aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/Kbuild1
-rw-r--r--include/linux/acpi.h3
-rw-r--r--include/linux/adt7461.h42
-rw-r--r--include/linux/aer.h3
-rw-r--r--include/linux/aio.h2
-rw-r--r--include/linux/akm8975.h87
-rw-r--r--include/linux/amba/mmci.h12
-rw-r--r--include/linux/amba/pl08x.h9
-rw-r--r--include/linux/amd-iommu.h171
-rw-r--r--include/linux/android_aid.h28
-rw-r--r--include/linux/android_alarm.h106
-rw-r--r--include/linux/anon_inodes.h2
-rw-r--r--include/linux/arcdevice.h1
-rw-r--r--include/linux/ashmem.h48
-rw-r--r--include/linux/ath9k_platform.h2
-rw-r--r--include/linux/atmdev.h2
-rw-r--r--include/linux/atomic.h54
-rw-r--r--include/linux/audit.h7
-rw-r--r--include/linux/backing-dev.h10
-rw-r--r--include/linux/basic_mmio_gpio.h15
-rw-r--r--include/linux/bcma/bcma.h47
-rw-r--r--include/linux/bcma/bcma_driver_chipcommon.h12
-rw-r--r--include/linux/bcma/bcma_driver_pci.h2
-rw-r--r--include/linux/bcma/bcma_regs.h27
-rw-r--r--include/linux/binfmts.h1
-rw-r--r--include/linux/bit_spinlock.h4
-rw-r--r--include/linux/bitmap.h2
-rw-r--r--include/linux/blk_types.h13
-rw-r--r--include/linux/blkdev.h34
-rw-r--r--include/linux/blktrace_api.h5
-rw-r--r--include/linux/bq27x00.h30
-rw-r--r--include/linux/bsg-lib.h73
-rw-r--r--include/linux/buffer_head.h2
-rw-r--r--include/linux/ceph/libceph.h2
-rw-r--r--include/linux/ceph/messenger.h1
-rw-r--r--include/linux/cgroup.h15
-rw-r--r--include/linux/clocksource.h18
-rw-r--r--include/linux/cm3217.h59
-rw-r--r--include/linux/cn_proc.h13
-rw-r--r--include/linux/compat.h10
-rw-r--r--include/linux/configfs.h2
-rw-r--r--include/linux/connector.h4
-rw-r--r--include/linux/cordic.h48
-rw-r--r--include/linux/cpu.h40
-rw-r--r--include/linux/cpuacct.h43
-rw-r--r--include/linux/cpufreq.h8
-rw-r--r--include/linux/cpuidle.h4
-rw-r--r--include/linux/cpumask.h14
-rw-r--r--include/linux/crc8.h101
-rw-r--r--include/linux/cred.h18
-rw-r--r--include/linux/crypto.h2
-rw-r--r--include/linux/cryptohash.h7
-rw-r--r--include/linux/cs5535.h60
-rw-r--r--include/linux/ctype.h9
-rw-r--r--include/linux/dcache.h43
-rw-r--r--include/linux/dcbnl.h25
-rw-r--r--include/linux/dccp.h1
-rw-r--r--include/linux/debug_locks.h2
-rw-r--r--include/linux/device-mapper.h48
-rw-r--r--include/linux/device.h12
-rw-r--r--include/linux/dio.h2
-rw-r--r--include/linux/dm-ioctl.h4
-rw-r--r--include/linux/dm-kcopyd.h15
-rw-r--r--include/linux/dma-buf.h176
-rw-r--r--include/linux/dma-direction.h13
-rw-r--r--include/linux/dma-mapping.h31
-rw-r--r--include/linux/dma_remapping.h12
-rw-r--r--include/linux/dmaengine.h4
-rw-r--r--include/linux/dmar.h43
-rw-r--r--include/linux/dvb/audio.h2
-rw-r--r--include/linux/dw_apb_timer.h56
-rw-r--r--include/linux/earlysuspend.h56
-rw-r--r--include/linux/ecryptfs.h113
-rw-r--r--include/linux/edac.h2
-rw-r--r--include/linux/eeprom_93xx46.h18
-rw-r--r--include/linux/efi.h40
-rw-r--r--include/linux/elevator.h2
-rw-r--r--include/linux/etherdevice.h2
-rw-r--r--include/linux/ethtool.h35
-rw-r--r--include/linux/export.h89
-rw-r--r--include/linux/ext2_fs.h5
-rw-r--r--include/linux/ext3_fs.h13
-rw-r--r--include/linux/fault-inject.h37
-rw-r--r--include/linux/fb.h21
-rw-r--r--include/linux/fd.h22
-rw-r--r--include/linux/fdtable.h3
-rw-r--r--include/linux/filter.h2
-rw-r--r--include/linux/firewire-cdev.h78
-rw-r--r--include/linux/firewire.h2
-rw-r--r--include/linux/fs.h199
-rw-r--r--include/linux/fsl_devices.h11
-rw-r--r--include/linux/fsl_hypervisor.h241
-rw-r--r--include/linux/fsnotify_backend.h2
-rw-r--r--include/linux/ftrace.h7
-rw-r--r--include/linux/ftrace_event.h5
-rw-r--r--include/linux/fuse.h9
-rw-r--r--include/linux/genalloc.h46
-rw-r--r--include/linux/generic_acl.h1
-rw-r--r--include/linux/genhd.h2
-rw-r--r--include/linux/gfp.h2
-rw-r--r--include/linux/gpio.h6
-rw-r--r--include/linux/gpio_event.h170
-rw-r--r--include/linux/gpio_keys.h4
-rw-r--r--include/linux/gpio_scrollwheel.h46
-rw-r--r--include/linux/gsmmux.h11
-rw-r--r--include/linux/hardirq.h4
-rw-r--r--include/linux/hash.h2
-rw-r--r--include/linux/hid.h7
-rw-r--r--include/linux/hugetlb.h3
-rw-r--r--include/linux/hw_breakpoint.h10
-rw-r--r--include/linux/hw_random.h2
-rw-r--r--include/linux/i2c-omap.h27
-rw-r--r--include/linux/i2c-slave.h259
-rw-r--r--include/linux/i2c-tegra.h29
-rw-r--r--include/linux/i2c.h1
-rw-r--r--include/linux/i2c/atmel_mxt_ts.h16
-rw-r--r--include/linux/i2c/panjit_ts.h30
-rw-r--r--include/linux/i2c/twl.h83
-rw-r--r--include/linux/i2c/twl4030-madc.h4
-rw-r--r--include/linux/i8253.h29
-rw-r--r--include/linux/idr.h4
-rw-r--r--include/linux/ieee80211.h55
-rw-r--r--include/linux/if.h2
-rw-r--r--include/linux/if_ether.h5
-rw-r--r--include/linux/if_packet.h6
-rw-r--r--include/linux/if_pppolac.h33
-rw-r--r--include/linux/if_pppopns.h32
-rw-r--r--include/linux/if_pppox.h27
-rw-r--r--include/linux/if_vlan.h91
-rw-r--r--include/linux/ina219.h34
-rw-r--r--include/linux/inet_lro.h19
-rw-r--r--include/linux/init_task.h1
-rw-r--r--include/linux/input.h11
-rw-r--r--include/linux/input/kxtj9.h70
-rw-r--r--include/linux/intel-iommu.h10
-rw-r--r--include/linux/interrupt.h5
-rw-r--r--include/linux/interrupt_keys.h47
-rw-r--r--include/linux/io-mapping.h4
-rw-r--r--include/linux/iocontext.h14
-rw-r--r--include/linux/iommu.h111
-rw-r--r--include/linux/ion.h347
-rw-r--r--include/linux/ioport.h31
-rw-r--r--include/linux/ipc_namespace.h7
-rw-r--r--include/linux/irq.h22
-rw-r--r--include/linux/irqdesc.h1
-rw-r--r--include/linux/irqdomain.h92
-rw-r--r--include/linux/iscsi_boot_sysfs.h16
-rw-r--r--include/linux/jbd.h1
-rw-r--r--include/linux/jbd2.h6
-rw-r--r--include/linux/jiffies.h2
-rw-r--r--include/linux/journal-head.h2
-rw-r--r--include/linux/jump_label.h2
-rw-r--r--include/linux/kconfig.h32
-rw-r--r--include/linux/kdb.h2
-rw-r--r--include/linux/kernel.h59
-rw-r--r--include/linux/key.h2
-rw-r--r--include/linux/keychord.h52
-rw-r--r--include/linux/keyreset.h28
-rw-r--r--include/linux/kgdb.h2
-rw-r--r--include/linux/kobject.h2
-rw-r--r--include/linux/kvm.h21
-rw-r--r--include/linux/kvm_host.h8
-rw-r--r--include/linux/led-lm3530.h5
-rw-r--r--include/linux/lglock.h36
-rw-r--r--include/linux/lguest.h2
-rw-r--r--include/linux/libata.h68
-rw-r--r--include/linux/lightsensor.h28
-rw-r--r--include/linux/llist.h126
-rw-r--r--include/linux/log2.h1
-rw-r--r--include/linux/loop.h5
-rw-r--r--include/linux/max17048_battery.h35
-rw-r--r--include/linux/memcontrol.h21
-rw-r--r--include/linux/memory_hotplug.h11
-rw-r--r--include/linux/mfd/aat2870.h181
-rw-r--r--include/linux/mfd/ab8500.h8
-rw-r--r--include/linux/mfd/max77663-core.h178
-rw-r--r--include/linux/mfd/max8907c.h259
-rw-r--r--include/linux/mfd/max8997.h7
-rw-r--r--include/linux/mfd/max8998.h12
-rw-r--r--include/linux/mfd/pm8xxx/rtc.h25
-rw-r--r--include/linux/mfd/rc5t583.h295
-rw-r--r--include/linux/mfd/ricoh583.h164
-rw-r--r--include/linux/mfd/stmpe.h3
-rw-r--r--include/linux/mfd/tmio.h8
-rw-r--r--include/linux/mfd/tps65090.h53
-rw-r--r--include/linux/mfd/tps6586x.h54
-rw-r--r--include/linux/mfd/tps65910.h52
-rw-r--r--include/linux/mfd/tps65912.h327
-rw-r--r--include/linux/mfd/tps6591x.h124
-rw-r--r--include/linux/mfd/tps80031.h203
-rw-r--r--include/linux/mfd/twl4030-audio.h (renamed from include/linux/mfd/twl4030-codec.h)16
-rw-r--r--include/linux/mfd/twl6040.h228
-rw-r--r--include/linux/mfd/wm831x/core.h131
-rw-r--r--include/linux/mfd/wm831x/pdata.h6
-rw-r--r--include/linux/mfd/wm8400-private.h7
-rw-r--r--include/linux/mfd/wm8994/core.h9
-rw-r--r--include/linux/mfd/wm8994/pdata.h2
-rw-r--r--include/linux/mii.h2
-rw-r--r--include/linux/miscdevice.h1
-rw-r--r--include/linux/mlx4/cmd.h3
-rw-r--r--include/linux/mlx4/device.h62
-rw-r--r--include/linux/mlx4/qp.h8
-rw-r--r--include/linux/mm.h138
-rw-r--r--include/linux/mm_types.h102
-rw-r--r--include/linux/mman.h2
-rw-r--r--include/linux/mmc/boot.h6
-rw-r--r--include/linux/mmc/card.h20
-rw-r--r--include/linux/mmc/core.h12
-rw-r--r--include/linux/mmc/dw_mmc.h28
-rw-r--r--include/linux/mmc/host.h64
-rw-r--r--include/linux/mmc/ioctl.h2
-rw-r--r--include/linux/mmc/mmc.h25
-rw-r--r--include/linux/mmc/pm.h3
-rw-r--r--include/linux/mmc/sd.h7
-rw-r--r--include/linux/mmc/sdhci-pltfm.h35
-rw-r--r--include/linux/mmc/sdhci-spear.h6
-rw-r--r--include/linux/mmc/sdhci.h79
-rw-r--r--include/linux/mmc/sdio.h40
-rw-r--r--include/linux/mmc/sdio_func.h17
-rw-r--r--include/linux/mmc/sdio_ids.h6
-rw-r--r--include/linux/mmc/sh_mmcif.h6
-rw-r--r--include/linux/mmc/sh_mobile_sdhi.h6
-rw-r--r--include/linux/mmc/tmio.h8
-rw-r--r--include/linux/mmzone.h8
-rw-r--r--include/linux/mnt_namespace.h1
-rw-r--r--include/linux/module.h92
-rw-r--r--include/linux/moduleloader.h7
-rw-r--r--include/linux/mount.h2
-rw-r--r--include/linux/mpu.h367
-rw-r--r--include/linux/mpu3050.h255
-rw-r--r--include/linux/mpu6000.h406
-rw-r--r--include/linux/msdos_fs.h12
-rw-r--r--include/linux/mtd/ubi.h14
-rw-r--r--include/linux/mutex.h4
-rw-r--r--include/linux/namei.h9
-rw-r--r--include/linux/nct1008.h100
-rw-r--r--include/linux/netdevice.h100
-rw-r--r--include/linux/netfilter/ipset/ip_set.h50
-rw-r--r--include/linux/netfilter/ipset/ip_set_ahash.h154
-rw-r--r--include/linux/netfilter/ipset/ip_set_hash.h4
-rw-r--r--include/linux/netfilter/ipset/ip_set_timeout.h5
-rw-r--r--include/linux/netfilter/ipset/pfxlen.h11
-rw-r--r--include/linux/netfilter/nfnetlink.h3
-rw-r--r--include/linux/netfilter/nfnetlink_queue.h1
-rw-r--r--include/linux/netfilter/xt_qtaguid.h13
-rw-r--r--include/linux/netfilter/xt_quota2.h25
-rw-r--r--include/linux/netfilter/xt_set.h15
-rw-r--r--include/linux/netfilter/xt_socket.h6
-rw-r--r--include/linux/netlink.h10
-rw-r--r--include/linux/netpoll.h2
-rw-r--r--include/linux/nfc.h126
-rw-r--r--include/linux/nfc/pn544.h102
-rw-r--r--include/linux/nfs.h2
-rw-r--r--include/linux/nfs4.h4
-rw-r--r--include/linux/nfs_fs.h16
-rw-r--r--include/linux/nfs_fs_sb.h11
-rw-r--r--include/linux/nfs_page.h17
-rw-r--r--include/linux/nfs_xdr.h67
-rw-r--r--include/linux/nfsd/export.h2
-rw-r--r--include/linux/nl80211.h77
-rw-r--r--include/linux/nodemask.h13
-rw-r--r--include/linux/notifier.h82
-rw-r--r--include/linux/nsproxy.h1
-rw-r--r--include/linux/nvhost.h145
-rw-r--r--include/linux/nvhost_ioctl.h213
-rw-r--r--include/linux/of.h39
-rw-r--r--include/linux/of_address.h5
-rw-r--r--include/linux/of_gpio.h51
-rw-r--r--include/linux/of_irq.h4
-rw-r--r--include/linux/of_net.h1
-rw-r--r--include/linux/of_pci.h5
-rw-r--r--include/linux/of_platform.h40
-rw-r--r--include/linux/oom.h4
-rw-r--r--include/linux/opp.h8
-rw-r--r--include/linux/oprofile.h2
-rw-r--r--include/linux/page-flags.h9
-rw-r--r--include/linux/pagemap.h16
-rw-r--r--include/linux/pci.h64
-rw-r--r--include/linux/pci_ids.h24
-rw-r--r--include/linux/pci_regs.h2
-rw-r--r--include/linux/pda_power.h2
-rw-r--r--include/linux/perf_event.h107
-rw-r--r--include/linux/personality.h1
-rw-r--r--include/linux/phy.h8
-rw-r--r--include/linux/platform_data/fsa9480.h27
-rw-r--r--include/linux/platform_data/ina230.h32
-rw-r--r--include/linux/platform_data/ntc_thermistor.h53
-rw-r--r--include/linux/platform_data/pxa_sdhci.h60
-rw-r--r--include/linux/platform_data/ram_console.h22
-rw-r--r--include/linux/platform_data/tegra_bpc_mgmt.h25
-rw-r--r--include/linux/platform_data/tegra_nor.h37
-rw-r--r--include/linux/platform_data/tegra_usb.h17
-rw-r--r--include/linux/platform_device.h1
-rw-r--r--include/linux/plist.h55
-rw-r--r--include/linux/pm.h10
-rw-r--r--include/linux/pm_domain.h112
-rw-r--r--include/linux/pm_qos_params.h23
-rw-r--r--include/linux/pm_runtime.h38
-rw-r--r--include/linux/pnfs_osd_xdr.h31
-rw-r--r--include/linux/pnp.h2
-rw-r--r--include/linux/poison.h6
-rw-r--r--include/linux/posix_acl.h83
-rw-r--r--include/linux/power/bq20z75.h3
-rw-r--r--include/linux/power/max17042_battery.h91
-rw-r--r--include/linux/power/max8907c-charger.h64
-rw-r--r--include/linux/power_supply.h4
-rw-r--r--include/linux/preempt.h26
-rw-r--r--include/linux/proc_fs.h8
-rw-r--r--include/linux/pstore.h9
-rw-r--r--include/linux/pti.h3
-rw-r--r--include/linux/ptp_classify.h13
-rw-r--r--include/linux/ptrace.h104
-rw-r--r--include/linux/pwm_backlight.h1
-rw-r--r--include/linux/quota.h10
-rw-r--r--include/linux/radix-tree.h37
-rw-r--r--include/linux/raid/md_p.h14
-rw-r--r--include/linux/ramoops.h2
-rw-r--r--include/linux/random.h11
-rw-r--r--include/linux/rculist.h2
-rw-r--r--include/linux/rcupdate.h12
-rw-r--r--include/linux/reboot.h5
-rw-r--r--include/linux/regmap.h217
-rw-r--r--include/linux/regulator/consumer.h51
-rw-r--r--include/linux/regulator/driver.h4
-rw-r--r--include/linux/regulator/fan53555-regulator.h63
-rw-r--r--include/linux/regulator/gpio-regulator.h87
-rw-r--r--include/linux/regulator/gpio-switch-regulator.h69
-rw-r--r--include/linux/regulator/max77663-regulator.h131
-rw-r--r--include/linux/regulator/max8907c-regulator.h46
-rw-r--r--include/linux/regulator/ricoh583-regulator.h63
-rw-r--r--include/linux/regulator/tps62360.h57
-rw-r--r--include/linux/regulator/tps6236x-regulator.h54
-rw-r--r--include/linux/regulator/tps65090-regulator.h60
-rw-r--r--include/linux/regulator/tps6591x-regulator.h77
-rw-r--r--include/linux/regulator/tps80031-regulator.h89
-rw-r--r--include/linux/reiserfs_acl.h6
-rw-r--r--include/linux/reiserfs_fs.h2
-rw-r--r--include/linux/reiserfs_xattr.h2
-rw-r--r--include/linux/ring_buffer.h2
-rw-r--r--include/linux/rio_regs.h18
-rw-r--r--include/linux/rmi.h656
-rw-r--r--include/linux/rtc.h3
-rw-r--r--include/linux/rtmutex.h4
-rw-r--r--include/linux/rtnetlink.h5
-rw-r--r--include/linux/rwsem.h12
-rw-r--r--include/linux/sched.h58
-rw-r--r--include/linux/seccomp.h10
-rw-r--r--include/linux/security.h9
-rw-r--r--include/linux/sem.h2
-rw-r--r--include/linux/seq_file.h1
-rw-r--r--include/linux/serial_core.h1
-rw-r--r--include/linux/serial_reg.h10
-rw-r--r--include/linux/serial_sci.h75
-rw-r--r--include/linux/sh_clk.h4
-rw-r--r--include/linux/sh_dma.h8
-rw-r--r--include/linux/shm.h7
-rw-r--r--include/linux/shmem_fs.h17
-rw-r--r--include/linux/shrinker.h43
-rw-r--r--include/linux/sigma.h13
-rw-r--r--include/linux/skbuff.h83
-rw-r--r--include/linux/slab.h20
-rw-r--r--include/linux/slab_def.h52
-rw-r--r--include/linux/slob_def.h10
-rw-r--r--include/linux/slub_def.h26
-rw-r--r--include/linux/smb349-charger.h63
-rw-r--r--include/linux/snmp.h2
-rw-r--r--include/linux/socket.h10
-rw-r--r--include/linux/sockios.h1
-rw-r--r--include/linux/sonet.h2
-rw-r--r--include/linux/spi-tegra.h50
-rw-r--r--include/linux/spi/74x164.h2
-rw-r--r--include/linux/spi/mcp23s08.h9
-rw-r--r--include/linux/spi/rm31080a_ts.h44
-rw-r--r--include/linux/spinlock.h2
-rw-r--r--include/linux/splice.h2
-rw-r--r--include/linux/ssb/ssb.h4
-rw-r--r--include/linux/ssb/ssb_driver_chipcommon.h2
-rw-r--r--include/linux/stacktrace.h4
-rw-r--r--include/linux/stmmac.h25
-rw-r--r--include/linux/stop_machine.h16
-rw-r--r--include/linux/sunrpc/auth.h2
-rw-r--r--include/linux/sunrpc/bc_xprt.h6
-rw-r--r--include/linux/sunrpc/cache.h11
-rw-r--r--include/linux/sunrpc/rpc_pipe_fs.h2
-rw-r--r--include/linux/sunrpc/sched.h4
-rw-r--r--include/linux/sunrpc/svc.h5
-rw-r--r--include/linux/sunrpc/timer.h2
-rw-r--r--include/linux/sunrpc/xdr.h2
-rw-r--r--include/linux/sunrpc/xprt.h34
-rw-r--r--include/linux/suspend.h16
-rw-r--r--include/linux/swap.h17
-rw-r--r--include/linux/swapops.h23
-rw-r--r--include/linux/switch.h53
-rw-r--r--include/linux/synaptics_i2c_rmi.h55
-rw-r--r--include/linux/syscalls.h3
-rw-r--r--include/linux/sysfs.h2
-rw-r--r--include/linux/tc_ematch/tc_em_meta.h2
-rw-r--r--include/linux/tcp.h1
-rw-r--r--include/linux/tegra_audio.h80
-rw-r--r--include/linux/tegra_avp.h44
-rw-r--r--include/linux/tegra_caif.h34
-rw-r--r--include/linux/tegra_ion.h91
-rw-r--r--include/linux/tegra_mediaserver.h112
-rw-r--r--include/linux/tegra_nvavp.h84
-rw-r--r--include/linux/tegra_pwm_bl.h31
-rw-r--r--include/linux/tegra_rpc.h47
-rw-r--r--include/linux/tegra_sema.h34
-rw-r--r--include/linux/tegra_spdif.h56
-rw-r--r--include/linux/tegra_uart.h44
-rw-r--r--include/linux/thermal.h22
-rw-r--r--include/linux/ti_wilink_st.h36
-rw-r--r--include/linux/tps80031-charger.h62
-rw-r--r--include/linux/tracedump.h43
-rw-r--r--include/linux/tracehook.h385
-rw-r--r--include/linux/tracelevel.h42
-rw-r--r--include/linux/tty.h45
-rw-r--r--include/linux/tty_driver.h3
-rw-r--r--include/linux/uid_stat.h29
-rw-r--r--include/linux/usb.h1
-rw-r--r--include/linux/usb/ch9.h20
-rw-r--r--include/linux/usb/composite.h35
-rw-r--r--include/linux/usb/f_accessory.h83
-rw-r--r--include/linux/usb/f_mtp.h75
-rw-r--r--include/linux/usb/gadget.h88
-rw-r--r--include/linux/usb/hcd.h2
-rw-r--r--include/linux/usb/m66592.h2
-rw-r--r--include/linux/usb/otg_id.h58
-rw-r--r--include/linux/usb/r8a66597.h8
-rw-r--r--include/linux/usb/renesas_usbhs.h17
-rw-r--r--include/linux/usb/usbnet.h3
-rw-r--r--include/linux/version.h2
-rw-r--r--include/linux/videodev2.h254
-rw-r--r--include/linux/virtio_net.h1
-rw-r--r--include/linux/vmalloc.h1
-rw-r--r--include/linux/vmstat.h2
-rw-r--r--include/linux/vt.h7
-rw-r--r--include/linux/vt_kern.h2
-rw-r--r--include/linux/wakelock.h91
-rw-r--r--include/linux/watchdog.h78
-rw-r--r--include/linux/wifi_tiwlan.h27
-rw-r--r--include/linux/wl127x-rfkill.h35
-rw-r--r--include/linux/wl12xx.h2
-rw-r--r--include/linux/wlan_plat.h27
-rw-r--r--include/linux/wm97xx.h13
-rw-r--r--include/linux/workqueue.h20
-rw-r--r--include/linux/writeback.h44
-rw-r--r--include/linux/zorro.h2
447 files changed, 14952 insertions, 2404 deletions
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index 01f63627505..619b5657af7 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -135,6 +135,7 @@ header-y += firewire-cdev.h
135header-y += firewire-constants.h 135header-y += firewire-constants.h
136header-y += flat.h 136header-y += flat.h
137header-y += fs.h 137header-y += fs.h
138header-y += fsl_hypervisor.h
138header-y += fuse.h 139header-y += fuse.h
139header-y += futex.h 140header-y += futex.h
140header-y += gameport.h 141header-y += gameport.h
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 1deb2a73c2d..6001b4da39d 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -238,7 +238,6 @@ extern int acpi_paddr_to_node(u64 start_addr, u64 size);
238extern int pnpacpi_disabled; 238extern int pnpacpi_disabled;
239 239
240#define PXM_INVAL (-1) 240#define PXM_INVAL (-1)
241#define NID_INVAL (-1)
242 241
243int acpi_check_resource_conflict(const struct resource *res); 242int acpi_check_resource_conflict(const struct resource *res);
244 243
@@ -280,6 +279,8 @@ acpi_status acpi_run_osc(acpi_handle handle, struct acpi_osc_context *context);
280#define OSC_SB_CPUHP_OST_SUPPORT 8 279#define OSC_SB_CPUHP_OST_SUPPORT 8
281#define OSC_SB_APEI_SUPPORT 16 280#define OSC_SB_APEI_SUPPORT 16
282 281
282extern bool osc_sb_apei_support_acked;
283
283/* PCI defined _OSC bits */ 284/* PCI defined _OSC bits */
284/* _OSC DW1 Definition (OS Support Fields) */ 285/* _OSC DW1 Definition (OS Support Fields) */
285#define OSC_EXT_PCI_CONFIG_SUPPORT 1 286#define OSC_EXT_PCI_CONFIG_SUPPORT 1
diff --git a/include/linux/adt7461.h b/include/linux/adt7461.h
new file mode 100644
index 00000000000..36f637ad287
--- /dev/null
+++ b/include/linux/adt7461.h
@@ -0,0 +1,42 @@
1/*
2 * include/linux/adt8461.h
3 *
4 * ADT7461, temperature monitoring device from ON Semiconductors
5 *
6 * Copyright (c) 2011, NVIDIA Corporation.
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, but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 * 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 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 */
22
23#ifndef _LINUX_ADT7461_H
24#define _LINUX_ADT7461_H
25
26#include <linux/types.h>
27
28struct adt7461_platform_data {
29 bool supported_hwrev;
30 bool ext_range;
31 bool therm2;
32 u8 conv_rate;
33 u8 offset;
34 u8 hysteresis;
35 u8 shutdown_ext_limit;
36 u8 shutdown_local_limit;
37 u8 throttling_ext_limit;
38 void (*alarm_fn)(bool raised);
39 int irq_gpio;
40};
41
42#endif /* _LINUX_ADT7461_H */
diff --git a/include/linux/aer.h b/include/linux/aer.h
index 8414de22a77..544abdb2238 100644
--- a/include/linux/aer.h
+++ b/include/linux/aer.h
@@ -51,5 +51,8 @@ static inline int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev)
51 51
52extern void cper_print_aer(const char *prefix, int cper_severity, 52extern void cper_print_aer(const char *prefix, int cper_severity,
53 struct aer_capability_regs *aer); 53 struct aer_capability_regs *aer);
54extern int cper_severity_to_aer(int cper_severity);
55extern void aer_recover_queue(int domain, unsigned int bus, unsigned int devfn,
56 int severity);
54#endif //_AER_H_ 57#endif //_AER_H_
55 58
diff --git a/include/linux/aio.h b/include/linux/aio.h
index 7a8db415528..2dcb72bff4b 100644
--- a/include/linux/aio.h
+++ b/include/linux/aio.h
@@ -7,7 +7,7 @@
7#include <linux/uio.h> 7#include <linux/uio.h>
8#include <linux/rcupdate.h> 8#include <linux/rcupdate.h>
9 9
10#include <asm/atomic.h> 10#include <linux/atomic.h>
11 11
12#define AIO_MAXSEGS 4 12#define AIO_MAXSEGS 4
13#define AIO_KIOGRP_NR_ATOMIC 8 13#define AIO_KIOGRP_NR_ATOMIC 8
diff --git a/include/linux/akm8975.h b/include/linux/akm8975.h
new file mode 100644
index 00000000000..6a7c4326001
--- /dev/null
+++ b/include/linux/akm8975.h
@@ -0,0 +1,87 @@
1/*
2 * Definitions for akm8975 compass chip.
3 */
4#ifndef AKM8975_H
5#define AKM8975_H
6
7#include <linux/ioctl.h>
8
9/*! \name AK8975 operation mode
10 \anchor AK8975_Mode
11 Defines an operation mode of the AK8975.*/
12/*! @{*/
13#define AK8975_MODE_SNG_MEASURE 0x01
14#define AK8975_MODE_SELF_TEST 0x08
15#define AK8975_MODE_FUSE_ACCESS 0x0F
16#define AK8975_MODE_POWER_DOWN 0x00
17/*! @}*/
18
19#define RBUFF_SIZE 8 /* Rx buffer size */
20
21/*! \name AK8975 register address
22\anchor AK8975_REG
23Defines a register address of the AK8975.*/
24/*! @{*/
25#define AK8975_REG_WIA 0x00
26#define AK8975_REG_INFO 0x01
27#define AK8975_REG_ST1 0x02
28#define AK8975_REG_HXL 0x03
29#define AK8975_REG_HXH 0x04
30#define AK8975_REG_HYL 0x05
31#define AK8975_REG_HYH 0x06
32#define AK8975_REG_HZL 0x07
33#define AK8975_REG_HZH 0x08
34#define AK8975_REG_ST2 0x09
35#define AK8975_REG_CNTL 0x0A
36#define AK8975_REG_RSV 0x0B
37#define AK8975_REG_ASTC 0x0C
38#define AK8975_REG_TS1 0x0D
39#define AK8975_REG_TS2 0x0E
40#define AK8975_REG_I2CDIS 0x0F
41/*! @}*/
42
43/*! \name AK8975 fuse-rom address
44\anchor AK8975_FUSE
45Defines a read-only address of the fuse ROM of the AK8975.*/
46/*! @{*/
47#define AK8975_FUSE_ASAX 0x10
48#define AK8975_FUSE_ASAY 0x11
49#define AK8975_FUSE_ASAZ 0x12
50/*! @}*/
51
52#define AKMIO 0xA1
53
54/* IOCTLs for AKM library */
55#define ECS_IOCTL_WRITE _IOW(AKMIO, 0x02, char[5])
56#define ECS_IOCTL_READ _IOWR(AKMIO, 0x03, char[5])
57#define ECS_IOCTL_GETDATA _IOR(AKMIO, 0x08, char[RBUFF_SIZE])
58#define ECS_IOCTL_SET_YPR _IOW(AKMIO, 0x0C, short[12])
59#define ECS_IOCTL_GET_OPEN_STATUS _IOR(AKMIO, 0x0D, int)
60#define ECS_IOCTL_GET_CLOSE_STATUS _IOR(AKMIO, 0x0E, int)
61#define ECS_IOCTL_GET_DELAY _IOR(AKMIO, 0x30, short)
62
63/* IOCTLs for APPs */
64#define ECS_IOCTL_APP_SET_MFLAG _IOW(AKMIO, 0x11, short)
65#define ECS_IOCTL_APP_GET_MFLAG _IOW(AKMIO, 0x12, short)
66#define ECS_IOCTL_APP_SET_AFLAG _IOW(AKMIO, 0x13, short)
67#define ECS_IOCTL_APP_GET_AFLAG _IOR(AKMIO, 0x14, short)
68#define ECS_IOCTL_APP_SET_DELAY _IOW(AKMIO, 0x18, short)
69#define ECS_IOCTL_APP_GET_DELAY ECS_IOCTL_GET_DELAY
70/* Set raw magnetic vector flag */
71#define ECS_IOCTL_APP_SET_MVFLAG _IOW(AKMIO, 0x19, short)
72/* Get raw magnetic vector flag */
73#define ECS_IOCTL_APP_GET_MVFLAG _IOR(AKMIO, 0x1A, short)
74#define ECS_IOCTL_APP_SET_TFLAG _IOR(AKMIO, 0x15, short)
75
76
77struct akm8975_platform_data {
78 int intr;
79
80 int (*init)(void);
81 void (*exit)(void);
82 int (*power_on)(void);
83 int (*power_off)(void);
84};
85
86#endif
87
diff --git a/include/linux/amba/mmci.h b/include/linux/amba/mmci.h
index 21114810c7c..60c737f7bda 100644
--- a/include/linux/amba/mmci.h
+++ b/include/linux/amba/mmci.h
@@ -5,6 +5,15 @@
5#define AMBA_MMCI_H 5#define AMBA_MMCI_H
6 6
7#include <linux/mmc/host.h> 7#include <linux/mmc/host.h>
8#include <linux/mmc/card.h>
9#include <linux/mmc/sdio_func.h>
10
11struct embedded_sdio_data {
12 struct sdio_cis cis;
13 struct sdio_cccr cccr;
14 struct sdio_embedded_func *funcs;
15 int num_funcs;
16};
8 17
9/* Just some dummy forwarding */ 18/* Just some dummy forwarding */
10struct dma_chan; 19struct dma_chan;
@@ -55,6 +64,9 @@ struct mmci_platform_data {
55 bool (*dma_filter)(struct dma_chan *chan, void *filter_param); 64 bool (*dma_filter)(struct dma_chan *chan, void *filter_param);
56 void *dma_rx_param; 65 void *dma_rx_param;
57 void *dma_tx_param; 66 void *dma_tx_param;
67 unsigned int status_irq;
68 struct embedded_sdio_data *embedded_sdio;
69 int (*register_status_notify)(void (*callback)(int card_present, void *dev_id), void *dev_id);
58}; 70};
59 71
60#endif 72#endif
diff --git a/include/linux/amba/pl08x.h b/include/linux/amba/pl08x.h
index 3111385b8ca..e6e28f37d8e 100644
--- a/include/linux/amba/pl08x.h
+++ b/include/linux/amba/pl08x.h
@@ -172,8 +172,11 @@ struct pl08x_dma_chan {
172 int phychan_hold; 172 int phychan_hold;
173 struct tasklet_struct tasklet; 173 struct tasklet_struct tasklet;
174 char *name; 174 char *name;
175 struct pl08x_channel_data *cd; 175 const struct pl08x_channel_data *cd;
176 dma_addr_t runtime_addr; 176 dma_addr_t src_addr;
177 dma_addr_t dst_addr;
178 u32 src_cctl;
179 u32 dst_cctl;
177 enum dma_data_direction runtime_direction; 180 enum dma_data_direction runtime_direction;
178 dma_cookie_t lc; 181 dma_cookie_t lc;
179 struct list_head pend_list; 182 struct list_head pend_list;
@@ -202,7 +205,7 @@ struct pl08x_dma_chan {
202 * @mem_buses: buses which memory can be accessed from: PL08X_AHB1 | PL08X_AHB2 205 * @mem_buses: buses which memory can be accessed from: PL08X_AHB1 | PL08X_AHB2
203 */ 206 */
204struct pl08x_platform_data { 207struct pl08x_platform_data {
205 struct pl08x_channel_data *slave_channels; 208 const struct pl08x_channel_data *slave_channels;
206 unsigned int num_slave_channels; 209 unsigned int num_slave_channels;
207 struct pl08x_channel_data memcpy_channel; 210 struct pl08x_channel_data memcpy_channel;
208 int (*get_signal)(struct pl08x_dma_chan *); 211 int (*get_signal)(struct pl08x_dma_chan *);
diff --git a/include/linux/amd-iommu.h b/include/linux/amd-iommu.h
new file mode 100644
index 00000000000..ef00610837d
--- /dev/null
+++ b/include/linux/amd-iommu.h
@@ -0,0 +1,171 @@
1/*
2 * Copyright (C) 2007-2010 Advanced Micro Devices, Inc.
3 * Author: Joerg Roedel <joerg.roedel@amd.com>
4 * Leo Duran <leo.duran@amd.com>
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published
8 * by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20#ifndef _ASM_X86_AMD_IOMMU_H
21#define _ASM_X86_AMD_IOMMU_H
22
23#include <linux/types.h>
24
25#ifdef CONFIG_AMD_IOMMU
26
27struct task_struct;
28struct pci_dev;
29
30extern int amd_iommu_detect(void);
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
165#else
166
167static inline int amd_iommu_detect(void) { return -ENODEV; }
168
169#endif
170
171#endif /* _ASM_X86_AMD_IOMMU_H */
diff --git a/include/linux/android_aid.h b/include/linux/android_aid.h
new file mode 100644
index 00000000000..0f904b3ba7f
--- /dev/null
+++ b/include/linux/android_aid.h
@@ -0,0 +1,28 @@
1/* include/linux/android_aid.h
2 *
3 * Copyright (C) 2008 Google, Inc.
4 *
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
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 */
15
16#ifndef _LINUX_ANDROID_AID_H
17#define _LINUX_ANDROID_AID_H
18
19/* AIDs that the kernel treats differently */
20#define AID_NET_BT_ADMIN 3001
21#define AID_NET_BT 3002
22#define AID_INET 3003
23#define AID_NET_RAW 3004
24#define AID_NET_ADMIN 3005
25#define AID_NET_BW_STATS 3006 /* read bandwidth statistics */
26#define AID_NET_BW_ACCT 3007 /* change bandwidth statistics accounting */
27
28#endif
diff --git a/include/linux/android_alarm.h b/include/linux/android_alarm.h
new file mode 100644
index 00000000000..f8f14e793db
--- /dev/null
+++ b/include/linux/android_alarm.h
@@ -0,0 +1,106 @@
1/* include/linux/android_alarm.h
2 *
3 * Copyright (C) 2006-2007 Google, Inc.
4 *
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
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 */
15
16#ifndef _LINUX_ANDROID_ALARM_H
17#define _LINUX_ANDROID_ALARM_H
18
19#include <linux/ioctl.h>
20#include <linux/time.h>
21
22enum android_alarm_type {
23 /* return code bit numbers or set alarm arg */
24 ANDROID_ALARM_RTC_WAKEUP,
25 ANDROID_ALARM_RTC,
26 ANDROID_ALARM_ELAPSED_REALTIME_WAKEUP,
27 ANDROID_ALARM_ELAPSED_REALTIME,
28 ANDROID_ALARM_SYSTEMTIME,
29
30 ANDROID_ALARM_TYPE_COUNT,
31
32 /* return code bit numbers */
33 /* ANDROID_ALARM_TIME_CHANGE = 16 */
34};
35
36#ifdef __KERNEL__
37
38#include <linux/ktime.h>
39#include <linux/rbtree.h>
40
41/*
42 * The alarm interface is similar to the hrtimer interface but adds support
43 * for wakeup from suspend. It also adds an elapsed realtime clock that can
44 * be used for periodic timers that need to keep runing while the system is
45 * suspended and not be disrupted when the wall time is set.
46 */
47
48/**
49 * struct alarm - the basic alarm structure
50 * @node: red black tree node for time ordered insertion
51 * @type: alarm type. rtc/elapsed-realtime/systemtime, wakeup/non-wakeup.
52 * @softexpires: the absolute earliest expiry time of the alarm.
53 * @expires: the absolute expiry time.
54 * @function: alarm expiry callback function
55 *
56 * The alarm structure must be initialized by alarm_init()
57 *
58 */
59
60struct alarm {
61 struct rb_node node;
62 enum android_alarm_type type;
63 ktime_t softexpires;
64 ktime_t expires;
65 void (*function)(struct alarm *);
66};
67
68void alarm_init(struct alarm *alarm,
69 enum android_alarm_type type, void (*function)(struct alarm *));
70void alarm_start_range(struct alarm *alarm, ktime_t start, ktime_t end);
71int alarm_try_to_cancel(struct alarm *alarm);
72int alarm_cancel(struct alarm *alarm);
73ktime_t alarm_get_elapsed_realtime(void);
74
75/* set rtc while preserving elapsed realtime */
76int alarm_set_rtc(const struct timespec ts);
77
78#endif
79
80enum android_alarm_return_flags {
81 ANDROID_ALARM_RTC_WAKEUP_MASK = 1U << ANDROID_ALARM_RTC_WAKEUP,
82 ANDROID_ALARM_RTC_MASK = 1U << ANDROID_ALARM_RTC,
83 ANDROID_ALARM_ELAPSED_REALTIME_WAKEUP_MASK =
84 1U << ANDROID_ALARM_ELAPSED_REALTIME_WAKEUP,
85 ANDROID_ALARM_ELAPSED_REALTIME_MASK =
86 1U << ANDROID_ALARM_ELAPSED_REALTIME,
87 ANDROID_ALARM_SYSTEMTIME_MASK = 1U << ANDROID_ALARM_SYSTEMTIME,
88 ANDROID_ALARM_TIME_CHANGE_MASK = 1U << 16
89};
90
91/* Disable alarm */
92#define ANDROID_ALARM_CLEAR(type) _IO('a', 0 | ((type) << 4))
93
94/* Ack last alarm and wait for next */
95#define ANDROID_ALARM_WAIT _IO('a', 1)
96
97#define ALARM_IOW(c, type, size) _IOW('a', (c) | ((type) << 4), size)
98/* Set alarm */
99#define ANDROID_ALARM_SET(type) ALARM_IOW(2, type, struct timespec)
100#define ANDROID_ALARM_SET_AND_WAIT(type) ALARM_IOW(3, type, struct timespec)
101#define ANDROID_ALARM_GET_TIME(type) ALARM_IOW(4, type, struct timespec)
102#define ANDROID_ALARM_SET_RTC _IOW('a', 5, struct timespec)
103#define ANDROID_ALARM_BASE_CMD(cmd) (cmd & ~(_IOC(0, 0, 0xf0, 0)))
104#define ANDROID_ALARM_IOCTL_TO_TYPE(cmd) (_IOC_NR(cmd) >> 4)
105
106#endif
diff --git a/include/linux/anon_inodes.h b/include/linux/anon_inodes.h
index 69a21e0ebd3..8013a45242f 100644
--- a/include/linux/anon_inodes.h
+++ b/include/linux/anon_inodes.h
@@ -8,6 +8,8 @@
8#ifndef _LINUX_ANON_INODES_H 8#ifndef _LINUX_ANON_INODES_H
9#define _LINUX_ANON_INODES_H 9#define _LINUX_ANON_INODES_H
10 10
11struct file_operations;
12
11struct file *anon_inode_getfile(const char *name, 13struct file *anon_inode_getfile(const char *name,
12 const struct file_operations *fops, 14 const struct file_operations *fops,
13 void *priv, int flags); 15 void *priv, int flags);
diff --git a/include/linux/arcdevice.h b/include/linux/arcdevice.h
index 7d650a0e3d8..7216b0daf54 100644
--- a/include/linux/arcdevice.h
+++ b/include/linux/arcdevice.h
@@ -20,6 +20,7 @@
20#include <linux/if_arcnet.h> 20#include <linux/if_arcnet.h>
21 21
22#ifdef __KERNEL__ 22#ifdef __KERNEL__
23#include <linux/irqreturn.h>
23 24
24#ifndef bool 25#ifndef bool
25#define bool int 26#define bool int
diff --git a/include/linux/ashmem.h b/include/linux/ashmem.h
new file mode 100644
index 00000000000..1976b10ef93
--- /dev/null
+++ b/include/linux/ashmem.h
@@ -0,0 +1,48 @@
1/*
2 * include/linux/ashmem.h
3 *
4 * Copyright 2008 Google Inc.
5 * Author: Robert Love
6 *
7 * This file is dual licensed. It may be redistributed and/or modified
8 * under the terms of the Apache 2.0 License OR version 2 of the GNU
9 * General Public License.
10 */
11
12#ifndef _LINUX_ASHMEM_H
13#define _LINUX_ASHMEM_H
14
15#include <linux/limits.h>
16#include <linux/ioctl.h>
17
18#define ASHMEM_NAME_LEN 256
19
20#define ASHMEM_NAME_DEF "dev/ashmem"
21
22/* Return values from ASHMEM_PIN: Was the mapping purged while unpinned? */
23#define ASHMEM_NOT_PURGED 0
24#define ASHMEM_WAS_PURGED 1
25
26/* Return values from ASHMEM_GET_PIN_STATUS: Is the mapping pinned? */
27#define ASHMEM_IS_UNPINNED 0
28#define ASHMEM_IS_PINNED 1
29
30struct ashmem_pin {
31 __u32 offset; /* offset into region, in bytes, page-aligned */
32 __u32 len; /* length forward from offset, in bytes, page-aligned */
33};
34
35#define __ASHMEMIOC 0x77
36
37#define ASHMEM_SET_NAME _IOW(__ASHMEMIOC, 1, char[ASHMEM_NAME_LEN])
38#define ASHMEM_GET_NAME _IOR(__ASHMEMIOC, 2, char[ASHMEM_NAME_LEN])
39#define ASHMEM_SET_SIZE _IOW(__ASHMEMIOC, 3, size_t)
40#define ASHMEM_GET_SIZE _IO(__ASHMEMIOC, 4)
41#define ASHMEM_SET_PROT_MASK _IOW(__ASHMEMIOC, 5, unsigned long)
42#define ASHMEM_GET_PROT_MASK _IO(__ASHMEMIOC, 6)
43#define ASHMEM_PIN _IOW(__ASHMEMIOC, 7, struct ashmem_pin)
44#define ASHMEM_UNPIN _IOW(__ASHMEMIOC, 8, struct ashmem_pin)
45#define ASHMEM_GET_PIN_STATUS _IO(__ASHMEMIOC, 9)
46#define ASHMEM_PURGE_ALL_CACHES _IO(__ASHMEMIOC, 10)
47
48#endif /* _LINUX_ASHMEM_H */
diff --git a/include/linux/ath9k_platform.h b/include/linux/ath9k_platform.h
index 60a7c49dcb4..6e3f54f3784 100644
--- a/include/linux/ath9k_platform.h
+++ b/include/linux/ath9k_platform.h
@@ -30,6 +30,8 @@ struct ath9k_platform_data {
30 u32 gpio_val; 30 u32 gpio_val;
31 31
32 bool is_clk_25mhz; 32 bool is_clk_25mhz;
33 int (*get_mac_revision)(void);
34 int (*external_reset)(void);
33}; 35};
34 36
35#endif /* _LINUX_ATH9K_PLATFORM_H */ 37#endif /* _LINUX_ATH9K_PLATFORM_H */
diff --git a/include/linux/atmdev.h b/include/linux/atmdev.h
index 381f4cec826..49a83ca900b 100644
--- a/include/linux/atmdev.h
+++ b/include/linux/atmdev.h
@@ -220,7 +220,7 @@ struct atm_cirange {
220#include <linux/skbuff.h> /* struct sk_buff */ 220#include <linux/skbuff.h> /* struct sk_buff */
221#include <linux/uio.h> 221#include <linux/uio.h>
222#include <net/sock.h> 222#include <net/sock.h>
223#include <asm/atomic.h> 223#include <linux/atomic.h>
224 224
225#ifdef CONFIG_PROC_FS 225#ifdef CONFIG_PROC_FS
226#include <linux/proc_fs.h> 226#include <linux/proc_fs.h>
diff --git a/include/linux/atomic.h b/include/linux/atomic.h
index ee456c79b0e..42b77b5446d 100644
--- a/include/linux/atomic.h
+++ b/include/linux/atomic.h
@@ -1,8 +1,32 @@
1/* Atomic operations usable in machine independent code */
1#ifndef _LINUX_ATOMIC_H 2#ifndef _LINUX_ATOMIC_H
2#define _LINUX_ATOMIC_H 3#define _LINUX_ATOMIC_H
3#include <asm/atomic.h> 4#include <asm/atomic.h>
4 5
5/** 6/**
7 * atomic_add_unless - add unless the number is already a given value
8 * @v: pointer of type atomic_t
9 * @a: the amount to add to v...
10 * @u: ...unless v is equal to u.
11 *
12 * Atomically adds @a to @v, so long as @v was not already @u.
13 * Returns non-zero if @v was not @u, and zero otherwise.
14 */
15static inline int atomic_add_unless(atomic_t *v, int a, int u)
16{
17 return __atomic_add_unless(v, a, u) != u;
18}
19
20/**
21 * atomic_inc_not_zero - increment unless the number is zero
22 * @v: pointer of type atomic_t
23 *
24 * Atomically increments @v by 1, so long as @v is non-zero.
25 * Returns non-zero if @v was non-zero, and zero otherwise.
26 */
27#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
28
29/**
6 * atomic_inc_not_zero_hint - increment if not null 30 * atomic_inc_not_zero_hint - increment if not null
7 * @v: pointer of type atomic_t 31 * @v: pointer of type atomic_t
8 * @hint: probable value of the atomic before the increment 32 * @hint: probable value of the atomic before the increment
@@ -34,6 +58,32 @@ static inline int atomic_inc_not_zero_hint(atomic_t *v, int hint)
34} 58}
35#endif 59#endif
36 60
61#ifndef atomic_inc_unless_negative
62static inline int atomic_inc_unless_negative(atomic_t *p)
63{
64 int v, v1;
65 for (v = 0; v >= 0; v = v1) {
66 v1 = atomic_cmpxchg(p, v, v + 1);
67 if (likely(v1 == v))
68 return 1;
69 }
70 return 0;
71}
72#endif
73
74#ifndef atomic_dec_unless_positive
75static inline int atomic_dec_unless_positive(atomic_t *p)
76{
77 int v, v1;
78 for (v = 0; v <= 0; v = v1) {
79 v1 = atomic_cmpxchg(p, v, v - 1);
80 if (likely(v1 == v))
81 return 1;
82 }
83 return 0;
84}
85#endif
86
37#ifndef CONFIG_ARCH_HAS_ATOMIC_OR 87#ifndef CONFIG_ARCH_HAS_ATOMIC_OR
38static inline void atomic_or(int i, atomic_t *v) 88static inline void atomic_or(int i, atomic_t *v)
39{ 89{
@@ -47,4 +97,8 @@ static inline void atomic_or(int i, atomic_t *v)
47} 97}
48#endif /* #ifndef CONFIG_ARCH_HAS_ATOMIC_OR */ 98#endif /* #ifndef CONFIG_ARCH_HAS_ATOMIC_OR */
49 99
100#include <asm-generic/atomic-long.h>
101#ifdef CONFIG_GENERIC_ATOMIC64
102#include <asm-generic/atomic64.h>
103#endif
50#endif /* _LINUX_ATOMIC_H */ 104#endif /* _LINUX_ATOMIC_H */
diff --git a/include/linux/audit.h b/include/linux/audit.h
index 9d339eb2788..0c8006129fb 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -613,6 +613,12 @@ extern void audit_log_d_path(struct audit_buffer *ab,
613extern void audit_log_key(struct audit_buffer *ab, 613extern void audit_log_key(struct audit_buffer *ab,
614 char *key); 614 char *key);
615extern void audit_log_lost(const char *message); 615extern void audit_log_lost(const char *message);
616#ifdef CONFIG_SECURITY
617extern void audit_log_secctx(struct audit_buffer *ab, u32 secid);
618#else
619#define audit_log_secctx(b,s) do { ; } while (0)
620#endif
621
616extern int audit_update_lsm_rules(void); 622extern int audit_update_lsm_rules(void);
617 623
618 /* Private API (for audit.c only) */ 624 /* Private API (for audit.c only) */
@@ -635,6 +641,7 @@ extern int audit_enabled;
635#define audit_log_untrustedstring(a,s) do { ; } while (0) 641#define audit_log_untrustedstring(a,s) do { ; } while (0)
636#define audit_log_d_path(b, p, d) do { ; } while (0) 642#define audit_log_d_path(b, p, d) do { ; } while (0)
637#define audit_log_key(b, k) do { ; } while (0) 643#define audit_log_key(b, k) do { ; } while (0)
644#define audit_log_secctx(b,s) do { ; } while (0)
638#define audit_enabled 0 645#define audit_enabled 0
639#endif 646#endif
640#endif 647#endif
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h
index 96f4094b706..3b2f9cb8298 100644
--- a/include/linux/backing-dev.h
+++ b/include/linux/backing-dev.h
@@ -16,7 +16,7 @@
16#include <linux/sched.h> 16#include <linux/sched.h>
17#include <linux/timer.h> 17#include <linux/timer.h>
18#include <linux/writeback.h> 18#include <linux/writeback.h>
19#include <asm/atomic.h> 19#include <linux/atomic.h>
20 20
21struct page; 21struct page;
22struct device; 22struct device;
@@ -40,6 +40,7 @@ typedef int (congested_fn)(void *, int);
40enum bdi_stat_item { 40enum bdi_stat_item {
41 BDI_RECLAIMABLE, 41 BDI_RECLAIMABLE,
42 BDI_WRITEBACK, 42 BDI_WRITEBACK,
43 BDI_WRITTEN,
43 NR_BDI_STAT_ITEMS 44 NR_BDI_STAT_ITEMS
44}; 45};
45 46
@@ -57,6 +58,7 @@ struct bdi_writeback {
57 struct list_head b_dirty; /* dirty inodes */ 58 struct list_head b_dirty; /* dirty inodes */
58 struct list_head b_io; /* parked for writeback */ 59 struct list_head b_io; /* parked for writeback */
59 struct list_head b_more_io; /* parked for more writeback */ 60 struct list_head b_more_io; /* parked for more writeback */
61 spinlock_t list_lock; /* protects the b_* lists */
60}; 62};
61 63
62struct backing_dev_info { 64struct backing_dev_info {
@@ -71,6 +73,11 @@ struct backing_dev_info {
71 73
72 struct percpu_counter bdi_stat[NR_BDI_STAT_ITEMS]; 74 struct percpu_counter bdi_stat[NR_BDI_STAT_ITEMS];
73 75
76 unsigned long bw_time_stamp; /* last time write bw is updated */
77 unsigned long written_stamp; /* pages written at bw_time_stamp */
78 unsigned long write_bandwidth; /* the estimated write bandwidth */
79 unsigned long avg_write_bandwidth; /* further smoothed write bw */
80
74 struct prop_local_percpu completions; 81 struct prop_local_percpu completions;
75 int dirty_exceeded; 82 int dirty_exceeded;
76 83
@@ -106,6 +113,7 @@ int bdi_writeback_thread(void *data);
106int bdi_has_dirty_io(struct backing_dev_info *bdi); 113int bdi_has_dirty_io(struct backing_dev_info *bdi);
107void bdi_arm_supers_timer(void); 114void bdi_arm_supers_timer(void);
108void bdi_wakeup_thread_delayed(struct backing_dev_info *bdi); 115void bdi_wakeup_thread_delayed(struct backing_dev_info *bdi);
116void bdi_lock_two(struct bdi_writeback *wb1, struct bdi_writeback *wb2);
109 117
110extern spinlock_t bdi_lock; 118extern spinlock_t bdi_lock;
111extern struct list_head bdi_list; 119extern struct list_head bdi_list;
diff --git a/include/linux/basic_mmio_gpio.h b/include/linux/basic_mmio_gpio.h
index 98999cf107c..feb91219674 100644
--- a/include/linux/basic_mmio_gpio.h
+++ b/include/linux/basic_mmio_gpio.h
@@ -63,15 +63,10 @@ static inline struct bgpio_chip *to_bgpio_chip(struct gpio_chip *gc)
63 return container_of(gc, struct bgpio_chip, gc); 63 return container_of(gc, struct bgpio_chip, gc);
64} 64}
65 65
66int __devexit bgpio_remove(struct bgpio_chip *bgc); 66int bgpio_remove(struct bgpio_chip *bgc);
67int __devinit bgpio_init(struct bgpio_chip *bgc, 67int bgpio_init(struct bgpio_chip *bgc, struct device *dev,
68 struct device *dev, 68 unsigned long sz, void __iomem *dat, void __iomem *set,
69 unsigned long sz, 69 void __iomem *clr, void __iomem *dirout, void __iomem *dirin,
70 void __iomem *dat, 70 bool big_endian);
71 void __iomem *set,
72 void __iomem *clr,
73 void __iomem *dirout,
74 void __iomem *dirin,
75 bool big_endian);
76 71
77#endif /* __BASIC_MMIO_GPIO_H */ 72#endif /* __BASIC_MMIO_GPIO_H */
diff --git a/include/linux/bcma/bcma.h b/include/linux/bcma/bcma.h
index 08763e4e848..8c96654bef1 100644
--- a/include/linux/bcma/bcma.h
+++ b/include/linux/bcma/bcma.h
@@ -6,6 +6,7 @@
6 6
7#include <linux/bcma/bcma_driver_chipcommon.h> 7#include <linux/bcma/bcma_driver_chipcommon.h>
8#include <linux/bcma/bcma_driver_pci.h> 8#include <linux/bcma/bcma_driver_pci.h>
9#include <linux/ssb/ssb.h> /* SPROM sharing */
9 10
10#include "bcma_regs.h" 11#include "bcma_regs.h"
11 12
@@ -24,6 +25,11 @@ struct bcma_chipinfo {
24 u8 pkg; 25 u8 pkg;
25}; 26};
26 27
28enum bcma_clkmode {
29 BCMA_CLKMODE_FAST,
30 BCMA_CLKMODE_DYNAMIC,
31};
32
27struct bcma_host_ops { 33struct bcma_host_ops {
28 u8 (*read8)(struct bcma_device *core, u16 offset); 34 u8 (*read8)(struct bcma_device *core, u16 offset);
29 u16 (*read16)(struct bcma_device *core, u16 offset); 35 u16 (*read16)(struct bcma_device *core, u16 offset);
@@ -31,6 +37,12 @@ struct bcma_host_ops {
31 void (*write8)(struct bcma_device *core, u16 offset, u8 value); 37 void (*write8)(struct bcma_device *core, u16 offset, u8 value);
32 void (*write16)(struct bcma_device *core, u16 offset, u16 value); 38 void (*write16)(struct bcma_device *core, u16 offset, u16 value);
33 void (*write32)(struct bcma_device *core, u16 offset, u32 value); 39 void (*write32)(struct bcma_device *core, u16 offset, u32 value);
40#ifdef CONFIG_BCMA_BLOCKIO
41 void (*block_read)(struct bcma_device *core, void *buffer,
42 size_t count, u16 offset, u8 reg_width);
43 void (*block_write)(struct bcma_device *core, const void *buffer,
44 size_t count, u16 offset, u8 reg_width);
45#endif
34 /* Agent ops */ 46 /* Agent ops */
35 u32 (*aread32)(struct bcma_device *core, u16 offset); 47 u32 (*aread32)(struct bcma_device *core, u16 offset);
36 void (*awrite32)(struct bcma_device *core, u16 offset, u32 value); 48 void (*awrite32)(struct bcma_device *core, u16 offset, u32 value);
@@ -117,6 +129,8 @@ struct bcma_device {
117 struct bcma_device_id id; 129 struct bcma_device_id id;
118 130
119 struct device dev; 131 struct device dev;
132 struct device *dma_dev;
133 unsigned int irq;
120 bool dev_registered; 134 bool dev_registered;
121 135
122 u8 core_index; 136 u8 core_index;
@@ -179,6 +193,10 @@ struct bcma_bus {
179 193
180 struct bcma_drv_cc drv_cc; 194 struct bcma_drv_cc drv_cc;
181 struct bcma_drv_pci drv_pci; 195 struct bcma_drv_pci drv_pci;
196
197 /* We decided to share SPROM struct with SSB as long as we do not need
198 * any hacks for BCMA. This simplifies drivers code. */
199 struct ssb_sprom sprom;
182}; 200};
183 201
184extern inline u32 bcma_read8(struct bcma_device *core, u16 offset) 202extern inline u32 bcma_read8(struct bcma_device *core, u16 offset)
@@ -208,6 +226,18 @@ void bcma_write32(struct bcma_device *core, u16 offset, u32 value)
208{ 226{
209 core->bus->ops->write32(core, offset, value); 227 core->bus->ops->write32(core, offset, value);
210} 228}
229#ifdef CONFIG_BCMA_BLOCKIO
230extern inline void bcma_block_read(struct bcma_device *core, void *buffer,
231 size_t count, u16 offset, u8 reg_width)
232{
233 core->bus->ops->block_read(core, buffer, count, offset, reg_width);
234}
235extern inline void bcma_block_write(struct bcma_device *core, const void *buffer,
236 size_t count, u16 offset, u8 reg_width)
237{
238 core->bus->ops->block_write(core, buffer, count, offset, reg_width);
239}
240#endif
211extern inline u32 bcma_aread32(struct bcma_device *core, u16 offset) 241extern inline u32 bcma_aread32(struct bcma_device *core, u16 offset)
212{ 242{
213 return core->bus->ops->aread32(core, offset); 243 return core->bus->ops->aread32(core, offset);
@@ -218,7 +248,24 @@ void bcma_awrite32(struct bcma_device *core, u16 offset, u32 value)
218 core->bus->ops->awrite32(core, offset, value); 248 core->bus->ops->awrite32(core, offset, value);
219} 249}
220 250
251#define bcma_mask32(cc, offset, mask) \
252 bcma_write32(cc, offset, bcma_read32(cc, offset) & (mask))
253#define bcma_set32(cc, offset, set) \
254 bcma_write32(cc, offset, bcma_read32(cc, offset) | (set))
255#define bcma_maskset32(cc, offset, mask, set) \
256 bcma_write32(cc, offset, (bcma_read32(cc, offset) & (mask)) | (set))
257
221extern bool bcma_core_is_enabled(struct bcma_device *core); 258extern bool bcma_core_is_enabled(struct bcma_device *core);
259extern void bcma_core_disable(struct bcma_device *core, u32 flags);
222extern int bcma_core_enable(struct bcma_device *core, u32 flags); 260extern int bcma_core_enable(struct bcma_device *core, u32 flags);
261extern void bcma_core_set_clockmode(struct bcma_device *core,
262 enum bcma_clkmode clkmode);
263extern void bcma_core_pll_ctl(struct bcma_device *core, u32 req, u32 status,
264 bool on);
265#define BCMA_DMA_TRANSLATION_MASK 0xC0000000
266#define BCMA_DMA_TRANSLATION_NONE 0x00000000
267#define BCMA_DMA_TRANSLATION_DMA32_CMT 0x40000000 /* Client Mode Translation for 32-bit DMA */
268#define BCMA_DMA_TRANSLATION_DMA64_CMT 0x80000000 /* Client Mode Translation for 64-bit DMA */
269extern u32 bcma_core_dma_translation(struct bcma_device *core);
223 270
224#endif /* LINUX_BCMA_H_ */ 271#endif /* LINUX_BCMA_H_ */
diff --git a/include/linux/bcma/bcma_driver_chipcommon.h b/include/linux/bcma/bcma_driver_chipcommon.h
index 083c3b6cd5c..a0f684615ae 100644
--- a/include/linux/bcma/bcma_driver_chipcommon.h
+++ b/include/linux/bcma/bcma_driver_chipcommon.h
@@ -179,15 +179,7 @@
179#define BCMA_CC_PROG_WAITCNT 0x0124 179#define BCMA_CC_PROG_WAITCNT 0x0124
180#define BCMA_CC_FLASH_CFG 0x0128 180#define BCMA_CC_FLASH_CFG 0x0128
181#define BCMA_CC_FLASH_WAITCNT 0x012C 181#define BCMA_CC_FLASH_WAITCNT 0x012C
182#define BCMA_CC_CLKCTLST 0x01E0 /* Clock control and status (rev >= 20) */ 182/* 0x1E0 is defined as shared BCMA_CLKCTLST */
183#define BCMA_CC_CLKCTLST_FORCEALP 0x00000001 /* Force ALP request */
184#define BCMA_CC_CLKCTLST_FORCEHT 0x00000002 /* Force HT request */
185#define BCMA_CC_CLKCTLST_FORCEILP 0x00000004 /* Force ILP request */
186#define BCMA_CC_CLKCTLST_HAVEALPREQ 0x00000008 /* ALP available request */
187#define BCMA_CC_CLKCTLST_HAVEHTREQ 0x00000010 /* HT available request */
188#define BCMA_CC_CLKCTLST_HWCROFF 0x00000020 /* Force HW clock request off */
189#define BCMA_CC_CLKCTLST_HAVEHT 0x00010000 /* HT available */
190#define BCMA_CC_CLKCTLST_HAVEALP 0x00020000 /* APL available */
191#define BCMA_CC_HW_WORKAROUND 0x01E4 /* Hardware workaround (rev >= 20) */ 183#define BCMA_CC_HW_WORKAROUND 0x01E4 /* Hardware workaround (rev >= 20) */
192#define BCMA_CC_UART0_DATA 0x0300 184#define BCMA_CC_UART0_DATA 0x0300
193#define BCMA_CC_UART0_IMR 0x0304 185#define BCMA_CC_UART0_IMR 0x0304
@@ -244,6 +236,8 @@
244#define BCMA_CC_REGCTL_DATA 0x065C 236#define BCMA_CC_REGCTL_DATA 0x065C
245#define BCMA_CC_PLLCTL_ADDR 0x0660 237#define BCMA_CC_PLLCTL_ADDR 0x0660
246#define BCMA_CC_PLLCTL_DATA 0x0664 238#define BCMA_CC_PLLCTL_DATA 0x0664
239#define BCMA_CC_SPROM 0x0800 /* SPROM beginning */
240#define BCMA_CC_SPROM_PCIE6 0x0830 /* SPROM beginning on PCIe rev >= 6 */
247 241
248/* Data for the PMU, if available. 242/* Data for the PMU, if available.
249 * Check availability with ((struct bcma_chipcommon)->capabilities & BCMA_CC_CAP_PMU) 243 * Check availability with ((struct bcma_chipcommon)->capabilities & BCMA_CC_CAP_PMU)
diff --git a/include/linux/bcma/bcma_driver_pci.h b/include/linux/bcma/bcma_driver_pci.h
index b7e191cf00e..3871b668caf 100644
--- a/include/linux/bcma/bcma_driver_pci.h
+++ b/include/linux/bcma/bcma_driver_pci.h
@@ -85,5 +85,7 @@ struct bcma_drv_pci {
85#define pcicore_write32(pc, offset, val) bcma_write32((pc)->core, offset, val) 85#define pcicore_write32(pc, offset, val) bcma_write32((pc)->core, offset, val)
86 86
87extern void bcma_core_pci_init(struct bcma_drv_pci *pc); 87extern void bcma_core_pci_init(struct bcma_drv_pci *pc);
88extern int bcma_core_pci_irq_ctl(struct bcma_drv_pci *pc,
89 struct bcma_device *core, bool enable);
88 90
89#endif /* LINUX_BCMA_DRIVER_PCI_H_ */ 91#endif /* LINUX_BCMA_DRIVER_PCI_H_ */
diff --git a/include/linux/bcma/bcma_regs.h b/include/linux/bcma/bcma_regs.h
index f82d88a960c..9faae2ae02e 100644
--- a/include/linux/bcma/bcma_regs.h
+++ b/include/linux/bcma/bcma_regs.h
@@ -1,13 +1,38 @@
1#ifndef LINUX_BCMA_REGS_H_ 1#ifndef LINUX_BCMA_REGS_H_
2#define LINUX_BCMA_REGS_H_ 2#define LINUX_BCMA_REGS_H_
3 3
4/* Some single registers are shared between many cores */
5/* BCMA_CLKCTLST: ChipCommon (rev >= 20), PCIe, 80211 */
6#define BCMA_CLKCTLST 0x01E0 /* Clock control and status */
7#define BCMA_CLKCTLST_FORCEALP 0x00000001 /* Force ALP request */
8#define BCMA_CLKCTLST_FORCEHT 0x00000002 /* Force HT request */
9#define BCMA_CLKCTLST_FORCEILP 0x00000004 /* Force ILP request */
10#define BCMA_CLKCTLST_HAVEALPREQ 0x00000008 /* ALP available request */
11#define BCMA_CLKCTLST_HAVEHTREQ 0x00000010 /* HT available request */
12#define BCMA_CLKCTLST_HWCROFF 0x00000020 /* Force HW clock request off */
13#define BCMA_CLKCTLST_EXTRESREQ 0x00000700 /* Mask of external resource requests */
14#define BCMA_CLKCTLST_HAVEALP 0x00010000 /* ALP available */
15#define BCMA_CLKCTLST_HAVEHT 0x00020000 /* HT available */
16#define BCMA_CLKCTLST_BP_ON_ALP 0x00040000 /* RO: running on ALP clock */
17#define BCMA_CLKCTLST_BP_ON_HT 0x00080000 /* RO: running on HT clock */
18#define BCMA_CLKCTLST_EXTRESST 0x07000000 /* Mask of external resource status */
19/* Is there any BCM4328 on BCMA bus? */
20#define BCMA_CLKCTLST_4328A0_HAVEHT 0x00010000 /* 4328a0 has reversed bits */
21#define BCMA_CLKCTLST_4328A0_HAVEALP 0x00020000 /* 4328a0 has reversed bits */
22
4/* Agent registers (common for every core) */ 23/* Agent registers (common for every core) */
5#define BCMA_IOCTL 0x0408 24#define BCMA_IOCTL 0x0408 /* IO control */
6#define BCMA_IOCTL_CLK 0x0001 25#define BCMA_IOCTL_CLK 0x0001
7#define BCMA_IOCTL_FGC 0x0002 26#define BCMA_IOCTL_FGC 0x0002
8#define BCMA_IOCTL_CORE_BITS 0x3FFC 27#define BCMA_IOCTL_CORE_BITS 0x3FFC
9#define BCMA_IOCTL_PME_EN 0x4000 28#define BCMA_IOCTL_PME_EN 0x4000
10#define BCMA_IOCTL_BIST_EN 0x8000 29#define BCMA_IOCTL_BIST_EN 0x8000
30#define BCMA_IOST 0x0500 /* IO status */
31#define BCMA_IOST_CORE_BITS 0x0FFF
32#define BCMA_IOST_DMA64 0x1000
33#define BCMA_IOST_GATED_CLK 0x2000
34#define BCMA_IOST_BIST_ERROR 0x4000
35#define BCMA_IOST_BIST_DONE 0x8000
11#define BCMA_RESET_CTL 0x0800 36#define BCMA_RESET_CTL 0x0800
12#define BCMA_RESET_CTL_RESET 0x0001 37#define BCMA_RESET_CTL_RESET 0x0001
13 38
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h
index 8845613fd7e..fd88a3945aa 100644
--- a/include/linux/binfmts.h
+++ b/include/linux/binfmts.h
@@ -111,6 +111,7 @@ extern int __must_check remove_arg_zero(struct linux_binprm *);
111extern int search_binary_handler(struct linux_binprm *, struct pt_regs *); 111extern int search_binary_handler(struct linux_binprm *, struct pt_regs *);
112extern int flush_old_exec(struct linux_binprm * bprm); 112extern int flush_old_exec(struct linux_binprm * bprm);
113extern void setup_new_exec(struct linux_binprm * bprm); 113extern void setup_new_exec(struct linux_binprm * bprm);
114extern void would_dump(struct linux_binprm *, struct file *);
114 115
115extern int suid_dumpable; 116extern int suid_dumpable;
116#define SUID_DUMP_DISABLE 0 /* No setuid dumping */ 117#define SUID_DUMP_DISABLE 0 /* No setuid dumping */
diff --git a/include/linux/bit_spinlock.h b/include/linux/bit_spinlock.h
index b4326bfa684..ac4d9f8b52e 100644
--- a/include/linux/bit_spinlock.h
+++ b/include/linux/bit_spinlock.h
@@ -3,7 +3,7 @@
3 3
4#include <linux/kernel.h> 4#include <linux/kernel.h>
5#include <linux/preempt.h> 5#include <linux/preempt.h>
6#include <asm/atomic.h> 6#include <linux/atomic.h>
7 7
8/* 8/*
9 * bit-based spin_lock() 9 * bit-based spin_lock()
@@ -88,7 +88,7 @@ static inline int bit_spin_is_locked(int bitnum, unsigned long *addr)
88{ 88{
89#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) 89#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK)
90 return test_bit(bitnum, addr); 90 return test_bit(bitnum, addr);
91#elif defined CONFIG_PREEMPT 91#elif defined CONFIG_PREEMPT_COUNT
92 return preempt_count(); 92 return preempt_count();
93#else 93#else
94 return 1; 94 return 1;
diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h
index dcafe0bf000..7ad634501e4 100644
--- a/include/linux/bitmap.h
+++ b/include/linux/bitmap.h
@@ -144,7 +144,9 @@ extern int bitmap_find_free_region(unsigned long *bitmap, int bits, int order);
144extern void bitmap_release_region(unsigned long *bitmap, int pos, int order); 144extern void bitmap_release_region(unsigned long *bitmap, int pos, int order);
145extern int bitmap_allocate_region(unsigned long *bitmap, int pos, int order); 145extern int bitmap_allocate_region(unsigned long *bitmap, int pos, int order);
146extern void bitmap_copy_le(void *dst, const unsigned long *src, int nbits); 146extern void bitmap_copy_le(void *dst, const unsigned long *src, int nbits);
147extern int bitmap_ord_to_pos(const unsigned long *bitmap, int n, int bits);
147 148
149#define BITMAP_FIRST_WORD_MASK(start) (~0UL << ((start) % BITS_PER_LONG))
148#define BITMAP_LAST_WORD_MASK(nbits) \ 150#define BITMAP_LAST_WORD_MASK(nbits) \
149( \ 151( \
150 ((nbits) % BITS_PER_LONG) ? \ 152 ((nbits) % BITS_PER_LONG) ? \
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
index 6395692b2e7..71fc53bb8f1 100644
--- a/include/linux/blk_types.h
+++ b/include/linux/blk_types.h
@@ -124,8 +124,13 @@ enum rq_flag_bits {
124 124
125 __REQ_SYNC, /* request is sync (sync write or read) */ 125 __REQ_SYNC, /* request is sync (sync write or read) */
126 __REQ_META, /* metadata io request */ 126 __REQ_META, /* metadata io request */
127 __REQ_PRIO, /* boost priority in cfq */
127 __REQ_DISCARD, /* request to discard sectors */ 128 __REQ_DISCARD, /* request to discard sectors */
129 __REQ_SECURE, /* secure discard (used with __REQ_DISCARD) */
130
128 __REQ_NOIDLE, /* don't anticipate more IO after this one */ 131 __REQ_NOIDLE, /* don't anticipate more IO after this one */
132 __REQ_FUA, /* forced unit access */
133 __REQ_FLUSH, /* request for cache flush */
129 134
130 /* bio only flags */ 135 /* bio only flags */
131 __REQ_RAHEAD, /* read ahead, can fail anytime */ 136 __REQ_RAHEAD, /* read ahead, can fail anytime */
@@ -135,7 +140,6 @@ enum rq_flag_bits {
135 /* request only flags */ 140 /* request only flags */
136 __REQ_SORTED, /* elevator knows about this request */ 141 __REQ_SORTED, /* elevator knows about this request */
137 __REQ_SOFTBARRIER, /* may not be passed by ioscheduler */ 142 __REQ_SOFTBARRIER, /* may not be passed by ioscheduler */
138 __REQ_FUA, /* forced unit access */
139 __REQ_NOMERGE, /* don't touch this for merging */ 143 __REQ_NOMERGE, /* don't touch this for merging */
140 __REQ_STARTED, /* drive already may have started this one */ 144 __REQ_STARTED, /* drive already may have started this one */
141 __REQ_DONTPREP, /* don't call prep for this one */ 145 __REQ_DONTPREP, /* don't call prep for this one */
@@ -146,11 +150,9 @@ enum rq_flag_bits {
146 __REQ_PREEMPT, /* set for "ide_preempt" requests */ 150 __REQ_PREEMPT, /* set for "ide_preempt" requests */
147 __REQ_ALLOCED, /* request came from our alloc pool */ 151 __REQ_ALLOCED, /* request came from our alloc pool */
148 __REQ_COPY_USER, /* contains copies of user pages */ 152 __REQ_COPY_USER, /* contains copies of user pages */
149 __REQ_FLUSH, /* request for cache flush */
150 __REQ_FLUSH_SEQ, /* request for flush sequence */ 153 __REQ_FLUSH_SEQ, /* request for flush sequence */
151 __REQ_IO_STAT, /* account I/O stat */ 154 __REQ_IO_STAT, /* account I/O stat */
152 __REQ_MIXED_MERGE, /* merge of different types, fail separately */ 155 __REQ_MIXED_MERGE, /* merge of different types, fail separately */
153 __REQ_SECURE, /* secure discard (used with __REQ_DISCARD) */
154 __REQ_NR_BITS, /* stops here */ 156 __REQ_NR_BITS, /* stops here */
155}; 157};
156 158
@@ -160,14 +162,15 @@ enum rq_flag_bits {
160#define REQ_FAILFAST_DRIVER (1 << __REQ_FAILFAST_DRIVER) 162#define REQ_FAILFAST_DRIVER (1 << __REQ_FAILFAST_DRIVER)
161#define REQ_SYNC (1 << __REQ_SYNC) 163#define REQ_SYNC (1 << __REQ_SYNC)
162#define REQ_META (1 << __REQ_META) 164#define REQ_META (1 << __REQ_META)
165#define REQ_PRIO (1 << __REQ_PRIO)
163#define REQ_DISCARD (1 << __REQ_DISCARD) 166#define REQ_DISCARD (1 << __REQ_DISCARD)
164#define REQ_NOIDLE (1 << __REQ_NOIDLE) 167#define REQ_NOIDLE (1 << __REQ_NOIDLE)
165 168
166#define REQ_FAILFAST_MASK \ 169#define REQ_FAILFAST_MASK \
167 (REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER) 170 (REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER)
168#define REQ_COMMON_MASK \ 171#define REQ_COMMON_MASK \
169 (REQ_WRITE | REQ_FAILFAST_MASK | REQ_SYNC | REQ_META | REQ_DISCARD | \ 172 (REQ_WRITE | REQ_FAILFAST_MASK | REQ_SYNC | REQ_META | REQ_PRIO | \
170 REQ_NOIDLE | REQ_FLUSH | REQ_FUA | REQ_SECURE) 173 REQ_DISCARD | REQ_NOIDLE | REQ_FLUSH | REQ_FUA | REQ_SECURE)
171#define REQ_CLONE_MASK REQ_COMMON_MASK 174#define REQ_CLONE_MASK REQ_COMMON_MASK
172 175
173#define REQ_RAHEAD (1 << __REQ_RAHEAD) 176#define REQ_RAHEAD (1 << __REQ_RAHEAD)
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 1a23722e887..5e30b45d3d6 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -30,6 +30,7 @@ struct request_pm_state;
30struct blk_trace; 30struct blk_trace;
31struct request; 31struct request;
32struct sg_io_hdr; 32struct sg_io_hdr;
33struct bsg_job;
33 34
34#define BLKDEV_MIN_RQ 4 35#define BLKDEV_MIN_RQ 4
35#define BLKDEV_MAX_RQ 128 /* Default maximum */ 36#define BLKDEV_MAX_RQ 128 /* Default maximum */
@@ -73,7 +74,7 @@ enum rq_cmd_type_bits {
73 74
74/* 75/*
75 * try to put the fields that are referenced together in the same cacheline. 76 * try to put the fields that are referenced together in the same cacheline.
76 * if you modify this structure, be sure to check block/blk-core.c:rq_init() 77 * if you modify this structure, be sure to check block/blk-core.c:blk_rq_init()
77 * as well! 78 * as well!
78 */ 79 */
79struct request { 80struct request {
@@ -117,6 +118,7 @@ struct request {
117 struct { 118 struct {
118 unsigned int seq; 119 unsigned int seq;
119 struct list_head list; 120 struct list_head list;
121 rq_end_io_fn *saved_end_io;
120 } flush; 122 } flush;
121 }; 123 };
122 124
@@ -209,6 +211,7 @@ typedef int (merge_bvec_fn) (struct request_queue *, struct bvec_merge_data *,
209typedef void (softirq_done_fn)(struct request *); 211typedef void (softirq_done_fn)(struct request *);
210typedef int (dma_drain_needed_fn)(struct request *); 212typedef int (dma_drain_needed_fn)(struct request *);
211typedef int (lld_busy_fn) (struct request_queue *q); 213typedef int (lld_busy_fn) (struct request_queue *q);
214typedef int (bsg_job_fn) (struct bsg_job *);
212 215
213enum blk_eh_timer_return { 216enum blk_eh_timer_return {
214 BLK_EH_NOT_HANDLED, 217 BLK_EH_NOT_HANDLED,
@@ -260,8 +263,7 @@ struct queue_limits {
260 unsigned char discard_zeroes_data; 263 unsigned char discard_zeroes_data;
261}; 264};
262 265
263struct request_queue 266struct request_queue {
264{
265 /* 267 /*
266 * Together with queue_head for cacheline sharing 268 * Together with queue_head for cacheline sharing
267 */ 269 */
@@ -304,14 +306,14 @@ struct request_queue
304 void *queuedata; 306 void *queuedata;
305 307
306 /* 308 /*
307 * queue needs bounce pages for pages above this limit 309 * various queue flags, see QUEUE_* below
308 */ 310 */
309 gfp_t bounce_gfp; 311 unsigned long queue_flags;
310 312
311 /* 313 /*
312 * various queue flags, see QUEUE_* below 314 * queue needs bounce pages for pages above this limit
313 */ 315 */
314 unsigned long queue_flags; 316 gfp_t bounce_gfp;
315 317
316 /* 318 /*
317 * protects queue structures from reentrancy. ->__queue_lock should 319 * protects queue structures from reentrancy. ->__queue_lock should
@@ -334,8 +336,8 @@ struct request_queue
334 unsigned int nr_congestion_off; 336 unsigned int nr_congestion_off;
335 unsigned int nr_batching; 337 unsigned int nr_batching;
336 338
337 void *dma_drain_buffer;
338 unsigned int dma_drain_size; 339 unsigned int dma_drain_size;
340 void *dma_drain_buffer;
339 unsigned int dma_pad_mask; 341 unsigned int dma_pad_mask;
340 unsigned int dma_alignment; 342 unsigned int dma_alignment;
341 343
@@ -376,6 +378,8 @@ struct request_queue
376 struct mutex sysfs_lock; 378 struct mutex sysfs_lock;
377 379
378#if defined(CONFIG_BLK_DEV_BSG) 380#if defined(CONFIG_BLK_DEV_BSG)
381 bsg_job_fn *bsg_job_fn;
382 int bsg_job_size;
379 struct bsg_class_device bsg_dev; 383 struct bsg_class_device bsg_dev;
380#endif 384#endif
381 385
@@ -393,7 +397,7 @@ struct request_queue
393#define QUEUE_FLAG_ELVSWITCH 6 /* don't use elevator, just do FIFO */ 397#define QUEUE_FLAG_ELVSWITCH 6 /* don't use elevator, just do FIFO */
394#define QUEUE_FLAG_BIDI 7 /* queue supports bidi requests */ 398#define QUEUE_FLAG_BIDI 7 /* queue supports bidi requests */
395#define QUEUE_FLAG_NOMERGES 8 /* disable merge attempts */ 399#define QUEUE_FLAG_NOMERGES 8 /* disable merge attempts */
396#define QUEUE_FLAG_SAME_COMP 9 /* force complete on same CPU */ 400#define QUEUE_FLAG_SAME_COMP 9 /* complete on same CPU-group */
397#define QUEUE_FLAG_FAIL_IO 10 /* fake timeout */ 401#define QUEUE_FLAG_FAIL_IO 10 /* fake timeout */
398#define QUEUE_FLAG_STACKABLE 11 /* supports request stacking */ 402#define QUEUE_FLAG_STACKABLE 11 /* supports request stacking */
399#define QUEUE_FLAG_NONROT 12 /* non-rotational device (SSD) */ 403#define QUEUE_FLAG_NONROT 12 /* non-rotational device (SSD) */
@@ -403,6 +407,7 @@ struct request_queue
403#define QUEUE_FLAG_NOXMERGES 15 /* No extended merges */ 407#define QUEUE_FLAG_NOXMERGES 15 /* No extended merges */
404#define QUEUE_FLAG_ADD_RANDOM 16 /* Contributes to random pool */ 408#define QUEUE_FLAG_ADD_RANDOM 16 /* Contributes to random pool */
405#define QUEUE_FLAG_SECDISCARD 17 /* supports SECDISCARD */ 409#define QUEUE_FLAG_SECDISCARD 17 /* supports SECDISCARD */
410#define QUEUE_FLAG_SAME_FORCE 18 /* force complete on same CPU */
406 411
407#define QUEUE_FLAG_DEFAULT ((1 << QUEUE_FLAG_IO_STAT) | \ 412#define QUEUE_FLAG_DEFAULT ((1 << QUEUE_FLAG_IO_STAT) | \
408 (1 << QUEUE_FLAG_STACKABLE) | \ 413 (1 << QUEUE_FLAG_STACKABLE) | \
@@ -798,9 +803,6 @@ extern void blk_unprep_request(struct request *);
798 */ 803 */
799extern struct request_queue *blk_init_queue_node(request_fn_proc *rfn, 804extern struct request_queue *blk_init_queue_node(request_fn_proc *rfn,
800 spinlock_t *lock, int node_id); 805 spinlock_t *lock, int node_id);
801extern struct request_queue *blk_init_allocated_queue_node(struct request_queue *,
802 request_fn_proc *,
803 spinlock_t *, int node_id);
804extern struct request_queue *blk_init_queue(request_fn_proc *, spinlock_t *); 806extern struct request_queue *blk_init_queue(request_fn_proc *, spinlock_t *);
805extern struct request_queue *blk_init_allocated_queue(struct request_queue *, 807extern struct request_queue *blk_init_allocated_queue(struct request_queue *,
806 request_fn_proc *, spinlock_t *); 808 request_fn_proc *, spinlock_t *);
@@ -857,12 +859,20 @@ struct request_queue *blk_alloc_queue(gfp_t);
857struct request_queue *blk_alloc_queue_node(gfp_t, int); 859struct request_queue *blk_alloc_queue_node(gfp_t, int);
858extern void blk_put_queue(struct request_queue *); 860extern void blk_put_queue(struct request_queue *);
859 861
862/*
863 * Note: Code in between changing the blk_plug list/cb_list or element of such
864 * lists is preemptable, but such code can't do sleep (or be very careful),
865 * otherwise data is corrupted. For details, please check schedule() where
866 * blk_schedule_flush_plug() is called.
867 */
860struct blk_plug { 868struct blk_plug {
861 unsigned long magic; 869 unsigned long magic;
862 struct list_head list; 870 struct list_head list;
863 struct list_head cb_list; 871 struct list_head cb_list;
864 unsigned int should_sort; 872 unsigned int should_sort;
865}; 873};
874#define BLK_MAX_REQUEST_COUNT 16
875
866struct blk_plug_cb { 876struct blk_plug_cb {
867 struct list_head list; 877 struct list_head list;
868 void (*callback)(struct blk_plug_cb *); 878 void (*callback)(struct blk_plug_cb *);
diff --git a/include/linux/blktrace_api.h b/include/linux/blktrace_api.h
index 8c7c2de7631..8e9e4bc6d73 100644
--- a/include/linux/blktrace_api.h
+++ b/include/linux/blktrace_api.h
@@ -14,7 +14,7 @@
14enum blktrace_cat { 14enum blktrace_cat {
15 BLK_TC_READ = 1 << 0, /* reads */ 15 BLK_TC_READ = 1 << 0, /* reads */
16 BLK_TC_WRITE = 1 << 1, /* writes */ 16 BLK_TC_WRITE = 1 << 1, /* writes */
17 BLK_TC_BARRIER = 1 << 2, /* barrier */ 17 BLK_TC_FLUSH = 1 << 2, /* flush */
18 BLK_TC_SYNC = 1 << 3, /* sync IO */ 18 BLK_TC_SYNC = 1 << 3, /* sync IO */
19 BLK_TC_SYNCIO = BLK_TC_SYNC, 19 BLK_TC_SYNCIO = BLK_TC_SYNC,
20 BLK_TC_QUEUE = 1 << 4, /* queueing/merging */ 20 BLK_TC_QUEUE = 1 << 4, /* queueing/merging */
@@ -28,8 +28,9 @@ enum blktrace_cat {
28 BLK_TC_META = 1 << 12, /* metadata */ 28 BLK_TC_META = 1 << 12, /* metadata */
29 BLK_TC_DISCARD = 1 << 13, /* discard requests */ 29 BLK_TC_DISCARD = 1 << 13, /* discard requests */
30 BLK_TC_DRV_DATA = 1 << 14, /* binary per-driver data */ 30 BLK_TC_DRV_DATA = 1 << 14, /* binary per-driver data */
31 BLK_TC_FUA = 1 << 15, /* fua requests */
31 32
32 BLK_TC_END = 1 << 15, /* only 16-bits, reminder */ 33 BLK_TC_END = 1 << 15, /* we've run out of bits! */
33}; 34};
34 35
35#define BLK_TC_SHIFT (16) 36#define BLK_TC_SHIFT (16)
diff --git a/include/linux/bq27x00.h b/include/linux/bq27x00.h
new file mode 100644
index 00000000000..b95cd203523
--- /dev/null
+++ b/include/linux/bq27x00.h
@@ -0,0 +1,30 @@
1/*
2 * include/linux/bq27x00.h
3 *
4 * BQ27x00 battery driver
5 *
6 * Copyright (c) 2011, NVIDIA Corporation.
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, but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 * 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 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 */
22
23#ifndef _LINUX_BQ27x00_H
24#define _LINUX_BQ27x00_H
25
26struct bq27x00_platform_data {
27 int ac_persent_gpio;
28};
29
30#endif /* _LINUX_BQ27x00_H */
diff --git a/include/linux/bsg-lib.h b/include/linux/bsg-lib.h
new file mode 100644
index 00000000000..f55ab8cdc10
--- /dev/null
+++ b/include/linux/bsg-lib.h
@@ -0,0 +1,73 @@
1/*
2 * BSG helper library
3 *
4 * Copyright (C) 2008 James Smart, Emulex Corporation
5 * Copyright (C) 2011 Red Hat, Inc. All rights reserved.
6 * Copyright (C) 2011 Mike Christie
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 *
22 */
23#ifndef _BLK_BSG_
24#define _BLK_BSG_
25
26#include <linux/blkdev.h>
27
28struct request;
29struct device;
30struct scatterlist;
31struct request_queue;
32
33struct bsg_buffer {
34 unsigned int payload_len;
35 int sg_cnt;
36 struct scatterlist *sg_list;
37};
38
39struct bsg_job {
40 struct device *dev;
41 struct request *req;
42
43 /* Transport/driver specific request/reply structs */
44 void *request;
45 void *reply;
46
47 unsigned int request_len;
48 unsigned int reply_len;
49 /*
50 * On entry : reply_len indicates the buffer size allocated for
51 * the reply.
52 *
53 * Upon completion : the message handler must set reply_len
54 * to indicates the size of the reply to be returned to the
55 * caller.
56 */
57
58 /* DMA payloads for the request/response */
59 struct bsg_buffer request_payload;
60 struct bsg_buffer reply_payload;
61
62 void *dd_data; /* Used for driver-specific storage */
63};
64
65void bsg_job_done(struct bsg_job *job, int result,
66 unsigned int reply_payload_rcv_len);
67int bsg_setup_queue(struct device *dev, struct request_queue *q, char *name,
68 bsg_job_fn *job_fn, int dd_job_size);
69void bsg_request_fn(struct request_queue *q);
70void bsg_remove_queue(struct request_queue *q);
71void bsg_goose_queue(struct request_queue *q);
72
73#endif
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index 503c8a6b307..458f497738a 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -12,7 +12,7 @@
12#include <linux/linkage.h> 12#include <linux/linkage.h>
13#include <linux/pagemap.h> 13#include <linux/pagemap.h>
14#include <linux/wait.h> 14#include <linux/wait.h>
15#include <asm/atomic.h> 15#include <linux/atomic.h>
16 16
17#ifdef CONFIG_BLOCK 17#ifdef CONFIG_BLOCK
18 18
diff --git a/include/linux/ceph/libceph.h b/include/linux/ceph/libceph.h
index 6365f041745..563755181c1 100644
--- a/include/linux/ceph/libceph.h
+++ b/include/linux/ceph/libceph.h
@@ -35,7 +35,7 @@
35#define CEPH_OPT_MYIP (1<<2) /* specified my ip */ 35#define CEPH_OPT_MYIP (1<<2) /* specified my ip */
36#define CEPH_OPT_NOCRC (1<<3) /* no data crc on writes */ 36#define CEPH_OPT_NOCRC (1<<3) /* no data crc on writes */
37 37
38#define CEPH_OPT_DEFAULT (0); 38#define CEPH_OPT_DEFAULT (0)
39 39
40#define ceph_set_opt(client, opt) \ 40#define ceph_set_opt(client, opt) \
41 (client)->options->flags |= CEPH_OPT_##opt; 41 (client)->options->flags |= CEPH_OPT_##opt;
diff --git a/include/linux/ceph/messenger.h b/include/linux/ceph/messenger.h
index 31d91a64838..d7adf151d33 100644
--- a/include/linux/ceph/messenger.h
+++ b/include/linux/ceph/messenger.h
@@ -94,6 +94,7 @@ struct ceph_msg {
94 bool more_to_follow; 94 bool more_to_follow;
95 bool needs_out_seq; 95 bool needs_out_seq;
96 int front_max; 96 int front_max;
97 unsigned long ack_stamp; /* tx: when we were acked */
97 98
98 struct ceph_msgpool *pool; 99 struct ceph_msgpool *pool;
99}; 100};
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index ab4ac0ccb85..cefedc8ced9 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -84,12 +84,6 @@ enum {
84 CSS_REMOVED, /* This CSS is dead */ 84 CSS_REMOVED, /* This CSS is dead */
85}; 85};
86 86
87/* Caller must verify that the css is not for root cgroup */
88static inline void __css_get(struct cgroup_subsys_state *css, int count)
89{
90 atomic_add(count, &css->refcnt);
91}
92
93/* 87/*
94 * Call css_get() to hold a reference on the css; it can be used 88 * Call css_get() to hold a reference on the css; it can be used
95 * for a reference obtained via: 89 * for a reference obtained via:
@@ -97,6 +91,7 @@ static inline void __css_get(struct cgroup_subsys_state *css, int count)
97 * - task->cgroups for a locked task 91 * - task->cgroups for a locked task
98 */ 92 */
99 93
94extern void __css_get(struct cgroup_subsys_state *css, int count);
100static inline void css_get(struct cgroup_subsys_state *css) 95static inline void css_get(struct cgroup_subsys_state *css)
101{ 96{
102 /* We don't need to reference count the root state */ 97 /* We don't need to reference count the root state */
@@ -143,10 +138,7 @@ static inline void css_put(struct cgroup_subsys_state *css)
143enum { 138enum {
144 /* Control Group is dead */ 139 /* Control Group is dead */
145 CGRP_REMOVED, 140 CGRP_REMOVED,
146 /* 141 /* Control Group has ever had a child cgroup or a task */
147 * Control Group has previously had a child cgroup or a task,
148 * but no longer (only if CGRP_NOTIFY_ON_RELEASE is set)
149 */
150 CGRP_RELEASABLE, 142 CGRP_RELEASABLE,
151 /* Control Group requires release notifications to userspace */ 143 /* Control Group requires release notifications to userspace */
152 CGRP_NOTIFY_ON_RELEASE, 144 CGRP_NOTIFY_ON_RELEASE,
@@ -287,6 +279,7 @@ struct css_set {
287 279
288 /* For RCU-protected deletion */ 280 /* For RCU-protected deletion */
289 struct rcu_head rcu_head; 281 struct rcu_head rcu_head;
282 struct work_struct work;
290}; 283};
291 284
292/* 285/*
@@ -466,6 +459,7 @@ struct cgroup_subsys {
466 struct cgroup *cgrp); 459 struct cgroup *cgrp);
467 int (*pre_destroy)(struct cgroup_subsys *ss, struct cgroup *cgrp); 460 int (*pre_destroy)(struct cgroup_subsys *ss, struct cgroup *cgrp);
468 void (*destroy)(struct cgroup_subsys *ss, struct cgroup *cgrp); 461 void (*destroy)(struct cgroup_subsys *ss, struct cgroup *cgrp);
462 int (*allow_attach)(struct cgroup *cgrp, struct task_struct *tsk);
469 int (*can_attach)(struct cgroup_subsys *ss, struct cgroup *cgrp, 463 int (*can_attach)(struct cgroup_subsys *ss, struct cgroup *cgrp,
470 struct task_struct *tsk); 464 struct task_struct *tsk);
471 int (*can_attach_task)(struct cgroup *cgrp, struct task_struct *tsk); 465 int (*can_attach_task)(struct cgroup *cgrp, struct task_struct *tsk);
@@ -539,7 +533,6 @@ static inline struct cgroup_subsys_state *cgroup_subsys_state(
539 */ 533 */
540#define task_subsys_state_check(task, subsys_id, __c) \ 534#define task_subsys_state_check(task, subsys_id, __c) \
541 rcu_dereference_check(task->cgroups->subsys[subsys_id], \ 535 rcu_dereference_check(task->cgroups->subsys[subsys_id], \
542 rcu_read_lock_held() || \
543 lockdep_is_held(&task->alloc_lock) || \ 536 lockdep_is_held(&task->alloc_lock) || \
544 cgroup_lock_is_held() || (__c)) 537 cgroup_lock_is_held() || (__c))
545 538
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index 18a1baf31f2..c86c940d1de 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -22,6 +22,10 @@
22typedef u64 cycle_t; 22typedef u64 cycle_t;
23struct clocksource; 23struct clocksource;
24 24
25#ifdef CONFIG_ARCH_CLOCKSOURCE_DATA
26#include <asm/clocksource.h>
27#endif
28
25/** 29/**
26 * struct cyclecounter - hardware abstraction for a free running counter 30 * struct cyclecounter - hardware abstraction for a free running counter
27 * Provides completely state-free accessors to the underlying hardware. 31 * Provides completely state-free accessors to the underlying hardware.
@@ -152,8 +156,9 @@ extern u64 timecounter_cyc2time(struct timecounter *tc,
152 * @mult: cycle to nanosecond multiplier 156 * @mult: cycle to nanosecond multiplier
153 * @shift: cycle to nanosecond divisor (power of two) 157 * @shift: cycle to nanosecond divisor (power of two)
154 * @max_idle_ns: max idle time permitted by the clocksource (nsecs) 158 * @max_idle_ns: max idle time permitted by the clocksource (nsecs)
159 * @maxadj maximum adjustment value to mult (~11%)
155 * @flags: flags describing special properties 160 * @flags: flags describing special properties
156 * @vread: vsyscall based read 161 * @archdata: arch-specific data
157 * @suspend: suspend function for the clocksource, if necessary 162 * @suspend: suspend function for the clocksource, if necessary
158 * @resume: resume function for the clocksource, if necessary 163 * @resume: resume function for the clocksource, if necessary
159 */ 164 */
@@ -168,17 +173,14 @@ struct clocksource {
168 u32 mult; 173 u32 mult;
169 u32 shift; 174 u32 shift;
170 u64 max_idle_ns; 175 u64 max_idle_ns;
171 176 u32 maxadj;
172#ifdef CONFIG_IA64 177#ifdef CONFIG_ARCH_CLOCKSOURCE_DATA
173 void *fsys_mmio; /* used by fsyscall asm code */ 178 struct arch_clocksource_data archdata;
174#define CLKSRC_FSYS_MMIO_SET(mmio, addr) ((mmio) = (addr))
175#else
176#define CLKSRC_FSYS_MMIO_SET(mmio, addr) do { } while (0)
177#endif 179#endif
180
178 const char *name; 181 const char *name;
179 struct list_head list; 182 struct list_head list;
180 int rating; 183 int rating;
181 cycle_t (*vread)(void);
182 int (*enable)(struct clocksource *cs); 184 int (*enable)(struct clocksource *cs);
183 void (*disable)(struct clocksource *cs); 185 void (*disable)(struct clocksource *cs);
184 unsigned long flags; 186 unsigned long flags;
diff --git a/include/linux/cm3217.h b/include/linux/cm3217.h
new file mode 100644
index 00000000000..29c72b58f8e
--- /dev/null
+++ b/include/linux/cm3217.h
@@ -0,0 +1,59 @@
1/* include/linux/cm3217.h
2 *
3 * Copyright (C) 2011 Capella Microsystems Inc.
4 * Author: Frank Hsieh <pengyueh@gmail.com>
5 *
6 * This software is licensed under the terms of the GNU General Public
7 * License version 2, as published by the Free Software Foundation, and
8 * may be copied, distributed, and modified under those terms.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 */
16
17#ifndef __LINUX_CM3217_H
18#define __LINUX_CM3217_H
19
20#define CM3217_I2C_NAME "cm3217"
21
22#define ALS_W_CMD1_addr (0x20 >> 1)
23#define ALS_W_CMD2_addr (0x22 >> 1)
24#define ALS_R_MSB_addr (0x21 >> 1)
25#define ALS_R_LSB_addr (0x23 >> 1)
26
27#define ALS_CALIBRATED 0x6E93
28
29/* cm3217 */
30
31/* for ALS command 20h */
32#define CM3217_ALS_BIT5_Default_1 (1 << 5)
33#define CM3217_ALS_IT_HALF_T (0 << 2)
34#define CM3217_ALS_IT_1_T (1 << 2)
35#define CM3217_ALS_IT_2_T (2 << 2)
36#define CM3217_ALS_IT_4_T (4 << 2)
37#define CM3217_ALS_WDM_DEFAULT_1 (1 << 1)
38#define CM3217_ALS_SD (1 << 0)
39
40/* for ALS command 22h */
41#define CM3217_ALS_IT_800ms (0 << 5)
42#define CM3217_ALS_IT_400ms (1 << 5)
43#define CM3217_ALS_IT_266ms (2 << 5)
44#define CM3217_ALS_IT_200ms (3 << 5)
45#define CM3217_ALS_IT_130ms (4 << 5)
46#define CM3217_ALS_IT_100ms (5 << 5)
47#define CM3217_ALS_IT_80ms (6 << 5)
48#define CM3217_ALS_IT_66ms (7 << 5)
49
50struct cm3217_platform_data {
51 uint16_t levels[10];
52 uint16_t golden_adc;
53 int (*power) (int, uint8_t); /* power to the chip */
54 uint16_t ALS_slave_address;
55};
56
57#define LS_PWR_ON (1 << 0)
58
59#endif
diff --git a/include/linux/cn_proc.h b/include/linux/cn_proc.h
index 47dac5ea8d3..12c517b51ca 100644
--- a/include/linux/cn_proc.h
+++ b/include/linux/cn_proc.h
@@ -53,6 +53,7 @@ struct proc_event {
53 PROC_EVENT_UID = 0x00000004, 53 PROC_EVENT_UID = 0x00000004,
54 PROC_EVENT_GID = 0x00000040, 54 PROC_EVENT_GID = 0x00000040,
55 PROC_EVENT_SID = 0x00000080, 55 PROC_EVENT_SID = 0x00000080,
56 PROC_EVENT_PTRACE = 0x00000100,
56 /* "next" should be 0x00000400 */ 57 /* "next" should be 0x00000400 */
57 /* "last" is the last process event: exit */ 58 /* "last" is the last process event: exit */
58 PROC_EVENT_EXIT = 0x80000000 59 PROC_EVENT_EXIT = 0x80000000
@@ -95,6 +96,13 @@ struct proc_event {
95 __kernel_pid_t process_tgid; 96 __kernel_pid_t process_tgid;
96 } sid; 97 } sid;
97 98
99 struct ptrace_proc_event {
100 __kernel_pid_t process_pid;
101 __kernel_pid_t process_tgid;
102 __kernel_pid_t tracer_pid;
103 __kernel_pid_t tracer_tgid;
104 } ptrace;
105
98 struct exit_proc_event { 106 struct exit_proc_event {
99 __kernel_pid_t process_pid; 107 __kernel_pid_t process_pid;
100 __kernel_pid_t process_tgid; 108 __kernel_pid_t process_tgid;
@@ -109,6 +117,7 @@ void proc_fork_connector(struct task_struct *task);
109void proc_exec_connector(struct task_struct *task); 117void proc_exec_connector(struct task_struct *task);
110void proc_id_connector(struct task_struct *task, int which_id); 118void proc_id_connector(struct task_struct *task, int which_id);
111void proc_sid_connector(struct task_struct *task); 119void proc_sid_connector(struct task_struct *task);
120void proc_ptrace_connector(struct task_struct *task, int which_id);
112void proc_exit_connector(struct task_struct *task); 121void proc_exit_connector(struct task_struct *task);
113#else 122#else
114static inline void proc_fork_connector(struct task_struct *task) 123static inline void proc_fork_connector(struct task_struct *task)
@@ -124,6 +133,10 @@ static inline void proc_id_connector(struct task_struct *task,
124static inline void proc_sid_connector(struct task_struct *task) 133static inline void proc_sid_connector(struct task_struct *task)
125{} 134{}
126 135
136static inline void proc_ptrace_connector(struct task_struct *task,
137 int ptrace_id)
138{}
139
127static inline void proc_exit_connector(struct task_struct *task) 140static inline void proc_exit_connector(struct task_struct *task)
128{} 141{}
129#endif /* CONFIG_PROC_EVENTS */ 142#endif /* CONFIG_PROC_EVENTS */
diff --git a/include/linux/compat.h b/include/linux/compat.h
index 846bb179257..c6e7523bf76 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -438,16 +438,6 @@ asmlinkage long compat_sys_ppoll(struct pollfd __user *ufds,
438 struct compat_timespec __user *tsp, 438 struct compat_timespec __user *tsp,
439 const compat_sigset_t __user *sigmask, 439 const compat_sigset_t __user *sigmask,
440 compat_size_t sigsetsize); 440 compat_size_t sigsetsize);
441#if (defined(CONFIG_NFSD) || defined(CONFIG_NFSD_MODULE)) && \
442 !defined(CONFIG_NFSD_DEPRECATED)
443union compat_nfsctl_res;
444struct compat_nfsctl_arg;
445asmlinkage long compat_sys_nfsservctl(int cmd,
446 struct compat_nfsctl_arg __user *arg,
447 union compat_nfsctl_res __user *res);
448#else
449asmlinkage long compat_sys_nfsservctl(int cmd, void *notused, void *notused2);
450#endif
451asmlinkage long compat_sys_signalfd4(int ufd, 441asmlinkage long compat_sys_signalfd4(int ufd,
452 const compat_sigset_t __user *sigmask, 442 const compat_sigset_t __user *sigmask,
453 compat_size_t sigsetsize, int flags); 443 compat_size_t sigsetsize, int flags);
diff --git a/include/linux/configfs.h b/include/linux/configfs.h
index 645778ad899..3081c58d696 100644
--- a/include/linux/configfs.h
+++ b/include/linux/configfs.h
@@ -42,7 +42,7 @@
42#include <linux/mutex.h> 42#include <linux/mutex.h>
43#include <linux/err.h> 43#include <linux/err.h>
44 44
45#include <asm/atomic.h> 45#include <linux/atomic.h>
46 46
47#define CONFIGFS_ITEM_NAME_LEN 20 47#define CONFIGFS_ITEM_NAME_LEN 20
48 48
diff --git a/include/linux/connector.h b/include/linux/connector.h
index f696bccd48c..3c9c54fd569 100644
--- a/include/linux/connector.h
+++ b/include/linux/connector.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * connector.h 2 * connector.h
3 * 3 *
4 * 2004-2005 Copyright (c) Evgeniy Polyakov <johnpol@2ka.mipt.ru> 4 * 2004-2005 Copyright (c) Evgeniy Polyakov <zbr@ioremap.net>
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
@@ -75,7 +75,7 @@ struct cn_msg {
75 75
76#ifdef __KERNEL__ 76#ifdef __KERNEL__
77 77
78#include <asm/atomic.h> 78#include <linux/atomic.h>
79 79
80#include <linux/list.h> 80#include <linux/list.h>
81#include <linux/workqueue.h> 81#include <linux/workqueue.h>
diff --git a/include/linux/cordic.h b/include/linux/cordic.h
new file mode 100644
index 00000000000..f932093e20c
--- /dev/null
+++ b/include/linux/cordic.h
@@ -0,0 +1,48 @@
1/*
2 * Copyright (c) 2011 Broadcom Corporation
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
11 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
13 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16#ifndef __CORDIC_H_
17#define __CORDIC_H_
18
19#include <linux/types.h>
20
21/**
22 * struct cordic_iq - i/q coordinate.
23 *
24 * @i: real part of coordinate (in phase).
25 * @q: imaginary part of coordinate (quadrature).
26 */
27struct cordic_iq {
28 s32 i;
29 s32 q;
30};
31
32/**
33 * cordic_calc_iq() - calculates the i/q coordinate for given angle.
34 *
35 * @theta: angle in degrees for which i/q coordinate is to be calculated.
36 * @coord: function output parameter holding the i/q coordinate.
37 *
38 * The function calculates the i/q coordinate for a given angle using
39 * cordic algorithm. The coordinate consists of a real (i) and an
40 * imaginary (q) part. The real part is essentially the cosine of the
41 * angle and the imaginary part is the sine of the angle. The returned
42 * values are scaled by 2^16 for precision. The range for theta is
43 * for -180 degrees to +180 degrees. Passed values outside this range are
44 * converted before doing the actual calculation.
45 */
46struct cordic_iq cordic_calc_iq(s32 theta);
47
48#endif /* __CORDIC_H_ */
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index 5f09323ee88..54d948ec49a 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -70,6 +70,39 @@ enum {
70 CPU_PRI_WORKQUEUE = 5, 70 CPU_PRI_WORKQUEUE = 5,
71}; 71};
72 72
73#define CPU_ONLINE 0x0002 /* CPU (unsigned)v is up */
74#define CPU_UP_PREPARE 0x0003 /* CPU (unsigned)v coming up */
75#define CPU_UP_CANCELED 0x0004 /* CPU (unsigned)v NOT coming up */
76#define CPU_DOWN_PREPARE 0x0005 /* CPU (unsigned)v going down */
77#define CPU_DOWN_FAILED 0x0006 /* CPU (unsigned)v NOT going down */
78#define CPU_DEAD 0x0007 /* CPU (unsigned)v dead */
79#define CPU_DYING 0x0008 /* CPU (unsigned)v not running any task,
80 * not handling interrupts, soon dead.
81 * Called on the dying cpu, interrupts
82 * are already disabled. Must not
83 * sleep, must not fail */
84#define CPU_POST_DEAD 0x0009 /* CPU (unsigned)v dead, cpu_hotplug
85 * lock is dropped */
86#define CPU_STARTING 0x000A /* CPU (unsigned)v soon running.
87 * Called on the new cpu, just before
88 * enabling interrupts. Must not sleep,
89 * must not fail */
90
91/* Used for CPU hotplug events occurring while tasks are frozen due to a suspend
92 * operation in progress
93 */
94#define CPU_TASKS_FROZEN 0x0010
95
96#define CPU_ONLINE_FROZEN (CPU_ONLINE | CPU_TASKS_FROZEN)
97#define CPU_UP_PREPARE_FROZEN (CPU_UP_PREPARE | CPU_TASKS_FROZEN)
98#define CPU_UP_CANCELED_FROZEN (CPU_UP_CANCELED | CPU_TASKS_FROZEN)
99#define CPU_DOWN_PREPARE_FROZEN (CPU_DOWN_PREPARE | CPU_TASKS_FROZEN)
100#define CPU_DOWN_FAILED_FROZEN (CPU_DOWN_FAILED | CPU_TASKS_FROZEN)
101#define CPU_DEAD_FROZEN (CPU_DEAD | CPU_TASKS_FROZEN)
102#define CPU_DYING_FROZEN (CPU_DYING | CPU_TASKS_FROZEN)
103#define CPU_STARTING_FROZEN (CPU_STARTING | CPU_TASKS_FROZEN)
104
105
73#ifdef CONFIG_SMP 106#ifdef CONFIG_SMP
74/* Need to know about CPUs going up/down? */ 107/* Need to know about CPUs going up/down? */
75#if defined(CONFIG_HOTPLUG_CPU) || !defined(MODULE) 108#if defined(CONFIG_HOTPLUG_CPU) || !defined(MODULE)
@@ -174,4 +207,11 @@ static inline int disable_nonboot_cpus(void) { return 0; }
174static inline void enable_nonboot_cpus(void) {} 207static inline void enable_nonboot_cpus(void) {}
175#endif /* !CONFIG_PM_SLEEP_SMP */ 208#endif /* !CONFIG_PM_SLEEP_SMP */
176 209
210#define IDLE_START 1
211#define IDLE_END 2
212
213void idle_notifier_register(struct notifier_block *n);
214void idle_notifier_unregister(struct notifier_block *n);
215void idle_notifier_call_chain(unsigned long val);
216
177#endif /* _LINUX_CPU_H_ */ 217#endif /* _LINUX_CPU_H_ */
diff --git a/include/linux/cpuacct.h b/include/linux/cpuacct.h
new file mode 100644
index 00000000000..8f68e733fe1
--- /dev/null
+++ b/include/linux/cpuacct.h
@@ -0,0 +1,43 @@
1/* include/linux/cpuacct.h
2 *
3 * Copyright (C) 2010 Google, Inc.
4 *
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
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 */
15
16#ifndef _CPUACCT_H_
17#define _CPUACCT_H_
18
19#include <linux/cgroup.h>
20
21#ifdef CONFIG_CGROUP_CPUACCT
22
23/*
24 * Platform specific CPU frequency hooks for cpuacct. These functions are
25 * called from the scheduler.
26 */
27struct cpuacct_charge_calls {
28 /*
29 * Platforms can take advantage of this data and use
30 * per-cpu allocations if necessary.
31 */
32 void (*init) (void **cpuacct_data);
33 void (*charge) (void *cpuacct_data, u64 cputime, unsigned int cpu);
34 void (*cpufreq_show) (void *cpuacct_data, struct cgroup_map_cb *cb);
35 /* Returns power consumed in milliWatt seconds */
36 u64 (*power_usage) (void *cpuacct_data);
37};
38
39int cpuacct_charge_register(struct cpuacct_charge_calls *fn);
40
41#endif /* CONFIG_CGROUP_CPUACCT */
42
43#endif // _CPUACCT_H_
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index 11be48e0d16..c6126b9fb7c 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -324,11 +324,16 @@ static inline unsigned int cpufreq_get(unsigned int cpu)
324/* query the last known CPU freq (in kHz). If zero, cpufreq couldn't detect it */ 324/* query the last known CPU freq (in kHz). If zero, cpufreq couldn't detect it */
325#ifdef CONFIG_CPU_FREQ 325#ifdef CONFIG_CPU_FREQ
326unsigned int cpufreq_quick_get(unsigned int cpu); 326unsigned int cpufreq_quick_get(unsigned int cpu);
327unsigned int cpufreq_quick_get_max(unsigned int cpu);
327#else 328#else
328static inline unsigned int cpufreq_quick_get(unsigned int cpu) 329static inline unsigned int cpufreq_quick_get(unsigned int cpu)
329{ 330{
330 return 0; 331 return 0;
331} 332}
333static inline unsigned int cpufreq_quick_get_max(unsigned int cpu)
334{
335 return 0;
336}
332#endif 337#endif
333 338
334 339
@@ -358,6 +363,9 @@ extern struct cpufreq_governor cpufreq_gov_ondemand;
358#elif defined(CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE) 363#elif defined(CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE)
359extern struct cpufreq_governor cpufreq_gov_conservative; 364extern struct cpufreq_governor cpufreq_gov_conservative;
360#define CPUFREQ_DEFAULT_GOVERNOR (&cpufreq_gov_conservative) 365#define CPUFREQ_DEFAULT_GOVERNOR (&cpufreq_gov_conservative)
366#elif defined(CONFIG_CPU_FREQ_DEFAULT_GOV_INTERACTIVE)
367extern struct cpufreq_governor cpufreq_gov_interactive;
368#define CPUFREQ_DEFAULT_GOVERNOR (&cpufreq_gov_interactive)
361#endif 369#endif
362 370
363 371
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
index 36719ead50e..b51629e15cf 100644
--- a/include/linux/cpuidle.h
+++ b/include/linux/cpuidle.h
@@ -122,6 +122,8 @@ struct cpuidle_driver {
122}; 122};
123 123
124#ifdef CONFIG_CPU_IDLE 124#ifdef CONFIG_CPU_IDLE
125extern void disable_cpuidle(void);
126extern int cpuidle_idle_call(void);
125 127
126extern int cpuidle_register_driver(struct cpuidle_driver *drv); 128extern int cpuidle_register_driver(struct cpuidle_driver *drv);
127struct cpuidle_driver *cpuidle_get_driver(void); 129struct cpuidle_driver *cpuidle_get_driver(void);
@@ -135,6 +137,8 @@ extern int cpuidle_enable_device(struct cpuidle_device *dev);
135extern void cpuidle_disable_device(struct cpuidle_device *dev); 137extern void cpuidle_disable_device(struct cpuidle_device *dev);
136 138
137#else 139#else
140static inline void disable_cpuidle(void) { }
141static inline int cpuidle_idle_call(void) { return -ENODEV; }
138 142
139static inline int cpuidle_register_driver(struct cpuidle_driver *drv) 143static inline int cpuidle_register_driver(struct cpuidle_driver *drv)
140{return -ENODEV; } 144{return -ENODEV; }
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
index b24ac56477b..4f7a6323747 100644
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@ -617,6 +617,20 @@ static inline size_t cpumask_size(void)
617 * ... use 'tmpmask' like a normal struct cpumask * ... 617 * ... use 'tmpmask' like a normal struct cpumask * ...
618 * 618 *
619 * free_cpumask_var(tmpmask); 619 * free_cpumask_var(tmpmask);
620 *
621 *
622 * However, one notable exception is there. alloc_cpumask_var() allocates
623 * only nr_cpumask_bits bits (in the other hand, real cpumask_t always has
624 * NR_CPUS bits). Therefore you don't have to dereference cpumask_var_t.
625 *
626 * cpumask_var_t tmpmask;
627 * if (!alloc_cpumask_var(&tmpmask, GFP_KERNEL))
628 * return -ENOMEM;
629 *
630 * var = *tmpmask;
631 *
632 * This code makes NR_CPUS length memcopy and brings to a memory corruption.
633 * cpumask_copy() provide safe copy functionality.
620 */ 634 */
621#ifdef CONFIG_CPUMASK_OFFSTACK 635#ifdef CONFIG_CPUMASK_OFFSTACK
622typedef struct cpumask *cpumask_var_t; 636typedef struct cpumask *cpumask_var_t;
diff --git a/include/linux/crc8.h b/include/linux/crc8.h
new file mode 100644
index 00000000000..13c8dabb044
--- /dev/null
+++ b/include/linux/crc8.h
@@ -0,0 +1,101 @@
1/*
2 * Copyright (c) 2011 Broadcom Corporation
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
11 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
13 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16#ifndef __CRC8_H_
17#define __CRC8_H_
18
19#include <linux/types.h>
20
21/* see usage of this value in crc8() description */
22#define CRC8_INIT_VALUE 0xFF
23
24/*
25 * Return value of crc8() indicating valid message+crc. This is true
26 * if a CRC is inverted before transmission. The CRC computed over the
27 * whole received bitstream is _table[x], where x is the bit pattern
28 * of the modification (almost always 0xff).
29 */
30#define CRC8_GOOD_VALUE(_table) (_table[0xFF])
31
32/* required table size for crc8 algorithm */
33#define CRC8_TABLE_SIZE 256
34
35/* helper macro assuring right table size is used */
36#define DECLARE_CRC8_TABLE(_table) \
37 static u8 _table[CRC8_TABLE_SIZE]
38
39/**
40 * crc8_populate_lsb - fill crc table for given polynomial in regular bit order.
41 *
42 * @table: table to be filled.
43 * @polynomial: polynomial for which table is to be filled.
44 *
45 * This function fills the provided table according the polynomial provided for
46 * regular bit order (lsb first). Polynomials in CRC algorithms are typically
47 * represented as shown below.
48 *
49 * poly = x^8 + x^7 + x^6 + x^4 + x^2 + 1
50 *
51 * For lsb first direction x^7 maps to the lsb. So the polynomial is as below.
52 *
53 * - lsb first: poly = 10101011(1) = 0xAB
54 */
55void crc8_populate_lsb(u8 table[CRC8_TABLE_SIZE], u8 polynomial);
56
57/**
58 * crc8_populate_msb - fill crc table for given polynomial in reverse bit order.
59 *
60 * @table: table to be filled.
61 * @polynomial: polynomial for which table is to be filled.
62 *
63 * This function fills the provided table according the polynomial provided for
64 * reverse bit order (msb first). Polynomials in CRC algorithms are typically
65 * represented as shown below.
66 *
67 * poly = x^8 + x^7 + x^6 + x^4 + x^2 + 1
68 *
69 * For msb first direction x^7 maps to the msb. So the polynomial is as below.
70 *
71 * - msb first: poly = (1)11010101 = 0xD5
72 */
73void crc8_populate_msb(u8 table[CRC8_TABLE_SIZE], u8 polynomial);
74
75/**
76 * crc8() - calculate a crc8 over the given input data.
77 *
78 * @table: crc table used for calculation.
79 * @pdata: pointer to data buffer.
80 * @nbytes: number of bytes in data buffer.
81 * @crc: previous returned crc8 value.
82 *
83 * The CRC8 is calculated using the polynomial given in crc8_populate_msb()
84 * or crc8_populate_lsb().
85 *
86 * The caller provides the initial value (either %CRC8_INIT_VALUE
87 * or the previous returned value) to allow for processing of
88 * discontiguous blocks of data. When generating the CRC the
89 * caller is responsible for complementing the final return value
90 * and inserting it into the byte stream. When validating a byte
91 * stream (including CRC8), a final return value of %CRC8_GOOD_VALUE
92 * indicates the byte stream data can be considered valid.
93 *
94 * Reference:
95 * "A Painless Guide to CRC Error Detection Algorithms", ver 3, Aug 1993
96 * Williams, Ross N., ross<at>ross.net
97 * (see URL http://www.ross.net/crc/download/crc_v3.txt).
98 */
99u8 crc8(const u8 table[CRC8_TABLE_SIZE], u8 *pdata, size_t nbytes, u8 crc);
100
101#endif /* __CRC8_H_ */
diff --git a/include/linux/cred.h b/include/linux/cred.h
index 82607992f30..40308969ed0 100644
--- a/include/linux/cred.h
+++ b/include/linux/cred.h
@@ -16,7 +16,7 @@
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/key.h> 17#include <linux/key.h>
18#include <linux/selinux.h> 18#include <linux/selinux.h>
19#include <asm/atomic.h> 19#include <linux/atomic.h>
20 20
21struct user_struct; 21struct user_struct;
22struct cred; 22struct cred;
@@ -265,10 +265,11 @@ static inline void put_cred(const struct cred *_cred)
265/** 265/**
266 * current_cred - Access the current task's subjective credentials 266 * current_cred - Access the current task's subjective credentials
267 * 267 *
268 * Access the subjective credentials of the current task. 268 * Access the subjective credentials of the current task. RCU-safe,
269 * since nobody else can modify it.
269 */ 270 */
270#define current_cred() \ 271#define current_cred() \
271 (current->cred) 272 rcu_dereference_protected(current->cred, 1)
272 273
273/** 274/**
274 * __task_cred - Access a task's objective credentials 275 * __task_cred - Access a task's objective credentials
@@ -284,7 +285,6 @@ static inline void put_cred(const struct cred *_cred)
284 ({ \ 285 ({ \
285 const struct task_struct *__t = (task); \ 286 const struct task_struct *__t = (task); \
286 rcu_dereference_check(__t->real_cred, \ 287 rcu_dereference_check(__t->real_cred, \
287 rcu_read_lock_held() || \
288 task_is_dead(__t)); \ 288 task_is_dead(__t)); \
289 }) 289 })
290 290
@@ -307,8 +307,8 @@ static inline void put_cred(const struct cred *_cred)
307#define get_current_user() \ 307#define get_current_user() \
308({ \ 308({ \
309 struct user_struct *__u; \ 309 struct user_struct *__u; \
310 struct cred *__cred; \ 310 const struct cred *__cred; \
311 __cred = (struct cred *) current_cred(); \ 311 __cred = current_cred(); \
312 __u = get_uid(__cred->user); \ 312 __u = get_uid(__cred->user); \
313 __u; \ 313 __u; \
314}) 314})
@@ -322,8 +322,8 @@ static inline void put_cred(const struct cred *_cred)
322#define get_current_groups() \ 322#define get_current_groups() \
323({ \ 323({ \
324 struct group_info *__groups; \ 324 struct group_info *__groups; \
325 struct cred *__cred; \ 325 const struct cred *__cred; \
326 __cred = (struct cred *) current_cred(); \ 326 __cred = current_cred(); \
327 __groups = get_group_info(__cred->group_info); \ 327 __groups = get_group_info(__cred->group_info); \
328 __groups; \ 328 __groups; \
329}) 329})
@@ -342,7 +342,7 @@ static inline void put_cred(const struct cred *_cred)
342 342
343#define current_cred_xxx(xxx) \ 343#define current_cred_xxx(xxx) \
344({ \ 344({ \
345 current->cred->xxx; \ 345 current_cred()->xxx; \
346}) 346})
347 347
348#define current_uid() (current_cred_xxx(uid)) 348#define current_uid() (current_cred_xxx(uid))
diff --git a/include/linux/crypto.h b/include/linux/crypto.h
index a6a7a1c83f5..e5e468e9133 100644
--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -17,7 +17,7 @@
17#ifndef _LINUX_CRYPTO_H 17#ifndef _LINUX_CRYPTO_H
18#define _LINUX_CRYPTO_H 18#define _LINUX_CRYPTO_H
19 19
20#include <asm/atomic.h> 20#include <linux/atomic.h>
21#include <linux/module.h> 21#include <linux/module.h>
22#include <linux/kernel.h> 22#include <linux/kernel.h>
23#include <linux/list.h> 23#include <linux/list.h>
diff --git a/include/linux/cryptohash.h b/include/linux/cryptohash.h
index ec78a4bbe1d..2cd9f1cf9fa 100644
--- a/include/linux/cryptohash.h
+++ b/include/linux/cryptohash.h
@@ -3,11 +3,16 @@
3 3
4#define SHA_DIGEST_WORDS 5 4#define SHA_DIGEST_WORDS 5
5#define SHA_MESSAGE_BYTES (512 /*bits*/ / 8) 5#define SHA_MESSAGE_BYTES (512 /*bits*/ / 8)
6#define SHA_WORKSPACE_WORDS 80 6#define SHA_WORKSPACE_WORDS 16
7 7
8void sha_init(__u32 *buf); 8void sha_init(__u32 *buf);
9void sha_transform(__u32 *digest, const char *data, __u32 *W); 9void sha_transform(__u32 *digest, const char *data, __u32 *W);
10 10
11#define MD5_DIGEST_WORDS 4
12#define MD5_MESSAGE_BYTES 64
13
14void md5_transform(__u32 *hash, __u32 const *in);
15
11__u32 half_md4_transform(__u32 buf[4], __u32 const in[8]); 16__u32 half_md4_transform(__u32 buf[4], __u32 const in[8]);
12 17
13#endif 18#endif
diff --git a/include/linux/cs5535.h b/include/linux/cs5535.h
index 6fe2114f8ad..c077aec3a6f 100644
--- a/include/linux/cs5535.h
+++ b/include/linux/cs5535.h
@@ -11,6 +11,8 @@
11#ifndef _CS5535_H 11#ifndef _CS5535_H
12#define _CS5535_H 12#define _CS5535_H
13 13
14#include <asm/msr.h>
15
14/* MSRs */ 16/* MSRs */
15#define MSR_GLIU_P2D_RO0 0x10000029 17#define MSR_GLIU_P2D_RO0 0x10000029
16 18
@@ -38,17 +40,75 @@
38#define MSR_MFGPT_NR 0x51400029 40#define MSR_MFGPT_NR 0x51400029
39#define MSR_MFGPT_SETUP 0x5140002B 41#define MSR_MFGPT_SETUP 0x5140002B
40 42
43#define MSR_RTC_DOMA_OFFSET 0x51400055
44#define MSR_RTC_MONA_OFFSET 0x51400056
45#define MSR_RTC_CEN_OFFSET 0x51400057
46
41#define MSR_LX_SPARE_MSR 0x80000011 /* DC-specific */ 47#define MSR_LX_SPARE_MSR 0x80000011 /* DC-specific */
42 48
43#define MSR_GX_GLD_MSR_CONFIG 0xC0002001 49#define MSR_GX_GLD_MSR_CONFIG 0xC0002001
44#define MSR_GX_MSR_PADSEL 0xC0002011 50#define MSR_GX_MSR_PADSEL 0xC0002011
45 51
52static inline int cs5535_pic_unreqz_select_high(unsigned int group,
53 unsigned int irq)
54{
55 uint32_t lo, hi;
56
57 rdmsr(MSR_PIC_ZSEL_HIGH, lo, hi);
58 lo &= ~(0xF << (group * 4));
59 lo |= (irq & 0xF) << (group * 4);
60 wrmsr(MSR_PIC_ZSEL_HIGH, lo, hi);
61 return 0;
62}
63
64/* PIC registers */
65#define CS5536_PIC_INT_SEL1 0x4d0
66#define CS5536_PIC_INT_SEL2 0x4d1
67
46/* resource sizes */ 68/* resource sizes */
47#define LBAR_GPIO_SIZE 0xFF 69#define LBAR_GPIO_SIZE 0xFF
48#define LBAR_MFGPT_SIZE 0x40 70#define LBAR_MFGPT_SIZE 0x40
49#define LBAR_ACPI_SIZE 0x40 71#define LBAR_ACPI_SIZE 0x40
50#define LBAR_PMS_SIZE 0x80 72#define LBAR_PMS_SIZE 0x80
51 73
74/*
75 * PMC registers (PMS block)
76 * It is only safe to access these registers as dword accesses.
77 * See CS5536 Specification Update erratas 17 & 18
78 */
79#define CS5536_PM_SCLK 0x10
80#define CS5536_PM_IN_SLPCTL 0x20
81#define CS5536_PM_WKXD 0x34
82#define CS5536_PM_WKD 0x30
83#define CS5536_PM_SSC 0x54
84
85/*
86 * PM registers (ACPI block)
87 * It is only safe to access these registers as dword accesses.
88 * See CS5536 Specification Update erratas 17 & 18
89 */
90#define CS5536_PM1_STS 0x00
91#define CS5536_PM1_EN 0x02
92#define CS5536_PM1_CNT 0x08
93#define CS5536_PM_GPE0_STS 0x18
94#define CS5536_PM_GPE0_EN 0x1c
95
96/* CS5536_PM1_STS bits */
97#define CS5536_WAK_FLAG (1 << 15)
98#define CS5536_PWRBTN_FLAG (1 << 8)
99
100/* CS5536_PM1_EN bits */
101#define CS5536_PM_PWRBTN (1 << 8)
102#define CS5536_PM_RTC (1 << 10)
103
104/* CS5536_PM_GPE0_STS bits */
105#define CS5536_GPIOM7_PME_FLAG (1 << 31)
106#define CS5536_GPIOM6_PME_FLAG (1 << 30)
107
108/* CS5536_PM_GPE0_EN bits */
109#define CS5536_GPIOM7_PME_EN (1 << 31)
110#define CS5536_GPIOM6_PME_EN (1 << 30)
111
52/* VSA2 magic values */ 112/* VSA2 magic values */
53#define VSA_VRC_INDEX 0xAC1C 113#define VSA_VRC_INDEX 0xAC1C
54#define VSA_VRC_DATA 0xAC1E 114#define VSA_VRC_DATA 0xAC1E
diff --git a/include/linux/ctype.h b/include/linux/ctype.h
index a3d6ee0044f..8acfe312f94 100644
--- a/include/linux/ctype.h
+++ b/include/linux/ctype.h
@@ -52,4 +52,13 @@ static inline unsigned char __toupper(unsigned char c)
52#define tolower(c) __tolower(c) 52#define tolower(c) __tolower(c)
53#define toupper(c) __toupper(c) 53#define toupper(c) __toupper(c)
54 54
55/*
56 * Fast implementation of tolower() for internal usage. Do not use in your
57 * code.
58 */
59static inline char _tolower(const char c)
60{
61 return c | 0x20;
62}
63
55#endif 64#endif
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index 19d90a55541..713c7c62443 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -1,7 +1,7 @@
1#ifndef __LINUX_DCACHE_H 1#ifndef __LINUX_DCACHE_H
2#define __LINUX_DCACHE_H 2#define __LINUX_DCACHE_H
3 3
4#include <asm/atomic.h> 4#include <linux/atomic.h>
5#include <linux/list.h> 5#include <linux/list.h>
6#include <linux/rculist.h> 6#include <linux/rculist.h>
7#include <linux/rculist_bl.h> 7#include <linux/rculist_bl.h>
@@ -180,12 +180,12 @@ struct dentry_operations {
180 */ 180 */
181 181
182/* d_flags entries */ 182/* d_flags entries */
183#define DCACHE_AUTOFS_PENDING 0x0001 /* autofs: "under construction" */ 183#define DCACHE_OP_HASH 0x0001
184#define DCACHE_NFSFS_RENAMED 0x0002 184#define DCACHE_OP_COMPARE 0x0002
185 /* this dentry has been "silly renamed" and has to be deleted on the last 185#define DCACHE_OP_REVALIDATE 0x0004
186 * dput() */ 186#define DCACHE_OP_DELETE 0x0008
187 187
188#define DCACHE_DISCONNECTED 0x0004 188#define DCACHE_DISCONNECTED 0x0010
189 /* This dentry is possibly not currently connected to the dcache tree, in 189 /* This dentry is possibly not currently connected to the dcache tree, in
190 * which case its parent will either be itself, or will have this flag as 190 * which case its parent will either be itself, or will have this flag as
191 * well. nfsd will not use a dentry with this bit set, but will first 191 * well. nfsd will not use a dentry with this bit set, but will first
@@ -196,26 +196,23 @@ struct dentry_operations {
196 * dentry into place and return that dentry rather than the passed one, 196 * dentry into place and return that dentry rather than the passed one,
197 * typically using d_splice_alias. */ 197 * typically using d_splice_alias. */
198 198
199#define DCACHE_REFERENCED 0x0008 /* Recently used, don't discard. */ 199#define DCACHE_REFERENCED 0x0020 /* Recently used, don't discard. */
200#define DCACHE_RCUACCESS 0x0010 /* Entry has ever been RCU-visible */ 200#define DCACHE_RCUACCESS 0x0040 /* Entry has ever been RCU-visible */
201#define DCACHE_INOTIFY_PARENT_WATCHED 0x0020
202 /* Parent inode is watched by inotify */
203
204#define DCACHE_COOKIE 0x0040 /* For use by dcookie subsystem */
205#define DCACHE_FSNOTIFY_PARENT_WATCHED 0x0080
206 /* Parent inode is watched by some fsnotify listener */
207 201
208#define DCACHE_CANT_MOUNT 0x0100 202#define DCACHE_CANT_MOUNT 0x0100
209#define DCACHE_GENOCIDE 0x0200 203#define DCACHE_GENOCIDE 0x0200
210 204
211#define DCACHE_OP_HASH 0x1000 205#define DCACHE_NFSFS_RENAMED 0x1000
212#define DCACHE_OP_COMPARE 0x2000 206 /* this dentry has been "silly renamed" and has to be deleted on the last
213#define DCACHE_OP_REVALIDATE 0x4000 207 * dput() */
214#define DCACHE_OP_DELETE 0x8000 208#define DCACHE_COOKIE 0x2000 /* For use by dcookie subsystem */
209#define DCACHE_FSNOTIFY_PARENT_WATCHED 0x4000
210 /* Parent inode is watched by some fsnotify listener */
215 211
216#define DCACHE_MOUNTED 0x10000 /* is a mountpoint */ 212#define DCACHE_MOUNTED 0x10000 /* is a mountpoint */
217#define DCACHE_NEED_AUTOMOUNT 0x20000 /* handle automount on this dir */ 213#define DCACHE_NEED_AUTOMOUNT 0x20000 /* handle automount on this dir */
218#define DCACHE_MANAGE_TRANSIT 0x40000 /* manage transit from this dirent */ 214#define DCACHE_MANAGE_TRANSIT 0x40000 /* manage transit from this dirent */
215#define DCACHE_NEED_LOOKUP 0x80000 /* dentry requires i_op->lookup */
219#define DCACHE_MANAGED_DENTRY \ 216#define DCACHE_MANAGED_DENTRY \
220 (DCACHE_MOUNTED|DCACHE_NEED_AUTOMOUNT|DCACHE_MANAGE_TRANSIT) 217 (DCACHE_MOUNTED|DCACHE_NEED_AUTOMOUNT|DCACHE_MANAGE_TRANSIT)
221 218
@@ -340,7 +337,8 @@ extern int d_validate(struct dentry *, struct dentry *);
340 */ 337 */
341extern char *dynamic_dname(struct dentry *, char *, int, const char *, ...); 338extern char *dynamic_dname(struct dentry *, char *, int, const char *, ...);
342 339
343extern char *__d_path(const struct path *path, struct path *root, char *, int); 340extern char *__d_path(const struct path *, const struct path *, char *, int);
341extern char *d_absolute_path(const struct path *, char *, int);
344extern char *d_path(const struct path *, char *, int); 342extern char *d_path(const struct path *, char *, int);
345extern char *d_path_with_unreachable(const struct path *, char *, int); 343extern char *d_path_with_unreachable(const struct path *, char *, int);
346extern char *dentry_path_raw(struct dentry *, char *, int); 344extern char *dentry_path_raw(struct dentry *, char *, int);
@@ -416,7 +414,12 @@ static inline bool d_mountpoint(struct dentry *dentry)
416 return dentry->d_flags & DCACHE_MOUNTED; 414 return dentry->d_flags & DCACHE_MOUNTED;
417} 415}
418 416
419extern struct dentry *lookup_create(struct nameidata *nd, int is_dir); 417static inline bool d_need_lookup(struct dentry *dentry)
418{
419 return dentry->d_flags & DCACHE_NEED_LOOKUP;
420}
421
422extern void d_clear_need_lookup(struct dentry *dentry);
420 423
421extern int sysctl_vfs_cache_pressure; 424extern int sysctl_vfs_cache_pressure;
422 425
diff --git a/include/linux/dcbnl.h b/include/linux/dcbnl.h
index c52280047e2..65a2562f66b 100644
--- a/include/linux/dcbnl.h
+++ b/include/linux/dcbnl.h
@@ -203,6 +203,7 @@ struct dcbmsg {
203 * @DCB_CMD_GFEATCFG: get DCBX features flags 203 * @DCB_CMD_GFEATCFG: get DCBX features flags
204 * @DCB_CMD_SFEATCFG: set DCBX features negotiation flags 204 * @DCB_CMD_SFEATCFG: set DCBX features negotiation flags
205 * @DCB_CMD_CEE_GET: get CEE aggregated configuration 205 * @DCB_CMD_CEE_GET: get CEE aggregated configuration
206 * @DCB_CMD_IEEE_DEL: delete IEEE 802.1Qaz configuration
206 */ 207 */
207enum dcbnl_commands { 208enum dcbnl_commands {
208 DCB_CMD_UNDEFINED, 209 DCB_CMD_UNDEFINED,
@@ -246,6 +247,7 @@ enum dcbnl_commands {
246 DCB_CMD_SFEATCFG, 247 DCB_CMD_SFEATCFG,
247 248
248 DCB_CMD_CEE_GET, 249 DCB_CMD_CEE_GET,
250 DCB_CMD_IEEE_DEL,
249 251
250 __DCB_CMD_ENUM_MAX, 252 __DCB_CMD_ENUM_MAX,
251 DCB_CMD_MAX = __DCB_CMD_ENUM_MAX - 1, 253 DCB_CMD_MAX = __DCB_CMD_ENUM_MAX - 1,
@@ -331,18 +333,30 @@ enum ieee_attrs_app {
331#define DCB_ATTR_IEEE_APP_MAX (__DCB_ATTR_IEEE_APP_MAX - 1) 333#define DCB_ATTR_IEEE_APP_MAX (__DCB_ATTR_IEEE_APP_MAX - 1)
332 334
333/** 335/**
334 * enum cee_attrs - CEE DCBX get attributes 336 * enum cee_attrs - CEE DCBX get attributes.
335 * 337 *
336 * @DCB_ATTR_CEE_UNSPEC: unspecified 338 * @DCB_ATTR_CEE_UNSPEC: unspecified
337 * @DCB_ATTR_CEE_PEER_PG: peer PG configuration - get only 339 * @DCB_ATTR_CEE_PEER_PG: peer PG configuration - get only
338 * @DCB_ATTR_CEE_PEER_PFC: peer PFC configuration - get only 340 * @DCB_ATTR_CEE_PEER_PFC: peer PFC configuration - get only
339 * @DCB_ATTR_CEE_PEER_APP: peer APP tlv - get only 341 * @DCB_ATTR_CEE_PEER_APP_TABLE: peer APP tlv - get only
342 * @DCB_ATTR_CEE_TX_PG: TX PG configuration (DCB_CMD_PGTX_GCFG)
343 * @DCB_ATTR_CEE_RX_PG: RX PG configuration (DCB_CMD_PGRX_GCFG)
344 * @DCB_ATTR_CEE_PFC: PFC configuration (DCB_CMD_PFC_GCFG)
345 * @DCB_ATTR_CEE_APP_TABLE: APP configuration (multi DCB_CMD_GAPP)
346 * @DCB_ATTR_CEE_FEAT: DCBX features flags (DCB_CMD_GFEATCFG)
347 *
348 * An aggregated collection of the cee std negotiated parameters.
340 */ 349 */
341enum cee_attrs { 350enum cee_attrs {
342 DCB_ATTR_CEE_UNSPEC, 351 DCB_ATTR_CEE_UNSPEC,
343 DCB_ATTR_CEE_PEER_PG, 352 DCB_ATTR_CEE_PEER_PG,
344 DCB_ATTR_CEE_PEER_PFC, 353 DCB_ATTR_CEE_PEER_PFC,
345 DCB_ATTR_CEE_PEER_APP_TABLE, 354 DCB_ATTR_CEE_PEER_APP_TABLE,
355 DCB_ATTR_CEE_TX_PG,
356 DCB_ATTR_CEE_RX_PG,
357 DCB_ATTR_CEE_PFC,
358 DCB_ATTR_CEE_APP_TABLE,
359 DCB_ATTR_CEE_FEAT,
346 __DCB_ATTR_CEE_MAX 360 __DCB_ATTR_CEE_MAX
347}; 361};
348#define DCB_ATTR_CEE_MAX (__DCB_ATTR_CEE_MAX - 1) 362#define DCB_ATTR_CEE_MAX (__DCB_ATTR_CEE_MAX - 1)
@@ -355,6 +369,13 @@ enum peer_app_attr {
355}; 369};
356#define DCB_ATTR_CEE_PEER_APP_MAX (__DCB_ATTR_CEE_PEER_APP_MAX - 1) 370#define DCB_ATTR_CEE_PEER_APP_MAX (__DCB_ATTR_CEE_PEER_APP_MAX - 1)
357 371
372enum cee_attrs_app {
373 DCB_ATTR_CEE_APP_UNSPEC,
374 DCB_ATTR_CEE_APP,
375 __DCB_ATTR_CEE_APP_MAX
376};
377#define DCB_ATTR_CEE_APP_MAX (__DCB_ATTR_CEE_APP_MAX - 1)
378
358/** 379/**
359 * enum dcbnl_pfc_attrs - DCB Priority Flow Control user priority nested attrs 380 * enum dcbnl_pfc_attrs - DCB Priority Flow Control user priority nested attrs
360 * 381 *
diff --git a/include/linux/dccp.h b/include/linux/dccp.h
index d638e85dc50..710c04302a1 100644
--- a/include/linux/dccp.h
+++ b/include/linux/dccp.h
@@ -236,6 +236,7 @@ enum dccp_packet_dequeueing_policy {
236#ifdef __KERNEL__ 236#ifdef __KERNEL__
237 237
238#include <linux/in.h> 238#include <linux/in.h>
239#include <linux/interrupt.h>
239#include <linux/ktime.h> 240#include <linux/ktime.h>
240#include <linux/list.h> 241#include <linux/list.h>
241#include <linux/uio.h> 242#include <linux/uio.h>
diff --git a/include/linux/debug_locks.h b/include/linux/debug_locks.h
index 2833452ea01..5033fb88c10 100644
--- a/include/linux/debug_locks.h
+++ b/include/linux/debug_locks.h
@@ -2,7 +2,7 @@
2#define __LINUX_DEBUG_LOCKING_H 2#define __LINUX_DEBUG_LOCKING_H
3 3
4#include <linux/kernel.h> 4#include <linux/kernel.h>
5#include <asm/atomic.h> 5#include <linux/atomic.h>
6#include <asm/system.h> 6#include <asm/system.h>
7 7
8struct task_struct; 8struct task_struct;
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h
index 4427e045405..99e3e50b5c5 100644
--- a/include/linux/device-mapper.h
+++ b/include/linux/device-mapper.h
@@ -197,6 +197,11 @@ struct dm_target {
197 * whether or not its underlying devices have support. 197 * whether or not its underlying devices have support.
198 */ 198 */
199 unsigned discards_supported:1; 199 unsigned discards_supported:1;
200
201 /*
202 * Set if this target does not return zeroes on discarded blocks.
203 */
204 unsigned discard_zeroes_data_unsupported:1;
200}; 205};
201 206
202/* Each target can link one of these into the table */ 207/* Each target can link one of these into the table */
@@ -208,6 +213,49 @@ struct dm_target_callbacks {
208int dm_register_target(struct target_type *t); 213int dm_register_target(struct target_type *t);
209void dm_unregister_target(struct target_type *t); 214void dm_unregister_target(struct target_type *t);
210 215
216/*
217 * Target argument parsing.
218 */
219struct dm_arg_set {
220 unsigned argc;
221 char **argv;
222};
223
224/*
225 * The minimum and maximum value of a numeric argument, together with
226 * the error message to use if the number is found to be outside that range.
227 */
228struct dm_arg {
229 unsigned min;
230 unsigned max;
231 char *error;
232};
233
234/*
235 * Validate the next argument, either returning it as *value or, if invalid,
236 * returning -EINVAL and setting *error.
237 */
238int dm_read_arg(struct dm_arg *arg, struct dm_arg_set *arg_set,
239 unsigned *value, char **error);
240
241/*
242 * Process the next argument as the start of a group containing between
243 * arg->min and arg->max further arguments. Either return the size as
244 * *num_args or, if invalid, return -EINVAL and set *error.
245 */
246int dm_read_arg_group(struct dm_arg *arg, struct dm_arg_set *arg_set,
247 unsigned *num_args, char **error);
248
249/*
250 * Return the current argument and shift to the next.
251 */
252const char *dm_shift_arg(struct dm_arg_set *as);
253
254/*
255 * Move through num_args arguments.
256 */
257void dm_consume_args(struct dm_arg_set *as, unsigned num_args);
258
211/*----------------------------------------------------------------- 259/*-----------------------------------------------------------------
212 * Functions for creating and manipulating mapped devices. 260 * Functions for creating and manipulating mapped devices.
213 * Drop the reference with dm_put when you finish with the object. 261 * Drop the reference with dm_put when you finish with the object.
diff --git a/include/linux/device.h b/include/linux/device.h
index e4f62d8896b..e838e143baa 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -22,7 +22,7 @@
22#include <linux/types.h> 22#include <linux/types.h>
23#include <linux/module.h> 23#include <linux/module.h>
24#include <linux/pm.h> 24#include <linux/pm.h>
25#include <asm/atomic.h> 25#include <linux/atomic.h>
26#include <asm/device.h> 26#include <asm/device.h>
27 27
28struct device; 28struct device;
@@ -33,6 +33,7 @@ struct class;
33struct subsys_private; 33struct subsys_private;
34struct bus_type; 34struct bus_type;
35struct device_node; 35struct device_node;
36struct iommu_ops;
36 37
37struct bus_attribute { 38struct bus_attribute {
38 struct attribute attr; 39 struct attribute attr;
@@ -67,6 +68,9 @@ extern void bus_remove_file(struct bus_type *, struct bus_attribute *);
67 * @resume: Called to bring a device on this bus out of sleep mode. 68 * @resume: Called to bring a device on this bus out of sleep mode.
68 * @pm: Power management operations of this bus, callback the specific 69 * @pm: Power management operations of this bus, callback the specific
69 * device driver's pm-ops. 70 * device driver's pm-ops.
71 * @iommu_ops IOMMU specific operations for this bus, used to attach IOMMU
72 * driver implementations to a bus and allow the driver to do
73 * bus-specific setup
70 * @p: The private data of the driver core, only the driver core can 74 * @p: The private data of the driver core, only the driver core can
71 * touch this. 75 * touch this.
72 * 76 *
@@ -96,6 +100,8 @@ struct bus_type {
96 100
97 const struct dev_pm_ops *pm; 101 const struct dev_pm_ops *pm;
98 102
103 struct iommu_ops *iommu_ops;
104
99 struct subsys_private *p; 105 struct subsys_private *p;
100}; 106};
101 107
@@ -516,7 +522,7 @@ struct device_dma_parameters {
516 * minimizes board-specific #ifdefs in drivers. 522 * minimizes board-specific #ifdefs in drivers.
517 * @power: For device power management. 523 * @power: For device power management.
518 * See Documentation/power/devices.txt for details. 524 * See Documentation/power/devices.txt for details.
519 * @pwr_domain: Provide callbacks that are executed during system suspend, 525 * @pm_domain: Provide callbacks that are executed during system suspend,
520 * hibernation, system resume and during runtime PM transitions 526 * hibernation, system resume and during runtime PM transitions
521 * along with subsystem-level and driver-level callbacks. 527 * along with subsystem-level and driver-level callbacks.
522 * @numa_node: NUMA node this device is close to. 528 * @numa_node: NUMA node this device is close to.
@@ -567,7 +573,7 @@ struct device {
567 void *platform_data; /* Platform specific data, device 573 void *platform_data; /* Platform specific data, device
568 core doesn't touch it */ 574 core doesn't touch it */
569 struct dev_pm_info power; 575 struct dev_pm_info power;
570 struct dev_power_domain *pwr_domain; 576 struct dev_pm_domain *pm_domain;
571 577
572#ifdef CONFIG_NUMA 578#ifdef CONFIG_NUMA
573 int numa_node; /* NUMA node this device is close to */ 579 int numa_node; /* NUMA node this device is close to */
diff --git a/include/linux/dio.h b/include/linux/dio.h
index b2dd31ca171..2cc0fd00463 100644
--- a/include/linux/dio.h
+++ b/include/linux/dio.h
@@ -254,7 +254,7 @@ static inline struct dio_driver *dio_dev_driver(const struct dio_dev *d)
254 254
255#define dio_resource_start(d) ((d)->resource.start) 255#define dio_resource_start(d) ((d)->resource.start)
256#define dio_resource_end(d) ((d)->resource.end) 256#define dio_resource_end(d) ((d)->resource.end)
257#define dio_resource_len(d) ((d)->resource.end-(d)->resource.start+1) 257#define dio_resource_len(d) (resource_size(&(d)->resource))
258#define dio_resource_flags(d) ((d)->resource.flags) 258#define dio_resource_flags(d) ((d)->resource.flags)
259 259
260#define dio_request_device(d, name) \ 260#define dio_request_device(d, name) \
diff --git a/include/linux/dm-ioctl.h b/include/linux/dm-ioctl.h
index 3708455ee6c..0cb8eff76bd 100644
--- a/include/linux/dm-ioctl.h
+++ b/include/linux/dm-ioctl.h
@@ -267,9 +267,9 @@ enum {
267#define DM_DEV_SET_GEOMETRY _IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, struct dm_ioctl) 267#define DM_DEV_SET_GEOMETRY _IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, struct dm_ioctl)
268 268
269#define DM_VERSION_MAJOR 4 269#define DM_VERSION_MAJOR 4
270#define DM_VERSION_MINOR 20 270#define DM_VERSION_MINOR 21
271#define DM_VERSION_PATCHLEVEL 0 271#define DM_VERSION_PATCHLEVEL 0
272#define DM_VERSION_EXTRA "-ioctl (2011-02-02)" 272#define DM_VERSION_EXTRA "-ioctl (2011-07-06)"
273 273
274/* Status bits */ 274/* Status bits */
275#define DM_READONLY_FLAG (1 << 0) /* In/Out */ 275#define DM_READONLY_FLAG (1 << 0) /* In/Out */
diff --git a/include/linux/dm-kcopyd.h b/include/linux/dm-kcopyd.h
index 298d587e349..5e54458e920 100644
--- a/include/linux/dm-kcopyd.h
+++ b/include/linux/dm-kcopyd.h
@@ -42,5 +42,20 @@ int dm_kcopyd_copy(struct dm_kcopyd_client *kc, struct dm_io_region *from,
42 unsigned num_dests, struct dm_io_region *dests, 42 unsigned num_dests, struct dm_io_region *dests,
43 unsigned flags, dm_kcopyd_notify_fn fn, void *context); 43 unsigned flags, dm_kcopyd_notify_fn fn, void *context);
44 44
45/*
46 * Prepare a callback and submit it via the kcopyd thread.
47 *
48 * dm_kcopyd_prepare_callback allocates a callback structure and returns it.
49 * It must not be called from interrupt context.
50 * The returned value should be passed into dm_kcopyd_do_callback.
51 *
52 * dm_kcopyd_do_callback submits the callback.
53 * It may be called from interrupt context.
54 * The callback is issued from the kcopyd thread.
55 */
56void *dm_kcopyd_prepare_callback(struct dm_kcopyd_client *kc,
57 dm_kcopyd_notify_fn fn, void *context);
58void dm_kcopyd_do_callback(void *job, int read_err, unsigned long write_err);
59
45#endif /* __KERNEL__ */ 60#endif /* __KERNEL__ */
46#endif /* _LINUX_DM_KCOPYD_H */ 61#endif /* _LINUX_DM_KCOPYD_H */
diff --git a/include/linux/dma-buf.h b/include/linux/dma-buf.h
new file mode 100644
index 00000000000..f8ac076afa5
--- /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/dma-direction.h b/include/linux/dma-direction.h
new file mode 100644
index 00000000000..95b6a82f595
--- /dev/null
+++ b/include/linux/dma-direction.h
@@ -0,0 +1,13 @@
1#ifndef _LINUX_DMA_DIRECTION_H
2#define _LINUX_DMA_DIRECTION_H
3/*
4 * These definitions mirror those in pci.h, so they can be used
5 * interchangeably with their PCI_ counterparts.
6 */
7enum dma_data_direction {
8 DMA_BIDIRECTIONAL = 0,
9 DMA_TO_DEVICE = 1,
10 DMA_FROM_DEVICE = 2,
11 DMA_NONE = 3,
12};
13#endif
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index ba8319ae5fc..347fdc32177 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -4,17 +4,9 @@
4#include <linux/device.h> 4#include <linux/device.h>
5#include <linux/err.h> 5#include <linux/err.h>
6#include <linux/dma-attrs.h> 6#include <linux/dma-attrs.h>
7#include <linux/dma-direction.h>
7#include <linux/scatterlist.h> 8#include <linux/scatterlist.h>
8 9
9/* These definitions mirror those in pci.h, so they can be used
10 * interchangeably with their PCI_ counterparts */
11enum dma_data_direction {
12 DMA_BIDIRECTIONAL = 0,
13 DMA_TO_DEVICE = 1,
14 DMA_FROM_DEVICE = 2,
15 DMA_NONE = 3,
16};
17
18struct dma_map_ops { 10struct dma_map_ops {
19 void* (*alloc_coherent)(struct device *dev, size_t size, 11 void* (*alloc_coherent)(struct device *dev, size_t size,
20 dma_addr_t *dma_handle, gfp_t gfp); 12 dma_addr_t *dma_handle, gfp_t gfp);
@@ -54,27 +46,6 @@ struct dma_map_ops {
54 46
55#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1)) 47#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
56 48
57typedef u64 DMA_nnBIT_MASK __deprecated;
58
59/*
60 * NOTE: do not use the below macros in new code and do not add new definitions
61 * here.
62 *
63 * Instead, just open-code DMA_BIT_MASK(n) within your driver
64 */
65#define DMA_64BIT_MASK (DMA_nnBIT_MASK)DMA_BIT_MASK(64)
66#define DMA_48BIT_MASK (DMA_nnBIT_MASK)DMA_BIT_MASK(48)
67#define DMA_47BIT_MASK (DMA_nnBIT_MASK)DMA_BIT_MASK(47)
68#define DMA_40BIT_MASK (DMA_nnBIT_MASK)DMA_BIT_MASK(40)
69#define DMA_39BIT_MASK (DMA_nnBIT_MASK)DMA_BIT_MASK(39)
70#define DMA_35BIT_MASK (DMA_nnBIT_MASK)DMA_BIT_MASK(35)
71#define DMA_32BIT_MASK (DMA_nnBIT_MASK)DMA_BIT_MASK(32)
72#define DMA_31BIT_MASK (DMA_nnBIT_MASK)DMA_BIT_MASK(31)
73#define DMA_30BIT_MASK (DMA_nnBIT_MASK)DMA_BIT_MASK(30)
74#define DMA_29BIT_MASK (DMA_nnBIT_MASK)DMA_BIT_MASK(29)
75#define DMA_28BIT_MASK (DMA_nnBIT_MASK)DMA_BIT_MASK(28)
76#define DMA_24BIT_MASK (DMA_nnBIT_MASK)DMA_BIT_MASK(24)
77
78#define DMA_MASK_NONE 0x0ULL 49#define DMA_MASK_NONE 0x0ULL
79 50
80static inline int valid_dma_direction(int dma_direction) 51static inline int valid_dma_direction(int dma_direction)
diff --git a/include/linux/dma_remapping.h b/include/linux/dma_remapping.h
index bbd8661b347..57c9a8ae4f2 100644
--- a/include/linux/dma_remapping.h
+++ b/include/linux/dma_remapping.h
@@ -25,11 +25,13 @@ struct intel_iommu;
25struct dmar_domain; 25struct dmar_domain;
26struct root_entry; 26struct root_entry;
27 27
28extern void free_dmar_iommu(struct intel_iommu *iommu);
29 28
30#ifdef CONFIG_DMAR 29#ifdef CONFIG_INTEL_IOMMU
30extern void free_dmar_iommu(struct intel_iommu *iommu);
31extern int iommu_calculate_agaw(struct intel_iommu *iommu); 31extern int iommu_calculate_agaw(struct intel_iommu *iommu);
32extern int iommu_calculate_max_sagaw(struct intel_iommu *iommu); 32extern int iommu_calculate_max_sagaw(struct intel_iommu *iommu);
33extern int dmar_disabled;
34extern int intel_iommu_enabled;
33#else 35#else
34static inline int iommu_calculate_agaw(struct intel_iommu *iommu) 36static inline int iommu_calculate_agaw(struct intel_iommu *iommu)
35{ 37{
@@ -39,8 +41,12 @@ static inline int iommu_calculate_max_sagaw(struct intel_iommu *iommu)
39{ 41{
40 return 0; 42 return 0;
41} 43}
44static inline void free_dmar_iommu(struct intel_iommu *iommu)
45{
46}
47#define dmar_disabled (1)
48#define intel_iommu_enabled (0)
42#endif 49#endif
43 50
44extern int dmar_disabled;
45 51
46#endif 52#endif
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index eee7addec28..8fbf40e0713 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -23,7 +23,9 @@
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-mapping.h> 26#include <linux/dma-direction.h>
27
28struct scatterlist;
27 29
28/** 30/**
29 * typedef dma_cookie_t - an opaque DMA cookie 31 * typedef dma_cookie_t - an opaque DMA cookie
diff --git a/include/linux/dmar.h b/include/linux/dmar.h
index 7b776d71d36..a8b1a847c10 100644
--- a/include/linux/dmar.h
+++ b/include/linux/dmar.h
@@ -26,8 +26,13 @@
26#include <linux/msi.h> 26#include <linux/msi.h>
27#include <linux/irqreturn.h> 27#include <linux/irqreturn.h>
28 28
29/* DMAR Flags */
30#define DMAR_INTR_REMAP 0x1
31#define DMAR_X2APIC_OPT_OUT 0x2
32
29struct intel_iommu; 33struct intel_iommu;
30#if defined(CONFIG_DMAR) || defined(CONFIG_INTR_REMAP) 34#ifdef CONFIG_DMAR_TABLE
35extern struct acpi_table_header *dmar_tbl;
31struct dmar_drhd_unit { 36struct dmar_drhd_unit {
32 struct list_head list; /* list of drhd units */ 37 struct list_head list; /* list of drhd units */
33 struct acpi_dmar_header *hdr; /* ACPI header */ 38 struct acpi_dmar_header *hdr; /* ACPI header */
@@ -76,7 +81,7 @@ static inline int enable_drhd_fault_handling(void)
76{ 81{
77 return -1; 82 return -1;
78} 83}
79#endif /* !CONFIG_DMAR && !CONFIG_INTR_REMAP */ 84#endif /* !CONFIG_DMAR_TABLE */
80 85
81struct irte { 86struct irte {
82 union { 87 union {
@@ -107,10 +112,10 @@ struct irte {
107 }; 112 };
108}; 113};
109 114
110#ifdef CONFIG_INTR_REMAP 115#ifdef CONFIG_IRQ_REMAP
111extern int intr_remapping_enabled; 116extern int intr_remapping_enabled;
112extern int intr_remapping_supported(void); 117extern int intr_remapping_supported(void);
113extern int enable_intr_remapping(int); 118extern int enable_intr_remapping(void);
114extern void disable_intr_remapping(void); 119extern void disable_intr_remapping(void);
115extern int reenable_intr_remapping(int); 120extern int reenable_intr_remapping(int);
116 121
@@ -177,7 +182,7 @@ static inline int set_msi_sid(struct irte *irte, struct pci_dev *dev)
177 182
178#define intr_remapping_enabled (0) 183#define intr_remapping_enabled (0)
179 184
180static inline int enable_intr_remapping(int eim) 185static inline int enable_intr_remapping(void)
181{ 186{
182 return -1; 187 return -1;
183} 188}
@@ -192,6 +197,11 @@ static inline int reenable_intr_remapping(int eim)
192} 197}
193#endif 198#endif
194 199
200enum {
201 IRQ_REMAP_XAPIC_MODE,
202 IRQ_REMAP_X2APIC_MODE,
203};
204
195/* Can't use the common MSI interrupt functions 205/* Can't use the common MSI interrupt functions
196 * since DMAR is not a pci device 206 * since DMAR is not a pci device
197 */ 207 */
@@ -204,7 +214,7 @@ extern int dmar_set_interrupt(struct intel_iommu *iommu);
204extern irqreturn_t dmar_fault(int irq, void *dev_id); 214extern irqreturn_t dmar_fault(int irq, void *dev_id);
205extern int arch_setup_dmar_msi(unsigned int irq); 215extern int arch_setup_dmar_msi(unsigned int irq);
206 216
207#ifdef CONFIG_DMAR 217#ifdef CONFIG_INTEL_IOMMU
208extern int iommu_detected, no_iommu; 218extern int iommu_detected, no_iommu;
209extern struct list_head dmar_rmrr_units; 219extern struct list_head dmar_rmrr_units;
210struct dmar_rmrr_unit { 220struct dmar_rmrr_unit {
@@ -227,9 +237,26 @@ struct dmar_atsr_unit {
227 u8 include_all:1; /* include all ports */ 237 u8 include_all:1; /* include all ports */
228}; 238};
229 239
240int dmar_parse_rmrr_atsr_dev(void);
241extern int dmar_parse_one_rmrr(struct acpi_dmar_header *header);
242extern int dmar_parse_one_atsr(struct acpi_dmar_header *header);
243extern int dmar_parse_dev_scope(void *start, void *end, int *cnt,
244 struct pci_dev ***devices, u16 segment);
230extern int intel_iommu_init(void); 245extern int intel_iommu_init(void);
231#else /* !CONFIG_DMAR: */ 246#else /* !CONFIG_INTEL_IOMMU: */
232static inline int intel_iommu_init(void) { return -ENODEV; } 247static inline int intel_iommu_init(void) { return -ENODEV; }
233#endif /* CONFIG_DMAR */ 248static inline int dmar_parse_one_rmrr(struct acpi_dmar_header *header)
249{
250 return 0;
251}
252static inline int dmar_parse_one_atsr(struct acpi_dmar_header *header)
253{
254 return 0;
255}
256static inline int dmar_parse_rmrr_atsr_dev(void)
257{
258 return 0;
259}
260#endif /* CONFIG_INTEL_IOMMU */
234 261
235#endif /* __DMAR_H__ */ 262#endif /* __DMAR_H__ */
diff --git a/include/linux/dvb/audio.h b/include/linux/dvb/audio.h
index fec66bd24f2..d47bccd604e 100644
--- a/include/linux/dvb/audio.h
+++ b/include/linux/dvb/audio.h
@@ -67,7 +67,7 @@ typedef struct audio_status {
67 67
68 68
69typedef 69typedef
70struct audio_karaoke{ /* if Vocal1 or Vocal2 are non-zero, they get mixed */ 70struct audio_karaoke { /* if Vocal1 or Vocal2 are non-zero, they get mixed */
71 int vocal1; /* into left and right t at 70% each */ 71 int vocal1; /* into left and right t at 70% each */
72 int vocal2; /* if both, Vocal1 and Vocal2 are non-zero, Vocal1 gets*/ 72 int vocal2; /* if both, Vocal1 and Vocal2 are non-zero, Vocal1 gets*/
73 int melody; /* mixed into the left channel and */ 73 int melody; /* mixed into the left channel and */
diff --git a/include/linux/dw_apb_timer.h b/include/linux/dw_apb_timer.h
new file mode 100644
index 00000000000..49638ea3b77
--- /dev/null
+++ b/include/linux/dw_apb_timer.h
@@ -0,0 +1,56 @@
1/*
2 * (C) Copyright 2009 Intel Corporation
3 * Author: Jacob Pan (jacob.jun.pan@intel.com)
4 *
5 * Shared with ARM platforms, Jamie Iles, Picochip 2011
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 * Support for the Synopsys DesignWare APB Timers.
12 */
13#ifndef __DW_APB_TIMER_H__
14#define __DW_APB_TIMER_H__
15
16#include <linux/clockchips.h>
17#include <linux/clocksource.h>
18#include <linux/interrupt.h>
19
20#define APBTMRS_REG_SIZE 0x14
21
22struct dw_apb_timer {
23 void __iomem *base;
24 unsigned long freq;
25 int irq;
26};
27
28struct dw_apb_clock_event_device {
29 struct clock_event_device ced;
30 struct dw_apb_timer timer;
31 struct irqaction irqaction;
32 void (*eoi)(struct dw_apb_timer *);
33};
34
35struct dw_apb_clocksource {
36 struct dw_apb_timer timer;
37 struct clocksource cs;
38};
39
40void dw_apb_clockevent_register(struct dw_apb_clock_event_device *dw_ced);
41void dw_apb_clockevent_pause(struct dw_apb_clock_event_device *dw_ced);
42void dw_apb_clockevent_resume(struct dw_apb_clock_event_device *dw_ced);
43void dw_apb_clockevent_stop(struct dw_apb_clock_event_device *dw_ced);
44
45struct dw_apb_clock_event_device *
46dw_apb_clockevent_init(int cpu, const char *name, unsigned rating,
47 void __iomem *base, int irq, unsigned long freq);
48struct dw_apb_clocksource *
49dw_apb_clocksource_init(unsigned rating, char *name, void __iomem *base,
50 unsigned long freq);
51void dw_apb_clocksource_register(struct dw_apb_clocksource *dw_cs);
52void dw_apb_clocksource_start(struct dw_apb_clocksource *dw_cs);
53cycle_t dw_apb_clocksource_read(struct dw_apb_clocksource *dw_cs);
54void dw_apb_clocksource_unregister(struct dw_apb_clocksource *dw_cs);
55
56#endif /* __DW_APB_TIMER_H__ */
diff --git a/include/linux/earlysuspend.h b/include/linux/earlysuspend.h
new file mode 100644
index 00000000000..8343b817af3
--- /dev/null
+++ b/include/linux/earlysuspend.h
@@ -0,0 +1,56 @@
1/* include/linux/earlysuspend.h
2 *
3 * Copyright (C) 2007-2008 Google, Inc.
4 *
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
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 */
15
16#ifndef _LINUX_EARLYSUSPEND_H
17#define _LINUX_EARLYSUSPEND_H
18
19#ifdef CONFIG_HAS_EARLYSUSPEND
20#include <linux/list.h>
21#endif
22
23/* The early_suspend structure defines suspend and resume hooks to be called
24 * when the user visible sleep state of the system changes, and a level to
25 * control the order. They can be used to turn off the screen and input
26 * devices that are not used for wakeup.
27 * Suspend handlers are called in low to high level order, resume handlers are
28 * called in the opposite order. If, when calling register_early_suspend,
29 * the suspend handlers have already been called without a matching call to the
30 * resume handlers, the suspend handler will be called directly from
31 * register_early_suspend. This direct call can violate the normal level order.
32 */
33enum {
34 EARLY_SUSPEND_LEVEL_BLANK_SCREEN = 50,
35 EARLY_SUSPEND_LEVEL_STOP_DRAWING = 100,
36 EARLY_SUSPEND_LEVEL_DISABLE_FB = 150,
37};
38struct early_suspend {
39#ifdef CONFIG_HAS_EARLYSUSPEND
40 struct list_head link;
41 int level;
42 void (*suspend)(struct early_suspend *h);
43 void (*resume)(struct early_suspend *h);
44#endif
45};
46
47#ifdef CONFIG_HAS_EARLYSUSPEND
48void register_early_suspend(struct early_suspend *handler);
49void unregister_early_suspend(struct early_suspend *handler);
50#else
51#define register_early_suspend(handler) do { } while (0)
52#define unregister_early_suspend(handler) do { } while (0)
53#endif
54
55#endif
56
diff --git a/include/linux/ecryptfs.h b/include/linux/ecryptfs.h
new file mode 100644
index 00000000000..2224a8c0cb6
--- /dev/null
+++ b/include/linux/ecryptfs.h
@@ -0,0 +1,113 @@
1#ifndef _LINUX_ECRYPTFS_H
2#define _LINUX_ECRYPTFS_H
3
4/* Version verification for shared data structures w/ userspace */
5#define ECRYPTFS_VERSION_MAJOR 0x00
6#define ECRYPTFS_VERSION_MINOR 0x04
7#define ECRYPTFS_SUPPORTED_FILE_VERSION 0x03
8/* These flags indicate which features are supported by the kernel
9 * module; userspace tools such as the mount helper read
10 * ECRYPTFS_VERSIONING_MASK from a sysfs handle in order to determine
11 * how to behave. */
12#define ECRYPTFS_VERSIONING_PASSPHRASE 0x00000001
13#define ECRYPTFS_VERSIONING_PUBKEY 0x00000002
14#define ECRYPTFS_VERSIONING_PLAINTEXT_PASSTHROUGH 0x00000004
15#define ECRYPTFS_VERSIONING_POLICY 0x00000008
16#define ECRYPTFS_VERSIONING_XATTR 0x00000010
17#define ECRYPTFS_VERSIONING_MULTKEY 0x00000020
18#define ECRYPTFS_VERSIONING_DEVMISC 0x00000040
19#define ECRYPTFS_VERSIONING_HMAC 0x00000080
20#define ECRYPTFS_VERSIONING_FILENAME_ENCRYPTION 0x00000100
21#define ECRYPTFS_VERSIONING_GCM 0x00000200
22#define ECRYPTFS_VERSIONING_MASK (ECRYPTFS_VERSIONING_PASSPHRASE \
23 | ECRYPTFS_VERSIONING_PLAINTEXT_PASSTHROUGH \
24 | ECRYPTFS_VERSIONING_PUBKEY \
25 | ECRYPTFS_VERSIONING_XATTR \
26 | ECRYPTFS_VERSIONING_MULTKEY \
27 | ECRYPTFS_VERSIONING_DEVMISC \
28 | ECRYPTFS_VERSIONING_FILENAME_ENCRYPTION)
29#define ECRYPTFS_MAX_PASSWORD_LENGTH 64
30#define ECRYPTFS_MAX_PASSPHRASE_BYTES ECRYPTFS_MAX_PASSWORD_LENGTH
31#define ECRYPTFS_SALT_SIZE 8
32#define ECRYPTFS_SALT_SIZE_HEX (ECRYPTFS_SALT_SIZE*2)
33/* The original signature size is only for what is stored on disk; all
34 * in-memory representations are expanded hex, so it better adapted to
35 * be passed around or referenced on the command line */
36#define ECRYPTFS_SIG_SIZE 8
37#define ECRYPTFS_SIG_SIZE_HEX (ECRYPTFS_SIG_SIZE*2)
38#define ECRYPTFS_PASSWORD_SIG_SIZE ECRYPTFS_SIG_SIZE_HEX
39#define ECRYPTFS_MAX_KEY_BYTES 64
40#define ECRYPTFS_MAX_ENCRYPTED_KEY_BYTES 512
41#define ECRYPTFS_FILE_VERSION 0x03
42#define ECRYPTFS_MAX_PKI_NAME_BYTES 16
43
44#define RFC2440_CIPHER_DES3_EDE 0x02
45#define RFC2440_CIPHER_CAST_5 0x03
46#define RFC2440_CIPHER_BLOWFISH 0x04
47#define RFC2440_CIPHER_AES_128 0x07
48#define RFC2440_CIPHER_AES_192 0x08
49#define RFC2440_CIPHER_AES_256 0x09
50#define RFC2440_CIPHER_TWOFISH 0x0a
51#define RFC2440_CIPHER_CAST_6 0x0b
52
53#define RFC2440_CIPHER_RSA 0x01
54
55/**
56 * For convenience, we may need to pass around the encrypted session
57 * key between kernel and userspace because the authentication token
58 * may not be extractable. For example, the TPM may not release the
59 * private key, instead requiring the encrypted data and returning the
60 * decrypted data.
61 */
62struct ecryptfs_session_key {
63#define ECRYPTFS_USERSPACE_SHOULD_TRY_TO_DECRYPT 0x00000001
64#define ECRYPTFS_USERSPACE_SHOULD_TRY_TO_ENCRYPT 0x00000002
65#define ECRYPTFS_CONTAINS_DECRYPTED_KEY 0x00000004
66#define ECRYPTFS_CONTAINS_ENCRYPTED_KEY 0x00000008
67 u32 flags;
68 u32 encrypted_key_size;
69 u32 decrypted_key_size;
70 u8 encrypted_key[ECRYPTFS_MAX_ENCRYPTED_KEY_BYTES];
71 u8 decrypted_key[ECRYPTFS_MAX_KEY_BYTES];
72};
73
74struct ecryptfs_password {
75 u32 password_bytes;
76 s32 hash_algo;
77 u32 hash_iterations;
78 u32 session_key_encryption_key_bytes;
79#define ECRYPTFS_PERSISTENT_PASSWORD 0x01
80#define ECRYPTFS_SESSION_KEY_ENCRYPTION_KEY_SET 0x02
81 u32 flags;
82 /* Iterated-hash concatenation of salt and passphrase */
83 u8 session_key_encryption_key[ECRYPTFS_MAX_KEY_BYTES];
84 u8 signature[ECRYPTFS_PASSWORD_SIG_SIZE + 1];
85 /* Always in expanded hex */
86 u8 salt[ECRYPTFS_SALT_SIZE];
87};
88
89enum ecryptfs_token_types {ECRYPTFS_PASSWORD, ECRYPTFS_PRIVATE_KEY};
90
91struct ecryptfs_private_key {
92 u32 key_size;
93 u32 data_len;
94 u8 signature[ECRYPTFS_PASSWORD_SIG_SIZE + 1];
95 char pki_type[ECRYPTFS_MAX_PKI_NAME_BYTES + 1];
96 u8 data[];
97};
98
99/* May be a password or a private key */
100struct ecryptfs_auth_tok {
101 u16 version; /* 8-bit major and 8-bit minor */
102 u16 token_type;
103#define ECRYPTFS_ENCRYPT_ONLY 0x00000001
104 u32 flags;
105 struct ecryptfs_session_key session_key;
106 u8 reserved[32];
107 union {
108 struct ecryptfs_password password;
109 struct ecryptfs_private_key private_key;
110 } token;
111} __attribute__ ((packed));
112
113#endif /* _LINUX_ECRYPTFS_H */
diff --git a/include/linux/edac.h b/include/linux/edac.h
index 36c66443bdf..4a73257b47d 100644
--- a/include/linux/edac.h
+++ b/include/linux/edac.h
@@ -12,7 +12,7 @@
12#ifndef _LINUX_EDAC_H_ 12#ifndef _LINUX_EDAC_H_
13#define _LINUX_EDAC_H_ 13#define _LINUX_EDAC_H_
14 14
15#include <asm/atomic.h> 15#include <linux/atomic.h>
16#include <linux/sysdev.h> 16#include <linux/sysdev.h>
17 17
18#define EDAC_OPSTATE_INVAL -1 18#define EDAC_OPSTATE_INVAL -1
diff --git a/include/linux/eeprom_93xx46.h b/include/linux/eeprom_93xx46.h
new file mode 100644
index 00000000000..06791811e49
--- /dev/null
+++ b/include/linux/eeprom_93xx46.h
@@ -0,0 +1,18 @@
1/*
2 * Module: eeprom_93xx46
3 * platform description for 93xx46 EEPROMs.
4 */
5
6struct eeprom_93xx46_platform_data {
7 unsigned char flags;
8#define EE_ADDR8 0x01 /* 8 bit addr. cfg */
9#define EE_ADDR16 0x02 /* 16 bit addr. cfg */
10#define EE_READONLY 0x08 /* forbid writing */
11
12 /*
13 * optional hooks to control additional logic
14 * before and after spi transfer.
15 */
16 void (*prepare)(void *);
17 void (*finish)(void *);
18};
diff --git a/include/linux/efi.h b/include/linux/efi.h
index e376270cd26..2362a0bc7f0 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -19,6 +19,7 @@
19#include <linux/rtc.h> 19#include <linux/rtc.h>
20#include <linux/ioport.h> 20#include <linux/ioport.h>
21#include <linux/pfn.h> 21#include <linux/pfn.h>
22#include <linux/pstore.h>
22 23
23#include <asm/page.h> 24#include <asm/page.h>
24#include <asm/system.h> 25#include <asm/system.h>
@@ -101,6 +102,13 @@ typedef struct {
101 u64 attribute; 102 u64 attribute;
102} efi_memory_desc_t; 103} efi_memory_desc_t;
103 104
105typedef struct {
106 efi_guid_t guid;
107 u32 headersize;
108 u32 flags;
109 u32 imagesize;
110} efi_capsule_header_t;
111
104typedef int (*efi_freemem_callback_t) (u64 start, u64 end, void *arg); 112typedef int (*efi_freemem_callback_t) (u64 start, u64 end, void *arg);
105 113
106/* 114/*
@@ -156,6 +164,9 @@ typedef struct {
156 unsigned long set_variable; 164 unsigned long set_variable;
157 unsigned long get_next_high_mono_count; 165 unsigned long get_next_high_mono_count;
158 unsigned long reset_system; 166 unsigned long reset_system;
167 unsigned long update_capsule;
168 unsigned long query_capsule_caps;
169 unsigned long query_variable_info;
159} efi_runtime_services_t; 170} efi_runtime_services_t;
160 171
161typedef efi_status_t efi_get_time_t (efi_time_t *tm, efi_time_cap_t *tc); 172typedef efi_status_t efi_get_time_t (efi_time_t *tm, efi_time_cap_t *tc);
@@ -168,7 +179,7 @@ typedef efi_status_t efi_get_variable_t (efi_char16_t *name, efi_guid_t *vendor,
168typedef efi_status_t efi_get_next_variable_t (unsigned long *name_size, efi_char16_t *name, 179typedef efi_status_t efi_get_next_variable_t (unsigned long *name_size, efi_char16_t *name,
169 efi_guid_t *vendor); 180 efi_guid_t *vendor);
170typedef efi_status_t efi_set_variable_t (efi_char16_t *name, efi_guid_t *vendor, 181typedef efi_status_t efi_set_variable_t (efi_char16_t *name, efi_guid_t *vendor,
171 unsigned long attr, unsigned long data_size, 182 u32 attr, unsigned long data_size,
172 void *data); 183 void *data);
173typedef efi_status_t efi_get_next_high_mono_count_t (u32 *count); 184typedef efi_status_t efi_get_next_high_mono_count_t (u32 *count);
174typedef void efi_reset_system_t (int reset_type, efi_status_t status, 185typedef void efi_reset_system_t (int reset_type, efi_status_t status,
@@ -177,6 +188,17 @@ typedef efi_status_t efi_set_virtual_address_map_t (unsigned long memory_map_siz
177 unsigned long descriptor_size, 188 unsigned long descriptor_size,
178 u32 descriptor_version, 189 u32 descriptor_version,
179 efi_memory_desc_t *virtual_map); 190 efi_memory_desc_t *virtual_map);
191typedef efi_status_t efi_query_variable_info_t(u32 attr,
192 u64 *storage_space,
193 u64 *remaining_space,
194 u64 *max_variable_size);
195typedef efi_status_t efi_update_capsule_t(efi_capsule_header_t **capsules,
196 unsigned long count,
197 unsigned long sg_list);
198typedef efi_status_t efi_query_capsule_caps_t(efi_capsule_header_t **capsules,
199 unsigned long count,
200 u64 *max_size,
201 int *reset_type);
180 202
181/* 203/*
182 * EFI Configuration Table and GUID definitions 204 * EFI Configuration Table and GUID definitions
@@ -211,6 +233,9 @@ typedef efi_status_t efi_set_virtual_address_map_t (unsigned long memory_map_siz
211#define UV_SYSTEM_TABLE_GUID \ 233#define UV_SYSTEM_TABLE_GUID \
212 EFI_GUID( 0x3b13a7d4, 0x633e, 0x11dd, 0x93, 0xec, 0xda, 0x25, 0x56, 0xd8, 0x95, 0x93 ) 234 EFI_GUID( 0x3b13a7d4, 0x633e, 0x11dd, 0x93, 0xec, 0xda, 0x25, 0x56, 0xd8, 0x95, 0x93 )
213 235
236#define LINUX_EFI_CRASH_GUID \
237 EFI_GUID( 0xcfc8fc79, 0xbe2e, 0x4ddc, 0x97, 0xf0, 0x9f, 0x98, 0xbf, 0xe2, 0x98, 0xa0 )
238
214typedef struct { 239typedef struct {
215 efi_guid_t guid; 240 efi_guid_t guid;
216 unsigned long table; 241 unsigned long table;
@@ -218,6 +243,13 @@ typedef struct {
218 243
219#define EFI_SYSTEM_TABLE_SIGNATURE ((u64)0x5453595320494249ULL) 244#define EFI_SYSTEM_TABLE_SIGNATURE ((u64)0x5453595320494249ULL)
220 245
246#define EFI_2_30_SYSTEM_TABLE_REVISION ((2 << 16) | (30))
247#define EFI_2_20_SYSTEM_TABLE_REVISION ((2 << 16) | (20))
248#define EFI_2_10_SYSTEM_TABLE_REVISION ((2 << 16) | (10))
249#define EFI_2_00_SYSTEM_TABLE_REVISION ((2 << 16) | (00))
250#define EFI_1_10_SYSTEM_TABLE_REVISION ((1 << 16) | (10))
251#define EFI_1_02_SYSTEM_TABLE_REVISION ((1 << 16) | (02))
252
221typedef struct { 253typedef struct {
222 efi_table_hdr_t hdr; 254 efi_table_hdr_t hdr;
223 unsigned long fw_vendor; /* physical addr of CHAR16 vendor string */ 255 unsigned long fw_vendor; /* physical addr of CHAR16 vendor string */
@@ -250,6 +282,7 @@ struct efi_memory_map {
250 */ 282 */
251extern struct efi { 283extern struct efi {
252 efi_system_table_t *systab; /* EFI system table */ 284 efi_system_table_t *systab; /* EFI system table */
285 unsigned int runtime_version; /* Runtime services version */
253 unsigned long mps; /* MPS table */ 286 unsigned long mps; /* MPS table */
254 unsigned long acpi; /* ACPI table (IA64 ext 0.71) */ 287 unsigned long acpi; /* ACPI table (IA64 ext 0.71) */
255 unsigned long acpi20; /* ACPI table (ACPI 2.0) */ 288 unsigned long acpi20; /* ACPI table (ACPI 2.0) */
@@ -266,6 +299,9 @@ extern struct efi {
266 efi_get_variable_t *get_variable; 299 efi_get_variable_t *get_variable;
267 efi_get_next_variable_t *get_next_variable; 300 efi_get_next_variable_t *get_next_variable;
268 efi_set_variable_t *set_variable; 301 efi_set_variable_t *set_variable;
302 efi_query_variable_info_t *query_variable_info;
303 efi_update_capsule_t *update_capsule;
304 efi_query_capsule_caps_t *query_capsule_caps;
269 efi_get_next_high_mono_count_t *get_next_high_mono_count; 305 efi_get_next_high_mono_count_t *get_next_high_mono_count;
270 efi_reset_system_t *reset_system; 306 efi_reset_system_t *reset_system;
271 efi_set_virtual_address_map_t *set_virtual_address_map; 307 efi_set_virtual_address_map_t *set_virtual_address_map;
@@ -426,6 +462,8 @@ struct efivars {
426 struct kset *kset; 462 struct kset *kset;
427 struct bin_attribute *new_var, *del_var; 463 struct bin_attribute *new_var, *del_var;
428 const struct efivar_operations *ops; 464 const struct efivar_operations *ops;
465 struct efivar_entry *walk_entry;
466 struct pstore_info efi_pstore_info;
429}; 467};
430 468
431int register_efivars(struct efivars *efivars, 469int register_efivars(struct efivars *efivars,
diff --git a/include/linux/elevator.h b/include/linux/elevator.h
index 21a8ebf2dc3..d800d514218 100644
--- a/include/linux/elevator.h
+++ b/include/linux/elevator.h
@@ -146,7 +146,7 @@ extern struct request *elv_rb_latter_request(struct request_queue *, struct requ
146/* 146/*
147 * rb support functions. 147 * rb support functions.
148 */ 148 */
149extern struct request *elv_rb_add(struct rb_root *, struct request *); 149extern void elv_rb_add(struct rb_root *, struct request *);
150extern void elv_rb_del(struct rb_root *, struct request *); 150extern void elv_rb_del(struct rb_root *, struct request *);
151extern struct request *elv_rb_find(struct rb_root *, sector_t); 151extern struct request *elv_rb_find(struct rb_root *, sector_t);
152 152
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h
index ab68f785fd1..05955cf0993 100644
--- a/include/linux/etherdevice.h
+++ b/include/linux/etherdevice.h
@@ -38,7 +38,7 @@ extern int eth_header(struct sk_buff *skb, struct net_device *dev,
38 const void *daddr, const void *saddr, unsigned len); 38 const void *daddr, const void *saddr, unsigned len);
39extern int eth_rebuild_header(struct sk_buff *skb); 39extern int eth_rebuild_header(struct sk_buff *skb);
40extern int eth_header_parse(const struct sk_buff *skb, unsigned char *haddr); 40extern int eth_header_parse(const struct sk_buff *skb, unsigned char *haddr);
41extern int eth_header_cache(const struct neighbour *neigh, struct hh_cache *hh); 41extern int eth_header_cache(const struct neighbour *neigh, struct hh_cache *hh, __be16 type);
42extern void eth_header_cache_update(struct hh_cache *hh, 42extern void eth_header_cache_update(struct hh_cache *hh,
43 const struct net_device *dev, 43 const struct net_device *dev,
44 const unsigned char *haddr); 44 const unsigned char *haddr);
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index 439b173c588..c6e427ab65f 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -287,7 +287,7 @@ enum ethtool_stringset {
287 ETH_SS_TEST = 0, 287 ETH_SS_TEST = 0,
288 ETH_SS_STATS, 288 ETH_SS_STATS,
289 ETH_SS_PRIV_FLAGS, 289 ETH_SS_PRIV_FLAGS,
290 ETH_SS_NTUPLE_FILTERS, 290 ETH_SS_NTUPLE_FILTERS, /* Do not use, GRXNTUPLE is now deprecated */
291 ETH_SS_FEATURES, 291 ETH_SS_FEATURES,
292}; 292};
293 293
@@ -310,9 +310,21 @@ struct ethtool_sset_info {
310 __u32's, etc. */ 310 __u32's, etc. */
311}; 311};
312 312
313/**
314 * enum ethtool_test_flags - flags definition of ethtool_test
315 * @ETH_TEST_FL_OFFLINE: if set perform online and offline tests, otherwise
316 * only online tests.
317 * @ETH_TEST_FL_FAILED: Driver set this flag if test fails.
318 * @ETH_TEST_FL_EXTERNAL_LB: Application request to perform external loopback
319 * test.
320 * @ETH_TEST_FL_EXTERNAL_LB_DONE: Driver performed the external loopback test
321 */
322
313enum ethtool_test_flags { 323enum ethtool_test_flags {
314 ETH_TEST_FL_OFFLINE = (1 << 0), /* online / offline */ 324 ETH_TEST_FL_OFFLINE = (1 << 0),
315 ETH_TEST_FL_FAILED = (1 << 1), /* test passed / failed */ 325 ETH_TEST_FL_FAILED = (1 << 1),
326 ETH_TEST_FL_EXTERNAL_LB = (1 << 2),
327 ETH_TEST_FL_EXTERNAL_LB_DONE = (1 << 3),
316}; 328};
317 329
318/* for requesting NIC test and getting results*/ 330/* for requesting NIC test and getting results*/
@@ -714,18 +726,6 @@ enum ethtool_sfeatures_retval_bits {
714/* needed by dev_disable_lro() */ 726/* needed by dev_disable_lro() */
715extern int __ethtool_set_flags(struct net_device *dev, u32 flags); 727extern int __ethtool_set_flags(struct net_device *dev, u32 flags);
716 728
717struct ethtool_rx_ntuple_flow_spec_container {
718 struct ethtool_rx_ntuple_flow_spec fs;
719 struct list_head list;
720};
721
722struct ethtool_rx_ntuple_list {
723#define ETHTOOL_MAX_NTUPLE_LIST_ENTRY 1024
724#define ETHTOOL_MAX_NTUPLE_STRING_PER_ENTRY 14
725 struct list_head list;
726 unsigned int count;
727};
728
729/** 729/**
730 * enum ethtool_phys_id_state - indicator state for physical identification 730 * enum ethtool_phys_id_state - indicator state for physical identification
731 * @ETHTOOL_ID_INACTIVE: Physical ID indicator should be deactivated 731 * @ETHTOOL_ID_INACTIVE: Physical ID indicator should be deactivated
@@ -758,7 +758,6 @@ u32 ethtool_op_get_ufo(struct net_device *dev);
758int ethtool_op_set_ufo(struct net_device *dev, u32 data); 758int ethtool_op_set_ufo(struct net_device *dev, u32 data);
759u32 ethtool_op_get_flags(struct net_device *dev); 759u32 ethtool_op_get_flags(struct net_device *dev);
760int ethtool_op_set_flags(struct net_device *dev, u32 data, u32 supported); 760int ethtool_op_set_flags(struct net_device *dev, u32 data, u32 supported);
761void ethtool_ntuple_flush(struct net_device *dev);
762bool ethtool_invalid_flags(struct net_device *dev, u32 data, u32 supported); 761bool ethtool_invalid_flags(struct net_device *dev, u32 data, u32 supported);
763 762
764/** 763/**
@@ -865,7 +864,6 @@ bool ethtool_invalid_flags(struct net_device *dev, u32 data, u32 supported);
865 * error code or zero. 864 * error code or zero.
866 * @set_rx_ntuple: Set an RX n-tuple rule. Returns a negative error code 865 * @set_rx_ntuple: Set an RX n-tuple rule. Returns a negative error code
867 * or zero. 866 * or zero.
868 * @get_rx_ntuple: Deprecated.
869 * @get_rxfh_indir: Get the contents of the RX flow hash indirection table. 867 * @get_rxfh_indir: Get the contents of the RX flow hash indirection table.
870 * Returns a negative error code or zero. 868 * Returns a negative error code or zero.
871 * @set_rxfh_indir: Set the contents of the RX flow hash indirection table. 869 * @set_rxfh_indir: Set the contents of the RX flow hash indirection table.
@@ -944,7 +942,6 @@ struct ethtool_ops {
944 int (*reset)(struct net_device *, u32 *); 942 int (*reset)(struct net_device *, u32 *);
945 int (*set_rx_ntuple)(struct net_device *, 943 int (*set_rx_ntuple)(struct net_device *,
946 struct ethtool_rx_ntuple *); 944 struct ethtool_rx_ntuple *);
947 int (*get_rx_ntuple)(struct net_device *, u32 stringset, void *);
948 int (*get_rxfh_indir)(struct net_device *, 945 int (*get_rxfh_indir)(struct net_device *,
949 struct ethtool_rxfh_indir *); 946 struct ethtool_rxfh_indir *);
950 int (*set_rxfh_indir)(struct net_device *, 947 int (*set_rxfh_indir)(struct net_device *,
@@ -1017,7 +1014,7 @@ struct ethtool_ops {
1017#define ETHTOOL_FLASHDEV 0x00000033 /* Flash firmware to device */ 1014#define ETHTOOL_FLASHDEV 0x00000033 /* Flash firmware to device */
1018#define ETHTOOL_RESET 0x00000034 /* Reset hardware */ 1015#define ETHTOOL_RESET 0x00000034 /* Reset hardware */
1019#define ETHTOOL_SRXNTUPLE 0x00000035 /* Add an n-tuple filter to device */ 1016#define ETHTOOL_SRXNTUPLE 0x00000035 /* Add an n-tuple filter to device */
1020#define ETHTOOL_GRXNTUPLE 0x00000036 /* Get n-tuple filters from device */ 1017#define ETHTOOL_GRXNTUPLE 0x00000036 /* deprecated */
1021#define ETHTOOL_GSSET_INFO 0x00000037 /* Get string set info */ 1018#define ETHTOOL_GSSET_INFO 0x00000037 /* Get string set info */
1022#define ETHTOOL_GRXFHINDIR 0x00000038 /* Get RX flow hash indir'n table */ 1019#define ETHTOOL_GRXFHINDIR 0x00000038 /* Get RX flow hash indir'n table */
1023#define ETHTOOL_SRXFHINDIR 0x00000039 /* Set RX flow hash indir'n table */ 1020#define ETHTOOL_SRXFHINDIR 0x00000039 /* Set RX flow hash indir'n table */
diff --git a/include/linux/export.h b/include/linux/export.h
new file mode 100644
index 00000000000..696c0f48afc
--- /dev/null
+++ b/include/linux/export.h
@@ -0,0 +1,89 @@
1#ifndef _LINUX_EXPORT_H
2#define _LINUX_EXPORT_H
3/*
4 * Export symbols from the kernel to modules. Forked from module.h
5 * to reduce the amount of pointless cruft we feed to gcc when only
6 * exporting a simple symbol or two.
7 *
8 * If you feel the need to add #include <linux/foo.h> to this file
9 * then you are doing something wrong and should go away silently.
10 */
11
12/* Some toolchains use a `_' prefix for all user symbols. */
13#ifdef CONFIG_SYMBOL_PREFIX
14#define MODULE_SYMBOL_PREFIX CONFIG_SYMBOL_PREFIX
15#else
16#define MODULE_SYMBOL_PREFIX ""
17#endif
18
19struct kernel_symbol
20{
21 unsigned long value;
22 const char *name;
23};
24
25#ifdef MODULE
26extern struct module __this_module;
27#define THIS_MODULE (&__this_module)
28#else
29#define THIS_MODULE ((struct module *)0)
30#endif
31
32#ifdef CONFIG_MODULES
33
34#ifndef __GENKSYMS__
35#ifdef CONFIG_MODVERSIONS
36/* Mark the CRC weak since genksyms apparently decides not to
37 * generate a checksums for some symbols */
38#define __CRC_SYMBOL(sym, sec) \
39 extern void *__crc_##sym __attribute__((weak)); \
40 static const unsigned long __kcrctab_##sym \
41 __used \
42 __attribute__((section("___kcrctab" sec "+" #sym), unused)) \
43 = (unsigned long) &__crc_##sym;
44#else
45#define __CRC_SYMBOL(sym, sec)
46#endif
47
48/* For every exported symbol, place a struct in the __ksymtab section */
49#define __EXPORT_SYMBOL(sym, sec) \
50 extern typeof(sym) sym; \
51 __CRC_SYMBOL(sym, sec) \
52 static const char __kstrtab_##sym[] \
53 __attribute__((section("__ksymtab_strings"), aligned(1))) \
54 = MODULE_SYMBOL_PREFIX #sym; \
55 static const struct kernel_symbol __ksymtab_##sym \
56 __used \
57 __attribute__((section("___ksymtab" sec "+" #sym), unused)) \
58 = { (unsigned long)&sym, __kstrtab_##sym }
59
60#define EXPORT_SYMBOL(sym) \
61 __EXPORT_SYMBOL(sym, "")
62
63#define EXPORT_SYMBOL_GPL(sym) \
64 __EXPORT_SYMBOL(sym, "_gpl")
65
66#define EXPORT_SYMBOL_GPL_FUTURE(sym) \
67 __EXPORT_SYMBOL(sym, "_gpl_future")
68
69#ifdef CONFIG_UNUSED_SYMBOLS
70#define EXPORT_UNUSED_SYMBOL(sym) __EXPORT_SYMBOL(sym, "_unused")
71#define EXPORT_UNUSED_SYMBOL_GPL(sym) __EXPORT_SYMBOL(sym, "_unused_gpl")
72#else
73#define EXPORT_UNUSED_SYMBOL(sym)
74#define EXPORT_UNUSED_SYMBOL_GPL(sym)
75#endif
76
77#endif /* __GENKSYMS__ */
78
79#else /* !CONFIG_MODULES... */
80
81#define EXPORT_SYMBOL(sym)
82#define EXPORT_SYMBOL_GPL(sym)
83#define EXPORT_SYMBOL_GPL_FUTURE(sym)
84#define EXPORT_UNUSED_SYMBOL(sym)
85#define EXPORT_UNUSED_SYMBOL_GPL(sym)
86
87#endif /* CONFIG_MODULES */
88
89#endif /* _LINUX_EXPORT_H */
diff --git a/include/linux/ext2_fs.h b/include/linux/ext2_fs.h
index 2dfa7076e8b..ce1b719e8bd 100644
--- a/include/linux/ext2_fs.h
+++ b/include/linux/ext2_fs.h
@@ -18,6 +18,7 @@
18 18
19#include <linux/types.h> 19#include <linux/types.h>
20#include <linux/magic.h> 20#include <linux/magic.h>
21#include <linux/fs.h>
21 22
22/* 23/*
23 * The second extended filesystem constants/structures 24 * The second extended filesystem constants/structures
@@ -196,8 +197,8 @@ struct ext2_group_desc
196 197
197/* Flags that should be inherited by new inodes from their parent. */ 198/* Flags that should be inherited by new inodes from their parent. */
198#define EXT2_FL_INHERITED (EXT2_SECRM_FL | EXT2_UNRM_FL | EXT2_COMPR_FL |\ 199#define EXT2_FL_INHERITED (EXT2_SECRM_FL | EXT2_UNRM_FL | EXT2_COMPR_FL |\
199 EXT2_SYNC_FL | EXT2_IMMUTABLE_FL | EXT2_APPEND_FL |\ 200 EXT2_SYNC_FL | EXT2_NODUMP_FL |\
200 EXT2_NODUMP_FL | EXT2_NOATIME_FL | EXT2_COMPRBLK_FL|\ 201 EXT2_NOATIME_FL | EXT2_COMPRBLK_FL |\
201 EXT2_NOCOMP_FL | EXT2_JOURNAL_DATA_FL |\ 202 EXT2_NOCOMP_FL | EXT2_JOURNAL_DATA_FL |\
202 EXT2_NOTAIL_FL | EXT2_DIRSYNC_FL) 203 EXT2_NOTAIL_FL | EXT2_DIRSYNC_FL)
203 204
diff --git a/include/linux/ext3_fs.h b/include/linux/ext3_fs.h
index 5e06acf95d0..0244611eb2b 100644
--- a/include/linux/ext3_fs.h
+++ b/include/linux/ext3_fs.h
@@ -180,8 +180,8 @@ struct ext3_group_desc
180 180
181/* Flags that should be inherited by new inodes from their parent. */ 181/* Flags that should be inherited by new inodes from their parent. */
182#define EXT3_FL_INHERITED (EXT3_SECRM_FL | EXT3_UNRM_FL | EXT3_COMPR_FL |\ 182#define EXT3_FL_INHERITED (EXT3_SECRM_FL | EXT3_UNRM_FL | EXT3_COMPR_FL |\
183 EXT3_SYNC_FL | EXT3_IMMUTABLE_FL | EXT3_APPEND_FL |\ 183 EXT3_SYNC_FL | EXT3_NODUMP_FL |\
184 EXT3_NODUMP_FL | EXT3_NOATIME_FL | EXT3_COMPRBLK_FL|\ 184 EXT3_NOATIME_FL | EXT3_COMPRBLK_FL |\
185 EXT3_NOCOMPR_FL | EXT3_JOURNAL_DATA_FL |\ 185 EXT3_NOCOMPR_FL | EXT3_JOURNAL_DATA_FL |\
186 EXT3_NOTAIL_FL | EXT3_DIRSYNC_FL) 186 EXT3_NOTAIL_FL | EXT3_DIRSYNC_FL)
187 187
@@ -418,12 +418,11 @@ struct ext3_inode {
418#define EXT2_MOUNT_DATA_FLAGS EXT3_MOUNT_DATA_FLAGS 418#define EXT2_MOUNT_DATA_FLAGS EXT3_MOUNT_DATA_FLAGS
419#endif 419#endif
420 420
421#define ext3_set_bit __test_and_set_bit_le 421#define ext3_set_bit __set_bit_le
422#define ext3_set_bit_atomic ext2_set_bit_atomic 422#define ext3_set_bit_atomic ext2_set_bit_atomic
423#define ext3_clear_bit __test_and_clear_bit_le 423#define ext3_clear_bit __clear_bit_le
424#define ext3_clear_bit_atomic ext2_clear_bit_atomic 424#define ext3_clear_bit_atomic ext2_clear_bit_atomic
425#define ext3_test_bit test_bit_le 425#define ext3_test_bit test_bit_le
426#define ext3_find_first_zero_bit find_first_zero_bit_le
427#define ext3_find_next_zero_bit find_next_zero_bit_le 426#define ext3_find_next_zero_bit find_next_zero_bit_le
428 427
429/* 428/*
@@ -877,7 +876,7 @@ extern int ext3_htree_store_dirent(struct file *dir_file, __u32 hash,
877extern void ext3_htree_free_dir_info(struct dir_private_info *p); 876extern void ext3_htree_free_dir_info(struct dir_private_info *p);
878 877
879/* fsync.c */ 878/* fsync.c */
880extern int ext3_sync_file(struct file *, int); 879extern int ext3_sync_file(struct file *, loff_t, loff_t, int);
881 880
882/* hash.c */ 881/* hash.c */
883extern int ext3fs_dirhash(const char *name, int len, struct 882extern int ext3fs_dirhash(const char *name, int len, struct
@@ -913,7 +912,7 @@ extern void ext3_dirty_inode(struct inode *, int);
913extern int ext3_change_inode_journal_flag(struct inode *, int); 912extern int ext3_change_inode_journal_flag(struct inode *, int);
914extern int ext3_get_inode_loc(struct inode *, struct ext3_iloc *); 913extern int ext3_get_inode_loc(struct inode *, struct ext3_iloc *);
915extern int ext3_can_truncate(struct inode *inode); 914extern int ext3_can_truncate(struct inode *inode);
916extern void ext3_truncate (struct inode *); 915extern void ext3_truncate(struct inode *inode);
917extern void ext3_set_inode_flags(struct inode *); 916extern void ext3_set_inode_flags(struct inode *);
918extern void ext3_get_inode_flags(struct ext3_inode_info *); 917extern void ext3_get_inode_flags(struct ext3_inode_info *);
919extern void ext3_set_aops(struct inode *inode); 918extern void ext3_set_aops(struct inode *inode);
diff --git a/include/linux/fault-inject.h b/include/linux/fault-inject.h
index 7b64ad40e4c..c6f996f2abb 100644
--- a/include/linux/fault-inject.h
+++ b/include/linux/fault-inject.h
@@ -5,7 +5,7 @@
5 5
6#include <linux/types.h> 6#include <linux/types.h>
7#include <linux/debugfs.h> 7#include <linux/debugfs.h>
8#include <asm/atomic.h> 8#include <linux/atomic.h>
9 9
10/* 10/*
11 * For explanation of the elements of this struct, see 11 * For explanation of the elements of this struct, see
@@ -25,26 +25,6 @@ struct fault_attr {
25 unsigned long reject_end; 25 unsigned long reject_end;
26 26
27 unsigned long count; 27 unsigned long count;
28
29#ifdef CONFIG_FAULT_INJECTION_DEBUG_FS
30
31 struct {
32 struct dentry *dir;
33
34 struct dentry *probability_file;
35 struct dentry *interval_file;
36 struct dentry *times_file;
37 struct dentry *space_file;
38 struct dentry *verbose_file;
39 struct dentry *task_filter_file;
40 struct dentry *stacktrace_depth_file;
41 struct dentry *require_start_file;
42 struct dentry *require_end_file;
43 struct dentry *reject_start_file;
44 struct dentry *reject_end_file;
45 } dentries;
46
47#endif
48}; 28};
49 29
50#define FAULT_ATTR_INITIALIZER { \ 30#define FAULT_ATTR_INITIALIZER { \
@@ -57,24 +37,19 @@ struct fault_attr {
57 37
58#define DECLARE_FAULT_ATTR(name) struct fault_attr name = FAULT_ATTR_INITIALIZER 38#define DECLARE_FAULT_ATTR(name) struct fault_attr name = FAULT_ATTR_INITIALIZER
59int setup_fault_attr(struct fault_attr *attr, char *str); 39int setup_fault_attr(struct fault_attr *attr, char *str);
60void should_fail_srandom(unsigned long entropy);
61bool should_fail(struct fault_attr *attr, ssize_t size); 40bool should_fail(struct fault_attr *attr, ssize_t size);
62 41
63#ifdef CONFIG_FAULT_INJECTION_DEBUG_FS 42#ifdef CONFIG_FAULT_INJECTION_DEBUG_FS
64 43
65int init_fault_attr_dentries(struct fault_attr *attr, const char *name); 44struct dentry *fault_create_debugfs_attr(const char *name,
66void cleanup_fault_attr_dentries(struct fault_attr *attr); 45 struct dentry *parent, struct fault_attr *attr);
67 46
68#else /* CONFIG_FAULT_INJECTION_DEBUG_FS */ 47#else /* CONFIG_FAULT_INJECTION_DEBUG_FS */
69 48
70static inline int init_fault_attr_dentries(struct fault_attr *attr, 49static inline struct dentry *fault_create_debugfs_attr(const char *name,
71 const char *name) 50 struct dentry *parent, struct fault_attr *attr)
72{
73 return -ENODEV;
74}
75
76static inline void cleanup_fault_attr_dentries(struct fault_attr *attr)
77{ 51{
52 return ERR_PTR(-ENODEV);
78} 53}
79 54
80#endif /* CONFIG_FAULT_INJECTION_DEBUG_FS */ 55#endif /* CONFIG_FAULT_INJECTION_DEBUG_FS */
diff --git a/include/linux/fb.h b/include/linux/fb.h
index 6a827487717..bb565a4c2e1 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -226,6 +226,19 @@ struct fb_bitfield {
226#define FB_VMODE_SMOOTH_XPAN 512 /* smooth xpan possible (internally used) */ 226#define FB_VMODE_SMOOTH_XPAN 512 /* smooth xpan possible (internally used) */
227#define FB_VMODE_CONUPDATE 512 /* don't update x/yoffset */ 227#define FB_VMODE_CONUPDATE 512 /* don't update x/yoffset */
228 228
229#define FB_FLAG_RATIO_4_3 64
230#define FB_FLAG_RATIO_16_9 128
231#define FB_FLAG_PIXEL_REPEAT 256
232
233/*
234 * Stereo modes
235 */
236#define FB_VMODE_STEREO_NONE 0x00000000 /* not stereo */
237#define FB_VMODE_STEREO_FRAME_PACK 0x01000000 /* frame packing */
238#define FB_VMODE_STEREO_TOP_BOTTOM 0x02000000 /* top-bottom */
239#define FB_VMODE_STEREO_LEFT_RIGHT 0x04000000 /* left-right */
240#define FB_VMODE_STEREO_MASK 0xFF000000
241
229/* 242/*
230 * Display rotation support 243 * Display rotation support
231 */ 244 */
@@ -439,6 +452,8 @@ struct file;
439 452
440#define FB_MISC_PRIM_COLOR 1 453#define FB_MISC_PRIM_COLOR 1
441#define FB_MISC_1ST_DETAIL 2 /* First Detailed Timing is preferred */ 454#define FB_MISC_1ST_DETAIL 2 /* First Detailed Timing is preferred */
455#define FB_MISC_HDMI 4 /* display supports HDMI signaling */
456
442struct fb_chroma { 457struct fb_chroma {
443 __u32 redx; /* in fraction of 1024 */ 458 __u32 redx; /* in fraction of 1024 */
444 __u32 greenx; 459 __u32 greenx;
@@ -1043,7 +1058,8 @@ extern void fb_deferred_io_open(struct fb_info *info,
1043 struct inode *inode, 1058 struct inode *inode,
1044 struct file *file); 1059 struct file *file);
1045extern void fb_deferred_io_cleanup(struct fb_info *info); 1060extern void fb_deferred_io_cleanup(struct fb_info *info);
1046extern int fb_deferred_io_fsync(struct file *file, int datasync); 1061extern int fb_deferred_io_fsync(struct file *file, loff_t start,
1062 loff_t end, int datasync);
1047 1063
1048static inline bool fb_be_math(struct fb_info *info) 1064static inline bool fb_be_math(struct fb_info *info)
1049{ 1065{
@@ -1103,6 +1119,7 @@ extern unsigned char *fb_ddc_read(struct i2c_adapter *adapter);
1103 1119
1104/* drivers/video/modedb.c */ 1120/* drivers/video/modedb.c */
1105#define VESA_MODEDB_SIZE 34 1121#define VESA_MODEDB_SIZE 34
1122#define CEA_MODEDB_SIZE 65
1106extern void fb_var_to_videomode(struct fb_videomode *mode, 1123extern void fb_var_to_videomode(struct fb_videomode *mode,
1107 const struct fb_var_screeninfo *var); 1124 const struct fb_var_screeninfo *var);
1108extern void fb_videomode_to_var(struct fb_var_screeninfo *var, 1125extern void fb_videomode_to_var(struct fb_var_screeninfo *var,
@@ -1155,7 +1172,7 @@ struct fb_videomode {
1155 1172
1156extern const char *fb_mode_option; 1173extern const char *fb_mode_option;
1157extern const struct fb_videomode vesa_modes[]; 1174extern const struct fb_videomode vesa_modes[];
1158extern const struct fb_videomode cea_modes[64]; 1175extern const struct fb_videomode cea_modes[];
1159 1176
1160struct fb_modelist { 1177struct fb_modelist {
1161 struct list_head list; 1178 struct list_head list;
diff --git a/include/linux/fd.h b/include/linux/fd.h
index f5d194af07a..72202b1b9a6 100644
--- a/include/linux/fd.h
+++ b/include/linux/fd.h
@@ -377,4 +377,26 @@ struct floppy_raw_cmd {
377#define FDEJECT _IO(2, 0x5a) 377#define FDEJECT _IO(2, 0x5a)
378/* eject the disk */ 378/* eject the disk */
379 379
380
381#ifdef __KERNEL__
382#ifdef CONFIG_COMPAT
383#include <linux/compat.h>
384
385struct compat_floppy_struct {
386 compat_uint_t size;
387 compat_uint_t sect;
388 compat_uint_t head;
389 compat_uint_t track;
390 compat_uint_t stretch;
391 unsigned char gap;
392 unsigned char rate;
393 unsigned char spec1;
394 unsigned char fmt_gap;
395 const compat_caddr_t name;
396};
397
398#define FDGETPRM32 _IOR(2, 0x04, struct compat_floppy_struct)
399#endif
400#endif
401
380#endif 402#endif
diff --git a/include/linux/fdtable.h b/include/linux/fdtable.h
index 133c0ba25e3..82163c4b32c 100644
--- a/include/linux/fdtable.h
+++ b/include/linux/fdtable.h
@@ -13,7 +13,7 @@
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/fs.h> 14#include <linux/fs.h>
15 15
16#include <asm/atomic.h> 16#include <linux/atomic.h>
17 17
18/* 18/*
19 * The default fd array needs to be at least BITS_PER_LONG, 19 * The default fd array needs to be at least BITS_PER_LONG,
@@ -60,7 +60,6 @@ struct files_struct {
60 60
61#define rcu_dereference_check_fdtable(files, fdtfd) \ 61#define rcu_dereference_check_fdtable(files, fdtfd) \
62 (rcu_dereference_check((fdtfd), \ 62 (rcu_dereference_check((fdtfd), \
63 rcu_read_lock_held() || \
64 lockdep_is_held(&(files)->file_lock) || \ 63 lockdep_is_held(&(files)->file_lock) || \
65 atomic_read(&(files)->count) == 1 || \ 64 atomic_read(&(files)->count) == 1 || \
66 rcu_my_thread_group_empty())) 65 rcu_my_thread_group_empty()))
diff --git a/include/linux/filter.h b/include/linux/filter.h
index 9ee3f9fb0b4..741956fa5bf 100644
--- a/include/linux/filter.h
+++ b/include/linux/filter.h
@@ -9,7 +9,7 @@
9#include <linux/types.h> 9#include <linux/types.h>
10 10
11#ifdef __KERNEL__ 11#ifdef __KERNEL__
12#include <asm/atomic.h> 12#include <linux/atomic.h>
13#endif 13#endif
14 14
15/* 15/*
diff --git a/include/linux/firewire-cdev.h b/include/linux/firewire-cdev.h
index 4ff09889c5c..357dbfc2829 100644
--- a/include/linux/firewire-cdev.h
+++ b/include/linux/firewire-cdev.h
@@ -30,10 +30,13 @@
30#include <linux/types.h> 30#include <linux/types.h>
31#include <linux/firewire-constants.h> 31#include <linux/firewire-constants.h>
32 32
33/* available since kernel version 2.6.22 */
33#define FW_CDEV_EVENT_BUS_RESET 0x00 34#define FW_CDEV_EVENT_BUS_RESET 0x00
34#define FW_CDEV_EVENT_RESPONSE 0x01 35#define FW_CDEV_EVENT_RESPONSE 0x01
35#define FW_CDEV_EVENT_REQUEST 0x02 36#define FW_CDEV_EVENT_REQUEST 0x02
36#define FW_CDEV_EVENT_ISO_INTERRUPT 0x03 37#define FW_CDEV_EVENT_ISO_INTERRUPT 0x03
38
39/* available since kernel version 2.6.30 */
37#define FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED 0x04 40#define FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED 0x04
38#define FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED 0x05 41#define FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED 0x05
39 42
@@ -120,24 +123,11 @@ struct fw_cdev_event_response {
120 123
121/** 124/**
122 * struct fw_cdev_event_request - Old version of &fw_cdev_event_request2 125 * struct fw_cdev_event_request - Old version of &fw_cdev_event_request2
123 * @closure: See &fw_cdev_event_common; set by %FW_CDEV_IOC_ALLOCATE ioctl
124 * @type: See &fw_cdev_event_common; always %FW_CDEV_EVENT_REQUEST 126 * @type: See &fw_cdev_event_common; always %FW_CDEV_EVENT_REQUEST
125 * @tcode: See &fw_cdev_event_request2
126 * @offset: See &fw_cdev_event_request2
127 * @handle: See &fw_cdev_event_request2
128 * @length: See &fw_cdev_event_request2
129 * @data: See &fw_cdev_event_request2
130 * 127 *
131 * This event is sent instead of &fw_cdev_event_request2 if the kernel or 128 * This event is sent instead of &fw_cdev_event_request2 if the kernel or
132 * the client implements ABI version <= 3. 129 * the client implements ABI version <= 3. &fw_cdev_event_request lacks
133 * 130 * essential information; use &fw_cdev_event_request2 instead.
134 * Unlike &fw_cdev_event_request2, the sender identity cannot be established,
135 * broadcast write requests cannot be distinguished from unicast writes, and
136 * @tcode of lock requests is %TCODE_LOCK_REQUEST.
137 *
138 * Requests to the FCP_REQUEST or FCP_RESPONSE register are responded to as
139 * with &fw_cdev_event_request2, except in kernel 2.6.32 and older which send
140 * the response packet of the client's %FW_CDEV_IOC_SEND_RESPONSE ioctl.
141 */ 131 */
142struct fw_cdev_event_request { 132struct fw_cdev_event_request {
143 __u64 closure; 133 __u64 closure;
@@ -452,29 +442,31 @@ union fw_cdev_event {
452 * %FW_CDEV_ISO_CONTEXT_RECEIVE_MULTICHANNEL, and 442 * %FW_CDEV_ISO_CONTEXT_RECEIVE_MULTICHANNEL, and
453 * %FW_CDEV_IOC_SET_ISO_CHANNELS 443 * %FW_CDEV_IOC_SET_ISO_CHANNELS
454 */ 444 */
455#define FW_CDEV_VERSION 3 /* Meaningless; don't use this macro. */
456 445
457/** 446/**
458 * struct fw_cdev_get_info - General purpose information ioctl 447 * struct fw_cdev_get_info - General purpose information ioctl
459 * @version: The version field is just a running serial number. Both an 448 * @version: The version field is just a running serial number. Both an
460 * input parameter (ABI version implemented by the client) and 449 * input parameter (ABI version implemented by the client) and
461 * output parameter (ABI version implemented by the kernel). 450 * output parameter (ABI version implemented by the kernel).
462 * A client must not fill in an %FW_CDEV_VERSION defined from an 451 * A client shall fill in the ABI @version for which the client
463 * included kernel header file but the actual version for which 452 * was implemented. This is necessary for forward compatibility.
464 * the client was implemented. This is necessary for forward 453 * @rom_length: If @rom is non-zero, up to @rom_length bytes of Configuration
465 * compatibility. We never break backwards compatibility, but
466 * may add more structs, events, and ioctls in later revisions.
467 * @rom_length: If @rom is non-zero, at most rom_length bytes of configuration
468 * ROM will be copied into that user space address. In either 454 * ROM will be copied into that user space address. In either
469 * case, @rom_length is updated with the actual length of the 455 * case, @rom_length is updated with the actual length of the
470 * configuration ROM. 456 * Configuration ROM.
471 * @rom: If non-zero, address of a buffer to be filled by a copy of the 457 * @rom: If non-zero, address of a buffer to be filled by a copy of the
472 * device's configuration ROM 458 * device's Configuration ROM
473 * @bus_reset: If non-zero, address of a buffer to be filled by a 459 * @bus_reset: If non-zero, address of a buffer to be filled by a
474 * &struct fw_cdev_event_bus_reset with the current state 460 * &struct fw_cdev_event_bus_reset with the current state
475 * of the bus. This does not cause a bus reset to happen. 461 * of the bus. This does not cause a bus reset to happen.
476 * @bus_reset_closure: Value of &closure in this and subsequent bus reset events 462 * @bus_reset_closure: Value of &closure in this and subsequent bus reset events
477 * @card: The index of the card this device belongs to 463 * @card: The index of the card this device belongs to
464 *
465 * The %FW_CDEV_IOC_GET_INFO ioctl is usually the very first one which a client
466 * performs right after it opened a /dev/fw* file.
467 *
468 * As a side effect, reception of %FW_CDEV_EVENT_BUS_RESET events to be read(2)
469 * is started by this ioctl.
478 */ 470 */
479struct fw_cdev_get_info { 471struct fw_cdev_get_info {
480 __u32 version; 472 __u32 version;
@@ -612,7 +604,7 @@ struct fw_cdev_initiate_bus_reset {
612 * @handle: Handle to the descriptor, written by the kernel 604 * @handle: Handle to the descriptor, written by the kernel
613 * 605 *
614 * Add a descriptor block and optionally a preceding immediate key to the local 606 * Add a descriptor block and optionally a preceding immediate key to the local
615 * node's configuration ROM. 607 * node's Configuration ROM.
616 * 608 *
617 * The @key field specifies the upper 8 bits of the descriptor root directory 609 * The @key field specifies the upper 8 bits of the descriptor root directory
618 * pointer and the @data and @length fields specify the contents. The @key 610 * pointer and the @data and @length fields specify the contents. The @key
@@ -627,9 +619,9 @@ struct fw_cdev_initiate_bus_reset {
627 * If successful, the kernel adds the descriptor and writes back a @handle to 619 * If successful, the kernel adds the descriptor and writes back a @handle to
628 * the kernel-side object to be used for later removal of the descriptor block 620 * the kernel-side object to be used for later removal of the descriptor block
629 * and immediate key. The kernel will also generate a bus reset to signal the 621 * and immediate key. The kernel will also generate a bus reset to signal the
630 * change of the configuration ROM to other nodes. 622 * change of the Configuration ROM to other nodes.
631 * 623 *
632 * This ioctl affects the configuration ROMs of all local nodes. 624 * This ioctl affects the Configuration ROMs of all local nodes.
633 * The ioctl only succeeds on device files which represent a local node. 625 * The ioctl only succeeds on device files which represent a local node.
634 */ 626 */
635struct fw_cdev_add_descriptor { 627struct fw_cdev_add_descriptor {
@@ -641,13 +633,13 @@ struct fw_cdev_add_descriptor {
641}; 633};
642 634
643/** 635/**
644 * struct fw_cdev_remove_descriptor - Remove contents from the configuration ROM 636 * struct fw_cdev_remove_descriptor - Remove contents from the Configuration ROM
645 * @handle: Handle to the descriptor, as returned by the kernel when the 637 * @handle: Handle to the descriptor, as returned by the kernel when the
646 * descriptor was added 638 * descriptor was added
647 * 639 *
648 * Remove a descriptor block and accompanying immediate key from the local 640 * Remove a descriptor block and accompanying immediate key from the local
649 * nodes' configuration ROMs. The kernel will also generate a bus reset to 641 * nodes' Configuration ROMs. The kernel will also generate a bus reset to
650 * signal the change of the configuration ROM to other nodes. 642 * signal the change of the Configuration ROM to other nodes.
651 */ 643 */
652struct fw_cdev_remove_descriptor { 644struct fw_cdev_remove_descriptor {
653 __u32 handle; 645 __u32 handle;
@@ -863,13 +855,8 @@ struct fw_cdev_stop_iso {
863 * @local_time: system time, in microseconds since the Epoch 855 * @local_time: system time, in microseconds since the Epoch
864 * @cycle_timer: Cycle Time register contents 856 * @cycle_timer: Cycle Time register contents
865 * 857 *
866 * The %FW_CDEV_IOC_GET_CYCLE_TIMER ioctl reads the isochronous cycle timer 858 * Same as %FW_CDEV_IOC_GET_CYCLE_TIMER2, but fixed to use %CLOCK_REALTIME
867 * and also the system clock (%CLOCK_REALTIME). This allows to express the 859 * and only with microseconds resolution.
868 * receive time of an isochronous packet as a system time.
869 *
870 * @cycle_timer consists of 7 bits cycleSeconds, 13 bits cycleCount, and
871 * 12 bits cycleOffset, in host byte order. Cf. the Cycle Time register
872 * per IEEE 1394 or Isochronous Cycle Timer register per OHCI-1394.
873 * 860 *
874 * In version 1 and 2 of the ABI, this ioctl returned unreliable (non- 861 * In version 1 and 2 of the ABI, this ioctl returned unreliable (non-
875 * monotonic) @cycle_timer values on certain controllers. 862 * monotonic) @cycle_timer values on certain controllers.
@@ -886,10 +873,17 @@ struct fw_cdev_get_cycle_timer {
886 * @clk_id: input parameter, clock from which to get the system time 873 * @clk_id: input parameter, clock from which to get the system time
887 * @cycle_timer: Cycle Time register contents 874 * @cycle_timer: Cycle Time register contents
888 * 875 *
889 * The %FW_CDEV_IOC_GET_CYCLE_TIMER2 works like 876 * The %FW_CDEV_IOC_GET_CYCLE_TIMER2 ioctl reads the isochronous cycle timer
890 * %FW_CDEV_IOC_GET_CYCLE_TIMER but lets you choose a clock like with POSIX' 877 * and also the system clock. This allows to correlate reception time of
891 * clock_gettime function. Supported @clk_id values are POSIX' %CLOCK_REALTIME 878 * isochronous packets with system time.
892 * and %CLOCK_MONOTONIC and Linux' %CLOCK_MONOTONIC_RAW. 879 *
880 * @clk_id lets you choose a clock like with POSIX' clock_gettime function.
881 * Supported @clk_id values are POSIX' %CLOCK_REALTIME and %CLOCK_MONOTONIC
882 * and Linux' %CLOCK_MONOTONIC_RAW.
883 *
884 * @cycle_timer consists of 7 bits cycleSeconds, 13 bits cycleCount, and
885 * 12 bits cycleOffset, in host byte order. Cf. the Cycle Time register
886 * per IEEE 1394 or Isochronous Cycle Timer register per OHCI-1394.
893 */ 887 */
894struct fw_cdev_get_cycle_timer2 { 888struct fw_cdev_get_cycle_timer2 {
895 __s64 tv_sec; 889 __s64 tv_sec;
@@ -1011,4 +1005,6 @@ struct fw_cdev_receive_phy_packets {
1011 __u64 closure; 1005 __u64 closure;
1012}; 1006};
1013 1007
1008#define FW_CDEV_VERSION 3 /* Meaningless legacy macro; don't use it. */
1009
1014#endif /* _LINUX_FIREWIRE_CDEV_H */ 1010#endif /* _LINUX_FIREWIRE_CDEV_H */
diff --git a/include/linux/firewire.h b/include/linux/firewire.h
index 5e6f42789af..84ccf8e04fa 100644
--- a/include/linux/firewire.h
+++ b/include/linux/firewire.h
@@ -14,7 +14,7 @@
14#include <linux/types.h> 14#include <linux/types.h>
15#include <linux/workqueue.h> 15#include <linux/workqueue.h>
16 16
17#include <asm/atomic.h> 17#include <linux/atomic.h>
18#include <asm/byteorder.h> 18#include <asm/byteorder.h>
19 19
20#define fw_notify(s, args...) printk(KERN_NOTICE KBUILD_MODNAME ": " s, ## args) 20#define fw_notify(s, args...) printk(KERN_NOTICE KBUILD_MODNAME ": " s, ## args)
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 8d5834bcb89..78987e9a384 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -32,7 +32,9 @@
32#define SEEK_SET 0 /* seek relative to beginning of file */ 32#define SEEK_SET 0 /* seek relative to beginning of file */
33#define SEEK_CUR 1 /* seek relative to current file position */ 33#define SEEK_CUR 1 /* seek relative to current file position */
34#define SEEK_END 2 /* seek relative to end of file */ 34#define SEEK_END 2 /* seek relative to end of file */
35#define SEEK_MAX SEEK_END 35#define SEEK_DATA 3 /* seek to the next data */
36#define SEEK_HOLE 4 /* seek to the next hole */
37#define SEEK_MAX SEEK_HOLE
36 38
37struct fstrim_range { 39struct fstrim_range {
38 __u64 start; 40 __u64 start;
@@ -63,6 +65,7 @@ struct inodes_stat_t {
63#define MAY_ACCESS 16 65#define MAY_ACCESS 16
64#define MAY_OPEN 32 66#define MAY_OPEN 32
65#define MAY_CHDIR 64 67#define MAY_CHDIR 64
68#define MAY_NOT_BLOCK 128 /* called from RCU mode, don't block */
66 69
67/* 70/*
68 * flags in file.f_mode. Note that FMODE_READ and FMODE_WRITE must correspond 71 * flags in file.f_mode. Note that FMODE_READ and FMODE_WRITE must correspond
@@ -159,10 +162,8 @@ struct inodes_stat_t {
159#define READA RWA_MASK 162#define READA RWA_MASK
160 163
161#define READ_SYNC (READ | REQ_SYNC) 164#define READ_SYNC (READ | REQ_SYNC)
162#define READ_META (READ | REQ_META)
163#define WRITE_SYNC (WRITE | REQ_SYNC | REQ_NOIDLE) 165#define WRITE_SYNC (WRITE | REQ_SYNC | REQ_NOIDLE)
164#define WRITE_ODIRECT (WRITE | REQ_SYNC) 166#define WRITE_ODIRECT (WRITE | REQ_SYNC)
165#define WRITE_META (WRITE | REQ_META)
166#define WRITE_FLUSH (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_FLUSH) 167#define WRITE_FLUSH (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_FLUSH)
167#define WRITE_FUA (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_FUA) 168#define WRITE_FUA (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_FUA)
168#define WRITE_FLUSH_FUA (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_FLUSH | REQ_FUA) 169#define WRITE_FLUSH_FUA (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_FLUSH | REQ_FUA)
@@ -376,7 +377,6 @@ struct inodes_stat_t {
376 377
377#include <linux/linkage.h> 378#include <linux/linkage.h>
378#include <linux/wait.h> 379#include <linux/wait.h>
379#include <linux/types.h>
380#include <linux/kdev_t.h> 380#include <linux/kdev_t.h>
381#include <linux/dcache.h> 381#include <linux/dcache.h>
382#include <linux/path.h> 382#include <linux/path.h>
@@ -392,8 +392,9 @@ struct inodes_stat_t {
392#include <linux/semaphore.h> 392#include <linux/semaphore.h>
393#include <linux/fiemap.h> 393#include <linux/fiemap.h>
394#include <linux/rculist_bl.h> 394#include <linux/rculist_bl.h>
395#include <linux/shrinker.h>
396#include <linux/atomic.h>
395 397
396#include <asm/atomic.h>
397#include <asm/byteorder.h> 398#include <asm/byteorder.h>
398 399
399struct export_operations; 400struct export_operations;
@@ -736,22 +737,54 @@ struct posix_acl;
736#define ACL_NOT_CACHED ((void *)(-1)) 737#define ACL_NOT_CACHED ((void *)(-1))
737struct inode_obj_id_table; 738struct inode_obj_id_table;
738 739
740#define IOP_FASTPERM 0x0001
741#define IOP_LOOKUP 0x0002
742#define IOP_NOFOLLOW 0x0004
743
744/*
745 * Keep mostly read-only and often accessed (especially for
746 * the RCU path lookup and 'stat' data) fields at the beginning
747 * of the 'struct inode'
748 */
739struct inode { 749struct inode {
740 /* RCU path lookup touches following: */
741 umode_t i_mode; 750 umode_t i_mode;
751 unsigned short i_opflags;
742 uid_t i_uid; 752 uid_t i_uid;
743 gid_t i_gid; 753 gid_t i_gid;
754 unsigned int i_flags;
755
756#ifdef CONFIG_FS_POSIX_ACL
757 struct posix_acl *i_acl;
758 struct posix_acl *i_default_acl;
759#endif
760
744 const struct inode_operations *i_op; 761 const struct inode_operations *i_op;
745 struct super_block *i_sb; 762 struct super_block *i_sb;
763 struct address_space *i_mapping;
746 764
747 spinlock_t i_lock; /* i_blocks, i_bytes, maybe i_size */
748 unsigned int i_flags;
749 unsigned long i_state;
750#ifdef CONFIG_SECURITY 765#ifdef CONFIG_SECURITY
751 void *i_security; 766 void *i_security;
752#endif 767#endif
753 struct mutex i_mutex;
754 768
769 /* Stat data, not accessed from path walking */
770 unsigned long i_ino;
771 unsigned int i_nlink;
772 dev_t i_rdev;
773 loff_t i_size;
774 struct timespec i_atime;
775 struct timespec i_mtime;
776 struct timespec i_ctime;
777 unsigned int i_blkbits;
778 blkcnt_t i_blocks;
779
780#ifdef __NEED_I_SIZE_ORDERED
781 seqcount_t i_size_seqcount;
782#endif
783
784 /* Misc */
785 unsigned long i_state;
786 spinlock_t i_lock; /* i_blocks, i_bytes, maybe i_size */
787 struct mutex i_mutex;
755 788
756 unsigned long dirtied_when; /* jiffies of first dirtying */ 789 unsigned long dirtied_when; /* jiffies of first dirtying */
757 790
@@ -763,25 +796,12 @@ struct inode {
763 struct list_head i_dentry; 796 struct list_head i_dentry;
764 struct rcu_head i_rcu; 797 struct rcu_head i_rcu;
765 }; 798 };
766 unsigned long i_ino;
767 atomic_t i_count; 799 atomic_t i_count;
768 unsigned int i_nlink;
769 dev_t i_rdev;
770 unsigned int i_blkbits;
771 u64 i_version; 800 u64 i_version;
772 loff_t i_size;
773#ifdef __NEED_I_SIZE_ORDERED
774 seqcount_t i_size_seqcount;
775#endif
776 struct timespec i_atime;
777 struct timespec i_mtime;
778 struct timespec i_ctime;
779 blkcnt_t i_blocks;
780 unsigned short i_bytes; 801 unsigned short i_bytes;
781 struct rw_semaphore i_alloc_sem; 802 atomic_t i_dio_count;
782 const struct file_operations *i_fop; /* former ->i_op->default_file_ops */ 803 const struct file_operations *i_fop; /* former ->i_op->default_file_ops */
783 struct file_lock *i_flock; 804 struct file_lock *i_flock;
784 struct address_space *i_mapping;
785 struct address_space i_data; 805 struct address_space i_data;
786#ifdef CONFIG_QUOTA 806#ifdef CONFIG_QUOTA
787 struct dquot *i_dquot[MAXQUOTAS]; 807 struct dquot *i_dquot[MAXQUOTAS];
@@ -804,12 +824,6 @@ struct inode {
804 atomic_t i_readcount; /* struct files open RO */ 824 atomic_t i_readcount; /* struct files open RO */
805#endif 825#endif
806 atomic_t i_writecount; 826 atomic_t i_writecount;
807#ifdef CONFIG_FS_POSIX_ACL
808 struct posix_acl *i_acl;
809 struct posix_acl *i_default_acl;
810#endif
811 struct list_head i_obj_list;
812 struct mutex i_obj_mutex;
813 void *i_private; /* fs or device private pointer */ 827 void *i_private; /* fs or device private pointer */
814}; 828};
815 829
@@ -1072,12 +1086,12 @@ struct file_lock_operations {
1072}; 1086};
1073 1087
1074struct lock_manager_operations { 1088struct lock_manager_operations {
1075 int (*fl_compare_owner)(struct file_lock *, struct file_lock *); 1089 int (*lm_compare_owner)(struct file_lock *, struct file_lock *);
1076 void (*fl_notify)(struct file_lock *); /* unblock callback */ 1090 void (*lm_notify)(struct file_lock *); /* unblock callback */
1077 int (*fl_grant)(struct file_lock *, struct file_lock *, int); 1091 int (*lm_grant)(struct file_lock *, struct file_lock *, int);
1078 void (*fl_release_private)(struct file_lock *); 1092 void (*lm_release_private)(struct file_lock *);
1079 void (*fl_break)(struct file_lock *); 1093 void (*lm_break)(struct file_lock *);
1080 int (*fl_change)(struct file_lock **, int); 1094 int (*lm_change)(struct file_lock **, int);
1081}; 1095};
1082 1096
1083struct lock_manager { 1097struct lock_manager {
@@ -1399,6 +1413,11 @@ struct super_block {
1399 struct list_head s_dentry_lru; /* unused dentry lru */ 1413 struct list_head s_dentry_lru; /* unused dentry lru */
1400 int s_nr_dentry_unused; /* # of dentry on lru */ 1414 int s_nr_dentry_unused; /* # of dentry on lru */
1401 1415
1416 /* s_inode_lru_lock protects s_inode_lru and s_nr_inodes_unused */
1417 spinlock_t s_inode_lru_lock ____cacheline_aligned_in_smp;
1418 struct list_head s_inode_lru; /* unused inode lru */
1419 int s_nr_inodes_unused; /* # of inodes on lru */
1420
1402 struct block_device *s_bdev; 1421 struct block_device *s_bdev;
1403 struct backing_dev_info *s_bdi; 1422 struct backing_dev_info *s_bdi;
1404 struct mtd_info *s_mtd; 1423 struct mtd_info *s_mtd;
@@ -1441,8 +1460,14 @@ struct super_block {
1441 * Saved pool identifier for cleancache (-1 means none) 1460 * Saved pool identifier for cleancache (-1 means none)
1442 */ 1461 */
1443 int cleancache_poolid; 1462 int cleancache_poolid;
1463
1464 struct shrinker s_shrink; /* per-sb shrinker handle */
1444}; 1465};
1445 1466
1467/* superblock cache pruning functions */
1468extern void prune_icache_sb(struct super_block *sb, int nr_to_scan);
1469extern void prune_dcache_sb(struct super_block *sb, int nr_to_scan);
1470
1446extern struct timespec current_fs_time(struct super_block *sb); 1471extern struct timespec current_fs_time(struct super_block *sb);
1447 1472
1448/* 1473/*
@@ -1457,10 +1482,6 @@ enum {
1457#define vfs_check_frozen(sb, level) \ 1482#define vfs_check_frozen(sb, level) \
1458 wait_event((sb)->s_wait_unfrozen, ((sb)->s_frozen < (level))) 1483 wait_event((sb)->s_wait_unfrozen, ((sb)->s_frozen < (level)))
1459 1484
1460#define get_fs_excl() atomic_inc(&current->fs_excl)
1461#define put_fs_excl() atomic_dec(&current->fs_excl)
1462#define has_fs_excl() atomic_read(&current->fs_excl)
1463
1464/* 1485/*
1465 * until VFS tracks user namespaces for inodes, just make all files 1486 * until VFS tracks user namespaces for inodes, just make all files
1466 * belong to init_user_ns 1487 * belong to init_user_ns
@@ -1493,7 +1514,6 @@ extern void dentry_unhash(struct dentry *dentry);
1493/* 1514/*
1494 * VFS file helper functions. 1515 * VFS file helper functions.
1495 */ 1516 */
1496extern int file_permission(struct file *, int);
1497extern void inode_init_owner(struct inode *inode, const struct inode *dir, 1517extern void inode_init_owner(struct inode *inode, const struct inode *dir,
1498 mode_t mode); 1518 mode_t mode);
1499/* 1519/*
@@ -1541,11 +1561,6 @@ struct block_device_operations;
1541#define HAVE_COMPAT_IOCTL 1 1561#define HAVE_COMPAT_IOCTL 1
1542#define HAVE_UNLOCKED_IOCTL 1 1562#define HAVE_UNLOCKED_IOCTL 1
1543 1563
1544/*
1545 * NOTE:
1546 * all file operations except setlease can be called without
1547 * the big kernel lock held in all filesystems.
1548 */
1549struct file_operations { 1564struct file_operations {
1550 struct module *owner; 1565 struct module *owner;
1551 loff_t (*llseek) (struct file *, loff_t, int); 1566 loff_t (*llseek) (struct file *, loff_t, int);
@@ -1561,7 +1576,7 @@ struct file_operations {
1561 int (*open) (struct inode *, struct file *); 1576 int (*open) (struct inode *, struct file *);
1562 int (*flush) (struct file *, fl_owner_t id); 1577 int (*flush) (struct file *, fl_owner_t id);
1563 int (*release) (struct inode *, struct file *); 1578 int (*release) (struct inode *, struct file *);
1564 int (*fsync) (struct file *, int datasync); 1579 int (*fsync) (struct file *, loff_t, loff_t, int datasync);
1565 int (*aio_fsync) (struct kiocb *, int datasync); 1580 int (*aio_fsync) (struct kiocb *, int datasync);
1566 int (*fasync) (int, struct file *, int); 1581 int (*fasync) (int, struct file *, int);
1567 int (*lock) (struct file *, int, struct file_lock *); 1582 int (*lock) (struct file *, int, struct file_lock *);
@@ -1576,13 +1591,11 @@ struct file_operations {
1576 loff_t len); 1591 loff_t len);
1577}; 1592};
1578 1593
1579#define IPERM_FLAG_RCU 0x0001
1580
1581struct inode_operations { 1594struct inode_operations {
1582 struct dentry * (*lookup) (struct inode *,struct dentry *, struct nameidata *); 1595 struct dentry * (*lookup) (struct inode *,struct dentry *, struct nameidata *);
1583 void * (*follow_link) (struct dentry *, struct nameidata *); 1596 void * (*follow_link) (struct dentry *, struct nameidata *);
1584 int (*permission) (struct inode *, int, unsigned int); 1597 int (*permission) (struct inode *, int);
1585 int (*check_acl)(struct inode *, int, unsigned int); 1598 struct posix_acl * (*get_acl)(struct inode *, int);
1586 1599
1587 int (*readlink) (struct dentry *, char __user *,int); 1600 int (*readlink) (struct dentry *, char __user *,int);
1588 void (*put_link) (struct dentry *, struct nameidata *, void *); 1601 void (*put_link) (struct dentry *, struct nameidata *, void *);
@@ -1648,6 +1661,8 @@ struct super_operations {
1648 ssize_t (*quota_write)(struct super_block *, int, const char *, size_t, loff_t); 1661 ssize_t (*quota_write)(struct super_block *, int, const char *, size_t, loff_t);
1649#endif 1662#endif
1650 int (*bdev_try_to_free_page)(struct super_block*, struct page*, gfp_t); 1663 int (*bdev_try_to_free_page)(struct super_block*, struct page*, gfp_t);
1664 int (*nr_cached_objects)(struct super_block *);
1665 void (*free_cached_objects)(struct super_block *, int);
1651}; 1666};
1652 1667
1653/* 1668/*
@@ -1696,6 +1711,10 @@ struct super_operations {
1696 * set during data writeback, and cleared with a wakeup 1711 * set during data writeback, and cleared with a wakeup
1697 * on the bit address once it is done. 1712 * on the bit address once it is done.
1698 * 1713 *
1714 * I_REFERENCED Marks the inode as recently references on the LRU list.
1715 *
1716 * I_DIO_WAKEUP Never set. Only used as a key for wait_on_bit().
1717 *
1699 * Q: What is the difference between I_WILL_FREE and I_FREEING? 1718 * Q: What is the difference between I_WILL_FREE and I_FREEING?
1700 */ 1719 */
1701#define I_DIRTY_SYNC (1 << 0) 1720#define I_DIRTY_SYNC (1 << 0)
@@ -1709,6 +1728,8 @@ struct super_operations {
1709#define __I_SYNC 7 1728#define __I_SYNC 7
1710#define I_SYNC (1 << __I_SYNC) 1729#define I_SYNC (1 << __I_SYNC)
1711#define I_REFERENCED (1 << 8) 1730#define I_REFERENCED (1 << 8)
1731#define __I_DIO_WAKEUP 9
1732#define I_DIO_WAKEUP (1 << I_DIO_WAKEUP)
1712 1733
1713#define I_DIRTY (I_DIRTY_SYNC | I_DIRTY_DATASYNC | I_DIRTY_PAGES) 1734#define I_DIRTY (I_DIRTY_SYNC | I_DIRTY_DATASYNC | I_DIRTY_PAGES)
1714 1735
@@ -1819,7 +1840,6 @@ struct file_system_type {
1819 struct lock_class_key i_lock_key; 1840 struct lock_class_key i_lock_key;
1820 struct lock_class_key i_mutex_key; 1841 struct lock_class_key i_mutex_key;
1821 struct lock_class_key i_mutex_dir_key; 1842 struct lock_class_key i_mutex_dir_key;
1822 struct lock_class_key i_alloc_sem_key;
1823}; 1843};
1824 1844
1825extern struct dentry *mount_ns(struct file_system_type *fs_type, int flags, 1845extern struct dentry *mount_ns(struct file_system_type *fs_type, int flags,
@@ -1840,6 +1860,8 @@ void kill_litter_super(struct super_block *sb);
1840void deactivate_super(struct super_block *sb); 1860void deactivate_super(struct super_block *sb);
1841void deactivate_locked_super(struct super_block *sb); 1861void deactivate_locked_super(struct super_block *sb);
1842int set_anon_super(struct super_block *s, void *data); 1862int set_anon_super(struct super_block *s, void *data);
1863int get_anon_bdev(dev_t *);
1864void free_anon_bdev(dev_t);
1843struct super_block *sget(struct file_system_type *type, 1865struct super_block *sget(struct file_system_type *type,
1844 int (*test)(struct super_block *,void *), 1866 int (*test)(struct super_block *,void *),
1845 int (*set)(struct super_block *,void *), 1867 int (*set)(struct super_block *,void *),
@@ -1872,6 +1894,7 @@ extern int register_filesystem(struct file_system_type *);
1872extern int unregister_filesystem(struct file_system_type *); 1894extern int unregister_filesystem(struct file_system_type *);
1873extern struct vfsmount *kern_mount_data(struct file_system_type *, void *data); 1895extern struct vfsmount *kern_mount_data(struct file_system_type *, void *data);
1874#define kern_mount(type) kern_mount_data(type, NULL) 1896#define kern_mount(type) kern_mount_data(type, NULL)
1897extern void kern_unmount(struct vfsmount *mnt);
1875extern int may_umount_tree(struct vfsmount *); 1898extern int may_umount_tree(struct vfsmount *);
1876extern int may_umount(struct vfsmount *); 1899extern int may_umount(struct vfsmount *);
1877extern long do_mount(char *, char *, char *, unsigned long, void *); 1900extern long do_mount(char *, char *, char *, unsigned long, void *);
@@ -1885,6 +1908,7 @@ extern int fd_statfs(int, struct kstatfs *);
1885extern int statfs_by_dentry(struct dentry *, struct kstatfs *); 1908extern int statfs_by_dentry(struct dentry *, struct kstatfs *);
1886extern int freeze_super(struct super_block *super); 1909extern int freeze_super(struct super_block *super);
1887extern int thaw_super(struct super_block *super); 1910extern int thaw_super(struct super_block *super);
1911extern bool our_mnt(struct vfsmount *mnt);
1888 1912
1889extern int current_umask(void); 1913extern int current_umask(void);
1890 1914
@@ -2191,16 +2215,38 @@ extern sector_t bmap(struct inode *, sector_t);
2191#endif 2215#endif
2192extern int notify_change(struct dentry *, struct iattr *); 2216extern int notify_change(struct dentry *, struct iattr *);
2193extern int inode_permission(struct inode *, int); 2217extern int inode_permission(struct inode *, int);
2194extern int generic_permission(struct inode *, int, unsigned int, 2218extern int generic_permission(struct inode *, int);
2195 int (*check_acl)(struct inode *, int, unsigned int));
2196 2219
2197static inline bool execute_ok(struct inode *inode) 2220static inline bool execute_ok(struct inode *inode)
2198{ 2221{
2199 return (inode->i_mode & S_IXUGO) || S_ISDIR(inode->i_mode); 2222 return (inode->i_mode & S_IXUGO) || S_ISDIR(inode->i_mode);
2200} 2223}
2201 2224
2202extern int get_write_access(struct inode *); 2225/*
2203extern int deny_write_access(struct file *); 2226 * get_write_access() gets write permission for a file.
2227 * put_write_access() releases this write permission.
2228 * This is used for regular files.
2229 * We cannot support write (and maybe mmap read-write shared) accesses and
2230 * MAP_DENYWRITE mmappings simultaneously. The i_writecount field of an inode
2231 * can have the following values:
2232 * 0: no writers, no VM_DENYWRITE mappings
2233 * < 0: (-i_writecount) vm_area_structs with VM_DENYWRITE set exist
2234 * > 0: (i_writecount) users are writing to the file.
2235 *
2236 * Normally we operate on that counter with atomic_{inc,dec} and it's safe
2237 * except for the cases where we don't hold i_writecount yet. Then we need to
2238 * use {get,deny}_write_access() - these functions check the sign and refuse
2239 * to do the change if sign is wrong.
2240 */
2241static inline int get_write_access(struct inode *inode)
2242{
2243 return atomic_inc_unless_negative(&inode->i_writecount) ? 0 : -ETXTBSY;
2244}
2245static inline int deny_write_access(struct file *file)
2246{
2247 struct inode *inode = file->f_path.dentry->d_inode;
2248 return atomic_dec_unless_positive(&inode->i_writecount) ? 0 : -ETXTBSY;
2249}
2204static inline void put_write_access(struct inode * inode) 2250static inline void put_write_access(struct inode * inode)
2205{ 2251{
2206 atomic_dec(&inode->i_writecount); 2252 atomic_dec(&inode->i_writecount);
@@ -2272,6 +2318,11 @@ extern struct inode * iget5_locked(struct super_block *, unsigned long, int (*te
2272extern struct inode * iget_locked(struct super_block *, unsigned long); 2318extern struct inode * iget_locked(struct super_block *, unsigned long);
2273extern int insert_inode_locked4(struct inode *, unsigned long, int (*test)(struct inode *, void *), void *); 2319extern int insert_inode_locked4(struct inode *, unsigned long, int (*test)(struct inode *, void *), void *);
2274extern int insert_inode_locked(struct inode *); 2320extern int insert_inode_locked(struct inode *);
2321#ifdef CONFIG_DEBUG_LOCK_ALLOC
2322extern void lockdep_annotate_inode_mutex_key(struct inode *inode);
2323#else
2324static inline void lockdep_annotate_inode_mutex_key(struct inode *inode) { };
2325#endif
2275extern void unlock_new_inode(struct inode *); 2326extern void unlock_new_inode(struct inode *);
2276extern unsigned int get_next_ino(void); 2327extern unsigned int get_next_ino(void);
2277 2328
@@ -2279,17 +2330,25 @@ extern void __iget(struct inode * inode);
2279extern void iget_failed(struct inode *); 2330extern void iget_failed(struct inode *);
2280extern void end_writeback(struct inode *); 2331extern void end_writeback(struct inode *);
2281extern void __destroy_inode(struct inode *); 2332extern void __destroy_inode(struct inode *);
2282extern struct inode *new_inode(struct super_block *); 2333extern struct inode *new_inode_pseudo(struct super_block *sb);
2334extern struct inode *new_inode(struct super_block *sb);
2283extern void free_inode_nonrcu(struct inode *inode); 2335extern void free_inode_nonrcu(struct inode *inode);
2284extern int should_remove_suid(struct dentry *); 2336extern int should_remove_suid(struct dentry *);
2285extern int file_remove_suid(struct file *); 2337extern int file_remove_suid(struct file *);
2286 2338
2287extern void __insert_inode_hash(struct inode *, unsigned long hashval); 2339extern void __insert_inode_hash(struct inode *, unsigned long hashval);
2288extern void remove_inode_hash(struct inode *);
2289static inline void insert_inode_hash(struct inode *inode) 2340static inline void insert_inode_hash(struct inode *inode)
2290{ 2341{
2291 __insert_inode_hash(inode, inode->i_ino); 2342 __insert_inode_hash(inode, inode->i_ino);
2292} 2343}
2344
2345extern void __remove_inode_hash(struct inode *);
2346static inline void remove_inode_hash(struct inode *inode)
2347{
2348 if (!inode_unhashed(inode))
2349 __remove_inode_hash(inode);
2350}
2351
2293extern void inode_sb_list_add(struct inode *inode); 2352extern void inode_sb_list_add(struct inode *inode);
2294 2353
2295#ifdef CONFIG_BLOCK 2354#ifdef CONFIG_BLOCK
@@ -2320,7 +2379,8 @@ extern int generic_segment_checks(const struct iovec *iov,
2320/* fs/block_dev.c */ 2379/* fs/block_dev.c */
2321extern ssize_t blkdev_aio_write(struct kiocb *iocb, const struct iovec *iov, 2380extern ssize_t blkdev_aio_write(struct kiocb *iocb, const struct iovec *iov,
2322 unsigned long nr_segs, loff_t pos); 2381 unsigned long nr_segs, loff_t pos);
2323extern int blkdev_fsync(struct file *filp, int datasync); 2382extern int blkdev_fsync(struct file *filp, loff_t start, loff_t end,
2383 int datasync);
2324 2384
2325/* fs/splice.c */ 2385/* fs/splice.c */
2326extern ssize_t generic_file_splice_read(struct file *, loff_t *, 2386extern ssize_t generic_file_splice_read(struct file *, loff_t *,
@@ -2371,6 +2431,8 @@ enum {
2371}; 2431};
2372 2432
2373void dio_end_io(struct bio *bio, int error); 2433void dio_end_io(struct bio *bio, int error);
2434void inode_dio_wait(struct inode *inode);
2435void inode_dio_done(struct inode *inode);
2374 2436
2375ssize_t __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode, 2437ssize_t __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode,
2376 struct block_device *bdev, const struct iovec *iov, loff_t offset, 2438 struct block_device *bdev, const struct iovec *iov, loff_t offset,
@@ -2378,14 +2440,17 @@ ssize_t __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode,
2378 dio_submit_t submit_io, int flags); 2440 dio_submit_t submit_io, int flags);
2379 2441
2380static inline ssize_t blockdev_direct_IO(int rw, struct kiocb *iocb, 2442static inline ssize_t blockdev_direct_IO(int rw, struct kiocb *iocb,
2381 struct inode *inode, struct block_device *bdev, const struct iovec *iov, 2443 struct inode *inode, const struct iovec *iov, loff_t offset,
2382 loff_t offset, unsigned long nr_segs, get_block_t get_block, 2444 unsigned long nr_segs, get_block_t get_block)
2383 dio_iodone_t end_io)
2384{ 2445{
2385 return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset, 2446 return __blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev, iov,
2386 nr_segs, get_block, end_io, NULL, 2447 offset, nr_segs, get_block, NULL, NULL,
2387 DIO_LOCKING | DIO_SKIP_HOLES); 2448 DIO_LOCKING | DIO_SKIP_HOLES);
2388} 2449}
2450#else
2451static inline void inode_dio_wait(struct inode *inode)
2452{
2453}
2389#endif 2454#endif
2390 2455
2391extern const struct file_operations generic_ro_fops; 2456extern const struct file_operations generic_ro_fops;
@@ -2435,6 +2500,8 @@ extern struct super_block *get_active_super(struct block_device *bdev);
2435extern struct super_block *user_get_super(dev_t); 2500extern struct super_block *user_get_super(dev_t);
2436extern void drop_super(struct super_block *sb); 2501extern void drop_super(struct super_block *sb);
2437extern void iterate_supers(void (*)(struct super_block *, void *), void *); 2502extern void iterate_supers(void (*)(struct super_block *, void *), void *);
2503extern void iterate_supers_type(struct file_system_type *,
2504 void (*)(struct super_block *, void *), void *);
2438 2505
2439extern int dcache_dir_open(struct inode *, struct file *); 2506extern int dcache_dir_open(struct inode *, struct file *);
2440extern int dcache_dir_close(struct inode *, struct file *); 2507extern int dcache_dir_close(struct inode *, struct file *);
@@ -2447,7 +2514,7 @@ extern int simple_link(struct dentry *, struct inode *, struct dentry *);
2447extern int simple_unlink(struct inode *, struct dentry *); 2514extern int simple_unlink(struct inode *, struct dentry *);
2448extern int simple_rmdir(struct inode *, struct dentry *); 2515extern int simple_rmdir(struct inode *, struct dentry *);
2449extern int simple_rename(struct inode *, struct dentry *, struct inode *, struct dentry *); 2516extern int simple_rename(struct inode *, struct dentry *, struct inode *, struct dentry *);
2450extern int noop_fsync(struct file *, int); 2517extern int noop_fsync(struct file *, loff_t, loff_t, int);
2451extern int simple_empty(struct dentry *); 2518extern int simple_empty(struct dentry *);
2452extern int simple_readpage(struct file *file, struct page *page); 2519extern int simple_readpage(struct file *file, struct page *page);
2453extern int simple_write_begin(struct file *file, struct address_space *mapping, 2520extern int simple_write_begin(struct file *file, struct address_space *mapping,
@@ -2472,7 +2539,7 @@ extern ssize_t simple_read_from_buffer(void __user *to, size_t count,
2472extern ssize_t simple_write_to_buffer(void *to, size_t available, loff_t *ppos, 2539extern ssize_t simple_write_to_buffer(void *to, size_t available, loff_t *ppos,
2473 const void __user *from, size_t count); 2540 const void __user *from, size_t count);
2474 2541
2475extern int generic_file_fsync(struct file *, int); 2542extern int generic_file_fsync(struct file *, loff_t, loff_t, int);
2476 2543
2477extern int generic_check_addressable(unsigned, u64); 2544extern int generic_check_addressable(unsigned, u64);
2478 2545
diff --git a/include/linux/fsl_devices.h b/include/linux/fsl_devices.h
index fffdf00f87b..1962102d132 100644
--- a/include/linux/fsl_devices.h
+++ b/include/linux/fsl_devices.h
@@ -58,6 +58,13 @@ enum fsl_usb2_phy_modes {
58 FSL_USB2_PHY_SERIAL, 58 FSL_USB2_PHY_SERIAL,
59}; 59};
60 60
61enum fsl_usb2_phy_types {
62 FSL_USB2_PHY_TYPE_UTMIP = 1,
63 FSL_USB2_PHY_TYPE_ULPI = 2,
64 FSL_USB2_PHY_TYPE_HSIC = 3,
65 FSL_USB2_PHY_TYPE_ICUSB = 4,
66};
67
61struct clk; 68struct clk;
62struct platform_device; 69struct platform_device;
63 70
@@ -72,7 +79,6 @@ struct fsl_usb2_platform_data {
72 void (*exit)(struct platform_device *); 79 void (*exit)(struct platform_device *);
73 void __iomem *regs; /* ioremap'd register base */ 80 void __iomem *regs; /* ioremap'd register base */
74 struct clk *clk; 81 struct clk *clk;
75 unsigned power_budget; /* hcd->power_budget */
76 unsigned big_endian_mmio:1; 82 unsigned big_endian_mmio:1;
77 unsigned big_endian_desc:1; 83 unsigned big_endian_desc:1;
78 unsigned es:1; /* need USBMODE:ES */ 84 unsigned es:1; /* need USBMODE:ES */
@@ -95,6 +101,9 @@ struct fsl_usb2_platform_data {
95 u32 pm_configured_flag; 101 u32 pm_configured_flag;
96 u32 pm_portsc; 102 u32 pm_portsc;
97 u32 pm_usbgenctrl; 103 u32 pm_usbgenctrl;
104
105 void *phy_config;
106 enum fsl_usb2_phy_types usb_phy_type;
98}; 107};
99 108
100/* Flags in fsl_usb2_mph_platform_data */ 109/* Flags in fsl_usb2_mph_platform_data */
diff --git a/include/linux/fsl_hypervisor.h b/include/linux/fsl_hypervisor.h
new file mode 100644
index 00000000000..1cebaeeeef5
--- /dev/null
+++ b/include/linux/fsl_hypervisor.h
@@ -0,0 +1,241 @@
1/*
2 * Freescale hypervisor ioctl and kernel interface
3 *
4 * Copyright (C) 2008-2011 Freescale Semiconductor, Inc.
5 * Author: Timur Tabi <timur@freescale.com>
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions are met:
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * * Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * * Neither the name of Freescale Semiconductor nor the
15 * names of its contributors may be used to endorse or promote products
16 * derived from this software without specific prior written permission.
17 *
18 *
19 * ALTERNATIVELY, this software may be distributed under the terms of the
20 * GNU General Public License ("GPL") as published by the Free Software
21 * Foundation, either version 2 of that License or (at your option) any
22 * later version.
23 *
24 * This software is provided by Freescale Semiconductor "as is" and any
25 * express or implied warranties, including, but not limited to, the implied
26 * warranties of merchantability and fitness for a particular purpose are
27 * disclaimed. In no event shall Freescale Semiconductor be liable for any
28 * direct, indirect, incidental, special, exemplary, or consequential damages
29 * (including, but not limited to, procurement of substitute goods or services;
30 * loss of use, data, or profits; or business interruption) however caused and
31 * on any theory of liability, whether in contract, strict liability, or tort
32 * (including negligence or otherwise) arising in any way out of the use of this
33 * software, even if advised of the possibility of such damage.
34 *
35 * This file is used by the Freescale hypervisor management driver. It can
36 * also be included by applications that need to communicate with the driver
37 * via the ioctl interface.
38 */
39
40#ifndef FSL_HYPERVISOR_H
41#define FSL_HYPERVISOR_H
42
43#include <linux/types.h>
44
45/**
46 * struct fsl_hv_ioctl_restart - restart a partition
47 * @ret: return error code from the hypervisor
48 * @partition: the ID of the partition to restart, or -1 for the
49 * calling partition
50 *
51 * Used by FSL_HV_IOCTL_PARTITION_RESTART
52 */
53struct fsl_hv_ioctl_restart {
54 __u32 ret;
55 __u32 partition;
56};
57
58/**
59 * struct fsl_hv_ioctl_status - get a partition's status
60 * @ret: return error code from the hypervisor
61 * @partition: the ID of the partition to query, or -1 for the
62 * calling partition
63 * @status: The returned status of the partition
64 *
65 * Used by FSL_HV_IOCTL_PARTITION_GET_STATUS
66 *
67 * Values of 'status':
68 * 0 = Stopped
69 * 1 = Running
70 * 2 = Starting
71 * 3 = Stopping
72 */
73struct fsl_hv_ioctl_status {
74 __u32 ret;
75 __u32 partition;
76 __u32 status;
77};
78
79/**
80 * struct fsl_hv_ioctl_start - start a partition
81 * @ret: return error code from the hypervisor
82 * @partition: the ID of the partition to control
83 * @entry_point: The offset within the guest IMA to start execution
84 * @load: If non-zero, reload the partition's images before starting
85 *
86 * Used by FSL_HV_IOCTL_PARTITION_START
87 */
88struct fsl_hv_ioctl_start {
89 __u32 ret;
90 __u32 partition;
91 __u32 entry_point;
92 __u32 load;
93};
94
95/**
96 * struct fsl_hv_ioctl_stop - stop a partition
97 * @ret: return error code from the hypervisor
98 * @partition: the ID of the partition to stop, or -1 for the calling
99 * partition
100 *
101 * Used by FSL_HV_IOCTL_PARTITION_STOP
102 */
103struct fsl_hv_ioctl_stop {
104 __u32 ret;
105 __u32 partition;
106};
107
108/**
109 * struct fsl_hv_ioctl_memcpy - copy memory between partitions
110 * @ret: return error code from the hypervisor
111 * @source: the partition ID of the source partition, or -1 for this
112 * partition
113 * @target: the partition ID of the target partition, or -1 for this
114 * partition
115 * @reserved: reserved, must be set to 0
116 * @local_addr: user-space virtual address of a buffer in the local
117 * partition
118 * @remote_addr: guest physical address of a buffer in the
119 * remote partition
120 * @count: the number of bytes to copy. Both the local and remote
121 * buffers must be at least 'count' bytes long
122 *
123 * Used by FSL_HV_IOCTL_MEMCPY
124 *
125 * The 'local' partition is the partition that calls this ioctl. The
126 * 'remote' partition is a different partition. The data is copied from
127 * the 'source' paritition' to the 'target' partition.
128 *
129 * The buffer in the remote partition must be guest physically
130 * contiguous.
131 *
132 * This ioctl does not support copying memory between two remote
133 * partitions or within the same partition, so either 'source' or
134 * 'target' (but not both) must be -1. In other words, either
135 *
136 * source == local and target == remote
137 * or
138 * source == remote and target == local
139 */
140struct fsl_hv_ioctl_memcpy {
141 __u32 ret;
142 __u32 source;
143 __u32 target;
144 __u32 reserved; /* padding to ensure local_vaddr is aligned */
145 __u64 local_vaddr;
146 __u64 remote_paddr;
147 __u64 count;
148};
149
150/**
151 * struct fsl_hv_ioctl_doorbell - ring a doorbell
152 * @ret: return error code from the hypervisor
153 * @doorbell: the handle of the doorbell to ring doorbell
154 *
155 * Used by FSL_HV_IOCTL_DOORBELL
156 */
157struct fsl_hv_ioctl_doorbell {
158 __u32 ret;
159 __u32 doorbell;
160};
161
162/**
163 * struct fsl_hv_ioctl_prop - get/set a device tree property
164 * @ret: return error code from the hypervisor
165 * @handle: handle of partition whose tree to access
166 * @path: virtual address of path name of node to access
167 * @propname: virtual address of name of property to access
168 * @propval: virtual address of property data buffer
169 * @proplen: Size of property data buffer
170 * @reserved: reserved, must be set to 0
171 *
172 * Used by FSL_HV_IOCTL_DOORBELL
173 */
174struct fsl_hv_ioctl_prop {
175 __u32 ret;
176 __u32 handle;
177 __u64 path;
178 __u64 propname;
179 __u64 propval;
180 __u32 proplen;
181 __u32 reserved; /* padding to ensure structure is aligned */
182};
183
184/* The ioctl type, documented in ioctl-number.txt */
185#define FSL_HV_IOCTL_TYPE 0xAF
186
187/* Restart another partition */
188#define FSL_HV_IOCTL_PARTITION_RESTART \
189 _IOWR(FSL_HV_IOCTL_TYPE, 1, struct fsl_hv_ioctl_restart)
190
191/* Get a partition's status */
192#define FSL_HV_IOCTL_PARTITION_GET_STATUS \
193 _IOWR(FSL_HV_IOCTL_TYPE, 2, struct fsl_hv_ioctl_status)
194
195/* Boot another partition */
196#define FSL_HV_IOCTL_PARTITION_START \
197 _IOWR(FSL_HV_IOCTL_TYPE, 3, struct fsl_hv_ioctl_start)
198
199/* Stop this or another partition */
200#define FSL_HV_IOCTL_PARTITION_STOP \
201 _IOWR(FSL_HV_IOCTL_TYPE, 4, struct fsl_hv_ioctl_stop)
202
203/* Copy data from one partition to another */
204#define FSL_HV_IOCTL_MEMCPY \
205 _IOWR(FSL_HV_IOCTL_TYPE, 5, struct fsl_hv_ioctl_memcpy)
206
207/* Ring a doorbell */
208#define FSL_HV_IOCTL_DOORBELL \
209 _IOWR(FSL_HV_IOCTL_TYPE, 6, struct fsl_hv_ioctl_doorbell)
210
211/* Get a property from another guest's device tree */
212#define FSL_HV_IOCTL_GETPROP \
213 _IOWR(FSL_HV_IOCTL_TYPE, 7, struct fsl_hv_ioctl_prop)
214
215/* Set a property in another guest's device tree */
216#define FSL_HV_IOCTL_SETPROP \
217 _IOWR(FSL_HV_IOCTL_TYPE, 8, struct fsl_hv_ioctl_prop)
218
219#ifdef __KERNEL__
220
221/**
222 * fsl_hv_event_register() - register a callback for failover events
223 * @nb: pointer to caller-supplied notifier_block structure
224 *
225 * This function is called by device drivers to register their callback
226 * functions for fail-over events.
227 *
228 * The caller should allocate a notifier_block object and initialize the
229 * 'priority' and 'notifier_call' fields.
230 */
231int fsl_hv_failover_register(struct notifier_block *nb);
232
233/**
234 * fsl_hv_event_unregister() - unregister a callback for failover events
235 * @nb: the same 'nb' used in previous fsl_hv_failover_register call
236 */
237int fsl_hv_failover_unregister(struct notifier_block *nb);
238
239#endif
240
241#endif
diff --git a/include/linux/fsnotify_backend.h b/include/linux/fsnotify_backend.h
index 69ad89b5048..91d0e0a34ef 100644
--- a/include/linux/fsnotify_backend.h
+++ b/include/linux/fsnotify_backend.h
@@ -16,7 +16,7 @@
16#include <linux/spinlock.h> 16#include <linux/spinlock.h>
17#include <linux/types.h> 17#include <linux/types.h>
18 18
19#include <asm/atomic.h> 19#include <linux/atomic.h>
20 20
21/* 21/*
22 * IN_* from inotfy.h lines up EXACTLY with FS_*, this is so we can easily 22 * IN_* from inotfy.h lines up EXACTLY with FS_*, this is so we can easily
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index 9d88e1cb5db..f0c0e8a47ae 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -19,6 +19,8 @@
19 19
20#include <asm/ftrace.h> 20#include <asm/ftrace.h>
21 21
22struct ftrace_hash;
23
22#ifdef CONFIG_FUNCTION_TRACER 24#ifdef CONFIG_FUNCTION_TRACER
23 25
24extern int ftrace_enabled; 26extern int ftrace_enabled;
@@ -29,8 +31,6 @@ ftrace_enable_sysctl(struct ctl_table *table, int write,
29 31
30typedef void (*ftrace_func_t)(unsigned long ip, unsigned long parent_ip); 32typedef void (*ftrace_func_t)(unsigned long ip, unsigned long parent_ip);
31 33
32struct ftrace_hash;
33
34enum { 34enum {
35 FTRACE_OPS_FL_ENABLED = 1 << 0, 35 FTRACE_OPS_FL_ENABLED = 1 << 0,
36 FTRACE_OPS_FL_GLOBAL = 1 << 1, 36 FTRACE_OPS_FL_GLOBAL = 1 << 1,
@@ -123,7 +123,8 @@ stack_trace_sysctl(struct ctl_table *table, int write,
123struct ftrace_func_command { 123struct ftrace_func_command {
124 struct list_head list; 124 struct list_head list;
125 char *name; 125 char *name;
126 int (*func)(char *func, char *cmd, 126 int (*func)(struct ftrace_hash *hash,
127 char *func, char *cmd,
127 char *params, int enable); 128 char *params, int enable);
128}; 129};
129 130
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
index 59d3ef100eb..96efa6794ea 100644
--- a/include/linux/ftrace_event.h
+++ b/include/linux/ftrace_event.h
@@ -76,6 +76,7 @@ struct trace_iterator {
76 struct trace_entry *ent; 76 struct trace_entry *ent;
77 unsigned long lost_events; 77 unsigned long lost_events;
78 int leftover; 78 int leftover;
79 int ent_size;
79 int cpu; 80 int cpu;
80 u64 ts; 81 u64 ts;
81 82
@@ -129,6 +130,10 @@ void trace_current_buffer_unlock_commit(struct ring_buffer *buffer,
129void trace_nowake_buffer_unlock_commit(struct ring_buffer *buffer, 130void trace_nowake_buffer_unlock_commit(struct ring_buffer *buffer,
130 struct ring_buffer_event *event, 131 struct ring_buffer_event *event,
131 unsigned long flags, int pc); 132 unsigned long flags, int pc);
133void trace_nowake_buffer_unlock_commit_regs(struct ring_buffer *buffer,
134 struct ring_buffer_event *event,
135 unsigned long flags, int pc,
136 struct pt_regs *regs);
132void trace_current_buffer_discard_commit(struct ring_buffer *buffer, 137void trace_current_buffer_discard_commit(struct ring_buffer *buffer,
133 struct ring_buffer_event *event); 138 struct ring_buffer_event *event);
134 139
diff --git a/include/linux/fuse.h b/include/linux/fuse.h
index d464de53db4..464cff52686 100644
--- a/include/linux/fuse.h
+++ b/include/linux/fuse.h
@@ -47,6 +47,9 @@
47 * - FUSE_IOCTL_UNRESTRICTED shall now return with array of 'struct 47 * - FUSE_IOCTL_UNRESTRICTED shall now return with array of 'struct
48 * fuse_ioctl_iovec' instead of ambiguous 'struct iovec' 48 * fuse_ioctl_iovec' instead of ambiguous 'struct iovec'
49 * - add FUSE_IOCTL_32BIT flag 49 * - add FUSE_IOCTL_32BIT flag
50 *
51 * 7.17
52 * - add FUSE_FLOCK_LOCKS and FUSE_RELEASE_FLOCK_UNLOCK
50 */ 53 */
51 54
52#ifndef _LINUX_FUSE_H 55#ifndef _LINUX_FUSE_H
@@ -78,7 +81,7 @@
78#define FUSE_KERNEL_VERSION 7 81#define FUSE_KERNEL_VERSION 7
79 82
80/** Minor version number of this interface */ 83/** Minor version number of this interface */
81#define FUSE_KERNEL_MINOR_VERSION 16 84#define FUSE_KERNEL_MINOR_VERSION 17
82 85
83/** The node ID of the root inode */ 86/** The node ID of the root inode */
84#define FUSE_ROOT_ID 1 87#define FUSE_ROOT_ID 1
@@ -153,8 +156,10 @@ struct fuse_file_lock {
153/** 156/**
154 * INIT request/reply flags 157 * INIT request/reply flags
155 * 158 *
159 * FUSE_POSIX_LOCKS: remote locking for POSIX file locks
156 * FUSE_EXPORT_SUPPORT: filesystem handles lookups of "." and ".." 160 * FUSE_EXPORT_SUPPORT: filesystem handles lookups of "." and ".."
157 * FUSE_DONT_MASK: don't apply umask to file mode on create operations 161 * FUSE_DONT_MASK: don't apply umask to file mode on create operations
162 * FUSE_FLOCK_LOCKS: remote locking for BSD style file locks
158 */ 163 */
159#define FUSE_ASYNC_READ (1 << 0) 164#define FUSE_ASYNC_READ (1 << 0)
160#define FUSE_POSIX_LOCKS (1 << 1) 165#define FUSE_POSIX_LOCKS (1 << 1)
@@ -163,6 +168,7 @@ struct fuse_file_lock {
163#define FUSE_EXPORT_SUPPORT (1 << 4) 168#define FUSE_EXPORT_SUPPORT (1 << 4)
164#define FUSE_BIG_WRITES (1 << 5) 169#define FUSE_BIG_WRITES (1 << 5)
165#define FUSE_DONT_MASK (1 << 6) 170#define FUSE_DONT_MASK (1 << 6)
171#define FUSE_FLOCK_LOCKS (1 << 10)
166 172
167/** 173/**
168 * CUSE INIT request/reply flags 174 * CUSE INIT request/reply flags
@@ -175,6 +181,7 @@ struct fuse_file_lock {
175 * Release flags 181 * Release flags
176 */ 182 */
177#define FUSE_RELEASE_FLUSH (1 << 0) 183#define FUSE_RELEASE_FLUSH (1 << 0)
184#define FUSE_RELEASE_FLOCK_UNLOCK (1 << 1)
178 185
179/** 186/**
180 * Getattr flags 187 * Getattr flags
diff --git a/include/linux/genalloc.h b/include/linux/genalloc.h
index 5bbebda78b0..ae9daa29395 100644
--- a/include/linux/genalloc.h
+++ b/include/linux/genalloc.h
@@ -1,8 +1,26 @@
1/* 1/*
2 * Basic general purpose allocator for managing special purpose memory 2 * Basic general purpose allocator for managing special purpose
3 * not managed by the regular kmalloc/kfree interface. 3 * memory, for example, memory that is not managed by the regular
4 * Uses for this includes on-device special memory, uncached memory 4 * kmalloc/kfree interface. Uses for this includes on-device special
5 * etc. 5 * memory, uncached memory etc.
6 *
7 * It is safe to use the allocator in NMI handlers and other special
8 * unblockable contexts that could otherwise deadlock on locks. This
9 * is implemented by using atomic operations and retries on any
10 * conflicts. The disadvantage is that there may be livelocks in
11 * extreme cases. For better scalability, one allocator can be used
12 * for each CPU.
13 *
14 * The lockless operation only works if there is enough memory
15 * available. If new memory is added to the pool a lock has to be
16 * still taken. So any user relying on locklessness has to ensure
17 * that sufficient memory is preallocated.
18 *
19 * The basic atomic operation of this allocator is cmpxchg on long.
20 * On architectures that don't have NMI-safe cmpxchg implementation,
21 * the allocator can NOT be used in NMI handler. So code uses the
22 * allocator in NMI handler should depend on
23 * CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG.
6 * 24 *
7 * This source code is licensed under the GNU General Public License, 25 * This source code is licensed under the GNU General Public License,
8 * Version 2. See the file COPYING for more details. 26 * Version 2. See the file COPYING for more details.
@@ -15,7 +33,7 @@
15 * General purpose special memory pool descriptor. 33 * General purpose special memory pool descriptor.
16 */ 34 */
17struct gen_pool { 35struct gen_pool {
18 rwlock_t lock; 36 spinlock_t lock;
19 struct list_head chunks; /* list of chunks in this pool */ 37 struct list_head chunks; /* list of chunks in this pool */
20 int min_alloc_order; /* minimum allocation order */ 38 int min_alloc_order; /* minimum allocation order */
21}; 39};
@@ -24,8 +42,8 @@ struct gen_pool {
24 * General purpose special memory pool chunk descriptor. 42 * General purpose special memory pool chunk descriptor.
25 */ 43 */
26struct gen_pool_chunk { 44struct gen_pool_chunk {
27 spinlock_t lock;
28 struct list_head next_chunk; /* next chunk in pool */ 45 struct list_head next_chunk; /* next chunk in pool */
46 atomic_t avail;
29 phys_addr_t phys_addr; /* physical starting address of memory chunk */ 47 phys_addr_t phys_addr; /* physical starting address of memory chunk */
30 unsigned long start_addr; /* starting address of memory chunk */ 48 unsigned long start_addr; /* starting address of memory chunk */
31 unsigned long end_addr; /* ending address of memory chunk */ 49 unsigned long end_addr; /* ending address of memory chunk */
@@ -54,6 +72,20 @@ static inline int gen_pool_add(struct gen_pool *pool, unsigned long addr,
54 return gen_pool_add_virt(pool, addr, -1, size, nid); 72 return gen_pool_add_virt(pool, addr, -1, size, nid);
55} 73}
56extern void gen_pool_destroy(struct gen_pool *); 74extern void gen_pool_destroy(struct gen_pool *);
57extern unsigned long gen_pool_alloc(struct gen_pool *, size_t); 75extern unsigned long gen_pool_alloc_addr(struct gen_pool *,
76 size_t, unsigned long);
77/**
78 * gen_pool_alloc - allocate special memory from the pool
79 * @pool: pool to allocate from
80 * @size: number of bytes to allocate from the pool
81 */
82static inline unsigned long gen_pool_alloc(struct gen_pool *pool, size_t size)
83{
84 return gen_pool_alloc_addr(pool, size, 0);
85}
58extern void gen_pool_free(struct gen_pool *, unsigned long, size_t); 86extern void gen_pool_free(struct gen_pool *, unsigned long, size_t);
87extern void gen_pool_for_each_chunk(struct gen_pool *,
88 void (*)(struct gen_pool *, struct gen_pool_chunk *, void *), void *);
89extern size_t gen_pool_avail(struct gen_pool *);
90extern size_t gen_pool_size(struct gen_pool *);
59#endif /* __GENALLOC_H__ */ 91#endif /* __GENALLOC_H__ */
diff --git a/include/linux/generic_acl.h b/include/linux/generic_acl.h
index 0437e377b55..b6d657544ef 100644
--- a/include/linux/generic_acl.h
+++ b/include/linux/generic_acl.h
@@ -10,6 +10,5 @@ extern const struct xattr_handler generic_acl_default_handler;
10 10
11int generic_acl_init(struct inode *, struct inode *); 11int generic_acl_init(struct inode *, struct inode *);
12int generic_acl_chmod(struct inode *); 12int generic_acl_chmod(struct inode *);
13int generic_check_acl(struct inode *inode, int mask, unsigned int flags);
14 13
15#endif /* LINUX_GENERIC_ACL_H */ 14#endif /* LINUX_GENERIC_ACL_H */
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 300d7582006..02fa4697a0e 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -420,7 +420,7 @@ static inline int get_disk_ro(struct gendisk *disk)
420 420
421extern void disk_block_events(struct gendisk *disk); 421extern void disk_block_events(struct gendisk *disk);
422extern void disk_unblock_events(struct gendisk *disk); 422extern void disk_unblock_events(struct gendisk *disk);
423extern void disk_check_events(struct gendisk *disk); 423extern void disk_flush_events(struct gendisk *disk, unsigned int mask);
424extern unsigned int disk_clear_events(struct gendisk *disk, unsigned int mask); 424extern unsigned int disk_clear_events(struct gendisk *disk, unsigned int mask);
425 425
426/* drivers/char/random.c */ 426/* drivers/char/random.c */
diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index cb4089254f0..3a76faf6a3e 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -92,7 +92,7 @@ struct vm_area_struct;
92 */ 92 */
93#define __GFP_NOTRACK_FALSE_POSITIVE (__GFP_NOTRACK) 93#define __GFP_NOTRACK_FALSE_POSITIVE (__GFP_NOTRACK)
94 94
95#define __GFP_BITS_SHIFT 23 /* Room for 23 __GFP_FOO bits */ 95#define __GFP_BITS_SHIFT 24 /* Room for N __GFP_FOO bits */
96#define __GFP_BITS_MASK ((__force gfp_t)((1 << __GFP_BITS_SHIFT) - 1)) 96#define __GFP_BITS_MASK ((__force gfp_t)((1 << __GFP_BITS_SHIFT) - 1))
97 97
98/* This equals 0, but use constants in case they ever change */ 98/* This equals 0, but use constants in case they ever change */
diff --git a/include/linux/gpio.h b/include/linux/gpio.h
index 17b5a0d80e4..6e20df09927 100644
--- a/include/linux/gpio.h
+++ b/include/linux/gpio.h
@@ -14,6 +14,12 @@
14#define GPIOF_OUT_INIT_LOW (GPIOF_DIR_OUT | GPIOF_INIT_LOW) 14#define GPIOF_OUT_INIT_LOW (GPIOF_DIR_OUT | GPIOF_INIT_LOW)
15#define GPIOF_OUT_INIT_HIGH (GPIOF_DIR_OUT | GPIOF_INIT_HIGH) 15#define GPIOF_OUT_INIT_HIGH (GPIOF_DIR_OUT | GPIOF_INIT_HIGH)
16 16
17/* Gpio pin is open drain */
18#define GPIOF_OPEN_DRAIN (1 << 2)
19
20/* Gpio pin is open source */
21#define GPIOF_OPEN_SOURCE (1 << 3)
22
17#ifdef CONFIG_GENERIC_GPIO 23#ifdef CONFIG_GENERIC_GPIO
18#include <asm/gpio.h> 24#include <asm/gpio.h>
19 25
diff --git a/include/linux/gpio_event.h b/include/linux/gpio_event.h
new file mode 100644
index 00000000000..2613fc5e4a9
--- /dev/null
+++ b/include/linux/gpio_event.h
@@ -0,0 +1,170 @@
1/* include/linux/gpio_event.h
2 *
3 * Copyright (C) 2007 Google, Inc.
4 *
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
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 */
15
16#ifndef _LINUX_GPIO_EVENT_H
17#define _LINUX_GPIO_EVENT_H
18
19#include <linux/input.h>
20
21struct gpio_event_input_devs {
22 int count;
23 struct input_dev *dev[];
24};
25enum {
26 GPIO_EVENT_FUNC_UNINIT = 0x0,
27 GPIO_EVENT_FUNC_INIT = 0x1,
28 GPIO_EVENT_FUNC_SUSPEND = 0x2,
29 GPIO_EVENT_FUNC_RESUME = 0x3,
30};
31struct gpio_event_info {
32 int (*func)(struct gpio_event_input_devs *input_devs,
33 struct gpio_event_info *info,
34 void **data, int func);
35 int (*event)(struct gpio_event_input_devs *input_devs,
36 struct gpio_event_info *info,
37 void **data, unsigned int dev, unsigned int type,
38 unsigned int code, int value); /* out events */
39 bool no_suspend;
40};
41
42struct gpio_event_platform_data {
43 const char *name;
44 struct gpio_event_info **info;
45 size_t info_count;
46 int (*power)(const struct gpio_event_platform_data *pdata, bool on);
47 const char *names[]; /* If name is NULL, names contain a NULL */
48 /* terminated list of input devices to create */
49};
50
51#define GPIO_EVENT_DEV_NAME "gpio-event"
52
53/* Key matrix */
54
55enum gpio_event_matrix_flags {
56 /* unset: drive active output low, set: drive active output high */
57 GPIOKPF_ACTIVE_HIGH = 1U << 0,
58 GPIOKPF_DEBOUNCE = 1U << 1,
59 GPIOKPF_REMOVE_SOME_PHANTOM_KEYS = 1U << 2,
60 GPIOKPF_REMOVE_PHANTOM_KEYS = GPIOKPF_REMOVE_SOME_PHANTOM_KEYS |
61 GPIOKPF_DEBOUNCE,
62 GPIOKPF_DRIVE_INACTIVE = 1U << 3,
63 GPIOKPF_LEVEL_TRIGGERED_IRQ = 1U << 4,
64 GPIOKPF_PRINT_UNMAPPED_KEYS = 1U << 16,
65 GPIOKPF_PRINT_MAPPED_KEYS = 1U << 17,
66 GPIOKPF_PRINT_PHANTOM_KEYS = 1U << 18,
67};
68
69#define MATRIX_CODE_BITS (10)
70#define MATRIX_KEY_MASK ((1U << MATRIX_CODE_BITS) - 1)
71#define MATRIX_KEY(dev, code) \
72 (((dev) << MATRIX_CODE_BITS) | (code & MATRIX_KEY_MASK))
73
74extern int gpio_event_matrix_func(struct gpio_event_input_devs *input_devs,
75 struct gpio_event_info *info, void **data, int func);
76struct gpio_event_matrix_info {
77 /* initialize to gpio_event_matrix_func */
78 struct gpio_event_info info;
79 /* size must be ninputs * noutputs */
80 const unsigned short *keymap;
81 unsigned int *input_gpios;
82 unsigned int *output_gpios;
83 unsigned int ninputs;
84 unsigned int noutputs;
85 /* time to wait before reading inputs after driving each output */
86 ktime_t settle_time;
87 /* time to wait before scanning the keypad a second time */
88 ktime_t debounce_delay;
89 ktime_t poll_time;
90 unsigned flags;
91};
92
93/* Directly connected inputs and outputs */
94
95enum gpio_event_direct_flags {
96 GPIOEDF_ACTIVE_HIGH = 1U << 0,
97/* GPIOEDF_USE_DOWN_IRQ = 1U << 1, */
98/* GPIOEDF_USE_IRQ = (1U << 2) | GPIOIDF_USE_DOWN_IRQ, */
99 GPIOEDF_PRINT_KEYS = 1U << 8,
100 GPIOEDF_PRINT_KEY_DEBOUNCE = 1U << 9,
101 GPIOEDF_PRINT_KEY_UNSTABLE = 1U << 10,
102};
103
104struct gpio_event_direct_entry {
105 uint32_t gpio:16;
106 uint32_t code:10;
107 uint32_t dev:6;
108};
109
110/* inputs */
111extern int gpio_event_input_func(struct gpio_event_input_devs *input_devs,
112 struct gpio_event_info *info, void **data, int func);
113struct gpio_event_input_info {
114 /* initialize to gpio_event_input_func */
115 struct gpio_event_info info;
116 ktime_t debounce_time;
117 ktime_t poll_time;
118 uint16_t flags;
119 uint16_t type;
120 const struct gpio_event_direct_entry *keymap;
121 size_t keymap_size;
122};
123
124/* outputs */
125extern int gpio_event_output_func(struct gpio_event_input_devs *input_devs,
126 struct gpio_event_info *info, void **data, int func);
127extern int gpio_event_output_event(struct gpio_event_input_devs *input_devs,
128 struct gpio_event_info *info, void **data,
129 unsigned int dev, unsigned int type,
130 unsigned int code, int value);
131struct gpio_event_output_info {
132 /* initialize to gpio_event_output_func and gpio_event_output_event */
133 struct gpio_event_info info;
134 uint16_t flags;
135 uint16_t type;
136 const struct gpio_event_direct_entry *keymap;
137 size_t keymap_size;
138};
139
140
141/* axes */
142
143enum gpio_event_axis_flags {
144 GPIOEAF_PRINT_UNKNOWN_DIRECTION = 1U << 16,
145 GPIOEAF_PRINT_RAW = 1U << 17,
146 GPIOEAF_PRINT_EVENT = 1U << 18,
147};
148
149extern int gpio_event_axis_func(struct gpio_event_input_devs *input_devs,
150 struct gpio_event_info *info, void **data, int func);
151struct gpio_event_axis_info {
152 /* initialize to gpio_event_axis_func */
153 struct gpio_event_info info;
154 uint8_t count; /* number of gpios for this axis */
155 uint8_t dev; /* device index when using multiple input devices */
156 uint8_t type; /* EV_REL or EV_ABS */
157 uint16_t code;
158 uint16_t decoded_size;
159 uint16_t (*map)(struct gpio_event_axis_info *info, uint16_t in);
160 uint32_t *gpio;
161 uint32_t flags;
162};
163#define gpio_axis_2bit_gray_map gpio_axis_4bit_gray_map
164#define gpio_axis_3bit_gray_map gpio_axis_4bit_gray_map
165uint16_t gpio_axis_4bit_gray_map(
166 struct gpio_event_axis_info *info, uint16_t in);
167uint16_t gpio_axis_5bit_singletrack_map(
168 struct gpio_event_axis_info *info, uint16_t in);
169
170#endif
diff --git a/include/linux/gpio_keys.h b/include/linux/gpio_keys.h
index b5ca4b2c08e..50f7ced738a 100644
--- a/include/linux/gpio_keys.h
+++ b/include/linux/gpio_keys.h
@@ -4,7 +4,7 @@
4struct gpio_keys_button { 4struct gpio_keys_button {
5 /* Configuration parameters */ 5 /* Configuration parameters */
6 unsigned int code; /* input event code (KEY_*, SW_*) */ 6 unsigned int code; /* input event code (KEY_*, SW_*) */
7 int gpio; 7 int gpio; /* -1 if this key does not support gpio */
8 int active_low; 8 int active_low;
9 const char *desc; 9 const char *desc;
10 unsigned int type; /* input event type (EV_KEY, EV_SW, EV_ABS) */ 10 unsigned int type; /* input event type (EV_KEY, EV_SW, EV_ABS) */
@@ -12,6 +12,7 @@ struct gpio_keys_button {
12 int debounce_interval; /* debounce ticks interval in msecs */ 12 int debounce_interval; /* debounce ticks interval in msecs */
13 bool can_disable; 13 bool can_disable;
14 int value; /* axis value for EV_ABS */ 14 int value; /* axis value for EV_ABS */
15 unsigned int irq; /* Irq number in case of interrupt keys */
15}; 16};
16 17
17struct gpio_keys_platform_data { 18struct gpio_keys_platform_data {
@@ -23,6 +24,7 @@ struct gpio_keys_platform_data {
23 int (*enable)(struct device *dev); 24 int (*enable)(struct device *dev);
24 void (*disable)(struct device *dev); 25 void (*disable)(struct device *dev);
25 const char *name; /* input device name */ 26 const char *name; /* input device name */
27 int (*wakeup_key)(void);
26}; 28};
27 29
28#endif 30#endif
diff --git a/include/linux/gpio_scrollwheel.h b/include/linux/gpio_scrollwheel.h
new file mode 100644
index 00000000000..33d17a0199e
--- /dev/null
+++ b/include/linux/gpio_scrollwheel.h
@@ -0,0 +1,46 @@
1/*
2 * Copyright (c) 2010, NVIDIA 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 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, 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
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 _GPIO_SCROLLWHEEL_H
20#define _GPIO_SCROLLWHEEL_H
21
22#define GPIO_SCROLLWHEEL_PIN_ONOFF 0
23#define GPIO_SCROLLWHEEL_PIN_PRESS 1
24#define GPIO_SCROLLWHEEL_PIN_ROT1 2
25#define GPIO_SCROLLWHEEL_PIN_ROT2 3
26#define GPIO_SCROLLWHEEL_PIN_MAX 4
27
28struct gpio_scrollwheel_button {
29 /* Configuration parameters */
30 int pinaction; /* GPIO_SCROLLWHEEL_PIN_* */
31 int gpio;
32 char *desc;
33 int active_low;
34 int debounce_interval; /* debounce ticks interval in msecs */
35};
36
37struct gpio_scrollwheel_platform_data {
38 struct gpio_scrollwheel_button *buttons;
39 int nbuttons;
40 unsigned int rep:1; /* enable input subsystem auto repeat */
41 int (*enable)(struct device *dev);
42 void (*disable)(struct device *dev);
43};
44
45#endif
46
diff --git a/include/linux/gsmmux.h b/include/linux/gsmmux.h
index 378de4195ca..c25e9477f7c 100644
--- a/include/linux/gsmmux.h
+++ b/include/linux/gsmmux.h
@@ -21,5 +21,16 @@ struct gsm_config
21#define GSMIOC_GETCONF _IOR('G', 0, struct gsm_config) 21#define GSMIOC_GETCONF _IOR('G', 0, struct gsm_config)
22#define GSMIOC_SETCONF _IOW('G', 1, struct gsm_config) 22#define GSMIOC_SETCONF _IOW('G', 1, struct gsm_config)
23 23
24struct gsm_netconfig {
25 unsigned int adaption; /* Adaption to use in network mode */
26 unsigned short protocol;/* Protocol to use - only ETH_P_IP supported */
27 unsigned short unused2;
28 char if_name[IFNAMSIZ]; /* interface name format string */
29 __u8 unused[28]; /* For future use */
30};
31
32#define GSMIOC_ENABLE_NET _IOW('G', 2, struct gsm_netconfig)
33#define GSMIOC_DISABLE_NET _IO('G', 3)
34
24 35
25#endif 36#endif
diff --git a/include/linux/hardirq.h b/include/linux/hardirq.h
index e6dd5a456ba..ef18786a7b4 100644
--- a/include/linux/hardirq.h
+++ b/include/linux/hardirq.h
@@ -95,7 +95,7 @@
95 */ 95 */
96#define in_nmi() (preempt_count() & NMI_MASK) 96#define in_nmi() (preempt_count() & NMI_MASK)
97 97
98#if defined(CONFIG_PREEMPT) 98#if defined(CONFIG_PREEMPT_COUNT)
99# define PREEMPT_CHECK_OFFSET 1 99# define PREEMPT_CHECK_OFFSET 1
100#else 100#else
101# define PREEMPT_CHECK_OFFSET 0 101# define PREEMPT_CHECK_OFFSET 0
@@ -117,7 +117,7 @@
117#define in_atomic_preempt_off() \ 117#define in_atomic_preempt_off() \
118 ((preempt_count() & ~PREEMPT_ACTIVE) != PREEMPT_CHECK_OFFSET) 118 ((preempt_count() & ~PREEMPT_ACTIVE) != PREEMPT_CHECK_OFFSET)
119 119
120#ifdef CONFIG_PREEMPT 120#ifdef CONFIG_PREEMPT_COUNT
121# define preemptible() (preempt_count() == 0 && !irqs_disabled()) 121# define preemptible() (preempt_count() == 0 && !irqs_disabled())
122# define IRQ_EXIT_OFFSET (HARDIRQ_OFFSET-1) 122# define IRQ_EXIT_OFFSET (HARDIRQ_OFFSET-1)
123#else 123#else
diff --git a/include/linux/hash.h b/include/linux/hash.h
index 06d25c189cc..b80506bdd73 100644
--- a/include/linux/hash.h
+++ b/include/linux/hash.h
@@ -63,7 +63,7 @@ static inline u32 hash_32(u32 val, unsigned int bits)
63 return hash >> (32 - bits); 63 return hash >> (32 - bits);
64} 64}
65 65
66static inline unsigned long hash_ptr(void *ptr, unsigned int bits) 66static inline unsigned long hash_ptr(const void *ptr, unsigned int bits)
67{ 67{
68 return hash_long((unsigned long)ptr, bits); 68 return hash_long((unsigned long)ptr, bits);
69} 69}
diff --git a/include/linux/hid.h b/include/linux/hid.h
index 42f7e2fb501..ab64d4768f6 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -453,7 +453,8 @@ struct hid_input {
453 453
454enum hid_type { 454enum hid_type {
455 HID_TYPE_OTHER = 0, 455 HID_TYPE_OTHER = 0,
456 HID_TYPE_USBMOUSE 456 HID_TYPE_USBMOUSE,
457 HID_TYPE_USBNONE
457}; 458};
458 459
459struct hid_driver; 460struct hid_driver;
@@ -597,6 +598,8 @@ struct hid_usage_id {
597 * @input_mapping: invoked on input registering before mapping an usage 598 * @input_mapping: invoked on input registering before mapping an usage
598 * @input_mapped: invoked on input registering after mapping an usage 599 * @input_mapped: invoked on input registering after mapping an usage
599 * @feature_mapping: invoked on feature registering 600 * @feature_mapping: invoked on feature registering
601 * @input_register: called just before input device is registered after reports
602 * are parsed.
600 * @suspend: invoked on suspend (NULL means nop) 603 * @suspend: invoked on suspend (NULL means nop)
601 * @resume: invoked on resume if device was not reset (NULL means nop) 604 * @resume: invoked on resume if device was not reset (NULL means nop)
602 * @reset_resume: invoked on resume if device was reset (NULL means nop) 605 * @reset_resume: invoked on resume if device was reset (NULL means nop)
@@ -643,6 +646,8 @@ struct hid_driver {
643 void (*feature_mapping)(struct hid_device *hdev, 646 void (*feature_mapping)(struct hid_device *hdev,
644 struct hid_field *field, 647 struct hid_field *field,
645 struct hid_usage *usage); 648 struct hid_usage *usage);
649 int (*input_register)(struct hid_device *hdev, struct hid_input
650 *hidinput);
646#ifdef CONFIG_PM 651#ifdef CONFIG_PM
647 int (*suspend)(struct hid_device *hdev, pm_message_t message); 652 int (*suspend)(struct hid_device *hdev, pm_message_t message);
648 int (*resume)(struct hid_device *hdev); 653 int (*resume)(struct hid_device *hdev);
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 59225ef27d1..19644e0016b 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -231,6 +231,9 @@ struct hstate {
231struct huge_bootmem_page { 231struct huge_bootmem_page {
232 struct list_head list; 232 struct list_head list;
233 struct hstate *hstate; 233 struct hstate *hstate;
234#ifdef CONFIG_HIGHMEM
235 phys_addr_t phys;
236#endif
234}; 237};
235 238
236struct page *alloc_huge_page_node(struct hstate *h, int nid); 239struct page *alloc_huge_page_node(struct hstate *h, int nid);
diff --git a/include/linux/hw_breakpoint.h b/include/linux/hw_breakpoint.h
index d1e55fed2c7..6ae9c631a1b 100644
--- a/include/linux/hw_breakpoint.h
+++ b/include/linux/hw_breakpoint.h
@@ -73,6 +73,7 @@ static inline unsigned long hw_breakpoint_len(struct perf_event *bp)
73extern struct perf_event * 73extern struct perf_event *
74register_user_hw_breakpoint(struct perf_event_attr *attr, 74register_user_hw_breakpoint(struct perf_event_attr *attr,
75 perf_overflow_handler_t triggered, 75 perf_overflow_handler_t triggered,
76 void *context,
76 struct task_struct *tsk); 77 struct task_struct *tsk);
77 78
78/* FIXME: only change from the attr, and don't unregister */ 79/* FIXME: only change from the attr, and don't unregister */
@@ -85,11 +86,13 @@ modify_user_hw_breakpoint(struct perf_event *bp, struct perf_event_attr *attr);
85extern struct perf_event * 86extern struct perf_event *
86register_wide_hw_breakpoint_cpu(struct perf_event_attr *attr, 87register_wide_hw_breakpoint_cpu(struct perf_event_attr *attr,
87 perf_overflow_handler_t triggered, 88 perf_overflow_handler_t triggered,
89 void *context,
88 int cpu); 90 int cpu);
89 91
90extern struct perf_event * __percpu * 92extern struct perf_event * __percpu *
91register_wide_hw_breakpoint(struct perf_event_attr *attr, 93register_wide_hw_breakpoint(struct perf_event_attr *attr,
92 perf_overflow_handler_t triggered); 94 perf_overflow_handler_t triggered,
95 void *context);
93 96
94extern int register_perf_hw_breakpoint(struct perf_event *bp); 97extern int register_perf_hw_breakpoint(struct perf_event *bp);
95extern int __register_perf_hw_breakpoint(struct perf_event *bp); 98extern int __register_perf_hw_breakpoint(struct perf_event *bp);
@@ -115,6 +118,7 @@ static inline int __init init_hw_breakpoint(void) { return 0; }
115static inline struct perf_event * 118static inline struct perf_event *
116register_user_hw_breakpoint(struct perf_event_attr *attr, 119register_user_hw_breakpoint(struct perf_event_attr *attr,
117 perf_overflow_handler_t triggered, 120 perf_overflow_handler_t triggered,
121 void *context,
118 struct task_struct *tsk) { return NULL; } 122 struct task_struct *tsk) { return NULL; }
119static inline int 123static inline int
120modify_user_hw_breakpoint(struct perf_event *bp, 124modify_user_hw_breakpoint(struct perf_event *bp,
@@ -122,10 +126,12 @@ modify_user_hw_breakpoint(struct perf_event *bp,
122static inline struct perf_event * 126static inline struct perf_event *
123register_wide_hw_breakpoint_cpu(struct perf_event_attr *attr, 127register_wide_hw_breakpoint_cpu(struct perf_event_attr *attr,
124 perf_overflow_handler_t triggered, 128 perf_overflow_handler_t triggered,
129 void *context,
125 int cpu) { return NULL; } 130 int cpu) { return NULL; }
126static inline struct perf_event * __percpu * 131static inline struct perf_event * __percpu *
127register_wide_hw_breakpoint(struct perf_event_attr *attr, 132register_wide_hw_breakpoint(struct perf_event_attr *attr,
128 perf_overflow_handler_t triggered) { return NULL; } 133 perf_overflow_handler_t triggered,
134 void *context) { return NULL; }
129static inline int 135static inline int
130register_perf_hw_breakpoint(struct perf_event *bp) { return -ENOSYS; } 136register_perf_hw_breakpoint(struct perf_event *bp) { return -ENOSYS; }
131static inline int 137static inline int
diff --git a/include/linux/hw_random.h b/include/linux/hw_random.h
index 9bede7633f7..b4b0eef5fdd 100644
--- a/include/linux/hw_random.h
+++ b/include/linux/hw_random.h
@@ -25,7 +25,7 @@
25 * there is always data available. *OBSOLETE* 25 * there is always data available. *OBSOLETE*
26 * @data_read: Read data from the RNG device. 26 * @data_read: Read data from the RNG device.
27 * Returns the number of lower random bytes in "data". 27 * Returns the number of lower random bytes in "data".
28 * Must not be NULL. *OSOLETE* 28 * Must not be NULL. *OBSOLETE*
29 * @read: New API. drivers can fill up to max bytes of data 29 * @read: New API. drivers can fill up to max bytes of data
30 * into the buffer. The buffer is aligned for any type. 30 * into the buffer. The buffer is aligned for any type.
31 * @priv: Private data, for use by the RNG driver. 31 * @priv: Private data, for use by the RNG driver.
diff --git a/include/linux/i2c-omap.h b/include/linux/i2c-omap.h
index 7472449cbb7..0aa0cbd676f 100644
--- a/include/linux/i2c-omap.h
+++ b/include/linux/i2c-omap.h
@@ -3,6 +3,33 @@
3 3
4#include <linux/platform_device.h> 4#include <linux/platform_device.h>
5 5
6/*
7 * Version 2 of the I2C peripheral unit has a different register
8 * layout and extra registers. The ID register in the V2 peripheral
9 * unit on the OMAP4430 reports the same ID as the V1 peripheral
10 * unit on the OMAP3530, so we must inform the driver which IP
11 * version we know it is running on from platform / cpu-specific
12 * code using these constants in the hwmod class definition.
13 */
14
15#define OMAP_I2C_IP_VERSION_1 1
16#define OMAP_I2C_IP_VERSION_2 2
17
18/* struct omap_i2c_bus_platform_data .flags meanings */
19
20#define OMAP_I2C_FLAG_NO_FIFO BIT(0)
21#define OMAP_I2C_FLAG_SIMPLE_CLOCK BIT(1)
22#define OMAP_I2C_FLAG_16BIT_DATA_REG BIT(2)
23#define OMAP_I2C_FLAG_RESET_REGS_POSTIDLE BIT(3)
24#define OMAP_I2C_FLAG_APPLY_ERRATA_I207 BIT(4)
25#define OMAP_I2C_FLAG_ALWAYS_ARMXOR_CLK BIT(5)
26#define OMAP_I2C_FLAG_FORCE_19200_INT_CLK BIT(6)
27/* how the CPU address bus must be translated for I2C unit access */
28#define OMAP_I2C_FLAG_BUS_SHIFT_NONE 0
29#define OMAP_I2C_FLAG_BUS_SHIFT_1 BIT(7)
30#define OMAP_I2C_FLAG_BUS_SHIFT_2 BIT(8)
31#define OMAP_I2C_FLAG_BUS_SHIFT__SHIFT 7
32
6struct omap_i2c_bus_platform_data { 33struct omap_i2c_bus_platform_data {
7 u32 clkrate; 34 u32 clkrate;
8 void (*set_mpu_wkup_lat)(struct device *dev, long set); 35 void (*set_mpu_wkup_lat)(struct device *dev, long set);
diff --git a/include/linux/i2c-slave.h b/include/linux/i2c-slave.h
new file mode 100644
index 00000000000..34df64f73f6
--- /dev/null
+++ b/include/linux/i2c-slave.h
@@ -0,0 +1,259 @@
1/*
2 * i2c-slave.h - definitions for the i2c-slave-bus interface
3 *
4 * Copyright (c) 2009-2011, NVIDIA Corporation.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, 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
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 */
20
21/* ------------------------------------------------------------------------- */
22
23#ifndef _LINUX_I2C_SLAVE_H
24#define _LINUX_I2C_SLAVE_H
25
26#include <linux/types.h>
27#ifdef __KERNEL__
28/* --- General options ------------------------------------------------ */
29
30struct i2c_client;
31struct i2c_slave_algorithm;
32struct i2c_slave_adapter;
33#if defined(CONFIG_I2C_SLAVE) && defined(CONFIG_I2C)
34
35/**
36 * i2c_slave_send - Sends data to master. When master issues a read cycle, the
37 * data is sent by the slave.
38 * This function copies the client data into the slave tx buffer and return to
39 * client. This is not a blocking call. Data will be sent to master later once
40 * slave got the master-ready cycle transfer.
41 * if there is no sufficient space to write the client buffer, it will return
42 * error. it will not write partial data.
43 * @client: Handle to i2c-slave client.
44 * @buf: Data that will be written to the master
45 * @count: How many bytes to write.
46 *
47 * Returns negative errno, or else the number of bytes written.
48 */
49extern int i2c_slave_send(struct i2c_client *client, const char *buf,
50 int count);
51
52/**
53 * i2c_slave_get_tx_status - Get amount of data available in tx buffer. If there
54 * is still data in tx buffer then wait for given time to transfer complete
55 * for a give timeout.
56 * @client: Handle to i2c-slave client.
57 * @timeout_ms: Time to wait for transfer to complete.
58 *
59 * Returns negative errno, or else the number of bytes remaining in tx buffer.
60 */
61extern int i2c_slave_get_tx_status(struct i2c_client *client, int timeout_ms);
62
63/**
64 * i2c_slave_recv - Receive data from master. The data received from master is
65 * stored on slave rx buffer. When this api will be called, the data will be
66 * copied from the slave rx buffer to client buffer. If requested amount (count)
67 * of data is not available then it will wait for either min_count to be receive
68 * or timeout whatever first.
69 *
70 * if timeout_ms = 0, then wait for min_count data to be read.
71 * if timoue_ms non zero then wait for the data till timeout happen.
72 * @client: Handle to i2c-slave client.
73 * @buf: Data that will be read from the master
74 * @count: How many bytes to read.
75 * @min_count: Block till read min_count of data.
76 * @timeout_ms: Time to wait for read to be complete.
77 *
78 * Returns negative errno, or else the number of bytes read.
79 */
80extern int i2c_slave_recv(struct i2c_client *client, char *buf, int count,
81 int min_count, int timeout_ms);
82
83/**
84 * i2c_slave_start - Start the i2c slave to receive/transmit data.
85 * After this i2c controller starts responding master.
86 * The dummy-char will send to master if there is no data to send on slave tx
87 * buffer.
88 * @client: Handle to i2c-slave client.
89 * @dummy_char: Data which will be send to master if there is no data to be send
90 * in slave tx buffer.
91 *
92 * Returns negative errno, or else 0 for success.
93 */
94extern int i2c_slave_start(struct i2c_client *client, unsigned char dummy_char);
95
96/**
97 * i2c_slave_stop - Stop slave to receive/transmit data.
98 * After this i2c controller stops responding master.
99 * @client: Handle to i2c-slave client.
100 * @is_buffer_clear: Reset the tx and rx slave buffer or not.
101 */
102extern void i2c_slave_stop(struct i2c_client *client, int is_buffer_clear);
103
104/**
105 * i2c_slave_flush_buffer - Flush the receive and transmit buffer.
106 * @client: Handle to i2c-slave client.
107 * @is_flush_tx_buffer: Reset the tx slave buffer or not.
108 * @is_flush_rx_buffer: Reset the rx slave buffer or not.
109 *
110 * Returns negative errno, or else 0 for success.
111 */
112extern int i2c_slave_flush_buffer(struct i2c_client *client,
113 int is_flush_tx_buffer, int is_flush_rx_buffer);
114
115/**
116 * i2c_slave_get_nack_cycle - Get the number of master read cycle on which
117 * dummy char sent. This is the way to find that how much cycle slave sent the
118 * NACK packet.
119 *
120 * @client: Handle to i2c-slave client.
121 * @is_cout_reset: Reset the nack count or not.
122 *
123 * Returns negative errno, or else 0 for success.
124 */
125extern int i2c_slave_get_nack_cycle(struct i2c_client *client,
126 int is_cout_reset);
127
128
129/**
130 * i2c_add_slave_adapter - Add slave adapter.
131 *
132 * @slv_adap: Slave adapter.
133 * @force_nr: Adapter number.
134 *
135 * Returns negative errno, or else 0 for success.
136 */
137extern int i2c_add_slave_adapter(struct i2c_slave_adapter *slv_adap,
138 bool force_nr);
139
140/**
141 * i2c_del_slave_adapter - Delete slave adapter.
142 *
143 * @slv_adap: Slave adapter.
144 *
145 * Returns negative errno, or else 0 for success.
146 */
147extern int i2c_del_slave_adapter(struct i2c_slave_adapter *slv_adap);
148
149#endif /* I2C_SLAVE */
150
151/*
152 * i2c_slave_adapter is the structure used to identify a physical i2c bus along
153 * with the access algorithms necessary to access it.
154 */
155struct i2c_slave_adapter {
156 struct module *owner;
157 unsigned int id;
158 unsigned int class; /* classes to allow probing for */
159 /* the algorithm to access the i2c-slave bus */
160 const struct i2c_slave_algorithm *slv_algo;
161 void *algo_data;
162 void *parent_data;
163
164 /* data fields that are valid for all devices */
165 u8 level; /* nesting level for lockdep */
166 struct mutex bus_lock;
167
168 int timeout; /* in jiffies */
169 int retries;
170 struct device *dev; /* the adapter device */
171 struct device *parent_dev; /* the adapter device */
172
173 int nr;
174 char name[48];
175 struct completion dev_released;
176};
177
178static inline void *i2c_get_slave_adapdata(const struct i2c_slave_adapter *dev)
179{
180 return dev_get_drvdata(dev->dev);
181}
182
183static inline void i2c_set_slave_adapdata(struct i2c_slave_adapter *dev,
184 void *data)
185{
186 dev_set_drvdata(dev->dev, data);
187}
188
189/*
190 * The following struct are for those who like to implement new i2c slave
191 * bus drivers:
192 * i2c_slave_algorithm is the interface to a class of hardware solutions which
193 * can be addressed using the same bus algorithms.
194 */
195struct i2c_slave_algorithm {
196 /* Start the slave to receive/transmit data.
197 * The dummy-char will send to master if there is no data to send on
198 * slave tx buffer.
199 */
200 int (*slave_start)(struct i2c_slave_adapter *slv_adap, int addr,
201 int is_ten_bit_addr, unsigned char dummy_char);
202
203 /* Stop slave to receive/transmit data.
204 * Required information to reset the slave rx and tx buffer to reset
205 * or not.
206 */
207 void (*slave_stop)(struct i2c_slave_adapter *slv_adap,
208 int is_buffer_clear);
209
210 /*
211 * Send data to master. The data will be copied on the slave tx buffer
212 * and will send to master once master initiates the master-read cycle.
213 * Function will return immediately once the buffer copied into slave
214 * tx buffer.
215 * Client will not wait till data is sent to master.
216 * This function will not copy data partially. If sufficient space is
217 * not available, it will return error.
218 */
219 int (*slave_send)(struct i2c_slave_adapter *slv_adap, const char *buf,
220 int count);
221
222 /*
223 * Get amount of data available in tx buffer. If there is still data in
224 * tx buffer wait for given time to get slave tx buffer emptied.
225 * returns number of data available in slave tx buffer.
226 */
227 int (*slave_get_tx_status)(struct i2c_slave_adapter *slv_adap,
228 int timeout_ms);
229
230 /*
231 * Receive data to master. The data received from master is stored on
232 * slave rx buffer. When this api will be called, the data will be
233 * coped from the slave rx buffer to client buffer. If requested (count)
234 * data is not available then it will wait for either min_count to be
235 * receive or timeout whatever first.
236 *
237 * if timeout_ms = 0, then wait for min_count data to be read.
238 * if timoue_ms non zero then wait for the data till timeout happen.
239 * returns number of bytes read as positive integer otherwise error.
240 */
241 int (*slave_recv)(struct i2c_slave_adapter *slv_adap, char *buf,
242 int count, int min_count, int timeout_ms);
243
244 /* Flush the receive and transmit buffer.
245 */
246 int (*slave_flush_buffer)(struct i2c_slave_adapter *slv_adap,
247 int is_flush_tx_buffer, int is_flush_rx_buffer);
248
249 /* Get the number of dummy char cycle.
250 * Get the number of master read cycle on which dummy character has
251 * been sent.
252 * This can be treat as NACK cycle from slave side.
253 * Pass option whether count need to be reset or not.
254 */
255 int (*slave_get_nack_cycle)(struct i2c_slave_adapter *slv_adap,
256 int is_cout_reset);
257};
258#endif /* __KERNEL__ */
259#endif /* _LINUX_I2C_SLAVE_H */
diff --git a/include/linux/i2c-tegra.h b/include/linux/i2c-tegra.h
index 9c85da49857..2b200c49acf 100644
--- a/include/linux/i2c-tegra.h
+++ b/include/linux/i2c-tegra.h
@@ -4,6 +4,8 @@
4 * Copyright (C) 2010 Google, Inc. 4 * Copyright (C) 2010 Google, Inc.
5 * Author: Colin Cross <ccross@android.com> 5 * Author: Colin Cross <ccross@android.com>
6 * 6 *
7 * Copyright (C) 2010-2011 NVIDIA Corporation
8 *
7 * This software is licensed under the terms of the GNU General Public 9 * This software is licensed under the terms of the GNU General Public
8 * License version 2, as published by the Free Software Foundation, and 10 * License version 2, as published by the Free Software Foundation, and
9 * may be copied, distributed, and modified under those terms. 11 * may be copied, distributed, and modified under those terms.
@@ -18,8 +20,35 @@
18#ifndef _LINUX_I2C_TEGRA_H 20#ifndef _LINUX_I2C_TEGRA_H
19#define _LINUX_I2C_TEGRA_H 21#define _LINUX_I2C_TEGRA_H
20 22
23#include <mach/pinmux.h>
24
25#define TEGRA_I2C_MAX_BUS 3
26
21struct tegra_i2c_platform_data { 27struct tegra_i2c_platform_data {
28 int adapter_nr;
29 int bus_count;
30 const struct tegra_pingroup_config *bus_mux[TEGRA_I2C_MAX_BUS];
31 int bus_mux_len[TEGRA_I2C_MAX_BUS];
32 unsigned long bus_clk_rate[TEGRA_I2C_MAX_BUS];
33 bool is_dvc;
34 bool is_clkon_always;
35 int retries;
36 int timeout; /* in jiffies */
37 u16 slave_addr;
38 int scl_gpio[TEGRA_I2C_MAX_BUS];
39 int sda_gpio[TEGRA_I2C_MAX_BUS];
40 int (*arb_recovery)(int scl_gpio, int sda_gpio);
41 bool is_high_speed_enable;
42 u16 hs_master_code;
43};
44
45struct tegra_i2c_slave_platform_data {
46 int adapter_nr;
47 const struct tegra_pingroup_config *pinmux;
48 int bus_mux_len;
22 unsigned long bus_clk_rate; 49 unsigned long bus_clk_rate;
50 int max_rx_buffer_size;
51 int max_tx_buffer_size;
23}; 52};
24 53
25#endif /* _LINUX_I2C_TEGRA_H */ 54#endif /* _LINUX_I2C_TEGRA_H */
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index a6c652ef516..0bd9ea2b62e 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -540,6 +540,7 @@ struct i2c_msg {
540#define I2C_FUNC_SMBUS_WRITE_BLOCK_DATA 0x02000000 540#define I2C_FUNC_SMBUS_WRITE_BLOCK_DATA 0x02000000
541#define I2C_FUNC_SMBUS_READ_I2C_BLOCK 0x04000000 /* I2C-like block xfer */ 541#define I2C_FUNC_SMBUS_READ_I2C_BLOCK 0x04000000 /* I2C-like block xfer */
542#define I2C_FUNC_SMBUS_WRITE_I2C_BLOCK 0x08000000 /* w/ 1-byte reg. addr. */ 542#define I2C_FUNC_SMBUS_WRITE_I2C_BLOCK 0x08000000 /* w/ 1-byte reg. addr. */
543#define I2C_FUNC_I2C_SLAVE_SUPPORT 0x10000000 /* i2c slave support */
543 544
544#define I2C_FUNC_SMBUS_BYTE (I2C_FUNC_SMBUS_READ_BYTE | \ 545#define I2C_FUNC_SMBUS_BYTE (I2C_FUNC_SMBUS_READ_BYTE | \
545 I2C_FUNC_SMBUS_WRITE_BYTE) 546 I2C_FUNC_SMBUS_WRITE_BYTE)
diff --git a/include/linux/i2c/atmel_mxt_ts.h b/include/linux/i2c/atmel_mxt_ts.h
index f027f7a6351..29550c11f6d 100644
--- a/include/linux/i2c/atmel_mxt_ts.h
+++ b/include/linux/i2c/atmel_mxt_ts.h
@@ -2,6 +2,8 @@
2 * Atmel maXTouch Touchscreen driver 2 * Atmel maXTouch Touchscreen driver
3 * 3 *
4 * Copyright (C) 2010 Samsung Electronics Co.Ltd 4 * Copyright (C) 2010 Samsung Electronics Co.Ltd
5 * Copyright (C) 2011 Atmel Corporation
6 * Copyright (C) 2011 NVIDIA Corporation
5 * Author: Joonyoung Shim <jy0922.shim@samsung.com> 7 * Author: Joonyoung Shim <jy0922.shim@samsung.com>
6 * 8 *
7 * This program is free software; you can redistribute it and/or modify it 9 * This program is free software; you can redistribute it and/or modify it
@@ -15,6 +17,16 @@
15 17
16#include <linux/types.h> 18#include <linux/types.h>
17 19
20/*
21 * Atmel I2C addresses
22 */
23#define MXT224_I2C_ADDR1 0x4A
24#define MXT224_I2C_ADDR2 0x4B
25#define MXT1386_I2C_ADDR1 0x4C
26#define MXT1386_I2C_ADDR2 0x4D
27#define MXT1386_I2C_ADDR3 0x5A
28#define MXT1386_I2C_ADDR4 0x5B
29
18/* Orient */ 30/* Orient */
19#define MXT_NORMAL 0x0 31#define MXT_NORMAL 0x0
20#define MXT_DIAGONAL 0x1 32#define MXT_DIAGONAL 0x1
@@ -39,6 +51,10 @@ struct mxt_platform_data {
39 unsigned int voltage; 51 unsigned int voltage;
40 unsigned char orient; 52 unsigned char orient;
41 unsigned long irqflags; 53 unsigned long irqflags;
54 u8(*read_chg) (void);
55 unsigned long config_crc;
56 unsigned int actv_cycle_time;
57 unsigned int idle_cycle_time;
42}; 58};
43 59
44#endif /* __LINUX_ATMEL_MXT_TS_H */ 60#endif /* __LINUX_ATMEL_MXT_TS_H */
diff --git a/include/linux/i2c/panjit_ts.h b/include/linux/i2c/panjit_ts.h
new file mode 100644
index 00000000000..1dd51e1ecae
--- /dev/null
+++ b/include/linux/i2c/panjit_ts.h
@@ -0,0 +1,30 @@
1/*
2 * include/linux/i2c/panjit_ts.h
3 *
4 * Copyright (c) 2010, NVIDIA Corporation.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, 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
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 */
20
21#ifndef _LINUX_I2C_PANJIT_TS_H
22#define _LINUX_I2C_PANJIT_TS_H
23
24struct device;
25
26struct panjit_i2c_ts_platform_data {
27 int gpio_reset;
28};
29
30#endif
diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h
index ba4f88624fc..bb92f0b1328 100644
--- a/include/linux/i2c/twl.h
+++ b/include/linux/i2c/twl.h
@@ -82,6 +82,10 @@
82#define TWL_MODULE_RTC TWL4030_MODULE_RTC 82#define TWL_MODULE_RTC TWL4030_MODULE_RTC
83#define TWL_MODULE_PWM TWL4030_MODULE_PWM0 83#define TWL_MODULE_PWM TWL4030_MODULE_PWM0
84 84
85#define TWL6030_MODULE_CHARGER TWL4030_MODULE_MAIN_CHARGE
86#define TWL6025_MODULE_CHARGER 0x18
87
88#define TWL6030_MODULE_GASGAUGE 0x0B
85#define TWL6030_MODULE_ID0 0x0D 89#define TWL6030_MODULE_ID0 0x0D
86#define TWL6030_MODULE_ID1 0x0E 90#define TWL6030_MODULE_ID1 0x0E
87#define TWL6030_MODULE_ID2 0x0F 91#define TWL6030_MODULE_ID2 0x0F
@@ -108,6 +112,7 @@
108#define GASGAUGE_INTR_OFFSET 17 112#define GASGAUGE_INTR_OFFSET 17
109#define USBOTG_INTR_OFFSET 4 113#define USBOTG_INTR_OFFSET 4
110#define CHARGER_INTR_OFFSET 2 114#define CHARGER_INTR_OFFSET 2
115#define GPADCSW_INTR_OFFSET 1
111#define RSV_INTR_OFFSET 0 116#define RSV_INTR_OFFSET 0
112 117
113/* INT register offsets */ 118/* INT register offsets */
@@ -172,6 +177,14 @@ TWL_CLASS_IS(4030, TWL4030_CLASS_ID)
172TWL_CLASS_IS(6030, TWL6030_CLASS_ID) 177TWL_CLASS_IS(6030, TWL6030_CLASS_ID)
173 178
174#define TWL6025_SUBCLASS BIT(4) /* TWL6025 has changed registers */ 179#define TWL6025_SUBCLASS BIT(4) /* TWL6025 has changed registers */
180#define MPU80031_SUBCLASS BIT(5) /* MPU80031 has changed registers */
181
182/* So we can recover the features in other parts of twl stack */
183unsigned int twl_features(void);
184
185/* so we can get at the EPROM SMPS OFFSET/MULT stuff */
186u8 twl_get_smps_offset(void);
187u8 twl_get_smps_mult(void);
175 188
176/* 189/*
177 * Read and write single 8-bit registers 190 * Read and write single 8-bit registers
@@ -179,6 +192,8 @@ TWL_CLASS_IS(6030, TWL6030_CLASS_ID)
179int twl_i2c_write_u8(u8 mod_no, u8 val, u8 reg); 192int twl_i2c_write_u8(u8 mod_no, u8 val, u8 reg);
180int twl_i2c_read_u8(u8 mod_no, u8 *val, u8 reg); 193int twl_i2c_read_u8(u8 mod_no, u8 *val, u8 reg);
181 194
195void twl_reg_dump(int module, int start, int end);
196
182/* 197/*
183 * Read and write several 8-bit registers at once. 198 * Read and write several 8-bit registers at once.
184 * 199 *
@@ -215,6 +230,10 @@ static inline int twl6030_mmc_card_detect(struct device *dev, int slot)
215 return -EIO; 230 return -EIO;
216} 231}
217#endif 232#endif
233
234int twl6030_set_usb_charge_enable(int enable);
235int twl6030_set_usb_in_current(int currentmA);
236
218/*----------------------------------------------------------------------*/ 237/*----------------------------------------------------------------------*/
219 238
220/* 239/*
@@ -552,11 +571,27 @@ static inline int twl6030_mmc_card_detect(struct device *dev, int slot)
552 571
553struct twl4030_clock_init_data { 572struct twl4030_clock_init_data {
554 bool ck32k_lowpwr_enable; 573 bool ck32k_lowpwr_enable;
574 bool clk32_active_state_on;
555}; 575};
556 576
557struct twl4030_bci_platform_data { 577struct twl4030_bci_platform_data {
558 int *battery_tmp_tbl; 578 int *battery_tmp_tbl;
559 unsigned int tblsize; 579 unsigned int battery_tmp_tblsize;
580 int *battery_volt_tbl;
581 unsigned int battery_volt_tblsize;
582 unsigned int monitoring_interval;
583
584 unsigned int max_charger_currentmA;
585 unsigned int max_charger_voltagemV;
586 unsigned int termination_currentmA;
587
588 unsigned int max_bat_voltagemV;
589 unsigned int low_bat_voltagemV;
590
591 /* twl6025 */
592 unsigned int use_hw_charger;
593 unsigned int use_eeprom_config;
594 unsigned int power_path;
560}; 595};
561 596
562/* TWL4030_GPIO_MAX (18) GPIOs, with interrupts */ 597/* TWL4030_GPIO_MAX (18) GPIOs, with interrupts */
@@ -621,6 +656,7 @@ struct twl4030_usb_data {
621 int (*phy_set_clock)(struct device *dev, int on); 656 int (*phy_set_clock)(struct device *dev, int on);
622 /* suspend/resume of phy */ 657 /* suspend/resume of phy */
623 int (*phy_suspend)(struct device *dev, int suspend); 658 int (*phy_suspend)(struct device *dev, int suspend);
659 int (*board_control_power)(struct device *dev, int on);
624}; 660};
625 661
626struct twl4030_ins { 662struct twl4030_ins {
@@ -657,32 +693,49 @@ struct twl4030_power_data {
657extern void twl4030_power_init(struct twl4030_power_data *triton2_scripts); 693extern void twl4030_power_init(struct twl4030_power_data *triton2_scripts);
658extern int twl4030_remove_script(u8 flags); 694extern int twl4030_remove_script(u8 flags);
659 695
660struct twl4030_codec_audio_data { 696struct twl4030_codec_data {
661 unsigned int digimic_delay; /* in ms */ 697 unsigned int digimic_delay; /* in ms */
662 unsigned int ramp_delay_value; 698 unsigned int ramp_delay_value;
663 unsigned int offset_cncl_path; 699 unsigned int offset_cncl_path;
664 unsigned int check_defaults:1; 700 unsigned int check_defaults:1;
665 unsigned int reset_registers:1; 701 unsigned int reset_registers:1;
666 unsigned int hs_extmute:1; 702 unsigned int hs_extmute:1;
703 u16 hs_left_step;
704 u16 hs_right_step;
705 u16 hf_left_step;
706 u16 hf_right_step;
667 void (*set_hs_extmute)(int mute); 707 void (*set_hs_extmute)(int mute);
668}; 708};
669 709
670struct twl4030_codec_vibra_data { 710struct twl4030_vibra_data {
671 unsigned int coexist; 711 unsigned int coexist;
712
713 /* twl6040 */
714 unsigned int vibldrv_res; /* left driver resistance */
715 unsigned int vibrdrv_res; /* right driver resistance */
716 unsigned int viblmotor_res; /* left motor resistance */
717 unsigned int vibrmotor_res; /* right motor resistance */
718 int vddvibl_uV; /* VDDVIBL volt, set 0 for fixed reg */
719 int vddvibr_uV; /* VDDVIBR volt, set 0 for fixed reg */
672}; 720};
673 721
674struct twl4030_codec_data { 722struct twl4030_audio_data {
675 unsigned int audio_mclk; 723 unsigned int audio_mclk;
676 struct twl4030_codec_audio_data *audio; 724 struct twl4030_codec_data *codec;
677 struct twl4030_codec_vibra_data *vibra; 725 struct twl4030_vibra_data *vibra;
678 726
679 /* twl6040 */ 727 /* twl6040 */
680 int audpwron_gpio; /* audio power-on gpio */ 728 int audpwron_gpio; /* audio power-on gpio */
681 int naudint_irq; /* audio interrupt */ 729 int naudint_irq; /* audio interrupt */
730 unsigned int irq_base;
682}; 731};
683 732
684struct twl4030_platform_data { 733struct twl4030_platform_data {
685 unsigned irq_base, irq_end; 734 unsigned irq_base, irq_end;
735
736 /* Callback for boar regulator initialisation */
737 int (*init)(void);
738
686 struct twl4030_clock_init_data *clock; 739 struct twl4030_clock_init_data *clock;
687 struct twl4030_bci_platform_data *bci; 740 struct twl4030_bci_platform_data *bci;
688 struct twl4030_gpio_platform_data *gpio; 741 struct twl4030_gpio_platform_data *gpio;
@@ -690,7 +743,7 @@ struct twl4030_platform_data {
690 struct twl4030_keypad_data *keypad; 743 struct twl4030_keypad_data *keypad;
691 struct twl4030_usb_data *usb; 744 struct twl4030_usb_data *usb;
692 struct twl4030_power_data *power; 745 struct twl4030_power_data *power;
693 struct twl4030_codec_data *codec; 746 struct twl4030_audio_data *audio;
694 747
695 /* Common LDO regulators for TWL4030/TWL6030 */ 748 /* Common LDO regulators for TWL4030/TWL6030 */
696 struct regulator_init_data *vdac; 749 struct regulator_init_data *vdac;
@@ -809,6 +862,22 @@ static inline int twl4030charger_usb_en(int enable) { return 0; }
809#define TWL6030_REG_VDAC 45 862#define TWL6030_REG_VDAC 45
810#define TWL6030_REG_VUSB 46 863#define TWL6030_REG_VUSB 46
811 864
865/* These are renamed in 6025 but same registers */
866#define TWL6025_REG_LDO2 48
867#define TWL6025_REG_LDO4 49
868#define TWL6025_REG_LDO3 50
869#define TWL6025_REG_LDO5 51
870#define TWL6025_REG_LDO1 52
871#define TWL6025_REG_LDO7 53
872#define TWL6025_REG_LDO6 54
873#define TWL6025_REG_LDOLN 55
874#define TWL6025_REG_LDOUSB 56
875
876/* 6025 DCDC supplies */
877#define TWL6025_REG_SMPS3 57
878#define TWL6025_REG_SMPS4 58
879#define TWL6025_REG_VIO 59
880
812/* INTERNAL LDOs */ 881/* INTERNAL LDOs */
813#define TWL6030_REG_VRTC 47 882#define TWL6030_REG_VRTC 47
814#define TWL6030_REG_CLK32KG 48 883#define TWL6030_REG_CLK32KG 48
diff --git a/include/linux/i2c/twl4030-madc.h b/include/linux/i2c/twl4030-madc.h
index 6427d298fbf..530e11ba073 100644
--- a/include/linux/i2c/twl4030-madc.h
+++ b/include/linux/i2c/twl4030-madc.h
@@ -129,6 +129,10 @@ enum sample_type {
129#define REG_BCICTL2 0x024 129#define REG_BCICTL2 0x024
130#define TWL4030_BCI_ITHSENS 0x007 130#define TWL4030_BCI_ITHSENS 0x007
131 131
132/* Register and bits for GPBR1 register */
133#define TWL4030_REG_GPBR1 0x0c
134#define TWL4030_GPBR1_MADC_HFCLK_EN (1 << 7)
135
132struct twl4030_madc_user_parms { 136struct twl4030_madc_user_parms {
133 int channel; 137 int channel;
134 int average; 138 int average;
diff --git a/include/linux/i8253.h b/include/linux/i8253.h
new file mode 100644
index 00000000000..e6bb36a9751
--- /dev/null
+++ b/include/linux/i8253.h
@@ -0,0 +1,29 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Machine specific IO port address definition for generic.
7 * Written by Osamu Tomita <tomita@cinet.co.jp>
8 */
9#ifndef __LINUX_I8253_H
10#define __LINUX_I8253_H
11
12#include <linux/param.h>
13#include <linux/spinlock.h>
14#include <linux/timex.h>
15
16/* i8253A PIT registers */
17#define PIT_MODE 0x43
18#define PIT_CH0 0x40
19#define PIT_CH2 0x42
20
21#define PIT_LATCH ((PIT_TICK_RATE + HZ/2) / HZ)
22
23extern raw_spinlock_t i8253_lock;
24extern struct clock_event_device i8253_clockevent;
25extern void clockevent_i8253_init(bool oneshot);
26
27extern void setup_pit_timer(void);
28
29#endif /* __LINUX_I8253_H */
diff --git a/include/linux/idr.h b/include/linux/idr.h
index 13a801f3d02..255491cf522 100644
--- a/include/linux/idr.h
+++ b/include/linux/idr.h
@@ -146,6 +146,10 @@ void ida_remove(struct ida *ida, int id);
146void ida_destroy(struct ida *ida); 146void ida_destroy(struct ida *ida);
147void ida_init(struct ida *ida); 147void ida_init(struct ida *ida);
148 148
149int ida_simple_get(struct ida *ida, unsigned int start, unsigned int end,
150 gfp_t gfp_mask);
151void ida_simple_remove(struct ida *ida, unsigned int id);
152
149void __init idr_init_cache(void); 153void __init idr_init_cache(void);
150 154
151#endif /* __IDR_H__ */ 155#endif /* __IDR_H__ */
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index bf56b6f7827..54c87896087 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -117,8 +117,19 @@
117#define IEEE80211_MAX_MESH_ID_LEN 32 117#define IEEE80211_MAX_MESH_ID_LEN 32
118 118
119#define IEEE80211_QOS_CTL_LEN 2 119#define IEEE80211_QOS_CTL_LEN 2
120#define IEEE80211_QOS_CTL_TID_MASK 0x000F 120/* 1d tag mask */
121#define IEEE80211_QOS_CTL_TAG1D_MASK 0x0007 121#define IEEE80211_QOS_CTL_TAG1D_MASK 0x0007
122/* TID mask */
123#define IEEE80211_QOS_CTL_TID_MASK 0x000f
124/* EOSP */
125#define IEEE80211_QOS_CTL_EOSP 0x0010
126/* ACK policy */
127#define IEEE80211_QOS_CTL_ACK_POLICY_NORMAL 0x0000
128#define IEEE80211_QOS_CTL_ACK_POLICY_NOACK 0x0020
129#define IEEE80211_QOS_CTL_ACK_POLICY_NO_EXPL 0x0040
130#define IEEE80211_QOS_CTL_ACK_POLICY_BLOCKACK 0x0060
131/* A-MSDU 802.11n */
132#define IEEE80211_QOS_CTL_A_MSDU_PRESENT 0x0080
122 133
123/* U-APSD queue for WMM IEs sent by AP */ 134/* U-APSD queue for WMM IEs sent by AP */
124#define IEEE80211_WMM_IE_AP_QOSINFO_UAPSD (1<<7) 135#define IEEE80211_WMM_IE_AP_QOSINFO_UAPSD (1<<7)
@@ -1423,9 +1434,6 @@ enum ieee80211_sa_query_action {
1423}; 1434};
1424 1435
1425 1436
1426/* A-MSDU 802.11n */
1427#define IEEE80211_QOS_CONTROL_A_MSDU_PRESENT 0x0080
1428
1429/* cipher suite selectors */ 1437/* cipher suite selectors */
1430#define WLAN_CIPHER_SUITE_USE_GROUP 0x000FAC00 1438#define WLAN_CIPHER_SUITE_USE_GROUP 0x000FAC00
1431#define WLAN_CIPHER_SUITE_WEP40 0x000FAC01 1439#define WLAN_CIPHER_SUITE_WEP40 0x000FAC01
@@ -1445,6 +1453,43 @@ enum ieee80211_sa_query_action {
1445 1453
1446#define WLAN_PMKID_LEN 16 1454#define WLAN_PMKID_LEN 16
1447 1455
1456/*
1457 * WMM/802.11e Tspec Element
1458 */
1459#define IEEE80211_WMM_IE_TSPEC_TID_MASK 0x0F
1460#define IEEE80211_WMM_IE_TSPEC_TID_SHIFT 1
1461
1462enum ieee80211_tspec_status_code {
1463 IEEE80211_TSPEC_STATUS_ADMISS_ACCEPTED = 0,
1464 IEEE80211_TSPEC_STATUS_ADDTS_INVAL_PARAMS = 0x1,
1465};
1466
1467struct ieee80211_tspec_ie {
1468 u8 element_id;
1469 u8 len;
1470 u8 oui[3];
1471 u8 oui_type;
1472 u8 oui_subtype;
1473 u8 version;
1474 __le16 tsinfo;
1475 u8 tsinfo_resvd;
1476 __le16 nominal_msdu;
1477 __le16 max_msdu;
1478 __le32 min_service_int;
1479 __le32 max_service_int;
1480 __le32 inactivity_int;
1481 __le32 suspension_int;
1482 __le32 service_start_time;
1483 __le32 min_data_rate;
1484 __le32 mean_data_rate;
1485 __le32 peak_data_rate;
1486 __le32 max_burst_size;
1487 __le32 delay_bound;
1488 __le32 min_phy_rate;
1489 __le16 sba;
1490 __le16 medium_time;
1491} __packed;
1492
1448/** 1493/**
1449 * ieee80211_get_qos_ctl - get pointer to qos control bytes 1494 * ieee80211_get_qos_ctl - get pointer to qos control bytes
1450 * @hdr: the frame 1495 * @hdr: the frame
diff --git a/include/linux/if.h b/include/linux/if.h
index 3bc63e6a02f..03489ca92de 100644
--- a/include/linux/if.h
+++ b/include/linux/if.h
@@ -76,6 +76,8 @@
76#define IFF_BRIDGE_PORT 0x4000 /* device used as bridge port */ 76#define IFF_BRIDGE_PORT 0x4000 /* device used as bridge port */
77#define IFF_OVS_DATAPATH 0x8000 /* device used as Open vSwitch 77#define IFF_OVS_DATAPATH 0x8000 /* device used as Open vSwitch
78 * datapath port */ 78 * datapath port */
79#define IFF_TX_SKB_SHARING 0x10000 /* The interface supports sharing
80 * skbs on transmit */
79 81
80#define IF_GET_IFACE 0x0001 /* for querying only */ 82#define IF_GET_IFACE 0x0001 /* for querying only */
81#define IF_GET_PROTO 0x0002 83#define IF_GET_PROTO 0x0002
diff --git a/include/linux/if_ether.h b/include/linux/if_ether.h
index 0065ffd3226..a3d99ff6e3b 100644
--- a/include/linux/if_ether.h
+++ b/include/linux/if_ether.h
@@ -78,10 +78,15 @@
78 */ 78 */
79#define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */ 79#define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */
80#define ETH_P_AOE 0x88A2 /* ATA over Ethernet */ 80#define ETH_P_AOE 0x88A2 /* ATA over Ethernet */
81#define ETH_P_8021AD 0x88A8 /* 802.1ad Service VLAN */
81#define ETH_P_TIPC 0x88CA /* TIPC */ 82#define ETH_P_TIPC 0x88CA /* TIPC */
83#define ETH_P_8021AH 0x88E7 /* 802.1ah Backbone Service Tag */
82#define ETH_P_1588 0x88F7 /* IEEE 1588 Timesync */ 84#define ETH_P_1588 0x88F7 /* IEEE 1588 Timesync */
83#define ETH_P_FCOE 0x8906 /* Fibre Channel over Ethernet */ 85#define ETH_P_FCOE 0x8906 /* Fibre Channel over Ethernet */
84#define ETH_P_FIP 0x8914 /* FCoE Initialization Protocol */ 86#define ETH_P_FIP 0x8914 /* FCoE Initialization Protocol */
87#define ETH_P_QINQ1 0x9100 /* deprecated QinQ VLAN [ NOT AN OFFICIALLY REGISTERED ID ] */
88#define ETH_P_QINQ2 0x9200 /* deprecated QinQ VLAN [ NOT AN OFFICIALLY REGISTERED ID ] */
89#define ETH_P_QINQ3 0x9300 /* deprecated QinQ VLAN [ NOT AN OFFICIALLY REGISTERED ID ] */
85#define ETH_P_EDSA 0xDADA /* Ethertype DSA [ NOT AN OFFICIALLY REGISTERED ID ] */ 90#define ETH_P_EDSA 0xDADA /* Ethertype DSA [ NOT AN OFFICIALLY REGISTERED ID ] */
86 91
87/* 92/*
diff --git a/include/linux/if_packet.h b/include/linux/if_packet.h
index 7b318630139..c1486060f5e 100644
--- a/include/linux/if_packet.h
+++ b/include/linux/if_packet.h
@@ -49,6 +49,12 @@ struct sockaddr_ll {
49#define PACKET_VNET_HDR 15 49#define PACKET_VNET_HDR 15
50#define PACKET_TX_TIMESTAMP 16 50#define PACKET_TX_TIMESTAMP 16
51#define PACKET_TIMESTAMP 17 51#define PACKET_TIMESTAMP 17
52#define PACKET_FANOUT 18
53
54#define PACKET_FANOUT_HASH 0
55#define PACKET_FANOUT_LB 1
56#define PACKET_FANOUT_CPU 2
57#define PACKET_FANOUT_FLAG_DEFRAG 0x8000
52 58
53struct tpacket_stats { 59struct tpacket_stats {
54 unsigned int tp_packets; 60 unsigned int tp_packets;
diff --git a/include/linux/if_pppolac.h b/include/linux/if_pppolac.h
new file mode 100644
index 00000000000..c06bd6c8ba2
--- /dev/null
+++ b/include/linux/if_pppolac.h
@@ -0,0 +1,33 @@
1/* include/linux/if_pppolac.h
2 *
3 * Header for PPP on L2TP Access Concentrator / PPPoLAC Socket (RFC 2661)
4 *
5 * Copyright (C) 2009 Google, Inc.
6 * Author: Chia-chi Yeh <chiachi@android.com>
7 *
8 * This software is licensed under the terms of the GNU General Public
9 * License version 2, as published by the Free Software Foundation, and
10 * may be copied, distributed, and modified under those terms.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 */
17
18#ifndef __LINUX_IF_PPPOLAC_H
19#define __LINUX_IF_PPPOLAC_H
20
21#include <linux/socket.h>
22#include <linux/types.h>
23
24struct sockaddr_pppolac {
25 sa_family_t sa_family; /* AF_PPPOX */
26 unsigned int sa_protocol; /* PX_PROTO_OLAC */
27 int udp_socket;
28 struct __attribute__((packed)) {
29 __u16 tunnel, session;
30 } local, remote;
31} __attribute__((packed));
32
33#endif /* __LINUX_IF_PPPOLAC_H */
diff --git a/include/linux/if_pppopns.h b/include/linux/if_pppopns.h
new file mode 100644
index 00000000000..0cf34b4d551
--- /dev/null
+++ b/include/linux/if_pppopns.h
@@ -0,0 +1,32 @@
1/* include/linux/if_pppopns.h
2 *
3 * Header for PPP on PPTP Network Server / PPPoPNS Socket (RFC 2637)
4 *
5 * Copyright (C) 2009 Google, Inc.
6 * Author: Chia-chi Yeh <chiachi@android.com>
7 *
8 * This software is licensed under the terms of the GNU General Public
9 * License version 2, as published by the Free Software Foundation, and
10 * may be copied, distributed, and modified under those terms.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 */
17
18#ifndef __LINUX_IF_PPPOPNS_H
19#define __LINUX_IF_PPPOPNS_H
20
21#include <linux/socket.h>
22#include <linux/types.h>
23
24struct sockaddr_pppopns {
25 sa_family_t sa_family; /* AF_PPPOX */
26 unsigned int sa_protocol; /* PX_PROTO_OPNS */
27 int tcp_socket;
28 __u16 local;
29 __u16 remote;
30} __attribute__((packed));
31
32#endif /* __LINUX_IF_PPPOPNS_H */
diff --git a/include/linux/if_pppox.h b/include/linux/if_pppox.h
index 397921b09ef..999ccd3fff3 100644
--- a/include/linux/if_pppox.h
+++ b/include/linux/if_pppox.h
@@ -27,6 +27,8 @@
27#include <linux/ppp_channel.h> 27#include <linux/ppp_channel.h>
28#endif /* __KERNEL__ */ 28#endif /* __KERNEL__ */
29#include <linux/if_pppol2tp.h> 29#include <linux/if_pppol2tp.h>
30#include <linux/if_pppolac.h>
31#include <linux/if_pppopns.h>
30 32
31/* For user-space programs to pick up these definitions 33/* For user-space programs to pick up these definitions
32 * which they wouldn't get otherwise without defining __KERNEL__ 34 * which they wouldn't get otherwise without defining __KERNEL__
@@ -60,7 +62,9 @@ struct pptp_addr {
60#define PX_PROTO_OE 0 /* Currently just PPPoE */ 62#define PX_PROTO_OE 0 /* Currently just PPPoE */
61#define PX_PROTO_OL2TP 1 /* Now L2TP also */ 63#define PX_PROTO_OL2TP 1 /* Now L2TP also */
62#define PX_PROTO_PPTP 2 64#define PX_PROTO_PPTP 2
63#define PX_MAX_PROTO 3 65#define PX_PROTO_OLAC 3
66#define PX_PROTO_OPNS 4
67#define PX_MAX_PROTO 5
64 68
65struct sockaddr_pppox { 69struct sockaddr_pppox {
66 sa_family_t sa_family; /* address family, AF_PPPOX */ 70 sa_family_t sa_family; /* address family, AF_PPPOX */
@@ -167,6 +171,25 @@ struct pptp_opt {
167 u32 seq_sent, seq_recv; 171 u32 seq_sent, seq_recv;
168 int ppp_flags; 172 int ppp_flags;
169}; 173};
174
175struct pppolac_opt {
176 __u32 local;
177 __u32 remote;
178 __u32 recv_sequence;
179 __u32 xmit_sequence;
180 atomic_t sequencing;
181 int (*backlog_rcv)(struct sock *sk_udp, struct sk_buff *skb);
182};
183
184struct pppopns_opt {
185 __u16 local;
186 __u16 remote;
187 __u32 recv_sequence;
188 __u32 xmit_sequence;
189 void (*data_ready)(struct sock *sk_raw, int length);
190 int (*backlog_rcv)(struct sock *sk_raw, struct sk_buff *skb);
191};
192
170#include <net/sock.h> 193#include <net/sock.h>
171 194
172struct pppox_sock { 195struct pppox_sock {
@@ -177,6 +200,8 @@ struct pppox_sock {
177 union { 200 union {
178 struct pppoe_opt pppoe; 201 struct pppoe_opt pppoe;
179 struct pptp_opt pptp; 202 struct pptp_opt pptp;
203 struct pppolac_opt lac;
204 struct pppopns_opt pns;
180 } proto; 205 } proto;
181 __be16 num; 206 __be16 num;
182}; 207};
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index affa27380b7..44da4822bca 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -91,25 +91,6 @@ struct vlan_group {
91 struct rcu_head rcu; 91 struct rcu_head rcu;
92}; 92};
93 93
94static inline struct net_device *vlan_group_get_device(struct vlan_group *vg,
95 u16 vlan_id)
96{
97 struct net_device **array;
98 array = vg->vlan_devices_arrays[vlan_id / VLAN_GROUP_ARRAY_PART_LEN];
99 return array ? array[vlan_id % VLAN_GROUP_ARRAY_PART_LEN] : NULL;
100}
101
102static inline void vlan_group_set_device(struct vlan_group *vg,
103 u16 vlan_id,
104 struct net_device *dev)
105{
106 struct net_device **array;
107 if (!vg)
108 return;
109 array = vg->vlan_devices_arrays[vlan_id / VLAN_GROUP_ARRAY_PART_LEN];
110 array[vlan_id % VLAN_GROUP_ARRAY_PART_LEN] = dev;
111}
112
113static inline int is_vlan_dev(struct net_device *dev) 94static inline int is_vlan_dev(struct net_device *dev)
114{ 95{
115 return dev->priv_flags & IFF_802_1Q_VLAN; 96 return dev->priv_flags & IFF_802_1Q_VLAN;
@@ -119,35 +100,18 @@ static inline int is_vlan_dev(struct net_device *dev)
119#define vlan_tx_tag_get(__skb) ((__skb)->vlan_tci & ~VLAN_TAG_PRESENT) 100#define vlan_tx_tag_get(__skb) ((__skb)->vlan_tci & ~VLAN_TAG_PRESENT)
120 101
121#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) 102#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
122/* Must be invoked with rcu_read_lock or with RTNL. */
123static inline struct net_device *vlan_find_dev(struct net_device *real_dev,
124 u16 vlan_id)
125{
126 struct vlan_group *grp = rcu_dereference_rtnl(real_dev->vlgrp);
127
128 if (grp)
129 return vlan_group_get_device(grp, vlan_id);
130
131 return NULL;
132}
133 103
104extern struct net_device *__vlan_find_dev_deep(struct net_device *real_dev,
105 u16 vlan_id);
134extern struct net_device *vlan_dev_real_dev(const struct net_device *dev); 106extern struct net_device *vlan_dev_real_dev(const struct net_device *dev);
135extern u16 vlan_dev_vlan_id(const struct net_device *dev); 107extern u16 vlan_dev_vlan_id(const struct net_device *dev);
136 108
137extern int __vlan_hwaccel_rx(struct sk_buff *skb, struct vlan_group *grp,
138 u16 vlan_tci, int polling);
139extern bool vlan_do_receive(struct sk_buff **skb); 109extern bool vlan_do_receive(struct sk_buff **skb);
140extern struct sk_buff *vlan_untag(struct sk_buff *skb); 110extern struct sk_buff *vlan_untag(struct sk_buff *skb);
141extern gro_result_t
142vlan_gro_receive(struct napi_struct *napi, struct vlan_group *grp,
143 unsigned int vlan_tci, struct sk_buff *skb);
144extern gro_result_t
145vlan_gro_frags(struct napi_struct *napi, struct vlan_group *grp,
146 unsigned int vlan_tci);
147 111
148#else 112#else
149static inline struct net_device *vlan_find_dev(struct net_device *real_dev, 113static inline struct net_device *
150 u16 vlan_id) 114__vlan_find_dev_deep(struct net_device *real_dev, u16 vlan_id)
151{ 115{
152 return NULL; 116 return NULL;
153} 117}
@@ -164,13 +128,6 @@ static inline u16 vlan_dev_vlan_id(const struct net_device *dev)
164 return 0; 128 return 0;
165} 129}
166 130
167static inline int __vlan_hwaccel_rx(struct sk_buff *skb, struct vlan_group *grp,
168 u16 vlan_tci, int polling)
169{
170 BUG();
171 return NET_XMIT_SUCCESS;
172}
173
174static inline bool vlan_do_receive(struct sk_buff **skb) 131static inline bool vlan_do_receive(struct sk_buff **skb)
175{ 132{
176 if ((*skb)->vlan_tci & VLAN_VID_MASK) 133 if ((*skb)->vlan_tci & VLAN_VID_MASK)
@@ -182,49 +139,9 @@ static inline struct sk_buff *vlan_untag(struct sk_buff *skb)
182{ 139{
183 return skb; 140 return skb;
184} 141}
185
186static inline gro_result_t
187vlan_gro_receive(struct napi_struct *napi, struct vlan_group *grp,
188 unsigned int vlan_tci, struct sk_buff *skb)
189{
190 return GRO_DROP;
191}
192
193static inline gro_result_t
194vlan_gro_frags(struct napi_struct *napi, struct vlan_group *grp,
195 unsigned int vlan_tci)
196{
197 return GRO_DROP;
198}
199#endif 142#endif
200 143
201/** 144/**
202 * vlan_hwaccel_rx - netif_rx wrapper for VLAN RX acceleration
203 * @skb: buffer
204 * @grp: vlan group
205 * @vlan_tci: VLAN TCI as received from the card
206 */
207static inline int vlan_hwaccel_rx(struct sk_buff *skb,
208 struct vlan_group *grp,
209 u16 vlan_tci)
210{
211 return __vlan_hwaccel_rx(skb, grp, vlan_tci, 0);
212}
213
214/**
215 * vlan_hwaccel_receive_skb - netif_receive_skb wrapper for VLAN RX acceleration
216 * @skb: buffer
217 * @grp: vlan group
218 * @vlan_tci: VLAN TCI as received from the card
219 */
220static inline int vlan_hwaccel_receive_skb(struct sk_buff *skb,
221 struct vlan_group *grp,
222 u16 vlan_tci)
223{
224 return __vlan_hwaccel_rx(skb, grp, vlan_tci, 1);
225}
226
227/**
228 * vlan_insert_tag - regular VLAN tag inserting 145 * vlan_insert_tag - regular VLAN tag inserting
229 * @skb: skbuff to tag 146 * @skb: skbuff to tag
230 * @vlan_tci: VLAN TCI to insert 147 * @vlan_tci: VLAN TCI to insert
diff --git a/include/linux/ina219.h b/include/linux/ina219.h
new file mode 100644
index 00000000000..c27fa26c575
--- /dev/null
+++ b/include/linux/ina219.h
@@ -0,0 +1,34 @@
1/*
2 * linux/include/linux/ina219.h
3 *
4 * Copyright (c) 2011, NVIDIA Corporation.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, 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
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 */
20
21#ifndef _INA219_H
22#define _INA219_H
23
24#include <linux/types.h>
25
26struct ina219_platform_data {
27 u8 divisor; /*divisor needed to get current value */
28 u32 calibration_data;
29 u32 power_lsb;
30 char rail_name[20];
31};
32
33#endif /* _LINUX_INA219_H */
34
diff --git a/include/linux/inet_lro.h b/include/linux/inet_lro.h
index c4335faebb6..2cf55afbcd4 100644
--- a/include/linux/inet_lro.h
+++ b/include/linux/inet_lro.h
@@ -50,7 +50,6 @@ struct net_lro_desc {
50 struct skb_frag_struct *next_frag; 50 struct skb_frag_struct *next_frag;
51 struct iphdr *iph; 51 struct iphdr *iph;
52 struct tcphdr *tcph; 52 struct tcphdr *tcph;
53 struct vlan_group *vgrp;
54 __wsum data_csum; 53 __wsum data_csum;
55 __be32 tcp_rcv_tsecr; 54 __be32 tcp_rcv_tsecr;
56 __be32 tcp_rcv_tsval; 55 __be32 tcp_rcv_tsval;
@@ -60,7 +59,6 @@ struct net_lro_desc {
60 u16 ip_tot_len; 59 u16 ip_tot_len;
61 u16 tcp_saw_tstamp; /* timestamps enabled */ 60 u16 tcp_saw_tstamp; /* timestamps enabled */
62 __be16 tcp_window; 61 __be16 tcp_window;
63 u16 vlan_tag;
64 int pkt_aggr_cnt; /* counts aggregated packets */ 62 int pkt_aggr_cnt; /* counts aggregated packets */
65 int vlan_packet; 63 int vlan_packet;
66 int mss; 64 int mss;
@@ -137,16 +135,6 @@ void lro_receive_skb(struct net_lro_mgr *lro_mgr,
137 void *priv); 135 void *priv);
138 136
139/* 137/*
140 * Processes a SKB with VLAN HW acceleration support
141 */
142
143void lro_vlan_hwaccel_receive_skb(struct net_lro_mgr *lro_mgr,
144 struct sk_buff *skb,
145 struct vlan_group *vgrp,
146 u16 vlan_tag,
147 void *priv);
148
149/*
150 * Processes a fragment list 138 * Processes a fragment list
151 * 139 *
152 * This functions aggregate fragments and generate SKBs do pass 140 * This functions aggregate fragments and generate SKBs do pass
@@ -165,13 +153,6 @@ void lro_receive_frags(struct net_lro_mgr *lro_mgr,
165 struct skb_frag_struct *frags, 153 struct skb_frag_struct *frags,
166 int len, int true_size, void *priv, __wsum sum); 154 int len, int true_size, void *priv, __wsum sum);
167 155
168void lro_vlan_hwaccel_receive_frags(struct net_lro_mgr *lro_mgr,
169 struct skb_frag_struct *frags,
170 int len, int true_size,
171 struct vlan_group *vgrp,
172 u16 vlan_tag,
173 void *priv, __wsum sum);
174
175/* 156/*
176 * Forward all aggregated SKBs held by lro_mgr to network stack 157 * Forward all aggregated SKBs held by lro_mgr to network stack
177 */ 158 */
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index 580f70c0239..d14e058aaee 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -176,7 +176,6 @@ extern struct cred init_cred;
176 .alloc_lock = __SPIN_LOCK_UNLOCKED(tsk.alloc_lock), \ 176 .alloc_lock = __SPIN_LOCK_UNLOCKED(tsk.alloc_lock), \
177 .journal_info = NULL, \ 177 .journal_info = NULL, \
178 .cpu_timers = INIT_CPU_TIMERS(tsk.cpu_timers), \ 178 .cpu_timers = INIT_CPU_TIMERS(tsk.cpu_timers), \
179 .fs_excl = ATOMIC_INIT(0), \
180 .pi_lock = __RAW_SPIN_LOCK_UNLOCKED(tsk.pi_lock), \ 179 .pi_lock = __RAW_SPIN_LOCK_UNLOCKED(tsk.pi_lock), \
181 .timer_slack_ns = 50000, /* 50 usec default slack */ \ 180 .timer_slack_ns = 50000, /* 50 usec default slack */ \
182 .pids = { \ 181 .pids = { \
diff --git a/include/linux/input.h b/include/linux/input.h
index 771d6d85667..48857fddf9a 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -119,9 +119,9 @@ struct input_keymap_entry {
119#define EVIOCGSND(len) _IOC(_IOC_READ, 'E', 0x1a, len) /* get all sounds status */ 119#define EVIOCGSND(len) _IOC(_IOC_READ, 'E', 0x1a, len) /* get all sounds status */
120#define EVIOCGSW(len) _IOC(_IOC_READ, 'E', 0x1b, len) /* get all switch states */ 120#define EVIOCGSW(len) _IOC(_IOC_READ, 'E', 0x1b, len) /* get all switch states */
121 121
122#define EVIOCGBIT(ev,len) _IOC(_IOC_READ, 'E', 0x20 + ev, len) /* get event bits */ 122#define EVIOCGBIT(ev,len) _IOC(_IOC_READ, 'E', 0x20 + (ev), len) /* get event bits */
123#define EVIOCGABS(abs) _IOR('E', 0x40 + abs, struct input_absinfo) /* get abs value/limits */ 123#define EVIOCGABS(abs) _IOR('E', 0x40 + (abs), struct input_absinfo) /* get abs value/limits */
124#define EVIOCSABS(abs) _IOW('E', 0xc0 + abs, struct input_absinfo) /* set abs value/limits */ 124#define EVIOCSABS(abs) _IOW('E', 0xc0 + (abs), struct input_absinfo) /* set abs value/limits */
125 125
126#define EVIOCSFF _IOC(_IOC_WRITE, 'E', 0x80, sizeof(struct ff_effect)) /* send a force effect to a force feedback device */ 126#define EVIOCSFF _IOC(_IOC_WRITE, 'E', 0x80, sizeof(struct ff_effect)) /* send a force effect to a force feedback device */
127#define EVIOCRMFF _IOW('E', 0x81, int) /* Erase a force effect */ 127#define EVIOCRMFF _IOW('E', 0x81, int) /* Erase a force effect */
@@ -129,6 +129,9 @@ struct input_keymap_entry {
129 129
130#define EVIOCGRAB _IOW('E', 0x90, int) /* Grab/Release device */ 130#define EVIOCGRAB _IOW('E', 0x90, int) /* Grab/Release device */
131 131
132#define EVIOCGSUSPENDBLOCK _IOR('E', 0x91, int) /* get suspend block enable */
133#define EVIOCSSUSPENDBLOCK _IOW('E', 0x91, int) /* set suspend block enable */
134
132/* 135/*
133 * Device properties and quirks 136 * Device properties and quirks
134 */ 137 */
@@ -438,6 +441,8 @@ struct input_keymap_entry {
438#define KEY_WIMAX 246 441#define KEY_WIMAX 246
439#define KEY_RFKILL 247 /* Key that controls all radios */ 442#define KEY_RFKILL 247 /* Key that controls all radios */
440 443
444#define KEY_MICMUTE 248 /* Mute / unmute the microphone */
445
441/* Code 255 is reserved for special needs of AT keyboard driver */ 446/* Code 255 is reserved for special needs of AT keyboard driver */
442 447
443#define BTN_MISC 0x100 448#define BTN_MISC 0x100
diff --git a/include/linux/input/kxtj9.h b/include/linux/input/kxtj9.h
new file mode 100644
index 00000000000..f6bac89537b
--- /dev/null
+++ b/include/linux/input/kxtj9.h
@@ -0,0 +1,70 @@
1/*
2 * Copyright (C) 2011 Kionix, Inc.
3 * Written by Chris Hudson <chudson@kionix.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
17 * 02111-1307, USA
18 */
19
20#ifndef __KXTJ9_H__
21#define __KXTJ9_H__
22
23#define KXTJ9_I2C_ADDR 0x0F
24
25struct kxtj9_platform_data {
26 unsigned int min_interval; /* minimum poll interval (in milli-seconds) */
27
28 /*
29 * By default, x is axis 0, y is axis 1, z is axis 2; these can be
30 * changed to account for sensor orientation within the host device.
31 */
32 u8 axis_map_x;
33 u8 axis_map_y;
34 u8 axis_map_z;
35
36 /*
37 * Each axis can be negated to account for sensor orientation within
38 * the host device.
39 */
40 bool negate_x;
41 bool negate_y;
42 bool negate_z;
43
44 /* CTRL_REG1: set resolution, g-range, data ready enable */
45 /* Output resolution: 8-bit valid or 12-bit valid */
46 #define RES_8BIT 0
47 #define RES_12BIT (1 << 6)
48 u8 res_12bit;
49 /* Output g-range: +/-2g, 4g, or 8g */
50 #define KXTJ9_G_2G 0
51 #define KXTJ9_G_4G (1 << 3)
52 #define KXTJ9_G_8G (1 << 4)
53 u8 g_range;
54
55 /* DATA_CTRL_REG: controls the output data rate of the part */
56 #define ODR12_5F 0
57 #define ODR25F 1
58 #define ODR50F 2
59 #define ODR100F 3
60 #define ODR200F 4
61 #define ODR400F 5
62 #define ODR800F 6
63 u8 data_odr_init;
64
65 int (*init)(void);
66 void (*exit)(void);
67 int (*power_on)(void);
68 int (*power_off)(void);
69};
70#endif /* __KXTJ9_H__ */
diff --git a/include/linux/intel-iommu.h b/include/linux/intel-iommu.h
index 9310c699a37..e6ca56de993 100644
--- a/include/linux/intel-iommu.h
+++ b/include/linux/intel-iommu.h
@@ -271,7 +271,7 @@ struct qi_desc {
271}; 271};
272 272
273struct q_inval { 273struct q_inval {
274 spinlock_t q_lock; 274 raw_spinlock_t q_lock;
275 struct qi_desc *desc; /* invalidation queue */ 275 struct qi_desc *desc; /* invalidation queue */
276 int *desc_status; /* desc status */ 276 int *desc_status; /* desc status */
277 int free_head; /* first free entry */ 277 int free_head; /* first free entry */
@@ -279,7 +279,7 @@ struct q_inval {
279 int free_cnt; 279 int free_cnt;
280}; 280};
281 281
282#ifdef CONFIG_INTR_REMAP 282#ifdef CONFIG_IRQ_REMAP
283/* 1MB - maximum possible interrupt remapping table size */ 283/* 1MB - maximum possible interrupt remapping table size */
284#define INTR_REMAP_PAGE_ORDER 8 284#define INTR_REMAP_PAGE_ORDER 8
285#define INTR_REMAP_TABLE_REG_SIZE 0xf 285#define INTR_REMAP_TABLE_REG_SIZE 0xf
@@ -311,14 +311,14 @@ struct intel_iommu {
311 u64 cap; 311 u64 cap;
312 u64 ecap; 312 u64 ecap;
313 u32 gcmd; /* Holds TE, EAFL. Don't need SRTP, SFL, WBF */ 313 u32 gcmd; /* Holds TE, EAFL. Don't need SRTP, SFL, WBF */
314 spinlock_t register_lock; /* protect register handling */ 314 raw_spinlock_t register_lock; /* protect register handling */
315 int seq_id; /* sequence id of the iommu */ 315 int seq_id; /* sequence id of the iommu */
316 int agaw; /* agaw of this iommu */ 316 int agaw; /* agaw of this iommu */
317 int msagaw; /* max sagaw of this iommu */ 317 int msagaw; /* max sagaw of this iommu */
318 unsigned int irq; 318 unsigned int irq;
319 unsigned char name[13]; /* Device Name */ 319 unsigned char name[13]; /* Device Name */
320 320
321#ifdef CONFIG_DMAR 321#ifdef CONFIG_INTEL_IOMMU
322 unsigned long *domain_ids; /* bitmap of domains */ 322 unsigned long *domain_ids; /* bitmap of domains */
323 struct dmar_domain **domains; /* ptr to domains */ 323 struct dmar_domain **domains; /* ptr to domains */
324 spinlock_t lock; /* protect context, domain ids */ 324 spinlock_t lock; /* protect context, domain ids */
@@ -329,7 +329,7 @@ struct intel_iommu {
329 struct q_inval *qi; /* Queued invalidation info */ 329 struct q_inval *qi; /* Queued invalidation info */
330 u32 *iommu_state; /* Store iommu states between suspend and resume.*/ 330 u32 *iommu_state; /* Store iommu states between suspend and resume.*/
331 331
332#ifdef CONFIG_INTR_REMAP 332#ifdef CONFIG_IRQ_REMAP
333 struct ir_table *ir_table; /* Interrupt remapping info */ 333 struct ir_table *ir_table; /* Interrupt remapping info */
334#endif 334#endif
335 int node; 335 int node;
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index f6efed0039e..f51a81bc46d 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -17,7 +17,7 @@
17#include <linux/kref.h> 17#include <linux/kref.h>
18#include <linux/workqueue.h> 18#include <linux/workqueue.h>
19 19
20#include <asm/atomic.h> 20#include <linux/atomic.h>
21#include <asm/ptrace.h> 21#include <asm/ptrace.h>
22#include <asm/system.h> 22#include <asm/system.h>
23#include <trace/events/irq.h> 23#include <trace/events/irq.h>
@@ -59,6 +59,8 @@
59 * IRQF_NO_SUSPEND - Do not disable this IRQ during suspend 59 * IRQF_NO_SUSPEND - Do not disable this IRQ during suspend
60 * IRQF_FORCE_RESUME - Force enable it on resume even if IRQF_NO_SUSPEND is set 60 * IRQF_FORCE_RESUME - Force enable it on resume even if IRQF_NO_SUSPEND is set
61 * IRQF_NO_THREAD - Interrupt cannot be threaded 61 * IRQF_NO_THREAD - Interrupt cannot be threaded
62 * IRQF_EARLY_RESUME - Resume IRQ early during syscore instead of at device
63 * resume time.
62 */ 64 */
63#define IRQF_DISABLED 0x00000020 65#define IRQF_DISABLED 0x00000020
64#define IRQF_SAMPLE_RANDOM 0x00000040 66#define IRQF_SAMPLE_RANDOM 0x00000040
@@ -72,6 +74,7 @@
72#define IRQF_NO_SUSPEND 0x00004000 74#define IRQF_NO_SUSPEND 0x00004000
73#define IRQF_FORCE_RESUME 0x00008000 75#define IRQF_FORCE_RESUME 0x00008000
74#define IRQF_NO_THREAD 0x00010000 76#define IRQF_NO_THREAD 0x00010000
77#define IRQF_EARLY_RESUME 0x00020000
75 78
76#define IRQF_TIMER (__IRQF_TIMER | IRQF_NO_SUSPEND | IRQF_NO_THREAD) 79#define IRQF_TIMER (__IRQF_TIMER | IRQF_NO_SUSPEND | IRQF_NO_THREAD)
77 80
diff --git a/include/linux/interrupt_keys.h b/include/linux/interrupt_keys.h
new file mode 100644
index 00000000000..8be6e9a6b0a
--- /dev/null
+++ b/include/linux/interrupt_keys.h
@@ -0,0 +1,47 @@
1/*
2 * include/linux/interrupt_keys.h
3 *
4 * Key driver for keys directly connected to intrrupt lines.
5 *
6 * Copyright (c) 2011, NVIDIA Corporation.
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, but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 * 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 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 */
22
23#ifndef _INTERRUPT_KEYS_H
24#define _INTERRUPT_KEYS_H
25
26struct interrupt_keys_button {
27 /* Configuration parameters */
28 int code; /* input event code (KEY_*, SW_*) */
29 int irq;
30 int active_low;
31 char *desc;
32 int type; /* input event type (EV_KEY, EV_SW) */
33 int wakeup; /* configure the interrupt source as a wake-up
34 * source */
35 int debounce_interval; /* debounce ticks interval in msecs */
36 bool can_disable;
37};
38
39struct interrupt_keys_platform_data {
40 struct interrupt_keys_button *int_buttons;
41 int nbuttons;
42 unsigned int rep:1; /* enable input subsystem auto repeat */
43 int (*enable)(struct device *dev);
44 void (*disable)(struct device *dev);
45};
46
47#endif
diff --git a/include/linux/io-mapping.h b/include/linux/io-mapping.h
index 8cdcc2a199a..1feeb526356 100644
--- a/include/linux/io-mapping.h
+++ b/include/linux/io-mapping.h
@@ -117,6 +117,8 @@ io_mapping_unmap(void __iomem *vaddr)
117 117
118#else 118#else
119 119
120#include <linux/uaccess.h>
121
120/* this struct isn't actually defined anywhere */ 122/* this struct isn't actually defined anywhere */
121struct io_mapping; 123struct io_mapping;
122 124
@@ -138,12 +140,14 @@ static inline void __iomem *
138io_mapping_map_atomic_wc(struct io_mapping *mapping, 140io_mapping_map_atomic_wc(struct io_mapping *mapping,
139 unsigned long offset) 141 unsigned long offset)
140{ 142{
143 pagefault_disable();
141 return ((char __force __iomem *) mapping) + offset; 144 return ((char __force __iomem *) mapping) + offset;
142} 145}
143 146
144static inline void 147static inline void
145io_mapping_unmap_atomic(void __iomem *vaddr) 148io_mapping_unmap_atomic(void __iomem *vaddr)
146{ 149{
150 pagefault_enable();
147} 151}
148 152
149/* Non-atomic map/unmap */ 153/* Non-atomic map/unmap */
diff --git a/include/linux/iocontext.h b/include/linux/iocontext.h
index b2eee896dcb..5037a0ad231 100644
--- a/include/linux/iocontext.h
+++ b/include/linux/iocontext.h
@@ -5,6 +5,14 @@
5#include <linux/rcupdate.h> 5#include <linux/rcupdate.h>
6 6
7struct cfq_queue; 7struct cfq_queue;
8struct cfq_ttime {
9 unsigned long last_end_request;
10
11 unsigned long ttime_total;
12 unsigned long ttime_samples;
13 unsigned long ttime_mean;
14};
15
8struct cfq_io_context { 16struct cfq_io_context {
9 void *key; 17 void *key;
10 18
@@ -12,11 +20,7 @@ struct cfq_io_context {
12 20
13 struct io_context *ioc; 21 struct io_context *ioc;
14 22
15 unsigned long last_end_request; 23 struct cfq_ttime ttime;
16
17 unsigned long ttime_total;
18 unsigned long ttime_samples;
19 unsigned long ttime_mean;
20 24
21 struct list_head queue_list; 25 struct list_head queue_list;
22 struct hlist_node cic_list; 26 struct hlist_node cic_list;
diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index 0a2ba409899..d937580417b 100644
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@ -19,65 +19,134 @@
19#ifndef __LINUX_IOMMU_H 19#ifndef __LINUX_IOMMU_H
20#define __LINUX_IOMMU_H 20#define __LINUX_IOMMU_H
21 21
22#include <linux/errno.h>
23
22#define IOMMU_READ (1) 24#define IOMMU_READ (1)
23#define IOMMU_WRITE (2) 25#define IOMMU_WRITE (2)
24#define IOMMU_CACHE (4) /* DMA cache coherency */ 26#define IOMMU_CACHE (4) /* DMA cache coherency */
25 27
28struct iommu_ops;
29struct bus_type;
26struct device; 30struct device;
31struct iommu_domain;
32
33/* iommu fault flags */
34#define IOMMU_FAULT_READ 0x0
35#define IOMMU_FAULT_WRITE 0x1
36
37typedef int (*iommu_fault_handler_t)(struct iommu_domain *,
38 struct device *, unsigned long, int);
27 39
28struct iommu_domain { 40struct iommu_domain {
41 struct iommu_ops *ops;
29 void *priv; 42 void *priv;
43 iommu_fault_handler_t handler;
30}; 44};
31 45
32#define IOMMU_CAP_CACHE_COHERENCY 0x1 46#define IOMMU_CAP_CACHE_COHERENCY 0x1
33#define IOMMU_CAP_INTR_REMAP 0x2 /* isolates device intrs */ 47#define IOMMU_CAP_INTR_REMAP 0x2 /* isolates device intrs */
34 48
49#ifdef CONFIG_IOMMU_API
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 */
35struct iommu_ops { 64struct iommu_ops {
36 int (*domain_init)(struct iommu_domain *domain); 65 int (*domain_init)(struct iommu_domain *domain);
37 void (*domain_destroy)(struct iommu_domain *domain); 66 void (*domain_destroy)(struct iommu_domain *domain);
38 int (*attach_dev)(struct iommu_domain *domain, struct device *dev); 67 int (*attach_dev)(struct iommu_domain *domain, struct device *dev);
39 void (*detach_dev)(struct iommu_domain *domain, struct device *dev); 68 void (*detach_dev)(struct iommu_domain *domain, struct device *dev);
40 int (*map)(struct iommu_domain *domain, unsigned long iova, 69 int (*map)(struct iommu_domain *domain, unsigned long iova,
41 phys_addr_t paddr, int gfp_order, int prot); 70 phys_addr_t paddr, size_t size, int prot);
42 int (*unmap)(struct iommu_domain *domain, unsigned long iova, 71 size_t (*unmap)(struct iommu_domain *domain, unsigned long iova,
43 int gfp_order); 72 size_t size);
44 phys_addr_t (*iova_to_phys)(struct iommu_domain *domain, 73 phys_addr_t (*iova_to_phys)(struct iommu_domain *domain,
45 unsigned long iova); 74 unsigned long iova);
46 int (*domain_has_cap)(struct iommu_domain *domain, 75 int (*domain_has_cap)(struct iommu_domain *domain,
47 unsigned long cap); 76 unsigned long cap);
77 int (*device_group)(struct device *dev, unsigned int *groupid);
78 unsigned long pgsize_bitmap;
48}; 79};
49 80
50#ifdef CONFIG_IOMMU_API 81extern int bus_set_iommu(struct bus_type *bus, struct iommu_ops *ops);
51 82extern bool iommu_present(struct bus_type *bus);
52extern void register_iommu(struct iommu_ops *ops); 83extern struct iommu_domain *iommu_domain_alloc(struct bus_type *bus);
53extern bool iommu_found(void);
54extern struct iommu_domain *iommu_domain_alloc(void);
55extern void iommu_domain_free(struct iommu_domain *domain); 84extern void iommu_domain_free(struct iommu_domain *domain);
56extern int iommu_attach_device(struct iommu_domain *domain, 85extern int iommu_attach_device(struct iommu_domain *domain,
57 struct device *dev); 86 struct device *dev);
58extern void iommu_detach_device(struct iommu_domain *domain, 87extern void iommu_detach_device(struct iommu_domain *domain,
59 struct device *dev); 88 struct device *dev);
60extern int iommu_map(struct iommu_domain *domain, unsigned long iova, 89extern int iommu_map(struct iommu_domain *domain, unsigned long iova,
61 phys_addr_t paddr, int gfp_order, int prot); 90 phys_addr_t paddr, size_t size, int prot);
62extern int iommu_unmap(struct iommu_domain *domain, unsigned long iova, 91extern size_t iommu_unmap(struct iommu_domain *domain, unsigned long iova,
63 int gfp_order); 92 size_t size);
64extern phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain, 93extern phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain,
65 unsigned long iova); 94 unsigned long iova);
66extern int iommu_domain_has_cap(struct iommu_domain *domain, 95extern int iommu_domain_has_cap(struct iommu_domain *domain,
67 unsigned long cap); 96 unsigned long cap);
97extern void iommu_set_fault_handler(struct iommu_domain *domain,
98 iommu_fault_handler_t handler);
99extern int iommu_device_group(struct device *dev, unsigned int *groupid);
100
101/**
102 * report_iommu_fault() - report about an IOMMU fault to the IOMMU framework
103 * @domain: the iommu domain where the fault has happened
104 * @dev: the device where the fault has happened
105 * @iova: the faulting address
106 * @flags: mmu fault flags (e.g. IOMMU_FAULT_READ/IOMMU_FAULT_WRITE/...)
107 *
108 * This function should be called by the low-level IOMMU implementations
109 * whenever IOMMU faults happen, to allow high-level users, that are
110 * interested in such events, to know about them.
111 *
112 * This event may be useful for several possible use cases:
113 * - mere logging of the event
114 * - dynamic TLB/PTE loading
115 * - if restarting of the faulting device is required
116 *
117 * Returns 0 on success and an appropriate error code otherwise (if dynamic
118 * PTE/TLB loading will one day be supported, implementations will be able
119 * to tell whether it succeeded or not according to this return value).
120 *
121 * Specifically, -ENOSYS is returned if a fault handler isn't installed
122 * (though fault handlers can also return -ENOSYS, in case they want to
123 * elicit the default behavior of the IOMMU drivers).
124 */
125static inline int report_iommu_fault(struct iommu_domain *domain,
126 struct device *dev, unsigned long iova, int flags)
127{
128 int ret = -ENOSYS;
68 129
69#else /* CONFIG_IOMMU_API */ 130 /*
131 * if upper layers showed interest and installed a fault handler,
132 * invoke it.
133 */
134 if (domain->handler)
135 ret = domain->handler(domain, dev, iova, flags);
70 136
71static inline void register_iommu(struct iommu_ops *ops) 137 return ret;
72{
73} 138}
74 139
75static inline bool iommu_found(void) 140#else /* CONFIG_IOMMU_API */
141
142struct iommu_ops {};
143
144static inline bool iommu_present(struct bus_type *bus)
76{ 145{
77 return false; 146 return false;
78} 147}
79 148
80static inline struct iommu_domain *iommu_domain_alloc(void) 149static inline struct iommu_domain *iommu_domain_alloc(struct bus_type *bus)
81{ 150{
82 return NULL; 151 return NULL;
83} 152}
@@ -121,6 +190,16 @@ static inline int domain_has_cap(struct iommu_domain *domain,
121 return 0; 190 return 0;
122} 191}
123 192
193static inline void iommu_set_fault_handler(struct iommu_domain *domain,
194 iommu_fault_handler_t handler)
195{
196}
197
198static inline int iommu_device_group(struct device *dev, unsigned int *groupid)
199{
200 return -ENODEV;
201}
202
124#endif /* CONFIG_IOMMU_API */ 203#endif /* CONFIG_IOMMU_API */
125 204
126#endif /* __LINUX_IOMMU_H */ 205#endif /* __LINUX_IOMMU_H */
diff --git a/include/linux/ion.h b/include/linux/ion.h
new file mode 100644
index 00000000000..9a322437a97
--- /dev/null
+++ b/include/linux/ion.h
@@ -0,0 +1,347 @@
1/*
2 * include/linux/ion.h
3 *
4 * Copyright (C) 2011 Google, Inc.
5 *
6 * This software is licensed under the terms of the GNU General Public
7 * License version 2, as published by the Free Software Foundation, and
8 * may be copied, distributed, and modified under those terms.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 */
16
17#ifndef _LINUX_ION_H
18#define _LINUX_ION_H
19
20#include <linux/types.h>
21
22struct ion_handle;
23/**
24 * enum ion_heap_types - list of all possible types of heaps
25 * @ION_HEAP_TYPE_SYSTEM: memory allocated via vmalloc
26 * @ION_HEAP_TYPE_SYSTEM_CONTIG: memory allocated via kmalloc
27 * @ION_HEAP_TYPE_CARVEOUT: memory allocated from a prereserved
28 * carveout heap, allocations are physically
29 * contiguous
30 * @ION_HEAP_END: helper for iterating over heaps
31 */
32enum ion_heap_type {
33 ION_HEAP_TYPE_SYSTEM,
34 ION_HEAP_TYPE_SYSTEM_CONTIG,
35 ION_HEAP_TYPE_CARVEOUT,
36 ION_HEAP_TYPE_IOMMU,
37 ION_HEAP_TYPE_CUSTOM, /* must be last so device specific heaps always
38 are at the end of this enum */
39 ION_NUM_HEAPS,
40};
41
42#define ION_HEAP_SYSTEM_MASK (1 << ION_HEAP_TYPE_SYSTEM)
43#define ION_HEAP_SYSTEM_CONTIG_MASK (1 << ION_HEAP_TYPE_SYSTEM_CONTIG)
44#define ION_HEAP_CARVEOUT_MASK (1 << ION_HEAP_TYPE_CARVEOUT)
45
46#ifdef __KERNEL__
47struct ion_device;
48struct ion_heap;
49struct ion_mapper;
50struct ion_client;
51struct ion_buffer;
52
53/* This should be removed some day when phys_addr_t's are fully
54 plumbed in the kernel, and all instances of ion_phys_addr_t should
55 be converted to phys_addr_t. For the time being many kernel interfaces
56 do not accept phys_addr_t's that would have to */
57#define ion_phys_addr_t unsigned long
58
59/**
60 * struct ion_platform_heap - defines a heap in the given platform
61 * @type: type of the heap from ion_heap_type enum
62 * @id: unique identifier for heap. When allocating (lower numbers
63 * will be allocated from first)
64 * @name: used for debug purposes
65 * @base: base address of heap in physical memory if applicable
66 * @size: size of the heap in bytes if applicable
67 * @priv: heap specific data
68 *
69 * Provided by the board file.
70 */
71struct ion_platform_heap {
72 enum ion_heap_type type;
73 unsigned int id;
74 const char *name;
75 ion_phys_addr_t base;
76 size_t size;
77 void *priv;
78};
79
80/**
81 * struct ion_platform_data - array of platform heaps passed from board file
82 * @nr: number of structures in the array
83 * @heaps: array of platform_heap structions
84 *
85 * Provided by the board file in the form of platform data to a platform device.
86 */
87struct ion_platform_data {
88 int nr;
89 struct ion_platform_heap heaps[];
90};
91
92/**
93 * ion_client_create() - allocate a client and returns it
94 * @dev: the global ion device
95 * @heap_mask: mask of heaps this client can allocate from
96 * @name: used for debugging
97 */
98struct ion_client *ion_client_create(struct ion_device *dev,
99 unsigned int heap_mask, const char *name);
100
101/**
102 * ion_client_destroy() - free's a client and all it's handles
103 * @client: the client
104 *
105 * Free the provided client and all it's resources including
106 * any handles it is holding.
107 */
108void ion_client_destroy(struct ion_client *client);
109
110/**
111 * ion_alloc - allocate ion memory
112 * @client: the client
113 * @len: size of the allocation
114 * @align: requested allocation alignment, lots of hardware blocks have
115 * alignment requirements of some kind
116 * @flags: mask of heaps to allocate from, if multiple bits are set
117 * heaps will be tried in order from lowest to highest order bit
118 *
119 * Allocate memory in one of the heaps provided in heap mask and return
120 * an opaque handle to it.
121 */
122struct ion_handle *ion_alloc(struct ion_client *client, size_t len,
123 size_t align, unsigned int flags);
124
125/**
126 * ion_free - free a handle
127 * @client: the client
128 * @handle: the handle to free
129 *
130 * Free the provided handle.
131 */
132void ion_free(struct ion_client *client, struct ion_handle *handle);
133
134/**
135 * ion_phys - returns the physical address and len of a handle
136 * @client: the client
137 * @handle: the handle
138 * @addr: a pointer to put the address in
139 * @len: a pointer to put the length in
140 *
141 * This function queries the heap for a particular handle to get the
142 * handle's physical address. It't output is only correct if
143 * a heap returns physically contiguous memory -- in other cases
144 * this api should not be implemented -- ion_map_dma should be used
145 * instead. Returns -EINVAL if the handle is invalid. This has
146 * no implications on the reference counting of the handle --
147 * the returned value may not be valid if the caller is not
148 * holding a reference.
149 */
150int ion_phys(struct ion_client *client, struct ion_handle *handle,
151 ion_phys_addr_t *addr, size_t *len);
152
153/**
154 * ion_map_kernel - create mapping for the given handle
155 * @client: the client
156 * @handle: handle to map
157 *
158 * Map the given handle into the kernel and return a kernel address that
159 * can be used to access this address.
160 */
161void *ion_map_kernel(struct ion_client *client, struct ion_handle *handle);
162
163/**
164 * ion_unmap_kernel() - destroy a kernel mapping for a handle
165 * @client: the client
166 * @handle: handle to unmap
167 */
168void ion_unmap_kernel(struct ion_client *client, struct ion_handle *handle);
169
170/**
171 * ion_map_dma - create a dma mapping for a given handle
172 * @client: the client
173 * @handle: handle to map
174 *
175 * Return an sglist describing the given handle
176 */
177struct scatterlist *ion_map_dma(struct ion_client *client,
178 struct ion_handle *handle);
179
180/**
181 * ion_unmap_dma() - destroy a dma mapping for a handle
182 * @client: the client
183 * @handle: handle to unmap
184 */
185void ion_unmap_dma(struct ion_client *client, struct ion_handle *handle);
186
187/**
188 * ion_share() - given a handle, obtain a buffer to pass to other clients
189 * @client: the client
190 * @handle: the handle to share
191 *
192 * Given a handle, return a buffer, which exists in a global name
193 * space, and can be passed to other clients. Should be passed into ion_import
194 * to obtain a new handle for this buffer.
195 *
196 * NOTE: This function does do not an extra reference. The burden is on the
197 * caller to make sure the buffer doesn't go away while it's being passed to
198 * another client. That is, ion_free should not be called on this handle until
199 * the buffer has been imported into the other client.
200 */
201struct ion_buffer *ion_share(struct ion_client *client,
202 struct ion_handle *handle);
203
204/**
205 * ion_import() - given an buffer in another client, import it
206 * @client: this blocks client
207 * @buffer: the buffer to import (as obtained from ion_share)
208 *
209 * Given a buffer, add it to the client and return the handle to use to refer
210 * to it further. This is called to share a handle from one kernel client to
211 * another.
212 */
213struct ion_handle *ion_import(struct ion_client *client,
214 struct ion_buffer *buffer);
215
216/**
217 * ion_import_fd() - given an fd obtained via ION_IOC_SHARE ioctl, import it
218 * @client: this blocks client
219 * @fd: the fd
220 *
221 * A helper function for drivers that will be recieving ion buffers shared
222 * with them from userspace. These buffers are represented by a file
223 * descriptor obtained as the return from the ION_IOC_SHARE ioctl.
224 * This function coverts that fd into the underlying buffer, and returns
225 * the handle to use to refer to it further.
226 */
227struct ion_handle *ion_import_fd(struct ion_client *client, int fd);
228#endif /* __KERNEL__ */
229
230/**
231 * DOC: Ion Userspace API
232 *
233 * create a client by opening /dev/ion
234 * most operations handled via following ioctls
235 *
236 */
237
238/**
239 * struct ion_allocation_data - metadata passed from userspace for allocations
240 * @len: size of the allocation
241 * @align: required alignment of the allocation
242 * @flags: flags passed to heap
243 * @handle: pointer that will be populated with a cookie to use to refer
244 * to this allocation
245 *
246 * Provided by userspace as an argument to the ioctl
247 */
248struct ion_allocation_data {
249 size_t len;
250 size_t align;
251 unsigned int flags;
252 struct ion_handle *handle;
253};
254
255/**
256 * struct ion_fd_data - metadata passed to/from userspace for a handle/fd pair
257 * @handle: a handle
258 * @fd: a file descriptor representing that handle
259 *
260 * For ION_IOC_SHARE or ION_IOC_MAP userspace populates the handle field with
261 * the handle returned from ion alloc, and the kernel returns the file
262 * descriptor to share or map in the fd field. For ION_IOC_IMPORT, userspace
263 * provides the file descriptor and the kernel returns the handle.
264 */
265struct ion_fd_data {
266 struct ion_handle *handle;
267 int fd;
268};
269
270/**
271 * struct ion_handle_data - a handle passed to/from the kernel
272 * @handle: a handle
273 */
274struct ion_handle_data {
275 struct ion_handle *handle;
276};
277
278/**
279 * struct ion_custom_data - metadata passed to/from userspace for a custom ioctl
280 * @cmd: the custom ioctl function to call
281 * @arg: additional data to pass to the custom ioctl, typically a user
282 * pointer to a predefined structure
283 *
284 * This works just like the regular cmd and arg fields of an ioctl.
285 */
286struct ion_custom_data {
287 unsigned int cmd;
288 unsigned long arg;
289};
290
291#define ION_IOC_MAGIC 'I'
292
293/**
294 * DOC: ION_IOC_ALLOC - allocate memory
295 *
296 * Takes an ion_allocation_data struct and returns it with the handle field
297 * populated with the opaque handle for the allocation.
298 */
299#define ION_IOC_ALLOC _IOWR(ION_IOC_MAGIC, 0, \
300 struct ion_allocation_data)
301
302/**
303 * DOC: ION_IOC_FREE - free memory
304 *
305 * Takes an ion_handle_data struct and frees the handle.
306 */
307#define ION_IOC_FREE _IOWR(ION_IOC_MAGIC, 1, struct ion_handle_data)
308
309/**
310 * DOC: ION_IOC_MAP - get a file descriptor to mmap
311 *
312 * Takes an ion_fd_data struct with the handle field populated with a valid
313 * opaque handle. Returns the struct with the fd field set to a file
314 * descriptor open in the current address space. This file descriptor
315 * can then be used as an argument to mmap.
316 */
317#define ION_IOC_MAP _IOWR(ION_IOC_MAGIC, 2, struct ion_fd_data)
318
319/**
320 * DOC: ION_IOC_SHARE - creates a file descriptor to use to share an allocation
321 *
322 * Takes an ion_fd_data struct with the handle field populated with a valid
323 * opaque handle. Returns the struct with the fd field set to a file
324 * descriptor open in the current address space. This file descriptor
325 * can then be passed to another process. The corresponding opaque handle can
326 * be retrieved via ION_IOC_IMPORT.
327 */
328#define ION_IOC_SHARE _IOWR(ION_IOC_MAGIC, 4, struct ion_fd_data)
329
330/**
331 * DOC: ION_IOC_IMPORT - imports a shared file descriptor
332 *
333 * Takes an ion_fd_data struct with the fd field populated with a valid file
334 * descriptor obtained from ION_IOC_SHARE and returns the struct with the handle
335 * filed set to the corresponding opaque handle.
336 */
337#define ION_IOC_IMPORT _IOWR(ION_IOC_MAGIC, 5, int)
338
339/**
340 * DOC: ION_IOC_CUSTOM - call architecture specific ion ioctl
341 *
342 * Takes the argument of the architecture specific ioctl to call and
343 * passes appropriate userdata for that ioctl
344 */
345#define ION_IOC_CUSTOM _IOWR(ION_IOC_MAGIC, 6, struct ion_custom_data)
346
347#endif /* _LINUX_ION_H */
diff --git a/include/linux/ioport.h b/include/linux/ioport.h
index e9bb22cba76..9d57a71775b 100644
--- a/include/linux/ioport.h
+++ b/include/linux/ioport.h
@@ -109,6 +109,36 @@ struct resource_list {
109/* PCI control bits. Shares IORESOURCE_BITS with above PCI ROM. */ 109/* PCI control bits. Shares IORESOURCE_BITS with above PCI ROM. */
110#define IORESOURCE_PCI_FIXED (1<<4) /* Do not move resource */ 110#define IORESOURCE_PCI_FIXED (1<<4) /* Do not move resource */
111 111
112
113/* helpers to define resources */
114#define DEFINE_RES_NAMED(_start, _size, _name, _flags) \
115 { \
116 .start = (_start), \
117 .end = (_start) + (_size) - 1, \
118 .name = (_name), \
119 .flags = (_flags), \
120 }
121
122#define DEFINE_RES_IO_NAMED(_start, _size, _name) \
123 DEFINE_RES_NAMED((_start), (_size), (_name), IORESOURCE_IO)
124#define DEFINE_RES_IO(_start, _size) \
125 DEFINE_RES_IO_NAMED((_start), (_size), NULL)
126
127#define DEFINE_RES_MEM_NAMED(_start, _size, _name) \
128 DEFINE_RES_NAMED((_start), (_size), (_name), IORESOURCE_MEM)
129#define DEFINE_RES_MEM(_start, _size) \
130 DEFINE_RES_MEM_NAMED((_start), (_size), NULL)
131
132#define DEFINE_RES_IRQ_NAMED(_irq, _name) \
133 DEFINE_RES_NAMED((_irq), 1, (_name), IORESOURCE_IRQ)
134#define DEFINE_RES_IRQ(_irq) \
135 DEFINE_RES_IRQ_NAMED((_irq), NULL)
136
137#define DEFINE_RES_DMA_NAMED(_dma, _name) \
138 DEFINE_RES_NAMED((_dma), 1, (_name), IORESOURCE_DMA)
139#define DEFINE_RES_DMA(_dma) \
140 DEFINE_RES_DMA_NAMED((_dma), NULL)
141
112/* PC/ISA/whatever - the normal PC address spaces: IO and memory */ 142/* PC/ISA/whatever - the normal PC address spaces: IO and memory */
113extern struct resource ioport_resource; 143extern struct resource ioport_resource;
114extern struct resource iomem_resource; 144extern struct resource iomem_resource;
@@ -132,6 +162,7 @@ extern int allocate_resource(struct resource *root, struct resource *new,
132 resource_size_t, 162 resource_size_t,
133 resource_size_t), 163 resource_size_t),
134 void *alignf_data); 164 void *alignf_data);
165struct resource *lookup_resource(struct resource *root, resource_size_t start);
135int adjust_resource(struct resource *res, resource_size_t start, 166int adjust_resource(struct resource *res, resource_size_t start,
136 resource_size_t size); 167 resource_size_t size);
137resource_size_t resource_alignment(struct resource *res); 168resource_size_t resource_alignment(struct resource *res);
diff --git a/include/linux/ipc_namespace.h b/include/linux/ipc_namespace.h
index a6d1655f960..8a297a5e794 100644
--- a/include/linux/ipc_namespace.h
+++ b/include/linux/ipc_namespace.h
@@ -44,6 +44,11 @@ struct ipc_namespace {
44 size_t shm_ctlall; 44 size_t shm_ctlall;
45 int shm_ctlmni; 45 int shm_ctlmni;
46 int shm_tot; 46 int shm_tot;
47 /*
48 * Defines whether IPC_RMID is forced for _all_ shm segments regardless
49 * of shmctl()
50 */
51 int shm_rmid_forced;
47 52
48 struct notifier_block ipcns_nb; 53 struct notifier_block ipcns_nb;
49 54
@@ -72,6 +77,7 @@ extern int register_ipcns_notifier(struct ipc_namespace *);
72extern int cond_register_ipcns_notifier(struct ipc_namespace *); 77extern int cond_register_ipcns_notifier(struct ipc_namespace *);
73extern void unregister_ipcns_notifier(struct ipc_namespace *); 78extern void unregister_ipcns_notifier(struct ipc_namespace *);
74extern int ipcns_notify(unsigned long); 79extern int ipcns_notify(unsigned long);
80extern void shm_destroy_orphaned(struct ipc_namespace *ns);
75#else /* CONFIG_SYSVIPC */ 81#else /* CONFIG_SYSVIPC */
76static inline int register_ipcns_notifier(struct ipc_namespace *ns) 82static inline int register_ipcns_notifier(struct ipc_namespace *ns)
77{ return 0; } 83{ return 0; }
@@ -79,6 +85,7 @@ static inline int cond_register_ipcns_notifier(struct ipc_namespace *ns)
79{ return 0; } 85{ return 0; }
80static inline void unregister_ipcns_notifier(struct ipc_namespace *ns) { } 86static inline void unregister_ipcns_notifier(struct ipc_namespace *ns) { }
81static inline int ipcns_notify(unsigned long l) { return 0; } 87static inline int ipcns_notify(unsigned long l) { return 0; }
88static inline void shm_destroy_orphaned(struct ipc_namespace *ns) {}
82#endif /* CONFIG_SYSVIPC */ 89#endif /* CONFIG_SYSVIPC */
83 90
84#ifdef CONFIG_POSIX_MQUEUE 91#ifdef CONFIG_POSIX_MQUEUE
diff --git a/include/linux/irq.h b/include/linux/irq.h
index baa397eb9c3..59517300a31 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -23,6 +23,7 @@
23#include <linux/errno.h> 23#include <linux/errno.h>
24#include <linux/topology.h> 24#include <linux/topology.h>
25#include <linux/wait.h> 25#include <linux/wait.h>
26#include <linux/module.h>
26 27
27#include <asm/irq.h> 28#include <asm/irq.h>
28#include <asm/ptrace.h> 29#include <asm/ptrace.h>
@@ -96,11 +97,6 @@ enum {
96 97
97#define IRQ_NO_BALANCING_MASK (IRQ_PER_CPU | IRQ_NO_BALANCING) 98#define IRQ_NO_BALANCING_MASK (IRQ_PER_CPU | IRQ_NO_BALANCING)
98 99
99static inline __deprecated bool CHECK_IRQ_PER_CPU(unsigned int status)
100{
101 return status & IRQ_PER_CPU;
102}
103
104/* 100/*
105 * Return value for chip->irq_set_affinity() 101 * Return value for chip->irq_set_affinity()
106 * 102 *
@@ -113,14 +109,18 @@ enum {
113}; 109};
114 110
115struct msi_desc; 111struct msi_desc;
112struct irq_domain;
116 113
117/** 114/**
118 * struct irq_data - per irq and irq chip data passed down to chip functions 115 * struct irq_data - per irq and irq chip data passed down to chip functions
119 * @irq: interrupt number 116 * @irq: interrupt number
117 * @hwirq: hardware interrupt number, local to the interrupt domain
120 * @node: node index useful for balancing 118 * @node: node index useful for balancing
121 * @state_use_accessors: status information for irq chip functions. 119 * @state_use_accessors: status information for irq chip functions.
122 * Use accessor functions to deal with it 120 * Use accessor functions to deal with it
123 * @chip: low level interrupt hardware access 121 * @chip: low level interrupt hardware access
122 * @domain: Interrupt translation domain; responsible for mapping
123 * between hwirq number and linux irq number.
124 * @handler_data: per-IRQ data for the irq_chip methods 124 * @handler_data: per-IRQ data for the irq_chip methods
125 * @chip_data: platform-specific per-chip private data for the chip 125 * @chip_data: platform-specific per-chip private data for the chip
126 * methods, to allow shared chip implementations 126 * methods, to allow shared chip implementations
@@ -133,9 +133,11 @@ struct msi_desc;
133 */ 133 */
134struct irq_data { 134struct irq_data {
135 unsigned int irq; 135 unsigned int irq;
136 unsigned long hwirq;
136 unsigned int node; 137 unsigned int node;
137 unsigned int state_use_accessors; 138 unsigned int state_use_accessors;
138 struct irq_chip *chip; 139 struct irq_chip *chip;
140 struct irq_domain *domain;
139 void *handler_data; 141 void *handler_data;
140 void *chip_data; 142 void *chip_data;
141 struct msi_desc *msi_desc; 143 struct msi_desc *msi_desc;
@@ -546,7 +548,15 @@ static inline struct msi_desc *irq_data_get_msi(struct irq_data *d)
546 return d->msi_desc; 548 return d->msi_desc;
547} 549}
548 550
549int irq_alloc_descs(int irq, unsigned int from, unsigned int cnt, int node); 551int __irq_alloc_descs(int irq, unsigned int from, unsigned int cnt, int node,
552 struct module *owner);
553
554static inline int irq_alloc_descs(int irq, unsigned int from, unsigned int cnt,
555 int node)
556{
557 return __irq_alloc_descs(irq, from, cnt, node, THIS_MODULE);
558}
559
550void irq_free_descs(unsigned int irq, unsigned int cnt); 560void irq_free_descs(unsigned int irq, unsigned int cnt);
551int irq_reserve_irqs(unsigned int from, unsigned int cnt); 561int irq_reserve_irqs(unsigned int from, unsigned int cnt);
552 562
diff --git a/include/linux/irqdesc.h b/include/linux/irqdesc.h
index 2d921b35212..150134ac709 100644
--- a/include/linux/irqdesc.h
+++ b/include/linux/irqdesc.h
@@ -66,6 +66,7 @@ struct irq_desc {
66#ifdef CONFIG_PROC_FS 66#ifdef CONFIG_PROC_FS
67 struct proc_dir_entry *dir; 67 struct proc_dir_entry *dir;
68#endif 68#endif
69 struct module *owner;
69 const char *name; 70 const char *name;
70} ____cacheline_internodealigned_in_smp; 71} ____cacheline_internodealigned_in_smp;
71 72
diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h
new file mode 100644
index 00000000000..3ad553e8eae
--- /dev/null
+++ b/include/linux/irqdomain.h
@@ -0,0 +1,92 @@
1/*
2 * irq_domain - IRQ translation domains
3 *
4 * Translation infrastructure between hw and linux irq numbers. This is
5 * helpful for interrupt controllers to implement mapping between hardware
6 * irq numbers and the Linux irq number space.
7 *
8 * irq_domains also have a hook for translating device tree interrupt
9 * representation into a hardware irq number that can be mapped back to a
10 * Linux irq number without any extra platform support code.
11 *
12 * irq_domain is expected to be embedded in an interrupt controller's private
13 * data structure.
14 */
15#ifndef _LINUX_IRQDOMAIN_H
16#define _LINUX_IRQDOMAIN_H
17
18#include <linux/irq.h>
19#include <linux/mod_devicetable.h>
20
21#ifdef CONFIG_IRQ_DOMAIN
22struct device_node;
23struct irq_domain;
24
25/**
26 * struct irq_domain_ops - Methods for irq_domain objects
27 * @to_irq: (optional) given a local hardware irq number, return the linux
28 * irq number. If to_irq is not implemented, then the irq_domain
29 * will use this translation: irq = (domain->irq_base + hwirq)
30 * @dt_translate: Given a device tree node and interrupt specifier, decode
31 * the hardware irq number and linux irq type value.
32 */
33struct irq_domain_ops {
34 unsigned int (*to_irq)(struct irq_domain *d, unsigned long hwirq);
35
36#ifdef CONFIG_OF
37 int (*dt_translate)(struct irq_domain *d, struct device_node *node,
38 const u32 *intspec, unsigned int intsize,
39 unsigned long *out_hwirq, unsigned int *out_type);
40#endif /* CONFIG_OF */
41};
42
43/**
44 * struct irq_domain - Hardware interrupt number translation object
45 * @list: Element in global irq_domain list.
46 * @irq_base: Start of irq_desc range assigned to the irq_domain. The creator
47 * of the irq_domain is responsible for allocating the array of
48 * irq_desc structures.
49 * @nr_irq: Number of irqs managed by the irq domain
50 * @ops: pointer to irq_domain methods
51 * @priv: private data pointer for use by owner. Not touched by irq_domain
52 * core code.
53 * @of_node: (optional) Pointer to device tree nodes associated with the
54 * irq_domain. Used when decoding device tree interrupt specifiers.
55 */
56struct irq_domain {
57 struct list_head list;
58 unsigned int irq_base;
59 unsigned int nr_irq;
60 const struct irq_domain_ops *ops;
61 void *priv;
62 struct device_node *of_node;
63};
64
65/**
66 * irq_domain_to_irq() - Translate from a hardware irq to a linux irq number
67 *
68 * Returns the linux irq number associated with a hardware irq. By default,
69 * the mapping is irq == domain->irq_base + hwirq, but this mapping can
70 * be overridden if the irq_domain implements a .to_irq() hook.
71 */
72static inline unsigned int irq_domain_to_irq(struct irq_domain *d,
73 unsigned long hwirq)
74{
75 return d->ops->to_irq ? d->ops->to_irq(d, hwirq) : d->irq_base + hwirq;
76}
77
78extern void irq_domain_add(struct irq_domain *domain);
79extern void irq_domain_del(struct irq_domain *domain);
80#endif /* CONFIG_IRQ_DOMAIN */
81
82#if defined(CONFIG_IRQ_DOMAIN) && defined(CONFIG_OF_IRQ)
83extern struct irq_domain_ops irq_domain_simple_ops;
84extern void irq_domain_add_simple(struct device_node *controller, int irq_base);
85extern void irq_domain_generate_simple(const struct of_device_id *match,
86 u64 phys_base, unsigned int irq_start);
87#else /* CONFIG_IRQ_DOMAIN && CONFIG_OF_IRQ */
88static inline void irq_domain_generate_simple(const struct of_device_id *match,
89 u64 phys_base, unsigned int irq_start) { }
90#endif /* CONFIG_IRQ_DOMAIN && CONFIG_OF_IRQ */
91
92#endif /* _LINUX_IRQDOMAIN_H */
diff --git a/include/linux/iscsi_boot_sysfs.h b/include/linux/iscsi_boot_sysfs.h
index f1e6c184f14..f0a2f8b0aa1 100644
--- a/include/linux/iscsi_boot_sysfs.h
+++ b/include/linux/iscsi_boot_sysfs.h
@@ -92,6 +92,13 @@ struct iscsi_boot_kobj {
92 * properties. 92 * properties.
93 */ 93 */
94 mode_t (*is_visible) (void *data, int type); 94 mode_t (*is_visible) (void *data, int type);
95
96 /*
97 * Driver specific release function.
98 *
99 * The function should free the data passed in.
100 */
101 void (*release) (void *data);
95}; 102};
96 103
97struct iscsi_boot_kset { 104struct iscsi_boot_kset {
@@ -103,18 +110,21 @@ struct iscsi_boot_kobj *
103iscsi_boot_create_initiator(struct iscsi_boot_kset *boot_kset, int index, 110iscsi_boot_create_initiator(struct iscsi_boot_kset *boot_kset, int index,
104 void *data, 111 void *data,
105 ssize_t (*show) (void *data, int type, char *buf), 112 ssize_t (*show) (void *data, int type, char *buf),
106 mode_t (*is_visible) (void *data, int type)); 113 mode_t (*is_visible) (void *data, int type),
114 void (*release) (void *data));
107 115
108struct iscsi_boot_kobj * 116struct iscsi_boot_kobj *
109iscsi_boot_create_ethernet(struct iscsi_boot_kset *boot_kset, int index, 117iscsi_boot_create_ethernet(struct iscsi_boot_kset *boot_kset, int index,
110 void *data, 118 void *data,
111 ssize_t (*show) (void *data, int type, char *buf), 119 ssize_t (*show) (void *data, int type, char *buf),
112 mode_t (*is_visible) (void *data, int type)); 120 mode_t (*is_visible) (void *data, int type),
121 void (*release) (void *data));
113struct iscsi_boot_kobj * 122struct iscsi_boot_kobj *
114iscsi_boot_create_target(struct iscsi_boot_kset *boot_kset, int index, 123iscsi_boot_create_target(struct iscsi_boot_kset *boot_kset, int index,
115 void *data, 124 void *data,
116 ssize_t (*show) (void *data, int type, char *buf), 125 ssize_t (*show) (void *data, int type, char *buf),
117 mode_t (*is_visible) (void *data, int type)); 126 mode_t (*is_visible) (void *data, int type),
127 void (*release) (void *data));
118 128
119struct iscsi_boot_kset *iscsi_boot_create_kset(const char *set_name); 129struct iscsi_boot_kset *iscsi_boot_create_kset(const char *set_name);
120struct iscsi_boot_kset *iscsi_boot_create_host_kset(unsigned int hostno); 130struct iscsi_boot_kset *iscsi_boot_create_host_kset(unsigned int hostno);
diff --git a/include/linux/jbd.h b/include/linux/jbd.h
index e06965081ba..e6a5e34bed4 100644
--- a/include/linux/jbd.h
+++ b/include/linux/jbd.h
@@ -940,7 +940,6 @@ extern int journal_force_commit(journal_t *);
940 */ 940 */
941struct journal_head *journal_add_journal_head(struct buffer_head *bh); 941struct journal_head *journal_add_journal_head(struct buffer_head *bh);
942struct journal_head *journal_grab_journal_head(struct buffer_head *bh); 942struct journal_head *journal_grab_journal_head(struct buffer_head *bh);
943void journal_remove_journal_head(struct buffer_head *bh);
944void journal_put_journal_head(struct journal_head *jh); 943void journal_put_journal_head(struct journal_head *jh);
945 944
946/* 945/*
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index d087c2e7b2a..38f307b8c33 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -1329,12 +1329,6 @@ extern int jbd_blocks_per_page(struct inode *inode);
1329#define BUFFER_TRACE2(bh, bh2, info) do {} while (0) 1329#define BUFFER_TRACE2(bh, bh2, info) do {} while (0)
1330#define JBUFFER_TRACE(jh, info) do {} while (0) 1330#define JBUFFER_TRACE(jh, info) do {} while (0)
1331 1331
1332/*
1333 * jbd2_dev_to_name is a utility function used by the jbd2 and ext4
1334 * tracing infrastructure to map a dev_t to a device name.
1335 */
1336extern const char *jbd2_dev_to_name(dev_t device);
1337
1338#endif /* __KERNEL__ */ 1332#endif /* __KERNEL__ */
1339 1333
1340#endif /* _LINUX_JBD2_H */ 1334#endif /* _LINUX_JBD2_H */
diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h
index f97672a36fa..265e2c3cbd1 100644
--- a/include/linux/jiffies.h
+++ b/include/linux/jiffies.h
@@ -303,7 +303,7 @@ extern void jiffies_to_timespec(const unsigned long jiffies,
303extern unsigned long timeval_to_jiffies(const struct timeval *value); 303extern unsigned long timeval_to_jiffies(const struct timeval *value);
304extern void jiffies_to_timeval(const unsigned long jiffies, 304extern void jiffies_to_timeval(const unsigned long jiffies,
305 struct timeval *value); 305 struct timeval *value);
306extern clock_t jiffies_to_clock_t(long x); 306extern clock_t jiffies_to_clock_t(unsigned long x);
307extern unsigned long clock_t_to_jiffies(unsigned long x); 307extern unsigned long clock_t_to_jiffies(unsigned long x);
308extern u64 jiffies_64_to_clock_t(u64 x); 308extern u64 jiffies_64_to_clock_t(u64 x);
309extern u64 nsec_to_clock_t(u64 x); 309extern u64 nsec_to_clock_t(u64 x);
diff --git a/include/linux/journal-head.h b/include/linux/journal-head.h
index 44e95d0a721..423cb6d78ee 100644
--- a/include/linux/journal-head.h
+++ b/include/linux/journal-head.h
@@ -45,7 +45,7 @@ struct journal_head {
45 * has been cowed 45 * has been cowed
46 * [jbd_lock_bh_state()] 46 * [jbd_lock_bh_state()]
47 */ 47 */
48 unsigned b_cow_tid; 48 tid_t b_cow_tid;
49 49
50 /* 50 /*
51 * Copy of the buffer data frozen for writing to the log. 51 * Copy of the buffer data frozen for writing to the log.
diff --git a/include/linux/jump_label.h b/include/linux/jump_label.h
index 83e745f3ead..66f23dc5e76 100644
--- a/include/linux/jump_label.h
+++ b/include/linux/jump_label.h
@@ -54,7 +54,7 @@ extern void jump_label_apply_nops(struct module *mod);
54 54
55#else 55#else
56 56
57#include <asm/atomic.h> 57#include <linux/atomic.h>
58 58
59#define JUMP_LABEL_INIT {ATOMIC_INIT(0)} 59#define JUMP_LABEL_INIT {ATOMIC_INIT(0)}
60 60
diff --git a/include/linux/kconfig.h b/include/linux/kconfig.h
new file mode 100644
index 00000000000..067eda0e4b3
--- /dev/null
+++ b/include/linux/kconfig.h
@@ -0,0 +1,32 @@
1#ifndef __LINUX_KCONFIG_H
2#define __LINUX_KCONFIG_H
3
4#include <generated/autoconf.h>
5
6/*
7 * Helper macros to use CONFIG_ options in C expressions. Note that
8 * these only work with boolean and tristate options.
9 */
10
11/*
12 * IS_ENABLED(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'y' or 'm',
13 * 0 otherwise.
14 *
15 */
16#define IS_ENABLED(option) \
17 (__enabled_ ## option || __enabled_ ## option ## _MODULE)
18
19/*
20 * IS_BUILTIN(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'y', 0
21 * otherwise. For boolean options, this is equivalent to
22 * IS_ENABLED(CONFIG_FOO).
23 */
24#define IS_BUILTIN(option) __enabled_ ## option
25
26/*
27 * IS_MODULE(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'm', 0
28 * otherwise.
29 */
30#define IS_MODULE(option) __enabled_ ## option ## _MODULE
31
32#endif /* __LINUX_KCONFIG_H */
diff --git a/include/linux/kdb.h b/include/linux/kdb.h
index aadff7cc2b8..529d9a0c75a 100644
--- a/include/linux/kdb.h
+++ b/include/linux/kdb.h
@@ -16,7 +16,7 @@
16#ifdef CONFIG_KGDB_KDB 16#ifdef CONFIG_KGDB_KDB
17#include <linux/init.h> 17#include <linux/init.h>
18#include <linux/sched.h> 18#include <linux/sched.h>
19#include <asm/atomic.h> 19#include <linux/atomic.h>
20 20
21#define KDB_POLL_FUNC_MAX 5 21#define KDB_POLL_FUNC_MAX 5
22extern int kdb_poll_idx; 22extern int kdb_poll_idx;
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 953352a8833..54bf5a471e1 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -56,6 +56,14 @@
56 56
57#define FIELD_SIZEOF(t, f) (sizeof(((t*)0)->f)) 57#define FIELD_SIZEOF(t, f) (sizeof(((t*)0)->f))
58#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d)) 58#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
59#define DIV_ROUND_UP_ULL(ll,d) \
60 ({ unsigned long long _tmp = (ll)+(d)-1; do_div(_tmp, d); _tmp; })
61
62#if BITS_PER_LONG == 32
63# define DIV_ROUND_UP_SECTOR_T(ll,d) DIV_ROUND_UP_ULL(ll, d)
64#else
65# define DIV_ROUND_UP_SECTOR_T(ll,d) DIV_ROUND_UP(ll,d)
66#endif
59 67
60/* The `const' in roundup() prevents gcc-3.3 from calling __divdi3 */ 68/* The `const' in roundup() prevents gcc-3.3 from calling __divdi3 */
61#define roundup(x, y) ( \ 69#define roundup(x, y) ( \
@@ -121,7 +129,7 @@ extern int _cond_resched(void);
121# define might_resched() do { } while (0) 129# define might_resched() do { } while (0)
122#endif 130#endif
123 131
124#ifdef CONFIG_DEBUG_SPINLOCK_SLEEP 132#ifdef CONFIG_DEBUG_ATOMIC_SLEEP
125 void __might_sleep(const char *file, int line, int preempt_offset); 133 void __might_sleep(const char *file, int line, int preempt_offset);
126/** 134/**
127 * might_sleep - annotation for functions that can sleep 135 * might_sleep - annotation for functions that can sleep
@@ -646,29 +654,6 @@ static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { }
646 const typeof( ((type *)0)->member ) *__mptr = (ptr); \ 654 const typeof( ((type *)0)->member ) *__mptr = (ptr); \
647 (type *)( (char *)__mptr - offsetof(type,member) );}) 655 (type *)( (char *)__mptr - offsetof(type,member) );})
648 656
649struct sysinfo;
650extern int do_sysinfo(struct sysinfo *info);
651
652#endif /* __KERNEL__ */
653
654#define SI_LOAD_SHIFT 16
655struct sysinfo {
656 long uptime; /* Seconds since boot */
657 unsigned long loads[3]; /* 1, 5, and 15 minute load averages */
658 unsigned long totalram; /* Total usable main memory size */
659 unsigned long freeram; /* Available memory size */
660 unsigned long sharedram; /* Amount of shared memory */
661 unsigned long bufferram; /* Memory used by buffers */
662 unsigned long totalswap; /* Total swap space size */
663 unsigned long freeswap; /* swap space still available */
664 unsigned short procs; /* Number of current processes */
665 unsigned short pad; /* explicit padding for m68k */
666 unsigned long totalhigh; /* Total high memory size */
667 unsigned long freehigh; /* Available high memory size */
668 unsigned int mem_unit; /* Memory unit size in bytes */
669 char _f[20-2*sizeof(long)-sizeof(int)]; /* Padding: libc5 uses this.. */
670};
671
672#ifdef __CHECKER__ 657#ifdef __CHECKER__
673#define BUILD_BUG_ON_NOT_POWER_OF_2(n) 658#define BUILD_BUG_ON_NOT_POWER_OF_2(n)
674#define BUILD_BUG_ON_ZERO(e) (0) 659#define BUILD_BUG_ON_ZERO(e) (0)
@@ -736,4 +721,30 @@ extern int __build_bug_on_failed;
736# define REBUILD_DUE_TO_FTRACE_MCOUNT_RECORD 721# define REBUILD_DUE_TO_FTRACE_MCOUNT_RECORD
737#endif 722#endif
738 723
724struct sysinfo;
725extern int do_sysinfo(struct sysinfo *info);
726
727#endif /* __KERNEL__ */
728
729#define SI_LOAD_SHIFT 16
730struct sysinfo {
731 long uptime; /* Seconds since boot */
732 unsigned long loads[3]; /* 1, 5, and 15 minute load averages */
733 unsigned long totalram; /* Total usable main memory size */
734 unsigned long freeram; /* Available memory size */
735 unsigned long sharedram; /* Amount of shared memory */
736 unsigned long bufferram; /* Memory used by buffers */
737 unsigned long totalswap; /* Total swap space size */
738 unsigned long freeswap; /* swap space still available */
739 unsigned short procs; /* Number of current processes */
740 unsigned short pad; /* explicit padding for m68k */
741 unsigned long totalhigh; /* Total high memory size */
742 unsigned long freehigh; /* Available high memory size */
743 unsigned int mem_unit; /* Memory unit size in bytes */
744 char _f[20-2*sizeof(long)-sizeof(int)]; /* Padding: libc5 uses this.. */
745};
746
747/* To identify board information in panic logs, set this */
748extern char *mach_panic_string;
749
739#endif 750#endif
diff --git a/include/linux/key.h b/include/linux/key.h
index 6ea4eebd346..183a6af7715 100644
--- a/include/linux/key.h
+++ b/include/linux/key.h
@@ -21,7 +21,7 @@
21#include <linux/rcupdate.h> 21#include <linux/rcupdate.h>
22#include <linux/sysctl.h> 22#include <linux/sysctl.h>
23#include <linux/rwsem.h> 23#include <linux/rwsem.h>
24#include <asm/atomic.h> 24#include <linux/atomic.h>
25 25
26#ifdef __KERNEL__ 26#ifdef __KERNEL__
27 27
diff --git a/include/linux/keychord.h b/include/linux/keychord.h
new file mode 100644
index 00000000000..856a5850217
--- /dev/null
+++ b/include/linux/keychord.h
@@ -0,0 +1,52 @@
1/*
2 * Key chord input driver
3 *
4 * Copyright (C) 2008 Google, Inc.
5 * Author: Mike Lockwood <lockwood@android.com>
6 *
7 * This software is licensed under the terms of the GNU General Public
8 * License version 2, as published by the Free Software Foundation, and
9 * may be copied, distributed, and modified under those terms.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16*/
17
18#ifndef __LINUX_KEYCHORD_H_
19#define __LINUX_KEYCHORD_H_
20
21#include <linux/input.h>
22
23#define KEYCHORD_VERSION 1
24
25/*
26 * One or more input_keychord structs are written to /dev/keychord
27 * at once to specify the list of keychords to monitor.
28 * Reading /dev/keychord returns the id of a keychord when the
29 * keychord combination is pressed. A keychord is signalled when
30 * all of the keys in the keycode list are in the pressed state.
31 * The order in which the keys are pressed does not matter.
32 * The keychord will not be signalled if keys not in the keycode
33 * list are pressed.
34 * Keychords will not be signalled on key release events.
35 */
36struct input_keychord {
37 /* should be KEYCHORD_VERSION */
38 __u16 version;
39 /*
40 * client specified ID, returned from read()
41 * when this keychord is pressed.
42 */
43 __u16 id;
44
45 /* number of keycodes in this keychord */
46 __u16 count;
47
48 /* variable length array of keycodes */
49 __u16 keycodes[];
50};
51
52#endif /* __LINUX_KEYCHORD_H_ */
diff --git a/include/linux/keyreset.h b/include/linux/keyreset.h
new file mode 100644
index 00000000000..a2ac49e5b68
--- /dev/null
+++ b/include/linux/keyreset.h
@@ -0,0 +1,28 @@
1/*
2 * include/linux/keyreset.h - platform data structure for resetkeys driver
3 *
4 * Copyright (C) 2008 Google, Inc.
5 *
6 * This software is licensed under the terms of the GNU General Public
7 * License version 2, as published by the Free Software Foundation, and
8 * may be copied, distributed, and modified under those terms.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 */
16
17#ifndef _LINUX_KEYRESET_H
18#define _LINUX_KEYRESET_H
19
20#define KEYRESET_NAME "keyreset"
21
22struct keyreset_platform_data {
23 int (*reset_fn)(void);
24 int *keys_up;
25 int keys_down[]; /* 0 terminated */
26};
27
28#endif /* _LINUX_KEYRESET_H */
diff --git a/include/linux/kgdb.h b/include/linux/kgdb.h
index 10ca03d0a25..fa391835508 100644
--- a/include/linux/kgdb.h
+++ b/include/linux/kgdb.h
@@ -16,7 +16,7 @@
16#include <linux/serial_8250.h> 16#include <linux/serial_8250.h>
17#include <linux/linkage.h> 17#include <linux/linkage.h>
18#include <linux/init.h> 18#include <linux/init.h>
19#include <asm/atomic.h> 19#include <linux/atomic.h>
20#ifdef CONFIG_HAVE_ARCH_KGDB 20#ifdef CONFIG_HAVE_ARCH_KGDB
21#include <asm/kgdb.h> 21#include <asm/kgdb.h>
22#endif 22#endif
diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index 9229b64ee3a..668729cc0fe 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -25,7 +25,7 @@
25#include <linux/kobject_ns.h> 25#include <linux/kobject_ns.h>
26#include <linux/kernel.h> 26#include <linux/kernel.h>
27#include <linux/wait.h> 27#include <linux/wait.h>
28#include <asm/atomic.h> 28#include <linux/atomic.h>
29 29
30#define UEVENT_HELPER_PATH_LEN 256 30#define UEVENT_HELPER_PATH_LEN 256
31#define UEVENT_NUM_ENVP 32 /* number of env pointers */ 31#define UEVENT_NUM_ENVP 32 /* number of env pointers */
diff --git a/include/linux/kvm.h b/include/linux/kvm.h
index 55ef181521f..aace6b8691a 100644
--- a/include/linux/kvm.h
+++ b/include/linux/kvm.h
@@ -161,6 +161,7 @@ struct kvm_pit_config {
161#define KVM_EXIT_NMI 16 161#define KVM_EXIT_NMI 16
162#define KVM_EXIT_INTERNAL_ERROR 17 162#define KVM_EXIT_INTERNAL_ERROR 17
163#define KVM_EXIT_OSI 18 163#define KVM_EXIT_OSI 18
164#define KVM_EXIT_PAPR_HCALL 19
164 165
165/* For KVM_EXIT_INTERNAL_ERROR */ 166/* For KVM_EXIT_INTERNAL_ERROR */
166#define KVM_INTERNAL_ERROR_EMULATION 1 167#define KVM_INTERNAL_ERROR_EMULATION 1
@@ -264,6 +265,11 @@ struct kvm_run {
264 struct { 265 struct {
265 __u64 gprs[32]; 266 __u64 gprs[32];
266 } osi; 267 } osi;
268 struct {
269 __u64 nr;
270 __u64 ret;
271 __u64 args[9];
272 } papr_hcall;
267 /* Fix the size of the union. */ 273 /* Fix the size of the union. */
268 char padding[256]; 274 char padding[256];
269 }; 275 };
@@ -544,6 +550,10 @@ struct kvm_ppc_pvinfo {
544#define KVM_CAP_TSC_CONTROL 60 550#define KVM_CAP_TSC_CONTROL 60
545#define KVM_CAP_GET_TSC_KHZ 61 551#define KVM_CAP_GET_TSC_KHZ 61
546#define KVM_CAP_PPC_BOOKE_SREGS 62 552#define KVM_CAP_PPC_BOOKE_SREGS 62
553#define KVM_CAP_SPAPR_TCE 63
554#define KVM_CAP_PPC_SMT 64
555#define KVM_CAP_PPC_RMA 65
556#define KVM_CAP_S390_GMAP 71
547 557
548#ifdef KVM_CAP_IRQ_ROUTING 558#ifdef KVM_CAP_IRQ_ROUTING
549 559
@@ -746,6 +756,9 @@ struct kvm_clock_data {
746/* Available with KVM_CAP_XCRS */ 756/* Available with KVM_CAP_XCRS */
747#define KVM_GET_XCRS _IOR(KVMIO, 0xa6, struct kvm_xcrs) 757#define KVM_GET_XCRS _IOR(KVMIO, 0xa6, struct kvm_xcrs)
748#define KVM_SET_XCRS _IOW(KVMIO, 0xa7, struct kvm_xcrs) 758#define KVM_SET_XCRS _IOW(KVMIO, 0xa7, struct kvm_xcrs)
759#define KVM_CREATE_SPAPR_TCE _IOW(KVMIO, 0xa8, struct kvm_create_spapr_tce)
760/* Available with KVM_CAP_RMA */
761#define KVM_ALLOCATE_RMA _IOR(KVMIO, 0xa9, struct kvm_allocate_rma)
749 762
750#define KVM_DEV_ASSIGN_ENABLE_IOMMU (1 << 0) 763#define KVM_DEV_ASSIGN_ENABLE_IOMMU (1 << 0)
751 764
@@ -773,20 +786,14 @@ struct kvm_assigned_pci_dev {
773 786
774struct kvm_assigned_irq { 787struct kvm_assigned_irq {
775 __u32 assigned_dev_id; 788 __u32 assigned_dev_id;
776 __u32 host_irq; 789 __u32 host_irq; /* ignored (legacy field) */
777 __u32 guest_irq; 790 __u32 guest_irq;
778 __u32 flags; 791 __u32 flags;
779 union { 792 union {
780 struct {
781 __u32 addr_lo;
782 __u32 addr_hi;
783 __u32 data;
784 } guest_msi;
785 __u32 reserved[12]; 793 __u32 reserved[12];
786 }; 794 };
787}; 795};
788 796
789
790struct kvm_assigned_msix_nr { 797struct kvm_assigned_msix_nr {
791 __u32 assigned_dev_id; 798 __u32 assigned_dev_id;
792 __u16 entry_nr; 799 __u16 entry_nr;
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index 31ebb59cbd2..eabb21a30c3 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -47,6 +47,7 @@
47#define KVM_REQ_DEACTIVATE_FPU 10 47#define KVM_REQ_DEACTIVATE_FPU 10
48#define KVM_REQ_EVENT 11 48#define KVM_REQ_EVENT 11
49#define KVM_REQ_APF_HALT 12 49#define KVM_REQ_APF_HALT 12
50#define KVM_REQ_STEAL_UPDATE 13
50 51
51#define KVM_USERSPACE_IRQ_SOURCE_ID 0 52#define KVM_USERSPACE_IRQ_SOURCE_ID 0
52 53
@@ -326,12 +327,17 @@ static inline struct kvm_memslots *kvm_memslots(struct kvm *kvm)
326static inline int is_error_hpa(hpa_t hpa) { return hpa >> HPA_MSB; } 327static inline int is_error_hpa(hpa_t hpa) { return hpa >> HPA_MSB; }
327 328
328extern struct page *bad_page; 329extern struct page *bad_page;
330extern struct page *fault_page;
331
329extern pfn_t bad_pfn; 332extern pfn_t bad_pfn;
333extern pfn_t fault_pfn;
330 334
331int is_error_page(struct page *page); 335int is_error_page(struct page *page);
332int is_error_pfn(pfn_t pfn); 336int is_error_pfn(pfn_t pfn);
333int is_hwpoison_pfn(pfn_t pfn); 337int is_hwpoison_pfn(pfn_t pfn);
334int is_fault_pfn(pfn_t pfn); 338int is_fault_pfn(pfn_t pfn);
339int is_noslot_pfn(pfn_t pfn);
340int is_invalid_pfn(pfn_t pfn);
335int kvm_is_error_hva(unsigned long addr); 341int kvm_is_error_hva(unsigned long addr);
336int kvm_set_memory_region(struct kvm *kvm, 342int kvm_set_memory_region(struct kvm *kvm,
337 struct kvm_userspace_memory_region *mem, 343 struct kvm_userspace_memory_region *mem,
@@ -381,6 +387,8 @@ int kvm_read_guest_page(struct kvm *kvm, gfn_t gfn, void *data, int offset,
381int kvm_read_guest_atomic(struct kvm *kvm, gpa_t gpa, void *data, 387int kvm_read_guest_atomic(struct kvm *kvm, gpa_t gpa, void *data,
382 unsigned long len); 388 unsigned long len);
383int kvm_read_guest(struct kvm *kvm, gpa_t gpa, void *data, unsigned long len); 389int kvm_read_guest(struct kvm *kvm, gpa_t gpa, void *data, unsigned long len);
390int kvm_read_guest_cached(struct kvm *kvm, struct gfn_to_hva_cache *ghc,
391 void *data, unsigned long len);
384int kvm_write_guest_page(struct kvm *kvm, gfn_t gfn, const void *data, 392int kvm_write_guest_page(struct kvm *kvm, gfn_t gfn, const void *data,
385 int offset, int len); 393 int offset, int len);
386int kvm_write_guest(struct kvm *kvm, gpa_t gpa, const void *data, 394int kvm_write_guest(struct kvm *kvm, gpa_t gpa, const void *data,
diff --git a/include/linux/led-lm3530.h b/include/linux/led-lm3530.h
index 58592fa67d2..8eb12357a11 100644
--- a/include/linux/led-lm3530.h
+++ b/include/linux/led-lm3530.h
@@ -84,6 +84,8 @@ enum lm3530_als_mode {
84 * @brt_ramp_rise: rate of rise of led current 84 * @brt_ramp_rise: rate of rise of led current
85 * @als1_resistor_sel: internal resistance from ALS1 input to ground 85 * @als1_resistor_sel: internal resistance from ALS1 input to ground
86 * @als2_resistor_sel: internal resistance from ALS2 input to ground 86 * @als2_resistor_sel: internal resistance from ALS2 input to ground
87 * @als_vmin: als input voltage calibrated for max brightness in mV
88 * @als_vmax: als input voltage calibrated for min brightness in mV
87 * @brt_val: brightness value (0-255) 89 * @brt_val: brightness value (0-255)
88 */ 90 */
89struct lm3530_platform_data { 91struct lm3530_platform_data {
@@ -101,6 +103,9 @@ struct lm3530_platform_data {
101 u8 als1_resistor_sel; 103 u8 als1_resistor_sel;
102 u8 als2_resistor_sel; 104 u8 als2_resistor_sel;
103 105
106 u32 als_vmin;
107 u32 als_vmax;
108
104 u8 brt_val; 109 u8 brt_val;
105}; 110};
106 111
diff --git a/include/linux/lglock.h b/include/linux/lglock.h
index f549056fb20..87f402ccec5 100644
--- a/include/linux/lglock.h
+++ b/include/linux/lglock.h
@@ -22,6 +22,7 @@
22#include <linux/spinlock.h> 22#include <linux/spinlock.h>
23#include <linux/lockdep.h> 23#include <linux/lockdep.h>
24#include <linux/percpu.h> 24#include <linux/percpu.h>
25#include <linux/cpu.h>
25 26
26/* can make br locks by using local lock for read side, global lock for write */ 27/* can make br locks by using local lock for read side, global lock for write */
27#define br_lock_init(name) name##_lock_init() 28#define br_lock_init(name) name##_lock_init()
@@ -72,9 +73,31 @@
72 73
73#define DEFINE_LGLOCK(name) \ 74#define DEFINE_LGLOCK(name) \
74 \ 75 \
76 DEFINE_SPINLOCK(name##_cpu_lock); \
77 cpumask_t name##_cpus __read_mostly; \
75 DEFINE_PER_CPU(arch_spinlock_t, name##_lock); \ 78 DEFINE_PER_CPU(arch_spinlock_t, name##_lock); \
76 DEFINE_LGLOCK_LOCKDEP(name); \ 79 DEFINE_LGLOCK_LOCKDEP(name); \
77 \ 80 \
81 static int \
82 name##_lg_cpu_callback(struct notifier_block *nb, \
83 unsigned long action, void *hcpu) \
84 { \
85 switch (action & ~CPU_TASKS_FROZEN) { \
86 case CPU_UP_PREPARE: \
87 spin_lock(&name##_cpu_lock); \
88 cpu_set((unsigned long)hcpu, name##_cpus); \
89 spin_unlock(&name##_cpu_lock); \
90 break; \
91 case CPU_UP_CANCELED: case CPU_DEAD: \
92 spin_lock(&name##_cpu_lock); \
93 cpu_clear((unsigned long)hcpu, name##_cpus); \
94 spin_unlock(&name##_cpu_lock); \
95 } \
96 return NOTIFY_OK; \
97 } \
98 static struct notifier_block name##_lg_cpu_notifier = { \
99 .notifier_call = name##_lg_cpu_callback, \
100 }; \
78 void name##_lock_init(void) { \ 101 void name##_lock_init(void) { \
79 int i; \ 102 int i; \
80 LOCKDEP_INIT_MAP(&name##_lock_dep_map, #name, &name##_lock_key, 0); \ 103 LOCKDEP_INIT_MAP(&name##_lock_dep_map, #name, &name##_lock_key, 0); \
@@ -83,6 +106,11 @@
83 lock = &per_cpu(name##_lock, i); \ 106 lock = &per_cpu(name##_lock, i); \
84 *lock = (arch_spinlock_t)__ARCH_SPIN_LOCK_UNLOCKED; \ 107 *lock = (arch_spinlock_t)__ARCH_SPIN_LOCK_UNLOCKED; \
85 } \ 108 } \
109 register_hotcpu_notifier(&name##_lg_cpu_notifier); \
110 get_online_cpus(); \
111 for_each_online_cpu(i) \
112 cpu_set(i, name##_cpus); \
113 put_online_cpus(); \
86 } \ 114 } \
87 EXPORT_SYMBOL(name##_lock_init); \ 115 EXPORT_SYMBOL(name##_lock_init); \
88 \ 116 \
@@ -124,9 +152,9 @@
124 \ 152 \
125 void name##_global_lock_online(void) { \ 153 void name##_global_lock_online(void) { \
126 int i; \ 154 int i; \
127 preempt_disable(); \ 155 spin_lock(&name##_cpu_lock); \
128 rwlock_acquire(&name##_lock_dep_map, 0, 0, _RET_IP_); \ 156 rwlock_acquire(&name##_lock_dep_map, 0, 0, _RET_IP_); \
129 for_each_online_cpu(i) { \ 157 for_each_cpu(i, &name##_cpus) { \
130 arch_spinlock_t *lock; \ 158 arch_spinlock_t *lock; \
131 lock = &per_cpu(name##_lock, i); \ 159 lock = &per_cpu(name##_lock, i); \
132 arch_spin_lock(lock); \ 160 arch_spin_lock(lock); \
@@ -137,12 +165,12 @@
137 void name##_global_unlock_online(void) { \ 165 void name##_global_unlock_online(void) { \
138 int i; \ 166 int i; \
139 rwlock_release(&name##_lock_dep_map, 1, _RET_IP_); \ 167 rwlock_release(&name##_lock_dep_map, 1, _RET_IP_); \
140 for_each_online_cpu(i) { \ 168 for_each_cpu(i, &name##_cpus) { \
141 arch_spinlock_t *lock; \ 169 arch_spinlock_t *lock; \
142 lock = &per_cpu(name##_lock, i); \ 170 lock = &per_cpu(name##_lock, i); \
143 arch_spin_unlock(lock); \ 171 arch_spin_unlock(lock); \
144 } \ 172 } \
145 preempt_enable(); \ 173 spin_unlock(&name##_cpu_lock); \
146 } \ 174 } \
147 EXPORT_SYMBOL(name##_global_unlock_online); \ 175 EXPORT_SYMBOL(name##_global_unlock_online); \
148 \ 176 \
diff --git a/include/linux/lguest.h b/include/linux/lguest.h
index 2fb1dcbcb5a..9962c6bb131 100644
--- a/include/linux/lguest.h
+++ b/include/linux/lguest.h
@@ -59,8 +59,6 @@ struct lguest_data {
59 unsigned long reserve_mem; 59 unsigned long reserve_mem;
60 /* KHz for the TSC clock. */ 60 /* KHz for the TSC clock. */
61 u32 tsc_khz; 61 u32 tsc_khz;
62 /* Page where the top-level pagetable is */
63 unsigned long pgdir;
64 62
65/* Fields initialized by the Guest at boot: */ 63/* Fields initialized by the Guest at boot: */
66 /* Instruction range to suppress interrupts even if enabled */ 64 /* Instruction range to suppress interrupts even if enabled */
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 5a9926b3407..efd6f980076 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -74,6 +74,16 @@
74 74
75#define BPRINTK(fmt, args...) if (ap->flags & ATA_FLAG_DEBUGMSG) printk(KERN_ERR "%s: " fmt, __func__, ## args) 75#define BPRINTK(fmt, args...) if (ap->flags & ATA_FLAG_DEBUGMSG) printk(KERN_ERR "%s: " fmt, __func__, ## args)
76 76
77#define ata_print_version_once(dev, version) \
78({ \
79 static bool __print_once; \
80 \
81 if (!__print_once) { \
82 __print_once = true; \
83 ata_print_version(dev, version); \
84 } \
85})
86
77/* NEW: debug levels */ 87/* NEW: debug levels */
78#define HAVE_LIBATA_MSG 1 88#define HAVE_LIBATA_MSG 1
79 89
@@ -1244,20 +1254,50 @@ static inline int sata_srst_pmp(struct ata_link *link)
1244/* 1254/*
1245 * printk helpers 1255 * printk helpers
1246 */ 1256 */
1247#define ata_port_printk(ap, lv, fmt, args...) \ 1257__attribute__((format (printf, 3, 4)))
1248 printk("%sata%u: "fmt, lv, (ap)->print_id , ##args) 1258int ata_port_printk(const struct ata_port *ap, const char *level,
1249 1259 const char *fmt, ...);
1250#define ata_link_printk(link, lv, fmt, args...) do { \ 1260__attribute__((format (printf, 3, 4)))
1251 if (sata_pmp_attached((link)->ap) || (link)->ap->slave_link) \ 1261int ata_link_printk(const struct ata_link *link, const char *level,
1252 printk("%sata%u.%02u: "fmt, lv, (link)->ap->print_id, \ 1262 const char *fmt, ...);
1253 (link)->pmp , ##args); \ 1263__attribute__((format (printf, 3, 4)))
1254 else \ 1264int ata_dev_printk(const struct ata_device *dev, const char *level,
1255 printk("%sata%u: "fmt, lv, (link)->ap->print_id , ##args); \ 1265 const char *fmt, ...);
1256 } while(0) 1266
1257 1267#define ata_port_err(ap, fmt, ...) \
1258#define ata_dev_printk(dev, lv, fmt, args...) \ 1268 ata_port_printk(ap, KERN_ERR, fmt, ##__VA_ARGS__)
1259 printk("%sata%u.%02u: "fmt, lv, (dev)->link->ap->print_id, \ 1269#define ata_port_warn(ap, fmt, ...) \
1260 (dev)->link->pmp + (dev)->devno , ##args) 1270 ata_port_printk(ap, KERN_WARNING, fmt, ##__VA_ARGS__)
1271#define ata_port_notice(ap, fmt, ...) \
1272 ata_port_printk(ap, KERN_NOTICE, fmt, ##__VA_ARGS__)
1273#define ata_port_info(ap, fmt, ...) \
1274 ata_port_printk(ap, KERN_INFO, fmt, ##__VA_ARGS__)
1275#define ata_port_dbg(ap, fmt, ...) \
1276 ata_port_printk(ap, KERN_DEBUG, fmt, ##__VA_ARGS__)
1277
1278#define ata_link_err(link, fmt, ...) \
1279 ata_link_printk(link, KERN_ERR, fmt, ##__VA_ARGS__)
1280#define ata_link_warn(link, fmt, ...) \
1281 ata_link_printk(link, KERN_WARNING, fmt, ##__VA_ARGS__)
1282#define ata_link_notice(link, fmt, ...) \
1283 ata_link_printk(link, KERN_NOTICE, fmt, ##__VA_ARGS__)
1284#define ata_link_info(link, fmt, ...) \
1285 ata_link_printk(link, KERN_INFO, fmt, ##__VA_ARGS__)
1286#define ata_link_dbg(link, fmt, ...) \
1287 ata_link_printk(link, KERN_DEBUG, fmt, ##__VA_ARGS__)
1288
1289#define ata_dev_err(dev, fmt, ...) \
1290 ata_dev_printk(dev, KERN_ERR, fmt, ##__VA_ARGS__)
1291#define ata_dev_warn(dev, fmt, ...) \
1292 ata_dev_printk(dev, KERN_WARNING, fmt, ##__VA_ARGS__)
1293#define ata_dev_notice(dev, fmt, ...) \
1294 ata_dev_printk(dev, KERN_NOTICE, fmt, ##__VA_ARGS__)
1295#define ata_dev_info(dev, fmt, ...) \
1296 ata_dev_printk(dev, KERN_INFO, fmt, ##__VA_ARGS__)
1297#define ata_dev_dbg(dev, fmt, ...) \
1298 ata_dev_printk(dev, KERN_DEBUG, fmt, ##__VA_ARGS__)
1299
1300void ata_print_version(const struct device *dev, const char *version);
1261 1301
1262/* 1302/*
1263 * ata_eh_info helpers 1303 * ata_eh_info helpers
diff --git a/include/linux/lightsensor.h b/include/linux/lightsensor.h
new file mode 100644
index 00000000000..7a87853ac06
--- /dev/null
+++ b/include/linux/lightsensor.h
@@ -0,0 +1,28 @@
1/* include/linux/lightsensor.h
2 *
3 * Copyright (C) 2011 Capella Microsystems Inc.
4 * Author: Frank Hsieh <pengyueh@gmail.com>
5 *
6 * This software is licensed under the terms of the GNU General Public
7 * License version 2, as published by the Free Software Foundation, and
8 * may be copied, distributed, and modified under those terms.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 */
16
17#ifndef __LINUX_LIGHTSENSOR_H
18#define __LINUX_LIGHTSENSOR_H
19
20#include <linux/types.h>
21#include <linux/ioctl.h>
22
23#define LIGHTSENSOR_IOCTL_MAGIC 'l'
24
25#define LIGHTSENSOR_IOCTL_GET_ENABLED _IOR(LIGHTSENSOR_IOCTL_MAGIC, 1, int *)
26#define LIGHTSENSOR_IOCTL_ENABLE _IOW(LIGHTSENSOR_IOCTL_MAGIC, 2, int *)
27
28#endif
diff --git a/include/linux/llist.h b/include/linux/llist.h
new file mode 100644
index 00000000000..aa0c8b5b3cd
--- /dev/null
+++ b/include/linux/llist.h
@@ -0,0 +1,126 @@
1#ifndef LLIST_H
2#define LLIST_H
3/*
4 * Lock-less NULL terminated single linked list
5 *
6 * If there are multiple producers and multiple consumers, llist_add
7 * can be used in producers and llist_del_all can be used in
8 * consumers. They can work simultaneously without lock. But
9 * llist_del_first can not be used here. Because llist_del_first
10 * depends on list->first->next does not changed if list->first is not
11 * changed during its operation, but llist_del_first, llist_add,
12 * llist_add (or llist_del_all, llist_add, llist_add) sequence in
13 * another consumer may violate that.
14 *
15 * If there are multiple producers and one consumer, llist_add can be
16 * used in producers and llist_del_all or llist_del_first can be used
17 * in the consumer.
18 *
19 * This can be summarized as follow:
20 *
21 * | add | del_first | del_all
22 * add | - | - | -
23 * del_first | | L | L
24 * del_all | | | -
25 *
26 * Where "-" stands for no lock is needed, while "L" stands for lock
27 * is needed.
28 *
29 * The list entries deleted via llist_del_all can be traversed with
30 * traversing function such as llist_for_each etc. But the list
31 * entries can not be traversed safely before deleted from the list.
32 * The order of deleted entries is from the newest to the oldest added
33 * one. If you want to traverse from the oldest to the newest, you
34 * must reverse the order by yourself before traversing.
35 *
36 * The basic atomic operation of this list is cmpxchg on long. On
37 * architectures that don't have NMI-safe cmpxchg implementation, the
38 * list can NOT be used in NMI handler. So code uses the list in NMI
39 * handler should depend on CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG.
40 */
41
42struct llist_head {
43 struct llist_node *first;
44};
45
46struct llist_node {
47 struct llist_node *next;
48};
49
50#define LLIST_HEAD_INIT(name) { NULL }
51#define LLIST_HEAD(name) struct llist_head name = LLIST_HEAD_INIT(name)
52
53/**
54 * init_llist_head - initialize lock-less list head
55 * @head: the head for your lock-less list
56 */
57static inline void init_llist_head(struct llist_head *list)
58{
59 list->first = NULL;
60}
61
62/**
63 * llist_entry - get the struct of this entry
64 * @ptr: the &struct llist_node pointer.
65 * @type: the type of the struct this is embedded in.
66 * @member: the name of the llist_node within the struct.
67 */
68#define llist_entry(ptr, type, member) \
69 container_of(ptr, type, member)
70
71/**
72 * llist_for_each - iterate over some deleted entries of a lock-less list
73 * @pos: the &struct llist_node to use as a loop cursor
74 * @node: the first entry of deleted list entries
75 *
76 * In general, some entries of the lock-less list can be traversed
77 * safely only after being deleted from list, so start with an entry
78 * instead of list head.
79 *
80 * If being used on entries deleted from lock-less list directly, the
81 * traverse order is from the newest to the oldest added entry. If
82 * you want to traverse from the oldest to the newest, you must
83 * reverse the order by yourself before traversing.
84 */
85#define llist_for_each(pos, node) \
86 for ((pos) = (node); pos; (pos) = (pos)->next)
87
88/**
89 * llist_for_each_entry - iterate over some deleted entries of lock-less list of given type
90 * @pos: the type * to use as a loop cursor.
91 * @node: the fist entry of deleted list entries.
92 * @member: the name of the llist_node with the struct.
93 *
94 * In general, some entries of the lock-less list can be traversed
95 * safely only after being removed from list, so start with an entry
96 * instead of list head.
97 *
98 * If being used on entries deleted from lock-less list directly, the
99 * traverse order is from the newest to the oldest added entry. If
100 * you want to traverse from the oldest to the newest, you must
101 * reverse the order by yourself before traversing.
102 */
103#define llist_for_each_entry(pos, node, member) \
104 for ((pos) = llist_entry((node), typeof(*(pos)), member); \
105 &(pos)->member != NULL; \
106 (pos) = llist_entry((pos)->member.next, typeof(*(pos)), member))
107
108/**
109 * llist_empty - tests whether a lock-less list is empty
110 * @head: the list to test
111 *
112 * Not guaranteed to be accurate or up to date. Just a quick way to
113 * test whether the list is empty without deleting something from the
114 * list.
115 */
116static inline int llist_empty(const struct llist_head *head)
117{
118 return ACCESS_ONCE(head->first) == NULL;
119}
120
121void llist_add(struct llist_node *new, struct llist_head *head);
122void llist_add_batch(struct llist_node *new_first, struct llist_node *new_last,
123 struct llist_head *head);
124struct llist_node *llist_del_first(struct llist_head *head);
125struct llist_node *llist_del_all(struct llist_head *head);
126#endif /* LLIST_H */
diff --git a/include/linux/log2.h b/include/linux/log2.h
index 25b808631cd..fd7ff3d91e6 100644
--- a/include/linux/log2.h
+++ b/include/linux/log2.h
@@ -185,7 +185,6 @@ unsigned long __rounddown_pow_of_two(unsigned long n)
185#define rounddown_pow_of_two(n) \ 185#define rounddown_pow_of_two(n) \
186( \ 186( \
187 __builtin_constant_p(n) ? ( \ 187 __builtin_constant_p(n) ? ( \
188 (n == 1) ? 0 : \
189 (1UL << ilog2(n))) : \ 188 (1UL << ilog2(n))) : \
190 __rounddown_pow_of_two(n) \ 189 __rounddown_pow_of_two(n) \
191 ) 190 )
diff --git a/include/linux/loop.h b/include/linux/loop.h
index 66c194e2d9b..683d6989011 100644
--- a/include/linux/loop.h
+++ b/include/linux/loop.h
@@ -64,7 +64,6 @@ struct loop_device {
64 64
65 struct request_queue *lo_queue; 65 struct request_queue *lo_queue;
66 struct gendisk *lo_disk; 66 struct gendisk *lo_disk;
67 struct list_head lo_list;
68}; 67};
69 68
70#endif /* __KERNEL__ */ 69#endif /* __KERNEL__ */
@@ -161,4 +160,8 @@ int loop_unregister_transfer(int number);
161#define LOOP_CHANGE_FD 0x4C06 160#define LOOP_CHANGE_FD 0x4C06
162#define LOOP_SET_CAPACITY 0x4C07 161#define LOOP_SET_CAPACITY 0x4C07
163 162
163/* /dev/loop-control interface */
164#define LOOP_CTL_ADD 0x4C80
165#define LOOP_CTL_REMOVE 0x4C81
166#define LOOP_CTL_GET_FREE 0x4C82
164#endif 167#endif
diff --git a/include/linux/max17048_battery.h b/include/linux/max17048_battery.h
new file mode 100644
index 00000000000..d997082fb5a
--- /dev/null
+++ b/include/linux/max17048_battery.h
@@ -0,0 +1,35 @@
1/*
2 * Copyright (C) 2009 Samsung Electronics
3 * Copyright (C) 2012 Nvidia Cooperation
4 * Minkyu Kang <mk7.kang@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 __MAX17048_BATTERY_H_
12#define __MAX17048_BATTERY_H_
13#include <linux/smb349-charger.h>
14
15struct max17048_battery_model {
16 uint8_t rcomp;
17 uint8_t soccheck_A;
18 uint8_t soccheck_B;
19 uint8_t bits;
20 uint8_t alert_threshold;
21 uint8_t one_percent_alerts;
22 uint8_t alert_on_reset;
23 uint16_t rcomp_seg;
24 uint16_t hibernate;
25 uint16_t vreset;
26 uint16_t valert;
27 uint16_t ocvtest;
28};
29
30struct max17048_platform_data {
31 int (*battery_online)(void);
32 int (*charging_status)(void);
33 int (*charger_online)(void);
34};
35#endif
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index 50940da6adf..b9c1c06cd7a 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -76,8 +76,6 @@ extern void mem_cgroup_uncharge_end(void);
76 76
77extern void mem_cgroup_uncharge_page(struct page *page); 77extern void mem_cgroup_uncharge_page(struct page *page);
78extern void mem_cgroup_uncharge_cache_page(struct page *page); 78extern void mem_cgroup_uncharge_cache_page(struct page *page);
79extern int mem_cgroup_shmem_charge_fallback(struct page *page,
80 struct mm_struct *mm, gfp_t gfp_mask);
81 79
82extern void mem_cgroup_out_of_memory(struct mem_cgroup *mem, gfp_t gfp_mask); 80extern void mem_cgroup_out_of_memory(struct mem_cgroup *mem, gfp_t gfp_mask);
83int task_in_mem_cgroup(struct task_struct *task, const struct mem_cgroup *mem); 81int task_in_mem_cgroup(struct task_struct *task, const struct mem_cgroup *mem);
@@ -111,14 +109,15 @@ int mem_cgroup_inactive_anon_is_low(struct mem_cgroup *memcg);
111int mem_cgroup_inactive_file_is_low(struct mem_cgroup *memcg); 109int mem_cgroup_inactive_file_is_low(struct mem_cgroup *memcg);
112int mem_cgroup_select_victim_node(struct mem_cgroup *memcg); 110int mem_cgroup_select_victim_node(struct mem_cgroup *memcg);
113unsigned long mem_cgroup_zone_nr_lru_pages(struct mem_cgroup *memcg, 111unsigned long mem_cgroup_zone_nr_lru_pages(struct mem_cgroup *memcg,
114 struct zone *zone, 112 int nid, int zid, unsigned int lrumask);
115 enum lru_list lru);
116struct zone_reclaim_stat *mem_cgroup_get_reclaim_stat(struct mem_cgroup *memcg, 113struct zone_reclaim_stat *mem_cgroup_get_reclaim_stat(struct mem_cgroup *memcg,
117 struct zone *zone); 114 struct zone *zone);
118struct zone_reclaim_stat* 115struct zone_reclaim_stat*
119mem_cgroup_get_reclaim_stat_from_page(struct page *page); 116mem_cgroup_get_reclaim_stat_from_page(struct page *page);
120extern void mem_cgroup_print_oom_info(struct mem_cgroup *memcg, 117extern void mem_cgroup_print_oom_info(struct mem_cgroup *memcg,
121 struct task_struct *p); 118 struct task_struct *p);
119extern void mem_cgroup_replace_page_cache(struct page *oldpage,
120 struct page *newpage);
122 121
123#ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP 122#ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP
124extern int do_swap_account; 123extern int do_swap_account;
@@ -207,12 +206,6 @@ static inline void mem_cgroup_uncharge_cache_page(struct page *page)
207{ 206{
208} 207}
209 208
210static inline int mem_cgroup_shmem_charge_fallback(struct page *page,
211 struct mm_struct *mm, gfp_t gfp_mask)
212{
213 return 0;
214}
215
216static inline void mem_cgroup_add_lru_list(struct page *page, int lru) 209static inline void mem_cgroup_add_lru_list(struct page *page, int lru)
217{ 210{
218} 211}
@@ -313,8 +306,8 @@ mem_cgroup_inactive_file_is_low(struct mem_cgroup *memcg)
313} 306}
314 307
315static inline unsigned long 308static inline unsigned long
316mem_cgroup_zone_nr_lru_pages(struct mem_cgroup *memcg, struct zone *zone, 309mem_cgroup_zone_nr_lru_pages(struct mem_cgroup *memcg, int nid, int zid,
317 enum lru_list lru) 310 unsigned int lru_mask)
318{ 311{
319 return 0; 312 return 0;
320} 313}
@@ -370,6 +363,10 @@ static inline
370void mem_cgroup_count_vm_event(struct mm_struct *mm, enum vm_event_item idx) 363void mem_cgroup_count_vm_event(struct mm_struct *mm, enum vm_event_item idx)
371{ 364{
372} 365}
366static inline void mem_cgroup_replace_page_cache(struct page *oldpage,
367 struct page *newpage)
368{
369}
373#endif /* CONFIG_CGROUP_MEM_CONT */ 370#endif /* CONFIG_CGROUP_MEM_CONT */
374 371
375#if !defined(CONFIG_CGROUP_MEM_RES_CTLR) || !defined(CONFIG_DEBUG_VM) 372#if !defined(CONFIG_CGROUP_MEM_RES_CTLR) || !defined(CONFIG_DEBUG_VM)
diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h
index 8122018d300..0b8e2a74260 100644
--- a/include/linux/memory_hotplug.h
+++ b/include/linux/memory_hotplug.h
@@ -68,12 +68,19 @@ static inline void zone_seqlock_init(struct zone *zone)
68extern int zone_grow_free_lists(struct zone *zone, unsigned long new_nr_pages); 68extern int zone_grow_free_lists(struct zone *zone, unsigned long new_nr_pages);
69extern int zone_grow_waitqueues(struct zone *zone, unsigned long nr_pages); 69extern int zone_grow_waitqueues(struct zone *zone, unsigned long nr_pages);
70extern int add_one_highpage(struct page *page, int pfn, int bad_ppro); 70extern int add_one_highpage(struct page *page, int pfn, int bad_ppro);
71/* need some defines for these for archs that don't support it */
72extern void online_page(struct page *page);
73/* VM interface that may be used by firmware interface */ 71/* VM interface that may be used by firmware interface */
74extern int online_pages(unsigned long, unsigned long); 72extern int online_pages(unsigned long, unsigned long);
75extern void __offline_isolated_pages(unsigned long, unsigned long); 73extern void __offline_isolated_pages(unsigned long, unsigned long);
76 74
75typedef void (*online_page_callback_t)(struct page *page);
76
77extern int set_online_page_callback(online_page_callback_t callback);
78extern int restore_online_page_callback(online_page_callback_t callback);
79
80extern void __online_page_set_limits(struct page *page);
81extern void __online_page_increment_counters(struct page *page);
82extern void __online_page_free(struct page *page);
83
77#ifdef CONFIG_MEMORY_HOTREMOVE 84#ifdef CONFIG_MEMORY_HOTREMOVE
78extern bool is_pageblock_removable_nolock(struct page *page); 85extern bool is_pageblock_removable_nolock(struct page *page);
79#endif /* CONFIG_MEMORY_HOTREMOVE */ 86#endif /* CONFIG_MEMORY_HOTREMOVE */
diff --git a/include/linux/mfd/aat2870.h b/include/linux/mfd/aat2870.h
new file mode 100644
index 00000000000..f7316c29bde
--- /dev/null
+++ b/include/linux/mfd/aat2870.h
@@ -0,0 +1,181 @@
1/*
2 * linux/include/linux/mfd/aat2870.h
3 *
4 * Copyright (c) 2011, NVIDIA Corporation.
5 * Author: Jin Park <jinyoungp@nvidia.com>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms 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 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
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
19 * 02110-1301 USA
20 */
21
22#ifndef __LINUX_MFD_AAT2870_H
23#define __LINUX_MFD_AAT2870_H
24
25#include <linux/debugfs.h>
26#include <linux/i2c.h>
27
28/* Register offsets */
29#define AAT2870_BL_CH_EN 0x00
30#define AAT2870_BLM 0x01
31#define AAT2870_BLS 0x02
32#define AAT2870_BL1 0x03
33#define AAT2870_BL2 0x04
34#define AAT2870_BL3 0x05
35#define AAT2870_BL4 0x06
36#define AAT2870_BL5 0x07
37#define AAT2870_BL6 0x08
38#define AAT2870_BL7 0x09
39#define AAT2870_BL8 0x0A
40#define AAT2870_FLR 0x0B
41#define AAT2870_FM 0x0C
42#define AAT2870_FS 0x0D
43#define AAT2870_ALS_CFG0 0x0E
44#define AAT2870_ALS_CFG1 0x0F
45#define AAT2870_ALS_CFG2 0x10
46#define AAT2870_AMB 0x11
47#define AAT2870_ALS0 0x12
48#define AAT2870_ALS1 0x13
49#define AAT2870_ALS2 0x14
50#define AAT2870_ALS3 0x15
51#define AAT2870_ALS4 0x16
52#define AAT2870_ALS5 0x17
53#define AAT2870_ALS6 0x18
54#define AAT2870_ALS7 0x19
55#define AAT2870_ALS8 0x1A
56#define AAT2870_ALS9 0x1B
57#define AAT2870_ALSA 0x1C
58#define AAT2870_ALSB 0x1D
59#define AAT2870_ALSC 0x1E
60#define AAT2870_ALSD 0x1F
61#define AAT2870_ALSE 0x20
62#define AAT2870_ALSF 0x21
63#define AAT2870_SUB_SET 0x22
64#define AAT2870_SUB_CTRL 0x23
65#define AAT2870_LDO_AB 0x24
66#define AAT2870_LDO_CD 0x25
67#define AAT2870_LDO_EN 0x26
68#define AAT2870_REG_NUM 0x27
69
70/* Device IDs */
71enum aat2870_id {
72 AAT2870_ID_BL,
73 AAT2870_ID_LDOA,
74 AAT2870_ID_LDOB,
75 AAT2870_ID_LDOC,
76 AAT2870_ID_LDOD
77};
78
79/* Backlight channels */
80#define AAT2870_BL_CH1 0x01
81#define AAT2870_BL_CH2 0x02
82#define AAT2870_BL_CH3 0x04
83#define AAT2870_BL_CH4 0x08
84#define AAT2870_BL_CH5 0x10
85#define AAT2870_BL_CH6 0x20
86#define AAT2870_BL_CH7 0x40
87#define AAT2870_BL_CH8 0x80
88#define AAT2870_BL_CH_ALL 0xFF
89
90/* Backlight current magnitude (mA) */
91enum aat2870_current {
92 AAT2870_CURRENT_0_45 = 1,
93 AAT2870_CURRENT_0_90,
94 AAT2870_CURRENT_1_80,
95 AAT2870_CURRENT_2_70,
96 AAT2870_CURRENT_3_60,
97 AAT2870_CURRENT_4_50,
98 AAT2870_CURRENT_5_40,
99 AAT2870_CURRENT_6_30,
100 AAT2870_CURRENT_7_20,
101 AAT2870_CURRENT_8_10,
102 AAT2870_CURRENT_9_00,
103 AAT2870_CURRENT_9_90,
104 AAT2870_CURRENT_10_8,
105 AAT2870_CURRENT_11_7,
106 AAT2870_CURRENT_12_6,
107 AAT2870_CURRENT_13_5,
108 AAT2870_CURRENT_14_4,
109 AAT2870_CURRENT_15_3,
110 AAT2870_CURRENT_16_2,
111 AAT2870_CURRENT_17_1,
112 AAT2870_CURRENT_18_0,
113 AAT2870_CURRENT_18_9,
114 AAT2870_CURRENT_19_8,
115 AAT2870_CURRENT_20_7,
116 AAT2870_CURRENT_21_6,
117 AAT2870_CURRENT_22_5,
118 AAT2870_CURRENT_23_4,
119 AAT2870_CURRENT_24_3,
120 AAT2870_CURRENT_25_2,
121 AAT2870_CURRENT_26_1,
122 AAT2870_CURRENT_27_0,
123 AAT2870_CURRENT_27_9
124};
125
126struct aat2870_register {
127 bool readable;
128 bool writeable;
129 u8 value;
130};
131
132struct aat2870_data {
133 struct device *dev;
134 struct i2c_client *client;
135
136 struct mutex io_lock;
137 struct aat2870_register *reg_cache; /* register cache */
138 int en_pin; /* enable GPIO pin (if < 0, ignore this value) */
139 bool is_enable;
140
141 /* init and uninit for platform specified */
142 int (*init)(struct aat2870_data *aat2870);
143 void (*uninit)(struct aat2870_data *aat2870);
144
145 /* i2c io funcntions */
146 int (*read)(struct aat2870_data *aat2870, u8 addr, u8 *val);
147 int (*write)(struct aat2870_data *aat2870, u8 addr, u8 val);
148 int (*update)(struct aat2870_data *aat2870, u8 addr, u8 mask, u8 val);
149
150 /* for debugfs */
151 struct dentry *dentry_root;
152 struct dentry *dentry_reg;
153};
154
155struct aat2870_subdev_info {
156 int id;
157 const char *name;
158 void *platform_data;
159};
160
161struct aat2870_platform_data {
162 int en_pin; /* enable GPIO pin (if < 0, ignore this value) */
163
164 struct aat2870_subdev_info *subdevs;
165 int num_subdevs;
166
167 /* init and uninit for platform specified */
168 int (*init)(struct aat2870_data *aat2870);
169 void (*uninit)(struct aat2870_data *aat2870);
170};
171
172struct aat2870_bl_platform_data {
173 /* backlight channels, default is AAT2870_BL_CH_ALL */
174 int channels;
175 /* backlight current magnitude, default is AAT2870_CURRENT_27_9 */
176 int max_current;
177 /* maximum brightness, default is 255 */
178 int max_brightness;
179};
180
181#endif /* __LINUX_MFD_AAT2870_H */
diff --git a/include/linux/mfd/ab8500.h b/include/linux/mfd/ab8500.h
index b3184307519..838c6b487cc 100644
--- a/include/linux/mfd/ab8500.h
+++ b/include/linux/mfd/ab8500.h
@@ -28,6 +28,7 @@
28#define AB8500_INTERRUPT 0xE 28#define AB8500_INTERRUPT 0xE
29#define AB8500_RTC 0xF 29#define AB8500_RTC 0xF
30#define AB8500_MISC 0x10 30#define AB8500_MISC 0x10
31#define AB8500_DEVELOPMENT 0x11
31#define AB8500_DEBUG 0x12 32#define AB8500_DEBUG 0x12
32#define AB8500_PROD_TEST 0x13 33#define AB8500_PROD_TEST 0x13
33#define AB8500_OTP_EMUL 0x15 34#define AB8500_OTP_EMUL 0x15
@@ -74,13 +75,6 @@
74#define AB8500_INT_ACC_DETECT_21DB_F 37 75#define AB8500_INT_ACC_DETECT_21DB_F 37
75#define AB8500_INT_ACC_DETECT_21DB_R 38 76#define AB8500_INT_ACC_DETECT_21DB_R 38
76#define AB8500_INT_GP_SW_ADC_CONV_END 39 77#define AB8500_INT_GP_SW_ADC_CONV_END 39
77#define AB8500_INT_ACC_DETECT_1DB_F 33
78#define AB8500_INT_ACC_DETECT_1DB_R 34
79#define AB8500_INT_ACC_DETECT_22DB_F 35
80#define AB8500_INT_ACC_DETECT_22DB_R 36
81#define AB8500_INT_ACC_DETECT_21DB_F 37
82#define AB8500_INT_ACC_DETECT_21DB_R 38
83#define AB8500_INT_GP_SW_ADC_CONV_END 39
84#define AB8500_INT_GPIO6R 40 78#define AB8500_INT_GPIO6R 40
85#define AB8500_INT_GPIO7R 41 79#define AB8500_INT_GPIO7R 41
86#define AB8500_INT_GPIO8R 42 80#define AB8500_INT_GPIO8R 42
diff --git a/include/linux/mfd/max77663-core.h b/include/linux/mfd/max77663-core.h
new file mode 100644
index 00000000000..acfe22aac53
--- /dev/null
+++ b/include/linux/mfd/max77663-core.h
@@ -0,0 +1,178 @@
1/*
2 * include/linux/mfd/max77663-core.h
3 *
4 * Copyright 2011 Maxim Integrated Products, Inc.
5 * Copyright (C) 2011-2012 NVIDIA Corporation
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation; either version 2 of the
10 * License, or (at your option) any later version.
11 *
12 */
13
14#ifndef __LINUX_MFD_MAX77663_CORE_H__
15#define __LINUX_MFD_MAX77663_CORE_H__
16
17#include <linux/irq.h>
18#include <linux/mfd/core.h>
19
20/*
21 * Interrupts
22 */
23enum {
24 MAX77663_IRQ_LBT_LB, /* Low-Battery */
25 MAX77663_IRQ_LBT_THERM_ALRM1, /* Thermal alarm status, > 120C */
26 MAX77663_IRQ_LBT_THERM_ALRM2, /* Thermal alarm status, > 140C */
27
28 MAX77663_IRQ_GPIO0, /* GPIO0 edge detection */
29 MAX77663_IRQ_GPIO1, /* GPIO1 edge detection */
30 MAX77663_IRQ_GPIO2, /* GPIO2 edge detection */
31 MAX77663_IRQ_GPIO3, /* GPIO3 edge detection */
32 MAX77663_IRQ_GPIO4, /* GPIO4 edge detection */
33 MAX77663_IRQ_GPIO5, /* GPIO5 edge detection */
34 MAX77663_IRQ_GPIO6, /* GPIO6 edge detection */
35 MAX77663_IRQ_GPIO7, /* GPIO7 edge detection */
36
37 MAX77663_IRQ_ONOFF_HRDPOWRN, /* Hard power off warnning */
38 MAX77663_IRQ_ONOFF_EN0_1SEC, /* EN0 active for 1s */
39 MAX77663_IRQ_ONOFF_EN0_FALLING, /* EN0 falling */
40 MAX77663_IRQ_ONOFF_EN0_RISING, /* EN0 rising */
41 MAX77663_IRQ_ONOFF_LID_FALLING, /* LID falling */
42 MAX77663_IRQ_ONOFF_LID_RISING, /* LID rising */
43 MAX77663_IRQ_ONOFF_ACOK_FALLING,/* ACOK falling */
44 MAX77663_IRQ_ONOFF_ACOK_RISING, /* ACOK rising */
45
46 MAX77663_IRQ_RTC, /* RTC */
47 MAX77663_IRQ_SD_PF, /* SD power fail */
48 MAX77663_IRQ_LDO_PF, /* LDO power fail */
49 MAX77663_IRQ_32K, /* 32kHz oscillator */
50 MAX77663_IRQ_NVER, /* Non-Volatile Event Recorder */
51
52 MAX77663_IRQ_NR,
53};
54
55/*
56 *GPIOs
57 */
58enum {
59 MAX77663_GPIO0,
60 MAX77663_GPIO1,
61 MAX77663_GPIO2,
62 MAX77663_GPIO3,
63 MAX77663_GPIO4,
64 MAX77663_GPIO5,
65 MAX77663_GPIO6,
66 MAX77663_GPIO7,
67
68 MAX77663_GPIO_NR,
69};
70
71/* Direction */
72enum max77663_gpio_dir {
73 GPIO_DIR_DEF,
74 GPIO_DIR_IN,
75 GPIO_DIR_OUT,
76};
77
78/* Data output */
79enum max77663_gpio_data_out {
80 GPIO_DOUT_DEF,
81 GPIO_DOUT_HIGH,
82 GPIO_DOUT_LOW,
83};
84
85/* Output drive */
86enum max77663_gpio_out_drv {
87 GPIO_OUT_DRV_DEF,
88 GPIO_OUT_DRV_PUSH_PULL,
89 GPIO_OUT_DRV_OPEN_DRAIN,
90};
91
92/* Pull-up */
93enum max77663_gpio_pull_up {
94 GPIO_PU_DEF,
95 GPIO_PU_ENABLE,
96 GPIO_PU_DISABLE,
97};
98
99/* Pull-down */
100enum max77663_gpio_pull_down {
101 GPIO_PD_DEF,
102 GPIO_PD_ENABLE,
103 GPIO_PD_DISABLE,
104};
105
106/* Alternate */
107enum max77663_gpio_alt {
108 GPIO_ALT_DEF,
109 GPIO_ALT_ENABLE,
110 GPIO_ALT_DISABLE,
111};
112
113/*
114 * Flags
115 */
116#define SLP_LPM_ENABLE 0x01
117
118struct max77663_gpio_config {
119 int gpio; /* gpio number */
120 enum max77663_gpio_dir dir;
121 enum max77663_gpio_data_out dout;
122 enum max77663_gpio_out_drv out_drv;
123 enum max77663_gpio_pull_up pull_up;
124 enum max77663_gpio_pull_down pull_down;
125 enum max77663_gpio_alt alternate;
126};
127
128struct max77663_platform_data {
129 int irq_base;
130 int gpio_base;
131
132 int num_gpio_cfgs;
133 struct max77663_gpio_config *gpio_cfgs;
134
135 int num_subdevs;
136 struct mfd_cell *sub_devices;
137
138 unsigned int flags;
139
140 unsigned char rtc_i2c_addr;
141
142 bool use_power_off;
143};
144
145#if defined(CONFIG_MFD_MAX77663)
146int max77663_read(struct device *dev, u8 addr, void *values, u32 len,
147 bool is_rtc);
148int max77663_write(struct device *dev, u8 addr, void *values, u32 len,
149 bool is_rtc);
150int max77663_set_bits(struct device *dev, u8 addr, u8 mask, u8 value,
151 bool is_rtc);
152int max77663_gpio_set_alternate(int gpio, int alternate);
153#else
154static inline int max77663_read(struct device *dev, u8 addr, void *values,
155 u32 len, bool is_rtc)
156{
157 return 0;
158}
159
160static inline int max77663_write(struct device *dev, u8 addr, void *values,
161 u32 len, bool is_rtc)
162{
163 return 0;
164}
165
166static inline int max77663_set_bits(struct device *dev, u8 addr, u8 mask,
167 u8 value, bool is_rtc)
168{
169 return 0;
170}
171
172static inline int max77663_gpio_set_alternate(int gpio, int alternate)
173{
174 return 0;
175}
176#endif /* defined(CONFIG_MFD_MAX77663) */
177
178#endif /* __LINUX_MFD_MAX77663_CORE_H__ */
diff --git a/include/linux/mfd/max8907c.h b/include/linux/mfd/max8907c.h
new file mode 100644
index 00000000000..48014b0485c
--- /dev/null
+++ b/include/linux/mfd/max8907c.h
@@ -0,0 +1,259 @@
1/* linux/mfd/max8907c.h
2 *
3 * Functions to access MAX8907C power management chip.
4 *
5 * Copyright (C) 2010 Gyungoh Yoo <jack.yoo@maxim-ic.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef __LINUX_MFD_MAX8907C_H
13#define __LINUX_MFD_MAX8907C_H
14
15/* MAX8907C register map */
16#define MAX8907C_REG_SYSENSEL 0x00
17#define MAX8907C_REG_ON_OFF_IRQ1 0x01
18#define MAX8907C_REG_ON_OFF_IRQ1_MASK 0x02
19#define MAX8907C_REG_ON_OFF_STAT 0x03
20#define MAX8907C_REG_SDCTL1 0x04
21#define MAX8907C_REG_SDSEQCNT1 0x05
22#define MAX8907C_REG_SDV1 0x06
23#define MAX8907C_REG_SDCTL2 0x07
24#define MAX8907C_REG_SDSEQCNT2 0x08
25#define MAX8907C_REG_SDV2 0x09
26#define MAX8907C_REG_SDCTL3 0x0A
27#define MAX8907C_REG_SDSEQCNT3 0x0B
28#define MAX8907C_REG_SDV3 0x0C
29#define MAX8907C_REG_ON_OFF_IRQ2 0x0D
30#define MAX8907C_REG_ON_OFF_IRQ2_MASK 0x0E
31#define MAX8907C_REG_RESET_CNFG 0x0F
32#define MAX8907C_REG_LDOCTL16 0x10
33#define MAX8907C_REG_LDOSEQCNT16 0x11
34#define MAX8907C_REG_LDO16VOUT 0x12
35#define MAX8907C_REG_SDBYSEQCNT 0x13
36#define MAX8907C_REG_LDOCTL17 0x14
37#define MAX8907C_REG_LDOSEQCNT17 0x15
38#define MAX8907C_REG_LDO17VOUT 0x16
39#define MAX8907C_REG_LDOCTL1 0x18
40#define MAX8907C_REG_LDOSEQCNT1 0x19
41#define MAX8907C_REG_LDO1VOUT 0x1A
42#define MAX8907C_REG_LDOCTL2 0x1C
43#define MAX8907C_REG_LDOSEQCNT2 0x1D
44#define MAX8907C_REG_LDO2VOUT 0x1E
45#define MAX8907C_REG_LDOCTL3 0x20
46#define MAX8907C_REG_LDOSEQCNT3 0x21
47#define MAX8907C_REG_LDO3VOUT 0x22
48#define MAX8907C_REG_LDOCTL4 0x24
49#define MAX8907C_REG_LDOSEQCNT4 0x25
50#define MAX8907C_REG_LDO4VOUT 0x26
51#define MAX8907C_REG_LDOCTL5 0x28
52#define MAX8907C_REG_LDOSEQCNT5 0x29
53#define MAX8907C_REG_LDO5VOUT 0x2A
54#define MAX8907C_REG_LDOCTL6 0x2C
55#define MAX8907C_REG_LDOSEQCNT6 0x2D
56#define MAX8907C_REG_LDO6VOUT 0x2E
57#define MAX8907C_REG_LDOCTL7 0x30
58#define MAX8907C_REG_LDOSEQCNT7 0x31
59#define MAX8907C_REG_LDO7VOUT 0x32
60#define MAX8907C_REG_LDOCTL8 0x34
61#define MAX8907C_REG_LDOSEQCNT8 0x35
62#define MAX8907C_REG_LDO8VOUT 0x36
63#define MAX8907C_REG_LDOCTL9 0x38
64#define MAX8907C_REG_LDOSEQCNT9 0x39
65#define MAX8907C_REG_LDO9VOUT 0x3A
66#define MAX8907C_REG_LDOCTL10 0x3C
67#define MAX8907C_REG_LDOSEQCNT10 0x3D
68#define MAX8907C_REG_LDO10VOUT 0x3E
69#define MAX8907C_REG_LDOCTL11 0x40
70#define MAX8907C_REG_LDOSEQCNT11 0x41
71#define MAX8907C_REG_LDO11VOUT 0x42
72#define MAX8907C_REG_LDOCTL12 0x44
73#define MAX8907C_REG_LDOSEQCNT12 0x45
74#define MAX8907C_REG_LDO12VOUT 0x46
75#define MAX8907C_REG_LDOCTL13 0x48
76#define MAX8907C_REG_LDOSEQCNT13 0x49
77#define MAX8907C_REG_LDO13VOUT 0x4A
78#define MAX8907C_REG_LDOCTL14 0x4C
79#define MAX8907C_REG_LDOSEQCNT14 0x4D
80#define MAX8907C_REG_LDO14VOUT 0x4E
81#define MAX8907C_REG_LDOCTL15 0x50
82#define MAX8907C_REG_LDOSEQCNT15 0x51
83#define MAX8907C_REG_LDO15VOUT 0x52
84#define MAX8907C_REG_OUT5VEN 0x54
85#define MAX8907C_REG_OUT5VSEQ 0x55
86#define MAX8907C_REG_OUT33VEN 0x58
87#define MAX8907C_REG_OUT33VSEQ 0x59
88#define MAX8907C_REG_LDOCTL19 0x5C
89#define MAX8907C_REG_LDOSEQCNT19 0x5D
90#define MAX8907C_REG_LDO19VOUT 0x5E
91#define MAX8907C_REG_LBCNFG 0x60
92#define MAX8907C_REG_SEQ1CNFG 0x64
93#define MAX8907C_REG_SEQ2CNFG 0x65
94#define MAX8907C_REG_SEQ3CNFG 0x66
95#define MAX8907C_REG_SEQ4CNFG 0x67
96#define MAX8907C_REG_SEQ5CNFG 0x68
97#define MAX8907C_REG_SEQ6CNFG 0x69
98#define MAX8907C_REG_SEQ7CNFG 0x6A
99#define MAX8907C_REG_LDOCTL18 0x72
100#define MAX8907C_REG_LDOSEQCNT18 0x73
101#define MAX8907C_REG_LDO18VOUT 0x74
102#define MAX8907C_REG_BBAT_CNFG 0x78
103#define MAX8907C_REG_CHG_CNTL1 0x7C
104#define MAX8907C_REG_CHG_CNTL2 0x7D
105#define MAX8907C_REG_CHG_IRQ1 0x7E
106#define MAX8907C_REG_CHG_IRQ2 0x7F
107#define MAX8907C_REG_CHG_IRQ1_MASK 0x80
108#define MAX8907C_REG_CHG_IRQ2_MASK 0x81
109#define MAX8907C_REG_CHG_STAT 0x82
110#define MAX8907C_REG_WLED_MODE_CNTL 0x84
111#define MAX8907C_REG_ILED_CNTL 0x84
112#define MAX8907C_REG_II1RR 0x8E
113#define MAX8907C_REG_II2RR 0x8F
114#define MAX8907C_REG_LDOCTL20 0x9C
115#define MAX8907C_REG_LDOSEQCNT20 0x9D
116#define MAX8907C_REG_LDO20VOUT 0x9E
117
118/* RTC register */
119#define MAX8907C_REG_RTC_SEC 0x00
120#define MAX8907C_REG_RTC_MIN 0x01
121#define MAX8907C_REG_RTC_HOURS 0x02
122#define MAX8907C_REG_RTC_WEEKDAY 0x03
123#define MAX8907C_REG_RTC_DATE 0x04
124#define MAX8907C_REG_RTC_MONTH 0x05
125#define MAX8907C_REG_RTC_YEAR1 0x06
126#define MAX8907C_REG_RTC_YEAR2 0x07
127#define MAX8907C_REG_ALARM0_SEC 0x08
128#define MAX8907C_REG_ALARM0_MIN 0x09
129#define MAX8907C_REG_ALARM0_HOURS 0x0A
130#define MAX8907C_REG_ALARM0_WEEKDAY 0x0B
131#define MAX8907C_REG_ALARM0_DATE 0x0C
132#define MAX8907C_REG_ALARM0_MONTH 0x0D
133#define MAX8907C_REG_ALARM0_YEAR1 0x0E
134#define MAX8907C_REG_ALARM0_YEAR2 0x0F
135#define MAX8907C_REG_ALARM1_SEC 0x10
136#define MAX8907C_REG_ALARM1_MIN 0x11
137#define MAX8907C_REG_ALARM1_HOURS 0x12
138#define MAX8907C_REG_ALARM1_WEEKDAY 0x13
139#define MAX8907C_REG_ALARM1_DATE 0x14
140#define MAX8907C_REG_ALARM1_MONTH 0x15
141#define MAX8907C_REG_ALARM1_YEAR1 0x16
142#define MAX8907C_REG_ALARM1_YEAR2 0x17
143#define MAX8907C_REG_ALARM0_CNTL 0x18
144#define MAX8907C_REG_ALARM1_CNTL 0x19
145#define MAX8907C_REG_RTC_STATUS 0x1A
146#define MAX8907C_REG_RTC_CNTL 0x1B
147#define MAX8907C_REG_RTC_IRQ 0x1C
148#define MAX8907C_REG_RTC_IRQ_MASK 0x1D
149#define MAX8907C_REG_MPL_CNTL 0x1E
150
151/* ADC and Touch Screen Controller register map */
152
153#define MAX8907C_CTL 0
154#define MAX8907C_SEQCNT 1
155#define MAX8907C_VOUT 2
156
157/* mask bit fields */
158#define MAX8907C_MASK_LDO_SEQ 0x1C
159#define MAX8907C_MASK_LDO_EN 0x01
160#define MAX8907C_MASK_VBBATTCV 0x03
161#define MAX8907C_MASK_OUT5V_VINEN 0x10
162#define MAX8907C_MASK_OUT5V_ENSRC 0x0E
163#define MAX8907C_MASK_OUT5V_EN 0x01
164
165/* Power off bit in RESET_CNFG reg */
166#define MAX8907C_MASK_POWER_OFF 0x40
167
168#define MAX8907C_MASK_PWR_EN 0x80
169#define MAX8907C_MASK_CTL_SEQ 0x1C
170
171#define MAX8907C_PWR_EN 0x80
172#define MAX8907C_CTL_SEQ 0x04
173
174#define MAX8907C_SD_SEQ1 0x02
175#define MAX8907C_SD_SEQ2 0x06
176
177#define MAX8907C_DELAY_CNT0 0x00
178
179#define MAX8907C_POWER_UP_DELAY_CNT1 0x10
180#define MAX8907C_POWER_UP_DELAY_CNT12 0xC0
181
182#define MAX8907C_POWER_DOWN_DELAY_CNT12 0x0C
183
184#define RTC_I2C_ADDR 0x68
185
186/*
187 * MAX8907B revision requires s/w WAR to connect PWREN input to
188 * sequencer 2 because of the bug in the silicon.
189 */
190#define MAX8907B_II2RR_PWREN_WAR (0x12)
191
192/* Defines common for all supplies PWREN sequencer selection */
193#define MAX8907B_SEQSEL_PWREN_LXX 1 /* SEQ2 (PWREN) */
194
195/* IRQ definitions */
196enum {
197 MAX8907C_IRQ_VCHG_DC_OVP,
198 MAX8907C_IRQ_VCHG_DC_F,
199 MAX8907C_IRQ_VCHG_DC_R,
200 MAX8907C_IRQ_VCHG_THM_OK_R,
201 MAX8907C_IRQ_VCHG_THM_OK_F,
202 MAX8907C_IRQ_VCHG_MBATTLOW_F,
203 MAX8907C_IRQ_VCHG_MBATTLOW_R,
204 MAX8907C_IRQ_VCHG_RST,
205 MAX8907C_IRQ_VCHG_DONE,
206 MAX8907C_IRQ_VCHG_TOPOFF,
207 MAX8907C_IRQ_VCHG_TMR_FAULT,
208 MAX8907C_IRQ_GPM_RSTIN,
209 MAX8907C_IRQ_GPM_MPL,
210 MAX8907C_IRQ_GPM_SW_3SEC,
211 MAX8907C_IRQ_GPM_EXTON_F,
212 MAX8907C_IRQ_GPM_EXTON_R,
213 MAX8907C_IRQ_GPM_SW_1SEC,
214 MAX8907C_IRQ_GPM_SW_F,
215 MAX8907C_IRQ_GPM_SW_R,
216 MAX8907C_IRQ_GPM_SYSCKEN_F,
217 MAX8907C_IRQ_GPM_SYSCKEN_R,
218 MAX8907C_IRQ_RTC_ALARM1,
219 MAX8907C_IRQ_RTC_ALARM0,
220 MAX8907C_NR_IRQS,
221};
222
223struct max8907c {
224 struct device *dev;
225 struct mutex io_lock;
226 struct mutex irq_lock;
227 struct i2c_client *i2c_power;
228 struct i2c_client *i2c_rtc;
229 int irq_base;
230 int core_irq;
231
232 unsigned char cache_chg[2];
233 unsigned char cache_on[2];
234 unsigned char cache_rtc;
235
236};
237
238struct max8907c_platform_data {
239 int num_subdevs;
240 struct platform_device **subdevs;
241 int irq_base;
242 int (*max8907c_setup)(void);
243 bool use_power_off;
244};
245
246int max8907c_reg_read(struct i2c_client *i2c, u8 reg);
247int max8907c_reg_bulk_read(struct i2c_client *i2c, u8 reg, u8 count, u8 *val);
248int max8907c_reg_write(struct i2c_client *i2c, u8 reg, u8 val);
249int max8907c_reg_bulk_write(struct i2c_client *i2c, u8 reg, u8 count, u8 *val);
250int max8907c_set_bits(struct i2c_client *i2c, u8 reg, u8 mask, u8 val);
251
252int max8907c_irq_init(struct max8907c *chip, int irq, int irq_base);
253void max8907c_irq_free(struct max8907c *chip);
254int max8907c_suspend(struct i2c_client *i2c, pm_message_t state);
255int max8907c_resume(struct i2c_client *i2c);
256void max8907c_deep_sleep(int enter);
257int max8907c_pwr_en_config(void);
258int max8907c_pwr_en_attach(void);
259#endif
diff --git a/include/linux/mfd/max8997.h b/include/linux/mfd/max8997.h
index 60931d08942..0bbd13dbe33 100644
--- a/include/linux/mfd/max8997.h
+++ b/include/linux/mfd/max8997.h
@@ -107,11 +107,16 @@ struct max8997_platform_data {
107 unsigned int buck5_voltage[8]; 107 unsigned int buck5_voltage[8];
108 bool buck5_gpiodvs; 108 bool buck5_gpiodvs;
109 109
110 /* ---- Charger control ---- */
111 /* eoc stands for 'end of charge' */
112 int eoc_mA; /* 50 ~ 200mA by 10mA step */
113 /* charge Full Timeout */
114 int timeout; /* 0 (no timeout), 5, 6, 7 hours */
115
110 /* MUIC: Not implemented */ 116 /* MUIC: Not implemented */
111 /* HAPTIC: Not implemented */ 117 /* HAPTIC: Not implemented */
112 /* RTC: Not implemented */ 118 /* RTC: Not implemented */
113 /* Flash: Not implemented */ 119 /* Flash: Not implemented */
114 /* Charger control: Not implemented */
115}; 120};
116 121
117#endif /* __LINUX_MFD_MAX8998_H */ 122#endif /* __LINUX_MFD_MAX8998_H */
diff --git a/include/linux/mfd/max8998.h b/include/linux/mfd/max8998.h
index 61daa167b57..f4f0dfa4698 100644
--- a/include/linux/mfd/max8998.h
+++ b/include/linux/mfd/max8998.h
@@ -87,6 +87,15 @@ struct max8998_regulator_data {
87 * @wakeup: Allow to wake up from suspend 87 * @wakeup: Allow to wake up from suspend
88 * @rtc_delay: LP3974 RTC chip bug that requires delay after a register 88 * @rtc_delay: LP3974 RTC chip bug that requires delay after a register
89 * write before reading it. 89 * write before reading it.
90 * @eoc: End of Charge Level in percent: 10% ~ 45% by 5% step
91 * If it equals 0, leave it unchanged.
92 * Otherwise, it is a invalid value.
93 * @restart: Restart Level in mV: 100, 150, 200, and -1 for disable.
94 * If it equals 0, leave it unchanged.
95 * Otherwise, it is a invalid value.
96 * @timeout: Full Timeout in hours: 5, 6, 7, and -1 for disable.
97 * If it equals 0, leave it unchanged.
98 * Otherwise, leave it unchanged.
90 */ 99 */
91struct max8998_platform_data { 100struct max8998_platform_data {
92 struct max8998_regulator_data *regulators; 101 struct max8998_regulator_data *regulators;
@@ -107,6 +116,9 @@ struct max8998_platform_data {
107 int buck2_default_idx; 116 int buck2_default_idx;
108 bool wakeup; 117 bool wakeup;
109 bool rtc_delay; 118 bool rtc_delay;
119 int eoc;
120 int restart;
121 int timeout;
110}; 122};
111 123
112#endif /* __LINUX_MFD_MAX8998_H */ 124#endif /* __LINUX_MFD_MAX8998_H */
diff --git a/include/linux/mfd/pm8xxx/rtc.h b/include/linux/mfd/pm8xxx/rtc.h
new file mode 100644
index 00000000000..14f1983eaec
--- /dev/null
+++ b/include/linux/mfd/pm8xxx/rtc.h
@@ -0,0 +1,25 @@
1/* Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 */
12
13#ifndef __RTC_PM8XXX_H__
14#define __RTC_PM8XXX_H__
15
16#define PM8XXX_RTC_DEV_NAME "rtc-pm8xxx"
17/**
18 * struct pm8xxx_rtc_pdata - RTC driver platform data
19 * @rtc_write_enable: variable stating RTC write capability
20 */
21struct pm8xxx_rtc_platform_data {
22 bool rtc_write_enable;
23};
24
25#endif /* __RTC_PM8XXX_H__ */
diff --git a/include/linux/mfd/rc5t583.h b/include/linux/mfd/rc5t583.h
new file mode 100644
index 00000000000..a2c61609d21
--- /dev/null
+++ b/include/linux/mfd/rc5t583.h
@@ -0,0 +1,295 @@
1/*
2 * Core driver interface to access RICOH_RC5T583 power management chip.
3 *
4 * Copyright (c) 2011-2012, NVIDIA CORPORATION. All rights reserved.
5 * Author: Laxman dewangan <ldewangan@nvidia.com>
6 *
7 * Based on code
8 * Copyright (C) 2011 RICOH COMPANY,LTD
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms and conditions of the GNU General Public License,
12 * version 2, as published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
17 * more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21 *
22 */
23
24#ifndef __LINUX_MFD_RC5T583_H
25#define __LINUX_MFD_RC5T583_H
26
27#include <linux/mutex.h>
28#include <linux/types.h>
29
30#define RC5T583_MAX_REGS 0xF8
31
32/* Maximum number of main interrupts */
33#define MAX_MAIN_INTERRUPT 5
34#define RC5T583_MAX_GPEDGE_REG 2
35#define RC5T583_MAX_INTERRUPT_MASK_REGS 9
36
37/* Interrupt enable register */
38#define RC5T583_INT_EN_SYS1 0x19
39#define RC5T583_INT_EN_SYS2 0x1D
40#define RC5T583_INT_EN_DCDC 0x41
41#define RC5T583_INT_EN_RTC 0xED
42#define RC5T583_INT_EN_ADC1 0x90
43#define RC5T583_INT_EN_ADC2 0x91
44#define RC5T583_INT_EN_ADC3 0x92
45
46/* Interrupt status registers (monitor regs in Ricoh)*/
47#define RC5T583_INTC_INTPOL 0xAD
48#define RC5T583_INTC_INTEN 0xAE
49#define RC5T583_INTC_INTMON 0xAF
50
51#define RC5T583_INT_MON_GRP 0xAF
52#define RC5T583_INT_MON_SYS1 0x1B
53#define RC5T583_INT_MON_SYS2 0x1F
54#define RC5T583_INT_MON_DCDC 0x43
55#define RC5T583_INT_MON_RTC 0xEE
56
57/* Interrupt clearing registers */
58#define RC5T583_INT_IR_SYS1 0x1A
59#define RC5T583_INT_IR_SYS2 0x1E
60#define RC5T583_INT_IR_DCDC 0x42
61#define RC5T583_INT_IR_RTC 0xEE
62#define RC5T583_INT_IR_ADCL 0x94
63#define RC5T583_INT_IR_ADCH 0x95
64#define RC5T583_INT_IR_ADCEND 0x96
65#define RC5T583_INT_IR_GPIOR 0xA9
66#define RC5T583_INT_IR_GPIOF 0xAA
67
68/* Sleep sequence registers */
69#define RC5T583_SLPSEQ1 0x21
70#define RC5T583_SLPSEQ2 0x22
71#define RC5T583_SLPSEQ3 0x23
72#define RC5T583_SLPSEQ4 0x24
73#define RC5T583_SLPSEQ5 0x25
74#define RC5T583_SLPSEQ6 0x26
75#define RC5T583_SLPSEQ7 0x27
76#define RC5T583_SLPSEQ8 0x28
77#define RC5T583_SLPSEQ9 0x29
78#define RC5T583_SLPSEQ10 0x2A
79#define RC5T583_SLPSEQ11 0x2B
80
81/* Regulator registers */
82#define RC5T583_REG_DC0CTL 0x30
83#define RC5T583_REG_DC0DAC 0x31
84#define RC5T583_REG_DC0LATCTL 0x32
85#define RC5T583_REG_SR0CTL 0x33
86
87#define RC5T583_REG_DC1CTL 0x34
88#define RC5T583_REG_DC1DAC 0x35
89#define RC5T583_REG_DC1LATCTL 0x36
90#define RC5T583_REG_SR1CTL 0x37
91
92#define RC5T583_REG_DC2CTL 0x38
93#define RC5T583_REG_DC2DAC 0x39
94#define RC5T583_REG_DC2LATCTL 0x3A
95#define RC5T583_REG_SR2CTL 0x3B
96
97#define RC5T583_REG_DC3CTL 0x3C
98#define RC5T583_REG_DC3DAC 0x3D
99#define RC5T583_REG_DC3LATCTL 0x3E
100#define RC5T583_REG_SR3CTL 0x3F
101
102
103#define RC5T583_REG_LDOEN1 0x50
104#define RC5T583_REG_LDOEN2 0x51
105#define RC5T583_REG_LDODIS1 0x52
106#define RC5T583_REG_LDODIS2 0x53
107
108#define RC5T583_REG_LDO0DAC 0x54
109#define RC5T583_REG_LDO1DAC 0x55
110#define RC5T583_REG_LDO2DAC 0x56
111#define RC5T583_REG_LDO3DAC 0x57
112#define RC5T583_REG_LDO4DAC 0x58
113#define RC5T583_REG_LDO5DAC 0x59
114#define RC5T583_REG_LDO6DAC 0x5A
115#define RC5T583_REG_LDO7DAC 0x5B
116#define RC5T583_REG_LDO8DAC 0x5C
117#define RC5T583_REG_LDO9DAC 0x5D
118
119#define RC5T583_REG_DC0DAC_DS 0x60
120#define RC5T583_REG_DC1DAC_DS 0x61
121#define RC5T583_REG_DC2DAC_DS 0x62
122#define RC5T583_REG_DC3DAC_DS 0x63
123
124#define RC5T583_REG_LDO0DAC_DS 0x64
125#define RC5T583_REG_LDO1DAC_DS 0x65
126#define RC5T583_REG_LDO2DAC_DS 0x66
127#define RC5T583_REG_LDO3DAC_DS 0x67
128#define RC5T583_REG_LDO4DAC_DS 0x68
129#define RC5T583_REG_LDO5DAC_DS 0x69
130#define RC5T583_REG_LDO6DAC_DS 0x6A
131#define RC5T583_REG_LDO7DAC_DS 0x6B
132#define RC5T583_REG_LDO8DAC_DS 0x6C
133#define RC5T583_REG_LDO9DAC_DS 0x6D
134
135/* GPIO register base address */
136#define RC5T583_GPIO_IOSEL 0xA0
137#define RC5T583_GPIO_PDEN 0xA1
138#define RC5T583_GPIO_IOOUT 0xA2
139#define RC5T583_GPIO_PGSEL 0xA3
140#define RC5T583_GPIO_GPINV 0xA4
141#define RC5T583_GPIO_GPDEB 0xA5
142#define RC5T583_GPIO_GPEDGE1 0xA6
143#define RC5T583_GPIO_GPEDGE2 0xA7
144#define RC5T583_GPIO_EN_INT 0xA8
145#define RC5T583_GPIO_MON_IOIN 0xAB
146#define RC5T583_GPIO_GPOFUNC 0xAC
147
148/* RICOH_RC5T583 IRQ definitions */
149enum {
150 RC5T583_IRQ_ONKEY,
151 RC5T583_IRQ_ACOK,
152 RC5T583_IRQ_LIDOPEN,
153 RC5T583_IRQ_PREOT,
154 RC5T583_IRQ_CLKSTP,
155 RC5T583_IRQ_ONKEY_OFF,
156 RC5T583_IRQ_WD,
157 RC5T583_IRQ_EN_PWRREQ1,
158 RC5T583_IRQ_EN_PWRREQ2,
159 RC5T583_IRQ_PRE_VINDET,
160
161 RC5T583_IRQ_DC0LIM,
162 RC5T583_IRQ_DC1LIM,
163 RC5T583_IRQ_DC2LIM,
164 RC5T583_IRQ_DC3LIM,
165
166 RC5T583_IRQ_CTC,
167 RC5T583_IRQ_YALE,
168 RC5T583_IRQ_DALE,
169 RC5T583_IRQ_WALE,
170
171 RC5T583_IRQ_AIN1L,
172 RC5T583_IRQ_AIN2L,
173 RC5T583_IRQ_AIN3L,
174 RC5T583_IRQ_VBATL,
175 RC5T583_IRQ_VIN3L,
176 RC5T583_IRQ_VIN8L,
177 RC5T583_IRQ_AIN1H,
178 RC5T583_IRQ_AIN2H,
179 RC5T583_IRQ_AIN3H,
180 RC5T583_IRQ_VBATH,
181 RC5T583_IRQ_VIN3H,
182 RC5T583_IRQ_VIN8H,
183 RC5T583_IRQ_ADCEND,
184
185 RC5T583_IRQ_GPIO0,
186 RC5T583_IRQ_GPIO1,
187 RC5T583_IRQ_GPIO2,
188 RC5T583_IRQ_GPIO3,
189 RC5T583_IRQ_GPIO4,
190 RC5T583_IRQ_GPIO5,
191 RC5T583_IRQ_GPIO6,
192 RC5T583_IRQ_GPIO7,
193
194 /* Should be last entry */
195 RC5T583_MAX_IRQS,
196};
197
198/* Ricoh583 gpio definitions */
199enum {
200 RC5T583_GPIO0,
201 RC5T583_GPIO1,
202 RC5T583_GPIO2,
203 RC5T583_GPIO3,
204 RC5T583_GPIO4,
205 RC5T583_GPIO5,
206 RC5T583_GPIO6,
207 RC5T583_GPIO7,
208
209 /* Should be last entry */
210 RC5T583_MAX_GPIO,
211};
212
213enum {
214 RC5T583_DS_NONE,
215 RC5T583_DS_DC0,
216 RC5T583_DS_DC1,
217 RC5T583_DS_DC2,
218 RC5T583_DS_DC3,
219 RC5T583_DS_LDO0,
220 RC5T583_DS_LDO1,
221 RC5T583_DS_LDO2,
222 RC5T583_DS_LDO3,
223 RC5T583_DS_LDO4,
224 RC5T583_DS_LDO5,
225 RC5T583_DS_LDO6,
226 RC5T583_DS_LDO7,
227 RC5T583_DS_LDO8,
228 RC5T583_DS_LDO9,
229 RC5T583_DS_PSO0,
230 RC5T583_DS_PSO1,
231 RC5T583_DS_PSO2,
232 RC5T583_DS_PSO3,
233 RC5T583_DS_PSO4,
234 RC5T583_DS_PSO5,
235 RC5T583_DS_PSO6,
236 RC5T583_DS_PSO7,
237
238 /* Should be last entry */
239 RC5T583_DS_MAX,
240};
241
242/*
243 * Ricoh pmic RC5T583 supports sleep through two external controls.
244 * The output of gpios and regulator can be enable/disable through
245 * this external signals.
246 */
247enum {
248 RC5T583_EXT_PWRREQ1_CONTROL = 0x1,
249 RC5T583_EXT_PWRREQ2_CONTROL = 0x2,
250};
251
252struct rc5t583 {
253 struct device *dev;
254 struct regmap *regmap;
255 int chip_irq;
256 int irq_base;
257 struct mutex irq_lock;
258 unsigned long group_irq_en[MAX_MAIN_INTERRUPT];
259
260 /* For main interrupt bits in INTC */
261 uint8_t intc_inten_reg;
262
263 /* For group interrupt bits and address */
264 uint8_t irq_en_reg[RC5T583_MAX_INTERRUPT_MASK_REGS];
265
266 /* For gpio edge */
267 uint8_t gpedge_reg[RC5T583_MAX_GPEDGE_REG];
268};
269
270/*
271 * rc5t583_platform_data: Platform data for ricoh rc5t583 pmu.
272 * The board specific data is provided through this structure.
273 * @irq_base: Irq base number on which this device registers their interrupts.
274 * @enable_shutdown: Enable shutdown through the input pin "shutdown".
275 */
276
277struct rc5t583_platform_data {
278 int irq_base;
279 bool enable_shutdown;
280};
281
282int rc5t583_write(struct device *dev, u8 reg, uint8_t val);
283int rc5t583_read(struct device *dev, uint8_t reg, uint8_t *val);
284int rc5t583_set_bits(struct device *dev, unsigned int reg,
285 unsigned int bit_mask);
286int rc5t583_clear_bits(struct device *dev, unsigned int reg,
287 unsigned int bit_mask);
288int rc5t583_update(struct device *dev, unsigned int reg,
289 unsigned int val, unsigned int mask);
290int rc5t583_ext_power_req_config(struct device *dev, int deepsleep_id,
291 int ext_pwr_req, int deepsleep_slot_nr);
292int rc5t583_irq_init(struct rc5t583 *rc5t583, int irq, int irq_base);
293int rc5t583_irq_exit(struct rc5t583 *rc5t583);
294
295#endif
diff --git a/include/linux/mfd/ricoh583.h b/include/linux/mfd/ricoh583.h
new file mode 100644
index 00000000000..4e38cded0fa
--- /dev/null
+++ b/include/linux/mfd/ricoh583.h
@@ -0,0 +1,164 @@
1/* include/linux/mfd/ricoh583.h
2 *
3 * Core driver interface to access RICOH583 power management chip.
4 *
5 * Copyright (C) 2011 NVIDIA Corporation
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 * more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 *
21 */
22
23#ifndef __LINUX_MFD_RICOH583_H
24#define __LINUX_MFD_RICOH583_H
25
26#include <linux/rtc.h>
27/* RICOH583 IRQ definitions */
28enum {
29 RICOH583_IRQ_ONKEY,
30 RICOH583_IRQ_ACOK,
31 RICOH583_IRQ_LIDOPEN,
32 RICOH583_IRQ_PREOT,
33 RICOH583_IRQ_CLKSTP,
34 RICOH583_IRQ_ONKEY_OFF,
35 RICOH583_IRQ_WD,
36 RICOH583_IRQ_EN_PWRREQ1,
37 RICOH583_IRQ_EN_PWRREQ2,
38 RICOH583_IRQ_PRE_VINDET,
39
40 RICOH583_IRQ_DC0LIM,
41 RICOH583_IRQ_DC1LIM,
42 RICOH583_IRQ_DC2LIM,
43 RICOH583_IRQ_DC3LIM,
44
45 RICOH583_IRQ_CTC,
46 RICOH583_IRQ_YALE,
47 RICOH583_IRQ_DALE,
48 RICOH583_IRQ_WALE,
49
50 RICOH583_IRQ_AIN1L,
51 RICOH583_IRQ_AIN2L,
52 RICOH583_IRQ_AIN3L,
53 RICOH583_IRQ_VBATL,
54 RICOH583_IRQ_VIN3L,
55 RICOH583_IRQ_VIN8L,
56 RICOH583_IRQ_AIN1H,
57 RICOH583_IRQ_AIN2H,
58 RICOH583_IRQ_AIN3H,
59 RICOH583_IRQ_VBATH,
60 RICOH583_IRQ_VIN3H,
61 RICOH583_IRQ_VIN8H,
62 RICOH583_IRQ_ADCEND,
63
64 RICOH583_IRQ_GPIO0,
65 RICOH583_IRQ_GPIO1,
66 RICOH583_IRQ_GPIO2,
67 RICOH583_IRQ_GPIO3,
68 RICOH583_IRQ_GPIO4,
69 RICOH583_IRQ_GPIO5,
70 RICOH583_IRQ_GPIO6,
71 RICOH583_IRQ_GPIO7,
72 RICOH583_NR_IRQS,
73};
74
75/* Ricoh583 gpio definitions */
76enum {
77 RICOH583_GPIO0,
78 RICOH583_GPIO1,
79 RICOH583_GPIO2,
80 RICOH583_GPIO3,
81 RICOH583_GPIO4,
82 RICOH583_GPIO5,
83 RICOH583_GPIO6,
84 RICOH583_GPIO7,
85
86 RICOH583_NR_GPIO,
87};
88
89enum ricoh583_deepsleep_control_id {
90 RICOH583_DS_NONE,
91 RICOH583_DS_DC0,
92 RICOH583_DS_DC1,
93 RICOH583_DS_DC2,
94 RICOH583_DS_DC3,
95 RICOH583_DS_LDO0,
96 RICOH583_DS_LDO1,
97 RICOH583_DS_LDO2,
98 RICOH583_DS_LDO3,
99 RICOH583_DS_LDO4,
100 RICOH583_DS_LDO5,
101 RICOH583_DS_LDO6,
102 RICOH583_DS_LDO7,
103 RICOH583_DS_LDO8,
104 RICOH583_DS_LDO9,
105 RICOH583_DS_PSO0,
106 RICOH583_DS_PSO1,
107 RICOH583_DS_PSO2,
108 RICOH583_DS_PSO3,
109 RICOH583_DS_PSO4,
110 RICOH583_DS_PSO5,
111 RICOH583_DS_PSO6,
112 RICOH583_DS_PSO7,
113};
114enum ricoh583_ext_pwrreq_control {
115 RICOH583_EXT_PWRREQ1_CONTROL = 0x1,
116 RICOH583_EXT_PWRREQ2_CONTROL = 0x2,
117};
118
119struct ricoh583_subdev_info {
120 int id;
121 const char *name;
122 void *platform_data;
123};
124
125struct ricoh583_rtc_platform_data {
126 int irq;
127 struct rtc_time time;
128};
129
130struct ricoh583_gpio_init_data {
131 unsigned pulldn_en:1; /* Enable pull down */
132 unsigned output_mode_en:1; /* Enable output mode during init */
133 unsigned output_val:1; /* Output value if it is in output mode */
134 unsigned init_apply:1; /* Apply init data on configuring gpios*/
135};
136
137struct ricoh583_platform_data {
138 int num_subdevs;
139 struct ricoh583_subdev_info *subdevs;
140 int gpio_base;
141 int irq_base;
142
143 struct ricoh583_gpio_init_data *gpio_init_data;
144 int num_gpioinit_data;
145 bool enable_shutdown_pin;
146};
147
148extern int ricoh583_read(struct device *dev, uint8_t reg, uint8_t *val);
149extern int ricoh583_bulk_reads(struct device *dev, u8 reg, u8 count,
150 uint8_t *val);
151extern int ricoh583_write(struct device *dev, u8 reg, uint8_t val);
152extern int ricoh583_bulk_writes(struct device *dev, u8 reg, u8 count,
153 uint8_t *val);
154extern int ricoh583_set_bits(struct device *dev, u8 reg, uint8_t bit_mask);
155extern int ricoh583_clr_bits(struct device *dev, u8 reg, uint8_t bit_mask);
156extern int ricoh583_update(struct device *dev, u8 reg, uint8_t val,
157 uint8_t mask);
158extern int ricoh583_ext_power_req_config(struct device *dev,
159 enum ricoh583_deepsleep_control_id control_id,
160 enum ricoh583_ext_pwrreq_control ext_pwr_req,
161 int deepsleep_slot_nr);
162extern int ricoh583_power_off(void);
163
164#endif
diff --git a/include/linux/mfd/stmpe.h b/include/linux/mfd/stmpe.h
index e762c270d8d..be1af7c42e5 100644
--- a/include/linux/mfd/stmpe.h
+++ b/include/linux/mfd/stmpe.h
@@ -57,6 +57,7 @@ struct stmpe_variant_info;
57 * @irq_lock: IRQ bus lock 57 * @irq_lock: IRQ bus lock
58 * @dev: device, mostly for dev_dbg() 58 * @dev: device, mostly for dev_dbg()
59 * @i2c: i2c client 59 * @i2c: i2c client
60 * @partnum: part number
60 * @variant: the detected STMPE model number 61 * @variant: the detected STMPE model number
61 * @regs: list of addresses of registers which are at different addresses on 62 * @regs: list of addresses of registers which are at different addresses on
62 * different variants. Indexed by one of STMPE_IDX_*. 63 * different variants. Indexed by one of STMPE_IDX_*.
@@ -121,6 +122,8 @@ struct stmpe_keypad_platform_data {
121 * @norequest_mask: bitmask specifying which GPIOs should _not_ be 122 * @norequest_mask: bitmask specifying which GPIOs should _not_ be
122 * requestable due to different usage (e.g. touch, keypad) 123 * requestable due to different usage (e.g. touch, keypad)
123 * STMPE_GPIO_NOREQ_* macros can be used here. 124 * STMPE_GPIO_NOREQ_* macros can be used here.
125 * @setup: board specific setup callback.
126 * @remove: board specific remove callback
124 */ 127 */
125struct stmpe_gpio_platform_data { 128struct stmpe_gpio_platform_data {
126 int gpio_base; 129 int gpio_base;
diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
index 5a90266c3a5..0dc98044d8b 100644
--- a/include/linux/mfd/tmio.h
+++ b/include/linux/mfd/tmio.h
@@ -68,6 +68,11 @@
68 * controller and report the event to the driver. 68 * controller and report the event to the driver.
69 */ 69 */
70#define TMIO_MMC_HAS_COLD_CD (1 << 3) 70#define TMIO_MMC_HAS_COLD_CD (1 << 3)
71/*
72 * Some controllers require waiting for the SD bus to become
73 * idle before writing to some registers.
74 */
75#define TMIO_MMC_HAS_IDLE_WAIT (1 << 4)
71 76
72int tmio_core_mmc_enable(void __iomem *cnf, int shift, unsigned long base); 77int tmio_core_mmc_enable(void __iomem *cnf, int shift, unsigned long base);
73int tmio_core_mmc_resume(void __iomem *cnf, int shift, unsigned long base); 78int tmio_core_mmc_resume(void __iomem *cnf, int shift, unsigned long base);
@@ -80,6 +85,8 @@ struct tmio_mmc_dma {
80 int alignment_shift; 85 int alignment_shift;
81}; 86};
82 87
88struct tmio_mmc_host;
89
83/* 90/*
84 * data for the MMC controller 91 * data for the MMC controller
85 */ 92 */
@@ -94,6 +101,7 @@ struct tmio_mmc_data {
94 void (*set_pwr)(struct platform_device *host, int state); 101 void (*set_pwr)(struct platform_device *host, int state);
95 void (*set_clk_div)(struct platform_device *host, int state); 102 void (*set_clk_div)(struct platform_device *host, int state);
96 int (*get_cd)(struct platform_device *host); 103 int (*get_cd)(struct platform_device *host);
104 int (*write16_hook)(struct tmio_mmc_host *host, int addr);
97}; 105};
98 106
99static inline void tmio_mmc_cd_wakeup(struct tmio_mmc_data *pdata) 107static inline void tmio_mmc_cd_wakeup(struct tmio_mmc_data *pdata)
diff --git a/include/linux/mfd/tps65090.h b/include/linux/mfd/tps65090.h
new file mode 100644
index 00000000000..511ced59ef1
--- /dev/null
+++ b/include/linux/mfd/tps65090.h
@@ -0,0 +1,53 @@
1/*
2 * include/linux/mfd/tps65090.h
3 * Core driver interface for TI TPS65090 PMIC family
4 *
5 * Copyright (C) 2012 NVIDIA Corporation
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 * more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 *
21 */
22
23#ifndef __LINUX_MFD_TPS65090_H
24#define __LINUX_MFD_TPS65090_H
25
26#include <linux/rtc.h>
27
28struct tps65090_subdev_info {
29 int id;
30 const char *name;
31 void *platform_data;
32};
33
34struct tps65090_platform_data {
35 int irq_base;
36 int num_subdevs;
37 struct tps65090_subdev_info *subdevs;
38};
39
40/*
41 * NOTE: the functions below are not intended for use outside
42 * of the TPS65090 sub-device drivers
43 */
44extern int tps65090_write(struct device *dev, int reg, uint8_t val);
45extern int tps65090_writes(struct device *dev, int reg, int len, uint8_t *val);
46extern int tps65090_read(struct device *dev, int reg, uint8_t *val);
47extern int tps65090_reads(struct device *dev, int reg, int len, uint8_t *val);
48extern int tps65090_set_bits(struct device *dev, int reg, uint8_t bit_num);
49extern int tps65090_clr_bits(struct device *dev, int reg, uint8_t bit_num);
50extern int tps65090_update(struct device *dev, int reg, uint8_t val,
51 uint8_t bit_num);
52
53#endif /*__LINUX_MFD_TPS65090_H */
diff --git a/include/linux/mfd/tps6586x.h b/include/linux/mfd/tps6586x.h
index b6bab1b04e2..702cee59cc7 100644
--- a/include/linux/mfd/tps6586x.h
+++ b/include/linux/mfd/tps6586x.h
@@ -1,6 +1,10 @@
1#ifndef __LINUX_MFD_TPS6586X_H 1#ifndef __LINUX_MFD_TPS6586X_H
2#define __LINUX_MFD_TPS6586X_H 2#define __LINUX_MFD_TPS6586X_H
3 3
4#define SM0_PWM_BIT 0
5#define SM1_PWM_BIT 1
6#define SM2_PWM_BIT 2
7
4enum { 8enum {
5 TPS6586X_ID_SM_0, 9 TPS6586X_ID_SM_0,
6 TPS6586X_ID_SM_1, 10 TPS6586X_ID_SM_1,
@@ -48,18 +52,68 @@ enum {
48 TPS6586X_INT_RTC_ALM2, 52 TPS6586X_INT_RTC_ALM2,
49}; 53};
50 54
55enum pwm_pfm_mode {
56 PWM_ONLY,
57 AUTO_PWM_PFM,
58 PWM_DEFAULT_VALUE,
59
60};
61
62enum slew_rate_settings {
63 SLEW_RATE_INSTANTLY = 0,
64 SLEW_RATE_0110UV_PER_SEC = 0x1,
65 SLEW_RATE_0220UV_PER_SEC = 0x2,
66 SLEW_RATE_0440UV_PER_SEC = 0x3,
67 SLEW_RATE_0880UV_PER_SEC = 0x4,
68 SLEW_RATE_1760UV_PER_SEC = 0x5,
69 SLEW_RATE_3520UV_PER_SEC = 0x6,
70 SLEW_RATE_7040UV_PER_SEC = 0x7,
71 SLEW_RATE_DEFAULT_VALUE,
72};
73
74struct tps6586x_settings {
75 /* SM0, SM1 and SM2 have PWM-only and auto PWM/PFM mode */
76 enum pwm_pfm_mode sm_pwm_mode;
77 /* SM0 and SM1 have slew rate settings */
78 enum slew_rate_settings slew_rate;
79};
80
81enum {
82 TPS6586X_RTC_CL_SEL_1_5PF = 0x0,
83 TPS6586X_RTC_CL_SEL_6_5PF = 0x1,
84 TPS6586X_RTC_CL_SEL_7_5PF = 0x2,
85 TPS6586X_RTC_CL_SEL_12_5PF = 0x3,
86};
87
51struct tps6586x_subdev_info { 88struct tps6586x_subdev_info {
52 int id; 89 int id;
53 const char *name; 90 const char *name;
54 void *platform_data; 91 void *platform_data;
55}; 92};
56 93
94struct tps6586x_epoch_start {
95 int year;
96 int month;
97 int day;
98 int hour;
99 int min;
100 int sec;
101};
102
103struct tps6586x_rtc_platform_data {
104 int irq;
105 struct tps6586x_epoch_start start;
106 int cl_sel; /* internal XTAL capacitance, see TPS6586X_RTC_CL_SEL* */
107};
108
57struct tps6586x_platform_data { 109struct tps6586x_platform_data {
58 int num_subdevs; 110 int num_subdevs;
59 struct tps6586x_subdev_info *subdevs; 111 struct tps6586x_subdev_info *subdevs;
60 112
61 int gpio_base; 113 int gpio_base;
62 int irq_base; 114 int irq_base;
115
116 bool use_power_off;
63}; 117};
64 118
65/* 119/*
diff --git a/include/linux/mfd/tps65910.h b/include/linux/mfd/tps65910.h
index 8bb85b930c0..f6021cc9d91 100644
--- a/include/linux/mfd/tps65910.h
+++ b/include/linux/mfd/tps65910.h
@@ -243,7 +243,8 @@
243 243
244 244
245/*Registers VDD1, VDD2 voltage values definitions */ 245/*Registers VDD1, VDD2 voltage values definitions */
246#define VDD1_2_NUM_VOLTS 73 246#define VDD1_2_NUM_VOLT_FINE 73
247#define VDD1_2_NUM_VOLT_COARSE 3
247#define VDD1_2_MIN_VOLT 6000 248#define VDD1_2_MIN_VOLT 6000
248#define VDD1_2_OFFSET 125 249#define VDD1_2_OFFSET 125
249 250
@@ -269,7 +270,7 @@
269#define LDO1_SEL_MASK 0xFC 270#define LDO1_SEL_MASK 0xFC
270#define LDO3_SEL_MASK 0x7C 271#define LDO3_SEL_MASK 0x7C
271#define LDO_MIN_VOLT 1000 272#define LDO_MIN_VOLT 1000
272#define LDO_MAX_VOLT 3300; 273#define LDO_MAX_VOLT 3300
273 274
274 275
275/*Register VDIG1 (0x80) register.RegisterDescription */ 276/*Register VDIG1 (0x80) register.RegisterDescription */
@@ -656,6 +657,8 @@
656 657
657 658
658/*Register GPIO (0x80) register.RegisterDescription */ 659/*Register GPIO (0x80) register.RegisterDescription */
660#define GPIO_SLEEP_MASK 0x80
661#define GPIO_SLEEP_SHIFT 7
659#define GPIO_DEB_MASK 0x10 662#define GPIO_DEB_MASK 0x10
660#define GPIO_DEB_SHIFT 4 663#define GPIO_DEB_SHIFT 4
661#define GPIO_PUEN_MASK 0x08 664#define GPIO_PUEN_MASK 0x08
@@ -739,6 +742,45 @@
739#define TPS65910_GPIO_STS BIT(1) 742#define TPS65910_GPIO_STS BIT(1)
740#define TPS65910_GPIO_SET BIT(0) 743#define TPS65910_GPIO_SET BIT(0)
741 744
745/* Max number of TPS65910/11 GPIOs */
746#define TPS65910_NUM_GPIO 6
747#define TPS65911_NUM_GPIO 9
748#define TPS6591X_MAX_NUM_GPIO 9
749
750/* Regulator Index Definitions */
751#define TPS65910_REG_VRTC 0
752#define TPS65910_REG_VIO 1
753#define TPS65910_REG_VDD1 2
754#define TPS65910_REG_VDD2 3
755#define TPS65910_REG_VDD3 4
756#define TPS65910_REG_VDIG1 5
757#define TPS65910_REG_VDIG2 6
758#define TPS65910_REG_VPLL 7
759#define TPS65910_REG_VDAC 8
760#define TPS65910_REG_VAUX1 9
761#define TPS65910_REG_VAUX2 10
762#define TPS65910_REG_VAUX33 11
763#define TPS65910_REG_VMMC 12
764
765#define TPS65911_REG_VDDCTRL 4
766#define TPS65911_REG_LDO1 5
767#define TPS65911_REG_LDO2 6
768#define TPS65911_REG_LDO3 7
769#define TPS65911_REG_LDO4 8
770#define TPS65911_REG_LDO5 9
771#define TPS65911_REG_LDO6 10
772#define TPS65911_REG_LDO7 11
773#define TPS65911_REG_LDO8 12
774
775/* Max number of TPS65910/11 regulators */
776#define TPS65910_NUM_REGS 13
777
778/* External sleep controls through EN1/EN2/EN3/SLEEP inputs */
779#define TPS65910_SLEEP_CONTROL_EXT_INPUT_EN1 0x1
780#define TPS65910_SLEEP_CONTROL_EXT_INPUT_EN2 0x2
781#define TPS65910_SLEEP_CONTROL_EXT_INPUT_EN3 0x4
782#define TPS65911_SLEEP_CONTROL_EXT_INPUT_SLEEP 0x8
783
742/** 784/**
743 * struct tps65910_board 785 * struct tps65910_board
744 * Board platform data may be used to initialize regulators. 786 * Board platform data may be used to initialize regulators.
@@ -750,7 +792,9 @@ struct tps65910_board {
750 int irq_base; 792 int irq_base;
751 int vmbch_threshold; 793 int vmbch_threshold;
752 int vmbch2_threshold; 794 int vmbch2_threshold;
753 struct regulator_init_data *tps65910_pmic_init_data; 795 unsigned long regulator_ext_sleep_control[TPS65910_NUM_REGS];
796 bool en_gpio_sleep[TPS6591X_MAX_NUM_GPIO];
797 struct regulator_init_data *tps65910_pmic_init_data[TPS65910_NUM_REGS];
754}; 798};
755 799
756/** 800/**
@@ -760,6 +804,7 @@ struct tps65910_board {
760struct tps65910 { 804struct tps65910 {
761 struct device *dev; 805 struct device *dev;
762 struct i2c_client *i2c_client; 806 struct i2c_client *i2c_client;
807 struct regmap *regmap;
763 struct mutex io_mutex; 808 struct mutex io_mutex;
764 unsigned int id; 809 unsigned int id;
765 int (*read)(struct tps65910 *tps65910, u8 reg, int size, void *dest); 810 int (*read)(struct tps65910 *tps65910, u8 reg, int size, void *dest);
@@ -791,6 +836,7 @@ int tps65910_clear_bits(struct tps65910 *tps65910, u8 reg, u8 mask);
791void tps65910_gpio_init(struct tps65910 *tps65910, int gpio_base); 836void tps65910_gpio_init(struct tps65910 *tps65910, int gpio_base);
792int tps65910_irq_init(struct tps65910 *tps65910, int irq, 837int tps65910_irq_init(struct tps65910 *tps65910, int irq,
793 struct tps65910_platform_data *pdata); 838 struct tps65910_platform_data *pdata);
839int tps65910_irq_exit(struct tps65910 *tps65910);
794 840
795static inline int tps65910_chip_id(struct tps65910 *tps65910) 841static inline int tps65910_chip_id(struct tps65910 *tps65910)
796{ 842{
diff --git a/include/linux/mfd/tps65912.h b/include/linux/mfd/tps65912.h
new file mode 100644
index 00000000000..aaceab402ec
--- /dev/null
+++ b/include/linux/mfd/tps65912.h
@@ -0,0 +1,327 @@
1/*
2 * tps65912.h -- TI TPS6591x
3 *
4 * Copyright 2011 Texas Instruments Inc.
5 *
6 * Author: Margarita Olaya <magi@slimlogic.co.uk>
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 *
13 */
14
15#ifndef __LINUX_MFD_TPS65912_H
16#define __LINUX_MFD_TPS65912_H
17
18/* TPS regulator type list */
19#define REGULATOR_LDO 0
20#define REGULATOR_DCDC 1
21
22/*
23 * List of registers for TPS65912
24 */
25
26#define TPS65912_DCDC1_CTRL 0x00
27#define TPS65912_DCDC2_CTRL 0x01
28#define TPS65912_DCDC3_CTRL 0x02
29#define TPS65912_DCDC4_CTRL 0x03
30#define TPS65912_DCDC1_OP 0x04
31#define TPS65912_DCDC1_AVS 0x05
32#define TPS65912_DCDC1_LIMIT 0x06
33#define TPS65912_DCDC2_OP 0x07
34#define TPS65912_DCDC2_AVS 0x08
35#define TPS65912_DCDC2_LIMIT 0x09
36#define TPS65912_DCDC3_OP 0x0A
37#define TPS65912_DCDC3_AVS 0x0B
38#define TPS65912_DCDC3_LIMIT 0x0C
39#define TPS65912_DCDC4_OP 0x0D
40#define TPS65912_DCDC4_AVS 0x0E
41#define TPS65912_DCDC4_LIMIT 0x0F
42#define TPS65912_LDO1_OP 0x10
43#define TPS65912_LDO1_AVS 0x11
44#define TPS65912_LDO1_LIMIT 0x12
45#define TPS65912_LDO2_OP 0x13
46#define TPS65912_LDO2_AVS 0x14
47#define TPS65912_LDO2_LIMIT 0x15
48#define TPS65912_LDO3_OP 0x16
49#define TPS65912_LDO3_AVS 0x17
50#define TPS65912_LDO3_LIMIT 0x18
51#define TPS65912_LDO4_OP 0x19
52#define TPS65912_LDO4_AVS 0x1A
53#define TPS65912_LDO4_LIMIT 0x1B
54#define TPS65912_LDO5 0x1C
55#define TPS65912_LDO6 0x1D
56#define TPS65912_LDO7 0x1E
57#define TPS65912_LDO8 0x1F
58#define TPS65912_LDO9 0x20
59#define TPS65912_LDO10 0x21
60#define TPS65912_THRM 0x22
61#define TPS65912_CLK32OUT 0x23
62#define TPS65912_DEVCTRL 0x24
63#define TPS65912_DEVCTRL2 0x25
64#define TPS65912_I2C_SPI_CFG 0x26
65#define TPS65912_KEEP_ON 0x27
66#define TPS65912_KEEP_ON2 0x28
67#define TPS65912_SET_OFF1 0x29
68#define TPS65912_SET_OFF2 0x2A
69#define TPS65912_DEF_VOLT 0x2B
70#define TPS65912_DEF_VOLT_MAPPING 0x2C
71#define TPS65912_DISCHARGE 0x2D
72#define TPS65912_DISCHARGE2 0x2E
73#define TPS65912_EN1_SET1 0x2F
74#define TPS65912_EN1_SET2 0x30
75#define TPS65912_EN2_SET1 0x31
76#define TPS65912_EN2_SET2 0x32
77#define TPS65912_EN3_SET1 0x33
78#define TPS65912_EN3_SET2 0x34
79#define TPS65912_EN4_SET1 0x35
80#define TPS65912_EN4_SET2 0x36
81#define TPS65912_PGOOD 0x37
82#define TPS65912_PGOOD2 0x38
83#define TPS65912_INT_STS 0x39
84#define TPS65912_INT_MSK 0x3A
85#define TPS65912_INT_STS2 0x3B
86#define TPS65912_INT_MSK2 0x3C
87#define TPS65912_INT_STS3 0x3D
88#define TPS65912_INT_MSK3 0x3E
89#define TPS65912_INT_STS4 0x3F
90#define TPS65912_INT_MSK4 0x40
91#define TPS65912_GPIO1 0x41
92#define TPS65912_GPIO2 0x42
93#define TPS65912_GPIO3 0x43
94#define TPS65912_GPIO4 0x44
95#define TPS65912_GPIO5 0x45
96#define TPS65912_VMON 0x46
97#define TPS65912_LEDA_CTRL1 0x47
98#define TPS65912_LEDA_CTRL2 0x48
99#define TPS65912_LEDA_CTRL3 0x49
100#define TPS65912_LEDA_CTRL4 0x4A
101#define TPS65912_LEDA_CTRL5 0x4B
102#define TPS65912_LEDA_CTRL6 0x4C
103#define TPS65912_LEDA_CTRL7 0x4D
104#define TPS65912_LEDA_CTRL8 0x4E
105#define TPS65912_LEDB_CTRL1 0x4F
106#define TPS65912_LEDB_CTRL2 0x50
107#define TPS65912_LEDB_CTRL3 0x51
108#define TPS65912_LEDB_CTRL4 0x52
109#define TPS65912_LEDB_CTRL5 0x53
110#define TPS65912_LEDB_CTRL6 0x54
111#define TPS65912_LEDB_CTRL7 0x55
112#define TPS65912_LEDB_CTRL8 0x56
113#define TPS65912_LEDC_CTRL1 0x57
114#define TPS65912_LEDC_CTRL2 0x58
115#define TPS65912_LEDC_CTRL3 0x59
116#define TPS65912_LEDC_CTRL4 0x5A
117#define TPS65912_LEDC_CTRL5 0x5B
118#define TPS65912_LEDC_CTRL6 0x5C
119#define TPS65912_LEDC_CTRL7 0x5D
120#define TPS65912_LEDC_CTRL8 0x5E
121#define TPS65912_LED_RAMP_UP_TIME 0x5F
122#define TPS65912_LED_RAMP_DOWN_TIME 0x60
123#define TPS65912_LED_SEQ_EN 0x61
124#define TPS65912_LOADSWITCH 0x62
125#define TPS65912_SPARE 0x63
126#define TPS65912_VERNUM 0x64
127#define TPS6591X_MAX_REGISTER 0x64
128
129/* IRQ Definitions */
130#define TPS65912_IRQ_PWRHOLD_F 0
131#define TPS65912_IRQ_VMON 1
132#define TPS65912_IRQ_PWRON 2
133#define TPS65912_IRQ_PWRON_LP 3
134#define TPS65912_IRQ_PWRHOLD_R 4
135#define TPS65912_IRQ_HOTDIE 5
136#define TPS65912_IRQ_GPIO1_R 6
137#define TPS65912_IRQ_GPIO1_F 7
138#define TPS65912_IRQ_GPIO2_R 8
139#define TPS65912_IRQ_GPIO2_F 9
140#define TPS65912_IRQ_GPIO3_R 10
141#define TPS65912_IRQ_GPIO3_F 11
142#define TPS65912_IRQ_GPIO4_R 12
143#define TPS65912_IRQ_GPIO4_F 13
144#define TPS65912_IRQ_GPIO5_R 14
145#define TPS65912_IRQ_GPIO5_F 15
146#define TPS65912_IRQ_PGOOD_DCDC1 16
147#define TPS65912_IRQ_PGOOD_DCDC2 17
148#define TPS65912_IRQ_PGOOD_DCDC3 18
149#define TPS65912_IRQ_PGOOD_DCDC4 19
150#define TPS65912_IRQ_PGOOD_LDO1 20
151#define TPS65912_IRQ_PGOOD_LDO2 21
152#define TPS65912_IRQ_PGOOD_LDO3 22
153#define TPS65912_IRQ_PGOOD_LDO4 23
154#define TPS65912_IRQ_PGOOD_LDO5 24
155#define TPS65912_IRQ_PGOOD_LDO6 25
156#define TPS65912_IRQ_PGOOD_LDO7 26
157#define TPS65912_IRQ_PGOOD_LD08 27
158#define TPS65912_IRQ_PGOOD_LDO9 28
159#define TPS65912_IRQ_PGOOD_LDO10 29
160
161#define TPS65912_NUM_IRQ 30
162
163/* GPIO 1 and 2 Register Definitions */
164#define GPIO_SLEEP_MASK 0x80
165#define GPIO_SLEEP_SHIFT 7
166#define GPIO_DEB_MASK 0x10
167#define GPIO_DEB_SHIFT 4
168#define GPIO_CFG_MASK 0x04
169#define GPIO_CFG_SHIFT 2
170#define GPIO_STS_MASK 0x02
171#define GPIO_STS_SHIFT 1
172#define GPIO_SET_MASK 0x01
173#define GPIO_SET_SHIFT 0
174
175/* GPIO 3 Register Definitions */
176#define GPIO3_SLEEP_MASK 0x80
177#define GPIO3_SLEEP_SHIFT 7
178#define GPIO3_SEL_MASK 0x40
179#define GPIO3_SEL_SHIFT 6
180#define GPIO3_ODEN_MASK 0x20
181#define GPIO3_ODEN_SHIFT 5
182#define GPIO3_DEB_MASK 0x10
183#define GPIO3_DEB_SHIFT 4
184#define GPIO3_PDEN_MASK 0x08
185#define GPIO3_PDEN_SHIFT 3
186#define GPIO3_CFG_MASK 0x04
187#define GPIO3_CFG_SHIFT 2
188#define GPIO3_STS_MASK 0x02
189#define GPIO3_STS_SHIFT 1
190#define GPIO3_SET_MASK 0x01
191#define GPIO3_SET_SHIFT 0
192
193/* GPIO 4 Register Definitions */
194#define GPIO4_SLEEP_MASK 0x80
195#define GPIO4_SLEEP_SHIFT 7
196#define GPIO4_SEL_MASK 0x40
197#define GPIO4_SEL_SHIFT 6
198#define GPIO4_ODEN_MASK 0x20
199#define GPIO4_ODEN_SHIFT 5
200#define GPIO4_DEB_MASK 0x10
201#define GPIO4_DEB_SHIFT 4
202#define GPIO4_PDEN_MASK 0x08
203#define GPIO4_PDEN_SHIFT 3
204#define GPIO4_CFG_MASK 0x04
205#define GPIO4_CFG_SHIFT 2
206#define GPIO4_STS_MASK 0x02
207#define GPIO4_STS_SHIFT 1
208#define GPIO4_SET_MASK 0x01
209#define GPIO4_SET_SHIFT 0
210
211/* Register THERM (0x80) register.RegisterDescription */
212#define THERM_THERM_HD_MASK 0x20
213#define THERM_THERM_HD_SHIFT 5
214#define THERM_THERM_TS_MASK 0x10
215#define THERM_THERM_TS_SHIFT 4
216#define THERM_THERM_HDSEL_MASK 0x0C
217#define THERM_THERM_HDSEL_SHIFT 2
218#define THERM_RSVD1_MASK 0x02
219#define THERM_RSVD1_SHIFT 1
220#define THERM_THERM_STATE_MASK 0x01
221#define THERM_THERM_STATE_SHIFT 0
222
223/* Register DCDCCTRL1 register.RegisterDescription */
224#define DCDCCTRL_VCON_ENABLE_MASK 0x80
225#define DCDCCTRL_VCON_ENABLE_SHIFT 7
226#define DCDCCTRL_VCON_RANGE1_MASK 0x40
227#define DCDCCTRL_VCON_RANGE1_SHIFT 6
228#define DCDCCTRL_VCON_RANGE0_MASK 0x20
229#define DCDCCTRL_VCON_RANGE0_SHIFT 5
230#define DCDCCTRL_TSTEP2_MASK 0x10
231#define DCDCCTRL_TSTEP2_SHIFT 4
232#define DCDCCTRL_TSTEP1_MASK 0x08
233#define DCDCCTRL_TSTEP1_SHIFT 3
234#define DCDCCTRL_TSTEP0_MASK 0x04
235#define DCDCCTRL_TSTEP0_SHIFT 2
236#define DCDCCTRL_DCDC1_MODE_MASK 0x02
237#define DCDCCTRL_DCDC1_MODE_SHIFT 1
238
239/* Register DCDCCTRL2 and DCDCCTRL3 register.RegisterDescription */
240#define DCDCCTRL_TSTEP2_MASK 0x10
241#define DCDCCTRL_TSTEP2_SHIFT 4
242#define DCDCCTRL_TSTEP1_MASK 0x08
243#define DCDCCTRL_TSTEP1_SHIFT 3
244#define DCDCCTRL_TSTEP0_MASK 0x04
245#define DCDCCTRL_TSTEP0_SHIFT 2
246#define DCDCCTRL_DCDC_MODE_MASK 0x02
247#define DCDCCTRL_DCDC_MODE_SHIFT 1
248#define DCDCCTRL_RSVD0_MASK 0x01
249#define DCDCCTRL_RSVD0_SHIFT 0
250
251/* Register DCDCCTRL4 register.RegisterDescription */
252#define DCDCCTRL_RAMP_TIME_MASK 0x01
253#define DCDCCTRL_RAMP_TIME_SHIFT 0
254
255/* Register DCDCx_AVS */
256#define DCDC_AVS_ENABLE_MASK 0x80
257#define DCDC_AVS_ENABLE_SHIFT 7
258#define DCDC_AVS_ECO_MASK 0x40
259#define DCDC_AVS_ECO_SHIFT 6
260
261/* Register DCDCx_LIMIT */
262#define DCDC_LIMIT_RANGE_MASK 0xC0
263#define DCDC_LIMIT_RANGE_SHIFT 6
264#define DCDC_LIMIT_MAX_SEL_MASK 0x3F
265#define DCDC_LIMIT_MAX_SEL_SHIFT 0
266
267/**
268 * struct tps65912_board
269 * Board platform dat may be used to initialize regulators.
270 */
271struct tps65912_board {
272 int is_dcdc1_avs;
273 int is_dcdc2_avs;
274 int is_dcdc3_avs;
275 int is_dcdc4_avs;
276 int irq;
277 int irq_base;
278 int gpio_base;
279 struct regulator_init_data *tps65912_pmic_init_data;
280};
281
282/**
283 * struct tps65912 - tps65912 sub-driver chip access routines
284 */
285
286struct tps65912 {
287 struct device *dev;
288 /* for read/write acces */
289 struct mutex io_mutex;
290
291 /* For device IO interfaces: I2C or SPI */
292 void *control_data;
293
294 int (*read)(struct tps65912 *tps65912, u8 reg, int size, void *dest);
295 int (*write)(struct tps65912 *tps65912, u8 reg, int size, void *src);
296
297 /* Client devices */
298 struct tps65912_pmic *pmic;
299
300 /* GPIO Handling */
301 struct gpio_chip gpio;
302
303 /* IRQ Handling */
304 struct mutex irq_lock;
305 int chip_irq;
306 int irq_base;
307 int irq_num;
308 u32 irq_mask;
309};
310
311struct tps65912_platform_data {
312 int irq;
313 int irq_base;
314};
315
316unsigned int tps_chip(void);
317
318int tps65912_set_bits(struct tps65912 *tps65912, u8 reg, u8 mask);
319int tps65912_clear_bits(struct tps65912 *tps65912, u8 reg, u8 mask);
320int tps65912_reg_read(struct tps65912 *tps65912, u8 reg);
321int tps65912_reg_write(struct tps65912 *tps65912, u8 reg, u8 val);
322int tps65912_device_init(struct tps65912 *tps65912);
323void tps65912_device_exit(struct tps65912 *tps65912);
324int tps65912_irq_init(struct tps65912 *tps65912, int irq,
325 struct tps65912_platform_data *pdata);
326
327#endif /* __LINUX_MFD_TPS65912_H */
diff --git a/include/linux/mfd/tps6591x.h b/include/linux/mfd/tps6591x.h
new file mode 100644
index 00000000000..d0d829fc8ab
--- /dev/null
+++ b/include/linux/mfd/tps6591x.h
@@ -0,0 +1,124 @@
1/*
2 * include/linux/mfd/tps6591x.c
3 * Core driver interface for TI TPS6591x PMIC family
4 *
5 * Copyright (C) 2011 NVIDIA Corporation
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 * more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 *
21 */
22
23#ifndef __LINUX_MFD_TPS6591X_H
24#define __LINUX_MFD_TPS6591X_H
25
26#include <linux/rtc.h>
27
28enum {
29 TPS6591X_INT_PWRHOLD_F,
30 TPS6591X_INT_VMBHI,
31 TPS6591X_INT_PWRON,
32 TPS6591X_INT_PWRON_LP,
33 TPS6591X_INT_PWRHOLD_R,
34 TPS6591X_INT_HOTDIE,
35 TPS6591X_INT_RTC_ALARM,
36 TPS6591X_INT_RTC_PERIOD,
37 TPS6591X_INT_GPIO0,
38 TPS6591X_INT_GPIO1,
39 TPS6591X_INT_GPIO2,
40 TPS6591X_INT_GPIO3,
41 TPS6591X_INT_GPIO4,
42 TPS6591X_INT_GPIO5,
43 TPS6591X_INT_WTCHDG,
44 TPS6591X_INT_VMBCH2_H,
45 TPS6591X_INT_VMBCH2_L,
46 TPS6591X_INT_PWRDN,
47
48 /* Last entry */
49 TPS6591X_INT_NR,
50};
51
52/* Gpio definitions */
53enum {
54 TPS6591X_GPIO_GP0 = 0,
55 TPS6591X_GPIO_GP1 = 1,
56 TPS6591X_GPIO_GP2 = 2,
57 TPS6591X_GPIO_GP3 = 3,
58 TPS6591X_GPIO_GP4 = 4,
59 TPS6591X_GPIO_GP5 = 5,
60 TPS6591X_GPIO_GP6 = 6,
61 TPS6591X_GPIO_GP7 = 7,
62 TPS6591X_GPIO_GP8 = 8,
63
64 /* Last entry */
65 TPS6591X_GPIO_NR,
66};
67
68struct tps6591x_subdev_info {
69 int id;
70 const char *name;
71 void *platform_data;
72};
73
74struct tps6591x_rtc_platform_data {
75 int irq;
76 struct rtc_time time;
77};
78
79struct tps6591x_sleep_keepon_data {
80 /* set 1 to maintain the following on sleep mode */
81 unsigned therm_keepon:1; /* themal monitoring */
82 unsigned clkout32k_keepon:1; /* CLK32KOUT */
83 unsigned vrtc_keepon:1; /* LD0 full load capability */
84 unsigned i2chs_keepon:1; /* high speed internal clock */
85};
86
87struct tps6591x_gpio_init_data {
88 unsigned sleep_en:1; /* Enable sleep mode */
89 unsigned pulldn_en:1; /* Enable pull down */
90 unsigned output_mode_en:1; /* Enable output mode during init */
91 unsigned output_val:1; /* Output value if it is in output mode */
92 unsigned init_apply:1; /* Apply init data on configuring gpios*/
93};
94
95struct tps6591x_platform_data {
96 int gpio_base;
97 int irq_base;
98
99 int num_subdevs;
100 struct tps6591x_subdev_info *subdevs;
101
102 bool dev_slp_en;
103 struct tps6591x_sleep_keepon_data *slp_keepon;
104
105 struct tps6591x_gpio_init_data *gpio_init_data;
106 int num_gpioinit_data;
107
108 bool use_power_off;
109};
110
111/*
112 * NOTE: the functions below are not intended for use outside
113 * of the TPS6591X sub-device drivers
114 */
115extern int tps6591x_write(struct device *dev, int reg, uint8_t val);
116extern int tps6591x_writes(struct device *dev, int reg, int len, uint8_t *val);
117extern int tps6591x_read(struct device *dev, int reg, uint8_t *val);
118extern int tps6591x_reads(struct device *dev, int reg, int len, uint8_t *val);
119extern int tps6591x_set_bits(struct device *dev, int reg, uint8_t bit_mask);
120extern int tps6591x_clr_bits(struct device *dev, int reg, uint8_t bit_mask);
121extern int tps6591x_update(struct device *dev, int reg, uint8_t val,
122 uint8_t mask);
123
124#endif /*__LINUX_MFD_TPS6591X_H */
diff --git a/include/linux/mfd/tps80031.h b/include/linux/mfd/tps80031.h
new file mode 100644
index 00000000000..1802dfefef0
--- /dev/null
+++ b/include/linux/mfd/tps80031.h
@@ -0,0 +1,203 @@
1/*
2 * include/linux/mfd/tps80031.c
3 *
4 * Core driver interface for TI TPS80031 PMIC
5 *
6 * Copyright (C) 2011 NVIDIA Corporation
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, but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 * 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 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 *
22 */
23
24#ifndef __LINUX_MFD_TPS80031_H
25#define __LINUX_MFD_TPS80031_H
26
27#include <linux/rtc.h>
28
29/* Supported chips */
30enum chips {
31 TPS80031 = 0x00000001,
32 TPS80032 = 0x00000002,
33};
34
35enum {
36 TPS80031_INT_PWRON,
37 TPS80031_INT_RPWRON,
38 TPS80031_INT_SYS_VLOW,
39 TPS80031_INT_RTC_ALARM,
40 TPS80031_INT_RTC_PERIOD,
41 TPS80031_INT_HOT_DIE,
42 TPS80031_INT_VXX_SHORT,
43 TPS80031_INT_SPDURATION,
44 TPS80031_INT_WATCHDOG,
45 TPS80031_INT_BAT,
46 TPS80031_INT_SIM,
47 TPS80031_INT_MMC,
48 TPS80031_INT_RES,
49 TPS80031_INT_GPADC_RT,
50 TPS80031_INT_GPADC_SW2_EOC,
51 TPS80031_INT_CC_AUTOCAL,
52 TPS80031_INT_ID_WKUP,
53 TPS80031_INT_VBUSS_WKUP,
54 TPS80031_INT_ID,
55 TPS80031_INT_VBUS,
56 TPS80031_INT_CHRG_CTRL,
57 TPS80031_INT_EXT_CHRG,
58 TPS80031_INT_INT_CHRG,
59 TPS80031_INT_RES2,
60 TPS80031_INT_BAT_TEMP_OVRANGE,
61 TPS80031_INT_BAT_REMOVED,
62 TPS80031_INT_VBUS_DET,
63 TPS80031_INT_VAC_DET,
64 TPS80031_INT_FAULT_WDG,
65 TPS80031_INT_LINCH_GATED,
66
67 /* Last interrupt id to get the end number */
68 TPS80031_INT_NR,
69};
70
71enum adc_channel {
72 BATTERY_TYPE = 0, /* External ADC */
73 BATTERY_TEMPERATURE = 1, /* External ADC */
74 AUDIO_ACCESSORY = 2, /* External ADC */
75 TEMPERATURE_EXTERNAL_DIODE = 3, /* External ADC */
76 TEMPERATURE_MEASUREMENT = 4, /* External ADC */
77 GENERAL_PURPOSE_1 = 5, /* External ADC */
78 GENERAL_PURPOSE_2 = 6, /* External ADC */
79 SYSTEM_SUPPLY = 7, /* Internal ADC */
80 BACKUP_BATTERY = 8, /* Internal ADC */
81 EXTERNAL_CHARGER_INPUT = 9, /* Internal ADC */
82 VBUS = 10, /* Internal ADC */
83 VBUS_DCDC_OUTPUT_CURRENT = 11, /* Internal ADC */
84 DIE_TEMPERATURE_1 = 12, /* Internal ADC */
85 DIE_TEMPERATURE_2 = 13, /* Internal ADC */
86 USB_ID_LINE = 14, /* Internal ADC */
87 TEST_NETWORK_1 = 15, /* Internal ADC */
88 TEST_NETWORK_2 = 16, /* Internal ADC */
89 BATTERY_CHARGING_CURRENT = 17, /* Internal ADC */
90 BATTERY_VOLTAGE = 18, /* Internal ADC */
91};
92
93enum TPS80031_GPIO {
94 TPS80031_GPIO_REGEN1,
95 TPS80031_GPIO_REGEN2,
96 TPS80031_GPIO_SYSEN,
97
98 /* Last entry */
99 TPS80031_GPIO_NR,
100};
101
102enum TPS80031_CLOCK32K {
103 TPS80031_CLOCK32K_AO,
104 TPS80031_CLOCK32K_G,
105 TPS80031_CLOCK32K_AUDIO,
106
107 /* Last entry */
108 TPS80031_CLOCK32K_NR,
109};
110
111enum {
112 SLAVE_ID0 = 0,
113 SLAVE_ID1 = 1,
114 SLAVE_ID2 = 2,
115 SLAVE_ID3 = 3,
116};
117
118enum {
119 I2C_ID0_ADDR = 0x12,
120 I2C_ID1_ADDR = 0x48,
121 I2C_ID2_ADDR = 0x49,
122 I2C_ID3_ADDR = 0x4A,
123};
124
125/* External controls requests */
126enum tps80031_ext_control {
127 PWR_REQ_INPUT_NONE = 0x00000000,
128 PWR_REQ_INPUT_PREQ1 = 0x00000001,
129 PWR_REQ_INPUT_PREQ2 = 0x00000002,
130 PWR_REQ_INPUT_PREQ3 = 0x00000004,
131 PWR_OFF_ON_SLEEP = 0x00000008,
132 PWR_ON_ON_SLEEP = 0x00000010,
133};
134
135struct tps80031_subdev_info {
136 int id;
137 const char *name;
138 void *platform_data;
139};
140
141struct tps80031_rtc_platform_data {
142 int irq;
143 struct rtc_time time;
144};
145
146struct tps80031_clk32k_init_data {
147 int clk32k_nr;
148 bool enable;
149 unsigned long ext_ctrl_flag;
150};
151
152struct tps80031_gpio_init_data {
153 int gpio_nr;
154 unsigned long ext_ctrl_flag;
155};
156
157struct tps80031_platform_data {
158 int num_subdevs;
159 struct tps80031_subdev_info *subdevs;
160 int gpio_base;
161 int irq_base;
162 struct tps80031_32kclock_plat_data *clk32k_pdata;
163 struct tps80031_gpio_init_data *gpio_init_data;
164 int gpio_init_data_size;
165 struct tps80031_clk32k_init_data *clk32k_init_data;
166 int clk32k_init_data_size;
167 bool use_power_off;
168};
169
170struct tps80031_bg_platform_data {
171 int irq_base;
172 int battery_present;
173};
174
175/*
176 * NOTE: the functions below are not intended for use outside
177 * of the TPS80031 sub-device drivers
178 */
179extern int tps80031_write(struct device *dev, int sid, int reg, uint8_t val);
180extern int tps80031_writes(struct device *dev, int sid, int reg, int len,
181 uint8_t *val);
182extern int tps80031_read(struct device *dev, int sid, int reg, uint8_t *val);
183extern int tps80031_reads(struct device *dev, int sid, int reg, int len,
184 uint8_t *val);
185extern int tps80031_set_bits(struct device *dev, int sid, int reg,
186 uint8_t bit_mask);
187extern int tps80031_clr_bits(struct device *dev, int sid, int reg,
188 uint8_t bit_mask);
189extern int tps80031_update(struct device *dev, int sid, int reg, uint8_t val,
190 uint8_t mask);
191extern int tps80031_force_update(struct device *dev, int sid, int reg,
192 uint8_t val, uint8_t mask);
193extern int tps80031_ext_power_req_config(struct device *dev,
194 unsigned long ext_ctrl_flag, int preq_bit,
195 int state_reg_add, int trans_reg_add);
196
197extern unsigned long tps80031_get_chip_info(struct device *dev);
198
199extern int tps80031_gpadc_conversion(int channle_no);
200
201extern int tps80031_get_pmu_version(struct device *dev);
202
203#endif /*__LINUX_MFD_TPS80031_H */
diff --git a/include/linux/mfd/twl4030-codec.h b/include/linux/mfd/twl4030-audio.h
index 5cc16bbd1da..3d22b72df07 100644
--- a/include/linux/mfd/twl4030-codec.h
+++ b/include/linux/mfd/twl4030-audio.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * MFD driver for twl4030 codec submodule 2 * MFD driver for twl4030 audio submodule
3 * 3 *
4 * Author: Peter Ujfalusi <peter.ujfalusi@ti.com> 4 * Author: Peter Ujfalusi <peter.ujfalusi@ti.com>
5 * 5 *
@@ -259,14 +259,14 @@
259#define TWL4030_VIBRA_DIR_SEL 0x20 259#define TWL4030_VIBRA_DIR_SEL 0x20
260 260
261/* TWL4030 codec resource IDs */ 261/* TWL4030 codec resource IDs */
262enum twl4030_codec_res { 262enum twl4030_audio_res {
263 TWL4030_CODEC_RES_POWER = 0, 263 TWL4030_AUDIO_RES_POWER = 0,
264 TWL4030_CODEC_RES_APLL, 264 TWL4030_AUDIO_RES_APLL,
265 TWL4030_CODEC_RES_MAX, 265 TWL4030_AUDIO_RES_MAX,
266}; 266};
267 267
268int twl4030_codec_disable_resource(enum twl4030_codec_res id); 268int twl4030_audio_disable_resource(enum twl4030_audio_res id);
269int twl4030_codec_enable_resource(enum twl4030_codec_res id); 269int twl4030_audio_enable_resource(enum twl4030_audio_res id);
270unsigned int twl4030_codec_get_mclk(void); 270unsigned int twl4030_audio_get_mclk(void);
271 271
272#endif /* End of __TWL4030_CODEC_H__ */ 272#endif /* End of __TWL4030_CODEC_H__ */
diff --git a/include/linux/mfd/twl6040.h b/include/linux/mfd/twl6040.h
new file mode 100644
index 00000000000..4c806f6d663
--- /dev/null
+++ b/include/linux/mfd/twl6040.h
@@ -0,0 +1,228 @@
1/*
2 * MFD driver for twl6040
3 *
4 * Authors: Jorge Eduardo Candelaria <jorge.candelaria@ti.com>
5 * Misael Lopez Cruz <misael.lopez@ti.com>
6 *
7 * Copyright: (C) 2011 Texas Instruments, Inc.
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 *
13 * 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
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
21 * 02110-1301 USA
22 *
23 */
24
25#ifndef __TWL6040_CODEC_H__
26#define __TWL6040_CODEC_H__
27
28#include <linux/interrupt.h>
29#include <linux/mfd/core.h>
30
31#define TWL6040_REG_ASICID 0x01
32#define TWL6040_REG_ASICREV 0x02
33#define TWL6040_REG_INTID 0x03
34#define TWL6040_REG_INTMR 0x04
35#define TWL6040_REG_NCPCTL 0x05
36#define TWL6040_REG_LDOCTL 0x06
37#define TWL6040_REG_HPPLLCTL 0x07
38#define TWL6040_REG_LPPLLCTL 0x08
39#define TWL6040_REG_LPPLLDIV 0x09
40#define TWL6040_REG_AMICBCTL 0x0A
41#define TWL6040_REG_DMICBCTL 0x0B
42#define TWL6040_REG_MICLCTL 0x0C
43#define TWL6040_REG_MICRCTL 0x0D
44#define TWL6040_REG_MICGAIN 0x0E
45#define TWL6040_REG_LINEGAIN 0x0F
46#define TWL6040_REG_HSLCTL 0x10
47#define TWL6040_REG_HSRCTL 0x11
48#define TWL6040_REG_HSGAIN 0x12
49#define TWL6040_REG_EARCTL 0x13
50#define TWL6040_REG_HFLCTL 0x14
51#define TWL6040_REG_HFLGAIN 0x15
52#define TWL6040_REG_HFRCTL 0x16
53#define TWL6040_REG_HFRGAIN 0x17
54#define TWL6040_REG_VIBCTLL 0x18
55#define TWL6040_REG_VIBDATL 0x19
56#define TWL6040_REG_VIBCTLR 0x1A
57#define TWL6040_REG_VIBDATR 0x1B
58#define TWL6040_REG_HKCTL1 0x1C
59#define TWL6040_REG_HKCTL2 0x1D
60#define TWL6040_REG_GPOCTL 0x1E
61#define TWL6040_REG_ALB 0x1F
62#define TWL6040_REG_DLB 0x20
63#define TWL6040_REG_TRIM1 0x28
64#define TWL6040_REG_TRIM2 0x29
65#define TWL6040_REG_TRIM3 0x2A
66#define TWL6040_REG_HSOTRIM 0x2B
67#define TWL6040_REG_HFOTRIM 0x2C
68#define TWL6040_REG_ACCCTL 0x2D
69#define TWL6040_REG_STATUS 0x2E
70
71#define TWL6040_CACHEREGNUM (TWL6040_REG_STATUS + 1)
72
73#define TWL6040_VIOREGNUM 18
74#define TWL6040_VDDREGNUM 21
75
76/* INTID (0x03) fields */
77
78#define TWL6040_THINT 0x01
79#define TWL6040_PLUGINT 0x02
80#define TWL6040_UNPLUGINT 0x04
81#define TWL6040_HOOKINT 0x08
82#define TWL6040_HFINT 0x10
83#define TWL6040_VIBINT 0x20
84#define TWL6040_READYINT 0x40
85
86/* INTMR (0x04) fields */
87
88#define TWL6040_THMSK 0x01
89#define TWL6040_PLUGMSK 0x02
90#define TWL6040_HOOKMSK 0x08
91#define TWL6040_HFMSK 0x10
92#define TWL6040_VIBMSK 0x20
93#define TWL6040_READYMSK 0x40
94#define TWL6040_ALLINT_MSK 0x7B
95
96/* NCPCTL (0x05) fields */
97
98#define TWL6040_NCPENA 0x01
99#define TWL6040_NCPOPEN 0x40
100
101/* LDOCTL (0x06) fields */
102
103#define TWL6040_LSLDOENA 0x01
104#define TWL6040_HSLDOENA 0x04
105#define TWL6040_REFENA 0x40
106#define TWL6040_OSCENA 0x80
107
108/* HPPLLCTL (0x07) fields */
109
110#define TWL6040_HPLLENA 0x01
111#define TWL6040_HPLLRST 0x02
112#define TWL6040_HPLLBP 0x04
113#define TWL6040_HPLLSQRENA 0x08
114#define TWL6040_MCLK_12000KHZ (0 << 5)
115#define TWL6040_MCLK_19200KHZ (1 << 5)
116#define TWL6040_MCLK_26000KHZ (2 << 5)
117#define TWL6040_MCLK_38400KHZ (3 << 5)
118#define TWL6040_MCLK_MSK 0x60
119
120/* LPPLLCTL (0x08) fields */
121
122#define TWL6040_LPLLENA 0x01
123#define TWL6040_LPLLRST 0x02
124#define TWL6040_LPLLSEL 0x04
125#define TWL6040_LPLLFIN 0x08
126#define TWL6040_HPLLSEL 0x10
127
128/* HSLCTL (0x10) fields */
129
130#define TWL6040_HSDACMODEL 0x02
131#define TWL6040_HSDRVMODEL 0x08
132
133/* HSRCTL (0x11) fields */
134
135#define TWL6040_HSDACMODER 0x02
136#define TWL6040_HSDRVMODER 0x08
137
138/* VIBCTLL (0x18) fields */
139
140#define TWL6040_VIBENAL 0x01
141#define TWL6040_VIBCTRLL 0x04
142#define TWL6040_VIBCTRLLP 0x08
143#define TWL6040_VIBCTRLLN 0x10
144
145/* VIBDATL (0x19) fields */
146
147#define TWL6040_VIBDAT_MAX 0x64
148
149/* VIBCTLR (0x1A) fields */
150
151#define TWL6040_VIBENAR 0x01
152#define TWL6040_VIBCTRLR 0x04
153#define TWL6040_VIBCTRLRP 0x08
154#define TWL6040_VIBCTRLRN 0x10
155
156/* GPOCTL (0x1E) fields */
157
158#define TWL6040_GPO1 0x01
159#define TWL6040_GPO2 0x02
160#define TWL6040_GPO3 0x03
161
162/* ACCCTL (0x2D) fields */
163
164#define TWL6040_I2CSEL 0x01
165#define TWL6040_RESETSPLIT 0x04
166#define TWL6040_INTCLRMODE 0x08
167
168/* STATUS (0x2E) fields */
169
170#define TWL6040_PLUGCOMP 0x02
171#define TWL6040_VIBLOCDET 0x10
172#define TWL6040_VIBROCDET 0x20
173#define TWL6040_TSHUTDET 0x40
174
175#define TWL6040_CELLS 2
176
177#define TWL6040_REV_ES1_0 0x00
178#define TWL6040_REV_ES1_1 0x01
179#define TWL6040_REV_ES1_2 0x02
180
181#define TWL6040_IRQ_TH 0
182#define TWL6040_IRQ_PLUG 1
183#define TWL6040_IRQ_HOOK 2
184#define TWL6040_IRQ_HF 3
185#define TWL6040_IRQ_VIB 4
186#define TWL6040_IRQ_READY 5
187
188/* PLL selection */
189#define TWL6040_SYSCLK_SEL_LPPLL 0
190#define TWL6040_SYSCLK_SEL_HPPLL 1
191
192struct twl6040 {
193 struct device *dev;
194 struct mutex mutex;
195 struct mutex io_mutex;
196 struct mutex irq_mutex;
197 struct mfd_cell cells[TWL6040_CELLS];
198 struct completion ready;
199
200 int audpwron;
201 int power_count;
202 int rev;
203
204 int pll;
205 unsigned int sysclk;
206
207 unsigned int irq;
208 unsigned int irq_base;
209 u8 irq_masks_cur;
210 u8 irq_masks_cache;
211};
212
213int twl6040_reg_read(struct twl6040 *twl6040, unsigned int reg);
214int twl6040_reg_write(struct twl6040 *twl6040, unsigned int reg,
215 u8 val);
216int twl6040_set_bits(struct twl6040 *twl6040, unsigned int reg,
217 u8 mask);
218int twl6040_clear_bits(struct twl6040 *twl6040, unsigned int reg,
219 u8 mask);
220int twl6040_power(struct twl6040 *twl6040, int on);
221int twl6040_set_pll(struct twl6040 *twl6040, int pll_id,
222 unsigned int freq_in, unsigned int freq_out);
223int twl6040_get_pll(struct twl6040 *twl6040);
224unsigned int twl6040_get_sysclk(struct twl6040 *twl6040);
225int twl6040_irq_init(struct twl6040 *twl6040);
226void twl6040_irq_exit(struct twl6040 *twl6040);
227
228#endif /* End of __TWL6040_CODEC_H__ */
diff --git a/include/linux/mfd/wm831x/core.h b/include/linux/mfd/wm831x/core.h
index 0d515ee1c24..ed8fe0d0409 100644
--- a/include/linux/mfd/wm831x/core.h
+++ b/include/linux/mfd/wm831x/core.h
@@ -17,6 +17,8 @@
17 17
18#include <linux/completion.h> 18#include <linux/completion.h>
19#include <linux/interrupt.h> 19#include <linux/interrupt.h>
20#include <linux/list.h>
21#include <linux/regmap.h>
20 22
21/* 23/*
22 * Register values. 24 * Register values.
@@ -234,9 +236,111 @@
234#define WM831X_ON_PIN_TO_SHIFT 0 /* ON_PIN_TO - [1:0] */ 236#define WM831X_ON_PIN_TO_SHIFT 0 /* ON_PIN_TO - [1:0] */
235#define WM831X_ON_PIN_TO_WIDTH 2 /* ON_PIN_TO - [1:0] */ 237#define WM831X_ON_PIN_TO_WIDTH 2 /* ON_PIN_TO - [1:0] */
236 238
239/*
240 * R16528 (0x4090) - Clock Control 1
241 */
242#define WM831X_CLKOUT_ENA 0x8000 /* CLKOUT_ENA */
243#define WM831X_CLKOUT_ENA_MASK 0x8000 /* CLKOUT_ENA */
244#define WM831X_CLKOUT_ENA_SHIFT 15 /* CLKOUT_ENA */
245#define WM831X_CLKOUT_ENA_WIDTH 1 /* CLKOUT_ENA */
246#define WM831X_CLKOUT_OD 0x2000 /* CLKOUT_OD */
247#define WM831X_CLKOUT_OD_MASK 0x2000 /* CLKOUT_OD */
248#define WM831X_CLKOUT_OD_SHIFT 13 /* CLKOUT_OD */
249#define WM831X_CLKOUT_OD_WIDTH 1 /* CLKOUT_OD */
250#define WM831X_CLKOUT_SLOT_MASK 0x0700 /* CLKOUT_SLOT - [10:8] */
251#define WM831X_CLKOUT_SLOT_SHIFT 8 /* CLKOUT_SLOT - [10:8] */
252#define WM831X_CLKOUT_SLOT_WIDTH 3 /* CLKOUT_SLOT - [10:8] */
253#define WM831X_CLKOUT_SLPSLOT_MASK 0x0070 /* CLKOUT_SLPSLOT - [6:4] */
254#define WM831X_CLKOUT_SLPSLOT_SHIFT 4 /* CLKOUT_SLPSLOT - [6:4] */
255#define WM831X_CLKOUT_SLPSLOT_WIDTH 3 /* CLKOUT_SLPSLOT - [6:4] */
256#define WM831X_CLKOUT_SRC 0x0001 /* CLKOUT_SRC */
257#define WM831X_CLKOUT_SRC_MASK 0x0001 /* CLKOUT_SRC */
258#define WM831X_CLKOUT_SRC_SHIFT 0 /* CLKOUT_SRC */
259#define WM831X_CLKOUT_SRC_WIDTH 1 /* CLKOUT_SRC */
260
261/*
262 * R16529 (0x4091) - Clock Control 2
263 */
264#define WM831X_XTAL_INH 0x8000 /* XTAL_INH */
265#define WM831X_XTAL_INH_MASK 0x8000 /* XTAL_INH */
266#define WM831X_XTAL_INH_SHIFT 15 /* XTAL_INH */
267#define WM831X_XTAL_INH_WIDTH 1 /* XTAL_INH */
268#define WM831X_XTAL_ENA 0x2000 /* XTAL_ENA */
269#define WM831X_XTAL_ENA_MASK 0x2000 /* XTAL_ENA */
270#define WM831X_XTAL_ENA_SHIFT 13 /* XTAL_ENA */
271#define WM831X_XTAL_ENA_WIDTH 1 /* XTAL_ENA */
272#define WM831X_XTAL_BKUPENA 0x1000 /* XTAL_BKUPENA */
273#define WM831X_XTAL_BKUPENA_MASK 0x1000 /* XTAL_BKUPENA */
274#define WM831X_XTAL_BKUPENA_SHIFT 12 /* XTAL_BKUPENA */
275#define WM831X_XTAL_BKUPENA_WIDTH 1 /* XTAL_BKUPENA */
276#define WM831X_FLL_AUTO 0x0080 /* FLL_AUTO */
277#define WM831X_FLL_AUTO_MASK 0x0080 /* FLL_AUTO */
278#define WM831X_FLL_AUTO_SHIFT 7 /* FLL_AUTO */
279#define WM831X_FLL_AUTO_WIDTH 1 /* FLL_AUTO */
280#define WM831X_FLL_AUTO_FREQ_MASK 0x0007 /* FLL_AUTO_FREQ - [2:0] */
281#define WM831X_FLL_AUTO_FREQ_SHIFT 0 /* FLL_AUTO_FREQ - [2:0] */
282#define WM831X_FLL_AUTO_FREQ_WIDTH 3 /* FLL_AUTO_FREQ - [2:0] */
283
284/*
285 * R16530 (0x4092) - FLL Control 1
286 */
287#define WM831X_FLL_FRAC 0x0004 /* FLL_FRAC */
288#define WM831X_FLL_FRAC_MASK 0x0004 /* FLL_FRAC */
289#define WM831X_FLL_FRAC_SHIFT 2 /* FLL_FRAC */
290#define WM831X_FLL_FRAC_WIDTH 1 /* FLL_FRAC */
291#define WM831X_FLL_OSC_ENA 0x0002 /* FLL_OSC_ENA */
292#define WM831X_FLL_OSC_ENA_MASK 0x0002 /* FLL_OSC_ENA */
293#define WM831X_FLL_OSC_ENA_SHIFT 1 /* FLL_OSC_ENA */
294#define WM831X_FLL_OSC_ENA_WIDTH 1 /* FLL_OSC_ENA */
295#define WM831X_FLL_ENA 0x0001 /* FLL_ENA */
296#define WM831X_FLL_ENA_MASK 0x0001 /* FLL_ENA */
297#define WM831X_FLL_ENA_SHIFT 0 /* FLL_ENA */
298#define WM831X_FLL_ENA_WIDTH 1 /* FLL_ENA */
299
300/*
301 * R16531 (0x4093) - FLL Control 2
302 */
303#define WM831X_FLL_OUTDIV_MASK 0x3F00 /* FLL_OUTDIV - [13:8] */
304#define WM831X_FLL_OUTDIV_SHIFT 8 /* FLL_OUTDIV - [13:8] */
305#define WM831X_FLL_OUTDIV_WIDTH 6 /* FLL_OUTDIV - [13:8] */
306#define WM831X_FLL_CTRL_RATE_MASK 0x0070 /* FLL_CTRL_RATE - [6:4] */
307#define WM831X_FLL_CTRL_RATE_SHIFT 4 /* FLL_CTRL_RATE - [6:4] */
308#define WM831X_FLL_CTRL_RATE_WIDTH 3 /* FLL_CTRL_RATE - [6:4] */
309#define WM831X_FLL_FRATIO_MASK 0x0007 /* FLL_FRATIO - [2:0] */
310#define WM831X_FLL_FRATIO_SHIFT 0 /* FLL_FRATIO - [2:0] */
311#define WM831X_FLL_FRATIO_WIDTH 3 /* FLL_FRATIO - [2:0] */
312
313/*
314 * R16532 (0x4094) - FLL Control 3
315 */
316#define WM831X_FLL_K_MASK 0xFFFF /* FLL_K - [15:0] */
317#define WM831X_FLL_K_SHIFT 0 /* FLL_K - [15:0] */
318#define WM831X_FLL_K_WIDTH 16 /* FLL_K - [15:0] */
319
320/*
321 * R16533 (0x4095) - FLL Control 4
322 */
323#define WM831X_FLL_N_MASK 0x7FE0 /* FLL_N - [14:5] */
324#define WM831X_FLL_N_SHIFT 5 /* FLL_N - [14:5] */
325#define WM831X_FLL_N_WIDTH 10 /* FLL_N - [14:5] */
326#define WM831X_FLL_GAIN_MASK 0x000F /* FLL_GAIN - [3:0] */
327#define WM831X_FLL_GAIN_SHIFT 0 /* FLL_GAIN - [3:0] */
328#define WM831X_FLL_GAIN_WIDTH 4 /* FLL_GAIN - [3:0] */
329
330/*
331 * R16534 (0x4096) - FLL Control 5
332 */
333#define WM831X_FLL_CLK_REF_DIV_MASK 0x0018 /* FLL_CLK_REF_DIV - [4:3] */
334#define WM831X_FLL_CLK_REF_DIV_SHIFT 3 /* FLL_CLK_REF_DIV - [4:3] */
335#define WM831X_FLL_CLK_REF_DIV_WIDTH 2 /* FLL_CLK_REF_DIV - [4:3] */
336#define WM831X_FLL_CLK_SRC_MASK 0x0003 /* FLL_CLK_SRC - [1:0] */
337#define WM831X_FLL_CLK_SRC_SHIFT 0 /* FLL_CLK_SRC - [1:0] */
338#define WM831X_FLL_CLK_SRC_WIDTH 2 /* FLL_CLK_SRC - [1:0] */
339
237struct regulator_dev; 340struct regulator_dev;
238 341
239#define WM831X_NUM_IRQ_REGS 5 342#define WM831X_NUM_IRQ_REGS 5
343#define WM831X_NUM_GPIO_REGS 16
240 344
241enum wm831x_parent { 345enum wm831x_parent {
242 WM8310 = 0x8310, 346 WM8310 = 0x8310,
@@ -248,23 +352,27 @@ enum wm831x_parent {
248 WM8326 = 0x8326, 352 WM8326 = 0x8326,
249}; 353};
250 354
355struct wm831x;
356enum wm831x_auxadc;
357
358typedef int (*wm831x_auxadc_read_fn)(struct wm831x *wm831x,
359 enum wm831x_auxadc input);
360
251struct wm831x { 361struct wm831x {
252 struct mutex io_lock; 362 struct mutex io_lock;
253 363
254 struct device *dev; 364 struct device *dev;
255 int (*read_dev)(struct wm831x *wm831x, unsigned short reg,
256 int bytes, void *dest);
257 int (*write_dev)(struct wm831x *wm831x, unsigned short reg,
258 int bytes, void *src);
259 365
260 void *control_data; 366 struct regmap *regmap;
261 367
262 int irq; /* Our chip IRQ */ 368 int irq; /* Our chip IRQ */
263 struct mutex irq_lock; 369 struct mutex irq_lock;
264 unsigned int irq_base; 370 int irq_base;
265 int irq_masks_cur[WM831X_NUM_IRQ_REGS]; /* Currently active value */ 371 int irq_masks_cur[WM831X_NUM_IRQ_REGS]; /* Currently active value */
266 int irq_masks_cache[WM831X_NUM_IRQ_REGS]; /* Cached hardware value */ 372 int irq_masks_cache[WM831X_NUM_IRQ_REGS]; /* Cached hardware value */
267 373
374 bool soft_shutdown;
375
268 /* Chip revision based flags */ 376 /* Chip revision based flags */
269 unsigned has_gpio_ena:1; /* Has GPIO enable bit */ 377 unsigned has_gpio_ena:1; /* Has GPIO enable bit */
270 unsigned has_cs_sts:1; /* Has current sink status bit */ 378 unsigned has_cs_sts:1; /* Has current sink status bit */
@@ -272,8 +380,13 @@ struct wm831x {
272 380
273 int num_gpio; 381 int num_gpio;
274 382
383 /* Used by the interrupt controller code to post writes */
384 int gpio_update[WM831X_NUM_GPIO_REGS];
385
275 struct mutex auxadc_lock; 386 struct mutex auxadc_lock;
276 struct completion auxadc_done; 387 struct list_head auxadc_pending;
388 u16 auxadc_active;
389 wm831x_auxadc_read_fn auxadc_read;
277 390
278 /* The WM831x has a security key blocking access to certain 391 /* The WM831x has a security key blocking access to certain
279 * registers. The mutex is taken by the accessors for locking 392 * registers. The mutex is taken by the accessors for locking
@@ -298,7 +411,11 @@ int wm831x_bulk_read(struct wm831x *wm831x, unsigned short reg,
298int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq); 411int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq);
299void wm831x_device_exit(struct wm831x *wm831x); 412void wm831x_device_exit(struct wm831x *wm831x);
300int wm831x_device_suspend(struct wm831x *wm831x); 413int wm831x_device_suspend(struct wm831x *wm831x);
414void wm831x_device_shutdown(struct wm831x *wm831x);
301int wm831x_irq_init(struct wm831x *wm831x, int irq); 415int wm831x_irq_init(struct wm831x *wm831x, int irq);
302void wm831x_irq_exit(struct wm831x *wm831x); 416void wm831x_irq_exit(struct wm831x *wm831x);
417void wm831x_auxadc_init(struct wm831x *wm831x);
418
419extern struct regmap_config wm831x_regmap_config;
303 420
304#endif 421#endif
diff --git a/include/linux/mfd/wm831x/pdata.h b/include/linux/mfd/wm831x/pdata.h
index ff42d700293..1d7a3f7b3b5 100644
--- a/include/linux/mfd/wm831x/pdata.h
+++ b/include/linux/mfd/wm831x/pdata.h
@@ -120,6 +120,12 @@ struct wm831x_pdata {
120 /** Put the /IRQ line into CMOS mode */ 120 /** Put the /IRQ line into CMOS mode */
121 bool irq_cmos; 121 bool irq_cmos;
122 122
123 /** Disable the touchscreen */
124 bool disable_touch;
125
126 /** The driver should initiate a power off sequence during shutdown */
127 bool soft_shutdown;
128
123 int irq_base; 129 int irq_base;
124 int gpio_base; 130 int gpio_base;
125 int gpio_defaults[WM831X_GPIO_NUM]; 131 int gpio_defaults[WM831X_GPIO_NUM];
diff --git a/include/linux/mfd/wm8400-private.h b/include/linux/mfd/wm8400-private.h
index 2aab4e93a5c..0147b696851 100644
--- a/include/linux/mfd/wm8400-private.h
+++ b/include/linux/mfd/wm8400-private.h
@@ -25,16 +25,15 @@
25#include <linux/mutex.h> 25#include <linux/mutex.h>
26#include <linux/platform_device.h> 26#include <linux/platform_device.h>
27 27
28struct regmap;
29
28#define WM8400_REGISTER_COUNT 0x55 30#define WM8400_REGISTER_COUNT 0x55
29 31
30struct wm8400 { 32struct wm8400 {
31 struct device *dev; 33 struct device *dev;
32 34
33 int (*read_dev)(void *data, char reg, int count, u16 *dst);
34 int (*write_dev)(void *data, char reg, int count, const u16 *src);
35
36 struct mutex io_lock; 35 struct mutex io_lock;
37 void *io_data; 36 struct regmap *regmap;
38 37
39 u16 reg_cache[WM8400_REGISTER_COUNT]; 38 u16 reg_cache[WM8400_REGISTER_COUNT];
40 39
diff --git a/include/linux/mfd/wm8994/core.h b/include/linux/mfd/wm8994/core.h
index f0b69cdae41..45df450d869 100644
--- a/include/linux/mfd/wm8994/core.h
+++ b/include/linux/mfd/wm8994/core.h
@@ -24,6 +24,7 @@ enum wm8994_type {
24 24
25struct regulator_dev; 25struct regulator_dev;
26struct regulator_bulk_data; 26struct regulator_bulk_data;
27struct regmap;
27 28
28#define WM8994_NUM_GPIO_REGS 11 29#define WM8994_NUM_GPIO_REGS 11
29#define WM8994_NUM_LDO_REGS 2 30#define WM8994_NUM_LDO_REGS 2
@@ -50,18 +51,12 @@ struct regulator_bulk_data;
50#define WM8994_IRQ_GPIO(x) (x + WM8994_IRQ_TEMP_WARN) 51#define WM8994_IRQ_GPIO(x) (x + WM8994_IRQ_TEMP_WARN)
51 52
52struct wm8994 { 53struct wm8994 {
53 struct mutex io_lock;
54 struct mutex irq_lock; 54 struct mutex irq_lock;
55 55
56 enum wm8994_type type; 56 enum wm8994_type type;
57 57
58 struct device *dev; 58 struct device *dev;
59 int (*read_dev)(struct wm8994 *wm8994, unsigned short reg, 59 struct regmap *regmap;
60 int bytes, void *dest);
61 int (*write_dev)(struct wm8994 *wm8994, unsigned short reg,
62 int bytes, const void *src);
63
64 void *control_data;
65 60
66 int gpio_base; 61 int gpio_base;
67 int irq_base; 62 int irq_base;
diff --git a/include/linux/mfd/wm8994/pdata.h b/include/linux/mfd/wm8994/pdata.h
index d12f8d635a8..97cf4f27d64 100644
--- a/include/linux/mfd/wm8994/pdata.h
+++ b/include/linux/mfd/wm8994/pdata.h
@@ -26,7 +26,7 @@ struct wm8994_ldo_pdata {
26 struct regulator_init_data *init_data; 26 struct regulator_init_data *init_data;
27}; 27};
28 28
29#define WM8994_CONFIGURE_GPIO 0x8000 29#define WM8994_CONFIGURE_GPIO 0x10000
30 30
31#define WM8994_DRC_REGS 5 31#define WM8994_DRC_REGS 5
32#define WM8994_EQ_REGS 20 32#define WM8994_EQ_REGS 20
diff --git a/include/linux/mii.h b/include/linux/mii.h
index 359fba88027..103113a2fd1 100644
--- a/include/linux/mii.h
+++ b/include/linux/mii.h
@@ -128,6 +128,8 @@
128/* 1000BASE-T Control register */ 128/* 1000BASE-T Control register */
129#define ADVERTISE_1000FULL 0x0200 /* Advertise 1000BASE-T full duplex */ 129#define ADVERTISE_1000FULL 0x0200 /* Advertise 1000BASE-T full duplex */
130#define ADVERTISE_1000HALF 0x0100 /* Advertise 1000BASE-T half duplex */ 130#define ADVERTISE_1000HALF 0x0100 /* Advertise 1000BASE-T half duplex */
131#define CTL1000_AS_MASTER 0x0800
132#define CTL1000_ENABLE_MASTER 0x1000
131 133
132/* 1000BASE-T Status register */ 134/* 1000BASE-T Status register */
133#define LPA_1000LOCALRXOK 0x2000 /* Link partner local receiver status */ 135#define LPA_1000LOCALRXOK 0x2000 /* Link partner local receiver status */
diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h
index 18fd13028ba..c309b1ecdc1 100644
--- a/include/linux/miscdevice.h
+++ b/include/linux/miscdevice.h
@@ -40,6 +40,7 @@
40#define BTRFS_MINOR 234 40#define BTRFS_MINOR 234
41#define AUTOFS_MINOR 235 41#define AUTOFS_MINOR 235
42#define MAPPER_CTRL_MINOR 236 42#define MAPPER_CTRL_MINOR 236
43#define LOOP_CTRL_MINOR 237
43#define MISC_DYNAMIC_MINOR 255 44#define MISC_DYNAMIC_MINOR 255
44 45
45struct device; 46struct device;
diff --git a/include/linux/mlx4/cmd.h b/include/linux/mlx4/cmd.h
index 9a18667c13c..b56e4587208 100644
--- a/include/linux/mlx4/cmd.h
+++ b/include/linux/mlx4/cmd.h
@@ -123,6 +123,9 @@ enum {
123 /* debug commands */ 123 /* debug commands */
124 MLX4_CMD_QUERY_DEBUG_MSG = 0x2a, 124 MLX4_CMD_QUERY_DEBUG_MSG = 0x2a,
125 MLX4_CMD_SET_DEBUG_MSG = 0x2b, 125 MLX4_CMD_SET_DEBUG_MSG = 0x2b,
126
127 /* statistics commands */
128 MLX4_CMD_QUERY_IF_STAT = 0X54,
126}; 129};
127 130
128enum { 131enum {
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index 8985768e2c0..53ef894bfa0 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -37,7 +37,7 @@
37#include <linux/completion.h> 37#include <linux/completion.h>
38#include <linux/radix-tree.h> 38#include <linux/radix-tree.h>
39 39
40#include <asm/atomic.h> 40#include <linux/atomic.h>
41 41
42#define MAX_MSIX_P_PORT 17 42#define MAX_MSIX_P_PORT 17
43#define MAX_MSIX 64 43#define MAX_MSIX 64
@@ -58,22 +58,28 @@ enum {
58}; 58};
59 59
60enum { 60enum {
61 MLX4_DEV_CAP_FLAG_RC = 1 << 0, 61 MLX4_DEV_CAP_FLAG_RC = 1LL << 0,
62 MLX4_DEV_CAP_FLAG_UC = 1 << 1, 62 MLX4_DEV_CAP_FLAG_UC = 1LL << 1,
63 MLX4_DEV_CAP_FLAG_UD = 1 << 2, 63 MLX4_DEV_CAP_FLAG_UD = 1LL << 2,
64 MLX4_DEV_CAP_FLAG_SRQ = 1 << 6, 64 MLX4_DEV_CAP_FLAG_SRQ = 1LL << 6,
65 MLX4_DEV_CAP_FLAG_IPOIB_CSUM = 1 << 7, 65 MLX4_DEV_CAP_FLAG_IPOIB_CSUM = 1LL << 7,
66 MLX4_DEV_CAP_FLAG_BAD_PKEY_CNTR = 1 << 8, 66 MLX4_DEV_CAP_FLAG_BAD_PKEY_CNTR = 1LL << 8,
67 MLX4_DEV_CAP_FLAG_BAD_QKEY_CNTR = 1 << 9, 67 MLX4_DEV_CAP_FLAG_BAD_QKEY_CNTR = 1LL << 9,
68 MLX4_DEV_CAP_FLAG_DPDP = 1 << 12, 68 MLX4_DEV_CAP_FLAG_DPDP = 1LL << 12,
69 MLX4_DEV_CAP_FLAG_BLH = 1 << 15, 69 MLX4_DEV_CAP_FLAG_BLH = 1LL << 15,
70 MLX4_DEV_CAP_FLAG_MEM_WINDOW = 1 << 16, 70 MLX4_DEV_CAP_FLAG_MEM_WINDOW = 1LL << 16,
71 MLX4_DEV_CAP_FLAG_APM = 1 << 17, 71 MLX4_DEV_CAP_FLAG_APM = 1LL << 17,
72 MLX4_DEV_CAP_FLAG_ATOMIC = 1 << 18, 72 MLX4_DEV_CAP_FLAG_ATOMIC = 1LL << 18,
73 MLX4_DEV_CAP_FLAG_RAW_MCAST = 1 << 19, 73 MLX4_DEV_CAP_FLAG_RAW_MCAST = 1LL << 19,
74 MLX4_DEV_CAP_FLAG_UD_AV_PORT = 1 << 20, 74 MLX4_DEV_CAP_FLAG_UD_AV_PORT = 1LL << 20,
75 MLX4_DEV_CAP_FLAG_UD_MCAST = 1 << 21, 75 MLX4_DEV_CAP_FLAG_UD_MCAST = 1LL << 21,
76 MLX4_DEV_CAP_FLAG_IBOE = 1 << 30 76 MLX4_DEV_CAP_FLAG_IBOE = 1LL << 30,
77 MLX4_DEV_CAP_FLAG_UC_LOOPBACK = 1LL << 32,
78 MLX4_DEV_CAP_FLAG_WOL = 1LL << 38,
79 MLX4_DEV_CAP_FLAG_UDP_RSS = 1LL << 40,
80 MLX4_DEV_CAP_FLAG_VEP_UC_STEER = 1LL << 41,
81 MLX4_DEV_CAP_FLAG_VEP_MC_STEER = 1LL << 42,
82 MLX4_DEV_CAP_FLAG_COUNTERS = 1LL << 48
77}; 83};
78 84
79enum { 85enum {
@@ -253,15 +259,10 @@ struct mlx4_caps {
253 int mtt_entry_sz; 259 int mtt_entry_sz;
254 u32 max_msg_sz; 260 u32 max_msg_sz;
255 u32 page_size_cap; 261 u32 page_size_cap;
256 u32 flags; 262 u64 flags;
257 u32 bmme_flags; 263 u32 bmme_flags;
258 u32 reserved_lkey; 264 u32 reserved_lkey;
259 u16 stat_rate_support; 265 u16 stat_rate_support;
260 int udp_rss;
261 int loopback_support;
262 int vep_uc_steering;
263 int vep_mc_steering;
264 int wol;
265 u8 port_width_cap[MLX4_MAX_PORTS + 1]; 266 u8 port_width_cap[MLX4_MAX_PORTS + 1];
266 int max_gso_sz; 267 int max_gso_sz;
267 int reserved_qps_cnt[MLX4_NUM_QP_REGION]; 268 int reserved_qps_cnt[MLX4_NUM_QP_REGION];
@@ -274,6 +275,7 @@ struct mlx4_caps {
274 u8 supported_type[MLX4_MAX_PORTS + 1]; 275 u8 supported_type[MLX4_MAX_PORTS + 1];
275 u32 port_mask; 276 u32 port_mask;
276 enum mlx4_port_type possible_type[MLX4_MAX_PORTS + 1]; 277 enum mlx4_port_type possible_type[MLX4_MAX_PORTS + 1];
278 u32 max_counters;
277}; 279};
278 280
279struct mlx4_buf_list { 281struct mlx4_buf_list {
@@ -438,6 +440,17 @@ union mlx4_ext_av {
438 struct mlx4_eth_av eth; 440 struct mlx4_eth_av eth;
439}; 441};
440 442
443struct mlx4_counter {
444 u8 reserved1[3];
445 u8 counter_mode;
446 __be32 num_ifc;
447 u32 reserved2[2];
448 __be64 rx_frames;
449 __be64 rx_bytes;
450 __be64 tx_frames;
451 __be64 tx_bytes;
452};
453
441struct mlx4_dev { 454struct mlx4_dev {
442 struct pci_dev *pdev; 455 struct pci_dev *pdev;
443 unsigned long flags; 456 unsigned long flags;
@@ -568,4 +581,7 @@ void mlx4_release_eq(struct mlx4_dev *dev, int vec);
568int mlx4_wol_read(struct mlx4_dev *dev, u64 *config, int port); 581int mlx4_wol_read(struct mlx4_dev *dev, u64 *config, int port);
569int mlx4_wol_write(struct mlx4_dev *dev, u64 config, int port); 582int mlx4_wol_write(struct mlx4_dev *dev, u64 config, int port);
570 583
584int mlx4_counter_alloc(struct mlx4_dev *dev, u32 *idx);
585void mlx4_counter_free(struct mlx4_dev *dev, u32 idx);
586
571#endif /* MLX4_DEVICE_H */ 587#endif /* MLX4_DEVICE_H */
diff --git a/include/linux/mlx4/qp.h b/include/linux/mlx4/qp.h
index 9e9eb21056c..4001c8249db 100644
--- a/include/linux/mlx4/qp.h
+++ b/include/linux/mlx4/qp.h
@@ -54,7 +54,8 @@ enum mlx4_qp_optpar {
54 MLX4_QP_OPTPAR_RETRY_COUNT = 1 << 12, 54 MLX4_QP_OPTPAR_RETRY_COUNT = 1 << 12,
55 MLX4_QP_OPTPAR_RNR_RETRY = 1 << 13, 55 MLX4_QP_OPTPAR_RNR_RETRY = 1 << 13,
56 MLX4_QP_OPTPAR_ACK_TIMEOUT = 1 << 14, 56 MLX4_QP_OPTPAR_ACK_TIMEOUT = 1 << 14,
57 MLX4_QP_OPTPAR_SCHED_QUEUE = 1 << 16 57 MLX4_QP_OPTPAR_SCHED_QUEUE = 1 << 16,
58 MLX4_QP_OPTPAR_COUNTER_INDEX = 1 << 20
58}; 59};
59 60
60enum mlx4_qp_state { 61enum mlx4_qp_state {
@@ -99,7 +100,7 @@ struct mlx4_qp_path {
99 u8 fl; 100 u8 fl;
100 u8 reserved1[2]; 101 u8 reserved1[2];
101 u8 pkey_index; 102 u8 pkey_index;
102 u8 reserved2; 103 u8 counter_index;
103 u8 grh_mylmc; 104 u8 grh_mylmc;
104 __be16 rlid; 105 __be16 rlid;
105 u8 ackto; 106 u8 ackto;
@@ -111,8 +112,7 @@ struct mlx4_qp_path {
111 u8 sched_queue; 112 u8 sched_queue;
112 u8 vlan_index; 113 u8 vlan_index;
113 u8 reserved3[2]; 114 u8 reserved3[2];
114 u8 counter_index; 115 u8 reserved4[2];
115 u8 reserved4;
116 u8 dmac[6]; 116 u8 dmac[6];
117}; 117};
118 118
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 9670f71d7be..d1d9840093f 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -15,6 +15,7 @@
15#include <linux/range.h> 15#include <linux/range.h>
16#include <linux/pfn.h> 16#include <linux/pfn.h>
17#include <linux/bit_spinlock.h> 17#include <linux/bit_spinlock.h>
18#include <linux/shrinker.h>
18 19
19struct mempolicy; 20struct mempolicy;
20struct anon_vma; 21struct anon_vma;
@@ -355,36 +356,50 @@ static inline struct page *compound_head(struct page *page)
355 return page; 356 return page;
356} 357}
357 358
359/*
360 * The atomic page->_mapcount, starts from -1: so that transitions
361 * both from it and to it can be tracked, using atomic_inc_and_test
362 * and atomic_add_negative(-1).
363 */
364static inline void reset_page_mapcount(struct page *page)
365{
366 atomic_set(&(page)->_mapcount, -1);
367}
368
369static inline int page_mapcount(struct page *page)
370{
371 return atomic_read(&(page)->_mapcount) + 1;
372}
373
358static inline int page_count(struct page *page) 374static inline int page_count(struct page *page)
359{ 375{
360 return atomic_read(&compound_head(page)->_count); 376 return atomic_read(&compound_head(page)->_count);
361} 377}
362 378
379static inline void get_huge_page_tail(struct page *page)
380{
381 /*
382 * __split_huge_page_refcount() cannot run
383 * from under us.
384 */
385 VM_BUG_ON(page_mapcount(page) < 0);
386 VM_BUG_ON(atomic_read(&page->_count) != 0);
387 atomic_inc(&page->_mapcount);
388}
389
390extern bool __get_page_tail(struct page *page);
391
363static inline void get_page(struct page *page) 392static inline void get_page(struct page *page)
364{ 393{
394 if (unlikely(PageTail(page)))
395 if (likely(__get_page_tail(page)))
396 return;
365 /* 397 /*
366 * Getting a normal page or the head of a compound page 398 * Getting a normal page or the head of a compound page
367 * requires to already have an elevated page->_count. Only if 399 * requires to already have an elevated page->_count.
368 * we're getting a tail page, the elevated page->_count is
369 * required only in the head page, so for tail pages the
370 * bugcheck only verifies that the page->_count isn't
371 * negative.
372 */ 400 */
373 VM_BUG_ON(atomic_read(&page->_count) < !PageTail(page)); 401 VM_BUG_ON(atomic_read(&page->_count) <= 0);
374 atomic_inc(&page->_count); 402 atomic_inc(&page->_count);
375 /*
376 * Getting a tail page will elevate both the head and tail
377 * page->_count(s).
378 */
379 if (unlikely(PageTail(page))) {
380 /*
381 * This is safe only because
382 * __split_huge_page_refcount can't run under
383 * get_page().
384 */
385 VM_BUG_ON(atomic_read(&page->first_page->_count) <= 0);
386 atomic_inc(&page->first_page->_count);
387 }
388} 403}
389 404
390static inline struct page *virt_to_head_page(const void *x) 405static inline struct page *virt_to_head_page(const void *x)
@@ -636,7 +651,7 @@ static inline pte_t maybe_mkwrite(pte_t pte, struct vm_area_struct *vma)
636#define SECTIONS_MASK ((1UL << SECTIONS_WIDTH) - 1) 651#define SECTIONS_MASK ((1UL << SECTIONS_WIDTH) - 1)
637#define ZONEID_MASK ((1UL << ZONEID_SHIFT) - 1) 652#define ZONEID_MASK ((1UL << ZONEID_SHIFT) - 1)
638 653
639static inline enum zone_type page_zonenum(struct page *page) 654static inline enum zone_type page_zonenum(const struct page *page)
640{ 655{
641 return (page->flags >> ZONES_PGSHIFT) & ZONES_MASK; 656 return (page->flags >> ZONES_PGSHIFT) & ZONES_MASK;
642} 657}
@@ -664,15 +679,15 @@ static inline int zone_to_nid(struct zone *zone)
664} 679}
665 680
666#ifdef NODE_NOT_IN_PAGE_FLAGS 681#ifdef NODE_NOT_IN_PAGE_FLAGS
667extern int page_to_nid(struct page *page); 682extern int page_to_nid(const struct page *page);
668#else 683#else
669static inline int page_to_nid(struct page *page) 684static inline int page_to_nid(const struct page *page)
670{ 685{
671 return (page->flags >> NODES_PGSHIFT) & NODES_MASK; 686 return (page->flags >> NODES_PGSHIFT) & NODES_MASK;
672} 687}
673#endif 688#endif
674 689
675static inline struct zone *page_zone(struct page *page) 690static inline struct zone *page_zone(const struct page *page)
676{ 691{
677 return &NODE_DATA(page_to_nid(page))->node_zones[page_zonenum(page)]; 692 return &NODE_DATA(page_to_nid(page))->node_zones[page_zonenum(page)];
678} 693}
@@ -684,7 +699,7 @@ static inline void set_page_section(struct page *page, unsigned long section)
684 page->flags |= (section & SECTIONS_MASK) << SECTIONS_PGSHIFT; 699 page->flags |= (section & SECTIONS_MASK) << SECTIONS_PGSHIFT;
685} 700}
686 701
687static inline unsigned long page_to_section(struct page *page) 702static inline unsigned long page_to_section(const struct page *page)
688{ 703{
689 return (page->flags >> SECTIONS_PGSHIFT) & SECTIONS_MASK; 704 return (page->flags >> SECTIONS_PGSHIFT) & SECTIONS_MASK;
690} 705}
@@ -717,7 +732,7 @@ static inline void set_page_links(struct page *page, enum zone_type zone,
717 */ 732 */
718#include <linux/vmstat.h> 733#include <linux/vmstat.h>
719 734
720static __always_inline void *lowmem_page_address(struct page *page) 735static __always_inline void *lowmem_page_address(const struct page *page)
721{ 736{
722 return __va(PFN_PHYS(page_to_pfn(page))); 737 return __va(PFN_PHYS(page_to_pfn(page)));
723} 738}
@@ -736,7 +751,7 @@ static __always_inline void *lowmem_page_address(struct page *page)
736#endif 751#endif
737 752
738#if defined(HASHED_PAGE_VIRTUAL) 753#if defined(HASHED_PAGE_VIRTUAL)
739void *page_address(struct page *page); 754void *page_address(const struct page *page);
740void set_page_address(struct page *page, void *virtual); 755void set_page_address(struct page *page, void *virtual);
741void page_address_init(void); 756void page_address_init(void);
742#endif 757#endif
@@ -803,21 +818,6 @@ static inline pgoff_t page_index(struct page *page)
803} 818}
804 819
805/* 820/*
806 * The atomic page->_mapcount, like _count, starts from -1:
807 * so that transitions both from it and to it can be tracked,
808 * using atomic_inc_and_test and atomic_add_negative(-1).
809 */
810static inline void reset_page_mapcount(struct page *page)
811{
812 atomic_set(&(page)->_mapcount, -1);
813}
814
815static inline int page_mapcount(struct page *page)
816{
817 return atomic_read(&(page)->_mapcount) + 1;
818}
819
820/*
821 * Return true if this page is mapped into pagetables. 821 * Return true if this page is mapped into pagetables.
822 */ 822 */
823static inline int page_mapped(struct page *page) 823static inline int page_mapped(struct page *page)
@@ -871,6 +871,7 @@ extern bool skip_free_areas_node(unsigned int flags, int nid);
871 871
872int shmem_lock(struct file *file, int lock, struct user_struct *user); 872int shmem_lock(struct file *file, int lock, struct user_struct *user);
873struct file *shmem_file_setup(const char *name, loff_t size, unsigned long flags); 873struct file *shmem_file_setup(const char *name, loff_t size, unsigned long flags);
874void shmem_set_file(struct vm_area_struct *vma, struct file *file);
874int shmem_zero_setup(struct vm_area_struct *); 875int shmem_zero_setup(struct vm_area_struct *);
875 876
876extern int can_do_mlock(void); 877extern int can_do_mlock(void);
@@ -910,6 +911,8 @@ unsigned long unmap_vmas(struct mmu_gather *tlb,
910 * @pte_entry: if set, called for each non-empty PTE (4th-level) entry 911 * @pte_entry: if set, called for each non-empty PTE (4th-level) entry
911 * @pte_hole: if set, called for each hole at all levels 912 * @pte_hole: if set, called for each hole at all levels
912 * @hugetlb_entry: if set, called for each hugetlb entry 913 * @hugetlb_entry: if set, called for each hugetlb entry
914 * *Caution*: The caller must hold mmap_sem() if @hugetlb_entry
915 * is used.
913 * 916 *
914 * (see walk_page_range for more details) 917 * (see walk_page_range for more details)
915 */ 918 */
@@ -959,6 +962,8 @@ int invalidate_inode_page(struct page *page);
959#ifdef CONFIG_MMU 962#ifdef CONFIG_MMU
960extern int handle_mm_fault(struct mm_struct *mm, struct vm_area_struct *vma, 963extern int handle_mm_fault(struct mm_struct *mm, struct vm_area_struct *vma,
961 unsigned long address, unsigned int flags); 964 unsigned long address, unsigned int flags);
965extern int fixup_user_fault(struct task_struct *tsk, struct mm_struct *mm,
966 unsigned long address, unsigned int fault_flags);
962#else 967#else
963static inline int handle_mm_fault(struct mm_struct *mm, 968static inline int handle_mm_fault(struct mm_struct *mm,
964 struct vm_area_struct *vma, unsigned long address, 969 struct vm_area_struct *vma, unsigned long address,
@@ -968,6 +973,14 @@ static inline int handle_mm_fault(struct mm_struct *mm,
968 BUG(); 973 BUG();
969 return VM_FAULT_SIGBUS; 974 return VM_FAULT_SIGBUS;
970} 975}
976static inline int fixup_user_fault(struct task_struct *tsk,
977 struct mm_struct *mm, unsigned long address,
978 unsigned int fault_flags)
979{
980 /* should never happen if there's no MMU */
981 BUG();
982 return -EFAULT;
983}
971#endif 984#endif
972 985
973extern int make_pages_present(unsigned long addr, unsigned long end); 986extern int make_pages_present(unsigned long addr, unsigned long end);
@@ -1121,44 +1134,6 @@ static inline void sync_mm_rss(struct task_struct *task, struct mm_struct *mm)
1121} 1134}
1122#endif 1135#endif
1123 1136
1124/*
1125 * This struct is used to pass information from page reclaim to the shrinkers.
1126 * We consolidate the values for easier extention later.
1127 */
1128struct shrink_control {
1129 gfp_t gfp_mask;
1130
1131 /* How many slab objects shrinker() should scan and try to reclaim */
1132 unsigned long nr_to_scan;
1133};
1134
1135/*
1136 * A callback you can register to apply pressure to ageable caches.
1137 *
1138 * 'sc' is passed shrink_control which includes a count 'nr_to_scan'
1139 * and a 'gfpmask'. It should look through the least-recently-used
1140 * 'nr_to_scan' entries and attempt to free them up. It should return
1141 * the number of objects which remain in the cache. If it returns -1, it means
1142 * it cannot do any scanning at this time (eg. there is a risk of deadlock).
1143 *
1144 * The 'gfpmask' refers to the allocation we are currently trying to
1145 * fulfil.
1146 *
1147 * Note that 'shrink' will be passed nr_to_scan == 0 when the VM is
1148 * querying the cache size, so a fastpath for that case is appropriate.
1149 */
1150struct shrinker {
1151 int (*shrink)(struct shrinker *, struct shrink_control *sc);
1152 int seeks; /* seeks to recreate an obj */
1153
1154 /* These are for internal use */
1155 struct list_head list;
1156 long nr; /* objs pending delete */
1157};
1158#define DEFAULT_SEEKS 2 /* A good number if you don't know better. */
1159extern void register_shrinker(struct shrinker *);
1160extern void unregister_shrinker(struct shrinker *);
1161
1162int vma_wants_writenotify(struct vm_area_struct *vma); 1137int vma_wants_writenotify(struct vm_area_struct *vma);
1163 1138
1164extern pte_t *__get_locked_pte(struct mm_struct *mm, unsigned long addr, 1139extern pte_t *__get_locked_pte(struct mm_struct *mm, unsigned long addr,
@@ -1313,6 +1288,7 @@ extern void remove_active_range(unsigned int nid, unsigned long start_pfn,
1313 unsigned long end_pfn); 1288 unsigned long end_pfn);
1314extern void remove_all_active_ranges(void); 1289extern void remove_all_active_ranges(void);
1315void sort_node_map(void); 1290void sort_node_map(void);
1291unsigned long node_map_pfn_alignment(void);
1316unsigned long __absent_pages_in_range(int nid, unsigned long start_pfn, 1292unsigned long __absent_pages_in_range(int nid, unsigned long start_pfn,
1317 unsigned long end_pfn); 1293 unsigned long end_pfn);
1318extern unsigned long absent_pages_in_range(unsigned long start_pfn, 1294extern unsigned long absent_pages_in_range(unsigned long start_pfn,
@@ -1445,8 +1421,7 @@ extern int do_munmap(struct mm_struct *, unsigned long, size_t);
1445 1421
1446extern unsigned long do_brk(unsigned long, unsigned long); 1422extern unsigned long do_brk(unsigned long, unsigned long);
1447 1423
1448/* filemap.c */ 1424/* truncate.c */
1449extern unsigned long page_unuse(struct page *);
1450extern void truncate_inode_pages(struct address_space *, loff_t); 1425extern void truncate_inode_pages(struct address_space *, loff_t);
1451extern void truncate_inode_pages_range(struct address_space *, 1426extern void truncate_inode_pages_range(struct address_space *,
1452 loff_t lstart, loff_t lend); 1427 loff_t lstart, loff_t lend);
@@ -1633,6 +1608,7 @@ enum mf_flags {
1633}; 1608};
1634extern void memory_failure(unsigned long pfn, int trapno); 1609extern void memory_failure(unsigned long pfn, int trapno);
1635extern int __memory_failure(unsigned long pfn, int trapno, int flags); 1610extern int __memory_failure(unsigned long pfn, int trapno, int flags);
1611extern void memory_failure_queue(unsigned long pfn, int trapno, int flags);
1636extern int unpoison_memory(unsigned long pfn); 1612extern int unpoison_memory(unsigned long pfn);
1637extern int sysctl_memory_failure_early_kill; 1613extern int sysctl_memory_failure_early_kill;
1638extern int sysctl_memory_failure_recovery; 1614extern int sysctl_memory_failure_recovery;
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index 027935c86c6..10a2f62cd56 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -30,23 +30,74 @@ struct address_space;
30 * moment. Note that we have no way to track which tasks are using 30 * moment. Note that we have no way to track which tasks are using
31 * a page, though if it is a pagecache page, rmap structures can tell us 31 * a page, though if it is a pagecache page, rmap structures can tell us
32 * who is mapping it. 32 * who is mapping it.
33 *
34 * The objects in struct page are organized in double word blocks in
35 * order to allows us to use atomic double word operations on portions
36 * of struct page. That is currently only used by slub but the arrangement
37 * allows the use of atomic double word operations on the flags/mapping
38 * and lru list pointers also.
33 */ 39 */
34struct page { 40struct page {
41 /* First double word block */
35 unsigned long flags; /* Atomic flags, some possibly 42 unsigned long flags; /* Atomic flags, some possibly
36 * updated asynchronously */ 43 * updated asynchronously */
37 atomic_t _count; /* Usage count, see below. */ 44 struct address_space *mapping; /* If low bit clear, points to
38 union { 45 * inode address_space, or NULL.
39 atomic_t _mapcount; /* Count of ptes mapped in mms, 46 * If page mapped as anonymous
40 * to show when page is mapped 47 * memory, low bit is set, and
41 * & limit reverse map searches. 48 * it points to anon_vma object:
49 * see PAGE_MAPPING_ANON below.
50 */
51 /* Second double word */
52 struct {
53 union {
54 pgoff_t index; /* Our offset within mapping. */
55 void *freelist; /* slub first free object */
56 };
57
58 union {
59 /* Used for cmpxchg_double in slub */
60 unsigned long counters;
61
62 struct {
63
64 union {
65 /*
66 * Count of ptes mapped in
67 * mms, to show when page is
68 * mapped & limit reverse map
69 * searches.
70 *
71 * Used also for tail pages
72 * refcounting instead of
73 * _count. Tail pages cannot
74 * be mapped and keeping the
75 * tail page _count zero at
76 * all times guarantees
77 * get_page_unless_zero() will
78 * never succeed on tail
79 * pages.
42 */ 80 */
43 struct { /* SLUB */ 81 atomic_t _mapcount;
44 u16 inuse; 82
45 u16 objects; 83 struct {
84 unsigned inuse:16;
85 unsigned objects:15;
86 unsigned frozen:1;
87 };
88 };
89 atomic_t _count; /* Usage count, see below. */
90 };
46 }; 91 };
47 }; 92 };
93
94 /* Third double word block */
95 struct list_head lru; /* Pageout list, eg. active_list
96 * protected by zone->lru_lock !
97 */
98
99 /* Remainder is not double word aligned */
48 union { 100 union {
49 struct {
50 unsigned long private; /* Mapping-private opaque data: 101 unsigned long private; /* Mapping-private opaque data:
51 * usually used for buffer_heads 102 * usually used for buffer_heads
52 * if PagePrivate set; used for 103 * if PagePrivate set; used for
@@ -54,27 +105,13 @@ struct page {
54 * indicates order in the buddy 105 * indicates order in the buddy
55 * system if PG_buddy is set. 106 * system if PG_buddy is set.
56 */ 107 */
57 struct address_space *mapping; /* If low bit clear, points to
58 * inode address_space, or NULL.
59 * If page mapped as anonymous
60 * memory, low bit is set, and
61 * it points to anon_vma object:
62 * see PAGE_MAPPING_ANON below.
63 */
64 };
65#if USE_SPLIT_PTLOCKS 108#if USE_SPLIT_PTLOCKS
66 spinlock_t ptl; 109 spinlock_t ptl;
67#endif 110#endif
68 struct kmem_cache *slab; /* SLUB: Pointer to slab */ 111 struct kmem_cache *slab; /* SLUB: Pointer to slab */
69 struct page *first_page; /* Compound tail pages */ 112 struct page *first_page; /* Compound tail pages */
70 }; 113 };
71 union { 114
72 pgoff_t index; /* Our offset within mapping. */
73 void *freelist; /* SLUB: freelist req. slab lock */
74 };
75 struct list_head lru; /* Pageout list, eg. active_list
76 * protected by zone->lru_lock !
77 */
78 /* 115 /*
79 * On machines where all RAM is mapped into kernel address space, 116 * On machines where all RAM is mapped into kernel address space,
80 * we can simply calculate the virtual address. On machines with 117 * we can simply calculate the virtual address. On machines with
@@ -100,7 +137,16 @@ struct page {
100 */ 137 */
101 void *shadow; 138 void *shadow;
102#endif 139#endif
103}; 140}
141/*
142 * If another subsystem starts using the double word pairing for atomic
143 * operations on struct page then it must change the #if to ensure
144 * proper alignment of the page struct.
145 */
146#if defined(CONFIG_SLUB) && defined(CONFIG_CMPXCHG_LOCAL)
147 __attribute__((__aligned__(2*sizeof(unsigned long))))
148#endif
149;
104 150
105typedef unsigned long __nocast vm_flags_t; 151typedef unsigned long __nocast vm_flags_t;
106 152
diff --git a/include/linux/mman.h b/include/linux/mman.h
index 9872d6ca58a..8b74e9b1d0a 100644
--- a/include/linux/mman.h
+++ b/include/linux/mman.h
@@ -14,7 +14,7 @@
14#include <linux/mm.h> 14#include <linux/mm.h>
15#include <linux/percpu_counter.h> 15#include <linux/percpu_counter.h>
16 16
17#include <asm/atomic.h> 17#include <linux/atomic.h>
18 18
19extern int sysctl_overcommit_memory; 19extern int sysctl_overcommit_memory;
20extern int sysctl_overcommit_ratio; 20extern int sysctl_overcommit_ratio;
diff --git a/include/linux/mmc/boot.h b/include/linux/mmc/boot.h
index 39d787c229c..23acc3baa07 100644
--- a/include/linux/mmc/boot.h
+++ b/include/linux/mmc/boot.h
@@ -1,7 +1,7 @@
1#ifndef MMC_BOOT_H 1#ifndef LINUX_MMC_BOOT_H
2#define MMC_BOOT_H 2#define LINUX_MMC_BOOT_H
3 3
4enum { MMC_PROGRESS_ENTER, MMC_PROGRESS_INIT, 4enum { MMC_PROGRESS_ENTER, MMC_PROGRESS_INIT,
5 MMC_PROGRESS_LOAD, MMC_PROGRESS_DONE }; 5 MMC_PROGRESS_LOAD, MMC_PROGRESS_DONE };
6 6
7#endif 7#endif /* LINUX_MMC_BOOT_H */
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index 6ad43554ac0..9178aa48209 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -77,6 +77,12 @@ struct mmc_ext_csd {
77 u8 raw_sec_feature_support;/* 231 */ 77 u8 raw_sec_feature_support;/* 231 */
78 u8 raw_trim_mult; /* 232 */ 78 u8 raw_trim_mult; /* 232 */
79 u8 raw_sectors[4]; /* 212 - 4 bytes */ 79 u8 raw_sectors[4]; /* 212 - 4 bytes */
80 bool hpi_en; /* HPI enablebit */
81 bool hpi; /* HPI support bit */
82 unsigned int hpi_cmd; /* cmd used as HPI */
83 u8 out_of_int_time; /* out of int time */
84 bool bk_ops; /* BK ops support bit */
85 bool bk_ops_en; /* BK ops enable bit */
80}; 86};
81 87
82struct sd_scr { 88struct sd_scr {
@@ -176,6 +182,8 @@ struct mmc_card {
176#define MMC_STATE_BLOCKADDR (1<<3) /* card uses block-addressing */ 182#define MMC_STATE_BLOCKADDR (1<<3) /* card uses block-addressing */
177#define MMC_STATE_HIGHSPEED_DDR (1<<4) /* card is in high speed mode */ 183#define MMC_STATE_HIGHSPEED_DDR (1<<4) /* card is in high speed mode */
178#define MMC_STATE_ULTRAHIGHSPEED (1<<5) /* card is in ultra high speed mode */ 184#define MMC_STATE_ULTRAHIGHSPEED (1<<5) /* card is in ultra high speed mode */
185#define MMC_STATE_DOING_BKOPS (1<<6) /* Card doing bkops */
186#define MMC_STATE_NEED_BKOPS (1<<7) /* Card needs to do bkops */
179#define MMC_CARD_SDXC (1<<6) /* card is SDXC */ 187#define MMC_CARD_SDXC (1<<6) /* card is SDXC */
180 unsigned int quirks; /* card quirks */ 188 unsigned int quirks; /* card quirks */
181#define MMC_QUIRK_LENIENT_FN0 (1<<0) /* allow SDIO FN0 writes outside of the VS CCCR range */ 189#define MMC_QUIRK_LENIENT_FN0 (1<<0) /* allow SDIO FN0 writes outside of the VS CCCR range */
@@ -312,9 +320,10 @@ static inline void __maybe_unused remove_quirk(struct mmc_card *card, int data)
312#define mmc_card_highspeed(c) ((c)->state & MMC_STATE_HIGHSPEED) 320#define mmc_card_highspeed(c) ((c)->state & MMC_STATE_HIGHSPEED)
313#define mmc_card_blockaddr(c) ((c)->state & MMC_STATE_BLOCKADDR) 321#define mmc_card_blockaddr(c) ((c)->state & MMC_STATE_BLOCKADDR)
314#define mmc_card_ddr_mode(c) ((c)->state & MMC_STATE_HIGHSPEED_DDR) 322#define mmc_card_ddr_mode(c) ((c)->state & MMC_STATE_HIGHSPEED_DDR)
315#define mmc_sd_card_uhs(c) ((c)->state & MMC_STATE_ULTRAHIGHSPEED) 323#define mmc_sd_card_uhs(c) ((c)->state & MMC_STATE_ULTRAHIGHSPEED)
316#define mmc_card_ext_capacity(c) ((c)->state & MMC_CARD_SDXC) 324#define mmc_card_ext_capacity(c) ((c)->state & MMC_CARD_SDXC)
317 325#define mmc_card_doing_bkops(c) ((c)->state & MMC_STATE_DOING_BKOPS)
326#define mmc_card_need_bkops(c) ((c)->state & MMC_STATE_NEED_BKOPS)
318#define mmc_card_set_present(c) ((c)->state |= MMC_STATE_PRESENT) 327#define mmc_card_set_present(c) ((c)->state |= MMC_STATE_PRESENT)
319#define mmc_card_set_readonly(c) ((c)->state |= MMC_STATE_READONLY) 328#define mmc_card_set_readonly(c) ((c)->state |= MMC_STATE_READONLY)
320#define mmc_card_set_highspeed(c) ((c)->state |= MMC_STATE_HIGHSPEED) 329#define mmc_card_set_highspeed(c) ((c)->state |= MMC_STATE_HIGHSPEED)
@@ -356,6 +365,11 @@ static inline void __maybe_unused remove_quirk_sd(struct mmc_card *card,
356 if (mmc_card_sd(card)) 365 if (mmc_card_sd(card))
357 card->quirks &= ~data; 366 card->quirks &= ~data;
358} 367}
368#define mmc_card_set_doing_bkops(c) ((c)->state |= MMC_STATE_DOING_BKOPS)
369#define mmc_card_set_need_bkops(c) ((c)->state |= MMC_STATE_NEED_BKOPS)
370
371#define mmc_card_clr_doing_bkops(c) ((c)->state &= ~MMC_STATE_DOING_BKOPS)
372#define mmc_card_clr_need_bkops(c) ((c)->state &= ~MMC_STATE_NEED_BKOPS)
359 373
360static inline int mmc_card_lenient_fn0(const struct mmc_card *c) 374static inline int mmc_card_lenient_fn0(const struct mmc_card *c)
361{ 375{
@@ -403,4 +417,4 @@ extern void mmc_unregister_driver(struct mmc_driver *);
403extern void mmc_fixup_device(struct mmc_card *card, 417extern void mmc_fixup_device(struct mmc_card *card,
404 const struct mmc_fixup *table); 418 const struct mmc_fixup *table);
405 419
406#endif 420#endif /* LINUX_MMC_CARD_H */
diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h
index b6718e549a5..c3e55fa63fb 100644
--- a/include/linux/mmc/core.h
+++ b/include/linux/mmc/core.h
@@ -117,6 +117,7 @@ struct mmc_data {
117 117
118 unsigned int sg_len; /* size of scatter list */ 118 unsigned int sg_len; /* size of scatter list */
119 struct scatterlist *sg; /* I/O scatter list */ 119 struct scatterlist *sg; /* I/O scatter list */
120 s32 host_cookie; /* host private data */
120}; 121};
121 122
122struct mmc_request { 123struct mmc_request {
@@ -125,12 +126,18 @@ struct mmc_request {
125 struct mmc_data *data; 126 struct mmc_data *data;
126 struct mmc_command *stop; 127 struct mmc_command *stop;
127 128
128 void *done_data; /* completion data */ 129 struct completion completion;
129 void (*done)(struct mmc_request *);/* completion function */ 130 void (*done)(struct mmc_request *);/* completion function */
130}; 131};
131 132
132struct mmc_host; 133struct mmc_host;
133struct mmc_card; 134struct mmc_card;
135struct mmc_async_req;
136
137extern struct mmc_async_req *mmc_start_req(struct mmc_host *,
138 struct mmc_async_req *, int *);
139extern int mmc_interrupt_hpi(struct mmc_card *);
140extern int mmc_bkops_start(struct mmc_card *card, bool is_synchronous);
134 141
135extern void mmc_wait_for_req(struct mmc_host *, struct mmc_request *); 142extern void mmc_wait_for_req(struct mmc_host *, struct mmc_request *);
136extern int mmc_wait_for_cmd(struct mmc_host *, struct mmc_command *, int); 143extern int mmc_wait_for_cmd(struct mmc_host *, struct mmc_command *, int);
@@ -155,6 +162,7 @@ extern int mmc_can_trim(struct mmc_card *card);
155extern int mmc_can_secure_erase_trim(struct mmc_card *card); 162extern int mmc_can_secure_erase_trim(struct mmc_card *card);
156extern int mmc_erase_group_aligned(struct mmc_card *card, unsigned int from, 163extern int mmc_erase_group_aligned(struct mmc_card *card, unsigned int from,
157 unsigned int nr); 164 unsigned int nr);
165extern unsigned int mmc_calc_max_discard(struct mmc_card *card);
158 166
159extern int mmc_set_blocklen(struct mmc_card *card, unsigned int blocklen); 167extern int mmc_set_blocklen(struct mmc_card *card, unsigned int blocklen);
160 168
@@ -179,4 +187,4 @@ static inline void mmc_claim_host(struct mmc_host *host)
179 187
180extern u32 mmc_vddrange_to_ocrmask(int vdd_min, int vdd_max); 188extern u32 mmc_vddrange_to_ocrmask(int vdd_min, int vdd_max);
181 189
182#endif 190#endif /* LINUX_MMC_CORE_H */
diff --git a/include/linux/mmc/dw_mmc.h b/include/linux/mmc/dw_mmc.h
index bdd7ceeb99e..6b46819705d 100644
--- a/include/linux/mmc/dw_mmc.h
+++ b/include/linux/mmc/dw_mmc.h
@@ -11,8 +11,8 @@
11 * (at your option) any later version. 11 * (at your option) any later version.
12 */ 12 */
13 13
14#ifndef _LINUX_MMC_DW_MMC_H_ 14#ifndef LINUX_MMC_DW_MMC_H
15#define _LINUX_MMC_DW_MMC_H_ 15#define LINUX_MMC_DW_MMC_H
16 16
17#define MAX_MCI_SLOTS 2 17#define MAX_MCI_SLOTS 2
18 18
@@ -48,6 +48,7 @@ struct mmc_data;
48 * @data: The data currently being transferred, or NULL if no data 48 * @data: The data currently being transferred, or NULL if no data
49 * transfer is in progress. 49 * transfer is in progress.
50 * @use_dma: Whether DMA channel is initialized or not. 50 * @use_dma: Whether DMA channel is initialized or not.
51 * @using_dma: Whether DMA is in use for the current transfer.
51 * @sg_dma: Bus address of DMA buffer. 52 * @sg_dma: Bus address of DMA buffer.
52 * @sg_cpu: Virtual address of DMA buffer. 53 * @sg_cpu: Virtual address of DMA buffer.
53 * @dma_ops: Pointer to platform-specific DMA callbacks. 54 * @dma_ops: Pointer to platform-specific DMA callbacks.
@@ -74,7 +75,11 @@ struct mmc_data;
74 * @pdev: Platform device associated with the MMC controller. 75 * @pdev: Platform device associated with the MMC controller.
75 * @pdata: Platform data associated with the MMC controller. 76 * @pdata: Platform data associated with the MMC controller.
76 * @slot: Slots sharing this MMC controller. 77 * @slot: Slots sharing this MMC controller.
78 * @fifo_depth: depth of FIFO.
77 * @data_shift: log2 of FIFO item size. 79 * @data_shift: log2 of FIFO item size.
80 * @part_buf_start: Start index in part_buf.
81 * @part_buf_count: Bytes of partial data in part_buf.
82 * @part_buf: Simple buffer for partial fifo reads/writes.
78 * @push_data: Pointer to FIFO push function. 83 * @push_data: Pointer to FIFO push function.
79 * @pull_data: Pointer to FIFO pull function. 84 * @pull_data: Pointer to FIFO pull function.
80 * @quirks: Set of quirks that apply to specific versions of the IP. 85 * @quirks: Set of quirks that apply to specific versions of the IP.
@@ -117,6 +122,7 @@ struct dw_mci {
117 122
118 /* DMA interface members*/ 123 /* DMA interface members*/
119 int use_dma; 124 int use_dma;
125 int using_dma;
120 126
121 dma_addr_t sg_dma; 127 dma_addr_t sg_dma;
122 void *sg_cpu; 128 void *sg_cpu;
@@ -131,7 +137,7 @@ struct dw_mci {
131 u32 stop_cmdr; 137 u32 stop_cmdr;
132 u32 dir_status; 138 u32 dir_status;
133 struct tasklet_struct tasklet; 139 struct tasklet_struct tasklet;
134 struct tasklet_struct card_tasklet; 140 struct work_struct card_work;
135 unsigned long pending_events; 141 unsigned long pending_events;
136 unsigned long completed_events; 142 unsigned long completed_events;
137 enum dw_mci_state state; 143 enum dw_mci_state state;
@@ -146,7 +152,15 @@ struct dw_mci {
146 struct dw_mci_slot *slot[MAX_MCI_SLOTS]; 152 struct dw_mci_slot *slot[MAX_MCI_SLOTS];
147 153
148 /* FIFO push and pull */ 154 /* FIFO push and pull */
155 int fifo_depth;
149 int data_shift; 156 int data_shift;
157 u8 part_buf_start;
158 u8 part_buf_count;
159 union {
160 u16 part_buf16;
161 u32 part_buf32;
162 u64 part_buf;
163 };
150 void (*push_data)(struct dw_mci *host, void *buf, int cnt); 164 void (*push_data)(struct dw_mci *host, void *buf, int cnt);
151 void (*pull_data)(struct dw_mci *host, void *buf, int cnt); 165 void (*pull_data)(struct dw_mci *host, void *buf, int cnt);
152 166
@@ -196,6 +210,12 @@ struct dw_mci_board {
196 unsigned int bus_hz; /* Bus speed */ 210 unsigned int bus_hz; /* Bus speed */
197 211
198 unsigned int caps; /* Capabilities */ 212 unsigned int caps; /* Capabilities */
213 /*
214 * Override fifo depth. If 0, autodetect it from the FIFOTH register,
215 * but note that this may not be reliable after a bootloader has used
216 * it.
217 */
218 unsigned int fifo_depth;
199 219
200 /* delay in mS before detecting cards after interrupt */ 220 /* delay in mS before detecting cards after interrupt */
201 u32 detect_delay_ms; 221 u32 detect_delay_ms;
@@ -219,4 +239,4 @@ struct dw_mci_board {
219 struct block_settings *blk_settings; 239 struct block_settings *blk_settings;
220}; 240};
221 241
222#endif /* _LINUX_MMC_DW_MMC_H_ */ 242#endif /* LINUX_MMC_DW_MMC_H */
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 1ee4424462e..8c0bf3f2a36 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -12,6 +12,7 @@
12 12
13#include <linux/leds.h> 13#include <linux/leds.h>
14#include <linux/sched.h> 14#include <linux/sched.h>
15#include <linux/wakelock.h>
15 16
16#include <linux/mmc/core.h> 17#include <linux/mmc/core.h>
17#include <linux/mmc/pm.h> 18#include <linux/mmc/pm.h>
@@ -56,8 +57,6 @@ struct mmc_ios {
56#define MMC_TIMING_UHS_SDR104 4 57#define MMC_TIMING_UHS_SDR104 4
57#define MMC_TIMING_UHS_DDR50 5 58#define MMC_TIMING_UHS_DDR50 5
58 59
59 unsigned char ddr; /* dual data rate used */
60
61#define MMC_SDR_MODE 0 60#define MMC_SDR_MODE 0
62#define MMC_1_2V_DDR_MODE 1 61#define MMC_1_2V_DDR_MODE 1
63#define MMC_1_8V_DDR_MODE 2 62#define MMC_1_8V_DDR_MODE 2
@@ -106,6 +105,15 @@ struct mmc_host_ops {
106 */ 105 */
107 int (*enable)(struct mmc_host *host); 106 int (*enable)(struct mmc_host *host);
108 int (*disable)(struct mmc_host *host, int lazy); 107 int (*disable)(struct mmc_host *host, int lazy);
108 /*
109 * It is optional for the host to implement pre_req and post_req in
110 * order to support double buffering of requests (prepare one
111 * request while another request is active).
112 */
113 void (*post_req)(struct mmc_host *host, struct mmc_request *req,
114 int err);
115 void (*pre_req)(struct mmc_host *host, struct mmc_request *req,
116 bool is_first_req);
109 void (*request)(struct mmc_host *host, struct mmc_request *req); 117 void (*request)(struct mmc_host *host, struct mmc_request *req);
110 /* 118 /*
111 * Avoid calling these three functions too often or in a "fast path", 119 * Avoid calling these three functions too often or in a "fast path",
@@ -139,11 +147,22 @@ struct mmc_host_ops {
139 int (*start_signal_voltage_switch)(struct mmc_host *host, struct mmc_ios *ios); 147 int (*start_signal_voltage_switch)(struct mmc_host *host, struct mmc_ios *ios);
140 int (*execute_tuning)(struct mmc_host *host); 148 int (*execute_tuning)(struct mmc_host *host);
141 void (*enable_preset_value)(struct mmc_host *host, bool enable); 149 void (*enable_preset_value)(struct mmc_host *host, bool enable);
150 int (*select_drive_strength)(unsigned int max_dtr, int host_drv, int card_drv);
142}; 151};
143 152
144struct mmc_card; 153struct mmc_card;
145struct device; 154struct device;
146 155
156struct mmc_async_req {
157 /* active mmc request */
158 struct mmc_request *mrq;
159 /*
160 * Check error status of completed mmc request.
161 * Returns 0 if success otherwise non zero.
162 */
163 int (*err_check) (struct mmc_card *, struct mmc_async_req *);
164};
165
147struct mmc_host { 166struct mmc_host {
148 struct device *parent; 167 struct device *parent;
149 struct device class_dev; 168 struct device class_dev;
@@ -211,6 +230,7 @@ struct mmc_host {
211#define MMC_CAP_MAX_CURRENT_600 (1 << 28) /* Host max current limit is 600mA */ 230#define MMC_CAP_MAX_CURRENT_600 (1 << 28) /* Host max current limit is 600mA */
212#define MMC_CAP_MAX_CURRENT_800 (1 << 29) /* Host max current limit is 800mA */ 231#define MMC_CAP_MAX_CURRENT_800 (1 << 29) /* Host max current limit is 800mA */
213#define MMC_CAP_CMD23 (1 << 30) /* CMD23 supported. */ 232#define MMC_CAP_CMD23 (1 << 30) /* CMD23 supported. */
233#define MMC_CAP_BKOPS (1 << 31) /* Host supports BKOPS */
214 234
215 mmc_pm_flag_t pm_caps; /* supported pm features */ 235 mmc_pm_flag_t pm_caps; /* supported pm features */
216 236
@@ -231,6 +251,7 @@ struct mmc_host {
231 unsigned int max_req_size; /* maximum number of bytes in one req */ 251 unsigned int max_req_size; /* maximum number of bytes in one req */
232 unsigned int max_blk_size; /* maximum size of one mmc block */ 252 unsigned int max_blk_size; /* maximum size of one mmc block */
233 unsigned int max_blk_count; /* maximum number of blocks in one req */ 253 unsigned int max_blk_count; /* maximum number of blocks in one req */
254 unsigned int max_discard_to; /* max. discard timeout in ms */
234 255
235 /* private data */ 256 /* private data */
236 spinlock_t lock; /* lock for claim and bus ops */ 257 spinlock_t lock; /* lock for claim and bus ops */
@@ -261,10 +282,15 @@ struct mmc_host {
261 int claim_cnt; /* "claim" nesting count */ 282 int claim_cnt; /* "claim" nesting count */
262 283
263 struct delayed_work detect; 284 struct delayed_work detect;
285 struct wake_lock detect_wake_lock;
264 286
265 const struct mmc_bus_ops *bus_ops; /* current bus driver */ 287 const struct mmc_bus_ops *bus_ops; /* current bus driver */
266 unsigned int bus_refs; /* reference counter */ 288 unsigned int bus_refs; /* reference counter */
267 289
290 unsigned int bus_resume_flags;
291#define MMC_BUSRESUME_MANUAL_RESUME (1 << 0)
292#define MMC_BUSRESUME_NEEDS_RESUME (1 << 1)
293
268 unsigned int sdio_irqs; 294 unsigned int sdio_irqs;
269 struct task_struct *sdio_irq_thread; 295 struct task_struct *sdio_irq_thread;
270 atomic_t sdio_irq_thread_abort; 296 atomic_t sdio_irq_thread_abort;
@@ -281,6 +307,17 @@ struct mmc_host {
281 307
282 struct dentry *debugfs_root; 308 struct dentry *debugfs_root;
283 309
310 struct mmc_async_req *areq; /* active async req */
311
312#ifdef CONFIG_MMC_EMBEDDED_SDIO
313 struct {
314 struct sdio_cis *cis;
315 struct sdio_cccr *cccr;
316 struct sdio_embedded_func *funcs;
317 int num_funcs;
318 } embedded_sdio_data;
319#endif
320
284 unsigned long private[0] ____cacheline_aligned; 321 unsigned long private[0] ____cacheline_aligned;
285}; 322};
286 323
@@ -289,6 +326,14 @@ extern int mmc_add_host(struct mmc_host *);
289extern void mmc_remove_host(struct mmc_host *); 326extern void mmc_remove_host(struct mmc_host *);
290extern void mmc_free_host(struct mmc_host *); 327extern void mmc_free_host(struct mmc_host *);
291 328
329#ifdef CONFIG_MMC_EMBEDDED_SDIO
330extern void mmc_set_embedded_sdio_data(struct mmc_host *host,
331 struct sdio_cis *cis,
332 struct sdio_cccr *cccr,
333 struct sdio_embedded_func *funcs,
334 int num_funcs);
335#endif
336
292static inline void *mmc_priv(struct mmc_host *host) 337static inline void *mmc_priv(struct mmc_host *host)
293{ 338{
294 return (void *)host->private; 339 return (void *)host->private;
@@ -299,6 +344,18 @@ static inline void *mmc_priv(struct mmc_host *host)
299#define mmc_dev(x) ((x)->parent) 344#define mmc_dev(x) ((x)->parent)
300#define mmc_classdev(x) (&(x)->class_dev) 345#define mmc_classdev(x) (&(x)->class_dev)
301#define mmc_hostname(x) (dev_name(&(x)->class_dev)) 346#define mmc_hostname(x) (dev_name(&(x)->class_dev))
347#define mmc_bus_needs_resume(host) ((host)->bus_resume_flags & MMC_BUSRESUME_NEEDS_RESUME)
348#define mmc_bus_manual_resume(host) ((host)->bus_resume_flags & MMC_BUSRESUME_MANUAL_RESUME)
349
350static inline void mmc_set_bus_resume_policy(struct mmc_host *host, int manual)
351{
352 if (manual)
353 host->bus_resume_flags |= MMC_BUSRESUME_MANUAL_RESUME;
354 else
355 host->bus_resume_flags &= ~MMC_BUSRESUME_MANUAL_RESUME;
356}
357
358extern int mmc_resume_bus(struct mmc_host *host);
302 359
303extern int mmc_suspend_host(struct mmc_host *); 360extern int mmc_suspend_host(struct mmc_host *);
304extern int mmc_resume_host(struct mmc_host *); 361extern int mmc_resume_host(struct mmc_host *);
@@ -373,5 +430,4 @@ static inline int mmc_host_cmd23(struct mmc_host *host)
373{ 430{
374 return host->caps & MMC_CAP_CMD23; 431 return host->caps & MMC_CAP_CMD23;
375} 432}
376#endif 433#endif /* LINUX_MMC_HOST_H */
377
diff --git a/include/linux/mmc/ioctl.h b/include/linux/mmc/ioctl.h
index 5baf2983a12..8fa5bc5f805 100644
--- a/include/linux/mmc/ioctl.h
+++ b/include/linux/mmc/ioctl.h
@@ -51,4 +51,4 @@ struct mmc_ioc_cmd {
51 * block device operations. 51 * block device operations.
52 */ 52 */
53#define MMC_IOC_MAX_BYTES (512L * 256) 53#define MMC_IOC_MAX_BYTES (512L * 256)
54#endif /* LINUX_MMC_IOCTL_H */ 54#endif /* LINUX_MMC_IOCTL_H */
diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h
index ac26a685cca..2bb1dfd4cf1 100644
--- a/include/linux/mmc/mmc.h
+++ b/include/linux/mmc/mmc.h
@@ -21,8 +21,8 @@
21 * 15 May 2002 21 * 15 May 2002
22 */ 22 */
23 23
24#ifndef MMC_MMC_H 24#ifndef LINUX_MMC_MMC_H
25#define MMC_MMC_H 25#define LINUX_MMC_MMC_H
26 26
27/* Standard MMC commands (4.1) type argument response */ 27/* Standard MMC commands (4.1) type argument response */
28 /* class 1 */ 28 /* class 1 */
@@ -138,8 +138,19 @@ static inline bool mmc_op_multi(u32 opcode)
138#define R1_CURRENT_STATE(x) ((x & 0x00001E00) >> 9) /* sx, b (4 bits) */ 138#define R1_CURRENT_STATE(x) ((x & 0x00001E00) >> 9) /* sx, b (4 bits) */
139#define R1_READY_FOR_DATA (1 << 8) /* sx, a */ 139#define R1_READY_FOR_DATA (1 << 8) /* sx, a */
140#define R1_SWITCH_ERROR (1 << 7) /* sx, c */ 140#define R1_SWITCH_ERROR (1 << 7) /* sx, c */
141#define R1_URGENT_BKOPS (1 << 6) /* sr, a */
141#define R1_APP_CMD (1 << 5) /* sr, c */ 142#define R1_APP_CMD (1 << 5) /* sr, c */
142 143
144#define R1_STATE_IDLE 0
145#define R1_STATE_READY 1
146#define R1_STATE_IDENT 2
147#define R1_STATE_STBY 3
148#define R1_STATE_TRAN 4
149#define R1_STATE_DATA 5
150#define R1_STATE_RCV 6
151#define R1_STATE_PRG 7
152#define R1_STATE_DIS 8
153
143/* 154/*
144 * MMC/SD in SPI mode reports R1 status always, and R2 for SEND_STATUS 155 * MMC/SD in SPI mode reports R1 status always, and R2 for SEND_STATUS
145 * R1 is the low order byte; R2 is the next highest byte, when present. 156 * R1 is the low order byte; R2 is the next highest byte, when present.
@@ -262,6 +273,9 @@ struct _mmc_csd {
262 273
263#define EXT_CSD_PARTITION_ATTRIBUTE 156 /* R/W */ 274#define EXT_CSD_PARTITION_ATTRIBUTE 156 /* R/W */
264#define EXT_CSD_PARTITION_SUPPORT 160 /* RO */ 275#define EXT_CSD_PARTITION_SUPPORT 160 /* RO */
276#define EXT_CSD_HPI_MGMT 161 /* R/W */
277#define EXT_CSD_BKOPS_EN 163 /* R/W */
278#define EXT_CSD_BKOPS_START 164 /* R/W */
265#define EXT_CSD_WR_REL_PARAM 166 /* RO */ 279#define EXT_CSD_WR_REL_PARAM 166 /* RO */
266#define EXT_CSD_ERASE_GROUP_DEF 175 /* R/W */ 280#define EXT_CSD_ERASE_GROUP_DEF 175 /* R/W */
267#define EXT_CSD_PART_CONFIG 179 /* R/W */ 281#define EXT_CSD_PART_CONFIG 179 /* R/W */
@@ -271,6 +285,7 @@ struct _mmc_csd {
271#define EXT_CSD_REV 192 /* RO */ 285#define EXT_CSD_REV 192 /* RO */
272#define EXT_CSD_STRUCTURE 194 /* RO */ 286#define EXT_CSD_STRUCTURE 194 /* RO */
273#define EXT_CSD_CARD_TYPE 196 /* RO */ 287#define EXT_CSD_CARD_TYPE 196 /* RO */
288#define EXT_CSD_OUT_OF_INTERRUPT_TIME 198 /* RO */
274#define EXT_CSD_PART_SWITCH_TIME 199 /* RO */ 289#define EXT_CSD_PART_SWITCH_TIME 199 /* RO */
275#define EXT_CSD_SEC_CNT 212 /* RO, 4 bytes */ 290#define EXT_CSD_SEC_CNT 212 /* RO, 4 bytes */
276#define EXT_CSD_S_A_TIMEOUT 217 /* RO */ 291#define EXT_CSD_S_A_TIMEOUT 217 /* RO */
@@ -283,6 +298,9 @@ struct _mmc_csd {
283#define EXT_CSD_SEC_ERASE_MULT 230 /* RO */ 298#define EXT_CSD_SEC_ERASE_MULT 230 /* RO */
284#define EXT_CSD_SEC_FEATURE_SUPPORT 231 /* RO */ 299#define EXT_CSD_SEC_FEATURE_SUPPORT 231 /* RO */
285#define EXT_CSD_TRIM_MULT 232 /* RO */ 300#define EXT_CSD_TRIM_MULT 232 /* RO */
301#define EXT_CSD_BKOPS_STATUS 246 /* RO */
302#define EXT_CSD_BKOPS_SUPPORT 502 /* RO */
303#define EXT_CSD_HPI_FEATURES 503 /* RO */
286 304
287/* 305/*
288 * EXT_CSD field definitions 306 * EXT_CSD field definitions
@@ -327,5 +345,4 @@ struct _mmc_csd {
327#define MMC_SWITCH_MODE_CLEAR_BITS 0x02 /* Clear bits which are 1 in value */ 345#define MMC_SWITCH_MODE_CLEAR_BITS 0x02 /* Clear bits which are 1 in value */
328#define MMC_SWITCH_MODE_WRITE_BYTE 0x03 /* Set target to value */ 346#define MMC_SWITCH_MODE_WRITE_BYTE 0x03 /* Set target to value */
329 347
330#endif /* MMC_MMC_PROTOCOL_H */ 348#endif /* LINUX_MMC_MMC_H */
331
diff --git a/include/linux/mmc/pm.h b/include/linux/mmc/pm.h
index d37aac49cf9..6e2d6a135c7 100644
--- a/include/linux/mmc/pm.h
+++ b/include/linux/mmc/pm.h
@@ -26,5 +26,6 @@ typedef unsigned int mmc_pm_flag_t;
26 26
27#define MMC_PM_KEEP_POWER (1 << 0) /* preserve card power during suspend */ 27#define MMC_PM_KEEP_POWER (1 << 0) /* preserve card power during suspend */
28#define MMC_PM_WAKE_SDIO_IRQ (1 << 1) /* wake up host system on SDIO IRQ assertion */ 28#define MMC_PM_WAKE_SDIO_IRQ (1 << 1) /* wake up host system on SDIO IRQ assertion */
29#define MMC_PM_IGNORE_PM_NOTIFY (1 << 2) /* ignore mmc pm notify */
29 30
30#endif 31#endif /* LINUX_MMC_PM_H */
diff --git a/include/linux/mmc/sd.h b/include/linux/mmc/sd.h
index 7d35d52c3df..1ebcf9ba125 100644
--- a/include/linux/mmc/sd.h
+++ b/include/linux/mmc/sd.h
@@ -9,8 +9,8 @@
9 * your option) any later version. 9 * your option) any later version.
10 */ 10 */
11 11
12#ifndef MMC_SD_H 12#ifndef LINUX_MMC_SD_H
13#define MMC_SD_H 13#define LINUX_MMC_SD_H
14 14
15/* SD commands type argument response */ 15/* SD commands type argument response */
16 /* class 0 */ 16 /* class 0 */
@@ -91,5 +91,4 @@
91#define SD_SWITCH_ACCESS_DEF 0 91#define SD_SWITCH_ACCESS_DEF 0
92#define SD_SWITCH_ACCESS_HS 1 92#define SD_SWITCH_ACCESS_HS 1
93 93
94#endif 94#endif /* LINUX_MMC_SD_H */
95
diff --git a/include/linux/mmc/sdhci-pltfm.h b/include/linux/mmc/sdhci-pltfm.h
deleted file mode 100644
index 548d59d404c..00000000000
--- a/include/linux/mmc/sdhci-pltfm.h
+++ /dev/null
@@ -1,35 +0,0 @@
1/*
2 * Platform data declarations for the sdhci-pltfm driver.
3 *
4 * Copyright (c) 2010 MontaVista Software, LLC.
5 *
6 * Author: Anton Vorontsov <avorontsov@ru.mvista.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 (at
11 * your option) any later version.
12 */
13
14#ifndef _SDHCI_PLTFM_H
15#define _SDHCI_PLTFM_H
16
17struct sdhci_ops;
18struct sdhci_host;
19
20/**
21 * struct sdhci_pltfm_data - SDHCI platform-specific information & hooks
22 * @ops: optional pointer to the platform-provided SDHCI ops
23 * @quirks: optional SDHCI quirks
24 * @init: optional hook that is called during device probe, before the
25 * driver tries to access any SDHCI registers
26 * @exit: optional hook that is called during device removal
27 */
28struct sdhci_pltfm_data {
29 struct sdhci_ops *ops;
30 unsigned int quirks;
31 int (*init)(struct sdhci_host *host, struct sdhci_pltfm_data *pdata);
32 void (*exit)(struct sdhci_host *host);
33};
34
35#endif /* _SDHCI_PLTFM_H */
diff --git a/include/linux/mmc/sdhci-spear.h b/include/linux/mmc/sdhci-spear.h
index 9188c973f3e..5cdc96da9dd 100644
--- a/include/linux/mmc/sdhci-spear.h
+++ b/include/linux/mmc/sdhci-spear.h
@@ -11,8 +11,8 @@
11 * warranty of any kind, whether express or implied. 11 * warranty of any kind, whether express or implied.
12 */ 12 */
13 13
14#ifndef MMC_SDHCI_SPEAR_H 14#ifndef LINUX_MMC_SDHCI_SPEAR_H
15#define MMC_SDHCI_SPEAR_H 15#define LINUX_MMC_SDHCI_SPEAR_H
16 16
17#include <linux/platform_device.h> 17#include <linux/platform_device.h>
18/* 18/*
@@ -39,4 +39,4 @@ sdhci_set_plat_data(struct platform_device *pdev, struct sdhci_plat_data *data)
39 pdev->dev.platform_data = data; 39 pdev->dev.platform_data = data;
40} 40}
41 41
42#endif /* MMC_SDHCI_SPEAR_H */ 42#endif /* LINUX_MMC_SDHCI_SPEAR_H */
diff --git a/include/linux/mmc/sdhci.h b/include/linux/mmc/sdhci.h
index 6a68c4eb4e4..5ee48390dec 100644
--- a/include/linux/mmc/sdhci.h
+++ b/include/linux/mmc/sdhci.h
@@ -8,8 +8,8 @@
8 * the Free Software Foundation; either version 2 of the License, or (at 8 * the Free Software Foundation; either version 2 of the License, or (at
9 * your option) any later version. 9 * your option) any later version.
10 */ 10 */
11#ifndef __SDHCI_H 11#ifndef LINUX_MMC_SDHCI_H
12#define __SDHCI_H 12#define LINUX_MMC_SDHCI_H
13 13
14#include <linux/scatterlist.h> 14#include <linux/scatterlist.h>
15#include <linux/compiler.h> 15#include <linux/compiler.h>
@@ -21,72 +21,78 @@ struct sdhci_host {
21 /* Data set by hardware interface driver */ 21 /* Data set by hardware interface driver */
22 const char *hw_name; /* Hardware bus name */ 22 const char *hw_name; /* Hardware bus name */
23 23
24 unsigned int quirks; /* Deviations from spec. */ 24 u64 quirks; /* Deviations from spec. */
25 25
26/* Controller doesn't honor resets unless we touch the clock register */ 26/* Controller doesn't honor resets unless we touch the clock register */
27#define SDHCI_QUIRK_CLOCK_BEFORE_RESET (1<<0) 27#define SDHCI_QUIRK_CLOCK_BEFORE_RESET (1ULL<<0)
28/* Controller has bad caps bits, but really supports DMA */ 28/* Controller has bad caps bits, but really supports DMA */
29#define SDHCI_QUIRK_FORCE_DMA (1<<1) 29#define SDHCI_QUIRK_FORCE_DMA (1ULL<<1)
30/* Controller doesn't like to be reset when there is no card inserted. */ 30/* Controller doesn't like to be reset when there is no card inserted. */
31#define SDHCI_QUIRK_NO_CARD_NO_RESET (1<<2) 31#define SDHCI_QUIRK_NO_CARD_NO_RESET (1ULL<<2)
32/* Controller doesn't like clearing the power reg before a change */ 32/* Controller doesn't like clearing the power reg before a change */
33#define SDHCI_QUIRK_SINGLE_POWER_WRITE (1<<3) 33#define SDHCI_QUIRK_SINGLE_POWER_WRITE (1ULL<<3)
34/* Controller has flaky internal state so reset it on each ios change */ 34/* Controller has flaky internal state so reset it on each ios change */
35#define SDHCI_QUIRK_RESET_CMD_DATA_ON_IOS (1<<4) 35#define SDHCI_QUIRK_RESET_CMD_DATA_ON_IOS (1ULL<<4)
36/* Controller has an unusable DMA engine */ 36/* Controller has an unusable DMA engine */
37#define SDHCI_QUIRK_BROKEN_DMA (1<<5) 37#define SDHCI_QUIRK_BROKEN_DMA (1ULL<<5)
38/* Controller has an unusable ADMA engine */ 38/* Controller has an unusable ADMA engine */
39#define SDHCI_QUIRK_BROKEN_ADMA (1<<6) 39#define SDHCI_QUIRK_BROKEN_ADMA (1ULL<<6)
40/* Controller can only DMA from 32-bit aligned addresses */ 40/* Controller can only DMA from 32-bit aligned addresses */
41#define SDHCI_QUIRK_32BIT_DMA_ADDR (1<<7) 41#define SDHCI_QUIRK_32BIT_DMA_ADDR (1ULL<<7)
42/* Controller can only DMA chunk sizes that are a multiple of 32 bits */ 42/* Controller can only DMA chunk sizes that are a multiple of 32 bits */
43#define SDHCI_QUIRK_32BIT_DMA_SIZE (1<<8) 43#define SDHCI_QUIRK_32BIT_DMA_SIZE (1ULL<<8)
44/* Controller can only ADMA chunks that are a multiple of 32 bits */ 44/* Controller can only ADMA chunks that are a multiple of 32 bits */
45#define SDHCI_QUIRK_32BIT_ADMA_SIZE (1<<9) 45#define SDHCI_QUIRK_32BIT_ADMA_SIZE (1ULL<<9)
46/* Controller needs to be reset after each request to stay stable */ 46/* Controller needs to be reset after each request to stay stable */
47#define SDHCI_QUIRK_RESET_AFTER_REQUEST (1<<10) 47#define SDHCI_QUIRK_RESET_AFTER_REQUEST (1ULL<<10)
48/* Controller needs voltage and power writes to happen separately */ 48/* Controller needs voltage and power writes to happen separately */
49#define SDHCI_QUIRK_NO_SIMULT_VDD_AND_POWER (1<<11) 49#define SDHCI_QUIRK_NO_SIMULT_VDD_AND_POWER (1ULL<<11)
50/* Controller provides an incorrect timeout value for transfers */ 50/* Controller provides an incorrect timeout value for transfers */
51#define SDHCI_QUIRK_BROKEN_TIMEOUT_VAL (1<<12) 51#define SDHCI_QUIRK_BROKEN_TIMEOUT_VAL (1ULL<<12)
52/* Controller has an issue with buffer bits for small transfers */ 52/* Controller has an issue with buffer bits for small transfers */
53#define SDHCI_QUIRK_BROKEN_SMALL_PIO (1<<13) 53#define SDHCI_QUIRK_BROKEN_SMALL_PIO (1ULL<<13)
54/* Controller does not provide transfer-complete interrupt when not busy */ 54/* Controller does not provide transfer-complete interrupt when not busy */
55#define SDHCI_QUIRK_NO_BUSY_IRQ (1<<14) 55#define SDHCI_QUIRK_NO_BUSY_IRQ (1ULL<<14)
56/* Controller has unreliable card detection */ 56/* Controller has unreliable card detection */
57#define SDHCI_QUIRK_BROKEN_CARD_DETECTION (1<<15) 57#define SDHCI_QUIRK_BROKEN_CARD_DETECTION (1ULL<<15)
58/* Controller reports inverted write-protect state */ 58/* Controller reports inverted write-protect state */
59#define SDHCI_QUIRK_INVERTED_WRITE_PROTECT (1<<16) 59#define SDHCI_QUIRK_INVERTED_WRITE_PROTECT (1ULL<<16)
60/* Controller has nonstandard clock management */ 60/* Controller has nonstandard clock management */
61#define SDHCI_QUIRK_NONSTANDARD_CLOCK (1<<17) 61#define SDHCI_QUIRK_NONSTANDARD_CLOCK (1ULL<<17)
62/* Controller does not like fast PIO transfers */ 62/* Controller does not like fast PIO transfers */
63#define SDHCI_QUIRK_PIO_NEEDS_DELAY (1<<18) 63#define SDHCI_QUIRK_PIO_NEEDS_DELAY (1ULL<<18)
64/* Controller losing signal/interrupt enable states after reset */ 64/* Controller losing signal/interrupt enable states after reset */
65#define SDHCI_QUIRK_RESTORE_IRQS_AFTER_RESET (1<<19) 65#define SDHCI_QUIRK_RESTORE_IRQS_AFTER_RESET (1ULL<<19)
66/* Controller has to be forced to use block size of 2048 bytes */ 66/* Controller has to be forced to use block size of 2048 bytes */
67#define SDHCI_QUIRK_FORCE_BLK_SZ_2048 (1<<20) 67#define SDHCI_QUIRK_FORCE_BLK_SZ_2048 (1ULL<<20)
68/* Controller cannot do multi-block transfers */ 68/* Controller cannot do multi-block transfers */
69#define SDHCI_QUIRK_NO_MULTIBLOCK (1<<21) 69#define SDHCI_QUIRK_NO_MULTIBLOCK (1ULL<<21)
70/* Controller can only handle 1-bit data transfers */ 70/* Controller can only handle 1-bit data transfers */
71#define SDHCI_QUIRK_FORCE_1_BIT_DATA (1<<22) 71#define SDHCI_QUIRK_FORCE_1_BIT_DATA (1ULL<<22)
72/* Controller needs 10ms delay between applying power and clock */ 72/* Controller needs 10ms delay between applying power and clock */
73#define SDHCI_QUIRK_DELAY_AFTER_POWER (1<<23) 73#define SDHCI_QUIRK_DELAY_AFTER_POWER (1ULL<<23)
74/* Controller uses SDCLK instead of TMCLK for data timeouts */ 74/* Controller uses SDCLK instead of TMCLK for data timeouts */
75#define SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK (1<<24) 75#define SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK (1ULL<<24)
76/* Controller reports wrong base clock capability */ 76/* Controller reports wrong base clock capability */
77#define SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN (1<<25) 77#define SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN (1ULL<<25)
78/* Controller cannot support End Attribute in NOP ADMA descriptor */ 78/* Controller cannot support End Attribute in NOP ADMA descriptor */
79#define SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC (1<<26) 79#define SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC (1ULL<<26)
80/* Controller is missing device caps. Use caps provided by host */ 80/* Controller is missing device caps. Use caps provided by host */
81#define SDHCI_QUIRK_MISSING_CAPS (1<<27) 81#define SDHCI_QUIRK_MISSING_CAPS (1ULL<<27)
82/* Controller uses Auto CMD12 command to stop the transfer */ 82/* Controller uses Auto CMD12 command to stop the transfer */
83#define SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12 (1<<28) 83#define SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12 (1ULL<<28)
84/* Controller doesn't have HISPD bit field in HI-SPEED SD card */ 84/* Controller doesn't have HISPD bit field in HI-SPEED SD card */
85#define SDHCI_QUIRK_NO_HISPD_BIT (1<<29) 85#define SDHCI_QUIRK_NO_HISPD_BIT (1ULL<<29)
86/* Controller treats ADMA descriptors with length 0000h incorrectly */ 86/* Controller treats ADMA descriptors with length 0000h incorrectly */
87#define SDHCI_QUIRK_BROKEN_ADMA_ZEROLEN_DESC (1<<30) 87#define SDHCI_QUIRK_BROKEN_ADMA_ZEROLEN_DESC (1ULL<<30)
88/* The read-only detection via SDHCI_PRESENT_STATE register is unstable */ 88/* The read-only detection via SDHCI_PRESENT_STATE register is unstable */
89#define SDHCI_QUIRK_UNSTABLE_RO_DETECT (1<<31) 89#define SDHCI_QUIRK_UNSTABLE_RO_DETECT (1ULL<<31)
90/* Controller cannot report the line status in present state register */
91#define SDHCI_QUIRK_NON_STD_VOLTAGE_SWITCHING (1ULL<<32)
92/* Controller doesn't follow the standard frequency tuning procedure */
93#define SDHCI_QUIRK_NON_STANDARD_TUNING (1ULL<<33)
94/* Controller doesn't calculate max_discard_to */
95#define SDHCI_QUIRK_NO_CALC_MAX_DISCARD_TO (1ULL<<34)
90 96
91 int irq; /* Device IRQ */ 97 int irq; /* Device IRQ */
92 void __iomem *ioaddr; /* Mapped address */ 98 void __iomem *ioaddr; /* Mapped address */
@@ -145,6 +151,7 @@ struct sdhci_host {
145 struct tasklet_struct finish_tasklet; 151 struct tasklet_struct finish_tasklet;
146 152
147 struct timer_list timer; /* Timer for timeouts */ 153 struct timer_list timer; /* Timer for timeouts */
154 unsigned int card_int_set; /* card int status */
148 155
149 unsigned int caps; /* Alternative capabilities */ 156 unsigned int caps; /* Alternative capabilities */
150 157
@@ -162,4 +169,4 @@ struct sdhci_host {
162 169
163 unsigned long private[0] ____cacheline_aligned; 170 unsigned long private[0] ____cacheline_aligned;
164}; 171};
165#endif /* __SDHCI_H */ 172#endif /* LINUX_MMC_SDHCI_H */
diff --git a/include/linux/mmc/sdio.h b/include/linux/mmc/sdio.h
index 245cdacee54..666ff6b0aea 100644
--- a/include/linux/mmc/sdio.h
+++ b/include/linux/mmc/sdio.h
@@ -9,8 +9,8 @@
9 * your option) any later version. 9 * your option) any later version.
10 */ 10 */
11 11
12#ifndef MMC_SDIO_H 12#ifndef LINUX_MMC_SDIO_H
13#define MMC_SDIO_H 13#define LINUX_MMC_SDIO_H
14 14
15/* SDIO commands type argument response */ 15/* SDIO commands type argument response */
16#define SD_IO_SEND_OP_COND 5 /* bcr [23:0] OCR R4 */ 16#define SD_IO_SEND_OP_COND 5 /* bcr [23:0] OCR R4 */
@@ -38,7 +38,8 @@
38 * [8:0] Byte/block count 38 * [8:0] Byte/block count
39 */ 39 */
40 40
41#define R4_MEMORY_PRESENT (1 << 27) 41#define R4_18V_PRESENT BIT(24)
42#define R4_MEMORY_PRESENT BIT(27)
42 43
43/* 44/*
44 SDIO status in R5 45 SDIO status in R5
@@ -72,17 +73,20 @@
72#define SDIO_CCCR_REV_1_00 0 /* CCCR/FBR Version 1.00 */ 73#define SDIO_CCCR_REV_1_00 0 /* CCCR/FBR Version 1.00 */
73#define SDIO_CCCR_REV_1_10 1 /* CCCR/FBR Version 1.10 */ 74#define SDIO_CCCR_REV_1_10 1 /* CCCR/FBR Version 1.10 */
74#define SDIO_CCCR_REV_1_20 2 /* CCCR/FBR Version 1.20 */ 75#define SDIO_CCCR_REV_1_20 2 /* CCCR/FBR Version 1.20 */
76#define SDIO_CCCR_REV_3_00 3 /* CCCR/FBR Version 3.00 */
75 77
76#define SDIO_SDIO_REV_1_00 0 /* SDIO Spec Version 1.00 */ 78#define SDIO_SDIO_REV_1_00 0 /* SDIO Spec Version 1.00 */
77#define SDIO_SDIO_REV_1_10 1 /* SDIO Spec Version 1.10 */ 79#define SDIO_SDIO_REV_1_10 1 /* SDIO Spec Version 1.10 */
78#define SDIO_SDIO_REV_1_20 2 /* SDIO Spec Version 1.20 */ 80#define SDIO_SDIO_REV_1_20 2 /* SDIO Spec Version 1.20 */
79#define SDIO_SDIO_REV_2_00 3 /* SDIO Spec Version 2.00 */ 81#define SDIO_SDIO_REV_2_00 3 /* SDIO Spec Version 2.00 */
82#define SDIO_SDIO_REV_3_00 4 /* SDIO Spec Version 3.00 */
80 83
81#define SDIO_CCCR_SD 0x01 84#define SDIO_CCCR_SD 0x01
82 85
83#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 */
84#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 */
85#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 */
86 90
87#define SDIO_CCCR_IOEx 0x02 91#define SDIO_CCCR_IOEx 0x02
88#define SDIO_CCCR_IORx 0x03 92#define SDIO_CCCR_IORx 0x03
@@ -132,8 +136,31 @@
132#define SDIO_CCCR_SPEED 0x13 136#define SDIO_CCCR_SPEED 0x13
133 137
134#define SDIO_SPEED_SHS 0x01 /* Supports High-Speed mode */ 138#define SDIO_SPEED_SHS 0x01 /* Supports High-Speed mode */
135#define SDIO_SPEED_EHS 0x02 /* Enable High-Speed mode */ 139#define SDIO_SPEED_BSS_SHIFT 1
136 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)
137/* 164/*
138 * Function Basic Registers (FBR) 165 * Function Basic Registers (FBR)
139 */ 166 */
@@ -161,5 +188,4 @@
161 188
162#define SDIO_FBR_BLKSIZE 0x10 /* block size (2 bytes) */ 189#define SDIO_FBR_BLKSIZE 0x10 /* block size (2 bytes) */
163 190
164#endif 191#endif /* LINUX_MMC_SDIO_H */
165
diff --git a/include/linux/mmc/sdio_func.h b/include/linux/mmc/sdio_func.h
index 31baaf82f45..dc680c4b50d 100644
--- a/include/linux/mmc/sdio_func.h
+++ b/include/linux/mmc/sdio_func.h
@@ -9,8 +9,8 @@
9 * your option) any later version. 9 * your option) any later version.
10 */ 10 */
11 11
12#ifndef MMC_SDIO_FUNC_H 12#ifndef LINUX_MMC_SDIO_FUNC_H
13#define MMC_SDIO_FUNC_H 13#define LINUX_MMC_SDIO_FUNC_H
14 14
15#include <linux/device.h> 15#include <linux/device.h>
16#include <linux/mod_devicetable.h> 16#include <linux/mod_devicetable.h>
@@ -23,6 +23,14 @@ struct sdio_func;
23typedef void (sdio_irq_handler_t)(struct sdio_func *); 23typedef void (sdio_irq_handler_t)(struct sdio_func *);
24 24
25/* 25/*
26 * Structure used to hold embedded SDIO device data from platform layer
27 */
28struct sdio_embedded_func {
29 uint8_t f_class;
30 uint32_t f_maxblksize;
31};
32
33/*
26 * SDIO function CIS tuple (unknown to the core) 34 * SDIO function CIS tuple (unknown to the core)
27 */ 35 */
28struct sdio_func_tuple { 36struct sdio_func_tuple {
@@ -130,6 +138,8 @@ extern int sdio_release_irq(struct sdio_func *func);
130extern unsigned int sdio_align_size(struct sdio_func *func, unsigned int sz); 138extern unsigned int sdio_align_size(struct sdio_func *func, unsigned int sz);
131 139
132extern u8 sdio_readb(struct sdio_func *func, unsigned int addr, int *err_ret); 140extern u8 sdio_readb(struct sdio_func *func, unsigned int addr, int *err_ret);
141extern u8 sdio_readb_ext(struct sdio_func *func, unsigned int addr, int *err_ret,
142 unsigned in);
133extern u16 sdio_readw(struct sdio_func *func, unsigned int addr, int *err_ret); 143extern u16 sdio_readw(struct sdio_func *func, unsigned int addr, int *err_ret);
134extern u32 sdio_readl(struct sdio_func *func, unsigned int addr, int *err_ret); 144extern u32 sdio_readl(struct sdio_func *func, unsigned int addr, int *err_ret);
135 145
@@ -161,5 +171,4 @@ extern void sdio_f0_writeb(struct sdio_func *func, unsigned char b,
161extern mmc_pm_flag_t sdio_get_host_pm_caps(struct sdio_func *func); 171extern mmc_pm_flag_t sdio_get_host_pm_caps(struct sdio_func *func);
162extern int sdio_set_host_pm_flags(struct sdio_func *func, mmc_pm_flag_t flags); 172extern int sdio_set_host_pm_flags(struct sdio_func *func, mmc_pm_flag_t flags);
163 173
164#endif 174#endif /* LINUX_MMC_SDIO_FUNC_H */
165
diff --git a/include/linux/mmc/sdio_ids.h b/include/linux/mmc/sdio_ids.h
index a36ab3bc7b0..9f03feedc8e 100644
--- a/include/linux/mmc/sdio_ids.h
+++ b/include/linux/mmc/sdio_ids.h
@@ -2,8 +2,8 @@
2 * SDIO Classes, Interface Types, Manufacturer IDs, etc. 2 * SDIO Classes, Interface Types, Manufacturer IDs, etc.
3 */ 3 */
4 4
5#ifndef MMC_SDIO_IDS_H 5#ifndef LINUX_MMC_SDIO_IDS_H
6#define MMC_SDIO_IDS_H 6#define LINUX_MMC_SDIO_IDS_H
7 7
8/* 8/*
9 * Standard SDIO Function Interfaces 9 * Standard SDIO Function Interfaces
@@ -44,4 +44,4 @@
44#define SDIO_DEVICE_ID_SIANO_NOVA_A0 0x1100 44#define SDIO_DEVICE_ID_SIANO_NOVA_A0 0x1100
45#define SDIO_DEVICE_ID_SIANO_STELLAR 0x5347 45#define SDIO_DEVICE_ID_SIANO_STELLAR 0x5347
46 46
47#endif 47#endif /* LINUX_MMC_SDIO_IDS_H */
diff --git a/include/linux/mmc/sh_mmcif.h b/include/linux/mmc/sh_mmcif.h
index 9eb9b4b96f5..0222cd8ebe7 100644
--- a/include/linux/mmc/sh_mmcif.h
+++ b/include/linux/mmc/sh_mmcif.h
@@ -11,8 +11,8 @@
11 * 11 *
12 */ 12 */
13 13
14#ifndef __SH_MMCIF_H__ 14#ifndef LINUX_MMC_SH_MMCIF_H
15#define __SH_MMCIF_H__ 15#define LINUX_MMC_SH_MMCIF_H
16 16
17#include <linux/io.h> 17#include <linux/io.h>
18#include <linux/platform_device.h> 18#include <linux/platform_device.h>
@@ -220,4 +220,4 @@ static inline void sh_mmcif_boot_init(void __iomem *base)
220 sh_mmcif_boot_cmd(base, 0x03400040, 0x00010000); 220 sh_mmcif_boot_cmd(base, 0x03400040, 0x00010000);
221} 221}
222 222
223#endif /* __SH_MMCIF_H__ */ 223#endif /* LINUX_MMC_SH_MMCIF_H */
diff --git a/include/linux/mmc/sh_mobile_sdhi.h b/include/linux/mmc/sh_mobile_sdhi.h
index faf32b6ec18..bd50b365167 100644
--- a/include/linux/mmc/sh_mobile_sdhi.h
+++ b/include/linux/mmc/sh_mobile_sdhi.h
@@ -1,5 +1,5 @@
1#ifndef __SH_MOBILE_SDHI_H__ 1#ifndef LINUX_MMC_SH_MOBILE_SDHI_H
2#define __SH_MOBILE_SDHI_H__ 2#define LINUX_MMC_SH_MOBILE_SDHI_H
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5 5
@@ -17,4 +17,4 @@ struct sh_mobile_sdhi_info {
17 int (*get_cd)(struct platform_device *pdev); 17 int (*get_cd)(struct platform_device *pdev);
18}; 18};
19 19
20#endif /* __SH_MOBILE_SDHI_H__ */ 20#endif /* LINUX_MMC_SH_MOBILE_SDHI_H */
diff --git a/include/linux/mmc/tmio.h b/include/linux/mmc/tmio.h
index 19490b942db..a1c1f321e51 100644
--- a/include/linux/mmc/tmio.h
+++ b/include/linux/mmc/tmio.h
@@ -12,8 +12,8 @@
12 * 12 *
13 * TC6393XB TC6391XB TC6387XB T7L66XB ASIC3 13 * TC6393XB TC6391XB TC6387XB T7L66XB ASIC3
14 */ 14 */
15#ifndef _LINUX_MMC_TMIO_H_ 15#ifndef LINUX_MMC_TMIO_H
16#define _LINUX_MMC_TMIO_H_ 16#define LINUX_MMC_TMIO_H
17 17
18#define CTL_SD_CMD 0x00 18#define CTL_SD_CMD 0x00
19#define CTL_ARG_REG 0x04 19#define CTL_ARG_REG 0x04
@@ -21,6 +21,7 @@
21#define CTL_XFER_BLK_COUNT 0xa 21#define CTL_XFER_BLK_COUNT 0xa
22#define CTL_RESPONSE 0x0c 22#define CTL_RESPONSE 0x0c
23#define CTL_STATUS 0x1c 23#define CTL_STATUS 0x1c
24#define CTL_STATUS2 0x1e
24#define CTL_IRQ_MASK 0x20 25#define CTL_IRQ_MASK 0x20
25#define CTL_SD_CARD_CLK_CTL 0x24 26#define CTL_SD_CARD_CLK_CTL 0x24
26#define CTL_SD_XFER_LEN 0x26 27#define CTL_SD_XFER_LEN 0x26
@@ -30,6 +31,7 @@
30#define CTL_TRANSACTION_CTL 0x34 31#define CTL_TRANSACTION_CTL 0x34
31#define CTL_SDIO_STATUS 0x36 32#define CTL_SDIO_STATUS 0x36
32#define CTL_SDIO_IRQ_MASK 0x38 33#define CTL_SDIO_IRQ_MASK 0x38
34#define CTL_DMA_ENABLE 0xd8
33#define CTL_RESET_SD 0xe0 35#define CTL_RESET_SD 0xe0
34#define CTL_SDIO_REGS 0x100 36#define CTL_SDIO_REGS 0x100
35#define CTL_CLK_AND_WAIT_CTL 0x138 37#define CTL_CLK_AND_WAIT_CTL 0x138
@@ -60,4 +62,4 @@
60 62
61#define TMIO_BBS 512 /* Boot block size */ 63#define TMIO_BBS 512 /* Boot block size */
62 64
63#endif /* _LINUX_MMC_TMIO_H_ */ 65#endif /* LINUX_MMC_TMIO_H */
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 9f7c3ebcbba..be1ac8d7789 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -16,7 +16,7 @@
16#include <linux/nodemask.h> 16#include <linux/nodemask.h>
17#include <linux/pageblock-flags.h> 17#include <linux/pageblock-flags.h>
18#include <generated/bounds.h> 18#include <generated/bounds.h>
19#include <asm/atomic.h> 19#include <linux/atomic.h>
20#include <asm/page.h> 20#include <asm/page.h>
21 21
22/* Free memory management - zoned buddy allocator. */ 22/* Free memory management - zoned buddy allocator. */
@@ -158,6 +158,12 @@ static inline int is_unevictable_lru(enum lru_list l)
158 return (l == LRU_UNEVICTABLE); 158 return (l == LRU_UNEVICTABLE);
159} 159}
160 160
161/* Mask used at gathering information at once (see memcontrol.c) */
162#define LRU_ALL_FILE (BIT(LRU_INACTIVE_FILE) | BIT(LRU_ACTIVE_FILE))
163#define LRU_ALL_ANON (BIT(LRU_INACTIVE_ANON) | BIT(LRU_ACTIVE_ANON))
164#define LRU_ALL_EVICTABLE (LRU_ALL_FILE | LRU_ALL_ANON)
165#define LRU_ALL ((1 << NR_LRU_LISTS) - 1)
166
161enum zone_watermarks { 167enum zone_watermarks {
162 WMARK_MIN, 168 WMARK_MIN,
163 WMARK_LOW, 169 WMARK_LOW,
diff --git a/include/linux/mnt_namespace.h b/include/linux/mnt_namespace.h
index 0b89efc6f21..29304855652 100644
--- a/include/linux/mnt_namespace.h
+++ b/include/linux/mnt_namespace.h
@@ -18,7 +18,6 @@ struct proc_mounts {
18 struct seq_file m; /* must be the first element */ 18 struct seq_file m; /* must be the first element */
19 struct mnt_namespace *ns; 19 struct mnt_namespace *ns;
20 struct path root; 20 struct path root;
21 int event;
22}; 21};
23 22
24struct fs_struct; 23struct fs_struct;
diff --git a/include/linux/module.h b/include/linux/module.h
index d9ca2d5dc6d..bbd77fa05b1 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -16,6 +16,7 @@
16#include <linux/kobject.h> 16#include <linux/kobject.h>
17#include <linux/moduleparam.h> 17#include <linux/moduleparam.h>
18#include <linux/tracepoint.h> 18#include <linux/tracepoint.h>
19#include <linux/export.h>
19 20
20#include <linux/percpu.h> 21#include <linux/percpu.h>
21#include <asm/module.h> 22#include <asm/module.h>
@@ -25,21 +26,8 @@
25/* Not Yet Implemented */ 26/* Not Yet Implemented */
26#define MODULE_SUPPORTED_DEVICE(name) 27#define MODULE_SUPPORTED_DEVICE(name)
27 28
28/* Some toolchains use a `_' prefix for all user symbols. */
29#ifdef CONFIG_SYMBOL_PREFIX
30#define MODULE_SYMBOL_PREFIX CONFIG_SYMBOL_PREFIX
31#else
32#define MODULE_SYMBOL_PREFIX ""
33#endif
34
35#define MODULE_NAME_LEN MAX_PARAM_PREFIX_LEN 29#define MODULE_NAME_LEN MAX_PARAM_PREFIX_LEN
36 30
37struct kernel_symbol
38{
39 unsigned long value;
40 const char *name;
41};
42
43struct modversion_info 31struct modversion_info
44{ 32{
45 unsigned long crc; 33 unsigned long crc;
@@ -48,10 +36,18 @@ struct modversion_info
48 36
49struct module; 37struct module;
50 38
39struct module_kobject {
40 struct kobject kobj;
41 struct module *mod;
42 struct kobject *drivers_dir;
43 struct module_param_attrs *mp;
44};
45
51struct module_attribute { 46struct module_attribute {
52 struct attribute attr; 47 struct attribute attr;
53 ssize_t (*show)(struct module_attribute *, struct module *, char *); 48 ssize_t (*show)(struct module_attribute *, struct module_kobject *,
54 ssize_t (*store)(struct module_attribute *, struct module *, 49 char *);
50 ssize_t (*store)(struct module_attribute *, struct module_kobject *,
55 const char *, size_t count); 51 const char *, size_t count);
56 void (*setup)(struct module *, const char *); 52 void (*setup)(struct module *, const char *);
57 int (*test)(struct module *); 53 int (*test)(struct module *);
@@ -65,15 +61,9 @@ struct module_version_attribute {
65} __attribute__ ((__aligned__(sizeof(void *)))); 61} __attribute__ ((__aligned__(sizeof(void *))));
66 62
67extern ssize_t __modver_version_show(struct module_attribute *, 63extern ssize_t __modver_version_show(struct module_attribute *,
68 struct module *, char *); 64 struct module_kobject *, char *);
69 65
70struct module_kobject 66extern struct module_attribute module_uevent;
71{
72 struct kobject kobj;
73 struct module *mod;
74 struct kobject *drivers_dir;
75 struct module_param_attrs *mp;
76};
77 67
78/* These are either module local, or the kernel's dummy ones. */ 68/* These are either module local, or the kernel's dummy ones. */
79extern int init_module(void); 69extern int init_module(void);
@@ -96,11 +86,8 @@ void trim_init_extable(struct module *m);
96extern const struct gtype##_id __mod_##gtype##_table \ 86extern const struct gtype##_id __mod_##gtype##_table \
97 __attribute__ ((unused, alias(__stringify(name)))) 87 __attribute__ ((unused, alias(__stringify(name))))
98 88
99extern struct module __this_module;
100#define THIS_MODULE (&__this_module)
101#else /* !MODULE */ 89#else /* !MODULE */
102#define MODULE_GENERIC_TABLE(gtype,name) 90#define MODULE_GENERIC_TABLE(gtype,name)
103#define THIS_MODULE ((struct module *)0)
104#endif 91#endif
105 92
106/* Generic info of form tag = "info" */ 93/* Generic info of form tag = "info" */
@@ -216,52 +203,6 @@ struct module_use {
216 struct module *source, *target; 203 struct module *source, *target;
217}; 204};
218 205
219#ifndef __GENKSYMS__
220#ifdef CONFIG_MODVERSIONS
221/* Mark the CRC weak since genksyms apparently decides not to
222 * generate a checksums for some symbols */
223#define __CRC_SYMBOL(sym, sec) \
224 extern void *__crc_##sym __attribute__((weak)); \
225 static const unsigned long __kcrctab_##sym \
226 __used \
227 __attribute__((section("___kcrctab" sec "+" #sym), unused)) \
228 = (unsigned long) &__crc_##sym;
229#else
230#define __CRC_SYMBOL(sym, sec)
231#endif
232
233/* For every exported symbol, place a struct in the __ksymtab section */
234#define __EXPORT_SYMBOL(sym, sec) \
235 extern typeof(sym) sym; \
236 __CRC_SYMBOL(sym, sec) \
237 static const char __kstrtab_##sym[] \
238 __attribute__((section("__ksymtab_strings"), aligned(1))) \
239 = MODULE_SYMBOL_PREFIX #sym; \
240 static const struct kernel_symbol __ksymtab_##sym \
241 __used \
242 __attribute__((section("___ksymtab" sec "+" #sym), unused)) \
243 = { (unsigned long)&sym, __kstrtab_##sym }
244
245#define EXPORT_SYMBOL(sym) \
246 __EXPORT_SYMBOL(sym, "")
247
248#define EXPORT_SYMBOL_GPL(sym) \
249 __EXPORT_SYMBOL(sym, "_gpl")
250
251#define EXPORT_SYMBOL_GPL_FUTURE(sym) \
252 __EXPORT_SYMBOL(sym, "_gpl_future")
253
254
255#ifdef CONFIG_UNUSED_SYMBOLS
256#define EXPORT_UNUSED_SYMBOL(sym) __EXPORT_SYMBOL(sym, "_unused")
257#define EXPORT_UNUSED_SYMBOL_GPL(sym) __EXPORT_SYMBOL(sym, "_unused_gpl")
258#else
259#define EXPORT_UNUSED_SYMBOL(sym)
260#define EXPORT_UNUSED_SYMBOL_GPL(sym)
261#endif
262
263#endif
264
265enum module_state 206enum module_state
266{ 207{
267 MODULE_STATE_LIVE, 208 MODULE_STATE_LIVE,
@@ -582,11 +523,6 @@ extern void module_update_tracepoints(void);
582extern int module_get_iter_tracepoints(struct tracepoint_iter *iter); 523extern int module_get_iter_tracepoints(struct tracepoint_iter *iter);
583 524
584#else /* !CONFIG_MODULES... */ 525#else /* !CONFIG_MODULES... */
585#define EXPORT_SYMBOL(sym)
586#define EXPORT_SYMBOL_GPL(sym)
587#define EXPORT_SYMBOL_GPL_FUTURE(sym)
588#define EXPORT_UNUSED_SYMBOL(sym)
589#define EXPORT_UNUSED_SYMBOL_GPL(sym)
590 526
591/* Given an address, look for it in the exception tables. */ 527/* Given an address, look for it in the exception tables. */
592static inline const struct exception_table_entry * 528static inline const struct exception_table_entry *
diff --git a/include/linux/moduleloader.h b/include/linux/moduleloader.h
index c1f40c2f7ff..b2be02ebf45 100644
--- a/include/linux/moduleloader.h
+++ b/include/linux/moduleloader.h
@@ -5,7 +5,12 @@
5#include <linux/module.h> 5#include <linux/module.h>
6#include <linux/elf.h> 6#include <linux/elf.h>
7 7
8/* These must be implemented by the specific architecture */ 8/* These may be implemented by architectures that need to hook into the
9 * module loader code. Architectures that don't need to do anything special
10 * can just rely on the 'weak' default hooks defined in kernel/module.c.
11 * Note, however, that at least one of apply_relocate or apply_relocate_add
12 * must be implemented by each architecture.
13 */
9 14
10/* Adjust arch-specific sections. Return 0 on success. */ 15/* Adjust arch-specific sections. Return 0 on success. */
11int module_frob_arch_sections(Elf_Ehdr *hdr, 16int module_frob_arch_sections(Elf_Ehdr *hdr,
diff --git a/include/linux/mount.h b/include/linux/mount.h
index 604f122a232..33fe53d7811 100644
--- a/include/linux/mount.h
+++ b/include/linux/mount.h
@@ -14,7 +14,7 @@
14#include <linux/nodemask.h> 14#include <linux/nodemask.h>
15#include <linux/spinlock.h> 15#include <linux/spinlock.h>
16#include <linux/seqlock.h> 16#include <linux/seqlock.h>
17#include <asm/atomic.h> 17#include <linux/atomic.h>
18 18
19struct super_block; 19struct super_block;
20struct vfsmount; 20struct vfsmount;
diff --git a/include/linux/mpu.h b/include/linux/mpu.h
new file mode 100644
index 00000000000..1977b38b8c1
--- /dev/null
+++ b/include/linux/mpu.h
@@ -0,0 +1,367 @@
1/*
2 $License:
3 Copyright (C) 2011 InvenSense Corporation, All Rights Reserved.
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 $
18 */
19
20#ifndef __MPU_H_
21#define __MPU_H_
22
23#include <linux/types.h>
24#include <linux/ioctl.h>
25
26/* Number of axes on each sensor */
27#define GYRO_NUM_AXES (3)
28#define ACCEL_NUM_AXES (3)
29#define COMPASS_NUM_AXES (3)
30
31struct mpu_read_write {
32 /* Memory address or register address depending on ioctl */
33 __u16 address;
34 __u16 length;
35 __u8 *data;
36};
37
38enum mpuirq_data_type {
39 MPUIRQ_DATA_TYPE_MPU_IRQ,
40 MPUIRQ_DATA_TYPE_SLAVE_IRQ,
41 MPUIRQ_DATA_TYPE_PM_EVENT,
42 MPUIRQ_DATA_TYPE_NUM_TYPES,
43};
44
45/* User space PM event notification */
46#define MPU_PM_EVENT_SUSPEND_PREPARE (3)
47#define MPU_PM_EVENT_POST_SUSPEND (4)
48
49struct mpuirq_data {
50 __u32 interruptcount;
51 __u64 irqtime;
52 __u32 data_type;
53 __s32 data;
54};
55
56enum ext_slave_config_key {
57 MPU_SLAVE_CONFIG_ODR_SUSPEND,
58 MPU_SLAVE_CONFIG_ODR_RESUME,
59 MPU_SLAVE_CONFIG_FSR_SUSPEND,
60 MPU_SLAVE_CONFIG_FSR_RESUME,
61 MPU_SLAVE_CONFIG_MOT_THS,
62 MPU_SLAVE_CONFIG_NMOT_THS,
63 MPU_SLAVE_CONFIG_MOT_DUR,
64 MPU_SLAVE_CONFIG_NMOT_DUR,
65 MPU_SLAVE_CONFIG_IRQ_SUSPEND,
66 MPU_SLAVE_CONFIG_IRQ_RESUME,
67 MPU_SLAVE_WRITE_REGISTERS,
68 MPU_SLAVE_READ_REGISTERS,
69 MPU_SLAVE_CONFIG_INTERNAL_REFERENCE,
70 /* AMI 306 specific config keys */
71 MPU_SLAVE_PARAM,
72 MPU_SLAVE_WINDOW,
73 MPU_SLAVE_READWINPARAMS,
74 MPU_SLAVE_SEARCHOFFSET,
75 /* AKM specific config keys */
76 MPU_SLAVE_READ_SCALE,
77 /* MPU3050 and MPU6050 Keys */
78 MPU_SLAVE_INT_CONFIG,
79 MPU_SLAVE_EXT_SYNC,
80 MPU_SLAVE_FULL_SCALE,
81 MPU_SLAVE_LPF,
82 MPU_SLAVE_CLK_SRC,
83 MPU_SLAVE_DIVIDER,
84 MPU_SLAVE_DMP_ENABLE,
85 MPU_SLAVE_FIFO_ENABLE,
86 MPU_SLAVE_DMP_CFG1,
87 MPU_SLAVE_DMP_CFG2,
88 MPU_SLAVE_TC,
89 MPU_SLAVE_GYRO,
90 MPU_SLAVE_ADDR,
91 MPU_SLAVE_PRODUCT_REVISION,
92 MPU_SLAVE_SILICON_REVISION,
93 MPU_SLAVE_PRODUCT_ID,
94 MPU_SLAVE_GYRO_SENS_TRIM,
95 MPU_SLAVE_ACCEL_SENS_TRIM,
96 MPU_SLAVE_RAM,
97 /* -------------------------- */
98 MPU_SLAVE_CONFIG_NUM_CONFIG_KEYS
99};
100
101/* For the MPU_SLAVE_CONFIG_IRQ_SUSPEND and MPU_SLAVE_CONFIG_IRQ_RESUME */
102enum ext_slave_config_irq_type {
103 MPU_SLAVE_IRQ_TYPE_NONE,
104 MPU_SLAVE_IRQ_TYPE_MOTION,
105 MPU_SLAVE_IRQ_TYPE_DATA_READY,
106};
107
108/* Structure for the following IOCTS's
109 * MPU_CONFIG_GYRO
110 * MPU_CONFIG_ACCEL
111 * MPU_CONFIG_COMPASS
112 * MPU_CONFIG_PRESSURE
113 * MPU_GET_CONFIG_GYRO
114 * MPU_GET_CONFIG_ACCEL
115 * MPU_GET_CONFIG_COMPASS
116 * MPU_GET_CONFIG_PRESSURE
117 *
118 * @key one of enum ext_slave_config_key
119 * @len length of data pointed to by data
120 * @apply zero if communication with the chip is not necessary, false otherwise
121 * This flag can be used to select cached data or to refresh cashed data
122 * cache data to be pushed later or push immediately. If true and the
123 * slave is on the secondary bus the MPU will first enger bypass mode
124 * before calling the slaves .config or .get_config funcion
125 * @data pointer to the data to confgure or get
126 */
127struct ext_slave_config {
128 __u8 key;
129 __u16 len;
130 __u8 apply;
131 void *data;
132};
133
134enum ext_slave_type {
135 EXT_SLAVE_TYPE_GYROSCOPE,
136 EXT_SLAVE_TYPE_ACCEL,
137 EXT_SLAVE_TYPE_COMPASS,
138 EXT_SLAVE_TYPE_PRESSURE,
139 /*EXT_SLAVE_TYPE_TEMPERATURE */
140
141 EXT_SLAVE_NUM_TYPES
142};
143
144enum ext_slave_id {
145 ID_INVALID = 0,
146
147 ACCEL_ID_LIS331,
148 ACCEL_ID_LSM303DLX,
149 ACCEL_ID_LIS3DH,
150 ACCEL_ID_KXSD9,
151 ACCEL_ID_KXTF9,
152 ACCEL_ID_BMA150,
153 ACCEL_ID_BMA222,
154 ACCEL_ID_BMA250,
155 ACCEL_ID_ADXL34X,
156 ACCEL_ID_MMA8450,
157 ACCEL_ID_MMA845X,
158 ACCEL_ID_MPU6050,
159
160 COMPASS_ID_AK8975,
161 COMPASS_ID_AK8963,
162 COMPASS_ID_AK8972,
163 COMPASS_ID_AMI30X,
164 COMPASS_ID_AMI306,
165 COMPASS_ID_YAS529,
166 COMPASS_ID_YAS530,
167 COMPASS_ID_HMC5883,
168 COMPASS_ID_LSM303DLH,
169 COMPASS_ID_LSM303DLM,
170 COMPASS_ID_MMC314X,
171 COMPASS_ID_HSCDTD002B,
172 COMPASS_ID_HSCDTD004A,
173
174 PRESSURE_ID_BMA085,
175};
176
177enum ext_slave_endian {
178 EXT_SLAVE_BIG_ENDIAN,
179 EXT_SLAVE_LITTLE_ENDIAN,
180 EXT_SLAVE_FS8_BIG_ENDIAN,
181 EXT_SLAVE_FS16_BIG_ENDIAN,
182};
183
184enum ext_slave_bus {
185 EXT_SLAVE_BUS_INVALID = -1,
186 EXT_SLAVE_BUS_PRIMARY = 0,
187 EXT_SLAVE_BUS_SECONDARY = 1
188};
189
190
191/**
192 * struct ext_slave_platform_data - Platform data for mpu3050 and mpu6050
193 * slave devices
194 *
195 * @type: the type of slave device based on the enum ext_slave_type
196 * definitions.
197 * @irq: the irq number attached to the slave if any.
198 * @adapt_num: the I2C adapter number.
199 * @bus: the bus the slave is attached to: enum ext_slave_bus
200 * @address: the I2C slave address of the slave device.
201 * @orientation: the mounting matrix of the device relative to MPU.
202 * @irq_data: private data for the slave irq handler
203 * @private_data: additional data, user customizable. Not touched by the MPU
204 * driver.
205 *
206 * The orientation matricies are 3x3 rotation matricies
207 * that are applied to the data to rotate from the mounting orientation to the
208 * platform orientation. The values must be one of 0, 1, or -1 and each row and
209 * column should have exactly 1 non-zero value.
210 */
211struct ext_slave_platform_data {
212 __u8 type;
213 __u32 irq;
214 __u32 adapt_num;
215 __u32 bus;
216 __u8 address;
217 __s8 orientation[9];
218 void *irq_data;
219 void *private_data;
220};
221
222struct fix_pnt_range {
223 __s32 mantissa;
224 __s32 fraction;
225};
226
227static inline long range_fixedpoint_to_long_mg(struct fix_pnt_range rng)
228{
229 return (long)(rng.mantissa * 1000 + rng.fraction / 10);
230}
231
232struct ext_slave_read_trigger {
233 __u8 reg;
234 __u8 value;
235};
236
237/**
238 * struct ext_slave_descr - Description of the slave device for programming.
239 *
240 * @suspend: function pointer to put the device in suspended state
241 * @resume: function pointer to put the device in running state
242 * @read: function that reads the device data
243 * @init: function used to preallocate memory used by the driver
244 * @exit: function used to free memory allocated for the driver
245 * @config: function used to configure the device
246 * @get_config:function used to get the device's configuration
247 *
248 * @name: text name of the device
249 * @type: device type. enum ext_slave_type
250 * @id: enum ext_slave_id
251 * @read_reg: starting register address to retrieve data.
252 * @read_len: length in bytes of the sensor data. Typically 6.
253 * @endian: byte order of the data. enum ext_slave_endian
254 * @range: full scale range of the slave ouput: struct fix_pnt_range
255 * @trigger: If reading data first requires writing a register this is the
256 * data to write.
257 *
258 * Defines the functions and information about the slave the mpu3050 and
259 * mpu6050 needs to use the slave device.
260 */
261struct ext_slave_descr {
262 int (*init) (void *mlsl_handle,
263 struct ext_slave_descr *slave,
264 struct ext_slave_platform_data *pdata);
265 int (*exit) (void *mlsl_handle,
266 struct ext_slave_descr *slave,
267 struct ext_slave_platform_data *pdata);
268 int (*suspend) (void *mlsl_handle,
269 struct ext_slave_descr *slave,
270 struct ext_slave_platform_data *pdata);
271 int (*resume) (void *mlsl_handle,
272 struct ext_slave_descr *slave,
273 struct ext_slave_platform_data *pdata);
274 int (*read) (void *mlsl_handle,
275 struct ext_slave_descr *slave,
276 struct ext_slave_platform_data *pdata,
277 __u8 *data);
278 int (*config) (void *mlsl_handle,
279 struct ext_slave_descr *slave,
280 struct ext_slave_platform_data *pdata,
281 struct ext_slave_config *config);
282 int (*get_config) (void *mlsl_handle,
283 struct ext_slave_descr *slave,
284 struct ext_slave_platform_data *pdata,
285 struct ext_slave_config *config);
286
287 char *name;
288 __u8 type;
289 __u8 id;
290 __u8 read_reg;
291 __u8 read_len;
292 __u8 endian;
293 struct fix_pnt_range range;
294 struct ext_slave_read_trigger *trigger;
295};
296
297/**
298 * struct mpu_platform_data - Platform data for the mpu driver
299 * @int_config: Bits [7:3] of the int config register.
300 * @level_shifter: 0: VLogic, 1: VDD
301 * @orientation: Orientation matrix of the gyroscope
302 *
303 * Contains platform specific information on how to configure the MPU3050 to
304 * work on this platform. The orientation matricies are 3x3 rotation matricies
305 * that are applied to the data to rotate from the mounting orientation to the
306 * platform orientation. The values must be one of 0, 1, or -1 and each row and
307 * column should have exactly 1 non-zero value.
308 */
309struct mpu_platform_data {
310 __u8 int_config;
311 __u8 level_shifter;
312 __s8 orientation[GYRO_NUM_AXES * GYRO_NUM_AXES];
313};
314
315#define MPU_IOCTL (0x81) /* Magic number for MPU Iocts */
316/* IOCTL commands for /dev/mpu */
317
318/*--------------------------------------------------------------------------
319 * Deprecated, debugging only
320 */
321#define MPU_SET_MPU_PLATFORM_DATA \
322 _IOWR(MPU_IOCTL, 0x01, struct mpu_platform_data)
323#define MPU_SET_EXT_SLAVE_PLATFORM_DATA \
324 _IOWR(MPU_IOCTL, 0x01, struct ext_slave_platform_data)
325/*--------------------------------------------------------------------------*/
326#define MPU_GET_EXT_SLAVE_PLATFORM_DATA \
327 _IOWR(MPU_IOCTL, 0x02, struct ext_slave_platform_data)
328#define MPU_GET_MPU_PLATFORM_DATA \
329 _IOWR(MPU_IOCTL, 0x02, struct mpu_platform_data)
330#define MPU_GET_EXT_SLAVE_DESCR \
331 _IOWR(MPU_IOCTL, 0x02, struct ext_slave_descr)
332
333#define MPU_READ _IOWR(MPU_IOCTL, 0x10, struct mpu_read_write)
334#define MPU_WRITE _IOW(MPU_IOCTL, 0x10, struct mpu_read_write)
335#define MPU_READ_MEM _IOWR(MPU_IOCTL, 0x11, struct mpu_read_write)
336#define MPU_WRITE_MEM _IOW(MPU_IOCTL, 0x11, struct mpu_read_write)
337#define MPU_READ_FIFO _IOWR(MPU_IOCTL, 0x12, struct mpu_read_write)
338#define MPU_WRITE_FIFO _IOW(MPU_IOCTL, 0x12, struct mpu_read_write)
339
340#define MPU_READ_COMPASS _IOR(MPU_IOCTL, 0x12, __u8)
341#define MPU_READ_ACCEL _IOR(MPU_IOCTL, 0x13, __u8)
342#define MPU_READ_PRESSURE _IOR(MPU_IOCTL, 0x14, __u8)
343
344#define MPU_CONFIG_GYRO _IOW(MPU_IOCTL, 0x20, struct ext_slave_config)
345#define MPU_CONFIG_ACCEL _IOW(MPU_IOCTL, 0x21, struct ext_slave_config)
346#define MPU_CONFIG_COMPASS _IOW(MPU_IOCTL, 0x22, struct ext_slave_config)
347#define MPU_CONFIG_PRESSURE _IOW(MPU_IOCTL, 0x23, struct ext_slave_config)
348
349#define MPU_GET_CONFIG_GYRO _IOWR(MPU_IOCTL, 0x20, struct ext_slave_config)
350#define MPU_GET_CONFIG_ACCEL _IOWR(MPU_IOCTL, 0x21, struct ext_slave_config)
351#define MPU_GET_CONFIG_COMPASS _IOWR(MPU_IOCTL, 0x22, struct ext_slave_config)
352#define MPU_GET_CONFIG_PRESSURE _IOWR(MPU_IOCTL, 0x23, struct ext_slave_config)
353
354#define MPU_SUSPEND _IOW(MPU_IOCTL, 0x30, __u32)
355#define MPU_RESUME _IOW(MPU_IOCTL, 0x31, __u32)
356/* Userspace PM Event response */
357#define MPU_PM_EVENT_HANDLED _IO(MPU_IOCTL, 0x32)
358
359#define MPU_GET_REQUESTED_SENSORS _IOR(MPU_IOCTL, 0x40, __u8)
360#define MPU_SET_REQUESTED_SENSORS _IOW(MPU_IOCTL, 0x40, __u8)
361#define MPU_GET_IGNORE_SYSTEM_SUSPEND _IOR(MPU_IOCTL, 0x41, __u8)
362#define MPU_SET_IGNORE_SYSTEM_SUSPEND _IOW(MPU_IOCTL, 0x41, __u8)
363#define MPU_GET_MLDL_STATUS _IOR(MPU_IOCTL, 0x42, __u8)
364#define MPU_GET_I2C_SLAVES_ENABLED _IOR(MPU_IOCTL, 0x43, __u8)
365
366
367#endif /* __MPU_H_ */
diff --git a/include/linux/mpu3050.h b/include/linux/mpu3050.h
new file mode 100644
index 00000000000..a8dcd5a9473
--- /dev/null
+++ b/include/linux/mpu3050.h
@@ -0,0 +1,255 @@
1/*
2 $License:
3 Copyright (C) 2010 InvenSense Corporation, All Rights Reserved.
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 $
18 */
19
20#ifndef __MPU3050_H_
21#define __MPU3050_H_
22
23#ifdef __KERNEL__
24#include <linux/types.h>
25#endif
26
27#ifdef M_HW
28#error MPU6000 build including MPU3050 header
29#endif
30
31#define MPU_NAME "mpu3050"
32#define DEFAULT_MPU_SLAVEADDR 0x68
33
34/*==== MPU REGISTER SET ====*/
35enum mpu_register {
36 MPUREG_WHO_AM_I = 0, /* 00 0x00 */
37 MPUREG_PRODUCT_ID, /* 01 0x01 */
38 MPUREG_02_RSVD, /* 02 0x02 */
39 MPUREG_03_RSVD, /* 03 0x03 */
40 MPUREG_04_RSVD, /* 04 0x04 */
41 MPUREG_XG_OFFS_TC, /* 05 0x05 */
42 MPUREG_06_RSVD, /* 06 0x06 */
43 MPUREG_07_RSVD, /* 07 0x07 */
44 MPUREG_YG_OFFS_TC, /* 08 0x08 */
45 MPUREG_09_RSVD, /* 09 0x09 */
46 MPUREG_0A_RSVD, /* 10 0x0a */
47 MPUREG_ZG_OFFS_TC, /* 11 0x0b */
48 MPUREG_X_OFFS_USRH, /* 12 0x0c */
49 MPUREG_X_OFFS_USRL, /* 13 0x0d */
50 MPUREG_Y_OFFS_USRH, /* 14 0x0e */
51 MPUREG_Y_OFFS_USRL, /* 15 0x0f */
52 MPUREG_Z_OFFS_USRH, /* 16 0x10 */
53 MPUREG_Z_OFFS_USRL, /* 17 0x11 */
54 MPUREG_FIFO_EN1, /* 18 0x12 */
55 MPUREG_FIFO_EN2, /* 19 0x13 */
56 MPUREG_AUX_SLV_ADDR, /* 20 0x14 */
57 MPUREG_SMPLRT_DIV, /* 21 0x15 */
58 MPUREG_DLPF_FS_SYNC, /* 22 0x16 */
59 MPUREG_INT_CFG, /* 23 0x17 */
60 MPUREG_ACCEL_BURST_ADDR,/* 24 0x18 */
61 MPUREG_19_RSVD, /* 25 0x19 */
62 MPUREG_INT_STATUS, /* 26 0x1a */
63 MPUREG_TEMP_OUT_H, /* 27 0x1b */
64 MPUREG_TEMP_OUT_L, /* 28 0x1c */
65 MPUREG_GYRO_XOUT_H, /* 29 0x1d */
66 MPUREG_GYRO_XOUT_L, /* 30 0x1e */
67 MPUREG_GYRO_YOUT_H, /* 31 0x1f */
68 MPUREG_GYRO_YOUT_L, /* 32 0x20 */
69 MPUREG_GYRO_ZOUT_H, /* 33 0x21 */
70 MPUREG_GYRO_ZOUT_L, /* 34 0x22 */
71 MPUREG_23_RSVD, /* 35 0x23 */
72 MPUREG_24_RSVD, /* 36 0x24 */
73 MPUREG_25_RSVD, /* 37 0x25 */
74 MPUREG_26_RSVD, /* 38 0x26 */
75 MPUREG_27_RSVD, /* 39 0x27 */
76 MPUREG_28_RSVD, /* 40 0x28 */
77 MPUREG_29_RSVD, /* 41 0x29 */
78 MPUREG_2A_RSVD, /* 42 0x2a */
79 MPUREG_2B_RSVD, /* 43 0x2b */
80 MPUREG_2C_RSVD, /* 44 0x2c */
81 MPUREG_2D_RSVD, /* 45 0x2d */
82 MPUREG_2E_RSVD, /* 46 0x2e */
83 MPUREG_2F_RSVD, /* 47 0x2f */
84 MPUREG_30_RSVD, /* 48 0x30 */
85 MPUREG_31_RSVD, /* 49 0x31 */
86 MPUREG_32_RSVD, /* 50 0x32 */
87 MPUREG_33_RSVD, /* 51 0x33 */
88 MPUREG_34_RSVD, /* 52 0x34 */
89 MPUREG_DMP_CFG_1, /* 53 0x35 */
90 MPUREG_DMP_CFG_2, /* 54 0x36 */
91 MPUREG_BANK_SEL, /* 55 0x37 */
92 MPUREG_MEM_START_ADDR, /* 56 0x38 */
93 MPUREG_MEM_R_W, /* 57 0x39 */
94 MPUREG_FIFO_COUNTH, /* 58 0x3a */
95 MPUREG_FIFO_COUNTL, /* 59 0x3b */
96 MPUREG_FIFO_R_W, /* 60 0x3c */
97 MPUREG_USER_CTRL, /* 61 0x3d */
98 MPUREG_PWR_MGM, /* 62 0x3e */
99 MPUREG_3F_RSVD, /* 63 0x3f */
100 NUM_OF_MPU_REGISTERS /* 64 0x40 */
101};
102
103/*==== BITS FOR MPU ====*/
104
105/*---- MPU 'FIFO_EN1' register (12) ----*/
106#define BIT_TEMP_OUT 0x80
107#define BIT_GYRO_XOUT 0x40
108#define BIT_GYRO_YOUT 0x20
109#define BIT_GYRO_ZOUT 0x10
110#define BIT_ACCEL_XOUT 0x08
111#define BIT_ACCEL_YOUT 0x04
112#define BIT_ACCEL_ZOUT 0x02
113#define BIT_AUX_1OUT 0x01
114/*---- MPU 'FIFO_EN2' register (13) ----*/
115#define BIT_AUX_2OUT 0x02
116#define BIT_AUX_3OUT 0x01
117/*---- MPU 'DLPF_FS_SYNC' register (16) ----*/
118#define BITS_EXT_SYNC_NONE 0x00
119#define BITS_EXT_SYNC_TEMP 0x20
120#define BITS_EXT_SYNC_GYROX 0x40
121#define BITS_EXT_SYNC_GYROY 0x60
122#define BITS_EXT_SYNC_GYROZ 0x80
123#define BITS_EXT_SYNC_ACCELX 0xA0
124#define BITS_EXT_SYNC_ACCELY 0xC0
125#define BITS_EXT_SYNC_ACCELZ 0xE0
126#define BITS_EXT_SYNC_MASK 0xE0
127#define BITS_FS_250DPS 0x00
128#define BITS_FS_500DPS 0x08
129#define BITS_FS_1000DPS 0x10
130#define BITS_FS_2000DPS 0x18
131#define BITS_FS_MASK 0x18
132#define BITS_DLPF_CFG_256HZ_NOLPF2 0x00
133#define BITS_DLPF_CFG_188HZ 0x01
134#define BITS_DLPF_CFG_98HZ 0x02
135#define BITS_DLPF_CFG_42HZ 0x03
136#define BITS_DLPF_CFG_20HZ 0x04
137#define BITS_DLPF_CFG_10HZ 0x05
138#define BITS_DLPF_CFG_5HZ 0x06
139#define BITS_DLPF_CFG_2100HZ_NOLPF 0x07
140#define BITS_DLPF_CFG_MASK 0x07
141/*---- MPU 'INT_CFG' register (17) ----*/
142#define BIT_ACTL 0x80
143#define BIT_ACTL_LOW 0x80
144#define BIT_ACTL_HIGH 0x00
145#define BIT_OPEN 0x40
146#define BIT_OPEN_DRAIN 0x40
147#define BIT_PUSH_PULL 0x00
148#define BIT_LATCH_INT_EN 0x20
149#define BIT_LATCH_INT_EN 0x20
150#define BIT_INT_PULSE_WIDTH_50US 0x00
151#define BIT_INT_ANYRD_2CLEAR 0x10
152#define BIT_INT_STAT_READ_2CLEAR 0x00
153#define BIT_MPU_RDY_EN 0x04
154#define BIT_DMP_INT_EN 0x02
155#define BIT_RAW_RDY_EN 0x01
156/*---- MPU 'INT_STATUS' register (1A) ----*/
157#define BIT_INT_STATUS_FIFO_OVERLOW 0x80
158#define BIT_MPU_RDY 0x04
159#define BIT_DMP_INT 0x02
160#define BIT_RAW_RDY 0x01
161/*---- MPU 'BANK_SEL' register (37) ----*/
162#define BIT_PRFTCH_EN 0x20
163#define BIT_CFG_USER_BANK 0x10
164#define BITS_MEM_SEL 0x0f
165/*---- MPU 'USER_CTRL' register (3D) ----*/
166#define BIT_DMP_EN 0x80
167#define BIT_FIFO_EN 0x40
168#define BIT_AUX_IF_EN 0x20
169#define BIT_AUX_RD_LENG 0x10
170#define BIT_AUX_IF_RST 0x08
171#define BIT_DMP_RST 0x04
172#define BIT_FIFO_RST 0x02
173#define BIT_GYRO_RST 0x01
174/*---- MPU 'PWR_MGM' register (3E) ----*/
175#define BIT_H_RESET 0x80
176#define BIT_SLEEP 0x40
177#define BIT_STBY_XG 0x20
178#define BIT_STBY_YG 0x10
179#define BIT_STBY_ZG 0x08
180#define BITS_CLKSEL 0x07
181
182/*---- MPU Silicon Revision ----*/
183#define MPU_SILICON_REV_A4 1 /* MPU A4 Device */
184#define MPU_SILICON_REV_B1 2 /* MPU B1 Device */
185#define MPU_SILICON_REV_B4 3 /* MPU B4 Device */
186#define MPU_SILICON_REV_B6 4 /* MPU B6 Device */
187
188/*---- MPU Memory ----*/
189#define MPU_MEM_BANK_SIZE (256)
190#define FIFO_HW_SIZE (512)
191
192enum MPU_MEMORY_BANKS {
193 MPU_MEM_RAM_BANK_0 = 0,
194 MPU_MEM_RAM_BANK_1,
195 MPU_MEM_RAM_BANK_2,
196 MPU_MEM_RAM_BANK_3,
197 MPU_MEM_NUM_RAM_BANKS,
198 MPU_MEM_OTP_BANK_0 = MPU_MEM_NUM_RAM_BANKS,
199 /* This one is always last */
200 MPU_MEM_NUM_BANKS
201};
202
203#define MPU_NUM_AXES (3)
204
205/*---- structure containing control variables used by MLDL ----*/
206/*---- MPU clock source settings ----*/
207/*---- MPU filter selections ----*/
208enum mpu_filter {
209 MPU_FILTER_256HZ_NOLPF2 = 0,
210 MPU_FILTER_188HZ,
211 MPU_FILTER_98HZ,
212 MPU_FILTER_42HZ,
213 MPU_FILTER_20HZ,
214 MPU_FILTER_10HZ,
215 MPU_FILTER_5HZ,
216 MPU_FILTER_2100HZ_NOLPF,
217 NUM_MPU_FILTER
218};
219
220enum mpu_fullscale {
221 MPU_FS_250DPS = 0,
222 MPU_FS_500DPS,
223 MPU_FS_1000DPS,
224 MPU_FS_2000DPS,
225 NUM_MPU_FS
226};
227
228enum mpu_clock_sel {
229 MPU_CLK_SEL_INTERNAL = 0,
230 MPU_CLK_SEL_PLLGYROX,
231 MPU_CLK_SEL_PLLGYROY,
232 MPU_CLK_SEL_PLLGYROZ,
233 MPU_CLK_SEL_PLLEXT32K,
234 MPU_CLK_SEL_PLLEXT19M,
235 MPU_CLK_SEL_RESERVED,
236 MPU_CLK_SEL_STOP,
237 NUM_CLK_SEL
238};
239
240enum mpu_ext_sync {
241 MPU_EXT_SYNC_NONE = 0,
242 MPU_EXT_SYNC_TEMP,
243 MPU_EXT_SYNC_GYROX,
244 MPU_EXT_SYNC_GYROY,
245 MPU_EXT_SYNC_GYROZ,
246 MPU_EXT_SYNC_ACCELX,
247 MPU_EXT_SYNC_ACCELY,
248 MPU_EXT_SYNC_ACCELZ,
249 NUM_MPU_EXT_SYNC
250};
251
252#define DLPF_FS_SYNC_VALUE(ext_sync, full_scale, lpf) \
253 ((ext_sync << 5) | (full_scale << 3) | lpf)
254
255#endif /* __MPU3050_H_ */
diff --git a/include/linux/mpu6000.h b/include/linux/mpu6000.h
new file mode 100644
index 00000000000..5a63c8f07b7
--- /dev/null
+++ b/include/linux/mpu6000.h
@@ -0,0 +1,406 @@
1/*
2 $License:
3 Copyright (C) 2010 InvenSense Corporation, All Rights Reserved.
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 $
18 */
19
20/**
21 * @defgroup
22 * @brief
23 *
24 * @{
25 * @file mpu6000.h
26 * @brief
27 */
28
29#ifndef __MPU6000_H_
30#define __MPU6000_H_
31
32#define MPU_NAME "mpu6000"
33#define DEFAULT_MPU_SLAVEADDR 0x68
34
35/*==== M_HW REGISTER SET ====*/
36enum {
37 MPUREG_XG_OFFS_TC = 0, /* 0x00 */
38 MPUREG_YG_OFFS_TC, /* 0x00 */
39 MPUREG_ZG_OFFS_TC, /* 0x00 */
40 MPUREG_X_FINE_GAIN, /* 0x00 */
41 MPUREG_Y_FINE_GAIN, /* 0x00 */
42 MPUREG_Z_FINE_GAIN, /* 0x00 */
43 MPUREG_XA_OFFS_H, /* 0x00 */
44 MPUREG_XA_OFFS_L_TC, /* 0x00 */
45 MPUREG_YA_OFFS_H, /* 0x00 */
46 MPUREG_YA_OFFS_L_TC, /* 0x00 */
47 MPUREG_ZA_OFFS_H, /* 0x00 */
48 MPUREG_ZA_OFFS_L_TC, /* 0xB */
49 MPUREG_0C_RSVD, /* 0x00 */
50 MPUREG_0D_RSVD, /* 0x00 */
51 MPUREG_0E_RSVD, /* 0x00 */
52 MPUREG_0F_RSVD, /* 0x00 */
53 MPUREG_10_RSVD, /* 0x00 */
54 MPUREG_11_RSVD, /* 0x00 */
55 MPUREG_12_RSVD, /* 0x00 */
56 MPUREG_XG_OFFS_USRH, /* 0x00 */
57 MPUREG_XG_OFFS_USRL, /* 0x00 */
58 MPUREG_YG_OFFS_USRH, /* 0x00 */
59 MPUREG_YG_OFFS_USRL, /* 0x00 */
60 MPUREG_ZG_OFFS_USRH, /* 0x00 */
61 MPUREG_ZG_OFFS_USRL, /* 0x00 */
62 MPUREG_SMPLRT_DIV, /* 0x19 */
63 MPUREG_CONFIG, /* 0x1A ==> DLPF_FS_SYNC */
64 MPUREG_GYRO_CONFIG, /* 0x00 */
65 MPUREG_ACCEL_CONFIG, /* 0x00 */
66 MPUREG_ACCEL_FF_THR, /* 0x00 */
67 MPUREG_ACCEL_FF_DUR, /* 0x00 */
68 MPUREG_ACCEL_MOT_THR, /* 0x00 */
69 MPUREG_ACCEL_MOT_DUR, /* 0x00 */
70 MPUREG_ACCEL_ZRMOT_THR, /* 0x00 */
71 MPUREG_ACCEL_ZRMOT_DUR, /* 0x00 */
72 MPUREG_FIFO_EN, /* 0x23 */
73 MPUREG_I2C_MST_CTRL, /* 0x00 */
74 MPUREG_I2C_SLV0_ADDR, /* 0x25 */
75 MPUREG_I2C_SLV0_REG, /* 0x00 */
76 MPUREG_I2C_SLV0_CTRL, /* 0x00 */
77 MPUREG_I2C_SLV1_ADDR, /* 0x28 */
78 MPUREG_I2C_SLV1_REG_PASSWORD, /* 0x00 */
79 MPUREG_I2C_SLV1_CTRL, /* 0x00 */
80 MPUREG_I2C_SLV2_ADDR, /* 0x2B */
81 MPUREG_I2C_SLV2_REG, /* 0x00 */
82 MPUREG_I2C_SLV2_CTRL, /* 0x00 */
83 MPUREG_I2C_SLV3_ADDR, /* 0x2E */
84 MPUREG_I2C_SLV3_REG, /* 0x00 */
85 MPUREG_I2C_SLV3_CTRL, /* 0x00 */
86 MPUREG_I2C_SLV4_ADDR, /* 0x31 */
87 MPUREG_I2C_SLV4_REG, /* 0x00 */
88 MPUREG_I2C_SLV4_DO, /* 0x00 */
89 MPUREG_I2C_SLV4_CTRL, /* 0x00 */
90 MPUREG_I2C_SLV4_DI, /* 0x00 */
91 MPUREG_I2C_MST_STATUS, /* 0x36 */
92 MPUREG_INT_PIN_CFG, /* 0x37 ==> -* INT_CFG */
93 MPUREG_INT_ENABLE, /* 0x38 ==> / */
94 MPUREG_DMP_INT_STATUS, /* 0x39 */
95 MPUREG_INT_STATUS, /* 0x3A */
96 MPUREG_ACCEL_XOUT_H, /* 0x3B */
97 MPUREG_ACCEL_XOUT_L, /* 0x00 */
98 MPUREG_ACCEL_YOUT_H, /* 0x00 */
99 MPUREG_ACCEL_YOUT_L, /* 0x00 */
100 MPUREG_ACCEL_ZOUT_H, /* 0x00 */
101 MPUREG_ACCEL_ZOUT_L, /* 0x00 */
102 MPUREG_TEMP_OUT_H, /* 0x41 */
103 MPUREG_TEMP_OUT_L, /* 0x00 */
104 MPUREG_GYRO_XOUT_H, /* 0x43 */
105 MPUREG_GYRO_XOUT_L, /* 0x00 */
106 MPUREG_GYRO_YOUT_H, /* 0x00 */
107 MPUREG_GYRO_YOUT_L, /* 0x00 */
108 MPUREG_GYRO_ZOUT_H, /* 0x00 */
109 MPUREG_GYRO_ZOUT_L, /* 0x00 */
110 MPUREG_EXT_SLV_SENS_DATA_00, /* 0x49 */
111 MPUREG_EXT_SLV_SENS_DATA_01, /* 0x00 */
112 MPUREG_EXT_SLV_SENS_DATA_02, /* 0x00 */
113 MPUREG_EXT_SLV_SENS_DATA_03, /* 0x00 */
114 MPUREG_EXT_SLV_SENS_DATA_04, /* 0x00 */
115 MPUREG_EXT_SLV_SENS_DATA_05, /* 0x00 */
116 MPUREG_EXT_SLV_SENS_DATA_06, /* 0x4F */
117 MPUREG_EXT_SLV_SENS_DATA_07, /* 0x00 */
118 MPUREG_EXT_SLV_SENS_DATA_08, /* 0x00 */
119 MPUREG_EXT_SLV_SENS_DATA_09, /* 0x00 */
120 MPUREG_EXT_SLV_SENS_DATA_10, /* 0x00 */
121 MPUREG_EXT_SLV_SENS_DATA_11, /* 0x00 */
122 MPUREG_EXT_SLV_SENS_DATA_12, /* 0x55 */
123 MPUREG_EXT_SLV_SENS_DATA_13, /* 0x00 */
124 MPUREG_EXT_SLV_SENS_DATA_14, /* 0x00 */
125 MPUREG_EXT_SLV_SENS_DATA_15, /* 0x00 */
126 MPUREG_EXT_SLV_SENS_DATA_16, /* 0x00 */
127 MPUREG_EXT_SLV_SENS_DATA_17, /* 0x00 */
128 MPUREG_EXT_SLV_SENS_DATA_18, /* 0x5B */
129 MPUREG_EXT_SLV_SENS_DATA_19, /* 0x00 */
130 MPUREG_EXT_SLV_SENS_DATA_20, /* 0x00 */
131 MPUREG_EXT_SLV_SENS_DATA_21, /* 0x00 */
132 MPUREG_EXT_SLV_SENS_DATA_22, /* 0x00 */
133 MPUREG_EXT_SLV_SENS_DATA_23, /* 0x00 */
134 ACCEL_INTEL_STATUS, /* 0x61 */
135 MPUREG_62_RSVD, /* 0x00 */
136 MPUREG_63_RSVD, /* 0x00 */
137 MPUREG_64_RSVD, /* 0x00 */
138 MPUREG_65_RSVD, /* 0x00 */
139 MPUREG_66_RSVD, /* 0x00 */
140 MPUREG_67_RSVD, /* 0x00 */
141 SIGNAL_PATH_RESET, /* 0x68 */
142 ACCEL_INTEL_CTRL, /* 0x69 */
143 MPUREG_USER_CTRL, /* 0x6A */
144 MPUREG_PWR_MGMT_1, /* 0x6B */
145 MPUREG_PWR_MGMT_2, /* 0x00 */
146 MPUREG_BANK_SEL, /* 0x6D */
147 MPUREG_MEM_START_ADDR, /* 0x6E */
148 MPUREG_MEM_R_W, /* 0x6F */
149 MPUREG_PRGM_STRT_ADDRH, /* 0x00 */
150 MPUREG_PRGM_STRT_ADDRL, /* 0x00 */
151 MPUREG_FIFO_COUNTH, /* 0x72 */
152 MPUREG_FIFO_COUNTL, /* 0x00 */
153 MPUREG_FIFO_R_W, /* 0x74 */
154 MPUREG_WHOAMI, /* 0x75,117 */
155
156 NUM_OF_MPU_REGISTERS /* = 0x76,118 */
157};
158
159/*==== M_HW MEMORY ====*/
160enum MPU_MEMORY_BANKS {
161 MEM_RAM_BANK_0 = 0,
162 MEM_RAM_BANK_1,
163 MEM_RAM_BANK_2,
164 MEM_RAM_BANK_3,
165 MEM_RAM_BANK_4,
166 MEM_RAM_BANK_5,
167 MEM_RAM_BANK_6,
168 MEM_RAM_BANK_7,
169 MEM_RAM_BANK_8,
170 MEM_RAM_BANK_9,
171 MEM_RAM_BANK_10,
172 MEM_RAM_BANK_11,
173 MPU_MEM_NUM_RAM_BANKS,
174 MPU_MEM_OTP_BANK_0 = 16
175};
176
177
178/*==== M_HW parameters ====*/
179
180#define NUM_REGS (NUM_OF_MPU_REGISTERS)
181#define START_SENS_REGS (0x3B)
182#define NUM_SENS_REGS (0x60-START_SENS_REGS+1)
183
184/*---- MPU Memory ----*/
185#define NUM_BANKS (MPU_MEM_NUM_RAM_BANKS)
186#define BANK_SIZE (256)
187#define MEM_SIZE (NUM_BANKS*BANK_SIZE)
188#define MPU_MEM_BANK_SIZE (BANK_SIZE) /*alternative name */
189
190#define FIFO_HW_SIZE (1024)
191
192#define NUM_EXT_SLAVES (4)
193
194
195/*==== BITS FOR M_HW ====*/
196
197/*---- M_HW 'FIFO_EN' register (23) ----*/
198#define BIT_TEMP_OUT 0x80
199#define BIT_GYRO_XOUT 0x40
200#define BIT_GYRO_YOUT 0x20
201#define BIT_GYRO_ZOUT 0x10
202#define BIT_ACCEL 0x08
203#define BIT_SLV_2 0x04
204#define BIT_SLV_1 0x02
205#define BIT_SLV_0 0x01
206/*---- M_HW 'CONFIG' register (1A) ----*/
207/*NONE 0xC0 */
208#define BITS_EXT_SYNC_SET 0x38
209#define BITS_DLPF_CFG 0x07
210/*---- M_HW 'GYRO_CONFIG' register (1B) ----*/
211/* voluntarily modified label from BITS_FS_SEL to
212 * BITS_GYRO_FS_SEL to avoid confusion with MPU
213 */
214#define BITS_GYRO_FS_SEL 0x18
215/*NONE 0x07 */
216/*---- M_HW 'ACCEL_CONFIG' register (1C) ----*/
217#define BITS_ACCEL_FS_SEL 0x18
218#define BITS_ACCEL_HPF 0x07
219/*---- M_HW 'I2C_MST_CTRL' register (24) ----*/
220#define BIT_MULT_MST_DIS 0x80
221#define BIT_WAIT_FOR_ES 0x40
222#define BIT_I2C_MST_VDDIO 0x20
223/*NONE 0x10 */
224#define BITS_I2C_MST_CLK 0x0F
225/*---- M_HW 'I2C_SLV?_CTRL' register (27,2A,2D,30) ----*/
226#define BIT_SLV_ENABLE 0x80
227#define BIT_SLV_BYTE_SW 0x40
228/*NONE 0x20 */
229#define BIT_SLV_GRP 0x10
230#define BITS_SLV_LENG 0x0F
231/*---- M_HW 'I2C_SLV4_ADDR' register (31) ----*/
232#define BIT_I2C_SLV4_RNW 0x80
233/*---- M_HW 'I2C_SLV4_CTRL' register (34) ----*/
234#define BIT_I2C_SLV4_EN 0x80
235#define BIT_SLV4_DONE_INT_EN 0x40
236/*NONE 0x3F */
237/*---- M_HW 'I2C_MST_STATUS' register (36) ----*/
238#define BIT_PASSTHROUGH 0x80
239#define BIT_I2C_SLV4_DONE 0x40
240#define BIT_I2C_LOST_ARB 0x20
241#define BIT_I2C_SLV4_NACK 0x10
242#define BIT_I2C_SLV3_NACK 0x08
243#define BIT_I2C_SLV2_NACK 0x04
244#define BIT_I2C_SLV1_NACK 0x02
245#define BIT_I2C_SLV0_NACK 0x01
246/*---- M_HW 'INT_PIN_CFG' register (37) ----*/
247#define BIT_ACTL 0x80
248#define BIT_ACTL_LOW 0x80
249#define BIT_ACTL_HIGH 0x00
250#define BIT_OPEN 0x40
251#define BIT_LATCH_INT_EN 0x20
252#define BIT_INT_ANYRD_2CLEAR 0x10
253#define BIT_ACTL_FSYNC 0x08
254#define BIT_FSYNC_INT_EN 0x04
255#define BIT_BYPASS_EN 0x02
256#define BIT_CLKOUT_EN 0x01
257/*---- M_HW 'INT_ENABLE' register (38) ----*/
258#define BIT_FF_EN 0x80
259#define BIT_MOT_EN 0x40
260#define BIT_ZMOT_EN 0x20
261#define BIT_FIFO_OVERFLOW_EN 0x10
262#define BIT_I2C_MST_INT_EN 0x08
263#define BIT_PLL_RDY_EN 0x04
264#define BIT_DMP_INT_EN 0x02
265#define BIT_RAW_RDY_EN 0x01
266/*---- M_HW 'DMP_INT_STATUS' register (39) ----*/
267/*NONE 0x80 */
268/*NONE 0x40 */
269#define BIT_DMP_INT_5 0x20
270#define BIT_DMP_INT_4 0x10
271#define BIT_DMP_INT_3 0x08
272#define BIT_DMP_INT_2 0x04
273#define BIT_DMP_INT_1 0x02
274#define BIT_DMP_INT_0 0x01
275/*---- M_HW 'INT_STATUS' register (3A) ----*/
276#define BIT_FF_INT 0x80
277#define BIT_MOT_INT 0x40
278#define BIT_ZMOT_INT 0x20
279#define BIT_FIFO_OVERFLOW_INT 0x10
280#define BIT_I2C_MST_INT 0x08
281#define BIT_PLL_RDY_INT 0x04
282#define BIT_DMP_INT 0x02
283#define BIT_RAW_DATA_RDY_INT 0x01
284/*---- M_HW 'BANK_SEL' register (6D) ----*/
285#define BIT_PRFTCH_EN 0x40
286#define BIT_CFG_USER_BANK 0x20
287#define BITS_MEM_SEL 0x1f
288/*---- M_HW 'USER_CTRL' register (6A) ----*/
289#define BIT_DMP_EN 0x80
290#define BIT_FIFO_EN 0x40
291#define BIT_I2C_MST_EN 0x20
292#define BIT_I2C_IF_DIS 0x10
293#define BIT_DMP_RST 0x08
294#define BIT_FIFO_RST 0x04
295#define BIT_I2C_MST_RST 0x02
296#define BIT_SIG_COND_RST 0x01
297/*---- M_HW 'PWR_MGMT_1' register (6B) ----*/
298#define BIT_H_RESET 0x80
299#define BITS_PWRSEL 0x70
300#define BIT_WKUP_INT 0x08
301#define BITS_CLKSEL 0x07
302/*---- M_HW 'PWR_MGMT_2' register (6C) ----*/
303#define BITS_LPA_WAKE_CTRL 0xC0
304#define BIT_STBY_XA 0x20
305#define BIT_STBY_YA 0x10
306#define BIT_STBY_ZA 0x08
307#define BIT_STBY_XG 0x04
308#define BIT_STBY_YG 0x02
309#define BIT_STBY_ZG 0x01
310
311/* although it has 6, this refers to the gyros */
312#define MPU_NUM_AXES (3)
313
314#define ACCEL_MOT_THR_LSB (32) /* mg */
315#define ACCEL_MOT_DUR_LSB (1)
316#define ACCEL_ZRMOT_THR_LSB_CONVERSION(mg) ((mg *1000)/255)
317#define ACCEL_ZRMOT_DUR_LSB (64)
318
319/*----------------------------------------------------------------------------*/
320/*---- Alternative names to take care of conflicts with current mpu3050.h ----*/
321/*----------------------------------------------------------------------------*/
322
323/*-- registers --*/
324#define MPUREG_DLPF_FS_SYNC MPUREG_CONFIG /* 0x1A */
325
326#define MPUREG_PRODUCT_ID MPUREG_WHOAMI /* 0x75 HACK!*/
327#define MPUREG_PWR_MGM MPUREG_PWR_MGMT_1 /* 0x6B */
328#define MPUREG_FIFO_EN1 MPUREG_FIFO_EN /* 0x23 */
329#define MPUREG_DMP_CFG_1 MPUREG_PRGM_STRT_ADDRH /* 0x70 */
330#define MPUREG_DMP_CFG_2 MPUREG_PRGM_STRT_ADDRL /* 0x71 */
331#define MPUREG_INT_CFG MPUREG_INT_ENABLE /* 0x38 */
332#define MPUREG_X_OFFS_USRH MPUREG_XG_OFFS_USRH /* 0x13 */
333#define MPUREG_WHO_AM_I MPUREG_WHOAMI /* 0x75 */
334#define MPUREG_23_RSVD MPUREG_EXT_SLV_SENS_DATA_00 /* 0x49 */
335#define MPUREG_AUX_SLV_ADDR MPUREG_I2C_SLV0_ADDR /* 0x25 */
336#define MPUREG_ACCEL_BURST_ADDR MPUREG_I2C_SLV0_REG /* 0x26 */
337
338/*-- bits --*/
339/* 'USER_CTRL' register */
340#define BIT_AUX_IF_EN BIT_I2C_MST_EN
341#define BIT_AUX_RD_LENG BIT_I2C_MST_EN
342#define BIT_IME_IF_RST BIT_I2C_MST_RST
343#define BIT_GYRO_RST BIT_SIG_COND_RST
344/* 'INT_ENABLE' register */
345#define BIT_RAW_RDY BIT_RAW_DATA_RDY_INT
346#define BIT_MPU_RDY_EN BIT_PLL_RDY_EN
347/* 'INT_STATUS' register */
348#define BIT_INT_STATUS_FIFO_OVERLOW BIT_FIFO_OVERFLOW_INT
349
350
351
352/*---- M_HW Silicon Revisions ----*/
353#define MPU_SILICON_REV_A1 1 /* M_HW A1 Device */
354#define MPU_SILICON_REV_B1 2 /* M_HW B1 Device */
355
356/*---- structure containing control variables used by MLDL ----*/
357/*---- MPU clock source settings ----*/
358/*---- MPU filter selections ----*/
359enum mpu_filter {
360 MPU_FILTER_256HZ_NOLPF2 = 0,
361 MPU_FILTER_188HZ,
362 MPU_FILTER_98HZ,
363 MPU_FILTER_42HZ,
364 MPU_FILTER_20HZ,
365 MPU_FILTER_10HZ,
366 MPU_FILTER_5HZ,
367 MPU_FILTER_2100HZ_NOLPF,
368 NUM_MPU_FILTER
369};
370
371enum mpu_fullscale {
372 MPU_FS_250DPS = 0,
373 MPU_FS_500DPS,
374 MPU_FS_1000DPS,
375 MPU_FS_2000DPS,
376 NUM_MPU_FS
377};
378
379enum mpu_clock_sel {
380 MPU_CLK_SEL_INTERNAL = 0,
381 MPU_CLK_SEL_PLLGYROX,
382 MPU_CLK_SEL_PLLGYROY,
383 MPU_CLK_SEL_PLLGYROZ,
384 MPU_CLK_SEL_PLLEXT32K,
385 MPU_CLK_SEL_PLLEXT19M,
386 MPU_CLK_SEL_RESERVED,
387 MPU_CLK_SEL_STOP,
388 NUM_CLK_SEL
389};
390
391enum mpu_ext_sync {
392 MPU_EXT_SYNC_NONE = 0,
393 MPU_EXT_SYNC_TEMP,
394 MPU_EXT_SYNC_GYROX,
395 MPU_EXT_SYNC_GYROY,
396 MPU_EXT_SYNC_GYROZ,
397 MPU_EXT_SYNC_ACCELX,
398 MPU_EXT_SYNC_ACCELY,
399 MPU_EXT_SYNC_ACCELZ,
400 NUM_MPU_EXT_SYNC
401};
402
403#define DLPF_FS_SYNC_VALUE(ext_sync, full_scale, lpf) \
404 ((ext_sync << 5) | (full_scale << 3) | lpf)
405
406#endif /* __IMU6000_H_ */
diff --git a/include/linux/msdos_fs.h b/include/linux/msdos_fs.h
index 34066e65fde..f38d4f0a5ae 100644
--- a/include/linux/msdos_fs.h
+++ b/include/linux/msdos_fs.h
@@ -101,6 +101,7 @@ struct __fat_dirent {
101/* <linux/videotext.h> has used 0x72 ('r') in collision, so skip a few */ 101/* <linux/videotext.h> has used 0x72 ('r') in collision, so skip a few */
102#define FAT_IOCTL_GET_ATTRIBUTES _IOR('r', 0x10, __u32) 102#define FAT_IOCTL_GET_ATTRIBUTES _IOR('r', 0x10, __u32)
103#define FAT_IOCTL_SET_ATTRIBUTES _IOW('r', 0x11, __u32) 103#define FAT_IOCTL_SET_ATTRIBUTES _IOW('r', 0x11, __u32)
104#define VFAT_IOCTL_GET_VOLUME_ID _IOR('r', 0x12, __u32)
104 105
105struct fat_boot_sector { 106struct fat_boot_sector {
106 __u8 ignored[3]; /* Boot strap short or near jump */ 107 __u8 ignored[3]; /* Boot strap short or near jump */
@@ -138,6 +139,17 @@ struct fat_boot_fsinfo {
138 __le32 reserved2[4]; 139 __le32 reserved2[4];
139}; 140};
140 141
142struct fat_boot_bsx {
143 __u8 drive; /* drive number */
144 __u8 reserved1;
145 __u8 signature; /* extended boot signature */
146 __u8 vol_id[4]; /* volume ID */
147 __u8 vol_label[11]; /* volume label */
148 __u8 type[8]; /* file system type */
149};
150#define FAT16_BSX_OFFSET 36 /* offset of fat_boot_bsx in FAT12 and FAT16 */
151#define FAT32_BSX_OFFSET 64 /* offset of fat_boot_bsx in FAT32 */
152
141struct msdos_dir_entry { 153struct msdos_dir_entry {
142 __u8 name[MSDOS_NAME];/* name and extension */ 154 __u8 name[MSDOS_NAME];/* name and extension */
143 __u8 attr; /* attribute bits */ 155 __u8 attr; /* attribute bits */
diff --git a/include/linux/mtd/ubi.h b/include/linux/mtd/ubi.h
index 15da0e99f48..db4836bed51 100644
--- a/include/linux/mtd/ubi.h
+++ b/include/linux/mtd/ubi.h
@@ -155,12 +155,14 @@ struct ubi_device_info {
155}; 155};
156 156
157/* 157/*
158 * enum - volume notification types. 158 * Volume notification types.
159 * @UBI_VOLUME_ADDED: volume has been added 159 * @UBI_VOLUME_ADDED: a volume has been added (an UBI device was attached or a
160 * @UBI_VOLUME_REMOVED: start volume volume 160 * volume was created)
161 * @UBI_VOLUME_RESIZED: volume size has been re-sized 161 * @UBI_VOLUME_REMOVED: a volume has been removed (an UBI device was detached
162 * @UBI_VOLUME_RENAMED: volume name has been re-named 162 * or a volume was removed)
163 * @UBI_VOLUME_UPDATED: volume name has been updated 163 * @UBI_VOLUME_RESIZED: a volume has been re-sized
164 * @UBI_VOLUME_RENAMED: a volume has been re-named
165 * @UBI_VOLUME_UPDATED: data has been written to a volume
164 * 166 *
165 * These constants define which type of event has happened when a volume 167 * These constants define which type of event has happened when a volume
166 * notification function is invoked. 168 * notification function is invoked.
diff --git a/include/linux/mutex.h b/include/linux/mutex.h
index a940fe435ac..9121595a8eb 100644
--- a/include/linux/mutex.h
+++ b/include/linux/mutex.h
@@ -15,7 +15,7 @@
15#include <linux/linkage.h> 15#include <linux/linkage.h>
16#include <linux/lockdep.h> 16#include <linux/lockdep.h>
17 17
18#include <asm/atomic.h> 18#include <linux/atomic.h>
19 19
20/* 20/*
21 * Simple, straightforward mutexes with strict semantics: 21 * Simple, straightforward mutexes with strict semantics:
@@ -92,7 +92,7 @@ do { \
92 \ 92 \
93 __mutex_init((mutex), #mutex, &__key); \ 93 __mutex_init((mutex), #mutex, &__key); \
94} while (0) 94} while (0)
95# define mutex_destroy(mutex) do { } while (0) 95static inline void mutex_destroy(struct mutex *lock) {}
96#endif 96#endif
97 97
98#ifdef CONFIG_DEBUG_LOCK_ALLOC 98#ifdef CONFIG_DEBUG_LOCK_ALLOC
diff --git a/include/linux/namei.h b/include/linux/namei.h
index eba45ea1029..ffc02135c48 100644
--- a/include/linux/namei.h
+++ b/include/linux/namei.h
@@ -48,12 +48,12 @@ enum {LAST_NORM, LAST_ROOT, LAST_DOT, LAST_DOTDOT, LAST_BIND};
48 */ 48 */
49#define LOOKUP_FOLLOW 0x0001 49#define LOOKUP_FOLLOW 0x0001
50#define LOOKUP_DIRECTORY 0x0002 50#define LOOKUP_DIRECTORY 0x0002
51#define LOOKUP_CONTINUE 0x0004 51#define LOOKUP_AUTOMOUNT 0x0004
52 52
53#define LOOKUP_PARENT 0x0010 53#define LOOKUP_PARENT 0x0010
54#define LOOKUP_REVAL 0x0020 54#define LOOKUP_REVAL 0x0020
55#define LOOKUP_RCU 0x0040 55#define LOOKUP_RCU 0x0040
56#define LOOKUP_NO_AUTOMOUNT 0x0080 56
57/* 57/*
58 * Intent data 58 * Intent data
59 */ 59 */
@@ -67,6 +67,7 @@ enum {LAST_NORM, LAST_ROOT, LAST_DOT, LAST_DOTDOT, LAST_BIND};
67#define LOOKUP_EMPTY 0x4000 67#define LOOKUP_EMPTY 0x4000
68 68
69extern int user_path_at(int, const char __user *, unsigned, struct path *); 69extern int user_path_at(int, const char __user *, unsigned, struct path *);
70extern int user_path_at_empty(int, const char __user *, unsigned, struct path *, int *empty);
70 71
71#define user_path(name, path) user_path_at(AT_FDCWD, name, LOOKUP_FOLLOW, path) 72#define user_path(name, path) user_path_at(AT_FDCWD, name, LOOKUP_FOLLOW, path)
72#define user_lpath(name, path) user_path_at(AT_FDCWD, name, 0, path) 73#define user_lpath(name, path) user_path_at(AT_FDCWD, name, 0, path)
@@ -75,9 +76,11 @@ extern int user_path_at(int, const char __user *, unsigned, struct path *);
75 76
76extern int kern_path(const char *, unsigned, struct path *); 77extern int kern_path(const char *, unsigned, struct path *);
77 78
79extern struct dentry *kern_path_create(int, const char *, struct path *, int);
80extern struct dentry *user_path_create(int, const char __user *, struct path *, int);
78extern int kern_path_parent(const char *, struct nameidata *); 81extern int kern_path_parent(const char *, struct nameidata *);
79extern int vfs_path_lookup(struct dentry *, struct vfsmount *, 82extern int vfs_path_lookup(struct dentry *, struct vfsmount *,
80 const char *, unsigned int, struct nameidata *); 83 const char *, unsigned int, struct path *);
81 84
82extern struct file *lookup_instantiate_filp(struct nameidata *nd, struct dentry *dentry, 85extern struct file *lookup_instantiate_filp(struct nameidata *nd, struct dentry *dentry,
83 int (*open)(struct inode *, struct file *)); 86 int (*open)(struct inode *, struct file *));
diff --git a/include/linux/nct1008.h b/include/linux/nct1008.h
new file mode 100644
index 00000000000..0a517f1d6d8
--- /dev/null
+++ b/include/linux/nct1008.h
@@ -0,0 +1,100 @@
1/*
2 * include/linux/nct1008.h
3 *
4 * NCT1008, temperature monitoring device from ON Semiconductors
5 *
6 * Copyright (c) 2010, NVIDIA Corporation.
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, but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 * 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 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 */
22
23#ifndef _LINUX_NCT1008_H
24#define _LINUX_NCT1008_H
25
26#include <linux/types.h>
27
28#include <mach/edp.h>
29
30#define MAX_ZONES 16
31
32struct nct1008_data;
33
34struct nct1008_platform_data {
35 bool supported_hwrev;
36 bool ext_range;
37 u8 conv_rate;
38 u8 offset;
39 u8 hysteresis;
40 s8 shutdown_ext_limit;
41 s8 shutdown_local_limit;
42 s8 throttling_ext_limit;
43 s8 thermal_zones[MAX_ZONES];
44 u8 thermal_zones_sz;
45 void (*alarm_fn)(bool raised);
46 void (*probe_callback)(struct nct1008_data *);
47};
48
49struct nct1008_data {
50 struct workqueue_struct *workqueue;
51 struct work_struct work;
52 struct i2c_client *client;
53 struct nct1008_platform_data plat_data;
54 struct mutex mutex;
55 struct dentry *dent;
56 u8 config;
57 s8 *limits;
58 u8 limits_sz;
59 void (*alarm_fn)(bool raised);
60 struct regulator *nct_reg;
61 long current_lo_limit;
62 long current_hi_limit;
63 int conv_period_ms;
64
65 void (*alert_func)(void *);
66 void *alert_data;
67};
68
69#ifdef CONFIG_SENSORS_NCT1008
70int nct1008_thermal_get_temp(struct nct1008_data *data, long *temp);
71int nct1008_thermal_get_temp_low(struct nct1008_data *data, long *temp);
72int nct1008_thermal_set_limits(struct nct1008_data *data,
73 long lo_limit_milli,
74 long hi_limit_milli);
75int nct1008_thermal_set_alert(struct nct1008_data *data,
76 void (*alert_func)(void *),
77 void *alert_data);
78int nct1008_thermal_set_shutdown_temp(struct nct1008_data *data,
79 long shutdown_temp);
80#else
81static inline int nct1008_thermal_get_temp(struct nct1008_data *data,
82 long *temp)
83{ return -EINVAL; }
84static inline int nct1008_thermal_get_temp_low(struct nct1008_data *data,
85 long *temp)
86{ return -EINVAL; }
87static inline int nct1008_thermal_set_limits(struct nct1008_data *data,
88 long lo_limit_milli,
89 long hi_limit_milli)
90{ return -EINVAL; }
91static inline int nct1008_thermal_set_alert(struct nct1008_data *data,
92 void (*alert_func)(void *),
93 void *alert_data)
94{ return -EINVAL; }
95static inline int nct1008_thermal_set_shutdown_temp(struct nct1008_data *data,
96 long shutdown_temp)
97{ return -EINVAL; }
98#endif
99
100#endif /* _LINUX_NCT1008_H */
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 9e19477991a..ddee79bb8f1 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -34,8 +34,7 @@
34#include <linux/pm_qos_params.h> 34#include <linux/pm_qos_params.h>
35#include <linux/timer.h> 35#include <linux/timer.h>
36#include <linux/delay.h> 36#include <linux/delay.h>
37#include <linux/mm.h> 37#include <linux/atomic.h>
38#include <asm/atomic.h>
39#include <asm/cache.h> 38#include <asm/cache.h>
40#include <asm/byteorder.h> 39#include <asm/byteorder.h>
41 40
@@ -61,11 +60,6 @@ struct wireless_dev;
61#define SET_ETHTOOL_OPS(netdev,ops) \ 60#define SET_ETHTOOL_OPS(netdev,ops) \
62 ( (netdev)->ethtool_ops = (ops) ) 61 ( (netdev)->ethtool_ops = (ops) )
63 62
64#define HAVE_ALLOC_NETDEV /* feature macro: alloc_xxxdev
65 functions are available. */
66#define HAVE_FREE_NETDEV /* free_netdev() */
67#define HAVE_NETDEV_PRIV /* netdev_priv() */
68
69/* hardware address assignment types */ 63/* hardware address assignment types */
70#define NET_ADDR_PERM 0 /* address is permanent (default) */ 64#define NET_ADDR_PERM 0 /* address is permanent (default) */
71#define NET_ADDR_RANDOM 1 /* address is generated randomly */ 65#define NET_ADDR_RANDOM 1 /* address is generated randomly */
@@ -258,21 +252,8 @@ struct netdev_hw_addr_list {
258 netdev_hw_addr_list_for_each(ha, &(dev)->mc) 252 netdev_hw_addr_list_for_each(ha, &(dev)->mc)
259 253
260struct hh_cache { 254struct hh_cache {
261 struct hh_cache *hh_next; /* Next entry */ 255 u16 hh_len;
262 atomic_t hh_refcnt; /* number of users */ 256 u16 __pad;
263/*
264 * We want hh_output, hh_len, hh_lock and hh_data be a in a separate
265 * cache line on SMP.
266 * They are mostly read, but hh_refcnt may be changed quite frequently,
267 * incurring cache line ping pongs.
268 */
269 __be16 hh_type ____cacheline_aligned_in_smp;
270 /* protocol identifier, f.e ETH_P_IP
271 * NOTE: For VLANs, this will be the
272 * encapuslated type. --BLG
273 */
274 u16 hh_len; /* length of header */
275 int (*hh_output)(struct sk_buff *skb);
276 seqlock_t hh_lock; 257 seqlock_t hh_lock;
277 258
278 /* cached hardware header; allow for machine alignment needs. */ 259 /* cached hardware header; allow for machine alignment needs. */
@@ -284,12 +265,6 @@ struct hh_cache {
284 unsigned long hh_data[HH_DATA_ALIGN(LL_MAX_HEADER) / sizeof(long)]; 265 unsigned long hh_data[HH_DATA_ALIGN(LL_MAX_HEADER) / sizeof(long)];
285}; 266};
286 267
287static inline void hh_cache_put(struct hh_cache *hh)
288{
289 if (atomic_dec_and_test(&hh->hh_refcnt))
290 kfree(hh);
291}
292
293/* Reserve HH_DATA_MOD byte aligned hard_header_len, but at least that much. 268/* Reserve HH_DATA_MOD byte aligned hard_header_len, but at least that much.
294 * Alternative is: 269 * Alternative is:
295 * dev->hard_header_len ? (dev->hard_header_len + 270 * dev->hard_header_len ? (dev->hard_header_len +
@@ -314,8 +289,7 @@ struct header_ops {
314 const void *saddr, unsigned len); 289 const void *saddr, unsigned len);
315 int (*parse)(const struct sk_buff *skb, unsigned char *haddr); 290 int (*parse)(const struct sk_buff *skb, unsigned char *haddr);
316 int (*rebuild)(struct sk_buff *skb); 291 int (*rebuild)(struct sk_buff *skb);
317#define HAVE_HEADER_CACHE 292 int (*cache)(const struct neighbour *neigh, struct hh_cache *hh, __be16 type);
318 int (*cache)(const struct neighbour *neigh, struct hh_cache *hh);
319 void (*cache_update)(struct hh_cache *hh, 293 void (*cache_update)(struct hh_cache *hh,
320 const struct net_device *dev, 294 const struct net_device *dev,
321 const unsigned char *haddr); 295 const unsigned char *haddr);
@@ -556,7 +530,7 @@ struct netdev_queue {
556 struct Qdisc *qdisc; 530 struct Qdisc *qdisc;
557 unsigned long state; 531 unsigned long state;
558 struct Qdisc *qdisc_sleeping; 532 struct Qdisc *qdisc_sleeping;
559#ifdef CONFIG_RPS 533#if defined(CONFIG_RPS) || defined(CONFIG_XPS)
560 struct kobject kobj; 534 struct kobject kobj;
561#endif 535#endif
562#if defined(CONFIG_XPS) && defined(CONFIG_NUMA) 536#if defined(CONFIG_XPS) && defined(CONFIG_NUMA)
@@ -794,12 +768,6 @@ struct netdev_tc_txq {
794 * 3. Update dev->stats asynchronously and atomically, and define 768 * 3. Update dev->stats asynchronously and atomically, and define
795 * neither operation. 769 * neither operation.
796 * 770 *
797 * void (*ndo_vlan_rx_register)(struct net_device *dev, struct vlan_group *grp);
798 * If device support VLAN receive acceleration
799 * (ie. dev->features & NETIF_F_HW_VLAN_RX), then this function is called
800 * when vlan groups for the device changes. Note: grp is NULL
801 * if no vlan's groups are being used.
802 *
803 * void (*ndo_vlan_rx_add_vid)(struct net_device *dev, unsigned short vid); 771 * void (*ndo_vlan_rx_add_vid)(struct net_device *dev, unsigned short vid);
804 * If device support VLAN filtering (dev->features & NETIF_F_HW_VLAN_FILTER) 772 * If device support VLAN filtering (dev->features & NETIF_F_HW_VLAN_FILTER)
805 * this function is called when a VLAN id is registered. 773 * this function is called when a VLAN id is registered.
@@ -888,7 +856,6 @@ struct netdev_tc_txq {
888 * Must return >0 or -errno if it changed dev->features itself. 856 * Must return >0 or -errno if it changed dev->features itself.
889 * 857 *
890 */ 858 */
891#define HAVE_NET_DEVICE_OPS
892struct net_device_ops { 859struct net_device_ops {
893 int (*ndo_init)(struct net_device *dev); 860 int (*ndo_init)(struct net_device *dev);
894 void (*ndo_uninit)(struct net_device *dev); 861 void (*ndo_uninit)(struct net_device *dev);
@@ -919,8 +886,6 @@ struct net_device_ops {
919 struct rtnl_link_stats64 *storage); 886 struct rtnl_link_stats64 *storage);
920 struct net_device_stats* (*ndo_get_stats)(struct net_device *dev); 887 struct net_device_stats* (*ndo_get_stats)(struct net_device *dev);
921 888
922 void (*ndo_vlan_rx_register)(struct net_device *dev,
923 struct vlan_group *grp);
924 void (*ndo_vlan_rx_add_vid)(struct net_device *dev, 889 void (*ndo_vlan_rx_add_vid)(struct net_device *dev,
925 unsigned short vid); 890 unsigned short vid);
926 void (*ndo_vlan_rx_kill_vid)(struct net_device *dev, 891 void (*ndo_vlan_rx_kill_vid)(struct net_device *dev,
@@ -1167,7 +1132,7 @@ struct net_device {
1167 spinlock_t addr_list_lock; 1132 spinlock_t addr_list_lock;
1168 struct netdev_hw_addr_list uc; /* Unicast mac addresses */ 1133 struct netdev_hw_addr_list uc; /* Unicast mac addresses */
1169 struct netdev_hw_addr_list mc; /* Multicast mac addresses */ 1134 struct netdev_hw_addr_list mc; /* Multicast mac addresses */
1170 int uc_promisc; 1135 bool uc_promisc;
1171 unsigned int promiscuity; 1136 unsigned int promiscuity;
1172 unsigned int allmulti; 1137 unsigned int allmulti;
1173 1138
@@ -1214,7 +1179,7 @@ struct net_device {
1214 1179
1215 unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */ 1180 unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */
1216 1181
1217#ifdef CONFIG_RPS 1182#if defined(CONFIG_RPS) || defined(CONFIG_XPS)
1218 struct kset *queues_kset; 1183 struct kset *queues_kset;
1219 1184
1220 struct netdev_rx_queue *_rx; 1185 struct netdev_rx_queue *_rx;
@@ -1342,9 +1307,6 @@ struct net_device {
1342 /* max exchange id for FCoE LRO by ddp */ 1307 /* max exchange id for FCoE LRO by ddp */
1343 unsigned int fcoe_ddp_xid; 1308 unsigned int fcoe_ddp_xid;
1344#endif 1309#endif
1345 /* n-tuple filter list attached to this device */
1346 struct ethtool_rx_ntuple_list ethtool_ntuple_list;
1347
1348 /* phy device may attach itself for hardware timestamping */ 1310 /* phy device may attach itself for hardware timestamping */
1349 struct phy_device *phydev; 1311 struct phy_device *phydev;
1350 1312
@@ -1557,9 +1519,41 @@ struct packet_type {
1557 struct list_head list; 1519 struct list_head list;
1558}; 1520};
1559 1521
1560#include <linux/interrupt.h>
1561#include <linux/notifier.h> 1522#include <linux/notifier.h>
1562 1523
1524/* netdevice notifier chain. Please remember to update the rtnetlink
1525 * notification exclusion list in rtnetlink_event() when adding new
1526 * types.
1527 */
1528#define NETDEV_UP 0x0001 /* For now you can't veto a device up/down */
1529#define NETDEV_DOWN 0x0002
1530#define NETDEV_REBOOT 0x0003 /* Tell a protocol stack a network interface
1531 detected a hardware crash and restarted
1532 - we can use this eg to kick tcp sessions
1533 once done */
1534#define NETDEV_CHANGE 0x0004 /* Notify device state change */
1535#define NETDEV_REGISTER 0x0005
1536#define NETDEV_UNREGISTER 0x0006
1537#define NETDEV_CHANGEMTU 0x0007
1538#define NETDEV_CHANGEADDR 0x0008
1539#define NETDEV_GOING_DOWN 0x0009
1540#define NETDEV_CHANGENAME 0x000A
1541#define NETDEV_FEAT_CHANGE 0x000B
1542#define NETDEV_BONDING_FAILOVER 0x000C
1543#define NETDEV_PRE_UP 0x000D
1544#define NETDEV_PRE_TYPE_CHANGE 0x000E
1545#define NETDEV_POST_TYPE_CHANGE 0x000F
1546#define NETDEV_POST_INIT 0x0010
1547#define NETDEV_UNREGISTER_BATCH 0x0011
1548#define NETDEV_RELEASE 0x0012
1549#define NETDEV_NOTIFY_PEERS 0x0013
1550#define NETDEV_JOIN 0x0014
1551
1552extern int register_netdevice_notifier(struct notifier_block *nb);
1553extern int unregister_netdevice_notifier(struct notifier_block *nb);
1554extern int call_netdevice_notifiers(unsigned long val, struct net_device *dev);
1555
1556
1563extern rwlock_t dev_base_lock; /* Device list lock */ 1557extern rwlock_t dev_base_lock; /* Device list lock */
1564 1558
1565 1559
@@ -1642,12 +1636,9 @@ static inline void unregister_netdevice(struct net_device *dev)
1642extern int netdev_refcnt_read(const struct net_device *dev); 1636extern int netdev_refcnt_read(const struct net_device *dev);
1643extern void free_netdev(struct net_device *dev); 1637extern void free_netdev(struct net_device *dev);
1644extern void synchronize_net(void); 1638extern void synchronize_net(void);
1645extern int register_netdevice_notifier(struct notifier_block *nb);
1646extern int unregister_netdevice_notifier(struct notifier_block *nb);
1647extern int init_dummy_netdev(struct net_device *dev); 1639extern int init_dummy_netdev(struct net_device *dev);
1648extern void netdev_resync_ops(struct net_device *dev); 1640extern void netdev_resync_ops(struct net_device *dev);
1649 1641
1650extern int call_netdevice_notifiers(unsigned long val, struct net_device *dev);
1651extern struct net_device *dev_get_by_index(struct net *net, int ifindex); 1642extern struct net_device *dev_get_by_index(struct net *net, int ifindex);
1652extern struct net_device *__dev_get_by_index(struct net *net, int ifindex); 1643extern struct net_device *__dev_get_by_index(struct net *net, int ifindex);
1653extern struct net_device *dev_get_by_index_rcu(struct net *net, int ifindex); 1644extern struct net_device *dev_get_by_index_rcu(struct net *net, int ifindex);
@@ -1688,9 +1679,12 @@ static inline int skb_gro_header_hard(struct sk_buff *skb, unsigned int hlen)
1688static inline void *skb_gro_header_slow(struct sk_buff *skb, unsigned int hlen, 1679static inline void *skb_gro_header_slow(struct sk_buff *skb, unsigned int hlen,
1689 unsigned int offset) 1680 unsigned int offset)
1690{ 1681{
1682 if (!pskb_may_pull(skb, hlen))
1683 return NULL;
1684
1691 NAPI_GRO_CB(skb)->frag0 = NULL; 1685 NAPI_GRO_CB(skb)->frag0 = NULL;
1692 NAPI_GRO_CB(skb)->frag0_len = 0; 1686 NAPI_GRO_CB(skb)->frag0_len = 0;
1693 return pskb_may_pull(skb, hlen) ? skb->data + offset : NULL; 1687 return skb->data + offset;
1694} 1688}
1695 1689
1696static inline void *skb_gro_mac_header(struct sk_buff *skb) 1690static inline void *skb_gro_mac_header(struct sk_buff *skb)
@@ -1780,8 +1774,6 @@ static inline void input_queue_tail_incr_save(struct softnet_data *sd,
1780 1774
1781DECLARE_PER_CPU_ALIGNED(struct softnet_data, softnet_data); 1775DECLARE_PER_CPU_ALIGNED(struct softnet_data, softnet_data);
1782 1776
1783#define HAVE_NETIF_QUEUE
1784
1785extern void __netif_schedule(struct Qdisc *q); 1777extern void __netif_schedule(struct Qdisc *q);
1786 1778
1787static inline void netif_schedule_queue(struct netdev_queue *txq) 1779static inline void netif_schedule_queue(struct netdev_queue *txq)
@@ -2057,10 +2049,8 @@ extern void dev_kfree_skb_irq(struct sk_buff *skb);
2057 */ 2049 */
2058extern void dev_kfree_skb_any(struct sk_buff *skb); 2050extern void dev_kfree_skb_any(struct sk_buff *skb);
2059 2051
2060#define HAVE_NETIF_RX 1
2061extern int netif_rx(struct sk_buff *skb); 2052extern int netif_rx(struct sk_buff *skb);
2062extern int netif_rx_ni(struct sk_buff *skb); 2053extern int netif_rx_ni(struct sk_buff *skb);
2063#define HAVE_NETIF_RECEIVE_SKB 1
2064extern int netif_receive_skb(struct sk_buff *skb); 2054extern int netif_receive_skb(struct sk_buff *skb);
2065extern gro_result_t dev_gro_receive(struct napi_struct *napi, 2055extern gro_result_t dev_gro_receive(struct napi_struct *napi,
2066 struct sk_buff *skb); 2056 struct sk_buff *skb);
@@ -2240,7 +2230,6 @@ extern void netif_device_attach(struct net_device *dev);
2240/* 2230/*
2241 * Network interface message level settings 2231 * Network interface message level settings
2242 */ 2232 */
2243#define HAVE_NETIF_MSG 1
2244 2233
2245enum { 2234enum {
2246 NETIF_MSG_DRV = 0x0001, 2235 NETIF_MSG_DRV = 0x0001,
@@ -2558,7 +2547,6 @@ static inline u32 netdev_get_wanted_features(struct net_device *dev)
2558 return (dev->features & ~dev->hw_features) | dev->wanted_features; 2547 return (dev->features & ~dev->hw_features) | dev->wanted_features;
2559} 2548}
2560u32 netdev_increment_features(u32 all, u32 one, u32 mask); 2549u32 netdev_increment_features(u32 all, u32 one, u32 mask);
2561u32 netdev_fix_features(struct net_device *dev, u32 features);
2562int __netdev_update_features(struct net_device *dev); 2550int __netdev_update_features(struct net_device *dev);
2563void netdev_update_features(struct net_device *dev); 2551void netdev_update_features(struct net_device *dev);
2564void netdev_change_features(struct net_device *dev); 2552void netdev_change_features(struct net_device *dev);
diff --git a/include/linux/netfilter/ipset/ip_set.h b/include/linux/netfilter/ipset/ip_set.h
index 5a262e3ae71..3540c6e262f 100644
--- a/include/linux/netfilter/ipset/ip_set.h
+++ b/include/linux/netfilter/ipset/ip_set.h
@@ -104,6 +104,8 @@ enum {
104 IPSET_ATTR_NAMEREF, 104 IPSET_ATTR_NAMEREF,
105 IPSET_ATTR_IP2, 105 IPSET_ATTR_IP2,
106 IPSET_ATTR_CIDR2, 106 IPSET_ATTR_CIDR2,
107 IPSET_ATTR_IP2_TO,
108 IPSET_ATTR_IFACE,
107 __IPSET_ATTR_ADT_MAX, 109 __IPSET_ATTR_ADT_MAX,
108}; 110};
109#define IPSET_ATTR_ADT_MAX (__IPSET_ATTR_ADT_MAX - 1) 111#define IPSET_ATTR_ADT_MAX (__IPSET_ATTR_ADT_MAX - 1)
@@ -142,12 +144,18 @@ enum ipset_errno {
142enum ipset_cmd_flags { 144enum ipset_cmd_flags {
143 IPSET_FLAG_BIT_EXIST = 0, 145 IPSET_FLAG_BIT_EXIST = 0,
144 IPSET_FLAG_EXIST = (1 << IPSET_FLAG_BIT_EXIST), 146 IPSET_FLAG_EXIST = (1 << IPSET_FLAG_BIT_EXIST),
147 IPSET_FLAG_BIT_LIST_SETNAME = 1,
148 IPSET_FLAG_LIST_SETNAME = (1 << IPSET_FLAG_BIT_LIST_SETNAME),
149 IPSET_FLAG_BIT_LIST_HEADER = 2,
150 IPSET_FLAG_LIST_HEADER = (1 << IPSET_FLAG_BIT_LIST_HEADER),
145}; 151};
146 152
147/* Flags at CADT attribute level */ 153/* Flags at CADT attribute level */
148enum ipset_cadt_flags { 154enum ipset_cadt_flags {
149 IPSET_FLAG_BIT_BEFORE = 0, 155 IPSET_FLAG_BIT_BEFORE = 0,
150 IPSET_FLAG_BEFORE = (1 << IPSET_FLAG_BIT_BEFORE), 156 IPSET_FLAG_BEFORE = (1 << IPSET_FLAG_BIT_BEFORE),
157 IPSET_FLAG_BIT_PHYSDEV = 1,
158 IPSET_FLAG_PHYSDEV = (1 << IPSET_FLAG_BIT_PHYSDEV),
151}; 159};
152 160
153/* Commands with settype-specific attributes */ 161/* Commands with settype-specific attributes */
@@ -165,6 +173,7 @@ enum ipset_adt {
165#include <linux/ipv6.h> 173#include <linux/ipv6.h>
166#include <linux/netlink.h> 174#include <linux/netlink.h>
167#include <linux/netfilter.h> 175#include <linux/netfilter.h>
176#include <linux/netfilter/x_tables.h>
168#include <linux/vmalloc.h> 177#include <linux/vmalloc.h>
169#include <net/netlink.h> 178#include <net/netlink.h>
170 179
@@ -206,6 +215,8 @@ enum ip_set_feature {
206 IPSET_TYPE_IP2 = (1 << IPSET_TYPE_IP2_FLAG), 215 IPSET_TYPE_IP2 = (1 << IPSET_TYPE_IP2_FLAG),
207 IPSET_TYPE_NAME_FLAG = 4, 216 IPSET_TYPE_NAME_FLAG = 4,
208 IPSET_TYPE_NAME = (1 << IPSET_TYPE_NAME_FLAG), 217 IPSET_TYPE_NAME = (1 << IPSET_TYPE_NAME_FLAG),
218 IPSET_TYPE_IFACE_FLAG = 5,
219 IPSET_TYPE_IFACE = (1 << IPSET_TYPE_IFACE_FLAG),
209 /* Strictly speaking not a feature, but a flag for dumping: 220 /* Strictly speaking not a feature, but a flag for dumping:
210 * this settype must be dumped last */ 221 * this settype must be dumped last */
211 IPSET_DUMP_LAST_FLAG = 7, 222 IPSET_DUMP_LAST_FLAG = 7,
@@ -214,7 +225,17 @@ enum ip_set_feature {
214 225
215struct ip_set; 226struct ip_set;
216 227
217typedef int (*ipset_adtfn)(struct ip_set *set, void *value, u32 timeout); 228typedef int (*ipset_adtfn)(struct ip_set *set, void *value,
229 u32 timeout, u32 flags);
230
231/* Kernel API function options */
232struct ip_set_adt_opt {
233 u8 family; /* Actual protocol family */
234 u8 dim; /* Dimension of match/target */
235 u8 flags; /* Direction and negation flags */
236 u32 cmdflags; /* Command-like flags */
237 u32 timeout; /* Timeout value */
238};
218 239
219/* Set type, variant-specific part */ 240/* Set type, variant-specific part */
220struct ip_set_type_variant { 241struct ip_set_type_variant {
@@ -223,14 +244,15 @@ struct ip_set_type_variant {
223 * zero for no match/success to add/delete 244 * zero for no match/success to add/delete
224 * positive for matching element */ 245 * positive for matching element */
225 int (*kadt)(struct ip_set *set, const struct sk_buff * skb, 246 int (*kadt)(struct ip_set *set, const struct sk_buff * skb,
226 enum ipset_adt adt, u8 pf, u8 dim, u8 flags); 247 const struct xt_action_param *par,
248 enum ipset_adt adt, const struct ip_set_adt_opt *opt);
227 249
228 /* Userspace: test/add/del entries 250 /* Userspace: test/add/del entries
229 * returns negative error code, 251 * returns negative error code,
230 * zero for no match/success to add/delete 252 * zero for no match/success to add/delete
231 * positive for matching element */ 253 * positive for matching element */
232 int (*uadt)(struct ip_set *set, struct nlattr *tb[], 254 int (*uadt)(struct ip_set *set, struct nlattr *tb[],
233 enum ipset_adt adt, u32 *lineno, u32 flags); 255 enum ipset_adt adt, u32 *lineno, u32 flags, bool retried);
234 256
235 /* Low level add/del/test functions */ 257 /* Low level add/del/test functions */
236 ipset_adtfn adt[IPSET_ADT_MAX]; 258 ipset_adtfn adt[IPSET_ADT_MAX];
@@ -268,8 +290,8 @@ struct ip_set_type {
268 u8 dimension; 290 u8 dimension;
269 /* Supported family: may be AF_UNSPEC for both AF_INET/AF_INET6 */ 291 /* Supported family: may be AF_UNSPEC for both AF_INET/AF_INET6 */
270 u8 family; 292 u8 family;
271 /* Type revision */ 293 /* Type revisions */
272 u8 revision; 294 u8 revision_min, revision_max;
273 295
274 /* Create set */ 296 /* Create set */
275 int (*create)(struct ip_set *set, struct nlattr *tb[], u32 flags); 297 int (*create)(struct ip_set *set, struct nlattr *tb[], u32 flags);
@@ -300,6 +322,8 @@ struct ip_set {
300 const struct ip_set_type_variant *variant; 322 const struct ip_set_type_variant *variant;
301 /* The actual INET family of the set */ 323 /* The actual INET family of the set */
302 u8 family; 324 u8 family;
325 /* The type revision */
326 u8 revision;
303 /* The type specific data */ 327 /* The type specific data */
304 void *data; 328 void *data;
305}; 329};
@@ -307,21 +331,25 @@ struct ip_set {
307/* register and unregister set references */ 331/* register and unregister set references */
308extern ip_set_id_t ip_set_get_byname(const char *name, struct ip_set **set); 332extern ip_set_id_t ip_set_get_byname(const char *name, struct ip_set **set);
309extern void ip_set_put_byindex(ip_set_id_t index); 333extern void ip_set_put_byindex(ip_set_id_t index);
310extern const char * ip_set_name_byindex(ip_set_id_t index); 334extern const char *ip_set_name_byindex(ip_set_id_t index);
311extern ip_set_id_t ip_set_nfnl_get(const char *name); 335extern ip_set_id_t ip_set_nfnl_get(const char *name);
312extern ip_set_id_t ip_set_nfnl_get_byindex(ip_set_id_t index); 336extern ip_set_id_t ip_set_nfnl_get_byindex(ip_set_id_t index);
313extern void ip_set_nfnl_put(ip_set_id_t index); 337extern void ip_set_nfnl_put(ip_set_id_t index);
314 338
315/* API for iptables set match, and SET target */ 339/* API for iptables set match, and SET target */
340
316extern int ip_set_add(ip_set_id_t id, const struct sk_buff *skb, 341extern int ip_set_add(ip_set_id_t id, const struct sk_buff *skb,
317 u8 family, u8 dim, u8 flags); 342 const struct xt_action_param *par,
343 const struct ip_set_adt_opt *opt);
318extern int ip_set_del(ip_set_id_t id, const struct sk_buff *skb, 344extern int ip_set_del(ip_set_id_t id, const struct sk_buff *skb,
319 u8 family, u8 dim, u8 flags); 345 const struct xt_action_param *par,
346 const struct ip_set_adt_opt *opt);
320extern int ip_set_test(ip_set_id_t id, const struct sk_buff *skb, 347extern int ip_set_test(ip_set_id_t id, const struct sk_buff *skb,
321 u8 family, u8 dim, u8 flags); 348 const struct xt_action_param *par,
349 const struct ip_set_adt_opt *opt);
322 350
323/* Utility functions */ 351/* Utility functions */
324extern void * ip_set_alloc(size_t size); 352extern void *ip_set_alloc(size_t size);
325extern void ip_set_free(void *members); 353extern void ip_set_free(void *members);
326extern int ip_set_get_ipaddr4(struct nlattr *nla, __be32 *ipaddr); 354extern int ip_set_get_ipaddr4(struct nlattr *nla, __be32 *ipaddr);
327extern int ip_set_get_ipaddr6(struct nlattr *nla, union nf_inet_addr *ipaddr); 355extern int ip_set_get_ipaddr6(struct nlattr *nla, union nf_inet_addr *ipaddr);
@@ -331,7 +359,7 @@ ip_set_get_hostipaddr4(struct nlattr *nla, u32 *ipaddr)
331{ 359{
332 __be32 ip; 360 __be32 ip;
333 int ret = ip_set_get_ipaddr4(nla, &ip); 361 int ret = ip_set_get_ipaddr4(nla, &ip);
334 362
335 if (ret) 363 if (ret)
336 return ret; 364 return ret;
337 *ipaddr = ntohl(ip); 365 *ipaddr = ntohl(ip);
diff --git a/include/linux/netfilter/ipset/ip_set_ahash.h b/include/linux/netfilter/ipset/ip_set_ahash.h
index ac3c822eb39..b89fb79cb44 100644
--- a/include/linux/netfilter/ipset/ip_set_ahash.h
+++ b/include/linux/netfilter/ipset/ip_set_ahash.h
@@ -5,6 +5,11 @@
5#include <linux/jhash.h> 5#include <linux/jhash.h>
6#include <linux/netfilter/ipset/ip_set_timeout.h> 6#include <linux/netfilter/ipset/ip_set_timeout.h>
7 7
8#define CONCAT(a, b, c) a##b##c
9#define TOKEN(a, b, c) CONCAT(a, b, c)
10
11#define type_pf_next TOKEN(TYPE, PF, _elem)
12
8/* Hashing which uses arrays to resolve clashing. The hash table is resized 13/* Hashing which uses arrays to resolve clashing. The hash table is resized
9 * (doubled) when searching becomes too long. 14 * (doubled) when searching becomes too long.
10 * Internally jhash is used with the assumption that the size of the 15 * Internally jhash is used with the assumption that the size of the
@@ -23,7 +28,32 @@
23/* Number of elements to store in an initial array block */ 28/* Number of elements to store in an initial array block */
24#define AHASH_INIT_SIZE 4 29#define AHASH_INIT_SIZE 4
25/* Max number of elements to store in an array block */ 30/* Max number of elements to store in an array block */
26#define AHASH_MAX_SIZE (3*4) 31#define AHASH_MAX_SIZE (3*AHASH_INIT_SIZE)
32
33/* Max number of elements can be tuned */
34#ifdef IP_SET_HASH_WITH_MULTI
35#define AHASH_MAX(h) ((h)->ahash_max)
36
37static inline u8
38tune_ahash_max(u8 curr, u32 multi)
39{
40 u32 n;
41
42 if (multi < curr)
43 return curr;
44
45 n = curr + AHASH_INIT_SIZE;
46 /* Currently, at listing one hash bucket must fit into a message.
47 * Therefore we have a hard limit here.
48 */
49 return n > curr && n <= 64 ? n : curr;
50}
51#define TUNE_AHASH_MAX(h, multi) \
52 ((h)->ahash_max = tune_ahash_max((h)->ahash_max, multi))
53#else
54#define AHASH_MAX(h) AHASH_MAX_SIZE
55#define TUNE_AHASH_MAX(h, multi)
56#endif
27 57
28/* A hash bucket */ 58/* A hash bucket */
29struct hbucket { 59struct hbucket {
@@ -38,7 +68,7 @@ struct htable {
38 struct hbucket bucket[0]; /* hashtable buckets */ 68 struct hbucket bucket[0]; /* hashtable buckets */
39}; 69};
40 70
41#define hbucket(h, i) &((h)->bucket[i]) 71#define hbucket(h, i) (&((h)->bucket[i]))
42 72
43/* Book-keeping of the prefixes added to the set */ 73/* Book-keeping of the prefixes added to the set */
44struct ip_set_hash_nets { 74struct ip_set_hash_nets {
@@ -54,9 +84,16 @@ struct ip_set_hash {
54 u32 initval; /* random jhash init value */ 84 u32 initval; /* random jhash init value */
55 u32 timeout; /* timeout value, if enabled */ 85 u32 timeout; /* timeout value, if enabled */
56 struct timer_list gc; /* garbage collection when timeout enabled */ 86 struct timer_list gc; /* garbage collection when timeout enabled */
87 struct type_pf_next next; /* temporary storage for uadd */
88#ifdef IP_SET_HASH_WITH_MULTI
89 u8 ahash_max; /* max elements in an array block */
90#endif
57#ifdef IP_SET_HASH_WITH_NETMASK 91#ifdef IP_SET_HASH_WITH_NETMASK
58 u8 netmask; /* netmask value for subnets to store */ 92 u8 netmask; /* netmask value for subnets to store */
59#endif 93#endif
94#ifdef IP_SET_HASH_WITH_RBTREE
95 struct rb_root rbtree;
96#endif
60#ifdef IP_SET_HASH_WITH_NETS 97#ifdef IP_SET_HASH_WITH_NETS
61 struct ip_set_hash_nets nets[0]; /* book-keeping of prefixes */ 98 struct ip_set_hash_nets nets[0]; /* book-keeping of prefixes */
62#endif 99#endif
@@ -194,17 +231,24 @@ ip_set_hash_destroy(struct ip_set *set)
194 del_timer_sync(&h->gc); 231 del_timer_sync(&h->gc);
195 232
196 ahash_destroy(h->table); 233 ahash_destroy(h->table);
234#ifdef IP_SET_HASH_WITH_RBTREE
235 rbtree_destroy(&h->rbtree);
236#endif
197 kfree(h); 237 kfree(h);
198 238
199 set->data = NULL; 239 set->data = NULL;
200} 240}
201 241
202#define HKEY(data, initval, htable_bits) \
203(jhash2((u32 *)(data), sizeof(struct type_pf_elem)/sizeof(u32), initval) \
204 & jhash_mask(htable_bits))
205
206#endif /* _IP_SET_AHASH_H */ 242#endif /* _IP_SET_AHASH_H */
207 243
244#ifndef HKEY_DATALEN
245#define HKEY_DATALEN sizeof(struct type_pf_elem)
246#endif
247
248#define HKEY(data, initval, htable_bits) \
249(jhash2((u32 *)(data), HKEY_DATALEN/sizeof(u32), initval) \
250 & jhash_mask(htable_bits))
251
208#define CONCAT(a, b, c) a##b##c 252#define CONCAT(a, b, c) a##b##c
209#define TOKEN(a, b, c) CONCAT(a, b, c) 253#define TOKEN(a, b, c) CONCAT(a, b, c)
210 254
@@ -217,6 +261,7 @@ ip_set_hash_destroy(struct ip_set *set)
217#define type_pf_data_netmask TOKEN(TYPE, PF, _data_netmask) 261#define type_pf_data_netmask TOKEN(TYPE, PF, _data_netmask)
218#define type_pf_data_list TOKEN(TYPE, PF, _data_list) 262#define type_pf_data_list TOKEN(TYPE, PF, _data_list)
219#define type_pf_data_tlist TOKEN(TYPE, PF, _data_tlist) 263#define type_pf_data_tlist TOKEN(TYPE, PF, _data_tlist)
264#define type_pf_data_next TOKEN(TYPE, PF, _data_next)
220 265
221#define type_pf_elem TOKEN(TYPE, PF, _elem) 266#define type_pf_elem TOKEN(TYPE, PF, _elem)
222#define type_pf_telem TOKEN(TYPE, PF, _telem) 267#define type_pf_telem TOKEN(TYPE, PF, _telem)
@@ -262,12 +307,13 @@ ip_set_hash_destroy(struct ip_set *set)
262/* Add an element to the hash table when resizing the set: 307/* Add an element to the hash table when resizing the set:
263 * we spare the maintenance of the internal counters. */ 308 * we spare the maintenance of the internal counters. */
264static int 309static int
265type_pf_elem_add(struct hbucket *n, const struct type_pf_elem *value) 310type_pf_elem_add(struct hbucket *n, const struct type_pf_elem *value,
311 u8 ahash_max)
266{ 312{
267 if (n->pos >= n->size) { 313 if (n->pos >= n->size) {
268 void *tmp; 314 void *tmp;
269 315
270 if (n->size >= AHASH_MAX_SIZE) 316 if (n->size >= ahash_max)
271 /* Trigger rehashing */ 317 /* Trigger rehashing */
272 return -EAGAIN; 318 return -EAGAIN;
273 319
@@ -322,7 +368,7 @@ retry:
322 for (j = 0; j < n->pos; j++) { 368 for (j = 0; j < n->pos; j++) {
323 data = ahash_data(n, j); 369 data = ahash_data(n, j);
324 m = hbucket(t, HKEY(data, h->initval, htable_bits)); 370 m = hbucket(t, HKEY(data, h->initval, htable_bits));
325 ret = type_pf_elem_add(m, data); 371 ret = type_pf_elem_add(m, data, AHASH_MAX(h));
326 if (ret < 0) { 372 if (ret < 0) {
327 read_unlock_bh(&set->lock); 373 read_unlock_bh(&set->lock);
328 ahash_destroy(t); 374 ahash_destroy(t);
@@ -346,17 +392,20 @@ retry:
346 return 0; 392 return 0;
347} 393}
348 394
395static inline void
396type_pf_data_next(struct ip_set_hash *h, const struct type_pf_elem *d);
397
349/* Add an element to a hash and update the internal counters when succeeded, 398/* Add an element to a hash and update the internal counters when succeeded,
350 * otherwise report the proper error code. */ 399 * otherwise report the proper error code. */
351static int 400static int
352type_pf_add(struct ip_set *set, void *value, u32 timeout) 401type_pf_add(struct ip_set *set, void *value, u32 timeout, u32 flags)
353{ 402{
354 struct ip_set_hash *h = set->data; 403 struct ip_set_hash *h = set->data;
355 struct htable *t; 404 struct htable *t;
356 const struct type_pf_elem *d = value; 405 const struct type_pf_elem *d = value;
357 struct hbucket *n; 406 struct hbucket *n;
358 int i, ret = 0; 407 int i, ret = 0;
359 u32 key; 408 u32 key, multi = 0;
360 409
361 if (h->elements >= h->maxelem) 410 if (h->elements >= h->maxelem)
362 return -IPSET_ERR_HASH_FULL; 411 return -IPSET_ERR_HASH_FULL;
@@ -366,14 +415,17 @@ type_pf_add(struct ip_set *set, void *value, u32 timeout)
366 key = HKEY(value, h->initval, t->htable_bits); 415 key = HKEY(value, h->initval, t->htable_bits);
367 n = hbucket(t, key); 416 n = hbucket(t, key);
368 for (i = 0; i < n->pos; i++) 417 for (i = 0; i < n->pos; i++)
369 if (type_pf_data_equal(ahash_data(n, i), d)) { 418 if (type_pf_data_equal(ahash_data(n, i), d, &multi)) {
370 ret = -IPSET_ERR_EXIST; 419 ret = -IPSET_ERR_EXIST;
371 goto out; 420 goto out;
372 } 421 }
373 422 TUNE_AHASH_MAX(h, multi);
374 ret = type_pf_elem_add(n, value); 423 ret = type_pf_elem_add(n, value, AHASH_MAX(h));
375 if (ret != 0) 424 if (ret != 0) {
425 if (ret == -EAGAIN)
426 type_pf_data_next(h, d);
376 goto out; 427 goto out;
428 }
377 429
378#ifdef IP_SET_HASH_WITH_NETS 430#ifdef IP_SET_HASH_WITH_NETS
379 add_cidr(h, d->cidr, HOST_MASK); 431 add_cidr(h, d->cidr, HOST_MASK);
@@ -388,7 +440,7 @@ out:
388 * and free up space if possible. 440 * and free up space if possible.
389 */ 441 */
390static int 442static int
391type_pf_del(struct ip_set *set, void *value, u32 timeout) 443type_pf_del(struct ip_set *set, void *value, u32 timeout, u32 flags)
392{ 444{
393 struct ip_set_hash *h = set->data; 445 struct ip_set_hash *h = set->data;
394 struct htable *t = h->table; 446 struct htable *t = h->table;
@@ -396,13 +448,13 @@ type_pf_del(struct ip_set *set, void *value, u32 timeout)
396 struct hbucket *n; 448 struct hbucket *n;
397 int i; 449 int i;
398 struct type_pf_elem *data; 450 struct type_pf_elem *data;
399 u32 key; 451 u32 key, multi = 0;
400 452
401 key = HKEY(value, h->initval, t->htable_bits); 453 key = HKEY(value, h->initval, t->htable_bits);
402 n = hbucket(t, key); 454 n = hbucket(t, key);
403 for (i = 0; i < n->pos; i++) { 455 for (i = 0; i < n->pos; i++) {
404 data = ahash_data(n, i); 456 data = ahash_data(n, i);
405 if (!type_pf_data_equal(data, d)) 457 if (!type_pf_data_equal(data, d, &multi))
406 continue; 458 continue;
407 if (i != n->pos - 1) 459 if (i != n->pos - 1)
408 /* Not last one */ 460 /* Not last one */
@@ -443,17 +495,17 @@ type_pf_test_cidrs(struct ip_set *set, struct type_pf_elem *d, u32 timeout)
443 struct hbucket *n; 495 struct hbucket *n;
444 const struct type_pf_elem *data; 496 const struct type_pf_elem *data;
445 int i, j = 0; 497 int i, j = 0;
446 u32 key; 498 u32 key, multi = 0;
447 u8 host_mask = SET_HOST_MASK(set->family); 499 u8 host_mask = SET_HOST_MASK(set->family);
448 500
449 pr_debug("test by nets\n"); 501 pr_debug("test by nets\n");
450 for (; j < host_mask && h->nets[j].cidr; j++) { 502 for (; j < host_mask && h->nets[j].cidr && !multi; j++) {
451 type_pf_data_netmask(d, h->nets[j].cidr); 503 type_pf_data_netmask(d, h->nets[j].cidr);
452 key = HKEY(d, h->initval, t->htable_bits); 504 key = HKEY(d, h->initval, t->htable_bits);
453 n = hbucket(t, key); 505 n = hbucket(t, key);
454 for (i = 0; i < n->pos; i++) { 506 for (i = 0; i < n->pos; i++) {
455 data = ahash_data(n, i); 507 data = ahash_data(n, i);
456 if (type_pf_data_equal(data, d)) 508 if (type_pf_data_equal(data, d, &multi))
457 return 1; 509 return 1;
458 } 510 }
459 } 511 }
@@ -463,7 +515,7 @@ type_pf_test_cidrs(struct ip_set *set, struct type_pf_elem *d, u32 timeout)
463 515
464/* Test whether the element is added to the set */ 516/* Test whether the element is added to the set */
465static int 517static int
466type_pf_test(struct ip_set *set, void *value, u32 timeout) 518type_pf_test(struct ip_set *set, void *value, u32 timeout, u32 flags)
467{ 519{
468 struct ip_set_hash *h = set->data; 520 struct ip_set_hash *h = set->data;
469 struct htable *t = h->table; 521 struct htable *t = h->table;
@@ -471,7 +523,7 @@ type_pf_test(struct ip_set *set, void *value, u32 timeout)
471 struct hbucket *n; 523 struct hbucket *n;
472 const struct type_pf_elem *data; 524 const struct type_pf_elem *data;
473 int i; 525 int i;
474 u32 key; 526 u32 key, multi = 0;
475 527
476#ifdef IP_SET_HASH_WITH_NETS 528#ifdef IP_SET_HASH_WITH_NETS
477 /* If we test an IP address and not a network address, 529 /* If we test an IP address and not a network address,
@@ -484,7 +536,7 @@ type_pf_test(struct ip_set *set, void *value, u32 timeout)
484 n = hbucket(t, key); 536 n = hbucket(t, key);
485 for (i = 0; i < n->pos; i++) { 537 for (i = 0; i < n->pos; i++) {
486 data = ahash_data(n, i); 538 data = ahash_data(n, i);
487 if (type_pf_data_equal(data, d)) 539 if (type_pf_data_equal(data, d, &multi))
488 return 1; 540 return 1;
489 } 541 }
490 return 0; 542 return 0;
@@ -586,10 +638,11 @@ nla_put_failure:
586 638
587static int 639static int
588type_pf_kadt(struct ip_set *set, const struct sk_buff * skb, 640type_pf_kadt(struct ip_set *set, const struct sk_buff * skb,
589 enum ipset_adt adt, u8 pf, u8 dim, u8 flags); 641 const struct xt_action_param *par,
642 enum ipset_adt adt, const struct ip_set_adt_opt *opt);
590static int 643static int
591type_pf_uadt(struct ip_set *set, struct nlattr *tb[], 644type_pf_uadt(struct ip_set *set, struct nlattr *tb[],
592 enum ipset_adt adt, u32 *lineno, u32 flags); 645 enum ipset_adt adt, u32 *lineno, u32 flags, bool retried);
593 646
594static const struct ip_set_type_variant type_pf_variant = { 647static const struct ip_set_type_variant type_pf_variant = {
595 .kadt = type_pf_kadt, 648 .kadt = type_pf_kadt,
@@ -640,14 +693,14 @@ type_pf_data_timeout_set(struct type_pf_elem *data, u32 timeout)
640 693
641static int 694static int
642type_pf_elem_tadd(struct hbucket *n, const struct type_pf_elem *value, 695type_pf_elem_tadd(struct hbucket *n, const struct type_pf_elem *value,
643 u32 timeout) 696 u8 ahash_max, u32 timeout)
644{ 697{
645 struct type_pf_elem *data; 698 struct type_pf_elem *data;
646 699
647 if (n->pos >= n->size) { 700 if (n->pos >= n->size) {
648 void *tmp; 701 void *tmp;
649 702
650 if (n->size >= AHASH_MAX_SIZE) 703 if (n->size >= ahash_max)
651 /* Trigger rehashing */ 704 /* Trigger rehashing */
652 return -EAGAIN; 705 return -EAGAIN;
653 706
@@ -752,7 +805,7 @@ retry:
752 for (j = 0; j < n->pos; j++) { 805 for (j = 0; j < n->pos; j++) {
753 data = ahash_tdata(n, j); 806 data = ahash_tdata(n, j);
754 m = hbucket(t, HKEY(data, h->initval, htable_bits)); 807 m = hbucket(t, HKEY(data, h->initval, htable_bits));
755 ret = type_pf_elem_tadd(m, data, 808 ret = type_pf_elem_tadd(m, data, AHASH_MAX(h),
756 type_pf_data_timeout(data)); 809 type_pf_data_timeout(data));
757 if (ret < 0) { 810 if (ret < 0) {
758 read_unlock_bh(&set->lock); 811 read_unlock_bh(&set->lock);
@@ -776,15 +829,16 @@ retry:
776} 829}
777 830
778static int 831static int
779type_pf_tadd(struct ip_set *set, void *value, u32 timeout) 832type_pf_tadd(struct ip_set *set, void *value, u32 timeout, u32 flags)
780{ 833{
781 struct ip_set_hash *h = set->data; 834 struct ip_set_hash *h = set->data;
782 struct htable *t = h->table; 835 struct htable *t = h->table;
783 const struct type_pf_elem *d = value; 836 const struct type_pf_elem *d = value;
784 struct hbucket *n; 837 struct hbucket *n;
785 struct type_pf_elem *data; 838 struct type_pf_elem *data;
786 int ret = 0, i, j = AHASH_MAX_SIZE + 1; 839 int ret = 0, i, j = AHASH_MAX(h) + 1;
787 u32 key; 840 bool flag_exist = flags & IPSET_FLAG_EXIST;
841 u32 key, multi = 0;
788 842
789 if (h->elements >= h->maxelem) 843 if (h->elements >= h->maxelem)
790 /* FIXME: when set is full, we slow down here */ 844 /* FIXME: when set is full, we slow down here */
@@ -798,18 +852,18 @@ type_pf_tadd(struct ip_set *set, void *value, u32 timeout)
798 n = hbucket(t, key); 852 n = hbucket(t, key);
799 for (i = 0; i < n->pos; i++) { 853 for (i = 0; i < n->pos; i++) {
800 data = ahash_tdata(n, i); 854 data = ahash_tdata(n, i);
801 if (type_pf_data_equal(data, d)) { 855 if (type_pf_data_equal(data, d, &multi)) {
802 if (type_pf_data_expired(data)) 856 if (type_pf_data_expired(data) || flag_exist)
803 j = i; 857 j = i;
804 else { 858 else {
805 ret = -IPSET_ERR_EXIST; 859 ret = -IPSET_ERR_EXIST;
806 goto out; 860 goto out;
807 } 861 }
808 } else if (j == AHASH_MAX_SIZE + 1 && 862 } else if (j == AHASH_MAX(h) + 1 &&
809 type_pf_data_expired(data)) 863 type_pf_data_expired(data))
810 j = i; 864 j = i;
811 } 865 }
812 if (j != AHASH_MAX_SIZE + 1) { 866 if (j != AHASH_MAX(h) + 1) {
813 data = ahash_tdata(n, j); 867 data = ahash_tdata(n, j);
814#ifdef IP_SET_HASH_WITH_NETS 868#ifdef IP_SET_HASH_WITH_NETS
815 del_cidr(h, data->cidr, HOST_MASK); 869 del_cidr(h, data->cidr, HOST_MASK);
@@ -819,9 +873,13 @@ type_pf_tadd(struct ip_set *set, void *value, u32 timeout)
819 type_pf_data_timeout_set(data, timeout); 873 type_pf_data_timeout_set(data, timeout);
820 goto out; 874 goto out;
821 } 875 }
822 ret = type_pf_elem_tadd(n, d, timeout); 876 TUNE_AHASH_MAX(h, multi);
823 if (ret != 0) 877 ret = type_pf_elem_tadd(n, d, AHASH_MAX(h), timeout);
878 if (ret != 0) {
879 if (ret == -EAGAIN)
880 type_pf_data_next(h, d);
824 goto out; 881 goto out;
882 }
825 883
826#ifdef IP_SET_HASH_WITH_NETS 884#ifdef IP_SET_HASH_WITH_NETS
827 add_cidr(h, d->cidr, HOST_MASK); 885 add_cidr(h, d->cidr, HOST_MASK);
@@ -833,7 +891,7 @@ out:
833} 891}
834 892
835static int 893static int
836type_pf_tdel(struct ip_set *set, void *value, u32 timeout) 894type_pf_tdel(struct ip_set *set, void *value, u32 timeout, u32 flags)
837{ 895{
838 struct ip_set_hash *h = set->data; 896 struct ip_set_hash *h = set->data;
839 struct htable *t = h->table; 897 struct htable *t = h->table;
@@ -841,13 +899,13 @@ type_pf_tdel(struct ip_set *set, void *value, u32 timeout)
841 struct hbucket *n; 899 struct hbucket *n;
842 int i; 900 int i;
843 struct type_pf_elem *data; 901 struct type_pf_elem *data;
844 u32 key; 902 u32 key, multi = 0;
845 903
846 key = HKEY(value, h->initval, t->htable_bits); 904 key = HKEY(value, h->initval, t->htable_bits);
847 n = hbucket(t, key); 905 n = hbucket(t, key);
848 for (i = 0; i < n->pos; i++) { 906 for (i = 0; i < n->pos; i++) {
849 data = ahash_tdata(n, i); 907 data = ahash_tdata(n, i);
850 if (!type_pf_data_equal(data, d)) 908 if (!type_pf_data_equal(data, d, &multi))
851 continue; 909 continue;
852 if (type_pf_data_expired(data)) 910 if (type_pf_data_expired(data))
853 return -IPSET_ERR_EXIST; 911 return -IPSET_ERR_EXIST;
@@ -887,16 +945,16 @@ type_pf_ttest_cidrs(struct ip_set *set, struct type_pf_elem *d, u32 timeout)
887 struct type_pf_elem *data; 945 struct type_pf_elem *data;
888 struct hbucket *n; 946 struct hbucket *n;
889 int i, j = 0; 947 int i, j = 0;
890 u32 key; 948 u32 key, multi = 0;
891 u8 host_mask = SET_HOST_MASK(set->family); 949 u8 host_mask = SET_HOST_MASK(set->family);
892 950
893 for (; j < host_mask && h->nets[j].cidr; j++) { 951 for (; j < host_mask && h->nets[j].cidr && !multi; j++) {
894 type_pf_data_netmask(d, h->nets[j].cidr); 952 type_pf_data_netmask(d, h->nets[j].cidr);
895 key = HKEY(d, h->initval, t->htable_bits); 953 key = HKEY(d, h->initval, t->htable_bits);
896 n = hbucket(t, key); 954 n = hbucket(t, key);
897 for (i = 0; i < n->pos; i++) { 955 for (i = 0; i < n->pos; i++) {
898 data = ahash_tdata(n, i); 956 data = ahash_tdata(n, i);
899 if (type_pf_data_equal(data, d)) 957 if (type_pf_data_equal(data, d, &multi))
900 return !type_pf_data_expired(data); 958 return !type_pf_data_expired(data);
901 } 959 }
902 } 960 }
@@ -905,14 +963,14 @@ type_pf_ttest_cidrs(struct ip_set *set, struct type_pf_elem *d, u32 timeout)
905#endif 963#endif
906 964
907static int 965static int
908type_pf_ttest(struct ip_set *set, void *value, u32 timeout) 966type_pf_ttest(struct ip_set *set, void *value, u32 timeout, u32 flags)
909{ 967{
910 struct ip_set_hash *h = set->data; 968 struct ip_set_hash *h = set->data;
911 struct htable *t = h->table; 969 struct htable *t = h->table;
912 struct type_pf_elem *data, *d = value; 970 struct type_pf_elem *data, *d = value;
913 struct hbucket *n; 971 struct hbucket *n;
914 int i; 972 int i;
915 u32 key; 973 u32 key, multi = 0;
916 974
917#ifdef IP_SET_HASH_WITH_NETS 975#ifdef IP_SET_HASH_WITH_NETS
918 if (d->cidr == SET_HOST_MASK(set->family)) 976 if (d->cidr == SET_HOST_MASK(set->family))
@@ -922,7 +980,7 @@ type_pf_ttest(struct ip_set *set, void *value, u32 timeout)
922 n = hbucket(t, key); 980 n = hbucket(t, key);
923 for (i = 0; i < n->pos; i++) { 981 for (i = 0; i < n->pos; i++) {
924 data = ahash_tdata(n, i); 982 data = ahash_tdata(n, i);
925 if (type_pf_data_equal(data, d)) 983 if (type_pf_data_equal(data, d, &multi))
926 return !type_pf_data_expired(data); 984 return !type_pf_data_expired(data);
927 } 985 }
928 return 0; 986 return 0;
@@ -1030,6 +1088,8 @@ type_pf_gc_init(struct ip_set *set)
1030 IPSET_GC_PERIOD(h->timeout)); 1088 IPSET_GC_PERIOD(h->timeout));
1031} 1089}
1032 1090
1091#undef HKEY_DATALEN
1092#undef HKEY
1033#undef type_pf_data_equal 1093#undef type_pf_data_equal
1034#undef type_pf_data_isnull 1094#undef type_pf_data_isnull
1035#undef type_pf_data_copy 1095#undef type_pf_data_copy
diff --git a/include/linux/netfilter/ipset/ip_set_hash.h b/include/linux/netfilter/ipset/ip_set_hash.h
index b86f15c0452..e2a9fae767f 100644
--- a/include/linux/netfilter/ipset/ip_set_hash.h
+++ b/include/linux/netfilter/ipset/ip_set_hash.h
@@ -11,6 +11,10 @@ enum {
11 IPSET_ERR_INVALID_PROTO, 11 IPSET_ERR_INVALID_PROTO,
12 /* Protocol missing but must be specified */ 12 /* Protocol missing but must be specified */
13 IPSET_ERR_MISSING_PROTO, 13 IPSET_ERR_MISSING_PROTO,
14 /* Range not supported */
15 IPSET_ERR_HASH_RANGE_UNSUPPORTED,
16 /* Invalid range */
17 IPSET_ERR_HASH_RANGE,
14}; 18};
15 19
16#ifdef __KERNEL__ 20#ifdef __KERNEL__
diff --git a/include/linux/netfilter/ipset/ip_set_timeout.h b/include/linux/netfilter/ipset/ip_set_timeout.h
index bcdd40ad39e..47923205a4a 100644
--- a/include/linux/netfilter/ipset/ip_set_timeout.h
+++ b/include/linux/netfilter/ipset/ip_set_timeout.h
@@ -22,6 +22,9 @@
22 22
23#define with_timeout(timeout) ((timeout) != IPSET_NO_TIMEOUT) 23#define with_timeout(timeout) ((timeout) != IPSET_NO_TIMEOUT)
24 24
25#define opt_timeout(opt, map) \
26 (with_timeout((opt)->timeout) ? (opt)->timeout : (map)->timeout)
27
25static inline unsigned int 28static inline unsigned int
26ip_set_timeout_uget(struct nlattr *tb) 29ip_set_timeout_uget(struct nlattr *tb)
27{ 30{
@@ -75,7 +78,7 @@ ip_set_timeout_set(u32 timeout)
75static inline u32 78static inline u32
76ip_set_timeout_get(unsigned long timeout) 79ip_set_timeout_get(unsigned long timeout)
77{ 80{
78 return timeout == IPSET_ELEM_PERMANENT ? 0 : 81 return timeout == IPSET_ELEM_PERMANENT ? 0 :
79 jiffies_to_msecs(timeout - jiffies)/1000; 82 jiffies_to_msecs(timeout - jiffies)/1000;
80} 83}
81 84
diff --git a/include/linux/netfilter/ipset/pfxlen.h b/include/linux/netfilter/ipset/pfxlen.h
index 0e1fb50da56..199fd11fedc 100644
--- a/include/linux/netfilter/ipset/pfxlen.h
+++ b/include/linux/netfilter/ipset/pfxlen.h
@@ -2,7 +2,8 @@
2#define _PFXLEN_H 2#define _PFXLEN_H
3 3
4#include <asm/byteorder.h> 4#include <asm/byteorder.h>
5#include <linux/netfilter.h> 5#include <linux/netfilter.h>
6#include <net/tcp.h>
6 7
7/* Prefixlen maps, by Jan Engelhardt */ 8/* Prefixlen maps, by Jan Engelhardt */
8extern const union nf_inet_addr ip_set_netmask_map[]; 9extern const union nf_inet_addr ip_set_netmask_map[];
@@ -32,4 +33,12 @@ ip_set_hostmask6(u8 pfxlen)
32 return &ip_set_hostmask_map[pfxlen].ip6[0]; 33 return &ip_set_hostmask_map[pfxlen].ip6[0];
33} 34}
34 35
36extern u32 ip_set_range_to_cidr(u32 from, u32 to, u8 *cidr);
37
38#define ip_set_mask_from_to(from, to, cidr) \
39do { \
40 from &= ip_set_hostmask(cidr); \
41 to = from | ~ip_set_hostmask(cidr); \
42} while (0)
43
35#endif /*_PFXLEN_H */ 44#endif /*_PFXLEN_H */
diff --git a/include/linux/netfilter/nfnetlink.h b/include/linux/netfilter/nfnetlink.h
index 2b11fc1a86b..74d33861473 100644
--- a/include/linux/netfilter/nfnetlink.h
+++ b/include/linux/netfilter/nfnetlink.h
@@ -60,6 +60,9 @@ struct nfnl_callback {
60 int (*call)(struct sock *nl, struct sk_buff *skb, 60 int (*call)(struct sock *nl, struct sk_buff *skb,
61 const struct nlmsghdr *nlh, 61 const struct nlmsghdr *nlh,
62 const struct nlattr * const cda[]); 62 const struct nlattr * const cda[]);
63 int (*call_rcu)(struct sock *nl, struct sk_buff *skb,
64 const struct nlmsghdr *nlh,
65 const struct nlattr * const cda[]);
63 const struct nla_policy *policy; /* netlink attribute policy */ 66 const struct nla_policy *policy; /* netlink attribute policy */
64 const u_int16_t attr_count; /* number of nlattr's */ 67 const u_int16_t attr_count; /* number of nlattr's */
65}; 68};
diff --git a/include/linux/netfilter/nfnetlink_queue.h b/include/linux/netfilter/nfnetlink_queue.h
index af94e0014eb..24b32e6c009 100644
--- a/include/linux/netfilter/nfnetlink_queue.h
+++ b/include/linux/netfilter/nfnetlink_queue.h
@@ -8,6 +8,7 @@ enum nfqnl_msg_types {
8 NFQNL_MSG_PACKET, /* packet from kernel to userspace */ 8 NFQNL_MSG_PACKET, /* packet from kernel to userspace */
9 NFQNL_MSG_VERDICT, /* verdict from userspace to kernel */ 9 NFQNL_MSG_VERDICT, /* verdict from userspace to kernel */
10 NFQNL_MSG_CONFIG, /* connect to a particular queue */ 10 NFQNL_MSG_CONFIG, /* connect to a particular queue */
11 NFQNL_MSG_VERDICT_BATCH, /* batchv from userspace to kernel */
11 12
12 NFQNL_MSG_MAX 13 NFQNL_MSG_MAX
13}; 14};
diff --git a/include/linux/netfilter/xt_qtaguid.h b/include/linux/netfilter/xt_qtaguid.h
new file mode 100644
index 00000000000..ca60fbdec2f
--- /dev/null
+++ b/include/linux/netfilter/xt_qtaguid.h
@@ -0,0 +1,13 @@
1#ifndef _XT_QTAGUID_MATCH_H
2#define _XT_QTAGUID_MATCH_H
3
4/* For now we just replace the xt_owner.
5 * FIXME: make iptables aware of qtaguid. */
6#include <linux/netfilter/xt_owner.h>
7
8#define XT_QTAGUID_UID XT_OWNER_UID
9#define XT_QTAGUID_GID XT_OWNER_GID
10#define XT_QTAGUID_SOCKET XT_OWNER_SOCKET
11#define xt_qtaguid_match_info xt_owner_match_info
12
13#endif /* _XT_QTAGUID_MATCH_H */
diff --git a/include/linux/netfilter/xt_quota2.h b/include/linux/netfilter/xt_quota2.h
new file mode 100644
index 00000000000..eadc6903314
--- /dev/null
+++ b/include/linux/netfilter/xt_quota2.h
@@ -0,0 +1,25 @@
1#ifndef _XT_QUOTA_H
2#define _XT_QUOTA_H
3
4enum xt_quota_flags {
5 XT_QUOTA_INVERT = 1 << 0,
6 XT_QUOTA_GROW = 1 << 1,
7 XT_QUOTA_PACKET = 1 << 2,
8 XT_QUOTA_NO_CHANGE = 1 << 3,
9 XT_QUOTA_MASK = 0x0F,
10};
11
12struct xt_quota_counter;
13
14struct xt_quota_mtinfo2 {
15 char name[15];
16 u_int8_t flags;
17
18 /* Comparison-invariant */
19 aligned_u64 quota;
20
21 /* Used internally by the kernel */
22 struct xt_quota_counter *master __attribute__((aligned(8)));
23};
24
25#endif /* _XT_QUOTA_H */
diff --git a/include/linux/netfilter/xt_set.h b/include/linux/netfilter/xt_set.h
index 081f1ded284..c0405ac9287 100644
--- a/include/linux/netfilter/xt_set.h
+++ b/include/linux/netfilter/xt_set.h
@@ -35,7 +35,7 @@ struct xt_set_info_target_v0 {
35 struct xt_set_info_v0 del_set; 35 struct xt_set_info_v0 del_set;
36}; 36};
37 37
38/* Revision 1: current interface to netfilter/iptables */ 38/* Revision 1 match and target */
39 39
40struct xt_set_info { 40struct xt_set_info {
41 ip_set_id_t index; 41 ip_set_id_t index;
@@ -44,13 +44,22 @@ struct xt_set_info {
44}; 44};
45 45
46/* match and target infos */ 46/* match and target infos */
47struct xt_set_info_match { 47struct xt_set_info_match_v1 {
48 struct xt_set_info match_set; 48 struct xt_set_info match_set;
49}; 49};
50 50
51struct xt_set_info_target { 51struct xt_set_info_target_v1 {
52 struct xt_set_info add_set; 52 struct xt_set_info add_set;
53 struct xt_set_info del_set; 53 struct xt_set_info del_set;
54}; 54};
55 55
56/* Revision 2 target */
57
58struct xt_set_info_target_v2 {
59 struct xt_set_info add_set;
60 struct xt_set_info del_set;
61 u32 flags;
62 u32 timeout;
63};
64
56#endif /*_XT_SET_H*/ 65#endif /*_XT_SET_H*/
diff --git a/include/linux/netfilter/xt_socket.h b/include/linux/netfilter/xt_socket.h
index 26d7217bd4f..63594564831 100644
--- a/include/linux/netfilter/xt_socket.h
+++ b/include/linux/netfilter/xt_socket.h
@@ -11,4 +11,10 @@ struct xt_socket_mtinfo1 {
11 __u8 flags; 11 __u8 flags;
12}; 12};
13 13
14void xt_socket_put_sk(struct sock *sk);
15struct sock *xt_socket_get4_sk(const struct sk_buff *skb,
16 struct xt_action_param *par);
17struct sock *xt_socket_get6_sk(const struct sk_buff *skb,
18 struct xt_action_param *par);
19
14#endif /* _XT_SOCKET_H */ 20#endif /* _XT_SOCKET_H */
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index a9dd89552f9..180540a84d3 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -29,7 +29,7 @@
29#define MAX_LINKS 32 29#define MAX_LINKS 32
30 30
31struct sockaddr_nl { 31struct sockaddr_nl {
32 sa_family_t nl_family; /* AF_NETLINK */ 32 __kernel_sa_family_t nl_family; /* AF_NETLINK */
33 unsigned short nl_pad; /* zero */ 33 unsigned short nl_pad; /* zero */
34 __u32 nl_pid; /* port ID */ 34 __u32 nl_pid; /* port ID */
35 __u32 nl_groups; /* multicast groups mask */ 35 __u32 nl_groups; /* multicast groups mask */
@@ -49,6 +49,7 @@ struct nlmsghdr {
49#define NLM_F_MULTI 2 /* Multipart message, terminated by NLMSG_DONE */ 49#define NLM_F_MULTI 2 /* Multipart message, terminated by NLMSG_DONE */
50#define NLM_F_ACK 4 /* Reply with ack, with zero or error code */ 50#define NLM_F_ACK 4 /* Reply with ack, with zero or error code */
51#define NLM_F_ECHO 8 /* Echo this request */ 51#define NLM_F_ECHO 8 /* Echo this request */
52#define NLM_F_DUMP_INTR 16 /* Dump was inconsistent due to sequence change */
52 53
53/* Modifiers to GET request */ 54/* Modifiers to GET request */
54#define NLM_F_ROOT 0x100 /* specify tree root */ 55#define NLM_F_ROOT 0x100 /* specify tree root */
@@ -221,7 +222,9 @@ struct netlink_callback {
221 int (*dump)(struct sk_buff * skb, 222 int (*dump)(struct sk_buff * skb,
222 struct netlink_callback *cb); 223 struct netlink_callback *cb);
223 int (*done)(struct netlink_callback *cb); 224 int (*done)(struct netlink_callback *cb);
224 int family; 225 u16 family;
226 u16 min_dump_alloc;
227 unsigned int prev_seq, seq;
225 long args[6]; 228 long args[6];
226}; 229};
227 230
@@ -259,7 +262,8 @@ __nlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, int type, int len, int flags)
259extern int netlink_dump_start(struct sock *ssk, struct sk_buff *skb, 262extern int netlink_dump_start(struct sock *ssk, struct sk_buff *skb,
260 const struct nlmsghdr *nlh, 263 const struct nlmsghdr *nlh,
261 int (*dump)(struct sk_buff *skb, struct netlink_callback*), 264 int (*dump)(struct sk_buff *skb, struct netlink_callback*),
262 int (*done)(struct netlink_callback*)); 265 int (*done)(struct netlink_callback*),
266 u16 min_dump_alloc);
263 267
264 268
265#define NL_NONROOT_RECV 0x1 269#define NL_NONROOT_RECV 0x1
diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h
index 79358bb712c..5dfa091c334 100644
--- a/include/linux/netpoll.h
+++ b/include/linux/netpoll.h
@@ -40,8 +40,6 @@ struct netpoll_info {
40 struct netpoll *netpoll; 40 struct netpoll *netpoll;
41}; 41};
42 42
43void netpoll_poll_dev(struct net_device *dev);
44void netpoll_poll(struct netpoll *np);
45void netpoll_send_udp(struct netpoll *np, const char *msg, int len); 43void netpoll_send_udp(struct netpoll *np, const char *msg, int len);
46void netpoll_print_options(struct netpoll *np); 44void netpoll_print_options(struct netpoll *np);
47int netpoll_parse_options(struct netpoll *np, char *opt); 45int netpoll_parse_options(struct netpoll *np, char *opt);
diff --git a/include/linux/nfc.h b/include/linux/nfc.h
new file mode 100644
index 00000000000..330a4c5db58
--- /dev/null
+++ b/include/linux/nfc.h
@@ -0,0 +1,126 @@
1/*
2 * Copyright (C) 2011 Instituto Nokia de Tecnologia
3 *
4 * Authors:
5 * Lauro Ramos Venancio <lauro.venancio@openbossa.org>
6 * Aloisio Almeida Jr <aloisio.almeida@openbossa.org>
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
20 * Free Software Foundation, Inc.,
21 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 */
23
24#ifndef __LINUX_NFC_H
25#define __LINUX_NFC_H
26
27#include <linux/types.h>
28#include <linux/socket.h>
29
30#define NFC_GENL_NAME "nfc"
31#define NFC_GENL_VERSION 1
32
33#define NFC_GENL_MCAST_EVENT_NAME "events"
34
35/**
36 * enum nfc_commands - supported nfc commands
37 *
38 * @NFC_CMD_UNSPEC: unspecified command
39 *
40 * @NFC_CMD_GET_DEVICE: request information about a device (requires
41 * %NFC_ATTR_DEVICE_INDEX) or dump request to get a list of all nfc devices
42 * @NFC_CMD_START_POLL: start polling for targets using the given protocols
43 * (requires %NFC_ATTR_DEVICE_INDEX and %NFC_ATTR_PROTOCOLS)
44 * @NFC_CMD_STOP_POLL: stop polling for targets (requires
45 * %NFC_ATTR_DEVICE_INDEX)
46 * @NFC_CMD_GET_TARGET: dump all targets found by the previous poll (requires
47 * %NFC_ATTR_DEVICE_INDEX)
48 * @NFC_EVENT_TARGETS_FOUND: event emitted when a new target is found
49 * (it sends %NFC_ATTR_DEVICE_INDEX)
50 * @NFC_EVENT_DEVICE_ADDED: event emitted when a new device is registred
51 * (it sends %NFC_ATTR_DEVICE_NAME, %NFC_ATTR_DEVICE_INDEX and
52 * %NFC_ATTR_PROTOCOLS)
53 * @NFC_EVENT_DEVICE_REMOVED: event emitted when a device is removed
54 * (it sends %NFC_ATTR_DEVICE_INDEX)
55 */
56enum nfc_commands {
57 NFC_CMD_UNSPEC,
58 NFC_CMD_GET_DEVICE,
59 NFC_CMD_START_POLL,
60 NFC_CMD_STOP_POLL,
61 NFC_CMD_GET_TARGET,
62 NFC_EVENT_TARGETS_FOUND,
63 NFC_EVENT_DEVICE_ADDED,
64 NFC_EVENT_DEVICE_REMOVED,
65/* private: internal use only */
66 __NFC_CMD_AFTER_LAST
67};
68#define NFC_CMD_MAX (__NFC_CMD_AFTER_LAST - 1)
69
70/**
71 * enum nfc_attrs - supported nfc attributes
72 *
73 * @NFC_ATTR_UNSPEC: unspecified attribute
74 *
75 * @NFC_ATTR_DEVICE_INDEX: index of nfc device
76 * @NFC_ATTR_DEVICE_NAME: device name, max 8 chars
77 * @NFC_ATTR_PROTOCOLS: nfc protocols - bitwise or-ed combination from
78 * NFC_PROTO_*_MASK constants
79 * @NFC_ATTR_TARGET_INDEX: index of the nfc target
80 * @NFC_ATTR_TARGET_SENS_RES: NFC-A targets extra information such as NFCID
81 * @NFC_ATTR_TARGET_SEL_RES: NFC-A targets extra information (useful if the
82 * target is not NFC-Forum compliant)
83 */
84enum nfc_attrs {
85 NFC_ATTR_UNSPEC,
86 NFC_ATTR_DEVICE_INDEX,
87 NFC_ATTR_DEVICE_NAME,
88 NFC_ATTR_PROTOCOLS,
89 NFC_ATTR_TARGET_INDEX,
90 NFC_ATTR_TARGET_SENS_RES,
91 NFC_ATTR_TARGET_SEL_RES,
92/* private: internal use only */
93 __NFC_ATTR_AFTER_LAST
94};
95#define NFC_ATTR_MAX (__NFC_ATTR_AFTER_LAST - 1)
96
97#define NFC_DEVICE_NAME_MAXSIZE 8
98
99/* NFC protocols */
100#define NFC_PROTO_JEWEL 1
101#define NFC_PROTO_MIFARE 2
102#define NFC_PROTO_FELICA 3
103#define NFC_PROTO_ISO14443 4
104#define NFC_PROTO_NFC_DEP 5
105
106#define NFC_PROTO_MAX 6
107
108/* NFC protocols masks used in bitsets */
109#define NFC_PROTO_JEWEL_MASK (1 << NFC_PROTO_JEWEL)
110#define NFC_PROTO_MIFARE_MASK (1 << NFC_PROTO_MIFARE)
111#define NFC_PROTO_FELICA_MASK (1 << NFC_PROTO_FELICA)
112#define NFC_PROTO_ISO14443_MASK (1 << NFC_PROTO_ISO14443)
113#define NFC_PROTO_NFC_DEP_MASK (1 << NFC_PROTO_NFC_DEP)
114
115struct sockaddr_nfc {
116 sa_family_t sa_family;
117 __u32 dev_idx;
118 __u32 target_idx;
119 __u32 nfc_protocol;
120};
121
122/* NFC socket protocols */
123#define NFC_SOCKPROTO_RAW 0
124#define NFC_SOCKPROTO_MAX 1
125
126#endif /*__LINUX_NFC_H */
diff --git a/include/linux/nfc/pn544.h b/include/linux/nfc/pn544.h
index 7ab8521f234..9285000dbb4 100644
--- a/include/linux/nfc/pn544.h
+++ b/include/linux/nfc/pn544.h
@@ -1,97 +1,33 @@
1/* 1/*
2 * Driver include for the PN544 NFC chip. 2 * Copyright (C) 2010 Trusted Logic S.A.
3 * 3 *
4 * Copyright (C) Nokia Corporation 4 * This program is free software; you can redistribute it and/or modify
5 * 5 * it under the terms of the GNU General Public License as published by
6 * Author: Jari Vanhala <ext-jari.vanhala@nokia.com> 6 * the Free Software Foundation; either version 2 of the License, or
7 * Contact: Matti Aaltoenn <matti.j.aaltonen@nokia.com> 7 * (at your option) any later version.
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * version 2 as published by the Free Software Foundation.
12 * 8 *
13 * This program is distributed in the hope that it will be useful, 9 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details. 12 * GNU General Public License for more details.
17 * 13 *
18 * You should have received a copy of the GNU General Public License 14 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software 15 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */ 17 */
22 18
23#ifndef _PN544_H_ 19#define PN544_MAGIC 0xE9
24#define _PN544_H_
25
26#include <linux/i2c.h>
27
28#define PN544_DRIVER_NAME "pn544"
29#define PN544_MAXWINDOW_SIZE 7
30#define PN544_WINDOW_SIZE 4
31#define PN544_RETRIES 10
32#define PN544_MAX_I2C_TRANSFER 0x0400
33#define PN544_MSG_MAX_SIZE 0x21 /* at normal HCI mode */
34
35/* ioctl */
36#define PN544_CHAR_BASE 'P'
37#define PN544_IOR(num, dtype) _IOR(PN544_CHAR_BASE, num, dtype)
38#define PN544_IOW(num, dtype) _IOW(PN544_CHAR_BASE, num, dtype)
39#define PN544_GET_FW_MODE PN544_IOW(1, unsigned int)
40#define PN544_SET_FW_MODE PN544_IOW(2, unsigned int)
41#define PN544_GET_DEBUG PN544_IOW(3, unsigned int)
42#define PN544_SET_DEBUG PN544_IOW(4, unsigned int)
43
44/* Timing restrictions (ms) */
45#define PN544_RESETVEN_TIME 30 /* 7 */
46#define PN544_PVDDVEN_TIME 0
47#define PN544_VBATVEN_TIME 0
48#define PN544_GPIO4VEN_TIME 0
49#define PN544_WAKEUP_ACK 5
50#define PN544_WAKEUP_GUARD (PN544_WAKEUP_ACK + 1)
51#define PN544_INACTIVITY_TIME 1000
52#define PN544_INTERFRAME_DELAY 200 /* us */
53#define PN544_BAUDRATE_CHANGE 150 /* us */
54
55/* Debug bits */
56#define PN544_DEBUG_BUF 0x01
57#define PN544_DEBUG_READ 0x02
58#define PN544_DEBUG_WRITE 0x04
59#define PN544_DEBUG_IRQ 0x08
60#define PN544_DEBUG_CALLS 0x10
61#define PN544_DEBUG_MODE 0x20
62
63/* Normal (HCI) mode */
64#define PN544_LLC_HCI_OVERHEAD 3 /* header + crc (to length) */
65#define PN544_LLC_MIN_SIZE (1 + PN544_LLC_HCI_OVERHEAD) /* length + */
66#define PN544_LLC_MAX_DATA (PN544_MSG_MAX_SIZE - 2)
67#define PN544_LLC_MAX_HCI_SIZE (PN544_LLC_MAX_DATA - 2)
68 20
69struct pn544_llc_packet { 21/*
70 unsigned char length; /* of rest of packet */ 22 * PN544 power control via ioctl
71 unsigned char header; 23 * PN544_SET_PWR(0): power off
72 unsigned char data[PN544_LLC_MAX_DATA]; /* includes crc-ccitt */ 24 * PN544_SET_PWR(1): power on
73}; 25 * PN544_SET_PWR(2): reset and power on with firmware download enabled
74 26 */
75/* Firmware upgrade mode */ 27#define PN544_SET_PWR _IOW(PN544_MAGIC, 0x01, unsigned int)
76#define PN544_FW_HEADER_SIZE 3
77/* max fw transfer is 1024bytes, but I2C limits it to 0xC0 */
78#define PN544_MAX_FW_DATA (PN544_MAX_I2C_TRANSFER - PN544_FW_HEADER_SIZE)
79
80struct pn544_fw_packet {
81 unsigned char command; /* status in answer */
82 unsigned char length[2]; /* big-endian order (msf) */
83 unsigned char data[PN544_MAX_FW_DATA];
84};
85 28
86#ifdef __KERNEL__ 29struct pn544_i2c_platform_data {
87/* board config */ 30 unsigned int irq_gpio;
88struct pn544_nfc_platform_data { 31 unsigned int ven_gpio;
89 int (*request_resources) (struct i2c_client *client); 32 unsigned int firm_gpio;
90 void (*free_resources) (void);
91 void (*enable) (int fw);
92 int (*test) (void);
93 void (*disable) (void);
94}; 33};
95#endif /* __KERNEL__ */
96
97#endif /* _PN544_H_ */
diff --git a/include/linux/nfs.h b/include/linux/nfs.h
index f387919bbc5..8c6ee44914c 100644
--- a/include/linux/nfs.h
+++ b/include/linux/nfs.h
@@ -29,6 +29,8 @@
29#define NFS_MNT_VERSION 1 29#define NFS_MNT_VERSION 1
30#define NFS_MNT3_VERSION 3 30#define NFS_MNT3_VERSION 3
31 31
32#define NFS_PIPE_DIRNAME "/nfs"
33
32/* 34/*
33 * NFS stats. The good thing with these values is that NFSv3 errors are 35 * NFS stats. The good thing with these values is that NFSv3 errors are
34 * a superset of NFSv2 errors (with the exception of NFSERR_WFLUSH which 36 * a superset of NFSv2 errors (with the exception of NFSERR_WFLUSH which
diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h
index 504b289ba68..76f99e8714f 100644
--- a/include/linux/nfs4.h
+++ b/include/linux/nfs4.h
@@ -563,6 +563,10 @@ enum {
563 NFSPROC4_CLNT_GETDEVICEINFO, 563 NFSPROC4_CLNT_GETDEVICEINFO,
564 NFSPROC4_CLNT_LAYOUTCOMMIT, 564 NFSPROC4_CLNT_LAYOUTCOMMIT,
565 NFSPROC4_CLNT_LAYOUTRETURN, 565 NFSPROC4_CLNT_LAYOUTRETURN,
566 NFSPROC4_CLNT_SECINFO_NO_NAME,
567 NFSPROC4_CLNT_TEST_STATEID,
568 NFSPROC4_CLNT_FREE_STATEID,
569 NFSPROC4_CLNT_GETDEVICELIST,
566}; 570};
567 571
568/* nfs41 types */ 572/* nfs41 types */
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index 1b93b9c60e5..fc0fd15c28d 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -85,7 +85,7 @@ struct nfs_lock_context {
85struct nfs4_state; 85struct nfs4_state;
86struct nfs_open_context { 86struct nfs_open_context {
87 struct nfs_lock_context lock_context; 87 struct nfs_lock_context lock_context;
88 struct path path; 88 struct dentry *dentry;
89 struct rpc_cred *cred; 89 struct rpc_cred *cred;
90 struct nfs4_state *state; 90 struct nfs4_state *state;
91 fmode_t mode; 91 fmode_t mode;
@@ -99,9 +99,10 @@ struct nfs_open_context {
99 99
100struct nfs_open_dir_context { 100struct nfs_open_dir_context {
101 struct rpc_cred *cred; 101 struct rpc_cred *cred;
102 unsigned long attr_gencount;
102 __u64 dir_cookie; 103 __u64 dir_cookie;
103 __u64 dup_cookie; 104 __u64 dup_cookie;
104 int duped; 105 signed char duped;
105}; 106};
106 107
107/* 108/*
@@ -360,7 +361,7 @@ extern int nfs_refresh_inode(struct inode *, struct nfs_fattr *);
360extern int nfs_post_op_update_inode(struct inode *inode, struct nfs_fattr *fattr); 361extern int nfs_post_op_update_inode(struct inode *inode, struct nfs_fattr *fattr);
361extern int nfs_post_op_update_inode_force_wcc(struct inode *inode, struct nfs_fattr *fattr); 362extern int nfs_post_op_update_inode_force_wcc(struct inode *inode, struct nfs_fattr *fattr);
362extern int nfs_getattr(struct vfsmount *, struct dentry *, struct kstat *); 363extern int nfs_getattr(struct vfsmount *, struct dentry *, struct kstat *);
363extern int nfs_permission(struct inode *, int, unsigned int); 364extern int nfs_permission(struct inode *, int);
364extern int nfs_open(struct inode *, struct file *); 365extern int nfs_open(struct inode *, struct file *);
365extern int nfs_release(struct inode *, struct file *); 366extern int nfs_release(struct inode *, struct file *);
366extern int nfs_attribute_timeout(struct inode *inode); 367extern int nfs_attribute_timeout(struct inode *inode);
@@ -372,7 +373,7 @@ extern void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr);
372extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx); 373extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx);
373extern void put_nfs_open_context(struct nfs_open_context *ctx); 374extern void put_nfs_open_context(struct nfs_open_context *ctx);
374extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_cred *cred, fmode_t mode); 375extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_cred *cred, fmode_t mode);
375extern struct nfs_open_context *alloc_nfs_open_context(struct path *path, struct rpc_cred *cred, fmode_t f_mode); 376extern struct nfs_open_context *alloc_nfs_open_context(struct dentry *dentry, struct rpc_cred *cred, fmode_t f_mode);
376extern void nfs_file_set_open_context(struct file *filp, struct nfs_open_context *ctx); 377extern void nfs_file_set_open_context(struct file *filp, struct nfs_open_context *ctx);
377extern struct nfs_lock_context *nfs_get_lock_context(struct nfs_open_context *ctx); 378extern struct nfs_lock_context *nfs_get_lock_context(struct nfs_open_context *ctx);
378extern void nfs_put_lock_context(struct nfs_lock_context *l_ctx); 379extern void nfs_put_lock_context(struct nfs_lock_context *l_ctx);
@@ -409,6 +410,9 @@ extern const struct inode_operations nfs_file_inode_operations;
409extern const struct inode_operations nfs3_file_inode_operations; 410extern const struct inode_operations nfs3_file_inode_operations;
410#endif /* CONFIG_NFS_V3 */ 411#endif /* CONFIG_NFS_V3 */
411extern const struct file_operations nfs_file_operations; 412extern const struct file_operations nfs_file_operations;
413#ifdef CONFIG_NFS_V4
414extern const struct file_operations nfs4_file_operations;
415#endif /* CONFIG_NFS_V4 */
412extern const struct address_space_operations nfs_file_aops; 416extern const struct address_space_operations nfs_file_aops;
413extern const struct address_space_operations nfs_dir_aops; 417extern const struct address_space_operations nfs_dir_aops;
414 418
@@ -568,12 +572,12 @@ extern struct posix_acl *nfs3_proc_getacl(struct inode *inode, int type);
568extern int nfs3_proc_setacl(struct inode *inode, int type, 572extern int nfs3_proc_setacl(struct inode *inode, int type,
569 struct posix_acl *acl); 573 struct posix_acl *acl);
570extern int nfs3_proc_set_default_acl(struct inode *dir, struct inode *inode, 574extern int nfs3_proc_set_default_acl(struct inode *dir, struct inode *inode,
571 mode_t mode); 575 umode_t mode);
572extern void nfs3_forget_cached_acls(struct inode *inode); 576extern void nfs3_forget_cached_acls(struct inode *inode);
573#else 577#else
574static inline int nfs3_proc_set_default_acl(struct inode *dir, 578static inline int nfs3_proc_set_default_acl(struct inode *dir,
575 struct inode *inode, 579 struct inode *inode,
576 mode_t mode) 580 umode_t mode)
577{ 581{
578 return 0; 582 return 0;
579} 583}
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
index 87694ca8691..b5479df8378 100644
--- a/include/linux/nfs_fs_sb.h
+++ b/include/linux/nfs_fs_sb.h
@@ -7,7 +7,7 @@
7#include <linux/nfs_xdr.h> 7#include <linux/nfs_xdr.h>
8#include <linux/sunrpc/xprt.h> 8#include <linux/sunrpc/xprt.h>
9 9
10#include <asm/atomic.h> 10#include <linux/atomic.h>
11 11
12struct nfs4_session; 12struct nfs4_session;
13struct nfs_iostats; 13struct nfs_iostats;
@@ -16,6 +16,7 @@ struct nfs4_sequence_args;
16struct nfs4_sequence_res; 16struct nfs4_sequence_res;
17struct nfs_server; 17struct nfs_server;
18struct nfs4_minor_version_ops; 18struct nfs4_minor_version_ops;
19struct server_scope;
19 20
20/* 21/*
21 * The nfs_client identifies our client state to the server. 22 * The nfs_client identifies our client state to the server.
@@ -77,12 +78,13 @@ struct nfs_client {
77 /* The flags used for obtaining the clientid during EXCHANGE_ID */ 78 /* The flags used for obtaining the clientid during EXCHANGE_ID */
78 u32 cl_exchange_flags; 79 u32 cl_exchange_flags;
79 struct nfs4_session *cl_session; /* sharred session */ 80 struct nfs4_session *cl_session; /* sharred session */
80 struct list_head cl_layouts;
81#endif /* CONFIG_NFS_V4 */ 81#endif /* CONFIG_NFS_V4 */
82 82
83#ifdef CONFIG_NFS_FSCACHE 83#ifdef CONFIG_NFS_FSCACHE
84 struct fscache_cookie *fscache; /* client index cache cookie */ 84 struct fscache_cookie *fscache; /* client index cache cookie */
85#endif 85#endif
86
87 struct server_scope *server_scope; /* from exchange_id */
86}; 88};
87 89
88/* 90/*
@@ -129,8 +131,9 @@ struct nfs_server {
129 struct fscache_cookie *fscache; /* superblock cookie */ 131 struct fscache_cookie *fscache; /* superblock cookie */
130#endif 132#endif
131 133
134 u32 pnfs_blksize; /* layout_blksize attr */
132#ifdef CONFIG_NFS_V4 135#ifdef CONFIG_NFS_V4
133 u32 attr_bitmask[2];/* V4 bitmask representing the set 136 u32 attr_bitmask[3];/* V4 bitmask representing the set
134 of attributes supported on this 137 of attributes supported on this
135 filesystem */ 138 filesystem */
136 u32 cache_consistency_bitmask[2]; 139 u32 cache_consistency_bitmask[2];
@@ -143,12 +146,14 @@ struct nfs_server {
143 filesystem */ 146 filesystem */
144 struct pnfs_layoutdriver_type *pnfs_curr_ld; /* Active layout driver */ 147 struct pnfs_layoutdriver_type *pnfs_curr_ld; /* Active layout driver */
145 struct rpc_wait_queue roc_rpcwaitq; 148 struct rpc_wait_queue roc_rpcwaitq;
149 void *pnfs_ld_data; /* per mount point data */
146 150
147 /* the following fields are protected by nfs_client->cl_lock */ 151 /* the following fields are protected by nfs_client->cl_lock */
148 struct rb_root state_owners; 152 struct rb_root state_owners;
149 struct rb_root openowner_id; 153 struct rb_root openowner_id;
150 struct rb_root lockowner_id; 154 struct rb_root lockowner_id;
151#endif 155#endif
156 struct list_head layouts;
152 struct list_head delegations; 157 struct list_head delegations;
153 void (*destroy)(struct nfs_server *); 158 void (*destroy)(struct nfs_server *);
154 159
diff --git a/include/linux/nfs_page.h b/include/linux/nfs_page.h
index 25311b3bedf..e2791a27a90 100644
--- a/include/linux/nfs_page.h
+++ b/include/linux/nfs_page.h
@@ -55,20 +55,28 @@ struct nfs_page {
55 struct nfs_writeverf wb_verf; /* Commit cookie */ 55 struct nfs_writeverf wb_verf; /* Commit cookie */
56}; 56};
57 57
58struct nfs_pageio_descriptor;
59struct nfs_pageio_ops {
60 void (*pg_init)(struct nfs_pageio_descriptor *, struct nfs_page *);
61 bool (*pg_test)(struct nfs_pageio_descriptor *, struct nfs_page *, struct nfs_page *);
62 int (*pg_doio)(struct nfs_pageio_descriptor *);
63};
64
58struct nfs_pageio_descriptor { 65struct nfs_pageio_descriptor {
59 struct list_head pg_list; 66 struct list_head pg_list;
60 unsigned long pg_bytes_written; 67 unsigned long pg_bytes_written;
61 size_t pg_count; 68 size_t pg_count;
62 size_t pg_bsize; 69 size_t pg_bsize;
63 unsigned int pg_base; 70 unsigned int pg_base;
64 char pg_moreio; 71 unsigned char pg_moreio : 1,
72 pg_recoalesce : 1;
65 73
66 struct inode *pg_inode; 74 struct inode *pg_inode;
67 int (*pg_doio)(struct nfs_pageio_descriptor *); 75 const struct nfs_pageio_ops *pg_ops;
68 int pg_ioflags; 76 int pg_ioflags;
69 int pg_error; 77 int pg_error;
78 const struct rpc_call_ops *pg_rpc_callops;
70 struct pnfs_layout_segment *pg_lseg; 79 struct pnfs_layout_segment *pg_lseg;
71 bool (*pg_test)(struct nfs_pageio_descriptor *, struct nfs_page *, struct nfs_page *);
72}; 80};
73 81
74#define NFS_WBACK_BUSY(req) (test_bit(PG_BUSY,&(req)->wb_flags)) 82#define NFS_WBACK_BUSY(req) (test_bit(PG_BUSY,&(req)->wb_flags))
@@ -85,7 +93,7 @@ extern int nfs_scan_list(struct nfs_inode *nfsi, struct list_head *dst,
85 pgoff_t idx_start, unsigned int npages, int tag); 93 pgoff_t idx_start, unsigned int npages, int tag);
86extern void nfs_pageio_init(struct nfs_pageio_descriptor *desc, 94extern void nfs_pageio_init(struct nfs_pageio_descriptor *desc,
87 struct inode *inode, 95 struct inode *inode,
88 int (*doio)(struct nfs_pageio_descriptor *desc), 96 const struct nfs_pageio_ops *pg_ops,
89 size_t bsize, 97 size_t bsize,
90 int how); 98 int how);
91extern int nfs_pageio_add_request(struct nfs_pageio_descriptor *, 99extern int nfs_pageio_add_request(struct nfs_pageio_descriptor *,
@@ -100,7 +108,6 @@ extern void nfs_unlock_request(struct nfs_page *req);
100extern int nfs_set_page_tag_locked(struct nfs_page *req); 108extern int nfs_set_page_tag_locked(struct nfs_page *req);
101extern void nfs_clear_page_tag_locked(struct nfs_page *req); 109extern void nfs_clear_page_tag_locked(struct nfs_page *req);
102 110
103
104/* 111/*
105 * Lock the page of an asynchronous request without getting a new reference 112 * Lock the page of an asynchronous request without getting a new reference
106 */ 113 */
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index 00848d86ffb..5c0e10d7da7 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -122,6 +122,7 @@ struct nfs_fsinfo {
122 struct timespec time_delta; /* server time granularity */ 122 struct timespec time_delta; /* server time granularity */
123 __u32 lease_time; /* in seconds */ 123 __u32 lease_time; /* in seconds */
124 __u32 layouttype; /* supported pnfs layout driver */ 124 __u32 layouttype; /* supported pnfs layout driver */
125 __u32 blksize; /* preferred pnfs io block size */
125}; 126};
126 127
127struct nfs_fsstat { 128struct nfs_fsstat {
@@ -235,6 +236,17 @@ struct nfs4_layoutget {
235 gfp_t gfp_flags; 236 gfp_t gfp_flags;
236}; 237};
237 238
239struct nfs4_getdevicelist_args {
240 const struct nfs_fh *fh;
241 u32 layoutclass;
242 struct nfs4_sequence_args seq_args;
243};
244
245struct nfs4_getdevicelist_res {
246 struct pnfs_devicelist *devlist;
247 struct nfs4_sequence_res seq_res;
248};
249
238struct nfs4_getdeviceinfo_args { 250struct nfs4_getdeviceinfo_args {
239 struct pnfs_device *pdev; 251 struct pnfs_device *pdev;
240 struct nfs4_sequence_args seq_args; 252 struct nfs4_sequence_args seq_args;
@@ -257,21 +269,23 @@ struct nfs4_layoutcommit_res {
257 struct nfs_fattr *fattr; 269 struct nfs_fattr *fattr;
258 const struct nfs_server *server; 270 const struct nfs_server *server;
259 struct nfs4_sequence_res seq_res; 271 struct nfs4_sequence_res seq_res;
272 int status;
260}; 273};
261 274
262struct nfs4_layoutcommit_data { 275struct nfs4_layoutcommit_data {
263 struct rpc_task task; 276 struct rpc_task task;
264 struct nfs_fattr fattr; 277 struct nfs_fattr fattr;
265 struct pnfs_layout_segment *lseg; 278 struct list_head lseg_list;
266 struct rpc_cred *cred; 279 struct rpc_cred *cred;
267 struct nfs4_layoutcommit_args args; 280 struct nfs4_layoutcommit_args args;
268 struct nfs4_layoutcommit_res res; 281 struct nfs4_layoutcommit_res res;
269}; 282};
270 283
271struct nfs4_layoutreturn_args { 284struct nfs4_layoutreturn_args {
272 __u32 layout_type; 285 struct pnfs_layout_hdr *layout;
273 struct inode *inode; 286 struct inode *inode;
274 nfs4_stateid stateid; 287 nfs4_stateid stateid;
288 __u32 layout_type;
275 struct nfs4_sequence_args seq_args; 289 struct nfs4_sequence_args seq_args;
276}; 290};
277 291
@@ -588,11 +602,16 @@ struct nfs_getaclargs {
588 size_t acl_len; 602 size_t acl_len;
589 unsigned int acl_pgbase; 603 unsigned int acl_pgbase;
590 struct page ** acl_pages; 604 struct page ** acl_pages;
605 struct page * acl_scratch;
591 struct nfs4_sequence_args seq_args; 606 struct nfs4_sequence_args seq_args;
592}; 607};
593 608
609/* getxattr ACL interface flags */
610#define NFS4_ACL_LEN_REQUEST 0x0001 /* zero length getxattr buffer */
594struct nfs_getaclres { 611struct nfs_getaclres {
595 size_t acl_len; 612 size_t acl_len;
613 size_t acl_data_offset;
614 int acl_flags;
596 struct nfs4_sequence_res seq_res; 615 struct nfs4_sequence_res seq_res;
597}; 616};
598 617
@@ -759,6 +778,11 @@ struct nfs3_getaclres {
759 struct posix_acl * acl_default; 778 struct posix_acl * acl_default;
760}; 779};
761 780
781struct nfs4_string {
782 unsigned int len;
783 char *data;
784};
785
762#ifdef CONFIG_NFS_V4 786#ifdef CONFIG_NFS_V4
763 787
764typedef u64 clientid4; 788typedef u64 clientid4;
@@ -942,18 +966,13 @@ struct nfs4_server_caps_arg {
942}; 966};
943 967
944struct nfs4_server_caps_res { 968struct nfs4_server_caps_res {
945 u32 attr_bitmask[2]; 969 u32 attr_bitmask[3];
946 u32 acl_bitmask; 970 u32 acl_bitmask;
947 u32 has_links; 971 u32 has_links;
948 u32 has_symlinks; 972 u32 has_symlinks;
949 struct nfs4_sequence_res seq_res; 973 struct nfs4_sequence_res seq_res;
950}; 974};
951 975
952struct nfs4_string {
953 unsigned int len;
954 char *data;
955};
956
957#define NFS4_PATHNAME_MAXCOMPONENTS 512 976#define NFS4_PATHNAME_MAXCOMPONENTS 512
958struct nfs4_pathname { 977struct nfs4_pathname {
959 unsigned int ncomponents; 978 unsigned int ncomponents;
@@ -1060,6 +1079,7 @@ struct server_scope {
1060struct nfs41_exchange_id_res { 1079struct nfs41_exchange_id_res {
1061 struct nfs_client *client; 1080 struct nfs_client *client;
1062 u32 flags; 1081 u32 flags;
1082 struct server_scope *server_scope;
1063}; 1083};
1064 1084
1065struct nfs41_create_session_args { 1085struct nfs41_create_session_args {
@@ -1083,6 +1103,34 @@ struct nfs41_reclaim_complete_args {
1083struct nfs41_reclaim_complete_res { 1103struct nfs41_reclaim_complete_res {
1084 struct nfs4_sequence_res seq_res; 1104 struct nfs4_sequence_res seq_res;
1085}; 1105};
1106
1107#define SECINFO_STYLE_CURRENT_FH 0
1108#define SECINFO_STYLE_PARENT 1
1109struct nfs41_secinfo_no_name_args {
1110 int style;
1111 struct nfs4_sequence_args seq_args;
1112};
1113
1114struct nfs41_test_stateid_args {
1115 nfs4_stateid *stateid;
1116 struct nfs4_sequence_args seq_args;
1117};
1118
1119struct nfs41_test_stateid_res {
1120 unsigned int status;
1121 struct nfs4_sequence_res seq_res;
1122};
1123
1124struct nfs41_free_stateid_args {
1125 nfs4_stateid *stateid;
1126 struct nfs4_sequence_args seq_args;
1127};
1128
1129struct nfs41_free_stateid_res {
1130 unsigned int status;
1131 struct nfs4_sequence_res seq_res;
1132};
1133
1086#endif /* CONFIG_NFS_V4_1 */ 1134#endif /* CONFIG_NFS_V4_1 */
1087 1135
1088struct nfs_page; 1136struct nfs_page;
@@ -1096,6 +1144,7 @@ struct nfs_read_data {
1096 struct rpc_cred *cred; 1144 struct rpc_cred *cred;
1097 struct nfs_fattr fattr; /* fattr storage */ 1145 struct nfs_fattr fattr; /* fattr storage */
1098 struct list_head pages; /* Coalesced read requests */ 1146 struct list_head pages; /* Coalesced read requests */
1147 struct list_head list; /* lists of struct nfs_read_data */
1099 struct nfs_page *req; /* multi ops per nfs_page */ 1148 struct nfs_page *req; /* multi ops per nfs_page */
1100 struct page **pagevec; 1149 struct page **pagevec;
1101 unsigned int npages; /* Max length of pagevec */ 1150 unsigned int npages; /* Max length of pagevec */
@@ -1119,6 +1168,7 @@ struct nfs_write_data {
1119 struct nfs_fattr fattr; 1168 struct nfs_fattr fattr;
1120 struct nfs_writeverf verf; 1169 struct nfs_writeverf verf;
1121 struct list_head pages; /* Coalesced requests we wish to flush */ 1170 struct list_head pages; /* Coalesced requests we wish to flush */
1171 struct list_head list; /* lists of struct nfs_write_data */
1122 struct nfs_page *req; /* multi ops per nfs_page */ 1172 struct nfs_page *req; /* multi ops per nfs_page */
1123 struct page **pagevec; 1173 struct page **pagevec;
1124 unsigned int npages; /* Max length of pagevec */ 1174 unsigned int npages; /* Max length of pagevec */
@@ -1149,6 +1199,7 @@ struct nfs_rpc_ops {
1149 const struct dentry_operations *dentry_ops; 1199 const struct dentry_operations *dentry_ops;
1150 const struct inode_operations *dir_inode_ops; 1200 const struct inode_operations *dir_inode_ops;
1151 const struct inode_operations *file_inode_ops; 1201 const struct inode_operations *file_inode_ops;
1202 const struct file_operations *file_ops;
1152 1203
1153 int (*getroot) (struct nfs_server *, struct nfs_fh *, 1204 int (*getroot) (struct nfs_server *, struct nfs_fh *,
1154 struct nfs_fsinfo *); 1205 struct nfs_fsinfo *);
diff --git a/include/linux/nfsd/export.h b/include/linux/nfsd/export.h
index 84058ec6939..8a31a20efe7 100644
--- a/include/linux/nfsd/export.h
+++ b/include/linux/nfsd/export.h
@@ -133,8 +133,6 @@ __be32 check_nfsd_access(struct svc_export *exp, struct svc_rqst *rqstp);
133int nfsd_export_init(void); 133int nfsd_export_init(void);
134void nfsd_export_shutdown(void); 134void nfsd_export_shutdown(void);
135void nfsd_export_flush(void); 135void nfsd_export_flush(void);
136void exp_readlock(void);
137void exp_readunlock(void);
138struct svc_export * rqst_exp_get_by_name(struct svc_rqst *, 136struct svc_export * rqst_exp_get_by_name(struct svc_rqst *,
139 struct path *); 137 struct path *);
140struct svc_export * rqst_exp_parent(struct svc_rqst *, 138struct svc_export * rqst_exp_parent(struct svc_rqst *,
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index c7ccaae15af..8ad70dcac3f 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -6,7 +6,7 @@
6 * Copyright 2006-2010 Johannes Berg <johannes@sipsolutions.net> 6 * Copyright 2006-2010 Johannes Berg <johannes@sipsolutions.net>
7 * Copyright 2008 Michael Wu <flamingice@sourmilk.net> 7 * Copyright 2008 Michael Wu <flamingice@sourmilk.net>
8 * Copyright 2008 Luis Carlos Cobo <luisca@cozybit.com> 8 * Copyright 2008 Luis Carlos Cobo <luisca@cozybit.com>
9 * Copyright 2008 Michael Buesch <mb@bu3sch.de> 9 * Copyright 2008 Michael Buesch <m@bues.ch>
10 * Copyright 2008, 2009 Luis R. Rodriguez <lrodriguez@atheros.com> 10 * Copyright 2008, 2009 Luis R. Rodriguez <lrodriguez@atheros.com>
11 * Copyright 2008 Jouni Malinen <jouni.malinen@atheros.com> 11 * Copyright 2008 Jouni Malinen <jouni.malinen@atheros.com>
12 * Copyright 2008 Colin McCabe <colin@cozybit.com> 12 * Copyright 2008 Colin McCabe <colin@cozybit.com>
@@ -247,7 +247,8 @@
247 * passed, all channels allowed for the current regulatory domain 247 * passed, all channels allowed for the current regulatory domain
248 * are used. Extra IEs can also be passed from the userspace by 248 * are used. Extra IEs can also be passed from the userspace by
249 * using the %NL80211_ATTR_IE attribute. 249 * using the %NL80211_ATTR_IE attribute.
250 * @NL80211_CMD_STOP_SCHED_SCAN: stop a scheduled scan 250 * @NL80211_CMD_STOP_SCHED_SCAN: stop a scheduled scan. Returns -ENOENT
251 * if scheduled scan is not running.
251 * @NL80211_CMD_SCHED_SCAN_RESULTS: indicates that there are scheduled scan 252 * @NL80211_CMD_SCHED_SCAN_RESULTS: indicates that there are scheduled scan
252 * results available. 253 * results available.
253 * @NL80211_CMD_SCHED_SCAN_STOPPED: indicates that the scheduled scan has 254 * @NL80211_CMD_SCHED_SCAN_STOPPED: indicates that the scheduled scan has
@@ -483,6 +484,14 @@
483 * more background information, see 484 * more background information, see
484 * http://wireless.kernel.org/en/users/Documentation/WoWLAN. 485 * http://wireless.kernel.org/en/users/Documentation/WoWLAN.
485 * 486 *
487 * @NL80211_CMD_SET_REKEY_OFFLOAD: This command is used give the driver
488 * the necessary information for supporting GTK rekey offload. This
489 * feature is typically used during WoWLAN. The configuration data
490 * is contained in %NL80211_ATTR_REKEY_DATA (which is nested and
491 * contains the data in sub-attributes). After rekeying happened,
492 * this command may also be sent by the driver as an MLME event to
493 * inform userspace of the new replay counter.
494 *
486 * @NL80211_CMD_MAX: highest used command number 495 * @NL80211_CMD_MAX: highest used command number
487 * @__NL80211_CMD_AFTER_LAST: internal use 496 * @__NL80211_CMD_AFTER_LAST: internal use
488 */ 497 */
@@ -605,6 +614,8 @@ enum nl80211_commands {
605 NL80211_CMD_SCHED_SCAN_RESULTS, 614 NL80211_CMD_SCHED_SCAN_RESULTS,
606 NL80211_CMD_SCHED_SCAN_STOPPED, 615 NL80211_CMD_SCHED_SCAN_STOPPED,
607 616
617 NL80211_CMD_SET_REKEY_OFFLOAD,
618
608 /* add new commands above here */ 619 /* add new commands above here */
609 620
610 /* used to define NL80211_CMD_MAX below */ 621 /* used to define NL80211_CMD_MAX below */
@@ -745,8 +756,12 @@ enum nl80211_commands {
745 * 756 *
746 * @NL80211_ATTR_MAX_NUM_SCAN_SSIDS: number of SSIDs you can scan with 757 * @NL80211_ATTR_MAX_NUM_SCAN_SSIDS: number of SSIDs you can scan with
747 * a single scan request, a wiphy attribute. 758 * a single scan request, a wiphy attribute.
759 * @NL80211_ATTR_MAX_NUM_SCHED_SCAN_SSIDS: number of SSIDs you can
760 * scan with a single scheduled scan request, a wiphy attribute.
748 * @NL80211_ATTR_MAX_SCAN_IE_LEN: maximum length of information elements 761 * @NL80211_ATTR_MAX_SCAN_IE_LEN: maximum length of information elements
749 * that can be added to a scan request 762 * that can be added to a scan request
763 * @NL80211_ATTR_MAX_SCHED_SCAN_IE_LEN: maximum length of information
764 * elements that can be added to a scheduled scan request
750 * 765 *
751 * @NL80211_ATTR_SCAN_FREQUENCIES: nested attribute with frequencies (in MHz) 766 * @NL80211_ATTR_SCAN_FREQUENCIES: nested attribute with frequencies (in MHz)
752 * @NL80211_ATTR_SCAN_SSIDS: nested attribute with SSIDs, leave out for passive 767 * @NL80211_ATTR_SCAN_SSIDS: nested attribute with SSIDs, leave out for passive
@@ -978,8 +993,8 @@ enum nl80211_commands {
978 * driving the peer link management state machine. 993 * driving the peer link management state machine.
979 * @NL80211_MESH_SETUP_USERSPACE_AMPE must be enabled. 994 * @NL80211_MESH_SETUP_USERSPACE_AMPE must be enabled.
980 * 995 *
981 * @NL80211_ATTR_WOWLAN_SUPPORTED: indicates, as part of the wiphy capabilities, 996 * @NL80211_ATTR_WOWLAN_TRIGGERS_SUPPORTED: indicates, as part of the wiphy
982 * the supported WoWLAN triggers 997 * capabilities, the supported WoWLAN triggers
983 * @NL80211_ATTR_WOWLAN_TRIGGERS: used by %NL80211_CMD_SET_WOWLAN to 998 * @NL80211_ATTR_WOWLAN_TRIGGERS: used by %NL80211_CMD_SET_WOWLAN to
984 * indicate which WoW triggers should be enabled. This is also 999 * indicate which WoW triggers should be enabled. This is also
985 * used by %NL80211_CMD_GET_WOWLAN to get the currently enabled WoWLAN 1000 * used by %NL80211_CMD_GET_WOWLAN to get the currently enabled WoWLAN
@@ -996,6 +1011,14 @@ enum nl80211_commands {
996 * are managed in software: interfaces of these types aren't subject to 1011 * are managed in software: interfaces of these types aren't subject to
997 * any restrictions in their number or combinations. 1012 * any restrictions in their number or combinations.
998 * 1013 *
1014 * @%NL80211_ATTR_REKEY_DATA: nested attribute containing the information
1015 * necessary for GTK rekeying in the device, see &enum nl80211_rekey_data.
1016 *
1017 * @NL80211_ATTR_SCAN_SUPP_RATES: rates per to be advertised as supported in scan,
1018 * nested array attribute containing an entry for each band, with the entry
1019 * being a list of supported rates as defined by IEEE 802.11 7.3.2.2 but
1020 * without the length restriction (at most %NL80211_MAX_SUPP_RATES).
1021 *
999 * @NL80211_ATTR_MAX: highest attribute number currently defined 1022 * @NL80211_ATTR_MAX: highest attribute number currently defined
1000 * @__NL80211_ATTR_AFTER_LAST: internal use 1023 * @__NL80211_ATTR_AFTER_LAST: internal use
1001 */ 1024 */
@@ -1194,6 +1217,13 @@ enum nl80211_attrs {
1194 NL80211_ATTR_INTERFACE_COMBINATIONS, 1217 NL80211_ATTR_INTERFACE_COMBINATIONS,
1195 NL80211_ATTR_SOFTWARE_IFTYPES, 1218 NL80211_ATTR_SOFTWARE_IFTYPES,
1196 1219
1220 NL80211_ATTR_REKEY_DATA,
1221
1222 NL80211_ATTR_MAX_NUM_SCHED_SCAN_SSIDS,
1223 NL80211_ATTR_MAX_SCHED_SCAN_IE_LEN,
1224
1225 NL80211_ATTR_SCAN_SUPP_RATES,
1226
1197 /* add attributes here, update the policy in nl80211.c */ 1227 /* add attributes here, update the policy in nl80211.c */
1198 1228
1199 __NL80211_ATTR_AFTER_LAST, 1229 __NL80211_ATTR_AFTER_LAST,
@@ -2239,6 +2269,16 @@ struct nl80211_wowlan_pattern_support {
2239 * 2269 *
2240 * In %NL80211_ATTR_WOWLAN_TRIGGERS_SUPPORTED, it is a binary attribute 2270 * In %NL80211_ATTR_WOWLAN_TRIGGERS_SUPPORTED, it is a binary attribute
2241 * carrying a &struct nl80211_wowlan_pattern_support. 2271 * carrying a &struct nl80211_wowlan_pattern_support.
2272 * @NL80211_WOWLAN_TRIG_GTK_REKEY_SUPPORTED: Not a real trigger, and cannot be
2273 * used when setting, used only to indicate that GTK rekeying is supported
2274 * by the device (flag)
2275 * @NL80211_WOWLAN_TRIG_GTK_REKEY_FAILURE: wake up on GTK rekey failure (if
2276 * done by the device) (flag)
2277 * @NL80211_WOWLAN_TRIG_EAP_IDENT_REQUEST: wake up on EAP Identity Request
2278 * packet (flag)
2279 * @NL80211_WOWLAN_TRIG_4WAY_HANDSHAKE: wake up on 4-way handshake (flag)
2280 * @NL80211_WOWLAN_TRIG_RFKILL_RELEASE: wake up when rfkill is released
2281 * (on devices that have rfkill in the device) (flag)
2242 * @NUM_NL80211_WOWLAN_TRIG: number of wake on wireless triggers 2282 * @NUM_NL80211_WOWLAN_TRIG: number of wake on wireless triggers
2243 * @MAX_NL80211_WOWLAN_TRIG: highest wowlan trigger attribute number 2283 * @MAX_NL80211_WOWLAN_TRIG: highest wowlan trigger attribute number
2244 */ 2284 */
@@ -2248,6 +2288,11 @@ enum nl80211_wowlan_triggers {
2248 NL80211_WOWLAN_TRIG_DISCONNECT, 2288 NL80211_WOWLAN_TRIG_DISCONNECT,
2249 NL80211_WOWLAN_TRIG_MAGIC_PKT, 2289 NL80211_WOWLAN_TRIG_MAGIC_PKT,
2250 NL80211_WOWLAN_TRIG_PKT_PATTERN, 2290 NL80211_WOWLAN_TRIG_PKT_PATTERN,
2291 NL80211_WOWLAN_TRIG_GTK_REKEY_SUPPORTED,
2292 NL80211_WOWLAN_TRIG_GTK_REKEY_FAILURE,
2293 NL80211_WOWLAN_TRIG_EAP_IDENT_REQUEST,
2294 NL80211_WOWLAN_TRIG_4WAY_HANDSHAKE,
2295 NL80211_WOWLAN_TRIG_RFKILL_RELEASE,
2251 2296
2252 /* keep last */ 2297 /* keep last */
2253 NUM_NL80211_WOWLAN_TRIG, 2298 NUM_NL80211_WOWLAN_TRIG,
@@ -2361,4 +2406,28 @@ enum nl80211_plink_state {
2361 MAX_NL80211_PLINK_STATES = NUM_NL80211_PLINK_STATES - 1 2406 MAX_NL80211_PLINK_STATES = NUM_NL80211_PLINK_STATES - 1
2362}; 2407};
2363 2408
2409#define NL80211_KCK_LEN 16
2410#define NL80211_KEK_LEN 16
2411#define NL80211_REPLAY_CTR_LEN 8
2412
2413/**
2414 * enum nl80211_rekey_data - attributes for GTK rekey offload
2415 * @__NL80211_REKEY_DATA_INVALID: invalid number for nested attributes
2416 * @NL80211_REKEY_DATA_KEK: key encryption key (binary)
2417 * @NL80211_REKEY_DATA_KCK: key confirmation key (binary)
2418 * @NL80211_REKEY_DATA_REPLAY_CTR: replay counter (binary)
2419 * @NUM_NL80211_REKEY_DATA: number of rekey attributes (internal)
2420 * @MAX_NL80211_REKEY_DATA: highest rekey attribute (internal)
2421 */
2422enum nl80211_rekey_data {
2423 __NL80211_REKEY_DATA_INVALID,
2424 NL80211_REKEY_DATA_KEK,
2425 NL80211_REKEY_DATA_KCK,
2426 NL80211_REKEY_DATA_REPLAY_CTR,
2427
2428 /* keep last */
2429 NUM_NL80211_REKEY_DATA,
2430 MAX_NL80211_REKEY_DATA = NUM_NL80211_REKEY_DATA - 1
2431};
2432
2364#endif /* __LINUX_NL80211_H */ 2433#endif /* __LINUX_NL80211_H */
diff --git a/include/linux/nodemask.h b/include/linux/nodemask.h
index dba35e41337..7afc36334d5 100644
--- a/include/linux/nodemask.h
+++ b/include/linux/nodemask.h
@@ -66,6 +66,8 @@
66 * int num_online_nodes() Number of online Nodes 66 * int num_online_nodes() Number of online Nodes
67 * int num_possible_nodes() Number of all possible Nodes 67 * int num_possible_nodes() Number of all possible Nodes
68 * 68 *
69 * int node_random(mask) Random node with set bit in mask
70 *
69 * int node_online(node) Is some node online? 71 * int node_online(node) Is some node online?
70 * int node_possible(node) Is some node possible? 72 * int node_possible(node) Is some node possible?
71 * 73 *
@@ -430,6 +432,7 @@ static inline void node_set_offline(int nid)
430 node_clear_state(nid, N_ONLINE); 432 node_clear_state(nid, N_ONLINE);
431 nr_online_nodes = num_node_state(N_ONLINE); 433 nr_online_nodes = num_node_state(N_ONLINE);
432} 434}
435
433#else 436#else
434 437
435static inline int node_state(int node, enum node_states state) 438static inline int node_state(int node, enum node_states state)
@@ -460,6 +463,16 @@ static inline int num_node_state(enum node_states state)
460 463
461#define node_set_online(node) node_set_state((node), N_ONLINE) 464#define node_set_online(node) node_set_state((node), N_ONLINE)
462#define node_set_offline(node) node_clear_state((node), N_ONLINE) 465#define node_set_offline(node) node_clear_state((node), N_ONLINE)
466
467#endif
468
469#if defined(CONFIG_NUMA) && (MAX_NUMNODES > 1)
470extern int node_random(const nodemask_t *maskp);
471#else
472static inline int node_random(const nodemask_t *mask)
473{
474 return 0;
475}
463#endif 476#endif
464 477
465#define node_online_map node_states[N_ONLINE] 478#define node_online_map node_states[N_ONLINE]
diff --git a/include/linux/notifier.h b/include/linux/notifier.h
index c0688b0168b..d65746efc95 100644
--- a/include/linux/notifier.h
+++ b/include/linux/notifier.h
@@ -185,80 +185,17 @@ static inline int notifier_to_errno(int ret)
185 * VC switch chains (for loadable kernel svgalib VC switch helpers) etc... 185 * VC switch chains (for loadable kernel svgalib VC switch helpers) etc...
186 */ 186 */
187 187
188/* netdevice notifier chain. Please remember to update the rtnetlink 188/* CPU notfiers are defined in include/linux/cpu.h. */
189 * notification exclusion list in rtnetlink_event() when adding new
190 * types.
191 */
192#define NETDEV_UP 0x0001 /* For now you can't veto a device up/down */
193#define NETDEV_DOWN 0x0002
194#define NETDEV_REBOOT 0x0003 /* Tell a protocol stack a network interface
195 detected a hardware crash and restarted
196 - we can use this eg to kick tcp sessions
197 once done */
198#define NETDEV_CHANGE 0x0004 /* Notify device state change */
199#define NETDEV_REGISTER 0x0005
200#define NETDEV_UNREGISTER 0x0006
201#define NETDEV_CHANGEMTU 0x0007
202#define NETDEV_CHANGEADDR 0x0008
203#define NETDEV_GOING_DOWN 0x0009
204#define NETDEV_CHANGENAME 0x000A
205#define NETDEV_FEAT_CHANGE 0x000B
206#define NETDEV_BONDING_FAILOVER 0x000C
207#define NETDEV_PRE_UP 0x000D
208#define NETDEV_PRE_TYPE_CHANGE 0x000E
209#define NETDEV_POST_TYPE_CHANGE 0x000F
210#define NETDEV_POST_INIT 0x0010
211#define NETDEV_UNREGISTER_BATCH 0x0011
212#define NETDEV_RELEASE 0x0012
213#define NETDEV_NOTIFY_PEERS 0x0013
214#define NETDEV_JOIN 0x0014
215
216#define SYS_DOWN 0x0001 /* Notify of system down */
217#define SYS_RESTART SYS_DOWN
218#define SYS_HALT 0x0002 /* Notify of system halt */
219#define SYS_POWER_OFF 0x0003 /* Notify of system power off */
220 189
221#define NETLINK_URELEASE 0x0001 /* Unicast netlink socket released */ 190/* netdevice notifiers are defined in include/linux/netdevice.h */
222 191
223#define CPU_ONLINE 0x0002 /* CPU (unsigned)v is up */ 192/* reboot notifiers are defined in include/linux/reboot.h. */
224#define CPU_UP_PREPARE 0x0003 /* CPU (unsigned)v coming up */
225#define CPU_UP_CANCELED 0x0004 /* CPU (unsigned)v NOT coming up */
226#define CPU_DOWN_PREPARE 0x0005 /* CPU (unsigned)v going down */
227#define CPU_DOWN_FAILED 0x0006 /* CPU (unsigned)v NOT going down */
228#define CPU_DEAD 0x0007 /* CPU (unsigned)v dead */
229#define CPU_DYING 0x0008 /* CPU (unsigned)v not running any task,
230 * not handling interrupts, soon dead.
231 * Called on the dying cpu, interrupts
232 * are already disabled. Must not
233 * sleep, must not fail */
234#define CPU_POST_DEAD 0x0009 /* CPU (unsigned)v dead, cpu_hotplug
235 * lock is dropped */
236#define CPU_STARTING 0x000A /* CPU (unsigned)v soon running.
237 * Called on the new cpu, just before
238 * enabling interrupts. Must not sleep,
239 * must not fail */
240 193
241/* Used for CPU hotplug events occurring while tasks are frozen due to a suspend 194/* Hibernation and suspend events are defined in include/linux/suspend.h. */
242 * operation in progress
243 */
244#define CPU_TASKS_FROZEN 0x0010
245 195
246#define CPU_ONLINE_FROZEN (CPU_ONLINE | CPU_TASKS_FROZEN) 196/* Virtual Terminal events are defined in include/linux/vt.h. */
247#define CPU_UP_PREPARE_FROZEN (CPU_UP_PREPARE | CPU_TASKS_FROZEN)
248#define CPU_UP_CANCELED_FROZEN (CPU_UP_CANCELED | CPU_TASKS_FROZEN)
249#define CPU_DOWN_PREPARE_FROZEN (CPU_DOWN_PREPARE | CPU_TASKS_FROZEN)
250#define CPU_DOWN_FAILED_FROZEN (CPU_DOWN_FAILED | CPU_TASKS_FROZEN)
251#define CPU_DEAD_FROZEN (CPU_DEAD | CPU_TASKS_FROZEN)
252#define CPU_DYING_FROZEN (CPU_DYING | CPU_TASKS_FROZEN)
253#define CPU_STARTING_FROZEN (CPU_STARTING | CPU_TASKS_FROZEN)
254 197
255/* Hibernation and suspend events */ 198#define NETLINK_URELEASE 0x0001 /* Unicast netlink socket released */
256#define PM_HIBERNATION_PREPARE 0x0001 /* Going to hibernate */
257#define PM_POST_HIBERNATION 0x0002 /* Hibernation finished */
258#define PM_SUSPEND_PREPARE 0x0003 /* Going to suspend the system */
259#define PM_POST_SUSPEND 0x0004 /* Suspend finished */
260#define PM_RESTORE_PREPARE 0x0005 /* Going to restore a saved image */
261#define PM_POST_RESTORE 0x0006 /* Restore failed */
262 199
263/* Console keyboard events. 200/* Console keyboard events.
264 * Note: KBD_KEYCODE is always sent before KBD_UNBOUND_KEYCODE, KBD_UNICODE and 201 * Note: KBD_KEYCODE is always sent before KBD_UNBOUND_KEYCODE, KBD_UNICODE and
@@ -271,12 +208,5 @@ static inline int notifier_to_errno(int ret)
271 208
272extern struct blocking_notifier_head reboot_notifier_list; 209extern struct blocking_notifier_head reboot_notifier_list;
273 210
274/* Virtual Terminal events. */
275#define VT_ALLOCATE 0x0001 /* Console got allocated */
276#define VT_DEALLOCATE 0x0002 /* Console will be deallocated */
277#define VT_WRITE 0x0003 /* A char got output */
278#define VT_UPDATE 0x0004 /* A bigger update occurred */
279#define VT_PREWRITE 0x0005 /* A char is about to be written to the console */
280
281#endif /* __KERNEL__ */ 211#endif /* __KERNEL__ */
282#endif /* _LINUX_NOTIFIER_H */ 212#endif /* _LINUX_NOTIFIER_H */
diff --git a/include/linux/nsproxy.h b/include/linux/nsproxy.h
index 50d20aba57d..cc37a55ad00 100644
--- a/include/linux/nsproxy.h
+++ b/include/linux/nsproxy.h
@@ -68,6 +68,7 @@ void switch_task_namespaces(struct task_struct *tsk, struct nsproxy *new);
68void free_nsproxy(struct nsproxy *ns); 68void free_nsproxy(struct nsproxy *ns);
69int unshare_nsproxy_namespaces(unsigned long, struct nsproxy **, 69int unshare_nsproxy_namespaces(unsigned long, struct nsproxy **,
70 struct fs_struct *); 70 struct fs_struct *);
71int __init nsproxy_cache_init(void);
71 72
72static inline void put_nsproxy(struct nsproxy *ns) 73static inline void put_nsproxy(struct nsproxy *ns)
73{ 74{
diff --git a/include/linux/nvhost.h b/include/linux/nvhost.h
new file mode 100644
index 00000000000..da5e1e6862c
--- /dev/null
+++ b/include/linux/nvhost.h
@@ -0,0 +1,145 @@
1/*
2 * include/linux/nvhost.h
3 *
4 * Tegra graphics host driver
5 *
6 * Copyright (c) 2009-2012, NVIDIA Corporation.
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, but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 * 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 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 */
22
23#ifndef __LINUX_NVHOST_H
24#define __LINUX_NVHOST_H
25
26#include <linux/device.h>
27#include <linux/types.h>
28
29struct nvhost_master;
30
31#define NVHOST_MODULE_MAX_CLOCKS 3
32#define NVHOST_MODULE_MAX_POWERGATE_IDS 2
33#define NVHOST_MODULE_NO_POWERGATE_IDS .powergate_ids = {-1, -1}
34#define NVHOST_DEFAULT_CLOCKGATE_DELAY .clockgate_delay = 25
35
36struct nvhost_clock {
37 char *name;
38 long default_rate;
39};
40
41enum nvhost_device_powerstate_t {
42 NVHOST_POWER_STATE_DEINIT,
43 NVHOST_POWER_STATE_RUNNING,
44 NVHOST_POWER_STATE_CLOCKGATED,
45 NVHOST_POWER_STATE_POWERGATED
46};
47
48struct nvhost_device {
49 const char *name; /* Device name */
50 struct device dev; /* Linux device struct */
51 int id; /* Separates clients of same hw */
52 int index; /* Hardware channel number */
53 u32 num_resources; /* Number of resources following */
54 struct resource *resource; /* Resources (IOMEM in particular) */
55 struct resource *reg_mem;
56 void __iomem *aperture; /* Iomem mapped to kernel */
57
58 u32 syncpts; /* Bitfield of sync points used */
59 u32 waitbases; /* Bit field of wait bases */
60 u32 modulemutexes; /* Bit field of module mutexes */
61 u32 moduleid; /* Module id for user space API */
62
63 u32 class; /* Device class */
64 bool exclusive; /* True if only one user at a time */
65 bool keepalive; /* Do not power gate when opened */
66 bool waitbasesync; /* Force sync of wait bases */
67
68 int powergate_ids[NVHOST_MODULE_MAX_POWERGATE_IDS];
69 bool can_powergate; /* True if module can be power gated */
70 int clockgate_delay;/* Delay before clock gated */
71 int powergate_delay;/* Delay before power gated */
72 struct nvhost_clock clocks[NVHOST_MODULE_MAX_CLOCKS];/* Clock names */
73
74 struct delayed_work powerstate_down;/* Power state management */
75 int num_clks; /* Number of clocks opened for dev */
76 struct clk *clk[NVHOST_MODULE_MAX_CLOCKS];
77 struct mutex lock; /* Power management lock */
78 int powerstate; /* Current power state */
79 int refcount; /* Number of tasks active */
80 wait_queue_head_t idle_wq; /* Work queue for idle */
81 struct list_head client_list; /* List of clients and rate requests */
82
83 struct nvhost_channel *channel; /* Channel assigned for the module */
84
85 /* Allocates a context handler for the device */
86 struct nvhost_hwctx_handler *(*alloc_hwctx_handler)(u32 syncpt,
87 u32 waitbase, struct nvhost_channel *ch);
88 /* Preparing for power off. Used for context save. */
89 int (*prepare_poweroff)(struct nvhost_device *dev);
90 /* Finalize power on. Can be used for context restore. */
91 void (*finalize_poweron)(struct nvhost_device *dev);
92 /* Device is busy. */
93 void (*busy)(struct nvhost_device *);
94 /* Device is idle. */
95 void (*idle)(struct nvhost_device *);
96 /* Device is going to be suspended */
97 void (*suspend)(struct nvhost_device *);
98 /* Device is initialized */
99 void (*init)(struct nvhost_device *dev);
100 /* Device is de-initialized. */
101 void (*deinit)(struct nvhost_device *dev);
102};
103
104/* Register device to nvhost bus */
105extern int nvhost_device_register(struct nvhost_device *);
106
107/* Deregister device from nvhost bus */
108extern void nvhost_device_unregister(struct nvhost_device *);
109
110extern struct bus_type nvhost_bus_type;
111
112struct nvhost_driver {
113 int (*probe)(struct nvhost_device *);
114 int (*remove)(struct nvhost_device *);
115 void (*shutdown)(struct nvhost_device *);
116 int (*suspend)(struct nvhost_device *, pm_message_t state);
117 int (*resume)(struct nvhost_device *);
118 struct device_driver driver;
119};
120
121extern int nvhost_driver_register(struct nvhost_driver *);
122extern void nvhost_driver_unregister(struct nvhost_driver *);
123extern struct resource *nvhost_get_resource(struct nvhost_device *,
124 unsigned int, unsigned int);
125extern int nvhost_get_irq(struct nvhost_device *, unsigned int);
126extern struct resource *nvhost_get_resource_byname(struct nvhost_device *,
127 unsigned int, const char *);
128extern int nvhost_get_irq_byname(struct nvhost_device *, const char *);
129
130#define to_nvhost_device(x) container_of((x), struct nvhost_device, dev)
131#define to_nvhost_driver(drv) (container_of((drv), struct nvhost_driver, \
132 driver))
133
134#define nvhost_get_drvdata(_dev) dev_get_drvdata(&(_dev)->dev)
135#define nvhost_set_drvdata(_dev, data) dev_set_drvdata(&(_dev)->dev, (data))
136static inline struct nvhost_master *nvhost_get_host(struct nvhost_device *_dev)
137{
138 return (_dev->dev.parent) ? \
139 ((struct nvhost_master *) dev_get_drvdata(_dev->dev.parent)) : \
140 ((struct nvhost_master *) dev_get_drvdata(&(_dev->dev)));
141}
142
143int nvhost_bus_add_host(struct nvhost_master *host);
144
145#endif
diff --git a/include/linux/nvhost_ioctl.h b/include/linux/nvhost_ioctl.h
new file mode 100644
index 00000000000..3f6eabf522f
--- /dev/null
+++ b/include/linux/nvhost_ioctl.h
@@ -0,0 +1,213 @@
1/*
2 * include/linux/nvhost_ioctl.h
3 *
4 * Tegra graphics host driver
5 *
6 * Copyright (c) 2009-2012, NVIDIA Corporation.
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, but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 * 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 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 */
22
23#ifndef __LINUX_NVHOST_IOCTL_H
24#define __LINUX_NVHOST_IOCTL_H
25
26#include <linux/ioctl.h>
27#include <linux/types.h>
28
29#if !defined(__KERNEL__)
30#define __user
31#endif
32
33#define NVHOST_INVALID_SYNCPOINT 0xFFFFFFFF
34#define NVHOST_NO_TIMEOUT (-1)
35#define NVHOST_NO_CONTEXT 0x0
36#define NVHOST_IOCTL_MAGIC 'H'
37#define NVHOST_PRIORITY_LOW 50
38#define NVHOST_PRIORITY_MEDIUM 100
39#define NVHOST_PRIORITY_HIGH 150
40
41/* version 0 header (used with write() submit interface) */
42struct nvhost_submit_hdr {
43 __u32 syncpt_id;
44 __u32 syncpt_incrs;
45 __u32 num_cmdbufs;
46 __u32 num_relocs;
47};
48
49#define NVHOST_SUBMIT_VERSION_V0 0x0
50#define NVHOST_SUBMIT_VERSION_V1 0x1
51#define NVHOST_SUBMIT_VERSION_V2 0x2
52#define NVHOST_SUBMIT_VERSION_MAX_SUPPORTED NVHOST_SUBMIT_VERSION_V2
53
54/* version 1 header (used with ioctl() submit interface) */
55struct nvhost_submit_hdr_ext {
56 __u32 syncpt_id; /* version 0 fields */
57 __u32 syncpt_incrs;
58 __u32 num_cmdbufs;
59 __u32 num_relocs;
60 __u32 submit_version; /* version 1 fields */
61 __u32 num_waitchks;
62 __u32 waitchk_mask;
63 __u32 pad[5]; /* future expansion */
64};
65
66struct nvhost_cmdbuf {
67 __u32 mem;
68 __u32 offset;
69 __u32 words;
70};
71
72struct nvhost_reloc {
73 __u32 cmdbuf_mem;
74 __u32 cmdbuf_offset;
75 __u32 target;
76 __u32 target_offset;
77};
78
79struct nvhost_reloc_shift {
80 __u32 shift;
81};
82
83struct nvhost_waitchk {
84 __u32 mem;
85 __u32 offset;
86 __u32 syncpt_id;
87 __u32 thresh;
88};
89
90struct nvhost_get_param_args {
91 __u32 value;
92};
93
94struct nvhost_set_nvmap_fd_args {
95 __u32 fd;
96};
97
98struct nvhost_read_3d_reg_args {
99 __u32 offset;
100 __u32 value;
101};
102
103struct nvhost_clk_rate_args {
104 __u64 rate;
105};
106
107struct nvhost_set_timeout_args {
108 __u32 timeout;
109};
110
111struct nvhost_set_priority_args {
112 __u32 priority;
113};
114
115#define NVHOST_IOCTL_CHANNEL_FLUSH \
116 _IOR(NVHOST_IOCTL_MAGIC, 1, struct nvhost_get_param_args)
117#define NVHOST_IOCTL_CHANNEL_GET_SYNCPOINTS \
118 _IOR(NVHOST_IOCTL_MAGIC, 2, struct nvhost_get_param_args)
119#define NVHOST_IOCTL_CHANNEL_GET_WAITBASES \
120 _IOR(NVHOST_IOCTL_MAGIC, 3, struct nvhost_get_param_args)
121#define NVHOST_IOCTL_CHANNEL_GET_MODMUTEXES \
122 _IOR(NVHOST_IOCTL_MAGIC, 4, struct nvhost_get_param_args)
123#define NVHOST_IOCTL_CHANNEL_SET_NVMAP_FD \
124 _IOW(NVHOST_IOCTL_MAGIC, 5, struct nvhost_set_nvmap_fd_args)
125#define NVHOST_IOCTL_CHANNEL_NULL_KICKOFF \
126 _IOR(NVHOST_IOCTL_MAGIC, 6, struct nvhost_get_param_args)
127#define NVHOST_IOCTL_CHANNEL_SUBMIT_EXT \
128 _IOW(NVHOST_IOCTL_MAGIC, 7, struct nvhost_submit_hdr_ext)
129#define NVHOST_IOCTL_CHANNEL_READ_3D_REG \
130 _IOWR(NVHOST_IOCTL_MAGIC, 8, struct nvhost_read_3d_reg_args)
131#define NVHOST_IOCTL_CHANNEL_GET_CLK_RATE \
132 _IOR(NVHOST_IOCTL_MAGIC, 9, struct nvhost_clk_rate_args)
133#define NVHOST_IOCTL_CHANNEL_SET_CLK_RATE \
134 _IOW(NVHOST_IOCTL_MAGIC, 10, struct nvhost_clk_rate_args)
135#define NVHOST_IOCTL_CHANNEL_SET_TIMEOUT \
136 _IOW(NVHOST_IOCTL_MAGIC, 11, struct nvhost_set_timeout_args)
137#define NVHOST_IOCTL_CHANNEL_GET_TIMEDOUT \
138 _IOR(NVHOST_IOCTL_MAGIC, 12, struct nvhost_get_param_args)
139#define NVHOST_IOCTL_CHANNEL_SET_PRIORITY \
140 _IOW(NVHOST_IOCTL_MAGIC, 13, struct nvhost_set_priority_args)
141#define NVHOST_IOCTL_CHANNEL_LAST \
142 _IOC_NR(NVHOST_IOCTL_CHANNEL_SET_PRIORITY)
143#define NVHOST_IOCTL_CHANNEL_MAX_ARG_SIZE sizeof(struct nvhost_submit_hdr_ext)
144
145struct nvhost_ctrl_syncpt_read_args {
146 __u32 id;
147 __u32 value;
148};
149
150struct nvhost_ctrl_syncpt_incr_args {
151 __u32 id;
152};
153
154struct nvhost_ctrl_syncpt_wait_args {
155 __u32 id;
156 __u32 thresh;
157 __s32 timeout;
158};
159
160struct nvhost_ctrl_syncpt_waitex_args {
161 __u32 id;
162 __u32 thresh;
163 __s32 timeout;
164 __u32 value;
165};
166
167struct nvhost_ctrl_module_mutex_args {
168 __u32 id;
169 __u32 lock;
170};
171
172enum nvhost_module_id {
173 NVHOST_MODULE_NONE = -1,
174 NVHOST_MODULE_DISPLAY_A = 0,
175 NVHOST_MODULE_DISPLAY_B,
176 NVHOST_MODULE_VI,
177 NVHOST_MODULE_ISP,
178 NVHOST_MODULE_MPE,
179};
180
181struct nvhost_ctrl_module_regrdwr_args {
182 __u32 id;
183 __u32 num_offsets;
184 __u32 block_size;
185 __u32 *offsets;
186 __u32 *values;
187 __u32 write;
188};
189
190#define NVHOST_IOCTL_CTRL_SYNCPT_READ \
191 _IOWR(NVHOST_IOCTL_MAGIC, 1, struct nvhost_ctrl_syncpt_read_args)
192#define NVHOST_IOCTL_CTRL_SYNCPT_INCR \
193 _IOW(NVHOST_IOCTL_MAGIC, 2, struct nvhost_ctrl_syncpt_incr_args)
194#define NVHOST_IOCTL_CTRL_SYNCPT_WAIT \
195 _IOW(NVHOST_IOCTL_MAGIC, 3, struct nvhost_ctrl_syncpt_wait_args)
196
197#define NVHOST_IOCTL_CTRL_MODULE_MUTEX \
198 _IOWR(NVHOST_IOCTL_MAGIC, 4, struct nvhost_ctrl_module_mutex_args)
199#define NVHOST_IOCTL_CTRL_MODULE_REGRDWR \
200 _IOWR(NVHOST_IOCTL_MAGIC, 5, struct nvhost_ctrl_module_regrdwr_args)
201
202#define NVHOST_IOCTL_CTRL_SYNCPT_WAITEX \
203 _IOWR(NVHOST_IOCTL_MAGIC, 6, struct nvhost_ctrl_syncpt_waitex_args)
204
205#define NVHOST_IOCTL_CTRL_GET_VERSION \
206 _IOR(NVHOST_IOCTL_MAGIC, 7, struct nvhost_get_param_args)
207
208#define NVHOST_IOCTL_CTRL_LAST \
209 _IOC_NR(NVHOST_IOCTL_CTRL_GET_VERSION)
210#define NVHOST_IOCTL_CTRL_MAX_ARG_SIZE \
211 sizeof(struct nvhost_ctrl_module_regrdwr_args)
212
213#endif
diff --git a/include/linux/of.h b/include/linux/of.h
index bfc0ed1b0ce..9180dc5cb00 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -195,6 +195,14 @@ extern struct device_node *of_find_node_with_property(
195extern struct property *of_find_property(const struct device_node *np, 195extern struct property *of_find_property(const struct device_node *np,
196 const char *name, 196 const char *name,
197 int *lenp); 197 int *lenp);
198extern int of_property_read_u32_array(const struct device_node *np,
199 const char *propname,
200 u32 *out_values,
201 size_t sz);
202
203extern int of_property_read_string(struct device_node *np,
204 const char *propname,
205 const char **out_string);
198extern int of_device_is_compatible(const struct device_node *device, 206extern int of_device_is_compatible(const struct device_node *device,
199 const char *); 207 const char *);
200extern int of_device_is_available(const struct device_node *device); 208extern int of_device_is_available(const struct device_node *device);
@@ -227,12 +235,41 @@ extern void of_attach_node(struct device_node *);
227extern void of_detach_node(struct device_node *); 235extern void of_detach_node(struct device_node *);
228#endif 236#endif
229 237
230#else 238#else /* CONFIG_OF */
231 239
232static inline bool of_have_populated_dt(void) 240static inline bool of_have_populated_dt(void)
233{ 241{
234 return false; 242 return false;
235} 243}
236 244
245static inline int of_property_read_u32_array(const struct device_node *np,
246 const char *propname,
247 u32 *out_values, size_t sz)
248{
249 return -ENOSYS;
250}
251
252static inline int of_property_read_string(struct device_node *np,
253 const char *propname,
254 const char **out_string)
255{
256 return -ENOSYS;
257}
258
259static inline const void *of_get_property(const struct device_node *node,
260 const char *name,
261 int *lenp)
262{
263 return NULL;
264}
265
237#endif /* CONFIG_OF */ 266#endif /* CONFIG_OF */
267
268static inline int of_property_read_u32(const struct device_node *np,
269 const char *propname,
270 u32 *out_value)
271{
272 return of_property_read_u32_array(np, propname, out_value, 1);
273}
274
238#endif /* _LINUX_OF_H */ 275#endif /* _LINUX_OF_H */
diff --git a/include/linux/of_address.h b/include/linux/of_address.h
index 2feda6ee614..3118623c2c1 100644
--- a/include/linux/of_address.h
+++ b/include/linux/of_address.h
@@ -1,11 +1,16 @@
1#ifndef __OF_ADDRESS_H 1#ifndef __OF_ADDRESS_H
2#define __OF_ADDRESS_H 2#define __OF_ADDRESS_H
3#include <linux/ioport.h> 3#include <linux/ioport.h>
4#include <linux/errno.h>
4#include <linux/of.h> 5#include <linux/of.h>
5 6
6extern u64 of_translate_address(struct device_node *np, const __be32 *addr); 7extern u64 of_translate_address(struct device_node *np, const __be32 *addr);
7extern int of_address_to_resource(struct device_node *dev, int index, 8extern int of_address_to_resource(struct device_node *dev, int index,
8 struct resource *r); 9 struct resource *r);
10extern struct device_node *of_find_matching_node_by_address(
11 struct device_node *from,
12 const struct of_device_id *matches,
13 u64 base_address);
9extern void __iomem *of_iomap(struct device_node *device, int index); 14extern void __iomem *of_iomap(struct device_node *device, int index);
10 15
11/* Extract an address from a device, returns the region size and 16/* Extract an address from a device, returns the region size and
diff --git a/include/linux/of_gpio.h b/include/linux/of_gpio.h
index 6598c04dab0..52280a2b5e6 100644
--- a/include/linux/of_gpio.h
+++ b/include/linux/of_gpio.h
@@ -46,8 +46,9 @@ static inline struct of_mm_gpio_chip *to_of_mm_gpio_chip(struct gpio_chip *gc)
46 return container_of(gc, struct of_mm_gpio_chip, gc); 46 return container_of(gc, struct of_mm_gpio_chip, gc);
47} 47}
48 48
49extern int of_get_gpio_flags(struct device_node *np, int index, 49extern int of_get_named_gpio_flags(struct device_node *np,
50 enum of_gpio_flags *flags); 50 const char *list_name, int index, enum of_gpio_flags *flags);
51
51extern unsigned int of_gpio_count(struct device_node *np); 52extern unsigned int of_gpio_count(struct device_node *np);
52 53
53extern int of_mm_gpiochip_add(struct device_node *np, 54extern int of_mm_gpiochip_add(struct device_node *np,
@@ -56,12 +57,14 @@ extern int of_mm_gpiochip_add(struct device_node *np,
56extern void of_gpiochip_add(struct gpio_chip *gc); 57extern void of_gpiochip_add(struct gpio_chip *gc);
57extern void of_gpiochip_remove(struct gpio_chip *gc); 58extern void of_gpiochip_remove(struct gpio_chip *gc);
58extern struct gpio_chip *of_node_to_gpiochip(struct device_node *np); 59extern struct gpio_chip *of_node_to_gpiochip(struct device_node *np);
60extern int of_gpio_simple_xlate(struct gpio_chip *gc, struct device_node *np,
61 const void *gpio_spec, u32 *flags);
59 62
60#else /* CONFIG_OF_GPIO */ 63#else /* CONFIG_OF_GPIO */
61 64
62/* Drivers may not strictly depend on the GPIO support, so let them link. */ 65/* Drivers may not strictly depend on the GPIO support, so let them link. */
63static inline int of_get_gpio_flags(struct device_node *np, int index, 66static inline int of_get_named_gpio_flags(struct device_node *np,
64 enum of_gpio_flags *flags) 67 const char *list_name, int index, enum of_gpio_flags *flags)
65{ 68{
66 return -ENOSYS; 69 return -ENOSYS;
67} 70}
@@ -71,13 +74,51 @@ static inline unsigned int of_gpio_count(struct device_node *np)
71 return 0; 74 return 0;
72} 75}
73 76
77static inline int of_gpio_simple_xlate(struct gpio_chip *gc,
78 struct device_node *np,
79 const void *gpio_spec, u32 *flags)
80{
81 return -ENOSYS;
82}
83
74static inline void of_gpiochip_add(struct gpio_chip *gc) { } 84static inline void of_gpiochip_add(struct gpio_chip *gc) { }
75static inline void of_gpiochip_remove(struct gpio_chip *gc) { } 85static inline void of_gpiochip_remove(struct gpio_chip *gc) { }
76 86
77#endif /* CONFIG_OF_GPIO */ 87#endif /* CONFIG_OF_GPIO */
78 88
79/** 89/**
80 * of_get_gpio - Get a GPIO number to use with GPIO API 90 * of_get_gpio_flags() - Get a GPIO number and flags to use with GPIO API
91 * @np: device node to get GPIO from
92 * @index: index of the GPIO
93 * @flags: a flags pointer to fill in
94 *
95 * Returns GPIO number to use with Linux generic GPIO API, or one of the errno
96 * value on the error condition. If @flags is not NULL the function also fills
97 * in flags for the GPIO.
98 */
99static inline int of_get_gpio_flags(struct device_node *np, int index,
100 enum of_gpio_flags *flags)
101{
102 return of_get_named_gpio_flags(np, "gpios", index, flags);
103}
104
105/**
106 * of_get_named_gpio() - Get a GPIO number to use with GPIO API
107 * @np: device node to get GPIO from
108 * @propname: Name of property containing gpio specifier(s)
109 * @index: index of the GPIO
110 *
111 * Returns GPIO number to use with Linux generic GPIO API, or one of the errno
112 * value on the error condition.
113 */
114static inline int of_get_named_gpio(struct device_node *np,
115 const char *propname, int index)
116{
117 return of_get_named_gpio_flags(np, propname, index, NULL);
118}
119
120/**
121 * of_get_gpio() - Get a GPIO number to use with GPIO API
81 * @np: device node to get GPIO from 122 * @np: device node to get GPIO from
82 * @index: index of the GPIO 123 * @index: index of the GPIO
83 * 124 *
diff --git a/include/linux/of_irq.h b/include/linux/of_irq.h
index e6955f5d1f0..cd2e61ce4e8 100644
--- a/include/linux/of_irq.h
+++ b/include/linux/of_irq.h
@@ -63,6 +63,9 @@ extern int of_irq_map_one(struct device_node *device, int index,
63extern unsigned int irq_create_of_mapping(struct device_node *controller, 63extern unsigned int irq_create_of_mapping(struct device_node *controller,
64 const u32 *intspec, 64 const u32 *intspec,
65 unsigned int intsize); 65 unsigned int intsize);
66#ifdef CONFIG_IRQ_DOMAIN
67extern void irq_dispose_mapping(unsigned int irq);
68#endif
66extern int of_irq_to_resource(struct device_node *dev, int index, 69extern int of_irq_to_resource(struct device_node *dev, int index,
67 struct resource *r); 70 struct resource *r);
68extern int of_irq_count(struct device_node *dev); 71extern int of_irq_count(struct device_node *dev);
@@ -70,6 +73,7 @@ extern int of_irq_to_resource_table(struct device_node *dev,
70 struct resource *res, int nr_irqs); 73 struct resource *res, int nr_irqs);
71extern struct device_node *of_irq_find_parent(struct device_node *child); 74extern struct device_node *of_irq_find_parent(struct device_node *child);
72 75
76
73#endif /* CONFIG_OF_IRQ */ 77#endif /* CONFIG_OF_IRQ */
74#endif /* CONFIG_OF */ 78#endif /* CONFIG_OF */
75#endif /* __OF_IRQ_H */ 79#endif /* __OF_IRQ_H */
diff --git a/include/linux/of_net.h b/include/linux/of_net.h
index e913081fb52..f4746418871 100644
--- a/include/linux/of_net.h
+++ b/include/linux/of_net.h
@@ -9,6 +9,7 @@
9 9
10#ifdef CONFIG_OF_NET 10#ifdef CONFIG_OF_NET
11#include <linux/of.h> 11#include <linux/of.h>
12extern const int of_get_phy_mode(struct device_node *np);
12extern const void *of_get_mac_address(struct device_node *np); 13extern const void *of_get_mac_address(struct device_node *np);
13#endif 14#endif
14 15
diff --git a/include/linux/of_pci.h b/include/linux/of_pci.h
index 85a27b650d7..f93e21700d3 100644
--- a/include/linux/of_pci.h
+++ b/include/linux/of_pci.h
@@ -6,4 +6,9 @@
6struct pci_dev; 6struct pci_dev;
7struct of_irq; 7struct of_irq;
8int of_irq_map_pci(struct pci_dev *pdev, struct of_irq *out_irq); 8int of_irq_map_pci(struct pci_dev *pdev, struct of_irq *out_irq);
9
10struct device_node;
11struct device_node *of_pci_find_child_device(struct device_node *parent,
12 unsigned int devfn);
13
9#endif 14#endif
diff --git a/include/linux/of_platform.h b/include/linux/of_platform.h
index fb51ae38cea..5a6f458a4bb 100644
--- a/include/linux/of_platform.h
+++ b/include/linux/of_platform.h
@@ -20,6 +20,40 @@
20#include <linux/platform_device.h> 20#include <linux/platform_device.h>
21 21
22/** 22/**
23 * struct of_dev_auxdata - lookup table entry for device names & platform_data
24 * @compatible: compatible value of node to match against node
25 * @phys_addr: Start address of registers to match against node
26 * @name: Name to assign for matching nodes
27 * @platform_data: platform_data to assign for matching nodes
28 *
29 * This lookup table allows the caller of of_platform_populate() to override
30 * the names of devices when creating devices from the device tree. The table
31 * should be terminated with an empty entry. It also allows the platform_data
32 * pointer to be set.
33 *
34 * The reason for this functionality is that some Linux infrastructure uses
35 * the device name to look up a specific device, but the Linux-specific names
36 * are not encoded into the device tree, so the kernel needs to provide specific
37 * values.
38 *
39 * Note: Using an auxdata lookup table should be considered a last resort when
40 * converting a platform to use the DT. Normally the automatically generated
41 * device name will not matter, and drivers should obtain data from the device
42 * node instead of from an anonymouns platform_data pointer.
43 */
44struct of_dev_auxdata {
45 char *compatible;
46 resource_size_t phys_addr;
47 char *name;
48 void *platform_data;
49};
50
51/* Macro to simplify populating a lookup table */
52#define OF_DEV_AUXDATA(_compat,_phys,_name,_pdata) \
53 { .compatible = _compat, .phys_addr = _phys, .name = _name, \
54 .platform_data = _pdata }
55
56/**
23 * of_platform_driver - Legacy of-aware driver for platform devices. 57 * of_platform_driver - Legacy of-aware driver for platform devices.
24 * 58 *
25 * An of_platform_driver driver is attached to a basic platform_device on 59 * An of_platform_driver driver is attached to a basic platform_device on
@@ -40,6 +74,8 @@ struct of_platform_driver
40#define to_of_platform_driver(drv) \ 74#define to_of_platform_driver(drv) \
41 container_of(drv,struct of_platform_driver, driver) 75 container_of(drv,struct of_platform_driver, driver)
42 76
77extern const struct of_device_id of_default_bus_match_table[];
78
43/* Platform drivers register/unregister */ 79/* Platform drivers register/unregister */
44extern struct platform_device *of_device_alloc(struct device_node *np, 80extern struct platform_device *of_device_alloc(struct device_node *np,
45 const char *bus_id, 81 const char *bus_id,
@@ -55,6 +91,10 @@ extern struct platform_device *of_platform_device_create(struct device_node *np,
55extern int of_platform_bus_probe(struct device_node *root, 91extern int of_platform_bus_probe(struct device_node *root,
56 const struct of_device_id *matches, 92 const struct of_device_id *matches,
57 struct device *parent); 93 struct device *parent);
94extern int of_platform_populate(struct device_node *root,
95 const struct of_device_id *matches,
96 const struct of_dev_auxdata *lookup,
97 struct device *parent);
58#endif /* !CONFIG_SPARC */ 98#endif /* !CONFIG_SPARC */
59 99
60#endif /* CONFIG_OF_DEVICE */ 100#endif /* CONFIG_OF_DEVICE */
diff --git a/include/linux/oom.h b/include/linux/oom.h
index 4952fb874ad..13b7b02e599 100644
--- a/include/linux/oom.h
+++ b/include/linux/oom.h
@@ -64,10 +64,6 @@ static inline void oom_killer_enable(void)
64 oom_killer_disabled = false; 64 oom_killer_disabled = false;
65} 65}
66 66
67/* The badness from the OOM killer */
68extern unsigned long badness(struct task_struct *p, struct mem_cgroup *mem,
69 const nodemask_t *nodemask, unsigned long uptime);
70
71extern struct task_struct *find_lock_task_mm(struct task_struct *p); 67extern struct task_struct *find_lock_task_mm(struct task_struct *p);
72 68
73/* sysctls */ 69/* sysctls */
diff --git a/include/linux/opp.h b/include/linux/opp.h
index 5449945d589..7020e9736fc 100644
--- a/include/linux/opp.h
+++ b/include/linux/opp.h
@@ -94,12 +94,20 @@ static inline int opp_disable(struct device *dev, unsigned long freq)
94#if defined(CONFIG_CPU_FREQ) && defined(CONFIG_PM_OPP) 94#if defined(CONFIG_CPU_FREQ) && defined(CONFIG_PM_OPP)
95int opp_init_cpufreq_table(struct device *dev, 95int opp_init_cpufreq_table(struct device *dev,
96 struct cpufreq_frequency_table **table); 96 struct cpufreq_frequency_table **table);
97void opp_free_cpufreq_table(struct device *dev,
98 struct cpufreq_frequency_table **table);
97#else 99#else
98static inline int opp_init_cpufreq_table(struct device *dev, 100static inline int opp_init_cpufreq_table(struct device *dev,
99 struct cpufreq_frequency_table **table) 101 struct cpufreq_frequency_table **table)
100{ 102{
101 return -EINVAL; 103 return -EINVAL;
102} 104}
105
106static inline
107void opp_free_cpufreq_table(struct device *dev,
108 struct cpufreq_frequency_table **table)
109{
110}
103#endif /* CONFIG_CPU_FREQ */ 111#endif /* CONFIG_CPU_FREQ */
104 112
105#endif /* __LINUX_OPP_H__ */ 113#endif /* __LINUX_OPP_H__ */
diff --git a/include/linux/oprofile.h b/include/linux/oprofile.h
index 7f5cfd3b37d..49c8727eeb5 100644
--- a/include/linux/oprofile.h
+++ b/include/linux/oprofile.h
@@ -18,7 +18,7 @@
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/errno.h> 19#include <linux/errno.h>
20#include <linux/printk.h> 20#include <linux/printk.h>
21#include <asm/atomic.h> 21#include <linux/atomic.h>
22 22
23/* Each escaped entry is prefixed by ESCAPE_CODE 23/* Each escaped entry is prefixed by ESCAPE_CODE
24 * then one of the following codes, then the 24 * then one of the following codes, then the
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 6081493db68..e90a673be67 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -124,9 +124,6 @@ enum pageflags {
124 124
125 /* SLOB */ 125 /* SLOB */
126 PG_slob_free = PG_private, 126 PG_slob_free = PG_private,
127
128 /* SLUB */
129 PG_slub_frozen = PG_active,
130}; 127};
131 128
132#ifndef __GENERATING_BOUNDS_H 129#ifndef __GENERATING_BOUNDS_H
@@ -135,7 +132,7 @@ enum pageflags {
135 * Macros to create function definitions for page flags 132 * Macros to create function definitions for page flags
136 */ 133 */
137#define TESTPAGEFLAG(uname, lname) \ 134#define TESTPAGEFLAG(uname, lname) \
138static inline int Page##uname(struct page *page) \ 135static inline int Page##uname(const struct page *page) \
139 { return test_bit(PG_##lname, &page->flags); } 136 { return test_bit(PG_##lname, &page->flags); }
140 137
141#define SETPAGEFLAG(uname, lname) \ 138#define SETPAGEFLAG(uname, lname) \
@@ -173,7 +170,7 @@ static inline int __TestClearPage##uname(struct page *page) \
173 __SETPAGEFLAG(uname, lname) __CLEARPAGEFLAG(uname, lname) 170 __SETPAGEFLAG(uname, lname) __CLEARPAGEFLAG(uname, lname)
174 171
175#define PAGEFLAG_FALSE(uname) \ 172#define PAGEFLAG_FALSE(uname) \
176static inline int Page##uname(struct page *page) \ 173static inline int Page##uname(const struct page *page) \
177 { return 0; } 174 { return 0; }
178 175
179#define TESTSCFLAG(uname, lname) \ 176#define TESTSCFLAG(uname, lname) \
@@ -212,8 +209,6 @@ PAGEFLAG(SwapBacked, swapbacked) __CLEARPAGEFLAG(SwapBacked, swapbacked)
212 209
213__PAGEFLAG(SlobFree, slob_free) 210__PAGEFLAG(SlobFree, slob_free)
214 211
215__PAGEFLAG(SlubFrozen, slub_frozen)
216
217/* 212/*
218 * Private page markings that may be used by the filesystem that owns the page 213 * Private page markings that may be used by the filesystem that owns the page
219 * for its own purposes. 214 * for its own purposes.
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index 716875e5352..cfaaa6949b8 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -134,7 +134,7 @@ static inline int page_cache_get_speculative(struct page *page)
134 VM_BUG_ON(in_interrupt()); 134 VM_BUG_ON(in_interrupt());
135 135
136#if !defined(CONFIG_SMP) && defined(CONFIG_TREE_RCU) 136#if !defined(CONFIG_SMP) && defined(CONFIG_TREE_RCU)
137# ifdef CONFIG_PREEMPT 137# ifdef CONFIG_PREEMPT_COUNT
138 VM_BUG_ON(!in_atomic()); 138 VM_BUG_ON(!in_atomic());
139# endif 139# endif
140 /* 140 /*
@@ -172,7 +172,7 @@ static inline int page_cache_add_speculative(struct page *page, int count)
172 VM_BUG_ON(in_interrupt()); 172 VM_BUG_ON(in_interrupt());
173 173
174#if !defined(CONFIG_SMP) && defined(CONFIG_TREE_RCU) 174#if !defined(CONFIG_SMP) && defined(CONFIG_TREE_RCU)
175# ifdef CONFIG_PREEMPT 175# ifdef CONFIG_PREEMPT_COUNT
176 VM_BUG_ON(!in_atomic()); 176 VM_BUG_ON(!in_atomic());
177# endif 177# endif
178 VM_BUG_ON(page_count(page) == 0); 178 VM_BUG_ON(page_count(page) == 0);
@@ -255,26 +255,24 @@ static inline struct page *grab_cache_page(struct address_space *mapping,
255extern struct page * grab_cache_page_nowait(struct address_space *mapping, 255extern struct page * grab_cache_page_nowait(struct address_space *mapping,
256 pgoff_t index); 256 pgoff_t index);
257extern struct page * read_cache_page_async(struct address_space *mapping, 257extern struct page * read_cache_page_async(struct address_space *mapping,
258 pgoff_t index, filler_t *filler, 258 pgoff_t index, filler_t *filler, void *data);
259 void *data);
260extern struct page * read_cache_page(struct address_space *mapping, 259extern struct page * read_cache_page(struct address_space *mapping,
261 pgoff_t index, filler_t *filler, 260 pgoff_t index, filler_t *filler, void *data);
262 void *data);
263extern struct page * read_cache_page_gfp(struct address_space *mapping, 261extern struct page * read_cache_page_gfp(struct address_space *mapping,
264 pgoff_t index, gfp_t gfp_mask); 262 pgoff_t index, gfp_t gfp_mask);
265extern int read_cache_pages(struct address_space *mapping, 263extern int read_cache_pages(struct address_space *mapping,
266 struct list_head *pages, filler_t *filler, void *data); 264 struct list_head *pages, filler_t *filler, void *data);
267 265
268static inline struct page *read_mapping_page_async( 266static inline struct page *read_mapping_page_async(
269 struct address_space *mapping, 267 struct address_space *mapping,
270 pgoff_t index, void *data) 268 pgoff_t index, void *data)
271{ 269{
272 filler_t *filler = (filler_t *)mapping->a_ops->readpage; 270 filler_t *filler = (filler_t *)mapping->a_ops->readpage;
273 return read_cache_page_async(mapping, index, filler, data); 271 return read_cache_page_async(mapping, index, filler, data);
274} 272}
275 273
276static inline struct page *read_mapping_page(struct address_space *mapping, 274static inline struct page *read_mapping_page(struct address_space *mapping,
277 pgoff_t index, void *data) 275 pgoff_t index, void *data)
278{ 276{
279 filler_t *filler = (filler_t *)mapping->a_ops->readpage; 277 filler_t *filler = (filler_t *)mapping->a_ops->readpage;
280 return read_cache_page(mapping, index, filler, data); 278 return read_cache_page(mapping, index, filler, data);
diff --git a/include/linux/pci.h b/include/linux/pci.h
index c446b5ca2d3..9fc01226055 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -49,7 +49,7 @@
49#include <linux/compiler.h> 49#include <linux/compiler.h>
50#include <linux/errno.h> 50#include <linux/errno.h>
51#include <linux/kobject.h> 51#include <linux/kobject.h>
52#include <asm/atomic.h> 52#include <linux/atomic.h>
53#include <linux/device.h> 53#include <linux/device.h>
54#include <linux/io.h> 54#include <linux/io.h>
55#include <linux/irqreturn.h> 55#include <linux/irqreturn.h>
@@ -251,7 +251,8 @@ struct pci_dev {
251 u8 revision; /* PCI revision, low byte of class word */ 251 u8 revision; /* PCI revision, low byte of class word */
252 u8 hdr_type; /* PCI header type (`multi' flag masked out) */ 252 u8 hdr_type; /* PCI header type (`multi' flag masked out) */
253 u8 pcie_cap; /* PCI-E capability offset */ 253 u8 pcie_cap; /* PCI-E capability offset */
254 u8 pcie_type; /* PCI-E device/port type */ 254 u8 pcie_type:4; /* PCI-E device/port type */
255 u8 pcie_mpss:3; /* PCI-E Max Payload Size Supported */
255 u8 rom_base_reg; /* which config register controls the ROM */ 256 u8 rom_base_reg; /* which config register controls the ROM */
256 u8 pin; /* which interrupt pin this device uses */ 257 u8 pin; /* which interrupt pin this device uses */
257 258
@@ -617,6 +618,17 @@ struct pci_driver {
617/* these external functions are only available when PCI support is enabled */ 618/* these external functions are only available when PCI support is enabled */
618#ifdef CONFIG_PCI 619#ifdef CONFIG_PCI
619 620
621extern void pcie_bus_configure_settings(struct pci_bus *bus, u8 smpss);
622
623enum pcie_bus_config_types {
624 PCIE_BUS_TUNE_OFF,
625 PCIE_BUS_SAFE,
626 PCIE_BUS_PERFORMANCE,
627 PCIE_BUS_PEER2PEER,
628};
629
630extern enum pcie_bus_config_types pcie_bus_config;
631
620extern struct bus_type pci_bus_type; 632extern struct bus_type pci_bus_type;
621 633
622/* Do NOT directly access these two variables, unless you are arch specific pci 634/* Do NOT directly access these two variables, unless you are arch specific pci
@@ -796,10 +808,13 @@ int pcix_get_mmrbc(struct pci_dev *dev);
796int pcix_set_mmrbc(struct pci_dev *dev, int mmrbc); 808int pcix_set_mmrbc(struct pci_dev *dev, int mmrbc);
797int pcie_get_readrq(struct pci_dev *dev); 809int pcie_get_readrq(struct pci_dev *dev);
798int pcie_set_readrq(struct pci_dev *dev, int rq); 810int pcie_set_readrq(struct pci_dev *dev, int rq);
811int pcie_get_mps(struct pci_dev *dev);
812int pcie_set_mps(struct pci_dev *dev, int mps);
799int __pci_reset_function(struct pci_dev *dev); 813int __pci_reset_function(struct pci_dev *dev);
800int pci_reset_function(struct pci_dev *dev); 814int pci_reset_function(struct pci_dev *dev);
801void pci_update_resource(struct pci_dev *dev, int resno); 815void pci_update_resource(struct pci_dev *dev, int resno);
802int __must_check pci_assign_resource(struct pci_dev *dev, int i); 816int __must_check pci_assign_resource(struct pci_dev *dev, int i);
817int __must_check pci_reassign_resource(struct pci_dev *dev, int i, resource_size_t add_size, resource_size_t align);
803int pci_select_bars(struct pci_dev *dev, unsigned long flags); 818int pci_select_bars(struct pci_dev *dev, unsigned long flags);
804 819
805/* ROM control related routines */ 820/* ROM control related routines */
@@ -843,8 +858,8 @@ void pci_enable_ido(struct pci_dev *dev, unsigned long type);
843void pci_disable_ido(struct pci_dev *dev, unsigned long type); 858void pci_disable_ido(struct pci_dev *dev, unsigned long type);
844 859
845enum pci_obff_signal_type { 860enum pci_obff_signal_type {
846 PCI_EXP_OBFF_SIGNAL_L0, 861 PCI_EXP_OBFF_SIGNAL_L0 = 0,
847 PCI_EXP_OBFF_SIGNAL_ALWAYS, 862 PCI_EXP_OBFF_SIGNAL_ALWAYS = 1,
848}; 863};
849int pci_enable_obff(struct pci_dev *dev, enum pci_obff_signal_type); 864int pci_enable_obff(struct pci_dev *dev, enum pci_obff_signal_type);
850void pci_disable_obff(struct pci_dev *dev); 865void pci_disable_obff(struct pci_dev *dev);
@@ -879,7 +894,7 @@ void pdev_enable_device(struct pci_dev *);
879void pdev_sort_resources(struct pci_dev *, struct resource_list *); 894void pdev_sort_resources(struct pci_dev *, struct resource_list *);
880int pci_enable_resources(struct pci_dev *, int mask); 895int pci_enable_resources(struct pci_dev *, int mask);
881void pci_fixup_irqs(u8 (*)(struct pci_dev *, u8 *), 896void pci_fixup_irqs(u8 (*)(struct pci_dev *, u8 *),
882 int (*)(struct pci_dev *, u8, u8)); 897 int (*)(const struct pci_dev *, u8, u8));
883#define HAVE_PCI_REQ_REGIONS 2 898#define HAVE_PCI_REQ_REGIONS 2
884int __must_check pci_request_regions(struct pci_dev *, const char *); 899int __must_check pci_request_regions(struct pci_dev *, const char *);
885int __must_check pci_request_regions_exclusive(struct pci_dev *, const char *); 900int __must_check pci_request_regions_exclusive(struct pci_dev *, const char *);
@@ -1589,5 +1604,44 @@ int pci_vpd_find_tag(const u8 *buf, unsigned int off, unsigned int len, u8 rdt);
1589int pci_vpd_find_info_keyword(const u8 *buf, unsigned int off, 1604int pci_vpd_find_info_keyword(const u8 *buf, unsigned int off,
1590 unsigned int len, const char *kw); 1605 unsigned int len, const char *kw);
1591 1606
1607/* PCI <-> OF binding helpers */
1608#ifdef CONFIG_OF
1609struct device_node;
1610extern void pci_set_of_node(struct pci_dev *dev);
1611extern void pci_release_of_node(struct pci_dev *dev);
1612extern void pci_set_bus_of_node(struct pci_bus *bus);
1613extern void pci_release_bus_of_node(struct pci_bus *bus);
1614
1615/* Arch may override this (weak) */
1616extern struct device_node * __weak pcibios_get_phb_of_node(struct pci_bus *bus);
1617
1618static inline struct device_node *pci_device_to_OF_node(struct pci_dev *pdev)
1619{
1620 return pdev ? pdev->dev.of_node : NULL;
1621}
1622
1623static inline struct device_node *pci_bus_to_OF_node(struct pci_bus *bus)
1624{
1625 return bus ? bus->dev.of_node : NULL;
1626}
1627
1628#else /* CONFIG_OF */
1629static inline void pci_set_of_node(struct pci_dev *dev) { }
1630static inline void pci_release_of_node(struct pci_dev *dev) { }
1631static inline void pci_set_bus_of_node(struct pci_bus *bus) { }
1632static inline void pci_release_bus_of_node(struct pci_bus *bus) { }
1633#endif /* CONFIG_OF */
1634
1635/**
1636 * pci_find_upstream_pcie_bridge - find upstream PCIe-to-PCI bridge of a device
1637 * @pdev: the PCI device
1638 *
1639 * if the device is PCIE, return NULL
1640 * if the device isn't connected to a PCIe bridge (that is its parent is a
1641 * legacy PCI bridge and the bridge is directly connected to bus 0), return its
1642 * parent
1643 */
1644struct pci_dev *pci_find_upstream_pcie_bridge(struct pci_dev *pdev);
1645
1592#endif /* __KERNEL__ */ 1646#endif /* __KERNEL__ */
1593#endif /* LINUX_PCI_H */ 1647#endif /* LINUX_PCI_H */
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index f8910e15556..ae96bbe5451 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -1308,6 +1308,7 @@
1308#define PCI_SUBDEVICE_ID_CREATIVE_SB08801 0x0041 1308#define PCI_SUBDEVICE_ID_CREATIVE_SB08801 0x0041
1309#define PCI_SUBDEVICE_ID_CREATIVE_SB08802 0x0042 1309#define PCI_SUBDEVICE_ID_CREATIVE_SB08802 0x0042
1310#define PCI_SUBDEVICE_ID_CREATIVE_SB08803 0x0043 1310#define PCI_SUBDEVICE_ID_CREATIVE_SB08803 0x0043
1311#define PCI_SUBDEVICE_ID_CREATIVE_SB1270 0x0062
1311#define PCI_SUBDEVICE_ID_CREATIVE_HENDRIX 0x6000 1312#define PCI_SUBDEVICE_ID_CREATIVE_HENDRIX 0x6000
1312 1313
1313#define PCI_VENDOR_ID_ECTIVA 0x1102 /* duplicate: CREATIVE */ 1314#define PCI_VENDOR_ID_ECTIVA 0x1102 /* duplicate: CREATIVE */
@@ -2103,6 +2104,9 @@
2103#define PCI_DEVICE_ID_TIGON3_5761E 0x1680 2104#define PCI_DEVICE_ID_TIGON3_5761E 0x1680
2104#define PCI_DEVICE_ID_TIGON3_5761 0x1681 2105#define PCI_DEVICE_ID_TIGON3_5761 0x1681
2105#define PCI_DEVICE_ID_TIGON3_5764 0x1684 2106#define PCI_DEVICE_ID_TIGON3_5764 0x1684
2107#define PCI_DEVICE_ID_NX2_57800 0x168a
2108#define PCI_DEVICE_ID_NX2_57840 0x168d
2109#define PCI_DEVICE_ID_NX2_57810 0x168e
2106#define PCI_DEVICE_ID_TIGON3_5787M 0x1693 2110#define PCI_DEVICE_ID_TIGON3_5787M 0x1693
2107#define PCI_DEVICE_ID_TIGON3_5782 0x1696 2111#define PCI_DEVICE_ID_TIGON3_5782 0x1696
2108#define PCI_DEVICE_ID_TIGON3_5784 0x1698 2112#define PCI_DEVICE_ID_TIGON3_5784 0x1698
@@ -2110,11 +2114,17 @@
2110#define PCI_DEVICE_ID_TIGON3_5787 0x169b 2114#define PCI_DEVICE_ID_TIGON3_5787 0x169b
2111#define PCI_DEVICE_ID_TIGON3_5788 0x169c 2115#define PCI_DEVICE_ID_TIGON3_5788 0x169c
2112#define PCI_DEVICE_ID_TIGON3_5789 0x169d 2116#define PCI_DEVICE_ID_TIGON3_5789 0x169d
2117#define PCI_DEVICE_ID_NX2_57800_MF 0x16a5
2113#define PCI_DEVICE_ID_TIGON3_5702X 0x16a6 2118#define PCI_DEVICE_ID_TIGON3_5702X 0x16a6
2114#define PCI_DEVICE_ID_TIGON3_5703X 0x16a7 2119#define PCI_DEVICE_ID_TIGON3_5703X 0x16a7
2115#define PCI_DEVICE_ID_TIGON3_5704S 0x16a8 2120#define PCI_DEVICE_ID_TIGON3_5704S 0x16a8
2121#define PCI_DEVICE_ID_NX2_57800_VF 0x16a9
2116#define PCI_DEVICE_ID_NX2_5706S 0x16aa 2122#define PCI_DEVICE_ID_NX2_5706S 0x16aa
2123#define PCI_DEVICE_ID_NX2_57840_MF 0x16ab
2117#define PCI_DEVICE_ID_NX2_5708S 0x16ac 2124#define PCI_DEVICE_ID_NX2_5708S 0x16ac
2125#define PCI_DEVICE_ID_NX2_57840_VF 0x16ad
2126#define PCI_DEVICE_ID_NX2_57810_MF 0x16ae
2127#define PCI_DEVICE_ID_NX2_57810_VF 0x16af
2118#define PCI_DEVICE_ID_TIGON3_5702A3 0x16c6 2128#define PCI_DEVICE_ID_TIGON3_5702A3 0x16c6
2119#define PCI_DEVICE_ID_TIGON3_5703A3 0x16c7 2129#define PCI_DEVICE_ID_TIGON3_5703A3 0x16c7
2120#define PCI_DEVICE_ID_TIGON3_5781 0x16dd 2130#define PCI_DEVICE_ID_TIGON3_5781 0x16dd
@@ -2699,6 +2709,16 @@
2699#define PCI_DEVICE_ID_INTEL_ICH10_5 0x3a60 2709#define PCI_DEVICE_ID_INTEL_ICH10_5 0x3a60
2700#define PCI_DEVICE_ID_INTEL_5_3400_SERIES_LPC_MIN 0x3b00 2710#define PCI_DEVICE_ID_INTEL_5_3400_SERIES_LPC_MIN 0x3b00
2701#define PCI_DEVICE_ID_INTEL_5_3400_SERIES_LPC_MAX 0x3b1f 2711#define PCI_DEVICE_ID_INTEL_5_3400_SERIES_LPC_MAX 0x3b1f
2712#define PCI_DEVICE_ID_INTEL_IOAT_SNB0 0x3c20
2713#define PCI_DEVICE_ID_INTEL_IOAT_SNB1 0x3c21
2714#define PCI_DEVICE_ID_INTEL_IOAT_SNB2 0x3c22
2715#define PCI_DEVICE_ID_INTEL_IOAT_SNB3 0x3c23
2716#define PCI_DEVICE_ID_INTEL_IOAT_SNB4 0x3c24
2717#define PCI_DEVICE_ID_INTEL_IOAT_SNB5 0x3c25
2718#define PCI_DEVICE_ID_INTEL_IOAT_SNB6 0x3c26
2719#define PCI_DEVICE_ID_INTEL_IOAT_SNB7 0x3c27
2720#define PCI_DEVICE_ID_INTEL_IOAT_SNB8 0x3c2e
2721#define PCI_DEVICE_ID_INTEL_IOAT_SNB9 0x3c2f
2702#define PCI_DEVICE_ID_INTEL_IOAT_SNB 0x402f 2722#define PCI_DEVICE_ID_INTEL_IOAT_SNB 0x402f
2703#define PCI_DEVICE_ID_INTEL_5100_16 0x65f0 2723#define PCI_DEVICE_ID_INTEL_5100_16 0x65f0
2704#define PCI_DEVICE_ID_INTEL_5100_21 0x65f5 2724#define PCI_DEVICE_ID_INTEL_5100_21 0x65f5
@@ -2822,7 +2842,11 @@
2822#define PCI_DEVICE_ID_NETMOS_9845 0x9845 2842#define PCI_DEVICE_ID_NETMOS_9845 0x9845
2823#define PCI_DEVICE_ID_NETMOS_9855 0x9855 2843#define PCI_DEVICE_ID_NETMOS_9855 0x9855
2824#define PCI_DEVICE_ID_NETMOS_9865 0x9865 2844#define PCI_DEVICE_ID_NETMOS_9865 0x9865
2845#define PCI_DEVICE_ID_NETMOS_9900 0x9900
2825#define PCI_DEVICE_ID_NETMOS_9901 0x9901 2846#define PCI_DEVICE_ID_NETMOS_9901 0x9901
2847#define PCI_DEVICE_ID_NETMOS_9904 0x9904
2848#define PCI_DEVICE_ID_NETMOS_9912 0x9912
2849#define PCI_DEVICE_ID_NETMOS_9922 0x9922
2826 2850
2827#define PCI_VENDOR_ID_3COM_2 0xa727 2851#define PCI_VENDOR_ID_3COM_2 0xa727
2828 2852
diff --git a/include/linux/pci_regs.h b/include/linux/pci_regs.h
index e8840964aca..dad7d9a4abc 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 */
diff --git a/include/linux/pda_power.h b/include/linux/pda_power.h
index c9e4d814ff7..2bb62bf296a 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/perf_event.h b/include/linux/perf_event.h
index e0786e35f24..c816075c01c 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -61,7 +61,7 @@ enum perf_hw_id {
61/* 61/*
62 * Generalized hardware cache events: 62 * Generalized hardware cache events:
63 * 63 *
64 * { L1-D, L1-I, LLC, ITLB, DTLB, BPU } x 64 * { L1-D, L1-I, LLC, ITLB, DTLB, BPU, NODE } x
65 * { read, write, prefetch } x 65 * { read, write, prefetch } x
66 * { accesses, misses } 66 * { accesses, misses }
67 */ 67 */
@@ -72,6 +72,7 @@ enum perf_hw_cache_id {
72 PERF_COUNT_HW_CACHE_DTLB = 3, 72 PERF_COUNT_HW_CACHE_DTLB = 3,
73 PERF_COUNT_HW_CACHE_ITLB = 4, 73 PERF_COUNT_HW_CACHE_ITLB = 4,
74 PERF_COUNT_HW_CACHE_BPU = 5, 74 PERF_COUNT_HW_CACHE_BPU = 5,
75 PERF_COUNT_HW_CACHE_NODE = 6,
75 76
76 PERF_COUNT_HW_CACHE_MAX, /* non-ABI */ 77 PERF_COUNT_HW_CACHE_MAX, /* non-ABI */
77}; 78};
@@ -508,7 +509,7 @@ struct perf_guest_info_callbacks {
508#include <linux/cpu.h> 509#include <linux/cpu.h>
509#include <linux/irq_work.h> 510#include <linux/irq_work.h>
510#include <linux/jump_label.h> 511#include <linux/jump_label.h>
511#include <asm/atomic.h> 512#include <linux/atomic.h>
512#include <asm/local.h> 513#include <asm/local.h>
513 514
514#define PERF_MAX_STACK_DEPTH 255 515#define PERF_MAX_STACK_DEPTH 255
@@ -536,6 +537,16 @@ struct perf_branch_stack {
536 537
537struct task_struct; 538struct task_struct;
538 539
540/*
541 * extra PMU register associated with an event
542 */
543struct hw_perf_event_extra {
544 u64 config; /* register value */
545 unsigned int reg; /* register address or index */
546 int alloc; /* extra register already allocated */
547 int idx; /* index in shared_regs->regs[] */
548};
549
539/** 550/**
540 * struct hw_perf_event - performance event hardware details: 551 * struct hw_perf_event - performance event hardware details:
541 */ 552 */
@@ -549,9 +560,7 @@ struct hw_perf_event {
549 unsigned long event_base; 560 unsigned long event_base;
550 int idx; 561 int idx;
551 int last_cpu; 562 int last_cpu;
552 unsigned int extra_reg; 563 struct hw_perf_event_extra extra_reg;
553 u64 extra_config;
554 int extra_alloc;
555 }; 564 };
556 struct { /* software */ 565 struct { /* software */
557 struct hrtimer hrtimer; 566 struct hrtimer hrtimer;
@@ -680,36 +689,9 @@ enum perf_event_active_state {
680}; 689};
681 690
682struct file; 691struct file;
683
684#define PERF_BUFFER_WRITABLE 0x01
685
686struct perf_buffer {
687 atomic_t refcount;
688 struct rcu_head rcu_head;
689#ifdef CONFIG_PERF_USE_VMALLOC
690 struct work_struct work;
691 int page_order; /* allocation order */
692#endif
693 int nr_pages; /* nr of data pages */
694 int writable; /* are we writable */
695
696 atomic_t poll; /* POLL_ for wakeups */
697
698 local_t head; /* write position */
699 local_t nest; /* nested writers */
700 local_t events; /* event limit */
701 local_t wakeup; /* wakeup stamp */
702 local_t lost; /* nr records lost */
703
704 long watermark; /* wakeup watermark */
705
706 struct perf_event_mmap_page *user_page;
707 void *data_pages[0];
708};
709
710struct perf_sample_data; 692struct perf_sample_data;
711 693
712typedef void (*perf_overflow_handler_t)(struct perf_event *, int, 694typedef void (*perf_overflow_handler_t)(struct perf_event *,
713 struct perf_sample_data *, 695 struct perf_sample_data *,
714 struct pt_regs *regs); 696 struct pt_regs *regs);
715 697
@@ -745,6 +727,8 @@ struct perf_cgroup {
745}; 727};
746#endif 728#endif
747 729
730struct ring_buffer;
731
748/** 732/**
749 * struct perf_event - performance event kernel representation: 733 * struct perf_event - performance event kernel representation:
750 */ 734 */
@@ -834,7 +818,7 @@ struct perf_event {
834 atomic_t mmap_count; 818 atomic_t mmap_count;
835 int mmap_locked; 819 int mmap_locked;
836 struct user_struct *mmap_user; 820 struct user_struct *mmap_user;
837 struct perf_buffer *buffer; 821 struct ring_buffer *rb;
838 822
839 /* poll related */ 823 /* poll related */
840 wait_queue_head_t waitq; 824 wait_queue_head_t waitq;
@@ -855,6 +839,7 @@ struct perf_event {
855 u64 id; 839 u64 id;
856 840
857 perf_overflow_handler_t overflow_handler; 841 perf_overflow_handler_t overflow_handler;
842 void *overflow_handler_context;
858 843
859#ifdef CONFIG_EVENT_TRACING 844#ifdef CONFIG_EVENT_TRACING
860 struct ftrace_event_call *tp_event; 845 struct ftrace_event_call *tp_event;
@@ -919,8 +904,8 @@ struct perf_event_context {
919 u64 parent_gen; 904 u64 parent_gen;
920 u64 generation; 905 u64 generation;
921 int pin_count; 906 int pin_count;
922 struct rcu_head rcu_head;
923 int nr_cgroups; /* cgroup events present */ 907 int nr_cgroups; /* cgroup events present */
908 struct rcu_head rcu_head;
924}; 909};
925 910
926/* 911/*
@@ -945,13 +930,11 @@ struct perf_cpu_context {
945 930
946struct perf_output_handle { 931struct perf_output_handle {
947 struct perf_event *event; 932 struct perf_event *event;
948 struct perf_buffer *buffer; 933 struct ring_buffer *rb;
949 unsigned long wakeup; 934 unsigned long wakeup;
950 unsigned long size; 935 unsigned long size;
951 void *addr; 936 void *addr;
952 int page; 937 int page;
953 int nmi;
954 int sample;
955}; 938};
956 939
957#ifdef CONFIG_PERF_EVENTS 940#ifdef CONFIG_PERF_EVENTS
@@ -961,8 +944,10 @@ extern void perf_pmu_unregister(struct pmu *pmu);
961 944
962extern int perf_num_counters(void); 945extern int perf_num_counters(void);
963extern const char *perf_pmu_name(void); 946extern const char *perf_pmu_name(void);
964extern void __perf_event_task_sched_in(struct task_struct *task); 947extern void __perf_event_task_sched_in(struct task_struct *prev,
965extern void __perf_event_task_sched_out(struct task_struct *task, struct task_struct *next); 948 struct task_struct *task);
949extern void __perf_event_task_sched_out(struct task_struct *prev,
950 struct task_struct *next);
966extern int perf_event_init_task(struct task_struct *child); 951extern int perf_event_init_task(struct task_struct *child);
967extern void perf_event_exit_task(struct task_struct *child); 952extern void perf_event_exit_task(struct task_struct *child);
968extern void perf_event_free_task(struct task_struct *task); 953extern void perf_event_free_task(struct task_struct *task);
@@ -972,13 +957,15 @@ extern void perf_pmu_disable(struct pmu *pmu);
972extern void perf_pmu_enable(struct pmu *pmu); 957extern void perf_pmu_enable(struct pmu *pmu);
973extern int perf_event_task_disable(void); 958extern int perf_event_task_disable(void);
974extern int perf_event_task_enable(void); 959extern int perf_event_task_enable(void);
960extern int perf_event_refresh(struct perf_event *event, int refresh);
975extern void perf_event_update_userpage(struct perf_event *event); 961extern void perf_event_update_userpage(struct perf_event *event);
976extern int perf_event_release_kernel(struct perf_event *event); 962extern int perf_event_release_kernel(struct perf_event *event);
977extern struct perf_event * 963extern struct perf_event *
978perf_event_create_kernel_counter(struct perf_event_attr *attr, 964perf_event_create_kernel_counter(struct perf_event_attr *attr,
979 int cpu, 965 int cpu,
980 struct task_struct *task, 966 struct task_struct *task,
981 perf_overflow_handler_t callback); 967 perf_overflow_handler_t callback,
968 void *context);
982extern u64 perf_event_read_value(struct perf_event *event, 969extern u64 perf_event_read_value(struct perf_event *event,
983 u64 *enabled, u64 *running); 970 u64 *enabled, u64 *running);
984 971
@@ -1018,7 +1005,7 @@ extern void perf_prepare_sample(struct perf_event_header *header,
1018 struct perf_event *event, 1005 struct perf_event *event,
1019 struct pt_regs *regs); 1006 struct pt_regs *regs);
1020 1007
1021extern int perf_event_overflow(struct perf_event *event, int nmi, 1008extern int perf_event_overflow(struct perf_event *event,
1022 struct perf_sample_data *data, 1009 struct perf_sample_data *data,
1023 struct pt_regs *regs); 1010 struct pt_regs *regs);
1024 1011
@@ -1037,7 +1024,7 @@ static inline int is_software_event(struct perf_event *event)
1037 1024
1038extern struct jump_label_key perf_swevent_enabled[PERF_COUNT_SW_MAX]; 1025extern struct jump_label_key perf_swevent_enabled[PERF_COUNT_SW_MAX];
1039 1026
1040extern void __perf_sw_event(u32, u64, int, struct pt_regs *, u64); 1027extern void __perf_sw_event(u32, u64, struct pt_regs *, u64);
1041 1028
1042#ifndef perf_arch_fetch_caller_regs 1029#ifndef perf_arch_fetch_caller_regs
1043static inline void perf_arch_fetch_caller_regs(struct pt_regs *regs, unsigned long ip) { } 1030static inline void perf_arch_fetch_caller_regs(struct pt_regs *regs, unsigned long ip) { }
@@ -1059,7 +1046,7 @@ static inline void perf_fetch_caller_regs(struct pt_regs *regs)
1059} 1046}
1060 1047
1061static __always_inline void 1048static __always_inline void
1062perf_sw_event(u32 event_id, u64 nr, int nmi, struct pt_regs *regs, u64 addr) 1049perf_sw_event(u32 event_id, u64 nr, struct pt_regs *regs, u64 addr)
1063{ 1050{
1064 struct pt_regs hot_regs; 1051 struct pt_regs hot_regs;
1065 1052
@@ -1068,23 +1055,26 @@ perf_sw_event(u32 event_id, u64 nr, int nmi, struct pt_regs *regs, u64 addr)
1068 perf_fetch_caller_regs(&hot_regs); 1055 perf_fetch_caller_regs(&hot_regs);
1069 regs = &hot_regs; 1056 regs = &hot_regs;
1070 } 1057 }
1071 __perf_sw_event(event_id, nr, nmi, regs, addr); 1058 __perf_sw_event(event_id, nr, regs, addr);
1072 } 1059 }
1073} 1060}
1074 1061
1075extern struct jump_label_key perf_sched_events; 1062extern struct jump_label_key perf_sched_events;
1076 1063
1077static inline void perf_event_task_sched_in(struct task_struct *task) 1064static inline void perf_event_task_sched_in(struct task_struct *prev,
1065 struct task_struct *task)
1078{ 1066{
1079 if (static_branch(&perf_sched_events)) 1067 if (static_branch(&perf_sched_events))
1080 __perf_event_task_sched_in(task); 1068 __perf_event_task_sched_in(prev, task);
1081} 1069}
1082 1070
1083static inline void perf_event_task_sched_out(struct task_struct *task, struct task_struct *next) 1071static inline void perf_event_task_sched_out(struct task_struct *prev,
1072 struct task_struct *next)
1084{ 1073{
1085 perf_sw_event(PERF_COUNT_SW_CONTEXT_SWITCHES, 1, 1, NULL, 0); 1074 perf_sw_event(PERF_COUNT_SW_CONTEXT_SWITCHES, 1, NULL, 0);
1086 1075
1087 __perf_event_task_sched_out(task, next); 1076 if (static_branch(&perf_sched_events))
1077 __perf_event_task_sched_out(prev, next);
1088} 1078}
1089 1079
1090extern void perf_event_mmap(struct vm_area_struct *vma); 1080extern void perf_event_mmap(struct vm_area_struct *vma);
@@ -1143,8 +1133,7 @@ extern void perf_bp_event(struct perf_event *event, void *data);
1143#endif 1133#endif
1144 1134
1145extern int perf_output_begin(struct perf_output_handle *handle, 1135extern int perf_output_begin(struct perf_output_handle *handle,
1146 struct perf_event *event, unsigned int size, 1136 struct perf_event *event, unsigned int size);
1147 int nmi, int sample);
1148extern void perf_output_end(struct perf_output_handle *handle); 1137extern void perf_output_end(struct perf_output_handle *handle);
1149extern void perf_output_copy(struct perf_output_handle *handle, 1138extern void perf_output_copy(struct perf_output_handle *handle,
1150 const void *buf, unsigned int len); 1139 const void *buf, unsigned int len);
@@ -1155,10 +1144,11 @@ extern void perf_event_disable(struct perf_event *event);
1155extern void perf_event_task_tick(void); 1144extern void perf_event_task_tick(void);
1156#else 1145#else
1157static inline void 1146static inline void
1158perf_event_task_sched_in(struct task_struct *task) { } 1147perf_event_task_sched_in(struct task_struct *prev,
1148 struct task_struct *task) { }
1159static inline void 1149static inline void
1160perf_event_task_sched_out(struct task_struct *task, 1150perf_event_task_sched_out(struct task_struct *prev,
1161 struct task_struct *next) { } 1151 struct task_struct *next) { }
1162static inline int perf_event_init_task(struct task_struct *child) { return 0; } 1152static inline int perf_event_init_task(struct task_struct *child) { return 0; }
1163static inline void perf_event_exit_task(struct task_struct *child) { } 1153static inline void perf_event_exit_task(struct task_struct *child) { }
1164static inline void perf_event_free_task(struct task_struct *task) { } 1154static inline void perf_event_free_task(struct task_struct *task) { }
@@ -1166,10 +1156,13 @@ static inline void perf_event_delayed_put(struct task_struct *task) { }
1166static inline void perf_event_print_debug(void) { } 1156static inline void perf_event_print_debug(void) { }
1167static inline int perf_event_task_disable(void) { return -EINVAL; } 1157static inline int perf_event_task_disable(void) { return -EINVAL; }
1168static inline int perf_event_task_enable(void) { return -EINVAL; } 1158static inline int perf_event_task_enable(void) { return -EINVAL; }
1159static inline int perf_event_refresh(struct perf_event *event, int refresh)
1160{
1161 return -EINVAL;
1162}
1169 1163
1170static inline void 1164static inline void
1171perf_sw_event(u32 event_id, u64 nr, int nmi, 1165perf_sw_event(u32 event_id, u64 nr, struct pt_regs *regs, u64 addr) { }
1172 struct pt_regs *regs, u64 addr) { }
1173static inline void 1166static inline void
1174perf_bp_event(struct perf_event *event, void *data) { } 1167perf_bp_event(struct perf_event *event, void *data) { }
1175 1168
diff --git a/include/linux/personality.h b/include/linux/personality.h
index eec3bae164d..8fc7dd1a57f 100644
--- a/include/linux/personality.h
+++ b/include/linux/personality.h
@@ -22,6 +22,7 @@ extern int __set_personality(unsigned int);
22 * These occupy the top three bytes. 22 * These occupy the top three bytes.
23 */ 23 */
24enum { 24enum {
25 UNAME26 = 0x0020000,
25 ADDR_NO_RANDOMIZE = 0x0040000, /* disable randomization of VA space */ 26 ADDR_NO_RANDOMIZE = 0x0040000, /* disable randomization of VA space */
26 FDPIC_FUNCPTRS = 0x0080000, /* userspace function ptrs point to descriptors 27 FDPIC_FUNCPTRS = 0x0080000, /* userspace function ptrs point to descriptors
27 * (signal handling) 28 * (signal handling)
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 7da5fa84595..79f337c4738 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -26,7 +26,7 @@
26#include <linux/workqueue.h> 26#include <linux/workqueue.h>
27#include <linux/mod_devicetable.h> 27#include <linux/mod_devicetable.h>
28 28
29#include <asm/atomic.h> 29#include <linux/atomic.h>
30 30
31#define PHY_BASIC_FEATURES (SUPPORTED_10baseT_Half | \ 31#define PHY_BASIC_FEATURES (SUPPORTED_10baseT_Half | \
32 SUPPORTED_10baseT_Full | \ 32 SUPPORTED_10baseT_Full | \
@@ -53,6 +53,7 @@
53 53
54/* Interface Mode definitions */ 54/* Interface Mode definitions */
55typedef enum { 55typedef enum {
56 PHY_INTERFACE_MODE_NA,
56 PHY_INTERFACE_MODE_MII, 57 PHY_INTERFACE_MODE_MII,
57 PHY_INTERFACE_MODE_GMII, 58 PHY_INTERFACE_MODE_GMII,
58 PHY_INTERFACE_MODE_SGMII, 59 PHY_INTERFACE_MODE_SGMII,
@@ -62,7 +63,8 @@ typedef enum {
62 PHY_INTERFACE_MODE_RGMII_ID, 63 PHY_INTERFACE_MODE_RGMII_ID,
63 PHY_INTERFACE_MODE_RGMII_RXID, 64 PHY_INTERFACE_MODE_RGMII_RXID,
64 PHY_INTERFACE_MODE_RGMII_TXID, 65 PHY_INTERFACE_MODE_RGMII_TXID,
65 PHY_INTERFACE_MODE_RTBI 66 PHY_INTERFACE_MODE_RTBI,
67 PHY_INTERFACE_MODE_SMII,
66} phy_interface_t; 68} phy_interface_t;
67 69
68 70
@@ -418,7 +420,7 @@ struct phy_driver {
418 420
419 /* 421 /*
420 * Requests a Tx timestamp for 'skb'. The phy driver promises 422 * Requests a Tx timestamp for 'skb'. The phy driver promises
421 * to deliver it to the socket's error queue as soon as a 423 * to deliver it using skb_complete_tx_timestamp() as soon as a
422 * timestamp becomes available. One of the PTP_CLASS_ values 424 * timestamp becomes available. One of the PTP_CLASS_ values
423 * is passed in 'type'. 425 * is passed in 'type'.
424 */ 426 */
diff --git a/include/linux/platform_data/fsa9480.h b/include/linux/platform_data/fsa9480.h
new file mode 100644
index 00000000000..72dddcb4bed
--- /dev/null
+++ b/include/linux/platform_data/fsa9480.h
@@ -0,0 +1,27 @@
1/*
2 * Copyright (C) 2010 Samsung Electronics
3 * Minkyu Kang <mk7.kang@samsung.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 */
9
10#ifndef _FSA9480_H_
11#define _FSA9480_H_
12
13#define FSA9480_ATTACHED 1
14#define FSA9480_DETACHED 0
15
16struct fsa9480_platform_data {
17 void (*cfg_gpio) (void);
18 void (*usb_cb) (u8 attached);
19 void (*uart_cb) (u8 attached);
20 void (*charger_cb) (u8 attached);
21 void (*jig_cb) (u8 attached);
22 void (*reset_cb) (void);
23 void (*usb_power) (u8 on);
24 int wakeup;
25};
26
27#endif /* _FSA9480_H_ */
diff --git a/include/linux/platform_data/ina230.h b/include/linux/platform_data/ina230.h
new file mode 100644
index 00000000000..fb1ac28ff62
--- /dev/null
+++ b/include/linux/platform_data/ina230.h
@@ -0,0 +1,32 @@
1/*
2 * include/linux/platform_data/ina230.h
3 *
4 * Copyright (c) 2011, NVIDIA Corporation.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 */
19
20#ifndef _INA230_H
21#define _INA230_H
22
23#include <linux/types.h>
24
25struct ina230_platform_data {
26 const char *rail_name;
27 s32 current_threshold;
28 s32 resistor;
29 s32 min_cores_online;
30};
31
32#endif /* _INA230_H */
diff --git a/include/linux/platform_data/ntc_thermistor.h b/include/linux/platform_data/ntc_thermistor.h
new file mode 100644
index 00000000000..abd28621527
--- /dev/null
+++ b/include/linux/platform_data/ntc_thermistor.h
@@ -0,0 +1,53 @@
1/*
2 * ntc_thermistor.h - NTC Thermistors
3 *
4 * Copyright (C) 2010 Samsung Electronics
5 * MyungJoo Ham <myungjoo.ham@samsung.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21#ifndef _LINUX_NTC_H
22#define _LINUX_NTC_H
23
24enum ntc_thermistor_type {
25 TYPE_NCPXXWB473,
26 TYPE_NCPXXWL333,
27};
28
29struct ntc_thermistor_platform_data {
30 /*
31 * One (not both) of read_uV and read_ohm should be provided and only
32 * one of the two should be provided.
33 * Both functions should return negative value for an error case.
34 *
35 * pullup_uV, pullup_ohm, pulldown_ohm, and connect are required to use
36 * read_uV()
37 *
38 * How to setup pullup_ohm, pulldown_ohm, and connect is
39 * described at Documentation/hwmon/ntc
40 *
41 * pullup/down_ohm: 0 for infinite / not-connected
42 */
43 int (*read_uV)(void);
44 unsigned int pullup_uV;
45
46 unsigned int pullup_ohm;
47 unsigned int pulldown_ohm;
48 enum { NTC_CONNECTED_POSITIVE, NTC_CONNECTED_GROUND } connect;
49
50 int (*read_ohm)(void);
51};
52
53#endif /* _LINUX_NTC_H */
diff --git a/include/linux/platform_data/pxa_sdhci.h b/include/linux/platform_data/pxa_sdhci.h
new file mode 100644
index 00000000000..51ad0995aba
--- /dev/null
+++ b/include/linux/platform_data/pxa_sdhci.h
@@ -0,0 +1,60 @@
1/*
2 * include/linux/platform_data/pxa_sdhci.h
3 *
4 * Copyright 2010 Marvell
5 * Zhangfei Gao <zhangfei.gao@marvell.com>
6 *
7 * PXA Platform - SDHCI platform data definitions
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13
14#ifndef _PXA_SDHCI_H_
15#define _PXA_SDHCI_H_
16
17/* pxa specific flag */
18/* Require clock free running */
19#define PXA_FLAG_ENABLE_CLOCK_GATING (1<<0)
20/* card always wired to host, like on-chip emmc */
21#define PXA_FLAG_CARD_PERMANENT (1<<1)
22/* Board design supports 8-bit data on SD/SDIO BUS */
23#define PXA_FLAG_SD_8_BIT_CAPABLE_SLOT (1<<2)
24
25/*
26 * struct pxa_sdhci_platdata() - Platform device data for PXA SDHCI
27 * @flags: flags for platform requirement
28 * @clk_delay_cycles:
29 * mmp2: each step is roughly 100ps, 5bits width
30 * pxa910: each step is 1ns, 4bits width
31 * @clk_delay_sel: select clk_delay, used on pxa910
32 * 0: choose feedback clk
33 * 1: choose feedback clk + delay value
34 * 2: choose internal clk
35 * @clk_delay_enable: enable clk_delay or not, used on pxa910
36 * @ext_cd_gpio: gpio pin used for external CD line
37 * @ext_cd_gpio_invert: invert values for external CD gpio line
38 * @max_speed: the maximum speed supported
39 * @host_caps: Standard MMC host capabilities bit field.
40 * @quirks: quirks of platfrom
41 * @pm_caps: pm_caps of platfrom
42 */
43struct sdhci_pxa_platdata {
44 unsigned int flags;
45 unsigned int clk_delay_cycles;
46 unsigned int clk_delay_sel;
47 bool clk_delay_enable;
48 unsigned int ext_cd_gpio;
49 bool ext_cd_gpio_invert;
50 unsigned int max_speed;
51 unsigned int host_caps;
52 unsigned int quirks;
53 unsigned int pm_caps;
54};
55
56struct sdhci_pxa {
57 u8 clk_enable;
58 u8 power_mode;
59};
60#endif /* _PXA_SDHCI_H_ */
diff --git a/include/linux/platform_data/ram_console.h b/include/linux/platform_data/ram_console.h
new file mode 100644
index 00000000000..9f1125c1106
--- /dev/null
+++ b/include/linux/platform_data/ram_console.h
@@ -0,0 +1,22 @@
1/*
2 * Copyright (C) 2010 Google, Inc.
3 *
4 * This software is licensed under the terms of the GNU General Public
5 * License version 2, as published by the Free Software Foundation, and
6 * may be copied, distributed, and modified under those terms.
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 */
14
15#ifndef _INCLUDE_LINUX_PLATFORM_DATA_RAM_CONSOLE_H_
16#define _INCLUDE_LINUX_PLATFORM_DATA_RAM_CONSOLE_H_
17
18struct ram_console_platform_data {
19 const char *bootinfo;
20};
21
22#endif /* _INCLUDE_LINUX_PLATFORM_DATA_RAM_CONSOLE_H_ */
diff --git a/include/linux/platform_data/tegra_bpc_mgmt.h b/include/linux/platform_data/tegra_bpc_mgmt.h
new file mode 100644
index 00000000000..bdd4862d63a
--- /dev/null
+++ b/include/linux/platform_data/tegra_bpc_mgmt.h
@@ -0,0 +1,25 @@
1/*
2 * Copyright (C) 2010-2011 NVIDIA Corporation
3 *
4 * This software is licensed under the terms of the GNU General Public
5 * License version 2, as published by the Free Software Foundation, and
6 * may be copied, distributed, and modified under those terms.
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 */
14
15#ifndef __TEGRA_BPC_MGMT_H
16#define __TEGRA_BPC_MGMT_H
17#include <linux/cpumask.h>
18
19struct tegra_bpc_mgmt_platform_data {
20 int gpio_trigger;
21 struct cpumask affinity_mask;
22 int bpc_mgmt_timeout;
23};
24
25#endif /*__TEGRA_BPC_MGMT_H*/
diff --git a/include/linux/platform_data/tegra_nor.h b/include/linux/platform_data/tegra_nor.h
new file mode 100644
index 00000000000..cd8faff2f1c
--- /dev/null
+++ b/include/linux/platform_data/tegra_nor.h
@@ -0,0 +1,37 @@
1/*
2 * include/linux/platform_data/tegra_nor.h
3 *
4 * Copyright (C) 2010 - 2011 NVIDIA Corporation.
5 *
6 * Author:
7 * Raghavendra V K <rvk@nvidia.com>
8 *
9 * This software is licensed under the terms of the GNU General Public
10 * License version 2, as published by the Free Software Foundation, and
11 * may be copied, distributed, and modified under those terms.
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 */
19
20#ifndef __MACH_TEGRA_NOR_PDATA_H
21#define __MACH_TEGRA_NOR_PDATA_H
22
23#include <asm/mach/flash.h>
24
25struct tegra_nor_chip_parms {
26 struct {
27 uint32_t timing0;
28 uint32_t timing1;
29 } timing_default, timing_read;
30};
31
32struct tegra_nor_platform_data {
33 struct tegra_nor_chip_parms chip_parms;
34 struct flash_platform_data flash;
35};
36
37#endif /* __MACH_TEGRA_NOR_PDATA_H */
diff --git a/include/linux/platform_data/tegra_usb.h b/include/linux/platform_data/tegra_usb.h
index 6bca5b569ac..e6377c379b4 100644
--- a/include/linux/platform_data/tegra_usb.h
+++ b/include/linux/platform_data/tegra_usb.h
@@ -1,5 +1,6 @@
1/* 1/*
2 * Copyright (C) 2010 Google, Inc. 2 * Copyright (C) 2010 Google, Inc.
3 * Copyright (C) 2010-2011 NVIDIA Corporation
3 * 4 *
4 * This software is licensed under the terms of the GNU General Public 5 * This software is licensed under the terms of the GNU General Public
5 * License version 2, as published by the Free Software Foundation, and 6 * License version 2, as published by the Free Software Foundation, and
@@ -21,11 +22,27 @@ enum tegra_usb_operating_modes {
21 TEGRA_USB_OTG, 22 TEGRA_USB_OTG,
22}; 23};
23 24
25enum tegra_usb_phy_type {
26 TEGRA_USB_PHY_TYPE_UTMIP = 0,
27 TEGRA_USB_PHY_TYPE_LINK_ULPI = 1,
28 TEGRA_USB_PHY_TYPE_NULL_ULPI = 2,
29 TEGRA_USB_PHY_TYPE_HSIC = 3,
30 TEGRA_USB_PHY_TYPE_ICUSB = 4,
31};
32
24struct tegra_ehci_platform_data { 33struct tegra_ehci_platform_data {
25 enum tegra_usb_operating_modes operating_mode; 34 enum tegra_usb_operating_modes operating_mode;
26 /* power down the phy on bus suspend */ 35 /* power down the phy on bus suspend */
27 int power_down_on_bus_suspend; 36 int power_down_on_bus_suspend;
37 int hotplug;
38 int default_enable;
28 void *phy_config; 39 void *phy_config;
40 enum tegra_usb_phy_type phy_type;
41};
42
43struct tegra_otg_platform_data {
44 struct platform_device *ehci_device;
45 struct tegra_ehci_platform_data *ehci_pdata;
29}; 46};
30 47
31#endif /* _TEGRA_USB_H_ */ 48#endif /* _TEGRA_USB_H_ */
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index ede1a80e335..27bb05aae70 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -42,6 +42,7 @@ extern void platform_device_unregister(struct platform_device *);
42extern struct bus_type platform_bus_type; 42extern struct bus_type platform_bus_type;
43extern struct device platform_bus; 43extern struct device platform_bus;
44 44
45extern void arch_setup_pdev_archdata(struct platform_device *);
45extern struct resource *platform_get_resource(struct platform_device *, unsigned int, unsigned int); 46extern struct resource *platform_get_resource(struct platform_device *, unsigned int, unsigned int);
46extern int platform_get_irq(struct platform_device *, unsigned int); 47extern int platform_get_irq(struct platform_device *, unsigned int);
47extern struct resource *platform_get_resource_byname(struct platform_device *, unsigned int, const char *); 48extern struct resource *platform_get_resource_byname(struct platform_device *, unsigned int, const char *);
diff --git a/include/linux/plist.h b/include/linux/plist.h
index c9b9f322c8d..aa0fb390bd2 100644
--- a/include/linux/plist.h
+++ b/include/linux/plist.h
@@ -77,14 +77,9 @@
77 77
78#include <linux/kernel.h> 78#include <linux/kernel.h>
79#include <linux/list.h> 79#include <linux/list.h>
80#include <linux/spinlock_types.h>
81 80
82struct plist_head { 81struct plist_head {
83 struct list_head node_list; 82 struct list_head node_list;
84#ifdef CONFIG_DEBUG_PI_LIST
85 raw_spinlock_t *rawlock;
86 spinlock_t *spinlock;
87#endif
88}; 83};
89 84
90struct plist_node { 85struct plist_node {
@@ -93,37 +88,13 @@ struct plist_node {
93 struct list_head node_list; 88 struct list_head node_list;
94}; 89};
95 90
96#ifdef CONFIG_DEBUG_PI_LIST
97# define PLIST_HEAD_LOCK_INIT(_lock) .spinlock = _lock
98# define PLIST_HEAD_LOCK_INIT_RAW(_lock) .rawlock = _lock
99#else
100# define PLIST_HEAD_LOCK_INIT(_lock)
101# define PLIST_HEAD_LOCK_INIT_RAW(_lock)
102#endif
103
104#define _PLIST_HEAD_INIT(head) \
105 .node_list = LIST_HEAD_INIT((head).node_list)
106
107/** 91/**
108 * PLIST_HEAD_INIT - static struct plist_head initializer 92 * PLIST_HEAD_INIT - static struct plist_head initializer
109 * @head: struct plist_head variable name 93 * @head: struct plist_head variable name
110 * @_lock: lock to initialize for this list
111 */
112#define PLIST_HEAD_INIT(head, _lock) \
113{ \
114 _PLIST_HEAD_INIT(head), \
115 PLIST_HEAD_LOCK_INIT(&(_lock)) \
116}
117
118/**
119 * PLIST_HEAD_INIT_RAW - static struct plist_head initializer
120 * @head: struct plist_head variable name
121 * @_lock: lock to initialize for this list
122 */ 94 */
123#define PLIST_HEAD_INIT_RAW(head, _lock) \ 95#define PLIST_HEAD_INIT(head) \
124{ \ 96{ \
125 _PLIST_HEAD_INIT(head), \ 97 .node_list = LIST_HEAD_INIT((head).node_list) \
126 PLIST_HEAD_LOCK_INIT_RAW(&(_lock)) \
127} 98}
128 99
129/** 100/**
@@ -141,31 +112,11 @@ struct plist_node {
141/** 112/**
142 * plist_head_init - dynamic struct plist_head initializer 113 * plist_head_init - dynamic struct plist_head initializer
143 * @head: &struct plist_head pointer 114 * @head: &struct plist_head pointer
144 * @lock: spinlock protecting the list (debugging)
145 */ 115 */
146static inline void 116static inline void
147plist_head_init(struct plist_head *head, spinlock_t *lock) 117plist_head_init(struct plist_head *head)
148{ 118{
149 INIT_LIST_HEAD(&head->node_list); 119 INIT_LIST_HEAD(&head->node_list);
150#ifdef CONFIG_DEBUG_PI_LIST
151 head->spinlock = lock;
152 head->rawlock = NULL;
153#endif
154}
155
156/**
157 * plist_head_init_raw - dynamic struct plist_head initializer
158 * @head: &struct plist_head pointer
159 * @lock: raw_spinlock protecting the list (debugging)
160 */
161static inline void
162plist_head_init_raw(struct plist_head *head, raw_spinlock_t *lock)
163{
164 INIT_LIST_HEAD(&head->node_list);
165#ifdef CONFIG_DEBUG_PI_LIST
166 head->rawlock = lock;
167 head->spinlock = NULL;
168#endif
169} 120}
170 121
171/** 122/**
diff --git a/include/linux/pm.h b/include/linux/pm.h
index 411e4f4be52..f7c84c9abd3 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -461,8 +461,8 @@ struct dev_pm_info {
461 unsigned long active_jiffies; 461 unsigned long active_jiffies;
462 unsigned long suspended_jiffies; 462 unsigned long suspended_jiffies;
463 unsigned long accounting_timestamp; 463 unsigned long accounting_timestamp;
464 void *subsys_data; /* Owned by the subsystem. */
465#endif 464#endif
465 void *subsys_data; /* Owned by the subsystem. */
466}; 466};
467 467
468extern void update_pm_runtime_accounting(struct device *dev); 468extern void update_pm_runtime_accounting(struct device *dev);
@@ -472,7 +472,7 @@ extern void update_pm_runtime_accounting(struct device *dev);
472 * hibernation, system resume and during runtime PM transitions along with 472 * hibernation, system resume and during runtime PM transitions along with
473 * subsystem-level and driver-level callbacks. 473 * subsystem-level and driver-level callbacks.
474 */ 474 */
475struct dev_power_domain { 475struct dev_pm_domain {
476 struct dev_pm_ops ops; 476 struct dev_pm_ops ops;
477}; 477};
478 478
@@ -553,11 +553,17 @@ extern void __suspend_report_result(const char *function, void *fn, int ret);
553extern int device_pm_wait_for_dev(struct device *sub, struct device *dev); 553extern int device_pm_wait_for_dev(struct device *sub, struct device *dev);
554 554
555extern int pm_generic_prepare(struct device *dev); 555extern int pm_generic_prepare(struct device *dev);
556extern int pm_generic_suspend_noirq(struct device *dev);
556extern int pm_generic_suspend(struct device *dev); 557extern int pm_generic_suspend(struct device *dev);
558extern int pm_generic_resume_noirq(struct device *dev);
557extern int pm_generic_resume(struct device *dev); 559extern int pm_generic_resume(struct device *dev);
560extern int pm_generic_freeze_noirq(struct device *dev);
558extern int pm_generic_freeze(struct device *dev); 561extern int pm_generic_freeze(struct device *dev);
562extern int pm_generic_thaw_noirq(struct device *dev);
559extern int pm_generic_thaw(struct device *dev); 563extern int pm_generic_thaw(struct device *dev);
564extern int pm_generic_restore_noirq(struct device *dev);
560extern int pm_generic_restore(struct device *dev); 565extern int pm_generic_restore(struct device *dev);
566extern int pm_generic_poweroff_noirq(struct device *dev);
561extern int pm_generic_poweroff(struct device *dev); 567extern int pm_generic_poweroff(struct device *dev);
562extern void pm_generic_complete(struct device *dev); 568extern void pm_generic_complete(struct device *dev);
563 569
diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
new file mode 100644
index 00000000000..f9ec1736a11
--- /dev/null
+++ b/include/linux/pm_domain.h
@@ -0,0 +1,112 @@
1/*
2 * pm_domain.h - Definitions and headers related to device power domains.
3 *
4 * Copyright (C) 2011 Rafael J. Wysocki <rjw@sisk.pl>, Renesas Electronics Corp.
5 *
6 * This file is released under the GPLv2.
7 */
8
9#ifndef _LINUX_PM_DOMAIN_H
10#define _LINUX_PM_DOMAIN_H
11
12#include <linux/device.h>
13
14enum gpd_status {
15 GPD_STATE_ACTIVE = 0, /* PM domain is active */
16 GPD_STATE_BUSY, /* Something is happening to the PM domain */
17 GPD_STATE_REPEAT, /* Power off in progress, to be repeated */
18 GPD_STATE_POWER_OFF, /* PM domain is off */
19};
20
21struct dev_power_governor {
22 bool (*power_down_ok)(struct dev_pm_domain *domain);
23};
24
25struct generic_pm_domain {
26 struct dev_pm_domain domain; /* PM domain operations */
27 struct list_head gpd_list_node; /* Node in the global PM domains list */
28 struct list_head sd_node; /* Node in the parent's subdomain list */
29 struct generic_pm_domain *parent; /* Parent PM domain */
30 struct list_head sd_list; /* List of dubdomains */
31 struct list_head dev_list; /* List of devices */
32 struct mutex lock;
33 struct dev_power_governor *gov;
34 struct work_struct power_off_work;
35 unsigned int in_progress; /* Number of devices being suspended now */
36 unsigned int sd_count; /* Number of subdomains with power "on" */
37 enum gpd_status status; /* Current state of the domain */
38 wait_queue_head_t status_wait_queue;
39 struct task_struct *poweroff_task; /* Powering off task */
40 unsigned int resume_count; /* Number of devices being resumed */
41 unsigned int device_count; /* Number of devices */
42 unsigned int suspended_count; /* System suspend device counter */
43 unsigned int prepared_count; /* Suspend counter of prepared devices */
44 bool suspend_power_off; /* Power status before system suspend */
45 int (*power_off)(struct generic_pm_domain *domain);
46 int (*power_on)(struct generic_pm_domain *domain);
47 int (*start_device)(struct device *dev);
48 int (*stop_device)(struct device *dev);
49 bool (*active_wakeup)(struct device *dev);
50};
51
52static inline struct generic_pm_domain *pd_to_genpd(struct dev_pm_domain *pd)
53{
54 return container_of(pd, struct generic_pm_domain, domain);
55}
56
57struct dev_list_entry {
58 struct list_head node;
59 struct device *dev;
60 bool need_restore;
61};
62
63#ifdef CONFIG_PM_GENERIC_DOMAINS
64extern int pm_genpd_add_device(struct generic_pm_domain *genpd,
65 struct device *dev);
66extern int pm_genpd_remove_device(struct generic_pm_domain *genpd,
67 struct device *dev);
68extern int pm_genpd_add_subdomain(struct generic_pm_domain *genpd,
69 struct generic_pm_domain *new_subdomain);
70extern int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd,
71 struct generic_pm_domain *target);
72extern void pm_genpd_init(struct generic_pm_domain *genpd,
73 struct dev_power_governor *gov, bool is_off);
74extern int pm_genpd_poweron(struct generic_pm_domain *genpd);
75#else
76static inline int pm_genpd_add_device(struct generic_pm_domain *genpd,
77 struct device *dev)
78{
79 return -ENOSYS;
80}
81static inline int pm_genpd_remove_device(struct generic_pm_domain *genpd,
82 struct device *dev)
83{
84 return -ENOSYS;
85}
86static inline int pm_genpd_add_subdomain(struct generic_pm_domain *genpd,
87 struct generic_pm_domain *new_sd)
88{
89 return -ENOSYS;
90}
91static inline int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd,
92 struct generic_pm_domain *target)
93{
94 return -ENOSYS;
95}
96static inline void pm_genpd_init(struct generic_pm_domain *genpd,
97 struct dev_power_governor *gov, bool is_off) {}
98static inline int pm_genpd_poweron(struct generic_pm_domain *genpd)
99{
100 return -ENOSYS;
101}
102#endif
103
104#ifdef CONFIG_PM_GENERIC_DOMAINS_RUNTIME
105extern void genpd_queue_power_off_work(struct generic_pm_domain *genpd);
106extern void pm_genpd_poweroff_unused(void);
107#else
108static inline void genpd_queue_power_off_work(struct generic_pm_domain *gpd) {}
109static inline void pm_genpd_poweroff_unused(void) {}
110#endif
111
112#endif /* _LINUX_PM_DOMAIN_H */
diff --git a/include/linux/pm_qos_params.h b/include/linux/pm_qos_params.h
index a7d87f911ca..5a536cbb25b 100644
--- a/include/linux/pm_qos_params.h
+++ b/include/linux/pm_qos_params.h
@@ -8,17 +8,30 @@
8#include <linux/notifier.h> 8#include <linux/notifier.h>
9#include <linux/miscdevice.h> 9#include <linux/miscdevice.h>
10 10
11#define PM_QOS_RESERVED 0 11enum {
12#define PM_QOS_CPU_DMA_LATENCY 1 12 PM_QOS_RESERVED = 0,
13#define PM_QOS_NETWORK_LATENCY 2 13 PM_QOS_CPU_DMA_LATENCY,
14#define PM_QOS_NETWORK_THROUGHPUT 3 14 PM_QOS_NETWORK_LATENCY,
15 PM_QOS_NETWORK_THROUGHPUT,
16 PM_QOS_MIN_ONLINE_CPUS,
17 PM_QOS_MAX_ONLINE_CPUS,
18 PM_QOS_CPU_FREQ_MIN,
19 PM_QOS_CPU_FREQ_MAX,
20
21 /* insert new class ID */
22
23 PM_QOS_NUM_CLASSES,
24};
15 25
16#define PM_QOS_NUM_CLASSES 4
17#define PM_QOS_DEFAULT_VALUE -1 26#define PM_QOS_DEFAULT_VALUE -1
18 27
19#define PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC) 28#define PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC)
20#define PM_QOS_NETWORK_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC) 29#define PM_QOS_NETWORK_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC)
21#define PM_QOS_NETWORK_THROUGHPUT_DEFAULT_VALUE 0 30#define PM_QOS_NETWORK_THROUGHPUT_DEFAULT_VALUE 0
31#define PM_QOS_MIN_ONLINE_CPUS_DEFAULT_VALUE 1
32#define PM_QOS_MAX_ONLINE_CPUS_DEFAULT_VALUE LONG_MAX
33#define PM_QOS_CPU_FREQ_MIN_DEFAULT_VALUE 0
34#define PM_QOS_CPU_FREQ_MAX_DEFAULT_VALUE LONG_MAX
22 35
23struct pm_qos_request_list { 36struct pm_qos_request_list {
24 struct plist_node list; 37 struct plist_node list;
diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h
index 878cf84baeb..daac05d751b 100644
--- a/include/linux/pm_runtime.h
+++ b/include/linux/pm_runtime.h
@@ -82,6 +82,11 @@ static inline bool pm_runtime_suspended(struct device *dev)
82 && !dev->power.disable_depth; 82 && !dev->power.disable_depth;
83} 83}
84 84
85static inline bool pm_runtime_status_suspended(struct device *dev)
86{
87 return dev->power.runtime_status == RPM_SUSPENDED;
88}
89
85static inline bool pm_runtime_enabled(struct device *dev) 90static inline bool pm_runtime_enabled(struct device *dev)
86{ 91{
87 return !dev->power.disable_depth; 92 return !dev->power.disable_depth;
@@ -130,6 +135,7 @@ static inline void pm_runtime_put_noidle(struct device *dev) {}
130static inline bool device_run_wake(struct device *dev) { return false; } 135static inline bool device_run_wake(struct device *dev) { return false; }
131static inline void device_set_run_wake(struct device *dev, bool enable) {} 136static inline void device_set_run_wake(struct device *dev, bool enable) {}
132static inline bool pm_runtime_suspended(struct device *dev) { return false; } 137static inline bool pm_runtime_suspended(struct device *dev) { return false; }
138static inline bool pm_runtime_status_suspended(struct device *dev) { return false; }
133static inline bool pm_runtime_enabled(struct device *dev) { return false; } 139static inline bool pm_runtime_enabled(struct device *dev) { return false; }
134 140
135static inline int pm_generic_runtime_idle(struct device *dev) { return 0; } 141static inline int pm_generic_runtime_idle(struct device *dev) { return 0; }
@@ -247,41 +253,41 @@ static inline void pm_runtime_dont_use_autosuspend(struct device *dev)
247 253
248struct pm_clk_notifier_block { 254struct pm_clk_notifier_block {
249 struct notifier_block nb; 255 struct notifier_block nb;
250 struct dev_power_domain *pwr_domain; 256 struct dev_pm_domain *pm_domain;
251 char *con_ids[]; 257 char *con_ids[];
252}; 258};
253 259
254#ifdef CONFIG_PM_RUNTIME_CLK 260#ifdef CONFIG_PM_CLK
255extern int pm_runtime_clk_init(struct device *dev); 261extern int pm_clk_init(struct device *dev);
256extern void pm_runtime_clk_destroy(struct device *dev); 262extern void pm_clk_destroy(struct device *dev);
257extern int pm_runtime_clk_add(struct device *dev, const char *con_id); 263extern int pm_clk_add(struct device *dev, const char *con_id);
258extern void pm_runtime_clk_remove(struct device *dev, const char *con_id); 264extern void pm_clk_remove(struct device *dev, const char *con_id);
259extern int pm_runtime_clk_suspend(struct device *dev); 265extern int pm_clk_suspend(struct device *dev);
260extern int pm_runtime_clk_resume(struct device *dev); 266extern int pm_clk_resume(struct device *dev);
261#else 267#else
262static inline int pm_runtime_clk_init(struct device *dev) 268static inline int pm_clk_init(struct device *dev)
263{ 269{
264 return -EINVAL; 270 return -EINVAL;
265} 271}
266static inline void pm_runtime_clk_destroy(struct device *dev) 272static inline void pm_clk_destroy(struct device *dev)
267{ 273{
268} 274}
269static inline int pm_runtime_clk_add(struct device *dev, const char *con_id) 275static inline int pm_clk_add(struct device *dev, const char *con_id)
270{ 276{
271 return -EINVAL; 277 return -EINVAL;
272} 278}
273static inline void pm_runtime_clk_remove(struct device *dev, const char *con_id) 279static inline void pm_clk_remove(struct device *dev, const char *con_id)
274{ 280{
275} 281}
276#define pm_runtime_clock_suspend NULL 282#define pm_clk_suspend NULL
277#define pm_runtime_clock_resume NULL 283#define pm_clk_resume NULL
278#endif 284#endif
279 285
280#ifdef CONFIG_HAVE_CLK 286#ifdef CONFIG_HAVE_CLK
281extern void pm_runtime_clk_add_notifier(struct bus_type *bus, 287extern void pm_clk_add_notifier(struct bus_type *bus,
282 struct pm_clk_notifier_block *clknb); 288 struct pm_clk_notifier_block *clknb);
283#else 289#else
284static inline void pm_runtime_clk_add_notifier(struct bus_type *bus, 290static inline void pm_clk_add_notifier(struct bus_type *bus,
285 struct pm_clk_notifier_block *clknb) 291 struct pm_clk_notifier_block *clknb)
286{ 292{
287} 293}
diff --git a/include/linux/pnfs_osd_xdr.h b/include/linux/pnfs_osd_xdr.h
index 76efbdd0162..435dd5fa745 100644
--- a/include/linux/pnfs_osd_xdr.h
+++ b/include/linux/pnfs_osd_xdr.h
@@ -41,9 +41,6 @@
41 41
42#include <linux/nfs_fs.h> 42#include <linux/nfs_fs.h>
43#include <linux/nfs_page.h> 43#include <linux/nfs_page.h>
44#include <scsi/osd_protocol.h>
45
46#define PNFS_OSD_OSDNAME_MAXSIZE 256
47 44
48/* 45/*
49 * draft-ietf-nfsv4-minorversion-22 46 * draft-ietf-nfsv4-minorversion-22
@@ -99,12 +96,6 @@ struct pnfs_osd_objid {
99#define _DEVID_HI(oid_device_id) \ 96#define _DEVID_HI(oid_device_id) \
100 (unsigned long long)be64_to_cpup(((__be64 *)(oid_device_id)->data) + 1) 97 (unsigned long long)be64_to_cpup(((__be64 *)(oid_device_id)->data) + 1)
101 98
102static inline int
103pnfs_osd_objid_xdr_sz(void)
104{
105 return (NFS4_DEVICEID4_SIZE / 4) + 2 + 2;
106}
107
108enum pnfs_osd_version { 99enum pnfs_osd_version {
109 PNFS_OSD_MISSING = 0, 100 PNFS_OSD_MISSING = 0,
110 PNFS_OSD_VERSION_1 = 1, 101 PNFS_OSD_VERSION_1 = 1,
@@ -189,8 +180,6 @@ struct pnfs_osd_targetid {
189 struct nfs4_string oti_scsi_device_id; 180 struct nfs4_string oti_scsi_device_id;
190}; 181};
191 182
192enum { PNFS_OSD_TARGETID_MAX = 1 + PNFS_OSD_OSDNAME_MAXSIZE / 4 };
193
194/* struct netaddr4 { 183/* struct netaddr4 {
195 * // see struct rpcb in RFC1833 184 * // see struct rpcb in RFC1833
196 * string r_netid<>; // network id 185 * string r_netid<>; // network id
@@ -207,12 +196,6 @@ struct pnfs_osd_targetaddr {
207 struct pnfs_osd_net_addr ota_netaddr; 196 struct pnfs_osd_net_addr ota_netaddr;
208}; 197};
209 198
210enum {
211 NETWORK_ID_MAX = 16 / 4,
212 UNIVERSAL_ADDRESS_MAX = 64 / 4,
213 PNFS_OSD_TARGETADDR_MAX = 3 + NETWORK_ID_MAX + UNIVERSAL_ADDRESS_MAX,
214};
215
216struct pnfs_osd_deviceaddr { 199struct pnfs_osd_deviceaddr {
217 struct pnfs_osd_targetid oda_targetid; 200 struct pnfs_osd_targetid oda_targetid;
218 struct pnfs_osd_targetaddr oda_targetaddr; 201 struct pnfs_osd_targetaddr oda_targetaddr;
@@ -222,15 +205,6 @@ struct pnfs_osd_deviceaddr {
222 struct nfs4_string oda_osdname; 205 struct nfs4_string oda_osdname;
223}; 206};
224 207
225enum {
226 ODA_OSDNAME_MAX = PNFS_OSD_OSDNAME_MAXSIZE / 4,
227 PNFS_OSD_DEVICEADDR_MAX =
228 PNFS_OSD_TARGETID_MAX + PNFS_OSD_TARGETADDR_MAX +
229 2 /*oda_lun*/ +
230 1 + OSD_SYSTEMID_LEN +
231 1 + ODA_OSDNAME_MAX,
232};
233
234/* LAYOUTCOMMIT: layoutupdate */ 208/* LAYOUTCOMMIT: layoutupdate */
235 209
236/* union pnfs_osd_deltaspaceused4 switch (bool dsu_valid) { 210/* union pnfs_osd_deltaspaceused4 switch (bool dsu_valid) {
@@ -279,7 +253,7 @@ struct pnfs_osd_ioerr {
279 u32 oer_errno; 253 u32 oer_errno;
280}; 254};
281 255
282/* OSD XDR API */ 256/* OSD XDR Client API */
283/* Layout helpers */ 257/* Layout helpers */
284/* Layout decoding is done in two parts: 258/* Layout decoding is done in two parts:
285 * 1. First Call pnfs_osd_xdr_decode_layout_map to read in only the header part 259 * 1. First Call pnfs_osd_xdr_decode_layout_map to read in only the header part
@@ -337,8 +311,7 @@ extern int
337pnfs_osd_xdr_encode_layoutupdate(struct xdr_stream *xdr, 311pnfs_osd_xdr_encode_layoutupdate(struct xdr_stream *xdr,
338 struct pnfs_osd_layoutupdate *lou); 312 struct pnfs_osd_layoutupdate *lou);
339 313
340/* osd_ioerror encoding/decoding (layout_return) */ 314/* osd_ioerror encoding (layout_return) */
341/* Client */
342extern __be32 *pnfs_osd_xdr_ioerr_reserve_space(struct xdr_stream *xdr); 315extern __be32 *pnfs_osd_xdr_ioerr_reserve_space(struct xdr_stream *xdr);
343extern void pnfs_osd_xdr_encode_ioerr(__be32 *p, struct pnfs_osd_ioerr *ioerr); 316extern void pnfs_osd_xdr_encode_ioerr(__be32 *p, struct pnfs_osd_ioerr *ioerr);
344 317
diff --git a/include/linux/pnp.h b/include/linux/pnp.h
index 1bc1338b817..195aafc6cd0 100644
--- a/include/linux/pnp.h
+++ b/include/linux/pnp.h
@@ -50,7 +50,7 @@ static inline resource_size_t pnp_resource_len(struct resource *res)
50{ 50{
51 if (res->start == 0 && res->end == 0) 51 if (res->start == 0 && res->end == 0)
52 return 0; 52 return 0;
53 return res->end - res->start + 1; 53 return resource_size(res);
54} 54}
55 55
56 56
diff --git a/include/linux/poison.h b/include/linux/poison.h
index 2110a81c5e2..79159de0e34 100644
--- a/include/linux/poison.h
+++ b/include/linux/poison.h
@@ -40,6 +40,12 @@
40#define RED_INACTIVE 0x09F911029D74E35BULL /* when obj is inactive */ 40#define RED_INACTIVE 0x09F911029D74E35BULL /* when obj is inactive */
41#define RED_ACTIVE 0xD84156C5635688C0ULL /* when obj is active */ 41#define RED_ACTIVE 0xD84156C5635688C0ULL /* when obj is active */
42 42
43#ifdef CONFIG_PHYS_ADDR_T_64BIT
44#define MEMBLOCK_INACTIVE 0x3a84fb0144c9e71bULL
45#else
46#define MEMBLOCK_INACTIVE 0x44c9e71bUL
47#endif
48
43#define SLUB_RED_INACTIVE 0xbb 49#define SLUB_RED_INACTIVE 0xbb
44#define SLUB_RED_ACTIVE 0xcc 50#define SLUB_RED_ACTIVE 0xcc
45 51
diff --git a/include/linux/posix_acl.h b/include/linux/posix_acl.h
index 54211c1cd92..b7681102a4b 100644
--- a/include/linux/posix_acl.h
+++ b/include/linux/posix_acl.h
@@ -9,6 +9,7 @@
9#define __LINUX_POSIX_ACL_H 9#define __LINUX_POSIX_ACL_H
10 10
11#include <linux/slab.h> 11#include <linux/slab.h>
12#include <linux/rcupdate.h>
12 13
13#define ACL_UNDEFINED_ID (-1) 14#define ACL_UNDEFINED_ID (-1)
14 15
@@ -38,7 +39,10 @@ struct posix_acl_entry {
38}; 39};
39 40
40struct posix_acl { 41struct posix_acl {
41 atomic_t a_refcount; 42 union {
43 atomic_t a_refcount;
44 struct rcu_head a_rcu;
45 };
42 unsigned int a_count; 46 unsigned int a_count;
43 struct posix_acl_entry a_entries[0]; 47 struct posix_acl_entry a_entries[0];
44}; 48};
@@ -65,7 +69,7 @@ static inline void
65posix_acl_release(struct posix_acl *acl) 69posix_acl_release(struct posix_acl *acl)
66{ 70{
67 if (acl && atomic_dec_and_test(&acl->a_refcount)) 71 if (acl && atomic_dec_and_test(&acl->a_refcount))
68 kfree(acl); 72 kfree_rcu(acl, a_rcu);
69} 73}
70 74
71 75
@@ -73,32 +77,33 @@ posix_acl_release(struct posix_acl *acl)
73 77
74extern void posix_acl_init(struct posix_acl *, int); 78extern void posix_acl_init(struct posix_acl *, int);
75extern struct posix_acl *posix_acl_alloc(int, gfp_t); 79extern struct posix_acl *posix_acl_alloc(int, gfp_t);
76extern struct posix_acl *posix_acl_clone(const struct posix_acl *, gfp_t);
77extern int posix_acl_valid(const struct posix_acl *); 80extern int posix_acl_valid(const struct posix_acl *);
78extern int posix_acl_permission(struct inode *, const struct posix_acl *, int); 81extern int posix_acl_permission(struct inode *, const struct posix_acl *, int);
79extern struct posix_acl *posix_acl_from_mode(mode_t, gfp_t); 82extern struct posix_acl *posix_acl_from_mode(umode_t, gfp_t);
80extern int posix_acl_equiv_mode(const struct posix_acl *, mode_t *); 83extern int posix_acl_equiv_mode(const struct posix_acl *, umode_t *);
81extern int posix_acl_create_masq(struct posix_acl *, mode_t *); 84extern int posix_acl_create(struct posix_acl **, gfp_t, umode_t *);
82extern int posix_acl_chmod_masq(struct posix_acl *, mode_t); 85extern int posix_acl_chmod(struct posix_acl **, gfp_t, umode_t);
83 86
84extern struct posix_acl *get_posix_acl(struct inode *, int); 87extern struct posix_acl *get_posix_acl(struct inode *, int);
85extern int set_posix_acl(struct inode *, int, struct posix_acl *); 88extern int set_posix_acl(struct inode *, int, struct posix_acl *);
86 89
87#ifdef CONFIG_FS_POSIX_ACL 90#ifdef CONFIG_FS_POSIX_ACL
88static inline struct posix_acl *get_cached_acl(struct inode *inode, int type) 91static inline struct posix_acl **acl_by_type(struct inode *inode, int type)
89{ 92{
90 struct posix_acl **p, *acl;
91 switch (type) { 93 switch (type) {
92 case ACL_TYPE_ACCESS: 94 case ACL_TYPE_ACCESS:
93 p = &inode->i_acl; 95 return &inode->i_acl;
94 break;
95 case ACL_TYPE_DEFAULT: 96 case ACL_TYPE_DEFAULT:
96 p = &inode->i_default_acl; 97 return &inode->i_default_acl;
97 break;
98 default: 98 default:
99 return ERR_PTR(-EINVAL); 99 BUG();
100 } 100 }
101 acl = ACCESS_ONCE(*p); 101}
102
103static inline struct posix_acl *get_cached_acl(struct inode *inode, int type)
104{
105 struct posix_acl **p = acl_by_type(inode, type);
106 struct posix_acl *acl = ACCESS_ONCE(*p);
102 if (acl) { 107 if (acl) {
103 spin_lock(&inode->i_lock); 108 spin_lock(&inode->i_lock);
104 acl = *p; 109 acl = *p;
@@ -109,41 +114,20 @@ static inline struct posix_acl *get_cached_acl(struct inode *inode, int type)
109 return acl; 114 return acl;
110} 115}
111 116
112static inline int negative_cached_acl(struct inode *inode, int type) 117static inline struct posix_acl *get_cached_acl_rcu(struct inode *inode, int type)
113{ 118{
114 struct posix_acl **p, *acl; 119 return rcu_dereference(*acl_by_type(inode, type));
115 switch (type) {
116 case ACL_TYPE_ACCESS:
117 p = &inode->i_acl;
118 break;
119 case ACL_TYPE_DEFAULT:
120 p = &inode->i_default_acl;
121 break;
122 default:
123 BUG();
124 }
125 acl = ACCESS_ONCE(*p);
126 if (acl)
127 return 0;
128 return 1;
129} 120}
130 121
131static inline void set_cached_acl(struct inode *inode, 122static inline void set_cached_acl(struct inode *inode,
132 int type, 123 int type,
133 struct posix_acl *acl) 124 struct posix_acl *acl)
134{ 125{
135 struct posix_acl *old = NULL; 126 struct posix_acl **p = acl_by_type(inode, type);
127 struct posix_acl *old;
136 spin_lock(&inode->i_lock); 128 spin_lock(&inode->i_lock);
137 switch (type) { 129 old = *p;
138 case ACL_TYPE_ACCESS: 130 rcu_assign_pointer(*p, posix_acl_dup(acl));
139 old = inode->i_acl;
140 inode->i_acl = posix_acl_dup(acl);
141 break;
142 case ACL_TYPE_DEFAULT:
143 old = inode->i_default_acl;
144 inode->i_default_acl = posix_acl_dup(acl);
145 break;
146 }
147 spin_unlock(&inode->i_lock); 131 spin_unlock(&inode->i_lock);
148 if (old != ACL_NOT_CACHED) 132 if (old != ACL_NOT_CACHED)
149 posix_acl_release(old); 133 posix_acl_release(old);
@@ -151,18 +135,11 @@ static inline void set_cached_acl(struct inode *inode,
151 135
152static inline void forget_cached_acl(struct inode *inode, int type) 136static inline void forget_cached_acl(struct inode *inode, int type)
153{ 137{
154 struct posix_acl *old = NULL; 138 struct posix_acl **p = acl_by_type(inode, type);
139 struct posix_acl *old;
155 spin_lock(&inode->i_lock); 140 spin_lock(&inode->i_lock);
156 switch (type) { 141 old = *p;
157 case ACL_TYPE_ACCESS: 142 *p = ACL_NOT_CACHED;
158 old = inode->i_acl;
159 inode->i_acl = ACL_NOT_CACHED;
160 break;
161 case ACL_TYPE_DEFAULT:
162 old = inode->i_default_acl;
163 inode->i_default_acl = ACL_NOT_CACHED;
164 break;
165 }
166 spin_unlock(&inode->i_lock); 143 spin_unlock(&inode->i_lock);
167 if (old != ACL_NOT_CACHED) 144 if (old != ACL_NOT_CACHED)
168 posix_acl_release(old); 145 posix_acl_release(old);
diff --git a/include/linux/power/bq20z75.h b/include/linux/power/bq20z75.h
index b0843b68af9..1398eb004e8 100644
--- a/include/linux/power/bq20z75.h
+++ b/include/linux/power/bq20z75.h
@@ -29,11 +29,14 @@
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
33 * external change notification
32 */ 34 */
33struct bq20z75_platform_data { 35struct bq20z75_platform_data {
34 int battery_detect; 36 int battery_detect;
35 int battery_detect_present; 37 int battery_detect_present;
36 int i2c_retry_count; 38 int i2c_retry_count;
39 int poll_retry_count;
37}; 40};
38 41
39#endif 42#endif
diff --git a/include/linux/power/max17042_battery.h b/include/linux/power/max17042_battery.h
index 7995deb8bfc..fe99211fb2b 100644
--- a/include/linux/power/max17042_battery.h
+++ b/include/linux/power/max17042_battery.h
@@ -23,8 +23,99 @@
23#ifndef __MAX17042_BATTERY_H_ 23#ifndef __MAX17042_BATTERY_H_
24#define __MAX17042_BATTERY_H_ 24#define __MAX17042_BATTERY_H_
25 25
26#define MAX17042_STATUS_BattAbsent (1 << 3)
27#define MAX17042_BATTERY_FULL (100)
28#define MAX17042_DEFAULT_SNS_RESISTOR (10000)
29
30enum max17042_register {
31 MAX17042_STATUS = 0x00,
32 MAX17042_VALRT_Th = 0x01,
33 MAX17042_TALRT_Th = 0x02,
34 MAX17042_SALRT_Th = 0x03,
35 MAX17042_AtRate = 0x04,
36 MAX17042_RepCap = 0x05,
37 MAX17042_RepSOC = 0x06,
38 MAX17042_Age = 0x07,
39 MAX17042_TEMP = 0x08,
40 MAX17042_VCELL = 0x09,
41 MAX17042_Current = 0x0A,
42 MAX17042_AvgCurrent = 0x0B,
43 MAX17042_Qresidual = 0x0C,
44 MAX17042_SOC = 0x0D,
45 MAX17042_AvSOC = 0x0E,
46 MAX17042_RemCap = 0x0F,
47 MAX17402_FullCAP = 0x10,
48 MAX17042_TTE = 0x11,
49 MAX17042_V_empty = 0x12,
50
51 MAX17042_RSLOW = 0x14,
52
53 MAX17042_AvgTA = 0x16,
54 MAX17042_Cycles = 0x17,
55 MAX17042_DesignCap = 0x18,
56 MAX17042_AvgVCELL = 0x19,
57 MAX17042_MinMaxTemp = 0x1A,
58 MAX17042_MinMaxVolt = 0x1B,
59 MAX17042_MinMaxCurr = 0x1C,
60 MAX17042_CONFIG = 0x1D,
61 MAX17042_ICHGTerm = 0x1E,
62 MAX17042_AvCap = 0x1F,
63 MAX17042_ManName = 0x20,
64 MAX17042_DevName = 0x21,
65 MAX17042_DevChem = 0x22,
66
67 MAX17042_TempNom = 0x24,
68 MAX17042_TempCold = 0x25,
69 MAX17042_TempHot = 0x26,
70 MAX17042_AIN = 0x27,
71 MAX17042_LearnCFG = 0x28,
72 MAX17042_SHFTCFG = 0x29,
73 MAX17042_RelaxCFG = 0x2A,
74 MAX17042_MiscCFG = 0x2B,
75 MAX17042_TGAIN = 0x2C,
76 MAx17042_TOFF = 0x2D,
77 MAX17042_CGAIN = 0x2E,
78 MAX17042_COFF = 0x2F,
79
80 MAX17042_Q_empty = 0x33,
81 MAX17042_T_empty = 0x34,
82
83 MAX17042_RCOMP0 = 0x38,
84 MAX17042_TempCo = 0x39,
85 MAX17042_Rx = 0x3A,
86 MAX17042_T_empty0 = 0x3B,
87 MAX17042_TaskPeriod = 0x3C,
88 MAX17042_FSTAT = 0x3D,
89
90 MAX17042_SHDNTIMER = 0x3F,
91
92 MAX17042_VFRemCap = 0x4A,
93
94 MAX17042_QH = 0x4D,
95 MAX17042_QL = 0x4E,
96};
97
98/*
99 * used for setting a register to a desired value
100 * addr : address for a register
101 * data : setting value for the register
102 */
103struct max17042_reg_data {
104 u8 addr;
105 u16 data;
106};
107
26struct max17042_platform_data { 108struct max17042_platform_data {
109 struct max17042_reg_data *init_data;
110 int num_init_data; /* Number of enties in init_data array */
27 bool enable_current_sense; 111 bool enable_current_sense;
112
113 /*
114 * R_sns in micro-ohms.
115 * default 10000 (if r_sns = 0) as it is the recommended value by
116 * the datasheet although it can be changed by board designers.
117 */
118 unsigned int r_sns;
28}; 119};
29 120
30#endif /* __MAX17042_BATTERY_H_ */ 121#endif /* __MAX17042_BATTERY_H_ */
diff --git a/include/linux/power/max8907c-charger.h b/include/linux/power/max8907c-charger.h
new file mode 100644
index 00000000000..2cebad768b0
--- /dev/null
+++ b/include/linux/power/max8907c-charger.h
@@ -0,0 +1,64 @@
1/* linux/power/max8907c-charger.h
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 as
5 * published by the Free Software Foundation.
6 */
7
8#ifndef __LINUX_MAX8907C_CHARGER_H
9#define __LINUX_MAX8907C_CHARGER_H
10
11/* interrupt */
12#define MAX8907C_VCHG_OVP (1 << 0)
13#define MAX8907C_VCHG_F (1 << 1)
14#define MAX8907C_VCHG_R (1 << 2)
15#define MAX8907C_THM_OK_R (1 << 8)
16#define MAX8907C_THM_OK_F (1 << 9)
17#define MAX8907C_MBATTLOW_F (1 << 10)
18#define MAX8907C_MBATTLOW_R (1 << 11)
19#define MAX8907C_CHG_RST (1 << 12)
20#define MAX8907C_CHG_DONE (1 << 13)
21#define MAX8907C_CHG_TOPOFF (1 << 14)
22#define MAX8907C_CHK_TMR_FAULT (1 << 15)
23
24enum max8907c_charger_topoff_threshold {
25 MAX8907C_TOPOFF_5PERCENT = 0x00,
26 MAX8907C_TOPOFF_10PERCENT = 0x01,
27 MAX8907C_TOPOFF_15PERCENT = 0x02,
28 MAX8907C_TOPOFF_20PERCENT = 0x03,
29};
30
31enum max8907c_charger_restart_hysteresis {
32 MAX8907C_RESTART_100MV = 0x00,
33 MAX8907C_RESTART_150MV = 0x01,
34 MAX8907C_RESTART_200MV = 0x02,
35 MAX8907C_RESTART_FLOAT = 0x03,
36};
37
38enum max8907c_fast_charging_current {
39 MAX8907C_FASTCHARGE_90MA = 0x00,
40 MAX8907C_FASTCHARGE_300MA = 0x01,
41 MAX8907C_FASTCHARGE_460MA = 0x02,
42 MAX8907C_FASTCHARGE_600MA = 0x03,
43 MAX8907C_FASTCHARGE_700MA = 0x04,
44 MAX8907C_FASTCHARGE_800MA = 0x05,
45 MAX8907C_FASTCHARGE_900MA = 0x06,
46 MAX8907C_FASTCHARGE_1000MA = 0x07,
47};
48
49enum max8907c_fast_charger_time {
50 MAX8907C_FCHARGE_TM_8H = 0x00,
51 MAX8907C_FCHARGE_TM_12H = 0x01,
52 MAX8907C_FCHARGE_TM_16H = 0x02,
53 MAX8907C_FCHARGE_TM_OFF = 0x03,
54};
55
56struct max8907c_charger_pdata {
57 int irq;
58 enum max8907c_charger_topoff_threshold topoff_threshold;
59 enum max8907c_charger_restart_hysteresis restart_hysteresis;
60 enum max8907c_charger_restart_hysteresis fast_charging_current;
61 enum max8907c_fast_charger_time fast_charger_time;
62};
63
64#endif
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index 204c18dfdc9..2287c321413 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -14,6 +14,7 @@
14#define __LINUX_POWER_SUPPLY_H__ 14#define __LINUX_POWER_SUPPLY_H__
15 15
16#include <linux/device.h> 16#include <linux/device.h>
17#include <linux/wakelock.h>
17#include <linux/workqueue.h> 18#include <linux/workqueue.h>
18#include <linux/leds.h> 19#include <linux/leds.h>
19 20
@@ -163,6 +164,9 @@ struct power_supply {
163 /* private */ 164 /* private */
164 struct device *dev; 165 struct device *dev;
165 struct work_struct changed_work; 166 struct work_struct changed_work;
167 spinlock_t changed_lock;
168 bool changed;
169 struct wake_lock work_wake_lock;
166 170
167#ifdef CONFIG_LEDS_TRIGGERS 171#ifdef CONFIG_LEDS_TRIGGERS
168 struct led_trigger *charging_full_trig; 172 struct led_trigger *charging_full_trig;
diff --git a/include/linux/preempt.h b/include/linux/preempt.h
index 2e681d9555b..58969b2a8a8 100644
--- a/include/linux/preempt.h
+++ b/include/linux/preempt.h
@@ -27,6 +27,21 @@
27 27
28asmlinkage void preempt_schedule(void); 28asmlinkage void preempt_schedule(void);
29 29
30#define preempt_check_resched() \
31do { \
32 if (unlikely(test_thread_flag(TIF_NEED_RESCHED))) \
33 preempt_schedule(); \
34} while (0)
35
36#else /* !CONFIG_PREEMPT */
37
38#define preempt_check_resched() do { } while (0)
39
40#endif /* CONFIG_PREEMPT */
41
42
43#ifdef CONFIG_PREEMPT_COUNT
44
30#define preempt_disable() \ 45#define preempt_disable() \
31do { \ 46do { \
32 inc_preempt_count(); \ 47 inc_preempt_count(); \
@@ -39,12 +54,6 @@ do { \
39 dec_preempt_count(); \ 54 dec_preempt_count(); \
40} while (0) 55} while (0)
41 56
42#define preempt_check_resched() \
43do { \
44 if (unlikely(test_thread_flag(TIF_NEED_RESCHED))) \
45 preempt_schedule(); \
46} while (0)
47
48#define preempt_enable() \ 57#define preempt_enable() \
49do { \ 58do { \
50 preempt_enable_no_resched(); \ 59 preempt_enable_no_resched(); \
@@ -80,18 +89,17 @@ do { \
80 preempt_check_resched(); \ 89 preempt_check_resched(); \
81} while (0) 90} while (0)
82 91
83#else 92#else /* !CONFIG_PREEMPT_COUNT */
84 93
85#define preempt_disable() do { } while (0) 94#define preempt_disable() do { } while (0)
86#define preempt_enable_no_resched() do { } while (0) 95#define preempt_enable_no_resched() do { } while (0)
87#define preempt_enable() do { } while (0) 96#define preempt_enable() do { } while (0)
88#define preempt_check_resched() do { } while (0)
89 97
90#define preempt_disable_notrace() do { } while (0) 98#define preempt_disable_notrace() do { } while (0)
91#define preempt_enable_no_resched_notrace() do { } while (0) 99#define preempt_enable_no_resched_notrace() do { } while (0)
92#define preempt_enable_notrace() do { } while (0) 100#define preempt_enable_notrace() do { } while (0)
93 101
94#endif 102#endif /* CONFIG_PREEMPT_COUNT */
95 103
96#ifdef CONFIG_PREEMPT_NOTIFIERS 104#ifdef CONFIG_PREEMPT_NOTIFIERS
97 105
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index e7576cf9e32..643b96c7a94 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -5,7 +5,7 @@
5#include <linux/fs.h> 5#include <linux/fs.h>
6#include <linux/spinlock.h> 6#include <linux/spinlock.h>
7#include <linux/magic.h> 7#include <linux/magic.h>
8#include <asm/atomic.h> 8#include <linux/atomic.h>
9 9
10struct net; 10struct net;
11struct completion; 11struct completion;
@@ -50,8 +50,6 @@ typedef int (write_proc_t)(struct file *file, const char __user *buffer,
50 50
51struct proc_dir_entry { 51struct proc_dir_entry {
52 unsigned int low_ino; 52 unsigned int low_ino;
53 unsigned int namelen;
54 const char *name;
55 mode_t mode; 53 mode_t mode;
56 nlink_t nlink; 54 nlink_t nlink;
57 uid_t uid; 55 uid_t uid;
@@ -73,9 +71,11 @@ struct proc_dir_entry {
73 write_proc_t *write_proc; 71 write_proc_t *write_proc;
74 atomic_t count; /* use count */ 72 atomic_t count; /* use count */
75 int pde_users; /* number of callers into module in progress */ 73 int pde_users; /* number of callers into module in progress */
76 spinlock_t pde_unload_lock; /* proc_fops checks and pde_users bumps */
77 struct completion *pde_unload_completion; 74 struct completion *pde_unload_completion;
78 struct list_head pde_openers; /* who did ->open, but not ->release */ 75 struct list_head pde_openers; /* who did ->open, but not ->release */
76 spinlock_t pde_unload_lock; /* proc_fops checks and pde_users bumps */
77 u8 namelen;
78 char name[];
79}; 79};
80 80
81enum kcore_type { 81enum kcore_type {
diff --git a/include/linux/pstore.h b/include/linux/pstore.h
index 2455ef2683f..cc03bbf5c4b 100644
--- a/include/linux/pstore.h
+++ b/include/linux/pstore.h
@@ -38,9 +38,12 @@ struct pstore_info {
38 int (*open)(struct pstore_info *psi); 38 int (*open)(struct pstore_info *psi);
39 int (*close)(struct pstore_info *psi); 39 int (*close)(struct pstore_info *psi);
40 ssize_t (*read)(u64 *id, enum pstore_type_id *type, 40 ssize_t (*read)(u64 *id, enum pstore_type_id *type,
41 struct timespec *time); 41 struct timespec *time, struct pstore_info *psi);
42 u64 (*write)(enum pstore_type_id type, size_t size); 42 u64 (*write)(enum pstore_type_id type, unsigned int part,
43 int (*erase)(u64 id); 43 size_t size, struct pstore_info *psi);
44 int (*erase)(enum pstore_type_id type, u64 id,
45 struct pstore_info *psi);
46 void *data;
44}; 47};
45 48
46#ifdef CONFIG_PSTORE 49#ifdef CONFIG_PSTORE
diff --git a/include/linux/pti.h b/include/linux/pti.h
index 81af667bb2d..b3ea01a3197 100644
--- a/include/linux/pti.h
+++ b/include/linux/pti.h
@@ -36,7 +36,8 @@ struct pti_masterchannel {
36 36
37/* the following functions are defined in misc/pti.c */ 37/* the following functions are defined in misc/pti.c */
38void pti_writedata(struct pti_masterchannel *mc, u8 *buf, int count); 38void pti_writedata(struct pti_masterchannel *mc, u8 *buf, int count);
39struct pti_masterchannel *pti_request_masterchannel(u8 type); 39struct pti_masterchannel *pti_request_masterchannel(u8 type,
40 const char *thread_name);
40void pti_release_masterchannel(struct pti_masterchannel *mc); 41void pti_release_masterchannel(struct pti_masterchannel *mc);
41 42
42#endif /*PTI_H_*/ 43#endif /*PTI_H_*/
diff --git a/include/linux/ptp_classify.h b/include/linux/ptp_classify.h
index e07e2742a86..1dc420ba213 100644
--- a/include/linux/ptp_classify.h
+++ b/include/linux/ptp_classify.h
@@ -51,6 +51,7 @@
51#define PTP_CLASS_V2_VLAN (PTP_CLASS_V2 | PTP_CLASS_VLAN) 51#define PTP_CLASS_V2_VLAN (PTP_CLASS_V2 | PTP_CLASS_VLAN)
52 52
53#define PTP_EV_PORT 319 53#define PTP_EV_PORT 319
54#define PTP_GEN_BIT 0x08 /* indicates general message, if set in message type */
54 55
55#define OFF_ETYPE 12 56#define OFF_ETYPE 12
56#define OFF_IHL 14 57#define OFF_IHL 14
@@ -116,14 +117,20 @@ static inline int ptp_filter_init(struct sock_filter *f, int len)
116 {OP_OR, 0, 0, PTP_CLASS_IPV6 }, /* */ \ 117 {OP_OR, 0, 0, PTP_CLASS_IPV6 }, /* */ \
117 {OP_RETA, 0, 0, 0 }, /* */ \ 118 {OP_RETA, 0, 0, 0 }, /* */ \
118/*L3x*/ {OP_RETK, 0, 0, PTP_CLASS_NONE }, /* */ \ 119/*L3x*/ {OP_RETK, 0, 0, PTP_CLASS_NONE }, /* */ \
119/*L40*/ {OP_JEQ, 0, 6, ETH_P_8021Q }, /* f goto L50 */ \ 120/*L40*/ {OP_JEQ, 0, 9, ETH_P_8021Q }, /* f goto L50 */ \
120 {OP_LDH, 0, 0, OFF_ETYPE + 4 }, /* */ \ 121 {OP_LDH, 0, 0, OFF_ETYPE + 4 }, /* */ \
121 {OP_JEQ, 0, 9, ETH_P_1588 }, /* f goto L60 */ \ 122 {OP_JEQ, 0, 15, ETH_P_1588 }, /* f goto L60 */ \
123 {OP_LDB, 0, 0, ETH_HLEN + VLAN_HLEN }, /* */ \
124 {OP_AND, 0, 0, PTP_GEN_BIT }, /* */ \
125 {OP_JEQ, 0, 12, 0 }, /* f goto L6x */ \
122 {OP_LDH, 0, 0, ETH_HLEN + VLAN_HLEN }, /* */ \ 126 {OP_LDH, 0, 0, ETH_HLEN + VLAN_HLEN }, /* */ \
123 {OP_AND, 0, 0, PTP_CLASS_VMASK }, /* */ \ 127 {OP_AND, 0, 0, PTP_CLASS_VMASK }, /* */ \
124 {OP_OR, 0, 0, PTP_CLASS_VLAN }, /* */ \ 128 {OP_OR, 0, 0, PTP_CLASS_VLAN }, /* */ \
125 {OP_RETA, 0, 0, 0 }, /* */ \ 129 {OP_RETA, 0, 0, 0 }, /* */ \
126/*L50*/ {OP_JEQ, 0, 4, ETH_P_1588 }, /* f goto L61 */ \ 130/*L50*/ {OP_JEQ, 0, 7, ETH_P_1588 }, /* f goto L61 */ \
131 {OP_LDB, 0, 0, ETH_HLEN }, /* */ \
132 {OP_AND, 0, 0, PTP_GEN_BIT }, /* */ \
133 {OP_JEQ, 0, 4, 0 }, /* f goto L6x */ \
127 {OP_LDH, 0, 0, ETH_HLEN }, /* */ \ 134 {OP_LDH, 0, 0, ETH_HLEN }, /* */ \
128 {OP_AND, 0, 0, PTP_CLASS_VMASK }, /* */ \ 135 {OP_AND, 0, 0, PTP_CLASS_VMASK }, /* */ \
129 {OP_OR, 0, 0, PTP_CLASS_L2 }, /* */ \ 136 {OP_OR, 0, 0, PTP_CLASS_L2 }, /* */ \
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h
index 9178d5cc0b0..800f113bea6 100644
--- a/include/linux/ptrace.h
+++ b/include/linux/ptrace.h
@@ -47,6 +47,13 @@
47#define PTRACE_GETREGSET 0x4204 47#define PTRACE_GETREGSET 0x4204
48#define PTRACE_SETREGSET 0x4205 48#define PTRACE_SETREGSET 0x4205
49 49
50#define PTRACE_SEIZE 0x4206
51#define PTRACE_INTERRUPT 0x4207
52#define PTRACE_LISTEN 0x4208
53
54/* flags in @data for PTRACE_SEIZE */
55#define PTRACE_SEIZE_DEVEL 0x80000000 /* temp flag for development */
56
50/* options set using PTRACE_SETOPTIONS */ 57/* options set using PTRACE_SETOPTIONS */
51#define PTRACE_O_TRACESYSGOOD 0x00000001 58#define PTRACE_O_TRACESYSGOOD 0x00000001
52#define PTRACE_O_TRACEFORK 0x00000002 59#define PTRACE_O_TRACEFORK 0x00000002
@@ -65,6 +72,7 @@
65#define PTRACE_EVENT_EXEC 4 72#define PTRACE_EVENT_EXEC 4
66#define PTRACE_EVENT_VFORK_DONE 5 73#define PTRACE_EVENT_VFORK_DONE 5
67#define PTRACE_EVENT_EXIT 6 74#define PTRACE_EVENT_EXIT 6
75#define PTRACE_EVENT_STOP 7
68 76
69#include <asm/ptrace.h> 77#include <asm/ptrace.h>
70 78
@@ -77,16 +85,22 @@
77 * flags. When the a task is stopped the ptracer owns task->ptrace. 85 * flags. When the a task is stopped the ptracer owns task->ptrace.
78 */ 86 */
79 87
88#define PT_SEIZED 0x00010000 /* SEIZE used, enable new behavior */
80#define PT_PTRACED 0x00000001 89#define PT_PTRACED 0x00000001
81#define PT_DTRACE 0x00000002 /* delayed trace (used on m68k, i386) */ 90#define PT_DTRACE 0x00000002 /* delayed trace (used on m68k, i386) */
82#define PT_TRACESYSGOOD 0x00000004 91#define PT_TRACESYSGOOD 0x00000004
83#define PT_PTRACE_CAP 0x00000008 /* ptracer can follow suid-exec */ 92#define PT_PTRACE_CAP 0x00000008 /* ptracer can follow suid-exec */
84#define PT_TRACE_FORK 0x00000010 93
85#define PT_TRACE_VFORK 0x00000020 94/* PT_TRACE_* event enable flags */
86#define PT_TRACE_CLONE 0x00000040 95#define PT_EVENT_FLAG_SHIFT 4
87#define PT_TRACE_EXEC 0x00000080 96#define PT_EVENT_FLAG(event) (1 << (PT_EVENT_FLAG_SHIFT + (event) - 1))
88#define PT_TRACE_VFORK_DONE 0x00000100 97
89#define PT_TRACE_EXIT 0x00000200 98#define PT_TRACE_FORK PT_EVENT_FLAG(PTRACE_EVENT_FORK)
99#define PT_TRACE_VFORK PT_EVENT_FLAG(PTRACE_EVENT_VFORK)
100#define PT_TRACE_CLONE PT_EVENT_FLAG(PTRACE_EVENT_CLONE)
101#define PT_TRACE_EXEC PT_EVENT_FLAG(PTRACE_EVENT_EXEC)
102#define PT_TRACE_VFORK_DONE PT_EVENT_FLAG(PTRACE_EVENT_VFORK_DONE)
103#define PT_TRACE_EXIT PT_EVENT_FLAG(PTRACE_EVENT_EXIT)
90 104
91#define PT_TRACE_MASK 0x000003f4 105#define PT_TRACE_MASK 0x000003f4
92 106
@@ -105,7 +119,7 @@ extern long arch_ptrace(struct task_struct *child, long request,
105extern int ptrace_readdata(struct task_struct *tsk, unsigned long src, char __user *dst, int len); 119extern int ptrace_readdata(struct task_struct *tsk, unsigned long src, char __user *dst, int len);
106extern int ptrace_writedata(struct task_struct *tsk, char __user *src, unsigned long dst, int len); 120extern int ptrace_writedata(struct task_struct *tsk, char __user *src, unsigned long dst, int len);
107extern void ptrace_disable(struct task_struct *); 121extern void ptrace_disable(struct task_struct *);
108extern int ptrace_check_attach(struct task_struct *task, int kill); 122extern int ptrace_check_attach(struct task_struct *task, bool ignore_state);
109extern int ptrace_request(struct task_struct *child, long request, 123extern int ptrace_request(struct task_struct *child, long request,
110 unsigned long addr, unsigned long data); 124 unsigned long addr, unsigned long data);
111extern void ptrace_notify(int exit_code); 125extern void ptrace_notify(int exit_code);
@@ -122,7 +136,7 @@ extern bool ptrace_may_access(struct task_struct *task, unsigned int mode);
122 136
123static inline int ptrace_reparented(struct task_struct *child) 137static inline int ptrace_reparented(struct task_struct *child)
124{ 138{
125 return child->real_parent != child->parent; 139 return !same_thread_group(child->real_parent, child->parent);
126} 140}
127 141
128static inline void ptrace_unlink(struct task_struct *child) 142static inline void ptrace_unlink(struct task_struct *child)
@@ -137,36 +151,56 @@ int generic_ptrace_pokedata(struct task_struct *tsk, unsigned long addr,
137 unsigned long data); 151 unsigned long data);
138 152
139/** 153/**
140 * task_ptrace - return %PT_* flags that apply to a task 154 * ptrace_parent - return the task that is tracing the given task
141 * @task: pointer to &task_struct in question 155 * @task: task to consider
142 * 156 *
143 * Returns the %PT_* flags that apply to @task. 157 * Returns %NULL if no one is tracing @task, or the &struct task_struct
158 * pointer to its tracer.
159 *
160 * Must called under rcu_read_lock(). The pointer returned might be kept
161 * live only by RCU. During exec, this may be called with task_lock() held
162 * on @task, still held from when check_unsafe_exec() was called.
144 */ 163 */
145static inline int task_ptrace(struct task_struct *task) 164static inline struct task_struct *ptrace_parent(struct task_struct *task)
146{ 165{
147 return task->ptrace; 166 if (unlikely(task->ptrace))
167 return rcu_dereference(task->parent);
168 return NULL;
169}
170
171/**
172 * ptrace_event_enabled - test whether a ptrace event is enabled
173 * @task: ptracee of interest
174 * @event: %PTRACE_EVENT_* to test
175 *
176 * Test whether @event is enabled for ptracee @task.
177 *
178 * Returns %true if @event is enabled, %false otherwise.
179 */
180static inline bool ptrace_event_enabled(struct task_struct *task, int event)
181{
182 return task->ptrace & PT_EVENT_FLAG(event);
148} 183}
149 184
150/** 185/**
151 * ptrace_event - possibly stop for a ptrace event notification 186 * ptrace_event - possibly stop for a ptrace event notification
152 * @mask: %PT_* bit to check in @current->ptrace 187 * @event: %PTRACE_EVENT_* value to report
153 * @event: %PTRACE_EVENT_* value to report if @mask is set
154 * @message: value for %PTRACE_GETEVENTMSG to return 188 * @message: value for %PTRACE_GETEVENTMSG to return
155 * 189 *
156 * This checks the @mask bit to see if ptrace wants stops for this event. 190 * Check whether @event is enabled and, if so, report @event and @message
157 * If so we stop, reporting @event and @message to the ptrace parent. 191 * to the ptrace parent.
158 *
159 * Returns nonzero if we did a ptrace notification, zero if not.
160 * 192 *
161 * Called without locks. 193 * Called without locks.
162 */ 194 */
163static inline int ptrace_event(int mask, int event, unsigned long message) 195static inline void ptrace_event(int event, unsigned long message)
164{ 196{
165 if (mask && likely(!(current->ptrace & mask))) 197 if (unlikely(ptrace_event_enabled(current, event))) {
166 return 0; 198 current->ptrace_message = message;
167 current->ptrace_message = message; 199 ptrace_notify((event << 8) | SIGTRAP);
168 ptrace_notify((event << 8) | SIGTRAP); 200 } else if (event == PTRACE_EVENT_EXEC && unlikely(current->ptrace)) {
169 return 1; 201 /* legacy EXEC report via SIGTRAP */
202 send_sig(SIGTRAP, current, 0);
203 }
170} 204}
171 205
172/** 206/**
@@ -183,16 +217,24 @@ static inline void ptrace_init_task(struct task_struct *child, bool ptrace)
183{ 217{
184 INIT_LIST_HEAD(&child->ptrace_entry); 218 INIT_LIST_HEAD(&child->ptrace_entry);
185 INIT_LIST_HEAD(&child->ptraced); 219 INIT_LIST_HEAD(&child->ptraced);
186 child->parent = child->real_parent; 220#ifdef CONFIG_HAVE_HW_BREAKPOINT
221 atomic_set(&child->ptrace_bp_refcnt, 1);
222#endif
223 child->jobctl = 0;
187 child->ptrace = 0; 224 child->ptrace = 0;
188 if (unlikely(ptrace) && (current->ptrace & PT_PTRACED)) { 225 child->parent = child->real_parent;
226
227 if (unlikely(ptrace) && current->ptrace) {
189 child->ptrace = current->ptrace; 228 child->ptrace = current->ptrace;
190 __ptrace_link(child, current->parent); 229 __ptrace_link(child, current->parent);
191 }
192 230
193#ifdef CONFIG_HAVE_HW_BREAKPOINT 231 if (child->ptrace & PT_SEIZED)
194 atomic_set(&child->ptrace_bp_refcnt, 1); 232 task_set_jobctl_pending(child, JOBCTL_TRAP_STOP);
195#endif 233 else
234 sigaddset(&child->pending.signal, SIGSTOP);
235
236 set_tsk_thread_flag(child, TIF_SIGPENDING);
237 }
196} 238}
197 239
198/** 240/**
diff --git a/include/linux/pwm_backlight.h b/include/linux/pwm_backlight.h
index 5e3e25a3c9c..63d2df43e61 100644
--- a/include/linux/pwm_backlight.h
+++ b/include/linux/pwm_backlight.h
@@ -14,6 +14,7 @@ struct platform_pwm_backlight_data {
14 unsigned int pwm_period_ns; 14 unsigned int pwm_period_ns;
15 int (*init)(struct device *dev); 15 int (*init)(struct device *dev);
16 int (*notify)(struct device *dev, int brightness); 16 int (*notify)(struct device *dev, int brightness);
17 void (*notify_after)(struct device *dev, int brightness);
17 void (*exit)(struct device *dev); 18 void (*exit)(struct device *dev);
18 int (*check_fb)(struct device *dev, struct fb_info *info); 19 int (*check_fb)(struct device *dev, struct fb_info *info);
19}; 20};
diff --git a/include/linux/quota.h b/include/linux/quota.h
index 9a85412e0db..cb785569903 100644
--- a/include/linux/quota.h
+++ b/include/linux/quota.h
@@ -180,7 +180,7 @@ enum {
180#include <linux/dqblk_v1.h> 180#include <linux/dqblk_v1.h>
181#include <linux/dqblk_v2.h> 181#include <linux/dqblk_v2.h>
182 182
183#include <asm/atomic.h> 183#include <linux/atomic.h>
184 184
185typedef __kernel_uid32_t qid_t; /* Type in which we store ids in memory */ 185typedef __kernel_uid32_t qid_t; /* Type in which we store ids in memory */
186typedef long long qsize_t; /* Type in which we store sizes */ 186typedef long long qsize_t; /* Type in which we store sizes */
@@ -415,13 +415,5 @@ struct quota_module_name {
415 {QFMT_VFS_V0, "quota_v2"},\ 415 {QFMT_VFS_V0, "quota_v2"},\
416 {0, NULL}} 416 {0, NULL}}
417 417
418#else
419
420# /* nodep */ include <sys/cdefs.h>
421
422__BEGIN_DECLS
423long quotactl __P ((unsigned int, const char *, int, caddr_t));
424__END_DECLS
425
426#endif /* __KERNEL__ */ 418#endif /* __KERNEL__ */
427#endif /* _QUOTA_ */ 419#endif /* _QUOTA_ */
diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h
index 23241c2fecc..9d4539c52e5 100644
--- a/include/linux/radix-tree.h
+++ b/include/linux/radix-tree.h
@@ -39,7 +39,15 @@
39 * when it is shrunk, before we rcu free the node. See shrink code for 39 * when it is shrunk, before we rcu free the node. See shrink code for
40 * details. 40 * details.
41 */ 41 */
42#define RADIX_TREE_INDIRECT_PTR 1 42#define RADIX_TREE_INDIRECT_PTR 1
43/*
44 * A common use of the radix tree is to store pointers to struct pages;
45 * but shmem/tmpfs needs also to store swap entries in the same tree:
46 * those are marked as exceptional entries to distinguish them.
47 * EXCEPTIONAL_ENTRY tests the bit, EXCEPTIONAL_SHIFT shifts content past it.
48 */
49#define RADIX_TREE_EXCEPTIONAL_ENTRY 2
50#define RADIX_TREE_EXCEPTIONAL_SHIFT 2
43 51
44#define radix_tree_indirect_to_ptr(ptr) \ 52#define radix_tree_indirect_to_ptr(ptr) \
45 radix_tree_indirect_to_ptr((void __force *)(ptr)) 53 radix_tree_indirect_to_ptr((void __force *)(ptr))
@@ -174,6 +182,28 @@ static inline int radix_tree_deref_retry(void *arg)
174} 182}
175 183
176/** 184/**
185 * radix_tree_exceptional_entry - radix_tree_deref_slot gave exceptional entry?
186 * @arg: value returned by radix_tree_deref_slot
187 * Returns: 0 if well-aligned pointer, non-0 if exceptional entry.
188 */
189static inline int radix_tree_exceptional_entry(void *arg)
190{
191 /* Not unlikely because radix_tree_exception often tested first */
192 return (unsigned long)arg & RADIX_TREE_EXCEPTIONAL_ENTRY;
193}
194
195/**
196 * radix_tree_exception - radix_tree_deref_slot returned either exception?
197 * @arg: value returned by radix_tree_deref_slot
198 * Returns: 0 if well-aligned pointer, non-0 if either kind of exception.
199 */
200static inline int radix_tree_exception(void *arg)
201{
202 return unlikely((unsigned long)arg &
203 (RADIX_TREE_INDIRECT_PTR | RADIX_TREE_EXCEPTIONAL_ENTRY));
204}
205
206/**
177 * radix_tree_replace_slot - replace item in a slot 207 * radix_tree_replace_slot - replace item in a slot
178 * @pslot: pointer to slot, returned by radix_tree_lookup_slot 208 * @pslot: pointer to slot, returned by radix_tree_lookup_slot
179 * @item: new item to store in the slot. 209 * @item: new item to store in the slot.
@@ -194,8 +224,8 @@ void *radix_tree_delete(struct radix_tree_root *, unsigned long);
194unsigned int 224unsigned int
195radix_tree_gang_lookup(struct radix_tree_root *root, void **results, 225radix_tree_gang_lookup(struct radix_tree_root *root, void **results,
196 unsigned long first_index, unsigned int max_items); 226 unsigned long first_index, unsigned int max_items);
197unsigned int 227unsigned int radix_tree_gang_lookup_slot(struct radix_tree_root *root,
198radix_tree_gang_lookup_slot(struct radix_tree_root *root, void ***results, 228 void ***results, unsigned long *indices,
199 unsigned long first_index, unsigned int max_items); 229 unsigned long first_index, unsigned int max_items);
200unsigned long radix_tree_next_hole(struct radix_tree_root *root, 230unsigned long radix_tree_next_hole(struct radix_tree_root *root,
201 unsigned long index, unsigned long max_scan); 231 unsigned long index, unsigned long max_scan);
@@ -222,6 +252,7 @@ unsigned long radix_tree_range_tag_if_tagged(struct radix_tree_root *root,
222 unsigned long nr_to_tag, 252 unsigned long nr_to_tag,
223 unsigned int fromtag, unsigned int totag); 253 unsigned int fromtag, unsigned int totag);
224int radix_tree_tagged(struct radix_tree_root *root, unsigned int tag); 254int radix_tree_tagged(struct radix_tree_root *root, unsigned int tag);
255unsigned long radix_tree_locate_item(struct radix_tree_root *root, void *item);
225 256
226static inline void radix_tree_preload_end(void) 257static inline void radix_tree_preload_end(void)
227{ 258{
diff --git a/include/linux/raid/md_p.h b/include/linux/raid/md_p.h
index 75cbf4f62fe..9e65d9e2066 100644
--- a/include/linux/raid/md_p.h
+++ b/include/linux/raid/md_p.h
@@ -245,10 +245,16 @@ struct mdp_superblock_1 {
245 __u8 device_uuid[16]; /* user-space setable, ignored by kernel */ 245 __u8 device_uuid[16]; /* user-space setable, ignored by kernel */
246 __u8 devflags; /* per-device flags. Only one defined...*/ 246 __u8 devflags; /* per-device flags. Only one defined...*/
247#define WriteMostly1 1 /* mask for writemostly flag in above */ 247#define WriteMostly1 1 /* mask for writemostly flag in above */
248 __u8 pad2[64-57]; /* set to 0 when writing */ 248 /* Bad block log. If there are any bad blocks the feature flag is set.
249 * If offset and size are non-zero, that space is reserved and available
250 */
251 __u8 bblog_shift; /* shift from sectors to block size */
252 __le16 bblog_size; /* number of sectors reserved for list */
253 __le32 bblog_offset; /* sector offset from superblock to bblog,
254 * signed - not unsigned */
249 255
250 /* array state information - 64 bytes */ 256 /* array state information - 64 bytes */
251 __le64 utime; /* 40 bits second, 24 btes microseconds */ 257 __le64 utime; /* 40 bits second, 24 bits microseconds */
252 __le64 events; /* incremented when superblock updated */ 258 __le64 events; /* incremented when superblock updated */
253 __le64 resync_offset; /* data before this offset (from data_offset) known to be in sync */ 259 __le64 resync_offset; /* data before this offset (from data_offset) known to be in sync */
254 __le32 sb_csum; /* checksum up to devs[max_dev] */ 260 __le32 sb_csum; /* checksum up to devs[max_dev] */
@@ -270,8 +276,8 @@ struct mdp_superblock_1 {
270 * must be honoured 276 * must be honoured
271 */ 277 */
272#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 */
273 280
274#define MD_FEATURE_ALL (1|2|4) 281#define MD_FEATURE_ALL (1|2|4|8)
275 282
276#endif 283#endif
277
diff --git a/include/linux/ramoops.h b/include/linux/ramoops.h
index 0ae68a2c121..484fef81cd3 100644
--- a/include/linux/ramoops.h
+++ b/include/linux/ramoops.h
@@ -10,6 +10,8 @@
10struct ramoops_platform_data { 10struct ramoops_platform_data {
11 unsigned long mem_size; 11 unsigned long mem_size;
12 unsigned long mem_address; 12 unsigned long mem_address;
13 unsigned long record_size;
14 int dump_oops;
13}; 15};
14 16
15#endif 17#endif
diff --git a/include/linux/random.h b/include/linux/random.h
index fb7ab9de5f3..d13059f3ea3 100644
--- a/include/linux/random.h
+++ b/include/linux/random.h
@@ -57,17 +57,6 @@ extern void add_interrupt_randomness(int irq);
57extern void get_random_bytes(void *buf, int nbytes); 57extern void get_random_bytes(void *buf, int nbytes);
58void generate_random_uuid(unsigned char uuid_out[16]); 58void generate_random_uuid(unsigned char uuid_out[16]);
59 59
60extern __u32 secure_ip_id(__be32 daddr);
61extern u32 secure_ipv4_port_ephemeral(__be32 saddr, __be32 daddr, __be16 dport);
62extern u32 secure_ipv6_port_ephemeral(const __be32 *saddr, const __be32 *daddr,
63 __be16 dport);
64extern __u32 secure_tcp_sequence_number(__be32 saddr, __be32 daddr,
65 __be16 sport, __be16 dport);
66extern __u32 secure_tcpv6_sequence_number(__be32 *saddr, __be32 *daddr,
67 __be16 sport, __be16 dport);
68extern u64 secure_dccp_sequence_number(__be32 saddr, __be32 daddr,
69 __be16 sport, __be16 dport);
70
71#ifndef MODULE 60#ifndef MODULE
72extern const struct file_operations random_fops, urandom_fops; 61extern const struct file_operations random_fops, urandom_fops;
73#endif 62#endif
diff --git a/include/linux/rculist.h b/include/linux/rculist.h
index e3beb315517..d079290843a 100644
--- a/include/linux/rculist.h
+++ b/include/linux/rculist.h
@@ -183,7 +183,7 @@ static inline void list_splice_init_rcu(struct list_head *list,
183 struct list_head *last = list->prev; 183 struct list_head *last = list->prev;
184 struct list_head *at = head->next; 184 struct list_head *at = head->next;
185 185
186 if (list_empty(head)) 186 if (list_empty(list))
187 return; 187 return;
188 188
189 /* "first" and "last" tracking list, so initialize it. */ 189 /* "first" and "last" tracking list, so initialize it. */
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 99f9aa7c280..8f4f881a0ad 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -239,7 +239,7 @@ extern int rcu_read_lock_bh_held(void);
239 * Check debug_lockdep_rcu_enabled() to prevent false positives during boot 239 * Check debug_lockdep_rcu_enabled() to prevent false positives during boot
240 * and while lockdep is disabled. 240 * and while lockdep is disabled.
241 */ 241 */
242#ifdef CONFIG_PREEMPT 242#ifdef CONFIG_PREEMPT_COUNT
243static inline int rcu_read_lock_sched_held(void) 243static inline int rcu_read_lock_sched_held(void)
244{ 244{
245 int lockdep_opinion = 0; 245 int lockdep_opinion = 0;
@@ -250,12 +250,12 @@ static inline int rcu_read_lock_sched_held(void)
250 lockdep_opinion = lock_is_held(&rcu_sched_lock_map); 250 lockdep_opinion = lock_is_held(&rcu_sched_lock_map);
251 return lockdep_opinion || preempt_count() != 0 || irqs_disabled(); 251 return lockdep_opinion || preempt_count() != 0 || irqs_disabled();
252} 252}
253#else /* #ifdef CONFIG_PREEMPT */ 253#else /* #ifdef CONFIG_PREEMPT_COUNT */
254static inline int rcu_read_lock_sched_held(void) 254static inline int rcu_read_lock_sched_held(void)
255{ 255{
256 return 1; 256 return 1;
257} 257}
258#endif /* #else #ifdef CONFIG_PREEMPT */ 258#endif /* #else #ifdef CONFIG_PREEMPT_COUNT */
259 259
260#else /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */ 260#else /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */
261 261
@@ -276,17 +276,17 @@ static inline int rcu_read_lock_bh_held(void)
276 return 1; 276 return 1;
277} 277}
278 278
279#ifdef CONFIG_PREEMPT 279#ifdef CONFIG_PREEMPT_COUNT
280static inline int rcu_read_lock_sched_held(void) 280static inline int rcu_read_lock_sched_held(void)
281{ 281{
282 return preempt_count() != 0 || irqs_disabled(); 282 return preempt_count() != 0 || irqs_disabled();
283} 283}
284#else /* #ifdef CONFIG_PREEMPT */ 284#else /* #ifdef CONFIG_PREEMPT_COUNT */
285static inline int rcu_read_lock_sched_held(void) 285static inline int rcu_read_lock_sched_held(void)
286{ 286{
287 return 1; 287 return 1;
288} 288}
289#endif /* #else #ifdef CONFIG_PREEMPT */ 289#endif /* #else #ifdef CONFIG_PREEMPT_COUNT */
290 290
291#endif /* #else #ifdef CONFIG_DEBUG_LOCK_ALLOC */ 291#endif /* #else #ifdef CONFIG_DEBUG_LOCK_ALLOC */
292 292
diff --git a/include/linux/reboot.h b/include/linux/reboot.h
index 3005d5a7fce..e0879a70e83 100644
--- a/include/linux/reboot.h
+++ b/include/linux/reboot.h
@@ -39,6 +39,11 @@
39 39
40#include <linux/notifier.h> 40#include <linux/notifier.h>
41 41
42#define SYS_DOWN 0x0001 /* Notify of system down */
43#define SYS_RESTART SYS_DOWN
44#define SYS_HALT 0x0002 /* Notify of system halt */
45#define SYS_POWER_OFF 0x0003 /* Notify of system power off */
46
42extern int register_reboot_notifier(struct notifier_block *); 47extern int register_reboot_notifier(struct notifier_block *);
43extern int unregister_reboot_notifier(struct notifier_block *); 48extern int unregister_reboot_notifier(struct notifier_block *);
44 49
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
new file mode 100644
index 00000000000..9fce3c8eb40
--- /dev/null
+++ b/include/linux/regmap.h
@@ -0,0 +1,217 @@
1#ifndef __LINUX_REGMAP_H
2#define __LINUX_REGMAP_H
3
4/*
5 * Register map access API
6 *
7 * Copyright 2011 Wolfson Microelectronics plc
8 *
9 * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
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#include <linux/device.h>
17#include <linux/list.h>
18#include <linux/module.h>
19
20struct i2c_client;
21struct spi_device;
22
23/* An enum of all the supported cache types */
24enum regcache_type {
25 REGCACHE_NONE,
26 REGCACHE_RBTREE,
27 REGCACHE_COMPRESSED
28};
29
30/**
31 * Default value for a register. We use an array of structs rather
32 * than a simple array as many modern devices have very sparse
33 * register maps.
34 *
35 * @reg: Register address.
36 * @def: Register default value.
37 */
38struct reg_default {
39 unsigned int reg;
40 unsigned int def;
41};
42
43/**
44 * Configuration for the register map of a device.
45 *
46 * @reg_bits: Number of bits in a register address, mandatory.
47 * @pad_bits: Number of bits of padding between register and value.
48 * @val_bits: Number of bits in a register value, mandatory.
49 *
50 * @writeable_reg: Optional callback returning true if the register
51 * can be written to.
52 * @readable_reg: Optional callback returning true if the register
53 * can be read from.
54 * @volatile_reg: Optional callback returning true if the register
55 * value can't be cached.
56 * @precious_reg: Optional callback returning true if the rgister
57 * should not be read outside of a call from the driver
58 * (eg, a clear on read interrupt status register).
59 *
60 * @max_register: Optional, specifies the maximum valid register index.
61 * @reg_defaults: Power on reset values for registers (for use with
62 * register cache support).
63 * @num_reg_defaults: Number of elements in reg_defaults.
64 *
65 * @read_flag_mask: Mask to be set in the top byte of the register when doing
66 * a read.
67 * @write_flag_mask: Mask to be set in the top byte of the register when doing
68 * a write. If both read_flag_mask and write_flag_mask are
69 * empty the regmap_bus default masks are used.
70 *
71 * @cache_type: The actual cache type.
72 * @reg_defaults_raw: Power on reset values for registers (for use with
73 * register cache support).
74 * @num_reg_defaults_raw: Number of elements in reg_defaults_raw.
75 */
76struct regmap_config {
77 int reg_bits;
78 int pad_bits;
79 int val_bits;
80
81 bool (*writeable_reg)(struct device *dev, unsigned int reg);
82 bool (*readable_reg)(struct device *dev, unsigned int reg);
83 bool (*volatile_reg)(struct device *dev, unsigned int reg);
84 bool (*precious_reg)(struct device *dev, unsigned int reg);
85
86 unsigned int max_register;
87 const struct reg_default *reg_defaults;
88 unsigned int num_reg_defaults;
89 enum regcache_type cache_type;
90 const void *reg_defaults_raw;
91 unsigned int num_reg_defaults_raw;
92
93 u8 read_flag_mask;
94 u8 write_flag_mask;
95};
96
97typedef int (*regmap_hw_write)(struct device *dev, const void *data,
98 size_t count);
99typedef int (*regmap_hw_gather_write)(struct device *dev,
100 const void *reg, size_t reg_len,
101 const void *val, size_t val_len);
102typedef int (*regmap_hw_read)(struct device *dev,
103 const void *reg_buf, size_t reg_size,
104 void *val_buf, size_t val_size);
105
106/**
107 * Description of a hardware bus for the register map infrastructure.
108 *
109 * @write: Write operation.
110 * @gather_write: Write operation with split register/value, return -ENOTSUPP
111 * if not implemented on a given device.
112 * @read: Read operation. Data is returned in the buffer used to transmit
113 * data.
114 * @read_flag_mask: Mask to be set in the top byte of the register when doing
115 * a read.
116 */
117struct regmap_bus {
118 regmap_hw_write write;
119 regmap_hw_gather_write gather_write;
120 regmap_hw_read read;
121 u8 read_flag_mask;
122};
123
124struct regmap *regmap_init(struct device *dev,
125 const struct regmap_bus *bus,
126 const struct regmap_config *config);
127struct regmap *regmap_init_i2c(struct i2c_client *i2c,
128 const struct regmap_config *config);
129struct regmap *regmap_init_spi(struct spi_device *dev,
130 const struct regmap_config *config);
131
132struct regmap *devm_regmap_init(struct device *dev,
133 const struct regmap_bus *bus,
134 const struct regmap_config *config);
135struct regmap *devm_regmap_init_i2c(struct i2c_client *i2c,
136 const struct regmap_config *config);
137struct regmap *devm_regmap_init_spi(struct spi_device *dev,
138 const struct regmap_config *config);
139
140void regmap_exit(struct regmap *map);
141int regmap_reinit_cache(struct regmap *map,
142 const struct regmap_config *config);
143int regmap_write(struct regmap *map, unsigned int reg, unsigned int val);
144int regmap_raw_write(struct regmap *map, unsigned int reg,
145 const void *val, size_t val_len);
146int regmap_bulk_write(struct regmap *map, unsigned int reg, const void *val,
147 size_t val_count);
148int regmap_read(struct regmap *map, unsigned int reg, unsigned int *val);
149int regmap_raw_read(struct regmap *map, unsigned int reg,
150 void *val, size_t val_len);
151int regmap_bulk_read(struct regmap *map, unsigned int reg, void *val,
152 size_t val_count);
153int regmap_update_bits(struct regmap *map, unsigned int reg,
154 unsigned int mask, unsigned int val);
155int regmap_update_bits_lazy(struct regmap *map, unsigned int reg,
156 unsigned int mask, unsigned int val);
157int regmap_update_bits_check(struct regmap *map, unsigned int reg,
158 unsigned int mask, unsigned int val,
159 bool *change);
160
161int regcache_sync(struct regmap *map);
162void regcache_cache_only(struct regmap *map, bool enable);
163void regcache_cache_bypass(struct regmap *map, bool enable);
164void regcache_mark_dirty(struct regmap *map);
165
166int regmap_register_patch(struct regmap *map, const struct reg_default *regs,
167 int num_regs);
168
169/**
170 * Description of an IRQ for the generic regmap irq_chip.
171 *
172 * @reg_offset: Offset of the status/mask register within the bank
173 * @mask: Mask used to flag/control the register.
174 */
175struct regmap_irq {
176 unsigned int reg_offset;
177 unsigned int mask;
178};
179
180/**
181 * Description of a generic regmap irq_chip. This is not intended to
182 * handle every possible interrupt controller, but it should handle a
183 * substantial proportion of those that are found in the wild.
184 *
185 * @name: Descriptive name for IRQ controller.
186 *
187 * @status_base: Base status register address.
188 * @mask_base: Base mask register address.
189 * @ack_base: Base ack address. If zero then the chip is clear on read.
190 *
191 * @num_regs: Number of registers in each control bank.
192 * @irqs: Descriptors for individual IRQs. Interrupt numbers are
193 * assigned based on the index in the array of the interrupt.
194 * @num_irqs: Number of descriptors.
195 */
196struct regmap_irq_chip {
197 const char *name;
198
199 unsigned int status_base;
200 unsigned int mask_base;
201 unsigned int ack_base;
202
203 int num_regs;
204
205 const struct regmap_irq *irqs;
206 int num_irqs;
207};
208
209struct regmap_irq_chip_data;
210
211int regmap_add_irq_chip(struct regmap *map, int irq, int irq_flags,
212 int irq_base, struct regmap_irq_chip *chip,
213 struct regmap_irq_chip_data **data);
214void regmap_del_irq_chip(int irq, struct regmap_irq_chip_data *data);
215int regmap_irq_chip_get_base(struct regmap_irq_chip_data *data);
216
217#endif
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
index 9e87c1cb727..8699df6fbb7 100644
--- a/include/linux/regulator/consumer.h
+++ b/include/linux/regulator/consumer.h
@@ -2,6 +2,7 @@
2 * consumer.h -- SoC Regulator consumer support. 2 * consumer.h -- SoC Regulator consumer support.
3 * 3 *
4 * Copyright (C) 2007, 2008 Wolfson Microelectronics PLC. 4 * Copyright (C) 2007, 2008 Wolfson Microelectronics PLC.
5 * Copyright (C) 2012 NVIDIA Corporation
5 * 6 *
6 * Author: Liam Girdwood <lrg@slimlogic.co.uk> 7 * Author: Liam Girdwood <lrg@slimlogic.co.uk>
7 * 8 *
@@ -92,6 +93,10 @@
92 * FORCE_DISABLE Regulator forcibly shut down by software. 93 * FORCE_DISABLE Regulator forcibly shut down by software.
93 * VOLTAGE_CHANGE Regulator voltage changed. 94 * VOLTAGE_CHANGE Regulator voltage changed.
94 * DISABLE Regulator was disabled. 95 * DISABLE Regulator was disabled.
96 * PRE_ENABLE Regulator is to be enabled
97 * POST_ENABLE Regulator was enabled
98 * OUT_PRECHANGE Regulator is enabled and its voltage is to be changed
99 * OUT_POSTCHANGE Regulator is enabled and its voltage was changed
95 * 100 *
96 * NOTE: These events can be OR'ed together when passed into handler. 101 * NOTE: These events can be OR'ed together when passed into handler.
97 */ 102 */
@@ -104,6 +109,10 @@
104#define REGULATOR_EVENT_FORCE_DISABLE 0x20 109#define REGULATOR_EVENT_FORCE_DISABLE 0x20
105#define REGULATOR_EVENT_VOLTAGE_CHANGE 0x40 110#define REGULATOR_EVENT_VOLTAGE_CHANGE 0x40
106#define REGULATOR_EVENT_DISABLE 0x80 111#define REGULATOR_EVENT_DISABLE 0x80
112#define REGULATOR_EVENT_PRE_ENABLE 0x100
113#define REGULATOR_EVENT_POST_ENABLE 0x200
114#define REGULATOR_EVENT_OUT_PRECHANGE 0x400
115#define REGULATOR_EVENT_OUT_POSTCHANGE 0x800
107 116
108struct regulator; 117struct regulator;
109 118
@@ -122,6 +131,9 @@ struct regulator;
122struct regulator_bulk_data { 131struct regulator_bulk_data {
123 const char *supply; 132 const char *supply;
124 struct regulator *consumer; 133 struct regulator *consumer;
134
135 /* private: Internal use */
136 int ret;
125}; 137};
126 138
127#if defined(CONFIG_REGULATOR) 139#if defined(CONFIG_REGULATOR)
@@ -194,6 +206,12 @@ static inline struct regulator *__must_check regulator_get(struct device *dev,
194 */ 206 */
195 return NULL; 207 return NULL;
196} 208}
209static inline struct regulator *__must_check regulator_get_exclusive(
210 struct device *dev, const char *id)
211{
212 /* See comment for regulator_get() stub, above */
213 return NULL;
214}
197static inline void regulator_put(struct regulator *regulator) 215static inline void regulator_put(struct regulator *regulator)
198{ 216{
199} 217}
@@ -208,6 +226,11 @@ static inline int regulator_disable(struct regulator *regulator)
208 return 0; 226 return 0;
209} 227}
210 228
229static inline int regulator_force_disable(struct regulator *regulator)
230{
231 return 0;
232}
233
211static inline int regulator_is_enabled(struct regulator *regulator) 234static inline int regulator_is_enabled(struct regulator *regulator)
212{ 235{
213 return 1; 236 return 1;
@@ -237,17 +260,45 @@ static inline void regulator_bulk_free(int num_consumers,
237{ 260{
238} 261}
239 262
263static inline int regulator_count_voltages(struct regulator *regulator)
264{
265 return 0;
266}
267
268static inline int regulator_list_voltage(struct regulator *regulator,
269 unsigned selector)
270{
271 return 0;
272}
273
274static inline int regulator_is_supported_voltage(struct regulator *regulator,
275 int min_uV, int max_uV)
276{
277 return 0;
278}
279
240static inline int regulator_set_voltage(struct regulator *regulator, 280static inline int regulator_set_voltage(struct regulator *regulator,
241 int min_uV, int max_uV) 281 int min_uV, int max_uV)
242{ 282{
243 return 0; 283 return 0;
244} 284}
245 285
286static inline int regulator_set_voltage_time(struct regulator *regulator,
287 int old_uV, int new_uV)
288{
289 return 0;
290}
291
246static inline int regulator_get_voltage(struct regulator *regulator) 292static inline int regulator_get_voltage(struct regulator *regulator)
247{ 293{
248 return 0; 294 return 0;
249} 295}
250 296
297static inline int regulator_sync_voltage(struct regulator *regulator)
298{
299 return 0;
300}
301
251static inline int regulator_set_current_limit(struct regulator *regulator, 302static inline int regulator_set_current_limit(struct regulator *regulator,
252 int min_uA, int max_uA) 303 int min_uA, int max_uA)
253{ 304{
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
index 6c433b89c80..1a80bc77517 100644
--- a/include/linux/regulator/driver.h
+++ b/include/linux/regulator/driver.h
@@ -188,18 +188,16 @@ struct regulator_dev {
188 188
189 /* lists we belong to */ 189 /* lists we belong to */
190 struct list_head list; /* list of all regulators */ 190 struct list_head list; /* list of all regulators */
191 struct list_head slist; /* list of supplied regulators */
192 191
193 /* lists we own */ 192 /* lists we own */
194 struct list_head consumer_list; /* consumers we supply */ 193 struct list_head consumer_list; /* consumers we supply */
195 struct list_head supply_list; /* regulators we supply */
196 194
197 struct blocking_notifier_head notifier; 195 struct blocking_notifier_head notifier;
198 struct mutex mutex; /* consumer lock */ 196 struct mutex mutex; /* consumer lock */
199 struct module *owner; 197 struct module *owner;
200 struct device dev; 198 struct device dev;
201 struct regulation_constraints *constraints; 199 struct regulation_constraints *constraints;
202 struct regulator_dev *supply; /* for tree */ 200 struct regulator *supply; /* for tree */
203 201
204 void *reg_data; /* regulator_dev data */ 202 void *reg_data; /* regulator_dev data */
205 203
diff --git a/include/linux/regulator/fan53555-regulator.h b/include/linux/regulator/fan53555-regulator.h
new file mode 100644
index 00000000000..e2ed83bab4e
--- /dev/null
+++ b/include/linux/regulator/fan53555-regulator.h
@@ -0,0 +1,63 @@
1/*
2 * include/linux/regulator/fan53555.h
3 *
4 * Interface for regulator driver for FairChild fan53555 Processor power supply
5 *
6 * Copyright (C) 2011 NVIDIA Corporation
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, but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 * 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 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 *
22 */
23
24#ifndef __REGULATOR_FAN53555_H
25#define __REGULATOR_FAN53555_H
26
27#include <linux/regulator/machine.h>
28
29/*
30 * struct fan53555_regulator_platform_data - fan53555 regulator platform data.
31 * When VSEL pin is low, VOUT is set by the VSEL0 register.
32 * When VSEL pin is high, VOUT is set by the VSEL1 register
33 *
34 * @reg_init_data: The regulator init data.
35 * @vsel_id: Select the voltage id register.
36 * @vsel0_buck_en: Software Buck enable when EN=high & VSEL=low
37 * @vsel0_mode: Force PWM mode(1) or Allow auto-PFM mode(0) during light load
38 * @init_vsel0_min_uV: initial micro volts when EN=high & VSEL=low
39 * @init_vsel0_max_uV: initial micro volts when EN=high & VSEL=low
40 * @vsel1_buck_en: Software Buck enable when EN=high & VSEL=high
41 * @vsel1_mode: Force PWM mode(1) or Allow auto-PFM mode(0) during light load
42 * @init_vsel1_min_uV: initial micro volts when EN=high & VSEL=high
43 * @init_vsel1_max_uV: initial micro volts when EN=high & VSEL=high
44 * @output_discharge: when the regulator is disabled, VOUT discharges
45 * @slew_rate: slew rate of trasitioning from a low to high voltage
46 */
47
48struct fan53555_regulator_platform_data {
49 struct regulator_init_data reg_init_data;
50 int vsel_id;
51 unsigned vsel0_buck_en:1;
52 unsigned vsel0_mode:1;
53 int init_vsel0_min_uV;
54 int init_vsel0_max_uV;
55 unsigned vsel1_buck_en:1;
56 unsigned vsel1_mode:1;
57 int init_vsel1_min_uV;
58 int init_vsel1_max_uV;
59 unsigned output_discharge:1;
60 unsigned slew_rate:3;
61};
62
63#endif /* __REGULATOR_FAN53555_H */
diff --git a/include/linux/regulator/gpio-regulator.h b/include/linux/regulator/gpio-regulator.h
new file mode 100644
index 00000000000..19fbd267406
--- /dev/null
+++ b/include/linux/regulator/gpio-regulator.h
@@ -0,0 +1,87 @@
1/*
2 * gpio-regulator.h
3 *
4 * Copyright 2011 Heiko Stuebner <heiko@sntech.de>
5 *
6 * based on fixed.h
7 *
8 * Copyright 2008 Wolfson Microelectronics PLC.
9 *
10 * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
11 *
12 * Copyright (c) 2009 Nokia Corporation
13 * Roger Quadros <ext-roger.quadros@nokia.com>
14 *
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License as
17 * published by the Free Software Foundation; either version 2 of the
18 * License, or (at your option) any later version.
19 */
20
21#ifndef __REGULATOR_GPIO_H
22#define __REGULATOR_GPIO_H
23
24struct regulator_init_data;
25
26enum regulator_type;
27
28/**
29 * struct gpio_regulator_state - state description
30 * @value: microvolts or microamps
31 * @gpios: bitfield of gpio target-states for the value
32 *
33 * This structure describes a supported setting of the regulator
34 * and the necessary gpio-state to achieve it.
35 *
36 * The n-th bit in the bitfield describes the state of the n-th GPIO
37 * from the gpios-array defined in gpio_regulator_config below.
38 */
39struct gpio_regulator_state {
40 int value;
41 int gpios;
42};
43
44/**
45 * struct gpio_regulator_config - config structure
46 * @supply_name: Name of the regulator supply
47 * @enable_gpio: GPIO to use for enable control
48 * set to -EINVAL if not used
49 * @enable_high: Polarity of enable GPIO
50 * 1 = Active high, 0 = Active low
51 * @enabled_at_boot: Whether regulator has been enabled at
52 * boot or not. 1 = Yes, 0 = No
53 * This is used to keep the regulator at
54 * the default state
55 * @startup_delay: Start-up time in microseconds
56 * @gpios: Array containing the gpios needed to control
57 * the setting of the regulator
58 * @nr_gpios: Number of gpios
59 * @states: Array of gpio_regulator_state entries describing
60 * the gpio state for specific voltages
61 * @nr_states: Number of states available
62 * @regulator_type: either REGULATOR_CURRENT or REGULATOR_VOLTAGE
63 * @init_data: regulator_init_data
64 *
65 * This structure contains gpio-voltage regulator configuration
66 * information that must be passed by platform code to the
67 * gpio-voltage regulator driver.
68 */
69struct gpio_regulator_config {
70 const char *supply_name;
71
72 int enable_gpio;
73 unsigned enable_high:1;
74 unsigned enabled_at_boot:1;
75 unsigned startup_delay;
76
77 struct gpio *gpios;
78 int nr_gpios;
79
80 struct gpio_regulator_state *states;
81 int nr_states;
82
83 enum regulator_type type;
84 struct regulator_init_data *init_data;
85};
86
87#endif
diff --git a/include/linux/regulator/gpio-switch-regulator.h b/include/linux/regulator/gpio-switch-regulator.h
new file mode 100644
index 00000000000..68776b93ef0
--- /dev/null
+++ b/include/linux/regulator/gpio-switch-regulator.h
@@ -0,0 +1,69 @@
1/*
2 * Copyright (c) 2011, NVIDIA 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 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, 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
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 _GPIO_SWITCH_REGULATOR_H
20#define _GPIO_SWITCH_REGULATOR_H
21
22#include <linux/regulator/machine.h>
23
24/*
25 * struct gpio_switch_regulator_subdev_data - Gpio switch regulator subdevice
26 * data.
27 *
28 * Subdevice data to register a gpio regulator switch device driver.
29 *
30 * @regulator_name: The name of regulator.
31 * @input_supply: Input supply name.
32 * @id: The id of the switch.
33 * @gpio_nr: Gpio nr which controls this switch.
34 * @active_low: true if making gpio low makes voltage output enable.
35 * @init_state: 1 if init_state should be active.
36 * @voltages: Possible voltages to set at output. The values are in millivolt.
37 * @n_voltages: Number of voltages.
38 * @num_consumer_supplies: Number of cosumer supplies.
39 * @consumer_supplies: List of consumer spllies.
40 */
41struct gpio_switch_regulator_subdev_data {
42 const char *regulator_name;
43 const char *input_supply;
44 int id;
45 int gpio_nr;
46 int active_low;
47 int pin_group;
48 int init_state;
49 int *voltages;
50 unsigned n_voltages;
51 struct regulator_consumer_supply *consumer_supplies;
52 int num_consumer_supplies;
53 struct regulation_constraints constraints;
54 int (*enable_rail)(struct gpio_switch_regulator_subdev_data *pdata);
55 int (*disable_rail)(struct gpio_switch_regulator_subdev_data *pdata);
56
57};
58
59/**
60 * gpio_switch_regulator_platform_data - platform data for gpio_switch_regulator
61 * @num_subdevs: number of regulators used
62 * @subdevs: pointer to regulators used
63 */
64struct gpio_switch_regulator_platform_data {
65 int num_subdevs;
66 struct gpio_switch_regulator_subdev_data **subdevs;
67};
68
69#endif
diff --git a/include/linux/regulator/max77663-regulator.h b/include/linux/regulator/max77663-regulator.h
new file mode 100644
index 00000000000..d8ab389c425
--- /dev/null
+++ b/include/linux/regulator/max77663-regulator.h
@@ -0,0 +1,131 @@
1/*
2 * include/linux/regulator/max77663-regulator.h
3 * Maxim LDO and Buck regulators driver
4 *
5 * Copyright 2011-2012 Maxim Integrated Products, Inc.
6 * Copyright (C) 2011-2012 NVIDIA Corporation
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 as
10 * published by the Free Software Foundation; either version 2 of the
11 * License, or (at your option) any later version.
12 *
13 */
14
15#ifndef __LINUX_REGULATOR_MAX77663_REGULATOR_H__
16#define __LINUX_REGULATOR_MAX77663_REGULATOR_H__
17
18#include <linux/regulator/machine.h>
19
20#define max77663_rails(_name) "max77663_"#_name
21
22enum max77663_regulator_id {
23 MAX77663_REGULATOR_ID_SD0,
24 MAX77663_REGULATOR_ID_DVSSD0,
25 MAX77663_REGULATOR_ID_SD1,
26 MAX77663_REGULATOR_ID_DVSSD1,
27 MAX77663_REGULATOR_ID_SD2,
28 MAX77663_REGULATOR_ID_SD3,
29 MAX77663_REGULATOR_ID_SD4,
30 MAX77663_REGULATOR_ID_LDO0,
31 MAX77663_REGULATOR_ID_LDO1,
32 MAX77663_REGULATOR_ID_LDO2,
33 MAX77663_REGULATOR_ID_LDO3,
34 MAX77663_REGULATOR_ID_LDO4,
35 MAX77663_REGULATOR_ID_LDO5,
36 MAX77663_REGULATOR_ID_LDO6,
37 MAX77663_REGULATOR_ID_LDO7,
38 MAX77663_REGULATOR_ID_LDO8,
39 MAX77663_REGULATOR_ID_NR,
40};
41
42/* FPS Power Up/Down Period */
43enum max77663_regulator_fps_power_period {
44 FPS_POWER_PERIOD_0,
45 FPS_POWER_PERIOD_1,
46 FPS_POWER_PERIOD_2,
47 FPS_POWER_PERIOD_3,
48 FPS_POWER_PERIOD_4,
49 FPS_POWER_PERIOD_5,
50 FPS_POWER_PERIOD_6,
51 FPS_POWER_PERIOD_7,
52 FPS_POWER_PERIOD_DEF = -1,
53};
54
55/* FPS Time Period */
56enum max77663_regulator_fps_time_period {
57 FPS_TIME_PERIOD_20US,
58 FPS_TIME_PERIOD_40US,
59 FPS_TIME_PERIOD_80US,
60 FPS_TIME_PERIOD_160US,
61 FPS_TIME_PERIOD_320US,
62 FPS_TIME_PERIOD_640US,
63 FPS_TIME_PERIOD_1280US,
64 FPS_TIME_PERIOD_2560US,
65 FPS_TIME_PERIOD_DEF = -1,
66};
67
68/* FPS Enable Source */
69enum max77663_regulator_fps_en_src {
70 FPS_EN_SRC_EN0,
71 FPS_EN_SRC_EN1,
72 FPS_EN_SRC_SW,
73 FPS_EN_SRC_RSVD,
74};
75
76/* FPS Source */
77enum max77663_regulator_fps_src {
78 FPS_SRC_0,
79 FPS_SRC_1,
80 FPS_SRC_2,
81 FPS_SRC_NONE,
82 FPS_SRC_DEF = -1,
83};
84
85/*
86 * Flags
87 */
88/* SD0 is controlled by EN2 */
89#define EN2_CTRL_SD0 0x01
90
91/* SD Slew Rate */
92#define SD_SLEW_RATE_SLOWEST 0x02 /* 13.75mV/us */
93#define SD_SLEW_RATE_SLOW 0x04 /* 27.50mV/us */
94#define SD_SLEW_RATE_FAST 0x08 /* 55.00mV/us */
95#define SD_SLEW_RATE_FASTEST 0x10 /* 100.00mV/us */
96#define SD_SLEW_RATE_MASK 0x1E
97
98/* SD Forced PWM Mode */
99#define SD_FORCED_PWM_MODE 0x20
100
101/* SD Failling Slew Rate Active-Discharge Mode */
102#define SD_FSRADE_DISABLE 0x40
103
104/* Group Low-Power Mode */
105#define GLPM_ENABLE 0x80
106
107/* Tracking for LDO4 */
108#define LDO4_EN_TRACKING 0x100
109
110struct max77663_regulator_fps_cfg {
111 enum max77663_regulator_fps_src src;
112 enum max77663_regulator_fps_en_src en_src;
113 enum max77663_regulator_fps_time_period time_period;
114};
115
116struct max77663_regulator_platform_data {
117 struct regulator_init_data init_data;
118 bool init_apply;
119 bool init_enable;
120 int init_uV;
121 enum max77663_regulator_fps_src fps_src;
122 enum max77663_regulator_fps_power_period fps_pu_period;
123 enum max77663_regulator_fps_power_period fps_pd_period;
124
125 int num_fps_cfgs;
126 struct max77663_regulator_fps_cfg *fps_cfgs;
127
128 unsigned int flags;
129};
130
131#endif /* __LINUX_REGULATOR_MAX77663_REGULATOR_H__ */
diff --git a/include/linux/regulator/max8907c-regulator.h b/include/linux/regulator/max8907c-regulator.h
new file mode 100644
index 00000000000..ddc5f0a6033
--- /dev/null
+++ b/include/linux/regulator/max8907c-regulator.h
@@ -0,0 +1,46 @@
1/* linux/regulator/max8907c-regulator.h
2 *
3 * Functions to access MAX8907C power management chip.
4 *
5 * Copyright (C) 2010 Gyungoh Yoo <jack.yoo@maxim-ic.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef __LINUX_REGULATOR_MAX8907C_H
13#define __LINUX_REGULATOR_MAX8907C_H
14
15/* IDs */
16#define MAX8907C_SD1 0
17#define MAX8907C_SD2 1
18#define MAX8907C_SD3 2
19#define MAX8907C_LDO1 3
20#define MAX8907C_LDO2 4
21#define MAX8907C_LDO3 5
22#define MAX8907C_LDO4 6
23#define MAX8907C_LDO5 7
24#define MAX8907C_LDO6 8
25#define MAX8907C_LDO7 9
26#define MAX8907C_LDO8 10
27#define MAX8907C_LDO9 11
28#define MAX8907C_LDO10 12
29#define MAX8907C_LDO11 13
30#define MAX8907C_LDO12 14
31#define MAX8907C_LDO13 15
32#define MAX8907C_LDO14 16
33#define MAX8907C_LDO15 17
34#define MAX8907C_LDO16 18
35#define MAX8907C_LDO17 19
36#define MAX8907C_LDO18 20
37#define MAX8907C_LDO19 21
38#define MAX8907C_LDO20 22
39#define MAX8907C_OUT5V 23
40#define MAX8907C_OUT33V 24
41#define MAX8907C_BBAT 25
42#define MAX8907C_SDBY 26
43#define MAX8907C_VRTC 27
44#define MAX8907C_WLED 27
45
46#endif
diff --git a/include/linux/regulator/ricoh583-regulator.h b/include/linux/regulator/ricoh583-regulator.h
new file mode 100644
index 00000000000..39fdb9e56e0
--- /dev/null
+++ b/include/linux/regulator/ricoh583-regulator.h
@@ -0,0 +1,63 @@
1/*
2 * linux/regulator/ricoh583-regulator.h
3 *
4 * Interface for regulator driver for RICOH583 power management chip.
5 *
6 * Copyright (C) 2011 NVIDIA Corporation
7 *
8 * Copyright (C) 2011 RICOH COMPANY,LTD
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 as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful, but WITHOUT
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
18 * 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 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 *
24 */
25
26#ifndef __LINUX_REGULATOR_RICOH583_H
27#define __LINUX_REGULATOR_RICOH583_H
28
29#include <linux/regulator/machine.h>
30
31
32#define ricoh583_rails(_name) "RICOH583_"#_name
33
34/* RICHOH Regulator IDs */
35enum regulator_id {
36 RICOH583_ID_DC0,
37 RICOH583_ID_DC1,
38 RICOH583_ID_DC2,
39 RICOH583_ID_DC3,
40 RICOH583_ID_LDO0,
41 RICOH583_ID_LDO1,
42 RICOH583_ID_LDO2,
43 RICOH583_ID_LDO3,
44 RICOH583_ID_LDO4,
45 RICOH583_ID_LDO5,
46 RICOH583_ID_LDO6,
47 RICOH583_ID_LDO7,
48 RICOH583_ID_LDO8,
49 RICOH583_ID_LDO9,
50};
51
52struct ricoh583_regulator_platform_data {
53 struct regulator_init_data regulator;
54 int init_uV;
55 unsigned init_enable:1;
56 unsigned init_apply:1;
57 int deepsleep_uV;
58 int deepsleep_slots;
59 unsigned long ext_pwr_req;
60 unsigned long flags;
61};
62
63#endif
diff --git a/include/linux/regulator/tps62360.h b/include/linux/regulator/tps62360.h
new file mode 100644
index 00000000000..6a5c1b2c751
--- /dev/null
+++ b/include/linux/regulator/tps62360.h
@@ -0,0 +1,57 @@
1/*
2 * tps62360.h -- TI tps62360
3 *
4 * Interface for regulator driver for TI TPS62360 Processor core supply
5 *
6 * Copyright (C) 2012 NVIDIA Corporation
7
8 * Author: Laxman Dewangan <ldewangan@nvidia.com>
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 as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful, but WITHOUT
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
18 * 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 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 *
24 */
25
26#ifndef __LINUX_REGULATOR_TPS62360_H
27#define __LINUX_REGULATOR_TPS62360_H
28
29#include <linux/regulator/machine.h>
30
31/*
32 * struct tps62360_regulator_platform_data - tps62360 regulator platform data.
33 *
34 * @reg_init_data: The regulator init data.
35 * @en_force_pwm: Enable force pwm or not.
36 * @en_discharge: Enable discharge the output capacitor via internal
37 * register.
38 * @en_internal_pulldn: internal pull down enable or not.
39 * @vsel0_gpio: Gpio number for vsel0. It should be -1 if this is tied with
40 * fixed logic.
41 * @vsel1_gpio: Gpio number for vsel1. It should be -1 if this is tied with
42 * fixed logic.
43 * @vsel0_def_state: Default state of vsel0. 1 if it is high else 0.
44 * @vsel1_def_state: Default state of vsel1. 1 if it is high else 0.
45 */
46struct tps62360_regulator_platform_data {
47 struct regulator_init_data reg_init_data;
48 bool en_force_pwm;
49 bool en_discharge;
50 bool en_internal_pulldn;
51 int vsel0_gpio;
52 int vsel1_gpio;
53 int vsel0_def_state;
54 int vsel1_def_state;
55};
56
57#endif /* __LINUX_REGULATOR_TPS62360_H */
diff --git a/include/linux/regulator/tps6236x-regulator.h b/include/linux/regulator/tps6236x-regulator.h
new file mode 100644
index 00000000000..7e8a3752966
--- /dev/null
+++ b/include/linux/regulator/tps6236x-regulator.h
@@ -0,0 +1,54 @@
1/*
2 * include/linux/regulator/tps6236x.h
3 *
4 * Interface for regulator driver for TI TPS6236x Processor core supply
5 *
6 * Copyright (C) 2011 NVIDIA Corporation
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, but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 * 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 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 *
22 */
23
24#ifndef __REGULATOR_TPS6236X_H
25#define __REGULATOR_TPS6236X_H
26
27#include <linux/regulator/machine.h>
28
29/*
30 * struct tps6236x_regulator_platform_data - tps6236x regulator platform data.
31 *
32 * @reg_init_data: The regulator init data.
33 * @internal_pd_enable: internal pull down enable or not.
34 * @vsel: Select the voltage id register.
35 * @init_uV: initial micro volts which need to be set.
36 * @init_enable: Enable or do not enable the rails during initialization.
37 * @init_apply: Init parameter applied or not.
38 * @is_force_pwm: Enable force pwm or not. If not then PFM mode configuration
39 * will be used.
40 * @enable_discharge: Enable discharge the output capacitor via a typ. 300Ohm
41 * path
42 */
43
44struct tps6236x_regulator_platform_data {
45 struct regulator_init_data reg_init_data;
46 int internal_pd_enable;
47 int vsel;
48 int init_uV;
49 unsigned init_apply:1;
50 bool is_force_pwm;
51 bool enable_discharge;
52};
53
54#endif /* __REGULATOR_TPS6236X_H */
diff --git a/include/linux/regulator/tps65090-regulator.h b/include/linux/regulator/tps65090-regulator.h
new file mode 100644
index 00000000000..341d53ec994
--- /dev/null
+++ b/include/linux/regulator/tps65090-regulator.h
@@ -0,0 +1,60 @@
1/*
2 * include/linux/regulator/tps65090-regulator.h
3 *
4 * Interface for regulator driver for TI TPS65090 PMIC family
5 *
6 * Copyright (C) 2012 NVIDIA Corporation
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, but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 * 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 Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 *
22 */
23
24#ifndef __REGULATOR_TPS65090_H
25#define __REGULATOR_TPS65090_H
26
27#include <linux/regulator/machine.h>
28
29#define tps65090_rails(_name) "tps65090_"#_name
30
31enum {
32 TPS65090_ID_DCDC1,
33 TPS65090_ID_DCDC2,
34 TPS65090_ID_DCDC3,
35 TPS65090_ID_FET1,
36 TPS65090_ID_FET2,
37 TPS65090_ID_FET3,
38 TPS65090_ID_FET4,
39 TPS65090_ID_FET5,
40 TPS65090_ID_FET6,
41 TPS65090_ID_FET7,
42};
43
44/*
45 * struct tps65090_regulator_platform_data
46 *
47 * @regulator: The regulator init data.
48 * @init_uV: initial micro volts which need to be set.
49 * @init_enable: Enable or do not enable the rails during initialization.
50 * @init_apply: Init parameter applied or not.
51 * @slew_rate_uV_per_us: Slew rate microvolt per microsec.
52 */
53
54struct tps65090_regulator_platform_data {
55 struct regulator_init_data regulator;
56 int slew_rate_uV_per_us;
57 unsigned int flags;
58};
59
60#endif /* __REGULATOR_TPS65090_H */
diff --git a/include/linux/regulator/tps6591x-regulator.h b/include/linux/regulator/tps6591x-regulator.h
new file mode 100644
index 00000000000..7f7f647906d
--- /dev/null
+++ b/include/linux/regulator/tps6591x-regulator.h
@@ -0,0 +1,77 @@
1/*
2 * include/linux/regulator/tps6591x-regulator.h
3 *
4 * Interface for regulator driver for TI TPS6591x PMIC family
5 *
6 * Copyright (C) 2011 NVIDIA Corporation
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, but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 * 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 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 *
22 */
23
24#ifndef __REGULATOR_TPS6591X_H
25#define __REGULATOR_TPS6591X_H
26
27#include <linux/regulator/machine.h>
28
29#define tps6591x_rails(_name) "tps6591x_"#_name
30
31enum {
32 TPS6591X_ID_VIO,
33 TPS6591X_ID_VDD_1,
34 TPS6591X_ID_VDD_2,
35 TPS6591X_ID_VDDCTRL,
36 TPS6591X_ID_LDO_1,
37 TPS6591X_ID_LDO_2,
38 TPS6591X_ID_LDO_3,
39 TPS6591X_ID_LDO_4,
40 TPS6591X_ID_LDO_5,
41 TPS6591X_ID_LDO_6,
42 TPS6591X_ID_LDO_7,
43 TPS6591X_ID_LDO_8,
44};
45
46enum tps6591x_ext_control {
47 EXT_CTRL_NONE = 0x0,
48 EXT_CTRL_EN1,
49 EXT_CTRL_EN2,
50 EXT_CTRL_SLEEP_OFF,
51};
52
53enum tps6591x_config_flags {
54 LDO_LOW_POWER_ON_SUSPEND = 0x1,
55};
56
57/*
58 * struct tps6591x_regulator_platform_data - tps6591x regulator platform data.
59 *
60 * @regulator: The regulator init data.
61 * @init_uV: initial micro volts which need to be set.
62 * @init_enable: Enable or do not enable the rails during initialization.
63 * @init_apply: Init parameter applied or not.
64 * @slew_rate_uV_per_us: Slew rate microvolt per microsec.
65 */
66
67struct tps6591x_regulator_platform_data {
68 struct regulator_init_data regulator;
69 int init_uV;
70 unsigned init_enable:1;
71 unsigned init_apply:1;
72 enum tps6591x_ext_control ectrl;
73 int slew_rate_uV_per_us;
74 unsigned int flags;
75};
76
77#endif /* __REGULATOR_TPS6591X_H */
diff --git a/include/linux/regulator/tps80031-regulator.h b/include/linux/regulator/tps80031-regulator.h
new file mode 100644
index 00000000000..1670d147fc3
--- /dev/null
+++ b/include/linux/regulator/tps80031-regulator.h
@@ -0,0 +1,89 @@
1/*
2 * include/linux/regulator/tps80031-regulator.h
3 *
4 * Interface for regulator driver for TI TPS80031
5 *
6 * Copyright (C) 2011 NVIDIA Corporation
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, but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 * 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 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 *
22 */
23
24#ifndef __REGULATOR_TPS80031_H
25#define __REGULATOR_TPS80031_H
26
27#include <linux/regulator/machine.h>
28
29#define tps80031_rails(_name) "tps80031_"#_name
30
31enum {
32 TPS80031_ID_VIO,
33 TPS80031_ID_SMPS1,
34 TPS80031_ID_SMPS2,
35 TPS80031_ID_SMPS3,
36 TPS80031_ID_SMPS4,
37 TPS80031_ID_VANA,
38 TPS80031_ID_LDO1,
39 TPS80031_ID_LDO2,
40 TPS80031_ID_LDO3,
41 TPS80031_ID_LDO4,
42 TPS80031_ID_LDO5,
43 TPS80031_ID_LDO6,
44 TPS80031_ID_LDO7,
45 TPS80031_ID_LDOLN,
46 TPS80031_ID_LDOUSB,
47 TPS80031_ID_VBUS,
48 TPS80031_ID_CHARGER,
49};
50
51
52enum {
53 /* USBLDO input selection */
54 USBLDO_INPUT_VSYS = 0x00000001,
55 USBLDO_INPUT_PMID = 0x00000002,
56
57 /* LDO3 output mode */
58 LDO3_OUTPUT_VIB = 0x00000004,
59
60 /* VBUS configuration */
61 VBUS_DISCHRG_EN_PDN = 0x00000004,
62 VBUS_SW_ONLY = 0x00000008,
63 VBUS_SW_N_ID = 0x00000010,
64};
65
66/*
67 * struct tps80031_regulator_platform_data - tps80031 regulator platform data.
68 *
69 * @regulator: The regulator init data.
70 * @init_uV: initial micro volts which need to be set.
71 * @init_enable: Enable or do not enable the rails during initialization.
72 * @init_apply: Init parameter applied or not.
73 * @ext_ctrl_flag: External control flag for sleep/power request control.
74 * @flags: Configuration flag to configure the rails. It should be ORed of
75 * above enums.
76 * @delay_us: Delay in microsecond after setting the desired voltage.
77 */
78
79struct tps80031_regulator_platform_data {
80 struct regulator_init_data regulator;
81 int init_uV;
82 unsigned init_enable:1;
83 unsigned init_apply:1;
84 unsigned int ext_ctrl_flag;
85 unsigned int flags;
86 int delay_us;
87};
88
89#endif /* __REGULATOR_TPS80031_H */
diff --git a/include/linux/reiserfs_acl.h b/include/linux/reiserfs_acl.h
index 3fd8c4506bb..f096b80e73d 100644
--- a/include/linux/reiserfs_acl.h
+++ b/include/linux/reiserfs_acl.h
@@ -59,11 +59,7 @@ extern const struct xattr_handler reiserfs_posix_acl_access_handler;
59#else 59#else
60 60
61#define reiserfs_cache_default_acl(inode) 0 61#define reiserfs_cache_default_acl(inode) 0
62 62#define reiserfs_get_acl NULL
63static inline struct posix_acl *reiserfs_get_acl(struct inode *inode, int type)
64{
65 return NULL;
66}
67 63
68static inline int reiserfs_acl_chmod(struct inode *inode) 64static inline int reiserfs_acl_chmod(struct inode *inode)
69{ 65{
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h
index eca75df00fe..96d465f8d3e 100644
--- a/include/linux/reiserfs_fs.h
+++ b/include/linux/reiserfs_fs.h
@@ -2332,7 +2332,9 @@ __u32 keyed_hash(const signed char *msg, int len);
2332__u32 yura_hash(const signed char *msg, int len); 2332__u32 yura_hash(const signed char *msg, int len);
2333__u32 r5_hash(const signed char *msg, int len); 2333__u32 r5_hash(const signed char *msg, int len);
2334 2334
2335#define reiserfs_set_le_bit __set_bit_le
2335#define reiserfs_test_and_set_le_bit __test_and_set_bit_le 2336#define reiserfs_test_and_set_le_bit __test_and_set_bit_le
2337#define reiserfs_clear_le_bit __clear_bit_le
2336#define reiserfs_test_and_clear_le_bit __test_and_clear_bit_le 2338#define reiserfs_test_and_clear_le_bit __test_and_clear_bit_le
2337#define reiserfs_test_le_bit test_bit_le 2339#define reiserfs_test_le_bit test_bit_le
2338#define reiserfs_find_next_zero_le_bit find_next_zero_bit_le 2340#define reiserfs_find_next_zero_le_bit find_next_zero_bit_le
diff --git a/include/linux/reiserfs_xattr.h b/include/linux/reiserfs_xattr.h
index 6deef5dc95f..c2b71473266 100644
--- a/include/linux/reiserfs_xattr.h
+++ b/include/linux/reiserfs_xattr.h
@@ -41,7 +41,7 @@ int reiserfs_xattr_init(struct super_block *sb, int mount_flags);
41int reiserfs_lookup_privroot(struct super_block *sb); 41int reiserfs_lookup_privroot(struct super_block *sb);
42int reiserfs_delete_xattrs(struct inode *inode); 42int reiserfs_delete_xattrs(struct inode *inode);
43int reiserfs_chown_xattrs(struct inode *inode, struct iattr *attrs); 43int reiserfs_chown_xattrs(struct inode *inode, struct iattr *attrs);
44int reiserfs_permission(struct inode *inode, int mask, unsigned int flags); 44int reiserfs_permission(struct inode *inode, int mask);
45 45
46#ifdef CONFIG_REISERFS_FS_XATTR 46#ifdef CONFIG_REISERFS_FS_XATTR
47#define has_xattr_dir(inode) (REISERFS_I(inode)->i_flags & i_has_xattr_dir) 47#define has_xattr_dir(inode) (REISERFS_I(inode)->i_flags & i_has_xattr_dir)
diff --git a/include/linux/ring_buffer.h b/include/linux/ring_buffer.h
index ab38ac80b0f..b891de96000 100644
--- a/include/linux/ring_buffer.h
+++ b/include/linux/ring_buffer.h
@@ -169,7 +169,7 @@ void ring_buffer_set_clock(struct ring_buffer *buffer,
169size_t ring_buffer_page_len(void *page); 169size_t ring_buffer_page_len(void *page);
170 170
171 171
172void *ring_buffer_alloc_read_page(struct ring_buffer *buffer); 172void *ring_buffer_alloc_read_page(struct ring_buffer *buffer, int cpu);
173void ring_buffer_free_read_page(struct ring_buffer *buffer, void *data); 173void ring_buffer_free_read_page(struct ring_buffer *buffer, void *data);
174int ring_buffer_read_page(struct ring_buffer *buffer, void **data_page, 174int ring_buffer_read_page(struct ring_buffer *buffer, void **data_page,
175 size_t len, int cpu, int full); 175 size_t len, int cpu, int full);
diff --git a/include/linux/rio_regs.h b/include/linux/rio_regs.h
index 9026b30238f..218168a2b5e 100644
--- a/include/linux/rio_regs.h
+++ b/include/linux/rio_regs.h
@@ -36,12 +36,12 @@
36#define RIO_PEF_PROCESSOR 0x20000000 /* [I] Processor */ 36#define RIO_PEF_PROCESSOR 0x20000000 /* [I] Processor */
37#define RIO_PEF_SWITCH 0x10000000 /* [I] Switch */ 37#define RIO_PEF_SWITCH 0x10000000 /* [I] Switch */
38#define RIO_PEF_MULTIPORT 0x08000000 /* [VI, 2.1] Multiport */ 38#define RIO_PEF_MULTIPORT 0x08000000 /* [VI, 2.1] Multiport */
39#define RIO_PEF_INB_MBOX 0x00f00000 /* [II] Mailboxes */ 39#define RIO_PEF_INB_MBOX 0x00f00000 /* [II, <= 1.2] Mailboxes */
40#define RIO_PEF_INB_MBOX0 0x00800000 /* [II] Mailbox 0 */ 40#define RIO_PEF_INB_MBOX0 0x00800000 /* [II, <= 1.2] Mailbox 0 */
41#define RIO_PEF_INB_MBOX1 0x00400000 /* [II] Mailbox 1 */ 41#define RIO_PEF_INB_MBOX1 0x00400000 /* [II, <= 1.2] Mailbox 1 */
42#define RIO_PEF_INB_MBOX2 0x00200000 /* [II] Mailbox 2 */ 42#define RIO_PEF_INB_MBOX2 0x00200000 /* [II, <= 1.2] Mailbox 2 */
43#define RIO_PEF_INB_MBOX3 0x00100000 /* [II] Mailbox 3 */ 43#define RIO_PEF_INB_MBOX3 0x00100000 /* [II, <= 1.2] Mailbox 3 */
44#define RIO_PEF_INB_DOORBELL 0x00080000 /* [II] Doorbells */ 44#define RIO_PEF_INB_DOORBELL 0x00080000 /* [II, <= 1.2] Doorbells */
45#define RIO_PEF_EXT_RT 0x00000200 /* [III, 1.3] Extended route table support */ 45#define RIO_PEF_EXT_RT 0x00000200 /* [III, 1.3] Extended route table support */
46#define RIO_PEF_STD_RT 0x00000100 /* [III, 1.3] Standard route table support */ 46#define RIO_PEF_STD_RT 0x00000100 /* [III, 1.3] Standard route table support */
47#define RIO_PEF_CTLS 0x00000010 /* [III] CTLS */ 47#define RIO_PEF_CTLS 0x00000010 /* [III] CTLS */
@@ -102,7 +102,7 @@
102#define RIO_SWITCH_RT_LIMIT 0x34 /* [III, 1.3] Switch Route Table Destination ID Limit CAR */ 102#define RIO_SWITCH_RT_LIMIT 0x34 /* [III, 1.3] Switch Route Table Destination ID Limit CAR */
103#define RIO_RT_MAX_DESTID 0x0000ffff 103#define RIO_RT_MAX_DESTID 0x0000ffff
104 104
105#define RIO_MBOX_CSR 0x40 /* [II] Mailbox CSR */ 105#define RIO_MBOX_CSR 0x40 /* [II, <= 1.2] Mailbox CSR */
106#define RIO_MBOX0_AVAIL 0x80000000 /* [II] Mbox 0 avail */ 106#define RIO_MBOX0_AVAIL 0x80000000 /* [II] Mbox 0 avail */
107#define RIO_MBOX0_FULL 0x40000000 /* [II] Mbox 0 full */ 107#define RIO_MBOX0_FULL 0x40000000 /* [II] Mbox 0 full */
108#define RIO_MBOX0_EMPTY 0x20000000 /* [II] Mbox 0 empty */ 108#define RIO_MBOX0_EMPTY 0x20000000 /* [II] Mbox 0 empty */
@@ -128,8 +128,8 @@
128#define RIO_MBOX3_FAIL 0x00000008 /* [II] Mbox 3 fail */ 128#define RIO_MBOX3_FAIL 0x00000008 /* [II] Mbox 3 fail */
129#define RIO_MBOX3_ERROR 0x00000004 /* [II] Mbox 3 error */ 129#define RIO_MBOX3_ERROR 0x00000004 /* [II] Mbox 3 error */
130 130
131#define RIO_WRITE_PORT_CSR 0x44 /* [I] Write Port CSR */ 131#define RIO_WRITE_PORT_CSR 0x44 /* [I, <= 1.2] Write Port CSR */
132#define RIO_DOORBELL_CSR 0x44 /* [II] Doorbell CSR */ 132#define RIO_DOORBELL_CSR 0x44 /* [II, <= 1.2] Doorbell CSR */
133#define RIO_DOORBELL_AVAIL 0x80000000 /* [II] Doorbell avail */ 133#define RIO_DOORBELL_AVAIL 0x80000000 /* [II] Doorbell avail */
134#define RIO_DOORBELL_FULL 0x40000000 /* [II] Doorbell full */ 134#define RIO_DOORBELL_FULL 0x40000000 /* [II] Doorbell full */
135#define RIO_DOORBELL_EMPTY 0x20000000 /* [II] Doorbell empty */ 135#define RIO_DOORBELL_EMPTY 0x20000000 /* [II] Doorbell empty */
diff --git a/include/linux/rmi.h b/include/linux/rmi.h
new file mode 100644
index 00000000000..84e121d936a
--- /dev/null
+++ b/include/linux/rmi.h
@@ -0,0 +1,656 @@
1/*
2 * Copyright (c) 2011 Synaptics Incorporated
3 * Copyright (c) 2011 Unixphere
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19#ifndef _RMI_H
20#define _RMI_H
21#include <linux/kernel.h>
22#include <linux/lockdep.h>
23#include <linux/module.h>
24#include <linux/types.h>
25#include <linux/device.h>
26#include <linux/cdev.h>
27#include <linux/mutex.h>
28#include <linux/stat.h>
29#include <linux/wait.h>
30#include <linux/list.h>
31#include <linux/interrupt.h>
32
33#ifdef CONFIG_HAS_EARLYSUSPEND
34#include <linux/earlysuspend.h>
35#endif
36
37#ifdef CONFIG_TOUCHSCREEN_SYN_RMI4_SPI
38
39#define CONFIG_RMI4_BUS
40#define CONFIG_RMI4_SPI
41#define CONFIG_RMI4_GENERIC
42#define CONFIG_RMI4_F09
43#define CONFIG_RMI4_F11
44#define CONFIG_RMI4_F19
45#define CONFIG_RMI4_F34
46#define CONFIG_RMI4_F54
47#define CONFIG_RMI4_DEV
48
49#endif
50
51// #define SYNAPTICS_SENSOR_POLL 1
52
53/* Permissions for sysfs attributes. Since the permissions policy will change
54 * on a global basis in the future, rather than edit all sysfs attrs everywhere
55 * in the driver (and risk screwing that up in the process), we use this handy
56 * set of #defines. That way when we change the policy for sysfs permissions,
57 * we only need to change them here.
58 */
59#define RMI_RO_ATTR S_IRUGO
60#define RMI_RW_ATTR (S_IRUGO | S_IWUGO)
61#define RMI_WO_ATTR S_IWUGO
62
63#define PDT_START_SCAN_LOCATION 0x00e9
64
65enum rmi_irq_polarity {
66 RMI_IRQ_ACTIVE_LOW = 0,
67 RMI_IRQ_ACTIVE_HIGH = 1
68};
69
70/**
71 * struct rmi_f11_axis_alignmen - target axis alignment
72 * @swap_axes: set to TRUE if desired to swap x- and y-axis
73 * @flip_x: set to TRUE if desired to flip direction on x-axis
74 * @flip_y: set to TRUE if desired to flip direction on y-axis
75 */
76struct rmi_f11_2d_axis_alignment {
77 bool swap_axes;
78 bool flip_x;
79 bool flip_y;
80 int clip_X_low;
81 int clip_Y_low;
82 int clip_X_high;
83 int clip_Y_high;
84 int offset_X;
85 int offset_Y;
86 int rel_report_enabled;
87};
88
89/**
90 * RMI F11 - function control register parameters
91 * Each register that has a specific bit-field setup has an accompanied
92 * register definition so that the setting can be chosen as a one-word
93 * register setting or per-bit setting.
94 */
95union rmi_f11_2d_ctrl0 {
96 struct {
97 u8 reporting_mode:3;
98 u8 abs_pos_filt:1;
99 u8 rel_pos_filt:1;
100 u8 rel_ballistics:1;
101 u8 dribble:1;
102 u8 report_beyond_clip:1;
103 };
104 u8 reg;
105};
106
107union rmi_f11_2d_ctrl1 {
108 struct {
109 u8 palm_detect_thres:4;
110 u8 motion_sensitivity:2;
111 u8 man_track_en:1;
112 u8 man_tracked_finger:1;
113 };
114 u8 reg;
115};
116
117union rmi_f11_2d_ctrl2__3 {
118 struct {
119 u8 delta_x_threshold:8;
120 u8 delta_y_threshold:8;
121 };
122 u8 regs[2];
123};
124
125union rmi_f11_2d_ctrl4 {
126 struct {
127 u8 velocity:8;
128 };
129 u8 reg;
130};
131
132union rmi_f11_2d_ctrl5 {
133 struct {
134 u8 acceleration:8;
135 };
136 u8 reg;
137};
138
139union rmi_f11_2d_ctrl6__7 {
140 struct {
141 u16 sensor_max_x_pos:12;
142 };
143 u8 regs[2];
144};
145
146union rmi_f11_2d_ctrl8__9 {
147 struct {
148 u16 sensor_max_y_pos:12;
149 };
150 u8 regs[2];
151};
152
153union rmi_f11_2d_ctrl10 {
154 struct {
155 u8 single_tap_int_enable:1;
156 u8 tap_n_hold_int_enable:1;
157 u8 double_tap_int_enable:1;
158 u8 early_tap_int_enable:1;
159 u8 flick_int_enable:1;
160 u8 press_int_enable:1;
161 u8 pinch_int_enable:1;
162 };
163 u8 reg;
164};
165
166union rmi_f11_2d_ctrl11 {
167 struct {
168 u8 palm_detect_int_enable:1;
169 u8 rotate_int_enable:1;
170 u8 touch_shape_int_enable:1;
171 u8 scroll_zone_int_enable:1;
172 u8 multi_finger_scroll_int_enable:1;
173 };
174 u8 reg;
175};
176
177union rmi_f11_2d_ctrl12 {
178 struct {
179 u8 sensor_map:7;
180 u8 xy_sel:1;
181 };
182 u8 reg;
183};
184
185union rmi_f11_2d_ctrl14 {
186 struct {
187 u8 sens_adjustment:5;
188 u8 hyst_adjustment:3;
189 };
190 u8 reg;
191};
192
193/* The configuation is controlled as per register which means that if a register
194 * is allocated for ctrl configuration one must make sure that all the bits are
195 * set accordingly for that particular register.
196 */
197struct rmi_f11_2d_ctrl {
198 union rmi_f11_2d_ctrl0 *ctrl0;
199 union rmi_f11_2d_ctrl1 *ctrl1;
200 union rmi_f11_2d_ctrl2__3 *ctrl2__3;
201 union rmi_f11_2d_ctrl4 *ctrl4;
202 union rmi_f11_2d_ctrl5 *ctrl5;
203 union rmi_f11_2d_ctrl6__7 *ctrl6__7;
204 union rmi_f11_2d_ctrl8__9 *ctrl8__9;
205 union rmi_f11_2d_ctrl10 *ctrl10;
206 union rmi_f11_2d_ctrl11 *ctrl11;
207 union rmi_f11_2d_ctrl12 *ctrl12;
208 u8 ctrl12_size;
209 union rmi_f11_2d_ctrl14 *ctrl14;
210 u8 *ctrl15;
211 u8 *ctrl16;
212 u8 *ctrl17;
213 u8 *ctrl18;
214 u8 *ctrl19;
215};
216
217struct rmi_f19_button_map {
218 unsigned char nbuttons;
219 unsigned char *map;
220};
221
222struct rmi_device_platform_data_spi {
223 int block_delay_us;
224 int split_read_block_delay_us;
225 int read_delay_us;
226 int write_delay_us;
227 int split_read_byte_delay_us;
228 int pre_delay_us;
229 int post_delay_us;
230
231 void *cs_assert_data;
232 int (*cs_assert) (const void *cs_assert_data, const bool assert);
233};
234
235struct rmi_device_platform_data {
236 char *driver_name;
237
238 int irq;
239 enum rmi_irq_polarity irq_polarity;
240 int (*gpio_config)(void *gpio_data, bool configure);
241
242 struct rmi_device_platform_data_spi spi_data;
243
244 /* function handler pdata */
245 struct rmi_f11_2d_ctrl *f11_ctrl;
246 struct rmi_f11_2d_axis_alignment axis_align;
247 struct rmi_f19_button_map *button_map;
248
249#ifdef CONFIG_PM
250 void *pm_data;
251 int (*pre_suspend) (const void *pm_data);
252 int (*post_resume) (const void *pm_data);
253#endif
254};
255
256/**
257 * struct rmi_function_descriptor - RMI function base addresses
258 * @query_base_addr: The RMI Query base address
259 * @command_base_addr: The RMI Command base address
260 * @control_base_addr: The RMI Control base address
261 * @data_base_addr: The RMI Data base address
262 * @interrupt_source_count: The number of irqs this RMI function needs
263 * @function_number: The RMI function number
264 *
265 * This struct is used when iterating the Page Description Table. The addresses
266 * are 16-bit values to include the current page address.
267 *
268 */
269struct rmi_function_descriptor {
270 u16 query_base_addr;
271 u16 command_base_addr;
272 u16 control_base_addr;
273 u16 data_base_addr;
274 u8 interrupt_source_count;
275 u8 function_number;
276 u8 function_version;
277};
278
279struct rmi_function_container;
280struct rmi_device;
281
282/**
283 * struct rmi_function_handler - an RMI function handler
284 * @func: The RMI function number
285 * @init: Callback for RMI function init
286 * @attention: Callback for RMI function attention
287 * @suspend: Callback for function suspend, returns 0 for success.
288 * @resume: Callback for RMI function resume, returns 0 for success.
289 * @remove: Callback for RMI function removal
290 *
291 * This struct describes the interface of an RMI function. These are
292 * registered to the bus using the rmi_register_function_driver() call.
293 *
294 */
295struct rmi_function_handler {
296 int func;
297 int (*init)(struct rmi_function_container *fc);
298 int (*attention)(struct rmi_function_container *fc, u8 *irq_bits);
299#ifdef CONFIG_PM
300 int (*suspend)(struct rmi_function_container *fc);
301 int (*resume)(struct rmi_function_container *fc);
302#endif
303 void (*remove)(struct rmi_function_container *fc);
304};
305
306/**
307 * struct rmi_function_device - represent an RMI function device
308 * @dev: The device created
309 *
310 * The RMI function device implements the "psuedo" device that represents
311 * an RMI4 function like function 0x11, function 0x34, etc. and is really
312 * a placeholder to be able to create sysfs attributes for each function
313 * in order to facilitate communication between user code and RMI4 functions.
314 *
315 */
316struct rmi_function_device {
317 struct device dev;
318};
319
320/**
321 * struct rmi_function_container - an element in a function handler list
322 * @list: The list
323 * @fd: The function descriptor of the RMI function
324 * @rmi_dev: Pointer to the RMI device associated with this function container
325 * @fh: The callbacks connected to this function
326 * @num_of_irqs: The number of irqs needed by this function
327 * @irq_pos: The position in the irq bitfield this function holds
328 * @data: Private data pointer
329 *
330 */
331struct rmi_function_container {
332 struct list_head list;
333
334 struct rmi_function_descriptor fd;
335 struct rmi_device *rmi_dev;
336 struct rmi_function_handler *fh;
337 struct device dev;
338
339 int num_of_irqs;
340 int irq_pos;
341 u8 *irq_mask;
342
343 void *data;
344};
345#define to_rmi_function_container(d) \
346 container_of(d, struct rmi_function_container, dev);
347#define to_rmi_function_device(d) \
348 container_of(d, struct rmi_function_device, dev);
349
350
351#ifdef CONFIG_RMI4_DEV
352
353#define RMI_CHAR_DEV_TMPBUF_SZ 128
354#define RMI_REG_ADDR_PAGE_SELECT 0xFF
355
356struct rmi_char_dev {
357 /* mutex for file operation*/
358 struct mutex mutex_file_op;
359 /* main char dev structure */
360 struct cdev main_dev;
361
362 /* register address for RMI protocol */
363 /* filp->f_pos */
364
365 /* pointer to the corresponding phys device info for this sensor */
366 /* The phys device has the pointers to read, write, etc. */
367 struct rmi_phys_device *phys;
368 /* reference count */
369 int ref_count;
370};
371
372int rmi_char_dev_register(struct rmi_phys_device *phys);
373void rmi_char_dev_unregister(struct rmi_phys_device *phys);
374
375#endif /*CONFIG_RMI4_DEV*/
376
377
378
379/**
380 * struct rmi_driver - represents an RMI driver
381 * @driver: Device driver model driver
382 * @probe: Callback for device probe
383 * @remove: Callback for device removal
384 * @shutdown: Callback for device shutdown
385 * @irq_handler: Callback for handling irqs
386 * @fh_add: Callback for function handler add
387 * @fh_remove: Callback for function handler remove
388 * @get_func_irq_mask: Callback for calculating interrupt mask
389 * @store_irq_mask: Callback for storing and replacing interrupt mask
390 * @restore_irq_mask: Callback for restoring previously stored interrupt mask
391 * @data: Private data pointer
392 *
393 * The RMI driver implements a driver on the RMI bus.
394 *
395 */
396struct rmi_driver {
397 struct device_driver driver;
398
399 int (*probe)(struct rmi_device *rmi_dev);
400 int (*remove)(struct rmi_device *rmi_dev);
401 void (*shutdown)(struct rmi_device *rmi_dev);
402 int (*irq_handler)(struct rmi_device *rmi_dev, int irq);
403 void (*fh_add)(struct rmi_device *rmi_dev,
404 struct rmi_function_handler *fh);
405 void (*fh_remove)(struct rmi_device *rmi_dev,
406 struct rmi_function_handler *fh);
407 u8* (*get_func_irq_mask)(struct rmi_device *rmi_dev,
408 struct rmi_function_container *fc);
409 int (*store_irq_mask)(struct rmi_device *rmi_dev, u8* new_interupts);
410 int (*restore_irq_mask)(struct rmi_device *rmi_dev);
411 void *data;
412};
413#define to_rmi_driver(d) \
414 container_of(d, struct rmi_driver, driver);
415
416/** struct rmi_phys_info - diagnostic information about the RMI physical
417 * device, used in the phys sysfs file.
418 * @proto String indicating the protocol being used.
419 * @tx_count Number of transmit operations.
420 * @tx_bytes Number of bytes transmitted.
421 * @tx_errs Number of errors encountered during transmit operations.
422 * @rx_count Number of receive operations.
423 * @rx_bytes Number of bytes received.
424 * @rx_errs Number of errors encountered during receive operations.
425 * @att_count Number of times ATTN assertions have been handled.
426 */
427struct rmi_phys_info {
428 char *proto;
429 long tx_count;
430 long tx_bytes;
431 long tx_errs;
432 long rx_count;
433 long rx_bytes;
434 long rx_errs;
435 long attn_count;
436};
437
438/**
439 * struct rmi_phys_device - represent an RMI physical device
440 * @dev: Pointer to the communication device, e.g. i2c or spi
441 * @rmi_dev: Pointer to the RMI device
442 * @write: Callback for write
443 * @write_block: Callback for writing a block of data
444 * @read: Callback for read
445 * @read_block: Callback for reading a block of data
446 * @data: Private data pointer
447 *
448 * The RMI physical device implements the glue between different communication
449 * buses such as I2C and SPI.
450 *
451 */
452struct rmi_phys_device {
453 struct device *dev;
454 struct rmi_device *rmi_dev;
455
456 int (*write)(struct rmi_phys_device *phys, u16 addr, u8 data);
457 int (*write_block)(struct rmi_phys_device *phys, u16 addr, u8 *buf,
458 int len);
459 int (*read)(struct rmi_phys_device *phys, u16 addr, u8 *buf);
460 int (*read_block)(struct rmi_phys_device *phys, u16 addr, u8 *buf,
461 int len);
462
463 int (*enable_device) (struct rmi_phys_device *phys);
464 void (*disable_device) (struct rmi_phys_device *phys);
465
466 void *data;
467
468 struct rmi_phys_info info;
469
470#ifdef CONFIG_RMI4_DEV
471 /* pointer to attention char device and char device */
472 struct rmi_char_dev *char_dev;
473 struct class *rmi_char_device_class;
474#endif /*CONFIG_RMI4_DEV*/
475};
476
477/**
478 * struct rmi_device - represents an RMI device
479 * @dev: The device created for the RMI bus
480 * @driver: Pointer to associated driver
481 * @phys: Pointer to the physical interface
482 * @early_suspend_handler: Pointers to early_suspend and late_resume, if
483 * configured.
484 *
485 * This structs represent an RMI device.
486 *
487 */
488struct rmi_device {
489 struct device dev;
490
491 struct rmi_driver *driver;
492 struct rmi_phys_device *phys;
493
494#ifdef CONFIG_HAS_EARLYSUSPEND
495 struct early_suspend early_suspend_handler;
496#endif
497};
498#define to_rmi_device(d) container_of(d, struct rmi_device, dev);
499#define to_rmi_platform_data(d) ((d)->phys->dev->platform_data);
500
501static inline void rmi_set_driverdata(struct rmi_device *d, void *data)
502{
503 dev_set_drvdata(&d->dev, data);
504}
505
506static inline void *rmi_get_driverdata(struct rmi_device *d)
507{
508 return dev_get_drvdata(&d->dev);
509}
510
511/**
512 * rmi_read - RMI read byte
513 * @d: Pointer to an RMI device
514 * @addr: The address to read from
515 * @buf: The read buffer
516 *
517 * Reads a byte of data using the underlaying physical protocol in to buf. It
518 * returns zero or a negative error code.
519 */
520static inline int rmi_read(struct rmi_device *d, u16 addr, u8 *buf)
521{
522 return d->phys->read(d->phys, addr, buf);
523}
524
525/**
526 * rmi_read_block - RMI read block
527 * @d: Pointer to an RMI device
528 * @addr: The start address to read from
529 * @buf: The read buffer
530 * @len: Length of the read buffer
531 *
532 * Reads a block of byte data using the underlaying physical protocol in to buf.
533 * It returns the amount of bytes read or a negative error code.
534 */
535static inline int rmi_read_block(struct rmi_device *d, u16 addr, u8 *buf,
536 int len)
537{
538 return d->phys->read_block(d->phys, addr, buf, len);
539}
540
541/**
542 * rmi_write - RMI write byte
543 * @d: Pointer to an RMI device
544 * @addr: The address to write to
545 * @data: The data to write
546 *
547 * Writes a byte from buf using the underlaying physical protocol. It
548 * returns zero or a negative error code.
549 */
550static inline int rmi_write(struct rmi_device *d, u16 addr, u8 data)
551{
552 return d->phys->write(d->phys, addr, data);
553}
554
555/**
556 * rmi_write_block - RMI write block
557 * @d: Pointer to an RMI device
558 * @addr: The start address to write to
559 * @buf: The write buffer
560 * @len: Length of the write buffer
561 *
562 * Writes a block of byte data from buf using the underlaying physical protocol.
563 * It returns the amount of bytes written or a negative error code.
564 */
565static inline int rmi_write_block(struct rmi_device *d, u16 addr, u8 *buf,
566 int len)
567{
568 return d->phys->write_block(d->phys, addr, buf, len);
569}
570
571/**
572 * rmi_register_driver - register rmi driver
573 * @driver: the driver to register
574 *
575 * This function registers an RMI driver to the RMI bus.
576 */
577int rmi_register_driver(struct rmi_driver *driver);
578
579/**
580 * rmi_unregister_driver - unregister rmi driver
581 * @driver: the driver to unregister
582 *
583 * This function unregisters an RMI driver to the RMI bus.
584 */
585void rmi_unregister_driver(struct rmi_driver *driver);
586
587/**
588 * rmi_register_phys_device - register a physical device connection
589 * @phys: the physical driver to register
590 *
591 * This function registers a physical driver to the RMI bus. These drivers
592 * provide a communication layer for the drivers connected to the bus, e.g.
593 * I2C, SPI and so on.
594 */
595int rmi_register_phys_device(struct rmi_phys_device *phys);
596
597/**
598 * rmi_unregister_phys_device - unregister a physical device connection
599 * @phys: the physical driver to unregister
600 *
601 * This function unregisters a physical driver from the RMI bus.
602 */
603void rmi_unregister_phys_device(struct rmi_phys_device *phys);
604
605/**
606 * rmi_register_function_driver - register an RMI function driver
607 * @fh: the function handler to register
608 *
609 * This function registers support for a new RMI function to the bus. All
610 * drivers on the bus will be notified of the presence of the new function
611 * driver.
612 */
613int rmi_register_function_driver(struct rmi_function_handler *fh);
614
615/**
616 * rmi_unregister_function_driver - unregister an RMI function driver
617 * @fh: the function handler to unregister
618 *
619 * This function unregisters a RMI function from the RMI bus. All drivers on
620 * the bus will be notified of the removal of a function driver.
621 */
622void rmi_unregister_function_driver(struct rmi_function_handler *fh);
623
624/**
625 * rmi_get_function_handler - get a pointer to specified RMI function
626 * @id: the RMI function id
627 *
628 * This function gets the specified RMI function handler from the list of
629 * supported functions.
630 */
631struct rmi_function_handler *rmi_get_function_handler(int id);
632
633/* Utility routine to handle writes to read-only attributes. Hopefully
634 * this will never happen, but if the user does something stupid, we
635 * don't want to accept it quietly.
636 */
637ssize_t rmi_store_error(struct device *dev,
638 struct device_attribute *attr,
639 const char *buf, size_t count);
640
641/* Utility routine to handle reads to write-only attributes. Hopefully
642 * this will never happen, but if the user does something stupid, we
643 * don't want to accept it quietly.
644 */
645ssize_t rmi_show_error(struct device *dev,
646 struct device_attribute *attr,
647 char *buf);
648
649/* utility function for bit access of u8*'s */
650void u8_set_bit(u8 *target, int pos);
651void u8_clear_bit(u8 *target, int pos);
652bool u8_is_set(u8 *target, int pos);
653bool u8_is_any_set(u8 *target, int size);
654void u8_or(u8 *dest, u8* target1, u8* target2, int size);
655void u8_and(u8 *dest, u8* target1, u8* target2, int size);
656#endif
diff --git a/include/linux/rtc.h b/include/linux/rtc.h
index b27ebea2566..93f4d035076 100644
--- a/include/linux/rtc.h
+++ b/include/linux/rtc.h
@@ -97,6 +97,9 @@ struct rtc_pll_info {
97#define RTC_AF 0x20 /* Alarm interrupt */ 97#define RTC_AF 0x20 /* Alarm interrupt */
98#define RTC_UF 0x10 /* Update interrupt for 1Hz RTC */ 98#define RTC_UF 0x10 /* Update interrupt for 1Hz RTC */
99 99
100
101#define RTC_MAX_FREQ 8192
102
100#ifdef __KERNEL__ 103#ifdef __KERNEL__
101 104
102#include <linux/types.h> 105#include <linux/types.h>
diff --git a/include/linux/rtmutex.h b/include/linux/rtmutex.h
index 8d522ffeda3..de17134244f 100644
--- a/include/linux/rtmutex.h
+++ b/include/linux/rtmutex.h
@@ -66,7 +66,7 @@ struct hrtimer_sleeper;
66 66
67#define __RT_MUTEX_INITIALIZER(mutexname) \ 67#define __RT_MUTEX_INITIALIZER(mutexname) \
68 { .wait_lock = __RAW_SPIN_LOCK_UNLOCKED(mutexname.wait_lock) \ 68 { .wait_lock = __RAW_SPIN_LOCK_UNLOCKED(mutexname.wait_lock) \
69 , .wait_list = PLIST_HEAD_INIT_RAW(mutexname.wait_list, mutexname.wait_lock) \ 69 , .wait_list = PLIST_HEAD_INIT(mutexname.wait_list) \
70 , .owner = NULL \ 70 , .owner = NULL \
71 __DEBUG_RT_MUTEX_INITIALIZER(mutexname)} 71 __DEBUG_RT_MUTEX_INITIALIZER(mutexname)}
72 72
@@ -100,7 +100,7 @@ extern void rt_mutex_unlock(struct rt_mutex *lock);
100 100
101#ifdef CONFIG_RT_MUTEXES 101#ifdef CONFIG_RT_MUTEXES
102# define INIT_RT_MUTEXES(tsk) \ 102# define INIT_RT_MUTEXES(tsk) \
103 .pi_waiters = PLIST_HEAD_INIT(tsk.pi_waiters, tsk.pi_lock), \ 103 .pi_waiters = PLIST_HEAD_INIT(tsk.pi_waiters), \
104 INIT_RT_MUTEX_DEBUG(tsk) 104 INIT_RT_MUTEX_DEBUG(tsk)
105#else 105#else
106# define INIT_RT_MUTEXES(tsk) 106# define INIT_RT_MUTEXES(tsk)
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index bbad657a372..8e872ead88b 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -585,6 +585,8 @@ enum rtnetlink_groups {
585#define RTNLGRP_PHONET_IFADDR RTNLGRP_PHONET_IFADDR 585#define RTNLGRP_PHONET_IFADDR RTNLGRP_PHONET_IFADDR
586 RTNLGRP_PHONET_ROUTE, 586 RTNLGRP_PHONET_ROUTE,
587#define RTNLGRP_PHONET_ROUTE RTNLGRP_PHONET_ROUTE 587#define RTNLGRP_PHONET_ROUTE RTNLGRP_PHONET_ROUTE
588 RTNLGRP_DCB,
589#define RTNLGRP_DCB RTNLGRP_DCB
588 __RTNLGRP_MAX 590 __RTNLGRP_MAX
589}; 591};
590#define RTNLGRP_MAX (__RTNLGRP_MAX - 1) 592#define RTNLGRP_MAX (__RTNLGRP_MAX - 1)
@@ -758,8 +760,7 @@ extern int lockdep_rtnl_is_held(void);
758 * or RTNL. Note : Please prefer rtnl_dereference() or rcu_dereference() 760 * or RTNL. Note : Please prefer rtnl_dereference() or rcu_dereference()
759 */ 761 */
760#define rcu_dereference_rtnl(p) \ 762#define rcu_dereference_rtnl(p) \
761 rcu_dereference_check(p, rcu_read_lock_held() || \ 763 rcu_dereference_check(p, lockdep_rtnl_is_held())
762 lockdep_rtnl_is_held())
763 764
764/** 765/**
765 * rtnl_dereference - fetch RCU pointer when updates are prevented by RTNL 766 * rtnl_dereference - fetch RCU pointer when updates are prevented by RTNL
diff --git a/include/linux/rwsem.h b/include/linux/rwsem.h
index a8afe9cd000..6a6741440cb 100644
--- a/include/linux/rwsem.h
+++ b/include/linux/rwsem.h
@@ -15,7 +15,7 @@
15#include <linux/spinlock.h> 15#include <linux/spinlock.h>
16 16
17#include <asm/system.h> 17#include <asm/system.h>
18#include <asm/atomic.h> 18#include <linux/atomic.h>
19 19
20struct rw_semaphore; 20struct rw_semaphore;
21 21
@@ -124,19 +124,9 @@ extern void downgrade_write(struct rw_semaphore *sem);
124 */ 124 */
125extern void down_read_nested(struct rw_semaphore *sem, int subclass); 125extern void down_read_nested(struct rw_semaphore *sem, int subclass);
126extern void down_write_nested(struct rw_semaphore *sem, int subclass); 126extern void down_write_nested(struct rw_semaphore *sem, int subclass);
127/*
128 * Take/release a lock when not the owner will release it.
129 *
130 * [ This API should be avoided as much as possible - the
131 * proper abstraction for this case is completions. ]
132 */
133extern void down_read_non_owner(struct rw_semaphore *sem);
134extern void up_read_non_owner(struct rw_semaphore *sem);
135#else 127#else
136# define down_read_nested(sem, subclass) down_read(sem) 128# define down_read_nested(sem, subclass) down_read(sem)
137# define down_write_nested(sem, subclass) down_write(sem) 129# define down_write_nested(sem, subclass) down_write(sem)
138# define down_read_non_owner(sem) down_read(sem)
139# define up_read_non_owner(sem) up_read(sem)
140#endif 130#endif
141 131
142#endif /* _LINUX_RWSEM_H */ 132#endif /* _LINUX_RWSEM_H */
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 2b094bdaafa..096834c7c63 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1298,7 +1298,7 @@ struct task_struct {
1298 int exit_state; 1298 int exit_state;
1299 int exit_code, exit_signal; 1299 int exit_code, exit_signal;
1300 int pdeath_signal; /* The signal sent when the parent dies */ 1300 int pdeath_signal; /* The signal sent when the parent dies */
1301 unsigned int group_stop; /* GROUP_STOP_*, siglock protected */ 1301 unsigned int jobctl; /* JOBCTL_*, siglock protected */
1302 /* ??? */ 1302 /* ??? */
1303 unsigned int personality; 1303 unsigned int personality;
1304 unsigned did_exec:1; 1304 unsigned did_exec:1;
@@ -1518,7 +1518,6 @@ struct task_struct {
1518 short il_next; 1518 short il_next;
1519 short pref_node_fork; 1519 short pref_node_fork;
1520#endif 1520#endif
1521 atomic_t fs_excl; /* holding fs exclusive resources */
1522 struct rcu_head rcu; 1521 struct rcu_head rcu;
1523 1522
1524 /* 1523 /*
@@ -1769,6 +1768,9 @@ static inline void put_task_struct(struct task_struct *t)
1769extern void task_times(struct task_struct *p, cputime_t *ut, cputime_t *st); 1768extern void task_times(struct task_struct *p, cputime_t *ut, cputime_t *st);
1770extern void thread_group_times(struct task_struct *p, cputime_t *ut, cputime_t *st); 1769extern void thread_group_times(struct task_struct *p, cputime_t *ut, cputime_t *st);
1771 1770
1771extern int task_free_register(struct notifier_block *n);
1772extern int task_free_unregister(struct notifier_block *n);
1773
1772/* 1774/*
1773 * Per process flags 1775 * Per process flags
1774 */ 1776 */
@@ -1783,6 +1785,7 @@ extern void thread_group_times(struct task_struct *p, cputime_t *ut, cputime_t *
1783#define PF_DUMPCORE 0x00000200 /* dumped core */ 1785#define PF_DUMPCORE 0x00000200 /* dumped core */
1784#define PF_SIGNALED 0x00000400 /* killed by a signal */ 1786#define PF_SIGNALED 0x00000400 /* killed by a signal */
1785#define PF_MEMALLOC 0x00000800 /* Allocating memory */ 1787#define PF_MEMALLOC 0x00000800 /* Allocating memory */
1788#define PF_NPROC_EXCEEDED 0x00001000 /* set_user noticed that RLIMIT_NPROC was exceeded */
1786#define PF_USED_MATH 0x00002000 /* if unset the fpu must be initialized before use */ 1789#define PF_USED_MATH 0x00002000 /* if unset the fpu must be initialized before use */
1787#define PF_FREEZING 0x00004000 /* freeze in progress. do not account to load */ 1790#define PF_FREEZING 0x00004000 /* freeze in progress. do not account to load */
1788#define PF_NOFREEZE 0x00008000 /* this thread should not be frozen */ 1791#define PF_NOFREEZE 0x00008000 /* this thread should not be frozen */
@@ -1828,15 +1831,34 @@ extern void thread_group_times(struct task_struct *p, cputime_t *ut, cputime_t *
1828#define used_math() tsk_used_math(current) 1831#define used_math() tsk_used_math(current)
1829 1832
1830/* 1833/*
1831 * task->group_stop flags 1834 * task->jobctl flags
1832 */ 1835 */
1833#define GROUP_STOP_SIGMASK 0xffff /* signr of the last group stop */ 1836#define JOBCTL_STOP_SIGMASK 0xffff /* signr of the last group stop */
1834#define GROUP_STOP_PENDING (1 << 16) /* task should stop for group stop */ 1837
1835#define GROUP_STOP_CONSUME (1 << 17) /* consume group stop count */ 1838#define JOBCTL_STOP_DEQUEUED_BIT 16 /* stop signal dequeued */
1836#define GROUP_STOP_TRAPPING (1 << 18) /* switching from STOPPED to TRACED */ 1839#define JOBCTL_STOP_PENDING_BIT 17 /* task should stop for group stop */
1837#define GROUP_STOP_DEQUEUED (1 << 19) /* stop signal dequeued */ 1840#define JOBCTL_STOP_CONSUME_BIT 18 /* consume group stop count */
1838 1841#define JOBCTL_TRAP_STOP_BIT 19 /* trap for STOP */
1839extern void task_clear_group_stop_pending(struct task_struct *task); 1842#define JOBCTL_TRAP_NOTIFY_BIT 20 /* trap for NOTIFY */
1843#define JOBCTL_TRAPPING_BIT 21 /* switching to TRACED */
1844#define JOBCTL_LISTENING_BIT 22 /* ptracer is listening for events */
1845
1846#define JOBCTL_STOP_DEQUEUED (1 << JOBCTL_STOP_DEQUEUED_BIT)
1847#define JOBCTL_STOP_PENDING (1 << JOBCTL_STOP_PENDING_BIT)
1848#define JOBCTL_STOP_CONSUME (1 << JOBCTL_STOP_CONSUME_BIT)
1849#define JOBCTL_TRAP_STOP (1 << JOBCTL_TRAP_STOP_BIT)
1850#define JOBCTL_TRAP_NOTIFY (1 << JOBCTL_TRAP_NOTIFY_BIT)
1851#define JOBCTL_TRAPPING (1 << JOBCTL_TRAPPING_BIT)
1852#define JOBCTL_LISTENING (1 << JOBCTL_LISTENING_BIT)
1853
1854#define JOBCTL_TRAP_MASK (JOBCTL_TRAP_STOP | JOBCTL_TRAP_NOTIFY)
1855#define JOBCTL_PENDING_MASK (JOBCTL_STOP_PENDING | JOBCTL_TRAP_MASK)
1856
1857extern bool task_set_jobctl_pending(struct task_struct *task,
1858 unsigned int mask);
1859extern void task_clear_jobctl_trapping(struct task_struct *task);
1860extern void task_clear_jobctl_pending(struct task_struct *task,
1861 unsigned int mask);
1840 1862
1841#ifdef CONFIG_PREEMPT_RCU 1863#ifdef CONFIG_PREEMPT_RCU
1842 1864
@@ -1952,7 +1974,6 @@ static inline void disable_sched_clock_irqtime(void) {}
1952 1974
1953extern unsigned long long 1975extern unsigned long long
1954task_sched_runtime(struct task_struct *task); 1976task_sched_runtime(struct task_struct *task);
1955extern unsigned long long thread_group_sched_runtime(struct task_struct *task);
1956 1977
1957/* sched_exec is called by processes performing an exec */ 1978/* sched_exec is called by processes performing an exec */
1958#ifdef CONFIG_SMP 1979#ifdef CONFIG_SMP
@@ -2166,7 +2187,7 @@ extern int kill_pid_info_as_uid(int, struct siginfo *, struct pid *, uid_t, uid_
2166extern int kill_pgrp(struct pid *pid, int sig, int priv); 2187extern int kill_pgrp(struct pid *pid, int sig, int priv);
2167extern int kill_pid(struct pid *pid, int sig, int priv); 2188extern int kill_pid(struct pid *pid, int sig, int priv);
2168extern int kill_proc_info(int, struct siginfo *, pid_t); 2189extern int kill_proc_info(int, struct siginfo *, pid_t);
2169extern int do_notify_parent(struct task_struct *, int); 2190extern __must_check bool do_notify_parent(struct task_struct *, int);
2170extern void __wake_up_parent(struct task_struct *p, struct task_struct *parent); 2191extern void __wake_up_parent(struct task_struct *p, struct task_struct *parent);
2171extern void force_sig(int, struct task_struct *); 2192extern void force_sig(int, struct task_struct *);
2172extern int send_sig(int, struct task_struct *, int); 2193extern int send_sig(int, struct task_struct *, int);
@@ -2290,8 +2311,10 @@ static inline int get_nr_threads(struct task_struct *tsk)
2290 return tsk->signal->nr_threads; 2311 return tsk->signal->nr_threads;
2291} 2312}
2292 2313
2293/* de_thread depends on thread_group_leader not being a pid based check */ 2314static inline bool thread_group_leader(struct task_struct *p)
2294#define thread_group_leader(p) (p == p->group_leader) 2315{
2316 return p->exit_signal >= 0;
2317}
2295 2318
2296/* Do to the insanities of de_thread it is possible for a process 2319/* Do to the insanities of de_thread it is possible for a process
2297 * to have the pid of the thread group leader without actually being 2320 * to have the pid of the thread group leader without actually being
@@ -2324,11 +2347,6 @@ static inline int thread_group_empty(struct task_struct *p)
2324#define delay_group_leader(p) \ 2347#define delay_group_leader(p) \
2325 (thread_group_leader(p) && !thread_group_empty(p)) 2348 (thread_group_leader(p) && !thread_group_empty(p))
2326 2349
2327static inline int task_detached(struct task_struct *p)
2328{
2329 return p->exit_signal == -1;
2330}
2331
2332/* 2350/*
2333 * Protects ->fs, ->files, ->mm, ->group_info, ->comm, keyring 2351 * Protects ->fs, ->files, ->mm, ->group_info, ->comm, keyring
2334 * subscriptions and synchronises with wait4(). Also used in procfs. Also 2352 * subscriptions and synchronises with wait4(). Also used in procfs. Also
@@ -2526,7 +2544,7 @@ extern int _cond_resched(void);
2526 2544
2527extern int __cond_resched_lock(spinlock_t *lock); 2545extern int __cond_resched_lock(spinlock_t *lock);
2528 2546
2529#ifdef CONFIG_PREEMPT 2547#ifdef CONFIG_PREEMPT_COUNT
2530#define PREEMPT_LOCK_OFFSET PREEMPT_OFFSET 2548#define PREEMPT_LOCK_OFFSET PREEMPT_OFFSET
2531#else 2549#else
2532#define PREEMPT_LOCK_OFFSET 0 2550#define PREEMPT_LOCK_OFFSET 0
diff --git a/include/linux/seccomp.h b/include/linux/seccomp.h
index 167c33361d9..cc7a4e9cc7a 100644
--- a/include/linux/seccomp.h
+++ b/include/linux/seccomp.h
@@ -19,6 +19,11 @@ static inline void secure_computing(int this_syscall)
19extern long prctl_get_seccomp(void); 19extern long prctl_get_seccomp(void);
20extern long prctl_set_seccomp(unsigned long); 20extern long prctl_set_seccomp(unsigned long);
21 21
22static inline int seccomp_mode(seccomp_t *s)
23{
24 return s->mode;
25}
26
22#else /* CONFIG_SECCOMP */ 27#else /* CONFIG_SECCOMP */
23 28
24#include <linux/errno.h> 29#include <linux/errno.h>
@@ -37,6 +42,11 @@ static inline long prctl_set_seccomp(unsigned long arg2)
37 return -EINVAL; 42 return -EINVAL;
38} 43}
39 44
45static inline int seccomp_mode(seccomp_t *s)
46{
47 return 0;
48}
49
40#endif /* CONFIG_SECCOMP */ 50#endif /* CONFIG_SECCOMP */
41 51
42#endif /* _LINUX_SECCOMP_H */ 52#endif /* _LINUX_SECCOMP_H */
diff --git a/include/linux/security.h b/include/linux/security.h
index 8ce59ef3e5a..ebd2a53a3d0 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -1456,7 +1456,7 @@ struct security_operations {
1456 struct inode *new_dir, struct dentry *new_dentry); 1456 struct inode *new_dir, struct dentry *new_dentry);
1457 int (*inode_readlink) (struct dentry *dentry); 1457 int (*inode_readlink) (struct dentry *dentry);
1458 int (*inode_follow_link) (struct dentry *dentry, struct nameidata *nd); 1458 int (*inode_follow_link) (struct dentry *dentry, struct nameidata *nd);
1459 int (*inode_permission) (struct inode *inode, int mask, unsigned flags); 1459 int (*inode_permission) (struct inode *inode, int mask);
1460 int (*inode_setattr) (struct dentry *dentry, struct iattr *attr); 1460 int (*inode_setattr) (struct dentry *dentry, struct iattr *attr);
1461 int (*inode_getattr) (struct vfsmount *mnt, struct dentry *dentry); 1461 int (*inode_getattr) (struct vfsmount *mnt, struct dentry *dentry);
1462 int (*inode_setxattr) (struct dentry *dentry, const char *name, 1462 int (*inode_setxattr) (struct dentry *dentry, const char *name,
@@ -1720,7 +1720,6 @@ int security_inode_rename(struct inode *old_dir, struct dentry *old_dentry,
1720int security_inode_readlink(struct dentry *dentry); 1720int security_inode_readlink(struct dentry *dentry);
1721int security_inode_follow_link(struct dentry *dentry, struct nameidata *nd); 1721int security_inode_follow_link(struct dentry *dentry, struct nameidata *nd);
1722int security_inode_permission(struct inode *inode, int mask); 1722int security_inode_permission(struct inode *inode, int mask);
1723int security_inode_exec_permission(struct inode *inode, unsigned int flags);
1724int security_inode_setattr(struct dentry *dentry, struct iattr *attr); 1723int security_inode_setattr(struct dentry *dentry, struct iattr *attr);
1725int security_inode_getattr(struct vfsmount *mnt, struct dentry *dentry); 1724int security_inode_getattr(struct vfsmount *mnt, struct dentry *dentry);
1726int security_inode_setxattr(struct dentry *dentry, const char *name, 1725int security_inode_setxattr(struct dentry *dentry, const char *name,
@@ -2113,12 +2112,6 @@ static inline int security_inode_permission(struct inode *inode, int mask)
2113 return 0; 2112 return 0;
2114} 2113}
2115 2114
2116static inline int security_inode_exec_permission(struct inode *inode,
2117 unsigned int flags)
2118{
2119 return 0;
2120}
2121
2122static inline int security_inode_setattr(struct dentry *dentry, 2115static inline int security_inode_setattr(struct dentry *dentry,
2123 struct iattr *attr) 2116 struct iattr *attr)
2124{ 2117{
diff --git a/include/linux/sem.h b/include/linux/sem.h
index f2961afa2f6..1feb2de2ee5 100644
--- a/include/linux/sem.h
+++ b/include/linux/sem.h
@@ -77,7 +77,7 @@ struct seminfo {
77#define SEMUSZ 20 /* sizeof struct sem_undo */ 77#define SEMUSZ 20 /* sizeof struct sem_undo */
78 78
79#ifdef __KERNEL__ 79#ifdef __KERNEL__
80#include <asm/atomic.h> 80#include <linux/atomic.h>
81#include <linux/rcupdate.h> 81#include <linux/rcupdate.h>
82#include <linux/cache.h> 82#include <linux/cache.h>
83 83
diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h
index 03c0232b416..be720cd2038 100644
--- a/include/linux/seq_file.h
+++ b/include/linux/seq_file.h
@@ -23,6 +23,7 @@ struct seq_file {
23 u64 version; 23 u64 version;
24 struct mutex lock; 24 struct mutex lock;
25 const struct seq_operations *op; 25 const struct seq_operations *op;
26 int poll_event;
26 void *private; 27 void *private;
27}; 28};
28 29
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index a5c31146a33..0d239897b2f 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -245,6 +245,7 @@ struct uart_ops {
245 void (*pm)(struct uart_port *, unsigned int state, 245 void (*pm)(struct uart_port *, unsigned int state,
246 unsigned int oldstate); 246 unsigned int oldstate);
247 int (*set_wake)(struct uart_port *, unsigned int state); 247 int (*set_wake)(struct uart_port *, unsigned int state);
248 void (*wake_peer)(struct uart_port *);
248 249
249 /* 250 /*
250 * Return a string describing the type of the port 251 * Return a string describing the type of the port
diff --git a/include/linux/serial_reg.h b/include/linux/serial_reg.h
index c75bda37c18..543e361b15c 100644
--- a/include/linux/serial_reg.h
+++ b/include/linux/serial_reg.h
@@ -2,10 +2,10 @@
2 * include/linux/serial_reg.h 2 * include/linux/serial_reg.h
3 * 3 *
4 * Copyright (C) 1992, 1994 by Theodore Ts'o. 4 * Copyright (C) 1992, 1994 by Theodore Ts'o.
5 * 5 *
6 * Redistribution of this file is permitted under the terms of the GNU 6 * Redistribution of this file is permitted under the terms of the GNU
7 * Public License (GPL) 7 * Public License (GPL)
8 * 8 *
9 * These are the UART port assignments, expressed as offsets from the base 9 * These are the UART port assignments, expressed as offsets from the base
10 * register. These assignments should hold for any serial port based on 10 * register. These assignments should hold for any serial port based on
11 * a 8250, 16450, or 16550(A). 11 * a 8250, 16450, or 16550(A).
@@ -86,7 +86,7 @@
86 86
87#define UART_LCR 3 /* Out: Line Control Register */ 87#define UART_LCR 3 /* Out: Line Control Register */
88/* 88/*
89 * Note: if the word length is 5 bits (UART_LCR_WLEN5), then setting 89 * Note: if the word length is 5 bits (UART_LCR_WLEN5), then setting
90 * UART_LCR_STOP will select 1.5 stop bits, not 2 stop bits. 90 * UART_LCR_STOP will select 1.5 stop bits, not 2 stop bits.
91 */ 91 */
92#define UART_LCR_DLAB 0x80 /* Divisor latch access bit */ 92#define UART_LCR_DLAB 0x80 /* Divisor latch access bit */
@@ -110,8 +110,10 @@
110#define UART_MCR 4 /* Out: Modem Control Register */ 110#define UART_MCR 4 /* Out: Modem Control Register */
111#define UART_MCR_CLKSEL 0x80 /* Divide clock by 4 (TI16C752, EFR[4]=1) */ 111#define UART_MCR_CLKSEL 0x80 /* Divide clock by 4 (TI16C752, EFR[4]=1) */
112#define UART_MCR_TCRTLR 0x40 /* Access TCR/TLR (TI16C752, EFR[4]=1) */ 112#define UART_MCR_TCRTLR 0x40 /* Access TCR/TLR (TI16C752, EFR[4]=1) */
113#define UART_MCR_HW_RTS 0x40 /* Enable hw control of RTS (Tegra UART) */
113#define UART_MCR_XONANY 0x20 /* Enable Xon Any (TI16C752, EFR[4]=1) */ 114#define UART_MCR_XONANY 0x20 /* Enable Xon Any (TI16C752, EFR[4]=1) */
114#define UART_MCR_AFE 0x20 /* Enable auto-RTS/CTS (TI16C550C/TI16C750) */ 115#define UART_MCR_AFE 0x20 /* Enable auto-RTS/CTS (TI16C550C/TI16C750) */
116#define UART_MCR_HW_CTS 0x20 /* Enable HW based CTS control (Tegra UART)*/
115#define UART_MCR_LOOP 0x10 /* Enable loopback test mode */ 117#define UART_MCR_LOOP 0x10 /* Enable loopback test mode */
116#define UART_MCR_OUT2 0x08 /* Out2 complement */ 118#define UART_MCR_OUT2 0x08 /* Out2 complement */
117#define UART_MCR_OUT1 0x04 /* Out1 complement */ 119#define UART_MCR_OUT1 0x04 /* Out1 complement */
diff --git a/include/linux/serial_sci.h b/include/linux/serial_sci.h
index a2afc9fbe18..8bffe9ae2ca 100644
--- a/include/linux/serial_sci.h
+++ b/include/linux/serial_sci.h
@@ -8,6 +8,8 @@
8 * Generic header for SuperH SCI(F) (used by sh/sh64/h8300 and related parts) 8 * Generic header for SuperH SCI(F) (used by sh/sh64/h8300 and related parts)
9 */ 9 */
10 10
11#define SCIx_NOT_SUPPORTED (-1)
12
11enum { 13enum {
12 SCBRR_ALGO_1, /* ((clk + 16 * bps) / (16 * bps) - 1) */ 14 SCBRR_ALGO_1, /* ((clk + 16 * bps) / (16 * bps) - 1) */
13 SCBRR_ALGO_2, /* ((clk + 16 * bps) / (32 * bps) - 1) */ 15 SCBRR_ALGO_2, /* ((clk + 16 * bps) / (32 * bps) - 1) */
@@ -25,6 +27,28 @@ enum {
25#define SCSCR_CKE1 (1 << 1) 27#define SCSCR_CKE1 (1 << 1)
26#define SCSCR_CKE0 (1 << 0) 28#define SCSCR_CKE0 (1 << 0)
27 29
30/* SCxSR SCI */
31#define SCI_TDRE 0x80
32#define SCI_RDRF 0x40
33#define SCI_ORER 0x20
34#define SCI_FER 0x10
35#define SCI_PER 0x08
36#define SCI_TEND 0x04
37
38#define SCI_DEFAULT_ERROR_MASK (SCI_PER | SCI_FER)
39
40/* SCxSR SCIF */
41#define SCIF_ER 0x0080
42#define SCIF_TEND 0x0040
43#define SCIF_TDFE 0x0020
44#define SCIF_BRK 0x0010
45#define SCIF_FER 0x0008
46#define SCIF_PER 0x0004
47#define SCIF_RDF 0x0002
48#define SCIF_DR 0x0001
49
50#define SCIF_DEFAULT_ERROR_MASK (SCIF_PER | SCIF_FER | SCIF_ER | SCIF_BRK)
51
28/* Offsets into the sci_port->irqs array */ 52/* Offsets into the sci_port->irqs array */
29enum { 53enum {
30 SCIx_ERI_IRQ, 54 SCIx_ERI_IRQ,
@@ -32,6 +56,24 @@ enum {
32 SCIx_TXI_IRQ, 56 SCIx_TXI_IRQ,
33 SCIx_BRI_IRQ, 57 SCIx_BRI_IRQ,
34 SCIx_NR_IRQS, 58 SCIx_NR_IRQS,
59
60 SCIx_MUX_IRQ = SCIx_NR_IRQS, /* special case */
61};
62
63enum {
64 SCIx_PROBE_REGTYPE,
65
66 SCIx_SCI_REGTYPE,
67 SCIx_IRDA_REGTYPE,
68 SCIx_SCIFA_REGTYPE,
69 SCIx_SCIFB_REGTYPE,
70 SCIx_SH3_SCIF_REGTYPE,
71 SCIx_SH4_SCIF_REGTYPE,
72 SCIx_SH4_SCIF_NO_SCSPTR_REGTYPE,
73 SCIx_SH4_SCIF_FIFODATA_REGTYPE,
74 SCIx_SH7705_SCIF_REGTYPE,
75
76 SCIx_NR_REGTYPES,
35}; 77};
36 78
37#define SCIx_IRQ_MUXED(irq) \ 79#define SCIx_IRQ_MUXED(irq) \
@@ -42,8 +84,29 @@ enum {
42 [SCIx_BRI_IRQ] = (irq), \ 84 [SCIx_BRI_IRQ] = (irq), \
43} 85}
44 86
87#define SCIx_IRQ_IS_MUXED(port) \
88 ((port)->cfg->irqs[SCIx_ERI_IRQ] == \
89 (port)->cfg->irqs[SCIx_RXI_IRQ]) || \
90 ((port)->cfg->irqs[SCIx_ERI_IRQ] && \
91 !(port)->cfg->irqs[SCIx_RXI_IRQ])
92/*
93 * SCI register subset common for all port types.
94 * Not all registers will exist on all parts.
95 */
96enum {
97 SCSMR, SCBRR, SCSCR, SCxSR,
98 SCFCR, SCFDR, SCxTDR, SCxRDR,
99 SCLSR, SCTFDR, SCRFDR, SCSPTR,
100
101 SCIx_NR_REGS,
102};
103
45struct device; 104struct device;
46 105
106struct plat_sci_port_ops {
107 void (*init_pins)(struct uart_port *, unsigned int cflag);
108};
109
47/* 110/*
48 * Platform device specific platform_data struct 111 * Platform device specific platform_data struct
49 */ 112 */
@@ -56,6 +119,18 @@ struct plat_sci_port {
56 unsigned int scbrr_algo_id; /* SCBRR calculation algo */ 119 unsigned int scbrr_algo_id; /* SCBRR calculation algo */
57 unsigned int scscr; /* SCSCR initialization */ 120 unsigned int scscr; /* SCSCR initialization */
58 121
122 /*
123 * Platform overrides if necessary, defaults otherwise.
124 */
125 int overrun_bit;
126 unsigned int error_mask;
127
128 int port_reg;
129 unsigned char regshift;
130 unsigned char regtype;
131
132 struct plat_sci_port_ops *ops;
133
59 struct device *dma_dev; 134 struct device *dma_dev;
60 135
61 unsigned int dma_slave_tx; 136 unsigned int dma_slave_tx;
diff --git a/include/linux/sh_clk.h b/include/linux/sh_clk.h
index 9a52f72527d..3ccf18648d0 100644
--- a/include/linux/sh_clk.h
+++ b/include/linux/sh_clk.h
@@ -147,4 +147,8 @@ int sh_clk_div4_reparent_register(struct clk *clks, int nr,
147int sh_clk_div6_register(struct clk *clks, int nr); 147int sh_clk_div6_register(struct clk *clks, int nr);
148int sh_clk_div6_reparent_register(struct clk *clks, int nr); 148int sh_clk_div6_reparent_register(struct clk *clks, int nr);
149 149
150#define CLKDEV_CON_ID(_id, _clk) { .con_id = _id, .clk = _clk }
151#define CLKDEV_DEV_ID(_id, _clk) { .dev_id = _id, .clk = _clk }
152#define CLKDEV_ICK_ID(_cid, _did, _clk) { .con_id = _cid, .dev_id = _did, .clk = _clk }
153
150#endif /* __SH_CLOCK_H */ 154#endif /* __SH_CLOCK_H */
diff --git a/include/linux/sh_dma.h b/include/linux/sh_dma.h
index b08cd4efa15..cb2dd118cc0 100644
--- a/include/linux/sh_dma.h
+++ b/include/linux/sh_dma.h
@@ -62,6 +62,12 @@ struct sh_dmae_pdata {
62 const unsigned int *ts_shift; 62 const unsigned int *ts_shift;
63 int ts_shift_num; 63 int ts_shift_num;
64 u16 dmaor_init; 64 u16 dmaor_init;
65 unsigned int chcr_offset;
66 u32 chcr_ie_bit;
67
68 unsigned int dmaor_is_32bit:1;
69 unsigned int needs_tend_set:1;
70 unsigned int no_dmars:1;
65}; 71};
66 72
67/* DMA register */ 73/* DMA register */
@@ -71,6 +77,8 @@ struct sh_dmae_pdata {
71#define CHCR 0x0C 77#define CHCR 0x0C
72#define DMAOR 0x40 78#define DMAOR 0x40
73 79
80#define TEND 0x18 /* USB-DMAC */
81
74/* DMAOR definitions */ 82/* DMAOR definitions */
75#define DMAOR_AE 0x00000004 83#define DMAOR_AE 0x00000004
76#define DMAOR_NMIF 0x00000002 84#define DMAOR_NMIF 0x00000002
diff --git a/include/linux/shm.h b/include/linux/shm.h
index eca6235a46c..92808b86703 100644
--- a/include/linux/shm.h
+++ b/include/linux/shm.h
@@ -95,6 +95,9 @@ struct shmid_kernel /* private to the kernel */
95 pid_t shm_cprid; 95 pid_t shm_cprid;
96 pid_t shm_lprid; 96 pid_t shm_lprid;
97 struct user_struct *mlock_user; 97 struct user_struct *mlock_user;
98
99 /* The task created the shm object. NULL if the task is dead. */
100 struct task_struct *shm_creator;
98}; 101};
99 102
100/* shm_mode upper byte flags */ 103/* shm_mode upper byte flags */
@@ -106,6 +109,7 @@ struct shmid_kernel /* private to the kernel */
106#ifdef CONFIG_SYSVIPC 109#ifdef CONFIG_SYSVIPC
107long do_shmat(int shmid, char __user *shmaddr, int shmflg, unsigned long *addr); 110long do_shmat(int shmid, char __user *shmaddr, int shmflg, unsigned long *addr);
108extern int is_file_shm_hugepages(struct file *file); 111extern int is_file_shm_hugepages(struct file *file);
112extern void exit_shm(struct task_struct *task);
109#else 113#else
110static inline long do_shmat(int shmid, char __user *shmaddr, 114static inline long do_shmat(int shmid, char __user *shmaddr,
111 int shmflg, unsigned long *addr) 115 int shmflg, unsigned long *addr)
@@ -116,6 +120,9 @@ static inline int is_file_shm_hugepages(struct file *file)
116{ 120{
117 return 0; 121 return 0;
118} 122}
123static inline void exit_shm(struct task_struct *task)
124{
125}
119#endif 126#endif
120 127
121#endif /* __KERNEL__ */ 128#endif /* __KERNEL__ */
diff --git a/include/linux/shmem_fs.h b/include/linux/shmem_fs.h
index aa08fa8fd79..9291ac3cc62 100644
--- a/include/linux/shmem_fs.h
+++ b/include/linux/shmem_fs.h
@@ -8,22 +8,15 @@
8 8
9/* inode in-kernel data */ 9/* inode in-kernel data */
10 10
11#define SHMEM_NR_DIRECT 16
12
13#define SHMEM_SYMLINK_INLINE_LEN (SHMEM_NR_DIRECT * sizeof(swp_entry_t))
14
15struct shmem_inode_info { 11struct shmem_inode_info {
16 spinlock_t lock; 12 spinlock_t lock;
17 unsigned long flags; 13 unsigned long flags;
18 unsigned long alloced; /* data pages alloced to file */ 14 unsigned long alloced; /* data pages alloced to file */
19 unsigned long swapped; /* subtotal assigned to swap */
20 unsigned long next_index; /* highest alloced index + 1 */
21 struct shared_policy policy; /* NUMA memory alloc policy */
22 struct page *i_indirect; /* top indirect blocks page */
23 union { 15 union {
24 swp_entry_t i_direct[SHMEM_NR_DIRECT]; /* first blocks */ 16 unsigned long swapped; /* subtotal assigned to swap */
25 char inline_symlink[SHMEM_SYMLINK_INLINE_LEN]; 17 char *symlink; /* unswappable short symlink */
26 }; 18 };
19 struct shared_policy policy; /* NUMA memory alloc policy */
27 struct list_head swaplist; /* chain of maybes on swap */ 20 struct list_head swaplist; /* chain of maybes on swap */
28 struct list_head xattr_list; /* list of shmem_xattr */ 21 struct list_head xattr_list; /* list of shmem_xattr */
29 struct inode vfs_inode; 22 struct inode vfs_inode;
@@ -49,7 +42,7 @@ static inline struct shmem_inode_info *SHMEM_I(struct inode *inode)
49/* 42/*
50 * Functions in mm/shmem.c called directly from elsewhere: 43 * Functions in mm/shmem.c called directly from elsewhere:
51 */ 44 */
52extern int init_tmpfs(void); 45extern int shmem_init(void);
53extern int shmem_fill_super(struct super_block *sb, void *data, int silent); 46extern int shmem_fill_super(struct super_block *sb, void *data, int silent);
54extern struct file *shmem_file_setup(const char *name, 47extern struct file *shmem_file_setup(const char *name,
55 loff_t size, unsigned long flags); 48 loff_t size, unsigned long flags);
@@ -59,8 +52,6 @@ extern struct page *shmem_read_mapping_page_gfp(struct address_space *mapping,
59 pgoff_t index, gfp_t gfp_mask); 52 pgoff_t index, gfp_t gfp_mask);
60extern void shmem_truncate_range(struct inode *inode, loff_t start, loff_t end); 53extern void shmem_truncate_range(struct inode *inode, loff_t start, loff_t end);
61extern int shmem_unuse(swp_entry_t entry, struct page *page); 54extern int shmem_unuse(swp_entry_t entry, struct page *page);
62extern void mem_cgroup_get_shmem_target(struct inode *inode, pgoff_t pgoff,
63 struct page **pagep, swp_entry_t *ent);
64 55
65static inline struct page *shmem_read_mapping_page( 56static inline struct page *shmem_read_mapping_page(
66 struct address_space *mapping, pgoff_t index) 57 struct address_space *mapping, pgoff_t index)
diff --git a/include/linux/shrinker.h b/include/linux/shrinker.h
new file mode 100644
index 00000000000..a83833a1f7a
--- /dev/null
+++ b/include/linux/shrinker.h
@@ -0,0 +1,43 @@
1#ifndef _LINUX_SHRINKER_H
2#define _LINUX_SHRINKER_H
3
4/*
5 * This struct is used to pass information from page reclaim to the shrinkers.
6 * We consolidate the values for easier extention later.
7 */
8struct shrink_control {
9 gfp_t gfp_mask;
10
11 /* How many slab objects shrinker() should scan and try to reclaim */
12 unsigned long nr_to_scan;
13};
14
15/*
16 * A callback you can register to apply pressure to ageable caches.
17 *
18 * 'sc' is passed shrink_control which includes a count 'nr_to_scan'
19 * and a 'gfpmask'. It should look through the least-recently-used
20 * 'nr_to_scan' entries and attempt to free them up. It should return
21 * the number of objects which remain in the cache. If it returns -1, it means
22 * it cannot do any scanning at this time (eg. there is a risk of deadlock).
23 * The callback must not return -1 if nr_to_scan is zero.
24 *
25 * The 'gfpmask' refers to the allocation we are currently trying to
26 * fulfil.
27 *
28 * Note that 'shrink' will be passed nr_to_scan == 0 when the VM is
29 * querying the cache size, so a fastpath for that case is appropriate.
30 */
31struct shrinker {
32 int (*shrink)(struct shrinker *, struct shrink_control *sc);
33 int seeks; /* seeks to recreate an obj */
34 long batch; /* reclaim batch size, 0 = default */
35
36 /* These are for internal use */
37 struct list_head list;
38 long nr; /* objs pending delete */
39};
40#define DEFAULT_SEEKS 2 /* A good number if you don't know better. */
41extern void register_shrinker(struct shrinker *);
42extern void unregister_shrinker(struct shrinker *);
43#endif
diff --git a/include/linux/sigma.h b/include/linux/sigma.h
index e2accb3164d..d0de882c0d9 100644
--- a/include/linux/sigma.h
+++ b/include/linux/sigma.h
@@ -24,7 +24,7 @@ struct sigma_firmware {
24struct sigma_firmware_header { 24struct sigma_firmware_header {
25 unsigned char magic[7]; 25 unsigned char magic[7];
26 u8 version; 26 u8 version;
27 u32 crc; 27 __le32 crc;
28}; 28};
29 29
30enum { 30enum {
@@ -40,19 +40,14 @@ enum {
40struct sigma_action { 40struct sigma_action {
41 u8 instr; 41 u8 instr;
42 u8 len_hi; 42 u8 len_hi;
43 u16 len; 43 __le16 len;
44 u16 addr; 44 __be16 addr;
45 unsigned char payload[]; 45 unsigned char payload[];
46}; 46};
47 47
48static inline u32 sigma_action_len(struct sigma_action *sa) 48static inline u32 sigma_action_len(struct sigma_action *sa)
49{ 49{
50 return (sa->len_hi << 16) | sa->len; 50 return (sa->len_hi << 16) | le16_to_cpu(sa->len);
51}
52
53static inline size_t sigma_action_size(struct sigma_action *sa, u32 payload_len)
54{
55 return sizeof(*sa) + payload_len + (payload_len % 2);
56} 51}
57 52
58extern int process_sigma_firmware(struct i2c_client *client, const char *name); 53extern int process_sigma_firmware(struct i2c_client *client, const char *name);
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index c0a4f3ab0cc..0f966460a34 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -20,7 +20,7 @@
20#include <linux/time.h> 20#include <linux/time.h>
21#include <linux/cache.h> 21#include <linux/cache.h>
22 22
23#include <asm/atomic.h> 23#include <linux/atomic.h>
24#include <asm/types.h> 24#include <asm/types.h>
25#include <linux/spinlock.h> 25#include <linux/spinlock.h>
26#include <linux/net.h> 26#include <linux/net.h>
@@ -187,6 +187,20 @@ enum {
187 187
188 /* ensure the originating sk reference is available on driver level */ 188 /* ensure the originating sk reference is available on driver level */
189 SKBTX_DRV_NEEDS_SK_REF = 1 << 3, 189 SKBTX_DRV_NEEDS_SK_REF = 1 << 3,
190
191 /* device driver supports TX zero-copy buffers */
192 SKBTX_DEV_ZEROCOPY = 1 << 4,
193};
194
195/*
196 * The callback notifies userspace to release buffers when skb DMA is done in
197 * lower device, the skb last reference should be 0 when calling this.
198 * The desc is used to track userspace buffer index.
199 */
200struct ubuf_info {
201 void (*callback)(void *);
202 void *arg;
203 unsigned long desc;
190}; 204};
191 205
192/* This data is invariant across clones and lives at 206/* This data is invariant across clones and lives at
@@ -211,6 +225,7 @@ struct skb_shared_info {
211 /* Intermediate layers must ensure that destructor_arg 225 /* Intermediate layers must ensure that destructor_arg
212 * remains valid until skb destructor */ 226 * remains valid until skb destructor */
213 void * destructor_arg; 227 void * destructor_arg;
228
214 /* must be last field, see pskb_expand_head() */ 229 /* must be last field, see pskb_expand_head() */
215 skb_frag_t frags[MAX_SKB_FRAGS]; 230 skb_frag_t frags[MAX_SKB_FRAGS];
216}; 231};
@@ -270,15 +285,12 @@ typedef unsigned char *sk_buff_data_t;
270 * struct sk_buff - socket buffer 285 * struct sk_buff - socket buffer
271 * @next: Next buffer in list 286 * @next: Next buffer in list
272 * @prev: Previous buffer in list 287 * @prev: Previous buffer in list
273 * @sk: Socket we are owned by
274 * @tstamp: Time we arrived 288 * @tstamp: Time we arrived
289 * @sk: Socket we are owned by
275 * @dev: Device we arrived on/are leaving by 290 * @dev: Device we arrived on/are leaving by
276 * @transport_header: Transport layer header 291 * @cb: Control buffer. Free for use by every layer. Put private vars here
277 * @network_header: Network layer header
278 * @mac_header: Link layer header
279 * @_skb_refdst: destination entry (with norefcount bit) 292 * @_skb_refdst: destination entry (with norefcount bit)
280 * @sp: the security path, used for xfrm 293 * @sp: the security path, used for xfrm
281 * @cb: Control buffer. Free for use by every layer. Put private vars here
282 * @len: Length of actual data 294 * @len: Length of actual data
283 * @data_len: Data length 295 * @data_len: Data length
284 * @mac_len: Length of link layer header 296 * @mac_len: Length of link layer header
@@ -286,40 +298,45 @@ typedef unsigned char *sk_buff_data_t;
286 * @csum: Checksum (must include start/offset pair) 298 * @csum: Checksum (must include start/offset pair)
287 * @csum_start: Offset from skb->head where checksumming should start 299 * @csum_start: Offset from skb->head where checksumming should start
288 * @csum_offset: Offset from csum_start where checksum should be stored 300 * @csum_offset: Offset from csum_start where checksum should be stored
301 * @priority: Packet queueing priority
289 * @local_df: allow local fragmentation 302 * @local_df: allow local fragmentation
290 * @cloned: Head may be cloned (check refcnt to be sure) 303 * @cloned: Head may be cloned (check refcnt to be sure)
304 * @ip_summed: Driver fed us an IP checksum
291 * @nohdr: Payload reference only, must not modify header 305 * @nohdr: Payload reference only, must not modify header
306 * @nfctinfo: Relationship of this skb to the connection
292 * @pkt_type: Packet class 307 * @pkt_type: Packet class
293 * @fclone: skbuff clone status 308 * @fclone: skbuff clone status
294 * @ip_summed: Driver fed us an IP checksum
295 * @priority: Packet queueing priority
296 * @users: User count - see {datagram,tcp}.c
297 * @protocol: Packet protocol from driver
298 * @truesize: Buffer size
299 * @head: Head of buffer
300 * @data: Data head pointer
301 * @tail: Tail pointer
302 * @end: End pointer
303 * @destructor: Destruct function
304 * @mark: Generic packet mark
305 * @nfct: Associated connection, if any
306 * @ipvs_property: skbuff is owned by ipvs 309 * @ipvs_property: skbuff is owned by ipvs
307 * @peeked: this packet has been seen already, so stats have been 310 * @peeked: this packet has been seen already, so stats have been
308 * done for it, don't do them again 311 * done for it, don't do them again
309 * @nf_trace: netfilter packet trace flag 312 * @nf_trace: netfilter packet trace flag
310 * @nfctinfo: Relationship of this skb to the connection 313 * @protocol: Packet protocol from driver
314 * @destructor: Destruct function
315 * @nfct: Associated connection, if any
311 * @nfct_reasm: netfilter conntrack re-assembly pointer 316 * @nfct_reasm: netfilter conntrack re-assembly pointer
312 * @nf_bridge: Saved data about a bridged frame - see br_netfilter.c 317 * @nf_bridge: Saved data about a bridged frame - see br_netfilter.c
313 * @skb_iif: ifindex of device we arrived on 318 * @skb_iif: ifindex of device we arrived on
314 * @rxhash: the packet hash computed on receive
315 * @queue_mapping: Queue mapping for multiqueue devices
316 * @tc_index: Traffic control index 319 * @tc_index: Traffic control index
317 * @tc_verd: traffic control verdict 320 * @tc_verd: traffic control verdict
321 * @rxhash: the packet hash computed on receive
322 * @queue_mapping: Queue mapping for multiqueue devices
318 * @ndisc_nodetype: router type (from link layer) 323 * @ndisc_nodetype: router type (from link layer)
324 * @ooo_okay: allow the mapping of a socket to a queue to be changed
319 * @dma_cookie: a cookie to one of several possible DMA operations 325 * @dma_cookie: a cookie to one of several possible DMA operations
320 * done by skb DMA functions 326 * done by skb DMA functions
321 * @secmark: security marking 327 * @secmark: security marking
328 * @mark: Generic packet mark
329 * @dropcount: total number of sk_receive_queue overflows
322 * @vlan_tci: vlan tag control information 330 * @vlan_tci: vlan tag control information
331 * @transport_header: Transport layer header
332 * @network_header: Network layer header
333 * @mac_header: Link layer header
334 * @tail: Tail pointer
335 * @end: End pointer
336 * @head: Head of buffer
337 * @data: Data head pointer
338 * @truesize: Buffer size
339 * @users: User count - see {datagram,tcp}.c
323 */ 340 */
324 341
325struct sk_buff { 342struct sk_buff {
@@ -507,6 +524,7 @@ static inline struct sk_buff *alloc_skb_fclone(unsigned int size,
507extern bool skb_recycle_check(struct sk_buff *skb, int skb_size); 524extern bool skb_recycle_check(struct sk_buff *skb, int skb_size);
508 525
509extern struct sk_buff *skb_morph(struct sk_buff *dst, struct sk_buff *src); 526extern struct sk_buff *skb_morph(struct sk_buff *dst, struct sk_buff *src);
527extern int skb_copy_ubufs(struct sk_buff *skb, gfp_t gfp_mask);
510extern struct sk_buff *skb_clone(struct sk_buff *skb, 528extern struct sk_buff *skb_clone(struct sk_buff *skb,
511 gfp_t priority); 529 gfp_t priority);
512extern struct sk_buff *skb_copy(const struct sk_buff *skb, 530extern struct sk_buff *skb_copy(const struct sk_buff *skb,
@@ -1562,16 +1580,22 @@ static inline struct sk_buff *netdev_alloc_skb(struct net_device *dev,
1562 return __netdev_alloc_skb(dev, length, GFP_ATOMIC); 1580 return __netdev_alloc_skb(dev, length, GFP_ATOMIC);
1563} 1581}
1564 1582
1565static inline struct sk_buff *netdev_alloc_skb_ip_align(struct net_device *dev, 1583static inline struct sk_buff *__netdev_alloc_skb_ip_align(struct net_device *dev,
1566 unsigned int length) 1584 unsigned int length, gfp_t gfp)
1567{ 1585{
1568 struct sk_buff *skb = netdev_alloc_skb(dev, length + NET_IP_ALIGN); 1586 struct sk_buff *skb = __netdev_alloc_skb(dev, length + NET_IP_ALIGN, gfp);
1569 1587
1570 if (NET_IP_ALIGN && skb) 1588 if (NET_IP_ALIGN && skb)
1571 skb_reserve(skb, NET_IP_ALIGN); 1589 skb_reserve(skb, NET_IP_ALIGN);
1572 return skb; 1590 return skb;
1573} 1591}
1574 1592
1593static inline struct sk_buff *netdev_alloc_skb_ip_align(struct net_device *dev,
1594 unsigned int length)
1595{
1596 return __netdev_alloc_skb_ip_align(dev, length, GFP_ATOMIC);
1597}
1598
1575/** 1599/**
1576 * __netdev_alloc_page - allocate a page for ps-rx on a specific device 1600 * __netdev_alloc_page - allocate a page for ps-rx on a specific device
1577 * @dev: network device to receive on 1601 * @dev: network device to receive on
@@ -1996,8 +2020,13 @@ static inline bool skb_defer_rx_timestamp(struct sk_buff *skb)
1996/** 2020/**
1997 * skb_complete_tx_timestamp() - deliver cloned skb with tx timestamps 2021 * skb_complete_tx_timestamp() - deliver cloned skb with tx timestamps
1998 * 2022 *
2023 * PHY drivers may accept clones of transmitted packets for
2024 * timestamping via their phy_driver.txtstamp method. These drivers
2025 * must call this function to return the skb back to the stack, with
2026 * or without a timestamp.
2027 *
1999 * @skb: clone of the the original outgoing packet 2028 * @skb: clone of the the original outgoing packet
2000 * @hwtstamps: hardware time stamps 2029 * @hwtstamps: hardware time stamps, may be NULL if not available
2001 * 2030 *
2002 */ 2031 */
2003void skb_complete_tx_timestamp(struct sk_buff *skb, 2032void skb_complete_tx_timestamp(struct sk_buff *skb,
@@ -2028,8 +2057,7 @@ static inline void sw_tx_timestamp(struct sk_buff *skb)
2028 * skb_tx_timestamp() - Driver hook for transmit timestamping 2057 * skb_tx_timestamp() - Driver hook for transmit timestamping
2029 * 2058 *
2030 * Ethernet MAC Drivers should call this function in their hard_xmit() 2059 * Ethernet MAC Drivers should call this function in their hard_xmit()
2031 * function as soon as possible after giving the sk_buff to the MAC 2060 * function immediately before giving the sk_buff to the MAC hardware.
2032 * hardware, but before freeing the sk_buff.
2033 * 2061 *
2034 * @skb: A socket buffer. 2062 * @skb: A socket buffer.
2035 */ 2063 */
@@ -2266,5 +2294,6 @@ static inline void skb_checksum_none_assert(struct sk_buff *skb)
2266} 2294}
2267 2295
2268bool skb_partial_csum_set(struct sk_buff *skb, u16 start, u16 off); 2296bool skb_partial_csum_set(struct sk_buff *skb, u16 start, u16 off);
2297
2269#endif /* __KERNEL__ */ 2298#endif /* __KERNEL__ */
2270#endif /* _LINUX_SKBUFF_H */ 2299#endif /* _LINUX_SKBUFF_H */
diff --git a/include/linux/slab.h b/include/linux/slab.h
index ad4dd1c8d30..573c809c33d 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -134,6 +134,26 @@ unsigned int kmem_cache_size(struct kmem_cache *);
134#define KMALLOC_MAX_ORDER (KMALLOC_SHIFT_HIGH - PAGE_SHIFT) 134#define KMALLOC_MAX_ORDER (KMALLOC_SHIFT_HIGH - PAGE_SHIFT)
135 135
136/* 136/*
137 * Some archs want to perform DMA into kmalloc caches and need a guaranteed
138 * alignment larger than the alignment of a 64-bit integer.
139 * Setting ARCH_KMALLOC_MINALIGN in arch headers allows that.
140 */
141#ifdef ARCH_DMA_MINALIGN
142#define ARCH_KMALLOC_MINALIGN ARCH_DMA_MINALIGN
143#else
144#define ARCH_KMALLOC_MINALIGN __alignof__(unsigned long long)
145#endif
146
147/*
148 * Setting ARCH_SLAB_MINALIGN in arch headers allows a different alignment.
149 * Intended for arches that get misalignment faults even for 64 bit integer
150 * aligned buffers.
151 */
152#ifndef ARCH_SLAB_MINALIGN
153#define ARCH_SLAB_MINALIGN __alignof__(unsigned long long)
154#endif
155
156/*
137 * Common kmalloc functions provided by all allocators 157 * Common kmalloc functions provided by all allocators
138 */ 158 */
139void * __must_check __krealloc(const void *, size_t, gfp_t); 159void * __must_check __krealloc(const void *, size_t, gfp_t);
diff --git a/include/linux/slab_def.h b/include/linux/slab_def.h
index 83203ae9390..d00e0bacda9 100644
--- a/include/linux/slab_def.h
+++ b/include/linux/slab_def.h
@@ -18,53 +18,25 @@
18#include <trace/events/kmem.h> 18#include <trace/events/kmem.h>
19 19
20/* 20/*
21 * Enforce a minimum alignment for the kmalloc caches.
22 * Usually, the kmalloc caches are cache_line_size() aligned, except when
23 * DEBUG and FORCED_DEBUG are enabled, then they are BYTES_PER_WORD aligned.
24 * Some archs want to perform DMA into kmalloc caches and need a guaranteed
25 * alignment larger than the alignment of a 64-bit integer.
26 * ARCH_KMALLOC_MINALIGN allows that.
27 * Note that increasing this value may disable some debug features.
28 */
29#ifdef ARCH_DMA_MINALIGN
30#define ARCH_KMALLOC_MINALIGN ARCH_DMA_MINALIGN
31#else
32#define ARCH_KMALLOC_MINALIGN __alignof__(unsigned long long)
33#endif
34
35#ifndef ARCH_SLAB_MINALIGN
36/*
37 * Enforce a minimum alignment for all caches.
38 * Intended for archs that get misalignment faults even for BYTES_PER_WORD
39 * aligned buffers. Includes ARCH_KMALLOC_MINALIGN.
40 * If possible: Do not enable this flag for CONFIG_DEBUG_SLAB, it disables
41 * some debug features.
42 */
43#define ARCH_SLAB_MINALIGN 0
44#endif
45
46/*
47 * struct kmem_cache 21 * struct kmem_cache
48 * 22 *
49 * manages a cache. 23 * manages a cache.
50 */ 24 */
51 25
52struct kmem_cache { 26struct kmem_cache {
53/* 1) per-cpu data, touched during every alloc/free */ 27/* 1) Cache tunables. Protected by cache_chain_mutex */
54 struct array_cache *array[NR_CPUS];
55/* 2) Cache tunables. Protected by cache_chain_mutex */
56 unsigned int batchcount; 28 unsigned int batchcount;
57 unsigned int limit; 29 unsigned int limit;
58 unsigned int shared; 30 unsigned int shared;
59 31
60 unsigned int buffer_size; 32 unsigned int buffer_size;
61 u32 reciprocal_buffer_size; 33 u32 reciprocal_buffer_size;
62/* 3) touched by every alloc & free from the backend */ 34/* 2) touched by every alloc & free from the backend */
63 35
64 unsigned int flags; /* constant flags */ 36 unsigned int flags; /* constant flags */
65 unsigned int num; /* # of objs per slab */ 37 unsigned int num; /* # of objs per slab */
66 38
67/* 4) cache_grow/shrink */ 39/* 3) cache_grow/shrink */
68 /* order of pgs per slab (2^n) */ 40 /* order of pgs per slab (2^n) */
69 unsigned int gfporder; 41 unsigned int gfporder;
70 42
@@ -80,11 +52,11 @@ struct kmem_cache {
80 /* constructor func */ 52 /* constructor func */
81 void (*ctor)(void *obj); 53 void (*ctor)(void *obj);
82 54
83/* 5) cache creation/removal */ 55/* 4) cache creation/removal */
84 const char *name; 56 const char *name;
85 struct list_head next; 57 struct list_head next;
86 58
87/* 6) statistics */ 59/* 5) statistics */
88#ifdef CONFIG_DEBUG_SLAB 60#ifdef CONFIG_DEBUG_SLAB
89 unsigned long num_active; 61 unsigned long num_active;
90 unsigned long num_allocations; 62 unsigned long num_allocations;
@@ -111,16 +83,18 @@ struct kmem_cache {
111 int obj_size; 83 int obj_size;
112#endif /* CONFIG_DEBUG_SLAB */ 84#endif /* CONFIG_DEBUG_SLAB */
113 85
86/* 6) per-cpu/per-node data, touched during every alloc/free */
114 /* 87 /*
115 * We put nodelists[] at the end of kmem_cache, because we want to size 88 * We put array[] at the end of kmem_cache, because we want to size
116 * this array to nr_node_ids slots instead of MAX_NUMNODES 89 * this array to nr_cpu_ids slots instead of NR_CPUS
117 * (see kmem_cache_init()) 90 * (see kmem_cache_init())
118 * We still use [MAX_NUMNODES] and not [1] or [0] because cache_cache 91 * We still use [NR_CPUS] and not [1] or [0] because cache_cache
119 * is statically defined, so we reserve the max number of nodes. 92 * is statically defined, so we reserve the max number of cpus.
120 */ 93 */
121 struct kmem_list3 *nodelists[MAX_NUMNODES]; 94 struct kmem_list3 **nodelists;
95 struct array_cache *array[NR_CPUS];
122 /* 96 /*
123 * Do not add fields after nodelists[] 97 * Do not add fields after array[]
124 */ 98 */
125}; 99};
126 100
diff --git a/include/linux/slob_def.h b/include/linux/slob_def.h
index 4382db09df4..0ec00b39d00 100644
--- a/include/linux/slob_def.h
+++ b/include/linux/slob_def.h
@@ -1,16 +1,6 @@
1#ifndef __LINUX_SLOB_DEF_H 1#ifndef __LINUX_SLOB_DEF_H
2#define __LINUX_SLOB_DEF_H 2#define __LINUX_SLOB_DEF_H
3 3
4#ifdef ARCH_DMA_MINALIGN
5#define ARCH_KMALLOC_MINALIGN ARCH_DMA_MINALIGN
6#else
7#define ARCH_KMALLOC_MINALIGN __alignof__(unsigned long)
8#endif
9
10#ifndef ARCH_SLAB_MINALIGN
11#define ARCH_SLAB_MINALIGN __alignof__(unsigned long)
12#endif
13
14void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node); 4void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node);
15 5
16static __always_inline void *kmem_cache_alloc(struct kmem_cache *cachep, 6static __always_inline void *kmem_cache_alloc(struct kmem_cache *cachep,
diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h
index c8668d161dd..f58d6413d23 100644
--- a/include/linux/slub_def.h
+++ b/include/linux/slub_def.h
@@ -24,6 +24,7 @@ enum stat_item {
24 ALLOC_FROM_PARTIAL, /* Cpu slab acquired from partial list */ 24 ALLOC_FROM_PARTIAL, /* Cpu slab acquired from partial list */
25 ALLOC_SLAB, /* Cpu slab acquired from page allocator */ 25 ALLOC_SLAB, /* Cpu slab acquired from page allocator */
26 ALLOC_REFILL, /* Refill cpu slab from slab freelist */ 26 ALLOC_REFILL, /* Refill cpu slab from slab freelist */
27 ALLOC_NODE_MISMATCH, /* Switching cpu slab */
27 FREE_SLAB, /* Slab freed to the page allocator */ 28 FREE_SLAB, /* Slab freed to the page allocator */
28 CPUSLAB_FLUSH, /* Abandoning of the cpu slab */ 29 CPUSLAB_FLUSH, /* Abandoning of the cpu slab */
29 DEACTIVATE_FULL, /* Cpu slab was full when deactivated */ 30 DEACTIVATE_FULL, /* Cpu slab was full when deactivated */
@@ -31,8 +32,10 @@ enum stat_item {
31 DEACTIVATE_TO_HEAD, /* Cpu slab was moved to the head of partials */ 32 DEACTIVATE_TO_HEAD, /* Cpu slab was moved to the head of partials */
32 DEACTIVATE_TO_TAIL, /* Cpu slab was moved to the tail of partials */ 33 DEACTIVATE_TO_TAIL, /* Cpu slab was moved to the tail of partials */
33 DEACTIVATE_REMOTE_FREES,/* Slab contained remotely freed objects */ 34 DEACTIVATE_REMOTE_FREES,/* Slab contained remotely freed objects */
35 DEACTIVATE_BYPASS, /* Implicit deactivation */
34 ORDER_FALLBACK, /* Number of times fallback was necessary */ 36 ORDER_FALLBACK, /* Number of times fallback was necessary */
35 CMPXCHG_DOUBLE_CPU_FAIL,/* Failure of this_cpu_cmpxchg_double */ 37 CMPXCHG_DOUBLE_CPU_FAIL,/* Failure of this_cpu_cmpxchg_double */
38 CMPXCHG_DOUBLE_FAIL, /* Number of times that cmpxchg double did not match */
36 NR_SLUB_STAT_ITEMS }; 39 NR_SLUB_STAT_ITEMS };
37 40
38struct kmem_cache_cpu { 41struct kmem_cache_cpu {
@@ -113,16 +116,6 @@ struct kmem_cache {
113 116
114#define KMALLOC_SHIFT_LOW ilog2(KMALLOC_MIN_SIZE) 117#define KMALLOC_SHIFT_LOW ilog2(KMALLOC_MIN_SIZE)
115 118
116#ifdef ARCH_DMA_MINALIGN
117#define ARCH_KMALLOC_MINALIGN ARCH_DMA_MINALIGN
118#else
119#define ARCH_KMALLOC_MINALIGN __alignof__(unsigned long long)
120#endif
121
122#ifndef ARCH_SLAB_MINALIGN
123#define ARCH_SLAB_MINALIGN __alignof__(unsigned long long)
124#endif
125
126/* 119/*
127 * Maximum kmalloc object size handled by SLUB. Larger object allocations 120 * Maximum kmalloc object size handled by SLUB. Larger object allocations
128 * are passed through to the page allocator. The page allocator "fastpath" 121 * are passed through to the page allocator. The page allocator "fastpath"
@@ -228,6 +221,19 @@ kmalloc_order(size_t size, gfp_t flags, unsigned int order)
228 return ret; 221 return ret;
229} 222}
230 223
224/**
225 * Calling this on allocated memory will check that the memory
226 * is expected to be in use, and print warnings if not.
227 */
228#ifdef CONFIG_SLUB_DEBUG
229extern bool verify_mem_not_deleted(const void *x);
230#else
231static inline bool verify_mem_not_deleted(const void *x)
232{
233 return true;
234}
235#endif
236
231#ifdef CONFIG_TRACING 237#ifdef CONFIG_TRACING
232extern void * 238extern void *
233kmem_cache_alloc_trace(struct kmem_cache *s, gfp_t gfpflags, size_t size); 239kmem_cache_alloc_trace(struct kmem_cache *s, gfp_t gfpflags, size_t size);
diff --git a/include/linux/smb349-charger.h b/include/linux/smb349-charger.h
new file mode 100644
index 00000000000..116f036baf1
--- /dev/null
+++ b/include/linux/smb349-charger.h
@@ -0,0 +1,63 @@
1/*
2 * include/linux/smb349-charger.h
3 *
4 * Battery charger driver interface for Summit SMB349
5 *
6 * Copyright (C) 2012 NVIDIA Corporation
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;
11 *
12 * This program is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 * more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 *
21 */
22
23#ifndef __LINUX_SMB349_CHARGER_H
24#define __LINUX_SMB349_CHARGER_H
25
26#include <linux/regulator/machine.h>
27
28enum charging_states {
29 idle,
30 progress,
31 completed,
32 stopped,
33};
34
35enum charger_type {
36 AC,
37 USB,
38};
39
40typedef void (*charging_callback_t)(enum charging_states state,
41enum charger_type chrg_type, void *args);
42
43struct smb349_charger {
44 struct i2c_client *client;
45 struct device *dev;
46 void *charger_cb_data;
47 enum charging_states state;
48 enum charger_type chrg_type;
49 charging_callback_t charger_cb;
50};
51
52int smb349_battery_online(void);
53typedef void (*callback_t)(enum usb_otg_state to,
54 enum usb_otg_state from, void *args);
55/*
56 * Register callback function for the client.
57 * Used by fuel-gauge driver to get battery charging properties.
58 */
59extern int register_callback(charging_callback_t cb, void *args);
60extern int register_otg_callback(callback_t cb, void *args);
61extern int update_charger_status(void);
62
63#endif /*__LINUX_SMB349_CHARGER_H */
diff --git a/include/linux/snmp.h b/include/linux/snmp.h
index 12b2b18e50c..e16557a357e 100644
--- a/include/linux/snmp.h
+++ b/include/linux/snmp.h
@@ -231,6 +231,8 @@ enum
231 LINUX_MIB_TCPDEFERACCEPTDROP, 231 LINUX_MIB_TCPDEFERACCEPTDROP,
232 LINUX_MIB_IPRPFILTER, /* IP Reverse Path Filter (rp_filter) */ 232 LINUX_MIB_IPRPFILTER, /* IP Reverse Path Filter (rp_filter) */
233 LINUX_MIB_TCPTIMEWAITOVERFLOW, /* TCPTimeWaitOverflow */ 233 LINUX_MIB_TCPTIMEWAITOVERFLOW, /* TCPTimeWaitOverflow */
234 LINUX_MIB_TCPREQQFULLDOCOOKIES, /* TCPReqQFullDoCookies */
235 LINUX_MIB_TCPREQQFULLDROP, /* TCPReqQFullDrop */
234 __LINUX_MIB_MAX 236 __LINUX_MIB_MAX
235}; 237};
236 238
diff --git a/include/linux/socket.h b/include/linux/socket.h
index 4ef98e422fd..d0e77f607a7 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -8,8 +8,10 @@
8#define _K_SS_ALIGNSIZE (__alignof__ (struct sockaddr *)) 8#define _K_SS_ALIGNSIZE (__alignof__ (struct sockaddr *))
9 /* Implementation specific desired alignment */ 9 /* Implementation specific desired alignment */
10 10
11typedef unsigned short __kernel_sa_family_t;
12
11struct __kernel_sockaddr_storage { 13struct __kernel_sockaddr_storage {
12 unsigned short ss_family; /* address family */ 14 __kernel_sa_family_t ss_family; /* address family */
13 /* Following field(s) are implementation specific */ 15 /* Following field(s) are implementation specific */
14 char __data[_K_SS_MAXSIZE - sizeof(unsigned short)]; 16 char __data[_K_SS_MAXSIZE - sizeof(unsigned short)];
15 /* space to achieve desired size, */ 17 /* space to achieve desired size, */
@@ -35,7 +37,7 @@ struct seq_file;
35extern void socket_seq_show(struct seq_file *seq); 37extern void socket_seq_show(struct seq_file *seq);
36#endif 38#endif
37 39
38typedef unsigned short sa_family_t; 40typedef __kernel_sa_family_t sa_family_t;
39 41
40/* 42/*
41 * 1003.1g requires sa_family_t and that sa_data is char. 43 * 1003.1g requires sa_family_t and that sa_data is char.
@@ -192,7 +194,8 @@ struct ucred {
192#define AF_IEEE802154 36 /* IEEE802154 sockets */ 194#define AF_IEEE802154 36 /* IEEE802154 sockets */
193#define AF_CAIF 37 /* CAIF sockets */ 195#define AF_CAIF 37 /* CAIF sockets */
194#define AF_ALG 38 /* Algorithm sockets */ 196#define AF_ALG 38 /* Algorithm sockets */
195#define AF_MAX 39 /* For now.. */ 197#define AF_NFC 39 /* NFC sockets */
198#define AF_MAX 40 /* For now.. */
196 199
197/* Protocol families, same as address families. */ 200/* Protocol families, same as address families. */
198#define PF_UNSPEC AF_UNSPEC 201#define PF_UNSPEC AF_UNSPEC
@@ -234,6 +237,7 @@ struct ucred {
234#define PF_IEEE802154 AF_IEEE802154 237#define PF_IEEE802154 AF_IEEE802154
235#define PF_CAIF AF_CAIF 238#define PF_CAIF AF_CAIF
236#define PF_ALG AF_ALG 239#define PF_ALG AF_ALG
240#define PF_NFC AF_NFC
237#define PF_MAX AF_MAX 241#define PF_MAX AF_MAX
238 242
239/* Maximum queue length specifiable by listen. */ 243/* Maximum queue length specifiable by listen. */
diff --git a/include/linux/sockios.h b/include/linux/sockios.h
index 7997a506ad4..f7ffe36db03 100644
--- a/include/linux/sockios.h
+++ b/include/linux/sockios.h
@@ -65,6 +65,7 @@
65#define SIOCDIFADDR 0x8936 /* delete PA address */ 65#define SIOCDIFADDR 0x8936 /* delete PA address */
66#define SIOCSIFHWBROADCAST 0x8937 /* set hardware broadcast addr */ 66#define SIOCSIFHWBROADCAST 0x8937 /* set hardware broadcast addr */
67#define SIOCGIFCOUNT 0x8938 /* get number of devices */ 67#define SIOCGIFCOUNT 0x8938 /* get number of devices */
68#define SIOCKILLADDR 0x8939 /* kill sockets with this local addr */
68 69
69#define SIOCGIFBR 0x8940 /* Bridging support */ 70#define SIOCGIFBR 0x8940 /* Bridging support */
70#define SIOCSIFBR 0x8941 /* Set bridging options */ 71#define SIOCSIFBR 0x8941 /* Set bridging options */
diff --git a/include/linux/sonet.h b/include/linux/sonet.h
index 67ad11fcf88..de8832dd272 100644
--- a/include/linux/sonet.h
+++ b/include/linux/sonet.h
@@ -58,7 +58,7 @@ struct sonet_stats {
58 58
59#ifdef __KERNEL__ 59#ifdef __KERNEL__
60 60
61#include <asm/atomic.h> 61#include <linux/atomic.h>
62 62
63struct k_sonet_stats { 63struct k_sonet_stats {
64#define __HANDLE_ITEM(i) atomic_t i 64#define __HANDLE_ITEM(i) atomic_t i
diff --git a/include/linux/spi-tegra.h b/include/linux/spi-tegra.h
new file mode 100644
index 00000000000..38096500551
--- /dev/null
+++ b/include/linux/spi-tegra.h
@@ -0,0 +1,50 @@
1/*
2 * include/linux/spi-tegra.c
3 *
4 * Copyright (C) 2011 NVIDIA Corporation
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, 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
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 */
20
21#ifndef _LINUX_SPI_TEGRA_H
22#define _LINUX_SPI_TEGRA_H
23
24#include <linux/clk.h>
25
26struct spi_clk_parent {
27 const char *name;
28 struct clk *parent_clk;
29 unsigned long fixed_clk_rate;
30};
31
32struct tegra_spi_platform_data {
33 bool is_dma_based;
34 int max_dma_buffer;
35 bool is_clkon_always;
36 unsigned int max_rate;
37 struct spi_clk_parent *parent_clk_list;
38 int parent_clk_count;
39};
40
41/* Controller data from device to pass some info like
42 * hw based chip select can be used or not and if yes
43 * then CS hold and setup time. */
44struct tegra_spi_device_controller_data {
45 bool is_hw_based_cs;
46 int cs_setup_clk_count;
47 int cs_hold_clk_count;
48};
49
50#endif /* _LINUX_SPI_TEGRA_H */
diff --git a/include/linux/spi/74x164.h b/include/linux/spi/74x164.h
index d85c52f294a..0aa6acc7331 100644
--- a/include/linux/spi/74x164.h
+++ b/include/linux/spi/74x164.h
@@ -1,8 +1,6 @@
1#ifndef LINUX_SPI_74X164_H 1#ifndef LINUX_SPI_74X164_H
2#define LINUX_SPI_74X164_H 2#define LINUX_SPI_74X164_H
3 3
4#define GEN_74X164_DRIVER_NAME "74x164"
5
6struct gen_74x164_chip_platform_data { 4struct gen_74x164_chip_platform_data {
7 /* number assigned to the first GPIO */ 5 /* number assigned to the first GPIO */
8 unsigned base; 6 unsigned base;
diff --git a/include/linux/spi/mcp23s08.h b/include/linux/spi/mcp23s08.h
index c42cff8ca19..2d676d5aaa8 100644
--- a/include/linux/spi/mcp23s08.h
+++ b/include/linux/spi/mcp23s08.h
@@ -22,13 +22,4 @@ struct mcp23s08_platform_data {
22 * base to base+15 (or base+31 for s17 variant). 22 * base to base+15 (or base+31 for s17 variant).
23 */ 23 */
24 unsigned base; 24 unsigned base;
25
26 void *context; /* param to setup/teardown */
27
28 int (*setup)(struct spi_device *spi,
29 int gpio, unsigned ngpio,
30 void *context);
31 int (*teardown)(struct spi_device *spi,
32 int gpio, unsigned ngpio,
33 void *context);
34}; 25};
diff --git a/include/linux/spi/rm31080a_ts.h b/include/linux/spi/rm31080a_ts.h
new file mode 100644
index 00000000000..13323a6f2ec
--- /dev/null
+++ b/include/linux/spi/rm31080a_ts.h
@@ -0,0 +1,44 @@
1#ifndef _RM31080A_TS_H_
2#define _RM31080A_TS_H_
3
4#define ENABLE_RAW_DATA_QUEUE
5
6#define RM_IOCTL_REPORT_POINT 0x1001
7#define RM_IOCTL_SET_HAL_PID 0x1002
8#define RM_IOCTL_INIT_START 0x1003
9#define RM_IOCTL_INIT_END 0x1004
10#define RM_IOCTL_FINISH_CALC 0x1005
11#define RM_IOCTL_SCRIBER_CTRL 0x1006
12#define RM_IOCTL_READ_RAW_DATA 0x1007
13#define RM_IOCTL_AUTOSCAN_CTRL 0x1008
14#define RM_IOCTL_NOISE_CHECK 0x1009
15#define RM_IOCTL_GET_PARAMETER 0x100A
16#define RM_IOCTL_SET_PARAMETER 0x100B
17
18#define RM_INPUT_RESOLUTION_X 4096
19#define RM_INPUT_RESOLUTION_Y 4096
20
21#define RM_TS_SIGNAL 44
22#define RM_TS_MAX_POINTS 16
23
24#define RM_SIGNAL_INTR 0x00000001
25#define RM_SIGNAL_SUSPEND 0x00000002
26#define RM_SIGNAL_RESUME 0x00000003
27
28typedef struct {
29 unsigned char ucTouchCount;
30 unsigned char ucID[RM_TS_MAX_POINTS];
31 unsigned short usX[RM_TS_MAX_POINTS];
32 unsigned short usY[RM_TS_MAX_POINTS];
33 unsigned short usZ[RM_TS_MAX_POINTS];
34} rm_touch_event;
35
36
37struct rm_spi_ts_platform_data{
38 int gpio_reset;
39 int x_size;
40 int y_size;
41 unsigned char* config;
42};
43
44#endif //_RM31080A_TS_H_
diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h
index 0b22d51258e..7df6c17b028 100644
--- a/include/linux/spinlock.h
+++ b/include/linux/spinlock.h
@@ -384,7 +384,7 @@ static inline void assert_spin_locked(spinlock_t *lock)
384 * Pull the atomic_t declaration: 384 * Pull the atomic_t declaration:
385 * (asm-mips/atomic.h needs above definitions) 385 * (asm-mips/atomic.h needs above definitions)
386 */ 386 */
387#include <asm/atomic.h> 387#include <linux/atomic.h>
388/** 388/**
389 * atomic_dec_and_lock - lock on reaching reference count zero 389 * atomic_dec_and_lock - lock on reaching reference count zero
390 * @atomic: the atomic counter 390 * @atomic: the atomic counter
diff --git a/include/linux/splice.h b/include/linux/splice.h
index 997c3b4c212..26e5b613ded 100644
--- a/include/linux/splice.h
+++ b/include/linux/splice.h
@@ -88,5 +88,7 @@ extern ssize_t splice_direct_to_actor(struct file *, struct splice_desc *,
88extern int splice_grow_spd(struct pipe_inode_info *, struct splice_pipe_desc *); 88extern int splice_grow_spd(struct pipe_inode_info *, struct splice_pipe_desc *);
89extern void splice_shrink_spd(struct pipe_inode_info *, 89extern void splice_shrink_spd(struct pipe_inode_info *,
90 struct splice_pipe_desc *); 90 struct splice_pipe_desc *);
91extern void spd_release_page(struct splice_pipe_desc *, unsigned int);
91 92
93extern const struct pipe_buf_operations page_cache_pipe_buf_ops;
92#endif 94#endif
diff --git a/include/linux/ssb/ssb.h b/include/linux/ssb/ssb.h
index 252e4482178..8623217f84d 100644
--- a/include/linux/ssb/ssb.h
+++ b/include/linux/ssb/ssb.h
@@ -27,6 +27,8 @@ struct ssb_sprom {
27 u8 et1mdcport; /* MDIO for enet1 */ 27 u8 et1mdcport; /* MDIO for enet1 */
28 u8 board_rev; /* Board revision number from SPROM. */ 28 u8 board_rev; /* Board revision number from SPROM. */
29 u8 country_code; /* Country Code */ 29 u8 country_code; /* Country Code */
30 u16 leddc_on_time; /* LED Powersave Duty Cycle On Count */
31 u16 leddc_off_time; /* LED Powersave Duty Cycle Off Count */
30 u8 ant_available_a; /* 2GHz antenna available bits (up to 4) */ 32 u8 ant_available_a; /* 2GHz antenna available bits (up to 4) */
31 u8 ant_available_bg; /* 5GHz antenna available bits (up to 4) */ 33 u8 ant_available_bg; /* 5GHz antenna available bits (up to 4) */
32 u16 pa0b0; 34 u16 pa0b0;
@@ -99,7 +101,7 @@ struct ssb_sprom {
99struct ssb_boardinfo { 101struct ssb_boardinfo {
100 u16 vendor; 102 u16 vendor;
101 u16 type; 103 u16 type;
102 u16 rev; 104 u8 rev;
103}; 105};
104 106
105 107
diff --git a/include/linux/ssb/ssb_driver_chipcommon.h b/include/linux/ssb/ssb_driver_chipcommon.h
index a08d693d832..1a6b0045b06 100644
--- a/include/linux/ssb/ssb_driver_chipcommon.h
+++ b/include/linux/ssb/ssb_driver_chipcommon.h
@@ -8,7 +8,7 @@
8 * gpio interface, extbus, and support for serial and parallel flashes. 8 * gpio interface, extbus, and support for serial and parallel flashes.
9 * 9 *
10 * Copyright 2005, Broadcom Corporation 10 * Copyright 2005, Broadcom Corporation
11 * Copyright 2006, Michael Buesch <mb@bu3sch.de> 11 * Copyright 2006, Michael Buesch <m@bues.ch>
12 * 12 *
13 * Licensed under the GPL version 2. See COPYING for details. 13 * Licensed under the GPL version 2. See COPYING for details.
14 */ 14 */
diff --git a/include/linux/stacktrace.h b/include/linux/stacktrace.h
index 25310f1d7f3..115b570e3bf 100644
--- a/include/linux/stacktrace.h
+++ b/include/linux/stacktrace.h
@@ -14,8 +14,8 @@ struct stack_trace {
14}; 14};
15 15
16extern void save_stack_trace(struct stack_trace *trace); 16extern void save_stack_trace(struct stack_trace *trace);
17extern void save_stack_trace_regs(struct stack_trace *trace, 17extern void save_stack_trace_regs(struct pt_regs *regs,
18 struct pt_regs *regs); 18 struct stack_trace *trace);
19extern void save_stack_trace_tsk(struct task_struct *tsk, 19extern void save_stack_trace_tsk(struct task_struct *tsk,
20 struct stack_trace *trace); 20 struct stack_trace *trace);
21 21
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
index 9529e49b038..0dddc9e42b6 100644
--- a/include/linux/stmmac.h
+++ b/include/linux/stmmac.h
@@ -28,11 +28,21 @@
28 28
29#include <linux/platform_device.h> 29#include <linux/platform_device.h>
30 30
31/* platform data for platform device structure's platform_data field */ 31/* Platfrom data for platform device structure's platform_data field */
32
33struct stmmac_mdio_bus_data {
34 int bus_id;
35 int (*phy_reset)(void *priv);
36 unsigned int phy_mask;
37 int *irqs;
38 int probed_phy_irq;
39};
32 40
33/* Private data for the STM on-board ethernet driver */
34struct plat_stmmacenet_data { 41struct plat_stmmacenet_data {
35 int bus_id; 42 int bus_id;
43 int phy_addr;
44 int interface;
45 struct stmmac_mdio_bus_data *mdio_bus_data;
36 int pbl; 46 int pbl;
37 int clk_csr; 47 int clk_csr;
38 int has_gmac; 48 int has_gmac;
@@ -40,6 +50,7 @@ struct plat_stmmacenet_data {
40 int tx_coe; 50 int tx_coe;
41 int bugged_jumbo; 51 int bugged_jumbo;
42 int pmt; 52 int pmt;
53 int force_sf_dma_mode;
43 void (*fix_mac_speed)(void *priv, unsigned int speed); 54 void (*fix_mac_speed)(void *priv, unsigned int speed);
44 void (*bus_setup)(void __iomem *ioaddr); 55 void (*bus_setup)(void __iomem *ioaddr);
45 int (*init)(struct platform_device *pdev); 56 int (*init)(struct platform_device *pdev);
@@ -47,14 +58,4 @@ struct plat_stmmacenet_data {
47 void *custom_cfg; 58 void *custom_cfg;
48 void *bsp_priv; 59 void *bsp_priv;
49}; 60};
50
51struct plat_stmmacphy_data {
52 int bus_id;
53 int phy_addr;
54 unsigned int phy_mask;
55 int interface;
56 int (*phy_reset)(void *priv);
57 void *priv;
58};
59#endif 61#endif
60
diff --git a/include/linux/stop_machine.h b/include/linux/stop_machine.h
index 092dc9b1ce7..2d04ea91676 100644
--- a/include/linux/stop_machine.h
+++ b/include/linux/stop_machine.h
@@ -94,7 +94,7 @@ static inline int try_stop_cpus(const struct cpumask *cpumask,
94 * stop_machine "Bogolock": stop the entire machine, disable 94 * stop_machine "Bogolock": stop the entire machine, disable
95 * interrupts. This is a very heavy lock, which is equivalent to 95 * interrupts. This is a very heavy lock, which is equivalent to
96 * grabbing every spinlock (and more). So the "read" side to such a 96 * grabbing every spinlock (and more). So the "read" side to such a
97 * lock is anything which disables preeempt. 97 * lock is anything which disables preemption.
98 */ 98 */
99#if defined(CONFIG_STOP_MACHINE) && defined(CONFIG_SMP) 99#if defined(CONFIG_STOP_MACHINE) && defined(CONFIG_SMP)
100 100
@@ -124,15 +124,19 @@ int stop_machine(int (*fn)(void *), void *data, const struct cpumask *cpus);
124 */ 124 */
125int __stop_machine(int (*fn)(void *), void *data, const struct cpumask *cpus); 125int __stop_machine(int (*fn)(void *), void *data, const struct cpumask *cpus);
126 126
127int stop_machine_from_inactive_cpu(int (*fn)(void *), void *data,
128 const struct cpumask *cpus);
129
127#else /* CONFIG_STOP_MACHINE && CONFIG_SMP */ 130#else /* CONFIG_STOP_MACHINE && CONFIG_SMP */
128 131
129static inline int __stop_machine(int (*fn)(void *), void *data, 132static inline int __stop_machine(int (*fn)(void *), void *data,
130 const struct cpumask *cpus) 133 const struct cpumask *cpus)
131{ 134{
135 unsigned long flags;
132 int ret; 136 int ret;
133 local_irq_disable(); 137 local_irq_save(flags);
134 ret = fn(data); 138 ret = fn(data);
135 local_irq_enable(); 139 local_irq_restore(flags);
136 return ret; 140 return ret;
137} 141}
138 142
@@ -142,5 +146,11 @@ static inline int stop_machine(int (*fn)(void *), void *data,
142 return __stop_machine(fn, data, cpus); 146 return __stop_machine(fn, data, cpus);
143} 147}
144 148
149static inline int stop_machine_from_inactive_cpu(int (*fn)(void *), void *data,
150 const struct cpumask *cpus)
151{
152 return __stop_machine(fn, data, cpus);
153}
154
145#endif /* CONFIG_STOP_MACHINE && CONFIG_SMP */ 155#endif /* CONFIG_STOP_MACHINE && CONFIG_SMP */
146#endif /* _LINUX_STOP_MACHINE */ 156#endif /* _LINUX_STOP_MACHINE */
diff --git a/include/linux/sunrpc/auth.h b/include/linux/sunrpc/auth.h
index 8521067ed4f..febc4dbec2c 100644
--- a/include/linux/sunrpc/auth.h
+++ b/include/linux/sunrpc/auth.h
@@ -15,7 +15,7 @@
15#include <linux/sunrpc/msg_prot.h> 15#include <linux/sunrpc/msg_prot.h>
16#include <linux/sunrpc/xdr.h> 16#include <linux/sunrpc/xdr.h>
17 17
18#include <asm/atomic.h> 18#include <linux/atomic.h>
19#include <linux/rcupdate.h> 19#include <linux/rcupdate.h>
20 20
21/* size of the nodename buffer */ 21/* size of the nodename buffer */
diff --git a/include/linux/sunrpc/bc_xprt.h b/include/linux/sunrpc/bc_xprt.h
index 082884295f8..f7f3ce340c0 100644
--- a/include/linux/sunrpc/bc_xprt.h
+++ b/include/linux/sunrpc/bc_xprt.h
@@ -31,7 +31,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31#include <linux/sunrpc/xprt.h> 31#include <linux/sunrpc/xprt.h>
32#include <linux/sunrpc/sched.h> 32#include <linux/sunrpc/sched.h>
33 33
34#ifdef CONFIG_NFS_V4_1 34#ifdef CONFIG_SUNRPC_BACKCHANNEL
35struct rpc_rqst *xprt_alloc_bc_request(struct rpc_xprt *xprt); 35struct rpc_rqst *xprt_alloc_bc_request(struct rpc_xprt *xprt);
36void xprt_free_bc_request(struct rpc_rqst *req); 36void xprt_free_bc_request(struct rpc_rqst *req);
37int xprt_setup_backchannel(struct rpc_xprt *, unsigned int min_reqs); 37int xprt_setup_backchannel(struct rpc_xprt *, unsigned int min_reqs);
@@ -47,7 +47,7 @@ static inline int svc_is_backchannel(const struct svc_rqst *rqstp)
47 return 1; 47 return 1;
48 return 0; 48 return 0;
49} 49}
50#else /* CONFIG_NFS_V4_1 */ 50#else /* CONFIG_SUNRPC_BACKCHANNEL */
51static inline int xprt_setup_backchannel(struct rpc_xprt *xprt, 51static inline int xprt_setup_backchannel(struct rpc_xprt *xprt,
52 unsigned int min_reqs) 52 unsigned int min_reqs)
53{ 53{
@@ -62,6 +62,6 @@ static inline int svc_is_backchannel(const struct svc_rqst *rqstp)
62static inline void xprt_free_bc_request(struct rpc_rqst *req) 62static inline void xprt_free_bc_request(struct rpc_rqst *req)
63{ 63{
64} 64}
65#endif /* CONFIG_NFS_V4_1 */ 65#endif /* CONFIG_SUNRPC_BACKCHANNEL */
66#endif /* _LINUX_SUNRPC_BC_XPRT_H */ 66#endif /* _LINUX_SUNRPC_BC_XPRT_H */
67 67
diff --git a/include/linux/sunrpc/cache.h b/include/linux/sunrpc/cache.h
index 8d2eef1a858..5efd8cef389 100644
--- a/include/linux/sunrpc/cache.h
+++ b/include/linux/sunrpc/cache.h
@@ -15,7 +15,7 @@
15 15
16#include <linux/kref.h> 16#include <linux/kref.h>
17#include <linux/slab.h> 17#include <linux/slab.h>
18#include <asm/atomic.h> 18#include <linux/atomic.h>
19#include <linux/proc_fs.h> 19#include <linux/proc_fs.h>
20 20
21/* 21/*
@@ -256,13 +256,4 @@ static inline time_t get_expiry(char **bpp)
256 return rv - boot.tv_sec; 256 return rv - boot.tv_sec;
257} 257}
258 258
259#ifdef CONFIG_NFSD_DEPRECATED
260static inline void sunrpc_invalidate(struct cache_head *h,
261 struct cache_detail *detail)
262{
263 h->expiry_time = seconds_since_boot() - 1;
264 detail->nextcheck = seconds_since_boot();
265}
266#endif /* CONFIG_NFSD_DEPRECATED */
267
268#endif /* _LINUX_SUNRPC_CACHE_H_ */ 259#endif /* _LINUX_SUNRPC_CACHE_H_ */
diff --git a/include/linux/sunrpc/rpc_pipe_fs.h b/include/linux/sunrpc/rpc_pipe_fs.h
index cf14db975da..e4ea43058d8 100644
--- a/include/linux/sunrpc/rpc_pipe_fs.h
+++ b/include/linux/sunrpc/rpc_pipe_fs.h
@@ -44,6 +44,8 @@ RPC_I(struct inode *inode)
44 return container_of(inode, struct rpc_inode, vfs_inode); 44 return container_of(inode, struct rpc_inode, vfs_inode);
45} 45}
46 46
47extern ssize_t rpc_pipe_generic_upcall(struct file *, struct rpc_pipe_msg *,
48 char __user *, size_t);
47extern int rpc_queue_upcall(struct inode *, struct rpc_pipe_msg *); 49extern int rpc_queue_upcall(struct inode *, struct rpc_pipe_msg *);
48 50
49struct rpc_clnt; 51struct rpc_clnt;
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h
index fe2d8e6b923..e7756896f3c 100644
--- a/include/linux/sunrpc/sched.h
+++ b/include/linux/sunrpc/sched.h
@@ -227,6 +227,10 @@ void rpc_init_wait_queue(struct rpc_wait_queue *, const char *);
227void rpc_destroy_wait_queue(struct rpc_wait_queue *); 227void rpc_destroy_wait_queue(struct rpc_wait_queue *);
228void rpc_sleep_on(struct rpc_wait_queue *, struct rpc_task *, 228void rpc_sleep_on(struct rpc_wait_queue *, struct rpc_task *,
229 rpc_action action); 229 rpc_action action);
230void rpc_sleep_on_priority(struct rpc_wait_queue *,
231 struct rpc_task *,
232 rpc_action action,
233 int priority);
230void rpc_wake_up_queued_task(struct rpc_wait_queue *, 234void rpc_wake_up_queued_task(struct rpc_wait_queue *,
231 struct rpc_task *); 235 struct rpc_task *);
232void rpc_wake_up(struct rpc_wait_queue *); 236void rpc_wake_up(struct rpc_wait_queue *);
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h
index ea29330b78b..223588a976a 100644
--- a/include/linux/sunrpc/svc.h
+++ b/include/linux/sunrpc/svc.h
@@ -92,7 +92,7 @@ struct svc_serv {
92 struct module * sv_module; /* optional module to count when 92 struct module * sv_module; /* optional module to count when
93 * adding threads */ 93 * adding threads */
94 svc_thread_fn sv_function; /* main function for threads */ 94 svc_thread_fn sv_function; /* main function for threads */
95#if defined(CONFIG_NFS_V4_1) 95#if defined(CONFIG_SUNRPC_BACKCHANNEL)
96 struct list_head sv_cb_list; /* queue for callback requests 96 struct list_head sv_cb_list; /* queue for callback requests
97 * that arrive over the same 97 * that arrive over the same
98 * connection */ 98 * connection */
@@ -100,7 +100,7 @@ struct svc_serv {
100 wait_queue_head_t sv_cb_waitq; /* sleep here if there are no 100 wait_queue_head_t sv_cb_waitq; /* sleep here if there are no
101 * entries in the svc_cb_list */ 101 * entries in the svc_cb_list */
102 struct svc_xprt *sv_bc_xprt; /* callback on fore channel */ 102 struct svc_xprt *sv_bc_xprt; /* callback on fore channel */
103#endif /* CONFIG_NFS_V4_1 */ 103#endif /* CONFIG_SUNRPC_BACKCHANNEL */
104}; 104};
105 105
106/* 106/*
@@ -273,6 +273,7 @@ struct svc_rqst {
273 /* Catering to nfsd */ 273 /* Catering to nfsd */
274 struct auth_domain * rq_client; /* RPC peer info */ 274 struct auth_domain * rq_client; /* RPC peer info */
275 struct auth_domain * rq_gssclient; /* "gss/"-style peer info */ 275 struct auth_domain * rq_gssclient; /* "gss/"-style peer info */
276 int rq_cachetype;
276 struct svc_cacherep * rq_cacherep; /* cache info */ 277 struct svc_cacherep * rq_cacherep; /* cache info */
277 int rq_splice_ok; /* turned off in gss privacy 278 int rq_splice_ok; /* turned off in gss privacy
278 * to prevent encrypting page 279 * to prevent encrypting page
diff --git a/include/linux/sunrpc/timer.h b/include/linux/sunrpc/timer.h
index a67fd734c73..697d6e69d61 100644
--- a/include/linux/sunrpc/timer.h
+++ b/include/linux/sunrpc/timer.h
@@ -9,7 +9,7 @@
9#ifndef _LINUX_SUNRPC_TIMER_H 9#ifndef _LINUX_SUNRPC_TIMER_H
10#define _LINUX_SUNRPC_TIMER_H 10#define _LINUX_SUNRPC_TIMER_H
11 11
12#include <asm/atomic.h> 12#include <linux/atomic.h>
13 13
14struct rpc_rtt { 14struct rpc_rtt {
15 unsigned long timeo; /* default timeout value */ 15 unsigned long timeo; /* default timeout value */
diff --git a/include/linux/sunrpc/xdr.h b/include/linux/sunrpc/xdr.h
index a20970ef9e4..af70af33354 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/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h
index 81cce3b3ee6..15518a152ac 100644
--- a/include/linux/sunrpc/xprt.h
+++ b/include/linux/sunrpc/xprt.h
@@ -22,6 +22,7 @@
22#define RPC_MIN_SLOT_TABLE (2U) 22#define RPC_MIN_SLOT_TABLE (2U)
23#define RPC_DEF_SLOT_TABLE (16U) 23#define RPC_DEF_SLOT_TABLE (16U)
24#define RPC_MAX_SLOT_TABLE (128U) 24#define RPC_MAX_SLOT_TABLE (128U)
25#define RPC_MAX_SLOT_TABLE_LIMIT (65536U)
25 26
26/* 27/*
27 * This describes a timeout strategy 28 * This describes a timeout strategy
@@ -100,18 +101,18 @@ struct rpc_rqst {
100 ktime_t rq_xtime; /* transmit time stamp */ 101 ktime_t rq_xtime; /* transmit time stamp */
101 int rq_ntrans; 102 int rq_ntrans;
102 103
103#if defined(CONFIG_NFS_V4_1) 104#if defined(CONFIG_SUNRPC_BACKCHANNEL)
104 struct list_head rq_bc_list; /* Callback service list */ 105 struct list_head rq_bc_list; /* Callback service list */
105 unsigned long rq_bc_pa_state; /* Backchannel prealloc state */ 106 unsigned long rq_bc_pa_state; /* Backchannel prealloc state */
106 struct list_head rq_bc_pa_list; /* Backchannel prealloc list */ 107 struct list_head rq_bc_pa_list; /* Backchannel prealloc list */
107#endif /* CONFIG_NFS_V4_1 */ 108#endif /* CONFIG_SUNRPC_BACKCHANEL */
108}; 109};
109#define rq_svec rq_snd_buf.head 110#define rq_svec rq_snd_buf.head
110#define rq_slen rq_snd_buf.len 111#define rq_slen rq_snd_buf.len
111 112
112struct rpc_xprt_ops { 113struct rpc_xprt_ops {
113 void (*set_buffer_size)(struct rpc_xprt *xprt, size_t sndsize, size_t rcvsize); 114 void (*set_buffer_size)(struct rpc_xprt *xprt, size_t sndsize, size_t rcvsize);
114 int (*reserve_xprt)(struct rpc_task *task); 115 int (*reserve_xprt)(struct rpc_xprt *xprt, struct rpc_task *task);
115 void (*release_xprt)(struct rpc_xprt *xprt, struct rpc_task *task); 116 void (*release_xprt)(struct rpc_xprt *xprt, struct rpc_task *task);
116 void (*rpcbind)(struct rpc_task *task); 117 void (*rpcbind)(struct rpc_task *task);
117 void (*set_port)(struct rpc_xprt *xprt, unsigned short port); 118 void (*set_port)(struct rpc_xprt *xprt, unsigned short port);
@@ -164,12 +165,12 @@ struct rpc_xprt {
164 165
165 struct rpc_wait_queue binding; /* requests waiting on rpcbind */ 166 struct rpc_wait_queue binding; /* requests waiting on rpcbind */
166 struct rpc_wait_queue sending; /* requests waiting to send */ 167 struct rpc_wait_queue sending; /* requests waiting to send */
167 struct rpc_wait_queue resend; /* requests waiting to resend */
168 struct rpc_wait_queue pending; /* requests in flight */ 168 struct rpc_wait_queue pending; /* requests in flight */
169 struct rpc_wait_queue backlog; /* waiting for slot */ 169 struct rpc_wait_queue backlog; /* waiting for slot */
170 struct list_head free; /* free slots */ 170 struct list_head free; /* free slots */
171 struct rpc_rqst * slot; /* slot table storage */ 171 unsigned int max_reqs; /* max number of slots */
172 unsigned int max_reqs; /* total slots */ 172 unsigned int min_reqs; /* min number of slots */
173 atomic_t num_reqs; /* total slots */
173 unsigned long state; /* transport state */ 174 unsigned long state; /* transport state */
174 unsigned char shutdown : 1, /* being shut down */ 175 unsigned char shutdown : 1, /* being shut down */
175 resvport : 1; /* use a reserved port */ 176 resvport : 1; /* use a reserved port */
@@ -200,7 +201,7 @@ struct rpc_xprt {
200 u32 xid; /* Next XID value to use */ 201 u32 xid; /* Next XID value to use */
201 struct rpc_task * snd_task; /* Task blocked in send */ 202 struct rpc_task * snd_task; /* Task blocked in send */
202 struct svc_xprt *bc_xprt; /* NFSv4.1 backchannel */ 203 struct svc_xprt *bc_xprt; /* NFSv4.1 backchannel */
203#if defined(CONFIG_NFS_V4_1) 204#if defined(CONFIG_SUNRPC_BACKCHANNEL)
204 struct svc_serv *bc_serv; /* The RPC service which will */ 205 struct svc_serv *bc_serv; /* The RPC service which will */
205 /* process the callback */ 206 /* process the callback */
206 unsigned int bc_alloc_count; /* Total number of preallocs */ 207 unsigned int bc_alloc_count; /* Total number of preallocs */
@@ -208,7 +209,7 @@ struct rpc_xprt {
208 * items */ 209 * items */
209 struct list_head bc_pa_list; /* List of preallocated 210 struct list_head bc_pa_list; /* List of preallocated
210 * backchannel rpc_rqst's */ 211 * backchannel rpc_rqst's */
211#endif /* CONFIG_NFS_V4_1 */ 212#endif /* CONFIG_SUNRPC_BACKCHANNEL */
212 struct list_head recv; 213 struct list_head recv;
213 214
214 struct { 215 struct {
@@ -228,15 +229,15 @@ struct rpc_xprt {
228 const char *address_strings[RPC_DISPLAY_MAX]; 229 const char *address_strings[RPC_DISPLAY_MAX];
229}; 230};
230 231
231#if defined(CONFIG_NFS_V4_1) 232#if defined(CONFIG_SUNRPC_BACKCHANNEL)
232/* 233/*
233 * Backchannel flags 234 * Backchannel flags
234 */ 235 */
235#define RPC_BC_PA_IN_USE 0x0001 /* Preallocated backchannel */ 236#define RPC_BC_PA_IN_USE 0x0001 /* Preallocated backchannel */
236 /* buffer in use */ 237 /* buffer in use */
237#endif /* CONFIG_NFS_V4_1 */ 238#endif /* CONFIG_SUNRPC_BACKCHANNEL */
238 239
239#if defined(CONFIG_NFS_V4_1) 240#if defined(CONFIG_SUNRPC_BACKCHANNEL)
240static inline int bc_prealloc(struct rpc_rqst *req) 241static inline int bc_prealloc(struct rpc_rqst *req)
241{ 242{
242 return test_bit(RPC_BC_PA_IN_USE, &req->rq_bc_pa_state); 243 return test_bit(RPC_BC_PA_IN_USE, &req->rq_bc_pa_state);
@@ -246,7 +247,7 @@ static inline int bc_prealloc(struct rpc_rqst *req)
246{ 247{
247 return 0; 248 return 0;
248} 249}
249#endif /* CONFIG_NFS_V4_1 */ 250#endif /* CONFIG_SUNRPC_BACKCHANNEL */
250 251
251struct xprt_create { 252struct xprt_create {
252 int ident; /* XPRT_TRANSPORT identifier */ 253 int ident; /* XPRT_TRANSPORT identifier */
@@ -271,8 +272,8 @@ struct xprt_class {
271struct rpc_xprt *xprt_create_transport(struct xprt_create *args); 272struct rpc_xprt *xprt_create_transport(struct xprt_create *args);
272void xprt_connect(struct rpc_task *task); 273void xprt_connect(struct rpc_task *task);
273void xprt_reserve(struct rpc_task *task); 274void xprt_reserve(struct rpc_task *task);
274int xprt_reserve_xprt(struct rpc_task *task); 275int xprt_reserve_xprt(struct rpc_xprt *xprt, struct rpc_task *task);
275int xprt_reserve_xprt_cong(struct rpc_task *task); 276int xprt_reserve_xprt_cong(struct rpc_xprt *xprt, struct rpc_task *task);
276int xprt_prepare_transmit(struct rpc_task *task); 277int xprt_prepare_transmit(struct rpc_task *task);
277void xprt_transmit(struct rpc_task *task); 278void xprt_transmit(struct rpc_task *task);
278void xprt_end_transmit(struct rpc_task *task); 279void xprt_end_transmit(struct rpc_task *task);
@@ -282,7 +283,9 @@ void xprt_release_xprt_cong(struct rpc_xprt *xprt, struct rpc_task *task);
282void xprt_release(struct rpc_task *task); 283void xprt_release(struct rpc_task *task);
283struct rpc_xprt * xprt_get(struct rpc_xprt *xprt); 284struct rpc_xprt * xprt_get(struct rpc_xprt *xprt);
284void xprt_put(struct rpc_xprt *xprt); 285void xprt_put(struct rpc_xprt *xprt);
285struct rpc_xprt * xprt_alloc(struct net *net, int size, int max_req); 286struct rpc_xprt * xprt_alloc(struct net *net, size_t size,
287 unsigned int num_prealloc,
288 unsigned int max_req);
286void xprt_free(struct rpc_xprt *); 289void xprt_free(struct rpc_xprt *);
287 290
288static inline __be32 *xprt_skip_transport_header(struct rpc_xprt *xprt, __be32 *p) 291static inline __be32 *xprt_skip_transport_header(struct rpc_xprt *xprt, __be32 *p)
@@ -321,7 +324,6 @@ void xprt_conditional_disconnect(struct rpc_xprt *xprt, unsigned int cookie);
321#define XPRT_CLOSING (6) 324#define XPRT_CLOSING (6)
322#define XPRT_CONNECTION_ABORT (7) 325#define XPRT_CONNECTION_ABORT (7)
323#define XPRT_CONNECTION_CLOSE (8) 326#define XPRT_CONNECTION_CLOSE (8)
324#define XPRT_INITIALIZED (9)
325 327
326static inline void xprt_set_connected(struct rpc_xprt *xprt) 328static inline void xprt_set_connected(struct rpc_xprt *xprt)
327{ 329{
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index 083ffea7ba1..6bbcef22e10 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -92,6 +92,13 @@ typedef int __bitwise suspend_state_t;
92 * @enter() and @wake(), even if any of them fails. It is executed after 92 * @enter() and @wake(), even if any of them fails. It is executed after
93 * a failing @prepare. 93 * a failing @prepare.
94 * 94 *
95 * @suspend_again: Returns whether the system should suspend again (true) or
96 * not (false). If the platform wants to poll sensors or execute some
97 * code during suspended without invoking userspace and most of devices,
98 * suspend_again callback is the place assuming that periodic-wakeup or
99 * alarm-wakeup is already setup. This allows to execute some codes while
100 * being kept suspended in the view of userland and devices.
101 *
95 * @end: Called by the PM core right after resuming devices, to indicate to 102 * @end: Called by the PM core right after resuming devices, to indicate to
96 * the platform that the system has returned to the working state or 103 * the platform that the system has returned to the working state or
97 * the transition to the sleep state has been aborted. 104 * the transition to the sleep state has been aborted.
@@ -113,6 +120,7 @@ struct platform_suspend_ops {
113 int (*enter)(suspend_state_t state); 120 int (*enter)(suspend_state_t state);
114 void (*wake)(void); 121 void (*wake)(void);
115 void (*finish)(void); 122 void (*finish)(void);
123 bool (*suspend_again)(void);
116 void (*end)(void); 124 void (*end)(void);
117 void (*recover)(void); 125 void (*recover)(void);
118}; 126};
@@ -260,6 +268,14 @@ static inline int hibernate(void) { return -ENOSYS; }
260static inline bool system_entering_hibernation(void) { return false; } 268static inline bool system_entering_hibernation(void) { return false; }
261#endif /* CONFIG_HIBERNATION */ 269#endif /* CONFIG_HIBERNATION */
262 270
271/* Hibernation and suspend events */
272#define PM_HIBERNATION_PREPARE 0x0001 /* Going to hibernate */
273#define PM_POST_HIBERNATION 0x0002 /* Hibernation finished */
274#define PM_SUSPEND_PREPARE 0x0003 /* Going to suspend the system */
275#define PM_POST_SUSPEND 0x0004 /* Suspend finished */
276#define PM_RESTORE_PREPARE 0x0005 /* Going to restore a saved image */
277#define PM_POST_RESTORE 0x0006 /* Restore failed */
278
263#ifdef CONFIG_PM_SLEEP 279#ifdef CONFIG_PM_SLEEP
264void save_processor_state(void); 280void save_processor_state(void);
265void restore_processor_state(void); 281void restore_processor_state(void);
diff --git a/include/linux/swap.h b/include/linux/swap.h
index a273468f828..c71f84bb62e 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -9,7 +9,7 @@
9#include <linux/sched.h> 9#include <linux/sched.h>
10#include <linux/node.h> 10#include <linux/node.h>
11 11
12#include <asm/atomic.h> 12#include <linux/atomic.h>
13#include <asm/page.h> 13#include <asm/page.h>
14 14
15struct notifier_block; 15struct notifier_block;
@@ -251,15 +251,13 @@ static inline void lru_cache_add_file(struct page *page)
251/* linux/mm/vmscan.c */ 251/* linux/mm/vmscan.c */
252extern unsigned long try_to_free_pages(struct zonelist *zonelist, int order, 252extern unsigned long try_to_free_pages(struct zonelist *zonelist, int order,
253 gfp_t gfp_mask, nodemask_t *mask); 253 gfp_t gfp_mask, nodemask_t *mask);
254extern int __isolate_lru_page(struct page *page, int mode, int file);
254extern unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem, 255extern unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem,
255 gfp_t gfp_mask, bool noswap, 256 gfp_t gfp_mask, bool noswap);
256 unsigned int swappiness);
257extern unsigned long mem_cgroup_shrink_node_zone(struct mem_cgroup *mem, 257extern unsigned long mem_cgroup_shrink_node_zone(struct mem_cgroup *mem,
258 gfp_t gfp_mask, bool noswap, 258 gfp_t gfp_mask, bool noswap,
259 unsigned int swappiness,
260 struct zone *zone, 259 struct zone *zone,
261 unsigned long *nr_scanned); 260 unsigned long *nr_scanned);
262extern int __isolate_lru_page(struct page *page, int mode, int file);
263extern unsigned long shrink_all_memory(unsigned long nr_pages); 261extern unsigned long shrink_all_memory(unsigned long nr_pages);
264extern int vm_swappiness; 262extern int vm_swappiness;
265extern int remove_mapping(struct address_space *mapping, struct page *page); 263extern int remove_mapping(struct address_space *mapping, struct page *page);
@@ -299,7 +297,14 @@ static inline void scan_unevictable_unregister_node(struct node *node)
299 297
300extern int kswapd_run(int nid); 298extern int kswapd_run(int nid);
301extern void kswapd_stop(int nid); 299extern void kswapd_stop(int nid);
302 300#ifdef CONFIG_CGROUP_MEM_RES_CTLR
301extern int mem_cgroup_swappiness(struct mem_cgroup *mem);
302#else
303static inline int mem_cgroup_swappiness(struct mem_cgroup *mem)
304{
305 return vm_swappiness;
306}
307#endif
303#ifdef CONFIG_SWAP 308#ifdef CONFIG_SWAP
304/* linux/mm/page_io.c */ 309/* linux/mm/page_io.c */
305extern int swap_readpage(struct page *); 310extern int swap_readpage(struct page *);
diff --git a/include/linux/swapops.h b/include/linux/swapops.h
index cd42e30b7c6..2189d3ffc85 100644
--- a/include/linux/swapops.h
+++ b/include/linux/swapops.h
@@ -1,3 +1,8 @@
1#ifndef _LINUX_SWAPOPS_H
2#define _LINUX_SWAPOPS_H
3
4#include <linux/radix-tree.h>
5
1/* 6/*
2 * swapcache pages are stored in the swapper_space radix tree. We want to 7 * swapcache pages are stored in the swapper_space radix tree. We want to
3 * get good packing density in that tree, so the index should be dense in 8 * get good packing density in that tree, so the index should be dense in
@@ -76,6 +81,22 @@ static inline pte_t swp_entry_to_pte(swp_entry_t entry)
76 return __swp_entry_to_pte(arch_entry); 81 return __swp_entry_to_pte(arch_entry);
77} 82}
78 83
84static inline swp_entry_t radix_to_swp_entry(void *arg)
85{
86 swp_entry_t entry;
87
88 entry.val = (unsigned long)arg >> RADIX_TREE_EXCEPTIONAL_SHIFT;
89 return entry;
90}
91
92static inline void *swp_to_radix_entry(swp_entry_t entry)
93{
94 unsigned long value;
95
96 value = entry.val << RADIX_TREE_EXCEPTIONAL_SHIFT;
97 return (void *)(value | RADIX_TREE_EXCEPTIONAL_ENTRY);
98}
99
79#ifdef CONFIG_MIGRATION 100#ifdef CONFIG_MIGRATION
80static inline swp_entry_t make_migration_entry(struct page *page, int write) 101static inline swp_entry_t make_migration_entry(struct page *page, int write)
81{ 102{
@@ -169,3 +190,5 @@ static inline int non_swap_entry(swp_entry_t entry)
169 return 0; 190 return 0;
170} 191}
171#endif 192#endif
193
194#endif /* _LINUX_SWAPOPS_H */
diff --git a/include/linux/switch.h b/include/linux/switch.h
new file mode 100644
index 00000000000..3e4c748e343
--- /dev/null
+++ b/include/linux/switch.h
@@ -0,0 +1,53 @@
1/*
2 * Switch class driver
3 *
4 * Copyright (C) 2008 Google, Inc.
5 * Author: Mike Lockwood <lockwood@android.com>
6 *
7 * This software is licensed under the terms of the GNU General Public
8 * License version 2, as published by the Free Software Foundation, and
9 * may be copied, distributed, and modified under those terms.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16*/
17
18#ifndef __LINUX_SWITCH_H__
19#define __LINUX_SWITCH_H__
20
21struct switch_dev {
22 const char *name;
23 struct device *dev;
24 int index;
25 int state;
26
27 ssize_t (*print_name)(struct switch_dev *sdev, char *buf);
28 ssize_t (*print_state)(struct switch_dev *sdev, char *buf);
29};
30
31struct gpio_switch_platform_data {
32 const char *name;
33 unsigned gpio;
34
35 /* if NULL, switch_dev.name will be printed */
36 const char *name_on;
37 const char *name_off;
38 /* if NULL, "0" or "1" will be printed */
39 const char *state_on;
40 const char *state_off;
41};
42
43extern int switch_dev_register(struct switch_dev *sdev);
44extern void switch_dev_unregister(struct switch_dev *sdev);
45
46static inline int switch_get_state(struct switch_dev *sdev)
47{
48 return sdev->state;
49}
50
51extern void switch_set_state(struct switch_dev *sdev, int state);
52
53#endif /* __LINUX_SWITCH_H__ */
diff --git a/include/linux/synaptics_i2c_rmi.h b/include/linux/synaptics_i2c_rmi.h
new file mode 100644
index 00000000000..5539cc52077
--- /dev/null
+++ b/include/linux/synaptics_i2c_rmi.h
@@ -0,0 +1,55 @@
1/*
2 * include/linux/synaptics_i2c_rmi.h - platform data structure for f75375s sensor
3 *
4 * Copyright (C) 2008 Google, Inc.
5 *
6 * This software is licensed under the terms of the GNU General Public
7 * License version 2, as published by the Free Software Foundation, and
8 * may be copied, distributed, and modified under those terms.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 */
16
17#ifndef _LINUX_SYNAPTICS_I2C_RMI_H
18#define _LINUX_SYNAPTICS_I2C_RMI_H
19
20#define SYNAPTICS_I2C_RMI_NAME "synaptics-rmi-ts"
21
22enum {
23 SYNAPTICS_FLIP_X = 1UL << 0,
24 SYNAPTICS_FLIP_Y = 1UL << 1,
25 SYNAPTICS_SWAP_XY = 1UL << 2,
26 SYNAPTICS_SNAP_TO_INACTIVE_EDGE = 1UL << 3,
27};
28
29struct synaptics_i2c_rmi_platform_data {
30 uint32_t version; /* Use this entry for panels with */
31 /* (major << 8 | minor) version or above. */
32 /* If non-zero another array entry follows */
33 int (*power)(int on); /* Only valid in first array entry */
34 uint32_t flags;
35 unsigned long irqflags;
36 uint32_t inactive_left; /* 0x10000 = screen width */
37 uint32_t inactive_right; /* 0x10000 = screen width */
38 uint32_t inactive_top; /* 0x10000 = screen height */
39 uint32_t inactive_bottom; /* 0x10000 = screen height */
40 uint32_t snap_left_on; /* 0x10000 = screen width */
41 uint32_t snap_left_off; /* 0x10000 = screen width */
42 uint32_t snap_right_on; /* 0x10000 = screen width */
43 uint32_t snap_right_off; /* 0x10000 = screen width */
44 uint32_t snap_top_on; /* 0x10000 = screen height */
45 uint32_t snap_top_off; /* 0x10000 = screen height */
46 uint32_t snap_bottom_on; /* 0x10000 = screen height */
47 uint32_t snap_bottom_off; /* 0x10000 = screen height */
48 uint32_t fuzz_x; /* 0x10000 = screen width */
49 uint32_t fuzz_y; /* 0x10000 = screen height */
50 int fuzz_p;
51 int fuzz_w;
52 int8_t sensitivity_adjust;
53};
54
55#endif /* _LINUX_SYNAPTICS_I2C_RMI_H */
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 8c03b98df5f..1ff0ec2a5e8 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -702,9 +702,6 @@ asmlinkage long sys_sysctl(struct __sysctl_args __user *args);
702asmlinkage long sys_sysinfo(struct sysinfo __user *info); 702asmlinkage long sys_sysinfo(struct sysinfo __user *info);
703asmlinkage long sys_sysfs(int option, 703asmlinkage long sys_sysfs(int option,
704 unsigned long arg1, unsigned long arg2); 704 unsigned long arg1, unsigned long arg2);
705asmlinkage long sys_nfsservctl(int cmd,
706 struct nfsctl_arg __user *arg,
707 void __user *res);
708asmlinkage long sys_syslog(int type, char __user *buf, int len); 705asmlinkage long sys_syslog(int type, char __user *buf, int len);
709asmlinkage long sys_uselib(const char __user *library); 706asmlinkage long sys_uselib(const char __user *library);
710asmlinkage long sys_ni_syscall(void); 707asmlinkage long sys_ni_syscall(void);
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index e2696d76a59..d7d2f215814 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -17,7 +17,7 @@
17#include <linux/list.h> 17#include <linux/list.h>
18#include <linux/lockdep.h> 18#include <linux/lockdep.h>
19#include <linux/kobject_ns.h> 19#include <linux/kobject_ns.h>
20#include <asm/atomic.h> 20#include <linux/atomic.h>
21 21
22struct kobject; 22struct kobject;
23struct module; 23struct module;
diff --git a/include/linux/tc_ematch/tc_em_meta.h b/include/linux/tc_ematch/tc_em_meta.h
index 7138962664f..b11f8ce2d3c 100644
--- a/include/linux/tc_ematch/tc_em_meta.h
+++ b/include/linux/tc_ematch/tc_em_meta.h
@@ -67,7 +67,7 @@ enum {
67 TCF_META_ID_SK_FORWARD_ALLOCS, 67 TCF_META_ID_SK_FORWARD_ALLOCS,
68 TCF_META_ID_SK_SNDBUF, 68 TCF_META_ID_SK_SNDBUF,
69 TCF_META_ID_SK_ALLOCS, 69 TCF_META_ID_SK_ALLOCS,
70 TCF_META_ID_SK_ROUTE_CAPS, 70 __TCF_META_ID_SK_ROUTE_CAPS, /* unimplemented but in ABI already */
71 TCF_META_ID_SK_HASH, 71 TCF_META_ID_SK_HASH,
72 TCF_META_ID_SK_LINGERTIME, 72 TCF_META_ID_SK_LINGERTIME,
73 TCF_META_ID_SK_ACK_BACKLOG, 73 TCF_META_ID_SK_ACK_BACKLOG,
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index e64f4c67d0e..531ede8006d 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -282,6 +282,7 @@ struct tcp_request_sock {
282#endif 282#endif
283 u32 rcv_isn; 283 u32 rcv_isn;
284 u32 snt_isn; 284 u32 snt_isn;
285 u32 snt_synack; /* synack sent time */
285}; 286};
286 287
287static inline struct tcp_request_sock *tcp_rsk(const struct request_sock *req) 288static inline struct tcp_request_sock *tcp_rsk(const struct request_sock *req)
diff --git a/include/linux/tegra_audio.h b/include/linux/tegra_audio.h
new file mode 100644
index 00000000000..6416cd01861
--- /dev/null
+++ b/include/linux/tegra_audio.h
@@ -0,0 +1,80 @@
1/* include/linux/tegra_audio.h
2 *
3 * Copyright (C) 2010 Google, Inc.
4 *
5 * Author:
6 * Iliyan Malchev <malchev@google.com>
7 *
8 * This software is licensed under the terms of the GNU General Public
9 * License version 2, as published by the Free Software Foundation, and
10 * may be copied, distributed, and modified under those terms.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 */
18
19#ifndef _TEGRA_AUDIO_H
20#define _TEGRA_AUDIO_H
21
22#include <linux/ioctl.h>
23
24#define TEGRA_AUDIO_MAGIC 't'
25
26#define TEGRA_AUDIO_IN_START _IO(TEGRA_AUDIO_MAGIC, 0)
27#define TEGRA_AUDIO_IN_STOP _IO(TEGRA_AUDIO_MAGIC, 1)
28
29struct tegra_audio_in_config {
30 int rate;
31 int stereo;
32};
33
34struct dam_srate {
35 unsigned int in_sample_rate;
36 unsigned int out_sample_rate;
37 unsigned int audio_bits;
38 unsigned int client_bits;
39 unsigned int audio_channels;
40 unsigned int client_channels;
41 unsigned int apbif_chan;
42};
43
44#define TEGRA_AUDIO_IN_SET_CONFIG _IOW(TEGRA_AUDIO_MAGIC, 2, \
45 const struct tegra_audio_in_config *)
46#define TEGRA_AUDIO_IN_GET_CONFIG _IOR(TEGRA_AUDIO_MAGIC, 3, \
47 struct tegra_audio_in_config *)
48
49#define TEGRA_AUDIO_IN_SET_NUM_BUFS _IOW(TEGRA_AUDIO_MAGIC, 4, \
50 const unsigned int *)
51#define TEGRA_AUDIO_IN_GET_NUM_BUFS _IOW(TEGRA_AUDIO_MAGIC, 5, \
52 unsigned int *)
53#define TEGRA_AUDIO_OUT_SET_NUM_BUFS _IOW(TEGRA_AUDIO_MAGIC, 6, \
54 const unsigned int *)
55#define TEGRA_AUDIO_OUT_GET_NUM_BUFS _IOW(TEGRA_AUDIO_MAGIC, 7, \
56 unsigned int *)
57
58#define TEGRA_AUDIO_OUT_FLUSH _IO(TEGRA_AUDIO_MAGIC, 10)
59
60#define TEGRA_AUDIO_BIT_FORMAT_DEFAULT 0
61#define TEGRA_AUDIO_BIT_FORMAT_DSP 1
62#define TEGRA_AUDIO_SET_BIT_FORMAT _IOW(TEGRA_AUDIO_MAGIC, 11, \
63 const unsigned int *)
64#define TEGRA_AUDIO_GET_BIT_FORMAT _IOR(TEGRA_AUDIO_MAGIC, 12, \
65 unsigned int *)
66
67#define DAM_SRC_START _IOW(TEGRA_AUDIO_MAGIC, 13, struct dam_srate *)
68#define DAM_SRC_STOP _IO(TEGRA_AUDIO_MAGIC, 14)
69#define DAM_MIXING_START _IOW(TEGRA_AUDIO_MAGIC, 15, struct dam_srate *)
70#define DAM_MIXING_STOP _IO(TEGRA_AUDIO_MAGIC, 16)
71#define DAM_SET_MIXING_FLAG _IO(TEGRA_AUDIO_MAGIC, 17)
72
73#define I2S_START _IOW(TEGRA_AUDIO_MAGIC, 15, struct i2s_pcm_format *)
74#define I2S_STOP _IOW(TEGRA_AUDIO_MAGIC, 16, struct i2s_pcm_format *)
75#define I2S_LOOPBACK _IOW(TEGRA_AUDIO_MAGIC, 17, unsigned int *)
76#define I2S_MODE_I2S _IOW(TEGRA_AUDIO_MAGIC, 18, unsigned int *)
77
78extern bool tegra_is_voice_call_active();
79
80#endif/*_CPCAP_AUDIO_H*/
diff --git a/include/linux/tegra_avp.h b/include/linux/tegra_avp.h
new file mode 100644
index 00000000000..9dc92f82136
--- /dev/null
+++ b/include/linux/tegra_avp.h
@@ -0,0 +1,44 @@
1/*
2 * Copyright (C) 2010 Google, Inc.
3 * Author: Dima Zavin <dima@android.com>
4 *
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
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 */
15
16#ifndef __LINUX_TEGRA_AVP_H
17#define __LINUX_TEGRA_AVP_H
18
19#include <linux/ioctl.h>
20#include <linux/types.h>
21
22#define TEGRA_AVP_LIB_MAX_NAME 32
23#define TEGRA_AVP_LIB_MAX_ARGS 220 /* DO NOT CHANGE THIS! */
24
25struct tegra_avp_lib {
26 char name[TEGRA_AVP_LIB_MAX_NAME];
27 void __user *args;
28 size_t args_len;
29 int greedy;
30 unsigned long handle;
31};
32
33struct tegra_avp_platform_data {
34 unsigned long emc_clk_rate;
35};
36#define TEGRA_AVP_IOCTL_MAGIC 'r'
37
38#define TEGRA_AVP_IOCTL_LOAD_LIB _IOWR(TEGRA_AVP_IOCTL_MAGIC, 0x40, struct tegra_avp_lib)
39#define TEGRA_AVP_IOCTL_UNLOAD_LIB _IOW(TEGRA_AVP_IOCTL_MAGIC, 0x41, unsigned long)
40
41#define TEGRA_AVP_IOCTL_MIN_NR _IOC_NR(TEGRA_AVP_IOCTL_LOAD_LIB)
42#define TEGRA_AVP_IOCTL_MAX_NR _IOC_NR(TEGRA_AVP_IOCTL_UNLOAD_LIB)
43
44#endif
diff --git a/include/linux/tegra_caif.h b/include/linux/tegra_caif.h
new file mode 100644
index 00000000000..fed67499def
--- /dev/null
+++ b/include/linux/tegra_caif.h
@@ -0,0 +1,34 @@
1/* include/linux/tegra_caif.h
2 *
3 * Copyright (C) 2011 NVIDIA Corporation
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 */
19
20#ifndef _TEGRA_CAIF_H_
21#define _TEGRA_CAIF_H_
22
23/* The GPIO details needed by the rainbow caif */
24struct tegra_caif_platform_data {
25 int reset;
26 int power;
27 int awr;
28 int cwr;
29 int spi_int;
30 int spi_ss;
31};
32
33#endif /* _TEGRA_CAIF_H_ */
34
diff --git a/include/linux/tegra_ion.h b/include/linux/tegra_ion.h
new file mode 100644
index 00000000000..73e190908b8
--- /dev/null
+++ b/include/linux/tegra_ion.h
@@ -0,0 +1,91 @@
1/*
2 * include/linux/tegra_ion.h
3 *
4 * Copyright (C) 2011, NVIDIA Corporation.
5 *
6 * This software is licensed under the terms of the GNU General Public
7 * License version 2, as published by the Free Software Foundation, and
8 * may be copied, distributed, and modified under those terms.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 */
16
17#include <linux/types.h>
18#include <linux/ion.h>
19
20#if !defined(__KERNEL__)
21#define __user
22#endif
23
24#ifndef _LINUX_TEGRA_ION_H
25#define _LINUX_TEGRA_ION_H
26
27struct tegra_ion_id_data {
28 struct ion_handle *handle;
29 unsigned long id;
30 size_t size;
31};
32
33struct tegra_ion_pin_data {
34 struct ion_handle **handles; /* array of handles to pin/unpin */
35 unsigned long *addr; /* array pf addresses to return */
36 unsigned long count; /* number of entries in handles */
37};
38
39/* Cache operations. */
40enum {
41 TEGRA_ION_CACHE_OP_WB = 0,
42 TEGRA_ION_CACHE_OP_INV,
43 TEGRA_ION_CACHE_OP_WB_INV,
44};
45
46struct tegra_ion_cache_maint_data {
47 unsigned long addr;
48 struct ion_handle *handle;
49 size_t len;
50 unsigned int op;
51};
52
53struct tegra_ion_rw_data {
54 unsigned long addr; /* user pointer*/
55 struct ion_handle *handle;
56 unsigned int offset; /* offset into handle mem */
57 unsigned int elem_size; /* individual atome size */
58 unsigned int mem_stride; /*delta in bytes between atoms in handle mem*/
59 unsigned int user_stride; /* delta in bytes between atoms in user */
60 unsigned int count; /* number of atoms to copy */
61};
62
63struct tegra_ion_get_params_data {
64 struct ion_handle *handle;
65 size_t size;
66 unsigned int align;
67 unsigned int heap;
68 unsigned long addr;
69};
70
71/* Custom Ioctl's. */
72enum {
73 TEGRA_ION_ALLOC_FROM_ID = 0,
74 TEGRA_ION_GET_ID,
75 TEGRA_ION_PIN,
76 TEGRA_ION_UNPIN,
77 TEGRA_ION_CACHE_MAINT,
78 TEGRA_ION_READ,
79 TEGRA_ION_WRITE,
80 TEGRA_ION_GET_PARAM,
81};
82
83/* List of heaps in the system. */
84enum {
85 TEGRA_ION_HEAP_CARVEOUT = 0,
86 TEGRA_ION_HEAP_IRAM,
87 TEGRA_ION_HEAP_VPR,
88 TEGRA_ION_HEAP_IOMMU
89};
90
91#endif /* _LINUX_TEGRA_ION_H */
diff --git a/include/linux/tegra_mediaserver.h b/include/linux/tegra_mediaserver.h
new file mode 100644
index 00000000000..f28473baf63
--- /dev/null
+++ b/include/linux/tegra_mediaserver.h
@@ -0,0 +1,112 @@
1/* include/linux/tegra_mediaserver.h
2 *
3 * Media Server driver for NVIDIA Tegra SoCs
4 *
5 * Copyright (c) 2011, NVIDIA Corporation.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 * more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 */
21
22
23#ifndef _TEGRA_MEDIASERVER_H
24#define _TEGRA_MEDIASERVER_H
25
26#include <linux/ioctl.h>
27
28#define TEGRA_MEDIASERVER_MAGIC 'm'
29#define TEGRA_MEDIASERVER_IOCTL_ALLOC \
30 _IOWR(TEGRA_MEDIASERVER_MAGIC, 0x40, \
31 union tegra_mediaserver_alloc_info)
32
33enum tegra_mediaserver_resource_type {
34 TEGRA_MEDIASERVER_RESOURCE_BLOCK = 0,
35 TEGRA_MEDIASERVER_RESOURCE_IRAM,
36};
37
38enum tegra_mediaserver_block_type {
39 TEGRA_MEDIASERVER_BLOCK_AUDDEC = 0,
40 TEGRA_MEDIASERVER_BLOCK_VIDDEC,
41};
42
43enum tegra_mediaserver_iram_type {
44 TEGRA_MEDIASERVER_IRAM_SCRATCH = 0,
45 TEGRA_MEDIASERVER_IRAM_SHARED,
46};
47
48
49struct tegra_mediaserver_block_info {
50 int nvmm_block_handle;
51 int avp_block_handle;
52 int avp_block_library_handle;
53 int service_handle;
54 int service_library_handle;
55};
56
57struct tegra_mediaserver_iram_info {
58 unsigned long rm_handle;
59 int physical_address;
60};
61
62union tegra_mediaserver_alloc_info {
63 struct {
64 int tegra_mediaserver_resource_type;
65
66 union {
67 struct tegra_mediaserver_block_info block;
68
69 struct {
70 int tegra_mediaserver_iram_type;
71 int alignment;
72 size_t size;
73 } iram;
74 } u;
75 } in;
76
77 struct {
78 union {
79 struct {
80 int count;
81 } block;
82
83 struct tegra_mediaserver_iram_info iram;
84 } u;
85 } out;
86};
87
88
89#define TEGRA_MEDIASERVER_IOCTL_FREE \
90 _IOR(TEGRA_MEDIASERVER_MAGIC, 0x41, union tegra_mediaserver_free_info)
91
92union tegra_mediaserver_free_info {
93 struct {
94 int tegra_mediaserver_resource_type;
95
96 union {
97 int nvmm_block_handle;
98 int iram_rm_handle;
99 } u;
100 } in;
101};
102
103
104#define TEGRA_MEDIASERVER_IOCTL_UPDATE_BLOCK_INFO \
105 _IOR(TEGRA_MEDIASERVER_MAGIC, 0x45, \
106 union tegra_mediaserver_update_block_info)
107
108union tegra_mediaserver_update_block_info {
109 struct tegra_mediaserver_block_info in;
110};
111#endif
112
diff --git a/include/linux/tegra_nvavp.h b/include/linux/tegra_nvavp.h
new file mode 100644
index 00000000000..32dc4c62b4b
--- /dev/null
+++ b/include/linux/tegra_nvavp.h
@@ -0,0 +1,84 @@
1/*
2 * include/linux/tegra_nvavp.h
3 *
4 * Copyright (C) 2011 NVIDIA Corp.
5 *
6 * This file is licensed under the terms of the GNU General Public License
7 * version 2. This program is licensed "as is" without any warranty of any
8 * kind, whether express or implied.
9 */
10
11#ifndef __LINUX_TEGRA_NVAVP_H
12#define __LINUX_TEGRA_NVAVP_H
13
14#include <linux/ioctl.h>
15#include <linux/types.h>
16
17#define NVAVP_MAX_RELOCATION_COUNT 64
18
19/* avp submit flags */
20#define NVAVP_FLAG_NONE 0x00000000
21#define NVAVP_UCODE_EXT 0x00000001 /*use external ucode provided */
22
23enum {
24 NVAVP_MODULE_ID_AVP = 2,
25 NVAVP_MODULE_ID_VCP = 3,
26 NVAVP_MODULE_ID_BSEA = 27,
27 NVAVP_MODULE_ID_VDE = 28,
28 NVAVP_MODULE_ID_MPE = 29,
29 NVAVP_MODULE_ID_EMC = 75,
30};
31
32struct nvavp_cmdbuf {
33 __u32 mem;
34 __u32 offset;
35 __u32 words;
36};
37
38struct nvavp_reloc {
39 __u32 cmdbuf_mem;
40 __u32 cmdbuf_offset;
41 __u32 target;
42 __u32 target_offset;
43};
44
45struct nvavp_syncpt {
46 __u32 id;
47 __u32 value;
48};
49
50struct nvavp_pushbuffer_submit_hdr {
51 struct nvavp_cmdbuf cmdbuf;
52 struct nvavp_reloc *relocs;
53 __u32 num_relocs;
54 struct nvavp_syncpt *syncpt;
55 __u32 flags;
56};
57
58struct nvavp_set_nvmap_fd_args {
59 __u32 fd;
60};
61
62struct nvavp_clock_args {
63 __u32 id;
64 __u32 rate;
65};
66
67#define NVAVP_IOCTL_MAGIC 'n'
68
69#define NVAVP_IOCTL_SET_NVMAP_FD _IOW(NVAVP_IOCTL_MAGIC, 0x60, \
70 struct nvavp_set_nvmap_fd_args)
71#define NVAVP_IOCTL_GET_SYNCPOINT_ID _IOR(NVAVP_IOCTL_MAGIC, 0x61, \
72 __u32)
73#define NVAVP_IOCTL_PUSH_BUFFER_SUBMIT _IOWR(NVAVP_IOCTL_MAGIC, 0x63, \
74 struct nvavp_pushbuffer_submit_hdr)
75#define NVAVP_IOCTL_SET_CLOCK _IOWR(NVAVP_IOCTL_MAGIC, 0x64, \
76 struct nvavp_clock_args)
77#define NVAVP_IOCTL_GET_CLOCK _IOR(NVAVP_IOCTL_MAGIC, 0x65, \
78 struct nvavp_clock_args)
79
80
81#define NVAVP_IOCTL_MIN_NR _IOC_NR(NVAVP_IOCTL_SET_NVMAP_FD)
82#define NVAVP_IOCTL_MAX_NR _IOC_NR(NVAVP_IOCTL_GET_CLOCK)
83
84#endif /* __LINUX_TEGRA_NVAVP_H */
diff --git a/include/linux/tegra_pwm_bl.h b/include/linux/tegra_pwm_bl.h
new file mode 100644
index 00000000000..71a81f2eda8
--- /dev/null
+++ b/include/linux/tegra_pwm_bl.h
@@ -0,0 +1,31 @@
1/* Tegra PWM backlight data *
2 *
3 * Copyright (C) 2011 NVIDIA Corporation
4 * Author: Renuka Apte <rapte@nvidia.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
12#ifndef TEGRA_PWM_BL_H
13#define TEGRA_PWM_BL_H
14
15#include <linux/backlight.h>
16
17struct platform_tegra_pwm_backlight_data {
18 int which_dc;
19 int which_pwm;
20 void (*switch_to_sfio)(int);
21 int gpio_conf_to_sfio;
22 unsigned int dft_brightness;
23 unsigned int max_brightness;
24 unsigned int period;
25 unsigned int clk_div;
26 unsigned int clk_select;
27 int (*notify)(struct device *dev, int brightness);
28 int (*check_fb)(struct device *dev, struct fb_info *info);
29};
30
31#endif /* TERGA_PWM_BL_H */
diff --git a/include/linux/tegra_rpc.h b/include/linux/tegra_rpc.h
new file mode 100644
index 00000000000..16e6367cf56
--- /dev/null
+++ b/include/linux/tegra_rpc.h
@@ -0,0 +1,47 @@
1/*
2 * Copyright (C) 2010 Google, Inc.
3 *
4 * Author:
5 * Dima Zavin <dima@android.com>
6 *
7 * Based on original code from NVIDIA, and a partial rewrite by:
8 * Gary King <gking@nvidia.com>
9 *
10 * This software is licensed under the terms of the GNU General Public
11 * License version 2, as published by the Free Software Foundation, and
12 * may be copied, distributed, and modified under those terms.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 */
20
21#ifndef __LINUX_TEGRA_RPC_H
22#define __LINUX_TEGRA_RPC_H
23
24#define TEGRA_RPC_MAX_MSG_LEN 256
25
26/* Note: the actual size of the name in the protocol message is 16 bytes,
27 * but that is because the name there is not NUL terminated, only NUL
28 * padded. */
29#define TEGRA_RPC_MAX_NAME_LEN 17
30
31struct tegra_rpc_port_desc {
32 char name[TEGRA_RPC_MAX_NAME_LEN];
33 int notify_fd; /* fd representing a trpc_sema to signal when a
34 * message has been received */
35};
36
37#define TEGRA_RPC_IOCTL_MAGIC 'r'
38
39#define TEGRA_RPC_IOCTL_PORT_CREATE _IOW(TEGRA_RPC_IOCTL_MAGIC, 0x20, struct tegra_rpc_port_desc)
40#define TEGRA_RPC_IOCTL_PORT_GET_NAME _IOR(TEGRA_RPC_IOCTL_MAGIC, 0x21, char *)
41#define TEGRA_RPC_IOCTL_PORT_CONNECT _IOR(TEGRA_RPC_IOCTL_MAGIC, 0x22, long)
42#define TEGRA_RPC_IOCTL_PORT_LISTEN _IOR(TEGRA_RPC_IOCTL_MAGIC, 0x23, long)
43
44#define TEGRA_RPC_IOCTL_MIN_NR _IOC_NR(TEGRA_RPC_IOCTL_PORT_CREATE)
45#define TEGRA_RPC_IOCTL_MAX_NR _IOC_NR(TEGRA_RPC_IOCTL_PORT_LISTEN)
46
47#endif
diff --git a/include/linux/tegra_sema.h b/include/linux/tegra_sema.h
new file mode 100644
index 00000000000..7b423b6cb5c
--- /dev/null
+++ b/include/linux/tegra_sema.h
@@ -0,0 +1,34 @@
1/*
2 * Copyright (C) 2010 Google, Inc.
3 *
4 * Author:
5 * Dima Zavin <dima@android.com>
6 *
7 * This software is licensed under the terms of the GNU General Public
8 * License version 2, as published by the Free Software Foundation, and
9 * may be copied, distributed, and modified under those terms.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 */
17
18#ifndef __LINUX_TEGRA_SEMA_H
19#define __LINUX_TEGRA_SEMA_H
20
21/* this shares the magic with the tegra RPC and AVP drivers.
22 * See include/linux/tegra_avp.h and include/linux/tegra_rpc.h */
23#define TEGRA_SEMA_IOCTL_MAGIC 'r'
24
25/* If IOCTL_WAIT is interrupted by a signal and the timeout was not -1,
26 * then the value pointed to by the argument will be updated with the amount
27 * of time remaining for the wait. */
28#define TEGRA_SEMA_IOCTL_WAIT _IOW(TEGRA_SEMA_IOCTL_MAGIC, 0x30, long *)
29#define TEGRA_SEMA_IOCTL_SIGNAL _IO(TEGRA_SEMA_IOCTL_MAGIC, 0x31)
30
31#define TEGRA_SEMA_IOCTL_MIN_NR _IOC_NR(TEGRA_SEMA_IOCTL_WAIT)
32#define TEGRA_SEMA_IOCTL_MAX_NR _IOC_NR(TEGRA_SEMA_IOCTL_SIGNAL)
33
34#endif
diff --git a/include/linux/tegra_spdif.h b/include/linux/tegra_spdif.h
new file mode 100644
index 00000000000..8d7f6457a0d
--- /dev/null
+++ b/include/linux/tegra_spdif.h
@@ -0,0 +1,56 @@
1/* include/linux/tegra_spdif.h
2 *
3 * SPDIF audio driver for NVIDIA Tegra SoCs
4 *
5 * Copyright (c) 2008-2009, NVIDIA Corporation.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 * more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 */
21
22#ifndef _TEGRA_SPDIF_H
23#define _TEGRA_SPDIF_H
24
25#include <linux/ioctl.h>
26
27#define TEGRA_SPDIF_MAGIC 's'
28
29
30
31struct tegra_audio_buf_config {
32 unsigned size; /* order */
33 unsigned threshold; /* order */
34 unsigned chunk; /* order */
35};
36
37
38
39#define TEGRA_AUDIO_OUT_SET_BUF_CONFIG _IOW(TEGRA_SPDIF_MAGIC, 0, \
40 const struct tegra_audio_buf_config *)
41#define TEGRA_AUDIO_OUT_GET_BUF_CONFIG _IOR(TEGRA_SPDIF_MAGIC, 1, \
42 struct tegra_audio_buf_config *)
43
44#define TEGRA_AUDIO_OUT_GET_ERROR_COUNT _IOR(TEGRA_SPDIF_MAGIC, 2, \
45 unsigned *)
46
47struct tegra_audio_out_preload {
48 void *data;
49 size_t len;
50 size_t len_written;
51};
52
53#define TEGRA_AUDIO_OUT_PRELOAD_FIFO _IOWR(TEGRA_SPDIF_MAGIC, 3, \
54 struct tegra_audio_out_preload *)
55
56#endif/*_TEGRA_SPDIF_H*/
diff --git a/include/linux/tegra_uart.h b/include/linux/tegra_uart.h
new file mode 100644
index 00000000000..38912ea9706
--- /dev/null
+++ b/include/linux/tegra_uart.h
@@ -0,0 +1,44 @@
1/* include/linux/tegra_uart.h
2 *
3 * Copyright (C) 2011 NVIDIA Corporation
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 */
19
20#ifndef _TEGRA_UART_H_
21#define _TEGRA_UART_H_
22
23#include <linux/clk.h>
24
25struct uart_clk_parent {
26 const char *name;
27 struct clk *parent_clk;
28 unsigned long fixed_clk_rate;
29};
30
31struct tegra_uart_platform_data {
32 void (*wake_peer)(struct uart_port *);
33 struct uart_clk_parent *parent_clk_list;
34 int parent_clk_count;
35 bool is_loopback;
36};
37
38int tegra_uart_is_tx_empty(struct uart_port *);
39void tegra_uart_request_clock_on(struct uart_port *);
40void tegra_uart_set_mctrl(struct uart_port *, unsigned int);
41void tegra_uart_request_clock_off(struct uart_port *uport);
42
43#endif /* _TEGRA_UART_H_ */
44
diff --git a/include/linux/thermal.h b/include/linux/thermal.h
index d3ec89fb412..47b4a27e6e9 100644
--- a/include/linux/thermal.h
+++ b/include/linux/thermal.h
@@ -85,22 +85,6 @@ struct thermal_cooling_device {
85 ((long)t-2732+5)/10 : ((long)t-2732-5)/10) 85 ((long)t-2732+5)/10 : ((long)t-2732-5)/10)
86#define CELSIUS_TO_KELVIN(t) ((t)*10+2732) 86#define CELSIUS_TO_KELVIN(t) ((t)*10+2732)
87 87
88#if defined(CONFIG_THERMAL_HWMON)
89/* thermal zone devices with the same type share one hwmon device */
90struct thermal_hwmon_device {
91 char type[THERMAL_NAME_LENGTH];
92 struct device *device;
93 int count;
94 struct list_head tz_list;
95 struct list_head node;
96};
97
98struct thermal_hwmon_attr {
99 struct device_attribute attr;
100 char name[16];
101};
102#endif
103
104struct thermal_zone_device { 88struct thermal_zone_device {
105 int id; 89 int id;
106 char type[THERMAL_NAME_LENGTH]; 90 char type[THERMAL_NAME_LENGTH];
@@ -120,12 +104,6 @@ struct thermal_zone_device {
120 struct mutex lock; /* protect cooling devices list */ 104 struct mutex lock; /* protect cooling devices list */
121 struct list_head node; 105 struct list_head node;
122 struct delayed_work poll_queue; 106 struct delayed_work poll_queue;
123#if defined(CONFIG_THERMAL_HWMON)
124 struct list_head hwmon_node;
125 struct thermal_hwmon_device *hwmon;
126 struct thermal_hwmon_attr temp_input; /* hwmon sys attr */
127 struct thermal_hwmon_attr temp_crit; /* hwmon sys attr */
128#endif
129}; 107};
130/* Adding event notification support elements */ 108/* Adding event notification support elements */
131#define THERMAL_GENL_FAMILY_NAME "thermal_event" 109#define THERMAL_GENL_FAMILY_NAME "thermal_event"
diff --git a/include/linux/ti_wilink_st.h b/include/linux/ti_wilink_st.h
index b004e557caa..1c68538840f 100644
--- a/include/linux/ti_wilink_st.h
+++ b/include/linux/ti_wilink_st.h
@@ -24,7 +24,9 @@
24 24
25#ifndef TI_WILINK_ST_H 25#ifndef TI_WILINK_ST_H
26#define TI_WILINK_ST_H 26#define TI_WILINK_ST_H
27#include <linux/wakelock.h>
27 28
29#include <linux/serial_core.h>
28/** 30/**
29 * enum proto-type - The protocol on WiLink chips which share a 31 * enum proto-type - The protocol on WiLink chips which share a
30 * common physical interface like UART. 32 * common physical interface like UART.
@@ -156,6 +158,7 @@ struct st_data_s {
156 unsigned long ll_state; 158 unsigned long ll_state;
157 void *kim_data; 159 void *kim_data;
158 struct tty_struct *tty; 160 struct tty_struct *tty;
161 struct wake_lock st_wk_lock;
159}; 162};
160 163
161/* 164/*
@@ -371,6 +374,8 @@ struct hci_command {
371#define LL_WAKE_UP_IND 0x32 374#define LL_WAKE_UP_IND 0x32
372#define LL_WAKE_UP_ACK 0x33 375#define LL_WAKE_UP_ACK 0x33
373 376
377#define HCILL_SLEEP_MODE_OPCODE 0xFD0C
378
374/* initialize and de-init ST LL */ 379/* initialize and de-init ST LL */
375long st_ll_init(struct st_data_s *); 380long st_ll_init(struct st_data_s *);
376long st_ll_deinit(struct st_data_s *); 381long st_ll_deinit(struct st_data_s *);
@@ -386,9 +391,17 @@ void st_ll_disable(struct st_data_s *);
386 * various funcs used by ST core to set/get the various PM states 391 * various funcs used by ST core to set/get the various PM states
387 * of the chip. 392 * of the chip.
388 */ 393 */
394
395#ifdef CONFIG_TI_ST
389unsigned long st_ll_getstate(struct st_data_s *); 396unsigned long st_ll_getstate(struct st_data_s *);
397#else
398static inline unsigned long st_ll_getstate(struct st_data_s *ll){ return 0; }
399#endif
390unsigned long st_ll_sleep_state(struct st_data_s *, unsigned char); 400unsigned long st_ll_sleep_state(struct st_data_s *, unsigned char);
391void st_ll_wakeup(struct st_data_s *); 401void st_ll_wakeup(struct st_data_s *);
402int bluesleep_start(struct uart_port *);
403void bluesleep_stop(void);
404
392 405
393/* 406/*
394 * header information used by st_core.c for FM and GPS 407 * header information used by st_core.c for FM and GPS
@@ -410,7 +423,28 @@ struct gps_event_hdr {
410 u16 plen; 423 u16 plen;
411} __attribute__ ((packed)); 424} __attribute__ ((packed));
412 425
413/* platform data */ 426/**
427 * struct ti_st_plat_data - platform data shared between ST driver and
428 * platform specific board file which adds the ST device.
429 * @nshutdown_gpio: Host's GPIO line to which chip's BT_EN is connected.
430 * @dev_name: The UART/TTY name to which chip is interfaced. (eg: /dev/ttyS1)
431 * @flow_cntrl: Should always be 1, since UART's CTS/RTS is used for PM
432 * purposes.
433 * @baud_rate: The baud rate supported by the Host UART controller, this will
434 * be shared across with the chip via a HCI VS command from User-Space Init
435 * Mgr application.
436 * @suspend:
437 * @resume: legacy PM routines hooked to platform specific board file, so as
438 * to take chip-host interface specific action.
439 * @chip_enable:
440 * @chip_disable: Platform/Interface specific mux mode setting, GPIO
441 * configuring, Host side PM disabling etc.. can be done here.
442 * @chip_asleep:
443 * @chip_awake: Chip specific deep sleep states is communicated to Host
444 * specific board-xx.c to take actions such as cut UART clocks when chip
445 * asleep or run host faster when chip awake etc..
446 *
447 */
414struct ti_st_plat_data { 448struct ti_st_plat_data {
415 long nshutdown_gpio; 449 long nshutdown_gpio;
416 unsigned char dev_name[UART_DEV_NAME_LEN]; /* uart name */ 450 unsigned char dev_name[UART_DEV_NAME_LEN]; /* uart name */
diff --git a/include/linux/tps80031-charger.h b/include/linux/tps80031-charger.h
new file mode 100644
index 00000000000..26c228edc30
--- /dev/null
+++ b/include/linux/tps80031-charger.h
@@ -0,0 +1,62 @@
1/*
2 * include/linux/tps80031-charger.h
3 *
4 * Battery charger driver interface for TI TPS80031 PMIC
5 *
6 * Copyright (C) 2011 NVIDIA Corporation
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, but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 * 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 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 *
22 */
23
24#ifndef __LINUX_TPS80031_CHARGER_H
25#define __LINUX_TPS80031_CHARGER_H
26
27#include <linux/regulator/machine.h>
28
29enum charging_states {
30 charging_state_idle,
31 charging_state_charging_in_progress,
32 charging_state_charging_completed,
33 charging_state_charging_stopped,
34};
35
36/**
37 * Callback type definition which is called when any state changed in the
38 * charging.
39 */
40typedef void (*charging_callback_t)(enum charging_states state, void *args);
41
42struct tps80031_charger_platform_data {
43 int regulator_id;
44 int max_charge_volt_mV;
45 int max_charge_current_mA;
46 int charging_term_current_mA;
47 int refresh_time;
48 int irq_base;
49 int watch_time_sec;
50 struct regulator_consumer_supply *consumer_supplies;
51 int num_consumer_supplies;
52 int (*board_init)(void *board_data);
53 void *board_data;
54};
55
56/**
57 * Register the callback function for the client. This callback gets called
58 * when there is any change in the chanrging states.
59 */
60extern int register_charging_state_callback(charging_callback_t cb, void *args);
61
62#endif /*__LINUX_TPS80031_CHARGER_H */
diff --git a/include/linux/tracedump.h b/include/linux/tracedump.h
new file mode 100644
index 00000000000..9e86946e354
--- /dev/null
+++ b/include/linux/tracedump.h
@@ -0,0 +1,43 @@
1/*
2 * include/linux/tracedump.h
3 *
4 * Copyright (c) 2011, NVIDIA CORPORATION. All rights reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions 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 it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14 *
15 * You should have received a copy of the GNU General Public License along with
16 * this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 */
20
21#ifndef _LINUX_KERNEL_TRACEDUMP_H
22#define _LINUX_KERNEL_TRACEDUMP_H
23
24/* tracedump
25 * This module provides additional mechanisms for retreiving tracing data.
26 * For details on configurations, parameters and usage, see tracedump.txt.
27 */
28
29#define TD_NO_PRINT 0
30#define TD_PRINT_CONSOLE 1
31#define TD_PRINT_USER 2
32
33/* Dump the tracer to console */
34int tracedump_dump(size_t max_out);
35
36/* Dumping functions */
37int tracedump_init(void);
38ssize_t tracedump_all(int print_to);
39ssize_t tracedump_next(size_t max_out, int print_to);
40int tracedump_reset(void);
41int tracedump_deinit(void);
42
43#endif /* _LINUX_KERNEL_TRACEDUMP_H */
diff --git a/include/linux/tracehook.h b/include/linux/tracehook.h
index e95f5236611..a71a2927a6a 100644
--- a/include/linux/tracehook.h
+++ b/include/linux/tracehook.h
@@ -51,27 +51,12 @@
51#include <linux/security.h> 51#include <linux/security.h>
52struct linux_binprm; 52struct linux_binprm;
53 53
54/**
55 * tracehook_expect_breakpoints - guess if task memory might be touched
56 * @task: current task, making a new mapping
57 *
58 * Return nonzero if @task is expected to want breakpoint insertion in
59 * its memory at some point. A zero return is no guarantee it won't
60 * be done, but this is a hint that it's known to be likely.
61 *
62 * May be called with @task->mm->mmap_sem held for writing.
63 */
64static inline int tracehook_expect_breakpoints(struct task_struct *task)
65{
66 return (task_ptrace(task) & PT_PTRACED) != 0;
67}
68
69/* 54/*
70 * ptrace report for syscall entry and exit looks identical. 55 * ptrace report for syscall entry and exit looks identical.
71 */ 56 */
72static inline void ptrace_report_syscall(struct pt_regs *regs) 57static inline void ptrace_report_syscall(struct pt_regs *regs)
73{ 58{
74 int ptrace = task_ptrace(current); 59 int ptrace = current->ptrace;
75 60
76 if (!(ptrace & PT_PTRACED)) 61 if (!(ptrace & PT_PTRACED))
77 return; 62 return;
@@ -145,229 +130,6 @@ static inline void tracehook_report_syscall_exit(struct pt_regs *regs, int step)
145} 130}
146 131
147/** 132/**
148 * tracehook_unsafe_exec - check for exec declared unsafe due to tracing
149 * @task: current task doing exec
150 *
151 * Return %LSM_UNSAFE_* bits applied to an exec because of tracing.
152 *
153 * @task->signal->cred_guard_mutex is held by the caller through the do_execve().
154 */
155static inline int tracehook_unsafe_exec(struct task_struct *task)
156{
157 int unsafe = 0;
158 int ptrace = task_ptrace(task);
159 if (ptrace & PT_PTRACED) {
160 if (ptrace & PT_PTRACE_CAP)
161 unsafe |= LSM_UNSAFE_PTRACE_CAP;
162 else
163 unsafe |= LSM_UNSAFE_PTRACE;
164 }
165 return unsafe;
166}
167
168/**
169 * tracehook_tracer_task - return the task that is tracing the given task
170 * @tsk: task to consider
171 *
172 * Returns NULL if no one is tracing @task, or the &struct task_struct
173 * pointer to its tracer.
174 *
175 * Must called under rcu_read_lock(). The pointer returned might be kept
176 * live only by RCU. During exec, this may be called with task_lock()
177 * held on @task, still held from when tracehook_unsafe_exec() was called.
178 */
179static inline struct task_struct *tracehook_tracer_task(struct task_struct *tsk)
180{
181 if (task_ptrace(tsk) & PT_PTRACED)
182 return rcu_dereference(tsk->parent);
183 return NULL;
184}
185
186/**
187 * tracehook_report_exec - a successful exec was completed
188 * @fmt: &struct linux_binfmt that performed the exec
189 * @bprm: &struct linux_binprm containing exec details
190 * @regs: user-mode register state
191 *
192 * An exec just completed, we are shortly going to return to user mode.
193 * The freshly initialized register state can be seen and changed in @regs.
194 * The name, file and other pointers in @bprm are still on hand to be
195 * inspected, but will be freed as soon as this returns.
196 *
197 * Called with no locks, but with some kernel resources held live
198 * and a reference on @fmt->module.
199 */
200static inline void tracehook_report_exec(struct linux_binfmt *fmt,
201 struct linux_binprm *bprm,
202 struct pt_regs *regs)
203{
204 if (!ptrace_event(PT_TRACE_EXEC, PTRACE_EVENT_EXEC, 0) &&
205 unlikely(task_ptrace(current) & PT_PTRACED))
206 send_sig(SIGTRAP, current, 0);
207}
208
209/**
210 * tracehook_report_exit - task has begun to exit
211 * @exit_code: pointer to value destined for @current->exit_code
212 *
213 * @exit_code points to the value passed to do_exit(), which tracing
214 * might change here. This is almost the first thing in do_exit(),
215 * before freeing any resources or setting the %PF_EXITING flag.
216 *
217 * Called with no locks held.
218 */
219static inline void tracehook_report_exit(long *exit_code)
220{
221 ptrace_event(PT_TRACE_EXIT, PTRACE_EVENT_EXIT, *exit_code);
222}
223
224/**
225 * tracehook_prepare_clone - prepare for new child to be cloned
226 * @clone_flags: %CLONE_* flags from clone/fork/vfork system call
227 *
228 * This is called before a new user task is to be cloned.
229 * Its return value will be passed to tracehook_finish_clone().
230 *
231 * Called with no locks held.
232 */
233static inline int tracehook_prepare_clone(unsigned clone_flags)
234{
235 if (clone_flags & CLONE_UNTRACED)
236 return 0;
237
238 if (clone_flags & CLONE_VFORK) {
239 if (current->ptrace & PT_TRACE_VFORK)
240 return PTRACE_EVENT_VFORK;
241 } else if ((clone_flags & CSIGNAL) != SIGCHLD) {
242 if (current->ptrace & PT_TRACE_CLONE)
243 return PTRACE_EVENT_CLONE;
244 } else if (current->ptrace & PT_TRACE_FORK)
245 return PTRACE_EVENT_FORK;
246
247 return 0;
248}
249
250/**
251 * tracehook_finish_clone - new child created and being attached
252 * @child: new child task
253 * @clone_flags: %CLONE_* flags from clone/fork/vfork system call
254 * @trace: return value from tracehook_prepare_clone()
255 *
256 * This is called immediately after adding @child to its parent's children list.
257 * The @trace value is that returned by tracehook_prepare_clone().
258 *
259 * Called with current's siglock and write_lock_irq(&tasklist_lock) held.
260 */
261static inline void tracehook_finish_clone(struct task_struct *child,
262 unsigned long clone_flags, int trace)
263{
264 ptrace_init_task(child, (clone_flags & CLONE_PTRACE) || trace);
265}
266
267/**
268 * tracehook_report_clone - in parent, new child is about to start running
269 * @regs: parent's user register state
270 * @clone_flags: flags from parent's system call
271 * @pid: new child's PID in the parent's namespace
272 * @child: new child task
273 *
274 * Called after a child is set up, but before it has been started running.
275 * This is not a good place to block, because the child has not started
276 * yet. Suspend the child here if desired, and then block in
277 * tracehook_report_clone_complete(). This must prevent the child from
278 * self-reaping if tracehook_report_clone_complete() uses the @child
279 * pointer; otherwise it might have died and been released by the time
280 * tracehook_report_clone_complete() is called.
281 *
282 * Called with no locks held, but the child cannot run until this returns.
283 */
284static inline void tracehook_report_clone(struct pt_regs *regs,
285 unsigned long clone_flags,
286 pid_t pid, struct task_struct *child)
287{
288 if (unlikely(task_ptrace(child))) {
289 /*
290 * It doesn't matter who attached/attaching to this
291 * task, the pending SIGSTOP is right in any case.
292 */
293 sigaddset(&child->pending.signal, SIGSTOP);
294 set_tsk_thread_flag(child, TIF_SIGPENDING);
295 }
296}
297
298/**
299 * tracehook_report_clone_complete - new child is running
300 * @trace: return value from tracehook_prepare_clone()
301 * @regs: parent's user register state
302 * @clone_flags: flags from parent's system call
303 * @pid: new child's PID in the parent's namespace
304 * @child: child task, already running
305 *
306 * This is called just after the child has started running. This is
307 * just before the clone/fork syscall returns, or blocks for vfork
308 * child completion if @clone_flags has the %CLONE_VFORK bit set.
309 * The @child pointer may be invalid if a self-reaping child died and
310 * tracehook_report_clone() took no action to prevent it from self-reaping.
311 *
312 * Called with no locks held.
313 */
314static inline void tracehook_report_clone_complete(int trace,
315 struct pt_regs *regs,
316 unsigned long clone_flags,
317 pid_t pid,
318 struct task_struct *child)
319{
320 if (unlikely(trace))
321 ptrace_event(0, trace, pid);
322}
323
324/**
325 * tracehook_report_vfork_done - vfork parent's child has exited or exec'd
326 * @child: child task, already running
327 * @pid: new child's PID in the parent's namespace
328 *
329 * Called after a %CLONE_VFORK parent has waited for the child to complete.
330 * The clone/vfork system call will return immediately after this.
331 * The @child pointer may be invalid if a self-reaping child died and
332 * tracehook_report_clone() took no action to prevent it from self-reaping.
333 *
334 * Called with no locks held.
335 */
336static inline void tracehook_report_vfork_done(struct task_struct *child,
337 pid_t pid)
338{
339 ptrace_event(PT_TRACE_VFORK_DONE, PTRACE_EVENT_VFORK_DONE, pid);
340}
341
342/**
343 * tracehook_prepare_release_task - task is being reaped, clean up tracing
344 * @task: task in %EXIT_DEAD state
345 *
346 * This is called in release_task() just before @task gets finally reaped
347 * and freed. This would be the ideal place to remove and clean up any
348 * tracing-related state for @task.
349 *
350 * Called with no locks held.
351 */
352static inline void tracehook_prepare_release_task(struct task_struct *task)
353{
354}
355
356/**
357 * tracehook_finish_release_task - final tracing clean-up
358 * @task: task in %EXIT_DEAD state
359 *
360 * This is called in release_task() when @task is being in the middle of
361 * being reaped. After this, there must be no tracing entanglements.
362 *
363 * Called with write_lock_irq(&tasklist_lock) held.
364 */
365static inline void tracehook_finish_release_task(struct task_struct *task)
366{
367 ptrace_release_task(task);
368}
369
370/**
371 * tracehook_signal_handler - signal handler setup is complete 133 * tracehook_signal_handler - signal handler setup is complete
372 * @sig: number of signal being delivered 134 * @sig: number of signal being delivered
373 * @info: siginfo_t of signal being delivered 135 * @info: siginfo_t of signal being delivered
@@ -390,151 +152,6 @@ static inline void tracehook_signal_handler(int sig, siginfo_t *info,
390 ptrace_notify(SIGTRAP); 152 ptrace_notify(SIGTRAP);
391} 153}
392 154
393/**
394 * tracehook_consider_ignored_signal - suppress short-circuit of ignored signal
395 * @task: task receiving the signal
396 * @sig: signal number being sent
397 *
398 * Return zero iff tracing doesn't care to examine this ignored signal,
399 * so it can short-circuit normal delivery and never even get queued.
400 *
401 * Called with @task->sighand->siglock held.
402 */
403static inline int tracehook_consider_ignored_signal(struct task_struct *task,
404 int sig)
405{
406 return (task_ptrace(task) & PT_PTRACED) != 0;
407}
408
409/**
410 * tracehook_consider_fatal_signal - suppress special handling of fatal signal
411 * @task: task receiving the signal
412 * @sig: signal number being sent
413 *
414 * Return nonzero to prevent special handling of this termination signal.
415 * Normally handler for signal is %SIG_DFL. It can be %SIG_IGN if @sig is
416 * ignored, in which case force_sig() is about to reset it to %SIG_DFL.
417 * When this returns zero, this signal might cause a quick termination
418 * that does not give the debugger a chance to intercept the signal.
419 *
420 * Called with or without @task->sighand->siglock held.
421 */
422static inline int tracehook_consider_fatal_signal(struct task_struct *task,
423 int sig)
424{
425 return (task_ptrace(task) & PT_PTRACED) != 0;
426}
427
428/**
429 * tracehook_force_sigpending - let tracing force signal_pending(current) on
430 *
431 * Called when recomputing our signal_pending() flag. Return nonzero
432 * to force the signal_pending() flag on, so that tracehook_get_signal()
433 * will be called before the next return to user mode.
434 *
435 * Called with @current->sighand->siglock held.
436 */
437static inline int tracehook_force_sigpending(void)
438{
439 return 0;
440}
441
442/**
443 * tracehook_get_signal - deliver synthetic signal to traced task
444 * @task: @current
445 * @regs: task_pt_regs(@current)
446 * @info: details of synthetic signal
447 * @return_ka: sigaction for synthetic signal
448 *
449 * Return zero to check for a real pending signal normally.
450 * Return -1 after releasing the siglock to repeat the check.
451 * Return a signal number to induce an artificial signal delivery,
452 * setting *@info and *@return_ka to specify its details and behavior.
453 *
454 * The @return_ka->sa_handler value controls the disposition of the
455 * signal, no matter the signal number. For %SIG_DFL, the return value
456 * is a representative signal to indicate the behavior (e.g. %SIGTERM
457 * for death, %SIGQUIT for core dump, %SIGSTOP for job control stop,
458 * %SIGTSTP for stop unless in an orphaned pgrp), but the signal number
459 * reported will be @info->si_signo instead.
460 *
461 * Called with @task->sighand->siglock held, before dequeuing pending signals.
462 */
463static inline int tracehook_get_signal(struct task_struct *task,
464 struct pt_regs *regs,
465 siginfo_t *info,
466 struct k_sigaction *return_ka)
467{
468 return 0;
469}
470
471/**
472 * tracehook_finish_jctl - report about return from job control stop
473 *
474 * This is called by do_signal_stop() after wakeup.
475 */
476static inline void tracehook_finish_jctl(void)
477{
478}
479
480#define DEATH_REAP -1
481#define DEATH_DELAYED_GROUP_LEADER -2
482
483/**
484 * tracehook_notify_death - task is dead, ready to notify parent
485 * @task: @current task now exiting
486 * @death_cookie: value to pass to tracehook_report_death()
487 * @group_dead: nonzero if this was the last thread in the group to die
488 *
489 * A return value >= 0 means call do_notify_parent() with that signal
490 * number. Negative return value can be %DEATH_REAP to self-reap right
491 * now, or %DEATH_DELAYED_GROUP_LEADER to a zombie without notifying our
492 * parent. Note that a return value of 0 means a do_notify_parent() call
493 * that sends no signal, but still wakes up a parent blocked in wait*().
494 *
495 * Called with write_lock_irq(&tasklist_lock) held.
496 */
497static inline int tracehook_notify_death(struct task_struct *task,
498 void **death_cookie, int group_dead)
499{
500 if (task_detached(task))
501 return task->ptrace ? SIGCHLD : DEATH_REAP;
502
503 /*
504 * If something other than our normal parent is ptracing us, then
505 * send it a SIGCHLD instead of honoring exit_signal. exit_signal
506 * only has special meaning to our real parent.
507 */
508 if (thread_group_empty(task) && !ptrace_reparented(task))
509 return task->exit_signal;
510
511 return task->ptrace ? SIGCHLD : DEATH_DELAYED_GROUP_LEADER;
512}
513
514/**
515 * tracehook_report_death - task is dead and ready to be reaped
516 * @task: @current task now exiting
517 * @signal: return value from tracheook_notify_death()
518 * @death_cookie: value passed back from tracehook_notify_death()
519 * @group_dead: nonzero if this was the last thread in the group to die
520 *
521 * Thread has just become a zombie or is about to self-reap. If positive,
522 * @signal is the signal number just sent to the parent (usually %SIGCHLD).
523 * If @signal is %DEATH_REAP, this thread will self-reap. If @signal is
524 * %DEATH_DELAYED_GROUP_LEADER, this is a delayed_group_leader() zombie.
525 * The @death_cookie was passed back by tracehook_notify_death().
526 *
527 * If normal reaping is not inhibited, @task->exit_state might be changing
528 * in parallel.
529 *
530 * Called without locks.
531 */
532static inline void tracehook_report_death(struct task_struct *task,
533 int signal, void *death_cookie,
534 int group_dead)
535{
536}
537
538#ifdef TIF_NOTIFY_RESUME 155#ifdef TIF_NOTIFY_RESUME
539/** 156/**
540 * set_notify_resume - cause tracehook_notify_resume() to be called 157 * set_notify_resume - cause tracehook_notify_resume() to be called
diff --git a/include/linux/tracelevel.h b/include/linux/tracelevel.h
new file mode 100644
index 00000000000..ac3351c6ed8
--- /dev/null
+++ b/include/linux/tracelevel.h
@@ -0,0 +1,42 @@
1/*
2 * include/linux/tracelevel.c
3 *
4 * Copyright (c) 2011, NVIDIA CORPORATION. All rights reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions 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 it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14 *
15 * You should have received a copy of the GNU General Public License along with
16 * this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 */
20
21#ifndef _TRACELEVEL_H
22#define _TRACELEVEL_H
23
24/* tracelevel allows a subsystem author to add priorities to
25 * trace_events. For usage details, see tracelevel.txt.
26 */
27
28#define TRACELEVEL_ERR 3
29#define TRACELEVEL_WARN 2
30#define TRACELEVEL_INFO 1
31#define TRACELEVEL_DEBUG 0
32
33#define TRACELEVEL_MAX TRACELEVEL_ERR
34#define TRACELEVEL_DEFAULT TRACELEVEL_ERR
35
36int __tracelevel_register(char *name, unsigned int level);
37int tracelevel_set_level(int level);
38
39#define tracelevel_register(name, level) \
40 __tracelevel_register(#name, level)
41
42#endif /* _TRACELEVEL_H */
diff --git a/include/linux/tty.h b/include/linux/tty.h
index d6f05292e45..969daca2107 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -5,24 +5,6 @@
5 * 'tty.h' defines some structures used by tty_io.c and some defines. 5 * 'tty.h' defines some structures used by tty_io.c and some defines.
6 */ 6 */
7 7
8#ifdef __KERNEL__
9#include <linux/fs.h>
10#include <linux/major.h>
11#include <linux/termios.h>
12#include <linux/workqueue.h>
13#include <linux/tty_driver.h>
14#include <linux/tty_ldisc.h>
15#include <linux/mutex.h>
16
17#include <asm/system.h>
18
19
20/*
21 * (Note: the *_driver.minor_start values 1, 64, 128, 192 are
22 * hardcoded at present.)
23 */
24#define NR_UNIX98_PTY_DEFAULT 4096 /* Default maximum for Unix98 ptys */
25#define NR_UNIX98_PTY_MAX (1 << MINORBITS) /* Absolute limit */
26#define NR_LDISCS 30 8#define NR_LDISCS 30
27 9
28/* line disciplines */ 10/* line disciplines */
@@ -53,6 +35,25 @@
53#define N_TRACESINK 23 /* Trace data routing for MIPI P1149.7 */ 35#define N_TRACESINK 23 /* Trace data routing for MIPI P1149.7 */
54#define N_TRACEROUTER 24 /* Trace data routing for MIPI P1149.7 */ 36#define N_TRACEROUTER 24 /* Trace data routing for MIPI P1149.7 */
55 37
38#ifdef __KERNEL__
39#include <linux/fs.h>
40#include <linux/major.h>
41#include <linux/termios.h>
42#include <linux/workqueue.h>
43#include <linux/tty_driver.h>
44#include <linux/tty_ldisc.h>
45#include <linux/mutex.h>
46
47#include <asm/system.h>
48
49
50/*
51 * (Note: the *_driver.minor_start values 1, 64, 128, 192 are
52 * hardcoded at present.)
53 */
54#define NR_UNIX98_PTY_DEFAULT 4096 /* Default maximum for Unix98 ptys */
55#define NR_UNIX98_PTY_MAX (1 << MINORBITS) /* Absolute limit */
56
56/* 57/*
57 * This character is the same as _POSIX_VDISABLE: it cannot be used as 58 * This character is the same as _POSIX_VDISABLE: it cannot be used as
58 * a c_cc[] character, but indicates that a particular special character 59 * a c_cc[] character, but indicates that a particular special character
@@ -294,7 +295,7 @@ struct tty_struct {
294 void *driver_data; 295 void *driver_data;
295 struct list_head tty_files; 296 struct list_head tty_files;
296 297
297#define N_TTY_BUF_SIZE 4096 298#define N_TTY_BUF_SIZE 32768
298 299
299 /* 300 /*
300 * The following is data for the N_TTY line discipline. For 301 * The following is data for the N_TTY line discipline. For
@@ -420,6 +421,8 @@ extern void tty_driver_flush_buffer(struct tty_struct *tty);
420extern void tty_throttle(struct tty_struct *tty); 421extern void tty_throttle(struct tty_struct *tty);
421extern void tty_unthrottle(struct tty_struct *tty); 422extern void tty_unthrottle(struct tty_struct *tty);
422extern int tty_do_resize(struct tty_struct *tty, struct winsize *ws); 423extern int tty_do_resize(struct tty_struct *tty, struct winsize *ws);
424extern void tty_driver_remove_tty(struct tty_driver *driver,
425 struct tty_struct *tty);
423extern void tty_shutdown(struct tty_struct *tty); 426extern void tty_shutdown(struct tty_struct *tty);
424extern void tty_free_termios(struct tty_struct *tty); 427extern void tty_free_termios(struct tty_struct *tty);
425extern int is_current_pgrp_orphaned(void); 428extern int is_current_pgrp_orphaned(void);
@@ -470,7 +473,9 @@ extern void proc_clear_tty(struct task_struct *p);
470extern struct tty_struct *get_current_tty(void); 473extern struct tty_struct *get_current_tty(void);
471extern void tty_default_fops(struct file_operations *fops); 474extern void tty_default_fops(struct file_operations *fops);
472extern struct tty_struct *alloc_tty_struct(void); 475extern struct tty_struct *alloc_tty_struct(void);
473extern int tty_add_file(struct tty_struct *tty, struct file *file); 476extern int tty_alloc_file(struct file *file);
477extern void tty_add_file(struct tty_struct *tty, struct file *file);
478extern void tty_free_file(struct file *file);
474extern void free_tty_struct(struct tty_struct *tty); 479extern void free_tty_struct(struct tty_struct *tty);
475extern void initialize_tty_struct(struct tty_struct *tty, 480extern void initialize_tty_struct(struct tty_struct *tty,
476 struct tty_driver *driver, int idx); 481 struct tty_driver *driver, int idx);
diff --git a/include/linux/tty_driver.h b/include/linux/tty_driver.h
index 9deeac85524..ecdaeb98b29 100644
--- a/include/linux/tty_driver.h
+++ b/include/linux/tty_driver.h
@@ -47,6 +47,9 @@
47 * 47 *
48 * This routine is called synchronously when a particular tty device 48 * This routine is called synchronously when a particular tty device
49 * is closed for the last time freeing up the resources. 49 * is closed for the last time freeing up the resources.
50 * Note that tty_shutdown() is not called if ops->shutdown is defined.
51 * This means one is responsible to take care of calling ops->remove (e.g.
52 * via tty_driver_remove_tty) and releasing tty->termios.
50 * 53 *
51 * 54 *
52 * void (*cleanup)(struct tty_struct * tty); 55 * void (*cleanup)(struct tty_struct * tty);
diff --git a/include/linux/uid_stat.h b/include/linux/uid_stat.h
new file mode 100644
index 00000000000..6bd6c4e52d1
--- /dev/null
+++ b/include/linux/uid_stat.h
@@ -0,0 +1,29 @@
1/* include/linux/uid_stat.h
2 *
3 * Copyright (C) 2008-2009 Google, Inc.
4 *
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
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 */
15
16#ifndef __uid_stat_h
17#define __uid_stat_h
18
19/* Contains definitions for resource tracking per uid. */
20
21#ifdef CONFIG_UID_STAT
22int uid_stat_tcp_snd(uid_t uid, int size);
23int uid_stat_tcp_rcv(uid_t uid, int size);
24#else
25#define uid_stat_tcp_snd(uid, size) do {} while (0);
26#define uid_stat_tcp_rcv(uid, size) do {} while (0);
27#endif
28
29#endif /* _LINUX_UID_STAT_H */
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 73c7df48960..b08e04cf202 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -1202,6 +1202,7 @@ struct urb {
1202 void *transfer_buffer; /* (in) associated data buffer */ 1202 void *transfer_buffer; /* (in) associated data buffer */
1203 dma_addr_t transfer_dma; /* (in) dma addr for transfer_buffer */ 1203 dma_addr_t transfer_dma; /* (in) dma addr for transfer_buffer */
1204 struct scatterlist *sg; /* (in) scatter gather buffer list */ 1204 struct scatterlist *sg; /* (in) scatter gather buffer list */
1205 int num_mapped_sgs; /* (internal) mapped sg entries */
1205 int num_sgs; /* (in) number of entries in the sg list */ 1206 int num_sgs; /* (in) number of entries in the sg list */
1206 u32 transfer_buffer_length; /* (in) data buffer length */ 1207 u32 transfer_buffer_length; /* (in) data buffer length */
1207 u32 actual_length; /* (return) actual transfer length */ 1208 u32 actual_length; /* (return) actual transfer length */
diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h
index 0fd3fbdd828..cf65b5cff72 100644
--- a/include/linux/usb/ch9.h
+++ b/include/linux/usb/ch9.h
@@ -583,8 +583,26 @@ struct usb_ss_ep_comp_descriptor {
583} __attribute__ ((packed)); 583} __attribute__ ((packed));
584 584
585#define USB_DT_SS_EP_COMP_SIZE 6 585#define USB_DT_SS_EP_COMP_SIZE 6
586
586/* Bits 4:0 of bmAttributes if this is a bulk endpoint */ 587/* Bits 4:0 of bmAttributes if this is a bulk endpoint */
587#define USB_SS_MAX_STREAMS(p) (1 << ((p) & 0x1f)) 588static inline int
589usb_ss_max_streams(const struct usb_ss_ep_comp_descriptor *comp)
590{
591 int max_streams;
592
593 if (!comp)
594 return 0;
595
596 max_streams = comp->bmAttributes & 0x1f;
597
598 if (!max_streams)
599 return 0;
600
601 max_streams = 1 << max_streams;
602
603 return max_streams;
604}
605
588/* Bits 1:0 of bmAttributes if this is an isoc endpoint */ 606/* Bits 1:0 of bmAttributes if this is an isoc endpoint */
589#define USB_SS_MULT(p) (1 + ((p) & 0x3)) 607#define USB_SS_MULT(p) (1 + ((p) & 0x3))
590 608
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h
index b78cba466d3..6938a8608cf 100644
--- a/include/linux/usb/composite.h
+++ b/include/linux/usb/composite.h
@@ -59,6 +59,10 @@ struct usb_configuration;
59 * @hs_descriptors: Table of high speed descriptors, using interface and 59 * @hs_descriptors: Table of high speed descriptors, using interface and
60 * string identifiers assigned during @bind(). If this pointer is null, 60 * string identifiers assigned during @bind(). If this pointer is null,
61 * the function will not be available at high speed. 61 * the function will not be available at high speed.
62 * @ss_descriptors: Table of super speed descriptors, using interface and
63 * string identifiers assigned during @bind(). If this
64 * pointer is null after initiation, the function will not
65 * be available at super speed.
62 * @config: assigned when @usb_add_function() is called; this is the 66 * @config: assigned when @usb_add_function() is called; this is the
63 * configuration with which this function is associated. 67 * configuration with which this function is associated.
64 * @bind: Before the gadget can register, all of its functions bind() to the 68 * @bind: Before the gadget can register, all of its functions bind() to the
@@ -77,6 +81,10 @@ struct usb_configuration;
77 * @setup: Used for interface-specific control requests. 81 * @setup: Used for interface-specific control requests.
78 * @suspend: Notifies functions when the host stops sending USB traffic. 82 * @suspend: Notifies functions when the host stops sending USB traffic.
79 * @resume: Notifies functions when the host restarts USB traffic. 83 * @resume: Notifies functions when the host restarts USB traffic.
84 * @get_status: Returns function status as a reply to
85 * GetStatus() request when the recepient is Interface.
86 * @func_suspend: callback to be called when
87 * SetFeature(FUNCTION_SUSPEND) is reseived
80 * 88 *
81 * A single USB function uses one or more interfaces, and should in most 89 * A single USB function uses one or more interfaces, and should in most
82 * cases support operation at both full and high speeds. Each function is 90 * cases support operation at both full and high speeds. Each function is
@@ -106,6 +114,7 @@ struct usb_function {
106 struct usb_gadget_strings **strings; 114 struct usb_gadget_strings **strings;
107 struct usb_descriptor_header **descriptors; 115 struct usb_descriptor_header **descriptors;
108 struct usb_descriptor_header **hs_descriptors; 116 struct usb_descriptor_header **hs_descriptors;
117 struct usb_descriptor_header **ss_descriptors;
109 118
110 struct usb_configuration *config; 119 struct usb_configuration *config;
111 120
@@ -132,6 +141,10 @@ struct usb_function {
132 void (*suspend)(struct usb_function *); 141 void (*suspend)(struct usb_function *);
133 void (*resume)(struct usb_function *); 142 void (*resume)(struct usb_function *);
134 143
144 /* USB 3.0 additions */
145 int (*get_status)(struct usb_function *);
146 int (*func_suspend)(struct usb_function *,
147 u8 suspend_opt);
135 /* private: */ 148 /* private: */
136 /* internals */ 149 /* internals */
137 struct list_head list; 150 struct list_head list;
@@ -145,20 +158,8 @@ int usb_function_activate(struct usb_function *);
145 158
146int usb_interface_id(struct usb_configuration *, struct usb_function *); 159int usb_interface_id(struct usb_configuration *, struct usb_function *);
147 160
148/** 161int config_ep_by_speed(struct usb_gadget *g, struct usb_function *f,
149 * ep_choose - select descriptor endpoint at current device speed 162 struct usb_ep *_ep);
150 * @g: gadget, connected and running at some speed
151 * @hs: descriptor to use for high speed operation
152 * @fs: descriptor to use for full or low speed operation
153 */
154static inline struct usb_endpoint_descriptor *
155ep_choose(struct usb_gadget *g, struct usb_endpoint_descriptor *hs,
156 struct usb_endpoint_descriptor *fs)
157{
158 if (gadget_is_dualspeed(g) && g->speed == USB_SPEED_HIGH)
159 return hs;
160 return fs;
161}
162 163
163#define MAX_CONFIG_INTERFACES 16 /* arbitrary; max 255 */ 164#define MAX_CONFIG_INTERFACES 16 /* arbitrary; max 255 */
164 165
@@ -231,6 +232,7 @@ struct usb_configuration {
231 struct list_head list; 232 struct list_head list;
232 struct list_head functions; 233 struct list_head functions;
233 u8 next_interface_id; 234 u8 next_interface_id;
235 unsigned superspeed:1;
234 unsigned highspeed:1; 236 unsigned highspeed:1;
235 unsigned fullspeed:1; 237 unsigned fullspeed:1;
236 struct usb_function *interface[MAX_CONFIG_INTERFACES]; 238 struct usb_function *interface[MAX_CONFIG_INTERFACES];
@@ -240,6 +242,9 @@ int usb_add_config(struct usb_composite_dev *,
240 struct usb_configuration *, 242 struct usb_configuration *,
241 int (*)(struct usb_configuration *)); 243 int (*)(struct usb_configuration *));
242 244
245int usb_remove_config(struct usb_composite_dev *,
246 struct usb_configuration *);
247
243/** 248/**
244 * struct usb_composite_driver - groups configurations into a gadget 249 * struct usb_composite_driver - groups configurations into a gadget
245 * @name: For diagnostics, identifies the driver. 250 * @name: For diagnostics, identifies the driver.
@@ -252,6 +257,7 @@ int usb_add_config(struct usb_composite_dev *,
252 * identifiers. 257 * identifiers.
253 * @strings: tables of strings, keyed by identifiers assigned during bind() 258 * @strings: tables of strings, keyed by identifiers assigned during bind()
254 * and language IDs provided in control requests 259 * and language IDs provided in control requests
260 * @max_speed: Highest speed the driver supports.
255 * @needs_serial: set to 1 if the gadget needs userspace to provide 261 * @needs_serial: set to 1 if the gadget needs userspace to provide
256 * a serial number. If one is not provided, warning will be printed. 262 * a serial number. If one is not provided, warning will be printed.
257 * @unbind: Reverses bind; called as a side effect of unregistering 263 * @unbind: Reverses bind; called as a side effect of unregistering
@@ -279,6 +285,7 @@ struct usb_composite_driver {
279 const char *iManufacturer; 285 const char *iManufacturer;
280 const struct usb_device_descriptor *dev; 286 const struct usb_device_descriptor *dev;
281 struct usb_gadget_strings **strings; 287 struct usb_gadget_strings **strings;
288 enum usb_device_speed max_speed;
282 unsigned needs_serial:1; 289 unsigned needs_serial:1;
283 290
284 int (*unbind)(struct usb_composite_dev *); 291 int (*unbind)(struct usb_composite_dev *);
diff --git a/include/linux/usb/f_accessory.h b/include/linux/usb/f_accessory.h
new file mode 100644
index 00000000000..5b2dcf9728e
--- /dev/null
+++ b/include/linux/usb/f_accessory.h
@@ -0,0 +1,83 @@
1/*
2 * Gadget Function Driver for Android USB accessories
3 *
4 * Copyright (C) 2011 Google, Inc.
5 * Author: Mike Lockwood <lockwood@android.com>
6 *
7 * This software is licensed under the terms of the GNU General Public
8 * License version 2, as published by the Free Software Foundation, and
9 * may be copied, distributed, and modified under those terms.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 */
17
18#ifndef __LINUX_USB_F_ACCESSORY_H
19#define __LINUX_USB_F_ACCESSORY_H
20
21/* Use Google Vendor ID when in accessory mode */
22#define USB_ACCESSORY_VENDOR_ID 0x18D1
23
24
25/* Product ID to use when in accessory mode */
26#define USB_ACCESSORY_PRODUCT_ID 0x2D00
27
28/* Product ID to use when in accessory mode and adb is enabled */
29#define USB_ACCESSORY_ADB_PRODUCT_ID 0x2D01
30
31/* Indexes for strings sent by the host via ACCESSORY_SEND_STRING */
32#define ACCESSORY_STRING_MANUFACTURER 0
33#define ACCESSORY_STRING_MODEL 1
34#define ACCESSORY_STRING_DESCRIPTION 2
35#define ACCESSORY_STRING_VERSION 3
36#define ACCESSORY_STRING_URI 4
37#define ACCESSORY_STRING_SERIAL 5
38
39/* Control request for retrieving device's protocol version (currently 1)
40 *
41 * requestType: USB_DIR_IN | USB_TYPE_VENDOR
42 * request: ACCESSORY_GET_PROTOCOL
43 * value: 0
44 * index: 0
45 * data version number (16 bits little endian)
46 */
47#define ACCESSORY_GET_PROTOCOL 51
48
49/* Control request for host to send a string to the device
50 *
51 * requestType: USB_DIR_OUT | USB_TYPE_VENDOR
52 * request: ACCESSORY_SEND_STRING
53 * value: 0
54 * index: string ID
55 * data zero terminated UTF8 string
56 *
57 * The device can later retrieve these strings via the
58 * ACCESSORY_GET_STRING_* ioctls
59 */
60#define ACCESSORY_SEND_STRING 52
61
62/* Control request for starting device in accessory mode.
63 * The host sends this after setting all its strings to the device.
64 *
65 * requestType: USB_DIR_OUT | USB_TYPE_VENDOR
66 * request: ACCESSORY_START
67 * value: 0
68 * index: 0
69 * data none
70 */
71#define ACCESSORY_START 53
72
73/* ioctls for retrieving strings set by the host */
74#define ACCESSORY_GET_STRING_MANUFACTURER _IOW('M', 1, char[256])
75#define ACCESSORY_GET_STRING_MODEL _IOW('M', 2, char[256])
76#define ACCESSORY_GET_STRING_DESCRIPTION _IOW('M', 3, char[256])
77#define ACCESSORY_GET_STRING_VERSION _IOW('M', 4, char[256])
78#define ACCESSORY_GET_STRING_URI _IOW('M', 5, char[256])
79#define ACCESSORY_GET_STRING_SERIAL _IOW('M', 6, char[256])
80/* returns 1 if there is a start request pending */
81#define ACCESSORY_IS_START_REQUESTED _IO('M', 7)
82
83#endif /* __LINUX_USB_F_ACCESSORY_H */
diff --git a/include/linux/usb/f_mtp.h b/include/linux/usb/f_mtp.h
new file mode 100644
index 00000000000..7422b17c6eb
--- /dev/null
+++ b/include/linux/usb/f_mtp.h
@@ -0,0 +1,75 @@
1/*
2 * Gadget Function Driver for MTP
3 *
4 * Copyright (C) 2010 Google, Inc.
5 * Author: Mike Lockwood <lockwood@android.com>
6 *
7 * This software is licensed under the terms of the GNU General Public
8 * License version 2, as published by the Free Software Foundation, and
9 * may be copied, distributed, and modified under those terms.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 */
17
18#ifndef __LINUX_USB_F_MTP_H
19#define __LINUX_USB_F_MTP_H
20
21#include <linux/ioctl.h>
22
23#ifdef __KERNEL__
24
25struct mtp_data_header {
26 /* length of packet, including this header */
27 uint32_t length;
28 /* container type (2 for data packet) */
29 uint16_t type;
30 /* MTP command code */
31 uint16_t command;
32 /* MTP transaction ID */
33 uint32_t transaction_id;
34};
35
36#endif /* __KERNEL__ */
37
38struct mtp_file_range {
39 /* file descriptor for file to transfer */
40 int fd;
41 /* offset in file for start of transfer */
42 loff_t offset;
43 /* number of bytes to transfer */
44 int64_t length;
45 /* MTP command ID for data header,
46 * used only for MTP_SEND_FILE_WITH_HEADER
47 */
48 uint16_t command;
49 /* MTP transaction ID for data header,
50 * used only for MTP_SEND_FILE_WITH_HEADER
51 */
52 uint32_t transaction_id;
53};
54
55struct mtp_event {
56 /* size of the event */
57 size_t length;
58 /* event data to send */
59 void *data;
60};
61
62/* Sends the specified file range to the host */
63#define MTP_SEND_FILE _IOW('M', 0, struct mtp_file_range)
64/* Receives data from the host and writes it to a file.
65 * The file is created if it does not exist.
66 */
67#define MTP_RECEIVE_FILE _IOW('M', 1, struct mtp_file_range)
68/* Sends an event to the host via the interrupt endpoint */
69#define MTP_SEND_EVENT _IOW('M', 3, struct mtp_event)
70/* Sends the specified file range to the host,
71 * with a 12 byte MTP data packet header at the beginning.
72 */
73#define MTP_SEND_FILE_WITH_HEADER _IOW('M', 4, struct mtp_file_range)
74
75#endif /* __LINUX_USB_F_MTP_H */
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index dd1571db55e..087f4b93183 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -15,7 +15,13 @@
15#ifndef __LINUX_USB_GADGET_H 15#ifndef __LINUX_USB_GADGET_H
16#define __LINUX_USB_GADGET_H 16#define __LINUX_USB_GADGET_H
17 17
18#include <linux/device.h>
19#include <linux/errno.h>
20#include <linux/init.h>
21#include <linux/list.h>
18#include <linux/slab.h> 22#include <linux/slab.h>
23#include <linux/types.h>
24#include <linux/usb/ch9.h>
19 25
20struct usb_ep; 26struct usb_ep;
21 27
@@ -27,6 +33,7 @@ struct usb_ep;
27 * field, and the usb controller needs one, it is responsible 33 * field, and the usb controller needs one, it is responsible
28 * for mapping and unmapping the buffer. 34 * for mapping and unmapping the buffer.
29 * @length: Length of that data 35 * @length: Length of that data
36 * @stream_id: The stream id, when USB3.0 bulk streams are being used
30 * @no_interrupt: If true, hints that no completion irq is needed. 37 * @no_interrupt: If true, hints that no completion irq is needed.
31 * Helpful sometimes with deep request queues that are handled 38 * Helpful sometimes with deep request queues that are handled
32 * directly by DMA controllers. 39 * directly by DMA controllers.
@@ -81,6 +88,7 @@ struct usb_request {
81 unsigned length; 88 unsigned length;
82 dma_addr_t dma; 89 dma_addr_t dma;
83 90
91 unsigned stream_id:16;
84 unsigned no_interrupt:1; 92 unsigned no_interrupt:1;
85 unsigned zero:1; 93 unsigned zero:1;
86 unsigned short_not_ok:1; 94 unsigned short_not_ok:1;
@@ -131,8 +139,17 @@ struct usb_ep_ops {
131 * @maxpacket:The maximum packet size used on this endpoint. The initial 139 * @maxpacket:The maximum packet size used on this endpoint. The initial
132 * value can sometimes be reduced (hardware allowing), according to 140 * value can sometimes be reduced (hardware allowing), according to
133 * the endpoint descriptor used to configure the endpoint. 141 * the endpoint descriptor used to configure the endpoint.
134 * @driver_data:for use by the gadget driver. all other fields are 142 * @max_streams: The maximum number of streams supported
135 * read-only to gadget drivers. 143 * by this EP (0 - 16, actual number is 2^n)
144 * @mult: multiplier, 'mult' value for SS Isoc EPs
145 * @maxburst: the maximum number of bursts supported by this EP (for usb3)
146 * @driver_data:for use by the gadget driver.
147 * @address: used to identify the endpoint when finding descriptor that
148 * matches connection speed
149 * @desc: endpoint descriptor. This pointer is set before the endpoint is
150 * enabled and remains valid until the endpoint is disabled.
151 * @comp_desc: In case of SuperSpeed support, this is the endpoint companion
152 * descriptor that is used to configure the endpoint
136 * 153 *
137 * the bus controller driver lists all the general purpose endpoints in 154 * the bus controller driver lists all the general purpose endpoints in
138 * gadget->ep_list. the control endpoint (gadget->ep0) is not in that list, 155 * gadget->ep_list. the control endpoint (gadget->ep0) is not in that list,
@@ -145,6 +162,12 @@ struct usb_ep {
145 const struct usb_ep_ops *ops; 162 const struct usb_ep_ops *ops;
146 struct list_head ep_list; 163 struct list_head ep_list;
147 unsigned maxpacket:16; 164 unsigned maxpacket:16;
165 unsigned max_streams:16;
166 unsigned mult:2;
167 unsigned maxburst:4;
168 u8 address;
169 const struct usb_endpoint_descriptor *desc;
170 const struct usb_ss_ep_comp_descriptor *comp_desc;
148}; 171};
149 172
150/*-------------------------------------------------------------------------*/ 173/*-------------------------------------------------------------------------*/
@@ -153,11 +176,8 @@ struct usb_ep {
153 * usb_ep_enable - configure endpoint, making it usable 176 * usb_ep_enable - configure endpoint, making it usable
154 * @ep:the endpoint being configured. may not be the endpoint named "ep0". 177 * @ep:the endpoint being configured. may not be the endpoint named "ep0".
155 * drivers discover endpoints through the ep_list of a usb_gadget. 178 * drivers discover endpoints through the ep_list of a usb_gadget.
156 * @desc:descriptor for desired behavior. caller guarantees this pointer
157 * remains valid until the endpoint is disabled; the data byte order
158 * is little-endian (usb-standard).
159 * 179 *
160 * when configurations are set, or when interface settings change, the driver 180 * When configurations are set, or when interface settings change, the driver
161 * will enable or disable the relevant endpoints. while it is enabled, an 181 * will enable or disable the relevant endpoints. while it is enabled, an
162 * endpoint may be used for i/o until the driver receives a disconnect() from 182 * endpoint may be used for i/o until the driver receives a disconnect() from
163 * the host or until the endpoint is disabled. 183 * the host or until the endpoint is disabled.
@@ -172,10 +192,9 @@ struct usb_ep {
172 * 192 *
173 * returns zero, or a negative error code. 193 * returns zero, or a negative error code.
174 */ 194 */
175static inline int usb_ep_enable(struct usb_ep *ep, 195static inline int usb_ep_enable(struct usb_ep *ep)
176 const struct usb_endpoint_descriptor *desc)
177{ 196{
178 return ep->ops->enable(ep, desc); 197 return ep->ops->enable(ep, ep->desc);
179} 198}
180 199
181/** 200/**
@@ -416,7 +435,16 @@ static inline void usb_ep_fifo_flush(struct usb_ep *ep)
416 435
417/*-------------------------------------------------------------------------*/ 436/*-------------------------------------------------------------------------*/
418 437
438struct usb_dcd_config_params {
439 __u8 bU1devExitLat; /* U1 Device exit Latency */
440#define USB_DEFULT_U1_DEV_EXIT_LAT 0x01 /* Less then 1 microsec */
441 __le16 bU2DevExitLat; /* U2 Device exit Latency */
442#define USB_DEFULT_U2_DEV_EXIT_LAT 0x1F4 /* Less then 500 microsec */
443};
444
445
419struct usb_gadget; 446struct usb_gadget;
447struct usb_gadget_driver;
420 448
421/* the rest of the api to the controller hardware: device operations, 449/* the rest of the api to the controller hardware: device operations,
422 * which don't involve endpoints (or i/o). 450 * which don't involve endpoints (or i/o).
@@ -430,6 +458,16 @@ struct usb_gadget_ops {
430 int (*pullup) (struct usb_gadget *, int is_on); 458 int (*pullup) (struct usb_gadget *, int is_on);
431 int (*ioctl)(struct usb_gadget *, 459 int (*ioctl)(struct usb_gadget *,
432 unsigned code, unsigned long param); 460 unsigned code, unsigned long param);
461 void (*get_config_params)(struct usb_dcd_config_params *);
462 int (*udc_start)(struct usb_gadget *,
463 struct usb_gadget_driver *);
464 int (*udc_stop)(struct usb_gadget *,
465 struct usb_gadget_driver *);
466
467 /* Those two are deprecated */
468 int (*start)(struct usb_gadget_driver *,
469 int (*bind)(struct usb_gadget *));
470 int (*stop)(struct usb_gadget_driver *);
433}; 471};
434 472
435/** 473/**
@@ -521,6 +559,24 @@ static inline int gadget_is_dualspeed(struct usb_gadget *g)
521} 559}
522 560
523/** 561/**
562 * gadget_is_superspeed() - return true if the hardware handles
563 * supperspeed
564 * @g: controller that might support supper speed
565 */
566static inline int gadget_is_superspeed(struct usb_gadget *g)
567{
568#ifdef CONFIG_USB_GADGET_SUPERSPEED
569 /*
570 * runtime test would check "g->is_superspeed" ... that might be
571 * useful to work around hardware bugs, but is mostly pointless
572 */
573 return 1;
574#else
575 return 0;
576#endif
577}
578
579/**
524 * gadget_is_otg - return true iff the hardware is OTG-ready 580 * gadget_is_otg - return true iff the hardware is OTG-ready
525 * @g: controller that might have a Mini-AB connector 581 * @g: controller that might have a Mini-AB connector
526 * 582 *
@@ -821,6 +877,9 @@ int usb_gadget_probe_driver(struct usb_gadget_driver *driver,
821 */ 877 */
822int usb_gadget_unregister_driver(struct usb_gadget_driver *driver); 878int usb_gadget_unregister_driver(struct usb_gadget_driver *driver);
823 879
880extern int usb_add_gadget_udc(struct device *parent, struct usb_gadget *gadget);
881extern void usb_del_gadget_udc(struct usb_gadget *gadget);
882
824/*-------------------------------------------------------------------------*/ 883/*-------------------------------------------------------------------------*/
825 884
826/* utility to simplify dealing with string descriptors */ 885/* utility to simplify dealing with string descriptors */
@@ -870,12 +929,6 @@ int usb_gadget_config_buf(const struct usb_config_descriptor *config,
870struct usb_descriptor_header **usb_copy_descriptors( 929struct usb_descriptor_header **usb_copy_descriptors(
871 struct usb_descriptor_header **); 930 struct usb_descriptor_header **);
872 931
873/* return copy of endpoint descriptor given original descriptor set */
874struct usb_endpoint_descriptor *usb_find_endpoint(
875 struct usb_descriptor_header **src,
876 struct usb_descriptor_header **copy,
877 struct usb_endpoint_descriptor *match);
878
879/** 932/**
880 * usb_free_descriptors - free descriptors returned by usb_copy_descriptors() 933 * usb_free_descriptors - free descriptors returned by usb_copy_descriptors()
881 * @v: vector of descriptors 934 * @v: vector of descriptors
@@ -892,6 +945,11 @@ static inline void usb_free_descriptors(struct usb_descriptor_header **v)
892extern struct usb_ep *usb_ep_autoconfig(struct usb_gadget *, 945extern struct usb_ep *usb_ep_autoconfig(struct usb_gadget *,
893 struct usb_endpoint_descriptor *); 946 struct usb_endpoint_descriptor *);
894 947
948
949extern struct usb_ep *usb_ep_autoconfig_ss(struct usb_gadget *,
950 struct usb_endpoint_descriptor *,
951 struct usb_ss_ep_comp_descriptor *);
952
895extern void usb_ep_autoconfig_reset(struct usb_gadget *); 953extern void usb_ep_autoconfig_reset(struct usb_gadget *);
896 954
897#endif /* __LINUX_USB_GADGET_H */ 955#endif /* __LINUX_USB_GADGET_H */
diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h
index 0097136ba45..c0ecc5a2ef9 100644
--- a/include/linux/usb/hcd.h
+++ b/include/linux/usb/hcd.h
@@ -178,7 +178,7 @@ struct usb_hcd {
178 * this structure. 178 * this structure.
179 */ 179 */
180 unsigned long hcd_priv[0] 180 unsigned long hcd_priv[0]
181 __attribute__ ((aligned(sizeof(unsigned long)))); 181 __attribute__ ((aligned(sizeof(s64))));
182}; 182};
183 183
184/* 2.4 does this a bit differently ... */ 184/* 2.4 does this a bit differently ... */
diff --git a/include/linux/usb/m66592.h b/include/linux/usb/m66592.h
index cda9625e7df..a4ba31ab2fe 100644
--- a/include/linux/usb/m66592.h
+++ b/include/linux/usb/m66592.h
@@ -38,6 +38,8 @@ struct m66592_platdata {
38 /* (external controller only) one = 3.3V, zero = 1.5V */ 38 /* (external controller only) one = 3.3V, zero = 1.5V */
39 unsigned vif:1; 39 unsigned vif:1;
40 40
41 /* (external controller only) set one = WR0_N shorted to WR1_N */
42 unsigned wr0_shorted_to_wr1:1;
41}; 43};
42 44
43#endif /* __LINUX_USB_M66592_H */ 45#endif /* __LINUX_USB_M66592_H */
diff --git a/include/linux/usb/otg_id.h b/include/linux/usb/otg_id.h
new file mode 100644
index 00000000000..f9f5189a73b
--- /dev/null
+++ b/include/linux/usb/otg_id.h
@@ -0,0 +1,58 @@
1/*
2 * Copyright (C) 2011 Google, Inc.
3 *
4 * Author:
5 * Colin Cross <ccross@android.com>
6 *
7 * This software is licensed under the terms of the GNU General Public
8 * License version 2, as published by the Free Software Foundation, and
9 * may be copied, distributed, and modified under those terms.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 */
17
18#ifndef __LINUX_USB_OTG_ID_H
19#define __LINUX_USB_OTG_ID_H
20
21#include <linux/notifier.h>
22#include <linux/plist.h>
23
24/**
25 * otg_id_notifier_block
26 *
27 * @priority: Order the notifications will be called in. Higher numbers
28 * get called first.
29 * @detect: Called during otg_id_notify. Return OTG_ID_HANDLED if the USB cable
30 * has been identified
31 * @proxy_wait: Called during otg_id_notify if a previous handler returns
32 * OTG_ID_PROXY_WAIT. This should wait on ID change then call otg_id_notify.
33 * This is used when a handler knows what's connected but can't detect
34 * the change itself.
35 * @cancel: Called after detect has returned OTG_ID_HANDLED to ask it to
36 * release detection resources to allow a new identification to occur.
37 */
38
39struct otg_id_notifier_block {
40 int priority;
41 int (*detect)(struct otg_id_notifier_block *otg_id_nb);
42 int (*proxy_wait)(struct otg_id_notifier_block *otg_id_nb);
43 void (*cancel)(struct otg_id_notifier_block *otg_id_nb);
44 struct plist_node p;
45};
46
47#define OTG_ID_PROXY_WAIT 2
48#define OTG_ID_HANDLED 1
49#define OTG_ID_UNHANDLED 0
50
51int otg_id_register_notifier(struct otg_id_notifier_block *otg_id_nb);
52void otg_id_unregister_notifier(struct otg_id_notifier_block *otg_id_nb);
53
54void otg_id_notify(void);
55int otg_id_suspend(void);
56void otg_id_resume(void);
57
58#endif /* __LINUX_USB_OTG_ID_H */
diff --git a/include/linux/usb/r8a66597.h b/include/linux/usb/r8a66597.h
index 26d21673405..b6b8660d0c6 100644
--- a/include/linux/usb/r8a66597.h
+++ b/include/linux/usb/r8a66597.h
@@ -3,7 +3,7 @@
3 * 3 *
4 * Copyright (C) 2009 Renesas Solutions Corp. 4 * Copyright (C) 2009 Renesas Solutions Corp.
5 * 5 *
6 * Author : Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com> 6 * Author : Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 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 9 * it under the terms of the GNU General Public License as published by
@@ -31,6 +31,9 @@ struct r8a66597_platdata {
31 /* This callback can control port power instead of DVSTCTR register. */ 31 /* This callback can control port power instead of DVSTCTR register. */
32 void (*port_power)(int port, int power); 32 void (*port_power)(int port, int power);
33 33
34 /* This parameter is for BUSWAIT */
35 u16 buswait;
36
34 /* set one = on chip controller, set zero = external controller */ 37 /* set one = on chip controller, set zero = external controller */
35 unsigned on_chip:1; 38 unsigned on_chip:1;
36 39
@@ -42,6 +45,9 @@ struct r8a66597_platdata {
42 45
43 /* set one = big endian, set zero = little endian */ 46 /* set one = big endian, set zero = little endian */
44 unsigned endian:1; 47 unsigned endian:1;
48
49 /* (external controller only) set one = WR0_N shorted to WR1_N */
50 unsigned wr0_shorted_to_wr1:1;
45}; 51};
46 52
47/* Register definitions */ 53/* Register definitions */
diff --git a/include/linux/usb/renesas_usbhs.h b/include/linux/usb/renesas_usbhs.h
index 3a7f1d982dd..8977431259c 100644
--- a/include/linux/usb/renesas_usbhs.h
+++ b/include/linux/usb/renesas_usbhs.h
@@ -110,6 +110,23 @@ struct renesas_usbhs_driver_param {
110 * delay time from notify_hotplug callback 110 * delay time from notify_hotplug callback
111 */ 111 */
112 int detection_delay; 112 int detection_delay;
113
114 /*
115 * option:
116 *
117 * dma id for dmaengine
118 */
119 int d0_tx_id;
120 int d0_rx_id;
121 int d1_tx_id;
122 int d1_rx_id;
123
124 /*
125 * option:
126 *
127 * pio <--> dma border.
128 */
129 int pio_dma_border; /* default is 64byte */
113}; 130};
114 131
115/* 132/*
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
index 605b0aa8d85..6939637e787 100644
--- a/include/linux/usb/usbnet.h
+++ b/include/linux/usb/usbnet.h
@@ -98,7 +98,7 @@ struct driver_info {
98 98
99#define FLAG_LINK_INTR 0x0800 /* updates link (carrier) status */ 99#define FLAG_LINK_INTR 0x0800 /* updates link (carrier) status */
100 100
101#define FLAG_POINTTOPOINT 0x1000 /* possibly use "usb%d" names */ 101#define FLAG_POINTTOPOINT 0x1000 /* possibly use "usb%d" names */
102 102
103/* 103/*
104 * Indicates to usbnet, that USB driver accumulates multiple IP packets. 104 * Indicates to usbnet, that USB driver accumulates multiple IP packets.
@@ -106,6 +106,7 @@ struct driver_info {
106 */ 106 */
107#define FLAG_MULTI_PACKET 0x2000 107#define FLAG_MULTI_PACKET 0x2000
108#define FLAG_RX_ASSEMBLE 0x4000 /* rx packets may span >1 frames */ 108#define FLAG_RX_ASSEMBLE 0x4000 /* rx packets may span >1 frames */
109#define FLAG_RMNET 0x8000 /* use "rmnet%d" names */
109 110
110 /* init device ... can sleep, or cause probe() failure */ 111 /* init device ... can sleep, or cause probe() failure */
111 int (*bind)(struct usbnet *, struct usb_interface *); 112 int (*bind)(struct usbnet *, struct usb_interface *);
diff --git a/include/linux/version.h b/include/linux/version.h
new file mode 100644
index 00000000000..6afe5dfae5a
--- /dev/null
+++ b/include/linux/version.h
@@ -0,0 +1,2 @@
1#define LINUX_VERSION_CODE 196874
2#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index 8a4c309d234..fca24cc5043 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -376,7 +376,16 @@ struct v4l2_pix_format {
376#define V4L2_PIX_FMT_MJPEG v4l2_fourcc('M', 'J', 'P', 'G') /* Motion-JPEG */ 376#define V4L2_PIX_FMT_MJPEG v4l2_fourcc('M', 'J', 'P', 'G') /* Motion-JPEG */
377#define V4L2_PIX_FMT_JPEG v4l2_fourcc('J', 'P', 'E', 'G') /* JFIF JPEG */ 377#define V4L2_PIX_FMT_JPEG v4l2_fourcc('J', 'P', 'E', 'G') /* JFIF JPEG */
378#define V4L2_PIX_FMT_DV v4l2_fourcc('d', 'v', 's', 'd') /* 1394 */ 378#define V4L2_PIX_FMT_DV v4l2_fourcc('d', 'v', 's', 'd') /* 1394 */
379#define V4L2_PIX_FMT_MPEG v4l2_fourcc('M', 'P', 'E', 'G') /* MPEG-1/2/4 */ 379#define V4L2_PIX_FMT_MPEG v4l2_fourcc('M', 'P', 'E', 'G') /* MPEG-1/2/4 Multiplexed */
380#define V4L2_PIX_FMT_H264 v4l2_fourcc('H', '2', '6', '4') /* H264 with start codes */
381#define V4L2_PIX_FMT_H264_NO_SC v4l2_fourcc('A', 'V', 'C', '1') /* H264 without start codes */
382#define V4L2_PIX_FMT_H263 v4l2_fourcc('H', '2', '6', '3') /* H263 */
383#define V4L2_PIX_FMT_MPEG1 v4l2_fourcc('M', 'P', 'G', '1') /* MPEG-1 ES */
384#define V4L2_PIX_FMT_MPEG2 v4l2_fourcc('M', 'P', 'G', '2') /* MPEG-2 ES */
385#define V4L2_PIX_FMT_MPEG4 v4l2_fourcc('M', 'P', 'G', '4') /* MPEG-4 ES */
386#define V4L2_PIX_FMT_XVID v4l2_fourcc('X', 'V', 'I', 'D') /* Xvid */
387#define V4L2_PIX_FMT_VC1_ANNEX_G v4l2_fourcc('V', 'C', '1', 'G') /* SMPTE 421M Annex G compliant stream */
388#define V4L2_PIX_FMT_VC1_ANNEX_L v4l2_fourcc('V', 'C', '1', 'L') /* SMPTE 421M Annex L compliant stream */
380 389
381/* Vendor-specific formats */ 390/* Vendor-specific formats */
382#define V4L2_PIX_FMT_CPIA1 v4l2_fourcc('C', 'P', 'I', 'A') /* cpia1 YUV */ 391#define V4L2_PIX_FMT_CPIA1 v4l2_fourcc('C', 'P', 'I', 'A') /* cpia1 YUV */
@@ -402,6 +411,7 @@ struct v4l2_pix_format {
402#define V4L2_PIX_FMT_CIT_YYVYUY v4l2_fourcc('C', 'I', 'T', 'V') /* one line of Y then 1 line of VYUY */ 411#define V4L2_PIX_FMT_CIT_YYVYUY v4l2_fourcc('C', 'I', 'T', 'V') /* one line of Y then 1 line of VYUY */
403#define V4L2_PIX_FMT_KONICA420 v4l2_fourcc('K', 'O', 'N', 'I') /* YUV420 planar in blocks of 256 pixels */ 412#define V4L2_PIX_FMT_KONICA420 v4l2_fourcc('K', 'O', 'N', 'I') /* YUV420 planar in blocks of 256 pixels */
404#define V4L2_PIX_FMT_JPGL v4l2_fourcc('J', 'P', 'G', 'L') /* JPEG-Lite */ 413#define V4L2_PIX_FMT_JPGL v4l2_fourcc('J', 'P', 'G', 'L') /* JPEG-Lite */
414#define V4L2_PIX_FMT_SE401 v4l2_fourcc('S', '4', '0', '1') /* se401 janggu compressed rgb */
405 415
406/* 416/*
407 * F O R M A T E N U M E R A T I O N 417 * F O R M A T E N U M E R A T I O N
@@ -1026,6 +1036,7 @@ struct v4l2_ext_controls {
1026#define V4L2_CTRL_CLASS_MPEG 0x00990000 /* MPEG-compression controls */ 1036#define V4L2_CTRL_CLASS_MPEG 0x00990000 /* MPEG-compression controls */
1027#define V4L2_CTRL_CLASS_CAMERA 0x009a0000 /* Camera class controls */ 1037#define V4L2_CTRL_CLASS_CAMERA 0x009a0000 /* Camera class controls */
1028#define V4L2_CTRL_CLASS_FM_TX 0x009b0000 /* FM Modulator control class */ 1038#define V4L2_CTRL_CLASS_FM_TX 0x009b0000 /* FM Modulator control class */
1039#define V4L2_CTRL_CLASS_FLASH 0x009c0000 /* Camera flash controls */
1029 1040
1030#define V4L2_CTRL_ID_MASK (0x0fffffff) 1041#define V4L2_CTRL_ID_MASK (0x0fffffff)
1031#define V4L2_CTRL_ID2CLASS(id) ((id) & 0x0fff0000UL) 1042#define V4L2_CTRL_ID2CLASS(id) ((id) & 0x0fff0000UL)
@@ -1039,6 +1050,7 @@ enum v4l2_ctrl_type {
1039 V4L2_CTRL_TYPE_INTEGER64 = 5, 1050 V4L2_CTRL_TYPE_INTEGER64 = 5,
1040 V4L2_CTRL_TYPE_CTRL_CLASS = 6, 1051 V4L2_CTRL_TYPE_CTRL_CLASS = 6,
1041 V4L2_CTRL_TYPE_STRING = 7, 1052 V4L2_CTRL_TYPE_STRING = 7,
1053 V4L2_CTRL_TYPE_BITMASK = 8,
1042}; 1054};
1043 1055
1044/* Used in the VIDIOC_QUERYCTRL ioctl for querying controls */ 1056/* Used in the VIDIOC_QUERYCTRL ioctl for querying controls */
@@ -1144,14 +1156,19 @@ enum v4l2_colorfx {
1144#define V4L2_CID_ILLUMINATORS_1 (V4L2_CID_BASE+37) 1156#define V4L2_CID_ILLUMINATORS_1 (V4L2_CID_BASE+37)
1145#define V4L2_CID_ILLUMINATORS_2 (V4L2_CID_BASE+38) 1157#define V4L2_CID_ILLUMINATORS_2 (V4L2_CID_BASE+38)
1146 1158
1159#define V4L2_CID_MIN_BUFFERS_FOR_CAPTURE (V4L2_CID_BASE+39)
1160#define V4L2_CID_MIN_BUFFERS_FOR_OUTPUT (V4L2_CID_BASE+40)
1161
1147/* last CID + 1 */ 1162/* last CID + 1 */
1148#define V4L2_CID_LASTP1 (V4L2_CID_BASE+39) 1163#define V4L2_CID_LASTP1 (V4L2_CID_BASE+41)
1164
1165/* Minimum number of buffer neede by the device */
1149 1166
1150/* MPEG-class control IDs defined by V4L2 */ 1167/* MPEG-class control IDs defined by V4L2 */
1151#define V4L2_CID_MPEG_BASE (V4L2_CTRL_CLASS_MPEG | 0x900) 1168#define V4L2_CID_MPEG_BASE (V4L2_CTRL_CLASS_MPEG | 0x900)
1152#define V4L2_CID_MPEG_CLASS (V4L2_CTRL_CLASS_MPEG | 1) 1169#define V4L2_CID_MPEG_CLASS (V4L2_CTRL_CLASS_MPEG | 1)
1153 1170
1154/* MPEG streams */ 1171/* MPEG streams, specific to multiplexed streams */
1155#define V4L2_CID_MPEG_STREAM_TYPE (V4L2_CID_MPEG_BASE+0) 1172#define V4L2_CID_MPEG_STREAM_TYPE (V4L2_CID_MPEG_BASE+0)
1156enum v4l2_mpeg_stream_type { 1173enum v4l2_mpeg_stream_type {
1157 V4L2_MPEG_STREAM_TYPE_MPEG2_PS = 0, /* MPEG-2 program stream */ 1174 V4L2_MPEG_STREAM_TYPE_MPEG2_PS = 0, /* MPEG-2 program stream */
@@ -1173,7 +1190,7 @@ enum v4l2_mpeg_stream_vbi_fmt {
1173 V4L2_MPEG_STREAM_VBI_FMT_IVTV = 1, /* VBI in private packets, IVTV format */ 1190 V4L2_MPEG_STREAM_VBI_FMT_IVTV = 1, /* VBI in private packets, IVTV format */
1174}; 1191};
1175 1192
1176/* MPEG audio */ 1193/* MPEG audio controls specific to multiplexed streams */
1177#define V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ (V4L2_CID_MPEG_BASE+100) 1194#define V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ (V4L2_CID_MPEG_BASE+100)
1178enum v4l2_mpeg_audio_sampling_freq { 1195enum v4l2_mpeg_audio_sampling_freq {
1179 V4L2_MPEG_AUDIO_SAMPLING_FREQ_44100 = 0, 1196 V4L2_MPEG_AUDIO_SAMPLING_FREQ_44100 = 0,
@@ -1289,7 +1306,7 @@ enum v4l2_mpeg_audio_ac3_bitrate {
1289 V4L2_MPEG_AUDIO_AC3_BITRATE_640K = 18, 1306 V4L2_MPEG_AUDIO_AC3_BITRATE_640K = 18,
1290}; 1307};
1291 1308
1292/* MPEG video */ 1309/* MPEG video controls specific to multiplexed streams */
1293#define V4L2_CID_MPEG_VIDEO_ENCODING (V4L2_CID_MPEG_BASE+200) 1310#define V4L2_CID_MPEG_VIDEO_ENCODING (V4L2_CID_MPEG_BASE+200)
1294enum v4l2_mpeg_video_encoding { 1311enum v4l2_mpeg_video_encoding {
1295 V4L2_MPEG_VIDEO_ENCODING_MPEG_1 = 0, 1312 V4L2_MPEG_VIDEO_ENCODING_MPEG_1 = 0,
@@ -1317,6 +1334,141 @@ enum v4l2_mpeg_video_bitrate_mode {
1317#define V4L2_CID_MPEG_VIDEO_TEMPORAL_DECIMATION (V4L2_CID_MPEG_BASE+209) 1334#define V4L2_CID_MPEG_VIDEO_TEMPORAL_DECIMATION (V4L2_CID_MPEG_BASE+209)
1318#define V4L2_CID_MPEG_VIDEO_MUTE (V4L2_CID_MPEG_BASE+210) 1335#define V4L2_CID_MPEG_VIDEO_MUTE (V4L2_CID_MPEG_BASE+210)
1319#define V4L2_CID_MPEG_VIDEO_MUTE_YUV (V4L2_CID_MPEG_BASE+211) 1336#define V4L2_CID_MPEG_VIDEO_MUTE_YUV (V4L2_CID_MPEG_BASE+211)
1337#define V4L2_CID_MPEG_VIDEO_DECODER_SLICE_INTERFACE (V4L2_CID_MPEG_BASE+212)
1338#define V4L2_CID_MPEG_VIDEO_DECODER_MPEG4_DEBLOCK_FILTER (V4L2_CID_MPEG_BASE+213)
1339#define V4L2_CID_MPEG_VIDEO_CYCLIC_INTRA_REFRESH_MB (V4L2_CID_MPEG_BASE+214)
1340#define V4L2_CID_MPEG_VIDEO_FRAME_RC_ENABLE (V4L2_CID_MPEG_BASE+215)
1341#define V4L2_CID_MPEG_VIDEO_HEADER_MODE (V4L2_CID_MPEG_BASE+216)
1342enum v4l2_mpeg_video_header_mode {
1343 V4L2_MPEG_VIDEO_HEADER_MODE_SEPARATE = 0,
1344 V4L2_MPEG_VIDEO_HEADER_MODE_JOINED_WITH_1ST_FRAME = 1,
1345
1346};
1347#define V4L2_CID_MPEG_VIDEO_MAX_REF_PIC (V4L2_CID_MPEG_BASE+217)
1348#define V4L2_CID_MPEG_VIDEO_MB_RC_ENABLE (V4L2_CID_MPEG_BASE+218)
1349#define V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MAX_BYTES (V4L2_CID_MPEG_BASE+219)
1350#define V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MAX_MB (V4L2_CID_MPEG_BASE+220)
1351#define V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MODE (V4L2_CID_MPEG_BASE+221)
1352enum v4l2_mpeg_video_multi_slice_mode {
1353 V4L2_MPEG_VIDEO_MULTI_SLICE_MODE_SINGLE = 0,
1354 V4L2_MPEG_VIDEO_MULTI_SICE_MODE_MAX_MB = 1,
1355 V4L2_MPEG_VIDEO_MULTI_SICE_MODE_MAX_BYTES = 2,
1356};
1357#define V4L2_CID_MPEG_VIDEO_VBV_SIZE (V4L2_CID_MPEG_BASE+222)
1358#define V4L2_CID_MPEG_VIDEO_H263_I_FRAME_QP (V4L2_CID_MPEG_BASE+300)
1359#define V4L2_CID_MPEG_VIDEO_H263_P_FRAME_QP (V4L2_CID_MPEG_BASE+301)
1360#define V4L2_CID_MPEG_VIDEO_H263_B_FRAME_QP (V4L2_CID_MPEG_BASE+302)
1361#define V4L2_CID_MPEG_VIDEO_H263_MIN_QP (V4L2_CID_MPEG_BASE+303)
1362#define V4L2_CID_MPEG_VIDEO_H263_MAX_QP (V4L2_CID_MPEG_BASE+304)
1363#define V4L2_CID_MPEG_VIDEO_H264_I_FRAME_QP (V4L2_CID_MPEG_BASE+350)
1364#define V4L2_CID_MPEG_VIDEO_H264_P_FRAME_QP (V4L2_CID_MPEG_BASE+351)
1365#define V4L2_CID_MPEG_VIDEO_H264_B_FRAME_QP (V4L2_CID_MPEG_BASE+352)
1366#define V4L2_CID_MPEG_VIDEO_H264_MIN_QP (V4L2_CID_MPEG_BASE+353)
1367#define V4L2_CID_MPEG_VIDEO_H264_MAX_QP (V4L2_CID_MPEG_BASE+354)
1368#define V4L2_CID_MPEG_VIDEO_H264_8X8_TRANSFORM (V4L2_CID_MPEG_BASE+355)
1369#define V4L2_CID_MPEG_VIDEO_H264_CPB_SIZE (V4L2_CID_MPEG_BASE+356)
1370#define V4L2_CID_MPEG_VIDEO_H264_ENTROPY_MODE (V4L2_CID_MPEG_BASE+357)
1371enum v4l2_mpeg_video_h264_entropy_mode {
1372 V4L2_MPEG_VIDEO_H264_ENTROPY_MODE_CAVLC = 0,
1373 V4L2_MPEG_VIDEO_H264_ENTROPY_MODE_CABAC = 1,
1374};
1375#define V4L2_CID_MPEG_VIDEO_H264_I_PERIOD (V4L2_CID_MPEG_BASE+358)
1376#define V4L2_CID_MPEG_VIDEO_H264_LEVEL (V4L2_CID_MPEG_BASE+359)
1377enum v4l2_mpeg_video_h264_level {
1378 V4L2_MPEG_VIDEO_H264_LEVEL_1_0 = 0,
1379 V4L2_MPEG_VIDEO_H264_LEVEL_1B = 1,
1380 V4L2_MPEG_VIDEO_H264_LEVEL_1_1 = 2,
1381 V4L2_MPEG_VIDEO_H264_LEVEL_1_2 = 3,
1382 V4L2_MPEG_VIDEO_H264_LEVEL_1_3 = 4,
1383 V4L2_MPEG_VIDEO_H264_LEVEL_2_0 = 5,
1384 V4L2_MPEG_VIDEO_H264_LEVEL_2_1 = 6,
1385 V4L2_MPEG_VIDEO_H264_LEVEL_2_2 = 7,
1386 V4L2_MPEG_VIDEO_H264_LEVEL_3_0 = 8,
1387 V4L2_MPEG_VIDEO_H264_LEVEL_3_1 = 9,
1388 V4L2_MPEG_VIDEO_H264_LEVEL_3_2 = 10,
1389 V4L2_MPEG_VIDEO_H264_LEVEL_4_0 = 11,
1390 V4L2_MPEG_VIDEO_H264_LEVEL_4_1 = 12,
1391 V4L2_MPEG_VIDEO_H264_LEVEL_4_2 = 13,
1392 V4L2_MPEG_VIDEO_H264_LEVEL_5_0 = 14,
1393 V4L2_MPEG_VIDEO_H264_LEVEL_5_1 = 15,
1394};
1395#define V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_ALPHA (V4L2_CID_MPEG_BASE+360)
1396#define V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_BETA (V4L2_CID_MPEG_BASE+361)
1397#define V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_MODE (V4L2_CID_MPEG_BASE+362)
1398enum v4l2_mpeg_video_h264_loop_filter_mode {
1399 V4L2_MPEG_VIDEO_H264_LOOP_FILTER_MODE_ENABLED = 0,
1400 V4L2_MPEG_VIDEO_H264_LOOP_FILTER_MODE_DISABLED = 1,
1401 V4L2_MPEG_VIDEO_H264_LOOP_FILTER_MODE_DISABLED_AT_SLICE_BOUNDARY = 2,
1402};
1403#define V4L2_CID_MPEG_VIDEO_H264_PROFILE (V4L2_CID_MPEG_BASE+363)
1404enum v4l2_mpeg_video_h264_profile {
1405 V4L2_MPEG_VIDEO_H264_PROFILE_BASELINE = 0,
1406 V4L2_MPEG_VIDEO_H264_PROFILE_CONSTRAINED_BASELINE = 1,
1407 V4L2_MPEG_VIDEO_H264_PROFILE_MAIN = 2,
1408 V4L2_MPEG_VIDEO_H264_PROFILE_EXTENDED = 3,
1409 V4L2_MPEG_VIDEO_H264_PROFILE_HIGH = 4,
1410 V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_10 = 5,
1411 V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_422 = 6,
1412 V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_444_PREDICTIVE = 7,
1413 V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_10_INTRA = 8,
1414 V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_422_INTRA = 9,
1415 V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_444_INTRA = 10,
1416 V4L2_MPEG_VIDEO_H264_PROFILE_CAVLC_444_INTRA = 11,
1417 V4L2_MPEG_VIDEO_H264_PROFILE_SCALABLE_BASELINE = 12,
1418 V4L2_MPEG_VIDEO_H264_PROFILE_SCALABLE_HIGH = 13,
1419 V4L2_MPEG_VIDEO_H264_PROFILE_SCALABLE_HIGH_INTRA = 14,
1420 V4L2_MPEG_VIDEO_H264_PROFILE_STEREO_HIGH = 15,
1421 V4L2_MPEG_VIDEO_H264_PROFILE_MULTIVIEW_HIGH = 16,
1422};
1423#define V4L2_CID_MPEG_VIDEO_H264_VUI_EXT_SAR_HEIGHT (V4L2_CID_MPEG_BASE+364)
1424#define V4L2_CID_MPEG_VIDEO_H264_VUI_EXT_SAR_WIDTH (V4L2_CID_MPEG_BASE+365)
1425#define V4L2_CID_MPEG_VIDEO_H264_VUI_SAR_ENABLE (V4L2_CID_MPEG_BASE+366)
1426#define V4L2_CID_MPEG_VIDEO_H264_VUI_SAR_IDC (V4L2_CID_MPEG_BASE+367)
1427enum v4l2_mpeg_video_h264_vui_sar_idc {
1428 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_UNSPECIFIED = 0,
1429 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_1x1 = 1,
1430 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_12x11 = 2,
1431 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_10x11 = 3,
1432 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_16x11 = 4,
1433 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_40x33 = 5,
1434 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_24x11 = 6,
1435 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_20x11 = 7,
1436 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_32x11 = 8,
1437 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_80x33 = 9,
1438 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_18x11 = 10,
1439 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_15x11 = 11,
1440 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_64x33 = 12,
1441 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_160x99 = 13,
1442 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_4x3 = 14,
1443 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_3x2 = 15,
1444 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_2x1 = 16,
1445 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_EXTENDED = 17,
1446};
1447#define V4L2_CID_MPEG_VIDEO_MPEG4_I_FRAME_QP (V4L2_CID_MPEG_BASE+400)
1448#define V4L2_CID_MPEG_VIDEO_MPEG4_P_FRAME_QP (V4L2_CID_MPEG_BASE+401)
1449#define V4L2_CID_MPEG_VIDEO_MPEG4_B_FRAME_QP (V4L2_CID_MPEG_BASE+402)
1450#define V4L2_CID_MPEG_VIDEO_MPEG4_MIN_QP (V4L2_CID_MPEG_BASE+403)
1451#define V4L2_CID_MPEG_VIDEO_MPEG4_MAX_QP (V4L2_CID_MPEG_BASE+404)
1452#define V4L2_CID_MPEG_VIDEO_MPEG4_LEVEL (V4L2_CID_MPEG_BASE+405)
1453enum v4l2_mpeg_video_mpeg4_level {
1454 V4L2_MPEG_VIDEO_MPEG4_LEVEL_0 = 0,
1455 V4L2_MPEG_VIDEO_MPEG4_LEVEL_0B = 1,
1456 V4L2_MPEG_VIDEO_MPEG4_LEVEL_1 = 2,
1457 V4L2_MPEG_VIDEO_MPEG4_LEVEL_2 = 3,
1458 V4L2_MPEG_VIDEO_MPEG4_LEVEL_3 = 4,
1459 V4L2_MPEG_VIDEO_MPEG4_LEVEL_3B = 5,
1460 V4L2_MPEG_VIDEO_MPEG4_LEVEL_4 = 6,
1461 V4L2_MPEG_VIDEO_MPEG4_LEVEL_5 = 7,
1462};
1463#define V4L2_CID_MPEG_VIDEO_MPEG4_PROFILE (V4L2_CID_MPEG_BASE+406)
1464enum v4l2_mpeg_video_mpeg4_profile {
1465 V4L2_MPEG_VIDEO_MPEG4_PROFILE_SIMPLE = 0,
1466 V4L2_MPEG_VIDEO_MPEG4_PROFILE_ADVANCED_SIMPLE = 1,
1467 V4L2_MPEG_VIDEO_MPEG4_PROFILE_CORE = 2,
1468 V4L2_MPEG_VIDEO_MPEG4_PROFILE_SIMPLE_SCALABLE = 3,
1469 V4L2_MPEG_VIDEO_MPEG4_PROFILE_ADVANCED_CODING_EFFICIENCY = 4,
1470};
1471#define V4L2_CID_MPEG_VIDEO_MPEG4_QPEL (V4L2_CID_MPEG_BASE+407)
1320 1472
1321/* MPEG-class control IDs specific to the CX2341x driver as defined by V4L2 */ 1473/* MPEG-class control IDs specific to the CX2341x driver as defined by V4L2 */
1322#define V4L2_CID_MPEG_CX2341X_BASE (V4L2_CTRL_CLASS_MPEG | 0x1000) 1474#define V4L2_CID_MPEG_CX2341X_BASE (V4L2_CTRL_CLASS_MPEG | 0x1000)
@@ -1359,6 +1511,33 @@ enum v4l2_mpeg_cx2341x_video_median_filter_type {
1359#define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_TOP (V4L2_CID_MPEG_CX2341X_BASE+10) 1511#define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_TOP (V4L2_CID_MPEG_CX2341X_BASE+10)
1360#define V4L2_CID_MPEG_CX2341X_STREAM_INSERT_NAV_PACKETS (V4L2_CID_MPEG_CX2341X_BASE+11) 1512#define V4L2_CID_MPEG_CX2341X_STREAM_INSERT_NAV_PACKETS (V4L2_CID_MPEG_CX2341X_BASE+11)
1361 1513
1514/* MPEG-class control IDs specific to the Samsung MFC 5.1 driver as defined by V4L2 */
1515#define V4L2_CID_MPEG_MFC51_BASE (V4L2_CTRL_CLASS_MPEG | 0x1100)
1516
1517#define V4L2_CID_MPEG_MFC51_VIDEO_DECODER_H264_DISPLAY_DELAY (V4L2_CID_MPEG_MFC51_BASE+0)
1518#define V4L2_CID_MPEG_MFC51_VIDEO_DECODER_H264_DISPLAY_DELAY_ENABLE (V4L2_CID_MPEG_MFC51_BASE+1)
1519#define V4L2_CID_MPEG_MFC51_VIDEO_FRAME_SKIP_MODE (V4L2_CID_MPEG_MFC51_BASE+2)
1520enum v4l2_mpeg_mfc51_video_frame_skip_mode {
1521 V4L2_MPEG_MFC51_VIDEO_FRAME_SKIP_MODE_DISABLED = 0,
1522 V4L2_MPEG_MFC51_VIDEO_FRAME_SKIP_MODE_LEVEL_LIMIT = 1,
1523 V4L2_MPEG_MFC51_VIDEO_FRAME_SKIP_MODE_BUF_LIMIT = 2,
1524};
1525#define V4L2_CID_MPEG_MFC51_VIDEO_FORCE_FRAME_TYPE (V4L2_CID_MPEG_MFC51_BASE+3)
1526enum v4l2_mpeg_mfc51_video_force_frame_type {
1527 V4L2_MPEG_MFC51_VIDEO_FORCE_FRAME_TYPE_DISABLED = 0,
1528 V4L2_MPEG_MFC51_VIDEO_FORCE_FRAME_TYPE_I_FRAME = 1,
1529 V4L2_MPEG_MFC51_VIDEO_FORCE_FRAME_TYPE_NOT_CODED = 2,
1530};
1531#define V4L2_CID_MPEG_MFC51_VIDEO_PADDING (V4L2_CID_MPEG_MFC51_BASE+4)
1532#define V4L2_CID_MPEG_MFC51_VIDEO_PADDING_YUV (V4L2_CID_MPEG_MFC51_BASE+5)
1533#define V4L2_CID_MPEG_MFC51_VIDEO_RC_FIXED_TARGET_BIT (V4L2_CID_MPEG_MFC51_BASE+6)
1534#define V4L2_CID_MPEG_MFC51_VIDEO_RC_REACTION_COEFF (V4L2_CID_MPEG_MFC51_BASE+7)
1535#define V4L2_CID_MPEG_MFC51_VIDEO_H264_ADAPTIVE_RC_ACTIVITY (V4L2_CID_MPEG_MFC51_BASE+50)
1536#define V4L2_CID_MPEG_MFC51_VIDEO_H264_ADAPTIVE_RC_DARK (V4L2_CID_MPEG_MFC51_BASE+51)
1537#define V4L2_CID_MPEG_MFC51_VIDEO_H264_ADAPTIVE_RC_SMOOTH (V4L2_CID_MPEG_MFC51_BASE+52)
1538#define V4L2_CID_MPEG_MFC51_VIDEO_H264_ADAPTIVE_RC_STATIC (V4L2_CID_MPEG_MFC51_BASE+53)
1539#define V4L2_CID_MPEG_MFC51_VIDEO_H264_NUM_REF_PIC_FOR_P (V4L2_CID_MPEG_MFC51_BASE+54)
1540
1362/* Camera class control IDs */ 1541/* Camera class control IDs */
1363#define V4L2_CID_CAMERA_CLASS_BASE (V4L2_CTRL_CLASS_CAMERA | 0x900) 1542#define V4L2_CID_CAMERA_CLASS_BASE (V4L2_CTRL_CLASS_CAMERA | 0x900)
1364#define V4L2_CID_CAMERA_CLASS (V4L2_CTRL_CLASS_CAMERA | 1) 1543#define V4L2_CID_CAMERA_CLASS (V4L2_CTRL_CLASS_CAMERA | 1)
@@ -1427,6 +1606,41 @@ enum v4l2_preemphasis {
1427#define V4L2_CID_TUNE_POWER_LEVEL (V4L2_CID_FM_TX_CLASS_BASE + 113) 1606#define V4L2_CID_TUNE_POWER_LEVEL (V4L2_CID_FM_TX_CLASS_BASE + 113)
1428#define V4L2_CID_TUNE_ANTENNA_CAPACITOR (V4L2_CID_FM_TX_CLASS_BASE + 114) 1607#define V4L2_CID_TUNE_ANTENNA_CAPACITOR (V4L2_CID_FM_TX_CLASS_BASE + 114)
1429 1608
1609/* Flash and privacy (indicator) light controls */
1610#define V4L2_CID_FLASH_CLASS_BASE (V4L2_CTRL_CLASS_FLASH | 0x900)
1611#define V4L2_CID_FLASH_CLASS (V4L2_CTRL_CLASS_FLASH | 1)
1612
1613#define V4L2_CID_FLASH_LED_MODE (V4L2_CID_FLASH_CLASS_BASE + 1)
1614enum v4l2_flash_led_mode {
1615 V4L2_FLASH_LED_MODE_NONE,
1616 V4L2_FLASH_LED_MODE_FLASH,
1617 V4L2_FLASH_LED_MODE_TORCH,
1618};
1619
1620#define V4L2_CID_FLASH_STROBE_SOURCE (V4L2_CID_FLASH_CLASS_BASE + 2)
1621enum v4l2_flash_strobe_source {
1622 V4L2_FLASH_STROBE_SOURCE_SOFTWARE,
1623 V4L2_FLASH_STROBE_SOURCE_EXTERNAL,
1624};
1625
1626#define V4L2_CID_FLASH_STROBE (V4L2_CID_FLASH_CLASS_BASE + 3)
1627#define V4L2_CID_FLASH_STROBE_STOP (V4L2_CID_FLASH_CLASS_BASE + 4)
1628#define V4L2_CID_FLASH_STROBE_STATUS (V4L2_CID_FLASH_CLASS_BASE + 5)
1629
1630#define V4L2_CID_FLASH_TIMEOUT (V4L2_CID_FLASH_CLASS_BASE + 6)
1631#define V4L2_CID_FLASH_INTENSITY (V4L2_CID_FLASH_CLASS_BASE + 7)
1632#define V4L2_CID_FLASH_TORCH_INTENSITY (V4L2_CID_FLASH_CLASS_BASE + 8)
1633#define V4L2_CID_FLASH_INDICATOR_INTENSITY (V4L2_CID_FLASH_CLASS_BASE + 9)
1634
1635#define V4L2_CID_FLASH_FAULT (V4L2_CID_FLASH_CLASS_BASE + 10)
1636#define V4L2_FLASH_FAULT_OVER_VOLTAGE (1 << 0)
1637#define V4L2_FLASH_FAULT_TIMEOUT (1 << 1)
1638#define V4L2_FLASH_FAULT_OVER_TEMPERATURE (1 << 2)
1639#define V4L2_FLASH_FAULT_SHORT_CIRCUIT (1 << 3)
1640
1641#define V4L2_CID_FLASH_CHARGE (V4L2_CID_FLASH_CLASS_BASE + 11)
1642#define V4L2_CID_FLASH_READY (V4L2_CID_FLASH_CLASS_BASE + 12)
1643
1430/* 1644/*
1431 * T U N I N G 1645 * T U N I N G
1432 */ 1646 */
@@ -1791,6 +2005,7 @@ struct v4l2_streamparm {
1791#define V4L2_EVENT_ALL 0 2005#define V4L2_EVENT_ALL 0
1792#define V4L2_EVENT_VSYNC 1 2006#define V4L2_EVENT_VSYNC 1
1793#define V4L2_EVENT_EOS 2 2007#define V4L2_EVENT_EOS 2
2008#define V4L2_EVENT_CTRL 3
1794#define V4L2_EVENT_PRIVATE_START 0x08000000 2009#define V4L2_EVENT_PRIVATE_START 0x08000000
1795 2010
1796/* Payload for V4L2_EVENT_VSYNC */ 2011/* Payload for V4L2_EVENT_VSYNC */
@@ -1799,21 +2014,46 @@ struct v4l2_event_vsync {
1799 __u8 field; 2014 __u8 field;
1800} __attribute__ ((packed)); 2015} __attribute__ ((packed));
1801 2016
2017/* Payload for V4L2_EVENT_CTRL */
2018#define V4L2_EVENT_CTRL_CH_VALUE (1 << 0)
2019#define V4L2_EVENT_CTRL_CH_FLAGS (1 << 1)
2020
2021struct v4l2_event_ctrl {
2022 __u32 changes;
2023 __u32 type;
2024 union {
2025 __s32 value;
2026 __s64 value64;
2027 };
2028 __u32 flags;
2029 __s32 minimum;
2030 __s32 maximum;
2031 __s32 step;
2032 __s32 default_value;
2033};
2034
1802struct v4l2_event { 2035struct v4l2_event {
1803 __u32 type; 2036 __u32 type;
1804 union { 2037 union {
1805 struct v4l2_event_vsync vsync; 2038 struct v4l2_event_vsync vsync;
2039 struct v4l2_event_ctrl ctrl;
1806 __u8 data[64]; 2040 __u8 data[64];
1807 } u; 2041 } u;
1808 __u32 pending; 2042 __u32 pending;
1809 __u32 sequence; 2043 __u32 sequence;
1810 struct timespec timestamp; 2044 struct timespec timestamp;
1811 __u32 reserved[9]; 2045 __u32 id;
2046 __u32 reserved[8];
1812}; 2047};
1813 2048
2049#define V4L2_EVENT_SUB_FL_SEND_INITIAL (1 << 0)
2050#define V4L2_EVENT_SUB_FL_ALLOW_FEEDBACK (1 << 1)
2051
1814struct v4l2_event_subscription { 2052struct v4l2_event_subscription {
1815 __u32 type; 2053 __u32 type;
1816 __u32 reserved[7]; 2054 __u32 id;
2055 __u32 flags;
2056 __u32 reserved[5];
1817}; 2057};
1818 2058
1819/* 2059/*
diff --git a/include/linux/virtio_net.h b/include/linux/virtio_net.h
index 136040bba3e..970d5a2a904 100644
--- a/include/linux/virtio_net.h
+++ b/include/linux/virtio_net.h
@@ -63,6 +63,7 @@ struct virtio_net_config {
63 * specify GSO or CSUM features, you can simply ignore the header. */ 63 * specify GSO or CSUM features, you can simply ignore the header. */
64struct virtio_net_hdr { 64struct virtio_net_hdr {
65#define VIRTIO_NET_HDR_F_NEEDS_CSUM 1 // Use csum_start, csum_offset 65#define VIRTIO_NET_HDR_F_NEEDS_CSUM 1 // Use csum_start, csum_offset
66#define VIRTIO_NET_HDR_F_DATA_VALID 2 // Csum is valid
66 __u8 flags; 67 __u8 flags;
67#define VIRTIO_NET_HDR_GSO_NONE 0 // Not a GSO frame 68#define VIRTIO_NET_HDR_GSO_NONE 0 // Not a GSO frame
68#define VIRTIO_NET_HDR_GSO_TCPV4 1 // GSO frame, IPv4 TCP (TSO) 69#define VIRTIO_NET_HDR_GSO_TCPV4 1 // GSO frame, IPv4 TCP (TSO)
diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h
index 9332e52ea8c..687fb11e201 100644
--- a/include/linux/vmalloc.h
+++ b/include/linux/vmalloc.h
@@ -13,6 +13,7 @@ struct vm_area_struct; /* vma defining user mapping in mm_types.h */
13#define VM_MAP 0x00000004 /* vmap()ed pages */ 13#define VM_MAP 0x00000004 /* vmap()ed pages */
14#define VM_USERMAP 0x00000008 /* suitable for remap_vmalloc_range */ 14#define VM_USERMAP 0x00000008 /* suitable for remap_vmalloc_range */
15#define VM_VPAGES 0x00000010 /* buffer for pages was vmalloc'ed */ 15#define VM_VPAGES 0x00000010 /* buffer for pages was vmalloc'ed */
16#define VM_UNLIST 0x00000020 /* vm_struct is not listed in vmlist */
16/* bits [20..32] reserved for arch specific ioremap internals */ 17/* bits [20..32] reserved for arch specific ioremap internals */
17 18
18/* 19/*
diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h
index bcd942fa611..65efb92da99 100644
--- a/include/linux/vmstat.h
+++ b/include/linux/vmstat.h
@@ -6,7 +6,7 @@
6#include <linux/mm.h> 6#include <linux/mm.h>
7#include <linux/mmzone.h> 7#include <linux/mmzone.h>
8#include <linux/vm_event_item.h> 8#include <linux/vm_event_item.h>
9#include <asm/atomic.h> 9#include <linux/atomic.h>
10 10
11extern int sysctl_stat_interval; 11extern int sysctl_stat_interval;
12 12
diff --git a/include/linux/vt.h b/include/linux/vt.h
index d5dd0bc408f..30a8dd9c83f 100644
--- a/include/linux/vt.h
+++ b/include/linux/vt.h
@@ -86,6 +86,13 @@ struct vt_setactivate {
86 86
87#ifdef __KERNEL__ 87#ifdef __KERNEL__
88 88
89/* Virtual Terminal events. */
90#define VT_ALLOCATE 0x0001 /* Console got allocated */
91#define VT_DEALLOCATE 0x0002 /* Console will be deallocated */
92#define VT_WRITE 0x0003 /* A char got output */
93#define VT_UPDATE 0x0004 /* A bigger update occurred */
94#define VT_PREWRITE 0x0005 /* A char is about to be written to the console */
95
89#ifdef CONFIG_VT_CONSOLE 96#ifdef CONFIG_VT_CONSOLE
90 97
91extern int vt_kmsg_redirect(int new); 98extern int vt_kmsg_redirect(int new);
diff --git a/include/linux/vt_kern.h b/include/linux/vt_kern.h
index 4d05e14ea60..c2164fad008 100644
--- a/include/linux/vt_kern.h
+++ b/include/linux/vt_kern.h
@@ -137,7 +137,7 @@ int vty_init(const struct file_operations *console_fops);
137 137
138static inline bool vt_force_oops_output(struct vc_data *vc) 138static inline bool vt_force_oops_output(struct vc_data *vc)
139{ 139{
140 if (oops_in_progress && vc->vc_panic_force_write) 140 if (oops_in_progress && vc->vc_panic_force_write && panic_timeout >= 0)
141 return true; 141 return true;
142 return false; 142 return false;
143} 143}
diff --git a/include/linux/wakelock.h b/include/linux/wakelock.h
new file mode 100644
index 00000000000..a096d24ada1
--- /dev/null
+++ b/include/linux/wakelock.h
@@ -0,0 +1,91 @@
1/* include/linux/wakelock.h
2 *
3 * Copyright (C) 2007-2008 Google, Inc.
4 *
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
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 */
15
16#ifndef _LINUX_WAKELOCK_H
17#define _LINUX_WAKELOCK_H
18
19#include <linux/list.h>
20#include <linux/ktime.h>
21
22/* A wake_lock prevents the system from entering suspend or other low power
23 * states when active. If the type is set to WAKE_LOCK_SUSPEND, the wake_lock
24 * prevents a full system suspend. If the type is WAKE_LOCK_IDLE, low power
25 * states that cause large interrupt latencies or that disable a set of
26 * interrupts will not entered from idle until the wake_locks are released.
27 */
28
29enum {
30 WAKE_LOCK_SUSPEND, /* Prevent suspend */
31 WAKE_LOCK_IDLE, /* Prevent low power idle */
32 WAKE_LOCK_TYPE_COUNT
33};
34
35struct wake_lock {
36#ifdef CONFIG_HAS_WAKELOCK
37 struct list_head link;
38 int flags;
39 const char *name;
40 unsigned long expires;
41#ifdef CONFIG_WAKELOCK_STAT
42 struct {
43 int count;
44 int expire_count;
45 int wakeup_count;
46 ktime_t total_time;
47 ktime_t prevent_suspend_time;
48 ktime_t max_time;
49 ktime_t last_time;
50 } stat;
51#endif
52#endif
53};
54
55#ifdef CONFIG_HAS_WAKELOCK
56
57void wake_lock_init(struct wake_lock *lock, int type, const char *name);
58void wake_lock_destroy(struct wake_lock *lock);
59void wake_lock(struct wake_lock *lock);
60void wake_lock_timeout(struct wake_lock *lock, long timeout);
61void wake_unlock(struct wake_lock *lock);
62
63/* wake_lock_active returns a non-zero value if the wake_lock is currently
64 * locked. If the wake_lock has a timeout, it does not check the timeout
65 * but if the timeout had aready been checked it will return 0.
66 */
67int wake_lock_active(struct wake_lock *lock);
68
69/* has_wake_lock returns 0 if no wake locks of the specified type are active,
70 * and non-zero if one or more wake locks are held. Specifically it returns
71 * -1 if one or more wake locks with no timeout are active or the
72 * number of jiffies until all active wake locks time out.
73 */
74long has_wake_lock(int type);
75
76#else
77
78static inline void wake_lock_init(struct wake_lock *lock, int type,
79 const char *name) {}
80static inline void wake_lock_destroy(struct wake_lock *lock) {}
81static inline void wake_lock(struct wake_lock *lock) {}
82static inline void wake_lock_timeout(struct wake_lock *lock, long timeout) {}
83static inline void wake_unlock(struct wake_lock *lock) {}
84
85static inline int wake_lock_active(struct wake_lock *lock) { return 0; }
86static inline long has_wake_lock(int type) { return 0; }
87
88#endif
89
90#endif
91
diff --git a/include/linux/watchdog.h b/include/linux/watchdog.h
index 011bcfeb9f0..111843f88b2 100644
--- a/include/linux/watchdog.h
+++ b/include/linux/watchdog.h
@@ -59,6 +59,84 @@ struct watchdog_info {
59#define WATCHDOG_NOWAYOUT 0 59#define WATCHDOG_NOWAYOUT 0
60#endif 60#endif
61 61
62struct watchdog_ops;
63struct watchdog_device;
64
65/** struct watchdog_ops - The watchdog-devices operations
66 *
67 * @owner: The module owner.
68 * @start: The routine for starting the watchdog device.
69 * @stop: The routine for stopping the watchdog device.
70 * @ping: The routine that sends a keepalive ping to the watchdog device.
71 * @status: The routine that shows the status of the watchdog device.
72 * @set_timeout:The routine for setting the watchdog devices timeout value.
73 * @ioctl: The routines that handles extra ioctl calls.
74 *
75 * The watchdog_ops structure contains a list of low-level operations
76 * that control a watchdog device. It also contains the module that owns
77 * these operations. The start and stop function are mandatory, all other
78 * functions are optonal.
79 */
80struct watchdog_ops {
81 struct module *owner;
82 /* mandatory operations */
83 int (*start)(struct watchdog_device *);
84 int (*stop)(struct watchdog_device *);
85 /* optional operations */
86 int (*ping)(struct watchdog_device *);
87 unsigned int (*status)(struct watchdog_device *);
88 int (*set_timeout)(struct watchdog_device *, unsigned int);
89 long (*ioctl)(struct watchdog_device *, unsigned int, unsigned long);
90};
91
92/** struct watchdog_device - The structure that defines a watchdog device
93 *
94 * @info: Pointer to a watchdog_info structure.
95 * @ops: Pointer to the list of watchdog operations.
96 * @bootstatus: Status of the watchdog device at boot.
97 * @timeout: The watchdog devices timeout value.
98 * @min_timeout:The watchdog devices minimum timeout value.
99 * @max_timeout:The watchdog devices maximum timeout value.
100 * @driver-data:Pointer to the drivers private data.
101 * @status: Field that contains the devices internal status bits.
102 *
103 * The watchdog_device structure contains all information about a
104 * watchdog timer device.
105 *
106 * The driver-data field may not be accessed directly. It must be accessed
107 * via the watchdog_set_drvdata and watchdog_get_drvdata helpers.
108 */
109struct watchdog_device {
110 const struct watchdog_info *info;
111 const struct watchdog_ops *ops;
112 unsigned int bootstatus;
113 unsigned int timeout;
114 unsigned int min_timeout;
115 unsigned int max_timeout;
116 void *driver_data;
117 unsigned long status;
118/* Bit numbers for status flags */
119#define WDOG_ACTIVE 0 /* Is the watchdog running/active */
120#define WDOG_DEV_OPEN 1 /* Opened via /dev/watchdog ? */
121#define WDOG_ALLOW_RELEASE 2 /* Did we receive the magic char ? */
122#define WDOG_NO_WAY_OUT 3 /* Is 'nowayout' feature set ? */
123};
124
125/* Use the following functions to manipulate watchdog driver specific data */
126static inline void watchdog_set_drvdata(struct watchdog_device *wdd, void *data)
127{
128 wdd->driver_data = data;
129}
130
131static inline void *watchdog_get_drvdata(struct watchdog_device *wdd)
132{
133 return wdd->driver_data;
134}
135
136/* drivers/watchdog/core/watchdog_core.c */
137extern int watchdog_register_device(struct watchdog_device *);
138extern void watchdog_unregister_device(struct watchdog_device *);
139
62#endif /* __KERNEL__ */ 140#endif /* __KERNEL__ */
63 141
64#endif /* ifndef _LINUX_WATCHDOG_H */ 142#endif /* ifndef _LINUX_WATCHDOG_H */
diff --git a/include/linux/wifi_tiwlan.h b/include/linux/wifi_tiwlan.h
new file mode 100644
index 00000000000..f07e0679fb8
--- /dev/null
+++ b/include/linux/wifi_tiwlan.h
@@ -0,0 +1,27 @@
1/* include/linux/wifi_tiwlan.h
2 *
3 * Copyright (C) 2008 Google, Inc.
4 *
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
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 */
15#ifndef _LINUX_WIFI_TIWLAN_H_
16#define _LINUX_WIFI_TIWLAN_H_
17
18#include <linux/wlan_plat.h>
19
20#define WMPA_NUMBER_OF_SECTIONS 3
21#define WMPA_NUMBER_OF_BUFFERS 160
22#define WMPA_SECTION_HEADER 24
23#define WMPA_SECTION_SIZE_0 (WMPA_NUMBER_OF_BUFFERS * 64)
24#define WMPA_SECTION_SIZE_1 (WMPA_NUMBER_OF_BUFFERS * 256)
25#define WMPA_SECTION_SIZE_2 (WMPA_NUMBER_OF_BUFFERS * 2048)
26
27#endif
diff --git a/include/linux/wl127x-rfkill.h b/include/linux/wl127x-rfkill.h
new file mode 100644
index 00000000000..9057ec63d5d
--- /dev/null
+++ b/include/linux/wl127x-rfkill.h
@@ -0,0 +1,35 @@
1/*
2 * Bluetooth TI wl127x rfkill power control via GPIO
3 *
4 * Copyright (C) 2009 Motorola, Inc.
5 * Copyright (C) 2008 Texas Instruments
6 * Initial code: Pavan Savoy <pavan.savoy@gmail.com> (wl127x_power.c)
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 *
22 */
23
24#ifndef _LINUX_WL127X_RFKILL_H
25#define _LINUX_WL127X_RFKILL_H
26
27#include <linux/rfkill.h>
28
29struct wl127x_rfkill_platform_data {
30 int nshutdown_gpio;
31
32 struct rfkill *rfkill; /* for driver only */
33};
34
35#endif
diff --git a/include/linux/wl12xx.h b/include/linux/wl12xx.h
index 4b697395326..0f559ae411c 100644
--- a/include/linux/wl12xx.h
+++ b/include/linux/wl12xx.h
@@ -34,6 +34,7 @@ enum {
34 WL12XX_REFCLOCK_26_XTAL = 5, /* 26 MHz, XTAL */ 34 WL12XX_REFCLOCK_26_XTAL = 5, /* 26 MHz, XTAL */
35}; 35};
36 36
37
37/* TCXO clock values */ 38/* TCXO clock values */
38enum { 39enum {
39 WL12XX_TCXOCLOCK_19_2 = 0, /* 19.2MHz */ 40 WL12XX_TCXOCLOCK_19_2 = 0, /* 19.2MHz */
@@ -48,6 +49,7 @@ enum {
48 49
49struct wl12xx_platform_data { 50struct wl12xx_platform_data {
50 void (*set_power)(bool enable); 51 void (*set_power)(bool enable);
52 void (*set_carddetect)(bool enable);
51 /* SDIO only: IRQ number if WLAN_IRQ line is used, 0 for SDIO IRQs */ 53 /* SDIO only: IRQ number if WLAN_IRQ line is used, 0 for SDIO IRQs */
52 int irq; 54 int irq;
53 bool use_eeprom; 55 bool use_eeprom;
diff --git a/include/linux/wlan_plat.h b/include/linux/wlan_plat.h
new file mode 100644
index 00000000000..40ec3482d1e
--- /dev/null
+++ b/include/linux/wlan_plat.h
@@ -0,0 +1,27 @@
1/* include/linux/wlan_plat.h
2 *
3 * Copyright (C) 2010 Google, Inc.
4 *
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
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 */
15#ifndef _LINUX_WLAN_PLAT_H_
16#define _LINUX_WLAN_PLAT_H_
17
18struct wifi_platform_data {
19 int (*set_power)(int val);
20 int (*set_reset)(int val);
21 int (*set_carddetect)(int val);
22 void *(*mem_prealloc)(int section, unsigned long size);
23 int (*get_mac_addr)(unsigned char *buf);
24 void *(*get_country_code)(char *ccode);
25};
26
27#endif
diff --git a/include/linux/wm97xx.h b/include/linux/wm97xx.h
index 38e8c4d9289..fd98bb96821 100644
--- a/include/linux/wm97xx.h
+++ b/include/linux/wm97xx.h
@@ -38,7 +38,11 @@
38#define WM97XX_ADCSEL_X 0x1000 /* x coord measurement */ 38#define WM97XX_ADCSEL_X 0x1000 /* x coord measurement */
39#define WM97XX_ADCSEL_Y 0x2000 /* y coord measurement */ 39#define WM97XX_ADCSEL_Y 0x2000 /* y coord measurement */
40#define WM97XX_ADCSEL_PRES 0x3000 /* pressure measurement */ 40#define WM97XX_ADCSEL_PRES 0x3000 /* pressure measurement */
41#define WM97XX_ADCSEL_MASK 0x7000 41#define WM97XX_AUX_ID1 0x4000
42#define WM97XX_AUX_ID2 0x5000
43#define WM97XX_AUX_ID3 0x6000
44#define WM97XX_AUX_ID4 0x7000
45#define WM97XX_ADCSEL_MASK 0x7000 /* ADC selection mask */
42#define WM97XX_COO 0x0800 /* enable coordinate mode */ 46#define WM97XX_COO 0x0800 /* enable coordinate mode */
43#define WM97XX_CTC 0x0400 /* enable continuous mode */ 47#define WM97XX_CTC 0x0400 /* enable continuous mode */
44#define WM97XX_CM_RATE_93 0x0000 /* 93.75Hz continuous rate */ 48#define WM97XX_CM_RATE_93 0x0000 /* 93.75Hz continuous rate */
@@ -61,13 +65,6 @@
61#define WM97XX_PRP_DET_DIG 0xc000 /* setect on, digitise on */ 65#define WM97XX_PRP_DET_DIG 0xc000 /* setect on, digitise on */
62#define WM97XX_RPR 0x2000 /* wake up on pen down */ 66#define WM97XX_RPR 0x2000 /* wake up on pen down */
63#define WM97XX_PEN_DOWN 0x8000 /* pen is down */ 67#define WM97XX_PEN_DOWN 0x8000 /* pen is down */
64#define WM97XX_ADCSRC_MASK 0x7000 /* ADC source mask */
65
66#define WM97XX_AUX_ID1 0x8001
67#define WM97XX_AUX_ID2 0x8002
68#define WM97XX_AUX_ID3 0x8003
69#define WM97XX_AUX_ID4 0x8004
70
71 68
72/* WM9712 Bits */ 69/* WM9712 Bits */
73#define WM9712_45W 0x1000 /* set for 5-wire touchscreen */ 70#define WM9712_45W 0x1000 /* set for 5-wire touchscreen */
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
index f584aba78ca..0d556deb497 100644
--- a/include/linux/workqueue.h
+++ b/include/linux/workqueue.h
@@ -10,7 +10,7 @@
10#include <linux/bitops.h> 10#include <linux/bitops.h>
11#include <linux/lockdep.h> 11#include <linux/lockdep.h>
12#include <linux/threads.h> 12#include <linux/threads.h>
13#include <asm/atomic.h> 13#include <linux/atomic.h>
14 14
15struct workqueue_struct; 15struct workqueue_struct;
16 16
@@ -255,7 +255,7 @@ enum {
255 WQ_HIGHPRI = 1 << 4, /* high priority */ 255 WQ_HIGHPRI = 1 << 4, /* high priority */
256 WQ_CPU_INTENSIVE = 1 << 5, /* cpu instensive workqueue */ 256 WQ_CPU_INTENSIVE = 1 << 5, /* cpu instensive workqueue */
257 257
258 WQ_DYING = 1 << 6, /* internal: workqueue is dying */ 258 WQ_DRAINING = 1 << 6, /* internal: workqueue is draining */
259 WQ_RESCUER = 1 << 7, /* internal: workqueue has rescuer */ 259 WQ_RESCUER = 1 << 7, /* internal: workqueue has rescuer */
260 260
261 WQ_MAX_ACTIVE = 512, /* I like 512, better ideas? */ 261 WQ_MAX_ACTIVE = 512, /* I like 512, better ideas? */
@@ -355,6 +355,7 @@ extern int queue_delayed_work_on(int cpu, struct workqueue_struct *wq,
355 struct delayed_work *work, unsigned long delay); 355 struct delayed_work *work, unsigned long delay);
356 356
357extern void flush_workqueue(struct workqueue_struct *wq); 357extern void flush_workqueue(struct workqueue_struct *wq);
358extern void drain_workqueue(struct workqueue_struct *wq);
358extern void flush_scheduled_work(void); 359extern void flush_scheduled_work(void);
359 360
360extern int schedule_work(struct work_struct *work); 361extern int schedule_work(struct work_struct *work);
@@ -412,21 +413,6 @@ static inline bool __cancel_delayed_work(struct delayed_work *work)
412 return ret; 413 return ret;
413} 414}
414 415
415/* Obsolete. use cancel_delayed_work_sync() */
416static inline __deprecated
417void cancel_rearming_delayed_workqueue(struct workqueue_struct *wq,
418 struct delayed_work *work)
419{
420 cancel_delayed_work_sync(work);
421}
422
423/* Obsolete. use cancel_delayed_work_sync() */
424static inline __deprecated
425void cancel_rearming_delayed_work(struct delayed_work *work)
426{
427 cancel_delayed_work_sync(work);
428}
429
430#ifndef CONFIG_SMP 416#ifndef CONFIG_SMP
431static inline long work_on_cpu(unsigned int cpu, long (*fn)(void *), void *arg) 417static inline long work_on_cpu(unsigned int cpu, long (*fn)(void *), void *arg)
432{ 418{
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index 17e7ccc322a..2b8963ff0f3 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -7,9 +7,28 @@
7#include <linux/sched.h> 7#include <linux/sched.h>
8#include <linux/fs.h> 8#include <linux/fs.h>
9 9
10struct backing_dev_info; 10/*
11 * The 1/4 region under the global dirty thresh is for smooth dirty throttling:
12 *
13 * (thresh - thresh/DIRTY_FULL_SCOPE, thresh)
14 *
15 * Further beyond, all dirtier tasks will enter a loop waiting (possibly long
16 * time) for the dirty pages to drop, unless written enough pages.
17 *
18 * The global dirty threshold is normally equal to the global dirty limit,
19 * except when the system suddenly allocates a lot of anonymous memory and
20 * knocks down the global dirty threshold quickly, in which case the global
21 * dirty limit will follow down slowly to prevent livelocking all dirtier tasks.
22 */
23#define DIRTY_SCOPE 8
24#define DIRTY_FULL_SCOPE (DIRTY_SCOPE / 2)
11 25
12extern spinlock_t inode_wb_list_lock; 26/*
27 * 4MB minimal write chunk size
28 */
29#define MIN_WRITEBACK_PAGES (4096UL >> (PAGE_CACHE_SHIFT - 10))
30
31struct backing_dev_info;
13 32
14/* 33/*
15 * fs/fs-writeback.c 34 * fs/fs-writeback.c
@@ -26,11 +45,6 @@ enum writeback_sync_modes {
26 */ 45 */
27struct writeback_control { 46struct writeback_control {
28 enum writeback_sync_modes sync_mode; 47 enum writeback_sync_modes sync_mode;
29 unsigned long *older_than_this; /* If !NULL, only write back inodes
30 older than this */
31 unsigned long wb_start; /* Time writeback_inodes_wb was
32 called. This is needed to avoid
33 extra jobs and livelock */
34 long nr_to_write; /* Write this many pages, and decrement 48 long nr_to_write; /* Write this many pages, and decrement
35 this for each page written */ 49 this for each page written */
36 long pages_skipped; /* Pages which were not written */ 50 long pages_skipped; /* Pages which were not written */
@@ -43,13 +57,11 @@ struct writeback_control {
43 loff_t range_start; 57 loff_t range_start;
44 loff_t range_end; 58 loff_t range_end;
45 59
46 unsigned nonblocking:1; /* Don't get stuck on request queues */
47 unsigned encountered_congestion:1; /* An output: a queue is full */
48 unsigned for_kupdate:1; /* A kupdate writeback */ 60 unsigned for_kupdate:1; /* A kupdate writeback */
49 unsigned for_background:1; /* A background writeback */ 61 unsigned for_background:1; /* A background writeback */
62 unsigned tagged_writepages:1; /* tag-and-write to avoid livelock */
50 unsigned for_reclaim:1; /* Invoked from the page allocator */ 63 unsigned for_reclaim:1; /* Invoked from the page allocator */
51 unsigned range_cyclic:1; /* range_start is cyclic */ 64 unsigned range_cyclic:1; /* range_start is cyclic */
52 unsigned more_io:1; /* more io to be dispatched */
53}; 65};
54 66
55/* 67/*
@@ -62,8 +74,7 @@ void writeback_inodes_sb_nr(struct super_block *, unsigned long nr);
62int writeback_inodes_sb_if_idle(struct super_block *); 74int writeback_inodes_sb_if_idle(struct super_block *);
63int writeback_inodes_sb_nr_if_idle(struct super_block *, unsigned long nr); 75int writeback_inodes_sb_nr_if_idle(struct super_block *, unsigned long nr);
64void sync_inodes_sb(struct super_block *); 76void sync_inodes_sb(struct super_block *);
65void writeback_inodes_wb(struct bdi_writeback *wb, 77long writeback_inodes_wb(struct bdi_writeback *wb, long nr_pages);
66 struct writeback_control *wbc);
67long wb_do_writeback(struct bdi_writeback *wb, int force_wait); 78long wb_do_writeback(struct bdi_writeback *wb, int force_wait);
68void wakeup_flusher_threads(long nr_pages); 79void wakeup_flusher_threads(long nr_pages);
69 80
@@ -94,6 +105,8 @@ static inline void laptop_sync_completion(void) { }
94#endif 105#endif
95void throttle_vm_writeout(gfp_t gfp_mask); 106void throttle_vm_writeout(gfp_t gfp_mask);
96 107
108extern unsigned long global_dirty_limit;
109
97/* These are exported to sysctl. */ 110/* These are exported to sysctl. */
98extern int dirty_background_ratio; 111extern int dirty_background_ratio;
99extern unsigned long dirty_background_bytes; 112extern unsigned long dirty_background_bytes;
@@ -128,6 +141,13 @@ void global_dirty_limits(unsigned long *pbackground, unsigned long *pdirty);
128unsigned long bdi_dirty_limit(struct backing_dev_info *bdi, 141unsigned long bdi_dirty_limit(struct backing_dev_info *bdi,
129 unsigned long dirty); 142 unsigned long dirty);
130 143
144void __bdi_update_bandwidth(struct backing_dev_info *bdi,
145 unsigned long thresh,
146 unsigned long dirty,
147 unsigned long bdi_thresh,
148 unsigned long bdi_dirty,
149 unsigned long start_time);
150
131void page_writeback_init(void); 151void page_writeback_init(void);
132void balance_dirty_pages_ratelimited_nr(struct address_space *mapping, 152void balance_dirty_pages_ratelimited_nr(struct address_space *mapping,
133 unsigned long nr_pages_dirtied); 153 unsigned long nr_pages_dirtied);
diff --git a/include/linux/zorro.h b/include/linux/zorro.h
index 7bf9db525e9..dff42025649 100644
--- a/include/linux/zorro.h
+++ b/include/linux/zorro.h
@@ -187,7 +187,7 @@ extern struct zorro_dev *zorro_find_device(zorro_id id,
187 187
188#define zorro_resource_start(z) ((z)->resource.start) 188#define zorro_resource_start(z) ((z)->resource.start)
189#define zorro_resource_end(z) ((z)->resource.end) 189#define zorro_resource_end(z) ((z)->resource.end)
190#define zorro_resource_len(z) ((z)->resource.end-(z)->resource.start+1) 190#define zorro_resource_len(z) (resource_size(&(z)->resource))
191#define zorro_resource_flags(z) ((z)->resource.flags) 191#define zorro_resource_flags(z) ((z)->resource.flags)
192 192
193#define zorro_request_device(z, name) \ 193#define zorro_request_device(z, name) \