aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJiri Kosina <jkosina@suse.cz>2012-02-03 17:12:42 -0500
committerJiri Kosina <jkosina@suse.cz>2012-02-03 17:13:05 -0500
commit972c5ae961d6e5103e2b33d935cfa4145fd47140 (patch)
tree350b2a76b979ba8766c09838617df67ff330eca0 /include
parent5196d20305d5e30d871111d3a876cf067dd94255 (diff)
parent7c7ed8ec337bf5f62cc5287a6eb6b2f1b7504c2f (diff)
Merge branch 'master' into for-next
Sync with Linus' tree to be able to apply patch to a newer code (namely drivers/gpu/drm/gma500/psb_intel_lvds.c)
Diffstat (limited to 'include')
-rw-r--r--include/acpi/acnames.h1
-rw-r--r--include/acpi/acpi_numa.h1
-rw-r--r--include/acpi/acpiosxf.h11
-rw-r--r--include/acpi/acpixf.h34
-rw-r--r--include/acpi/acrestyp.h207
-rw-r--r--include/acpi/actbl.h23
-rw-r--r--include/acpi/actbl1.h57
-rw-r--r--include/acpi/actbl3.h552
-rw-r--r--include/acpi/actypes.h12
-rw-r--r--include/acpi/apei.h4
-rw-r--r--include/acpi/atomicio.h10
-rw-r--r--include/acpi/processor.h1
-rw-r--r--include/asm-generic/gpio.h4
-rw-r--r--include/asm-generic/io.h6
-rw-r--r--include/asm-generic/iomap.h9
-rw-r--r--include/asm-generic/page.h10
-rw-r--r--include/asm-generic/param.h13
-rw-r--r--include/asm-generic/pci_iomap.h25
-rw-r--r--include/asm-generic/tlb.h14
-rw-r--r--include/asm-generic/uaccess.h7
-rw-r--r--include/crypto/algapi.h1
-rw-r--r--include/crypto/lrw.h43
-rw-r--r--include/crypto/serpent.h27
-rw-r--r--include/crypto/twofish.h2
-rw-r--r--include/crypto/xts.h27
-rw-r--r--include/drm/Kbuild1
-rw-r--r--include/drm/drm.h4
-rw-r--r--include/drm/drmP.h11
-rw-r--r--include/drm/drm_crtc.h214
-rw-r--r--include/drm/drm_crtc_helper.h5
-rw-r--r--include/drm/drm_fourcc.h137
-rw-r--r--include/drm/drm_mode.h74
-rw-r--r--include/drm/drm_sman.h176
-rw-r--r--include/drm/exynos_drm.h37
-rw-r--r--include/drm/gma_drm.h91
-rw-r--r--include/drm/i915_drm.h40
-rw-r--r--include/drm/radeon_drm.h36
-rw-r--r--include/drm/sis_drm.h4
-rw-r--r--include/drm/ttm/ttm_bo_api.h24
-rw-r--r--include/drm/ttm/ttm_bo_driver.h203
-rw-r--r--include/drm/ttm/ttm_page_alloc.h77
-rw-r--r--include/drm/via_drm.h4
-rw-r--r--include/keys/user-type.h3
-rw-r--r--include/linux/acct.h3
-rw-r--r--include/linux/acpi.h24
-rw-r--r--include/linux/acpi_io.h3
-rw-r--r--include/linux/ahci_platform.h2
-rw-r--r--include/linux/amba/mmci.h2
-rw-r--r--include/linux/amba/pl061.h2
-rw-r--r--include/linux/amba/pl08x.h4
-rw-r--r--include/linux/amba/pl330.h15
-rw-r--r--include/linux/amd-iommu.h138
-rw-r--r--include/linux/ata_platform.h3
-rw-r--r--include/linux/audit.h116
-rw-r--r--include/linux/bcma/bcma.h2
-rw-r--r--include/linux/bio.h66
-rw-r--r--include/linux/blkdev.h104
-rw-r--r--include/linux/capability.h4
-rw-r--r--include/linux/cgroup.h31
-rw-r--r--include/linux/clk.h22
-rw-r--r--include/linux/compiler-gcc.h5
-rw-r--r--include/linux/compiler-gcc4.h1
-rw-r--r--include/linux/compiler.h4
-rw-r--r--include/linux/console.h2
-rw-r--r--include/linux/cpuidle.h7
-rw-r--r--include/linux/crash_dump.h1
-rw-r--r--include/linux/cred.h6
-rw-r--r--include/linux/cuda.h5
-rw-r--r--include/linux/dcache.h3
-rw-r--r--include/linux/device.h15
-rw-r--r--include/linux/digsig.h64
-rw-r--r--include/linux/display.h61
-rw-r--r--include/linux/dlm.h71
-rw-r--r--include/linux/dma-buf.h176
-rw-r--r--include/linux/dmaengine.h99
-rw-r--r--include/linux/dvb/frontend.h19
-rw-r--r--include/linux/dvb/version.h2
-rw-r--r--include/linux/dw_dmac.h2
-rw-r--r--include/linux/efi.h136
-rw-r--r--include/linux/elevator.h41
-rw-r--r--include/linux/elf-em.h1
-rw-r--r--include/linux/elf.h18
-rw-r--r--include/linux/eventpoll.h1
-rw-r--r--include/linux/fb.h14
-rw-r--r--include/linux/freezer.h2
-rw-r--r--include/linux/fs.h15
-rw-r--r--include/linux/ftrace.h77
-rw-r--r--include/linux/fuse.h16
-rw-r--r--include/linux/gfp.h23
-rw-r--r--include/linux/gfs2_ondisk.h2
-rw-r--r--include/linux/gpio-pxa.h16
-rw-r--r--include/linux/hid.h21
-rw-r--r--include/linux/huge_mm.h2
-rw-r--r--include/linux/hyperv.h2
-rw-r--r--include/linux/i2c/twl.h2
-rw-r--r--include/linux/if_team.h10
-rw-r--r--include/linux/inet_diag.h14
-rw-r--r--include/linux/init.h3
-rw-r--r--include/linux/init_task.h9
-rw-r--r--include/linux/input/auo-pixcir-ts.h56
-rw-r--r--include/linux/input/gp2ap002a00f.h22
-rw-r--r--include/linux/input/gpio_tilt.h73
-rw-r--r--include/linux/input/pixcir_ts.h10
-rw-r--r--include/linux/input/samsung-keypad.h43
-rw-r--r--include/linux/input/tca8418_keypad.h44
-rw-r--r--include/linux/iocontext.h136
-rw-r--r--include/linux/iommu.h33
-rw-r--r--include/linux/isdn_divertif.h4
-rw-r--r--include/linux/jbd.h5
-rw-r--r--include/linux/jbd2.h1
-rw-r--r--include/linux/kernel.h30
-rw-r--r--include/linux/kexec.h2
-rw-r--r--include/linux/key-type.h1
-rw-r--r--include/linux/key.h5
-rw-r--r--include/linux/kmemleak.h8
-rw-r--r--include/linux/kmsg_dump.h1
-rw-r--r--include/linux/kref.h1
-rw-r--r--include/linux/kvm_host.h39
-rw-r--r--include/linux/kvm_para.h1
-rw-r--r--include/linux/leds-tca6507.h34
-rw-r--r--include/linux/linkage.h4
-rw-r--r--include/linux/lockd/lockd.h2
-rw-r--r--include/linux/lp8727.h51
-rw-r--r--include/linux/mbus.h13
-rw-r--r--include/linux/memcontrol.h107
-rw-r--r--include/linux/mempolicy.h10
-rw-r--r--include/linux/mfd/88pm860x.h3
-rw-r--r--include/linux/mfd/abx500/ab5500.h (renamed from include/linux/mfd/ab5500/ab5500.h)0
-rw-r--r--include/linux/mfd/abx500/ab8500-gpadc.h (renamed from include/linux/mfd/ab8500/gpadc.h)0
-rw-r--r--include/linux/mfd/abx500/ab8500-gpio.h (renamed from include/linux/mfd/ab8500/gpio.h)0
-rw-r--r--include/linux/mfd/abx500/ab8500-sysctrl.h (renamed from include/linux/mfd/ab8500/sysctrl.h)0
-rw-r--r--include/linux/mfd/abx500/ab8500.h (renamed from include/linux/mfd/ab8500.h)0
-rw-r--r--include/linux/mfd/da9052/da9052.h131
-rw-r--r--include/linux/mfd/da9052/pdata.h40
-rw-r--r--include/linux/mfd/da9052/reg.h749
-rw-r--r--include/linux/mfd/max8925.h9
-rw-r--r--include/linux/mfd/max8997.h83
-rw-r--r--include/linux/mfd/mc13xxx.h9
-rw-r--r--include/linux/mfd/mcp.h5
-rw-r--r--include/linux/mfd/s5m87xx/s5m-core.h373
-rw-r--r--include/linux/mfd/s5m87xx/s5m-pmic.h100
-rw-r--r--include/linux/mfd/s5m87xx/s5m-rtc.h84
-rw-r--r--include/linux/mfd/stmpe.h16
-rw-r--r--include/linux/mfd/tps65910.h30
-rw-r--r--include/linux/mfd/wm8994/core.h7
-rw-r--r--include/linux/mfd/wm8994/pdata.h31
-rw-r--r--include/linux/mfd/wm8994/registers.h112
-rw-r--r--include/linux/migrate.h11
-rw-r--r--include/linux/migrate_mode.h16
-rw-r--r--include/linux/miscdevice.h1
-rw-r--r--include/linux/mlx4/device.h1
-rw-r--r--include/linux/mm.h39
-rw-r--r--include/linux/mm_inline.h44
-rw-r--r--include/linux/mm_types.h9
-rw-r--r--include/linux/mmc/card.h23
-rw-r--r--include/linux/mmc/cd-gpio.h19
-rw-r--r--include/linux/mmc/core.h2
-rw-r--r--include/linux/mmc/dw_mmc.h1
-rw-r--r--include/linux/mmc/host.h27
-rw-r--r--include/linux/mmc/mmc.h72
-rw-r--r--include/linux/mmc/sdhci-pci-data.h18
-rw-r--r--include/linux/mmc/sdhci.h3
-rw-r--r--include/linux/mmc/sdio.h29
-rw-r--r--include/linux/mmzone.h34
-rw-r--r--include/linux/module.h21
-rw-r--r--include/linux/moduleparam.h17
-rw-r--r--include/linux/mpi.h144
-rw-r--r--include/linux/mroute6.h4
-rw-r--r--include/linux/msi.h3
-rw-r--r--include/linux/mtd/cfi.h16
-rw-r--r--include/linux/mtd/cfi_endian.h76
-rw-r--r--include/linux/mtd/gpmi-nand.h68
-rw-r--r--include/linux/mtd/map.h3
-rw-r--r--include/linux/mtd/mtd.h334
-rw-r--r--include/linux/mtd/nand.h1
-rw-r--r--include/linux/mtd/physmap.h1
-rw-r--r--include/linux/netdevice.h9
-rw-r--r--include/linux/netfilter/nf_conntrack_common.h4
-rw-r--r--include/linux/netfilter/x_tables.h4
-rw-r--r--include/linux/netfilter/xt_CT.h3
-rw-r--r--include/linux/nfs_fs_sb.h1
-rw-r--r--include/linux/nfs_idmap.h8
-rw-r--r--include/linux/nfs_xdr.h22
-rw-r--r--include/linux/nls.h5
-rw-r--r--include/linux/nvme.h434
-rw-r--r--include/linux/oom.h2
-rw-r--r--include/linux/page-debug-flags.h4
-rw-r--r--include/linux/page_cgroup.h46
-rw-r--r--include/linux/pagevec.h19
-rw-r--r--include/linux/patchkey.h4
-rw-r--r--include/linux/pci-aspm.h4
-rw-r--r--include/linux/pci.h51
-rw-r--r--include/linux/pci_ids.h23
-rw-r--r--include/linux/pci_regs.h36
-rw-r--r--include/linux/pda_power.h2
-rw-r--r--include/linux/percpu.h190
-rw-r--r--include/linux/perf_event.h1
-rw-r--r--include/linux/phy.h7
-rw-r--r--include/linux/pid_namespace.h2
-rw-r--r--include/linux/pinctrl/machine.h30
-rw-r--r--include/linux/pinctrl/pinconf.h97
-rw-r--r--include/linux/pinctrl/pinctrl.h15
-rw-r--r--include/linux/pinctrl/pinmux.h29
-rw-r--r--include/linux/pkt_sched.h20
-rw-r--r--include/linux/platform_data/macb.h17
-rw-r--r--include/linux/platform_data/mv_usb.h18
-rw-r--r--include/linux/platform_data/s3c-hsudc.h34
-rw-r--r--include/linux/pmu.h4
-rw-r--r--include/linux/power/charger-manager.h147
-rw-r--r--include/linux/power/sbs-battery.h (renamed from include/linux/power/bq20z75.h)10
-rw-r--r--include/linux/power_supply.h11
-rw-r--r--include/linux/prctl.h12
-rw-r--r--include/linux/proc_fs.h2
-rw-r--r--include/linux/ptrace.h15
-rw-r--r--include/linux/quota.h6
-rw-r--r--include/linux/radix-tree.h3
-rw-r--r--include/linux/raid/md_p.h7
-rw-r--r--include/linux/raid/pq.h2
-rw-r--r--include/linux/regmap.h59
-rw-r--r--include/linux/regulator/consumer.h13
-rw-r--r--include/linux/regulator/driver.h4
-rw-r--r--include/linux/regulator/of_regulator.h22
-rw-r--r--include/linux/res_counter.h11
-rw-r--r--include/linux/rmap.h5
-rw-r--r--include/linux/s3c_adc_battery.h4
-rw-r--r--include/linux/sched.h86
-rw-r--r--include/linux/security.h64
-rw-r--r--include/linux/serial_8250.h5
-rw-r--r--include/linux/serial_core.h104
-rw-r--r--include/linux/serial_sci.h22
-rw-r--r--include/linux/sh_clk.h10
-rw-r--r--include/linux/sh_dma.h4
-rw-r--r--include/linux/sh_pfc.h22
-rw-r--r--include/linux/shmem_fs.h1
-rw-r--r--include/linux/sigma.h55
-rw-r--r--include/linux/signal.h1
-rw-r--r--include/linux/sirfsoc_dma.h6
-rw-r--r--include/linux/slab_def.h2
-rw-r--r--include/linux/snmp.h1
-rw-r--r--include/linux/sound.h4
-rw-r--r--include/linux/soundcard.h4
-rw-r--r--include/linux/sunrpc/auth.h3
-rw-r--r--include/linux/sunrpc/auth_gss.h2
-rw-r--r--include/linux/sunrpc/svc_xprt.h3
-rw-r--r--include/linux/sunrpc/svcsock.h2
-rw-r--r--include/linux/sunrpc/xdr.h2
-rw-r--r--include/linux/suspend.h19
-rw-r--r--include/linux/swap.h3
-rw-r--r--include/linux/swiotlb.h2
-rw-r--r--include/linux/sysdev.h164
-rw-r--r--include/linux/thermal.h4
-rw-r--r--include/linux/tty_driver.h1
-rw-r--r--include/linux/ucb1400.h6
-rw-r--r--include/linux/usb.h15
-rw-r--r--include/linux/usb/ch11.h31
-rw-r--r--include/linux/usb/ch9.h20
-rw-r--r--include/linux/usb/gadget.h26
-rw-r--r--include/linux/usb/hcd.h2
-rw-r--r--include/linux/usb/langwell_otg.h139
-rw-r--r--include/linux/usb/renesas_usbhs.h10
-rw-r--r--include/linux/usb/serial.h11
-rw-r--r--include/linux/videodev2.h58
-rw-r--r--include/linux/virtio.h75
-rw-r--r--include/linux/virtio_ring.h1
-rw-r--r--include/linux/watchdog.h21
-rw-r--r--include/linux/workqueue.h47
-rw-r--r--include/linux/writeback.h12
-rw-r--r--include/linux/zorro_ids.h4
-rw-r--r--include/media/as3645a.h71
-rw-r--r--include/media/atmel-isi.h4
-rw-r--r--include/media/cx25840.h1
-rw-r--r--include/media/davinci/vpbe.h16
-rw-r--r--include/media/davinci/vpbe_venc.h4
-rw-r--r--include/media/davinci/vpif_types.h71
-rw-r--r--include/media/media-entity.h2
-rw-r--r--include/media/omap3isp.h2
-rw-r--r--include/media/pwc-ioctl.h323
-rw-r--r--include/media/rc-map.h10
-rw-r--r--include/media/soc_camera.h2
-rw-r--r--include/media/tuner.h3
-rw-r--r--include/media/v4l2-ioctl.h4
-rw-r--r--include/mtd/mtd-abi.h3
-rw-r--r--include/net/9p/9p.h28
-rw-r--r--include/net/bluetooth/hci.h2
-rw-r--r--include/net/bluetooth/hci_core.h4
-rw-r--r--include/net/cfg80211.h6
-rw-r--r--include/net/flow.h2
-rw-r--r--include/net/netns/generic.h1
-rw-r--r--include/net/netprio_cgroup.h1
-rw-r--r--include/net/red.h3
-rw-r--r--include/net/snmp.h14
-rw-r--r--include/net/sock.h14
-rw-r--r--include/net/tcp.h2
-rw-r--r--include/rdma/ib_addr.h2
-rw-r--r--include/rdma/ib_cm.h3
-rw-r--r--include/scsi/libfc.h2
-rw-r--r--include/scsi/scsi_device.h1
-rw-r--r--include/scsi/scsi_host.h3
-rw-r--r--include/scsi/scsi_transport_iscsi.h5
-rw-r--r--include/sound/Kbuild2
-rw-r--r--include/sound/compress_driver.h167
-rw-r--r--include/sound/compress_offload.h161
-rw-r--r--include/sound/compress_params.h397
-rw-r--r--include/sound/control.h8
-rw-r--r--include/sound/core.h3
-rw-r--r--include/sound/minors.h4
-rw-r--r--include/sound/saif.h4
-rw-r--r--include/sound/sh_fsi.h12
-rw-r--r--include/sound/soc-dapm.h5
-rw-r--r--include/sound/soc.h27
-rw-r--r--include/sound/sta32x.h35
-rw-r--r--include/sound/wm8903.h7
-rw-r--r--include/target/target_core_backend.h65
-rw-r--r--include/target/target_core_base.h169
-rw-r--r--include/target/target_core_device.h63
-rw-r--r--include/target/target_core_fabric.h (renamed from include/target/target_core_fabric_ops.h)94
-rw-r--r--include/target/target_core_fabric_lib.h28
-rw-r--r--include/target/target_core_tmr.h35
-rw-r--r--include/target/target_core_tpg.h35
-rw-r--r--include/target/target_core_transport.h287
-rw-r--r--include/trace/events/btrfs.h203
-rw-r--r--include/trace/events/ext4.h6
-rw-r--r--include/trace/events/kmem.h4
-rw-r--r--include/trace/events/oom.h33
-rw-r--r--include/trace/events/regmap.h9
-rw-r--r--include/trace/events/task.h61
-rw-r--r--include/trace/events/vmscan.h22
-rw-r--r--include/trace/events/writeback.h14
-rw-r--r--include/video/edid.h6
-rw-r--r--include/video/omapdss.h58
-rw-r--r--include/video/sh_mipi_dsi.h21
-rw-r--r--include/video/sh_mobile_lcdc.h4
-rw-r--r--include/xen/events.h7
-rw-r--r--include/xen/grant_table.h37
-rw-r--r--include/xen/interface/grant_table.h167
-rw-r--r--include/xen/interface/io/blkif.h40
-rw-r--r--include/xen/interface/io/xs_wire.h3
-rw-r--r--include/xen/interface/xen.h2
-rw-r--r--include/xen/xenbus.h31
-rw-r--r--include/xen/xenbus_dev.h41
340 files changed, 9903 insertions, 2941 deletions
diff --git a/include/acpi/acnames.h b/include/acpi/acnames.h
index fc1575fd4596..5b5af0d30a97 100644
--- a/include/acpi/acnames.h
+++ b/include/acpi/acnames.h
@@ -58,6 +58,7 @@
58#define METHOD_NAME__PRT "_PRT" 58#define METHOD_NAME__PRT "_PRT"
59#define METHOD_NAME__CRS "_CRS" 59#define METHOD_NAME__CRS "_CRS"
60#define METHOD_NAME__PRS "_PRS" 60#define METHOD_NAME__PRS "_PRS"
61#define METHOD_NAME__AEI "_AEI"
61#define METHOD_NAME__PRW "_PRW" 62#define METHOD_NAME__PRW "_PRW"
62#define METHOD_NAME__SRS "_SRS" 63#define METHOD_NAME__SRS "_SRS"
63 64
diff --git a/include/acpi/acpi_numa.h b/include/acpi/acpi_numa.h
index 173972672175..451823cb8837 100644
--- a/include/acpi/acpi_numa.h
+++ b/include/acpi/acpi_numa.h
@@ -15,6 +15,7 @@ extern int pxm_to_node(int);
15extern int node_to_pxm(int); 15extern int node_to_pxm(int);
16extern void __acpi_map_pxm_to_node(int, int); 16extern void __acpi_map_pxm_to_node(int, int);
17extern int acpi_map_pxm_to_node(int); 17extern int acpi_map_pxm_to_node(int);
18extern unsigned char acpi_srat_revision;
18 19
19#endif /* CONFIG_ACPI_NUMA */ 20#endif /* CONFIG_ACPI_NUMA */
20#endif /* __ACP_NUMA_H */ 21#endif /* __ACP_NUMA_H */
diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h
index 83062ed0ef2f..7c9aebe8a7aa 100644
--- a/include/acpi/acpiosxf.h
+++ b/include/acpi/acpiosxf.h
@@ -218,9 +218,13 @@ acpi_status acpi_os_write_port(acpi_io_address address, u32 value, u32 width);
218 */ 218 */
219acpi_status 219acpi_status
220acpi_os_read_memory(acpi_physical_address address, u32 * value, u32 width); 220acpi_os_read_memory(acpi_physical_address address, u32 * value, u32 width);
221acpi_status
222acpi_os_read_memory64(acpi_physical_address address, u64 *value, u32 width);
221 223
222acpi_status 224acpi_status
223acpi_os_write_memory(acpi_physical_address address, u32 value, u32 width); 225acpi_os_write_memory(acpi_physical_address address, u32 value, u32 width);
226acpi_status
227acpi_os_write_memory64(acpi_physical_address address, u64 value, u32 width);
224 228
225/* 229/*
226 * Platform and hardware-independent PCI configuration space access 230 * Platform and hardware-independent PCI configuration space access
@@ -238,13 +242,6 @@ acpi_os_write_pci_configuration(struct acpi_pci_id *pci_id,
238/* 242/*
239 * Miscellaneous 243 * Miscellaneous
240 */ 244 */
241acpi_status
242acpi_os_validate_address(u8 space_id, acpi_physical_address address,
243 acpi_size length, char *name);
244acpi_status
245acpi_os_invalidate_address(u8 space_id, acpi_physical_address address,
246 acpi_size length);
247
248u64 acpi_os_get_timer(void); 245u64 acpi_os_get_timer(void);
249 246
250acpi_status acpi_os_signal(u32 function, void *info); 247acpi_status acpi_os_signal(u32 function, void *info);
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index f554a9313b43..a28da35ba45e 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -47,7 +47,7 @@
47 47
48/* Current ACPICA subsystem version in YYYYMMDD format */ 48/* Current ACPICA subsystem version in YYYYMMDD format */
49 49
50#define ACPI_CA_VERSION 0x20110623 50#define ACPI_CA_VERSION 0x20120111
51 51
52#include "actypes.h" 52#include "actypes.h"
53#include "actbl.h" 53#include "actbl.h"
@@ -66,7 +66,7 @@ extern u8 acpi_gbl_create_osi_method;
66extern u8 acpi_gbl_use_default_register_widths; 66extern u8 acpi_gbl_use_default_register_widths;
67extern acpi_name acpi_gbl_trace_method_name; 67extern acpi_name acpi_gbl_trace_method_name;
68extern u32 acpi_gbl_trace_flags; 68extern u32 acpi_gbl_trace_flags;
69extern u32 acpi_gbl_enable_aml_debug_object; 69extern bool acpi_gbl_enable_aml_debug_object;
70extern u8 acpi_gbl_copy_dsdt_locally; 70extern u8 acpi_gbl_copy_dsdt_locally;
71extern u8 acpi_gbl_truncate_io_addresses; 71extern u8 acpi_gbl_truncate_io_addresses;
72extern u8 acpi_gbl_disable_auto_repair; 72extern u8 acpi_gbl_disable_auto_repair;
@@ -74,6 +74,7 @@ extern u8 acpi_gbl_disable_auto_repair;
74extern u32 acpi_current_gpe_count; 74extern u32 acpi_current_gpe_count;
75extern struct acpi_table_fadt acpi_gbl_FADT; 75extern struct acpi_table_fadt acpi_gbl_FADT;
76extern u8 acpi_gbl_system_awake_and_running; 76extern u8 acpi_gbl_system_awake_and_running;
77extern u8 acpi_gbl_reduced_hardware; /* ACPI 5.0 */
77 78
78extern u32 acpi_rsdt_forced; 79extern u32 acpi_rsdt_forced;
79/* 80/*
@@ -111,6 +112,11 @@ acpi_status acpi_install_interface(acpi_string interface_name);
111 112
112acpi_status acpi_remove_interface(acpi_string interface_name); 113acpi_status acpi_remove_interface(acpi_string interface_name);
113 114
115u32
116acpi_check_address_range(acpi_adr_space_type space_id,
117 acpi_physical_address address,
118 acpi_size length, u8 warn);
119
114/* 120/*
115 * ACPI Memory management 121 * ACPI Memory management
116 */ 122 */
@@ -276,12 +282,23 @@ acpi_status acpi_install_exception_handler(acpi_exception_handler handler);
276acpi_status acpi_install_interface_handler(acpi_interface_handler handler); 282acpi_status acpi_install_interface_handler(acpi_interface_handler handler);
277 283
278/* 284/*
279 * Event interfaces 285 * Global Lock interfaces
280 */ 286 */
281acpi_status acpi_acquire_global_lock(u16 timeout, u32 * handle); 287acpi_status acpi_acquire_global_lock(u16 timeout, u32 * handle);
282 288
283acpi_status acpi_release_global_lock(u32 handle); 289acpi_status acpi_release_global_lock(u32 handle);
284 290
291/*
292 * Interfaces to AML mutex objects
293 */
294acpi_status
295acpi_acquire_mutex(acpi_handle handle, acpi_string pathname, u16 timeout);
296
297acpi_status acpi_release_mutex(acpi_handle handle, acpi_string pathname);
298
299/*
300 * Fixed Event interfaces
301 */
285acpi_status acpi_enable_event(u32 event, u32 flags); 302acpi_status acpi_enable_event(u32 event, u32 flags);
286 303
287acpi_status acpi_disable_event(u32 event, u32 flags); 304acpi_status acpi_disable_event(u32 event, u32 flags);
@@ -291,7 +308,7 @@ acpi_status acpi_clear_event(u32 event);
291acpi_status acpi_get_event_status(u32 event, acpi_event_status * event_status); 308acpi_status acpi_get_event_status(u32 event, acpi_event_status * event_status);
292 309
293/* 310/*
294 * GPE Interfaces 311 * General Purpose Event (GPE) Interfaces
295 */ 312 */
296acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number); 313acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number);
297 314
@@ -346,6 +363,10 @@ acpi_get_possible_resources(acpi_handle device, struct acpi_buffer *ret_buffer);
346#endif 363#endif
347 364
348acpi_status 365acpi_status
366acpi_get_event_resources(acpi_handle device_handle,
367 struct acpi_buffer *ret_buffer);
368
369acpi_status
349acpi_walk_resources(acpi_handle device, 370acpi_walk_resources(acpi_handle device,
350 char *name, 371 char *name,
351 acpi_walk_resource_callback user_function, void *context); 372 acpi_walk_resource_callback user_function, void *context);
@@ -360,6 +381,11 @@ acpi_status
360acpi_resource_to_address64(struct acpi_resource *resource, 381acpi_resource_to_address64(struct acpi_resource *resource,
361 struct acpi_resource_address64 *out); 382 struct acpi_resource_address64 *out);
362 383
384acpi_status
385acpi_buffer_to_resource(u8 *aml_buffer,
386 u16 aml_buffer_length,
387 struct acpi_resource **resource_ptr);
388
363/* 389/*
364 * Hardware (ACPI device) interfaces 390 * Hardware (ACPI device) interfaces
365 */ 391 */
diff --git a/include/acpi/acrestyp.h b/include/acpi/acrestyp.h
index 0a66cc45dd6b..3506e39a66b1 100644
--- a/include/acpi/acrestyp.h
+++ b/include/acpi/acrestyp.h
@@ -61,11 +61,14 @@ typedef u32 acpi_rsdesc_size; /* Max Resource Descriptor size is (Length+3) = (6
61#define ACPI_WRITE_COMBINING_MEMORY (u8) 0x02 61#define ACPI_WRITE_COMBINING_MEMORY (u8) 0x02
62#define ACPI_PREFETCHABLE_MEMORY (u8) 0x03 62#define ACPI_PREFETCHABLE_MEMORY (u8) 0x03
63 63
64/*! [Begin] no source code translation */
64/* 65/*
65 * IO Attributes 66 * IO Attributes
66 * The ISA IO ranges are: n000-n0_fFh, n400-n4_fFh, n800-n8_fFh, n_c00-n_cFFh. 67 * The ISA IO ranges are: n000-n0FFh, n400-n4FFh, n800-n8FFh, nC00-nCFFh.
67 * The non-ISA IO ranges are: n100-n3_fFh, n500-n7_fFh, n900-n_bFFh, n_cd0-n_fFFh. 68 * The non-ISA IO ranges are: n100-n3FFh, n500-n7FFh, n900-nBFFh, nCD0-nFFFh.
68 */ 69 */
70/*! [End] no source code translation !*/
71
69#define ACPI_NON_ISA_ONLY_RANGES (u8) 0x01 72#define ACPI_NON_ISA_ONLY_RANGES (u8) 0x01
70#define ACPI_ISA_ONLY_RANGES (u8) 0x02 73#define ACPI_ISA_ONLY_RANGES (u8) 0x02
71#define ACPI_ENTIRE_RANGE (ACPI_NON_ISA_ONLY_RANGES | ACPI_ISA_ONLY_RANGES) 74#define ACPI_ENTIRE_RANGE (ACPI_NON_ISA_ONLY_RANGES | ACPI_ISA_ONLY_RANGES)
@@ -81,16 +84,26 @@ typedef u32 acpi_rsdesc_size; /* Max Resource Descriptor size is (Length+3) = (6
81#define ACPI_DECODE_16 (u8) 0x01 /* 16-bit IO address decode */ 84#define ACPI_DECODE_16 (u8) 0x01 /* 16-bit IO address decode */
82 85
83/* 86/*
84 * IRQ Attributes 87 * Interrupt attributes - used in multiple descriptors
85 */ 88 */
89
90/* Triggering */
91
86#define ACPI_LEVEL_SENSITIVE (u8) 0x00 92#define ACPI_LEVEL_SENSITIVE (u8) 0x00
87#define ACPI_EDGE_SENSITIVE (u8) 0x01 93#define ACPI_EDGE_SENSITIVE (u8) 0x01
88 94
95/* Polarity */
96
89#define ACPI_ACTIVE_HIGH (u8) 0x00 97#define ACPI_ACTIVE_HIGH (u8) 0x00
90#define ACPI_ACTIVE_LOW (u8) 0x01 98#define ACPI_ACTIVE_LOW (u8) 0x01
99#define ACPI_ACTIVE_BOTH (u8) 0x02
100
101/* Sharing */
91 102
92#define ACPI_EXCLUSIVE (u8) 0x00 103#define ACPI_EXCLUSIVE (u8) 0x00
93#define ACPI_SHARED (u8) 0x01 104#define ACPI_SHARED (u8) 0x01
105#define ACPI_EXCLUSIVE_AND_WAKE (u8) 0x02
106#define ACPI_SHARED_AND_WAKE (u8) 0x03
94 107
95/* 108/*
96 * DMA Attributes 109 * DMA Attributes
@@ -127,6 +140,8 @@ typedef u32 acpi_rsdesc_size; /* Max Resource Descriptor size is (Length+3) = (6
127#define ACPI_POS_DECODE (u8) 0x00 140#define ACPI_POS_DECODE (u8) 0x00
128#define ACPI_SUB_DECODE (u8) 0x01 141#define ACPI_SUB_DECODE (u8) 0x01
129 142
143/* Producer/Consumer */
144
130#define ACPI_PRODUCER (u8) 0x00 145#define ACPI_PRODUCER (u8) 0x00
131#define ACPI_CONSUMER (u8) 0x01 146#define ACPI_CONSUMER (u8) 0x01
132 147
@@ -192,6 +207,21 @@ struct acpi_resource_fixed_io {
192 u8 address_length; 207 u8 address_length;
193}; 208};
194 209
210struct acpi_resource_fixed_dma {
211 u16 request_lines;
212 u16 channels;
213 u8 width;
214};
215
216/* Values for Width field above */
217
218#define ACPI_DMA_WIDTH8 0
219#define ACPI_DMA_WIDTH16 1
220#define ACPI_DMA_WIDTH32 2
221#define ACPI_DMA_WIDTH64 3
222#define ACPI_DMA_WIDTH128 4
223#define ACPI_DMA_WIDTH256 5
224
195struct acpi_resource_vendor { 225struct acpi_resource_vendor {
196 u16 byte_length; 226 u16 byte_length;
197 u8 byte_data[1]; 227 u8 byte_data[1];
@@ -329,6 +359,166 @@ struct acpi_resource_generic_register {
329 u64 address; 359 u64 address;
330}; 360};
331 361
362struct acpi_resource_gpio {
363 u8 revision_id;
364 u8 connection_type;
365 u8 producer_consumer; /* For values, see Producer/Consumer above */
366 u8 pin_config;
367 u8 sharable; /* For values, see Interrupt Attributes above */
368 u8 io_restriction;
369 u8 triggering; /* For values, see Interrupt Attributes above */
370 u8 polarity; /* For values, see Interrupt Attributes above */
371 u16 drive_strength;
372 u16 debounce_timeout;
373 u16 pin_table_length;
374 u16 vendor_length;
375 struct acpi_resource_source resource_source;
376 u16 *pin_table;
377 u8 *vendor_data;
378};
379
380/* Values for GPIO connection_type field above */
381
382#define ACPI_RESOURCE_GPIO_TYPE_INT 0
383#define ACPI_RESOURCE_GPIO_TYPE_IO 1
384
385/* Values for pin_config field above */
386
387#define ACPI_PIN_CONFIG_DEFAULT 0
388#define ACPI_PIN_CONFIG_PULLUP 1
389#define ACPI_PIN_CONFIG_PULLDOWN 2
390#define ACPI_PIN_CONFIG_NOPULL 3
391
392/* Values for io_restriction field above */
393
394#define ACPI_IO_RESTRICT_NONE 0
395#define ACPI_IO_RESTRICT_INPUT 1
396#define ACPI_IO_RESTRICT_OUTPUT 2
397#define ACPI_IO_RESTRICT_NONE_PRESERVE 3
398
399/* Common structure for I2C, SPI, and UART serial descriptors */
400
401#define ACPI_RESOURCE_SERIAL_COMMON \
402 u8 revision_id; \
403 u8 type; \
404 u8 producer_consumer; /* For values, see Producer/Consumer above */\
405 u8 slave_mode; \
406 u8 type_revision_id; \
407 u16 type_data_length; \
408 u16 vendor_length; \
409 struct acpi_resource_source resource_source; \
410 u8 *vendor_data;
411
412struct acpi_resource_common_serialbus {
413ACPI_RESOURCE_SERIAL_COMMON};
414
415/* Values for the Type field above */
416
417#define ACPI_RESOURCE_SERIAL_TYPE_I2C 1
418#define ACPI_RESOURCE_SERIAL_TYPE_SPI 2
419#define ACPI_RESOURCE_SERIAL_TYPE_UART 3
420
421/* Values for slave_mode field above */
422
423#define ACPI_CONTROLLER_INITIATED 0
424#define ACPI_DEVICE_INITIATED 1
425
426struct acpi_resource_i2c_serialbus {
427 ACPI_RESOURCE_SERIAL_COMMON u8 access_mode;
428 u16 slave_address;
429 u32 connection_speed;
430};
431
432/* Values for access_mode field above */
433
434#define ACPI_I2C_7BIT_MODE 0
435#define ACPI_I2C_10BIT_MODE 1
436
437struct acpi_resource_spi_serialbus {
438 ACPI_RESOURCE_SERIAL_COMMON u8 wire_mode;
439 u8 device_polarity;
440 u8 data_bit_length;
441 u8 clock_phase;
442 u8 clock_polarity;
443 u16 device_selection;
444 u32 connection_speed;
445};
446
447/* Values for wire_mode field above */
448
449#define ACPI_SPI_4WIRE_MODE 0
450#define ACPI_SPI_3WIRE_MODE 1
451
452/* Values for device_polarity field above */
453
454#define ACPI_SPI_ACTIVE_LOW 0
455#define ACPI_SPI_ACTIVE_HIGH 1
456
457/* Values for clock_phase field above */
458
459#define ACPI_SPI_FIRST_PHASE 0
460#define ACPI_SPI_SECOND_PHASE 1
461
462/* Values for clock_polarity field above */
463
464#define ACPI_SPI_START_LOW 0
465#define ACPI_SPI_START_HIGH 1
466
467struct acpi_resource_uart_serialbus {
468 ACPI_RESOURCE_SERIAL_COMMON u8 endian;
469 u8 data_bits;
470 u8 stop_bits;
471 u8 flow_control;
472 u8 parity;
473 u8 lines_enabled;
474 u16 rx_fifo_size;
475 u16 tx_fifo_size;
476 u32 default_baud_rate;
477};
478
479/* Values for Endian field above */
480
481#define ACPI_UART_LITTLE_ENDIAN 0
482#define ACPI_UART_BIG_ENDIAN 1
483
484/* Values for data_bits field above */
485
486#define ACPI_UART_5_DATA_BITS 0
487#define ACPI_UART_6_DATA_BITS 1
488#define ACPI_UART_7_DATA_BITS 2
489#define ACPI_UART_8_DATA_BITS 3
490#define ACPI_UART_9_DATA_BITS 4
491
492/* Values for stop_bits field above */
493
494#define ACPI_UART_NO_STOP_BITS 0
495#define ACPI_UART_1_STOP_BIT 1
496#define ACPI_UART_1P5_STOP_BITS 2
497#define ACPI_UART_2_STOP_BITS 3
498
499/* Values for flow_control field above */
500
501#define ACPI_UART_FLOW_CONTROL_NONE 0
502#define ACPI_UART_FLOW_CONTROL_HW 1
503#define ACPI_UART_FLOW_CONTROL_XON_XOFF 2
504
505/* Values for Parity field above */
506
507#define ACPI_UART_PARITY_NONE 0
508#define ACPI_UART_PARITY_EVEN 1
509#define ACPI_UART_PARITY_ODD 2
510#define ACPI_UART_PARITY_MARK 3
511#define ACPI_UART_PARITY_SPACE 4
512
513/* Values for lines_enabled bitfield above */
514
515#define ACPI_UART_CARRIER_DETECT (1<<2)
516#define ACPI_UART_RING_INDICATOR (1<<3)
517#define ACPI_UART_DATA_SET_READY (1<<4)
518#define ACPI_UART_DATA_TERMINAL_READY (1<<5)
519#define ACPI_UART_CLEAR_TO_SEND (1<<6)
520#define ACPI_UART_REQUEST_TO_SEND (1<<7)
521
332/* ACPI_RESOURCE_TYPEs */ 522/* ACPI_RESOURCE_TYPEs */
333 523
334#define ACPI_RESOURCE_TYPE_IRQ 0 524#define ACPI_RESOURCE_TYPE_IRQ 0
@@ -348,7 +538,10 @@ struct acpi_resource_generic_register {
348#define ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 14 /* ACPI 3.0 */ 538#define ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 14 /* ACPI 3.0 */
349#define ACPI_RESOURCE_TYPE_EXTENDED_IRQ 15 539#define ACPI_RESOURCE_TYPE_EXTENDED_IRQ 15
350#define ACPI_RESOURCE_TYPE_GENERIC_REGISTER 16 540#define ACPI_RESOURCE_TYPE_GENERIC_REGISTER 16
351#define ACPI_RESOURCE_TYPE_MAX 16 541#define ACPI_RESOURCE_TYPE_GPIO 17 /* ACPI 5.0 */
542#define ACPI_RESOURCE_TYPE_FIXED_DMA 18 /* ACPI 5.0 */
543#define ACPI_RESOURCE_TYPE_SERIAL_BUS 19 /* ACPI 5.0 */
544#define ACPI_RESOURCE_TYPE_MAX 19
352 545
353/* Master union for resource descriptors */ 546/* Master union for resource descriptors */
354 547
@@ -358,6 +551,7 @@ union acpi_resource_data {
358 struct acpi_resource_start_dependent start_dpf; 551 struct acpi_resource_start_dependent start_dpf;
359 struct acpi_resource_io io; 552 struct acpi_resource_io io;
360 struct acpi_resource_fixed_io fixed_io; 553 struct acpi_resource_fixed_io fixed_io;
554 struct acpi_resource_fixed_dma fixed_dma;
361 struct acpi_resource_vendor vendor; 555 struct acpi_resource_vendor vendor;
362 struct acpi_resource_vendor_typed vendor_typed; 556 struct acpi_resource_vendor_typed vendor_typed;
363 struct acpi_resource_end_tag end_tag; 557 struct acpi_resource_end_tag end_tag;
@@ -370,6 +564,11 @@ union acpi_resource_data {
370 struct acpi_resource_extended_address64 ext_address64; 564 struct acpi_resource_extended_address64 ext_address64;
371 struct acpi_resource_extended_irq extended_irq; 565 struct acpi_resource_extended_irq extended_irq;
372 struct acpi_resource_generic_register generic_reg; 566 struct acpi_resource_generic_register generic_reg;
567 struct acpi_resource_gpio gpio;
568 struct acpi_resource_i2c_serialbus i2c_serial_bus;
569 struct acpi_resource_spi_serialbus spi_serial_bus;
570 struct acpi_resource_uart_serialbus uart_serial_bus;
571 struct acpi_resource_common_serialbus common_serial_bus;
373 572
374 /* Common fields */ 573 /* Common fields */
375 574
diff --git a/include/acpi/actbl.h b/include/acpi/actbl.h
index f1380287ed4d..8e1b92f6f650 100644
--- a/include/acpi/actbl.h
+++ b/include/acpi/actbl.h
@@ -255,6 +255,8 @@ struct acpi_table_fadt {
255 struct acpi_generic_address xpm_timer_block; /* 64-bit Extended Power Mgt Timer Ctrl Reg Blk address */ 255 struct acpi_generic_address xpm_timer_block; /* 64-bit Extended Power Mgt Timer Ctrl Reg Blk address */
256 struct acpi_generic_address xgpe0_block; /* 64-bit Extended General Purpose Event 0 Reg Blk address */ 256 struct acpi_generic_address xgpe0_block; /* 64-bit Extended General Purpose Event 0 Reg Blk address */
257 struct acpi_generic_address xgpe1_block; /* 64-bit Extended General Purpose Event 1 Reg Blk address */ 257 struct acpi_generic_address xgpe1_block; /* 64-bit Extended General Purpose Event 1 Reg Blk address */
258 struct acpi_generic_address sleep_control; /* 64-bit Sleep Control register */
259 struct acpi_generic_address sleep_status; /* 64-bit Sleep Status register */
258}; 260};
259 261
260/* Masks for FADT Boot Architecture Flags (boot_flags) */ 262/* Masks for FADT Boot Architecture Flags (boot_flags) */
@@ -264,6 +266,7 @@ struct acpi_table_fadt {
264#define ACPI_FADT_NO_VGA (1<<2) /* 02: [V4] It is not safe to probe for VGA hardware */ 266#define ACPI_FADT_NO_VGA (1<<2) /* 02: [V4] It is not safe to probe for VGA hardware */
265#define ACPI_FADT_NO_MSI (1<<3) /* 03: [V4] Message Signaled Interrupts (MSI) must not be enabled */ 267#define ACPI_FADT_NO_MSI (1<<3) /* 03: [V4] Message Signaled Interrupts (MSI) must not be enabled */
266#define ACPI_FADT_NO_ASPM (1<<4) /* 04: [V4] PCIe ASPM control must not be enabled */ 268#define ACPI_FADT_NO_ASPM (1<<4) /* 04: [V4] PCIe ASPM control must not be enabled */
269#define ACPI_FADT_NO_CMOS_RTC (1<<5) /* 05: [V5] No CMOS real-time clock present */
267 270
268#define FADT2_REVISION_ID 3 271#define FADT2_REVISION_ID 3
269 272
@@ -289,6 +292,8 @@ struct acpi_table_fadt {
289#define ACPI_FADT_REMOTE_POWER_ON (1<<17) /* 17: [V4] System is compatible with remote power on (ACPI 3.0) */ 292#define ACPI_FADT_REMOTE_POWER_ON (1<<17) /* 17: [V4] System is compatible with remote power on (ACPI 3.0) */
290#define ACPI_FADT_APIC_CLUSTER (1<<18) /* 18: [V4] All local APICs must use cluster model (ACPI 3.0) */ 293#define ACPI_FADT_APIC_CLUSTER (1<<18) /* 18: [V4] All local APICs must use cluster model (ACPI 3.0) */
291#define ACPI_FADT_APIC_PHYSICAL (1<<19) /* 19: [V4] All local x_aPICs must use physical dest mode (ACPI 3.0) */ 294#define ACPI_FADT_APIC_PHYSICAL (1<<19) /* 19: [V4] All local x_aPICs must use physical dest mode (ACPI 3.0) */
295#define ACPI_FADT_HW_REDUCED (1<<20) /* 20: [V5] ACPI hardware is not implemented (ACPI 5.0) */
296#define ACPI_FADT_LOW_POWER_S0 (1<<21) /* 21: [V5] S0 power savings are equal or better than S3 (ACPI 5.0) */
292 297
293/* Values for preferred_profile (Preferred Power Management Profiles) */ 298/* Values for preferred_profile (Preferred Power Management Profiles) */
294 299
@@ -299,14 +304,16 @@ enum acpi_prefered_pm_profiles {
299 PM_WORKSTATION = 3, 304 PM_WORKSTATION = 3,
300 PM_ENTERPRISE_SERVER = 4, 305 PM_ENTERPRISE_SERVER = 4,
301 PM_SOHO_SERVER = 5, 306 PM_SOHO_SERVER = 5,
302 PM_APPLIANCE_PC = 6 307 PM_APPLIANCE_PC = 6,
308 PM_PERFORMANCE_SERVER = 7,
309 PM_TABLET = 8
303}; 310};
304 311
305/* Reset to default packing */ 312/* Reset to default packing */
306 313
307#pragma pack() 314#pragma pack()
308 315
309#define ACPI_FADT_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_fadt, f) 316#define ACPI_FADT_OFFSET(f) (u16) ACPI_OFFSET (struct acpi_table_fadt, f)
310 317
311/* 318/*
312 * Internal table-related structures 319 * Internal table-related structures
@@ -342,6 +349,7 @@ struct acpi_table_desc {
342 349
343#include <acpi/actbl1.h> 350#include <acpi/actbl1.h>
344#include <acpi/actbl2.h> 351#include <acpi/actbl2.h>
352#include <acpi/actbl3.h>
345 353
346/* 354/*
347 * Sizes of the various flavors of FADT. We need to look closely 355 * Sizes of the various flavors of FADT. We need to look closely
@@ -351,12 +359,15 @@ struct acpi_table_desc {
351 * FADT is the bottom line as to what the version really is. 359 * FADT is the bottom line as to what the version really is.
352 * 360 *
353 * For reference, the values below are as follows: 361 * For reference, the values below are as follows:
354 * FADT V1 size: 0x74 362 * FADT V1 size: 0x074
355 * FADT V2 size: 0x84 363 * FADT V2 size: 0x084
356 * FADT V3+ size: 0xF4 364 * FADT V3 size: 0x0F4
365 * FADT V4 size: 0x0F4
366 * FADT V5 size: 0x10C
357 */ 367 */
358#define ACPI_FADT_V1_SIZE (u32) (ACPI_FADT_OFFSET (flags) + 4) 368#define ACPI_FADT_V1_SIZE (u32) (ACPI_FADT_OFFSET (flags) + 4)
359#define ACPI_FADT_V2_SIZE (u32) (ACPI_FADT_OFFSET (reserved4[0]) + 3) 369#define ACPI_FADT_V2_SIZE (u32) (ACPI_FADT_OFFSET (reserved4[0]) + 3)
360#define ACPI_FADT_V3_SIZE (u32) (sizeof (struct acpi_table_fadt)) 370#define ACPI_FADT_V3_SIZE (u32) (ACPI_FADT_OFFSET (sleep_control))
371#define ACPI_FADT_V5_SIZE (u32) (sizeof (struct acpi_table_fadt))
361 372
362#endif /* __ACTBL_H__ */ 373#endif /* __ACTBL_H__ */
diff --git a/include/acpi/actbl1.h b/include/acpi/actbl1.h
index 7504bc99b29b..71e747beac8f 100644
--- a/include/acpi/actbl1.h
+++ b/include/acpi/actbl1.h
@@ -228,7 +228,8 @@ enum acpi_einj_actions {
228 ACPI_EINJ_EXECUTE_OPERATION = 5, 228 ACPI_EINJ_EXECUTE_OPERATION = 5,
229 ACPI_EINJ_CHECK_BUSY_STATUS = 6, 229 ACPI_EINJ_CHECK_BUSY_STATUS = 6,
230 ACPI_EINJ_GET_COMMAND_STATUS = 7, 230 ACPI_EINJ_GET_COMMAND_STATUS = 7,
231 ACPI_EINJ_ACTION_RESERVED = 8, /* 8 and greater are reserved */ 231 ACPI_EINJ_SET_ERROR_TYPE_WITH_ADDRESS = 8,
232 ACPI_EINJ_ACTION_RESERVED = 9, /* 9 and greater are reserved */
232 ACPI_EINJ_TRIGGER_ERROR = 0xFF /* Except for this value */ 233 ACPI_EINJ_TRIGGER_ERROR = 0xFF /* Except for this value */
233}; 234};
234 235
@@ -240,7 +241,27 @@ enum acpi_einj_instructions {
240 ACPI_EINJ_WRITE_REGISTER = 2, 241 ACPI_EINJ_WRITE_REGISTER = 2,
241 ACPI_EINJ_WRITE_REGISTER_VALUE = 3, 242 ACPI_EINJ_WRITE_REGISTER_VALUE = 3,
242 ACPI_EINJ_NOOP = 4, 243 ACPI_EINJ_NOOP = 4,
243 ACPI_EINJ_INSTRUCTION_RESERVED = 5 /* 5 and greater are reserved */ 244 ACPI_EINJ_FLUSH_CACHELINE = 5,
245 ACPI_EINJ_INSTRUCTION_RESERVED = 6 /* 6 and greater are reserved */
246};
247
248struct acpi_einj_error_type_with_addr {
249 u32 error_type;
250 u32 vendor_struct_offset;
251 u32 flags;
252 u32 apic_id;
253 u64 address;
254 u64 range;
255 u32 pcie_id;
256};
257
258struct acpi_einj_vendor {
259 u32 length;
260 u32 pcie_id;
261 u16 vendor_id;
262 u16 device_id;
263 u8 revision_id;
264 u8 reserved[3];
244}; 265};
245 266
246/* EINJ Trigger Error Action Table */ 267/* EINJ Trigger Error Action Table */
@@ -275,6 +296,7 @@ enum acpi_einj_command_status {
275#define ACPI_EINJ_PLATFORM_CORRECTABLE (1<<9) 296#define ACPI_EINJ_PLATFORM_CORRECTABLE (1<<9)
276#define ACPI_EINJ_PLATFORM_UNCORRECTABLE (1<<10) 297#define ACPI_EINJ_PLATFORM_UNCORRECTABLE (1<<10)
277#define ACPI_EINJ_PLATFORM_FATAL (1<<11) 298#define ACPI_EINJ_PLATFORM_FATAL (1<<11)
299#define ACPI_EINJ_VENDOR_DEFINED (1<<31)
278 300
279/******************************************************************************* 301/*******************************************************************************
280 * 302 *
@@ -631,7 +653,9 @@ enum acpi_madt_type {
631 ACPI_MADT_TYPE_INTERRUPT_SOURCE = 8, 653 ACPI_MADT_TYPE_INTERRUPT_SOURCE = 8,
632 ACPI_MADT_TYPE_LOCAL_X2APIC = 9, 654 ACPI_MADT_TYPE_LOCAL_X2APIC = 9,
633 ACPI_MADT_TYPE_LOCAL_X2APIC_NMI = 10, 655 ACPI_MADT_TYPE_LOCAL_X2APIC_NMI = 10,
634 ACPI_MADT_TYPE_RESERVED = 11 /* 11 and greater are reserved */ 656 ACPI_MADT_TYPE_GENERIC_INTERRUPT = 11,
657 ACPI_MADT_TYPE_GENERIC_DISTRIBUTOR = 12,
658 ACPI_MADT_TYPE_RESERVED = 13 /* 13 and greater are reserved */
635}; 659};
636 660
637/* 661/*
@@ -752,11 +776,36 @@ struct acpi_madt_local_x2apic_nmi {
752 u8 reserved[3]; 776 u8 reserved[3];
753}; 777};
754 778
779/* 11: Generic Interrupt (ACPI 5.0) */
780
781struct acpi_madt_generic_interrupt {
782 struct acpi_subtable_header header;
783 u16 reserved; /* Reserved - must be zero */
784 u32 gic_id;
785 u32 uid;
786 u32 flags;
787 u32 parking_version;
788 u32 performance_interrupt;
789 u64 parked_address;
790 u64 base_address;
791};
792
793/* 12: Generic Distributor (ACPI 5.0) */
794
795struct acpi_madt_generic_distributor {
796 struct acpi_subtable_header header;
797 u16 reserved; /* Reserved - must be zero */
798 u32 gic_id;
799 u64 base_address;
800 u32 global_irq_base;
801 u32 reserved2; /* Reserved - must be zero */
802};
803
755/* 804/*
756 * Common flags fields for MADT subtables 805 * Common flags fields for MADT subtables
757 */ 806 */
758 807
759/* MADT Local APIC flags (lapic_flags) */ 808/* MADT Local APIC flags (lapic_flags) and GIC flags */
760 809
761#define ACPI_MADT_ENABLED (1) /* 00: Processor is usable if set */ 810#define ACPI_MADT_ENABLED (1) /* 00: Processor is usable if set */
762 811
diff --git a/include/acpi/actbl3.h b/include/acpi/actbl3.h
new file mode 100644
index 000000000000..c22ce80e9535
--- /dev/null
+++ b/include/acpi/actbl3.h
@@ -0,0 +1,552 @@
1/******************************************************************************
2 *
3 * Name: actbl3.h - ACPI Table Definitions
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44#ifndef __ACTBL3_H__
45#define __ACTBL3_H__
46
47/*******************************************************************************
48 *
49 * Additional ACPI Tables (3)
50 *
51 * These tables are not consumed directly by the ACPICA subsystem, but are
52 * included here to support device drivers and the AML disassembler.
53 *
54 * The tables in this file are fully defined within the ACPI specification.
55 *
56 ******************************************************************************/
57
58/*
59 * Values for description table header signatures for tables defined in this
60 * file. Useful because they make it more difficult to inadvertently type in
61 * the wrong signature.
62 */
63#define ACPI_SIG_BGRT "BGRT" /* Boot Graphics Resource Table */
64#define ACPI_SIG_DRTM "DRTM" /* Dynamic Root of Trust for Measurement table */
65#define ACPI_SIG_FPDT "FPDT" /* Firmware Performance Data Table */
66#define ACPI_SIG_GTDT "GTDT" /* Generic Timer Description Table */
67#define ACPI_SIG_MPST "MPST" /* Memory Power State Table */
68#define ACPI_SIG_PCCT "PCCT" /* Platform Communications Channel Table */
69#define ACPI_SIG_PMTT "PMTT" /* Platform Memory Topology Table */
70#define ACPI_SIG_RASF "RASF" /* RAS Feature table */
71
72#define ACPI_SIG_S3PT "S3PT" /* S3 Performance (sub)Table */
73#define ACPI_SIG_PCCS "PCC" /* PCC Shared Memory Region */
74
75/* Reserved table signatures */
76
77#define ACPI_SIG_CSRT "CSRT" /* Core System Resources Table */
78#define ACPI_SIG_DBG2 "DBG2" /* Debug Port table 2 */
79#define ACPI_SIG_MATR "MATR" /* Memory Address Translation Table */
80#define ACPI_SIG_MSDM "MSDM" /* Microsoft Data Management Table */
81#define ACPI_SIG_WPBT "WPBT" /* Windows Platform Binary Table */
82
83/*
84 * All tables must be byte-packed to match the ACPI specification, since
85 * the tables are provided by the system BIOS.
86 */
87#pragma pack(1)
88
89/*
90 * Note about bitfields: The u8 type is used for bitfields in ACPI tables.
91 * This is the only type that is even remotely portable. Anything else is not
92 * portable, so do not use any other bitfield types.
93 */
94
95/*******************************************************************************
96 *
97 * BGRT - Boot Graphics Resource Table (ACPI 5.0)
98 * Version 1
99 *
100 ******************************************************************************/
101
102struct acpi_table_bgrt {
103 struct acpi_table_header header; /* Common ACPI table header */
104 u16 version;
105 u8 status;
106 u8 image_type;
107 u64 image_address;
108 u32 image_offset_x;
109 u32 image_offset_y;
110};
111
112/*******************************************************************************
113 *
114 * DRTM - Dynamic Root of Trust for Measurement table
115 *
116 ******************************************************************************/
117
118struct acpi_table_drtm {
119 struct acpi_table_header header; /* Common ACPI table header */
120 u64 entry_base_address;
121 u64 entry_length;
122 u32 entry_address32;
123 u64 entry_address64;
124 u64 exit_address;
125 u64 log_area_address;
126 u32 log_area_length;
127 u64 arch_dependent_address;
128 u32 flags;
129};
130
131/* 1) Validated Tables List */
132
133struct acpi_drtm_vtl_list {
134 u32 validated_table_list_count;
135};
136
137/* 2) Resources List */
138
139struct acpi_drtm_resource_list {
140 u32 resource_list_count;
141};
142
143/* 3) Platform-specific Identifiers List */
144
145struct acpi_drtm_id_list {
146 u32 id_list_count;
147};
148
149/*******************************************************************************
150 *
151 * FPDT - Firmware Performance Data Table (ACPI 5.0)
152 * Version 1
153 *
154 ******************************************************************************/
155
156struct acpi_table_fpdt {
157 struct acpi_table_header header; /* Common ACPI table header */
158};
159
160/* FPDT subtable header */
161
162struct acpi_fpdt_header {
163 u16 type;
164 u8 length;
165 u8 revision;
166};
167
168/* Values for Type field above */
169
170enum acpi_fpdt_type {
171 ACPI_FPDT_TYPE_BOOT = 0,
172 ACPI_FPDT_TYPE_S3PERF = 1,
173};
174
175/*
176 * FPDT subtables
177 */
178
179/* 0: Firmware Basic Boot Performance Record */
180
181struct acpi_fpdt_boot {
182 struct acpi_fpdt_header header;
183 u8 reserved[4];
184 u64 reset_end;
185 u64 load_start;
186 u64 startup_start;
187 u64 exit_services_entry;
188 u64 exit_services_exit;
189};
190
191/* 1: S3 Performance Table Pointer Record */
192
193struct acpi_fpdt_s3pt_ptr {
194 struct acpi_fpdt_header header;
195 u8 reserved[4];
196 u64 address;
197};
198
199/*
200 * S3PT - S3 Performance Table. This table is pointed to by the
201 * FPDT S3 Pointer Record above.
202 */
203struct acpi_table_s3pt {
204 u8 signature[4]; /* "S3PT" */
205 u32 length;
206};
207
208/*
209 * S3PT Subtables
210 */
211struct acpi_s3pt_header {
212 u16 type;
213 u8 length;
214 u8 revision;
215};
216
217/* Values for Type field above */
218
219enum acpi_s3pt_type {
220 ACPI_S3PT_TYPE_RESUME = 0,
221 ACPI_S3PT_TYPE_SUSPEND = 1,
222};
223
224struct acpi_s3pt_resume {
225 struct acpi_s3pt_header header;
226 u32 resume_count;
227 u64 full_resume;
228 u64 average_resume;
229};
230
231struct acpi_s3pt_suspend {
232 struct acpi_s3pt_header header;
233 u64 suspend_start;
234 u64 suspend_end;
235};
236
237/*******************************************************************************
238 *
239 * GTDT - Generic Timer Description Table (ACPI 5.0)
240 * Version 1
241 *
242 ******************************************************************************/
243
244struct acpi_table_gtdt {
245 struct acpi_table_header header; /* Common ACPI table header */
246 u64 address;
247 u32 flags;
248 u32 secure_pl1_interrupt;
249 u32 secure_pl1_flags;
250 u32 non_secure_pl1_interrupt;
251 u32 non_secure_pl1_flags;
252 u32 virtual_timer_interrupt;
253 u32 virtual_timer_flags;
254 u32 non_secure_pl2_interrupt;
255 u32 non_secure_pl2_flags;
256};
257
258/* Values for Flags field above */
259
260#define ACPI_GTDT_MAPPED_BLOCK_PRESENT 1
261
262/* Values for all "TimerFlags" fields above */
263
264#define ACPI_GTDT_INTERRUPT_MODE 1
265#define ACPI_GTDT_INTERRUPT_POLARITY 2
266
267/*******************************************************************************
268 *
269 * MPST - Memory Power State Table (ACPI 5.0)
270 * Version 1
271 *
272 ******************************************************************************/
273
274#define ACPI_MPST_CHANNEL_INFO \
275 u16 reserved1; \
276 u8 channel_id; \
277 u8 reserved2; \
278 u16 power_node_count;
279
280/* Main table */
281
282struct acpi_table_mpst {
283 struct acpi_table_header header; /* Common ACPI table header */
284 ACPI_MPST_CHANNEL_INFO /* Platform Communication Channel */
285};
286
287/* Memory Platform Communication Channel Info */
288
289struct acpi_mpst_channel {
290 ACPI_MPST_CHANNEL_INFO /* Platform Communication Channel */
291};
292
293/* Memory Power Node Structure */
294
295struct acpi_mpst_power_node {
296 u8 flags;
297 u8 reserved1;
298 u16 node_id;
299 u32 length;
300 u64 range_address;
301 u64 range_length;
302 u8 num_power_states;
303 u8 num_physical_components;
304 u16 reserved2;
305};
306
307/* Values for Flags field above */
308
309#define ACPI_MPST_ENABLED 1
310#define ACPI_MPST_POWER_MANAGED 2
311#define ACPI_MPST_HOT_PLUG_CAPABLE 4
312
313/* Memory Power State Structure (follows POWER_NODE above) */
314
315struct acpi_mpst_power_state {
316 u8 power_state;
317 u8 info_index;
318};
319
320/* Physical Component ID Structure (follows POWER_STATE above) */
321
322struct acpi_mpst_component {
323 u16 component_id;
324};
325
326/* Memory Power State Characteristics Structure (follows all POWER_NODEs) */
327
328struct acpi_mpst_data_hdr {
329 u16 characteristics_count;
330};
331
332struct acpi_mpst_power_data {
333 u8 revision;
334 u8 flags;
335 u16 reserved1;
336 u32 average_power;
337 u32 power_saving;
338 u64 exit_latency;
339 u64 reserved2;
340};
341
342/* Values for Flags field above */
343
344#define ACPI_MPST_PRESERVE 1
345#define ACPI_MPST_AUTOENTRY 2
346#define ACPI_MPST_AUTOEXIT 4
347
348/* Shared Memory Region (not part of an ACPI table) */
349
350struct acpi_mpst_shared {
351 u32 signature;
352 u16 pcc_command;
353 u16 pcc_status;
354 u16 command_register;
355 u16 status_register;
356 u16 power_state_id;
357 u16 power_node_id;
358 u64 energy_consumed;
359 u64 average_power;
360};
361
362/*******************************************************************************
363 *
364 * PCCT - Platform Communications Channel Table (ACPI 5.0)
365 * Version 1
366 *
367 ******************************************************************************/
368
369struct acpi_table_pcct {
370 struct acpi_table_header header; /* Common ACPI table header */
371 u32 flags;
372 u32 latency;
373 u32 reserved;
374};
375
376/* Values for Flags field above */
377
378#define ACPI_PCCT_DOORBELL 1
379
380/*
381 * PCCT subtables
382 */
383
384/* 0: Generic Communications Subspace */
385
386struct acpi_pcct_subspace {
387 struct acpi_subtable_header header;
388 u8 reserved[6];
389 u64 base_address;
390 u64 length;
391 struct acpi_generic_address doorbell_register;
392 u64 preserve_mask;
393 u64 write_mask;
394};
395
396/*
397 * PCC memory structures (not part of the ACPI table)
398 */
399
400/* Shared Memory Region */
401
402struct acpi_pcct_shared_memory {
403 u32 signature;
404 u16 command;
405 u16 status;
406};
407
408/*******************************************************************************
409 *
410 * PMTT - Platform Memory Topology Table (ACPI 5.0)
411 * Version 1
412 *
413 ******************************************************************************/
414
415struct acpi_table_pmtt {
416 struct acpi_table_header header; /* Common ACPI table header */
417 u32 reserved;
418};
419
420/* Common header for PMTT subtables that follow main table */
421
422struct acpi_pmtt_header {
423 u8 type;
424 u8 reserved1;
425 u16 length;
426 u16 flags;
427 u16 reserved2;
428};
429
430/* Values for Type field above */
431
432#define ACPI_PMTT_TYPE_SOCKET 0
433#define ACPI_PMTT_TYPE_CONTROLLER 1
434#define ACPI_PMTT_TYPE_DIMM 2
435#define ACPI_PMTT_TYPE_RESERVED 3 /* 0x03-0xFF are reserved */
436
437/* Values for Flags field above */
438
439#define ACPI_PMTT_TOP_LEVEL 0x0001
440#define ACPI_PMTT_PHYSICAL 0x0002
441#define ACPI_PMTT_MEMORY_TYPE 0x000C
442
443/*
444 * PMTT subtables, correspond to Type in struct acpi_pmtt_header
445 */
446
447/* 0: Socket Structure */
448
449struct acpi_pmtt_socket {
450 struct acpi_pmtt_header header;
451 u16 socket_id;
452 u16 reserved;
453};
454
455/* 1: Memory Controller subtable */
456
457struct acpi_pmtt_controller {
458 struct acpi_pmtt_header header;
459 u32 read_latency;
460 u32 write_latency;
461 u32 read_bandwidth;
462 u32 write_bandwidth;
463 u16 access_width;
464 u16 alignment;
465 u16 reserved;
466 u16 domain_count;
467};
468
469/* 1a: Proximity Domain substructure */
470
471struct acpi_pmtt_domain {
472 u32 proximity_domain;
473};
474
475/* 2: Physical Component Identifier (DIMM) */
476
477struct acpi_pmtt_physical_component {
478 struct acpi_pmtt_header header;
479 u16 component_id;
480 u16 reserved;
481 u32 memory_size;
482 u32 bios_handle;
483};
484
485/*******************************************************************************
486 *
487 * RASF - RAS Feature Table (ACPI 5.0)
488 * Version 1
489 *
490 ******************************************************************************/
491
492struct acpi_table_rasf {
493 struct acpi_table_header header; /* Common ACPI table header */
494 u8 channel_id[12];
495};
496
497/* RASF Platform Communication Channel Shared Memory Region */
498
499struct acpi_rasf_shared_memory {
500 u32 signature;
501 u16 command;
502 u16 status;
503 u64 requested_address;
504 u64 requested_length;
505 u64 actual_address;
506 u64 actual_length;
507 u16 flags;
508 u8 speed;
509};
510
511/* Masks for Flags and Speed fields above */
512
513#define ACPI_RASF_SCRUBBER_RUNNING 1
514#define ACPI_RASF_SPEED (7<<1)
515
516/* Channel Commands */
517
518enum acpi_rasf_commands {
519 ACPI_RASF_GET_RAS_CAPABILITIES = 1,
520 ACPI_RASF_GET_PATROL_PARAMETERS = 2,
521 ACPI_RASF_START_PATROL_SCRUBBER = 3,
522 ACPI_RASF_STOP_PATROL_SCRUBBER = 4
523};
524
525/* Channel Command flags */
526
527#define ACPI_RASF_GENERATE_SCI (1<<15)
528
529/* Status values */
530
531enum acpi_rasf_status {
532 ACPI_RASF_SUCCESS = 0,
533 ACPI_RASF_NOT_VALID = 1,
534 ACPI_RASF_NOT_SUPPORTED = 2,
535 ACPI_RASF_BUSY = 3,
536 ACPI_RASF_FAILED = 4,
537 ACPI_RASF_ABORTED = 5,
538 ACPI_RASF_INVALID_DATA = 6
539};
540
541/* Status flags */
542
543#define ACPI_RASF_COMMAND_COMPLETE (1)
544#define ACPI_RASF_SCI_DOORBELL (1<<1)
545#define ACPI_RASF_ERROR (1<<2)
546#define ACPI_RASF_STATUS (0x1F<<3)
547
548/* Reset to default packing */
549
550#pragma pack()
551
552#endif /* __ACTBL3_H__ */
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
index ed73f6705c86..d5dee7ce9474 100644
--- a/include/acpi/actypes.h
+++ b/include/acpi/actypes.h
@@ -712,8 +712,10 @@ typedef u8 acpi_adr_space_type;
712#define ACPI_ADR_SPACE_CMOS (acpi_adr_space_type) 5 712#define ACPI_ADR_SPACE_CMOS (acpi_adr_space_type) 5
713#define ACPI_ADR_SPACE_PCI_BAR_TARGET (acpi_adr_space_type) 6 713#define ACPI_ADR_SPACE_PCI_BAR_TARGET (acpi_adr_space_type) 6
714#define ACPI_ADR_SPACE_IPMI (acpi_adr_space_type) 7 714#define ACPI_ADR_SPACE_IPMI (acpi_adr_space_type) 7
715#define ACPI_ADR_SPACE_GPIO (acpi_adr_space_type) 8
716#define ACPI_ADR_SPACE_GSBUS (acpi_adr_space_type) 9
715 717
716#define ACPI_NUM_PREDEFINED_REGIONS 8 718#define ACPI_NUM_PREDEFINED_REGIONS 10
717 719
718/* 720/*
719 * Special Address Spaces 721 * Special Address Spaces
@@ -957,6 +959,14 @@ acpi_status(*acpi_adr_space_handler) (u32 function,
957 959
958#define ACPI_DEFAULT_HANDLER NULL 960#define ACPI_DEFAULT_HANDLER NULL
959 961
962/* Special Context data for generic_serial_bus/general_purpose_io (ACPI 5.0) */
963
964struct acpi_connection_info {
965 u8 *connection;
966 u16 length;
967 u8 access_length;
968};
969
960typedef 970typedef
961acpi_status(*acpi_adr_space_setup) (acpi_handle region_handle, 971acpi_status(*acpi_adr_space_setup) (acpi_handle region_handle,
962 u32 function, 972 u32 function,
diff --git a/include/acpi/apei.h b/include/acpi/apei.h
index 51a527d24a8a..04f349d8da73 100644
--- a/include/acpi/apei.h
+++ b/include/acpi/apei.h
@@ -16,10 +16,10 @@
16 16
17#ifdef __KERNEL__ 17#ifdef __KERNEL__
18 18
19extern int hest_disable; 19extern bool hest_disable;
20extern int erst_disable; 20extern int erst_disable;
21#ifdef CONFIG_ACPI_APEI_GHES 21#ifdef CONFIG_ACPI_APEI_GHES
22extern int ghes_disable; 22extern bool ghes_disable;
23#else 23#else
24#define ghes_disable 1 24#define ghes_disable 1
25#endif 25#endif
diff --git a/include/acpi/atomicio.h b/include/acpi/atomicio.h
deleted file mode 100644
index 8b9fb4b0b9ce..000000000000
--- a/include/acpi/atomicio.h
+++ /dev/null
@@ -1,10 +0,0 @@
1#ifndef ACPI_ATOMIC_IO_H
2#define ACPI_ATOMIC_IO_H
3
4int acpi_pre_map_gar(struct acpi_generic_address *reg);
5int acpi_post_unmap_gar(struct acpi_generic_address *reg);
6
7int acpi_atomic_read(u64 *val, struct acpi_generic_address *reg);
8int acpi_atomic_write(u64 val, struct acpi_generic_address *reg);
9
10#endif
diff --git a/include/acpi/processor.h b/include/acpi/processor.h
index 610f6fb1bbc2..8cf7e98a2c7b 100644
--- a/include/acpi/processor.h
+++ b/include/acpi/processor.h
@@ -195,6 +195,7 @@ struct acpi_processor_flags {
195 u8 has_cst:1; 195 u8 has_cst:1;
196 u8 power_setup_done:1; 196 u8 power_setup_done:1;
197 u8 bm_rld_set:1; 197 u8 bm_rld_set:1;
198 u8 need_hotplug_init:1;
198}; 199};
199 200
200struct acpi_processor { 201struct acpi_processor {
diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
index d466c8d8826d..1ff4e221cb4d 100644
--- a/include/asm-generic/gpio.h
+++ b/include/asm-generic/gpio.h
@@ -177,6 +177,10 @@ extern int gpio_request_one(unsigned gpio, unsigned long flags, const char *labe
177extern int gpio_request_array(const struct gpio *array, size_t num); 177extern int gpio_request_array(const struct gpio *array, size_t num);
178extern void gpio_free_array(const struct gpio *array, size_t num); 178extern void gpio_free_array(const struct gpio *array, size_t num);
179 179
180/* bindings for managed devices that want to request gpios */
181int devm_gpio_request(struct device *dev, unsigned gpio, const char *label);
182void devm_gpio_free(struct device *dev, unsigned int gpio);
183
180#ifdef CONFIG_GPIO_SYSFS 184#ifdef CONFIG_GPIO_SYSFS
181 185
182/* 186/*
diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
index 912088773a69..448303bdb85f 100644
--- a/include/asm-generic/io.h
+++ b/include/asm-generic/io.h
@@ -19,6 +19,8 @@
19#include <asm-generic/iomap.h> 19#include <asm-generic/iomap.h>
20#endif 20#endif
21 21
22#include <asm-generic/pci_iomap.h>
23
22#ifndef mmiowb 24#ifndef mmiowb
23#define mmiowb() do {} while (0) 25#define mmiowb() do {} while (0)
24#endif 26#endif
@@ -283,9 +285,7 @@ static inline void writesb(const void __iomem *addr, const void *buf, int len)
283#define __io_virt(x) ((void __force *) (x)) 285#define __io_virt(x) ((void __force *) (x))
284 286
285#ifndef CONFIG_GENERIC_IOMAP 287#ifndef CONFIG_GENERIC_IOMAP
286/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */
287struct pci_dev; 288struct pci_dev;
288extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max);
289static inline void pci_iounmap(struct pci_dev *dev, void __iomem *p) 289static inline void pci_iounmap(struct pci_dev *dev, void __iomem *p)
290{ 290{
291} 291}
@@ -327,7 +327,7 @@ static inline void __iomem *ioremap(phys_addr_t offset, unsigned long size)
327#define ioremap_wc ioremap_nocache 327#define ioremap_wc ioremap_nocache
328#endif 328#endif
329 329
330static inline void iounmap(void *addr) 330static inline void iounmap(void __iomem *addr)
331{ 331{
332} 332}
333#endif /* CONFIG_MMU */ 333#endif /* CONFIG_MMU */
diff --git a/include/asm-generic/iomap.h b/include/asm-generic/iomap.h
index 98dcd76ce836..8a3d4fde2604 100644
--- a/include/asm-generic/iomap.h
+++ b/include/asm-generic/iomap.h
@@ -67,18 +67,15 @@ extern void ioport_unmap(void __iomem *);
67#endif 67#endif
68 68
69#ifdef CONFIG_PCI 69#ifdef CONFIG_PCI
70/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */ 70/* Destroy a virtual mapping cookie for a PCI BAR (memory or IO) */
71struct pci_dev; 71struct pci_dev;
72extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max);
73extern void pci_iounmap(struct pci_dev *dev, void __iomem *); 72extern void pci_iounmap(struct pci_dev *dev, void __iomem *);
74#else 73#else
75struct pci_dev; 74struct pci_dev;
76static inline void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max)
77{
78 return NULL;
79}
80static inline void pci_iounmap(struct pci_dev *dev, void __iomem *addr) 75static inline void pci_iounmap(struct pci_dev *dev, void __iomem *addr)
81{ } 76{ }
82#endif 77#endif
83 78
79#include <asm-generic/pci_iomap.h>
80
84#endif 81#endif
diff --git a/include/asm-generic/page.h b/include/asm-generic/page.h
index 351889d1de19..37d1fe28960a 100644
--- a/include/asm-generic/page.h
+++ b/include/asm-generic/page.h
@@ -71,10 +71,14 @@ extern unsigned long memory_end;
71#define PAGE_OFFSET (0) 71#define PAGE_OFFSET (0)
72#endif 72#endif
73 73
74#ifndef ARCH_PFN_OFFSET
75#define ARCH_PFN_OFFSET (PAGE_OFFSET >> PAGE_SHIFT)
76#endif
77
74#ifndef __ASSEMBLY__ 78#ifndef __ASSEMBLY__
75 79
76#define __va(x) ((void *)((unsigned long)(x) + PAGE_OFFSET)) 80#define __va(x) ((void *)((unsigned long) (x)))
77#define __pa(x) ((unsigned long) (x) - PAGE_OFFSET) 81#define __pa(x) ((unsigned long) (x))
78 82
79#define virt_to_pfn(kaddr) (__pa(kaddr) >> PAGE_SHIFT) 83#define virt_to_pfn(kaddr) (__pa(kaddr) >> PAGE_SHIFT)
80#define pfn_to_virt(pfn) __va((pfn) << PAGE_SHIFT) 84#define pfn_to_virt(pfn) __va((pfn) << PAGE_SHIFT)
@@ -86,7 +90,7 @@ extern unsigned long memory_end;
86#define page_to_phys(page) ((dma_addr_t)page_to_pfn(page) << PAGE_SHIFT) 90#define page_to_phys(page) ((dma_addr_t)page_to_pfn(page) << PAGE_SHIFT)
87#endif 91#endif
88 92
89#define pfn_valid(pfn) ((pfn) < max_mapnr) 93#define pfn_valid(pfn) ((pfn) >= ARCH_PFN_OFFSET && ((pfn) - ARCH_PFN_OFFSET) < max_mapnr)
90 94
91#define virt_addr_valid(kaddr) (((void *)(kaddr) >= (void *)PAGE_OFFSET) && \ 95#define virt_addr_valid(kaddr) (((void *)(kaddr) >= (void *)PAGE_OFFSET) && \
92 ((void *)(kaddr) < (void *)memory_end)) 96 ((void *)(kaddr) < (void *)memory_end))
diff --git a/include/asm-generic/param.h b/include/asm-generic/param.h
index cdf8251bfb6c..835632a3b468 100644
--- a/include/asm-generic/param.h
+++ b/include/asm-generic/param.h
@@ -1,12 +1,6 @@
1#ifndef __ASM_GENERIC_PARAM_H 1#ifndef __ASM_GENERIC_PARAM_H
2#define __ASM_GENERIC_PARAM_H 2#define __ASM_GENERIC_PARAM_H
3 3
4#ifdef __KERNEL__
5# define HZ CONFIG_HZ /* Internal kernel timer frequency */
6# define USER_HZ 100 /* some user interfaces are */
7# define CLOCKS_PER_SEC (USER_HZ) /* in "ticks" like times() */
8#endif
9
10#ifndef HZ 4#ifndef HZ
11#define HZ 100 5#define HZ 100
12#endif 6#endif
@@ -21,4 +15,11 @@
21 15
22#define MAXHOSTNAMELEN 64 /* max length of hostname */ 16#define MAXHOSTNAMELEN 64 /* max length of hostname */
23 17
18#ifdef __KERNEL__
19# undef HZ
20# define HZ CONFIG_HZ /* Internal kernel timer frequency */
21# define USER_HZ 100 /* some user interfaces are */
22# define CLOCKS_PER_SEC (USER_HZ) /* in "ticks" like times() */
23#endif
24
24#endif /* __ASM_GENERIC_PARAM_H */ 25#endif /* __ASM_GENERIC_PARAM_H */
diff --git a/include/asm-generic/pci_iomap.h b/include/asm-generic/pci_iomap.h
new file mode 100644
index 000000000000..8de4b73e19e2
--- /dev/null
+++ b/include/asm-generic/pci_iomap.h
@@ -0,0 +1,25 @@
1/* Generic I/O port emulation, based on MN10300 code
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11#ifndef __ASM_GENERIC_PCI_IOMAP_H
12#define __ASM_GENERIC_PCI_IOMAP_H
13
14struct pci_dev;
15#ifdef CONFIG_PCI
16/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */
17extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max);
18#else
19static inline void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max)
20{
21 return NULL;
22}
23#endif
24
25#endif /* __ASM_GENERIC_IO_H */
diff --git a/include/asm-generic/tlb.h b/include/asm-generic/tlb.h
index e58fa777fa09..f96a5b58a975 100644
--- a/include/asm-generic/tlb.h
+++ b/include/asm-generic/tlb.h
@@ -139,6 +139,20 @@ static inline void tlb_remove_page(struct mmu_gather *tlb, struct page *page)
139 __tlb_remove_tlb_entry(tlb, ptep, address); \ 139 __tlb_remove_tlb_entry(tlb, ptep, address); \
140 } while (0) 140 } while (0)
141 141
142/**
143 * tlb_remove_pmd_tlb_entry - remember a pmd mapping for later tlb invalidation
144 * This is a nop so far, because only x86 needs it.
145 */
146#ifndef __tlb_remove_pmd_tlb_entry
147#define __tlb_remove_pmd_tlb_entry(tlb, pmdp, address) do {} while (0)
148#endif
149
150#define tlb_remove_pmd_tlb_entry(tlb, pmdp, address) \
151 do { \
152 tlb->need_flush = 1; \
153 __tlb_remove_pmd_tlb_entry(tlb, pmdp, address); \
154 } while (0)
155
142#define pte_free_tlb(tlb, ptep, address) \ 156#define pte_free_tlb(tlb, ptep, address) \
143 do { \ 157 do { \
144 tlb->need_flush = 1; \ 158 tlb->need_flush = 1; \
diff --git a/include/asm-generic/uaccess.h b/include/asm-generic/uaccess.h
index ac68c999b6c2..9788568f7978 100644
--- a/include/asm-generic/uaccess.h
+++ b/include/asm-generic/uaccess.h
@@ -289,9 +289,14 @@ strncpy_from_user(char *dst, const char __user *src, long count)
289 * Return 0 on exception, a value greater than N if too long 289 * Return 0 on exception, a value greater than N if too long
290 */ 290 */
291#ifndef __strnlen_user 291#ifndef __strnlen_user
292#define __strnlen_user strnlen 292#define __strnlen_user(s, n) (strnlen((s), (n)) + 1)
293#endif 293#endif
294 294
295/*
296 * Unlike strnlen, strnlen_user includes the nul terminator in
297 * its returned count. Callers should check for a returned value
298 * greater than N as an indication the string is too long.
299 */
295static inline long strnlen_user(const char __user *src, long n) 300static inline long strnlen_user(const char __user *src, long n)
296{ 301{
297 if (!access_ok(VERIFY_READ, src, 1)) 302 if (!access_ok(VERIFY_READ, src, 1))
diff --git a/include/crypto/algapi.h b/include/crypto/algapi.h
index ecc721def10c..418d270e1806 100644
--- a/include/crypto/algapi.h
+++ b/include/crypto/algapi.h
@@ -134,6 +134,7 @@ struct crypto_template *crypto_lookup_template(const char *name);
134 134
135int crypto_register_instance(struct crypto_template *tmpl, 135int crypto_register_instance(struct crypto_template *tmpl,
136 struct crypto_instance *inst); 136 struct crypto_instance *inst);
137int crypto_unregister_instance(struct crypto_alg *alg);
137 138
138int crypto_init_spawn(struct crypto_spawn *spawn, struct crypto_alg *alg, 139int crypto_init_spawn(struct crypto_spawn *spawn, struct crypto_alg *alg,
139 struct crypto_instance *inst, u32 mask); 140 struct crypto_instance *inst, u32 mask);
diff --git a/include/crypto/lrw.h b/include/crypto/lrw.h
new file mode 100644
index 000000000000..25a2c8716375
--- /dev/null
+++ b/include/crypto/lrw.h
@@ -0,0 +1,43 @@
1#ifndef _CRYPTO_LRW_H
2#define _CRYPTO_LRW_H
3
4#include <crypto/b128ops.h>
5
6struct scatterlist;
7struct gf128mul_64k;
8struct blkcipher_desc;
9
10#define LRW_BLOCK_SIZE 16
11
12struct lrw_table_ctx {
13 /* optimizes multiplying a random (non incrementing, as at the
14 * start of a new sector) value with key2, we could also have
15 * used 4k optimization tables or no optimization at all. In the
16 * latter case we would have to store key2 here */
17 struct gf128mul_64k *table;
18 /* stores:
19 * key2*{ 0,0,...0,0,0,0,1 }, key2*{ 0,0,...0,0,0,1,1 },
20 * key2*{ 0,0,...0,0,1,1,1 }, key2*{ 0,0,...0,1,1,1,1 }
21 * key2*{ 0,0,...1,1,1,1,1 }, etc
22 * needed for optimized multiplication of incrementing values
23 * with key2 */
24 be128 mulinc[128];
25};
26
27int lrw_init_table(struct lrw_table_ctx *ctx, const u8 *tweak);
28void lrw_free_table(struct lrw_table_ctx *ctx);
29
30struct lrw_crypt_req {
31 be128 *tbuf;
32 unsigned int tbuflen;
33
34 struct lrw_table_ctx *table_ctx;
35 void *crypt_ctx;
36 void (*crypt_fn)(void *ctx, u8 *blks, unsigned int nbytes);
37};
38
39int lrw_crypt(struct blkcipher_desc *desc, struct scatterlist *dst,
40 struct scatterlist *src, unsigned int nbytes,
41 struct lrw_crypt_req *req);
42
43#endif /* _CRYPTO_LRW_H */
diff --git a/include/crypto/serpent.h b/include/crypto/serpent.h
new file mode 100644
index 000000000000..b7e0941eb6fc
--- /dev/null
+++ b/include/crypto/serpent.h
@@ -0,0 +1,27 @@
1/*
2 * Common values for serpent algorithms
3 */
4
5#ifndef _CRYPTO_SERPENT_H
6#define _CRYPTO_SERPENT_H
7
8#include <linux/types.h>
9#include <linux/crypto.h>
10
11#define SERPENT_MIN_KEY_SIZE 0
12#define SERPENT_MAX_KEY_SIZE 32
13#define SERPENT_EXPKEY_WORDS 132
14#define SERPENT_BLOCK_SIZE 16
15
16struct serpent_ctx {
17 u32 expkey[SERPENT_EXPKEY_WORDS];
18};
19
20int __serpent_setkey(struct serpent_ctx *ctx, const u8 *key,
21 unsigned int keylen);
22int serpent_setkey(struct crypto_tfm *tfm, const u8 *key, unsigned int keylen);
23
24void __serpent_encrypt(struct serpent_ctx *ctx, u8 *dst, const u8 *src);
25void __serpent_decrypt(struct serpent_ctx *ctx, u8 *dst, const u8 *src);
26
27#endif
diff --git a/include/crypto/twofish.h b/include/crypto/twofish.h
index c408522595c6..095c901a8af3 100644
--- a/include/crypto/twofish.h
+++ b/include/crypto/twofish.h
@@ -17,6 +17,8 @@ struct twofish_ctx {
17 u32 s[4][256], w[8], k[32]; 17 u32 s[4][256], w[8], k[32];
18}; 18};
19 19
20int __twofish_setkey(struct twofish_ctx *ctx, const u8 *key,
21 unsigned int key_len, u32 *flags);
20int twofish_setkey(struct crypto_tfm *tfm, const u8 *key, unsigned int key_len); 22int twofish_setkey(struct crypto_tfm *tfm, const u8 *key, unsigned int key_len);
21 23
22#endif 24#endif
diff --git a/include/crypto/xts.h b/include/crypto/xts.h
new file mode 100644
index 000000000000..72c09eb56437
--- /dev/null
+++ b/include/crypto/xts.h
@@ -0,0 +1,27 @@
1#ifndef _CRYPTO_XTS_H
2#define _CRYPTO_XTS_H
3
4#include <crypto/b128ops.h>
5
6struct scatterlist;
7struct blkcipher_desc;
8
9#define XTS_BLOCK_SIZE 16
10
11struct xts_crypt_req {
12 be128 *tbuf;
13 unsigned int tbuflen;
14
15 void *tweak_ctx;
16 void (*tweak_fn)(void *ctx, u8* dst, const u8* src);
17 void *crypt_ctx;
18 void (*crypt_fn)(void *ctx, u8 *blks, unsigned int nbytes);
19};
20
21#define XTS_TWEAK_CAST(x) ((void (*)(void *, u8*, const u8*))(x))
22
23int xts_crypt(struct blkcipher_desc *desc, struct scatterlist *dst,
24 struct scatterlist *src, unsigned int nbytes,
25 struct xts_crypt_req *req);
26
27#endif /* _CRYPTO_XTS_H */
diff --git a/include/drm/Kbuild b/include/drm/Kbuild
index 3a60ac889520..a5c0e10fd47d 100644
--- a/include/drm/Kbuild
+++ b/include/drm/Kbuild
@@ -1,4 +1,5 @@
1header-y += drm.h 1header-y += drm.h
2header-y += drm_fourcc.h
2header-y += drm_mode.h 3header-y += drm_mode.h
3header-y += drm_sarea.h 4header-y += drm_sarea.h
4header-y += i810_drm.h 5header-y += i810_drm.h
diff --git a/include/drm/drm.h b/include/drm/drm.h
index 4be33b4ca2f8..49d94ede2ec2 100644
--- a/include/drm/drm.h
+++ b/include/drm/drm.h
@@ -714,6 +714,10 @@ struct drm_get_cap {
714#define DRM_IOCTL_MODE_CREATE_DUMB DRM_IOWR(0xB2, struct drm_mode_create_dumb) 714#define DRM_IOCTL_MODE_CREATE_DUMB DRM_IOWR(0xB2, struct drm_mode_create_dumb)
715#define DRM_IOCTL_MODE_MAP_DUMB DRM_IOWR(0xB3, struct drm_mode_map_dumb) 715#define DRM_IOCTL_MODE_MAP_DUMB DRM_IOWR(0xB3, struct drm_mode_map_dumb)
716#define DRM_IOCTL_MODE_DESTROY_DUMB DRM_IOWR(0xB4, struct drm_mode_destroy_dumb) 716#define DRM_IOCTL_MODE_DESTROY_DUMB DRM_IOWR(0xB4, struct drm_mode_destroy_dumb)
717#define DRM_IOCTL_MODE_GETPLANERESOURCES DRM_IOWR(0xB5, struct drm_mode_get_plane_res)
718#define DRM_IOCTL_MODE_GETPLANE DRM_IOWR(0xB6, struct drm_mode_get_plane)
719#define DRM_IOCTL_MODE_SETPLANE DRM_IOWR(0xB7, struct drm_mode_set_plane)
720#define DRM_IOCTL_MODE_ADDFB2 DRM_IOWR(0xB8, struct drm_mode_fb_cmd2)
717 721
718/** 722/**
719 * Device specific ioctls should only be in their respective headers 723 * Device specific ioctls should only be in their respective headers
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index e8acca892af0..92f0981b5fb8 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -918,7 +918,7 @@ struct drm_driver {
918 int dev_priv_size; 918 int dev_priv_size;
919 struct drm_ioctl_desc *ioctls; 919 struct drm_ioctl_desc *ioctls;
920 int num_ioctls; 920 int num_ioctls;
921 struct file_operations fops; 921 const struct file_operations *fops;
922 union { 922 union {
923 struct pci_driver *pci; 923 struct pci_driver *pci;
924 struct platform_device *platform_device; 924 struct platform_device *platform_device;
@@ -1328,6 +1328,7 @@ extern int drm_getmagic(struct drm_device *dev, void *data,
1328 struct drm_file *file_priv); 1328 struct drm_file *file_priv);
1329extern int drm_authmagic(struct drm_device *dev, void *data, 1329extern int drm_authmagic(struct drm_device *dev, void *data,
1330 struct drm_file *file_priv); 1330 struct drm_file *file_priv);
1331extern int drm_remove_magic(struct drm_master *master, drm_magic_t magic);
1331 1332
1332/* Cache management (drm_cache.c) */ 1333/* Cache management (drm_cache.c) */
1333void drm_clflush_pages(struct page *pages[], unsigned long num_pages); 1334void drm_clflush_pages(struct page *pages[], unsigned long num_pages);
@@ -1696,5 +1697,13 @@ extern void drm_platform_exit(struct drm_driver *driver, struct platform_device
1696extern int drm_get_platform_dev(struct platform_device *pdev, 1697extern int drm_get_platform_dev(struct platform_device *pdev,
1697 struct drm_driver *driver); 1698 struct drm_driver *driver);
1698 1699
1700/* returns true if currently okay to sleep */
1701static __inline__ bool drm_can_sleep(void)
1702{
1703 if (in_atomic() || in_dbg_master() || irqs_disabled())
1704 return false;
1705 return true;
1706}
1707
1699#endif /* __KERNEL__ */ 1708#endif /* __KERNEL__ */
1700#endif 1709#endif
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 802079809282..4cd4be26722c 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -29,9 +29,10 @@
29#include <linux/spinlock.h> 29#include <linux/spinlock.h>
30#include <linux/types.h> 30#include <linux/types.h>
31#include <linux/idr.h> 31#include <linux/idr.h>
32
33#include <linux/fb.h> 32#include <linux/fb.h>
34 33
34#include <drm/drm_fourcc.h>
35
35struct drm_device; 36struct drm_device;
36struct drm_mode_set; 37struct drm_mode_set;
37struct drm_framebuffer; 38struct drm_framebuffer;
@@ -44,6 +45,7 @@ struct drm_framebuffer;
44#define DRM_MODE_OBJECT_PROPERTY 0xb0b0b0b0 45#define DRM_MODE_OBJECT_PROPERTY 0xb0b0b0b0
45#define DRM_MODE_OBJECT_FB 0xfbfbfbfb 46#define DRM_MODE_OBJECT_FB 0xfbfbfbfb
46#define DRM_MODE_OBJECT_BLOB 0xbbbbbbbb 47#define DRM_MODE_OBJECT_BLOB 0xbbbbbbbb
48#define DRM_MODE_OBJECT_PLANE 0xeeeeeeee
47 49
48struct drm_mode_object { 50struct drm_mode_object {
49 uint32_t id; 51 uint32_t id;
@@ -118,7 +120,6 @@ struct drm_display_mode {
118 120
119 char name[DRM_DISPLAY_MODE_LEN]; 121 char name[DRM_DISPLAY_MODE_LEN];
120 122
121 int connector_count;
122 enum drm_mode_status status; 123 enum drm_mode_status status;
123 int type; 124 int type;
124 125
@@ -238,13 +239,15 @@ struct drm_framebuffer {
238 struct list_head head; 239 struct list_head head;
239 struct drm_mode_object base; 240 struct drm_mode_object base;
240 const struct drm_framebuffer_funcs *funcs; 241 const struct drm_framebuffer_funcs *funcs;
241 unsigned int pitch; 242 unsigned int pitches[4];
243 unsigned int offsets[4];
242 unsigned int width; 244 unsigned int width;
243 unsigned int height; 245 unsigned int height;
244 /* depth can be 15 or 16 */ 246 /* depth can be 15 or 16 */
245 unsigned int depth; 247 unsigned int depth;
246 int bits_per_pixel; 248 int bits_per_pixel;
247 int flags; 249 int flags;
250 uint32_t pixel_format; /* fourcc format */
248 struct list_head filp_head; 251 struct list_head filp_head;
249 /* if you are using the helper */ 252 /* if you are using the helper */
250 void *helper_private; 253 void *helper_private;
@@ -278,6 +281,7 @@ struct drm_crtc;
278struct drm_connector; 281struct drm_connector;
279struct drm_encoder; 282struct drm_encoder;
280struct drm_pending_vblank_event; 283struct drm_pending_vblank_event;
284struct drm_plane;
281 285
282/** 286/**
283 * drm_crtc_funcs - control CRTCs for a given device 287 * drm_crtc_funcs - control CRTCs for a given device
@@ -341,10 +345,21 @@ struct drm_crtc_funcs {
341 345
342/** 346/**
343 * drm_crtc - central CRTC control structure 347 * drm_crtc - central CRTC control structure
348 * @dev: parent DRM device
349 * @head: list management
350 * @base: base KMS object for ID tracking etc.
344 * @enabled: is this CRTC enabled? 351 * @enabled: is this CRTC enabled?
352 * @mode: current mode timings
353 * @hwmode: mode timings as programmed to hw regs
345 * @x: x position on screen 354 * @x: x position on screen
346 * @y: y position on screen 355 * @y: y position on screen
347 * @funcs: CRTC control functions 356 * @funcs: CRTC control functions
357 * @gamma_size: size of gamma ramp
358 * @gamma_store: gamma ramp values
359 * @framedur_ns: precise frame timing
360 * @framedur_ns: precise line timing
361 * @pixeldur_ns: precise pixel timing
362 * @helper_private: mid-layer private data
348 * 363 *
349 * Each CRTC may have one or more connectors associated with it. This structure 364 * Each CRTC may have one or more connectors associated with it. This structure
350 * allows the CRTC to be controlled. 365 * allows the CRTC to be controlled.
@@ -423,6 +438,13 @@ struct drm_connector_funcs {
423 void (*force)(struct drm_connector *connector); 438 void (*force)(struct drm_connector *connector);
424}; 439};
425 440
441/**
442 * drm_encoder_funcs - encoder controls
443 * @reset: reset state (e.g. at init or resume time)
444 * @destroy: cleanup and free associated data
445 *
446 * Encoders sit between CRTCs and connectors.
447 */
426struct drm_encoder_funcs { 448struct drm_encoder_funcs {
427 void (*reset)(struct drm_encoder *encoder); 449 void (*reset)(struct drm_encoder *encoder);
428 void (*destroy)(struct drm_encoder *encoder); 450 void (*destroy)(struct drm_encoder *encoder);
@@ -431,10 +453,22 @@ struct drm_encoder_funcs {
431#define DRM_CONNECTOR_MAX_UMODES 16 453#define DRM_CONNECTOR_MAX_UMODES 16
432#define DRM_CONNECTOR_MAX_PROPERTY 16 454#define DRM_CONNECTOR_MAX_PROPERTY 16
433#define DRM_CONNECTOR_LEN 32 455#define DRM_CONNECTOR_LEN 32
434#define DRM_CONNECTOR_MAX_ENCODER 2 456#define DRM_CONNECTOR_MAX_ENCODER 3
435 457
436/** 458/**
437 * drm_encoder - central DRM encoder structure 459 * drm_encoder - central DRM encoder structure
460 * @dev: parent DRM device
461 * @head: list management
462 * @base: base KMS object
463 * @encoder_type: one of the %DRM_MODE_ENCODER_<foo> types in drm_mode.h
464 * @possible_crtcs: bitmask of potential CRTC bindings
465 * @possible_clones: bitmask of potential sibling encoders for cloning
466 * @crtc: currently bound CRTC
467 * @funcs: control functions
468 * @helper_private: mid-layer private data
469 *
470 * CRTCs drive pixels to encoders, which convert them into signals
471 * appropriate for a given connector or set of connectors.
438 */ 472 */
439struct drm_encoder { 473struct drm_encoder {
440 struct drm_device *dev; 474 struct drm_device *dev;
@@ -470,14 +504,37 @@ enum drm_connector_force {
470 504
471/** 505/**
472 * drm_connector - central DRM connector control structure 506 * drm_connector - central DRM connector control structure
473 * @crtc: CRTC this connector is currently connected to, NULL if none 507 * @dev: parent DRM device
508 * @kdev: kernel device for sysfs attributes
509 * @attr: sysfs attributes
510 * @head: list management
511 * @base: base KMS object
512 * @connector_type: one of the %DRM_MODE_CONNECTOR_<foo> types from drm_mode.h
513 * @connector_type_id: index into connector type enum
474 * @interlace_allowed: can this connector handle interlaced modes? 514 * @interlace_allowed: can this connector handle interlaced modes?
475 * @doublescan_allowed: can this connector handle doublescan? 515 * @doublescan_allowed: can this connector handle doublescan?
476 * @available_modes: modes available on this connector (from get_modes() + user) 516 * @modes: modes available on this connector (from fill_modes() + user)
477 * @initial_x: initial x position for this connector 517 * @status: one of the drm_connector_status enums (connected, not, or unknown)
478 * @initial_y: initial y position for this connector 518 * @probed_modes: list of modes derived directly from the display
479 * @status: connector connected? 519 * @display_info: information about attached display (e.g. from EDID)
480 * @funcs: connector control functions 520 * @funcs: connector control functions
521 * @user_modes: user added mode list
522 * @edid_blob_ptr: DRM property containing EDID if present
523 * @property_ids: property tracking for this connector
524 * @property_values: value pointers or data for properties
525 * @polled: a %DRM_CONNECTOR_POLL_<foo> value for core driven polling
526 * @dpms: current dpms state
527 * @helper_private: mid-layer private data
528 * @force: a %DRM_FORCE_<foo> state for forced mode sets
529 * @encoder_ids: valid encoders for this connector
530 * @encoder: encoder driving this connector, if any
531 * @eld: EDID-like data, if present
532 * @dvi_dual: dual link DVI, if found
533 * @max_tmds_clock: max clock rate, if found
534 * @latency_present: AV delay info from ELD, if found
535 * @video_latency: video latency info from ELD, if found
536 * @audio_latency: audio latency info from ELD, if found
537 * @null_edid_counter: track sinks that give us all zeros for the EDID
481 * 538 *
482 * Each connector may be connected to one or more CRTCs, or may be clonable by 539 * Each connector may be connected to one or more CRTCs, or may be clonable by
483 * another connector if they can share a CRTC. Each connector also has a specific 540 * another connector if they can share a CRTC. Each connector also has a specific
@@ -498,7 +555,6 @@ struct drm_connector {
498 bool doublescan_allowed; 555 bool doublescan_allowed;
499 struct list_head modes; /* list of modes on this connector */ 556 struct list_head modes; /* list of modes on this connector */
500 557
501 int initial_x, initial_y;
502 enum drm_connector_status status; 558 enum drm_connector_status status;
503 559
504 /* these are modes added by probing with DDC or the BIOS */ 560 /* these are modes added by probing with DDC or the BIOS */
@@ -522,7 +578,6 @@ struct drm_connector {
522 /* forced on connector */ 578 /* forced on connector */
523 enum drm_connector_force force; 579 enum drm_connector_force force;
524 uint32_t encoder_ids[DRM_CONNECTOR_MAX_ENCODER]; 580 uint32_t encoder_ids[DRM_CONNECTOR_MAX_ENCODER];
525 uint32_t force_encoder_id;
526 struct drm_encoder *encoder; /* currently active encoder */ 581 struct drm_encoder *encoder; /* currently active encoder */
527 582
528 /* EDID bits */ 583 /* EDID bits */
@@ -536,7 +591,71 @@ struct drm_connector {
536}; 591};
537 592
538/** 593/**
539 * struct drm_mode_set 594 * drm_plane_funcs - driver plane control functions
595 * @update_plane: update the plane configuration
596 * @disable_plane: shut down the plane
597 * @destroy: clean up plane resources
598 */
599struct drm_plane_funcs {
600 int (*update_plane)(struct drm_plane *plane,
601 struct drm_crtc *crtc, struct drm_framebuffer *fb,
602 int crtc_x, int crtc_y,
603 unsigned int crtc_w, unsigned int crtc_h,
604 uint32_t src_x, uint32_t src_y,
605 uint32_t src_w, uint32_t src_h);
606 int (*disable_plane)(struct drm_plane *plane);
607 void (*destroy)(struct drm_plane *plane);
608};
609
610/**
611 * drm_plane - central DRM plane control structure
612 * @dev: DRM device this plane belongs to
613 * @head: for list management
614 * @base: base mode object
615 * @possible_crtcs: pipes this plane can be bound to
616 * @format_types: array of formats supported by this plane
617 * @format_count: number of formats supported
618 * @crtc: currently bound CRTC
619 * @fb: currently bound fb
620 * @gamma_size: size of gamma table
621 * @gamma_store: gamma correction table
622 * @enabled: enabled flag
623 * @funcs: helper functions
624 * @helper_private: storage for drver layer
625 */
626struct drm_plane {
627 struct drm_device *dev;
628 struct list_head head;
629
630 struct drm_mode_object base;
631
632 uint32_t possible_crtcs;
633 uint32_t *format_types;
634 uint32_t format_count;
635
636 struct drm_crtc *crtc;
637 struct drm_framebuffer *fb;
638
639 /* CRTC gamma size for reporting to userspace */
640 uint32_t gamma_size;
641 uint16_t *gamma_store;
642
643 bool enabled;
644
645 const struct drm_plane_funcs *funcs;
646 void *helper_private;
647};
648
649/**
650 * drm_mode_set - new values for a CRTC config change
651 * @head: list management
652 * @fb: framebuffer to use for new config
653 * @crtc: CRTC whose configuration we're about to change
654 * @mode: mode timings to use
655 * @x: position of this CRTC relative to @fb
656 * @y: position of this CRTC relative to @fb
657 * @connectors: array of connectors to drive with this CRTC if possible
658 * @num_connectors: size of @connectors array
540 * 659 *
541 * Represents a single crtc the connectors that it drives with what mode 660 * Represents a single crtc the connectors that it drives with what mode
542 * and from which framebuffer it scans out from. 661 * and from which framebuffer it scans out from.
@@ -558,13 +677,33 @@ struct drm_mode_set {
558}; 677};
559 678
560/** 679/**
561 * struct drm_mode_config_funcs - configure CRTCs for a given screen layout 680 * struct drm_mode_config_funcs - basic driver provided mode setting functions
681 * @fb_create: create a new framebuffer object
682 * @output_poll_changed: function to handle output configuration changes
683 *
684 * Some global (i.e. not per-CRTC, connector, etc) mode setting functions that
685 * involve drivers.
562 */ 686 */
563struct drm_mode_config_funcs { 687struct drm_mode_config_funcs {
564 struct drm_framebuffer *(*fb_create)(struct drm_device *dev, struct drm_file *file_priv, struct drm_mode_fb_cmd *mode_cmd); 688 struct drm_framebuffer *(*fb_create)(struct drm_device *dev,
689 struct drm_file *file_priv,
690 struct drm_mode_fb_cmd2 *mode_cmd);
565 void (*output_poll_changed)(struct drm_device *dev); 691 void (*output_poll_changed)(struct drm_device *dev);
566}; 692};
567 693
694/**
695 * drm_mode_group - group of mode setting resources for potential sub-grouping
696 * @num_crtcs: CRTC count
697 * @num_encoders: encoder count
698 * @num_connectors: connector count
699 * @id_list: list of KMS object IDs in this group
700 *
701 * Currently this simply tracks the global mode setting state. But in the
702 * future it could allow groups of objects to be set aside into independent
703 * control groups for use by different user level processes (e.g. two X servers
704 * running simultaneously on different heads, each with their own mode
705 * configuration and freedom of mode setting).
706 */
568struct drm_mode_group { 707struct drm_mode_group {
569 uint32_t num_crtcs; 708 uint32_t num_crtcs;
570 uint32_t num_encoders; 709 uint32_t num_encoders;
@@ -576,7 +715,30 @@ struct drm_mode_group {
576 715
577/** 716/**
578 * drm_mode_config - Mode configuration control structure 717 * drm_mode_config - Mode configuration control structure
718 * @mutex: mutex protecting KMS related lists and structures
719 * @idr_mutex: mutex for KMS ID allocation and management
720 * @crtc_idr: main KMS ID tracking object
721 * @num_fb: number of fbs available
722 * @fb_list: list of framebuffers available
723 * @num_connector: number of connectors on this device
724 * @connector_list: list of connector objects
725 * @num_encoder: number of encoders on this device
726 * @encoder_list: list of encoder objects
727 * @num_crtc: number of CRTCs on this device
728 * @crtc_list: list of CRTC objects
729 * @min_width: minimum pixel width on this device
730 * @min_height: minimum pixel height on this device
731 * @max_width: maximum pixel width on this device
732 * @max_height: maximum pixel height on this device
733 * @funcs: core driver provided mode setting functions
734 * @fb_base: base address of the framebuffer
735 * @poll_enabled: track polling status for this device
736 * @output_poll_work: delayed work for polling in process context
737 * @*_property: core property tracking
579 * 738 *
739 * Core mode resource tracking structure. All CRTC, encoders, and connectors
740 * enumerated by the driver are added here, as are global properties. Some
741 * global restrictions are also here, e.g. dimension restrictions.
580 */ 742 */
581struct drm_mode_config { 743struct drm_mode_config {
582 struct mutex mutex; /* protects configuration (mode lists etc.) */ 744 struct mutex mutex; /* protects configuration (mode lists etc.) */
@@ -589,6 +751,8 @@ struct drm_mode_config {
589 struct list_head connector_list; 751 struct list_head connector_list;
590 int num_encoder; 752 int num_encoder;
591 struct list_head encoder_list; 753 struct list_head encoder_list;
754 int num_plane;
755 struct list_head plane_list;
592 756
593 int num_crtc; 757 int num_crtc;
594 struct list_head crtc_list; 758 struct list_head crtc_list;
@@ -641,6 +805,7 @@ struct drm_mode_config {
641#define obj_to_fb(x) container_of(x, struct drm_framebuffer, base) 805#define obj_to_fb(x) container_of(x, struct drm_framebuffer, base)
642#define obj_to_property(x) container_of(x, struct drm_property, base) 806#define obj_to_property(x) container_of(x, struct drm_property, base)
643#define obj_to_blob(x) container_of(x, struct drm_property_blob, base) 807#define obj_to_blob(x) container_of(x, struct drm_property_blob, base)
808#define obj_to_plane(x) container_of(x, struct drm_plane, base)
644 809
645 810
646extern void drm_crtc_init(struct drm_device *dev, 811extern void drm_crtc_init(struct drm_device *dev,
@@ -660,6 +825,14 @@ extern void drm_encoder_init(struct drm_device *dev,
660 const struct drm_encoder_funcs *funcs, 825 const struct drm_encoder_funcs *funcs,
661 int encoder_type); 826 int encoder_type);
662 827
828extern int drm_plane_init(struct drm_device *dev,
829 struct drm_plane *plane,
830 unsigned long possible_crtcs,
831 const struct drm_plane_funcs *funcs,
832 const uint32_t *formats, uint32_t format_count,
833 bool priv);
834extern void drm_plane_cleanup(struct drm_plane *plane);
835
663extern void drm_encoder_cleanup(struct drm_encoder *encoder); 836extern void drm_encoder_cleanup(struct drm_encoder *encoder);
664 837
665extern char *drm_get_connector_name(struct drm_connector *connector); 838extern char *drm_get_connector_name(struct drm_connector *connector);
@@ -753,17 +926,25 @@ extern struct drm_mode_object *drm_mode_object_find(struct drm_device *dev,
753/* IOCTLs */ 926/* IOCTLs */
754extern int drm_mode_getresources(struct drm_device *dev, 927extern int drm_mode_getresources(struct drm_device *dev,
755 void *data, struct drm_file *file_priv); 928 void *data, struct drm_file *file_priv);
756 929extern int drm_mode_getplane_res(struct drm_device *dev, void *data,
930 struct drm_file *file_priv);
757extern int drm_mode_getcrtc(struct drm_device *dev, 931extern int drm_mode_getcrtc(struct drm_device *dev,
758 void *data, struct drm_file *file_priv); 932 void *data, struct drm_file *file_priv);
759extern int drm_mode_getconnector(struct drm_device *dev, 933extern int drm_mode_getconnector(struct drm_device *dev,
760 void *data, struct drm_file *file_priv); 934 void *data, struct drm_file *file_priv);
761extern int drm_mode_setcrtc(struct drm_device *dev, 935extern int drm_mode_setcrtc(struct drm_device *dev,
762 void *data, struct drm_file *file_priv); 936 void *data, struct drm_file *file_priv);
937extern int drm_mode_getplane(struct drm_device *dev,
938 void *data, struct drm_file *file_priv);
939extern int drm_mode_setplane(struct drm_device *dev,
940 void *data, struct drm_file *file_priv);
763extern int drm_mode_cursor_ioctl(struct drm_device *dev, 941extern int drm_mode_cursor_ioctl(struct drm_device *dev,
764 void *data, struct drm_file *file_priv); 942 void *data, struct drm_file *file_priv);
765extern int drm_mode_addfb(struct drm_device *dev, 943extern int drm_mode_addfb(struct drm_device *dev,
766 void *data, struct drm_file *file_priv); 944 void *data, struct drm_file *file_priv);
945extern int drm_mode_addfb2(struct drm_device *dev,
946 void *data, struct drm_file *file_priv);
947extern uint32_t drm_mode_legacy_fb_format(uint32_t bpp, uint32_t depth);
767extern int drm_mode_rmfb(struct drm_device *dev, 948extern int drm_mode_rmfb(struct drm_device *dev,
768 void *data, struct drm_file *file_priv); 949 void *data, struct drm_file *file_priv);
769extern int drm_mode_getfb(struct drm_device *dev, 950extern int drm_mode_getfb(struct drm_device *dev,
@@ -824,4 +1005,7 @@ extern int drm_mode_mmap_dumb_ioctl(struct drm_device *dev,
824 void *data, struct drm_file *file_priv); 1005 void *data, struct drm_file *file_priv);
825extern int drm_mode_destroy_dumb_ioctl(struct drm_device *dev, 1006extern int drm_mode_destroy_dumb_ioctl(struct drm_device *dev,
826 void *data, struct drm_file *file_priv); 1007 void *data, struct drm_file *file_priv);
1008
1009extern void drm_fb_get_bpp_depth(uint32_t format, unsigned int *depth,
1010 int *bpp);
827#endif /* __DRM_CRTC_H__ */ 1011#endif /* __DRM_CRTC_H__ */
diff --git a/include/drm/drm_crtc_helper.h b/include/drm/drm_crtc_helper.h
index 73b071203dcc..37515d1afab3 100644
--- a/include/drm/drm_crtc_helper.h
+++ b/include/drm/drm_crtc_helper.h
@@ -117,7 +117,7 @@ extern bool drm_helper_encoder_in_use(struct drm_encoder *encoder);
117extern void drm_helper_connector_dpms(struct drm_connector *connector, int mode); 117extern void drm_helper_connector_dpms(struct drm_connector *connector, int mode);
118 118
119extern int drm_helper_mode_fill_fb_struct(struct drm_framebuffer *fb, 119extern int drm_helper_mode_fill_fb_struct(struct drm_framebuffer *fb,
120 struct drm_mode_fb_cmd *mode_cmd); 120 struct drm_mode_fb_cmd2 *mode_cmd);
121 121
122static inline void drm_crtc_helper_add(struct drm_crtc *crtc, 122static inline void drm_crtc_helper_add(struct drm_crtc *crtc,
123 const struct drm_crtc_helper_funcs *funcs) 123 const struct drm_crtc_helper_funcs *funcs)
@@ -144,4 +144,7 @@ extern void drm_helper_hpd_irq_event(struct drm_device *dev);
144 144
145extern void drm_kms_helper_poll_disable(struct drm_device *dev); 145extern void drm_kms_helper_poll_disable(struct drm_device *dev);
146extern void drm_kms_helper_poll_enable(struct drm_device *dev); 146extern void drm_kms_helper_poll_enable(struct drm_device *dev);
147
148extern int drm_format_num_planes(uint32_t format);
149
147#endif 150#endif
diff --git a/include/drm/drm_fourcc.h b/include/drm/drm_fourcc.h
new file mode 100644
index 000000000000..bdf0152cbbe9
--- /dev/null
+++ b/include/drm/drm_fourcc.h
@@ -0,0 +1,137 @@
1/*
2 * Copyright 2011 Intel Corporation
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
19 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
20 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
21 * OTHER DEALINGS IN THE SOFTWARE.
22 */
23
24#ifndef DRM_FOURCC_H
25#define DRM_FOURCC_H
26
27#include <linux/types.h>
28
29#define fourcc_code(a, b, c, d) ((__u32)(a) | ((__u32)(b) << 8) | \
30 ((__u32)(c) << 16) | ((__u32)(d) << 24))
31
32#define DRM_FORMAT_BIG_ENDIAN (1<<31) /* format is big endian instead of little endian */
33
34/* color index */
35#define DRM_FORMAT_C8 fourcc_code('C', '8', ' ', ' ') /* [7:0] C */
36
37/* 8 bpp RGB */
38#define DRM_FORMAT_RGB332 fourcc_code('R', 'G', 'B', '8') /* [7:0] R:G:B 3:3:2 */
39#define DRM_FORMAT_BGR233 fourcc_code('B', 'G', 'R', '8') /* [7:0] B:G:R 2:3:3 */
40
41/* 16 bpp RGB */
42#define DRM_FORMAT_XRGB4444 fourcc_code('X', 'R', '1', '2') /* [15:0] x:R:G:B 4:4:4:4 little endian */
43#define DRM_FORMAT_XBGR4444 fourcc_code('X', 'B', '1', '2') /* [15:0] x:B:G:R 4:4:4:4 little endian */
44#define DRM_FORMAT_RGBX4444 fourcc_code('R', 'X', '1', '2') /* [15:0] R:G:B:x 4:4:4:4 little endian */
45#define DRM_FORMAT_BGRX4444 fourcc_code('B', 'X', '1', '2') /* [15:0] B:G:R:x 4:4:4:4 little endian */
46
47#define DRM_FORMAT_ARGB4444 fourcc_code('A', 'R', '1', '2') /* [15:0] A:R:G:B 4:4:4:4 little endian */
48#define DRM_FORMAT_ABGR4444 fourcc_code('A', 'B', '1', '2') /* [15:0] A:B:G:R 4:4:4:4 little endian */
49#define DRM_FORMAT_RGBA4444 fourcc_code('R', 'A', '1', '2') /* [15:0] R:G:B:A 4:4:4:4 little endian */
50#define DRM_FORMAT_BGRA4444 fourcc_code('B', 'A', '1', '2') /* [15:0] B:G:R:A 4:4:4:4 little endian */
51
52#define DRM_FORMAT_XRGB1555 fourcc_code('X', 'R', '1', '5') /* [15:0] x:R:G:B 1:5:5:5 little endian */
53#define DRM_FORMAT_XBGR1555 fourcc_code('X', 'B', '1', '5') /* [15:0] x:B:G:R 1:5:5:5 little endian */
54#define DRM_FORMAT_RGBX5551 fourcc_code('R', 'X', '1', '5') /* [15:0] R:G:B:x 5:5:5:1 little endian */
55#define DRM_FORMAT_BGRX5551 fourcc_code('B', 'X', '1', '5') /* [15:0] B:G:R:x 5:5:5:1 little endian */
56
57#define DRM_FORMAT_ARGB1555 fourcc_code('A', 'R', '1', '5') /* [15:0] A:R:G:B 1:5:5:5 little endian */
58#define DRM_FORMAT_ABGR1555 fourcc_code('A', 'B', '1', '5') /* [15:0] A:B:G:R 1:5:5:5 little endian */
59#define DRM_FORMAT_RGBA5551 fourcc_code('R', 'A', '1', '5') /* [15:0] R:G:B:A 5:5:5:1 little endian */
60#define DRM_FORMAT_BGRA5551 fourcc_code('B', 'A', '1', '5') /* [15:0] B:G:R:A 5:5:5:1 little endian */
61
62#define DRM_FORMAT_RGB565 fourcc_code('R', 'G', '1', '6') /* [15:0] R:G:B 5:6:5 little endian */
63#define DRM_FORMAT_BGR565 fourcc_code('B', 'G', '1', '6') /* [15:0] B:G:R 5:6:5 little endian */
64
65/* 24 bpp RGB */
66#define DRM_FORMAT_RGB888 fourcc_code('R', 'G', '2', '4') /* [23:0] R:G:B little endian */
67#define DRM_FORMAT_BGR888 fourcc_code('B', 'G', '2', '4') /* [23:0] B:G:R little endian */
68
69/* 32 bpp RGB */
70#define DRM_FORMAT_XRGB8888 fourcc_code('X', 'R', '2', '4') /* [31:0] x:R:G:B 8:8:8:8 little endian */
71#define DRM_FORMAT_XBGR8888 fourcc_code('X', 'B', '2', '4') /* [31:0] x:B:G:R 8:8:8:8 little endian */
72#define DRM_FORMAT_RGBX8888 fourcc_code('R', 'X', '2', '4') /* [31:0] R:G:B:x 8:8:8:8 little endian */
73#define DRM_FORMAT_BGRX8888 fourcc_code('B', 'X', '2', '4') /* [31:0] B:G:R:x 8:8:8:8 little endian */
74
75#define DRM_FORMAT_ARGB8888 fourcc_code('A', 'R', '2', '4') /* [31:0] A:R:G:B 8:8:8:8 little endian */
76#define DRM_FORMAT_ABGR8888 fourcc_code('A', 'B', '2', '4') /* [31:0] A:B:G:R 8:8:8:8 little endian */
77#define DRM_FORMAT_RGBA8888 fourcc_code('R', 'A', '2', '4') /* [31:0] R:G:B:A 8:8:8:8 little endian */
78#define DRM_FORMAT_BGRA8888 fourcc_code('B', 'A', '2', '4') /* [31:0] B:G:R:A 8:8:8:8 little endian */
79
80#define DRM_FORMAT_XRGB2101010 fourcc_code('X', 'R', '3', '0') /* [31:0] x:R:G:B 2:10:10:10 little endian */
81#define DRM_FORMAT_XBGR2101010 fourcc_code('X', 'B', '3', '0') /* [31:0] x:B:G:R 2:10:10:10 little endian */
82#define DRM_FORMAT_RGBX1010102 fourcc_code('R', 'X', '3', '0') /* [31:0] R:G:B:x 10:10:10:2 little endian */
83#define DRM_FORMAT_BGRX1010102 fourcc_code('B', 'X', '3', '0') /* [31:0] B:G:R:x 10:10:10:2 little endian */
84
85#define DRM_FORMAT_ARGB2101010 fourcc_code('A', 'R', '3', '0') /* [31:0] A:R:G:B 2:10:10:10 little endian */
86#define DRM_FORMAT_ABGR2101010 fourcc_code('A', 'B', '3', '0') /* [31:0] A:B:G:R 2:10:10:10 little endian */
87#define DRM_FORMAT_RGBA1010102 fourcc_code('R', 'A', '3', '0') /* [31:0] R:G:B:A 10:10:10:2 little endian */
88#define DRM_FORMAT_BGRA1010102 fourcc_code('B', 'A', '3', '0') /* [31:0] B:G:R:A 10:10:10:2 little endian */
89
90/* packed YCbCr */
91#define DRM_FORMAT_YUYV fourcc_code('Y', 'U', 'Y', 'V') /* [31:0] Cr0:Y1:Cb0:Y0 8:8:8:8 little endian */
92#define DRM_FORMAT_YVYU fourcc_code('Y', 'V', 'Y', 'U') /* [31:0] Cb0:Y1:Cr0:Y0 8:8:8:8 little endian */
93#define DRM_FORMAT_UYVY fourcc_code('U', 'Y', 'V', 'Y') /* [31:0] Y1:Cr0:Y0:Cb0 8:8:8:8 little endian */
94#define DRM_FORMAT_VYUY fourcc_code('V', 'Y', 'U', 'Y') /* [31:0] Y1:Cb0:Y0:Cr0 8:8:8:8 little endian */
95
96#define DRM_FORMAT_AYUV fourcc_code('A', 'Y', 'U', 'V') /* [31:0] A:Y:Cb:Cr 8:8:8:8 little endian */
97
98/*
99 * 2 plane YCbCr
100 * index 0 = Y plane, [7:0] Y
101 * index 1 = Cr:Cb plane, [15:0] Cr:Cb little endian
102 * or
103 * index 1 = Cb:Cr plane, [15:0] Cb:Cr little endian
104 */
105#define DRM_FORMAT_NV12 fourcc_code('N', 'V', '1', '2') /* 2x2 subsampled Cr:Cb plane */
106#define DRM_FORMAT_NV21 fourcc_code('N', 'V', '2', '1') /* 2x2 subsampled Cb:Cr plane */
107#define DRM_FORMAT_NV16 fourcc_code('N', 'V', '1', '6') /* 2x1 subsampled Cr:Cb plane */
108#define DRM_FORMAT_NV61 fourcc_code('N', 'V', '6', '1') /* 2x1 subsampled Cb:Cr plane */
109
110/* 2 non contiguous plane YCbCr */
111#define DRM_FORMAT_NV12M fourcc_code('N', 'M', '1', '2') /* 2x2 subsampled Cr:Cb plane */
112#define DRM_FORMAT_NV12MT fourcc_code('T', 'M', '1', '2') /* 2x2 subsampled Cr:Cb plane 64x32 macroblocks */
113
114/*
115 * 3 plane YCbCr
116 * index 0: Y plane, [7:0] Y
117 * index 1: Cb plane, [7:0] Cb
118 * index 2: Cr plane, [7:0] Cr
119 * or
120 * index 1: Cr plane, [7:0] Cr
121 * index 2: Cb plane, [7:0] Cb
122 */
123#define DRM_FORMAT_YUV410 fourcc_code('Y', 'U', 'V', '9') /* 4x4 subsampled Cb (1) and Cr (2) planes */
124#define DRM_FORMAT_YVU410 fourcc_code('Y', 'V', 'U', '9') /* 4x4 subsampled Cr (1) and Cb (2) planes */
125#define DRM_FORMAT_YUV411 fourcc_code('Y', 'U', '1', '1') /* 4x1 subsampled Cb (1) and Cr (2) planes */
126#define DRM_FORMAT_YVU411 fourcc_code('Y', 'V', '1', '1') /* 4x1 subsampled Cr (1) and Cb (2) planes */
127#define DRM_FORMAT_YUV420 fourcc_code('Y', 'U', '1', '2') /* 2x2 subsampled Cb (1) and Cr (2) planes */
128#define DRM_FORMAT_YVU420 fourcc_code('Y', 'V', '1', '2') /* 2x2 subsampled Cr (1) and Cb (2) planes */
129#define DRM_FORMAT_YUV422 fourcc_code('Y', 'U', '1', '6') /* 2x1 subsampled Cb (1) and Cr (2) planes */
130#define DRM_FORMAT_YVU422 fourcc_code('Y', 'V', '1', '6') /* 2x1 subsampled Cr (1) and Cb (2) planes */
131#define DRM_FORMAT_YUV444 fourcc_code('Y', 'U', '2', '4') /* non-subsampled Cb (1) and Cr (2) planes */
132#define DRM_FORMAT_YVU444 fourcc_code('Y', 'V', '2', '4') /* non-subsampled Cr (1) and Cb (2) planes */
133
134/* 3 non contiguous plane YCbCr */
135#define DRM_FORMAT_YUV420M fourcc_code('Y', 'M', '1', '2') /* 2x2 subsampled Cb (1) and Cr (2) planes */
136
137#endif /* DRM_FOURCC_H */
diff --git a/include/drm/drm_mode.h b/include/drm/drm_mode.h
index ddd46db65b57..2a2acda8b437 100644
--- a/include/drm/drm_mode.h
+++ b/include/drm/drm_mode.h
@@ -120,11 +120,48 @@ struct drm_mode_crtc {
120 struct drm_mode_modeinfo mode; 120 struct drm_mode_modeinfo mode;
121}; 121};
122 122
123#define DRM_MODE_ENCODER_NONE 0 123#define DRM_MODE_PRESENT_TOP_FIELD (1<<0)
124#define DRM_MODE_ENCODER_DAC 1 124#define DRM_MODE_PRESENT_BOTTOM_FIELD (1<<1)
125#define DRM_MODE_ENCODER_TMDS 2 125
126#define DRM_MODE_ENCODER_LVDS 3 126/* Planes blend with or override other bits on the CRTC */
127#define DRM_MODE_ENCODER_TVDAC 4 127struct drm_mode_set_plane {
128 __u32 plane_id;
129 __u32 crtc_id;
130 __u32 fb_id; /* fb object contains surface format type */
131 __u32 flags; /* see above flags */
132
133 /* Signed dest location allows it to be partially off screen */
134 __s32 crtc_x, crtc_y;
135 __u32 crtc_w, crtc_h;
136
137 /* Source values are 16.16 fixed point */
138 __u32 src_x, src_y;
139 __u32 src_h, src_w;
140};
141
142struct drm_mode_get_plane {
143 __u32 plane_id;
144
145 __u32 crtc_id;
146 __u32 fb_id;
147
148 __u32 possible_crtcs;
149 __u32 gamma_size;
150
151 __u32 count_format_types;
152 __u64 format_type_ptr;
153};
154
155struct drm_mode_get_plane_res {
156 __u64 plane_id_ptr;
157 __u32 count_planes;
158};
159
160#define DRM_MODE_ENCODER_NONE 0
161#define DRM_MODE_ENCODER_DAC 1
162#define DRM_MODE_ENCODER_TMDS 2
163#define DRM_MODE_ENCODER_LVDS 3
164#define DRM_MODE_ENCODER_TVDAC 4
128#define DRM_MODE_ENCODER_VIRTUAL 5 165#define DRM_MODE_ENCODER_VIRTUAL 5
129 166
130struct drm_mode_get_encoder { 167struct drm_mode_get_encoder {
@@ -231,6 +268,33 @@ struct drm_mode_fb_cmd {
231 __u32 handle; 268 __u32 handle;
232}; 269};
233 270
271#define DRM_MODE_FB_INTERLACED (1<<0) /* for interlaced framebuffers */
272
273struct drm_mode_fb_cmd2 {
274 __u32 fb_id;
275 __u32 width, height;
276 __u32 pixel_format; /* fourcc code from drm_fourcc.h */
277 __u32 flags; /* see above flags */
278
279 /*
280 * In case of planar formats, this ioctl allows up to 4
281 * buffer objects with offets and pitches per plane.
282 * The pitch and offset order is dictated by the fourcc,
283 * e.g. NV12 (http://fourcc.org/yuv.php#NV12) is described as:
284 *
285 * YUV 4:2:0 image with a plane of 8 bit Y samples
286 * followed by an interleaved U/V plane containing
287 * 8 bit 2x2 subsampled colour difference samples.
288 *
289 * So it would consist of Y as offset[0] and UV as
290 * offeset[1]. Note that offset[0] will generally
291 * be 0.
292 */
293 __u32 handles[4];
294 __u32 pitches[4]; /* pitch for each plane */
295 __u32 offsets[4]; /* offset of each plane */
296};
297
234#define DRM_MODE_FB_DIRTY_ANNOTATE_COPY 0x01 298#define DRM_MODE_FB_DIRTY_ANNOTATE_COPY 0x01
235#define DRM_MODE_FB_DIRTY_ANNOTATE_FILL 0x02 299#define DRM_MODE_FB_DIRTY_ANNOTATE_FILL 0x02
236#define DRM_MODE_FB_DIRTY_FLAGS 0x03 300#define DRM_MODE_FB_DIRTY_FLAGS 0x03
diff --git a/include/drm/drm_sman.h b/include/drm/drm_sman.h
deleted file mode 100644
index 08ecf83ad5d4..000000000000
--- a/include/drm/drm_sman.h
+++ /dev/null
@@ -1,176 +0,0 @@
1/**************************************************************************
2 *
3 * Copyright 2006 Tungsten Graphics, Inc., Bismarck, ND., USA.
4 * All Rights Reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
13 *
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
16 * of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
21 * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
22 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
23 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
24 * USE OR OTHER DEALINGS IN THE SOFTWARE.
25 *
26 *
27 **************************************************************************/
28/*
29 * Simple memory MANager interface that keeps track on allocate regions on a
30 * per "owner" basis. All regions associated with an "owner" can be released
31 * with a simple call. Typically if the "owner" exists. The owner is any
32 * "unsigned long" identifier. Can typically be a pointer to a file private
33 * struct or a context identifier.
34 *
35 * Authors:
36 * Thomas Hellström <thomas-at-tungstengraphics-dot-com>
37 */
38
39#ifndef DRM_SMAN_H
40#define DRM_SMAN_H
41
42#include "drmP.h"
43#include "drm_hashtab.h"
44
45/*
46 * A class that is an abstration of a simple memory allocator.
47 * The sman implementation provides a default such allocator
48 * using the drm_mm.c implementation. But the user can replace it.
49 * See the SiS implementation, which may use the SiS FB kernel module
50 * for memory management.
51 */
52
53struct drm_sman_mm {
54 /* private info. If allocated, needs to be destroyed by the destroy
55 function */
56 void *private;
57
58 /* Allocate a memory block with given size and alignment.
59 Return an opaque reference to the memory block */
60
61 void *(*allocate) (void *private, unsigned long size,
62 unsigned alignment);
63
64 /* Free a memory block. "ref" is the opaque reference that we got from
65 the "alloc" function */
66
67 void (*free) (void *private, void *ref);
68
69 /* Free all resources associated with this allocator */
70
71 void (*destroy) (void *private);
72
73 /* Return a memory offset from the opaque reference returned from the
74 "alloc" function */
75
76 unsigned long (*offset) (void *private, void *ref);
77};
78
79struct drm_memblock_item {
80 struct list_head owner_list;
81 struct drm_hash_item user_hash;
82 void *mm_info;
83 struct drm_sman_mm *mm;
84 struct drm_sman *sman;
85};
86
87struct drm_sman {
88 struct drm_sman_mm *mm;
89 int num_managers;
90 struct drm_open_hash owner_hash_tab;
91 struct drm_open_hash user_hash_tab;
92 struct list_head owner_items;
93};
94
95/*
96 * Take down a memory manager. This function should only be called after a
97 * successful init and after a call to drm_sman_cleanup.
98 */
99
100extern void drm_sman_takedown(struct drm_sman * sman);
101
102/*
103 * Allocate structures for a manager.
104 * num_managers are the number of memory pools to manage. (VRAM, AGP, ....)
105 * user_order is the log2 of the number of buckets in the user hash table.
106 * set this to approximately log2 of the max number of memory regions
107 * that will be allocated for _all_ pools together.
108 * owner_order is the log2 of the number of buckets in the owner hash table.
109 * set this to approximately log2 of
110 * the number of client file connections that will
111 * be using the manager.
112 *
113 */
114
115extern int drm_sman_init(struct drm_sman * sman, unsigned int num_managers,
116 unsigned int user_order, unsigned int owner_order);
117
118/*
119 * Initialize a drm_mm.c allocator. Should be called only once for each
120 * manager unless a customized allogator is used.
121 */
122
123extern int drm_sman_set_range(struct drm_sman * sman, unsigned int manager,
124 unsigned long start, unsigned long size);
125
126/*
127 * Initialize a customized allocator for one of the managers.
128 * (See the SiS module). The object pointed to by "allocator" is copied,
129 * so it can be destroyed after this call.
130 */
131
132extern int drm_sman_set_manager(struct drm_sman * sman, unsigned int mananger,
133 struct drm_sman_mm * allocator);
134
135/*
136 * Allocate a memory block. Aligment is not implemented yet.
137 */
138
139extern struct drm_memblock_item *drm_sman_alloc(struct drm_sman * sman,
140 unsigned int manager,
141 unsigned long size,
142 unsigned alignment,
143 unsigned long owner);
144/*
145 * Free a memory block identified by its user hash key.
146 */
147
148extern int drm_sman_free_key(struct drm_sman * sman, unsigned int key);
149
150/*
151 * returns 1 iff there are no stale memory blocks associated with this owner.
152 * Typically called to determine if we need to idle the hardware and call
153 * drm_sman_owner_cleanup. If there are no stale memory blocks, it removes all
154 * resources associated with owner.
155 */
156
157extern int drm_sman_owner_clean(struct drm_sman * sman, unsigned long owner);
158
159/*
160 * Frees all stale memory blocks associated with this owner. Note that this
161 * requires that the hardware is finished with all blocks, so the graphics engine
162 * should be idled before this call is made. This function also frees
163 * any resources associated with "owner" and should be called when owner
164 * is not going to be referenced anymore.
165 */
166
167extern void drm_sman_owner_cleanup(struct drm_sman * sman, unsigned long owner);
168
169/*
170 * Frees all stale memory blocks associated with the memory manager.
171 * See idling above.
172 */
173
174extern void drm_sman_cleanup(struct drm_sman * sman);
175
176#endif
diff --git a/include/drm/exynos_drm.h b/include/drm/exynos_drm.h
index 12050434d57a..5e120f1c5cd9 100644
--- a/include/drm/exynos_drm.h
+++ b/include/drm/exynos_drm.h
@@ -74,9 +74,16 @@ struct drm_exynos_gem_mmap {
74 uint64_t mapped; 74 uint64_t mapped;
75}; 75};
76 76
77struct drm_exynos_plane_set_zpos {
78 __u32 plane_id;
79 __s32 zpos;
80};
81
77#define DRM_EXYNOS_GEM_CREATE 0x00 82#define DRM_EXYNOS_GEM_CREATE 0x00
78#define DRM_EXYNOS_GEM_MAP_OFFSET 0x01 83#define DRM_EXYNOS_GEM_MAP_OFFSET 0x01
79#define DRM_EXYNOS_GEM_MMAP 0x02 84#define DRM_EXYNOS_GEM_MMAP 0x02
85/* Reserved 0x03 ~ 0x05 for exynos specific gem ioctl */
86#define DRM_EXYNOS_PLANE_SET_ZPOS 0x06
80 87
81#define DRM_IOCTL_EXYNOS_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + \ 88#define DRM_IOCTL_EXYNOS_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + \
82 DRM_EXYNOS_GEM_CREATE, struct drm_exynos_gem_create) 89 DRM_EXYNOS_GEM_CREATE, struct drm_exynos_gem_create)
@@ -87,6 +94,9 @@ struct drm_exynos_gem_mmap {
87#define DRM_IOCTL_EXYNOS_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + \ 94#define DRM_IOCTL_EXYNOS_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + \
88 DRM_EXYNOS_GEM_MMAP, struct drm_exynos_gem_mmap) 95 DRM_EXYNOS_GEM_MMAP, struct drm_exynos_gem_mmap)
89 96
97#define DRM_IOCTL_EXYNOS_PLANE_SET_ZPOS DRM_IOWR(DRM_COMMAND_BASE + \
98 DRM_EXYNOS_PLANE_SET_ZPOS, struct drm_exynos_plane_set_zpos)
99
90/** 100/**
91 * Platform Specific Structure for DRM based FIMD. 101 * Platform Specific Structure for DRM based FIMD.
92 * 102 *
@@ -102,4 +112,31 @@ struct exynos_drm_fimd_pdata {
102 unsigned int bpp; 112 unsigned int bpp;
103}; 113};
104 114
115/**
116 * Platform Specific Structure for DRM based HDMI.
117 *
118 * @hdmi_dev: device point to specific hdmi driver.
119 * @mixer_dev: device point to specific mixer driver.
120 *
121 * this structure is used for common hdmi driver and each device object
122 * would be used to access specific device driver(hdmi or mixer driver)
123 */
124struct exynos_drm_common_hdmi_pd {
125 struct device *hdmi_dev;
126 struct device *mixer_dev;
127};
128
129/**
130 * Platform Specific Structure for DRM based HDMI core.
131 *
132 * @timing: default video mode for initializing
133 * @default_win: default window layer number to be used for UI.
134 * @bpp: default bit per pixel.
135 */
136struct exynos_drm_hdmi_pdata {
137 struct fb_videomode timing;
138 unsigned int default_win;
139 unsigned int bpp;
140};
141
105#endif 142#endif
diff --git a/include/drm/gma_drm.h b/include/drm/gma_drm.h
new file mode 100644
index 000000000000..113686785717
--- /dev/null
+++ b/include/drm/gma_drm.h
@@ -0,0 +1,91 @@
1/**************************************************************************
2 * Copyright (c) 2007-2011, Intel Corporation.
3 * All Rights Reserved.
4 * Copyright (c) 2008, Tungsten Graphics Inc. Cedar Park, TX., USA.
5 * All Rights Reserved.
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms and conditions of the GNU General Public License,
9 * version 2, as published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * more details.
15 *
16 * You should have received a copy of the GNU General Public License along with
17 * this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 **************************************************************************/
21
22#ifndef _PSB_DRM_H_
23#define _PSB_DRM_H_
24
25/*
26 * Manage the LUT for an output
27 */
28struct drm_psb_dpst_lut_arg {
29 uint8_t lut[256];
30 int output_id;
31};
32
33/*
34 * Validate modes
35 */
36struct drm_psb_mode_operation_arg {
37 u32 obj_id;
38 u16 operation;
39 struct drm_mode_modeinfo mode;
40 u64 data;
41};
42
43/*
44 * Query the stolen memory for smarter management of
45 * memory by the server
46 */
47struct drm_psb_stolen_memory_arg {
48 u32 base;
49 u32 size;
50};
51
52struct drm_psb_get_pipe_from_crtc_id_arg {
53 /** ID of CRTC being requested **/
54 u32 crtc_id;
55 /** pipe of requested CRTC **/
56 u32 pipe;
57};
58
59struct drm_psb_gem_create {
60 __u64 size;
61 __u32 handle;
62 __u32 flags;
63#define GMA_GEM_CREATE_STOLEN 1 /* Stolen memory can be used */
64};
65
66struct drm_psb_gem_mmap {
67 __u32 handle;
68 __u32 pad;
69 /**
70 * Fake offset to use for subsequent mmap call
71 *
72 * This is a fixed-size type for 32/64 compatibility.
73 */
74 __u64 offset;
75};
76
77/* Controlling the kernel modesetting buffers */
78
79#define DRM_GMA_GEM_CREATE 0x00 /* Create a GEM object */
80#define DRM_GMA_GEM_MMAP 0x01 /* Map GEM memory */
81#define DRM_GMA_STOLEN_MEMORY 0x02 /* Report stolen memory */
82#define DRM_GMA_2D_OP 0x03 /* Will be merged later */
83#define DRM_GMA_GAMMA 0x04 /* Set gamma table */
84#define DRM_GMA_ADB 0x05 /* Get backlight */
85#define DRM_GMA_DPST_BL 0x06 /* Set backlight */
86#define DRM_GMA_GET_PIPE_FROM_CRTC_ID 0x1 /* CRTC to physical pipe# */
87#define DRM_GMA_MODE_OPERATION 0x07 /* Mode validation/DC set */
88#define PSB_MODE_OPERATION_MODE_VALID 0x01
89
90
91#endif
diff --git a/include/drm/i915_drm.h b/include/drm/i915_drm.h
index 28c0d114cb52..924f6a454fed 100644
--- a/include/drm/i915_drm.h
+++ b/include/drm/i915_drm.h
@@ -198,6 +198,8 @@ typedef struct _drm_i915_sarea {
198#define DRM_I915_OVERLAY_PUT_IMAGE 0x27 198#define DRM_I915_OVERLAY_PUT_IMAGE 0x27
199#define DRM_I915_OVERLAY_ATTRS 0x28 199#define DRM_I915_OVERLAY_ATTRS 0x28
200#define DRM_I915_GEM_EXECBUFFER2 0x29 200#define DRM_I915_GEM_EXECBUFFER2 0x29
201#define DRM_I915_GET_SPRITE_COLORKEY 0x2a
202#define DRM_I915_SET_SPRITE_COLORKEY 0x2b
201 203
202#define DRM_IOCTL_I915_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t) 204#define DRM_IOCTL_I915_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t)
203#define DRM_IOCTL_I915_FLUSH DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLUSH) 205#define DRM_IOCTL_I915_FLUSH DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLUSH)
@@ -239,6 +241,8 @@ typedef struct _drm_i915_sarea {
239#define DRM_IOCTL_I915_GEM_MADVISE DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MADVISE, struct drm_i915_gem_madvise) 241#define DRM_IOCTL_I915_GEM_MADVISE DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MADVISE, struct drm_i915_gem_madvise)
240#define DRM_IOCTL_I915_OVERLAY_PUT_IMAGE DRM_IOW(DRM_COMMAND_BASE + DRM_I915_OVERLAY_PUT_IMAGE, struct drm_intel_overlay_put_image) 242#define DRM_IOCTL_I915_OVERLAY_PUT_IMAGE DRM_IOW(DRM_COMMAND_BASE + DRM_I915_OVERLAY_PUT_IMAGE, struct drm_intel_overlay_put_image)
241#define DRM_IOCTL_I915_OVERLAY_ATTRS DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_OVERLAY_ATTRS, struct drm_intel_overlay_attrs) 243#define DRM_IOCTL_I915_OVERLAY_ATTRS DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_OVERLAY_ATTRS, struct drm_intel_overlay_attrs)
244#define DRM_IOCTL_I915_SET_SPRITE_COLORKEY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_SET_SPRITE_COLORKEY, struct drm_intel_sprite_colorkey)
245#define DRM_IOCTL_I915_GET_SPRITE_COLORKEY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_SET_SPRITE_COLORKEY, struct drm_intel_sprite_colorkey)
242 246
243/* Allow drivers to submit batchbuffers directly to hardware, relying 247/* Allow drivers to submit batchbuffers directly to hardware, relying
244 * on the security mechanisms provided by hardware. 248 * on the security mechanisms provided by hardware.
@@ -291,6 +295,7 @@ typedef struct drm_i915_irq_wait {
291#define I915_PARAM_HAS_COHERENT_RINGS 13 295#define I915_PARAM_HAS_COHERENT_RINGS 13
292#define I915_PARAM_HAS_EXEC_CONSTANTS 14 296#define I915_PARAM_HAS_EXEC_CONSTANTS 14
293#define I915_PARAM_HAS_RELAXED_DELTA 15 297#define I915_PARAM_HAS_RELAXED_DELTA 15
298#define I915_PARAM_HAS_GEN7_SOL_RESET 16
294 299
295typedef struct drm_i915_getparam { 300typedef struct drm_i915_getparam {
296 int param; 301 int param;
@@ -653,6 +658,9 @@ struct drm_i915_gem_execbuffer2 {
653 __u64 rsvd2; 658 __u64 rsvd2;
654}; 659};
655 660
661/** Resets the SO write offset registers for transform feedback on gen7. */
662#define I915_EXEC_GEN7_SOL_RESET (1<<8)
663
656struct drm_i915_gem_pin { 664struct drm_i915_gem_pin {
657 /** Handle of the buffer to be pinned. */ 665 /** Handle of the buffer to be pinned. */
658 __u32 handle; 666 __u32 handle;
@@ -844,4 +852,36 @@ struct drm_intel_overlay_attrs {
844 __u32 gamma5; 852 __u32 gamma5;
845}; 853};
846 854
855/*
856 * Intel sprite handling
857 *
858 * Color keying works with a min/mask/max tuple. Both source and destination
859 * color keying is allowed.
860 *
861 * Source keying:
862 * Sprite pixels within the min & max values, masked against the color channels
863 * specified in the mask field, will be transparent. All other pixels will
864 * be displayed on top of the primary plane. For RGB surfaces, only the min
865 * and mask fields will be used; ranged compares are not allowed.
866 *
867 * Destination keying:
868 * Primary plane pixels that match the min value, masked against the color
869 * channels specified in the mask field, will be replaced by corresponding
870 * pixels from the sprite plane.
871 *
872 * Note that source & destination keying are exclusive; only one can be
873 * active on a given plane.
874 */
875
876#define I915_SET_COLORKEY_NONE (1<<0) /* disable color key matching */
877#define I915_SET_COLORKEY_DESTINATION (1<<1)
878#define I915_SET_COLORKEY_SOURCE (1<<2)
879struct drm_intel_sprite_colorkey {
880 __u32 plane_id;
881 __u32 min_value;
882 __u32 channel_mask;
883 __u32 max_value;
884 __u32 flags;
885};
886
847#endif /* _I915_DRM_H_ */ 887#endif /* _I915_DRM_H_ */
diff --git a/include/drm/radeon_drm.h b/include/drm/radeon_drm.h
index be94be6d6f17..b55da40953fd 100644
--- a/include/drm/radeon_drm.h
+++ b/include/drm/radeon_drm.h
@@ -509,6 +509,7 @@ typedef struct {
509#define DRM_RADEON_GEM_SET_TILING 0x28 509#define DRM_RADEON_GEM_SET_TILING 0x28
510#define DRM_RADEON_GEM_GET_TILING 0x29 510#define DRM_RADEON_GEM_GET_TILING 0x29
511#define DRM_RADEON_GEM_BUSY 0x2a 511#define DRM_RADEON_GEM_BUSY 0x2a
512#define DRM_RADEON_GEM_VA 0x2b
512 513
513#define DRM_IOCTL_RADEON_CP_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_CP_INIT, drm_radeon_init_t) 514#define DRM_IOCTL_RADEON_CP_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_CP_INIT, drm_radeon_init_t)
514#define DRM_IOCTL_RADEON_CP_START DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_CP_START) 515#define DRM_IOCTL_RADEON_CP_START DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_CP_START)
@@ -550,6 +551,7 @@ typedef struct {
550#define DRM_IOCTL_RADEON_GEM_SET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_SET_TILING, struct drm_radeon_gem_set_tiling) 551#define DRM_IOCTL_RADEON_GEM_SET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_SET_TILING, struct drm_radeon_gem_set_tiling)
551#define DRM_IOCTL_RADEON_GEM_GET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_GET_TILING, struct drm_radeon_gem_get_tiling) 552#define DRM_IOCTL_RADEON_GEM_GET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_GET_TILING, struct drm_radeon_gem_get_tiling)
552#define DRM_IOCTL_RADEON_GEM_BUSY DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_BUSY, struct drm_radeon_gem_busy) 553#define DRM_IOCTL_RADEON_GEM_BUSY DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_BUSY, struct drm_radeon_gem_busy)
554#define DRM_IOCTL_RADEON_GEM_VA DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_VA, struct drm_radeon_gem_va)
553 555
554typedef struct drm_radeon_init { 556typedef struct drm_radeon_init {
555 enum { 557 enum {
@@ -872,12 +874,39 @@ struct drm_radeon_gem_pwrite {
872 uint64_t data_ptr; 874 uint64_t data_ptr;
873}; 875};
874 876
877#define RADEON_VA_MAP 1
878#define RADEON_VA_UNMAP 2
879
880#define RADEON_VA_RESULT_OK 0
881#define RADEON_VA_RESULT_ERROR 1
882#define RADEON_VA_RESULT_VA_EXIST 2
883
884#define RADEON_VM_PAGE_VALID (1 << 0)
885#define RADEON_VM_PAGE_READABLE (1 << 1)
886#define RADEON_VM_PAGE_WRITEABLE (1 << 2)
887#define RADEON_VM_PAGE_SYSTEM (1 << 3)
888#define RADEON_VM_PAGE_SNOOPED (1 << 4)
889
890struct drm_radeon_gem_va {
891 uint32_t handle;
892 uint32_t operation;
893 uint32_t vm_id;
894 uint32_t flags;
895 uint64_t offset;
896};
897
875#define RADEON_CHUNK_ID_RELOCS 0x01 898#define RADEON_CHUNK_ID_RELOCS 0x01
876#define RADEON_CHUNK_ID_IB 0x02 899#define RADEON_CHUNK_ID_IB 0x02
877#define RADEON_CHUNK_ID_FLAGS 0x03 900#define RADEON_CHUNK_ID_FLAGS 0x03
878 901
879/* The first dword of RADEON_CHUNK_ID_FLAGS is a uint32 of these flags: */ 902/* The first dword of RADEON_CHUNK_ID_FLAGS is a uint32 of these flags: */
880#define RADEON_CS_KEEP_TILING_FLAGS 0x01 903#define RADEON_CS_KEEP_TILING_FLAGS 0x01
904#define RADEON_CS_USE_VM 0x02
905/* The second dword of RADEON_CHUNK_ID_FLAGS is a uint32 that sets the ring type */
906#define RADEON_CS_RING_GFX 0
907#define RADEON_CS_RING_COMPUTE 1
908/* The third dword of RADEON_CHUNK_ID_FLAGS is a sint32 that sets the priority */
909/* 0 = normal, + = higher priority, - = lower priority */
881 910
882struct drm_radeon_cs_chunk { 911struct drm_radeon_cs_chunk {
883 uint32_t chunk_id; 912 uint32_t chunk_id;
@@ -885,6 +914,9 @@ struct drm_radeon_cs_chunk {
885 uint64_t chunk_data; 914 uint64_t chunk_data;
886}; 915};
887 916
917/* drm_radeon_cs_reloc.flags */
918#define RADEON_RELOC_DONT_SYNC 0x01
919
888struct drm_radeon_cs_reloc { 920struct drm_radeon_cs_reloc {
889 uint32_t handle; 921 uint32_t handle;
890 uint32_t read_domains; 922 uint32_t read_domains;
@@ -916,6 +948,10 @@ struct drm_radeon_cs {
916#define RADEON_INFO_NUM_TILE_PIPES 0x0b /* tile pipes for r600+ */ 948#define RADEON_INFO_NUM_TILE_PIPES 0x0b /* tile pipes for r600+ */
917#define RADEON_INFO_FUSION_GART_WORKING 0x0c /* fusion writes to GTT were broken before this */ 949#define RADEON_INFO_FUSION_GART_WORKING 0x0c /* fusion writes to GTT were broken before this */
918#define RADEON_INFO_BACKEND_MAP 0x0d /* pipe to backend map, needed by mesa */ 950#define RADEON_INFO_BACKEND_MAP 0x0d /* pipe to backend map, needed by mesa */
951/* virtual address start, va < start are reserved by the kernel */
952#define RADEON_INFO_VA_START 0x0e
953/* maximum size of ib using the virtual memory cs */
954#define RADEON_INFO_IB_VM_MAX_SIZE 0x0f
919 955
920struct drm_radeon_info { 956struct drm_radeon_info {
921 uint32_t request; 957 uint32_t request;
diff --git a/include/drm/sis_drm.h b/include/drm/sis_drm.h
index 30f7b3827466..035b804dda6d 100644
--- a/include/drm/sis_drm.h
+++ b/include/drm/sis_drm.h
@@ -64,4 +64,8 @@ typedef struct {
64 unsigned int offset, size; 64 unsigned int offset, size;
65} drm_sis_fb_t; 65} drm_sis_fb_t;
66 66
67struct sis_file_private {
68 struct list_head obj_list;
69};
70
67#endif /* __SIS_DRM_H__ */ 71#endif /* __SIS_DRM_H__ */
diff --git a/include/drm/ttm/ttm_bo_api.h b/include/drm/ttm/ttm_bo_api.h
index 42e346985186..974c8f801c39 100644
--- a/include/drm/ttm/ttm_bo_api.h
+++ b/include/drm/ttm/ttm_bo_api.h
@@ -122,17 +122,12 @@ struct ttm_mem_reg {
122 * be mmapped by user space. Each of these bos occupy a slot in the 122 * be mmapped by user space. Each of these bos occupy a slot in the
123 * device address space, that can be used for normal vm operations. 123 * device address space, that can be used for normal vm operations.
124 * 124 *
125 * @ttm_bo_type_user: These are user-space memory areas that are made
126 * available to the GPU by mapping the buffer pages into the GPU aperture
127 * space. These buffers cannot be mmaped from the device address space.
128 *
129 * @ttm_bo_type_kernel: These buffers are like ttm_bo_type_device buffers, 125 * @ttm_bo_type_kernel: These buffers are like ttm_bo_type_device buffers,
130 * but they cannot be accessed from user-space. For kernel-only use. 126 * but they cannot be accessed from user-space. For kernel-only use.
131 */ 127 */
132 128
133enum ttm_bo_type { 129enum ttm_bo_type {
134 ttm_bo_type_device, 130 ttm_bo_type_device,
135 ttm_bo_type_user,
136 ttm_bo_type_kernel 131 ttm_bo_type_kernel
137}; 132};
138 133
@@ -434,9 +429,9 @@ extern void ttm_bo_unlock_delayed_workqueue(struct ttm_bo_device *bdev,
434 * -EBUSY if the buffer is busy and no_wait is true. 429 * -EBUSY if the buffer is busy and no_wait is true.
435 * -ERESTARTSYS if interrupted by a signal. 430 * -ERESTARTSYS if interrupted by a signal.
436 */ 431 */
437
438extern int 432extern int
439ttm_bo_synccpu_write_grab(struct ttm_buffer_object *bo, bool no_wait); 433ttm_bo_synccpu_write_grab(struct ttm_buffer_object *bo, bool no_wait);
434
440/** 435/**
441 * ttm_bo_synccpu_write_release: 436 * ttm_bo_synccpu_write_release:
442 * 437 *
@@ -447,6 +442,22 @@ ttm_bo_synccpu_write_grab(struct ttm_buffer_object *bo, bool no_wait);
447extern void ttm_bo_synccpu_write_release(struct ttm_buffer_object *bo); 442extern void ttm_bo_synccpu_write_release(struct ttm_buffer_object *bo);
448 443
449/** 444/**
445 * ttm_bo_acc_size
446 *
447 * @bdev: Pointer to a ttm_bo_device struct.
448 * @bo_size: size of the buffer object in byte.
449 * @struct_size: size of the structure holding buffer object datas
450 *
451 * Returns size to account for a buffer object
452 */
453size_t ttm_bo_acc_size(struct ttm_bo_device *bdev,
454 unsigned long bo_size,
455 unsigned struct_size);
456size_t ttm_bo_dma_acc_size(struct ttm_bo_device *bdev,
457 unsigned long bo_size,
458 unsigned struct_size);
459
460/**
450 * ttm_bo_init 461 * ttm_bo_init
451 * 462 *
452 * @bdev: Pointer to a ttm_bo_device struct. 463 * @bdev: Pointer to a ttm_bo_device struct.
@@ -493,6 +504,7 @@ extern int ttm_bo_init(struct ttm_bo_device *bdev,
493 struct file *persistent_swap_storage, 504 struct file *persistent_swap_storage,
494 size_t acc_size, 505 size_t acc_size,
495 void (*destroy) (struct ttm_buffer_object *)); 506 void (*destroy) (struct ttm_buffer_object *));
507
496/** 508/**
497 * ttm_bo_synccpu_object_init 509 * ttm_bo_synccpu_object_init
498 * 510 *
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h
index 94eb1434316e..d43e892307ff 100644
--- a/include/drm/ttm/ttm_bo_driver.h
+++ b/include/drm/ttm/ttm_bo_driver.h
@@ -43,36 +43,9 @@ struct ttm_backend;
43 43
44struct ttm_backend_func { 44struct ttm_backend_func {
45 /** 45 /**
46 * struct ttm_backend_func member populate
47 *
48 * @backend: Pointer to a struct ttm_backend.
49 * @num_pages: Number of pages to populate.
50 * @pages: Array of pointers to ttm pages.
51 * @dummy_read_page: Page to be used instead of NULL pages in the
52 * array @pages.
53 * @dma_addrs: Array of DMA (bus) address of the ttm pages.
54 *
55 * Populate the backend with ttm pages. Depending on the backend,
56 * it may or may not copy the @pages array.
57 */
58 int (*populate) (struct ttm_backend *backend,
59 unsigned long num_pages, struct page **pages,
60 struct page *dummy_read_page,
61 dma_addr_t *dma_addrs);
62 /**
63 * struct ttm_backend_func member clear
64 *
65 * @backend: Pointer to a struct ttm_backend.
66 *
67 * This is an "unpopulate" function. Release all resources
68 * allocated with populate.
69 */
70 void (*clear) (struct ttm_backend *backend);
71
72 /**
73 * struct ttm_backend_func member bind 46 * struct ttm_backend_func member bind
74 * 47 *
75 * @backend: Pointer to a struct ttm_backend. 48 * @ttm: Pointer to a struct ttm_tt.
76 * @bo_mem: Pointer to a struct ttm_mem_reg describing the 49 * @bo_mem: Pointer to a struct ttm_mem_reg describing the
77 * memory type and location for binding. 50 * memory type and location for binding.
78 * 51 *
@@ -80,46 +53,29 @@ struct ttm_backend_func {
80 * indicated by @bo_mem. This function should be able to handle 53 * indicated by @bo_mem. This function should be able to handle
81 * differences between aperture and system page sizes. 54 * differences between aperture and system page sizes.
82 */ 55 */
83 int (*bind) (struct ttm_backend *backend, struct ttm_mem_reg *bo_mem); 56 int (*bind) (struct ttm_tt *ttm, struct ttm_mem_reg *bo_mem);
84 57
85 /** 58 /**
86 * struct ttm_backend_func member unbind 59 * struct ttm_backend_func member unbind
87 * 60 *
88 * @backend: Pointer to a struct ttm_backend. 61 * @ttm: Pointer to a struct ttm_tt.
89 * 62 *
90 * Unbind previously bound backend pages. This function should be 63 * Unbind previously bound backend pages. This function should be
91 * able to handle differences between aperture and system page sizes. 64 * able to handle differences between aperture and system page sizes.
92 */ 65 */
93 int (*unbind) (struct ttm_backend *backend); 66 int (*unbind) (struct ttm_tt *ttm);
94 67
95 /** 68 /**
96 * struct ttm_backend_func member destroy 69 * struct ttm_backend_func member destroy
97 * 70 *
98 * @backend: Pointer to a struct ttm_backend. 71 * @ttm: Pointer to a struct ttm_tt.
99 * 72 *
100 * Destroy the backend. 73 * Destroy the backend. This will be call back from ttm_tt_destroy so
74 * don't call ttm_tt_destroy from the callback or infinite loop.
101 */ 75 */
102 void (*destroy) (struct ttm_backend *backend); 76 void (*destroy) (struct ttm_tt *ttm);
103};
104
105/**
106 * struct ttm_backend
107 *
108 * @bdev: Pointer to a struct ttm_bo_device.
109 * @flags: For driver use.
110 * @func: Pointer to a struct ttm_backend_func that describes
111 * the backend methods.
112 *
113 */
114
115struct ttm_backend {
116 struct ttm_bo_device *bdev;
117 uint32_t flags;
118 struct ttm_backend_func *func;
119}; 77};
120 78
121#define TTM_PAGE_FLAG_USER (1 << 1)
122#define TTM_PAGE_FLAG_USER_DIRTY (1 << 2)
123#define TTM_PAGE_FLAG_WRITE (1 << 3) 79#define TTM_PAGE_FLAG_WRITE (1 << 3)
124#define TTM_PAGE_FLAG_SWAPPED (1 << 4) 80#define TTM_PAGE_FLAG_SWAPPED (1 << 4)
125#define TTM_PAGE_FLAG_PERSISTENT_SWAP (1 << 5) 81#define TTM_PAGE_FLAG_PERSISTENT_SWAP (1 << 5)
@@ -135,23 +91,18 @@ enum ttm_caching_state {
135/** 91/**
136 * struct ttm_tt 92 * struct ttm_tt
137 * 93 *
94 * @bdev: Pointer to a struct ttm_bo_device.
95 * @func: Pointer to a struct ttm_backend_func that describes
96 * the backend methods.
138 * @dummy_read_page: Page to map where the ttm_tt page array contains a NULL 97 * @dummy_read_page: Page to map where the ttm_tt page array contains a NULL
139 * pointer. 98 * pointer.
140 * @pages: Array of pages backing the data. 99 * @pages: Array of pages backing the data.
141 * @first_himem_page: Himem pages are put last in the page array, which
142 * enables us to run caching attribute changes on only the first part
143 * of the page array containing lomem pages. This is the index of the
144 * first himem page.
145 * @last_lomem_page: Index of the last lomem page in the page array.
146 * @num_pages: Number of pages in the page array. 100 * @num_pages: Number of pages in the page array.
147 * @bdev: Pointer to the current struct ttm_bo_device. 101 * @bdev: Pointer to the current struct ttm_bo_device.
148 * @be: Pointer to the ttm backend. 102 * @be: Pointer to the ttm backend.
149 * @tsk: The task for user ttm.
150 * @start: virtual address for user ttm.
151 * @swap_storage: Pointer to shmem struct file for swap storage. 103 * @swap_storage: Pointer to shmem struct file for swap storage.
152 * @caching_state: The current caching state of the pages. 104 * @caching_state: The current caching state of the pages.
153 * @state: The current binding state of the pages. 105 * @state: The current binding state of the pages.
154 * @dma_address: The DMA (bus) addresses of the pages (if TTM_PAGE_FLAG_DMA32)
155 * 106 *
156 * This is a structure holding the pages, caching- and aperture binding 107 * This is a structure holding the pages, caching- and aperture binding
157 * status for a buffer object that isn't backed by fixed (VRAM / AGP) 108 * status for a buffer object that isn't backed by fixed (VRAM / AGP)
@@ -159,16 +110,14 @@ enum ttm_caching_state {
159 */ 110 */
160 111
161struct ttm_tt { 112struct ttm_tt {
113 struct ttm_bo_device *bdev;
114 struct ttm_backend_func *func;
162 struct page *dummy_read_page; 115 struct page *dummy_read_page;
163 struct page **pages; 116 struct page **pages;
164 long first_himem_page;
165 long last_lomem_page;
166 uint32_t page_flags; 117 uint32_t page_flags;
167 unsigned long num_pages; 118 unsigned long num_pages;
168 struct ttm_bo_global *glob; 119 struct ttm_bo_global *glob;
169 struct ttm_backend *be; 120 struct ttm_backend *be;
170 struct task_struct *tsk;
171 unsigned long start;
172 struct file *swap_storage; 121 struct file *swap_storage;
173 enum ttm_caching_state caching_state; 122 enum ttm_caching_state caching_state;
174 enum { 123 enum {
@@ -176,7 +125,23 @@ struct ttm_tt {
176 tt_unbound, 125 tt_unbound,
177 tt_unpopulated, 126 tt_unpopulated,
178 } state; 127 } state;
128};
129
130/**
131 * struct ttm_dma_tt
132 *
133 * @ttm: Base ttm_tt struct.
134 * @dma_address: The DMA (bus) addresses of the pages
135 * @pages_list: used by some page allocation backend
136 *
137 * This is a structure holding the pages, caching- and aperture binding
138 * status for a buffer object that isn't backed by fixed (VRAM / AGP)
139 * memory.
140 */
141struct ttm_dma_tt {
142 struct ttm_tt ttm;
179 dma_addr_t *dma_address; 143 dma_addr_t *dma_address;
144 struct list_head pages_list;
180}; 145};
181 146
182#define TTM_MEMTYPE_FLAG_FIXED (1 << 0) /* Fixed (on-card) PCI memory */ 147#define TTM_MEMTYPE_FLAG_FIXED (1 << 0) /* Fixed (on-card) PCI memory */
@@ -351,15 +316,42 @@ struct ttm_mem_type_manager {
351 316
352struct ttm_bo_driver { 317struct ttm_bo_driver {
353 /** 318 /**
354 * struct ttm_bo_driver member create_ttm_backend_entry 319 * ttm_tt_create
355 * 320 *
356 * @bdev: The buffer object device. 321 * @bdev: pointer to a struct ttm_bo_device:
322 * @size: Size of the data needed backing.
323 * @page_flags: Page flags as identified by TTM_PAGE_FLAG_XX flags.
324 * @dummy_read_page: See struct ttm_bo_device.
357 * 325 *
358 * Create a driver specific struct ttm_backend. 326 * Create a struct ttm_tt to back data with system memory pages.
327 * No pages are actually allocated.
328 * Returns:
329 * NULL: Out of memory.
359 */ 330 */
331 struct ttm_tt *(*ttm_tt_create)(struct ttm_bo_device *bdev,
332 unsigned long size,
333 uint32_t page_flags,
334 struct page *dummy_read_page);
360 335
361 struct ttm_backend *(*create_ttm_backend_entry) 336 /**
362 (struct ttm_bo_device *bdev); 337 * ttm_tt_populate
338 *
339 * @ttm: The struct ttm_tt to contain the backing pages.
340 *
341 * Allocate all backing pages
342 * Returns:
343 * -ENOMEM: Out of memory.
344 */
345 int (*ttm_tt_populate)(struct ttm_tt *ttm);
346
347 /**
348 * ttm_tt_unpopulate
349 *
350 * @ttm: The struct ttm_tt to contain the backing pages.
351 *
352 * Free all backing page
353 */
354 void (*ttm_tt_unpopulate)(struct ttm_tt *ttm);
363 355
364 /** 356 /**
365 * struct ttm_bo_driver member invalidate_caches 357 * struct ttm_bo_driver member invalidate_caches
@@ -477,9 +469,6 @@ struct ttm_bo_global_ref {
477 * @dummy_read_page: Pointer to a dummy page used for mapping requests 469 * @dummy_read_page: Pointer to a dummy page used for mapping requests
478 * of unpopulated pages. 470 * of unpopulated pages.
479 * @shrink: A shrink callback object used for buffer object swap. 471 * @shrink: A shrink callback object used for buffer object swap.
480 * @ttm_bo_extra_size: Extra size (sizeof(struct ttm_buffer_object) excluded)
481 * used by a buffer object. This is excluding page arrays and backing pages.
482 * @ttm_bo_size: This is @ttm_bo_extra_size + sizeof(struct ttm_buffer_object).
483 * @device_list_mutex: Mutex protecting the device list. 472 * @device_list_mutex: Mutex protecting the device list.
484 * This mutex is held while traversing the device list for pm options. 473 * This mutex is held while traversing the device list for pm options.
485 * @lru_lock: Spinlock protecting the bo subsystem lru lists. 474 * @lru_lock: Spinlock protecting the bo subsystem lru lists.
@@ -497,8 +486,6 @@ struct ttm_bo_global {
497 struct ttm_mem_global *mem_glob; 486 struct ttm_mem_global *mem_glob;
498 struct page *dummy_read_page; 487 struct page *dummy_read_page;
499 struct ttm_mem_shrink shrink; 488 struct ttm_mem_shrink shrink;
500 size_t ttm_bo_extra_size;
501 size_t ttm_bo_size;
502 struct mutex device_list_mutex; 489 struct mutex device_list_mutex;
503 spinlock_t lru_lock; 490 spinlock_t lru_lock;
504 491
@@ -600,8 +587,9 @@ ttm_flag_masked(uint32_t *old, uint32_t new, uint32_t mask)
600} 587}
601 588
602/** 589/**
603 * ttm_tt_create 590 * ttm_tt_init
604 * 591 *
592 * @ttm: The struct ttm_tt.
605 * @bdev: pointer to a struct ttm_bo_device: 593 * @bdev: pointer to a struct ttm_bo_device:
606 * @size: Size of the data needed backing. 594 * @size: Size of the data needed backing.
607 * @page_flags: Page flags as identified by TTM_PAGE_FLAG_XX flags. 595 * @page_flags: Page flags as identified by TTM_PAGE_FLAG_XX flags.
@@ -612,28 +600,22 @@ ttm_flag_masked(uint32_t *old, uint32_t new, uint32_t mask)
612 * Returns: 600 * Returns:
613 * NULL: Out of memory. 601 * NULL: Out of memory.
614 */ 602 */
615extern struct ttm_tt *ttm_tt_create(struct ttm_bo_device *bdev, 603extern int ttm_tt_init(struct ttm_tt *ttm, struct ttm_bo_device *bdev,
616 unsigned long size, 604 unsigned long size, uint32_t page_flags,
617 uint32_t page_flags, 605 struct page *dummy_read_page);
618 struct page *dummy_read_page); 606extern int ttm_dma_tt_init(struct ttm_dma_tt *ttm_dma, struct ttm_bo_device *bdev,
607 unsigned long size, uint32_t page_flags,
608 struct page *dummy_read_page);
619 609
620/** 610/**
621 * ttm_tt_set_user: 611 * ttm_tt_fini
622 * 612 *
623 * @ttm: The struct ttm_tt to populate. 613 * @ttm: the ttm_tt structure.
624 * @tsk: A struct task_struct for which @start is a valid user-space address.
625 * @start: A valid user-space address.
626 * @num_pages: Size in pages of the user memory area.
627 * 614 *
628 * Populate a struct ttm_tt with a user-space memory area after first pinning 615 * Free memory of ttm_tt structure
629 * the pages backing it.
630 * Returns:
631 * !0: Error.
632 */ 616 */
633 617extern void ttm_tt_fini(struct ttm_tt *ttm);
634extern int ttm_tt_set_user(struct ttm_tt *ttm, 618extern void ttm_dma_tt_fini(struct ttm_dma_tt *ttm_dma);
635 struct task_struct *tsk,
636 unsigned long start, unsigned long num_pages);
637 619
638/** 620/**
639 * ttm_ttm_bind: 621 * ttm_ttm_bind:
@@ -646,20 +628,11 @@ extern int ttm_tt_set_user(struct ttm_tt *ttm,
646extern int ttm_tt_bind(struct ttm_tt *ttm, struct ttm_mem_reg *bo_mem); 628extern int ttm_tt_bind(struct ttm_tt *ttm, struct ttm_mem_reg *bo_mem);
647 629
648/** 630/**
649 * ttm_tt_populate:
650 *
651 * @ttm: The struct ttm_tt to contain the backing pages.
652 *
653 * Add backing pages to all of @ttm
654 */
655extern int ttm_tt_populate(struct ttm_tt *ttm);
656
657/**
658 * ttm_ttm_destroy: 631 * ttm_ttm_destroy:
659 * 632 *
660 * @ttm: The struct ttm_tt. 633 * @ttm: The struct ttm_tt.
661 * 634 *
662 * Unbind, unpopulate and destroy a struct ttm_tt. 635 * Unbind, unpopulate and destroy common struct ttm_tt.
663 */ 636 */
664extern void ttm_tt_destroy(struct ttm_tt *ttm); 637extern void ttm_tt_destroy(struct ttm_tt *ttm);
665 638
@@ -673,19 +646,13 @@ extern void ttm_tt_destroy(struct ttm_tt *ttm);
673extern void ttm_tt_unbind(struct ttm_tt *ttm); 646extern void ttm_tt_unbind(struct ttm_tt *ttm);
674 647
675/** 648/**
676 * ttm_ttm_destroy: 649 * ttm_tt_swapin:
677 * 650 *
678 * @ttm: The struct ttm_tt. 651 * @ttm: The struct ttm_tt.
679 * @index: Index of the desired page.
680 *
681 * Return a pointer to the struct page backing @ttm at page
682 * index @index. If the page is unpopulated, one will be allocated to
683 * populate that index.
684 * 652 *
685 * Returns: 653 * Swap in a previously swap out ttm_tt.
686 * NULL on OOM.
687 */ 654 */
688extern struct page *ttm_tt_get_page(struct ttm_tt *ttm, int index); 655extern int ttm_tt_swapin(struct ttm_tt *ttm);
689 656
690/** 657/**
691 * ttm_tt_cache_flush: 658 * ttm_tt_cache_flush:
@@ -1046,17 +1013,25 @@ extern const struct ttm_mem_type_manager_func ttm_bo_manager_func;
1046#include <linux/agp_backend.h> 1013#include <linux/agp_backend.h>
1047 1014
1048/** 1015/**
1049 * ttm_agp_backend_init 1016 * ttm_agp_tt_create
1050 * 1017 *
1051 * @bdev: Pointer to a struct ttm_bo_device. 1018 * @bdev: Pointer to a struct ttm_bo_device.
1052 * @bridge: The agp bridge this device is sitting on. 1019 * @bridge: The agp bridge this device is sitting on.
1020 * @size: Size of the data needed backing.
1021 * @page_flags: Page flags as identified by TTM_PAGE_FLAG_XX flags.
1022 * @dummy_read_page: See struct ttm_bo_device.
1023 *
1053 * 1024 *
1054 * Create a TTM backend that uses the indicated AGP bridge as an aperture 1025 * Create a TTM backend that uses the indicated AGP bridge as an aperture
1055 * for TT memory. This function uses the linux agpgart interface to 1026 * for TT memory. This function uses the linux agpgart interface to
1056 * bind and unbind memory backing a ttm_tt. 1027 * bind and unbind memory backing a ttm_tt.
1057 */ 1028 */
1058extern struct ttm_backend *ttm_agp_backend_init(struct ttm_bo_device *bdev, 1029extern struct ttm_tt *ttm_agp_tt_create(struct ttm_bo_device *bdev,
1059 struct agp_bridge_data *bridge); 1030 struct agp_bridge_data *bridge,
1031 unsigned long size, uint32_t page_flags,
1032 struct page *dummy_read_page);
1033int ttm_agp_tt_populate(struct ttm_tt *ttm);
1034void ttm_agp_tt_unpopulate(struct ttm_tt *ttm);
1060#endif 1035#endif
1061 1036
1062#endif 1037#endif
diff --git a/include/drm/ttm/ttm_page_alloc.h b/include/drm/ttm/ttm_page_alloc.h
index 129de12353f1..5fe27400d176 100644
--- a/include/drm/ttm/ttm_page_alloc.h
+++ b/include/drm/ttm/ttm_page_alloc.h
@@ -30,45 +30,70 @@
30#include "ttm_memory.h" 30#include "ttm_memory.h"
31 31
32/** 32/**
33 * Get count number of pages from pool to pages list. 33 * Initialize pool allocator.
34 */
35int ttm_page_alloc_init(struct ttm_mem_global *glob, unsigned max_pages);
36/**
37 * Free pool allocator.
38 */
39void ttm_page_alloc_fini(void);
40
41/**
42 * ttm_pool_populate:
43 *
44 * @ttm: The struct ttm_tt to contain the backing pages.
34 * 45 *
35 * @pages: head of empty linked list where pages are filled. 46 * Add backing pages to all of @ttm
36 * @flags: ttm flags for page allocation.
37 * @cstate: ttm caching state for the page.
38 * @count: number of pages to allocate.
39 * @dma_address: The DMA (bus) address of pages (if TTM_PAGE_FLAG_DMA32 set).
40 */ 47 */
41int ttm_get_pages(struct list_head *pages, 48extern int ttm_pool_populate(struct ttm_tt *ttm);
42 int flags, 49
43 enum ttm_caching_state cstate,
44 unsigned count,
45 dma_addr_t *dma_address);
46/** 50/**
47 * Put linked list of pages to pool. 51 * ttm_pool_unpopulate:
52 *
53 * @ttm: The struct ttm_tt which to free backing pages.
48 * 54 *
49 * @pages: list of pages to free. 55 * Free all pages of @ttm
50 * @page_count: number of pages in the list. Zero can be passed for unknown
51 * count.
52 * @flags: ttm flags for page allocation.
53 * @cstate: ttm caching state.
54 * @dma_address: The DMA (bus) address of pages (if TTM_PAGE_FLAG_DMA32 set).
55 */ 56 */
56void ttm_put_pages(struct list_head *pages, 57extern void ttm_pool_unpopulate(struct ttm_tt *ttm);
57 unsigned page_count, 58
58 int flags, 59/**
59 enum ttm_caching_state cstate, 60 * Output the state of pools to debugfs file
60 dma_addr_t *dma_address); 61 */
62extern int ttm_page_alloc_debugfs(struct seq_file *m, void *data);
63
64
65#ifdef CONFIG_SWIOTLB
61/** 66/**
62 * Initialize pool allocator. 67 * Initialize pool allocator.
63 */ 68 */
64int ttm_page_alloc_init(struct ttm_mem_global *glob, unsigned max_pages); 69int ttm_dma_page_alloc_init(struct ttm_mem_global *glob, unsigned max_pages);
70
65/** 71/**
66 * Free pool allocator. 72 * Free pool allocator.
67 */ 73 */
68void ttm_page_alloc_fini(void); 74void ttm_dma_page_alloc_fini(void);
69 75
70/** 76/**
71 * Output the state of pools to debugfs file 77 * Output the state of pools to debugfs file
72 */ 78 */
73extern int ttm_page_alloc_debugfs(struct seq_file *m, void *data); 79extern int ttm_dma_page_alloc_debugfs(struct seq_file *m, void *data);
80
81extern int ttm_dma_populate(struct ttm_dma_tt *ttm_dma, struct device *dev);
82extern void ttm_dma_unpopulate(struct ttm_dma_tt *ttm_dma, struct device *dev);
83
84#else
85static inline int ttm_dma_page_alloc_init(struct ttm_mem_global *glob,
86 unsigned max_pages)
87{
88 return -ENODEV;
89}
90
91static inline void ttm_dma_page_alloc_fini(void) { return; }
92
93static inline int ttm_dma_page_alloc_debugfs(struct seq_file *m, void *data)
94{
95 return 0;
96}
97#endif
98
74#endif 99#endif
diff --git a/include/drm/via_drm.h b/include/drm/via_drm.h
index fd11a5bd892d..79b3b6e0f6b3 100644
--- a/include/drm/via_drm.h
+++ b/include/drm/via_drm.h
@@ -274,4 +274,8 @@ typedef struct drm_via_dmablit {
274 drm_via_blitsync_t sync; 274 drm_via_blitsync_t sync;
275} drm_via_dmablit_t; 275} drm_via_dmablit_t;
276 276
277struct via_file_private {
278 struct list_head obj_list;
279};
280
277#endif /* _VIA_DRM_H_ */ 281#endif /* _VIA_DRM_H_ */
diff --git a/include/keys/user-type.h b/include/keys/user-type.h
index c37c34275a44..bc9ec1d7698c 100644
--- a/include/keys/user-type.h
+++ b/include/keys/user-type.h
@@ -17,7 +17,7 @@
17 17
18/*****************************************************************************/ 18/*****************************************************************************/
19/* 19/*
20 * the payload for a key of type "user" 20 * the payload for a key of type "user" or "logon"
21 * - once filled in and attached to a key: 21 * - once filled in and attached to a key:
22 * - the payload struct is invariant may not be changed, only replaced 22 * - the payload struct is invariant may not be changed, only replaced
23 * - the payload must be read with RCU procedures or with the key semaphore 23 * - the payload must be read with RCU procedures or with the key semaphore
@@ -33,6 +33,7 @@ struct user_key_payload {
33}; 33};
34 34
35extern struct key_type key_type_user; 35extern struct key_type key_type_user;
36extern struct key_type key_type_logon;
36 37
37extern int user_instantiate(struct key *key, const void *data, size_t datalen); 38extern int user_instantiate(struct key *key, const void *data, size_t datalen);
38extern int user_update(struct key *key, const void *data, size_t datalen); 39extern int user_update(struct key *key, const void *data, size_t datalen);
diff --git a/include/linux/acct.h b/include/linux/acct.h
index 3e4737fa6cce..d537aa0ec414 100644
--- a/include/linux/acct.h
+++ b/include/linux/acct.h
@@ -146,6 +146,9 @@ extern void acct_exit_ns(struct pid_namespace *);
146 * 146 *
147 */ 147 */
148 148
149#undef ACCT_VERSION
150#undef AHZ
151
149#ifdef CONFIG_BSD_PROCESS_ACCT_V3 152#ifdef CONFIG_BSD_PROCESS_ACCT_V3
150#define ACCT_VERSION 3 153#define ACCT_VERSION 3
151#define AHZ 100 154#define AHZ 100
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 6001b4da39dd..3f968665899b 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -302,10 +302,19 @@ extern bool osc_sb_apei_support_acked;
302 OSC_PCI_EXPRESS_PME_CONTROL | \ 302 OSC_PCI_EXPRESS_PME_CONTROL | \
303 OSC_PCI_EXPRESS_AER_CONTROL | \ 303 OSC_PCI_EXPRESS_AER_CONTROL | \
304 OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL) 304 OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL)
305
306#define OSC_PCI_NATIVE_HOTPLUG (OSC_PCI_EXPRESS_NATIVE_HP_CONTROL | \
307 OSC_SHPC_NATIVE_HP_CONTROL)
308
305extern acpi_status acpi_pci_osc_control_set(acpi_handle handle, 309extern acpi_status acpi_pci_osc_control_set(acpi_handle handle,
306 u32 *mask, u32 req); 310 u32 *mask, u32 req);
307extern void acpi_early_init(void); 311extern void acpi_early_init(void);
308 312
313extern int acpi_nvs_register(__u64 start, __u64 size);
314
315extern int acpi_nvs_for_each_region(int (*func)(__u64, __u64, void *),
316 void *data);
317
309#else /* !CONFIG_ACPI */ 318#else /* !CONFIG_ACPI */
310 319
311#define acpi_disabled 1 320#define acpi_disabled 1
@@ -348,15 +357,18 @@ static inline int acpi_table_parse(char *id,
348{ 357{
349 return -1; 358 return -1;
350} 359}
351#endif /* !CONFIG_ACPI */
352 360
353#ifdef CONFIG_ACPI_SLEEP 361static inline int acpi_nvs_register(__u64 start, __u64 size)
354int suspend_nvs_register(unsigned long start, unsigned long size);
355#else
356static inline int suspend_nvs_register(unsigned long a, unsigned long b)
357{ 362{
358 return 0; 363 return 0;
359} 364}
360#endif 365
366static inline int acpi_nvs_for_each_region(int (*func)(__u64, __u64, void *),
367 void *data)
368{
369 return 0;
370}
371
372#endif /* !CONFIG_ACPI */
361 373
362#endif /*_LINUX_ACPI_H*/ 374#endif /*_LINUX_ACPI_H*/
diff --git a/include/linux/acpi_io.h b/include/linux/acpi_io.h
index 4afd7102459d..b0ffa219993e 100644
--- a/include/linux/acpi_io.h
+++ b/include/linux/acpi_io.h
@@ -12,4 +12,7 @@ static inline void __iomem *acpi_os_ioremap(acpi_physical_address phys,
12 12
13void __iomem *acpi_os_get_iomem(acpi_physical_address phys, unsigned int size); 13void __iomem *acpi_os_get_iomem(acpi_physical_address phys, unsigned int size);
14 14
15int acpi_os_map_generic_address(struct acpi_generic_address *addr);
16void acpi_os_unmap_generic_address(struct acpi_generic_address *addr);
17
15#endif 18#endif
diff --git a/include/linux/ahci_platform.h b/include/linux/ahci_platform.h
index be3d9a77d6ed..73a25005d88a 100644
--- a/include/linux/ahci_platform.h
+++ b/include/linux/ahci_platform.h
@@ -23,6 +23,8 @@ struct ata_port_info;
23struct ahci_platform_data { 23struct ahci_platform_data {
24 int (*init)(struct device *dev, void __iomem *addr); 24 int (*init)(struct device *dev, void __iomem *addr);
25 void (*exit)(struct device *dev); 25 void (*exit)(struct device *dev);
26 int (*suspend)(struct device *dev);
27 int (*resume)(struct device *dev);
26 const struct ata_port_info *ata_port_info; 28 const struct ata_port_info *ata_port_info;
27 unsigned int force_port_map; 29 unsigned int force_port_map;
28 unsigned int mask_port_map; 30 unsigned int mask_port_map;
diff --git a/include/linux/amba/mmci.h b/include/linux/amba/mmci.h
index 21114810c7c0..0101e9c17fa1 100644
--- a/include/linux/amba/mmci.h
+++ b/include/linux/amba/mmci.h
@@ -30,6 +30,7 @@ struct dma_chan;
30 * @cd_invert: true if the gpio_cd pin value is active low 30 * @cd_invert: true if the gpio_cd pin value is active low
31 * @capabilities: the capabilities of the block as implemented in 31 * @capabilities: the capabilities of the block as implemented in
32 * this platform, signify anything MMC_CAP_* from mmc/host.h 32 * this platform, signify anything MMC_CAP_* from mmc/host.h
33 * @capabilities2: more capabilities, MMC_CAP2_* from mmc/host.h
33 * @dma_filter: function used to select an appropriate RX and TX 34 * @dma_filter: function used to select an appropriate RX and TX
34 * DMA channel to be used for DMA, if and only if you're deploying the 35 * DMA channel to be used for DMA, if and only if you're deploying the
35 * generic DMA engine 36 * generic DMA engine
@@ -52,6 +53,7 @@ struct mmci_platform_data {
52 int gpio_cd; 53 int gpio_cd;
53 bool cd_invert; 54 bool cd_invert;
54 unsigned long capabilities; 55 unsigned long capabilities;
56 unsigned long capabilities2;
55 bool (*dma_filter)(struct dma_chan *chan, void *filter_param); 57 bool (*dma_filter)(struct dma_chan *chan, void *filter_param);
56 void *dma_rx_param; 58 void *dma_rx_param;
57 void *dma_tx_param; 59 void *dma_tx_param;
diff --git a/include/linux/amba/pl061.h b/include/linux/amba/pl061.h
index 2412af944f1f..fb83c0453489 100644
--- a/include/linux/amba/pl061.h
+++ b/include/linux/amba/pl061.h
@@ -7,7 +7,7 @@ struct pl061_platform_data {
7 unsigned gpio_base; 7 unsigned gpio_base;
8 8
9 /* number of the first IRQ. 9 /* number of the first IRQ.
10 * If the IRQ functionality in not desired this must be set to NO_IRQ. 10 * If the IRQ functionality in not desired this must be set to 0.
11 */ 11 */
12 unsigned irq_base; 12 unsigned irq_base;
13 13
diff --git a/include/linux/amba/pl08x.h b/include/linux/amba/pl08x.h
index 9eabffbc4e50..033f6aa670de 100644
--- a/include/linux/amba/pl08x.h
+++ b/include/linux/amba/pl08x.h
@@ -134,7 +134,7 @@ struct pl08x_txd {
134 struct dma_async_tx_descriptor tx; 134 struct dma_async_tx_descriptor tx;
135 struct list_head node; 135 struct list_head node;
136 struct list_head dsg_list; 136 struct list_head dsg_list;
137 enum dma_data_direction direction; 137 enum dma_transfer_direction direction;
138 dma_addr_t llis_bus; 138 dma_addr_t llis_bus;
139 struct pl08x_lli *llis_va; 139 struct pl08x_lli *llis_va;
140 /* Default cctl value for LLIs */ 140 /* Default cctl value for LLIs */
@@ -197,7 +197,7 @@ struct pl08x_dma_chan {
197 dma_addr_t dst_addr; 197 dma_addr_t dst_addr;
198 u32 src_cctl; 198 u32 src_cctl;
199 u32 dst_cctl; 199 u32 dst_cctl;
200 enum dma_data_direction runtime_direction; 200 enum dma_transfer_direction runtime_direction;
201 dma_cookie_t lc; 201 dma_cookie_t lc;
202 struct list_head pend_list; 202 struct list_head pend_list;
203 struct pl08x_txd *at; 203 struct pl08x_txd *at;
diff --git a/include/linux/amba/pl330.h b/include/linux/amba/pl330.h
index d12f077a6daf..12e023c19ac1 100644
--- a/include/linux/amba/pl330.h
+++ b/include/linux/amba/pl330.h
@@ -12,17 +12,9 @@
12#ifndef __AMBA_PL330_H_ 12#ifndef __AMBA_PL330_H_
13#define __AMBA_PL330_H_ 13#define __AMBA_PL330_H_
14 14
15#include <linux/dmaengine.h>
15#include <asm/hardware/pl330.h> 16#include <asm/hardware/pl330.h>
16 17
17struct dma_pl330_peri {
18 /*
19 * Peri_Req i/f of the DMAC that is
20 * peripheral could be reached from.
21 */
22 u8 peri_id; /* specific dma id */
23 enum pl330_reqtype rqtype;
24};
25
26struct dma_pl330_platdata { 18struct dma_pl330_platdata {
27 /* 19 /*
28 * Number of valid peripherals connected to DMAC. 20 * Number of valid peripherals connected to DMAC.
@@ -33,9 +25,12 @@ struct dma_pl330_platdata {
33 */ 25 */
34 u8 nr_valid_peri; 26 u8 nr_valid_peri;
35 /* Array of valid peripherals */ 27 /* Array of valid peripherals */
36 struct dma_pl330_peri *peri; 28 u8 *peri_id;
29 /* Operational capabilities */
30 dma_cap_mask_t cap_mask;
37 /* Bytes to allocate for MC buffer */ 31 /* Bytes to allocate for MC buffer */
38 unsigned mcbuf_sz; 32 unsigned mcbuf_sz;
39}; 33};
40 34
35extern bool pl330_filter(struct dma_chan *chan, void *param);
41#endif /* __AMBA_PL330_H_ */ 36#endif /* __AMBA_PL330_H_ */
diff --git a/include/linux/amd-iommu.h b/include/linux/amd-iommu.h
index a6863a2dec1f..ef00610837d4 100644
--- a/include/linux/amd-iommu.h
+++ b/include/linux/amd-iommu.h
@@ -20,12 +20,148 @@
20#ifndef _ASM_X86_AMD_IOMMU_H 20#ifndef _ASM_X86_AMD_IOMMU_H
21#define _ASM_X86_AMD_IOMMU_H 21#define _ASM_X86_AMD_IOMMU_H
22 22
23#include <linux/irqreturn.h> 23#include <linux/types.h>
24 24
25#ifdef CONFIG_AMD_IOMMU 25#ifdef CONFIG_AMD_IOMMU
26 26
27struct task_struct;
28struct pci_dev;
29
27extern int amd_iommu_detect(void); 30extern int amd_iommu_detect(void);
28 31
32
33/**
34 * amd_iommu_enable_device_erratum() - Enable erratum workaround for device
35 * in the IOMMUv2 driver
36 * @pdev: The PCI device the workaround is necessary for
37 * @erratum: The erratum workaround to enable
38 *
39 * The function needs to be called before amd_iommu_init_device().
40 * Possible values for the erratum number are for now:
41 * - AMD_PRI_DEV_ERRATUM_ENABLE_RESET - Reset PRI capability when PRI
42 * is enabled
43 * - AMD_PRI_DEV_ERRATUM_LIMIT_REQ_ONE - Limit number of outstanding PRI
44 * requests to one
45 */
46#define AMD_PRI_DEV_ERRATUM_ENABLE_RESET 0
47#define AMD_PRI_DEV_ERRATUM_LIMIT_REQ_ONE 1
48
49extern void amd_iommu_enable_device_erratum(struct pci_dev *pdev, u32 erratum);
50
51/**
52 * amd_iommu_init_device() - Init device for use with IOMMUv2 driver
53 * @pdev: The PCI device to initialize
54 * @pasids: Number of PASIDs to support for this device
55 *
56 * This function does all setup for the device pdev so that it can be
57 * used with IOMMUv2.
58 * Returns 0 on success or negative value on error.
59 */
60extern int amd_iommu_init_device(struct pci_dev *pdev, int pasids);
61
62/**
63 * amd_iommu_free_device() - Free all IOMMUv2 related device resources
64 * and disable IOMMUv2 usage for this device
65 * @pdev: The PCI device to disable IOMMUv2 usage for'
66 */
67extern void amd_iommu_free_device(struct pci_dev *pdev);
68
69/**
70 * amd_iommu_bind_pasid() - Bind a given task to a PASID on a device
71 * @pdev: The PCI device to bind the task to
72 * @pasid: The PASID on the device the task should be bound to
73 * @task: the task to bind
74 *
75 * The function returns 0 on success or a negative value on error.
76 */
77extern int amd_iommu_bind_pasid(struct pci_dev *pdev, int pasid,
78 struct task_struct *task);
79
80/**
81 * amd_iommu_unbind_pasid() - Unbind a PASID from its task on
82 * a device
83 * @pdev: The device of the PASID
84 * @pasid: The PASID to unbind
85 *
86 * When this function returns the device is no longer using the PASID
87 * and the PASID is no longer bound to its task.
88 */
89extern void amd_iommu_unbind_pasid(struct pci_dev *pdev, int pasid);
90
91/**
92 * amd_iommu_set_invalid_ppr_cb() - Register a call-back for failed
93 * PRI requests
94 * @pdev: The PCI device the call-back should be registered for
95 * @cb: The call-back function
96 *
97 * The IOMMUv2 driver invokes this call-back when it is unable to
98 * successfully handle a PRI request. The device driver can then decide
99 * which PRI response the device should see. Possible return values for
100 * the call-back are:
101 *
102 * - AMD_IOMMU_INV_PRI_RSP_SUCCESS - Send SUCCESS back to the device
103 * - AMD_IOMMU_INV_PRI_RSP_INVALID - Send INVALID back to the device
104 * - AMD_IOMMU_INV_PRI_RSP_FAIL - Send Failure back to the device,
105 * the device is required to disable
106 * PRI when it receives this response
107 *
108 * The function returns 0 on success or negative value on error.
109 */
110#define AMD_IOMMU_INV_PRI_RSP_SUCCESS 0
111#define AMD_IOMMU_INV_PRI_RSP_INVALID 1
112#define AMD_IOMMU_INV_PRI_RSP_FAIL 2
113
114typedef int (*amd_iommu_invalid_ppr_cb)(struct pci_dev *pdev,
115 int pasid,
116 unsigned long address,
117 u16);
118
119extern int amd_iommu_set_invalid_ppr_cb(struct pci_dev *pdev,
120 amd_iommu_invalid_ppr_cb cb);
121
122/**
123 * amd_iommu_device_info() - Get information about IOMMUv2 support of a
124 * PCI device
125 * @pdev: PCI device to query information from
126 * @info: A pointer to an amd_iommu_device_info structure which will contain
127 * the information about the PCI device
128 *
129 * Returns 0 on success, negative value on error
130 */
131
132#define AMD_IOMMU_DEVICE_FLAG_ATS_SUP 0x1 /* ATS feature supported */
133#define AMD_IOMMU_DEVICE_FLAG_PRI_SUP 0x2 /* PRI feature supported */
134#define AMD_IOMMU_DEVICE_FLAG_PASID_SUP 0x4 /* PASID context supported */
135#define AMD_IOMMU_DEVICE_FLAG_EXEC_SUP 0x8 /* Device may request execution
136 on memory pages */
137#define AMD_IOMMU_DEVICE_FLAG_PRIV_SUP 0x10 /* Device may request
138 super-user privileges */
139
140struct amd_iommu_device_info {
141 int max_pasids;
142 u32 flags;
143};
144
145extern int amd_iommu_device_info(struct pci_dev *pdev,
146 struct amd_iommu_device_info *info);
147
148/**
149 * amd_iommu_set_invalidate_ctx_cb() - Register a call-back for invalidating
150 * a pasid context. This call-back is
151 * invoked when the IOMMUv2 driver needs to
152 * invalidate a PASID context, for example
153 * because the task that is bound to that
154 * context is about to exit.
155 *
156 * @pdev: The PCI device the call-back should be registered for
157 * @cb: The call-back function
158 */
159
160typedef void (*amd_iommu_invalidate_ctx)(struct pci_dev *pdev, int pasid);
161
162extern int amd_iommu_set_invalidate_ctx_cb(struct pci_dev *pdev,
163 amd_iommu_invalidate_ctx cb);
164
29#else 165#else
30 166
31static inline int amd_iommu_detect(void) { return -ENODEV; } 167static inline int amd_iommu_detect(void) { return -ENODEV; }
diff --git a/include/linux/ata_platform.h b/include/linux/ata_platform.h
index 9a26c83a2c9e..b856a2a590d9 100644
--- a/include/linux/ata_platform.h
+++ b/include/linux/ata_platform.h
@@ -27,10 +27,7 @@ extern int __devexit __pata_platform_remove(struct device *dev);
27/* 27/*
28 * Marvell SATA private data 28 * Marvell SATA private data
29 */ 29 */
30struct mbus_dram_target_info;
31
32struct mv_sata_platform_data { 30struct mv_sata_platform_data {
33 struct mbus_dram_target_info *dram;
34 int n_ports; /* number of sata ports */ 31 int n_ports; /* number of sata ports */
35}; 32};
36 33
diff --git a/include/linux/audit.h b/include/linux/audit.h
index 426ab9f4dd85..9ff7a2c48b50 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -26,6 +26,7 @@
26 26
27#include <linux/types.h> 27#include <linux/types.h>
28#include <linux/elf-em.h> 28#include <linux/elf-em.h>
29#include <linux/ptrace.h>
29 30
30/* The netlink messages for the audit system is divided into blocks: 31/* The netlink messages for the audit system is divided into blocks:
31 * 1000 - 1099 are for commanding the audit system 32 * 1000 - 1099 are for commanding the audit system
@@ -181,6 +182,40 @@
181 * AUDIT_UNUSED_BITS is updated if need be. */ 182 * AUDIT_UNUSED_BITS is updated if need be. */
182#define AUDIT_UNUSED_BITS 0x07FFFC00 183#define AUDIT_UNUSED_BITS 0x07FFFC00
183 184
185/* AUDIT_FIELD_COMPARE rule list */
186#define AUDIT_COMPARE_UID_TO_OBJ_UID 1
187#define AUDIT_COMPARE_GID_TO_OBJ_GID 2
188#define AUDIT_COMPARE_EUID_TO_OBJ_UID 3
189#define AUDIT_COMPARE_EGID_TO_OBJ_GID 4
190#define AUDIT_COMPARE_AUID_TO_OBJ_UID 5
191#define AUDIT_COMPARE_SUID_TO_OBJ_UID 6
192#define AUDIT_COMPARE_SGID_TO_OBJ_GID 7
193#define AUDIT_COMPARE_FSUID_TO_OBJ_UID 8
194#define AUDIT_COMPARE_FSGID_TO_OBJ_GID 9
195
196#define AUDIT_COMPARE_UID_TO_AUID 10
197#define AUDIT_COMPARE_UID_TO_EUID 11
198#define AUDIT_COMPARE_UID_TO_FSUID 12
199#define AUDIT_COMPARE_UID_TO_SUID 13
200
201#define AUDIT_COMPARE_AUID_TO_FSUID 14
202#define AUDIT_COMPARE_AUID_TO_SUID 15
203#define AUDIT_COMPARE_AUID_TO_EUID 16
204
205#define AUDIT_COMPARE_EUID_TO_SUID 17
206#define AUDIT_COMPARE_EUID_TO_FSUID 18
207
208#define AUDIT_COMPARE_SUID_TO_FSUID 19
209
210#define AUDIT_COMPARE_GID_TO_EGID 20
211#define AUDIT_COMPARE_GID_TO_FSGID 21
212#define AUDIT_COMPARE_GID_TO_SGID 22
213
214#define AUDIT_COMPARE_EGID_TO_FSGID 23
215#define AUDIT_COMPARE_EGID_TO_SGID 24
216#define AUDIT_COMPARE_SGID_TO_FSGID 25
217
218#define AUDIT_MAX_FIELD_COMPARE AUDIT_COMPARE_SGID_TO_FSGID
184 219
185/* Rule fields */ 220/* Rule fields */
186 /* These are useful when checking the 221 /* These are useful when checking the
@@ -222,6 +257,9 @@
222#define AUDIT_PERM 106 257#define AUDIT_PERM 106
223#define AUDIT_DIR 107 258#define AUDIT_DIR 107
224#define AUDIT_FILETYPE 108 259#define AUDIT_FILETYPE 108
260#define AUDIT_OBJ_UID 109
261#define AUDIT_OBJ_GID 110
262#define AUDIT_FIELD_COMPARE 111
225 263
226#define AUDIT_ARG0 200 264#define AUDIT_ARG0 200
227#define AUDIT_ARG1 (AUDIT_ARG0+1) 265#define AUDIT_ARG1 (AUDIT_ARG0+1)
@@ -408,28 +446,24 @@ struct audit_field {
408 void *lsm_rule; 446 void *lsm_rule;
409}; 447};
410 448
411#define AUDITSC_INVALID 0
412#define AUDITSC_SUCCESS 1
413#define AUDITSC_FAILURE 2
414#define AUDITSC_RESULT(x) ( ((long)(x))<0?AUDITSC_FAILURE:AUDITSC_SUCCESS )
415extern int __init audit_register_class(int class, unsigned *list); 449extern int __init audit_register_class(int class, unsigned *list);
416extern int audit_classify_syscall(int abi, unsigned syscall); 450extern int audit_classify_syscall(int abi, unsigned syscall);
417extern int audit_classify_arch(int arch); 451extern int audit_classify_arch(int arch);
418#ifdef CONFIG_AUDITSYSCALL 452#ifdef CONFIG_AUDITSYSCALL
419/* These are defined in auditsc.c */ 453/* These are defined in auditsc.c */
420 /* Public API */ 454 /* Public API */
421extern void audit_finish_fork(struct task_struct *child);
422extern int audit_alloc(struct task_struct *task); 455extern int audit_alloc(struct task_struct *task);
423extern void audit_free(struct task_struct *task); 456extern void __audit_free(struct task_struct *task);
424extern void audit_syscall_entry(int arch, 457extern void __audit_syscall_entry(int arch,
425 int major, unsigned long a0, unsigned long a1, 458 int major, unsigned long a0, unsigned long a1,
426 unsigned long a2, unsigned long a3); 459 unsigned long a2, unsigned long a3);
427extern void audit_syscall_exit(int failed, long return_code); 460extern void __audit_syscall_exit(int ret_success, long ret_value);
428extern void __audit_getname(const char *name); 461extern void __audit_getname(const char *name);
429extern void audit_putname(const char *name); 462extern void audit_putname(const char *name);
430extern void __audit_inode(const char *name, const struct dentry *dentry); 463extern void __audit_inode(const char *name, const struct dentry *dentry);
431extern void __audit_inode_child(const struct dentry *dentry, 464extern void __audit_inode_child(const struct dentry *dentry,
432 const struct inode *parent); 465 const struct inode *parent);
466extern void __audit_seccomp(unsigned long syscall);
433extern void __audit_ptrace(struct task_struct *t); 467extern void __audit_ptrace(struct task_struct *t);
434 468
435static inline int audit_dummy_context(void) 469static inline int audit_dummy_context(void)
@@ -437,6 +471,27 @@ static inline int audit_dummy_context(void)
437 void *p = current->audit_context; 471 void *p = current->audit_context;
438 return !p || *(int *)p; 472 return !p || *(int *)p;
439} 473}
474static inline void audit_free(struct task_struct *task)
475{
476 if (unlikely(task->audit_context))
477 __audit_free(task);
478}
479static inline void audit_syscall_entry(int arch, int major, unsigned long a0,
480 unsigned long a1, unsigned long a2,
481 unsigned long a3)
482{
483 if (unlikely(!audit_dummy_context()))
484 __audit_syscall_entry(arch, major, a0, a1, a2, a3);
485}
486static inline void audit_syscall_exit(void *pt_regs)
487{
488 if (unlikely(current->audit_context)) {
489 int success = is_syscall_success(pt_regs);
490 int return_code = regs_return_value(pt_regs);
491
492 __audit_syscall_exit(success, return_code);
493 }
494}
440static inline void audit_getname(const char *name) 495static inline void audit_getname(const char *name)
441{ 496{
442 if (unlikely(!audit_dummy_context())) 497 if (unlikely(!audit_dummy_context()))
@@ -453,6 +508,12 @@ static inline void audit_inode_child(const struct dentry *dentry,
453} 508}
454void audit_core_dumps(long signr); 509void audit_core_dumps(long signr);
455 510
511static inline void audit_seccomp(unsigned long syscall)
512{
513 if (unlikely(!audit_dummy_context()))
514 __audit_seccomp(syscall);
515}
516
456static inline void audit_ptrace(struct task_struct *t) 517static inline void audit_ptrace(struct task_struct *t)
457{ 518{
458 if (unlikely(!audit_dummy_context())) 519 if (unlikely(!audit_dummy_context()))
@@ -463,17 +524,16 @@ static inline void audit_ptrace(struct task_struct *t)
463extern unsigned int audit_serial(void); 524extern unsigned int audit_serial(void);
464extern int auditsc_get_stamp(struct audit_context *ctx, 525extern int auditsc_get_stamp(struct audit_context *ctx,
465 struct timespec *t, unsigned int *serial); 526 struct timespec *t, unsigned int *serial);
466extern int audit_set_loginuid(struct task_struct *task, uid_t loginuid); 527extern int audit_set_loginuid(uid_t loginuid);
467#define audit_get_loginuid(t) ((t)->loginuid) 528#define audit_get_loginuid(t) ((t)->loginuid)
468#define audit_get_sessionid(t) ((t)->sessionid) 529#define audit_get_sessionid(t) ((t)->sessionid)
469extern void audit_log_task_context(struct audit_buffer *ab); 530extern void audit_log_task_context(struct audit_buffer *ab);
470extern void __audit_ipc_obj(struct kern_ipc_perm *ipcp); 531extern void __audit_ipc_obj(struct kern_ipc_perm *ipcp);
471extern void __audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, umode_t mode); 532extern void __audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, umode_t mode);
472extern int audit_bprm(struct linux_binprm *bprm); 533extern int __audit_bprm(struct linux_binprm *bprm);
473extern void audit_socketcall(int nargs, unsigned long *args); 534extern void __audit_socketcall(int nargs, unsigned long *args);
474extern int audit_sockaddr(int len, void *addr); 535extern int __audit_sockaddr(int len, void *addr);
475extern void __audit_fd_pair(int fd1, int fd2); 536extern void __audit_fd_pair(int fd1, int fd2);
476extern int audit_set_macxattr(const char *name);
477extern void __audit_mq_open(int oflag, umode_t mode, struct mq_attr *attr); 537extern void __audit_mq_open(int oflag, umode_t mode, struct mq_attr *attr);
478extern void __audit_mq_sendrecv(mqd_t mqdes, size_t msg_len, unsigned int msg_prio, const struct timespec *abs_timeout); 538extern void __audit_mq_sendrecv(mqd_t mqdes, size_t msg_len, unsigned int msg_prio, const struct timespec *abs_timeout);
479extern void __audit_mq_notify(mqd_t mqdes, const struct sigevent *notification); 539extern void __audit_mq_notify(mqd_t mqdes, const struct sigevent *notification);
@@ -499,6 +559,23 @@ static inline void audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid
499 if (unlikely(!audit_dummy_context())) 559 if (unlikely(!audit_dummy_context()))
500 __audit_ipc_set_perm(qbytes, uid, gid, mode); 560 __audit_ipc_set_perm(qbytes, uid, gid, mode);
501} 561}
562static inline int audit_bprm(struct linux_binprm *bprm)
563{
564 if (unlikely(!audit_dummy_context()))
565 return __audit_bprm(bprm);
566 return 0;
567}
568static inline void audit_socketcall(int nargs, unsigned long *args)
569{
570 if (unlikely(!audit_dummy_context()))
571 __audit_socketcall(nargs, args);
572}
573static inline int audit_sockaddr(int len, void *addr)
574{
575 if (unlikely(!audit_dummy_context()))
576 return __audit_sockaddr(len, addr);
577 return 0;
578}
502static inline void audit_mq_open(int oflag, umode_t mode, struct mq_attr *attr) 579static inline void audit_mq_open(int oflag, umode_t mode, struct mq_attr *attr)
503{ 580{
504 if (unlikely(!audit_dummy_context())) 581 if (unlikely(!audit_dummy_context()))
@@ -544,12 +621,11 @@ static inline void audit_mmap_fd(int fd, int flags)
544 621
545extern int audit_n_rules; 622extern int audit_n_rules;
546extern int audit_signals; 623extern int audit_signals;
547#else 624#else /* CONFIG_AUDITSYSCALL */
548#define audit_finish_fork(t)
549#define audit_alloc(t) ({ 0; }) 625#define audit_alloc(t) ({ 0; })
550#define audit_free(t) do { ; } while (0) 626#define audit_free(t) do { ; } while (0)
551#define audit_syscall_entry(ta,a,b,c,d,e) do { ; } while (0) 627#define audit_syscall_entry(ta,a,b,c,d,e) do { ; } while (0)
552#define audit_syscall_exit(f,r) do { ; } while (0) 628#define audit_syscall_exit(r) do { ; } while (0)
553#define audit_dummy_context() 1 629#define audit_dummy_context() 1
554#define audit_getname(n) do { ; } while (0) 630#define audit_getname(n) do { ; } while (0)
555#define audit_putname(n) do { ; } while (0) 631#define audit_putname(n) do { ; } while (0)
@@ -558,6 +634,7 @@ extern int audit_signals;
558#define audit_inode(n,d) do { (void)(d); } while (0) 634#define audit_inode(n,d) do { (void)(d); } while (0)
559#define audit_inode_child(i,p) do { ; } while (0) 635#define audit_inode_child(i,p) do { ; } while (0)
560#define audit_core_dumps(i) do { ; } while (0) 636#define audit_core_dumps(i) do { ; } while (0)
637#define audit_seccomp(i) do { ; } while (0)
561#define auditsc_get_stamp(c,t,s) (0) 638#define auditsc_get_stamp(c,t,s) (0)
562#define audit_get_loginuid(t) (-1) 639#define audit_get_loginuid(t) (-1)
563#define audit_get_sessionid(t) (-1) 640#define audit_get_sessionid(t) (-1)
@@ -568,7 +645,6 @@ extern int audit_signals;
568#define audit_socketcall(n,a) ((void)0) 645#define audit_socketcall(n,a) ((void)0)
569#define audit_fd_pair(n,a) ((void)0) 646#define audit_fd_pair(n,a) ((void)0)
570#define audit_sockaddr(len, addr) ({ 0; }) 647#define audit_sockaddr(len, addr) ({ 0; })
571#define audit_set_macxattr(n) do { ; } while (0)
572#define audit_mq_open(o,m,a) ((void)0) 648#define audit_mq_open(o,m,a) ((void)0)
573#define audit_mq_sendrecv(d,l,p,t) ((void)0) 649#define audit_mq_sendrecv(d,l,p,t) ((void)0)
574#define audit_mq_notify(d,n) ((void)0) 650#define audit_mq_notify(d,n) ((void)0)
@@ -579,7 +655,7 @@ extern int audit_signals;
579#define audit_ptrace(t) ((void)0) 655#define audit_ptrace(t) ((void)0)
580#define audit_n_rules 0 656#define audit_n_rules 0
581#define audit_signals 0 657#define audit_signals 0
582#endif 658#endif /* CONFIG_AUDITSYSCALL */
583 659
584#ifdef CONFIG_AUDIT 660#ifdef CONFIG_AUDIT
585/* These are defined in audit.c */ 661/* These are defined in audit.c */
diff --git a/include/linux/bcma/bcma.h b/include/linux/bcma/bcma.h
index f4b8346b1a33..83c209f39493 100644
--- a/include/linux/bcma/bcma.h
+++ b/include/linux/bcma/bcma.h
@@ -162,7 +162,7 @@ struct bcma_driver {
162 162
163 int (*probe)(struct bcma_device *dev); 163 int (*probe)(struct bcma_device *dev);
164 void (*remove)(struct bcma_device *dev); 164 void (*remove)(struct bcma_device *dev);
165 int (*suspend)(struct bcma_device *dev, pm_message_t state); 165 int (*suspend)(struct bcma_device *dev);
166 int (*resume)(struct bcma_device *dev); 166 int (*resume)(struct bcma_device *dev);
167 void (*shutdown)(struct bcma_device *dev); 167 void (*shutdown)(struct bcma_device *dev);
168 168
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 847994aef0e9..129a9c097958 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -515,24 +515,64 @@ extern void bio_integrity_init(void);
515 515
516#else /* CONFIG_BLK_DEV_INTEGRITY */ 516#else /* CONFIG_BLK_DEV_INTEGRITY */
517 517
518#define bio_integrity(a) (0) 518static inline int bio_integrity(struct bio *bio)
519#define bioset_integrity_create(a, b) (0) 519{
520#define bio_integrity_prep(a) (0) 520 return 0;
521#define bio_integrity_enabled(a) (0) 521}
522
523static inline int bio_integrity_enabled(struct bio *bio)
524{
525 return 0;
526}
527
528static inline int bioset_integrity_create(struct bio_set *bs, int pool_size)
529{
530 return 0;
531}
532
533static inline void bioset_integrity_free (struct bio_set *bs)
534{
535 return;
536}
537
538static inline int bio_integrity_prep(struct bio *bio)
539{
540 return 0;
541}
542
543static inline void bio_integrity_free(struct bio *bio, struct bio_set *bs)
544{
545 return;
546}
547
522static inline int bio_integrity_clone(struct bio *bio, struct bio *bio_src, 548static inline int bio_integrity_clone(struct bio *bio, struct bio *bio_src,
523 gfp_t gfp_mask, struct bio_set *bs) 549 gfp_t gfp_mask, struct bio_set *bs)
524{ 550{
525 return 0; 551 return 0;
526} 552}
527#define bioset_integrity_free(a) do { } while (0) 553
528#define bio_integrity_free(a, b) do { } while (0) 554static inline void bio_integrity_split(struct bio *bio, struct bio_pair *bp,
529#define bio_integrity_endio(a, b) do { } while (0) 555 int sectors)
530#define bio_integrity_advance(a, b) do { } while (0) 556{
531#define bio_integrity_trim(a, b, c) do { } while (0) 557 return;
532#define bio_integrity_split(a, b, c) do { } while (0) 558}
533#define bio_integrity_set_tag(a, b, c) do { } while (0) 559
534#define bio_integrity_get_tag(a, b, c) do { } while (0) 560static inline void bio_integrity_advance(struct bio *bio,
535#define bio_integrity_init(a) do { } while (0) 561 unsigned int bytes_done)
562{
563 return;
564}
565
566static inline void bio_integrity_trim(struct bio *bio, unsigned int offset,
567 unsigned int sectors)
568{
569 return;
570}
571
572static inline void bio_integrity_init(void)
573{
574 return;
575}
536 576
537#endif /* CONFIG_BLK_DEV_INTEGRITY */ 577#endif /* CONFIG_BLK_DEV_INTEGRITY */
538 578
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 94acd8172b5b..6c6a1f008065 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -111,10 +111,14 @@ struct request {
111 * Three pointers are available for the IO schedulers, if they need 111 * Three pointers are available for the IO schedulers, if they need
112 * more they have to dynamically allocate it. Flush requests are 112 * more they have to dynamically allocate it. Flush requests are
113 * never put on the IO scheduler. So let the flush fields share 113 * never put on the IO scheduler. So let the flush fields share
114 * space with the three elevator_private pointers. 114 * space with the elevator data.
115 */ 115 */
116 union { 116 union {
117 void *elevator_private[3]; 117 struct {
118 struct io_cq *icq;
119 void *priv[2];
120 } elv;
121
118 struct { 122 struct {
119 unsigned int seq; 123 unsigned int seq;
120 struct list_head list; 124 struct list_head list;
@@ -311,6 +315,12 @@ struct request_queue {
311 unsigned long queue_flags; 315 unsigned long queue_flags;
312 316
313 /* 317 /*
318 * ida allocated id for this queue. Used to index queues from
319 * ioctx.
320 */
321 int id;
322
323 /*
314 * queue needs bounce pages for pages above this limit 324 * queue needs bounce pages for pages above this limit
315 */ 325 */
316 gfp_t bounce_gfp; 326 gfp_t bounce_gfp;
@@ -351,6 +361,8 @@ struct request_queue {
351 struct timer_list timeout; 361 struct timer_list timeout;
352 struct list_head timeout_list; 362 struct list_head timeout_list;
353 363
364 struct list_head icq_list;
365
354 struct queue_limits limits; 366 struct queue_limits limits;
355 367
356 /* 368 /*
@@ -387,6 +399,9 @@ struct request_queue {
387 /* Throttle data */ 399 /* Throttle data */
388 struct throtl_data *td; 400 struct throtl_data *td;
389#endif 401#endif
402#ifdef CONFIG_LOCKDEP
403 int ioc_release_depth;
404#endif
390}; 405};
391 406
392#define QUEUE_FLAG_QUEUED 1 /* uses generic tag queueing */ 407#define QUEUE_FLAG_QUEUED 1 /* uses generic tag queueing */
@@ -481,6 +496,7 @@ static inline void queue_flag_clear(unsigned int flag, struct request_queue *q)
481 496
482#define blk_queue_tagged(q) test_bit(QUEUE_FLAG_QUEUED, &(q)->queue_flags) 497#define blk_queue_tagged(q) test_bit(QUEUE_FLAG_QUEUED, &(q)->queue_flags)
483#define blk_queue_stopped(q) test_bit(QUEUE_FLAG_STOPPED, &(q)->queue_flags) 498#define blk_queue_stopped(q) test_bit(QUEUE_FLAG_STOPPED, &(q)->queue_flags)
499#define blk_queue_dead(q) test_bit(QUEUE_FLAG_DEAD, &(q)->queue_flags)
484#define blk_queue_nomerges(q) test_bit(QUEUE_FLAG_NOMERGES, &(q)->queue_flags) 500#define blk_queue_nomerges(q) test_bit(QUEUE_FLAG_NOMERGES, &(q)->queue_flags)
485#define blk_queue_noxmerges(q) \ 501#define blk_queue_noxmerges(q) \
486 test_bit(QUEUE_FLAG_NOXMERGES, &(q)->queue_flags) 502 test_bit(QUEUE_FLAG_NOXMERGES, &(q)->queue_flags)
@@ -660,7 +676,6 @@ extern void __blk_put_request(struct request_queue *, struct request *);
660extern struct request *blk_get_request(struct request_queue *, int, gfp_t); 676extern struct request *blk_get_request(struct request_queue *, int, gfp_t);
661extern struct request *blk_make_request(struct request_queue *, struct bio *, 677extern struct request *blk_make_request(struct request_queue *, struct bio *,
662 gfp_t); 678 gfp_t);
663extern void blk_insert_request(struct request_queue *, struct request *, int, void *);
664extern void blk_requeue_request(struct request_queue *, struct request *); 679extern void blk_requeue_request(struct request_queue *, struct request *);
665extern void blk_add_request_payload(struct request *rq, struct page *page, 680extern void blk_add_request_payload(struct request *rq, struct page *page,
666 unsigned int len); 681 unsigned int len);
@@ -675,6 +690,9 @@ extern int blk_insert_cloned_request(struct request_queue *q,
675 struct request *rq); 690 struct request *rq);
676extern void blk_delay_queue(struct request_queue *, unsigned long); 691extern void blk_delay_queue(struct request_queue *, unsigned long);
677extern void blk_recount_segments(struct request_queue *, struct bio *); 692extern void blk_recount_segments(struct request_queue *, struct bio *);
693extern int scsi_verify_blk_ioctl(struct block_device *, unsigned int);
694extern int scsi_cmd_blk_ioctl(struct block_device *, fmode_t,
695 unsigned int, void __user *);
678extern int scsi_cmd_ioctl(struct request_queue *, struct gendisk *, fmode_t, 696extern int scsi_cmd_ioctl(struct request_queue *, struct gendisk *, fmode_t,
679 unsigned int, void __user *); 697 unsigned int, void __user *);
680extern int sg_scsi_ioctl(struct request_queue *, struct gendisk *, fmode_t, 698extern int sg_scsi_ioctl(struct request_queue *, struct gendisk *, fmode_t,
@@ -826,6 +844,7 @@ extern void blk_queue_io_min(struct request_queue *q, unsigned int min);
826extern void blk_limits_io_opt(struct queue_limits *limits, unsigned int opt); 844extern void blk_limits_io_opt(struct queue_limits *limits, unsigned int opt);
827extern void blk_queue_io_opt(struct request_queue *q, unsigned int opt); 845extern void blk_queue_io_opt(struct request_queue *q, unsigned int opt);
828extern void blk_set_default_limits(struct queue_limits *lim); 846extern void blk_set_default_limits(struct queue_limits *lim);
847extern void blk_set_stacking_limits(struct queue_limits *lim);
829extern int blk_stack_limits(struct queue_limits *t, struct queue_limits *b, 848extern int blk_stack_limits(struct queue_limits *t, struct queue_limits *b,
830 sector_t offset); 849 sector_t offset);
831extern int bdev_stack_limits(struct queue_limits *t, struct block_device *bdev, 850extern int bdev_stack_limits(struct queue_limits *t, struct block_device *bdev,
@@ -856,7 +875,7 @@ extern int blk_rq_map_sg(struct request_queue *, struct request *, struct scatte
856extern void blk_dump_rq_flags(struct request *, char *); 875extern void blk_dump_rq_flags(struct request *, char *);
857extern long nr_blockdev_pages(void); 876extern long nr_blockdev_pages(void);
858 877
859int blk_get_queue(struct request_queue *); 878bool __must_check blk_get_queue(struct request_queue *);
860struct request_queue *blk_alloc_queue(gfp_t); 879struct request_queue *blk_alloc_queue(gfp_t);
861struct request_queue *blk_alloc_queue_node(gfp_t, int); 880struct request_queue *blk_alloc_queue_node(gfp_t, int);
862extern void blk_put_queue(struct request_queue *); 881extern void blk_put_queue(struct request_queue *);
@@ -1279,19 +1298,70 @@ queue_max_integrity_segments(struct request_queue *q)
1279 1298
1280#else /* CONFIG_BLK_DEV_INTEGRITY */ 1299#else /* CONFIG_BLK_DEV_INTEGRITY */
1281 1300
1282#define blk_integrity_rq(rq) (0) 1301struct bio;
1283#define blk_rq_count_integrity_sg(a, b) (0) 1302struct block_device;
1284#define blk_rq_map_integrity_sg(a, b, c) (0) 1303struct gendisk;
1285#define bdev_get_integrity(a) (0) 1304struct blk_integrity;
1286#define blk_get_integrity(a) (0) 1305
1287#define blk_integrity_compare(a, b) (0) 1306static inline int blk_integrity_rq(struct request *rq)
1288#define blk_integrity_register(a, b) (0) 1307{
1289#define blk_integrity_unregister(a) do { } while (0) 1308 return 0;
1290#define blk_queue_max_integrity_segments(a, b) do { } while (0) 1309}
1291#define queue_max_integrity_segments(a) (0) 1310static inline int blk_rq_count_integrity_sg(struct request_queue *q,
1292#define blk_integrity_merge_rq(a, b, c) (0) 1311 struct bio *b)
1293#define blk_integrity_merge_bio(a, b, c) (0) 1312{
1294#define blk_integrity_is_initialized(a) (0) 1313 return 0;
1314}
1315static inline int blk_rq_map_integrity_sg(struct request_queue *q,
1316 struct bio *b,
1317 struct scatterlist *s)
1318{
1319 return 0;
1320}
1321static inline struct blk_integrity *bdev_get_integrity(struct block_device *b)
1322{
1323 return 0;
1324}
1325static inline struct blk_integrity *blk_get_integrity(struct gendisk *disk)
1326{
1327 return NULL;
1328}
1329static inline int blk_integrity_compare(struct gendisk *a, struct gendisk *b)
1330{
1331 return 0;
1332}
1333static inline int blk_integrity_register(struct gendisk *d,
1334 struct blk_integrity *b)
1335{
1336 return 0;
1337}
1338static inline void blk_integrity_unregister(struct gendisk *d)
1339{
1340}
1341static inline void blk_queue_max_integrity_segments(struct request_queue *q,
1342 unsigned int segs)
1343{
1344}
1345static inline unsigned short queue_max_integrity_segments(struct request_queue *q)
1346{
1347 return 0;
1348}
1349static inline int blk_integrity_merge_rq(struct request_queue *rq,
1350 struct request *r1,
1351 struct request *r2)
1352{
1353 return 0;
1354}
1355static inline int blk_integrity_merge_bio(struct request_queue *rq,
1356 struct request *r,
1357 struct bio *b)
1358{
1359 return 0;
1360}
1361static inline bool blk_integrity_is_initialized(struct gendisk *g)
1362{
1363 return 0;
1364}
1295 1365
1296#endif /* CONFIG_BLK_DEV_INTEGRITY */ 1366#endif /* CONFIG_BLK_DEV_INTEGRITY */
1297 1367
diff --git a/include/linux/capability.h b/include/linux/capability.h
index a63d13d84ad8..12d52dedb229 100644
--- a/include/linux/capability.h
+++ b/include/linux/capability.h
@@ -380,7 +380,6 @@ struct user_namespace;
380struct user_namespace *current_user_ns(void); 380struct user_namespace *current_user_ns(void);
381 381
382extern const kernel_cap_t __cap_empty_set; 382extern const kernel_cap_t __cap_empty_set;
383extern const kernel_cap_t __cap_full_set;
384extern const kernel_cap_t __cap_init_eff_set; 383extern const kernel_cap_t __cap_init_eff_set;
385 384
386/* 385/*
@@ -544,9 +543,10 @@ extern bool has_capability(struct task_struct *t, int cap);
544extern bool has_ns_capability(struct task_struct *t, 543extern bool has_ns_capability(struct task_struct *t,
545 struct user_namespace *ns, int cap); 544 struct user_namespace *ns, int cap);
546extern bool has_capability_noaudit(struct task_struct *t, int cap); 545extern bool has_capability_noaudit(struct task_struct *t, int cap);
546extern bool has_ns_capability_noaudit(struct task_struct *t,
547 struct user_namespace *ns, int cap);
547extern bool capable(int cap); 548extern bool capable(int cap);
548extern bool ns_capable(struct user_namespace *ns, int cap); 549extern bool ns_capable(struct user_namespace *ns, int cap);
549extern bool task_ns_capable(struct task_struct *t, int cap);
550extern bool nsown_capable(int cap); 550extern bool nsown_capable(int cap);
551 551
552/* audit system wants to get cap info from files as well */ 552/* audit system wants to get cap info from files as well */
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index a17becc36ca1..e9b602151caf 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -457,6 +457,28 @@ void cgroup_exclude_rmdir(struct cgroup_subsys_state *css);
457void cgroup_release_and_wakeup_rmdir(struct cgroup_subsys_state *css); 457void cgroup_release_and_wakeup_rmdir(struct cgroup_subsys_state *css);
458 458
459/* 459/*
460 * Control Group taskset, used to pass around set of tasks to cgroup_subsys
461 * methods.
462 */
463struct cgroup_taskset;
464struct task_struct *cgroup_taskset_first(struct cgroup_taskset *tset);
465struct task_struct *cgroup_taskset_next(struct cgroup_taskset *tset);
466struct cgroup *cgroup_taskset_cur_cgroup(struct cgroup_taskset *tset);
467int cgroup_taskset_size(struct cgroup_taskset *tset);
468
469/**
470 * cgroup_taskset_for_each - iterate cgroup_taskset
471 * @task: the loop cursor
472 * @skip_cgrp: skip if task's cgroup matches this, %NULL to iterate through all
473 * @tset: taskset to iterate
474 */
475#define cgroup_taskset_for_each(task, skip_cgrp, tset) \
476 for ((task) = cgroup_taskset_first((tset)); (task); \
477 (task) = cgroup_taskset_next((tset))) \
478 if (!(skip_cgrp) || \
479 cgroup_taskset_cur_cgroup((tset)) != (skip_cgrp))
480
481/*
460 * Control Group subsystem type. 482 * Control Group subsystem type.
461 * See Documentation/cgroups/cgroups.txt for details 483 * See Documentation/cgroups/cgroups.txt for details
462 */ 484 */
@@ -467,14 +489,11 @@ struct cgroup_subsys {
467 int (*pre_destroy)(struct cgroup_subsys *ss, struct cgroup *cgrp); 489 int (*pre_destroy)(struct cgroup_subsys *ss, struct cgroup *cgrp);
468 void (*destroy)(struct cgroup_subsys *ss, struct cgroup *cgrp); 490 void (*destroy)(struct cgroup_subsys *ss, struct cgroup *cgrp);
469 int (*can_attach)(struct cgroup_subsys *ss, struct cgroup *cgrp, 491 int (*can_attach)(struct cgroup_subsys *ss, struct cgroup *cgrp,
470 struct task_struct *tsk); 492 struct cgroup_taskset *tset);
471 int (*can_attach_task)(struct cgroup *cgrp, struct task_struct *tsk);
472 void (*cancel_attach)(struct cgroup_subsys *ss, struct cgroup *cgrp, 493 void (*cancel_attach)(struct cgroup_subsys *ss, struct cgroup *cgrp,
473 struct task_struct *tsk); 494 struct cgroup_taskset *tset);
474 void (*pre_attach)(struct cgroup *cgrp);
475 void (*attach_task)(struct cgroup *cgrp, struct task_struct *tsk);
476 void (*attach)(struct cgroup_subsys *ss, struct cgroup *cgrp, 495 void (*attach)(struct cgroup_subsys *ss, struct cgroup *cgrp,
477 struct cgroup *old_cgrp, struct task_struct *tsk); 496 struct cgroup_taskset *tset);
478 void (*fork)(struct cgroup_subsys *ss, struct task_struct *task); 497 void (*fork)(struct cgroup_subsys *ss, struct task_struct *task);
479 void (*exit)(struct cgroup_subsys *ss, struct cgroup *cgrp, 498 void (*exit)(struct cgroup_subsys *ss, struct cgroup *cgrp,
480 struct cgroup *old_cgrp, struct task_struct *task); 499 struct cgroup *old_cgrp, struct task_struct *task);
diff --git a/include/linux/clk.h b/include/linux/clk.h
index 7213b52b2c0e..b9d46fa154b4 100644
--- a/include/linux/clk.h
+++ b/include/linux/clk.h
@@ -107,6 +107,28 @@ static inline void clk_unprepare(struct clk *clk)
107} 107}
108#endif 108#endif
109 109
110/* clk_prepare_enable helps cases using clk_enable in non-atomic context. */
111static inline int clk_prepare_enable(struct clk *clk)
112{
113 int ret;
114
115 ret = clk_prepare(clk);
116 if (ret)
117 return ret;
118 ret = clk_enable(clk);
119 if (ret)
120 clk_unprepare(clk);
121
122 return ret;
123}
124
125/* clk_disable_unprepare helps cases using clk_disable in non-atomic context. */
126static inline void clk_disable_unprepare(struct clk *clk)
127{
128 clk_disable(clk);
129 clk_unprepare(clk);
130}
131
110/** 132/**
111 * clk_get_rate - obtain the current clock rate (in Hz) for a clock source. 133 * clk_get_rate - obtain the current clock rate (in Hz) for a clock source.
112 * This is only valid once the clock source has been enabled. 134 * This is only valid once the clock source has been enabled.
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
index 59e4028e833d..3fd17c249221 100644
--- a/include/linux/compiler-gcc.h
+++ b/include/linux/compiler-gcc.h
@@ -50,6 +50,11 @@
50# define inline inline __attribute__((always_inline)) 50# define inline inline __attribute__((always_inline))
51# define __inline__ __inline__ __attribute__((always_inline)) 51# define __inline__ __inline__ __attribute__((always_inline))
52# define __inline __inline __attribute__((always_inline)) 52# define __inline __inline __attribute__((always_inline))
53#else
54/* A lot of inline functions can cause havoc with function tracing */
55# define inline inline notrace
56# define __inline__ __inline__ notrace
57# define __inline __inline notrace
53#endif 58#endif
54 59
55#define __deprecated __attribute__((deprecated)) 60#define __deprecated __attribute__((deprecated))
diff --git a/include/linux/compiler-gcc4.h b/include/linux/compiler-gcc4.h
index dfadc96e9d63..2f4079175afb 100644
--- a/include/linux/compiler-gcc4.h
+++ b/include/linux/compiler-gcc4.h
@@ -29,6 +29,7 @@
29 the kernel context */ 29 the kernel context */
30#define __cold __attribute__((__cold__)) 30#define __cold __attribute__((__cold__))
31 31
32#define __linktime_error(message) __attribute__((__error__(message)))
32 33
33#if __GNUC_MINOR__ >= 5 34#if __GNUC_MINOR__ >= 5
34/* 35/*
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 320d6c94ff84..4a243546d142 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -293,7 +293,9 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect);
293#ifndef __compiletime_error 293#ifndef __compiletime_error
294# define __compiletime_error(message) 294# define __compiletime_error(message)
295#endif 295#endif
296 296#ifndef __linktime_error
297# define __linktime_error(message)
298#endif
297/* 299/*
298 * Prevent the compiler from merging or refetching accesses. The compiler 300 * Prevent the compiler from merging or refetching accesses. The compiler
299 * is also forbidden from reordering successive instances of ACCESS_ONCE(), 301 * is also forbidden from reordering successive instances of ACCESS_ONCE(),
diff --git a/include/linux/console.h b/include/linux/console.h
index 7453cfd593c8..7201ce4280ca 100644
--- a/include/linux/console.h
+++ b/include/linux/console.h
@@ -152,7 +152,7 @@ extern int braille_register_console(struct console *, int index,
152 char *console_options, char *braille_options); 152 char *console_options, char *braille_options);
153extern int braille_unregister_console(struct console *); 153extern int braille_unregister_console(struct console *);
154extern void console_sysfs_notify(void); 154extern void console_sysfs_notify(void);
155extern int console_suspend_enabled; 155extern bool console_suspend_enabled;
156 156
157/* Suspend and resume console messages over PM events */ 157/* Suspend and resume console messages over PM events */
158extern void suspend_console(void); 158extern void suspend_console(void);
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
index 23f81de51829..712abcc205ae 100644
--- a/include/linux/cpuidle.h
+++ b/include/linux/cpuidle.h
@@ -186,7 +186,14 @@ struct cpuidle_governor {
186extern int cpuidle_register_governor(struct cpuidle_governor *gov); 186extern int cpuidle_register_governor(struct cpuidle_governor *gov);
187extern void cpuidle_unregister_governor(struct cpuidle_governor *gov); 187extern void cpuidle_unregister_governor(struct cpuidle_governor *gov);
188 188
189#ifdef CONFIG_INTEL_IDLE
190extern int intel_idle_cpu_init(int cpu);
189#else 191#else
192static inline int intel_idle_cpu_init(int cpu) { return -1; }
193#endif
194
195#else
196static inline int intel_idle_cpu_init(int cpu) { return -1; }
190 197
191static inline int cpuidle_register_governor(struct cpuidle_governor *gov) 198static inline int cpuidle_register_governor(struct cpuidle_governor *gov)
192{return 0;} 199{return 0;}
diff --git a/include/linux/crash_dump.h b/include/linux/crash_dump.h
index 5c4abce94ad1..b936763f2236 100644
--- a/include/linux/crash_dump.h
+++ b/include/linux/crash_dump.h
@@ -5,6 +5,7 @@
5#include <linux/kexec.h> 5#include <linux/kexec.h>
6#include <linux/device.h> 6#include <linux/device.h>
7#include <linux/proc_fs.h> 7#include <linux/proc_fs.h>
8#include <linux/elf.h>
8 9
9#define ELFCORE_ADDR_MAX (-1ULL) 10#define ELFCORE_ADDR_MAX (-1ULL)
10#define ELFCORE_ADDR_ERR (-2ULL) 11#define ELFCORE_ADDR_ERR (-2ULL)
diff --git a/include/linux/cred.h b/include/linux/cred.h
index 40308969ed00..adadf71a7327 100644
--- a/include/linux/cred.h
+++ b/include/linux/cred.h
@@ -358,10 +358,12 @@ static inline void put_cred(const struct cred *_cred)
358#define current_security() (current_cred_xxx(security)) 358#define current_security() (current_cred_xxx(security))
359 359
360#ifdef CONFIG_USER_NS 360#ifdef CONFIG_USER_NS
361#define current_user_ns() (current_cred_xxx(user_ns)) 361#define current_user_ns() (current_cred_xxx(user_ns))
362#define task_user_ns(task) (task_cred_xxx((task), user_ns))
362#else 363#else
363extern struct user_namespace init_user_ns; 364extern struct user_namespace init_user_ns;
364#define current_user_ns() (&init_user_ns) 365#define current_user_ns() (&init_user_ns)
366#define task_user_ns(task) (&init_user_ns)
365#endif 367#endif
366 368
367 369
diff --git a/include/linux/cuda.h b/include/linux/cuda.h
index 6a3e6385d3f3..9f9865ff781e 100644
--- a/include/linux/cuda.h
+++ b/include/linux/cuda.h
@@ -5,6 +5,9 @@
5 * Copyright (C) 1996 Paul Mackerras. 5 * Copyright (C) 1996 Paul Mackerras.
6 */ 6 */
7 7
8#ifndef _LINUX_CUDA_H
9#define _LINUX_CUDA_H
10
8/* CUDA commands (2nd byte) */ 11/* CUDA commands (2nd byte) */
9#define CUDA_WARM_START 0 12#define CUDA_WARM_START 0
10#define CUDA_AUTOPOLL 1 13#define CUDA_AUTOPOLL 1
@@ -34,3 +37,5 @@ extern int cuda_request(struct adb_request *req,
34extern void cuda_poll(void); 37extern void cuda_poll(void);
35 38
36#endif /* __KERNEL */ 39#endif /* __KERNEL */
40
41#endif /* _LINUX_CUDA_H */
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index ed9f74f6c519..d64a55b23afd 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -203,6 +203,7 @@ struct dentry_operations {
203 203
204#define DCACHE_CANT_MOUNT 0x0100 204#define DCACHE_CANT_MOUNT 0x0100
205#define DCACHE_GENOCIDE 0x0200 205#define DCACHE_GENOCIDE 0x0200
206#define DCACHE_SHRINK_LIST 0x0400
206 207
207#define DCACHE_NFSFS_RENAMED 0x1000 208#define DCACHE_NFSFS_RENAMED 0x1000
208 /* this dentry has been "silly renamed" and has to be deleted on the last 209 /* this dentry has been "silly renamed" and has to be deleted on the last
@@ -241,6 +242,7 @@ extern struct dentry * d_alloc(struct dentry *, const struct qstr *);
241extern struct dentry * d_alloc_pseudo(struct super_block *, const struct qstr *); 242extern struct dentry * d_alloc_pseudo(struct super_block *, const struct qstr *);
242extern struct dentry * d_splice_alias(struct inode *, struct dentry *); 243extern struct dentry * d_splice_alias(struct inode *, struct dentry *);
243extern struct dentry * d_add_ci(struct dentry *, struct inode *, struct qstr *); 244extern struct dentry * d_add_ci(struct dentry *, struct inode *, struct qstr *);
245extern struct dentry *d_find_any_alias(struct inode *inode);
244extern struct dentry * d_obtain_alias(struct inode *); 246extern struct dentry * d_obtain_alias(struct inode *);
245extern void shrink_dcache_sb(struct super_block *); 247extern void shrink_dcache_sb(struct super_block *);
246extern void shrink_dcache_parent(struct dentry *); 248extern void shrink_dcache_parent(struct dentry *);
@@ -249,6 +251,7 @@ extern int d_invalidate(struct dentry *);
249 251
250/* only used at mount-time */ 252/* only used at mount-time */
251extern struct dentry * d_alloc_root(struct inode *); 253extern struct dentry * d_alloc_root(struct inode *);
254extern struct dentry * d_make_root(struct inode *);
252 255
253/* <clickety>-<click> the ramfs-type tree */ 256/* <clickety>-<click> the ramfs-type tree */
254extern void d_genocide(struct dentry *); 257extern void d_genocide(struct dentry *);
diff --git a/include/linux/device.h b/include/linux/device.h
index 5b3adb8f9588..b63fb393aa58 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -279,11 +279,11 @@ struct device *driver_find_device(struct device_driver *drv,
279 279
280/** 280/**
281 * struct subsys_interface - interfaces to device functions 281 * struct subsys_interface - interfaces to device functions
282 * @name name of the device function 282 * @name: name of the device function
283 * @subsystem subsytem of the devices to attach to 283 * @subsys: subsytem of the devices to attach to
284 * @node the list of functions registered at the subsystem 284 * @node: the list of functions registered at the subsystem
285 * @add device hookup to device function handler 285 * @add_dev: device hookup to device function handler
286 * @remove device hookup to device function handler 286 * @remove_dev: device hookup to device function handler
287 * 287 *
288 * Simple interfaces attached to a subsystem. Multiple interfaces can 288 * Simple interfaces attached to a subsystem. Multiple interfaces can
289 * attach to a subsystem and its devices. Unlike drivers, they do not 289 * attach to a subsystem and its devices. Unlike drivers, they do not
@@ -612,6 +612,7 @@ struct device_dma_parameters {
612 * @archdata: For arch-specific additions. 612 * @archdata: For arch-specific additions.
613 * @of_node: Associated device tree node. 613 * @of_node: Associated device tree node.
614 * @devt: For creating the sysfs "dev". 614 * @devt: For creating the sysfs "dev".
615 * @id: device instance
615 * @devres_lock: Spinlock to protect the resource of the device. 616 * @devres_lock: Spinlock to protect the resource of the device.
616 * @devres_head: The resources list of the device. 617 * @devres_head: The resources list of the device.
617 * @knode_class: The node used to add the device to the class list. 618 * @knode_class: The node used to add the device to the class list.
@@ -1003,6 +1004,10 @@ extern long sysfs_deprecated;
1003 * Each module may only use this macro once, and calling it replaces 1004 * Each module may only use this macro once, and calling it replaces
1004 * module_init() and module_exit(). 1005 * module_init() and module_exit().
1005 * 1006 *
1007 * @__driver: driver name
1008 * @__register: register function for this driver type
1009 * @__unregister: unregister function for this driver type
1010 *
1006 * Use this macro to construct bus specific macros for registering 1011 * Use this macro to construct bus specific macros for registering
1007 * drivers, and do not use it on its own. 1012 * drivers, and do not use it on its own.
1008 */ 1013 */
diff --git a/include/linux/digsig.h b/include/linux/digsig.h
new file mode 100644
index 000000000000..b01558b15814
--- /dev/null
+++ b/include/linux/digsig.h
@@ -0,0 +1,64 @@
1/*
2 * Copyright (C) 2011 Nokia Corporation
3 * Copyright (C) 2011 Intel Corporation
4 *
5 * Author:
6 * Dmitry Kasatkin <dmitry.kasatkin@nokia.com>
7 * <dmitry.kasatkin@intel.com>
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 as published by
11 * the Free Software Foundation, version 2 of the License.
12 *
13 */
14
15#ifndef _DIGSIG_H
16#define _DIGSIG_H
17
18#include <linux/key.h>
19
20enum pubkey_algo {
21 PUBKEY_ALGO_RSA,
22 PUBKEY_ALGO_MAX,
23};
24
25enum digest_algo {
26 DIGEST_ALGO_SHA1,
27 DIGEST_ALGO_SHA256,
28 DIGEST_ALGO_MAX
29};
30
31struct pubkey_hdr {
32 uint8_t version; /* key format version */
33 time_t timestamp; /* key made, always 0 for now */
34 uint8_t algo;
35 uint8_t nmpi;
36 char mpi[0];
37} __packed;
38
39struct signature_hdr {
40 uint8_t version; /* signature format version */
41 time_t timestamp; /* signature made */
42 uint8_t algo;
43 uint8_t hash;
44 uint8_t keyid[8];
45 uint8_t nmpi;
46 char mpi[0];
47} __packed;
48
49#if defined(CONFIG_SIGNATURE) || defined(CONFIG_SIGNATURE_MODULE)
50
51int digsig_verify(struct key *keyring, const char *sig, int siglen,
52 const char *digest, int digestlen);
53
54#else
55
56static inline int digsig_verify(struct key *keyring, const char *sig,
57 int siglen, const char *digest, int digestlen)
58{
59 return -EOPNOTSUPP;
60}
61
62#endif /* CONFIG_SIGNATURE */
63
64#endif /* _DIGSIG_H */
diff --git a/include/linux/display.h b/include/linux/display.h
deleted file mode 100644
index 3bf70d639728..000000000000
--- a/include/linux/display.h
+++ /dev/null
@@ -1,61 +0,0 @@
1/*
2 * Copyright (C) 2006 James Simmons <jsimmons@infradead.org>
3 *
4 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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 (at
9 * your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
19 *
20 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
21 */
22
23#ifndef _LINUX_DISPLAY_H
24#define _LINUX_DISPLAY_H
25
26#include <linux/device.h>
27
28struct display_device;
29
30/* This structure defines all the properties of a Display. */
31struct display_driver {
32 int (*set_contrast)(struct display_device *, unsigned int);
33 int (*get_contrast)(struct display_device *);
34 void (*suspend)(struct display_device *, pm_message_t state);
35 void (*resume)(struct display_device *);
36 int (*probe)(struct display_device *, void *);
37 int (*remove)(struct display_device *);
38 int max_contrast;
39};
40
41struct display_device {
42 struct module *owner; /* Owner module */
43 struct display_driver *driver;
44 struct device *parent; /* This is the parent */
45 struct device *dev; /* This is this display device */
46 struct mutex lock;
47 void *priv_data;
48 char type[16];
49 char *name;
50 int idx;
51};
52
53extern struct display_device *display_device_register(struct display_driver *driver,
54 struct device *dev, void *devdata);
55extern void display_device_unregister(struct display_device *dev);
56
57extern int probe_edid(struct display_device *dev, void *devdata);
58
59#define to_display_device(obj) container_of(obj, struct display_device, class_dev)
60
61#endif
diff --git a/include/linux/dlm.h b/include/linux/dlm.h
index d4e02f5353a0..6c7f6e9546c7 100644
--- a/include/linux/dlm.h
+++ b/include/linux/dlm.h
@@ -2,7 +2,7 @@
2******************************************************************************* 2*******************************************************************************
3** 3**
4** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. 4** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
5** Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved. 5** Copyright (C) 2004-2011 Red Hat, Inc. All rights reserved.
6** 6**
7** This copyrighted material is made available to anyone wishing to use, 7** This copyrighted material is made available to anyone wishing to use,
8** modify, copy, or redistribute it subject to the terms and conditions 8** modify, copy, or redistribute it subject to the terms and conditions
@@ -74,15 +74,76 @@ struct dlm_lksb {
74 74
75#ifdef __KERNEL__ 75#ifdef __KERNEL__
76 76
77struct dlm_slot {
78 int nodeid; /* 1 to MAX_INT */
79 int slot; /* 1 to MAX_INT */
80};
81
82/*
83 * recover_prep: called before the dlm begins lock recovery.
84 * Notfies lockspace user that locks from failed members will be granted.
85 * recover_slot: called after recover_prep and before recover_done.
86 * Identifies a failed lockspace member.
87 * recover_done: called after the dlm completes lock recovery.
88 * Identifies lockspace members and lockspace generation number.
89 */
90
91struct dlm_lockspace_ops {
92 void (*recover_prep) (void *ops_arg);
93 void (*recover_slot) (void *ops_arg, struct dlm_slot *slot);
94 void (*recover_done) (void *ops_arg, struct dlm_slot *slots,
95 int num_slots, int our_slot, uint32_t generation);
96};
97
77/* 98/*
78 * dlm_new_lockspace 99 * dlm_new_lockspace
79 * 100 *
80 * Starts a lockspace with the given name. If the named lockspace exists in 101 * Create/join a lockspace.
81 * the cluster, the calling node joins it. 102 *
103 * name: lockspace name, null terminated, up to DLM_LOCKSPACE_LEN (not
104 * including terminating null).
105 *
106 * cluster: cluster name, null terminated, up to DLM_LOCKSPACE_LEN (not
107 * including terminating null). Optional. When cluster is null, it
108 * is not used. When set, dlm_new_lockspace() returns -EBADR if cluster
109 * is not equal to the dlm cluster name.
110 *
111 * flags:
112 * DLM_LSFL_NODIR
113 * The dlm should not use a resource directory, but statically assign
114 * resource mastery to nodes based on the name hash that is otherwise
115 * used to select the directory node. Must be the same on all nodes.
116 * DLM_LSFL_TIMEWARN
117 * The dlm should emit netlink messages if locks have been waiting
118 * for a configurable amount of time. (Unused.)
119 * DLM_LSFL_FS
120 * The lockspace user is in the kernel (i.e. filesystem). Enables
121 * direct bast/cast callbacks.
122 * DLM_LSFL_NEWEXCL
123 * dlm_new_lockspace() should return -EEXIST if the lockspace exists.
124 *
125 * lvblen: length of lvb in bytes. Must be multiple of 8.
126 * dlm_new_lockspace() returns an error if this does not match
127 * what other nodes are using.
128 *
129 * ops: callbacks that indicate lockspace recovery points so the
130 * caller can coordinate its recovery and know lockspace members.
131 * This is only used by the initial dlm_new_lockspace() call.
132 * Optional.
133 *
134 * ops_arg: arg for ops callbacks.
135 *
136 * ops_result: tells caller if the ops callbacks (if provided) will
137 * be used or not. 0: will be used, -EXXX will not be used.
138 * -EOPNOTSUPP: the dlm does not have recovery_callbacks enabled.
139 *
140 * lockspace: handle for dlm functions
82 */ 141 */
83 142
84int dlm_new_lockspace(const char *name, int namelen, 143int dlm_new_lockspace(const char *name, const char *cluster,
85 dlm_lockspace_t **lockspace, uint32_t flags, int lvblen); 144 uint32_t flags, int lvblen,
145 const struct dlm_lockspace_ops *ops, void *ops_arg,
146 int *ops_result, dlm_lockspace_t **lockspace);
86 147
87/* 148/*
88 * dlm_release_lockspace 149 * dlm_release_lockspace
diff --git a/include/linux/dma-buf.h b/include/linux/dma-buf.h
new file mode 100644
index 000000000000..f8ac076afa52
--- /dev/null
+++ b/include/linux/dma-buf.h
@@ -0,0 +1,176 @@
1/*
2 * Header file for dma buffer sharing framework.
3 *
4 * Copyright(C) 2011 Linaro Limited. All rights reserved.
5 * Author: Sumit Semwal <sumit.semwal@ti.com>
6 *
7 * Many thanks to linaro-mm-sig list, and specially
8 * Arnd Bergmann <arnd@arndb.de>, Rob Clark <rob@ti.com> and
9 * Daniel Vetter <daniel@ffwll.ch> for their support in creation and
10 * refining of this idea.
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License version 2 as published by
14 * the Free Software Foundation.
15 *
16 * This program is distributed in the hope that it will be useful, but WITHOUT
17 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
19 * more details.
20 *
21 * You should have received a copy of the GNU General Public License along with
22 * this program. If not, see <http://www.gnu.org/licenses/>.
23 */
24#ifndef __DMA_BUF_H__
25#define __DMA_BUF_H__
26
27#include <linux/file.h>
28#include <linux/err.h>
29#include <linux/device.h>
30#include <linux/scatterlist.h>
31#include <linux/list.h>
32#include <linux/dma-mapping.h>
33
34struct dma_buf;
35struct dma_buf_attachment;
36
37/**
38 * struct dma_buf_ops - operations possible on struct dma_buf
39 * @attach: [optional] allows different devices to 'attach' themselves to the
40 * given buffer. It might return -EBUSY to signal that backing storage
41 * is already allocated and incompatible with the requirements
42 * of requesting device.
43 * @detach: [optional] detach a given device from this buffer.
44 * @map_dma_buf: returns list of scatter pages allocated, increases usecount
45 * of the buffer. Requires atleast one attach to be called
46 * before. Returned sg list should already be mapped into
47 * _device_ address space. This call may sleep. May also return
48 * -EINTR. Should return -EINVAL if attach hasn't been called yet.
49 * @unmap_dma_buf: decreases usecount of buffer, might deallocate scatter
50 * pages.
51 * @release: release this buffer; to be called after the last dma_buf_put.
52 */
53struct dma_buf_ops {
54 int (*attach)(struct dma_buf *, struct device *,
55 struct dma_buf_attachment *);
56
57 void (*detach)(struct dma_buf *, struct dma_buf_attachment *);
58
59 /* For {map,unmap}_dma_buf below, any specific buffer attributes
60 * required should get added to device_dma_parameters accessible
61 * via dev->dma_params.
62 */
63 struct sg_table * (*map_dma_buf)(struct dma_buf_attachment *,
64 enum dma_data_direction);
65 void (*unmap_dma_buf)(struct dma_buf_attachment *,
66 struct sg_table *);
67 /* TODO: Add try_map_dma_buf version, to return immed with -EBUSY
68 * if the call would block.
69 */
70
71 /* after final dma_buf_put() */
72 void (*release)(struct dma_buf *);
73
74};
75
76/**
77 * struct dma_buf - shared buffer object
78 * @size: size of the buffer
79 * @file: file pointer used for sharing buffers across, and for refcounting.
80 * @attachments: list of dma_buf_attachment that denotes all devices attached.
81 * @ops: dma_buf_ops associated with this buffer object.
82 * @priv: exporter specific private data for this buffer object.
83 */
84struct dma_buf {
85 size_t size;
86 struct file *file;
87 struct list_head attachments;
88 const struct dma_buf_ops *ops;
89 /* mutex to serialize list manipulation and other ops */
90 struct mutex lock;
91 void *priv;
92};
93
94/**
95 * struct dma_buf_attachment - holds device-buffer attachment data
96 * @dmabuf: buffer for this attachment.
97 * @dev: device attached to the buffer.
98 * @node: list of dma_buf_attachment.
99 * @priv: exporter specific attachment data.
100 *
101 * This structure holds the attachment information between the dma_buf buffer
102 * and its user device(s). The list contains one attachment struct per device
103 * attached to the buffer.
104 */
105struct dma_buf_attachment {
106 struct dma_buf *dmabuf;
107 struct device *dev;
108 struct list_head node;
109 void *priv;
110};
111
112#ifdef CONFIG_DMA_SHARED_BUFFER
113struct dma_buf_attachment *dma_buf_attach(struct dma_buf *dmabuf,
114 struct device *dev);
115void dma_buf_detach(struct dma_buf *dmabuf,
116 struct dma_buf_attachment *dmabuf_attach);
117struct dma_buf *dma_buf_export(void *priv, struct dma_buf_ops *ops,
118 size_t size, int flags);
119int dma_buf_fd(struct dma_buf *dmabuf);
120struct dma_buf *dma_buf_get(int fd);
121void dma_buf_put(struct dma_buf *dmabuf);
122
123struct sg_table *dma_buf_map_attachment(struct dma_buf_attachment *,
124 enum dma_data_direction);
125void dma_buf_unmap_attachment(struct dma_buf_attachment *, struct sg_table *);
126#else
127
128static inline struct dma_buf_attachment *dma_buf_attach(struct dma_buf *dmabuf,
129 struct device *dev)
130{
131 return ERR_PTR(-ENODEV);
132}
133
134static inline void dma_buf_detach(struct dma_buf *dmabuf,
135 struct dma_buf_attachment *dmabuf_attach)
136{
137 return;
138}
139
140static inline struct dma_buf *dma_buf_export(void *priv,
141 struct dma_buf_ops *ops,
142 size_t size, int flags)
143{
144 return ERR_PTR(-ENODEV);
145}
146
147static inline int dma_buf_fd(struct dma_buf *dmabuf)
148{
149 return -ENODEV;
150}
151
152static inline struct dma_buf *dma_buf_get(int fd)
153{
154 return ERR_PTR(-ENODEV);
155}
156
157static inline void dma_buf_put(struct dma_buf *dmabuf)
158{
159 return;
160}
161
162static inline struct sg_table *dma_buf_map_attachment(
163 struct dma_buf_attachment *attach, enum dma_data_direction write)
164{
165 return ERR_PTR(-ENODEV);
166}
167
168static inline void dma_buf_unmap_attachment(struct dma_buf_attachment *attach,
169 struct sg_table *sg)
170{
171 return;
172}
173
174#endif /* CONFIG_DMA_SHARED_BUFFER */
175
176#endif /* __DMA_BUF_H__ */
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index 75f53f874b24..679b349d9b66 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -23,7 +23,6 @@
23 23
24#include <linux/device.h> 24#include <linux/device.h>
25#include <linux/uio.h> 25#include <linux/uio.h>
26#include <linux/dma-direction.h>
27#include <linux/scatterlist.h> 26#include <linux/scatterlist.h>
28#include <linux/bitmap.h> 27#include <linux/bitmap.h>
29#include <asm/page.h> 28#include <asm/page.h>
@@ -72,11 +71,93 @@ enum dma_transaction_type {
72 DMA_ASYNC_TX, 71 DMA_ASYNC_TX,
73 DMA_SLAVE, 72 DMA_SLAVE,
74 DMA_CYCLIC, 73 DMA_CYCLIC,
74 DMA_INTERLEAVE,
75/* last transaction type for creation of the capabilities mask */
76 DMA_TX_TYPE_END,
75}; 77};
76 78
77/* last transaction type for creation of the capabilities mask */ 79/**
78#define DMA_TX_TYPE_END (DMA_CYCLIC + 1) 80 * enum dma_transfer_direction - dma transfer mode and direction indicator
81 * @DMA_MEM_TO_MEM: Async/Memcpy mode
82 * @DMA_MEM_TO_DEV: Slave mode & From Memory to Device
83 * @DMA_DEV_TO_MEM: Slave mode & From Device to Memory
84 * @DMA_DEV_TO_DEV: Slave mode & From Device to Device
85 */
86enum dma_transfer_direction {
87 DMA_MEM_TO_MEM,
88 DMA_MEM_TO_DEV,
89 DMA_DEV_TO_MEM,
90 DMA_DEV_TO_DEV,
91 DMA_TRANS_NONE,
92};
93
94/**
95 * Interleaved Transfer Request
96 * ----------------------------
97 * A chunk is collection of contiguous bytes to be transfered.
98 * The gap(in bytes) between two chunks is called inter-chunk-gap(ICG).
99 * ICGs may or maynot change between chunks.
100 * A FRAME is the smallest series of contiguous {chunk,icg} pairs,
101 * that when repeated an integral number of times, specifies the transfer.
102 * A transfer template is specification of a Frame, the number of times
103 * it is to be repeated and other per-transfer attributes.
104 *
105 * Practically, a client driver would have ready a template for each
106 * type of transfer it is going to need during its lifetime and
107 * set only 'src_start' and 'dst_start' before submitting the requests.
108 *
109 *
110 * | Frame-1 | Frame-2 | ~ | Frame-'numf' |
111 * |====....==.===...=...|====....==.===...=...| ~ |====....==.===...=...|
112 *
113 * == Chunk size
114 * ... ICG
115 */
116
117/**
118 * struct data_chunk - Element of scatter-gather list that makes a frame.
119 * @size: Number of bytes to read from source.
120 * size_dst := fn(op, size_src), so doesn't mean much for destination.
121 * @icg: Number of bytes to jump after last src/dst address of this
122 * chunk and before first src/dst address for next chunk.
123 * Ignored for dst(assumed 0), if dst_inc is true and dst_sgl is false.
124 * Ignored for src(assumed 0), if src_inc is true and src_sgl is false.
125 */
126struct data_chunk {
127 size_t size;
128 size_t icg;
129};
79 130
131/**
132 * struct dma_interleaved_template - Template to convey DMAC the transfer pattern
133 * and attributes.
134 * @src_start: Bus address of source for the first chunk.
135 * @dst_start: Bus address of destination for the first chunk.
136 * @dir: Specifies the type of Source and Destination.
137 * @src_inc: If the source address increments after reading from it.
138 * @dst_inc: If the destination address increments after writing to it.
139 * @src_sgl: If the 'icg' of sgl[] applies to Source (scattered read).
140 * Otherwise, source is read contiguously (icg ignored).
141 * Ignored if src_inc is false.
142 * @dst_sgl: If the 'icg' of sgl[] applies to Destination (scattered write).
143 * Otherwise, destination is filled contiguously (icg ignored).
144 * Ignored if dst_inc is false.
145 * @numf: Number of frames in this template.
146 * @frame_size: Number of chunks in a frame i.e, size of sgl[].
147 * @sgl: Array of {chunk,icg} pairs that make up a frame.
148 */
149struct dma_interleaved_template {
150 dma_addr_t src_start;
151 dma_addr_t dst_start;
152 enum dma_transfer_direction dir;
153 bool src_inc;
154 bool dst_inc;
155 bool src_sgl;
156 bool dst_sgl;
157 size_t numf;
158 size_t frame_size;
159 struct data_chunk sgl[0];
160};
80 161
81/** 162/**
82 * enum dma_ctrl_flags - DMA flags to augment operation preparation, 163 * enum dma_ctrl_flags - DMA flags to augment operation preparation,
@@ -269,7 +350,7 @@ enum dma_slave_buswidth {
269 * struct, if applicable. 350 * struct, if applicable.
270 */ 351 */
271struct dma_slave_config { 352struct dma_slave_config {
272 enum dma_data_direction direction; 353 enum dma_transfer_direction direction;
273 dma_addr_t src_addr; 354 dma_addr_t src_addr;
274 dma_addr_t dst_addr; 355 dma_addr_t dst_addr;
275 enum dma_slave_buswidth src_addr_width; 356 enum dma_slave_buswidth src_addr_width;
@@ -433,6 +514,7 @@ struct dma_tx_state {
433 * @device_prep_dma_cyclic: prepare a cyclic dma operation suitable for audio. 514 * @device_prep_dma_cyclic: prepare a cyclic dma operation suitable for audio.
434 * The function takes a buffer of size buf_len. The callback function will 515 * The function takes a buffer of size buf_len. The callback function will
435 * be called after period_len bytes have been transferred. 516 * be called after period_len bytes have been transferred.
517 * @device_prep_interleaved_dma: Transfer expression in a generic way.
436 * @device_control: manipulate all pending operations on a channel, returns 518 * @device_control: manipulate all pending operations on a channel, returns
437 * zero or error code 519 * zero or error code
438 * @device_tx_status: poll for transaction completion, the optional 520 * @device_tx_status: poll for transaction completion, the optional
@@ -492,11 +574,14 @@ struct dma_device {
492 574
493 struct dma_async_tx_descriptor *(*device_prep_slave_sg)( 575 struct dma_async_tx_descriptor *(*device_prep_slave_sg)(
494 struct dma_chan *chan, struct scatterlist *sgl, 576 struct dma_chan *chan, struct scatterlist *sgl,
495 unsigned int sg_len, enum dma_data_direction direction, 577 unsigned int sg_len, enum dma_transfer_direction direction,
496 unsigned long flags); 578 unsigned long flags);
497 struct dma_async_tx_descriptor *(*device_prep_dma_cyclic)( 579 struct dma_async_tx_descriptor *(*device_prep_dma_cyclic)(
498 struct dma_chan *chan, dma_addr_t buf_addr, size_t buf_len, 580 struct dma_chan *chan, dma_addr_t buf_addr, size_t buf_len,
499 size_t period_len, enum dma_data_direction direction); 581 size_t period_len, enum dma_transfer_direction direction);
582 struct dma_async_tx_descriptor *(*device_prep_interleaved_dma)(
583 struct dma_chan *chan, struct dma_interleaved_template *xt,
584 unsigned long flags);
500 int (*device_control)(struct dma_chan *chan, enum dma_ctrl_cmd cmd, 585 int (*device_control)(struct dma_chan *chan, enum dma_ctrl_cmd cmd,
501 unsigned long arg); 586 unsigned long arg);
502 587
@@ -522,7 +607,7 @@ static inline int dmaengine_slave_config(struct dma_chan *chan,
522 607
523static inline struct dma_async_tx_descriptor *dmaengine_prep_slave_single( 608static inline struct dma_async_tx_descriptor *dmaengine_prep_slave_single(
524 struct dma_chan *chan, void *buf, size_t len, 609 struct dma_chan *chan, void *buf, size_t len,
525 enum dma_data_direction dir, unsigned long flags) 610 enum dma_transfer_direction dir, unsigned long flags)
526{ 611{
527 struct scatterlist sg; 612 struct scatterlist sg;
528 sg_init_one(&sg, buf, len); 613 sg_init_one(&sg, buf, len);
diff --git a/include/linux/dvb/frontend.h b/include/linux/dvb/frontend.h
index 1b1094c35e4f..cb4428ab81ed 100644
--- a/include/linux/dvb/frontend.h
+++ b/include/linux/dvb/frontend.h
@@ -72,7 +72,7 @@ typedef enum fe_caps {
72 72
73struct dvb_frontend_info { 73struct dvb_frontend_info {
74 char name[128]; 74 char name[128];
75 fe_type_t type; 75 fe_type_t type; /* DEPRECATED. Use DTV_ENUM_DELSYS instead */
76 __u32 frequency_min; 76 __u32 frequency_min;
77 __u32 frequency_max; 77 __u32 frequency_max;
78 __u32 frequency_stepsize; 78 __u32 frequency_stepsize;
@@ -181,6 +181,7 @@ typedef enum fe_transmit_mode {
181 TRANSMISSION_MODE_32K, 181 TRANSMISSION_MODE_32K,
182} fe_transmit_mode_t; 182} fe_transmit_mode_t;
183 183
184#if defined(__DVB_CORE__) || !defined (__KERNEL__)
184typedef enum fe_bandwidth { 185typedef enum fe_bandwidth {
185 BANDWIDTH_8_MHZ, 186 BANDWIDTH_8_MHZ,
186 BANDWIDTH_7_MHZ, 187 BANDWIDTH_7_MHZ,
@@ -190,7 +191,7 @@ typedef enum fe_bandwidth {
190 BANDWIDTH_10_MHZ, 191 BANDWIDTH_10_MHZ,
191 BANDWIDTH_1_712_MHZ, 192 BANDWIDTH_1_712_MHZ,
192} fe_bandwidth_t; 193} fe_bandwidth_t;
193 194#endif
194 195
195typedef enum fe_guard_interval { 196typedef enum fe_guard_interval {
196 GUARD_INTERVAL_1_32, 197 GUARD_INTERVAL_1_32,
@@ -213,6 +214,7 @@ typedef enum fe_hierarchy {
213} fe_hierarchy_t; 214} fe_hierarchy_t;
214 215
215 216
217#if defined(__DVB_CORE__) || !defined (__KERNEL__)
216struct dvb_qpsk_parameters { 218struct dvb_qpsk_parameters {
217 __u32 symbol_rate; /* symbol rate in Symbols per second */ 219 __u32 symbol_rate; /* symbol rate in Symbols per second */
218 fe_code_rate_t fec_inner; /* forward error correction (see above) */ 220 fe_code_rate_t fec_inner; /* forward error correction (see above) */
@@ -251,11 +253,11 @@ struct dvb_frontend_parameters {
251 } u; 253 } u;
252}; 254};
253 255
254
255struct dvb_frontend_event { 256struct dvb_frontend_event {
256 fe_status_t status; 257 fe_status_t status;
257 struct dvb_frontend_parameters parameters; 258 struct dvb_frontend_parameters parameters;
258}; 259};
260#endif
259 261
260/* S2API Commands */ 262/* S2API Commands */
261#define DTV_UNDEFINED 0 263#define DTV_UNDEFINED 0
@@ -316,7 +318,9 @@ struct dvb_frontend_event {
316 318
317#define DTV_DVBT2_PLP_ID 43 319#define DTV_DVBT2_PLP_ID 43
318 320
319#define DTV_MAX_COMMAND DTV_DVBT2_PLP_ID 321#define DTV_ENUM_DELSYS 44
322
323#define DTV_MAX_COMMAND DTV_ENUM_DELSYS
320 324
321typedef enum fe_pilot { 325typedef enum fe_pilot {
322 PILOT_ON, 326 PILOT_ON,
@@ -333,7 +337,7 @@ typedef enum fe_rolloff {
333 337
334typedef enum fe_delivery_system { 338typedef enum fe_delivery_system {
335 SYS_UNDEFINED, 339 SYS_UNDEFINED,
336 SYS_DVBC_ANNEX_AC, 340 SYS_DVBC_ANNEX_A,
337 SYS_DVBC_ANNEX_B, 341 SYS_DVBC_ANNEX_B,
338 SYS_DVBT, 342 SYS_DVBT,
339 SYS_DSS, 343 SYS_DSS,
@@ -350,8 +354,13 @@ typedef enum fe_delivery_system {
350 SYS_DAB, 354 SYS_DAB,
351 SYS_DVBT2, 355 SYS_DVBT2,
352 SYS_TURBO, 356 SYS_TURBO,
357 SYS_DVBC_ANNEX_C,
353} fe_delivery_system_t; 358} fe_delivery_system_t;
354 359
360
361#define SYS_DVBC_ANNEX_AC SYS_DVBC_ANNEX_A
362
363
355struct dtv_cmds_h { 364struct dtv_cmds_h {
356 char *name; /* A display name for debugging purposes */ 365 char *name; /* A display name for debugging purposes */
357 366
diff --git a/include/linux/dvb/version.h b/include/linux/dvb/version.h
index 66594b1d5d7b..0559e2bd38f9 100644
--- a/include/linux/dvb/version.h
+++ b/include/linux/dvb/version.h
@@ -24,6 +24,6 @@
24#define _DVBVERSION_H_ 24#define _DVBVERSION_H_
25 25
26#define DVB_API_VERSION 5 26#define DVB_API_VERSION 5
27#define DVB_API_VERSION_MINOR 4 27#define DVB_API_VERSION_MINOR 5
28 28
29#endif /*_DVBVERSION_H_*/ 29#endif /*_DVBVERSION_H_*/
diff --git a/include/linux/dw_dmac.h b/include/linux/dw_dmac.h
index 4bfe0a2f7d50..f2c64f92c4a0 100644
--- a/include/linux/dw_dmac.h
+++ b/include/linux/dw_dmac.h
@@ -127,7 +127,7 @@ struct dw_cyclic_desc {
127 127
128struct dw_cyclic_desc *dw_dma_cyclic_prep(struct dma_chan *chan, 128struct dw_cyclic_desc *dw_dma_cyclic_prep(struct dma_chan *chan,
129 dma_addr_t buf_addr, size_t buf_len, size_t period_len, 129 dma_addr_t buf_addr, size_t buf_len, size_t period_len,
130 enum dma_data_direction direction); 130 enum dma_transfer_direction direction);
131void dw_dma_cyclic_free(struct dma_chan *chan); 131void dw_dma_cyclic_free(struct dma_chan *chan);
132int dw_dma_cyclic_start(struct dma_chan *chan); 132int dw_dma_cyclic_start(struct dma_chan *chan);
133void dw_dma_cyclic_stop(struct dma_chan *chan); 133void dw_dma_cyclic_stop(struct dma_chan *chan);
diff --git a/include/linux/efi.h b/include/linux/efi.h
index 2362a0bc7f0d..37c300712e02 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -109,6 +109,14 @@ typedef struct {
109 u32 imagesize; 109 u32 imagesize;
110} efi_capsule_header_t; 110} efi_capsule_header_t;
111 111
112/*
113 * Allocation types for calls to boottime->allocate_pages.
114 */
115#define EFI_ALLOCATE_ANY_PAGES 0
116#define EFI_ALLOCATE_MAX_ADDRESS 1
117#define EFI_ALLOCATE_ADDRESS 2
118#define EFI_MAX_ALLOCATE_TYPE 3
119
112typedef int (*efi_freemem_callback_t) (u64 start, u64 end, void *arg); 120typedef int (*efi_freemem_callback_t) (u64 start, u64 end, void *arg);
113 121
114/* 122/*
@@ -139,6 +147,57 @@ typedef struct {
139} efi_time_cap_t; 147} efi_time_cap_t;
140 148
141/* 149/*
150 * EFI Boot Services table
151 */
152typedef struct {
153 efi_table_hdr_t hdr;
154 void *raise_tpl;
155 void *restore_tpl;
156 void *allocate_pages;
157 void *free_pages;
158 void *get_memory_map;
159 void *allocate_pool;
160 void *free_pool;
161 void *create_event;
162 void *set_timer;
163 void *wait_for_event;
164 void *signal_event;
165 void *close_event;
166 void *check_event;
167 void *install_protocol_interface;
168 void *reinstall_protocol_interface;
169 void *uninstall_protocol_interface;
170 void *handle_protocol;
171 void *__reserved;
172 void *register_protocol_notify;
173 void *locate_handle;
174 void *locate_device_path;
175 void *install_configuration_table;
176 void *load_image;
177 void *start_image;
178 void *exit;
179 void *unload_image;
180 void *exit_boot_services;
181 void *get_next_monotonic_count;
182 void *stall;
183 void *set_watchdog_timer;
184 void *connect_controller;
185 void *disconnect_controller;
186 void *open_protocol;
187 void *close_protocol;
188 void *open_protocol_information;
189 void *protocols_per_handle;
190 void *locate_handle_buffer;
191 void *locate_protocol;
192 void *install_multiple_protocol_interfaces;
193 void *uninstall_multiple_protocol_interfaces;
194 void *calculate_crc32;
195 void *copy_mem;
196 void *set_mem;
197 void *create_event_ex;
198} efi_boot_services_t;
199
200/*
142 * Types and defines for EFI ResetSystem 201 * Types and defines for EFI ResetSystem
143 */ 202 */
144#define EFI_RESET_COLD 0 203#define EFI_RESET_COLD 0
@@ -236,6 +295,24 @@ typedef efi_status_t efi_query_capsule_caps_t(efi_capsule_header_t **capsules,
236#define LINUX_EFI_CRASH_GUID \ 295#define LINUX_EFI_CRASH_GUID \
237 EFI_GUID( 0xcfc8fc79, 0xbe2e, 0x4ddc, 0x97, 0xf0, 0x9f, 0x98, 0xbf, 0xe2, 0x98, 0xa0 ) 296 EFI_GUID( 0xcfc8fc79, 0xbe2e, 0x4ddc, 0x97, 0xf0, 0x9f, 0x98, 0xbf, 0xe2, 0x98, 0xa0 )
238 297
298#define LOADED_IMAGE_PROTOCOL_GUID \
299 EFI_GUID( 0x5b1b31a1, 0x9562, 0x11d2, 0x8e, 0x3f, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b )
300
301#define EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID \
302 EFI_GUID( 0x9042a9de, 0x23dc, 0x4a38, 0x96, 0xfb, 0x7a, 0xde, 0xd0, 0x80, 0x51, 0x6a )
303
304#define EFI_UGA_PROTOCOL_GUID \
305 EFI_GUID( 0x982c298b, 0xf4fa, 0x41cb, 0xb8, 0x38, 0x77, 0xaa, 0x68, 0x8f, 0xb8, 0x39 )
306
307#define EFI_PCI_IO_PROTOCOL_GUID \
308 EFI_GUID( 0x4cf5b200, 0x68b8, 0x4ca5, 0x9e, 0xec, 0xb2, 0x3e, 0x3f, 0x50, 0x2, 0x9a )
309
310#define EFI_FILE_INFO_ID \
311 EFI_GUID( 0x9576e92, 0x6d3f, 0x11d2, 0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b )
312
313#define EFI_FILE_SYSTEM_GUID \
314 EFI_GUID( 0x964e5b22, 0x6459, 0x11d2, 0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b )
315
239typedef struct { 316typedef struct {
240 efi_guid_t guid; 317 efi_guid_t guid;
241 unsigned long table; 318 unsigned long table;
@@ -261,7 +338,7 @@ typedef struct {
261 unsigned long stderr_handle; 338 unsigned long stderr_handle;
262 unsigned long stderr; 339 unsigned long stderr;
263 efi_runtime_services_t *runtime; 340 efi_runtime_services_t *runtime;
264 unsigned long boottime; 341 efi_boot_services_t *boottime;
265 unsigned long nr_tables; 342 unsigned long nr_tables;
266 unsigned long tables; 343 unsigned long tables;
267} efi_system_table_t; 344} efi_system_table_t;
@@ -275,6 +352,56 @@ struct efi_memory_map {
275 unsigned long desc_size; 352 unsigned long desc_size;
276}; 353};
277 354
355typedef struct {
356 u32 revision;
357 void *parent_handle;
358 efi_system_table_t *system_table;
359 void *device_handle;
360 void *file_path;
361 void *reserved;
362 u32 load_options_size;
363 void *load_options;
364 void *image_base;
365 __aligned_u64 image_size;
366 unsigned int image_code_type;
367 unsigned int image_data_type;
368 unsigned long unload;
369} efi_loaded_image_t;
370
371typedef struct {
372 u64 revision;
373 void *open_volume;
374} efi_file_io_interface_t;
375
376typedef struct {
377 u64 size;
378 u64 file_size;
379 u64 phys_size;
380 efi_time_t create_time;
381 efi_time_t last_access_time;
382 efi_time_t modification_time;
383 __aligned_u64 attribute;
384 efi_char16_t filename[1];
385} efi_file_info_t;
386
387typedef struct {
388 u64 revision;
389 void *open;
390 void *close;
391 void *delete;
392 void *read;
393 void *write;
394 void *get_position;
395 void *set_position;
396 void *get_info;
397 void *set_info;
398 void *flush;
399} efi_file_handle_t;
400
401#define EFI_FILE_MODE_READ 0x0000000000000001
402#define EFI_FILE_MODE_WRITE 0x0000000000000002
403#define EFI_FILE_MODE_CREATE 0x8000000000000000
404
278#define EFI_INVALID_TABLE_ADDR (~0UL) 405#define EFI_INVALID_TABLE_ADDR (~0UL)
279 406
280/* 407/*
@@ -385,6 +512,13 @@ extern int __init efi_setup_pcdp_console(char *);
385#define EFI_VARIABLE_RUNTIME_ACCESS 0x0000000000000004 512#define EFI_VARIABLE_RUNTIME_ACCESS 0x0000000000000004
386 513
387/* 514/*
515 * The type of search to perform when calling boottime->locate_handle
516 */
517#define EFI_LOCATE_ALL_HANDLES 0
518#define EFI_LOCATE_BY_REGISTER_NOTIFY 1
519#define EFI_LOCATE_BY_PROTOCOL 2
520
521/*
388 * EFI Device Path information 522 * EFI Device Path information
389 */ 523 */
390#define EFI_DEV_HW 0x01 524#define EFI_DEV_HW 0x01
diff --git a/include/linux/elevator.h b/include/linux/elevator.h
index 1d0f7a2ff73b..c24f3d7fbf1e 100644
--- a/include/linux/elevator.h
+++ b/include/linux/elevator.h
@@ -5,6 +5,8 @@
5 5
6#ifdef CONFIG_BLOCK 6#ifdef CONFIG_BLOCK
7 7
8struct io_cq;
9
8typedef int (elevator_merge_fn) (struct request_queue *, struct request **, 10typedef int (elevator_merge_fn) (struct request_queue *, struct request **,
9 struct bio *); 11 struct bio *);
10 12
@@ -24,6 +26,8 @@ typedef struct request *(elevator_request_list_fn) (struct request_queue *, stru
24typedef void (elevator_completed_req_fn) (struct request_queue *, struct request *); 26typedef void (elevator_completed_req_fn) (struct request_queue *, struct request *);
25typedef int (elevator_may_queue_fn) (struct request_queue *, int); 27typedef int (elevator_may_queue_fn) (struct request_queue *, int);
26 28
29typedef void (elevator_init_icq_fn) (struct io_cq *);
30typedef void (elevator_exit_icq_fn) (struct io_cq *);
27typedef int (elevator_set_req_fn) (struct request_queue *, struct request *, gfp_t); 31typedef int (elevator_set_req_fn) (struct request_queue *, struct request *, gfp_t);
28typedef void (elevator_put_req_fn) (struct request *); 32typedef void (elevator_put_req_fn) (struct request *);
29typedef void (elevator_activate_req_fn) (struct request_queue *, struct request *); 33typedef void (elevator_activate_req_fn) (struct request_queue *, struct request *);
@@ -56,6 +60,9 @@ struct elevator_ops
56 elevator_request_list_fn *elevator_former_req_fn; 60 elevator_request_list_fn *elevator_former_req_fn;
57 elevator_request_list_fn *elevator_latter_req_fn; 61 elevator_request_list_fn *elevator_latter_req_fn;
58 62
63 elevator_init_icq_fn *elevator_init_icq_fn; /* see iocontext.h */
64 elevator_exit_icq_fn *elevator_exit_icq_fn; /* ditto */
65
59 elevator_set_req_fn *elevator_set_req_fn; 66 elevator_set_req_fn *elevator_set_req_fn;
60 elevator_put_req_fn *elevator_put_req_fn; 67 elevator_put_req_fn *elevator_put_req_fn;
61 68
@@ -63,7 +70,6 @@ struct elevator_ops
63 70
64 elevator_init_fn *elevator_init_fn; 71 elevator_init_fn *elevator_init_fn;
65 elevator_exit_fn *elevator_exit_fn; 72 elevator_exit_fn *elevator_exit_fn;
66 void (*trim)(struct io_context *);
67}; 73};
68 74
69#define ELV_NAME_MAX (16) 75#define ELV_NAME_MAX (16)
@@ -79,11 +85,20 @@ struct elv_fs_entry {
79 */ 85 */
80struct elevator_type 86struct elevator_type
81{ 87{
82 struct list_head list; 88 /* managed by elevator core */
89 struct kmem_cache *icq_cache;
90
91 /* fields provided by elevator implementation */
83 struct elevator_ops ops; 92 struct elevator_ops ops;
93 size_t icq_size; /* see iocontext.h */
94 size_t icq_align; /* ditto */
84 struct elv_fs_entry *elevator_attrs; 95 struct elv_fs_entry *elevator_attrs;
85 char elevator_name[ELV_NAME_MAX]; 96 char elevator_name[ELV_NAME_MAX];
86 struct module *elevator_owner; 97 struct module *elevator_owner;
98
99 /* managed by elevator core */
100 char icq_cache_name[ELV_NAME_MAX + 5]; /* elvname + "_io_cq" */
101 struct list_head list;
87}; 102};
88 103
89/* 104/*
@@ -91,10 +106,9 @@ struct elevator_type
91 */ 106 */
92struct elevator_queue 107struct elevator_queue
93{ 108{
94 struct elevator_ops *ops; 109 struct elevator_type *type;
95 void *elevator_data; 110 void *elevator_data;
96 struct kobject kobj; 111 struct kobject kobj;
97 struct elevator_type *elevator_type;
98 struct mutex sysfs_lock; 112 struct mutex sysfs_lock;
99 struct hlist_head *hash; 113 struct hlist_head *hash;
100 unsigned int registered:1; 114 unsigned int registered:1;
@@ -129,7 +143,7 @@ extern void elv_drain_elevator(struct request_queue *);
129/* 143/*
130 * io scheduler registration 144 * io scheduler registration
131 */ 145 */
132extern void elv_register(struct elevator_type *); 146extern int elv_register(struct elevator_type *);
133extern void elv_unregister(struct elevator_type *); 147extern void elv_unregister(struct elevator_type *);
134 148
135/* 149/*
@@ -197,22 +211,5 @@ enum {
197 INIT_LIST_HEAD(&(rq)->csd.list); \ 211 INIT_LIST_HEAD(&(rq)->csd.list); \
198 } while (0) 212 } while (0)
199 213
200/*
201 * io context count accounting
202 */
203#define elv_ioc_count_mod(name, __val) this_cpu_add(name, __val)
204#define elv_ioc_count_inc(name) this_cpu_inc(name)
205#define elv_ioc_count_dec(name) this_cpu_dec(name)
206
207#define elv_ioc_count_read(name) \
208({ \
209 unsigned long __val = 0; \
210 int __cpu; \
211 smp_wmb(); \
212 for_each_possible_cpu(__cpu) \
213 __val += per_cpu(name, __cpu); \
214 __val; \
215})
216
217#endif /* CONFIG_BLOCK */ 214#endif /* CONFIG_BLOCK */
218#endif 215#endif
diff --git a/include/linux/elf-em.h b/include/linux/elf-em.h
index 18bea78fe47b..8e2b7bac4378 100644
--- a/include/linux/elf-em.h
+++ b/include/linux/elf-em.h
@@ -33,6 +33,7 @@
33#define EM_H8_300 46 /* Renesas H8/300,300H,H8S */ 33#define EM_H8_300 46 /* Renesas H8/300,300H,H8S */
34#define EM_MN10300 89 /* Panasonic/MEI MN10300, AM33 */ 34#define EM_MN10300 89 /* Panasonic/MEI MN10300, AM33 */
35#define EM_BLACKFIN 106 /* ADI Blackfin Processor */ 35#define EM_BLACKFIN 106 /* ADI Blackfin Processor */
36#define EM_TI_C6000 140 /* TI C6X DSPs */
36#define EM_FRV 0x5441 /* Fujitsu FR-V */ 37#define EM_FRV 0x5441 /* Fujitsu FR-V */
37#define EM_AVR32 0x18ad /* Atmel AVR32 */ 38#define EM_AVR32 0x18ad /* Atmel AVR32 */
38 39
diff --git a/include/linux/elf.h b/include/linux/elf.h
index 31f0508d7da7..999b4f52e8e5 100644
--- a/include/linux/elf.h
+++ b/include/linux/elf.h
@@ -7,15 +7,6 @@
7#include <asm/elf.h> 7#include <asm/elf.h>
8#endif 8#endif
9 9
10struct file;
11
12#ifndef elf_read_implies_exec
13 /* Executables for which elf_read_implies_exec() returns TRUE will
14 have the READ_IMPLIES_EXEC personality flag set automatically.
15 Override in asm/elf.h as needed. */
16# define elf_read_implies_exec(ex, have_pt_gnu_stack) 0
17#endif
18
19/* 32-bit ELF base types. */ 10/* 32-bit ELF base types. */
20typedef __u32 Elf32_Addr; 11typedef __u32 Elf32_Addr;
21typedef __u16 Elf32_Half; 12typedef __u16 Elf32_Half;
@@ -414,6 +405,13 @@ typedef struct elf64_note {
414} Elf64_Nhdr; 405} Elf64_Nhdr;
415 406
416#ifdef __KERNEL__ 407#ifdef __KERNEL__
408#ifndef elf_read_implies_exec
409 /* Executables for which elf_read_implies_exec() returns TRUE will
410 have the READ_IMPLIES_EXEC personality flag set automatically.
411 Override in asm/elf.h as needed. */
412# define elf_read_implies_exec(ex, have_pt_gnu_stack) 0
413#endif
414
417#if ELF_CLASS == ELFCLASS32 415#if ELF_CLASS == ELFCLASS32
418 416
419extern Elf32_Dyn _DYNAMIC []; 417extern Elf32_Dyn _DYNAMIC [];
@@ -437,6 +435,8 @@ extern Elf64_Dyn _DYNAMIC [];
437#endif 435#endif
438 436
439/* Optional callbacks to write extra ELF notes. */ 437/* Optional callbacks to write extra ELF notes. */
438struct file;
439
440#ifndef ARCH_HAVE_EXTRA_ELF_NOTES 440#ifndef ARCH_HAVE_EXTRA_ELF_NOTES
441static inline int elf_coredump_extra_notes_size(void) { return 0; } 441static inline int elf_coredump_extra_notes_size(void) { return 0; }
442static inline int elf_coredump_extra_notes_write(struct file *file, 442static inline int elf_coredump_extra_notes_write(struct file *file,
diff --git a/include/linux/eventpoll.h b/include/linux/eventpoll.h
index f362733186a5..657ab55beda0 100644
--- a/include/linux/eventpoll.h
+++ b/include/linux/eventpoll.h
@@ -61,6 +61,7 @@ struct file;
61static inline void eventpoll_init_file(struct file *file) 61static inline void eventpoll_init_file(struct file *file)
62{ 62{
63 INIT_LIST_HEAD(&file->f_ep_links); 63 INIT_LIST_HEAD(&file->f_ep_links);
64 INIT_LIST_HEAD(&file->f_tfile_llink);
64} 65}
65 66
66 67
diff --git a/include/linux/fb.h b/include/linux/fb.h
index 1d6836c498dd..c18122f40543 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -45,6 +45,7 @@
45#define FB_TYPE_INTERLEAVED_PLANES 2 /* Interleaved planes */ 45#define FB_TYPE_INTERLEAVED_PLANES 2 /* Interleaved planes */
46#define FB_TYPE_TEXT 3 /* Text/attributes */ 46#define FB_TYPE_TEXT 3 /* Text/attributes */
47#define FB_TYPE_VGA_PLANES 4 /* EGA/VGA planes */ 47#define FB_TYPE_VGA_PLANES 4 /* EGA/VGA planes */
48#define FB_TYPE_FOURCC 5 /* Type identified by a V4L2 FOURCC */
48 49
49#define FB_AUX_TEXT_MDA 0 /* Monochrome text */ 50#define FB_AUX_TEXT_MDA 0 /* Monochrome text */
50#define FB_AUX_TEXT_CGA 1 /* CGA/EGA/VGA Color text */ 51#define FB_AUX_TEXT_CGA 1 /* CGA/EGA/VGA Color text */
@@ -69,6 +70,7 @@
69#define FB_VISUAL_PSEUDOCOLOR 3 /* Pseudo color (like atari) */ 70#define FB_VISUAL_PSEUDOCOLOR 3 /* Pseudo color (like atari) */
70#define FB_VISUAL_DIRECTCOLOR 4 /* Direct color */ 71#define FB_VISUAL_DIRECTCOLOR 4 /* Direct color */
71#define FB_VISUAL_STATIC_PSEUDOCOLOR 5 /* Pseudo color readonly */ 72#define FB_VISUAL_STATIC_PSEUDOCOLOR 5 /* Pseudo color readonly */
73#define FB_VISUAL_FOURCC 6 /* Visual identified by a V4L2 FOURCC */
72 74
73#define FB_ACCEL_NONE 0 /* no hardware accelerator */ 75#define FB_ACCEL_NONE 0 /* no hardware accelerator */
74#define FB_ACCEL_ATARIBLITT 1 /* Atari Blitter */ 76#define FB_ACCEL_ATARIBLITT 1 /* Atari Blitter */
@@ -154,6 +156,8 @@
154 156
155#define FB_ACCEL_PUV3_UNIGFX 0xa0 /* PKUnity-v3 Unigfx */ 157#define FB_ACCEL_PUV3_UNIGFX 0xa0 /* PKUnity-v3 Unigfx */
156 158
159#define FB_CAP_FOURCC 1 /* Device supports FOURCC-based formats */
160
157struct fb_fix_screeninfo { 161struct fb_fix_screeninfo {
158 char id[16]; /* identification string eg "TT Builtin" */ 162 char id[16]; /* identification string eg "TT Builtin" */
159 unsigned long smem_start; /* Start of frame buffer mem */ 163 unsigned long smem_start; /* Start of frame buffer mem */
@@ -171,7 +175,8 @@ struct fb_fix_screeninfo {
171 __u32 mmio_len; /* Length of Memory Mapped I/O */ 175 __u32 mmio_len; /* Length of Memory Mapped I/O */
172 __u32 accel; /* Indicate to driver which */ 176 __u32 accel; /* Indicate to driver which */
173 /* specific chip/card we have */ 177 /* specific chip/card we have */
174 __u16 reserved[3]; /* Reserved for future compatibility */ 178 __u16 capabilities; /* see FB_CAP_* */
179 __u16 reserved[2]; /* Reserved for future compatibility */
175}; 180};
176 181
177/* Interpretation of offset for color fields: All offsets are from the right, 182/* Interpretation of offset for color fields: All offsets are from the right,
@@ -246,8 +251,8 @@ struct fb_var_screeninfo {
246 __u32 yoffset; /* resolution */ 251 __u32 yoffset; /* resolution */
247 252
248 __u32 bits_per_pixel; /* guess what */ 253 __u32 bits_per_pixel; /* guess what */
249 __u32 grayscale; /* != 0 Graylevels instead of colors */ 254 __u32 grayscale; /* 0 = color, 1 = grayscale, */
250 255 /* >1 = FOURCC */
251 struct fb_bitfield red; /* bitfield in fb mem if true color, */ 256 struct fb_bitfield red; /* bitfield in fb mem if true color, */
252 struct fb_bitfield green; /* else only length is significant */ 257 struct fb_bitfield green; /* else only length is significant */
253 struct fb_bitfield blue; 258 struct fb_bitfield blue;
@@ -273,7 +278,8 @@ struct fb_var_screeninfo {
273 __u32 sync; /* see FB_SYNC_* */ 278 __u32 sync; /* see FB_SYNC_* */
274 __u32 vmode; /* see FB_VMODE_* */ 279 __u32 vmode; /* see FB_VMODE_* */
275 __u32 rotate; /* angle we rotate counter clockwise */ 280 __u32 rotate; /* angle we rotate counter clockwise */
276 __u32 reserved[5]; /* Reserved for future compatibility */ 281 __u32 colorspace; /* colorspace for FOURCC-based modes */
282 __u32 reserved[4]; /* Reserved for future compatibility */
277}; 283};
278 284
279struct fb_cmap { 285struct fb_cmap {
diff --git a/include/linux/freezer.h b/include/linux/freezer.h
index 0ab54e16a91f..d09af4b67cf1 100644
--- a/include/linux/freezer.h
+++ b/include/linux/freezer.h
@@ -39,6 +39,7 @@ extern bool __refrigerator(bool check_kthr_stop);
39extern int freeze_processes(void); 39extern int freeze_processes(void);
40extern int freeze_kernel_threads(void); 40extern int freeze_kernel_threads(void);
41extern void thaw_processes(void); 41extern void thaw_processes(void);
42extern void thaw_kernel_threads(void);
42 43
43static inline bool try_to_freeze(void) 44static inline bool try_to_freeze(void)
44{ 45{
@@ -174,6 +175,7 @@ static inline bool __refrigerator(bool check_kthr_stop) { return false; }
174static inline int freeze_processes(void) { return -ENOSYS; } 175static inline int freeze_processes(void) { return -ENOSYS; }
175static inline int freeze_kernel_threads(void) { return -ENOSYS; } 176static inline int freeze_kernel_threads(void) { return -ENOSYS; }
176static inline void thaw_processes(void) {} 177static inline void thaw_processes(void) {}
178static inline void thaw_kernel_threads(void) {}
177 179
178static inline bool try_to_freeze(void) { return false; } 180static inline bool try_to_freeze(void) { return false; }
179 181
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 7aacf31418fe..386da09f229d 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -319,6 +319,7 @@ struct inodes_stat_t {
319#define BLKPBSZGET _IO(0x12,123) 319#define BLKPBSZGET _IO(0x12,123)
320#define BLKDISCARDZEROES _IO(0x12,124) 320#define BLKDISCARDZEROES _IO(0x12,124)
321#define BLKSECDISCARD _IO(0x12,125) 321#define BLKSECDISCARD _IO(0x12,125)
322#define BLKROTATIONAL _IO(0x12,126)
322 323
323#define BMAP_IOCTL 1 /* obsolete - kept for compatibility */ 324#define BMAP_IOCTL 1 /* obsolete - kept for compatibility */
324#define FIBMAP _IO(0x00,1) /* bmap access */ 325#define FIBMAP _IO(0x00,1) /* bmap access */
@@ -395,6 +396,7 @@ struct inodes_stat_t {
395#include <linux/rculist_bl.h> 396#include <linux/rculist_bl.h>
396#include <linux/atomic.h> 397#include <linux/atomic.h>
397#include <linux/shrinker.h> 398#include <linux/shrinker.h>
399#include <linux/migrate_mode.h>
398 400
399#include <asm/byteorder.h> 401#include <asm/byteorder.h>
400 402
@@ -609,9 +611,12 @@ struct address_space_operations {
609 loff_t offset, unsigned long nr_segs); 611 loff_t offset, unsigned long nr_segs);
610 int (*get_xip_mem)(struct address_space *, pgoff_t, int, 612 int (*get_xip_mem)(struct address_space *, pgoff_t, int,
611 void **, unsigned long *); 613 void **, unsigned long *);
612 /* migrate the contents of a page to the specified target */ 614 /*
615 * migrate the contents of a page to the specified target. If sync
616 * is false, it must not block.
617 */
613 int (*migratepage) (struct address_space *, 618 int (*migratepage) (struct address_space *,
614 struct page *, struct page *); 619 struct page *, struct page *, enum migrate_mode);
615 int (*launder_page) (struct page *); 620 int (*launder_page) (struct page *);
616 int (*is_partially_uptodate) (struct page *, read_descriptor_t *, 621 int (*is_partially_uptodate) (struct page *, read_descriptor_t *,
617 unsigned long); 622 unsigned long);
@@ -656,6 +661,7 @@ struct address_space {
656 * must be enforced here for CRIS, to let the least significant bit 661 * must be enforced here for CRIS, to let the least significant bit
657 * of struct page's "mapping" pointer be used for PAGE_MAPPING_ANON. 662 * of struct page's "mapping" pointer be used for PAGE_MAPPING_ANON.
658 */ 663 */
664struct request_queue;
659 665
660struct block_device { 666struct block_device {
661 dev_t bd_dev; /* not a kdev_t - it's a search key */ 667 dev_t bd_dev; /* not a kdev_t - it's a search key */
@@ -678,6 +684,7 @@ struct block_device {
678 unsigned bd_part_count; 684 unsigned bd_part_count;
679 int bd_invalidated; 685 int bd_invalidated;
680 struct gendisk * bd_disk; 686 struct gendisk * bd_disk;
687 struct request_queue * bd_queue;
681 struct list_head bd_list; 688 struct list_head bd_list;
682 /* 689 /*
683 * Private data. You must have bd_claim'ed the block_device 690 * Private data. You must have bd_claim'ed the block_device
@@ -1001,6 +1008,7 @@ struct file {
1001#ifdef CONFIG_EPOLL 1008#ifdef CONFIG_EPOLL
1002 /* Used by fs/eventpoll.c to link all the hooks to this file */ 1009 /* Used by fs/eventpoll.c to link all the hooks to this file */
1003 struct list_head f_ep_links; 1010 struct list_head f_ep_links;
1011 struct list_head f_tfile_llink;
1004#endif /* #ifdef CONFIG_EPOLL */ 1012#endif /* #ifdef CONFIG_EPOLL */
1005 struct address_space *f_mapping; 1013 struct address_space *f_mapping;
1006#ifdef CONFIG_DEBUG_WRITECOUNT 1014#ifdef CONFIG_DEBUG_WRITECOUNT
@@ -2536,7 +2544,8 @@ extern int generic_check_addressable(unsigned, u64);
2536 2544
2537#ifdef CONFIG_MIGRATION 2545#ifdef CONFIG_MIGRATION
2538extern int buffer_migrate_page(struct address_space *, 2546extern int buffer_migrate_page(struct address_space *,
2539 struct page *, struct page *); 2547 struct page *, struct page *,
2548 enum migrate_mode);
2540#else 2549#else
2541#define buffer_migrate_page NULL 2550#define buffer_migrate_page NULL
2542#endif 2551#endif
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index 26eafcef75be..028e26f0bf08 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -133,6 +133,8 @@ struct ftrace_func_command {
133int ftrace_arch_code_modify_prepare(void); 133int ftrace_arch_code_modify_prepare(void);
134int ftrace_arch_code_modify_post_process(void); 134int ftrace_arch_code_modify_post_process(void);
135 135
136void ftrace_bug(int err, unsigned long ip);
137
136struct seq_file; 138struct seq_file;
137 139
138struct ftrace_probe_ops { 140struct ftrace_probe_ops {
@@ -161,7 +163,6 @@ extern int ftrace_text_reserved(void *start, void *end);
161 163
162enum { 164enum {
163 FTRACE_FL_ENABLED = (1 << 30), 165 FTRACE_FL_ENABLED = (1 << 30),
164 FTRACE_FL_FREE = (1 << 31),
165}; 166};
166 167
167#define FTRACE_FL_MASK (0x3UL << 30) 168#define FTRACE_FL_MASK (0x3UL << 30)
@@ -172,10 +173,7 @@ struct dyn_ftrace {
172 unsigned long ip; /* address of mcount call-site */ 173 unsigned long ip; /* address of mcount call-site */
173 struct dyn_ftrace *freelist; 174 struct dyn_ftrace *freelist;
174 }; 175 };
175 union { 176 unsigned long flags;
176 unsigned long flags;
177 struct dyn_ftrace *newlist;
178 };
179 struct dyn_arch_ftrace arch; 177 struct dyn_arch_ftrace arch;
180}; 178};
181 179
@@ -190,6 +188,56 @@ void ftrace_set_global_notrace(unsigned char *buf, int len, int reset);
190int register_ftrace_command(struct ftrace_func_command *cmd); 188int register_ftrace_command(struct ftrace_func_command *cmd);
191int unregister_ftrace_command(struct ftrace_func_command *cmd); 189int unregister_ftrace_command(struct ftrace_func_command *cmd);
192 190
191enum {
192 FTRACE_UPDATE_CALLS = (1 << 0),
193 FTRACE_DISABLE_CALLS = (1 << 1),
194 FTRACE_UPDATE_TRACE_FUNC = (1 << 2),
195 FTRACE_START_FUNC_RET = (1 << 3),
196 FTRACE_STOP_FUNC_RET = (1 << 4),
197};
198
199enum {
200 FTRACE_UPDATE_IGNORE,
201 FTRACE_UPDATE_MAKE_CALL,
202 FTRACE_UPDATE_MAKE_NOP,
203};
204
205enum {
206 FTRACE_ITER_FILTER = (1 << 0),
207 FTRACE_ITER_NOTRACE = (1 << 1),
208 FTRACE_ITER_PRINTALL = (1 << 2),
209 FTRACE_ITER_DO_HASH = (1 << 3),
210 FTRACE_ITER_HASH = (1 << 4),
211 FTRACE_ITER_ENABLED = (1 << 5),
212};
213
214void arch_ftrace_update_code(int command);
215
216struct ftrace_rec_iter;
217
218struct ftrace_rec_iter *ftrace_rec_iter_start(void);
219struct ftrace_rec_iter *ftrace_rec_iter_next(struct ftrace_rec_iter *iter);
220struct dyn_ftrace *ftrace_rec_iter_record(struct ftrace_rec_iter *iter);
221
222int ftrace_update_record(struct dyn_ftrace *rec, int enable);
223int ftrace_test_record(struct dyn_ftrace *rec, int enable);
224void ftrace_run_stop_machine(int command);
225int ftrace_location(unsigned long ip);
226
227extern ftrace_func_t ftrace_trace_function;
228
229int ftrace_regex_open(struct ftrace_ops *ops, int flag,
230 struct inode *inode, struct file *file);
231ssize_t ftrace_filter_write(struct file *file, const char __user *ubuf,
232 size_t cnt, loff_t *ppos);
233ssize_t ftrace_notrace_write(struct file *file, const char __user *ubuf,
234 size_t cnt, loff_t *ppos);
235loff_t ftrace_regex_lseek(struct file *file, loff_t offset, int origin);
236int ftrace_regex_release(struct inode *inode, struct file *file);
237
238void __init
239ftrace_set_early_filter(struct ftrace_ops *ops, char *buf, int enable);
240
193/* defined in arch */ 241/* defined in arch */
194extern int ftrace_ip_converted(unsigned long ip); 242extern int ftrace_ip_converted(unsigned long ip);
195extern int ftrace_dyn_arch_init(void *data); 243extern int ftrace_dyn_arch_init(void *data);
@@ -284,6 +332,25 @@ static inline int ftrace_text_reserved(void *start, void *end)
284{ 332{
285 return 0; 333 return 0;
286} 334}
335
336/*
337 * Again users of functions that have ftrace_ops may not
338 * have them defined when ftrace is not enabled, but these
339 * functions may still be called. Use a macro instead of inline.
340 */
341#define ftrace_regex_open(ops, flag, inod, file) ({ -ENODEV; })
342#define ftrace_set_early_filter(ops, buf, enable) do { } while (0)
343
344static inline ssize_t ftrace_filter_write(struct file *file, const char __user *ubuf,
345 size_t cnt, loff_t *ppos) { return -ENODEV; }
346static inline ssize_t ftrace_notrace_write(struct file *file, const char __user *ubuf,
347 size_t cnt, loff_t *ppos) { return -ENODEV; }
348static inline loff_t ftrace_regex_lseek(struct file *file, loff_t offset, int origin)
349{
350 return -ENODEV;
351}
352static inline int
353ftrace_regex_release(struct inode *inode, struct file *file) { return -ENODEV; }
287#endif /* CONFIG_DYNAMIC_FTRACE */ 354#endif /* CONFIG_DYNAMIC_FTRACE */
288 355
289/* totally disable ftrace - can not re-enable after this */ 356/* totally disable ftrace - can not re-enable after this */
diff --git a/include/linux/fuse.h b/include/linux/fuse.h
index 464cff526860..8ba2c9460b28 100644
--- a/include/linux/fuse.h
+++ b/include/linux/fuse.h
@@ -50,6 +50,10 @@
50 * 50 *
51 * 7.17 51 * 7.17
52 * - add FUSE_FLOCK_LOCKS and FUSE_RELEASE_FLOCK_UNLOCK 52 * - add FUSE_FLOCK_LOCKS and FUSE_RELEASE_FLOCK_UNLOCK
53 *
54 * 7.18
55 * - add FUSE_IOCTL_DIR flag
56 * - add FUSE_NOTIFY_DELETE
53 */ 57 */
54 58
55#ifndef _LINUX_FUSE_H 59#ifndef _LINUX_FUSE_H
@@ -81,7 +85,7 @@
81#define FUSE_KERNEL_VERSION 7 85#define FUSE_KERNEL_VERSION 7
82 86
83/** Minor version number of this interface */ 87/** Minor version number of this interface */
84#define FUSE_KERNEL_MINOR_VERSION 17 88#define FUSE_KERNEL_MINOR_VERSION 18
85 89
86/** The node ID of the root inode */ 90/** The node ID of the root inode */
87#define FUSE_ROOT_ID 1 91#define FUSE_ROOT_ID 1
@@ -214,6 +218,7 @@ struct fuse_file_lock {
214 * FUSE_IOCTL_UNRESTRICTED: not restricted to well-formed ioctls, retry allowed 218 * FUSE_IOCTL_UNRESTRICTED: not restricted to well-formed ioctls, retry allowed
215 * FUSE_IOCTL_RETRY: retry with new iovecs 219 * FUSE_IOCTL_RETRY: retry with new iovecs
216 * FUSE_IOCTL_32BIT: 32bit ioctl 220 * FUSE_IOCTL_32BIT: 32bit ioctl
221 * FUSE_IOCTL_DIR: is a directory
217 * 222 *
218 * FUSE_IOCTL_MAX_IOV: maximum of in_iovecs + out_iovecs 223 * FUSE_IOCTL_MAX_IOV: maximum of in_iovecs + out_iovecs
219 */ 224 */
@@ -221,6 +226,7 @@ struct fuse_file_lock {
221#define FUSE_IOCTL_UNRESTRICTED (1 << 1) 226#define FUSE_IOCTL_UNRESTRICTED (1 << 1)
222#define FUSE_IOCTL_RETRY (1 << 2) 227#define FUSE_IOCTL_RETRY (1 << 2)
223#define FUSE_IOCTL_32BIT (1 << 3) 228#define FUSE_IOCTL_32BIT (1 << 3)
229#define FUSE_IOCTL_DIR (1 << 4)
224 230
225#define FUSE_IOCTL_MAX_IOV 256 231#define FUSE_IOCTL_MAX_IOV 256
226 232
@@ -283,6 +289,7 @@ enum fuse_notify_code {
283 FUSE_NOTIFY_INVAL_ENTRY = 3, 289 FUSE_NOTIFY_INVAL_ENTRY = 3,
284 FUSE_NOTIFY_STORE = 4, 290 FUSE_NOTIFY_STORE = 4,
285 FUSE_NOTIFY_RETRIEVE = 5, 291 FUSE_NOTIFY_RETRIEVE = 5,
292 FUSE_NOTIFY_DELETE = 6,
286 FUSE_NOTIFY_CODE_MAX, 293 FUSE_NOTIFY_CODE_MAX,
287}; 294};
288 295
@@ -606,6 +613,13 @@ struct fuse_notify_inval_entry_out {
606 __u32 padding; 613 __u32 padding;
607}; 614};
608 615
616struct fuse_notify_delete_out {
617 __u64 parent;
618 __u64 child;
619 __u32 namelen;
620 __u32 padding;
621};
622
609struct fuse_notify_store_out { 623struct fuse_notify_store_out {
610 __u64 nodeid; 624 __u64 nodeid;
611 __u64 offset; 625 __u64 offset;
diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index 3a76faf6a3ee..581e74b7df95 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -36,6 +36,7 @@ struct vm_area_struct;
36#endif 36#endif
37#define ___GFP_NO_KSWAPD 0x400000u 37#define ___GFP_NO_KSWAPD 0x400000u
38#define ___GFP_OTHER_NODE 0x800000u 38#define ___GFP_OTHER_NODE 0x800000u
39#define ___GFP_WRITE 0x1000000u
39 40
40/* 41/*
41 * GFP bitmasks.. 42 * GFP bitmasks..
@@ -85,6 +86,7 @@ struct vm_area_struct;
85 86
86#define __GFP_NO_KSWAPD ((__force gfp_t)___GFP_NO_KSWAPD) 87#define __GFP_NO_KSWAPD ((__force gfp_t)___GFP_NO_KSWAPD)
87#define __GFP_OTHER_NODE ((__force gfp_t)___GFP_OTHER_NODE) /* On behalf of other node */ 88#define __GFP_OTHER_NODE ((__force gfp_t)___GFP_OTHER_NODE) /* On behalf of other node */
89#define __GFP_WRITE ((__force gfp_t)___GFP_WRITE) /* Allocator intends to dirty page */
88 90
89/* 91/*
90 * This may seem redundant, but it's a way of annotating false positives vs. 92 * This may seem redundant, but it's a way of annotating false positives vs.
@@ -92,7 +94,7 @@ struct vm_area_struct;
92 */ 94 */
93#define __GFP_NOTRACK_FALSE_POSITIVE (__GFP_NOTRACK) 95#define __GFP_NOTRACK_FALSE_POSITIVE (__GFP_NOTRACK)
94 96
95#define __GFP_BITS_SHIFT 24 /* Room for N __GFP_FOO bits */ 97#define __GFP_BITS_SHIFT 25 /* Room for N __GFP_FOO bits */
96#define __GFP_BITS_MASK ((__force gfp_t)((1 << __GFP_BITS_SHIFT) - 1)) 98#define __GFP_BITS_MASK ((__force gfp_t)((1 << __GFP_BITS_SHIFT) - 1))
97 99
98/* This equals 0, but use constants in case they ever change */ 100/* This equals 0, but use constants in case they ever change */
@@ -313,7 +315,7 @@ static inline struct page *alloc_pages_node(int nid, gfp_t gfp_mask,
313static inline struct page *alloc_pages_exact_node(int nid, gfp_t gfp_mask, 315static inline struct page *alloc_pages_exact_node(int nid, gfp_t gfp_mask,
314 unsigned int order) 316 unsigned int order)
315{ 317{
316 VM_BUG_ON(nid < 0 || nid >= MAX_NUMNODES); 318 VM_BUG_ON(nid < 0 || nid >= MAX_NUMNODES || !node_online(nid));
317 319
318 return __alloc_pages(gfp_mask, order, node_zonelist(nid, gfp_mask)); 320 return __alloc_pages(gfp_mask, order, node_zonelist(nid, gfp_mask));
319} 321}
@@ -358,6 +360,7 @@ void *alloc_pages_exact_nid(int nid, size_t size, gfp_t gfp_mask);
358extern void __free_pages(struct page *page, unsigned int order); 360extern void __free_pages(struct page *page, unsigned int order);
359extern void free_pages(unsigned long addr, unsigned int order); 361extern void free_pages(unsigned long addr, unsigned int order);
360extern void free_hot_cold_page(struct page *page, int cold); 362extern void free_hot_cold_page(struct page *page, int cold);
363extern void free_hot_cold_page_list(struct list_head *list, int cold);
361 364
362#define __free_page(page) __free_pages((page), 0) 365#define __free_page(page) __free_pages((page), 0)
363#define free_page(addr) free_pages((addr), 0) 366#define free_page(addr) free_pages((addr), 0)
@@ -367,9 +370,25 @@ void drain_zone_pages(struct zone *zone, struct per_cpu_pages *pcp);
367void drain_all_pages(void); 370void drain_all_pages(void);
368void drain_local_pages(void *dummy); 371void drain_local_pages(void *dummy);
369 372
373/*
374 * gfp_allowed_mask is set to GFP_BOOT_MASK during early boot to restrict what
375 * GFP flags are used before interrupts are enabled. Once interrupts are
376 * enabled, it is set to __GFP_BITS_MASK while the system is running. During
377 * hibernation, it is used by PM to avoid I/O during memory allocation while
378 * devices are suspended.
379 */
370extern gfp_t gfp_allowed_mask; 380extern gfp_t gfp_allowed_mask;
371 381
372extern void pm_restrict_gfp_mask(void); 382extern void pm_restrict_gfp_mask(void);
373extern void pm_restore_gfp_mask(void); 383extern void pm_restore_gfp_mask(void);
374 384
385#ifdef CONFIG_PM_SLEEP
386extern bool pm_suspended_storage(void);
387#else
388static inline bool pm_suspended_storage(void)
389{
390 return false;
391}
392#endif /* CONFIG_PM_SLEEP */
393
375#endif /* __LINUX_GFP_H */ 394#endif /* __LINUX_GFP_H */
diff --git a/include/linux/gfs2_ondisk.h b/include/linux/gfs2_ondisk.h
index 4f4462974c14..b148087f49a6 100644
--- a/include/linux/gfs2_ondisk.h
+++ b/include/linux/gfs2_ondisk.h
@@ -22,6 +22,8 @@
22#define GFS2_LIVE_LOCK 1 22#define GFS2_LIVE_LOCK 1
23#define GFS2_TRANS_LOCK 2 23#define GFS2_TRANS_LOCK 2
24#define GFS2_RENAME_LOCK 3 24#define GFS2_RENAME_LOCK 3
25#define GFS2_CONTROL_LOCK 4
26#define GFS2_MOUNTED_LOCK 5
25 27
26/* Format numbers for various metadata types */ 28/* Format numbers for various metadata types */
27 29
diff --git a/include/linux/gpio-pxa.h b/include/linux/gpio-pxa.h
new file mode 100644
index 000000000000..05071ee34c3f
--- /dev/null
+++ b/include/linux/gpio-pxa.h
@@ -0,0 +1,16 @@
1#ifndef __GPIO_PXA_H
2#define __GPIO_PXA_H
3
4#define GPIO_bit(x) (1 << ((x) & 0x1f))
5
6#define gpio_to_bank(gpio) ((gpio) >> 5)
7
8/* NOTE: some PXAs have fewer on-chip GPIOs (like PXA255, with 85).
9 * Those cases currently cause holes in the GPIO number space, the
10 * actual number of the last GPIO is recorded by 'pxa_last_gpio'.
11 */
12extern int pxa_last_gpio;
13
14extern int pxa_irq_to_gpio(int irq);
15
16#endif /* __GPIO_PXA_H */
diff --git a/include/linux/hid.h b/include/linux/hid.h
index c235e4e8767c..3a95da60fd3e 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -72,6 +72,7 @@
72#include <linux/workqueue.h> 72#include <linux/workqueue.h>
73#include <linux/input.h> 73#include <linux/input.h>
74#include <linux/semaphore.h> 74#include <linux/semaphore.h>
75#include <linux/power_supply.h>
75 76
76/* 77/*
77 * We parse each description item into this structure. Short items data 78 * We parse each description item into this structure. Short items data
@@ -190,6 +191,7 @@ struct hid_item {
190#define HID_UP_UNDEFINED 0x00000000 191#define HID_UP_UNDEFINED 0x00000000
191#define HID_UP_GENDESK 0x00010000 192#define HID_UP_GENDESK 0x00010000
192#define HID_UP_SIMULATION 0x00020000 193#define HID_UP_SIMULATION 0x00020000
194#define HID_UP_GENDEVCTRLS 0x00060000
193#define HID_UP_KEYBOARD 0x00070000 195#define HID_UP_KEYBOARD 0x00070000
194#define HID_UP_LED 0x00080000 196#define HID_UP_LED 0x00080000
195#define HID_UP_BUTTON 0x00090000 197#define HID_UP_BUTTON 0x00090000
@@ -239,6 +241,8 @@ struct hid_item {
239#define HID_GD_RIGHT 0x00010092 241#define HID_GD_RIGHT 0x00010092
240#define HID_GD_LEFT 0x00010093 242#define HID_GD_LEFT 0x00010093
241 243
244#define HID_DC_BATTERYSTRENGTH 0x00060020
245
242#define HID_DG_DIGITIZER 0x000d0001 246#define HID_DG_DIGITIZER 0x000d0001
243#define HID_DG_PEN 0x000d0002 247#define HID_DG_PEN 0x000d0002
244#define HID_DG_LIGHTPEN 0x000d0003 248#define HID_DG_LIGHTPEN 0x000d0003
@@ -482,6 +486,19 @@ struct hid_device { /* device report descriptor */
482 struct hid_driver *driver; 486 struct hid_driver *driver;
483 struct hid_ll_driver *ll_driver; 487 struct hid_ll_driver *ll_driver;
484 488
489#ifdef CONFIG_HID_BATTERY_STRENGTH
490 /*
491 * Power supply information for HID devices which report
492 * battery strength. power_supply is registered iff
493 * battery.name is non-NULL.
494 */
495 struct power_supply battery;
496 __s32 battery_min;
497 __s32 battery_max;
498 __s32 battery_report_type;
499 __s32 battery_report_id;
500#endif
501
485 unsigned int status; /* see STAT flags above */ 502 unsigned int status; /* see STAT flags above */
486 unsigned claimed; /* Claimed by hidinput, hiddev? */ 503 unsigned claimed; /* Claimed by hidinput, hiddev? */
487 unsigned quirks; /* Various quirks the device can pull on us */ 504 unsigned quirks; /* Various quirks the device can pull on us */
@@ -712,6 +729,8 @@ extern void hidinput_disconnect(struct hid_device *);
712int hid_set_field(struct hid_field *, unsigned, __s32); 729int hid_set_field(struct hid_field *, unsigned, __s32);
713int hid_input_report(struct hid_device *, int type, u8 *, int, int); 730int hid_input_report(struct hid_device *, int type, u8 *, int, int);
714int hidinput_find_field(struct hid_device *hid, unsigned int type, unsigned int code, struct hid_field **field); 731int hidinput_find_field(struct hid_device *hid, unsigned int type, unsigned int code, struct hid_field **field);
732struct hid_field *hidinput_get_led_field(struct hid_device *hid);
733unsigned int hidinput_count_leds(struct hid_device *hid);
715void hid_output_report(struct hid_report *report, __u8 *data); 734void hid_output_report(struct hid_report *report, __u8 *data);
716struct hid_device *hid_allocate_device(void); 735struct hid_device *hid_allocate_device(void);
717struct hid_report *hid_register_report(struct hid_device *device, unsigned type, unsigned id); 736struct hid_report *hid_register_report(struct hid_device *device, unsigned type, unsigned id);
@@ -719,6 +738,8 @@ int hid_parse_report(struct hid_device *hid, __u8 *start, unsigned size);
719int hid_check_keys_pressed(struct hid_device *hid); 738int hid_check_keys_pressed(struct hid_device *hid);
720int hid_connect(struct hid_device *hid, unsigned int connect_mask); 739int hid_connect(struct hid_device *hid, unsigned int connect_mask);
721void hid_disconnect(struct hid_device *hid); 740void hid_disconnect(struct hid_device *hid);
741const struct hid_device_id *hid_match_id(struct hid_device *hdev,
742 const struct hid_device_id *id);
722 743
723/** 744/**
724 * hid_map_usage - map usage input bits 745 * hid_map_usage - map usage input bits
diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h
index a9ace9c32507..1b921299abc4 100644
--- a/include/linux/huge_mm.h
+++ b/include/linux/huge_mm.h
@@ -18,7 +18,7 @@ extern struct page *follow_trans_huge_pmd(struct mm_struct *mm,
18 unsigned int flags); 18 unsigned int flags);
19extern int zap_huge_pmd(struct mmu_gather *tlb, 19extern int zap_huge_pmd(struct mmu_gather *tlb,
20 struct vm_area_struct *vma, 20 struct vm_area_struct *vma,
21 pmd_t *pmd); 21 pmd_t *pmd, unsigned long addr);
22extern int mincore_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd, 22extern int mincore_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd,
23 unsigned long addr, unsigned long end, 23 unsigned long addr, unsigned long end,
24 unsigned char *vec); 24 unsigned char *vec);
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index 12ec328481de..62b908e0e591 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -35,7 +35,7 @@
35#include <linux/mod_devicetable.h> 35#include <linux/mod_devicetable.h>
36 36
37 37
38#define MAX_PAGE_BUFFER_COUNT 16 38#define MAX_PAGE_BUFFER_COUNT 18
39#define MAX_MULTIPAGE_BUFFER_COUNT 32 /* 128K */ 39#define MAX_MULTIPAGE_BUFFER_COUNT 32 /* 128K */
40 40
41#pragma pack(push, 1) 41#pragma pack(push, 1)
diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h
index 114c0f6fc63d..78d3465251d6 100644
--- a/include/linux/i2c/twl.h
+++ b/include/linux/i2c/twl.h
@@ -652,10 +652,12 @@ struct twl4030_power_data {
652 unsigned num; 652 unsigned num;
653 struct twl4030_resconfig *resource_config; 653 struct twl4030_resconfig *resource_config;
654#define TWL4030_RESCONFIG_UNDEF ((u8)-1) 654#define TWL4030_RESCONFIG_UNDEF ((u8)-1)
655 bool use_poweroff; /* Board is wired for TWL poweroff */
655}; 656};
656 657
657extern void twl4030_power_init(struct twl4030_power_data *triton2_scripts); 658extern void twl4030_power_init(struct twl4030_power_data *triton2_scripts);
658extern int twl4030_remove_script(u8 flags); 659extern int twl4030_remove_script(u8 flags);
660extern void twl4030_power_off(void);
659 661
660struct twl4030_codec_data { 662struct twl4030_codec_data {
661 unsigned int digimic_delay; /* in ms */ 663 unsigned int digimic_delay; /* in ms */
diff --git a/include/linux/if_team.h b/include/linux/if_team.h
index 828181fbad5d..58404b0c5010 100644
--- a/include/linux/if_team.h
+++ b/include/linux/if_team.h
@@ -46,6 +46,10 @@ struct team_port {
46 u32 speed; 46 u32 speed;
47 u8 duplex; 47 u8 duplex;
48 48
49 /* Custom gennetlink interface related flags */
50 bool changed;
51 bool removed;
52
49 struct rcu_head rcu; 53 struct rcu_head rcu;
50}; 54};
51 55
@@ -72,6 +76,10 @@ struct team_option {
72 enum team_option_type type; 76 enum team_option_type type;
73 int (*getter)(struct team *team, void *arg); 77 int (*getter)(struct team *team, void *arg);
74 int (*setter)(struct team *team, void *arg); 78 int (*setter)(struct team *team, void *arg);
79
80 /* Custom gennetlink interface related flags */
81 bool changed;
82 bool removed;
75}; 83};
76 84
77struct team_mode { 85struct team_mode {
@@ -207,6 +215,7 @@ enum {
207 TEAM_ATTR_OPTION_CHANGED, /* flag */ 215 TEAM_ATTR_OPTION_CHANGED, /* flag */
208 TEAM_ATTR_OPTION_TYPE, /* u8 */ 216 TEAM_ATTR_OPTION_TYPE, /* u8 */
209 TEAM_ATTR_OPTION_DATA, /* dynamic */ 217 TEAM_ATTR_OPTION_DATA, /* dynamic */
218 TEAM_ATTR_OPTION_REMOVED, /* flag */
210 219
211 __TEAM_ATTR_OPTION_MAX, 220 __TEAM_ATTR_OPTION_MAX,
212 TEAM_ATTR_OPTION_MAX = __TEAM_ATTR_OPTION_MAX - 1, 221 TEAM_ATTR_OPTION_MAX = __TEAM_ATTR_OPTION_MAX - 1,
@@ -227,6 +236,7 @@ enum {
227 TEAM_ATTR_PORT_LINKUP, /* flag */ 236 TEAM_ATTR_PORT_LINKUP, /* flag */
228 TEAM_ATTR_PORT_SPEED, /* u32 */ 237 TEAM_ATTR_PORT_SPEED, /* u32 */
229 TEAM_ATTR_PORT_DUPLEX, /* u8 */ 238 TEAM_ATTR_PORT_DUPLEX, /* u8 */
239 TEAM_ATTR_PORT_REMOVED, /* flag */
230 240
231 __TEAM_ATTR_PORT_MAX, 241 __TEAM_ATTR_PORT_MAX,
232 TEAM_ATTR_PORT_MAX = __TEAM_ATTR_PORT_MAX - 1, 242 TEAM_ATTR_PORT_MAX = __TEAM_ATTR_PORT_MAX - 1,
diff --git a/include/linux/inet_diag.h b/include/linux/inet_diag.h
index 34e8d52c1925..f1362b5447fc 100644
--- a/include/linux/inet_diag.h
+++ b/include/linux/inet_diag.h
@@ -22,7 +22,7 @@ struct inet_diag_sockid {
22 22
23/* Request structure */ 23/* Request structure */
24 24
25struct inet_diag_req_compat { 25struct inet_diag_req {
26 __u8 idiag_family; /* Family of addresses. */ 26 __u8 idiag_family; /* Family of addresses. */
27 __u8 idiag_src_len; 27 __u8 idiag_src_len;
28 __u8 idiag_dst_len; 28 __u8 idiag_dst_len;
@@ -34,7 +34,7 @@ struct inet_diag_req_compat {
34 __u32 idiag_dbs; /* Tables to dump (NI) */ 34 __u32 idiag_dbs; /* Tables to dump (NI) */
35}; 35};
36 36
37struct inet_diag_req { 37struct inet_diag_req_v2 {
38 __u8 sdiag_family; 38 __u8 sdiag_family;
39 __u8 sdiag_protocol; 39 __u8 sdiag_protocol;
40 __u8 idiag_ext; 40 __u8 idiag_ext;
@@ -143,12 +143,12 @@ struct netlink_callback;
143struct inet_diag_handler { 143struct inet_diag_handler {
144 void (*dump)(struct sk_buff *skb, 144 void (*dump)(struct sk_buff *skb,
145 struct netlink_callback *cb, 145 struct netlink_callback *cb,
146 struct inet_diag_req *r, 146 struct inet_diag_req_v2 *r,
147 struct nlattr *bc); 147 struct nlattr *bc);
148 148
149 int (*dump_one)(struct sk_buff *in_skb, 149 int (*dump_one)(struct sk_buff *in_skb,
150 const struct nlmsghdr *nlh, 150 const struct nlmsghdr *nlh,
151 struct inet_diag_req *req); 151 struct inet_diag_req_v2 *req);
152 152
153 void (*idiag_get_info)(struct sock *sk, 153 void (*idiag_get_info)(struct sock *sk,
154 struct inet_diag_msg *r, 154 struct inet_diag_msg *r,
@@ -158,15 +158,15 @@ struct inet_diag_handler {
158 158
159struct inet_connection_sock; 159struct inet_connection_sock;
160int inet_sk_diag_fill(struct sock *sk, struct inet_connection_sock *icsk, 160int inet_sk_diag_fill(struct sock *sk, struct inet_connection_sock *icsk,
161 struct sk_buff *skb, struct inet_diag_req *req, 161 struct sk_buff *skb, struct inet_diag_req_v2 *req,
162 u32 pid, u32 seq, u16 nlmsg_flags, 162 u32 pid, u32 seq, u16 nlmsg_flags,
163 const struct nlmsghdr *unlh); 163 const struct nlmsghdr *unlh);
164void inet_diag_dump_icsk(struct inet_hashinfo *h, struct sk_buff *skb, 164void inet_diag_dump_icsk(struct inet_hashinfo *h, struct sk_buff *skb,
165 struct netlink_callback *cb, struct inet_diag_req *r, 165 struct netlink_callback *cb, struct inet_diag_req_v2 *r,
166 struct nlattr *bc); 166 struct nlattr *bc);
167int inet_diag_dump_one_icsk(struct inet_hashinfo *hashinfo, 167int inet_diag_dump_one_icsk(struct inet_hashinfo *hashinfo,
168 struct sk_buff *in_skb, const struct nlmsghdr *nlh, 168 struct sk_buff *in_skb, const struct nlmsghdr *nlh,
169 struct inet_diag_req *req); 169 struct inet_diag_req_v2 *req);
170 170
171int inet_diag_bc_sk(const struct nlattr *_bc, struct sock *sk); 171int inet_diag_bc_sk(const struct nlattr *_bc, struct sock *sk);
172 172
diff --git a/include/linux/init.h b/include/linux/init.h
index 9146f39cdddf..6b951095a42f 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -2,6 +2,7 @@
2#define _LINUX_INIT_H 2#define _LINUX_INIT_H
3 3
4#include <linux/compiler.h> 4#include <linux/compiler.h>
5#include <linux/types.h>
5 6
6/* These macros are used to mark some functions or 7/* These macros are used to mark some functions or
7 * initialized data (doesn't apply to uninitialized data) 8 * initialized data (doesn't apply to uninitialized data)
@@ -156,7 +157,7 @@ void prepare_namespace(void);
156 157
157extern void (*late_time_init)(void); 158extern void (*late_time_init)(void);
158 159
159extern int initcall_debug; 160extern bool initcall_debug;
160 161
161#endif 162#endif
162 163
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index 32574eef9394..9c66b1ada9d7 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -23,11 +23,10 @@ extern struct files_struct init_files;
23extern struct fs_struct init_fs; 23extern struct fs_struct init_fs;
24 24
25#ifdef CONFIG_CGROUPS 25#ifdef CONFIG_CGROUPS
26#define INIT_THREADGROUP_FORK_LOCK(sig) \ 26#define INIT_GROUP_RWSEM(sig) \
27 .threadgroup_fork_lock = \ 27 .group_rwsem = __RWSEM_INITIALIZER(sig.group_rwsem),
28 __RWSEM_INITIALIZER(sig.threadgroup_fork_lock),
29#else 28#else
30#define INIT_THREADGROUP_FORK_LOCK(sig) 29#define INIT_GROUP_RWSEM(sig)
31#endif 30#endif
32 31
33#define INIT_SIGNALS(sig) { \ 32#define INIT_SIGNALS(sig) { \
@@ -46,7 +45,7 @@ extern struct fs_struct init_fs;
46 }, \ 45 }, \
47 .cred_guard_mutex = \ 46 .cred_guard_mutex = \
48 __MUTEX_INITIALIZER(sig.cred_guard_mutex), \ 47 __MUTEX_INITIALIZER(sig.cred_guard_mutex), \
49 INIT_THREADGROUP_FORK_LOCK(sig) \ 48 INIT_GROUP_RWSEM(sig) \
50} 49}
51 50
52extern struct nsproxy init_nsproxy; 51extern struct nsproxy init_nsproxy;
diff --git a/include/linux/input/auo-pixcir-ts.h b/include/linux/input/auo-pixcir-ts.h
new file mode 100644
index 000000000000..75d4be717714
--- /dev/null
+++ b/include/linux/input/auo-pixcir-ts.h
@@ -0,0 +1,56 @@
1/*
2 * Driver for AUO in-cell touchscreens
3 *
4 * Copyright (c) 2011 Heiko Stuebner <heiko@sntech.de>
5 *
6 * based on auo_touch.h from Dell Streak kernel
7 *
8 * Copyright (c) 2008 QUALCOMM Incorporated.
9 * Copyright (c) 2008 QUALCOMM USA, INC.
10 *
11 *
12 * This software is licensed under the terms of the GNU General Public
13 * License version 2, as published by the Free Software Foundation, and
14 * may be copied, distributed, and modified under those terms.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 */
22
23#ifndef __AUO_PIXCIR_TS_H__
24#define __AUO_PIXCIR_TS_H__
25
26/*
27 * Interrupt modes:
28 * periodical: interrupt is asserted periodicaly
29 * compare coordinates: interrupt is asserted when coordinates change
30 * indicate touch: interrupt is asserted during touch
31 */
32#define AUO_PIXCIR_INT_PERIODICAL 0x00
33#define AUO_PIXCIR_INT_COMP_COORD 0x01
34#define AUO_PIXCIR_INT_TOUCH_IND 0x02
35
36/*
37 * @gpio_int interrupt gpio
38 * @int_setting one of AUO_PIXCIR_INT_*
39 * @init_hw hardwarespecific init
40 * @exit_hw hardwarespecific shutdown
41 * @x_max x-resolution
42 * @y_max y-resolution
43 */
44struct auo_pixcir_ts_platdata {
45 int gpio_int;
46
47 int int_setting;
48
49 void (*init_hw)(struct i2c_client *);
50 void (*exit_hw)(struct i2c_client *);
51
52 unsigned int x_max;
53 unsigned int y_max;
54};
55
56#endif
diff --git a/include/linux/input/gp2ap002a00f.h b/include/linux/input/gp2ap002a00f.h
new file mode 100644
index 000000000000..aad2fd44a61a
--- /dev/null
+++ b/include/linux/input/gp2ap002a00f.h
@@ -0,0 +1,22 @@
1#ifndef _GP2AP002A00F_H_
2#define _GP2AP002A00F_H_
3
4#include <linux/i2c.h>
5
6#define GP2A_I2C_NAME "gp2ap002a00f"
7
8/**
9 * struct gp2a_platform_data - Sharp gp2ap002a00f proximity platform data
10 * @vout_gpio: The gpio connected to the object detected pin (VOUT)
11 * @wakeup: Set to true if the proximity can wake the device from suspend
12 * @hw_setup: Callback for setting up hardware such as gpios and vregs
13 * @hw_shutdown: Callback for properly shutting down hardware
14 */
15struct gp2a_platform_data {
16 int vout_gpio;
17 bool wakeup;
18 int (*hw_setup)(struct i2c_client *client);
19 int (*hw_shutdown)(struct i2c_client *client);
20};
21
22#endif
diff --git a/include/linux/input/gpio_tilt.h b/include/linux/input/gpio_tilt.h
new file mode 100644
index 000000000000..c1cc52d380e0
--- /dev/null
+++ b/include/linux/input/gpio_tilt.h
@@ -0,0 +1,73 @@
1#ifndef _INPUT_GPIO_TILT_H
2#define _INPUT_GPIO_TILT_H
3
4/**
5 * struct gpio_tilt_axis - Axis used by the tilt switch
6 * @axis: Constant describing the axis, e.g. ABS_X
7 * @min: minimum value for abs_param
8 * @max: maximum value for abs_param
9 * @fuzz: fuzz value for abs_param
10 * @flat: flat value for abs_param
11 */
12struct gpio_tilt_axis {
13 int axis;
14 int min;
15 int max;
16 int fuzz;
17 int flat;
18};
19
20/**
21 * struct gpio_tilt_state - state description
22 * @gpios: bitfield of gpio target-states for the value
23 * @axes: array containing the axes settings for the gpio state
24 * The array indizes must correspond to the axes defined
25 * in platform_data
26 *
27 * This structure describes a supported axis settings
28 * and the necessary gpio-state which represent it.
29 *
30 * The n-th bit in the bitfield describes the state of the n-th GPIO
31 * from the gpios-array defined in gpio_regulator_config below.
32 */
33struct gpio_tilt_state {
34 int gpios;
35 int *axes;
36};
37
38/**
39 * struct gpio_tilt_platform_data
40 * @gpios: Array containing the gpios determining the tilt state
41 * @nr_gpios: Number of gpios
42 * @axes: Array of gpio_tilt_axis descriptions
43 * @nr_axes: Number of axes
44 * @states: Array of gpio_tilt_state entries describing
45 * the gpio state for specific tilts
46 * @nr_states: Number of states available
47 * @debounce_interval: debounce ticks interval in msecs
48 * @poll_interval: polling interval in msecs - for polling driver only
49 * @enable: callback to enable the tilt switch
50 * @disable: callback to disable the tilt switch
51 *
52 * This structure contains gpio-tilt-switch configuration
53 * information that must be passed by platform code to the
54 * gpio-tilt input driver.
55 */
56struct gpio_tilt_platform_data {
57 struct gpio *gpios;
58 int nr_gpios;
59
60 struct gpio_tilt_axis *axes;
61 int nr_axes;
62
63 struct gpio_tilt_state *states;
64 int nr_states;
65
66 int debounce_interval;
67
68 unsigned int poll_interval;
69 int (*enable)(struct device *dev);
70 void (*disable)(struct device *dev);
71};
72
73#endif
diff --git a/include/linux/input/pixcir_ts.h b/include/linux/input/pixcir_ts.h
new file mode 100644
index 000000000000..7163d91c0373
--- /dev/null
+++ b/include/linux/input/pixcir_ts.h
@@ -0,0 +1,10 @@
1#ifndef _PIXCIR_I2C_TS_H
2#define _PIXCIR_I2C_TS_H
3
4struct pixcir_ts_platform_data {
5 int (*attb_read_val)(void);
6 int x_max;
7 int y_max;
8};
9
10#endif
diff --git a/include/linux/input/samsung-keypad.h b/include/linux/input/samsung-keypad.h
new file mode 100644
index 000000000000..f25619bfd8a8
--- /dev/null
+++ b/include/linux/input/samsung-keypad.h
@@ -0,0 +1,43 @@
1/*
2 * Samsung Keypad platform data definitions
3 *
4 * Copyright (C) 2010 Samsung Electronics Co.Ltd
5 * Author: Joonyoung Shim <jy0922.shim@samsung.com>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 */
12
13#ifndef __SAMSUNG_KEYPAD_H
14#define __SAMSUNG_KEYPAD_H
15
16#include <linux/input/matrix_keypad.h>
17
18#define SAMSUNG_MAX_ROWS 8
19#define SAMSUNG_MAX_COLS 8
20
21/**
22 * struct samsung_keypad_platdata - Platform device data for Samsung Keypad.
23 * @keymap_data: pointer to &matrix_keymap_data.
24 * @rows: number of keypad row supported.
25 * @cols: number of keypad col supported.
26 * @no_autorepeat: disable key autorepeat.
27 * @wakeup: controls whether the device should be set up as wakeup source.
28 * @cfg_gpio: configure the GPIO.
29 *
30 * Initialisation data specific to either the machine or the platform
31 * for the device driver to use or call-back when configuring gpio.
32 */
33struct samsung_keypad_platdata {
34 const struct matrix_keymap_data *keymap_data;
35 unsigned int rows;
36 unsigned int cols;
37 bool no_autorepeat;
38 bool wakeup;
39
40 void (*cfg_gpio)(unsigned int rows, unsigned int cols);
41};
42
43#endif /* __SAMSUNG_KEYPAD_H */
diff --git a/include/linux/input/tca8418_keypad.h b/include/linux/input/tca8418_keypad.h
new file mode 100644
index 000000000000..e71a85dc2cbd
--- /dev/null
+++ b/include/linux/input/tca8418_keypad.h
@@ -0,0 +1,44 @@
1/*
2 * TCA8418 keypad platform support
3 *
4 * Copyright (C) 2011 Fuel7, Inc. All rights reserved.
5 *
6 * Author: Kyle Manna <kyle.manna@fuel7.com>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public
10 * License v2 as published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public
18 * License along with this program; if not, write to the
19 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 * Boston, MA 021110-1307, USA.
21 *
22 * If you can't comply with GPLv2, alternative licensing terms may be
23 * arranged. Please contact Fuel7, Inc. (http://fuel7.com/) for proprietary
24 * alternative licensing inquiries.
25 */
26
27#ifndef _TCA8418_KEYPAD_H
28#define _TCA8418_KEYPAD_H
29
30#include <linux/types.h>
31#include <linux/input/matrix_keypad.h>
32
33#define TCA8418_I2C_ADDR 0x34
34#define TCA8418_NAME "tca8418_keypad"
35
36struct tca8418_keypad_platform_data {
37 const struct matrix_keymap_data *keymap_data;
38 unsigned rows;
39 unsigned cols;
40 bool rep;
41 bool irq_is_gpio;
42};
43
44#endif
diff --git a/include/linux/iocontext.h b/include/linux/iocontext.h
index 5037a0ad2312..7e1371c4bccf 100644
--- a/include/linux/iocontext.h
+++ b/include/linux/iocontext.h
@@ -3,32 +3,92 @@
3 3
4#include <linux/radix-tree.h> 4#include <linux/radix-tree.h>
5#include <linux/rcupdate.h> 5#include <linux/rcupdate.h>
6#include <linux/workqueue.h>
6 7
7struct cfq_queue; 8enum {
8struct cfq_ttime { 9 ICQ_IOPRIO_CHANGED,
9 unsigned long last_end_request; 10 ICQ_CGROUP_CHANGED,
10
11 unsigned long ttime_total;
12 unsigned long ttime_samples;
13 unsigned long ttime_mean;
14}; 11};
15 12
16struct cfq_io_context { 13/*
17 void *key; 14 * An io_cq (icq) is association between an io_context (ioc) and a
18 15 * request_queue (q). This is used by elevators which need to track
19 struct cfq_queue *cfqq[2]; 16 * information per ioc - q pair.
20 17 *
21 struct io_context *ioc; 18 * Elevator can request use of icq by setting elevator_type->icq_size and
22 19 * ->icq_align. Both size and align must be larger than that of struct
23 struct cfq_ttime ttime; 20 * io_cq and elevator can use the tail area for private information. The
24 21 * recommended way to do this is defining a struct which contains io_cq as
25 struct list_head queue_list; 22 * the first member followed by private members and using its size and
26 struct hlist_node cic_list; 23 * align. For example,
27 24 *
28 void (*dtor)(struct io_context *); /* destructor */ 25 * struct snail_io_cq {
29 void (*exit)(struct io_context *); /* called on task exit */ 26 * struct io_cq icq;
27 * int poke_snail;
28 * int feed_snail;
29 * };
30 *
31 * struct elevator_type snail_elv_type {
32 * .ops = { ... },
33 * .icq_size = sizeof(struct snail_io_cq),
34 * .icq_align = __alignof__(struct snail_io_cq),
35 * ...
36 * };
37 *
38 * If icq_size is set, block core will manage icq's. All requests will
39 * have its ->elv.icq field set before elevator_ops->elevator_set_req_fn()
40 * is called and be holding a reference to the associated io_context.
41 *
42 * Whenever a new icq is created, elevator_ops->elevator_init_icq_fn() is
43 * called and, on destruction, ->elevator_exit_icq_fn(). Both functions
44 * are called with both the associated io_context and queue locks held.
45 *
46 * Elevator is allowed to lookup icq using ioc_lookup_icq() while holding
47 * queue lock but the returned icq is valid only until the queue lock is
48 * released. Elevators can not and should not try to create or destroy
49 * icq's.
50 *
51 * As icq's are linked from both ioc and q, the locking rules are a bit
52 * complex.
53 *
54 * - ioc lock nests inside q lock.
55 *
56 * - ioc->icq_list and icq->ioc_node are protected by ioc lock.
57 * q->icq_list and icq->q_node by q lock.
58 *
59 * - ioc->icq_tree and ioc->icq_hint are protected by ioc lock, while icq
60 * itself is protected by q lock. However, both the indexes and icq
61 * itself are also RCU managed and lookup can be performed holding only
62 * the q lock.
63 *
64 * - icq's are not reference counted. They are destroyed when either the
65 * ioc or q goes away. Each request with icq set holds an extra
66 * reference to ioc to ensure it stays until the request is completed.
67 *
68 * - Linking and unlinking icq's are performed while holding both ioc and q
69 * locks. Due to the lock ordering, q exit is simple but ioc exit
70 * requires reverse-order double lock dance.
71 */
72struct io_cq {
73 struct request_queue *q;
74 struct io_context *ioc;
30 75
31 struct rcu_head rcu_head; 76 /*
77 * q_node and ioc_node link io_cq through icq_list of q and ioc
78 * respectively. Both fields are unused once ioc_exit_icq() is
79 * called and shared with __rcu_icq_cache and __rcu_head which are
80 * used for RCU free of io_cq.
81 */
82 union {
83 struct list_head q_node;
84 struct kmem_cache *__rcu_icq_cache;
85 };
86 union {
87 struct hlist_node ioc_node;
88 struct rcu_head __rcu_head;
89 };
90
91 unsigned long changed;
32}; 92};
33 93
34/* 94/*
@@ -43,11 +103,6 @@ struct io_context {
43 spinlock_t lock; 103 spinlock_t lock;
44 104
45 unsigned short ioprio; 105 unsigned short ioprio;
46 unsigned short ioprio_changed;
47
48#if defined(CONFIG_BLK_CGROUP) || defined(CONFIG_BLK_CGROUP_MODULE)
49 unsigned short cgroup_changed;
50#endif
51 106
52 /* 107 /*
53 * For request batching 108 * For request batching
@@ -55,9 +110,11 @@ struct io_context {
55 int nr_batch_requests; /* Number of requests left in the batch */ 110 int nr_batch_requests; /* Number of requests left in the batch */
56 unsigned long last_waited; /* Time last woken after wait for request */ 111 unsigned long last_waited; /* Time last woken after wait for request */
57 112
58 struct radix_tree_root radix_root; 113 struct radix_tree_root icq_tree;
59 struct hlist_head cic_list; 114 struct io_cq __rcu *icq_hint;
60 void __rcu *ioc_data; 115 struct hlist_head icq_list;
116
117 struct work_struct release_work;
61}; 118};
62 119
63static inline struct io_context *ioc_task_link(struct io_context *ioc) 120static inline struct io_context *ioc_task_link(struct io_context *ioc)
@@ -76,20 +133,17 @@ static inline struct io_context *ioc_task_link(struct io_context *ioc)
76 133
77struct task_struct; 134struct task_struct;
78#ifdef CONFIG_BLOCK 135#ifdef CONFIG_BLOCK
79int put_io_context(struct io_context *ioc); 136void put_io_context(struct io_context *ioc, struct request_queue *locked_q);
80void exit_io_context(struct task_struct *task); 137void exit_io_context(struct task_struct *task);
81struct io_context *get_io_context(gfp_t gfp_flags, int node); 138struct io_context *get_task_io_context(struct task_struct *task,
82struct io_context *alloc_io_context(gfp_t gfp_flags, int node); 139 gfp_t gfp_flags, int node);
140void ioc_ioprio_changed(struct io_context *ioc, int ioprio);
141void ioc_cgroup_changed(struct io_context *ioc);
83#else 142#else
84static inline void exit_io_context(struct task_struct *task)
85{
86}
87
88struct io_context; 143struct io_context;
89static inline int put_io_context(struct io_context *ioc) 144static inline void put_io_context(struct io_context *ioc,
90{ 145 struct request_queue *locked_q) { }
91 return 1; 146static inline void exit_io_context(struct task_struct *task) { }
92}
93#endif 147#endif
94 148
95#endif 149#endif
diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index 432acc4c054d..d937580417ba 100644
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@ -48,19 +48,34 @@ struct iommu_domain {
48 48
49#ifdef CONFIG_IOMMU_API 49#ifdef CONFIG_IOMMU_API
50 50
51/**
52 * struct iommu_ops - iommu ops and capabilities
53 * @domain_init: init iommu domain
54 * @domain_destroy: destroy iommu domain
55 * @attach_dev: attach device to an iommu domain
56 * @detach_dev: detach device from an iommu domain
57 * @map: map a physically contiguous memory region to an iommu domain
58 * @unmap: unmap a physically contiguous memory region from an iommu domain
59 * @iova_to_phys: translate iova to physical address
60 * @domain_has_cap: domain capabilities query
61 * @commit: commit iommu domain
62 * @pgsize_bitmap: bitmap of supported page sizes
63 */
51struct iommu_ops { 64struct iommu_ops {
52 int (*domain_init)(struct iommu_domain *domain); 65 int (*domain_init)(struct iommu_domain *domain);
53 void (*domain_destroy)(struct iommu_domain *domain); 66 void (*domain_destroy)(struct iommu_domain *domain);
54 int (*attach_dev)(struct iommu_domain *domain, struct device *dev); 67 int (*attach_dev)(struct iommu_domain *domain, struct device *dev);
55 void (*detach_dev)(struct iommu_domain *domain, struct device *dev); 68 void (*detach_dev)(struct iommu_domain *domain, struct device *dev);
56 int (*map)(struct iommu_domain *domain, unsigned long iova, 69 int (*map)(struct iommu_domain *domain, unsigned long iova,
57 phys_addr_t paddr, int gfp_order, int prot); 70 phys_addr_t paddr, size_t size, int prot);
58 int (*unmap)(struct iommu_domain *domain, unsigned long iova, 71 size_t (*unmap)(struct iommu_domain *domain, unsigned long iova,
59 int gfp_order); 72 size_t size);
60 phys_addr_t (*iova_to_phys)(struct iommu_domain *domain, 73 phys_addr_t (*iova_to_phys)(struct iommu_domain *domain,
61 unsigned long iova); 74 unsigned long iova);
62 int (*domain_has_cap)(struct iommu_domain *domain, 75 int (*domain_has_cap)(struct iommu_domain *domain,
63 unsigned long cap); 76 unsigned long cap);
77 int (*device_group)(struct device *dev, unsigned int *groupid);
78 unsigned long pgsize_bitmap;
64}; 79};
65 80
66extern int bus_set_iommu(struct bus_type *bus, struct iommu_ops *ops); 81extern int bus_set_iommu(struct bus_type *bus, struct iommu_ops *ops);
@@ -72,15 +87,16 @@ extern int iommu_attach_device(struct iommu_domain *domain,
72extern void iommu_detach_device(struct iommu_domain *domain, 87extern void iommu_detach_device(struct iommu_domain *domain,
73 struct device *dev); 88 struct device *dev);
74extern int iommu_map(struct iommu_domain *domain, unsigned long iova, 89extern int iommu_map(struct iommu_domain *domain, unsigned long iova,
75 phys_addr_t paddr, int gfp_order, int prot); 90 phys_addr_t paddr, size_t size, int prot);
76extern int iommu_unmap(struct iommu_domain *domain, unsigned long iova, 91extern size_t iommu_unmap(struct iommu_domain *domain, unsigned long iova,
77 int gfp_order); 92 size_t size);
78extern phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain, 93extern phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain,
79 unsigned long iova); 94 unsigned long iova);
80extern int iommu_domain_has_cap(struct iommu_domain *domain, 95extern int iommu_domain_has_cap(struct iommu_domain *domain,
81 unsigned long cap); 96 unsigned long cap);
82extern void iommu_set_fault_handler(struct iommu_domain *domain, 97extern void iommu_set_fault_handler(struct iommu_domain *domain,
83 iommu_fault_handler_t handler); 98 iommu_fault_handler_t handler);
99extern int iommu_device_group(struct device *dev, unsigned int *groupid);
84 100
85/** 101/**
86 * report_iommu_fault() - report about an IOMMU fault to the IOMMU framework 102 * report_iommu_fault() - report about an IOMMU fault to the IOMMU framework
@@ -179,6 +195,11 @@ static inline void iommu_set_fault_handler(struct iommu_domain *domain,
179{ 195{
180} 196}
181 197
198static inline int iommu_device_group(struct device *dev, unsigned int *groupid)
199{
200 return -ENODEV;
201}
202
182#endif /* CONFIG_IOMMU_API */ 203#endif /* CONFIG_IOMMU_API */
183 204
184#endif /* __LINUX_IOMMU_H */ 205#endif /* __LINUX_IOMMU_H */
diff --git a/include/linux/isdn_divertif.h b/include/linux/isdn_divertif.h
index 07821ca5955f..a5a50f523807 100644
--- a/include/linux/isdn_divertif.h
+++ b/include/linux/isdn_divertif.h
@@ -10,6 +10,8 @@
10 * 10 *
11 */ 11 */
12 12
13#ifndef _LINUX_ISDN_DIVERTIF_H
14#define _LINUX_ISDN_DIVERTIF_H
13 15
14/***********************************************************/ 16/***********************************************************/
15/* magic value is also used to control version information */ 17/* magic value is also used to control version information */
@@ -45,3 +47,5 @@ typedef struct
45/*********************/ 47/*********************/
46extern int DIVERT_REG_NAME(isdn_divert_if *); 48extern int DIVERT_REG_NAME(isdn_divert_if *);
47#endif 49#endif
50
51#endif /* _LINUX_ISDN_DIVERTIF_H */
diff --git a/include/linux/jbd.h b/include/linux/jbd.h
index c7acdde3243d..d211732b9e99 100644
--- a/include/linux/jbd.h
+++ b/include/linux/jbd.h
@@ -497,7 +497,6 @@ struct transaction_s
497 * @j_format_version: Version of the superblock format 497 * @j_format_version: Version of the superblock format
498 * @j_state_lock: Protect the various scalars in the journal 498 * @j_state_lock: Protect the various scalars in the journal
499 * @j_barrier_count: Number of processes waiting to create a barrier lock 499 * @j_barrier_count: Number of processes waiting to create a barrier lock
500 * @j_barrier: The barrier lock itself
501 * @j_running_transaction: The current running transaction.. 500 * @j_running_transaction: The current running transaction..
502 * @j_committing_transaction: the transaction we are pushing to disk 501 * @j_committing_transaction: the transaction we are pushing to disk
503 * @j_checkpoint_transactions: a linked circular list of all transactions 502 * @j_checkpoint_transactions: a linked circular list of all transactions
@@ -580,9 +579,6 @@ struct journal_s
580 */ 579 */
581 int j_barrier_count; 580 int j_barrier_count;
582 581
583 /* The barrier lock itself */
584 struct mutex j_barrier;
585
586 /* 582 /*
587 * Transactions: The current running transaction... 583 * Transactions: The current running transaction...
588 * [j_state_lock] [caller holding open handle] 584 * [j_state_lock] [caller holding open handle]
@@ -913,6 +909,7 @@ extern int journal_set_revoke(journal_t *, unsigned int, tid_t);
913extern int journal_test_revoke(journal_t *, unsigned int, tid_t); 909extern int journal_test_revoke(journal_t *, unsigned int, tid_t);
914extern void journal_clear_revoke(journal_t *); 910extern void journal_clear_revoke(journal_t *);
915extern void journal_switch_revoke_table(journal_t *journal); 911extern void journal_switch_revoke_table(journal_t *journal);
912extern void journal_clear_buffer_revoked_flags(journal_t *journal);
916 913
917/* 914/*
918 * The log thread user interface: 915 * The log thread user interface:
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index 2092ea21e469..5557baefed60 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -1151,6 +1151,7 @@ extern int jbd2_journal_set_revoke(journal_t *, unsigned long long, tid_t);
1151extern int jbd2_journal_test_revoke(journal_t *, unsigned long long, tid_t); 1151extern int jbd2_journal_test_revoke(journal_t *, unsigned long long, tid_t);
1152extern void jbd2_journal_clear_revoke(journal_t *); 1152extern void jbd2_journal_clear_revoke(journal_t *);
1153extern void jbd2_journal_switch_revoke_table(journal_t *journal); 1153extern void jbd2_journal_switch_revoke_table(journal_t *journal);
1154extern void jbd2_clear_buffer_revoked_flags(journal_t *journal);
1154 1155
1155/* 1156/*
1156 * The log thread user interface: 1157 * The log thread user interface:
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index e8b1597b5cf2..e8343422240a 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -185,16 +185,17 @@ static inline void might_fault(void)
185 185
186extern struct atomic_notifier_head panic_notifier_list; 186extern struct atomic_notifier_head panic_notifier_list;
187extern long (*panic_blink)(int state); 187extern long (*panic_blink)(int state);
188NORET_TYPE void panic(const char * fmt, ...) 188__printf(1, 2)
189 __attribute__ ((NORET_AND format (printf, 1, 2))) __cold; 189void panic(const char *fmt, ...)
190 __noreturn __cold;
190extern void oops_enter(void); 191extern void oops_enter(void);
191extern void oops_exit(void); 192extern void oops_exit(void);
192void print_oops_end_marker(void); 193void print_oops_end_marker(void);
193extern int oops_may_print(void); 194extern int oops_may_print(void);
194NORET_TYPE void do_exit(long error_code) 195void do_exit(long error_code)
195 ATTRIB_NORET; 196 __noreturn;
196NORET_TYPE void complete_and_exit(struct completion *, long) 197void complete_and_exit(struct completion *, long)
197 ATTRIB_NORET; 198 __noreturn;
198 199
199/* Internal, do not use. */ 200/* Internal, do not use. */
200int __must_check _kstrtoul(const char *s, unsigned int base, unsigned long *res); 201int __must_check _kstrtoul(const char *s, unsigned int base, unsigned long *res);
@@ -341,6 +342,7 @@ extern int panic_timeout;
341extern int panic_on_oops; 342extern int panic_on_oops;
342extern int panic_on_unrecovered_nmi; 343extern int panic_on_unrecovered_nmi;
343extern int panic_on_io_nmi; 344extern int panic_on_io_nmi;
345extern int sysctl_panic_on_stackoverflow;
344extern const char *print_tainted(void); 346extern const char *print_tainted(void);
345extern void add_taint(unsigned flag); 347extern void add_taint(unsigned flag);
346extern int test_taint(unsigned flag); 348extern int test_taint(unsigned flag);
@@ -665,6 +667,7 @@ static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { }
665#define BUILD_BUG_ON_ZERO(e) (0) 667#define BUILD_BUG_ON_ZERO(e) (0)
666#define BUILD_BUG_ON_NULL(e) ((void*)0) 668#define BUILD_BUG_ON_NULL(e) ((void*)0)
667#define BUILD_BUG_ON(condition) 669#define BUILD_BUG_ON(condition)
670#define BUILD_BUG() (0)
668#else /* __CHECKER__ */ 671#else /* __CHECKER__ */
669 672
670/* Force a compilation error if a constant expression is not a power of 2 */ 673/* Force a compilation error if a constant expression is not a power of 2 */
@@ -703,6 +706,21 @@ extern int __build_bug_on_failed;
703 if (condition) __build_bug_on_failed = 1; \ 706 if (condition) __build_bug_on_failed = 1; \
704 } while(0) 707 } while(0)
705#endif 708#endif
709
710/**
711 * BUILD_BUG - break compile if used.
712 *
713 * If you have some code that you expect the compiler to eliminate at
714 * build time, you should use BUILD_BUG to detect if it is
715 * unexpectedly used.
716 */
717#define BUILD_BUG() \
718 do { \
719 extern void __build_bug_failed(void) \
720 __linktime_error("BUILD_BUG failed"); \
721 __build_bug_failed(); \
722 } while (0)
723
706#endif /* __CHECKER__ */ 724#endif /* __CHECKER__ */
707 725
708/* Trap pasters of __FUNCTION__ at compile-time */ 726/* Trap pasters of __FUNCTION__ at compile-time */
diff --git a/include/linux/kexec.h b/include/linux/kexec.h
index 2fa0901219d4..0d7d6a1b172f 100644
--- a/include/linux/kexec.h
+++ b/include/linux/kexec.h
@@ -50,9 +50,11 @@
50 * note header. For kdump, the code in vmcore.c runs in the context 50 * note header. For kdump, the code in vmcore.c runs in the context
51 * of the second kernel to combine them into one note. 51 * of the second kernel to combine them into one note.
52 */ 52 */
53#ifndef KEXEC_NOTE_BYTES
53#define KEXEC_NOTE_BYTES ( (KEXEC_NOTE_HEAD_BYTES * 2) + \ 54#define KEXEC_NOTE_BYTES ( (KEXEC_NOTE_HEAD_BYTES * 2) + \
54 KEXEC_CORE_NOTE_NAME_BYTES + \ 55 KEXEC_CORE_NOTE_NAME_BYTES + \
55 KEXEC_CORE_NOTE_DESC_BYTES ) 56 KEXEC_CORE_NOTE_DESC_BYTES )
57#endif
56 58
57/* 59/*
58 * This structure is used to hold the arguments that are used when loading 60 * This structure is used to hold the arguments that are used when loading
diff --git a/include/linux/key-type.h b/include/linux/key-type.h
index 9efd081bb31e..39e3c082c49d 100644
--- a/include/linux/key-type.h
+++ b/include/linux/key-type.h
@@ -92,6 +92,7 @@ struct key_type {
92 92
93 /* internal fields */ 93 /* internal fields */
94 struct list_head link; /* link in types list */ 94 struct list_head link; /* link in types list */
95 struct lock_class_key lock_class; /* key->sem lock class */
95}; 96};
96 97
97extern struct key_type key_type_keyring; 98extern struct key_type key_type_keyring;
diff --git a/include/linux/key.h b/include/linux/key.h
index 183a6af7715d..5253471cd2ea 100644
--- a/include/linux/key.h
+++ b/include/linux/key.h
@@ -271,7 +271,7 @@ extern int keyring_add_key(struct key *keyring,
271 271
272extern struct key *key_lookup(key_serial_t id); 272extern struct key *key_lookup(key_serial_t id);
273 273
274static inline key_serial_t key_serial(struct key *key) 274static inline key_serial_t key_serial(const struct key *key)
275{ 275{
276 return key ? key->serial : 0; 276 return key ? key->serial : 0;
277} 277}
@@ -293,6 +293,9 @@ static inline bool key_is_instantiated(const struct key *key)
293 (rcu_dereference_protected((KEY)->payload.rcudata, \ 293 (rcu_dereference_protected((KEY)->payload.rcudata, \
294 rwsem_is_locked(&((struct key *)(KEY))->sem))) 294 rwsem_is_locked(&((struct key *)(KEY))->sem)))
295 295
296#define rcu_assign_keypointer(KEY, PAYLOAD) \
297 (rcu_assign_pointer((KEY)->payload.rcudata, PAYLOAD))
298
296#ifdef CONFIG_SYSCTL 299#ifdef CONFIG_SYSCTL
297extern ctl_table key_sysctls[]; 300extern ctl_table key_sysctls[];
298#endif 301#endif
diff --git a/include/linux/kmemleak.h b/include/linux/kmemleak.h
index 99d9a6766f7e..2a5e5548a1d2 100644
--- a/include/linux/kmemleak.h
+++ b/include/linux/kmemleak.h
@@ -26,8 +26,10 @@
26extern void kmemleak_init(void) __ref; 26extern void kmemleak_init(void) __ref;
27extern void kmemleak_alloc(const void *ptr, size_t size, int min_count, 27extern void kmemleak_alloc(const void *ptr, size_t size, int min_count,
28 gfp_t gfp) __ref; 28 gfp_t gfp) __ref;
29extern void kmemleak_alloc_percpu(const void __percpu *ptr, size_t size) __ref;
29extern void kmemleak_free(const void *ptr) __ref; 30extern void kmemleak_free(const void *ptr) __ref;
30extern void kmemleak_free_part(const void *ptr, size_t size) __ref; 31extern void kmemleak_free_part(const void *ptr, size_t size) __ref;
32extern void kmemleak_free_percpu(const void __percpu *ptr) __ref;
31extern void kmemleak_padding(const void *ptr, unsigned long offset, 33extern void kmemleak_padding(const void *ptr, unsigned long offset,
32 size_t size) __ref; 34 size_t size) __ref;
33extern void kmemleak_not_leak(const void *ptr) __ref; 35extern void kmemleak_not_leak(const void *ptr) __ref;
@@ -68,6 +70,9 @@ static inline void kmemleak_alloc_recursive(const void *ptr, size_t size,
68 gfp_t gfp) 70 gfp_t gfp)
69{ 71{
70} 72}
73static inline void kmemleak_alloc_percpu(const void __percpu *ptr, size_t size)
74{
75}
71static inline void kmemleak_free(const void *ptr) 76static inline void kmemleak_free(const void *ptr)
72{ 77{
73} 78}
@@ -77,6 +82,9 @@ static inline void kmemleak_free_part(const void *ptr, size_t size)
77static inline void kmemleak_free_recursive(const void *ptr, unsigned long flags) 82static inline void kmemleak_free_recursive(const void *ptr, unsigned long flags)
78{ 83{
79} 84}
85static inline void kmemleak_free_percpu(const void __percpu *ptr)
86{
87}
80static inline void kmemleak_not_leak(const void *ptr) 88static inline void kmemleak_not_leak(const void *ptr)
81{ 89{
82} 90}
diff --git a/include/linux/kmsg_dump.h b/include/linux/kmsg_dump.h
index ee0c952188de..fee66317e071 100644
--- a/include/linux/kmsg_dump.h
+++ b/include/linux/kmsg_dump.h
@@ -18,7 +18,6 @@
18enum kmsg_dump_reason { 18enum kmsg_dump_reason {
19 KMSG_DUMP_OOPS, 19 KMSG_DUMP_OOPS,
20 KMSG_DUMP_PANIC, 20 KMSG_DUMP_PANIC,
21 KMSG_DUMP_KEXEC,
22 KMSG_DUMP_RESTART, 21 KMSG_DUMP_RESTART,
23 KMSG_DUMP_HALT, 22 KMSG_DUMP_HALT,
24 KMSG_DUMP_POWEROFF, 23 KMSG_DUMP_POWEROFF,
diff --git a/include/linux/kref.h b/include/linux/kref.h
index abc0120b09b7..9c07dcebded7 100644
--- a/include/linux/kref.h
+++ b/include/linux/kref.h
@@ -17,6 +17,7 @@
17 17
18#include <linux/bug.h> 18#include <linux/bug.h>
19#include <linux/atomic.h> 19#include <linux/atomic.h>
20#include <linux/kernel.h>
20 21
21struct kref { 22struct kref {
22 atomic_t refcount; 23 atomic_t refcount;
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index d52623199978..900c76337e8f 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -14,6 +14,7 @@
14#include <linux/signal.h> 14#include <linux/signal.h>
15#include <linux/sched.h> 15#include <linux/sched.h>
16#include <linux/mm.h> 16#include <linux/mm.h>
17#include <linux/mmu_notifier.h>
17#include <linux/preempt.h> 18#include <linux/preempt.h>
18#include <linux/msi.h> 19#include <linux/msi.h>
19#include <linux/slab.h> 20#include <linux/slab.h>
@@ -50,6 +51,9 @@
50#define KVM_REQ_APF_HALT 12 51#define KVM_REQ_APF_HALT 12
51#define KVM_REQ_STEAL_UPDATE 13 52#define KVM_REQ_STEAL_UPDATE 13
52#define KVM_REQ_NMI 14 53#define KVM_REQ_NMI 14
54#define KVM_REQ_IMMEDIATE_EXIT 15
55#define KVM_REQ_PMU 16
56#define KVM_REQ_PMI 17
53 57
54#define KVM_USERSPACE_IRQ_SOURCE_ID 0 58#define KVM_USERSPACE_IRQ_SOURCE_ID 0
55 59
@@ -179,6 +183,7 @@ struct kvm_memory_slot {
179 unsigned long *rmap; 183 unsigned long *rmap;
180 unsigned long *dirty_bitmap; 184 unsigned long *dirty_bitmap;
181 unsigned long *dirty_bitmap_head; 185 unsigned long *dirty_bitmap_head;
186 unsigned long nr_dirty_pages;
182 struct kvm_lpage_info *lpage_info[KVM_NR_PAGE_SIZES - 1]; 187 struct kvm_lpage_info *lpage_info[KVM_NR_PAGE_SIZES - 1];
183 unsigned long userspace_addr; 188 unsigned long userspace_addr;
184 int user_alloc; 189 int user_alloc;
@@ -224,11 +229,20 @@ struct kvm_irq_routing_table {};
224 229
225#endif 230#endif
226 231
232#ifndef KVM_MEM_SLOTS_NUM
233#define KVM_MEM_SLOTS_NUM (KVM_MEMORY_SLOTS + KVM_PRIVATE_MEM_SLOTS)
234#endif
235
236/*
237 * Note:
238 * memslots are not sorted by id anymore, please use id_to_memslot()
239 * to get the memslot by its id.
240 */
227struct kvm_memslots { 241struct kvm_memslots {
228 int nmemslots;
229 u64 generation; 242 u64 generation;
230 struct kvm_memory_slot memslots[KVM_MEMORY_SLOTS + 243 struct kvm_memory_slot memslots[KVM_MEM_SLOTS_NUM];
231 KVM_PRIVATE_MEM_SLOTS]; 244 /* The mapping table from slot id to the index in memslots[]. */
245 int id_to_index[KVM_MEM_SLOTS_NUM];
232}; 246};
233 247
234struct kvm { 248struct kvm {
@@ -239,7 +253,6 @@ struct kvm {
239 struct srcu_struct srcu; 253 struct srcu_struct srcu;
240#ifdef CONFIG_KVM_APIC_ARCHITECTURE 254#ifdef CONFIG_KVM_APIC_ARCHITECTURE
241 u32 bsp_vcpu_id; 255 u32 bsp_vcpu_id;
242 struct kvm_vcpu *bsp_vcpu;
243#endif 256#endif
244 struct kvm_vcpu *vcpus[KVM_MAX_VCPUS]; 257 struct kvm_vcpu *vcpus[KVM_MAX_VCPUS];
245 atomic_t online_vcpus; 258 atomic_t online_vcpus;
@@ -302,6 +315,11 @@ static inline struct kvm_vcpu *kvm_get_vcpu(struct kvm *kvm, int i)
302 (vcpup = kvm_get_vcpu(kvm, idx)) != NULL; \ 315 (vcpup = kvm_get_vcpu(kvm, idx)) != NULL; \
303 idx++) 316 idx++)
304 317
318#define kvm_for_each_memslot(memslot, slots) \
319 for (memslot = &slots->memslots[0]; \
320 memslot < slots->memslots + KVM_MEM_SLOTS_NUM && memslot->npages;\
321 memslot++)
322
305int kvm_vcpu_init(struct kvm_vcpu *vcpu, struct kvm *kvm, unsigned id); 323int kvm_vcpu_init(struct kvm_vcpu *vcpu, struct kvm *kvm, unsigned id);
306void kvm_vcpu_uninit(struct kvm_vcpu *vcpu); 324void kvm_vcpu_uninit(struct kvm_vcpu *vcpu);
307 325
@@ -314,6 +332,7 @@ void kvm_exit(void);
314 332
315void kvm_get_kvm(struct kvm *kvm); 333void kvm_get_kvm(struct kvm *kvm);
316void kvm_put_kvm(struct kvm *kvm); 334void kvm_put_kvm(struct kvm *kvm);
335void update_memslots(struct kvm_memslots *slots, struct kvm_memory_slot *new);
317 336
318static inline struct kvm_memslots *kvm_memslots(struct kvm *kvm) 337static inline struct kvm_memslots *kvm_memslots(struct kvm *kvm)
319{ 338{
@@ -322,6 +341,18 @@ static inline struct kvm_memslots *kvm_memslots(struct kvm *kvm)
322 || lockdep_is_held(&kvm->slots_lock)); 341 || lockdep_is_held(&kvm->slots_lock));
323} 342}
324 343
344static inline struct kvm_memory_slot *
345id_to_memslot(struct kvm_memslots *slots, int id)
346{
347 int index = slots->id_to_index[id];
348 struct kvm_memory_slot *slot;
349
350 slot = &slots->memslots[index];
351
352 WARN_ON(slot->id != id);
353 return slot;
354}
355
325#define HPA_MSB ((sizeof(hpa_t) * 8) - 1) 356#define HPA_MSB ((sizeof(hpa_t) * 8) - 1)
326#define HPA_ERR_MASK ((hpa_t)1 << HPA_MSB) 357#define HPA_ERR_MASK ((hpa_t)1 << HPA_MSB)
327static inline int is_error_hpa(hpa_t hpa) { return hpa >> HPA_MSB; } 358static inline int is_error_hpa(hpa_t hpa) { return hpa >> HPA_MSB; }
diff --git a/include/linux/kvm_para.h b/include/linux/kvm_para.h
index 47a070b0520e..ff476ddaf310 100644
--- a/include/linux/kvm_para.h
+++ b/include/linux/kvm_para.h
@@ -35,4 +35,3 @@ static inline int kvm_para_has_feature(unsigned int feature)
35} 35}
36#endif /* __KERNEL__ */ 36#endif /* __KERNEL__ */
37#endif /* __LINUX_KVM_PARA_H */ 37#endif /* __LINUX_KVM_PARA_H */
38
diff --git a/include/linux/leds-tca6507.h b/include/linux/leds-tca6507.h
new file mode 100644
index 000000000000..dcabf4fa2aef
--- /dev/null
+++ b/include/linux/leds-tca6507.h
@@ -0,0 +1,34 @@
1/*
2 * TCA6507 LED chip driver.
3 *
4 * Copyright (C) 2011 Neil Brown <neil@brown.name>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * version 2 as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18 * 02110-1301 USA
19 */
20
21#ifndef __LINUX_TCA6507_H
22#define __LINUX_TCA6507_H
23#include <linux/leds.h>
24
25struct tca6507_platform_data {
26 struct led_platform_data leds;
27#ifdef CONFIG_GPIOLIB
28 int gpio_base;
29 void (*setup)(unsigned gpio_base, unsigned ngpio);
30#endif
31};
32
33#define TCA6507_MAKE_GPIO 1
34#endif /* __LINUX_TCA6507_H*/
diff --git a/include/linux/linkage.h b/include/linux/linkage.h
index 3f46aedea42f..807f1e533226 100644
--- a/include/linux/linkage.h
+++ b/include/linux/linkage.h
@@ -88,8 +88,4 @@
88 88
89#endif 89#endif
90 90
91#define NORET_TYPE /**/
92#define ATTRIB_NORET __attribute__((noreturn))
93#define NORET_AND noreturn,
94
95#endif 91#endif
diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h
index 90b0656a869e..88a114fce477 100644
--- a/include/linux/lockd/lockd.h
+++ b/include/linux/lockd/lockd.h
@@ -195,7 +195,7 @@ extern struct svc_procedure nlmsvc_procedures4[];
195#endif 195#endif
196extern int nlmsvc_grace_period; 196extern int nlmsvc_grace_period;
197extern unsigned long nlmsvc_timeout; 197extern unsigned long nlmsvc_timeout;
198extern int nsm_use_hostnames; 198extern bool nsm_use_hostnames;
199extern u32 nsm_local_state; 199extern u32 nsm_local_state;
200 200
201/* 201/*
diff --git a/include/linux/lp8727.h b/include/linux/lp8727.h
new file mode 100644
index 000000000000..d21fa2865bf4
--- /dev/null
+++ b/include/linux/lp8727.h
@@ -0,0 +1,51 @@
1/*
2 * Copyright (C) 2011 National Semiconductor
3 *
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
9#ifndef _LP8727_H
10#define _LP8727_H
11
12enum lp8727_eoc_level {
13 EOC_5P,
14 EOC_10P,
15 EOC_16P,
16 EOC_20P,
17 EOC_25P,
18 EOC_33P,
19 EOC_50P,
20};
21
22enum lp8727_ichg {
23 ICHG_90mA,
24 ICHG_100mA,
25 ICHG_400mA,
26 ICHG_450mA,
27 ICHG_500mA,
28 ICHG_600mA,
29 ICHG_700mA,
30 ICHG_800mA,
31 ICHG_900mA,
32 ICHG_1000mA,
33};
34
35struct lp8727_chg_param {
36 /* end of charge level setting */
37 enum lp8727_eoc_level eoc_level;
38 /* charging current */
39 enum lp8727_ichg ichg;
40};
41
42struct lp8727_platform_data {
43 u8 (*get_batt_present)(void);
44 u16 (*get_batt_level)(void);
45 u8 (*get_batt_capacity)(void);
46 u8 (*get_batt_temp)(void);
47 struct lp8727_chg_param ac;
48 struct lp8727_chg_param usb;
49};
50
51#endif
diff --git a/include/linux/mbus.h b/include/linux/mbus.h
index c11ff2932549..efa1a6d7aca8 100644
--- a/include/linux/mbus.h
+++ b/include/linux/mbus.h
@@ -32,5 +32,16 @@ struct mbus_dram_target_info
32 } cs[4]; 32 } cs[4];
33}; 33};
34 34
35 35/*
36 * The Marvell mbus is to be found only on SOCs from the Orion family
37 * at the moment. Provide a dummy stub for other architectures.
38 */
39#ifdef CONFIG_PLAT_ORION
40extern const struct mbus_dram_target_info *mv_mbus_dram_info(void);
41#else
42static inline const struct mbus_dram_target_info *mv_mbus_dram_info(void)
43{
44 return NULL;
45}
46#endif
36#endif 47#endif
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index 9b296ea41bb8..4d34356fe644 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -32,13 +32,11 @@ enum mem_cgroup_page_stat_item {
32 MEMCG_NR_FILE_MAPPED, /* # of pages charged as file rss */ 32 MEMCG_NR_FILE_MAPPED, /* # of pages charged as file rss */
33}; 33};
34 34
35extern unsigned long mem_cgroup_isolate_pages(unsigned long nr_to_scan, 35struct mem_cgroup_reclaim_cookie {
36 struct list_head *dst, 36 struct zone *zone;
37 unsigned long *scanned, int order, 37 int priority;
38 isolate_mode_t mode, 38 unsigned int generation;
39 struct zone *z, 39};
40 struct mem_cgroup *mem_cont,
41 int active, int file);
42 40
43#ifdef CONFIG_CGROUP_MEM_RES_CTLR 41#ifdef CONFIG_CGROUP_MEM_RES_CTLR
44/* 42/*
@@ -56,20 +54,21 @@ extern int mem_cgroup_newpage_charge(struct page *page, struct mm_struct *mm,
56 gfp_t gfp_mask); 54 gfp_t gfp_mask);
57/* for swap handling */ 55/* for swap handling */
58extern int mem_cgroup_try_charge_swapin(struct mm_struct *mm, 56extern int mem_cgroup_try_charge_swapin(struct mm_struct *mm,
59 struct page *page, gfp_t mask, struct mem_cgroup **ptr); 57 struct page *page, gfp_t mask, struct mem_cgroup **memcgp);
60extern void mem_cgroup_commit_charge_swapin(struct page *page, 58extern void mem_cgroup_commit_charge_swapin(struct page *page,
61 struct mem_cgroup *ptr); 59 struct mem_cgroup *memcg);
62extern void mem_cgroup_cancel_charge_swapin(struct mem_cgroup *ptr); 60extern void mem_cgroup_cancel_charge_swapin(struct mem_cgroup *memcg);
63 61
64extern int mem_cgroup_cache_charge(struct page *page, struct mm_struct *mm, 62extern int mem_cgroup_cache_charge(struct page *page, struct mm_struct *mm,
65 gfp_t gfp_mask); 63 gfp_t gfp_mask);
66extern void mem_cgroup_add_lru_list(struct page *page, enum lru_list lru); 64
67extern void mem_cgroup_del_lru_list(struct page *page, enum lru_list lru); 65struct lruvec *mem_cgroup_zone_lruvec(struct zone *, struct mem_cgroup *);
68extern void mem_cgroup_rotate_reclaimable_page(struct page *page); 66struct lruvec *mem_cgroup_lru_add_list(struct zone *, struct page *,
69extern void mem_cgroup_rotate_lru_list(struct page *page, enum lru_list lru); 67 enum lru_list);
70extern void mem_cgroup_del_lru(struct page *page); 68void mem_cgroup_lru_del_list(struct page *, enum lru_list);
71extern void mem_cgroup_move_lists(struct page *page, 69void mem_cgroup_lru_del(struct page *);
72 enum lru_list from, enum lru_list to); 70struct lruvec *mem_cgroup_lru_move_lists(struct zone *, struct page *,
71 enum lru_list, enum lru_list);
73 72
74/* For coalescing uncharge for reducing memcg' overhead*/ 73/* For coalescing uncharge for reducing memcg' overhead*/
75extern void mem_cgroup_uncharge_start(void); 74extern void mem_cgroup_uncharge_start(void);
@@ -102,10 +101,15 @@ extern struct cgroup_subsys_state *mem_cgroup_css(struct mem_cgroup *memcg);
102 101
103extern int 102extern int
104mem_cgroup_prepare_migration(struct page *page, 103mem_cgroup_prepare_migration(struct page *page,
105 struct page *newpage, struct mem_cgroup **ptr, gfp_t gfp_mask); 104 struct page *newpage, struct mem_cgroup **memcgp, gfp_t gfp_mask);
106extern void mem_cgroup_end_migration(struct mem_cgroup *memcg, 105extern void mem_cgroup_end_migration(struct mem_cgroup *memcg,
107 struct page *oldpage, struct page *newpage, bool migration_ok); 106 struct page *oldpage, struct page *newpage, bool migration_ok);
108 107
108struct mem_cgroup *mem_cgroup_iter(struct mem_cgroup *,
109 struct mem_cgroup *,
110 struct mem_cgroup_reclaim_cookie *);
111void mem_cgroup_iter_break(struct mem_cgroup *, struct mem_cgroup *);
112
109/* 113/*
110 * For memory reclaim. 114 * For memory reclaim.
111 */ 115 */
@@ -122,7 +126,10 @@ struct zone_reclaim_stat*
122mem_cgroup_get_reclaim_stat_from_page(struct page *page); 126mem_cgroup_get_reclaim_stat_from_page(struct page *page);
123extern void mem_cgroup_print_oom_info(struct mem_cgroup *memcg, 127extern void mem_cgroup_print_oom_info(struct mem_cgroup *memcg,
124 struct task_struct *p); 128 struct task_struct *p);
129extern void mem_cgroup_replace_page_cache(struct page *oldpage,
130 struct page *newpage);
125 131
132extern void mem_cgroup_reset_owner(struct page *page);
126#ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP 133#ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP
127extern int do_swap_account; 134extern int do_swap_account;
128#endif 135#endif
@@ -157,7 +164,7 @@ u64 mem_cgroup_get_limit(struct mem_cgroup *memcg);
157 164
158void mem_cgroup_count_vm_event(struct mm_struct *mm, enum vm_event_item idx); 165void mem_cgroup_count_vm_event(struct mm_struct *mm, enum vm_event_item idx);
159#ifdef CONFIG_TRANSPARENT_HUGEPAGE 166#ifdef CONFIG_TRANSPARENT_HUGEPAGE
160void mem_cgroup_split_huge_fixup(struct page *head, struct page *tail); 167void mem_cgroup_split_huge_fixup(struct page *head);
161#endif 168#endif
162 169
163#ifdef CONFIG_DEBUG_VM 170#ifdef CONFIG_DEBUG_VM
@@ -180,17 +187,17 @@ static inline int mem_cgroup_cache_charge(struct page *page,
180} 187}
181 188
182static inline int mem_cgroup_try_charge_swapin(struct mm_struct *mm, 189static inline int mem_cgroup_try_charge_swapin(struct mm_struct *mm,
183 struct page *page, gfp_t gfp_mask, struct mem_cgroup **ptr) 190 struct page *page, gfp_t gfp_mask, struct mem_cgroup **memcgp)
184{ 191{
185 return 0; 192 return 0;
186} 193}
187 194
188static inline void mem_cgroup_commit_charge_swapin(struct page *page, 195static inline void mem_cgroup_commit_charge_swapin(struct page *page,
189 struct mem_cgroup *ptr) 196 struct mem_cgroup *memcg)
190{ 197{
191} 198}
192 199
193static inline void mem_cgroup_cancel_charge_swapin(struct mem_cgroup *ptr) 200static inline void mem_cgroup_cancel_charge_swapin(struct mem_cgroup *memcg)
194{ 201{
195} 202}
196 203
@@ -210,33 +217,33 @@ static inline void mem_cgroup_uncharge_cache_page(struct page *page)
210{ 217{
211} 218}
212 219
213static inline void mem_cgroup_add_lru_list(struct page *page, int lru) 220static inline struct lruvec *mem_cgroup_zone_lruvec(struct zone *zone,
214{ 221 struct mem_cgroup *memcg)
215}
216
217static inline void mem_cgroup_del_lru_list(struct page *page, int lru)
218{ 222{
219 return ; 223 return &zone->lruvec;
220} 224}
221 225
222static inline void mem_cgroup_rotate_reclaimable_page(struct page *page) 226static inline struct lruvec *mem_cgroup_lru_add_list(struct zone *zone,
227 struct page *page,
228 enum lru_list lru)
223{ 229{
224 return ; 230 return &zone->lruvec;
225} 231}
226 232
227static inline void mem_cgroup_rotate_lru_list(struct page *page, int lru) 233static inline void mem_cgroup_lru_del_list(struct page *page, enum lru_list lru)
228{ 234{
229 return ;
230} 235}
231 236
232static inline void mem_cgroup_del_lru(struct page *page) 237static inline void mem_cgroup_lru_del(struct page *page)
233{ 238{
234 return ;
235} 239}
236 240
237static inline void 241static inline struct lruvec *mem_cgroup_lru_move_lists(struct zone *zone,
238mem_cgroup_move_lists(struct page *page, enum lru_list from, enum lru_list to) 242 struct page *page,
243 enum lru_list from,
244 enum lru_list to)
239{ 245{
246 return &zone->lruvec;
240} 247}
241 248
242static inline struct mem_cgroup *try_get_mem_cgroup_from_page(struct page *page) 249static inline struct mem_cgroup *try_get_mem_cgroup_from_page(struct page *page)
@@ -269,7 +276,7 @@ static inline struct cgroup_subsys_state
269 276
270static inline int 277static inline int
271mem_cgroup_prepare_migration(struct page *page, struct page *newpage, 278mem_cgroup_prepare_migration(struct page *page, struct page *newpage,
272 struct mem_cgroup **ptr, gfp_t gfp_mask) 279 struct mem_cgroup **memcgp, gfp_t gfp_mask)
273{ 280{
274 return 0; 281 return 0;
275} 282}
@@ -279,6 +286,19 @@ static inline void mem_cgroup_end_migration(struct mem_cgroup *memcg,
279{ 286{
280} 287}
281 288
289static inline struct mem_cgroup *
290mem_cgroup_iter(struct mem_cgroup *root,
291 struct mem_cgroup *prev,
292 struct mem_cgroup_reclaim_cookie *reclaim)
293{
294 return NULL;
295}
296
297static inline void mem_cgroup_iter_break(struct mem_cgroup *root,
298 struct mem_cgroup *prev)
299{
300}
301
282static inline int mem_cgroup_get_reclaim_priority(struct mem_cgroup *memcg) 302static inline int mem_cgroup_get_reclaim_priority(struct mem_cgroup *memcg)
283{ 303{
284 return 0; 304 return 0;
@@ -360,8 +380,7 @@ u64 mem_cgroup_get_limit(struct mem_cgroup *memcg)
360 return 0; 380 return 0;
361} 381}
362 382
363static inline void mem_cgroup_split_huge_fixup(struct page *head, 383static inline void mem_cgroup_split_huge_fixup(struct page *head)
364 struct page *tail)
365{ 384{
366} 385}
367 386
@@ -369,6 +388,14 @@ static inline
369void mem_cgroup_count_vm_event(struct mm_struct *mm, enum vm_event_item idx) 388void mem_cgroup_count_vm_event(struct mm_struct *mm, enum vm_event_item idx)
370{ 389{
371} 390}
391static inline void mem_cgroup_replace_page_cache(struct page *oldpage,
392 struct page *newpage)
393{
394}
395
396static inline void mem_cgroup_reset_owner(struct page *page)
397{
398}
372#endif /* CONFIG_CGROUP_MEM_CONT */ 399#endif /* CONFIG_CGROUP_MEM_CONT */
373 400
374#if !defined(CONFIG_CGROUP_MEM_RES_CTLR) || !defined(CONFIG_DEBUG_VM) 401#if !defined(CONFIG_CGROUP_MEM_RES_CTLR) || !defined(CONFIG_DEBUG_VM)
@@ -390,7 +417,6 @@ enum {
390 OVER_LIMIT, 417 OVER_LIMIT,
391}; 418};
392 419
393#ifdef CONFIG_INET
394struct sock; 420struct sock;
395#ifdef CONFIG_CGROUP_MEM_RES_CTLR_KMEM 421#ifdef CONFIG_CGROUP_MEM_RES_CTLR_KMEM
396void sock_update_memcg(struct sock *sk); 422void sock_update_memcg(struct sock *sk);
@@ -403,6 +429,5 @@ static inline void sock_release_memcg(struct sock *sk)
403{ 429{
404} 430}
405#endif /* CONFIG_CGROUP_MEM_RES_CTLR_KMEM */ 431#endif /* CONFIG_CGROUP_MEM_RES_CTLR_KMEM */
406#endif /* CONFIG_INET */
407#endif /* _LINUX_MEMCONTROL_H */ 432#endif /* _LINUX_MEMCONTROL_H */
408 433
diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h
index 7978eec1b7d9..7c727a90d70d 100644
--- a/include/linux/mempolicy.h
+++ b/include/linux/mempolicy.h
@@ -164,11 +164,11 @@ static inline void mpol_get(struct mempolicy *pol)
164 atomic_inc(&pol->refcnt); 164 atomic_inc(&pol->refcnt);
165} 165}
166 166
167extern int __mpol_equal(struct mempolicy *a, struct mempolicy *b); 167extern bool __mpol_equal(struct mempolicy *a, struct mempolicy *b);
168static inline int mpol_equal(struct mempolicy *a, struct mempolicy *b) 168static inline bool mpol_equal(struct mempolicy *a, struct mempolicy *b)
169{ 169{
170 if (a == b) 170 if (a == b)
171 return 1; 171 return true;
172 return __mpol_equal(a, b); 172 return __mpol_equal(a, b);
173} 173}
174 174
@@ -257,9 +257,9 @@ static inline int vma_migratable(struct vm_area_struct *vma)
257 257
258struct mempolicy {}; 258struct mempolicy {};
259 259
260static inline int mpol_equal(struct mempolicy *a, struct mempolicy *b) 260static inline bool mpol_equal(struct mempolicy *a, struct mempolicy *b)
261{ 261{
262 return 1; 262 return true;
263} 263}
264 264
265static inline void mpol_put(struct mempolicy *p) 265static inline void mpol_put(struct mempolicy *p)
diff --git a/include/linux/mfd/88pm860x.h b/include/linux/mfd/88pm860x.h
index 63b4fb8e3b6f..92be3476c9f5 100644
--- a/include/linux/mfd/88pm860x.h
+++ b/include/linux/mfd/88pm860x.h
@@ -297,10 +297,11 @@ enum {
297 297
298struct pm860x_chip { 298struct pm860x_chip {
299 struct device *dev; 299 struct device *dev;
300 struct mutex io_lock;
301 struct mutex irq_lock; 300 struct mutex irq_lock;
302 struct i2c_client *client; 301 struct i2c_client *client;
303 struct i2c_client *companion; /* companion chip client */ 302 struct i2c_client *companion; /* companion chip client */
303 struct regmap *regmap;
304 struct regmap *regmap_companion;
304 305
305 int buck3_double; /* DVC ramp slope double */ 306 int buck3_double; /* DVC ramp slope double */
306 unsigned short companion_addr; 307 unsigned short companion_addr;
diff --git a/include/linux/mfd/ab5500/ab5500.h b/include/linux/mfd/abx500/ab5500.h
index a720051ae933..a720051ae933 100644
--- a/include/linux/mfd/ab5500/ab5500.h
+++ b/include/linux/mfd/abx500/ab5500.h
diff --git a/include/linux/mfd/ab8500/gpadc.h b/include/linux/mfd/abx500/ab8500-gpadc.h
index 252966769d93..252966769d93 100644
--- a/include/linux/mfd/ab8500/gpadc.h
+++ b/include/linux/mfd/abx500/ab8500-gpadc.h
diff --git a/include/linux/mfd/ab8500/gpio.h b/include/linux/mfd/abx500/ab8500-gpio.h
index 488a8c920a29..488a8c920a29 100644
--- a/include/linux/mfd/ab8500/gpio.h
+++ b/include/linux/mfd/abx500/ab8500-gpio.h
diff --git a/include/linux/mfd/ab8500/sysctrl.h b/include/linux/mfd/abx500/ab8500-sysctrl.h
index 10da0291f8f8..10da0291f8f8 100644
--- a/include/linux/mfd/ab8500/sysctrl.h
+++ b/include/linux/mfd/abx500/ab8500-sysctrl.h
diff --git a/include/linux/mfd/ab8500.h b/include/linux/mfd/abx500/ab8500.h
index 838c6b487cc5..838c6b487cc5 100644
--- a/include/linux/mfd/ab8500.h
+++ b/include/linux/mfd/abx500/ab8500.h
diff --git a/include/linux/mfd/da9052/da9052.h b/include/linux/mfd/da9052/da9052.h
new file mode 100644
index 000000000000..5702d1be13b4
--- /dev/null
+++ b/include/linux/mfd/da9052/da9052.h
@@ -0,0 +1,131 @@
1/*
2 * da9052 declarations for DA9052 PMICs.
3 *
4 * Copyright(c) 2011 Dialog Semiconductor Ltd.
5 *
6 * Author: David Dajun Chen <dchen@diasemi.com>
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 as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 *
22 */
23
24#ifndef __MFD_DA9052_DA9052_H
25#define __MFD_DA9052_DA9052_H
26
27#include <linux/interrupt.h>
28#include <linux/regmap.h>
29#include <linux/slab.h>
30#include <linux/completion.h>
31#include <linux/list.h>
32#include <linux/mfd/core.h>
33
34#include <linux/mfd/da9052/reg.h>
35
36#define DA9052_IRQ_DCIN 0
37#define DA9052_IRQ_VBUS 1
38#define DA9052_IRQ_DCINREM 2
39#define DA9052_IRQ_VBUSREM 3
40#define DA9052_IRQ_VDDLOW 4
41#define DA9052_IRQ_ALARM 5
42#define DA9052_IRQ_SEQRDY 6
43#define DA9052_IRQ_COMP1V2 7
44#define DA9052_IRQ_NONKEY 8
45#define DA9052_IRQ_IDFLOAT 9
46#define DA9052_IRQ_IDGND 10
47#define DA9052_IRQ_CHGEND 11
48#define DA9052_IRQ_TBAT 12
49#define DA9052_IRQ_ADC_EOM 13
50#define DA9052_IRQ_PENDOWN 14
51#define DA9052_IRQ_TSIREADY 15
52#define DA9052_IRQ_GPI0 16
53#define DA9052_IRQ_GPI1 17
54#define DA9052_IRQ_GPI2 18
55#define DA9052_IRQ_GPI3 19
56#define DA9052_IRQ_GPI4 20
57#define DA9052_IRQ_GPI5 21
58#define DA9052_IRQ_GPI6 22
59#define DA9052_IRQ_GPI7 23
60#define DA9052_IRQ_GPI8 24
61#define DA9052_IRQ_GPI9 25
62#define DA9052_IRQ_GPI10 26
63#define DA9052_IRQ_GPI11 27
64#define DA9052_IRQ_GPI12 28
65#define DA9052_IRQ_GPI13 29
66#define DA9052_IRQ_GPI14 30
67#define DA9052_IRQ_GPI15 31
68
69enum da9052_chip_id {
70 DA9052,
71 DA9053_AA,
72 DA9053_BA,
73 DA9053_BB,
74};
75
76struct da9052_pdata;
77
78struct da9052 {
79 struct mutex io_lock;
80
81 struct device *dev;
82 struct regmap *regmap;
83
84 int irq_base;
85 u8 chip_id;
86
87 int chip_irq;
88};
89
90/* Device I/O API */
91static inline int da9052_reg_read(struct da9052 *da9052, unsigned char reg)
92{
93 int val, ret;
94
95 ret = regmap_read(da9052->regmap, reg, &val);
96 if (ret < 0)
97 return ret;
98 return val;
99}
100
101static inline int da9052_reg_write(struct da9052 *da9052, unsigned char reg,
102 unsigned char val)
103{
104 return regmap_write(da9052->regmap, reg, val);
105}
106
107static inline int da9052_group_read(struct da9052 *da9052, unsigned char reg,
108 unsigned reg_cnt, unsigned char *val)
109{
110 return regmap_bulk_read(da9052->regmap, reg, val, reg_cnt);
111}
112
113static inline int da9052_group_write(struct da9052 *da9052, unsigned char reg,
114 unsigned reg_cnt, unsigned char *val)
115{
116 return regmap_raw_write(da9052->regmap, reg, val, reg_cnt);
117}
118
119static inline int da9052_reg_update(struct da9052 *da9052, unsigned char reg,
120 unsigned char bit_mask,
121 unsigned char reg_val)
122{
123 return regmap_update_bits(da9052->regmap, reg, bit_mask, reg_val);
124}
125
126int da9052_device_init(struct da9052 *da9052, u8 chip_id);
127void da9052_device_exit(struct da9052 *da9052);
128
129extern struct regmap_config da9052_regmap_config;
130
131#endif /* __MFD_DA9052_DA9052_H */
diff --git a/include/linux/mfd/da9052/pdata.h b/include/linux/mfd/da9052/pdata.h
new file mode 100644
index 000000000000..62c5c3c2992e
--- /dev/null
+++ b/include/linux/mfd/da9052/pdata.h
@@ -0,0 +1,40 @@
1/*
2 * Platform data declarations for DA9052 PMICs.
3 *
4 * Copyright(c) 2011 Dialog Semiconductor Ltd.
5 *
6 * Author: David Dajun Chen <dchen@diasemi.com>
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 as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 *
22 */
23
24#ifndef __MFD_DA9052_PDATA_H__
25#define __MFD_DA9052_PDATA_H__
26
27#define DA9052_MAX_REGULATORS 14
28
29struct da9052;
30
31struct da9052_pdata {
32 struct led_platform_data *pled;
33 int (*init) (struct da9052 *da9052);
34 int irq_base;
35 int gpio_base;
36 int use_for_apm;
37 struct regulator_init_data *regulators[DA9052_MAX_REGULATORS];
38};
39
40#endif
diff --git a/include/linux/mfd/da9052/reg.h b/include/linux/mfd/da9052/reg.h
new file mode 100644
index 000000000000..b97f7309d7f6
--- /dev/null
+++ b/include/linux/mfd/da9052/reg.h
@@ -0,0 +1,749 @@
1/*
2 * Register declarations for DA9052 PMICs.
3 *
4 * Copyright(c) 2011 Dialog Semiconductor Ltd.
5 *
6 * Author: David Dajun Chen <dchen@diasemi.com>
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 as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 *
22 */
23
24#ifndef __LINUX_MFD_DA9052_REG_H
25#define __LINUX_MFD_DA9052_REG_H
26
27/* PAGE REGISTERS */
28#define DA9052_PAGE0_CON_REG 0
29#define DA9052_PAGE1_CON_REG 128
30
31/* STATUS REGISTERS */
32#define DA9052_STATUS_A_REG 1
33#define DA9052_STATUS_B_REG 2
34#define DA9052_STATUS_C_REG 3
35#define DA9052_STATUS_D_REG 4
36
37/* EVENT REGISTERS */
38#define DA9052_EVENT_A_REG 5
39#define DA9052_EVENT_B_REG 6
40#define DA9052_EVENT_C_REG 7
41#define DA9052_EVENT_D_REG 8
42#define DA9052_FAULTLOG_REG 9
43
44/* IRQ REGISTERS */
45#define DA9052_IRQ_MASK_A_REG 10
46#define DA9052_IRQ_MASK_B_REG 11
47#define DA9052_IRQ_MASK_C_REG 12
48#define DA9052_IRQ_MASK_D_REG 13
49
50/* CONTROL REGISTERS */
51#define DA9052_CONTROL_A_REG 14
52#define DA9052_CONTROL_B_REG 15
53#define DA9052_CONTROL_C_REG 16
54#define DA9052_CONTROL_D_REG 17
55
56#define DA9052_PDDIS_REG 18
57#define DA9052_INTERFACE_REG 19
58#define DA9052_RESET_REG 20
59
60/* GPIO REGISTERS */
61#define DA9052_GPIO_0_1_REG 21
62#define DA9052_GPIO_2_3_REG 22
63#define DA9052_GPIO_4_5_REG 23
64#define DA9052_GPIO_6_7_REG 24
65#define DA9052_GPIO_14_15_REG 28
66
67/* POWER SEQUENCER CONTROL REGISTERS */
68#define DA9052_ID_0_1_REG 29
69#define DA9052_ID_2_3_REG 30
70#define DA9052_ID_4_5_REG 31
71#define DA9052_ID_6_7_REG 32
72#define DA9052_ID_8_9_REG 33
73#define DA9052_ID_10_11_REG 34
74#define DA9052_ID_12_13_REG 35
75#define DA9052_ID_14_15_REG 36
76#define DA9052_ID_16_17_REG 37
77#define DA9052_ID_18_19_REG 38
78#define DA9052_ID_20_21_REG 39
79#define DA9052_SEQ_STATUS_REG 40
80#define DA9052_SEQ_A_REG 41
81#define DA9052_SEQ_B_REG 42
82#define DA9052_SEQ_TIMER_REG 43
83
84/* LDO AND BUCK REGISTERS */
85#define DA9052_BUCKA_REG 44
86#define DA9052_BUCKB_REG 45
87#define DA9052_BUCKCORE_REG 46
88#define DA9052_BUCKPRO_REG 47
89#define DA9052_BUCKMEM_REG 48
90#define DA9052_BUCKPERI_REG 49
91#define DA9052_LDO1_REG 50
92#define DA9052_LDO2_REG 51
93#define DA9052_LDO3_REG 52
94#define DA9052_LDO4_REG 53
95#define DA9052_LDO5_REG 54
96#define DA9052_LDO6_REG 55
97#define DA9052_LDO7_REG 56
98#define DA9052_LDO8_REG 57
99#define DA9052_LDO9_REG 58
100#define DA9052_LDO10_REG 59
101#define DA9052_SUPPLY_REG 60
102#define DA9052_PULLDOWN_REG 61
103#define DA9052_CHGBUCK_REG 62
104#define DA9052_WAITCONT_REG 63
105#define DA9052_ISET_REG 64
106#define DA9052_BATCHG_REG 65
107
108/* BATTERY CONTROL REGISTRS */
109#define DA9052_CHG_CONT_REG 66
110#define DA9052_INPUT_CONT_REG 67
111#define DA9052_CHG_TIME_REG 68
112#define DA9052_BBAT_CONT_REG 69
113
114/* LED CONTROL REGISTERS */
115#define DA9052_BOOST_REG 70
116#define DA9052_LED_CONT_REG 71
117#define DA9052_LEDMIN123_REG 72
118#define DA9052_LED1_CONF_REG 73
119#define DA9052_LED2_CONF_REG 74
120#define DA9052_LED3_CONF_REG 75
121#define DA9052_LED1CONT_REG 76
122#define DA9052_LED2CONT_REG 77
123#define DA9052_LED3CONT_REG 78
124#define DA9052_LED_CONT_4_REG 79
125#define DA9052_LED_CONT_5_REG 80
126
127/* ADC CONTROL REGISTERS */
128#define DA9052_ADC_MAN_REG 81
129#define DA9052_ADC_CONT_REG 82
130#define DA9052_ADC_RES_L_REG 83
131#define DA9052_ADC_RES_H_REG 84
132#define DA9052_VDD_RES_REG 85
133#define DA9052_VDD_MON_REG 86
134
135#define DA9052_ICHG_AV_REG 87
136#define DA9052_ICHG_THD_REG 88
137#define DA9052_ICHG_END_REG 89
138#define DA9052_TBAT_RES_REG 90
139#define DA9052_TBAT_HIGHP_REG 91
140#define DA9052_TBAT_HIGHN_REG 92
141#define DA9052_TBAT_LOW_REG 93
142#define DA9052_T_OFFSET_REG 94
143
144#define DA9052_ADCIN4_RES_REG 95
145#define DA9052_AUTO4_HIGH_REG 96
146#define DA9052_AUTO4_LOW_REG 97
147#define DA9052_ADCIN5_RES_REG 98
148#define DA9052_AUTO5_HIGH_REG 99
149#define DA9052_AUTO5_LOW_REG 100
150#define DA9052_ADCIN6_RES_REG 101
151#define DA9052_AUTO6_HIGH_REG 102
152#define DA9052_AUTO6_LOW_REG 103
153
154#define DA9052_TJUNC_RES_REG 104
155
156/* TSI CONTROL REGISTERS */
157#define DA9052_TSI_CONT_A_REG 105
158#define DA9052_TSI_CONT_B_REG 106
159#define DA9052_TSI_X_MSB_REG 107
160#define DA9052_TSI_Y_MSB_REG 108
161#define DA9052_TSI_LSB_REG 109
162#define DA9052_TSI_Z_MSB_REG 110
163
164/* RTC COUNT REGISTERS */
165#define DA9052_COUNT_S_REG 111
166#define DA9052_COUNT_MI_REG 112
167#define DA9052_COUNT_H_REG 113
168#define DA9052_COUNT_D_REG 114
169#define DA9052_COUNT_MO_REG 115
170#define DA9052_COUNT_Y_REG 116
171
172/* RTC CONTROL REGISTERS */
173#define DA9052_ALARM_MI_REG 117
174#define DA9052_ALARM_H_REG 118
175#define DA9052_ALARM_D_REG 119
176#define DA9052_ALARM_MO_REG 120
177#define DA9052_ALARM_Y_REG 121
178#define DA9052_SECOND_A_REG 122
179#define DA9052_SECOND_B_REG 123
180#define DA9052_SECOND_C_REG 124
181#define DA9052_SECOND_D_REG 125
182
183/* PAGE CONFIGURATION BIT */
184#define DA9052_PAGE_CONF 0X80
185
186/* STATUS REGISTER A BITS */
187#define DA9052_STATUSA_VDATDET 0X80
188#define DA9052_STATUSA_VBUSSEL 0X40
189#define DA9052_STATUSA_DCINSEL 0X20
190#define DA9052_STATUSA_VBUSDET 0X10
191#define DA9052_STATUSA_DCINDET 0X08
192#define DA9052_STATUSA_IDGND 0X04
193#define DA9052_STATUSA_IDFLOAT 0X02
194#define DA9052_STATUSA_NONKEY 0X01
195
196/* STATUS REGISTER B BITS */
197#define DA9052_STATUSB_COMPDET 0X80
198#define DA9052_STATUSB_SEQUENCING 0X40
199#define DA9052_STATUSB_GPFB2 0X20
200#define DA9052_STATUSB_CHGTO 0X10
201#define DA9052_STATUSB_CHGEND 0X08
202#define DA9052_STATUSB_CHGLIM 0X04
203#define DA9052_STATUSB_CHGPRE 0X02
204#define DA9052_STATUSB_CHGATT 0X01
205
206/* STATUS REGISTER C BITS */
207#define DA9052_STATUSC_GPI7 0X80
208#define DA9052_STATUSC_GPI6 0X40
209#define DA9052_STATUSC_GPI5 0X20
210#define DA9052_STATUSC_GPI4 0X10
211#define DA9052_STATUSC_GPI3 0X08
212#define DA9052_STATUSC_GPI2 0X04
213#define DA9052_STATUSC_GPI1 0X02
214#define DA9052_STATUSC_GPI0 0X01
215
216/* STATUS REGISTER D BITS */
217#define DA9052_STATUSD_GPI15 0X80
218#define DA9052_STATUSD_GPI14 0X40
219#define DA9052_STATUSD_GPI13 0X20
220#define DA9052_STATUSD_GPI12 0X10
221#define DA9052_STATUSD_GPI11 0X08
222#define DA9052_STATUSD_GPI10 0X04
223#define DA9052_STATUSD_GPI9 0X02
224#define DA9052_STATUSD_GPI8 0X01
225
226/* EVENT REGISTER A BITS */
227#define DA9052_EVENTA_ECOMP1V2 0X80
228#define DA9052_EVENTA_ESEQRDY 0X40
229#define DA9052_EVENTA_EALRAM 0X20
230#define DA9052_EVENTA_EVDDLOW 0X10
231#define DA9052_EVENTA_EVBUSREM 0X08
232#define DA9052_EVENTA_EDCINREM 0X04
233#define DA9052_EVENTA_EVBUSDET 0X02
234#define DA9052_EVENTA_EDCINDET 0X01
235
236/* EVENT REGISTER B BITS */
237#define DA9052_EVENTB_ETSIREADY 0X80
238#define DA9052_EVENTB_EPENDOWN 0X40
239#define DA9052_EVENTB_EADCEOM 0X20
240#define DA9052_EVENTB_ETBAT 0X10
241#define DA9052_EVENTB_ECHGEND 0X08
242#define DA9052_EVENTB_EIDGND 0X04
243#define DA9052_EVENTB_EIDFLOAT 0X02
244#define DA9052_EVENTB_ENONKEY 0X01
245
246/* EVENT REGISTER C BITS */
247#define DA9052_EVENTC_EGPI7 0X80
248#define DA9052_EVENTC_EGPI6 0X40
249#define DA9052_EVENTC_EGPI5 0X20
250#define DA9052_EVENTC_EGPI4 0X10
251#define DA9052_EVENTC_EGPI3 0X08
252#define DA9052_EVENTC_EGPI2 0X04
253#define DA9052_EVENTC_EGPI1 0X02
254#define DA9052_EVENTC_EGPI0 0X01
255
256/* EVENT REGISTER D BITS */
257#define DA9052_EVENTD_EGPI15 0X80
258#define DA9052_EVENTD_EGPI14 0X40
259#define DA9052_EVENTD_EGPI13 0X20
260#define DA9052_EVENTD_EGPI12 0X10
261#define DA9052_EVENTD_EGPI11 0X08
262#define DA9052_EVENTD_EGPI10 0X04
263#define DA9052_EVENTD_EGPI9 0X02
264#define DA9052_EVENTD_EGPI8 0X01
265
266/* IRQ MASK REGISTERS BITS */
267#define DA9052_M_NONKEY 0X0100
268
269/* TSI EVENT REGISTERS BITS */
270#define DA9052_E_PEN_DOWN 0X4000
271#define DA9052_E_TSI_READY 0X8000
272
273/* FAULT LOG REGISTER BITS */
274#define DA9052_FAULTLOG_WAITSET 0X80
275#define DA9052_FAULTLOG_NSDSET 0X40
276#define DA9052_FAULTLOG_KEYSHUT 0X20
277#define DA9052_FAULTLOG_TEMPOVER 0X08
278#define DA9052_FAULTLOG_VDDSTART 0X04
279#define DA9052_FAULTLOG_VDDFAULT 0X02
280#define DA9052_FAULTLOG_TWDERROR 0X01
281
282/* CONTROL REGISTER A BITS */
283#define DA9052_CONTROLA_GPIV 0X80
284#define DA9052_CONTROLA_PMOTYPE 0X20
285#define DA9052_CONTROLA_PMOV 0X10
286#define DA9052_CONTROLA_PMIV 0X08
287#define DA9052_CONTROLA_PMIFV 0X08
288#define DA9052_CONTROLA_PWR1EN 0X04
289#define DA9052_CONTROLA_PWREN 0X02
290#define DA9052_CONTROLA_SYSEN 0X01
291
292/* CONTROL REGISTER B BITS */
293#define DA9052_CONTROLB_SHUTDOWN 0X80
294#define DA9052_CONTROLB_DEEPSLEEP 0X40
295#define DA9052_CONTROL_B_WRITEMODE 0X20
296#define DA9052_CONTROLB_BBATEN 0X10
297#define DA9052_CONTROLB_OTPREADEN 0X08
298#define DA9052_CONTROLB_AUTOBOOT 0X04
299#define DA9052_CONTROLB_ACTDIODE 0X02
300#define DA9052_CONTROLB_BUCKMERGE 0X01
301
302/* CONTROL REGISTER C BITS */
303#define DA9052_CONTROLC_BLINKDUR 0X80
304#define DA9052_CONTROLC_BLINKFRQ 0X60
305#define DA9052_CONTROLC_DEBOUNCING 0X1C
306#define DA9052_CONTROLC_PMFB2PIN 0X02
307#define DA9052_CONTROLC_PMFB1PIN 0X01
308
309/* CONTROL REGISTER D BITS */
310#define DA9052_CONTROLD_WATCHDOG 0X80
311#define DA9052_CONTROLD_ACCDETEN 0X40
312#define DA9052_CONTROLD_GPI1415SD 0X20
313#define DA9052_CONTROLD_NONKEYSD 0X10
314#define DA9052_CONTROLD_KEEPACTEN 0X08
315#define DA9052_CONTROLD_TWDSCALE 0X07
316
317/* POWER DOWN DISABLE REGISTER BITS */
318#define DA9052_PDDIS_PMCONTPD 0X80
319#define DA9052_PDDIS_OUT32KPD 0X40
320#define DA9052_PDDIS_CHGBBATPD 0X20
321#define DA9052_PDDIS_CHGPD 0X10
322#define DA9052_PDDIS_HS2WIREPD 0X08
323#define DA9052_PDDIS_PMIFPD 0X04
324#define DA9052_PDDIS_GPADCPD 0X02
325#define DA9052_PDDIS_GPIOPD 0X01
326
327/* CONTROL REGISTER D BITS */
328#define DA9052_INTERFACE_IFBASEADDR 0XE0
329#define DA9052_INTERFACE_NCSPOL 0X10
330#define DA9052_INTERFACE_RWPOL 0X08
331#define DA9052_INTERFACE_CPHA 0X04
332#define DA9052_INTERFACE_CPOL 0X02
333#define DA9052_INTERFACE_IFTYPE 0X01
334
335/* CONTROL REGISTER D BITS */
336#define DA9052_RESET_RESETEVENT 0XC0
337#define DA9052_RESET_RESETTIMER 0X3F
338
339/* GPIO REGISTERS */
340/* GPIO CONTROL REGISTER BITS */
341#define DA9052_GPIO_EVEN_PORT_PIN 0X03
342#define DA9052_GPIO_EVEN_PORT_TYPE 0X04
343#define DA9052_GPIO_EVEN_PORT_MODE 0X08
344
345#define DA9052_GPIO_ODD_PORT_PIN 0X30
346#define DA9052_GPIO_ODD_PORT_TYPE 0X40
347#define DA9052_GPIO_ODD_PORT_MODE 0X80
348
349/*POWER SEQUENCER REGISTER BITS */
350/* SEQ CONTROL REGISTER BITS FOR ID 0 AND 1 */
351#define DA9052_ID01_LDO1STEP 0XF0
352#define DA9052_ID01_SYSPRE 0X04
353#define DA9052_ID01_DEFSUPPLY 0X02
354#define DA9052_ID01_NRESMODE 0X01
355
356/* SEQ CONTROL REGISTER BITS FOR ID 2 AND 3 */
357#define DA9052_ID23_LDO3STEP 0XF0
358#define DA9052_ID23_LDO2STEP 0X0F
359
360/* SEQ CONTROL REGISTER BITS FOR ID 4 AND 5 */
361#define DA9052_ID45_LDO5STEP 0XF0
362#define DA9052_ID45_LDO4STEP 0X0F
363
364/* SEQ CONTROL REGISTER BITS FOR ID 6 AND 7 */
365#define DA9052_ID67_LDO7STEP 0XF0
366#define DA9052_ID67_LDO6STEP 0X0F
367
368/* SEQ CONTROL REGISTER BITS FOR ID 8 AND 9 */
369#define DA9052_ID89_LDO9STEP 0XF0
370#define DA9052_ID89_LDO8STEP 0X0F
371
372/* SEQ CONTROL REGISTER BITS FOR ID 10 AND 11 */
373#define DA9052_ID1011_PDDISSTEP 0XF0
374#define DA9052_ID1011_LDO10STEP 0X0F
375
376/* SEQ CONTROL REGISTER BITS FOR ID 12 AND 13 */
377#define DA9052_ID1213_VMEMSWSTEP 0XF0
378#define DA9052_ID1213_VPERISWSTEP 0X0F
379
380/* SEQ CONTROL REGISTER BITS FOR ID 14 AND 15 */
381#define DA9052_ID1415_BUCKPROSTEP 0XF0
382#define DA9052_ID1415_BUCKCORESTEP 0X0F
383
384/* SEQ CONTROL REGISTER BITS FOR ID 16 AND 17 */
385#define DA9052_ID1617_BUCKPERISTEP 0XF0
386#define DA9052_ID1617_BUCKMEMSTEP 0X0F
387
388/* SEQ CONTROL REGISTER BITS FOR ID 18 AND 19 */
389#define DA9052_ID1819_GPRISE2STEP 0XF0
390#define DA9052_ID1819_GPRISE1STEP 0X0F
391
392/* SEQ CONTROL REGISTER BITS FOR ID 20 AND 21 */
393#define DA9052_ID2021_GPFALL2STEP 0XF0
394#define DA9052_ID2021_GPFALL1STEP 0X0F
395
396/* POWER SEQ STATUS REGISTER BITS */
397#define DA9052_SEQSTATUS_SEQPOINTER 0XF0
398#define DA9052_SEQSTATUS_WAITSTEP 0X0F
399
400/* POWER SEQ A REGISTER BITS */
401#define DA9052_SEQA_POWEREND 0XF0
402#define DA9052_SEQA_SYSTEMEND 0X0F
403
404/* POWER SEQ B REGISTER BITS */
405#define DA9052_SEQB_PARTDOWN 0XF0
406#define DA9052_SEQB_MAXCOUNT 0X0F
407
408/* POWER SEQ TIMER REGISTER BITS */
409#define DA9052_SEQTIMER_SEQDUMMY 0XF0
410#define DA9052_SEQTIMER_SEQTIME 0X0F
411
412/*POWER SUPPLY CONTROL REGISTER BITS */
413/* BUCK REGISTER A BITS */
414#define DA9052_BUCKA_BPROILIM 0XC0
415#define DA9052_BUCKA_BPROMODE 0X30
416#define DA9052_BUCKA_BCOREILIM 0X0C
417#define DA9052_BUCKA_BCOREMODE 0X03
418
419/* BUCK REGISTER B BITS */
420#define DA9052_BUCKB_BERIILIM 0XC0
421#define DA9052_BUCKB_BPERIMODE 0X30
422#define DA9052_BUCKB_BMEMILIM 0X0C
423#define DA9052_BUCKB_BMEMMODE 0X03
424
425/* BUCKCORE REGISTER BITS */
426#define DA9052_BUCKCORE_BCORECONF 0X80
427#define DA9052_BUCKCORE_BCOREEN 0X40
428#define DA9052_BUCKCORE_VBCORE 0X3F
429
430/* BUCKPRO REGISTER BITS */
431#define DA9052_BUCKPRO_BPROCONF 0X80
432#define DA9052_BUCKPRO_BPROEN 0X40
433#define DA9052_BUCKPRO_VBPRO 0X3F
434
435/* BUCKMEM REGISTER BITS */
436#define DA9052_BUCKMEM_BMEMCONF 0X80
437#define DA9052_BUCKMEM_BMEMEN 0X40
438#define DA9052_BUCKMEM_VBMEM 0X3F
439
440/* BUCKPERI REGISTER BITS */
441#define DA9052_BUCKPERI_BPERICONF 0X80
442#define DA9052_BUCKPERI_BPERIEN 0X40
443#define DA9052_BUCKPERI_BPERIHS 0X20
444#define DA9052_BUCKPERI_VBPERI 0X1F
445
446/* LDO1 REGISTER BITS */
447#define DA9052_LDO1_LDO1CONF 0X80
448#define DA9052_LDO1_LDO1EN 0X40
449#define DA9052_LDO1_VLDO1 0X1F
450
451/* LDO2 REGISTER BITS */
452#define DA9052_LDO2_LDO2CONF 0X80
453#define DA9052_LDO2_LDO2EN 0X40
454#define DA9052_LDO2_VLDO2 0X3F
455
456/* LDO3 REGISTER BITS */
457#define DA9052_LDO3_LDO3CONF 0X80
458#define DA9052_LDO3_LDO3EN 0X40
459#define DA9052_LDO3_VLDO3 0X3F
460
461/* LDO4 REGISTER BITS */
462#define DA9052_LDO4_LDO4CONF 0X80
463#define DA9052_LDO4_LDO4EN 0X40
464#define DA9052_LDO4_VLDO4 0X3F
465
466/* LDO5 REGISTER BITS */
467#define DA9052_LDO5_LDO5CONF 0X80
468#define DA9052_LDO5_LDO5EN 0X40
469#define DA9052_LDO5_VLDO5 0X3F
470
471/* LDO6 REGISTER BITS */
472#define DA9052_LDO6_LDO6CONF 0X80
473#define DA9052_LDO6_LDO6EN 0X40
474#define DA9052_LDO6_VLDO6 0X3F
475
476/* LDO7 REGISTER BITS */
477#define DA9052_LDO7_LDO7CONF 0X80
478#define DA9052_LDO7_LDO7EN 0X40
479#define DA9052_LDO7_VLDO7 0X3F
480
481/* LDO8 REGISTER BITS */
482#define DA9052_LDO8_LDO8CONF 0X80
483#define DA9052_LDO8_LDO8EN 0X40
484#define DA9052_LDO8_VLDO8 0X3F
485
486/* LDO9 REGISTER BITS */
487#define DA9052_LDO9_LDO9CONF 0X80
488#define DA9052_LDO9_LDO9EN 0X40
489#define DA9052_LDO9_VLDO9 0X3F
490
491/* LDO10 REGISTER BITS */
492#define DA9052_LDO10_LDO10CONF 0X80
493#define DA9052_LDO10_LDO10EN 0X40
494#define DA9052_LDO10_VLDO10 0X3F
495
496/* SUPPLY REGISTER BITS */
497#define DA9052_SUPPLY_VLOCK 0X80
498#define DA9052_SUPPLY_VMEMSWEN 0X40
499#define DA9052_SUPPLY_VPERISWEN 0X20
500#define DA9052_SUPPLY_VLDO3GO 0X10
501#define DA9052_SUPPLY_VLDO2GO 0X08
502#define DA9052_SUPPLY_VBMEMGO 0X04
503#define DA9052_SUPPLY_VBPROGO 0X02
504#define DA9052_SUPPLY_VBCOREGO 0X01
505
506/* PULLDOWN REGISTER BITS */
507#define DA9052_PULLDOWN_LDO5PDDIS 0X20
508#define DA9052_PULLDOWN_LDO2PDDIS 0X10
509#define DA9052_PULLDOWN_LDO1PDDIS 0X08
510#define DA9052_PULLDOWN_MEMPDDIS 0X04
511#define DA9052_PULLDOWN_PROPDDIS 0X02
512#define DA9052_PULLDOWN_COREPDDIS 0X01
513
514/* BAT CHARGER REGISTER BITS */
515/* CHARGER BUCK REGISTER BITS */
516#define DA9052_CHGBUCK_CHGTEMP 0X80
517#define DA9052_CHGBUCK_CHGUSBILIM 0X40
518#define DA9052_CHGBUCK_CHGBUCKLP 0X20
519#define DA9052_CHGBUCK_CHGBUCKEN 0X10
520#define DA9052_CHGBUCK_ISETBUCK 0X0F
521
522/* WAIT COUNTER REGISTER BITS */
523#define DA9052_WAITCONT_WAITDIR 0X80
524#define DA9052_WAITCONT_RTCCLOCK 0X40
525#define DA9052_WAITCONT_WAITMODE 0X20
526#define DA9052_WAITCONT_EN32KOUT 0X10
527#define DA9052_WAITCONT_DELAYTIME 0X0F
528
529/* ISET CONTROL REGISTER BITS */
530#define DA9052_ISET_ISETDCIN 0XF0
531#define DA9052_ISET_ISETVBUS 0X0F
532
533/* BATTERY CHARGER CONTROL REGISTER BITS */
534#define DA9052_BATCHG_ICHGPRE 0XC0
535#define DA9052_BATCHG_ICHGBAT 0X3F
536
537/* CHARGER COUNTER REGISTER BITS */
538#define DA9052_CHG_CONT_VCHG_BAT 0XF8
539#define DA9052_CHG_CONT_TCTR 0X07
540
541/* INPUT CONTROL REGISTER BITS */
542#define DA9052_INPUT_CONT_TCTR_MODE 0X80
543#define DA9052_INPUT_CONT_VBUS_SUSP 0X10
544#define DA9052_INPUT_CONT_DCIN_SUSP 0X08
545
546/* CHARGING TIME REGISTER BITS */
547#define DA9052_CHGTIME_CHGTIME 0XFF
548
549/* BACKUP BATTERY CONTROL REGISTER BITS */
550#define DA9052_BBATCONT_BCHARGERISET 0XF0
551#define DA9052_BBATCONT_BCHARGERVSET 0X0F
552
553/* LED REGISTERS BITS */
554/* LED BOOST REGISTER BITS */
555#define DA9052_BOOST_EBFAULT 0X80
556#define DA9052_BOOST_MBFAULT 0X40
557#define DA9052_BOOST_BOOSTFRQ 0X20
558#define DA9052_BOOST_BOOSTILIM 0X10
559#define DA9052_BOOST_LED3INEN 0X08
560#define DA9052_BOOST_LED2INEN 0X04
561#define DA9052_BOOST_LED1INEN 0X02
562#define DA9052_BOOST_BOOSTEN 0X01
563
564/* LED CONTROL REGISTER BITS */
565#define DA9052_LEDCONT_SELLEDMODE 0X80
566#define DA9052_LEDCONT_LED3ICONT 0X40
567#define DA9052_LEDCONT_LED3RAMP 0X20
568#define DA9052_LEDCONT_LED3EN 0X10
569#define DA9052_LEDCONT_LED2RAMP 0X08
570#define DA9052_LEDCONT_LED2EN 0X04
571#define DA9052_LEDCONT_LED1RAMP 0X02
572#define DA9052_LEDCONT_LED1EN 0X01
573
574/* LEDMIN123 REGISTER BIT */
575#define DA9052_LEDMIN123_LEDMINCURRENT 0XFF
576
577/* LED1CONF REGISTER BIT */
578#define DA9052_LED1CONF_LED1CURRENT 0XFF
579
580/* LED2CONF REGISTER BIT */
581#define DA9052_LED2CONF_LED2CURRENT 0XFF
582
583/* LED3CONF REGISTER BIT */
584#define DA9052_LED3CONF_LED3CURRENT 0XFF
585
586/* LED COUNT REGISTER BIT */
587#define DA9052_LED_CONT_DIM 0X80
588
589/* ADC MAN REGISTERS BITS */
590#define DA9052_ADC_MAN_MAN_CONV 0X10
591#define DA9052_ADC_MAN_MUXSEL_VDDOUT 0X00
592#define DA9052_ADC_MAN_MUXSEL_ICH 0X01
593#define DA9052_ADC_MAN_MUXSEL_TBAT 0X02
594#define DA9052_ADC_MAN_MUXSEL_VBAT 0X03
595#define DA9052_ADC_MAN_MUXSEL_AD4 0X04
596#define DA9052_ADC_MAN_MUXSEL_AD5 0X05
597#define DA9052_ADC_MAN_MUXSEL_AD6 0X06
598#define DA9052_ADC_MAN_MUXSEL_VBBAT 0X09
599
600/* ADC CONTROL REGSISTERS BITS */
601#define DA9052_ADCCONT_COMP1V2EN 0X80
602#define DA9052_ADCCONT_ADCMODE 0X40
603#define DA9052_ADCCONT_TBATISRCEN 0X20
604#define DA9052_ADCCONT_AD4ISRCEN 0X10
605#define DA9052_ADCCONT_AUTOAD6EN 0X08
606#define DA9052_ADCCONT_AUTOAD5EN 0X04
607#define DA9052_ADCCONT_AUTOAD4EN 0X02
608#define DA9052_ADCCONT_AUTOVDDEN 0X01
609
610/* ADC 10 BIT MANUAL CONVERSION RESULT LOW REGISTER */
611#define DA9052_ADC_RES_LSB 0X03
612
613/* ADC 10 BIT MANUAL CONVERSION RESULT HIGH REGISTER */
614#define DA9052_ADCRESH_ADCRESMSB 0XFF
615
616/* VDD RES REGSISTER BIT*/
617#define DA9052_VDDRES_VDDOUTRES 0XFF
618
619/* VDD MON REGSISTER BIT */
620#define DA9052_VDDMON_VDDOUTMON 0XFF
621
622/* ICHG_AV REGSISTER BIT */
623#define DA9052_ICHGAV_ICHGAV 0XFF
624
625/* ICHG_THD REGSISTER BIT */
626#define DA9052_ICHGTHD_ICHGTHD 0XFF
627
628/* ICHG_END REGSISTER BIT */
629#define DA9052_ICHGEND_ICHGEND 0XFF
630
631/* TBAT_RES REGSISTER BIT */
632#define DA9052_TBATRES_TBATRES 0XFF
633
634/* TBAT_HIGHP REGSISTER BIT */
635#define DA9052_TBATHIGHP_TBATHIGHP 0XFF
636
637/* TBAT_HIGHN REGSISTER BIT */
638#define DA9052_TBATHIGHN_TBATHIGHN 0XFF
639
640/* TBAT_LOW REGSISTER BIT */
641#define DA9052_TBATLOW_TBATLOW 0XFF
642
643/* T_OFFSET REGSISTER BIT */
644#define DA9052_TOFFSET_TOFFSET 0XFF
645
646/* ADCIN4_RES REGSISTER BIT */
647#define DA9052_ADCIN4RES_ADCIN4RES 0XFF
648
649/* ADCIN4_HIGH REGSISTER BIT */
650#define DA9052_AUTO4HIGH_AUTO4HIGH 0XFF
651
652/* ADCIN4_LOW REGSISTER BIT */
653#define DA9052_AUTO4LOW_AUTO4LOW 0XFF
654
655/* ADCIN5_RES REGSISTER BIT */
656#define DA9052_ADCIN5RES_ADCIN5RES 0XFF
657
658/* ADCIN5_HIGH REGSISTER BIT */
659#define DA9052_AUTO5HIGH_AUTOHIGH 0XFF
660
661/* ADCIN5_LOW REGSISTER BIT */
662#define DA9052_AUTO5LOW_AUTO5LOW 0XFF
663
664/* ADCIN6_RES REGSISTER BIT */
665#define DA9052_ADCIN6RES_ADCIN6RES 0XFF
666
667/* ADCIN6_HIGH REGSISTER BIT */
668#define DA9052_AUTO6HIGH_AUTO6HIGH 0XFF
669
670/* ADCIN6_LOW REGSISTER BIT */
671#define DA9052_AUTO6LOW_AUTO6LOW 0XFF
672
673/* TJUNC_RES REGSISTER BIT*/
674#define DA9052_TJUNCRES_TJUNCRES 0XFF
675
676/* TSI REGISTER */
677/* TSI CONTROL REGISTER A BITS */
678#define DA9052_TSICONTA_TSIDELAY 0XC0
679#define DA9052_TSICONTA_TSISKIP 0X38
680#define DA9052_TSICONTA_TSIMODE 0X04
681#define DA9052_TSICONTA_PENDETEN 0X02
682#define DA9052_TSICONTA_AUTOTSIEN 0X01
683
684/* TSI CONTROL REGISTER B BITS */
685#define DA9052_TSICONTB_ADCREF 0X80
686#define DA9052_TSICONTB_TSIMAN 0X40
687#define DA9052_TSICONTB_TSIMUX 0X30
688#define DA9052_TSICONTB_TSISEL3 0X08
689#define DA9052_TSICONTB_TSISEL2 0X04
690#define DA9052_TSICONTB_TSISEL1 0X02
691#define DA9052_TSICONTB_TSISEL0 0X01
692
693/* TSI X CO-ORDINATE MSB RESULT REGISTER BITS */
694#define DA9052_TSIXMSB_TSIXM 0XFF
695
696/* TSI Y CO-ORDINATE MSB RESULT REGISTER BITS */
697#define DA9052_TSIYMSB_TSIYM 0XFF
698
699/* TSI CO-ORDINATE LSB RESULT REGISTER BITS */
700#define DA9052_TSILSB_PENDOWN 0X40
701#define DA9052_TSILSB_TSIZL 0X30
702#define DA9052_TSILSB_TSIYL 0X0C
703#define DA9052_TSILSB_TSIXL 0X03
704
705/* TSI Z MEASUREMENT MSB RESULT REGISTER BIT */
706#define DA9052_TSIZMSB_TSIZM 0XFF
707
708/* RTC REGISTER */
709/* RTC TIMER SECONDS REGISTER BITS */
710#define DA9052_COUNTS_MONITOR 0X40
711#define DA9052_RTC_SEC 0X3F
712
713/* RTC TIMER MINUTES REGISTER BIT */
714#define DA9052_RTC_MIN 0X3F
715
716/* RTC TIMER HOUR REGISTER BIT */
717#define DA9052_RTC_HOUR 0X1F
718
719/* RTC TIMER DAYS REGISTER BIT */
720#define DA9052_RTC_DAY 0X1F
721
722/* RTC TIMER MONTHS REGISTER BIT */
723#define DA9052_RTC_MONTH 0X0F
724
725/* RTC TIMER YEARS REGISTER BIT */
726#define DA9052_RTC_YEAR 0X3F
727
728/* RTC ALARM MINUTES REGISTER BITS */
729#define DA9052_ALARMM_I_TICK_TYPE 0X80
730#define DA9052_ALARMMI_ALARMTYPE 0X40
731
732/* RTC ALARM YEARS REGISTER BITS */
733#define DA9052_ALARM_Y_TICK_ON 0X80
734#define DA9052_ALARM_Y_ALARM_ON 0X40
735
736/* RTC SECONDS REGISTER A BITS */
737#define DA9052_SECONDA_SECONDSA 0XFF
738
739/* RTC SECONDS REGISTER B BITS */
740#define DA9052_SECONDB_SECONDSB 0XFF
741
742/* RTC SECONDS REGISTER C BITS */
743#define DA9052_SECONDC_SECONDSC 0XFF
744
745/* RTC SECONDS REGISTER D BITS */
746#define DA9052_SECONDD_SECONDSD 0XFF
747
748#endif
749/* __LINUX_MFD_DA9052_REG_H */
diff --git a/include/linux/mfd/max8925.h b/include/linux/mfd/max8925.h
index 5259dfe8c585..15b2392a56fb 100644
--- a/include/linux/mfd/max8925.h
+++ b/include/linux/mfd/max8925.h
@@ -167,9 +167,6 @@ enum {
167 MAX8925_IRQ_VCHG_DC_OVP, 167 MAX8925_IRQ_VCHG_DC_OVP,
168 MAX8925_IRQ_VCHG_DC_F, 168 MAX8925_IRQ_VCHG_DC_F,
169 MAX8925_IRQ_VCHG_DC_R, 169 MAX8925_IRQ_VCHG_DC_R,
170 MAX8925_IRQ_VCHG_USB_OVP,
171 MAX8925_IRQ_VCHG_USB_F,
172 MAX8925_IRQ_VCHG_USB_R,
173 MAX8925_IRQ_VCHG_THM_OK_R, 170 MAX8925_IRQ_VCHG_THM_OK_R,
174 MAX8925_IRQ_VCHG_THM_OK_F, 171 MAX8925_IRQ_VCHG_THM_OK_F,
175 MAX8925_IRQ_VCHG_SYSLOW_F, 172 MAX8925_IRQ_VCHG_SYSLOW_F,
@@ -206,6 +203,8 @@ struct max8925_chip {
206 int irq_base; 203 int irq_base;
207 int core_irq; 204 int core_irq;
208 int tsc_irq; 205 int tsc_irq;
206
207 unsigned int wakeup_flag;
209}; 208};
210 209
211struct max8925_backlight_pdata { 210struct max8925_backlight_pdata {
@@ -223,6 +222,10 @@ struct max8925_power_pdata {
223 unsigned batt_detect:1; 222 unsigned batt_detect:1;
224 unsigned topoff_threshold:2; 223 unsigned topoff_threshold:2;
225 unsigned fast_charge:3; /* charge current */ 224 unsigned fast_charge:3; /* charge current */
225 unsigned no_temp_support:1; /* set if no temperature detect */
226 unsigned no_insert_detect:1; /* set if no ac insert detect */
227 char **supplied_to;
228 int num_supplicants;
226}; 229};
227 230
228/* 231/*
diff --git a/include/linux/mfd/max8997.h b/include/linux/mfd/max8997.h
index 0bbd13dbe336..fff590521e50 100644
--- a/include/linux/mfd/max8997.h
+++ b/include/linux/mfd/max8997.h
@@ -77,6 +77,82 @@ struct max8997_regulator_data {
77 struct regulator_init_data *initdata; 77 struct regulator_init_data *initdata;
78}; 78};
79 79
80enum max8997_muic_usb_type {
81 MAX8997_USB_HOST,
82 MAX8997_USB_DEVICE,
83};
84
85enum max8997_muic_charger_type {
86 MAX8997_CHARGER_TYPE_NONE = 0,
87 MAX8997_CHARGER_TYPE_USB,
88 MAX8997_CHARGER_TYPE_DOWNSTREAM_PORT,
89 MAX8997_CHARGER_TYPE_DEDICATED_CHG,
90 MAX8997_CHARGER_TYPE_500MA,
91 MAX8997_CHARGER_TYPE_1A,
92 MAX8997_CHARGER_TYPE_DEAD_BATTERY = 7,
93};
94
95struct max8997_muic_reg_data {
96 u8 addr;
97 u8 data;
98};
99
100/**
101 * struct max8997_muic_platform_data
102 * @usb_callback: callback function for USB
103 * inform callee of USB type (HOST or DEVICE)
104 * and attached state(true or false)
105 * @charger_callback: callback function for charger
106 * inform callee of charger_type
107 * and attached state(true or false)
108 * @deskdock_callback: callback function for desk dock
109 * inform callee of attached state(true or false)
110 * @cardock_callback: callback function for car dock
111 * inform callee of attached state(true or false)
112 * @mhl_callback: callback function for MHL (Mobile High-definition Link)
113 * inform callee of attached state(true or false)
114 * @uart_callback: callback function for JIG UART
115 * inform callee of attached state(true or false)
116 * @init_data: array of max8997_muic_reg_data
117 * used for initializing registers of MAX8997 MUIC device
118 * @num_init_data: array size of init_data
119 */
120struct max8997_muic_platform_data {
121 void (*usb_callback)(enum max8997_muic_usb_type usb_type,
122 bool attached);
123 void (*charger_callback)(bool attached,
124 enum max8997_muic_charger_type charger_type);
125 void (*deskdock_callback) (bool attached);
126 void (*cardock_callback) (bool attached);
127 void (*mhl_callback) (bool attached);
128 void (*uart_callback) (bool attached);
129
130 struct max8997_muic_reg_data *init_data;
131 int num_init_data;
132};
133
134enum max8997_led_mode {
135 MAX8997_NONE,
136 MAX8997_FLASH_MODE,
137 MAX8997_MOVIE_MODE,
138 MAX8997_FLASH_PIN_CONTROL_MODE,
139 MAX8997_MOVIE_PIN_CONTROL_MODE,
140};
141
142/**
143 * struct max8997_led_platform_data
144 * The number of LED devices for MAX8997 is two
145 * @mode: LED mode for each LED device
146 * @brightness: initial brightness for each LED device
147 * range:
148 * [0 - 31]: MAX8997_FLASH_MODE and MAX8997_FLASH_PIN_CONTROL_MODE
149 * [0 - 15]: MAX8997_MOVIE_MODE and MAX8997_MOVIE_PIN_CONTROL_MODE
150 */
151struct max8997_led_platform_data {
152 enum max8997_led_mode mode[2];
153 u8 brightness[2];
154};
155
80struct max8997_platform_data { 156struct max8997_platform_data {
81 /* IRQ */ 157 /* IRQ */
82 int irq_base; 158 int irq_base;
@@ -113,10 +189,13 @@ struct max8997_platform_data {
113 /* charge Full Timeout */ 189 /* charge Full Timeout */
114 int timeout; /* 0 (no timeout), 5, 6, 7 hours */ 190 int timeout; /* 0 (no timeout), 5, 6, 7 hours */
115 191
116 /* MUIC: Not implemented */ 192 /* ---- MUIC ---- */
193 struct max8997_muic_platform_data *muic_pdata;
194
117 /* HAPTIC: Not implemented */ 195 /* HAPTIC: Not implemented */
118 /* RTC: Not implemented */ 196 /* RTC: Not implemented */
119 /* Flash: Not implemented */ 197 /* ---- LED ---- */
198 struct max8997_led_platform_data *led_pdata;
120}; 199};
121 200
122#endif /* __LINUX_MFD_MAX8998_H */ 201#endif /* __LINUX_MFD_MAX8998_H */
diff --git a/include/linux/mfd/mc13xxx.h b/include/linux/mfd/mc13xxx.h
index 3816c2fac0ad..b86ee45c8b03 100644
--- a/include/linux/mfd/mc13xxx.h
+++ b/include/linux/mfd/mc13xxx.h
@@ -69,6 +69,7 @@ struct regulator_init_data;
69struct mc13xxx_regulator_init_data { 69struct mc13xxx_regulator_init_data {
70 int id; 70 int id;
71 struct regulator_init_data *init_data; 71 struct regulator_init_data *init_data;
72 struct device_node *node;
72}; 73};
73 74
74struct mc13xxx_regulator_platform_data { 75struct mc13xxx_regulator_platform_data {
@@ -173,6 +174,9 @@ struct mc13xxx_platform_data {
173#define MC13XXX_ADC_MODE_MULT_CHAN 3 174#define MC13XXX_ADC_MODE_MULT_CHAN 3
174 175
175#define MC13XXX_ADC0 43 176#define MC13XXX_ADC0 43
177#define MC13XXX_ADC0_LICELLCON (1 << 0)
178#define MC13XXX_ADC0_CHRGICON (1 << 1)
179#define MC13XXX_ADC0_BATICON (1 << 2)
176#define MC13XXX_ADC0_ADREFEN (1 << 10) 180#define MC13XXX_ADC0_ADREFEN (1 << 10)
177#define MC13XXX_ADC0_TSMOD0 (1 << 12) 181#define MC13XXX_ADC0_TSMOD0 (1 << 12)
178#define MC13XXX_ADC0_TSMOD1 (1 << 13) 182#define MC13XXX_ADC0_TSMOD1 (1 << 13)
@@ -184,4 +188,9 @@ struct mc13xxx_platform_data {
184 MC13XXX_ADC0_TSMOD1 | \ 188 MC13XXX_ADC0_TSMOD1 | \
185 MC13XXX_ADC0_TSMOD2) 189 MC13XXX_ADC0_TSMOD2)
186 190
191#define MC13XXX_ADC0_CONFIG_MASK (MC13XXX_ADC0_TSMOD_MASK | \
192 MC13XXX_ADC0_LICELLCON | \
193 MC13XXX_ADC0_CHRGICON | \
194 MC13XXX_ADC0_BATICON)
195
187#endif /* ifndef __LINUX_MFD_MC13XXX_H */ 196#endif /* ifndef __LINUX_MFD_MC13XXX_H */
diff --git a/include/linux/mfd/mcp.h b/include/linux/mfd/mcp.h
index ee496708e38b..f88c1cc0cb0f 100644
--- a/include/linux/mfd/mcp.h
+++ b/include/linux/mfd/mcp.h
@@ -64,6 +64,9 @@ void mcp_driver_unregister(struct mcp_driver *);
64#define mcp_get_drvdata(mcp) dev_get_drvdata(&(mcp)->attached_device) 64#define mcp_get_drvdata(mcp) dev_get_drvdata(&(mcp)->attached_device)
65#define mcp_set_drvdata(mcp,d) dev_set_drvdata(&(mcp)->attached_device, d) 65#define mcp_set_drvdata(mcp,d) dev_set_drvdata(&(mcp)->attached_device, d)
66 66
67#define mcp_priv(mcp) ((void *)((mcp)+1)) 67static inline void *mcp_priv(struct mcp *mcp)
68{
69 return mcp + 1;
70}
68 71
69#endif 72#endif
diff --git a/include/linux/mfd/s5m87xx/s5m-core.h b/include/linux/mfd/s5m87xx/s5m-core.h
new file mode 100644
index 000000000000..a7480b57f92d
--- /dev/null
+++ b/include/linux/mfd/s5m87xx/s5m-core.h
@@ -0,0 +1,373 @@
1/*
2 * s5m-core.h
3 *
4 * Copyright (c) 2011 Samsung Electronics Co., Ltd
5 * http://www.samsung.com
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 *
12 */
13
14#ifndef __LINUX_MFD_S5M_CORE_H
15#define __LINUX_MFD_S5M_CORE_H
16
17#define NUM_IRQ_REGS 4
18
19enum s5m_device_type {
20 S5M8751X,
21 S5M8763X,
22 S5M8767X,
23};
24
25/* S5M8767 registers */
26enum s5m8767_reg {
27 S5M8767_REG_ID,
28 S5M8767_REG_INT1,
29 S5M8767_REG_INT2,
30 S5M8767_REG_INT3,
31 S5M8767_REG_INT1M,
32 S5M8767_REG_INT2M,
33 S5M8767_REG_INT3M,
34 S5M8767_REG_STATUS1,
35 S5M8767_REG_STATUS2,
36 S5M8767_REG_STATUS3,
37 S5M8767_REG_CTRL1,
38 S5M8767_REG_CTRL2,
39 S5M8767_REG_LOWBAT1,
40 S5M8767_REG_LOWBAT2,
41 S5M8767_REG_BUCHG,
42 S5M8767_REG_DVSRAMP,
43 S5M8767_REG_DVSTIMER2 = 0x10,
44 S5M8767_REG_DVSTIMER3,
45 S5M8767_REG_DVSTIMER4,
46 S5M8767_REG_LDO1,
47 S5M8767_REG_LDO2,
48 S5M8767_REG_LDO3,
49 S5M8767_REG_LDO4,
50 S5M8767_REG_LDO5,
51 S5M8767_REG_LDO6,
52 S5M8767_REG_LDO7,
53 S5M8767_REG_LDO8,
54 S5M8767_REG_LDO9,
55 S5M8767_REG_LDO10,
56 S5M8767_REG_LDO11,
57 S5M8767_REG_LDO12,
58 S5M8767_REG_LDO13,
59 S5M8767_REG_LDO14 = 0x20,
60 S5M8767_REG_LDO15,
61 S5M8767_REG_LDO16,
62 S5M8767_REG_LDO17,
63 S5M8767_REG_LDO18,
64 S5M8767_REG_LDO19,
65 S5M8767_REG_LDO20,
66 S5M8767_REG_LDO21,
67 S5M8767_REG_LDO22,
68 S5M8767_REG_LDO23,
69 S5M8767_REG_LDO24,
70 S5M8767_REG_LDO25,
71 S5M8767_REG_LDO26,
72 S5M8767_REG_LDO27,
73 S5M8767_REG_LDO28,
74 S5M8767_REG_UVLO = 0x31,
75 S5M8767_REG_BUCK1CTRL1,
76 S5M8767_REG_BUCK1CTRL2,
77 S5M8767_REG_BUCK2CTRL,
78 S5M8767_REG_BUCK2DVS1,
79 S5M8767_REG_BUCK2DVS2,
80 S5M8767_REG_BUCK2DVS3,
81 S5M8767_REG_BUCK2DVS4,
82 S5M8767_REG_BUCK2DVS5,
83 S5M8767_REG_BUCK2DVS6,
84 S5M8767_REG_BUCK2DVS7,
85 S5M8767_REG_BUCK2DVS8,
86 S5M8767_REG_BUCK3CTRL,
87 S5M8767_REG_BUCK3DVS1,
88 S5M8767_REG_BUCK3DVS2,
89 S5M8767_REG_BUCK3DVS3,
90 S5M8767_REG_BUCK3DVS4,
91 S5M8767_REG_BUCK3DVS5,
92 S5M8767_REG_BUCK3DVS6,
93 S5M8767_REG_BUCK3DVS7,
94 S5M8767_REG_BUCK3DVS8,
95 S5M8767_REG_BUCK4CTRL,
96 S5M8767_REG_BUCK4DVS1,
97 S5M8767_REG_BUCK4DVS2,
98 S5M8767_REG_BUCK4DVS3,
99 S5M8767_REG_BUCK4DVS4,
100 S5M8767_REG_BUCK4DVS5,
101 S5M8767_REG_BUCK4DVS6,
102 S5M8767_REG_BUCK4DVS7,
103 S5M8767_REG_BUCK4DVS8,
104 S5M8767_REG_BUCK5CTRL1,
105 S5M8767_REG_BUCK5CTRL2,
106 S5M8767_REG_BUCK5CTRL3,
107 S5M8767_REG_BUCK5CTRL4,
108 S5M8767_REG_BUCK5CTRL5,
109 S5M8767_REG_BUCK6CTRL1,
110 S5M8767_REG_BUCK6CTRL2,
111 S5M8767_REG_BUCK7CTRL1,
112 S5M8767_REG_BUCK7CTRL2,
113 S5M8767_REG_BUCK8CTRL1,
114 S5M8767_REG_BUCK8CTRL2,
115 S5M8767_REG_BUCK9CTRL1,
116 S5M8767_REG_BUCK9CTRL2,
117 S5M8767_REG_LDO1CTRL,
118 S5M8767_REG_LDO2_1CTRL,
119 S5M8767_REG_LDO2_2CTRL,
120 S5M8767_REG_LDO2_3CTRL,
121 S5M8767_REG_LDO2_4CTRL,
122 S5M8767_REG_LDO3CTRL,
123 S5M8767_REG_LDO4CTRL,
124 S5M8767_REG_LDO5CTRL,
125 S5M8767_REG_LDO6CTRL,
126 S5M8767_REG_LDO7CTRL,
127 S5M8767_REG_LDO8CTRL,
128 S5M8767_REG_LDO9CTRL,
129 S5M8767_REG_LDO10CTRL,
130 S5M8767_REG_LDO11CTRL,
131 S5M8767_REG_LDO12CTRL,
132 S5M8767_REG_LDO13CTRL,
133 S5M8767_REG_LDO14CTRL,
134 S5M8767_REG_LDO15CTRL,
135 S5M8767_REG_LDO16CTRL,
136 S5M8767_REG_LDO17CTRL,
137 S5M8767_REG_LDO18CTRL,
138 S5M8767_REG_LDO19CTRL,
139 S5M8767_REG_LDO20CTRL,
140 S5M8767_REG_LDO21CTRL,
141 S5M8767_REG_LDO22CTRL,
142 S5M8767_REG_LDO23CTRL,
143 S5M8767_REG_LDO24CTRL,
144 S5M8767_REG_LDO25CTRL,
145 S5M8767_REG_LDO26CTRL,
146 S5M8767_REG_LDO27CTRL,
147 S5M8767_REG_LDO28CTRL,
148};
149
150/* S5M8763 registers */
151enum s5m8763_reg {
152 S5M8763_REG_IRQ1,
153 S5M8763_REG_IRQ2,
154 S5M8763_REG_IRQ3,
155 S5M8763_REG_IRQ4,
156 S5M8763_REG_IRQM1,
157 S5M8763_REG_IRQM2,
158 S5M8763_REG_IRQM3,
159 S5M8763_REG_IRQM4,
160 S5M8763_REG_STATUS1,
161 S5M8763_REG_STATUS2,
162 S5M8763_REG_STATUSM1,
163 S5M8763_REG_STATUSM2,
164 S5M8763_REG_CHGR1,
165 S5M8763_REG_CHGR2,
166 S5M8763_REG_LDO_ACTIVE_DISCHARGE1,
167 S5M8763_REG_LDO_ACTIVE_DISCHARGE2,
168 S5M8763_REG_BUCK_ACTIVE_DISCHARGE3,
169 S5M8763_REG_ONOFF1,
170 S5M8763_REG_ONOFF2,
171 S5M8763_REG_ONOFF3,
172 S5M8763_REG_ONOFF4,
173 S5M8763_REG_BUCK1_VOLTAGE1,
174 S5M8763_REG_BUCK1_VOLTAGE2,
175 S5M8763_REG_BUCK1_VOLTAGE3,
176 S5M8763_REG_BUCK1_VOLTAGE4,
177 S5M8763_REG_BUCK2_VOLTAGE1,
178 S5M8763_REG_BUCK2_VOLTAGE2,
179 S5M8763_REG_BUCK3,
180 S5M8763_REG_BUCK4,
181 S5M8763_REG_LDO1_LDO2,
182 S5M8763_REG_LDO3,
183 S5M8763_REG_LDO4,
184 S5M8763_REG_LDO5,
185 S5M8763_REG_LDO6,
186 S5M8763_REG_LDO7,
187 S5M8763_REG_LDO7_LDO8,
188 S5M8763_REG_LDO9_LDO10,
189 S5M8763_REG_LDO11,
190 S5M8763_REG_LDO12,
191 S5M8763_REG_LDO13,
192 S5M8763_REG_LDO14,
193 S5M8763_REG_LDO15,
194 S5M8763_REG_LDO16,
195 S5M8763_REG_BKCHR,
196 S5M8763_REG_LBCNFG1,
197 S5M8763_REG_LBCNFG2,
198};
199
200enum s5m8767_irq {
201 S5M8767_IRQ_PWRR,
202 S5M8767_IRQ_PWRF,
203 S5M8767_IRQ_PWR1S,
204 S5M8767_IRQ_JIGR,
205 S5M8767_IRQ_JIGF,
206 S5M8767_IRQ_LOWBAT2,
207 S5M8767_IRQ_LOWBAT1,
208
209 S5M8767_IRQ_MRB,
210 S5M8767_IRQ_DVSOK2,
211 S5M8767_IRQ_DVSOK3,
212 S5M8767_IRQ_DVSOK4,
213
214 S5M8767_IRQ_RTC60S,
215 S5M8767_IRQ_RTCA1,
216 S5M8767_IRQ_RTCA2,
217 S5M8767_IRQ_SMPL,
218 S5M8767_IRQ_RTC1S,
219 S5M8767_IRQ_WTSR,
220
221 S5M8767_IRQ_NR,
222};
223
224#define S5M8767_IRQ_PWRR_MASK (1 << 0)
225#define S5M8767_IRQ_PWRF_MASK (1 << 1)
226#define S5M8767_IRQ_PWR1S_MASK (1 << 3)
227#define S5M8767_IRQ_JIGR_MASK (1 << 4)
228#define S5M8767_IRQ_JIGF_MASK (1 << 5)
229#define S5M8767_IRQ_LOWBAT2_MASK (1 << 6)
230#define S5M8767_IRQ_LOWBAT1_MASK (1 << 7)
231
232#define S5M8767_IRQ_MRB_MASK (1 << 2)
233#define S5M8767_IRQ_DVSOK2_MASK (1 << 3)
234#define S5M8767_IRQ_DVSOK3_MASK (1 << 4)
235#define S5M8767_IRQ_DVSOK4_MASK (1 << 5)
236
237#define S5M8767_IRQ_RTC60S_MASK (1 << 0)
238#define S5M8767_IRQ_RTCA1_MASK (1 << 1)
239#define S5M8767_IRQ_RTCA2_MASK (1 << 2)
240#define S5M8767_IRQ_SMPL_MASK (1 << 3)
241#define S5M8767_IRQ_RTC1S_MASK (1 << 4)
242#define S5M8767_IRQ_WTSR_MASK (1 << 5)
243
244enum s5m8763_irq {
245 S5M8763_IRQ_DCINF,
246 S5M8763_IRQ_DCINR,
247 S5M8763_IRQ_JIGF,
248 S5M8763_IRQ_JIGR,
249 S5M8763_IRQ_PWRONF,
250 S5M8763_IRQ_PWRONR,
251
252 S5M8763_IRQ_WTSREVNT,
253 S5M8763_IRQ_SMPLEVNT,
254 S5M8763_IRQ_ALARM1,
255 S5M8763_IRQ_ALARM0,
256
257 S5M8763_IRQ_ONKEY1S,
258 S5M8763_IRQ_TOPOFFR,
259 S5M8763_IRQ_DCINOVPR,
260 S5M8763_IRQ_CHGRSTF,
261 S5M8763_IRQ_DONER,
262 S5M8763_IRQ_CHGFAULT,
263
264 S5M8763_IRQ_LOBAT1,
265 S5M8763_IRQ_LOBAT2,
266
267 S5M8763_IRQ_NR,
268};
269
270#define S5M8763_IRQ_DCINF_MASK (1 << 2)
271#define S5M8763_IRQ_DCINR_MASK (1 << 3)
272#define S5M8763_IRQ_JIGF_MASK (1 << 4)
273#define S5M8763_IRQ_JIGR_MASK (1 << 5)
274#define S5M8763_IRQ_PWRONF_MASK (1 << 6)
275#define S5M8763_IRQ_PWRONR_MASK (1 << 7)
276
277#define S5M8763_IRQ_WTSREVNT_MASK (1 << 0)
278#define S5M8763_IRQ_SMPLEVNT_MASK (1 << 1)
279#define S5M8763_IRQ_ALARM1_MASK (1 << 2)
280#define S5M8763_IRQ_ALARM0_MASK (1 << 3)
281
282#define S5M8763_IRQ_ONKEY1S_MASK (1 << 0)
283#define S5M8763_IRQ_TOPOFFR_MASK (1 << 2)
284#define S5M8763_IRQ_DCINOVPR_MASK (1 << 3)
285#define S5M8763_IRQ_CHGRSTF_MASK (1 << 4)
286#define S5M8763_IRQ_DONER_MASK (1 << 5)
287#define S5M8763_IRQ_CHGFAULT_MASK (1 << 7)
288
289#define S5M8763_IRQ_LOBAT1_MASK (1 << 0)
290#define S5M8763_IRQ_LOBAT2_MASK (1 << 1)
291
292#define S5M8763_ENRAMP (1 << 4)
293
294/**
295 * struct s5m87xx_dev - s5m87xx master device for sub-drivers
296 * @dev: master device of the chip (can be used to access platform data)
297 * @i2c: i2c client private data for regulator
298 * @rtc: i2c client private data for rtc
299 * @iolock: mutex for serializing io access
300 * @irqlock: mutex for buslock
301 * @irq_base: base IRQ number for s5m87xx, required for IRQs
302 * @irq: generic IRQ number for s5m87xx
303 * @ono: power onoff IRQ number for s5m87xx
304 * @irq_masks_cur: currently active value
305 * @irq_masks_cache: cached hardware value
306 * @type: indicate which s5m87xx "variant" is used
307 */
308struct s5m87xx_dev {
309 struct device *dev;
310 struct regmap *regmap;
311 struct i2c_client *i2c;
312 struct i2c_client *rtc;
313 struct mutex iolock;
314 struct mutex irqlock;
315
316 int device_type;
317 int irq_base;
318 int irq;
319 int ono;
320 u8 irq_masks_cur[NUM_IRQ_REGS];
321 u8 irq_masks_cache[NUM_IRQ_REGS];
322 int type;
323 bool wakeup;
324};
325
326int s5m_irq_init(struct s5m87xx_dev *s5m87xx);
327void s5m_irq_exit(struct s5m87xx_dev *s5m87xx);
328int s5m_irq_resume(struct s5m87xx_dev *s5m87xx);
329
330extern int s5m_reg_read(struct s5m87xx_dev *s5m87xx, u8 reg, void *dest);
331extern int s5m_bulk_read(struct s5m87xx_dev *s5m87xx, u8 reg, int count, u8 *buf);
332extern int s5m_reg_write(struct s5m87xx_dev *s5m87xx, u8 reg, u8 value);
333extern int s5m_bulk_write(struct s5m87xx_dev *s5m87xx, u8 reg, int count, u8 *buf);
334extern int s5m_reg_update(struct s5m87xx_dev *s5m87xx, u8 reg, u8 val, u8 mask);
335
336struct s5m_platform_data {
337 struct s5m_regulator_data *regulators;
338 int device_type;
339 int num_regulators;
340
341 int irq_base;
342 int (*cfg_pmic_irq)(void);
343
344 int ono;
345 bool wakeup;
346 bool buck_voltage_lock;
347
348 int buck_gpios[3];
349 int buck2_voltage[8];
350 bool buck2_gpiodvs;
351 int buck3_voltage[8];
352 bool buck3_gpiodvs;
353 int buck4_voltage[8];
354 bool buck4_gpiodvs;
355
356 int buck_set1;
357 int buck_set2;
358 int buck_set3;
359 int buck2_enable;
360 int buck3_enable;
361 int buck4_enable;
362 int buck_default_idx;
363 int buck2_default_idx;
364 int buck3_default_idx;
365 int buck4_default_idx;
366
367 int buck_ramp_delay;
368 bool buck2_ramp_enable;
369 bool buck3_ramp_enable;
370 bool buck4_ramp_enable;
371};
372
373#endif /* __LINUX_MFD_S5M_CORE_H */
diff --git a/include/linux/mfd/s5m87xx/s5m-pmic.h b/include/linux/mfd/s5m87xx/s5m-pmic.h
new file mode 100644
index 000000000000..a72a5d27e62e
--- /dev/null
+++ b/include/linux/mfd/s5m87xx/s5m-pmic.h
@@ -0,0 +1,100 @@
1/* s5m87xx.h
2 *
3 * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
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#ifndef __LINUX_MFD_S5M_PMIC_H
12#define __LINUX_MFD_S5M_PMIC_H
13
14#include <linux/regulator/machine.h>
15
16/* S5M8767 regulator ids */
17enum s5m8767_regulators {
18 S5M8767_LDO1,
19 S5M8767_LDO2,
20 S5M8767_LDO3,
21 S5M8767_LDO4,
22 S5M8767_LDO5,
23 S5M8767_LDO6,
24 S5M8767_LDO7,
25 S5M8767_LDO8,
26 S5M8767_LDO9,
27 S5M8767_LDO10,
28 S5M8767_LDO11,
29 S5M8767_LDO12,
30 S5M8767_LDO13,
31 S5M8767_LDO14,
32 S5M8767_LDO15,
33 S5M8767_LDO16,
34 S5M8767_LDO17,
35 S5M8767_LDO18,
36 S5M8767_LDO19,
37 S5M8767_LDO20,
38 S5M8767_LDO21,
39 S5M8767_LDO22,
40 S5M8767_LDO23,
41 S5M8767_LDO24,
42 S5M8767_LDO25,
43 S5M8767_LDO26,
44 S5M8767_LDO27,
45 S5M8767_LDO28,
46 S5M8767_BUCK1,
47 S5M8767_BUCK2,
48 S5M8767_BUCK3,
49 S5M8767_BUCK4,
50 S5M8767_BUCK5,
51 S5M8767_BUCK6,
52 S5M8767_BUCK7,
53 S5M8767_BUCK8,
54 S5M8767_BUCK9,
55 S5M8767_AP_EN32KHZ,
56 S5M8767_CP_EN32KHZ,
57
58 S5M8767_REG_MAX,
59};
60
61/* S5M8763 regulator ids */
62enum s5m8763_regulators {
63 S5M8763_LDO1,
64 S5M8763_LDO2,
65 S5M8763_LDO3,
66 S5M8763_LDO4,
67 S5M8763_LDO5,
68 S5M8763_LDO6,
69 S5M8763_LDO7,
70 S5M8763_LDO8,
71 S5M8763_LDO9,
72 S5M8763_LDO10,
73 S5M8763_LDO11,
74 S5M8763_LDO12,
75 S5M8763_LDO13,
76 S5M8763_LDO14,
77 S5M8763_LDO15,
78 S5M8763_LDO16,
79 S5M8763_BUCK1,
80 S5M8763_BUCK2,
81 S5M8763_BUCK3,
82 S5M8763_BUCK4,
83 S5M8763_AP_EN32KHZ,
84 S5M8763_CP_EN32KHZ,
85 S5M8763_ENCHGVI,
86 S5M8763_ESAFEUSB1,
87 S5M8763_ESAFEUSB2,
88};
89
90/**
91 * s5m87xx_regulator_data - regulator data
92 * @id: regulator id
93 * @initdata: regulator init data (contraints, supplies, ...)
94 */
95struct s5m_regulator_data {
96 int id;
97 struct regulator_init_data *initdata;
98};
99
100#endif /* __LINUX_MFD_S5M_PMIC_H */
diff --git a/include/linux/mfd/s5m87xx/s5m-rtc.h b/include/linux/mfd/s5m87xx/s5m-rtc.h
new file mode 100644
index 000000000000..6ce8da264cec
--- /dev/null
+++ b/include/linux/mfd/s5m87xx/s5m-rtc.h
@@ -0,0 +1,84 @@
1/*
2 * s5m-rtc.h
3 *
4 * Copyright (c) 2011 Samsung Electronics Co., Ltd
5 * http://www.samsung.com
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 *
12 */
13
14#ifndef __LINUX_MFD_S5M_RTC_H
15#define __LINUX_MFD_S5M_RTC_H
16
17enum s5m87xx_rtc_reg {
18 S5M87XX_RTC_SEC,
19 S5M87XX_RTC_MIN,
20 S5M87XX_RTC_HOUR,
21 S5M87XX_RTC_WEEKDAY,
22 S5M87XX_RTC_DATE,
23 S5M87XX_RTC_MONTH,
24 S5M87XX_RTC_YEAR1,
25 S5M87XX_RTC_YEAR2,
26 S5M87XX_ALARM0_SEC,
27 S5M87XX_ALARM0_MIN,
28 S5M87XX_ALARM0_HOUR,
29 S5M87XX_ALARM0_WEEKDAY,
30 S5M87XX_ALARM0_DATE,
31 S5M87XX_ALARM0_MONTH,
32 S5M87XX_ALARM0_YEAR1,
33 S5M87XX_ALARM0_YEAR2,
34 S5M87XX_ALARM1_SEC,
35 S5M87XX_ALARM1_MIN,
36 S5M87XX_ALARM1_HOUR,
37 S5M87XX_ALARM1_WEEKDAY,
38 S5M87XX_ALARM1_DATE,
39 S5M87XX_ALARM1_MONTH,
40 S5M87XX_ALARM1_YEAR1,
41 S5M87XX_ALARM1_YEAR2,
42 S5M87XX_ALARM0_CONF,
43 S5M87XX_ALARM1_CONF,
44 S5M87XX_RTC_STATUS,
45 S5M87XX_WTSR_SMPL_CNTL,
46 S5M87XX_RTC_UDR_CON,
47};
48
49#define RTC_I2C_ADDR (0x0C >> 1)
50
51#define HOUR_12 (1 << 7)
52#define HOUR_AMPM (1 << 6)
53#define HOUR_PM (1 << 5)
54#define ALARM0_STATUS (1 << 1)
55#define ALARM1_STATUS (1 << 2)
56#define UPDATE_AD (1 << 0)
57
58/* RTC Control Register */
59#define BCD_EN_SHIFT 0
60#define BCD_EN_MASK (1 << BCD_EN_SHIFT)
61#define MODEL24_SHIFT 1
62#define MODEL24_MASK (1 << MODEL24_SHIFT)
63/* RTC Update Register1 */
64#define RTC_UDR_SHIFT 0
65#define RTC_UDR_MASK (1 << RTC_UDR_SHIFT)
66/* RTC Hour register */
67#define HOUR_PM_SHIFT 6
68#define HOUR_PM_MASK (1 << HOUR_PM_SHIFT)
69/* RTC Alarm Enable */
70#define ALARM_ENABLE_SHIFT 7
71#define ALARM_ENABLE_MASK (1 << ALARM_ENABLE_SHIFT)
72
73enum {
74 RTC_SEC = 0,
75 RTC_MIN,
76 RTC_HOUR,
77 RTC_WEEKDAY,
78 RTC_DATE,
79 RTC_MONTH,
80 RTC_YEAR1,
81 RTC_YEAR2,
82};
83
84#endif /* __LINUX_MFD_S5M_RTC_H */
diff --git a/include/linux/mfd/stmpe.h b/include/linux/mfd/stmpe.h
index be1af7c42e57..ca1d7a347600 100644
--- a/include/linux/mfd/stmpe.h
+++ b/include/linux/mfd/stmpe.h
@@ -20,6 +20,8 @@ enum stmpe_block {
20}; 20};
21 21
22enum stmpe_partnum { 22enum stmpe_partnum {
23 STMPE610,
24 STMPE801,
23 STMPE811, 25 STMPE811,
24 STMPE1601, 26 STMPE1601,
25 STMPE2401, 27 STMPE2401,
@@ -50,17 +52,20 @@ enum {
50 52
51 53
52struct stmpe_variant_info; 54struct stmpe_variant_info;
55struct stmpe_client_info;
53 56
54/** 57/**
55 * struct stmpe - STMPE MFD structure 58 * struct stmpe - STMPE MFD structure
56 * @lock: lock protecting I/O operations 59 * @lock: lock protecting I/O operations
57 * @irq_lock: IRQ bus lock 60 * @irq_lock: IRQ bus lock
58 * @dev: device, mostly for dev_dbg() 61 * @dev: device, mostly for dev_dbg()
59 * @i2c: i2c client 62 * @client: client - i2c or spi
63 * @ci: client specific information
60 * @partnum: part number 64 * @partnum: part number
61 * @variant: the detected STMPE model number 65 * @variant: the detected STMPE model number
62 * @regs: list of addresses of registers which are at different addresses on 66 * @regs: list of addresses of registers which are at different addresses on
63 * different variants. Indexed by one of STMPE_IDX_*. 67 * different variants. Indexed by one of STMPE_IDX_*.
68 * @irq: irq number for stmpe
64 * @irq_base: starting IRQ number for internal IRQs 69 * @irq_base: starting IRQ number for internal IRQs
65 * @num_gpios: number of gpios, differs for variants 70 * @num_gpios: number of gpios, differs for variants
66 * @ier: cache of IER registers for bus_lock 71 * @ier: cache of IER registers for bus_lock
@@ -71,11 +76,13 @@ struct stmpe {
71 struct mutex lock; 76 struct mutex lock;
72 struct mutex irq_lock; 77 struct mutex irq_lock;
73 struct device *dev; 78 struct device *dev;
74 struct i2c_client *i2c; 79 void *client;
80 struct stmpe_client_info *ci;
75 enum stmpe_partnum partnum; 81 enum stmpe_partnum partnum;
76 struct stmpe_variant_info *variant; 82 struct stmpe_variant_info *variant;
77 const u8 *regs; 83 const u8 *regs;
78 84
85 int irq;
79 int irq_base; 86 int irq_base;
80 int num_gpios; 87 int num_gpios;
81 u8 ier[2]; 88 u8 ier[2];
@@ -183,6 +190,9 @@ struct stmpe_ts_platform_data {
183 * @autosleep_timeout: inactivity timeout in milliseconds for autosleep 190 * @autosleep_timeout: inactivity timeout in milliseconds for autosleep
184 * @irq_base: base IRQ number. %STMPE_NR_IRQS irqs will be used, or 191 * @irq_base: base IRQ number. %STMPE_NR_IRQS irqs will be used, or
185 * %STMPE_NR_INTERNAL_IRQS if the GPIO driver is not used. 192 * %STMPE_NR_INTERNAL_IRQS if the GPIO driver is not used.
193 * @irq_over_gpio: true if gpio is used to get irq
194 * @irq_gpio: gpio number over which irq will be requested (significant only if
195 * irq_over_gpio is true)
186 * @gpio: GPIO-specific platform data 196 * @gpio: GPIO-specific platform data
187 * @keypad: keypad-specific platform data 197 * @keypad: keypad-specific platform data
188 * @ts: touchscreen-specific platform data 198 * @ts: touchscreen-specific platform data
@@ -194,6 +204,8 @@ struct stmpe_platform_data {
194 unsigned int irq_trigger; 204 unsigned int irq_trigger;
195 bool irq_invert_polarity; 205 bool irq_invert_polarity;
196 bool autosleep; 206 bool autosleep;
207 bool irq_over_gpio;
208 int irq_gpio;
197 int autosleep_timeout; 209 int autosleep_timeout;
198 210
199 struct stmpe_gpio_platform_data *gpio; 211 struct stmpe_gpio_platform_data *gpio;
diff --git a/include/linux/mfd/tps65910.h b/include/linux/mfd/tps65910.h
index 8bf2cb9502dd..d0cb12eba402 100644
--- a/include/linux/mfd/tps65910.h
+++ b/include/linux/mfd/tps65910.h
@@ -740,6 +740,34 @@
740#define TPS65910_GPIO_STS BIT(1) 740#define TPS65910_GPIO_STS BIT(1)
741#define TPS65910_GPIO_SET BIT(0) 741#define TPS65910_GPIO_SET BIT(0)
742 742
743/* Regulator Index Definitions */
744#define TPS65910_REG_VRTC 0
745#define TPS65910_REG_VIO 1
746#define TPS65910_REG_VDD1 2
747#define TPS65910_REG_VDD2 3
748#define TPS65910_REG_VDD3 4
749#define TPS65910_REG_VDIG1 5
750#define TPS65910_REG_VDIG2 6
751#define TPS65910_REG_VPLL 7
752#define TPS65910_REG_VDAC 8
753#define TPS65910_REG_VAUX1 9
754#define TPS65910_REG_VAUX2 10
755#define TPS65910_REG_VAUX33 11
756#define TPS65910_REG_VMMC 12
757
758#define TPS65911_REG_VDDCTRL 4
759#define TPS65911_REG_LDO1 5
760#define TPS65911_REG_LDO2 6
761#define TPS65911_REG_LDO3 7
762#define TPS65911_REG_LDO4 8
763#define TPS65911_REG_LDO5 9
764#define TPS65911_REG_LDO6 10
765#define TPS65911_REG_LDO7 11
766#define TPS65911_REG_LDO8 12
767
768/* Max number of TPS65910/11 regulators */
769#define TPS65910_NUM_REGS 13
770
743/** 771/**
744 * struct tps65910_board 772 * struct tps65910_board
745 * Board platform data may be used to initialize regulators. 773 * Board platform data may be used to initialize regulators.
@@ -751,7 +779,7 @@ struct tps65910_board {
751 int irq_base; 779 int irq_base;
752 int vmbch_threshold; 780 int vmbch_threshold;
753 int vmbch2_threshold; 781 int vmbch2_threshold;
754 struct regulator_init_data *tps65910_pmic_init_data; 782 struct regulator_init_data *tps65910_pmic_init_data[TPS65910_NUM_REGS];
755}; 783};
756 784
757/** 785/**
diff --git a/include/linux/mfd/wm8994/core.h b/include/linux/mfd/wm8994/core.h
index f44bdb7273bd..9eff2a351ec5 100644
--- a/include/linux/mfd/wm8994/core.h
+++ b/include/linux/mfd/wm8994/core.h
@@ -15,6 +15,7 @@
15#ifndef __MFD_WM8994_CORE_H__ 15#ifndef __MFD_WM8994_CORE_H__
16#define __MFD_WM8994_CORE_H__ 16#define __MFD_WM8994_CORE_H__
17 17
18#include <linux/mutex.h>
18#include <linux/interrupt.h> 19#include <linux/interrupt.h>
19 20
20enum wm8994_type { 21enum wm8994_type {
@@ -55,6 +56,7 @@ struct wm8994 {
55 struct mutex irq_lock; 56 struct mutex irq_lock;
56 57
57 enum wm8994_type type; 58 enum wm8994_type type;
59 int revision;
58 60
59 struct device *dev; 61 struct device *dev;
60 struct regmap *regmap; 62 struct regmap *regmap;
@@ -65,13 +67,10 @@ struct wm8994 {
65 int irq_base; 67 int irq_base;
66 68
67 int irq; 69 int irq;
68 u16 irq_masks_cur[WM8994_NUM_IRQ_REGS]; 70 struct regmap_irq_chip_data *irq_data;
69 u16 irq_masks_cache[WM8994_NUM_IRQ_REGS];
70 71
71 /* Used over suspend/resume */ 72 /* Used over suspend/resume */
72 bool suspended; 73 bool suspended;
73 u16 ldo_regs[WM8994_NUM_LDO_REGS];
74 u16 gpio_regs[WM8994_NUM_GPIO_REGS];
75 74
76 struct regulator_dev *dbvdd; 75 struct regulator_dev *dbvdd;
77 int num_supplies; 76 int num_supplies;
diff --git a/include/linux/mfd/wm8994/pdata.h b/include/linux/mfd/wm8994/pdata.h
index ea32f306dca6..3fb1f407d5e6 100644
--- a/include/linux/mfd/wm8994/pdata.h
+++ b/include/linux/mfd/wm8994/pdata.h
@@ -23,7 +23,7 @@ struct wm8994_ldo_pdata {
23 int enable; 23 int enable;
24 24
25 const char *supply; 25 const char *supply;
26 struct regulator_init_data *init_data; 26 const struct regulator_init_data *init_data;
27}; 27};
28 28
29#define WM8994_CONFIGURE_GPIO 0x10000 29#define WM8994_CONFIGURE_GPIO 0x10000
@@ -113,6 +113,23 @@ struct wm8958_enh_eq_cfg {
113 u16 regs[WM8958_ENH_EQ_REGS]; 113 u16 regs[WM8958_ENH_EQ_REGS];
114}; 114};
115 115
116/**
117 * Microphone detection rates, used to tune response rates and power
118 * consumption for WM8958/WM1811 microphone detection.
119 *
120 * @sysclk: System clock rate to use this configuration for.
121 * @idle: True if this configuration should use when no accessory is detected,
122 * false otherwise.
123 * @start: Value for MICD_BIAS_START_TIME register field (not shifted).
124 * @rate: Value for MICD_RATE register field (not shifted).
125 */
126struct wm8958_micd_rate {
127 int sysclk;
128 bool idle;
129 int start;
130 int rate;
131};
132
116struct wm8994_pdata { 133struct wm8994_pdata {
117 int gpio_base; 134 int gpio_base;
118 135
@@ -144,6 +161,9 @@ struct wm8994_pdata {
144 int num_enh_eq_cfgs; 161 int num_enh_eq_cfgs;
145 struct wm8958_enh_eq_cfg *enh_eq_cfgs; 162 struct wm8958_enh_eq_cfg *enh_eq_cfgs;
146 163
164 int num_micd_rates;
165 struct wm8958_micd_rate *micd_rates;
166
147 /* LINEOUT can be differential or single ended */ 167 /* LINEOUT can be differential or single ended */
148 unsigned int lineout1_diff:1; 168 unsigned int lineout1_diff:1;
149 unsigned int lineout2_diff:1; 169 unsigned int lineout2_diff:1;
@@ -168,12 +188,21 @@ struct wm8994_pdata {
168 /* WM8958 microphone bias configuration */ 188 /* WM8958 microphone bias configuration */
169 int micbias[2]; 189 int micbias[2];
170 190
191 /* WM8958 microphone detection ranges */
192 u16 micd_lvl_sel;
193
171 /* Disable the internal pull downs on the LDOs if they are 194 /* Disable the internal pull downs on the LDOs if they are
172 * always driven (eg, connected to an always on supply or 195 * always driven (eg, connected to an always on supply or
173 * GPIO that always drives an output. If they float power 196 * GPIO that always drives an output. If they float power
174 * consumption will rise. 197 * consumption will rise.
175 */ 198 */
176 bool ldo_ena_always_driven; 199 bool ldo_ena_always_driven;
200
201 /*
202 * SPKMODE must be pulled internally by the device on this
203 * system.
204 */
205 bool spkmode_pu;
177}; 206};
178 207
179#endif 208#endif
diff --git a/include/linux/mfd/wm8994/registers.h b/include/linux/mfd/wm8994/registers.h
index 83a9caec0e43..86e6a032a078 100644
--- a/include/linux/mfd/wm8994/registers.h
+++ b/include/linux/mfd/wm8994/registers.h
@@ -95,11 +95,15 @@
95#define WM8994_FLL1_CONTROL_3 0x222 95#define WM8994_FLL1_CONTROL_3 0x222
96#define WM8994_FLL1_CONTROL_4 0x223 96#define WM8994_FLL1_CONTROL_4 0x223
97#define WM8994_FLL1_CONTROL_5 0x224 97#define WM8994_FLL1_CONTROL_5 0x224
98#define WM8958_FLL1_EFS_1 0x226
99#define WM8958_FLL1_EFS_2 0x227
98#define WM8994_FLL2_CONTROL_1 0x240 100#define WM8994_FLL2_CONTROL_1 0x240
99#define WM8994_FLL2_CONTROL_2 0x241 101#define WM8994_FLL2_CONTROL_2 0x241
100#define WM8994_FLL2_CONTROL_3 0x242 102#define WM8994_FLL2_CONTROL_3 0x242
101#define WM8994_FLL2_CONTROL_4 0x243 103#define WM8994_FLL2_CONTROL_4 0x243
102#define WM8994_FLL2_CONTROL_5 0x244 104#define WM8994_FLL2_CONTROL_5 0x244
105#define WM8958_FLL2_EFS_1 0x246
106#define WM8958_FLL2_EFS_2 0x247
103#define WM8994_AIF1_CONTROL_1 0x300 107#define WM8994_AIF1_CONTROL_1 0x300
104#define WM8994_AIF1_CONTROL_2 0x301 108#define WM8994_AIF1_CONTROL_2 0x301
105#define WM8994_AIF1_MASTER_SLAVE 0x302 109#define WM8994_AIF1_MASTER_SLAVE 0x302
@@ -116,6 +120,7 @@
116#define WM8994_AIF2DAC_LRCLK 0x315 120#define WM8994_AIF2DAC_LRCLK 0x315
117#define WM8994_AIF2DAC_DATA 0x316 121#define WM8994_AIF2DAC_DATA 0x316
118#define WM8994_AIF2ADC_DATA 0x317 122#define WM8994_AIF2ADC_DATA 0x317
123#define WM1811_AIF2TX_CONTROL 0x318
119#define WM8958_AIF3_CONTROL_1 0x320 124#define WM8958_AIF3_CONTROL_1 0x320
120#define WM8958_AIF3_CONTROL_2 0x321 125#define WM8958_AIF3_CONTROL_2 0x321
121#define WM8958_AIF3DAC_DATA 0x322 126#define WM8958_AIF3DAC_DATA 0x322
@@ -166,6 +171,7 @@
166#define WM8994_AIF1_DAC1_EQ_BAND_5_A 0x491 171#define WM8994_AIF1_DAC1_EQ_BAND_5_A 0x491
167#define WM8994_AIF1_DAC1_EQ_BAND_5_B 0x492 172#define WM8994_AIF1_DAC1_EQ_BAND_5_B 0x492
168#define WM8994_AIF1_DAC1_EQ_BAND_5_PG 0x493 173#define WM8994_AIF1_DAC1_EQ_BAND_5_PG 0x493
174#define WM8994_AIF1_DAC1_EQ_BAND_1_C 0x494
169#define WM8994_AIF1_DAC2_EQ_GAINS_1 0x4A0 175#define WM8994_AIF1_DAC2_EQ_GAINS_1 0x4A0
170#define WM8994_AIF1_DAC2_EQ_GAINS_2 0x4A1 176#define WM8994_AIF1_DAC2_EQ_GAINS_2 0x4A1
171#define WM8994_AIF1_DAC2_EQ_BAND_1_A 0x4A2 177#define WM8994_AIF1_DAC2_EQ_BAND_1_A 0x4A2
@@ -186,6 +192,7 @@
186#define WM8994_AIF1_DAC2_EQ_BAND_5_A 0x4B1 192#define WM8994_AIF1_DAC2_EQ_BAND_5_A 0x4B1
187#define WM8994_AIF1_DAC2_EQ_BAND_5_B 0x4B2 193#define WM8994_AIF1_DAC2_EQ_BAND_5_B 0x4B2
188#define WM8994_AIF1_DAC2_EQ_BAND_5_PG 0x4B3 194#define WM8994_AIF1_DAC2_EQ_BAND_5_PG 0x4B3
195#define WM8994_AIF1_DAC2_EQ_BAND_1_C 0x4B4
189#define WM8994_AIF2_ADC_LEFT_VOLUME 0x500 196#define WM8994_AIF2_ADC_LEFT_VOLUME 0x500
190#define WM8994_AIF2_ADC_RIGHT_VOLUME 0x501 197#define WM8994_AIF2_ADC_RIGHT_VOLUME 0x501
191#define WM8994_AIF2_DAC_LEFT_VOLUME 0x502 198#define WM8994_AIF2_DAC_LEFT_VOLUME 0x502
@@ -219,6 +226,7 @@
219#define WM8994_AIF2_EQ_BAND_5_A 0x591 226#define WM8994_AIF2_EQ_BAND_5_A 0x591
220#define WM8994_AIF2_EQ_BAND_5_B 0x592 227#define WM8994_AIF2_EQ_BAND_5_B 0x592
221#define WM8994_AIF2_EQ_BAND_5_PG 0x593 228#define WM8994_AIF2_EQ_BAND_5_PG 0x593
229#define WM8994_AIF2_EQ_BAND_1_C 0x594
222#define WM8994_DAC1_MIXER_VOLUMES 0x600 230#define WM8994_DAC1_MIXER_VOLUMES 0x600
223#define WM8994_DAC1_LEFT_MIXER_ROUTING 0x601 231#define WM8994_DAC1_LEFT_MIXER_ROUTING 0x601
224#define WM8994_DAC1_RIGHT_MIXER_ROUTING 0x602 232#define WM8994_DAC1_RIGHT_MIXER_ROUTING 0x602
@@ -242,6 +250,7 @@
242#define WM8994_GPIO_4 0x703 250#define WM8994_GPIO_4 0x703
243#define WM8994_GPIO_5 0x704 251#define WM8994_GPIO_5 0x704
244#define WM8994_GPIO_6 0x705 252#define WM8994_GPIO_6 0x705
253#define WM1811_JACKDET_CTRL 0x705
245#define WM8994_GPIO_7 0x706 254#define WM8994_GPIO_7 0x706
246#define WM8994_GPIO_8 0x707 255#define WM8994_GPIO_8 0x707
247#define WM8994_GPIO_9 0x708 256#define WM8994_GPIO_9 0x708
@@ -264,7 +273,43 @@
264#define WM8958_DSP2_RELEASETIME 0xA03 273#define WM8958_DSP2_RELEASETIME 0xA03
265#define WM8958_DSP2_VERMAJMIN 0xA04 274#define WM8958_DSP2_VERMAJMIN 0xA04
266#define WM8958_DSP2_VERBUILD 0xA05 275#define WM8958_DSP2_VERBUILD 0xA05
276#define WM8958_DSP2_TESTREG 0xA06
277#define WM8958_DSP2_XORREG 0xA07
278#define WM8958_DSP2_SHIFTMAXX 0xA08
279#define WM8958_DSP2_SHIFTMAXY 0xA09
280#define WM8958_DSP2_SHIFTMAXZ 0xA0A
281#define WM8958_DSP2_SHIFTMAXEXTLO 0xA0B
282#define WM8958_DSP2_AESSELECT 0xA0C
267#define WM8958_DSP2_EXECCONTROL 0xA0D 283#define WM8958_DSP2_EXECCONTROL 0xA0D
284#define WM8958_DSP2_SAMPLEBREAK 0xA0E
285#define WM8958_DSP2_COUNTBREAK 0xA0F
286#define WM8958_DSP2_INTSTATUS 0xA10
287#define WM8958_DSP2_EVENTSTATUS 0xA11
288#define WM8958_DSP2_INTMASK 0xA12
289#define WM8958_DSP2_CONFIGDWIDTH 0xA13
290#define WM8958_DSP2_CONFIGINSTR 0xA14
291#define WM8958_DSP2_CONFIGDMEM 0xA15
292#define WM8958_DSP2_CONFIGDELAYS 0xA16
293#define WM8958_DSP2_CONFIGNUMIO 0xA17
294#define WM8958_DSP2_CONFIGEXTDEPTH 0xA18
295#define WM8958_DSP2_CONFIGMULTIPLIER 0xA19
296#define WM8958_DSP2_CONFIGCTRLDWIDTH 0xA1A
297#define WM8958_DSP2_CONFIGPIPELINE 0xA1B
298#define WM8958_DSP2_SHIFTMAXEXTHI 0xA1C
299#define WM8958_DSP2_SWVERSIONREG 0xA1D
300#define WM8958_DSP2_CONFIGXMEM 0xA1E
301#define WM8958_DSP2_CONFIGYMEM 0xA1F
302#define WM8958_DSP2_CONFIGZMEM 0xA20
303#define WM8958_FW_BUILD_1 0x2000
304#define WM8958_FW_BUILD_0 0x2001
305#define WM8958_FW_ID_1 0x2002
306#define WM8958_FW_ID_0 0x2003
307#define WM8958_FW_MAJOR_1 0x2004
308#define WM8958_FW_MAJOR_0 0x2005
309#define WM8958_FW_MINOR_1 0x2006
310#define WM8958_FW_MINOR_0 0x2007
311#define WM8958_FW_PATCH_1 0x2008
312#define WM8958_FW_PATCH_0 0x2009
268#define WM8958_MBC_BAND_2_LOWER_CUTOFF_C1_1 0x2200 313#define WM8958_MBC_BAND_2_LOWER_CUTOFF_C1_1 0x2200
269#define WM8958_MBC_BAND_2_LOWER_CUTOFF_C1_2 0x2201 314#define WM8958_MBC_BAND_2_LOWER_CUTOFF_C1_2 0x2201
270#define WM8958_MBC_BAND_2_LOWER_CUTOFF_C2_1 0x2202 315#define WM8958_MBC_BAND_2_LOWER_CUTOFF_C2_1 0x2202
@@ -333,6 +378,14 @@
333#define WM8958_MBC_B2_PG2_2 0x242D 378#define WM8958_MBC_B2_PG2_2 0x242D
334#define WM8958_MBC_B1_PG2_1 0x242E 379#define WM8958_MBC_B1_PG2_1 0x242E
335#define WM8958_MBC_B1_PG2_2 0x242F 380#define WM8958_MBC_B1_PG2_2 0x242F
381#define WM8958_MBC_CROSSOVER_1 0x2600
382#define WM8958_MBC_CROSSOVER_2 0x2601
383#define WM8958_MBC_HPF_1 0x2602
384#define WM8958_MBC_HPF_2 0x2603
385#define WM8958_MBC_LPF_1 0x2606
386#define WM8958_MBC_LPF_2 0x2607
387#define WM8958_MBC_RMS_LIMIT_1 0x260A
388#define WM8958_MBC_RMS_LIMIT_2 0x260B
336#define WM8994_WRITE_SEQUENCER_0 0x3000 389#define WM8994_WRITE_SEQUENCER_0 0x3000
337#define WM8994_WRITE_SEQUENCER_1 0x3001 390#define WM8994_WRITE_SEQUENCER_1 0x3001
338#define WM8994_WRITE_SEQUENCER_2 0x3002 391#define WM8994_WRITE_SEQUENCER_2 0x3002
@@ -1852,6 +1905,9 @@
1852/* 1905/*
1853 * R57 (0x39) - AntiPOP (2) 1906 * R57 (0x39) - AntiPOP (2)
1854 */ 1907 */
1908#define WM1811_JACKDET_MODE_MASK 0x0180 /* JACKDET_MODE - [8:7] */
1909#define WM1811_JACKDET_MODE_SHIFT 7 /* JACKDET_MODE - [8:7] */
1910#define WM1811_JACKDET_MODE_WIDTH 2 /* JACKDET_MODE - [8:7] */
1855#define WM8994_MICB2_DISCH 0x0100 /* MICB2_DISCH */ 1911#define WM8994_MICB2_DISCH 0x0100 /* MICB2_DISCH */
1856#define WM8994_MICB2_DISCH_MASK 0x0100 /* MICB2_DISCH */ 1912#define WM8994_MICB2_DISCH_MASK 0x0100 /* MICB2_DISCH */
1857#define WM8994_MICB2_DISCH_SHIFT 8 /* MICB2_DISCH */ 1913#define WM8994_MICB2_DISCH_SHIFT 8 /* MICB2_DISCH */
@@ -2389,6 +2445,10 @@
2389/* 2445/*
2390 * R548 (0x224) - FLL1 Control (5) 2446 * R548 (0x224) - FLL1 Control (5)
2391 */ 2447 */
2448#define WM8958_FLL1_BYP 0x8000 /* FLL1_BYP */
2449#define WM8958_FLL1_BYP_MASK 0x8000 /* FLL1_BYP */
2450#define WM8958_FLL1_BYP_SHIFT 15 /* FLL1_BYP */
2451#define WM8958_FLL1_BYP_WIDTH 1 /* FLL1_BYP */
2392#define WM8994_FLL1_FRC_NCO_VAL_MASK 0x1F80 /* FLL1_FRC_NCO_VAL - [12:7] */ 2452#define WM8994_FLL1_FRC_NCO_VAL_MASK 0x1F80 /* FLL1_FRC_NCO_VAL - [12:7] */
2393#define WM8994_FLL1_FRC_NCO_VAL_SHIFT 7 /* FLL1_FRC_NCO_VAL - [12:7] */ 2453#define WM8994_FLL1_FRC_NCO_VAL_SHIFT 7 /* FLL1_FRC_NCO_VAL - [12:7] */
2394#define WM8994_FLL1_FRC_NCO_VAL_WIDTH 6 /* FLL1_FRC_NCO_VAL - [12:7] */ 2454#define WM8994_FLL1_FRC_NCO_VAL_WIDTH 6 /* FLL1_FRC_NCO_VAL - [12:7] */
@@ -2404,6 +2464,24 @@
2404#define WM8994_FLL1_REFCLK_SRC_WIDTH 2 /* FLL1_REFCLK_SRC - [1:0] */ 2464#define WM8994_FLL1_REFCLK_SRC_WIDTH 2 /* FLL1_REFCLK_SRC - [1:0] */
2405 2465
2406/* 2466/*
2467 * R550 (0x226) - FLL1 EFS 1
2468 */
2469#define WM8958_FLL1_LAMBDA_MASK 0xFFFF /* FLL1_LAMBDA - [15:0] */
2470#define WM8958_FLL1_LAMBDA_SHIFT 0 /* FLL1_LAMBDA - [15:0] */
2471#define WM8958_FLL1_LAMBDA_WIDTH 16 /* FLL1_LAMBDA - [15:0] */
2472
2473/*
2474 * R551 (0x227) - FLL1 EFS 2
2475 */
2476#define WM8958_FLL1_LFSR_SEL_MASK 0x0006 /* FLL1_LFSR_SEL - [2:1] */
2477#define WM8958_FLL1_LFSR_SEL_SHIFT 1 /* FLL1_LFSR_SEL - [2:1] */
2478#define WM8958_FLL1_LFSR_SEL_WIDTH 2 /* FLL1_LFSR_SEL - [2:1] */
2479#define WM8958_FLL1_EFS_ENA 0x0001 /* FLL1_EFS_ENA */
2480#define WM8958_FLL1_EFS_ENA_MASK 0x0001 /* FLL1_EFS_ENA */
2481#define WM8958_FLL1_EFS_ENA_SHIFT 0 /* FLL1_EFS_ENA */
2482#define WM8958_FLL1_EFS_ENA_WIDTH 1 /* FLL1_EFS_ENA */
2483
2484/*
2407 * R576 (0x240) - FLL2 Control (1) 2485 * R576 (0x240) - FLL2 Control (1)
2408 */ 2486 */
2409#define WM8994_FLL2_FRAC 0x0004 /* FLL2_FRAC */ 2487#define WM8994_FLL2_FRAC 0x0004 /* FLL2_FRAC */
@@ -2452,6 +2530,10 @@
2452/* 2530/*
2453 * R580 (0x244) - FLL2 Control (5) 2531 * R580 (0x244) - FLL2 Control (5)
2454 */ 2532 */
2533#define WM8958_FLL2_BYP 0x8000 /* FLL2_BYP */
2534#define WM8958_FLL2_BYP_MASK 0x8000 /* FLL2_BYP */
2535#define WM8958_FLL2_BYP_SHIFT 15 /* FLL2_BYP */
2536#define WM8958_FLL2_BYP_WIDTH 1 /* FLL2_BYP */
2455#define WM8994_FLL2_FRC_NCO_VAL_MASK 0x1F80 /* FLL2_FRC_NCO_VAL - [12:7] */ 2537#define WM8994_FLL2_FRC_NCO_VAL_MASK 0x1F80 /* FLL2_FRC_NCO_VAL - [12:7] */
2456#define WM8994_FLL2_FRC_NCO_VAL_SHIFT 7 /* FLL2_FRC_NCO_VAL - [12:7] */ 2538#define WM8994_FLL2_FRC_NCO_VAL_SHIFT 7 /* FLL2_FRC_NCO_VAL - [12:7] */
2457#define WM8994_FLL2_FRC_NCO_VAL_WIDTH 6 /* FLL2_FRC_NCO_VAL - [12:7] */ 2539#define WM8994_FLL2_FRC_NCO_VAL_WIDTH 6 /* FLL2_FRC_NCO_VAL - [12:7] */
@@ -2467,6 +2549,24 @@
2467#define WM8994_FLL2_REFCLK_SRC_WIDTH 2 /* FLL2_REFCLK_SRC - [1:0] */ 2549#define WM8994_FLL2_REFCLK_SRC_WIDTH 2 /* FLL2_REFCLK_SRC - [1:0] */
2468 2550
2469/* 2551/*
2552 * R582 (0x246) - FLL2 EFS 1
2553 */
2554#define WM8958_FLL2_LAMBDA_MASK 0xFFFF /* FLL2_LAMBDA - [15:0] */
2555#define WM8958_FLL2_LAMBDA_SHIFT 0 /* FLL2_LAMBDA - [15:0] */
2556#define WM8958_FLL2_LAMBDA_WIDTH 16 /* FLL2_LAMBDA - [15:0] */
2557
2558/*
2559 * R583 (0x247) - FLL2 EFS 2
2560 */
2561#define WM8958_FLL2_LFSR_SEL_MASK 0x0006 /* FLL2_LFSR_SEL - [2:1] */
2562#define WM8958_FLL2_LFSR_SEL_SHIFT 1 /* FLL2_LFSR_SEL - [2:1] */
2563#define WM8958_FLL2_LFSR_SEL_WIDTH 2 /* FLL2_LFSR_SEL - [2:1] */
2564#define WM8958_FLL2_EFS_ENA 0x0001 /* FLL2_EFS_ENA */
2565#define WM8958_FLL2_EFS_ENA_MASK 0x0001 /* FLL2_EFS_ENA */
2566#define WM8958_FLL2_EFS_ENA_SHIFT 0 /* FLL2_EFS_ENA */
2567#define WM8958_FLL2_EFS_ENA_WIDTH 1 /* FLL2_EFS_ENA */
2568
2569/*
2470 * R768 (0x300) - AIF1 Control (1) 2570 * R768 (0x300) - AIF1 Control (1)
2471 */ 2571 */
2472#define WM8994_AIF1ADCL_SRC 0x8000 /* AIF1ADCL_SRC */ 2572#define WM8994_AIF1ADCL_SRC 0x8000 /* AIF1ADCL_SRC */
@@ -4187,6 +4287,18 @@
4187#define WM8994_STL_SEL_WIDTH 1 /* STL_SEL */ 4287#define WM8994_STL_SEL_WIDTH 1 /* STL_SEL */
4188 4288
4189/* 4289/*
4290 * R1797 (0x705) - JACKDET Ctrl
4291 */
4292#define WM1811_JACKDET_DB 0x0100 /* JACKDET_DB */
4293#define WM1811_JACKDET_DB_MASK 0x0100 /* JACKDET_DB */
4294#define WM1811_JACKDET_DB_SHIFT 8 /* JACKDET_DB */
4295#define WM1811_JACKDET_DB_WIDTH 1 /* JACKDET_DB */
4296#define WM1811_JACKDET_LVL 0x0040 /* JACKDET_LVL */
4297#define WM1811_JACKDET_LVL_MASK 0x0040 /* JACKDET_LVL */
4298#define WM1811_JACKDET_LVL_SHIFT 6 /* JACKDET_LVL */
4299#define WM1811_JACKDET_LVL_WIDTH 1 /* JACKDET_LVL */
4300
4301/*
4190 * R1824 (0x720) - Pull Control (1) 4302 * R1824 (0x720) - Pull Control (1)
4191 */ 4303 */
4192#define WM8994_DMICDAT2_PU 0x0800 /* DMICDAT2_PU */ 4304#define WM8994_DMICDAT2_PU 0x0800 /* DMICDAT2_PU */
diff --git a/include/linux/migrate.h b/include/linux/migrate.h
index e39aeecfe9a2..05ed2828a553 100644
--- a/include/linux/migrate.h
+++ b/include/linux/migrate.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/mm.h> 4#include <linux/mm.h>
5#include <linux/mempolicy.h> 5#include <linux/mempolicy.h>
6#include <linux/migrate_mode.h>
6 7
7typedef struct page *new_page_t(struct page *, unsigned long private, int **); 8typedef struct page *new_page_t(struct page *, unsigned long private, int **);
8 9
@@ -11,13 +12,13 @@ typedef struct page *new_page_t(struct page *, unsigned long private, int **);
11 12
12extern void putback_lru_pages(struct list_head *l); 13extern void putback_lru_pages(struct list_head *l);
13extern int migrate_page(struct address_space *, 14extern int migrate_page(struct address_space *,
14 struct page *, struct page *); 15 struct page *, struct page *, enum migrate_mode);
15extern int migrate_pages(struct list_head *l, new_page_t x, 16extern int migrate_pages(struct list_head *l, new_page_t x,
16 unsigned long private, bool offlining, 17 unsigned long private, bool offlining,
17 bool sync); 18 enum migrate_mode mode);
18extern int migrate_huge_pages(struct list_head *l, new_page_t x, 19extern int migrate_huge_pages(struct list_head *l, new_page_t x,
19 unsigned long private, bool offlining, 20 unsigned long private, bool offlining,
20 bool sync); 21 enum migrate_mode mode);
21 22
22extern int fail_migrate_page(struct address_space *, 23extern int fail_migrate_page(struct address_space *,
23 struct page *, struct page *); 24 struct page *, struct page *);
@@ -36,10 +37,10 @@ extern int migrate_huge_page_move_mapping(struct address_space *mapping,
36static inline void putback_lru_pages(struct list_head *l) {} 37static inline void putback_lru_pages(struct list_head *l) {}
37static inline int migrate_pages(struct list_head *l, new_page_t x, 38static inline int migrate_pages(struct list_head *l, new_page_t x,
38 unsigned long private, bool offlining, 39 unsigned long private, bool offlining,
39 bool sync) { return -ENOSYS; } 40 enum migrate_mode mode) { return -ENOSYS; }
40static inline int migrate_huge_pages(struct list_head *l, new_page_t x, 41static inline int migrate_huge_pages(struct list_head *l, new_page_t x,
41 unsigned long private, bool offlining, 42 unsigned long private, bool offlining,
42 bool sync) { return -ENOSYS; } 43 enum migrate_mode mode) { return -ENOSYS; }
43 44
44static inline int migrate_prep(void) { return -ENOSYS; } 45static inline int migrate_prep(void) { return -ENOSYS; }
45static inline int migrate_prep_local(void) { return -ENOSYS; } 46static inline int migrate_prep_local(void) { return -ENOSYS; }
diff --git a/include/linux/migrate_mode.h b/include/linux/migrate_mode.h
new file mode 100644
index 000000000000..ebf3d89a3919
--- /dev/null
+++ b/include/linux/migrate_mode.h
@@ -0,0 +1,16 @@
1#ifndef MIGRATE_MODE_H_INCLUDED
2#define MIGRATE_MODE_H_INCLUDED
3/*
4 * MIGRATE_ASYNC means never block
5 * MIGRATE_SYNC_LIGHT in the current implementation means to allow blocking
6 * on most operations but not ->writepage as the potential stall time
7 * is too significant
8 * MIGRATE_SYNC will block when migrating pages
9 */
10enum migrate_mode {
11 MIGRATE_ASYNC,
12 MIGRATE_SYNC_LIGHT,
13 MIGRATE_SYNC,
14};
15
16#endif /* MIGRATE_MODE_H_INCLUDED */
diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h
index 32085249e9cb..0549d2115507 100644
--- a/include/linux/miscdevice.h
+++ b/include/linux/miscdevice.h
@@ -42,6 +42,7 @@
42#define AUTOFS_MINOR 235 42#define AUTOFS_MINOR 235
43#define MAPPER_CTRL_MINOR 236 43#define MAPPER_CTRL_MINOR 236
44#define LOOP_CTRL_MINOR 237 44#define LOOP_CTRL_MINOR 237
45#define VHOST_NET_MINOR 238
45#define MISC_DYNAMIC_MINOR 255 46#define MISC_DYNAMIC_MINOR 255
46 47
47struct device; 48struct device;
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index 5c4fe8e5bfe5..aea61905499b 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -621,6 +621,7 @@ void mlx4_unregister_mac(struct mlx4_dev *dev, u8 port, u64 mac);
621int mlx4_replace_mac(struct mlx4_dev *dev, u8 port, int qpn, u64 new_mac); 621int mlx4_replace_mac(struct mlx4_dev *dev, u8 port, int qpn, u64 new_mac);
622int mlx4_get_eth_qp(struct mlx4_dev *dev, u8 port, u64 mac, int *qpn); 622int mlx4_get_eth_qp(struct mlx4_dev *dev, u8 port, u64 mac, int *qpn);
623void mlx4_put_eth_qp(struct mlx4_dev *dev, u8 port, u64 mac, int qpn); 623void mlx4_put_eth_qp(struct mlx4_dev *dev, u8 port, u64 mac, int qpn);
624void mlx4_set_stats_bitmap(struct mlx4_dev *dev, u64 *stats_bitmap);
624 625
625int mlx4_find_cached_vlan(struct mlx4_dev *dev, u8 port, u16 vid, int *idx); 626int mlx4_find_cached_vlan(struct mlx4_dev *dev, u8 port, u16 vid, int *idx);
626int mlx4_register_vlan(struct mlx4_dev *dev, u8 port, u16 vlan, int *index); 627int mlx4_register_vlan(struct mlx4_dev *dev, u8 port, u16 vlan, int *index);
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 5d9b4c9813bd..17b27cd269c4 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1482,6 +1482,18 @@ static inline unsigned long vma_pages(struct vm_area_struct *vma)
1482 return (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; 1482 return (vma->vm_end - vma->vm_start) >> PAGE_SHIFT;
1483} 1483}
1484 1484
1485/* Look up the first VMA which exactly match the interval vm_start ... vm_end */
1486static inline struct vm_area_struct *find_exact_vma(struct mm_struct *mm,
1487 unsigned long vm_start, unsigned long vm_end)
1488{
1489 struct vm_area_struct *vma = find_vma(mm, vm_start);
1490
1491 if (vma && (vma->vm_start != vm_start || vma->vm_end != vm_end))
1492 vma = NULL;
1493
1494 return vma;
1495}
1496
1485#ifdef CONFIG_MMU 1497#ifdef CONFIG_MMU
1486pgprot_t vm_get_page_prot(unsigned long vm_flags); 1498pgprot_t vm_get_page_prot(unsigned long vm_flags);
1487#else 1499#else
@@ -1528,23 +1540,13 @@ static inline void vm_stat_account(struct mm_struct *mm,
1528#endif /* CONFIG_PROC_FS */ 1540#endif /* CONFIG_PROC_FS */
1529 1541
1530#ifdef CONFIG_DEBUG_PAGEALLOC 1542#ifdef CONFIG_DEBUG_PAGEALLOC
1531extern int debug_pagealloc_enabled;
1532
1533extern void kernel_map_pages(struct page *page, int numpages, int enable); 1543extern void kernel_map_pages(struct page *page, int numpages, int enable);
1534
1535static inline void enable_debug_pagealloc(void)
1536{
1537 debug_pagealloc_enabled = 1;
1538}
1539#ifdef CONFIG_HIBERNATION 1544#ifdef CONFIG_HIBERNATION
1540extern bool kernel_page_present(struct page *page); 1545extern bool kernel_page_present(struct page *page);
1541#endif /* CONFIG_HIBERNATION */ 1546#endif /* CONFIG_HIBERNATION */
1542#else 1547#else
1543static inline void 1548static inline void
1544kernel_map_pages(struct page *page, int numpages, int enable) {} 1549kernel_map_pages(struct page *page, int numpages, int enable) {}
1545static inline void enable_debug_pagealloc(void)
1546{
1547}
1548#ifdef CONFIG_HIBERNATION 1550#ifdef CONFIG_HIBERNATION
1549static inline bool kernel_page_present(struct page *page) { return true; } 1551static inline bool kernel_page_present(struct page *page) { return true; }
1550#endif /* CONFIG_HIBERNATION */ 1552#endif /* CONFIG_HIBERNATION */
@@ -1618,5 +1620,22 @@ extern void copy_user_huge_page(struct page *dst, struct page *src,
1618 unsigned int pages_per_huge_page); 1620 unsigned int pages_per_huge_page);
1619#endif /* CONFIG_TRANSPARENT_HUGEPAGE || CONFIG_HUGETLBFS */ 1621#endif /* CONFIG_TRANSPARENT_HUGEPAGE || CONFIG_HUGETLBFS */
1620 1622
1623#ifdef CONFIG_DEBUG_PAGEALLOC
1624extern unsigned int _debug_guardpage_minorder;
1625
1626static inline unsigned int debug_guardpage_minorder(void)
1627{
1628 return _debug_guardpage_minorder;
1629}
1630
1631static inline bool page_is_guard(struct page *page)
1632{
1633 return test_bit(PAGE_DEBUG_FLAG_GUARD, &page->debug_flags);
1634}
1635#else
1636static inline unsigned int debug_guardpage_minorder(void) { return 0; }
1637static inline bool page_is_guard(struct page *page) { return false; }
1638#endif /* CONFIG_DEBUG_PAGEALLOC */
1639
1621#endif /* __KERNEL__ */ 1640#endif /* __KERNEL__ */
1622#endif /* _LINUX_MM_H */ 1641#endif /* _LINUX_MM_H */
diff --git a/include/linux/mm_inline.h b/include/linux/mm_inline.h
index 8f7d24712dc1..227fd3e9a9c9 100644
--- a/include/linux/mm_inline.h
+++ b/include/linux/mm_inline.h
@@ -22,26 +22,21 @@ static inline int page_is_file_cache(struct page *page)
22} 22}
23 23
24static inline void 24static inline void
25__add_page_to_lru_list(struct zone *zone, struct page *page, enum lru_list l, 25add_page_to_lru_list(struct zone *zone, struct page *page, enum lru_list lru)
26 struct list_head *head)
27{ 26{
28 list_add(&page->lru, head); 27 struct lruvec *lruvec;
29 __mod_zone_page_state(zone, NR_LRU_BASE + l, hpage_nr_pages(page));
30 mem_cgroup_add_lru_list(page, l);
31}
32 28
33static inline void 29 lruvec = mem_cgroup_lru_add_list(zone, page, lru);
34add_page_to_lru_list(struct zone *zone, struct page *page, enum lru_list l) 30 list_add(&page->lru, &lruvec->lists[lru]);
35{ 31 __mod_zone_page_state(zone, NR_LRU_BASE + lru, hpage_nr_pages(page));
36 __add_page_to_lru_list(zone, page, l, &zone->lru[l].list);
37} 32}
38 33
39static inline void 34static inline void
40del_page_from_lru_list(struct zone *zone, struct page *page, enum lru_list l) 35del_page_from_lru_list(struct zone *zone, struct page *page, enum lru_list lru)
41{ 36{
37 mem_cgroup_lru_del_list(page, lru);
42 list_del(&page->lru); 38 list_del(&page->lru);
43 __mod_zone_page_state(zone, NR_LRU_BASE + l, -hpage_nr_pages(page)); 39 __mod_zone_page_state(zone, NR_LRU_BASE + lru, -hpage_nr_pages(page));
44 mem_cgroup_del_lru_list(page, l);
45} 40}
46 41
47/** 42/**
@@ -59,24 +54,28 @@ static inline enum lru_list page_lru_base_type(struct page *page)
59 return LRU_INACTIVE_ANON; 54 return LRU_INACTIVE_ANON;
60} 55}
61 56
62static inline void 57/**
63del_page_from_lru(struct zone *zone, struct page *page) 58 * page_off_lru - which LRU list was page on? clearing its lru flags.
59 * @page: the page to test
60 *
61 * Returns the LRU list a page was on, as an index into the array of LRU
62 * lists; and clears its Unevictable or Active flags, ready for freeing.
63 */
64static inline enum lru_list page_off_lru(struct page *page)
64{ 65{
65 enum lru_list l; 66 enum lru_list lru;
66 67
67 list_del(&page->lru);
68 if (PageUnevictable(page)) { 68 if (PageUnevictable(page)) {
69 __ClearPageUnevictable(page); 69 __ClearPageUnevictable(page);
70 l = LRU_UNEVICTABLE; 70 lru = LRU_UNEVICTABLE;
71 } else { 71 } else {
72 l = page_lru_base_type(page); 72 lru = page_lru_base_type(page);
73 if (PageActive(page)) { 73 if (PageActive(page)) {
74 __ClearPageActive(page); 74 __ClearPageActive(page);
75 l += LRU_ACTIVE; 75 lru += LRU_ACTIVE;
76 } 76 }
77 } 77 }
78 __mod_zone_page_state(zone, NR_LRU_BASE + l, -hpage_nr_pages(page)); 78 return lru;
79 mem_cgroup_del_lru_list(page, l);
80} 79}
81 80
82/** 81/**
@@ -97,7 +96,6 @@ static inline enum lru_list page_lru(struct page *page)
97 if (PageActive(page)) 96 if (PageActive(page))
98 lru += LRU_ACTIVE; 97 lru += LRU_ACTIVE;
99 } 98 }
100
101 return lru; 99 return lru;
102} 100}
103 101
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index 5b42f1b34eb7..3cc3062b3767 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -151,12 +151,11 @@ struct page {
151#endif 151#endif
152} 152}
153/* 153/*
154 * If another subsystem starts using the double word pairing for atomic 154 * The struct page can be forced to be double word aligned so that atomic ops
155 * operations on struct page then it must change the #if to ensure 155 * on double words work. The SLUB allocator can make use of such a feature.
156 * proper alignment of the page struct.
157 */ 156 */
158#if defined(CONFIG_SLUB) && defined(CONFIG_CMPXCHG_LOCAL) 157#ifdef CONFIG_HAVE_ALIGNED_STRUCT_PAGE
159 __attribute__((__aligned__(2*sizeof(unsigned long)))) 158 __aligned(2 * sizeof(unsigned long))
160#endif 159#endif
161; 160;
162 161
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index c8ef9bc54d50..9f22ba572de0 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -71,6 +71,8 @@ struct mmc_ext_csd {
71 bool hpi_en; /* HPI enablebit */ 71 bool hpi_en; /* HPI enablebit */
72 bool hpi; /* HPI support bit */ 72 bool hpi; /* HPI support bit */
73 unsigned int hpi_cmd; /* cmd used as HPI */ 73 unsigned int hpi_cmd; /* cmd used as HPI */
74 unsigned int boot_ro_lock; /* ro lock support */
75 bool boot_ro_lockable;
74 u8 raw_partition_support; /* 160 */ 76 u8 raw_partition_support; /* 160 */
75 u8 raw_erased_mem_count; /* 181 */ 77 u8 raw_erased_mem_count; /* 181 */
76 u8 raw_ext_csd_structure; /* 194 */ 78 u8 raw_ext_csd_structure; /* 194 */
@@ -110,6 +112,7 @@ struct sd_ssr {
110struct sd_switch_caps { 112struct sd_switch_caps {
111 unsigned int hs_max_dtr; 113 unsigned int hs_max_dtr;
112 unsigned int uhs_max_dtr; 114 unsigned int uhs_max_dtr;
115#define HIGH_SPEED_MAX_DTR 50000000
113#define UHS_SDR104_MAX_DTR 208000000 116#define UHS_SDR104_MAX_DTR 208000000
114#define UHS_SDR50_MAX_DTR 100000000 117#define UHS_SDR50_MAX_DTR 100000000
115#define UHS_DDR50_MAX_DTR 50000000 118#define UHS_DDR50_MAX_DTR 50000000
@@ -117,11 +120,13 @@ struct sd_switch_caps {
117#define UHS_SDR12_MAX_DTR 25000000 120#define UHS_SDR12_MAX_DTR 25000000
118 unsigned int sd3_bus_mode; 121 unsigned int sd3_bus_mode;
119#define UHS_SDR12_BUS_SPEED 0 122#define UHS_SDR12_BUS_SPEED 0
123#define HIGH_SPEED_BUS_SPEED 1
120#define UHS_SDR25_BUS_SPEED 1 124#define UHS_SDR25_BUS_SPEED 1
121#define UHS_SDR50_BUS_SPEED 2 125#define UHS_SDR50_BUS_SPEED 2
122#define UHS_SDR104_BUS_SPEED 3 126#define UHS_SDR104_BUS_SPEED 3
123#define UHS_DDR50_BUS_SPEED 4 127#define UHS_DDR50_BUS_SPEED 4
124 128
129#define SD_MODE_HIGH_SPEED (1 << HIGH_SPEED_BUS_SPEED)
125#define SD_MODE_UHS_SDR12 (1 << UHS_SDR12_BUS_SPEED) 130#define SD_MODE_UHS_SDR12 (1 << UHS_SDR12_BUS_SPEED)
126#define SD_MODE_UHS_SDR25 (1 << UHS_SDR25_BUS_SPEED) 131#define SD_MODE_UHS_SDR25 (1 << UHS_SDR25_BUS_SPEED)
127#define SD_MODE_UHS_SDR50 (1 << UHS_SDR50_BUS_SPEED) 132#define SD_MODE_UHS_SDR50 (1 << UHS_SDR50_BUS_SPEED)
@@ -184,6 +189,10 @@ struct mmc_part {
184 unsigned int part_cfg; /* partition type */ 189 unsigned int part_cfg; /* partition type */
185 char name[MAX_MMC_PART_NAME_LEN]; 190 char name[MAX_MMC_PART_NAME_LEN];
186 bool force_ro; /* to make boot parts RO by default */ 191 bool force_ro; /* to make boot parts RO by default */
192 unsigned int area_type;
193#define MMC_BLK_DATA_AREA_MAIN (1<<0)
194#define MMC_BLK_DATA_AREA_BOOT (1<<1)
195#define MMC_BLK_DATA_AREA_GP (1<<2)
187}; 196};
188 197
189/* 198/*
@@ -206,6 +215,8 @@ struct mmc_card {
206#define MMC_STATE_HIGHSPEED_DDR (1<<4) /* card is in high speed mode */ 215#define MMC_STATE_HIGHSPEED_DDR (1<<4) /* card is in high speed mode */
207#define MMC_STATE_ULTRAHIGHSPEED (1<<5) /* card is in ultra high speed mode */ 216#define MMC_STATE_ULTRAHIGHSPEED (1<<5) /* card is in ultra high speed mode */
208#define MMC_CARD_SDXC (1<<6) /* card is SDXC */ 217#define MMC_CARD_SDXC (1<<6) /* card is SDXC */
218#define MMC_CARD_REMOVED (1<<7) /* card has been removed */
219#define MMC_STATE_HIGHSPEED_200 (1<<8) /* card is in HS200 mode */
209 unsigned int quirks; /* card quirks */ 220 unsigned int quirks; /* card quirks */
210#define MMC_QUIRK_LENIENT_FN0 (1<<0) /* allow SDIO FN0 writes outside of the VS CCCR range */ 221#define MMC_QUIRK_LENIENT_FN0 (1<<0) /* allow SDIO FN0 writes outside of the VS CCCR range */
211#define MMC_QUIRK_BLKSZ_FOR_BYTE_MODE (1<<1) /* use func->cur_blksize */ 222#define MMC_QUIRK_BLKSZ_FOR_BYTE_MODE (1<<1) /* use func->cur_blksize */
@@ -261,12 +272,14 @@ struct mmc_card {
261 * This function fill contents in mmc_part. 272 * This function fill contents in mmc_part.
262 */ 273 */
263static inline void mmc_part_add(struct mmc_card *card, unsigned int size, 274static inline void mmc_part_add(struct mmc_card *card, unsigned int size,
264 unsigned int part_cfg, char *name, int idx, bool ro) 275 unsigned int part_cfg, char *name, int idx, bool ro,
276 int area_type)
265{ 277{
266 card->part[card->nr_parts].size = size; 278 card->part[card->nr_parts].size = size;
267 card->part[card->nr_parts].part_cfg = part_cfg; 279 card->part[card->nr_parts].part_cfg = part_cfg;
268 sprintf(card->part[card->nr_parts].name, name, idx); 280 sprintf(card->part[card->nr_parts].name, name, idx);
269 card->part[card->nr_parts].force_ro = ro; 281 card->part[card->nr_parts].force_ro = ro;
282 card->part[card->nr_parts].area_type = area_type;
270 card->nr_parts++; 283 card->nr_parts++;
271} 284}
272 285
@@ -362,18 +375,24 @@ static inline void __maybe_unused remove_quirk(struct mmc_card *card, int data)
362#define mmc_card_present(c) ((c)->state & MMC_STATE_PRESENT) 375#define mmc_card_present(c) ((c)->state & MMC_STATE_PRESENT)
363#define mmc_card_readonly(c) ((c)->state & MMC_STATE_READONLY) 376#define mmc_card_readonly(c) ((c)->state & MMC_STATE_READONLY)
364#define mmc_card_highspeed(c) ((c)->state & MMC_STATE_HIGHSPEED) 377#define mmc_card_highspeed(c) ((c)->state & MMC_STATE_HIGHSPEED)
378#define mmc_card_hs200(c) ((c)->state & MMC_STATE_HIGHSPEED_200)
365#define mmc_card_blockaddr(c) ((c)->state & MMC_STATE_BLOCKADDR) 379#define mmc_card_blockaddr(c) ((c)->state & MMC_STATE_BLOCKADDR)
366#define mmc_card_ddr_mode(c) ((c)->state & MMC_STATE_HIGHSPEED_DDR) 380#define mmc_card_ddr_mode(c) ((c)->state & MMC_STATE_HIGHSPEED_DDR)
367#define mmc_sd_card_uhs(c) ((c)->state & MMC_STATE_ULTRAHIGHSPEED) 381#define mmc_card_uhs(c) ((c)->state & MMC_STATE_ULTRAHIGHSPEED)
382#define mmc_sd_card_uhs(c) ((c)->state & MMC_STATE_ULTRAHIGHSPEED)
368#define mmc_card_ext_capacity(c) ((c)->state & MMC_CARD_SDXC) 383#define mmc_card_ext_capacity(c) ((c)->state & MMC_CARD_SDXC)
384#define mmc_card_removed(c) ((c) && ((c)->state & MMC_CARD_REMOVED))
369 385
370#define mmc_card_set_present(c) ((c)->state |= MMC_STATE_PRESENT) 386#define mmc_card_set_present(c) ((c)->state |= MMC_STATE_PRESENT)
371#define mmc_card_set_readonly(c) ((c)->state |= MMC_STATE_READONLY) 387#define mmc_card_set_readonly(c) ((c)->state |= MMC_STATE_READONLY)
372#define mmc_card_set_highspeed(c) ((c)->state |= MMC_STATE_HIGHSPEED) 388#define mmc_card_set_highspeed(c) ((c)->state |= MMC_STATE_HIGHSPEED)
389#define mmc_card_set_hs200(c) ((c)->state |= MMC_STATE_HIGHSPEED_200)
373#define mmc_card_set_blockaddr(c) ((c)->state |= MMC_STATE_BLOCKADDR) 390#define mmc_card_set_blockaddr(c) ((c)->state |= MMC_STATE_BLOCKADDR)
374#define mmc_card_set_ddr_mode(c) ((c)->state |= MMC_STATE_HIGHSPEED_DDR) 391#define mmc_card_set_ddr_mode(c) ((c)->state |= MMC_STATE_HIGHSPEED_DDR)
392#define mmc_card_set_uhs(c) ((c)->state |= MMC_STATE_ULTRAHIGHSPEED)
375#define mmc_sd_card_set_uhs(c) ((c)->state |= MMC_STATE_ULTRAHIGHSPEED) 393#define mmc_sd_card_set_uhs(c) ((c)->state |= MMC_STATE_ULTRAHIGHSPEED)
376#define mmc_card_set_ext_capacity(c) ((c)->state |= MMC_CARD_SDXC) 394#define mmc_card_set_ext_capacity(c) ((c)->state |= MMC_CARD_SDXC)
395#define mmc_card_set_removed(c) ((c)->state |= MMC_CARD_REMOVED)
377 396
378/* 397/*
379 * Quirk add/remove for MMC products. 398 * Quirk add/remove for MMC products.
diff --git a/include/linux/mmc/cd-gpio.h b/include/linux/mmc/cd-gpio.h
new file mode 100644
index 000000000000..a8e469783318
--- /dev/null
+++ b/include/linux/mmc/cd-gpio.h
@@ -0,0 +1,19 @@
1/*
2 * Generic GPIO card-detect helper header
3 *
4 * Copyright (C) 2011, Guennadi Liakhovetski <g.liakhovetski@gmx.de>
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#ifndef MMC_CD_GPIO_H
12#define MMC_CD_GPIO_H
13
14struct mmc_host;
15int mmc_cd_gpio_request(struct mmc_host *host, unsigned int gpio,
16 unsigned int irq, unsigned long flags);
17void mmc_cd_gpio_free(struct mmc_host *host);
18
19#endif
diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h
index 174a844a5dda..87a976cc5654 100644
--- a/include/linux/mmc/core.h
+++ b/include/linux/mmc/core.h
@@ -180,6 +180,8 @@ extern int mmc_try_claim_host(struct mmc_host *host);
180 180
181extern int mmc_flush_cache(struct mmc_card *); 181extern int mmc_flush_cache(struct mmc_card *);
182 182
183extern int mmc_detect_card_removed(struct mmc_host *host);
184
183/** 185/**
184 * mmc_claim_host - exclusively claim a host 186 * mmc_claim_host - exclusively claim a host
185 * @host: mmc host to claim 187 * @host: mmc host to claim
diff --git a/include/linux/mmc/dw_mmc.h b/include/linux/mmc/dw_mmc.h
index 6dc9b80568a0..e8779c6d1759 100644
--- a/include/linux/mmc/dw_mmc.h
+++ b/include/linux/mmc/dw_mmc.h
@@ -214,6 +214,7 @@ struct dw_mci_board {
214 unsigned int bus_hz; /* Bus speed */ 214 unsigned int bus_hz; /* Bus speed */
215 215
216 unsigned int caps; /* Capabilities */ 216 unsigned int caps; /* Capabilities */
217 unsigned int caps2; /* More capabilities */
217 /* 218 /*
218 * Override fifo depth. If 0, autodetect it from the FIFOTH register, 219 * Override fifo depth. If 0, autodetect it from the FIFOTH register,
219 * but note that this may not be reliable after a bootloader has used 220 * but note that this may not be reliable after a bootloader has used
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index a3ac9c48e5de..0beba1e5e1ed 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -56,10 +56,13 @@ struct mmc_ios {
56#define MMC_TIMING_UHS_SDR50 3 56#define MMC_TIMING_UHS_SDR50 3
57#define MMC_TIMING_UHS_SDR104 4 57#define MMC_TIMING_UHS_SDR104 4
58#define MMC_TIMING_UHS_DDR50 5 58#define MMC_TIMING_UHS_DDR50 5
59#define MMC_TIMING_MMC_HS200 6
59 60
60#define MMC_SDR_MODE 0 61#define MMC_SDR_MODE 0
61#define MMC_1_2V_DDR_MODE 1 62#define MMC_1_2V_DDR_MODE 1
62#define MMC_1_8V_DDR_MODE 2 63#define MMC_1_8V_DDR_MODE 2
64#define MMC_1_2V_SDR_MODE 3
65#define MMC_1_8V_SDR_MODE 4
63 66
64 unsigned char signal_voltage; /* signalling voltage (1.8V or 3.3V) */ 67 unsigned char signal_voltage; /* signalling voltage (1.8V or 3.3V) */
65 68
@@ -148,7 +151,9 @@ struct mmc_host_ops {
148 void (*init_card)(struct mmc_host *host, struct mmc_card *card); 151 void (*init_card)(struct mmc_host *host, struct mmc_card *card);
149 152
150 int (*start_signal_voltage_switch)(struct mmc_host *host, struct mmc_ios *ios); 153 int (*start_signal_voltage_switch)(struct mmc_host *host, struct mmc_ios *ios);
151 int (*execute_tuning)(struct mmc_host *host); 154
155 /* The tuning command opcode value is different for SD and eMMC cards */
156 int (*execute_tuning)(struct mmc_host *host, u32 opcode);
152 void (*enable_preset_value)(struct mmc_host *host, bool enable); 157 void (*enable_preset_value)(struct mmc_host *host, bool enable);
153 int (*select_drive_strength)(unsigned int max_dtr, int host_drv, int card_drv); 158 int (*select_drive_strength)(unsigned int max_dtr, int host_drv, int card_drv);
154 void (*hw_reset)(struct mmc_host *host); 159 void (*hw_reset)(struct mmc_host *host);
@@ -167,6 +172,11 @@ struct mmc_async_req {
167 int (*err_check) (struct mmc_card *, struct mmc_async_req *); 172 int (*err_check) (struct mmc_card *, struct mmc_async_req *);
168}; 173};
169 174
175struct mmc_hotplug {
176 unsigned int irq;
177 void *handler_priv;
178};
179
170struct mmc_host { 180struct mmc_host {
171 struct device *parent; 181 struct device *parent;
172 struct device class_dev; 182 struct device class_dev;
@@ -242,6 +252,11 @@ struct mmc_host {
242#define MMC_CAP2_CACHE_CTRL (1 << 1) /* Allow cache control */ 252#define MMC_CAP2_CACHE_CTRL (1 << 1) /* Allow cache control */
243#define MMC_CAP2_POWEROFF_NOTIFY (1 << 2) /* Notify poweroff supported */ 253#define MMC_CAP2_POWEROFF_NOTIFY (1 << 2) /* Notify poweroff supported */
244#define MMC_CAP2_NO_MULTI_READ (1 << 3) /* Multiblock reads don't work */ 254#define MMC_CAP2_NO_MULTI_READ (1 << 3) /* Multiblock reads don't work */
255#define MMC_CAP2_NO_SLEEP_CMD (1 << 4) /* Don't allow sleep command */
256#define MMC_CAP2_HS200_1_8V_SDR (1 << 5) /* can support */
257#define MMC_CAP2_HS200_1_2V_SDR (1 << 6) /* can support */
258#define MMC_CAP2_HS200 (MMC_CAP2_HS200_1_8V_SDR | \
259 MMC_CAP2_HS200_1_2V_SDR)
245 260
246 mmc_pm_flag_t pm_caps; /* supported pm features */ 261 mmc_pm_flag_t pm_caps; /* supported pm features */
247 unsigned int power_notify_type; 262 unsigned int power_notify_type;
@@ -253,10 +268,12 @@ struct mmc_host {
253 int clk_requests; /* internal reference counter */ 268 int clk_requests; /* internal reference counter */
254 unsigned int clk_delay; /* number of MCI clk hold cycles */ 269 unsigned int clk_delay; /* number of MCI clk hold cycles */
255 bool clk_gated; /* clock gated */ 270 bool clk_gated; /* clock gated */
256 struct work_struct clk_gate_work; /* delayed clock gate */ 271 struct delayed_work clk_gate_work; /* delayed clock gate */
257 unsigned int clk_old; /* old clock value cache */ 272 unsigned int clk_old; /* old clock value cache */
258 spinlock_t clk_lock; /* lock for clk fields */ 273 spinlock_t clk_lock; /* lock for clk fields */
259 struct mutex clk_gate_mutex; /* mutex for clock gating */ 274 struct mutex clk_gate_mutex; /* mutex for clock gating */
275 struct device_attribute clkgate_delay_attr;
276 unsigned long clkgate_delay;
260#endif 277#endif
261 278
262 /* host specific block data */ 279 /* host specific block data */
@@ -297,6 +314,8 @@ struct mmc_host {
297 int claim_cnt; /* "claim" nesting count */ 314 int claim_cnt; /* "claim" nesting count */
298 315
299 struct delayed_work detect; 316 struct delayed_work detect;
317 int detect_change; /* card detect flag */
318 struct mmc_hotplug hotplug;
300 319
301 const struct mmc_bus_ops *bus_ops; /* current bus driver */ 320 const struct mmc_bus_ops *bus_ops; /* current bus driver */
302 unsigned int bus_refs; /* reference counter */ 321 unsigned int bus_refs; /* reference counter */
@@ -323,6 +342,8 @@ struct mmc_host {
323 struct fault_attr fail_mmc_request; 342 struct fault_attr fail_mmc_request;
324#endif 343#endif
325 344
345 unsigned int actual_clock; /* Actual HC clock rate */
346
326 unsigned long private[0] ____cacheline_aligned; 347 unsigned long private[0] ____cacheline_aligned;
327}; 348};
328 349
@@ -396,7 +417,7 @@ static inline void mmc_set_disable_delay(struct mmc_host *host,
396} 417}
397 418
398/* Module parameter */ 419/* Module parameter */
399extern int mmc_assume_removable; 420extern bool mmc_assume_removable;
400 421
401static inline int mmc_card_is_removable(struct mmc_host *host) 422static inline int mmc_card_is_removable(struct mmc_host *host)
402{ 423{
diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h
index 0e7135697d11..fb9f6e116e1c 100644
--- a/include/linux/mmc/mmc.h
+++ b/include/linux/mmc/mmc.h
@@ -51,6 +51,7 @@
51#define MMC_READ_SINGLE_BLOCK 17 /* adtc [31:0] data addr R1 */ 51#define MMC_READ_SINGLE_BLOCK 17 /* adtc [31:0] data addr R1 */
52#define MMC_READ_MULTIPLE_BLOCK 18 /* adtc [31:0] data addr R1 */ 52#define MMC_READ_MULTIPLE_BLOCK 18 /* adtc [31:0] data addr R1 */
53#define MMC_SEND_TUNING_BLOCK 19 /* adtc R1 */ 53#define MMC_SEND_TUNING_BLOCK 19 /* adtc R1 */
54#define MMC_SEND_TUNING_BLOCK_HS200 21 /* adtc R1 */
54 55
55 /* class 3 */ 56 /* class 3 */
56#define MMC_WRITE_DAT_UNTIL_STOP 20 /* adtc [31:0] data addr R1 */ 57#define MMC_WRITE_DAT_UNTIL_STOP 20 /* adtc [31:0] data addr R1 */
@@ -280,6 +281,7 @@ struct _mmc_csd {
280#define EXT_CSD_RST_N_FUNCTION 162 /* R/W */ 281#define EXT_CSD_RST_N_FUNCTION 162 /* R/W */
281#define EXT_CSD_SANITIZE_START 165 /* W */ 282#define EXT_CSD_SANITIZE_START 165 /* W */
282#define EXT_CSD_WR_REL_PARAM 166 /* RO */ 283#define EXT_CSD_WR_REL_PARAM 166 /* RO */
284#define EXT_CSD_BOOT_WP 173 /* R/W */
283#define EXT_CSD_ERASE_GROUP_DEF 175 /* R/W */ 285#define EXT_CSD_ERASE_GROUP_DEF 175 /* R/W */
284#define EXT_CSD_PART_CONFIG 179 /* R/W */ 286#define EXT_CSD_PART_CONFIG 179 /* R/W */
285#define EXT_CSD_ERASED_MEM_CONT 181 /* RO */ 287#define EXT_CSD_ERASED_MEM_CONT 181 /* RO */
@@ -321,6 +323,11 @@ struct _mmc_csd {
321 323
322#define EXT_CSD_WR_REL_PARAM_EN (1<<2) 324#define EXT_CSD_WR_REL_PARAM_EN (1<<2)
323 325
326#define EXT_CSD_BOOT_WP_B_PWR_WP_DIS (0x40)
327#define EXT_CSD_BOOT_WP_B_PERM_WP_DIS (0x10)
328#define EXT_CSD_BOOT_WP_B_PERM_WP_EN (0x04)
329#define EXT_CSD_BOOT_WP_B_PWR_WP_EN (0x01)
330
324#define EXT_CSD_PART_CONFIG_ACC_MASK (0x7) 331#define EXT_CSD_PART_CONFIG_ACC_MASK (0x7)
325#define EXT_CSD_PART_CONFIG_ACC_BOOT0 (0x1) 332#define EXT_CSD_PART_CONFIG_ACC_BOOT0 (0x1)
326#define EXT_CSD_PART_CONFIG_ACC_GP0 (0x4) 333#define EXT_CSD_PART_CONFIG_ACC_GP0 (0x4)
@@ -333,13 +340,76 @@ struct _mmc_csd {
333 340
334#define EXT_CSD_CARD_TYPE_26 (1<<0) /* Card can run at 26MHz */ 341#define EXT_CSD_CARD_TYPE_26 (1<<0) /* Card can run at 26MHz */
335#define EXT_CSD_CARD_TYPE_52 (1<<1) /* Card can run at 52MHz */ 342#define EXT_CSD_CARD_TYPE_52 (1<<1) /* Card can run at 52MHz */
336#define EXT_CSD_CARD_TYPE_MASK 0xF /* Mask out reserved bits */ 343#define EXT_CSD_CARD_TYPE_MASK 0x3F /* Mask out reserved bits */
337#define EXT_CSD_CARD_TYPE_DDR_1_8V (1<<2) /* Card can run at 52MHz */ 344#define EXT_CSD_CARD_TYPE_DDR_1_8V (1<<2) /* Card can run at 52MHz */
338 /* DDR mode @1.8V or 3V I/O */ 345 /* DDR mode @1.8V or 3V I/O */
339#define EXT_CSD_CARD_TYPE_DDR_1_2V (1<<3) /* Card can run at 52MHz */ 346#define EXT_CSD_CARD_TYPE_DDR_1_2V (1<<3) /* Card can run at 52MHz */
340 /* DDR mode @1.2V I/O */ 347 /* DDR mode @1.2V I/O */
341#define EXT_CSD_CARD_TYPE_DDR_52 (EXT_CSD_CARD_TYPE_DDR_1_8V \ 348#define EXT_CSD_CARD_TYPE_DDR_52 (EXT_CSD_CARD_TYPE_DDR_1_8V \
342 | EXT_CSD_CARD_TYPE_DDR_1_2V) 349 | EXT_CSD_CARD_TYPE_DDR_1_2V)
350#define EXT_CSD_CARD_TYPE_SDR_1_8V (1<<4) /* Card can run at 200MHz */
351#define EXT_CSD_CARD_TYPE_SDR_1_2V (1<<5) /* Card can run at 200MHz */
352 /* SDR mode @1.2V I/O */
353
354#define EXT_CSD_CARD_TYPE_SDR_200 (EXT_CSD_CARD_TYPE_SDR_1_8V | \
355 EXT_CSD_CARD_TYPE_SDR_1_2V)
356
357#define EXT_CSD_CARD_TYPE_SDR_ALL (EXT_CSD_CARD_TYPE_SDR_200 | \
358 EXT_CSD_CARD_TYPE_52 | \
359 EXT_CSD_CARD_TYPE_26)
360
361#define EXT_CSD_CARD_TYPE_SDR_1_2V_ALL (EXT_CSD_CARD_TYPE_SDR_1_2V | \
362 EXT_CSD_CARD_TYPE_52 | \
363 EXT_CSD_CARD_TYPE_26)
364
365#define EXT_CSD_CARD_TYPE_SDR_1_8V_ALL (EXT_CSD_CARD_TYPE_SDR_1_8V | \
366 EXT_CSD_CARD_TYPE_52 | \
367 EXT_CSD_CARD_TYPE_26)
368
369#define EXT_CSD_CARD_TYPE_SDR_1_2V_DDR_1_8V (EXT_CSD_CARD_TYPE_SDR_1_2V | \
370 EXT_CSD_CARD_TYPE_DDR_1_8V | \
371 EXT_CSD_CARD_TYPE_52 | \
372 EXT_CSD_CARD_TYPE_26)
373
374#define EXT_CSD_CARD_TYPE_SDR_1_8V_DDR_1_8V (EXT_CSD_CARD_TYPE_SDR_1_8V | \
375 EXT_CSD_CARD_TYPE_DDR_1_8V | \
376 EXT_CSD_CARD_TYPE_52 | \
377 EXT_CSD_CARD_TYPE_26)
378
379#define EXT_CSD_CARD_TYPE_SDR_1_2V_DDR_1_2V (EXT_CSD_CARD_TYPE_SDR_1_2V | \
380 EXT_CSD_CARD_TYPE_DDR_1_2V | \
381 EXT_CSD_CARD_TYPE_52 | \
382 EXT_CSD_CARD_TYPE_26)
383
384#define EXT_CSD_CARD_TYPE_SDR_1_8V_DDR_1_2V (EXT_CSD_CARD_TYPE_SDR_1_8V | \
385 EXT_CSD_CARD_TYPE_DDR_1_2V | \
386 EXT_CSD_CARD_TYPE_52 | \
387 EXT_CSD_CARD_TYPE_26)
388
389#define EXT_CSD_CARD_TYPE_SDR_1_2V_DDR_52 (EXT_CSD_CARD_TYPE_SDR_1_2V | \
390 EXT_CSD_CARD_TYPE_DDR_52 | \
391 EXT_CSD_CARD_TYPE_52 | \
392 EXT_CSD_CARD_TYPE_26)
393
394#define EXT_CSD_CARD_TYPE_SDR_1_8V_DDR_52 (EXT_CSD_CARD_TYPE_SDR_1_8V | \
395 EXT_CSD_CARD_TYPE_DDR_52 | \
396 EXT_CSD_CARD_TYPE_52 | \
397 EXT_CSD_CARD_TYPE_26)
398
399#define EXT_CSD_CARD_TYPE_SDR_ALL_DDR_1_8V (EXT_CSD_CARD_TYPE_SDR_200 | \
400 EXT_CSD_CARD_TYPE_DDR_1_8V | \
401 EXT_CSD_CARD_TYPE_52 | \
402 EXT_CSD_CARD_TYPE_26)
403
404#define EXT_CSD_CARD_TYPE_SDR_ALL_DDR_1_2V (EXT_CSD_CARD_TYPE_SDR_200 | \
405 EXT_CSD_CARD_TYPE_DDR_1_2V | \
406 EXT_CSD_CARD_TYPE_52 | \
407 EXT_CSD_CARD_TYPE_26)
408
409#define EXT_CSD_CARD_TYPE_SDR_ALL_DDR_52 (EXT_CSD_CARD_TYPE_SDR_200 | \
410 EXT_CSD_CARD_TYPE_DDR_52 | \
411 EXT_CSD_CARD_TYPE_52 | \
412 EXT_CSD_CARD_TYPE_26)
343 413
344#define EXT_CSD_BUS_WIDTH_1 0 /* Card is in 1 bit mode */ 414#define EXT_CSD_BUS_WIDTH_1 0 /* Card is in 1 bit mode */
345#define EXT_CSD_BUS_WIDTH_4 1 /* Card is in 4 bit mode */ 415#define EXT_CSD_BUS_WIDTH_4 1 /* Card is in 4 bit mode */
diff --git a/include/linux/mmc/sdhci-pci-data.h b/include/linux/mmc/sdhci-pci-data.h
new file mode 100644
index 000000000000..8959604a13d3
--- /dev/null
+++ b/include/linux/mmc/sdhci-pci-data.h
@@ -0,0 +1,18 @@
1#ifndef LINUX_MMC_SDHCI_PCI_DATA_H
2#define LINUX_MMC_SDHCI_PCI_DATA_H
3
4struct pci_dev;
5
6struct sdhci_pci_data {
7 struct pci_dev *pdev;
8 int slotno;
9 int rst_n_gpio; /* Set to -EINVAL if unused */
10 int cd_gpio; /* Set to -EINVAL if unused */
11 int (*setup)(struct sdhci_pci_data *data);
12 void (*cleanup)(struct sdhci_pci_data *data);
13};
14
15extern struct sdhci_pci_data *(*sdhci_pci_get_data)(struct pci_dev *pdev,
16 int slotno);
17
18#endif
diff --git a/include/linux/mmc/sdhci.h b/include/linux/mmc/sdhci.h
index e4b69353678d..c750f85177d9 100644
--- a/include/linux/mmc/sdhci.h
+++ b/include/linux/mmc/sdhci.h
@@ -90,8 +90,6 @@ struct sdhci_host {
90 90
91 unsigned int quirks2; /* More deviations from spec. */ 91 unsigned int quirks2; /* More deviations from spec. */
92 92
93#define SDHCI_QUIRK2_OWN_CARD_DETECTION (1<<0)
94
95 int irq; /* Device IRQ */ 93 int irq; /* Device IRQ */
96 void __iomem *ioaddr; /* Mapped address */ 94 void __iomem *ioaddr; /* Mapped address */
97 95
@@ -121,6 +119,7 @@ struct sdhci_host {
121#define SDHCI_AUTO_CMD23 (1<<7) /* Auto CMD23 support */ 119#define SDHCI_AUTO_CMD23 (1<<7) /* Auto CMD23 support */
122#define SDHCI_PV_ENABLED (1<<8) /* Preset value enabled */ 120#define SDHCI_PV_ENABLED (1<<8) /* Preset value enabled */
123#define SDHCI_SDIO_IRQ_ENABLED (1<<9) /* SDIO irq enabled */ 121#define SDHCI_SDIO_IRQ_ENABLED (1<<9) /* SDIO irq enabled */
122#define SDHCI_HS200_NEEDS_TUNING (1<<10) /* HS200 needs tuning */
124 123
125 unsigned int version; /* SDHCI spec. version */ 124 unsigned int version; /* SDHCI spec. version */
126 125
diff --git a/include/linux/mmc/sdio.h b/include/linux/mmc/sdio.h
index e0b1123497b9..c9fe66c58f8f 100644
--- a/include/linux/mmc/sdio.h
+++ b/include/linux/mmc/sdio.h
@@ -38,6 +38,7 @@
38 * [8:0] Byte/block count 38 * [8:0] Byte/block count
39 */ 39 */
40 40
41#define R4_18V_PRESENT (1<<24)
41#define R4_MEMORY_PRESENT (1 << 27) 42#define R4_MEMORY_PRESENT (1 << 27)
42 43
43/* 44/*
@@ -85,6 +86,7 @@
85#define SDIO_SD_REV_1_01 0 /* SD Physical Spec Version 1.01 */ 86#define SDIO_SD_REV_1_01 0 /* SD Physical Spec Version 1.01 */
86#define SDIO_SD_REV_1_10 1 /* SD Physical Spec Version 1.10 */ 87#define SDIO_SD_REV_1_10 1 /* SD Physical Spec Version 1.10 */
87#define SDIO_SD_REV_2_00 2 /* SD Physical Spec Version 2.00 */ 88#define SDIO_SD_REV_2_00 2 /* SD Physical Spec Version 2.00 */
89#define SDIO_SD_REV_3_00 3 /* SD Physical Spev Version 3.00 */
88 90
89#define SDIO_CCCR_IOEx 0x02 91#define SDIO_CCCR_IOEx 0x02
90#define SDIO_CCCR_IORx 0x03 92#define SDIO_CCCR_IORx 0x03
@@ -134,8 +136,31 @@
134#define SDIO_CCCR_SPEED 0x13 136#define SDIO_CCCR_SPEED 0x13
135 137
136#define SDIO_SPEED_SHS 0x01 /* Supports High-Speed mode */ 138#define SDIO_SPEED_SHS 0x01 /* Supports High-Speed mode */
137#define SDIO_SPEED_EHS 0x02 /* Enable High-Speed mode */ 139#define SDIO_SPEED_BSS_SHIFT 1
138 140#define SDIO_SPEED_BSS_MASK (7<<SDIO_SPEED_BSS_SHIFT)
141#define SDIO_SPEED_SDR12 (0<<SDIO_SPEED_BSS_SHIFT)
142#define SDIO_SPEED_SDR25 (1<<SDIO_SPEED_BSS_SHIFT)
143#define SDIO_SPEED_SDR50 (2<<SDIO_SPEED_BSS_SHIFT)
144#define SDIO_SPEED_SDR104 (3<<SDIO_SPEED_BSS_SHIFT)
145#define SDIO_SPEED_DDR50 (4<<SDIO_SPEED_BSS_SHIFT)
146#define SDIO_SPEED_EHS SDIO_SPEED_SDR25 /* Enable High-Speed */
147
148#define SDIO_CCCR_UHS 0x14
149#define SDIO_UHS_SDR50 0x01
150#define SDIO_UHS_SDR104 0x02
151#define SDIO_UHS_DDR50 0x04
152
153#define SDIO_CCCR_DRIVE_STRENGTH 0x15
154#define SDIO_SDTx_MASK 0x07
155#define SDIO_DRIVE_SDTA (1<<0)
156#define SDIO_DRIVE_SDTC (1<<1)
157#define SDIO_DRIVE_SDTD (1<<2)
158#define SDIO_DRIVE_DTSx_MASK 0x03
159#define SDIO_DRIVE_DTSx_SHIFT 4
160#define SDIO_DTSx_SET_TYPE_B (0 << SDIO_DRIVE_DTSx_SHIFT)
161#define SDIO_DTSx_SET_TYPE_A (1 << SDIO_DRIVE_DTSx_SHIFT)
162#define SDIO_DTSx_SET_TYPE_C (2 << SDIO_DRIVE_DTSx_SHIFT)
163#define SDIO_DTSx_SET_TYPE_D (3 << SDIO_DRIVE_DTSx_SHIFT)
139/* 164/*
140 * Function Basic Registers (FBR) 165 * Function Basic Registers (FBR)
141 */ 166 */
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 3ac040f19369..650ba2fb3301 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -140,25 +140,29 @@ enum lru_list {
140 NR_LRU_LISTS 140 NR_LRU_LISTS
141}; 141};
142 142
143#define for_each_lru(l) for (l = 0; l < NR_LRU_LISTS; l++) 143#define for_each_lru(lru) for (lru = 0; lru < NR_LRU_LISTS; lru++)
144 144
145#define for_each_evictable_lru(l) for (l = 0; l <= LRU_ACTIVE_FILE; l++) 145#define for_each_evictable_lru(lru) for (lru = 0; lru <= LRU_ACTIVE_FILE; lru++)
146 146
147static inline int is_file_lru(enum lru_list l) 147static inline int is_file_lru(enum lru_list lru)
148{ 148{
149 return (l == LRU_INACTIVE_FILE || l == LRU_ACTIVE_FILE); 149 return (lru == LRU_INACTIVE_FILE || lru == LRU_ACTIVE_FILE);
150} 150}
151 151
152static inline int is_active_lru(enum lru_list l) 152static inline int is_active_lru(enum lru_list lru)
153{ 153{
154 return (l == LRU_ACTIVE_ANON || l == LRU_ACTIVE_FILE); 154 return (lru == LRU_ACTIVE_ANON || lru == LRU_ACTIVE_FILE);
155} 155}
156 156
157static inline int is_unevictable_lru(enum lru_list l) 157static inline int is_unevictable_lru(enum lru_list lru)
158{ 158{
159 return (l == LRU_UNEVICTABLE); 159 return (lru == LRU_UNEVICTABLE);
160} 160}
161 161
162struct lruvec {
163 struct list_head lists[NR_LRU_LISTS];
164};
165
162/* Mask used at gathering information at once (see memcontrol.c) */ 166/* Mask used at gathering information at once (see memcontrol.c) */
163#define LRU_ALL_FILE (BIT(LRU_INACTIVE_FILE) | BIT(LRU_ACTIVE_FILE)) 167#define LRU_ALL_FILE (BIT(LRU_INACTIVE_FILE) | BIT(LRU_ACTIVE_FILE))
164#define LRU_ALL_ANON (BIT(LRU_INACTIVE_ANON) | BIT(LRU_ACTIVE_ANON)) 168#define LRU_ALL_ANON (BIT(LRU_INACTIVE_ANON) | BIT(LRU_ACTIVE_ANON))
@@ -173,6 +177,8 @@ static inline int is_unevictable_lru(enum lru_list l)
173#define ISOLATE_CLEAN ((__force isolate_mode_t)0x4) 177#define ISOLATE_CLEAN ((__force isolate_mode_t)0x4)
174/* Isolate unmapped file */ 178/* Isolate unmapped file */
175#define ISOLATE_UNMAPPED ((__force isolate_mode_t)0x8) 179#define ISOLATE_UNMAPPED ((__force isolate_mode_t)0x8)
180/* Isolate for asynchronous migration */
181#define ISOLATE_ASYNC_MIGRATE ((__force isolate_mode_t)0x10)
176 182
177/* LRU Isolation modes. */ 183/* LRU Isolation modes. */
178typedef unsigned __bitwise__ isolate_mode_t; 184typedef unsigned __bitwise__ isolate_mode_t;
@@ -317,6 +323,12 @@ struct zone {
317 */ 323 */
318 unsigned long lowmem_reserve[MAX_NR_ZONES]; 324 unsigned long lowmem_reserve[MAX_NR_ZONES];
319 325
326 /*
327 * This is a per-zone reserve of pages that should not be
328 * considered dirtyable memory.
329 */
330 unsigned long dirty_balance_reserve;
331
320#ifdef CONFIG_NUMA 332#ifdef CONFIG_NUMA
321 int node; 333 int node;
322 /* 334 /*
@@ -358,10 +370,8 @@ struct zone {
358 ZONE_PADDING(_pad1_) 370 ZONE_PADDING(_pad1_)
359 371
360 /* Fields commonly accessed by the page reclaim scanner */ 372 /* Fields commonly accessed by the page reclaim scanner */
361 spinlock_t lru_lock; 373 spinlock_t lru_lock;
362 struct zone_lru { 374 struct lruvec lruvec;
363 struct list_head list;
364 } lru[NR_LRU_LISTS];
365 375
366 struct zone_reclaim_stat reclaim_stat; 376 struct zone_reclaim_stat reclaim_stat;
367 377
diff --git a/include/linux/module.h b/include/linux/module.h
index 3cb7839a60b9..4598bf03e98b 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -205,6 +205,20 @@ enum module_state
205 MODULE_STATE_GOING, 205 MODULE_STATE_GOING,
206}; 206};
207 207
208/**
209 * struct module_ref - per cpu module reference counts
210 * @incs: number of module get on this cpu
211 * @decs: number of module put on this cpu
212 *
213 * We force an alignment on 8 or 16 bytes, so that alloc_percpu()
214 * put @incs/@decs in same cache line, with no extra memory cost,
215 * since alloc_percpu() is fine grained.
216 */
217struct module_ref {
218 unsigned long incs;
219 unsigned long decs;
220} __attribute((aligned(2 * sizeof(unsigned long))));
221
208struct module 222struct module
209{ 223{
210 enum module_state state; 224 enum module_state state;
@@ -347,10 +361,7 @@ struct module
347 /* Destruction function. */ 361 /* Destruction function. */
348 void (*exit)(void); 362 void (*exit)(void);
349 363
350 struct module_ref { 364 struct module_ref __percpu *refptr;
351 unsigned int incs;
352 unsigned int decs;
353 } __percpu *refptr;
354#endif 365#endif
355 366
356#ifdef CONFIG_CONSTRUCTORS 367#ifdef CONFIG_CONSTRUCTORS
@@ -434,7 +445,7 @@ extern void __module_put_and_exit(struct module *mod, long code)
434#define module_put_and_exit(code) __module_put_and_exit(THIS_MODULE, code); 445#define module_put_and_exit(code) __module_put_and_exit(THIS_MODULE, code);
435 446
436#ifdef CONFIG_MODULE_UNLOAD 447#ifdef CONFIG_MODULE_UNLOAD
437unsigned int module_refcount(struct module *mod); 448unsigned long module_refcount(struct module *mod);
438void __symbol_put(const char *symbol); 449void __symbol_put(const char *symbol);
439#define symbol_put(x) __symbol_put(MODULE_SYMBOL_PREFIX #x) 450#define symbol_put(x) __symbol_put(MODULE_SYMBOL_PREFIX #x)
440void symbol_put_addr(void *addr); 451void symbol_put_addr(void *addr);
diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h
index 7939f636c8ba..c47f4d60db0b 100644
--- a/include/linux/moduleparam.h
+++ b/include/linux/moduleparam.h
@@ -350,23 +350,23 @@ extern int param_set_charp(const char *val, const struct kernel_param *kp);
350extern int param_get_charp(char *buffer, const struct kernel_param *kp); 350extern int param_get_charp(char *buffer, const struct kernel_param *kp);
351#define param_check_charp(name, p) __param_check(name, p, char *) 351#define param_check_charp(name, p) __param_check(name, p, char *)
352 352
353/* For historical reasons "bool" parameters can be (unsigned) "int". */ 353/* We used to allow int as well as bool. We're taking that away! */
354extern struct kernel_param_ops param_ops_bool; 354extern struct kernel_param_ops param_ops_bool;
355extern int param_set_bool(const char *val, const struct kernel_param *kp); 355extern int param_set_bool(const char *val, const struct kernel_param *kp);
356extern int param_get_bool(char *buffer, const struct kernel_param *kp); 356extern int param_get_bool(char *buffer, const struct kernel_param *kp);
357#define param_check_bool(name, p) \ 357#define param_check_bool(name, p) __param_check(name, p, bool)
358 static inline void __check_##name(void) \
359 { \
360 BUILD_BUG_ON(!__same_type((p), bool *) && \
361 !__same_type((p), unsigned int *) && \
362 !__same_type((p), int *)); \
363 }
364 358
365extern struct kernel_param_ops param_ops_invbool; 359extern struct kernel_param_ops param_ops_invbool;
366extern int param_set_invbool(const char *val, const struct kernel_param *kp); 360extern int param_set_invbool(const char *val, const struct kernel_param *kp);
367extern int param_get_invbool(char *buffer, const struct kernel_param *kp); 361extern int param_get_invbool(char *buffer, const struct kernel_param *kp);
368#define param_check_invbool(name, p) __param_check(name, p, bool) 362#define param_check_invbool(name, p) __param_check(name, p, bool)
369 363
364/* An int, which can only be set like a bool (though it shows as an int). */
365extern struct kernel_param_ops param_ops_bint;
366extern int param_set_bint(const char *val, const struct kernel_param *kp);
367#define param_get_bint param_get_int
368#define param_check_bint param_check_int
369
370/** 370/**
371 * module_param_array - a parameter which is an array of some type 371 * module_param_array - a parameter which is an array of some type
372 * @name: the name of the array variable 372 * @name: the name of the array variable
@@ -395,6 +395,7 @@ extern int param_get_invbool(char *buffer, const struct kernel_param *kp);
395 * module_param_named() for why this might be necessary. 395 * module_param_named() for why this might be necessary.
396 */ 396 */
397#define module_param_array_named(name, array, type, nump, perm) \ 397#define module_param_array_named(name, array, type, nump, perm) \
398 param_check_##type(name, &(array)[0]); \
398 static const struct kparam_array __param_arr_##name \ 399 static const struct kparam_array __param_arr_##name \
399 = { .max = ARRAY_SIZE(array), .num = nump, \ 400 = { .max = ARRAY_SIZE(array), .num = nump, \
400 .ops = &param_ops_##type, \ 401 .ops = &param_ops_##type, \
diff --git a/include/linux/mpi.h b/include/linux/mpi.h
new file mode 100644
index 000000000000..d02cca6cc8ce
--- /dev/null
+++ b/include/linux/mpi.h
@@ -0,0 +1,144 @@
1/* mpi.h - Multi Precision Integers
2 * Copyright (C) 1994, 1996, 1998, 1999,
3 * 2000, 2001 Free Software Foundation, Inc.
4 *
5 * This file is part of GNUPG.
6 *
7 * GNUPG is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * GNUPG is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
20 *
21 * Note: This code is heavily based on the GNU MP Library.
22 * Actually it's the same code with only minor changes in the
23 * way the data is stored; this is to support the abstraction
24 * of an optional secure memory allocation which may be used
25 * to avoid revealing of sensitive data due to paging etc.
26 * The GNU MP Library itself is published under the LGPL;
27 * however I decided to publish this code under the plain GPL.
28 */
29
30#ifndef G10_MPI_H
31#define G10_MPI_H
32
33#include <linux/types.h>
34
35/* DSI defines */
36
37#define SHA1_DIGEST_LENGTH 20
38
39/*end of DSI defines */
40
41#define BYTES_PER_MPI_LIMB (BITS_PER_LONG / 8)
42#define BITS_PER_MPI_LIMB BITS_PER_LONG
43
44typedef unsigned long int mpi_limb_t;
45typedef signed long int mpi_limb_signed_t;
46
47struct gcry_mpi {
48 int alloced; /* array size (# of allocated limbs) */
49 int nlimbs; /* number of valid limbs */
50 int nbits; /* the real number of valid bits (info only) */
51 int sign; /* indicates a negative number */
52 unsigned flags; /* bit 0: array must be allocated in secure memory space */
53 /* bit 1: not used */
54 /* bit 2: the limb is a pointer to some m_alloced data */
55 mpi_limb_t *d; /* array with the limbs */
56};
57
58typedef struct gcry_mpi *MPI;
59
60#define mpi_get_nlimbs(a) ((a)->nlimbs)
61#define mpi_is_neg(a) ((a)->sign)
62
63/*-- mpiutil.c --*/
64MPI mpi_alloc(unsigned nlimbs);
65MPI mpi_alloc_secure(unsigned nlimbs);
66MPI mpi_alloc_like(MPI a);
67void mpi_free(MPI a);
68int mpi_resize(MPI a, unsigned nlimbs);
69int mpi_copy(MPI *copy, const MPI a);
70void mpi_clear(MPI a);
71int mpi_set(MPI w, MPI u);
72int mpi_set_ui(MPI w, ulong u);
73MPI mpi_alloc_set_ui(unsigned long u);
74void mpi_m_check(MPI a);
75void mpi_swap(MPI a, MPI b);
76
77/*-- mpicoder.c --*/
78MPI do_encode_md(const void *sha_buffer, unsigned nbits);
79MPI mpi_read_from_buffer(const void *buffer, unsigned *ret_nread);
80int mpi_fromstr(MPI val, const char *str);
81u32 mpi_get_keyid(MPI a, u32 *keyid);
82void *mpi_get_buffer(MPI a, unsigned *nbytes, int *sign);
83void *mpi_get_secure_buffer(MPI a, unsigned *nbytes, int *sign);
84int mpi_set_buffer(MPI a, const void *buffer, unsigned nbytes, int sign);
85
86#define log_mpidump g10_log_mpidump
87
88/*-- mpi-add.c --*/
89int mpi_add_ui(MPI w, MPI u, ulong v);
90int mpi_add(MPI w, MPI u, MPI v);
91int mpi_addm(MPI w, MPI u, MPI v, MPI m);
92int mpi_sub_ui(MPI w, MPI u, ulong v);
93int mpi_sub(MPI w, MPI u, MPI v);
94int mpi_subm(MPI w, MPI u, MPI v, MPI m);
95
96/*-- mpi-mul.c --*/
97int mpi_mul_ui(MPI w, MPI u, ulong v);
98int mpi_mul_2exp(MPI w, MPI u, ulong cnt);
99int mpi_mul(MPI w, MPI u, MPI v);
100int mpi_mulm(MPI w, MPI u, MPI v, MPI m);
101
102/*-- mpi-div.c --*/
103ulong mpi_fdiv_r_ui(MPI rem, MPI dividend, ulong divisor);
104int mpi_fdiv_r(MPI rem, MPI dividend, MPI divisor);
105int mpi_fdiv_q(MPI quot, MPI dividend, MPI divisor);
106int mpi_fdiv_qr(MPI quot, MPI rem, MPI dividend, MPI divisor);
107int mpi_tdiv_r(MPI rem, MPI num, MPI den);
108int mpi_tdiv_qr(MPI quot, MPI rem, MPI num, MPI den);
109int mpi_tdiv_q_2exp(MPI w, MPI u, unsigned count);
110int mpi_divisible_ui(const MPI dividend, ulong divisor);
111
112/*-- mpi-gcd.c --*/
113int mpi_gcd(MPI g, const MPI a, const MPI b);
114
115/*-- mpi-pow.c --*/
116int mpi_pow(MPI w, MPI u, MPI v);
117int mpi_powm(MPI res, MPI base, MPI exp, MPI mod);
118
119/*-- mpi-mpow.c --*/
120int mpi_mulpowm(MPI res, MPI *basearray, MPI *exparray, MPI mod);
121
122/*-- mpi-cmp.c --*/
123int mpi_cmp_ui(MPI u, ulong v);
124int mpi_cmp(MPI u, MPI v);
125
126/*-- mpi-scan.c --*/
127int mpi_getbyte(MPI a, unsigned idx);
128void mpi_putbyte(MPI a, unsigned idx, int value);
129unsigned mpi_trailing_zeros(MPI a);
130
131/*-- mpi-bit.c --*/
132void mpi_normalize(MPI a);
133unsigned mpi_get_nbits(MPI a);
134int mpi_test_bit(MPI a, unsigned n);
135int mpi_set_bit(MPI a, unsigned n);
136int mpi_set_highbit(MPI a, unsigned n);
137void mpi_clear_highbit(MPI a, unsigned n);
138void mpi_clear_bit(MPI a, unsigned n);
139int mpi_rshift(MPI x, MPI a, unsigned n);
140
141/*-- mpi-inv.c --*/
142int mpi_invm(MPI x, MPI u, MPI v);
143
144#endif /*G10_MPI_H */
diff --git a/include/linux/mroute6.h b/include/linux/mroute6.h
index a3759cb0ac10..6d8c7251eb8d 100644
--- a/include/linux/mroute6.h
+++ b/include/linux/mroute6.h
@@ -43,9 +43,11 @@ typedef unsigned short mifi_t;
43typedef __u32 if_mask; 43typedef __u32 if_mask;
44#define NIFBITS (sizeof(if_mask) * 8) /* bits per mask */ 44#define NIFBITS (sizeof(if_mask) * 8) /* bits per mask */
45 45
46#if !defined(__KERNEL__) && !defined(DIV_ROUND_UP) 46#if !defined(__KERNEL__)
47#if !defined(DIV_ROUND_UP)
47#define DIV_ROUND_UP(x,y) (((x) + ((y) - 1)) / (y)) 48#define DIV_ROUND_UP(x,y) (((x) + ((y) - 1)) / (y))
48#endif 49#endif
50#endif
49 51
50typedef struct if_set { 52typedef struct if_set {
51 if_mask ifs_bits[DIV_ROUND_UP(IF_SETSIZE, NIFBITS)]; 53 if_mask ifs_bits[DIV_ROUND_UP(IF_SETSIZE, NIFBITS)];
diff --git a/include/linux/msi.h b/include/linux/msi.h
index 05acced439a3..ce93a341337d 100644
--- a/include/linux/msi.h
+++ b/include/linux/msi.h
@@ -1,6 +1,7 @@
1#ifndef LINUX_MSI_H 1#ifndef LINUX_MSI_H
2#define LINUX_MSI_H 2#define LINUX_MSI_H
3 3
4#include <linux/kobject.h>
4#include <linux/list.h> 5#include <linux/list.h>
5 6
6struct msi_msg { 7struct msi_msg {
@@ -44,6 +45,8 @@ struct msi_desc {
44 45
45 /* Last set MSI message */ 46 /* Last set MSI message */
46 struct msi_msg msg; 47 struct msi_msg msg;
48
49 struct kobject kobj;
47}; 50};
48 51
49/* 52/*
diff --git a/include/linux/mtd/cfi.h b/include/linux/mtd/cfi.h
index d24925492972..d5d2ec6494bb 100644
--- a/include/linux/mtd/cfi.h
+++ b/include/linux/mtd/cfi.h
@@ -354,10 +354,10 @@ static inline map_word cfi_build_cmd(u_long cmd, struct map_info *map, struct cf
354 onecmd = cmd; 354 onecmd = cmd;
355 break; 355 break;
356 case 2: 356 case 2:
357 onecmd = cpu_to_cfi16(cmd); 357 onecmd = cpu_to_cfi16(map, cmd);
358 break; 358 break;
359 case 4: 359 case 4:
360 onecmd = cpu_to_cfi32(cmd); 360 onecmd = cpu_to_cfi32(map, cmd);
361 break; 361 break;
362 } 362 }
363 363
@@ -437,10 +437,10 @@ static inline unsigned long cfi_merge_status(map_word val, struct map_info *map,
437 case 1: 437 case 1:
438 break; 438 break;
439 case 2: 439 case 2:
440 res = cfi16_to_cpu(res); 440 res = cfi16_to_cpu(map, res);
441 break; 441 break;
442 case 4: 442 case 4:
443 res = cfi32_to_cpu(res); 443 res = cfi32_to_cpu(map, res);
444 break; 444 break;
445 default: BUG(); 445 default: BUG();
446 } 446 }
@@ -480,12 +480,12 @@ static inline uint8_t cfi_read_query(struct map_info *map, uint32_t addr)
480 if (map_bankwidth_is_1(map)) { 480 if (map_bankwidth_is_1(map)) {
481 return val.x[0]; 481 return val.x[0];
482 } else if (map_bankwidth_is_2(map)) { 482 } else if (map_bankwidth_is_2(map)) {
483 return cfi16_to_cpu(val.x[0]); 483 return cfi16_to_cpu(map, val.x[0]);
484 } else { 484 } else {
485 /* No point in a 64-bit byteswap since that would just be 485 /* No point in a 64-bit byteswap since that would just be
486 swapping the responses from different chips, and we are 486 swapping the responses from different chips, and we are
487 only interested in one chip (a representative sample) */ 487 only interested in one chip (a representative sample) */
488 return cfi32_to_cpu(val.x[0]); 488 return cfi32_to_cpu(map, val.x[0]);
489 } 489 }
490} 490}
491 491
@@ -496,12 +496,12 @@ static inline uint16_t cfi_read_query16(struct map_info *map, uint32_t addr)
496 if (map_bankwidth_is_1(map)) { 496 if (map_bankwidth_is_1(map)) {
497 return val.x[0] & 0xff; 497 return val.x[0] & 0xff;
498 } else if (map_bankwidth_is_2(map)) { 498 } else if (map_bankwidth_is_2(map)) {
499 return cfi16_to_cpu(val.x[0]); 499 return cfi16_to_cpu(map, val.x[0]);
500 } else { 500 } else {
501 /* No point in a 64-bit byteswap since that would just be 501 /* No point in a 64-bit byteswap since that would just be
502 swapping the responses from different chips, and we are 502 swapping the responses from different chips, and we are
503 only interested in one chip (a representative sample) */ 503 only interested in one chip (a representative sample) */
504 return cfi32_to_cpu(val.x[0]); 504 return cfi32_to_cpu(map, val.x[0]);
505 } 505 }
506} 506}
507 507
diff --git a/include/linux/mtd/cfi_endian.h b/include/linux/mtd/cfi_endian.h
index 51cc3f5917a8..b97a625071f8 100644
--- a/include/linux/mtd/cfi_endian.h
+++ b/include/linux/mtd/cfi_endian.h
@@ -19,53 +19,35 @@
19 19
20#include <asm/byteorder.h> 20#include <asm/byteorder.h>
21 21
22#ifndef CONFIG_MTD_CFI_ADV_OPTIONS 22#define CFI_HOST_ENDIAN 1
23 23#define CFI_LITTLE_ENDIAN 2
24#define CFI_HOST_ENDIAN 24#define CFI_BIG_ENDIAN 3
25 25
26#else 26#if !defined(CONFIG_MTD_CFI_ADV_OPTIONS) || defined(CONFIG_MTD_CFI_NOSWAP)
27 27#define CFI_DEFAULT_ENDIAN CFI_HOST_ENDIAN
28#ifdef CONFIG_MTD_CFI_NOSWAP 28#elif defined(CONFIG_MTD_CFI_LE_BYTE_SWAP)
29#define CFI_HOST_ENDIAN 29#define CFI_DEFAULT_ENDIAN CFI_LITTLE_ENDIAN
30#endif 30#elif defined(CONFIG_MTD_CFI_BE_BYTE_SWAP)
31 31#define CFI_DEFAULT_ENDIAN CFI_BIG_ENDIAN
32#ifdef CONFIG_MTD_CFI_LE_BYTE_SWAP
33#define CFI_LITTLE_ENDIAN
34#endif
35
36#ifdef CONFIG_MTD_CFI_BE_BYTE_SWAP
37#define CFI_BIG_ENDIAN
38#endif
39
40#endif
41
42#if defined(CFI_LITTLE_ENDIAN)
43#define cpu_to_cfi8(x) (x)
44#define cfi8_to_cpu(x) (x)
45#define cpu_to_cfi16(x) cpu_to_le16(x)
46#define cpu_to_cfi32(x) cpu_to_le32(x)
47#define cpu_to_cfi64(x) cpu_to_le64(x)
48#define cfi16_to_cpu(x) le16_to_cpu(x)
49#define cfi32_to_cpu(x) le32_to_cpu(x)
50#define cfi64_to_cpu(x) le64_to_cpu(x)
51#elif defined (CFI_BIG_ENDIAN)
52#define cpu_to_cfi8(x) (x)
53#define cfi8_to_cpu(x) (x)
54#define cpu_to_cfi16(x) cpu_to_be16(x)
55#define cpu_to_cfi32(x) cpu_to_be32(x)
56#define cpu_to_cfi64(x) cpu_to_be64(x)
57#define cfi16_to_cpu(x) be16_to_cpu(x)
58#define cfi32_to_cpu(x) be32_to_cpu(x)
59#define cfi64_to_cpu(x) be64_to_cpu(x)
60#elif defined (CFI_HOST_ENDIAN)
61#define cpu_to_cfi8(x) (x)
62#define cfi8_to_cpu(x) (x)
63#define cpu_to_cfi16(x) (x)
64#define cpu_to_cfi32(x) (x)
65#define cpu_to_cfi64(x) (x)
66#define cfi16_to_cpu(x) (x)
67#define cfi32_to_cpu(x) (x)
68#define cfi64_to_cpu(x) (x)
69#else 32#else
70#error No CFI endianness defined 33#error No CFI endianness defined
71#endif 34#endif
35
36#define cfi_default(s) ((s)?:CFI_DEFAULT_ENDIAN)
37#define cfi_be(s) (cfi_default(s) == CFI_BIG_ENDIAN)
38#define cfi_le(s) (cfi_default(s) == CFI_LITTLE_ENDIAN)
39#define cfi_host(s) (cfi_default(s) == CFI_HOST_ENDIAN)
40
41#define cpu_to_cfi8(map, x) (x)
42#define cfi8_to_cpu(map, x) (x)
43#define cpu_to_cfi16(map, x) _cpu_to_cfi(16, (map)->swap, (x))
44#define cpu_to_cfi32(map, x) _cpu_to_cfi(32, (map)->swap, (x))
45#define cpu_to_cfi64(map, x) _cpu_to_cfi(64, (map)->swap, (x))
46#define cfi16_to_cpu(map, x) _cfi_to_cpu(16, (map)->swap, (x))
47#define cfi32_to_cpu(map, x) _cfi_to_cpu(32, (map)->swap, (x))
48#define cfi64_to_cpu(map, x) _cfi_to_cpu(64, (map)->swap, (x))
49
50#define _cpu_to_cfi(w, s, x) (cfi_host(s)?(x):_swap_to_cfi(w, s, x))
51#define _cfi_to_cpu(w, s, x) (cfi_host(s)?(x):_swap_to_cpu(w, s, x))
52#define _swap_to_cfi(w, s, x) (cfi_be(s)?cpu_to_be##w(x):cpu_to_le##w(x))
53#define _swap_to_cpu(w, s, x) (cfi_be(s)?be##w##_to_cpu(x):le##w##_to_cpu(x))
diff --git a/include/linux/mtd/gpmi-nand.h b/include/linux/mtd/gpmi-nand.h
new file mode 100644
index 000000000000..69b6dbf46b5e
--- /dev/null
+++ b/include/linux/mtd/gpmi-nand.h
@@ -0,0 +1,68 @@
1/*
2 * Copyright (C) 2011 Freescale Semiconductor, Inc. All Rights Reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (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 along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 */
18
19#ifndef __MACH_MXS_GPMI_NAND_H__
20#define __MACH_MXS_GPMI_NAND_H__
21
22/* The size of the resources is fixed. */
23#define GPMI_NAND_RES_SIZE 6
24
25/* Resource names for the GPMI NAND driver. */
26#define GPMI_NAND_GPMI_REGS_ADDR_RES_NAME "GPMI NAND GPMI Registers"
27#define GPMI_NAND_GPMI_INTERRUPT_RES_NAME "GPMI NAND GPMI Interrupt"
28#define GPMI_NAND_BCH_REGS_ADDR_RES_NAME "GPMI NAND BCH Registers"
29#define GPMI_NAND_BCH_INTERRUPT_RES_NAME "GPMI NAND BCH Interrupt"
30#define GPMI_NAND_DMA_CHANNELS_RES_NAME "GPMI NAND DMA Channels"
31#define GPMI_NAND_DMA_INTERRUPT_RES_NAME "GPMI NAND DMA Interrupt"
32
33/**
34 * struct gpmi_nand_platform_data - GPMI NAND driver platform data.
35 *
36 * This structure communicates platform-specific information to the GPMI NAND
37 * driver that can't be expressed as resources.
38 *
39 * @platform_init: A pointer to a function the driver will call to
40 * initialize the platform (e.g., set up the pin mux).
41 * @min_prop_delay_in_ns: Minimum propagation delay of GPMI signals to and
42 * from the NAND Flash device, in nanoseconds.
43 * @max_prop_delay_in_ns: Maximum propagation delay of GPMI signals to and
44 * from the NAND Flash device, in nanoseconds.
45 * @max_chip_count: The maximum number of chips for which the driver
46 * should configure the hardware. This value most
47 * likely reflects the number of pins that are
48 * connected to a NAND Flash device. If this is
49 * greater than the SoC hardware can support, the
50 * driver will print a message and fail to initialize.
51 * @partitions: An optional pointer to an array of partition
52 * descriptions.
53 * @partition_count: The number of elements in the partitions array.
54 */
55struct gpmi_nand_platform_data {
56 /* SoC hardware information. */
57 int (*platform_init)(void);
58
59 /* NAND Flash information. */
60 unsigned int min_prop_delay_in_ns;
61 unsigned int max_prop_delay_in_ns;
62 unsigned int max_chip_count;
63
64 /* Medium information. */
65 struct mtd_partition *partitions;
66 unsigned partition_count;
67};
68#endif
diff --git a/include/linux/mtd/map.h b/include/linux/mtd/map.h
index a9e6ba46865e..94e924e2ecd5 100644
--- a/include/linux/mtd/map.h
+++ b/include/linux/mtd/map.h
@@ -26,7 +26,7 @@
26#include <linux/list.h> 26#include <linux/list.h>
27#include <linux/string.h> 27#include <linux/string.h>
28#include <linux/bug.h> 28#include <linux/bug.h>
29 29#include <linux/kernel.h>
30 30
31#include <asm/unaligned.h> 31#include <asm/unaligned.h>
32#include <asm/system.h> 32#include <asm/system.h>
@@ -214,6 +214,7 @@ struct map_info {
214 void __iomem *virt; 214 void __iomem *virt;
215 void *cached; 215 void *cached;
216 216
217 int swap; /* this mapping's byte-swapping requirement */
217 int bankwidth; /* in octets. This isn't necessarily the width 218 int bankwidth; /* in octets. This isn't necessarily the width
218 of actual bus cycles -- it's the repeat interval 219 of actual bus cycles -- it's the repeat interval
219 in bytes, before you are talking to the first chip again. 220 in bytes, before you are talking to the first chip again.
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index 9f5b312af783..887ebe318c75 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -171,87 +171,60 @@ struct mtd_info {
171 struct mtd_erase_region_info *eraseregions; 171 struct mtd_erase_region_info *eraseregions;
172 172
173 /* 173 /*
174 * Erase is an asynchronous operation. Device drivers are supposed 174 * Do not call via these pointers, use corresponding mtd_*()
175 * to call instr->callback() whenever the operation completes, even 175 * wrappers instead.
176 * if it completes with a failure.
177 * Callers are supposed to pass a callback function and wait for it
178 * to be called before writing to the block.
179 */ 176 */
180 int (*erase) (struct mtd_info *mtd, struct erase_info *instr); 177 int (*erase) (struct mtd_info *mtd, struct erase_info *instr);
181
182 /* This stuff for eXecute-In-Place */
183 /* phys is optional and may be set to NULL */
184 int (*point) (struct mtd_info *mtd, loff_t from, size_t len, 178 int (*point) (struct mtd_info *mtd, loff_t from, size_t len,
185 size_t *retlen, void **virt, resource_size_t *phys); 179 size_t *retlen, void **virt, resource_size_t *phys);
186
187 /* We probably shouldn't allow XIP if the unpoint isn't a NULL */
188 void (*unpoint) (struct mtd_info *mtd, loff_t from, size_t len); 180 void (*unpoint) (struct mtd_info *mtd, loff_t from, size_t len);
189
190 /* Allow NOMMU mmap() to directly map the device (if not NULL)
191 * - return the address to which the offset maps
192 * - return -ENOSYS to indicate refusal to do the mapping
193 */
194 unsigned long (*get_unmapped_area) (struct mtd_info *mtd, 181 unsigned long (*get_unmapped_area) (struct mtd_info *mtd,
195 unsigned long len, 182 unsigned long len,
196 unsigned long offset, 183 unsigned long offset,
197 unsigned long flags); 184 unsigned long flags);
198 185 int (*read) (struct mtd_info *mtd, loff_t from, size_t len,
199 /* Backing device capabilities for this device 186 size_t *retlen, u_char *buf);
200 * - provides mmap capabilities 187 int (*write) (struct mtd_info *mtd, loff_t to, size_t len,
201 */ 188 size_t *retlen, const u_char *buf);
202 struct backing_dev_info *backing_dev_info; 189 int (*panic_write) (struct mtd_info *mtd, loff_t to, size_t len,
203 190 size_t *retlen, const u_char *buf);
204
205 int (*read) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf);
206 int (*write) (struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, const u_char *buf);
207
208 /* In blackbox flight recorder like scenarios we want to make successful
209 writes in interrupt context. panic_write() is only intended to be
210 called when its known the kernel is about to panic and we need the
211 write to succeed. Since the kernel is not going to be running for much
212 longer, this function can break locks and delay to ensure the write
213 succeeds (but not sleep). */
214
215 int (*panic_write) (struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, const u_char *buf);
216
217 int (*read_oob) (struct mtd_info *mtd, loff_t from, 191 int (*read_oob) (struct mtd_info *mtd, loff_t from,
218 struct mtd_oob_ops *ops); 192 struct mtd_oob_ops *ops);
219 int (*write_oob) (struct mtd_info *mtd, loff_t to, 193 int (*write_oob) (struct mtd_info *mtd, loff_t to,
220 struct mtd_oob_ops *ops); 194 struct mtd_oob_ops *ops);
221 195 int (*get_fact_prot_info) (struct mtd_info *mtd, struct otp_info *buf,
222 /* 196 size_t len);
223 * Methods to access the protection register area, present in some 197 int (*read_fact_prot_reg) (struct mtd_info *mtd, loff_t from,
224 * flash devices. The user data is one time programmable but the 198 size_t len, size_t *retlen, u_char *buf);
225 * factory data is read only. 199 int (*get_user_prot_info) (struct mtd_info *mtd, struct otp_info *buf,
226 */ 200 size_t len);
227 int (*get_fact_prot_info) (struct mtd_info *mtd, struct otp_info *buf, size_t len); 201 int (*read_user_prot_reg) (struct mtd_info *mtd, loff_t from,
228 int (*read_fact_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); 202 size_t len, size_t *retlen, u_char *buf);
229 int (*get_user_prot_info) (struct mtd_info *mtd, struct otp_info *buf, size_t len); 203 int (*write_user_prot_reg) (struct mtd_info *mtd, loff_t to, size_t len,
230 int (*read_user_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); 204 size_t *retlen, u_char *buf);
231 int (*write_user_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); 205 int (*lock_user_prot_reg) (struct mtd_info *mtd, loff_t from,
232 int (*lock_user_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len); 206 size_t len);
233 207 int (*writev) (struct mtd_info *mtd, const struct kvec *vecs,
234 /* kvec-based read/write methods. 208 unsigned long count, loff_t to, size_t *retlen);
235 NB: The 'count' parameter is the number of _vectors_, each of
236 which contains an (ofs, len) tuple.
237 */
238 int (*writev) (struct mtd_info *mtd, const struct kvec *vecs, unsigned long count, loff_t to, size_t *retlen);
239
240 /* Sync */
241 void (*sync) (struct mtd_info *mtd); 209 void (*sync) (struct mtd_info *mtd);
242
243 /* Chip-supported device locking */
244 int (*lock) (struct mtd_info *mtd, loff_t ofs, uint64_t len); 210 int (*lock) (struct mtd_info *mtd, loff_t ofs, uint64_t len);
245 int (*unlock) (struct mtd_info *mtd, loff_t ofs, uint64_t len); 211 int (*unlock) (struct mtd_info *mtd, loff_t ofs, uint64_t len);
246 int (*is_locked) (struct mtd_info *mtd, loff_t ofs, uint64_t len); 212 int (*is_locked) (struct mtd_info *mtd, loff_t ofs, uint64_t len);
247 213 int (*block_isbad) (struct mtd_info *mtd, loff_t ofs);
248 /* Power Management functions */ 214 int (*block_markbad) (struct mtd_info *mtd, loff_t ofs);
249 int (*suspend) (struct mtd_info *mtd); 215 int (*suspend) (struct mtd_info *mtd);
250 void (*resume) (struct mtd_info *mtd); 216 void (*resume) (struct mtd_info *mtd);
217 /*
218 * If the driver is something smart, like UBI, it may need to maintain
219 * its own reference counting. The below functions are only for driver.
220 */
221 int (*get_device) (struct mtd_info *mtd);
222 void (*put_device) (struct mtd_info *mtd);
251 223
252 /* Bad block management functions */ 224 /* Backing device capabilities for this device
253 int (*block_isbad) (struct mtd_info *mtd, loff_t ofs); 225 * - provides mmap capabilities
254 int (*block_markbad) (struct mtd_info *mtd, loff_t ofs); 226 */
227 struct backing_dev_info *backing_dev_info;
255 228
256 struct notifier_block reboot_notifier; /* default mode before reboot */ 229 struct notifier_block reboot_notifier; /* default mode before reboot */
257 230
@@ -265,18 +238,218 @@ struct mtd_info {
265 struct module *owner; 238 struct module *owner;
266 struct device dev; 239 struct device dev;
267 int usecount; 240 int usecount;
268
269 /* If the driver is something smart, like UBI, it may need to maintain
270 * its own reference counting. The below functions are only for driver.
271 * The driver may register its callbacks. These callbacks are not
272 * supposed to be called by MTD users */
273 int (*get_device) (struct mtd_info *mtd);
274 void (*put_device) (struct mtd_info *mtd);
275}; 241};
276 242
277static inline struct mtd_info *dev_to_mtd(struct device *dev) 243/*
244 * Erase is an asynchronous operation. Device drivers are supposed
245 * to call instr->callback() whenever the operation completes, even
246 * if it completes with a failure.
247 * Callers are supposed to pass a callback function and wait for it
248 * to be called before writing to the block.
249 */
250static inline int mtd_erase(struct mtd_info *mtd, struct erase_info *instr)
251{
252 return mtd->erase(mtd, instr);
253}
254
255/*
256 * This stuff for eXecute-In-Place. phys is optional and may be set to NULL.
257 */
258static inline int mtd_point(struct mtd_info *mtd, loff_t from, size_t len,
259 size_t *retlen, void **virt, resource_size_t *phys)
260{
261 *retlen = 0;
262 if (!mtd->point)
263 return -EOPNOTSUPP;
264 return mtd->point(mtd, from, len, retlen, virt, phys);
265}
266
267/* We probably shouldn't allow XIP if the unpoint isn't a NULL */
268static inline void mtd_unpoint(struct mtd_info *mtd, loff_t from, size_t len)
278{ 269{
279 return dev ? dev_get_drvdata(dev) : NULL; 270 return mtd->unpoint(mtd, from, len);
271}
272
273/*
274 * Allow NOMMU mmap() to directly map the device (if not NULL)
275 * - return the address to which the offset maps
276 * - return -ENOSYS to indicate refusal to do the mapping
277 */
278static inline unsigned long mtd_get_unmapped_area(struct mtd_info *mtd,
279 unsigned long len,
280 unsigned long offset,
281 unsigned long flags)
282{
283 if (!mtd->get_unmapped_area)
284 return -EOPNOTSUPP;
285 return mtd->get_unmapped_area(mtd, len, offset, flags);
286}
287
288static inline int mtd_read(struct mtd_info *mtd, loff_t from, size_t len,
289 size_t *retlen, u_char *buf)
290{
291 return mtd->read(mtd, from, len, retlen, buf);
292}
293
294static inline int mtd_write(struct mtd_info *mtd, loff_t to, size_t len,
295 size_t *retlen, const u_char *buf)
296{
297 *retlen = 0;
298 if (!mtd->write)
299 return -EROFS;
300 return mtd->write(mtd, to, len, retlen, buf);
301}
302
303/*
304 * In blackbox flight recorder like scenarios we want to make successful writes
305 * in interrupt context. panic_write() is only intended to be called when its
306 * known the kernel is about to panic and we need the write to succeed. Since
307 * the kernel is not going to be running for much longer, this function can
308 * break locks and delay to ensure the write succeeds (but not sleep).
309 */
310static inline int mtd_panic_write(struct mtd_info *mtd, loff_t to, size_t len,
311 size_t *retlen, const u_char *buf)
312{
313 *retlen = 0;
314 if (!mtd->panic_write)
315 return -EOPNOTSUPP;
316 return mtd->panic_write(mtd, to, len, retlen, buf);
317}
318
319static inline int mtd_read_oob(struct mtd_info *mtd, loff_t from,
320 struct mtd_oob_ops *ops)
321{
322 ops->retlen = ops->oobretlen = 0;
323 if (!mtd->read_oob)
324 return -EOPNOTSUPP;
325 return mtd->read_oob(mtd, from, ops);
326}
327
328static inline int mtd_write_oob(struct mtd_info *mtd, loff_t to,
329 struct mtd_oob_ops *ops)
330{
331 ops->retlen = ops->oobretlen = 0;
332 if (!mtd->write_oob)
333 return -EOPNOTSUPP;
334 return mtd->write_oob(mtd, to, ops);
335}
336
337/*
338 * Method to access the protection register area, present in some flash
339 * devices. The user data is one time programmable but the factory data is read
340 * only.
341 */
342static inline int mtd_get_fact_prot_info(struct mtd_info *mtd,
343 struct otp_info *buf, size_t len)
344{
345 if (!mtd->get_fact_prot_info)
346 return -EOPNOTSUPP;
347 return mtd->get_fact_prot_info(mtd, buf, len);
348}
349
350static inline int mtd_read_fact_prot_reg(struct mtd_info *mtd, loff_t from,
351 size_t len, size_t *retlen,
352 u_char *buf)
353{
354 *retlen = 0;
355 if (!mtd->read_fact_prot_reg)
356 return -EOPNOTSUPP;
357 return mtd->read_fact_prot_reg(mtd, from, len, retlen, buf);
358}
359
360static inline int mtd_get_user_prot_info(struct mtd_info *mtd,
361 struct otp_info *buf,
362 size_t len)
363{
364 if (!mtd->get_user_prot_info)
365 return -EOPNOTSUPP;
366 return mtd->get_user_prot_info(mtd, buf, len);
367}
368
369static inline int mtd_read_user_prot_reg(struct mtd_info *mtd, loff_t from,
370 size_t len, size_t *retlen,
371 u_char *buf)
372{
373 *retlen = 0;
374 if (!mtd->read_user_prot_reg)
375 return -EOPNOTSUPP;
376 return mtd->read_user_prot_reg(mtd, from, len, retlen, buf);
377}
378
379static inline int mtd_write_user_prot_reg(struct mtd_info *mtd, loff_t to,
380 size_t len, size_t *retlen,
381 u_char *buf)
382{
383 *retlen = 0;
384 if (!mtd->write_user_prot_reg)
385 return -EOPNOTSUPP;
386 return mtd->write_user_prot_reg(mtd, to, len, retlen, buf);
387}
388
389static inline int mtd_lock_user_prot_reg(struct mtd_info *mtd, loff_t from,
390 size_t len)
391{
392 if (!mtd->lock_user_prot_reg)
393 return -EOPNOTSUPP;
394 return mtd->lock_user_prot_reg(mtd, from, len);
395}
396
397int mtd_writev(struct mtd_info *mtd, const struct kvec *vecs,
398 unsigned long count, loff_t to, size_t *retlen);
399
400static inline void mtd_sync(struct mtd_info *mtd)
401{
402 if (mtd->sync)
403 mtd->sync(mtd);
404}
405
406/* Chip-supported device locking */
407static inline int mtd_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len)
408{
409 if (!mtd->lock)
410 return -EOPNOTSUPP;
411 return mtd->lock(mtd, ofs, len);
412}
413
414static inline int mtd_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len)
415{
416 if (!mtd->unlock)
417 return -EOPNOTSUPP;
418 return mtd->unlock(mtd, ofs, len);
419}
420
421static inline int mtd_is_locked(struct mtd_info *mtd, loff_t ofs, uint64_t len)
422{
423 if (!mtd->is_locked)
424 return -EOPNOTSUPP;
425 return mtd->is_locked(mtd, ofs, len);
426}
427
428static inline int mtd_suspend(struct mtd_info *mtd)
429{
430 if (!mtd->suspend)
431 return -EOPNOTSUPP;
432 return mtd->suspend(mtd);
433}
434
435static inline void mtd_resume(struct mtd_info *mtd)
436{
437 if (mtd->resume)
438 mtd->resume(mtd);
439}
440
441static inline int mtd_block_isbad(struct mtd_info *mtd, loff_t ofs)
442{
443 if (!mtd->block_isbad)
444 return 0;
445 return mtd->block_isbad(mtd, ofs);
446}
447
448static inline int mtd_block_markbad(struct mtd_info *mtd, loff_t ofs)
449{
450 if (!mtd->block_markbad)
451 return -EOPNOTSUPP;
452 return mtd->block_markbad(mtd, ofs);
280} 453}
281 454
282static inline uint32_t mtd_div_by_eb(uint64_t sz, struct mtd_info *mtd) 455static inline uint32_t mtd_div_by_eb(uint64_t sz, struct mtd_info *mtd)
@@ -309,6 +482,16 @@ static inline uint32_t mtd_mod_by_ws(uint64_t sz, struct mtd_info *mtd)
309 return do_div(sz, mtd->writesize); 482 return do_div(sz, mtd->writesize);
310} 483}
311 484
485static inline int mtd_has_oob(const struct mtd_info *mtd)
486{
487 return mtd->read_oob && mtd->write_oob;
488}
489
490static inline int mtd_can_have_bb(const struct mtd_info *mtd)
491{
492 return !!mtd->block_isbad;
493}
494
312 /* Kernel-side ioctl definitions */ 495 /* Kernel-side ioctl definitions */
313 496
314struct mtd_partition; 497struct mtd_partition;
@@ -338,13 +521,6 @@ struct mtd_notifier {
338 521
339extern void register_mtd_user (struct mtd_notifier *new); 522extern void register_mtd_user (struct mtd_notifier *new);
340extern int unregister_mtd_user (struct mtd_notifier *old); 523extern int unregister_mtd_user (struct mtd_notifier *old);
341
342int default_mtd_writev(struct mtd_info *mtd, const struct kvec *vecs,
343 unsigned long count, loff_t to, size_t *retlen);
344
345int default_mtd_readv(struct mtd_info *mtd, struct kvec *vecs,
346 unsigned long count, loff_t from, size_t *retlen);
347
348void *mtd_kmalloc_up_to(const struct mtd_info *mtd, size_t *size); 524void *mtd_kmalloc_up_to(const struct mtd_info *mtd, size_t *size);
349 525
350void mtd_erase_callback(struct erase_info *instr); 526void mtd_erase_callback(struct erase_info *instr);
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 904131bab501..63b5a8b6dfbd 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -555,6 +555,7 @@ struct nand_chip {
555#define NAND_MFR_HYNIX 0xad 555#define NAND_MFR_HYNIX 0xad
556#define NAND_MFR_MICRON 0x2c 556#define NAND_MFR_MICRON 0x2c
557#define NAND_MFR_AMD 0x01 557#define NAND_MFR_AMD 0x01
558#define NAND_MFR_MACRONIX 0xc2
558 559
559/** 560/**
560 * struct nand_flash_dev - NAND Flash Device ID Structure 561 * struct nand_flash_dev - NAND Flash Device ID Structure
diff --git a/include/linux/mtd/physmap.h b/include/linux/mtd/physmap.h
index 04e018160e2b..d2887e76b7f6 100644
--- a/include/linux/mtd/physmap.h
+++ b/include/linux/mtd/physmap.h
@@ -30,6 +30,7 @@ struct physmap_flash_data {
30 unsigned int pfow_base; 30 unsigned int pfow_base;
31 char *probe_type; 31 char *probe_type;
32 struct mtd_partition *parts; 32 struct mtd_partition *parts;
33 const char **part_probe_types;
33}; 34};
34 35
35#endif /* __LINUX_MTD_PHYSMAP__ */ 36#endif /* __LINUX_MTD_PHYSMAP__ */
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index a1d109590da4..0eac07c95255 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -2155,7 +2155,7 @@ extern void netdev_run_todo(void);
2155 */ 2155 */
2156static inline void dev_put(struct net_device *dev) 2156static inline void dev_put(struct net_device *dev)
2157{ 2157{
2158 irqsafe_cpu_dec(*dev->pcpu_refcnt); 2158 this_cpu_dec(*dev->pcpu_refcnt);
2159} 2159}
2160 2160
2161/** 2161/**
@@ -2166,7 +2166,7 @@ static inline void dev_put(struct net_device *dev)
2166 */ 2166 */
2167static inline void dev_hold(struct net_device *dev) 2167static inline void dev_hold(struct net_device *dev)
2168{ 2168{
2169 irqsafe_cpu_inc(*dev->pcpu_refcnt); 2169 this_cpu_inc(*dev->pcpu_refcnt);
2170} 2170}
2171 2171
2172/* Carrier loss detection, dial on demand. The functions netif_carrier_on 2172/* Carrier loss detection, dial on demand. The functions netif_carrier_on
@@ -2450,6 +2450,11 @@ static inline void netif_addr_lock(struct net_device *dev)
2450 spin_lock(&dev->addr_list_lock); 2450 spin_lock(&dev->addr_list_lock);
2451} 2451}
2452 2452
2453static inline void netif_addr_lock_nested(struct net_device *dev)
2454{
2455 spin_lock_nested(&dev->addr_list_lock, SINGLE_DEPTH_NESTING);
2456}
2457
2453static inline void netif_addr_lock_bh(struct net_device *dev) 2458static inline void netif_addr_lock_bh(struct net_device *dev)
2454{ 2459{
2455 spin_lock_bh(&dev->addr_list_lock); 2460 spin_lock_bh(&dev->addr_list_lock);
diff --git a/include/linux/netfilter/nf_conntrack_common.h b/include/linux/netfilter/nf_conntrack_common.h
index 9e3a2838291b..0d3dd66322ec 100644
--- a/include/linux/netfilter/nf_conntrack_common.h
+++ b/include/linux/netfilter/nf_conntrack_common.h
@@ -83,10 +83,6 @@ enum ip_conntrack_status {
83 /* Conntrack is a fake untracked entry */ 83 /* Conntrack is a fake untracked entry */
84 IPS_UNTRACKED_BIT = 12, 84 IPS_UNTRACKED_BIT = 12,
85 IPS_UNTRACKED = (1 << IPS_UNTRACKED_BIT), 85 IPS_UNTRACKED = (1 << IPS_UNTRACKED_BIT),
86
87 /* Conntrack has a userspace helper. */
88 IPS_USERSPACE_HELPER_BIT = 13,
89 IPS_USERSPACE_HELPER = (1 << IPS_USERSPACE_HELPER_BIT),
90}; 86};
91 87
92/* Connection tracking event types */ 88/* Connection tracking event types */
diff --git a/include/linux/netfilter/x_tables.h b/include/linux/netfilter/x_tables.h
index 32cddf78b13e..8d674a786744 100644
--- a/include/linux/netfilter/x_tables.h
+++ b/include/linux/netfilter/x_tables.h
@@ -471,7 +471,7 @@ DECLARE_PER_CPU(seqcount_t, xt_recseq);
471 * 471 *
472 * Begin packet processing : all readers must wait the end 472 * Begin packet processing : all readers must wait the end
473 * 1) Must be called with preemption disabled 473 * 1) Must be called with preemption disabled
474 * 2) softirqs must be disabled too (or we should use irqsafe_cpu_add()) 474 * 2) softirqs must be disabled too (or we should use this_cpu_add())
475 * Returns : 475 * Returns :
476 * 1 if no recursion on this cpu 476 * 1 if no recursion on this cpu
477 * 0 if recursion detected 477 * 0 if recursion detected
@@ -503,7 +503,7 @@ static inline unsigned int xt_write_recseq_begin(void)
503 * 503 *
504 * End packet processing : all readers can proceed 504 * End packet processing : all readers can proceed
505 * 1) Must be called with preemption disabled 505 * 1) Must be called with preemption disabled
506 * 2) softirqs must be disabled too (or we should use irqsafe_cpu_add()) 506 * 2) softirqs must be disabled too (or we should use this_cpu_add())
507 */ 507 */
508static inline void xt_write_recseq_end(unsigned int addend) 508static inline void xt_write_recseq_end(unsigned int addend)
509{ 509{
diff --git a/include/linux/netfilter/xt_CT.h b/include/linux/netfilter/xt_CT.h
index 6390f0992f36..b56e76811c04 100644
--- a/include/linux/netfilter/xt_CT.h
+++ b/include/linux/netfilter/xt_CT.h
@@ -3,8 +3,7 @@
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5 5
6#define XT_CT_NOTRACK 0x1 6#define XT_CT_NOTRACK 0x1
7#define XT_CT_USERSPACE_HELPER 0x2
8 7
9struct xt_ct_target_info { 8struct xt_ct_target_info {
10 __u16 flags; 9 __u16 flags;
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
index b5479df8378d..ba4d7656ecfd 100644
--- a/include/linux/nfs_fs_sb.h
+++ b/include/linux/nfs_fs_sb.h
@@ -153,6 +153,7 @@ struct nfs_server {
153 struct rb_root openowner_id; 153 struct rb_root openowner_id;
154 struct rb_root lockowner_id; 154 struct rb_root lockowner_id;
155#endif 155#endif
156 struct list_head state_owners_lru;
156 struct list_head layouts; 157 struct list_head layouts;
157 struct list_head delegations; 158 struct list_head delegations;
158 void (*destroy)(struct nfs_server *); 159 void (*destroy)(struct nfs_server *);
diff --git a/include/linux/nfs_idmap.h b/include/linux/nfs_idmap.h
index ae7d6a380dae..308c18877018 100644
--- a/include/linux/nfs_idmap.h
+++ b/include/linux/nfs_idmap.h
@@ -66,6 +66,8 @@ struct idmap_msg {
66/* Forward declaration to make this header independent of others */ 66/* Forward declaration to make this header independent of others */
67struct nfs_client; 67struct nfs_client;
68struct nfs_server; 68struct nfs_server;
69struct nfs_fattr;
70struct nfs4_string;
69 71
70#ifdef CONFIG_NFS_USE_NEW_IDMAPPER 72#ifdef CONFIG_NFS_USE_NEW_IDMAPPER
71 73
@@ -97,6 +99,12 @@ void nfs_idmap_delete(struct nfs_client *);
97 99
98#endif /* CONFIG_NFS_USE_NEW_IDMAPPER */ 100#endif /* CONFIG_NFS_USE_NEW_IDMAPPER */
99 101
102void nfs_fattr_init_names(struct nfs_fattr *fattr,
103 struct nfs4_string *owner_name,
104 struct nfs4_string *group_name);
105void nfs_fattr_free_names(struct nfs_fattr *);
106void nfs_fattr_map_and_free_names(struct nfs_server *, struct nfs_fattr *);
107
100int nfs_map_name_to_uid(const struct nfs_server *, const char *, size_t, __u32 *); 108int nfs_map_name_to_uid(const struct nfs_server *, const char *, size_t, __u32 *);
101int nfs_map_group_to_gid(const struct nfs_server *, const char *, size_t, __u32 *); 109int nfs_map_group_to_gid(const struct nfs_server *, const char *, size_t, __u32 *);
102int nfs_map_uid_to_name(const struct nfs_server *, __u32, char *, size_t); 110int nfs_map_uid_to_name(const struct nfs_server *, __u32, char *, size_t);
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index 2a7c533be5dd..a764cef06b73 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -18,6 +18,11 @@
18/* Forward declaration for NFS v3 */ 18/* Forward declaration for NFS v3 */
19struct nfs4_secinfo_flavors; 19struct nfs4_secinfo_flavors;
20 20
21struct nfs4_string {
22 unsigned int len;
23 char *data;
24};
25
21struct nfs_fsid { 26struct nfs_fsid {
22 uint64_t major; 27 uint64_t major;
23 uint64_t minor; 28 uint64_t minor;
@@ -61,6 +66,8 @@ struct nfs_fattr {
61 struct timespec pre_ctime; /* pre_op_attr.ctime */ 66 struct timespec pre_ctime; /* pre_op_attr.ctime */
62 unsigned long time_start; 67 unsigned long time_start;
63 unsigned long gencount; 68 unsigned long gencount;
69 struct nfs4_string *owner_name;
70 struct nfs4_string *group_name;
64}; 71};
65 72
66#define NFS_ATTR_FATTR_TYPE (1U << 0) 73#define NFS_ATTR_FATTR_TYPE (1U << 0)
@@ -85,6 +92,8 @@ struct nfs_fattr {
85#define NFS_ATTR_FATTR_V4_REFERRAL (1U << 19) /* NFSv4 referral */ 92#define NFS_ATTR_FATTR_V4_REFERRAL (1U << 19) /* NFSv4 referral */
86#define NFS_ATTR_FATTR_MOUNTPOINT (1U << 20) /* Treat as mountpoint */ 93#define NFS_ATTR_FATTR_MOUNTPOINT (1U << 20) /* Treat as mountpoint */
87#define NFS_ATTR_FATTR_MOUNTED_ON_FILEID (1U << 21) 94#define NFS_ATTR_FATTR_MOUNTED_ON_FILEID (1U << 21)
95#define NFS_ATTR_FATTR_OWNER_NAME (1U << 22)
96#define NFS_ATTR_FATTR_GROUP_NAME (1U << 23)
88 97
89#define NFS_ATTR_FATTR (NFS_ATTR_FATTR_TYPE \ 98#define NFS_ATTR_FATTR (NFS_ATTR_FATTR_TYPE \
90 | NFS_ATTR_FATTR_MODE \ 99 | NFS_ATTR_FATTR_MODE \
@@ -324,6 +333,7 @@ struct nfs_openargs {
324 const struct qstr * name; 333 const struct qstr * name;
325 const struct nfs_server *server; /* Needed for ID mapping */ 334 const struct nfs_server *server; /* Needed for ID mapping */
326 const u32 * bitmask; 335 const u32 * bitmask;
336 const u32 * dir_bitmask;
327 __u32 claim; 337 __u32 claim;
328 struct nfs4_sequence_args seq_args; 338 struct nfs4_sequence_args seq_args;
329}; 339};
@@ -342,6 +352,8 @@ struct nfs_openres {
342 __u32 do_recall; 352 __u32 do_recall;
343 __u64 maxsize; 353 __u64 maxsize;
344 __u32 attrset[NFS4_BITMAP_SIZE]; 354 __u32 attrset[NFS4_BITMAP_SIZE];
355 struct nfs4_string *owner;
356 struct nfs4_string *group_owner;
345 struct nfs4_sequence_res seq_res; 357 struct nfs4_sequence_res seq_res;
346}; 358};
347 359
@@ -602,11 +614,16 @@ struct nfs_getaclargs {
602 size_t acl_len; 614 size_t acl_len;
603 unsigned int acl_pgbase; 615 unsigned int acl_pgbase;
604 struct page ** acl_pages; 616 struct page ** acl_pages;
617 struct page * acl_scratch;
605 struct nfs4_sequence_args seq_args; 618 struct nfs4_sequence_args seq_args;
606}; 619};
607 620
621/* getxattr ACL interface flags */
622#define NFS4_ACL_LEN_REQUEST 0x0001 /* zero length getxattr buffer */
608struct nfs_getaclres { 623struct nfs_getaclres {
609 size_t acl_len; 624 size_t acl_len;
625 size_t acl_data_offset;
626 int acl_flags;
610 struct nfs4_sequence_res seq_res; 627 struct nfs4_sequence_res seq_res;
611}; 628};
612 629
@@ -773,11 +790,6 @@ struct nfs3_getaclres {
773 struct posix_acl * acl_default; 790 struct posix_acl * acl_default;
774}; 791};
775 792
776struct nfs4_string {
777 unsigned int len;
778 char *data;
779};
780
781#ifdef CONFIG_NFS_V4 793#ifdef CONFIG_NFS_V4
782 794
783typedef u64 clientid4; 795typedef u64 clientid4;
diff --git a/include/linux/nls.h b/include/linux/nls.h
index d47beef08dfd..5dc635f8d79e 100644
--- a/include/linux/nls.h
+++ b/include/linux/nls.h
@@ -43,7 +43,7 @@ enum utf16_endian {
43 UTF16_BIG_ENDIAN 43 UTF16_BIG_ENDIAN
44}; 44};
45 45
46/* nls.c */ 46/* nls_base.c */
47extern int register_nls(struct nls_table *); 47extern int register_nls(struct nls_table *);
48extern int unregister_nls(struct nls_table *); 48extern int unregister_nls(struct nls_table *);
49extern struct nls_table *load_nls(char *); 49extern struct nls_table *load_nls(char *);
@@ -52,7 +52,8 @@ extern struct nls_table *load_nls_default(void);
52 52
53extern int utf8_to_utf32(const u8 *s, int len, unicode_t *pu); 53extern int utf8_to_utf32(const u8 *s, int len, unicode_t *pu);
54extern int utf32_to_utf8(unicode_t u, u8 *s, int maxlen); 54extern int utf32_to_utf8(unicode_t u, u8 *s, int maxlen);
55extern int utf8s_to_utf16s(const u8 *s, int len, wchar_t *pwcs); 55extern int utf8s_to_utf16s(const u8 *s, int len,
56 enum utf16_endian endian, wchar_t *pwcs, int maxlen);
56extern int utf16s_to_utf8s(const wchar_t *pwcs, int len, 57extern int utf16s_to_utf8s(const wchar_t *pwcs, int len,
57 enum utf16_endian endian, u8 *s, int maxlen); 58 enum utf16_endian endian, u8 *s, int maxlen);
58 59
diff --git a/include/linux/nvme.h b/include/linux/nvme.h
new file mode 100644
index 000000000000..9490a00529f4
--- /dev/null
+++ b/include/linux/nvme.h
@@ -0,0 +1,434 @@
1/*
2 * Definitions for the NVM Express interface
3 * Copyright (c) 2011, Intel Corporation.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
17 */
18
19#ifndef _LINUX_NVME_H
20#define _LINUX_NVME_H
21
22#include <linux/types.h>
23
24struct nvme_bar {
25 __u64 cap; /* Controller Capabilities */
26 __u32 vs; /* Version */
27 __u32 intms; /* Interrupt Mask Set */
28 __u32 intmc; /* Interrupt Mask Clear */
29 __u32 cc; /* Controller Configuration */
30 __u32 rsvd1; /* Reserved */
31 __u32 csts; /* Controller Status */
32 __u32 rsvd2; /* Reserved */
33 __u32 aqa; /* Admin Queue Attributes */
34 __u64 asq; /* Admin SQ Base Address */
35 __u64 acq; /* Admin CQ Base Address */
36};
37
38#define NVME_CAP_TIMEOUT(cap) (((cap) >> 24) & 0xff)
39#define NVME_CAP_STRIDE(cap) (((cap) >> 32) & 0xf)
40
41enum {
42 NVME_CC_ENABLE = 1 << 0,
43 NVME_CC_CSS_NVM = 0 << 4,
44 NVME_CC_MPS_SHIFT = 7,
45 NVME_CC_ARB_RR = 0 << 11,
46 NVME_CC_ARB_WRRU = 1 << 11,
47 NVME_CC_ARB_VS = 7 << 11,
48 NVME_CC_SHN_NONE = 0 << 14,
49 NVME_CC_SHN_NORMAL = 1 << 14,
50 NVME_CC_SHN_ABRUPT = 2 << 14,
51 NVME_CC_IOSQES = 6 << 16,
52 NVME_CC_IOCQES = 4 << 20,
53 NVME_CSTS_RDY = 1 << 0,
54 NVME_CSTS_CFS = 1 << 1,
55 NVME_CSTS_SHST_NORMAL = 0 << 2,
56 NVME_CSTS_SHST_OCCUR = 1 << 2,
57 NVME_CSTS_SHST_CMPLT = 2 << 2,
58};
59
60struct nvme_id_power_state {
61 __le16 max_power; /* centiwatts */
62 __u16 rsvd2;
63 __le32 entry_lat; /* microseconds */
64 __le32 exit_lat; /* microseconds */
65 __u8 read_tput;
66 __u8 read_lat;
67 __u8 write_tput;
68 __u8 write_lat;
69 __u8 rsvd16[16];
70};
71
72#define NVME_VS(major, minor) (major << 16 | minor)
73
74struct nvme_id_ctrl {
75 __le16 vid;
76 __le16 ssvid;
77 char sn[20];
78 char mn[40];
79 char fr[8];
80 __u8 rab;
81 __u8 ieee[3];
82 __u8 mic;
83 __u8 mdts;
84 __u8 rsvd78[178];
85 __le16 oacs;
86 __u8 acl;
87 __u8 aerl;
88 __u8 frmw;
89 __u8 lpa;
90 __u8 elpe;
91 __u8 npss;
92 __u8 rsvd264[248];
93 __u8 sqes;
94 __u8 cqes;
95 __u8 rsvd514[2];
96 __le32 nn;
97 __le16 oncs;
98 __le16 fuses;
99 __u8 fna;
100 __u8 vwc;
101 __le16 awun;
102 __le16 awupf;
103 __u8 rsvd530[1518];
104 struct nvme_id_power_state psd[32];
105 __u8 vs[1024];
106};
107
108struct nvme_lbaf {
109 __le16 ms;
110 __u8 ds;
111 __u8 rp;
112};
113
114struct nvme_id_ns {
115 __le64 nsze;
116 __le64 ncap;
117 __le64 nuse;
118 __u8 nsfeat;
119 __u8 nlbaf;
120 __u8 flbas;
121 __u8 mc;
122 __u8 dpc;
123 __u8 dps;
124 __u8 rsvd30[98];
125 struct nvme_lbaf lbaf[16];
126 __u8 rsvd192[192];
127 __u8 vs[3712];
128};
129
130enum {
131 NVME_NS_FEAT_THIN = 1 << 0,
132 NVME_LBAF_RP_BEST = 0,
133 NVME_LBAF_RP_BETTER = 1,
134 NVME_LBAF_RP_GOOD = 2,
135 NVME_LBAF_RP_DEGRADED = 3,
136};
137
138struct nvme_lba_range_type {
139 __u8 type;
140 __u8 attributes;
141 __u8 rsvd2[14];
142 __u64 slba;
143 __u64 nlb;
144 __u8 guid[16];
145 __u8 rsvd48[16];
146};
147
148enum {
149 NVME_LBART_TYPE_FS = 0x01,
150 NVME_LBART_TYPE_RAID = 0x02,
151 NVME_LBART_TYPE_CACHE = 0x03,
152 NVME_LBART_TYPE_SWAP = 0x04,
153
154 NVME_LBART_ATTRIB_TEMP = 1 << 0,
155 NVME_LBART_ATTRIB_HIDE = 1 << 1,
156};
157
158/* I/O commands */
159
160enum nvme_opcode {
161 nvme_cmd_flush = 0x00,
162 nvme_cmd_write = 0x01,
163 nvme_cmd_read = 0x02,
164 nvme_cmd_write_uncor = 0x04,
165 nvme_cmd_compare = 0x05,
166 nvme_cmd_dsm = 0x09,
167};
168
169struct nvme_common_command {
170 __u8 opcode;
171 __u8 flags;
172 __u16 command_id;
173 __le32 nsid;
174 __u32 cdw2[2];
175 __le64 metadata;
176 __le64 prp1;
177 __le64 prp2;
178 __u32 cdw10[6];
179};
180
181struct nvme_rw_command {
182 __u8 opcode;
183 __u8 flags;
184 __u16 command_id;
185 __le32 nsid;
186 __u64 rsvd2;
187 __le64 metadata;
188 __le64 prp1;
189 __le64 prp2;
190 __le64 slba;
191 __le16 length;
192 __le16 control;
193 __le32 dsmgmt;
194 __le32 reftag;
195 __le16 apptag;
196 __le16 appmask;
197};
198
199enum {
200 NVME_RW_LR = 1 << 15,
201 NVME_RW_FUA = 1 << 14,
202 NVME_RW_DSM_FREQ_UNSPEC = 0,
203 NVME_RW_DSM_FREQ_TYPICAL = 1,
204 NVME_RW_DSM_FREQ_RARE = 2,
205 NVME_RW_DSM_FREQ_READS = 3,
206 NVME_RW_DSM_FREQ_WRITES = 4,
207 NVME_RW_DSM_FREQ_RW = 5,
208 NVME_RW_DSM_FREQ_ONCE = 6,
209 NVME_RW_DSM_FREQ_PREFETCH = 7,
210 NVME_RW_DSM_FREQ_TEMP = 8,
211 NVME_RW_DSM_LATENCY_NONE = 0 << 4,
212 NVME_RW_DSM_LATENCY_IDLE = 1 << 4,
213 NVME_RW_DSM_LATENCY_NORM = 2 << 4,
214 NVME_RW_DSM_LATENCY_LOW = 3 << 4,
215 NVME_RW_DSM_SEQ_REQ = 1 << 6,
216 NVME_RW_DSM_COMPRESSED = 1 << 7,
217};
218
219/* Admin commands */
220
221enum nvme_admin_opcode {
222 nvme_admin_delete_sq = 0x00,
223 nvme_admin_create_sq = 0x01,
224 nvme_admin_get_log_page = 0x02,
225 nvme_admin_delete_cq = 0x04,
226 nvme_admin_create_cq = 0x05,
227 nvme_admin_identify = 0x06,
228 nvme_admin_abort_cmd = 0x08,
229 nvme_admin_set_features = 0x09,
230 nvme_admin_get_features = 0x0a,
231 nvme_admin_async_event = 0x0c,
232 nvme_admin_activate_fw = 0x10,
233 nvme_admin_download_fw = 0x11,
234 nvme_admin_format_nvm = 0x80,
235 nvme_admin_security_send = 0x81,
236 nvme_admin_security_recv = 0x82,
237};
238
239enum {
240 NVME_QUEUE_PHYS_CONTIG = (1 << 0),
241 NVME_CQ_IRQ_ENABLED = (1 << 1),
242 NVME_SQ_PRIO_URGENT = (0 << 1),
243 NVME_SQ_PRIO_HIGH = (1 << 1),
244 NVME_SQ_PRIO_MEDIUM = (2 << 1),
245 NVME_SQ_PRIO_LOW = (3 << 1),
246 NVME_FEAT_ARBITRATION = 0x01,
247 NVME_FEAT_POWER_MGMT = 0x02,
248 NVME_FEAT_LBA_RANGE = 0x03,
249 NVME_FEAT_TEMP_THRESH = 0x04,
250 NVME_FEAT_ERR_RECOVERY = 0x05,
251 NVME_FEAT_VOLATILE_WC = 0x06,
252 NVME_FEAT_NUM_QUEUES = 0x07,
253 NVME_FEAT_IRQ_COALESCE = 0x08,
254 NVME_FEAT_IRQ_CONFIG = 0x09,
255 NVME_FEAT_WRITE_ATOMIC = 0x0a,
256 NVME_FEAT_ASYNC_EVENT = 0x0b,
257 NVME_FEAT_SW_PROGRESS = 0x0c,
258};
259
260struct nvme_identify {
261 __u8 opcode;
262 __u8 flags;
263 __u16 command_id;
264 __le32 nsid;
265 __u64 rsvd2[2];
266 __le64 prp1;
267 __le64 prp2;
268 __le32 cns;
269 __u32 rsvd11[5];
270};
271
272struct nvme_features {
273 __u8 opcode;
274 __u8 flags;
275 __u16 command_id;
276 __le32 nsid;
277 __u64 rsvd2[2];
278 __le64 prp1;
279 __le64 prp2;
280 __le32 fid;
281 __le32 dword11;
282 __u32 rsvd12[4];
283};
284
285struct nvme_create_cq {
286 __u8 opcode;
287 __u8 flags;
288 __u16 command_id;
289 __u32 rsvd1[5];
290 __le64 prp1;
291 __u64 rsvd8;
292 __le16 cqid;
293 __le16 qsize;
294 __le16 cq_flags;
295 __le16 irq_vector;
296 __u32 rsvd12[4];
297};
298
299struct nvme_create_sq {
300 __u8 opcode;
301 __u8 flags;
302 __u16 command_id;
303 __u32 rsvd1[5];
304 __le64 prp1;
305 __u64 rsvd8;
306 __le16 sqid;
307 __le16 qsize;
308 __le16 sq_flags;
309 __le16 cqid;
310 __u32 rsvd12[4];
311};
312
313struct nvme_delete_queue {
314 __u8 opcode;
315 __u8 flags;
316 __u16 command_id;
317 __u32 rsvd1[9];
318 __le16 qid;
319 __u16 rsvd10;
320 __u32 rsvd11[5];
321};
322
323struct nvme_download_firmware {
324 __u8 opcode;
325 __u8 flags;
326 __u16 command_id;
327 __u32 rsvd1[5];
328 __le64 prp1;
329 __le64 prp2;
330 __le32 numd;
331 __le32 offset;
332 __u32 rsvd12[4];
333};
334
335struct nvme_command {
336 union {
337 struct nvme_common_command common;
338 struct nvme_rw_command rw;
339 struct nvme_identify identify;
340 struct nvme_features features;
341 struct nvme_create_cq create_cq;
342 struct nvme_create_sq create_sq;
343 struct nvme_delete_queue delete_queue;
344 struct nvme_download_firmware dlfw;
345 };
346};
347
348enum {
349 NVME_SC_SUCCESS = 0x0,
350 NVME_SC_INVALID_OPCODE = 0x1,
351 NVME_SC_INVALID_FIELD = 0x2,
352 NVME_SC_CMDID_CONFLICT = 0x3,
353 NVME_SC_DATA_XFER_ERROR = 0x4,
354 NVME_SC_POWER_LOSS = 0x5,
355 NVME_SC_INTERNAL = 0x6,
356 NVME_SC_ABORT_REQ = 0x7,
357 NVME_SC_ABORT_QUEUE = 0x8,
358 NVME_SC_FUSED_FAIL = 0x9,
359 NVME_SC_FUSED_MISSING = 0xa,
360 NVME_SC_INVALID_NS = 0xb,
361 NVME_SC_LBA_RANGE = 0x80,
362 NVME_SC_CAP_EXCEEDED = 0x81,
363 NVME_SC_NS_NOT_READY = 0x82,
364 NVME_SC_CQ_INVALID = 0x100,
365 NVME_SC_QID_INVALID = 0x101,
366 NVME_SC_QUEUE_SIZE = 0x102,
367 NVME_SC_ABORT_LIMIT = 0x103,
368 NVME_SC_ABORT_MISSING = 0x104,
369 NVME_SC_ASYNC_LIMIT = 0x105,
370 NVME_SC_FIRMWARE_SLOT = 0x106,
371 NVME_SC_FIRMWARE_IMAGE = 0x107,
372 NVME_SC_INVALID_VECTOR = 0x108,
373 NVME_SC_INVALID_LOG_PAGE = 0x109,
374 NVME_SC_INVALID_FORMAT = 0x10a,
375 NVME_SC_BAD_ATTRIBUTES = 0x180,
376 NVME_SC_WRITE_FAULT = 0x280,
377 NVME_SC_READ_ERROR = 0x281,
378 NVME_SC_GUARD_CHECK = 0x282,
379 NVME_SC_APPTAG_CHECK = 0x283,
380 NVME_SC_REFTAG_CHECK = 0x284,
381 NVME_SC_COMPARE_FAILED = 0x285,
382 NVME_SC_ACCESS_DENIED = 0x286,
383};
384
385struct nvme_completion {
386 __le32 result; /* Used by admin commands to return data */
387 __u32 rsvd;
388 __le16 sq_head; /* how much of this queue may be reclaimed */
389 __le16 sq_id; /* submission queue that generated this entry */
390 __u16 command_id; /* of the command which completed */
391 __le16 status; /* did the command fail, and if so, why? */
392};
393
394struct nvme_user_io {
395 __u8 opcode;
396 __u8 flags;
397 __u16 control;
398 __u16 nblocks;
399 __u16 rsvd;
400 __u64 metadata;
401 __u64 addr;
402 __u64 slba;
403 __u32 dsmgmt;
404 __u32 reftag;
405 __u16 apptag;
406 __u16 appmask;
407};
408
409struct nvme_admin_cmd {
410 __u8 opcode;
411 __u8 flags;
412 __u16 rsvd1;
413 __u32 nsid;
414 __u32 cdw2;
415 __u32 cdw3;
416 __u64 metadata;
417 __u64 addr;
418 __u32 metadata_len;
419 __u32 data_len;
420 __u32 cdw10;
421 __u32 cdw11;
422 __u32 cdw12;
423 __u32 cdw13;
424 __u32 cdw14;
425 __u32 cdw15;
426 __u32 timeout_ms;
427 __u32 result;
428};
429
430#define NVME_IOCTL_ID _IO('N', 0x40)
431#define NVME_IOCTL_ADMIN_CMD _IOWR('N', 0x41, struct nvme_admin_cmd)
432#define NVME_IOCTL_SUBMIT_IO _IOW('N', 0x42, struct nvme_user_io)
433
434#endif /* _LINUX_NVME_H */
diff --git a/include/linux/oom.h b/include/linux/oom.h
index 6f9d04a85336..552fba9c7d5a 100644
--- a/include/linux/oom.h
+++ b/include/linux/oom.h
@@ -43,7 +43,7 @@ enum oom_constraint {
43extern void compare_swap_oom_score_adj(int old_val, int new_val); 43extern void compare_swap_oom_score_adj(int old_val, int new_val);
44extern int test_set_oom_score_adj(int new_val); 44extern int test_set_oom_score_adj(int new_val);
45 45
46extern unsigned int oom_badness(struct task_struct *p, struct mem_cgroup *mem, 46extern unsigned int oom_badness(struct task_struct *p, struct mem_cgroup *memcg,
47 const nodemask_t *nodemask, unsigned long totalpages); 47 const nodemask_t *nodemask, unsigned long totalpages);
48extern int try_set_zonelist_oom(struct zonelist *zonelist, gfp_t gfp_flags); 48extern int try_set_zonelist_oom(struct zonelist *zonelist, gfp_t gfp_flags);
49extern void clear_zonelist_oom(struct zonelist *zonelist, gfp_t gfp_flags); 49extern void clear_zonelist_oom(struct zonelist *zonelist, gfp_t gfp_flags);
diff --git a/include/linux/page-debug-flags.h b/include/linux/page-debug-flags.h
index b0638fd91e92..22691f614043 100644
--- a/include/linux/page-debug-flags.h
+++ b/include/linux/page-debug-flags.h
@@ -13,6 +13,7 @@
13 13
14enum page_debug_flags { 14enum page_debug_flags {
15 PAGE_DEBUG_FLAG_POISON, /* Page is poisoned */ 15 PAGE_DEBUG_FLAG_POISON, /* Page is poisoned */
16 PAGE_DEBUG_FLAG_GUARD,
16}; 17};
17 18
18/* 19/*
@@ -21,7 +22,8 @@ enum page_debug_flags {
21 */ 22 */
22 23
23#ifdef CONFIG_WANT_PAGE_DEBUG_FLAGS 24#ifdef CONFIG_WANT_PAGE_DEBUG_FLAGS
24#if !defined(CONFIG_PAGE_POISONING) \ 25#if !defined(CONFIG_PAGE_POISONING) && \
26 !defined(CONFIG_PAGE_GUARD) \
25/* && !defined(CONFIG_PAGE_DEBUG_SOMETHING_ELSE) && ... */ 27/* && !defined(CONFIG_PAGE_DEBUG_SOMETHING_ELSE) && ... */
26#error WANT_PAGE_DEBUG_FLAGS is turned on with no debug features! 28#error WANT_PAGE_DEBUG_FLAGS is turned on with no debug features!
27#endif 29#endif
diff --git a/include/linux/page_cgroup.h b/include/linux/page_cgroup.h
index 961ecc7d30bc..a2d11771c84b 100644
--- a/include/linux/page_cgroup.h
+++ b/include/linux/page_cgroup.h
@@ -10,8 +10,6 @@ enum {
10 /* flags for mem_cgroup and file and I/O status */ 10 /* flags for mem_cgroup and file and I/O status */
11 PCG_MOVE_LOCK, /* For race between move_account v.s. following bits */ 11 PCG_MOVE_LOCK, /* For race between move_account v.s. following bits */
12 PCG_FILE_MAPPED, /* page is accounted as "mapped" */ 12 PCG_FILE_MAPPED, /* page is accounted as "mapped" */
13 /* No lock in page_cgroup */
14 PCG_ACCT_LRU, /* page has been accounted for (under lru_lock) */
15 __NR_PCG_FLAGS, 13 __NR_PCG_FLAGS,
16}; 14};
17 15
@@ -31,7 +29,6 @@ enum {
31struct page_cgroup { 29struct page_cgroup {
32 unsigned long flags; 30 unsigned long flags;
33 struct mem_cgroup *mem_cgroup; 31 struct mem_cgroup *mem_cgroup;
34 struct list_head lru; /* per cgroup LRU list */
35}; 32};
36 33
37void __meminit pgdat_page_cgroup_init(struct pglist_data *pgdat); 34void __meminit pgdat_page_cgroup_init(struct pglist_data *pgdat);
@@ -76,12 +73,6 @@ TESTPCGFLAG(Used, USED)
76CLEARPCGFLAG(Used, USED) 73CLEARPCGFLAG(Used, USED)
77SETPCGFLAG(Used, USED) 74SETPCGFLAG(Used, USED)
78 75
79SETPCGFLAG(AcctLRU, ACCT_LRU)
80CLEARPCGFLAG(AcctLRU, ACCT_LRU)
81TESTPCGFLAG(AcctLRU, ACCT_LRU)
82TESTCLEARPCGFLAG(AcctLRU, ACCT_LRU)
83
84
85SETPCGFLAG(FileMapped, FILE_MAPPED) 76SETPCGFLAG(FileMapped, FILE_MAPPED)
86CLEARPCGFLAG(FileMapped, FILE_MAPPED) 77CLEARPCGFLAG(FileMapped, FILE_MAPPED)
87TESTPCGFLAG(FileMapped, FILE_MAPPED) 78TESTPCGFLAG(FileMapped, FILE_MAPPED)
@@ -122,39 +113,6 @@ static inline void move_unlock_page_cgroup(struct page_cgroup *pc,
122 local_irq_restore(*flags); 113 local_irq_restore(*flags);
123} 114}
124 115
125#ifdef CONFIG_SPARSEMEM
126#define PCG_ARRAYID_WIDTH SECTIONS_SHIFT
127#else
128#define PCG_ARRAYID_WIDTH NODES_SHIFT
129#endif
130
131#if (PCG_ARRAYID_WIDTH > BITS_PER_LONG - NR_PCG_FLAGS)
132#error Not enough space left in pc->flags to store page_cgroup array IDs
133#endif
134
135/* pc->flags: ARRAY-ID | FLAGS */
136
137#define PCG_ARRAYID_MASK ((1UL << PCG_ARRAYID_WIDTH) - 1)
138
139#define PCG_ARRAYID_OFFSET (BITS_PER_LONG - PCG_ARRAYID_WIDTH)
140/*
141 * Zero the shift count for non-existent fields, to prevent compiler
142 * warnings and ensure references are optimized away.
143 */
144#define PCG_ARRAYID_SHIFT (PCG_ARRAYID_OFFSET * (PCG_ARRAYID_WIDTH != 0))
145
146static inline void set_page_cgroup_array_id(struct page_cgroup *pc,
147 unsigned long id)
148{
149 pc->flags &= ~(PCG_ARRAYID_MASK << PCG_ARRAYID_SHIFT);
150 pc->flags |= (id & PCG_ARRAYID_MASK) << PCG_ARRAYID_SHIFT;
151}
152
153static inline unsigned long page_cgroup_array_id(struct page_cgroup *pc)
154{
155 return (pc->flags >> PCG_ARRAYID_SHIFT) & PCG_ARRAYID_MASK;
156}
157
158#else /* CONFIG_CGROUP_MEM_RES_CTLR */ 116#else /* CONFIG_CGROUP_MEM_RES_CTLR */
159struct page_cgroup; 117struct page_cgroup;
160 118
@@ -183,7 +141,7 @@ static inline void __init page_cgroup_init_flatmem(void)
183extern unsigned short swap_cgroup_cmpxchg(swp_entry_t ent, 141extern unsigned short swap_cgroup_cmpxchg(swp_entry_t ent,
184 unsigned short old, unsigned short new); 142 unsigned short old, unsigned short new);
185extern unsigned short swap_cgroup_record(swp_entry_t ent, unsigned short id); 143extern unsigned short swap_cgroup_record(swp_entry_t ent, unsigned short id);
186extern unsigned short lookup_swap_cgroup(swp_entry_t ent); 144extern unsigned short lookup_swap_cgroup_id(swp_entry_t ent);
187extern int swap_cgroup_swapon(int type, unsigned long max_pages); 145extern int swap_cgroup_swapon(int type, unsigned long max_pages);
188extern void swap_cgroup_swapoff(int type); 146extern void swap_cgroup_swapoff(int type);
189#else 147#else
@@ -195,7 +153,7 @@ unsigned short swap_cgroup_record(swp_entry_t ent, unsigned short id)
195} 153}
196 154
197static inline 155static inline
198unsigned short lookup_swap_cgroup(swp_entry_t ent) 156unsigned short lookup_swap_cgroup_id(swp_entry_t ent)
199{ 157{
200 return 0; 158 return 0;
201} 159}
diff --git a/include/linux/pagevec.h b/include/linux/pagevec.h
index bab82f4c571c..2aa12b8499c0 100644
--- a/include/linux/pagevec.h
+++ b/include/linux/pagevec.h
@@ -21,9 +21,7 @@ struct pagevec {
21}; 21};
22 22
23void __pagevec_release(struct pagevec *pvec); 23void __pagevec_release(struct pagevec *pvec);
24void __pagevec_free(struct pagevec *pvec); 24void __pagevec_lru_add(struct pagevec *pvec, enum lru_list lru);
25void ____pagevec_lru_add(struct pagevec *pvec, enum lru_list lru);
26void pagevec_strip(struct pagevec *pvec);
27unsigned pagevec_lookup(struct pagevec *pvec, struct address_space *mapping, 25unsigned pagevec_lookup(struct pagevec *pvec, struct address_space *mapping,
28 pgoff_t start, unsigned nr_pages); 26 pgoff_t start, unsigned nr_pages);
29unsigned pagevec_lookup_tag(struct pagevec *pvec, 27unsigned pagevec_lookup_tag(struct pagevec *pvec,
@@ -60,37 +58,30 @@ static inline unsigned pagevec_add(struct pagevec *pvec, struct page *page)
60 return pagevec_space(pvec); 58 return pagevec_space(pvec);
61} 59}
62 60
63
64static inline void pagevec_release(struct pagevec *pvec) 61static inline void pagevec_release(struct pagevec *pvec)
65{ 62{
66 if (pagevec_count(pvec)) 63 if (pagevec_count(pvec))
67 __pagevec_release(pvec); 64 __pagevec_release(pvec);
68} 65}
69 66
70static inline void pagevec_free(struct pagevec *pvec)
71{
72 if (pagevec_count(pvec))
73 __pagevec_free(pvec);
74}
75
76static inline void __pagevec_lru_add_anon(struct pagevec *pvec) 67static inline void __pagevec_lru_add_anon(struct pagevec *pvec)
77{ 68{
78 ____pagevec_lru_add(pvec, LRU_INACTIVE_ANON); 69 __pagevec_lru_add(pvec, LRU_INACTIVE_ANON);
79} 70}
80 71
81static inline void __pagevec_lru_add_active_anon(struct pagevec *pvec) 72static inline void __pagevec_lru_add_active_anon(struct pagevec *pvec)
82{ 73{
83 ____pagevec_lru_add(pvec, LRU_ACTIVE_ANON); 74 __pagevec_lru_add(pvec, LRU_ACTIVE_ANON);
84} 75}
85 76
86static inline void __pagevec_lru_add_file(struct pagevec *pvec) 77static inline void __pagevec_lru_add_file(struct pagevec *pvec)
87{ 78{
88 ____pagevec_lru_add(pvec, LRU_INACTIVE_FILE); 79 __pagevec_lru_add(pvec, LRU_INACTIVE_FILE);
89} 80}
90 81
91static inline void __pagevec_lru_add_active_file(struct pagevec *pvec) 82static inline void __pagevec_lru_add_active_file(struct pagevec *pvec)
92{ 83{
93 ____pagevec_lru_add(pvec, LRU_ACTIVE_FILE); 84 __pagevec_lru_add(pvec, LRU_ACTIVE_FILE);
94} 85}
95 86
96static inline void pagevec_lru_add_file(struct pagevec *pvec) 87static inline void pagevec_lru_add_file(struct pagevec *pvec)
diff --git a/include/linux/patchkey.h b/include/linux/patchkey.h
index d974a6e92372..aefda0ec6e62 100644
--- a/include/linux/patchkey.h
+++ b/include/linux/patchkey.h
@@ -32,7 +32,8 @@
32# else 32# else
33# error "could not determine byte order" 33# error "could not determine byte order"
34# endif 34# endif
35#elif defined(__BYTE_ORDER) 35#else
36#if defined(__BYTE_ORDER)
36# if __BYTE_ORDER == __BIG_ENDIAN 37# if __BYTE_ORDER == __BIG_ENDIAN
37# define _PATCHKEY(id) (0xfd00|id) 38# define _PATCHKEY(id) (0xfd00|id)
38# elif __BYTE_ORDER == __LITTLE_ENDIAN 39# elif __BYTE_ORDER == __LITTLE_ENDIAN
@@ -41,5 +42,6 @@
41# error "could not determine byte order" 42# error "could not determine byte order"
42# endif 43# endif
43#endif 44#endif
45#endif
44 46
45#endif /* _LINUX_PATCHKEY_H */ 47#endif /* _LINUX_PATCHKEY_H */
diff --git a/include/linux/pci-aspm.h b/include/linux/pci-aspm.h
index 7cea7b6c1413..c8320144fe79 100644
--- a/include/linux/pci-aspm.h
+++ b/include/linux/pci-aspm.h
@@ -29,7 +29,7 @@ extern void pcie_aspm_pm_state_change(struct pci_dev *pdev);
29extern void pcie_aspm_powersave_config_link(struct pci_dev *pdev); 29extern void pcie_aspm_powersave_config_link(struct pci_dev *pdev);
30extern void pci_disable_link_state(struct pci_dev *pdev, int state); 30extern void pci_disable_link_state(struct pci_dev *pdev, int state);
31extern void pci_disable_link_state_locked(struct pci_dev *pdev, int state); 31extern void pci_disable_link_state_locked(struct pci_dev *pdev, int state);
32extern void pcie_clear_aspm(void); 32extern void pcie_clear_aspm(struct pci_bus *bus);
33extern void pcie_no_aspm(void); 33extern void pcie_no_aspm(void);
34#else 34#else
35static inline void pcie_aspm_init_link_state(struct pci_dev *pdev) 35static inline void pcie_aspm_init_link_state(struct pci_dev *pdev)
@@ -47,7 +47,7 @@ static inline void pcie_aspm_powersave_config_link(struct pci_dev *pdev)
47static inline void pci_disable_link_state(struct pci_dev *pdev, int state) 47static inline void pci_disable_link_state(struct pci_dev *pdev, int state)
48{ 48{
49} 49}
50static inline void pcie_clear_aspm(void) 50static inline void pcie_clear_aspm(struct pci_bus *bus)
51{ 51{
52} 52}
53static inline void pcie_no_aspm(void) 53static inline void pcie_no_aspm(void)
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 7cda65b5f798..a16b1df3deff 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -111,7 +111,7 @@ enum {
111 PCI_NUM_RESOURCES, 111 PCI_NUM_RESOURCES,
112 112
113 /* preserve this for compatibility */ 113 /* preserve this for compatibility */
114 DEVICE_COUNT_RESOURCE 114 DEVICE_COUNT_RESOURCE = PCI_NUM_RESOURCES,
115}; 115};
116 116
117typedef int __bitwise pci_power_t; 117typedef int __bitwise pci_power_t;
@@ -308,7 +308,7 @@ struct pci_dev {
308 unsigned int is_added:1; 308 unsigned int is_added:1;
309 unsigned int is_busmaster:1; /* device is busmaster */ 309 unsigned int is_busmaster:1; /* device is busmaster */
310 unsigned int no_msi:1; /* device may not use msi */ 310 unsigned int no_msi:1; /* device may not use msi */
311 unsigned int block_ucfg_access:1; /* userspace config space access is blocked */ 311 unsigned int block_cfg_access:1; /* config space access is blocked */
312 unsigned int broken_parity_status:1; /* Device generates false positive parity */ 312 unsigned int broken_parity_status:1; /* Device generates false positive parity */
313 unsigned int irq_reroute_variant:2; /* device needs IRQ rerouting variant */ 313 unsigned int irq_reroute_variant:2; /* device needs IRQ rerouting variant */
314 unsigned int msi_enabled:1; 314 unsigned int msi_enabled:1;
@@ -336,6 +336,7 @@ struct pci_dev {
336 struct bin_attribute *res_attr_wc[DEVICE_COUNT_RESOURCE]; /* sysfs file for WC mapping of resources */ 336 struct bin_attribute *res_attr_wc[DEVICE_COUNT_RESOURCE]; /* sysfs file for WC mapping of resources */
337#ifdef CONFIG_PCI_MSI 337#ifdef CONFIG_PCI_MSI
338 struct list_head msi_list; 338 struct list_head msi_list;
339 struct kset *msi_kset;
339#endif 340#endif
340 struct pci_vpd *vpd; 341 struct pci_vpd *vpd;
341#ifdef CONFIG_PCI_ATS 342#ifdef CONFIG_PCI_ATS
@@ -660,17 +661,13 @@ extern struct pci_bus *pci_find_bus(int domain, int busnr);
660void pci_bus_add_devices(const struct pci_bus *bus); 661void pci_bus_add_devices(const struct pci_bus *bus);
661struct pci_bus *pci_scan_bus_parented(struct device *parent, int bus, 662struct pci_bus *pci_scan_bus_parented(struct device *parent, int bus,
662 struct pci_ops *ops, void *sysdata); 663 struct pci_ops *ops, void *sysdata);
663static inline struct pci_bus * __devinit pci_scan_bus(int bus, struct pci_ops *ops, 664struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops, void *sysdata);
664 void *sysdata) 665struct pci_bus *pci_create_root_bus(struct device *parent, int bus,
665{ 666 struct pci_ops *ops, void *sysdata,
666 struct pci_bus *root_bus; 667 struct list_head *resources);
667 root_bus = pci_scan_bus_parented(NULL, bus, ops, sysdata); 668struct pci_bus * __devinit pci_scan_root_bus(struct device *parent, int bus,
668 if (root_bus) 669 struct pci_ops *ops, void *sysdata,
669 pci_bus_add_devices(root_bus); 670 struct list_head *resources);
670 return root_bus;
671}
672struct pci_bus *pci_create_bus(struct device *parent, int bus,
673 struct pci_ops *ops, void *sysdata);
674struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev, 671struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev,
675 int busnr); 672 int busnr);
676void pcie_update_link_speed(struct pci_bus *bus, u16 link_status); 673void pcie_update_link_speed(struct pci_bus *bus, u16 link_status);
@@ -794,8 +791,11 @@ static inline int pci_is_managed(struct pci_dev *pdev)
794} 791}
795 792
796void pci_disable_device(struct pci_dev *dev); 793void pci_disable_device(struct pci_dev *dev);
794
795extern unsigned int pcibios_max_latency;
797void pci_set_master(struct pci_dev *dev); 796void pci_set_master(struct pci_dev *dev);
798void pci_clear_master(struct pci_dev *dev); 797void pci_clear_master(struct pci_dev *dev);
798
799int pci_set_pcie_reset_state(struct pci_dev *dev, enum pcie_reset_state state); 799int pci_set_pcie_reset_state(struct pci_dev *dev, enum pcie_reset_state state);
800int pci_set_cacheline_size(struct pci_dev *dev); 800int pci_set_cacheline_size(struct pci_dev *dev);
801#define HAVE_PCI_SET_MWI 801#define HAVE_PCI_SET_MWI
@@ -803,6 +803,9 @@ int __must_check pci_set_mwi(struct pci_dev *dev);
803int pci_try_set_mwi(struct pci_dev *dev); 803int pci_try_set_mwi(struct pci_dev *dev);
804void pci_clear_mwi(struct pci_dev *dev); 804void pci_clear_mwi(struct pci_dev *dev);
805void pci_intx(struct pci_dev *dev, int enable); 805void pci_intx(struct pci_dev *dev, int enable);
806bool pci_intx_mask_supported(struct pci_dev *dev);
807bool pci_check_and_mask_intx(struct pci_dev *dev);
808bool pci_check_and_unmask_intx(struct pci_dev *dev);
806void pci_msi_off(struct pci_dev *dev); 809void pci_msi_off(struct pci_dev *dev);
807int pci_set_dma_max_seg_size(struct pci_dev *dev, unsigned int size); 810int pci_set_dma_max_seg_size(struct pci_dev *dev, unsigned int size);
808int pci_set_dma_seg_boundary(struct pci_dev *dev, unsigned long mask); 811int pci_set_dma_seg_boundary(struct pci_dev *dev, unsigned long mask);
@@ -910,6 +913,8 @@ int pci_request_selected_regions_exclusive(struct pci_dev *, int, const char *);
910void pci_release_selected_regions(struct pci_dev *, int); 913void pci_release_selected_regions(struct pci_dev *, int);
911 914
912/* drivers/pci/bus.c */ 915/* drivers/pci/bus.c */
916void pci_add_resource(struct list_head *resources, struct resource *res);
917void pci_free_resource_list(struct list_head *resources);
913void pci_bus_add_resource(struct pci_bus *bus, struct resource *res, unsigned int flags); 918void pci_bus_add_resource(struct pci_bus *bus, struct resource *res, unsigned int flags);
914struct resource *pci_bus_resource_n(const struct pci_bus *bus, int n); 919struct resource *pci_bus_resource_n(const struct pci_bus *bus, int n);
915void pci_bus_remove_resources(struct pci_bus *bus); 920void pci_bus_remove_resources(struct pci_bus *bus);
@@ -1084,8 +1089,9 @@ int ht_create_irq(struct pci_dev *dev, int idx);
1084void ht_destroy_irq(unsigned int irq); 1089void ht_destroy_irq(unsigned int irq);
1085#endif /* CONFIG_HT_IRQ */ 1090#endif /* CONFIG_HT_IRQ */
1086 1091
1087extern void pci_block_user_cfg_access(struct pci_dev *dev); 1092extern void pci_cfg_access_lock(struct pci_dev *dev);
1088extern void pci_unblock_user_cfg_access(struct pci_dev *dev); 1093extern bool pci_cfg_access_trylock(struct pci_dev *dev);
1094extern void pci_cfg_access_unlock(struct pci_dev *dev);
1089 1095
1090/* 1096/*
1091 * PCI domain support. Sometimes called PCI segment (eg by ACPI), 1097 * PCI domain support. Sometimes called PCI segment (eg by ACPI),
@@ -1282,10 +1288,13 @@ static inline void pci_release_regions(struct pci_dev *dev)
1282 1288
1283#define pci_dma_burst_advice(pdev, strat, strategy_parameter) do { } while (0) 1289#define pci_dma_burst_advice(pdev, strat, strategy_parameter) do { } while (0)
1284 1290
1285static inline void pci_block_user_cfg_access(struct pci_dev *dev) 1291static inline void pci_block_cfg_access(struct pci_dev *dev)
1286{ } 1292{ }
1287 1293
1288static inline void pci_unblock_user_cfg_access(struct pci_dev *dev) 1294static inline int pci_block_cfg_access_in_atomic(struct pci_dev *dev)
1295{ return 0; }
1296
1297static inline void pci_unblock_cfg_access(struct pci_dev *dev)
1289{ } 1298{ }
1290 1299
1291static inline struct pci_bus *pci_find_next_bus(const struct pci_bus *from) 1300static inline struct pci_bus *pci_find_next_bus(const struct pci_bus *from)
@@ -1423,10 +1432,10 @@ static inline void pci_fixup_device(enum pci_fixup_pass pass,
1423void __iomem *pcim_iomap(struct pci_dev *pdev, int bar, unsigned long maxlen); 1432void __iomem *pcim_iomap(struct pci_dev *pdev, int bar, unsigned long maxlen);
1424void pcim_iounmap(struct pci_dev *pdev, void __iomem *addr); 1433void pcim_iounmap(struct pci_dev *pdev, void __iomem *addr);
1425void __iomem * const *pcim_iomap_table(struct pci_dev *pdev); 1434void __iomem * const *pcim_iomap_table(struct pci_dev *pdev);
1426int pcim_iomap_regions(struct pci_dev *pdev, u16 mask, const char *name); 1435int pcim_iomap_regions(struct pci_dev *pdev, int mask, const char *name);
1427int pcim_iomap_regions_request_all(struct pci_dev *pdev, u16 mask, 1436int pcim_iomap_regions_request_all(struct pci_dev *pdev, int mask,
1428 const char *name); 1437 const char *name);
1429void pcim_iounmap_regions(struct pci_dev *pdev, u16 mask); 1438void pcim_iounmap_regions(struct pci_dev *pdev, int mask);
1430 1439
1431extern int pci_pci_problems; 1440extern int pci_pci_problems;
1432#define PCIPCI_FAIL 1 /* No PCI PCI DMA */ 1441#define PCIPCI_FAIL 1 /* No PCI PCI DMA */
@@ -1445,8 +1454,10 @@ extern u8 pci_cache_line_size;
1445extern unsigned long pci_hotplug_io_size; 1454extern unsigned long pci_hotplug_io_size;
1446extern unsigned long pci_hotplug_mem_size; 1455extern unsigned long pci_hotplug_mem_size;
1447 1456
1457/* Architecture specific versions may override these (weak) */
1448int pcibios_add_platform_entries(struct pci_dev *dev); 1458int pcibios_add_platform_entries(struct pci_dev *dev);
1449void pcibios_disable_device(struct pci_dev *dev); 1459void pcibios_disable_device(struct pci_dev *dev);
1460void pcibios_set_master(struct pci_dev *dev);
1450int pcibios_set_pcie_reset_state(struct pci_dev *dev, 1461int pcibios_set_pcie_reset_state(struct pci_dev *dev,
1451 enum pcie_reset_state state); 1462 enum pcie_reset_state state);
1452 1463
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 2aaee0ca9da8..31d77af2ef42 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -776,6 +776,29 @@
776#define PCI_DEVICE_ID_ELSA_QS3000 0x3000 776#define PCI_DEVICE_ID_ELSA_QS3000 0x3000
777 777
778#define PCI_VENDOR_ID_STMICRO 0x104A 778#define PCI_VENDOR_ID_STMICRO 0x104A
779#define PCI_DEVICE_ID_STMICRO_USB_HOST 0xCC00
780#define PCI_DEVICE_ID_STMICRO_USB_OHCI 0xCC01
781#define PCI_DEVICE_ID_STMICRO_USB_OTG 0xCC02
782#define PCI_DEVICE_ID_STMICRO_UART_HWFC 0xCC03
783#define PCI_DEVICE_ID_STMICRO_UART_NO_HWFC 0xCC04
784#define PCI_DEVICE_ID_STMICRO_SOC_DMA 0xCC05
785#define PCI_DEVICE_ID_STMICRO_SATA 0xCC06
786#define PCI_DEVICE_ID_STMICRO_I2C 0xCC07
787#define PCI_DEVICE_ID_STMICRO_SPI_HS 0xCC08
788#define PCI_DEVICE_ID_STMICRO_MAC 0xCC09
789#define PCI_DEVICE_ID_STMICRO_SDIO_EMMC 0xCC0A
790#define PCI_DEVICE_ID_STMICRO_SDIO 0xCC0B
791#define PCI_DEVICE_ID_STMICRO_GPIO 0xCC0C
792#define PCI_DEVICE_ID_STMICRO_VIP 0xCC0D
793#define PCI_DEVICE_ID_STMICRO_AUDIO_ROUTER_DMA 0xCC0E
794#define PCI_DEVICE_ID_STMICRO_AUDIO_ROUTER_SRCS 0xCC0F
795#define PCI_DEVICE_ID_STMICRO_AUDIO_ROUTER_MSPS 0xCC10
796#define PCI_DEVICE_ID_STMICRO_CAN 0xCC11
797#define PCI_DEVICE_ID_STMICRO_MLB 0xCC12
798#define PCI_DEVICE_ID_STMICRO_DBP 0xCC13
799#define PCI_DEVICE_ID_STMICRO_SATA_PHY 0xCC14
800#define PCI_DEVICE_ID_STMICRO_ESRAM 0xCC15
801#define PCI_DEVICE_ID_STMICRO_VIC 0xCC16
779 802
780#define PCI_VENDOR_ID_BUSLOGIC 0x104B 803#define PCI_VENDOR_ID_BUSLOGIC 0x104B
781#define PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER_NC 0x0140 804#define PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER_NC 0x0140
diff --git a/include/linux/pci_regs.h b/include/linux/pci_regs.h
index b5d9657f3100..e41a10f5ae83 100644
--- a/include/linux/pci_regs.h
+++ b/include/linux/pci_regs.h
@@ -392,7 +392,7 @@
392#define PCI_EXP_TYPE_DOWNSTREAM 0x6 /* Downstream Port */ 392#define PCI_EXP_TYPE_DOWNSTREAM 0x6 /* Downstream Port */
393#define PCI_EXP_TYPE_PCI_BRIDGE 0x7 /* PCI/PCI-X Bridge */ 393#define PCI_EXP_TYPE_PCI_BRIDGE 0x7 /* PCI/PCI-X Bridge */
394#define PCI_EXP_TYPE_RC_END 0x9 /* Root Complex Integrated Endpoint */ 394#define PCI_EXP_TYPE_RC_END 0x9 /* Root Complex Integrated Endpoint */
395#define PCI_EXP_TYPE_RC_EC 0x10 /* Root Complex Event Collector */ 395#define PCI_EXP_TYPE_RC_EC 0xa /* Root Complex Event Collector */
396#define PCI_EXP_FLAGS_SLOT 0x0100 /* Slot implemented */ 396#define PCI_EXP_FLAGS_SLOT 0x0100 /* Slot implemented */
397#define PCI_EXP_FLAGS_IRQ 0x3e00 /* Interrupt message number */ 397#define PCI_EXP_FLAGS_IRQ 0x3e00 /* Interrupt message number */
398#define PCI_EXP_DEVCAP 4 /* Device capabilities */ 398#define PCI_EXP_DEVCAP 4 /* Device capabilities */
@@ -537,7 +537,9 @@
537#define PCI_EXT_CAP_ID_ARI 14 537#define PCI_EXT_CAP_ID_ARI 14
538#define PCI_EXT_CAP_ID_ATS 15 538#define PCI_EXT_CAP_ID_ATS 15
539#define PCI_EXT_CAP_ID_SRIOV 16 539#define PCI_EXT_CAP_ID_SRIOV 16
540#define PCI_EXT_CAP_ID_PRI 19
540#define PCI_EXT_CAP_ID_LTR 24 541#define PCI_EXT_CAP_ID_LTR 24
542#define PCI_EXT_CAP_ID_PASID 27
541 543
542/* Advanced Error Reporting */ 544/* Advanced Error Reporting */
543#define PCI_ERR_UNCOR_STATUS 4 /* Uncorrectable Error Status */ 545#define PCI_ERR_UNCOR_STATUS 4 /* Uncorrectable Error Status */
@@ -664,24 +666,24 @@
664#define PCI_ATS_MIN_STU 12 /* shift of minimum STU block */ 666#define PCI_ATS_MIN_STU 12 /* shift of minimum STU block */
665 667
666/* Page Request Interface */ 668/* Page Request Interface */
667#define PCI_PRI_CAP 0x13 /* PRI capability ID */ 669#define PCI_PRI_CTRL 0x04 /* PRI control register */
668#define PCI_PRI_CONTROL_OFF 0x04 /* Offset of control register */ 670#define PCI_PRI_CTRL_ENABLE 0x01 /* Enable */
669#define PCI_PRI_STATUS_OFF 0x06 /* Offset of status register */ 671#define PCI_PRI_CTRL_RESET 0x02 /* Reset */
670#define PCI_PRI_ENABLE 0x0001 /* Enable mask */ 672#define PCI_PRI_STATUS 0x06 /* PRI status register */
671#define PCI_PRI_RESET 0x0002 /* Reset bit mask */ 673#define PCI_PRI_STATUS_RF 0x001 /* Response Failure */
672#define PCI_PRI_STATUS_RF 0x0001 /* Request Failure */ 674#define PCI_PRI_STATUS_UPRGI 0x002 /* Unexpected PRG index */
673#define PCI_PRI_STATUS_UPRGI 0x0002 /* Unexpected PRG index */ 675#define PCI_PRI_STATUS_STOPPED 0x100 /* PRI Stopped */
674#define PCI_PRI_STATUS_STOPPED 0x0100 /* PRI Stopped */ 676#define PCI_PRI_MAX_REQ 0x08 /* PRI max reqs supported */
675#define PCI_PRI_MAX_REQ_OFF 0x08 /* Cap offset for max reqs supported */ 677#define PCI_PRI_ALLOC_REQ 0x0c /* PRI max reqs allowed */
676#define PCI_PRI_ALLOC_REQ_OFF 0x0c /* Cap offset for max reqs allowed */
677 678
678/* PASID capability */ 679/* PASID capability */
679#define PCI_PASID_CAP 0x1b /* PASID capability ID */ 680#define PCI_PASID_CAP 0x04 /* PASID feature register */
680#define PCI_PASID_CAP_OFF 0x04 /* PASID feature register */ 681#define PCI_PASID_CAP_EXEC 0x02 /* Exec permissions Supported */
681#define PCI_PASID_CONTROL_OFF 0x06 /* PASID control register */ 682#define PCI_PASID_CAP_PRIV 0x04 /* Priviledge Mode Supported */
682#define PCI_PASID_ENABLE 0x01 /* Enable/Supported bit */ 683#define PCI_PASID_CTRL 0x06 /* PASID control register */
683#define PCI_PASID_EXEC 0x02 /* Exec permissions Enable/Supported */ 684#define PCI_PASID_CTRL_ENABLE 0x01 /* Enable bit */
684#define PCI_PASID_PRIV 0x04 /* Priviledge Mode Enable/Support */ 685#define PCI_PASID_CTRL_EXEC 0x02 /* Exec permissions Enable */
686#define PCI_PASID_CTRL_PRIV 0x04 /* Priviledge Mode Enable */
685 687
686/* Single Root I/O Virtualization */ 688/* Single Root I/O Virtualization */
687#define PCI_SRIOV_CAP 0x04 /* SR-IOV Capabilities */ 689#define PCI_SRIOV_CAP 0x04 /* SR-IOV Capabilities */
diff --git a/include/linux/pda_power.h b/include/linux/pda_power.h
index c9e4d814ff77..2bb62bf296ac 100644
--- a/include/linux/pda_power.h
+++ b/include/linux/pda_power.h
@@ -35,6 +35,8 @@ struct pda_power_pdata {
35 unsigned int polling_interval; /* msecs, default is 2000 */ 35 unsigned int polling_interval; /* msecs, default is 2000 */
36 36
37 unsigned long ac_max_uA; /* current to draw when on AC */ 37 unsigned long ac_max_uA; /* current to draw when on AC */
38
39 bool use_otg_notifier;
38}; 40};
39 41
40#endif /* __PDA_POWER_H__ */ 42#endif /* __PDA_POWER_H__ */
diff --git a/include/linux/percpu.h b/include/linux/percpu.h
index 9ca008f0c542..32cd1f67462e 100644
--- a/include/linux/percpu.h
+++ b/include/linux/percpu.h
@@ -172,10 +172,10 @@ extern phys_addr_t per_cpu_ptr_to_phys(void *addr);
172 * equal char, int or long. percpu_read() evaluates to a lvalue and 172 * equal char, int or long. percpu_read() evaluates to a lvalue and
173 * all others to void. 173 * all others to void.
174 * 174 *
175 * These operations are guaranteed to be atomic w.r.t. preemption. 175 * These operations are guaranteed to be atomic.
176 * The generic versions use plain get/put_cpu_var(). Archs are 176 * The generic versions disable interrupts. Archs are
177 * encouraged to implement single-instruction alternatives which don't 177 * encouraged to implement single-instruction alternatives which don't
178 * require preemption protection. 178 * require protection.
179 */ 179 */
180#ifndef percpu_read 180#ifndef percpu_read
181# define percpu_read(var) \ 181# define percpu_read(var) \
@@ -347,9 +347,10 @@ do { \
347 347
348#define _this_cpu_generic_to_op(pcp, val, op) \ 348#define _this_cpu_generic_to_op(pcp, val, op) \
349do { \ 349do { \
350 preempt_disable(); \ 350 unsigned long flags; \
351 local_irq_save(flags); \
351 *__this_cpu_ptr(&(pcp)) op val; \ 352 *__this_cpu_ptr(&(pcp)) op val; \
352 preempt_enable(); \ 353 local_irq_restore(flags); \
353} while (0) 354} while (0)
354 355
355#ifndef this_cpu_write 356#ifndef this_cpu_write
@@ -447,10 +448,11 @@ do { \
447#define _this_cpu_generic_add_return(pcp, val) \ 448#define _this_cpu_generic_add_return(pcp, val) \
448({ \ 449({ \
449 typeof(pcp) ret__; \ 450 typeof(pcp) ret__; \
450 preempt_disable(); \ 451 unsigned long flags; \
452 local_irq_save(flags); \
451 __this_cpu_add(pcp, val); \ 453 __this_cpu_add(pcp, val); \
452 ret__ = __this_cpu_read(pcp); \ 454 ret__ = __this_cpu_read(pcp); \
453 preempt_enable(); \ 455 local_irq_restore(flags); \
454 ret__; \ 456 ret__; \
455}) 457})
456 458
@@ -476,10 +478,11 @@ do { \
476 478
477#define _this_cpu_generic_xchg(pcp, nval) \ 479#define _this_cpu_generic_xchg(pcp, nval) \
478({ typeof(pcp) ret__; \ 480({ typeof(pcp) ret__; \
479 preempt_disable(); \ 481 unsigned long flags; \
482 local_irq_save(flags); \
480 ret__ = __this_cpu_read(pcp); \ 483 ret__ = __this_cpu_read(pcp); \
481 __this_cpu_write(pcp, nval); \ 484 __this_cpu_write(pcp, nval); \
482 preempt_enable(); \ 485 local_irq_restore(flags); \
483 ret__; \ 486 ret__; \
484}) 487})
485 488
@@ -501,12 +504,14 @@ do { \
501#endif 504#endif
502 505
503#define _this_cpu_generic_cmpxchg(pcp, oval, nval) \ 506#define _this_cpu_generic_cmpxchg(pcp, oval, nval) \
504({ typeof(pcp) ret__; \ 507({ \
505 preempt_disable(); \ 508 typeof(pcp) ret__; \
509 unsigned long flags; \
510 local_irq_save(flags); \
506 ret__ = __this_cpu_read(pcp); \ 511 ret__ = __this_cpu_read(pcp); \
507 if (ret__ == (oval)) \ 512 if (ret__ == (oval)) \
508 __this_cpu_write(pcp, nval); \ 513 __this_cpu_write(pcp, nval); \
509 preempt_enable(); \ 514 local_irq_restore(flags); \
510 ret__; \ 515 ret__; \
511}) 516})
512 517
@@ -538,10 +543,11 @@ do { \
538#define _this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \ 543#define _this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \
539({ \ 544({ \
540 int ret__; \ 545 int ret__; \
541 preempt_disable(); \ 546 unsigned long flags; \
547 local_irq_save(flags); \
542 ret__ = __this_cpu_generic_cmpxchg_double(pcp1, pcp2, \ 548 ret__ = __this_cpu_generic_cmpxchg_double(pcp1, pcp2, \
543 oval1, oval2, nval1, nval2); \ 549 oval1, oval2, nval1, nval2); \
544 preempt_enable(); \ 550 local_irq_restore(flags); \
545 ret__; \ 551 ret__; \
546}) 552})
547 553
@@ -567,9 +573,9 @@ do { \
567#endif 573#endif
568 574
569/* 575/*
570 * Generic percpu operations that do not require preemption handling. 576 * Generic percpu operations for context that are safe from preemption/interrupts.
571 * Either we do not care about races or the caller has the 577 * Either we do not care about races or the caller has the
572 * responsibility of handling preemptions issues. Arch code can still 578 * responsibility of handling preemption/interrupt issues. Arch code can still
573 * override these instructions since the arch per cpu code may be more 579 * override these instructions since the arch per cpu code may be more
574 * efficient and may actually get race freeness for free (that is the 580 * efficient and may actually get race freeness for free (that is the
575 * case for x86 for example). 581 * case for x86 for example).
@@ -802,156 +808,4 @@ do { \
802 __pcpu_double_call_return_bool(__this_cpu_cmpxchg_double_, (pcp1), (pcp2), (oval1), (oval2), (nval1), (nval2)) 808 __pcpu_double_call_return_bool(__this_cpu_cmpxchg_double_, (pcp1), (pcp2), (oval1), (oval2), (nval1), (nval2))
803#endif 809#endif
804 810
805/*
806 * IRQ safe versions of the per cpu RMW operations. Note that these operations
807 * are *not* safe against modification of the same variable from another
808 * processors (which one gets when using regular atomic operations)
809 * They are guaranteed to be atomic vs. local interrupts and
810 * preemption only.
811 */
812#define irqsafe_cpu_generic_to_op(pcp, val, op) \
813do { \
814 unsigned long flags; \
815 local_irq_save(flags); \
816 *__this_cpu_ptr(&(pcp)) op val; \
817 local_irq_restore(flags); \
818} while (0)
819
820#ifndef irqsafe_cpu_add
821# ifndef irqsafe_cpu_add_1
822# define irqsafe_cpu_add_1(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), +=)
823# endif
824# ifndef irqsafe_cpu_add_2
825# define irqsafe_cpu_add_2(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), +=)
826# endif
827# ifndef irqsafe_cpu_add_4
828# define irqsafe_cpu_add_4(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), +=)
829# endif
830# ifndef irqsafe_cpu_add_8
831# define irqsafe_cpu_add_8(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), +=)
832# endif
833# define irqsafe_cpu_add(pcp, val) __pcpu_size_call(irqsafe_cpu_add_, (pcp), (val))
834#endif
835
836#ifndef irqsafe_cpu_sub
837# define irqsafe_cpu_sub(pcp, val) irqsafe_cpu_add((pcp), -(val))
838#endif
839
840#ifndef irqsafe_cpu_inc
841# define irqsafe_cpu_inc(pcp) irqsafe_cpu_add((pcp), 1)
842#endif
843
844#ifndef irqsafe_cpu_dec
845# define irqsafe_cpu_dec(pcp) irqsafe_cpu_sub((pcp), 1)
846#endif
847
848#ifndef irqsafe_cpu_and
849# ifndef irqsafe_cpu_and_1
850# define irqsafe_cpu_and_1(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), &=)
851# endif
852# ifndef irqsafe_cpu_and_2
853# define irqsafe_cpu_and_2(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), &=)
854# endif
855# ifndef irqsafe_cpu_and_4
856# define irqsafe_cpu_and_4(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), &=)
857# endif
858# ifndef irqsafe_cpu_and_8
859# define irqsafe_cpu_and_8(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), &=)
860# endif
861# define irqsafe_cpu_and(pcp, val) __pcpu_size_call(irqsafe_cpu_and_, (val))
862#endif
863
864#ifndef irqsafe_cpu_or
865# ifndef irqsafe_cpu_or_1
866# define irqsafe_cpu_or_1(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), |=)
867# endif
868# ifndef irqsafe_cpu_or_2
869# define irqsafe_cpu_or_2(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), |=)
870# endif
871# ifndef irqsafe_cpu_or_4
872# define irqsafe_cpu_or_4(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), |=)
873# endif
874# ifndef irqsafe_cpu_or_8
875# define irqsafe_cpu_or_8(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), |=)
876# endif
877# define irqsafe_cpu_or(pcp, val) __pcpu_size_call(irqsafe_cpu_or_, (val))
878#endif
879
880#ifndef irqsafe_cpu_xor
881# ifndef irqsafe_cpu_xor_1
882# define irqsafe_cpu_xor_1(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), ^=)
883# endif
884# ifndef irqsafe_cpu_xor_2
885# define irqsafe_cpu_xor_2(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), ^=)
886# endif
887# ifndef irqsafe_cpu_xor_4
888# define irqsafe_cpu_xor_4(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), ^=)
889# endif
890# ifndef irqsafe_cpu_xor_8
891# define irqsafe_cpu_xor_8(pcp, val) irqsafe_cpu_generic_to_op((pcp), (val), ^=)
892# endif
893# define irqsafe_cpu_xor(pcp, val) __pcpu_size_call(irqsafe_cpu_xor_, (val))
894#endif
895
896#define irqsafe_cpu_generic_cmpxchg(pcp, oval, nval) \
897({ \
898 typeof(pcp) ret__; \
899 unsigned long flags; \
900 local_irq_save(flags); \
901 ret__ = __this_cpu_read(pcp); \
902 if (ret__ == (oval)) \
903 __this_cpu_write(pcp, nval); \
904 local_irq_restore(flags); \
905 ret__; \
906})
907
908#ifndef irqsafe_cpu_cmpxchg
909# ifndef irqsafe_cpu_cmpxchg_1
910# define irqsafe_cpu_cmpxchg_1(pcp, oval, nval) irqsafe_cpu_generic_cmpxchg(pcp, oval, nval)
911# endif
912# ifndef irqsafe_cpu_cmpxchg_2
913# define irqsafe_cpu_cmpxchg_2(pcp, oval, nval) irqsafe_cpu_generic_cmpxchg(pcp, oval, nval)
914# endif
915# ifndef irqsafe_cpu_cmpxchg_4
916# define irqsafe_cpu_cmpxchg_4(pcp, oval, nval) irqsafe_cpu_generic_cmpxchg(pcp, oval, nval)
917# endif
918# ifndef irqsafe_cpu_cmpxchg_8
919# define irqsafe_cpu_cmpxchg_8(pcp, oval, nval) irqsafe_cpu_generic_cmpxchg(pcp, oval, nval)
920# endif
921# define irqsafe_cpu_cmpxchg(pcp, oval, nval) \
922 __pcpu_size_call_return2(irqsafe_cpu_cmpxchg_, (pcp), oval, nval)
923#endif
924
925#define irqsafe_generic_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \
926({ \
927 int ret__; \
928 unsigned long flags; \
929 local_irq_save(flags); \
930 ret__ = __this_cpu_generic_cmpxchg_double(pcp1, pcp2, \
931 oval1, oval2, nval1, nval2); \
932 local_irq_restore(flags); \
933 ret__; \
934})
935
936#ifndef irqsafe_cpu_cmpxchg_double
937# ifndef irqsafe_cpu_cmpxchg_double_1
938# define irqsafe_cpu_cmpxchg_double_1(pcp1, pcp2, oval1, oval2, nval1, nval2) \
939 irqsafe_generic_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
940# endif
941# ifndef irqsafe_cpu_cmpxchg_double_2
942# define irqsafe_cpu_cmpxchg_double_2(pcp1, pcp2, oval1, oval2, nval1, nval2) \
943 irqsafe_generic_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
944# endif
945# ifndef irqsafe_cpu_cmpxchg_double_4
946# define irqsafe_cpu_cmpxchg_double_4(pcp1, pcp2, oval1, oval2, nval1, nval2) \
947 irqsafe_generic_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
948# endif
949# ifndef irqsafe_cpu_cmpxchg_double_8
950# define irqsafe_cpu_cmpxchg_double_8(pcp1, pcp2, oval1, oval2, nval1, nval2) \
951 irqsafe_generic_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
952# endif
953# define irqsafe_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \
954 __pcpu_double_call_return_bool(irqsafe_cpu_cmpxchg_double_, (pcp1), (pcp2), (oval1), (oval2), (nval1), (nval2))
955#endif
956
957#endif /* __LINUX_PERCPU_H */ 811#endif /* __LINUX_PERCPU_H */
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 08855613ceb3..abb2776be1ba 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -587,6 +587,7 @@ struct hw_perf_event {
587 u64 sample_period; 587 u64 sample_period;
588 u64 last_period; 588 u64 last_period;
589 local64_t period_left; 589 local64_t period_left;
590 u64 interrupts_seq;
590 u64 interrupts; 591 u64 interrupts;
591 592
592 u64 freq_time_stamp; 593 u64 freq_time_stamp;
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 79f337c47388..c599f7eca1e7 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -129,7 +129,12 @@ struct mii_bus {
129}; 129};
130#define to_mii_bus(d) container_of(d, struct mii_bus, dev) 130#define to_mii_bus(d) container_of(d, struct mii_bus, dev)
131 131
132struct mii_bus *mdiobus_alloc(void); 132struct mii_bus *mdiobus_alloc_size(size_t);
133static inline struct mii_bus *mdiobus_alloc(void)
134{
135 return mdiobus_alloc_size(0);
136}
137
133int mdiobus_register(struct mii_bus *bus); 138int mdiobus_register(struct mii_bus *bus);
134void mdiobus_unregister(struct mii_bus *bus); 139void mdiobus_unregister(struct mii_bus *bus);
135void mdiobus_free(struct mii_bus *bus); 140void mdiobus_free(struct mii_bus *bus);
diff --git a/include/linux/pid_namespace.h b/include/linux/pid_namespace.h
index 38d10326246a..e7cf6669ac34 100644
--- a/include/linux/pid_namespace.h
+++ b/include/linux/pid_namespace.h
@@ -30,6 +30,8 @@ struct pid_namespace {
30#ifdef CONFIG_BSD_PROCESS_ACCT 30#ifdef CONFIG_BSD_PROCESS_ACCT
31 struct bsd_acct_struct *bacct; 31 struct bsd_acct_struct *bacct;
32#endif 32#endif
33 gid_t pid_gid;
34 int hide_pid;
33}; 35};
34 36
35extern struct pid_namespace init_pid_ns; 37extern struct pid_namespace init_pid_ns;
diff --git a/include/linux/pinctrl/machine.h b/include/linux/pinctrl/machine.h
index 88863531d862..d0aecb7f6fb9 100644
--- a/include/linux/pinctrl/machine.h
+++ b/include/linux/pinctrl/machine.h
@@ -48,7 +48,7 @@ struct pinmux_map {
48 const char *group; 48 const char *group;
49 struct device *dev; 49 struct device *dev;
50 const char *dev_name; 50 const char *dev_name;
51 const bool hog_on_boot; 51 bool hog_on_boot;
52}; 52};
53 53
54/* 54/*
@@ -66,30 +66,22 @@ struct pinmux_map {
66 { .name = a, .ctrl_dev_name = b, .function = c } 66 { .name = a, .ctrl_dev_name = b, .function = c }
67 67
68/* 68/*
69 * Convenience macro to map a function onto the primary device pinctrl device 69 * Convenience macro to map a system function onto a certain pinctrl device,
70 * this is especially helpful on systems that have only one pin controller 70 * to be hogged by the pinmux core until the system shuts down.
71 * or need to set up a lot of mappings on the primary controller.
72 */
73#define PINMUX_MAP_PRIMARY(a, b, c) \
74 { .name = a, .ctrl_dev_name = "pinctrl.0", .function = b, \
75 .dev_name = c }
76
77/*
78 * Convenience macro to map a system function onto the primary pinctrl device.
79 * System functions are not assigned to a particular device.
80 */ 71 */
81#define PINMUX_MAP_PRIMARY_SYS(a, b) \ 72#define PINMUX_MAP_SYS_HOG(a, b, c) \
82 { .name = a, .ctrl_dev_name = "pinctrl.0", .function = b } 73 { .name = a, .ctrl_dev_name = b, .function = c, \
74 .hog_on_boot = true }
83 75
84/* 76/*
85 * Convenience macro to map a system function onto the primary pinctrl device, 77 * Convenience macro to map a system function onto a certain pinctrl device
86 * to be hogged by the pinmux core until the system shuts down. 78 * using a specified group, to be hogged by the pinmux core until the system
79 * shuts down.
87 */ 80 */
88#define PINMUX_MAP_PRIMARY_SYS_HOG(a, b) \ 81#define PINMUX_MAP_SYS_HOG_GROUP(a, b, c, d) \
89 { .name = a, .ctrl_dev_name = "pinctrl.0", .function = b, \ 82 { .name = a, .ctrl_dev_name = b, .function = c, .group = d, \
90 .hog_on_boot = true } 83 .hog_on_boot = true }
91 84
92
93#ifdef CONFIG_PINMUX 85#ifdef CONFIG_PINMUX
94 86
95extern int pinmux_register_mappings(struct pinmux_map const *map, 87extern int pinmux_register_mappings(struct pinmux_map const *map,
diff --git a/include/linux/pinctrl/pinconf.h b/include/linux/pinctrl/pinconf.h
new file mode 100644
index 000000000000..477922cf043a
--- /dev/null
+++ b/include/linux/pinctrl/pinconf.h
@@ -0,0 +1,97 @@
1/*
2 * Interface the pinconfig portions of the pinctrl subsystem
3 *
4 * Copyright (C) 2011 ST-Ericsson SA
5 * Written on behalf of Linaro for ST-Ericsson
6 * This interface is used in the core to keep track of pins.
7 *
8 * Author: Linus Walleij <linus.walleij@linaro.org>
9 *
10 * License terms: GNU General Public License (GPL) version 2
11 */
12#ifndef __LINUX_PINCTRL_PINCONF_H
13#define __LINUX_PINCTRL_PINCONF_H
14
15#ifdef CONFIG_PINCONF
16
17struct pinctrl_dev;
18struct seq_file;
19
20/**
21 * struct pinconf_ops - pin config operations, to be implemented by
22 * pin configuration capable drivers.
23 * @pin_config_get: get the config of a certain pin, if the requested config
24 * is not available on this controller this should return -ENOTSUPP
25 * and if it is available but disabled it should return -EINVAL
26 * @pin_config_get: get the config of a certain pin
27 * @pin_config_set: configure an individual pin
28 * @pin_config_group_get: get configurations for an entire pin group
29 * @pin_config_group_set: configure all pins in a group
30 * @pin_config_dbg_show: optional debugfs display hook that will provide
31 * per-device info for a certain pin in debugfs
32 * @pin_config_group_dbg_show: optional debugfs display hook that will provide
33 * per-device info for a certain group in debugfs
34 */
35struct pinconf_ops {
36 int (*pin_config_get) (struct pinctrl_dev *pctldev,
37 unsigned pin,
38 unsigned long *config);
39 int (*pin_config_set) (struct pinctrl_dev *pctldev,
40 unsigned pin,
41 unsigned long config);
42 int (*pin_config_group_get) (struct pinctrl_dev *pctldev,
43 unsigned selector,
44 unsigned long *config);
45 int (*pin_config_group_set) (struct pinctrl_dev *pctldev,
46 unsigned selector,
47 unsigned long config);
48 void (*pin_config_dbg_show) (struct pinctrl_dev *pctldev,
49 struct seq_file *s,
50 unsigned offset);
51 void (*pin_config_group_dbg_show) (struct pinctrl_dev *pctldev,
52 struct seq_file *s,
53 unsigned selector);
54};
55
56extern int pin_config_get(const char *dev_name, const char *name,
57 unsigned long *config);
58extern int pin_config_set(const char *dev_name, const char *name,
59 unsigned long config);
60extern int pin_config_group_get(const char *dev_name,
61 const char *pin_group,
62 unsigned long *config);
63extern int pin_config_group_set(const char *dev_name,
64 const char *pin_group,
65 unsigned long config);
66
67#else
68
69static inline int pin_config_get(const char *dev_name, const char *name,
70 unsigned long *config)
71{
72 return 0;
73}
74
75static inline int pin_config_set(const char *dev_name, const char *name,
76 unsigned long config)
77{
78 return 0;
79}
80
81static inline int pin_config_group_get(const char *dev_name,
82 const char *pin_group,
83 unsigned long *config)
84{
85 return 0;
86}
87
88static inline int pin_config_group_set(const char *dev_name,
89 const char *pin_group,
90 unsigned long config)
91{
92 return 0;
93}
94
95#endif
96
97#endif /* __LINUX_PINCTRL_PINCONF_H */
diff --git a/include/linux/pinctrl/pinctrl.h b/include/linux/pinctrl/pinctrl.h
index 04c011038f32..8bd22ee7aa09 100644
--- a/include/linux/pinctrl/pinctrl.h
+++ b/include/linux/pinctrl/pinctrl.h
@@ -21,6 +21,7 @@
21 21
22struct pinctrl_dev; 22struct pinctrl_dev;
23struct pinmux_ops; 23struct pinmux_ops;
24struct pinconf_ops;
24struct gpio_chip; 25struct gpio_chip;
25 26
26/** 27/**
@@ -45,6 +46,7 @@ struct pinctrl_pin_desc {
45 * @name: a name for the chip in this range 46 * @name: a name for the chip in this range
46 * @id: an ID number for the chip in this range 47 * @id: an ID number for the chip in this range
47 * @base: base offset of the GPIO range 48 * @base: base offset of the GPIO range
49 * @pin_base: base pin number of the GPIO range
48 * @npins: number of pins in the GPIO range, including the base number 50 * @npins: number of pins in the GPIO range, including the base number
49 * @gc: an optional pointer to a gpio_chip 51 * @gc: an optional pointer to a gpio_chip
50 */ 52 */
@@ -53,6 +55,7 @@ struct pinctrl_gpio_range {
53 const char *name; 55 const char *name;
54 unsigned int id; 56 unsigned int id;
55 unsigned int base; 57 unsigned int base;
58 unsigned int pin_base;
56 unsigned int npins; 59 unsigned int npins;
57 struct gpio_chip *gc; 60 struct gpio_chip *gc;
58}; 61};
@@ -89,22 +92,20 @@ struct pinctrl_ops {
89 * this pin controller 92 * this pin controller
90 * @npins: number of descriptors in the array, usually just ARRAY_SIZE() 93 * @npins: number of descriptors in the array, usually just ARRAY_SIZE()
91 * of the pins field above 94 * of the pins field above
92 * @maxpin: since pin spaces may be sparse, there can he "holes" in the
93 * pin range, this attribute gives the maximum pin number in the
94 * total range. This should not be lower than npins for example,
95 * but may be equal to npins if you have no holes in the pin range.
96 * @pctlops: pin control operation vtable, to support global concepts like 95 * @pctlops: pin control operation vtable, to support global concepts like
97 * grouping of pins, this is optional. 96 * grouping of pins, this is optional.
98 * @pmxops: pinmux operation vtable, if you support pinmuxing in your driver 97 * @pmxops: pinmux operations vtable, if you support pinmuxing in your driver
98 * @confops: pin config operations vtable, if you support pin configuration in
99 * your driver
99 * @owner: module providing the pin controller, used for refcounting 100 * @owner: module providing the pin controller, used for refcounting
100 */ 101 */
101struct pinctrl_desc { 102struct pinctrl_desc {
102 const char *name; 103 const char *name;
103 struct pinctrl_pin_desc const *pins; 104 struct pinctrl_pin_desc const *pins;
104 unsigned int npins; 105 unsigned int npins;
105 unsigned int maxpin;
106 struct pinctrl_ops *pctlops; 106 struct pinctrl_ops *pctlops;
107 struct pinmux_ops *pmxops; 107 struct pinmux_ops *pmxops;
108 struct pinconf_ops *confops;
108 struct module *owner; 109 struct module *owner;
109}; 110};
110 111
@@ -123,7 +124,7 @@ extern void *pinctrl_dev_get_drvdata(struct pinctrl_dev *pctldev);
123 124
124struct pinctrl_dev; 125struct pinctrl_dev;
125 126
126/* Sufficiently stupid default function when pinctrl is not in use */ 127/* Sufficiently stupid default functions when pinctrl is not in use */
127static inline bool pin_is_valid(struct pinctrl_dev *pctldev, int pin) 128static inline bool pin_is_valid(struct pinctrl_dev *pctldev, int pin)
128{ 129{
129 return pin >= 0; 130 return pin >= 0;
diff --git a/include/linux/pinctrl/pinmux.h b/include/linux/pinctrl/pinmux.h
index 3c430e797efc..937b3e2fa36f 100644
--- a/include/linux/pinctrl/pinmux.h
+++ b/include/linux/pinctrl/pinmux.h
@@ -52,9 +52,15 @@ struct pinctrl_dev;
52 * @disable: disable a certain muxing selector with a certain pin group 52 * @disable: disable a certain muxing selector with a certain pin group
53 * @gpio_request_enable: requests and enables GPIO on a certain pin. 53 * @gpio_request_enable: requests and enables GPIO on a certain pin.
54 * Implement this only if you can mux every pin individually as GPIO. The 54 * Implement this only if you can mux every pin individually as GPIO. The
55 * affected GPIO range is passed along with an offset into that 55 * affected GPIO range is passed along with an offset(pin number) into that
56 * specific GPIO range - function selectors and pin groups are orthogonal 56 * specific GPIO range - function selectors and pin groups are orthogonal
57 * to this, the core will however make sure the pins do not collide 57 * to this, the core will however make sure the pins do not collide.
58 * @gpio_disable_free: free up GPIO muxing on a certain pin, the reverse of
59 * @gpio_request_enable
60 * @gpio_set_direction: Since controllers may need different configurations
61 * depending on whether the GPIO is configured as input or output,
62 * a direction selector function may be implemented as a backing
63 * to the GPIO controllers that need pin muxing.
58 */ 64 */
59struct pinmux_ops { 65struct pinmux_ops {
60 int (*request) (struct pinctrl_dev *pctldev, unsigned offset); 66 int (*request) (struct pinctrl_dev *pctldev, unsigned offset);
@@ -73,11 +79,20 @@ struct pinmux_ops {
73 int (*gpio_request_enable) (struct pinctrl_dev *pctldev, 79 int (*gpio_request_enable) (struct pinctrl_dev *pctldev,
74 struct pinctrl_gpio_range *range, 80 struct pinctrl_gpio_range *range,
75 unsigned offset); 81 unsigned offset);
82 void (*gpio_disable_free) (struct pinctrl_dev *pctldev,
83 struct pinctrl_gpio_range *range,
84 unsigned offset);
85 int (*gpio_set_direction) (struct pinctrl_dev *pctldev,
86 struct pinctrl_gpio_range *range,
87 unsigned offset,
88 bool input);
76}; 89};
77 90
78/* External interface to pinmux */ 91/* External interface to pinmux */
79extern int pinmux_request_gpio(unsigned gpio); 92extern int pinmux_request_gpio(unsigned gpio);
80extern void pinmux_free_gpio(unsigned gpio); 93extern void pinmux_free_gpio(unsigned gpio);
94extern int pinmux_gpio_direction_input(unsigned gpio);
95extern int pinmux_gpio_direction_output(unsigned gpio);
81extern struct pinmux * __must_check pinmux_get(struct device *dev, const char *name); 96extern struct pinmux * __must_check pinmux_get(struct device *dev, const char *name);
82extern void pinmux_put(struct pinmux *pmx); 97extern void pinmux_put(struct pinmux *pmx);
83extern int pinmux_enable(struct pinmux *pmx); 98extern int pinmux_enable(struct pinmux *pmx);
@@ -94,6 +109,16 @@ static inline void pinmux_free_gpio(unsigned gpio)
94{ 109{
95} 110}
96 111
112static inline int pinmux_gpio_direction_input(unsigned gpio)
113{
114 return 0;
115}
116
117static inline int pinmux_gpio_direction_output(unsigned gpio)
118{
119 return 0;
120}
121
97static inline struct pinmux * __must_check pinmux_get(struct device *dev, const char *name) 122static inline struct pinmux * __must_check pinmux_get(struct device *dev, const char *name)
98{ 123{
99 return NULL; 124 return NULL;
diff --git a/include/linux/pkt_sched.h b/include/linux/pkt_sched.h
index 8f1b928f777c..0d5b79365d03 100644
--- a/include/linux/pkt_sched.h
+++ b/include/linux/pkt_sched.h
@@ -162,10 +162,30 @@ struct tc_sfq_qopt {
162 unsigned flows; /* Maximal number of flows */ 162 unsigned flows; /* Maximal number of flows */
163}; 163};
164 164
165struct tc_sfqred_stats {
166 __u32 prob_drop; /* Early drops, below max threshold */
167 __u32 forced_drop; /* Early drops, after max threshold */
168 __u32 prob_mark; /* Marked packets, below max threshold */
169 __u32 forced_mark; /* Marked packets, after max threshold */
170 __u32 prob_mark_head; /* Marked packets, below max threshold */
171 __u32 forced_mark_head;/* Marked packets, after max threshold */
172};
173
165struct tc_sfq_qopt_v1 { 174struct tc_sfq_qopt_v1 {
166 struct tc_sfq_qopt v0; 175 struct tc_sfq_qopt v0;
167 unsigned int depth; /* max number of packets per flow */ 176 unsigned int depth; /* max number of packets per flow */
168 unsigned int headdrop; 177 unsigned int headdrop;
178/* SFQRED parameters */
179 __u32 limit; /* HARD maximal flow queue length (bytes) */
180 __u32 qth_min; /* Min average length threshold (bytes) */
181 __u32 qth_max; /* Max average length threshold (bytes) */
182 unsigned char Wlog; /* log(W) */
183 unsigned char Plog; /* log(P_max/(qth_max-qth_min)) */
184 unsigned char Scell_log; /* cell size for idle damping */
185 unsigned char flags;
186 __u32 max_P; /* probability, high resolution */
187/* SFQRED stats */
188 struct tc_sfqred_stats stats;
169}; 189};
170 190
171 191
diff --git a/include/linux/platform_data/macb.h b/include/linux/platform_data/macb.h
new file mode 100644
index 000000000000..b081c7245ec8
--- /dev/null
+++ b/include/linux/platform_data/macb.h
@@ -0,0 +1,17 @@
1/*
2 * Copyright (C) 2004-2006 Atmel Corporation
3 *
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#ifndef __MACB_PDATA_H__
9#define __MACB_PDATA_H__
10
11struct macb_platform_data {
12 u32 phy_mask;
13 int phy_irq_pin; /* PHY IRQ */
14 u8 is_rmii; /* using RMII interface? */
15};
16
17#endif /* __MACB_PDATA_H__ */
diff --git a/include/linux/platform_data/mv_usb.h b/include/linux/platform_data/mv_usb.h
index e9d9149ddf38..d94804aca764 100644
--- a/include/linux/platform_data/mv_usb.h
+++ b/include/linux/platform_data/mv_usb.h
@@ -42,9 +42,23 @@ struct mv_usb_platform_data {
42 /* only valid for HCD. OTG or Host only*/ 42 /* only valid for HCD. OTG or Host only*/
43 unsigned int mode; 43 unsigned int mode;
44 44
45 int (*phy_init)(unsigned int regbase); 45 /* This flag is used for that needs id pin checked by otg */
46 void (*phy_deinit)(unsigned int regbase); 46 unsigned int disable_otg_clock_gating:1;
47 /* Force a_bus_req to be asserted */
48 unsigned int otg_force_a_bus_req:1;
49
50 int (*phy_init)(void __iomem *regbase);
51 void (*phy_deinit)(void __iomem *regbase);
47 int (*set_vbus)(unsigned int vbus); 52 int (*set_vbus)(unsigned int vbus);
53 int (*private_init)(void __iomem *opregs, void __iomem *phyregs);
48}; 54};
49 55
56#ifndef CONFIG_HAVE_CLK
57/* Dummy stub for clk framework */
58#define clk_get(dev, id) NULL
59#define clk_put(clock) do {} while (0)
60#define clk_enable(clock) do {} while (0)
61#define clk_disable(clock) do {} while (0)
62#endif
63
50#endif 64#endif
diff --git a/include/linux/platform_data/s3c-hsudc.h b/include/linux/platform_data/s3c-hsudc.h
new file mode 100644
index 000000000000..6fa109339bf9
--- /dev/null
+++ b/include/linux/platform_data/s3c-hsudc.h
@@ -0,0 +1,34 @@
1/*
2 * S3C24XX USB 2.0 High-speed USB controller gadget driver
3 *
4 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
5 * http://www.samsung.com/
6 *
7 * The S3C24XX USB 2.0 high-speed USB controller supports upto 9 endpoints.
8 * Each endpoint can be configured as either in or out endpoint. Endpoints
9 * can be configured for Bulk or Interrupt transfer mode.
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
14*/
15
16#ifndef __LINUX_USB_S3C_HSUDC_H
17#define __LINUX_USB_S3C_HSUDC_H
18
19/**
20 * s3c24xx_hsudc_platdata - Platform data for USB High-Speed gadget controller.
21 * @epnum: Number of endpoints to be instantiated by the controller driver.
22 * @gpio_init: Platform specific USB related GPIO initialization.
23 * @gpio_uninit: Platform specific USB releted GPIO uninitialzation.
24 *
25 * Representation of platform data for the S3C24XX USB 2.0 High Speed gadget
26 * controllers.
27 */
28struct s3c24xx_hsudc_platdata {
29 unsigned int epnum;
30 void (*gpio_init)(void);
31 void (*gpio_uninit)(void);
32};
33
34#endif /* __LINUX_USB_S3C_HSUDC_H */
diff --git a/include/linux/pmu.h b/include/linux/pmu.h
index cafe98d96948..84e6a55a1202 100644
--- a/include/linux/pmu.h
+++ b/include/linux/pmu.h
@@ -6,6 +6,8 @@
6 * Copyright (C) 1998 Paul Mackerras. 6 * Copyright (C) 1998 Paul Mackerras.
7 */ 7 */
8 8
9#ifndef _LINUX_PMU_H
10#define _LINUX_PMU_H
9 11
10#define PMU_DRIVER_VERSION 2 12#define PMU_DRIVER_VERSION 2
11 13
@@ -207,3 +209,5 @@ extern int pmu_sys_suspended;
207#endif 209#endif
208 210
209#endif /* __KERNEL__ */ 211#endif /* __KERNEL__ */
212
213#endif /* _LINUX_PMU_H */
diff --git a/include/linux/power/charger-manager.h b/include/linux/power/charger-manager.h
new file mode 100644
index 000000000000..4f75e531c112
--- /dev/null
+++ b/include/linux/power/charger-manager.h
@@ -0,0 +1,147 @@
1/*
2 * Copyright (C) 2011 Samsung Electronics Co., Ltd.
3 * MyungJoo.Ham <myungjoo.ham@samsung.com>
4 *
5 * Charger Manager.
6 * This framework enables to control and multiple chargers and to
7 * monitor charging even in the context of suspend-to-RAM with
8 * an interface combining the chargers.
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
15#ifndef _CHARGER_MANAGER_H
16#define _CHARGER_MANAGER_H
17
18#include <linux/power_supply.h>
19
20enum data_source {
21 CM_FUEL_GAUGE,
22 CM_CHARGER_STAT,
23};
24
25enum polling_modes {
26 CM_POLL_DISABLE = 0,
27 CM_POLL_ALWAYS,
28 CM_POLL_EXTERNAL_POWER_ONLY,
29 CM_POLL_CHARGING_ONLY,
30};
31
32/**
33 * struct charger_global_desc
34 * @rtc_name: the name of RTC used to wake up the system from suspend.
35 * @rtc_only_wakeup:
36 * If the system is woken up by waekup-sources other than the RTC or
37 * callbacks, Charger Manager should recognize with
38 * rtc_only_wakeup() returning false.
39 * If the RTC given to CM is the only wakeup reason,
40 * rtc_only_wakeup should return true.
41 */
42struct charger_global_desc {
43 char *rtc_name;
44
45 bool (*rtc_only_wakeup)(void);
46};
47
48/**
49 * struct charger_desc
50 * @psy_name: the name of power-supply-class for charger manager
51 * @polling_mode:
52 * Determine which polling mode will be used
53 * @fullbatt_uV: voltage in microvolt
54 * If it is not being charged and VBATT >= fullbatt_uV,
55 * it is assumed to be full.
56 * @polling_interval_ms: interval in millisecond at which
57 * charger manager will monitor battery health
58 * @battery_present:
59 * Specify where information for existance of battery can be obtained
60 * @psy_charger_stat: the names of power-supply for chargers
61 * @num_charger_regulator: the number of entries in charger_regulators
62 * @charger_regulators: array of regulator_bulk_data for chargers
63 * @psy_fuel_gauge: the name of power-supply for fuel gauge
64 * @temperature_out_of_range:
65 * Determine whether the status is overheat or cold or normal.
66 * return_value > 0: overheat
67 * return_value == 0: normal
68 * return_value < 0: cold
69 * @measure_battery_temp:
70 * true: measure battery temperature
71 * false: measure ambient temperature
72 */
73struct charger_desc {
74 char *psy_name;
75
76 enum polling_modes polling_mode;
77 unsigned int polling_interval_ms;
78
79 unsigned int fullbatt_uV;
80
81 enum data_source battery_present;
82
83 char **psy_charger_stat;
84
85 int num_charger_regulators;
86 struct regulator_bulk_data *charger_regulators;
87
88 char *psy_fuel_gauge;
89
90 int (*temperature_out_of_range)(int *mC);
91 bool measure_battery_temp;
92};
93
94#define PSY_NAME_MAX 30
95
96/**
97 * struct charger_manager
98 * @entry: entry for list
99 * @dev: device pointer
100 * @desc: instance of charger_desc
101 * @fuel_gauge: power_supply for fuel gauge
102 * @charger_stat: array of power_supply for chargers
103 * @charger_enabled: the state of charger
104 * @emergency_stop:
105 * When setting true, stop charging
106 * @last_temp_mC: the measured temperature in milli-Celsius
107 * @psy_name_buf: the name of power-supply-class for charger manager
108 * @charger_psy: power_supply for charger manager
109 * @status_save_ext_pwr_inserted:
110 * saved status of external power before entering suspend-to-RAM
111 * @status_save_batt:
112 * saved status of battery before entering suspend-to-RAM
113 */
114struct charger_manager {
115 struct list_head entry;
116 struct device *dev;
117 struct charger_desc *desc;
118
119 struct power_supply *fuel_gauge;
120 struct power_supply **charger_stat;
121
122 bool charger_enabled;
123
124 int emergency_stop;
125 int last_temp_mC;
126
127 char psy_name_buf[PSY_NAME_MAX + 1];
128 struct power_supply charger_psy;
129
130 bool status_save_ext_pwr_inserted;
131 bool status_save_batt;
132};
133
134#ifdef CONFIG_CHARGER_MANAGER
135extern int setup_charger_manager(struct charger_global_desc *gd);
136extern bool cm_suspend_again(void);
137#else
138static void __maybe_unused setup_charger_manager(struct charger_global_desc *gd)
139{ }
140
141static bool __maybe_unused cm_suspend_again(void)
142{
143 return false;
144}
145#endif
146
147#endif /* _CHARGER_MANAGER_H */
diff --git a/include/linux/power/bq20z75.h b/include/linux/power/sbs-battery.h
index 1398eb004e83..2b0a9d9ff57e 100644
--- a/include/linux/power/bq20z75.h
+++ b/include/linux/power/sbs-battery.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Gas Gauge driver for TI's BQ20Z75 2 * Gas Gauge driver for SBS Compliant Gas Gauges
3 * 3 *
4 * Copyright (c) 2010, NVIDIA Corporation. 4 * Copyright (c) 2010, NVIDIA Corporation.
5 * 5 *
@@ -18,21 +18,21 @@
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 */ 19 */
20 20
21#ifndef __LINUX_POWER_BQ20Z75_H_ 21#ifndef __LINUX_POWER_SBS_BATTERY_H_
22#define __LINUX_POWER_BQ20Z75_H_ 22#define __LINUX_POWER_SBS_BATTERY_H_
23 23
24#include <linux/power_supply.h> 24#include <linux/power_supply.h>
25#include <linux/types.h> 25#include <linux/types.h>
26 26
27/** 27/**
28 * struct bq20z75_platform_data - platform data for bq20z75 devices 28 * struct sbs_platform_data - platform data for sbs devices
29 * @battery_detect: GPIO which is used to detect battery presence 29 * @battery_detect: GPIO which is used to detect battery presence
30 * @battery_detect_present: gpio state when battery is present (0 / 1) 30 * @battery_detect_present: gpio state when battery is present (0 / 1)
31 * @i2c_retry_count: # of times to retry on i2c IO failure 31 * @i2c_retry_count: # of times to retry on i2c IO failure
32 * @poll_retry_count: # of times to retry looking for new status after 32 * @poll_retry_count: # of times to retry looking for new status after
33 * external change notification 33 * external change notification
34 */ 34 */
35struct bq20z75_platform_data { 35struct sbs_platform_data {
36 int battery_detect; 36 int battery_detect;
37 int battery_detect_present; 37 int battery_detect_present;
38 int i2c_retry_count; 38 int i2c_retry_count;
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index 204c18dfdc9e..fa9b962aec12 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -74,6 +74,12 @@ enum {
74 POWER_SUPPLY_CAPACITY_LEVEL_FULL, 74 POWER_SUPPLY_CAPACITY_LEVEL_FULL,
75}; 75};
76 76
77enum {
78 POWER_SUPPLY_SCOPE_UNKNOWN = 0,
79 POWER_SUPPLY_SCOPE_SYSTEM,
80 POWER_SUPPLY_SCOPE_DEVICE,
81};
82
77enum power_supply_property { 83enum power_supply_property {
78 /* Properties of type `int' */ 84 /* Properties of type `int' */
79 POWER_SUPPLY_PROP_STATUS = 0, 85 POWER_SUPPLY_PROP_STATUS = 0,
@@ -116,6 +122,7 @@ enum power_supply_property {
116 POWER_SUPPLY_PROP_TIME_TO_FULL_NOW, 122 POWER_SUPPLY_PROP_TIME_TO_FULL_NOW,
117 POWER_SUPPLY_PROP_TIME_TO_FULL_AVG, 123 POWER_SUPPLY_PROP_TIME_TO_FULL_AVG,
118 POWER_SUPPLY_PROP_TYPE, /* use power_supply.type instead */ 124 POWER_SUPPLY_PROP_TYPE, /* use power_supply.type instead */
125 POWER_SUPPLY_PROP_SCOPE,
119 /* Properties of type `const char *' */ 126 /* Properties of type `const char *' */
120 POWER_SUPPLY_PROP_MODEL_NAME, 127 POWER_SUPPLY_PROP_MODEL_NAME,
121 POWER_SUPPLY_PROP_MANUFACTURER, 128 POWER_SUPPLY_PROP_MANUFACTURER,
@@ -123,7 +130,8 @@ enum power_supply_property {
123}; 130};
124 131
125enum power_supply_type { 132enum power_supply_type {
126 POWER_SUPPLY_TYPE_BATTERY = 0, 133 POWER_SUPPLY_TYPE_UNKNOWN = 0,
134 POWER_SUPPLY_TYPE_BATTERY,
127 POWER_SUPPLY_TYPE_UPS, 135 POWER_SUPPLY_TYPE_UPS,
128 POWER_SUPPLY_TYPE_MAINS, 136 POWER_SUPPLY_TYPE_MAINS,
129 POWER_SUPPLY_TYPE_USB, /* Standard Downstream Port */ 137 POWER_SUPPLY_TYPE_USB, /* Standard Downstream Port */
@@ -211,6 +219,7 @@ static inline int power_supply_is_system_supplied(void) { return -ENOSYS; }
211extern int power_supply_register(struct device *parent, 219extern int power_supply_register(struct device *parent,
212 struct power_supply *psy); 220 struct power_supply *psy);
213extern void power_supply_unregister(struct power_supply *psy); 221extern void power_supply_unregister(struct power_supply *psy);
222extern int power_supply_powers(struct power_supply *psy, struct device *dev);
214 223
215/* For APM emulation, think legacy userspace. */ 224/* For APM emulation, think legacy userspace. */
216extern struct class *power_supply_class; 225extern struct class *power_supply_class;
diff --git a/include/linux/prctl.h b/include/linux/prctl.h
index a3baeb2c2161..7ddc7f1b480f 100644
--- a/include/linux/prctl.h
+++ b/include/linux/prctl.h
@@ -102,4 +102,16 @@
102 102
103#define PR_MCE_KILL_GET 34 103#define PR_MCE_KILL_GET 34
104 104
105/*
106 * Tune up process memory map specifics.
107 */
108#define PR_SET_MM 35
109# define PR_SET_MM_START_CODE 1
110# define PR_SET_MM_END_CODE 2
111# define PR_SET_MM_START_DATA 3
112# define PR_SET_MM_END_DATA 4
113# define PR_SET_MM_START_STACK 5
114# define PR_SET_MM_START_BRK 6
115# define PR_SET_MM_BRK 7
116
105#endif /* _LINUX_PRCTL_H */ 117#endif /* _LINUX_PRCTL_H */
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index 6d9e575519cc..85c507306239 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -253,7 +253,7 @@ extern const struct proc_ns_operations utsns_operations;
253extern const struct proc_ns_operations ipcns_operations; 253extern const struct proc_ns_operations ipcns_operations;
254 254
255union proc_op { 255union proc_op {
256 int (*proc_get_link)(struct inode *, struct path *); 256 int (*proc_get_link)(struct dentry *, struct path *);
257 int (*proc_read)(struct task_struct *task, char *page); 257 int (*proc_read)(struct task_struct *task, char *page);
258 int (*proc_show)(struct seq_file *m, 258 int (*proc_show)(struct seq_file *m,
259 struct pid_namespace *ns, struct pid *pid, 259 struct pid_namespace *ns, struct pid *pid,
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h
index 800f113bea66..c2f1f6a5fcb8 100644
--- a/include/linux/ptrace.h
+++ b/include/linux/ptrace.h
@@ -112,6 +112,7 @@
112 112
113#include <linux/compiler.h> /* For unlikely. */ 113#include <linux/compiler.h> /* For unlikely. */
114#include <linux/sched.h> /* For struct task_struct. */ 114#include <linux/sched.h> /* For struct task_struct. */
115#include <linux/err.h> /* for IS_ERR_VALUE */
115 116
116 117
117extern long arch_ptrace(struct task_struct *child, long request, 118extern long arch_ptrace(struct task_struct *child, long request,
@@ -127,8 +128,9 @@ extern void __ptrace_link(struct task_struct *child,
127 struct task_struct *new_parent); 128 struct task_struct *new_parent);
128extern void __ptrace_unlink(struct task_struct *child); 129extern void __ptrace_unlink(struct task_struct *child);
129extern void exit_ptrace(struct task_struct *tracer); 130extern void exit_ptrace(struct task_struct *tracer);
130#define PTRACE_MODE_READ 1 131#define PTRACE_MODE_READ 0x01
131#define PTRACE_MODE_ATTACH 2 132#define PTRACE_MODE_ATTACH 0x02
133#define PTRACE_MODE_NOAUDIT 0x04
132/* Returns 0 on success, -errno on denial. */ 134/* Returns 0 on success, -errno on denial. */
133extern int __ptrace_may_access(struct task_struct *task, unsigned int mode); 135extern int __ptrace_may_access(struct task_struct *task, unsigned int mode);
134/* Returns true on success, false on denial. */ 136/* Returns true on success, false on denial. */
@@ -265,6 +267,15 @@ static inline void ptrace_release_task(struct task_struct *task)
265#define force_successful_syscall_return() do { } while (0) 267#define force_successful_syscall_return() do { } while (0)
266#endif 268#endif
267 269
270#ifndef is_syscall_success
271/*
272 * On most systems we can tell if a syscall is a success based on if the retval
273 * is an error value. On some systems like ia64 and powerpc they have different
274 * indicators of success/failure and must define their own.
275 */
276#define is_syscall_success(regs) (!IS_ERR_VALUE((unsigned long)(regs_return_value(regs))))
277#endif
278
268/* 279/*
269 * <asm/ptrace.h> should define the following things inside #ifdef __KERNEL__. 280 * <asm/ptrace.h> should define the following things inside #ifdef __KERNEL__.
270 * 281 *
diff --git a/include/linux/quota.h b/include/linux/quota.h
index cb7855699037..c09fa042b5ea 100644
--- a/include/linux/quota.h
+++ b/include/linux/quota.h
@@ -230,7 +230,11 @@ struct mem_dqinfo {
230struct super_block; 230struct super_block;
231 231
232#define DQF_MASK 0xffff /* Mask for format specific flags */ 232#define DQF_MASK 0xffff /* Mask for format specific flags */
233#define DQF_INFO_DIRTY_B 16 233#define DQF_GETINFO_MASK 0x1ffff /* Mask for flags passed to userspace */
234#define DQF_SETINFO_MASK 0xffff /* Mask for flags modifiable from userspace */
235#define DQF_SYS_FILE_B 16
236#define DQF_SYS_FILE (1 << DQF_SYS_FILE_B) /* Quota file stored as system file */
237#define DQF_INFO_DIRTY_B 31
234#define DQF_INFO_DIRTY (1 << DQF_INFO_DIRTY_B) /* Is info dirty? */ 238#define DQF_INFO_DIRTY (1 << DQF_INFO_DIRTY_B) /* Is info dirty? */
235 239
236extern void mark_info_dirty(struct super_block *sb, int type); 240extern void mark_info_dirty(struct super_block *sb, int type);
diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h
index 9d4539c52e53..07e360b1b282 100644
--- a/include/linux/radix-tree.h
+++ b/include/linux/radix-tree.h
@@ -49,9 +49,6 @@
49#define RADIX_TREE_EXCEPTIONAL_ENTRY 2 49#define RADIX_TREE_EXCEPTIONAL_ENTRY 2
50#define RADIX_TREE_EXCEPTIONAL_SHIFT 2 50#define RADIX_TREE_EXCEPTIONAL_SHIFT 2
51 51
52#define radix_tree_indirect_to_ptr(ptr) \
53 radix_tree_indirect_to_ptr((void __force *)(ptr))
54
55static inline int radix_tree_is_indirect_ptr(void *ptr) 52static inline int radix_tree_is_indirect_ptr(void *ptr)
56{ 53{
57 return (int)((unsigned long)ptr & RADIX_TREE_INDIRECT_PTR); 54 return (int)((unsigned long)ptr & RADIX_TREE_INDIRECT_PTR);
diff --git a/include/linux/raid/md_p.h b/include/linux/raid/md_p.h
index 9e65d9e20662..6f6df86f1ae5 100644
--- a/include/linux/raid/md_p.h
+++ b/include/linux/raid/md_p.h
@@ -277,7 +277,10 @@ struct mdp_superblock_1 {
277 */ 277 */
278#define MD_FEATURE_RESHAPE_ACTIVE 4 278#define MD_FEATURE_RESHAPE_ACTIVE 4
279#define MD_FEATURE_BAD_BLOCKS 8 /* badblock list is not empty */ 279#define MD_FEATURE_BAD_BLOCKS 8 /* badblock list is not empty */
280 280#define MD_FEATURE_REPLACEMENT 16 /* This device is replacing an
281#define MD_FEATURE_ALL (1|2|4|8) 281 * active device with same 'role'.
282 * 'recovery_offset' is also set.
283 */
284#define MD_FEATURE_ALL (1|2|4|8|16)
282 285
283#endif 286#endif
diff --git a/include/linux/raid/pq.h b/include/linux/raid/pq.h
index 2b59cc824395..53272e9860a7 100644
--- a/include/linux/raid/pq.h
+++ b/include/linux/raid/pq.h
@@ -132,7 +132,7 @@ void raid6_dual_recov(int disks, size_t bytes, int faila, int failb,
132 PROT_READ|PROT_WRITE, \ 132 PROT_READ|PROT_WRITE, \
133 MAP_PRIVATE|MAP_ANONYMOUS,\ 133 MAP_PRIVATE|MAP_ANONYMOUS,\
134 0, 0)) 134 0, 0))
135# define free_pages(x, y) munmap((void *)(x), (y)*PAGE_SIZE) 135# define free_pages(x, y) munmap((void *)(x), PAGE_SIZE << (y))
136 136
137static inline void cpu_relax(void) 137static inline void cpu_relax(void)
138{ 138{
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index 690276a642cf..eb93921cdd30 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -23,9 +23,8 @@ struct spi_device;
23/* An enum of all the supported cache types */ 23/* An enum of all the supported cache types */
24enum regcache_type { 24enum regcache_type {
25 REGCACHE_NONE, 25 REGCACHE_NONE,
26 REGCACHE_INDEXED,
27 REGCACHE_RBTREE, 26 REGCACHE_RBTREE,
28 REGCACHE_LZO 27 REGCACHE_COMPRESSED
29}; 28};
30 29
31/** 30/**
@@ -83,7 +82,7 @@ struct regmap_config {
83 bool (*precious_reg)(struct device *dev, unsigned int reg); 82 bool (*precious_reg)(struct device *dev, unsigned int reg);
84 83
85 unsigned int max_register; 84 unsigned int max_register;
86 struct reg_default *reg_defaults; 85 const struct reg_default *reg_defaults;
87 unsigned int num_reg_defaults; 86 unsigned int num_reg_defaults;
88 enum regcache_type cache_type; 87 enum regcache_type cache_type;
89 const void *reg_defaults_raw; 88 const void *reg_defaults_raw;
@@ -129,6 +128,8 @@ struct regmap *regmap_init_spi(struct spi_device *dev,
129 const struct regmap_config *config); 128 const struct regmap_config *config);
130 129
131void regmap_exit(struct regmap *map); 130void regmap_exit(struct regmap *map);
131int regmap_reinit_cache(struct regmap *map,
132 const struct regmap_config *config);
132int regmap_write(struct regmap *map, unsigned int reg, unsigned int val); 133int regmap_write(struct regmap *map, unsigned int reg, unsigned int val);
133int regmap_raw_write(struct regmap *map, unsigned int reg, 134int regmap_raw_write(struct regmap *map, unsigned int reg,
134 const void *val, size_t val_len); 135 const void *val, size_t val_len);
@@ -139,9 +140,61 @@ int regmap_bulk_read(struct regmap *map, unsigned int reg, void *val,
139 size_t val_count); 140 size_t val_count);
140int regmap_update_bits(struct regmap *map, unsigned int reg, 141int regmap_update_bits(struct regmap *map, unsigned int reg,
141 unsigned int mask, unsigned int val); 142 unsigned int mask, unsigned int val);
143int regmap_update_bits_check(struct regmap *map, unsigned int reg,
144 unsigned int mask, unsigned int val,
145 bool *change);
142 146
143int regcache_sync(struct regmap *map); 147int regcache_sync(struct regmap *map);
144void regcache_cache_only(struct regmap *map, bool enable); 148void regcache_cache_only(struct regmap *map, bool enable);
145void regcache_cache_bypass(struct regmap *map, bool enable); 149void regcache_cache_bypass(struct regmap *map, bool enable);
150void regcache_mark_dirty(struct regmap *map);
151
152/**
153 * Description of an IRQ for the generic regmap irq_chip.
154 *
155 * @reg_offset: Offset of the status/mask register within the bank
156 * @mask: Mask used to flag/control the register.
157 */
158struct regmap_irq {
159 unsigned int reg_offset;
160 unsigned int mask;
161};
162
163/**
164 * Description of a generic regmap irq_chip. This is not intended to
165 * handle every possible interrupt controller, but it should handle a
166 * substantial proportion of those that are found in the wild.
167 *
168 * @name: Descriptive name for IRQ controller.
169 *
170 * @status_base: Base status register address.
171 * @mask_base: Base mask register address.
172 * @ack_base: Base ack address. If zero then the chip is clear on read.
173 *
174 * @num_regs: Number of registers in each control bank.
175 * @irqs: Descriptors for individual IRQs. Interrupt numbers are
176 * assigned based on the index in the array of the interrupt.
177 * @num_irqs: Number of descriptors.
178 */
179struct regmap_irq_chip {
180 const char *name;
181
182 unsigned int status_base;
183 unsigned int mask_base;
184 unsigned int ack_base;
185
186 int num_regs;
187
188 const struct regmap_irq *irqs;
189 int num_irqs;
190};
191
192struct regmap_irq_chip_data;
193
194int regmap_add_irq_chip(struct regmap *map, int irq, int irq_flags,
195 int irq_base, struct regmap_irq_chip *chip,
196 struct regmap_irq_chip_data **data);
197void regmap_del_irq_chip(int irq, struct regmap_irq_chip_data *data);
198int regmap_irq_chip_get_base(struct regmap_irq_chip_data *data);
146 199
147#endif 200#endif
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
index f7756d146c61..f2698a0edfc4 100644
--- a/include/linux/regulator/consumer.h
+++ b/include/linux/regulator/consumer.h
@@ -149,6 +149,8 @@ int regulator_bulk_enable(int num_consumers,
149 struct regulator_bulk_data *consumers); 149 struct regulator_bulk_data *consumers);
150int regulator_bulk_disable(int num_consumers, 150int regulator_bulk_disable(int num_consumers,
151 struct regulator_bulk_data *consumers); 151 struct regulator_bulk_data *consumers);
152int regulator_bulk_force_disable(int num_consumers,
153 struct regulator_bulk_data *consumers);
152void regulator_bulk_free(int num_consumers, 154void regulator_bulk_free(int num_consumers,
153 struct regulator_bulk_data *consumers); 155 struct regulator_bulk_data *consumers);
154 156
@@ -212,6 +214,11 @@ static inline int regulator_disable(struct regulator *regulator)
212 return 0; 214 return 0;
213} 215}
214 216
217static inline int regulator_force_disable(struct regulator *regulator)
218{
219 return 0;
220}
221
215static inline int regulator_disable_deferred(struct regulator *regulator, 222static inline int regulator_disable_deferred(struct regulator *regulator,
216 int ms) 223 int ms)
217{ 224{
@@ -242,6 +249,12 @@ static inline int regulator_bulk_disable(int num_consumers,
242 return 0; 249 return 0;
243} 250}
244 251
252static inline int regulator_bulk_force_disable(int num_consumers,
253 struct regulator_bulk_data *consumers)
254{
255 return 0;
256}
257
245static inline void regulator_bulk_free(int num_consumers, 258static inline void regulator_bulk_free(int num_consumers,
246 struct regulator_bulk_data *consumers) 259 struct regulator_bulk_data *consumers)
247{ 260{
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
index 52c89ae32f64..4214b9a9d1c9 100644
--- a/include/linux/regulator/driver.h
+++ b/include/linux/regulator/driver.h
@@ -154,6 +154,7 @@ enum regulator_type {
154 * this type. 154 * this type.
155 * 155 *
156 * @name: Identifying name for the regulator. 156 * @name: Identifying name for the regulator.
157 * @supply_name: Identifying the regulator supply
157 * @id: Numerical identifier for the regulator. 158 * @id: Numerical identifier for the regulator.
158 * @n_voltages: Number of selectors available for ops.list_voltage(). 159 * @n_voltages: Number of selectors available for ops.list_voltage().
159 * @ops: Regulator operations table. 160 * @ops: Regulator operations table.
@@ -163,6 +164,7 @@ enum regulator_type {
163 */ 164 */
164struct regulator_desc { 165struct regulator_desc {
165 const char *name; 166 const char *name;
167 const char *supply_name;
166 int id; 168 int id;
167 unsigned n_voltages; 169 unsigned n_voltages;
168 struct regulator_ops *ops; 170 struct regulator_ops *ops;
@@ -212,7 +214,7 @@ struct regulator_dev {
212 214
213struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc, 215struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc,
214 struct device *dev, const struct regulator_init_data *init_data, 216 struct device *dev, const struct regulator_init_data *init_data,
215 void *driver_data); 217 void *driver_data, struct device_node *of_node);
216void regulator_unregister(struct regulator_dev *rdev); 218void regulator_unregister(struct regulator_dev *rdev);
217 219
218int regulator_notifier_call_chain(struct regulator_dev *rdev, 220int regulator_notifier_call_chain(struct regulator_dev *rdev,
diff --git a/include/linux/regulator/of_regulator.h b/include/linux/regulator/of_regulator.h
new file mode 100644
index 000000000000..769704f296e5
--- /dev/null
+++ b/include/linux/regulator/of_regulator.h
@@ -0,0 +1,22 @@
1/*
2 * OpenFirmware regulator support routines
3 *
4 */
5
6#ifndef __LINUX_OF_REG_H
7#define __LINUX_OF_REG_H
8
9#if defined(CONFIG_OF)
10extern struct regulator_init_data
11 *of_get_regulator_init_data(struct device *dev,
12 struct device_node *node);
13#else
14static inline struct regulator_init_data
15 *of_get_regulator_init_data(struct device *dev,
16 struct device_node *node)
17{
18 return NULL;
19}
20#endif /* CONFIG_OF */
21
22#endif /* __LINUX_OF_REG_H */
diff --git a/include/linux/res_counter.h b/include/linux/res_counter.h
index c9d625ca659e..da81af086eaf 100644
--- a/include/linux/res_counter.h
+++ b/include/linux/res_counter.h
@@ -109,12 +109,18 @@ void res_counter_init(struct res_counter *counter, struct res_counter *parent);
109 * 109 *
110 * returns 0 on success and <0 if the counter->usage will exceed the 110 * returns 0 on success and <0 if the counter->usage will exceed the
111 * counter->limit _locked call expects the counter->lock to be taken 111 * counter->limit _locked call expects the counter->lock to be taken
112 *
113 * charge_nofail works the same, except that it charges the resource
114 * counter unconditionally, and returns < 0 if the after the current
115 * charge we are over limit.
112 */ 116 */
113 117
114int __must_check res_counter_charge_locked(struct res_counter *counter, 118int __must_check res_counter_charge_locked(struct res_counter *counter,
115 unsigned long val); 119 unsigned long val);
116int __must_check res_counter_charge(struct res_counter *counter, 120int __must_check res_counter_charge(struct res_counter *counter,
117 unsigned long val, struct res_counter **limit_fail_at); 121 unsigned long val, struct res_counter **limit_fail_at);
122int __must_check res_counter_charge_nofail(struct res_counter *counter,
123 unsigned long val, struct res_counter **limit_fail_at);
118 124
119/* 125/*
120 * uncharge - tell that some portion of the resource is released 126 * uncharge - tell that some portion of the resource is released
@@ -142,7 +148,10 @@ static inline unsigned long long res_counter_margin(struct res_counter *cnt)
142 unsigned long flags; 148 unsigned long flags;
143 149
144 spin_lock_irqsave(&cnt->lock, flags); 150 spin_lock_irqsave(&cnt->lock, flags);
145 margin = cnt->limit - cnt->usage; 151 if (cnt->limit > cnt->usage)
152 margin = cnt->limit - cnt->usage;
153 else
154 margin = 0;
146 spin_unlock_irqrestore(&cnt->lock, flags); 155 spin_unlock_irqrestore(&cnt->lock, flags);
147 return margin; 156 return margin;
148} 157}
diff --git a/include/linux/rmap.h b/include/linux/rmap.h
index 2148b122779b..1cdd62a2788a 100644
--- a/include/linux/rmap.h
+++ b/include/linux/rmap.h
@@ -120,6 +120,7 @@ void anon_vma_init(void); /* create anon_vma_cachep */
120int anon_vma_prepare(struct vm_area_struct *); 120int anon_vma_prepare(struct vm_area_struct *);
121void unlink_anon_vmas(struct vm_area_struct *); 121void unlink_anon_vmas(struct vm_area_struct *);
122int anon_vma_clone(struct vm_area_struct *, struct vm_area_struct *); 122int anon_vma_clone(struct vm_area_struct *, struct vm_area_struct *);
123void anon_vma_moveto_tail(struct vm_area_struct *);
123int anon_vma_fork(struct vm_area_struct *, struct vm_area_struct *); 124int anon_vma_fork(struct vm_area_struct *, struct vm_area_struct *);
124void __anon_vma_link(struct vm_area_struct *); 125void __anon_vma_link(struct vm_area_struct *);
125 126
@@ -157,7 +158,7 @@ static inline void page_dup_rmap(struct page *page)
157 * Called from mm/vmscan.c to handle paging out 158 * Called from mm/vmscan.c to handle paging out
158 */ 159 */
159int page_referenced(struct page *, int is_locked, 160int page_referenced(struct page *, int is_locked,
160 struct mem_cgroup *cnt, unsigned long *vm_flags); 161 struct mem_cgroup *memcg, unsigned long *vm_flags);
161int page_referenced_one(struct page *, struct vm_area_struct *, 162int page_referenced_one(struct page *, struct vm_area_struct *,
162 unsigned long address, unsigned int *mapcount, unsigned long *vm_flags); 163 unsigned long address, unsigned int *mapcount, unsigned long *vm_flags);
163 164
@@ -235,7 +236,7 @@ int rmap_walk(struct page *page, int (*rmap_one)(struct page *,
235#define anon_vma_link(vma) do {} while (0) 236#define anon_vma_link(vma) do {} while (0)
236 237
237static inline int page_referenced(struct page *page, int is_locked, 238static inline int page_referenced(struct page *page, int is_locked,
238 struct mem_cgroup *cnt, 239 struct mem_cgroup *memcg,
239 unsigned long *vm_flags) 240 unsigned long *vm_flags)
240{ 241{
241 *vm_flags = 0; 242 *vm_flags = 0;
diff --git a/include/linux/s3c_adc_battery.h b/include/linux/s3c_adc_battery.h
index fbe58b7e63eb..99dadbffdd4f 100644
--- a/include/linux/s3c_adc_battery.h
+++ b/include/linux/s3c_adc_battery.h
@@ -25,6 +25,10 @@ struct s3c_adc_bat_pdata {
25 const unsigned int current_channel; 25 const unsigned int current_channel;
26 const unsigned int backup_volt_channel; 26 const unsigned int backup_volt_channel;
27 27
28 const unsigned int volt_samples;
29 const unsigned int current_samples;
30 const unsigned int backup_volt_samples;
31
28 const unsigned int volt_mult; 32 const unsigned int volt_mult;
29 const unsigned int current_mult; 33 const unsigned int current_mult;
30 const unsigned int backup_volt_mult; 34 const unsigned int backup_volt_mult;
diff --git a/include/linux/sched.h b/include/linux/sched.h
index ad93e1ec8c65..7d379a6bfd88 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -637,13 +637,15 @@ struct signal_struct {
637#endif 637#endif
638#ifdef CONFIG_CGROUPS 638#ifdef CONFIG_CGROUPS
639 /* 639 /*
640 * The threadgroup_fork_lock prevents threads from forking with 640 * group_rwsem prevents new tasks from entering the threadgroup and
641 * CLONE_THREAD while held for writing. Use this for fork-sensitive 641 * member tasks from exiting,a more specifically, setting of
642 * threadgroup-wide operations. It's taken for reading in fork.c in 642 * PF_EXITING. fork and exit paths are protected with this rwsem
643 * copy_process(). 643 * using threadgroup_change_begin/end(). Users which require
644 * Currently only needed write-side by cgroups. 644 * threadgroup to remain stable should use threadgroup_[un]lock()
645 * which also takes care of exec path. Currently, cgroup is the
646 * only user.
645 */ 647 */
646 struct rw_semaphore threadgroup_fork_lock; 648 struct rw_semaphore group_rwsem;
647#endif 649#endif
648 650
649 int oom_adj; /* OOM kill score adjustment (bit shift) */ 651 int oom_adj; /* OOM kill score adjustment (bit shift) */
@@ -1542,6 +1544,7 @@ struct task_struct {
1542 */ 1544 */
1543 int nr_dirtied; 1545 int nr_dirtied;
1544 int nr_dirtied_pause; 1546 int nr_dirtied_pause;
1547 unsigned long dirty_paused_when; /* start of a write-and-pause period */
1545 1548
1546#ifdef CONFIG_LATENCYTOP 1549#ifdef CONFIG_LATENCYTOP
1547 int latency_record_count; 1550 int latency_record_count;
@@ -2085,9 +2088,9 @@ extern int sched_setscheduler_nocheck(struct task_struct *, int,
2085extern struct task_struct *idle_task(int cpu); 2088extern struct task_struct *idle_task(int cpu);
2086/** 2089/**
2087 * is_idle_task - is the specified task an idle task? 2090 * is_idle_task - is the specified task an idle task?
2088 * @tsk: the task in question. 2091 * @p: the task in question.
2089 */ 2092 */
2090static inline bool is_idle_task(struct task_struct *p) 2093static inline bool is_idle_task(const struct task_struct *p)
2091{ 2094{
2092 return p->pid == 0; 2095 return p->pid == 0;
2093} 2096}
@@ -2256,6 +2259,12 @@ static inline void mmdrop(struct mm_struct * mm)
2256extern void mmput(struct mm_struct *); 2259extern void mmput(struct mm_struct *);
2257/* Grab a reference to a task's mm, if it is not already going away */ 2260/* Grab a reference to a task's mm, if it is not already going away */
2258extern struct mm_struct *get_task_mm(struct task_struct *task); 2261extern struct mm_struct *get_task_mm(struct task_struct *task);
2262/*
2263 * Grab a reference to a task's mm, if it is not already going away
2264 * and ptrace_may_access with the mode parameter passed to it
2265 * succeeds.
2266 */
2267extern struct mm_struct *mm_access(struct task_struct *task, unsigned int mode);
2259/* Remove the current tasks stale references to the old mm_struct */ 2268/* Remove the current tasks stale references to the old mm_struct */
2260extern void mm_release(struct task_struct *, struct mm_struct *); 2269extern void mm_release(struct task_struct *, struct mm_struct *);
2261/* Allocate a new mm structure and copy contents from tsk->mm */ 2270/* Allocate a new mm structure and copy contents from tsk->mm */
@@ -2272,7 +2281,7 @@ extern void __cleanup_sighand(struct sighand_struct *);
2272extern void exit_itimers(struct signal_struct *); 2281extern void exit_itimers(struct signal_struct *);
2273extern void flush_itimer_signals(void); 2282extern void flush_itimer_signals(void);
2274 2283
2275extern NORET_TYPE void do_group_exit(int); 2284extern void do_group_exit(int);
2276 2285
2277extern void daemonize(const char *, ...); 2286extern void daemonize(const char *, ...);
2278extern int allow_signal(int); 2287extern int allow_signal(int);
@@ -2394,29 +2403,62 @@ static inline void unlock_task_sighand(struct task_struct *tsk,
2394 spin_unlock_irqrestore(&tsk->sighand->siglock, *flags); 2403 spin_unlock_irqrestore(&tsk->sighand->siglock, *flags);
2395} 2404}
2396 2405
2397/* See the declaration of threadgroup_fork_lock in signal_struct. */
2398#ifdef CONFIG_CGROUPS 2406#ifdef CONFIG_CGROUPS
2399static inline void threadgroup_fork_read_lock(struct task_struct *tsk) 2407static inline void threadgroup_change_begin(struct task_struct *tsk)
2400{ 2408{
2401 down_read(&tsk->signal->threadgroup_fork_lock); 2409 down_read(&tsk->signal->group_rwsem);
2402} 2410}
2403static inline void threadgroup_fork_read_unlock(struct task_struct *tsk) 2411static inline void threadgroup_change_end(struct task_struct *tsk)
2404{ 2412{
2405 up_read(&tsk->signal->threadgroup_fork_lock); 2413 up_read(&tsk->signal->group_rwsem);
2406} 2414}
2407static inline void threadgroup_fork_write_lock(struct task_struct *tsk) 2415
2416/**
2417 * threadgroup_lock - lock threadgroup
2418 * @tsk: member task of the threadgroup to lock
2419 *
2420 * Lock the threadgroup @tsk belongs to. No new task is allowed to enter
2421 * and member tasks aren't allowed to exit (as indicated by PF_EXITING) or
2422 * perform exec. This is useful for cases where the threadgroup needs to
2423 * stay stable across blockable operations.
2424 *
2425 * fork and exit paths explicitly call threadgroup_change_{begin|end}() for
2426 * synchronization. While held, no new task will be added to threadgroup
2427 * and no existing live task will have its PF_EXITING set.
2428 *
2429 * During exec, a task goes and puts its thread group through unusual
2430 * changes. After de-threading, exclusive access is assumed to resources
2431 * which are usually shared by tasks in the same group - e.g. sighand may
2432 * be replaced with a new one. Also, the exec'ing task takes over group
2433 * leader role including its pid. Exclude these changes while locked by
2434 * grabbing cred_guard_mutex which is used to synchronize exec path.
2435 */
2436static inline void threadgroup_lock(struct task_struct *tsk)
2408{ 2437{
2409 down_write(&tsk->signal->threadgroup_fork_lock); 2438 /*
2439 * exec uses exit for de-threading nesting group_rwsem inside
2440 * cred_guard_mutex. Grab cred_guard_mutex first.
2441 */
2442 mutex_lock(&tsk->signal->cred_guard_mutex);
2443 down_write(&tsk->signal->group_rwsem);
2410} 2444}
2411static inline void threadgroup_fork_write_unlock(struct task_struct *tsk) 2445
2446/**
2447 * threadgroup_unlock - unlock threadgroup
2448 * @tsk: member task of the threadgroup to unlock
2449 *
2450 * Reverse threadgroup_lock().
2451 */
2452static inline void threadgroup_unlock(struct task_struct *tsk)
2412{ 2453{
2413 up_write(&tsk->signal->threadgroup_fork_lock); 2454 up_write(&tsk->signal->group_rwsem);
2455 mutex_unlock(&tsk->signal->cred_guard_mutex);
2414} 2456}
2415#else 2457#else
2416static inline void threadgroup_fork_read_lock(struct task_struct *tsk) {} 2458static inline void threadgroup_change_begin(struct task_struct *tsk) {}
2417static inline void threadgroup_fork_read_unlock(struct task_struct *tsk) {} 2459static inline void threadgroup_change_end(struct task_struct *tsk) {}
2418static inline void threadgroup_fork_write_lock(struct task_struct *tsk) {} 2460static inline void threadgroup_lock(struct task_struct *tsk) {}
2419static inline void threadgroup_fork_write_unlock(struct task_struct *tsk) {} 2461static inline void threadgroup_unlock(struct task_struct *tsk) {}
2420#endif 2462#endif
2421 2463
2422#ifndef __HAVE_THREAD_FUNCTIONS 2464#ifndef __HAVE_THREAD_FUNCTIONS
diff --git a/include/linux/security.h b/include/linux/security.h
index 98112cf93884..83c18e8c846d 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -54,8 +54,8 @@ struct user_namespace;
54 * These functions are in security/capability.c and are used 54 * These functions are in security/capability.c and are used
55 * as the default capabilities functions 55 * as the default capabilities functions
56 */ 56 */
57extern int cap_capable(struct task_struct *tsk, const struct cred *cred, 57extern int cap_capable(const struct cred *cred, struct user_namespace *ns,
58 struct user_namespace *ns, int cap, int audit); 58 int cap, int audit);
59extern int cap_settime(const struct timespec *ts, const struct timezone *tz); 59extern int cap_settime(const struct timespec *ts, const struct timezone *tz);
60extern int cap_ptrace_access_check(struct task_struct *child, unsigned int mode); 60extern int cap_ptrace_access_check(struct task_struct *child, unsigned int mode);
61extern int cap_ptrace_traceme(struct task_struct *parent); 61extern int cap_ptrace_traceme(struct task_struct *parent);
@@ -96,7 +96,6 @@ struct xfrm_user_sec_ctx;
96struct seq_file; 96struct seq_file;
97 97
98extern int cap_netlink_send(struct sock *sk, struct sk_buff *skb); 98extern int cap_netlink_send(struct sock *sk, struct sk_buff *skb);
99extern int cap_netlink_recv(struct sk_buff *skb, int cap);
100 99
101void reset_security_ops(void); 100void reset_security_ops(void);
102 101
@@ -590,6 +589,8 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
590 * @reqprot contains the protection requested by the application. 589 * @reqprot contains the protection requested by the application.
591 * @prot contains the protection that will be applied by the kernel. 590 * @prot contains the protection that will be applied by the kernel.
592 * @flags contains the operational flags. 591 * @flags contains the operational flags.
592 * @addr contains virtual address that will be used for the operation.
593 * @addr_only contains a boolean: 0 if file-backed VMA, otherwise 1.
593 * Return 0 if permission is granted. 594 * Return 0 if permission is granted.
594 * @file_mprotect: 595 * @file_mprotect:
595 * Check permissions before changing memory access permissions. 596 * Check permissions before changing memory access permissions.
@@ -797,12 +798,6 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
797 * @skb contains the sk_buff structure for the netlink message. 798 * @skb contains the sk_buff structure for the netlink message.
798 * Return 0 if the information was successfully saved and message 799 * Return 0 if the information was successfully saved and message
799 * is allowed to be transmitted. 800 * is allowed to be transmitted.
800 * @netlink_recv:
801 * Check permission before processing the received netlink message in
802 * @skb.
803 * @skb contains the sk_buff structure for the netlink message.
804 * @cap indicates the capability required
805 * Return 0 if permission is granted.
806 * 801 *
807 * Security hooks for Unix domain networking. 802 * Security hooks for Unix domain networking.
808 * 803 *
@@ -1266,7 +1261,6 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
1266 * @capable: 1261 * @capable:
1267 * Check whether the @tsk process has the @cap capability in the indicated 1262 * Check whether the @tsk process has the @cap capability in the indicated
1268 * credentials. 1263 * credentials.
1269 * @tsk contains the task_struct for the process.
1270 * @cred contains the credentials to use. 1264 * @cred contains the credentials to use.
1271 * @ns contains the user namespace we want the capability in 1265 * @ns contains the user namespace we want the capability in
1272 * @cap contains the capability <include/linux/capability.h>. 1266 * @cap contains the capability <include/linux/capability.h>.
@@ -1390,8 +1384,8 @@ struct security_operations {
1390 const kernel_cap_t *effective, 1384 const kernel_cap_t *effective,
1391 const kernel_cap_t *inheritable, 1385 const kernel_cap_t *inheritable,
1392 const kernel_cap_t *permitted); 1386 const kernel_cap_t *permitted);
1393 int (*capable) (struct task_struct *tsk, const struct cred *cred, 1387 int (*capable) (const struct cred *cred, struct user_namespace *ns,
1394 struct user_namespace *ns, int cap, int audit); 1388 int cap, int audit);
1395 int (*quotactl) (int cmds, int type, int id, struct super_block *sb); 1389 int (*quotactl) (int cmds, int type, int id, struct super_block *sb);
1396 int (*quota_on) (struct dentry *dentry); 1390 int (*quota_on) (struct dentry *dentry);
1397 int (*syslog) (int type); 1391 int (*syslog) (int type);
@@ -1561,7 +1555,6 @@ struct security_operations {
1561 struct sembuf *sops, unsigned nsops, int alter); 1555 struct sembuf *sops, unsigned nsops, int alter);
1562 1556
1563 int (*netlink_send) (struct sock *sk, struct sk_buff *skb); 1557 int (*netlink_send) (struct sock *sk, struct sk_buff *skb);
1564 int (*netlink_recv) (struct sk_buff *skb, int cap);
1565 1558
1566 void (*d_instantiate) (struct dentry *dentry, struct inode *inode); 1559 void (*d_instantiate) (struct dentry *dentry, struct inode *inode);
1567 1560
@@ -1673,12 +1666,10 @@ int security_capset(struct cred *new, const struct cred *old,
1673 const kernel_cap_t *effective, 1666 const kernel_cap_t *effective,
1674 const kernel_cap_t *inheritable, 1667 const kernel_cap_t *inheritable,
1675 const kernel_cap_t *permitted); 1668 const kernel_cap_t *permitted);
1676int security_capable(struct user_namespace *ns, const struct cred *cred, 1669int security_capable(const struct cred *cred, struct user_namespace *ns,
1677 int cap);
1678int security_real_capable(struct task_struct *tsk, struct user_namespace *ns,
1679 int cap); 1670 int cap);
1680int security_real_capable_noaudit(struct task_struct *tsk, 1671int security_capable_noaudit(const struct cred *cred, struct user_namespace *ns,
1681 struct user_namespace *ns, int cap); 1672 int cap);
1682int security_quotactl(int cmds, int type, int id, struct super_block *sb); 1673int security_quotactl(int cmds, int type, int id, struct super_block *sb);
1683int security_quota_on(struct dentry *dentry); 1674int security_quota_on(struct dentry *dentry);
1684int security_syslog(int type); 1675int security_syslog(int type);
@@ -1815,7 +1806,6 @@ void security_d_instantiate(struct dentry *dentry, struct inode *inode);
1815int security_getprocattr(struct task_struct *p, char *name, char **value); 1806int security_getprocattr(struct task_struct *p, char *name, char **value);
1816int security_setprocattr(struct task_struct *p, char *name, void *value, size_t size); 1807int security_setprocattr(struct task_struct *p, char *name, void *value, size_t size);
1817int security_netlink_send(struct sock *sk, struct sk_buff *skb); 1808int security_netlink_send(struct sock *sk, struct sk_buff *skb);
1818int security_netlink_recv(struct sk_buff *skb, int cap);
1819int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen); 1809int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen);
1820int security_secctx_to_secid(const char *secdata, u32 seclen, u32 *secid); 1810int security_secctx_to_secid(const char *secdata, u32 seclen, u32 *secid);
1821void security_release_secctx(char *secdata, u32 seclen); 1811void security_release_secctx(char *secdata, u32 seclen);
@@ -1873,32 +1863,15 @@ static inline int security_capset(struct cred *new,
1873 return cap_capset(new, old, effective, inheritable, permitted); 1863 return cap_capset(new, old, effective, inheritable, permitted);
1874} 1864}
1875 1865
1876static inline int security_capable(struct user_namespace *ns, 1866static inline int security_capable(const struct cred *cred,
1877 const struct cred *cred, int cap) 1867 struct user_namespace *ns, int cap)
1878{
1879 return cap_capable(current, cred, ns, cap, SECURITY_CAP_AUDIT);
1880}
1881
1882static inline int security_real_capable(struct task_struct *tsk, struct user_namespace *ns, int cap)
1883{ 1868{
1884 int ret; 1869 return cap_capable(cred, ns, cap, SECURITY_CAP_AUDIT);
1885
1886 rcu_read_lock();
1887 ret = cap_capable(tsk, __task_cred(tsk), ns, cap, SECURITY_CAP_AUDIT);
1888 rcu_read_unlock();
1889 return ret;
1890} 1870}
1891 1871
1892static inline 1872static inline int security_capable_noaudit(const struct cred *cred,
1893int security_real_capable_noaudit(struct task_struct *tsk, struct user_namespace *ns, int cap) 1873 struct user_namespace *ns, int cap) {
1894{ 1874 return cap_capable(cred, ns, cap, SECURITY_CAP_NOAUDIT);
1895 int ret;
1896
1897 rcu_read_lock();
1898 ret = cap_capable(tsk, __task_cred(tsk), ns, cap,
1899 SECURITY_CAP_NOAUDIT);
1900 rcu_read_unlock();
1901 return ret;
1902} 1875}
1903 1876
1904static inline int security_quotactl(int cmds, int type, int id, 1877static inline int security_quotactl(int cmds, int type, int id,
@@ -2043,7 +2016,7 @@ static inline void security_inode_free(struct inode *inode)
2043static inline int security_inode_init_security(struct inode *inode, 2016static inline int security_inode_init_security(struct inode *inode,
2044 struct inode *dir, 2017 struct inode *dir,
2045 const struct qstr *qstr, 2018 const struct qstr *qstr,
2046 initxattrs initxattrs, 2019 const initxattrs initxattrs,
2047 void *fs_data) 2020 void *fs_data)
2048{ 2021{
2049 return 0; 2022 return 0;
@@ -2515,11 +2488,6 @@ static inline int security_netlink_send(struct sock *sk, struct sk_buff *skb)
2515 return cap_netlink_send(sk, skb); 2488 return cap_netlink_send(sk, skb);
2516} 2489}
2517 2490
2518static inline int security_netlink_recv(struct sk_buff *skb, int cap)
2519{
2520 return cap_netlink_recv(skb, cap);
2521}
2522
2523static inline int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen) 2491static inline int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen)
2524{ 2492{
2525 return -EOPNOTSUPP; 2493 return -EOPNOTSUPP;
diff --git a/include/linux/serial_8250.h b/include/linux/serial_8250.h
index 1f05bbeac01e..8f012f8ac8e9 100644
--- a/include/linux/serial_8250.h
+++ b/include/linux/serial_8250.h
@@ -66,6 +66,7 @@ enum {
66 * dependent on the 8250 driver. 66 * dependent on the 8250 driver.
67 */ 67 */
68struct uart_port; 68struct uart_port;
69struct uart_8250_port;
69 70
70int serial8250_register_port(struct uart_port *); 71int serial8250_register_port(struct uart_port *);
71void serial8250_unregister_port(int line); 72void serial8250_unregister_port(int line);
@@ -81,7 +82,11 @@ extern void serial8250_do_set_termios(struct uart_port *port,
81 struct ktermios *termios, struct ktermios *old); 82 struct ktermios *termios, struct ktermios *old);
82extern void serial8250_do_pm(struct uart_port *port, unsigned int state, 83extern void serial8250_do_pm(struct uart_port *port, unsigned int state,
83 unsigned int oldstate); 84 unsigned int oldstate);
85extern int fsl8250_handle_irq(struct uart_port *port);
84int serial8250_handle_irq(struct uart_port *port, unsigned int iir); 86int serial8250_handle_irq(struct uart_port *port, unsigned int iir);
87unsigned char serial8250_rx_chars(struct uart_8250_port *up, unsigned char lsr);
88void serial8250_tx_chars(struct uart_8250_port *up);
89unsigned int serial8250_modem_status(struct uart_8250_port *up);
85 90
86extern void serial8250_set_isa_configurator(void (*v) 91extern void serial8250_set_isa_configurator(void (*v)
87 (int port, struct uart_port *up, 92 (int port, struct uart_port *up,
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index eadf33d0abba..c91ace70c21d 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -207,6 +207,10 @@
207/* Xilinx PSS UART */ 207/* Xilinx PSS UART */
208#define PORT_XUARTPS 98 208#define PORT_XUARTPS 98
209 209
210/* Atheros AR933X SoC */
211#define PORT_AR933X 99
212
213
210#ifdef __KERNEL__ 214#ifdef __KERNEL__
211 215
212#include <linux/compiler.h> 216#include <linux/compiler.h>
@@ -351,6 +355,7 @@ struct uart_port {
351#define UPF_CONS_FLOW ((__force upf_t) (1 << 23)) 355#define UPF_CONS_FLOW ((__force upf_t) (1 << 23))
352#define UPF_SHARE_IRQ ((__force upf_t) (1 << 24)) 356#define UPF_SHARE_IRQ ((__force upf_t) (1 << 24))
353#define UPF_EXAR_EFR ((__force upf_t) (1 << 25)) 357#define UPF_EXAR_EFR ((__force upf_t) (1 << 25))
358#define UPF_IIR_ONCE ((__force upf_t) (1 << 26))
354/* The exact UART type is known and should not be probed. */ 359/* The exact UART type is known and should not be probed. */
355#define UPF_FIXED_TYPE ((__force upf_t) (1 << 27)) 360#define UPF_FIXED_TYPE ((__force upf_t) (1 << 27))
356#define UPF_BOOT_AUTOCONF ((__force upf_t) (1 << 28)) 361#define UPF_BOOT_AUTOCONF ((__force upf_t) (1 << 28))
@@ -483,10 +488,19 @@ static inline int uart_tx_stopped(struct uart_port *port)
483/* 488/*
484 * The following are helper functions for the low level drivers. 489 * The following are helper functions for the low level drivers.
485 */ 490 */
491
492extern void uart_handle_dcd_change(struct uart_port *uport,
493 unsigned int status);
494extern void uart_handle_cts_change(struct uart_port *uport,
495 unsigned int status);
496
497extern void uart_insert_char(struct uart_port *port, unsigned int status,
498 unsigned int overrun, unsigned int ch, unsigned int flag);
499
500#ifdef SUPPORT_SYSRQ
486static inline int 501static inline int
487uart_handle_sysrq_char(struct uart_port *port, unsigned int ch) 502uart_handle_sysrq_char(struct uart_port *port, unsigned int ch)
488{ 503{
489#ifdef SUPPORT_SYSRQ
490 if (port->sysrq) { 504 if (port->sysrq) {
491 if (ch && time_before(jiffies, port->sysrq)) { 505 if (ch && time_before(jiffies, port->sysrq)) {
492 handle_sysrq(ch); 506 handle_sysrq(ch);
@@ -495,11 +509,10 @@ uart_handle_sysrq_char(struct uart_port *port, unsigned int ch)
495 } 509 }
496 port->sysrq = 0; 510 port->sysrq = 0;
497 } 511 }
498#endif
499 return 0; 512 return 0;
500} 513}
501#ifndef SUPPORT_SYSRQ 514#else
502#define uart_handle_sysrq_char(port,ch) uart_handle_sysrq_char(port, 0) 515#define uart_handle_sysrq_char(port,ch) ({ (void)port; 0; })
503#endif 516#endif
504 517
505/* 518/*
@@ -522,89 +535,6 @@ static inline int uart_handle_break(struct uart_port *port)
522 return 0; 535 return 0;
523} 536}
524 537
525/**
526 * uart_handle_dcd_change - handle a change of carrier detect state
527 * @uport: uart_port structure for the open port
528 * @status: new carrier detect status, nonzero if active
529 */
530static inline void
531uart_handle_dcd_change(struct uart_port *uport, unsigned int status)
532{
533 struct uart_state *state = uport->state;
534 struct tty_port *port = &state->port;
535 struct tty_ldisc *ld = tty_ldisc_ref(port->tty);
536 struct pps_event_time ts;
537
538 if (ld && ld->ops->dcd_change)
539 pps_get_ts(&ts);
540
541 uport->icount.dcd++;
542#ifdef CONFIG_HARD_PPS
543 if ((uport->flags & UPF_HARDPPS_CD) && status)
544 hardpps();
545#endif
546
547 if (port->flags & ASYNC_CHECK_CD) {
548 if (status)
549 wake_up_interruptible(&port->open_wait);
550 else if (port->tty)
551 tty_hangup(port->tty);
552 }
553
554 if (ld && ld->ops->dcd_change)
555 ld->ops->dcd_change(port->tty, status, &ts);
556 if (ld)
557 tty_ldisc_deref(ld);
558}
559
560/**
561 * uart_handle_cts_change - handle a change of clear-to-send state
562 * @uport: uart_port structure for the open port
563 * @status: new clear to send status, nonzero if active
564 */
565static inline void
566uart_handle_cts_change(struct uart_port *uport, unsigned int status)
567{
568 struct tty_port *port = &uport->state->port;
569 struct tty_struct *tty = port->tty;
570
571 uport->icount.cts++;
572
573 if (port->flags & ASYNC_CTS_FLOW) {
574 if (tty->hw_stopped) {
575 if (status) {
576 tty->hw_stopped = 0;
577 uport->ops->start_tx(uport);
578 uart_write_wakeup(uport);
579 }
580 } else {
581 if (!status) {
582 tty->hw_stopped = 1;
583 uport->ops->stop_tx(uport);
584 }
585 }
586 }
587}
588
589#include <linux/tty_flip.h>
590
591static inline void
592uart_insert_char(struct uart_port *port, unsigned int status,
593 unsigned int overrun, unsigned int ch, unsigned int flag)
594{
595 struct tty_struct *tty = port->state->port.tty;
596
597 if ((status & port->ignore_status_mask & ~overrun) == 0)
598 tty_insert_flip_char(tty, ch, flag);
599
600 /*
601 * Overrun is special. Since it's reported immediately,
602 * it doesn't affect the current character.
603 */
604 if (status & ~port->ignore_status_mask & overrun)
605 tty_insert_flip_char(tty, 0, TTY_OVERRUN);
606}
607
608/* 538/*
609 * UART_ENABLE_MS - determine if port should enable modem status irqs 539 * UART_ENABLE_MS - determine if port should enable modem status irqs
610 */ 540 */
diff --git a/include/linux/serial_sci.h b/include/linux/serial_sci.h
index 369273a52679..78779074f6e8 100644
--- a/include/linux/serial_sci.h
+++ b/include/linux/serial_sci.h
@@ -49,6 +49,10 @@ enum {
49 49
50#define SCIF_DEFAULT_ERROR_MASK (SCIF_PER | SCIF_FER | SCIF_ER | SCIF_BRK) 50#define SCIF_DEFAULT_ERROR_MASK (SCIF_PER | SCIF_FER | SCIF_ER | SCIF_BRK)
51 51
52/* SCSPTR, optional */
53#define SCSPTR_RTSIO (1 << 7)
54#define SCSPTR_CTSIO (1 << 5)
55
52/* Offsets into the sci_port->irqs array */ 56/* Offsets into the sci_port->irqs array */
53enum { 57enum {
54 SCIx_ERI_IRQ, 58 SCIx_ERI_IRQ,
@@ -60,6 +64,17 @@ enum {
60 SCIx_MUX_IRQ = SCIx_NR_IRQS, /* special case */ 64 SCIx_MUX_IRQ = SCIx_NR_IRQS, /* special case */
61}; 65};
62 66
67/* Offsets into the sci_port->gpios array */
68enum {
69 SCIx_SCK,
70 SCIx_RXD,
71 SCIx_TXD,
72 SCIx_CTS,
73 SCIx_RTS,
74
75 SCIx_NR_FNS,
76};
77
63enum { 78enum {
64 SCIx_PROBE_REGTYPE, 79 SCIx_PROBE_REGTYPE,
65 80
@@ -109,13 +124,20 @@ struct plat_sci_port_ops {
109}; 124};
110 125
111/* 126/*
127 * Port-specific capabilities
128 */
129#define SCIx_HAVE_RTSCTS (1 << 0)
130
131/*
112 * Platform device specific platform_data struct 132 * Platform device specific platform_data struct
113 */ 133 */
114struct plat_sci_port { 134struct plat_sci_port {
115 unsigned long mapbase; /* resource base */ 135 unsigned long mapbase; /* resource base */
116 unsigned int irqs[SCIx_NR_IRQS]; /* ERI, RXI, TXI, BRI */ 136 unsigned int irqs[SCIx_NR_IRQS]; /* ERI, RXI, TXI, BRI */
137 unsigned int gpios[SCIx_NR_FNS]; /* SCK, RXD, TXD, CTS, RTS */
117 unsigned int type; /* SCI / SCIF / IRDA */ 138 unsigned int type; /* SCI / SCIF / IRDA */
118 upf_t flags; /* UPF_* flags */ 139 upf_t flags; /* UPF_* flags */
140 unsigned long capabilities; /* Port features/capabilities */
119 141
120 unsigned int scbrr_algo_id; /* SCBRR calculation algo */ 142 unsigned int scbrr_algo_id; /* SCBRR calculation algo */
121 unsigned int scscr; /* SCSCR initialization */ 143 unsigned int scscr; /* SCSCR initialization */
diff --git a/include/linux/sh_clk.h b/include/linux/sh_clk.h
index a20831cf336a..54341d811685 100644
--- a/include/linux/sh_clk.h
+++ b/include/linux/sh_clk.h
@@ -49,6 +49,7 @@ struct clk {
49 49
50 void __iomem *enable_reg; 50 void __iomem *enable_reg;
51 unsigned int enable_bit; 51 unsigned int enable_bit;
52 void __iomem *mapped_reg;
52 53
53 unsigned long arch_flags; 54 unsigned long arch_flags;
54 void *priv; 55 void *priv;
@@ -131,10 +132,9 @@ int sh_clk_div4_enable_register(struct clk *clks, int nr,
131int sh_clk_div4_reparent_register(struct clk *clks, int nr, 132int sh_clk_div4_reparent_register(struct clk *clks, int nr,
132 struct clk_div4_table *table); 133 struct clk_div4_table *table);
133 134
134#define SH_CLK_DIV6_EXT(_parent, _reg, _flags, _parents, \ 135#define SH_CLK_DIV6_EXT(_reg, _flags, _parents, \
135 _num_parents, _src_shift, _src_width) \ 136 _num_parents, _src_shift, _src_width) \
136{ \ 137{ \
137 .parent = _parent, \
138 .enable_reg = (void __iomem *)_reg, \ 138 .enable_reg = (void __iomem *)_reg, \
139 .flags = _flags, \ 139 .flags = _flags, \
140 .parent_table = _parents, \ 140 .parent_table = _parents, \
@@ -144,7 +144,11 @@ int sh_clk_div4_reparent_register(struct clk *clks, int nr,
144} 144}
145 145
146#define SH_CLK_DIV6(_parent, _reg, _flags) \ 146#define SH_CLK_DIV6(_parent, _reg, _flags) \
147 SH_CLK_DIV6_EXT(_parent, _reg, _flags, NULL, 0, 0, 0) 147{ \
148 .parent = _parent, \
149 .enable_reg = (void __iomem *)_reg, \
150 .flags = _flags, \
151}
148 152
149int sh_clk_div6_register(struct clk *clks, int nr); 153int sh_clk_div6_register(struct clk *clks, int nr);
150int sh_clk_div6_reparent_register(struct clk *clks, int nr); 154int sh_clk_div6_reparent_register(struct clk *clks, int nr);
diff --git a/include/linux/sh_dma.h b/include/linux/sh_dma.h
index cb2dd118cc0f..8cd7fe59cf1a 100644
--- a/include/linux/sh_dma.h
+++ b/include/linux/sh_dma.h
@@ -30,7 +30,7 @@ struct sh_desc {
30 struct sh_dmae_regs hw; 30 struct sh_dmae_regs hw;
31 struct list_head node; 31 struct list_head node;
32 struct dma_async_tx_descriptor async_tx; 32 struct dma_async_tx_descriptor async_tx;
33 enum dma_data_direction direction; 33 enum dma_transfer_direction direction;
34 dma_cookie_t cookie; 34 dma_cookie_t cookie;
35 size_t partial; 35 size_t partial;
36 int chunks; 36 int chunks;
@@ -48,6 +48,7 @@ struct sh_dmae_channel {
48 unsigned int offset; 48 unsigned int offset;
49 unsigned int dmars; 49 unsigned int dmars;
50 unsigned int dmars_bit; 50 unsigned int dmars_bit;
51 unsigned int chclr_offset;
51}; 52};
52 53
53struct sh_dmae_pdata { 54struct sh_dmae_pdata {
@@ -68,6 +69,7 @@ struct sh_dmae_pdata {
68 unsigned int dmaor_is_32bit:1; 69 unsigned int dmaor_is_32bit:1;
69 unsigned int needs_tend_set:1; 70 unsigned int needs_tend_set:1;
70 unsigned int no_dmars:1; 71 unsigned int no_dmars:1;
72 unsigned int chclr_present:1;
71}; 73};
72 74
73/* DMA register */ 75/* DMA register */
diff --git a/include/linux/sh_pfc.h b/include/linux/sh_pfc.h
index 8446789216e5..5c15aed9c4b2 100644
--- a/include/linux/sh_pfc.h
+++ b/include/linux/sh_pfc.h
@@ -45,16 +45,24 @@ struct pinmux_cfg_reg {
45 unsigned long reg, reg_width, field_width; 45 unsigned long reg, reg_width, field_width;
46 unsigned long *cnt; 46 unsigned long *cnt;
47 pinmux_enum_t *enum_ids; 47 pinmux_enum_t *enum_ids;
48 unsigned long *var_field_width;
48}; 49};
49 50
50#define PINMUX_CFG_REG(name, r, r_width, f_width) \ 51#define PINMUX_CFG_REG(name, r, r_width, f_width) \
51 .reg = r, .reg_width = r_width, .field_width = f_width, \ 52 .reg = r, .reg_width = r_width, .field_width = f_width, \
52 .cnt = (unsigned long [r_width / f_width]) {}, \ 53 .cnt = (unsigned long [r_width / f_width]) {}, \
53 .enum_ids = (pinmux_enum_t [(r_width / f_width) * (1 << f_width)]) \ 54 .enum_ids = (pinmux_enum_t [(r_width / f_width) * (1 << f_width)])
55
56#define PINMUX_CFG_REG_VAR(name, r, r_width, var_fw0, var_fwn...) \
57 .reg = r, .reg_width = r_width, \
58 .cnt = (unsigned long [r_width]) {}, \
59 .var_field_width = (unsigned long [r_width]) { var_fw0, var_fwn, 0 }, \
60 .enum_ids = (pinmux_enum_t [])
54 61
55struct pinmux_data_reg { 62struct pinmux_data_reg {
56 unsigned long reg, reg_width, reg_shadow; 63 unsigned long reg, reg_width, reg_shadow;
57 pinmux_enum_t *enum_ids; 64 pinmux_enum_t *enum_ids;
65 void __iomem *mapped_reg;
58}; 66};
59 67
60#define PINMUX_DATA_REG(name, r, r_width) \ 68#define PINMUX_DATA_REG(name, r, r_width) \
@@ -75,6 +83,12 @@ struct pinmux_range {
75 pinmux_enum_t force; 83 pinmux_enum_t force;
76}; 84};
77 85
86struct pfc_window {
87 phys_addr_t phys;
88 void __iomem *virt;
89 unsigned long size;
90};
91
78struct pinmux_info { 92struct pinmux_info {
79 char *name; 93 char *name;
80 pinmux_enum_t reserved_id; 94 pinmux_enum_t reserved_id;
@@ -98,6 +112,12 @@ struct pinmux_info {
98 struct pinmux_irq *gpio_irq; 112 struct pinmux_irq *gpio_irq;
99 unsigned int gpio_irq_size; 113 unsigned int gpio_irq_size;
100 114
115 struct resource *resource;
116 unsigned int num_resources;
117 struct pfc_window *window;
118
119 unsigned long unlock_reg;
120
101 struct gpio_chip chip; 121 struct gpio_chip chip;
102}; 122};
103 123
diff --git a/include/linux/shmem_fs.h b/include/linux/shmem_fs.h
index e4c711c6f321..79ab2555b3b0 100644
--- a/include/linux/shmem_fs.h
+++ b/include/linux/shmem_fs.h
@@ -48,6 +48,7 @@ extern struct file *shmem_file_setup(const char *name,
48 loff_t size, unsigned long flags); 48 loff_t size, unsigned long flags);
49extern int shmem_zero_setup(struct vm_area_struct *); 49extern int shmem_zero_setup(struct vm_area_struct *);
50extern int shmem_lock(struct file *file, int lock, struct user_struct *user); 50extern int shmem_lock(struct file *file, int lock, struct user_struct *user);
51extern void shmem_unlock_mapping(struct address_space *mapping);
51extern struct page *shmem_read_mapping_page_gfp(struct address_space *mapping, 52extern struct page *shmem_read_mapping_page_gfp(struct address_space *mapping,
52 pgoff_t index, gfp_t gfp_mask); 53 pgoff_t index, gfp_t gfp_mask);
53extern void shmem_truncate_range(struct inode *inode, loff_t start, loff_t end); 54extern void shmem_truncate_range(struct inode *inode, loff_t start, loff_t end);
diff --git a/include/linux/sigma.h b/include/linux/sigma.h
deleted file mode 100644
index d0de882c0d96..000000000000
--- a/include/linux/sigma.h
+++ /dev/null
@@ -1,55 +0,0 @@
1/*
2 * Load firmware files from Analog Devices SigmaStudio
3 *
4 * Copyright 2009-2011 Analog Devices Inc.
5 *
6 * Licensed under the GPL-2 or later.
7 */
8
9#ifndef __SIGMA_FIRMWARE_H__
10#define __SIGMA_FIRMWARE_H__
11
12#include <linux/firmware.h>
13#include <linux/types.h>
14
15struct i2c_client;
16
17#define SIGMA_MAGIC "ADISIGM"
18
19struct sigma_firmware {
20 const struct firmware *fw;
21 size_t pos;
22};
23
24struct sigma_firmware_header {
25 unsigned char magic[7];
26 u8 version;
27 __le32 crc;
28};
29
30enum {
31 SIGMA_ACTION_WRITEXBYTES = 0,
32 SIGMA_ACTION_WRITESINGLE,
33 SIGMA_ACTION_WRITESAFELOAD,
34 SIGMA_ACTION_DELAY,
35 SIGMA_ACTION_PLLWAIT,
36 SIGMA_ACTION_NOOP,
37 SIGMA_ACTION_END,
38};
39
40struct sigma_action {
41 u8 instr;
42 u8 len_hi;
43 __le16 len;
44 __be16 addr;
45 unsigned char payload[];
46};
47
48static inline u32 sigma_action_len(struct sigma_action *sa)
49{
50 return (sa->len_hi << 16) | le16_to_cpu(sa->len);
51}
52
53extern int process_sigma_firmware(struct i2c_client *client, const char *name);
54
55#endif
diff --git a/include/linux/signal.h b/include/linux/signal.h
index a822300a253b..7987ce74874b 100644
--- a/include/linux/signal.h
+++ b/include/linux/signal.h
@@ -254,6 +254,7 @@ extern void set_current_blocked(const sigset_t *);
254extern int show_unhandled_signals; 254extern int show_unhandled_signals;
255 255
256extern int get_signal_to_deliver(siginfo_t *info, struct k_sigaction *return_ka, struct pt_regs *regs, void *cookie); 256extern int get_signal_to_deliver(siginfo_t *info, struct k_sigaction *return_ka, struct pt_regs *regs, void *cookie);
257extern void block_sigmask(struct k_sigaction *ka, int signr);
257extern void exit_signals(struct task_struct *tsk); 258extern void exit_signals(struct task_struct *tsk);
258 259
259extern struct kmem_cache *sighand_cachep; 260extern struct kmem_cache *sighand_cachep;
diff --git a/include/linux/sirfsoc_dma.h b/include/linux/sirfsoc_dma.h
new file mode 100644
index 000000000000..29d959333d81
--- /dev/null
+++ b/include/linux/sirfsoc_dma.h
@@ -0,0 +1,6 @@
1#ifndef _SIRFSOC_DMA_H_
2#define _SIRFSOC_DMA_H_
3
4bool sirfsoc_dma_filter_id(struct dma_chan *chan, void *chan_id);
5
6#endif
diff --git a/include/linux/slab_def.h b/include/linux/slab_def.h
index d00e0bacda93..fbd1117fdfde 100644
--- a/include/linux/slab_def.h
+++ b/include/linux/slab_def.h
@@ -15,8 +15,6 @@
15#include <asm/cache.h> /* kmalloc_sizes.h needs L1_CACHE_BYTES */ 15#include <asm/cache.h> /* kmalloc_sizes.h needs L1_CACHE_BYTES */
16#include <linux/compiler.h> 16#include <linux/compiler.h>
17 17
18#include <trace/events/kmem.h>
19
20/* 18/*
21 * struct kmem_cache 19 * struct kmem_cache
22 * 20 *
diff --git a/include/linux/snmp.h b/include/linux/snmp.h
index e16557a357e5..c1241c428179 100644
--- a/include/linux/snmp.h
+++ b/include/linux/snmp.h
@@ -192,7 +192,6 @@ enum
192 LINUX_MIB_TCPPARTIALUNDO, /* TCPPartialUndo */ 192 LINUX_MIB_TCPPARTIALUNDO, /* TCPPartialUndo */
193 LINUX_MIB_TCPDSACKUNDO, /* TCPDSACKUndo */ 193 LINUX_MIB_TCPDSACKUNDO, /* TCPDSACKUndo */
194 LINUX_MIB_TCPLOSSUNDO, /* TCPLossUndo */ 194 LINUX_MIB_TCPLOSSUNDO, /* TCPLossUndo */
195 LINUX_MIB_TCPLOSS, /* TCPLoss */
196 LINUX_MIB_TCPLOSTRETRANSMIT, /* TCPLostRetransmit */ 195 LINUX_MIB_TCPLOSTRETRANSMIT, /* TCPLostRetransmit */
197 LINUX_MIB_TCPRENOFAILURES, /* TCPRenoFailures */ 196 LINUX_MIB_TCPRENOFAILURES, /* TCPRenoFailures */
198 LINUX_MIB_TCPSACKFAILURES, /* TCPSackFailures */ 197 LINUX_MIB_TCPSACKFAILURES, /* TCPSackFailures */
diff --git a/include/linux/sound.h b/include/linux/sound.h
index 44dcf0570432..fae20ba01fbf 100644
--- a/include/linux/sound.h
+++ b/include/linux/sound.h
@@ -1,3 +1,5 @@
1#ifndef _LINUX_SOUND_H
2#define _LINUX_SOUND_H
1 3
2/* 4/*
3 * Minor numbers for the sound driver. 5 * Minor numbers for the sound driver.
@@ -42,3 +44,5 @@ extern void unregister_sound_mixer(int unit);
42extern void unregister_sound_midi(int unit); 44extern void unregister_sound_midi(int unit);
43extern void unregister_sound_dsp(int unit); 45extern void unregister_sound_dsp(int unit);
44#endif /* __KERNEL__ */ 46#endif /* __KERNEL__ */
47
48#endif /* _LINUX_SOUND_H */
diff --git a/include/linux/soundcard.h b/include/linux/soundcard.h
index fe204fe39f7c..dfcf86f013a9 100644
--- a/include/linux/soundcard.h
+++ b/include/linux/soundcard.h
@@ -198,7 +198,8 @@ typedef struct seq_event_rec {
198# else 198# else
199# error "could not determine byte order" 199# error "could not determine byte order"
200# endif 200# endif
201#elif defined(__BYTE_ORDER) 201#else
202# if defined(__BYTE_ORDER)
202# if __BYTE_ORDER == __BIG_ENDIAN 203# if __BYTE_ORDER == __BIG_ENDIAN
203# define AFMT_S16_NE AFMT_S16_BE 204# define AFMT_S16_NE AFMT_S16_BE
204# elif __BYTE_ORDER == __LITTLE_ENDIAN 205# elif __BYTE_ORDER == __LITTLE_ENDIAN
@@ -206,6 +207,7 @@ typedef struct seq_event_rec {
206# else 207# else
207# error "could not determine byte order" 208# error "could not determine byte order"
208# endif 209# endif
210# endif
209#endif 211#endif
210 212
211/* 213/*
diff --git a/include/linux/sunrpc/auth.h b/include/linux/sunrpc/auth.h
index febc4dbec2ca..7874a8a56638 100644
--- a/include/linux/sunrpc/auth.h
+++ b/include/linux/sunrpc/auth.h
@@ -26,6 +26,7 @@ struct auth_cred {
26 uid_t uid; 26 uid_t uid;
27 gid_t gid; 27 gid_t gid;
28 struct group_info *group_info; 28 struct group_info *group_info;
29 const char *principal;
29 unsigned char machine_cred : 1; 30 unsigned char machine_cred : 1;
30}; 31};
31 32
@@ -127,7 +128,7 @@ void rpc_destroy_generic_auth(void);
127void rpc_destroy_authunix(void); 128void rpc_destroy_authunix(void);
128 129
129struct rpc_cred * rpc_lookup_cred(void); 130struct rpc_cred * rpc_lookup_cred(void);
130struct rpc_cred * rpc_lookup_machine_cred(void); 131struct rpc_cred * rpc_lookup_machine_cred(const char *service_name);
131int rpcauth_register(const struct rpc_authops *); 132int rpcauth_register(const struct rpc_authops *);
132int rpcauth_unregister(const struct rpc_authops *); 133int rpcauth_unregister(const struct rpc_authops *);
133struct rpc_auth * rpcauth_create(rpc_authflavor_t, struct rpc_clnt *); 134struct rpc_auth * rpcauth_create(rpc_authflavor_t, struct rpc_clnt *);
diff --git a/include/linux/sunrpc/auth_gss.h b/include/linux/sunrpc/auth_gss.h
index 8eee9dbbfe7a..f1cfd4c85cd0 100644
--- a/include/linux/sunrpc/auth_gss.h
+++ b/include/linux/sunrpc/auth_gss.h
@@ -82,8 +82,8 @@ struct gss_cred {
82 enum rpc_gss_svc gc_service; 82 enum rpc_gss_svc gc_service;
83 struct gss_cl_ctx __rcu *gc_ctx; 83 struct gss_cl_ctx __rcu *gc_ctx;
84 struct gss_upcall_msg *gc_upcall; 84 struct gss_upcall_msg *gc_upcall;
85 const char *gc_principal;
85 unsigned long gc_upcall_timestamp; 86 unsigned long gc_upcall_timestamp;
86 unsigned char gc_machine_cred : 1;
87}; 87};
88 88
89#endif /* __KERNEL__ */ 89#endif /* __KERNEL__ */
diff --git a/include/linux/sunrpc/svc_xprt.h b/include/linux/sunrpc/svc_xprt.h
index 8620f79658d4..dfa900948af7 100644
--- a/include/linux/sunrpc/svc_xprt.h
+++ b/include/linux/sunrpc/svc_xprt.h
@@ -109,7 +109,7 @@ static inline int register_xpt_user(struct svc_xprt *xpt, struct svc_xpt_user *u
109 109
110int svc_reg_xprt_class(struct svc_xprt_class *); 110int svc_reg_xprt_class(struct svc_xprt_class *);
111void svc_unreg_xprt_class(struct svc_xprt_class *); 111void svc_unreg_xprt_class(struct svc_xprt_class *);
112void svc_xprt_init(struct svc_xprt_class *, struct svc_xprt *, 112void svc_xprt_init(struct net *, struct svc_xprt_class *, struct svc_xprt *,
113 struct svc_serv *); 113 struct svc_serv *);
114int svc_create_xprt(struct svc_serv *, const char *, struct net *, 114int svc_create_xprt(struct svc_serv *, const char *, struct net *,
115 const int, const unsigned short, int); 115 const int, const unsigned short, int);
@@ -118,7 +118,6 @@ void svc_xprt_received(struct svc_xprt *);
118void svc_xprt_put(struct svc_xprt *xprt); 118void svc_xprt_put(struct svc_xprt *xprt);
119void svc_xprt_copy_addrs(struct svc_rqst *rqstp, struct svc_xprt *xprt); 119void svc_xprt_copy_addrs(struct svc_rqst *rqstp, struct svc_xprt *xprt);
120void svc_close_xprt(struct svc_xprt *xprt); 120void svc_close_xprt(struct svc_xprt *xprt);
121void svc_delete_xprt(struct svc_xprt *xprt);
122int svc_port_is_privileged(struct sockaddr *sin); 121int svc_port_is_privileged(struct sockaddr *sin);
123int svc_print_xprts(char *buf, int maxlen); 122int svc_print_xprts(char *buf, int maxlen);
124struct svc_xprt *svc_find_xprt(struct svc_serv *serv, const char *xcl_name, 123struct svc_xprt *svc_find_xprt(struct svc_serv *serv, const char *xcl_name,
diff --git a/include/linux/sunrpc/svcsock.h b/include/linux/sunrpc/svcsock.h
index 85c50b40759d..c84e9741cb2a 100644
--- a/include/linux/sunrpc/svcsock.h
+++ b/include/linux/sunrpc/svcsock.h
@@ -34,7 +34,7 @@ struct svc_sock {
34/* 34/*
35 * Function prototypes. 35 * Function prototypes.
36 */ 36 */
37void svc_close_all(struct list_head *); 37void svc_close_all(struct svc_serv *);
38int svc_recv(struct svc_rqst *, long); 38int svc_recv(struct svc_rqst *, long);
39int svc_send(struct svc_rqst *); 39int svc_send(struct svc_rqst *);
40void svc_drop(struct svc_rqst *); 40void svc_drop(struct svc_rqst *);
diff --git a/include/linux/sunrpc/xdr.h b/include/linux/sunrpc/xdr.h
index a20970ef9e4e..af70af333546 100644
--- a/include/linux/sunrpc/xdr.h
+++ b/include/linux/sunrpc/xdr.h
@@ -191,6 +191,8 @@ extern int xdr_decode_array2(struct xdr_buf *buf, unsigned int base,
191 struct xdr_array2_desc *desc); 191 struct xdr_array2_desc *desc);
192extern int xdr_encode_array2(struct xdr_buf *buf, unsigned int base, 192extern int xdr_encode_array2(struct xdr_buf *buf, unsigned int base,
193 struct xdr_array2_desc *desc); 193 struct xdr_array2_desc *desc);
194extern void _copy_from_pages(char *p, struct page **pages, size_t pgbase,
195 size_t len);
194 196
195/* 197/*
196 * Provide some simple tools for XDR buffer overflow-checking etc. 198 * Provide some simple tools for XDR buffer overflow-checking etc.
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index 95040cc33107..91784a4f8608 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -357,14 +357,29 @@ extern bool pm_save_wakeup_count(unsigned int count);
357 357
358static inline void lock_system_sleep(void) 358static inline void lock_system_sleep(void)
359{ 359{
360 freezer_do_not_count(); 360 current->flags |= PF_FREEZER_SKIP;
361 mutex_lock(&pm_mutex); 361 mutex_lock(&pm_mutex);
362} 362}
363 363
364static inline void unlock_system_sleep(void) 364static inline void unlock_system_sleep(void)
365{ 365{
366 /*
367 * Don't use freezer_count() because we don't want the call to
368 * try_to_freeze() here.
369 *
370 * Reason:
371 * Fundamentally, we just don't need it, because freezing condition
372 * doesn't come into effect until we release the pm_mutex lock,
373 * since the freezer always works with pm_mutex held.
374 *
375 * More importantly, in the case of hibernation,
376 * unlock_system_sleep() gets called in snapshot_read() and
377 * snapshot_write() when the freezing condition is still in effect.
378 * Which means, if we use try_to_freeze() here, it would make them
379 * enter the refrigerator, thus causing hibernation to lockup.
380 */
381 current->flags &= ~PF_FREEZER_SKIP;
366 mutex_unlock(&pm_mutex); 382 mutex_unlock(&pm_mutex);
367 freezer_count();
368} 383}
369 384
370#else /* !CONFIG_PM_SLEEP */ 385#else /* !CONFIG_PM_SLEEP */
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 1e22e126d2ac..3e60228e7299 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -207,6 +207,7 @@ struct swap_list_t {
207/* linux/mm/page_alloc.c */ 207/* linux/mm/page_alloc.c */
208extern unsigned long totalram_pages; 208extern unsigned long totalram_pages;
209extern unsigned long totalreserve_pages; 209extern unsigned long totalreserve_pages;
210extern unsigned long dirty_balance_reserve;
210extern unsigned int nr_free_buffer_pages(void); 211extern unsigned int nr_free_buffer_pages(void);
211extern unsigned int nr_free_pagecache_pages(void); 212extern unsigned int nr_free_pagecache_pages(void);
212 213
@@ -272,7 +273,7 @@ static inline int zone_reclaim(struct zone *z, gfp_t mask, unsigned int order)
272#endif 273#endif
273 274
274extern int page_evictable(struct page *page, struct vm_area_struct *vma); 275extern int page_evictable(struct page *page, struct vm_area_struct *vma);
275extern void scan_mapping_unevictable_pages(struct address_space *); 276extern void check_move_unevictable_pages(struct page **, int nr_pages);
276 277
277extern unsigned long scan_unevictable_pages; 278extern unsigned long scan_unevictable_pages;
278extern int scan_unevictable_handler(struct ctl_table *, int, 279extern int scan_unevictable_handler(struct ctl_table *, int,
diff --git a/include/linux/swiotlb.h b/include/linux/swiotlb.h
index 445702c60d04..e872526fdc5f 100644
--- a/include/linux/swiotlb.h
+++ b/include/linux/swiotlb.h
@@ -24,7 +24,7 @@ extern int swiotlb_force;
24 24
25extern void swiotlb_init(int verbose); 25extern void swiotlb_init(int verbose);
26extern void swiotlb_init_with_tbl(char *tlb, unsigned long nslabs, int verbose); 26extern void swiotlb_init_with_tbl(char *tlb, unsigned long nslabs, int verbose);
27extern unsigned long swioltb_nr_tbl(void); 27extern unsigned long swiotlb_nr_tbl(void);
28 28
29/* 29/*
30 * Enumeration for sync targets 30 * Enumeration for sync targets
diff --git a/include/linux/sysdev.h b/include/linux/sysdev.h
deleted file mode 100644
index 20f63d3e6144..000000000000
--- a/include/linux/sysdev.h
+++ /dev/null
@@ -1,164 +0,0 @@
1/**
2 * System devices follow a slightly different driver model.
3 * They don't need to do dynammic driver binding, can't be probed,
4 * and don't reside on any type of peripheral bus.
5 * So, we represent and treat them a little differently.
6 *
7 * We still have a notion of a driver for a system device, because we still
8 * want to perform basic operations on these devices.
9 *
10 * We also support auxiliary drivers binding to devices of a certain class.
11 *
12 * This allows configurable drivers to register themselves for devices of
13 * a certain type. And, it allows class definitions to reside in generic
14 * code while arch-specific code can register specific drivers.
15 *
16 * Auxiliary drivers registered with a NULL cls are registered as drivers
17 * for all system devices, and get notification calls for each device.
18 */
19
20
21#ifndef _SYSDEV_H_
22#define _SYSDEV_H_
23
24#include <linux/kobject.h>
25#include <linux/pm.h>
26
27
28struct sys_device;
29struct sysdev_class_attribute;
30
31struct sysdev_class {
32 const char *name;
33 struct list_head drivers;
34 struct sysdev_class_attribute **attrs;
35 struct kset kset;
36};
37
38struct sysdev_class_attribute {
39 struct attribute attr;
40 ssize_t (*show)(struct sysdev_class *, struct sysdev_class_attribute *,
41 char *);
42 ssize_t (*store)(struct sysdev_class *, struct sysdev_class_attribute *,
43 const char *, size_t);
44};
45
46#define _SYSDEV_CLASS_ATTR(_name,_mode,_show,_store) \
47{ \
48 .attr = {.name = __stringify(_name), .mode = _mode }, \
49 .show = _show, \
50 .store = _store, \
51}
52
53#define SYSDEV_CLASS_ATTR(_name,_mode,_show,_store) \
54 struct sysdev_class_attribute attr_##_name = \
55 _SYSDEV_CLASS_ATTR(_name,_mode,_show,_store)
56
57
58extern int sysdev_class_register(struct sysdev_class *);
59extern void sysdev_class_unregister(struct sysdev_class *);
60
61extern int sysdev_class_create_file(struct sysdev_class *,
62 struct sysdev_class_attribute *);
63extern void sysdev_class_remove_file(struct sysdev_class *,
64 struct sysdev_class_attribute *);
65/**
66 * Auxiliary system device drivers.
67 */
68
69struct sysdev_driver {
70 struct list_head entry;
71 int (*add)(struct sys_device *);
72 int (*remove)(struct sys_device *);
73};
74
75
76extern int sysdev_driver_register(struct sysdev_class *, struct sysdev_driver *);
77extern void sysdev_driver_unregister(struct sysdev_class *, struct sysdev_driver *);
78
79
80/**
81 * sys_devices can be simplified a lot from regular devices, because they're
82 * simply not as versatile.
83 */
84
85struct sys_device {
86 u32 id;
87 struct sysdev_class * cls;
88 struct kobject kobj;
89};
90
91extern int sysdev_register(struct sys_device *);
92extern void sysdev_unregister(struct sys_device *);
93
94
95struct sysdev_attribute {
96 struct attribute attr;
97 ssize_t (*show)(struct sys_device *, struct sysdev_attribute *, char *);
98 ssize_t (*store)(struct sys_device *, struct sysdev_attribute *,
99 const char *, size_t);
100};
101
102
103#define _SYSDEV_ATTR(_name, _mode, _show, _store) \
104{ \
105 .attr = { .name = __stringify(_name), .mode = _mode }, \
106 .show = _show, \
107 .store = _store, \
108}
109
110#define SYSDEV_ATTR(_name, _mode, _show, _store) \
111 struct sysdev_attribute attr_##_name = \
112 _SYSDEV_ATTR(_name, _mode, _show, _store);
113
114extern int sysdev_create_file(struct sys_device *, struct sysdev_attribute *);
115extern void sysdev_remove_file(struct sys_device *, struct sysdev_attribute *);
116
117/* Create/remove NULL terminated attribute list */
118static inline int
119sysdev_create_files(struct sys_device *d, struct sysdev_attribute **a)
120{
121 return sysfs_create_files(&d->kobj, (const struct attribute **)a);
122}
123
124static inline void
125sysdev_remove_files(struct sys_device *d, struct sysdev_attribute **a)
126{
127 return sysfs_remove_files(&d->kobj, (const struct attribute **)a);
128}
129
130struct sysdev_ext_attribute {
131 struct sysdev_attribute attr;
132 void *var;
133};
134
135/*
136 * Support for simple variable sysdev attributes.
137 * The pointer to the variable is stored in a sysdev_ext_attribute
138 */
139
140/* Add more types as needed */
141
142extern ssize_t sysdev_show_ulong(struct sys_device *, struct sysdev_attribute *,
143 char *);
144extern ssize_t sysdev_store_ulong(struct sys_device *,
145 struct sysdev_attribute *, const char *, size_t);
146extern ssize_t sysdev_show_int(struct sys_device *, struct sysdev_attribute *,
147 char *);
148extern ssize_t sysdev_store_int(struct sys_device *,
149 struct sysdev_attribute *, const char *, size_t);
150
151#define _SYSDEV_ULONG_ATTR(_name, _mode, _var) \
152 { _SYSDEV_ATTR(_name, _mode, sysdev_show_ulong, sysdev_store_ulong), \
153 &(_var) }
154#define SYSDEV_ULONG_ATTR(_name, _mode, _var) \
155 struct sysdev_ext_attribute attr_##_name = \
156 _SYSDEV_ULONG_ATTR(_name, _mode, _var);
157#define _SYSDEV_INT_ATTR(_name, _mode, _var) \
158 { _SYSDEV_ATTR(_name, _mode, sysdev_show_int, sysdev_store_int), \
159 &(_var) }
160#define SYSDEV_INT_ATTR(_name, _mode, _var) \
161 struct sysdev_ext_attribute attr_##_name = \
162 _SYSDEV_INT_ATTR(_name, _mode, _var);
163
164#endif /* _SYSDEV_H_ */
diff --git a/include/linux/thermal.h b/include/linux/thermal.h
index 47b4a27e6e97..796f1ff0388c 100644
--- a/include/linux/thermal.h
+++ b/include/linux/thermal.h
@@ -152,9 +152,9 @@ struct thermal_cooling_device *thermal_cooling_device_register(char *, void *,
152void thermal_cooling_device_unregister(struct thermal_cooling_device *); 152void thermal_cooling_device_unregister(struct thermal_cooling_device *);
153 153
154#ifdef CONFIG_NET 154#ifdef CONFIG_NET
155extern int generate_netlink_event(u32 orig, enum events event); 155extern int thermal_generate_netlink_event(u32 orig, enum events event);
156#else 156#else
157static inline int generate_netlink_event(u32 orig, enum events event) 157static inline int thermal_generate_netlink_event(u32 orig, enum events event)
158{ 158{
159 return 0; 159 return 0;
160} 160}
diff --git a/include/linux/tty_driver.h b/include/linux/tty_driver.h
index ecdaeb98b293..5cf685086dd3 100644
--- a/include/linux/tty_driver.h
+++ b/include/linux/tty_driver.h
@@ -312,7 +312,6 @@ struct tty_driver {
312 */ 312 */
313 struct tty_struct **ttys; 313 struct tty_struct **ttys;
314 struct ktermios **termios; 314 struct ktermios **termios;
315 struct ktermios **termios_locked;
316 void *driver_state; 315 void *driver_state;
317 316
318 /* 317 /*
diff --git a/include/linux/ucb1400.h b/include/linux/ucb1400.h
index 5c75153f9441..d21b33c4c6ca 100644
--- a/include/linux/ucb1400.h
+++ b/include/linux/ucb1400.h
@@ -96,13 +96,11 @@ struct ucb1400_gpio {
96 96
97struct ucb1400_ts { 97struct ucb1400_ts {
98 struct input_dev *ts_idev; 98 struct input_dev *ts_idev;
99 struct task_struct *ts_task;
100 int id; 99 int id;
101 wait_queue_head_t ts_wait;
102 unsigned int ts_restart:1;
103 int irq; 100 int irq;
104 unsigned int irq_pending; /* not bit field shared */
105 struct snd_ac97 *ac97; 101 struct snd_ac97 *ac97;
102 wait_queue_head_t ts_wait;
103 bool stopped;
106}; 104};
107 105
108struct ucb1400 { 106struct ucb1400 {
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 7f8d4d61ca47..69d845739bc2 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -1073,6 +1073,7 @@ typedef void (*usb_complete_t)(struct urb *);
1073 * which the host controller driver should use in preference to the 1073 * which the host controller driver should use in preference to the
1074 * transfer_buffer. 1074 * transfer_buffer.
1075 * @sg: scatter gather buffer list 1075 * @sg: scatter gather buffer list
1076 * @num_mapped_sgs: (internal) number of mapped sg entries
1076 * @num_sgs: number of entries in the sg list 1077 * @num_sgs: number of entries in the sg list
1077 * @transfer_buffer_length: How big is transfer_buffer. The transfer may 1078 * @transfer_buffer_length: How big is transfer_buffer. The transfer may
1078 * be broken up into chunks according to the current maximum packet 1079 * be broken up into chunks according to the current maximum packet
@@ -1233,6 +1234,7 @@ struct urb {
1233 void *transfer_buffer; /* (in) associated data buffer */ 1234 void *transfer_buffer; /* (in) associated data buffer */
1234 dma_addr_t transfer_dma; /* (in) dma addr for transfer_buffer */ 1235 dma_addr_t transfer_dma; /* (in) dma addr for transfer_buffer */
1235 struct scatterlist *sg; /* (in) scatter gather buffer list */ 1236 struct scatterlist *sg; /* (in) scatter gather buffer list */
1237 int num_mapped_sgs; /* (internal) mapped sg entries */
1236 int num_sgs; /* (in) number of entries in the sg list */ 1238 int num_sgs; /* (in) number of entries in the sg list */
1237 u32 transfer_buffer_length; /* (in) data buffer length */ 1239 u32 transfer_buffer_length; /* (in) data buffer length */
1238 u32 actual_length; /* (return) actual transfer length */ 1240 u32 actual_length; /* (return) actual transfer length */
@@ -1610,6 +1612,19 @@ usb_maxpacket(struct usb_device *udev, int pipe, int is_out)
1610 1612
1611/* ----------------------------------------------------------------------- */ 1613/* ----------------------------------------------------------------------- */
1612 1614
1615/* translate USB error codes to codes user space understands */
1616static inline int usb_translate_errors(int error_code)
1617{
1618 switch (error_code) {
1619 case 0:
1620 case -ENOMEM:
1621 case -ENODEV:
1622 return error_code;
1623 default:
1624 return -EIO;
1625 }
1626}
1627
1613/* Events from the usb core */ 1628/* Events from the usb core */
1614#define USB_DEVICE_ADD 0x0001 1629#define USB_DEVICE_ADD 0x0001
1615#define USB_DEVICE_REMOVE 0x0002 1630#define USB_DEVICE_REMOVE 0x0002
diff --git a/include/linux/usb/ch11.h b/include/linux/usb/ch11.h
index 4ebaf0824179..31fdb4c6ee3d 100644
--- a/include/linux/usb/ch11.h
+++ b/include/linux/usb/ch11.h
@@ -26,7 +26,6 @@
26#define HUB_RESET_TT 9 26#define HUB_RESET_TT 9
27#define HUB_GET_TT_STATE 10 27#define HUB_GET_TT_STATE 10
28#define HUB_STOP_TT 11 28#define HUB_STOP_TT 11
29#define HUB_SET_DEPTH 12
30 29
31/* 30/*
32 * Hub class additional requests defined by USB 3.0 spec 31 * Hub class additional requests defined by USB 3.0 spec
@@ -165,11 +164,20 @@ struct usb_port_status {
165 * wHubCharacteristics (masks) 164 * wHubCharacteristics (masks)
166 * See USB 2.0 spec Table 11-13, offset 3 165 * See USB 2.0 spec Table 11-13, offset 3
167 */ 166 */
168#define HUB_CHAR_LPSM 0x0003 /* D1 .. D0 */ 167#define HUB_CHAR_LPSM 0x0003 /* Logical Power Switching Mode mask */
169#define HUB_CHAR_COMPOUND 0x0004 /* D2 */ 168#define HUB_CHAR_COMMON_LPSM 0x0000 /* All ports power control at once */
170#define HUB_CHAR_OCPM 0x0018 /* D4 .. D3 */ 169#define HUB_CHAR_INDV_PORT_LPSM 0x0001 /* per-port power control */
171#define HUB_CHAR_TTTT 0x0060 /* D6 .. D5 */ 170#define HUB_CHAR_NO_LPSM 0x0002 /* no power switching */
172#define HUB_CHAR_PORTIND 0x0080 /* D7 */ 171
172#define HUB_CHAR_COMPOUND 0x0004 /* hub is part of a compound device */
173
174#define HUB_CHAR_OCPM 0x0018 /* Over-Current Protection Mode mask */
175#define HUB_CHAR_COMMON_OCPM 0x0000 /* All ports Over-Current reporting */
176#define HUB_CHAR_INDV_PORT_OCPM 0x0008 /* per-port Over-current reporting */
177#define HUB_CHAR_NO_OCPM 0x0010 /* No Over-current Protection support */
178
179#define HUB_CHAR_TTTT 0x0060 /* TT Think Time mask */
180#define HUB_CHAR_PORTIND 0x0080 /* per-port indicators (LEDs) */
173 181
174struct usb_hub_status { 182struct usb_hub_status {
175 __le16 wHubStatus; 183 __le16 wHubStatus;
@@ -198,6 +206,17 @@ struct usb_hub_status {
198#define USB_DT_HUB_NONVAR_SIZE 7 206#define USB_DT_HUB_NONVAR_SIZE 7
199#define USB_DT_SS_HUB_SIZE 12 207#define USB_DT_SS_HUB_SIZE 12
200 208
209/*
210 * Hub Device descriptor
211 * USB Hub class device protocols
212 */
213
214#define USB_HUB_PR_FS 0 /* Full speed hub */
215#define USB_HUB_PR_HS_NO_TT 0 /* Hi-speed hub without TT */
216#define USB_HUB_PR_HS_SINGLE_TT 1 /* Hi-speed hub with single TT */
217#define USB_HUB_PR_HS_MULTI_TT 2 /* Hi-speed hub with multiple TT */
218#define USB_HUB_PR_SS 3 /* Super speed hub */
219
201struct usb_hub_descriptor { 220struct usb_hub_descriptor {
202 __u8 bDescLength; 221 __u8 bDescLength;
203 __u8 bDescriptorType; 222 __u8 bDescriptorType;
diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h
index d5da6c68c250..61b29057b054 100644
--- a/include/linux/usb/ch9.h
+++ b/include/linux/usb/ch9.h
@@ -605,8 +605,26 @@ struct usb_ss_ep_comp_descriptor {
605} __attribute__ ((packed)); 605} __attribute__ ((packed));
606 606
607#define USB_DT_SS_EP_COMP_SIZE 6 607#define USB_DT_SS_EP_COMP_SIZE 6
608
608/* Bits 4:0 of bmAttributes if this is a bulk endpoint */ 609/* Bits 4:0 of bmAttributes if this is a bulk endpoint */
609#define USB_SS_MAX_STREAMS(p) (1 << ((p) & 0x1f)) 610static inline int
611usb_ss_max_streams(const struct usb_ss_ep_comp_descriptor *comp)
612{
613 int max_streams;
614
615 if (!comp)
616 return 0;
617
618 max_streams = comp->bmAttributes & 0x1f;
619
620 if (!max_streams)
621 return 0;
622
623 max_streams = 1 << max_streams;
624
625 return max_streams;
626}
627
610/* Bits 1:0 of bmAttributes if this is an isoc endpoint */ 628/* Bits 1:0 of bmAttributes if this is an isoc endpoint */
611#define USB_SS_MULT(p) (1 + ((p) & 0x3)) 629#define USB_SS_MULT(p) (1 + ((p) & 0x3))
612 630
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index 1d3a67523ffc..da653b5c7134 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -20,6 +20,7 @@
20#include <linux/init.h> 20#include <linux/init.h>
21#include <linux/list.h> 21#include <linux/list.h>
22#include <linux/slab.h> 22#include <linux/slab.h>
23#include <linux/scatterlist.h>
23#include <linux/types.h> 24#include <linux/types.h>
24#include <linux/usb/ch9.h> 25#include <linux/usb/ch9.h>
25 26
@@ -32,6 +33,9 @@ struct usb_ep;
32 * @dma: DMA address corresponding to 'buf'. If you don't set this 33 * @dma: DMA address corresponding to 'buf'. If you don't set this
33 * field, and the usb controller needs one, it is responsible 34 * field, and the usb controller needs one, it is responsible
34 * for mapping and unmapping the buffer. 35 * for mapping and unmapping the buffer.
36 * @sg: a scatterlist for SG-capable controllers.
37 * @num_sgs: number of SG entries
38 * @num_mapped_sgs: number of SG entries mapped to DMA (internal)
35 * @length: Length of that data 39 * @length: Length of that data
36 * @stream_id: The stream id, when USB3.0 bulk streams are being used 40 * @stream_id: The stream id, when USB3.0 bulk streams are being used
37 * @no_interrupt: If true, hints that no completion irq is needed. 41 * @no_interrupt: If true, hints that no completion irq is needed.
@@ -88,6 +92,10 @@ struct usb_request {
88 unsigned length; 92 unsigned length;
89 dma_addr_t dma; 93 dma_addr_t dma;
90 94
95 struct scatterlist *sg;
96 unsigned num_sgs;
97 unsigned num_mapped_sgs;
98
91 unsigned stream_id:16; 99 unsigned stream_id:16;
92 unsigned no_interrupt:1; 100 unsigned no_interrupt:1;
93 unsigned zero:1; 101 unsigned zero:1;
@@ -164,7 +172,7 @@ struct usb_ep {
164 unsigned maxpacket:16; 172 unsigned maxpacket:16;
165 unsigned max_streams:16; 173 unsigned max_streams:16;
166 unsigned mult:2; 174 unsigned mult:2;
167 unsigned maxburst:4; 175 unsigned maxburst:5;
168 u8 address; 176 u8 address;
169 const struct usb_endpoint_descriptor *desc; 177 const struct usb_endpoint_descriptor *desc;
170 const struct usb_ss_ep_comp_descriptor *comp_desc; 178 const struct usb_ss_ep_comp_descriptor *comp_desc;
@@ -477,8 +485,9 @@ struct usb_gadget_ops {
477 * driver setup() requests 485 * driver setup() requests
478 * @ep_list: List of other endpoints supported by the device. 486 * @ep_list: List of other endpoints supported by the device.
479 * @speed: Speed of current connection to USB host. 487 * @speed: Speed of current connection to USB host.
480 * @is_dualspeed: True if the controller supports both high and full speed 488 * @max_speed: Maximal speed the UDC can handle. UDC must support this
481 * operation. If it does, the gadget driver must also support both. 489 * and all slower speeds.
490 * @sg_supported: true if we can handle scatter-gather
482 * @is_otg: True if the USB device port uses a Mini-AB jack, so that the 491 * @is_otg: True if the USB device port uses a Mini-AB jack, so that the
483 * gadget driver must provide a USB OTG descriptor. 492 * gadget driver must provide a USB OTG descriptor.
484 * @is_a_peripheral: False unless is_otg, the "A" end of a USB cable 493 * @is_a_peripheral: False unless is_otg, the "A" end of a USB cable
@@ -518,7 +527,8 @@ struct usb_gadget {
518 struct usb_ep *ep0; 527 struct usb_ep *ep0;
519 struct list_head ep_list; /* of usb_ep */ 528 struct list_head ep_list; /* of usb_ep */
520 enum usb_device_speed speed; 529 enum usb_device_speed speed;
521 unsigned is_dualspeed:1; 530 enum usb_device_speed max_speed;
531 unsigned sg_supported:1;
522 unsigned is_otg:1; 532 unsigned is_otg:1;
523 unsigned is_a_peripheral:1; 533 unsigned is_a_peripheral:1;
524 unsigned b_hnp_enable:1; 534 unsigned b_hnp_enable:1;
@@ -549,7 +559,7 @@ static inline struct usb_gadget *dev_to_usb_gadget(struct device *dev)
549static inline int gadget_is_dualspeed(struct usb_gadget *g) 559static inline int gadget_is_dualspeed(struct usb_gadget *g)
550{ 560{
551#ifdef CONFIG_USB_GADGET_DUALSPEED 561#ifdef CONFIG_USB_GADGET_DUALSPEED
552 /* runtime test would check "g->is_dualspeed" ... that might be 562 /* runtime test would check "g->max_speed" ... that might be
553 * useful to work around hardware bugs, but is mostly pointless 563 * useful to work around hardware bugs, but is mostly pointless
554 */ 564 */
555 return 1; 565 return 1;
@@ -567,7 +577,7 @@ static inline int gadget_is_superspeed(struct usb_gadget *g)
567{ 577{
568#ifdef CONFIG_USB_GADGET_SUPERSPEED 578#ifdef CONFIG_USB_GADGET_SUPERSPEED
569 /* 579 /*
570 * runtime test would check "g->is_superspeed" ... that might be 580 * runtime test would check "g->max_speed" ... that might be
571 * useful to work around hardware bugs, but is mostly pointless 581 * useful to work around hardware bugs, but is mostly pointless
572 */ 582 */
573 return 1; 583 return 1;
@@ -760,7 +770,7 @@ static inline int usb_gadget_disconnect(struct usb_gadget *gadget)
760/** 770/**
761 * struct usb_gadget_driver - driver for usb 'slave' devices 771 * struct usb_gadget_driver - driver for usb 'slave' devices
762 * @function: String describing the gadget's function 772 * @function: String describing the gadget's function
763 * @speed: Highest speed the driver handles. 773 * @max_speed: Highest speed the driver handles.
764 * @setup: Invoked for ep0 control requests that aren't handled by 774 * @setup: Invoked for ep0 control requests that aren't handled by
765 * the hardware level driver. Most calls must be handled by 775 * the hardware level driver. Most calls must be handled by
766 * the gadget driver, including descriptor and configuration 776 * the gadget driver, including descriptor and configuration
@@ -824,7 +834,7 @@ static inline int usb_gadget_disconnect(struct usb_gadget *gadget)
824 */ 834 */
825struct usb_gadget_driver { 835struct usb_gadget_driver {
826 char *function; 836 char *function;
827 enum usb_device_speed speed; 837 enum usb_device_speed max_speed;
828 void (*unbind)(struct usb_gadget *); 838 void (*unbind)(struct usb_gadget *);
829 int (*setup)(struct usb_gadget *, 839 int (*setup)(struct usb_gadget *,
830 const struct usb_ctrlrequest *); 840 const struct usb_ctrlrequest *);
diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h
index 03354d557b79..b2f62f3a32af 100644
--- a/include/linux/usb/hcd.h
+++ b/include/linux/usb/hcd.h
@@ -99,7 +99,6 @@ struct usb_hcd {
99 */ 99 */
100 unsigned long flags; 100 unsigned long flags;
101#define HCD_FLAG_HW_ACCESSIBLE 0 /* at full power */ 101#define HCD_FLAG_HW_ACCESSIBLE 0 /* at full power */
102#define HCD_FLAG_SAW_IRQ 1
103#define HCD_FLAG_POLL_RH 2 /* poll for rh status? */ 102#define HCD_FLAG_POLL_RH 2 /* poll for rh status? */
104#define HCD_FLAG_POLL_PENDING 3 /* status has changed? */ 103#define HCD_FLAG_POLL_PENDING 3 /* status has changed? */
105#define HCD_FLAG_WAKEUP_PENDING 4 /* root hub is resuming? */ 104#define HCD_FLAG_WAKEUP_PENDING 4 /* root hub is resuming? */
@@ -110,7 +109,6 @@ struct usb_hcd {
110 * be slightly faster than test_bit(). 109 * be slightly faster than test_bit().
111 */ 110 */
112#define HCD_HW_ACCESSIBLE(hcd) ((hcd)->flags & (1U << HCD_FLAG_HW_ACCESSIBLE)) 111#define HCD_HW_ACCESSIBLE(hcd) ((hcd)->flags & (1U << HCD_FLAG_HW_ACCESSIBLE))
113#define HCD_SAW_IRQ(hcd) ((hcd)->flags & (1U << HCD_FLAG_SAW_IRQ))
114#define HCD_POLL_RH(hcd) ((hcd)->flags & (1U << HCD_FLAG_POLL_RH)) 112#define HCD_POLL_RH(hcd) ((hcd)->flags & (1U << HCD_FLAG_POLL_RH))
115#define HCD_POLL_PENDING(hcd) ((hcd)->flags & (1U << HCD_FLAG_POLL_PENDING)) 113#define HCD_POLL_PENDING(hcd) ((hcd)->flags & (1U << HCD_FLAG_POLL_PENDING))
116#define HCD_WAKEUP_PENDING(hcd) ((hcd)->flags & (1U << HCD_FLAG_WAKEUP_PENDING)) 114#define HCD_WAKEUP_PENDING(hcd) ((hcd)->flags & (1U << HCD_FLAG_WAKEUP_PENDING))
diff --git a/include/linux/usb/langwell_otg.h b/include/linux/usb/langwell_otg.h
deleted file mode 100644
index 51f17b16d312..000000000000
--- a/include/linux/usb/langwell_otg.h
+++ /dev/null
@@ -1,139 +0,0 @@
1/*
2 * Intel Langwell USB OTG transceiver driver
3 * Copyright (C) 2008 - 2010, Intel Corporation.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
17 *
18 */
19
20#ifndef __LANGWELL_OTG_H
21#define __LANGWELL_OTG_H
22
23#include <linux/usb/intel_mid_otg.h>
24
25#define CI_USBCMD 0x30
26# define USBCMD_RST BIT(1)
27# define USBCMD_RS BIT(0)
28#define CI_USBSTS 0x34
29# define USBSTS_SLI BIT(8)
30# define USBSTS_URI BIT(6)
31# define USBSTS_PCI BIT(2)
32#define CI_PORTSC1 0x74
33# define PORTSC_PP BIT(12)
34# define PORTSC_LS (BIT(11) | BIT(10))
35# define PORTSC_SUSP BIT(7)
36# define PORTSC_CCS BIT(0)
37#define CI_HOSTPC1 0xb4
38# define HOSTPC1_PHCD BIT(22)
39#define CI_OTGSC 0xf4
40# define OTGSC_DPIE BIT(30)
41# define OTGSC_1MSE BIT(29)
42# define OTGSC_BSEIE BIT(28)
43# define OTGSC_BSVIE BIT(27)
44# define OTGSC_ASVIE BIT(26)
45# define OTGSC_AVVIE BIT(25)
46# define OTGSC_IDIE BIT(24)
47# define OTGSC_DPIS BIT(22)
48# define OTGSC_1MSS BIT(21)
49# define OTGSC_BSEIS BIT(20)
50# define OTGSC_BSVIS BIT(19)
51# define OTGSC_ASVIS BIT(18)
52# define OTGSC_AVVIS BIT(17)
53# define OTGSC_IDIS BIT(16)
54# define OTGSC_DPS BIT(14)
55# define OTGSC_1MST BIT(13)
56# define OTGSC_BSE BIT(12)
57# define OTGSC_BSV BIT(11)
58# define OTGSC_ASV BIT(10)
59# define OTGSC_AVV BIT(9)
60# define OTGSC_ID BIT(8)
61# define OTGSC_HABA BIT(7)
62# define OTGSC_HADP BIT(6)
63# define OTGSC_IDPU BIT(5)
64# define OTGSC_DP BIT(4)
65# define OTGSC_OT BIT(3)
66# define OTGSC_HAAR BIT(2)
67# define OTGSC_VC BIT(1)
68# define OTGSC_VD BIT(0)
69# define OTGSC_INTEN_MASK (0x7f << 24)
70# define OTGSC_INT_MASK (0x5f << 24)
71# define OTGSC_INTSTS_MASK (0x7f << 16)
72#define CI_USBMODE 0xf8
73# define USBMODE_CM (BIT(1) | BIT(0))
74# define USBMODE_IDLE 0
75# define USBMODE_DEVICE 0x2
76# define USBMODE_HOST 0x3
77#define USBCFG_ADDR 0xff10801c
78#define USBCFG_LEN 4
79# define USBCFG_VBUSVAL BIT(14)
80# define USBCFG_AVALID BIT(13)
81# define USBCFG_BVALID BIT(12)
82# define USBCFG_SESEND BIT(11)
83
84#define INTR_DUMMY_MASK (USBSTS_SLI | USBSTS_URI | USBSTS_PCI)
85
86enum langwell_otg_timer_type {
87 TA_WAIT_VRISE_TMR,
88 TA_WAIT_BCON_TMR,
89 TA_AIDL_BDIS_TMR,
90 TB_ASE0_BRST_TMR,
91 TB_SE0_SRP_TMR,
92 TB_SRP_INIT_TMR,
93 TB_SRP_FAIL_TMR,
94 TB_BUS_SUSPEND_TMR
95};
96
97#define TA_WAIT_VRISE 100
98#define TA_WAIT_BCON 30000
99#define TA_AIDL_BDIS 15000
100#define TB_ASE0_BRST 5000
101#define TB_SE0_SRP 2
102#define TB_SRP_INIT 100
103#define TB_SRP_FAIL 5500
104#define TB_BUS_SUSPEND 500
105
106struct langwell_otg_timer {
107 unsigned long expires; /* Number of count increase to timeout */
108 unsigned long count; /* Tick counter */
109 void (*function)(unsigned long); /* Timeout function */
110 unsigned long data; /* Data passed to function */
111 struct list_head list;
112};
113
114struct langwell_otg {
115 struct intel_mid_otg_xceiv iotg;
116 struct device *dev;
117
118 void __iomem *usbcfg; /* SCCBUSB config Reg */
119
120 unsigned region;
121 unsigned cfg_region;
122
123 struct work_struct work;
124 struct workqueue_struct *qwork;
125 struct timer_list hsm_timer;
126
127 spinlock_t lock;
128 spinlock_t wq_lock;
129
130 struct notifier_block iotg_notifier;
131};
132
133static inline
134struct langwell_otg *mid_xceiv_to_lnw(struct intel_mid_otg_xceiv *iotg)
135{
136 return container_of(iotg, struct langwell_otg, iotg);
137}
138
139#endif /* __LANGWELL_OTG_H__ */
diff --git a/include/linux/usb/renesas_usbhs.h b/include/linux/usb/renesas_usbhs.h
index e5a40c318548..0d3f98879256 100644
--- a/include/linux/usb/renesas_usbhs.h
+++ b/include/linux/usb/renesas_usbhs.h
@@ -67,6 +67,14 @@ struct renesas_usbhs_platform_callback {
67 /* 67 /*
68 * option: 68 * option:
69 * 69 *
70 * for board specific clock control
71 */
72 void (*power_ctrl)(struct platform_device *pdev,
73 void __iomem *base, int enable);
74
75 /*
76 * option:
77 *
70 * Phy reset for platform 78 * Phy reset for platform
71 */ 79 */
72 void (*phy_reset)(struct platform_device *pdev); 80 void (*phy_reset)(struct platform_device *pdev);
@@ -118,7 +126,7 @@ struct renesas_usbhs_driver_param {
118 * 126 *
119 * delay time from notify_hotplug callback 127 * delay time from notify_hotplug callback
120 */ 128 */
121 int detection_delay; 129 int detection_delay; /* msec */
122 130
123 /* 131 /*
124 * option: 132 * option:
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h
index b29f70b2ecae..4267a9c717ba 100644
--- a/include/linux/usb/serial.h
+++ b/include/linux/usb/serial.h
@@ -58,11 +58,13 @@ enum port_dev_state {
58 * @read_urb: pointer to the bulk in struct urb for this port. 58 * @read_urb: pointer to the bulk in struct urb for this port.
59 * @bulk_in_endpointAddress: endpoint address for the bulk in pipe for this 59 * @bulk_in_endpointAddress: endpoint address for the bulk in pipe for this
60 * port. 60 * port.
61 * @bulk_in_buffers: pointers to the bulk in buffers for this port
62 * @read_urbs: pointers to the bulk in urbs for this port
63 * @read_urbs_free: status bitmap the for bulk in urbs
61 * @bulk_out_buffer: pointer to the bulk out buffer for this port. 64 * @bulk_out_buffer: pointer to the bulk out buffer for this port.
62 * @bulk_out_size: the size of the bulk_out_buffer, in bytes. 65 * @bulk_out_size: the size of the bulk_out_buffer, in bytes.
63 * @write_urb: pointer to the bulk out struct urb for this port. 66 * @write_urb: pointer to the bulk out struct urb for this port.
64 * @write_fifo: kfifo used to buffer outgoing data 67 * @write_fifo: kfifo used to buffer outgoing data
65 * @write_urb_busy: port`s writing status
66 * @bulk_out_buffers: pointers to the bulk out buffers for this port 68 * @bulk_out_buffers: pointers to the bulk out buffers for this port
67 * @write_urbs: pointers to the bulk out urbs for this port 69 * @write_urbs: pointers to the bulk out urbs for this port
68 * @write_urbs_free: status bitmap the for bulk out urbs 70 * @write_urbs_free: status bitmap the for bulk out urbs
@@ -99,11 +101,14 @@ struct usb_serial_port {
99 struct urb *read_urb; 101 struct urb *read_urb;
100 __u8 bulk_in_endpointAddress; 102 __u8 bulk_in_endpointAddress;
101 103
104 unsigned char *bulk_in_buffers[2];
105 struct urb *read_urbs[2];
106 unsigned long read_urbs_free;
107
102 unsigned char *bulk_out_buffer; 108 unsigned char *bulk_out_buffer;
103 int bulk_out_size; 109 int bulk_out_size;
104 struct urb *write_urb; 110 struct urb *write_urb;
105 struct kfifo write_fifo; 111 struct kfifo write_fifo;
106 int write_urb_busy;
107 112
108 unsigned char *bulk_out_buffers[2]; 113 unsigned char *bulk_out_buffers[2];
109 struct urb *write_urbs[2]; 114 struct urb *write_urbs[2];
@@ -340,7 +345,7 @@ extern void usb_serial_generic_disconnect(struct usb_serial *serial);
340extern void usb_serial_generic_release(struct usb_serial *serial); 345extern void usb_serial_generic_release(struct usb_serial *serial);
341extern int usb_serial_generic_register(int debug); 346extern int usb_serial_generic_register(int debug);
342extern void usb_serial_generic_deregister(void); 347extern void usb_serial_generic_deregister(void);
343extern int usb_serial_generic_submit_read_urb(struct usb_serial_port *port, 348extern int usb_serial_generic_submit_read_urbs(struct usb_serial_port *port,
344 gfp_t mem_flags); 349 gfp_t mem_flags);
345extern void usb_serial_generic_process_read_urb(struct urb *urb); 350extern void usb_serial_generic_process_read_urb(struct urb *urb);
346extern int usb_serial_generic_prepare_write_buffer(struct usb_serial_port *port, 351extern int usb_serial_generic_prepare_write_buffer(struct usb_serial_port *port,
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index 4b752d5ee80e..5e11f8a1f867 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -343,6 +343,8 @@ struct v4l2_pix_format {
343#define V4L2_PIX_FMT_NV21 v4l2_fourcc('N', 'V', '2', '1') /* 12 Y/CrCb 4:2:0 */ 343#define V4L2_PIX_FMT_NV21 v4l2_fourcc('N', 'V', '2', '1') /* 12 Y/CrCb 4:2:0 */
344#define V4L2_PIX_FMT_NV16 v4l2_fourcc('N', 'V', '1', '6') /* 16 Y/CbCr 4:2:2 */ 344#define V4L2_PIX_FMT_NV16 v4l2_fourcc('N', 'V', '1', '6') /* 16 Y/CbCr 4:2:2 */
345#define V4L2_PIX_FMT_NV61 v4l2_fourcc('N', 'V', '6', '1') /* 16 Y/CrCb 4:2:2 */ 345#define V4L2_PIX_FMT_NV61 v4l2_fourcc('N', 'V', '6', '1') /* 16 Y/CrCb 4:2:2 */
346#define V4L2_PIX_FMT_NV24 v4l2_fourcc('N', 'V', '2', '4') /* 24 Y/CbCr 4:4:4 */
347#define V4L2_PIX_FMT_NV42 v4l2_fourcc('N', 'V', '4', '2') /* 24 Y/CrCb 4:4:4 */
346 348
347/* two non contiguous planes - one Y, one Cr + Cb interleaved */ 349/* two non contiguous planes - one Y, one Cr + Cb interleaved */
348#define V4L2_PIX_FMT_NV12M v4l2_fourcc('N', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 */ 350#define V4L2_PIX_FMT_NV12M v4l2_fourcc('N', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 */
@@ -401,6 +403,7 @@ struct v4l2_pix_format {
401#define V4L2_PIX_FMT_SPCA561 v4l2_fourcc('S', '5', '6', '1') /* compressed GBRG bayer */ 403#define V4L2_PIX_FMT_SPCA561 v4l2_fourcc('S', '5', '6', '1') /* compressed GBRG bayer */
402#define V4L2_PIX_FMT_PAC207 v4l2_fourcc('P', '2', '0', '7') /* compressed BGGR bayer */ 404#define V4L2_PIX_FMT_PAC207 v4l2_fourcc('P', '2', '0', '7') /* compressed BGGR bayer */
403#define V4L2_PIX_FMT_MR97310A v4l2_fourcc('M', '3', '1', '0') /* compressed BGGR bayer */ 405#define V4L2_PIX_FMT_MR97310A v4l2_fourcc('M', '3', '1', '0') /* compressed BGGR bayer */
406#define V4L2_PIX_FMT_JL2005BCD v4l2_fourcc('J', 'L', '2', '0') /* compressed RGGB bayer */
404#define V4L2_PIX_FMT_SN9C2028 v4l2_fourcc('S', 'O', 'N', 'X') /* compressed GBRG bayer */ 407#define V4L2_PIX_FMT_SN9C2028 v4l2_fourcc('S', 'O', 'N', 'X') /* compressed GBRG bayer */
405#define V4L2_PIX_FMT_SQ905C v4l2_fourcc('9', '0', '5', 'C') /* compressed RGGB bayer */ 408#define V4L2_PIX_FMT_SQ905C v4l2_fourcc('9', '0', '5', 'C') /* compressed RGGB bayer */
406#define V4L2_PIX_FMT_PJPG v4l2_fourcc('P', 'J', 'P', 'G') /* Pixart 73xx JPEG */ 409#define V4L2_PIX_FMT_PJPG v4l2_fourcc('P', 'J', 'P', 'G') /* Pixart 73xx JPEG */
@@ -742,6 +745,48 @@ struct v4l2_crop {
742 struct v4l2_rect c; 745 struct v4l2_rect c;
743}; 746};
744 747
748/* Hints for adjustments of selection rectangle */
749#define V4L2_SEL_FLAG_GE 0x00000001
750#define V4L2_SEL_FLAG_LE 0x00000002
751
752/* Selection targets */
753
754/* current cropping area */
755#define V4L2_SEL_TGT_CROP_ACTIVE 0
756/* default cropping area */
757#define V4L2_SEL_TGT_CROP_DEFAULT 1
758/* cropping bounds */
759#define V4L2_SEL_TGT_CROP_BOUNDS 2
760/* current composing area */
761#define V4L2_SEL_TGT_COMPOSE_ACTIVE 256
762/* default composing area */
763#define V4L2_SEL_TGT_COMPOSE_DEFAULT 257
764/* composing bounds */
765#define V4L2_SEL_TGT_COMPOSE_BOUNDS 258
766/* current composing area plus all padding pixels */
767#define V4L2_SEL_TGT_COMPOSE_PADDED 259
768
769/**
770 * struct v4l2_selection - selection info
771 * @type: buffer type (do not use *_MPLANE types)
772 * @target: selection target, used to choose one of possible rectangles
773 * @flags: constraints flags
774 * @r: coordinates of selection window
775 * @reserved: for future use, rounds structure size to 64 bytes, set to zero
776 *
777 * Hardware may use multiple helper window to process a video stream.
778 * The structure is used to exchange this selection areas between
779 * an application and a driver.
780 */
781struct v4l2_selection {
782 __u32 type;
783 __u32 target;
784 __u32 flags;
785 struct v4l2_rect r;
786 __u32 reserved[9];
787};
788
789
745/* 790/*
746 * A N A L O G V I D E O S T A N D A R D 791 * A N A L O G V I D E O S T A N D A R D
747 */ 792 */
@@ -1131,6 +1176,7 @@ struct v4l2_querymenu {
1131#define V4L2_CTRL_FLAG_NEXT_CTRL 0x80000000 1176#define V4L2_CTRL_FLAG_NEXT_CTRL 0x80000000
1132 1177
1133/* User-class control IDs defined by V4L2 */ 1178/* User-class control IDs defined by V4L2 */
1179#define V4L2_CID_MAX_CTRLS 1024
1134#define V4L2_CID_BASE (V4L2_CTRL_CLASS_USER | 0x900) 1180#define V4L2_CID_BASE (V4L2_CTRL_CLASS_USER | 0x900)
1135#define V4L2_CID_USER_BASE V4L2_CID_BASE 1181#define V4L2_CID_USER_BASE V4L2_CID_BASE
1136/* IDs reserved for driver specific controls */ 1182/* IDs reserved for driver specific controls */
@@ -1204,10 +1250,10 @@ enum v4l2_colorfx {
1204#define V4L2_CID_MIN_BUFFERS_FOR_CAPTURE (V4L2_CID_BASE+39) 1250#define V4L2_CID_MIN_BUFFERS_FOR_CAPTURE (V4L2_CID_BASE+39)
1205#define V4L2_CID_MIN_BUFFERS_FOR_OUTPUT (V4L2_CID_BASE+40) 1251#define V4L2_CID_MIN_BUFFERS_FOR_OUTPUT (V4L2_CID_BASE+40)
1206 1252
1207/* last CID + 1 */ 1253#define V4L2_CID_ALPHA_COMPONENT (V4L2_CID_BASE+41)
1208#define V4L2_CID_LASTP1 (V4L2_CID_BASE+41)
1209 1254
1210/* Minimum number of buffer neede by the device */ 1255/* last CID + 1 */
1256#define V4L2_CID_LASTP1 (V4L2_CID_BASE+42)
1211 1257
1212/* MPEG-class control IDs defined by V4L2 */ 1258/* MPEG-class control IDs defined by V4L2 */
1213#define V4L2_CID_MPEG_BASE (V4L2_CTRL_CLASS_MPEG | 0x900) 1259#define V4L2_CID_MPEG_BASE (V4L2_CTRL_CLASS_MPEG | 0x900)
@@ -1682,6 +1728,8 @@ enum v4l2_flash_strobe_source {
1682#define V4L2_FLASH_FAULT_TIMEOUT (1 << 1) 1728#define V4L2_FLASH_FAULT_TIMEOUT (1 << 1)
1683#define V4L2_FLASH_FAULT_OVER_TEMPERATURE (1 << 2) 1729#define V4L2_FLASH_FAULT_OVER_TEMPERATURE (1 << 2)
1684#define V4L2_FLASH_FAULT_SHORT_CIRCUIT (1 << 3) 1730#define V4L2_FLASH_FAULT_SHORT_CIRCUIT (1 << 3)
1731#define V4L2_FLASH_FAULT_OVER_CURRENT (1 << 4)
1732#define V4L2_FLASH_FAULT_INDICATOR (1 << 5)
1685 1733
1686#define V4L2_CID_FLASH_CHARGE (V4L2_CID_FLASH_CLASS_BASE + 11) 1734#define V4L2_CID_FLASH_CHARGE (V4L2_CID_FLASH_CLASS_BASE + 11)
1687#define V4L2_CID_FLASH_READY (V4L2_CID_FLASH_CLASS_BASE + 12) 1735#define V4L2_CID_FLASH_READY (V4L2_CID_FLASH_CLASS_BASE + 12)
@@ -2255,6 +2303,10 @@ struct v4l2_create_buffers {
2255#define VIDIOC_CREATE_BUFS _IOWR('V', 92, struct v4l2_create_buffers) 2303#define VIDIOC_CREATE_BUFS _IOWR('V', 92, struct v4l2_create_buffers)
2256#define VIDIOC_PREPARE_BUF _IOWR('V', 93, struct v4l2_buffer) 2304#define VIDIOC_PREPARE_BUF _IOWR('V', 93, struct v4l2_buffer)
2257 2305
2306/* Experimental selection API */
2307#define VIDIOC_G_SELECTION _IOWR('V', 94, struct v4l2_selection)
2308#define VIDIOC_S_SELECTION _IOWR('V', 95, struct v4l2_selection)
2309
2258/* Reminder: when adding new ioctls please add support for them to 2310/* Reminder: when adding new ioctls please add support for them to
2259 drivers/media/video/v4l2-compat-ioctl32.c as well! */ 2311 drivers/media/video/v4l2-compat-ioctl32.c as well! */
2260 2312
diff --git a/include/linux/virtio.h b/include/linux/virtio.h
index 4c069d8bd740..d0018d27c281 100644
--- a/include/linux/virtio.h
+++ b/include/linux/virtio.h
@@ -25,70 +25,18 @@ struct virtqueue {
25 void *priv; 25 void *priv;
26}; 26};
27 27
28/** 28int virtqueue_add_buf(struct virtqueue *vq,
29 * operations for virtqueue 29 struct scatterlist sg[],
30 * virtqueue_add_buf: expose buffer to other end 30 unsigned int out_num,
31 * vq: the struct virtqueue we're talking about. 31 unsigned int in_num,
32 * sg: the description of the buffer(s). 32 void *data,
33 * out_num: the number of sg readable by other side 33 gfp_t gfp);
34 * in_num: the number of sg which are writable (after readable ones)
35 * data: the token identifying the buffer.
36 * gfp: how to do memory allocations (if necessary).
37 * Returns remaining capacity of queue (sg segments) or a negative error.
38 * virtqueue_kick: update after add_buf
39 * vq: the struct virtqueue
40 * After one or more add_buf calls, invoke this to kick the other side.
41 * virtqueue_get_buf: get the next used buffer
42 * vq: the struct virtqueue we're talking about.
43 * len: the length written into the buffer
44 * Returns NULL or the "data" token handed to add_buf.
45 * virtqueue_disable_cb: disable callbacks
46 * vq: the struct virtqueue we're talking about.
47 * Note that this is not necessarily synchronous, hence unreliable and only
48 * useful as an optimization.
49 * virtqueue_enable_cb: restart callbacks after disable_cb.
50 * vq: the struct virtqueue we're talking about.
51 * This re-enables callbacks; it returns "false" if there are pending
52 * buffers in the queue, to detect a possible race between the driver
53 * checking for more work, and enabling callbacks.
54 * virtqueue_enable_cb_delayed: restart callbacks after disable_cb.
55 * vq: the struct virtqueue we're talking about.
56 * This re-enables callbacks but hints to the other side to delay
57 * interrupts until most of the available buffers have been processed;
58 * it returns "false" if there are many pending buffers in the queue,
59 * to detect a possible race between the driver checking for more work,
60 * and enabling callbacks.
61 * virtqueue_detach_unused_buf: detach first unused buffer
62 * vq: the struct virtqueue we're talking about.
63 * Returns NULL or the "data" token handed to add_buf
64 * virtqueue_get_vring_size: return the size of the virtqueue's vring
65 * vq: the struct virtqueue containing the vring of interest.
66 * Returns the size of the vring.
67 *
68 * Locking rules are straightforward: the driver is responsible for
69 * locking. No two operations may be invoked simultaneously, with the exception
70 * of virtqueue_disable_cb.
71 *
72 * All operations can be called in any context.
73 */
74 34
75int virtqueue_add_buf_gfp(struct virtqueue *vq, 35void virtqueue_kick(struct virtqueue *vq);
76 struct scatterlist sg[],
77 unsigned int out_num,
78 unsigned int in_num,
79 void *data,
80 gfp_t gfp);
81 36
82static inline int virtqueue_add_buf(struct virtqueue *vq, 37bool virtqueue_kick_prepare(struct virtqueue *vq);
83 struct scatterlist sg[],
84 unsigned int out_num,
85 unsigned int in_num,
86 void *data)
87{
88 return virtqueue_add_buf_gfp(vq, sg, out_num, in_num, data, GFP_ATOMIC);
89}
90 38
91void virtqueue_kick(struct virtqueue *vq); 39void virtqueue_notify(struct virtqueue *vq);
92 40
93void *virtqueue_get_buf(struct virtqueue *vq, unsigned int *len); 41void *virtqueue_get_buf(struct virtqueue *vq, unsigned int *len);
94 42
@@ -146,6 +94,11 @@ struct virtio_driver {
146 int (*probe)(struct virtio_device *dev); 94 int (*probe)(struct virtio_device *dev);
147 void (*remove)(struct virtio_device *dev); 95 void (*remove)(struct virtio_device *dev);
148 void (*config_changed)(struct virtio_device *dev); 96 void (*config_changed)(struct virtio_device *dev);
97#ifdef CONFIG_PM
98 int (*freeze)(struct virtio_device *dev);
99 int (*thaw)(struct virtio_device *dev);
100 int (*restore)(struct virtio_device *dev);
101#endif
149}; 102};
150 103
151int register_virtio_driver(struct virtio_driver *drv); 104int register_virtio_driver(struct virtio_driver *drv);
diff --git a/include/linux/virtio_ring.h b/include/linux/virtio_ring.h
index 36be0f6e18a9..e338730c2660 100644
--- a/include/linux/virtio_ring.h
+++ b/include/linux/virtio_ring.h
@@ -168,6 +168,7 @@ struct virtqueue;
168struct virtqueue *vring_new_virtqueue(unsigned int num, 168struct virtqueue *vring_new_virtqueue(unsigned int num,
169 unsigned int vring_align, 169 unsigned int vring_align,
170 struct virtio_device *vdev, 170 struct virtio_device *vdev,
171 bool weak_barriers,
171 void *pages, 172 void *pages,
172 void (*notify)(struct virtqueue *vq), 173 void (*notify)(struct virtqueue *vq),
173 void (*callback)(struct virtqueue *vq), 174 void (*callback)(struct virtqueue *vq),
diff --git a/include/linux/watchdog.h b/include/linux/watchdog.h
index 111843f88b2a..43ba5b3ce2a3 100644
--- a/include/linux/watchdog.h
+++ b/include/linux/watchdog.h
@@ -53,11 +53,7 @@ struct watchdog_info {
53 53
54#ifdef __KERNEL__ 54#ifdef __KERNEL__
55 55
56#ifdef CONFIG_WATCHDOG_NOWAYOUT 56#include <linux/bitops.h>
57#define WATCHDOG_NOWAYOUT 1
58#else
59#define WATCHDOG_NOWAYOUT 0
60#endif
61 57
62struct watchdog_ops; 58struct watchdog_ops;
63struct watchdog_device; 59struct watchdog_device;
@@ -122,6 +118,21 @@ struct watchdog_device {
122#define WDOG_NO_WAY_OUT 3 /* Is 'nowayout' feature set ? */ 118#define WDOG_NO_WAY_OUT 3 /* Is 'nowayout' feature set ? */
123}; 119};
124 120
121#ifdef CONFIG_WATCHDOG_NOWAYOUT
122#define WATCHDOG_NOWAYOUT 1
123#define WATCHDOG_NOWAYOUT_INIT_STATUS (1 << WDOG_NO_WAY_OUT)
124#else
125#define WATCHDOG_NOWAYOUT 0
126#define WATCHDOG_NOWAYOUT_INIT_STATUS 0
127#endif
128
129/* Use the following function to set the nowayout feature */
130static inline void watchdog_set_nowayout(struct watchdog_device *wdd, int nowayout)
131{
132 if (nowayout)
133 set_bit(WDOG_NO_WAY_OUT, &wdd->status);
134}
135
125/* Use the following functions to manipulate watchdog driver specific data */ 136/* Use the following functions to manipulate watchdog driver specific data */
126static inline void watchdog_set_drvdata(struct watchdog_device *wdd, void *data) 137static inline void watchdog_set_drvdata(struct watchdog_device *wdd, void *data)
127{ 138{
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
index 0d556deb497b..eb8b9f15f2e0 100644
--- a/include/linux/workqueue.h
+++ b/include/linux/workqueue.h
@@ -297,32 +297,50 @@ extern struct workqueue_struct *system_unbound_wq;
297extern struct workqueue_struct *system_freezable_wq; 297extern struct workqueue_struct *system_freezable_wq;
298 298
299extern struct workqueue_struct * 299extern struct workqueue_struct *
300__alloc_workqueue_key(const char *name, unsigned int flags, int max_active, 300__alloc_workqueue_key(const char *fmt, unsigned int flags, int max_active,
301 struct lock_class_key *key, const char *lock_name); 301 struct lock_class_key *key, const char *lock_name, ...) __printf(1, 6);
302 302
303/**
304 * alloc_workqueue - allocate a workqueue
305 * @fmt: printf format for the name of the workqueue
306 * @flags: WQ_* flags
307 * @max_active: max in-flight work items, 0 for default
308 * @args: args for @fmt
309 *
310 * Allocate a workqueue with the specified parameters. For detailed
311 * information on WQ_* flags, please refer to Documentation/workqueue.txt.
312 *
313 * The __lock_name macro dance is to guarantee that single lock_class_key
314 * doesn't end up with different namesm, which isn't allowed by lockdep.
315 *
316 * RETURNS:
317 * Pointer to the allocated workqueue on success, %NULL on failure.
318 */
303#ifdef CONFIG_LOCKDEP 319#ifdef CONFIG_LOCKDEP
304#define alloc_workqueue(name, flags, max_active) \ 320#define alloc_workqueue(fmt, flags, max_active, args...) \
305({ \ 321({ \
306 static struct lock_class_key __key; \ 322 static struct lock_class_key __key; \
307 const char *__lock_name; \ 323 const char *__lock_name; \
308 \ 324 \
309 if (__builtin_constant_p(name)) \ 325 if (__builtin_constant_p(fmt)) \
310 __lock_name = (name); \ 326 __lock_name = (fmt); \
311 else \ 327 else \
312 __lock_name = #name; \ 328 __lock_name = #fmt; \
313 \ 329 \
314 __alloc_workqueue_key((name), (flags), (max_active), \ 330 __alloc_workqueue_key((fmt), (flags), (max_active), \
315 &__key, __lock_name); \ 331 &__key, __lock_name, ##args); \
316}) 332})
317#else 333#else
318#define alloc_workqueue(name, flags, max_active) \ 334#define alloc_workqueue(fmt, flags, max_active, args...) \
319 __alloc_workqueue_key((name), (flags), (max_active), NULL, NULL) 335 __alloc_workqueue_key((fmt), (flags), (max_active), \
336 NULL, NULL, ##args)
320#endif 337#endif
321 338
322/** 339/**
323 * alloc_ordered_workqueue - allocate an ordered workqueue 340 * alloc_ordered_workqueue - allocate an ordered workqueue
324 * @name: name of the workqueue 341 * @fmt: printf format for the name of the workqueue
325 * @flags: WQ_* flags (only WQ_FREEZABLE and WQ_MEM_RECLAIM are meaningful) 342 * @flags: WQ_* flags (only WQ_FREEZABLE and WQ_MEM_RECLAIM are meaningful)
343 * @args: args for @fmt
326 * 344 *
327 * Allocate an ordered workqueue. An ordered workqueue executes at 345 * Allocate an ordered workqueue. An ordered workqueue executes at
328 * most one work item at any given time in the queued order. They are 346 * most one work item at any given time in the queued order. They are
@@ -331,11 +349,8 @@ __alloc_workqueue_key(const char *name, unsigned int flags, int max_active,
331 * RETURNS: 349 * RETURNS:
332 * Pointer to the allocated workqueue on success, %NULL on failure. 350 * Pointer to the allocated workqueue on success, %NULL on failure.
333 */ 351 */
334static inline struct workqueue_struct * 352#define alloc_ordered_workqueue(fmt, flags, args...) \
335alloc_ordered_workqueue(const char *name, unsigned int flags) 353 alloc_workqueue(fmt, WQ_UNBOUND | (flags), 1, ##args)
336{
337 return alloc_workqueue(name, WQ_UNBOUND | flags, 1);
338}
339 354
340#define create_workqueue(name) \ 355#define create_workqueue(name) \
341 alloc_workqueue((name), WQ_MEM_RECLAIM, 1) 356 alloc_workqueue((name), WQ_MEM_RECLAIM, 1)
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index a378c295851f..995b8bf630ac 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -7,6 +7,8 @@
7#include <linux/sched.h> 7#include <linux/sched.h>
8#include <linux/fs.h> 8#include <linux/fs.h>
9 9
10DECLARE_PER_CPU(int, dirty_throttle_leaks);
11
10/* 12/*
11 * The 1/4 region under the global dirty thresh is for smooth dirty throttling: 13 * The 1/4 region under the global dirty thresh is for smooth dirty throttling:
12 * 14 *
@@ -23,11 +25,6 @@
23#define DIRTY_SCOPE 8 25#define DIRTY_SCOPE 8
24#define DIRTY_FULL_SCOPE (DIRTY_SCOPE / 2) 26#define DIRTY_FULL_SCOPE (DIRTY_SCOPE / 2)
25 27
26/*
27 * 4MB minimal write chunk size
28 */
29#define MIN_WRITEBACK_PAGES (4096UL >> (PAGE_CACHE_SHIFT - 10))
30
31struct backing_dev_info; 28struct backing_dev_info;
32 29
33/* 30/*
@@ -124,6 +121,7 @@ void laptop_mode_timer_fn(unsigned long data);
124static inline void laptop_sync_completion(void) { } 121static inline void laptop_sync_completion(void) { }
125#endif 122#endif
126void throttle_vm_writeout(gfp_t gfp_mask); 123void throttle_vm_writeout(gfp_t gfp_mask);
124bool zone_dirty_ok(struct zone *zone);
127 125
128extern unsigned long global_dirty_limit; 126extern unsigned long global_dirty_limit;
129 127
@@ -138,8 +136,6 @@ extern int vm_highmem_is_dirtyable;
138extern int block_dump; 136extern int block_dump;
139extern int laptop_mode; 137extern int laptop_mode;
140 138
141extern unsigned long determine_dirtyable_memory(void);
142
143extern int dirty_background_ratio_handler(struct ctl_table *table, int write, 139extern int dirty_background_ratio_handler(struct ctl_table *table, int write,
144 void __user *buffer, size_t *lenp, 140 void __user *buffer, size_t *lenp,
145 loff_t *ppos); 141 loff_t *ppos);
@@ -195,6 +191,8 @@ void writeback_set_ratelimit(void);
195void tag_pages_for_writeback(struct address_space *mapping, 191void tag_pages_for_writeback(struct address_space *mapping,
196 pgoff_t start, pgoff_t end); 192 pgoff_t start, pgoff_t end);
197 193
194void account_page_redirty(struct page *page);
195
198/* pdflush.c */ 196/* pdflush.c */
199extern int nr_pdflush_threads; /* Global so it can be exported to sysctl 197extern int nr_pdflush_threads; /* Global so it can be exported to sysctl
200 read-only. */ 198 read-only. */
diff --git a/include/linux/zorro_ids.h b/include/linux/zorro_ids.h
index 7e749088910d..74bc53bcfdcf 100644
--- a/include/linux/zorro_ids.h
+++ b/include/linux/zorro_ids.h
@@ -360,8 +360,8 @@
360#define ZORRO_PROD_VILLAGE_TRONIC_PICASSO_II_II_PLUS_RAM ZORRO_ID(VILLAGE_TRONIC, 0x0B, 0) 360#define ZORRO_PROD_VILLAGE_TRONIC_PICASSO_II_II_PLUS_RAM ZORRO_ID(VILLAGE_TRONIC, 0x0B, 0)
361#define ZORRO_PROD_VILLAGE_TRONIC_PICASSO_II_II_PLUS_REG ZORRO_ID(VILLAGE_TRONIC, 0x0C, 0) 361#define ZORRO_PROD_VILLAGE_TRONIC_PICASSO_II_II_PLUS_REG ZORRO_ID(VILLAGE_TRONIC, 0x0C, 0)
362#define ZORRO_PROD_VILLAGE_TRONIC_PICASSO_II_II_PLUS_SEGMENTED_MODE ZORRO_ID(VILLAGE_TRONIC, 0x0D, 0) 362#define ZORRO_PROD_VILLAGE_TRONIC_PICASSO_II_II_PLUS_SEGMENTED_MODE ZORRO_ID(VILLAGE_TRONIC, 0x0D, 0)
363#define ZORRO_PROD_VILLAGE_TRONIC_PICASSO_IV_Z2_MEM1 ZORRO_ID(VILLAGE_TRONIC, 0x15, 0) 363#define ZORRO_PROD_VILLAGE_TRONIC_PICASSO_IV_Z2_RAM1 ZORRO_ID(VILLAGE_TRONIC, 0x15, 0)
364#define ZORRO_PROD_VILLAGE_TRONIC_PICASSO_IV_Z2_MEM2 ZORRO_ID(VILLAGE_TRONIC, 0x16, 0) 364#define ZORRO_PROD_VILLAGE_TRONIC_PICASSO_IV_Z2_RAM2 ZORRO_ID(VILLAGE_TRONIC, 0x16, 0)
365#define ZORRO_PROD_VILLAGE_TRONIC_PICASSO_IV_Z2_REG ZORRO_ID(VILLAGE_TRONIC, 0x17, 0) 365#define ZORRO_PROD_VILLAGE_TRONIC_PICASSO_IV_Z2_REG ZORRO_ID(VILLAGE_TRONIC, 0x17, 0)
366#define ZORRO_PROD_VILLAGE_TRONIC_PICASSO_IV_Z3 ZORRO_ID(VILLAGE_TRONIC, 0x18, 0) 366#define ZORRO_PROD_VILLAGE_TRONIC_PICASSO_IV_Z3 ZORRO_ID(VILLAGE_TRONIC, 0x18, 0)
367#define ZORRO_PROD_VILLAGE_TRONIC_ARIADNE ZORRO_ID(VILLAGE_TRONIC, 0xC9, 0) 367#define ZORRO_PROD_VILLAGE_TRONIC_ARIADNE ZORRO_ID(VILLAGE_TRONIC, 0xC9, 0)
diff --git a/include/media/as3645a.h b/include/media/as3645a.h
new file mode 100644
index 000000000000..5075496d2c9e
--- /dev/null
+++ b/include/media/as3645a.h
@@ -0,0 +1,71 @@
1/*
2 * include/media/as3645a.h
3 *
4 * Copyright (C) 2008-2011 Nokia Corporation
5 *
6 * Contact: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * version 2 as published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA
21 *
22 */
23
24#ifndef __AS3645A_H__
25#define __AS3645A_H__
26
27#include <media/v4l2-subdev.h>
28
29#define AS3645A_NAME "as3645a"
30#define AS3645A_I2C_ADDR (0x60 >> 1) /* W:0x60, R:0x61 */
31
32#define AS3645A_FLASH_TIMEOUT_MIN 100000 /* us */
33#define AS3645A_FLASH_TIMEOUT_MAX 850000
34#define AS3645A_FLASH_TIMEOUT_STEP 50000
35
36#define AS3645A_FLASH_INTENSITY_MIN 200 /* mA */
37#define AS3645A_FLASH_INTENSITY_MAX_1LED 500
38#define AS3645A_FLASH_INTENSITY_MAX_2LEDS 400
39#define AS3645A_FLASH_INTENSITY_STEP 20
40
41#define AS3645A_TORCH_INTENSITY_MIN 20 /* mA */
42#define AS3645A_TORCH_INTENSITY_MAX 160
43#define AS3645A_TORCH_INTENSITY_STEP 20
44
45#define AS3645A_INDICATOR_INTENSITY_MIN 0 /* uA */
46#define AS3645A_INDICATOR_INTENSITY_MAX 10000
47#define AS3645A_INDICATOR_INTENSITY_STEP 2500
48
49/*
50 * as3645a_platform_data - Flash controller platform data
51 * @set_power: Set power callback
52 * @vref: VREF offset (0=0V, 1=+0.3V, 2=-0.3V, 3=+0.6V)
53 * @peak: Inductor peak current limit (0=1.25A, 1=1.5A, 2=1.75A, 3=2.0A)
54 * @ext_strobe: True if external flash strobe can be used
55 * @flash_max_current: Max flash current (mA, <= AS3645A_FLASH_INTENSITY_MAX)
56 * @torch_max_current: Max torch current (mA, >= AS3645A_TORCH_INTENSITY_MAX)
57 * @timeout_max: Max flash timeout (us, <= AS3645A_FLASH_TIMEOUT_MAX)
58 */
59struct as3645a_platform_data {
60 int (*set_power)(struct v4l2_subdev *subdev, int on);
61 unsigned int vref;
62 unsigned int peak;
63 bool ext_strobe;
64
65 /* Flash and torch currents and timeout limits */
66 unsigned int flash_max_current;
67 unsigned int torch_max_current;
68 unsigned int timeout_max;
69};
70
71#endif /* __AS3645A_H__ */
diff --git a/include/media/atmel-isi.h b/include/media/atmel-isi.h
index 26cece595121..656823075709 100644
--- a/include/media/atmel-isi.h
+++ b/include/media/atmel-isi.h
@@ -110,10 +110,12 @@ struct isi_platform_data {
110 u8 hsync_act_low; 110 u8 hsync_act_low;
111 u8 vsync_act_low; 111 u8 vsync_act_low;
112 u8 pclk_act_falling; 112 u8 pclk_act_falling;
113 u8 isi_full_mode; 113 u8 full_mode;
114 u32 data_width_flags; 114 u32 data_width_flags;
115 /* Using for ISI_CFG1 */ 115 /* Using for ISI_CFG1 */
116 u32 frate; 116 u32 frate;
117 /* Using for ISI_MCK */
118 u32 mck_hz;
117}; 119};
118 120
119#endif /* __ATMEL_ISI_H__ */ 121#endif /* __ATMEL_ISI_H__ */
diff --git a/include/media/cx25840.h b/include/media/cx25840.h
index 46d1a141208e..783c5bdd63eb 100644
--- a/include/media/cx25840.h
+++ b/include/media/cx25840.h
@@ -85,6 +85,7 @@ enum cx25840_video_input {
85 CX25840_NONE1_CH3 = 0x800000c0, 85 CX25840_NONE1_CH3 = 0x800000c0,
86 CX25840_SVIDEO_ON = 0x80000100, 86 CX25840_SVIDEO_ON = 0x80000100,
87 CX25840_COMPONENT_ON = 0x80000200, 87 CX25840_COMPONENT_ON = 0x80000200,
88 CX25840_DIF_ON = 0x80000400,
88}; 89};
89 90
90enum cx25840_audio_input { 91enum cx25840_audio_input {
diff --git a/include/media/davinci/vpbe.h b/include/media/davinci/vpbe.h
index 8b11fb037980..8bc1b3c0e679 100644
--- a/include/media/davinci/vpbe.h
+++ b/include/media/davinci/vpbe.h
@@ -63,6 +63,7 @@ struct vpbe_output {
63 * output basis. If per mode is needed, we may have to move this to 63 * output basis. If per mode is needed, we may have to move this to
64 * mode_info structure 64 * mode_info structure
65 */ 65 */
66 enum v4l2_mbus_pixelcode if_params;
66}; 67};
67 68
68/* encoder configuration info */ 69/* encoder configuration info */
@@ -74,6 +75,15 @@ struct encoder_config_info {
74 struct i2c_board_info board_info; 75 struct i2c_board_info board_info;
75}; 76};
76 77
78/*amplifier configuration info */
79struct amp_config_info {
80 char module_name[32];
81 /* Is this an i2c device ? */
82 unsigned int is_i2c:1;
83 /* i2c subdevice board info */
84 struct i2c_board_info board_info;
85};
86
77/* structure for defining vpbe display subsystem components */ 87/* structure for defining vpbe display subsystem components */
78struct vpbe_config { 88struct vpbe_config {
79 char module_name[32]; 89 char module_name[32];
@@ -84,6 +94,8 @@ struct vpbe_config {
84 /* external encoder information goes here */ 94 /* external encoder information goes here */
85 int num_ext_encoders; 95 int num_ext_encoders;
86 struct encoder_config_info *ext_encoders; 96 struct encoder_config_info *ext_encoders;
97 /* amplifier information goes here */
98 struct amp_config_info *amp;
87 int num_outputs; 99 int num_outputs;
88 /* Order is venc outputs followed by LCD and then external encoders */ 100 /* Order is venc outputs followed by LCD and then external encoders */
89 struct vpbe_output *outputs; 101 struct vpbe_output *outputs;
@@ -158,6 +170,8 @@ struct vpbe_device {
158 struct v4l2_subdev **encoders; 170 struct v4l2_subdev **encoders;
159 /* current encoder index */ 171 /* current encoder index */
160 int current_sd_index; 172 int current_sd_index;
173 /* external amplifier v4l2 subdevice */
174 struct v4l2_subdev *amp;
161 struct mutex lock; 175 struct mutex lock;
162 /* device initialized */ 176 /* device initialized */
163 int initialized; 177 int initialized;
@@ -165,6 +179,8 @@ struct vpbe_device {
165 struct clk *dac_clk; 179 struct clk *dac_clk;
166 /* osd_device pointer */ 180 /* osd_device pointer */
167 struct osd_state *osd_device; 181 struct osd_state *osd_device;
182 /* venc device pointer */
183 struct venc_platform_data *venc_device;
168 /* 184 /*
169 * fields below are accessed by users of vpbe_device. Not the 185 * fields below are accessed by users of vpbe_device. Not the
170 * ones above 186 * ones above
diff --git a/include/media/davinci/vpbe_venc.h b/include/media/davinci/vpbe_venc.h
index 426c205831a2..6b57334f4029 100644
--- a/include/media/davinci/vpbe_venc.h
+++ b/include/media/davinci/vpbe_venc.h
@@ -29,10 +29,14 @@
29 29
30struct venc_platform_data { 30struct venc_platform_data {
31 enum vpbe_version venc_type; 31 enum vpbe_version venc_type;
32 int (*setup_pinmux)(enum v4l2_mbus_pixelcode if_type,
33 int field);
32 int (*setup_clock)(enum vpbe_enc_timings_type type, 34 int (*setup_clock)(enum vpbe_enc_timings_type type,
33 unsigned int mode); 35 unsigned int mode);
36 int (*setup_if_config)(enum v4l2_mbus_pixelcode pixcode);
34 /* Number of LCD outputs supported */ 37 /* Number of LCD outputs supported */
35 int num_lcd_outputs; 38 int num_lcd_outputs;
39 struct vpbe_if_params *lcd_if_params;
36}; 40};
37 41
38enum venc_ioctls { 42enum venc_ioctls {
diff --git a/include/media/davinci/vpif_types.h b/include/media/davinci/vpif_types.h
new file mode 100644
index 000000000000..9929b05cff3a
--- /dev/null
+++ b/include/media/davinci/vpif_types.h
@@ -0,0 +1,71 @@
1/*
2 * Copyright (C) 2011 Texas Instruments Inc
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation version 2.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 */
17#ifndef _VPIF_TYPES_H
18#define _VPIF_TYPES_H
19
20#define VPIF_CAPTURE_MAX_CHANNELS 2
21
22enum vpif_if_type {
23 VPIF_IF_BT656,
24 VPIF_IF_BT1120,
25 VPIF_IF_RAW_BAYER
26};
27
28struct vpif_interface {
29 enum vpif_if_type if_type;
30 unsigned hd_pol:1;
31 unsigned vd_pol:1;
32 unsigned fid_pol:1;
33};
34
35struct vpif_subdev_info {
36 const char *name;
37 struct i2c_board_info board_info;
38 u32 input;
39 u32 output;
40 unsigned can_route:1;
41 struct vpif_interface vpif_if;
42};
43
44struct vpif_display_config {
45 int (*set_clock)(int, int);
46 struct vpif_subdev_info *subdevinfo;
47 int subdev_count;
48 const char **output;
49 int output_count;
50 const char *card_name;
51};
52
53struct vpif_input {
54 struct v4l2_input input;
55 const char *subdev_name;
56};
57
58struct vpif_capture_chan_config {
59 const struct vpif_input *inputs;
60 int input_count;
61};
62
63struct vpif_capture_config {
64 int (*setup_input_channel_mode)(int);
65 int (*setup_input_path)(int, const char *);
66 struct vpif_capture_chan_config chan_config[VPIF_CAPTURE_MAX_CHANNELS];
67 struct vpif_subdev_info *subdev_info;
68 int subdev_count;
69 const char *card_name;
70};
71#endif /* _VPIF_TYPES_H */
diff --git a/include/media/media-entity.h b/include/media/media-entity.h
index cd8bca63a502..29e7bba78ffe 100644
--- a/include/media/media-entity.h
+++ b/include/media/media-entity.h
@@ -98,7 +98,7 @@ struct media_entity {
98 98
99 /* Sub-device specifications */ 99 /* Sub-device specifications */
100 /* Nothing needed yet */ 100 /* Nothing needed yet */
101 }; 101 } info;
102}; 102};
103 103
104static inline u32 media_entity_type(struct media_entity *entity) 104static inline u32 media_entity_type(struct media_entity *entity)
diff --git a/include/media/omap3isp.h b/include/media/omap3isp.h
index e917b1da6577..042849a34640 100644
--- a/include/media/omap3isp.h
+++ b/include/media/omap3isp.h
@@ -58,7 +58,7 @@ enum {
58 * ISP_LANE_SHIFT_4 - CAMEXT[13:4] -> CAM[9:0] 58 * ISP_LANE_SHIFT_4 - CAMEXT[13:4] -> CAM[9:0]
59 * ISP_LANE_SHIFT_6 - CAMEXT[13:6] -> CAM[7:0] 59 * ISP_LANE_SHIFT_6 - CAMEXT[13:6] -> CAM[7:0]
60 * @clk_pol: Pixel clock polarity 60 * @clk_pol: Pixel clock polarity
61 * 0 - Non Inverted, 1 - Inverted 61 * 0 - Sample on rising edge, 1 - Sample on falling edge
62 * @hs_pol: Horizontal synchronization polarity 62 * @hs_pol: Horizontal synchronization polarity
63 * 0 - Active high, 1 - Active low 63 * 0 - Active high, 1 - Active low
64 * @vs_pol: Vertical synchronization polarity 64 * @vs_pol: Vertical synchronization polarity
diff --git a/include/media/pwc-ioctl.h b/include/media/pwc-ioctl.h
deleted file mode 100644
index 1ed1e616fe33..000000000000
--- a/include/media/pwc-ioctl.h
+++ /dev/null
@@ -1,323 +0,0 @@
1#ifndef PWC_IOCTL_H
2#define PWC_IOCTL_H
3
4/* (C) 2001-2004 Nemosoft Unv.
5 (C) 2004-2006 Luc Saillard (luc@saillard.org)
6
7 NOTE: this version of pwc is an unofficial (modified) release of pwc & pcwx
8 driver and thus may have bugs that are not present in the original version.
9 Please send bug reports and support requests to <luc@saillard.org>.
10 The decompression routines have been implemented by reverse-engineering the
11 Nemosoft binary pwcx module. Caveat emptor.
12
13 This program is free software; you can redistribute it and/or modify
14 it under the terms of the GNU General Public License as published by
15 the Free Software Foundation; either version 2 of the License, or
16 (at your option) any later version.
17
18 This program is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 GNU General Public License for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with this program; if not, write to the Free Software
25 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26*/
27
28/* This is pwc-ioctl.h belonging to PWC 10.0.10
29 It contains structures and defines to communicate from user space
30 directly to the driver.
31 */
32
33/*
34 Changes
35 2001/08/03 Alvarado Added ioctl constants to access methods for
36 changing white balance and red/blue gains
37 2002/12/15 G. H. Fernandez-Toribio VIDIOCGREALSIZE
38 2003/12/13 Nemosft Unv. Some modifications to make interfacing to
39 PWCX easier
40 2006/01/01 Luc Saillard Add raw format definition
41 */
42
43/* These are private ioctl() commands, specific for the Philips webcams.
44 They contain functions not found in other webcams, and settings not
45 specified in the Video4Linux API.
46
47 The #define names are built up like follows:
48 VIDIOC VIDeo IOCtl prefix
49 PWC Philps WebCam
50 G optional: Get
51 S optional: Set
52 ... the function
53 */
54
55#include <linux/types.h>
56
57/* Enumeration of image sizes */
58#define PSZ_SQCIF 0x00
59#define PSZ_QSIF 0x01
60#define PSZ_QCIF 0x02
61#define PSZ_SIF 0x03
62#define PSZ_CIF 0x04
63#define PSZ_VGA 0x05
64#define PSZ_MAX 6
65
66
67/* The frame rate is encoded in the video_window.flags parameter using
68 the upper 16 bits, since some flags are defined nowadays. The following
69 defines provide a mask and shift to filter out this value.
70 This value can also be passing using the private flag when using v4l2 and
71 VIDIOC_S_FMT ioctl.
72
73 In 'Snapshot' mode the camera freezes its automatic exposure and colour
74 balance controls.
75 */
76#define PWC_FPS_SHIFT 16
77#define PWC_FPS_MASK 0x00FF0000
78#define PWC_FPS_FRMASK 0x003F0000
79#define PWC_FPS_SNAPSHOT 0x00400000
80#define PWC_QLT_MASK 0x03000000
81#define PWC_QLT_SHIFT 24
82
83
84/* structure for transferring x & y coordinates */
85struct pwc_coord
86{
87 int x, y; /* guess what */
88 int size; /* size, or offset */
89};
90
91
92/* Used with VIDIOCPWCPROBE */
93struct pwc_probe
94{
95 char name[32];
96 int type;
97};
98
99struct pwc_serial
100{
101 char serial[30]; /* String with serial number. Contains terminating 0 */
102};
103
104/* pwc_whitebalance.mode values */
105#define PWC_WB_INDOOR 0
106#define PWC_WB_OUTDOOR 1
107#define PWC_WB_FL 2
108#define PWC_WB_MANUAL 3
109#define PWC_WB_AUTO 4
110
111/* Used with VIDIOCPWC[SG]AWB (Auto White Balance).
112 Set mode to one of the PWC_WB_* values above.
113 *red and *blue are the respective gains of these colour components inside
114 the camera; range 0..65535
115 When 'mode' == PWC_WB_MANUAL, 'manual_red' and 'manual_blue' are set or read;
116 otherwise undefined.
117 'read_red' and 'read_blue' are read-only.
118*/
119struct pwc_whitebalance
120{
121 int mode;
122 int manual_red, manual_blue; /* R/W */
123 int read_red, read_blue; /* R/O */
124};
125
126/*
127 'control_speed' and 'control_delay' are used in automatic whitebalance mode,
128 and tell the camera how fast it should react to changes in lighting, and
129 with how much delay. Valid values are 0..65535.
130*/
131struct pwc_wb_speed
132{
133 int control_speed;
134 int control_delay;
135
136};
137
138/* Used with VIDIOCPWC[SG]LED */
139struct pwc_leds
140{
141 int led_on; /* Led on-time; range = 0..25000 */
142 int led_off; /* Led off-time; range = 0..25000 */
143};
144
145/* Image size (used with GREALSIZE) */
146struct pwc_imagesize
147{
148 int width;
149 int height;
150};
151
152/* Defines and structures for Motorized Pan & Tilt */
153#define PWC_MPT_PAN 0x01
154#define PWC_MPT_TILT 0x02
155#define PWC_MPT_TIMEOUT 0x04 /* for status */
156
157/* Set angles; when absolute != 0, the angle is absolute and the
158 driver calculates the relative offset for you. This can only
159 be used with VIDIOCPWCSANGLE; VIDIOCPWCGANGLE always returns
160 absolute angles.
161 */
162struct pwc_mpt_angles
163{
164 int absolute; /* write-only */
165 int pan; /* degrees * 100 */
166 int tilt; /* degress * 100 */
167};
168
169/* Range of angles of the camera, both horizontally and vertically.
170 */
171struct pwc_mpt_range
172{
173 int pan_min, pan_max; /* degrees * 100 */
174 int tilt_min, tilt_max;
175};
176
177struct pwc_mpt_status
178{
179 int status;
180 int time_pan;
181 int time_tilt;
182};
183
184
185/* This is used for out-of-kernel decompression. With it, you can get
186 all the necessary information to initialize and use the decompressor
187 routines in standalone applications.
188 */
189struct pwc_video_command
190{
191 int type; /* camera type (645, 675, 730, etc.) */
192 int release; /* release number */
193
194 int size; /* one of PSZ_* */
195 int alternate;
196 int command_len; /* length of USB video command */
197 unsigned char command_buf[13]; /* Actual USB video command */
198 int bandlength; /* >0 = compressed */
199 int frame_size; /* Size of one (un)compressed frame */
200};
201
202/* Flags for PWCX subroutines. Not all modules honour all flags. */
203#define PWCX_FLAG_PLANAR 0x0001
204#define PWCX_FLAG_BAYER 0x0008
205
206
207/* IOCTL definitions */
208
209 /* Restore user settings */
210#define VIDIOCPWCRUSER _IO('v', 192)
211 /* Save user settings */
212#define VIDIOCPWCSUSER _IO('v', 193)
213 /* Restore factory settings */
214#define VIDIOCPWCFACTORY _IO('v', 194)
215
216 /* You can manipulate the compression factor. A compression preference of 0
217 means use uncompressed modes when available; 1 is low compression, 2 is
218 medium and 3 is high compression preferred. Of course, the higher the
219 compression, the lower the bandwidth used but more chance of artefacts
220 in the image. The driver automatically chooses a higher compression when
221 the preferred mode is not available.
222 */
223 /* Set preferred compression quality (0 = uncompressed, 3 = highest compression) */
224#define VIDIOCPWCSCQUAL _IOW('v', 195, int)
225 /* Get preferred compression quality */
226#define VIDIOCPWCGCQUAL _IOR('v', 195, int)
227
228
229/* Retrieve serial number of camera */
230#define VIDIOCPWCGSERIAL _IOR('v', 198, struct pwc_serial)
231
232 /* This is a probe function; since so many devices are supported, it
233 becomes difficult to include all the names in programs that want to
234 check for the enhanced Philips stuff. So in stead, try this PROBE;
235 it returns a structure with the original name, and the corresponding
236 Philips type.
237 To use, fill the structure with zeroes, call PROBE and if that succeeds,
238 compare the name with that returned from VIDIOCGCAP; they should be the
239 same. If so, you can be assured it is a Philips (OEM) cam and the type
240 is valid.
241 */
242#define VIDIOCPWCPROBE _IOR('v', 199, struct pwc_probe)
243
244 /* Set AGC (Automatic Gain Control); int < 0 = auto, 0..65535 = fixed */
245#define VIDIOCPWCSAGC _IOW('v', 200, int)
246 /* Get AGC; int < 0 = auto; >= 0 = fixed, range 0..65535 */
247#define VIDIOCPWCGAGC _IOR('v', 200, int)
248 /* Set shutter speed; int < 0 = auto; >= 0 = fixed, range 0..65535 */
249#define VIDIOCPWCSSHUTTER _IOW('v', 201, int)
250
251 /* Color compensation (Auto White Balance) */
252#define VIDIOCPWCSAWB _IOW('v', 202, struct pwc_whitebalance)
253#define VIDIOCPWCGAWB _IOR('v', 202, struct pwc_whitebalance)
254
255 /* Auto WB speed */
256#define VIDIOCPWCSAWBSPEED _IOW('v', 203, struct pwc_wb_speed)
257#define VIDIOCPWCGAWBSPEED _IOR('v', 203, struct pwc_wb_speed)
258
259 /* LEDs on/off/blink; int range 0..65535 */
260#define VIDIOCPWCSLED _IOW('v', 205, struct pwc_leds)
261#define VIDIOCPWCGLED _IOR('v', 205, struct pwc_leds)
262
263 /* Contour (sharpness); int < 0 = auto, 0..65536 = fixed */
264#define VIDIOCPWCSCONTOUR _IOW('v', 206, int)
265#define VIDIOCPWCGCONTOUR _IOR('v', 206, int)
266
267 /* Backlight compensation; 0 = off, otherwise on */
268#define VIDIOCPWCSBACKLIGHT _IOW('v', 207, int)
269#define VIDIOCPWCGBACKLIGHT _IOR('v', 207, int)
270
271 /* Flickerless mode; = 0 off, otherwise on */
272#define VIDIOCPWCSFLICKER _IOW('v', 208, int)
273#define VIDIOCPWCGFLICKER _IOR('v', 208, int)
274
275 /* Dynamic noise reduction; 0 off, 3 = high noise reduction */
276#define VIDIOCPWCSDYNNOISE _IOW('v', 209, int)
277#define VIDIOCPWCGDYNNOISE _IOR('v', 209, int)
278
279 /* Real image size as used by the camera; tells you whether or not there's a gray border around the image */
280#define VIDIOCPWCGREALSIZE _IOR('v', 210, struct pwc_imagesize)
281
282 /* Motorized pan & tilt functions */
283#define VIDIOCPWCMPTRESET _IOW('v', 211, int)
284#define VIDIOCPWCMPTGRANGE _IOR('v', 211, struct pwc_mpt_range)
285#define VIDIOCPWCMPTSANGLE _IOW('v', 212, struct pwc_mpt_angles)
286#define VIDIOCPWCMPTGANGLE _IOR('v', 212, struct pwc_mpt_angles)
287#define VIDIOCPWCMPTSTATUS _IOR('v', 213, struct pwc_mpt_status)
288
289 /* Get the USB set-video command; needed for initializing libpwcx */
290#define VIDIOCPWCGVIDCMD _IOR('v', 215, struct pwc_video_command)
291struct pwc_table_init_buffer {
292 int len;
293 char *buffer;
294
295};
296#define VIDIOCPWCGVIDTABLE _IOR('v', 216, struct pwc_table_init_buffer)
297
298/*
299 * This is private command used when communicating with v4l2.
300 * In the future all private ioctl will be remove/replace to
301 * use interface offer by v4l2.
302 */
303
304#define V4L2_CID_PRIVATE_SAVE_USER (V4L2_CID_PRIVATE_BASE + 0)
305#define V4L2_CID_PRIVATE_RESTORE_USER (V4L2_CID_PRIVATE_BASE + 1)
306#define V4L2_CID_PRIVATE_RESTORE_FACTORY (V4L2_CID_PRIVATE_BASE + 2)
307#define V4L2_CID_PRIVATE_COLOUR_MODE (V4L2_CID_PRIVATE_BASE + 3)
308#define V4L2_CID_PRIVATE_AUTOCONTOUR (V4L2_CID_PRIVATE_BASE + 4)
309#define V4L2_CID_PRIVATE_CONTOUR (V4L2_CID_PRIVATE_BASE + 5)
310#define V4L2_CID_PRIVATE_BACKLIGHT (V4L2_CID_PRIVATE_BASE + 6)
311#define V4L2_CID_PRIVATE_FLICKERLESS (V4L2_CID_PRIVATE_BASE + 7)
312#define V4L2_CID_PRIVATE_NOISE_REDUCTION (V4L2_CID_PRIVATE_BASE + 8)
313
314struct pwc_raw_frame {
315 __le16 type; /* type of the webcam */
316 __le16 vbandlength; /* Size of 4lines compressed (used by the decompressor) */
317 __u8 cmd[4]; /* the four byte of the command (in case of nala,
318 only the first 3 bytes is filled) */
319 __u8 rawframe[0]; /* frame_size = H/4*vbandlength */
320} __attribute__ ((packed));
321
322
323#endif
diff --git a/include/media/rc-map.h b/include/media/rc-map.h
index 26a3bd0fe57c..f688bde61228 100644
--- a/include/media/rc-map.h
+++ b/include/media/rc-map.h
@@ -18,13 +18,15 @@
18#define RC_TYPE_JVC (1 << 3) /* JVC protocol */ 18#define RC_TYPE_JVC (1 << 3) /* JVC protocol */
19#define RC_TYPE_SONY (1 << 4) /* Sony12/15/20 protocol */ 19#define RC_TYPE_SONY (1 << 4) /* Sony12/15/20 protocol */
20#define RC_TYPE_RC5_SZ (1 << 5) /* RC5 variant used by Streamzap */ 20#define RC_TYPE_RC5_SZ (1 << 5) /* RC5 variant used by Streamzap */
21#define RC_TYPE_SANYO (1 << 6) /* Sanyo protocol */
21#define RC_TYPE_MCE_KBD (1 << 29) /* RC6-ish MCE keyboard/mouse */ 22#define RC_TYPE_MCE_KBD (1 << 29) /* RC6-ish MCE keyboard/mouse */
22#define RC_TYPE_LIRC (1 << 30) /* Pass raw IR to lirc userspace */ 23#define RC_TYPE_LIRC (1 << 30) /* Pass raw IR to lirc userspace */
23#define RC_TYPE_OTHER (1u << 31) 24#define RC_TYPE_OTHER (1u << 31)
24 25
25#define RC_TYPE_ALL (RC_TYPE_RC5 | RC_TYPE_NEC | RC_TYPE_RC6 | \ 26#define RC_TYPE_ALL (RC_TYPE_RC5 | RC_TYPE_NEC | RC_TYPE_RC6 | \
26 RC_TYPE_JVC | RC_TYPE_SONY | RC_TYPE_LIRC | \ 27 RC_TYPE_JVC | RC_TYPE_SONY | RC_TYPE_LIRC | \
27 RC_TYPE_RC5_SZ | RC_TYPE_MCE_KBD | RC_TYPE_OTHER) 28 RC_TYPE_RC5_SZ | RC_TYPE_SANYO | RC_TYPE_MCE_KBD | \
29 RC_TYPE_OTHER)
28 30
29struct rc_map_table { 31struct rc_map_table {
30 u32 scancode; 32 u32 scancode;
@@ -145,7 +147,7 @@ void rc_map_init(void);
145#define RC_MAP_TREKSTOR "rc-trekstor" 147#define RC_MAP_TREKSTOR "rc-trekstor"
146#define RC_MAP_TT_1500 "rc-tt-1500" 148#define RC_MAP_TT_1500 "rc-tt-1500"
147#define RC_MAP_TWINHAN_VP1027_DVBS "rc-twinhan1027" 149#define RC_MAP_TWINHAN_VP1027_DVBS "rc-twinhan1027"
148#define RC_MAP_VIDEOMATE_M1F "rc-videomate-m1f" 150#define RC_MAP_VIDEOMATE_K100 "rc-videomate-k100"
149#define RC_MAP_VIDEOMATE_S350 "rc-videomate-s350" 151#define RC_MAP_VIDEOMATE_S350 "rc-videomate-s350"
150#define RC_MAP_VIDEOMATE_TV_PVR "rc-videomate-tv-pvr" 152#define RC_MAP_VIDEOMATE_TV_PVR "rc-videomate-tv-pvr"
151#define RC_MAP_WINFAST "rc-winfast" 153#define RC_MAP_WINFAST "rc-winfast"
diff --git a/include/media/soc_camera.h b/include/media/soc_camera.h
index 5fb2c3d10c05..b5c2b6cb0d81 100644
--- a/include/media/soc_camera.h
+++ b/include/media/soc_camera.h
@@ -94,7 +94,7 @@ struct soc_camera_host_ops {
94 struct soc_camera_device *); 94 struct soc_camera_device *);
95 int (*reqbufs)(struct soc_camera_device *, struct v4l2_requestbuffers *); 95 int (*reqbufs)(struct soc_camera_device *, struct v4l2_requestbuffers *);
96 int (*querycap)(struct soc_camera_host *, struct v4l2_capability *); 96 int (*querycap)(struct soc_camera_host *, struct v4l2_capability *);
97 int (*set_bus_param)(struct soc_camera_device *, __u32); 97 int (*set_bus_param)(struct soc_camera_device *);
98 int (*get_parm)(struct soc_camera_device *, struct v4l2_streamparm *); 98 int (*get_parm)(struct soc_camera_device *, struct v4l2_streamparm *);
99 int (*set_parm)(struct soc_camera_device *, struct v4l2_streamparm *); 99 int (*set_parm)(struct soc_camera_device *, struct v4l2_streamparm *);
100 int (*enum_fsizes)(struct soc_camera_device *, struct v4l2_frmsizeenum *); 100 int (*enum_fsizes)(struct soc_camera_device *, struct v4l2_frmsizeenum *);
diff --git a/include/media/tuner.h b/include/media/tuner.h
index 89c290b69a5c..29e1920e7339 100644
--- a/include/media/tuner.h
+++ b/include/media/tuner.h
@@ -127,7 +127,6 @@
127#define TUNER_PHILIPS_FMD1216MEX_MK3 78 127#define TUNER_PHILIPS_FMD1216MEX_MK3 78
128#define TUNER_PHILIPS_FM1216MK5 79 128#define TUNER_PHILIPS_FM1216MK5 79
129#define TUNER_PHILIPS_FQ1216LME_MK3 80 /* Active loopthrough, no FM */ 129#define TUNER_PHILIPS_FQ1216LME_MK3 80 /* Active loopthrough, no FM */
130#define TUNER_XC4000 81 /* Xceive Silicon Tuner */
131 130
132#define TUNER_PARTSNIC_PTI_5NF05 81 131#define TUNER_PARTSNIC_PTI_5NF05 81
133#define TUNER_PHILIPS_CU1216L 82 132#define TUNER_PHILIPS_CU1216L 82
@@ -136,6 +135,8 @@
136#define TUNER_PHILIPS_FQ1236_MK5 85 /* NTSC, TDA9885, no FM radio */ 135#define TUNER_PHILIPS_FQ1236_MK5 85 /* NTSC, TDA9885, no FM radio */
137#define TUNER_TENA_TNF_5337 86 136#define TUNER_TENA_TNF_5337 86
138 137
138#define TUNER_XC4000 87 /* Xceive Silicon Tuner */
139
139/* tv card specific */ 140/* tv card specific */
140#define TDA9887_PRESENT (1<<0) 141#define TDA9887_PRESENT (1<<0)
141#define TDA9887_PORT1_INACTIVE (1<<1) 142#define TDA9887_PORT1_INACTIVE (1<<1)
diff --git a/include/media/v4l2-ioctl.h b/include/media/v4l2-ioctl.h
index 4d1c74ad4c84..3f5d60fc5df6 100644
--- a/include/media/v4l2-ioctl.h
+++ b/include/media/v4l2-ioctl.h
@@ -196,6 +196,10 @@ struct v4l2_ioctl_ops {
196 struct v4l2_crop *a); 196 struct v4l2_crop *a);
197 int (*vidioc_s_crop) (struct file *file, void *fh, 197 int (*vidioc_s_crop) (struct file *file, void *fh,
198 struct v4l2_crop *a); 198 struct v4l2_crop *a);
199 int (*vidioc_g_selection) (struct file *file, void *fh,
200 struct v4l2_selection *s);
201 int (*vidioc_s_selection) (struct file *file, void *fh,
202 struct v4l2_selection *s);
199 /* Compression ioctls */ 203 /* Compression ioctls */
200 int (*vidioc_g_jpegcomp) (struct file *file, void *fh, 204 int (*vidioc_g_jpegcomp) (struct file *file, void *fh,
201 struct v4l2_jpegcompression *a); 205 struct v4l2_jpegcompression *a);
diff --git a/include/mtd/mtd-abi.h b/include/mtd/mtd-abi.h
index 1a7e1d20adf9..36eace03b2ac 100644
--- a/include/mtd/mtd-abi.h
+++ b/include/mtd/mtd-abi.h
@@ -198,7 +198,8 @@ struct otp_info {
198#define MEMISLOCKED _IOR('M', 23, struct erase_info_user) 198#define MEMISLOCKED _IOR('M', 23, struct erase_info_user)
199/* 199/*
200 * Most generic write interface; can write in-band and/or out-of-band in various 200 * Most generic write interface; can write in-band and/or out-of-band in various
201 * modes (see "struct mtd_write_req") 201 * modes (see "struct mtd_write_req"). This ioctl is not supported for flashes
202 * without OOB, e.g., NOR flash.
202 */ 203 */
203#define MEMWRITE _IOWR('M', 24, struct mtd_write_req) 204#define MEMWRITE _IOWR('M', 24, struct mtd_write_req)
204 205
diff --git a/include/net/9p/9p.h b/include/net/9p/9p.h
index 2d70b95b3b55..7184853ca360 100644
--- a/include/net/9p/9p.h
+++ b/include/net/9p/9p.h
@@ -63,30 +63,16 @@ enum p9_debug_flags {
63 63
64#ifdef CONFIG_NET_9P_DEBUG 64#ifdef CONFIG_NET_9P_DEBUG
65extern unsigned int p9_debug_level; 65extern unsigned int p9_debug_level;
66 66__printf(3, 4)
67#define P9_DPRINTK(level, format, arg...) \ 67void _p9_debug(enum p9_debug_flags level, const char *func,
68do { \ 68 const char *fmt, ...);
69 if ((p9_debug_level & level) == level) {\ 69#define p9_debug(level, fmt, ...) \
70 if (level == P9_DEBUG_9P) \ 70 _p9_debug(level, __func__, fmt, ##__VA_ARGS__)
71 printk(KERN_NOTICE "(%8.8d) " \
72 format , task_pid_nr(current) , ## arg); \
73 else \
74 printk(KERN_NOTICE "-- %s (%d): " \
75 format , __func__, task_pid_nr(current) , ## arg); \
76 } \
77} while (0)
78
79#else 71#else
80#define P9_DPRINTK(level, format, arg...) do { } while (0) 72#define p9_debug(level, fmt, ...) \
73 no_printk(fmt, ##__VA_ARGS__)
81#endif 74#endif
82 75
83
84#define P9_EPRINTK(level, format, arg...) \
85do { \
86 printk(level "9p: %s (%d): " \
87 format , __func__, task_pid_nr(current), ## arg); \
88} while (0)
89
90/** 76/**
91 * enum p9_msg_t - 9P message types 77 * enum p9_msg_t - 9P message types
92 * @P9_TLERROR: not used 78 * @P9_TLERROR: not used
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index 5b2fed5eebf2..00596e816b4d 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -1388,6 +1388,6 @@ struct hci_inquiry_req {
1388}; 1388};
1389#define IREQ_CACHE_FLUSH 0x0001 1389#define IREQ_CACHE_FLUSH 0x0001
1390 1390
1391extern int enable_hs; 1391extern bool enable_hs;
1392 1392
1393#endif /* __HCI_H */ 1393#endif /* __HCI_H */
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 5e2e98458496..ea9231f4935f 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -127,7 +127,7 @@ struct hci_dev {
127 __u8 major_class; 127 __u8 major_class;
128 __u8 minor_class; 128 __u8 minor_class;
129 __u8 features[8]; 129 __u8 features[8];
130 __u8 extfeatures[8]; 130 __u8 host_features[8];
131 __u8 commands[64]; 131 __u8 commands[64];
132 __u8 ssp_mode; 132 __u8 ssp_mode;
133 __u8 hci_ver; 133 __u8 hci_ver;
@@ -676,7 +676,7 @@ void hci_conn_del_sysfs(struct hci_conn *conn);
676#define lmp_le_capable(dev) ((dev)->features[4] & LMP_LE) 676#define lmp_le_capable(dev) ((dev)->features[4] & LMP_LE)
677 677
678/* ----- Extended LMP capabilities ----- */ 678/* ----- Extended LMP capabilities ----- */
679#define lmp_host_le_capable(dev) ((dev)->extfeatures[0] & LMP_HOST_LE) 679#define lmp_host_le_capable(dev) ((dev)->host_features[0] & LMP_HOST_LE)
680 680
681/* ----- HCI protocols ----- */ 681/* ----- HCI protocols ----- */
682static inline int hci_proto_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr, 682static inline int hci_proto_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr,
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 15f4be7d768e..a067d30ce73e 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -1140,6 +1140,7 @@ struct cfg80211_disassoc_request {
1140 * @bssid: Fixed BSSID requested, maybe be %NULL, if set do not 1140 * @bssid: Fixed BSSID requested, maybe be %NULL, if set do not
1141 * search for IBSSs with a different BSSID. 1141 * search for IBSSs with a different BSSID.
1142 * @channel: The channel to use if no IBSS can be found to join. 1142 * @channel: The channel to use if no IBSS can be found to join.
1143 * @channel_type: channel type (HT mode)
1143 * @channel_fixed: The channel should be fixed -- do not search for 1144 * @channel_fixed: The channel should be fixed -- do not search for
1144 * IBSSs to join on other channels. 1145 * IBSSs to join on other channels.
1145 * @ie: information element(s) to include in the beacon 1146 * @ie: information element(s) to include in the beacon
@@ -1978,6 +1979,11 @@ struct wiphy_wowlan_support {
1978 * configured as RX antennas. Antenna configuration commands will be 1979 * configured as RX antennas. Antenna configuration commands will be
1979 * rejected unless this or @available_antennas_tx is set. 1980 * rejected unless this or @available_antennas_tx is set.
1980 * 1981 *
1982 * @probe_resp_offload:
1983 * Bitmap of supported protocols for probe response offloading.
1984 * See &enum nl80211_probe_resp_offload_support_attr. Only valid
1985 * when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set.
1986 *
1981 * @max_remain_on_channel_duration: Maximum time a remain-on-channel operation 1987 * @max_remain_on_channel_duration: Maximum time a remain-on-channel operation
1982 * may request, if implemented. 1988 * may request, if implemented.
1983 * 1989 *
diff --git a/include/net/flow.h b/include/net/flow.h
index da1f064a81b3..9b582437fbea 100644
--- a/include/net/flow.h
+++ b/include/net/flow.h
@@ -78,7 +78,7 @@ static inline void flowi4_init_output(struct flowi4 *fl4, int oif,
78 __u32 mark, __u8 tos, __u8 scope, 78 __u32 mark, __u8 tos, __u8 scope,
79 __u8 proto, __u8 flags, 79 __u8 proto, __u8 flags,
80 __be32 daddr, __be32 saddr, 80 __be32 daddr, __be32 saddr,
81 __be16 dport, __be32 sport) 81 __be16 dport, __be16 sport)
82{ 82{
83 fl4->flowi4_oif = oif; 83 fl4->flowi4_oif = oif;
84 fl4->flowi4_iif = 0; 84 fl4->flowi4_iif = 0;
diff --git a/include/net/netns/generic.h b/include/net/netns/generic.h
index 3419bf5cd154..d55f43443335 100644
--- a/include/net/netns/generic.h
+++ b/include/net/netns/generic.h
@@ -41,6 +41,7 @@ static inline void *net_generic(const struct net *net, int id)
41 ptr = ng->ptr[id - 1]; 41 ptr = ng->ptr[id - 1];
42 rcu_read_unlock(); 42 rcu_read_unlock();
43 43
44 BUG_ON(!ptr);
44 return ptr; 45 return ptr;
45} 46}
46#endif 47#endif
diff --git a/include/net/netprio_cgroup.h b/include/net/netprio_cgroup.h
index e503b87c4c1b..7b2d43139c8e 100644
--- a/include/net/netprio_cgroup.h
+++ b/include/net/netprio_cgroup.h
@@ -13,7 +13,6 @@
13 13
14#ifndef _NETPRIO_CGROUP_H 14#ifndef _NETPRIO_CGROUP_H
15#define _NETPRIO_CGROUP_H 15#define _NETPRIO_CGROUP_H
16#include <linux/module.h>
17#include <linux/cgroup.h> 16#include <linux/cgroup.h>
18#include <linux/hardirq.h> 17#include <linux/hardirq.h>
19#include <linux/rcupdate.h> 18#include <linux/rcupdate.h>
diff --git a/include/net/red.h b/include/net/red.h
index baab385a4736..28068ec614b2 100644
--- a/include/net/red.h
+++ b/include/net/red.h
@@ -199,7 +199,8 @@ static inline void red_set_parms(struct red_parms *p,
199 p->Scell_log = Scell_log; 199 p->Scell_log = Scell_log;
200 p->Scell_max = (255 << Scell_log); 200 p->Scell_max = (255 << Scell_log);
201 201
202 memcpy(p->Stab, stab, sizeof(p->Stab)); 202 if (stab)
203 memcpy(p->Stab, stab, sizeof(p->Stab));
203} 204}
204 205
205static inline int red_is_idling(const struct red_vars *v) 206static inline int red_is_idling(const struct red_vars *v)
diff --git a/include/net/snmp.h b/include/net/snmp.h
index 2f65e1686fc8..0147b901e79c 100644
--- a/include/net/snmp.h
+++ b/include/net/snmp.h
@@ -129,33 +129,33 @@ struct linux_xfrm_mib {
129 __this_cpu_inc(mib[0]->mibs[field]) 129 __this_cpu_inc(mib[0]->mibs[field])
130 130
131#define SNMP_INC_STATS_USER(mib, field) \ 131#define SNMP_INC_STATS_USER(mib, field) \
132 irqsafe_cpu_inc(mib[0]->mibs[field]) 132 this_cpu_inc(mib[0]->mibs[field])
133 133
134#define SNMP_INC_STATS_ATOMIC_LONG(mib, field) \ 134#define SNMP_INC_STATS_ATOMIC_LONG(mib, field) \
135 atomic_long_inc(&mib->mibs[field]) 135 atomic_long_inc(&mib->mibs[field])
136 136
137#define SNMP_INC_STATS(mib, field) \ 137#define SNMP_INC_STATS(mib, field) \
138 irqsafe_cpu_inc(mib[0]->mibs[field]) 138 this_cpu_inc(mib[0]->mibs[field])
139 139
140#define SNMP_DEC_STATS(mib, field) \ 140#define SNMP_DEC_STATS(mib, field) \
141 irqsafe_cpu_dec(mib[0]->mibs[field]) 141 this_cpu_dec(mib[0]->mibs[field])
142 142
143#define SNMP_ADD_STATS_BH(mib, field, addend) \ 143#define SNMP_ADD_STATS_BH(mib, field, addend) \
144 __this_cpu_add(mib[0]->mibs[field], addend) 144 __this_cpu_add(mib[0]->mibs[field], addend)
145 145
146#define SNMP_ADD_STATS_USER(mib, field, addend) \ 146#define SNMP_ADD_STATS_USER(mib, field, addend) \
147 irqsafe_cpu_add(mib[0]->mibs[field], addend) 147 this_cpu_add(mib[0]->mibs[field], addend)
148 148
149#define SNMP_ADD_STATS(mib, field, addend) \ 149#define SNMP_ADD_STATS(mib, field, addend) \
150 irqsafe_cpu_add(mib[0]->mibs[field], addend) 150 this_cpu_add(mib[0]->mibs[field], addend)
151/* 151/*
152 * Use "__typeof__(*mib[0]) *ptr" instead of "__typeof__(mib[0]) ptr" 152 * Use "__typeof__(*mib[0]) *ptr" instead of "__typeof__(mib[0]) ptr"
153 * to make @ptr a non-percpu pointer. 153 * to make @ptr a non-percpu pointer.
154 */ 154 */
155#define SNMP_UPD_PO_STATS(mib, basefield, addend) \ 155#define SNMP_UPD_PO_STATS(mib, basefield, addend) \
156 do { \ 156 do { \
157 irqsafe_cpu_inc(mib[0]->mibs[basefield##PKTS]); \ 157 this_cpu_inc(mib[0]->mibs[basefield##PKTS]); \
158 irqsafe_cpu_add(mib[0]->mibs[basefield##OCTETS], addend); \ 158 this_cpu_add(mib[0]->mibs[basefield##OCTETS], addend); \
159 } while (0) 159 } while (0)
160#define SNMP_UPD_PO_STATS_BH(mib, basefield, addend) \ 160#define SNMP_UPD_PO_STATS_BH(mib, basefield, addend) \
161 do { \ 161 do { \
diff --git a/include/net/sock.h b/include/net/sock.h
index bb972d254dff..91c1c8baf020 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -55,6 +55,7 @@
55#include <linux/uaccess.h> 55#include <linux/uaccess.h>
56#include <linux/memcontrol.h> 56#include <linux/memcontrol.h>
57#include <linux/res_counter.h> 57#include <linux/res_counter.h>
58#include <linux/jump_label.h>
58 59
59#include <linux/filter.h> 60#include <linux/filter.h>
60#include <linux/rculist_nulls.h> 61#include <linux/rculist_nulls.h>
@@ -226,6 +227,7 @@ struct cg_proto;
226 * @sk_ack_backlog: current listen backlog 227 * @sk_ack_backlog: current listen backlog
227 * @sk_max_ack_backlog: listen backlog set in listen() 228 * @sk_max_ack_backlog: listen backlog set in listen()
228 * @sk_priority: %SO_PRIORITY setting 229 * @sk_priority: %SO_PRIORITY setting
230 * @sk_cgrp_prioidx: socket group's priority map index
229 * @sk_type: socket type (%SOCK_STREAM, etc) 231 * @sk_type: socket type (%SOCK_STREAM, etc)
230 * @sk_protocol: which protocol this socket belongs in this network family 232 * @sk_protocol: which protocol this socket belongs in this network family
231 * @sk_peer_pid: &struct pid for this socket's peer 233 * @sk_peer_pid: &struct pid for this socket's peer
@@ -921,7 +923,7 @@ inline void sk_refcnt_debug_release(const struct sock *sk)
921#define sk_refcnt_debug_release(sk) do { } while (0) 923#define sk_refcnt_debug_release(sk) do { } while (0)
922#endif /* SOCK_REFCNT_DEBUG */ 924#endif /* SOCK_REFCNT_DEBUG */
923 925
924#ifdef CONFIG_CGROUP_MEM_RES_CTLR_KMEM 926#if defined(CONFIG_CGROUP_MEM_RES_CTLR_KMEM) && defined(CONFIG_NET)
925extern struct jump_label_key memcg_socket_limit_enabled; 927extern struct jump_label_key memcg_socket_limit_enabled;
926static inline struct cg_proto *parent_cg_proto(struct proto *proto, 928static inline struct cg_proto *parent_cg_proto(struct proto *proto,
927 struct cg_proto *cg_proto) 929 struct cg_proto *cg_proto)
@@ -1007,9 +1009,8 @@ static inline void memcg_memory_allocated_add(struct cg_proto *prot,
1007 struct res_counter *fail; 1009 struct res_counter *fail;
1008 int ret; 1010 int ret;
1009 1011
1010 ret = res_counter_charge(prot->memory_allocated, 1012 ret = res_counter_charge_nofail(prot->memory_allocated,
1011 amt << PAGE_SHIFT, &fail); 1013 amt << PAGE_SHIFT, &fail);
1012
1013 if (ret < 0) 1014 if (ret < 0)
1014 *parent_status = OVER_LIMIT; 1015 *parent_status = OVER_LIMIT;
1015} 1016}
@@ -1053,12 +1054,11 @@ sk_memory_allocated_add(struct sock *sk, int amt, int *parent_status)
1053} 1054}
1054 1055
1055static inline void 1056static inline void
1056sk_memory_allocated_sub(struct sock *sk, int amt, int parent_status) 1057sk_memory_allocated_sub(struct sock *sk, int amt)
1057{ 1058{
1058 struct proto *prot = sk->sk_prot; 1059 struct proto *prot = sk->sk_prot;
1059 1060
1060 if (mem_cgroup_sockets_enabled && sk->sk_cgrp && 1061 if (mem_cgroup_sockets_enabled && sk->sk_cgrp)
1061 parent_status != OVER_LIMIT) /* Otherwise was uncharged already */
1062 memcg_memory_allocated_sub(sk->sk_cgrp, amt); 1062 memcg_memory_allocated_sub(sk->sk_cgrp, amt);
1063 1063
1064 atomic_long_sub(amt, prot->memory_allocated); 1064 atomic_long_sub(amt, prot->memory_allocated);
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 0118ea999f67..d49db0113a06 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -311,6 +311,8 @@ extern struct proto tcp_prot;
311#define TCP_ADD_STATS_USER(net, field, val) SNMP_ADD_STATS_USER((net)->mib.tcp_statistics, field, val) 311#define TCP_ADD_STATS_USER(net, field, val) SNMP_ADD_STATS_USER((net)->mib.tcp_statistics, field, val)
312#define TCP_ADD_STATS(net, field, val) SNMP_ADD_STATS((net)->mib.tcp_statistics, field, val) 312#define TCP_ADD_STATS(net, field, val) SNMP_ADD_STATS((net)->mib.tcp_statistics, field, val)
313 313
314extern void tcp_init_mem(struct net *net);
315
314extern void tcp_v4_err(struct sk_buff *skb, u32); 316extern void tcp_v4_err(struct sk_buff *skb, u32);
315 317
316extern void tcp_shutdown (struct sock *sk, int how); 318extern void tcp_shutdown (struct sock *sk, int how);
diff --git a/include/rdma/ib_addr.h b/include/rdma/ib_addr.h
index 639a4491fc0d..99965395c5f3 100644
--- a/include/rdma/ib_addr.h
+++ b/include/rdma/ib_addr.h
@@ -281,7 +281,7 @@ static inline u16 rdma_get_vlan_id(union ib_gid *dgid)
281static inline struct net_device *rdma_vlan_dev_real_dev(const struct net_device *dev) 281static inline struct net_device *rdma_vlan_dev_real_dev(const struct net_device *dev)
282{ 282{
283 return dev->priv_flags & IFF_802_1Q_VLAN ? 283 return dev->priv_flags & IFF_802_1Q_VLAN ?
284 vlan_dev_real_dev(dev) : 0; 284 vlan_dev_real_dev(dev) : NULL;
285} 285}
286 286
287#endif /* IB_ADDR_H */ 287#endif /* IB_ADDR_H */
diff --git a/include/rdma/ib_cm.h b/include/rdma/ib_cm.h
index c8f94e8db69c..83f77ac33957 100644
--- a/include/rdma/ib_cm.h
+++ b/include/rdma/ib_cm.h
@@ -38,6 +38,9 @@
38#include <rdma/ib_mad.h> 38#include <rdma/ib_mad.h>
39#include <rdma/ib_sa.h> 39#include <rdma/ib_sa.h>
40 40
41/* ib_cm and ib_user_cm modules share /sys/class/infiniband_cm */
42extern struct class cm_class;
43
41enum ib_cm_state { 44enum ib_cm_state {
42 IB_CM_IDLE, 45 IB_CM_IDLE,
43 IB_CM_LISTEN, 46 IB_CM_LISTEN,
diff --git a/include/scsi/libfc.h b/include/scsi/libfc.h
index 5d1a758e0595..6a3922fe0be0 100644
--- a/include/scsi/libfc.h
+++ b/include/scsi/libfc.h
@@ -857,7 +857,7 @@ struct fc_lport {
857 enum fc_lport_state state; 857 enum fc_lport_state state;
858 unsigned long boot_time; 858 unsigned long boot_time;
859 struct fc_host_statistics host_stats; 859 struct fc_host_statistics host_stats;
860 struct fcoe_dev_stats *dev_stats; 860 struct fcoe_dev_stats __percpu *dev_stats;
861 u8 retry_count; 861 u8 retry_count;
862 862
863 /* Fabric information */ 863 /* Fabric information */
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index 5591ed54dc93..77273f2fdd80 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -185,7 +185,6 @@ typedef void (*activate_complete)(void *, int);
185struct scsi_device_handler { 185struct scsi_device_handler {
186 /* Used by the infrastructure */ 186 /* Used by the infrastructure */
187 struct list_head list; /* list of scsi_device_handlers */ 187 struct list_head list; /* list of scsi_device_handlers */
188 int idx;
189 188
190 /* Filled by the hardware handler */ 189 /* Filled by the hardware handler */
191 struct module *module; 190 struct module *module;
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index 50266c9405fc..5f7d5b3b1c6e 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -669,6 +669,9 @@ struct Scsi_Host {
669 /* Asynchronous scan in progress */ 669 /* Asynchronous scan in progress */
670 unsigned async_scan:1; 670 unsigned async_scan:1;
671 671
672 /* Don't resume host in EH */
673 unsigned eh_noresume:1;
674
672 /* 675 /*
673 * Optional work queue to be utilized by the transport 676 * Optional work queue to be utilized by the transport
674 */ 677 */
diff --git a/include/scsi/scsi_transport_iscsi.h b/include/scsi/scsi_transport_iscsi.h
index 87f34c3d447d..2c3a46d102fd 100644
--- a/include/scsi/scsi_transport_iscsi.h
+++ b/include/scsi/scsi_transport_iscsi.h
@@ -211,6 +211,11 @@ struct iscsi_cls_session {
211 unsigned int target_id; 211 unsigned int target_id;
212 bool ida_used; 212 bool ida_used;
213 213
214 /*
215 * pid of userspace process that created session or -1 if
216 * created by the kernel.
217 */
218 pid_t creator;
214 int state; 219 int state;
215 int sid; /* session id */ 220 int sid; /* session id */
216 void *dd_data; /* LLD private data */ 221 void *dd_data; /* LLD private data */
diff --git a/include/sound/Kbuild b/include/sound/Kbuild
index 802947f60915..6df30ed1581c 100644
--- a/include/sound/Kbuild
+++ b/include/sound/Kbuild
@@ -6,3 +6,5 @@ header-y += hdsp.h
6header-y += hdspm.h 6header-y += hdspm.h
7header-y += sb16_csp.h 7header-y += sb16_csp.h
8header-y += sfnt_info.h 8header-y += sfnt_info.h
9header-y += compress_params.h
10header-y += compress_offload.h
diff --git a/include/sound/compress_driver.h b/include/sound/compress_driver.h
new file mode 100644
index 000000000000..48f2a1ff2bbc
--- /dev/null
+++ b/include/sound/compress_driver.h
@@ -0,0 +1,167 @@
1/*
2 * compress_driver.h - compress offload driver definations
3 *
4 * Copyright (C) 2011 Intel Corporation
5 * Authors: Vinod Koul <vinod.koul@linux.intel.com>
6 * Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
7 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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 as published by
11 * the Free Software Foundation; version 2 of the License.
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
21 *
22 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
23 *
24 */
25#ifndef __COMPRESS_DRIVER_H
26#define __COMPRESS_DRIVER_H
27
28#include <linux/types.h>
29#include <linux/sched.h>
30#include <sound/compress_offload.h>
31#include <sound/asound.h>
32#include <sound/pcm.h>
33
34struct snd_compr_ops;
35
36/**
37 * struct snd_compr_runtime: runtime stream description
38 * @state: stream state
39 * @ops: pointer to DSP callbacks
40 * @buffer: pointer to kernel buffer, valid only when not in mmap mode or
41 * DSP doesn't implement copy
42 * @buffer_size: size of the above buffer
43 * @fragment_size: size of buffer fragment in bytes
44 * @fragments: number of such fragments
45 * @hw_pointer: offset of last location in buffer where DSP copied data
46 * @app_pointer: offset of last location in buffer where app wrote data
47 * @total_bytes_available: cumulative number of bytes made available in
48 * the ring buffer
49 * @total_bytes_transferred: cumulative bytes transferred by offload DSP
50 * @sleep: poll sleep
51 */
52struct snd_compr_runtime {
53 snd_pcm_state_t state;
54 struct snd_compr_ops *ops;
55 void *buffer;
56 u64 buffer_size;
57 u32 fragment_size;
58 u32 fragments;
59 u64 hw_pointer;
60 u64 app_pointer;
61 u64 total_bytes_available;
62 u64 total_bytes_transferred;
63 wait_queue_head_t sleep;
64};
65
66/**
67 * struct snd_compr_stream: compressed stream
68 * @name: device name
69 * @ops: pointer to DSP callbacks
70 * @runtime: pointer to runtime structure
71 * @device: device pointer
72 * @direction: stream direction, playback/recording
73 * @private_data: pointer to DSP private data
74 */
75struct snd_compr_stream {
76 const char *name;
77 struct snd_compr_ops *ops;
78 struct snd_compr_runtime *runtime;
79 struct snd_compr *device;
80 enum snd_compr_direction direction;
81 void *private_data;
82};
83
84/**
85 * struct snd_compr_ops: compressed path DSP operations
86 * @open: Open the compressed stream
87 * This callback is mandatory and shall keep dsp ready to receive the stream
88 * parameter
89 * @free: Close the compressed stream, mandatory
90 * @set_params: Sets the compressed stream parameters, mandatory
91 * This can be called in during stream creation only to set codec params
92 * and the stream properties
93 * @get_params: retrieve the codec parameters, mandatory
94 * @trigger: Trigger operations like start, pause, resume, drain, stop.
95 * This callback is mandatory
96 * @pointer: Retrieve current h/w pointer information. Mandatory
97 * @copy: Copy the compressed data to/from userspace, Optional
98 * Can't be implemented if DSP supports mmap
99 * @mmap: DSP mmap method to mmap DSP memory
100 * @ack: Ack for DSP when data is written to audio buffer, Optional
101 * Not valid if copy is implemented
102 * @get_caps: Retrieve DSP capabilities, mandatory
103 * @get_codec_caps: Retrieve capabilities for a specific codec, mandatory
104 */
105struct snd_compr_ops {
106 int (*open)(struct snd_compr_stream *stream);
107 int (*free)(struct snd_compr_stream *stream);
108 int (*set_params)(struct snd_compr_stream *stream,
109 struct snd_compr_params *params);
110 int (*get_params)(struct snd_compr_stream *stream,
111 struct snd_codec *params);
112 int (*trigger)(struct snd_compr_stream *stream, int cmd);
113 int (*pointer)(struct snd_compr_stream *stream,
114 struct snd_compr_tstamp *tstamp);
115 int (*copy)(struct snd_compr_stream *stream, const char __user *buf,
116 size_t count);
117 int (*mmap)(struct snd_compr_stream *stream,
118 struct vm_area_struct *vma);
119 int (*ack)(struct snd_compr_stream *stream, size_t bytes);
120 int (*get_caps) (struct snd_compr_stream *stream,
121 struct snd_compr_caps *caps);
122 int (*get_codec_caps) (struct snd_compr_stream *stream,
123 struct snd_compr_codec_caps *codec);
124};
125
126/**
127 * struct snd_compr: Compressed device
128 * @name: DSP device name
129 * @dev: Device pointer
130 * @ops: pointer to DSP callbacks
131 * @private_data: pointer to DSP pvt data
132 * @card: sound card pointer
133 * @direction: Playback or capture direction
134 * @lock: device lock
135 * @device: device id
136 */
137struct snd_compr {
138 const char *name;
139 struct device *dev;
140 struct snd_compr_ops *ops;
141 void *private_data;
142 struct snd_card *card;
143 unsigned int direction;
144 struct mutex lock;
145 int device;
146};
147
148/* compress device register APIs */
149int snd_compress_register(struct snd_compr *device);
150int snd_compress_deregister(struct snd_compr *device);
151int snd_compress_new(struct snd_card *card, int device,
152 int type, struct snd_compr *compr);
153
154/* dsp driver callback apis
155 * For playback: driver should call snd_compress_fragment_elapsed() to let the
156 * framework know that a fragment has been consumed from the ring buffer
157 *
158 * For recording: we want to know when a frame is available or when
159 * at least one frame is available so snd_compress_frame_elapsed()
160 * callback should be called when a encodeded frame is available
161 */
162static inline void snd_compr_fragment_elapsed(struct snd_compr_stream *stream)
163{
164 wake_up(&stream->runtime->sleep);
165}
166
167#endif
diff --git a/include/sound/compress_offload.h b/include/sound/compress_offload.h
new file mode 100644
index 000000000000..05341a43fedf
--- /dev/null
+++ b/include/sound/compress_offload.h
@@ -0,0 +1,161 @@
1/*
2 * compress_offload.h - compress offload header definations
3 *
4 * Copyright (C) 2011 Intel Corporation
5 * Authors: Vinod Koul <vinod.koul@linux.intel.com>
6 * Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
7 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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 as published by
11 * the Free Software Foundation; version 2 of the License.
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
21 *
22 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
23 *
24 */
25#ifndef __COMPRESS_OFFLOAD_H
26#define __COMPRESS_OFFLOAD_H
27
28#include <linux/types.h>
29#include <sound/asound.h>
30#include <sound/compress_params.h>
31
32
33#define SNDRV_COMPRESS_VERSION SNDRV_PROTOCOL_VERSION(0, 1, 0)
34/**
35 * struct snd_compressed_buffer: compressed buffer
36 * @fragment_size: size of buffer fragment in bytes
37 * @fragments: number of such fragments
38 */
39struct snd_compressed_buffer {
40 __u32 fragment_size;
41 __u32 fragments;
42};
43
44/**
45 * struct snd_compr_params: compressed stream params
46 * @buffer: buffer description
47 * @codec: codec parameters
48 * @no_wake_mode: dont wake on fragment elapsed
49 */
50struct snd_compr_params {
51 struct snd_compressed_buffer buffer;
52 struct snd_codec codec;
53 __u8 no_wake_mode;
54};
55
56/**
57 * struct snd_compr_tstamp: timestamp descriptor
58 * @byte_offset: Byte offset in ring buffer to DSP
59 * @copied_total: Total number of bytes copied from/to ring buffer to/by DSP
60 * @pcm_frames: Frames decoded or encoded by DSP. This field will evolve by
61 * large steps and should only be used to monitor encoding/decoding
62 * progress. It shall not be used for timing estimates.
63 * @pcm_io_frames: Frames rendered or received by DSP into a mixer or an audio
64 * output/input. This field should be used for A/V sync or time estimates.
65 * @sampling_rate: sampling rate of audio
66 */
67struct snd_compr_tstamp {
68 __u32 byte_offset;
69 __u32 copied_total;
70 snd_pcm_uframes_t pcm_frames;
71 snd_pcm_uframes_t pcm_io_frames;
72 __u32 sampling_rate;
73};
74
75/**
76 * struct snd_compr_avail: avail descriptor
77 * @avail: Number of bytes available in ring buffer for writing/reading
78 * @tstamp: timestamp infomation
79 */
80struct snd_compr_avail {
81 __u64 avail;
82 struct snd_compr_tstamp tstamp;
83};
84
85enum snd_compr_direction {
86 SND_COMPRESS_PLAYBACK = 0,
87 SND_COMPRESS_CAPTURE
88};
89
90/**
91 * struct snd_compr_caps: caps descriptor
92 * @codecs: pointer to array of codecs
93 * @direction: direction supported. Of type snd_compr_direction
94 * @min_fragment_size: minimum fragment supported by DSP
95 * @max_fragment_size: maximum fragment supported by DSP
96 * @min_fragments: min fragments supported by DSP
97 * @max_fragments: max fragments supported by DSP
98 * @num_codecs: number of codecs supported
99 * @reserved: reserved field
100 */
101struct snd_compr_caps {
102 __u32 num_codecs;
103 __u32 direction;
104 __u32 min_fragment_size;
105 __u32 max_fragment_size;
106 __u32 min_fragments;
107 __u32 max_fragments;
108 __u32 codecs[MAX_NUM_CODECS];
109 __u32 reserved[11];
110};
111
112/**
113 * struct snd_compr_codec_caps: query capability of codec
114 * @codec: codec for which capability is queried
115 * @num_descriptors: number of codec descriptors
116 * @descriptor: array of codec capability descriptor
117 */
118struct snd_compr_codec_caps {
119 __u32 codec;
120 __u32 num_descriptors;
121 struct snd_codec_desc descriptor[MAX_NUM_CODEC_DESCRIPTORS];
122};
123
124/**
125 * compress path ioctl definitions
126 * SNDRV_COMPRESS_GET_CAPS: Query capability of DSP
127 * SNDRV_COMPRESS_GET_CODEC_CAPS: Query capability of a codec
128 * SNDRV_COMPRESS_SET_PARAMS: Set codec and stream parameters
129 * Note: only codec params can be changed runtime and stream params cant be
130 * SNDRV_COMPRESS_GET_PARAMS: Query codec params
131 * SNDRV_COMPRESS_TSTAMP: get the current timestamp value
132 * SNDRV_COMPRESS_AVAIL: get the current buffer avail value.
133 * This also queries the tstamp properties
134 * SNDRV_COMPRESS_PAUSE: Pause the running stream
135 * SNDRV_COMPRESS_RESUME: resume a paused stream
136 * SNDRV_COMPRESS_START: Start a stream
137 * SNDRV_COMPRESS_STOP: stop a running stream, discarding ring buffer content
138 * and the buffers currently with DSP
139 * SNDRV_COMPRESS_DRAIN: Play till end of buffers and stop after that
140 * SNDRV_COMPRESS_IOCTL_VERSION: Query the API version
141 */
142#define SNDRV_COMPRESS_IOCTL_VERSION _IOR('C', 0x00, int)
143#define SNDRV_COMPRESS_GET_CAPS _IOWR('C', 0x10, struct snd_compr_caps)
144#define SNDRV_COMPRESS_GET_CODEC_CAPS _IOWR('C', 0x11,\
145 struct snd_compr_codec_caps)
146#define SNDRV_COMPRESS_SET_PARAMS _IOW('C', 0x12, struct snd_compr_params)
147#define SNDRV_COMPRESS_GET_PARAMS _IOR('C', 0x13, struct snd_codec)
148#define SNDRV_COMPRESS_TSTAMP _IOR('C', 0x20, struct snd_compr_tstamp)
149#define SNDRV_COMPRESS_AVAIL _IOR('C', 0x21, struct snd_compr_avail)
150#define SNDRV_COMPRESS_PAUSE _IO('C', 0x30)
151#define SNDRV_COMPRESS_RESUME _IO('C', 0x31)
152#define SNDRV_COMPRESS_START _IO('C', 0x32)
153#define SNDRV_COMPRESS_STOP _IO('C', 0x33)
154#define SNDRV_COMPRESS_DRAIN _IO('C', 0x34)
155/*
156 * TODO
157 * 1. add mmap support
158 *
159 */
160#define SND_COMPR_TRIGGER_DRAIN 7 /*FIXME move this to pcm.h */
161#endif
diff --git a/include/sound/compress_params.h b/include/sound/compress_params.h
new file mode 100644
index 000000000000..d97d69f81a7d
--- /dev/null
+++ b/include/sound/compress_params.h
@@ -0,0 +1,397 @@
1/*
2 * compress_params.h - codec types and parameters for compressed data
3 * streaming interface
4 *
5 * Copyright (C) 2011 Intel Corporation
6 * Authors: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
7 * Vinod Koul <vinod.koul@linux.intel.com>
8 *
9 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; version 2 of the License.
14 *
15 * This program is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
23 *
24 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
25 *
26 * The definitions in this file are derived from the OpenMAX AL version 1.1
27 * and OpenMAX IL v 1.1.2 header files which contain the copyright notice below.
28 *
29 * Copyright (c) 2007-2010 The Khronos Group Inc.
30 *
31 * Permission is hereby granted, free of charge, to any person obtaining
32 * a copy of this software and/or associated documentation files (the
33 * "Materials "), to deal in the Materials without restriction, including
34 * without limitation the rights to use, copy, modify, merge, publish,
35 * distribute, sublicense, and/or sell copies of the Materials, and to
36 * permit persons to whom the Materials are furnished to do so, subject to
37 * the following conditions:
38 *
39 * The above copyright notice and this permission notice shall be included
40 * in all copies or substantial portions of the Materials.
41 *
42 * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
43 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
44 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
45 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
46 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
47 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
48 * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
49 *
50 */
51#ifndef __SND_COMPRESS_PARAMS_H
52#define __SND_COMPRESS_PARAMS_H
53
54/* AUDIO CODECS SUPPORTED */
55#define MAX_NUM_CODECS 32
56#define MAX_NUM_CODEC_DESCRIPTORS 32
57#define MAX_NUM_BITRATES 32
58
59/* Codecs are listed linearly to allow for extensibility */
60#define SND_AUDIOCODEC_PCM ((__u32) 0x00000001)
61#define SND_AUDIOCODEC_MP3 ((__u32) 0x00000002)
62#define SND_AUDIOCODEC_AMR ((__u32) 0x00000003)
63#define SND_AUDIOCODEC_AMRWB ((__u32) 0x00000004)
64#define SND_AUDIOCODEC_AMRWBPLUS ((__u32) 0x00000005)
65#define SND_AUDIOCODEC_AAC ((__u32) 0x00000006)
66#define SND_AUDIOCODEC_WMA ((__u32) 0x00000007)
67#define SND_AUDIOCODEC_REAL ((__u32) 0x00000008)
68#define SND_AUDIOCODEC_VORBIS ((__u32) 0x00000009)
69#define SND_AUDIOCODEC_FLAC ((__u32) 0x0000000A)
70#define SND_AUDIOCODEC_IEC61937 ((__u32) 0x0000000B)
71#define SND_AUDIOCODEC_G723_1 ((__u32) 0x0000000C)
72#define SND_AUDIOCODEC_G729 ((__u32) 0x0000000D)
73
74/*
75 * Profile and modes are listed with bit masks. This allows for a
76 * more compact representation of fields that will not evolve
77 * (in contrast to the list of codecs)
78 */
79
80#define SND_AUDIOPROFILE_PCM ((__u32) 0x00000001)
81
82/* MP3 modes are only useful for encoders */
83#define SND_AUDIOCHANMODE_MP3_MONO ((__u32) 0x00000001)
84#define SND_AUDIOCHANMODE_MP3_STEREO ((__u32) 0x00000002)
85#define SND_AUDIOCHANMODE_MP3_JOINTSTEREO ((__u32) 0x00000004)
86#define SND_AUDIOCHANMODE_MP3_DUAL ((__u32) 0x00000008)
87
88#define SND_AUDIOPROFILE_AMR ((__u32) 0x00000001)
89
90/* AMR modes are only useful for encoders */
91#define SND_AUDIOMODE_AMR_DTX_OFF ((__u32) 0x00000001)
92#define SND_AUDIOMODE_AMR_VAD1 ((__u32) 0x00000002)
93#define SND_AUDIOMODE_AMR_VAD2 ((__u32) 0x00000004)
94
95#define SND_AUDIOSTREAMFORMAT_UNDEFINED ((__u32) 0x00000000)
96#define SND_AUDIOSTREAMFORMAT_CONFORMANCE ((__u32) 0x00000001)
97#define SND_AUDIOSTREAMFORMAT_IF1 ((__u32) 0x00000002)
98#define SND_AUDIOSTREAMFORMAT_IF2 ((__u32) 0x00000004)
99#define SND_AUDIOSTREAMFORMAT_FSF ((__u32) 0x00000008)
100#define SND_AUDIOSTREAMFORMAT_RTPPAYLOAD ((__u32) 0x00000010)
101#define SND_AUDIOSTREAMFORMAT_ITU ((__u32) 0x00000020)
102
103#define SND_AUDIOPROFILE_AMRWB ((__u32) 0x00000001)
104
105/* AMRWB modes are only useful for encoders */
106#define SND_AUDIOMODE_AMRWB_DTX_OFF ((__u32) 0x00000001)
107#define SND_AUDIOMODE_AMRWB_VAD1 ((__u32) 0x00000002)
108#define SND_AUDIOMODE_AMRWB_VAD2 ((__u32) 0x00000004)
109
110#define SND_AUDIOPROFILE_AMRWBPLUS ((__u32) 0x00000001)
111
112#define SND_AUDIOPROFILE_AAC ((__u32) 0x00000001)
113
114/* AAC modes are required for encoders and decoders */
115#define SND_AUDIOMODE_AAC_MAIN ((__u32) 0x00000001)
116#define SND_AUDIOMODE_AAC_LC ((__u32) 0x00000002)
117#define SND_AUDIOMODE_AAC_SSR ((__u32) 0x00000004)
118#define SND_AUDIOMODE_AAC_LTP ((__u32) 0x00000008)
119#define SND_AUDIOMODE_AAC_HE ((__u32) 0x00000010)
120#define SND_AUDIOMODE_AAC_SCALABLE ((__u32) 0x00000020)
121#define SND_AUDIOMODE_AAC_ERLC ((__u32) 0x00000040)
122#define SND_AUDIOMODE_AAC_LD ((__u32) 0x00000080)
123#define SND_AUDIOMODE_AAC_HE_PS ((__u32) 0x00000100)
124#define SND_AUDIOMODE_AAC_HE_MPS ((__u32) 0x00000200)
125
126/* AAC formats are required for encoders and decoders */
127#define SND_AUDIOSTREAMFORMAT_MP2ADTS ((__u32) 0x00000001)
128#define SND_AUDIOSTREAMFORMAT_MP4ADTS ((__u32) 0x00000002)
129#define SND_AUDIOSTREAMFORMAT_MP4LOAS ((__u32) 0x00000004)
130#define SND_AUDIOSTREAMFORMAT_MP4LATM ((__u32) 0x00000008)
131#define SND_AUDIOSTREAMFORMAT_ADIF ((__u32) 0x00000010)
132#define SND_AUDIOSTREAMFORMAT_MP4FF ((__u32) 0x00000020)
133#define SND_AUDIOSTREAMFORMAT_RAW ((__u32) 0x00000040)
134
135#define SND_AUDIOPROFILE_WMA7 ((__u32) 0x00000001)
136#define SND_AUDIOPROFILE_WMA8 ((__u32) 0x00000002)
137#define SND_AUDIOPROFILE_WMA9 ((__u32) 0x00000004)
138#define SND_AUDIOPROFILE_WMA10 ((__u32) 0x00000008)
139
140#define SND_AUDIOMODE_WMA_LEVEL1 ((__u32) 0x00000001)
141#define SND_AUDIOMODE_WMA_LEVEL2 ((__u32) 0x00000002)
142#define SND_AUDIOMODE_WMA_LEVEL3 ((__u32) 0x00000004)
143#define SND_AUDIOMODE_WMA_LEVEL4 ((__u32) 0x00000008)
144#define SND_AUDIOMODE_WMAPRO_LEVELM0 ((__u32) 0x00000010)
145#define SND_AUDIOMODE_WMAPRO_LEVELM1 ((__u32) 0x00000020)
146#define SND_AUDIOMODE_WMAPRO_LEVELM2 ((__u32) 0x00000040)
147#define SND_AUDIOMODE_WMAPRO_LEVELM3 ((__u32) 0x00000080)
148
149#define SND_AUDIOSTREAMFORMAT_WMA_ASF ((__u32) 0x00000001)
150/*
151 * Some implementations strip the ASF header and only send ASF packets
152 * to the DSP
153 */
154#define SND_AUDIOSTREAMFORMAT_WMA_NOASF_HDR ((__u32) 0x00000002)
155
156#define SND_AUDIOPROFILE_REALAUDIO ((__u32) 0x00000001)
157
158#define SND_AUDIOMODE_REALAUDIO_G2 ((__u32) 0x00000001)
159#define SND_AUDIOMODE_REALAUDIO_8 ((__u32) 0x00000002)
160#define SND_AUDIOMODE_REALAUDIO_10 ((__u32) 0x00000004)
161#define SND_AUDIOMODE_REALAUDIO_SURROUND ((__u32) 0x00000008)
162
163#define SND_AUDIOPROFILE_VORBIS ((__u32) 0x00000001)
164
165#define SND_AUDIOMODE_VORBIS ((__u32) 0x00000001)
166
167#define SND_AUDIOPROFILE_FLAC ((__u32) 0x00000001)
168
169/*
170 * Define quality levels for FLAC encoders, from LEVEL0 (fast)
171 * to LEVEL8 (best)
172 */
173#define SND_AUDIOMODE_FLAC_LEVEL0 ((__u32) 0x00000001)
174#define SND_AUDIOMODE_FLAC_LEVEL1 ((__u32) 0x00000002)
175#define SND_AUDIOMODE_FLAC_LEVEL2 ((__u32) 0x00000004)
176#define SND_AUDIOMODE_FLAC_LEVEL3 ((__u32) 0x00000008)
177#define SND_AUDIOMODE_FLAC_LEVEL4 ((__u32) 0x00000010)
178#define SND_AUDIOMODE_FLAC_LEVEL5 ((__u32) 0x00000020)
179#define SND_AUDIOMODE_FLAC_LEVEL6 ((__u32) 0x00000040)
180#define SND_AUDIOMODE_FLAC_LEVEL7 ((__u32) 0x00000080)
181#define SND_AUDIOMODE_FLAC_LEVEL8 ((__u32) 0x00000100)
182
183#define SND_AUDIOSTREAMFORMAT_FLAC ((__u32) 0x00000001)
184#define SND_AUDIOSTREAMFORMAT_FLAC_OGG ((__u32) 0x00000002)
185
186/* IEC61937 payloads without CUVP and preambles */
187#define SND_AUDIOPROFILE_IEC61937 ((__u32) 0x00000001)
188/* IEC61937 with S/PDIF preambles+CUVP bits in 32-bit containers */
189#define SND_AUDIOPROFILE_IEC61937_SPDIF ((__u32) 0x00000002)
190
191/*
192 * IEC modes are mandatory for decoders. Format autodetection
193 * will only happen on the DSP side with mode 0. The PCM mode should
194 * not be used, the PCM codec should be used instead.
195 */
196#define SND_AUDIOMODE_IEC_REF_STREAM_HEADER ((__u32) 0x00000000)
197#define SND_AUDIOMODE_IEC_LPCM ((__u32) 0x00000001)
198#define SND_AUDIOMODE_IEC_AC3 ((__u32) 0x00000002)
199#define SND_AUDIOMODE_IEC_MPEG1 ((__u32) 0x00000004)
200#define SND_AUDIOMODE_IEC_MP3 ((__u32) 0x00000008)
201#define SND_AUDIOMODE_IEC_MPEG2 ((__u32) 0x00000010)
202#define SND_AUDIOMODE_IEC_AACLC ((__u32) 0x00000020)
203#define SND_AUDIOMODE_IEC_DTS ((__u32) 0x00000040)
204#define SND_AUDIOMODE_IEC_ATRAC ((__u32) 0x00000080)
205#define SND_AUDIOMODE_IEC_SACD ((__u32) 0x00000100)
206#define SND_AUDIOMODE_IEC_EAC3 ((__u32) 0x00000200)
207#define SND_AUDIOMODE_IEC_DTS_HD ((__u32) 0x00000400)
208#define SND_AUDIOMODE_IEC_MLP ((__u32) 0x00000800)
209#define SND_AUDIOMODE_IEC_DST ((__u32) 0x00001000)
210#define SND_AUDIOMODE_IEC_WMAPRO ((__u32) 0x00002000)
211#define SND_AUDIOMODE_IEC_REF_CXT ((__u32) 0x00004000)
212#define SND_AUDIOMODE_IEC_HE_AAC ((__u32) 0x00008000)
213#define SND_AUDIOMODE_IEC_HE_AAC2 ((__u32) 0x00010000)
214#define SND_AUDIOMODE_IEC_MPEG_SURROUND ((__u32) 0x00020000)
215
216#define SND_AUDIOPROFILE_G723_1 ((__u32) 0x00000001)
217
218#define SND_AUDIOMODE_G723_1_ANNEX_A ((__u32) 0x00000001)
219#define SND_AUDIOMODE_G723_1_ANNEX_B ((__u32) 0x00000002)
220#define SND_AUDIOMODE_G723_1_ANNEX_C ((__u32) 0x00000004)
221
222#define SND_AUDIOPROFILE_G729 ((__u32) 0x00000001)
223
224#define SND_AUDIOMODE_G729_ANNEX_A ((__u32) 0x00000001)
225#define SND_AUDIOMODE_G729_ANNEX_B ((__u32) 0x00000002)
226
227/* <FIXME: multichannel encoders aren't supported for now. Would need
228 an additional definition of channel arrangement> */
229
230/* VBR/CBR definitions */
231#define SND_RATECONTROLMODE_CONSTANTBITRATE ((__u32) 0x00000001)
232#define SND_RATECONTROLMODE_VARIABLEBITRATE ((__u32) 0x00000002)
233
234/* Encoder options */
235
236struct snd_enc_wma {
237 __u32 super_block_align; /* WMA Type-specific data */
238};
239
240
241/**
242 * struct snd_enc_vorbis
243 * @quality: Sets encoding quality to n, between -1 (low) and 10 (high).
244 * In the default mode of operation, the quality level is 3.
245 * Normal quality range is 0 - 10.
246 * @managed: Boolean. Set bitrate management mode. This turns off the
247 * normal VBR encoding, but allows hard or soft bitrate constraints to be
248 * enforced by the encoder. This mode can be slower, and may also be
249 * lower quality. It is primarily useful for streaming.
250 * @max_bit_rate: Enabled only if managed is TRUE
251 * @min_bit_rate: Enabled only if managed is TRUE
252 * @downmix: Boolean. Downmix input from stereo to mono (has no effect on
253 * non-stereo streams). Useful for lower-bitrate encoding.
254 *
255 * These options were extracted from the OpenMAX IL spec and Gstreamer vorbisenc
256 * properties
257 *
258 * For best quality users should specify VBR mode and set quality levels.
259 */
260
261struct snd_enc_vorbis {
262 __s32 quality;
263 __u32 managed;
264 __u32 max_bit_rate;
265 __u32 min_bit_rate;
266 __u32 downmix;
267};
268
269
270/**
271 * struct snd_enc_real
272 * @quant_bits: number of coupling quantization bits in the stream
273 * @start_region: coupling start region in the stream
274 * @num_regions: number of regions value
275 *
276 * These options were extracted from the OpenMAX IL spec
277 */
278
279struct snd_enc_real {
280 __u32 quant_bits;
281 __u32 start_region;
282 __u32 num_regions;
283};
284
285/**
286 * struct snd_enc_flac
287 * @num: serial number, valid only for OGG formats
288 * needs to be set by application
289 * @gain: Add replay gain tags
290 *
291 * These options were extracted from the FLAC online documentation
292 * at http://flac.sourceforge.net/documentation_tools_flac.html
293 *
294 * To make the API simpler, it is assumed that the user will select quality
295 * profiles. Additional options that affect encoding quality and speed can
296 * be added at a later stage if needed.
297 *
298 * By default the Subset format is used by encoders.
299 *
300 * TAGS such as pictures, etc, cannot be handled by an offloaded encoder and are
301 * not supported in this API.
302 */
303
304struct snd_enc_flac {
305 __u32 num;
306 __u32 gain;
307};
308
309struct snd_enc_generic {
310 __u32 bw; /* encoder bandwidth */
311 __s32 reserved[15];
312};
313
314union snd_codec_options {
315 struct snd_enc_wma wma;
316 struct snd_enc_vorbis vorbis;
317 struct snd_enc_real real;
318 struct snd_enc_flac flac;
319 struct snd_enc_generic generic;
320};
321
322/** struct snd_codec_desc - description of codec capabilities
323 * @max_ch: Maximum number of audio channels
324 * @sample_rates: Sampling rates in Hz, use SNDRV_PCM_RATE_xxx for this
325 * @bit_rate: Indexed array containing supported bit rates
326 * @num_bitrates: Number of valid values in bit_rate array
327 * @rate_control: value is specified by SND_RATECONTROLMODE defines.
328 * @profiles: Supported profiles. See SND_AUDIOPROFILE defines.
329 * @modes: Supported modes. See SND_AUDIOMODE defines
330 * @formats: Supported formats. See SND_AUDIOSTREAMFORMAT defines
331 * @min_buffer: Minimum buffer size handled by codec implementation
332 * @reserved: reserved for future use
333 *
334 * This structure provides a scalar value for profiles, modes and stream
335 * format fields.
336 * If an implementation supports multiple combinations, they will be listed as
337 * codecs with different descriptors, for example there would be 2 descriptors
338 * for AAC-RAW and AAC-ADTS.
339 * This entails some redundancy but makes it easier to avoid invalid
340 * configurations.
341 *
342 */
343
344struct snd_codec_desc {
345 __u32 max_ch;
346 __u32 sample_rates;
347 __u32 bit_rate[MAX_NUM_BITRATES];
348 __u32 num_bitrates;
349 __u32 rate_control;
350 __u32 profiles;
351 __u32 modes;
352 __u32 formats;
353 __u32 min_buffer;
354 __u32 reserved[15];
355};
356
357/** struct snd_codec
358 * @id: Identifies the supported audio encoder/decoder.
359 * See SND_AUDIOCODEC macros.
360 * @ch_in: Number of input audio channels
361 * @ch_out: Number of output channels. In case of contradiction between
362 * this field and the channelMode field, the channelMode field
363 * overrides.
364 * @sample_rate: Audio sample rate of input data
365 * @bit_rate: Bitrate of encoded data. May be ignored by decoders
366 * @rate_control: Encoding rate control. See SND_RATECONTROLMODE defines.
367 * Encoders may rely on profiles for quality levels.
368 * May be ignored by decoders.
369 * @profile: Mandatory for encoders, can be mandatory for specific
370 * decoders as well. See SND_AUDIOPROFILE defines.
371 * @level: Supported level (Only used by WMA at the moment)
372 * @ch_mode: Channel mode for encoder. See SND_AUDIOCHANMODE defines
373 * @format: Format of encoded bistream. Mandatory when defined.
374 * See SND_AUDIOSTREAMFORMAT defines.
375 * @align: Block alignment in bytes of an audio sample.
376 * Only required for PCM or IEC formats.
377 * @options: encoder-specific settings
378 * @reserved: reserved for future use
379 */
380
381struct snd_codec {
382 __u32 id;
383 __u32 ch_in;
384 __u32 ch_out;
385 __u32 sample_rate;
386 __u32 bit_rate;
387 __u32 rate_control;
388 __u32 profile;
389 __u32 level;
390 __u32 ch_mode;
391 __u32 format;
392 __u32 align;
393 union snd_codec_options options;
394 __u32 reserved[3];
395};
396
397#endif
diff --git a/include/sound/control.h b/include/sound/control.h
index 1a94a216ed99..b2796e83c7ac 100644
--- a/include/sound/control.h
+++ b/include/sound/control.h
@@ -227,4 +227,12 @@ snd_ctl_add_slave_uncached(struct snd_kcontrol *master,
227 return _snd_ctl_add_slave(master, slave, SND_CTL_SLAVE_NEED_UPDATE); 227 return _snd_ctl_add_slave(master, slave, SND_CTL_SLAVE_NEED_UPDATE);
228} 228}
229 229
230/*
231 * Helper functions for jack-detection controls
232 */
233struct snd_kcontrol *
234snd_kctl_jack_new(const char *name, int idx, void *private_data);
235void snd_kctl_jack_report(struct snd_card *card,
236 struct snd_kcontrol *kctl, bool status);
237
230#endif /* __SOUND_CONTROL_H */ 238#endif /* __SOUND_CONTROL_H */
diff --git a/include/sound/core.h b/include/sound/core.h
index 3be5ab782b99..cea1b5426dfa 100644
--- a/include/sound/core.h
+++ b/include/sound/core.h
@@ -62,6 +62,7 @@ typedef int __bitwise snd_device_type_t;
62#define SNDRV_DEV_BUS ((__force snd_device_type_t) 0x1007) 62#define SNDRV_DEV_BUS ((__force snd_device_type_t) 0x1007)
63#define SNDRV_DEV_CODEC ((__force snd_device_type_t) 0x1008) 63#define SNDRV_DEV_CODEC ((__force snd_device_type_t) 0x1008)
64#define SNDRV_DEV_JACK ((__force snd_device_type_t) 0x1009) 64#define SNDRV_DEV_JACK ((__force snd_device_type_t) 0x1009)
65#define SNDRV_DEV_COMPRESS ((__force snd_device_type_t) 0x100A)
65#define SNDRV_DEV_LOWLEVEL ((__force snd_device_type_t) 0x2000) 66#define SNDRV_DEV_LOWLEVEL ((__force snd_device_type_t) 0x2000)
66 67
67typedef int __bitwise snd_device_state_t; 68typedef int __bitwise snd_device_state_t;
@@ -416,6 +417,7 @@ static inline int __snd_bug_on(int cond)
416#define gameport_get_port_data(gp) (gp)->port_data 417#define gameport_get_port_data(gp) (gp)->port_data
417#endif 418#endif
418 419
420#ifdef CONFIG_PCI
419/* PCI quirk list helper */ 421/* PCI quirk list helper */
420struct snd_pci_quirk { 422struct snd_pci_quirk {
421 unsigned short subvendor; /* PCI subvendor ID */ 423 unsigned short subvendor; /* PCI subvendor ID */
@@ -455,5 +457,6 @@ snd_pci_quirk_lookup(struct pci_dev *pci, const struct snd_pci_quirk *list);
455const struct snd_pci_quirk * 457const struct snd_pci_quirk *
456snd_pci_quirk_lookup_id(u16 vendor, u16 device, 458snd_pci_quirk_lookup_id(u16 vendor, u16 device,
457 const struct snd_pci_quirk *list); 459 const struct snd_pci_quirk *list);
460#endif
458 461
459#endif /* __SOUND_CORE_H */ 462#endif /* __SOUND_CORE_H */
diff --git a/include/sound/minors.h b/include/sound/minors.h
index 8f764204a856..5978f9a8c8b2 100644
--- a/include/sound/minors.h
+++ b/include/sound/minors.h
@@ -35,7 +35,7 @@
35#define SNDRV_MINOR_TIMER 33 /* SNDRV_MINOR_GLOBAL + 1 * 32 */ 35#define SNDRV_MINOR_TIMER 33 /* SNDRV_MINOR_GLOBAL + 1 * 32 */
36 36
37#ifndef CONFIG_SND_DYNAMIC_MINORS 37#ifndef CONFIG_SND_DYNAMIC_MINORS
38 /* 2 - 3 (reserved) */ 38#define SNDRV_MINOR_COMPRESS 2 /* 2 - 3 */
39#define SNDRV_MINOR_HWDEP 4 /* 4 - 7 */ 39#define SNDRV_MINOR_HWDEP 4 /* 4 - 7 */
40#define SNDRV_MINOR_RAWMIDI 8 /* 8 - 15 */ 40#define SNDRV_MINOR_RAWMIDI 8 /* 8 - 15 */
41#define SNDRV_MINOR_PCM_PLAYBACK 16 /* 16 - 23 */ 41#define SNDRV_MINOR_PCM_PLAYBACK 16 /* 16 - 23 */
@@ -49,6 +49,7 @@
49#define SNDRV_DEVICE_TYPE_PCM_CAPTURE SNDRV_MINOR_PCM_CAPTURE 49#define SNDRV_DEVICE_TYPE_PCM_CAPTURE SNDRV_MINOR_PCM_CAPTURE
50#define SNDRV_DEVICE_TYPE_SEQUENCER SNDRV_MINOR_SEQUENCER 50#define SNDRV_DEVICE_TYPE_SEQUENCER SNDRV_MINOR_SEQUENCER
51#define SNDRV_DEVICE_TYPE_TIMER SNDRV_MINOR_TIMER 51#define SNDRV_DEVICE_TYPE_TIMER SNDRV_MINOR_TIMER
52#define SNDRV_DEVICE_TYPE_COMPRESS SNDRV_MINOR_COMPRESS
52 53
53#else /* CONFIG_SND_DYNAMIC_MINORS */ 54#else /* CONFIG_SND_DYNAMIC_MINORS */
54 55
@@ -60,6 +61,7 @@ enum {
60 SNDRV_DEVICE_TYPE_RAWMIDI, 61 SNDRV_DEVICE_TYPE_RAWMIDI,
61 SNDRV_DEVICE_TYPE_PCM_PLAYBACK, 62 SNDRV_DEVICE_TYPE_PCM_PLAYBACK,
62 SNDRV_DEVICE_TYPE_PCM_CAPTURE, 63 SNDRV_DEVICE_TYPE_PCM_CAPTURE,
64 SNDRV_DEVICE_TYPE_COMPRESS,
63}; 65};
64 66
65#endif /* CONFIG_SND_DYNAMIC_MINORS */ 67#endif /* CONFIG_SND_DYNAMIC_MINORS */
diff --git a/include/sound/saif.h b/include/sound/saif.h
index d0e0de7984ec..f22f3e16edf4 100644
--- a/include/sound/saif.h
+++ b/include/sound/saif.h
@@ -10,7 +10,7 @@
10#define __SOUND_SAIF_H__ 10#define __SOUND_SAIF_H__
11 11
12struct mxs_saif_platform_data { 12struct mxs_saif_platform_data {
13 int (*init) (void); 13 bool master_mode; /* if true use master mode */
14 int (*get_master_id) (unsigned int saif_id); 14 int master_id; /* id of the master if in slave mode */
15}; 15};
16#endif 16#endif
diff --git a/include/sound/sh_fsi.h b/include/sound/sh_fsi.h
index 9a155f9d0a12..9b1aacaa82fe 100644
--- a/include/sound/sh_fsi.h
+++ b/include/sound/sh_fsi.h
@@ -78,4 +78,16 @@ struct sh_fsi_platform_info {
78 int (*set_rate)(struct device *dev, int is_porta, int rate, int enable); 78 int (*set_rate)(struct device *dev, int is_porta, int rate, int enable);
79}; 79};
80 80
81/*
82 * for fsi-ak4642
83 */
84struct fsi_ak4642_info {
85 const char *name;
86 const char *card;
87 const char *cpu_dai;
88 const char *codec;
89 const char *platform;
90 int id;
91};
92
81#endif /* __SOUND_FSI_H */ 93#endif /* __SOUND_FSI_H */
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index 17a4c17f19f5..d26a9b784772 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -43,6 +43,9 @@
43 .num_kcontrols = 0} 43 .num_kcontrols = 0}
44 44
45/* platform domain */ 45/* platform domain */
46#define SND_SOC_DAPM_SIGGEN(wname) \
47{ .id = snd_soc_dapm_siggen, .name = wname, .kcontrol_news = NULL, \
48 .num_kcontrols = 0, .reg = SND_SOC_NOPM }
46#define SND_SOC_DAPM_INPUT(wname) \ 49#define SND_SOC_DAPM_INPUT(wname) \
47{ .id = snd_soc_dapm_input, .name = wname, .kcontrol_news = NULL, \ 50{ .id = snd_soc_dapm_input, .name = wname, .kcontrol_news = NULL, \
48 .num_kcontrols = 0, .reg = SND_SOC_NOPM } 51 .num_kcontrols = 0, .reg = SND_SOC_NOPM }
@@ -380,6 +383,7 @@ int snd_soc_dapm_force_enable_pin(struct snd_soc_dapm_context *dapm,
380 const char *pin); 383 const char *pin);
381int snd_soc_dapm_ignore_suspend(struct snd_soc_dapm_context *dapm, 384int snd_soc_dapm_ignore_suspend(struct snd_soc_dapm_context *dapm,
382 const char *pin); 385 const char *pin);
386void snd_soc_dapm_auto_nc_codec_pins(struct snd_soc_codec *codec);
383 387
384/* Mostly internal - should not normally be used */ 388/* Mostly internal - should not normally be used */
385void dapm_mark_dirty(struct snd_soc_dapm_widget *w, const char *reason); 389void dapm_mark_dirty(struct snd_soc_dapm_widget *w, const char *reason);
@@ -409,6 +413,7 @@ enum snd_soc_dapm_type {
409 snd_soc_dapm_supply, /* power/clock supply */ 413 snd_soc_dapm_supply, /* power/clock supply */
410 snd_soc_dapm_aif_in, /* audio interface input */ 414 snd_soc_dapm_aif_in, /* audio interface input */
411 snd_soc_dapm_aif_out, /* audio interface output */ 415 snd_soc_dapm_aif_out, /* audio interface output */
416 snd_soc_dapm_siggen, /* signal generator */
412}; 417};
413 418
414/* 419/*
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 11cfb5953e06..0992dff55959 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -231,6 +231,7 @@ enum snd_soc_bias_level {
231 SND_SOC_BIAS_ON = 3, 231 SND_SOC_BIAS_ON = 3,
232}; 232};
233 233
234struct device_node;
234struct snd_jack; 235struct snd_jack;
235struct snd_soc_card; 236struct snd_soc_card;
236struct snd_soc_pcm_stream; 237struct snd_soc_pcm_stream;
@@ -266,8 +267,6 @@ enum snd_soc_control_type {
266 267
267enum snd_soc_compress_type { 268enum snd_soc_compress_type {
268 SND_SOC_FLAT_COMPRESSION = 1, 269 SND_SOC_FLAT_COMPRESSION = 1,
269 SND_SOC_LZO_COMPRESSION,
270 SND_SOC_RBTREE_COMPRESSION
271}; 270};
272 271
273enum snd_soc_pcm_subclass { 272enum snd_soc_pcm_subclass {
@@ -318,6 +317,7 @@ int snd_soc_platform_read(struct snd_soc_platform *platform,
318 unsigned int reg); 317 unsigned int reg);
319int snd_soc_platform_write(struct snd_soc_platform *platform, 318int snd_soc_platform_write(struct snd_soc_platform *platform,
320 unsigned int reg, unsigned int val); 319 unsigned int reg, unsigned int val);
320int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num);
321 321
322/* Utility functions to get clock rates from various things */ 322/* Utility functions to get clock rates from various things */
323int snd_soc_calc_frame_size(int sample_size, int channels, int tdm_slots); 323int snd_soc_calc_frame_size(int sample_size, int channels, int tdm_slots);
@@ -593,8 +593,7 @@ struct snd_soc_codec_driver {
593 /* driver ops */ 593 /* driver ops */
594 int (*probe)(struct snd_soc_codec *); 594 int (*probe)(struct snd_soc_codec *);
595 int (*remove)(struct snd_soc_codec *); 595 int (*remove)(struct snd_soc_codec *);
596 int (*suspend)(struct snd_soc_codec *, 596 int (*suspend)(struct snd_soc_codec *);
597 pm_message_t state);
598 int (*resume)(struct snd_soc_codec *); 597 int (*resume)(struct snd_soc_codec *);
599 598
600 /* Default control and setup, added after probe() is run */ 599 /* Default control and setup, added after probe() is run */
@@ -706,8 +705,11 @@ struct snd_soc_dai_link {
706 const char *name; /* Codec name */ 705 const char *name; /* Codec name */
707 const char *stream_name; /* Stream name */ 706 const char *stream_name; /* Stream name */
708 const char *codec_name; /* for multi-codec */ 707 const char *codec_name; /* for multi-codec */
708 const struct device_node *codec_of_node;
709 const char *platform_name; /* for multi-platform */ 709 const char *platform_name; /* for multi-platform */
710 const struct device_node *platform_of_node;
710 const char *cpu_dai_name; 711 const char *cpu_dai_name;
712 const struct device_node *cpu_dai_of_node;
711 const char *codec_dai_name; 713 const char *codec_dai_name;
712 714
713 unsigned int dai_fmt; /* format to set on init */ 715 unsigned int dai_fmt; /* format to set on init */
@@ -718,6 +720,9 @@ struct snd_soc_dai_link {
718 /* Symmetry requirements */ 720 /* Symmetry requirements */
719 unsigned int symmetric_rates:1; 721 unsigned int symmetric_rates:1;
720 722
723 /* pmdown_time is ignored at stop */
724 unsigned int ignore_pmdown_time:1;
725
721 /* codec/machine specific init - e.g. add machine controls */ 726 /* codec/machine specific init - e.g. add machine controls */
722 int (*init)(struct snd_soc_pcm_runtime *rtd); 727 int (*init)(struct snd_soc_pcm_runtime *rtd);
723 728
@@ -813,6 +818,7 @@ struct snd_soc_card {
813 int num_dapm_widgets; 818 int num_dapm_widgets;
814 const struct snd_soc_dapm_route *dapm_routes; 819 const struct snd_soc_dapm_route *dapm_routes;
815 int num_dapm_routes; 820 int num_dapm_routes;
821 bool fully_routed;
816 822
817 struct work_struct deferred_resume_work; 823 struct work_struct deferred_resume_work;
818 824
@@ -840,8 +846,8 @@ struct snd_soc_card {
840}; 846};
841 847
842/* SoC machine DAI configuration, glues a codec and cpu DAI together */ 848/* SoC machine DAI configuration, glues a codec and cpu DAI together */
843struct snd_soc_pcm_runtime { 849struct snd_soc_pcm_runtime {
844 struct device dev; 850 struct device *dev;
845 struct snd_soc_card *card; 851 struct snd_soc_card *card;
846 struct snd_soc_dai_link *dai_link; 852 struct snd_soc_dai_link *dai_link;
847 struct mutex pcm_mutex; 853 struct mutex pcm_mutex;
@@ -927,12 +933,12 @@ static inline void *snd_soc_platform_get_drvdata(struct snd_soc_platform *platfo
927static inline void snd_soc_pcm_set_drvdata(struct snd_soc_pcm_runtime *rtd, 933static inline void snd_soc_pcm_set_drvdata(struct snd_soc_pcm_runtime *rtd,
928 void *data) 934 void *data)
929{ 935{
930 dev_set_drvdata(&rtd->dev, data); 936 dev_set_drvdata(rtd->dev, data);
931} 937}
932 938
933static inline void *snd_soc_pcm_get_drvdata(struct snd_soc_pcm_runtime *rtd) 939static inline void *snd_soc_pcm_get_drvdata(struct snd_soc_pcm_runtime *rtd)
934{ 940{
935 return dev_get_drvdata(&rtd->dev); 941 return dev_get_drvdata(rtd->dev);
936} 942}
937 943
938static inline void snd_soc_initialize_card_lists(struct snd_soc_card *card) 944static inline void snd_soc_initialize_card_lists(struct snd_soc_card *card)
@@ -960,6 +966,11 @@ static inline bool snd_soc_volsw_is_stereo(struct soc_mixer_control *mc)
960int snd_soc_util_init(void); 966int snd_soc_util_init(void);
961void snd_soc_util_exit(void); 967void snd_soc_util_exit(void);
962 968
969int snd_soc_of_parse_card_name(struct snd_soc_card *card,
970 const char *propname);
971int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
972 const char *propname);
973
963#include <sound/soc-dai.h> 974#include <sound/soc-dai.h>
964 975
965#ifdef CONFIG_DEBUG_FS 976#ifdef CONFIG_DEBUG_FS
diff --git a/include/sound/sta32x.h b/include/sound/sta32x.h
new file mode 100644
index 000000000000..8d93b0357a14
--- /dev/null
+++ b/include/sound/sta32x.h
@@ -0,0 +1,35 @@
1/*
2 * Platform data for ST STA32x ASoC codec driver.
3 *
4 * Copyright: 2011 Raumfeld GmbH
5 * Author: Johannes Stezenbach <js@sig21.net>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 */
12#ifndef __LINUX_SND__STA32X_H
13#define __LINUX_SND__STA32X_H
14
15#define STA32X_OCFG_2CH 0
16#define STA32X_OCFG_2_1CH 1
17#define STA32X_OCFG_1CH 3
18
19#define STA32X_OM_CH1 0
20#define STA32X_OM_CH2 1
21#define STA32X_OM_CH3 2
22
23#define STA32X_THERMAL_ADJUSTMENT_ENABLE 1
24#define STA32X_THERMAL_RECOVERY_ENABLE 2
25
26struct sta32x_platform_data {
27 int output_conf;
28 int ch1_output_mapping;
29 int ch2_output_mapping;
30 int ch3_output_mapping;
31 int thermal_conf;
32 int needs_esd_watchdog;
33};
34
35#endif /* __LINUX_SND__STA32X_H */
diff --git a/include/sound/wm8903.h b/include/sound/wm8903.h
index cf7ccb76a8de..b310c5a3a958 100644
--- a/include/sound/wm8903.h
+++ b/include/sound/wm8903.h
@@ -11,8 +11,11 @@
11#ifndef __LINUX_SND_WM8903_H 11#ifndef __LINUX_SND_WM8903_H
12#define __LINUX_SND_WM8903_H 12#define __LINUX_SND_WM8903_H
13 13
14/* Used to enable configuration of a GPIO to all zeros */ 14/*
15#define WM8903_GPIO_NO_CONFIG 0x8000 15 * Used to enable configuration of a GPIO to all zeros; a gpio_cfg value of
16 * zero in platform data means "don't touch this pin".
17 */
18#define WM8903_GPIO_CONFIG_ZERO 0x8000
16 19
17/* 20/*
18 * R6 (0x06) - Mic Bias Control 0 21 * R6 (0x06) - Mic Bias Control 0
diff --git a/include/target/target_core_backend.h b/include/target/target_core_backend.h
new file mode 100644
index 000000000000..4866499bdeeb
--- /dev/null
+++ b/include/target/target_core_backend.h
@@ -0,0 +1,65 @@
1#ifndef TARGET_CORE_BACKEND_H
2#define TARGET_CORE_BACKEND_H
3
4#define TRANSPORT_PLUGIN_PHBA_PDEV 1
5#define TRANSPORT_PLUGIN_VHBA_PDEV 2
6#define TRANSPORT_PLUGIN_VHBA_VDEV 3
7
8struct se_subsystem_api {
9 struct list_head sub_api_list;
10
11 char name[16];
12 struct module *owner;
13
14 u8 transport_type;
15
16 unsigned int fua_write_emulated : 1;
17 unsigned int write_cache_emulated : 1;
18
19 int (*attach_hba)(struct se_hba *, u32);
20 void (*detach_hba)(struct se_hba *);
21 int (*pmode_enable_hba)(struct se_hba *, unsigned long);
22 void *(*allocate_virtdevice)(struct se_hba *, const char *);
23 struct se_device *(*create_virtdevice)(struct se_hba *,
24 struct se_subsystem_dev *, void *);
25 void (*free_device)(void *);
26 int (*transport_complete)(struct se_task *task);
27 struct se_task *(*alloc_task)(unsigned char *cdb);
28 int (*do_task)(struct se_task *);
29 int (*do_discard)(struct se_device *, sector_t, u32);
30 void (*do_sync_cache)(struct se_task *);
31 void (*free_task)(struct se_task *);
32 ssize_t (*check_configfs_dev_params)(struct se_hba *,
33 struct se_subsystem_dev *);
34 ssize_t (*set_configfs_dev_params)(struct se_hba *,
35 struct se_subsystem_dev *, const char *, ssize_t);
36 ssize_t (*show_configfs_dev_params)(struct se_hba *,
37 struct se_subsystem_dev *, char *);
38 u32 (*get_device_rev)(struct se_device *);
39 u32 (*get_device_type)(struct se_device *);
40 sector_t (*get_blocks)(struct se_device *);
41 unsigned char *(*get_sense_buffer)(struct se_task *);
42};
43
44int transport_subsystem_register(struct se_subsystem_api *);
45void transport_subsystem_release(struct se_subsystem_api *);
46
47struct se_device *transport_add_device_to_core_hba(struct se_hba *,
48 struct se_subsystem_api *, struct se_subsystem_dev *, u32,
49 void *, struct se_dev_limits *, const char *, const char *);
50
51void transport_complete_sync_cache(struct se_cmd *, int);
52void transport_complete_task(struct se_task *, int);
53
54void target_get_task_cdb(struct se_task *, unsigned char *);
55
56void transport_set_vpd_proto_id(struct t10_vpd *, unsigned char *);
57int transport_set_vpd_assoc(struct t10_vpd *, unsigned char *);
58int transport_set_vpd_ident_type(struct t10_vpd *, unsigned char *);
59int transport_set_vpd_ident(struct t10_vpd *, unsigned char *);
60
61/* core helpers also used by command snooping in pscsi */
62void *transport_kmap_first_data_page(struct se_cmd *);
63void transport_kunmap_first_data_page(struct se_cmd *);
64
65#endif /* TARGET_CORE_BACKEND_H */
diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h
index 6873c7dd9145..daf532bc721a 100644
--- a/include/target/target_core_base.h
+++ b/include/target/target_core_base.h
@@ -10,6 +10,7 @@
10#include <net/tcp.h> 10#include <net/tcp.h>
11 11
12#define TARGET_CORE_MOD_VERSION "v4.1.0-rc1-ml" 12#define TARGET_CORE_MOD_VERSION "v4.1.0-rc1-ml"
13#define TARGET_CORE_VERSION TARGET_CORE_MOD_VERSION
13 14
14/* Maximum Number of LUNs per Target Portal Group */ 15/* Maximum Number of LUNs per Target Portal Group */
15/* Don't raise above 511 or REPORT_LUNS needs to handle >1 page */ 16/* Don't raise above 511 or REPORT_LUNS needs to handle >1 page */
@@ -34,6 +35,7 @@
34#define TRANSPORT_SENSE_BUFFER SCSI_SENSE_BUFFERSIZE 35#define TRANSPORT_SENSE_BUFFER SCSI_SENSE_BUFFERSIZE
35/* Used by transport_send_check_condition_and_sense() */ 36/* Used by transport_send_check_condition_and_sense() */
36#define SPC_SENSE_KEY_OFFSET 2 37#define SPC_SENSE_KEY_OFFSET 2
38#define SPC_ADD_SENSE_LEN_OFFSET 7
37#define SPC_ASC_KEY_OFFSET 12 39#define SPC_ASC_KEY_OFFSET 12
38#define SPC_ASCQ_KEY_OFFSET 13 40#define SPC_ASCQ_KEY_OFFSET 13
39#define TRANSPORT_IQN_LEN 224 41#define TRANSPORT_IQN_LEN 224
@@ -53,6 +55,72 @@
53/* Used by transport_get_inquiry_vpd_device_ident() */ 55/* Used by transport_get_inquiry_vpd_device_ident() */
54#define INQUIRY_VPD_DEVICE_IDENTIFIER_LEN 254 56#define INQUIRY_VPD_DEVICE_IDENTIFIER_LEN 254
55 57
58/* Attempts before moving from SHORT to LONG */
59#define PYX_TRANSPORT_WINDOW_CLOSED_THRESHOLD 3
60#define PYX_TRANSPORT_WINDOW_CLOSED_WAIT_SHORT 3 /* In milliseconds */
61#define PYX_TRANSPORT_WINDOW_CLOSED_WAIT_LONG 10 /* In milliseconds */
62
63#define PYX_TRANSPORT_STATUS_INTERVAL 5 /* In seconds */
64
65/*
66 * struct se_subsystem_dev->su_dev_flags
67*/
68#define SDF_FIRMWARE_VPD_UNIT_SERIAL 0x00000001
69#define SDF_EMULATED_VPD_UNIT_SERIAL 0x00000002
70#define SDF_USING_UDEV_PATH 0x00000004
71#define SDF_USING_ALIAS 0x00000008
72
73/*
74 * struct se_device->dev_flags
75 */
76#define DF_READ_ONLY 0x00000001
77#define DF_SPC2_RESERVATIONS 0x00000002
78#define DF_SPC2_RESERVATIONS_WITH_ISID 0x00000004
79
80/* struct se_dev_attrib sanity values */
81/* Default max_unmap_lba_count */
82#define DA_MAX_UNMAP_LBA_COUNT 0
83/* Default max_unmap_block_desc_count */
84#define DA_MAX_UNMAP_BLOCK_DESC_COUNT 0
85/* Default unmap_granularity */
86#define DA_UNMAP_GRANULARITY_DEFAULT 0
87/* Default unmap_granularity_alignment */
88#define DA_UNMAP_GRANULARITY_ALIGNMENT_DEFAULT 0
89/* Emulation for Direct Page Out */
90#define DA_EMULATE_DPO 0
91/* Emulation for Forced Unit Access WRITEs */
92#define DA_EMULATE_FUA_WRITE 1
93/* Emulation for Forced Unit Access READs */
94#define DA_EMULATE_FUA_READ 0
95/* Emulation for WriteCache and SYNCHRONIZE_CACHE */
96#define DA_EMULATE_WRITE_CACHE 0
97/* Emulation for UNIT ATTENTION Interlock Control */
98#define DA_EMULATE_UA_INTLLCK_CTRL 0
99/* Emulation for TASK_ABORTED status (TAS) by default */
100#define DA_EMULATE_TAS 1
101/* Emulation for Thin Provisioning UNMAP using block/blk-lib.c:blkdev_issue_discard() */
102#define DA_EMULATE_TPU 0
103/*
104 * Emulation for Thin Provisioning WRITE_SAME w/ UNMAP=1 bit using
105 * block/blk-lib.c:blkdev_issue_discard()
106 */
107#define DA_EMULATE_TPWS 0
108/* No Emulation for PSCSI by default */
109#define DA_EMULATE_RESERVATIONS 0
110/* No Emulation for PSCSI by default */
111#define DA_EMULATE_ALUA 0
112/* Enforce SCSI Initiator Port TransportID with 'ISID' for PR */
113#define DA_ENFORCE_PR_ISIDS 1
114#define DA_STATUS_MAX_SECTORS_MIN 16
115#define DA_STATUS_MAX_SECTORS_MAX 8192
116/* By default don't report non-rotating (solid state) medium */
117#define DA_IS_NONROT 0
118/* Queue Algorithm Modifier default for restricted reordering in control mode page */
119#define DA_EMULATE_REST_REORD 0
120
121#define SE_MODE_PAGE_BUF 512
122
123
56/* struct se_hba->hba_flags */ 124/* struct se_hba->hba_flags */
57enum hba_flags_table { 125enum hba_flags_table {
58 HBA_FLAGS_INTERNAL_USE = 0x01, 126 HBA_FLAGS_INTERNAL_USE = 0x01,
@@ -71,11 +139,12 @@ enum transport_tpg_type_table {
71 TRANSPORT_TPG_TYPE_DISCOVERY = 1, 139 TRANSPORT_TPG_TYPE_DISCOVERY = 1,
72}; 140};
73 141
74/* Used for generate timer flags */ 142/* struct se_task->task_flags */
75enum se_task_flags { 143enum se_task_flags {
76 TF_ACTIVE = (1 << 0), 144 TF_ACTIVE = (1 << 0),
77 TF_SENT = (1 << 1), 145 TF_SENT = (1 << 1),
78 TF_REQUEST_STOP = (1 << 2), 146 TF_REQUEST_STOP = (1 << 2),
147 TF_HAS_SENSE = (1 << 3),
79}; 148};
80 149
81/* Special transport agnostic struct se_cmd->t_states */ 150/* Special transport agnostic struct se_cmd->t_states */
@@ -158,9 +227,38 @@ enum tcm_sense_reason_table {
158 TCM_RESERVATION_CONFLICT = 0x10, 227 TCM_RESERVATION_CONFLICT = 0x10,
159}; 228};
160 229
230enum target_sc_flags_table {
231 TARGET_SCF_BIDI_OP = 0x01,
232 TARGET_SCF_ACK_KREF = 0x02,
233};
234
235/* fabric independent task management function values */
236enum tcm_tmreq_table {
237 TMR_ABORT_TASK = 1,
238 TMR_ABORT_TASK_SET = 2,
239 TMR_CLEAR_ACA = 3,
240 TMR_CLEAR_TASK_SET = 4,
241 TMR_LUN_RESET = 5,
242 TMR_TARGET_WARM_RESET = 6,
243 TMR_TARGET_COLD_RESET = 7,
244 TMR_FABRIC_TMR = 255,
245};
246
247/* fabric independent task management response values */
248enum tcm_tmrsp_table {
249 TMR_FUNCTION_COMPLETE = 0,
250 TMR_TASK_DOES_NOT_EXIST = 1,
251 TMR_LUN_DOES_NOT_EXIST = 2,
252 TMR_TASK_STILL_ALLEGIANT = 3,
253 TMR_TASK_FAILOVER_NOT_SUPPORTED = 4,
254 TMR_TASK_MGMT_FUNCTION_NOT_SUPPORTED = 5,
255 TMR_FUNCTION_AUTHORIZATION_FAILED = 6,
256 TMR_FUNCTION_REJECTED = 255,
257};
258
161struct se_obj { 259struct se_obj {
162 atomic_t obj_access_count; 260 atomic_t obj_access_count;
163} ____cacheline_aligned; 261};
164 262
165/* 263/*
166 * Used by TCM Core internally to signal if ALUA emulation is enabled or 264 * Used by TCM Core internally to signal if ALUA emulation is enabled or
@@ -207,7 +305,7 @@ struct t10_alua {
207 struct config_group alua_tg_pt_gps_group; 305 struct config_group alua_tg_pt_gps_group;
208 int (*alua_state_check)(struct se_cmd *, unsigned char *, u8 *); 306 int (*alua_state_check)(struct se_cmd *, unsigned char *, u8 *);
209 struct list_head tg_pt_gps_list; 307 struct list_head tg_pt_gps_list;
210} ____cacheline_aligned; 308};
211 309
212struct t10_alua_lu_gp { 310struct t10_alua_lu_gp {
213 u16 lu_gp_id; 311 u16 lu_gp_id;
@@ -218,7 +316,7 @@ struct t10_alua_lu_gp {
218 struct config_group lu_gp_group; 316 struct config_group lu_gp_group;
219 struct list_head lu_gp_node; 317 struct list_head lu_gp_node;
220 struct list_head lu_gp_mem_list; 318 struct list_head lu_gp_mem_list;
221} ____cacheline_aligned; 319};
222 320
223struct t10_alua_lu_gp_member { 321struct t10_alua_lu_gp_member {
224 bool lu_gp_assoc; 322 bool lu_gp_assoc;
@@ -227,7 +325,7 @@ struct t10_alua_lu_gp_member {
227 struct t10_alua_lu_gp *lu_gp; 325 struct t10_alua_lu_gp *lu_gp;
228 struct se_device *lu_gp_mem_dev; 326 struct se_device *lu_gp_mem_dev;
229 struct list_head lu_gp_mem_list; 327 struct list_head lu_gp_mem_list;
230} ____cacheline_aligned; 328};
231 329
232struct t10_alua_tg_pt_gp { 330struct t10_alua_tg_pt_gp {
233 u16 tg_pt_gp_id; 331 u16 tg_pt_gp_id;
@@ -250,7 +348,7 @@ struct t10_alua_tg_pt_gp {
250 struct config_group tg_pt_gp_group; 348 struct config_group tg_pt_gp_group;
251 struct list_head tg_pt_gp_list; 349 struct list_head tg_pt_gp_list;
252 struct list_head tg_pt_gp_mem_list; 350 struct list_head tg_pt_gp_mem_list;
253} ____cacheline_aligned; 351};
254 352
255struct t10_alua_tg_pt_gp_member { 353struct t10_alua_tg_pt_gp_member {
256 bool tg_pt_gp_assoc; 354 bool tg_pt_gp_assoc;
@@ -259,7 +357,7 @@ struct t10_alua_tg_pt_gp_member {
259 struct t10_alua_tg_pt_gp *tg_pt_gp; 357 struct t10_alua_tg_pt_gp *tg_pt_gp;
260 struct se_port *tg_pt; 358 struct se_port *tg_pt;
261 struct list_head tg_pt_gp_mem_list; 359 struct list_head tg_pt_gp_mem_list;
262} ____cacheline_aligned; 360};
263 361
264struct t10_vpd { 362struct t10_vpd {
265 unsigned char device_identifier[INQUIRY_VPD_DEVICE_IDENTIFIER_LEN]; 363 unsigned char device_identifier[INQUIRY_VPD_DEVICE_IDENTIFIER_LEN];
@@ -269,7 +367,7 @@ struct t10_vpd {
269 u32 association; 367 u32 association;
270 u32 device_identifier_type; 368 u32 device_identifier_type;
271 struct list_head vpd_list; 369 struct list_head vpd_list;
272} ____cacheline_aligned; 370};
273 371
274struct t10_wwn { 372struct t10_wwn {
275 char vendor[8]; 373 char vendor[8];
@@ -280,7 +378,7 @@ struct t10_wwn {
280 struct se_subsystem_dev *t10_sub_dev; 378 struct se_subsystem_dev *t10_sub_dev;
281 struct config_group t10_wwn_group; 379 struct config_group t10_wwn_group;
282 struct list_head t10_vpd_list; 380 struct list_head t10_vpd_list;
283} ____cacheline_aligned; 381};
284 382
285 383
286/* 384/*
@@ -333,7 +431,7 @@ struct t10_pr_registration {
333 struct list_head pr_reg_aptpl_list; 431 struct list_head pr_reg_aptpl_list;
334 struct list_head pr_reg_atp_list; 432 struct list_head pr_reg_atp_list;
335 struct list_head pr_reg_atp_mem_list; 433 struct list_head pr_reg_atp_mem_list;
336} ____cacheline_aligned; 434};
337 435
338/* 436/*
339 * This set of function pointer ops is set based upon SPC3_PERSISTENT_RESERVATIONS, 437 * This set of function pointer ops is set based upon SPC3_PERSISTENT_RESERVATIONS,
@@ -374,20 +472,20 @@ struct t10_reservation {
374 struct list_head registration_list; 472 struct list_head registration_list;
375 struct list_head aptpl_reg_list; 473 struct list_head aptpl_reg_list;
376 struct t10_reservation_ops pr_ops; 474 struct t10_reservation_ops pr_ops;
377} ____cacheline_aligned; 475};
378 476
379struct se_queue_req { 477struct se_queue_req {
380 int state; 478 int state;
381 struct se_cmd *cmd; 479 struct se_cmd *cmd;
382 struct list_head qr_list; 480 struct list_head qr_list;
383} ____cacheline_aligned; 481};
384 482
385struct se_queue_obj { 483struct se_queue_obj {
386 atomic_t queue_cnt; 484 atomic_t queue_cnt;
387 spinlock_t cmd_queue_lock; 485 spinlock_t cmd_queue_lock;
388 struct list_head qobj_list; 486 struct list_head qobj_list;
389 wait_queue_head_t thread_wq; 487 wait_queue_head_t thread_wq;
390} ____cacheline_aligned; 488};
391 489
392struct se_task { 490struct se_task {
393 unsigned long long task_lba; 491 unsigned long long task_lba;
@@ -397,16 +495,14 @@ struct se_task {
397 struct scatterlist *task_sg; 495 struct scatterlist *task_sg;
398 u32 task_sg_nents; 496 u32 task_sg_nents;
399 u16 task_flags; 497 u16 task_flags;
400 u8 task_sense;
401 u8 task_scsi_status; 498 u8 task_scsi_status;
402 int task_error_status;
403 enum dma_data_direction task_data_direction; 499 enum dma_data_direction task_data_direction;
404 atomic_t task_state_active;
405 struct list_head t_list; 500 struct list_head t_list;
406 struct list_head t_execute_list; 501 struct list_head t_execute_list;
407 struct list_head t_state_list; 502 struct list_head t_state_list;
503 bool t_state_active;
408 struct completion task_stop_comp; 504 struct completion task_stop_comp;
409} ____cacheline_aligned; 505};
410 506
411struct se_cmd { 507struct se_cmd {
412 /* SAM response code being sent to initiator */ 508 /* SAM response code being sent to initiator */
@@ -451,6 +547,7 @@ struct se_cmd {
451 struct list_head se_queue_node; 547 struct list_head se_queue_node;
452 struct list_head se_cmd_list; 548 struct list_head se_cmd_list;
453 struct completion cmd_wait_comp; 549 struct completion cmd_wait_comp;
550 struct kref cmd_kref;
454 struct target_core_fabric_ops *se_tfo; 551 struct target_core_fabric_ops *se_tfo;
455 int (*execute_task)(struct se_task *); 552 int (*execute_task)(struct se_task *);
456 void (*transport_complete_callback)(struct se_cmd *); 553 void (*transport_complete_callback)(struct se_cmd *);
@@ -492,7 +589,7 @@ struct se_cmd {
492 struct list_head t_task_list; 589 struct list_head t_task_list;
493 u32 t_task_list_num; 590 u32 t_task_list_num;
494 591
495} ____cacheline_aligned; 592};
496 593
497struct se_tmr_req { 594struct se_tmr_req {
498 /* Task Management function to be preformed */ 595 /* Task Management function to be preformed */
@@ -510,7 +607,7 @@ struct se_tmr_req {
510 struct se_device *tmr_dev; 607 struct se_device *tmr_dev;
511 struct se_lun *tmr_lun; 608 struct se_lun *tmr_lun;
512 struct list_head tmr_list; 609 struct list_head tmr_list;
513} ____cacheline_aligned; 610};
514 611
515struct se_ua { 612struct se_ua {
516 u8 ua_asc; 613 u8 ua_asc;
@@ -518,7 +615,7 @@ struct se_ua {
518 struct se_node_acl *ua_nacl; 615 struct se_node_acl *ua_nacl;
519 struct list_head ua_dev_list; 616 struct list_head ua_dev_list;
520 struct list_head ua_nacl_list; 617 struct list_head ua_nacl_list;
521} ____cacheline_aligned; 618};
522 619
523struct se_node_acl { 620struct se_node_acl {
524 char initiatorname[TRANSPORT_IQN_LEN]; 621 char initiatorname[TRANSPORT_IQN_LEN];
@@ -545,7 +642,7 @@ struct se_node_acl {
545 struct config_group *acl_default_groups[5]; 642 struct config_group *acl_default_groups[5];
546 struct list_head acl_list; 643 struct list_head acl_list;
547 struct list_head acl_sess_list; 644 struct list_head acl_sess_list;
548} ____cacheline_aligned; 645};
549 646
550struct se_session { 647struct se_session {
551 unsigned sess_tearing_down:1; 648 unsigned sess_tearing_down:1;
@@ -558,7 +655,7 @@ struct se_session {
558 struct list_head sess_cmd_list; 655 struct list_head sess_cmd_list;
559 struct list_head sess_wait_list; 656 struct list_head sess_wait_list;
560 spinlock_t sess_cmd_lock; 657 spinlock_t sess_cmd_lock;
561} ____cacheline_aligned; 658};
562 659
563struct se_device; 660struct se_device;
564struct se_transform_info; 661struct se_transform_info;
@@ -578,7 +675,7 @@ struct se_lun_acl {
578 struct list_head lacl_list; 675 struct list_head lacl_list;
579 struct config_group se_lun_group; 676 struct config_group se_lun_group;
580 struct se_ml_stat_grps ml_stat_grps; 677 struct se_ml_stat_grps ml_stat_grps;
581} ____cacheline_aligned; 678};
582 679
583struct se_dev_entry { 680struct se_dev_entry {
584 bool def_pr_registered; 681 bool def_pr_registered;
@@ -603,7 +700,7 @@ struct se_dev_entry {
603 struct se_lun *se_lun; 700 struct se_lun *se_lun;
604 struct list_head alua_port_list; 701 struct list_head alua_port_list;
605 struct list_head ua_list; 702 struct list_head ua_list;
606} ____cacheline_aligned; 703};
607 704
608struct se_dev_limits { 705struct se_dev_limits {
609 /* Max supported HW queue depth */ 706 /* Max supported HW queue depth */
@@ -612,7 +709,7 @@ struct se_dev_limits {
612 u32 queue_depth; 709 u32 queue_depth;
613 /* From include/linux/blkdev.h for the other HW/SW limits. */ 710 /* From include/linux/blkdev.h for the other HW/SW limits. */
614 struct queue_limits limits; 711 struct queue_limits limits;
615} ____cacheline_aligned; 712};
616 713
617struct se_dev_attrib { 714struct se_dev_attrib {
618 int emulate_dpo; 715 int emulate_dpo;
@@ -641,7 +738,7 @@ struct se_dev_attrib {
641 u32 unmap_granularity_alignment; 738 u32 unmap_granularity_alignment;
642 struct se_subsystem_dev *da_sub_dev; 739 struct se_subsystem_dev *da_sub_dev;
643 struct config_group da_group; 740 struct config_group da_group;
644} ____cacheline_aligned; 741};
645 742
646struct se_dev_stat_grps { 743struct se_dev_stat_grps {
647 struct config_group stat_group; 744 struct config_group stat_group;
@@ -674,7 +771,7 @@ struct se_subsystem_dev {
674 struct config_group se_dev_pr_group; 771 struct config_group se_dev_pr_group;
675 /* For target_core_stat.c groups */ 772 /* For target_core_stat.c groups */
676 struct se_dev_stat_grps dev_stat_grps; 773 struct se_dev_stat_grps dev_stat_grps;
677} ____cacheline_aligned; 774};
678 775
679struct se_device { 776struct se_device {
680 /* RELATIVE TARGET PORT IDENTIFER Counter */ 777 /* RELATIVE TARGET PORT IDENTIFER Counter */
@@ -685,7 +782,6 @@ struct se_device {
685 u32 dev_port_count; 782 u32 dev_port_count;
686 /* See transport_device_status_table */ 783 /* See transport_device_status_table */
687 u32 dev_status; 784 u32 dev_status;
688 u32 dev_tcq_window_closed;
689 /* Physical device queue depth */ 785 /* Physical device queue depth */
690 u32 queue_depth; 786 u32 queue_depth;
691 /* Used for SPC-2 reservations enforce of ISIDs */ 787 /* Used for SPC-2 reservations enforce of ISIDs */
@@ -702,7 +798,6 @@ struct se_device {
702 spinlock_t stats_lock; 798 spinlock_t stats_lock;
703 /* Active commands on this virtual SE device */ 799 /* Active commands on this virtual SE device */
704 atomic_t simple_cmds; 800 atomic_t simple_cmds;
705 atomic_t depth_left;
706 atomic_t dev_ordered_id; 801 atomic_t dev_ordered_id;
707 atomic_t execute_tasks; 802 atomic_t execute_tasks;
708 atomic_t dev_ordered_sync; 803 atomic_t dev_ordered_sync;
@@ -740,7 +835,7 @@ struct se_device {
740 struct se_subsystem_api *transport; 835 struct se_subsystem_api *transport;
741 /* Linked list for struct se_hba struct se_device list */ 836 /* Linked list for struct se_hba struct se_device list */
742 struct list_head dev_list; 837 struct list_head dev_list;
743} ____cacheline_aligned; 838};
744 839
745struct se_hba { 840struct se_hba {
746 u16 hba_tpgt; 841 u16 hba_tpgt;
@@ -759,7 +854,7 @@ struct se_hba {
759 struct config_group hba_group; 854 struct config_group hba_group;
760 struct mutex hba_access_mutex; 855 struct mutex hba_access_mutex;
761 struct se_subsystem_api *transport; 856 struct se_subsystem_api *transport;
762} ____cacheline_aligned; 857};
763 858
764struct se_port_stat_grps { 859struct se_port_stat_grps {
765 struct config_group stat_group; 860 struct config_group stat_group;
@@ -785,13 +880,13 @@ struct se_lun {
785 struct se_port *lun_sep; 880 struct se_port *lun_sep;
786 struct config_group lun_group; 881 struct config_group lun_group;
787 struct se_port_stat_grps port_stat_grps; 882 struct se_port_stat_grps port_stat_grps;
788} ____cacheline_aligned; 883};
789 884
790struct scsi_port_stats { 885struct scsi_port_stats {
791 u64 cmd_pdus; 886 u64 cmd_pdus;
792 u64 tx_data_octets; 887 u64 tx_data_octets;
793 u64 rx_data_octets; 888 u64 rx_data_octets;
794} ____cacheline_aligned; 889};
795 890
796struct se_port { 891struct se_port {
797 /* RELATIVE TARGET PORT IDENTIFER */ 892 /* RELATIVE TARGET PORT IDENTIFER */
@@ -811,12 +906,12 @@ struct se_port {
811 struct se_portal_group *sep_tpg; 906 struct se_portal_group *sep_tpg;
812 struct list_head sep_alua_list; 907 struct list_head sep_alua_list;
813 struct list_head sep_list; 908 struct list_head sep_list;
814} ____cacheline_aligned; 909};
815 910
816struct se_tpg_np { 911struct se_tpg_np {
817 struct se_portal_group *tpg_np_parent; 912 struct se_portal_group *tpg_np_parent;
818 struct config_group tpg_np_group; 913 struct config_group tpg_np_group;
819} ____cacheline_aligned; 914};
820 915
821struct se_portal_group { 916struct se_portal_group {
822 /* Type of target portal group, see transport_tpg_type_table */ 917 /* Type of target portal group, see transport_tpg_type_table */
@@ -849,13 +944,13 @@ struct se_portal_group {
849 struct config_group tpg_acl_group; 944 struct config_group tpg_acl_group;
850 struct config_group tpg_attrib_group; 945 struct config_group tpg_attrib_group;
851 struct config_group tpg_param_group; 946 struct config_group tpg_param_group;
852} ____cacheline_aligned; 947};
853 948
854struct se_wwn { 949struct se_wwn {
855 struct target_fabric_configfs *wwn_tf; 950 struct target_fabric_configfs *wwn_tf;
856 struct config_group wwn_group; 951 struct config_group wwn_group;
857 struct config_group *wwn_default_groups[2]; 952 struct config_group *wwn_default_groups[2];
858 struct config_group fabric_stat_group; 953 struct config_group fabric_stat_group;
859} ____cacheline_aligned; 954};
860 955
861#endif /* TARGET_CORE_BASE_H */ 956#endif /* TARGET_CORE_BASE_H */
diff --git a/include/target/target_core_device.h b/include/target/target_core_device.h
deleted file mode 100644
index 2be31ff8763b..000000000000
--- a/include/target/target_core_device.h
+++ /dev/null
@@ -1,63 +0,0 @@
1#ifndef TARGET_CORE_DEVICE_H
2#define TARGET_CORE_DEVICE_H
3
4extern int transport_lookup_cmd_lun(struct se_cmd *, u32);
5extern int transport_lookup_tmr_lun(struct se_cmd *, u32);
6extern struct se_dev_entry *core_get_se_deve_from_rtpi(
7 struct se_node_acl *, u16);
8extern int core_free_device_list_for_node(struct se_node_acl *,
9 struct se_portal_group *);
10extern void core_dec_lacl_count(struct se_node_acl *, struct se_cmd *);
11extern void core_update_device_list_access(u32, u32, struct se_node_acl *);
12extern int core_update_device_list_for_node(struct se_lun *, struct se_lun_acl *, u32,
13 u32, struct se_node_acl *,
14 struct se_portal_group *, int);
15extern void core_clear_lun_from_tpg(struct se_lun *, struct se_portal_group *);
16extern int core_dev_export(struct se_device *, struct se_portal_group *,
17 struct se_lun *);
18extern void core_dev_unexport(struct se_device *, struct se_portal_group *,
19 struct se_lun *);
20extern int target_report_luns(struct se_task *);
21extern void se_release_device_for_hba(struct se_device *);
22extern void se_release_vpd_for_dev(struct se_device *);
23extern void se_clear_dev_ports(struct se_device *);
24extern int se_free_virtual_device(struct se_device *, struct se_hba *);
25extern int se_dev_check_online(struct se_device *);
26extern int se_dev_check_shutdown(struct se_device *);
27extern void se_dev_set_default_attribs(struct se_device *, struct se_dev_limits *);
28extern int se_dev_set_task_timeout(struct se_device *, u32);
29extern int se_dev_set_max_unmap_lba_count(struct se_device *, u32);
30extern int se_dev_set_max_unmap_block_desc_count(struct se_device *, u32);
31extern int se_dev_set_unmap_granularity(struct se_device *, u32);
32extern int se_dev_set_unmap_granularity_alignment(struct se_device *, u32);
33extern int se_dev_set_emulate_dpo(struct se_device *, int);
34extern int se_dev_set_emulate_fua_write(struct se_device *, int);
35extern int se_dev_set_emulate_fua_read(struct se_device *, int);
36extern int se_dev_set_emulate_write_cache(struct se_device *, int);
37extern int se_dev_set_emulate_ua_intlck_ctrl(struct se_device *, int);
38extern int se_dev_set_emulate_tas(struct se_device *, int);
39extern int se_dev_set_emulate_tpu(struct se_device *, int);
40extern int se_dev_set_emulate_tpws(struct se_device *, int);
41extern int se_dev_set_enforce_pr_isids(struct se_device *, int);
42extern int se_dev_set_is_nonrot(struct se_device *, int);
43extern int se_dev_set_emulate_rest_reord(struct se_device *dev, int);
44extern int se_dev_set_queue_depth(struct se_device *, u32);
45extern int se_dev_set_max_sectors(struct se_device *, u32);
46extern int se_dev_set_optimal_sectors(struct se_device *, u32);
47extern int se_dev_set_block_size(struct se_device *, u32);
48extern struct se_lun *core_dev_add_lun(struct se_portal_group *, struct se_hba *,
49 struct se_device *, u32);
50extern int core_dev_del_lun(struct se_portal_group *, u32);
51extern struct se_lun *core_get_lun_from_tpg(struct se_portal_group *, u32);
52extern struct se_lun_acl *core_dev_init_initiator_node_lun_acl(struct se_portal_group *,
53 u32, char *, int *);
54extern int core_dev_add_initiator_node_lun_acl(struct se_portal_group *,
55 struct se_lun_acl *, u32, u32);
56extern int core_dev_del_initiator_node_lun_acl(struct se_portal_group *,
57 struct se_lun *, struct se_lun_acl *);
58extern void core_dev_free_initiator_node_lun_acl(struct se_portal_group *,
59 struct se_lun_acl *lacl);
60extern int core_dev_setup_virtual_lun0(void);
61extern void core_dev_release_virtual_lun0(void);
62
63#endif /* TARGET_CORE_DEVICE_H */
diff --git a/include/target/target_core_fabric_ops.h b/include/target/target_core_fabric.h
index 0256825f923d..523e8bc104d4 100644
--- a/include/target/target_core_fabric_ops.h
+++ b/include/target/target_core_fabric.h
@@ -1,5 +1,5 @@
1/* Defined in target_core_configfs.h */ 1#ifndef TARGET_CORE_FABRIC_H
2struct target_fabric_configfs; 2#define TARGET_CORE_FABRIC_H
3 3
4struct target_core_fabric_ops { 4struct target_core_fabric_ops {
5 struct configfs_subsystem *tf_subsys; 5 struct configfs_subsystem *tf_subsys;
@@ -52,10 +52,6 @@ struct target_core_fabric_ops {
52 * Returning 0 will signal a descriptor has not been released. 52 * Returning 0 will signal a descriptor has not been released.
53 */ 53 */
54 int (*check_stop_free)(struct se_cmd *); 54 int (*check_stop_free)(struct se_cmd *);
55 /*
56 * Optional check for active I/O shutdown
57 */
58 int (*check_release_cmd)(struct se_cmd *);
59 void (*release_cmd)(struct se_cmd *); 55 void (*release_cmd)(struct se_cmd *);
60 /* 56 /*
61 * Called with spin_lock_bh(struct se_portal_group->session_lock held. 57 * Called with spin_lock_bh(struct se_portal_group->session_lock held.
@@ -103,3 +99,89 @@ struct target_core_fabric_ops {
103 struct config_group *, const char *); 99 struct config_group *, const char *);
104 void (*fabric_drop_nodeacl)(struct se_node_acl *); 100 void (*fabric_drop_nodeacl)(struct se_node_acl *);
105}; 101};
102
103struct se_session *transport_init_session(void);
104void __transport_register_session(struct se_portal_group *,
105 struct se_node_acl *, struct se_session *, void *);
106void transport_register_session(struct se_portal_group *,
107 struct se_node_acl *, struct se_session *, void *);
108void transport_free_session(struct se_session *);
109void transport_deregister_session_configfs(struct se_session *);
110void transport_deregister_session(struct se_session *);
111
112
113void transport_init_se_cmd(struct se_cmd *, struct target_core_fabric_ops *,
114 struct se_session *, u32, int, int, unsigned char *);
115int transport_lookup_cmd_lun(struct se_cmd *, u32);
116int transport_generic_allocate_tasks(struct se_cmd *, unsigned char *);
117int target_submit_cmd(struct se_cmd *, struct se_session *, unsigned char *,
118 unsigned char *, u32, u32, int, int, int);
119int transport_handle_cdb_direct(struct se_cmd *);
120int transport_generic_handle_cdb_map(struct se_cmd *);
121int transport_generic_handle_data(struct se_cmd *);
122int transport_generic_map_mem_to_cmd(struct se_cmd *cmd,
123 struct scatterlist *, u32, struct scatterlist *, u32);
124void transport_do_task_sg_chain(struct se_cmd *);
125int transport_generic_new_cmd(struct se_cmd *);
126
127void transport_generic_process_write(struct se_cmd *);
128
129void transport_generic_free_cmd(struct se_cmd *, int);
130
131bool transport_wait_for_tasks(struct se_cmd *);
132int transport_check_aborted_status(struct se_cmd *, int);
133int transport_send_check_condition_and_sense(struct se_cmd *, u8, int);
134
135void target_get_sess_cmd(struct se_session *, struct se_cmd *, bool);
136int target_put_sess_cmd(struct se_session *, struct se_cmd *);
137void target_splice_sess_cmd_list(struct se_session *);
138void target_wait_for_sess_cmds(struct se_session *, int);
139
140int core_alua_check_nonop_delay(struct se_cmd *);
141
142struct se_tmr_req *core_tmr_alloc_req(struct se_cmd *, void *, u8, gfp_t);
143void core_tmr_release_req(struct se_tmr_req *);
144int transport_generic_handle_tmr(struct se_cmd *);
145int transport_lookup_tmr_lun(struct se_cmd *, u32);
146
147struct se_node_acl *core_tpg_check_initiator_node_acl(struct se_portal_group *,
148 unsigned char *);
149void core_tpg_clear_object_luns(struct se_portal_group *);
150struct se_node_acl *core_tpg_add_initiator_node_acl(struct se_portal_group *,
151 struct se_node_acl *, const char *, u32);
152int core_tpg_del_initiator_node_acl(struct se_portal_group *,
153 struct se_node_acl *, int);
154int core_tpg_set_initiator_node_queue_depth(struct se_portal_group *,
155 unsigned char *, u32, int);
156int core_tpg_register(struct target_core_fabric_ops *, struct se_wwn *,
157 struct se_portal_group *, void *, int);
158int core_tpg_deregister(struct se_portal_group *);
159
160/* SAS helpers */
161u8 sas_get_fabric_proto_ident(struct se_portal_group *);
162u32 sas_get_pr_transport_id(struct se_portal_group *, struct se_node_acl *,
163 struct t10_pr_registration *, int *, unsigned char *);
164u32 sas_get_pr_transport_id_len(struct se_portal_group *, struct se_node_acl *,
165 struct t10_pr_registration *, int *);
166char *sas_parse_pr_out_transport_id(struct se_portal_group *, const char *,
167 u32 *, char **);
168
169/* FC helpers */
170u8 fc_get_fabric_proto_ident(struct se_portal_group *);
171u32 fc_get_pr_transport_id(struct se_portal_group *, struct se_node_acl *,
172 struct t10_pr_registration *, int *, unsigned char *);
173u32 fc_get_pr_transport_id_len(struct se_portal_group *, struct se_node_acl *,
174 struct t10_pr_registration *, int *);
175char *fc_parse_pr_out_transport_id(struct se_portal_group *, const char *,
176 u32 *, char **);
177
178/* iSCSI helpers */
179u8 iscsi_get_fabric_proto_ident(struct se_portal_group *);
180u32 iscsi_get_pr_transport_id(struct se_portal_group *, struct se_node_acl *,
181 struct t10_pr_registration *, int *, unsigned char *);
182u32 iscsi_get_pr_transport_id_len(struct se_portal_group *, struct se_node_acl *,
183 struct t10_pr_registration *, int *);
184char *iscsi_parse_pr_out_transport_id(struct se_portal_group *, const char *,
185 u32 *, char **);
186
187#endif /* TARGET_CORE_FABRICH */
diff --git a/include/target/target_core_fabric_lib.h b/include/target/target_core_fabric_lib.h
deleted file mode 100644
index c2f8d0e3a03b..000000000000
--- a/include/target/target_core_fabric_lib.h
+++ /dev/null
@@ -1,28 +0,0 @@
1#ifndef TARGET_CORE_FABRIC_LIB_H
2#define TARGET_CORE_FABRIC_LIB_H
3
4extern u8 sas_get_fabric_proto_ident(struct se_portal_group *);
5extern u32 sas_get_pr_transport_id(struct se_portal_group *, struct se_node_acl *,
6 struct t10_pr_registration *, int *, unsigned char *);
7extern u32 sas_get_pr_transport_id_len(struct se_portal_group *, struct se_node_acl *,
8 struct t10_pr_registration *, int *);
9extern char *sas_parse_pr_out_transport_id(struct se_portal_group *,
10 const char *, u32 *, char **);
11
12extern u8 fc_get_fabric_proto_ident(struct se_portal_group *);
13extern u32 fc_get_pr_transport_id(struct se_portal_group *, struct se_node_acl *,
14 struct t10_pr_registration *, int *, unsigned char *);
15extern u32 fc_get_pr_transport_id_len(struct se_portal_group *, struct se_node_acl *,
16 struct t10_pr_registration *, int *);
17extern char *fc_parse_pr_out_transport_id(struct se_portal_group *,
18 const char *, u32 *, char **);
19
20extern u8 iscsi_get_fabric_proto_ident(struct se_portal_group *);
21extern u32 iscsi_get_pr_transport_id(struct se_portal_group *, struct se_node_acl *,
22 struct t10_pr_registration *, int *, unsigned char *);
23extern u32 iscsi_get_pr_transport_id_len(struct se_portal_group *, struct se_node_acl *,
24 struct t10_pr_registration *, int *);
25extern char *iscsi_parse_pr_out_transport_id(struct se_portal_group *,
26 const char *, u32 *, char **);
27
28#endif /* TARGET_CORE_FABRIC_LIB_H */
diff --git a/include/target/target_core_tmr.h b/include/target/target_core_tmr.h
deleted file mode 100644
index d5876e17d3fb..000000000000
--- a/include/target/target_core_tmr.h
+++ /dev/null
@@ -1,35 +0,0 @@
1#ifndef TARGET_CORE_TMR_H
2#define TARGET_CORE_TMR_H
3
4/* fabric independent task management function values */
5enum tcm_tmreq_table {
6 TMR_ABORT_TASK = 1,
7 TMR_ABORT_TASK_SET = 2,
8 TMR_CLEAR_ACA = 3,
9 TMR_CLEAR_TASK_SET = 4,
10 TMR_LUN_RESET = 5,
11 TMR_TARGET_WARM_RESET = 6,
12 TMR_TARGET_COLD_RESET = 7,
13 TMR_FABRIC_TMR = 255,
14};
15
16/* fabric independent task management response values */
17enum tcm_tmrsp_table {
18 TMR_FUNCTION_COMPLETE = 0,
19 TMR_TASK_DOES_NOT_EXIST = 1,
20 TMR_LUN_DOES_NOT_EXIST = 2,
21 TMR_TASK_STILL_ALLEGIANT = 3,
22 TMR_TASK_FAILOVER_NOT_SUPPORTED = 4,
23 TMR_TASK_MGMT_FUNCTION_NOT_SUPPORTED = 5,
24 TMR_FUNCTION_AUTHORIZATION_FAILED = 6,
25 TMR_FUNCTION_REJECTED = 255,
26};
27
28extern struct kmem_cache *se_tmr_req_cache;
29
30extern struct se_tmr_req *core_tmr_alloc_req(struct se_cmd *, void *, u8, gfp_t);
31extern void core_tmr_release_req(struct se_tmr_req *);
32extern int core_tmr_lun_reset(struct se_device *, struct se_tmr_req *,
33 struct list_head *, struct se_cmd *);
34
35#endif /* TARGET_CORE_TMR_H */
diff --git a/include/target/target_core_tpg.h b/include/target/target_core_tpg.h
deleted file mode 100644
index 77e18729c4c1..000000000000
--- a/include/target/target_core_tpg.h
+++ /dev/null
@@ -1,35 +0,0 @@
1#ifndef TARGET_CORE_TPG_H
2#define TARGET_CORE_TPG_H
3
4extern struct se_node_acl *__core_tpg_get_initiator_node_acl(struct se_portal_group *tpg,
5 const char *);
6extern struct se_node_acl *core_tpg_get_initiator_node_acl(struct se_portal_group *tpg,
7 unsigned char *);
8extern void core_tpg_add_node_to_devs(struct se_node_acl *,
9 struct se_portal_group *);
10extern struct se_node_acl *core_tpg_check_initiator_node_acl(
11 struct se_portal_group *,
12 unsigned char *);
13extern void core_tpg_wait_for_nacl_pr_ref(struct se_node_acl *);
14extern void core_tpg_wait_for_mib_ref(struct se_node_acl *);
15extern void core_tpg_clear_object_luns(struct se_portal_group *);
16extern struct se_node_acl *core_tpg_add_initiator_node_acl(
17 struct se_portal_group *,
18 struct se_node_acl *,
19 const char *, u32);
20extern int core_tpg_del_initiator_node_acl(struct se_portal_group *,
21 struct se_node_acl *, int);
22extern int core_tpg_set_initiator_node_queue_depth(struct se_portal_group *,
23 unsigned char *, u32, int);
24extern int core_tpg_register(struct target_core_fabric_ops *,
25 struct se_wwn *,
26 struct se_portal_group *, void *,
27 int);
28extern int core_tpg_deregister(struct se_portal_group *);
29extern struct se_lun *core_tpg_pre_addlun(struct se_portal_group *, u32);
30extern int core_tpg_post_addlun(struct se_portal_group *, struct se_lun *, u32,
31 void *);
32extern struct se_lun *core_tpg_pre_dellun(struct se_portal_group *, u32, int *);
33extern int core_tpg_post_dellun(struct se_portal_group *, struct se_lun *);
34
35#endif /* TARGET_CORE_TPG_H */
diff --git a/include/target/target_core_transport.h b/include/target/target_core_transport.h
deleted file mode 100644
index dac4f2d859fd..000000000000
--- a/include/target/target_core_transport.h
+++ /dev/null
@@ -1,287 +0,0 @@
1#ifndef TARGET_CORE_TRANSPORT_H
2#define TARGET_CORE_TRANSPORT_H
3
4#define TARGET_CORE_VERSION TARGET_CORE_MOD_VERSION
5
6/* Attempts before moving from SHORT to LONG */
7#define PYX_TRANSPORT_WINDOW_CLOSED_THRESHOLD 3
8#define PYX_TRANSPORT_WINDOW_CLOSED_WAIT_SHORT 3 /* In milliseconds */
9#define PYX_TRANSPORT_WINDOW_CLOSED_WAIT_LONG 10 /* In milliseconds */
10
11#define PYX_TRANSPORT_STATUS_INTERVAL 5 /* In seconds */
12
13#define TRANSPORT_PLUGIN_PHBA_PDEV 1
14#define TRANSPORT_PLUGIN_VHBA_PDEV 2
15#define TRANSPORT_PLUGIN_VHBA_VDEV 3
16
17/*
18 * struct se_subsystem_dev->su_dev_flags
19*/
20#define SDF_FIRMWARE_VPD_UNIT_SERIAL 0x00000001
21#define SDF_EMULATED_VPD_UNIT_SERIAL 0x00000002
22#define SDF_USING_UDEV_PATH 0x00000004
23#define SDF_USING_ALIAS 0x00000008
24
25/*
26 * struct se_device->dev_flags
27 */
28#define DF_READ_ONLY 0x00000001
29#define DF_SPC2_RESERVATIONS 0x00000002
30#define DF_SPC2_RESERVATIONS_WITH_ISID 0x00000004
31
32/* struct se_dev_attrib sanity values */
33/* Default max_unmap_lba_count */
34#define DA_MAX_UNMAP_LBA_COUNT 0
35/* Default max_unmap_block_desc_count */
36#define DA_MAX_UNMAP_BLOCK_DESC_COUNT 0
37/* Default unmap_granularity */
38#define DA_UNMAP_GRANULARITY_DEFAULT 0
39/* Default unmap_granularity_alignment */
40#define DA_UNMAP_GRANULARITY_ALIGNMENT_DEFAULT 0
41/* Emulation for Direct Page Out */
42#define DA_EMULATE_DPO 0
43/* Emulation for Forced Unit Access WRITEs */
44#define DA_EMULATE_FUA_WRITE 1
45/* Emulation for Forced Unit Access READs */
46#define DA_EMULATE_FUA_READ 0
47/* Emulation for WriteCache and SYNCHRONIZE_CACHE */
48#define DA_EMULATE_WRITE_CACHE 0
49/* Emulation for UNIT ATTENTION Interlock Control */
50#define DA_EMULATE_UA_INTLLCK_CTRL 0
51/* Emulation for TASK_ABORTED status (TAS) by default */
52#define DA_EMULATE_TAS 1
53/* Emulation for Thin Provisioning UNMAP using block/blk-lib.c:blkdev_issue_discard() */
54#define DA_EMULATE_TPU 0
55/*
56 * Emulation for Thin Provisioning WRITE_SAME w/ UNMAP=1 bit using
57 * block/blk-lib.c:blkdev_issue_discard()
58 */
59#define DA_EMULATE_TPWS 0
60/* No Emulation for PSCSI by default */
61#define DA_EMULATE_RESERVATIONS 0
62/* No Emulation for PSCSI by default */
63#define DA_EMULATE_ALUA 0
64/* Enforce SCSI Initiator Port TransportID with 'ISID' for PR */
65#define DA_ENFORCE_PR_ISIDS 1
66#define DA_STATUS_MAX_SECTORS_MIN 16
67#define DA_STATUS_MAX_SECTORS_MAX 8192
68/* By default don't report non-rotating (solid state) medium */
69#define DA_IS_NONROT 0
70/* Queue Algorithm Modifier default for restricted reordering in control mode page */
71#define DA_EMULATE_REST_REORD 0
72
73#define SE_MODE_PAGE_BUF 512
74
75#define MOD_MAX_SECTORS(ms, bs) (ms % (PAGE_SIZE / bs))
76
77struct se_subsystem_api;
78
79extern int init_se_kmem_caches(void);
80extern void release_se_kmem_caches(void);
81extern u32 scsi_get_new_index(scsi_index_t);
82extern void transport_init_queue_obj(struct se_queue_obj *);
83extern void transport_subsystem_check_init(void);
84extern int transport_subsystem_register(struct se_subsystem_api *);
85extern void transport_subsystem_release(struct se_subsystem_api *);
86extern void transport_load_plugins(void);
87extern struct se_session *transport_init_session(void);
88extern void __transport_register_session(struct se_portal_group *,
89 struct se_node_acl *,
90 struct se_session *, void *);
91extern void transport_register_session(struct se_portal_group *,
92 struct se_node_acl *,
93 struct se_session *, void *);
94extern void transport_free_session(struct se_session *);
95extern void transport_deregister_session_configfs(struct se_session *);
96extern void transport_deregister_session(struct se_session *);
97extern void transport_cmd_finish_abort(struct se_cmd *, int);
98extern void transport_complete_sync_cache(struct se_cmd *, int);
99extern void transport_complete_task(struct se_task *, int);
100extern void transport_add_task_to_execute_queue(struct se_task *,
101 struct se_task *,
102 struct se_device *);
103extern void transport_remove_task_from_execute_queue(struct se_task *,
104 struct se_device *);
105extern void __transport_remove_task_from_execute_queue(struct se_task *,
106 struct se_device *);
107unsigned char *transport_dump_cmd_direction(struct se_cmd *);
108extern void transport_dump_dev_state(struct se_device *, char *, int *);
109extern void transport_dump_dev_info(struct se_device *, struct se_lun *,
110 unsigned long long, char *, int *);
111extern void transport_dump_vpd_proto_id(struct t10_vpd *,
112 unsigned char *, int);
113extern void transport_set_vpd_proto_id(struct t10_vpd *, unsigned char *);
114extern int transport_dump_vpd_assoc(struct t10_vpd *,
115 unsigned char *, int);
116extern int transport_set_vpd_assoc(struct t10_vpd *, unsigned char *);
117extern int transport_dump_vpd_ident_type(struct t10_vpd *,
118 unsigned char *, int);
119extern int transport_set_vpd_ident_type(struct t10_vpd *, unsigned char *);
120extern int transport_dump_vpd_ident(struct t10_vpd *,
121 unsigned char *, int);
122extern int transport_set_vpd_ident(struct t10_vpd *, unsigned char *);
123extern struct se_device *transport_add_device_to_core_hba(struct se_hba *,
124 struct se_subsystem_api *,
125 struct se_subsystem_dev *, u32,
126 void *, struct se_dev_limits *,
127 const char *, const char *);
128extern void transport_init_se_cmd(struct se_cmd *,
129 struct target_core_fabric_ops *,
130 struct se_session *, u32, int, int,
131 unsigned char *);
132void *transport_kmap_first_data_page(struct se_cmd *cmd);
133void transport_kunmap_first_data_page(struct se_cmd *cmd);
134extern int transport_generic_allocate_tasks(struct se_cmd *, unsigned char *);
135extern int transport_handle_cdb_direct(struct se_cmd *);
136extern int transport_generic_handle_cdb_map(struct se_cmd *);
137extern int transport_generic_handle_data(struct se_cmd *);
138extern int transport_generic_handle_tmr(struct se_cmd *);
139extern bool target_stop_task(struct se_task *task, unsigned long *flags);
140extern int transport_generic_map_mem_to_cmd(struct se_cmd *cmd, struct scatterlist *, u32,
141 struct scatterlist *, u32);
142extern int transport_clear_lun_from_sessions(struct se_lun *);
143extern bool transport_wait_for_tasks(struct se_cmd *);
144extern int transport_check_aborted_status(struct se_cmd *, int);
145extern int transport_send_check_condition_and_sense(struct se_cmd *, u8, int);
146extern void transport_send_task_abort(struct se_cmd *);
147extern void transport_release_cmd(struct se_cmd *);
148extern void transport_generic_free_cmd(struct se_cmd *, int);
149extern void target_get_sess_cmd(struct se_session *, struct se_cmd *);
150extern int target_put_sess_cmd(struct se_session *, struct se_cmd *);
151extern void target_splice_sess_cmd_list(struct se_session *);
152extern void target_wait_for_sess_cmds(struct se_session *, int);
153extern void transport_generic_wait_for_cmds(struct se_cmd *, int);
154extern void transport_do_task_sg_chain(struct se_cmd *);
155extern void transport_generic_process_write(struct se_cmd *);
156extern int transport_generic_new_cmd(struct se_cmd *);
157extern int transport_generic_do_tmr(struct se_cmd *);
158/* From target_core_alua.c */
159extern int core_alua_check_nonop_delay(struct se_cmd *);
160/* From target_core_cdb.c */
161extern int transport_emulate_control_cdb(struct se_task *);
162extern void target_get_task_cdb(struct se_task *task, unsigned char *cdb);
163
164/*
165 * Each se_transport_task_t can have N number of possible struct se_task's
166 * for the storage transport(s) to possibly execute.
167 * Used primarily for splitting up CDBs that exceed the physical storage
168 * HBA's maximum sector count per task.
169 */
170struct se_mem {
171 struct page *se_page;
172 u32 se_len;
173 u32 se_off;
174 struct list_head se_list;
175} ____cacheline_aligned;
176
177/*
178 * Each type of disk transport supported MUST have a template defined
179 * within its .h file.
180 */
181struct se_subsystem_api {
182 /*
183 * The Name. :-)
184 */
185 char name[16];
186 /*
187 * Transport Type.
188 */
189 u8 transport_type;
190
191 unsigned int fua_write_emulated : 1;
192 unsigned int write_cache_emulated : 1;
193
194 /*
195 * struct module for struct se_hba references
196 */
197 struct module *owner;
198 /*
199 * Used for global se_subsystem_api list_head
200 */
201 struct list_head sub_api_list;
202 /*
203 * attach_hba():
204 */
205 int (*attach_hba)(struct se_hba *, u32);
206 /*
207 * detach_hba():
208 */
209 void (*detach_hba)(struct se_hba *);
210 /*
211 * pmode_hba(): Used for TCM/pSCSI subsystem plugin HBA ->
212 * Linux/SCSI struct Scsi_Host passthrough
213 */
214 int (*pmode_enable_hba)(struct se_hba *, unsigned long);
215 /*
216 * allocate_virtdevice():
217 */
218 void *(*allocate_virtdevice)(struct se_hba *, const char *);
219 /*
220 * create_virtdevice(): Only for Virtual HBAs
221 */
222 struct se_device *(*create_virtdevice)(struct se_hba *,
223 struct se_subsystem_dev *, void *);
224 /*
225 * free_device():
226 */
227 void (*free_device)(void *);
228
229 /*
230 * transport_complete():
231 *
232 * Use transport_generic_complete() for majority of DAS transport
233 * drivers. Provided out of convenience.
234 */
235 int (*transport_complete)(struct se_task *task);
236 struct se_task *(*alloc_task)(unsigned char *cdb);
237 /*
238 * do_task():
239 */
240 int (*do_task)(struct se_task *);
241 /*
242 * Used by virtual subsystem plugins IBLOCK and FILEIO to emulate
243 * UNMAP and WRITE_SAME_* w/ UNMAP=1 <-> Linux/Block Discard
244 */
245 int (*do_discard)(struct se_device *, sector_t, u32);
246 /*
247 * Used by virtual subsystem plugins IBLOCK and FILEIO to emulate
248 * SYNCHRONIZE_CACHE_* <-> Linux/Block blkdev_issue_flush()
249 */
250 void (*do_sync_cache)(struct se_task *);
251 /*
252 * free_task():
253 */
254 void (*free_task)(struct se_task *);
255 /*
256 * check_configfs_dev_params():
257 */
258 ssize_t (*check_configfs_dev_params)(struct se_hba *, struct se_subsystem_dev *);
259 /*
260 * set_configfs_dev_params():
261 */
262 ssize_t (*set_configfs_dev_params)(struct se_hba *, struct se_subsystem_dev *,
263 const char *, ssize_t);
264 /*
265 * show_configfs_dev_params():
266 */
267 ssize_t (*show_configfs_dev_params)(struct se_hba *, struct se_subsystem_dev *,
268 char *);
269 /*
270 * get_device_rev():
271 */
272 u32 (*get_device_rev)(struct se_device *);
273 /*
274 * get_device_type():
275 */
276 u32 (*get_device_type)(struct se_device *);
277 /*
278 * Get the sector_t from a subsystem backstore..
279 */
280 sector_t (*get_blocks)(struct se_device *);
281 /*
282 * get_sense_buffer():
283 */
284 unsigned char *(*get_sense_buffer)(struct se_task *);
285} ____cacheline_aligned;
286
287#endif /* TARGET_CORE_TRANSPORT_H */
diff --git a/include/trace/events/btrfs.h b/include/trace/events/btrfs.h
index b31702ac15be..84f3001a568d 100644
--- a/include/trace/events/btrfs.h
+++ b/include/trace/events/btrfs.h
@@ -16,6 +16,8 @@ struct btrfs_delayed_ref_node;
16struct btrfs_delayed_tree_ref; 16struct btrfs_delayed_tree_ref;
17struct btrfs_delayed_data_ref; 17struct btrfs_delayed_data_ref;
18struct btrfs_delayed_ref_head; 18struct btrfs_delayed_ref_head;
19struct btrfs_block_group_cache;
20struct btrfs_free_cluster;
19struct map_lookup; 21struct map_lookup;
20struct extent_buffer; 22struct extent_buffer;
21 23
@@ -44,6 +46,17 @@ struct extent_buffer;
44 obj, ((obj >= BTRFS_DATA_RELOC_TREE_OBJECTID) || \ 46 obj, ((obj >= BTRFS_DATA_RELOC_TREE_OBJECTID) || \
45 (obj <= BTRFS_CSUM_TREE_OBJECTID )) ? __show_root_type(obj) : "-" 47 (obj <= BTRFS_CSUM_TREE_OBJECTID )) ? __show_root_type(obj) : "-"
46 48
49#define BTRFS_GROUP_FLAGS \
50 { BTRFS_BLOCK_GROUP_DATA, "DATA"}, \
51 { BTRFS_BLOCK_GROUP_SYSTEM, "SYSTEM"}, \
52 { BTRFS_BLOCK_GROUP_METADATA, "METADATA"}, \
53 { BTRFS_BLOCK_GROUP_RAID0, "RAID0"}, \
54 { BTRFS_BLOCK_GROUP_RAID1, "RAID1"}, \
55 { BTRFS_BLOCK_GROUP_DUP, "DUP"}, \
56 { BTRFS_BLOCK_GROUP_RAID10, "RAID10"}
57
58#define BTRFS_UUID_SIZE 16
59
47TRACE_EVENT(btrfs_transaction_commit, 60TRACE_EVENT(btrfs_transaction_commit,
48 61
49 TP_PROTO(struct btrfs_root *root), 62 TP_PROTO(struct btrfs_root *root),
@@ -621,6 +634,34 @@ TRACE_EVENT(btrfs_cow_block,
621 __entry->cow_level) 634 __entry->cow_level)
622); 635);
623 636
637TRACE_EVENT(btrfs_space_reservation,
638
639 TP_PROTO(struct btrfs_fs_info *fs_info, char *type, u64 val,
640 u64 bytes, int reserve),
641
642 TP_ARGS(fs_info, type, val, bytes, reserve),
643
644 TP_STRUCT__entry(
645 __array( u8, fsid, BTRFS_UUID_SIZE )
646 __string( type, type )
647 __field( u64, val )
648 __field( u64, bytes )
649 __field( int, reserve )
650 ),
651
652 TP_fast_assign(
653 memcpy(__entry->fsid, fs_info->fsid, BTRFS_UUID_SIZE);
654 __assign_str(type, type);
655 __entry->val = val;
656 __entry->bytes = bytes;
657 __entry->reserve = reserve;
658 ),
659
660 TP_printk("%pU: %s: %Lu %s %Lu", __entry->fsid, __get_str(type),
661 __entry->val, __entry->reserve ? "reserve" : "release",
662 __entry->bytes)
663);
664
624DECLARE_EVENT_CLASS(btrfs__reserved_extent, 665DECLARE_EVENT_CLASS(btrfs__reserved_extent,
625 666
626 TP_PROTO(struct btrfs_root *root, u64 start, u64 len), 667 TP_PROTO(struct btrfs_root *root, u64 start, u64 len),
@@ -659,6 +700,168 @@ DEFINE_EVENT(btrfs__reserved_extent, btrfs_reserved_extent_free,
659 TP_ARGS(root, start, len) 700 TP_ARGS(root, start, len)
660); 701);
661 702
703TRACE_EVENT(find_free_extent,
704
705 TP_PROTO(struct btrfs_root *root, u64 num_bytes, u64 empty_size,
706 u64 data),
707
708 TP_ARGS(root, num_bytes, empty_size, data),
709
710 TP_STRUCT__entry(
711 __field( u64, root_objectid )
712 __field( u64, num_bytes )
713 __field( u64, empty_size )
714 __field( u64, data )
715 ),
716
717 TP_fast_assign(
718 __entry->root_objectid = root->root_key.objectid;
719 __entry->num_bytes = num_bytes;
720 __entry->empty_size = empty_size;
721 __entry->data = data;
722 ),
723
724 TP_printk("root = %Lu(%s), len = %Lu, empty_size = %Lu, "
725 "flags = %Lu(%s)", show_root_type(__entry->root_objectid),
726 __entry->num_bytes, __entry->empty_size, __entry->data,
727 __print_flags((unsigned long)__entry->data, "|",
728 BTRFS_GROUP_FLAGS))
729);
730
731DECLARE_EVENT_CLASS(btrfs__reserve_extent,
732
733 TP_PROTO(struct btrfs_root *root,
734 struct btrfs_block_group_cache *block_group, u64 start,
735 u64 len),
736
737 TP_ARGS(root, block_group, start, len),
738
739 TP_STRUCT__entry(
740 __field( u64, root_objectid )
741 __field( u64, bg_objectid )
742 __field( u64, flags )
743 __field( u64, start )
744 __field( u64, len )
745 ),
746
747 TP_fast_assign(
748 __entry->root_objectid = root->root_key.objectid;
749 __entry->bg_objectid = block_group->key.objectid;
750 __entry->flags = block_group->flags;
751 __entry->start = start;
752 __entry->len = len;
753 ),
754
755 TP_printk("root = %Lu(%s), block_group = %Lu, flags = %Lu(%s), "
756 "start = %Lu, len = %Lu",
757 show_root_type(__entry->root_objectid), __entry->bg_objectid,
758 __entry->flags, __print_flags((unsigned long)__entry->flags,
759 "|", BTRFS_GROUP_FLAGS),
760 __entry->start, __entry->len)
761);
762
763DEFINE_EVENT(btrfs__reserve_extent, btrfs_reserve_extent,
764
765 TP_PROTO(struct btrfs_root *root,
766 struct btrfs_block_group_cache *block_group, u64 start,
767 u64 len),
768
769 TP_ARGS(root, block_group, start, len)
770);
771
772DEFINE_EVENT(btrfs__reserve_extent, btrfs_reserve_extent_cluster,
773
774 TP_PROTO(struct btrfs_root *root,
775 struct btrfs_block_group_cache *block_group, u64 start,
776 u64 len),
777
778 TP_ARGS(root, block_group, start, len)
779);
780
781TRACE_EVENT(btrfs_find_cluster,
782
783 TP_PROTO(struct btrfs_block_group_cache *block_group, u64 start,
784 u64 bytes, u64 empty_size, u64 min_bytes),
785
786 TP_ARGS(block_group, start, bytes, empty_size, min_bytes),
787
788 TP_STRUCT__entry(
789 __field( u64, bg_objectid )
790 __field( u64, flags )
791 __field( u64, start )
792 __field( u64, bytes )
793 __field( u64, empty_size )
794 __field( u64, min_bytes )
795 ),
796
797 TP_fast_assign(
798 __entry->bg_objectid = block_group->key.objectid;
799 __entry->flags = block_group->flags;
800 __entry->start = start;
801 __entry->bytes = bytes;
802 __entry->empty_size = empty_size;
803 __entry->min_bytes = min_bytes;
804 ),
805
806 TP_printk("block_group = %Lu, flags = %Lu(%s), start = %Lu, len = %Lu,"
807 " empty_size = %Lu, min_bytes = %Lu", __entry->bg_objectid,
808 __entry->flags,
809 __print_flags((unsigned long)__entry->flags, "|",
810 BTRFS_GROUP_FLAGS), __entry->start,
811 __entry->bytes, __entry->empty_size, __entry->min_bytes)
812);
813
814TRACE_EVENT(btrfs_failed_cluster_setup,
815
816 TP_PROTO(struct btrfs_block_group_cache *block_group),
817
818 TP_ARGS(block_group),
819
820 TP_STRUCT__entry(
821 __field( u64, bg_objectid )
822 ),
823
824 TP_fast_assign(
825 __entry->bg_objectid = block_group->key.objectid;
826 ),
827
828 TP_printk("block_group = %Lu", __entry->bg_objectid)
829);
830
831TRACE_EVENT(btrfs_setup_cluster,
832
833 TP_PROTO(struct btrfs_block_group_cache *block_group,
834 struct btrfs_free_cluster *cluster, u64 size, int bitmap),
835
836 TP_ARGS(block_group, cluster, size, bitmap),
837
838 TP_STRUCT__entry(
839 __field( u64, bg_objectid )
840 __field( u64, flags )
841 __field( u64, start )
842 __field( u64, max_size )
843 __field( u64, size )
844 __field( int, bitmap )
845 ),
846
847 TP_fast_assign(
848 __entry->bg_objectid = block_group->key.objectid;
849 __entry->flags = block_group->flags;
850 __entry->start = cluster->window_start;
851 __entry->max_size = cluster->max_size;
852 __entry->size = size;
853 __entry->bitmap = bitmap;
854 ),
855
856 TP_printk("block_group = %Lu, flags = %Lu(%s), window_start = %Lu, "
857 "size = %Lu, max_size = %Lu, bitmap = %d",
858 __entry->bg_objectid,
859 __entry->flags,
860 __print_flags((unsigned long)__entry->flags, "|",
861 BTRFS_GROUP_FLAGS), __entry->start,
862 __entry->size, __entry->max_size, __entry->bitmap)
863);
864
662#endif /* _TRACE_BTRFS_H */ 865#endif /* _TRACE_BTRFS_H */
663 866
664/* This part must be outside protection */ 867/* This part must be outside protection */
diff --git a/include/trace/events/ext4.h b/include/trace/events/ext4.h
index 748ff7cbe555..319538bf17d2 100644
--- a/include/trace/events/ext4.h
+++ b/include/trace/events/ext4.h
@@ -573,9 +573,9 @@ TRACE_EVENT(ext4_mb_release_inode_pa,
573); 573);
574 574
575TRACE_EVENT(ext4_mb_release_group_pa, 575TRACE_EVENT(ext4_mb_release_group_pa,
576 TP_PROTO(struct ext4_prealloc_space *pa), 576 TP_PROTO(struct super_block *sb, struct ext4_prealloc_space *pa),
577 577
578 TP_ARGS(pa), 578 TP_ARGS(sb, pa),
579 579
580 TP_STRUCT__entry( 580 TP_STRUCT__entry(
581 __field( dev_t, dev ) 581 __field( dev_t, dev )
@@ -585,7 +585,7 @@ TRACE_EVENT(ext4_mb_release_group_pa,
585 ), 585 ),
586 586
587 TP_fast_assign( 587 TP_fast_assign(
588 __entry->dev = pa->pa_inode->i_sb->s_dev; 588 __entry->dev = sb->s_dev;
589 __entry->pa_pstart = pa->pa_pstart; 589 __entry->pa_pstart = pa->pa_pstart;
590 __entry->pa_len = pa->pa_len; 590 __entry->pa_len = pa->pa_len;
591 ), 591 ),
diff --git a/include/trace/events/kmem.h b/include/trace/events/kmem.h
index a9c87ad8331c..5f889f16b0c8 100644
--- a/include/trace/events/kmem.h
+++ b/include/trace/events/kmem.h
@@ -147,7 +147,7 @@ DEFINE_EVENT(kmem_free, kmem_cache_free,
147 TP_ARGS(call_site, ptr) 147 TP_ARGS(call_site, ptr)
148); 148);
149 149
150TRACE_EVENT(mm_page_free_direct, 150TRACE_EVENT(mm_page_free,
151 151
152 TP_PROTO(struct page *page, unsigned int order), 152 TP_PROTO(struct page *page, unsigned int order),
153 153
@@ -169,7 +169,7 @@ TRACE_EVENT(mm_page_free_direct,
169 __entry->order) 169 __entry->order)
170); 170);
171 171
172TRACE_EVENT(mm_pagevec_free, 172TRACE_EVENT(mm_page_free_batched,
173 173
174 TP_PROTO(struct page *page, int cold), 174 TP_PROTO(struct page *page, int cold),
175 175
diff --git a/include/trace/events/oom.h b/include/trace/events/oom.h
new file mode 100644
index 000000000000..dd4ba3b92002
--- /dev/null
+++ b/include/trace/events/oom.h
@@ -0,0 +1,33 @@
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM oom
3
4#if !defined(_TRACE_OOM_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_OOM_H
6#include <linux/tracepoint.h>
7
8TRACE_EVENT(oom_score_adj_update,
9
10 TP_PROTO(struct task_struct *task),
11
12 TP_ARGS(task),
13
14 TP_STRUCT__entry(
15 __field( pid_t, pid)
16 __array( char, comm, TASK_COMM_LEN )
17 __field( int, oom_score_adj)
18 ),
19
20 TP_fast_assign(
21 __entry->pid = task->pid;
22 memcpy(__entry->comm, task->comm, TASK_COMM_LEN);
23 __entry->oom_score_adj = task->signal->oom_score_adj;
24 ),
25
26 TP_printk("pid=%d comm=%s oom_score_adj=%d",
27 __entry->pid, __entry->comm, __entry->oom_score_adj)
28);
29
30#endif
31
32/* This part must be outside protection */
33#include <trace/define_trace.h>
diff --git a/include/trace/events/regmap.h b/include/trace/events/regmap.h
index 1e3193b8fcc8..12fbf43524e9 100644
--- a/include/trace/events/regmap.h
+++ b/include/trace/events/regmap.h
@@ -55,6 +55,15 @@ DEFINE_EVENT(regmap_reg, regmap_reg_read,
55 55
56); 56);
57 57
58DEFINE_EVENT(regmap_reg, regmap_reg_read_cache,
59
60 TP_PROTO(struct device *dev, unsigned int reg,
61 unsigned int val),
62
63 TP_ARGS(dev, reg, val)
64
65);
66
58DECLARE_EVENT_CLASS(regmap_block, 67DECLARE_EVENT_CLASS(regmap_block,
59 68
60 TP_PROTO(struct device *dev, unsigned int reg, int count), 69 TP_PROTO(struct device *dev, unsigned int reg, int count),
diff --git a/include/trace/events/task.h b/include/trace/events/task.h
new file mode 100644
index 000000000000..b53add02e929
--- /dev/null
+++ b/include/trace/events/task.h
@@ -0,0 +1,61 @@
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM task
3
4#if !defined(_TRACE_TASK_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_TASK_H
6#include <linux/tracepoint.h>
7
8TRACE_EVENT(task_newtask,
9
10 TP_PROTO(struct task_struct *task, unsigned long clone_flags),
11
12 TP_ARGS(task, clone_flags),
13
14 TP_STRUCT__entry(
15 __field( pid_t, pid)
16 __array( char, comm, TASK_COMM_LEN)
17 __field( unsigned long, clone_flags)
18 __field( int, oom_score_adj)
19 ),
20
21 TP_fast_assign(
22 __entry->pid = task->pid;
23 memcpy(__entry->comm, task->comm, TASK_COMM_LEN);
24 __entry->clone_flags = clone_flags;
25 __entry->oom_score_adj = task->signal->oom_score_adj;
26 ),
27
28 TP_printk("pid=%d comm=%s clone_flags=%lx oom_score_adj=%d",
29 __entry->pid, __entry->comm,
30 __entry->clone_flags, __entry->oom_score_adj)
31);
32
33TRACE_EVENT(task_rename,
34
35 TP_PROTO(struct task_struct *task, char *comm),
36
37 TP_ARGS(task, comm),
38
39 TP_STRUCT__entry(
40 __field( pid_t, pid)
41 __array( char, oldcomm, TASK_COMM_LEN)
42 __array( char, newcomm, TASK_COMM_LEN)
43 __field( int, oom_score_adj)
44 ),
45
46 TP_fast_assign(
47 __entry->pid = task->pid;
48 memcpy(entry->oldcomm, task->comm, TASK_COMM_LEN);
49 memcpy(entry->newcomm, comm, TASK_COMM_LEN);
50 __entry->oom_score_adj = task->signal->oom_score_adj;
51 ),
52
53 TP_printk("pid=%d oldcomm=%s newcomm=%s oom_score_adj=%d",
54 __entry->pid, __entry->oldcomm,
55 __entry->newcomm, __entry->oom_score_adj)
56);
57
58#endif
59
60/* This part must be outside protection */
61#include <trace/define_trace.h>
diff --git a/include/trace/events/vmscan.h b/include/trace/events/vmscan.h
index edc4b3d25a2d..f64560e204bc 100644
--- a/include/trace/events/vmscan.h
+++ b/include/trace/events/vmscan.h
@@ -266,9 +266,10 @@ DECLARE_EVENT_CLASS(mm_vmscan_lru_isolate_template,
266 unsigned long nr_lumpy_taken, 266 unsigned long nr_lumpy_taken,
267 unsigned long nr_lumpy_dirty, 267 unsigned long nr_lumpy_dirty,
268 unsigned long nr_lumpy_failed, 268 unsigned long nr_lumpy_failed,
269 isolate_mode_t isolate_mode), 269 isolate_mode_t isolate_mode,
270 int file),
270 271
271 TP_ARGS(order, nr_requested, nr_scanned, nr_taken, nr_lumpy_taken, nr_lumpy_dirty, nr_lumpy_failed, isolate_mode), 272 TP_ARGS(order, nr_requested, nr_scanned, nr_taken, nr_lumpy_taken, nr_lumpy_dirty, nr_lumpy_failed, isolate_mode, file),
272 273
273 TP_STRUCT__entry( 274 TP_STRUCT__entry(
274 __field(int, order) 275 __field(int, order)
@@ -279,6 +280,7 @@ DECLARE_EVENT_CLASS(mm_vmscan_lru_isolate_template,
279 __field(unsigned long, nr_lumpy_dirty) 280 __field(unsigned long, nr_lumpy_dirty)
280 __field(unsigned long, nr_lumpy_failed) 281 __field(unsigned long, nr_lumpy_failed)
281 __field(isolate_mode_t, isolate_mode) 282 __field(isolate_mode_t, isolate_mode)
283 __field(int, file)
282 ), 284 ),
283 285
284 TP_fast_assign( 286 TP_fast_assign(
@@ -290,9 +292,10 @@ DECLARE_EVENT_CLASS(mm_vmscan_lru_isolate_template,
290 __entry->nr_lumpy_dirty = nr_lumpy_dirty; 292 __entry->nr_lumpy_dirty = nr_lumpy_dirty;
291 __entry->nr_lumpy_failed = nr_lumpy_failed; 293 __entry->nr_lumpy_failed = nr_lumpy_failed;
292 __entry->isolate_mode = isolate_mode; 294 __entry->isolate_mode = isolate_mode;
295 __entry->file = file;
293 ), 296 ),
294 297
295 TP_printk("isolate_mode=%d order=%d nr_requested=%lu nr_scanned=%lu nr_taken=%lu contig_taken=%lu contig_dirty=%lu contig_failed=%lu", 298 TP_printk("isolate_mode=%d order=%d nr_requested=%lu nr_scanned=%lu nr_taken=%lu contig_taken=%lu contig_dirty=%lu contig_failed=%lu file=%d",
296 __entry->isolate_mode, 299 __entry->isolate_mode,
297 __entry->order, 300 __entry->order,
298 __entry->nr_requested, 301 __entry->nr_requested,
@@ -300,7 +303,8 @@ DECLARE_EVENT_CLASS(mm_vmscan_lru_isolate_template,
300 __entry->nr_taken, 303 __entry->nr_taken,
301 __entry->nr_lumpy_taken, 304 __entry->nr_lumpy_taken,
302 __entry->nr_lumpy_dirty, 305 __entry->nr_lumpy_dirty,
303 __entry->nr_lumpy_failed) 306 __entry->nr_lumpy_failed,
307 __entry->file)
304); 308);
305 309
306DEFINE_EVENT(mm_vmscan_lru_isolate_template, mm_vmscan_lru_isolate, 310DEFINE_EVENT(mm_vmscan_lru_isolate_template, mm_vmscan_lru_isolate,
@@ -312,9 +316,10 @@ DEFINE_EVENT(mm_vmscan_lru_isolate_template, mm_vmscan_lru_isolate,
312 unsigned long nr_lumpy_taken, 316 unsigned long nr_lumpy_taken,
313 unsigned long nr_lumpy_dirty, 317 unsigned long nr_lumpy_dirty,
314 unsigned long nr_lumpy_failed, 318 unsigned long nr_lumpy_failed,
315 isolate_mode_t isolate_mode), 319 isolate_mode_t isolate_mode,
320 int file),
316 321
317 TP_ARGS(order, nr_requested, nr_scanned, nr_taken, nr_lumpy_taken, nr_lumpy_dirty, nr_lumpy_failed, isolate_mode) 322 TP_ARGS(order, nr_requested, nr_scanned, nr_taken, nr_lumpy_taken, nr_lumpy_dirty, nr_lumpy_failed, isolate_mode, file)
318 323
319); 324);
320 325
@@ -327,9 +332,10 @@ DEFINE_EVENT(mm_vmscan_lru_isolate_template, mm_vmscan_memcg_isolate,
327 unsigned long nr_lumpy_taken, 332 unsigned long nr_lumpy_taken,
328 unsigned long nr_lumpy_dirty, 333 unsigned long nr_lumpy_dirty,
329 unsigned long nr_lumpy_failed, 334 unsigned long nr_lumpy_failed,
330 isolate_mode_t isolate_mode), 335 isolate_mode_t isolate_mode,
336 int file),
331 337
332 TP_ARGS(order, nr_requested, nr_scanned, nr_taken, nr_lumpy_taken, nr_lumpy_dirty, nr_lumpy_failed, isolate_mode) 338 TP_ARGS(order, nr_requested, nr_scanned, nr_taken, nr_lumpy_taken, nr_lumpy_dirty, nr_lumpy_failed, isolate_mode, file)
333 339
334); 340);
335 341
diff --git a/include/trace/events/writeback.h b/include/trace/events/writeback.h
index 99d1d0decf88..8588a8918023 100644
--- a/include/trace/events/writeback.h
+++ b/include/trace/events/writeback.h
@@ -300,12 +300,13 @@ TRACE_EVENT(balance_dirty_pages,
300 unsigned long dirty_ratelimit, 300 unsigned long dirty_ratelimit,
301 unsigned long task_ratelimit, 301 unsigned long task_ratelimit,
302 unsigned long dirtied, 302 unsigned long dirtied,
303 unsigned long period,
303 long pause, 304 long pause,
304 unsigned long start_time), 305 unsigned long start_time),
305 306
306 TP_ARGS(bdi, thresh, bg_thresh, dirty, bdi_thresh, bdi_dirty, 307 TP_ARGS(bdi, thresh, bg_thresh, dirty, bdi_thresh, bdi_dirty,
307 dirty_ratelimit, task_ratelimit, 308 dirty_ratelimit, task_ratelimit,
308 dirtied, pause, start_time), 309 dirtied, period, pause, start_time),
309 310
310 TP_STRUCT__entry( 311 TP_STRUCT__entry(
311 __array( char, bdi, 32) 312 __array( char, bdi, 32)
@@ -320,6 +321,8 @@ TRACE_EVENT(balance_dirty_pages,
320 __field(unsigned int, dirtied_pause) 321 __field(unsigned int, dirtied_pause)
321 __field(unsigned long, paused) 322 __field(unsigned long, paused)
322 __field( long, pause) 323 __field( long, pause)
324 __field(unsigned long, period)
325 __field( long, think)
323 ), 326 ),
324 327
325 TP_fast_assign( 328 TP_fast_assign(
@@ -336,6 +339,9 @@ TRACE_EVENT(balance_dirty_pages,
336 __entry->task_ratelimit = KBps(task_ratelimit); 339 __entry->task_ratelimit = KBps(task_ratelimit);
337 __entry->dirtied = dirtied; 340 __entry->dirtied = dirtied;
338 __entry->dirtied_pause = current->nr_dirtied_pause; 341 __entry->dirtied_pause = current->nr_dirtied_pause;
342 __entry->think = current->dirty_paused_when == 0 ? 0 :
343 (long)(jiffies - current->dirty_paused_when) * 1000/HZ;
344 __entry->period = period * 1000 / HZ;
339 __entry->pause = pause * 1000 / HZ; 345 __entry->pause = pause * 1000 / HZ;
340 __entry->paused = (jiffies - start_time) * 1000 / HZ; 346 __entry->paused = (jiffies - start_time) * 1000 / HZ;
341 ), 347 ),
@@ -346,7 +352,7 @@ TRACE_EVENT(balance_dirty_pages,
346 "bdi_setpoint=%lu bdi_dirty=%lu " 352 "bdi_setpoint=%lu bdi_dirty=%lu "
347 "dirty_ratelimit=%lu task_ratelimit=%lu " 353 "dirty_ratelimit=%lu task_ratelimit=%lu "
348 "dirtied=%u dirtied_pause=%u " 354 "dirtied=%u dirtied_pause=%u "
349 "paused=%lu pause=%ld", 355 "paused=%lu pause=%ld period=%lu think=%ld",
350 __entry->bdi, 356 __entry->bdi,
351 __entry->limit, 357 __entry->limit,
352 __entry->setpoint, 358 __entry->setpoint,
@@ -358,7 +364,9 @@ TRACE_EVENT(balance_dirty_pages,
358 __entry->dirtied, 364 __entry->dirtied,
359 __entry->dirtied_pause, 365 __entry->dirtied_pause,
360 __entry->paused, /* ms */ 366 __entry->paused, /* ms */
361 __entry->pause /* ms */ 367 __entry->pause, /* ms */
368 __entry->period, /* ms */
369 __entry->think /* ms */
362 ) 370 )
363); 371);
364 372
diff --git a/include/video/edid.h b/include/video/edid.h
index 928c342b33d6..c5f198704912 100644
--- a/include/video/edid.h
+++ b/include/video/edid.h
@@ -1,16 +1,14 @@
1#ifndef __linux_video_edid_h__ 1#ifndef __linux_video_edid_h__
2#define __linux_video_edid_h__ 2#define __linux_video_edid_h__
3 3
4#if !defined(__KERNEL__) || defined(CONFIG_X86)
5
6struct edid_info { 4struct edid_info {
7 unsigned char dummy[128]; 5 unsigned char dummy[128];
8}; 6};
9 7
10#ifdef __KERNEL__ 8#ifdef __KERNEL__
9#ifdef CONFIG_X86
11extern struct edid_info edid_info; 10extern struct edid_info edid_info;
12#endif /* __KERNEL__ */ 11#endif
13
14#endif 12#endif
15 13
16#endif /* __linux_video_edid_h__ */ 14#endif /* __linux_video_edid_h__ */
diff --git a/include/video/omapdss.h b/include/video/omapdss.h
index 378c7ed6760b..062b3b24ff10 100644
--- a/include/video/omapdss.h
+++ b/include/video/omapdss.h
@@ -200,6 +200,10 @@ enum omap_dss_clk_source {
200 OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DSI, /* OMAP4: PLL2_CLK2 */ 200 OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DSI, /* OMAP4: PLL2_CLK2 */
201}; 201};
202 202
203enum omap_hdmi_flags {
204 OMAP_HDMI_SDA_SCL_EXTERNAL_PULLUP = 1 << 0,
205};
206
203/* RFBI */ 207/* RFBI */
204 208
205struct rfbi_timings { 209struct rfbi_timings {
@@ -294,8 +298,8 @@ int dsi_vc_set_max_rx_packet_size(struct omap_dss_device *dssdev, int channel,
294 u16 len); 298 u16 len);
295int dsi_vc_send_null(struct omap_dss_device *dssdev, int channel); 299int dsi_vc_send_null(struct omap_dss_device *dssdev, int channel);
296int dsi_vc_send_bta_sync(struct omap_dss_device *dssdev, int channel); 300int dsi_vc_send_bta_sync(struct omap_dss_device *dssdev, int channel);
297int dsi_video_mode_enable(struct omap_dss_device *dssdev, int channel); 301int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel);
298void dsi_video_mode_disable(struct omap_dss_device *dssdev, int channel); 302void dsi_disable_video_output(struct omap_dss_device *dssdev, int channel);
299 303
300/* Board specific data */ 304/* Board specific data */
301struct omap_dss_board_info { 305struct omap_dss_board_info {
@@ -309,6 +313,8 @@ struct omap_dss_board_info {
309 313
310/* Init with the board info */ 314/* Init with the board info */
311extern int omap_display_init(struct omap_dss_board_info *board_data); 315extern int omap_display_init(struct omap_dss_board_info *board_data);
316/* HDMI mux init*/
317extern int omap_hdmi_init(enum omap_hdmi_flags flags);
312 318
313struct omap_display_platform_data { 319struct omap_display_platform_data {
314 struct omap_dss_board_info *board_data; 320 struct omap_dss_board_info *board_data;
@@ -352,8 +358,6 @@ struct omap_dss_cpr_coefs {
352}; 358};
353 359
354struct omap_overlay_info { 360struct omap_overlay_info {
355 bool enabled;
356
357 u32 paddr; 361 u32 paddr;
358 u32 p_uv_addr; /* for NV12 format */ 362 u32 p_uv_addr; /* for NV12 format */
359 u16 screen_width; 363 u16 screen_width;
@@ -385,11 +389,21 @@ struct omap_overlay {
385 389
386 /* dynamic fields */ 390 /* dynamic fields */
387 struct omap_overlay_manager *manager; 391 struct omap_overlay_manager *manager;
388 struct omap_overlay_info info;
389 392
390 bool manager_changed; 393 /*
391 /* if true, info has been changed, but not applied() yet */ 394 * The following functions do not block:
392 bool info_dirty; 395 *
396 * is_enabled
397 * set_overlay_info
398 * get_overlay_info
399 *
400 * The rest of the functions may block and cannot be called from
401 * interrupt context
402 */
403
404 int (*enable)(struct omap_overlay *ovl);
405 int (*disable)(struct omap_overlay *ovl);
406 bool (*is_enabled)(struct omap_overlay *ovl);
393 407
394 int (*set_manager)(struct omap_overlay *ovl, 408 int (*set_manager)(struct omap_overlay *ovl,
395 struct omap_overlay_manager *mgr); 409 struct omap_overlay_manager *mgr);
@@ -418,23 +432,27 @@ struct omap_overlay_manager_info {
418 432
419struct omap_overlay_manager { 433struct omap_overlay_manager {
420 struct kobject kobj; 434 struct kobject kobj;
421 struct list_head list;
422 435
423 /* static fields */ 436 /* static fields */
424 const char *name; 437 const char *name;
425 enum omap_channel id; 438 enum omap_channel id;
426 enum omap_overlay_manager_caps caps; 439 enum omap_overlay_manager_caps caps;
427 int num_overlays; 440 struct list_head overlays;
428 struct omap_overlay **overlays;
429 enum omap_display_type supported_displays; 441 enum omap_display_type supported_displays;
430 442
431 /* dynamic fields */ 443 /* dynamic fields */
432 struct omap_dss_device *device; 444 struct omap_dss_device *device;
433 struct omap_overlay_manager_info info;
434 445
435 bool device_changed; 446 /*
436 /* if true, info has been changed but not applied() yet */ 447 * The following functions do not block:
437 bool info_dirty; 448 *
449 * set_manager_info
450 * get_manager_info
451 * apply
452 *
453 * The rest of the functions may block and cannot be called from
454 * interrupt context
455 */
438 456
439 int (*set_device)(struct omap_overlay_manager *mgr, 457 int (*set_device)(struct omap_overlay_manager *mgr,
440 struct omap_dss_device *dssdev); 458 struct omap_dss_device *dssdev);
@@ -448,9 +466,6 @@ struct omap_overlay_manager {
448 int (*apply)(struct omap_overlay_manager *mgr); 466 int (*apply)(struct omap_overlay_manager *mgr);
449 int (*wait_for_go)(struct omap_overlay_manager *mgr); 467 int (*wait_for_go)(struct omap_overlay_manager *mgr);
450 int (*wait_for_vsync)(struct omap_overlay_manager *mgr); 468 int (*wait_for_vsync)(struct omap_overlay_manager *mgr);
451
452 int (*enable)(struct omap_overlay_manager *mgr);
453 int (*disable)(struct omap_overlay_manager *mgr);
454}; 469};
455 470
456struct omap_dss_device { 471struct omap_dss_device {
@@ -662,12 +677,7 @@ void omapdss_dsi_vc_enable_hs(struct omap_dss_device *dssdev, int channel,
662 bool enable); 677 bool enable);
663int omapdss_dsi_enable_te(struct omap_dss_device *dssdev, bool enable); 678int omapdss_dsi_enable_te(struct omap_dss_device *dssdev, bool enable);
664 679
665int omap_dsi_prepare_update(struct omap_dss_device *dssdev, 680int omap_dsi_update(struct omap_dss_device *dssdev, int channel,
666 u16 *x, u16 *y, u16 *w, u16 *h,
667 bool enlarge_update_area);
668int omap_dsi_update(struct omap_dss_device *dssdev,
669 int channel,
670 u16 x, u16 y, u16 w, u16 h,
671 void (*callback)(int, void *), void *data); 681 void (*callback)(int, void *), void *data);
672int omap_dsi_request_vc(struct omap_dss_device *dssdev, int *channel); 682int omap_dsi_request_vc(struct omap_dss_device *dssdev, int *channel);
673int omap_dsi_set_vc_id(struct omap_dss_device *dssdev, int channel, int vc_id); 683int omap_dsi_set_vc_id(struct omap_dss_device *dssdev, int channel, int vc_id);
diff --git a/include/video/sh_mipi_dsi.h b/include/video/sh_mipi_dsi.h
index 6cb95c977de9..434d56b4a1a5 100644
--- a/include/video/sh_mipi_dsi.h
+++ b/include/video/sh_mipi_dsi.h
@@ -28,14 +28,33 @@ enum sh_mipi_dsi_data_fmt {
28struct sh_mobile_lcdc_chan_cfg; 28struct sh_mobile_lcdc_chan_cfg;
29 29
30#define SH_MIPI_DSI_HSABM (1 << 0) 30#define SH_MIPI_DSI_HSABM (1 << 0)
31#define SH_MIPI_DSI_HSPBM (1 << 1) 31#define SH_MIPI_DSI_HBPBM (1 << 1)
32#define SH_MIPI_DSI_HFPBM (1 << 2)
33#define SH_MIPI_DSI_BL2E (1 << 3)
34#define SH_MIPI_DSI_VSEE (1 << 4)
35#define SH_MIPI_DSI_HSEE (1 << 5)
36#define SH_MIPI_DSI_HSAE (1 << 6)
37
38#define SH_MIPI_DSI_HSbyteCLK (1 << 24)
39#define SH_MIPI_DSI_HS6divCLK (1 << 25)
40#define SH_MIPI_DSI_HS4divCLK (1 << 26)
41
42#define SH_MIPI_DSI_SYNC_PULSES_MODE (SH_MIPI_DSI_VSEE | \
43 SH_MIPI_DSI_HSEE | \
44 SH_MIPI_DSI_HSAE)
45#define SH_MIPI_DSI_SYNC_EVENTS_MODE (0)
46#define SH_MIPI_DSI_SYNC_BURST_MODE (SH_MIPI_DSI_BL2E)
32 47
33struct sh_mipi_dsi_info { 48struct sh_mipi_dsi_info {
34 enum sh_mipi_dsi_data_fmt data_format; 49 enum sh_mipi_dsi_data_fmt data_format;
35 struct sh_mobile_lcdc_chan_cfg *lcd_chan; 50 struct sh_mobile_lcdc_chan_cfg *lcd_chan;
51 int lane;
36 unsigned long flags; 52 unsigned long flags;
37 u32 clksrc; 53 u32 clksrc;
38 unsigned int vsynw_offset; 54 unsigned int vsynw_offset;
55 int (*set_dot_clock)(struct platform_device *pdev,
56 void __iomem *base,
57 int enable);
39}; 58};
40 59
41#endif 60#endif
diff --git a/include/video/sh_mobile_lcdc.h b/include/video/sh_mobile_lcdc.h
index 8101b726b48a..fe30b759c51e 100644
--- a/include/video/sh_mobile_lcdc.h
+++ b/include/video/sh_mobile_lcdc.h
@@ -174,7 +174,8 @@ struct sh_mobile_lcdc_bl_info {
174 174
175struct sh_mobile_lcdc_chan_cfg { 175struct sh_mobile_lcdc_chan_cfg {
176 int chan; 176 int chan;
177 int bpp; 177 int fourcc;
178 int colorspace;
178 int interface_type; /* selects RGBn or SYSn I/F, see above */ 179 int interface_type; /* selects RGBn or SYSn I/F, see above */
179 int clock_divider; 180 int clock_divider;
180 unsigned long flags; /* LCDC_FLAGS_... */ 181 unsigned long flags; /* LCDC_FLAGS_... */
@@ -184,7 +185,6 @@ struct sh_mobile_lcdc_chan_cfg {
184 struct sh_mobile_lcdc_board_cfg board_cfg; 185 struct sh_mobile_lcdc_board_cfg board_cfg;
185 struct sh_mobile_lcdc_bl_info bl_info; 186 struct sh_mobile_lcdc_bl_info bl_info;
186 struct sh_mobile_lcdc_sys_bus_cfg sys_bus_cfg; /* only for SYSn I/F */ 187 struct sh_mobile_lcdc_sys_bus_cfg sys_bus_cfg; /* only for SYSn I/F */
187 int nonstd;
188 struct sh_mobile_meram_cfg *meram_cfg; 188 struct sh_mobile_meram_cfg *meram_cfg;
189}; 189};
190 190
diff --git a/include/xen/events.h b/include/xen/events.h
index d287997d3eab..0f773708e02c 100644
--- a/include/xen/events.h
+++ b/include/xen/events.h
@@ -37,6 +37,13 @@ int bind_interdomain_evtchn_to_irqhandler(unsigned int remote_domain,
37 */ 37 */
38void unbind_from_irqhandler(unsigned int irq, void *dev_id); 38void unbind_from_irqhandler(unsigned int irq, void *dev_id);
39 39
40/*
41 * Allow extra references to event channels exposed to userspace by evtchn
42 */
43int evtchn_make_refcounted(unsigned int evtchn);
44int evtchn_get(unsigned int evtchn);
45void evtchn_put(unsigned int evtchn);
46
40void xen_send_IPI_one(unsigned int cpu, enum ipi_vector vector); 47void xen_send_IPI_one(unsigned int cpu, enum ipi_vector vector);
41int resend_irq_on_evtchn(unsigned int irq); 48int resend_irq_on_evtchn(unsigned int irq);
42void rebind_evtchn_irq(int evtchn, int irq); 49void rebind_evtchn_irq(int evtchn, int irq);
diff --git a/include/xen/grant_table.h b/include/xen/grant_table.h
index 11e2dfce42f8..15f8a00ff003 100644
--- a/include/xen/grant_table.h
+++ b/include/xen/grant_table.h
@@ -62,6 +62,24 @@ int gnttab_resume(void);
62 62
63int gnttab_grant_foreign_access(domid_t domid, unsigned long frame, 63int gnttab_grant_foreign_access(domid_t domid, unsigned long frame,
64 int readonly); 64 int readonly);
65int gnttab_grant_foreign_access_subpage(domid_t domid, unsigned long frame,
66 int flags, unsigned page_off,
67 unsigned length);
68int gnttab_grant_foreign_access_trans(domid_t domid, int flags,
69 domid_t trans_domid,
70 grant_ref_t trans_gref);
71
72/*
73 * Are sub-page grants available on this version of Xen? Returns true if they
74 * are, and false if they're not.
75 */
76bool gnttab_subpage_grants_available(void);
77
78/*
79 * Are transitive grants available on this version of Xen? Returns true if they
80 * are, and false if they're not.
81 */
82bool gnttab_trans_grants_available(void);
65 83
66/* 84/*
67 * End access through the given grant reference, iff the grant entry is no 85 * End access through the given grant reference, iff the grant entry is no
@@ -108,6 +126,13 @@ void gnttab_cancel_free_callback(struct gnttab_free_callback *callback);
108 126
109void gnttab_grant_foreign_access_ref(grant_ref_t ref, domid_t domid, 127void gnttab_grant_foreign_access_ref(grant_ref_t ref, domid_t domid,
110 unsigned long frame, int readonly); 128 unsigned long frame, int readonly);
129int gnttab_grant_foreign_access_subpage_ref(grant_ref_t ref, domid_t domid,
130 unsigned long frame, int flags,
131 unsigned page_off,
132 unsigned length);
133int gnttab_grant_foreign_access_trans_ref(grant_ref_t ref, domid_t domid,
134 int flags, domid_t trans_domid,
135 grant_ref_t trans_gref);
111 136
112void gnttab_grant_foreign_transfer_ref(grant_ref_t, domid_t domid, 137void gnttab_grant_foreign_transfer_ref(grant_ref_t, domid_t domid,
113 unsigned long pfn); 138 unsigned long pfn);
@@ -145,9 +170,11 @@ gnttab_set_unmap_op(struct gnttab_unmap_grant_ref *unmap, phys_addr_t addr,
145 170
146int arch_gnttab_map_shared(unsigned long *frames, unsigned long nr_gframes, 171int arch_gnttab_map_shared(unsigned long *frames, unsigned long nr_gframes,
147 unsigned long max_nr_gframes, 172 unsigned long max_nr_gframes,
148 struct grant_entry **__shared); 173 void **__shared);
149void arch_gnttab_unmap_shared(struct grant_entry *shared, 174int arch_gnttab_map_status(uint64_t *frames, unsigned long nr_gframes,
150 unsigned long nr_gframes); 175 unsigned long max_nr_gframes,
176 grant_status_t **__shared);
177void arch_gnttab_unmap(void *shared, unsigned long nr_gframes);
151 178
152extern unsigned long xen_hvm_resume_frames; 179extern unsigned long xen_hvm_resume_frames;
153unsigned int gnttab_max_grant_frames(void); 180unsigned int gnttab_max_grant_frames(void);
@@ -155,9 +182,9 @@ unsigned int gnttab_max_grant_frames(void);
155#define gnttab_map_vaddr(map) ((void *)(map.host_virt_addr)) 182#define gnttab_map_vaddr(map) ((void *)(map.host_virt_addr))
156 183
157int gnttab_map_refs(struct gnttab_map_grant_ref *map_ops, 184int gnttab_map_refs(struct gnttab_map_grant_ref *map_ops,
158 struct gnttab_map_grant_ref *kmap_ops, 185 struct gnttab_map_grant_ref *kmap_ops,
159 struct page **pages, unsigned int count); 186 struct page **pages, unsigned int count);
160int gnttab_unmap_refs(struct gnttab_unmap_grant_ref *unmap_ops, 187int gnttab_unmap_refs(struct gnttab_unmap_grant_ref *unmap_ops,
161 struct page **pages, unsigned int count); 188 struct page **pages, unsigned int count, bool clear_pte);
162 189
163#endif /* __ASM_GNTTAB_H__ */ 190#endif /* __ASM_GNTTAB_H__ */
diff --git a/include/xen/interface/grant_table.h b/include/xen/interface/grant_table.h
index 39e571796e32..a17d84433e6a 100644
--- a/include/xen/interface/grant_table.h
+++ b/include/xen/interface/grant_table.h
@@ -85,12 +85,22 @@
85 */ 85 */
86 86
87/* 87/*
88 * Reference to a grant entry in a specified domain's grant table.
89 */
90typedef uint32_t grant_ref_t;
91
92/*
88 * A grant table comprises a packed array of grant entries in one or more 93 * A grant table comprises a packed array of grant entries in one or more
89 * page frames shared between Xen and a guest. 94 * page frames shared between Xen and a guest.
90 * [XEN]: This field is written by Xen and read by the sharing guest. 95 * [XEN]: This field is written by Xen and read by the sharing guest.
91 * [GST]: This field is written by the guest and read by Xen. 96 * [GST]: This field is written by the guest and read by Xen.
92 */ 97 */
93struct grant_entry { 98
99/*
100 * Version 1 of the grant table entry structure is maintained purely
101 * for backwards compatibility. New guests should use version 2.
102 */
103struct grant_entry_v1 {
94 /* GTF_xxx: various type and flag information. [XEN,GST] */ 104 /* GTF_xxx: various type and flag information. [XEN,GST] */
95 uint16_t flags; 105 uint16_t flags;
96 /* The domain being granted foreign privileges. [GST] */ 106 /* The domain being granted foreign privileges. [GST] */
@@ -108,10 +118,13 @@ struct grant_entry {
108 * GTF_permit_access: Allow @domid to map/access @frame. 118 * GTF_permit_access: Allow @domid to map/access @frame.
109 * GTF_accept_transfer: Allow @domid to transfer ownership of one page frame 119 * GTF_accept_transfer: Allow @domid to transfer ownership of one page frame
110 * to this guest. Xen writes the page number to @frame. 120 * to this guest. Xen writes the page number to @frame.
121 * GTF_transitive: Allow @domid to transitively access a subrange of
122 * @trans_grant in @trans_domid. No mappings are allowed.
111 */ 123 */
112#define GTF_invalid (0U<<0) 124#define GTF_invalid (0U<<0)
113#define GTF_permit_access (1U<<0) 125#define GTF_permit_access (1U<<0)
114#define GTF_accept_transfer (2U<<0) 126#define GTF_accept_transfer (2U<<0)
127#define GTF_transitive (3U<<0)
115#define GTF_type_mask (3U<<0) 128#define GTF_type_mask (3U<<0)
116 129
117/* 130/*
@@ -119,6 +132,9 @@ struct grant_entry {
119 * GTF_readonly: Restrict @domid to read-only mappings and accesses. [GST] 132 * GTF_readonly: Restrict @domid to read-only mappings and accesses. [GST]
120 * GTF_reading: Grant entry is currently mapped for reading by @domid. [XEN] 133 * GTF_reading: Grant entry is currently mapped for reading by @domid. [XEN]
121 * GTF_writing: Grant entry is currently mapped for writing by @domid. [XEN] 134 * GTF_writing: Grant entry is currently mapped for writing by @domid. [XEN]
135 * GTF_sub_page: Grant access to only a subrange of the page. @domid
136 * will only be allowed to copy from the grant, and not
137 * map it. [GST]
122 */ 138 */
123#define _GTF_readonly (2) 139#define _GTF_readonly (2)
124#define GTF_readonly (1U<<_GTF_readonly) 140#define GTF_readonly (1U<<_GTF_readonly)
@@ -126,6 +142,8 @@ struct grant_entry {
126#define GTF_reading (1U<<_GTF_reading) 142#define GTF_reading (1U<<_GTF_reading)
127#define _GTF_writing (4) 143#define _GTF_writing (4)
128#define GTF_writing (1U<<_GTF_writing) 144#define GTF_writing (1U<<_GTF_writing)
145#define _GTF_sub_page (8)
146#define GTF_sub_page (1U<<_GTF_sub_page)
129 147
130/* 148/*
131 * Subflags for GTF_accept_transfer: 149 * Subflags for GTF_accept_transfer:
@@ -142,15 +160,81 @@ struct grant_entry {
142#define _GTF_transfer_completed (3) 160#define _GTF_transfer_completed (3)
143#define GTF_transfer_completed (1U<<_GTF_transfer_completed) 161#define GTF_transfer_completed (1U<<_GTF_transfer_completed)
144 162
163/*
164 * Version 2 grant table entries. These fulfil the same role as
165 * version 1 entries, but can represent more complicated operations.
166 * Any given domain will have either a version 1 or a version 2 table,
167 * and every entry in the table will be the same version.
168 *
169 * The interface by which domains use grant references does not depend
170 * on the grant table version in use by the other domain.
171 */
145 172
146/*********************************** 173/*
147 * GRANT TABLE QUERIES AND USES 174 * Version 1 and version 2 grant entries share a common prefix. The
175 * fields of the prefix are documented as part of struct
176 * grant_entry_v1.
148 */ 177 */
178struct grant_entry_header {
179 uint16_t flags;
180 domid_t domid;
181};
149 182
150/* 183/*
151 * Reference to a grant entry in a specified domain's grant table. 184 * Version 2 of the grant entry structure, here is an union because three
185 * different types are suppotted: full_page, sub_page and transitive.
186 */
187union grant_entry_v2 {
188 struct grant_entry_header hdr;
189
190 /*
191 * This member is used for V1-style full page grants, where either:
192 *
193 * -- hdr.type is GTF_accept_transfer, or
194 * -- hdr.type is GTF_permit_access and GTF_sub_page is not set.
195 *
196 * In that case, the frame field has the same semantics as the
197 * field of the same name in the V1 entry structure.
198 */
199 struct {
200 struct grant_entry_header hdr;
201 uint32_t pad0;
202 uint64_t frame;
203 } full_page;
204
205 /*
206 * If the grant type is GTF_grant_access and GTF_sub_page is set,
207 * @domid is allowed to access bytes [@page_off,@page_off+@length)
208 * in frame @frame.
209 */
210 struct {
211 struct grant_entry_header hdr;
212 uint16_t page_off;
213 uint16_t length;
214 uint64_t frame;
215 } sub_page;
216
217 /*
218 * If the grant is GTF_transitive, @domid is allowed to use the
219 * grant @gref in domain @trans_domid, as if it was the local
220 * domain. Obviously, the transitive access must be compatible
221 * with the original grant.
222 */
223 struct {
224 struct grant_entry_header hdr;
225 domid_t trans_domid;
226 uint16_t pad0;
227 grant_ref_t gref;
228 } transitive;
229
230 uint32_t __spacer[4]; /* Pad to a power of two */
231};
232
233typedef uint16_t grant_status_t;
234
235/***********************************
236 * GRANT TABLE QUERIES AND USES
152 */ 237 */
153typedef uint32_t grant_ref_t;
154 238
155/* 239/*
156 * Handle to track a mapping created via a grant reference. 240 * Handle to track a mapping created via a grant reference.
@@ -322,6 +406,79 @@ struct gnttab_query_size {
322DEFINE_GUEST_HANDLE_STRUCT(gnttab_query_size); 406DEFINE_GUEST_HANDLE_STRUCT(gnttab_query_size);
323 407
324/* 408/*
409 * GNTTABOP_unmap_and_replace: Destroy one or more grant-reference mappings
410 * tracked by <handle> but atomically replace the page table entry with one
411 * pointing to the machine address under <new_addr>. <new_addr> will be
412 * redirected to the null entry.
413 * NOTES:
414 * 1. The call may fail in an undefined manner if either mapping is not
415 * tracked by <handle>.
416 * 2. After executing a batch of unmaps, it is guaranteed that no stale
417 * mappings will remain in the device or host TLBs.
418 */
419#define GNTTABOP_unmap_and_replace 7
420struct gnttab_unmap_and_replace {
421 /* IN parameters. */
422 uint64_t host_addr;
423 uint64_t new_addr;
424 grant_handle_t handle;
425 /* OUT parameters. */
426 int16_t status; /* GNTST_* */
427};
428DEFINE_GUEST_HANDLE_STRUCT(gnttab_unmap_and_replace);
429
430/*
431 * GNTTABOP_set_version: Request a particular version of the grant
432 * table shared table structure. This operation can only be performed
433 * once in any given domain. It must be performed before any grants
434 * are activated; otherwise, the domain will be stuck with version 1.
435 * The only defined versions are 1 and 2.
436 */
437#define GNTTABOP_set_version 8
438struct gnttab_set_version {
439 /* IN parameters */
440 uint32_t version;
441};
442DEFINE_GUEST_HANDLE_STRUCT(gnttab_set_version);
443
444/*
445 * GNTTABOP_get_status_frames: Get the list of frames used to store grant
446 * status for <dom>. In grant format version 2, the status is separated
447 * from the other shared grant fields to allow more efficient synchronization
448 * using barriers instead of atomic cmpexch operations.
449 * <nr_frames> specify the size of vector <frame_list>.
450 * The frame addresses are returned in the <frame_list>.
451 * Only <nr_frames> addresses are returned, even if the table is larger.
452 * NOTES:
453 * 1. <dom> may be specified as DOMID_SELF.
454 * 2. Only a sufficiently-privileged domain may specify <dom> != DOMID_SELF.
455 */
456#define GNTTABOP_get_status_frames 9
457struct gnttab_get_status_frames {
458 /* IN parameters. */
459 uint32_t nr_frames;
460 domid_t dom;
461 /* OUT parameters. */
462 int16_t status; /* GNTST_* */
463 GUEST_HANDLE(uint64_t) frame_list;
464};
465DEFINE_GUEST_HANDLE_STRUCT(gnttab_get_status_frames);
466
467/*
468 * GNTTABOP_get_version: Get the grant table version which is in
469 * effect for domain <dom>.
470 */
471#define GNTTABOP_get_version 10
472struct gnttab_get_version {
473 /* IN parameters */
474 domid_t dom;
475 uint16_t pad;
476 /* OUT parameters */
477 uint32_t version;
478};
479DEFINE_GUEST_HANDLE_STRUCT(gnttab_get_version);
480
481/*
325 * Bitfield values for update_pin_status.flags. 482 * Bitfield values for update_pin_status.flags.
326 */ 483 */
327 /* Map the grant entry for access by I/O devices. */ 484 /* Map the grant entry for access by I/O devices. */
diff --git a/include/xen/interface/io/blkif.h b/include/xen/interface/io/blkif.h
index 9324488f23f0..ee338bfde18b 100644
--- a/include/xen/interface/io/blkif.h
+++ b/include/xen/interface/io/blkif.h
@@ -84,6 +84,21 @@ typedef uint64_t blkif_sector_t;
84 * e07154r6-Data_Set_Management_Proposal_for_ATA-ACS2.doc 84 * e07154r6-Data_Set_Management_Proposal_for_ATA-ACS2.doc
85 * http://www.seagate.com/staticfiles/support/disc/manuals/ 85 * http://www.seagate.com/staticfiles/support/disc/manuals/
86 * Interface%20manuals/100293068c.pdf 86 * Interface%20manuals/100293068c.pdf
87 * The backend can optionally provide three extra XenBus attributes to
88 * further optimize the discard functionality:
89 * 'discard-aligment' - Devices that support discard functionality may
90 * internally allocate space in units that are bigger than the exported
91 * logical block size. The discard-alignment parameter indicates how many bytes
92 * the beginning of the partition is offset from the internal allocation unit's
93 * natural alignment.
94 * 'discard-granularity' - Devices that support discard functionality may
95 * internally allocate space using units that are bigger than the logical block
96 * size. The discard-granularity parameter indicates the size of the internal
97 * allocation unit in bytes if reported by the device. Otherwise the
98 * discard-granularity will be set to match the device's physical block size.
99 * 'discard-secure' - All copies of the discarded sectors (potentially created
100 * by garbage collection) must also be erased. To use this feature, the flag
101 * BLKIF_DISCARD_SECURE must be set in the blkif_request_trim.
87 */ 102 */
88#define BLKIF_OP_DISCARD 5 103#define BLKIF_OP_DISCARD 5
89 104
@@ -95,6 +110,12 @@ typedef uint64_t blkif_sector_t;
95#define BLKIF_MAX_SEGMENTS_PER_REQUEST 11 110#define BLKIF_MAX_SEGMENTS_PER_REQUEST 11
96 111
97struct blkif_request_rw { 112struct blkif_request_rw {
113 uint8_t nr_segments; /* number of segments */
114 blkif_vdev_t handle; /* only for read/write requests */
115#ifdef CONFIG_X86_64
116 uint32_t _pad1; /* offsetof(blkif_request,u.rw.id) == 8 */
117#endif
118 uint64_t id; /* private guest value, echoed in resp */
98 blkif_sector_t sector_number;/* start sector idx on disk (r/w only) */ 119 blkif_sector_t sector_number;/* start sector idx on disk (r/w only) */
99 struct blkif_request_segment { 120 struct blkif_request_segment {
100 grant_ref_t gref; /* reference to I/O buffer frame */ 121 grant_ref_t gref; /* reference to I/O buffer frame */
@@ -102,23 +123,28 @@ struct blkif_request_rw {
102 /* @last_sect: last sector in frame to transfer (inclusive). */ 123 /* @last_sect: last sector in frame to transfer (inclusive). */
103 uint8_t first_sect, last_sect; 124 uint8_t first_sect, last_sect;
104 } seg[BLKIF_MAX_SEGMENTS_PER_REQUEST]; 125 } seg[BLKIF_MAX_SEGMENTS_PER_REQUEST];
105}; 126} __attribute__((__packed__));
106 127
107struct blkif_request_discard { 128struct blkif_request_discard {
129 uint8_t flag; /* BLKIF_DISCARD_SECURE or zero. */
130#define BLKIF_DISCARD_SECURE (1<<0) /* ignored if discard-secure=0 */
131 blkif_vdev_t _pad1; /* only for read/write requests */
132#ifdef CONFIG_X86_64
133 uint32_t _pad2; /* offsetof(blkif_req..,u.discard.id)==8*/
134#endif
135 uint64_t id; /* private guest value, echoed in resp */
108 blkif_sector_t sector_number; 136 blkif_sector_t sector_number;
109 uint64_t nr_sectors; 137 uint64_t nr_sectors;
110}; 138 uint8_t _pad3;
139} __attribute__((__packed__));
111 140
112struct blkif_request { 141struct blkif_request {
113 uint8_t operation; /* BLKIF_OP_??? */ 142 uint8_t operation; /* BLKIF_OP_??? */
114 uint8_t nr_segments; /* number of segments */
115 blkif_vdev_t handle; /* only for read/write requests */
116 uint64_t id; /* private guest value, echoed in resp */
117 union { 143 union {
118 struct blkif_request_rw rw; 144 struct blkif_request_rw rw;
119 struct blkif_request_discard discard; 145 struct blkif_request_discard discard;
120 } u; 146 } u;
121}; 147} __attribute__((__packed__));
122 148
123struct blkif_response { 149struct blkif_response {
124 uint64_t id; /* copied from request */ 150 uint64_t id; /* copied from request */
diff --git a/include/xen/interface/io/xs_wire.h b/include/xen/interface/io/xs_wire.h
index f6f07aa35af5..7cdfca24eafb 100644
--- a/include/xen/interface/io/xs_wire.h
+++ b/include/xen/interface/io/xs_wire.h
@@ -87,4 +87,7 @@ struct xenstore_domain_interface {
87 XENSTORE_RING_IDX rsp_cons, rsp_prod; 87 XENSTORE_RING_IDX rsp_cons, rsp_prod;
88}; 88};
89 89
90/* Violating this is very bad. See docs/misc/xenstore.txt. */
91#define XENSTORE_PAYLOAD_MAX 4096
92
90#endif /* _XS_WIRE_H */ 93#endif /* _XS_WIRE_H */
diff --git a/include/xen/interface/xen.h b/include/xen/interface/xen.h
index 6a6e91449347..a890804945e3 100644
--- a/include/xen/interface/xen.h
+++ b/include/xen/interface/xen.h
@@ -523,6 +523,8 @@ struct tmem_op {
523 } u; 523 } u;
524}; 524};
525 525
526DEFINE_GUEST_HANDLE(u64);
527
526#else /* __ASSEMBLY__ */ 528#else /* __ASSEMBLY__ */
527 529
528/* In assembly code we cannot use C numeric constant suffixes. */ 530/* In assembly code we cannot use C numeric constant suffixes. */
diff --git a/include/xen/xenbus.h b/include/xen/xenbus.h
index b1b6676c1c43..e8c599b237c2 100644
--- a/include/xen/xenbus.h
+++ b/include/xen/xenbus.h
@@ -85,8 +85,6 @@ struct xenbus_device_id
85 85
86/* A xenbus driver. */ 86/* A xenbus driver. */
87struct xenbus_driver { 87struct xenbus_driver {
88 char *name;
89 struct module *owner;
90 const struct xenbus_device_id *ids; 88 const struct xenbus_device_id *ids;
91 int (*probe)(struct xenbus_device *dev, 89 int (*probe)(struct xenbus_device *dev,
92 const struct xenbus_device_id *id); 90 const struct xenbus_device_id *id);
@@ -101,31 +99,20 @@ struct xenbus_driver {
101 int (*is_ready)(struct xenbus_device *dev); 99 int (*is_ready)(struct xenbus_device *dev);
102}; 100};
103 101
104static inline struct xenbus_driver *to_xenbus_driver(struct device_driver *drv) 102#define DEFINE_XENBUS_DRIVER(var, drvname, methods...) \
105{ 103struct xenbus_driver var ## _driver = { \
106 return container_of(drv, struct xenbus_driver, driver); 104 .driver.name = drvname + 0 ?: var ## _ids->devicetype, \
105 .driver.owner = THIS_MODULE, \
106 .ids = var ## _ids, ## methods \
107} 107}
108 108
109int __must_check __xenbus_register_frontend(struct xenbus_driver *drv, 109static inline struct xenbus_driver *to_xenbus_driver(struct device_driver *drv)
110 struct module *owner,
111 const char *mod_name);
112
113static inline int __must_check
114xenbus_register_frontend(struct xenbus_driver *drv)
115{ 110{
116 WARN_ON(drv->owner != THIS_MODULE); 111 return container_of(drv, struct xenbus_driver, driver);
117 return __xenbus_register_frontend(drv, THIS_MODULE, KBUILD_MODNAME);
118} 112}
119 113
120int __must_check __xenbus_register_backend(struct xenbus_driver *drv, 114int __must_check xenbus_register_frontend(struct xenbus_driver *);
121 struct module *owner, 115int __must_check xenbus_register_backend(struct xenbus_driver *);
122 const char *mod_name);
123static inline int __must_check
124xenbus_register_backend(struct xenbus_driver *drv)
125{
126 WARN_ON(drv->owner != THIS_MODULE);
127 return __xenbus_register_backend(drv, THIS_MODULE, KBUILD_MODNAME);
128}
129 116
130void xenbus_unregister_driver(struct xenbus_driver *drv); 117void xenbus_unregister_driver(struct xenbus_driver *drv);
131 118
diff --git a/include/xen/xenbus_dev.h b/include/xen/xenbus_dev.h
new file mode 100644
index 000000000000..ac5f0fe47ed9
--- /dev/null
+++ b/include/xen/xenbus_dev.h
@@ -0,0 +1,41 @@
1/******************************************************************************
2 * evtchn.h
3 *
4 * Interface to /dev/xen/xenbus_backend.
5 *
6 * Copyright (c) 2011 Bastian Blank <waldi@debian.org>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License version 2
10 * as published by the Free Software Foundation; or, when distributed
11 * separately from the Linux kernel or incorporated into other
12 * software packages, subject to the following license:
13 *
14 * Permission is hereby granted, free of charge, to any person obtaining a copy
15 * of this source file (the "Software"), to deal in the Software without
16 * restriction, including without limitation the rights to use, copy, modify,
17 * merge, publish, distribute, sublicense, and/or sell copies of the Software,
18 * and to permit persons to whom the Software is furnished to do so, subject to
19 * the following conditions:
20 *
21 * The above copyright notice and this permission notice shall be included in
22 * all copies or substantial portions of the Software.
23 *
24 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
30 * IN THE SOFTWARE.
31 */
32
33#ifndef __LINUX_XEN_XENBUS_DEV_H__
34#define __LINUX_XEN_XENBUS_DEV_H__
35
36#include <linux/ioctl.h>
37
38#define IOCTL_XENBUS_BACKEND_EVTCHN \
39 _IOC(_IOC_NONE, 'B', 0, 0)
40
41#endif /* __LINUX_XEN_XENBUS_DEV_H__ */