aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/acpi/acpi_bus.h36
-rw-r--r--include/acpi/actypes.h7
-rw-r--r--include/asm-generic/dma-coherent.h4
-rw-r--r--include/asm-generic/dma-contiguous.h28
-rw-r--r--include/asm-generic/gpio.h6
-rw-r--r--include/asm-generic/kvm_para.h22
-rw-r--r--include/asm-generic/pci-bridge.h6
-rw-r--r--include/asm-generic/pgtable.h5
-rw-r--r--include/asm-generic/siginfo.h22
-rw-r--r--include/asm-generic/statfs.h2
-rw-r--r--include/asm-generic/syscall.h14
-rw-r--r--include/asm-generic/vmlinux.lds.h2
-rw-r--r--include/asm-generic/word-at-a-time.h52
-rw-r--r--include/drm/drm.h6
-rw-r--r--include/drm/drmP.h19
-rw-r--r--include/drm/drm_crtc.h86
-rw-r--r--include/drm/drm_crtc_helper.h23
-rw-r--r--include/drm/drm_dp_helper.h8
-rw-r--r--include/drm/drm_edid.h26
-rw-r--r--include/drm/drm_fixed.h1
-rw-r--r--include/drm/drm_mode.h16
-rw-r--r--include/drm/exynos_drm.h99
-rw-r--r--include/drm/i915_drm.h3
-rw-r--r--include/drm/radeon_drm.h1
-rw-r--r--include/drm/ttm/ttm_bo_api.h9
-rw-r--r--include/drm/ttm/ttm_bo_driver.h2
-rw-r--r--include/keys/keyring-type.h2
-rw-r--r--include/linux/Kbuild7
-rw-r--r--include/linux/alarmtimer.h3
-rw-r--r--include/linux/amba/bus.h8
-rw-r--r--include/linux/amba/pl08x.h3
-rw-r--r--include/linux/atmlec.h7
-rw-r--r--include/linux/audit.h8
-rw-r--r--include/linux/basic_mmio_gpio.h6
-rw-r--r--include/linux/bcma/bcma.h8
-rw-r--r--include/linux/bcma/bcma_driver_pci.h11
-rw-r--r--include/linux/blkdev.h3
-rw-r--r--include/linux/bootmem.h3
-rw-r--r--include/linux/capability.h7
-rw-r--r--include/linux/cgroup.h81
-rw-r--r--include/linux/clk-private.h99
-rw-r--r--include/linux/clk-provider.h120
-rw-r--r--include/linux/clk.h38
-rw-r--r--include/linux/clkdev.h3
-rw-r--r--include/linux/cpu.h2
-rw-r--r--include/linux/cred.h33
-rw-r--r--include/linux/cs5535.h1
-rw-r--r--include/linux/dcache.h21
-rw-r--r--include/linux/dcbnl.h12
-rw-r--r--include/linux/dccp.h2
-rw-r--r--include/linux/debugfs.h11
-rw-r--r--include/linux/device.h38
-rw-r--r--include/linux/dlm.h1
-rw-r--r--include/linux/dma-buf.h33
-rw-r--r--include/linux/dma-contiguous.h110
-rw-r--r--include/linux/dmaengine.h6
-rw-r--r--include/linux/dmar.h85
-rw-r--r--include/linux/dvb/frontend.h51
-rw-r--r--include/linux/dvb/version.h2
-rw-r--r--include/linux/dynamic_debug.h22
-rw-r--r--include/linux/efi.h13
-rw-r--r--include/linux/etherdevice.h65
-rw-r--r--include/linux/ethtool.h69
-rw-r--r--include/linux/eventpoll.h12
-rw-r--r--include/linux/extcon.h324
-rw-r--r--include/linux/extcon/extcon_gpio.h52
-rw-r--r--include/linux/filter.h19
-rw-r--r--include/linux/firewire.h17
-rw-r--r--include/linux/fixp-arith.h87
-rw-r--r--include/linux/fs.h56
-rw-r--r--include/linux/fsl/mxs-dma.h12
-rw-r--r--include/linux/fsl_devices.h9
-rw-r--r--include/linux/ftrace.h19
-rw-r--r--include/linux/ftrace_event.h2
-rw-r--r--include/linux/gameport.h13
-rw-r--r--include/linux/generic_serial.h64
-rw-r--r--include/linux/genhd.h6
-rw-r--r--include/linux/gfp.h12
-rw-r--r--include/linux/gpio.h59
-rw-r--r--include/linux/hid.h36
-rw-r--r--include/linux/hidraw.h4
-rw-r--r--include/linux/hugetlb.h8
-rw-r--r--include/linux/hyperv.h31
-rw-r--r--include/linux/i2c-mux-gpio.h (renamed from include/linux/gpio-i2cmux.h)14
-rw-r--r--include/linux/i2c-mux.h3
-rw-r--r--include/linux/i2c-pnx.h10
-rw-r--r--include/linux/i2c.h1
-rw-r--r--include/linux/i2c/adp5588.h1
-rw-r--r--include/linux/i2c/twl.h5
-rw-r--r--include/linux/i2o-dev.h2
-rw-r--r--include/linux/ibmtr.h373
-rw-r--r--include/linux/ieee80211.h36
-rw-r--r--include/linux/if_arp.h1
-rw-r--r--include/linux/if_ec.h68
-rw-r--r--include/linux/if_link.h5
-rw-r--r--include/linux/if_macvlan.h1
-rw-r--r--include/linux/if_pppol2tp.h28
-rw-r--r--include/linux/if_pppox.h20
-rw-r--r--include/linux/if_team.h67
-rw-r--r--include/linux/if_tr.h103
-rw-r--r--include/linux/iio/buffer.h191
-rw-r--r--include/linux/iio/consumer.h96
-rw-r--r--include/linux/iio/driver.h34
-rw-r--r--include/linux/iio/events.h105
-rw-r--r--include/linux/iio/iio.h492
-rw-r--r--include/linux/iio/kfifo_buf.h8
-rw-r--r--include/linux/iio/machine.h24
-rw-r--r--include/linux/iio/sysfs.h117
-rw-r--r--include/linux/iio/trigger.h119
-rw-r--r--include/linux/iio/trigger_consumer.h52
-rw-r--r--include/linux/iio/types.h55
-rw-r--r--include/linux/in6.h2
-rw-r--r--include/linux/input/lm8333.h24
-rw-r--r--include/linux/input/matrix_keypad.h54
-rw-r--r--include/linux/input/navpoint.h12
-rw-r--r--include/linux/interrupt.h8
-rw-r--r--include/linux/ioport.h7
-rw-r--r--include/linux/ip_vs.h17
-rw-r--r--include/linux/irq.h5
-rw-r--r--include/linux/irqdomain.h3
-rw-r--r--include/linux/isdn.h26
-rw-r--r--include/linux/jbd.h18
-rw-r--r--include/linux/kernel.h15
-rw-r--r--include/linux/key.h11
-rw-r--r--include/linux/keyctl.h1
-rw-r--r--include/linux/kvm.h42
-rw-r--r--include/linux/kvm_host.h55
-rw-r--r--include/linux/l2tp.h19
-rw-r--r--include/linux/libata.h4
-rw-r--r--include/linux/lockdep.h18
-rw-r--r--include/linux/lsm_audit.h6
-rw-r--r--include/linux/mISDNhw.h25
-rw-r--r--include/linux/mISDNif.h16
-rw-r--r--include/linux/mca-legacy.h66
-rw-r--r--include/linux/mca.h148
-rw-r--r--include/linux/mdio-mux.h21
-rw-r--r--include/linux/mei.h110
-rw-r--r--include/linux/mfd/abx500.h5
-rw-r--r--include/linux/mfd/abx500/ab5500.h140
-rw-r--r--include/linux/mfd/asic3.h1
-rw-r--r--include/linux/mfd/da9052/da9052.h1
-rw-r--r--include/linux/mfd/db5500-prcmu.h105
-rw-r--r--include/linux/mfd/dbx500-prcmu.h242
-rw-r--r--include/linux/mfd/max8997.h23
-rw-r--r--include/linux/mfd/mc13xxx.h11
-rw-r--r--include/linux/mfd/palmas.h2620
-rw-r--r--include/linux/mfd/rc5t583.h31
-rw-r--r--include/linux/mfd/s5m87xx/s5m-core.h1
-rw-r--r--include/linux/mfd/s5m87xx/s5m-pmic.h29
-rw-r--r--include/linux/mfd/tps65090.h13
-rw-r--r--include/linux/mfd/tps6586x.h1
-rw-r--r--include/linux/mfd/wm831x/pdata.h2
-rw-r--r--include/linux/mfd/wm8994/core.h12
-rw-r--r--include/linux/micrel_phy.h2
-rw-r--r--include/linux/mlx4/cmd.h4
-rw-r--r--include/linux/mlx4/device.h11
-rw-r--r--include/linux/mlx4/qp.h6
-rw-r--r--include/linux/mm.h6
-rw-r--r--include/linux/mm_types.h2
-rw-r--r--include/linux/mmc/card.h4
-rw-r--r--include/linux/mmc/dw_mmc.h1
-rw-r--r--include/linux/mmc/host.h2
-rw-r--r--include/linux/mmc/mmc.h60
-rw-r--r--include/linux/mmc/mxs-mmc.h19
-rw-r--r--include/linux/mmzone.h49
-rw-r--r--include/linux/mod_devicetable.h4
-rw-r--r--include/linux/moduleparam.h3
-rw-r--r--include/linux/mtd/ubi.h31
-rw-r--r--include/linux/mv643xx_eth.h1
-rw-r--r--include/linux/neighbour.h3
-rw-r--r--include/linux/net.h23
-rw-r--r--include/linux/netdevice.h52
-rw-r--r--include/linux/netfilter.h6
-rw-r--r--include/linux/netfilter/ipset/ip_set.h54
-rw-r--r--include/linux/netfilter/ipset/ip_set_ahash.h37
-rw-r--r--include/linux/netfilter/ipset/ip_set_timeout.h4
-rw-r--r--include/linux/netfilter/nf_conntrack_common.h4
-rw-r--r--include/linux/netfilter/nf_conntrack_h323_types.h12
-rw-r--r--include/linux/netfilter/nfnetlink.h2
-rw-r--r--include/linux/netfilter/xt_HMARK.h45
-rw-r--r--include/linux/netfilter/xt_hashlimit.h12
-rw-r--r--include/linux/netfilter_bridge.h9
-rw-r--r--include/linux/netfilter_ipv4/Kbuild1
-rw-r--r--include/linux/netfilter_ipv4/ip_queue.h72
-rw-r--r--include/linux/netfilter_ipv6/ip6_tables.h7
-rw-r--r--include/linux/netlink.h2
-rw-r--r--include/linux/nfc.h1
-rw-r--r--include/linux/nfc/pn544.h7
-rw-r--r--include/linux/nfs4.h13
-rw-r--r--include/linux/nfs_fs.h31
-rw-r--r--include/linux/nfs_fs_sb.h17
-rw-r--r--include/linux/nfs_page.h20
-rw-r--r--include/linux/nfs_xdr.h210
-rw-r--r--include/linux/nl80211.h52
-rw-r--r--include/linux/nl802154.h20
-rw-r--r--include/linux/of.h51
-rw-r--r--include/linux/of_gpio.h1
-rw-r--r--include/linux/of_i2c.h4
-rw-r--r--include/linux/of_irq.h12
-rw-r--r--include/linux/of_mdio.h2
-rw-r--r--include/linux/of_serial.h17
-rw-r--r--include/linux/of_spi.h23
-rw-r--r--include/linux/page-isolation.h18
-rw-r--r--include/linux/pagemap.h64
-rw-r--r--include/linux/pci.h9
-rw-r--r--include/linux/percpu.h54
-rw-r--r--include/linux/perf_event.h5
-rw-r--r--include/linux/phy.h4
-rw-r--r--include/linux/pid_namespace.h2
-rw-r--r--include/linux/pinctrl/consumer.h44
-rw-r--r--include/linux/pinctrl/machine.h7
-rw-r--r--include/linux/pinctrl/pinconf.h6
-rw-r--r--include/linux/pinctrl/pinctrl-state.h13
-rw-r--r--include/linux/pinctrl/pinctrl.h22
-rw-r--r--include/linux/pinctrl/pinmux.h9
-rw-r--r--include/linux/pkt_sched.h81
-rw-r--r--include/linux/platform_data/at91_adc.h61
-rw-r--r--include/linux/platform_data/ehci-sh.h28
-rw-r--r--include/linux/platform_data/emif_plat.h128
-rw-r--r--include/linux/platform_data/gpio-em.h10
-rw-r--r--include/linux/platform_data/ina2xx.h19
-rw-r--r--include/linux/platform_data/s3c-hsotg.h35
-rw-r--r--include/linux/platform_data/tegra_usb.h1
-rw-r--r--include/linux/platform_data/wiznet.h24
-rw-r--r--include/linux/pm.h2
-rw-r--r--include/linux/pm_domain.h13
-rw-r--r--include/linux/pm_runtime.h3
-rw-r--r--include/linux/pm_wakeup.h15
-rw-r--r--include/linux/prctl.h15
-rw-r--r--include/linux/printk.h13
-rw-r--r--include/linux/proc_fs.h4
-rw-r--r--include/linux/pstore_ram.h98
-rw-r--r--include/linux/ptp_clock_kernel.h8
-rw-r--r--include/linux/ptrace.h5
-rw-r--r--include/linux/quotaops.h4
-rw-r--r--include/linux/raid/md_p.h15
-rw-r--r--include/linux/raid/pq.h18
-rw-r--r--include/linux/ramoops.h17
-rw-r--r--include/linux/rational.h2
-rw-r--r--include/linux/rculist.h40
-rw-r--r--include/linux/rcupdate.h20
-rw-r--r--include/linux/rcutiny.h11
-rw-r--r--include/linux/rcutree.h19
-rw-r--r--include/linux/regmap.h44
-rw-r--r--include/linux/regulator/driver.h73
-rw-r--r--include/linux/regulator/fixed.h7
-rw-r--r--include/linux/regulator/of_regulator.h18
-rw-r--r--include/linux/regulator/tps62360.h6
-rw-r--r--include/linux/regulator/tps65090-regulator.h50
-rw-r--r--include/linux/res_counter.h2
-rw-r--r--include/linux/ring_buffer.h6
-rw-r--r--include/linux/rndis.h390
-rw-r--r--include/linux/rtnetlink.h4
-rw-r--r--include/linux/sched.h76
-rw-r--r--include/linux/seccomp.h107
-rw-r--r--include/linux/security.h14
-rw-r--r--include/linux/seqlock.h23
-rw-r--r--include/linux/serial.h2
-rw-r--r--include/linux/serial_8250.h3
-rw-r--r--include/linux/serial_core.h5
-rw-r--r--include/linux/serial_sci.h2
-rw-r--r--include/linux/serio.h13
-rw-r--r--include/linux/sh_clk.h34
-rw-r--r--include/linux/sh_intc.h1
-rw-r--r--include/linux/shmem_fs.h4
-rw-r--r--include/linux/signal.h1
-rw-r--r--include/linux/skbuff.h119
-rw-r--r--include/linux/smp.h6
-rw-r--r--include/linux/sock_diag.h4
-rw-r--r--include/linux/socket.h4
-rw-r--r--include/linux/spi/eeprom.h10
-rw-r--r--include/linux/spi/orion_spi.h17
-rw-r--r--include/linux/spi/rspi.h31
-rw-r--r--include/linux/srcu.h48
-rw-r--r--include/linux/ssb/ssb.h1
-rw-r--r--include/linux/ssb/ssb_regs.h61
-rw-r--r--include/linux/stat.h5
-rw-r--r--include/linux/stmmac.h57
-rw-r--r--include/linux/stmp_device.h20
-rw-r--r--include/linux/suspend.h14
-rw-r--r--include/linux/sysfs.h12
-rw-r--r--include/linux/tcp.h24
-rw-r--r--include/linux/thread_info.h6
-rw-r--r--include/linux/ti_wilink_st.h2
-rw-r--r--include/linux/time.h1
-rw-r--r--include/linux/topology.h46
-rw-r--r--include/linux/trdevice.h37
-rw-r--r--include/linux/tty.h23
-rw-r--r--include/linux/tty_ldisc.h2
-rw-r--r--include/linux/uidgid.h200
-rw-r--r--include/linux/uprobes.h165
-rw-r--r--include/linux/usb.h79
-rw-r--r--include/linux/usb/ch11.h2
-rw-r--r--include/linux/usb/ch9.h58
-rw-r--r--include/linux/usb/chipidea.h28
-rw-r--r--include/linux/usb/composite.h6
-rw-r--r--include/linux/usb/functionfs.h4
-rw-r--r--include/linux/usb/gpio_vbus.h2
-rw-r--r--include/linux/usb/hcd.h32
-rw-r--r--include/linux/usb/isp1301.h80
-rw-r--r--include/linux/usb/langwell_udc.h310
-rw-r--r--include/linux/usb/rndis_host.h66
-rw-r--r--include/linux/usb/serial.h34
-rw-r--r--include/linux/usb/usbnet.h3
-rw-r--r--include/linux/user_namespace.h39
-rw-r--r--include/linux/uuid.h4
-rw-r--r--include/linux/v4l2-dv-timings.h816
-rw-r--r--include/linux/v4l2-subdev.h41
-rw-r--r--include/linux/vga_switcheroo.h19
-rw-r--r--include/linux/vgaarb.h7
-rw-r--r--include/linux/videodev2.h372
-rw-r--r--include/linux/virtio_config.h11
-rw-r--r--include/linux/virtio_net.h14
-rw-r--r--include/linux/vme.h174
-rw-r--r--include/linux/vt_kern.h1
-rw-r--r--include/linux/writeback.h10
-rw-r--r--include/media/media-entity.h5
-rw-r--r--include/media/mt9p031.h19
-rw-r--r--include/media/omap3isp.h29
-rw-r--r--include/media/rc-map.h3
-rw-r--r--include/media/s5p_fimc.h16
-rw-r--r--include/media/saa7146.h4
-rw-r--r--include/media/saa7146_vv.h25
-rw-r--r--include/media/sh_mobile_ceu.h1
-rw-r--r--include/media/smiapp.h84
-rw-r--r--include/media/soc_camera.h9
-rw-r--r--include/media/soc_mediabus.h21
-rw-r--r--include/media/v4l2-ctrls.h40
-rw-r--r--include/media/v4l2-dev.h25
-rw-r--r--include/media/v4l2-event.h24
-rw-r--r--include/media/v4l2-ioctl.h6
-rw-r--r--include/media/v4l2-subdev.h55
-rw-r--r--include/media/videobuf-dma-contig.h10
-rw-r--r--include/memory/jedec_ddr.h175
-rw-r--r--include/mtd/ubi-user.h34
-rw-r--r--include/net/addrconf.h20
-rw-r--r--include/net/af_unix.h2
-rw-r--r--include/net/ax25.h10
-rw-r--r--include/net/bluetooth/bluetooth.h31
-rw-r--r--include/net/bluetooth/hci.h8
-rw-r--r--include/net/bluetooth/hci_core.h70
-rw-r--r--include/net/bluetooth/l2cap.h93
-rw-r--r--include/net/bluetooth/mgmt.h9
-rw-r--r--include/net/bluetooth/smp.h2
-rw-r--r--include/net/caif/caif_hsi.h19
-rw-r--r--include/net/caif/cfpkt.h9
-rw-r--r--include/net/cfg80211.h66
-rw-r--r--include/net/codel.h342
-rw-r--r--include/net/compat.h8
-rw-r--r--include/net/dcbnl.h2
-rw-r--r--include/net/dn.h2
-rw-r--r--include/net/dn_fib.h6
-rw-r--r--include/net/dn_route.h4
-rw-r--r--include/net/dst.h1
-rw-r--r--include/net/dst_ops.h2
-rw-r--r--include/net/icmp.h3
-rw-r--r--include/net/ieee802154_netdev.h27
-rw-r--r--include/net/if_inet6.h56
-rw-r--r--include/net/inet6_connection_sock.h2
-rw-r--r--include/net/inet_connection_sock.h5
-rw-r--r--include/net/inet_frag.h3
-rw-r--r--include/net/ip.h20
-rw-r--r--include/net/ip6_route.h4
-rw-r--r--include/net/ip_fib.h4
-rw-r--r--include/net/ip_vs.h109
-rw-r--r--include/net/ipip.h2
-rw-r--r--include/net/ipv6.h39
-rw-r--r--include/net/lapb.h6
-rw-r--r--include/net/llc_c_ev.h2
-rw-r--r--include/net/llc_pdu.h7
-rw-r--r--include/net/mac80211.h183
-rw-r--r--include/net/mac802154.h136
-rw-r--r--include/net/ndisc.h1
-rw-r--r--include/net/neighbour.h5
-rw-r--r--include/net/net_namespace.h21
-rw-r--r--include/net/netfilter/nf_conntrack.h10
-rw-r--r--include/net/netfilter/nf_conntrack_helper.h4
-rw-r--r--include/net/netfilter/nf_conntrack_l3proto.h2
-rw-r--r--include/net/netlink.h169
-rw-r--r--include/net/netns/conntrack.h3
-rw-r--r--include/net/netns/hash.h2
-rw-r--r--include/net/netns/ipv6.h4
-rw-r--r--include/net/nfc/hci.h196
-rw-r--r--include/net/nfc/nfc.h27
-rw-r--r--include/net/nfc/shdlc.h106
-rw-r--r--include/net/pkt_sched.h2
-rw-r--r--include/net/rawv6.h2
-rw-r--r--include/net/route.h6
-rw-r--r--include/net/rtnetlink.h11
-rw-r--r--include/net/sctp/sctp.h13
-rw-r--r--include/net/sctp/structs.h8
-rw-r--r--include/net/sock.h190
-rw-r--r--include/net/tcp.h116
-rw-r--r--include/net/tcp_memcontrol.h4
-rw-r--r--include/net/udp.h6
-rw-r--r--include/net/wimax.h4
-rw-r--r--include/net/wpan-phy.h10
-rw-r--r--include/net/x25.h2
-rw-r--r--include/net/xfrm.h17
-rw-r--r--include/rdma/ib_mad.h2
-rw-r--r--include/rdma/ib_verbs.h4
-rw-r--r--include/scsi/iscsi_proto.h2
-rw-r--r--include/scsi/libsas.h40
-rw-r--r--include/scsi/sas.h1
-rw-r--r--include/scsi/sas_ata.h4
-rw-r--r--include/sound/asound.h14
-rw-r--r--include/sound/asoundef.h41
-rw-r--r--include/sound/cs42l52.h36
-rw-r--r--include/sound/max98095.h12
-rw-r--r--include/sound/sh_fsi.h18
-rw-r--r--include/sound/simple_card.h38
-rw-r--r--include/sound/soc-dai.h4
-rw-r--r--include/sound/soc-dapm.h28
-rw-r--r--include/sound/soc-dpcm.h138
-rw-r--r--include/sound/soc.h118
-rw-r--r--include/target/target_core_backend.h16
-rw-r--r--include/target/target_core_base.h59
-rw-r--r--include/target/target_core_fabric.h11
-rw-r--r--include/trace/events/asoc.h80
-rw-r--r--include/trace/events/ext3.h4
-rw-r--r--include/trace/events/ext4.h4
-rw-r--r--include/trace/events/jbd.h39
-rw-r--r--include/trace/events/power.h34
-rw-r--r--include/trace/events/rcu.h2
-rw-r--r--include/trace/events/workqueue.h2
-rw-r--r--include/trace/events/writeback.h36
-rw-r--r--include/video/omap-panel-nokia-dsi.h3
-rw-r--r--include/video/omap-panel-tfp410.h (renamed from include/video/omap-panel-dvi.h)18
-rw-r--r--include/video/omapdss.h28
-rw-r--r--include/video/vga.h22
-rw-r--r--include/xen/acpi.h58
-rw-r--r--include/xen/events.h3
-rw-r--r--include/xen/grant_table.h2
-rw-r--r--include/xen/xenbus_dev.h3
434 files changed, 14103 insertions, 4012 deletions
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index f1c8ca60e824..b0d62820ada1 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -51,6 +51,37 @@ acpi_evaluate_reference(acpi_handle handle,
51 struct acpi_object_list *arguments, 51 struct acpi_object_list *arguments,
52 struct acpi_handle_list *list); 52 struct acpi_handle_list *list);
53 53
54struct acpi_pld {
55 unsigned int revision:7; /* 0 */
56 unsigned int ignore_colour:1; /* 7 */
57 unsigned int colour:24; /* 8 */
58 unsigned int width:16; /* 32 */
59 unsigned int height:16; /* 48 */
60 unsigned int user_visible:1; /* 64 */
61 unsigned int dock:1; /* 65 */
62 unsigned int lid:1; /* 66 */
63 unsigned int panel:3; /* 67 */
64 unsigned int vertical_pos:2; /* 70 */
65 unsigned int horizontal_pos:2; /* 72 */
66 unsigned int shape:4; /* 74 */
67 unsigned int group_orientation:1; /* 78 */
68 unsigned int group_token:8; /* 79 */
69 unsigned int group_position:8; /* 87 */
70 unsigned int bay:1; /* 95 */
71 unsigned int ejectable:1; /* 96 */
72 unsigned int ospm_eject_required:1; /* 97 */
73 unsigned int cabinet_number:8; /* 98 */
74 unsigned int card_cage_number:8; /* 106 */
75 unsigned int reference:1; /* 114 */
76 unsigned int rotation:4; /* 115 */
77 unsigned int order:5; /* 119 */
78 unsigned int reserved:4; /* 124 */
79 unsigned int vertical_offset:16; /* 128 */
80 unsigned int horizontal_offset:16; /* 144 */
81} __attribute__((__packed__));
82
83acpi_status
84acpi_get_physical_device_location(acpi_handle handle, struct acpi_pld *pld);
54#ifdef CONFIG_ACPI 85#ifdef CONFIG_ACPI
55 86
56#include <linux/proc_fs.h> 87#include <linux/proc_fs.h>
@@ -407,6 +438,11 @@ static inline int acpi_pm_device_sleep_wake(struct device *dev, bool enable)
407} 438}
408#endif 439#endif
409 440
441#else /* CONFIG_ACPI */
442
443static int register_acpi_bus_type(struct acpi_bus_type *bus) { return 0; }
444static int unregister_acpi_bus_type(struct acpi_bus_type *bus) { return 0; }
445
410#endif /* CONFIG_ACPI */ 446#endif /* CONFIG_ACPI */
411 447
412#endif /*__ACPI_BUS_H__*/ 448#endif /*__ACPI_BUS_H__*/
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
index eba66043cf1b..e8bcc4742e0e 100644
--- a/include/acpi/actypes.h
+++ b/include/acpi/actypes.h
@@ -499,9 +499,10 @@ typedef u64 acpi_integer;
499#define ACPI_STATE_D0 (u8) 0 499#define ACPI_STATE_D0 (u8) 0
500#define ACPI_STATE_D1 (u8) 1 500#define ACPI_STATE_D1 (u8) 1
501#define ACPI_STATE_D2 (u8) 2 501#define ACPI_STATE_D2 (u8) 2
502#define ACPI_STATE_D3 (u8) 3 502#define ACPI_STATE_D3_HOT (u8) 3
503#define ACPI_STATE_D3_COLD (u8) 4 503#define ACPI_STATE_D3 (u8) 4
504#define ACPI_D_STATES_MAX ACPI_STATE_D3_COLD 504#define ACPI_STATE_D3_COLD ACPI_STATE_D3
505#define ACPI_D_STATES_MAX ACPI_STATE_D3
505#define ACPI_D_STATE_COUNT 5 506#define ACPI_D_STATE_COUNT 5
506 507
507#define ACPI_STATE_C0 (u8) 0 508#define ACPI_STATE_C0 (u8) 0
diff --git a/include/asm-generic/dma-coherent.h b/include/asm-generic/dma-coherent.h
index 85a3ffaa0242..abfb2682de7f 100644
--- a/include/asm-generic/dma-coherent.h
+++ b/include/asm-generic/dma-coherent.h
@@ -3,13 +3,15 @@
3 3
4#ifdef CONFIG_HAVE_GENERIC_DMA_COHERENT 4#ifdef CONFIG_HAVE_GENERIC_DMA_COHERENT
5/* 5/*
6 * These two functions are only for dma allocator. 6 * These three functions are only for dma allocator.
7 * Don't use them in device drivers. 7 * Don't use them in device drivers.
8 */ 8 */
9int dma_alloc_from_coherent(struct device *dev, ssize_t size, 9int dma_alloc_from_coherent(struct device *dev, ssize_t size,
10 dma_addr_t *dma_handle, void **ret); 10 dma_addr_t *dma_handle, void **ret);
11int dma_release_from_coherent(struct device *dev, int order, void *vaddr); 11int dma_release_from_coherent(struct device *dev, int order, void *vaddr);
12 12
13int dma_mmap_from_coherent(struct device *dev, struct vm_area_struct *vma,
14 void *cpu_addr, size_t size, int *ret);
13/* 15/*
14 * Standard interface 16 * Standard interface
15 */ 17 */
diff --git a/include/asm-generic/dma-contiguous.h b/include/asm-generic/dma-contiguous.h
new file mode 100644
index 000000000000..c544356b374b
--- /dev/null
+++ b/include/asm-generic/dma-contiguous.h
@@ -0,0 +1,28 @@
1#ifndef ASM_DMA_CONTIGUOUS_H
2#define ASM_DMA_CONTIGUOUS_H
3
4#ifdef __KERNEL__
5#ifdef CONFIG_CMA
6
7#include <linux/device.h>
8#include <linux/dma-contiguous.h>
9
10static inline struct cma *dev_get_cma_area(struct device *dev)
11{
12 if (dev && dev->cma_area)
13 return dev->cma_area;
14 return dma_contiguous_default_area;
15}
16
17static inline void dev_set_cma_area(struct device *dev, struct cma *cma)
18{
19 if (dev)
20 dev->cma_area = cma;
21 if (!dev || !dma_contiguous_default_area)
22 dma_contiguous_default_area = cma;
23}
24
25#endif
26#endif
27
28#endif
diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
index 5f52690c3c8f..365ea09ed3b0 100644
--- a/include/asm-generic/gpio.h
+++ b/include/asm-generic/gpio.h
@@ -142,9 +142,9 @@ extern int __must_check gpiochip_reserve(int start, int ngpio);
142/* add/remove chips */ 142/* add/remove chips */
143extern int gpiochip_add(struct gpio_chip *chip); 143extern int gpiochip_add(struct gpio_chip *chip);
144extern int __must_check gpiochip_remove(struct gpio_chip *chip); 144extern int __must_check gpiochip_remove(struct gpio_chip *chip);
145extern struct gpio_chip *gpiochip_find(const void *data, 145extern struct gpio_chip *gpiochip_find(void *data,
146 int (*match)(struct gpio_chip *chip, 146 int (*match)(struct gpio_chip *chip,
147 const void *data)); 147 void *data));
148 148
149 149
150/* Always use the library code for GPIO management calls, 150/* Always use the library code for GPIO management calls,
@@ -179,6 +179,8 @@ extern void gpio_free_array(const struct gpio *array, size_t num);
179 179
180/* bindings for managed devices that want to request gpios */ 180/* bindings for managed devices that want to request gpios */
181int devm_gpio_request(struct device *dev, unsigned gpio, const char *label); 181int devm_gpio_request(struct device *dev, unsigned gpio, const char *label);
182int devm_gpio_request_one(struct device *dev, unsigned gpio,
183 unsigned long flags, const char *label);
182void devm_gpio_free(struct device *dev, unsigned int gpio); 184void devm_gpio_free(struct device *dev, unsigned int gpio);
183 185
184#ifdef CONFIG_GPIO_SYSFS 186#ifdef CONFIG_GPIO_SYSFS
diff --git a/include/asm-generic/kvm_para.h b/include/asm-generic/kvm_para.h
new file mode 100644
index 000000000000..5cba37f9eae1
--- /dev/null
+++ b/include/asm-generic/kvm_para.h
@@ -0,0 +1,22 @@
1#ifndef _ASM_GENERIC_KVM_PARA_H
2#define _ASM_GENERIC_KVM_PARA_H
3
4#ifdef __KERNEL__
5
6/*
7 * This function is used by architectures that support kvm to avoid issuing
8 * false soft lockup messages.
9 */
10static inline bool kvm_check_and_clear_guest_paused(void)
11{
12 return false;
13}
14
15static inline unsigned int kvm_arch_para_features(void)
16{
17 return 0;
18}
19
20#endif /* _KERNEL__ */
21
22#endif
diff --git a/include/asm-generic/pci-bridge.h b/include/asm-generic/pci-bridge.h
index a5b5d5a89a4f..20db2e5a0a69 100644
--- a/include/asm-generic/pci-bridge.h
+++ b/include/asm-generic/pci-bridge.h
@@ -30,6 +30,12 @@ enum {
30 PCI_ENABLE_PROC_DOMAINS = 0x00000010, 30 PCI_ENABLE_PROC_DOMAINS = 0x00000010,
31 /* ... except for domain 0 */ 31 /* ... except for domain 0 */
32 PCI_COMPAT_DOMAIN_0 = 0x00000020, 32 PCI_COMPAT_DOMAIN_0 = 0x00000020,
33
34 /* PCIe downstream ports are bridges that normally lead to only a
35 * device 0, but if this is set, we scan all possible devices, not
36 * just device 0.
37 */
38 PCI_SCAN_ALL_PCIE_DEVS = 0x00000040,
33}; 39};
34 40
35#ifdef CONFIG_PCI 41#ifdef CONFIG_PCI
diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h
index 125c54e98517..e2768f188f55 100644
--- a/include/asm-generic/pgtable.h
+++ b/include/asm-generic/pgtable.h
@@ -158,9 +158,8 @@ static inline void pmdp_set_wrprotect(struct mm_struct *mm,
158#endif 158#endif
159 159
160#ifndef __HAVE_ARCH_PMDP_SPLITTING_FLUSH 160#ifndef __HAVE_ARCH_PMDP_SPLITTING_FLUSH
161extern pmd_t pmdp_splitting_flush(struct vm_area_struct *vma, 161extern void pmdp_splitting_flush(struct vm_area_struct *vma,
162 unsigned long address, 162 unsigned long address, pmd_t *pmdp);
163 pmd_t *pmdp);
164#endif 163#endif
165 164
166#ifndef __HAVE_ARCH_PTE_SAME 165#ifndef __HAVE_ARCH_PTE_SAME
diff --git a/include/asm-generic/siginfo.h b/include/asm-generic/siginfo.h
index 5e5e3865f1ed..8ed67779fc09 100644
--- a/include/asm-generic/siginfo.h
+++ b/include/asm-generic/siginfo.h
@@ -98,9 +98,18 @@ typedef struct siginfo {
98 __ARCH_SI_BAND_T _band; /* POLL_IN, POLL_OUT, POLL_MSG */ 98 __ARCH_SI_BAND_T _band; /* POLL_IN, POLL_OUT, POLL_MSG */
99 int _fd; 99 int _fd;
100 } _sigpoll; 100 } _sigpoll;
101
102 /* SIGSYS */
103 struct {
104 void __user *_call_addr; /* calling user insn */
105 int _syscall; /* triggering system call number */
106 unsigned int _arch; /* AUDIT_ARCH_* of syscall */
107 } _sigsys;
101 } _sifields; 108 } _sifields;
102} __ARCH_SI_ATTRIBUTES siginfo_t; 109} __ARCH_SI_ATTRIBUTES siginfo_t;
103 110
111/* If the arch shares siginfo, then it has SIGSYS. */
112#define __ARCH_SIGSYS
104#endif 113#endif
105 114
106/* 115/*
@@ -124,6 +133,11 @@ typedef struct siginfo {
124#define si_addr_lsb _sifields._sigfault._addr_lsb 133#define si_addr_lsb _sifields._sigfault._addr_lsb
125#define si_band _sifields._sigpoll._band 134#define si_band _sifields._sigpoll._band
126#define si_fd _sifields._sigpoll._fd 135#define si_fd _sifields._sigpoll._fd
136#ifdef __ARCH_SIGSYS
137#define si_call_addr _sifields._sigsys._call_addr
138#define si_syscall _sifields._sigsys._syscall
139#define si_arch _sifields._sigsys._arch
140#endif
127 141
128#ifdef __KERNEL__ 142#ifdef __KERNEL__
129#define __SI_MASK 0xffff0000u 143#define __SI_MASK 0xffff0000u
@@ -134,6 +148,7 @@ typedef struct siginfo {
134#define __SI_CHLD (4 << 16) 148#define __SI_CHLD (4 << 16)
135#define __SI_RT (5 << 16) 149#define __SI_RT (5 << 16)
136#define __SI_MESGQ (6 << 16) 150#define __SI_MESGQ (6 << 16)
151#define __SI_SYS (7 << 16)
137#define __SI_CODE(T,N) ((T) | ((N) & 0xffff)) 152#define __SI_CODE(T,N) ((T) | ((N) & 0xffff))
138#else 153#else
139#define __SI_KILL 0 154#define __SI_KILL 0
@@ -143,6 +158,7 @@ typedef struct siginfo {
143#define __SI_CHLD 0 158#define __SI_CHLD 0
144#define __SI_RT 0 159#define __SI_RT 0
145#define __SI_MESGQ 0 160#define __SI_MESGQ 0
161#define __SI_SYS 0
146#define __SI_CODE(T,N) (N) 162#define __SI_CODE(T,N) (N)
147#endif 163#endif
148 164
@@ -240,6 +256,12 @@ typedef struct siginfo {
240#define NSIGPOLL 6 256#define NSIGPOLL 6
241 257
242/* 258/*
259 * SIGSYS si_codes
260 */
261#define SYS_SECCOMP (__SI_SYS|1) /* seccomp triggered */
262#define NSIGSYS 1
263
264/*
243 * sigevent definitions 265 * sigevent definitions
244 * 266 *
245 * It seems likely that SIGEV_THREAD will have to be handled from 267 * It seems likely that SIGEV_THREAD will have to be handled from
diff --git a/include/asm-generic/statfs.h b/include/asm-generic/statfs.h
index 0fd28e028de1..c749af9c0983 100644
--- a/include/asm-generic/statfs.h
+++ b/include/asm-generic/statfs.h
@@ -15,7 +15,7 @@ typedef __kernel_fsid_t fsid_t;
15 * with a 10' pole. 15 * with a 10' pole.
16 */ 16 */
17#ifndef __statfs_word 17#ifndef __statfs_word
18#if BITS_PER_LONG == 64 18#if __BITS_PER_LONG == 64
19#define __statfs_word long 19#define __statfs_word long
20#else 20#else
21#define __statfs_word __u32 21#define __statfs_word __u32
diff --git a/include/asm-generic/syscall.h b/include/asm-generic/syscall.h
index 5c122ae6bfa6..5b09392db673 100644
--- a/include/asm-generic/syscall.h
+++ b/include/asm-generic/syscall.h
@@ -142,4 +142,18 @@ void syscall_set_arguments(struct task_struct *task, struct pt_regs *regs,
142 unsigned int i, unsigned int n, 142 unsigned int i, unsigned int n,
143 const unsigned long *args); 143 const unsigned long *args);
144 144
145/**
146 * syscall_get_arch - return the AUDIT_ARCH for the current system call
147 * @task: task of interest, must be in system call entry tracing
148 * @regs: task_pt_regs() of @task
149 *
150 * Returns the AUDIT_ARCH_* based on the system call convention in use.
151 *
152 * It's only valid to call this when @task is stopped on entry to a system
153 * call, due to %TIF_SYSCALL_TRACE, %TIF_SYSCALL_AUDIT, or %TIF_SECCOMP.
154 *
155 * Architectures which permit CONFIG_HAVE_ARCH_SECCOMP_FILTER must
156 * provide an implementation of this.
157 */
158int syscall_get_arch(struct task_struct *task, struct pt_regs *regs);
145#endif /* _ASM_SYSCALL_H */ 159#endif /* _ASM_SYSCALL_H */
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 8aeadf6b553a..4e2e1cc505ab 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -486,8 +486,8 @@
486 CPU_DISCARD(init.data) \ 486 CPU_DISCARD(init.data) \
487 MEM_DISCARD(init.data) \ 487 MEM_DISCARD(init.data) \
488 KERNEL_CTORS() \ 488 KERNEL_CTORS() \
489 *(.init.rodata) \
490 MCOUNT_REC() \ 489 MCOUNT_REC() \
490 *(.init.rodata) \
491 FTRACE_EVENTS() \ 491 FTRACE_EVENTS() \
492 TRACE_SYSCALLS() \ 492 TRACE_SYSCALLS() \
493 DEV_DISCARD(init.rodata) \ 493 DEV_DISCARD(init.rodata) \
diff --git a/include/asm-generic/word-at-a-time.h b/include/asm-generic/word-at-a-time.h
new file mode 100644
index 000000000000..3f21f1b72e45
--- /dev/null
+++ b/include/asm-generic/word-at-a-time.h
@@ -0,0 +1,52 @@
1#ifndef _ASM_WORD_AT_A_TIME_H
2#define _ASM_WORD_AT_A_TIME_H
3
4/*
5 * This says "generic", but it's actually big-endian only.
6 * Little-endian can use more efficient versions of these
7 * interfaces, see for example
8 * arch/x86/include/asm/word-at-a-time.h
9 * for those.
10 */
11
12#include <linux/kernel.h>
13
14struct word_at_a_time {
15 const unsigned long high_bits, low_bits;
16};
17
18#define WORD_AT_A_TIME_CONSTANTS { REPEAT_BYTE(0xfe) + 1, REPEAT_BYTE(0x7f) }
19
20/* Bit set in the bytes that have a zero */
21static inline long prep_zero_mask(unsigned long val, unsigned long rhs, const struct word_at_a_time *c)
22{
23 unsigned long mask = (val & c->low_bits) + c->low_bits;
24 return ~(mask | rhs);
25}
26
27#define create_zero_mask(mask) (mask)
28
29static inline long find_zero(unsigned long mask)
30{
31 long byte = 0;
32#ifdef CONFIG_64BIT
33 if (mask >> 32)
34 mask >>= 32;
35 else
36 byte = 4;
37#endif
38 if (mask >> 16)
39 mask >>= 16;
40 else
41 byte += 2;
42 return (mask >> 8) ? byte : byte + 1;
43}
44
45static inline bool has_zero(unsigned long val, unsigned long *data, const struct word_at_a_time *c)
46{
47 unsigned long rhs = val | c->low_bits;
48 *data = rhs;
49 return (val + c->high_bits) & ~rhs;
50}
51
52#endif /* _ASM_WORD_AT_A_TIME_H */
diff --git a/include/drm/drm.h b/include/drm/drm.h
index 64ff02d5b730..e51035a3757f 100644
--- a/include/drm/drm.h
+++ b/include/drm/drm.h
@@ -730,6 +730,8 @@ struct drm_prime_handle {
730#define DRM_IOCTL_MODE_GETPLANE DRM_IOWR(0xB6, struct drm_mode_get_plane) 730#define DRM_IOCTL_MODE_GETPLANE DRM_IOWR(0xB6, struct drm_mode_get_plane)
731#define DRM_IOCTL_MODE_SETPLANE DRM_IOWR(0xB7, struct drm_mode_set_plane) 731#define DRM_IOCTL_MODE_SETPLANE DRM_IOWR(0xB7, struct drm_mode_set_plane)
732#define DRM_IOCTL_MODE_ADDFB2 DRM_IOWR(0xB8, struct drm_mode_fb_cmd2) 732#define DRM_IOCTL_MODE_ADDFB2 DRM_IOWR(0xB8, struct drm_mode_fb_cmd2)
733#define DRM_IOCTL_MODE_OBJ_GETPROPERTIES DRM_IOWR(0xB9, struct drm_mode_obj_get_properties)
734#define DRM_IOCTL_MODE_OBJ_SETPROPERTY DRM_IOWR(0xBA, struct drm_mode_obj_set_property)
733 735
734/** 736/**
735 * Device specific ioctls should only be in their respective headers 737 * Device specific ioctls should only be in their respective headers
@@ -775,6 +777,10 @@ struct drm_event_vblank {
775#define DRM_CAP_VBLANK_HIGH_CRTC 0x2 777#define DRM_CAP_VBLANK_HIGH_CRTC 0x2
776#define DRM_CAP_DUMB_PREFERRED_DEPTH 0x3 778#define DRM_CAP_DUMB_PREFERRED_DEPTH 0x3
777#define DRM_CAP_DUMB_PREFER_SHADOW 0x4 779#define DRM_CAP_DUMB_PREFER_SHADOW 0x4
780#define DRM_CAP_PRIME 0x5
781
782#define DRM_PRIME_CAP_IMPORT 0x1
783#define DRM_PRIME_CAP_EXPORT 0x2
778 784
779/* typedef area */ 785/* typedef area */
780#ifndef __KERNEL__ 786#ifndef __KERNEL__
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index dd731043fecd..31ad880ca2ef 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -755,11 +755,11 @@ struct drm_driver {
755 * @dev: DRM device 755 * @dev: DRM device
756 * @crtc: counter to fetch 756 * @crtc: counter to fetch
757 * 757 *
758 * Driver callback for fetching a raw hardware vblank counter 758 * Driver callback for fetching a raw hardware vblank counter for @crtc.
759 * for @crtc. If a device doesn't have a hardware counter, the 759 * If a device doesn't have a hardware counter, the driver can simply
760 * driver can simply return the value of drm_vblank_count and 760 * return the value of drm_vblank_count. The DRM core will account for
761 * make the enable_vblank() and disable_vblank() hooks into no-ops, 761 * missed vblank events while interrupts where disabled based on system
762 * leaving interrupts enabled at all times. 762 * timestamps.
763 * 763 *
764 * Wraparound handling and loss of events due to modesetting is dealt 764 * Wraparound handling and loss of events due to modesetting is dealt
765 * with in the DRM core code. 765 * with in the DRM core code.
@@ -941,7 +941,7 @@ struct drm_driver {
941 uint32_t handle); 941 uint32_t handle);
942 942
943 /* Driver private ops for this object */ 943 /* Driver private ops for this object */
944 struct vm_operations_struct *gem_vm_ops; 944 const struct vm_operations_struct *gem_vm_ops;
945 945
946 int major; 946 int major;
947 int minor; 947 int minor;
@@ -1309,8 +1309,8 @@ extern int drm_release(struct inode *inode, struct file *filp);
1309 /* Mapping support (drm_vm.h) */ 1309 /* Mapping support (drm_vm.h) */
1310extern int drm_mmap(struct file *filp, struct vm_area_struct *vma); 1310extern int drm_mmap(struct file *filp, struct vm_area_struct *vma);
1311extern int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma); 1311extern int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma);
1312extern void drm_vm_open_locked(struct vm_area_struct *vma); 1312extern void drm_vm_open_locked(struct drm_device *dev, struct vm_area_struct *vma);
1313extern void drm_vm_close_locked(struct vm_area_struct *vma); 1313extern void drm_vm_close_locked(struct drm_device *dev, struct vm_area_struct *vma);
1314extern unsigned int drm_poll(struct file *filp, struct poll_table_struct *wait); 1314extern unsigned int drm_poll(struct file *filp, struct poll_table_struct *wait);
1315 1315
1316 /* Memory management support (drm_memory.h) */ 1316 /* Memory management support (drm_memory.h) */
@@ -1378,6 +1378,7 @@ extern int drm_remove_magic(struct drm_master *master, drm_magic_t magic);
1378 1378
1379/* Cache management (drm_cache.c) */ 1379/* Cache management (drm_cache.c) */
1380void drm_clflush_pages(struct page *pages[], unsigned long num_pages); 1380void drm_clflush_pages(struct page *pages[], unsigned long num_pages);
1381void drm_clflush_virt_range(char *addr, unsigned long length);
1381 1382
1382 /* Locking IOCTL support (drm_lock.h) */ 1383 /* Locking IOCTL support (drm_lock.h) */
1383extern int drm_lock(struct drm_device *dev, void *data, 1384extern int drm_lock(struct drm_device *dev, void *data,
@@ -1557,6 +1558,8 @@ extern int drm_prime_handle_to_fd_ioctl(struct drm_device *dev, void *data,
1557extern int drm_prime_fd_to_handle_ioctl(struct drm_device *dev, void *data, 1558extern int drm_prime_fd_to_handle_ioctl(struct drm_device *dev, void *data,
1558 struct drm_file *file_priv); 1559 struct drm_file *file_priv);
1559 1560
1561extern int drm_prime_sg_to_page_addr_arrays(struct sg_table *sgt, struct page **pages,
1562 dma_addr_t *addrs, int max_pages);
1560extern struct sg_table *drm_prime_pages_to_sg(struct page **pages, int nr_pages); 1563extern struct sg_table *drm_prime_pages_to_sg(struct page **pages, int nr_pages);
1561extern void drm_prime_gem_destroy(struct drm_gem_object *obj, struct sg_table *sg); 1564extern void drm_prime_gem_destroy(struct drm_gem_object *obj, struct sg_table *sg);
1562 1565
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index e250eda4e3a8..73e45600f95d 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -36,6 +36,7 @@
36struct drm_device; 36struct drm_device;
37struct drm_mode_set; 37struct drm_mode_set;
38struct drm_framebuffer; 38struct drm_framebuffer;
39struct drm_object_properties;
39 40
40 41
41#define DRM_MODE_OBJECT_CRTC 0xcccccccc 42#define DRM_MODE_OBJECT_CRTC 0xcccccccc
@@ -50,6 +51,14 @@ struct drm_framebuffer;
50struct drm_mode_object { 51struct drm_mode_object {
51 uint32_t id; 52 uint32_t id;
52 uint32_t type; 53 uint32_t type;
54 struct drm_object_properties *properties;
55};
56
57#define DRM_OBJECT_MAX_PROPERTY 16
58struct drm_object_properties {
59 int count;
60 uint32_t ids[DRM_OBJECT_MAX_PROPERTY];
61 uint64_t values[DRM_OBJECT_MAX_PROPERTY];
53}; 62};
54 63
55/* 64/*
@@ -285,19 +294,16 @@ struct drm_plane;
285 294
286/** 295/**
287 * drm_crtc_funcs - control CRTCs for a given device 296 * drm_crtc_funcs - control CRTCs for a given device
288 * @reset: reset CRTC after state has been invalidate (e.g. resume)
289 * @dpms: control display power levels
290 * @save: save CRTC state 297 * @save: save CRTC state
291 * @resore: restore CRTC state 298 * @restore: restore CRTC state
292 * @lock: lock the CRTC 299 * @reset: reset CRTC after state has been invalidate (e.g. resume)
293 * @unlock: unlock the CRTC 300 * @cursor_set: setup the cursor
294 * @shadow_allocate: allocate shadow pixmap 301 * @cursor_move: move the cursor
295 * @shadow_create: create shadow pixmap for rotation support
296 * @shadow_destroy: free shadow pixmap
297 * @mode_fixup: fixup proposed mode
298 * @mode_set: set the desired mode on the CRTC
299 * @gamma_set: specify color ramp for CRTC 302 * @gamma_set: specify color ramp for CRTC
300 * @destroy: deinit and free object. 303 * @destroy: deinit and free object
304 * @set_property: called when a property is changed
305 * @set_config: apply a new CRTC configuration
306 * @page_flip: initiate a page flip
301 * 307 *
302 * The drm_crtc_funcs structure is the central CRTC management structure 308 * The drm_crtc_funcs structure is the central CRTC management structure
303 * in the DRM. Each CRTC controls one or more connectors (note that the name 309 * in the DRM. Each CRTC controls one or more connectors (note that the name
@@ -341,6 +347,9 @@ struct drm_crtc_funcs {
341 int (*page_flip)(struct drm_crtc *crtc, 347 int (*page_flip)(struct drm_crtc *crtc,
342 struct drm_framebuffer *fb, 348 struct drm_framebuffer *fb,
343 struct drm_pending_vblank_event *event); 349 struct drm_pending_vblank_event *event);
350
351 int (*set_property)(struct drm_crtc *crtc,
352 struct drm_property *property, uint64_t val);
344}; 353};
345 354
346/** 355/**
@@ -360,6 +369,7 @@ struct drm_crtc_funcs {
360 * @framedur_ns: precise line timing 369 * @framedur_ns: precise line timing
361 * @pixeldur_ns: precise pixel timing 370 * @pixeldur_ns: precise pixel timing
362 * @helper_private: mid-layer private data 371 * @helper_private: mid-layer private data
372 * @properties: property tracking for this CRTC
363 * 373 *
364 * Each CRTC may have one or more connectors associated with it. This structure 374 * Each CRTC may have one or more connectors associated with it. This structure
365 * allows the CRTC to be controlled. 375 * allows the CRTC to be controlled.
@@ -395,6 +405,8 @@ struct drm_crtc {
395 405
396 /* if you are using the helper */ 406 /* if you are using the helper */
397 void *helper_private; 407 void *helper_private;
408
409 struct drm_object_properties properties;
398}; 410};
399 411
400 412
@@ -404,11 +416,8 @@ struct drm_crtc {
404 * @save: save connector state 416 * @save: save connector state
405 * @restore: restore connector state 417 * @restore: restore connector state
406 * @reset: reset connector after state has been invalidate (e.g. resume) 418 * @reset: reset connector after state has been invalidate (e.g. resume)
407 * @mode_valid: is this mode valid on the given connector?
408 * @mode_fixup: try to fixup proposed mode for this connector
409 * @mode_set: set this mode
410 * @detect: is this connector active? 419 * @detect: is this connector active?
411 * @get_modes: get mode list for this connector 420 * @fill_modes: fill mode list for this connector
412 * @set_property: property for this connector may need update 421 * @set_property: property for this connector may need update
413 * @destroy: make object go away 422 * @destroy: make object go away
414 * @force: notify the driver the connector is forced on 423 * @force: notify the driver the connector is forced on
@@ -451,7 +460,6 @@ struct drm_encoder_funcs {
451}; 460};
452 461
453#define DRM_CONNECTOR_MAX_UMODES 16 462#define DRM_CONNECTOR_MAX_UMODES 16
454#define DRM_CONNECTOR_MAX_PROPERTY 16
455#define DRM_CONNECTOR_LEN 32 463#define DRM_CONNECTOR_LEN 32
456#define DRM_CONNECTOR_MAX_ENCODER 3 464#define DRM_CONNECTOR_MAX_ENCODER 3
457 465
@@ -520,8 +528,7 @@ enum drm_connector_force {
520 * @funcs: connector control functions 528 * @funcs: connector control functions
521 * @user_modes: user added mode list 529 * @user_modes: user added mode list
522 * @edid_blob_ptr: DRM property containing EDID if present 530 * @edid_blob_ptr: DRM property containing EDID if present
523 * @property_ids: property tracking for this connector 531 * @properties: property tracking for this connector
524 * @property_values: value pointers or data for properties
525 * @polled: a %DRM_CONNECTOR_POLL_<foo> value for core driven polling 532 * @polled: a %DRM_CONNECTOR_POLL_<foo> value for core driven polling
526 * @dpms: current dpms state 533 * @dpms: current dpms state
527 * @helper_private: mid-layer private data 534 * @helper_private: mid-layer private data
@@ -565,8 +572,7 @@ struct drm_connector {
565 572
566 struct list_head user_modes; 573 struct list_head user_modes;
567 struct drm_property_blob *edid_blob_ptr; 574 struct drm_property_blob *edid_blob_ptr;
568 u32 property_ids[DRM_CONNECTOR_MAX_PROPERTY]; 575 struct drm_object_properties properties;
569 uint64_t property_values[DRM_CONNECTOR_MAX_PROPERTY];
570 576
571 uint8_t polled; /* DRM_CONNECTOR_POLL_* */ 577 uint8_t polled; /* DRM_CONNECTOR_POLL_* */
572 578
@@ -595,6 +601,7 @@ struct drm_connector {
595 * @update_plane: update the plane configuration 601 * @update_plane: update the plane configuration
596 * @disable_plane: shut down the plane 602 * @disable_plane: shut down the plane
597 * @destroy: clean up plane resources 603 * @destroy: clean up plane resources
604 * @set_property: called when a property is changed
598 */ 605 */
599struct drm_plane_funcs { 606struct drm_plane_funcs {
600 int (*update_plane)(struct drm_plane *plane, 607 int (*update_plane)(struct drm_plane *plane,
@@ -605,6 +612,9 @@ struct drm_plane_funcs {
605 uint32_t src_w, uint32_t src_h); 612 uint32_t src_w, uint32_t src_h);
606 int (*disable_plane)(struct drm_plane *plane); 613 int (*disable_plane)(struct drm_plane *plane);
607 void (*destroy)(struct drm_plane *plane); 614 void (*destroy)(struct drm_plane *plane);
615
616 int (*set_property)(struct drm_plane *plane,
617 struct drm_property *property, uint64_t val);
608}; 618};
609 619
610/** 620/**
@@ -622,6 +632,7 @@ struct drm_plane_funcs {
622 * @enabled: enabled flag 632 * @enabled: enabled flag
623 * @funcs: helper functions 633 * @funcs: helper functions
624 * @helper_private: storage for drver layer 634 * @helper_private: storage for drver layer
635 * @properties: property tracking for this plane
625 */ 636 */
626struct drm_plane { 637struct drm_plane {
627 struct drm_device *dev; 638 struct drm_device *dev;
@@ -644,6 +655,8 @@ struct drm_plane {
644 655
645 const struct drm_plane_funcs *funcs; 656 const struct drm_plane_funcs *funcs;
646 void *helper_private; 657 void *helper_private;
658
659 struct drm_object_properties properties;
647}; 660};
648 661
649/** 662/**
@@ -761,7 +774,7 @@ struct drm_mode_config {
761 774
762 int min_width, min_height; 775 int min_width, min_height;
763 int max_width, max_height; 776 int max_width, max_height;
764 struct drm_mode_config_funcs *funcs; 777 const struct drm_mode_config_funcs *funcs;
765 resource_size_t fb_base; 778 resource_size_t fb_base;
766 779
767 /* output poll support */ 780 /* output poll support */
@@ -898,6 +911,12 @@ extern int drm_connector_property_set_value(struct drm_connector *connector,
898extern int drm_connector_property_get_value(struct drm_connector *connector, 911extern int drm_connector_property_get_value(struct drm_connector *connector,
899 struct drm_property *property, 912 struct drm_property *property,
900 uint64_t *value); 913 uint64_t *value);
914extern int drm_object_property_set_value(struct drm_mode_object *obj,
915 struct drm_property *property,
916 uint64_t val);
917extern int drm_object_property_get_value(struct drm_mode_object *obj,
918 struct drm_property *property,
919 uint64_t *value);
901extern struct drm_display_mode *drm_crtc_mode_create(struct drm_device *dev); 920extern struct drm_display_mode *drm_crtc_mode_create(struct drm_device *dev);
902extern void drm_framebuffer_set_object(struct drm_device *dev, 921extern void drm_framebuffer_set_object(struct drm_device *dev,
903 unsigned long handle); 922 unsigned long handle);
@@ -910,14 +929,21 @@ extern int drmfb_remove(struct drm_device *dev, struct drm_framebuffer *fb);
910extern void drm_crtc_probe_connector_modes(struct drm_device *dev, int maxX, int maxY); 929extern void drm_crtc_probe_connector_modes(struct drm_device *dev, int maxX, int maxY);
911extern bool drm_crtc_in_use(struct drm_crtc *crtc); 930extern bool drm_crtc_in_use(struct drm_crtc *crtc);
912 931
913extern int drm_connector_attach_property(struct drm_connector *connector, 932extern void drm_connector_attach_property(struct drm_connector *connector,
914 struct drm_property *property, uint64_t init_val); 933 struct drm_property *property, uint64_t init_val);
934extern void drm_object_attach_property(struct drm_mode_object *obj,
935 struct drm_property *property,
936 uint64_t init_val);
915extern struct drm_property *drm_property_create(struct drm_device *dev, int flags, 937extern struct drm_property *drm_property_create(struct drm_device *dev, int flags,
916 const char *name, int num_values); 938 const char *name, int num_values);
917extern struct drm_property *drm_property_create_enum(struct drm_device *dev, int flags, 939extern struct drm_property *drm_property_create_enum(struct drm_device *dev, int flags,
918 const char *name, 940 const char *name,
919 const struct drm_prop_enum_list *props, 941 const struct drm_prop_enum_list *props,
920 int num_values); 942 int num_values);
943struct drm_property *drm_property_create_bitmask(struct drm_device *dev,
944 int flags, const char *name,
945 const struct drm_prop_enum_list *props,
946 int num_values);
921struct drm_property *drm_property_create_range(struct drm_device *dev, int flags, 947struct drm_property *drm_property_create_range(struct drm_device *dev, int flags,
922 const char *name, 948 const char *name,
923 uint64_t min, uint64_t max); 949 uint64_t min, uint64_t max);
@@ -1012,10 +1038,11 @@ extern int drm_add_modes_noedid(struct drm_connector *connector,
1012 int hdisplay, int vdisplay); 1038 int hdisplay, int vdisplay);
1013 1039
1014extern int drm_edid_header_is_valid(const u8 *raw_edid); 1040extern int drm_edid_header_is_valid(const u8 *raw_edid);
1015extern bool drm_edid_block_valid(u8 *raw_edid); 1041extern bool drm_edid_block_valid(u8 *raw_edid, int block);
1016extern bool drm_edid_is_valid(struct edid *edid); 1042extern bool drm_edid_is_valid(struct edid *edid);
1017struct drm_display_mode *drm_mode_find_dmt(struct drm_device *dev, 1043struct drm_display_mode *drm_mode_find_dmt(struct drm_device *dev,
1018 int hsize, int vsize, int fresh); 1044 int hsize, int vsize, int fresh,
1045 bool rb);
1019 1046
1020extern int drm_mode_create_dumb_ioctl(struct drm_device *dev, 1047extern int drm_mode_create_dumb_ioctl(struct drm_device *dev,
1021 void *data, struct drm_file *file_priv); 1048 void *data, struct drm_file *file_priv);
@@ -1023,7 +1050,16 @@ extern int drm_mode_mmap_dumb_ioctl(struct drm_device *dev,
1023 void *data, struct drm_file *file_priv); 1050 void *data, struct drm_file *file_priv);
1024extern int drm_mode_destroy_dumb_ioctl(struct drm_device *dev, 1051extern int drm_mode_destroy_dumb_ioctl(struct drm_device *dev,
1025 void *data, struct drm_file *file_priv); 1052 void *data, struct drm_file *file_priv);
1053extern int drm_mode_obj_get_properties_ioctl(struct drm_device *dev, void *data,
1054 struct drm_file *file_priv);
1055extern int drm_mode_obj_set_property_ioctl(struct drm_device *dev, void *data,
1056 struct drm_file *file_priv);
1026 1057
1027extern void drm_fb_get_bpp_depth(uint32_t format, unsigned int *depth, 1058extern void drm_fb_get_bpp_depth(uint32_t format, unsigned int *depth,
1028 int *bpp); 1059 int *bpp);
1060extern int drm_format_num_planes(uint32_t format);
1061extern int drm_format_plane_cpp(uint32_t format, int plane);
1062extern int drm_format_horz_chroma_subsampling(uint32_t format);
1063extern int drm_format_vert_chroma_subsampling(uint32_t format);
1064
1029#endif /* __DRM_CRTC_H__ */ 1065#endif /* __DRM_CRTC_H__ */
diff --git a/include/drm/drm_crtc_helper.h b/include/drm/drm_crtc_helper.h
index 37515d1afab3..7988e55c98d0 100644
--- a/include/drm/drm_crtc_helper.h
+++ b/include/drm/drm_crtc_helper.h
@@ -44,6 +44,13 @@ enum mode_set_atomic {
44 ENTER_ATOMIC_MODE_SET, 44 ENTER_ATOMIC_MODE_SET,
45}; 45};
46 46
47/**
48 * drm_crtc_helper_funcs - helper operations for CRTCs
49 * @mode_fixup: try to fixup proposed mode for this connector
50 * @mode_set: set this mode
51 *
52 * The helper operations are called by the mid-layer CRTC helper.
53 */
47struct drm_crtc_helper_funcs { 54struct drm_crtc_helper_funcs {
48 /* 55 /*
49 * Control power levels on the CRTC. If the mode passed in is 56 * Control power levels on the CRTC. If the mode passed in is
@@ -76,6 +83,13 @@ struct drm_crtc_helper_funcs {
76 void (*disable)(struct drm_crtc *crtc); 83 void (*disable)(struct drm_crtc *crtc);
77}; 84};
78 85
86/**
87 * drm_encoder_helper_funcs - helper operations for encoders
88 * @mode_fixup: try to fixup proposed mode for this connector
89 * @mode_set: set this mode
90 *
91 * The helper operations are called by the mid-layer CRTC helper.
92 */
79struct drm_encoder_helper_funcs { 93struct drm_encoder_helper_funcs {
80 void (*dpms)(struct drm_encoder *encoder, int mode); 94 void (*dpms)(struct drm_encoder *encoder, int mode);
81 void (*save)(struct drm_encoder *encoder); 95 void (*save)(struct drm_encoder *encoder);
@@ -97,6 +111,13 @@ struct drm_encoder_helper_funcs {
97 void (*disable)(struct drm_encoder *encoder); 111 void (*disable)(struct drm_encoder *encoder);
98}; 112};
99 113
114/**
115 * drm_connector_helper_funcs - helper operations for connectors
116 * @get_modes: get mode list for this connector
117 * @mode_valid: is this mode valid on the given connector?
118 *
119 * The helper operations are called by the mid-layer CRTC helper.
120 */
100struct drm_connector_helper_funcs { 121struct drm_connector_helper_funcs {
101 int (*get_modes)(struct drm_connector *connector); 122 int (*get_modes)(struct drm_connector *connector);
102 int (*mode_valid)(struct drm_connector *connector, 123 int (*mode_valid)(struct drm_connector *connector,
@@ -145,6 +166,4 @@ extern void drm_helper_hpd_irq_event(struct drm_device *dev);
145extern void drm_kms_helper_poll_disable(struct drm_device *dev); 166extern void drm_kms_helper_poll_disable(struct drm_device *dev);
146extern void drm_kms_helper_poll_enable(struct drm_device *dev); 167extern void drm_kms_helper_poll_enable(struct drm_device *dev);
147 168
148extern int drm_format_num_planes(uint32_t format);
149
150#endif 169#endif
diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h
index 93df2d72750b..1744b18c06b3 100644
--- a/include/drm/drm_dp_helper.h
+++ b/include/drm/drm_dp_helper.h
@@ -72,6 +72,10 @@
72 72
73#define DP_MAIN_LINK_CHANNEL_CODING 0x006 73#define DP_MAIN_LINK_CHANNEL_CODING 0x006
74 74
75#define DP_DOWN_STREAM_PORT_COUNT 0x007
76#define DP_PORT_COUNT_MASK 0x0f
77#define DP_OUI_SUPPORT (1 << 7)
78
75#define DP_EDP_CONFIGURATION_CAP 0x00d 79#define DP_EDP_CONFIGURATION_CAP 0x00d
76#define DP_TRAINING_AUX_RD_INTERVAL 0x00e 80#define DP_TRAINING_AUX_RD_INTERVAL 0x00e
77 81
@@ -213,6 +217,10 @@
213# define DP_TEST_NAK (1 << 1) 217# define DP_TEST_NAK (1 << 1)
214# define DP_TEST_EDID_CHECKSUM_WRITE (1 << 2) 218# define DP_TEST_EDID_CHECKSUM_WRITE (1 << 2)
215 219
220#define DP_SOURCE_OUI 0x300
221#define DP_SINK_OUI 0x400
222#define DP_BRANCH_OUI 0x500
223
216#define DP_SET_POWER 0x600 224#define DP_SET_POWER 0x600
217# define DP_SET_POWER_D0 0x1 225# define DP_SET_POWER_D0 0x1
218# define DP_SET_POWER_D3 0x2 226# define DP_SET_POWER_D3 0x2
diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h
index bcb9a66baa8c..0cac551c5347 100644
--- a/include/drm/drm_edid.h
+++ b/include/drm/drm_edid.h
@@ -90,12 +90,26 @@ struct detailed_data_monitor_range {
90 u8 min_hfreq_khz; 90 u8 min_hfreq_khz;
91 u8 max_hfreq_khz; 91 u8 max_hfreq_khz;
92 u8 pixel_clock_mhz; /* need to multiply by 10 */ 92 u8 pixel_clock_mhz; /* need to multiply by 10 */
93 __le16 sec_gtf_toggle; /* A000=use above, 20=use below */ 93 u8 flags;
94 u8 hfreq_start_khz; /* need to multiply by 2 */ 94 union {
95 u8 c; /* need to divide by 2 */ 95 struct {
96 __le16 m; 96 u8 reserved;
97 u8 k; 97 u8 hfreq_start_khz; /* need to multiply by 2 */
98 u8 j; /* need to divide by 2 */ 98 u8 c; /* need to divide by 2 */
99 __le16 m;
100 u8 k;
101 u8 j; /* need to divide by 2 */
102 } __attribute__((packed)) gtf2;
103 struct {
104 u8 version;
105 u8 data1; /* high 6 bits: extra clock resolution */
106 u8 data2; /* plus low 2 of above: max hactive */
107 u8 supported_aspects;
108 u8 flags; /* preferred aspect and blanking support */
109 u8 supported_scalings;
110 u8 preferred_refresh;
111 } __attribute__((packed)) cvt;
112 } formula;
99} __attribute__((packed)); 113} __attribute__((packed));
100 114
101struct detailed_data_wpindex { 115struct detailed_data_wpindex {
diff --git a/include/drm/drm_fixed.h b/include/drm/drm_fixed.h
index 4a08a664ff1f..0ead502e17d2 100644
--- a/include/drm/drm_fixed.h
+++ b/include/drm/drm_fixed.h
@@ -37,6 +37,7 @@ typedef union dfixed {
37#define dfixed_init(A) { .full = dfixed_const((A)) } 37#define dfixed_init(A) { .full = dfixed_const((A)) }
38#define dfixed_init_half(A) { .full = dfixed_const_half((A)) } 38#define dfixed_init_half(A) { .full = dfixed_const_half((A)) }
39#define dfixed_trunc(A) ((A).full >> 12) 39#define dfixed_trunc(A) ((A).full >> 12)
40#define dfixed_frac(A) ((A).full & ((1 << 12) - 1))
40 41
41static inline u32 dfixed_floor(fixed20_12 A) 42static inline u32 dfixed_floor(fixed20_12 A)
42{ 43{
diff --git a/include/drm/drm_mode.h b/include/drm/drm_mode.h
index 4a0aae38e160..5581980b14f6 100644
--- a/include/drm/drm_mode.h
+++ b/include/drm/drm_mode.h
@@ -230,6 +230,7 @@ struct drm_mode_get_connector {
230#define DRM_MODE_PROP_IMMUTABLE (1<<2) 230#define DRM_MODE_PROP_IMMUTABLE (1<<2)
231#define DRM_MODE_PROP_ENUM (1<<3) /* enumerated type with text strings */ 231#define DRM_MODE_PROP_ENUM (1<<3) /* enumerated type with text strings */
232#define DRM_MODE_PROP_BLOB (1<<4) 232#define DRM_MODE_PROP_BLOB (1<<4)
233#define DRM_MODE_PROP_BITMASK (1<<5) /* bitmask of enumerated types */
233 234
234struct drm_mode_property_enum { 235struct drm_mode_property_enum {
235 __u64 value; 236 __u64 value;
@@ -254,6 +255,21 @@ struct drm_mode_connector_set_property {
254 __u32 connector_id; 255 __u32 connector_id;
255}; 256};
256 257
258struct drm_mode_obj_get_properties {
259 __u64 props_ptr;
260 __u64 prop_values_ptr;
261 __u32 count_props;
262 __u32 obj_id;
263 __u32 obj_type;
264};
265
266struct drm_mode_obj_set_property {
267 __u64 value;
268 __u32 prop_id;
269 __u32 obj_id;
270 __u32 obj_type;
271};
272
257struct drm_mode_get_blob { 273struct drm_mode_get_blob {
258 __u32 blob_id; 274 __u32 blob_id;
259 __u32 length; 275 __u32 length;
diff --git a/include/drm/exynos_drm.h b/include/drm/exynos_drm.h
index e478de4e5d56..b6d7ce92eadd 100644
--- a/include/drm/exynos_drm.h
+++ b/include/drm/exynos_drm.h
@@ -29,6 +29,8 @@
29#ifndef _EXYNOS_DRM_H_ 29#ifndef _EXYNOS_DRM_H_
30#define _EXYNOS_DRM_H_ 30#define _EXYNOS_DRM_H_
31 31
32#include "drm.h"
33
32/** 34/**
33 * User-desired buffer creation information structure. 35 * User-desired buffer creation information structure.
34 * 36 *
@@ -75,6 +77,21 @@ struct drm_exynos_gem_mmap {
75}; 77};
76 78
77/** 79/**
80 * A structure to gem information.
81 *
82 * @handle: a handle to gem object created.
83 * @flags: flag value including memory type and cache attribute and
84 * this value would be set by driver.
85 * @size: size to memory region allocated by gem and this size would
86 * be set by driver.
87 */
88struct drm_exynos_gem_info {
89 unsigned int handle;
90 unsigned int flags;
91 uint64_t size;
92};
93
94/**
78 * A structure for user connection request of virtual display. 95 * A structure for user connection request of virtual display.
79 * 96 *
80 * @connection: indicate whether doing connetion or not by user. 97 * @connection: indicate whether doing connetion or not by user.
@@ -95,18 +112,64 @@ struct drm_exynos_plane_set_zpos {
95 112
96/* memory type definitions. */ 113/* memory type definitions. */
97enum e_drm_exynos_gem_mem_type { 114enum e_drm_exynos_gem_mem_type {
115 /* Physically Continuous memory and used as default. */
116 EXYNOS_BO_CONTIG = 0 << 0,
98 /* Physically Non-Continuous memory. */ 117 /* Physically Non-Continuous memory. */
99 EXYNOS_BO_NONCONTIG = 1 << 0, 118 EXYNOS_BO_NONCONTIG = 1 << 0,
100 EXYNOS_BO_MASK = EXYNOS_BO_NONCONTIG 119 /* non-cachable mapping and used as default. */
120 EXYNOS_BO_NONCACHABLE = 0 << 1,
121 /* cachable mapping. */
122 EXYNOS_BO_CACHABLE = 1 << 1,
123 /* write-combine mapping. */
124 EXYNOS_BO_WC = 1 << 2,
125 EXYNOS_BO_MASK = EXYNOS_BO_NONCONTIG | EXYNOS_BO_CACHABLE |
126 EXYNOS_BO_WC
127};
128
129struct drm_exynos_g2d_get_ver {
130 __u32 major;
131 __u32 minor;
132};
133
134struct drm_exynos_g2d_cmd {
135 __u32 offset;
136 __u32 data;
137};
138
139enum drm_exynos_g2d_event_type {
140 G2D_EVENT_NOT,
141 G2D_EVENT_NONSTOP,
142 G2D_EVENT_STOP, /* not yet */
143};
144
145struct drm_exynos_g2d_set_cmdlist {
146 __u64 cmd;
147 __u64 cmd_gem;
148 __u32 cmd_nr;
149 __u32 cmd_gem_nr;
150
151 /* for g2d event */
152 __u64 event_type;
153 __u64 user_data;
154};
155
156struct drm_exynos_g2d_exec {
157 __u64 async;
101}; 158};
102 159
103#define DRM_EXYNOS_GEM_CREATE 0x00 160#define DRM_EXYNOS_GEM_CREATE 0x00
104#define DRM_EXYNOS_GEM_MAP_OFFSET 0x01 161#define DRM_EXYNOS_GEM_MAP_OFFSET 0x01
105#define DRM_EXYNOS_GEM_MMAP 0x02 162#define DRM_EXYNOS_GEM_MMAP 0x02
106/* Reserved 0x03 ~ 0x05 for exynos specific gem ioctl */ 163/* Reserved 0x03 ~ 0x05 for exynos specific gem ioctl */
164#define DRM_EXYNOS_GEM_GET 0x04
107#define DRM_EXYNOS_PLANE_SET_ZPOS 0x06 165#define DRM_EXYNOS_PLANE_SET_ZPOS 0x06
108#define DRM_EXYNOS_VIDI_CONNECTION 0x07 166#define DRM_EXYNOS_VIDI_CONNECTION 0x07
109 167
168/* G2D */
169#define DRM_EXYNOS_G2D_GET_VER 0x20
170#define DRM_EXYNOS_G2D_SET_CMDLIST 0x21
171#define DRM_EXYNOS_G2D_EXEC 0x22
172
110#define DRM_IOCTL_EXYNOS_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + \ 173#define DRM_IOCTL_EXYNOS_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + \
111 DRM_EXYNOS_GEM_CREATE, struct drm_exynos_gem_create) 174 DRM_EXYNOS_GEM_CREATE, struct drm_exynos_gem_create)
112 175
@@ -116,12 +179,34 @@ enum e_drm_exynos_gem_mem_type {
116#define DRM_IOCTL_EXYNOS_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + \ 179#define DRM_IOCTL_EXYNOS_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + \
117 DRM_EXYNOS_GEM_MMAP, struct drm_exynos_gem_mmap) 180 DRM_EXYNOS_GEM_MMAP, struct drm_exynos_gem_mmap)
118 181
182#define DRM_IOCTL_EXYNOS_GEM_GET DRM_IOWR(DRM_COMMAND_BASE + \
183 DRM_EXYNOS_GEM_GET, struct drm_exynos_gem_info)
184
119#define DRM_IOCTL_EXYNOS_PLANE_SET_ZPOS DRM_IOWR(DRM_COMMAND_BASE + \ 185#define DRM_IOCTL_EXYNOS_PLANE_SET_ZPOS DRM_IOWR(DRM_COMMAND_BASE + \
120 DRM_EXYNOS_PLANE_SET_ZPOS, struct drm_exynos_plane_set_zpos) 186 DRM_EXYNOS_PLANE_SET_ZPOS, struct drm_exynos_plane_set_zpos)
121 187
122#define DRM_IOCTL_EXYNOS_VIDI_CONNECTION DRM_IOWR(DRM_COMMAND_BASE + \ 188#define DRM_IOCTL_EXYNOS_VIDI_CONNECTION DRM_IOWR(DRM_COMMAND_BASE + \
123 DRM_EXYNOS_VIDI_CONNECTION, struct drm_exynos_vidi_connection) 189 DRM_EXYNOS_VIDI_CONNECTION, struct drm_exynos_vidi_connection)
124 190
191#define DRM_IOCTL_EXYNOS_G2D_GET_VER DRM_IOWR(DRM_COMMAND_BASE + \
192 DRM_EXYNOS_G2D_GET_VER, struct drm_exynos_g2d_get_ver)
193#define DRM_IOCTL_EXYNOS_G2D_SET_CMDLIST DRM_IOWR(DRM_COMMAND_BASE + \
194 DRM_EXYNOS_G2D_SET_CMDLIST, struct drm_exynos_g2d_set_cmdlist)
195#define DRM_IOCTL_EXYNOS_G2D_EXEC DRM_IOWR(DRM_COMMAND_BASE + \
196 DRM_EXYNOS_G2D_EXEC, struct drm_exynos_g2d_exec)
197
198/* EXYNOS specific events */
199#define DRM_EXYNOS_G2D_EVENT 0x80000000
200
201struct drm_exynos_g2d_event {
202 struct drm_event base;
203 __u64 user_data;
204 __u32 tv_sec;
205 __u32 tv_usec;
206 __u32 cmdlist_no;
207 __u32 reserved;
208};
209
125#ifdef __KERNEL__ 210#ifdef __KERNEL__
126 211
127/** 212/**
@@ -169,16 +254,14 @@ struct exynos_drm_common_hdmi_pd {
169/** 254/**
170 * Platform Specific Structure for DRM based HDMI core. 255 * Platform Specific Structure for DRM based HDMI core.
171 * 256 *
172 * @timing: default video mode for initializing
173 * @default_win: default window layer number to be used for UI.
174 * @bpp: default bit per pixel.
175 * @is_v13: set if hdmi version 13 is. 257 * @is_v13: set if hdmi version 13 is.
258 * @cfg_hpd: function pointer to configure hdmi hotplug detection pin
259 * @get_hpd: function pointer to get value of hdmi hotplug detection pin
176 */ 260 */
177struct exynos_drm_hdmi_pdata { 261struct exynos_drm_hdmi_pdata {
178 struct fb_videomode timing; 262 bool is_v13;
179 unsigned int default_win; 263 void (*cfg_hpd)(bool external);
180 unsigned int bpp; 264 int (*get_hpd)(void);
181 unsigned int is_v13:1;
182}; 265};
183 266
184#endif /* __KERNEL__ */ 267#endif /* __KERNEL__ */
diff --git a/include/drm/i915_drm.h b/include/drm/i915_drm.h
index da929bb5b788..f3f82242bf1d 100644
--- a/include/drm/i915_drm.h
+++ b/include/drm/i915_drm.h
@@ -296,7 +296,8 @@ typedef struct drm_i915_irq_wait {
296#define I915_PARAM_HAS_EXEC_CONSTANTS 14 296#define I915_PARAM_HAS_EXEC_CONSTANTS 14
297#define I915_PARAM_HAS_RELAXED_DELTA 15 297#define I915_PARAM_HAS_RELAXED_DELTA 15
298#define I915_PARAM_HAS_GEN7_SOL_RESET 16 298#define I915_PARAM_HAS_GEN7_SOL_RESET 16
299#define I915_PARAM_HAS_LLC 17 299#define I915_PARAM_HAS_LLC 17
300#define I915_PARAM_HAS_ALIASING_PPGTT 18
300 301
301typedef struct drm_i915_getparam { 302typedef struct drm_i915_getparam {
302 int param; 303 int param;
diff --git a/include/drm/radeon_drm.h b/include/drm/radeon_drm.h
index 7c491b4bcf65..58056865b8e9 100644
--- a/include/drm/radeon_drm.h
+++ b/include/drm/radeon_drm.h
@@ -926,7 +926,6 @@ struct drm_radeon_cs_chunk {
926}; 926};
927 927
928/* drm_radeon_cs_reloc.flags */ 928/* drm_radeon_cs_reloc.flags */
929#define RADEON_RELOC_DONT_SYNC 0x01
930 929
931struct drm_radeon_cs_reloc { 930struct drm_radeon_cs_reloc {
932 uint32_t handle; 931 uint32_t handle;
diff --git a/include/drm/ttm/ttm_bo_api.h b/include/drm/ttm/ttm_bo_api.h
index 974c8f801c39..e15f2a89a270 100644
--- a/include/drm/ttm/ttm_bo_api.h
+++ b/include/drm/ttm/ttm_bo_api.h
@@ -124,11 +124,15 @@ struct ttm_mem_reg {
124 * 124 *
125 * @ttm_bo_type_kernel: These buffers are like ttm_bo_type_device buffers, 125 * @ttm_bo_type_kernel: These buffers are like ttm_bo_type_device buffers,
126 * but they cannot be accessed from user-space. For kernel-only use. 126 * but they cannot be accessed from user-space. For kernel-only use.
127 *
128 * @ttm_bo_type_sg: Buffer made from dmabuf sg table shared with another
129 * driver.
127 */ 130 */
128 131
129enum ttm_bo_type { 132enum ttm_bo_type {
130 ttm_bo_type_device, 133 ttm_bo_type_device,
131 ttm_bo_type_kernel 134 ttm_bo_type_kernel,
135 ttm_bo_type_sg
132}; 136};
133 137
134struct ttm_tt; 138struct ttm_tt;
@@ -271,6 +275,8 @@ struct ttm_buffer_object {
271 275
272 unsigned long offset; 276 unsigned long offset;
273 uint32_t cur_placement; 277 uint32_t cur_placement;
278
279 struct sg_table *sg;
274}; 280};
275 281
276/** 282/**
@@ -503,6 +509,7 @@ extern int ttm_bo_init(struct ttm_bo_device *bdev,
503 bool interrubtible, 509 bool interrubtible,
504 struct file *persistent_swap_storage, 510 struct file *persistent_swap_storage,
505 size_t acc_size, 511 size_t acc_size,
512 struct sg_table *sg,
506 void (*destroy) (struct ttm_buffer_object *)); 513 void (*destroy) (struct ttm_buffer_object *));
507 514
508/** 515/**
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h
index d43e892307ff..a05f1b55714d 100644
--- a/include/drm/ttm/ttm_bo_driver.h
+++ b/include/drm/ttm/ttm_bo_driver.h
@@ -81,6 +81,7 @@ struct ttm_backend_func {
81#define TTM_PAGE_FLAG_PERSISTENT_SWAP (1 << 5) 81#define TTM_PAGE_FLAG_PERSISTENT_SWAP (1 << 5)
82#define TTM_PAGE_FLAG_ZERO_ALLOC (1 << 6) 82#define TTM_PAGE_FLAG_ZERO_ALLOC (1 << 6)
83#define TTM_PAGE_FLAG_DMA32 (1 << 7) 83#define TTM_PAGE_FLAG_DMA32 (1 << 7)
84#define TTM_PAGE_FLAG_SG (1 << 8)
84 85
85enum ttm_caching_state { 86enum ttm_caching_state {
86 tt_uncached, 87 tt_uncached,
@@ -116,6 +117,7 @@ struct ttm_tt {
116 struct page **pages; 117 struct page **pages;
117 uint32_t page_flags; 118 uint32_t page_flags;
118 unsigned long num_pages; 119 unsigned long num_pages;
120 struct sg_table *sg; /* for SG objects via dma-buf */
119 struct ttm_bo_global *glob; 121 struct ttm_bo_global *glob;
120 struct ttm_backend *be; 122 struct ttm_backend *be;
121 struct file *swap_storage; 123 struct file *swap_storage;
diff --git a/include/keys/keyring-type.h b/include/keys/keyring-type.h
index 843f872a4b63..cf49159b0e3a 100644
--- a/include/keys/keyring-type.h
+++ b/include/keys/keyring-type.h
@@ -24,7 +24,7 @@ struct keyring_list {
24 unsigned short maxkeys; /* max keys this list can hold */ 24 unsigned short maxkeys; /* max keys this list can hold */
25 unsigned short nkeys; /* number of keys currently held */ 25 unsigned short nkeys; /* number of keys currently held */
26 unsigned short delkey; /* key to be unlinked by RCU */ 26 unsigned short delkey; /* key to be unlinked by RCU */
27 struct key *keys[0]; 27 struct key __rcu *keys[0];
28}; 28};
29 29
30 30
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index 3c9b616c834a..4cd59b95858f 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -167,7 +167,6 @@ header-y += if_arp.h
167header-y += if_bonding.h 167header-y += if_bonding.h
168header-y += if_bridge.h 168header-y += if_bridge.h
169header-y += if_cablemodem.h 169header-y += if_cablemodem.h
170header-y += if_ec.h
171header-y += if_eql.h 170header-y += if_eql.h
172header-y += if_ether.h 171header-y += if_ether.h
173header-y += if_fc.h 172header-y += if_fc.h
@@ -186,7 +185,6 @@ header-y += if_pppox.h
186header-y += if_slip.h 185header-y += if_slip.h
187header-y += if_strip.h 186header-y += if_strip.h
188header-y += if_team.h 187header-y += if_team.h
189header-y += if_tr.h
190header-y += if_tun.h 188header-y += if_tun.h
191header-y += if_tunnel.h 189header-y += if_tunnel.h
192header-y += if_vlan.h 190header-y += if_vlan.h
@@ -240,6 +238,7 @@ header-y += map_to_7segment.h
240header-y += matroxfb.h 238header-y += matroxfb.h
241header-y += mdio.h 239header-y += mdio.h
242header-y += media.h 240header-y += media.h
241header-y += mei.h
243header-y += mempolicy.h 242header-y += mempolicy.h
244header-y += meye.h 243header-y += meye.h
245header-y += mii.h 244header-y += mii.h
@@ -271,6 +270,7 @@ header-y += netfilter_ipv4.h
271header-y += netfilter_ipv6.h 270header-y += netfilter_ipv6.h
272header-y += netlink.h 271header-y += netlink.h
273header-y += netrom.h 272header-y += netrom.h
273header-y += nfc.h
274header-y += nfs.h 274header-y += nfs.h
275header-y += nfs2.h 275header-y += nfs2.h
276header-y += nfs3.h 276header-y += nfs3.h
@@ -332,6 +332,7 @@ header-y += scc.h
332header-y += sched.h 332header-y += sched.h
333header-y += screen_info.h 333header-y += screen_info.h
334header-y += sdla.h 334header-y += sdla.h
335header-y += seccomp.h
335header-y += securebits.h 336header-y += securebits.h
336header-y += selinux_netlink.h 337header-y += selinux_netlink.h
337header-y += sem.h 338header-y += sem.h
@@ -381,7 +382,9 @@ header-y += unistd.h
381header-y += usbdevice_fs.h 382header-y += usbdevice_fs.h
382header-y += utime.h 383header-y += utime.h
383header-y += utsname.h 384header-y += utsname.h
385header-y += uuid.h
384header-y += uvcvideo.h 386header-y += uvcvideo.h
387header-y += v4l2-dv-timings.h
385header-y += v4l2-mediabus.h 388header-y += v4l2-mediabus.h
386header-y += v4l2-subdev.h 389header-y += v4l2-subdev.h
387header-y += veth.h 390header-y += veth.h
diff --git a/include/linux/alarmtimer.h b/include/linux/alarmtimer.h
index 975009e1cbe6..96c5c249b086 100644
--- a/include/linux/alarmtimer.h
+++ b/include/linux/alarmtimer.h
@@ -76,4 +76,7 @@ static inline int alarmtimer_callback_running(struct alarm *timer)
76} 76}
77 77
78 78
79/* Provide way to access the rtc device being used by alarmtimers */
80struct rtc_device *alarmtimer_get_rtcdev(void);
81
79#endif 82#endif
diff --git a/include/linux/amba/bus.h b/include/linux/amba/bus.h
index 8d54f79457ba..d36417158d8f 100644
--- a/include/linux/amba/bus.h
+++ b/include/linux/amba/bus.h
@@ -63,6 +63,14 @@ struct amba_device *amba_device_alloc(const char *, resource_size_t, size_t);
63void amba_device_put(struct amba_device *); 63void amba_device_put(struct amba_device *);
64int amba_device_add(struct amba_device *, struct resource *); 64int amba_device_add(struct amba_device *, struct resource *);
65int amba_device_register(struct amba_device *, struct resource *); 65int amba_device_register(struct amba_device *, struct resource *);
66struct amba_device *amba_apb_device_add(struct device *parent, const char *name,
67 resource_size_t base, size_t size,
68 int irq1, int irq2, void *pdata,
69 unsigned int periphid);
70struct amba_device *amba_ahb_device_add(struct device *parent, const char *name,
71 resource_size_t base, size_t size,
72 int irq1, int irq2, void *pdata,
73 unsigned int periphid);
66void amba_device_unregister(struct amba_device *); 74void amba_device_unregister(struct amba_device *);
67struct amba_device *amba_find_device(const char *, struct device *, unsigned int, unsigned int); 75struct amba_device *amba_find_device(const char *, struct device *, unsigned int, unsigned int);
68int amba_request_regions(struct amba_device *, const char *); 76int amba_request_regions(struct amba_device *, const char *);
diff --git a/include/linux/amba/pl08x.h b/include/linux/amba/pl08x.h
index e64ce2cfee99..02549017212a 100644
--- a/include/linux/amba/pl08x.h
+++ b/include/linux/amba/pl08x.h
@@ -92,6 +92,8 @@ struct pl08x_bus_data {
92 * right now 92 * right now
93 * @serving: the virtual channel currently being served by this physical 93 * @serving: the virtual channel currently being served by this physical
94 * channel 94 * channel
95 * @locked: channel unavailable for the system, e.g. dedicated to secure
96 * world
95 */ 97 */
96struct pl08x_phy_chan { 98struct pl08x_phy_chan {
97 unsigned int id; 99 unsigned int id;
@@ -99,6 +101,7 @@ struct pl08x_phy_chan {
99 spinlock_t lock; 101 spinlock_t lock;
100 int signal; 102 int signal;
101 struct pl08x_dma_chan *serving; 103 struct pl08x_dma_chan *serving;
104 bool locked;
102}; 105};
103 106
104/** 107/**
diff --git a/include/linux/atmlec.h b/include/linux/atmlec.h
index 39c917fd1b96..302791e3ab2b 100644
--- a/include/linux/atmlec.h
+++ b/include/linux/atmlec.h
@@ -21,13 +21,6 @@
21/* Maximum number of LEC interfaces (tweakable) */ 21/* Maximum number of LEC interfaces (tweakable) */
22#define MAX_LEC_ITF 48 22#define MAX_LEC_ITF 48
23 23
24/*
25 * From the total of MAX_LEC_ITF, last NUM_TR_DEVS are reserved for Token Ring.
26 * E.g. if MAX_LEC_ITF = 48 and NUM_TR_DEVS = 8, then lec0-lec39 are for
27 * Ethernet ELANs and lec40-lec47 are for Token Ring ELANS.
28 */
29#define NUM_TR_DEVS 8
30
31typedef enum { 24typedef enum {
32 l_set_mac_addr, 25 l_set_mac_addr,
33 l_del_mac_addr, 26 l_del_mac_addr,
diff --git a/include/linux/audit.h b/include/linux/audit.h
index ed3ef1972496..22f292a917a3 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -463,7 +463,7 @@ extern void audit_putname(const char *name);
463extern void __audit_inode(const char *name, const struct dentry *dentry); 463extern void __audit_inode(const char *name, const struct dentry *dentry);
464extern void __audit_inode_child(const struct dentry *dentry, 464extern void __audit_inode_child(const struct dentry *dentry,
465 const struct inode *parent); 465 const struct inode *parent);
466extern void __audit_seccomp(unsigned long syscall); 466extern void __audit_seccomp(unsigned long syscall, long signr, int code);
467extern void __audit_ptrace(struct task_struct *t); 467extern void __audit_ptrace(struct task_struct *t);
468 468
469static inline int audit_dummy_context(void) 469static inline int audit_dummy_context(void)
@@ -508,10 +508,10 @@ static inline void audit_inode_child(const struct dentry *dentry,
508} 508}
509void audit_core_dumps(long signr); 509void audit_core_dumps(long signr);
510 510
511static inline void audit_seccomp(unsigned long syscall) 511static inline void audit_seccomp(unsigned long syscall, long signr, int code)
512{ 512{
513 if (unlikely(!audit_dummy_context())) 513 if (unlikely(!audit_dummy_context()))
514 __audit_seccomp(syscall); 514 __audit_seccomp(syscall, signr, code);
515} 515}
516 516
517static inline void audit_ptrace(struct task_struct *t) 517static inline void audit_ptrace(struct task_struct *t)
@@ -634,7 +634,7 @@ extern int audit_signals;
634#define audit_inode(n,d) do { (void)(d); } while (0) 634#define audit_inode(n,d) do { (void)(d); } while (0)
635#define audit_inode_child(i,p) do { ; } while (0) 635#define audit_inode_child(i,p) do { ; } while (0)
636#define audit_core_dumps(i) do { ; } while (0) 636#define audit_core_dumps(i) do { ; } while (0)
637#define audit_seccomp(i) do { ; } while (0) 637#define audit_seccomp(i,s,c) do { ; } while (0)
638#define auditsc_get_stamp(c,t,s) (0) 638#define auditsc_get_stamp(c,t,s) (0)
639#define audit_get_loginuid(t) (-1) 639#define audit_get_loginuid(t) (-1)
640#define audit_get_sessionid(t) (-1) 640#define audit_get_sessionid(t) (-1)
diff --git a/include/linux/basic_mmio_gpio.h b/include/linux/basic_mmio_gpio.h
index feb912196745..1c504ca5bdb3 100644
--- a/include/linux/basic_mmio_gpio.h
+++ b/include/linux/basic_mmio_gpio.h
@@ -67,6 +67,10 @@ int bgpio_remove(struct bgpio_chip *bgc);
67int bgpio_init(struct bgpio_chip *bgc, struct device *dev, 67int bgpio_init(struct bgpio_chip *bgc, struct device *dev,
68 unsigned long sz, void __iomem *dat, void __iomem *set, 68 unsigned long sz, void __iomem *dat, void __iomem *set,
69 void __iomem *clr, void __iomem *dirout, void __iomem *dirin, 69 void __iomem *clr, void __iomem *dirout, void __iomem *dirin,
70 bool big_endian); 70 unsigned long flags);
71
72#define BGPIOF_BIG_ENDIAN BIT(0)
73#define BGPIOF_UNREADABLE_REG_SET BIT(1) /* reg_set is unreadable */
74#define BGPIOF_UNREADABLE_REG_DIR BIT(2) /* reg_dir is unreadable */
71 75
72#endif /* __BASIC_MMIO_GPIO_H */ 76#endif /* __BASIC_MMIO_GPIO_H */
diff --git a/include/linux/bcma/bcma.h b/include/linux/bcma/bcma.h
index 5af9a075498f..8deaf6d050c3 100644
--- a/include/linux/bcma/bcma.h
+++ b/include/linux/bcma/bcma.h
@@ -26,6 +26,11 @@ struct bcma_chipinfo {
26 u8 pkg; 26 u8 pkg;
27}; 27};
28 28
29struct bcma_boardinfo {
30 u16 vendor;
31 u16 type;
32};
33
29enum bcma_clkmode { 34enum bcma_clkmode {
30 BCMA_CLKMODE_FAST, 35 BCMA_CLKMODE_FAST,
31 BCMA_CLKMODE_DYNAMIC, 36 BCMA_CLKMODE_DYNAMIC,
@@ -139,6 +144,7 @@ struct bcma_device {
139 u8 core_unit; 144 u8 core_unit;
140 145
141 u32 addr; 146 u32 addr;
147 u32 addr1;
142 u32 wrap; 148 u32 wrap;
143 149
144 void __iomem *io_addr; 150 void __iomem *io_addr;
@@ -198,6 +204,8 @@ struct bcma_bus {
198 204
199 struct bcma_chipinfo chipinfo; 205 struct bcma_chipinfo chipinfo;
200 206
207 struct bcma_boardinfo boardinfo;
208
201 struct bcma_device *mapped_core; 209 struct bcma_device *mapped_core;
202 struct list_head cores; 210 struct list_head cores;
203 u8 nr_cores; 211 u8 nr_cores;
diff --git a/include/linux/bcma/bcma_driver_pci.h b/include/linux/bcma/bcma_driver_pci.h
index 46c71e27d31f..41da581e1612 100644
--- a/include/linux/bcma/bcma_driver_pci.h
+++ b/include/linux/bcma/bcma_driver_pci.h
@@ -87,6 +87,13 @@ struct pci_dev;
87#define BCMA_CORE_PCI_PCICFG2 0x0600 /* PCI config space 2 (rev >= 8) */ 87#define BCMA_CORE_PCI_PCICFG2 0x0600 /* PCI config space 2 (rev >= 8) */
88#define BCMA_CORE_PCI_PCICFG3 0x0700 /* PCI config space 3 (rev >= 8) */ 88#define BCMA_CORE_PCI_PCICFG3 0x0700 /* PCI config space 3 (rev >= 8) */
89#define BCMA_CORE_PCI_SPROM(wordoffset) (0x0800 + ((wordoffset) * 2)) /* SPROM shadow area (72 bytes) */ 89#define BCMA_CORE_PCI_SPROM(wordoffset) (0x0800 + ((wordoffset) * 2)) /* SPROM shadow area (72 bytes) */
90#define BCMA_CORE_PCI_SPROM_PI_OFFSET 0 /* first word */
91#define BCMA_CORE_PCI_SPROM_PI_MASK 0xf000 /* bit 15:12 */
92#define BCMA_CORE_PCI_SPROM_PI_SHIFT 12 /* bit 15:12 */
93#define BCMA_CORE_PCI_SPROM_MISC_CONFIG 5 /* word 5 */
94#define BCMA_CORE_PCI_SPROM_L23READY_EXIT_NOPERST 0x8000 /* bit 15 */
95#define BCMA_CORE_PCI_SPROM_CLKREQ_OFFSET_REV5 20 /* word 20 for srom rev <= 5 */
96#define BCMA_CORE_PCI_SPROM_CLKREQ_ENB 0x0800 /* bit 11 */
90 97
91/* SBtoPCIx */ 98/* SBtoPCIx */
92#define BCMA_CORE_PCI_SBTOPCI_MEM 0x00000000 99#define BCMA_CORE_PCI_SBTOPCI_MEM 0x00000000
@@ -133,6 +140,7 @@ struct pci_dev;
133#define BCMA_CORE_PCI_DLLP_LRREG 0x120 /* Link Replay */ 140#define BCMA_CORE_PCI_DLLP_LRREG 0x120 /* Link Replay */
134#define BCMA_CORE_PCI_DLLP_LACKTOREG 0x124 /* Link Ack Timeout */ 141#define BCMA_CORE_PCI_DLLP_LACKTOREG 0x124 /* Link Ack Timeout */
135#define BCMA_CORE_PCI_DLLP_PMTHRESHREG 0x128 /* Power Management Threshold */ 142#define BCMA_CORE_PCI_DLLP_PMTHRESHREG 0x128 /* Power Management Threshold */
143#define BCMA_CORE_PCI_ASPMTIMER_EXTEND 0x01000000 /* > rev7: enable extend ASPM timer */
136#define BCMA_CORE_PCI_DLLP_RTRYWPREG 0x12C /* Retry buffer write ptr */ 144#define BCMA_CORE_PCI_DLLP_RTRYWPREG 0x12C /* Retry buffer write ptr */
137#define BCMA_CORE_PCI_DLLP_RTRYRPREG 0x130 /* Retry buffer Read ptr */ 145#define BCMA_CORE_PCI_DLLP_RTRYRPREG 0x130 /* Retry buffer Read ptr */
138#define BCMA_CORE_PCI_DLLP_RTRYPPREG 0x134 /* Retry buffer Purged ptr */ 146#define BCMA_CORE_PCI_DLLP_RTRYPPREG 0x134 /* Retry buffer Purged ptr */
@@ -201,12 +209,15 @@ struct bcma_drv_pci {
201}; 209};
202 210
203/* Register access */ 211/* Register access */
212#define pcicore_read16(pc, offset) bcma_read16((pc)->core, offset)
204#define pcicore_read32(pc, offset) bcma_read32((pc)->core, offset) 213#define pcicore_read32(pc, offset) bcma_read32((pc)->core, offset)
214#define pcicore_write16(pc, offset, val) bcma_write16((pc)->core, offset, val)
205#define pcicore_write32(pc, offset, val) bcma_write32((pc)->core, offset, val) 215#define pcicore_write32(pc, offset, val) bcma_write32((pc)->core, offset, val)
206 216
207extern void __devinit bcma_core_pci_init(struct bcma_drv_pci *pc); 217extern void __devinit bcma_core_pci_init(struct bcma_drv_pci *pc);
208extern int bcma_core_pci_irq_ctl(struct bcma_drv_pci *pc, 218extern int bcma_core_pci_irq_ctl(struct bcma_drv_pci *pc,
209 struct bcma_device *core, bool enable); 219 struct bcma_device *core, bool enable);
220extern void bcma_core_pci_extend_L1timer(struct bcma_drv_pci *pc, bool extend);
210 221
211extern int bcma_core_pci_pcibios_map_irq(const struct pci_dev *dev); 222extern int bcma_core_pci_pcibios_map_irq(const struct pci_dev *dev);
212extern int bcma_core_pci_plat_dev_init(struct pci_dev *dev); 223extern int bcma_core_pci_plat_dev_init(struct pci_dev *dev);
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 2aa24664a5b5..4d4ac24a263e 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -1,9 +1,10 @@
1#ifndef _LINUX_BLKDEV_H 1#ifndef _LINUX_BLKDEV_H
2#define _LINUX_BLKDEV_H 2#define _LINUX_BLKDEV_H
3 3
4#include <linux/sched.h>
5
4#ifdef CONFIG_BLOCK 6#ifdef CONFIG_BLOCK
5 7
6#include <linux/sched.h>
7#include <linux/major.h> 8#include <linux/major.h>
8#include <linux/genhd.h> 9#include <linux/genhd.h>
9#include <linux/list.h> 10#include <linux/list.h>
diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h
index 66d3e954eb6c..1a0cd270bb7a 100644
--- a/include/linux/bootmem.h
+++ b/include/linux/bootmem.h
@@ -154,7 +154,8 @@ extern void *alloc_large_system_hash(const char *tablename,
154 int flags, 154 int flags,
155 unsigned int *_hash_shift, 155 unsigned int *_hash_shift,
156 unsigned int *_hash_mask, 156 unsigned int *_hash_mask,
157 unsigned long limit); 157 unsigned long low_limit,
158 unsigned long high_limit);
158 159
159#define HASH_EARLY 0x00000001 /* Allocating during early boot? */ 160#define HASH_EARLY 0x00000001 /* Allocating during early boot? */
160#define HASH_SMALL 0x00000002 /* sub-page allocation allowed, min 161#define HASH_SMALL 0x00000002 /* sub-page allocation allowed, min
diff --git a/include/linux/capability.h b/include/linux/capability.h
index 12d52dedb229..68d56effc328 100644
--- a/include/linux/capability.h
+++ b/include/linux/capability.h
@@ -360,8 +360,11 @@ struct cpu_vfs_cap_data {
360 360
361#define CAP_WAKE_ALARM 35 361#define CAP_WAKE_ALARM 35
362 362
363/* Allow preventing system suspends while epoll events are pending */
363 364
364#define CAP_LAST_CAP CAP_WAKE_ALARM 365#define CAP_EPOLLWAKEUP 36
366
367#define CAP_LAST_CAP CAP_EPOLLWAKEUP
365 368
366#define cap_valid(x) ((x) >= 0 && (x) <= CAP_LAST_CAP) 369#define cap_valid(x) ((x) >= 0 && (x) <= CAP_LAST_CAP)
367 370
@@ -374,6 +377,7 @@ struct cpu_vfs_cap_data {
374 377
375#ifdef __KERNEL__ 378#ifdef __KERNEL__
376 379
380struct inode;
377struct dentry; 381struct dentry;
378struct user_namespace; 382struct user_namespace;
379 383
@@ -548,6 +552,7 @@ extern bool has_ns_capability_noaudit(struct task_struct *t,
548extern bool capable(int cap); 552extern bool capable(int cap);
549extern bool ns_capable(struct user_namespace *ns, int cap); 553extern bool ns_capable(struct user_namespace *ns, int cap);
550extern bool nsown_capable(int cap); 554extern bool nsown_capable(int cap);
555extern bool inode_capable(const struct inode *inode, int cap);
551 556
552/* audit system wants to get cap info from files as well */ 557/* audit system wants to get cap info from files as well */
553extern int get_vfs_caps_from_disk(const struct dentry *dentry, struct cpu_vfs_cap_data *cpu_caps); 558extern int get_vfs_caps_from_disk(const struct dentry *dentry, struct cpu_vfs_cap_data *cpu_caps);
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index 5a85b3415c1b..d3f5fba2c159 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -16,6 +16,7 @@
16#include <linux/prio_heap.h> 16#include <linux/prio_heap.h>
17#include <linux/rwsem.h> 17#include <linux/rwsem.h>
18#include <linux/idr.h> 18#include <linux/idr.h>
19#include <linux/workqueue.h>
19 20
20#ifdef CONFIG_CGROUPS 21#ifdef CONFIG_CGROUPS
21 22
@@ -76,12 +77,16 @@ struct cgroup_subsys_state {
76 unsigned long flags; 77 unsigned long flags;
77 /* ID for this css, if possible */ 78 /* ID for this css, if possible */
78 struct css_id __rcu *id; 79 struct css_id __rcu *id;
80
81 /* Used to put @cgroup->dentry on the last css_put() */
82 struct work_struct dput_work;
79}; 83};
80 84
81/* bits in struct cgroup_subsys_state flags field */ 85/* bits in struct cgroup_subsys_state flags field */
82enum { 86enum {
83 CSS_ROOT, /* This CSS is the root of the subsystem */ 87 CSS_ROOT, /* This CSS is the root of the subsystem */
84 CSS_REMOVED, /* This CSS is dead */ 88 CSS_REMOVED, /* This CSS is dead */
89 CSS_CLEAR_CSS_REFS, /* @ss->__DEPRECATED_clear_css_refs */
85}; 90};
86 91
87/* Caller must verify that the css is not for root cgroup */ 92/* Caller must verify that the css is not for root cgroup */
@@ -115,16 +120,12 @@ static inline bool css_is_removed(struct cgroup_subsys_state *css)
115 * the css has been destroyed. 120 * the css has been destroyed.
116 */ 121 */
117 122
123extern bool __css_tryget(struct cgroup_subsys_state *css);
118static inline bool css_tryget(struct cgroup_subsys_state *css) 124static inline bool css_tryget(struct cgroup_subsys_state *css)
119{ 125{
120 if (test_bit(CSS_ROOT, &css->flags)) 126 if (test_bit(CSS_ROOT, &css->flags))
121 return true; 127 return true;
122 while (!atomic_inc_not_zero(&css->refcnt)) { 128 return __css_tryget(css);
123 if (test_bit(CSS_REMOVED, &css->flags))
124 return false;
125 cpu_relax();
126 }
127 return true;
128} 129}
129 130
130/* 131/*
@@ -132,11 +133,11 @@ static inline bool css_tryget(struct cgroup_subsys_state *css)
132 * css_get() or css_tryget() 133 * css_get() or css_tryget()
133 */ 134 */
134 135
135extern void __css_put(struct cgroup_subsys_state *css, int count); 136extern void __css_put(struct cgroup_subsys_state *css);
136static inline void css_put(struct cgroup_subsys_state *css) 137static inline void css_put(struct cgroup_subsys_state *css)
137{ 138{
138 if (!test_bit(CSS_ROOT, &css->flags)) 139 if (!test_bit(CSS_ROOT, &css->flags))
139 __css_put(css, 1); 140 __css_put(css);
140} 141}
141 142
142/* bits in struct cgroup flags field */ 143/* bits in struct cgroup flags field */
@@ -175,6 +176,7 @@ struct cgroup {
175 */ 176 */
176 struct list_head sibling; /* my parent's children */ 177 struct list_head sibling; /* my parent's children */
177 struct list_head children; /* my children */ 178 struct list_head children; /* my children */
179 struct list_head files; /* my files */
178 180
179 struct cgroup *parent; /* my parent */ 181 struct cgroup *parent; /* my parent */
180 struct dentry __rcu *dentry; /* cgroup fs entry, RCU protected */ 182 struct dentry __rcu *dentry; /* cgroup fs entry, RCU protected */
@@ -191,6 +193,9 @@ struct cgroup {
191 */ 193 */
192 struct list_head css_sets; 194 struct list_head css_sets;
193 195
196 struct list_head allcg_node; /* cgroupfs_root->allcg_list */
197 struct list_head cft_q_node; /* used during cftype add/rm */
198
194 /* 199 /*
195 * Linked list running through all cgroups that can 200 * Linked list running through all cgroups that can
196 * potentially be reaped by the release agent. Protected by 201 * potentially be reaped by the release agent. Protected by
@@ -275,11 +280,17 @@ struct cgroup_map_cb {
275 * - the 'cftype' of the file is file->f_dentry->d_fsdata 280 * - the 'cftype' of the file is file->f_dentry->d_fsdata
276 */ 281 */
277 282
278#define MAX_CFTYPE_NAME 64 283/* cftype->flags */
284#define CFTYPE_ONLY_ON_ROOT (1U << 0) /* only create on root cg */
285#define CFTYPE_NOT_ON_ROOT (1U << 1) /* don't create onp root cg */
286
287#define MAX_CFTYPE_NAME 64
288
279struct cftype { 289struct cftype {
280 /* 290 /*
281 * By convention, the name should begin with the name of the 291 * By convention, the name should begin with the name of the
282 * subsystem, followed by a period 292 * subsystem, followed by a period. Zero length string indicates
293 * end of cftype array.
283 */ 294 */
284 char name[MAX_CFTYPE_NAME]; 295 char name[MAX_CFTYPE_NAME];
285 int private; 296 int private;
@@ -295,6 +306,9 @@ struct cftype {
295 */ 306 */
296 size_t max_write_len; 307 size_t max_write_len;
297 308
309 /* CFTYPE_* flags */
310 unsigned int flags;
311
298 int (*open)(struct inode *inode, struct file *file); 312 int (*open)(struct inode *inode, struct file *file);
299 ssize_t (*read)(struct cgroup *cgrp, struct cftype *cft, 313 ssize_t (*read)(struct cgroup *cgrp, struct cftype *cft,
300 struct file *file, 314 struct file *file,
@@ -373,6 +387,16 @@ struct cftype {
373 struct eventfd_ctx *eventfd); 387 struct eventfd_ctx *eventfd);
374}; 388};
375 389
390/*
391 * cftype_sets describe cftypes belonging to a subsystem and are chained at
392 * cgroup_subsys->cftsets. Each cftset points to an array of cftypes
393 * terminated by zero length name.
394 */
395struct cftype_set {
396 struct list_head node; /* chained at subsys->cftsets */
397 const struct cftype *cfts;
398};
399
376struct cgroup_scanner { 400struct cgroup_scanner {
377 struct cgroup *cg; 401 struct cgroup *cg;
378 int (*test_task)(struct task_struct *p, struct cgroup_scanner *scan); 402 int (*test_task)(struct task_struct *p, struct cgroup_scanner *scan);
@@ -382,21 +406,8 @@ struct cgroup_scanner {
382 void *data; 406 void *data;
383}; 407};
384 408
385/* 409int cgroup_add_cftypes(struct cgroup_subsys *ss, const struct cftype *cfts);
386 * Add a new file to the given cgroup directory. Should only be 410int cgroup_rm_cftypes(struct cgroup_subsys *ss, const struct cftype *cfts);
387 * called by subsystems from within a populate() method
388 */
389int cgroup_add_file(struct cgroup *cgrp, struct cgroup_subsys *subsys,
390 const struct cftype *cft);
391
392/*
393 * Add a set of new files to the given cgroup directory. Should
394 * only be called by subsystems from within a populate() method
395 */
396int cgroup_add_files(struct cgroup *cgrp,
397 struct cgroup_subsys *subsys,
398 const struct cftype cft[],
399 int count);
400 411
401int cgroup_is_removed(const struct cgroup *cgrp); 412int cgroup_is_removed(const struct cgroup *cgrp);
402 413
@@ -461,7 +472,6 @@ struct cgroup_subsys {
461 void (*fork)(struct task_struct *task); 472 void (*fork)(struct task_struct *task);
462 void (*exit)(struct cgroup *cgrp, struct cgroup *old_cgrp, 473 void (*exit)(struct cgroup *cgrp, struct cgroup *old_cgrp,
463 struct task_struct *task); 474 struct task_struct *task);
464 int (*populate)(struct cgroup_subsys *ss, struct cgroup *cgrp);
465 void (*post_clone)(struct cgroup *cgrp); 475 void (*post_clone)(struct cgroup *cgrp);
466 void (*bind)(struct cgroup *root); 476 void (*bind)(struct cgroup *root);
467 477
@@ -474,6 +484,18 @@ struct cgroup_subsys {
474 * (not available in early_init time.) 484 * (not available in early_init time.)
475 */ 485 */
476 bool use_id; 486 bool use_id;
487
488 /*
489 * If %true, cgroup removal will try to clear css refs by retrying
490 * ss->pre_destroy() until there's no css ref left. This behavior
491 * is strictly for backward compatibility and will be removed as
492 * soon as the current user (memcg) is updated.
493 *
494 * If %false, ss->pre_destroy() can't fail and cgroup removal won't
495 * wait for css refs to drop to zero before proceeding.
496 */
497 bool __DEPRECATED_clear_css_refs;
498
477#define MAX_CGROUP_TYPE_NAMELEN 32 499#define MAX_CGROUP_TYPE_NAMELEN 32
478 const char *name; 500 const char *name;
479 501
@@ -500,6 +522,13 @@ struct cgroup_subsys {
500 struct idr idr; 522 struct idr idr;
501 spinlock_t id_lock; 523 spinlock_t id_lock;
502 524
525 /* list of cftype_sets */
526 struct list_head cftsets;
527
528 /* base cftypes, automatically [de]registered with subsys itself */
529 struct cftype *base_cftypes;
530 struct cftype_set base_cftset;
531
503 /* should be defined only by modular subsystems */ 532 /* should be defined only by modular subsystems */
504 struct module *module; 533 struct module *module;
505}; 534};
diff --git a/include/linux/clk-private.h b/include/linux/clk-private.h
index 5e4312b6f5cc..eb3f84bc5325 100644
--- a/include/linux/clk-private.h
+++ b/include/linux/clk-private.h
@@ -30,7 +30,7 @@ struct clk {
30 const struct clk_ops *ops; 30 const struct clk_ops *ops;
31 struct clk_hw *hw; 31 struct clk_hw *hw;
32 struct clk *parent; 32 struct clk *parent;
33 char **parent_names; 33 const char **parent_names;
34 struct clk **parents; 34 struct clk **parents;
35 u8 num_parents; 35 u8 num_parents;
36 unsigned long rate; 36 unsigned long rate;
@@ -55,12 +55,22 @@ struct clk {
55 * alternative macro for static initialization 55 * alternative macro for static initialization
56 */ 56 */
57 57
58extern struct clk_ops clk_fixed_rate_ops; 58#define DEFINE_CLK(_name, _ops, _flags, _parent_names, \
59 _parents) \
60 static struct clk _name = { \
61 .name = #_name, \
62 .ops = &_ops, \
63 .hw = &_name##_hw.hw, \
64 .parent_names = _parent_names, \
65 .num_parents = ARRAY_SIZE(_parent_names), \
66 .parents = _parents, \
67 .flags = _flags, \
68 }
59 69
60#define DEFINE_CLK_FIXED_RATE(_name, _flags, _rate, \ 70#define DEFINE_CLK_FIXED_RATE(_name, _flags, _rate, \
61 _fixed_rate_flags) \ 71 _fixed_rate_flags) \
62 static struct clk _name; \ 72 static struct clk _name; \
63 static char *_name##_parent_names[] = {}; \ 73 static const char *_name##_parent_names[] = {}; \
64 static struct clk_fixed_rate _name##_hw = { \ 74 static struct clk_fixed_rate _name##_hw = { \
65 .hw = { \ 75 .hw = { \
66 .clk = &_name, \ 76 .clk = &_name, \
@@ -68,23 +78,14 @@ extern struct clk_ops clk_fixed_rate_ops;
68 .fixed_rate = _rate, \ 78 .fixed_rate = _rate, \
69 .flags = _fixed_rate_flags, \ 79 .flags = _fixed_rate_flags, \
70 }; \ 80 }; \
71 static struct clk _name = { \ 81 DEFINE_CLK(_name, clk_fixed_rate_ops, _flags, \
72 .name = #_name, \ 82 _name##_parent_names, NULL);
73 .ops = &clk_fixed_rate_ops, \
74 .hw = &_name##_hw.hw, \
75 .parent_names = _name##_parent_names, \
76 .num_parents = \
77 ARRAY_SIZE(_name##_parent_names), \
78 .flags = _flags, \
79 };
80
81extern struct clk_ops clk_gate_ops;
82 83
83#define DEFINE_CLK_GATE(_name, _parent_name, _parent_ptr, \ 84#define DEFINE_CLK_GATE(_name, _parent_name, _parent_ptr, \
84 _flags, _reg, _bit_idx, \ 85 _flags, _reg, _bit_idx, \
85 _gate_flags, _lock) \ 86 _gate_flags, _lock) \
86 static struct clk _name; \ 87 static struct clk _name; \
87 static char *_name##_parent_names[] = { \ 88 static const char *_name##_parent_names[] = { \
88 _parent_name, \ 89 _parent_name, \
89 }; \ 90 }; \
90 static struct clk *_name##_parents[] = { \ 91 static struct clk *_name##_parents[] = { \
@@ -99,24 +100,14 @@ extern struct clk_ops clk_gate_ops;
99 .flags = _gate_flags, \ 100 .flags = _gate_flags, \
100 .lock = _lock, \ 101 .lock = _lock, \
101 }; \ 102 }; \
102 static struct clk _name = { \ 103 DEFINE_CLK(_name, clk_gate_ops, _flags, \
103 .name = #_name, \ 104 _name##_parent_names, _name##_parents);
104 .ops = &clk_gate_ops, \
105 .hw = &_name##_hw.hw, \
106 .parent_names = _name##_parent_names, \
107 .num_parents = \
108 ARRAY_SIZE(_name##_parent_names), \
109 .parents = _name##_parents, \
110 .flags = _flags, \
111 };
112
113extern struct clk_ops clk_divider_ops;
114 105
115#define DEFINE_CLK_DIVIDER(_name, _parent_name, _parent_ptr, \ 106#define DEFINE_CLK_DIVIDER(_name, _parent_name, _parent_ptr, \
116 _flags, _reg, _shift, _width, \ 107 _flags, _reg, _shift, _width, \
117 _divider_flags, _lock) \ 108 _divider_flags, _lock) \
118 static struct clk _name; \ 109 static struct clk _name; \
119 static char *_name##_parent_names[] = { \ 110 static const char *_name##_parent_names[] = { \
120 _parent_name, \ 111 _parent_name, \
121 }; \ 112 }; \
122 static struct clk *_name##_parents[] = { \ 113 static struct clk *_name##_parents[] = { \
@@ -132,18 +123,8 @@ extern struct clk_ops clk_divider_ops;
132 .flags = _divider_flags, \ 123 .flags = _divider_flags, \
133 .lock = _lock, \ 124 .lock = _lock, \
134 }; \ 125 }; \
135 static struct clk _name = { \ 126 DEFINE_CLK(_name, clk_divider_ops, _flags, \
136 .name = #_name, \ 127 _name##_parent_names, _name##_parents);
137 .ops = &clk_divider_ops, \
138 .hw = &_name##_hw.hw, \
139 .parent_names = _name##_parent_names, \
140 .num_parents = \
141 ARRAY_SIZE(_name##_parent_names), \
142 .parents = _name##_parents, \
143 .flags = _flags, \
144 };
145
146extern struct clk_ops clk_mux_ops;
147 128
148#define DEFINE_CLK_MUX(_name, _parent_names, _parents, _flags, \ 129#define DEFINE_CLK_MUX(_name, _parent_names, _parents, _flags, \
149 _reg, _shift, _width, \ 130 _reg, _shift, _width, \
@@ -159,16 +140,28 @@ extern struct clk_ops clk_mux_ops;
159 .flags = _mux_flags, \ 140 .flags = _mux_flags, \
160 .lock = _lock, \ 141 .lock = _lock, \
161 }; \ 142 }; \
162 static struct clk _name = { \ 143 DEFINE_CLK(_name, clk_mux_ops, _flags, _parent_names, \
163 .name = #_name, \ 144 _parents);
164 .ops = &clk_mux_ops, \ 145
165 .hw = &_name##_hw.hw, \ 146#define DEFINE_CLK_FIXED_FACTOR(_name, _parent_name, \
166 .parent_names = _parent_names, \ 147 _parent_ptr, _flags, \
167 .num_parents = \ 148 _mult, _div) \
168 ARRAY_SIZE(_parent_names), \ 149 static struct clk _name; \
169 .parents = _parents, \ 150 static const char *_name##_parent_names[] = { \
170 .flags = _flags, \ 151 _parent_name, \
171 }; 152 }; \
153 static struct clk *_name##_parents[] = { \
154 _parent_ptr, \
155 }; \
156 static struct clk_fixed_factor _name##_hw = { \
157 .hw = { \
158 .clk = &_name, \
159 }, \
160 .mult = _mult, \
161 .div = _div, \
162 }; \
163 DEFINE_CLK(_name, clk_fixed_factor_ops, _flags, \
164 _name##_parent_names, _name##_parents);
172 165
173/** 166/**
174 * __clk_init - initialize the data structures in a struct clk 167 * __clk_init - initialize the data structures in a struct clk
@@ -189,8 +182,12 @@ extern struct clk_ops clk_mux_ops;
189 * 182 *
190 * It is not necessary to call clk_register if __clk_init is used directly with 183 * It is not necessary to call clk_register if __clk_init is used directly with
191 * statically initialized clock data. 184 * statically initialized clock data.
185 *
186 * Returns 0 on success, otherwise an error code.
192 */ 187 */
193void __clk_init(struct device *dev, struct clk *clk); 188int __clk_init(struct device *dev, struct clk *clk);
189
190struct clk *__clk_register(struct device *dev, struct clk_hw *hw);
194 191
195#endif /* CONFIG_COMMON_CLK */ 192#endif /* CONFIG_COMMON_CLK */
196#endif /* CLK_PRIVATE_H */ 193#endif /* CLK_PRIVATE_H */
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
index 5508897ad376..4a0b483986c3 100644
--- a/include/linux/clk-provider.h
+++ b/include/linux/clk-provider.h
@@ -15,19 +15,6 @@
15 15
16#ifdef CONFIG_COMMON_CLK 16#ifdef CONFIG_COMMON_CLK
17 17
18/**
19 * struct clk_hw - handle for traversing from a struct clk to its corresponding
20 * hardware-specific structure. struct clk_hw should be declared within struct
21 * clk_foo and then referenced by the struct clk instance that uses struct
22 * clk_foo's clk_ops
23 *
24 * clk: pointer to the struct clk instance that points back to this struct
25 * clk_hw instance
26 */
27struct clk_hw {
28 struct clk *clk;
29};
30
31/* 18/*
32 * flags used across common struct clk. these flags should only affect the 19 * flags used across common struct clk. these flags should only affect the
33 * top-level framework. custom flags for dealing with hardware specifics 20 * top-level framework. custom flags for dealing with hardware specifics
@@ -39,6 +26,8 @@ struct clk_hw {
39#define CLK_IGNORE_UNUSED BIT(3) /* do not gate even if unused */ 26#define CLK_IGNORE_UNUSED BIT(3) /* do not gate even if unused */
40#define CLK_IS_ROOT BIT(4) /* root clk, has no parent */ 27#define CLK_IS_ROOT BIT(4) /* root clk, has no parent */
41 28
29struct clk_hw;
30
42/** 31/**
43 * struct clk_ops - Callback operations for hardware clocks; these are to 32 * struct clk_ops - Callback operations for hardware clocks; these are to
44 * be provided by the clock implementation, and will be called by drivers 33 * be provided by the clock implementation, and will be called by drivers
@@ -88,19 +77,11 @@ struct clk_hw {
88 * array index into the value programmed into the hardware. 77 * array index into the value programmed into the hardware.
89 * Returns 0 on success, -EERROR otherwise. 78 * Returns 0 on success, -EERROR otherwise.
90 * 79 *
91 * @set_rate: Change the rate of this clock. If this callback returns 80 * @set_rate: Change the rate of this clock. The requested rate is specified
92 * CLK_SET_RATE_PARENT, the rate change will be propagated to the 81 * by the second argument, which should typically be the return
93 * parent clock (which may propagate again if the parent clock 82 * of .round_rate call. The third argument gives the parent rate
94 * also sets this flag). The requested rate of the parent is 83 * which is likely helpful for most .set_rate implementation.
95 * passed back from the callback in the second 'unsigned long *' 84 * Returns 0 on success, -EERROR otherwise.
96 * argument. Note that it is up to the hardware clock's set_rate
97 * implementation to insure that clocks do not run out of spec
98 * when propgating the call to set_rate up to the parent. One way
99 * to do this is to gate the clock (via clk_disable and/or
100 * clk_unprepare) before calling clk_set_rate, then ungating it
101 * afterward. If your clock also has the CLK_GATE_SET_RATE flag
102 * set then this will insure safety. Returns 0 on success,
103 * -EERROR otherwise.
104 * 85 *
105 * The clk_enable/clk_disable and clk_prepare/clk_unprepare pairs allow 86 * The clk_enable/clk_disable and clk_prepare/clk_unprepare pairs allow
106 * implementations to split any work between atomic (enable) and sleepable 87 * implementations to split any work between atomic (enable) and sleepable
@@ -125,10 +106,46 @@ struct clk_ops {
125 unsigned long *); 106 unsigned long *);
126 int (*set_parent)(struct clk_hw *hw, u8 index); 107 int (*set_parent)(struct clk_hw *hw, u8 index);
127 u8 (*get_parent)(struct clk_hw *hw); 108 u8 (*get_parent)(struct clk_hw *hw);
128 int (*set_rate)(struct clk_hw *hw, unsigned long); 109 int (*set_rate)(struct clk_hw *hw, unsigned long,
110 unsigned long);
129 void (*init)(struct clk_hw *hw); 111 void (*init)(struct clk_hw *hw);
130}; 112};
131 113
114/**
115 * struct clk_init_data - holds init data that's common to all clocks and is
116 * shared between the clock provider and the common clock framework.
117 *
118 * @name: clock name
119 * @ops: operations this clock supports
120 * @parent_names: array of string names for all possible parents
121 * @num_parents: number of possible parents
122 * @flags: framework-level hints and quirks
123 */
124struct clk_init_data {
125 const char *name;
126 const struct clk_ops *ops;
127 const char **parent_names;
128 u8 num_parents;
129 unsigned long flags;
130};
131
132/**
133 * struct clk_hw - handle for traversing from a struct clk to its corresponding
134 * hardware-specific structure. struct clk_hw should be declared within struct
135 * clk_foo and then referenced by the struct clk instance that uses struct
136 * clk_foo's clk_ops
137 *
138 * @clk: pointer to the struct clk instance that points back to this struct
139 * clk_hw instance
140 *
141 * @init: pointer to struct clk_init_data that contains the init data shared
142 * with the common clock framework.
143 */
144struct clk_hw {
145 struct clk *clk;
146 struct clk_init_data *init;
147};
148
132/* 149/*
133 * DOC: Basic clock implementations common to many platforms 150 * DOC: Basic clock implementations common to many platforms
134 * 151 *
@@ -149,6 +166,7 @@ struct clk_fixed_rate {
149 u8 flags; 166 u8 flags;
150}; 167};
151 168
169extern const struct clk_ops clk_fixed_rate_ops;
152struct clk *clk_register_fixed_rate(struct device *dev, const char *name, 170struct clk *clk_register_fixed_rate(struct device *dev, const char *name,
153 const char *parent_name, unsigned long flags, 171 const char *parent_name, unsigned long flags,
154 unsigned long fixed_rate); 172 unsigned long fixed_rate);
@@ -165,7 +183,7 @@ struct clk *clk_register_fixed_rate(struct device *dev, const char *name,
165 * Clock which can gate its output. Implements .enable & .disable 183 * Clock which can gate its output. Implements .enable & .disable
166 * 184 *
167 * Flags: 185 * Flags:
168 * CLK_GATE_SET_DISABLE - by default this clock sets the bit at bit_idx to 186 * CLK_GATE_SET_TO_DISABLE - by default this clock sets the bit at bit_idx to
169 * enable the clock. Setting this flag does the opposite: setting the bit 187 * enable the clock. Setting this flag does the opposite: setting the bit
170 * disable the clock and clearing it enables the clock 188 * disable the clock and clearing it enables the clock
171 */ 189 */
@@ -175,11 +193,11 @@ struct clk_gate {
175 u8 bit_idx; 193 u8 bit_idx;
176 u8 flags; 194 u8 flags;
177 spinlock_t *lock; 195 spinlock_t *lock;
178 char *parent[1];
179}; 196};
180 197
181#define CLK_GATE_SET_TO_DISABLE BIT(0) 198#define CLK_GATE_SET_TO_DISABLE BIT(0)
182 199
200extern const struct clk_ops clk_gate_ops;
183struct clk *clk_register_gate(struct device *dev, const char *name, 201struct clk *clk_register_gate(struct device *dev, const char *name,
184 const char *parent_name, unsigned long flags, 202 const char *parent_name, unsigned long flags,
185 void __iomem *reg, u8 bit_idx, 203 void __iomem *reg, u8 bit_idx,
@@ -212,12 +230,12 @@ struct clk_divider {
212 u8 width; 230 u8 width;
213 u8 flags; 231 u8 flags;
214 spinlock_t *lock; 232 spinlock_t *lock;
215 char *parent[1];
216}; 233};
217 234
218#define CLK_DIVIDER_ONE_BASED BIT(0) 235#define CLK_DIVIDER_ONE_BASED BIT(0)
219#define CLK_DIVIDER_POWER_OF_TWO BIT(1) 236#define CLK_DIVIDER_POWER_OF_TWO BIT(1)
220 237
238extern const struct clk_ops clk_divider_ops;
221struct clk *clk_register_divider(struct device *dev, const char *name, 239struct clk *clk_register_divider(struct device *dev, const char *name,
222 const char *parent_name, unsigned long flags, 240 const char *parent_name, unsigned long flags,
223 void __iomem *reg, u8 shift, u8 width, 241 void __iomem *reg, u8 shift, u8 width,
@@ -238,7 +256,7 @@ struct clk *clk_register_divider(struct device *dev, const char *name,
238 * 256 *
239 * Flags: 257 * Flags:
240 * CLK_MUX_INDEX_ONE - register index starts at 1, not 0 258 * CLK_MUX_INDEX_ONE - register index starts at 1, not 0
241 * CLK_MUX_INDEX_BITWISE - register index is a single bit (power of two) 259 * CLK_MUX_INDEX_BIT - register index is a single bit (power of two)
242 */ 260 */
243struct clk_mux { 261struct clk_mux {
244 struct clk_hw hw; 262 struct clk_hw hw;
@@ -252,29 +270,49 @@ struct clk_mux {
252#define CLK_MUX_INDEX_ONE BIT(0) 270#define CLK_MUX_INDEX_ONE BIT(0)
253#define CLK_MUX_INDEX_BIT BIT(1) 271#define CLK_MUX_INDEX_BIT BIT(1)
254 272
273extern const struct clk_ops clk_mux_ops;
255struct clk *clk_register_mux(struct device *dev, const char *name, 274struct clk *clk_register_mux(struct device *dev, const char *name,
256 char **parent_names, u8 num_parents, unsigned long flags, 275 const char **parent_names, u8 num_parents, unsigned long flags,
257 void __iomem *reg, u8 shift, u8 width, 276 void __iomem *reg, u8 shift, u8 width,
258 u8 clk_mux_flags, spinlock_t *lock); 277 u8 clk_mux_flags, spinlock_t *lock);
259 278
260/** 279/**
280 * struct clk_fixed_factor - fixed multiplier and divider clock
281 *
282 * @hw: handle between common and hardware-specific interfaces
283 * @mult: multiplier
284 * @div: divider
285 *
286 * Clock with a fixed multiplier and divider. The output frequency is the
287 * parent clock rate divided by div and multiplied by mult.
288 * Implements .recalc_rate, .set_rate and .round_rate
289 */
290
291struct clk_fixed_factor {
292 struct clk_hw hw;
293 unsigned int mult;
294 unsigned int div;
295};
296
297extern struct clk_ops clk_fixed_factor_ops;
298struct clk *clk_register_fixed_factor(struct device *dev, const char *name,
299 const char *parent_name, unsigned long flags,
300 unsigned int mult, unsigned int div);
301
302/**
261 * clk_register - allocate a new clock, register it and return an opaque cookie 303 * clk_register - allocate a new clock, register it and return an opaque cookie
262 * @dev: device that is registering this clock 304 * @dev: device that is registering this clock
263 * @name: clock name
264 * @ops: operations this clock supports
265 * @hw: link to hardware-specific clock data 305 * @hw: link to hardware-specific clock data
266 * @parent_names: array of string names for all possible parents
267 * @num_parents: number of possible parents
268 * @flags: framework-level hints and quirks
269 * 306 *
270 * clk_register is the primary interface for populating the clock tree with new 307 * clk_register is the primary interface for populating the clock tree with new
271 * clock nodes. It returns a pointer to the newly allocated struct clk which 308 * clock nodes. It returns a pointer to the newly allocated struct clk which
272 * cannot be dereferenced by driver code but may be used in conjuction with the 309 * cannot be dereferenced by driver code but may be used in conjuction with the
273 * rest of the clock API. 310 * rest of the clock API. In the event of an error clk_register will return an
311 * error code; drivers must test for an error code after calling clk_register.
274 */ 312 */
275struct clk *clk_register(struct device *dev, const char *name, 313struct clk *clk_register(struct device *dev, struct clk_hw *hw);
276 const struct clk_ops *ops, struct clk_hw *hw, 314
277 char **parent_names, u8 num_parents, unsigned long flags); 315void clk_unregister(struct clk *clk);
278 316
279/* helper functions */ 317/* helper functions */
280const char *__clk_get_name(struct clk *clk); 318const char *__clk_get_name(struct clk *clk);
diff --git a/include/linux/clk.h b/include/linux/clk.h
index b0252726df61..ad5c43e8ae8a 100644
--- a/include/linux/clk.h
+++ b/include/linux/clk.h
@@ -81,7 +81,7 @@ int clk_notifier_register(struct clk *clk, struct notifier_block *nb);
81 81
82int clk_notifier_unregister(struct clk *clk, struct notifier_block *nb); 82int clk_notifier_unregister(struct clk *clk, struct notifier_block *nb);
83 83
84#endif /* !CONFIG_COMMON_CLK */ 84#endif
85 85
86/** 86/**
87 * clk_get - lookup and obtain a reference to a clock producer. 87 * clk_get - lookup and obtain a reference to a clock producer.
@@ -101,6 +101,26 @@ int clk_notifier_unregister(struct clk *clk, struct notifier_block *nb);
101struct clk *clk_get(struct device *dev, const char *id); 101struct clk *clk_get(struct device *dev, const char *id);
102 102
103/** 103/**
104 * devm_clk_get - lookup and obtain a managed reference to a clock producer.
105 * @dev: device for clock "consumer"
106 * @id: clock comsumer ID
107 *
108 * Returns a struct clk corresponding to the clock producer, or
109 * valid IS_ERR() condition containing errno. The implementation
110 * uses @dev and @id to determine the clock consumer, and thereby
111 * the clock producer. (IOW, @id may be identical strings, but
112 * clk_get may return different clock producers depending on @dev.)
113 *
114 * Drivers must assume that the clock source is not enabled.
115 *
116 * devm_clk_get should not be called from within interrupt context.
117 *
118 * The clock will automatically be freed when the device is unbound
119 * from the bus.
120 */
121struct clk *devm_clk_get(struct device *dev, const char *id);
122
123/**
104 * clk_prepare - prepare a clock source 124 * clk_prepare - prepare a clock source
105 * @clk: clock source 125 * @clk: clock source
106 * 126 *
@@ -206,6 +226,18 @@ unsigned long clk_get_rate(struct clk *clk);
206 */ 226 */
207void clk_put(struct clk *clk); 227void clk_put(struct clk *clk);
208 228
229/**
230 * devm_clk_put - "free" a managed clock source
231 * @dev: device used to acuqire the clock
232 * @clk: clock source acquired with devm_clk_get()
233 *
234 * Note: drivers must ensure that all clk_enable calls made on this
235 * clock source are balanced by clk_disable calls prior to calling
236 * this function.
237 *
238 * clk_put should not be called from within interrupt context.
239 */
240void devm_clk_put(struct device *dev, struct clk *clk);
209 241
210/* 242/*
211 * The remaining APIs are optional for machine class support. 243 * The remaining APIs are optional for machine class support.
@@ -220,7 +252,7 @@ void clk_put(struct clk *clk);
220 * Returns rounded clock rate in Hz, or negative errno. 252 * Returns rounded clock rate in Hz, or negative errno.
221 */ 253 */
222long clk_round_rate(struct clk *clk, unsigned long rate); 254long clk_round_rate(struct clk *clk, unsigned long rate);
223 255
224/** 256/**
225 * clk_set_rate - set the clock rate for a clock source 257 * clk_set_rate - set the clock rate for a clock source
226 * @clk: clock source 258 * @clk: clock source
@@ -229,7 +261,7 @@ long clk_round_rate(struct clk *clk, unsigned long rate);
229 * Returns success (0) or negative errno. 261 * Returns success (0) or negative errno.
230 */ 262 */
231int clk_set_rate(struct clk *clk, unsigned long rate); 263int clk_set_rate(struct clk *clk, unsigned long rate);
232 264
233/** 265/**
234 * clk_set_parent - set the parent clock source for this clock 266 * clk_set_parent - set the parent clock source for this clock
235 * @clk: clock source 267 * @clk: clock source
diff --git a/include/linux/clkdev.h b/include/linux/clkdev.h
index d9a4fd028c9d..a6a6f603103b 100644
--- a/include/linux/clkdev.h
+++ b/include/linux/clkdev.h
@@ -40,4 +40,7 @@ void clkdev_drop(struct clk_lookup *cl);
40void clkdev_add_table(struct clk_lookup *, size_t); 40void clkdev_add_table(struct clk_lookup *, size_t);
41int clk_add_alias(const char *, const char *, char *, struct device *); 41int clk_add_alias(const char *, const char *, char *, struct device *);
42 42
43int clk_register_clkdev(struct clk *, const char *, const char *, ...);
44int clk_register_clkdevs(struct clk *, struct clk_lookup *, size_t);
45
43#endif 46#endif
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index ee28844ae68e..7230bb59a06f 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -36,8 +36,6 @@ extern void cpu_remove_dev_attr(struct device_attribute *attr);
36extern int cpu_add_dev_attr_group(struct attribute_group *attrs); 36extern int cpu_add_dev_attr_group(struct attribute_group *attrs);
37extern void cpu_remove_dev_attr_group(struct attribute_group *attrs); 37extern void cpu_remove_dev_attr_group(struct attribute_group *attrs);
38 38
39extern int sched_create_sysfs_power_savings_entries(struct device *dev);
40
41#ifdef CONFIG_HOTPLUG_CPU 39#ifdef CONFIG_HOTPLUG_CPU
42extern void unregister_cpu(struct cpu *cpu); 40extern void unregister_cpu(struct cpu *cpu);
43extern ssize_t arch_cpu_probe(const char *, size_t); 41extern ssize_t arch_cpu_probe(const char *, size_t);
diff --git a/include/linux/cred.h b/include/linux/cred.h
index adadf71a7327..917dc5aeb1d4 100644
--- a/include/linux/cred.h
+++ b/include/linux/cred.h
@@ -17,6 +17,7 @@
17#include <linux/key.h> 17#include <linux/key.h>
18#include <linux/selinux.h> 18#include <linux/selinux.h>
19#include <linux/atomic.h> 19#include <linux/atomic.h>
20#include <linux/uidgid.h>
20 21
21struct user_struct; 22struct user_struct;
22struct cred; 23struct cred;
@@ -26,14 +27,14 @@ struct inode;
26 * COW Supplementary groups list 27 * COW Supplementary groups list
27 */ 28 */
28#define NGROUPS_SMALL 32 29#define NGROUPS_SMALL 32
29#define NGROUPS_PER_BLOCK ((unsigned int)(PAGE_SIZE / sizeof(gid_t))) 30#define NGROUPS_PER_BLOCK ((unsigned int)(PAGE_SIZE / sizeof(kgid_t)))
30 31
31struct group_info { 32struct group_info {
32 atomic_t usage; 33 atomic_t usage;
33 int ngroups; 34 int ngroups;
34 int nblocks; 35 int nblocks;
35 gid_t small_block[NGROUPS_SMALL]; 36 kgid_t small_block[NGROUPS_SMALL];
36 gid_t *blocks[0]; 37 kgid_t *blocks[0];
37}; 38};
38 39
39/** 40/**
@@ -66,14 +67,14 @@ extern struct group_info init_groups;
66extern void groups_free(struct group_info *); 67extern void groups_free(struct group_info *);
67extern int set_current_groups(struct group_info *); 68extern int set_current_groups(struct group_info *);
68extern int set_groups(struct cred *, struct group_info *); 69extern int set_groups(struct cred *, struct group_info *);
69extern int groups_search(const struct group_info *, gid_t); 70extern int groups_search(const struct group_info *, kgid_t);
70 71
71/* access the groups "array" with this macro */ 72/* access the groups "array" with this macro */
72#define GROUP_AT(gi, i) \ 73#define GROUP_AT(gi, i) \
73 ((gi)->blocks[(i) / NGROUPS_PER_BLOCK][(i) % NGROUPS_PER_BLOCK]) 74 ((gi)->blocks[(i) / NGROUPS_PER_BLOCK][(i) % NGROUPS_PER_BLOCK])
74 75
75extern int in_group_p(gid_t); 76extern int in_group_p(kgid_t);
76extern int in_egroup_p(gid_t); 77extern int in_egroup_p(kgid_t);
77 78
78/* 79/*
79 * The common credentials for a thread group 80 * The common credentials for a thread group
@@ -122,14 +123,14 @@ struct cred {
122#define CRED_MAGIC 0x43736564 123#define CRED_MAGIC 0x43736564
123#define CRED_MAGIC_DEAD 0x44656144 124#define CRED_MAGIC_DEAD 0x44656144
124#endif 125#endif
125 uid_t uid; /* real UID of the task */ 126 kuid_t uid; /* real UID of the task */
126 gid_t gid; /* real GID of the task */ 127 kgid_t gid; /* real GID of the task */
127 uid_t suid; /* saved UID of the task */ 128 kuid_t suid; /* saved UID of the task */
128 gid_t sgid; /* saved GID of the task */ 129 kgid_t sgid; /* saved GID of the task */
129 uid_t euid; /* effective UID of the task */ 130 kuid_t euid; /* effective UID of the task */
130 gid_t egid; /* effective GID of the task */ 131 kgid_t egid; /* effective GID of the task */
131 uid_t fsuid; /* UID for VFS ops */ 132 kuid_t fsuid; /* UID for VFS ops */
132 gid_t fsgid; /* GID for VFS ops */ 133 kgid_t fsgid; /* GID for VFS ops */
133 unsigned securebits; /* SUID-less security management */ 134 unsigned securebits; /* SUID-less security management */
134 kernel_cap_t cap_inheritable; /* caps our children can inherit */ 135 kernel_cap_t cap_inheritable; /* caps our children can inherit */
135 kernel_cap_t cap_permitted; /* caps we're permitted */ 136 kernel_cap_t cap_permitted; /* caps we're permitted */
@@ -146,7 +147,7 @@ struct cred {
146 void *security; /* subjective LSM security */ 147 void *security; /* subjective LSM security */
147#endif 148#endif
148 struct user_struct *user; /* real user ID subscription */ 149 struct user_struct *user; /* real user ID subscription */
149 struct user_namespace *user_ns; /* cached user->user_ns */ 150 struct user_namespace *user_ns; /* user_ns the caps and keyrings are relative to. */
150 struct group_info *group_info; /* supplementary groups for euid/fsgid */ 151 struct group_info *group_info; /* supplementary groups for euid/fsgid */
151 struct rcu_head rcu; /* RCU deletion hook */ 152 struct rcu_head rcu; /* RCU deletion hook */
152}; 153};
@@ -357,11 +358,11 @@ static inline void put_cred(const struct cred *_cred)
357#define current_user() (current_cred_xxx(user)) 358#define current_user() (current_cred_xxx(user))
358#define current_security() (current_cred_xxx(security)) 359#define current_security() (current_cred_xxx(security))
359 360
361extern struct user_namespace init_user_ns;
360#ifdef CONFIG_USER_NS 362#ifdef CONFIG_USER_NS
361#define current_user_ns() (current_cred_xxx(user_ns)) 363#define current_user_ns() (current_cred_xxx(user_ns))
362#define task_user_ns(task) (task_cred_xxx((task), user_ns)) 364#define task_user_ns(task) (task_cred_xxx((task), user_ns))
363#else 365#else
364extern struct user_namespace init_user_ns;
365#define current_user_ns() (&init_user_ns) 366#define current_user_ns() (&init_user_ns)
366#define task_user_ns(task) (&init_user_ns) 367#define task_user_ns(task) (&init_user_ns)
367#endif 368#endif
diff --git a/include/linux/cs5535.h b/include/linux/cs5535.h
index c077aec3a6ff..cfe83239d7f0 100644
--- a/include/linux/cs5535.h
+++ b/include/linux/cs5535.h
@@ -95,6 +95,7 @@ static inline int cs5535_pic_unreqz_select_high(unsigned int group,
95 95
96/* CS5536_PM1_STS bits */ 96/* CS5536_PM1_STS bits */
97#define CS5536_WAK_FLAG (1 << 15) 97#define CS5536_WAK_FLAG (1 << 15)
98#define CS5536_RTC_FLAG (1 << 10)
98#define CS5536_PWRBTN_FLAG (1 << 8) 99#define CS5536_PWRBTN_FLAG (1 << 8)
99 100
100/* CS5536_PM1_EN bits */ 101/* CS5536_PM1_EN bits */
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index 7e11f1418203..094789ff3e9f 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -25,6 +25,13 @@ struct vfsmount;
25 25
26#define IS_ROOT(x) ((x) == (x)->d_parent) 26#define IS_ROOT(x) ((x) == (x)->d_parent)
27 27
28/* The hash is always the low bits of hash_len */
29#ifdef __LITTLE_ENDIAN
30 #define HASH_LEN_DECLARE u32 hash; u32 len;
31#else
32 #define HASH_LEN_DECLARE u32 len; u32 hash;
33#endif
34
28/* 35/*
29 * "quick string" -- eases parameter passing, but more importantly 36 * "quick string" -- eases parameter passing, but more importantly
30 * saves "metadata" about the string (ie length and the hash). 37 * saves "metadata" about the string (ie length and the hash).
@@ -33,11 +40,19 @@ struct vfsmount;
33 * dentry. 40 * dentry.
34 */ 41 */
35struct qstr { 42struct qstr {
36 unsigned int hash; 43 union {
37 unsigned int len; 44 struct {
45 HASH_LEN_DECLARE;
46 };
47 u64 hash_len;
48 };
38 const unsigned char *name; 49 const unsigned char *name;
39}; 50};
40 51
52#define QSTR_INIT(n,l) { { { .len = l } }, .name = n }
53#define hashlen_hash(hashlen) ((u32) (hashlen))
54#define hashlen_len(hashlen) ((u32)((hashlen) >> 32))
55
41struct dentry_stat_t { 56struct dentry_stat_t {
42 int nr_dentry; 57 int nr_dentry;
43 int nr_unused; 58 int nr_unused;
@@ -282,7 +297,7 @@ extern struct dentry *d_hash_and_lookup(struct dentry *, struct qstr *);
282extern struct dentry *__d_lookup(struct dentry *, struct qstr *); 297extern struct dentry *__d_lookup(struct dentry *, struct qstr *);
283extern struct dentry *__d_lookup_rcu(const struct dentry *parent, 298extern struct dentry *__d_lookup_rcu(const struct dentry *parent,
284 const struct qstr *name, 299 const struct qstr *name,
285 unsigned *seq, struct inode **inode); 300 unsigned *seq, struct inode *inode);
286 301
287/** 302/**
288 * __d_rcu_to_refcount - take a refcount on dentry if sequence check is ok 303 * __d_rcu_to_refcount - take a refcount on dentry if sequence check is ok
diff --git a/include/linux/dcbnl.h b/include/linux/dcbnl.h
index 65a2562f66b4..6bb43382f3f3 100644
--- a/include/linux/dcbnl.h
+++ b/include/linux/dcbnl.h
@@ -67,6 +67,17 @@ struct ieee_ets {
67 __u8 reco_prio_tc[IEEE_8021QAZ_MAX_TCS]; 67 __u8 reco_prio_tc[IEEE_8021QAZ_MAX_TCS];
68}; 68};
69 69
70/* This structure contains rate limit extension to the IEEE 802.1Qaz ETS
71 * managed object.
72 * Values are 64 bits long and specified in Kbps to enable usage over both
73 * slow and very fast networks.
74 *
75 * @tc_maxrate: maximal tc tx bandwidth indexed by traffic class
76 */
77struct ieee_maxrate {
78 __u64 tc_maxrate[IEEE_8021QAZ_MAX_TCS];
79};
80
70/* This structure contains the IEEE 802.1Qaz PFC managed object 81/* This structure contains the IEEE 802.1Qaz PFC managed object
71 * 82 *
72 * @pfc_cap: Indicates the number of traffic classes on the local device 83 * @pfc_cap: Indicates the number of traffic classes on the local device
@@ -321,6 +332,7 @@ enum ieee_attrs {
321 DCB_ATTR_IEEE_PEER_ETS, 332 DCB_ATTR_IEEE_PEER_ETS,
322 DCB_ATTR_IEEE_PEER_PFC, 333 DCB_ATTR_IEEE_PEER_PFC,
323 DCB_ATTR_IEEE_PEER_APP, 334 DCB_ATTR_IEEE_PEER_APP,
335 DCB_ATTR_IEEE_MAXRATE,
324 __DCB_ATTR_IEEE_MAX 336 __DCB_ATTR_IEEE_MAX
325}; 337};
326#define DCB_ATTR_IEEE_MAX (__DCB_ATTR_IEEE_MAX - 1) 338#define DCB_ATTR_IEEE_MAX (__DCB_ATTR_IEEE_MAX - 1)
diff --git a/include/linux/dccp.h b/include/linux/dccp.h
index eaf95a023af4..d16294e2a118 100644
--- a/include/linux/dccp.h
+++ b/include/linux/dccp.h
@@ -549,6 +549,8 @@ static inline const char *dccp_role(const struct sock *sk)
549 return NULL; 549 return NULL;
550} 550}
551 551
552extern void dccp_syn_ack_timeout(struct sock *sk, struct request_sock *req);
553
552#endif /* __KERNEL__ */ 554#endif /* __KERNEL__ */
553 555
554#endif /* _LINUX_DCCP_H */ 556#endif /* _LINUX_DCCP_H */
diff --git a/include/linux/debugfs.h b/include/linux/debugfs.h
index ae36b72c22f3..66c434f5dd1e 100644
--- a/include/linux/debugfs.h
+++ b/include/linux/debugfs.h
@@ -93,6 +93,10 @@ struct dentry *debugfs_create_regset32(const char *name, umode_t mode,
93int debugfs_print_regs32(struct seq_file *s, const struct debugfs_reg32 *regs, 93int debugfs_print_regs32(struct seq_file *s, const struct debugfs_reg32 *regs,
94 int nregs, void __iomem *base, char *prefix); 94 int nregs, void __iomem *base, char *prefix);
95 95
96struct dentry *debugfs_create_u32_array(const char *name, umode_t mode,
97 struct dentry *parent,
98 u32 *array, u32 elements);
99
96bool debugfs_initialized(void); 100bool debugfs_initialized(void);
97 101
98#else 102#else
@@ -219,6 +223,13 @@ static inline bool debugfs_initialized(void)
219 return false; 223 return false;
220} 224}
221 225
226static inline struct dentry *debugfs_create_u32_array(const char *name, umode_t mode,
227 struct dentry *parent,
228 u32 *array, u32 elements)
229{
230 return ERR_PTR(-ENODEV);
231}
232
222#endif 233#endif
223 234
224#endif 235#endif
diff --git a/include/linux/device.h b/include/linux/device.h
index 5ad17cccdd71..161d96241b1b 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -23,6 +23,7 @@
23#include <linux/mutex.h> 23#include <linux/mutex.h>
24#include <linux/pm.h> 24#include <linux/pm.h>
25#include <linux/atomic.h> 25#include <linux/atomic.h>
26#include <linux/ratelimit.h>
26#include <asm/device.h> 27#include <asm/device.h>
27 28
28struct device; 29struct device;
@@ -502,7 +503,10 @@ ssize_t device_store_int(struct device *dev, struct device_attribute *attr,
502 { __ATTR(_name, _mode, device_show_ulong, device_store_ulong), &(_var) } 503 { __ATTR(_name, _mode, device_show_ulong, device_store_ulong), &(_var) }
503#define DEVICE_INT_ATTR(_name, _mode, _var) \ 504#define DEVICE_INT_ATTR(_name, _mode, _var) \
504 struct dev_ext_attribute dev_attr_##_name = \ 505 struct dev_ext_attribute dev_attr_##_name = \
505 { __ATTR(_name, _mode, device_show_ulong, device_store_ulong), &(_var) } 506 { __ATTR(_name, _mode, device_show_int, device_store_int), &(_var) }
507#define DEVICE_ATTR_IGNORE_LOCKDEP(_name, _mode, _show, _store) \
508 struct device_attribute dev_attr_##_name = \
509 __ATTR_IGNORE_LOCKDEP(_name, _mode, _show, _store)
506 510
507extern int device_create_file(struct device *device, 511extern int device_create_file(struct device *device,
508 const struct device_attribute *entry); 512 const struct device_attribute *entry);
@@ -541,6 +545,8 @@ extern void *devres_remove(struct device *dev, dr_release_t release,
541 dr_match_t match, void *match_data); 545 dr_match_t match, void *match_data);
542extern int devres_destroy(struct device *dev, dr_release_t release, 546extern int devres_destroy(struct device *dev, dr_release_t release,
543 dr_match_t match, void *match_data); 547 dr_match_t match, void *match_data);
548extern int devres_release(struct device *dev, dr_release_t release,
549 dr_match_t match, void *match_data);
544 550
545/* devres group */ 551/* devres group */
546extern void * __must_check devres_open_group(struct device *dev, void *id, 552extern void * __must_check devres_open_group(struct device *dev, void *id,
@@ -661,6 +667,10 @@ struct device {
661 667
662 struct dma_coherent_mem *dma_mem; /* internal for coherent mem 668 struct dma_coherent_mem *dma_mem; /* internal for coherent mem
663 override */ 669 override */
670#ifdef CONFIG_CMA
671 struct cma *cma_area; /* contiguous memory area for dma
672 allocations */
673#endif
664 /* arch specific additions */ 674 /* arch specific additions */
665 struct dev_archdata archdata; 675 struct dev_archdata archdata;
666 676
@@ -931,6 +941,32 @@ int _dev_info(const struct device *dev, const char *fmt, ...)
931 941
932#endif 942#endif
933 943
944#define dev_level_ratelimited(dev_level, dev, fmt, ...) \
945do { \
946 static DEFINE_RATELIMIT_STATE(_rs, \
947 DEFAULT_RATELIMIT_INTERVAL, \
948 DEFAULT_RATELIMIT_BURST); \
949 if (__ratelimit(&_rs)) \
950 dev_level(dev, fmt, ##__VA_ARGS__); \
951} while (0)
952
953#define dev_emerg_ratelimited(dev, fmt, ...) \
954 dev_level_ratelimited(dev_emerg, dev, fmt, ##__VA_ARGS__)
955#define dev_alert_ratelimited(dev, fmt, ...) \
956 dev_level_ratelimited(dev_alert, dev, fmt, ##__VA_ARGS__)
957#define dev_crit_ratelimited(dev, fmt, ...) \
958 dev_level_ratelimited(dev_crit, dev, fmt, ##__VA_ARGS__)
959#define dev_err_ratelimited(dev, fmt, ...) \
960 dev_level_ratelimited(dev_err, dev, fmt, ##__VA_ARGS__)
961#define dev_warn_ratelimited(dev, fmt, ...) \
962 dev_level_ratelimited(dev_warn, dev, fmt, ##__VA_ARGS__)
963#define dev_notice_ratelimited(dev, fmt, ...) \
964 dev_level_ratelimited(dev_notice, dev, fmt, ##__VA_ARGS__)
965#define dev_info_ratelimited(dev, fmt, ...) \
966 dev_level_ratelimited(dev_info, dev, fmt, ##__VA_ARGS__)
967#define dev_dbg_ratelimited(dev, fmt, ...) \
968 dev_level_ratelimited(dev_dbg, dev, fmt, ##__VA_ARGS__)
969
934/* 970/*
935 * Stupid hackaround for existing uses of non-printk uses dev_info 971 * Stupid hackaround for existing uses of non-printk uses dev_info
936 * 972 *
diff --git a/include/linux/dlm.h b/include/linux/dlm.h
index 6c7f6e9546c7..520152411cd1 100644
--- a/include/linux/dlm.h
+++ b/include/linux/dlm.h
@@ -67,7 +67,6 @@ struct dlm_lksb {
67 67
68/* dlm_new_lockspace() flags */ 68/* dlm_new_lockspace() flags */
69 69
70#define DLM_LSFL_NODIR 0x00000001
71#define DLM_LSFL_TIMEWARN 0x00000002 70#define DLM_LSFL_TIMEWARN 0x00000002
72#define DLM_LSFL_FS 0x00000004 71#define DLM_LSFL_FS 0x00000004
73#define DLM_LSFL_NEWEXCL 0x00000008 72#define DLM_LSFL_NEWEXCL 0x00000008
diff --git a/include/linux/dma-buf.h b/include/linux/dma-buf.h
index 3efbfc2145c3..eb48f3816df9 100644
--- a/include/linux/dma-buf.h
+++ b/include/linux/dma-buf.h
@@ -61,6 +61,13 @@ struct dma_buf_attachment;
61 * This Callback must not sleep. 61 * This Callback must not sleep.
62 * @kmap: maps a page from the buffer into kernel address space. 62 * @kmap: maps a page from the buffer into kernel address space.
63 * @kunmap: [optional] unmaps a page from the buffer. 63 * @kunmap: [optional] unmaps a page from the buffer.
64 * @mmap: used to expose the backing storage to userspace. Note that the
65 * mapping needs to be coherent - if the exporter doesn't directly
66 * support this, it needs to fake coherency by shooting down any ptes
67 * when transitioning away from the cpu domain.
68 * @vmap: [optional] creates a virtual mapping for the buffer into kernel
69 * address space. Same restrictions as for vmap and friends apply.
70 * @vunmap: [optional] unmaps a vmap from the buffer
64 */ 71 */
65struct dma_buf_ops { 72struct dma_buf_ops {
66 int (*attach)(struct dma_buf *, struct device *, 73 int (*attach)(struct dma_buf *, struct device *,
@@ -92,6 +99,11 @@ struct dma_buf_ops {
92 void (*kunmap_atomic)(struct dma_buf *, unsigned long, void *); 99 void (*kunmap_atomic)(struct dma_buf *, unsigned long, void *);
93 void *(*kmap)(struct dma_buf *, unsigned long); 100 void *(*kmap)(struct dma_buf *, unsigned long);
94 void (*kunmap)(struct dma_buf *, unsigned long, void *); 101 void (*kunmap)(struct dma_buf *, unsigned long, void *);
102
103 int (*mmap)(struct dma_buf *, struct vm_area_struct *vma);
104
105 void *(*vmap)(struct dma_buf *);
106 void (*vunmap)(struct dma_buf *, void *vaddr);
95}; 107};
96 108
97/** 109/**
@@ -167,6 +179,11 @@ void *dma_buf_kmap_atomic(struct dma_buf *, unsigned long);
167void dma_buf_kunmap_atomic(struct dma_buf *, unsigned long, void *); 179void dma_buf_kunmap_atomic(struct dma_buf *, unsigned long, void *);
168void *dma_buf_kmap(struct dma_buf *, unsigned long); 180void *dma_buf_kmap(struct dma_buf *, unsigned long);
169void dma_buf_kunmap(struct dma_buf *, unsigned long, void *); 181void dma_buf_kunmap(struct dma_buf *, unsigned long, void *);
182
183int dma_buf_mmap(struct dma_buf *, struct vm_area_struct *,
184 unsigned long);
185void *dma_buf_vmap(struct dma_buf *);
186void dma_buf_vunmap(struct dma_buf *, void *vaddr);
170#else 187#else
171 188
172static inline struct dma_buf_attachment *dma_buf_attach(struct dma_buf *dmabuf, 189static inline struct dma_buf_attachment *dma_buf_attach(struct dma_buf *dmabuf,
@@ -248,6 +265,22 @@ static inline void dma_buf_kunmap(struct dma_buf *dmabuf,
248 unsigned long pnum, void *vaddr) 265 unsigned long pnum, void *vaddr)
249{ 266{
250} 267}
268
269static inline int dma_buf_mmap(struct dma_buf *dmabuf,
270 struct vm_area_struct *vma,
271 unsigned long pgoff)
272{
273 return -ENODEV;
274}
275
276static inline void *dma_buf_vmap(struct dma_buf *dmabuf)
277{
278 return NULL;
279}
280
281static inline void dma_buf_vunmap(struct dma_buf *dmabuf, void *vaddr)
282{
283}
251#endif /* CONFIG_DMA_SHARED_BUFFER */ 284#endif /* CONFIG_DMA_SHARED_BUFFER */
252 285
253#endif /* __DMA_BUF_H__ */ 286#endif /* __DMA_BUF_H__ */
diff --git a/include/linux/dma-contiguous.h b/include/linux/dma-contiguous.h
new file mode 100644
index 000000000000..2f303e4b7ed3
--- /dev/null
+++ b/include/linux/dma-contiguous.h
@@ -0,0 +1,110 @@
1#ifndef __LINUX_CMA_H
2#define __LINUX_CMA_H
3
4/*
5 * Contiguous Memory Allocator for DMA mapping framework
6 * Copyright (c) 2010-2011 by Samsung Electronics.
7 * Written by:
8 * Marek Szyprowski <m.szyprowski@samsung.com>
9 * Michal Nazarewicz <mina86@mina86.com>
10 *
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License as
13 * published by the Free Software Foundation; either version 2 of the
14 * License or (at your optional) any later version of the license.
15 */
16
17/*
18 * Contiguous Memory Allocator
19 *
20 * The Contiguous Memory Allocator (CMA) makes it possible to
21 * allocate big contiguous chunks of memory after the system has
22 * booted.
23 *
24 * Why is it needed?
25 *
26 * Various devices on embedded systems have no scatter-getter and/or
27 * IO map support and require contiguous blocks of memory to
28 * operate. They include devices such as cameras, hardware video
29 * coders, etc.
30 *
31 * Such devices often require big memory buffers (a full HD frame
32 * is, for instance, more then 2 mega pixels large, i.e. more than 6
33 * MB of memory), which makes mechanisms such as kmalloc() or
34 * alloc_page() ineffective.
35 *
36 * At the same time, a solution where a big memory region is
37 * reserved for a device is suboptimal since often more memory is
38 * reserved then strictly required and, moreover, the memory is
39 * inaccessible to page system even if device drivers don't use it.
40 *
41 * CMA tries to solve this issue by operating on memory regions
42 * where only movable pages can be allocated from. This way, kernel
43 * can use the memory for pagecache and when device driver requests
44 * it, allocated pages can be migrated.
45 *
46 * Driver usage
47 *
48 * CMA should not be used by the device drivers directly. It is
49 * only a helper framework for dma-mapping subsystem.
50 *
51 * For more information, see kernel-docs in drivers/base/dma-contiguous.c
52 */
53
54#ifdef __KERNEL__
55
56struct cma;
57struct page;
58struct device;
59
60#ifdef CONFIG_CMA
61
62/*
63 * There is always at least global CMA area and a few optional device
64 * private areas configured in kernel .config.
65 */
66#define MAX_CMA_AREAS (1 + CONFIG_CMA_AREAS)
67
68extern struct cma *dma_contiguous_default_area;
69
70void dma_contiguous_reserve(phys_addr_t addr_limit);
71int dma_declare_contiguous(struct device *dev, unsigned long size,
72 phys_addr_t base, phys_addr_t limit);
73
74struct page *dma_alloc_from_contiguous(struct device *dev, int count,
75 unsigned int order);
76bool dma_release_from_contiguous(struct device *dev, struct page *pages,
77 int count);
78
79#else
80
81#define MAX_CMA_AREAS (0)
82
83static inline void dma_contiguous_reserve(phys_addr_t limit) { }
84
85static inline
86int dma_declare_contiguous(struct device *dev, unsigned long size,
87 phys_addr_t base, phys_addr_t limit)
88{
89 return -ENOSYS;
90}
91
92static inline
93struct page *dma_alloc_from_contiguous(struct device *dev, int count,
94 unsigned int order)
95{
96 return NULL;
97}
98
99static inline
100bool dma_release_from_contiguous(struct device *dev, struct page *pages,
101 int count)
102{
103 return false;
104}
105
106#endif
107
108#endif
109
110#endif
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index f9a2e5e67a54..d3fec584e8c3 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -615,11 +615,13 @@ static inline int dmaengine_slave_config(struct dma_chan *chan,
615} 615}
616 616
617static inline struct dma_async_tx_descriptor *dmaengine_prep_slave_single( 617static inline struct dma_async_tx_descriptor *dmaengine_prep_slave_single(
618 struct dma_chan *chan, void *buf, size_t len, 618 struct dma_chan *chan, dma_addr_t buf, size_t len,
619 enum dma_transfer_direction dir, unsigned long flags) 619 enum dma_transfer_direction dir, unsigned long flags)
620{ 620{
621 struct scatterlist sg; 621 struct scatterlist sg;
622 sg_init_one(&sg, buf, len); 622 sg_init_table(&sg, 1);
623 sg_dma_address(&sg) = buf;
624 sg_dma_len(&sg) = len;
623 625
624 return chan->device->device_prep_slave_sg(chan, &sg, 1, 626 return chan->device->device_prep_slave_sg(chan, &sg, 1,
625 dir, flags, NULL); 627 dir, flags, NULL);
diff --git a/include/linux/dmar.h b/include/linux/dmar.h
index 731a60975101..b029d1aa2d12 100644
--- a/include/linux/dmar.h
+++ b/include/linux/dmar.h
@@ -114,91 +114,6 @@ struct irte {
114 }; 114 };
115}; 115};
116 116
117#ifdef CONFIG_IRQ_REMAP
118extern int intr_remapping_enabled;
119extern int intr_remapping_supported(void);
120extern int enable_intr_remapping(void);
121extern void disable_intr_remapping(void);
122extern int reenable_intr_remapping(int);
123
124extern int get_irte(int irq, struct irte *entry);
125extern int modify_irte(int irq, struct irte *irte_modified);
126extern int alloc_irte(struct intel_iommu *iommu, int irq, u16 count);
127extern int set_irte_irq(int irq, struct intel_iommu *iommu, u16 index,
128 u16 sub_handle);
129extern int map_irq_to_irte_handle(int irq, u16 *sub_handle);
130extern int free_irte(int irq);
131
132extern struct intel_iommu *map_dev_to_ir(struct pci_dev *dev);
133extern struct intel_iommu *map_ioapic_to_ir(int apic);
134extern struct intel_iommu *map_hpet_to_ir(u8 id);
135extern int set_ioapic_sid(struct irte *irte, int apic);
136extern int set_hpet_sid(struct irte *irte, u8 id);
137extern int set_msi_sid(struct irte *irte, struct pci_dev *dev);
138#else
139static inline int alloc_irte(struct intel_iommu *iommu, int irq, u16 count)
140{
141 return -1;
142}
143static inline int modify_irte(int irq, struct irte *irte_modified)
144{
145 return -1;
146}
147static inline int free_irte(int irq)
148{
149 return -1;
150}
151static inline int map_irq_to_irte_handle(int irq, u16 *sub_handle)
152{
153 return -1;
154}
155static inline int set_irte_irq(int irq, struct intel_iommu *iommu, u16 index,
156 u16 sub_handle)
157{
158 return -1;
159}
160static inline struct intel_iommu *map_dev_to_ir(struct pci_dev *dev)
161{
162 return NULL;
163}
164static inline struct intel_iommu *map_ioapic_to_ir(int apic)
165{
166 return NULL;
167}
168static inline struct intel_iommu *map_hpet_to_ir(unsigned int hpet_id)
169{
170 return NULL;
171}
172static inline int set_ioapic_sid(struct irte *irte, int apic)
173{
174 return 0;
175}
176static inline int set_hpet_sid(struct irte *irte, u8 id)
177{
178 return -1;
179}
180static inline int set_msi_sid(struct irte *irte, struct pci_dev *dev)
181{
182 return 0;
183}
184
185#define intr_remapping_enabled (0)
186
187static inline int enable_intr_remapping(void)
188{
189 return -1;
190}
191
192static inline void disable_intr_remapping(void)
193{
194}
195
196static inline int reenable_intr_remapping(int eim)
197{
198 return 0;
199}
200#endif
201
202enum { 117enum {
203 IRQ_REMAP_XAPIC_MODE, 118 IRQ_REMAP_XAPIC_MODE,
204 IRQ_REMAP_X2APIC_MODE, 119 IRQ_REMAP_X2APIC_MODE,
diff --git a/include/linux/dvb/frontend.h b/include/linux/dvb/frontend.h
index cb4428ab81ed..f50d4058c5fb 100644
--- a/include/linux/dvb/frontend.h
+++ b/include/linux/dvb/frontend.h
@@ -320,7 +320,24 @@ struct dvb_frontend_event {
320 320
321#define DTV_ENUM_DELSYS 44 321#define DTV_ENUM_DELSYS 44
322 322
323#define DTV_MAX_COMMAND DTV_ENUM_DELSYS 323/* ATSC-MH */
324#define DTV_ATSCMH_FIC_VER 45
325#define DTV_ATSCMH_PARADE_ID 46
326#define DTV_ATSCMH_NOG 47
327#define DTV_ATSCMH_TNOG 48
328#define DTV_ATSCMH_SGN 49
329#define DTV_ATSCMH_PRC 50
330#define DTV_ATSCMH_RS_FRAME_MODE 51
331#define DTV_ATSCMH_RS_FRAME_ENSEMBLE 52
332#define DTV_ATSCMH_RS_CODE_MODE_PRI 53
333#define DTV_ATSCMH_RS_CODE_MODE_SEC 54
334#define DTV_ATSCMH_SCCC_BLOCK_MODE 55
335#define DTV_ATSCMH_SCCC_CODE_MODE_A 56
336#define DTV_ATSCMH_SCCC_CODE_MODE_B 57
337#define DTV_ATSCMH_SCCC_CODE_MODE_C 58
338#define DTV_ATSCMH_SCCC_CODE_MODE_D 59
339
340#define DTV_MAX_COMMAND DTV_ATSCMH_SCCC_CODE_MODE_D
324 341
325typedef enum fe_pilot { 342typedef enum fe_pilot {
326 PILOT_ON, 343 PILOT_ON,
@@ -360,6 +377,38 @@ typedef enum fe_delivery_system {
360 377
361#define SYS_DVBC_ANNEX_AC SYS_DVBC_ANNEX_A 378#define SYS_DVBC_ANNEX_AC SYS_DVBC_ANNEX_A
362 379
380/* ATSC-MH */
381
382enum atscmh_sccc_block_mode {
383 ATSCMH_SCCC_BLK_SEP = 0,
384 ATSCMH_SCCC_BLK_COMB = 1,
385 ATSCMH_SCCC_BLK_RES = 2,
386};
387
388enum atscmh_sccc_code_mode {
389 ATSCMH_SCCC_CODE_HLF = 0,
390 ATSCMH_SCCC_CODE_QTR = 1,
391 ATSCMH_SCCC_CODE_RES = 2,
392};
393
394enum atscmh_rs_frame_ensemble {
395 ATSCMH_RSFRAME_ENS_PRI = 0,
396 ATSCMH_RSFRAME_ENS_SEC = 1,
397};
398
399enum atscmh_rs_frame_mode {
400 ATSCMH_RSFRAME_PRI_ONLY = 0,
401 ATSCMH_RSFRAME_PRI_SEC = 1,
402 ATSCMH_RSFRAME_RES = 2,
403};
404
405enum atscmh_rs_code_mode {
406 ATSCMH_RSCODE_211_187 = 0,
407 ATSCMH_RSCODE_223_187 = 1,
408 ATSCMH_RSCODE_235_187 = 2,
409 ATSCMH_RSCODE_RES = 3,
410};
411
363 412
364struct dtv_cmds_h { 413struct dtv_cmds_h {
365 char *name; /* A display name for debugging purposes */ 414 char *name; /* A display name for debugging purposes */
diff --git a/include/linux/dvb/version.h b/include/linux/dvb/version.h
index 0559e2bd38f9..43d9e8d462d4 100644
--- a/include/linux/dvb/version.h
+++ b/include/linux/dvb/version.h
@@ -24,6 +24,6 @@
24#define _DVBVERSION_H_ 24#define _DVBVERSION_H_
25 25
26#define DVB_API_VERSION 5 26#define DVB_API_VERSION 5
27#define DVB_API_VERSION_MINOR 5 27#define DVB_API_VERSION_MINOR 6
28 28
29#endif /*_DVBVERSION_H_*/ 29#endif /*_DVBVERSION_H_*/
diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h
index 7e3c53a900d8..c18257b0fa72 100644
--- a/include/linux/dynamic_debug.h
+++ b/include/linux/dynamic_debug.h
@@ -17,8 +17,8 @@ struct _ddebug {
17 const char *format; 17 const char *format;
18 unsigned int lineno:18; 18 unsigned int lineno:18;
19 /* 19 /*
20 * The flags field controls the behaviour at the callsite. 20 * The flags field controls the behaviour at the callsite.
21 * The bits here are changed dynamically when the user 21 * The bits here are changed dynamically when the user
22 * writes commands to <debugfs>/dynamic_debug/control 22 * writes commands to <debugfs>/dynamic_debug/control
23 */ 23 */
24#define _DPRINTK_FLAGS_NONE 0 24#define _DPRINTK_FLAGS_NONE 0
@@ -44,6 +44,9 @@ extern int ddebug_remove_module(const char *mod_name);
44extern __printf(2, 3) 44extern __printf(2, 3)
45int __dynamic_pr_debug(struct _ddebug *descriptor, const char *fmt, ...); 45int __dynamic_pr_debug(struct _ddebug *descriptor, const char *fmt, ...);
46 46
47extern int ddebug_dyndbg_module_param_cb(char *param, char *val,
48 const char *modname);
49
47struct device; 50struct device;
48 51
49extern __printf(3, 4) 52extern __printf(3, 4)
@@ -94,11 +97,26 @@ do { \
94 97
95#else 98#else
96 99
100#include <linux/string.h>
101#include <linux/errno.h>
102
97static inline int ddebug_remove_module(const char *mod) 103static inline int ddebug_remove_module(const char *mod)
98{ 104{
99 return 0; 105 return 0;
100} 106}
101 107
108static inline int ddebug_dyndbg_module_param_cb(char *param, char *val,
109 const char *modname)
110{
111 if (strstr(param, "dyndbg")) {
112 /* avoid pr_warn(), which wants pr_fmt() fully defined */
113 printk(KERN_WARNING "dyndbg param is supported only in "
114 "CONFIG_DYNAMIC_DEBUG builds\n");
115 return 0; /* allow and ignore */
116 }
117 return -EINVAL;
118}
119
102#define dynamic_pr_debug(fmt, ...) \ 120#define dynamic_pr_debug(fmt, ...) \
103 do { if (0) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); } while (0) 121 do { if (0) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); } while (0)
104#define dynamic_dev_dbg(dev, fmt, ...) \ 122#define dynamic_dev_dbg(dev, fmt, ...) \
diff --git a/include/linux/efi.h b/include/linux/efi.h
index 88ec80670d5f..ec45ccd8708a 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -554,7 +554,18 @@ extern int __init efi_setup_pcdp_console(char *);
554#define EFI_VARIABLE_NON_VOLATILE 0x0000000000000001 554#define EFI_VARIABLE_NON_VOLATILE 0x0000000000000001
555#define EFI_VARIABLE_BOOTSERVICE_ACCESS 0x0000000000000002 555#define EFI_VARIABLE_BOOTSERVICE_ACCESS 0x0000000000000002
556#define EFI_VARIABLE_RUNTIME_ACCESS 0x0000000000000004 556#define EFI_VARIABLE_RUNTIME_ACCESS 0x0000000000000004
557 557#define EFI_VARIABLE_HARDWARE_ERROR_RECORD 0x0000000000000008
558#define EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS 0x0000000000000010
559#define EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS 0x0000000000000020
560#define EFI_VARIABLE_APPEND_WRITE 0x0000000000000040
561
562#define EFI_VARIABLE_MASK (EFI_VARIABLE_NON_VOLATILE | \
563 EFI_VARIABLE_BOOTSERVICE_ACCESS | \
564 EFI_VARIABLE_RUNTIME_ACCESS | \
565 EFI_VARIABLE_HARDWARE_ERROR_RECORD | \
566 EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS | \
567 EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS | \
568 EFI_VARIABLE_APPEND_WRITE)
558/* 569/*
559 * The type of search to perform when calling boottime->locate_handle 570 * The type of search to perform when calling boottime->locate_handle
560 */ 571 */
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h
index 8a1835855faa..3d406e0ede6d 100644
--- a/include/linux/etherdevice.h
+++ b/include/linux/etherdevice.h
@@ -18,8 +18,6 @@
18 * as published by the Free Software Foundation; either version 18 * as published by the Free Software Foundation; either version
19 * 2 of the License, or (at your option) any later version. 19 * 2 of the License, or (at your option) any later version.
20 * 20 *
21 * WARNING: This move may well be temporary. This file will get merged with others RSN.
22 *
23 */ 21 */
24#ifndef _LINUX_ETHERDEVICE_H 22#ifndef _LINUX_ETHERDEVICE_H
25#define _LINUX_ETHERDEVICE_H 23#define _LINUX_ETHERDEVICE_H
@@ -59,7 +57,7 @@ extern struct net_device *alloc_etherdev_mqs(int sizeof_priv, unsigned int txqs,
59 * 57 *
60 * Return true if the address is all zeroes. 58 * Return true if the address is all zeroes.
61 */ 59 */
62static inline int is_zero_ether_addr(const u8 *addr) 60static inline bool is_zero_ether_addr(const u8 *addr)
63{ 61{
64 return !(addr[0] | addr[1] | addr[2] | addr[3] | addr[4] | addr[5]); 62 return !(addr[0] | addr[1] | addr[2] | addr[3] | addr[4] | addr[5]);
65} 63}
@@ -71,7 +69,7 @@ static inline int is_zero_ether_addr(const u8 *addr)
71 * Return true if the address is a multicast address. 69 * Return true if the address is a multicast address.
72 * By definition the broadcast address is also a multicast address. 70 * By definition the broadcast address is also a multicast address.
73 */ 71 */
74static inline int is_multicast_ether_addr(const u8 *addr) 72static inline bool is_multicast_ether_addr(const u8 *addr)
75{ 73{
76 return 0x01 & addr[0]; 74 return 0x01 & addr[0];
77} 75}
@@ -82,7 +80,7 @@ static inline int is_multicast_ether_addr(const u8 *addr)
82 * 80 *
83 * Return true if the address is a local address. 81 * Return true if the address is a local address.
84 */ 82 */
85static inline int is_local_ether_addr(const u8 *addr) 83static inline bool is_local_ether_addr(const u8 *addr)
86{ 84{
87 return 0x02 & addr[0]; 85 return 0x02 & addr[0];
88} 86}
@@ -93,7 +91,7 @@ static inline int is_local_ether_addr(const u8 *addr)
93 * 91 *
94 * Return true if the address is the broadcast address. 92 * Return true if the address is the broadcast address.
95 */ 93 */
96static inline int is_broadcast_ether_addr(const u8 *addr) 94static inline bool is_broadcast_ether_addr(const u8 *addr)
97{ 95{
98 return (addr[0] & addr[1] & addr[2] & addr[3] & addr[4] & addr[5]) == 0xff; 96 return (addr[0] & addr[1] & addr[2] & addr[3] & addr[4] & addr[5]) == 0xff;
99} 97}
@@ -104,7 +102,7 @@ static inline int is_broadcast_ether_addr(const u8 *addr)
104 * 102 *
105 * Return true if the address is a unicast address. 103 * Return true if the address is a unicast address.
106 */ 104 */
107static inline int is_unicast_ether_addr(const u8 *addr) 105static inline bool is_unicast_ether_addr(const u8 *addr)
108{ 106{
109 return !is_multicast_ether_addr(addr); 107 return !is_multicast_ether_addr(addr);
110} 108}
@@ -118,7 +116,7 @@ static inline int is_unicast_ether_addr(const u8 *addr)
118 * 116 *
119 * Return true if the address is valid. 117 * Return true if the address is valid.
120 */ 118 */
121static inline int is_valid_ether_addr(const u8 *addr) 119static inline bool is_valid_ether_addr(const u8 *addr)
122{ 120{
123 /* FF:FF:FF:FF:FF:FF is a multicast address so we don't need to 121 /* FF:FF:FF:FF:FF:FF is a multicast address so we don't need to
124 * explicitly check for it here. */ 122 * explicitly check for it here. */
@@ -159,7 +157,8 @@ static inline void eth_hw_addr_random(struct net_device *dev)
159 * @addr1: Pointer to a six-byte array containing the Ethernet address 157 * @addr1: Pointer to a six-byte array containing the Ethernet address
160 * @addr2: Pointer other six-byte array containing the Ethernet address 158 * @addr2: Pointer other six-byte array containing the Ethernet address
161 * 159 *
162 * Compare two ethernet addresses, returns 0 if equal 160 * Compare two Ethernet addresses, returns 0 if equal, non-zero otherwise.
161 * Unlike memcmp(), it doesn't return a value suitable for sorting.
163 */ 162 */
164static inline unsigned compare_ether_addr(const u8 *addr1, const u8 *addr2) 163static inline unsigned compare_ether_addr(const u8 *addr1, const u8 *addr2)
165{ 164{
@@ -170,6 +169,18 @@ static inline unsigned compare_ether_addr(const u8 *addr1, const u8 *addr2)
170 return ((a[0] ^ b[0]) | (a[1] ^ b[1]) | (a[2] ^ b[2])) != 0; 169 return ((a[0] ^ b[0]) | (a[1] ^ b[1]) | (a[2] ^ b[2])) != 0;
171} 170}
172 171
172/**
173 * ether_addr_equal - Compare two Ethernet addresses
174 * @addr1: Pointer to a six-byte array containing the Ethernet address
175 * @addr2: Pointer other six-byte array containing the Ethernet address
176 *
177 * Compare two Ethernet addresses, returns true if equal
178 */
179static inline bool ether_addr_equal(const u8 *addr1, const u8 *addr2)
180{
181 return !compare_ether_addr(addr1, addr2);
182}
183
173static inline unsigned long zap_last_2bytes(unsigned long value) 184static inline unsigned long zap_last_2bytes(unsigned long value)
174{ 185{
175#ifdef __BIG_ENDIAN 186#ifdef __BIG_ENDIAN
@@ -180,34 +191,34 @@ static inline unsigned long zap_last_2bytes(unsigned long value)
180} 191}
181 192
182/** 193/**
183 * compare_ether_addr_64bits - Compare two Ethernet addresses 194 * ether_addr_equal_64bits - Compare two Ethernet addresses
184 * @addr1: Pointer to an array of 8 bytes 195 * @addr1: Pointer to an array of 8 bytes
185 * @addr2: Pointer to an other array of 8 bytes 196 * @addr2: Pointer to an other array of 8 bytes
186 * 197 *
187 * Compare two ethernet addresses, returns 0 if equal. 198 * Compare two Ethernet addresses, returns true if equal, false otherwise.
188 * Same result than "memcmp(addr1, addr2, ETH_ALEN)" but without conditional 199 *
189 * branches, and possibly long word memory accesses on CPU allowing cheap 200 * The function doesn't need any conditional branches and possibly uses
190 * unaligned memory reads. 201 * word memory accesses on CPU allowing cheap unaligned memory reads.
191 * arrays = { byte1, byte2, byte3, byte4, byte6, byte7, pad1, pad2} 202 * arrays = { byte1, byte2, byte3, byte4, byte5, byte6, pad1, pad2 }
192 * 203 *
193 * Please note that alignment of addr1 & addr2 is only guaranted to be 16 bits. 204 * Please note that alignment of addr1 & addr2 are only guaranteed to be 16 bits.
194 */ 205 */
195 206
196static inline unsigned compare_ether_addr_64bits(const u8 addr1[6+2], 207static inline bool ether_addr_equal_64bits(const u8 addr1[6+2],
197 const u8 addr2[6+2]) 208 const u8 addr2[6+2])
198{ 209{
199#ifdef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS 210#ifdef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
200 unsigned long fold = ((*(unsigned long *)addr1) ^ 211 unsigned long fold = ((*(unsigned long *)addr1) ^
201 (*(unsigned long *)addr2)); 212 (*(unsigned long *)addr2));
202 213
203 if (sizeof(fold) == 8) 214 if (sizeof(fold) == 8)
204 return zap_last_2bytes(fold) != 0; 215 return zap_last_2bytes(fold) == 0;
205 216
206 fold |= zap_last_2bytes((*(unsigned long *)(addr1 + 4)) ^ 217 fold |= zap_last_2bytes((*(unsigned long *)(addr1 + 4)) ^
207 (*(unsigned long *)(addr2 + 4))); 218 (*(unsigned long *)(addr2 + 4)));
208 return fold != 0; 219 return fold == 0;
209#else 220#else
210 return compare_ether_addr(addr1, addr2); 221 return ether_addr_equal(addr1, addr2);
211#endif 222#endif
212} 223}
213 224
@@ -219,23 +230,23 @@ static inline unsigned compare_ether_addr_64bits(const u8 addr1[6+2],
219 * Compare passed address with all addresses of the device. Return true if the 230 * Compare passed address with all addresses of the device. Return true if the
220 * address if one of the device addresses. 231 * address if one of the device addresses.
221 * 232 *
222 * Note that this function calls compare_ether_addr_64bits() so take care of 233 * Note that this function calls ether_addr_equal_64bits() so take care of
223 * the right padding. 234 * the right padding.
224 */ 235 */
225static inline bool is_etherdev_addr(const struct net_device *dev, 236static inline bool is_etherdev_addr(const struct net_device *dev,
226 const u8 addr[6 + 2]) 237 const u8 addr[6 + 2])
227{ 238{
228 struct netdev_hw_addr *ha; 239 struct netdev_hw_addr *ha;
229 int res = 1; 240 bool res = false;
230 241
231 rcu_read_lock(); 242 rcu_read_lock();
232 for_each_dev_addr(dev, ha) { 243 for_each_dev_addr(dev, ha) {
233 res = compare_ether_addr_64bits(addr, ha->addr); 244 res = ether_addr_equal_64bits(addr, ha->addr);
234 if (!res) 245 if (res)
235 break; 246 break;
236 } 247 }
237 rcu_read_unlock(); 248 rcu_read_unlock();
238 return !res; 249 return res;
239} 250}
240#endif /* __KERNEL__ */ 251#endif /* __KERNEL__ */
241 252
@@ -244,7 +255,7 @@ static inline bool is_etherdev_addr(const struct net_device *dev,
244 * @a: Pointer to Ethernet header 255 * @a: Pointer to Ethernet header
245 * @b: Pointer to Ethernet header 256 * @b: Pointer to Ethernet header
246 * 257 *
247 * Compare two ethernet headers, returns 0 if equal. 258 * Compare two Ethernet headers, returns 0 if equal.
248 * This assumes that the network header (i.e., IP header) is 4-byte 259 * This assumes that the network header (i.e., IP header) is 4-byte
249 * aligned OR the platform can handle unaligned access. This is the 260 * aligned OR the platform can handle unaligned access. This is the
250 * case for all packets coming into netif_receive_skb or similar 261 * case for all packets coming into netif_receive_skb or similar
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index f5647b59a90e..e17fa7140588 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -137,6 +137,23 @@ struct ethtool_eeprom {
137}; 137};
138 138
139/** 139/**
140 * struct ethtool_modinfo - plugin module eeprom information
141 * @cmd: %ETHTOOL_GMODULEINFO
142 * @type: Standard the module information conforms to %ETH_MODULE_SFF_xxxx
143 * @eeprom_len: Length of the eeprom
144 *
145 * This structure is used to return the information to
146 * properly size memory for a subsequent call to %ETHTOOL_GMODULEEEPROM.
147 * The type code indicates the eeprom data format
148 */
149struct ethtool_modinfo {
150 __u32 cmd;
151 __u32 type;
152 __u32 eeprom_len;
153 __u32 reserved[8];
154};
155
156/**
140 * struct ethtool_coalesce - coalescing parameters for IRQs and stats updates 157 * struct ethtool_coalesce - coalescing parameters for IRQs and stats updates
141 * @cmd: ETHTOOL_{G,S}COALESCE 158 * @cmd: ETHTOOL_{G,S}COALESCE
142 * @rx_coalesce_usecs: How many usecs to delay an RX interrupt after 159 * @rx_coalesce_usecs: How many usecs to delay an RX interrupt after
@@ -661,12 +678,17 @@ struct ethtool_flash {
661 * %ETHTOOL_SET_DUMP 678 * %ETHTOOL_SET_DUMP
662 * @version: FW version of the dump, filled in by driver 679 * @version: FW version of the dump, filled in by driver
663 * @flag: driver dependent flag for dump setting, filled in by driver during 680 * @flag: driver dependent flag for dump setting, filled in by driver during
664 * get and filled in by ethtool for set operation 681 * get and filled in by ethtool for set operation.
682 * flag must be initialized by macro ETH_FW_DUMP_DISABLE value when
683 * firmware dump is disabled.
665 * @len: length of dump data, used as the length of the user buffer on entry to 684 * @len: length of dump data, used as the length of the user buffer on entry to
666 * %ETHTOOL_GET_DUMP_DATA and this is returned as dump length by driver 685 * %ETHTOOL_GET_DUMP_DATA and this is returned as dump length by driver
667 * for %ETHTOOL_GET_DUMP_FLAG command 686 * for %ETHTOOL_GET_DUMP_FLAG command
668 * @data: data collected for get dump data operation 687 * @data: data collected for get dump data operation
669 */ 688 */
689
690#define ETH_FW_DUMP_DISABLE 0
691
670struct ethtool_dump { 692struct ethtool_dump {
671 __u32 cmd; 693 __u32 cmd;
672 __u32 version; 694 __u32 version;
@@ -726,6 +748,29 @@ struct ethtool_sfeatures {
726 struct ethtool_set_features_block features[0]; 748 struct ethtool_set_features_block features[0];
727}; 749};
728 750
751/**
752 * struct ethtool_ts_info - holds a device's timestamping and PHC association
753 * @cmd: command number = %ETHTOOL_GET_TS_INFO
754 * @so_timestamping: bit mask of the sum of the supported SO_TIMESTAMPING flags
755 * @phc_index: device index of the associated PHC, or -1 if there is none
756 * @tx_types: bit mask of the supported hwtstamp_tx_types enumeration values
757 * @rx_filters: bit mask of the supported hwtstamp_rx_filters enumeration values
758 *
759 * The bits in the 'tx_types' and 'rx_filters' fields correspond to
760 * the 'hwtstamp_tx_types' and 'hwtstamp_rx_filters' enumeration values,
761 * respectively. For example, if the device supports HWTSTAMP_TX_ON,
762 * then (1 << HWTSTAMP_TX_ON) in 'tx_types' will be set.
763 */
764struct ethtool_ts_info {
765 __u32 cmd;
766 __u32 so_timestamping;
767 __s32 phc_index;
768 __u32 tx_types;
769 __u32 tx_reserved[3];
770 __u32 rx_filters;
771 __u32 rx_reserved[3];
772};
773
729/* 774/*
730 * %ETHTOOL_SFEATURES changes features present in features[].valid to the 775 * %ETHTOOL_SFEATURES changes features present in features[].valid to the
731 * values of corresponding bits in features[].requested. Bits in .requested 776 * values of corresponding bits in features[].requested. Bits in .requested
@@ -788,6 +833,7 @@ struct net_device;
788 833
789/* Some generic methods drivers may use in their ethtool_ops */ 834/* Some generic methods drivers may use in their ethtool_ops */
790u32 ethtool_op_get_link(struct net_device *dev); 835u32 ethtool_op_get_link(struct net_device *dev);
836int ethtool_op_get_ts_info(struct net_device *dev, struct ethtool_ts_info *eti);
791 837
792/** 838/**
793 * ethtool_rxfh_indir_default - get default value for RX flow hash indirection 839 * ethtool_rxfh_indir_default - get default value for RX flow hash indirection
@@ -893,6 +939,12 @@ static inline u32 ethtool_rxfh_indir_default(u32 index, u32 n_rx_rings)
893 * and flag of the device. 939 * and flag of the device.
894 * @get_dump_data: Get dump data. 940 * @get_dump_data: Get dump data.
895 * @set_dump: Set dump specific flags to the device. 941 * @set_dump: Set dump specific flags to the device.
942 * @get_ts_info: Get the time stamping and PTP hardware clock capabilities.
943 * Drivers supporting transmit time stamps in software should set this to
944 * ethtool_op_get_ts_info().
945 * @get_module_info: Get the size and type of the eeprom contained within
946 * a plug-in module.
947 * @get_module_eeprom: Get the eeprom information from the plug-in module
896 * 948 *
897 * All operations are optional (i.e. the function pointer may be set 949 * All operations are optional (i.e. the function pointer may be set
898 * to %NULL) and callers must take this into account. Callers must 950 * to %NULL) and callers must take this into account. Callers must
@@ -954,6 +1006,12 @@ struct ethtool_ops {
954 int (*get_dump_data)(struct net_device *, 1006 int (*get_dump_data)(struct net_device *,
955 struct ethtool_dump *, void *); 1007 struct ethtool_dump *, void *);
956 int (*set_dump)(struct net_device *, struct ethtool_dump *); 1008 int (*set_dump)(struct net_device *, struct ethtool_dump *);
1009 int (*get_ts_info)(struct net_device *, struct ethtool_ts_info *);
1010 int (*get_module_info)(struct net_device *,
1011 struct ethtool_modinfo *);
1012 int (*get_module_eeprom)(struct net_device *,
1013 struct ethtool_eeprom *, u8 *);
1014
957 1015
958}; 1016};
959#endif /* __KERNEL__ */ 1017#endif /* __KERNEL__ */
@@ -1028,6 +1086,9 @@ struct ethtool_ops {
1028#define ETHTOOL_SET_DUMP 0x0000003e /* Set dump settings */ 1086#define ETHTOOL_SET_DUMP 0x0000003e /* Set dump settings */
1029#define ETHTOOL_GET_DUMP_FLAG 0x0000003f /* Get dump settings */ 1087#define ETHTOOL_GET_DUMP_FLAG 0x0000003f /* Get dump settings */
1030#define ETHTOOL_GET_DUMP_DATA 0x00000040 /* Get dump data */ 1088#define ETHTOOL_GET_DUMP_DATA 0x00000040 /* Get dump data */
1089#define ETHTOOL_GET_TS_INFO 0x00000041 /* Get time stamping and PHC info */
1090#define ETHTOOL_GMODULEINFO 0x00000042 /* Get plug-in module information */
1091#define ETHTOOL_GMODULEEEPROM 0x00000043 /* Get plug-in module eeprom */
1031 1092
1032/* compatibility with older code */ 1093/* compatibility with older code */
1033#define SPARC_ETH_GSET ETHTOOL_GSET 1094#define SPARC_ETH_GSET ETHTOOL_GSET
@@ -1177,6 +1238,12 @@ struct ethtool_ops {
1177#define RX_CLS_LOC_FIRST 0xfffffffe 1238#define RX_CLS_LOC_FIRST 0xfffffffe
1178#define RX_CLS_LOC_LAST 0xfffffffd 1239#define RX_CLS_LOC_LAST 0xfffffffd
1179 1240
1241/* EEPROM Standards for plug in modules */
1242#define ETH_MODULE_SFF_8079 0x1
1243#define ETH_MODULE_SFF_8079_LEN 256
1244#define ETH_MODULE_SFF_8472 0x2
1245#define ETH_MODULE_SFF_8472_LEN 512
1246
1180/* Reset flags */ 1247/* Reset flags */
1181/* The reset() operation must clear the flags for the components which 1248/* The reset() operation must clear the flags for the components which
1182 * were actually reset. On successful return, the flags indicate the 1249 * were actually reset. On successful return, the flags indicate the
diff --git a/include/linux/eventpoll.h b/include/linux/eventpoll.h
index 657ab55beda0..6f8be328770a 100644
--- a/include/linux/eventpoll.h
+++ b/include/linux/eventpoll.h
@@ -26,6 +26,18 @@
26#define EPOLL_CTL_DEL 2 26#define EPOLL_CTL_DEL 2
27#define EPOLL_CTL_MOD 3 27#define EPOLL_CTL_MOD 3
28 28
29/*
30 * Request the handling of system wakeup events so as to prevent system suspends
31 * from happening while those events are being processed.
32 *
33 * Assuming neither EPOLLET nor EPOLLONESHOT is set, system suspends will not be
34 * re-allowed until epoll_wait is called again after consuming the wakeup
35 * event(s).
36 *
37 * Requires CAP_EPOLLWAKEUP
38 */
39#define EPOLLWAKEUP (1 << 29)
40
29/* Set the One Shot behaviour for the target file descriptor */ 41/* Set the One Shot behaviour for the target file descriptor */
30#define EPOLLONESHOT (1 << 30) 42#define EPOLLONESHOT (1 << 30)
31 43
diff --git a/include/linux/extcon.h b/include/linux/extcon.h
new file mode 100644
index 000000000000..cdd401477656
--- /dev/null
+++ b/include/linux/extcon.h
@@ -0,0 +1,324 @@
1/*
2 * External connector (extcon) class driver
3 *
4 * Copyright (C) 2012 Samsung Electronics
5 * Author: Donggeun Kim <dg77.kim@samsung.com>
6 * Author: MyungJoo Ham <myungjoo.ham@samsung.com>
7 *
8 * based on switch class driver
9 * Copyright (C) 2008 Google, Inc.
10 * Author: Mike Lockwood <lockwood@android.com>
11 *
12 * This software is licensed under the terms of the GNU General Public
13 * License version 2, as published by the Free Software Foundation, and
14 * may be copied, distributed, and modified under those terms.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21*/
22
23#ifndef __LINUX_EXTCON_H__
24#define __LINUX_EXTCON_H__
25
26#include <linux/notifier.h>
27
28#define SUPPORTED_CABLE_MAX 32
29#define CABLE_NAME_MAX 30
30
31/*
32 * The standard cable name is to help support general notifier
33 * and notifee device drivers to share the common names.
34 * Please use standard cable names unless your notifier device has
35 * a very unique and abnormal cable or
36 * the cable type is supposed to be used with only one unique
37 * pair of notifier/notifee devices.
38 *
39 * Please add any other "standard" cables used with extcon dev.
40 *
41 * You may add a dot and number to specify version or specification
42 * of the specific cable if it is required. (e.g., "Fast-charger.18"
43 * and "Fast-charger.10" for 1.8A and 1.0A chargers)
44 * However, the notifee and notifier should be able to handle such
45 * string and if the notifee can negotiate the protocol or idenify,
46 * you don't need such convention. This convention is helpful when
47 * notifier can distinguish but notifiee cannot.
48 */
49enum extcon_cable_name {
50 EXTCON_USB = 0,
51 EXTCON_USB_HOST,
52 EXTCON_TA, /* Travel Adaptor */
53 EXTCON_FAST_CHARGER,
54 EXTCON_SLOW_CHARGER,
55 EXTCON_CHARGE_DOWNSTREAM, /* Charging an external device */
56 EXTCON_HDMI,
57 EXTCON_MHL,
58 EXTCON_DVI,
59 EXTCON_VGA,
60 EXTCON_DOCK,
61 EXTCON_LINE_IN,
62 EXTCON_LINE_OUT,
63 EXTCON_MIC_IN,
64 EXTCON_HEADPHONE_OUT,
65 EXTCON_SPDIF_IN,
66 EXTCON_SPDIF_OUT,
67 EXTCON_VIDEO_IN,
68 EXTCON_VIDEO_OUT,
69 EXTCON_MECHANICAL,
70};
71extern const char *extcon_cable_name[];
72
73struct extcon_cable;
74
75/**
76 * struct extcon_dev - An extcon device represents one external connector.
77 * @name The name of this extcon device. Parent device name is used
78 * if NULL.
79 * @supported_cable Array of supported cable name ending with NULL.
80 * If supported_cable is NULL, cable name related APIs
81 * are disabled.
82 * @mutually_exclusive Array of mutually exclusive set of cables that cannot
83 * be attached simultaneously. The array should be
84 * ending with NULL or be NULL (no mutually exclusive
85 * cables). For example, if it is { 0x7, 0x30, 0}, then,
86 * {0, 1}, {0, 1, 2}, {0, 2}, {1, 2}, or {4, 5} cannot
87 * be attached simulataneously. {0x7, 0} is equivalent to
88 * {0x3, 0x6, 0x5, 0}. If it is {0xFFFFFFFF, 0}, there
89 * can be no simultaneous connections.
90 * @print_name An optional callback to override the method to print the
91 * name of the extcon device.
92 * @print_state An optional callback to override the method to print the
93 * status of the extcon device.
94 * @dev Device of this extcon. Do not provide at register-time.
95 * @state Attach/detach state of this extcon. Do not provide at
96 * register-time
97 * @nh Notifier for the state change events from this extcon
98 * @entry To support list of extcon devices so that uses can search
99 * for extcon devices based on the extcon name.
100 * @lock
101 * @max_supported Internal value to store the number of cables.
102 * @extcon_dev_type Device_type struct to provide attribute_groups
103 * customized for each extcon device.
104 * @cables Sysfs subdirectories. Each represents one cable.
105 *
106 * In most cases, users only need to provide "User initializing data" of
107 * this struct when registering an extcon. In some exceptional cases,
108 * optional callbacks may be needed. However, the values in "internal data"
109 * are overwritten by register function.
110 */
111struct extcon_dev {
112 /* --- Optional user initializing data --- */
113 const char *name;
114 const char **supported_cable;
115 const u32 *mutually_exclusive;
116
117 /* --- Optional callbacks to override class functions --- */
118 ssize_t (*print_name)(struct extcon_dev *edev, char *buf);
119 ssize_t (*print_state)(struct extcon_dev *edev, char *buf);
120
121 /* --- Internal data. Please do not set. --- */
122 struct device *dev;
123 u32 state;
124 struct raw_notifier_head nh;
125 struct list_head entry;
126 spinlock_t lock; /* could be called by irq handler */
127 int max_supported;
128
129 /* /sys/class/extcon/.../cable.n/... */
130 struct device_type extcon_dev_type;
131 struct extcon_cable *cables;
132 /* /sys/class/extcon/.../mutually_exclusive/... */
133 struct attribute_group attr_g_muex;
134 struct attribute **attrs_muex;
135 struct device_attribute *d_attrs_muex;
136};
137
138/**
139 * struct extcon_cable - An internal data for each cable of extcon device.
140 * @edev The extcon device
141 * @cable_index Index of this cable in the edev
142 * @attr_g Attribute group for the cable
143 * @attr_name "name" sysfs entry
144 * @attr_state "state" sysfs entry
145 * @attrs Array pointing to attr_name and attr_state for attr_g
146 */
147struct extcon_cable {
148 struct extcon_dev *edev;
149 int cable_index;
150
151 struct attribute_group attr_g;
152 struct device_attribute attr_name;
153 struct device_attribute attr_state;
154
155 struct attribute *attrs[3]; /* to be fed to attr_g.attrs */
156};
157
158/**
159 * struct extcon_specific_cable_nb - An internal data for
160 * extcon_register_interest().
161 * @internal_nb a notifier block bridging extcon notifier and cable notifier.
162 * @user_nb user provided notifier block for events from a specific cable.
163 * @cable_index the target cable.
164 * @edev the target extcon device.
165 * @previous_value the saved previous event value.
166 */
167struct extcon_specific_cable_nb {
168 struct notifier_block internal_nb;
169 struct notifier_block *user_nb;
170 int cable_index;
171 struct extcon_dev *edev;
172 unsigned long previous_value;
173};
174
175#if IS_ENABLED(CONFIG_EXTCON)
176
177/*
178 * Following APIs are for notifiers or configurations.
179 * Notifiers are the external port and connection devices.
180 */
181extern int extcon_dev_register(struct extcon_dev *edev, struct device *dev);
182extern void extcon_dev_unregister(struct extcon_dev *edev);
183extern struct extcon_dev *extcon_get_extcon_dev(const char *extcon_name);
184
185/*
186 * get/set/update_state access the 32b encoded state value, which represents
187 * states of all possible cables of the multistate port. For example, if one
188 * calls extcon_set_state(edev, 0x7), it may mean that all the three cables
189 * are attached to the port.
190 */
191static inline u32 extcon_get_state(struct extcon_dev *edev)
192{
193 return edev->state;
194}
195
196extern int extcon_set_state(struct extcon_dev *edev, u32 state);
197extern int extcon_update_state(struct extcon_dev *edev, u32 mask, u32 state);
198
199/*
200 * get/set_cable_state access each bit of the 32b encoded state value.
201 * They are used to access the status of each cable based on the cable_name
202 * or cable_index, which is retrived by extcon_find_cable_index
203 */
204extern int extcon_find_cable_index(struct extcon_dev *sdev,
205 const char *cable_name);
206extern int extcon_get_cable_state_(struct extcon_dev *edev, int cable_index);
207extern int extcon_set_cable_state_(struct extcon_dev *edev, int cable_index,
208 bool cable_state);
209
210extern int extcon_get_cable_state(struct extcon_dev *edev,
211 const char *cable_name);
212extern int extcon_set_cable_state(struct extcon_dev *edev,
213 const char *cable_name, bool cable_state);
214
215/*
216 * Following APIs are for notifiees (those who want to be notified)
217 * to register a callback for events from a specific cable of the extcon.
218 * Notifiees are the connected device drivers wanting to get notified by
219 * a specific external port of a connection device.
220 */
221extern int extcon_register_interest(struct extcon_specific_cable_nb *obj,
222 const char *extcon_name,
223 const char *cable_name,
224 struct notifier_block *nb);
225extern int extcon_unregister_interest(struct extcon_specific_cable_nb *nb);
226
227/*
228 * Following APIs are to monitor every action of a notifier.
229 * Registerer gets notified for every external port of a connection device.
230 * Probably this could be used to debug an action of notifier; however,
231 * we do not recommend to use this at normal 'notifiee' device drivers who
232 * want to be notified by a specific external port of the notifier.
233 */
234extern int extcon_register_notifier(struct extcon_dev *edev,
235 struct notifier_block *nb);
236extern int extcon_unregister_notifier(struct extcon_dev *edev,
237 struct notifier_block *nb);
238#else /* CONFIG_EXTCON */
239static inline int extcon_dev_register(struct extcon_dev *edev,
240 struct device *dev)
241{
242 return 0;
243}
244
245static inline void extcon_dev_unregister(struct extcon_dev *edev) { }
246
247static inline u32 extcon_get_state(struct extcon_dev *edev)
248{
249 return 0;
250}
251
252static inline int extcon_set_state(struct extcon_dev *edev, u32 state)
253{
254 return 0;
255}
256
257static inline int extcon_update_state(struct extcon_dev *edev, u32 mask,
258 u32 state)
259{
260 return 0;
261}
262
263static inline int extcon_find_cable_index(struct extcon_dev *edev,
264 const char *cable_name)
265{
266 return 0;
267}
268
269static inline int extcon_get_cable_state_(struct extcon_dev *edev,
270 int cable_index)
271{
272 return 0;
273}
274
275static inline int extcon_set_cable_state_(struct extcon_dev *edev,
276 int cable_index, bool cable_state)
277{
278 return 0;
279}
280
281static inline int extcon_get_cable_state(struct extcon_dev *edev,
282 const char *cable_name)
283{
284 return 0;
285}
286
287static inline int extcon_set_cable_state(struct extcon_dev *edev,
288 const char *cable_name, int state)
289{
290 return 0;
291}
292
293static inline struct extcon_dev *extcon_get_extcon_dev(const char *extcon_name)
294{
295 return NULL;
296}
297
298static inline int extcon_register_notifier(struct extcon_dev *edev,
299 struct notifier_block *nb)
300{
301 return 0;
302}
303
304static inline int extcon_unregister_notifier(struct extcon_dev *edev,
305 struct notifier_block *nb)
306{
307 return 0;
308}
309
310static inline int extcon_register_interest(struct extcon_specific_cable_nb *obj,
311 const char *extcon_name,
312 const char *cable_name,
313 struct notifier_block *nb)
314{
315 return 0;
316}
317
318static inline int extcon_unregister_interest(struct extcon_specific_cable_nb
319 *obj)
320{
321 return 0;
322}
323#endif /* CONFIG_EXTCON */
324#endif /* __LINUX_EXTCON_H__ */
diff --git a/include/linux/extcon/extcon_gpio.h b/include/linux/extcon/extcon_gpio.h
new file mode 100644
index 000000000000..a2129b73dcb1
--- /dev/null
+++ b/include/linux/extcon/extcon_gpio.h
@@ -0,0 +1,52 @@
1/*
2 * External connector (extcon) class generic GPIO driver
3 *
4 * Copyright (C) 2012 Samsung Electronics
5 * Author: MyungJoo Ham <myungjoo.ham@samsung.com>
6 *
7 * based on switch class driver
8 * Copyright (C) 2008 Google, Inc.
9 * Author: Mike Lockwood <lockwood@android.com>
10 *
11 * This software is licensed under the terms of the GNU General Public
12 * License version 2, as published by the Free Software Foundation, and
13 * may be copied, distributed, and modified under those terms.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20*/
21#ifndef __EXTCON_GPIO_H__
22#define __EXTCON_GPIO_H__ __FILE__
23
24#include <linux/extcon.h>
25
26/**
27 * struct gpio_extcon_platform_data - A simple GPIO-controlled extcon device.
28 * @name The name of this GPIO extcon device.
29 * @gpio Corresponding GPIO.
30 * @debounce Debounce time for GPIO IRQ in ms.
31 * @irq_flags IRQ Flags (e.g., IRQF_TRIGGER_LOW).
32 * @state_on print_state is overriden with state_on if attached. If Null,
33 * default method of extcon class is used.
34 * @state_off print_state is overriden with state_on if dettached. If Null,
35 * default method of extcon class is used.
36 *
37 * Note that in order for state_on or state_off to be valid, both state_on
38 * and state_off should be not NULL. If at least one of them is NULL,
39 * the print_state is not overriden.
40 */
41struct gpio_extcon_platform_data {
42 const char *name;
43 unsigned gpio;
44 unsigned long debounce;
45 unsigned long irq_flags;
46
47 /* if NULL, "0" or "1" will be printed */
48 const char *state_on;
49 const char *state_off;
50};
51
52#endif /* __EXTCON_GPIO_H__ */
diff --git a/include/linux/filter.h b/include/linux/filter.h
index 8eeb205f298b..82b01357af8b 100644
--- a/include/linux/filter.h
+++ b/include/linux/filter.h
@@ -10,6 +10,7 @@
10 10
11#ifdef __KERNEL__ 11#ifdef __KERNEL__
12#include <linux/atomic.h> 12#include <linux/atomic.h>
13#include <linux/compat.h>
13#endif 14#endif
14 15
15/* 16/*
@@ -126,12 +127,23 @@ struct sock_fprog { /* Required for SO_ATTACH_FILTER. */
126#define SKF_AD_HATYPE 28 127#define SKF_AD_HATYPE 28
127#define SKF_AD_RXHASH 32 128#define SKF_AD_RXHASH 32
128#define SKF_AD_CPU 36 129#define SKF_AD_CPU 36
129#define SKF_AD_MAX 40 130#define SKF_AD_ALU_XOR_X 40
131#define SKF_AD_MAX 44
130#define SKF_NET_OFF (-0x100000) 132#define SKF_NET_OFF (-0x100000)
131#define SKF_LL_OFF (-0x200000) 133#define SKF_LL_OFF (-0x200000)
132 134
133#ifdef __KERNEL__ 135#ifdef __KERNEL__
134 136
137#ifdef CONFIG_COMPAT
138/*
139 * A struct sock_filter is architecture independent.
140 */
141struct compat_sock_fprog {
142 u16 len;
143 compat_uptr_t filter; /* struct sock_filter * */
144};
145#endif
146
135struct sk_buff; 147struct sk_buff;
136struct sock; 148struct sock;
137 149
@@ -153,6 +165,9 @@ static inline unsigned int sk_filter_len(const struct sk_filter *fp)
153extern int sk_filter(struct sock *sk, struct sk_buff *skb); 165extern int sk_filter(struct sock *sk, struct sk_buff *skb);
154extern unsigned int sk_run_filter(const struct sk_buff *skb, 166extern unsigned int sk_run_filter(const struct sk_buff *skb,
155 const struct sock_filter *filter); 167 const struct sock_filter *filter);
168extern int sk_unattached_filter_create(struct sk_filter **pfp,
169 struct sock_fprog *fprog);
170extern void sk_unattached_filter_destroy(struct sk_filter *fp);
156extern int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk); 171extern int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk);
157extern int sk_detach_filter(struct sock *sk); 172extern int sk_detach_filter(struct sock *sk);
158extern int sk_chk_filter(struct sock_filter *filter, unsigned int flen); 173extern int sk_chk_filter(struct sock_filter *filter, unsigned int flen);
@@ -228,6 +243,8 @@ enum {
228 BPF_S_ANC_HATYPE, 243 BPF_S_ANC_HATYPE,
229 BPF_S_ANC_RXHASH, 244 BPF_S_ANC_RXHASH,
230 BPF_S_ANC_CPU, 245 BPF_S_ANC_CPU,
246 BPF_S_ANC_ALU_XOR_X,
247 BPF_S_ANC_SECCOMP_LD_W,
231}; 248};
232 249
233#endif /* __KERNEL__ */ 250#endif /* __KERNEL__ */
diff --git a/include/linux/firewire.h b/include/linux/firewire.h
index cdc9b719e9c7..7edcf1031718 100644
--- a/include/linux/firewire.h
+++ b/include/linux/firewire.h
@@ -135,6 +135,20 @@ struct fw_card {
135 __be32 maint_utility_register; 135 __be32 maint_utility_register;
136}; 136};
137 137
138static inline struct fw_card *fw_card_get(struct fw_card *card)
139{
140 kref_get(&card->kref);
141
142 return card;
143}
144
145void fw_card_release(struct kref *kref);
146
147static inline void fw_card_put(struct fw_card *card)
148{
149 kref_put(&card->kref, fw_card_release);
150}
151
138struct fw_attribute_group { 152struct fw_attribute_group {
139 struct attribute_group *groups[2]; 153 struct attribute_group *groups[2];
140 struct attribute_group group; 154 struct attribute_group group;
@@ -325,6 +339,7 @@ int fw_core_add_address_handler(struct fw_address_handler *handler,
325void fw_core_remove_address_handler(struct fw_address_handler *handler); 339void fw_core_remove_address_handler(struct fw_address_handler *handler);
326void fw_send_response(struct fw_card *card, 340void fw_send_response(struct fw_card *card,
327 struct fw_request *request, int rcode); 341 struct fw_request *request, int rcode);
342int fw_get_request_speed(struct fw_request *request);
328void fw_send_request(struct fw_card *card, struct fw_transaction *t, 343void fw_send_request(struct fw_card *card, struct fw_transaction *t,
329 int tcode, int destination_id, int generation, int speed, 344 int tcode, int destination_id, int generation, int speed,
330 unsigned long long offset, void *payload, size_t length, 345 unsigned long long offset, void *payload, size_t length,
@@ -334,6 +349,7 @@ int fw_cancel_transaction(struct fw_card *card,
334int fw_run_transaction(struct fw_card *card, int tcode, int destination_id, 349int fw_run_transaction(struct fw_card *card, int tcode, int destination_id,
335 int generation, int speed, unsigned long long offset, 350 int generation, int speed, unsigned long long offset,
336 void *payload, size_t length); 351 void *payload, size_t length);
352const char *fw_rcode_string(int rcode);
337 353
338static inline int fw_stream_packet_destination_id(int tag, int channel, int sy) 354static inline int fw_stream_packet_destination_id(int tag, int channel, int sy)
339{ 355{
@@ -391,6 +407,7 @@ struct fw_iso_buffer {
391 enum dma_data_direction direction; 407 enum dma_data_direction direction;
392 struct page **pages; 408 struct page **pages;
393 int page_count; 409 int page_count;
410 int page_count_mapped;
394}; 411};
395 412
396int fw_iso_buffer_init(struct fw_iso_buffer *buffer, struct fw_card *card, 413int fw_iso_buffer_init(struct fw_iso_buffer *buffer, struct fw_card *card,
diff --git a/include/linux/fixp-arith.h b/include/linux/fixp-arith.h
new file mode 100644
index 000000000000..3089d7382325
--- /dev/null
+++ b/include/linux/fixp-arith.h
@@ -0,0 +1,87 @@
1#ifndef _FIXP_ARITH_H
2#define _FIXP_ARITH_H
3
4/*
5 * Simplistic fixed-point arithmetics.
6 * Hmm, I'm probably duplicating some code :(
7 *
8 * Copyright (c) 2002 Johann Deneux
9 */
10
11/*
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 *
26 * Should you need to contact me, the author, you can do so by
27 * e-mail - mail your message to <johann.deneux@gmail.com>
28 */
29
30#include <linux/types.h>
31
32/* The type representing fixed-point values */
33typedef s16 fixp_t;
34
35#define FRAC_N 8
36#define FRAC_MASK ((1<<FRAC_N)-1)
37
38/* Not to be used directly. Use fixp_{cos,sin} */
39static const fixp_t cos_table[46] = {
40 0x0100, 0x00FF, 0x00FF, 0x00FE, 0x00FD, 0x00FC, 0x00FA, 0x00F8,
41 0x00F6, 0x00F3, 0x00F0, 0x00ED, 0x00E9, 0x00E6, 0x00E2, 0x00DD,
42 0x00D9, 0x00D4, 0x00CF, 0x00C9, 0x00C4, 0x00BE, 0x00B8, 0x00B1,
43 0x00AB, 0x00A4, 0x009D, 0x0096, 0x008F, 0x0087, 0x0080, 0x0078,
44 0x0070, 0x0068, 0x005F, 0x0057, 0x004F, 0x0046, 0x003D, 0x0035,
45 0x002C, 0x0023, 0x001A, 0x0011, 0x0008, 0x0000
46};
47
48
49/* a: 123 -> 123.0 */
50static inline fixp_t fixp_new(s16 a)
51{
52 return a<<FRAC_N;
53}
54
55/* a: 0xFFFF -> -1.0
56 0x8000 -> 1.0
57 0x0000 -> 0.0
58*/
59static inline fixp_t fixp_new16(s16 a)
60{
61 return ((s32)a)>>(16-FRAC_N);
62}
63
64static inline fixp_t fixp_cos(unsigned int degrees)
65{
66 int quadrant = (degrees / 90) & 3;
67 unsigned int i = degrees % 90;
68
69 if (quadrant == 1 || quadrant == 3)
70 i = 90 - i;
71
72 i >>= 1;
73
74 return (quadrant == 1 || quadrant == 2)? -cos_table[i] : cos_table[i];
75}
76
77static inline fixp_t fixp_sin(unsigned int degrees)
78{
79 return -fixp_cos(degrees + 90);
80}
81
82static inline fixp_t fixp_mult(fixp_t a, fixp_t b)
83{
84 return ((s32)(a*b))>>FRAC_N;
85}
86
87#endif
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 8de675523e46..cdc1a9630948 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -402,6 +402,7 @@ struct inodes_stat_t {
402#include <linux/atomic.h> 402#include <linux/atomic.h>
403#include <linux/shrinker.h> 403#include <linux/shrinker.h>
404#include <linux/migrate_mode.h> 404#include <linux/migrate_mode.h>
405#include <linux/uidgid.h>
405 406
406#include <asm/byteorder.h> 407#include <asm/byteorder.h>
407 408
@@ -469,8 +470,8 @@ typedef void (dio_iodone_t)(struct kiocb *iocb, loff_t offset,
469struct iattr { 470struct iattr {
470 unsigned int ia_valid; 471 unsigned int ia_valid;
471 umode_t ia_mode; 472 umode_t ia_mode;
472 uid_t ia_uid; 473 kuid_t ia_uid;
473 gid_t ia_gid; 474 kgid_t ia_gid;
474 loff_t ia_size; 475 loff_t ia_size;
475 struct timespec ia_atime; 476 struct timespec ia_atime;
476 struct timespec ia_mtime; 477 struct timespec ia_mtime;
@@ -761,8 +762,8 @@ struct posix_acl;
761struct inode { 762struct inode {
762 umode_t i_mode; 763 umode_t i_mode;
763 unsigned short i_opflags; 764 unsigned short i_opflags;
764 uid_t i_uid; 765 kuid_t i_uid;
765 gid_t i_gid; 766 kgid_t i_gid;
766 unsigned int i_flags; 767 unsigned int i_flags;
767 768
768#ifdef CONFIG_FS_POSIX_ACL 769#ifdef CONFIG_FS_POSIX_ACL
@@ -927,6 +928,31 @@ static inline void i_size_write(struct inode *inode, loff_t i_size)
927#endif 928#endif
928} 929}
929 930
931/* Helper functions so that in most cases filesystems will
932 * not need to deal directly with kuid_t and kgid_t and can
933 * instead deal with the raw numeric values that are stored
934 * in the filesystem.
935 */
936static inline uid_t i_uid_read(const struct inode *inode)
937{
938 return from_kuid(&init_user_ns, inode->i_uid);
939}
940
941static inline gid_t i_gid_read(const struct inode *inode)
942{
943 return from_kgid(&init_user_ns, inode->i_gid);
944}
945
946static inline void i_uid_write(struct inode *inode, uid_t uid)
947{
948 inode->i_uid = make_kuid(&init_user_ns, uid);
949}
950
951static inline void i_gid_write(struct inode *inode, gid_t gid)
952{
953 inode->i_gid = make_kgid(&init_user_ns, gid);
954}
955
930static inline unsigned iminor(const struct inode *inode) 956static inline unsigned iminor(const struct inode *inode)
931{ 957{
932 return MINOR(inode->i_rdev); 958 return MINOR(inode->i_rdev);
@@ -943,7 +969,7 @@ struct fown_struct {
943 rwlock_t lock; /* protects pid, uid, euid fields */ 969 rwlock_t lock; /* protects pid, uid, euid fields */
944 struct pid *pid; /* pid or -pgrp where SIGIO should be sent */ 970 struct pid *pid; /* pid or -pgrp where SIGIO should be sent */
945 enum pid_type pid_type; /* Kind of process group SIGIO should be sent to */ 971 enum pid_type pid_type; /* Kind of process group SIGIO should be sent to */
946 uid_t uid, euid; /* uid/euid of process setting the owner */ 972 kuid_t uid, euid; /* uid/euid of process setting the owner */
947 int signum; /* posix.1b rt signal to be delivered on IO */ 973 int signum; /* posix.1b rt signal to be delivered on IO */
948}; 974};
949 975
@@ -1527,12 +1553,6 @@ enum {
1527#define vfs_check_frozen(sb, level) \ 1553#define vfs_check_frozen(sb, level) \
1528 wait_event((sb)->s_wait_unfrozen, ((sb)->s_frozen < (level))) 1554 wait_event((sb)->s_wait_unfrozen, ((sb)->s_frozen < (level)))
1529 1555
1530/*
1531 * until VFS tracks user namespaces for inodes, just make all files
1532 * belong to init_user_ns
1533 */
1534extern struct user_namespace init_user_ns;
1535#define inode_userns(inode) (&init_user_ns)
1536extern bool inode_owner_or_capable(const struct inode *inode); 1556extern bool inode_owner_or_capable(const struct inode *inode);
1537 1557
1538/* not quite ready to be deprecated, but... */ 1558/* not quite ready to be deprecated, but... */
@@ -1744,8 +1764,8 @@ struct super_operations {
1744 * I_FREEING Set when inode is about to be freed but still has dirty 1764 * I_FREEING Set when inode is about to be freed but still has dirty
1745 * pages or buffers attached or the inode itself is still 1765 * pages or buffers attached or the inode itself is still
1746 * dirty. 1766 * dirty.
1747 * I_CLEAR Added by end_writeback(). In this state the inode is clean 1767 * I_CLEAR Added by clear_inode(). In this state the inode is
1748 * and can be destroyed. Inode keeps I_FREEING. 1768 * clean and can be destroyed. Inode keeps I_FREEING.
1749 * 1769 *
1750 * Inodes that are I_WILL_FREE, I_FREEING or I_CLEAR are 1770 * Inodes that are I_WILL_FREE, I_FREEING or I_CLEAR are
1751 * prohibited for many purposes. iget() must wait for 1771 * prohibited for many purposes. iget() must wait for
@@ -1753,9 +1773,10 @@ struct super_operations {
1753 * anew. Other functions will just ignore such inodes, 1773 * anew. Other functions will just ignore such inodes,
1754 * if appropriate. I_NEW is used for waiting. 1774 * if appropriate. I_NEW is used for waiting.
1755 * 1775 *
1756 * I_SYNC Synchonized write of dirty inode data. The bits is 1776 * I_SYNC Writeback of inode is running. The bit is set during
1757 * set during data writeback, and cleared with a wakeup 1777 * data writeback, and cleared with a wakeup on the bit
1758 * on the bit address once it is done. 1778 * address once it is done. The bit is also used to pin
1779 * the inode in memory for flusher thread.
1759 * 1780 *
1760 * I_REFERENCED Marks the inode as recently references on the LRU list. 1781 * I_REFERENCED Marks the inode as recently references on the LRU list.
1761 * 1782 *
@@ -2051,6 +2072,7 @@ extern void unregister_blkdev(unsigned int, const char *);
2051extern struct block_device *bdget(dev_t); 2072extern struct block_device *bdget(dev_t);
2052extern struct block_device *bdgrab(struct block_device *bdev); 2073extern struct block_device *bdgrab(struct block_device *bdev);
2053extern void bd_set_size(struct block_device *, loff_t size); 2074extern void bd_set_size(struct block_device *, loff_t size);
2075extern sector_t blkdev_max_block(struct block_device *bdev);
2054extern void bd_forget(struct inode *inode); 2076extern void bd_forget(struct inode *inode);
2055extern void bdput(struct block_device *); 2077extern void bdput(struct block_device *);
2056extern void invalidate_bdev(struct block_device *); 2078extern void invalidate_bdev(struct block_device *);
@@ -2328,7 +2350,7 @@ extern unsigned int get_next_ino(void);
2328 2350
2329extern void __iget(struct inode * inode); 2351extern void __iget(struct inode * inode);
2330extern void iget_failed(struct inode *); 2352extern void iget_failed(struct inode *);
2331extern void end_writeback(struct inode *); 2353extern void clear_inode(struct inode *);
2332extern void __destroy_inode(struct inode *); 2354extern void __destroy_inode(struct inode *);
2333extern struct inode *new_inode_pseudo(struct super_block *sb); 2355extern struct inode *new_inode_pseudo(struct super_block *sb);
2334extern struct inode *new_inode(struct super_block *sb); 2356extern struct inode *new_inode(struct super_block *sb);
diff --git a/include/linux/fsl/mxs-dma.h b/include/linux/fsl/mxs-dma.h
index 203d7c4a3e11..55d870238399 100644
--- a/include/linux/fsl/mxs-dma.h
+++ b/include/linux/fsl/mxs-dma.h
@@ -15,14 +15,6 @@ struct mxs_dma_data {
15 int chan_irq; 15 int chan_irq;
16}; 16};
17 17
18static inline int mxs_dma_is_apbh(struct dma_chan *chan) 18extern int mxs_dma_is_apbh(struct dma_chan *chan);
19{ 19extern int mxs_dma_is_apbx(struct dma_chan *chan);
20 return !strcmp(dev_name(chan->device->dev), "mxs-dma-apbh");
21}
22
23static inline int mxs_dma_is_apbx(struct dma_chan *chan)
24{
25 return !strcmp(dev_name(chan->device->dev), "mxs-dma-apbx");
26}
27
28#endif /* __MACH_MXS_DMA_H__ */ 20#endif /* __MACH_MXS_DMA_H__ */
diff --git a/include/linux/fsl_devices.h b/include/linux/fsl_devices.h
index fffdf00f87b9..15be561e7397 100644
--- a/include/linux/fsl_devices.h
+++ b/include/linux/fsl_devices.h
@@ -6,7 +6,7 @@
6 * 6 *
7 * Maintainer: Kumar Gala <galak@kernel.crashing.org> 7 * Maintainer: Kumar Gala <galak@kernel.crashing.org>
8 * 8 *
9 * Copyright 2004 Freescale Semiconductor, Inc 9 * Copyright 2004,2012 Freescale Semiconductor, Inc
10 * 10 *
11 * This program is free software; you can redistribute it and/or modify it 11 * This program is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License as published by the 12 * under the terms of the GNU General Public License as published by the
@@ -17,6 +17,12 @@
17#ifndef _FSL_DEVICE_H_ 17#ifndef _FSL_DEVICE_H_
18#define _FSL_DEVICE_H_ 18#define _FSL_DEVICE_H_
19 19
20#define FSL_UTMI_PHY_DLY 10 /*As per P1010RM, delay for UTMI
21 PHY CLK to become stable - 10ms*/
22#define FSL_USB_VER_OLD 0
23#define FSL_USB_VER_1_6 1
24#define FSL_USB_VER_2_2 2
25
20#include <linux/types.h> 26#include <linux/types.h>
21 27
22/* 28/*
@@ -63,6 +69,7 @@ struct platform_device;
63 69
64struct fsl_usb2_platform_data { 70struct fsl_usb2_platform_data {
65 /* board specific information */ 71 /* board specific information */
72 int controller_ver;
66 enum fsl_usb2_operating_modes operating_mode; 73 enum fsl_usb2_operating_modes operating_mode;
67 enum fsl_usb2_phy_modes phy_mode; 74 enum fsl_usb2_phy_modes phy_mode;
68 unsigned int port_enables; 75 unsigned int port_enables;
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index 72a6cabb4d5b..55e6d63d46d0 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -286,10 +286,16 @@ struct ftrace_rec_iter *ftrace_rec_iter_start(void);
286struct ftrace_rec_iter *ftrace_rec_iter_next(struct ftrace_rec_iter *iter); 286struct ftrace_rec_iter *ftrace_rec_iter_next(struct ftrace_rec_iter *iter);
287struct dyn_ftrace *ftrace_rec_iter_record(struct ftrace_rec_iter *iter); 287struct dyn_ftrace *ftrace_rec_iter_record(struct ftrace_rec_iter *iter);
288 288
289#define for_ftrace_rec_iter(iter) \
290 for (iter = ftrace_rec_iter_start(); \
291 iter; \
292 iter = ftrace_rec_iter_next(iter))
293
294
289int ftrace_update_record(struct dyn_ftrace *rec, int enable); 295int ftrace_update_record(struct dyn_ftrace *rec, int enable);
290int ftrace_test_record(struct dyn_ftrace *rec, int enable); 296int ftrace_test_record(struct dyn_ftrace *rec, int enable);
291void ftrace_run_stop_machine(int command); 297void ftrace_run_stop_machine(int command);
292int ftrace_location(unsigned long ip); 298unsigned long ftrace_location(unsigned long ip);
293 299
294extern ftrace_func_t ftrace_trace_function; 300extern ftrace_func_t ftrace_trace_function;
295 301
@@ -308,11 +314,14 @@ ftrace_set_early_filter(struct ftrace_ops *ops, char *buf, int enable);
308/* defined in arch */ 314/* defined in arch */
309extern int ftrace_ip_converted(unsigned long ip); 315extern int ftrace_ip_converted(unsigned long ip);
310extern int ftrace_dyn_arch_init(void *data); 316extern int ftrace_dyn_arch_init(void *data);
317extern void ftrace_replace_code(int enable);
311extern int ftrace_update_ftrace_func(ftrace_func_t func); 318extern int ftrace_update_ftrace_func(ftrace_func_t func);
312extern void ftrace_caller(void); 319extern void ftrace_caller(void);
313extern void ftrace_call(void); 320extern void ftrace_call(void);
314extern void mcount_call(void); 321extern void mcount_call(void);
315 322
323void ftrace_modify_all_code(int command);
324
316#ifndef FTRACE_ADDR 325#ifndef FTRACE_ADDR
317#define FTRACE_ADDR ((unsigned long)ftrace_caller) 326#define FTRACE_ADDR ((unsigned long)ftrace_caller)
318#endif 327#endif
@@ -485,8 +494,12 @@ static inline void __ftrace_enabled_restore(int enabled)
485 extern void trace_preempt_on(unsigned long a0, unsigned long a1); 494 extern void trace_preempt_on(unsigned long a0, unsigned long a1);
486 extern void trace_preempt_off(unsigned long a0, unsigned long a1); 495 extern void trace_preempt_off(unsigned long a0, unsigned long a1);
487#else 496#else
488 static inline void trace_preempt_on(unsigned long a0, unsigned long a1) { } 497/*
489 static inline void trace_preempt_off(unsigned long a0, unsigned long a1) { } 498 * Use defines instead of static inlines because some arches will make code out
499 * of the CALLER_ADDR, when we really want these to be a real nop.
500 */
501# define trace_preempt_on(a0, a1) do { } while (0)
502# define trace_preempt_off(a0, a1) do { } while (0)
490#endif 503#endif
491 504
492#ifdef CONFIG_FTRACE_MCOUNT_RECORD 505#ifdef CONFIG_FTRACE_MCOUNT_RECORD
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
index 5f3f3be5af09..176a939d1547 100644
--- a/include/linux/ftrace_event.h
+++ b/include/linux/ftrace_event.h
@@ -179,6 +179,7 @@ enum {
179 TRACE_EVENT_FL_RECORDED_CMD_BIT, 179 TRACE_EVENT_FL_RECORDED_CMD_BIT,
180 TRACE_EVENT_FL_CAP_ANY_BIT, 180 TRACE_EVENT_FL_CAP_ANY_BIT,
181 TRACE_EVENT_FL_NO_SET_FILTER_BIT, 181 TRACE_EVENT_FL_NO_SET_FILTER_BIT,
182 TRACE_EVENT_FL_IGNORE_ENABLE_BIT,
182}; 183};
183 184
184enum { 185enum {
@@ -187,6 +188,7 @@ enum {
187 TRACE_EVENT_FL_RECORDED_CMD = (1 << TRACE_EVENT_FL_RECORDED_CMD_BIT), 188 TRACE_EVENT_FL_RECORDED_CMD = (1 << TRACE_EVENT_FL_RECORDED_CMD_BIT),
188 TRACE_EVENT_FL_CAP_ANY = (1 << TRACE_EVENT_FL_CAP_ANY_BIT), 189 TRACE_EVENT_FL_CAP_ANY = (1 << TRACE_EVENT_FL_CAP_ANY_BIT),
189 TRACE_EVENT_FL_NO_SET_FILTER = (1 << TRACE_EVENT_FL_NO_SET_FILTER_BIT), 190 TRACE_EVENT_FL_NO_SET_FILTER = (1 << TRACE_EVENT_FL_NO_SET_FILTER_BIT),
191 TRACE_EVENT_FL_IGNORE_ENABLE = (1 << TRACE_EVENT_FL_IGNORE_ENABLE_BIT),
190}; 192};
191 193
192struct ftrace_event_call { 194struct ftrace_event_call {
diff --git a/include/linux/gameport.h b/include/linux/gameport.h
index b456b08d70ed..b986be513406 100644
--- a/include/linux/gameport.h
+++ b/include/linux/gameport.h
@@ -153,6 +153,19 @@ int __must_check __gameport_register_driver(struct gameport_driver *drv,
153 153
154void gameport_unregister_driver(struct gameport_driver *drv); 154void gameport_unregister_driver(struct gameport_driver *drv);
155 155
156/**
157 * module_gameport_driver() - Helper macro for registering a gameport driver
158 * @__gameport_driver: gameport_driver struct
159 *
160 * Helper macro for gameport drivers which do not do anything special in
161 * module init/exit. This eliminates a lot of boilerplate. Each module may
162 * only use this macro once, and calling it replaces module_init() and
163 * module_exit().
164 */
165#define module_gameport_driver(__gameport_driver) \
166 module_driver(__gameport_driver, gameport_register_driver, \
167 gameport_unregister_driver)
168
156#endif /* __KERNEL__ */ 169#endif /* __KERNEL__ */
157 170
158#define GAMEPORT_MODE_DISABLED 0 171#define GAMEPORT_MODE_DISABLED 0
diff --git a/include/linux/generic_serial.h b/include/linux/generic_serial.h
index fadff28505bb..79b3eb37243a 100644
--- a/include/linux/generic_serial.h
+++ b/include/linux/generic_serial.h
@@ -4,7 +4,6 @@
4 * Copyright (C) 1998 R.E.Wolff@BitWizard.nl 4 * Copyright (C) 1998 R.E.Wolff@BitWizard.nl
5 * 5 *
6 * written for the SX serial driver. 6 * written for the SX serial driver.
7 * Contains the code that should be shared over all the serial drivers.
8 * 7 *
9 * Version 0.1 -- December, 1998. 8 * Version 0.1 -- December, 1998.
10 */ 9 */
@@ -12,45 +11,8 @@
12#ifndef GENERIC_SERIAL_H 11#ifndef GENERIC_SERIAL_H
13#define GENERIC_SERIAL_H 12#define GENERIC_SERIAL_H
14 13
15#ifdef __KERNEL__ 14#warning Use of this header is deprecated.
16#include <linux/mutex.h> 15#warning Since nobody sets the constants defined here for you, you should not, in any case, use them. Including the header is thus pointless.
17#include <linux/tty.h>
18
19struct real_driver {
20 void (*disable_tx_interrupts) (void *);
21 void (*enable_tx_interrupts) (void *);
22 void (*disable_rx_interrupts) (void *);
23 void (*enable_rx_interrupts) (void *);
24 void (*shutdown_port) (void*);
25 int (*set_real_termios) (void*);
26 int (*chars_in_buffer) (void*);
27 void (*close) (void*);
28 void (*hungup) (void*);
29 void (*getserial) (void*, struct serial_struct *sp);
30};
31
32
33
34struct gs_port {
35 int magic;
36 struct tty_port port;
37 unsigned char *xmit_buf;
38 int xmit_head;
39 int xmit_tail;
40 int xmit_cnt;
41 struct mutex port_write_mutex;
42 unsigned long event;
43 unsigned short closing_wait;
44 int close_delay;
45 struct real_driver *rd;
46 int wakeup_chars;
47 int baud_base;
48 int baud;
49 int custom_divisor;
50 spinlock_t driver_lock;
51};
52
53#endif /* __KERNEL__ */
54 16
55/* Flags */ 17/* Flags */
56/* Warning: serial.h defines some ASYNC_ flags, they say they are "only" 18/* Warning: serial.h defines some ASYNC_ flags, they say they are "only"
@@ -60,8 +22,6 @@ struct gs_port {
60#define GS_RX_INTEN 0x00400000 22#define GS_RX_INTEN 0x00400000
61#define GS_ACTIVE 0x00200000 23#define GS_ACTIVE 0x00200000
62 24
63
64
65#define GS_TYPE_NORMAL 1 25#define GS_TYPE_NORMAL 1
66 26
67#define GS_DEBUG_FLUSH 0x00000001 27#define GS_DEBUG_FLUSH 0x00000001
@@ -72,24 +32,4 @@ struct gs_port {
72#define GS_DEBUG_FLOW 0x00000020 32#define GS_DEBUG_FLOW 0x00000020
73#define GS_DEBUG_WRITE 0x00000040 33#define GS_DEBUG_WRITE 0x00000040
74 34
75#ifdef __KERNEL__
76int gs_put_char(struct tty_struct *tty, unsigned char ch);
77int gs_write(struct tty_struct *tty,
78 const unsigned char *buf, int count);
79int gs_write_room(struct tty_struct *tty);
80int gs_chars_in_buffer(struct tty_struct *tty);
81void gs_flush_buffer(struct tty_struct *tty);
82void gs_flush_chars(struct tty_struct *tty);
83void gs_stop(struct tty_struct *tty);
84void gs_start(struct tty_struct *tty);
85void gs_hangup(struct tty_struct *tty);
86int gs_block_til_ready(void *port, struct file *filp);
87void gs_close(struct tty_struct *tty, struct file *filp);
88void gs_set_termios (struct tty_struct * tty,
89 struct ktermios * old_termios);
90int gs_init_port(struct gs_port *port);
91int gs_setserial(struct gs_port *port, struct serial_struct __user *sp);
92int gs_getserial(struct gs_port *port, struct serial_struct __user *sp);
93void gs_got_break(struct gs_port *port);
94#endif /* __KERNEL__ */
95#endif 35#endif
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index e61d3192448e..017a7fb5a1fc 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -222,12 +222,6 @@ static inline void part_pack_uuid(const u8 *uuid_str, u8 *to)
222 } 222 }
223} 223}
224 224
225static inline char *part_unpack_uuid(const u8 *uuid, char *out)
226{
227 sprintf(out, "%pU", uuid);
228 return out;
229}
230
231static inline int disk_max_parts(struct gendisk *disk) 225static inline int disk_max_parts(struct gendisk *disk)
232{ 226{
233 if (disk->flags & GENHD_FL_EXT_DEVT) 227 if (disk->flags & GENHD_FL_EXT_DEVT)
diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index 581e74b7df95..1e49be49d324 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -391,4 +391,16 @@ static inline bool pm_suspended_storage(void)
391} 391}
392#endif /* CONFIG_PM_SLEEP */ 392#endif /* CONFIG_PM_SLEEP */
393 393
394#ifdef CONFIG_CMA
395
396/* The below functions must be run on a range from a single zone. */
397extern int alloc_contig_range(unsigned long start, unsigned long end,
398 unsigned migratetype);
399extern void free_contig_range(unsigned long pfn, unsigned nr_pages);
400
401/* CMA stuff */
402extern void init_cma_reserved_pageblock(struct page *page);
403
404#endif
405
394#endif /* __LINUX_GFP_H */ 406#endif /* __LINUX_GFP_H */
diff --git a/include/linux/gpio.h b/include/linux/gpio.h
index 6155ecf192b0..f07fc2d08159 100644
--- a/include/linux/gpio.h
+++ b/include/linux/gpio.h
@@ -1,6 +1,8 @@
1#ifndef __LINUX_GPIO_H 1#ifndef __LINUX_GPIO_H
2#define __LINUX_GPIO_H 2#define __LINUX_GPIO_H
3 3
4#include <linux/errno.h>
5
4/* see Documentation/gpio.txt */ 6/* see Documentation/gpio.txt */
5 7
6/* make these flag values available regardless of GPIO kconfig options */ 8/* make these flag values available regardless of GPIO kconfig options */
@@ -20,6 +22,11 @@
20/* Gpio pin is open source */ 22/* Gpio pin is open source */
21#define GPIOF_OPEN_SOURCE (1 << 3) 23#define GPIOF_OPEN_SOURCE (1 << 3)
22 24
25#define GPIOF_EXPORT (1 << 2)
26#define GPIOF_EXPORT_CHANGEABLE (1 << 3)
27#define GPIOF_EXPORT_DIR_FIXED (GPIOF_EXPORT)
28#define GPIOF_EXPORT_DIR_CHANGEABLE (GPIOF_EXPORT | GPIOF_EXPORT_CHANGEABLE)
29
23/** 30/**
24 * struct gpio - a structure describing a GPIO with configuration 31 * struct gpio - a structure describing a GPIO with configuration
25 * @gpio: the GPIO number 32 * @gpio: the GPIO number
@@ -33,7 +40,39 @@ struct gpio {
33}; 40};
34 41
35#ifdef CONFIG_GENERIC_GPIO 42#ifdef CONFIG_GENERIC_GPIO
43
44#ifdef CONFIG_ARCH_HAVE_CUSTOM_GPIO_H
36#include <asm/gpio.h> 45#include <asm/gpio.h>
46#else
47
48#include <asm-generic/gpio.h>
49
50static inline int gpio_get_value(unsigned int gpio)
51{
52 return __gpio_get_value(gpio);
53}
54
55static inline void gpio_set_value(unsigned int gpio, int value)
56{
57 __gpio_set_value(gpio, value);
58}
59
60static inline int gpio_cansleep(unsigned int gpio)
61{
62 return __gpio_cansleep(gpio);
63}
64
65static inline int gpio_to_irq(unsigned int gpio)
66{
67 return __gpio_to_irq(gpio);
68}
69
70static inline int irq_to_gpio(unsigned int irq)
71{
72 return -EINVAL;
73}
74
75#endif
37 76
38#else 77#else
39 78
@@ -55,12 +94,24 @@ static inline int gpio_request(unsigned gpio, const char *label)
55 return -ENOSYS; 94 return -ENOSYS;
56} 95}
57 96
97static inline int devm_gpio_request(struct device *dev, unsigned gpio,
98 const char *label)
99{
100 return -ENOSYS;
101}
102
58static inline int gpio_request_one(unsigned gpio, 103static inline int gpio_request_one(unsigned gpio,
59 unsigned long flags, const char *label) 104 unsigned long flags, const char *label)
60{ 105{
61 return -ENOSYS; 106 return -ENOSYS;
62} 107}
63 108
109static inline int devm_gpio_request_one(struct device *dev, unsigned gpio,
110 unsigned long flags, const char *label)
111{
112 return -ENOSYS;
113}
114
64static inline int gpio_request_array(const struct gpio *array, size_t num) 115static inline int gpio_request_array(const struct gpio *array, size_t num)
65{ 116{
66 return -ENOSYS; 117 return -ENOSYS;
@@ -74,6 +125,14 @@ static inline void gpio_free(unsigned gpio)
74 WARN_ON(1); 125 WARN_ON(1);
75} 126}
76 127
128static inline void devm_gpio_free(struct device *dev, unsigned gpio)
129{
130 might_sleep();
131
132 /* GPIO can never have been requested */
133 WARN_ON(1);
134}
135
77static inline void gpio_free_array(const struct gpio *array, size_t num) 136static inline void gpio_free_array(const struct gpio *array, size_t num)
78{ 137{
79 might_sleep(); 138 might_sleep();
diff --git a/include/linux/hid.h b/include/linux/hid.h
index 3a95da60fd3e..449fa385703d 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -317,7 +317,6 @@ struct hid_item {
317#define HID_QUIRK_BADPAD 0x00000020 317#define HID_QUIRK_BADPAD 0x00000020
318#define HID_QUIRK_MULTI_INPUT 0x00000040 318#define HID_QUIRK_MULTI_INPUT 0x00000040
319#define HID_QUIRK_HIDINPUT_FORCE 0x00000080 319#define HID_QUIRK_HIDINPUT_FORCE 0x00000080
320#define HID_QUIRK_MULTITOUCH 0x00000100
321#define HID_QUIRK_SKIP_OUTPUT_REPORTS 0x00010000 320#define HID_QUIRK_SKIP_OUTPUT_REPORTS 0x00010000
322#define HID_QUIRK_FULLSPEED_INTERVAL 0x10000000 321#define HID_QUIRK_FULLSPEED_INTERVAL 0x10000000
323#define HID_QUIRK_NO_INIT_REPORTS 0x20000000 322#define HID_QUIRK_NO_INIT_REPORTS 0x20000000
@@ -325,6 +324,12 @@ struct hid_item {
325#define HID_QUIRK_NO_INPUT_SYNC 0x80000000 324#define HID_QUIRK_NO_INPUT_SYNC 0x80000000
326 325
327/* 326/*
327 * HID device groups
328 */
329#define HID_GROUP_GENERIC 0x0001
330#define HID_GROUP_MULTITOUCH 0x0002
331
332/*
328 * This is the global environment of the parser. This information is 333 * This is the global environment of the parser. This information is
329 * persistent for main-items. The global environment can be saved and 334 * persistent for main-items. The global environment can be saved and
330 * restored with PUSH/POP statements. 335 * restored with PUSH/POP statements.
@@ -467,6 +472,8 @@ struct hid_driver;
467struct hid_ll_driver; 472struct hid_ll_driver;
468 473
469struct hid_device { /* device report descriptor */ 474struct hid_device { /* device report descriptor */
475 __u8 *dev_rdesc;
476 unsigned dev_rsize;
470 __u8 *rdesc; 477 __u8 *rdesc;
471 unsigned rsize; 478 unsigned rsize;
472 struct hid_collection *collection; /* List of HID collections */ 479 struct hid_collection *collection; /* List of HID collections */
@@ -474,6 +481,7 @@ struct hid_device { /* device report descriptor */
474 unsigned maxcollection; /* Number of parsed collections */ 481 unsigned maxcollection; /* Number of parsed collections */
475 unsigned maxapplication; /* Number of applications */ 482 unsigned maxapplication; /* Number of applications */
476 __u16 bus; /* BUS ID */ 483 __u16 bus; /* BUS ID */
484 __u16 group; /* Report group */
477 __u32 vendor; /* Vendor ID */ 485 __u32 vendor; /* Vendor ID */
478 __u32 product; /* Product ID */ 486 __u32 product; /* Product ID */
479 __u32 version; /* HID version */ 487 __u32 version; /* HID version */
@@ -578,12 +586,12 @@ struct hid_descriptor {
578 struct hid_class_descriptor desc[1]; 586 struct hid_class_descriptor desc[1];
579} __attribute__ ((packed)); 587} __attribute__ ((packed));
580 588
581#define HID_DEVICE(b, ven, prod) \ 589#define HID_DEVICE(b, g, ven, prod) \
582 .bus = (b), \ 590 .bus = (b), .group = (g), .vendor = (ven), .product = (prod)
583 .vendor = (ven), .product = (prod) 591#define HID_USB_DEVICE(ven, prod) \
584 592 .bus = BUS_USB, .vendor = (ven), .product = (prod)
585#define HID_USB_DEVICE(ven, prod) HID_DEVICE(BUS_USB, ven, prod) 593#define HID_BLUETOOTH_DEVICE(ven, prod) \
586#define HID_BLUETOOTH_DEVICE(ven, prod) HID_DEVICE(BUS_BLUETOOTH, ven, prod) 594 .bus = BUS_BLUETOOTH, .vendor = (ven), .product = (prod)
587 595
588#define HID_REPORT_ID(rep) \ 596#define HID_REPORT_ID(rep) \
589 .report_type = (rep) 597 .report_type = (rep)
@@ -735,6 +743,7 @@ void hid_output_report(struct hid_report *report, __u8 *data);
735struct hid_device *hid_allocate_device(void); 743struct hid_device *hid_allocate_device(void);
736struct hid_report *hid_register_report(struct hid_device *device, unsigned type, unsigned id); 744struct hid_report *hid_register_report(struct hid_device *device, unsigned type, unsigned id);
737int hid_parse_report(struct hid_device *hid, __u8 *start, unsigned size); 745int hid_parse_report(struct hid_device *hid, __u8 *start, unsigned size);
746int hid_open_report(struct hid_device *device);
738int hid_check_keys_pressed(struct hid_device *hid); 747int hid_check_keys_pressed(struct hid_device *hid);
739int hid_connect(struct hid_device *hid, unsigned int connect_mask); 748int hid_connect(struct hid_device *hid, unsigned int connect_mask);
740void hid_disconnect(struct hid_device *hid); 749void hid_disconnect(struct hid_device *hid);
@@ -805,16 +814,7 @@ static inline void hid_map_usage_clear(struct hid_input *hidinput,
805 */ 814 */
806static inline int __must_check hid_parse(struct hid_device *hdev) 815static inline int __must_check hid_parse(struct hid_device *hdev)
807{ 816{
808 int ret; 817 return hid_open_report(hdev);
809
810 if (hdev->status & HID_STAT_PARSED)
811 return 0;
812
813 ret = hdev->ll_driver->parse(hdev);
814 if (!ret)
815 hdev->status |= HID_STAT_PARSED;
816
817 return ret;
818} 818}
819 819
820/** 820/**
@@ -896,7 +896,7 @@ static inline int hid_hw_power(struct hid_device *hdev, int level)
896 return hdev->ll_driver->power ? hdev->ll_driver->power(hdev, level) : 0; 896 return hdev->ll_driver->power ? hdev->ll_driver->power(hdev, level) : 0;
897} 897}
898 898
899void hid_report_raw_event(struct hid_device *hid, int type, u8 *data, int size, 899int hid_report_raw_event(struct hid_device *hid, int type, u8 *data, int size,
900 int interrupt); 900 int interrupt);
901 901
902extern int hid_generic_init(void); 902extern int hid_generic_init(void);
diff --git a/include/linux/hidraw.h b/include/linux/hidraw.h
index 4b88e697c4e9..45e9fcb8d877 100644
--- a/include/linux/hidraw.h
+++ b/include/linux/hidraw.h
@@ -76,13 +76,13 @@ struct hidraw_list {
76#ifdef CONFIG_HIDRAW 76#ifdef CONFIG_HIDRAW
77int hidraw_init(void); 77int hidraw_init(void);
78void hidraw_exit(void); 78void hidraw_exit(void);
79void hidraw_report_event(struct hid_device *, u8 *, int); 79int hidraw_report_event(struct hid_device *, u8 *, int);
80int hidraw_connect(struct hid_device *); 80int hidraw_connect(struct hid_device *);
81void hidraw_disconnect(struct hid_device *); 81void hidraw_disconnect(struct hid_device *);
82#else 82#else
83static inline int hidraw_init(void) { return 0; } 83static inline int hidraw_init(void) { return 0; }
84static inline void hidraw_exit(void) { } 84static inline void hidraw_exit(void) { }
85static inline void hidraw_report_event(struct hid_device *hid, u8 *data, int len) { } 85static inline int hidraw_report_event(struct hid_device *hid, u8 *data, int len) { return 0; }
86static inline int hidraw_connect(struct hid_device *hid) { return -1; } 86static inline int hidraw_connect(struct hid_device *hid) { return -1; }
87static inline void hidraw_disconnect(struct hid_device *hid) { } 87static inline void hidraw_disconnect(struct hid_device *hid) { }
88#endif 88#endif
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 000837e126e6..d5d6bbe2259e 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -284,6 +284,14 @@ static inline unsigned int blocks_per_huge_page(struct hstate *h)
284 284
285#include <asm/hugetlb.h> 285#include <asm/hugetlb.h>
286 286
287#ifndef arch_make_huge_pte
288static inline pte_t arch_make_huge_pte(pte_t entry, struct vm_area_struct *vma,
289 struct page *page, int writable)
290{
291 return entry;
292}
293#endif
294
287static inline struct hstate *page_hstate(struct page *page) 295static inline struct hstate *page_hstate(struct page *page)
288{ 296{
289 return size_to_hstate(PAGE_SIZE << compound_order(page)); 297 return size_to_hstate(PAGE_SIZE << compound_order(page));
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index 5852545e6bba..68ed7f7e1fc9 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -274,6 +274,33 @@ struct hv_ring_buffer_debug_info {
274 u32 bytes_avail_towrite; 274 u32 bytes_avail_towrite;
275}; 275};
276 276
277
278/*
279 *
280 * hv_get_ringbuffer_availbytes()
281 *
282 * Get number of bytes available to read and to write to
283 * for the specified ring buffer
284 */
285static inline void
286hv_get_ringbuffer_availbytes(struct hv_ring_buffer_info *rbi,
287 u32 *read, u32 *write)
288{
289 u32 read_loc, write_loc, dsize;
290
291 smp_read_barrier_depends();
292
293 /* Capture the read/write indices before they changed */
294 read_loc = rbi->ring_buffer->read_index;
295 write_loc = rbi->ring_buffer->write_index;
296 dsize = rbi->ring_datasize;
297
298 *write = write_loc >= read_loc ? dsize - (write_loc - read_loc) :
299 read_loc - write_loc;
300 *read = dsize - *write;
301}
302
303
277/* 304/*
278 * We use the same version numbering for all Hyper-V modules. 305 * We use the same version numbering for all Hyper-V modules.
279 * 306 *
@@ -1035,8 +1062,10 @@ struct hyperv_service_callback {
1035 void (*callback) (void *context); 1062 void (*callback) (void *context);
1036}; 1063};
1037 1064
1065#define MAX_SRV_VER 0x7ffffff
1038extern void vmbus_prep_negotiate_resp(struct icmsg_hdr *, 1066extern void vmbus_prep_negotiate_resp(struct icmsg_hdr *,
1039 struct icmsg_negotiate *, u8 *); 1067 struct icmsg_negotiate *, u8 *, int,
1068 int);
1040 1069
1041int hv_kvp_init(struct hv_util_service *); 1070int hv_kvp_init(struct hv_util_service *);
1042void hv_kvp_deinit(void); 1071void hv_kvp_deinit(void);
diff --git a/include/linux/gpio-i2cmux.h b/include/linux/i2c-mux-gpio.h
index 4a333bb0bd0d..a36343a37ebc 100644
--- a/include/linux/gpio-i2cmux.h
+++ b/include/linux/i2c-mux-gpio.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * gpio-i2cmux interface to platform code 2 * i2c-mux-gpio interface to platform code
3 * 3 *
4 * Peter Korsgaard <peter.korsgaard@barco.com> 4 * Peter Korsgaard <peter.korsgaard@barco.com>
5 * 5 *
@@ -8,14 +8,14 @@
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 */ 9 */
10 10
11#ifndef _LINUX_GPIO_I2CMUX_H 11#ifndef _LINUX_I2C_MUX_GPIO_H
12#define _LINUX_GPIO_I2CMUX_H 12#define _LINUX_I2C_MUX_GPIO_H
13 13
14/* MUX has no specific idle mode */ 14/* MUX has no specific idle mode */
15#define GPIO_I2CMUX_NO_IDLE ((unsigned)-1) 15#define I2C_MUX_GPIO_NO_IDLE ((unsigned)-1)
16 16
17/** 17/**
18 * struct gpio_i2cmux_platform_data - Platform-dependent data for gpio-i2cmux 18 * struct i2c_mux_gpio_platform_data - Platform-dependent data for i2c-mux-gpio
19 * @parent: Parent I2C bus adapter number 19 * @parent: Parent I2C bus adapter number
20 * @base_nr: Base I2C bus number to number adapters from or zero for dynamic 20 * @base_nr: Base I2C bus number to number adapters from or zero for dynamic
21 * @values: Array of bitmasks of GPIO settings (low/high) for each 21 * @values: Array of bitmasks of GPIO settings (low/high) for each
@@ -25,7 +25,7 @@
25 * @n_gpios: Number of GPIOs used to control MUX 25 * @n_gpios: Number of GPIOs used to control MUX
26 * @idle: Bitmask to write to MUX when idle or GPIO_I2CMUX_NO_IDLE if not used 26 * @idle: Bitmask to write to MUX when idle or GPIO_I2CMUX_NO_IDLE if not used
27 */ 27 */
28struct gpio_i2cmux_platform_data { 28struct i2c_mux_gpio_platform_data {
29 int parent; 29 int parent;
30 int base_nr; 30 int base_nr;
31 const unsigned *values; 31 const unsigned *values;
@@ -35,4 +35,4 @@ struct gpio_i2cmux_platform_data {
35 unsigned idle; 35 unsigned idle;
36}; 36};
37 37
38#endif /* _LINUX_GPIO_I2CMUX_H */ 38#endif /* _LINUX_I2C_MUX_GPIO_H */
diff --git a/include/linux/i2c-mux.h b/include/linux/i2c-mux.h
index 747f0cde4164..c79083830014 100644
--- a/include/linux/i2c-mux.h
+++ b/include/linux/i2c-mux.h
@@ -34,7 +34,8 @@
34 * mux control. 34 * mux control.
35 */ 35 */
36struct i2c_adapter *i2c_add_mux_adapter(struct i2c_adapter *parent, 36struct i2c_adapter *i2c_add_mux_adapter(struct i2c_adapter *parent,
37 void *mux_dev, u32 force_nr, u32 chan_id, 37 struct device *mux_dev,
38 void *mux_priv, u32 force_nr, u32 chan_id,
38 int (*select) (struct i2c_adapter *, 39 int (*select) (struct i2c_adapter *,
39 void *mux_dev, u32 chan_id), 40 void *mux_dev, u32 chan_id),
40 int (*deselect) (struct i2c_adapter *, 41 int (*deselect) (struct i2c_adapter *,
diff --git a/include/linux/i2c-pnx.h b/include/linux/i2c-pnx.h
index a87124d4d533..1bc74afe7a35 100644
--- a/include/linux/i2c-pnx.h
+++ b/include/linux/i2c-pnx.h
@@ -29,14 +29,10 @@ struct i2c_pnx_algo_data {
29 struct i2c_pnx_mif mif; 29 struct i2c_pnx_mif mif;
30 int last; 30 int last;
31 struct clk *clk; 31 struct clk *clk;
32 struct i2c_pnx_data *i2c_pnx;
33 struct i2c_adapter adapter; 32 struct i2c_adapter adapter;
34}; 33 phys_addr_t base;
35 34 int irq;
36struct i2c_pnx_data { 35 u32 timeout;
37 const char *name;
38 u32 base;
39 int irq;
40}; 36};
41 37
42#endif /* __I2C_PNX_H__ */ 38#endif /* __I2C_PNX_H__ */
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 195d8b3d9cfb..b66cb601435f 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -232,6 +232,7 @@ struct i2c_client {
232#define to_i2c_client(d) container_of(d, struct i2c_client, dev) 232#define to_i2c_client(d) container_of(d, struct i2c_client, dev)
233 233
234extern struct i2c_client *i2c_verify_client(struct device *dev); 234extern struct i2c_client *i2c_verify_client(struct device *dev);
235extern struct i2c_adapter *i2c_verify_adapter(struct device *dev);
235 236
236static inline struct i2c_client *kobj_to_i2c_client(struct kobject *kobj) 237static inline struct i2c_client *kobj_to_i2c_client(struct kobject *kobj)
237{ 238{
diff --git a/include/linux/i2c/adp5588.h b/include/linux/i2c/adp5588.h
index cec17cf6cac2..d8341cb47b60 100644
--- a/include/linux/i2c/adp5588.h
+++ b/include/linux/i2c/adp5588.h
@@ -157,6 +157,7 @@ struct i2c_client; /* forward declaration */
157 157
158struct adp5588_gpio_platform_data { 158struct adp5588_gpio_platform_data {
159 int gpio_start; /* GPIO Chip base # */ 159 int gpio_start; /* GPIO Chip base # */
160 const char *const *names;
160 unsigned irq_base; /* interrupt base # */ 161 unsigned irq_base; /* interrupt base # */
161 unsigned pullup_dis_mask; /* Pull-Up Disable Mask */ 162 unsigned pullup_dis_mask; /* Pull-Up Disable Mask */
162 int (*setup)(struct i2c_client *client, 163 int (*setup)(struct i2c_client *client,
diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h
index d1afedc00898..3993477103a5 100644
--- a/include/linux/i2c/twl.h
+++ b/include/linux/i2c/twl.h
@@ -750,6 +750,11 @@ struct twl_regulator_driver_data {
750#define TWL5031 BIT(2) /* twl5031 has different registers */ 750#define TWL5031 BIT(2) /* twl5031 has different registers */
751#define TWL6030_CLASS BIT(3) /* TWL6030 class */ 751#define TWL6030_CLASS BIT(3) /* TWL6030 class */
752#define TWL6025_SUBCLASS BIT(4) /* TWL6025 has changed registers */ 752#define TWL6025_SUBCLASS BIT(4) /* TWL6025 has changed registers */
753#define TWL4030_ALLOW_UNSUPPORTED BIT(5) /* Some voltages are possible
754 * but not officially supported.
755 * This flag is necessary to
756 * enable them.
757 */
753 758
754/*----------------------------------------------------------------------*/ 759/*----------------------------------------------------------------------*/
755 760
diff --git a/include/linux/i2o-dev.h b/include/linux/i2o-dev.h
index a0b23dd45239..a8093bfec3a6 100644
--- a/include/linux/i2o-dev.h
+++ b/include/linux/i2o-dev.h
@@ -124,7 +124,7 @@ typedef struct i2o_sg_io_hdr {
124#define I2O_BUS_LOCAL 0 124#define I2O_BUS_LOCAL 0
125#define I2O_BUS_ISA 1 125#define I2O_BUS_ISA 1
126#define I2O_BUS_EISA 2 126#define I2O_BUS_EISA 2
127#define I2O_BUS_MCA 3 127/* was I2O_BUS_MCA 3 */
128#define I2O_BUS_PCI 4 128#define I2O_BUS_PCI 4
129#define I2O_BUS_PCMCIA 5 129#define I2O_BUS_PCMCIA 5
130#define I2O_BUS_NUBUS 6 130#define I2O_BUS_NUBUS 6
diff --git a/include/linux/ibmtr.h b/include/linux/ibmtr.h
deleted file mode 100644
index 06695b74d405..000000000000
--- a/include/linux/ibmtr.h
+++ /dev/null
@@ -1,373 +0,0 @@
1#ifndef __LINUX_IBMTR_H__
2#define __LINUX_IBMTR_H__
3
4/* Definitions for an IBM Token Ring card. */
5/* This file is distributed under the GNU GPL */
6
7/* ported to the Alpha architecture 02/20/96 (just used the HZ macro) */
8
9#define TR_RETRY_INTERVAL (30*HZ) /* 500 on PC = 5 s */
10#define TR_RST_TIME (msecs_to_jiffies(50)) /* 5 on PC = 50 ms */
11#define TR_BUSY_INTERVAL (msecs_to_jiffies(200)) /* 5 on PC = 200 ms */
12#define TR_SPIN_INTERVAL (3*HZ) /* 3 seconds before init timeout */
13
14#define TR_ISA 1
15#define TR_MCA 2
16#define TR_ISAPNP 3
17#define NOTOK 0
18
19#define IBMTR_SHARED_RAM_SIZE 0x10000
20#define IBMTR_IO_EXTENT 4
21#define IBMTR_MAX_ADAPTERS 4
22
23#define CHANNEL_ID 0X1F30
24#define AIP 0X1F00
25#define AIPADAPTYPE 0X1FA0
26#define AIPDATARATE 0X1FA2
27#define AIPEARLYTOKEN 0X1FA4
28#define AIPAVAILSHRAM 0X1FA6
29#define AIPSHRAMPAGE 0X1FA8
30#define AIP4MBDHB 0X1FAA
31#define AIP16MBDHB 0X1FAC
32#define AIPFID 0X1FBA
33
34#define ADAPTRESET 0x1 /* Control Adapter reset (add to base) */
35#define ADAPTRESETREL 0x2 /* Release Adapter from reset ( """) */
36#define ADAPTINTREL 0x3 /* Adapter interrupt release */
37
38#define GLOBAL_INT_ENABLE 0x02f0
39
40/* MMIO bits 0-4 select register */
41#define RRR_EVEN 0x00 /* Shared RAM relocation registers - even and odd */
42/* Used to set the starting address of shared RAM */
43/* Bits 1 through 7 of this register map to bits 13 through 19 of the shared
44 RAM address.*/
45/* ie: 0x02 sets RAM address to ...ato! issy su wazzoo !! GODZILLA!!! */
46#define RRR_ODD 0x01
47/* Bits 2 and 3 of this register can be read to determine shared RAM size */
48/* 00 for 8k, 01 for 16k, 10 for 32k, 11 for 64k */
49#define WRBR_EVEN 0x02 /* Write region base registers - even and odd */
50#define WRBR_ODD 0x03
51#define WWOR_EVEN 0x04 /* Write window open registers - even and odd */
52#define WWOR_ODD 0x05
53#define WWCR_EVEN 0x06 /* Write window close registers - even and odd */
54#define WWCR_ODD 0x07
55
56/* Interrupt status registers - PC system - even and odd */
57#define ISRP_EVEN 0x08
58
59#define TCR_INT 0x10 /* Bit 4 - Timer interrupt. The TVR_EVEN timer has
60 expired. */
61#define ERR_INT 0x08 /* Bit 3 - Error interrupt. The adapter has had an
62 internal error. */
63#define ACCESS_INT 0x04 /* Bit 2 - Access interrupt. You have attempted to
64 write to an invalid area of shared RAM
65 or an invalid register within the MMIO. */
66/* In addition, the following bits within ISRP_EVEN can be turned on or off */
67/* by you to control the interrupt processing: */
68#define INT_ENABLE 0x40 /* Bit 6 - Interrupt enable. If 0, no interrupts will
69 occur. If 1, interrupts will occur normally.
70 Normally set to 1. */
71/* Bit 0 - Primary or alternate adapter. Set to zero if this adapter is the
72 primary adapter, 1 if this adapter is the alternate adapter. */
73
74
75#define ISRP_ODD 0x09
76
77#define ADAP_CHK_INT 0x40 /* Bit 6 - Adapter check. the adapter has
78 encountered a serious problem and has closed
79 itself. Whoa. */
80#define SRB_RESP_INT 0x20 /* Bit 5 - SRB response. The adapter has accepted
81 an SRB request and set the return code within
82 the SRB. */
83#define ASB_FREE_INT 0x10 /* Bit 4 - ASB free. The adapter has read the ASB
84 and this area can be safely reused. This interrupt
85 is only used if your application has set the ASB
86 free request bit in ISRA_ODD or if an error was
87 detected in your response. */
88#define ARB_CMD_INT 0x08 /* Bit 3 - ARB command. The adapter has given you a
89 command for action. The command is located in the
90 ARB area of shared memory. */
91#define SSB_RESP_INT 0x04 /* Bit 2 - SSB response. The adapter has posted a
92 response to your SRB (the response is located in
93 the SSB area of shared memory). */
94/* Bit 1 - Bridge frame forward complete. */
95
96
97
98#define ISRA_EVEN 0x0A /*Interrupt status registers - adapter - even and odd */
99/* Bit 7 - Internal parity error (on adapter's internal bus) */
100/* Bit 6 - Timer interrupt pending */
101/* Bit 5 - Access interrupt (attempt by adapter to access illegal address) */
102/* Bit 4 - Adapter microcode problem (microcode dead-man timer expired) */
103/* Bit 3 - Adapter processor check status */
104/* Bit 2 - Reserved */
105/* Bit 1 - Adapter hardware interrupt mask (prevents internal interrupts) */
106/* Bit 0 - Adapter software interrupt mask (prevents internal software ints) */
107
108#define ISRA_ODD 0x0B
109#define CMD_IN_SRB 0x20 /* Bit 5 - Indicates that you have placed a new
110 command in the SRB and are ready for the adapter to
111 process the command. */
112#define RESP_IN_ASB 0x10 /* Bit 4 - Indicates that you have placed a response
113 (an ASB) in the shared RAM which is available for
114 the adapter's use. */
115/* Bit 3 - Indicates that you are ready to put an SRB in the shared RAM, but
116 that a previous command is still pending. The adapter will then
117 interrupt you when the previous command is completed */
118/* Bit 2 - Indicates that you are ready to put an ASB in the shared RAM, but
119 that a previous ASB is still pending. The adapter will then interrupt
120 you when the previous ASB is copied. */
121#define ARB_FREE 0x2
122#define SSB_FREE 0x1
123
124#define TCR_EVEN 0x0C /* Timer control registers - even and odd */
125#define TCR_ODD 0x0D
126#define TVR_EVEN 0x0E /* Timer value registers - even and odd */
127#define TVR_ODD 0x0F
128#define SRPR_EVEN 0x18 /* Shared RAM paging registers - even and odd */
129#define SRPR_ENABLE_PAGING 0xc0
130#define SRPR_ODD 0x19 /* Not used. */
131#define TOKREAD 0x60
132#define TOKOR 0x40
133#define TOKAND 0x20
134#define TOKWRITE 0x00
135
136/* MMIO bits 5-6 select operation */
137/* 00 is used to write to a register */
138/* 01 is used to bitwise AND a byte with a register */
139/* 10 is used to bitwise OR a byte with a register */
140/* 11 is used to read from a register */
141
142/* MMIO bits 7-8 select area of interest.. see below */
143/* 00 selects attachment control area. */
144/* 01 is reserved. */
145/* 10 selects adapter identification area A containing the adapter encoded
146 address. */
147/* 11 selects the adapter identification area B containing test patterns. */
148
149#define PCCHANNELID 5049434F3631313039393020
150#define MCCHANNELID 4D4152533633583435313820
151
152#define ACA_OFFSET 0x1e00
153#define ACA_SET 0x40
154#define ACA_RESET 0x20
155#define ACA_RW 0x00
156
157#ifdef ENABLE_PAGING
158#define SET_PAGE(x) (writeb((x), ti->mmio + ACA_OFFSET+ ACA_RW + SRPR_EVEN))
159#else
160#define SET_PAGE(x)
161#endif
162
163/* do_tok_int possible values */
164#define FIRST_INT 1
165#define NOT_FIRST 2
166
167typedef enum { CLOSED, OPEN } open_state;
168//staic const char *printstate[] = { "CLOSED","OPEN"};
169
170struct tok_info {
171 unsigned char irq;
172 void __iomem *mmio;
173 unsigned char hw_address[32];
174 unsigned char adapter_type;
175 unsigned char data_rate;
176 unsigned char token_release;
177 unsigned char avail_shared_ram;
178 unsigned char shared_ram_paging;
179 unsigned char turbo;
180 unsigned short dhb_size4mb;
181 unsigned short rbuf_len4;
182 unsigned short rbuf_cnt4;
183 unsigned short maxmtu4;
184 unsigned short dhb_size16mb;
185 unsigned short rbuf_len16;
186 unsigned short rbuf_cnt16;
187 unsigned short maxmtu16;
188 /* Additions by David Morris */
189 unsigned char do_tok_int;
190 wait_queue_head_t wait_for_reset;
191 unsigned char sram_base;
192 /* Additions by Peter De Schrijver */
193 unsigned char page_mask; /* mask to select RAM page to Map*/
194 unsigned char mapped_ram_size; /* size of RAM page */
195 __u32 sram_phys; /* Shared memory base address */
196 void __iomem *sram_virt; /* Shared memory base address */
197 void __iomem *init_srb; /* Initial System Request Block address */
198 void __iomem *srb; /* System Request Block address */
199 void __iomem *ssb; /* System Status Block address */
200 void __iomem *arb; /* Adapter Request Block address */
201 void __iomem *asb; /* Adapter Status Block address */
202 __u8 init_srb_page;
203 __u8 srb_page;
204 __u8 ssb_page;
205 __u8 arb_page;
206 __u8 asb_page;
207 unsigned short exsap_station_id;
208 unsigned short global_int_enable;
209 struct sk_buff *current_skb;
210
211 unsigned char auto_speedsave;
212 open_state open_status, sap_status;
213 enum {MANUAL, AUTOMATIC} open_mode;
214 enum {FAIL, RESTART, REOPEN} open_action;
215 enum {NO, YES} open_failure;
216 unsigned char readlog_pending;
217 unsigned short adapter_int_enable; /* Adapter-specific int enable */
218 struct timer_list tr_timer;
219 unsigned char ring_speed;
220 spinlock_t lock; /* SMP protection */
221};
222
223/* token ring adapter commands */
224#define DIR_INTERRUPT 0x00 /* struct srb_interrupt */
225#define DIR_MOD_OPEN_PARAMS 0x01
226#define DIR_OPEN_ADAPTER 0x03 /* struct dir_open_adapter */
227#define DIR_CLOSE_ADAPTER 0x04
228#define DIR_SET_GRP_ADDR 0x06
229#define DIR_SET_FUNC_ADDR 0x07 /* struct srb_set_funct_addr */
230#define DIR_READ_LOG 0x08 /* struct srb_read_log */
231#define DLC_OPEN_SAP 0x15 /* struct dlc_open_sap */
232#define DLC_CLOSE_SAP 0x16
233#define DATA_LOST 0x20 /* struct asb_rec */
234#define REC_DATA 0x81 /* struct arb_rec_req */
235#define XMIT_DATA_REQ 0x82 /* struct arb_xmit_req */
236#define DLC_STATUS 0x83 /* struct arb_dlc_status */
237#define RING_STAT_CHANGE 0x84 /* struct dlc_open_sap ??? */
238
239/* DIR_OPEN_ADAPTER options */
240#define OPEN_PASS_BCON_MAC 0x0100
241#define NUM_RCV_BUF 2
242#define RCV_BUF_LEN 1024
243#define DHB_LENGTH 2048
244#define NUM_DHB 2
245#define DLC_MAX_SAP 2
246#define DLC_MAX_STA 1
247
248/* DLC_OPEN_SAP options */
249#define MAX_I_FIELD 0x0088
250#define SAP_OPEN_IND_SAP 0x04
251#define SAP_OPEN_PRIORITY 0x20
252#define SAP_OPEN_STATION_CNT 0x1
253#define XMIT_DIR_FRAME 0x0A
254#define XMIT_UI_FRAME 0x0d
255#define XMIT_XID_CMD 0x0e
256#define XMIT_TEST_CMD 0x11
257
258/* srb close return code */
259#define SIGNAL_LOSS 0x8000
260#define HARD_ERROR 0x4000
261#define XMIT_BEACON 0x1000
262#define LOBE_FAULT 0x0800
263#define AUTO_REMOVAL 0x0400
264#define REMOVE_RECV 0x0100
265#define LOG_OVERFLOW 0x0080
266#define RING_RECOVER 0x0020
267
268struct srb_init_response {
269 unsigned char command;
270 unsigned char init_status;
271 unsigned char init_status_2;
272 unsigned char reserved[3];
273 __u16 bring_up_code;
274 __u16 encoded_address;
275 __u16 level_address;
276 __u16 adapter_address;
277 __u16 parms_address;
278 __u16 mac_address;
279};
280
281struct dir_open_adapter {
282 unsigned char command;
283 char reserved[7];
284 __u16 open_options;
285 unsigned char node_address[6];
286 unsigned char group_address[4];
287 unsigned char funct_address[4];
288 __u16 num_rcv_buf;
289 __u16 rcv_buf_len;
290 __u16 dhb_length;
291 unsigned char num_dhb;
292 char reserved2;
293 unsigned char dlc_max_sap;
294 unsigned char dlc_max_sta;
295 unsigned char dlc_max_gsap;
296 unsigned char dlc_max_gmem;
297 unsigned char dlc_t1_tick_1;
298 unsigned char dlc_t2_tick_1;
299 unsigned char dlc_ti_tick_1;
300 unsigned char dlc_t1_tick_2;
301 unsigned char dlc_t2_tick_2;
302 unsigned char dlc_ti_tick_2;
303 unsigned char product_id[18];
304};
305
306struct dlc_open_sap {
307 unsigned char command;
308 unsigned char reserved1;
309 unsigned char ret_code;
310 unsigned char reserved2;
311 __u16 station_id;
312 unsigned char timer_t1;
313 unsigned char timer_t2;
314 unsigned char timer_ti;
315 unsigned char maxout;
316 unsigned char maxin;
317 unsigned char maxout_incr;
318 unsigned char max_retry_count;
319 unsigned char gsap_max_mem;
320 __u16 max_i_field;
321 unsigned char sap_value;
322 unsigned char sap_options;
323 unsigned char station_count;
324 unsigned char sap_gsap_mem;
325 unsigned char gsap[0];
326};
327
328struct srb_xmit {
329 unsigned char command;
330 unsigned char cmd_corr;
331 unsigned char ret_code;
332 unsigned char reserved1;
333 __u16 station_id;
334};
335
336struct arb_rec_req {
337 unsigned char command;
338 unsigned char reserved1[3];
339 __u16 station_id;
340 __u16 rec_buf_addr;
341 unsigned char lan_hdr_len;
342 unsigned char dlc_hdr_len;
343 __u16 frame_len;
344 unsigned char msg_type;
345};
346
347struct asb_rec {
348 unsigned char command;
349 unsigned char reserved1;
350 unsigned char ret_code;
351 unsigned char reserved2;
352 __u16 station_id;
353 __u16 rec_buf_addr;
354};
355
356struct rec_buf {
357 unsigned char reserved1[2];
358 __u16 buf_ptr;
359 unsigned char reserved2;
360 unsigned char receive_fs;
361 __u16 buf_len;
362 unsigned char data[0];
363};
364
365struct srb_set_funct_addr {
366 unsigned char command;
367 unsigned char reserved1;
368 unsigned char ret_code;
369 unsigned char reserved2[3];
370 unsigned char funct_address[4];
371};
372
373#endif
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index 210e2c325534..ce9af8918514 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -640,9 +640,9 @@ struct ieee80211_rann_ie {
640 u8 rann_hopcount; 640 u8 rann_hopcount;
641 u8 rann_ttl; 641 u8 rann_ttl;
642 u8 rann_addr[6]; 642 u8 rann_addr[6];
643 u32 rann_seq; 643 __le32 rann_seq;
644 u32 rann_interval; 644 __le32 rann_interval;
645 u32 rann_metric; 645 __le32 rann_metric;
646} __attribute__ ((packed)); 646} __attribute__ ((packed));
647 647
648enum ieee80211_rann_flags { 648enum ieee80211_rann_flags {
@@ -1007,13 +1007,13 @@ enum ieee80211_min_mpdu_spacing {
1007}; 1007};
1008 1008
1009/** 1009/**
1010 * struct ieee80211_ht_info - HT information 1010 * struct ieee80211_ht_operation - HT operation IE
1011 * 1011 *
1012 * This structure is the "HT information element" as 1012 * This structure is the "HT operation element" as
1013 * described in 802.11n D5.0 7.3.2.58 1013 * described in 802.11n-2009 7.3.2.57
1014 */ 1014 */
1015struct ieee80211_ht_info { 1015struct ieee80211_ht_operation {
1016 u8 control_chan; 1016 u8 primary_chan;
1017 u8 ht_param; 1017 u8 ht_param;
1018 __le16 operation_mode; 1018 __le16 operation_mode;
1019 __le16 stbc_param; 1019 __le16 stbc_param;
@@ -1027,8 +1027,6 @@ struct ieee80211_ht_info {
1027#define IEEE80211_HT_PARAM_CHA_SEC_BELOW 0x03 1027#define IEEE80211_HT_PARAM_CHA_SEC_BELOW 0x03
1028#define IEEE80211_HT_PARAM_CHAN_WIDTH_ANY 0x04 1028#define IEEE80211_HT_PARAM_CHAN_WIDTH_ANY 0x04
1029#define IEEE80211_HT_PARAM_RIFS_MODE 0x08 1029#define IEEE80211_HT_PARAM_RIFS_MODE 0x08
1030#define IEEE80211_HT_PARAM_SPSMP_SUPPORT 0x10
1031#define IEEE80211_HT_PARAM_SERV_INTERVAL_GRAN 0xE0
1032 1030
1033/* for operation_mode */ 1031/* for operation_mode */
1034#define IEEE80211_HT_OP_MODE_PROTECTION 0x0003 1032#define IEEE80211_HT_OP_MODE_PROTECTION 0x0003
@@ -1301,7 +1299,7 @@ enum ieee80211_eid {
1301 WLAN_EID_EXT_SUPP_RATES = 50, 1299 WLAN_EID_EXT_SUPP_RATES = 50,
1302 1300
1303 WLAN_EID_HT_CAPABILITY = 45, 1301 WLAN_EID_HT_CAPABILITY = 45,
1304 WLAN_EID_HT_INFORMATION = 61, 1302 WLAN_EID_HT_OPERATION = 61,
1305 1303
1306 WLAN_EID_RSN = 48, 1304 WLAN_EID_RSN = 48,
1307 WLAN_EID_MMIE = 76, 1305 WLAN_EID_MMIE = 76,
@@ -1441,6 +1439,18 @@ enum ieee80211_tdls_actioncode {
1441#define WLAN_TDLS_SNAP_RFTYPE 0x2 1439#define WLAN_TDLS_SNAP_RFTYPE 0x2
1442 1440
1443/** 1441/**
1442 * enum - mesh synchronization method identifier
1443 *
1444 * @IEEE80211_SYNC_METHOD_NEIGHBOR_OFFSET: the default synchronization method
1445 * @IEEE80211_SYNC_METHOD_VENDOR: a vendor specific synchronization method
1446 * that will be specified in a vendor specific information element
1447 */
1448enum {
1449 IEEE80211_SYNC_METHOD_NEIGHBOR_OFFSET = 1,
1450 IEEE80211_SYNC_METHOD_VENDOR = 255,
1451};
1452
1453/**
1444 * enum - mesh path selection protocol identifier 1454 * enum - mesh path selection protocol identifier
1445 * 1455 *
1446 * @IEEE80211_PATH_PROTOCOL_HWMP: the default path selection protocol 1456 * @IEEE80211_PATH_PROTOCOL_HWMP: the default path selection protocol
@@ -1448,7 +1458,7 @@ enum ieee80211_tdls_actioncode {
1448 * be specified in a vendor specific information element 1458 * be specified in a vendor specific information element
1449 */ 1459 */
1450enum { 1460enum {
1451 IEEE80211_PATH_PROTOCOL_HWMP = 0, 1461 IEEE80211_PATH_PROTOCOL_HWMP = 1,
1452 IEEE80211_PATH_PROTOCOL_VENDOR = 255, 1462 IEEE80211_PATH_PROTOCOL_VENDOR = 255,
1453}; 1463};
1454 1464
@@ -1460,7 +1470,7 @@ enum {
1460 * specified in a vendor specific information element 1470 * specified in a vendor specific information element
1461 */ 1471 */
1462enum { 1472enum {
1463 IEEE80211_PATH_METRIC_AIRTIME = 0, 1473 IEEE80211_PATH_METRIC_AIRTIME = 1,
1464 IEEE80211_PATH_METRIC_VENDOR = 255, 1474 IEEE80211_PATH_METRIC_VENDOR = 255,
1465}; 1475};
1466 1476
diff --git a/include/linux/if_arp.h b/include/linux/if_arp.h
index 6d722f41ee7c..f0e69c6e8208 100644
--- a/include/linux/if_arp.h
+++ b/include/linux/if_arp.h
@@ -87,6 +87,7 @@
87#define ARPHRD_IEEE80211_PRISM 802 /* IEEE 802.11 + Prism2 header */ 87#define ARPHRD_IEEE80211_PRISM 802 /* IEEE 802.11 + Prism2 header */
88#define ARPHRD_IEEE80211_RADIOTAP 803 /* IEEE 802.11 + radiotap header */ 88#define ARPHRD_IEEE80211_RADIOTAP 803 /* IEEE 802.11 + radiotap header */
89#define ARPHRD_IEEE802154 804 89#define ARPHRD_IEEE802154 804
90#define ARPHRD_IEEE802154_MONITOR 805 /* IEEE 802.15.4 network monitor */
90 91
91#define ARPHRD_PHONET 820 /* PhoNet media type */ 92#define ARPHRD_PHONET 820 /* PhoNet media type */
92#define ARPHRD_PHONET_PIPE 821 /* PhoNet pipe header */ 93#define ARPHRD_PHONET_PIPE 821 /* PhoNet pipe header */
diff --git a/include/linux/if_ec.h b/include/linux/if_ec.h
deleted file mode 100644
index d85f9f48129f..000000000000
--- a/include/linux/if_ec.h
+++ /dev/null
@@ -1,68 +0,0 @@
1/* Definitions for Econet sockets. */
2
3#ifndef __LINUX_IF_EC
4#define __LINUX_IF_EC
5
6/* User visible stuff. Glibc provides its own but libc5 folk will use these */
7
8struct ec_addr {
9 unsigned char station; /* Station number. */
10 unsigned char net; /* Network number. */
11};
12
13struct sockaddr_ec {
14 unsigned short sec_family;
15 unsigned char port; /* Port number. */
16 unsigned char cb; /* Control/flag byte. */
17 unsigned char type; /* Type of message. */
18 struct ec_addr addr;
19 unsigned long cookie;
20};
21
22#define ECTYPE_PACKET_RECEIVED 0 /* Packet received */
23#define ECTYPE_TRANSMIT_STATUS 0x10 /* Transmit completed,
24 low nibble holds status */
25
26#define ECTYPE_TRANSMIT_OK 1
27#define ECTYPE_TRANSMIT_NOT_LISTENING 2
28#define ECTYPE_TRANSMIT_NET_ERROR 3
29#define ECTYPE_TRANSMIT_NO_CLOCK 4
30#define ECTYPE_TRANSMIT_LINE_JAMMED 5
31#define ECTYPE_TRANSMIT_NOT_PRESENT 6
32
33#ifdef __KERNEL__
34
35#define EC_HLEN 6
36
37/* This is what an Econet frame looks like on the wire. */
38struct ec_framehdr {
39 unsigned char dst_stn;
40 unsigned char dst_net;
41 unsigned char src_stn;
42 unsigned char src_net;
43 unsigned char cb;
44 unsigned char port;
45};
46
47struct econet_sock {
48 /* struct sock has to be the first member of econet_sock */
49 struct sock sk;
50 unsigned char cb;
51 unsigned char port;
52 unsigned char station;
53 unsigned char net;
54 unsigned short num;
55};
56
57static inline struct econet_sock *ec_sk(const struct sock *sk)
58{
59 return (struct econet_sock *)sk;
60}
61
62struct ec_device {
63 unsigned char station, net; /* Econet protocol address */
64};
65
66#endif
67
68#endif
diff --git a/include/linux/if_link.h b/include/linux/if_link.h
index 4b24ff453aee..f715750d0b87 100644
--- a/include/linux/if_link.h
+++ b/include/linux/if_link.h
@@ -138,6 +138,8 @@ enum {
138 IFLA_GROUP, /* Group the device belongs to */ 138 IFLA_GROUP, /* Group the device belongs to */
139 IFLA_NET_NS_FD, 139 IFLA_NET_NS_FD,
140 IFLA_EXT_MASK, /* Extended info mask, VFs, etc */ 140 IFLA_EXT_MASK, /* Extended info mask, VFs, etc */
141 IFLA_PROMISCUITY, /* Promiscuity count: > 0 means acts PROMISC */
142#define IFLA_PROMISCUITY IFLA_PROMISCUITY
141 __IFLA_MAX 143 __IFLA_MAX
142}; 144};
143 145
@@ -253,6 +255,7 @@ struct ifla_vlan_qos_mapping {
253enum { 255enum {
254 IFLA_MACVLAN_UNSPEC, 256 IFLA_MACVLAN_UNSPEC,
255 IFLA_MACVLAN_MODE, 257 IFLA_MACVLAN_MODE,
258 IFLA_MACVLAN_FLAGS,
256 __IFLA_MACVLAN_MAX, 259 __IFLA_MACVLAN_MAX,
257}; 260};
258 261
@@ -265,6 +268,8 @@ enum macvlan_mode {
265 MACVLAN_MODE_PASSTHRU = 8,/* take over the underlying device */ 268 MACVLAN_MODE_PASSTHRU = 8,/* take over the underlying device */
266}; 269};
267 270
271#define MACVLAN_FLAG_NOPROMISC 1
272
268/* SR-IOV virtual function management section */ 273/* SR-IOV virtual function management section */
269 274
270enum { 275enum {
diff --git a/include/linux/if_macvlan.h b/include/linux/if_macvlan.h
index d103dca5c563..f65e8d250f7e 100644
--- a/include/linux/if_macvlan.h
+++ b/include/linux/if_macvlan.h
@@ -60,6 +60,7 @@ struct macvlan_dev {
60 struct net_device *lowerdev; 60 struct net_device *lowerdev;
61 struct macvlan_pcpu_stats __percpu *pcpu_stats; 61 struct macvlan_pcpu_stats __percpu *pcpu_stats;
62 enum macvlan_mode mode; 62 enum macvlan_mode mode;
63 u16 flags;
63 int (*receive)(struct sk_buff *skb); 64 int (*receive)(struct sk_buff *skb);
64 int (*forward)(struct net_device *dev, struct sk_buff *skb); 65 int (*forward)(struct net_device *dev, struct sk_buff *skb);
65 struct macvtap_queue *taps[MAX_MACVTAP_QUEUES]; 66 struct macvtap_queue *taps[MAX_MACVTAP_QUEUES];
diff --git a/include/linux/if_pppol2tp.h b/include/linux/if_pppol2tp.h
index 23cefa1111bf..b4775418d525 100644
--- a/include/linux/if_pppol2tp.h
+++ b/include/linux/if_pppol2tp.h
@@ -19,10 +19,11 @@
19 19
20#ifdef __KERNEL__ 20#ifdef __KERNEL__
21#include <linux/in.h> 21#include <linux/in.h>
22#include <linux/in6.h>
22#endif 23#endif
23 24
24/* Structure used to connect() the socket to a particular tunnel UDP 25/* Structure used to connect() the socket to a particular tunnel UDP
25 * socket. 26 * socket over IPv4.
26 */ 27 */
27struct pppol2tp_addr { 28struct pppol2tp_addr {
28 __kernel_pid_t pid; /* pid that owns the fd. 29 __kernel_pid_t pid; /* pid that owns the fd.
@@ -35,6 +36,20 @@ struct pppol2tp_addr {
35 __u16 d_tunnel, d_session; /* For sending outgoing packets */ 36 __u16 d_tunnel, d_session; /* For sending outgoing packets */
36}; 37};
37 38
39/* Structure used to connect() the socket to a particular tunnel UDP
40 * socket over IPv6.
41 */
42struct pppol2tpin6_addr {
43 __kernel_pid_t pid; /* pid that owns the fd.
44 * 0 => current */
45 int fd; /* FD of UDP socket to use */
46
47 __u16 s_tunnel, s_session; /* For matching incoming packets */
48 __u16 d_tunnel, d_session; /* For sending outgoing packets */
49
50 struct sockaddr_in6 addr; /* IP address and port to send to */
51};
52
38/* The L2TPv3 protocol changes tunnel and session ids from 16 to 32 53/* The L2TPv3 protocol changes tunnel and session ids from 16 to 32
39 * bits. So we need a different sockaddr structure. 54 * bits. So we need a different sockaddr structure.
40 */ 55 */
@@ -49,6 +64,17 @@ struct pppol2tpv3_addr {
49 __u32 d_tunnel, d_session; /* For sending outgoing packets */ 64 __u32 d_tunnel, d_session; /* For sending outgoing packets */
50}; 65};
51 66
67struct pppol2tpv3in6_addr {
68 __kernel_pid_t pid; /* pid that owns the fd.
69 * 0 => current */
70 int fd; /* FD of UDP or IP socket to use */
71
72 __u32 s_tunnel, s_session; /* For matching incoming packets */
73 __u32 d_tunnel, d_session; /* For sending outgoing packets */
74
75 struct sockaddr_in6 addr; /* IP address and port to send to */
76};
77
52/* Socket options: 78/* Socket options:
53 * DEBUG - bitmask of debug message categories 79 * DEBUG - bitmask of debug message categories
54 * SENDSEQ - 0 => don't send packets with sequence numbers 80 * SENDSEQ - 0 => don't send packets with sequence numbers
diff --git a/include/linux/if_pppox.h b/include/linux/if_pppox.h
index b5f927f59f26..09c474c480cd 100644
--- a/include/linux/if_pppox.h
+++ b/include/linux/if_pppox.h
@@ -70,7 +70,7 @@ struct sockaddr_pppox {
70 struct pppoe_addr pppoe; 70 struct pppoe_addr pppoe;
71 struct pptp_addr pptp; 71 struct pptp_addr pptp;
72 } sa_addr; 72 } sa_addr;
73} __attribute__((packed)); 73} __packed;
74 74
75/* The use of the above union isn't viable because the size of this 75/* The use of the above union isn't viable because the size of this
76 * struct must stay fixed over time -- applications use sizeof(struct 76 * struct must stay fixed over time -- applications use sizeof(struct
@@ -81,7 +81,13 @@ struct sockaddr_pppol2tp {
81 __kernel_sa_family_t sa_family; /* address family, AF_PPPOX */ 81 __kernel_sa_family_t sa_family; /* address family, AF_PPPOX */
82 unsigned int sa_protocol; /* protocol identifier */ 82 unsigned int sa_protocol; /* protocol identifier */
83 struct pppol2tp_addr pppol2tp; 83 struct pppol2tp_addr pppol2tp;
84} __attribute__((packed)); 84} __packed;
85
86struct sockaddr_pppol2tpin6 {
87 __kernel_sa_family_t sa_family; /* address family, AF_PPPOX */
88 unsigned int sa_protocol; /* protocol identifier */
89 struct pppol2tpin6_addr pppol2tp;
90} __packed;
85 91
86/* The L2TPv3 protocol changes tunnel and session ids from 16 to 32 92/* The L2TPv3 protocol changes tunnel and session ids from 16 to 32
87 * bits. So we need a different sockaddr structure. 93 * bits. So we need a different sockaddr structure.
@@ -90,7 +96,13 @@ struct sockaddr_pppol2tpv3 {
90 __kernel_sa_family_t sa_family; /* address family, AF_PPPOX */ 96 __kernel_sa_family_t sa_family; /* address family, AF_PPPOX */
91 unsigned int sa_protocol; /* protocol identifier */ 97 unsigned int sa_protocol; /* protocol identifier */
92 struct pppol2tpv3_addr pppol2tp; 98 struct pppol2tpv3_addr pppol2tp;
93} __attribute__((packed)); 99} __packed;
100
101struct sockaddr_pppol2tpv3in6 {
102 __kernel_sa_family_t sa_family; /* address family, AF_PPPOX */
103 unsigned int sa_protocol; /* protocol identifier */
104 struct pppol2tpv3in6_addr pppol2tp;
105} __packed;
94 106
95/********************************************************************* 107/*********************************************************************
96 * 108 *
@@ -140,7 +152,7 @@ struct pppoe_hdr {
140 __be16 sid; 152 __be16 sid;
141 __be16 length; 153 __be16 length;
142 struct pppoe_tag tag[0]; 154 struct pppoe_tag tag[0];
143} __attribute__((packed)); 155} __packed;
144 156
145/* Length of entire PPPoE + PPP header */ 157/* Length of entire PPPoE + PPP header */
146#define PPPOE_SES_HLEN 8 158#define PPPOE_SES_HLEN 8
diff --git a/include/linux/if_team.h b/include/linux/if_team.h
index 58404b0c5010..8185f57a9c7f 100644
--- a/include/linux/if_team.h
+++ b/include/linux/if_team.h
@@ -28,10 +28,28 @@ struct team;
28 28
29struct team_port { 29struct team_port {
30 struct net_device *dev; 30 struct net_device *dev;
31 struct hlist_node hlist; /* node in hash list */ 31 struct hlist_node hlist; /* node in enabled ports hash list */
32 struct list_head list; /* node in ordinary list */ 32 struct list_head list; /* node in ordinary list */
33 struct team *team; 33 struct team *team;
34 int index; 34 int index; /* index of enabled port. If disabled, it's set to -1 */
35
36 bool linkup; /* either state.linkup or user.linkup */
37
38 struct {
39 bool linkup;
40 u32 speed;
41 u8 duplex;
42 } state;
43
44 /* Values set by userspace */
45 struct {
46 bool linkup;
47 bool linkup_enabled;
48 } user;
49
50 /* Custom gennetlink interface related flags */
51 bool changed;
52 bool removed;
35 53
36 /* 54 /*
37 * A place for storing original values of the device before it 55 * A place for storing original values of the device before it
@@ -42,14 +60,6 @@ struct team_port {
42 unsigned int mtu; 60 unsigned int mtu;
43 } orig; 61 } orig;
44 62
45 bool linkup;
46 u32 speed;
47 u8 duplex;
48
49 /* Custom gennetlink interface related flags */
50 bool changed;
51 bool removed;
52
53 struct rcu_head rcu; 63 struct rcu_head rcu;
54}; 64};
55 65
@@ -68,18 +78,30 @@ struct team_mode_ops {
68enum team_option_type { 78enum team_option_type {
69 TEAM_OPTION_TYPE_U32, 79 TEAM_OPTION_TYPE_U32,
70 TEAM_OPTION_TYPE_STRING, 80 TEAM_OPTION_TYPE_STRING,
81 TEAM_OPTION_TYPE_BINARY,
82 TEAM_OPTION_TYPE_BOOL,
83};
84
85struct team_gsetter_ctx {
86 union {
87 u32 u32_val;
88 const char *str_val;
89 struct {
90 const void *ptr;
91 u32 len;
92 } bin_val;
93 bool bool_val;
94 } data;
95 struct team_port *port;
71}; 96};
72 97
73struct team_option { 98struct team_option {
74 struct list_head list; 99 struct list_head list;
75 const char *name; 100 const char *name;
101 bool per_port;
76 enum team_option_type type; 102 enum team_option_type type;
77 int (*getter)(struct team *team, void *arg); 103 int (*getter)(struct team *team, struct team_gsetter_ctx *ctx);
78 int (*setter)(struct team *team, void *arg); 104 int (*setter)(struct team *team, struct team_gsetter_ctx *ctx);
79
80 /* Custom gennetlink interface related flags */
81 bool changed;
82 bool removed;
83}; 105};
84 106
85struct team_mode { 107struct team_mode {
@@ -103,13 +125,15 @@ struct team {
103 struct mutex lock; /* used for overall locking, e.g. port lists write */ 125 struct mutex lock; /* used for overall locking, e.g. port lists write */
104 126
105 /* 127 /*
106 * port lists with port count 128 * List of enabled ports and their count
107 */ 129 */
108 int port_count; 130 int en_port_count;
109 struct hlist_head port_hlist[TEAM_PORT_HASHENTRIES]; 131 struct hlist_head en_port_hlist[TEAM_PORT_HASHENTRIES];
110 struct list_head port_list; 132
133 struct list_head port_list; /* list of all ports */
111 134
112 struct list_head option_list; 135 struct list_head option_list;
136 struct list_head option_inst_list; /* list of option instances */
113 137
114 const struct team_mode *mode; 138 const struct team_mode *mode;
115 struct team_mode_ops ops; 139 struct team_mode_ops ops;
@@ -119,7 +143,7 @@ struct team {
119static inline struct hlist_head *team_port_index_hash(struct team *team, 143static inline struct hlist_head *team_port_index_hash(struct team *team,
120 int port_index) 144 int port_index)
121{ 145{
122 return &team->port_hlist[port_index & (TEAM_PORT_HASHENTRIES - 1)]; 146 return &team->en_port_hlist[port_index & (TEAM_PORT_HASHENTRIES - 1)];
123} 147}
124 148
125static inline struct team_port *team_get_port_by_index(struct team *team, 149static inline struct team_port *team_get_port_by_index(struct team *team,
@@ -216,6 +240,7 @@ enum {
216 TEAM_ATTR_OPTION_TYPE, /* u8 */ 240 TEAM_ATTR_OPTION_TYPE, /* u8 */
217 TEAM_ATTR_OPTION_DATA, /* dynamic */ 241 TEAM_ATTR_OPTION_DATA, /* dynamic */
218 TEAM_ATTR_OPTION_REMOVED, /* flag */ 242 TEAM_ATTR_OPTION_REMOVED, /* flag */
243 TEAM_ATTR_OPTION_PORT_IFINDEX, /* u32 */ /* for per-port options */
219 244
220 __TEAM_ATTR_OPTION_MAX, 245 __TEAM_ATTR_OPTION_MAX,
221 TEAM_ATTR_OPTION_MAX = __TEAM_ATTR_OPTION_MAX - 1, 246 TEAM_ATTR_OPTION_MAX = __TEAM_ATTR_OPTION_MAX - 1,
diff --git a/include/linux/if_tr.h b/include/linux/if_tr.h
deleted file mode 100644
index fc23aeb0f201..000000000000
--- a/include/linux/if_tr.h
+++ /dev/null
@@ -1,103 +0,0 @@
1/*
2 * INET An implementation of the TCP/IP protocol suite for the LINUX
3 * operating system. INET is implemented using the BSD Socket
4 * interface as the means of communication with the user level.
5 *
6 * Global definitions for the Token-Ring IEEE 802.5 interface.
7 *
8 * Version: @(#)if_tr.h 0.0 07/11/94
9 *
10 * Author: Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
11 * Donald Becker, <becker@super.org>
12 * Peter De Schrijver, <stud11@cc4.kuleuven.ac.be>
13 *
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License
16 * as published by the Free Software Foundation; either version
17 * 2 of the License, or (at your option) any later version.
18 */
19#ifndef _LINUX_IF_TR_H
20#define _LINUX_IF_TR_H
21
22#include <linux/types.h>
23#include <asm/byteorder.h> /* For __be16 */
24
25/* IEEE 802.5 Token-Ring magic constants. The frame sizes omit the preamble
26 and FCS/CRC (frame check sequence). */
27#define TR_ALEN 6 /* Octets in one token-ring addr */
28#define TR_HLEN (sizeof(struct trh_hdr)+sizeof(struct trllc))
29#define AC 0x10
30#define LLC_FRAME 0x40
31
32/* LLC and SNAP constants */
33#define EXTENDED_SAP 0xAA
34#define UI_CMD 0x03
35
36/* This is an Token-Ring frame header. */
37struct trh_hdr {
38 __u8 ac; /* access control field */
39 __u8 fc; /* frame control field */
40 __u8 daddr[TR_ALEN]; /* destination address */
41 __u8 saddr[TR_ALEN]; /* source address */
42 __be16 rcf; /* route control field */
43 __be16 rseg[8]; /* routing registers */
44};
45
46#ifdef __KERNEL__
47#include <linux/skbuff.h>
48
49static inline struct trh_hdr *tr_hdr(const struct sk_buff *skb)
50{
51 return (struct trh_hdr *)skb_mac_header(skb);
52}
53#endif
54
55/* This is an Token-Ring LLC structure */
56struct trllc {
57 __u8 dsap; /* destination SAP */
58 __u8 ssap; /* source SAP */
59 __u8 llc; /* LLC control field */
60 __u8 protid[3]; /* protocol id */
61 __be16 ethertype; /* ether type field */
62};
63
64/* Token-Ring statistics collection data. */
65struct tr_statistics {
66 unsigned long rx_packets; /* total packets received */
67 unsigned long tx_packets; /* total packets transmitted */
68 unsigned long rx_bytes; /* total bytes received */
69 unsigned long tx_bytes; /* total bytes transmitted */
70 unsigned long rx_errors; /* bad packets received */
71 unsigned long tx_errors; /* packet transmit problems */
72 unsigned long rx_dropped; /* no space in linux buffers */
73 unsigned long tx_dropped; /* no space available in linux */
74 unsigned long multicast; /* multicast packets received */
75 unsigned long transmit_collision;
76
77 /* detailed Token-Ring errors. See IBM Token-Ring Network
78 Architecture for more info */
79
80 unsigned long line_errors;
81 unsigned long internal_errors;
82 unsigned long burst_errors;
83 unsigned long A_C_errors;
84 unsigned long abort_delimiters;
85 unsigned long lost_frames;
86 unsigned long recv_congest_count;
87 unsigned long frame_copied_errors;
88 unsigned long frequency_errors;
89 unsigned long token_errors;
90 unsigned long dummy1;
91};
92
93/* source routing stuff */
94#define TR_RII 0x80
95#define TR_RCF_DIR_BIT 0x80
96#define TR_RCF_LEN_MASK 0x1f00
97#define TR_RCF_BROADCAST 0x8000 /* all-routes broadcast */
98#define TR_RCF_LIMITED_BROADCAST 0xC000 /* single-route broadcast */
99#define TR_RCF_FRAME2K 0x20
100#define TR_RCF_BROADCAST_MASK 0xC000
101#define TR_MAXRIFLEN 18
102
103#endif /* _LINUX_IF_TR_H */
diff --git a/include/linux/iio/buffer.h b/include/linux/iio/buffer.h
new file mode 100644
index 000000000000..fb0fe46fd659
--- /dev/null
+++ b/include/linux/iio/buffer.h
@@ -0,0 +1,191 @@
1/* The industrial I/O core - generic buffer interfaces.
2 *
3 * Copyright (c) 2008 Jonathan Cameron
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 as published by
7 * the Free Software Foundation.
8 */
9
10#ifndef _IIO_BUFFER_GENERIC_H_
11#define _IIO_BUFFER_GENERIC_H_
12#include <linux/sysfs.h>
13#include <linux/iio/iio.h>
14
15#ifdef CONFIG_IIO_BUFFER
16
17struct iio_buffer;
18
19/**
20 * struct iio_buffer_access_funcs - access functions for buffers.
21 * @store_to: actually store stuff to the buffer
22 * @read_first_n: try to get a specified number of bytes (must exist)
23 * @request_update: if a parameter change has been marked, update underlying
24 * storage.
25 * @get_bytes_per_datum:get current bytes per datum
26 * @set_bytes_per_datum:set number of bytes per datum
27 * @get_length: get number of datums in buffer
28 * @set_length: set number of datums in buffer
29 *
30 * The purpose of this structure is to make the buffer element
31 * modular as event for a given driver, different usecases may require
32 * different buffer designs (space efficiency vs speed for example).
33 *
34 * It is worth noting that a given buffer implementation may only support a
35 * small proportion of these functions. The core code 'should' cope fine with
36 * any of them not existing.
37 **/
38struct iio_buffer_access_funcs {
39 int (*store_to)(struct iio_buffer *buffer, u8 *data, s64 timestamp);
40 int (*read_first_n)(struct iio_buffer *buffer,
41 size_t n,
42 char __user *buf);
43
44 int (*request_update)(struct iio_buffer *buffer);
45
46 int (*get_bytes_per_datum)(struct iio_buffer *buffer);
47 int (*set_bytes_per_datum)(struct iio_buffer *buffer, size_t bpd);
48 int (*get_length)(struct iio_buffer *buffer);
49 int (*set_length)(struct iio_buffer *buffer, int length);
50};
51
52/**
53 * struct iio_buffer - general buffer structure
54 * @length: [DEVICE] number of datums in buffer
55 * @bytes_per_datum: [DEVICE] size of individual datum including timestamp
56 * @scan_el_attrs: [DRIVER] control of scan elements if that scan mode
57 * control method is used
58 * @scan_mask: [INTERN] bitmask used in masking scan mode elements
59 * @scan_timestamp: [INTERN] does the scan mode include a timestamp
60 * @access: [DRIVER] buffer access functions associated with the
61 * implementation.
62 * @scan_el_dev_attr_list:[INTERN] list of scan element related attributes.
63 * @scan_el_group: [DRIVER] attribute group for those attributes not
64 * created from the iio_chan_info array.
65 * @pollq: [INTERN] wait queue to allow for polling on the buffer.
66 * @stufftoread: [INTERN] flag to indicate new data.
67 * @demux_list: [INTERN] list of operations required to demux the scan.
68 * @demux_bounce: [INTERN] buffer for doing gather from incoming scan.
69 **/
70struct iio_buffer {
71 int length;
72 int bytes_per_datum;
73 struct attribute_group *scan_el_attrs;
74 long *scan_mask;
75 bool scan_timestamp;
76 const struct iio_buffer_access_funcs *access;
77 struct list_head scan_el_dev_attr_list;
78 struct attribute_group scan_el_group;
79 wait_queue_head_t pollq;
80 bool stufftoread;
81 const struct attribute_group *attrs;
82 struct list_head demux_list;
83 unsigned char *demux_bounce;
84};
85
86/**
87 * iio_buffer_init() - Initialize the buffer structure
88 * @buffer: buffer to be initialized
89 **/
90void iio_buffer_init(struct iio_buffer *buffer);
91
92/**
93 * __iio_update_buffer() - update common elements of buffers
94 * @buffer: buffer that is the event source
95 * @bytes_per_datum: size of individual datum including timestamp
96 * @length: number of datums in buffer
97 **/
98static inline void __iio_update_buffer(struct iio_buffer *buffer,
99 int bytes_per_datum, int length)
100{
101 buffer->bytes_per_datum = bytes_per_datum;
102 buffer->length = length;
103}
104
105int iio_scan_mask_query(struct iio_dev *indio_dev,
106 struct iio_buffer *buffer, int bit);
107
108/**
109 * iio_scan_mask_set() - set particular bit in the scan mask
110 * @buffer: the buffer whose scan mask we are interested in
111 * @bit: the bit to be set.
112 **/
113int iio_scan_mask_set(struct iio_dev *indio_dev,
114 struct iio_buffer *buffer, int bit);
115
116/**
117 * iio_push_to_buffer() - push to a registered buffer.
118 * @buffer: IIO buffer structure for device
119 * @scan: Full scan.
120 * @timestamp:
121 */
122int iio_push_to_buffer(struct iio_buffer *buffer, unsigned char *data,
123 s64 timestamp);
124
125int iio_update_demux(struct iio_dev *indio_dev);
126
127/**
128 * iio_buffer_register() - register the buffer with IIO core
129 * @indio_dev: device with the buffer to be registered
130 **/
131int iio_buffer_register(struct iio_dev *indio_dev,
132 const struct iio_chan_spec *channels,
133 int num_channels);
134
135/**
136 * iio_buffer_unregister() - unregister the buffer from IIO core
137 * @indio_dev: the device with the buffer to be unregistered
138 **/
139void iio_buffer_unregister(struct iio_dev *indio_dev);
140
141/**
142 * iio_buffer_read_length() - attr func to get number of datums in the buffer
143 **/
144ssize_t iio_buffer_read_length(struct device *dev,
145 struct device_attribute *attr,
146 char *buf);
147/**
148 * iio_buffer_write_length() - attr func to set number of datums in the buffer
149 **/
150ssize_t iio_buffer_write_length(struct device *dev,
151 struct device_attribute *attr,
152 const char *buf,
153 size_t len);
154/**
155 * iio_buffer_store_enable() - attr to turn the buffer on
156 **/
157ssize_t iio_buffer_store_enable(struct device *dev,
158 struct device_attribute *attr,
159 const char *buf,
160 size_t len);
161/**
162 * iio_buffer_show_enable() - attr to see if the buffer is on
163 **/
164ssize_t iio_buffer_show_enable(struct device *dev,
165 struct device_attribute *attr,
166 char *buf);
167#define IIO_BUFFER_LENGTH_ATTR DEVICE_ATTR(length, S_IRUGO | S_IWUSR, \
168 iio_buffer_read_length, \
169 iio_buffer_write_length)
170
171#define IIO_BUFFER_ENABLE_ATTR DEVICE_ATTR(enable, S_IRUGO | S_IWUSR, \
172 iio_buffer_show_enable, \
173 iio_buffer_store_enable)
174
175int iio_sw_buffer_preenable(struct iio_dev *indio_dev);
176
177#else /* CONFIG_IIO_BUFFER */
178
179static inline int iio_buffer_register(struct iio_dev *indio_dev,
180 struct iio_chan_spec *channels,
181 int num_channels)
182{
183 return 0;
184}
185
186static inline void iio_buffer_unregister(struct iio_dev *indio_dev)
187{};
188
189#endif /* CONFIG_IIO_BUFFER */
190
191#endif /* _IIO_BUFFER_GENERIC_H_ */
diff --git a/include/linux/iio/consumer.h b/include/linux/iio/consumer.h
new file mode 100644
index 000000000000..1a15e560a5a1
--- /dev/null
+++ b/include/linux/iio/consumer.h
@@ -0,0 +1,96 @@
1/*
2 * Industrial I/O in kernel consumer interface
3 *
4 * Copyright (c) 2011 Jonathan Cameron
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 by
8 * the Free Software Foundation.
9 */
10#ifndef _IIO_INKERN_CONSUMER_H_
11#define _IIO_INKERN_CONSUMER_H
12#include <linux/iio/types.h>
13
14struct iio_dev;
15struct iio_chan_spec;
16
17/**
18 * struct iio_channel - everything needed for a consumer to use a channel
19 * @indio_dev: Device on which the channel exists.
20 * @channel: Full description of the channel.
21 */
22struct iio_channel {
23 struct iio_dev *indio_dev;
24 const struct iio_chan_spec *channel;
25};
26
27/**
28 * iio_channel_get() - get description of all that is needed to access channel.
29 * @name: Unique name of the device as provided in the iio_map
30 * with which the desired provider to consumer mapping
31 * was registered.
32 * @consumer_channel: Unique name to identify the channel on the consumer
33 * side. This typically describes the channels use within
34 * the consumer. E.g. 'battery_voltage'
35 */
36struct iio_channel *iio_st_channel_get(const char *name,
37 const char *consumer_channel);
38
39/**
40 * iio_st_channel_release() - release channels obtained via iio_st_channel_get
41 * @chan: The channel to be released.
42 */
43void iio_st_channel_release(struct iio_channel *chan);
44
45/**
46 * iio_st_channel_get_all() - get all channels associated with a client
47 * @name: name of consumer device.
48 *
49 * Returns an array of iio_channel structures terminated with one with
50 * null iio_dev pointer.
51 * This function is used by fairly generic consumers to get all the
52 * channels registered as having this consumer.
53 */
54struct iio_channel *iio_st_channel_get_all(const char *name);
55
56/**
57 * iio_st_channel_release_all() - reverse iio_st_get_all
58 * @chan: Array of channels to be released.
59 */
60void iio_st_channel_release_all(struct iio_channel *chan);
61
62/**
63 * iio_st_read_channel_raw() - read from a given channel
64 * @channel: The channel being queried.
65 * @val: Value read back.
66 *
67 * Note raw reads from iio channels are in adc counts and hence
68 * scale will need to be applied if standard units required.
69 */
70int iio_st_read_channel_raw(struct iio_channel *chan,
71 int *val);
72
73/**
74 * iio_st_get_channel_type() - get the type of a channel
75 * @channel: The channel being queried.
76 * @type: The type of the channel.
77 *
78 * returns the enum iio_chan_type of the channel
79 */
80int iio_st_get_channel_type(struct iio_channel *channel,
81 enum iio_chan_type *type);
82
83/**
84 * iio_st_read_channel_scale() - read the scale value for a channel
85 * @channel: The channel being queried.
86 * @val: First part of value read back.
87 * @val2: Second part of value read back.
88 *
89 * Note returns a description of what is in val and val2, such
90 * as IIO_VAL_INT_PLUS_MICRO telling us we have a value of val
91 * + val2/1e6
92 */
93int iio_st_read_channel_scale(struct iio_channel *chan, int *val,
94 int *val2);
95
96#endif
diff --git a/include/linux/iio/driver.h b/include/linux/iio/driver.h
new file mode 100644
index 000000000000..a4f8b2e05af5
--- /dev/null
+++ b/include/linux/iio/driver.h
@@ -0,0 +1,34 @@
1/*
2 * Industrial I/O in kernel access map interface.
3 *
4 * Copyright (c) 2011 Jonathan Cameron
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 by
8 * the Free Software Foundation.
9 */
10
11#ifndef _IIO_INKERN_H_
12#define _IIO_INKERN_H_
13
14struct iio_map;
15
16/**
17 * iio_map_array_register() - tell the core about inkernel consumers
18 * @indio_dev: provider device
19 * @map: array of mappings specifying association of channel with client
20 */
21int iio_map_array_register(struct iio_dev *indio_dev,
22 struct iio_map *map);
23
24/**
25 * iio_map_array_unregister() - tell the core to remove consumer mappings
26 * @indio_dev: provider device
27 * @map: array of mappings to remove. Note these must have same memory
28 * addresses as those originally added not just equal parameter
29 * values.
30 */
31int iio_map_array_unregister(struct iio_dev *indio_dev,
32 struct iio_map *map);
33
34#endif
diff --git a/include/linux/iio/events.h b/include/linux/iio/events.h
new file mode 100644
index 000000000000..b5acbf93c5da
--- /dev/null
+++ b/include/linux/iio/events.h
@@ -0,0 +1,105 @@
1/* The industrial I/O - event passing to userspace
2 *
3 * Copyright (c) 2008-2011 Jonathan Cameron
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 as published by
7 * the Free Software Foundation.
8 */
9#ifndef _IIO_EVENTS_H_
10#define _IIO_EVENTS_H_
11
12#include <linux/ioctl.h>
13#include <linux/types.h>
14#include <linux/iio/types.h>
15
16/**
17 * struct iio_event_data - The actual event being pushed to userspace
18 * @id: event identifier
19 * @timestamp: best estimate of time of event occurrence (often from
20 * the interrupt handler)
21 */
22struct iio_event_data {
23 __u64 id;
24 __s64 timestamp;
25};
26
27#define IIO_GET_EVENT_FD_IOCTL _IOR('i', 0x90, int)
28
29enum iio_event_type {
30 IIO_EV_TYPE_THRESH,
31 IIO_EV_TYPE_MAG,
32 IIO_EV_TYPE_ROC,
33 IIO_EV_TYPE_THRESH_ADAPTIVE,
34 IIO_EV_TYPE_MAG_ADAPTIVE,
35};
36
37enum iio_event_direction {
38 IIO_EV_DIR_EITHER,
39 IIO_EV_DIR_RISING,
40 IIO_EV_DIR_FALLING,
41};
42
43/**
44 * IIO_EVENT_CODE() - create event identifier
45 * @chan_type: Type of the channel. Should be one of enum iio_chan_type.
46 * @diff: Whether the event is for an differential channel or not.
47 * @modifier: Modifier for the channel. Should be one of enum iio_modifier.
48 * @direction: Direction of the event. One of enum iio_event_direction.
49 * @type: Type of the event. Should be one enum iio_event_type.
50 * @chan: Channel number for non-differential channels.
51 * @chan1: First channel number for differential channels.
52 * @chan2: Second channel number for differential channels.
53 */
54
55#define IIO_EVENT_CODE(chan_type, diff, modifier, direction, \
56 type, chan, chan1, chan2) \
57 (((u64)type << 56) | ((u64)diff << 55) | \
58 ((u64)direction << 48) | ((u64)modifier << 40) | \
59 ((u64)chan_type << 32) | (((u16)chan2) << 16) | ((u16)chan1) | \
60 ((u16)chan))
61
62
63#define IIO_EV_DIR_MAX 4
64#define IIO_EV_BIT(type, direction) \
65 (1 << (type*IIO_EV_DIR_MAX + direction))
66
67/**
68 * IIO_MOD_EVENT_CODE() - create event identifier for modified channels
69 * @chan_type: Type of the channel. Should be one of enum iio_chan_type.
70 * @number: Channel number.
71 * @modifier: Modifier for the channel. Should be one of enum iio_modifier.
72 * @type: Type of the event. Should be one enum iio_event_type.
73 * @direction: Direction of the event. One of enum iio_event_direction.
74 */
75
76#define IIO_MOD_EVENT_CODE(chan_type, number, modifier, \
77 type, direction) \
78 IIO_EVENT_CODE(chan_type, 0, modifier, direction, type, number, 0, 0)
79
80/**
81 * IIO_UNMOD_EVENT_CODE() - create event identifier for unmodified channels
82 * @chan_type: Type of the channel. Should be one of enum iio_chan_type.
83 * @number: Channel number.
84 * @type: Type of the event. Should be one enum iio_event_type.
85 * @direction: Direction of the event. One of enum iio_event_direction.
86 */
87
88#define IIO_UNMOD_EVENT_CODE(chan_type, number, type, direction) \
89 IIO_EVENT_CODE(chan_type, 0, 0, direction, type, number, 0, 0)
90
91#define IIO_EVENT_CODE_EXTRACT_TYPE(mask) ((mask >> 56) & 0xFF)
92
93#define IIO_EVENT_CODE_EXTRACT_DIR(mask) ((mask >> 48) & 0xCF)
94
95#define IIO_EVENT_CODE_EXTRACT_CHAN_TYPE(mask) ((mask >> 32) & 0xFF)
96
97/* Event code number extraction depends on which type of event we have.
98 * Perhaps review this function in the future*/
99#define IIO_EVENT_CODE_EXTRACT_CHAN(mask) ((__s16)(mask & 0xFFFF))
100#define IIO_EVENT_CODE_EXTRACT_CHAN2(mask) ((__s16)(((mask) >> 16) & 0xFFFF))
101
102#define IIO_EVENT_CODE_EXTRACT_MODIFIER(mask) ((mask >> 40) & 0xFF)
103#define IIO_EVENT_CODE_EXTRACT_DIFF(mask) (((mask) >> 55) & 0x1)
104
105#endif
diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h
new file mode 100644
index 000000000000..3a4f6a3ab80d
--- /dev/null
+++ b/include/linux/iio/iio.h
@@ -0,0 +1,492 @@
1
2/* The industrial I/O core
3 *
4 * Copyright (c) 2008 Jonathan Cameron
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 by
8 * the Free Software Foundation.
9 */
10#ifndef _INDUSTRIAL_IO_H_
11#define _INDUSTRIAL_IO_H_
12
13#include <linux/device.h>
14#include <linux/cdev.h>
15#include <linux/iio/types.h>
16/* IIO TODO LIST */
17/*
18 * Provide means of adjusting timer accuracy.
19 * Currently assumes nano seconds.
20 */
21
22enum iio_chan_info_enum {
23 IIO_CHAN_INFO_RAW = 0,
24 IIO_CHAN_INFO_PROCESSED,
25 IIO_CHAN_INFO_SCALE,
26 IIO_CHAN_INFO_OFFSET,
27 IIO_CHAN_INFO_CALIBSCALE,
28 IIO_CHAN_INFO_CALIBBIAS,
29 IIO_CHAN_INFO_PEAK,
30 IIO_CHAN_INFO_PEAK_SCALE,
31 IIO_CHAN_INFO_QUADRATURE_CORRECTION_RAW,
32 IIO_CHAN_INFO_AVERAGE_RAW,
33 IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY,
34 IIO_CHAN_INFO_SAMP_FREQ,
35 IIO_CHAN_INFO_FREQUENCY,
36 IIO_CHAN_INFO_PHASE,
37 IIO_CHAN_INFO_HARDWAREGAIN,
38};
39
40#define IIO_CHAN_INFO_SHARED_BIT(type) BIT(type*2)
41#define IIO_CHAN_INFO_SEPARATE_BIT(type) BIT(type*2 + 1)
42
43#define IIO_CHAN_INFO_RAW_SEPARATE_BIT \
44 IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_RAW)
45#define IIO_CHAN_INFO_PROCESSED_SEPARATE_BIT \
46 IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_PROCESSED)
47#define IIO_CHAN_INFO_SCALE_SEPARATE_BIT \
48 IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_SCALE)
49#define IIO_CHAN_INFO_SCALE_SHARED_BIT \
50 IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_SCALE)
51#define IIO_CHAN_INFO_OFFSET_SEPARATE_BIT \
52 IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_OFFSET)
53#define IIO_CHAN_INFO_OFFSET_SHARED_BIT \
54 IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_OFFSET)
55#define IIO_CHAN_INFO_CALIBSCALE_SEPARATE_BIT \
56 IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_CALIBSCALE)
57#define IIO_CHAN_INFO_CALIBSCALE_SHARED_BIT \
58 IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_CALIBSCALE)
59#define IIO_CHAN_INFO_CALIBBIAS_SEPARATE_BIT \
60 IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_CALIBBIAS)
61#define IIO_CHAN_INFO_CALIBBIAS_SHARED_BIT \
62 IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_CALIBBIAS)
63#define IIO_CHAN_INFO_PEAK_SEPARATE_BIT \
64 IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_PEAK)
65#define IIO_CHAN_INFO_PEAK_SHARED_BIT \
66 IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_PEAK)
67#define IIO_CHAN_INFO_PEAKSCALE_SEPARATE_BIT \
68 IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_PEAKSCALE)
69#define IIO_CHAN_INFO_PEAKSCALE_SHARED_BIT \
70 IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_PEAKSCALE)
71#define IIO_CHAN_INFO_QUADRATURE_CORRECTION_RAW_SEPARATE_BIT \
72 IIO_CHAN_INFO_SEPARATE_BIT( \
73 IIO_CHAN_INFO_QUADRATURE_CORRECTION_RAW)
74#define IIO_CHAN_INFO_QUADRATURE_CORRECTION_RAW_SHARED_BIT \
75 IIO_CHAN_INFO_SHARED_BIT( \
76 IIO_CHAN_INFO_QUADRATURE_CORRECTION_RAW)
77#define IIO_CHAN_INFO_AVERAGE_RAW_SEPARATE_BIT \
78 IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_AVERAGE_RAW)
79#define IIO_CHAN_INFO_AVERAGE_RAW_SHARED_BIT \
80 IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_AVERAGE_RAW)
81#define IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY_SHARED_BIT \
82 IIO_CHAN_INFO_SHARED_BIT( \
83 IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY)
84#define IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY_SEPARATE_BIT \
85 IIO_CHAN_INFO_SEPARATE_BIT( \
86 IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY)
87#define IIO_CHAN_INFO_SAMP_FREQ_SEPARATE_BIT \
88 IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_SAMP_FREQ)
89#define IIO_CHAN_INFO_SAMP_FREQ_SHARED_BIT \
90 IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_SAMP_FREQ)
91#define IIO_CHAN_INFO_FREQUENCY_SEPARATE_BIT \
92 IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_FREQUENCY)
93#define IIO_CHAN_INFO_FREQUENCY_SHARED_BIT \
94 IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_FREQUENCY)
95#define IIO_CHAN_INFO_PHASE_SEPARATE_BIT \
96 IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_PHASE)
97#define IIO_CHAN_INFO_PHASE_SHARED_BIT \
98 IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_PHASE)
99#define IIO_CHAN_INFO_HARDWAREGAIN_SEPARATE_BIT \
100 IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_HARDWAREGAIN)
101#define IIO_CHAN_INFO_HARDWAREGAIN_SHARED_BIT \
102 IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_HARDWAREGAIN)
103
104enum iio_endian {
105 IIO_CPU,
106 IIO_BE,
107 IIO_LE,
108};
109
110struct iio_chan_spec;
111struct iio_dev;
112
113/**
114 * struct iio_chan_spec_ext_info - Extended channel info attribute
115 * @name: Info attribute name
116 * @shared: Whether this attribute is shared between all channels.
117 * @read: Read callback for this info attribute, may be NULL.
118 * @write: Write callback for this info attribute, may be NULL.
119 * @private: Data private to the driver.
120 */
121struct iio_chan_spec_ext_info {
122 const char *name;
123 bool shared;
124 ssize_t (*read)(struct iio_dev *, uintptr_t private,
125 struct iio_chan_spec const *, char *buf);
126 ssize_t (*write)(struct iio_dev *, uintptr_t private,
127 struct iio_chan_spec const *, const char *buf,
128 size_t len);
129 uintptr_t private;
130};
131
132/**
133 * struct iio_chan_spec - specification of a single channel
134 * @type: What type of measurement is the channel making.
135 * @channel: What number or name do we wish to assign the channel.
136 * @channel2: If there is a second number for a differential
137 * channel then this is it. If modified is set then the
138 * value here specifies the modifier.
139 * @address: Driver specific identifier.
140 * @scan_index: Monotonic index to give ordering in scans when read
141 * from a buffer.
142 * @scan_type: Sign: 's' or 'u' to specify signed or unsigned
143 * realbits: Number of valid bits of data
144 * storage_bits: Realbits + padding
145 * shift: Shift right by this before masking out
146 * realbits.
147 * endianness: little or big endian
148 * @info_mask: What information is to be exported about this channel.
149 * This includes calibbias, scale etc.
150 * @event_mask: What events can this channel produce.
151 * @ext_info: Array of extended info attributes for this channel.
152 * The array is NULL terminated, the last element should
153 * have it's name field set to NULL.
154 * @extend_name: Allows labeling of channel attributes with an
155 * informative name. Note this has no effect codes etc,
156 * unlike modifiers.
157 * @datasheet_name: A name used in in kernel mapping of channels. It should
158 * correspond to the first name that the channel is referred
159 * to by in the datasheet (e.g. IND), or the nearest
160 * possible compound name (e.g. IND-INC).
161 * @modified: Does a modifier apply to this channel. What these are
162 * depends on the channel type. Modifier is set in
163 * channel2. Examples are IIO_MOD_X for axial sensors about
164 * the 'x' axis.
165 * @indexed: Specify the channel has a numerical index. If not,
166 * the value in channel will be suppressed for attribute
167 * but not for event codes. Typically set it to 0 when
168 * the index is false.
169 * @differential: Channel is differential.
170 */
171struct iio_chan_spec {
172 enum iio_chan_type type;
173 int channel;
174 int channel2;
175 unsigned long address;
176 int scan_index;
177 struct {
178 char sign;
179 u8 realbits;
180 u8 storagebits;
181 u8 shift;
182 enum iio_endian endianness;
183 } scan_type;
184 long info_mask;
185 long event_mask;
186 const struct iio_chan_spec_ext_info *ext_info;
187 const char *extend_name;
188 const char *datasheet_name;
189 unsigned modified:1;
190 unsigned indexed:1;
191 unsigned output:1;
192 unsigned differential:1;
193};
194
195#define IIO_ST(si, rb, sb, sh) \
196 { .sign = si, .realbits = rb, .storagebits = sb, .shift = sh }
197
198#define IIO_CHAN_SOFT_TIMESTAMP(_si) \
199 { .type = IIO_TIMESTAMP, .channel = -1, \
200 .scan_index = _si, .scan_type = IIO_ST('s', 64, 64, 0) }
201
202/**
203 * iio_get_time_ns() - utility function to get a time stamp for events etc
204 **/
205static inline s64 iio_get_time_ns(void)
206{
207 struct timespec ts;
208 /*
209 * calls getnstimeofday.
210 * If hrtimers then up to ns accurate, if not microsecond.
211 */
212 ktime_get_real_ts(&ts);
213
214 return timespec_to_ns(&ts);
215}
216
217/* Device operating modes */
218#define INDIO_DIRECT_MODE 0x01
219#define INDIO_BUFFER_TRIGGERED 0x02
220#define INDIO_BUFFER_HARDWARE 0x08
221
222#define INDIO_ALL_BUFFER_MODES \
223 (INDIO_BUFFER_TRIGGERED | INDIO_BUFFER_HARDWARE)
224
225struct iio_trigger; /* forward declaration */
226struct iio_dev;
227
228/**
229 * struct iio_info - constant information about device
230 * @driver_module: module structure used to ensure correct
231 * ownership of chrdevs etc
232 * @event_attrs: event control attributes
233 * @attrs: general purpose device attributes
234 * @read_raw: function to request a value from the device.
235 * mask specifies which value. Note 0 means a reading of
236 * the channel in question. Return value will specify the
237 * type of value returned by the device. val and val2 will
238 * contain the elements making up the returned value.
239 * @write_raw: function to write a value to the device.
240 * Parameters are the same as for read_raw.
241 * @write_raw_get_fmt: callback function to query the expected
242 * format/precision. If not set by the driver, write_raw
243 * returns IIO_VAL_INT_PLUS_MICRO.
244 * @read_event_config: find out if the event is enabled.
245 * @write_event_config: set if the event is enabled.
246 * @read_event_value: read a value associated with the event. Meaning
247 * is event dependant. event_code specifies which event.
248 * @write_event_value: write the value associated with the event.
249 * Meaning is event dependent.
250 * @validate_trigger: function to validate the trigger when the
251 * current trigger gets changed.
252 **/
253struct iio_info {
254 struct module *driver_module;
255 struct attribute_group *event_attrs;
256 const struct attribute_group *attrs;
257
258 int (*read_raw)(struct iio_dev *indio_dev,
259 struct iio_chan_spec const *chan,
260 int *val,
261 int *val2,
262 long mask);
263
264 int (*write_raw)(struct iio_dev *indio_dev,
265 struct iio_chan_spec const *chan,
266 int val,
267 int val2,
268 long mask);
269
270 int (*write_raw_get_fmt)(struct iio_dev *indio_dev,
271 struct iio_chan_spec const *chan,
272 long mask);
273
274 int (*read_event_config)(struct iio_dev *indio_dev,
275 u64 event_code);
276
277 int (*write_event_config)(struct iio_dev *indio_dev,
278 u64 event_code,
279 int state);
280
281 int (*read_event_value)(struct iio_dev *indio_dev,
282 u64 event_code,
283 int *val);
284 int (*write_event_value)(struct iio_dev *indio_dev,
285 u64 event_code,
286 int val);
287 int (*validate_trigger)(struct iio_dev *indio_dev,
288 struct iio_trigger *trig);
289 int (*update_scan_mode)(struct iio_dev *indio_dev,
290 const unsigned long *scan_mask);
291 int (*debugfs_reg_access)(struct iio_dev *indio_dev,
292 unsigned reg, unsigned writeval,
293 unsigned *readval);
294};
295
296/**
297 * struct iio_buffer_setup_ops - buffer setup related callbacks
298 * @preenable: [DRIVER] function to run prior to marking buffer enabled
299 * @postenable: [DRIVER] function to run after marking buffer enabled
300 * @predisable: [DRIVER] function to run prior to marking buffer
301 * disabled
302 * @postdisable: [DRIVER] function to run after marking buffer disabled
303 */
304struct iio_buffer_setup_ops {
305 int (*preenable)(struct iio_dev *);
306 int (*postenable)(struct iio_dev *);
307 int (*predisable)(struct iio_dev *);
308 int (*postdisable)(struct iio_dev *);
309};
310
311/**
312 * struct iio_dev - industrial I/O device
313 * @id: [INTERN] used to identify device internally
314 * @modes: [DRIVER] operating modes supported by device
315 * @currentmode: [DRIVER] current operating mode
316 * @dev: [DRIVER] device structure, should be assigned a parent
317 * and owner
318 * @event_interface: [INTERN] event chrdevs associated with interrupt lines
319 * @buffer: [DRIVER] any buffer present
320 * @scan_bytes: [INTERN] num bytes captured to be fed to buffer demux
321 * @mlock: [INTERN] lock used to prevent simultaneous device state
322 * changes
323 * @available_scan_masks: [DRIVER] optional array of allowed bitmasks
324 * @masklength: [INTERN] the length of the mask established from
325 * channels
326 * @active_scan_mask: [INTERN] union of all scan masks requested by buffers
327 * @scan_timestamp: [INTERN] set if any buffers have requested timestamp
328 * @scan_index_timestamp:[INTERN] cache of the index to the timestamp
329 * @trig: [INTERN] current device trigger (buffer modes)
330 * @pollfunc: [DRIVER] function run on trigger being received
331 * @channels: [DRIVER] channel specification structure table
332 * @num_channels: [DRIVER] number of chanels specified in @channels.
333 * @channel_attr_list: [INTERN] keep track of automatically created channel
334 * attributes
335 * @chan_attr_group: [INTERN] group for all attrs in base directory
336 * @name: [DRIVER] name of the device.
337 * @info: [DRIVER] callbacks and constant info from driver
338 * @info_exist_lock: [INTERN] lock to prevent use during removal
339 * @setup_ops: [DRIVER] callbacks to call before and after buffer
340 * enable/disable
341 * @chrdev: [INTERN] associated character device
342 * @groups: [INTERN] attribute groups
343 * @groupcounter: [INTERN] index of next attribute group
344 * @flags: [INTERN] file ops related flags including busy flag.
345 * @debugfs_dentry: [INTERN] device specific debugfs dentry.
346 * @cached_reg_addr: [INTERN] cached register address for debugfs reads.
347 */
348struct iio_dev {
349 int id;
350
351 int modes;
352 int currentmode;
353 struct device dev;
354
355 struct iio_event_interface *event_interface;
356
357 struct iio_buffer *buffer;
358 int scan_bytes;
359 struct mutex mlock;
360
361 const unsigned long *available_scan_masks;
362 unsigned masklength;
363 const unsigned long *active_scan_mask;
364 bool scan_timestamp;
365 unsigned scan_index_timestamp;
366 struct iio_trigger *trig;
367 struct iio_poll_func *pollfunc;
368
369 struct iio_chan_spec const *channels;
370 int num_channels;
371
372 struct list_head channel_attr_list;
373 struct attribute_group chan_attr_group;
374 const char *name;
375 const struct iio_info *info;
376 struct mutex info_exist_lock;
377 const struct iio_buffer_setup_ops *setup_ops;
378 struct cdev chrdev;
379#define IIO_MAX_GROUPS 6
380 const struct attribute_group *groups[IIO_MAX_GROUPS + 1];
381 int groupcounter;
382
383 unsigned long flags;
384#if defined(CONFIG_DEBUG_FS)
385 struct dentry *debugfs_dentry;
386 unsigned cached_reg_addr;
387#endif
388};
389
390/**
391 * iio_find_channel_from_si() - get channel from its scan index
392 * @indio_dev: device
393 * @si: scan index to match
394 */
395const struct iio_chan_spec
396*iio_find_channel_from_si(struct iio_dev *indio_dev, int si);
397
398/**
399 * iio_device_register() - register a device with the IIO subsystem
400 * @indio_dev: Device structure filled by the device driver
401 **/
402int iio_device_register(struct iio_dev *indio_dev);
403
404/**
405 * iio_device_unregister() - unregister a device from the IIO subsystem
406 * @indio_dev: Device structure representing the device.
407 **/
408void iio_device_unregister(struct iio_dev *indio_dev);
409
410/**
411 * iio_push_event() - try to add event to the list for userspace reading
412 * @indio_dev: IIO device structure
413 * @ev_code: What event
414 * @timestamp: When the event occurred
415 **/
416int iio_push_event(struct iio_dev *indio_dev, u64 ev_code, s64 timestamp);
417
418extern struct bus_type iio_bus_type;
419
420/**
421 * iio_device_put() - reference counted deallocation of struct device
422 * @dev: the iio_device containing the device
423 **/
424static inline void iio_device_put(struct iio_dev *indio_dev)
425{
426 if (indio_dev)
427 put_device(&indio_dev->dev);
428};
429
430/**
431 * dev_to_iio_dev() - Get IIO device struct from a device struct
432 * @dev: The device embedded in the IIO device
433 *
434 * Note: The device must be a IIO device, otherwise the result is undefined.
435 */
436static inline struct iio_dev *dev_to_iio_dev(struct device *dev)
437{
438 return container_of(dev, struct iio_dev, dev);
439}
440
441/* Can we make this smaller? */
442#define IIO_ALIGN L1_CACHE_BYTES
443/**
444 * iio_device_alloc() - allocate an iio_dev from a driver
445 * @sizeof_priv: Space to allocate for private structure.
446 **/
447struct iio_dev *iio_device_alloc(int sizeof_priv);
448
449static inline void *iio_priv(const struct iio_dev *indio_dev)
450{
451 return (char *)indio_dev + ALIGN(sizeof(struct iio_dev), IIO_ALIGN);
452}
453
454static inline struct iio_dev *iio_priv_to_dev(void *priv)
455{
456 return (struct iio_dev *)((char *)priv -
457 ALIGN(sizeof(struct iio_dev), IIO_ALIGN));
458}
459
460/**
461 * iio_device_free() - free an iio_dev from a driver
462 * @dev: the iio_dev associated with the device
463 **/
464void iio_device_free(struct iio_dev *indio_dev);
465
466/**
467 * iio_buffer_enabled() - helper function to test if the buffer is enabled
468 * @indio_dev: IIO device info structure for device
469 **/
470static inline bool iio_buffer_enabled(struct iio_dev *indio_dev)
471{
472 return indio_dev->currentmode
473 & (INDIO_BUFFER_TRIGGERED | INDIO_BUFFER_HARDWARE);
474};
475
476/**
477 * iio_get_debugfs_dentry() - helper function to get the debugfs_dentry
478 * @indio_dev: IIO device info structure for device
479 **/
480#if defined(CONFIG_DEBUG_FS)
481static inline struct dentry *iio_get_debugfs_dentry(struct iio_dev *indio_dev)
482{
483 return indio_dev->debugfs_dentry;
484};
485#else
486static inline struct dentry *iio_get_debugfs_dentry(struct iio_dev *indio_dev)
487{
488 return NULL;
489};
490#endif
491
492#endif /* _INDUSTRIAL_IO_H_ */
diff --git a/include/linux/iio/kfifo_buf.h b/include/linux/iio/kfifo_buf.h
new file mode 100644
index 000000000000..014d5a13b32b
--- /dev/null
+++ b/include/linux/iio/kfifo_buf.h
@@ -0,0 +1,8 @@
1
2#include <linux/kfifo.h>
3#include <linux/iio/iio.h>
4#include <linux/iio/buffer.h>
5
6struct iio_buffer *iio_kfifo_allocate(struct iio_dev *indio_dev);
7void iio_kfifo_free(struct iio_buffer *r);
8
diff --git a/include/linux/iio/machine.h b/include/linux/iio/machine.h
new file mode 100644
index 000000000000..0b1f19bfdc44
--- /dev/null
+++ b/include/linux/iio/machine.h
@@ -0,0 +1,24 @@
1/*
2 * Industrial I/O in kernel access map definitions for board files.
3 *
4 * Copyright (c) 2011 Jonathan Cameron
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 by
8 * the Free Software Foundation.
9 */
10
11/**
12 * struct iio_map - description of link between consumer and device channels
13 * @adc_channel_label: Label used to identify the channel on the provider.
14 * This is matched against the datasheet_name element
15 * of struct iio_chan_spec.
16 * @consumer_dev_name: Name to uniquely identify the consumer device.
17 * @consumer_channel: Unique name used to idenitify the channel on the
18 * consumer side.
19 */
20struct iio_map {
21 const char *adc_channel_label;
22 const char *consumer_dev_name;
23 const char *consumer_channel;
24};
diff --git a/include/linux/iio/sysfs.h b/include/linux/iio/sysfs.h
new file mode 100644
index 000000000000..bfedb73b850e
--- /dev/null
+++ b/include/linux/iio/sysfs.h
@@ -0,0 +1,117 @@
1/* The industrial I/O core
2 *
3 *Copyright (c) 2008 Jonathan Cameron
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 as published by
7 * the Free Software Foundation.
8 *
9 * General attributes
10 */
11
12#ifndef _INDUSTRIAL_IO_SYSFS_H_
13#define _INDUSTRIAL_IO_SYSFS_H_
14
15struct iio_chan_spec;
16
17/**
18 * struct iio_dev_attr - iio specific device attribute
19 * @dev_attr: underlying device attribute
20 * @address: associated register address
21 * @l: list head for maintaining list of dynamically created attrs.
22 */
23struct iio_dev_attr {
24 struct device_attribute dev_attr;
25 u64 address;
26 struct list_head l;
27 struct iio_chan_spec const *c;
28};
29
30#define to_iio_dev_attr(_dev_attr) \
31 container_of(_dev_attr, struct iio_dev_attr, dev_attr)
32
33ssize_t iio_read_const_attr(struct device *dev,
34 struct device_attribute *attr,
35 char *len);
36
37/**
38 * struct iio_const_attr - constant device specific attribute
39 * often used for things like available modes
40 * @string: attribute string
41 * @dev_attr: underlying device attribute
42 */
43struct iio_const_attr {
44 const char *string;
45 struct device_attribute dev_attr;
46};
47
48#define to_iio_const_attr(_dev_attr) \
49 container_of(_dev_attr, struct iio_const_attr, dev_attr)
50
51/* Some attributes will be hard coded (device dependent) and not require an
52 address, in these cases pass a negative */
53#define IIO_ATTR(_name, _mode, _show, _store, _addr) \
54 { .dev_attr = __ATTR(_name, _mode, _show, _store), \
55 .address = _addr }
56
57#define IIO_DEVICE_ATTR(_name, _mode, _show, _store, _addr) \
58 struct iio_dev_attr iio_dev_attr_##_name \
59 = IIO_ATTR(_name, _mode, _show, _store, _addr)
60
61#define IIO_DEVICE_ATTR_NAMED(_vname, _name, _mode, _show, _store, _addr) \
62 struct iio_dev_attr iio_dev_attr_##_vname \
63 = IIO_ATTR(_name, _mode, _show, _store, _addr)
64
65#define IIO_CONST_ATTR(_name, _string) \
66 struct iio_const_attr iio_const_attr_##_name \
67 = { .string = _string, \
68 .dev_attr = __ATTR(_name, S_IRUGO, iio_read_const_attr, NULL)}
69
70#define IIO_CONST_ATTR_NAMED(_vname, _name, _string) \
71 struct iio_const_attr iio_const_attr_##_vname \
72 = { .string = _string, \
73 .dev_attr = __ATTR(_name, S_IRUGO, iio_read_const_attr, NULL)}
74
75/* Generic attributes of onetype or another */
76/**
77 * IIO_DEV_ATTR_RESET: resets the device
78 **/
79#define IIO_DEV_ATTR_RESET(_store) \
80 IIO_DEVICE_ATTR(reset, S_IWUSR, NULL, _store, 0)
81
82/**
83 * IIO_DEV_ATTR_SAMP_FREQ - sets any internal clock frequency
84 * @_mode: sysfs file mode/permissions
85 * @_show: output method for the attribute
86 * @_store: input method for the attribute
87 **/
88#define IIO_DEV_ATTR_SAMP_FREQ(_mode, _show, _store) \
89 IIO_DEVICE_ATTR(sampling_frequency, _mode, _show, _store, 0)
90
91/**
92 * IIO_DEV_ATTR_SAMP_FREQ_AVAIL - list available sampling frequencies
93 * @_show: output method for the attribute
94 *
95 * May be mode dependent on some devices
96 **/
97#define IIO_DEV_ATTR_SAMP_FREQ_AVAIL(_show) \
98 IIO_DEVICE_ATTR(sampling_frequency_available, S_IRUGO, _show, NULL, 0)
99/**
100 * IIO_CONST_ATTR_AVAIL_SAMP_FREQ - list available sampling frequencies
101 * @_string: frequency string for the attribute
102 *
103 * Constant version
104 **/
105#define IIO_CONST_ATTR_SAMP_FREQ_AVAIL(_string) \
106 IIO_CONST_ATTR(sampling_frequency_available, _string)
107
108#define IIO_DEV_ATTR_TEMP_RAW(_show) \
109 IIO_DEVICE_ATTR(in_temp_raw, S_IRUGO, _show, NULL, 0)
110
111#define IIO_CONST_ATTR_TEMP_OFFSET(_string) \
112 IIO_CONST_ATTR(in_temp_offset, _string)
113
114#define IIO_CONST_ATTR_TEMP_SCALE(_string) \
115 IIO_CONST_ATTR(in_temp_scale, _string)
116
117#endif /* _INDUSTRIAL_IO_SYSFS_H_ */
diff --git a/include/linux/iio/trigger.h b/include/linux/iio/trigger.h
new file mode 100644
index 000000000000..a9819940a84c
--- /dev/null
+++ b/include/linux/iio/trigger.h
@@ -0,0 +1,119 @@
1/* The industrial I/O core, trigger handling functions
2 *
3 * Copyright (c) 2008 Jonathan Cameron
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 as published by
7 * the Free Software Foundation.
8 */
9#include <linux/irq.h>
10#include <linux/module.h>
11
12#ifndef _IIO_TRIGGER_H_
13#define _IIO_TRIGGER_H_
14
15struct iio_subirq {
16 bool enabled;
17};
18
19/**
20 * struct iio_trigger_ops - operations structure for an iio_trigger.
21 * @owner: used to monitor usage count of the trigger.
22 * @set_trigger_state: switch on/off the trigger on demand
23 * @try_reenable: function to reenable the trigger when the
24 * use count is zero (may be NULL)
25 * @validate_device: function to validate the device when the
26 * current trigger gets changed.
27 *
28 * This is typically static const within a driver and shared by
29 * instances of a given device.
30 **/
31struct iio_trigger_ops {
32 struct module *owner;
33 int (*set_trigger_state)(struct iio_trigger *trig, bool state);
34 int (*try_reenable)(struct iio_trigger *trig);
35 int (*validate_device)(struct iio_trigger *trig,
36 struct iio_dev *indio_dev);
37};
38
39
40/**
41 * struct iio_trigger - industrial I/O trigger device
42 *
43 * @id: [INTERN] unique id number
44 * @name: [DRIVER] unique name
45 * @dev: [DRIVER] associated device (if relevant)
46 * @private_data: [DRIVER] device specific data
47 * @list: [INTERN] used in maintenance of global trigger list
48 * @alloc_list: [DRIVER] used for driver specific trigger list
49 * @use_count: use count for the trigger
50 * @subirq_chip: [INTERN] associate 'virtual' irq chip.
51 * @subirq_base: [INTERN] base number for irqs provided by trigger.
52 * @subirqs: [INTERN] information about the 'child' irqs.
53 * @pool: [INTERN] bitmap of irqs currently in use.
54 * @pool_lock: [INTERN] protection of the irq pool.
55 **/
56struct iio_trigger {
57 const struct iio_trigger_ops *ops;
58 int id;
59 const char *name;
60 struct device dev;
61
62 void *private_data;
63 struct list_head list;
64 struct list_head alloc_list;
65 int use_count;
66
67 struct irq_chip subirq_chip;
68 int subirq_base;
69
70 struct iio_subirq subirqs[CONFIG_IIO_CONSUMERS_PER_TRIGGER];
71 unsigned long pool[BITS_TO_LONGS(CONFIG_IIO_CONSUMERS_PER_TRIGGER)];
72 struct mutex pool_lock;
73};
74
75
76static inline struct iio_trigger *to_iio_trigger(struct device *d)
77{
78 return container_of(d, struct iio_trigger, dev);
79};
80
81static inline void iio_trigger_put(struct iio_trigger *trig)
82{
83 module_put(trig->ops->owner);
84 put_device(&trig->dev);
85};
86
87static inline void iio_trigger_get(struct iio_trigger *trig)
88{
89 get_device(&trig->dev);
90 __module_get(trig->ops->owner);
91};
92
93/**
94 * iio_trigger_register() - register a trigger with the IIO core
95 * @trig_info: trigger to be registered
96 **/
97int iio_trigger_register(struct iio_trigger *trig_info);
98
99/**
100 * iio_trigger_unregister() - unregister a trigger from the core
101 * @trig_info: trigger to be unregistered
102 **/
103void iio_trigger_unregister(struct iio_trigger *trig_info);
104
105/**
106 * iio_trigger_poll() - called on a trigger occurring
107 * @trig: trigger which occurred
108 *
109 * Typically called in relevant hardware interrupt handler.
110 **/
111void iio_trigger_poll(struct iio_trigger *trig, s64 time);
112void iio_trigger_poll_chained(struct iio_trigger *trig, s64 time);
113
114irqreturn_t iio_trigger_generic_data_rdy_poll(int irq, void *private);
115
116__printf(1, 2) struct iio_trigger *iio_trigger_alloc(const char *fmt, ...);
117void iio_trigger_free(struct iio_trigger *trig);
118
119#endif /* _IIO_TRIGGER_H_ */
diff --git a/include/linux/iio/trigger_consumer.h b/include/linux/iio/trigger_consumer.h
new file mode 100644
index 000000000000..60d64b356945
--- /dev/null
+++ b/include/linux/iio/trigger_consumer.h
@@ -0,0 +1,52 @@
1/* The industrial I/O core, trigger consumer functions
2 *
3 * Copyright (c) 2008-2011 Jonathan Cameron
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 as published by
7 * the Free Software Foundation.
8 */
9
10/**
11 * struct iio_poll_func - poll function pair
12 *
13 * @indio_dev: data specific to device (passed into poll func)
14 * @h: the function that is actually run on trigger
15 * @thread: threaded interrupt part
16 * @type: the type of interrupt (basically if oneshot)
17 * @name: name used to identify the trigger consumer.
18 * @irq: the corresponding irq as allocated from the
19 * trigger pool
20 * @timestamp: some devices need a timestamp grabbed as soon
21 * as possible after the trigger - hence handler
22 * passes it via here.
23 **/
24struct iio_poll_func {
25 struct iio_dev *indio_dev;
26 irqreturn_t (*h)(int irq, void *p);
27 irqreturn_t (*thread)(int irq, void *p);
28 int type;
29 char *name;
30 int irq;
31 s64 timestamp;
32};
33
34
35struct iio_poll_func
36*iio_alloc_pollfunc(irqreturn_t (*h)(int irq, void *p),
37 irqreturn_t (*thread)(int irq, void *p),
38 int type,
39 struct iio_dev *indio_dev,
40 const char *fmt,
41 ...);
42void iio_dealloc_pollfunc(struct iio_poll_func *pf);
43irqreturn_t iio_pollfunc_store_time(int irq, void *p);
44
45void iio_trigger_notify_done(struct iio_trigger *trig);
46
47/*
48 * Two functions for common case where all that happens is a pollfunc
49 * is attached and detached from a trigger
50 */
51int iio_triggered_buffer_postenable(struct iio_dev *indio_dev);
52int iio_triggered_buffer_predisable(struct iio_dev *indio_dev);
diff --git a/include/linux/iio/types.h b/include/linux/iio/types.h
new file mode 100644
index 000000000000..1b073b1cc7c2
--- /dev/null
+++ b/include/linux/iio/types.h
@@ -0,0 +1,55 @@
1/* industrial I/O data types needed both in and out of kernel
2 *
3 * Copyright (c) 2008 Jonathan Cameron
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 as published by
7 * the Free Software Foundation.
8 */
9
10#ifndef _IIO_TYPES_H_
11#define _IIO_TYPES_H_
12
13enum iio_chan_type {
14 /* real channel types */
15 IIO_VOLTAGE,
16 IIO_CURRENT,
17 IIO_POWER,
18 IIO_ACCEL,
19 IIO_ANGL_VEL,
20 IIO_MAGN,
21 IIO_LIGHT,
22 IIO_INTENSITY,
23 IIO_PROXIMITY,
24 IIO_TEMP,
25 IIO_INCLI,
26 IIO_ROT,
27 IIO_ANGL,
28 IIO_TIMESTAMP,
29 IIO_CAPACITANCE,
30 IIO_ALTVOLTAGE,
31};
32
33enum iio_modifier {
34 IIO_NO_MOD,
35 IIO_MOD_X,
36 IIO_MOD_Y,
37 IIO_MOD_Z,
38 IIO_MOD_X_AND_Y,
39 IIO_MOD_X_AND_Z,
40 IIO_MOD_Y_AND_Z,
41 IIO_MOD_X_AND_Y_AND_Z,
42 IIO_MOD_X_OR_Y,
43 IIO_MOD_X_OR_Z,
44 IIO_MOD_Y_OR_Z,
45 IIO_MOD_X_OR_Y_OR_Z,
46 IIO_MOD_LIGHT_BOTH,
47 IIO_MOD_LIGHT_IR,
48};
49
50#define IIO_VAL_INT 1
51#define IIO_VAL_INT_PLUS_MICRO 2
52#define IIO_VAL_INT_PLUS_NANO 3
53#define IIO_VAL_INT_PLUS_MICRO_DB 4
54
55#endif /* _IIO_TYPES_H_ */
diff --git a/include/linux/in6.h b/include/linux/in6.h
index 5c83d9e3eb8f..cba469ba11a4 100644
--- a/include/linux/in6.h
+++ b/include/linux/in6.h
@@ -142,7 +142,7 @@ struct in6_flowlabel_req {
142/* 142/*
143 * IPv6 TLV options. 143 * IPv6 TLV options.
144 */ 144 */
145#define IPV6_TLV_PAD0 0 145#define IPV6_TLV_PAD1 0
146#define IPV6_TLV_PADN 1 146#define IPV6_TLV_PADN 1
147#define IPV6_TLV_ROUTERALERT 5 147#define IPV6_TLV_ROUTERALERT 5
148#define IPV6_TLV_JUMBO 194 148#define IPV6_TLV_JUMBO 194
diff --git a/include/linux/input/lm8333.h b/include/linux/input/lm8333.h
new file mode 100644
index 000000000000..79f918c6e8c5
--- /dev/null
+++ b/include/linux/input/lm8333.h
@@ -0,0 +1,24 @@
1/*
2 * public include for LM8333 keypad driver - same license as driver
3 * Copyright (C) 2012 Wolfram Sang, Pengutronix <w.sang@pengutronix.de>
4 */
5
6#ifndef _LM8333_H
7#define _LM8333_H
8
9struct lm8333;
10
11struct lm8333_platform_data {
12 /* Keymap data */
13 const struct matrix_keymap_data *matrix_data;
14 /* Active timeout before enter HALT mode in microseconds */
15 unsigned active_time;
16 /* Debounce interval in microseconds */
17 unsigned debounce_time;
18};
19
20extern int lm8333_read8(struct lm8333 *lm8333, u8 cmd);
21extern int lm8333_write8(struct lm8333 *lm8333, u8 cmd, u8 val);
22extern int lm8333_read_block(struct lm8333 *lm8333, u8 cmd, u8 len, u8 *buf);
23
24#endif /* _LM8333_H */
diff --git a/include/linux/input/matrix_keypad.h b/include/linux/input/matrix_keypad.h
index 6c07ced0af81..5f3aa6b11bfa 100644
--- a/include/linux/input/matrix_keypad.h
+++ b/include/linux/input/matrix_keypad.h
@@ -75,54 +75,10 @@ struct matrix_keypad_platform_data {
75 bool no_autorepeat; 75 bool no_autorepeat;
76}; 76};
77 77
78/** 78int matrix_keypad_build_keymap(const struct matrix_keymap_data *keymap_data,
79 * matrix_keypad_build_keymap - convert platform keymap into matrix keymap 79 const char *keymap_name,
80 * @keymap_data: keymap supplied by the platform code 80 unsigned int rows, unsigned int cols,
81 * @row_shift: number of bits to shift row value by to advance to the next 81 unsigned short *keymap,
82 * line in the keymap 82 struct input_dev *input_dev);
83 * @keymap: expanded version of keymap that is suitable for use by
84 * matrix keyboad driver
85 * @keybit: pointer to bitmap of keys supported by input device
86 *
87 * This function converts platform keymap (encoded with KEY() macro) into
88 * an array of keycodes that is suitable for using in a standard matrix
89 * keyboard driver that uses row and col as indices.
90 */
91static inline void
92matrix_keypad_build_keymap(const struct matrix_keymap_data *keymap_data,
93 unsigned int row_shift,
94 unsigned short *keymap, unsigned long *keybit)
95{
96 int i;
97
98 for (i = 0; i < keymap_data->keymap_size; i++) {
99 unsigned int key = keymap_data->keymap[i];
100 unsigned int row = KEY_ROW(key);
101 unsigned int col = KEY_COL(key);
102 unsigned short code = KEY_VAL(key);
103
104 keymap[MATRIX_SCAN_CODE(row, col, row_shift)] = code;
105 __set_bit(code, keybit);
106 }
107 __clear_bit(KEY_RESERVED, keybit);
108}
109
110#ifdef CONFIG_INPUT_OF_MATRIX_KEYMAP
111struct matrix_keymap_data *
112matrix_keyboard_of_fill_keymap(struct device_node *np, const char *propname);
113
114void matrix_keyboard_of_free_keymap(const struct matrix_keymap_data *kd);
115#else
116static inline struct matrix_keymap_data *
117matrix_keyboard_of_fill_keymap(struct device_node *np, const char *propname)
118{
119 return NULL;
120}
121
122static inline void
123matrix_keyboard_of_free_keymap(const struct matrix_keymap_data *kd)
124{
125}
126#endif
127 83
128#endif /* _MATRIX_KEYPAD_H */ 84#endif /* _MATRIX_KEYPAD_H */
diff --git a/include/linux/input/navpoint.h b/include/linux/input/navpoint.h
new file mode 100644
index 000000000000..45050eb34de3
--- /dev/null
+++ b/include/linux/input/navpoint.h
@@ -0,0 +1,12 @@
1/*
2 * Copyright (C) 2012 Paul Parsons <lost.distance@yahoo.com>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9struct navpoint_platform_data {
10 int port; /* PXA SSP port for pxa_ssp_request() */
11 int gpio; /* GPIO for power on/off */
12};
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 2aea5d22db07..c91171599cb6 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -93,27 +93,27 @@ typedef irqreturn_t (*irq_handler_t)(int, void *);
93/** 93/**
94 * struct irqaction - per interrupt action descriptor 94 * struct irqaction - per interrupt action descriptor
95 * @handler: interrupt handler function 95 * @handler: interrupt handler function
96 * @flags: flags (see IRQF_* above)
97 * @name: name of the device 96 * @name: name of the device
98 * @dev_id: cookie to identify the device 97 * @dev_id: cookie to identify the device
99 * @percpu_dev_id: cookie to identify the device 98 * @percpu_dev_id: cookie to identify the device
100 * @next: pointer to the next irqaction for shared interrupts 99 * @next: pointer to the next irqaction for shared interrupts
101 * @irq: interrupt number 100 * @irq: interrupt number
102 * @dir: pointer to the proc/irq/NN/name entry 101 * @flags: flags (see IRQF_* above)
103 * @thread_fn: interrupt handler function for threaded interrupts 102 * @thread_fn: interrupt handler function for threaded interrupts
104 * @thread: thread pointer for threaded interrupts 103 * @thread: thread pointer for threaded interrupts
105 * @thread_flags: flags related to @thread 104 * @thread_flags: flags related to @thread
106 * @thread_mask: bitmask for keeping track of @thread activity 105 * @thread_mask: bitmask for keeping track of @thread activity
106 * @dir: pointer to the proc/irq/NN/name entry
107 */ 107 */
108struct irqaction { 108struct irqaction {
109 irq_handler_t handler; 109 irq_handler_t handler;
110 unsigned long flags;
111 void *dev_id; 110 void *dev_id;
112 void __percpu *percpu_dev_id; 111 void __percpu *percpu_dev_id;
113 struct irqaction *next; 112 struct irqaction *next;
114 int irq;
115 irq_handler_t thread_fn; 113 irq_handler_t thread_fn;
116 struct task_struct *thread; 114 struct task_struct *thread;
115 unsigned int irq;
116 unsigned int flags;
117 unsigned long thread_flags; 117 unsigned long thread_flags;
118 unsigned long thread_mask; 118 unsigned long thread_mask;
119 const char *name; 119 const char *name;
diff --git a/include/linux/ioport.h b/include/linux/ioport.h
index e885ba23de70..589e0e75efae 100644
--- a/include/linux/ioport.h
+++ b/include/linux/ioport.h
@@ -223,5 +223,12 @@ extern int
223walk_system_ram_range(unsigned long start_pfn, unsigned long nr_pages, 223walk_system_ram_range(unsigned long start_pfn, unsigned long nr_pages,
224 void *arg, int (*func)(unsigned long, unsigned long, void *)); 224 void *arg, int (*func)(unsigned long, unsigned long, void *));
225 225
226/* True if any part of r1 overlaps r2 */
227static inline bool resource_overlaps(struct resource *r1, struct resource *r2)
228{
229 return (r1->start <= r2->end && r1->end >= r2->start);
230}
231
232
226#endif /* __ASSEMBLY__ */ 233#endif /* __ASSEMBLY__ */
227#endif /* _LINUX_IOPORT_H */ 234#endif /* _LINUX_IOPORT_H */
diff --git a/include/linux/ip_vs.h b/include/linux/ip_vs.h
index 4deb3834d62c..8a2d438dc499 100644
--- a/include/linux/ip_vs.h
+++ b/include/linux/ip_vs.h
@@ -89,6 +89,7 @@
89#define IP_VS_CONN_F_TEMPLATE 0x1000 /* template, not connection */ 89#define IP_VS_CONN_F_TEMPLATE 0x1000 /* template, not connection */
90#define IP_VS_CONN_F_ONE_PACKET 0x2000 /* forward only one packet */ 90#define IP_VS_CONN_F_ONE_PACKET 0x2000 /* forward only one packet */
91 91
92/* Initial bits allowed in backup server */
92#define IP_VS_CONN_F_BACKUP_MASK (IP_VS_CONN_F_FWD_MASK | \ 93#define IP_VS_CONN_F_BACKUP_MASK (IP_VS_CONN_F_FWD_MASK | \
93 IP_VS_CONN_F_NOOUTPUT | \ 94 IP_VS_CONN_F_NOOUTPUT | \
94 IP_VS_CONN_F_INACTIVE | \ 95 IP_VS_CONN_F_INACTIVE | \
@@ -97,6 +98,10 @@
97 IP_VS_CONN_F_TEMPLATE \ 98 IP_VS_CONN_F_TEMPLATE \
98 ) 99 )
99 100
101/* Bits allowed to update in backup server */
102#define IP_VS_CONN_F_BACKUP_UPD_MASK (IP_VS_CONN_F_INACTIVE | \
103 IP_VS_CONN_F_SEQ_MASK)
104
100/* Flags that are not sent to backup server start from bit 16 */ 105/* Flags that are not sent to backup server start from bit 16 */
101#define IP_VS_CONN_F_NFCT (1 << 16) /* use netfilter conntrack */ 106#define IP_VS_CONN_F_NFCT (1 << 16) /* use netfilter conntrack */
102 107
@@ -125,8 +130,8 @@ struct ip_vs_service_user {
125 130
126 /* virtual service options */ 131 /* virtual service options */
127 char sched_name[IP_VS_SCHEDNAME_MAXLEN]; 132 char sched_name[IP_VS_SCHEDNAME_MAXLEN];
128 unsigned flags; /* virtual service flags */ 133 unsigned int flags; /* virtual service flags */
129 unsigned timeout; /* persistent timeout in sec */ 134 unsigned int timeout; /* persistent timeout in sec */
130 __be32 netmask; /* persistent netmask */ 135 __be32 netmask; /* persistent netmask */
131}; 136};
132 137
@@ -137,7 +142,7 @@ struct ip_vs_dest_user {
137 __be16 port; 142 __be16 port;
138 143
139 /* real server options */ 144 /* real server options */
140 unsigned conn_flags; /* connection flags */ 145 unsigned int conn_flags; /* connection flags */
141 int weight; /* destination weight */ 146 int weight; /* destination weight */
142 147
143 /* thresholds for active connections */ 148 /* thresholds for active connections */
@@ -187,8 +192,8 @@ struct ip_vs_service_entry {
187 192
188 /* service options */ 193 /* service options */
189 char sched_name[IP_VS_SCHEDNAME_MAXLEN]; 194 char sched_name[IP_VS_SCHEDNAME_MAXLEN];
190 unsigned flags; /* virtual service flags */ 195 unsigned int flags; /* virtual service flags */
191 unsigned timeout; /* persistent timeout */ 196 unsigned int timeout; /* persistent timeout */
192 __be32 netmask; /* persistent netmask */ 197 __be32 netmask; /* persistent netmask */
193 198
194 /* number of real servers */ 199 /* number of real servers */
@@ -202,7 +207,7 @@ struct ip_vs_service_entry {
202struct ip_vs_dest_entry { 207struct ip_vs_dest_entry {
203 __be32 addr; /* destination address */ 208 __be32 addr; /* destination address */
204 __be16 port; 209 __be16 port;
205 unsigned conn_flags; /* connection flags */ 210 unsigned int conn_flags; /* connection flags */
206 int weight; /* destination weight */ 211 int weight; /* destination weight */
207 212
208 __u32 u_threshold; /* upper threshold */ 213 __u32 u_threshold; /* upper threshold */
diff --git a/include/linux/irq.h b/include/linux/irq.h
index b27cfcfd3a59..61f5cec031e0 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -335,11 +335,6 @@ struct irq_chip {
335 void (*irq_print_chip)(struct irq_data *data, struct seq_file *p); 335 void (*irq_print_chip)(struct irq_data *data, struct seq_file *p);
336 336
337 unsigned long flags; 337 unsigned long flags;
338
339 /* Currently used only by UML, might disappear one day.*/
340#ifdef CONFIG_IRQ_RELEASE_METHOD
341 void (*release)(unsigned int irq, void *dev_id);
342#endif
343}; 338};
344 339
345/* 340/*
diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h
index c65740d76e66..5abb533eb8eb 100644
--- a/include/linux/irqdomain.h
+++ b/include/linux/irqdomain.h
@@ -141,9 +141,8 @@ static inline struct irq_domain *irq_domain_add_legacy_isa(
141 return irq_domain_add_legacy(of_node, NUM_ISA_INTERRUPTS, 0, 0, ops, 141 return irq_domain_add_legacy(of_node, NUM_ISA_INTERRUPTS, 0, 0, ops,
142 host_data); 142 host_data);
143} 143}
144extern struct irq_domain *irq_find_host(struct device_node *node);
145extern void irq_set_default_host(struct irq_domain *host);
146 144
145extern void irq_domain_remove(struct irq_domain *host);
147 146
148extern unsigned int irq_create_mapping(struct irq_domain *host, 147extern unsigned int irq_create_mapping(struct irq_domain *host,
149 irq_hw_number_t hwirq); 148 irq_hw_number_t hwirq);
diff --git a/include/linux/isdn.h b/include/linux/isdn.h
index 292f27a793d4..215c41602af8 100644
--- a/include/linux/isdn.h
+++ b/include/linux/isdn.h
@@ -15,6 +15,7 @@
15#define __ISDN_H__ 15#define __ISDN_H__
16 16
17#include <linux/ioctl.h> 17#include <linux/ioctl.h>
18#include <linux/tty.h>
18 19
19#define ISDN_MAX_DRIVERS 32 20#define ISDN_MAX_DRIVERS 32
20#define ISDN_MAX_CHANNELS 64 21#define ISDN_MAX_CHANNELS 64
@@ -392,21 +393,8 @@ typedef struct isdn_net_dev_s {
392/*======================= Start of ISDN-tty stuff ===========================*/ 393/*======================= Start of ISDN-tty stuff ===========================*/
393 394
394#define ISDN_ASYNC_MAGIC 0x49344C01 /* for paranoia-checking */ 395#define ISDN_ASYNC_MAGIC 0x49344C01 /* for paranoia-checking */
395#define ISDN_ASYNC_INITIALIZED 0x80000000 /* port was initialized */
396#define ISDN_ASYNC_CALLOUT_ACTIVE 0x40000000 /* Call out device active */
397#define ISDN_ASYNC_NORMAL_ACTIVE 0x20000000 /* Normal device active */
398#define ISDN_ASYNC_CLOSING 0x08000000 /* Serial port is closing */
399#define ISDN_ASYNC_CTS_FLOW 0x04000000 /* Do CTS flow control */
400#define ISDN_ASYNC_CHECK_CD 0x02000000 /* i.e., CLOCAL */
401#define ISDN_ASYNC_HUP_NOTIFY 0x0001 /* Notify tty on hangups/closes */
402#define ISDN_ASYNC_SESSION_LOCKOUT 0x0100 /* Lock cua opens on session */
403#define ISDN_ASYNC_PGRP_LOCKOUT 0x0200 /* Lock cua opens on pgrp */
404#define ISDN_ASYNC_CALLOUT_NOHUP 0x0400 /* No hangup for cui */
405#define ISDN_ASYNC_SPLIT_TERMIOS 0x0008 /* Sep. termios for dialin/out */
406#define ISDN_SERIAL_XMIT_SIZE 1024 /* Default bufsize for write */ 396#define ISDN_SERIAL_XMIT_SIZE 1024 /* Default bufsize for write */
407#define ISDN_SERIAL_XMIT_MAX 4000 /* Maximum bufsize for write */ 397#define ISDN_SERIAL_XMIT_MAX 4000 /* Maximum bufsize for write */
408#define ISDN_SERIAL_TYPE_NORMAL 1
409#define ISDN_SERIAL_TYPE_CALLOUT 2
410 398
411#ifdef CONFIG_ISDN_AUDIO 399#ifdef CONFIG_ISDN_AUDIO
412/* For using sk_buffs with audio we need some private variables 400/* For using sk_buffs with audio we need some private variables
@@ -448,17 +436,12 @@ typedef struct atemu {
448/* Private data (similar to async_struct in <linux/serial.h>) */ 436/* Private data (similar to async_struct in <linux/serial.h>) */
449typedef struct modem_info { 437typedef struct modem_info {
450 int magic; 438 int magic;
451 struct module *owner; 439 struct tty_port port;
452 int flags; /* defined in tty.h */
453 int x_char; /* xon/xoff character */ 440 int x_char; /* xon/xoff character */
454 int mcr; /* Modem control register */ 441 int mcr; /* Modem control register */
455 int msr; /* Modem status register */ 442 int msr; /* Modem status register */
456 int lsr; /* Line status register */ 443 int lsr; /* Line status register */
457 int line; 444 int line;
458 int count; /* # of fd on device */
459 int blocked_open; /* # of blocked opens */
460 long session; /* Session of opening process */
461 long pgrp; /* pgrp of opening process */
462 int online; /* 1 = B-Channel is up, drop data */ 445 int online; /* 1 = B-Channel is up, drop data */
463 /* 2 = B-Channel is up, deliver d.*/ 446 /* 2 = B-Channel is up, deliver d.*/
464 int dialing; /* Dial in progress or ATA */ 447 int dialing; /* Dial in progress or ATA */
@@ -478,7 +461,6 @@ typedef struct modem_info {
478 int send_outstanding;/* # of outstanding send-requests */ 461 int send_outstanding;/* # of outstanding send-requests */
479 int xmit_size; /* max. # of chars in xmit_buf */ 462 int xmit_size; /* max. # of chars in xmit_buf */
480 int xmit_count; /* # of chars in xmit_buf */ 463 int xmit_count; /* # of chars in xmit_buf */
481 unsigned char *xmit_buf; /* transmit buffer */
482 struct sk_buff_head xmit_queue; /* transmit queue */ 464 struct sk_buff_head xmit_queue; /* transmit queue */
483 atomic_t xmit_lock; /* Semaphore for isdn_tty_write */ 465 atomic_t xmit_lock; /* Semaphore for isdn_tty_write */
484#ifdef CONFIG_ISDN_AUDIO 466#ifdef CONFIG_ISDN_AUDIO
@@ -496,11 +478,7 @@ typedef struct modem_info {
496 struct T30_s *fax; /* T30 Fax Group 3 data/interface */ 478 struct T30_s *fax; /* T30 Fax Group 3 data/interface */
497 int faxonline; /* Fax-channel status */ 479 int faxonline; /* Fax-channel status */
498#endif 480#endif
499 struct tty_struct *tty; /* Pointer to corresponding tty */
500 atemu emu; /* AT-emulator data */ 481 atemu emu; /* AT-emulator data */
501 struct ktermios normal_termios; /* For saving termios structs */
502 struct ktermios callout_termios;
503 wait_queue_head_t open_wait, close_wait;
504 spinlock_t readlock; 482 spinlock_t readlock;
505} modem_info; 483} modem_info;
506 484
diff --git a/include/linux/jbd.h b/include/linux/jbd.h
index d211732b9e99..c8f32975f0e4 100644
--- a/include/linux/jbd.h
+++ b/include/linux/jbd.h
@@ -479,12 +479,6 @@ struct transaction_s
479 * How many handles used this transaction? [t_handle_lock] 479 * How many handles used this transaction? [t_handle_lock]
480 */ 480 */
481 int t_handle_count; 481 int t_handle_count;
482
483 /*
484 * This transaction is being forced and some process is
485 * waiting for it to finish.
486 */
487 unsigned int t_synchronous_commit:1;
488}; 482};
489 483
490/** 484/**
@@ -531,6 +525,8 @@ struct transaction_s
531 * transaction 525 * transaction
532 * @j_commit_request: Sequence number of the most recent transaction wanting 526 * @j_commit_request: Sequence number of the most recent transaction wanting
533 * commit 527 * commit
528 * @j_commit_waited: Sequence number of the most recent transaction someone
529 * is waiting for to commit.
534 * @j_uuid: Uuid of client object. 530 * @j_uuid: Uuid of client object.
535 * @j_task: Pointer to the current commit thread for this journal 531 * @j_task: Pointer to the current commit thread for this journal
536 * @j_max_transaction_buffers: Maximum number of metadata buffers to allow in a 532 * @j_max_transaction_buffers: Maximum number of metadata buffers to allow in a
@@ -696,6 +692,13 @@ struct journal_s
696 tid_t j_commit_request; 692 tid_t j_commit_request;
697 693
698 /* 694 /*
695 * Sequence number of the most recent transaction someone is waiting
696 * for to commit.
697 * [j_state_lock]
698 */
699 tid_t j_commit_waited;
700
701 /*
699 * Journal uuid: identifies the object (filesystem, LVM volume etc) 702 * Journal uuid: identifies the object (filesystem, LVM volume etc)
700 * backed by this journal. This will eventually be replaced by an array 703 * backed by this journal. This will eventually be replaced by an array
701 * of uuids, allowing us to index multiple devices within a single 704 * of uuids, allowing us to index multiple devices within a single
@@ -861,7 +864,8 @@ extern int journal_destroy (journal_t *);
861extern int journal_recover (journal_t *journal); 864extern int journal_recover (journal_t *journal);
862extern int journal_wipe (journal_t *, int); 865extern int journal_wipe (journal_t *, int);
863extern int journal_skip_recovery (journal_t *); 866extern int journal_skip_recovery (journal_t *);
864extern void journal_update_superblock (journal_t *, int); 867extern void journal_update_sb_log_tail (journal_t *, tid_t, unsigned int,
868 int);
865extern void journal_abort (journal_t *, int); 869extern void journal_abort (journal_t *, int);
866extern int journal_errno (journal_t *); 870extern int journal_errno (journal_t *);
867extern void journal_ack_err (journal_t *); 871extern void journal_ack_err (journal_t *);
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 645231c373c8..ec55a3c8ba77 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -38,6 +38,8 @@
38 38
39#define STACK_MAGIC 0xdeadbeef 39#define STACK_MAGIC 0xdeadbeef
40 40
41#define REPEAT_BYTE(x) ((~0ul / 0xff) * (x))
42
41#define ALIGN(x, a) __ALIGN_KERNEL((x), (a)) 43#define ALIGN(x, a) __ALIGN_KERNEL((x), (a))
42#define __ALIGN_MASK(x, mask) __ALIGN_KERNEL_MASK((x), (mask)) 44#define __ALIGN_MASK(x, mask) __ALIGN_KERNEL_MASK((x), (mask))
43#define PTR_ALIGN(p, a) ((typeof(p))ALIGN((unsigned long)(p), (a))) 45#define PTR_ALIGN(p, a) ((typeof(p))ALIGN((unsigned long)(p), (a)))
@@ -480,15 +482,16 @@ do { \
480 482
481#define trace_printk(fmt, args...) \ 483#define trace_printk(fmt, args...) \
482do { \ 484do { \
485 static const char *trace_printk_fmt \
486 __attribute__((section("__trace_printk_fmt"))) = \
487 __builtin_constant_p(fmt) ? fmt : NULL; \
488 \
483 __trace_printk_check_format(fmt, ##args); \ 489 __trace_printk_check_format(fmt, ##args); \
484 if (__builtin_constant_p(fmt)) { \
485 static const char *trace_printk_fmt \
486 __attribute__((section("__trace_printk_fmt"))) = \
487 __builtin_constant_p(fmt) ? fmt : NULL; \
488 \ 490 \
491 if (__builtin_constant_p(fmt)) \
489 __trace_bprintk(_THIS_IP_, trace_printk_fmt, ##args); \ 492 __trace_bprintk(_THIS_IP_, trace_printk_fmt, ##args); \
490 } else \ 493 else \
491 __trace_printk(_THIS_IP_, fmt, ##args); \ 494 __trace_printk(_THIS_IP_, fmt, ##args); \
492} while (0) 495} while (0)
493 496
494extern __printf(2, 3) 497extern __printf(2, 3)
diff --git a/include/linux/key.h b/include/linux/key.h
index 96933b1e5d24..5231800770e1 100644
--- a/include/linux/key.h
+++ b/include/linux/key.h
@@ -124,7 +124,10 @@ static inline unsigned long is_key_possessed(const key_ref_t key_ref)
124struct key { 124struct key {
125 atomic_t usage; /* number of references */ 125 atomic_t usage; /* number of references */
126 key_serial_t serial; /* key serial number */ 126 key_serial_t serial; /* key serial number */
127 struct rb_node serial_node; 127 union {
128 struct list_head graveyard_link;
129 struct rb_node serial_node;
130 };
128 struct key_type *type; /* type of key */ 131 struct key_type *type; /* type of key */
129 struct rw_semaphore sem; /* change vs change sem */ 132 struct rw_semaphore sem; /* change vs change sem */
130 struct key_user *user; /* owner of this key */ 133 struct key_user *user; /* owner of this key */
@@ -133,6 +136,7 @@ struct key {
133 time_t expiry; /* time at which key expires (or 0) */ 136 time_t expiry; /* time at which key expires (or 0) */
134 time_t revoked_at; /* time at which key was revoked */ 137 time_t revoked_at; /* time at which key was revoked */
135 }; 138 };
139 time_t last_used_at; /* last time used for LRU keyring discard */
136 uid_t uid; 140 uid_t uid;
137 gid_t gid; 141 gid_t gid;
138 key_perm_t perm; /* access permissions */ 142 key_perm_t perm; /* access permissions */
@@ -156,6 +160,7 @@ struct key {
156#define KEY_FLAG_USER_CONSTRUCT 4 /* set if key is being constructed in userspace */ 160#define KEY_FLAG_USER_CONSTRUCT 4 /* set if key is being constructed in userspace */
157#define KEY_FLAG_NEGATIVE 5 /* set if key is negative */ 161#define KEY_FLAG_NEGATIVE 5 /* set if key is negative */
158#define KEY_FLAG_ROOT_CAN_CLEAR 6 /* set if key can be cleared by root without permission */ 162#define KEY_FLAG_ROOT_CAN_CLEAR 6 /* set if key can be cleared by root without permission */
163#define KEY_FLAG_INVALIDATED 7 /* set if key has been invalidated */
159 164
160 /* the description string 165 /* the description string
161 * - this is used to match a key against search criteria 166 * - this is used to match a key against search criteria
@@ -199,6 +204,7 @@ extern struct key *key_alloc(struct key_type *type,
199#define KEY_ALLOC_NOT_IN_QUOTA 0x0002 /* not in quota */ 204#define KEY_ALLOC_NOT_IN_QUOTA 0x0002 /* not in quota */
200 205
201extern void key_revoke(struct key *key); 206extern void key_revoke(struct key *key);
207extern void key_invalidate(struct key *key);
202extern void key_put(struct key *key); 208extern void key_put(struct key *key);
203 209
204static inline struct key *key_get(struct key *key) 210static inline struct key *key_get(struct key *key)
@@ -236,7 +242,7 @@ extern struct key *request_key_async_with_auxdata(struct key_type *type,
236 242
237extern int wait_for_key_construction(struct key *key, bool intr); 243extern int wait_for_key_construction(struct key *key, bool intr);
238 244
239extern int key_validate(struct key *key); 245extern int key_validate(const struct key *key);
240 246
241extern key_ref_t key_create_or_update(key_ref_t keyring, 247extern key_ref_t key_create_or_update(key_ref_t keyring,
242 const char *type, 248 const char *type,
@@ -319,6 +325,7 @@ extern void key_init(void);
319#define key_serial(k) 0 325#define key_serial(k) 0
320#define key_get(k) ({ NULL; }) 326#define key_get(k) ({ NULL; })
321#define key_revoke(k) do { } while(0) 327#define key_revoke(k) do { } while(0)
328#define key_invalidate(k) do { } while(0)
322#define key_put(k) do { } while(0) 329#define key_put(k) do { } while(0)
323#define key_ref_put(k) do { } while(0) 330#define key_ref_put(k) do { } while(0)
324#define make_key_ref(k, p) NULL 331#define make_key_ref(k, p) NULL
diff --git a/include/linux/keyctl.h b/include/linux/keyctl.h
index 9b0b865ce622..c9b7f4faf97a 100644
--- a/include/linux/keyctl.h
+++ b/include/linux/keyctl.h
@@ -55,5 +55,6 @@
55#define KEYCTL_SESSION_TO_PARENT 18 /* apply session keyring to parent process */ 55#define KEYCTL_SESSION_TO_PARENT 18 /* apply session keyring to parent process */
56#define KEYCTL_REJECT 19 /* reject a partially constructed key */ 56#define KEYCTL_REJECT 19 /* reject a partially constructed key */
57#define KEYCTL_INSTANTIATE_IOV 20 /* instantiate a partially constructed key */ 57#define KEYCTL_INSTANTIATE_IOV 20 /* instantiate a partially constructed key */
58#define KEYCTL_INVALIDATE 21 /* invalidate a key */
58 59
59#endif /* _LINUX_KEYCTL_H */ 60#endif /* _LINUX_KEYCTL_H */
diff --git a/include/linux/kvm.h b/include/linux/kvm.h
index 6c322a90b92f..09f2b3aa2da7 100644
--- a/include/linux/kvm.h
+++ b/include/linux/kvm.h
@@ -449,6 +449,30 @@ struct kvm_ppc_pvinfo {
449 __u8 pad[108]; 449 __u8 pad[108];
450}; 450};
451 451
452/* for KVM_PPC_GET_SMMU_INFO */
453#define KVM_PPC_PAGE_SIZES_MAX_SZ 8
454
455struct kvm_ppc_one_page_size {
456 __u32 page_shift; /* Page shift (or 0) */
457 __u32 pte_enc; /* Encoding in the HPTE (>>12) */
458};
459
460struct kvm_ppc_one_seg_page_size {
461 __u32 page_shift; /* Base page shift of segment (or 0) */
462 __u32 slb_enc; /* SLB encoding for BookS */
463 struct kvm_ppc_one_page_size enc[KVM_PPC_PAGE_SIZES_MAX_SZ];
464};
465
466#define KVM_PPC_PAGE_SIZES_REAL 0x00000001
467#define KVM_PPC_1T_SEGMENTS 0x00000002
468
469struct kvm_ppc_smmu_info {
470 __u64 flags;
471 __u32 slb_size;
472 __u32 pad;
473 struct kvm_ppc_one_seg_page_size sps[KVM_PPC_PAGE_SIZES_MAX_SZ];
474};
475
452#define KVMIO 0xAE 476#define KVMIO 0xAE
453 477
454/* machine type bits, to be used as argument to KVM_CREATE_VM */ 478/* machine type bits, to be used as argument to KVM_CREATE_VM */
@@ -589,6 +613,10 @@ struct kvm_ppc_pvinfo {
589#define KVM_CAP_S390_UCONTROL 73 613#define KVM_CAP_S390_UCONTROL 73
590#define KVM_CAP_SYNC_REGS 74 614#define KVM_CAP_SYNC_REGS 74
591#define KVM_CAP_PCI_2_3 75 615#define KVM_CAP_PCI_2_3 75
616#define KVM_CAP_KVMCLOCK_CTRL 76
617#define KVM_CAP_SIGNAL_MSI 77
618#define KVM_CAP_PPC_GET_SMMU_INFO 78
619#define KVM_CAP_S390_COW 79
592 620
593#ifdef KVM_CAP_IRQ_ROUTING 621#ifdef KVM_CAP_IRQ_ROUTING
594 622
@@ -714,6 +742,14 @@ struct kvm_one_reg {
714 __u64 addr; 742 __u64 addr;
715}; 743};
716 744
745struct kvm_msi {
746 __u32 address_lo;
747 __u32 address_hi;
748 __u32 data;
749 __u32 flags;
750 __u8 pad[16];
751};
752
717/* 753/*
718 * ioctls for VM fds 754 * ioctls for VM fds
719 */ 755 */
@@ -788,6 +824,10 @@ struct kvm_s390_ucas_mapping {
788/* Available with KVM_CAP_PCI_2_3 */ 824/* Available with KVM_CAP_PCI_2_3 */
789#define KVM_ASSIGN_SET_INTX_MASK _IOW(KVMIO, 0xa4, \ 825#define KVM_ASSIGN_SET_INTX_MASK _IOW(KVMIO, 0xa4, \
790 struct kvm_assigned_pci_dev) 826 struct kvm_assigned_pci_dev)
827/* Available with KVM_CAP_SIGNAL_MSI */
828#define KVM_SIGNAL_MSI _IOW(KVMIO, 0xa5, struct kvm_msi)
829/* Available with KVM_CAP_PPC_GET_SMMU_INFO */
830#define KVM_PPC_GET_SMMU_INFO _IOR(KVMIO, 0xa6, struct kvm_ppc_smmu_info)
791 831
792/* 832/*
793 * ioctls for vcpu fds 833 * ioctls for vcpu fds
@@ -859,6 +899,8 @@ struct kvm_s390_ucas_mapping {
859/* Available with KVM_CAP_ONE_REG */ 899/* Available with KVM_CAP_ONE_REG */
860#define KVM_GET_ONE_REG _IOW(KVMIO, 0xab, struct kvm_one_reg) 900#define KVM_GET_ONE_REG _IOW(KVMIO, 0xab, struct kvm_one_reg)
861#define KVM_SET_ONE_REG _IOW(KVMIO, 0xac, struct kvm_one_reg) 901#define KVM_SET_ONE_REG _IOW(KVMIO, 0xac, struct kvm_one_reg)
902/* VM is being stopped by host */
903#define KVM_KVMCLOCK_CTRL _IO(KVMIO, 0xad)
862 904
863#define KVM_DEV_ASSIGN_ENABLE_IOMMU (1 << 0) 905#define KVM_DEV_ASSIGN_ENABLE_IOMMU (1 << 0)
864#define KVM_DEV_ASSIGN_PCI_2_3 (1 << 1) 906#define KVM_DEV_ASSIGN_PCI_2_3 (1 << 1)
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index 72cbf08d45fb..c4464356b35b 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -35,6 +35,20 @@
35#endif 35#endif
36 36
37/* 37/*
38 * If we support unaligned MMIO, at most one fragment will be split into two:
39 */
40#ifdef KVM_UNALIGNED_MMIO
41# define KVM_EXTRA_MMIO_FRAGMENTS 1
42#else
43# define KVM_EXTRA_MMIO_FRAGMENTS 0
44#endif
45
46#define KVM_USER_MMIO_SIZE 8
47
48#define KVM_MAX_MMIO_FRAGMENTS \
49 (KVM_MMIO_SIZE / KVM_USER_MMIO_SIZE + KVM_EXTRA_MMIO_FRAGMENTS)
50
51/*
38 * vcpu->requests bit members 52 * vcpu->requests bit members
39 */ 53 */
40#define KVM_REQ_TLB_FLUSH 0 54#define KVM_REQ_TLB_FLUSH 0
@@ -68,10 +82,11 @@ struct kvm_io_range {
68 struct kvm_io_device *dev; 82 struct kvm_io_device *dev;
69}; 83};
70 84
85#define NR_IOBUS_DEVS 1000
86
71struct kvm_io_bus { 87struct kvm_io_bus {
72 int dev_count; 88 int dev_count;
73#define NR_IOBUS_DEVS 300 89 struct kvm_io_range range[];
74 struct kvm_io_range range[NR_IOBUS_DEVS];
75}; 90};
76 91
77enum kvm_bus { 92enum kvm_bus {
@@ -113,7 +128,18 @@ int kvm_async_pf_wakeup_all(struct kvm_vcpu *vcpu);
113enum { 128enum {
114 OUTSIDE_GUEST_MODE, 129 OUTSIDE_GUEST_MODE,
115 IN_GUEST_MODE, 130 IN_GUEST_MODE,
116 EXITING_GUEST_MODE 131 EXITING_GUEST_MODE,
132 READING_SHADOW_PAGE_TABLES,
133};
134
135/*
136 * Sometimes a large or cross-page mmio needs to be broken up into separate
137 * exits for userspace servicing.
138 */
139struct kvm_mmio_fragment {
140 gpa_t gpa;
141 void *data;
142 unsigned len;
117}; 143};
118 144
119struct kvm_vcpu { 145struct kvm_vcpu {
@@ -143,10 +169,9 @@ struct kvm_vcpu {
143 int mmio_needed; 169 int mmio_needed;
144 int mmio_read_completed; 170 int mmio_read_completed;
145 int mmio_is_write; 171 int mmio_is_write;
146 int mmio_size; 172 int mmio_cur_fragment;
147 int mmio_index; 173 int mmio_nr_fragments;
148 unsigned char mmio_data[KVM_MMIO_SIZE]; 174 struct kvm_mmio_fragment mmio_fragments[KVM_MAX_MMIO_FRAGMENTS];
149 gpa_t mmio_phys_addr;
150#endif 175#endif
151 176
152#ifdef CONFIG_KVM_ASYNC_PF 177#ifdef CONFIG_KVM_ASYNC_PF
@@ -178,8 +203,6 @@ struct kvm_memory_slot {
178 unsigned long flags; 203 unsigned long flags;
179 unsigned long *rmap; 204 unsigned long *rmap;
180 unsigned long *dirty_bitmap; 205 unsigned long *dirty_bitmap;
181 unsigned long *dirty_bitmap_head;
182 unsigned long nr_dirty_pages;
183 struct kvm_arch_memory_slot arch; 206 struct kvm_arch_memory_slot arch;
184 unsigned long userspace_addr; 207 unsigned long userspace_addr;
185 int user_alloc; 208 int user_alloc;
@@ -438,6 +461,8 @@ void mark_page_dirty_in_slot(struct kvm *kvm, struct kvm_memory_slot *memslot,
438 gfn_t gfn); 461 gfn_t gfn);
439 462
440void kvm_vcpu_block(struct kvm_vcpu *vcpu); 463void kvm_vcpu_block(struct kvm_vcpu *vcpu);
464void kvm_vcpu_kick(struct kvm_vcpu *vcpu);
465bool kvm_vcpu_yield_to(struct kvm_vcpu *target);
441void kvm_vcpu_on_spin(struct kvm_vcpu *vcpu); 466void kvm_vcpu_on_spin(struct kvm_vcpu *vcpu);
442void kvm_resched(struct kvm_vcpu *vcpu); 467void kvm_resched(struct kvm_vcpu *vcpu);
443void kvm_load_guest_fpu(struct kvm_vcpu *vcpu); 468void kvm_load_guest_fpu(struct kvm_vcpu *vcpu);
@@ -506,6 +531,7 @@ int kvm_arch_hardware_setup(void);
506void kvm_arch_hardware_unsetup(void); 531void kvm_arch_hardware_unsetup(void);
507void kvm_arch_check_processor_compat(void *rtn); 532void kvm_arch_check_processor_compat(void *rtn);
508int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu); 533int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu);
534int kvm_arch_vcpu_should_kick(struct kvm_vcpu *vcpu);
509 535
510void kvm_free_physmem(struct kvm *kvm); 536void kvm_free_physmem(struct kvm *kvm);
511 537
@@ -521,6 +547,15 @@ static inline void kvm_arch_free_vm(struct kvm *kvm)
521} 547}
522#endif 548#endif
523 549
550static inline wait_queue_head_t *kvm_arch_vcpu_wq(struct kvm_vcpu *vcpu)
551{
552#ifdef __KVM_HAVE_ARCH_WQP
553 return vcpu->arch.wqp;
554#else
555 return &vcpu->wq;
556#endif
557}
558
524int kvm_arch_init_vm(struct kvm *kvm, unsigned long type); 559int kvm_arch_init_vm(struct kvm *kvm, unsigned long type);
525void kvm_arch_destroy_vm(struct kvm *kvm); 560void kvm_arch_destroy_vm(struct kvm *kvm);
526void kvm_free_all_assigned_devices(struct kvm *kvm); 561void kvm_free_all_assigned_devices(struct kvm *kvm);
@@ -769,6 +804,8 @@ int kvm_set_irq_routing(struct kvm *kvm,
769 unsigned flags); 804 unsigned flags);
770void kvm_free_irq_routing(struct kvm *kvm); 805void kvm_free_irq_routing(struct kvm *kvm);
771 806
807int kvm_send_userspace_msi(struct kvm *kvm, struct kvm_msi *msi);
808
772#else 809#else
773 810
774static inline void kvm_free_irq_routing(struct kvm *kvm) {} 811static inline void kvm_free_irq_routing(struct kvm *kvm) {}
diff --git a/include/linux/l2tp.h b/include/linux/l2tp.h
index e77d7f9bb246..7eab668f60f3 100644
--- a/include/linux/l2tp.h
+++ b/include/linux/l2tp.h
@@ -11,6 +11,7 @@
11#include <linux/socket.h> 11#include <linux/socket.h>
12#ifdef __KERNEL__ 12#ifdef __KERNEL__
13#include <linux/in.h> 13#include <linux/in.h>
14#include <linux/in6.h>
14#else 15#else
15#include <netinet/in.h> 16#include <netinet/in.h>
16#endif 17#endif
@@ -39,6 +40,22 @@ struct sockaddr_l2tpip {
39 sizeof(__u32)]; 40 sizeof(__u32)];
40}; 41};
41 42
43/**
44 * struct sockaddr_l2tpip6 - the sockaddr structure for L2TP-over-IPv6 sockets
45 * @l2tp_family: address family number AF_L2TPIP.
46 * @l2tp_addr: protocol specific address information
47 * @l2tp_conn_id: connection id of tunnel
48 */
49struct sockaddr_l2tpip6 {
50 /* The first fields must match struct sockaddr_in6 */
51 __kernel_sa_family_t l2tp_family; /* AF_INET6 */
52 __be16 l2tp_unused; /* INET port number (unused) */
53 __be32 l2tp_flowinfo; /* IPv6 flow information */
54 struct in6_addr l2tp_addr; /* IPv6 address */
55 __u32 l2tp_scope_id; /* scope id (new in RFC2553) */
56 __u32 l2tp_conn_id; /* Connection ID of tunnel */
57};
58
42/***************************************************************************** 59/*****************************************************************************
43 * NETLINK_GENERIC netlink family. 60 * NETLINK_GENERIC netlink family.
44 *****************************************************************************/ 61 *****************************************************************************/
@@ -108,6 +125,8 @@ enum {
108 L2TP_ATTR_MTU, /* u16 */ 125 L2TP_ATTR_MTU, /* u16 */
109 L2TP_ATTR_MRU, /* u16 */ 126 L2TP_ATTR_MRU, /* u16 */
110 L2TP_ATTR_STATS, /* nested */ 127 L2TP_ATTR_STATS, /* nested */
128 L2TP_ATTR_IP6_SADDR, /* struct in6_addr */
129 L2TP_ATTR_IP6_DADDR, /* struct in6_addr */
111 __L2TP_ATTR_MAX, 130 __L2TP_ATTR_MAX,
112}; 131};
113 132
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 42378d637ffb..6e887c742a27 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -247,6 +247,7 @@ enum {
247 ATA_HOST_SIMPLEX = (1 << 0), /* Host is simplex, one DMA channel per host only */ 247 ATA_HOST_SIMPLEX = (1 << 0), /* Host is simplex, one DMA channel per host only */
248 ATA_HOST_STARTED = (1 << 1), /* Host started */ 248 ATA_HOST_STARTED = (1 << 1), /* Host started */
249 ATA_HOST_PARALLEL_SCAN = (1 << 2), /* Ports on this host can be scanned in parallel */ 249 ATA_HOST_PARALLEL_SCAN = (1 << 2), /* Ports on this host can be scanned in parallel */
250 ATA_HOST_IGNORE_ATA = (1 << 3), /* Ignore ATA devices on this host. */
250 251
251 /* bits 24:31 of host->flags are reserved for LLD specific flags */ 252 /* bits 24:31 of host->flags are reserved for LLD specific flags */
252 253
@@ -996,7 +997,8 @@ extern int ata_sas_scsi_ioctl(struct ata_port *ap, struct scsi_device *dev,
996extern void ata_sas_port_destroy(struct ata_port *); 997extern void ata_sas_port_destroy(struct ata_port *);
997extern struct ata_port *ata_sas_port_alloc(struct ata_host *, 998extern struct ata_port *ata_sas_port_alloc(struct ata_host *,
998 struct ata_port_info *, struct Scsi_Host *); 999 struct ata_port_info *, struct Scsi_Host *);
999extern int ata_sas_async_port_init(struct ata_port *); 1000extern void ata_sas_async_probe(struct ata_port *ap);
1001extern int ata_sas_sync_probe(struct ata_port *ap);
1000extern int ata_sas_port_init(struct ata_port *); 1002extern int ata_sas_port_init(struct ata_port *);
1001extern int ata_sas_port_start(struct ata_port *ap); 1003extern int ata_sas_port_start(struct ata_port *ap);
1002extern void ata_sas_port_stop(struct ata_port *ap); 1004extern void ata_sas_port_stop(struct ata_port *ap);
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h
index d36619ead3ba..00e46376e28f 100644
--- a/include/linux/lockdep.h
+++ b/include/linux/lockdep.h
@@ -157,6 +157,24 @@ struct lockdep_map {
157#endif 157#endif
158}; 158};
159 159
160static inline void lockdep_copy_map(struct lockdep_map *to,
161 struct lockdep_map *from)
162{
163 int i;
164
165 *to = *from;
166 /*
167 * Since the class cache can be modified concurrently we could observe
168 * half pointers (64bit arch using 32bit copy insns). Therefore clear
169 * the caches and take the performance hit.
170 *
171 * XXX it doesn't work well with lockdep_set_class_and_subclass(), since
172 * that relies on cache abuse.
173 */
174 for (i = 0; i < NR_LOCKDEP_CACHING_CLASSES; i++)
175 to->class_cache[i] = NULL;
176}
177
160/* 178/*
161 * Every lock has a list of other locks that were taken after it. 179 * Every lock has a list of other locks that were taken after it.
162 * We only grow the list, never remove from it: 180 * We only grow the list, never remove from it:
diff --git a/include/linux/lsm_audit.h b/include/linux/lsm_audit.h
index fad48aab893b..1cc89e9df480 100644
--- a/include/linux/lsm_audit.h
+++ b/include/linux/lsm_audit.h
@@ -53,7 +53,6 @@ struct common_audit_data {
53#define LSM_AUDIT_DATA_KMOD 8 53#define LSM_AUDIT_DATA_KMOD 8
54#define LSM_AUDIT_DATA_INODE 9 54#define LSM_AUDIT_DATA_INODE 9
55#define LSM_AUDIT_DATA_DENTRY 10 55#define LSM_AUDIT_DATA_DENTRY 10
56 struct task_struct *tsk;
57 union { 56 union {
58 struct path path; 57 struct path path;
59 struct dentry *dentry; 58 struct dentry *dentry;
@@ -93,11 +92,6 @@ int ipv4_skb_to_auditdata(struct sk_buff *skb,
93int ipv6_skb_to_auditdata(struct sk_buff *skb, 92int ipv6_skb_to_auditdata(struct sk_buff *skb,
94 struct common_audit_data *ad, u8 *proto); 93 struct common_audit_data *ad, u8 *proto);
95 94
96/* Initialize an LSM audit data structure. */
97#define COMMON_AUDIT_DATA_INIT(_d, _t) \
98 { memset((_d), 0, sizeof(struct common_audit_data)); \
99 (_d)->type = LSM_AUDIT_DATA_##_t; }
100
101void common_lsm_audit(struct common_audit_data *a, 95void common_lsm_audit(struct common_audit_data *a,
102 void (*pre_audit)(struct audit_buffer *, void *), 96 void (*pre_audit)(struct audit_buffer *, void *),
103 void (*post_audit)(struct audit_buffer *, void *)); 97 void (*post_audit)(struct audit_buffer *, void *));
diff --git a/include/linux/mISDNhw.h b/include/linux/mISDNhw.h
index 4af841408fb5..d0752eca9b44 100644
--- a/include/linux/mISDNhw.h
+++ b/include/linux/mISDNhw.h
@@ -72,7 +72,9 @@
72#define FLG_LL_OK 24 72#define FLG_LL_OK 24
73#define FLG_LL_CONN 25 73#define FLG_LL_CONN 25
74#define FLG_DTMFSEND 26 74#define FLG_DTMFSEND 26
75 75#define FLG_TX_EMPTY 27
76/* stop sending received data upstream */
77#define FLG_RX_OFF 28
76/* workq events */ 78/* workq events */
77#define FLG_RECVQUEUE 30 79#define FLG_RECVQUEUE 30
78#define FLG_PHCHANGE 31 80#define FLG_PHCHANGE 31
@@ -135,10 +137,14 @@ extern int create_l1(struct dchannel *, dchannel_l1callback *);
135#define HW_TESTRX_RAW 0x9602 137#define HW_TESTRX_RAW 0x9602
136#define HW_TESTRX_HDLC 0x9702 138#define HW_TESTRX_HDLC 0x9702
137#define HW_TESTRX_OFF 0x9802 139#define HW_TESTRX_OFF 0x9802
140#define HW_TIMER3_IND 0x9902
141#define HW_TIMER3_VALUE 0x9a00
142#define HW_TIMER3_VMASK 0x00FF
138 143
139struct layer1; 144struct layer1;
140extern int l1_event(struct layer1 *, u_int); 145extern int l1_event(struct layer1 *, u_int);
141 146
147#define MISDN_BCH_FILL_SIZE 4
142 148
143struct bchannel { 149struct bchannel {
144 struct mISDNchannel ch; 150 struct mISDNchannel ch;
@@ -150,8 +156,14 @@ struct bchannel {
150 int slot; /* multiport card channel slot */ 156 int slot; /* multiport card channel slot */
151 struct timer_list timer; 157 struct timer_list timer;
152 /* receive data */ 158 /* receive data */
159 u8 fill[MISDN_BCH_FILL_SIZE];
153 struct sk_buff *rx_skb; 160 struct sk_buff *rx_skb;
154 int maxlen; 161 unsigned short maxlen;
162 unsigned short init_maxlen; /* initial value */
163 unsigned short next_maxlen; /* pending value */
164 unsigned short minlen; /* for transparent data */
165 unsigned short init_minlen; /* initial value */
166 unsigned short next_minlen; /* pending value */
155 /* send data */ 167 /* send data */
156 struct sk_buff *next_skb; 168 struct sk_buff *next_skb;
157 struct sk_buff *tx_skb; 169 struct sk_buff *tx_skb;
@@ -163,23 +175,26 @@ struct bchannel {
163 int err_crc; 175 int err_crc;
164 int err_tx; 176 int err_tx;
165 int err_rx; 177 int err_rx;
178 int dropcnt;
166}; 179};
167 180
168extern int mISDN_initdchannel(struct dchannel *, int, void *); 181extern int mISDN_initdchannel(struct dchannel *, int, void *);
169extern int mISDN_initbchannel(struct bchannel *, int); 182extern int mISDN_initbchannel(struct bchannel *, unsigned short,
183 unsigned short);
170extern int mISDN_freedchannel(struct dchannel *); 184extern int mISDN_freedchannel(struct dchannel *);
171extern void mISDN_clear_bchannel(struct bchannel *); 185extern void mISDN_clear_bchannel(struct bchannel *);
172extern int mISDN_freebchannel(struct bchannel *); 186extern int mISDN_freebchannel(struct bchannel *);
187extern int mISDN_ctrl_bchannel(struct bchannel *, struct mISDN_ctrl_req *);
173extern void queue_ch_frame(struct mISDNchannel *, u_int, 188extern void queue_ch_frame(struct mISDNchannel *, u_int,
174 int, struct sk_buff *); 189 int, struct sk_buff *);
175extern int dchannel_senddata(struct dchannel *, struct sk_buff *); 190extern int dchannel_senddata(struct dchannel *, struct sk_buff *);
176extern int bchannel_senddata(struct bchannel *, struct sk_buff *); 191extern int bchannel_senddata(struct bchannel *, struct sk_buff *);
192extern int bchannel_get_rxbuf(struct bchannel *, int);
177extern void recv_Dchannel(struct dchannel *); 193extern void recv_Dchannel(struct dchannel *);
178extern void recv_Echannel(struct dchannel *, struct dchannel *); 194extern void recv_Echannel(struct dchannel *, struct dchannel *);
179extern void recv_Bchannel(struct bchannel *, unsigned int id); 195extern void recv_Bchannel(struct bchannel *, unsigned int, bool);
180extern void recv_Dchannel_skb(struct dchannel *, struct sk_buff *); 196extern void recv_Dchannel_skb(struct dchannel *, struct sk_buff *);
181extern void recv_Bchannel_skb(struct bchannel *, struct sk_buff *); 197extern void recv_Bchannel_skb(struct bchannel *, struct sk_buff *);
182extern void confirm_Bsend(struct bchannel *bch);
183extern int get_next_bframe(struct bchannel *); 198extern int get_next_bframe(struct bchannel *);
184extern int get_next_dframe(struct dchannel *); 199extern int get_next_dframe(struct dchannel *);
185 200
diff --git a/include/linux/mISDNif.h b/include/linux/mISDNif.h
index b5e7f2202484..246a3529ecf6 100644
--- a/include/linux/mISDNif.h
+++ b/include/linux/mISDNif.h
@@ -37,7 +37,7 @@
37 */ 37 */
38#define MISDN_MAJOR_VERSION 1 38#define MISDN_MAJOR_VERSION 1
39#define MISDN_MINOR_VERSION 1 39#define MISDN_MINOR_VERSION 1
40#define MISDN_RELEASE 21 40#define MISDN_RELEASE 29
41 41
42/* primitives for information exchange 42/* primitives for information exchange
43 * generell format 43 * generell format
@@ -115,6 +115,11 @@
115#define MDL_ERROR_IND 0x1F04 115#define MDL_ERROR_IND 0x1F04
116#define MDL_ERROR_RSP 0x5F04 116#define MDL_ERROR_RSP 0x5F04
117 117
118/* intern layer 2 */
119#define DL_TIMER200_IND 0x7004
120#define DL_TIMER203_IND 0x7304
121#define DL_INTERN_MSG 0x7804
122
118/* DL_INFORMATION_IND types */ 123/* DL_INFORMATION_IND types */
119#define DL_INFO_L2_CONNECT 0x0001 124#define DL_INFO_L2_CONNECT 0x0001
120#define DL_INFO_L2_REMOVED 0x0002 125#define DL_INFO_L2_REMOVED 0x0002
@@ -360,6 +365,7 @@ clear_channelmap(u_int nr, u_char *map)
360#define MISDN_CTRL_LOOP 0x0001 365#define MISDN_CTRL_LOOP 0x0001
361#define MISDN_CTRL_CONNECT 0x0002 366#define MISDN_CTRL_CONNECT 0x0002
362#define MISDN_CTRL_DISCONNECT 0x0004 367#define MISDN_CTRL_DISCONNECT 0x0004
368#define MISDN_CTRL_RX_BUFFER 0x0008
363#define MISDN_CTRL_PCMCONNECT 0x0010 369#define MISDN_CTRL_PCMCONNECT 0x0010
364#define MISDN_CTRL_PCMDISCONNECT 0x0020 370#define MISDN_CTRL_PCMDISCONNECT 0x0020
365#define MISDN_CTRL_SETPEER 0x0040 371#define MISDN_CTRL_SETPEER 0x0040
@@ -367,6 +373,7 @@ clear_channelmap(u_int nr, u_char *map)
367#define MISDN_CTRL_RX_OFF 0x0100 373#define MISDN_CTRL_RX_OFF 0x0100
368#define MISDN_CTRL_FILL_EMPTY 0x0200 374#define MISDN_CTRL_FILL_EMPTY 0x0200
369#define MISDN_CTRL_GETPEER 0x0400 375#define MISDN_CTRL_GETPEER 0x0400
376#define MISDN_CTRL_L1_TIMER3 0x0800
370#define MISDN_CTRL_HW_FEATURES_OP 0x2000 377#define MISDN_CTRL_HW_FEATURES_OP 0x2000
371#define MISDN_CTRL_HW_FEATURES 0x2001 378#define MISDN_CTRL_HW_FEATURES 0x2001
372#define MISDN_CTRL_HFC_OP 0x4000 379#define MISDN_CTRL_HFC_OP 0x4000
@@ -381,6 +388,12 @@ clear_channelmap(u_int nr, u_char *map)
381#define MISDN_CTRL_HFC_WD_INIT 0x4009 388#define MISDN_CTRL_HFC_WD_INIT 0x4009
382#define MISDN_CTRL_HFC_WD_RESET 0x400A 389#define MISDN_CTRL_HFC_WD_RESET 0x400A
383 390
391/* special RX buffer value for MISDN_CTRL_RX_BUFFER request.p1 is the minimum
392 * buffer size request.p2 the maximum. Using MISDN_CTRL_RX_SIZE_IGNORE will
393 * not change the value, but still read back the actual stetting.
394 */
395#define MISDN_CTRL_RX_SIZE_IGNORE -1
396
384/* socket options */ 397/* socket options */
385#define MISDN_TIME_STAMP 0x0001 398#define MISDN_TIME_STAMP 0x0001
386 399
@@ -585,6 +598,7 @@ static inline struct mISDNdevice *dev_to_mISDN(struct device *dev)
585extern void set_channel_address(struct mISDNchannel *, u_int, u_int); 598extern void set_channel_address(struct mISDNchannel *, u_int, u_int);
586extern void mISDN_clock_update(struct mISDNclock *, int, struct timeval *); 599extern void mISDN_clock_update(struct mISDNclock *, int, struct timeval *);
587extern unsigned short mISDN_clock_get(void); 600extern unsigned short mISDN_clock_get(void);
601extern const char *mISDNDevName4ch(struct mISDNchannel *);
588 602
589#endif /* __KERNEL__ */ 603#endif /* __KERNEL__ */
590#endif /* mISDNIF_H */ 604#endif /* mISDNIF_H */
diff --git a/include/linux/mca-legacy.h b/include/linux/mca-legacy.h
deleted file mode 100644
index 7a3aea845902..000000000000
--- a/include/linux/mca-legacy.h
+++ /dev/null
@@ -1,66 +0,0 @@
1/* -*- mode: c; c-basic-offset: 8 -*- */
2
3/* This is the function prototypes for the old legacy MCA interface
4 *
5 * Please move your driver to the new sysfs based one instead */
6
7#ifndef _LINUX_MCA_LEGACY_H
8#define _LINUX_MCA_LEGACY_H
9
10#include <linux/mca.h>
11
12#warning "MCA legacy - please move your driver to the new sysfs api"
13
14/* MCA_NOTFOUND is an error condition. The other two indicate
15 * motherboard POS registers contain the adapter. They might be
16 * returned by the mca_find_adapter() function, and can be used as
17 * arguments to mca_read_stored_pos(). I'm not going to allow direct
18 * access to the motherboard registers until we run across an adapter
19 * that requires it. We don't know enough about them to know if it's
20 * safe.
21 *
22 * See Documentation/mca.txt or one of the existing drivers for
23 * more information.
24 */
25#define MCA_NOTFOUND (-1)
26
27
28
29/* Returns the slot of the first enabled adapter matching id. User can
30 * specify a starting slot beyond zero, to deal with detecting multiple
31 * devices. Returns MCA_NOTFOUND if id not found. Also checks the
32 * integrated adapters.
33 */
34extern int mca_find_adapter(int id, int start);
35extern int mca_find_unused_adapter(int id, int start);
36
37extern int mca_mark_as_used(int slot);
38extern void mca_mark_as_unused(int slot);
39
40/* gets a byte out of POS register (stored in memory) */
41extern unsigned char mca_read_stored_pos(int slot, int reg);
42
43/* This can be expanded later. Right now, it gives us a way of
44 * getting meaningful information into the MCA_info structure,
45 * so we can have a more interesting /proc/mca.
46 */
47extern void mca_set_adapter_name(int slot, char* name);
48
49/* These routines actually mess with the hardware POS registers. They
50 * temporarily disable the device (and interrupts), so make sure you know
51 * what you're doing if you use them. Furthermore, writing to a POS may
52 * result in two devices trying to share a resource, which in turn can
53 * result in multiple devices sharing memory spaces, IRQs, or even trashing
54 * hardware. YOU HAVE BEEN WARNED.
55 *
56 * You can only access slots with this. Motherboard registers are off
57 * limits.
58 */
59
60/* read a byte from the specified POS register. */
61extern unsigned char mca_read_pos(int slot, int reg);
62
63/* write a byte to the specified POS register. */
64extern void mca_write_pos(int slot, int reg, unsigned char byte);
65
66#endif
diff --git a/include/linux/mca.h b/include/linux/mca.h
deleted file mode 100644
index 37972704617f..000000000000
--- a/include/linux/mca.h
+++ /dev/null
@@ -1,148 +0,0 @@
1/*
2 * Header for Microchannel Architecture Bus
3 * Written by Martin Kolinek, February 1996
4 */
5
6#ifndef _LINUX_MCA_H
7#define _LINUX_MCA_H
8
9#include <linux/device.h>
10
11#ifdef CONFIG_MCA
12#include <asm/mca.h>
13
14extern int MCA_bus;
15#else
16#define MCA_bus 0
17#endif
18
19/* This sets up an information callback for /proc/mca/slot?. The
20 * function is called with the buffer, slot, and device pointer (or
21 * some equally informative context information, or nothing, if you
22 * prefer), and is expected to put useful information into the
23 * buffer. The adapter name, id, and POS registers get printed
24 * before this is called though, so don't do it again.
25 *
26 * This should be called with a NULL procfn when a module
27 * unregisters, thus preventing kernel crashes and other such
28 * nastiness.
29 */
30typedef int (*MCA_ProcFn)(char* buf, int slot, void* dev);
31
32/* Should only be called by the NMI interrupt handler, this will do some
33 * fancy stuff to figure out what might have generated a NMI.
34 */
35extern void mca_handle_nmi(void);
36
37enum MCA_AdapterStatus {
38 MCA_ADAPTER_NORMAL = 0,
39 MCA_ADAPTER_NONE = 1,
40 MCA_ADAPTER_DISABLED = 2,
41 MCA_ADAPTER_ERROR = 3
42};
43
44struct mca_device {
45 u64 dma_mask;
46 int pos_id;
47 int slot;
48
49 /* index into id_table, set by the bus match routine */
50 int index;
51
52 /* is there a driver installed? 0 - No, 1 - Yes */
53 int driver_loaded;
54 /* POS registers */
55 unsigned char pos[8];
56 /* if a pseudo adapter of the motherboard, this is the motherboard
57 * register value to use for setup cycles */
58 short pos_register;
59
60 enum MCA_AdapterStatus status;
61#ifdef CONFIG_MCA_PROC_FS
62 /* name of the proc/mca file */
63 char procname[8];
64 /* /proc info callback */
65 MCA_ProcFn procfn;
66 /* device/context info for proc callback */
67 void *proc_dev;
68#endif
69 struct device dev;
70 char name[32];
71};
72#define to_mca_device(mdev) container_of(mdev, struct mca_device, dev)
73
74struct mca_bus_accessor_functions {
75 unsigned char (*mca_read_pos)(struct mca_device *, int reg);
76 void (*mca_write_pos)(struct mca_device *, int reg,
77 unsigned char byte);
78 int (*mca_transform_irq)(struct mca_device *, int irq);
79 int (*mca_transform_ioport)(struct mca_device *,
80 int region);
81 void * (*mca_transform_memory)(struct mca_device *,
82 void *memory);
83};
84
85struct mca_bus {
86 u64 default_dma_mask;
87 int number;
88 struct mca_bus_accessor_functions f;
89 struct device dev;
90 char name[32];
91};
92#define to_mca_bus(mdev) container_of(mdev, struct mca_bus, dev)
93
94struct mca_driver {
95 const short *id_table;
96 void *driver_data;
97 int integrated_id;
98 struct device_driver driver;
99};
100#define to_mca_driver(mdriver) container_of(mdriver, struct mca_driver, driver)
101
102/* Ongoing supported API functions */
103extern struct mca_device *mca_find_device_by_slot(int slot);
104extern int mca_system_init(void);
105extern struct mca_bus *mca_attach_bus(int);
106
107extern unsigned char mca_device_read_stored_pos(struct mca_device *mca_dev,
108 int reg);
109extern unsigned char mca_device_read_pos(struct mca_device *mca_dev, int reg);
110extern void mca_device_write_pos(struct mca_device *mca_dev, int reg,
111 unsigned char byte);
112extern int mca_device_transform_irq(struct mca_device *mca_dev, int irq);
113extern int mca_device_transform_ioport(struct mca_device *mca_dev, int port);
114extern void *mca_device_transform_memory(struct mca_device *mca_dev,
115 void *mem);
116extern int mca_device_claimed(struct mca_device *mca_dev);
117extern void mca_device_set_claim(struct mca_device *mca_dev, int val);
118extern void mca_device_set_name(struct mca_device *mca_dev, const char *name);
119static inline char *mca_device_get_name(struct mca_device *mca_dev)
120{
121 return mca_dev ? mca_dev->name : NULL;
122}
123
124extern enum MCA_AdapterStatus mca_device_status(struct mca_device *mca_dev);
125
126extern struct bus_type mca_bus_type;
127
128extern int mca_register_driver(struct mca_driver *drv);
129extern int mca_register_driver_integrated(struct mca_driver *, int);
130extern void mca_unregister_driver(struct mca_driver *drv);
131
132/* WARNING: only called by the boot time device setup */
133extern int mca_register_device(int bus, struct mca_device *mca_dev);
134
135#ifdef CONFIG_MCA_PROC_FS
136extern void mca_do_proc_init(void);
137extern void mca_set_adapter_procfn(int slot, MCA_ProcFn, void* dev);
138#else
139static inline void mca_do_proc_init(void)
140{
141}
142
143static inline void mca_set_adapter_procfn(int slot, MCA_ProcFn fn, void* dev)
144{
145}
146#endif
147
148#endif /* _LINUX_MCA_H */
diff --git a/include/linux/mdio-mux.h b/include/linux/mdio-mux.h
new file mode 100644
index 000000000000..a243dbba8659
--- /dev/null
+++ b/include/linux/mdio-mux.h
@@ -0,0 +1,21 @@
1/*
2 * MDIO bus multiplexer framwork.
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2011, 2012 Cavium, Inc.
9 */
10#ifndef __LINUX_MDIO_MUX_H
11#define __LINUX_MDIO_MUX_H
12#include <linux/device.h>
13
14int mdio_mux_init(struct device *dev,
15 int (*switch_fn) (int cur, int desired, void *data),
16 void **mux_handle,
17 void *data);
18
19void mdio_mux_uninit(void *mux_handle);
20
21#endif /* __LINUX_MDIO_MUX_H */
diff --git a/include/linux/mei.h b/include/linux/mei.h
new file mode 100644
index 000000000000..bc0d8b69c49e
--- /dev/null
+++ b/include/linux/mei.h
@@ -0,0 +1,110 @@
1/******************************************************************************
2 * Intel Management Engine Interface (Intel MEI) Linux driver
3 * Intel MEI Interface Header
4 *
5 * This file is provided under a dual BSD/GPLv2 license. When using or
6 * redistributing this file, you may do so under either license.
7 *
8 * GPL LICENSE SUMMARY
9 *
10 * Copyright(c) 2003 - 2012 Intel Corporation. All rights reserved.
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of version 2 of the GNU General Public License as
14 * published by the Free Software Foundation.
15 *
16 * This program is distributed in the hope that it will be useful, but
17 * WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
24 * USA
25 *
26 * The full GNU General Public License is included in this distribution
27 * in the file called LICENSE.GPL.
28 *
29 * Contact Information:
30 * Intel Corporation.
31 * linux-mei@linux.intel.com
32 * http://www.intel.com
33 *
34 * BSD LICENSE
35 *
36 * Copyright(c) 2003 - 2012 Intel Corporation. All rights reserved.
37 * All rights reserved.
38 *
39 * Redistribution and use in source and binary forms, with or without
40 * modification, are permitted provided that the following conditions
41 * are met:
42 *
43 * * Redistributions of source code must retain the above copyright
44 * notice, this list of conditions and the following disclaimer.
45 * * Redistributions in binary form must reproduce the above copyright
46 * notice, this list of conditions and the following disclaimer in
47 * the documentation and/or other materials provided with the
48 * distribution.
49 * * Neither the name Intel Corporation nor the names of its
50 * contributors may be used to endorse or promote products derived
51 * from this software without specific prior written permission.
52 *
53 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
54 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
55 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
56 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
57 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
58 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
59 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
60 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
61 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
62 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
63 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
64 *
65 *****************************************************************************/
66
67#ifndef _LINUX_MEI_H
68#define _LINUX_MEI_H
69
70#include <linux/uuid.h>
71
72/*
73 * This IOCTL is used to associate the current file descriptor with a
74 * FW Client (given by UUID). This opens a communication channel
75 * between a host client and a FW client. From this point every read and write
76 * will communicate with the associated FW client.
77 * Only in close() (file_operation release()) the communication between
78 * the clients is disconnected
79 *
80 * The IOCTL argument is a struct with a union that contains
81 * the input parameter and the output parameter for this IOCTL.
82 *
83 * The input parameter is UUID of the FW Client.
84 * The output parameter is the properties of the FW client
85 * (FW protocol version and max message size).
86 *
87 */
88#define IOCTL_MEI_CONNECT_CLIENT \
89 _IOWR('H' , 0x01, struct mei_connect_client_data)
90
91/*
92 * Intel MEI client information struct
93 */
94struct mei_client {
95 __u32 max_msg_length;
96 __u8 protocol_version;
97 __u8 reserved[3];
98};
99
100/*
101 * IOCTL Connect Client Data structure
102 */
103struct mei_connect_client_data {
104 union {
105 uuid_le in_client_uuid;
106 struct mei_client out_client_properties;
107 };
108};
109
110#endif /* _LINUX_MEI_H */
diff --git a/include/linux/mfd/abx500.h b/include/linux/mfd/abx500.h
index ee96cd51d8b2..1318ca622633 100644
--- a/include/linux/mfd/abx500.h
+++ b/include/linux/mfd/abx500.h
@@ -6,7 +6,7 @@
6 * 6 *
7 * ABX500 core access functions. 7 * ABX500 core access functions.
8 * The abx500 interface is used for the Analog Baseband chip 8 * The abx500 interface is used for the Analog Baseband chip
9 * ab3100, ab5500, and ab8500. 9 * ab3100 and ab8500.
10 * 10 *
11 * Author: Mattias Wallin <mattias.wallin@stericsson.com> 11 * Author: Mattias Wallin <mattias.wallin@stericsson.com>
12 * Author: Mattias Nilsson <mattias.i.nilsson@stericsson.com> 12 * Author: Mattias Nilsson <mattias.i.nilsson@stericsson.com>
@@ -30,9 +30,6 @@ struct device;
30#define AB3100_P1G 0xc6 30#define AB3100_P1G 0xc6
31#define AB3100_R2A 0xc7 31#define AB3100_R2A 0xc7
32#define AB3100_R2B 0xc8 32#define AB3100_R2B 0xc8
33#define AB5500_1_0 0x20
34#define AB5500_1_1 0x21
35#define AB5500_2_0 0x24
36 33
37/* 34/*
38 * AB3100, EVENTA1, A2 and A3 event register flags 35 * AB3100, EVENTA1, A2 and A3 event register flags
diff --git a/include/linux/mfd/abx500/ab5500.h b/include/linux/mfd/abx500/ab5500.h
deleted file mode 100644
index 54f820ed73bb..000000000000
--- a/include/linux/mfd/abx500/ab5500.h
+++ /dev/null
@@ -1,140 +0,0 @@
1/*
2 * Copyright (C) ST-Ericsson 2011
3 *
4 * License Terms: GNU General Public License v2
5 */
6#ifndef MFD_AB5500_H
7#define MFD_AB5500_H
8
9struct device;
10
11enum ab5500_devid {
12 AB5500_DEVID_ADC,
13 AB5500_DEVID_LEDS,
14 AB5500_DEVID_POWER,
15 AB5500_DEVID_REGULATORS,
16 AB5500_DEVID_SIM,
17 AB5500_DEVID_RTC,
18 AB5500_DEVID_CHARGER,
19 AB5500_DEVID_FUELGAUGE,
20 AB5500_DEVID_VIBRATOR,
21 AB5500_DEVID_CODEC,
22 AB5500_DEVID_USB,
23 AB5500_DEVID_OTP,
24 AB5500_DEVID_VIDEO,
25 AB5500_DEVID_DBIECI,
26 AB5500_DEVID_ONSWA,
27 AB5500_NUM_DEVICES,
28};
29
30enum ab5500_banks {
31 AB5500_BANK_VIT_IO_I2C_CLK_TST_OTP = 0,
32 AB5500_BANK_VDDDIG_IO_I2C_CLK_TST = 1,
33 AB5500_BANK_VDENC = 2,
34 AB5500_BANK_SIM_USBSIM = 3,
35 AB5500_BANK_LED = 4,
36 AB5500_BANK_ADC = 5,
37 AB5500_BANK_RTC = 6,
38 AB5500_BANK_STARTUP = 7,
39 AB5500_BANK_DBI_ECI = 8,
40 AB5500_BANK_CHG = 9,
41 AB5500_BANK_FG_BATTCOM_ACC = 10,
42 AB5500_BANK_USB = 11,
43 AB5500_BANK_IT = 12,
44 AB5500_BANK_VIBRA = 13,
45 AB5500_BANK_AUDIO_HEADSETUSB = 14,
46 AB5500_NUM_BANKS = 15,
47};
48
49enum ab5500_banks_addr {
50 AB5500_ADDR_VIT_IO_I2C_CLK_TST_OTP = 0x4A,
51 AB5500_ADDR_VDDDIG_IO_I2C_CLK_TST = 0x4B,
52 AB5500_ADDR_VDENC = 0x06,
53 AB5500_ADDR_SIM_USBSIM = 0x04,
54 AB5500_ADDR_LED = 0x10,
55 AB5500_ADDR_ADC = 0x0A,
56 AB5500_ADDR_RTC = 0x0F,
57 AB5500_ADDR_STARTUP = 0x03,
58 AB5500_ADDR_DBI_ECI = 0x07,
59 AB5500_ADDR_CHG = 0x0B,
60 AB5500_ADDR_FG_BATTCOM_ACC = 0x0C,
61 AB5500_ADDR_USB = 0x05,
62 AB5500_ADDR_IT = 0x0E,
63 AB5500_ADDR_VIBRA = 0x02,
64 AB5500_ADDR_AUDIO_HEADSETUSB = 0x0D,
65};
66
67/*
68 * Interrupt register offsets
69 * Bank : 0x0E
70 */
71#define AB5500_IT_SOURCE0_REG 0x20
72#define AB5500_IT_SOURCE1_REG 0x21
73#define AB5500_IT_SOURCE2_REG 0x22
74#define AB5500_IT_SOURCE3_REG 0x23
75#define AB5500_IT_SOURCE4_REG 0x24
76#define AB5500_IT_SOURCE5_REG 0x25
77#define AB5500_IT_SOURCE6_REG 0x26
78#define AB5500_IT_SOURCE7_REG 0x27
79#define AB5500_IT_SOURCE8_REG 0x28
80#define AB5500_IT_SOURCE9_REG 0x29
81#define AB5500_IT_SOURCE10_REG 0x2A
82#define AB5500_IT_SOURCE11_REG 0x2B
83#define AB5500_IT_SOURCE12_REG 0x2C
84#define AB5500_IT_SOURCE13_REG 0x2D
85#define AB5500_IT_SOURCE14_REG 0x2E
86#define AB5500_IT_SOURCE15_REG 0x2F
87#define AB5500_IT_SOURCE16_REG 0x30
88#define AB5500_IT_SOURCE17_REG 0x31
89#define AB5500_IT_SOURCE18_REG 0x32
90#define AB5500_IT_SOURCE19_REG 0x33
91#define AB5500_IT_SOURCE20_REG 0x34
92#define AB5500_IT_SOURCE21_REG 0x35
93#define AB5500_IT_SOURCE22_REG 0x36
94#define AB5500_IT_SOURCE23_REG 0x37
95
96#define AB5500_NUM_IRQ_REGS 23
97
98/**
99 * struct ab5500
100 * @access_mutex: lock out concurrent accesses to the AB registers
101 * @dev: a pointer to the device struct for this chip driver
102 * @ab5500_irq: the analog baseband irq
103 * @irq_base: the platform configuration irq base for subdevices
104 * @chip_name: name of this chip variant
105 * @chip_id: 8 bit chip ID for this chip variant
106 * @irq_lock: a lock to protect the mask
107 * @abb_events: a local bit mask of the prcmu wakeup events
108 * @event_mask: a local copy of the mask event registers
109 * @last_event_mask: a copy of the last event_mask written to hardware
110 * @startup_events: a copy of the first reading of the event registers
111 * @startup_events_read: whether the first events have been read
112 */
113struct ab5500 {
114 struct mutex access_mutex;
115 struct device *dev;
116 unsigned int ab5500_irq;
117 unsigned int irq_base;
118 char chip_name[32];
119 u8 chip_id;
120 struct mutex irq_lock;
121 u32 abb_events;
122 u8 mask[AB5500_NUM_IRQ_REGS];
123 u8 oldmask[AB5500_NUM_IRQ_REGS];
124 u8 startup_events[AB5500_NUM_IRQ_REGS];
125 bool startup_events_read;
126#ifdef CONFIG_DEBUG_FS
127 unsigned int debug_bank;
128 unsigned int debug_address;
129#endif
130};
131
132struct ab5500_platform_data {
133 struct {unsigned int base; unsigned int count; } irq;
134 void *dev_data[AB5500_NUM_DEVICES];
135 struct abx500_init_settings *init_settings;
136 unsigned int init_settings_sz;
137 bool pm_power_off;
138};
139
140#endif /* MFD_AB5500_H */
diff --git a/include/linux/mfd/asic3.h b/include/linux/mfd/asic3.h
index 3fda7e589ccd..e1148d037e7b 100644
--- a/include/linux/mfd/asic3.h
+++ b/include/linux/mfd/asic3.h
@@ -140,6 +140,7 @@ struct asic3_platform_data {
140#define ASIC3_GPIOC13_nPWAIT ASIC3_CONFIG_GPIO(45, 1, 1, 0) 140#define ASIC3_GPIOC13_nPWAIT ASIC3_CONFIG_GPIO(45, 1, 1, 0)
141#define ASIC3_GPIOC14_nPIOIS16 ASIC3_CONFIG_GPIO(46, 1, 1, 0) 141#define ASIC3_GPIOC14_nPIOIS16 ASIC3_CONFIG_GPIO(46, 1, 1, 0)
142#define ASIC3_GPIOC15_nPIOR ASIC3_CONFIG_GPIO(47, 1, 0, 0) 142#define ASIC3_GPIOC15_nPIOR ASIC3_CONFIG_GPIO(47, 1, 0, 0)
143#define ASIC3_GPIOD4_CF_nCD ASIC3_CONFIG_GPIO(52, 1, 0, 0)
143#define ASIC3_GPIOD11_nCIOIS16 ASIC3_CONFIG_GPIO(59, 1, 0, 0) 144#define ASIC3_GPIOD11_nCIOIS16 ASIC3_CONFIG_GPIO(59, 1, 0, 0)
144#define ASIC3_GPIOD12_nCWAIT ASIC3_CONFIG_GPIO(60, 1, 0, 0) 145#define ASIC3_GPIOD12_nCWAIT ASIC3_CONFIG_GPIO(60, 1, 0, 0)
145#define ASIC3_GPIOD15_nPIOW ASIC3_CONFIG_GPIO(63, 1, 0, 0) 146#define ASIC3_GPIOD15_nPIOW ASIC3_CONFIG_GPIO(63, 1, 0, 0)
diff --git a/include/linux/mfd/da9052/da9052.h b/include/linux/mfd/da9052/da9052.h
index b990cca1d9ee..0507c4c21a7d 100644
--- a/include/linux/mfd/da9052/da9052.h
+++ b/include/linux/mfd/da9052/da9052.h
@@ -95,6 +95,7 @@ struct da9052 {
95 struct completion done; 95 struct completion done;
96 96
97 int irq_base; 97 int irq_base;
98 struct regmap_irq_chip_data *irq_data;
98 u8 chip_id; 99 u8 chip_id;
99 100
100 int chip_irq; 101 int chip_irq;
diff --git a/include/linux/mfd/db5500-prcmu.h b/include/linux/mfd/db5500-prcmu.h
deleted file mode 100644
index 5a049dfaf153..000000000000
--- a/include/linux/mfd/db5500-prcmu.h
+++ /dev/null
@@ -1,105 +0,0 @@
1/*
2 * Copyright (C) ST-Ericsson SA 2010
3 *
4 * License Terms: GNU General Public License v2
5 *
6 * U5500 PRCMU API.
7 */
8#ifndef __MFD_DB5500_PRCMU_H
9#define __MFD_DB5500_PRCMU_H
10
11static inline int prcmu_resetout(u8 resoutn, u8 state)
12{
13 return 0;
14}
15
16static inline int db5500_prcmu_set_epod(u16 epod_id, u8 epod_state)
17{
18 return 0;
19}
20
21static inline int db5500_prcmu_request_clock(u8 clock, bool enable)
22{
23 return 0;
24}
25
26static inline int db5500_prcmu_set_power_state(u8 state, bool keep_ulp_clk,
27 bool keep_ap_pll)
28{
29 return 0;
30}
31
32static inline int db5500_prcmu_config_esram0_deep_sleep(u8 state)
33{
34 return 0;
35}
36
37static inline u16 db5500_prcmu_get_reset_code(void)
38{
39 return 0;
40}
41
42static inline bool db5500_prcmu_is_ac_wake_requested(void)
43{
44 return 0;
45}
46
47static inline int db5500_prcmu_set_arm_opp(u8 opp)
48{
49 return 0;
50}
51
52static inline int db5500_prcmu_get_arm_opp(void)
53{
54 return 0;
55}
56
57static inline void db5500_prcmu_config_abb_event_readout(u32 abb_events) {}
58
59static inline void db5500_prcmu_get_abb_event_buffer(void __iomem **buf) {}
60
61static inline void db5500_prcmu_system_reset(u16 reset_code) {}
62
63static inline void db5500_prcmu_enable_wakeups(u32 wakeups) {}
64
65#ifdef CONFIG_MFD_DB5500_PRCMU
66
67void db5500_prcmu_early_init(void);
68int db5500_prcmu_set_display_clocks(void);
69int db5500_prcmu_disable_dsipll(void);
70int db5500_prcmu_enable_dsipll(void);
71int db5500_prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size);
72int db5500_prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size);
73
74#else /* !CONFIG_UX500_SOC_DB5500 */
75
76static inline void db5500_prcmu_early_init(void) {}
77
78static inline int db5500_prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size)
79{
80 return -ENOSYS;
81}
82
83static inline int db5500_prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size)
84{
85 return -ENOSYS;
86}
87
88static inline int db5500_prcmu_set_display_clocks(void)
89{
90 return 0;
91}
92
93static inline int db5500_prcmu_disable_dsipll(void)
94{
95 return 0;
96}
97
98static inline int db5500_prcmu_enable_dsipll(void)
99{
100 return 0;
101}
102
103#endif /* CONFIG_MFD_DB5500_PRCMU */
104
105#endif /* __MFD_DB5500_PRCMU_H */
diff --git a/include/linux/mfd/dbx500-prcmu.h b/include/linux/mfd/dbx500-prcmu.h
index d7674eb7305f..5a13f93d8f1c 100644
--- a/include/linux/mfd/dbx500-prcmu.h
+++ b/include/linux/mfd/dbx500-prcmu.h
@@ -55,17 +55,6 @@ enum prcmu_wakeup_index {
55#define NUM_EPOD_ID 8 55#define NUM_EPOD_ID 8
56 56
57/* 57/*
58 * DB5500 EPODs
59 */
60#define DB5500_EPOD_ID_BASE 0x0100
61#define DB5500_EPOD_ID_SGA (DB5500_EPOD_ID_BASE + 0)
62#define DB5500_EPOD_ID_HVA (DB5500_EPOD_ID_BASE + 1)
63#define DB5500_EPOD_ID_SIA (DB5500_EPOD_ID_BASE + 2)
64#define DB5500_EPOD_ID_DISP (DB5500_EPOD_ID_BASE + 3)
65#define DB5500_EPOD_ID_ESRAM12 (DB5500_EPOD_ID_BASE + 6)
66#define DB5500_NUM_EPOD_ID 7
67
68/*
69 * state definition for EPOD (power domain) 58 * state definition for EPOD (power domain)
70 * - EPOD_STATE_NO_CHANGE: The EPOD should remain unchanged 59 * - EPOD_STATE_NO_CHANGE: The EPOD should remain unchanged
71 * - EPOD_STATE_OFF: The EPOD is switched off 60 * - EPOD_STATE_OFF: The EPOD is switched off
@@ -80,29 +69,6 @@ enum prcmu_wakeup_index {
80#define EPOD_STATE_ON_CLK_OFF 0x03 69#define EPOD_STATE_ON_CLK_OFF 0x03
81#define EPOD_STATE_ON 0x04 70#define EPOD_STATE_ON 0x04
82 71
83/* DB5500 CLKOUT IDs */
84enum {
85 DB5500_CLKOUT0 = 0,
86 DB5500_CLKOUT1,
87};
88
89/* DB5500 CLKOUTx sources */
90enum {
91 DB5500_CLKOUT_REF_CLK_SEL0,
92 DB5500_CLKOUT_RTC_CLK0_SEL0,
93 DB5500_CLKOUT_ULP_CLK_SEL0,
94 DB5500_CLKOUT_STATIC0,
95 DB5500_CLKOUT_REFCLK,
96 DB5500_CLKOUT_ULPCLK,
97 DB5500_CLKOUT_ARMCLK,
98 DB5500_CLKOUT_SYSACC0CLK,
99 DB5500_CLKOUT_SOC0PLLCLK,
100 DB5500_CLKOUT_SOC1PLLCLK,
101 DB5500_CLKOUT_DDRPLLCLK,
102 DB5500_CLKOUT_TVCLK,
103 DB5500_CLKOUT_IRDACLK,
104};
105
106/* 72/*
107 * CLKOUT sources 73 * CLKOUT sources
108 */ 74 */
@@ -248,101 +214,66 @@ enum ddr_pwrst {
248}; 214};
249 215
250#include <linux/mfd/db8500-prcmu.h> 216#include <linux/mfd/db8500-prcmu.h>
251#include <linux/mfd/db5500-prcmu.h>
252 217
253#if defined(CONFIG_UX500_SOC_DB8500) || defined(CONFIG_UX500_SOC_DB5500) 218#if defined(CONFIG_UX500_SOC_DB8500)
254 219
255#include <mach/id.h> 220#include <mach/id.h>
256 221
257static inline void __init prcmu_early_init(void) 222static inline void __init prcmu_early_init(void)
258{ 223{
259 if (cpu_is_u5500()) 224 return db8500_prcmu_early_init();
260 return db5500_prcmu_early_init();
261 else
262 return db8500_prcmu_early_init();
263} 225}
264 226
265static inline int prcmu_set_power_state(u8 state, bool keep_ulp_clk, 227static inline int prcmu_set_power_state(u8 state, bool keep_ulp_clk,
266 bool keep_ap_pll) 228 bool keep_ap_pll)
267{ 229{
268 if (cpu_is_u5500()) 230 return db8500_prcmu_set_power_state(state, keep_ulp_clk,
269 return db5500_prcmu_set_power_state(state, keep_ulp_clk, 231 keep_ap_pll);
270 keep_ap_pll);
271 else
272 return db8500_prcmu_set_power_state(state, keep_ulp_clk,
273 keep_ap_pll);
274} 232}
275 233
276static inline u8 prcmu_get_power_state_result(void) 234static inline u8 prcmu_get_power_state_result(void)
277{ 235{
278 if (cpu_is_u5500()) 236 return db8500_prcmu_get_power_state_result();
279 return -EINVAL;
280 else
281 return db8500_prcmu_get_power_state_result();
282} 237}
283 238
284static inline int prcmu_gic_decouple(void) 239static inline int prcmu_gic_decouple(void)
285{ 240{
286 if (cpu_is_u5500()) 241 return db8500_prcmu_gic_decouple();
287 return -EINVAL;
288 else
289 return db8500_prcmu_gic_decouple();
290} 242}
291 243
292static inline int prcmu_gic_recouple(void) 244static inline int prcmu_gic_recouple(void)
293{ 245{
294 if (cpu_is_u5500()) 246 return db8500_prcmu_gic_recouple();
295 return -EINVAL;
296 else
297 return db8500_prcmu_gic_recouple();
298} 247}
299 248
300static inline bool prcmu_gic_pending_irq(void) 249static inline bool prcmu_gic_pending_irq(void)
301{ 250{
302 if (cpu_is_u5500()) 251 return db8500_prcmu_gic_pending_irq();
303 return -EINVAL;
304 else
305 return db8500_prcmu_gic_pending_irq();
306} 252}
307 253
308static inline bool prcmu_is_cpu_in_wfi(int cpu) 254static inline bool prcmu_is_cpu_in_wfi(int cpu)
309{ 255{
310 if (cpu_is_u5500()) 256 return db8500_prcmu_is_cpu_in_wfi(cpu);
311 return -EINVAL;
312 else
313 return db8500_prcmu_is_cpu_in_wfi(cpu);
314} 257}
315 258
316static inline int prcmu_copy_gic_settings(void) 259static inline int prcmu_copy_gic_settings(void)
317{ 260{
318 if (cpu_is_u5500()) 261 return db8500_prcmu_copy_gic_settings();
319 return -EINVAL;
320 else
321 return db8500_prcmu_copy_gic_settings();
322} 262}
323 263
324static inline bool prcmu_pending_irq(void) 264static inline bool prcmu_pending_irq(void)
325{ 265{
326 if (cpu_is_u5500()) 266 return db8500_prcmu_pending_irq();
327 return -EINVAL;
328 else
329 return db8500_prcmu_pending_irq();
330} 267}
331 268
332static inline int prcmu_set_epod(u16 epod_id, u8 epod_state) 269static inline int prcmu_set_epod(u16 epod_id, u8 epod_state)
333{ 270{
334 if (cpu_is_u5500()) 271 return db8500_prcmu_set_epod(epod_id, epod_state);
335 return -EINVAL;
336 else
337 return db8500_prcmu_set_epod(epod_id, epod_state);
338} 272}
339 273
340static inline void prcmu_enable_wakeups(u32 wakeups) 274static inline void prcmu_enable_wakeups(u32 wakeups)
341{ 275{
342 if (cpu_is_u5500()) 276 db8500_prcmu_enable_wakeups(wakeups);
343 db5500_prcmu_enable_wakeups(wakeups);
344 else
345 db8500_prcmu_enable_wakeups(wakeups);
346} 277}
347 278
348static inline void prcmu_disable_wakeups(void) 279static inline void prcmu_disable_wakeups(void)
@@ -352,18 +283,12 @@ static inline void prcmu_disable_wakeups(void)
352 283
353static inline void prcmu_config_abb_event_readout(u32 abb_events) 284static inline void prcmu_config_abb_event_readout(u32 abb_events)
354{ 285{
355 if (cpu_is_u5500()) 286 db8500_prcmu_config_abb_event_readout(abb_events);
356 db5500_prcmu_config_abb_event_readout(abb_events);
357 else
358 db8500_prcmu_config_abb_event_readout(abb_events);
359} 287}
360 288
361static inline void prcmu_get_abb_event_buffer(void __iomem **buf) 289static inline void prcmu_get_abb_event_buffer(void __iomem **buf)
362{ 290{
363 if (cpu_is_u5500()) 291 db8500_prcmu_get_abb_event_buffer(buf);
364 db5500_prcmu_get_abb_event_buffer(buf);
365 else
366 db8500_prcmu_get_abb_event_buffer(buf);
367} 292}
368 293
369int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size); 294int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size);
@@ -374,10 +299,7 @@ int prcmu_config_clkout(u8 clkout, u8 source, u8 div);
374 299
375static inline int prcmu_request_clock(u8 clock, bool enable) 300static inline int prcmu_request_clock(u8 clock, bool enable)
376{ 301{
377 if (cpu_is_u5500()) 302 return db8500_prcmu_request_clock(clock, enable);
378 return db5500_prcmu_request_clock(clock, enable);
379 else
380 return db8500_prcmu_request_clock(clock, enable);
381} 303}
382 304
383unsigned long prcmu_clock_rate(u8 clock); 305unsigned long prcmu_clock_rate(u8 clock);
@@ -386,211 +308,133 @@ int prcmu_set_clock_rate(u8 clock, unsigned long rate);
386 308
387static inline int prcmu_set_ddr_opp(u8 opp) 309static inline int prcmu_set_ddr_opp(u8 opp)
388{ 310{
389 if (cpu_is_u5500()) 311 return db8500_prcmu_set_ddr_opp(opp);
390 return -EINVAL;
391 else
392 return db8500_prcmu_set_ddr_opp(opp);
393} 312}
394static inline int prcmu_get_ddr_opp(void) 313static inline int prcmu_get_ddr_opp(void)
395{ 314{
396 if (cpu_is_u5500()) 315 return db8500_prcmu_get_ddr_opp();
397 return -EINVAL;
398 else
399 return db8500_prcmu_get_ddr_opp();
400} 316}
401 317
402static inline int prcmu_set_arm_opp(u8 opp) 318static inline int prcmu_set_arm_opp(u8 opp)
403{ 319{
404 if (cpu_is_u5500()) 320 return db8500_prcmu_set_arm_opp(opp);
405 return -EINVAL;
406 else
407 return db8500_prcmu_set_arm_opp(opp);
408} 321}
409 322
410static inline int prcmu_get_arm_opp(void) 323static inline int prcmu_get_arm_opp(void)
411{ 324{
412 if (cpu_is_u5500()) 325 return db8500_prcmu_get_arm_opp();
413 return -EINVAL;
414 else
415 return db8500_prcmu_get_arm_opp();
416} 326}
417 327
418static inline int prcmu_set_ape_opp(u8 opp) 328static inline int prcmu_set_ape_opp(u8 opp)
419{ 329{
420 if (cpu_is_u5500()) 330 return db8500_prcmu_set_ape_opp(opp);
421 return -EINVAL;
422 else
423 return db8500_prcmu_set_ape_opp(opp);
424} 331}
425 332
426static inline int prcmu_get_ape_opp(void) 333static inline int prcmu_get_ape_opp(void)
427{ 334{
428 if (cpu_is_u5500()) 335 return db8500_prcmu_get_ape_opp();
429 return -EINVAL;
430 else
431 return db8500_prcmu_get_ape_opp();
432} 336}
433 337
434static inline void prcmu_system_reset(u16 reset_code) 338static inline void prcmu_system_reset(u16 reset_code)
435{ 339{
436 if (cpu_is_u5500()) 340 return db8500_prcmu_system_reset(reset_code);
437 return db5500_prcmu_system_reset(reset_code);
438 else
439 return db8500_prcmu_system_reset(reset_code);
440} 341}
441 342
442static inline u16 prcmu_get_reset_code(void) 343static inline u16 prcmu_get_reset_code(void)
443{ 344{
444 if (cpu_is_u5500()) 345 return db8500_prcmu_get_reset_code();
445 return db5500_prcmu_get_reset_code();
446 else
447 return db8500_prcmu_get_reset_code();
448} 346}
449 347
450void prcmu_ac_wake_req(void); 348void prcmu_ac_wake_req(void);
451void prcmu_ac_sleep_req(void); 349void prcmu_ac_sleep_req(void);
452static inline void prcmu_modem_reset(void) 350static inline void prcmu_modem_reset(void)
453{ 351{
454 if (cpu_is_u5500()) 352 return db8500_prcmu_modem_reset();
455 return;
456 else
457 return db8500_prcmu_modem_reset();
458} 353}
459 354
460static inline bool prcmu_is_ac_wake_requested(void) 355static inline bool prcmu_is_ac_wake_requested(void)
461{ 356{
462 if (cpu_is_u5500()) 357 return db8500_prcmu_is_ac_wake_requested();
463 return db5500_prcmu_is_ac_wake_requested();
464 else
465 return db8500_prcmu_is_ac_wake_requested();
466} 358}
467 359
468static inline int prcmu_set_display_clocks(void) 360static inline int prcmu_set_display_clocks(void)
469{ 361{
470 if (cpu_is_u5500()) 362 return db8500_prcmu_set_display_clocks();
471 return db5500_prcmu_set_display_clocks();
472 else
473 return db8500_prcmu_set_display_clocks();
474} 363}
475 364
476static inline int prcmu_disable_dsipll(void) 365static inline int prcmu_disable_dsipll(void)
477{ 366{
478 if (cpu_is_u5500()) 367 return db8500_prcmu_disable_dsipll();
479 return db5500_prcmu_disable_dsipll();
480 else
481 return db8500_prcmu_disable_dsipll();
482} 368}
483 369
484static inline int prcmu_enable_dsipll(void) 370static inline int prcmu_enable_dsipll(void)
485{ 371{
486 if (cpu_is_u5500()) 372 return db8500_prcmu_enable_dsipll();
487 return db5500_prcmu_enable_dsipll();
488 else
489 return db8500_prcmu_enable_dsipll();
490} 373}
491 374
492static inline int prcmu_config_esram0_deep_sleep(u8 state) 375static inline int prcmu_config_esram0_deep_sleep(u8 state)
493{ 376{
494 if (cpu_is_u5500()) 377 return db8500_prcmu_config_esram0_deep_sleep(state);
495 return -EINVAL;
496 else
497 return db8500_prcmu_config_esram0_deep_sleep(state);
498} 378}
499 379
500static inline int prcmu_config_hotdog(u8 threshold) 380static inline int prcmu_config_hotdog(u8 threshold)
501{ 381{
502 if (cpu_is_u5500()) 382 return db8500_prcmu_config_hotdog(threshold);
503 return -EINVAL;
504 else
505 return db8500_prcmu_config_hotdog(threshold);
506} 383}
507 384
508static inline int prcmu_config_hotmon(u8 low, u8 high) 385static inline int prcmu_config_hotmon(u8 low, u8 high)
509{ 386{
510 if (cpu_is_u5500()) 387 return db8500_prcmu_config_hotmon(low, high);
511 return -EINVAL;
512 else
513 return db8500_prcmu_config_hotmon(low, high);
514} 388}
515 389
516static inline int prcmu_start_temp_sense(u16 cycles32k) 390static inline int prcmu_start_temp_sense(u16 cycles32k)
517{ 391{
518 if (cpu_is_u5500()) 392 return db8500_prcmu_start_temp_sense(cycles32k);
519 return -EINVAL;
520 else
521 return db8500_prcmu_start_temp_sense(cycles32k);
522} 393}
523 394
524static inline int prcmu_stop_temp_sense(void) 395static inline int prcmu_stop_temp_sense(void)
525{ 396{
526 if (cpu_is_u5500()) 397 return db8500_prcmu_stop_temp_sense();
527 return -EINVAL;
528 else
529 return db8500_prcmu_stop_temp_sense();
530} 398}
531 399
532static inline u32 prcmu_read(unsigned int reg) 400static inline u32 prcmu_read(unsigned int reg)
533{ 401{
534 if (cpu_is_u5500()) 402 return db8500_prcmu_read(reg);
535 return -EINVAL;
536 else
537 return db8500_prcmu_read(reg);
538} 403}
539 404
540static inline void prcmu_write(unsigned int reg, u32 value) 405static inline void prcmu_write(unsigned int reg, u32 value)
541{ 406{
542 if (cpu_is_u5500()) 407 db8500_prcmu_write(reg, value);
543 return;
544 else
545 db8500_prcmu_write(reg, value);
546} 408}
547 409
548static inline void prcmu_write_masked(unsigned int reg, u32 mask, u32 value) 410static inline void prcmu_write_masked(unsigned int reg, u32 mask, u32 value)
549{ 411{
550 if (cpu_is_u5500()) 412 db8500_prcmu_write_masked(reg, mask, value);
551 return;
552 else
553 db8500_prcmu_write_masked(reg, mask, value);
554} 413}
555 414
556static inline int prcmu_enable_a9wdog(u8 id) 415static inline int prcmu_enable_a9wdog(u8 id)
557{ 416{
558 if (cpu_is_u5500()) 417 return db8500_prcmu_enable_a9wdog(id);
559 return -EINVAL;
560 else
561 return db8500_prcmu_enable_a9wdog(id);
562} 418}
563 419
564static inline int prcmu_disable_a9wdog(u8 id) 420static inline int prcmu_disable_a9wdog(u8 id)
565{ 421{
566 if (cpu_is_u5500()) 422 return db8500_prcmu_disable_a9wdog(id);
567 return -EINVAL;
568 else
569 return db8500_prcmu_disable_a9wdog(id);
570} 423}
571 424
572static inline int prcmu_kick_a9wdog(u8 id) 425static inline int prcmu_kick_a9wdog(u8 id)
573{ 426{
574 if (cpu_is_u5500()) 427 return db8500_prcmu_kick_a9wdog(id);
575 return -EINVAL;
576 else
577 return db8500_prcmu_kick_a9wdog(id);
578} 428}
579 429
580static inline int prcmu_load_a9wdog(u8 id, u32 timeout) 430static inline int prcmu_load_a9wdog(u8 id, u32 timeout)
581{ 431{
582 if (cpu_is_u5500()) 432 return db8500_prcmu_load_a9wdog(id, timeout);
583 return -EINVAL;
584 else
585 return db8500_prcmu_load_a9wdog(id, timeout);
586} 433}
587 434
588static inline int prcmu_config_a9wdog(u8 num, bool sleep_auto_off) 435static inline int prcmu_config_a9wdog(u8 num, bool sleep_auto_off)
589{ 436{
590 if (cpu_is_u5500()) 437 return db8500_prcmu_config_a9wdog(num, sleep_auto_off);
591 return -EINVAL;
592 else
593 return db8500_prcmu_config_a9wdog(num, sleep_auto_off);
594} 438}
595#else 439#else
596 440
@@ -768,7 +612,7 @@ static inline void prcmu_clear(unsigned int reg, u32 bits)
768 prcmu_write_masked(reg, bits, 0); 612 prcmu_write_masked(reg, bits, 0);
769} 613}
770 614
771#if defined(CONFIG_UX500_SOC_DB8500) || defined(CONFIG_UX500_SOC_DB5500) 615#if defined(CONFIG_UX500_SOC_DB8500)
772 616
773/** 617/**
774 * prcmu_enable_spi2 - Enables pin muxing for SPI2 on OtherAlternateC1. 618 * prcmu_enable_spi2 - Enables pin muxing for SPI2 on OtherAlternateC1.
diff --git a/include/linux/mfd/max8997.h b/include/linux/mfd/max8997.h
index 28726dd540f2..b40c08cd30bc 100644
--- a/include/linux/mfd/max8997.h
+++ b/include/linux/mfd/max8997.h
@@ -99,34 +99,11 @@ struct max8997_muic_reg_data {
99 99
100/** 100/**
101 * struct max8997_muic_platform_data 101 * struct max8997_muic_platform_data
102 * @usb_callback: callback function for USB
103 * inform callee of USB type (HOST or DEVICE)
104 * and attached state(true or false)
105 * @charger_callback: callback function for charger
106 * inform callee of charger_type
107 * and attached state(true or false)
108 * @deskdock_callback: callback function for desk dock
109 * inform callee of attached state(true or false)
110 * @cardock_callback: callback function for car dock
111 * inform callee of attached state(true or false)
112 * @mhl_callback: callback function for MHL (Mobile High-definition Link)
113 * inform callee of attached state(true or false)
114 * @uart_callback: callback function for JIG UART
115 * inform callee of attached state(true or false)
116 * @init_data: array of max8997_muic_reg_data 102 * @init_data: array of max8997_muic_reg_data
117 * used for initializing registers of MAX8997 MUIC device 103 * used for initializing registers of MAX8997 MUIC device
118 * @num_init_data: array size of init_data 104 * @num_init_data: array size of init_data
119 */ 105 */
120struct max8997_muic_platform_data { 106struct max8997_muic_platform_data {
121 void (*usb_callback)(enum max8997_muic_usb_type usb_type,
122 bool attached);
123 void (*charger_callback)(bool attached,
124 enum max8997_muic_charger_type charger_type);
125 void (*deskdock_callback) (bool attached);
126 void (*cardock_callback) (bool attached);
127 void (*mhl_callback) (bool attached);
128 void (*uart_callback) (bool attached);
129
130 struct max8997_muic_reg_data *init_data; 107 struct max8997_muic_reg_data *init_data;
131 int num_init_data; 108 int num_init_data;
132}; 109};
diff --git a/include/linux/mfd/mc13xxx.h b/include/linux/mfd/mc13xxx.h
index 10e038bac8dd..bf070755982e 100644
--- a/include/linux/mfd/mc13xxx.h
+++ b/include/linux/mfd/mc13xxx.h
@@ -170,6 +170,16 @@ struct mc13xxx_ts_platform_data {
170 bool atox; 170 bool atox;
171}; 171};
172 172
173enum mc13783_ssi_port {
174 MC13783_SSI1_PORT,
175 MC13783_SSI2_PORT,
176};
177
178struct mc13xxx_codec_platform_data {
179 enum mc13783_ssi_port adc_ssi_port;
180 enum mc13783_ssi_port dac_ssi_port;
181};
182
173struct mc13xxx_platform_data { 183struct mc13xxx_platform_data {
174#define MC13XXX_USE_TOUCHSCREEN (1 << 0) 184#define MC13XXX_USE_TOUCHSCREEN (1 << 0)
175#define MC13XXX_USE_CODEC (1 << 1) 185#define MC13XXX_USE_CODEC (1 << 1)
@@ -181,6 +191,7 @@ struct mc13xxx_platform_data {
181 struct mc13xxx_leds_platform_data *leds; 191 struct mc13xxx_leds_platform_data *leds;
182 struct mc13xxx_buttons_platform_data *buttons; 192 struct mc13xxx_buttons_platform_data *buttons;
183 struct mc13xxx_ts_platform_data touch; 193 struct mc13xxx_ts_platform_data touch;
194 struct mc13xxx_codec_platform_data *codec;
184}; 195};
185 196
186#define MC13XXX_ADC_MODE_TS 1 197#define MC13XXX_ADC_MODE_TS 1
diff --git a/include/linux/mfd/palmas.h b/include/linux/mfd/palmas.h
new file mode 100644
index 000000000000..9cbc642d40ad
--- /dev/null
+++ b/include/linux/mfd/palmas.h
@@ -0,0 +1,2620 @@
1/*
2 * TI Palmas
3 *
4 * Copyright 2011 Texas Instruments Inc.
5 *
6 * Author: Graeme Gregory <gg@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_PALMAS_H
16#define __LINUX_MFD_PALMAS_H
17
18#include <linux/usb/otg.h>
19#include <linux/leds.h>
20#include <linux/regmap.h>
21#include <linux/regulator/driver.h>
22
23#define PALMAS_NUM_CLIENTS 3
24
25struct palmas_pmic;
26
27struct palmas {
28 struct device *dev;
29
30 struct i2c_client *i2c_clients[PALMAS_NUM_CLIENTS];
31 struct regmap *regmap[PALMAS_NUM_CLIENTS];
32
33 /* Stored chip id */
34 int id;
35
36 /* IRQ Data */
37 int irq;
38 u32 irq_mask;
39 struct mutex irq_lock;
40 struct regmap_irq_chip_data *irq_data;
41
42 /* Child Devices */
43 struct palmas_pmic *pmic;
44
45 /* GPIO MUXing */
46 u8 gpio_muxed;
47 u8 led_muxed;
48 u8 pwm_muxed;
49};
50
51struct palmas_reg_init {
52 /* warm_rest controls the voltage levels after a warm reset
53 *
54 * 0: reload default values from OTP on warm reset
55 * 1: maintain voltage from VSEL on warm reset
56 */
57 int warm_reset;
58
59 /* roof_floor controls whether the regulator uses the i2c style
60 * of DVS or uses the method where a GPIO or other control method is
61 * attached to the NSLEEP/ENABLE1/ENABLE2 pins
62 *
63 * For SMPS
64 *
65 * 0: i2c selection of voltage
66 * 1: pin selection of voltage.
67 *
68 * For LDO unused
69 */
70 int roof_floor;
71
72 /* sleep_mode is the mode loaded to MODE_SLEEP bits as defined in
73 * the data sheet.
74 *
75 * For SMPS
76 *
77 * 0: Off
78 * 1: AUTO
79 * 2: ECO
80 * 3: Forced PWM
81 *
82 * For LDO
83 *
84 * 0: Off
85 * 1: On
86 */
87 int mode_sleep;
88
89 /* tstep is the timestep loaded to the TSTEP register
90 *
91 * For SMPS
92 *
93 * 0: Jump (no slope control)
94 * 1: 10mV/us
95 * 2: 5mV/us
96 * 3: 2.5mV/us
97 *
98 * For LDO unused
99 */
100 int tstep;
101
102 /* voltage_sel is the bitfield loaded onto the SMPSX_VOLTAGE
103 * register. Set this is the default voltage set in OTP needs
104 * to be overridden.
105 */
106 u8 vsel;
107
108};
109
110struct palmas_pmic_platform_data {
111 /* An array of pointers to regulator init data indexed by regulator
112 * ID
113 */
114 struct regulator_init_data **reg_data;
115
116 /* An array of pointers to structures containing sleep mode and DVS
117 * configuration for regulators indexed by ID
118 */
119 struct palmas_reg_init **reg_init;
120
121 /* use LDO6 for vibrator control */
122 int ldo6_vibrator;
123
124
125};
126
127struct palmas_platform_data {
128 int gpio_base;
129
130 /* bit value to be loaded to the POWER_CTRL register */
131 u8 power_ctrl;
132
133 /*
134 * boolean to select if we want to configure muxing here
135 * then the two value to load into the registers if true
136 */
137 int mux_from_pdata;
138 u8 pad1, pad2;
139
140 struct palmas_pmic_platform_data *pmic_pdata;
141};
142
143/* Define the palmas IRQ numbers */
144enum palmas_irqs {
145 /* INT1 registers */
146 PALMAS_CHARG_DET_N_VBUS_OVV_IRQ,
147 PALMAS_PWRON_IRQ,
148 PALMAS_LONG_PRESS_KEY_IRQ,
149 PALMAS_RPWRON_IRQ,
150 PALMAS_PWRDOWN_IRQ,
151 PALMAS_HOTDIE_IRQ,
152 PALMAS_VSYS_MON_IRQ,
153 PALMAS_VBAT_MON_IRQ,
154 /* INT2 registers */
155 PALMAS_RTC_ALARM_IRQ,
156 PALMAS_RTC_TIMER_IRQ,
157 PALMAS_WDT_IRQ,
158 PALMAS_BATREMOVAL_IRQ,
159 PALMAS_RESET_IN_IRQ,
160 PALMAS_FBI_BB_IRQ,
161 PALMAS_SHORT_IRQ,
162 PALMAS_VAC_ACOK_IRQ,
163 /* INT3 registers */
164 PALMAS_GPADC_AUTO_0_IRQ,
165 PALMAS_GPADC_AUTO_1_IRQ,
166 PALMAS_GPADC_EOC_SW_IRQ,
167 PALMAS_GPADC_EOC_RT_IRQ,
168 PALMAS_ID_OTG_IRQ,
169 PALMAS_ID_IRQ,
170 PALMAS_VBUS_OTG_IRQ,
171 PALMAS_VBUS_IRQ,
172 /* INT4 registers */
173 PALMAS_GPIO_0_IRQ,
174 PALMAS_GPIO_1_IRQ,
175 PALMAS_GPIO_2_IRQ,
176 PALMAS_GPIO_3_IRQ,
177 PALMAS_GPIO_4_IRQ,
178 PALMAS_GPIO_5_IRQ,
179 PALMAS_GPIO_6_IRQ,
180 PALMAS_GPIO_7_IRQ,
181 /* Total Number IRQs */
182 PALMAS_NUM_IRQ,
183};
184
185enum palmas_regulators {
186 /* SMPS regulators */
187 PALMAS_REG_SMPS12,
188 PALMAS_REG_SMPS123,
189 PALMAS_REG_SMPS3,
190 PALMAS_REG_SMPS45,
191 PALMAS_REG_SMPS457,
192 PALMAS_REG_SMPS6,
193 PALMAS_REG_SMPS7,
194 PALMAS_REG_SMPS8,
195 PALMAS_REG_SMPS9,
196 PALMAS_REG_SMPS10,
197 /* LDO regulators */
198 PALMAS_REG_LDO1,
199 PALMAS_REG_LDO2,
200 PALMAS_REG_LDO3,
201 PALMAS_REG_LDO4,
202 PALMAS_REG_LDO5,
203 PALMAS_REG_LDO6,
204 PALMAS_REG_LDO7,
205 PALMAS_REG_LDO8,
206 PALMAS_REG_LDO9,
207 PALMAS_REG_LDOLN,
208 PALMAS_REG_LDOUSB,
209 /* Total number of regulators */
210 PALMAS_NUM_REGS,
211};
212
213struct palmas_pmic {
214 struct palmas *palmas;
215 struct device *dev;
216 struct regulator_desc desc[PALMAS_NUM_REGS];
217 struct regulator_dev *rdev[PALMAS_NUM_REGS];
218 struct mutex mutex;
219
220 int smps123;
221 int smps457;
222
223 int range[PALMAS_REG_SMPS10];
224};
225
226/* defines so we can store the mux settings */
227#define PALMAS_GPIO_0_MUXED (1 << 0)
228#define PALMAS_GPIO_1_MUXED (1 << 1)
229#define PALMAS_GPIO_2_MUXED (1 << 2)
230#define PALMAS_GPIO_3_MUXED (1 << 3)
231#define PALMAS_GPIO_4_MUXED (1 << 4)
232#define PALMAS_GPIO_5_MUXED (1 << 5)
233#define PALMAS_GPIO_6_MUXED (1 << 6)
234#define PALMAS_GPIO_7_MUXED (1 << 7)
235
236#define PALMAS_LED1_MUXED (1 << 0)
237#define PALMAS_LED2_MUXED (1 << 1)
238
239#define PALMAS_PWM1_MUXED (1 << 0)
240#define PALMAS_PWM2_MUXED (1 << 1)
241
242/* helper macro to get correct slave number */
243#define PALMAS_BASE_TO_SLAVE(x) ((x >> 8) - 1)
244#define PALMAS_BASE_TO_REG(x, y) ((x & 0xff) + y)
245
246/* Base addresses of IP blocks in Palmas */
247#define PALMAS_SMPS_DVS_BASE 0x20
248#define PALMAS_RTC_BASE 0x100
249#define PALMAS_VALIDITY_BASE 0x118
250#define PALMAS_SMPS_BASE 0x120
251#define PALMAS_LDO_BASE 0x150
252#define PALMAS_DVFS_BASE 0x180
253#define PALMAS_PMU_CONTROL_BASE 0x1A0
254#define PALMAS_RESOURCE_BASE 0x1D4
255#define PALMAS_PU_PD_OD_BASE 0x1F4
256#define PALMAS_LED_BASE 0x200
257#define PALMAS_INTERRUPT_BASE 0x210
258#define PALMAS_USB_OTG_BASE 0x250
259#define PALMAS_VIBRATOR_BASE 0x270
260#define PALMAS_GPIO_BASE 0x280
261#define PALMAS_USB_BASE 0x290
262#define PALMAS_GPADC_BASE 0x2C0
263#define PALMAS_TRIM_GPADC_BASE 0x3CD
264
265/* Registers for function RTC */
266#define PALMAS_SECONDS_REG 0x0
267#define PALMAS_MINUTES_REG 0x1
268#define PALMAS_HOURS_REG 0x2
269#define PALMAS_DAYS_REG 0x3
270#define PALMAS_MONTHS_REG 0x4
271#define PALMAS_YEARS_REG 0x5
272#define PALMAS_WEEKS_REG 0x6
273#define PALMAS_ALARM_SECONDS_REG 0x8
274#define PALMAS_ALARM_MINUTES_REG 0x9
275#define PALMAS_ALARM_HOURS_REG 0xA
276#define PALMAS_ALARM_DAYS_REG 0xB
277#define PALMAS_ALARM_MONTHS_REG 0xC
278#define PALMAS_ALARM_YEARS_REG 0xD
279#define PALMAS_RTC_CTRL_REG 0x10
280#define PALMAS_RTC_STATUS_REG 0x11
281#define PALMAS_RTC_INTERRUPTS_REG 0x12
282#define PALMAS_RTC_COMP_LSB_REG 0x13
283#define PALMAS_RTC_COMP_MSB_REG 0x14
284#define PALMAS_RTC_RES_PROG_REG 0x15
285#define PALMAS_RTC_RESET_STATUS_REG 0x16
286
287/* Bit definitions for SECONDS_REG */
288#define PALMAS_SECONDS_REG_SEC1_MASK 0x70
289#define PALMAS_SECONDS_REG_SEC1_SHIFT 4
290#define PALMAS_SECONDS_REG_SEC0_MASK 0x0f
291#define PALMAS_SECONDS_REG_SEC0_SHIFT 0
292
293/* Bit definitions for MINUTES_REG */
294#define PALMAS_MINUTES_REG_MIN1_MASK 0x70
295#define PALMAS_MINUTES_REG_MIN1_SHIFT 4
296#define PALMAS_MINUTES_REG_MIN0_MASK 0x0f
297#define PALMAS_MINUTES_REG_MIN0_SHIFT 0
298
299/* Bit definitions for HOURS_REG */
300#define PALMAS_HOURS_REG_PM_NAM 0x80
301#define PALMAS_HOURS_REG_PM_NAM_SHIFT 7
302#define PALMAS_HOURS_REG_HOUR1_MASK 0x30
303#define PALMAS_HOURS_REG_HOUR1_SHIFT 4
304#define PALMAS_HOURS_REG_HOUR0_MASK 0x0f
305#define PALMAS_HOURS_REG_HOUR0_SHIFT 0
306
307/* Bit definitions for DAYS_REG */
308#define PALMAS_DAYS_REG_DAY1_MASK 0x30
309#define PALMAS_DAYS_REG_DAY1_SHIFT 4
310#define PALMAS_DAYS_REG_DAY0_MASK 0x0f
311#define PALMAS_DAYS_REG_DAY0_SHIFT 0
312
313/* Bit definitions for MONTHS_REG */
314#define PALMAS_MONTHS_REG_MONTH1 0x10
315#define PALMAS_MONTHS_REG_MONTH1_SHIFT 4
316#define PALMAS_MONTHS_REG_MONTH0_MASK 0x0f
317#define PALMAS_MONTHS_REG_MONTH0_SHIFT 0
318
319/* Bit definitions for YEARS_REG */
320#define PALMAS_YEARS_REG_YEAR1_MASK 0xf0
321#define PALMAS_YEARS_REG_YEAR1_SHIFT 4
322#define PALMAS_YEARS_REG_YEAR0_MASK 0x0f
323#define PALMAS_YEARS_REG_YEAR0_SHIFT 0
324
325/* Bit definitions for WEEKS_REG */
326#define PALMAS_WEEKS_REG_WEEK_MASK 0x07
327#define PALMAS_WEEKS_REG_WEEK_SHIFT 0
328
329/* Bit definitions for ALARM_SECONDS_REG */
330#define PALMAS_ALARM_SECONDS_REG_ALARM_SEC1_MASK 0x70
331#define PALMAS_ALARM_SECONDS_REG_ALARM_SEC1_SHIFT 4
332#define PALMAS_ALARM_SECONDS_REG_ALARM_SEC0_MASK 0x0f
333#define PALMAS_ALARM_SECONDS_REG_ALARM_SEC0_SHIFT 0
334
335/* Bit definitions for ALARM_MINUTES_REG */
336#define PALMAS_ALARM_MINUTES_REG_ALARM_MIN1_MASK 0x70
337#define PALMAS_ALARM_MINUTES_REG_ALARM_MIN1_SHIFT 4
338#define PALMAS_ALARM_MINUTES_REG_ALARM_MIN0_MASK 0x0f
339#define PALMAS_ALARM_MINUTES_REG_ALARM_MIN0_SHIFT 0
340
341/* Bit definitions for ALARM_HOURS_REG */
342#define PALMAS_ALARM_HOURS_REG_ALARM_PM_NAM 0x80
343#define PALMAS_ALARM_HOURS_REG_ALARM_PM_NAM_SHIFT 7
344#define PALMAS_ALARM_HOURS_REG_ALARM_HOUR1_MASK 0x30
345#define PALMAS_ALARM_HOURS_REG_ALARM_HOUR1_SHIFT 4
346#define PALMAS_ALARM_HOURS_REG_ALARM_HOUR0_MASK 0x0f
347#define PALMAS_ALARM_HOURS_REG_ALARM_HOUR0_SHIFT 0
348
349/* Bit definitions for ALARM_DAYS_REG */
350#define PALMAS_ALARM_DAYS_REG_ALARM_DAY1_MASK 0x30
351#define PALMAS_ALARM_DAYS_REG_ALARM_DAY1_SHIFT 4
352#define PALMAS_ALARM_DAYS_REG_ALARM_DAY0_MASK 0x0f
353#define PALMAS_ALARM_DAYS_REG_ALARM_DAY0_SHIFT 0
354
355/* Bit definitions for ALARM_MONTHS_REG */
356#define PALMAS_ALARM_MONTHS_REG_ALARM_MONTH1 0x10
357#define PALMAS_ALARM_MONTHS_REG_ALARM_MONTH1_SHIFT 4
358#define PALMAS_ALARM_MONTHS_REG_ALARM_MONTH0_MASK 0x0f
359#define PALMAS_ALARM_MONTHS_REG_ALARM_MONTH0_SHIFT 0
360
361/* Bit definitions for ALARM_YEARS_REG */
362#define PALMAS_ALARM_YEARS_REG_ALARM_YEAR1_MASK 0xf0
363#define PALMAS_ALARM_YEARS_REG_ALARM_YEAR1_SHIFT 4
364#define PALMAS_ALARM_YEARS_REG_ALARM_YEAR0_MASK 0x0f
365#define PALMAS_ALARM_YEARS_REG_ALARM_YEAR0_SHIFT 0
366
367/* Bit definitions for RTC_CTRL_REG */
368#define PALMAS_RTC_CTRL_REG_RTC_V_OPT 0x80
369#define PALMAS_RTC_CTRL_REG_RTC_V_OPT_SHIFT 7
370#define PALMAS_RTC_CTRL_REG_GET_TIME 0x40
371#define PALMAS_RTC_CTRL_REG_GET_TIME_SHIFT 6
372#define PALMAS_RTC_CTRL_REG_SET_32_COUNTER 0x20
373#define PALMAS_RTC_CTRL_REG_SET_32_COUNTER_SHIFT 5
374#define PALMAS_RTC_CTRL_REG_TEST_MODE 0x10
375#define PALMAS_RTC_CTRL_REG_TEST_MODE_SHIFT 4
376#define PALMAS_RTC_CTRL_REG_MODE_12_24 0x08
377#define PALMAS_RTC_CTRL_REG_MODE_12_24_SHIFT 3
378#define PALMAS_RTC_CTRL_REG_AUTO_COMP 0x04
379#define PALMAS_RTC_CTRL_REG_AUTO_COMP_SHIFT 2
380#define PALMAS_RTC_CTRL_REG_ROUND_30S 0x02
381#define PALMAS_RTC_CTRL_REG_ROUND_30S_SHIFT 1
382#define PALMAS_RTC_CTRL_REG_STOP_RTC 0x01
383#define PALMAS_RTC_CTRL_REG_STOP_RTC_SHIFT 0
384
385/* Bit definitions for RTC_STATUS_REG */
386#define PALMAS_RTC_STATUS_REG_POWER_UP 0x80
387#define PALMAS_RTC_STATUS_REG_POWER_UP_SHIFT 7
388#define PALMAS_RTC_STATUS_REG_ALARM 0x40
389#define PALMAS_RTC_STATUS_REG_ALARM_SHIFT 6
390#define PALMAS_RTC_STATUS_REG_EVENT_1D 0x20
391#define PALMAS_RTC_STATUS_REG_EVENT_1D_SHIFT 5
392#define PALMAS_RTC_STATUS_REG_EVENT_1H 0x10
393#define PALMAS_RTC_STATUS_REG_EVENT_1H_SHIFT 4
394#define PALMAS_RTC_STATUS_REG_EVENT_1M 0x08
395#define PALMAS_RTC_STATUS_REG_EVENT_1M_SHIFT 3
396#define PALMAS_RTC_STATUS_REG_EVENT_1S 0x04
397#define PALMAS_RTC_STATUS_REG_EVENT_1S_SHIFT 2
398#define PALMAS_RTC_STATUS_REG_RUN 0x02
399#define PALMAS_RTC_STATUS_REG_RUN_SHIFT 1
400
401/* Bit definitions for RTC_INTERRUPTS_REG */
402#define PALMAS_RTC_INTERRUPTS_REG_IT_SLEEP_MASK_EN 0x10
403#define PALMAS_RTC_INTERRUPTS_REG_IT_SLEEP_MASK_EN_SHIFT 4
404#define PALMAS_RTC_INTERRUPTS_REG_IT_ALARM 0x08
405#define PALMAS_RTC_INTERRUPTS_REG_IT_ALARM_SHIFT 3
406#define PALMAS_RTC_INTERRUPTS_REG_IT_TIMER 0x04
407#define PALMAS_RTC_INTERRUPTS_REG_IT_TIMER_SHIFT 2
408#define PALMAS_RTC_INTERRUPTS_REG_EVERY_MASK 0x03
409#define PALMAS_RTC_INTERRUPTS_REG_EVERY_SHIFT 0
410
411/* Bit definitions for RTC_COMP_LSB_REG */
412#define PALMAS_RTC_COMP_LSB_REG_RTC_COMP_LSB_MASK 0xff
413#define PALMAS_RTC_COMP_LSB_REG_RTC_COMP_LSB_SHIFT 0
414
415/* Bit definitions for RTC_COMP_MSB_REG */
416#define PALMAS_RTC_COMP_MSB_REG_RTC_COMP_MSB_MASK 0xff
417#define PALMAS_RTC_COMP_MSB_REG_RTC_COMP_MSB_SHIFT 0
418
419/* Bit definitions for RTC_RES_PROG_REG */
420#define PALMAS_RTC_RES_PROG_REG_SW_RES_PROG_MASK 0x3f
421#define PALMAS_RTC_RES_PROG_REG_SW_RES_PROG_SHIFT 0
422
423/* Bit definitions for RTC_RESET_STATUS_REG */
424#define PALMAS_RTC_RESET_STATUS_REG_RESET_STATUS 0x01
425#define PALMAS_RTC_RESET_STATUS_REG_RESET_STATUS_SHIFT 0
426
427/* Registers for function BACKUP */
428#define PALMAS_BACKUP0 0x0
429#define PALMAS_BACKUP1 0x1
430#define PALMAS_BACKUP2 0x2
431#define PALMAS_BACKUP3 0x3
432#define PALMAS_BACKUP4 0x4
433#define PALMAS_BACKUP5 0x5
434#define PALMAS_BACKUP6 0x6
435#define PALMAS_BACKUP7 0x7
436
437/* Bit definitions for BACKUP0 */
438#define PALMAS_BACKUP0_BACKUP_MASK 0xff
439#define PALMAS_BACKUP0_BACKUP_SHIFT 0
440
441/* Bit definitions for BACKUP1 */
442#define PALMAS_BACKUP1_BACKUP_MASK 0xff
443#define PALMAS_BACKUP1_BACKUP_SHIFT 0
444
445/* Bit definitions for BACKUP2 */
446#define PALMAS_BACKUP2_BACKUP_MASK 0xff
447#define PALMAS_BACKUP2_BACKUP_SHIFT 0
448
449/* Bit definitions for BACKUP3 */
450#define PALMAS_BACKUP3_BACKUP_MASK 0xff
451#define PALMAS_BACKUP3_BACKUP_SHIFT 0
452
453/* Bit definitions for BACKUP4 */
454#define PALMAS_BACKUP4_BACKUP_MASK 0xff
455#define PALMAS_BACKUP4_BACKUP_SHIFT 0
456
457/* Bit definitions for BACKUP5 */
458#define PALMAS_BACKUP5_BACKUP_MASK 0xff
459#define PALMAS_BACKUP5_BACKUP_SHIFT 0
460
461/* Bit definitions for BACKUP6 */
462#define PALMAS_BACKUP6_BACKUP_MASK 0xff
463#define PALMAS_BACKUP6_BACKUP_SHIFT 0
464
465/* Bit definitions for BACKUP7 */
466#define PALMAS_BACKUP7_BACKUP_MASK 0xff
467#define PALMAS_BACKUP7_BACKUP_SHIFT 0
468
469/* Registers for function SMPS */
470#define PALMAS_SMPS12_CTRL 0x0
471#define PALMAS_SMPS12_TSTEP 0x1
472#define PALMAS_SMPS12_FORCE 0x2
473#define PALMAS_SMPS12_VOLTAGE 0x3
474#define PALMAS_SMPS3_CTRL 0x4
475#define PALMAS_SMPS3_VOLTAGE 0x7
476#define PALMAS_SMPS45_CTRL 0x8
477#define PALMAS_SMPS45_TSTEP 0x9
478#define PALMAS_SMPS45_FORCE 0xA
479#define PALMAS_SMPS45_VOLTAGE 0xB
480#define PALMAS_SMPS6_CTRL 0xC
481#define PALMAS_SMPS6_TSTEP 0xD
482#define PALMAS_SMPS6_FORCE 0xE
483#define PALMAS_SMPS6_VOLTAGE 0xF
484#define PALMAS_SMPS7_CTRL 0x10
485#define PALMAS_SMPS7_VOLTAGE 0x13
486#define PALMAS_SMPS8_CTRL 0x14
487#define PALMAS_SMPS8_TSTEP 0x15
488#define PALMAS_SMPS8_FORCE 0x16
489#define PALMAS_SMPS8_VOLTAGE 0x17
490#define PALMAS_SMPS9_CTRL 0x18
491#define PALMAS_SMPS9_VOLTAGE 0x1B
492#define PALMAS_SMPS10_CTRL 0x1C
493#define PALMAS_SMPS10_STATUS 0x1F
494#define PALMAS_SMPS_CTRL 0x24
495#define PALMAS_SMPS_PD_CTRL 0x25
496#define PALMAS_SMPS_DITHER_EN 0x26
497#define PALMAS_SMPS_THERMAL_EN 0x27
498#define PALMAS_SMPS_THERMAL_STATUS 0x28
499#define PALMAS_SMPS_SHORT_STATUS 0x29
500#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN 0x2A
501#define PALMAS_SMPS_POWERGOOD_MASK1 0x2B
502#define PALMAS_SMPS_POWERGOOD_MASK2 0x2C
503
504/* Bit definitions for SMPS12_CTRL */
505#define PALMAS_SMPS12_CTRL_WR_S 0x80
506#define PALMAS_SMPS12_CTRL_WR_S_SHIFT 7
507#define PALMAS_SMPS12_CTRL_ROOF_FLOOR_EN 0x40
508#define PALMAS_SMPS12_CTRL_ROOF_FLOOR_EN_SHIFT 6
509#define PALMAS_SMPS12_CTRL_STATUS_MASK 0x30
510#define PALMAS_SMPS12_CTRL_STATUS_SHIFT 4
511#define PALMAS_SMPS12_CTRL_MODE_SLEEP_MASK 0x0c
512#define PALMAS_SMPS12_CTRL_MODE_SLEEP_SHIFT 2
513#define PALMAS_SMPS12_CTRL_MODE_ACTIVE_MASK 0x03
514#define PALMAS_SMPS12_CTRL_MODE_ACTIVE_SHIFT 0
515
516/* Bit definitions for SMPS12_TSTEP */
517#define PALMAS_SMPS12_TSTEP_TSTEP_MASK 0x03
518#define PALMAS_SMPS12_TSTEP_TSTEP_SHIFT 0
519
520/* Bit definitions for SMPS12_FORCE */
521#define PALMAS_SMPS12_FORCE_CMD 0x80
522#define PALMAS_SMPS12_FORCE_CMD_SHIFT 7
523#define PALMAS_SMPS12_FORCE_VSEL_MASK 0x7f
524#define PALMAS_SMPS12_FORCE_VSEL_SHIFT 0
525
526/* Bit definitions for SMPS12_VOLTAGE */
527#define PALMAS_SMPS12_VOLTAGE_RANGE 0x80
528#define PALMAS_SMPS12_VOLTAGE_RANGE_SHIFT 7
529#define PALMAS_SMPS12_VOLTAGE_VSEL_MASK 0x7f
530#define PALMAS_SMPS12_VOLTAGE_VSEL_SHIFT 0
531
532/* Bit definitions for SMPS3_CTRL */
533#define PALMAS_SMPS3_CTRL_WR_S 0x80
534#define PALMAS_SMPS3_CTRL_WR_S_SHIFT 7
535#define PALMAS_SMPS3_CTRL_STATUS_MASK 0x30
536#define PALMAS_SMPS3_CTRL_STATUS_SHIFT 4
537#define PALMAS_SMPS3_CTRL_MODE_SLEEP_MASK 0x0c
538#define PALMAS_SMPS3_CTRL_MODE_SLEEP_SHIFT 2
539#define PALMAS_SMPS3_CTRL_MODE_ACTIVE_MASK 0x03
540#define PALMAS_SMPS3_CTRL_MODE_ACTIVE_SHIFT 0
541
542/* Bit definitions for SMPS3_VOLTAGE */
543#define PALMAS_SMPS3_VOLTAGE_RANGE 0x80
544#define PALMAS_SMPS3_VOLTAGE_RANGE_SHIFT 7
545#define PALMAS_SMPS3_VOLTAGE_VSEL_MASK 0x7f
546#define PALMAS_SMPS3_VOLTAGE_VSEL_SHIFT 0
547
548/* Bit definitions for SMPS45_CTRL */
549#define PALMAS_SMPS45_CTRL_WR_S 0x80
550#define PALMAS_SMPS45_CTRL_WR_S_SHIFT 7
551#define PALMAS_SMPS45_CTRL_ROOF_FLOOR_EN 0x40
552#define PALMAS_SMPS45_CTRL_ROOF_FLOOR_EN_SHIFT 6
553#define PALMAS_SMPS45_CTRL_STATUS_MASK 0x30
554#define PALMAS_SMPS45_CTRL_STATUS_SHIFT 4
555#define PALMAS_SMPS45_CTRL_MODE_SLEEP_MASK 0x0c
556#define PALMAS_SMPS45_CTRL_MODE_SLEEP_SHIFT 2
557#define PALMAS_SMPS45_CTRL_MODE_ACTIVE_MASK 0x03
558#define PALMAS_SMPS45_CTRL_MODE_ACTIVE_SHIFT 0
559
560/* Bit definitions for SMPS45_TSTEP */
561#define PALMAS_SMPS45_TSTEP_TSTEP_MASK 0x03
562#define PALMAS_SMPS45_TSTEP_TSTEP_SHIFT 0
563
564/* Bit definitions for SMPS45_FORCE */
565#define PALMAS_SMPS45_FORCE_CMD 0x80
566#define PALMAS_SMPS45_FORCE_CMD_SHIFT 7
567#define PALMAS_SMPS45_FORCE_VSEL_MASK 0x7f
568#define PALMAS_SMPS45_FORCE_VSEL_SHIFT 0
569
570/* Bit definitions for SMPS45_VOLTAGE */
571#define PALMAS_SMPS45_VOLTAGE_RANGE 0x80
572#define PALMAS_SMPS45_VOLTAGE_RANGE_SHIFT 7
573#define PALMAS_SMPS45_VOLTAGE_VSEL_MASK 0x7f
574#define PALMAS_SMPS45_VOLTAGE_VSEL_SHIFT 0
575
576/* Bit definitions for SMPS6_CTRL */
577#define PALMAS_SMPS6_CTRL_WR_S 0x80
578#define PALMAS_SMPS6_CTRL_WR_S_SHIFT 7
579#define PALMAS_SMPS6_CTRL_ROOF_FLOOR_EN 0x40
580#define PALMAS_SMPS6_CTRL_ROOF_FLOOR_EN_SHIFT 6
581#define PALMAS_SMPS6_CTRL_STATUS_MASK 0x30
582#define PALMAS_SMPS6_CTRL_STATUS_SHIFT 4
583#define PALMAS_SMPS6_CTRL_MODE_SLEEP_MASK 0x0c
584#define PALMAS_SMPS6_CTRL_MODE_SLEEP_SHIFT 2
585#define PALMAS_SMPS6_CTRL_MODE_ACTIVE_MASK 0x03
586#define PALMAS_SMPS6_CTRL_MODE_ACTIVE_SHIFT 0
587
588/* Bit definitions for SMPS6_TSTEP */
589#define PALMAS_SMPS6_TSTEP_TSTEP_MASK 0x03
590#define PALMAS_SMPS6_TSTEP_TSTEP_SHIFT 0
591
592/* Bit definitions for SMPS6_FORCE */
593#define PALMAS_SMPS6_FORCE_CMD 0x80
594#define PALMAS_SMPS6_FORCE_CMD_SHIFT 7
595#define PALMAS_SMPS6_FORCE_VSEL_MASK 0x7f
596#define PALMAS_SMPS6_FORCE_VSEL_SHIFT 0
597
598/* Bit definitions for SMPS6_VOLTAGE */
599#define PALMAS_SMPS6_VOLTAGE_RANGE 0x80
600#define PALMAS_SMPS6_VOLTAGE_RANGE_SHIFT 7
601#define PALMAS_SMPS6_VOLTAGE_VSEL_MASK 0x7f
602#define PALMAS_SMPS6_VOLTAGE_VSEL_SHIFT 0
603
604/* Bit definitions for SMPS7_CTRL */
605#define PALMAS_SMPS7_CTRL_WR_S 0x80
606#define PALMAS_SMPS7_CTRL_WR_S_SHIFT 7
607#define PALMAS_SMPS7_CTRL_STATUS_MASK 0x30
608#define PALMAS_SMPS7_CTRL_STATUS_SHIFT 4
609#define PALMAS_SMPS7_CTRL_MODE_SLEEP_MASK 0x0c
610#define PALMAS_SMPS7_CTRL_MODE_SLEEP_SHIFT 2
611#define PALMAS_SMPS7_CTRL_MODE_ACTIVE_MASK 0x03
612#define PALMAS_SMPS7_CTRL_MODE_ACTIVE_SHIFT 0
613
614/* Bit definitions for SMPS7_VOLTAGE */
615#define PALMAS_SMPS7_VOLTAGE_RANGE 0x80
616#define PALMAS_SMPS7_VOLTAGE_RANGE_SHIFT 7
617#define PALMAS_SMPS7_VOLTAGE_VSEL_MASK 0x7f
618#define PALMAS_SMPS7_VOLTAGE_VSEL_SHIFT 0
619
620/* Bit definitions for SMPS8_CTRL */
621#define PALMAS_SMPS8_CTRL_WR_S 0x80
622#define PALMAS_SMPS8_CTRL_WR_S_SHIFT 7
623#define PALMAS_SMPS8_CTRL_ROOF_FLOOR_EN 0x40
624#define PALMAS_SMPS8_CTRL_ROOF_FLOOR_EN_SHIFT 6
625#define PALMAS_SMPS8_CTRL_STATUS_MASK 0x30
626#define PALMAS_SMPS8_CTRL_STATUS_SHIFT 4
627#define PALMAS_SMPS8_CTRL_MODE_SLEEP_MASK 0x0c
628#define PALMAS_SMPS8_CTRL_MODE_SLEEP_SHIFT 2
629#define PALMAS_SMPS8_CTRL_MODE_ACTIVE_MASK 0x03
630#define PALMAS_SMPS8_CTRL_MODE_ACTIVE_SHIFT 0
631
632/* Bit definitions for SMPS8_TSTEP */
633#define PALMAS_SMPS8_TSTEP_TSTEP_MASK 0x03
634#define PALMAS_SMPS8_TSTEP_TSTEP_SHIFT 0
635
636/* Bit definitions for SMPS8_FORCE */
637#define PALMAS_SMPS8_FORCE_CMD 0x80
638#define PALMAS_SMPS8_FORCE_CMD_SHIFT 7
639#define PALMAS_SMPS8_FORCE_VSEL_MASK 0x7f
640#define PALMAS_SMPS8_FORCE_VSEL_SHIFT 0
641
642/* Bit definitions for SMPS8_VOLTAGE */
643#define PALMAS_SMPS8_VOLTAGE_RANGE 0x80
644#define PALMAS_SMPS8_VOLTAGE_RANGE_SHIFT 7
645#define PALMAS_SMPS8_VOLTAGE_VSEL_MASK 0x7f
646#define PALMAS_SMPS8_VOLTAGE_VSEL_SHIFT 0
647
648/* Bit definitions for SMPS9_CTRL */
649#define PALMAS_SMPS9_CTRL_WR_S 0x80
650#define PALMAS_SMPS9_CTRL_WR_S_SHIFT 7
651#define PALMAS_SMPS9_CTRL_STATUS_MASK 0x30
652#define PALMAS_SMPS9_CTRL_STATUS_SHIFT 4
653#define PALMAS_SMPS9_CTRL_MODE_SLEEP_MASK 0x0c
654#define PALMAS_SMPS9_CTRL_MODE_SLEEP_SHIFT 2
655#define PALMAS_SMPS9_CTRL_MODE_ACTIVE_MASK 0x03
656#define PALMAS_SMPS9_CTRL_MODE_ACTIVE_SHIFT 0
657
658/* Bit definitions for SMPS9_VOLTAGE */
659#define PALMAS_SMPS9_VOLTAGE_RANGE 0x80
660#define PALMAS_SMPS9_VOLTAGE_RANGE_SHIFT 7
661#define PALMAS_SMPS9_VOLTAGE_VSEL_MASK 0x7f
662#define PALMAS_SMPS9_VOLTAGE_VSEL_SHIFT 0
663
664/* Bit definitions for SMPS10_CTRL */
665#define PALMAS_SMPS10_CTRL_MODE_SLEEP_MASK 0xf0
666#define PALMAS_SMPS10_CTRL_MODE_SLEEP_SHIFT 4
667#define PALMAS_SMPS10_CTRL_MODE_ACTIVE_MASK 0x0f
668#define PALMAS_SMPS10_CTRL_MODE_ACTIVE_SHIFT 0
669
670/* Bit definitions for SMPS10_STATUS */
671#define PALMAS_SMPS10_STATUS_STATUS_MASK 0x0f
672#define PALMAS_SMPS10_STATUS_STATUS_SHIFT 0
673
674/* Bit definitions for SMPS_CTRL */
675#define PALMAS_SMPS_CTRL_SMPS45_SMPS457_EN 0x20
676#define PALMAS_SMPS_CTRL_SMPS45_SMPS457_EN_SHIFT 5
677#define PALMAS_SMPS_CTRL_SMPS12_SMPS123_EN 0x10
678#define PALMAS_SMPS_CTRL_SMPS12_SMPS123_EN_SHIFT 4
679#define PALMAS_SMPS_CTRL_SMPS45_PHASE_CTRL_MASK 0x0c
680#define PALMAS_SMPS_CTRL_SMPS45_PHASE_CTRL_SHIFT 2
681#define PALMAS_SMPS_CTRL_SMPS123_PHASE_CTRL_MASK 0x03
682#define PALMAS_SMPS_CTRL_SMPS123_PHASE_CTRL_SHIFT 0
683
684/* Bit definitions for SMPS_PD_CTRL */
685#define PALMAS_SMPS_PD_CTRL_SMPS9 0x40
686#define PALMAS_SMPS_PD_CTRL_SMPS9_SHIFT 6
687#define PALMAS_SMPS_PD_CTRL_SMPS8 0x20
688#define PALMAS_SMPS_PD_CTRL_SMPS8_SHIFT 5
689#define PALMAS_SMPS_PD_CTRL_SMPS7 0x10
690#define PALMAS_SMPS_PD_CTRL_SMPS7_SHIFT 4
691#define PALMAS_SMPS_PD_CTRL_SMPS6 0x08
692#define PALMAS_SMPS_PD_CTRL_SMPS6_SHIFT 3
693#define PALMAS_SMPS_PD_CTRL_SMPS45 0x04
694#define PALMAS_SMPS_PD_CTRL_SMPS45_SHIFT 2
695#define PALMAS_SMPS_PD_CTRL_SMPS3 0x02
696#define PALMAS_SMPS_PD_CTRL_SMPS3_SHIFT 1
697#define PALMAS_SMPS_PD_CTRL_SMPS12 0x01
698#define PALMAS_SMPS_PD_CTRL_SMPS12_SHIFT 0
699
700/* Bit definitions for SMPS_THERMAL_EN */
701#define PALMAS_SMPS_THERMAL_EN_SMPS9 0x40
702#define PALMAS_SMPS_THERMAL_EN_SMPS9_SHIFT 6
703#define PALMAS_SMPS_THERMAL_EN_SMPS8 0x20
704#define PALMAS_SMPS_THERMAL_EN_SMPS8_SHIFT 5
705#define PALMAS_SMPS_THERMAL_EN_SMPS6 0x08
706#define PALMAS_SMPS_THERMAL_EN_SMPS6_SHIFT 3
707#define PALMAS_SMPS_THERMAL_EN_SMPS457 0x04
708#define PALMAS_SMPS_THERMAL_EN_SMPS457_SHIFT 2
709#define PALMAS_SMPS_THERMAL_EN_SMPS123 0x01
710#define PALMAS_SMPS_THERMAL_EN_SMPS123_SHIFT 0
711
712/* Bit definitions for SMPS_THERMAL_STATUS */
713#define PALMAS_SMPS_THERMAL_STATUS_SMPS9 0x40
714#define PALMAS_SMPS_THERMAL_STATUS_SMPS9_SHIFT 6
715#define PALMAS_SMPS_THERMAL_STATUS_SMPS8 0x20
716#define PALMAS_SMPS_THERMAL_STATUS_SMPS8_SHIFT 5
717#define PALMAS_SMPS_THERMAL_STATUS_SMPS6 0x08
718#define PALMAS_SMPS_THERMAL_STATUS_SMPS6_SHIFT 3
719#define PALMAS_SMPS_THERMAL_STATUS_SMPS457 0x04
720#define PALMAS_SMPS_THERMAL_STATUS_SMPS457_SHIFT 2
721#define PALMAS_SMPS_THERMAL_STATUS_SMPS123 0x01
722#define PALMAS_SMPS_THERMAL_STATUS_SMPS123_SHIFT 0
723
724/* Bit definitions for SMPS_SHORT_STATUS */
725#define PALMAS_SMPS_SHORT_STATUS_SMPS10 0x80
726#define PALMAS_SMPS_SHORT_STATUS_SMPS10_SHIFT 7
727#define PALMAS_SMPS_SHORT_STATUS_SMPS9 0x40
728#define PALMAS_SMPS_SHORT_STATUS_SMPS9_SHIFT 6
729#define PALMAS_SMPS_SHORT_STATUS_SMPS8 0x20
730#define PALMAS_SMPS_SHORT_STATUS_SMPS8_SHIFT 5
731#define PALMAS_SMPS_SHORT_STATUS_SMPS7 0x10
732#define PALMAS_SMPS_SHORT_STATUS_SMPS7_SHIFT 4
733#define PALMAS_SMPS_SHORT_STATUS_SMPS6 0x08
734#define PALMAS_SMPS_SHORT_STATUS_SMPS6_SHIFT 3
735#define PALMAS_SMPS_SHORT_STATUS_SMPS45 0x04
736#define PALMAS_SMPS_SHORT_STATUS_SMPS45_SHIFT 2
737#define PALMAS_SMPS_SHORT_STATUS_SMPS3 0x02
738#define PALMAS_SMPS_SHORT_STATUS_SMPS3_SHIFT 1
739#define PALMAS_SMPS_SHORT_STATUS_SMPS12 0x01
740#define PALMAS_SMPS_SHORT_STATUS_SMPS12_SHIFT 0
741
742/* Bit definitions for SMPS_NEGATIVE_CURRENT_LIMIT_EN */
743#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS9 0x40
744#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS9_SHIFT 6
745#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS8 0x20
746#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS8_SHIFT 5
747#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS7 0x10
748#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS7_SHIFT 4
749#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS6 0x08
750#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS6_SHIFT 3
751#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS45 0x04
752#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS45_SHIFT 2
753#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS3 0x02
754#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS3_SHIFT 1
755#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS12 0x01
756#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS12_SHIFT 0
757
758/* Bit definitions for SMPS_POWERGOOD_MASK1 */
759#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS10 0x80
760#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS10_SHIFT 7
761#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS9 0x40
762#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS9_SHIFT 6
763#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS8 0x20
764#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS8_SHIFT 5
765#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS7 0x10
766#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS7_SHIFT 4
767#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS6 0x08
768#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS6_SHIFT 3
769#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS45 0x04
770#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS45_SHIFT 2
771#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS3 0x02
772#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS3_SHIFT 1
773#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS12 0x01
774#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS12_SHIFT 0
775
776/* Bit definitions for SMPS_POWERGOOD_MASK2 */
777#define PALMAS_SMPS_POWERGOOD_MASK2_POWERGOOD_TYPE_SELECT 0x80
778#define PALMAS_SMPS_POWERGOOD_MASK2_POWERGOOD_TYPE_SELECT_SHIFT 7
779#define PALMAS_SMPS_POWERGOOD_MASK2_GPIO_7 0x04
780#define PALMAS_SMPS_POWERGOOD_MASK2_GPIO_7_SHIFT 2
781#define PALMAS_SMPS_POWERGOOD_MASK2_VBUS 0x02
782#define PALMAS_SMPS_POWERGOOD_MASK2_VBUS_SHIFT 1
783#define PALMAS_SMPS_POWERGOOD_MASK2_ACOK 0x01
784#define PALMAS_SMPS_POWERGOOD_MASK2_ACOK_SHIFT 0
785
786/* Registers for function LDO */
787#define PALMAS_LDO1_CTRL 0x0
788#define PALMAS_LDO1_VOLTAGE 0x1
789#define PALMAS_LDO2_CTRL 0x2
790#define PALMAS_LDO2_VOLTAGE 0x3
791#define PALMAS_LDO3_CTRL 0x4
792#define PALMAS_LDO3_VOLTAGE 0x5
793#define PALMAS_LDO4_CTRL 0x6
794#define PALMAS_LDO4_VOLTAGE 0x7
795#define PALMAS_LDO5_CTRL 0x8
796#define PALMAS_LDO5_VOLTAGE 0x9
797#define PALMAS_LDO6_CTRL 0xA
798#define PALMAS_LDO6_VOLTAGE 0xB
799#define PALMAS_LDO7_CTRL 0xC
800#define PALMAS_LDO7_VOLTAGE 0xD
801#define PALMAS_LDO8_CTRL 0xE
802#define PALMAS_LDO8_VOLTAGE 0xF
803#define PALMAS_LDO9_CTRL 0x10
804#define PALMAS_LDO9_VOLTAGE 0x11
805#define PALMAS_LDOLN_CTRL 0x12
806#define PALMAS_LDOLN_VOLTAGE 0x13
807#define PALMAS_LDOUSB_CTRL 0x14
808#define PALMAS_LDOUSB_VOLTAGE 0x15
809#define PALMAS_LDO_CTRL 0x1A
810#define PALMAS_LDO_PD_CTRL1 0x1B
811#define PALMAS_LDO_PD_CTRL2 0x1C
812#define PALMAS_LDO_SHORT_STATUS1 0x1D
813#define PALMAS_LDO_SHORT_STATUS2 0x1E
814
815/* Bit definitions for LDO1_CTRL */
816#define PALMAS_LDO1_CTRL_WR_S 0x80
817#define PALMAS_LDO1_CTRL_WR_S_SHIFT 7
818#define PALMAS_LDO1_CTRL_STATUS 0x10
819#define PALMAS_LDO1_CTRL_STATUS_SHIFT 4
820#define PALMAS_LDO1_CTRL_MODE_SLEEP 0x04
821#define PALMAS_LDO1_CTRL_MODE_SLEEP_SHIFT 2
822#define PALMAS_LDO1_CTRL_MODE_ACTIVE 0x01
823#define PALMAS_LDO1_CTRL_MODE_ACTIVE_SHIFT 0
824
825/* Bit definitions for LDO1_VOLTAGE */
826#define PALMAS_LDO1_VOLTAGE_VSEL_MASK 0x3f
827#define PALMAS_LDO1_VOLTAGE_VSEL_SHIFT 0
828
829/* Bit definitions for LDO2_CTRL */
830#define PALMAS_LDO2_CTRL_WR_S 0x80
831#define PALMAS_LDO2_CTRL_WR_S_SHIFT 7
832#define PALMAS_LDO2_CTRL_STATUS 0x10
833#define PALMAS_LDO2_CTRL_STATUS_SHIFT 4
834#define PALMAS_LDO2_CTRL_MODE_SLEEP 0x04
835#define PALMAS_LDO2_CTRL_MODE_SLEEP_SHIFT 2
836#define PALMAS_LDO2_CTRL_MODE_ACTIVE 0x01
837#define PALMAS_LDO2_CTRL_MODE_ACTIVE_SHIFT 0
838
839/* Bit definitions for LDO2_VOLTAGE */
840#define PALMAS_LDO2_VOLTAGE_VSEL_MASK 0x3f
841#define PALMAS_LDO2_VOLTAGE_VSEL_SHIFT 0
842
843/* Bit definitions for LDO3_CTRL */
844#define PALMAS_LDO3_CTRL_WR_S 0x80
845#define PALMAS_LDO3_CTRL_WR_S_SHIFT 7
846#define PALMAS_LDO3_CTRL_STATUS 0x10
847#define PALMAS_LDO3_CTRL_STATUS_SHIFT 4
848#define PALMAS_LDO3_CTRL_MODE_SLEEP 0x04
849#define PALMAS_LDO3_CTRL_MODE_SLEEP_SHIFT 2
850#define PALMAS_LDO3_CTRL_MODE_ACTIVE 0x01
851#define PALMAS_LDO3_CTRL_MODE_ACTIVE_SHIFT 0
852
853/* Bit definitions for LDO3_VOLTAGE */
854#define PALMAS_LDO3_VOLTAGE_VSEL_MASK 0x3f
855#define PALMAS_LDO3_VOLTAGE_VSEL_SHIFT 0
856
857/* Bit definitions for LDO4_CTRL */
858#define PALMAS_LDO4_CTRL_WR_S 0x80
859#define PALMAS_LDO4_CTRL_WR_S_SHIFT 7
860#define PALMAS_LDO4_CTRL_STATUS 0x10
861#define PALMAS_LDO4_CTRL_STATUS_SHIFT 4
862#define PALMAS_LDO4_CTRL_MODE_SLEEP 0x04
863#define PALMAS_LDO4_CTRL_MODE_SLEEP_SHIFT 2
864#define PALMAS_LDO4_CTRL_MODE_ACTIVE 0x01
865#define PALMAS_LDO4_CTRL_MODE_ACTIVE_SHIFT 0
866
867/* Bit definitions for LDO4_VOLTAGE */
868#define PALMAS_LDO4_VOLTAGE_VSEL_MASK 0x3f
869#define PALMAS_LDO4_VOLTAGE_VSEL_SHIFT 0
870
871/* Bit definitions for LDO5_CTRL */
872#define PALMAS_LDO5_CTRL_WR_S 0x80
873#define PALMAS_LDO5_CTRL_WR_S_SHIFT 7
874#define PALMAS_LDO5_CTRL_STATUS 0x10
875#define PALMAS_LDO5_CTRL_STATUS_SHIFT 4
876#define PALMAS_LDO5_CTRL_MODE_SLEEP 0x04
877#define PALMAS_LDO5_CTRL_MODE_SLEEP_SHIFT 2
878#define PALMAS_LDO5_CTRL_MODE_ACTIVE 0x01
879#define PALMAS_LDO5_CTRL_MODE_ACTIVE_SHIFT 0
880
881/* Bit definitions for LDO5_VOLTAGE */
882#define PALMAS_LDO5_VOLTAGE_VSEL_MASK 0x3f
883#define PALMAS_LDO5_VOLTAGE_VSEL_SHIFT 0
884
885/* Bit definitions for LDO6_CTRL */
886#define PALMAS_LDO6_CTRL_WR_S 0x80
887#define PALMAS_LDO6_CTRL_WR_S_SHIFT 7
888#define PALMAS_LDO6_CTRL_LDO_VIB_EN 0x40
889#define PALMAS_LDO6_CTRL_LDO_VIB_EN_SHIFT 6
890#define PALMAS_LDO6_CTRL_STATUS 0x10
891#define PALMAS_LDO6_CTRL_STATUS_SHIFT 4
892#define PALMAS_LDO6_CTRL_MODE_SLEEP 0x04
893#define PALMAS_LDO6_CTRL_MODE_SLEEP_SHIFT 2
894#define PALMAS_LDO6_CTRL_MODE_ACTIVE 0x01
895#define PALMAS_LDO6_CTRL_MODE_ACTIVE_SHIFT 0
896
897/* Bit definitions for LDO6_VOLTAGE */
898#define PALMAS_LDO6_VOLTAGE_VSEL_MASK 0x3f
899#define PALMAS_LDO6_VOLTAGE_VSEL_SHIFT 0
900
901/* Bit definitions for LDO7_CTRL */
902#define PALMAS_LDO7_CTRL_WR_S 0x80
903#define PALMAS_LDO7_CTRL_WR_S_SHIFT 7
904#define PALMAS_LDO7_CTRL_STATUS 0x10
905#define PALMAS_LDO7_CTRL_STATUS_SHIFT 4
906#define PALMAS_LDO7_CTRL_MODE_SLEEP 0x04
907#define PALMAS_LDO7_CTRL_MODE_SLEEP_SHIFT 2
908#define PALMAS_LDO7_CTRL_MODE_ACTIVE 0x01
909#define PALMAS_LDO7_CTRL_MODE_ACTIVE_SHIFT 0
910
911/* Bit definitions for LDO7_VOLTAGE */
912#define PALMAS_LDO7_VOLTAGE_VSEL_MASK 0x3f
913#define PALMAS_LDO7_VOLTAGE_VSEL_SHIFT 0
914
915/* Bit definitions for LDO8_CTRL */
916#define PALMAS_LDO8_CTRL_WR_S 0x80
917#define PALMAS_LDO8_CTRL_WR_S_SHIFT 7
918#define PALMAS_LDO8_CTRL_LDO_TRACKING_EN 0x40
919#define PALMAS_LDO8_CTRL_LDO_TRACKING_EN_SHIFT 6
920#define PALMAS_LDO8_CTRL_STATUS 0x10
921#define PALMAS_LDO8_CTRL_STATUS_SHIFT 4
922#define PALMAS_LDO8_CTRL_MODE_SLEEP 0x04
923#define PALMAS_LDO8_CTRL_MODE_SLEEP_SHIFT 2
924#define PALMAS_LDO8_CTRL_MODE_ACTIVE 0x01
925#define PALMAS_LDO8_CTRL_MODE_ACTIVE_SHIFT 0
926
927/* Bit definitions for LDO8_VOLTAGE */
928#define PALMAS_LDO8_VOLTAGE_VSEL_MASK 0x3f
929#define PALMAS_LDO8_VOLTAGE_VSEL_SHIFT 0
930
931/* Bit definitions for LDO9_CTRL */
932#define PALMAS_LDO9_CTRL_WR_S 0x80
933#define PALMAS_LDO9_CTRL_WR_S_SHIFT 7
934#define PALMAS_LDO9_CTRL_LDO_BYPASS_EN 0x40
935#define PALMAS_LDO9_CTRL_LDO_BYPASS_EN_SHIFT 6
936#define PALMAS_LDO9_CTRL_STATUS 0x10
937#define PALMAS_LDO9_CTRL_STATUS_SHIFT 4
938#define PALMAS_LDO9_CTRL_MODE_SLEEP 0x04
939#define PALMAS_LDO9_CTRL_MODE_SLEEP_SHIFT 2
940#define PALMAS_LDO9_CTRL_MODE_ACTIVE 0x01
941#define PALMAS_LDO9_CTRL_MODE_ACTIVE_SHIFT 0
942
943/* Bit definitions for LDO9_VOLTAGE */
944#define PALMAS_LDO9_VOLTAGE_VSEL_MASK 0x3f
945#define PALMAS_LDO9_VOLTAGE_VSEL_SHIFT 0
946
947/* Bit definitions for LDOLN_CTRL */
948#define PALMAS_LDOLN_CTRL_WR_S 0x80
949#define PALMAS_LDOLN_CTRL_WR_S_SHIFT 7
950#define PALMAS_LDOLN_CTRL_STATUS 0x10
951#define PALMAS_LDOLN_CTRL_STATUS_SHIFT 4
952#define PALMAS_LDOLN_CTRL_MODE_SLEEP 0x04
953#define PALMAS_LDOLN_CTRL_MODE_SLEEP_SHIFT 2
954#define PALMAS_LDOLN_CTRL_MODE_ACTIVE 0x01
955#define PALMAS_LDOLN_CTRL_MODE_ACTIVE_SHIFT 0
956
957/* Bit definitions for LDOLN_VOLTAGE */
958#define PALMAS_LDOLN_VOLTAGE_VSEL_MASK 0x3f
959#define PALMAS_LDOLN_VOLTAGE_VSEL_SHIFT 0
960
961/* Bit definitions for LDOUSB_CTRL */
962#define PALMAS_LDOUSB_CTRL_WR_S 0x80
963#define PALMAS_LDOUSB_CTRL_WR_S_SHIFT 7
964#define PALMAS_LDOUSB_CTRL_STATUS 0x10
965#define PALMAS_LDOUSB_CTRL_STATUS_SHIFT 4
966#define PALMAS_LDOUSB_CTRL_MODE_SLEEP 0x04
967#define PALMAS_LDOUSB_CTRL_MODE_SLEEP_SHIFT 2
968#define PALMAS_LDOUSB_CTRL_MODE_ACTIVE 0x01
969#define PALMAS_LDOUSB_CTRL_MODE_ACTIVE_SHIFT 0
970
971/* Bit definitions for LDOUSB_VOLTAGE */
972#define PALMAS_LDOUSB_VOLTAGE_VSEL_MASK 0x3f
973#define PALMAS_LDOUSB_VOLTAGE_VSEL_SHIFT 0
974
975/* Bit definitions for LDO_CTRL */
976#define PALMAS_LDO_CTRL_LDOUSB_ON_VBUS_VSYS 0x01
977#define PALMAS_LDO_CTRL_LDOUSB_ON_VBUS_VSYS_SHIFT 0
978
979/* Bit definitions for LDO_PD_CTRL1 */
980#define PALMAS_LDO_PD_CTRL1_LDO8 0x80
981#define PALMAS_LDO_PD_CTRL1_LDO8_SHIFT 7
982#define PALMAS_LDO_PD_CTRL1_LDO7 0x40
983#define PALMAS_LDO_PD_CTRL1_LDO7_SHIFT 6
984#define PALMAS_LDO_PD_CTRL1_LDO6 0x20
985#define PALMAS_LDO_PD_CTRL1_LDO6_SHIFT 5
986#define PALMAS_LDO_PD_CTRL1_LDO5 0x10
987#define PALMAS_LDO_PD_CTRL1_LDO5_SHIFT 4
988#define PALMAS_LDO_PD_CTRL1_LDO4 0x08
989#define PALMAS_LDO_PD_CTRL1_LDO4_SHIFT 3
990#define PALMAS_LDO_PD_CTRL1_LDO3 0x04
991#define PALMAS_LDO_PD_CTRL1_LDO3_SHIFT 2
992#define PALMAS_LDO_PD_CTRL1_LDO2 0x02
993#define PALMAS_LDO_PD_CTRL1_LDO2_SHIFT 1
994#define PALMAS_LDO_PD_CTRL1_LDO1 0x01
995#define PALMAS_LDO_PD_CTRL1_LDO1_SHIFT 0
996
997/* Bit definitions for LDO_PD_CTRL2 */
998#define PALMAS_LDO_PD_CTRL2_LDOUSB 0x04
999#define PALMAS_LDO_PD_CTRL2_LDOUSB_SHIFT 2
1000#define PALMAS_LDO_PD_CTRL2_LDOLN 0x02
1001#define PALMAS_LDO_PD_CTRL2_LDOLN_SHIFT 1
1002#define PALMAS_LDO_PD_CTRL2_LDO9 0x01
1003#define PALMAS_LDO_PD_CTRL2_LDO9_SHIFT 0
1004
1005/* Bit definitions for LDO_SHORT_STATUS1 */
1006#define PALMAS_LDO_SHORT_STATUS1_LDO8 0x80
1007#define PALMAS_LDO_SHORT_STATUS1_LDO8_SHIFT 7
1008#define PALMAS_LDO_SHORT_STATUS1_LDO7 0x40
1009#define PALMAS_LDO_SHORT_STATUS1_LDO7_SHIFT 6
1010#define PALMAS_LDO_SHORT_STATUS1_LDO6 0x20
1011#define PALMAS_LDO_SHORT_STATUS1_LDO6_SHIFT 5
1012#define PALMAS_LDO_SHORT_STATUS1_LDO5 0x10
1013#define PALMAS_LDO_SHORT_STATUS1_LDO5_SHIFT 4
1014#define PALMAS_LDO_SHORT_STATUS1_LDO4 0x08
1015#define PALMAS_LDO_SHORT_STATUS1_LDO4_SHIFT 3
1016#define PALMAS_LDO_SHORT_STATUS1_LDO3 0x04
1017#define PALMAS_LDO_SHORT_STATUS1_LDO3_SHIFT 2
1018#define PALMAS_LDO_SHORT_STATUS1_LDO2 0x02
1019#define PALMAS_LDO_SHORT_STATUS1_LDO2_SHIFT 1
1020#define PALMAS_LDO_SHORT_STATUS1_LDO1 0x01
1021#define PALMAS_LDO_SHORT_STATUS1_LDO1_SHIFT 0
1022
1023/* Bit definitions for LDO_SHORT_STATUS2 */
1024#define PALMAS_LDO_SHORT_STATUS2_LDOVANA 0x08
1025#define PALMAS_LDO_SHORT_STATUS2_LDOVANA_SHIFT 3
1026#define PALMAS_LDO_SHORT_STATUS2_LDOUSB 0x04
1027#define PALMAS_LDO_SHORT_STATUS2_LDOUSB_SHIFT 2
1028#define PALMAS_LDO_SHORT_STATUS2_LDOLN 0x02
1029#define PALMAS_LDO_SHORT_STATUS2_LDOLN_SHIFT 1
1030#define PALMAS_LDO_SHORT_STATUS2_LDO9 0x01
1031#define PALMAS_LDO_SHORT_STATUS2_LDO9_SHIFT 0
1032
1033/* Registers for function PMU_CONTROL */
1034#define PALMAS_DEV_CTRL 0x0
1035#define PALMAS_POWER_CTRL 0x1
1036#define PALMAS_VSYS_LO 0x2
1037#define PALMAS_VSYS_MON 0x3
1038#define PALMAS_VBAT_MON 0x4
1039#define PALMAS_WATCHDOG 0x5
1040#define PALMAS_BOOT_STATUS 0x6
1041#define PALMAS_BATTERY_BOUNCE 0x7
1042#define PALMAS_BACKUP_BATTERY_CTRL 0x8
1043#define PALMAS_LONG_PRESS_KEY 0x9
1044#define PALMAS_OSC_THERM_CTRL 0xA
1045#define PALMAS_BATDEBOUNCING 0xB
1046#define PALMAS_SWOFF_HWRST 0xF
1047#define PALMAS_SWOFF_COLDRST 0x10
1048#define PALMAS_SWOFF_STATUS 0x11
1049#define PALMAS_PMU_CONFIG 0x12
1050#define PALMAS_SPARE 0x14
1051#define PALMAS_PMU_SECONDARY_INT 0x15
1052#define PALMAS_SW_REVISION 0x17
1053#define PALMAS_EXT_CHRG_CTRL 0x18
1054#define PALMAS_PMU_SECONDARY_INT2 0x19
1055
1056/* Bit definitions for DEV_CTRL */
1057#define PALMAS_DEV_CTRL_DEV_STATUS_MASK 0x0c
1058#define PALMAS_DEV_CTRL_DEV_STATUS_SHIFT 2
1059#define PALMAS_DEV_CTRL_SW_RST 0x02
1060#define PALMAS_DEV_CTRL_SW_RST_SHIFT 1
1061#define PALMAS_DEV_CTRL_DEV_ON 0x01
1062#define PALMAS_DEV_CTRL_DEV_ON_SHIFT 0
1063
1064/* Bit definitions for POWER_CTRL */
1065#define PALMAS_POWER_CTRL_ENABLE2_MASK 0x04
1066#define PALMAS_POWER_CTRL_ENABLE2_MASK_SHIFT 2
1067#define PALMAS_POWER_CTRL_ENABLE1_MASK 0x02
1068#define PALMAS_POWER_CTRL_ENABLE1_MASK_SHIFT 1
1069#define PALMAS_POWER_CTRL_NSLEEP_MASK 0x01
1070#define PALMAS_POWER_CTRL_NSLEEP_MASK_SHIFT 0
1071
1072/* Bit definitions for VSYS_LO */
1073#define PALMAS_VSYS_LO_THRESHOLD_MASK 0x1f
1074#define PALMAS_VSYS_LO_THRESHOLD_SHIFT 0
1075
1076/* Bit definitions for VSYS_MON */
1077#define PALMAS_VSYS_MON_ENABLE 0x80
1078#define PALMAS_VSYS_MON_ENABLE_SHIFT 7
1079#define PALMAS_VSYS_MON_THRESHOLD_MASK 0x3f
1080#define PALMAS_VSYS_MON_THRESHOLD_SHIFT 0
1081
1082/* Bit definitions for VBAT_MON */
1083#define PALMAS_VBAT_MON_ENABLE 0x80
1084#define PALMAS_VBAT_MON_ENABLE_SHIFT 7
1085#define PALMAS_VBAT_MON_THRESHOLD_MASK 0x3f
1086#define PALMAS_VBAT_MON_THRESHOLD_SHIFT 0
1087
1088/* Bit definitions for WATCHDOG */
1089#define PALMAS_WATCHDOG_LOCK 0x20
1090#define PALMAS_WATCHDOG_LOCK_SHIFT 5
1091#define PALMAS_WATCHDOG_ENABLE 0x10
1092#define PALMAS_WATCHDOG_ENABLE_SHIFT 4
1093#define PALMAS_WATCHDOG_MODE 0x08
1094#define PALMAS_WATCHDOG_MODE_SHIFT 3
1095#define PALMAS_WATCHDOG_TIMER_MASK 0x07
1096#define PALMAS_WATCHDOG_TIMER_SHIFT 0
1097
1098/* Bit definitions for BOOT_STATUS */
1099#define PALMAS_BOOT_STATUS_BOOT1 0x02
1100#define PALMAS_BOOT_STATUS_BOOT1_SHIFT 1
1101#define PALMAS_BOOT_STATUS_BOOT0 0x01
1102#define PALMAS_BOOT_STATUS_BOOT0_SHIFT 0
1103
1104/* Bit definitions for BATTERY_BOUNCE */
1105#define PALMAS_BATTERY_BOUNCE_BB_DELAY_MASK 0x3f
1106#define PALMAS_BATTERY_BOUNCE_BB_DELAY_SHIFT 0
1107
1108/* Bit definitions for BACKUP_BATTERY_CTRL */
1109#define PALMAS_BACKUP_BATTERY_CTRL_VRTC_18_15 0x80
1110#define PALMAS_BACKUP_BATTERY_CTRL_VRTC_18_15_SHIFT 7
1111#define PALMAS_BACKUP_BATTERY_CTRL_VRTC_EN_SLP 0x40
1112#define PALMAS_BACKUP_BATTERY_CTRL_VRTC_EN_SLP_SHIFT 6
1113#define PALMAS_BACKUP_BATTERY_CTRL_VRTC_EN_OFF 0x20
1114#define PALMAS_BACKUP_BATTERY_CTRL_VRTC_EN_OFF_SHIFT 5
1115#define PALMAS_BACKUP_BATTERY_CTRL_VRTC_PWEN 0x10
1116#define PALMAS_BACKUP_BATTERY_CTRL_VRTC_PWEN_SHIFT 4
1117#define PALMAS_BACKUP_BATTERY_CTRL_BBS_BBC_LOW_ICHRG 0x08
1118#define PALMAS_BACKUP_BATTERY_CTRL_BBS_BBC_LOW_ICHRG_SHIFT 3
1119#define PALMAS_BACKUP_BATTERY_CTRL_BB_SEL_MASK 0x06
1120#define PALMAS_BACKUP_BATTERY_CTRL_BB_SEL_SHIFT 1
1121#define PALMAS_BACKUP_BATTERY_CTRL_BB_CHG_EN 0x01
1122#define PALMAS_BACKUP_BATTERY_CTRL_BB_CHG_EN_SHIFT 0
1123
1124/* Bit definitions for LONG_PRESS_KEY */
1125#define PALMAS_LONG_PRESS_KEY_LPK_LOCK 0x80
1126#define PALMAS_LONG_PRESS_KEY_LPK_LOCK_SHIFT 7
1127#define PALMAS_LONG_PRESS_KEY_LPK_INT_CLR 0x10
1128#define PALMAS_LONG_PRESS_KEY_LPK_INT_CLR_SHIFT 4
1129#define PALMAS_LONG_PRESS_KEY_LPK_TIME_MASK 0x0c
1130#define PALMAS_LONG_PRESS_KEY_LPK_TIME_SHIFT 2
1131#define PALMAS_LONG_PRESS_KEY_PWRON_DEBOUNCE_MASK 0x03
1132#define PALMAS_LONG_PRESS_KEY_PWRON_DEBOUNCE_SHIFT 0
1133
1134/* Bit definitions for OSC_THERM_CTRL */
1135#define PALMAS_OSC_THERM_CTRL_VANA_ON_IN_SLEEP 0x80
1136#define PALMAS_OSC_THERM_CTRL_VANA_ON_IN_SLEEP_SHIFT 7
1137#define PALMAS_OSC_THERM_CTRL_INT_MASK_IN_SLEEP 0x40
1138#define PALMAS_OSC_THERM_CTRL_INT_MASK_IN_SLEEP_SHIFT 6
1139#define PALMAS_OSC_THERM_CTRL_RC15MHZ_ON_IN_SLEEP 0x20
1140#define PALMAS_OSC_THERM_CTRL_RC15MHZ_ON_IN_SLEEP_SHIFT 5
1141#define PALMAS_OSC_THERM_CTRL_THERM_OFF_IN_SLEEP 0x10
1142#define PALMAS_OSC_THERM_CTRL_THERM_OFF_IN_SLEEP_SHIFT 4
1143#define PALMAS_OSC_THERM_CTRL_THERM_HD_SEL_MASK 0x0c
1144#define PALMAS_OSC_THERM_CTRL_THERM_HD_SEL_SHIFT 2
1145#define PALMAS_OSC_THERM_CTRL_OSC_BYPASS 0x02
1146#define PALMAS_OSC_THERM_CTRL_OSC_BYPASS_SHIFT 1
1147#define PALMAS_OSC_THERM_CTRL_OSC_HPMODE 0x01
1148#define PALMAS_OSC_THERM_CTRL_OSC_HPMODE_SHIFT 0
1149
1150/* Bit definitions for BATDEBOUNCING */
1151#define PALMAS_BATDEBOUNCING_BAT_DEB_BYPASS 0x80
1152#define PALMAS_BATDEBOUNCING_BAT_DEB_BYPASS_SHIFT 7
1153#define PALMAS_BATDEBOUNCING_BINS_DEB_MASK 0x78
1154#define PALMAS_BATDEBOUNCING_BINS_DEB_SHIFT 3
1155#define PALMAS_BATDEBOUNCING_BEXT_DEB_MASK 0x07
1156#define PALMAS_BATDEBOUNCING_BEXT_DEB_SHIFT 0
1157
1158/* Bit definitions for SWOFF_HWRST */
1159#define PALMAS_SWOFF_HWRST_PWRON_LPK 0x80
1160#define PALMAS_SWOFF_HWRST_PWRON_LPK_SHIFT 7
1161#define PALMAS_SWOFF_HWRST_PWRDOWN 0x40
1162#define PALMAS_SWOFF_HWRST_PWRDOWN_SHIFT 6
1163#define PALMAS_SWOFF_HWRST_WTD 0x20
1164#define PALMAS_SWOFF_HWRST_WTD_SHIFT 5
1165#define PALMAS_SWOFF_HWRST_TSHUT 0x10
1166#define PALMAS_SWOFF_HWRST_TSHUT_SHIFT 4
1167#define PALMAS_SWOFF_HWRST_RESET_IN 0x08
1168#define PALMAS_SWOFF_HWRST_RESET_IN_SHIFT 3
1169#define PALMAS_SWOFF_HWRST_SW_RST 0x04
1170#define PALMAS_SWOFF_HWRST_SW_RST_SHIFT 2
1171#define PALMAS_SWOFF_HWRST_VSYS_LO 0x02
1172#define PALMAS_SWOFF_HWRST_VSYS_LO_SHIFT 1
1173#define PALMAS_SWOFF_HWRST_GPADC_SHUTDOWN 0x01
1174#define PALMAS_SWOFF_HWRST_GPADC_SHUTDOWN_SHIFT 0
1175
1176/* Bit definitions for SWOFF_COLDRST */
1177#define PALMAS_SWOFF_COLDRST_PWRON_LPK 0x80
1178#define PALMAS_SWOFF_COLDRST_PWRON_LPK_SHIFT 7
1179#define PALMAS_SWOFF_COLDRST_PWRDOWN 0x40
1180#define PALMAS_SWOFF_COLDRST_PWRDOWN_SHIFT 6
1181#define PALMAS_SWOFF_COLDRST_WTD 0x20
1182#define PALMAS_SWOFF_COLDRST_WTD_SHIFT 5
1183#define PALMAS_SWOFF_COLDRST_TSHUT 0x10
1184#define PALMAS_SWOFF_COLDRST_TSHUT_SHIFT 4
1185#define PALMAS_SWOFF_COLDRST_RESET_IN 0x08
1186#define PALMAS_SWOFF_COLDRST_RESET_IN_SHIFT 3
1187#define PALMAS_SWOFF_COLDRST_SW_RST 0x04
1188#define PALMAS_SWOFF_COLDRST_SW_RST_SHIFT 2
1189#define PALMAS_SWOFF_COLDRST_VSYS_LO 0x02
1190#define PALMAS_SWOFF_COLDRST_VSYS_LO_SHIFT 1
1191#define PALMAS_SWOFF_COLDRST_GPADC_SHUTDOWN 0x01
1192#define PALMAS_SWOFF_COLDRST_GPADC_SHUTDOWN_SHIFT 0
1193
1194/* Bit definitions for SWOFF_STATUS */
1195#define PALMAS_SWOFF_STATUS_PWRON_LPK 0x80
1196#define PALMAS_SWOFF_STATUS_PWRON_LPK_SHIFT 7
1197#define PALMAS_SWOFF_STATUS_PWRDOWN 0x40
1198#define PALMAS_SWOFF_STATUS_PWRDOWN_SHIFT 6
1199#define PALMAS_SWOFF_STATUS_WTD 0x20
1200#define PALMAS_SWOFF_STATUS_WTD_SHIFT 5
1201#define PALMAS_SWOFF_STATUS_TSHUT 0x10
1202#define PALMAS_SWOFF_STATUS_TSHUT_SHIFT 4
1203#define PALMAS_SWOFF_STATUS_RESET_IN 0x08
1204#define PALMAS_SWOFF_STATUS_RESET_IN_SHIFT 3
1205#define PALMAS_SWOFF_STATUS_SW_RST 0x04
1206#define PALMAS_SWOFF_STATUS_SW_RST_SHIFT 2
1207#define PALMAS_SWOFF_STATUS_VSYS_LO 0x02
1208#define PALMAS_SWOFF_STATUS_VSYS_LO_SHIFT 1
1209#define PALMAS_SWOFF_STATUS_GPADC_SHUTDOWN 0x01
1210#define PALMAS_SWOFF_STATUS_GPADC_SHUTDOWN_SHIFT 0
1211
1212/* Bit definitions for PMU_CONFIG */
1213#define PALMAS_PMU_CONFIG_MULTI_CELL_EN 0x40
1214#define PALMAS_PMU_CONFIG_MULTI_CELL_EN_SHIFT 6
1215#define PALMAS_PMU_CONFIG_SPARE_MASK 0x30
1216#define PALMAS_PMU_CONFIG_SPARE_SHIFT 4
1217#define PALMAS_PMU_CONFIG_SWOFF_DLY_MASK 0x0c
1218#define PALMAS_PMU_CONFIG_SWOFF_DLY_SHIFT 2
1219#define PALMAS_PMU_CONFIG_GATE_RESET_OUT 0x02
1220#define PALMAS_PMU_CONFIG_GATE_RESET_OUT_SHIFT 1
1221#define PALMAS_PMU_CONFIG_AUTODEVON 0x01
1222#define PALMAS_PMU_CONFIG_AUTODEVON_SHIFT 0
1223
1224/* Bit definitions for SPARE */
1225#define PALMAS_SPARE_SPARE_MASK 0xf8
1226#define PALMAS_SPARE_SPARE_SHIFT 3
1227#define PALMAS_SPARE_REGEN3_OD 0x04
1228#define PALMAS_SPARE_REGEN3_OD_SHIFT 2
1229#define PALMAS_SPARE_REGEN2_OD 0x02
1230#define PALMAS_SPARE_REGEN2_OD_SHIFT 1
1231#define PALMAS_SPARE_REGEN1_OD 0x01
1232#define PALMAS_SPARE_REGEN1_OD_SHIFT 0
1233
1234/* Bit definitions for PMU_SECONDARY_INT */
1235#define PALMAS_PMU_SECONDARY_INT_VBUS_OVV_INT_SRC 0x80
1236#define PALMAS_PMU_SECONDARY_INT_VBUS_OVV_INT_SRC_SHIFT 7
1237#define PALMAS_PMU_SECONDARY_INT_CHARG_DET_N_INT_SRC 0x40
1238#define PALMAS_PMU_SECONDARY_INT_CHARG_DET_N_INT_SRC_SHIFT 6
1239#define PALMAS_PMU_SECONDARY_INT_BB_INT_SRC 0x20
1240#define PALMAS_PMU_SECONDARY_INT_BB_INT_SRC_SHIFT 5
1241#define PALMAS_PMU_SECONDARY_INT_FBI_INT_SRC 0x10
1242#define PALMAS_PMU_SECONDARY_INT_FBI_INT_SRC_SHIFT 4
1243#define PALMAS_PMU_SECONDARY_INT_VBUS_OVV_MASK 0x08
1244#define PALMAS_PMU_SECONDARY_INT_VBUS_OVV_MASK_SHIFT 3
1245#define PALMAS_PMU_SECONDARY_INT_CHARG_DET_N_MASK 0x04
1246#define PALMAS_PMU_SECONDARY_INT_CHARG_DET_N_MASK_SHIFT 2
1247#define PALMAS_PMU_SECONDARY_INT_BB_MASK 0x02
1248#define PALMAS_PMU_SECONDARY_INT_BB_MASK_SHIFT 1
1249#define PALMAS_PMU_SECONDARY_INT_FBI_MASK 0x01
1250#define PALMAS_PMU_SECONDARY_INT_FBI_MASK_SHIFT 0
1251
1252/* Bit definitions for SW_REVISION */
1253#define PALMAS_SW_REVISION_SW_REVISION_MASK 0xff
1254#define PALMAS_SW_REVISION_SW_REVISION_SHIFT 0
1255
1256/* Bit definitions for EXT_CHRG_CTRL */
1257#define PALMAS_EXT_CHRG_CTRL_VBUS_OVV_STATUS 0x80
1258#define PALMAS_EXT_CHRG_CTRL_VBUS_OVV_STATUS_SHIFT 7
1259#define PALMAS_EXT_CHRG_CTRL_CHARG_DET_N_STATUS 0x40
1260#define PALMAS_EXT_CHRG_CTRL_CHARG_DET_N_STATUS_SHIFT 6
1261#define PALMAS_EXT_CHRG_CTRL_VSYS_DEBOUNCE_DELAY 0x08
1262#define PALMAS_EXT_CHRG_CTRL_VSYS_DEBOUNCE_DELAY_SHIFT 3
1263#define PALMAS_EXT_CHRG_CTRL_CHRG_DET_N 0x04
1264#define PALMAS_EXT_CHRG_CTRL_CHRG_DET_N_SHIFT 2
1265#define PALMAS_EXT_CHRG_CTRL_AUTO_ACA_EN 0x02
1266#define PALMAS_EXT_CHRG_CTRL_AUTO_ACA_EN_SHIFT 1
1267#define PALMAS_EXT_CHRG_CTRL_AUTO_LDOUSB_EN 0x01
1268#define PALMAS_EXT_CHRG_CTRL_AUTO_LDOUSB_EN_SHIFT 0
1269
1270/* Bit definitions for PMU_SECONDARY_INT2 */
1271#define PALMAS_PMU_SECONDARY_INT2_DVFS2_INT_SRC 0x20
1272#define PALMAS_PMU_SECONDARY_INT2_DVFS2_INT_SRC_SHIFT 5
1273#define PALMAS_PMU_SECONDARY_INT2_DVFS1_INT_SRC 0x10
1274#define PALMAS_PMU_SECONDARY_INT2_DVFS1_INT_SRC_SHIFT 4
1275#define PALMAS_PMU_SECONDARY_INT2_DVFS2_MASK 0x02
1276#define PALMAS_PMU_SECONDARY_INT2_DVFS2_MASK_SHIFT 1
1277#define PALMAS_PMU_SECONDARY_INT2_DVFS1_MASK 0x01
1278#define PALMAS_PMU_SECONDARY_INT2_DVFS1_MASK_SHIFT 0
1279
1280/* Registers for function RESOURCE */
1281#define PALMAS_CLK32KG_CTRL 0x0
1282#define PALMAS_CLK32KGAUDIO_CTRL 0x1
1283#define PALMAS_REGEN1_CTRL 0x2
1284#define PALMAS_REGEN2_CTRL 0x3
1285#define PALMAS_SYSEN1_CTRL 0x4
1286#define PALMAS_SYSEN2_CTRL 0x5
1287#define PALMAS_NSLEEP_RES_ASSIGN 0x6
1288#define PALMAS_NSLEEP_SMPS_ASSIGN 0x7
1289#define PALMAS_NSLEEP_LDO_ASSIGN1 0x8
1290#define PALMAS_NSLEEP_LDO_ASSIGN2 0x9
1291#define PALMAS_ENABLE1_RES_ASSIGN 0xA
1292#define PALMAS_ENABLE1_SMPS_ASSIGN 0xB
1293#define PALMAS_ENABLE1_LDO_ASSIGN1 0xC
1294#define PALMAS_ENABLE1_LDO_ASSIGN2 0xD
1295#define PALMAS_ENABLE2_RES_ASSIGN 0xE
1296#define PALMAS_ENABLE2_SMPS_ASSIGN 0xF
1297#define PALMAS_ENABLE2_LDO_ASSIGN1 0x10
1298#define PALMAS_ENABLE2_LDO_ASSIGN2 0x11
1299#define PALMAS_REGEN3_CTRL 0x12
1300
1301/* Bit definitions for CLK32KG_CTRL */
1302#define PALMAS_CLK32KG_CTRL_STATUS 0x10
1303#define PALMAS_CLK32KG_CTRL_STATUS_SHIFT 4
1304#define PALMAS_CLK32KG_CTRL_MODE_SLEEP 0x04
1305#define PALMAS_CLK32KG_CTRL_MODE_SLEEP_SHIFT 2
1306#define PALMAS_CLK32KG_CTRL_MODE_ACTIVE 0x01
1307#define PALMAS_CLK32KG_CTRL_MODE_ACTIVE_SHIFT 0
1308
1309/* Bit definitions for CLK32KGAUDIO_CTRL */
1310#define PALMAS_CLK32KGAUDIO_CTRL_STATUS 0x10
1311#define PALMAS_CLK32KGAUDIO_CTRL_STATUS_SHIFT 4
1312#define PALMAS_CLK32KGAUDIO_CTRL_RESERVED3 0x08
1313#define PALMAS_CLK32KGAUDIO_CTRL_RESERVED3_SHIFT 3
1314#define PALMAS_CLK32KGAUDIO_CTRL_MODE_SLEEP 0x04
1315#define PALMAS_CLK32KGAUDIO_CTRL_MODE_SLEEP_SHIFT 2
1316#define PALMAS_CLK32KGAUDIO_CTRL_MODE_ACTIVE 0x01
1317#define PALMAS_CLK32KGAUDIO_CTRL_MODE_ACTIVE_SHIFT 0
1318
1319/* Bit definitions for REGEN1_CTRL */
1320#define PALMAS_REGEN1_CTRL_STATUS 0x10
1321#define PALMAS_REGEN1_CTRL_STATUS_SHIFT 4
1322#define PALMAS_REGEN1_CTRL_MODE_SLEEP 0x04
1323#define PALMAS_REGEN1_CTRL_MODE_SLEEP_SHIFT 2
1324#define PALMAS_REGEN1_CTRL_MODE_ACTIVE 0x01
1325#define PALMAS_REGEN1_CTRL_MODE_ACTIVE_SHIFT 0
1326
1327/* Bit definitions for REGEN2_CTRL */
1328#define PALMAS_REGEN2_CTRL_STATUS 0x10
1329#define PALMAS_REGEN2_CTRL_STATUS_SHIFT 4
1330#define PALMAS_REGEN2_CTRL_MODE_SLEEP 0x04
1331#define PALMAS_REGEN2_CTRL_MODE_SLEEP_SHIFT 2
1332#define PALMAS_REGEN2_CTRL_MODE_ACTIVE 0x01
1333#define PALMAS_REGEN2_CTRL_MODE_ACTIVE_SHIFT 0
1334
1335/* Bit definitions for SYSEN1_CTRL */
1336#define PALMAS_SYSEN1_CTRL_STATUS 0x10
1337#define PALMAS_SYSEN1_CTRL_STATUS_SHIFT 4
1338#define PALMAS_SYSEN1_CTRL_MODE_SLEEP 0x04
1339#define PALMAS_SYSEN1_CTRL_MODE_SLEEP_SHIFT 2
1340#define PALMAS_SYSEN1_CTRL_MODE_ACTIVE 0x01
1341#define PALMAS_SYSEN1_CTRL_MODE_ACTIVE_SHIFT 0
1342
1343/* Bit definitions for SYSEN2_CTRL */
1344#define PALMAS_SYSEN2_CTRL_STATUS 0x10
1345#define PALMAS_SYSEN2_CTRL_STATUS_SHIFT 4
1346#define PALMAS_SYSEN2_CTRL_MODE_SLEEP 0x04
1347#define PALMAS_SYSEN2_CTRL_MODE_SLEEP_SHIFT 2
1348#define PALMAS_SYSEN2_CTRL_MODE_ACTIVE 0x01
1349#define PALMAS_SYSEN2_CTRL_MODE_ACTIVE_SHIFT 0
1350
1351/* Bit definitions for NSLEEP_RES_ASSIGN */
1352#define PALMAS_NSLEEP_RES_ASSIGN_REGEN3 0x40
1353#define PALMAS_NSLEEP_RES_ASSIGN_REGEN3_SHIFT 6
1354#define PALMAS_NSLEEP_RES_ASSIGN_CLK32KGAUDIO 0x20
1355#define PALMAS_NSLEEP_RES_ASSIGN_CLK32KGAUDIO_SHIFT 5
1356#define PALMAS_NSLEEP_RES_ASSIGN_CLK32KG 0x10
1357#define PALMAS_NSLEEP_RES_ASSIGN_CLK32KG_SHIFT 4
1358#define PALMAS_NSLEEP_RES_ASSIGN_SYSEN2 0x08
1359#define PALMAS_NSLEEP_RES_ASSIGN_SYSEN2_SHIFT 3
1360#define PALMAS_NSLEEP_RES_ASSIGN_SYSEN1 0x04
1361#define PALMAS_NSLEEP_RES_ASSIGN_SYSEN1_SHIFT 2
1362#define PALMAS_NSLEEP_RES_ASSIGN_REGEN2 0x02
1363#define PALMAS_NSLEEP_RES_ASSIGN_REGEN2_SHIFT 1
1364#define PALMAS_NSLEEP_RES_ASSIGN_REGEN1 0x01
1365#define PALMAS_NSLEEP_RES_ASSIGN_REGEN1_SHIFT 0
1366
1367/* Bit definitions for NSLEEP_SMPS_ASSIGN */
1368#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS10 0x80
1369#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS10_SHIFT 7
1370#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS9 0x40
1371#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS9_SHIFT 6
1372#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS8 0x20
1373#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS8_SHIFT 5
1374#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS7 0x10
1375#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS7_SHIFT 4
1376#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS6 0x08
1377#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS6_SHIFT 3
1378#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS45 0x04
1379#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS45_SHIFT 2
1380#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS3 0x02
1381#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS3_SHIFT 1
1382#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS12 0x01
1383#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS12_SHIFT 0
1384
1385/* Bit definitions for NSLEEP_LDO_ASSIGN1 */
1386#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO8 0x80
1387#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO8_SHIFT 7
1388#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO7 0x40
1389#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO7_SHIFT 6
1390#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO6 0x20
1391#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO6_SHIFT 5
1392#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO5 0x10
1393#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO5_SHIFT 4
1394#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO4 0x08
1395#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO4_SHIFT 3
1396#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO3 0x04
1397#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO3_SHIFT 2
1398#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO2 0x02
1399#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO2_SHIFT 1
1400#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO1 0x01
1401#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO1_SHIFT 0
1402
1403/* Bit definitions for NSLEEP_LDO_ASSIGN2 */
1404#define PALMAS_NSLEEP_LDO_ASSIGN2_LDOUSB 0x04
1405#define PALMAS_NSLEEP_LDO_ASSIGN2_LDOUSB_SHIFT 2
1406#define PALMAS_NSLEEP_LDO_ASSIGN2_LDOLN 0x02
1407#define PALMAS_NSLEEP_LDO_ASSIGN2_LDOLN_SHIFT 1
1408#define PALMAS_NSLEEP_LDO_ASSIGN2_LDO9 0x01
1409#define PALMAS_NSLEEP_LDO_ASSIGN2_LDO9_SHIFT 0
1410
1411/* Bit definitions for ENABLE1_RES_ASSIGN */
1412#define PALMAS_ENABLE1_RES_ASSIGN_REGEN3 0x40
1413#define PALMAS_ENABLE1_RES_ASSIGN_REGEN3_SHIFT 6
1414#define PALMAS_ENABLE1_RES_ASSIGN_CLK32KGAUDIO 0x20
1415#define PALMAS_ENABLE1_RES_ASSIGN_CLK32KGAUDIO_SHIFT 5
1416#define PALMAS_ENABLE1_RES_ASSIGN_CLK32KG 0x10
1417#define PALMAS_ENABLE1_RES_ASSIGN_CLK32KG_SHIFT 4
1418#define PALMAS_ENABLE1_RES_ASSIGN_SYSEN2 0x08
1419#define PALMAS_ENABLE1_RES_ASSIGN_SYSEN2_SHIFT 3
1420#define PALMAS_ENABLE1_RES_ASSIGN_SYSEN1 0x04
1421#define PALMAS_ENABLE1_RES_ASSIGN_SYSEN1_SHIFT 2
1422#define PALMAS_ENABLE1_RES_ASSIGN_REGEN2 0x02
1423#define PALMAS_ENABLE1_RES_ASSIGN_REGEN2_SHIFT 1
1424#define PALMAS_ENABLE1_RES_ASSIGN_REGEN1 0x01
1425#define PALMAS_ENABLE1_RES_ASSIGN_REGEN1_SHIFT 0
1426
1427/* Bit definitions for ENABLE1_SMPS_ASSIGN */
1428#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS10 0x80
1429#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS10_SHIFT 7
1430#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS9 0x40
1431#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS9_SHIFT 6
1432#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS8 0x20
1433#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS8_SHIFT 5
1434#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS7 0x10
1435#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS7_SHIFT 4
1436#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS6 0x08
1437#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS6_SHIFT 3
1438#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS45 0x04
1439#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS45_SHIFT 2
1440#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS3 0x02
1441#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS3_SHIFT 1
1442#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS12 0x01
1443#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS12_SHIFT 0
1444
1445/* Bit definitions for ENABLE1_LDO_ASSIGN1 */
1446#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO8 0x80
1447#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO8_SHIFT 7
1448#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO7 0x40
1449#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO7_SHIFT 6
1450#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO6 0x20
1451#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO6_SHIFT 5
1452#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO5 0x10
1453#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO5_SHIFT 4
1454#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO4 0x08
1455#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO4_SHIFT 3
1456#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO3 0x04
1457#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO3_SHIFT 2
1458#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO2 0x02
1459#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO2_SHIFT 1
1460#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO1 0x01
1461#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO1_SHIFT 0
1462
1463/* Bit definitions for ENABLE1_LDO_ASSIGN2 */
1464#define PALMAS_ENABLE1_LDO_ASSIGN2_LDOUSB 0x04
1465#define PALMAS_ENABLE1_LDO_ASSIGN2_LDOUSB_SHIFT 2
1466#define PALMAS_ENABLE1_LDO_ASSIGN2_LDOLN 0x02
1467#define PALMAS_ENABLE1_LDO_ASSIGN2_LDOLN_SHIFT 1
1468#define PALMAS_ENABLE1_LDO_ASSIGN2_LDO9 0x01
1469#define PALMAS_ENABLE1_LDO_ASSIGN2_LDO9_SHIFT 0
1470
1471/* Bit definitions for ENABLE2_RES_ASSIGN */
1472#define PALMAS_ENABLE2_RES_ASSIGN_REGEN3 0x40
1473#define PALMAS_ENABLE2_RES_ASSIGN_REGEN3_SHIFT 6
1474#define PALMAS_ENABLE2_RES_ASSIGN_CLK32KGAUDIO 0x20
1475#define PALMAS_ENABLE2_RES_ASSIGN_CLK32KGAUDIO_SHIFT 5
1476#define PALMAS_ENABLE2_RES_ASSIGN_CLK32KG 0x10
1477#define PALMAS_ENABLE2_RES_ASSIGN_CLK32KG_SHIFT 4
1478#define PALMAS_ENABLE2_RES_ASSIGN_SYSEN2 0x08
1479#define PALMAS_ENABLE2_RES_ASSIGN_SYSEN2_SHIFT 3
1480#define PALMAS_ENABLE2_RES_ASSIGN_SYSEN1 0x04
1481#define PALMAS_ENABLE2_RES_ASSIGN_SYSEN1_SHIFT 2
1482#define PALMAS_ENABLE2_RES_ASSIGN_REGEN2 0x02
1483#define PALMAS_ENABLE2_RES_ASSIGN_REGEN2_SHIFT 1
1484#define PALMAS_ENABLE2_RES_ASSIGN_REGEN1 0x01
1485#define PALMAS_ENABLE2_RES_ASSIGN_REGEN1_SHIFT 0
1486
1487/* Bit definitions for ENABLE2_SMPS_ASSIGN */
1488#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS10 0x80
1489#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS10_SHIFT 7
1490#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS9 0x40
1491#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS9_SHIFT 6
1492#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS8 0x20
1493#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS8_SHIFT 5
1494#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS7 0x10
1495#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS7_SHIFT 4
1496#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS6 0x08
1497#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS6_SHIFT 3
1498#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS45 0x04
1499#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS45_SHIFT 2
1500#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS3 0x02
1501#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS3_SHIFT 1
1502#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS12 0x01
1503#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS12_SHIFT 0
1504
1505/* Bit definitions for ENABLE2_LDO_ASSIGN1 */
1506#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO8 0x80
1507#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO8_SHIFT 7
1508#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO7 0x40
1509#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO7_SHIFT 6
1510#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO6 0x20
1511#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO6_SHIFT 5
1512#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO5 0x10
1513#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO5_SHIFT 4
1514#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO4 0x08
1515#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO4_SHIFT 3
1516#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO3 0x04
1517#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO3_SHIFT 2
1518#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO2 0x02
1519#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO2_SHIFT 1
1520#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO1 0x01
1521#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO1_SHIFT 0
1522
1523/* Bit definitions for ENABLE2_LDO_ASSIGN2 */
1524#define PALMAS_ENABLE2_LDO_ASSIGN2_LDOUSB 0x04
1525#define PALMAS_ENABLE2_LDO_ASSIGN2_LDOUSB_SHIFT 2
1526#define PALMAS_ENABLE2_LDO_ASSIGN2_LDOLN 0x02
1527#define PALMAS_ENABLE2_LDO_ASSIGN2_LDOLN_SHIFT 1
1528#define PALMAS_ENABLE2_LDO_ASSIGN2_LDO9 0x01
1529#define PALMAS_ENABLE2_LDO_ASSIGN2_LDO9_SHIFT 0
1530
1531/* Bit definitions for REGEN3_CTRL */
1532#define PALMAS_REGEN3_CTRL_STATUS 0x10
1533#define PALMAS_REGEN3_CTRL_STATUS_SHIFT 4
1534#define PALMAS_REGEN3_CTRL_MODE_SLEEP 0x04
1535#define PALMAS_REGEN3_CTRL_MODE_SLEEP_SHIFT 2
1536#define PALMAS_REGEN3_CTRL_MODE_ACTIVE 0x01
1537#define PALMAS_REGEN3_CTRL_MODE_ACTIVE_SHIFT 0
1538
1539/* Registers for function PAD_CONTROL */
1540#define PALMAS_PU_PD_INPUT_CTRL1 0x0
1541#define PALMAS_PU_PD_INPUT_CTRL2 0x1
1542#define PALMAS_PU_PD_INPUT_CTRL3 0x2
1543#define PALMAS_OD_OUTPUT_CTRL 0x4
1544#define PALMAS_POLARITY_CTRL 0x5
1545#define PALMAS_PRIMARY_SECONDARY_PAD1 0x6
1546#define PALMAS_PRIMARY_SECONDARY_PAD2 0x7
1547#define PALMAS_I2C_SPI 0x8
1548#define PALMAS_PU_PD_INPUT_CTRL4 0x9
1549#define PALMAS_PRIMARY_SECONDARY_PAD3 0xA
1550
1551/* Bit definitions for PU_PD_INPUT_CTRL1 */
1552#define PALMAS_PU_PD_INPUT_CTRL1_RESET_IN_PD 0x40
1553#define PALMAS_PU_PD_INPUT_CTRL1_RESET_IN_PD_SHIFT 6
1554#define PALMAS_PU_PD_INPUT_CTRL1_GPADC_START_PU 0x20
1555#define PALMAS_PU_PD_INPUT_CTRL1_GPADC_START_PU_SHIFT 5
1556#define PALMAS_PU_PD_INPUT_CTRL1_GPADC_START_PD 0x10
1557#define PALMAS_PU_PD_INPUT_CTRL1_GPADC_START_PD_SHIFT 4
1558#define PALMAS_PU_PD_INPUT_CTRL1_PWRDOWN_PD 0x04
1559#define PALMAS_PU_PD_INPUT_CTRL1_PWRDOWN_PD_SHIFT 2
1560#define PALMAS_PU_PD_INPUT_CTRL1_NRESWARM_PU 0x02
1561#define PALMAS_PU_PD_INPUT_CTRL1_NRESWARM_PU_SHIFT 1
1562
1563/* Bit definitions for PU_PD_INPUT_CTRL2 */
1564#define PALMAS_PU_PD_INPUT_CTRL2_ENABLE2_PU 0x20
1565#define PALMAS_PU_PD_INPUT_CTRL2_ENABLE2_PU_SHIFT 5
1566#define PALMAS_PU_PD_INPUT_CTRL2_ENABLE2_PD 0x10
1567#define PALMAS_PU_PD_INPUT_CTRL2_ENABLE2_PD_SHIFT 4
1568#define PALMAS_PU_PD_INPUT_CTRL2_ENABLE1_PU 0x08
1569#define PALMAS_PU_PD_INPUT_CTRL2_ENABLE1_PU_SHIFT 3
1570#define PALMAS_PU_PD_INPUT_CTRL2_ENABLE1_PD 0x04
1571#define PALMAS_PU_PD_INPUT_CTRL2_ENABLE1_PD_SHIFT 2
1572#define PALMAS_PU_PD_INPUT_CTRL2_NSLEEP_PU 0x02
1573#define PALMAS_PU_PD_INPUT_CTRL2_NSLEEP_PU_SHIFT 1
1574#define PALMAS_PU_PD_INPUT_CTRL2_NSLEEP_PD 0x01
1575#define PALMAS_PU_PD_INPUT_CTRL2_NSLEEP_PD_SHIFT 0
1576
1577/* Bit definitions for PU_PD_INPUT_CTRL3 */
1578#define PALMAS_PU_PD_INPUT_CTRL3_ACOK_PD 0x40
1579#define PALMAS_PU_PD_INPUT_CTRL3_ACOK_PD_SHIFT 6
1580#define PALMAS_PU_PD_INPUT_CTRL3_CHRG_DET_N_PD 0x10
1581#define PALMAS_PU_PD_INPUT_CTRL3_CHRG_DET_N_PD_SHIFT 4
1582#define PALMAS_PU_PD_INPUT_CTRL3_POWERHOLD_PD 0x04
1583#define PALMAS_PU_PD_INPUT_CTRL3_POWERHOLD_PD_SHIFT 2
1584#define PALMAS_PU_PD_INPUT_CTRL3_MSECURE_PD 0x01
1585#define PALMAS_PU_PD_INPUT_CTRL3_MSECURE_PD_SHIFT 0
1586
1587/* Bit definitions for OD_OUTPUT_CTRL */
1588#define PALMAS_OD_OUTPUT_CTRL_PWM_2_OD 0x80
1589#define PALMAS_OD_OUTPUT_CTRL_PWM_2_OD_SHIFT 7
1590#define PALMAS_OD_OUTPUT_CTRL_VBUSDET_OD 0x40
1591#define PALMAS_OD_OUTPUT_CTRL_VBUSDET_OD_SHIFT 6
1592#define PALMAS_OD_OUTPUT_CTRL_PWM_1_OD 0x20
1593#define PALMAS_OD_OUTPUT_CTRL_PWM_1_OD_SHIFT 5
1594#define PALMAS_OD_OUTPUT_CTRL_INT_OD 0x08
1595#define PALMAS_OD_OUTPUT_CTRL_INT_OD_SHIFT 3
1596
1597/* Bit definitions for POLARITY_CTRL */
1598#define PALMAS_POLARITY_CTRL_INT_POLARITY 0x80
1599#define PALMAS_POLARITY_CTRL_INT_POLARITY_SHIFT 7
1600#define PALMAS_POLARITY_CTRL_ENABLE2_POLARITY 0x40
1601#define PALMAS_POLARITY_CTRL_ENABLE2_POLARITY_SHIFT 6
1602#define PALMAS_POLARITY_CTRL_ENABLE1_POLARITY 0x20
1603#define PALMAS_POLARITY_CTRL_ENABLE1_POLARITY_SHIFT 5
1604#define PALMAS_POLARITY_CTRL_NSLEEP_POLARITY 0x10
1605#define PALMAS_POLARITY_CTRL_NSLEEP_POLARITY_SHIFT 4
1606#define PALMAS_POLARITY_CTRL_RESET_IN_POLARITY 0x08
1607#define PALMAS_POLARITY_CTRL_RESET_IN_POLARITY_SHIFT 3
1608#define PALMAS_POLARITY_CTRL_GPIO_3_CHRG_DET_N_POLARITY 0x04
1609#define PALMAS_POLARITY_CTRL_GPIO_3_CHRG_DET_N_POLARITY_SHIFT 2
1610#define PALMAS_POLARITY_CTRL_POWERGOOD_USB_PSEL_POLARITY 0x02
1611#define PALMAS_POLARITY_CTRL_POWERGOOD_USB_PSEL_POLARITY_SHIFT 1
1612#define PALMAS_POLARITY_CTRL_PWRDOWN_POLARITY 0x01
1613#define PALMAS_POLARITY_CTRL_PWRDOWN_POLARITY_SHIFT 0
1614
1615/* Bit definitions for PRIMARY_SECONDARY_PAD1 */
1616#define PALMAS_PRIMARY_SECONDARY_PAD1_GPIO_3 0x80
1617#define PALMAS_PRIMARY_SECONDARY_PAD1_GPIO_3_SHIFT 7
1618#define PALMAS_PRIMARY_SECONDARY_PAD1_GPIO_2_MASK 0x60
1619#define PALMAS_PRIMARY_SECONDARY_PAD1_GPIO_2_SHIFT 5
1620#define PALMAS_PRIMARY_SECONDARY_PAD1_GPIO_1_MASK 0x18
1621#define PALMAS_PRIMARY_SECONDARY_PAD1_GPIO_1_SHIFT 3
1622#define PALMAS_PRIMARY_SECONDARY_PAD1_GPIO_0 0x04
1623#define PALMAS_PRIMARY_SECONDARY_PAD1_GPIO_0_SHIFT 2
1624#define PALMAS_PRIMARY_SECONDARY_PAD1_VAC 0x02
1625#define PALMAS_PRIMARY_SECONDARY_PAD1_VAC_SHIFT 1
1626#define PALMAS_PRIMARY_SECONDARY_PAD1_POWERGOOD 0x01
1627#define PALMAS_PRIMARY_SECONDARY_PAD1_POWERGOOD_SHIFT 0
1628
1629/* Bit definitions for PRIMARY_SECONDARY_PAD2 */
1630#define PALMAS_PRIMARY_SECONDARY_PAD2_GPIO_7_MASK 0x30
1631#define PALMAS_PRIMARY_SECONDARY_PAD2_GPIO_7_SHIFT 4
1632#define PALMAS_PRIMARY_SECONDARY_PAD2_GPIO_6 0x08
1633#define PALMAS_PRIMARY_SECONDARY_PAD2_GPIO_6_SHIFT 3
1634#define PALMAS_PRIMARY_SECONDARY_PAD2_GPIO_5_MASK 0x06
1635#define PALMAS_PRIMARY_SECONDARY_PAD2_GPIO_5_SHIFT 1
1636#define PALMAS_PRIMARY_SECONDARY_PAD2_GPIO_4 0x01
1637#define PALMAS_PRIMARY_SECONDARY_PAD2_GPIO_4_SHIFT 0
1638
1639/* Bit definitions for I2C_SPI */
1640#define PALMAS_I2C_SPI_I2C2OTP_EN 0x80
1641#define PALMAS_I2C_SPI_I2C2OTP_EN_SHIFT 7
1642#define PALMAS_I2C_SPI_I2C2OTP_PAGESEL 0x40
1643#define PALMAS_I2C_SPI_I2C2OTP_PAGESEL_SHIFT 6
1644#define PALMAS_I2C_SPI_ID_I2C2 0x20
1645#define PALMAS_I2C_SPI_ID_I2C2_SHIFT 5
1646#define PALMAS_I2C_SPI_I2C_SPI 0x10
1647#define PALMAS_I2C_SPI_I2C_SPI_SHIFT 4
1648#define PALMAS_I2C_SPI_ID_I2C1_MASK 0x0f
1649#define PALMAS_I2C_SPI_ID_I2C1_SHIFT 0
1650
1651/* Bit definitions for PU_PD_INPUT_CTRL4 */
1652#define PALMAS_PU_PD_INPUT_CTRL4_DVFS2_DAT_PD 0x40
1653#define PALMAS_PU_PD_INPUT_CTRL4_DVFS2_DAT_PD_SHIFT 6
1654#define PALMAS_PU_PD_INPUT_CTRL4_DVFS2_CLK_PD 0x10
1655#define PALMAS_PU_PD_INPUT_CTRL4_DVFS2_CLK_PD_SHIFT 4
1656#define PALMAS_PU_PD_INPUT_CTRL4_DVFS1_DAT_PD 0x04
1657#define PALMAS_PU_PD_INPUT_CTRL4_DVFS1_DAT_PD_SHIFT 2
1658#define PALMAS_PU_PD_INPUT_CTRL4_DVFS1_CLK_PD 0x01
1659#define PALMAS_PU_PD_INPUT_CTRL4_DVFS1_CLK_PD_SHIFT 0
1660
1661/* Bit definitions for PRIMARY_SECONDARY_PAD3 */
1662#define PALMAS_PRIMARY_SECONDARY_PAD3_DVFS2 0x02
1663#define PALMAS_PRIMARY_SECONDARY_PAD3_DVFS2_SHIFT 1
1664#define PALMAS_PRIMARY_SECONDARY_PAD3_DVFS1 0x01
1665#define PALMAS_PRIMARY_SECONDARY_PAD3_DVFS1_SHIFT 0
1666
1667/* Registers for function LED_PWM */
1668#define PALMAS_LED_PERIOD_CTRL 0x0
1669#define PALMAS_LED_CTRL 0x1
1670#define PALMAS_PWM_CTRL1 0x2
1671#define PALMAS_PWM_CTRL2 0x3
1672
1673/* Bit definitions for LED_PERIOD_CTRL */
1674#define PALMAS_LED_PERIOD_CTRL_LED_2_PERIOD_MASK 0x38
1675#define PALMAS_LED_PERIOD_CTRL_LED_2_PERIOD_SHIFT 3
1676#define PALMAS_LED_PERIOD_CTRL_LED_1_PERIOD_MASK 0x07
1677#define PALMAS_LED_PERIOD_CTRL_LED_1_PERIOD_SHIFT 0
1678
1679/* Bit definitions for LED_CTRL */
1680#define PALMAS_LED_CTRL_LED_2_SEQ 0x20
1681#define PALMAS_LED_CTRL_LED_2_SEQ_SHIFT 5
1682#define PALMAS_LED_CTRL_LED_1_SEQ 0x10
1683#define PALMAS_LED_CTRL_LED_1_SEQ_SHIFT 4
1684#define PALMAS_LED_CTRL_LED_2_ON_TIME_MASK 0x0c
1685#define PALMAS_LED_CTRL_LED_2_ON_TIME_SHIFT 2
1686#define PALMAS_LED_CTRL_LED_1_ON_TIME_MASK 0x03
1687#define PALMAS_LED_CTRL_LED_1_ON_TIME_SHIFT 0
1688
1689/* Bit definitions for PWM_CTRL1 */
1690#define PALMAS_PWM_CTRL1_PWM_FREQ_EN 0x02
1691#define PALMAS_PWM_CTRL1_PWM_FREQ_EN_SHIFT 1
1692#define PALMAS_PWM_CTRL1_PWM_FREQ_SEL 0x01
1693#define PALMAS_PWM_CTRL1_PWM_FREQ_SEL_SHIFT 0
1694
1695/* Bit definitions for PWM_CTRL2 */
1696#define PALMAS_PWM_CTRL2_PWM_DUTY_SEL_MASK 0xff
1697#define PALMAS_PWM_CTRL2_PWM_DUTY_SEL_SHIFT 0
1698
1699/* Registers for function INTERRUPT */
1700#define PALMAS_INT1_STATUS 0x0
1701#define PALMAS_INT1_MASK 0x1
1702#define PALMAS_INT1_LINE_STATE 0x2
1703#define PALMAS_INT1_EDGE_DETECT1_RESERVED 0x3
1704#define PALMAS_INT1_EDGE_DETECT2_RESERVED 0x4
1705#define PALMAS_INT2_STATUS 0x5
1706#define PALMAS_INT2_MASK 0x6
1707#define PALMAS_INT2_LINE_STATE 0x7
1708#define PALMAS_INT2_EDGE_DETECT1_RESERVED 0x8
1709#define PALMAS_INT2_EDGE_DETECT2_RESERVED 0x9
1710#define PALMAS_INT3_STATUS 0xA
1711#define PALMAS_INT3_MASK 0xB
1712#define PALMAS_INT3_LINE_STATE 0xC
1713#define PALMAS_INT3_EDGE_DETECT1_RESERVED 0xD
1714#define PALMAS_INT3_EDGE_DETECT2_RESERVED 0xE
1715#define PALMAS_INT4_STATUS 0xF
1716#define PALMAS_INT4_MASK 0x10
1717#define PALMAS_INT4_LINE_STATE 0x11
1718#define PALMAS_INT4_EDGE_DETECT1 0x12
1719#define PALMAS_INT4_EDGE_DETECT2 0x13
1720#define PALMAS_INT_CTRL 0x14
1721
1722/* Bit definitions for INT1_STATUS */
1723#define PALMAS_INT1_STATUS_VBAT_MON 0x80
1724#define PALMAS_INT1_STATUS_VBAT_MON_SHIFT 7
1725#define PALMAS_INT1_STATUS_VSYS_MON 0x40
1726#define PALMAS_INT1_STATUS_VSYS_MON_SHIFT 6
1727#define PALMAS_INT1_STATUS_HOTDIE 0x20
1728#define PALMAS_INT1_STATUS_HOTDIE_SHIFT 5
1729#define PALMAS_INT1_STATUS_PWRDOWN 0x10
1730#define PALMAS_INT1_STATUS_PWRDOWN_SHIFT 4
1731#define PALMAS_INT1_STATUS_RPWRON 0x08
1732#define PALMAS_INT1_STATUS_RPWRON_SHIFT 3
1733#define PALMAS_INT1_STATUS_LONG_PRESS_KEY 0x04
1734#define PALMAS_INT1_STATUS_LONG_PRESS_KEY_SHIFT 2
1735#define PALMAS_INT1_STATUS_PWRON 0x02
1736#define PALMAS_INT1_STATUS_PWRON_SHIFT 1
1737#define PALMAS_INT1_STATUS_CHARG_DET_N_VBUS_OVV 0x01
1738#define PALMAS_INT1_STATUS_CHARG_DET_N_VBUS_OVV_SHIFT 0
1739
1740/* Bit definitions for INT1_MASK */
1741#define PALMAS_INT1_MASK_VBAT_MON 0x80
1742#define PALMAS_INT1_MASK_VBAT_MON_SHIFT 7
1743#define PALMAS_INT1_MASK_VSYS_MON 0x40
1744#define PALMAS_INT1_MASK_VSYS_MON_SHIFT 6
1745#define PALMAS_INT1_MASK_HOTDIE 0x20
1746#define PALMAS_INT1_MASK_HOTDIE_SHIFT 5
1747#define PALMAS_INT1_MASK_PWRDOWN 0x10
1748#define PALMAS_INT1_MASK_PWRDOWN_SHIFT 4
1749#define PALMAS_INT1_MASK_RPWRON 0x08
1750#define PALMAS_INT1_MASK_RPWRON_SHIFT 3
1751#define PALMAS_INT1_MASK_LONG_PRESS_KEY 0x04
1752#define PALMAS_INT1_MASK_LONG_PRESS_KEY_SHIFT 2
1753#define PALMAS_INT1_MASK_PWRON 0x02
1754#define PALMAS_INT1_MASK_PWRON_SHIFT 1
1755#define PALMAS_INT1_MASK_CHARG_DET_N_VBUS_OVV 0x01
1756#define PALMAS_INT1_MASK_CHARG_DET_N_VBUS_OVV_SHIFT 0
1757
1758/* Bit definitions for INT1_LINE_STATE */
1759#define PALMAS_INT1_LINE_STATE_VBAT_MON 0x80
1760#define PALMAS_INT1_LINE_STATE_VBAT_MON_SHIFT 7
1761#define PALMAS_INT1_LINE_STATE_VSYS_MON 0x40
1762#define PALMAS_INT1_LINE_STATE_VSYS_MON_SHIFT 6
1763#define PALMAS_INT1_LINE_STATE_HOTDIE 0x20
1764#define PALMAS_INT1_LINE_STATE_HOTDIE_SHIFT 5
1765#define PALMAS_INT1_LINE_STATE_PWRDOWN 0x10
1766#define PALMAS_INT1_LINE_STATE_PWRDOWN_SHIFT 4
1767#define PALMAS_INT1_LINE_STATE_RPWRON 0x08
1768#define PALMAS_INT1_LINE_STATE_RPWRON_SHIFT 3
1769#define PALMAS_INT1_LINE_STATE_LONG_PRESS_KEY 0x04
1770#define PALMAS_INT1_LINE_STATE_LONG_PRESS_KEY_SHIFT 2
1771#define PALMAS_INT1_LINE_STATE_PWRON 0x02
1772#define PALMAS_INT1_LINE_STATE_PWRON_SHIFT 1
1773#define PALMAS_INT1_LINE_STATE_CHARG_DET_N_VBUS_OVV 0x01
1774#define PALMAS_INT1_LINE_STATE_CHARG_DET_N_VBUS_OVV_SHIFT 0
1775
1776/* Bit definitions for INT2_STATUS */
1777#define PALMAS_INT2_STATUS_VAC_ACOK 0x80
1778#define PALMAS_INT2_STATUS_VAC_ACOK_SHIFT 7
1779#define PALMAS_INT2_STATUS_SHORT 0x40
1780#define PALMAS_INT2_STATUS_SHORT_SHIFT 6
1781#define PALMAS_INT2_STATUS_FBI_BB 0x20
1782#define PALMAS_INT2_STATUS_FBI_BB_SHIFT 5
1783#define PALMAS_INT2_STATUS_RESET_IN 0x10
1784#define PALMAS_INT2_STATUS_RESET_IN_SHIFT 4
1785#define PALMAS_INT2_STATUS_BATREMOVAL 0x08
1786#define PALMAS_INT2_STATUS_BATREMOVAL_SHIFT 3
1787#define PALMAS_INT2_STATUS_WDT 0x04
1788#define PALMAS_INT2_STATUS_WDT_SHIFT 2
1789#define PALMAS_INT2_STATUS_RTC_TIMER 0x02
1790#define PALMAS_INT2_STATUS_RTC_TIMER_SHIFT 1
1791#define PALMAS_INT2_STATUS_RTC_ALARM 0x01
1792#define PALMAS_INT2_STATUS_RTC_ALARM_SHIFT 0
1793
1794/* Bit definitions for INT2_MASK */
1795#define PALMAS_INT2_MASK_VAC_ACOK 0x80
1796#define PALMAS_INT2_MASK_VAC_ACOK_SHIFT 7
1797#define PALMAS_INT2_MASK_SHORT 0x40
1798#define PALMAS_INT2_MASK_SHORT_SHIFT 6
1799#define PALMAS_INT2_MASK_FBI_BB 0x20
1800#define PALMAS_INT2_MASK_FBI_BB_SHIFT 5
1801#define PALMAS_INT2_MASK_RESET_IN 0x10
1802#define PALMAS_INT2_MASK_RESET_IN_SHIFT 4
1803#define PALMAS_INT2_MASK_BATREMOVAL 0x08
1804#define PALMAS_INT2_MASK_BATREMOVAL_SHIFT 3
1805#define PALMAS_INT2_MASK_WDT 0x04
1806#define PALMAS_INT2_MASK_WDT_SHIFT 2
1807#define PALMAS_INT2_MASK_RTC_TIMER 0x02
1808#define PALMAS_INT2_MASK_RTC_TIMER_SHIFT 1
1809#define PALMAS_INT2_MASK_RTC_ALARM 0x01
1810#define PALMAS_INT2_MASK_RTC_ALARM_SHIFT 0
1811
1812/* Bit definitions for INT2_LINE_STATE */
1813#define PALMAS_INT2_LINE_STATE_VAC_ACOK 0x80
1814#define PALMAS_INT2_LINE_STATE_VAC_ACOK_SHIFT 7
1815#define PALMAS_INT2_LINE_STATE_SHORT 0x40
1816#define PALMAS_INT2_LINE_STATE_SHORT_SHIFT 6
1817#define PALMAS_INT2_LINE_STATE_FBI_BB 0x20
1818#define PALMAS_INT2_LINE_STATE_FBI_BB_SHIFT 5
1819#define PALMAS_INT2_LINE_STATE_RESET_IN 0x10
1820#define PALMAS_INT2_LINE_STATE_RESET_IN_SHIFT 4
1821#define PALMAS_INT2_LINE_STATE_BATREMOVAL 0x08
1822#define PALMAS_INT2_LINE_STATE_BATREMOVAL_SHIFT 3
1823#define PALMAS_INT2_LINE_STATE_WDT 0x04
1824#define PALMAS_INT2_LINE_STATE_WDT_SHIFT 2
1825#define PALMAS_INT2_LINE_STATE_RTC_TIMER 0x02
1826#define PALMAS_INT2_LINE_STATE_RTC_TIMER_SHIFT 1
1827#define PALMAS_INT2_LINE_STATE_RTC_ALARM 0x01
1828#define PALMAS_INT2_LINE_STATE_RTC_ALARM_SHIFT 0
1829
1830/* Bit definitions for INT3_STATUS */
1831#define PALMAS_INT3_STATUS_VBUS 0x80
1832#define PALMAS_INT3_STATUS_VBUS_SHIFT 7
1833#define PALMAS_INT3_STATUS_VBUS_OTG 0x40
1834#define PALMAS_INT3_STATUS_VBUS_OTG_SHIFT 6
1835#define PALMAS_INT3_STATUS_ID 0x20
1836#define PALMAS_INT3_STATUS_ID_SHIFT 5
1837#define PALMAS_INT3_STATUS_ID_OTG 0x10
1838#define PALMAS_INT3_STATUS_ID_OTG_SHIFT 4
1839#define PALMAS_INT3_STATUS_GPADC_EOC_RT 0x08
1840#define PALMAS_INT3_STATUS_GPADC_EOC_RT_SHIFT 3
1841#define PALMAS_INT3_STATUS_GPADC_EOC_SW 0x04
1842#define PALMAS_INT3_STATUS_GPADC_EOC_SW_SHIFT 2
1843#define PALMAS_INT3_STATUS_GPADC_AUTO_1 0x02
1844#define PALMAS_INT3_STATUS_GPADC_AUTO_1_SHIFT 1
1845#define PALMAS_INT3_STATUS_GPADC_AUTO_0 0x01
1846#define PALMAS_INT3_STATUS_GPADC_AUTO_0_SHIFT 0
1847
1848/* Bit definitions for INT3_MASK */
1849#define PALMAS_INT3_MASK_VBUS 0x80
1850#define PALMAS_INT3_MASK_VBUS_SHIFT 7
1851#define PALMAS_INT3_MASK_VBUS_OTG 0x40
1852#define PALMAS_INT3_MASK_VBUS_OTG_SHIFT 6
1853#define PALMAS_INT3_MASK_ID 0x20
1854#define PALMAS_INT3_MASK_ID_SHIFT 5
1855#define PALMAS_INT3_MASK_ID_OTG 0x10
1856#define PALMAS_INT3_MASK_ID_OTG_SHIFT 4
1857#define PALMAS_INT3_MASK_GPADC_EOC_RT 0x08
1858#define PALMAS_INT3_MASK_GPADC_EOC_RT_SHIFT 3
1859#define PALMAS_INT3_MASK_GPADC_EOC_SW 0x04
1860#define PALMAS_INT3_MASK_GPADC_EOC_SW_SHIFT 2
1861#define PALMAS_INT3_MASK_GPADC_AUTO_1 0x02
1862#define PALMAS_INT3_MASK_GPADC_AUTO_1_SHIFT 1
1863#define PALMAS_INT3_MASK_GPADC_AUTO_0 0x01
1864#define PALMAS_INT3_MASK_GPADC_AUTO_0_SHIFT 0
1865
1866/* Bit definitions for INT3_LINE_STATE */
1867#define PALMAS_INT3_LINE_STATE_VBUS 0x80
1868#define PALMAS_INT3_LINE_STATE_VBUS_SHIFT 7
1869#define PALMAS_INT3_LINE_STATE_VBUS_OTG 0x40
1870#define PALMAS_INT3_LINE_STATE_VBUS_OTG_SHIFT 6
1871#define PALMAS_INT3_LINE_STATE_ID 0x20
1872#define PALMAS_INT3_LINE_STATE_ID_SHIFT 5
1873#define PALMAS_INT3_LINE_STATE_ID_OTG 0x10
1874#define PALMAS_INT3_LINE_STATE_ID_OTG_SHIFT 4
1875#define PALMAS_INT3_LINE_STATE_GPADC_EOC_RT 0x08
1876#define PALMAS_INT3_LINE_STATE_GPADC_EOC_RT_SHIFT 3
1877#define PALMAS_INT3_LINE_STATE_GPADC_EOC_SW 0x04
1878#define PALMAS_INT3_LINE_STATE_GPADC_EOC_SW_SHIFT 2
1879#define PALMAS_INT3_LINE_STATE_GPADC_AUTO_1 0x02
1880#define PALMAS_INT3_LINE_STATE_GPADC_AUTO_1_SHIFT 1
1881#define PALMAS_INT3_LINE_STATE_GPADC_AUTO_0 0x01
1882#define PALMAS_INT3_LINE_STATE_GPADC_AUTO_0_SHIFT 0
1883
1884/* Bit definitions for INT4_STATUS */
1885#define PALMAS_INT4_STATUS_GPIO_7 0x80
1886#define PALMAS_INT4_STATUS_GPIO_7_SHIFT 7
1887#define PALMAS_INT4_STATUS_GPIO_6 0x40
1888#define PALMAS_INT4_STATUS_GPIO_6_SHIFT 6
1889#define PALMAS_INT4_STATUS_GPIO_5 0x20
1890#define PALMAS_INT4_STATUS_GPIO_5_SHIFT 5
1891#define PALMAS_INT4_STATUS_GPIO_4 0x10
1892#define PALMAS_INT4_STATUS_GPIO_4_SHIFT 4
1893#define PALMAS_INT4_STATUS_GPIO_3 0x08
1894#define PALMAS_INT4_STATUS_GPIO_3_SHIFT 3
1895#define PALMAS_INT4_STATUS_GPIO_2 0x04
1896#define PALMAS_INT4_STATUS_GPIO_2_SHIFT 2
1897#define PALMAS_INT4_STATUS_GPIO_1 0x02
1898#define PALMAS_INT4_STATUS_GPIO_1_SHIFT 1
1899#define PALMAS_INT4_STATUS_GPIO_0 0x01
1900#define PALMAS_INT4_STATUS_GPIO_0_SHIFT 0
1901
1902/* Bit definitions for INT4_MASK */
1903#define PALMAS_INT4_MASK_GPIO_7 0x80
1904#define PALMAS_INT4_MASK_GPIO_7_SHIFT 7
1905#define PALMAS_INT4_MASK_GPIO_6 0x40
1906#define PALMAS_INT4_MASK_GPIO_6_SHIFT 6
1907#define PALMAS_INT4_MASK_GPIO_5 0x20
1908#define PALMAS_INT4_MASK_GPIO_5_SHIFT 5
1909#define PALMAS_INT4_MASK_GPIO_4 0x10
1910#define PALMAS_INT4_MASK_GPIO_4_SHIFT 4
1911#define PALMAS_INT4_MASK_GPIO_3 0x08
1912#define PALMAS_INT4_MASK_GPIO_3_SHIFT 3
1913#define PALMAS_INT4_MASK_GPIO_2 0x04
1914#define PALMAS_INT4_MASK_GPIO_2_SHIFT 2
1915#define PALMAS_INT4_MASK_GPIO_1 0x02
1916#define PALMAS_INT4_MASK_GPIO_1_SHIFT 1
1917#define PALMAS_INT4_MASK_GPIO_0 0x01
1918#define PALMAS_INT4_MASK_GPIO_0_SHIFT 0
1919
1920/* Bit definitions for INT4_LINE_STATE */
1921#define PALMAS_INT4_LINE_STATE_GPIO_7 0x80
1922#define PALMAS_INT4_LINE_STATE_GPIO_7_SHIFT 7
1923#define PALMAS_INT4_LINE_STATE_GPIO_6 0x40
1924#define PALMAS_INT4_LINE_STATE_GPIO_6_SHIFT 6
1925#define PALMAS_INT4_LINE_STATE_GPIO_5 0x20
1926#define PALMAS_INT4_LINE_STATE_GPIO_5_SHIFT 5
1927#define PALMAS_INT4_LINE_STATE_GPIO_4 0x10
1928#define PALMAS_INT4_LINE_STATE_GPIO_4_SHIFT 4
1929#define PALMAS_INT4_LINE_STATE_GPIO_3 0x08
1930#define PALMAS_INT4_LINE_STATE_GPIO_3_SHIFT 3
1931#define PALMAS_INT4_LINE_STATE_GPIO_2 0x04
1932#define PALMAS_INT4_LINE_STATE_GPIO_2_SHIFT 2
1933#define PALMAS_INT4_LINE_STATE_GPIO_1 0x02
1934#define PALMAS_INT4_LINE_STATE_GPIO_1_SHIFT 1
1935#define PALMAS_INT4_LINE_STATE_GPIO_0 0x01
1936#define PALMAS_INT4_LINE_STATE_GPIO_0_SHIFT 0
1937
1938/* Bit definitions for INT4_EDGE_DETECT1 */
1939#define PALMAS_INT4_EDGE_DETECT1_GPIO_3_RISING 0x80
1940#define PALMAS_INT4_EDGE_DETECT1_GPIO_3_RISING_SHIFT 7
1941#define PALMAS_INT4_EDGE_DETECT1_GPIO_3_FALLING 0x40
1942#define PALMAS_INT4_EDGE_DETECT1_GPIO_3_FALLING_SHIFT 6
1943#define PALMAS_INT4_EDGE_DETECT1_GPIO_2_RISING 0x20
1944#define PALMAS_INT4_EDGE_DETECT1_GPIO_2_RISING_SHIFT 5
1945#define PALMAS_INT4_EDGE_DETECT1_GPIO_2_FALLING 0x10
1946#define PALMAS_INT4_EDGE_DETECT1_GPIO_2_FALLING_SHIFT 4
1947#define PALMAS_INT4_EDGE_DETECT1_GPIO_1_RISING 0x08
1948#define PALMAS_INT4_EDGE_DETECT1_GPIO_1_RISING_SHIFT 3
1949#define PALMAS_INT4_EDGE_DETECT1_GPIO_1_FALLING 0x04
1950#define PALMAS_INT4_EDGE_DETECT1_GPIO_1_FALLING_SHIFT 2
1951#define PALMAS_INT4_EDGE_DETECT1_GPIO_0_RISING 0x02
1952#define PALMAS_INT4_EDGE_DETECT1_GPIO_0_RISING_SHIFT 1
1953#define PALMAS_INT4_EDGE_DETECT1_GPIO_0_FALLING 0x01
1954#define PALMAS_INT4_EDGE_DETECT1_GPIO_0_FALLING_SHIFT 0
1955
1956/* Bit definitions for INT4_EDGE_DETECT2 */
1957#define PALMAS_INT4_EDGE_DETECT2_GPIO_7_RISING 0x80
1958#define PALMAS_INT4_EDGE_DETECT2_GPIO_7_RISING_SHIFT 7
1959#define PALMAS_INT4_EDGE_DETECT2_GPIO_7_FALLING 0x40
1960#define PALMAS_INT4_EDGE_DETECT2_GPIO_7_FALLING_SHIFT 6
1961#define PALMAS_INT4_EDGE_DETECT2_GPIO_6_RISING 0x20
1962#define PALMAS_INT4_EDGE_DETECT2_GPIO_6_RISING_SHIFT 5
1963#define PALMAS_INT4_EDGE_DETECT2_GPIO_6_FALLING 0x10
1964#define PALMAS_INT4_EDGE_DETECT2_GPIO_6_FALLING_SHIFT 4
1965#define PALMAS_INT4_EDGE_DETECT2_GPIO_5_RISING 0x08
1966#define PALMAS_INT4_EDGE_DETECT2_GPIO_5_RISING_SHIFT 3
1967#define PALMAS_INT4_EDGE_DETECT2_GPIO_5_FALLING 0x04
1968#define PALMAS_INT4_EDGE_DETECT2_GPIO_5_FALLING_SHIFT 2
1969#define PALMAS_INT4_EDGE_DETECT2_GPIO_4_RISING 0x02
1970#define PALMAS_INT4_EDGE_DETECT2_GPIO_4_RISING_SHIFT 1
1971#define PALMAS_INT4_EDGE_DETECT2_GPIO_4_FALLING 0x01
1972#define PALMAS_INT4_EDGE_DETECT2_GPIO_4_FALLING_SHIFT 0
1973
1974/* Bit definitions for INT_CTRL */
1975#define PALMAS_INT_CTRL_INT_PENDING 0x04
1976#define PALMAS_INT_CTRL_INT_PENDING_SHIFT 2
1977#define PALMAS_INT_CTRL_INT_CLEAR 0x01
1978#define PALMAS_INT_CTRL_INT_CLEAR_SHIFT 0
1979
1980/* Registers for function USB_OTG */
1981#define PALMAS_USB_WAKEUP 0x3
1982#define PALMAS_USB_VBUS_CTRL_SET 0x4
1983#define PALMAS_USB_VBUS_CTRL_CLR 0x5
1984#define PALMAS_USB_ID_CTRL_SET 0x6
1985#define PALMAS_USB_ID_CTRL_CLEAR 0x7
1986#define PALMAS_USB_VBUS_INT_SRC 0x8
1987#define PALMAS_USB_VBUS_INT_LATCH_SET 0x9
1988#define PALMAS_USB_VBUS_INT_LATCH_CLR 0xA
1989#define PALMAS_USB_VBUS_INT_EN_LO_SET 0xB
1990#define PALMAS_USB_VBUS_INT_EN_LO_CLR 0xC
1991#define PALMAS_USB_VBUS_INT_EN_HI_SET 0xD
1992#define PALMAS_USB_VBUS_INT_EN_HI_CLR 0xE
1993#define PALMAS_USB_ID_INT_SRC 0xF
1994#define PALMAS_USB_ID_INT_LATCH_SET 0x10
1995#define PALMAS_USB_ID_INT_LATCH_CLR 0x11
1996#define PALMAS_USB_ID_INT_EN_LO_SET 0x12
1997#define PALMAS_USB_ID_INT_EN_LO_CLR 0x13
1998#define PALMAS_USB_ID_INT_EN_HI_SET 0x14
1999#define PALMAS_USB_ID_INT_EN_HI_CLR 0x15
2000#define PALMAS_USB_OTG_ADP_CTRL 0x16
2001#define PALMAS_USB_OTG_ADP_HIGH 0x17
2002#define PALMAS_USB_OTG_ADP_LOW 0x18
2003#define PALMAS_USB_OTG_ADP_RISE 0x19
2004#define PALMAS_USB_OTG_REVISION 0x1A
2005
2006/* Bit definitions for USB_WAKEUP */
2007#define PALMAS_USB_WAKEUP_ID_WK_UP_COMP 0x01
2008#define PALMAS_USB_WAKEUP_ID_WK_UP_COMP_SHIFT 0
2009
2010/* Bit definitions for USB_VBUS_CTRL_SET */
2011#define PALMAS_USB_VBUS_CTRL_SET_VBUS_CHRG_VSYS 0x80
2012#define PALMAS_USB_VBUS_CTRL_SET_VBUS_CHRG_VSYS_SHIFT 7
2013#define PALMAS_USB_VBUS_CTRL_SET_VBUS_DISCHRG 0x20
2014#define PALMAS_USB_VBUS_CTRL_SET_VBUS_DISCHRG_SHIFT 5
2015#define PALMAS_USB_VBUS_CTRL_SET_VBUS_IADP_SRC 0x10
2016#define PALMAS_USB_VBUS_CTRL_SET_VBUS_IADP_SRC_SHIFT 4
2017#define PALMAS_USB_VBUS_CTRL_SET_VBUS_IADP_SINK 0x08
2018#define PALMAS_USB_VBUS_CTRL_SET_VBUS_IADP_SINK_SHIFT 3
2019#define PALMAS_USB_VBUS_CTRL_SET_VBUS_ACT_COMP 0x04
2020#define PALMAS_USB_VBUS_CTRL_SET_VBUS_ACT_COMP_SHIFT 2
2021
2022/* Bit definitions for USB_VBUS_CTRL_CLR */
2023#define PALMAS_USB_VBUS_CTRL_CLR_VBUS_CHRG_VSYS 0x80
2024#define PALMAS_USB_VBUS_CTRL_CLR_VBUS_CHRG_VSYS_SHIFT 7
2025#define PALMAS_USB_VBUS_CTRL_CLR_VBUS_DISCHRG 0x20
2026#define PALMAS_USB_VBUS_CTRL_CLR_VBUS_DISCHRG_SHIFT 5
2027#define PALMAS_USB_VBUS_CTRL_CLR_VBUS_IADP_SRC 0x10
2028#define PALMAS_USB_VBUS_CTRL_CLR_VBUS_IADP_SRC_SHIFT 4
2029#define PALMAS_USB_VBUS_CTRL_CLR_VBUS_IADP_SINK 0x08
2030#define PALMAS_USB_VBUS_CTRL_CLR_VBUS_IADP_SINK_SHIFT 3
2031#define PALMAS_USB_VBUS_CTRL_CLR_VBUS_ACT_COMP 0x04
2032#define PALMAS_USB_VBUS_CTRL_CLR_VBUS_ACT_COMP_SHIFT 2
2033
2034/* Bit definitions for USB_ID_CTRL_SET */
2035#define PALMAS_USB_ID_CTRL_SET_ID_PU_220K 0x80
2036#define PALMAS_USB_ID_CTRL_SET_ID_PU_220K_SHIFT 7
2037#define PALMAS_USB_ID_CTRL_SET_ID_PU_100K 0x40
2038#define PALMAS_USB_ID_CTRL_SET_ID_PU_100K_SHIFT 6
2039#define PALMAS_USB_ID_CTRL_SET_ID_GND_DRV 0x20
2040#define PALMAS_USB_ID_CTRL_SET_ID_GND_DRV_SHIFT 5
2041#define PALMAS_USB_ID_CTRL_SET_ID_SRC_16U 0x10
2042#define PALMAS_USB_ID_CTRL_SET_ID_SRC_16U_SHIFT 4
2043#define PALMAS_USB_ID_CTRL_SET_ID_SRC_5U 0x08
2044#define PALMAS_USB_ID_CTRL_SET_ID_SRC_5U_SHIFT 3
2045#define PALMAS_USB_ID_CTRL_SET_ID_ACT_COMP 0x04
2046#define PALMAS_USB_ID_CTRL_SET_ID_ACT_COMP_SHIFT 2
2047
2048/* Bit definitions for USB_ID_CTRL_CLEAR */
2049#define PALMAS_USB_ID_CTRL_CLEAR_ID_PU_220K 0x80
2050#define PALMAS_USB_ID_CTRL_CLEAR_ID_PU_220K_SHIFT 7
2051#define PALMAS_USB_ID_CTRL_CLEAR_ID_PU_100K 0x40
2052#define PALMAS_USB_ID_CTRL_CLEAR_ID_PU_100K_SHIFT 6
2053#define PALMAS_USB_ID_CTRL_CLEAR_ID_GND_DRV 0x20
2054#define PALMAS_USB_ID_CTRL_CLEAR_ID_GND_DRV_SHIFT 5
2055#define PALMAS_USB_ID_CTRL_CLEAR_ID_SRC_16U 0x10
2056#define PALMAS_USB_ID_CTRL_CLEAR_ID_SRC_16U_SHIFT 4
2057#define PALMAS_USB_ID_CTRL_CLEAR_ID_SRC_5U 0x08
2058#define PALMAS_USB_ID_CTRL_CLEAR_ID_SRC_5U_SHIFT 3
2059#define PALMAS_USB_ID_CTRL_CLEAR_ID_ACT_COMP 0x04
2060#define PALMAS_USB_ID_CTRL_CLEAR_ID_ACT_COMP_SHIFT 2
2061
2062/* Bit definitions for USB_VBUS_INT_SRC */
2063#define PALMAS_USB_VBUS_INT_SRC_VOTG_SESS_VLD 0x80
2064#define PALMAS_USB_VBUS_INT_SRC_VOTG_SESS_VLD_SHIFT 7
2065#define PALMAS_USB_VBUS_INT_SRC_VADP_PRB 0x40
2066#define PALMAS_USB_VBUS_INT_SRC_VADP_PRB_SHIFT 6
2067#define PALMAS_USB_VBUS_INT_SRC_VADP_SNS 0x20
2068#define PALMAS_USB_VBUS_INT_SRC_VADP_SNS_SHIFT 5
2069#define PALMAS_USB_VBUS_INT_SRC_VA_VBUS_VLD 0x08
2070#define PALMAS_USB_VBUS_INT_SRC_VA_VBUS_VLD_SHIFT 3
2071#define PALMAS_USB_VBUS_INT_SRC_VA_SESS_VLD 0x04
2072#define PALMAS_USB_VBUS_INT_SRC_VA_SESS_VLD_SHIFT 2
2073#define PALMAS_USB_VBUS_INT_SRC_VB_SESS_VLD 0x02
2074#define PALMAS_USB_VBUS_INT_SRC_VB_SESS_VLD_SHIFT 1
2075#define PALMAS_USB_VBUS_INT_SRC_VB_SESS_END 0x01
2076#define PALMAS_USB_VBUS_INT_SRC_VB_SESS_END_SHIFT 0
2077
2078/* Bit definitions for USB_VBUS_INT_LATCH_SET */
2079#define PALMAS_USB_VBUS_INT_LATCH_SET_VOTG_SESS_VLD 0x80
2080#define PALMAS_USB_VBUS_INT_LATCH_SET_VOTG_SESS_VLD_SHIFT 7
2081#define PALMAS_USB_VBUS_INT_LATCH_SET_VADP_PRB 0x40
2082#define PALMAS_USB_VBUS_INT_LATCH_SET_VADP_PRB_SHIFT 6
2083#define PALMAS_USB_VBUS_INT_LATCH_SET_VADP_SNS 0x20
2084#define PALMAS_USB_VBUS_INT_LATCH_SET_VADP_SNS_SHIFT 5
2085#define PALMAS_USB_VBUS_INT_LATCH_SET_ADP 0x10
2086#define PALMAS_USB_VBUS_INT_LATCH_SET_ADP_SHIFT 4
2087#define PALMAS_USB_VBUS_INT_LATCH_SET_VA_VBUS_VLD 0x08
2088#define PALMAS_USB_VBUS_INT_LATCH_SET_VA_VBUS_VLD_SHIFT 3
2089#define PALMAS_USB_VBUS_INT_LATCH_SET_VA_SESS_VLD 0x04
2090#define PALMAS_USB_VBUS_INT_LATCH_SET_VA_SESS_VLD_SHIFT 2
2091#define PALMAS_USB_VBUS_INT_LATCH_SET_VB_SESS_VLD 0x02
2092#define PALMAS_USB_VBUS_INT_LATCH_SET_VB_SESS_VLD_SHIFT 1
2093#define PALMAS_USB_VBUS_INT_LATCH_SET_VB_SESS_END 0x01
2094#define PALMAS_USB_VBUS_INT_LATCH_SET_VB_SESS_END_SHIFT 0
2095
2096/* Bit definitions for USB_VBUS_INT_LATCH_CLR */
2097#define PALMAS_USB_VBUS_INT_LATCH_CLR_VOTG_SESS_VLD 0x80
2098#define PALMAS_USB_VBUS_INT_LATCH_CLR_VOTG_SESS_VLD_SHIFT 7
2099#define PALMAS_USB_VBUS_INT_LATCH_CLR_VADP_PRB 0x40
2100#define PALMAS_USB_VBUS_INT_LATCH_CLR_VADP_PRB_SHIFT 6
2101#define PALMAS_USB_VBUS_INT_LATCH_CLR_VADP_SNS 0x20
2102#define PALMAS_USB_VBUS_INT_LATCH_CLR_VADP_SNS_SHIFT 5
2103#define PALMAS_USB_VBUS_INT_LATCH_CLR_ADP 0x10
2104#define PALMAS_USB_VBUS_INT_LATCH_CLR_ADP_SHIFT 4
2105#define PALMAS_USB_VBUS_INT_LATCH_CLR_VA_VBUS_VLD 0x08
2106#define PALMAS_USB_VBUS_INT_LATCH_CLR_VA_VBUS_VLD_SHIFT 3
2107#define PALMAS_USB_VBUS_INT_LATCH_CLR_VA_SESS_VLD 0x04
2108#define PALMAS_USB_VBUS_INT_LATCH_CLR_VA_SESS_VLD_SHIFT 2
2109#define PALMAS_USB_VBUS_INT_LATCH_CLR_VB_SESS_VLD 0x02
2110#define PALMAS_USB_VBUS_INT_LATCH_CLR_VB_SESS_VLD_SHIFT 1
2111#define PALMAS_USB_VBUS_INT_LATCH_CLR_VB_SESS_END 0x01
2112#define PALMAS_USB_VBUS_INT_LATCH_CLR_VB_SESS_END_SHIFT 0
2113
2114/* Bit definitions for USB_VBUS_INT_EN_LO_SET */
2115#define PALMAS_USB_VBUS_INT_EN_LO_SET_VOTG_SESS_VLD 0x80
2116#define PALMAS_USB_VBUS_INT_EN_LO_SET_VOTG_SESS_VLD_SHIFT 7
2117#define PALMAS_USB_VBUS_INT_EN_LO_SET_VADP_PRB 0x40
2118#define PALMAS_USB_VBUS_INT_EN_LO_SET_VADP_PRB_SHIFT 6
2119#define PALMAS_USB_VBUS_INT_EN_LO_SET_VADP_SNS 0x20
2120#define PALMAS_USB_VBUS_INT_EN_LO_SET_VADP_SNS_SHIFT 5
2121#define PALMAS_USB_VBUS_INT_EN_LO_SET_VA_VBUS_VLD 0x08
2122#define PALMAS_USB_VBUS_INT_EN_LO_SET_VA_VBUS_VLD_SHIFT 3
2123#define PALMAS_USB_VBUS_INT_EN_LO_SET_VA_SESS_VLD 0x04
2124#define PALMAS_USB_VBUS_INT_EN_LO_SET_VA_SESS_VLD_SHIFT 2
2125#define PALMAS_USB_VBUS_INT_EN_LO_SET_VB_SESS_VLD 0x02
2126#define PALMAS_USB_VBUS_INT_EN_LO_SET_VB_SESS_VLD_SHIFT 1
2127#define PALMAS_USB_VBUS_INT_EN_LO_SET_VB_SESS_END 0x01
2128#define PALMAS_USB_VBUS_INT_EN_LO_SET_VB_SESS_END_SHIFT 0
2129
2130/* Bit definitions for USB_VBUS_INT_EN_LO_CLR */
2131#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VOTG_SESS_VLD 0x80
2132#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VOTG_SESS_VLD_SHIFT 7
2133#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VADP_PRB 0x40
2134#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VADP_PRB_SHIFT 6
2135#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VADP_SNS 0x20
2136#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VADP_SNS_SHIFT 5
2137#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VA_VBUS_VLD 0x08
2138#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VA_VBUS_VLD_SHIFT 3
2139#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VA_SESS_VLD 0x04
2140#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VA_SESS_VLD_SHIFT 2
2141#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VB_SESS_VLD 0x02
2142#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VB_SESS_VLD_SHIFT 1
2143#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VB_SESS_END 0x01
2144#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VB_SESS_END_SHIFT 0
2145
2146/* Bit definitions for USB_VBUS_INT_EN_HI_SET */
2147#define PALMAS_USB_VBUS_INT_EN_HI_SET_VOTG_SESS_VLD 0x80
2148#define PALMAS_USB_VBUS_INT_EN_HI_SET_VOTG_SESS_VLD_SHIFT 7
2149#define PALMAS_USB_VBUS_INT_EN_HI_SET_VADP_PRB 0x40
2150#define PALMAS_USB_VBUS_INT_EN_HI_SET_VADP_PRB_SHIFT 6
2151#define PALMAS_USB_VBUS_INT_EN_HI_SET_VADP_SNS 0x20
2152#define PALMAS_USB_VBUS_INT_EN_HI_SET_VADP_SNS_SHIFT 5
2153#define PALMAS_USB_VBUS_INT_EN_HI_SET_ADP 0x10
2154#define PALMAS_USB_VBUS_INT_EN_HI_SET_ADP_SHIFT 4
2155#define PALMAS_USB_VBUS_INT_EN_HI_SET_VA_VBUS_VLD 0x08
2156#define PALMAS_USB_VBUS_INT_EN_HI_SET_VA_VBUS_VLD_SHIFT 3
2157#define PALMAS_USB_VBUS_INT_EN_HI_SET_VA_SESS_VLD 0x04
2158#define PALMAS_USB_VBUS_INT_EN_HI_SET_VA_SESS_VLD_SHIFT 2
2159#define PALMAS_USB_VBUS_INT_EN_HI_SET_VB_SESS_VLD 0x02
2160#define PALMAS_USB_VBUS_INT_EN_HI_SET_VB_SESS_VLD_SHIFT 1
2161#define PALMAS_USB_VBUS_INT_EN_HI_SET_VB_SESS_END 0x01
2162#define PALMAS_USB_VBUS_INT_EN_HI_SET_VB_SESS_END_SHIFT 0
2163
2164/* Bit definitions for USB_VBUS_INT_EN_HI_CLR */
2165#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VOTG_SESS_VLD 0x80
2166#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VOTG_SESS_VLD_SHIFT 7
2167#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VADP_PRB 0x40
2168#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VADP_PRB_SHIFT 6
2169#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VADP_SNS 0x20
2170#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VADP_SNS_SHIFT 5
2171#define PALMAS_USB_VBUS_INT_EN_HI_CLR_ADP 0x10
2172#define PALMAS_USB_VBUS_INT_EN_HI_CLR_ADP_SHIFT 4
2173#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VA_VBUS_VLD 0x08
2174#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VA_VBUS_VLD_SHIFT 3
2175#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VA_SESS_VLD 0x04
2176#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VA_SESS_VLD_SHIFT 2
2177#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VB_SESS_VLD 0x02
2178#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VB_SESS_VLD_SHIFT 1
2179#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VB_SESS_END 0x01
2180#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VB_SESS_END_SHIFT 0
2181
2182/* Bit definitions for USB_ID_INT_SRC */
2183#define PALMAS_USB_ID_INT_SRC_ID_FLOAT 0x10
2184#define PALMAS_USB_ID_INT_SRC_ID_FLOAT_SHIFT 4
2185#define PALMAS_USB_ID_INT_SRC_ID_A 0x08
2186#define PALMAS_USB_ID_INT_SRC_ID_A_SHIFT 3
2187#define PALMAS_USB_ID_INT_SRC_ID_B 0x04
2188#define PALMAS_USB_ID_INT_SRC_ID_B_SHIFT 2
2189#define PALMAS_USB_ID_INT_SRC_ID_C 0x02
2190#define PALMAS_USB_ID_INT_SRC_ID_C_SHIFT 1
2191#define PALMAS_USB_ID_INT_SRC_ID_GND 0x01
2192#define PALMAS_USB_ID_INT_SRC_ID_GND_SHIFT 0
2193
2194/* Bit definitions for USB_ID_INT_LATCH_SET */
2195#define PALMAS_USB_ID_INT_LATCH_SET_ID_FLOAT 0x10
2196#define PALMAS_USB_ID_INT_LATCH_SET_ID_FLOAT_SHIFT 4
2197#define PALMAS_USB_ID_INT_LATCH_SET_ID_A 0x08
2198#define PALMAS_USB_ID_INT_LATCH_SET_ID_A_SHIFT 3
2199#define PALMAS_USB_ID_INT_LATCH_SET_ID_B 0x04
2200#define PALMAS_USB_ID_INT_LATCH_SET_ID_B_SHIFT 2
2201#define PALMAS_USB_ID_INT_LATCH_SET_ID_C 0x02
2202#define PALMAS_USB_ID_INT_LATCH_SET_ID_C_SHIFT 1
2203#define PALMAS_USB_ID_INT_LATCH_SET_ID_GND 0x01
2204#define PALMAS_USB_ID_INT_LATCH_SET_ID_GND_SHIFT 0
2205
2206/* Bit definitions for USB_ID_INT_LATCH_CLR */
2207#define PALMAS_USB_ID_INT_LATCH_CLR_ID_FLOAT 0x10
2208#define PALMAS_USB_ID_INT_LATCH_CLR_ID_FLOAT_SHIFT 4
2209#define PALMAS_USB_ID_INT_LATCH_CLR_ID_A 0x08
2210#define PALMAS_USB_ID_INT_LATCH_CLR_ID_A_SHIFT 3
2211#define PALMAS_USB_ID_INT_LATCH_CLR_ID_B 0x04
2212#define PALMAS_USB_ID_INT_LATCH_CLR_ID_B_SHIFT 2
2213#define PALMAS_USB_ID_INT_LATCH_CLR_ID_C 0x02
2214#define PALMAS_USB_ID_INT_LATCH_CLR_ID_C_SHIFT 1
2215#define PALMAS_USB_ID_INT_LATCH_CLR_ID_GND 0x01
2216#define PALMAS_USB_ID_INT_LATCH_CLR_ID_GND_SHIFT 0
2217
2218/* Bit definitions for USB_ID_INT_EN_LO_SET */
2219#define PALMAS_USB_ID_INT_EN_LO_SET_ID_FLOAT 0x10
2220#define PALMAS_USB_ID_INT_EN_LO_SET_ID_FLOAT_SHIFT 4
2221#define PALMAS_USB_ID_INT_EN_LO_SET_ID_A 0x08
2222#define PALMAS_USB_ID_INT_EN_LO_SET_ID_A_SHIFT 3
2223#define PALMAS_USB_ID_INT_EN_LO_SET_ID_B 0x04
2224#define PALMAS_USB_ID_INT_EN_LO_SET_ID_B_SHIFT 2
2225#define PALMAS_USB_ID_INT_EN_LO_SET_ID_C 0x02
2226#define PALMAS_USB_ID_INT_EN_LO_SET_ID_C_SHIFT 1
2227#define PALMAS_USB_ID_INT_EN_LO_SET_ID_GND 0x01
2228#define PALMAS_USB_ID_INT_EN_LO_SET_ID_GND_SHIFT 0
2229
2230/* Bit definitions for USB_ID_INT_EN_LO_CLR */
2231#define PALMAS_USB_ID_INT_EN_LO_CLR_ID_FLOAT 0x10
2232#define PALMAS_USB_ID_INT_EN_LO_CLR_ID_FLOAT_SHIFT 4
2233#define PALMAS_USB_ID_INT_EN_LO_CLR_ID_A 0x08
2234#define PALMAS_USB_ID_INT_EN_LO_CLR_ID_A_SHIFT 3
2235#define PALMAS_USB_ID_INT_EN_LO_CLR_ID_B 0x04
2236#define PALMAS_USB_ID_INT_EN_LO_CLR_ID_B_SHIFT 2
2237#define PALMAS_USB_ID_INT_EN_LO_CLR_ID_C 0x02
2238#define PALMAS_USB_ID_INT_EN_LO_CLR_ID_C_SHIFT 1
2239#define PALMAS_USB_ID_INT_EN_LO_CLR_ID_GND 0x01
2240#define PALMAS_USB_ID_INT_EN_LO_CLR_ID_GND_SHIFT 0
2241
2242/* Bit definitions for USB_ID_INT_EN_HI_SET */
2243#define PALMAS_USB_ID_INT_EN_HI_SET_ID_FLOAT 0x10
2244#define PALMAS_USB_ID_INT_EN_HI_SET_ID_FLOAT_SHIFT 4
2245#define PALMAS_USB_ID_INT_EN_HI_SET_ID_A 0x08
2246#define PALMAS_USB_ID_INT_EN_HI_SET_ID_A_SHIFT 3
2247#define PALMAS_USB_ID_INT_EN_HI_SET_ID_B 0x04
2248#define PALMAS_USB_ID_INT_EN_HI_SET_ID_B_SHIFT 2
2249#define PALMAS_USB_ID_INT_EN_HI_SET_ID_C 0x02
2250#define PALMAS_USB_ID_INT_EN_HI_SET_ID_C_SHIFT 1
2251#define PALMAS_USB_ID_INT_EN_HI_SET_ID_GND 0x01
2252#define PALMAS_USB_ID_INT_EN_HI_SET_ID_GND_SHIFT 0
2253
2254/* Bit definitions for USB_ID_INT_EN_HI_CLR */
2255#define PALMAS_USB_ID_INT_EN_HI_CLR_ID_FLOAT 0x10
2256#define PALMAS_USB_ID_INT_EN_HI_CLR_ID_FLOAT_SHIFT 4
2257#define PALMAS_USB_ID_INT_EN_HI_CLR_ID_A 0x08
2258#define PALMAS_USB_ID_INT_EN_HI_CLR_ID_A_SHIFT 3
2259#define PALMAS_USB_ID_INT_EN_HI_CLR_ID_B 0x04
2260#define PALMAS_USB_ID_INT_EN_HI_CLR_ID_B_SHIFT 2
2261#define PALMAS_USB_ID_INT_EN_HI_CLR_ID_C 0x02
2262#define PALMAS_USB_ID_INT_EN_HI_CLR_ID_C_SHIFT 1
2263#define PALMAS_USB_ID_INT_EN_HI_CLR_ID_GND 0x01
2264#define PALMAS_USB_ID_INT_EN_HI_CLR_ID_GND_SHIFT 0
2265
2266/* Bit definitions for USB_OTG_ADP_CTRL */
2267#define PALMAS_USB_OTG_ADP_CTRL_ADP_EN 0x04
2268#define PALMAS_USB_OTG_ADP_CTRL_ADP_EN_SHIFT 2
2269#define PALMAS_USB_OTG_ADP_CTRL_ADP_MODE_MASK 0x03
2270#define PALMAS_USB_OTG_ADP_CTRL_ADP_MODE_SHIFT 0
2271
2272/* Bit definitions for USB_OTG_ADP_HIGH */
2273#define PALMAS_USB_OTG_ADP_HIGH_T_ADP_HIGH_MASK 0xff
2274#define PALMAS_USB_OTG_ADP_HIGH_T_ADP_HIGH_SHIFT 0
2275
2276/* Bit definitions for USB_OTG_ADP_LOW */
2277#define PALMAS_USB_OTG_ADP_LOW_T_ADP_LOW_MASK 0xff
2278#define PALMAS_USB_OTG_ADP_LOW_T_ADP_LOW_SHIFT 0
2279
2280/* Bit definitions for USB_OTG_ADP_RISE */
2281#define PALMAS_USB_OTG_ADP_RISE_T_ADP_RISE_MASK 0xff
2282#define PALMAS_USB_OTG_ADP_RISE_T_ADP_RISE_SHIFT 0
2283
2284/* Bit definitions for USB_OTG_REVISION */
2285#define PALMAS_USB_OTG_REVISION_OTG_REV 0x01
2286#define PALMAS_USB_OTG_REVISION_OTG_REV_SHIFT 0
2287
2288/* Registers for function VIBRATOR */
2289#define PALMAS_VIBRA_CTRL 0x0
2290
2291/* Bit definitions for VIBRA_CTRL */
2292#define PALMAS_VIBRA_CTRL_PWM_DUTY_SEL_MASK 0x06
2293#define PALMAS_VIBRA_CTRL_PWM_DUTY_SEL_SHIFT 1
2294#define PALMAS_VIBRA_CTRL_PWM_FREQ_SEL 0x01
2295#define PALMAS_VIBRA_CTRL_PWM_FREQ_SEL_SHIFT 0
2296
2297/* Registers for function GPIO */
2298#define PALMAS_GPIO_DATA_IN 0x0
2299#define PALMAS_GPIO_DATA_DIR 0x1
2300#define PALMAS_GPIO_DATA_OUT 0x2
2301#define PALMAS_GPIO_DEBOUNCE_EN 0x3
2302#define PALMAS_GPIO_CLEAR_DATA_OUT 0x4
2303#define PALMAS_GPIO_SET_DATA_OUT 0x5
2304#define PALMAS_PU_PD_GPIO_CTRL1 0x6
2305#define PALMAS_PU_PD_GPIO_CTRL2 0x7
2306#define PALMAS_OD_OUTPUT_GPIO_CTRL 0x8
2307
2308/* Bit definitions for GPIO_DATA_IN */
2309#define PALMAS_GPIO_DATA_IN_GPIO_7_IN 0x80
2310#define PALMAS_GPIO_DATA_IN_GPIO_7_IN_SHIFT 7
2311#define PALMAS_GPIO_DATA_IN_GPIO_6_IN 0x40
2312#define PALMAS_GPIO_DATA_IN_GPIO_6_IN_SHIFT 6
2313#define PALMAS_GPIO_DATA_IN_GPIO_5_IN 0x20
2314#define PALMAS_GPIO_DATA_IN_GPIO_5_IN_SHIFT 5
2315#define PALMAS_GPIO_DATA_IN_GPIO_4_IN 0x10
2316#define PALMAS_GPIO_DATA_IN_GPIO_4_IN_SHIFT 4
2317#define PALMAS_GPIO_DATA_IN_GPIO_3_IN 0x08
2318#define PALMAS_GPIO_DATA_IN_GPIO_3_IN_SHIFT 3
2319#define PALMAS_GPIO_DATA_IN_GPIO_2_IN 0x04
2320#define PALMAS_GPIO_DATA_IN_GPIO_2_IN_SHIFT 2
2321#define PALMAS_GPIO_DATA_IN_GPIO_1_IN 0x02
2322#define PALMAS_GPIO_DATA_IN_GPIO_1_IN_SHIFT 1
2323#define PALMAS_GPIO_DATA_IN_GPIO_0_IN 0x01
2324#define PALMAS_GPIO_DATA_IN_GPIO_0_IN_SHIFT 0
2325
2326/* Bit definitions for GPIO_DATA_DIR */
2327#define PALMAS_GPIO_DATA_DIR_GPIO_7_DIR 0x80
2328#define PALMAS_GPIO_DATA_DIR_GPIO_7_DIR_SHIFT 7
2329#define PALMAS_GPIO_DATA_DIR_GPIO_6_DIR 0x40
2330#define PALMAS_GPIO_DATA_DIR_GPIO_6_DIR_SHIFT 6
2331#define PALMAS_GPIO_DATA_DIR_GPIO_5_DIR 0x20
2332#define PALMAS_GPIO_DATA_DIR_GPIO_5_DIR_SHIFT 5
2333#define PALMAS_GPIO_DATA_DIR_GPIO_4_DIR 0x10
2334#define PALMAS_GPIO_DATA_DIR_GPIO_4_DIR_SHIFT 4
2335#define PALMAS_GPIO_DATA_DIR_GPIO_3_DIR 0x08
2336#define PALMAS_GPIO_DATA_DIR_GPIO_3_DIR_SHIFT 3
2337#define PALMAS_GPIO_DATA_DIR_GPIO_2_DIR 0x04
2338#define PALMAS_GPIO_DATA_DIR_GPIO_2_DIR_SHIFT 2
2339#define PALMAS_GPIO_DATA_DIR_GPIO_1_DIR 0x02
2340#define PALMAS_GPIO_DATA_DIR_GPIO_1_DIR_SHIFT 1
2341#define PALMAS_GPIO_DATA_DIR_GPIO_0_DIR 0x01
2342#define PALMAS_GPIO_DATA_DIR_GPIO_0_DIR_SHIFT 0
2343
2344/* Bit definitions for GPIO_DATA_OUT */
2345#define PALMAS_GPIO_DATA_OUT_GPIO_7_OUT 0x80
2346#define PALMAS_GPIO_DATA_OUT_GPIO_7_OUT_SHIFT 7
2347#define PALMAS_GPIO_DATA_OUT_GPIO_6_OUT 0x40
2348#define PALMAS_GPIO_DATA_OUT_GPIO_6_OUT_SHIFT 6
2349#define PALMAS_GPIO_DATA_OUT_GPIO_5_OUT 0x20
2350#define PALMAS_GPIO_DATA_OUT_GPIO_5_OUT_SHIFT 5
2351#define PALMAS_GPIO_DATA_OUT_GPIO_4_OUT 0x10
2352#define PALMAS_GPIO_DATA_OUT_GPIO_4_OUT_SHIFT 4
2353#define PALMAS_GPIO_DATA_OUT_GPIO_3_OUT 0x08
2354#define PALMAS_GPIO_DATA_OUT_GPIO_3_OUT_SHIFT 3
2355#define PALMAS_GPIO_DATA_OUT_GPIO_2_OUT 0x04
2356#define PALMAS_GPIO_DATA_OUT_GPIO_2_OUT_SHIFT 2
2357#define PALMAS_GPIO_DATA_OUT_GPIO_1_OUT 0x02
2358#define PALMAS_GPIO_DATA_OUT_GPIO_1_OUT_SHIFT 1
2359#define PALMAS_GPIO_DATA_OUT_GPIO_0_OUT 0x01
2360#define PALMAS_GPIO_DATA_OUT_GPIO_0_OUT_SHIFT 0
2361
2362/* Bit definitions for GPIO_DEBOUNCE_EN */
2363#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_7_DEBOUNCE_EN 0x80
2364#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_7_DEBOUNCE_EN_SHIFT 7
2365#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_6_DEBOUNCE_EN 0x40
2366#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_6_DEBOUNCE_EN_SHIFT 6
2367#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_5_DEBOUNCE_EN 0x20
2368#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_5_DEBOUNCE_EN_SHIFT 5
2369#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_4_DEBOUNCE_EN 0x10
2370#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_4_DEBOUNCE_EN_SHIFT 4
2371#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_3_DEBOUNCE_EN 0x08
2372#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_3_DEBOUNCE_EN_SHIFT 3
2373#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_2_DEBOUNCE_EN 0x04
2374#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_2_DEBOUNCE_EN_SHIFT 2
2375#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_1_DEBOUNCE_EN 0x02
2376#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_1_DEBOUNCE_EN_SHIFT 1
2377#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_0_DEBOUNCE_EN 0x01
2378#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_0_DEBOUNCE_EN_SHIFT 0
2379
2380/* Bit definitions for GPIO_CLEAR_DATA_OUT */
2381#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_7_CLEAR_DATA_OUT 0x80
2382#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_7_CLEAR_DATA_OUT_SHIFT 7
2383#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_6_CLEAR_DATA_OUT 0x40
2384#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_6_CLEAR_DATA_OUT_SHIFT 6
2385#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_5_CLEAR_DATA_OUT 0x20
2386#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_5_CLEAR_DATA_OUT_SHIFT 5
2387#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_4_CLEAR_DATA_OUT 0x10
2388#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_4_CLEAR_DATA_OUT_SHIFT 4
2389#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_3_CLEAR_DATA_OUT 0x08
2390#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_3_CLEAR_DATA_OUT_SHIFT 3
2391#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_2_CLEAR_DATA_OUT 0x04
2392#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_2_CLEAR_DATA_OUT_SHIFT 2
2393#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_1_CLEAR_DATA_OUT 0x02
2394#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_1_CLEAR_DATA_OUT_SHIFT 1
2395#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_0_CLEAR_DATA_OUT 0x01
2396#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_0_CLEAR_DATA_OUT_SHIFT 0
2397
2398/* Bit definitions for GPIO_SET_DATA_OUT */
2399#define PALMAS_GPIO_SET_DATA_OUT_GPIO_7_SET_DATA_OUT 0x80
2400#define PALMAS_GPIO_SET_DATA_OUT_GPIO_7_SET_DATA_OUT_SHIFT 7
2401#define PALMAS_GPIO_SET_DATA_OUT_GPIO_6_SET_DATA_OUT 0x40
2402#define PALMAS_GPIO_SET_DATA_OUT_GPIO_6_SET_DATA_OUT_SHIFT 6
2403#define PALMAS_GPIO_SET_DATA_OUT_GPIO_5_SET_DATA_OUT 0x20
2404#define PALMAS_GPIO_SET_DATA_OUT_GPIO_5_SET_DATA_OUT_SHIFT 5
2405#define PALMAS_GPIO_SET_DATA_OUT_GPIO_4_SET_DATA_OUT 0x10
2406#define PALMAS_GPIO_SET_DATA_OUT_GPIO_4_SET_DATA_OUT_SHIFT 4
2407#define PALMAS_GPIO_SET_DATA_OUT_GPIO_3_SET_DATA_OUT 0x08
2408#define PALMAS_GPIO_SET_DATA_OUT_GPIO_3_SET_DATA_OUT_SHIFT 3
2409#define PALMAS_GPIO_SET_DATA_OUT_GPIO_2_SET_DATA_OUT 0x04
2410#define PALMAS_GPIO_SET_DATA_OUT_GPIO_2_SET_DATA_OUT_SHIFT 2
2411#define PALMAS_GPIO_SET_DATA_OUT_GPIO_1_SET_DATA_OUT 0x02
2412#define PALMAS_GPIO_SET_DATA_OUT_GPIO_1_SET_DATA_OUT_SHIFT 1
2413#define PALMAS_GPIO_SET_DATA_OUT_GPIO_0_SET_DATA_OUT 0x01
2414#define PALMAS_GPIO_SET_DATA_OUT_GPIO_0_SET_DATA_OUT_SHIFT 0
2415
2416/* Bit definitions for PU_PD_GPIO_CTRL1 */
2417#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_3_PD 0x40
2418#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_3_PD_SHIFT 6
2419#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_2_PU 0x20
2420#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_2_PU_SHIFT 5
2421#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_2_PD 0x10
2422#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_2_PD_SHIFT 4
2423#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_1_PU 0x08
2424#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_1_PU_SHIFT 3
2425#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_1_PD 0x04
2426#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_1_PD_SHIFT 2
2427#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_0_PD 0x01
2428#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_0_PD_SHIFT 0
2429
2430/* Bit definitions for PU_PD_GPIO_CTRL2 */
2431#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_7_PD 0x40
2432#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_7_PD_SHIFT 6
2433#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_6_PU 0x20
2434#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_6_PU_SHIFT 5
2435#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_6_PD 0x10
2436#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_6_PD_SHIFT 4
2437#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_5_PU 0x08
2438#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_5_PU_SHIFT 3
2439#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_5_PD 0x04
2440#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_5_PD_SHIFT 2
2441#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_4_PU 0x02
2442#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_4_PU_SHIFT 1
2443#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_4_PD 0x01
2444#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_4_PD_SHIFT 0
2445
2446/* Bit definitions for OD_OUTPUT_GPIO_CTRL */
2447#define PALMAS_OD_OUTPUT_GPIO_CTRL_GPIO_5_OD 0x20
2448#define PALMAS_OD_OUTPUT_GPIO_CTRL_GPIO_5_OD_SHIFT 5
2449#define PALMAS_OD_OUTPUT_GPIO_CTRL_GPIO_2_OD 0x04
2450#define PALMAS_OD_OUTPUT_GPIO_CTRL_GPIO_2_OD_SHIFT 2
2451#define PALMAS_OD_OUTPUT_GPIO_CTRL_GPIO_1_OD 0x02
2452#define PALMAS_OD_OUTPUT_GPIO_CTRL_GPIO_1_OD_SHIFT 1
2453
2454/* Registers for function GPADC */
2455#define PALMAS_GPADC_CTRL1 0x0
2456#define PALMAS_GPADC_CTRL2 0x1
2457#define PALMAS_GPADC_RT_CTRL 0x2
2458#define PALMAS_GPADC_AUTO_CTRL 0x3
2459#define PALMAS_GPADC_STATUS 0x4
2460#define PALMAS_GPADC_RT_SELECT 0x5
2461#define PALMAS_GPADC_RT_CONV0_LSB 0x6
2462#define PALMAS_GPADC_RT_CONV0_MSB 0x7
2463#define PALMAS_GPADC_AUTO_SELECT 0x8
2464#define PALMAS_GPADC_AUTO_CONV0_LSB 0x9
2465#define PALMAS_GPADC_AUTO_CONV0_MSB 0xA
2466#define PALMAS_GPADC_AUTO_CONV1_LSB 0xB
2467#define PALMAS_GPADC_AUTO_CONV1_MSB 0xC
2468#define PALMAS_GPADC_SW_SELECT 0xD
2469#define PALMAS_GPADC_SW_CONV0_LSB 0xE
2470#define PALMAS_GPADC_SW_CONV0_MSB 0xF
2471#define PALMAS_GPADC_THRES_CONV0_LSB 0x10
2472#define PALMAS_GPADC_THRES_CONV0_MSB 0x11
2473#define PALMAS_GPADC_THRES_CONV1_LSB 0x12
2474#define PALMAS_GPADC_THRES_CONV1_MSB 0x13
2475#define PALMAS_GPADC_SMPS_ILMONITOR_EN 0x14
2476#define PALMAS_GPADC_SMPS_VSEL_MONITORING 0x15
2477
2478/* Bit definitions for GPADC_CTRL1 */
2479#define PALMAS_GPADC_CTRL1_RESERVED_MASK 0xc0
2480#define PALMAS_GPADC_CTRL1_RESERVED_SHIFT 6
2481#define PALMAS_GPADC_CTRL1_CURRENT_SRC_CH3_MASK 0x30
2482#define PALMAS_GPADC_CTRL1_CURRENT_SRC_CH3_SHIFT 4
2483#define PALMAS_GPADC_CTRL1_CURRENT_SRC_CH0_MASK 0x0c
2484#define PALMAS_GPADC_CTRL1_CURRENT_SRC_CH0_SHIFT 2
2485#define PALMAS_GPADC_CTRL1_BAT_REMOVAL_DET 0x02
2486#define PALMAS_GPADC_CTRL1_BAT_REMOVAL_DET_SHIFT 1
2487#define PALMAS_GPADC_CTRL1_GPADC_FORCE 0x01
2488#define PALMAS_GPADC_CTRL1_GPADC_FORCE_SHIFT 0
2489
2490/* Bit definitions for GPADC_CTRL2 */
2491#define PALMAS_GPADC_CTRL2_RESERVED_MASK 0x06
2492#define PALMAS_GPADC_CTRL2_RESERVED_SHIFT 1
2493
2494/* Bit definitions for GPADC_RT_CTRL */
2495#define PALMAS_GPADC_RT_CTRL_EXTEND_DELAY 0x02
2496#define PALMAS_GPADC_RT_CTRL_EXTEND_DELAY_SHIFT 1
2497#define PALMAS_GPADC_RT_CTRL_START_POLARITY 0x01
2498#define PALMAS_GPADC_RT_CTRL_START_POLARITY_SHIFT 0
2499
2500/* Bit definitions for GPADC_AUTO_CTRL */
2501#define PALMAS_GPADC_AUTO_CTRL_SHUTDOWN_CONV1 0x80
2502#define PALMAS_GPADC_AUTO_CTRL_SHUTDOWN_CONV1_SHIFT 7
2503#define PALMAS_GPADC_AUTO_CTRL_SHUTDOWN_CONV0 0x40
2504#define PALMAS_GPADC_AUTO_CTRL_SHUTDOWN_CONV0_SHIFT 6
2505#define PALMAS_GPADC_AUTO_CTRL_AUTO_CONV1_EN 0x20
2506#define PALMAS_GPADC_AUTO_CTRL_AUTO_CONV1_EN_SHIFT 5
2507#define PALMAS_GPADC_AUTO_CTRL_AUTO_CONV0_EN 0x10
2508#define PALMAS_GPADC_AUTO_CTRL_AUTO_CONV0_EN_SHIFT 4
2509#define PALMAS_GPADC_AUTO_CTRL_COUNTER_CONV_MASK 0x0f
2510#define PALMAS_GPADC_AUTO_CTRL_COUNTER_CONV_SHIFT 0
2511
2512/* Bit definitions for GPADC_STATUS */
2513#define PALMAS_GPADC_STATUS_GPADC_AVAILABLE 0x10
2514#define PALMAS_GPADC_STATUS_GPADC_AVAILABLE_SHIFT 4
2515
2516/* Bit definitions for GPADC_RT_SELECT */
2517#define PALMAS_GPADC_RT_SELECT_RT_CONV_EN 0x80
2518#define PALMAS_GPADC_RT_SELECT_RT_CONV_EN_SHIFT 7
2519#define PALMAS_GPADC_RT_SELECT_RT_CONV0_SEL_MASK 0x0f
2520#define PALMAS_GPADC_RT_SELECT_RT_CONV0_SEL_SHIFT 0
2521
2522/* Bit definitions for GPADC_RT_CONV0_LSB */
2523#define PALMAS_GPADC_RT_CONV0_LSB_RT_CONV0_LSB_MASK 0xff
2524#define PALMAS_GPADC_RT_CONV0_LSB_RT_CONV0_LSB_SHIFT 0
2525
2526/* Bit definitions for GPADC_RT_CONV0_MSB */
2527#define PALMAS_GPADC_RT_CONV0_MSB_RT_CONV0_MSB_MASK 0x0f
2528#define PALMAS_GPADC_RT_CONV0_MSB_RT_CONV0_MSB_SHIFT 0
2529
2530/* Bit definitions for GPADC_AUTO_SELECT */
2531#define PALMAS_GPADC_AUTO_SELECT_AUTO_CONV1_SEL_MASK 0xf0
2532#define PALMAS_GPADC_AUTO_SELECT_AUTO_CONV1_SEL_SHIFT 4
2533#define PALMAS_GPADC_AUTO_SELECT_AUTO_CONV0_SEL_MASK 0x0f
2534#define PALMAS_GPADC_AUTO_SELECT_AUTO_CONV0_SEL_SHIFT 0
2535
2536/* Bit definitions for GPADC_AUTO_CONV0_LSB */
2537#define PALMAS_GPADC_AUTO_CONV0_LSB_AUTO_CONV0_LSB_MASK 0xff
2538#define PALMAS_GPADC_AUTO_CONV0_LSB_AUTO_CONV0_LSB_SHIFT 0
2539
2540/* Bit definitions for GPADC_AUTO_CONV0_MSB */
2541#define PALMAS_GPADC_AUTO_CONV0_MSB_AUTO_CONV0_MSB_MASK 0x0f
2542#define PALMAS_GPADC_AUTO_CONV0_MSB_AUTO_CONV0_MSB_SHIFT 0
2543
2544/* Bit definitions for GPADC_AUTO_CONV1_LSB */
2545#define PALMAS_GPADC_AUTO_CONV1_LSB_AUTO_CONV1_LSB_MASK 0xff
2546#define PALMAS_GPADC_AUTO_CONV1_LSB_AUTO_CONV1_LSB_SHIFT 0
2547
2548/* Bit definitions for GPADC_AUTO_CONV1_MSB */
2549#define PALMAS_GPADC_AUTO_CONV1_MSB_AUTO_CONV1_MSB_MASK 0x0f
2550#define PALMAS_GPADC_AUTO_CONV1_MSB_AUTO_CONV1_MSB_SHIFT 0
2551
2552/* Bit definitions for GPADC_SW_SELECT */
2553#define PALMAS_GPADC_SW_SELECT_SW_CONV_EN 0x80
2554#define PALMAS_GPADC_SW_SELECT_SW_CONV_EN_SHIFT 7
2555#define PALMAS_GPADC_SW_SELECT_SW_START_CONV0 0x10
2556#define PALMAS_GPADC_SW_SELECT_SW_START_CONV0_SHIFT 4
2557#define PALMAS_GPADC_SW_SELECT_SW_CONV0_SEL_MASK 0x0f
2558#define PALMAS_GPADC_SW_SELECT_SW_CONV0_SEL_SHIFT 0
2559
2560/* Bit definitions for GPADC_SW_CONV0_LSB */
2561#define PALMAS_GPADC_SW_CONV0_LSB_SW_CONV0_LSB_MASK 0xff
2562#define PALMAS_GPADC_SW_CONV0_LSB_SW_CONV0_LSB_SHIFT 0
2563
2564/* Bit definitions for GPADC_SW_CONV0_MSB */
2565#define PALMAS_GPADC_SW_CONV0_MSB_SW_CONV0_MSB_MASK 0x0f
2566#define PALMAS_GPADC_SW_CONV0_MSB_SW_CONV0_MSB_SHIFT 0
2567
2568/* Bit definitions for GPADC_THRES_CONV0_LSB */
2569#define PALMAS_GPADC_THRES_CONV0_LSB_THRES_CONV0_LSB_MASK 0xff
2570#define PALMAS_GPADC_THRES_CONV0_LSB_THRES_CONV0_LSB_SHIFT 0
2571
2572/* Bit definitions for GPADC_THRES_CONV0_MSB */
2573#define PALMAS_GPADC_THRES_CONV0_MSB_THRES_CONV0_POL 0x80
2574#define PALMAS_GPADC_THRES_CONV0_MSB_THRES_CONV0_POL_SHIFT 7
2575#define PALMAS_GPADC_THRES_CONV0_MSB_THRES_CONV0_MSB_MASK 0x0f
2576#define PALMAS_GPADC_THRES_CONV0_MSB_THRES_CONV0_MSB_SHIFT 0
2577
2578/* Bit definitions for GPADC_THRES_CONV1_LSB */
2579#define PALMAS_GPADC_THRES_CONV1_LSB_THRES_CONV1_LSB_MASK 0xff
2580#define PALMAS_GPADC_THRES_CONV1_LSB_THRES_CONV1_LSB_SHIFT 0
2581
2582/* Bit definitions for GPADC_THRES_CONV1_MSB */
2583#define PALMAS_GPADC_THRES_CONV1_MSB_THRES_CONV1_POL 0x80
2584#define PALMAS_GPADC_THRES_CONV1_MSB_THRES_CONV1_POL_SHIFT 7
2585#define PALMAS_GPADC_THRES_CONV1_MSB_THRES_CONV1_MSB_MASK 0x0f
2586#define PALMAS_GPADC_THRES_CONV1_MSB_THRES_CONV1_MSB_SHIFT 0
2587
2588/* Bit definitions for GPADC_SMPS_ILMONITOR_EN */
2589#define PALMAS_GPADC_SMPS_ILMONITOR_EN_SMPS_ILMON_EN 0x20
2590#define PALMAS_GPADC_SMPS_ILMONITOR_EN_SMPS_ILMON_EN_SHIFT 5
2591#define PALMAS_GPADC_SMPS_ILMONITOR_EN_SMPS_ILMON_REXT 0x10
2592#define PALMAS_GPADC_SMPS_ILMONITOR_EN_SMPS_ILMON_REXT_SHIFT 4
2593#define PALMAS_GPADC_SMPS_ILMONITOR_EN_SMPS_ILMON_SEL_MASK 0x0f
2594#define PALMAS_GPADC_SMPS_ILMONITOR_EN_SMPS_ILMON_SEL_SHIFT 0
2595
2596/* Bit definitions for GPADC_SMPS_VSEL_MONITORING */
2597#define PALMAS_GPADC_SMPS_VSEL_MONITORING_ACTIVE_PHASE 0x80
2598#define PALMAS_GPADC_SMPS_VSEL_MONITORING_ACTIVE_PHASE_SHIFT 7
2599#define PALMAS_GPADC_SMPS_VSEL_MONITORING_SMPS_VSEL_MONITORING_MASK 0x7f
2600#define PALMAS_GPADC_SMPS_VSEL_MONITORING_SMPS_VSEL_MONITORING_SHIFT 0
2601
2602/* Registers for function GPADC */
2603#define PALMAS_GPADC_TRIM1 0x0
2604#define PALMAS_GPADC_TRIM2 0x1
2605#define PALMAS_GPADC_TRIM3 0x2
2606#define PALMAS_GPADC_TRIM4 0x3
2607#define PALMAS_GPADC_TRIM5 0x4
2608#define PALMAS_GPADC_TRIM6 0x5
2609#define PALMAS_GPADC_TRIM7 0x6
2610#define PALMAS_GPADC_TRIM8 0x7
2611#define PALMAS_GPADC_TRIM9 0x8
2612#define PALMAS_GPADC_TRIM10 0x9
2613#define PALMAS_GPADC_TRIM11 0xA
2614#define PALMAS_GPADC_TRIM12 0xB
2615#define PALMAS_GPADC_TRIM13 0xC
2616#define PALMAS_GPADC_TRIM14 0xD
2617#define PALMAS_GPADC_TRIM15 0xE
2618#define PALMAS_GPADC_TRIM16 0xF
2619
2620#endif /* __LINUX_MFD_PALMAS_H */
diff --git a/include/linux/mfd/rc5t583.h b/include/linux/mfd/rc5t583.h
index 0b64b19d81ab..3661c59aa1e9 100644
--- a/include/linux/mfd/rc5t583.h
+++ b/include/linux/mfd/rc5t583.h
@@ -250,6 +250,26 @@ enum {
250 RC5T583_EXT_PWRREQ2_CONTROL = 0x2, 250 RC5T583_EXT_PWRREQ2_CONTROL = 0x2,
251}; 251};
252 252
253enum {
254 RC5T583_REGULATOR_DC0,
255 RC5T583_REGULATOR_DC1,
256 RC5T583_REGULATOR_DC2,
257 RC5T583_REGULATOR_DC3,
258 RC5T583_REGULATOR_LDO0,
259 RC5T583_REGULATOR_LDO1,
260 RC5T583_REGULATOR_LDO2,
261 RC5T583_REGULATOR_LDO3,
262 RC5T583_REGULATOR_LDO4,
263 RC5T583_REGULATOR_LDO5,
264 RC5T583_REGULATOR_LDO6,
265 RC5T583_REGULATOR_LDO7,
266 RC5T583_REGULATOR_LDO8,
267 RC5T583_REGULATOR_LDO9,
268
269 /* Should be last entry */
270 RC5T583_REGULATOR_MAX,
271};
272
253struct rc5t583 { 273struct rc5t583 {
254 struct device *dev; 274 struct device *dev;
255 struct regmap *regmap; 275 struct regmap *regmap;
@@ -272,12 +292,23 @@ struct rc5t583 {
272 * rc5t583_platform_data: Platform data for ricoh rc5t583 pmu. 292 * rc5t583_platform_data: Platform data for ricoh rc5t583 pmu.
273 * The board specific data is provided through this structure. 293 * The board specific data is provided through this structure.
274 * @irq_base: Irq base number on which this device registers their interrupts. 294 * @irq_base: Irq base number on which this device registers their interrupts.
295 * @gpio_base: GPIO base from which gpio of this device will start.
275 * @enable_shutdown: Enable shutdown through the input pin "shutdown". 296 * @enable_shutdown: Enable shutdown through the input pin "shutdown".
297 * @regulator_deepsleep_slot: The slot number on which device goes to sleep
298 * in device sleep mode.
299 * @regulator_ext_pwr_control: External power request regulator control. The
300 * regulator output enable/disable is controlled by the external
301 * power request input state.
302 * @reg_init_data: Regulator init data.
276 */ 303 */
277 304
278struct rc5t583_platform_data { 305struct rc5t583_platform_data {
279 int irq_base; 306 int irq_base;
307 int gpio_base;
280 bool enable_shutdown; 308 bool enable_shutdown;
309 int regulator_deepsleep_slot[RC5T583_REGULATOR_MAX];
310 unsigned long regulator_ext_pwr_control[RC5T583_REGULATOR_MAX];
311 struct regulator_init_data *reg_init_data[RC5T583_REGULATOR_MAX];
281}; 312};
282 313
283static inline int rc5t583_write(struct device *dev, uint8_t reg, uint8_t val) 314static inline int rc5t583_write(struct device *dev, uint8_t reg, uint8_t val)
diff --git a/include/linux/mfd/s5m87xx/s5m-core.h b/include/linux/mfd/s5m87xx/s5m-core.h
index a7480b57f92d..21603b42f22f 100644
--- a/include/linux/mfd/s5m87xx/s5m-core.h
+++ b/include/linux/mfd/s5m87xx/s5m-core.h
@@ -335,6 +335,7 @@ extern int s5m_reg_update(struct s5m87xx_dev *s5m87xx, u8 reg, u8 val, u8 mask);
335 335
336struct s5m_platform_data { 336struct s5m_platform_data {
337 struct s5m_regulator_data *regulators; 337 struct s5m_regulator_data *regulators;
338 struct s5m_opmode_data *opmode;
338 int device_type; 339 int device_type;
339 int num_regulators; 340 int num_regulators;
340 341
diff --git a/include/linux/mfd/s5m87xx/s5m-pmic.h b/include/linux/mfd/s5m87xx/s5m-pmic.h
index a72a5d27e62e..7c719f20f58a 100644
--- a/include/linux/mfd/s5m87xx/s5m-pmic.h
+++ b/include/linux/mfd/s5m87xx/s5m-pmic.h
@@ -58,6 +58,8 @@ enum s5m8767_regulators {
58 S5M8767_REG_MAX, 58 S5M8767_REG_MAX,
59}; 59};
60 60
61#define S5M8767_ENCTRL_SHIFT 6
62
61/* S5M8763 regulator ids */ 63/* S5M8763 regulator ids */
62enum s5m8763_regulators { 64enum s5m8763_regulators {
63 S5M8763_LDO1, 65 S5M8763_LDO1,
@@ -97,4 +99,31 @@ struct s5m_regulator_data {
97 struct regulator_init_data *initdata; 99 struct regulator_init_data *initdata;
98}; 100};
99 101
102/*
103 * s5m_opmode_data - regulator operation mode data
104 * @id: regulator id
105 * @mode: regulator operation mode
106 */
107struct s5m_opmode_data {
108 int id;
109 int mode;
110};
111
112/*
113 * s5m regulator operation mode
114 * S5M_OPMODE_OFF Regulator always OFF
115 * S5M_OPMODE_ON Regulator always ON
116 * S5M_OPMODE_LOWPOWER Regulator is on in low-power mode
117 * S5M_OPMODE_SUSPEND Regulator is changed by PWREN pin
118 * If PWREN is high, regulator is on
119 * If PWREN is low, regulator is off
120 */
121
122enum s5m_opmode {
123 S5M_OPMODE_OFF,
124 S5M_OPMODE_ON,
125 S5M_OPMODE_LOWPOWER,
126 S5M_OPMODE_SUSPEND,
127};
128
100#endif /* __LINUX_MFD_S5M_PMIC_H */ 129#endif /* __LINUX_MFD_S5M_PMIC_H */
diff --git a/include/linux/mfd/tps65090.h b/include/linux/mfd/tps65090.h
index 38e31c55adbb..6bc31d854626 100644
--- a/include/linux/mfd/tps65090.h
+++ b/include/linux/mfd/tps65090.h
@@ -22,6 +22,19 @@
22#ifndef __LINUX_MFD_TPS65090_H 22#ifndef __LINUX_MFD_TPS65090_H
23#define __LINUX_MFD_TPS65090_H 23#define __LINUX_MFD_TPS65090_H
24 24
25#include <linux/irq.h>
26
27struct tps65090 {
28 struct mutex lock;
29 struct device *dev;
30 struct i2c_client *client;
31 struct regmap *rmap;
32 struct irq_chip irq_chip;
33 struct mutex irq_lock;
34 int irq_base;
35 unsigned int id;
36};
37
25struct tps65090_subdev_info { 38struct tps65090_subdev_info {
26 int id; 39 int id;
27 const char *name; 40 const char *name;
diff --git a/include/linux/mfd/tps6586x.h b/include/linux/mfd/tps6586x.h
index b19176eab44d..f350fd0ba1df 100644
--- a/include/linux/mfd/tps6586x.h
+++ b/include/linux/mfd/tps6586x.h
@@ -68,6 +68,7 @@ struct tps6586x_subdev_info {
68 int id; 68 int id;
69 const char *name; 69 const char *name;
70 void *platform_data; 70 void *platform_data;
71 struct device_node *of_node;
71}; 72};
72 73
73struct tps6586x_platform_data { 74struct tps6586x_platform_data {
diff --git a/include/linux/mfd/wm831x/pdata.h b/include/linux/mfd/wm831x/pdata.h
index 1d7a3f7b3b5d..dcc9631b3052 100644
--- a/include/linux/mfd/wm831x/pdata.h
+++ b/include/linux/mfd/wm831x/pdata.h
@@ -26,7 +26,7 @@ struct wm831x_backlight_pdata {
26struct wm831x_backup_pdata { 26struct wm831x_backup_pdata {
27 int charger_enable; 27 int charger_enable;
28 int no_constant_voltage; /** Disable constant voltage charging */ 28 int no_constant_voltage; /** Disable constant voltage charging */
29 int vlim; /** Voltage limit in milivolts */ 29 int vlim; /** Voltage limit in millivolts */
30 int ilim; /** Current limit in microamps */ 30 int ilim; /** Current limit in microamps */
31}; 31};
32 32
diff --git a/include/linux/mfd/wm8994/core.h b/include/linux/mfd/wm8994/core.h
index d41bc7b8a86a..1f173306bf05 100644
--- a/include/linux/mfd/wm8994/core.h
+++ b/include/linux/mfd/wm8994/core.h
@@ -17,6 +17,7 @@
17 17
18#include <linux/mutex.h> 18#include <linux/mutex.h>
19#include <linux/interrupt.h> 19#include <linux/interrupt.h>
20#include <linux/regmap.h>
20 21
21enum wm8994_type { 22enum wm8994_type {
22 WM8994 = 0, 23 WM8994 = 0,
@@ -26,7 +27,6 @@ enum wm8994_type {
26 27
27struct regulator_dev; 28struct regulator_dev;
28struct regulator_bulk_data; 29struct regulator_bulk_data;
29struct regmap;
30 30
31#define WM8994_NUM_GPIO_REGS 11 31#define WM8994_NUM_GPIO_REGS 11
32#define WM8994_NUM_LDO_REGS 2 32#define WM8994_NUM_LDO_REGS 2
@@ -95,17 +95,17 @@ static inline int wm8994_request_irq(struct wm8994 *wm8994, int irq,
95 irq_handler_t handler, const char *name, 95 irq_handler_t handler, const char *name,
96 void *data) 96 void *data)
97{ 97{
98 if (!wm8994->irq_base) 98 if (!wm8994->irq_data)
99 return -EINVAL; 99 return -EINVAL;
100 return request_threaded_irq(wm8994->irq_base + irq, NULL, handler, 100 return request_threaded_irq(regmap_irq_get_virq(wm8994->irq_data, irq),
101 IRQF_TRIGGER_RISING, name, 101 NULL, handler, IRQF_TRIGGER_RISING, name,
102 data); 102 data);
103} 103}
104static inline void wm8994_free_irq(struct wm8994 *wm8994, int irq, void *data) 104static inline void wm8994_free_irq(struct wm8994 *wm8994, int irq, void *data)
105{ 105{
106 if (!wm8994->irq_base) 106 if (!wm8994->irq_data)
107 return; 107 return;
108 free_irq(wm8994->irq_base + irq, data); 108 free_irq(regmap_irq_get_virq(wm8994->irq_data, irq), data);
109} 109}
110 110
111int wm8994_irq_init(struct wm8994 *wm8994); 111int wm8994_irq_init(struct wm8994 *wm8994);
diff --git a/include/linux/micrel_phy.h b/include/linux/micrel_phy.h
index dd8da342a991..61f0905bdc48 100644
--- a/include/linux/micrel_phy.h
+++ b/include/linux/micrel_phy.h
@@ -3,7 +3,7 @@
3 3
4#define MICREL_PHY_ID_MASK 0x00fffff0 4#define MICREL_PHY_ID_MASK 0x00fffff0
5 5
6#define PHY_ID_KSZ9021 0x00221611 6#define PHY_ID_KSZ9021 0x00221610
7#define PHY_ID_KS8737 0x00221720 7#define PHY_ID_KS8737 0x00221720
8#define PHY_ID_KS8041 0x00221510 8#define PHY_ID_KS8041 0x00221510
9#define PHY_ID_KS8051 0x00221550 9#define PHY_ID_KS8051 0x00221550
diff --git a/include/linux/mlx4/cmd.h b/include/linux/mlx4/cmd.h
index 9958ff2cad3c..1f3860a8a109 100644
--- a/include/linux/mlx4/cmd.h
+++ b/include/linux/mlx4/cmd.h
@@ -150,6 +150,10 @@ enum {
150 /* statistics commands */ 150 /* statistics commands */
151 MLX4_CMD_QUERY_IF_STAT = 0X54, 151 MLX4_CMD_QUERY_IF_STAT = 0X54,
152 MLX4_CMD_SET_IF_STAT = 0X55, 152 MLX4_CMD_SET_IF_STAT = 0X55,
153
154 /* set port opcode modifiers */
155 MLX4_SET_PORT_PRIO2TC = 0x8,
156 MLX4_SET_PORT_SCHEDULER = 0x9,
153}; 157};
154 158
155enum { 159enum {
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index 834c96c5d879..6e27fa99e8b9 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -98,6 +98,12 @@ enum {
98 MLX4_DEV_CAP_FLAG_SENSE_SUPPORT = 1LL << 55 98 MLX4_DEV_CAP_FLAG_SENSE_SUPPORT = 1LL << 55
99}; 99};
100 100
101enum {
102 MLX4_DEV_CAP_FLAG2_RSS = 1LL << 0,
103 MLX4_DEV_CAP_FLAG2_RSS_TOP = 1LL << 1,
104 MLX4_DEV_CAP_FLAG2_RSS_XOR = 1LL << 2
105};
106
101#define MLX4_ATTR_EXTENDED_PORT_INFO cpu_to_be16(0xff90) 107#define MLX4_ATTR_EXTENDED_PORT_INFO cpu_to_be16(0xff90)
102 108
103enum { 109enum {
@@ -292,11 +298,13 @@ struct mlx4_caps {
292 u32 max_msg_sz; 298 u32 max_msg_sz;
293 u32 page_size_cap; 299 u32 page_size_cap;
294 u64 flags; 300 u64 flags;
301 u64 flags2;
295 u32 bmme_flags; 302 u32 bmme_flags;
296 u32 reserved_lkey; 303 u32 reserved_lkey;
297 u16 stat_rate_support; 304 u16 stat_rate_support;
298 u8 port_width_cap[MLX4_MAX_PORTS + 1]; 305 u8 port_width_cap[MLX4_MAX_PORTS + 1];
299 int max_gso_sz; 306 int max_gso_sz;
307 int max_rss_tbl_sz;
300 int reserved_qps_cnt[MLX4_NUM_QP_REGION]; 308 int reserved_qps_cnt[MLX4_NUM_QP_REGION];
301 int reserved_qps; 309 int reserved_qps;
302 int reserved_qps_base[MLX4_NUM_QP_REGION]; 310 int reserved_qps_base[MLX4_NUM_QP_REGION];
@@ -628,6 +636,9 @@ int mlx4_SET_PORT_general(struct mlx4_dev *dev, u8 port, int mtu,
628 u8 pptx, u8 pfctx, u8 pprx, u8 pfcrx); 636 u8 pptx, u8 pfctx, u8 pprx, u8 pfcrx);
629int mlx4_SET_PORT_qpn_calc(struct mlx4_dev *dev, u8 port, u32 base_qpn, 637int mlx4_SET_PORT_qpn_calc(struct mlx4_dev *dev, u8 port, u32 base_qpn,
630 u8 promisc); 638 u8 promisc);
639int mlx4_SET_PORT_PRIO2TC(struct mlx4_dev *dev, u8 port, u8 *prio2tc);
640int mlx4_SET_PORT_SCHEDULER(struct mlx4_dev *dev, u8 port, u8 *tc_tx_bw,
641 u8 *pg, u16 *ratelimit);
631int mlx4_find_cached_vlan(struct mlx4_dev *dev, u8 port, u16 vid, int *idx); 642int mlx4_find_cached_vlan(struct mlx4_dev *dev, u8 port, u16 vid, int *idx);
632int mlx4_register_vlan(struct mlx4_dev *dev, u8 port, u16 vlan, int *index); 643int mlx4_register_vlan(struct mlx4_dev *dev, u8 port, u16 vlan, int *index);
633void mlx4_unregister_vlan(struct mlx4_dev *dev, u8 port, int index); 644void mlx4_unregister_vlan(struct mlx4_dev *dev, u8 port, int index);
diff --git a/include/linux/mlx4/qp.h b/include/linux/mlx4/qp.h
index 091f9e7dc8b9..338388ba260a 100644
--- a/include/linux/mlx4/qp.h
+++ b/include/linux/mlx4/qp.h
@@ -139,7 +139,8 @@ struct mlx4_qp_path {
139 u8 rgid[16]; 139 u8 rgid[16];
140 u8 sched_queue; 140 u8 sched_queue;
141 u8 vlan_index; 141 u8 vlan_index;
142 u8 reserved3[2]; 142 u8 feup;
143 u8 reserved3;
143 u8 reserved4[2]; 144 u8 reserved4[2];
144 u8 dmac[6]; 145 u8 dmac[6];
145}; 146};
@@ -233,7 +234,8 @@ struct mlx4_wqe_mlx_seg {
233 u8 owner; 234 u8 owner;
234 u8 reserved1[2]; 235 u8 reserved1[2];
235 u8 opcode; 236 u8 opcode;
236 u8 reserved2[3]; 237 __be16 sched_prio;
238 u8 reserved2;
237 u8 size; 239 u8 size;
238 /* 240 /*
239 * [17] VL15 241 * [17] VL15
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 74aa71bea1e4..7d5c37f24c63 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -896,10 +896,8 @@ int zap_vma_ptes(struct vm_area_struct *vma, unsigned long address,
896 unsigned long size); 896 unsigned long size);
897void zap_page_range(struct vm_area_struct *vma, unsigned long address, 897void zap_page_range(struct vm_area_struct *vma, unsigned long address,
898 unsigned long size, struct zap_details *); 898 unsigned long size, struct zap_details *);
899void unmap_vmas(struct mmu_gather *tlb, 899void unmap_vmas(struct mmu_gather *tlb, struct vm_area_struct *start_vma,
900 struct vm_area_struct *start_vma, unsigned long start_addr, 900 unsigned long start, unsigned long end);
901 unsigned long end_addr, unsigned long *nr_accounted,
902 struct zap_details *);
903 901
904/** 902/**
905 * mm_walk - callbacks for walk_page_range 903 * mm_walk - callbacks for walk_page_range
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index 3cc3062b3767..26574c726121 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -12,6 +12,7 @@
12#include <linux/completion.h> 12#include <linux/completion.h>
13#include <linux/cpumask.h> 13#include <linux/cpumask.h>
14#include <linux/page-debug-flags.h> 14#include <linux/page-debug-flags.h>
15#include <linux/uprobes.h>
15#include <asm/page.h> 16#include <asm/page.h>
16#include <asm/mmu.h> 17#include <asm/mmu.h>
17 18
@@ -388,6 +389,7 @@ struct mm_struct {
388#ifdef CONFIG_CPUMASK_OFFSTACK 389#ifdef CONFIG_CPUMASK_OFFSTACK
389 struct cpumask cpumask_allocation; 390 struct cpumask cpumask_allocation;
390#endif 391#endif
392 struct uprobes_state uprobes_state;
391}; 393};
392 394
393static inline void mm_init_cpumask(struct mm_struct *mm) 395static inline void mm_init_cpumask(struct mm_struct *mm)
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index 629b823f8836..d76513b5b263 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -58,6 +58,10 @@ struct mmc_ext_csd {
58 unsigned int generic_cmd6_time; /* Units: 10ms */ 58 unsigned int generic_cmd6_time; /* Units: 10ms */
59 unsigned int power_off_longtime; /* Units: ms */ 59 unsigned int power_off_longtime; /* Units: ms */
60 unsigned int hs_max_dtr; 60 unsigned int hs_max_dtr;
61#define MMC_HIGH_26_MAX_DTR 26000000
62#define MMC_HIGH_52_MAX_DTR 52000000
63#define MMC_HIGH_DDR_MAX_DTR 52000000
64#define MMC_HS200_MAX_DTR 200000000
61 unsigned int sectors; 65 unsigned int sectors;
62 unsigned int card_type; 66 unsigned int card_type;
63 unsigned int hc_erase_size; /* In sectors */ 67 unsigned int hc_erase_size; /* In sectors */
diff --git a/include/linux/mmc/dw_mmc.h b/include/linux/mmc/dw_mmc.h
index 8f66e28f5a0f..7a7ebd367cfd 100644
--- a/include/linux/mmc/dw_mmc.h
+++ b/include/linux/mmc/dw_mmc.h
@@ -125,6 +125,7 @@ struct dw_mci {
125 struct mmc_request *mrq; 125 struct mmc_request *mrq;
126 struct mmc_command *cmd; 126 struct mmc_command *cmd;
127 struct mmc_data *data; 127 struct mmc_data *data;
128 struct workqueue_struct *card_workqueue;
128 129
129 /* DMA interface members*/ 130 /* DMA interface members*/
130 int use_dma; 131 int use_dma;
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index cbde4b7e675e..0707d228d7f1 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -297,6 +297,7 @@ struct mmc_host {
297 297
298 unsigned int sdio_irqs; 298 unsigned int sdio_irqs;
299 struct task_struct *sdio_irq_thread; 299 struct task_struct *sdio_irq_thread;
300 bool sdio_irq_pending;
300 atomic_t sdio_irq_thread_abort; 301 atomic_t sdio_irq_thread_abort;
301 302
302 mmc_pm_flag_t pm_flags; /* requested pm features */ 303 mmc_pm_flag_t pm_flags; /* requested pm features */
@@ -352,6 +353,7 @@ extern int mmc_cache_ctrl(struct mmc_host *, u8);
352static inline void mmc_signal_sdio_irq(struct mmc_host *host) 353static inline void mmc_signal_sdio_irq(struct mmc_host *host)
353{ 354{
354 host->ops->enable_sdio_irq(host, 0); 355 host->ops->enable_sdio_irq(host, 0);
356 host->sdio_irq_pending = true;
355 wake_up_process(host->sdio_irq_thread); 357 wake_up_process(host->sdio_irq_thread);
356} 358}
357 359
diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h
index b822a2cb6008..d425cab144d9 100644
--- a/include/linux/mmc/mmc.h
+++ b/include/linux/mmc/mmc.h
@@ -354,66 +354,6 @@ struct _mmc_csd {
354#define EXT_CSD_CARD_TYPE_SDR_1_2V (1<<5) /* Card can run at 200MHz */ 354#define EXT_CSD_CARD_TYPE_SDR_1_2V (1<<5) /* Card can run at 200MHz */
355 /* SDR mode @1.2V I/O */ 355 /* SDR mode @1.2V I/O */
356 356
357#define EXT_CSD_CARD_TYPE_SDR_200 (EXT_CSD_CARD_TYPE_SDR_1_8V | \
358 EXT_CSD_CARD_TYPE_SDR_1_2V)
359
360#define EXT_CSD_CARD_TYPE_SDR_ALL (EXT_CSD_CARD_TYPE_SDR_200 | \
361 EXT_CSD_CARD_TYPE_52 | \
362 EXT_CSD_CARD_TYPE_26)
363
364#define EXT_CSD_CARD_TYPE_SDR_1_2V_ALL (EXT_CSD_CARD_TYPE_SDR_1_2V | \
365 EXT_CSD_CARD_TYPE_52 | \
366 EXT_CSD_CARD_TYPE_26)
367
368#define EXT_CSD_CARD_TYPE_SDR_1_8V_ALL (EXT_CSD_CARD_TYPE_SDR_1_8V | \
369 EXT_CSD_CARD_TYPE_52 | \
370 EXT_CSD_CARD_TYPE_26)
371
372#define EXT_CSD_CARD_TYPE_SDR_1_2V_DDR_1_8V (EXT_CSD_CARD_TYPE_SDR_1_2V | \
373 EXT_CSD_CARD_TYPE_DDR_1_8V | \
374 EXT_CSD_CARD_TYPE_52 | \
375 EXT_CSD_CARD_TYPE_26)
376
377#define EXT_CSD_CARD_TYPE_SDR_1_8V_DDR_1_8V (EXT_CSD_CARD_TYPE_SDR_1_8V | \
378 EXT_CSD_CARD_TYPE_DDR_1_8V | \
379 EXT_CSD_CARD_TYPE_52 | \
380 EXT_CSD_CARD_TYPE_26)
381
382#define EXT_CSD_CARD_TYPE_SDR_1_2V_DDR_1_2V (EXT_CSD_CARD_TYPE_SDR_1_2V | \
383 EXT_CSD_CARD_TYPE_DDR_1_2V | \
384 EXT_CSD_CARD_TYPE_52 | \
385 EXT_CSD_CARD_TYPE_26)
386
387#define EXT_CSD_CARD_TYPE_SDR_1_8V_DDR_1_2V (EXT_CSD_CARD_TYPE_SDR_1_8V | \
388 EXT_CSD_CARD_TYPE_DDR_1_2V | \
389 EXT_CSD_CARD_TYPE_52 | \
390 EXT_CSD_CARD_TYPE_26)
391
392#define EXT_CSD_CARD_TYPE_SDR_1_2V_DDR_52 (EXT_CSD_CARD_TYPE_SDR_1_2V | \
393 EXT_CSD_CARD_TYPE_DDR_52 | \
394 EXT_CSD_CARD_TYPE_52 | \
395 EXT_CSD_CARD_TYPE_26)
396
397#define EXT_CSD_CARD_TYPE_SDR_1_8V_DDR_52 (EXT_CSD_CARD_TYPE_SDR_1_8V | \
398 EXT_CSD_CARD_TYPE_DDR_52 | \
399 EXT_CSD_CARD_TYPE_52 | \
400 EXT_CSD_CARD_TYPE_26)
401
402#define EXT_CSD_CARD_TYPE_SDR_ALL_DDR_1_8V (EXT_CSD_CARD_TYPE_SDR_200 | \
403 EXT_CSD_CARD_TYPE_DDR_1_8V | \
404 EXT_CSD_CARD_TYPE_52 | \
405 EXT_CSD_CARD_TYPE_26)
406
407#define EXT_CSD_CARD_TYPE_SDR_ALL_DDR_1_2V (EXT_CSD_CARD_TYPE_SDR_200 | \
408 EXT_CSD_CARD_TYPE_DDR_1_2V | \
409 EXT_CSD_CARD_TYPE_52 | \
410 EXT_CSD_CARD_TYPE_26)
411
412#define EXT_CSD_CARD_TYPE_SDR_ALL_DDR_52 (EXT_CSD_CARD_TYPE_SDR_200 | \
413 EXT_CSD_CARD_TYPE_DDR_52 | \
414 EXT_CSD_CARD_TYPE_52 | \
415 EXT_CSD_CARD_TYPE_26)
416
417#define EXT_CSD_BUS_WIDTH_1 0 /* Card is in 1 bit mode */ 357#define EXT_CSD_BUS_WIDTH_1 0 /* Card is in 1 bit mode */
418#define EXT_CSD_BUS_WIDTH_4 1 /* Card is in 4 bit mode */ 358#define EXT_CSD_BUS_WIDTH_4 1 /* Card is in 4 bit mode */
419#define EXT_CSD_BUS_WIDTH_8 2 /* Card is in 8 bit mode */ 359#define EXT_CSD_BUS_WIDTH_8 2 /* Card is in 8 bit mode */
diff --git a/include/linux/mmc/mxs-mmc.h b/include/linux/mmc/mxs-mmc.h
new file mode 100644
index 000000000000..7c2ad3a7f2f3
--- /dev/null
+++ b/include/linux/mmc/mxs-mmc.h
@@ -0,0 +1,19 @@
1/*
2 * Copyright 2011 Freescale Semiconductor, Inc. All Rights Reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#ifndef __LINUX_MMC_MXS_MMC_H__
10#define __LINUX_MMC_MXS_MMC_H__
11
12struct mxs_mmc_platform_data {
13 int wp_gpio; /* write protect pin */
14 unsigned int flags;
15#define SLOTF_4_BIT_CAPABLE (1 << 0)
16#define SLOTF_8_BIT_CAPABLE (1 << 1)
17};
18
19#endif /* __LINUX_MMC_MXS_MMC_H__ */
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index dff711509661..4871e31ae277 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -30,18 +30,44 @@
30/* 30/*
31 * PAGE_ALLOC_COSTLY_ORDER is the order at which allocations are deemed 31 * PAGE_ALLOC_COSTLY_ORDER is the order at which allocations are deemed
32 * costly to service. That is between allocation orders which should 32 * costly to service. That is between allocation orders which should
33 * coelesce naturally under reasonable reclaim pressure and those which 33 * coalesce naturally under reasonable reclaim pressure and those which
34 * will not. 34 * will not.
35 */ 35 */
36#define PAGE_ALLOC_COSTLY_ORDER 3 36#define PAGE_ALLOC_COSTLY_ORDER 3
37 37
38#define MIGRATE_UNMOVABLE 0 38enum {
39#define MIGRATE_RECLAIMABLE 1 39 MIGRATE_UNMOVABLE,
40#define MIGRATE_MOVABLE 2 40 MIGRATE_RECLAIMABLE,
41#define MIGRATE_PCPTYPES 3 /* the number of types on the pcp lists */ 41 MIGRATE_MOVABLE,
42#define MIGRATE_RESERVE 3 42 MIGRATE_PCPTYPES, /* the number of types on the pcp lists */
43#define MIGRATE_ISOLATE 4 /* can't allocate from here */ 43 MIGRATE_RESERVE = MIGRATE_PCPTYPES,
44#define MIGRATE_TYPES 5 44#ifdef CONFIG_CMA
45 /*
46 * MIGRATE_CMA migration type is designed to mimic the way
47 * ZONE_MOVABLE works. Only movable pages can be allocated
48 * from MIGRATE_CMA pageblocks and page allocator never
49 * implicitly change migration type of MIGRATE_CMA pageblock.
50 *
51 * The way to use it is to change migratetype of a range of
52 * pageblocks to MIGRATE_CMA which can be done by
53 * __free_pageblock_cma() function. What is important though
54 * is that a range of pageblocks must be aligned to
55 * MAX_ORDER_NR_PAGES should biggest page be bigger then
56 * a single pageblock.
57 */
58 MIGRATE_CMA,
59#endif
60 MIGRATE_ISOLATE, /* can't allocate from here */
61 MIGRATE_TYPES
62};
63
64#ifdef CONFIG_CMA
65# define is_migrate_cma(migratetype) unlikely((migratetype) == MIGRATE_CMA)
66# define cma_wmark_pages(zone) zone->min_cma_pages
67#else
68# define is_migrate_cma(migratetype) false
69# define cma_wmark_pages(zone) 0
70#endif
45 71
46#define for_each_migratetype_order(order, type) \ 72#define for_each_migratetype_order(order, type) \
47 for (order = 0; order < MAX_ORDER; order++) \ 73 for (order = 0; order < MAX_ORDER; order++) \
@@ -347,6 +373,13 @@ struct zone {
347 /* see spanned/present_pages for more description */ 373 /* see spanned/present_pages for more description */
348 seqlock_t span_seqlock; 374 seqlock_t span_seqlock;
349#endif 375#endif
376#ifdef CONFIG_CMA
377 /*
378 * CMA needs to increase watermark levels during the allocation
379 * process to make sure that the system is not starved.
380 */
381 unsigned long min_cma_pages;
382#endif
350 struct free_area free_area[MAX_ORDER]; 383 struct free_area free_area[MAX_ORDER];
351 384
352#ifndef CONFIG_SPARSEMEM 385#ifndef CONFIG_SPARSEMEM
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index 501da4cb8a6d..5db93821f9c7 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -132,10 +132,12 @@ struct usb_device_id {
132#define USB_DEVICE_ID_MATCH_INT_PROTOCOL 0x0200 132#define USB_DEVICE_ID_MATCH_INT_PROTOCOL 0x0200
133 133
134#define HID_ANY_ID (~0) 134#define HID_ANY_ID (~0)
135#define HID_BUS_ANY 0xffff
136#define HID_GROUP_ANY 0x0000
135 137
136struct hid_device_id { 138struct hid_device_id {
137 __u16 bus; 139 __u16 bus;
138 __u16 pad1; 140 __u16 group;
139 __u32 vendor; 141 __u32 vendor;
140 __u32 product; 142 __u32 product;
141 kernel_ulong_t driver_data 143 kernel_ulong_t driver_data
diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h
index ea36486378d8..1b14d25162cb 100644
--- a/include/linux/moduleparam.h
+++ b/include/linux/moduleparam.h
@@ -320,7 +320,8 @@ extern int parse_args(const char *name,
320 unsigned num, 320 unsigned num,
321 s16 level_min, 321 s16 level_min,
322 s16 level_max, 322 s16 level_max,
323 int (*unknown)(char *param, char *val)); 323 int (*unknown)(char *param, char *val,
324 const char *doing));
324 325
325/* Called by module remove. */ 326/* Called by module remove. */
326#ifdef CONFIG_SYSFS 327#ifdef CONFIG_SYSFS
diff --git a/include/linux/mtd/ubi.h b/include/linux/mtd/ubi.h
index db4836bed514..c3918a0684fe 100644
--- a/include/linux/mtd/ubi.h
+++ b/include/linux/mtd/ubi.h
@@ -25,6 +25,9 @@
25#include <linux/types.h> 25#include <linux/types.h>
26#include <mtd/ubi-user.h> 26#include <mtd/ubi-user.h>
27 27
28/* All voumes/LEBs */
29#define UBI_ALL -1
30
28/* 31/*
29 * enum ubi_open_mode - UBI volume open mode constants. 32 * enum ubi_open_mode - UBI volume open mode constants.
30 * 33 *
@@ -208,14 +211,15 @@ void ubi_close_volume(struct ubi_volume_desc *desc);
208int ubi_leb_read(struct ubi_volume_desc *desc, int lnum, char *buf, int offset, 211int ubi_leb_read(struct ubi_volume_desc *desc, int lnum, char *buf, int offset,
209 int len, int check); 212 int len, int check);
210int ubi_leb_write(struct ubi_volume_desc *desc, int lnum, const void *buf, 213int ubi_leb_write(struct ubi_volume_desc *desc, int lnum, const void *buf,
211 int offset, int len, int dtype); 214 int offset, int len);
212int ubi_leb_change(struct ubi_volume_desc *desc, int lnum, const void *buf, 215int ubi_leb_change(struct ubi_volume_desc *desc, int lnum, const void *buf,
213 int len, int dtype); 216 int len);
214int ubi_leb_erase(struct ubi_volume_desc *desc, int lnum); 217int ubi_leb_erase(struct ubi_volume_desc *desc, int lnum);
215int ubi_leb_unmap(struct ubi_volume_desc *desc, int lnum); 218int ubi_leb_unmap(struct ubi_volume_desc *desc, int lnum);
216int ubi_leb_map(struct ubi_volume_desc *desc, int lnum, int dtype); 219int ubi_leb_map(struct ubi_volume_desc *desc, int lnum);
217int ubi_is_mapped(struct ubi_volume_desc *desc, int lnum); 220int ubi_is_mapped(struct ubi_volume_desc *desc, int lnum);
218int ubi_sync(int ubi_num); 221int ubi_sync(int ubi_num);
222int ubi_flush(int ubi_num, int vol_id, int lnum);
219 223
220/* 224/*
221 * This function is the same as the 'ubi_leb_read()' function, but it does not 225 * This function is the same as the 'ubi_leb_read()' function, but it does not
@@ -226,25 +230,4 @@ static inline int ubi_read(struct ubi_volume_desc *desc, int lnum, char *buf,
226{ 230{
227 return ubi_leb_read(desc, lnum, buf, offset, len, 0); 231 return ubi_leb_read(desc, lnum, buf, offset, len, 0);
228} 232}
229
230/*
231 * This function is the same as the 'ubi_leb_write()' functions, but it does
232 * not have the data type argument.
233 */
234static inline int ubi_write(struct ubi_volume_desc *desc, int lnum,
235 const void *buf, int offset, int len)
236{
237 return ubi_leb_write(desc, lnum, buf, offset, len, UBI_UNKNOWN);
238}
239
240/*
241 * This function is the same as the 'ubi_leb_change()' functions, but it does
242 * not have the data type argument.
243 */
244static inline int ubi_change(struct ubi_volume_desc *desc, int lnum,
245 const void *buf, int len)
246{
247 return ubi_leb_change(desc, lnum, buf, len, UBI_UNKNOWN);
248}
249
250#endif /* !__LINUX_UBI_H__ */ 233#endif /* !__LINUX_UBI_H__ */
diff --git a/include/linux/mv643xx_eth.h b/include/linux/mv643xx_eth.h
index 30b0c4e78f91..51bf8ada6dc0 100644
--- a/include/linux/mv643xx_eth.h
+++ b/include/linux/mv643xx_eth.h
@@ -18,7 +18,6 @@
18struct mv643xx_eth_shared_platform_data { 18struct mv643xx_eth_shared_platform_data {
19 struct mbus_dram_target_info *dram; 19 struct mbus_dram_target_info *dram;
20 struct platform_device *shared_smi; 20 struct platform_device *shared_smi;
21 unsigned int t_clk;
22 /* 21 /*
23 * Max packet size for Tx IP/Layer 4 checksum, when set to 0, default 22 * Max packet size for Tx IP/Layer 4 checksum, when set to 0, default
24 * limit of 9KiB will be used. 23 * limit of 9KiB will be used.
diff --git a/include/linux/neighbour.h b/include/linux/neighbour.h
index b188f68a08c9..275e5d65dcb2 100644
--- a/include/linux/neighbour.h
+++ b/include/linux/neighbour.h
@@ -33,6 +33,9 @@ enum {
33#define NTF_PROXY 0x08 /* == ATF_PUBL */ 33#define NTF_PROXY 0x08 /* == ATF_PUBL */
34#define NTF_ROUTER 0x80 34#define NTF_ROUTER 0x80
35 35
36#define NTF_SELF 0x02
37#define NTF_MASTER 0x04
38
36/* 39/*
37 * Neighbor Cache Entry States. 40 * Neighbor Cache Entry States.
38 */ 41 */
diff --git a/include/linux/net.h b/include/linux/net.h
index be60c7f5e145..2d7510f38934 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -250,6 +250,29 @@ extern struct socket *sockfd_lookup(int fd, int *err);
250#define sockfd_put(sock) fput(sock->file) 250#define sockfd_put(sock) fput(sock->file)
251extern int net_ratelimit(void); 251extern int net_ratelimit(void);
252 252
253#define net_ratelimited_function(function, ...) \
254do { \
255 if (net_ratelimit()) \
256 function(__VA_ARGS__); \
257} while (0)
258
259#define net_emerg_ratelimited(fmt, ...) \
260 net_ratelimited_function(pr_emerg, fmt, ##__VA_ARGS__)
261#define net_alert_ratelimited(fmt, ...) \
262 net_ratelimited_function(pr_alert, fmt, ##__VA_ARGS__)
263#define net_crit_ratelimited(fmt, ...) \
264 net_ratelimited_function(pr_crit, fmt, ##__VA_ARGS__)
265#define net_err_ratelimited(fmt, ...) \
266 net_ratelimited_function(pr_err, fmt, ##__VA_ARGS__)
267#define net_notice_ratelimited(fmt, ...) \
268 net_ratelimited_function(pr_notice, fmt, ##__VA_ARGS__)
269#define net_warn_ratelimited(fmt, ...) \
270 net_ratelimited_function(pr_warn, fmt, ##__VA_ARGS__)
271#define net_info_ratelimited(fmt, ...) \
272 net_ratelimited_function(pr_info, fmt, ##__VA_ARGS__)
273#define net_dbg_ratelimited(fmt, ...) \
274 net_ratelimited_function(pr_debug, fmt, ##__VA_ARGS__)
275
253#define net_random() random32() 276#define net_random() random32()
254#define net_srandom(seed) srandom32((__force u32)seed) 277#define net_srandom(seed) srandom32((__force u32)seed)
255 278
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 5cbaa20f1659..e7fd468f7126 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -54,6 +54,7 @@
54#include <net/netprio_cgroup.h> 54#include <net/netprio_cgroup.h>
55 55
56#include <linux/netdev_features.h> 56#include <linux/netdev_features.h>
57#include <linux/neighbour.h>
57 58
58struct netpoll_info; 59struct netpoll_info;
59struct device; 60struct device;
@@ -288,7 +289,7 @@ struct hh_cache {
288struct header_ops { 289struct header_ops {
289 int (*create) (struct sk_buff *skb, struct net_device *dev, 290 int (*create) (struct sk_buff *skb, struct net_device *dev,
290 unsigned short type, const void *daddr, 291 unsigned short type, const void *daddr,
291 const void *saddr, unsigned len); 292 const void *saddr, unsigned int len);
292 int (*parse)(const struct sk_buff *skb, unsigned char *haddr); 293 int (*parse)(const struct sk_buff *skb, unsigned char *haddr);
293 int (*rebuild)(struct sk_buff *skb); 294 int (*rebuild)(struct sk_buff *skb);
294 int (*cache)(const struct neighbour *neigh, struct hh_cache *hh, __be16 type); 295 int (*cache)(const struct neighbour *neigh, struct hh_cache *hh, __be16 type);
@@ -905,6 +906,16 @@ struct netdev_fcoe_hbainfo {
905 * feature set might be less than what was returned by ndo_fix_features()). 906 * feature set might be less than what was returned by ndo_fix_features()).
906 * Must return >0 or -errno if it changed dev->features itself. 907 * Must return >0 or -errno if it changed dev->features itself.
907 * 908 *
909 * int (*ndo_fdb_add)(struct ndmsg *ndm, struct net_device *dev,
910 * unsigned char *addr, u16 flags)
911 * Adds an FDB entry to dev for addr.
912 * int (*ndo_fdb_del)(struct ndmsg *ndm, struct net_device *dev,
913 * unsigned char *addr)
914 * Deletes the FDB entry from dev coresponding to addr.
915 * int (*ndo_fdb_dump)(struct sk_buff *skb, struct netlink_callback *cb,
916 * struct net_device *dev, int idx)
917 * Used to add FDB entries to dump requests. Implementers should add
918 * entries to skb and update idx with the number of entries.
908 */ 919 */
909struct net_device_ops { 920struct net_device_ops {
910 int (*ndo_init)(struct net_device *dev); 921 int (*ndo_init)(struct net_device *dev);
@@ -1002,6 +1013,18 @@ struct net_device_ops {
1002 netdev_features_t features); 1013 netdev_features_t features);
1003 int (*ndo_neigh_construct)(struct neighbour *n); 1014 int (*ndo_neigh_construct)(struct neighbour *n);
1004 void (*ndo_neigh_destroy)(struct neighbour *n); 1015 void (*ndo_neigh_destroy)(struct neighbour *n);
1016
1017 int (*ndo_fdb_add)(struct ndmsg *ndm,
1018 struct net_device *dev,
1019 unsigned char *addr,
1020 u16 flags);
1021 int (*ndo_fdb_del)(struct ndmsg *ndm,
1022 struct net_device *dev,
1023 unsigned char *addr);
1024 int (*ndo_fdb_dump)(struct sk_buff *skb,
1025 struct netlink_callback *cb,
1026 struct net_device *dev,
1027 int idx);
1005}; 1028};
1006 1029
1007/* 1030/*
@@ -1132,7 +1155,6 @@ struct net_device {
1132 struct in_device __rcu *ip_ptr; /* IPv4 specific data */ 1155 struct in_device __rcu *ip_ptr; /* IPv4 specific data */
1133 struct dn_dev __rcu *dn_ptr; /* DECnet specific data */ 1156 struct dn_dev __rcu *dn_ptr; /* DECnet specific data */
1134 struct inet6_dev __rcu *ip6_ptr; /* IPv6 specific data */ 1157 struct inet6_dev __rcu *ip6_ptr; /* IPv6 specific data */
1135 void *ec_ptr; /* Econet specific data */
1136 void *ax25_ptr; /* AX.25 specific data */ 1158 void *ax25_ptr; /* AX.25 specific data */
1137 struct wireless_dev *ieee80211_ptr; /* IEEE 802.11 specific data, 1159 struct wireless_dev *ieee80211_ptr; /* IEEE 802.11 specific data,
1138 assign before registering */ 1160 assign before registering */
@@ -1403,15 +1425,6 @@ static inline bool netdev_uses_dsa_tags(struct net_device *dev)
1403 return 0; 1425 return 0;
1404} 1426}
1405 1427
1406#ifndef CONFIG_NET_NS
1407static inline void skb_set_dev(struct sk_buff *skb, struct net_device *dev)
1408{
1409 skb->dev = dev;
1410}
1411#else /* CONFIG_NET_NS */
1412void skb_set_dev(struct sk_buff *skb, struct net_device *dev);
1413#endif
1414
1415static inline bool netdev_uses_trailer_tags(struct net_device *dev) 1428static inline bool netdev_uses_trailer_tags(struct net_device *dev)
1416{ 1429{
1417#ifdef CONFIG_NET_DSA_TAG_TRAILER 1430#ifdef CONFIG_NET_DSA_TAG_TRAILER
@@ -1486,6 +1499,8 @@ struct napi_gro_cb {
1486 1499
1487 /* Free the skb? */ 1500 /* Free the skb? */
1488 int free; 1501 int free;
1502#define NAPI_GRO_FREE 1
1503#define NAPI_GRO_FREE_STOLEN_HEAD 2
1489}; 1504};
1490 1505
1491#define NAPI_GRO_CB(skb) ((struct napi_gro_cb *)(skb)->cb) 1506#define NAPI_GRO_CB(skb) ((struct napi_gro_cb *)(skb)->cb)
@@ -1689,7 +1704,7 @@ static inline void *skb_gro_network_header(struct sk_buff *skb)
1689static inline int dev_hard_header(struct sk_buff *skb, struct net_device *dev, 1704static inline int dev_hard_header(struct sk_buff *skb, struct net_device *dev,
1690 unsigned short type, 1705 unsigned short type,
1691 const void *daddr, const void *saddr, 1706 const void *daddr, const void *saddr,
1692 unsigned len) 1707 unsigned int len)
1693{ 1708{
1694 if (!dev->header_ops || !dev->header_ops->create) 1709 if (!dev->header_ops || !dev->header_ops->create)
1695 return 0; 1710 return 0;
@@ -1740,7 +1755,7 @@ struct softnet_data {
1740 unsigned int input_queue_head; 1755 unsigned int input_queue_head;
1741 unsigned int input_queue_tail; 1756 unsigned int input_queue_tail;
1742#endif 1757#endif
1743 unsigned dropped; 1758 unsigned int dropped;
1744 struct sk_buff_head input_pkt_queue; 1759 struct sk_buff_head input_pkt_queue;
1745 struct napi_struct backlog; 1760 struct napi_struct backlog;
1746}; 1761};
@@ -1925,7 +1940,7 @@ static inline void netdev_sent_queue(struct net_device *dev, unsigned int bytes)
1925} 1940}
1926 1941
1927static inline void netdev_tx_completed_queue(struct netdev_queue *dev_queue, 1942static inline void netdev_tx_completed_queue(struct netdev_queue *dev_queue,
1928 unsigned pkts, unsigned bytes) 1943 unsigned int pkts, unsigned int bytes)
1929{ 1944{
1930#ifdef CONFIG_BQL 1945#ifdef CONFIG_BQL
1931 if (unlikely(!bytes)) 1946 if (unlikely(!bytes))
@@ -1949,7 +1964,7 @@ static inline void netdev_tx_completed_queue(struct netdev_queue *dev_queue,
1949} 1964}
1950 1965
1951static inline void netdev_completed_queue(struct net_device *dev, 1966static inline void netdev_completed_queue(struct net_device *dev,
1952 unsigned pkts, unsigned bytes) 1967 unsigned int pkts, unsigned int bytes)
1953{ 1968{
1954 netdev_tx_completed_queue(netdev_get_tx_queue(dev, 0), pkts, bytes); 1969 netdev_tx_completed_queue(netdev_get_tx_queue(dev, 0), pkts, bytes);
1955} 1970}
@@ -2127,7 +2142,6 @@ extern struct sk_buff * napi_get_frags(struct napi_struct *napi);
2127extern gro_result_t napi_frags_finish(struct napi_struct *napi, 2142extern gro_result_t napi_frags_finish(struct napi_struct *napi,
2128 struct sk_buff *skb, 2143 struct sk_buff *skb,
2129 gro_result_t ret); 2144 gro_result_t ret);
2130extern struct sk_buff * napi_frags_skb(struct napi_struct *napi);
2131extern gro_result_t napi_gro_frags(struct napi_struct *napi); 2145extern gro_result_t napi_gro_frags(struct napi_struct *napi);
2132 2146
2133static inline void napi_free_frags(struct napi_struct *napi) 2147static inline void napi_free_frags(struct napi_struct *napi)
@@ -2144,9 +2158,9 @@ extern void netdev_rx_handler_unregister(struct net_device *dev);
2144extern bool dev_valid_name(const char *name); 2158extern bool dev_valid_name(const char *name);
2145extern int dev_ioctl(struct net *net, unsigned int cmd, void __user *); 2159extern int dev_ioctl(struct net *net, unsigned int cmd, void __user *);
2146extern int dev_ethtool(struct net *net, struct ifreq *); 2160extern int dev_ethtool(struct net *net, struct ifreq *);
2147extern unsigned dev_get_flags(const struct net_device *); 2161extern unsigned int dev_get_flags(const struct net_device *);
2148extern int __dev_change_flags(struct net_device *, unsigned int flags); 2162extern int __dev_change_flags(struct net_device *, unsigned int flags);
2149extern int dev_change_flags(struct net_device *, unsigned); 2163extern int dev_change_flags(struct net_device *, unsigned int);
2150extern void __dev_notify_flags(struct net_device *, unsigned int old_flags); 2164extern void __dev_notify_flags(struct net_device *, unsigned int old_flags);
2151extern int dev_change_name(struct net_device *, const char *); 2165extern int dev_change_name(struct net_device *, const char *);
2152extern int dev_set_alias(struct net_device *, const char *, size_t); 2166extern int dev_set_alias(struct net_device *, const char *, size_t);
@@ -2546,6 +2560,7 @@ extern int dev_addr_init(struct net_device *dev);
2546 2560
2547/* Functions used for unicast addresses handling */ 2561/* Functions used for unicast addresses handling */
2548extern int dev_uc_add(struct net_device *dev, unsigned char *addr); 2562extern int dev_uc_add(struct net_device *dev, unsigned char *addr);
2563extern int dev_uc_add_excl(struct net_device *dev, unsigned char *addr);
2549extern int dev_uc_del(struct net_device *dev, unsigned char *addr); 2564extern int dev_uc_del(struct net_device *dev, unsigned char *addr);
2550extern int dev_uc_sync(struct net_device *to, struct net_device *from); 2565extern int dev_uc_sync(struct net_device *to, struct net_device *from);
2551extern void dev_uc_unsync(struct net_device *to, struct net_device *from); 2566extern void dev_uc_unsync(struct net_device *to, struct net_device *from);
@@ -2555,6 +2570,7 @@ extern void dev_uc_init(struct net_device *dev);
2555/* Functions used for multicast addresses handling */ 2570/* Functions used for multicast addresses handling */
2556extern int dev_mc_add(struct net_device *dev, unsigned char *addr); 2571extern int dev_mc_add(struct net_device *dev, unsigned char *addr);
2557extern int dev_mc_add_global(struct net_device *dev, unsigned char *addr); 2572extern int dev_mc_add_global(struct net_device *dev, unsigned char *addr);
2573extern int dev_mc_add_excl(struct net_device *dev, unsigned char *addr);
2558extern int dev_mc_del(struct net_device *dev, unsigned char *addr); 2574extern int dev_mc_del(struct net_device *dev, unsigned char *addr);
2559extern int dev_mc_del_global(struct net_device *dev, unsigned char *addr); 2575extern int dev_mc_del_global(struct net_device *dev, unsigned char *addr);
2560extern int dev_mc_sync(struct net_device *to, struct net_device *from); 2576extern int dev_mc_sync(struct net_device *to, struct net_device *from);
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index 29734be334c1..ff9c84c29b28 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -154,12 +154,6 @@ void nf_unregister_hooks(struct nf_hook_ops *reg, unsigned int n);
154int nf_register_sockopt(struct nf_sockopt_ops *reg); 154int nf_register_sockopt(struct nf_sockopt_ops *reg);
155void nf_unregister_sockopt(struct nf_sockopt_ops *reg); 155void nf_unregister_sockopt(struct nf_sockopt_ops *reg);
156 156
157#ifdef CONFIG_SYSCTL
158/* Sysctl registration */
159extern struct ctl_path nf_net_netfilter_sysctl_path[];
160extern struct ctl_path nf_net_ipv4_netfilter_sysctl_path[];
161#endif /* CONFIG_SYSCTL */
162
163extern struct list_head nf_hooks[NFPROTO_NUMPROTO][NF_MAX_HOOKS]; 157extern struct list_head nf_hooks[NFPROTO_NUMPROTO][NF_MAX_HOOKS];
164 158
165#if defined(CONFIG_JUMP_LABEL) 159#if defined(CONFIG_JUMP_LABEL)
diff --git a/include/linux/netfilter/ipset/ip_set.h b/include/linux/netfilter/ipset/ip_set.h
index 2f8e18a23227..2edc64cab739 100644
--- a/include/linux/netfilter/ipset/ip_set.h
+++ b/include/linux/netfilter/ipset/ip_set.h
@@ -411,26 +411,32 @@ ip_set_get_h16(const struct nlattr *attr)
411#define ipset_nest_start(skb, attr) nla_nest_start(skb, attr | NLA_F_NESTED) 411#define ipset_nest_start(skb, attr) nla_nest_start(skb, attr | NLA_F_NESTED)
412#define ipset_nest_end(skb, start) nla_nest_end(skb, start) 412#define ipset_nest_end(skb, start) nla_nest_end(skb, start)
413 413
414#define NLA_PUT_IPADDR4(skb, type, ipaddr) \ 414static inline int nla_put_ipaddr4(struct sk_buff *skb, int type, __be32 ipaddr)
415do { \ 415{
416 struct nlattr *__nested = ipset_nest_start(skb, type); \ 416 struct nlattr *__nested = ipset_nest_start(skb, type);
417 \ 417 int ret;
418 if (!__nested) \ 418
419 goto nla_put_failure; \ 419 if (!__nested)
420 NLA_PUT_NET32(skb, IPSET_ATTR_IPADDR_IPV4, ipaddr); \ 420 return -EMSGSIZE;
421 ipset_nest_end(skb, __nested); \ 421 ret = nla_put_net32(skb, IPSET_ATTR_IPADDR_IPV4, ipaddr);
422} while (0) 422 if (!ret)
423 423 ipset_nest_end(skb, __nested);
424#define NLA_PUT_IPADDR6(skb, type, ipaddrptr) \ 424 return ret;
425do { \ 425}
426 struct nlattr *__nested = ipset_nest_start(skb, type); \ 426
427 \ 427static inline int nla_put_ipaddr6(struct sk_buff *skb, int type, const struct in6_addr *ipaddrptr)
428 if (!__nested) \ 428{
429 goto nla_put_failure; \ 429 struct nlattr *__nested = ipset_nest_start(skb, type);
430 NLA_PUT(skb, IPSET_ATTR_IPADDR_IPV6, \ 430 int ret;
431 sizeof(struct in6_addr), ipaddrptr); \ 431
432 ipset_nest_end(skb, __nested); \ 432 if (!__nested)
433} while (0) 433 return -EMSGSIZE;
434 ret = nla_put(skb, IPSET_ATTR_IPADDR_IPV6,
435 sizeof(struct in6_addr), ipaddrptr);
436 if (!ret)
437 ipset_nest_end(skb, __nested);
438 return ret;
439}
434 440
435/* Get address from skbuff */ 441/* Get address from skbuff */
436static inline __be32 442static inline __be32
@@ -472,8 +478,8 @@ union ip_set_name_index {
472 478
473#define IP_SET_OP_GET_BYNAME 0x00000006 /* Get set index by name */ 479#define IP_SET_OP_GET_BYNAME 0x00000006 /* Get set index by name */
474struct ip_set_req_get_set { 480struct ip_set_req_get_set {
475 unsigned op; 481 unsigned int op;
476 unsigned version; 482 unsigned int version;
477 union ip_set_name_index set; 483 union ip_set_name_index set;
478}; 484};
479 485
@@ -482,8 +488,8 @@ struct ip_set_req_get_set {
482 488
483#define IP_SET_OP_VERSION 0x00000100 /* Ask kernel version */ 489#define IP_SET_OP_VERSION 0x00000100 /* Ask kernel version */
484struct ip_set_req_version { 490struct ip_set_req_version {
485 unsigned op; 491 unsigned int op;
486 unsigned version; 492 unsigned int version;
487}; 493};
488 494
489#endif /*_IP_SET_H */ 495#endif /*_IP_SET_H */
diff --git a/include/linux/netfilter/ipset/ip_set_ahash.h b/include/linux/netfilter/ipset/ip_set_ahash.h
index 05a5d72680be..b114d35aea5e 100644
--- a/include/linux/netfilter/ipset/ip_set_ahash.h
+++ b/include/linux/netfilter/ipset/ip_set_ahash.h
@@ -99,6 +99,22 @@ struct ip_set_hash {
99#endif 99#endif
100}; 100};
101 101
102static size_t
103htable_size(u8 hbits)
104{
105 size_t hsize;
106
107 /* We must fit both into u32 in jhash and size_t */
108 if (hbits > 31)
109 return 0;
110 hsize = jhash_size(hbits);
111 if ((((size_t)-1) - sizeof(struct htable))/sizeof(struct hbucket)
112 < hsize)
113 return 0;
114
115 return hsize * sizeof(struct hbucket) + sizeof(struct htable);
116}
117
102/* Compute htable_bits from the user input parameter hashsize */ 118/* Compute htable_bits from the user input parameter hashsize */
103static u8 119static u8
104htable_bits(u32 hashsize) 120htable_bits(u32 hashsize)
@@ -594,17 +610,20 @@ type_pf_head(struct ip_set *set, struct sk_buff *skb)
594 nested = ipset_nest_start(skb, IPSET_ATTR_DATA); 610 nested = ipset_nest_start(skb, IPSET_ATTR_DATA);
595 if (!nested) 611 if (!nested)
596 goto nla_put_failure; 612 goto nla_put_failure;
597 NLA_PUT_NET32(skb, IPSET_ATTR_HASHSIZE, 613 if (nla_put_net32(skb, IPSET_ATTR_HASHSIZE,
598 htonl(jhash_size(h->table->htable_bits))); 614 htonl(jhash_size(h->table->htable_bits))) ||
599 NLA_PUT_NET32(skb, IPSET_ATTR_MAXELEM, htonl(h->maxelem)); 615 nla_put_net32(skb, IPSET_ATTR_MAXELEM, htonl(h->maxelem)))
616 goto nla_put_failure;
600#ifdef IP_SET_HASH_WITH_NETMASK 617#ifdef IP_SET_HASH_WITH_NETMASK
601 if (h->netmask != HOST_MASK) 618 if (h->netmask != HOST_MASK &&
602 NLA_PUT_U8(skb, IPSET_ATTR_NETMASK, h->netmask); 619 nla_put_u8(skb, IPSET_ATTR_NETMASK, h->netmask))
620 goto nla_put_failure;
603#endif 621#endif
604 NLA_PUT_NET32(skb, IPSET_ATTR_REFERENCES, htonl(set->ref - 1)); 622 if (nla_put_net32(skb, IPSET_ATTR_REFERENCES, htonl(set->ref - 1)) ||
605 NLA_PUT_NET32(skb, IPSET_ATTR_MEMSIZE, htonl(memsize)); 623 nla_put_net32(skb, IPSET_ATTR_MEMSIZE, htonl(memsize)) ||
606 if (with_timeout(h->timeout)) 624 (with_timeout(h->timeout) &&
607 NLA_PUT_NET32(skb, IPSET_ATTR_TIMEOUT, htonl(h->timeout)); 625 nla_put_net32(skb, IPSET_ATTR_TIMEOUT, htonl(h->timeout))))
626 goto nla_put_failure;
608 ipset_nest_end(skb, nested); 627 ipset_nest_end(skb, nested);
609 628
610 return 0; 629 return 0;
diff --git a/include/linux/netfilter/ipset/ip_set_timeout.h b/include/linux/netfilter/ipset/ip_set_timeout.h
index 47923205a4ad..41d9cfa08167 100644
--- a/include/linux/netfilter/ipset/ip_set_timeout.h
+++ b/include/linux/netfilter/ipset/ip_set_timeout.h
@@ -30,6 +30,10 @@ ip_set_timeout_uget(struct nlattr *tb)
30{ 30{
31 unsigned int timeout = ip_set_get_h32(tb); 31 unsigned int timeout = ip_set_get_h32(tb);
32 32
33 /* Normalize to fit into jiffies */
34 if (timeout > UINT_MAX/MSEC_PER_SEC)
35 timeout = UINT_MAX/MSEC_PER_SEC;
36
33 /* Userspace supplied TIMEOUT parameter: adjust crazy size */ 37 /* Userspace supplied TIMEOUT parameter: adjust crazy size */
34 return timeout == IPSET_NO_TIMEOUT ? IPSET_NO_TIMEOUT - 1 : timeout; 38 return timeout == IPSET_NO_TIMEOUT ? IPSET_NO_TIMEOUT - 1 : timeout;
35} 39}
diff --git a/include/linux/netfilter/nf_conntrack_common.h b/include/linux/netfilter/nf_conntrack_common.h
index 0d3dd66322ec..d146872a0b91 100644
--- a/include/linux/netfilter/nf_conntrack_common.h
+++ b/include/linux/netfilter/nf_conntrack_common.h
@@ -83,6 +83,10 @@ enum ip_conntrack_status {
83 /* Conntrack is a fake untracked entry */ 83 /* Conntrack is a fake untracked entry */
84 IPS_UNTRACKED_BIT = 12, 84 IPS_UNTRACKED_BIT = 12,
85 IPS_UNTRACKED = (1 << IPS_UNTRACKED_BIT), 85 IPS_UNTRACKED = (1 << IPS_UNTRACKED_BIT),
86
87 /* Conntrack got a helper explicitly attached via CT target. */
88 IPS_HELPER_BIT = 13,
89 IPS_HELPER = (1 << IPS_HELPER_BIT),
86}; 90};
87 91
88/* Connection tracking event types */ 92/* Connection tracking event types */
diff --git a/include/linux/netfilter/nf_conntrack_h323_types.h b/include/linux/netfilter/nf_conntrack_h323_types.h
index f35b6b4801e7..b0821f45fbe4 100644
--- a/include/linux/netfilter/nf_conntrack_h323_types.h
+++ b/include/linux/netfilter/nf_conntrack_h323_types.h
@@ -7,12 +7,12 @@
7 7
8typedef struct TransportAddress_ipAddress { /* SEQUENCE */ 8typedef struct TransportAddress_ipAddress { /* SEQUENCE */
9 int options; /* No use */ 9 int options; /* No use */
10 unsigned ip; 10 unsigned int ip;
11} TransportAddress_ipAddress; 11} TransportAddress_ipAddress;
12 12
13typedef struct TransportAddress_ip6Address { /* SEQUENCE */ 13typedef struct TransportAddress_ip6Address { /* SEQUENCE */
14 int options; /* No use */ 14 int options; /* No use */
15 unsigned ip; 15 unsigned int ip;
16} TransportAddress_ip6Address; 16} TransportAddress_ip6Address;
17 17
18typedef struct TransportAddress { /* CHOICE */ 18typedef struct TransportAddress { /* CHOICE */
@@ -96,12 +96,12 @@ typedef struct DataType { /* CHOICE */
96 96
97typedef struct UnicastAddress_iPAddress { /* SEQUENCE */ 97typedef struct UnicastAddress_iPAddress { /* SEQUENCE */
98 int options; /* No use */ 98 int options; /* No use */
99 unsigned network; 99 unsigned int network;
100} UnicastAddress_iPAddress; 100} UnicastAddress_iPAddress;
101 101
102typedef struct UnicastAddress_iP6Address { /* SEQUENCE */ 102typedef struct UnicastAddress_iP6Address { /* SEQUENCE */
103 int options; /* No use */ 103 int options; /* No use */
104 unsigned network; 104 unsigned int network;
105} UnicastAddress_iP6Address; 105} UnicastAddress_iP6Address;
106 106
107typedef struct UnicastAddress { /* CHOICE */ 107typedef struct UnicastAddress { /* CHOICE */
@@ -698,7 +698,7 @@ typedef struct RegistrationRequest { /* SEQUENCE */
698 } options; 698 } options;
699 RegistrationRequest_callSignalAddress callSignalAddress; 699 RegistrationRequest_callSignalAddress callSignalAddress;
700 RegistrationRequest_rasAddress rasAddress; 700 RegistrationRequest_rasAddress rasAddress;
701 unsigned timeToLive; 701 unsigned int timeToLive;
702} RegistrationRequest; 702} RegistrationRequest;
703 703
704typedef struct RegistrationConfirm_callSignalAddress { /* SEQUENCE OF */ 704typedef struct RegistrationConfirm_callSignalAddress { /* SEQUENCE OF */
@@ -730,7 +730,7 @@ typedef struct RegistrationConfirm { /* SEQUENCE */
730 eRegistrationConfirm_genericData = (1 << 12), 730 eRegistrationConfirm_genericData = (1 << 12),
731 } options; 731 } options;
732 RegistrationConfirm_callSignalAddress callSignalAddress; 732 RegistrationConfirm_callSignalAddress callSignalAddress;
733 unsigned timeToLive; 733 unsigned int timeToLive;
734} RegistrationConfirm; 734} RegistrationConfirm;
735 735
736typedef struct UnregistrationRequest_callSignalAddress { /* SEQUENCE OF */ 736typedef struct UnregistrationRequest_callSignalAddress { /* SEQUENCE OF */
diff --git a/include/linux/netfilter/nfnetlink.h b/include/linux/netfilter/nfnetlink.h
index 6fd1f0d07e64..a1048c1587d1 100644
--- a/include/linux/netfilter/nfnetlink.h
+++ b/include/linux/netfilter/nfnetlink.h
@@ -80,7 +80,7 @@ extern int nfnetlink_subsys_register(const struct nfnetlink_subsystem *n);
80extern int nfnetlink_subsys_unregister(const struct nfnetlink_subsystem *n); 80extern int nfnetlink_subsys_unregister(const struct nfnetlink_subsystem *n);
81 81
82extern int nfnetlink_has_listeners(struct net *net, unsigned int group); 82extern int nfnetlink_has_listeners(struct net *net, unsigned int group);
83extern int nfnetlink_send(struct sk_buff *skb, struct net *net, u32 pid, unsigned group, 83extern int nfnetlink_send(struct sk_buff *skb, struct net *net, u32 pid, unsigned int group,
84 int echo, gfp_t flags); 84 int echo, gfp_t flags);
85extern int nfnetlink_set_err(struct net *net, u32 pid, u32 group, int error); 85extern int nfnetlink_set_err(struct net *net, u32 pid, u32 group, int error);
86extern int nfnetlink_unicast(struct sk_buff *skb, struct net *net, u_int32_t pid, int flags); 86extern int nfnetlink_unicast(struct sk_buff *skb, struct net *net, u_int32_t pid, int flags);
diff --git a/include/linux/netfilter/xt_HMARK.h b/include/linux/netfilter/xt_HMARK.h
new file mode 100644
index 000000000000..abb1650940d2
--- /dev/null
+++ b/include/linux/netfilter/xt_HMARK.h
@@ -0,0 +1,45 @@
1#ifndef XT_HMARK_H_
2#define XT_HMARK_H_
3
4#include <linux/types.h>
5
6enum {
7 XT_HMARK_SADDR_MASK,
8 XT_HMARK_DADDR_MASK,
9 XT_HMARK_SPI,
10 XT_HMARK_SPI_MASK,
11 XT_HMARK_SPORT,
12 XT_HMARK_DPORT,
13 XT_HMARK_SPORT_MASK,
14 XT_HMARK_DPORT_MASK,
15 XT_HMARK_PROTO_MASK,
16 XT_HMARK_RND,
17 XT_HMARK_MODULUS,
18 XT_HMARK_OFFSET,
19 XT_HMARK_CT,
20 XT_HMARK_METHOD_L3,
21 XT_HMARK_METHOD_L3_4,
22};
23#define XT_HMARK_FLAG(flag) (1 << flag)
24
25union hmark_ports {
26 struct {
27 __u16 src;
28 __u16 dst;
29 } p16;
30 __u32 v32;
31};
32
33struct xt_hmark_info {
34 union nf_inet_addr src_mask;
35 union nf_inet_addr dst_mask;
36 union hmark_ports port_mask;
37 union hmark_ports port_set;
38 __u32 flags;
39 __u16 proto_mask;
40 __u32 hashrnd;
41 __u32 hmodulus;
42 __u32 hoffset; /* Mark offset to start from */
43};
44
45#endif /* XT_HMARK_H_ */
diff --git a/include/linux/netfilter/xt_hashlimit.h b/include/linux/netfilter/xt_hashlimit.h
index b1925b5925e9..c42e52f39f8f 100644
--- a/include/linux/netfilter/xt_hashlimit.h
+++ b/include/linux/netfilter/xt_hashlimit.h
@@ -6,7 +6,11 @@
6/* timings are in milliseconds. */ 6/* timings are in milliseconds. */
7#define XT_HASHLIMIT_SCALE 10000 7#define XT_HASHLIMIT_SCALE 10000
8/* 1/10,000 sec period => max of 10,000/sec. Min rate is then 429490 8/* 1/10,000 sec period => max of 10,000/sec. Min rate is then 429490
9 seconds, or one every 59 hours. */ 9 * seconds, or one packet every 59 hours.
10 */
11
12/* packet length accounting is done in 16-byte steps */
13#define XT_HASHLIMIT_BYTE_SHIFT 4
10 14
11/* details of this structure hidden by the implementation */ 15/* details of this structure hidden by the implementation */
12struct xt_hashlimit_htable; 16struct xt_hashlimit_htable;
@@ -17,7 +21,13 @@ enum {
17 XT_HASHLIMIT_HASH_SIP = 1 << 2, 21 XT_HASHLIMIT_HASH_SIP = 1 << 2,
18 XT_HASHLIMIT_HASH_SPT = 1 << 3, 22 XT_HASHLIMIT_HASH_SPT = 1 << 3,
19 XT_HASHLIMIT_INVERT = 1 << 4, 23 XT_HASHLIMIT_INVERT = 1 << 4,
24 XT_HASHLIMIT_BYTES = 1 << 5,
20}; 25};
26#ifdef __KERNEL__
27#define XT_HASHLIMIT_ALL (XT_HASHLIMIT_HASH_DIP | XT_HASHLIMIT_HASH_DPT | \
28 XT_HASHLIMIT_HASH_SIP | XT_HASHLIMIT_HASH_SPT | \
29 XT_HASHLIMIT_INVERT | XT_HASHLIMIT_BYTES)
30#endif
21 31
22struct hashlimit_cfg { 32struct hashlimit_cfg {
23 __u32 mode; /* bitmask of XT_HASHLIMIT_HASH_* */ 33 __u32 mode; /* bitmask of XT_HASHLIMIT_HASH_* */
diff --git a/include/linux/netfilter_bridge.h b/include/linux/netfilter_bridge.h
index 0ddd161f3b06..31d2844e6572 100644
--- a/include/linux/netfilter_bridge.h
+++ b/include/linux/netfilter_bridge.h
@@ -104,9 +104,18 @@ struct bridge_skb_cb {
104 } daddr; 104 } daddr;
105}; 105};
106 106
107static inline void br_drop_fake_rtable(struct sk_buff *skb)
108{
109 struct dst_entry *dst = skb_dst(skb);
110
111 if (dst && (dst->flags & DST_FAKE_RTABLE))
112 skb_dst_drop(skb);
113}
114
107#else 115#else
108#define nf_bridge_maybe_copy_header(skb) (0) 116#define nf_bridge_maybe_copy_header(skb) (0)
109#define nf_bridge_pad(skb) (0) 117#define nf_bridge_pad(skb) (0)
118#define br_drop_fake_rtable(skb) do { } while (0)
110#endif /* CONFIG_BRIDGE_NETFILTER */ 119#endif /* CONFIG_BRIDGE_NETFILTER */
111 120
112#endif /* __KERNEL__ */ 121#endif /* __KERNEL__ */
diff --git a/include/linux/netfilter_ipv4/Kbuild b/include/linux/netfilter_ipv4/Kbuild
index 31f8bec95650..c61b8fb1a9ef 100644
--- a/include/linux/netfilter_ipv4/Kbuild
+++ b/include/linux/netfilter_ipv4/Kbuild
@@ -1,4 +1,3 @@
1header-y += ip_queue.h
2header-y += ip_tables.h 1header-y += ip_tables.h
3header-y += ipt_CLUSTERIP.h 2header-y += ipt_CLUSTERIP.h
4header-y += ipt_ECN.h 3header-y += ipt_ECN.h
diff --git a/include/linux/netfilter_ipv4/ip_queue.h b/include/linux/netfilter_ipv4/ip_queue.h
deleted file mode 100644
index a03507f465f8..000000000000
--- a/include/linux/netfilter_ipv4/ip_queue.h
+++ /dev/null
@@ -1,72 +0,0 @@
1/*
2 * This is a module which is used for queueing IPv4 packets and
3 * communicating with userspace via netlink.
4 *
5 * (C) 2000 James Morris, this code is GPL.
6 */
7#ifndef _IP_QUEUE_H
8#define _IP_QUEUE_H
9
10#ifdef __KERNEL__
11#ifdef DEBUG_IPQ
12#define QDEBUG(x...) printk(KERN_DEBUG ## x)
13#else
14#define QDEBUG(x...)
15#endif /* DEBUG_IPQ */
16#else
17#include <net/if.h>
18#endif /* ! __KERNEL__ */
19
20/* Messages sent from kernel */
21typedef struct ipq_packet_msg {
22 unsigned long packet_id; /* ID of queued packet */
23 unsigned long mark; /* Netfilter mark value */
24 long timestamp_sec; /* Packet arrival time (seconds) */
25 long timestamp_usec; /* Packet arrvial time (+useconds) */
26 unsigned int hook; /* Netfilter hook we rode in on */
27 char indev_name[IFNAMSIZ]; /* Name of incoming interface */
28 char outdev_name[IFNAMSIZ]; /* Name of outgoing interface */
29 __be16 hw_protocol; /* Hardware protocol (network order) */
30 unsigned short hw_type; /* Hardware type */
31 unsigned char hw_addrlen; /* Hardware address length */
32 unsigned char hw_addr[8]; /* Hardware address */
33 size_t data_len; /* Length of packet data */
34 unsigned char payload[0]; /* Optional packet data */
35} ipq_packet_msg_t;
36
37/* Messages sent from userspace */
38typedef struct ipq_mode_msg {
39 unsigned char value; /* Requested mode */
40 size_t range; /* Optional range of packet requested */
41} ipq_mode_msg_t;
42
43typedef struct ipq_verdict_msg {
44 unsigned int value; /* Verdict to hand to netfilter */
45 unsigned long id; /* Packet ID for this verdict */
46 size_t data_len; /* Length of replacement data */
47 unsigned char payload[0]; /* Optional replacement packet */
48} ipq_verdict_msg_t;
49
50typedef struct ipq_peer_msg {
51 union {
52 ipq_verdict_msg_t verdict;
53 ipq_mode_msg_t mode;
54 } msg;
55} ipq_peer_msg_t;
56
57/* Packet delivery modes */
58enum {
59 IPQ_COPY_NONE, /* Initial mode, packets are dropped */
60 IPQ_COPY_META, /* Copy metadata */
61 IPQ_COPY_PACKET /* Copy metadata + packet (range) */
62};
63#define IPQ_COPY_MAX IPQ_COPY_PACKET
64
65/* Types of messages */
66#define IPQM_BASE 0x10 /* standard netlink messages below this */
67#define IPQM_MODE (IPQM_BASE + 1) /* Mode request from peer */
68#define IPQM_VERDICT (IPQM_BASE + 2) /* Verdict from peer */
69#define IPQM_PACKET (IPQM_BASE + 3) /* Packet from kernel */
70#define IPQM_MAX (IPQM_BASE + 4)
71
72#endif /*_IP_QUEUE_H*/
diff --git a/include/linux/netfilter_ipv6/ip6_tables.h b/include/linux/netfilter_ipv6/ip6_tables.h
index 1bc898b14a80..08c2cbbaa32b 100644
--- a/include/linux/netfilter_ipv6/ip6_tables.h
+++ b/include/linux/netfilter_ipv6/ip6_tables.h
@@ -298,9 +298,14 @@ ip6t_ext_hdr(u8 nexthdr)
298 (nexthdr == IPPROTO_DSTOPTS); 298 (nexthdr == IPPROTO_DSTOPTS);
299} 299}
300 300
301enum {
302 IP6T_FH_F_FRAG = (1 << 0),
303 IP6T_FH_F_AUTH = (1 << 1),
304};
305
301/* find specified header and get offset to it */ 306/* find specified header and get offset to it */
302extern int ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset, 307extern int ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset,
303 int target, unsigned short *fragoff); 308 int target, unsigned short *fragoff, int *fragflg);
304 309
305#ifdef CONFIG_COMPAT 310#ifdef CONFIG_COMPAT
306#include <net/compat.h> 311#include <net/compat.h>
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index a2092f582a78..0f628ffa420c 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -7,7 +7,7 @@
7#define NETLINK_ROUTE 0 /* Routing/device hook */ 7#define NETLINK_ROUTE 0 /* Routing/device hook */
8#define NETLINK_UNUSED 1 /* Unused number */ 8#define NETLINK_UNUSED 1 /* Unused number */
9#define NETLINK_USERSOCK 2 /* Reserved for user mode socket protocols */ 9#define NETLINK_USERSOCK 2 /* Reserved for user mode socket protocols */
10#define NETLINK_FIREWALL 3 /* Firewalling hook */ 10#define NETLINK_FIREWALL 3 /* Unused number, formerly ip_queue */
11#define NETLINK_SOCK_DIAG 4 /* socket monitoring */ 11#define NETLINK_SOCK_DIAG 4 /* socket monitoring */
12#define NETLINK_NFLOG 5 /* netfilter/iptables ULOG */ 12#define NETLINK_NFLOG 5 /* netfilter/iptables ULOG */
13#define NETLINK_XFRM 6 /* ipsec */ 13#define NETLINK_XFRM 6 /* ipsec */
diff --git a/include/linux/nfc.h b/include/linux/nfc.h
index 39c1fcf089c0..0ae9b5857c83 100644
--- a/include/linux/nfc.h
+++ b/include/linux/nfc.h
@@ -70,6 +70,7 @@ enum nfc_commands {
70 NFC_EVENT_TARGETS_FOUND, 70 NFC_EVENT_TARGETS_FOUND,
71 NFC_EVENT_DEVICE_ADDED, 71 NFC_EVENT_DEVICE_ADDED,
72 NFC_EVENT_DEVICE_REMOVED, 72 NFC_EVENT_DEVICE_REMOVED,
73 NFC_EVENT_TARGET_LOST,
73/* private: internal use only */ 74/* private: internal use only */
74 __NFC_CMD_AFTER_LAST 75 __NFC_CMD_AFTER_LAST
75}; 76};
diff --git a/include/linux/nfc/pn544.h b/include/linux/nfc/pn544.h
index 7ab8521f2347..9890bbaf4328 100644
--- a/include/linux/nfc/pn544.h
+++ b/include/linux/nfc/pn544.h
@@ -84,6 +84,12 @@ struct pn544_fw_packet {
84}; 84};
85 85
86#ifdef __KERNEL__ 86#ifdef __KERNEL__
87enum {
88 NFC_GPIO_ENABLE,
89 NFC_GPIO_FW_RESET,
90 NFC_GPIO_IRQ
91};
92
87/* board config */ 93/* board config */
88struct pn544_nfc_platform_data { 94struct pn544_nfc_platform_data {
89 int (*request_resources) (struct i2c_client *client); 95 int (*request_resources) (struct i2c_client *client);
@@ -91,6 +97,7 @@ struct pn544_nfc_platform_data {
91 void (*enable) (int fw); 97 void (*enable) (int fw);
92 int (*test) (void); 98 int (*test) (void);
93 void (*disable) (void); 99 void (*disable) (void);
100 int (*get_gpio)(int type);
94}; 101};
95#endif /* __KERNEL__ */ 102#endif /* __KERNEL__ */
96 103
diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h
index 0987146b0637..af2d2fa30eee 100644
--- a/include/linux/nfs4.h
+++ b/include/linux/nfs4.h
@@ -69,6 +69,10 @@
69#define NFS4_CDFC4_FORE_OR_BOTH 0x3 69#define NFS4_CDFC4_FORE_OR_BOTH 0x3
70#define NFS4_CDFC4_BACK_OR_BOTH 0x7 70#define NFS4_CDFC4_BACK_OR_BOTH 0x7
71 71
72#define NFS4_CDFS4_FORE 0x1
73#define NFS4_CDFS4_BACK 0x2
74#define NFS4_CDFS4_BOTH 0x3
75
72#define NFS4_SET_TO_SERVER_TIME 0 76#define NFS4_SET_TO_SERVER_TIME 0
73#define NFS4_SET_TO_CLIENT_TIME 1 77#define NFS4_SET_TO_CLIENT_TIME 1
74 78
@@ -526,6 +530,13 @@ enum lock_type4 {
526#define FATTR4_WORD1_MOUNTED_ON_FILEID (1UL << 23) 530#define FATTR4_WORD1_MOUNTED_ON_FILEID (1UL << 23)
527#define FATTR4_WORD1_FS_LAYOUT_TYPES (1UL << 30) 531#define FATTR4_WORD1_FS_LAYOUT_TYPES (1UL << 30)
528#define FATTR4_WORD2_LAYOUT_BLKSIZE (1UL << 1) 532#define FATTR4_WORD2_LAYOUT_BLKSIZE (1UL << 1)
533#define FATTR4_WORD2_MDSTHRESHOLD (1UL << 4)
534
535/* MDS threshold bitmap bits */
536#define THRESHOLD_RD (1UL << 0)
537#define THRESHOLD_WR (1UL << 1)
538#define THRESHOLD_RD_IO (1UL << 2)
539#define THRESHOLD_WR_IO (1UL << 3)
529 540
530#define NFSPROC4_NULL 0 541#define NFSPROC4_NULL 0
531#define NFSPROC4_COMPOUND 1 542#define NFSPROC4_COMPOUND 1
@@ -596,6 +607,8 @@ enum {
596 NFSPROC4_CLNT_TEST_STATEID, 607 NFSPROC4_CLNT_TEST_STATEID,
597 NFSPROC4_CLNT_FREE_STATEID, 608 NFSPROC4_CLNT_FREE_STATEID,
598 NFSPROC4_CLNT_GETDEVICELIST, 609 NFSPROC4_CLNT_GETDEVICELIST,
610 NFSPROC4_CLNT_BIND_CONN_TO_SESSION,
611 NFSPROC4_CLNT_DESTROY_CLIENTID,
599}; 612};
600 613
601/* nfs41 types */ 614/* nfs41 types */
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index 52a1bdb4ee2b..b23cfc120edb 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -102,6 +102,7 @@ struct nfs_open_context {
102 int error; 102 int error;
103 103
104 struct list_head list; 104 struct list_head list;
105 struct nfs4_threshold *mdsthreshold;
105}; 106};
106 107
107struct nfs_open_dir_context { 108struct nfs_open_dir_context {
@@ -179,8 +180,7 @@ struct nfs_inode {
179 __be32 cookieverf[2]; 180 __be32 cookieverf[2];
180 181
181 unsigned long npages; 182 unsigned long npages;
182 unsigned long ncommit; 183 struct nfs_mds_commit_info commit_info;
183 struct list_head commit_list;
184 184
185 /* Open contexts for shared mmap writes */ 185 /* Open contexts for shared mmap writes */
186 struct list_head open_files; 186 struct list_head open_files;
@@ -201,8 +201,10 @@ struct nfs_inode {
201 201
202 /* pNFS layout information */ 202 /* pNFS layout information */
203 struct pnfs_layout_hdr *layout; 203 struct pnfs_layout_hdr *layout;
204 atomic_t commits_outstanding;
205#endif /* CONFIG_NFS_V4*/ 204#endif /* CONFIG_NFS_V4*/
205 /* how many bytes have been written/read and how many bytes queued up */
206 __u64 write_io;
207 __u64 read_io;
206#ifdef CONFIG_NFS_FSCACHE 208#ifdef CONFIG_NFS_FSCACHE
207 struct fscache_cookie *fscache; 209 struct fscache_cookie *fscache;
208#endif 210#endif
@@ -230,7 +232,6 @@ struct nfs_inode {
230#define NFS_INO_FSCACHE (5) /* inode can be cached by FS-Cache */ 232#define NFS_INO_FSCACHE (5) /* inode can be cached by FS-Cache */
231#define NFS_INO_FSCACHE_LOCK (6) /* FS-Cache cookie management lock */ 233#define NFS_INO_FSCACHE_LOCK (6) /* FS-Cache cookie management lock */
232#define NFS_INO_COMMIT (7) /* inode is committing unstable writes */ 234#define NFS_INO_COMMIT (7) /* inode is committing unstable writes */
233#define NFS_INO_PNFS_COMMIT (8) /* use pnfs code for commit */
234#define NFS_INO_LAYOUTCOMMIT (9) /* layoutcommit required */ 235#define NFS_INO_LAYOUTCOMMIT (9) /* layoutcommit required */
235#define NFS_INO_LAYOUTCOMMITTING (10) /* layoutcommit inflight */ 236#define NFS_INO_LAYOUTCOMMITTING (10) /* layoutcommit inflight */
236 237
@@ -317,11 +318,6 @@ static inline int nfs_server_capable(struct inode *inode, int cap)
317 return NFS_SERVER(inode)->caps & cap; 318 return NFS_SERVER(inode)->caps & cap;
318} 319}
319 320
320static inline int NFS_USE_READDIRPLUS(struct inode *inode)
321{
322 return test_bit(NFS_INO_ADVISE_RDPLUS, &NFS_I(inode)->flags);
323}
324
325static inline void nfs_set_verifier(struct dentry * dentry, unsigned long verf) 321static inline void nfs_set_verifier(struct dentry * dentry, unsigned long verf)
326{ 322{
327 dentry->d_time = verf; 323 dentry->d_time = verf;
@@ -552,8 +548,8 @@ extern int nfs_wb_page(struct inode *inode, struct page* page);
552extern int nfs_wb_page_cancel(struct inode *inode, struct page* page); 548extern int nfs_wb_page_cancel(struct inode *inode, struct page* page);
553#if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4) 549#if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4)
554extern int nfs_commit_inode(struct inode *, int); 550extern int nfs_commit_inode(struct inode *, int);
555extern struct nfs_write_data *nfs_commitdata_alloc(void); 551extern struct nfs_commit_data *nfs_commitdata_alloc(void);
556extern void nfs_commit_free(struct nfs_write_data *wdata); 552extern void nfs_commit_free(struct nfs_commit_data *data);
557#else 553#else
558static inline int 554static inline int
559nfs_commit_inode(struct inode *inode, int how) 555nfs_commit_inode(struct inode *inode, int how)
@@ -569,12 +565,6 @@ nfs_have_writebacks(struct inode *inode)
569} 565}
570 566
571/* 567/*
572 * Allocate nfs_write_data structures
573 */
574extern struct nfs_write_data *nfs_writedata_alloc(unsigned int npages);
575extern void nfs_writedata_free(struct nfs_write_data *);
576
577/*
578 * linux/fs/nfs/read.c 568 * linux/fs/nfs/read.c
579 */ 569 */
580extern int nfs_readpage(struct file *, struct page *); 570extern int nfs_readpage(struct file *, struct page *);
@@ -585,12 +575,6 @@ extern int nfs_readpage_async(struct nfs_open_context *, struct inode *,
585 struct page *); 575 struct page *);
586 576
587/* 577/*
588 * Allocate nfs_read_data structures
589 */
590extern struct nfs_read_data *nfs_readdata_alloc(unsigned int npages);
591extern void nfs_readdata_free(struct nfs_read_data *);
592
593/*
594 * linux/fs/nfs3proc.c 578 * linux/fs/nfs3proc.c
595 */ 579 */
596#ifdef CONFIG_NFS_V3_ACL 580#ifdef CONFIG_NFS_V3_ACL
@@ -654,6 +638,7 @@ nfs_fileid_to_ino_t(u64 fileid)
654#define NFSDBG_FSCACHE 0x0800 638#define NFSDBG_FSCACHE 0x0800
655#define NFSDBG_PNFS 0x1000 639#define NFSDBG_PNFS 0x1000
656#define NFSDBG_PNFS_LD 0x2000 640#define NFSDBG_PNFS_LD 0x2000
641#define NFSDBG_STATE 0x4000
657#define NFSDBG_ALL 0xFFFF 642#define NFSDBG_ALL 0xFFFF
658 643
659#ifdef __KERNEL__ 644#ifdef __KERNEL__
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
index 7073fc74481c..fbb78fb09bd2 100644
--- a/include/linux/nfs_fs_sb.h
+++ b/include/linux/nfs_fs_sb.h
@@ -17,7 +17,7 @@ struct nfs4_sequence_args;
17struct nfs4_sequence_res; 17struct nfs4_sequence_res;
18struct nfs_server; 18struct nfs_server;
19struct nfs4_minor_version_ops; 19struct nfs4_minor_version_ops;
20struct server_scope; 20struct nfs41_server_scope;
21struct nfs41_impl_id; 21struct nfs41_impl_id;
22 22
23/* 23/*
@@ -35,6 +35,9 @@ struct nfs_client {
35#define NFS_CS_RENEWD 3 /* - renewd started */ 35#define NFS_CS_RENEWD 3 /* - renewd started */
36#define NFS_CS_STOP_RENEW 4 /* no more state to renew */ 36#define NFS_CS_STOP_RENEW 4 /* no more state to renew */
37#define NFS_CS_CHECK_LEASE_TIME 5 /* need to check lease time */ 37#define NFS_CS_CHECK_LEASE_TIME 5 /* need to check lease time */
38 unsigned long cl_flags; /* behavior switches */
39#define NFS_CS_NORESVPORT 0 /* - use ephemeral src port */
40#define NFS_CS_DISCRTRY 1 /* - disconnect on RPC retry */
38 struct sockaddr_storage cl_addr; /* server identifier */ 41 struct sockaddr_storage cl_addr; /* server identifier */
39 size_t cl_addrlen; 42 size_t cl_addrlen;
40 char * cl_hostname; /* hostname of server */ 43 char * cl_hostname; /* hostname of server */
@@ -61,9 +64,6 @@ struct nfs_client {
61 64
62 struct rpc_wait_queue cl_rpcwaitq; 65 struct rpc_wait_queue cl_rpcwaitq;
63 66
64 /* used for the setclientid verifier */
65 struct timespec cl_boot_time;
66
67 /* idmapper */ 67 /* idmapper */
68 struct idmap * cl_idmap; 68 struct idmap * cl_idmap;
69 69
@@ -79,16 +79,17 @@ struct nfs_client {
79 u32 cl_seqid; 79 u32 cl_seqid;
80 /* The flags used for obtaining the clientid during EXCHANGE_ID */ 80 /* The flags used for obtaining the clientid during EXCHANGE_ID */
81 u32 cl_exchange_flags; 81 u32 cl_exchange_flags;
82 struct nfs4_session *cl_session; /* sharred session */ 82 struct nfs4_session *cl_session; /* shared session */
83 struct nfs41_server_owner *cl_serverowner;
84 struct nfs41_server_scope *cl_serverscope;
85 struct nfs41_impl_id *cl_implid;
83#endif /* CONFIG_NFS_V4 */ 86#endif /* CONFIG_NFS_V4 */
84 87
85#ifdef CONFIG_NFS_FSCACHE 88#ifdef CONFIG_NFS_FSCACHE
86 struct fscache_cookie *fscache; /* client index cache cookie */ 89 struct fscache_cookie *fscache; /* client index cache cookie */
87#endif 90#endif
88 91
89 struct server_scope *server_scope; /* from exchange_id */ 92 struct net *cl_net;
90 struct nfs41_impl_id *impl_id; /* from exchange_id */
91 struct net *net;
92}; 93};
93 94
94/* 95/*
diff --git a/include/linux/nfs_page.h b/include/linux/nfs_page.h
index eac30d6bec17..88d166b555e8 100644
--- a/include/linux/nfs_page.h
+++ b/include/linux/nfs_page.h
@@ -27,7 +27,6 @@ enum {
27 PG_CLEAN, 27 PG_CLEAN,
28 PG_NEED_COMMIT, 28 PG_NEED_COMMIT,
29 PG_NEED_RESCHED, 29 PG_NEED_RESCHED,
30 PG_PARTIAL_READ_FAILED,
31 PG_COMMIT_TO_DS, 30 PG_COMMIT_TO_DS,
32}; 31};
33 32
@@ -37,7 +36,6 @@ struct nfs_page {
37 struct page *wb_page; /* page to read in/write out */ 36 struct page *wb_page; /* page to read in/write out */
38 struct nfs_open_context *wb_context; /* File state context info */ 37 struct nfs_open_context *wb_context; /* File state context info */
39 struct nfs_lock_context *wb_lock_context; /* lock context info */ 38 struct nfs_lock_context *wb_lock_context; /* lock context info */
40 atomic_t wb_complete; /* i/os we're waiting for */
41 pgoff_t wb_index; /* Offset >> PAGE_CACHE_SHIFT */ 39 pgoff_t wb_index; /* Offset >> PAGE_CACHE_SHIFT */
42 unsigned int wb_offset, /* Offset & ~PAGE_CACHE_MASK */ 40 unsigned int wb_offset, /* Offset & ~PAGE_CACHE_MASK */
43 wb_pgbase, /* Start of page data */ 41 wb_pgbase, /* Start of page data */
@@ -68,7 +66,9 @@ struct nfs_pageio_descriptor {
68 int pg_ioflags; 66 int pg_ioflags;
69 int pg_error; 67 int pg_error;
70 const struct rpc_call_ops *pg_rpc_callops; 68 const struct rpc_call_ops *pg_rpc_callops;
69 const struct nfs_pgio_completion_ops *pg_completion_ops;
71 struct pnfs_layout_segment *pg_lseg; 70 struct pnfs_layout_segment *pg_lseg;
71 struct nfs_direct_req *pg_dreq;
72}; 72};
73 73
74#define NFS_WBACK_BUSY(req) (test_bit(PG_BUSY,&(req)->wb_flags)) 74#define NFS_WBACK_BUSY(req) (test_bit(PG_BUSY,&(req)->wb_flags))
@@ -84,6 +84,7 @@ extern void nfs_release_request(struct nfs_page *req);
84extern void nfs_pageio_init(struct nfs_pageio_descriptor *desc, 84extern void nfs_pageio_init(struct nfs_pageio_descriptor *desc,
85 struct inode *inode, 85 struct inode *inode,
86 const struct nfs_pageio_ops *pg_ops, 86 const struct nfs_pageio_ops *pg_ops,
87 const struct nfs_pgio_completion_ops *compl_ops,
87 size_t bsize, 88 size_t bsize,
88 int how); 89 int how);
89extern int nfs_pageio_add_request(struct nfs_pageio_descriptor *, 90extern int nfs_pageio_add_request(struct nfs_pageio_descriptor *,
@@ -95,26 +96,17 @@ extern bool nfs_generic_pg_test(struct nfs_pageio_descriptor *desc,
95 struct nfs_page *req); 96 struct nfs_page *req);
96extern int nfs_wait_on_request(struct nfs_page *); 97extern int nfs_wait_on_request(struct nfs_page *);
97extern void nfs_unlock_request(struct nfs_page *req); 98extern void nfs_unlock_request(struct nfs_page *req);
99extern void nfs_unlock_and_release_request(struct nfs_page *req);
98 100
99/* 101/*
100 * Lock the page of an asynchronous request without getting a new reference 102 * Lock the page of an asynchronous request
101 */ 103 */
102static inline int 104static inline int
103nfs_lock_request_dontget(struct nfs_page *req)
104{
105 return !test_and_set_bit(PG_BUSY, &req->wb_flags);
106}
107
108static inline int
109nfs_lock_request(struct nfs_page *req) 105nfs_lock_request(struct nfs_page *req)
110{ 106{
111 if (test_and_set_bit(PG_BUSY, &req->wb_flags)) 107 return !test_and_set_bit(PG_BUSY, &req->wb_flags);
112 return 0;
113 kref_get(&req->wb_kref);
114 return 1;
115} 108}
116 109
117
118/** 110/**
119 * nfs_list_add_request - Insert a request into a list 111 * nfs_list_add_request - Insert a request into a list
120 * @req: request 112 * @req: request
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index 7ba3551a0414..d1a7bf51c326 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -35,6 +35,15 @@ static inline int nfs_fsid_equal(const struct nfs_fsid *a, const struct nfs_fsid
35 return a->major == b->major && a->minor == b->minor; 35 return a->major == b->major && a->minor == b->minor;
36} 36}
37 37
38struct nfs4_threshold {
39 __u32 bm;
40 __u32 l_type;
41 __u64 rd_sz;
42 __u64 wr_sz;
43 __u64 rd_io_sz;
44 __u64 wr_io_sz;
45};
46
38struct nfs_fattr { 47struct nfs_fattr {
39 unsigned int valid; /* which fields are valid */ 48 unsigned int valid; /* which fields are valid */
40 umode_t mode; 49 umode_t mode;
@@ -67,6 +76,7 @@ struct nfs_fattr {
67 unsigned long gencount; 76 unsigned long gencount;
68 struct nfs4_string *owner_name; 77 struct nfs4_string *owner_name;
69 struct nfs4_string *group_name; 78 struct nfs4_string *group_name;
79 struct nfs4_threshold *mdsthreshold; /* pNFS threshold hints */
70}; 80};
71 81
72#define NFS_ATTR_FATTR_TYPE (1U << 0) 82#define NFS_ATTR_FATTR_TYPE (1U << 0)
@@ -106,14 +116,14 @@ struct nfs_fattr {
106 | NFS_ATTR_FATTR_FILEID \ 116 | NFS_ATTR_FATTR_FILEID \
107 | NFS_ATTR_FATTR_ATIME \ 117 | NFS_ATTR_FATTR_ATIME \
108 | NFS_ATTR_FATTR_MTIME \ 118 | NFS_ATTR_FATTR_MTIME \
109 | NFS_ATTR_FATTR_CTIME) 119 | NFS_ATTR_FATTR_CTIME \
120 | NFS_ATTR_FATTR_CHANGE)
110#define NFS_ATTR_FATTR_V2 (NFS_ATTR_FATTR \ 121#define NFS_ATTR_FATTR_V2 (NFS_ATTR_FATTR \
111 | NFS_ATTR_FATTR_BLOCKS_USED) 122 | NFS_ATTR_FATTR_BLOCKS_USED)
112#define NFS_ATTR_FATTR_V3 (NFS_ATTR_FATTR \ 123#define NFS_ATTR_FATTR_V3 (NFS_ATTR_FATTR \
113 | NFS_ATTR_FATTR_SPACE_USED) 124 | NFS_ATTR_FATTR_SPACE_USED)
114#define NFS_ATTR_FATTR_V4 (NFS_ATTR_FATTR \ 125#define NFS_ATTR_FATTR_V4 (NFS_ATTR_FATTR \
115 | NFS_ATTR_FATTR_SPACE_USED \ 126 | NFS_ATTR_FATTR_SPACE_USED)
116 | NFS_ATTR_FATTR_CHANGE)
117 127
118/* 128/*
119 * Info on the file system 129 * Info on the file system
@@ -338,7 +348,6 @@ struct nfs_openargs {
338 const struct qstr * name; 348 const struct qstr * name;
339 const struct nfs_server *server; /* Needed for ID mapping */ 349 const struct nfs_server *server; /* Needed for ID mapping */
340 const u32 * bitmask; 350 const u32 * bitmask;
341 const u32 * dir_bitmask;
342 __u32 claim; 351 __u32 claim;
343 struct nfs4_sequence_args seq_args; 352 struct nfs4_sequence_args seq_args;
344}; 353};
@@ -349,7 +358,6 @@ struct nfs_openres {
349 struct nfs4_change_info cinfo; 358 struct nfs4_change_info cinfo;
350 __u32 rflags; 359 __u32 rflags;
351 struct nfs_fattr * f_attr; 360 struct nfs_fattr * f_attr;
352 struct nfs_fattr * dir_attr;
353 struct nfs_seqid * seqid; 361 struct nfs_seqid * seqid;
354 const struct nfs_server *server; 362 const struct nfs_server *server;
355 fmode_t delegation_type; 363 fmode_t delegation_type;
@@ -519,12 +527,29 @@ struct nfs_writeres {
519}; 527};
520 528
521/* 529/*
530 * Arguments to the commit call.
531 */
532struct nfs_commitargs {
533 struct nfs_fh *fh;
534 __u64 offset;
535 __u32 count;
536 const u32 *bitmask;
537 struct nfs4_sequence_args seq_args;
538};
539
540struct nfs_commitres {
541 struct nfs_fattr *fattr;
542 struct nfs_writeverf *verf;
543 const struct nfs_server *server;
544 struct nfs4_sequence_res seq_res;
545};
546
547/*
522 * Common arguments to the unlink call 548 * Common arguments to the unlink call
523 */ 549 */
524struct nfs_removeargs { 550struct nfs_removeargs {
525 const struct nfs_fh *fh; 551 const struct nfs_fh *fh;
526 struct qstr name; 552 struct qstr name;
527 const u32 * bitmask;
528 struct nfs4_sequence_args seq_args; 553 struct nfs4_sequence_args seq_args;
529}; 554};
530 555
@@ -543,7 +568,6 @@ struct nfs_renameargs {
543 const struct nfs_fh *new_dir; 568 const struct nfs_fh *new_dir;
544 const struct qstr *old_name; 569 const struct qstr *old_name;
545 const struct qstr *new_name; 570 const struct qstr *new_name;
546 const u32 *bitmask;
547 struct nfs4_sequence_args seq_args; 571 struct nfs4_sequence_args seq_args;
548}; 572};
549 573
@@ -839,7 +863,6 @@ struct nfs4_create_res {
839 struct nfs_fh * fh; 863 struct nfs_fh * fh;
840 struct nfs_fattr * fattr; 864 struct nfs_fattr * fattr;
841 struct nfs4_change_info dir_cinfo; 865 struct nfs4_change_info dir_cinfo;
842 struct nfs_fattr * dir_fattr;
843 struct nfs4_sequence_res seq_res; 866 struct nfs4_sequence_res seq_res;
844}; 867};
845 868
@@ -1061,6 +1084,21 @@ struct nfstime4 {
1061}; 1084};
1062 1085
1063#ifdef CONFIG_NFS_V4_1 1086#ifdef CONFIG_NFS_V4_1
1087
1088struct pnfs_commit_bucket {
1089 struct list_head written;
1090 struct list_head committing;
1091 struct pnfs_layout_segment *wlseg;
1092 struct pnfs_layout_segment *clseg;
1093};
1094
1095struct pnfs_ds_commit_info {
1096 int nwritten;
1097 int ncommitting;
1098 int nbuckets;
1099 struct pnfs_commit_bucket *buckets;
1100};
1101
1064#define NFS4_EXCHANGE_ID_LEN (48) 1102#define NFS4_EXCHANGE_ID_LEN (48)
1065struct nfs41_exchange_id_args { 1103struct nfs41_exchange_id_args {
1066 struct nfs_client *client; 1104 struct nfs_client *client;
@@ -1070,13 +1108,13 @@ struct nfs41_exchange_id_args {
1070 u32 flags; 1108 u32 flags;
1071}; 1109};
1072 1110
1073struct server_owner { 1111struct nfs41_server_owner {
1074 uint64_t minor_id; 1112 uint64_t minor_id;
1075 uint32_t major_id_sz; 1113 uint32_t major_id_sz;
1076 char major_id[NFS4_OPAQUE_LIMIT]; 1114 char major_id[NFS4_OPAQUE_LIMIT];
1077}; 1115};
1078 1116
1079struct server_scope { 1117struct nfs41_server_scope {
1080 uint32_t server_scope_sz; 1118 uint32_t server_scope_sz;
1081 char server_scope[NFS4_OPAQUE_LIMIT]; 1119 char server_scope[NFS4_OPAQUE_LIMIT];
1082}; 1120};
@@ -1087,10 +1125,18 @@ struct nfs41_impl_id {
1087 struct nfstime4 date; 1125 struct nfstime4 date;
1088}; 1126};
1089 1127
1128struct nfs41_bind_conn_to_session_res {
1129 struct nfs4_session *session;
1130 u32 dir;
1131 bool use_conn_in_rdma_mode;
1132};
1133
1090struct nfs41_exchange_id_res { 1134struct nfs41_exchange_id_res {
1091 struct nfs_client *client; 1135 u64 clientid;
1136 u32 seqid;
1092 u32 flags; 1137 u32 flags;
1093 struct server_scope *server_scope; 1138 struct nfs41_server_owner *server_owner;
1139 struct nfs41_server_scope *server_scope;
1094 struct nfs41_impl_id *impl_id; 1140 struct nfs41_impl_id *impl_id;
1095}; 1141};
1096 1142
@@ -1143,35 +1189,114 @@ struct nfs41_free_stateid_res {
1143 struct nfs4_sequence_res seq_res; 1189 struct nfs4_sequence_res seq_res;
1144}; 1190};
1145 1191
1192#else
1193
1194struct pnfs_ds_commit_info {
1195};
1196
1146#endif /* CONFIG_NFS_V4_1 */ 1197#endif /* CONFIG_NFS_V4_1 */
1147 1198
1148struct nfs_page; 1199struct nfs_page;
1149 1200
1150#define NFS_PAGEVEC_SIZE (8U) 1201#define NFS_PAGEVEC_SIZE (8U)
1151 1202
1203struct nfs_page_array {
1204 struct page **pagevec;
1205 unsigned int npages; /* Max length of pagevec */
1206 struct page *page_array[NFS_PAGEVEC_SIZE];
1207};
1208
1152struct nfs_read_data { 1209struct nfs_read_data {
1210 struct nfs_pgio_header *header;
1211 struct list_head list;
1153 struct rpc_task task; 1212 struct rpc_task task;
1154 struct inode *inode;
1155 struct rpc_cred *cred;
1156 struct nfs_fattr fattr; /* fattr storage */ 1213 struct nfs_fattr fattr; /* fattr storage */
1157 struct list_head pages; /* Coalesced read requests */
1158 struct list_head list; /* lists of struct nfs_read_data */
1159 struct nfs_page *req; /* multi ops per nfs_page */
1160 struct page **pagevec;
1161 unsigned int npages; /* Max length of pagevec */
1162 struct nfs_readargs args; 1214 struct nfs_readargs args;
1163 struct nfs_readres res; 1215 struct nfs_readres res;
1164 unsigned long timestamp; /* For lease renewal */ 1216 unsigned long timestamp; /* For lease renewal */
1165 struct pnfs_layout_segment *lseg;
1166 struct nfs_client *ds_clp; /* pNFS data server */
1167 const struct rpc_call_ops *mds_ops;
1168 int (*read_done_cb) (struct rpc_task *task, struct nfs_read_data *data); 1217 int (*read_done_cb) (struct rpc_task *task, struct nfs_read_data *data);
1169 __u64 mds_offset; 1218 __u64 mds_offset;
1219 struct nfs_page_array pages;
1220 struct nfs_client *ds_clp; /* pNFS data server */
1221};
1222
1223/* used as flag bits in nfs_pgio_header */
1224enum {
1225 NFS_IOHDR_ERROR = 0,
1226 NFS_IOHDR_EOF,
1227 NFS_IOHDR_REDO,
1228 NFS_IOHDR_NEED_COMMIT,
1229 NFS_IOHDR_NEED_RESCHED,
1230};
1231
1232struct nfs_pgio_header {
1233 struct inode *inode;
1234 struct rpc_cred *cred;
1235 struct list_head pages;
1236 struct list_head rpc_list;
1237 atomic_t refcnt;
1238 struct nfs_page *req;
1239 struct pnfs_layout_segment *lseg;
1240 loff_t io_start;
1241 const struct rpc_call_ops *mds_ops;
1242 void (*release) (struct nfs_pgio_header *hdr);
1243 const struct nfs_pgio_completion_ops *completion_ops;
1244 struct nfs_direct_req *dreq;
1245 spinlock_t lock;
1246 /* fields protected by lock */
1170 int pnfs_error; 1247 int pnfs_error;
1171 struct page *page_array[NFS_PAGEVEC_SIZE]; 1248 int error; /* merge with pnfs_error */
1249 unsigned long good_bytes; /* boundary of good data */
1250 unsigned long flags;
1251};
1252
1253struct nfs_read_header {
1254 struct nfs_pgio_header header;
1255 struct nfs_read_data rpc_data;
1172}; 1256};
1173 1257
1174struct nfs_write_data { 1258struct nfs_write_data {
1259 struct nfs_pgio_header *header;
1260 struct list_head list;
1261 struct rpc_task task;
1262 struct nfs_fattr fattr;
1263 struct nfs_writeverf verf;
1264 struct nfs_writeargs args; /* argument struct */
1265 struct nfs_writeres res; /* result struct */
1266 unsigned long timestamp; /* For lease renewal */
1267 int (*write_done_cb) (struct rpc_task *task, struct nfs_write_data *data);
1268 __u64 mds_offset; /* Filelayout dense stripe */
1269 struct nfs_page_array pages;
1270 struct nfs_client *ds_clp; /* pNFS data server */
1271};
1272
1273struct nfs_write_header {
1274 struct nfs_pgio_header header;
1275 struct nfs_write_data rpc_data;
1276};
1277
1278struct nfs_mds_commit_info {
1279 atomic_t rpcs_out;
1280 unsigned long ncommit;
1281 struct list_head list;
1282};
1283
1284struct nfs_commit_data;
1285struct nfs_inode;
1286struct nfs_commit_completion_ops {
1287 void (*error_cleanup) (struct nfs_inode *nfsi);
1288 void (*completion) (struct nfs_commit_data *data);
1289};
1290
1291struct nfs_commit_info {
1292 spinlock_t *lock;
1293 struct nfs_mds_commit_info *mds;
1294 struct pnfs_ds_commit_info *ds;
1295 struct nfs_direct_req *dreq; /* O_DIRECT request */
1296 const struct nfs_commit_completion_ops *completion_ops;
1297};
1298
1299struct nfs_commit_data {
1175 struct rpc_task task; 1300 struct rpc_task task;
1176 struct inode *inode; 1301 struct inode *inode;
1177 struct rpc_cred *cred; 1302 struct rpc_cred *cred;
@@ -1179,22 +1304,22 @@ struct nfs_write_data {
1179 struct nfs_writeverf verf; 1304 struct nfs_writeverf verf;
1180 struct list_head pages; /* Coalesced requests we wish to flush */ 1305 struct list_head pages; /* Coalesced requests we wish to flush */
1181 struct list_head list; /* lists of struct nfs_write_data */ 1306 struct list_head list; /* lists of struct nfs_write_data */
1182 struct nfs_page *req; /* multi ops per nfs_page */ 1307 struct nfs_direct_req *dreq; /* O_DIRECT request */
1183 struct page **pagevec; 1308 struct nfs_commitargs args; /* argument struct */
1184 unsigned int npages; /* Max length of pagevec */ 1309 struct nfs_commitres res; /* result struct */
1185 struct nfs_writeargs args; /* argument struct */ 1310 struct nfs_open_context *context;
1186 struct nfs_writeres res; /* result struct */
1187 struct pnfs_layout_segment *lseg; 1311 struct pnfs_layout_segment *lseg;
1188 struct nfs_client *ds_clp; /* pNFS data server */ 1312 struct nfs_client *ds_clp; /* pNFS data server */
1189 int ds_commit_index; 1313 int ds_commit_index;
1190 const struct rpc_call_ops *mds_ops; 1314 const struct rpc_call_ops *mds_ops;
1191 int (*write_done_cb) (struct rpc_task *task, struct nfs_write_data *data); 1315 const struct nfs_commit_completion_ops *completion_ops;
1192#ifdef CONFIG_NFS_V4 1316 int (*commit_done_cb) (struct rpc_task *task, struct nfs_commit_data *data);
1193 unsigned long timestamp; /* For lease renewal */ 1317};
1194#endif 1318
1195 __u64 mds_offset; /* Filelayout dense stripe */ 1319struct nfs_pgio_completion_ops {
1196 int pnfs_error; 1320 void (*error_cleanup)(struct list_head *head);
1197 struct page *page_array[NFS_PAGEVEC_SIZE]; 1321 void (*init_hdr)(struct nfs_pgio_header *hdr);
1322 void (*completion)(struct nfs_pgio_header *hdr);
1198}; 1323};
1199 1324
1200struct nfs_unlinkdata { 1325struct nfs_unlinkdata {
@@ -1234,11 +1359,13 @@ struct nfs_rpc_ops {
1234 1359
1235 int (*getroot) (struct nfs_server *, struct nfs_fh *, 1360 int (*getroot) (struct nfs_server *, struct nfs_fh *,
1236 struct nfs_fsinfo *); 1361 struct nfs_fsinfo *);
1362 struct vfsmount *(*submount) (struct nfs_server *, struct dentry *,
1363 struct nfs_fh *, struct nfs_fattr *);
1237 int (*getattr) (struct nfs_server *, struct nfs_fh *, 1364 int (*getattr) (struct nfs_server *, struct nfs_fh *,
1238 struct nfs_fattr *); 1365 struct nfs_fattr *);
1239 int (*setattr) (struct dentry *, struct nfs_fattr *, 1366 int (*setattr) (struct dentry *, struct nfs_fattr *,
1240 struct iattr *); 1367 struct iattr *);
1241 int (*lookup) (struct rpc_clnt *clnt, struct inode *, struct qstr *, 1368 int (*lookup) (struct inode *, struct qstr *,
1242 struct nfs_fh *, struct nfs_fattr *); 1369 struct nfs_fh *, struct nfs_fattr *);
1243 int (*access) (struct inode *, struct nfs_access_entry *); 1370 int (*access) (struct inode *, struct nfs_access_entry *);
1244 int (*readlink)(struct inode *, struct page *, unsigned int, 1371 int (*readlink)(struct inode *, struct page *, unsigned int,
@@ -1277,8 +1404,9 @@ struct nfs_rpc_ops {
1277 void (*write_setup) (struct nfs_write_data *, struct rpc_message *); 1404 void (*write_setup) (struct nfs_write_data *, struct rpc_message *);
1278 void (*write_rpc_prepare)(struct rpc_task *, struct nfs_write_data *); 1405 void (*write_rpc_prepare)(struct rpc_task *, struct nfs_write_data *);
1279 int (*write_done) (struct rpc_task *, struct nfs_write_data *); 1406 int (*write_done) (struct rpc_task *, struct nfs_write_data *);
1280 void (*commit_setup) (struct nfs_write_data *, struct rpc_message *); 1407 void (*commit_setup) (struct nfs_commit_data *, struct rpc_message *);
1281 int (*commit_done) (struct rpc_task *, struct nfs_write_data *); 1408 void (*commit_rpc_prepare)(struct rpc_task *, struct nfs_commit_data *);
1409 int (*commit_done) (struct rpc_task *, struct nfs_commit_data *);
1282 int (*lock)(struct file *, int, struct file_lock *); 1410 int (*lock)(struct file *, int, struct file_lock *);
1283 int (*lock_check_bounds)(const struct file_lock *); 1411 int (*lock_check_bounds)(const struct file_lock *);
1284 void (*clear_acl_cache)(struct inode *); 1412 void (*clear_acl_cache)(struct inode *);
@@ -1287,9 +1415,9 @@ struct nfs_rpc_ops {
1287 struct nfs_open_context *ctx, 1415 struct nfs_open_context *ctx,
1288 int open_flags, 1416 int open_flags,
1289 struct iattr *iattr); 1417 struct iattr *iattr);
1290 int (*init_client) (struct nfs_client *, const struct rpc_timeout *, 1418 struct nfs_client *
1291 const char *, rpc_authflavor_t, int); 1419 (*init_client) (struct nfs_client *, const struct rpc_timeout *,
1292 int (*secinfo)(struct inode *, const struct qstr *, struct nfs4_secinfo_flavors *); 1420 const char *, rpc_authflavor_t);
1293}; 1421};
1294 1422
1295/* 1423/*
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index e474f6e780cc..a6959f72745e 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -548,6 +548,11 @@
548 * @NL80211_CMD_SET_NOACK_MAP: sets a bitmap for the individual TIDs whether 548 * @NL80211_CMD_SET_NOACK_MAP: sets a bitmap for the individual TIDs whether
549 * No Acknowledgement Policy should be applied. 549 * No Acknowledgement Policy should be applied.
550 * 550 *
551 * @NL80211_CMD_CH_SWITCH_NOTIFY: An AP or GO may decide to switch channels
552 * independently of the userspace SME, send this event indicating
553 * %NL80211_ATTR_IFINDEX is now on %NL80211_ATTR_WIPHY_FREQ with
554 * %NL80211_ATTR_WIPHY_CHANNEL_TYPE.
555 *
551 * @NL80211_CMD_MAX: highest used command number 556 * @NL80211_CMD_MAX: highest used command number
552 * @__NL80211_CMD_AFTER_LAST: internal use 557 * @__NL80211_CMD_AFTER_LAST: internal use
553 */ 558 */
@@ -689,6 +694,8 @@ enum nl80211_commands {
689 694
690 NL80211_CMD_SET_NOACK_MAP, 695 NL80211_CMD_SET_NOACK_MAP,
691 696
697 NL80211_CMD_CH_SWITCH_NOTIFY,
698
692 /* add new commands above here */ 699 /* add new commands above here */
693 700
694 /* used to define NL80211_CMD_MAX below */ 701 /* used to define NL80211_CMD_MAX below */
@@ -1587,6 +1594,8 @@ enum nl80211_sta_flags {
1587 NL80211_STA_FLAG_MAX = __NL80211_STA_FLAG_AFTER_LAST - 1 1594 NL80211_STA_FLAG_MAX = __NL80211_STA_FLAG_AFTER_LAST - 1
1588}; 1595};
1589 1596
1597#define NL80211_STA_FLAG_MAX_OLD_API NL80211_STA_FLAG_TDLS_PEER
1598
1590/** 1599/**
1591 * struct nl80211_sta_flag_update - station flags mask/set 1600 * struct nl80211_sta_flag_update - station flags mask/set
1592 * @mask: mask of station flags to set 1601 * @mask: mask of station flags to set
@@ -1685,6 +1694,7 @@ enum nl80211_sta_bss_param {
1685 * @NL80211_STA_INFO_CONNECTED_TIME: time since the station is last connected 1694 * @NL80211_STA_INFO_CONNECTED_TIME: time since the station is last connected
1686 * @NL80211_STA_INFO_STA_FLAGS: Contains a struct nl80211_sta_flag_update. 1695 * @NL80211_STA_INFO_STA_FLAGS: Contains a struct nl80211_sta_flag_update.
1687 * @NL80211_STA_INFO_BEACON_LOSS: count of times beacon loss was detected (u32) 1696 * @NL80211_STA_INFO_BEACON_LOSS: count of times beacon loss was detected (u32)
1697 * @NL80211_STA_INFO_T_OFFSET: timing offset with respect to this STA (s64)
1688 * @__NL80211_STA_INFO_AFTER_LAST: internal 1698 * @__NL80211_STA_INFO_AFTER_LAST: internal
1689 * @NL80211_STA_INFO_MAX: highest possible station info attribute 1699 * @NL80211_STA_INFO_MAX: highest possible station info attribute
1690 */ 1700 */
@@ -1708,6 +1718,7 @@ enum nl80211_sta_info {
1708 NL80211_STA_INFO_CONNECTED_TIME, 1718 NL80211_STA_INFO_CONNECTED_TIME,
1709 NL80211_STA_INFO_STA_FLAGS, 1719 NL80211_STA_INFO_STA_FLAGS,
1710 NL80211_STA_INFO_BEACON_LOSS, 1720 NL80211_STA_INFO_BEACON_LOSS,
1721 NL80211_STA_INFO_T_OFFSET,
1711 1722
1712 /* keep last */ 1723 /* keep last */
1713 __NL80211_STA_INFO_AFTER_LAST, 1724 __NL80211_STA_INFO_AFTER_LAST,
@@ -1985,9 +1996,9 @@ enum nl80211_reg_rule_flags {
1985 * enum nl80211_dfs_regions - regulatory DFS regions 1996 * enum nl80211_dfs_regions - regulatory DFS regions
1986 * 1997 *
1987 * @NL80211_DFS_UNSET: Country has no DFS master region specified 1998 * @NL80211_DFS_UNSET: Country has no DFS master region specified
1988 * @NL80211_DFS_FCC_: Country follows DFS master rules from FCC 1999 * @NL80211_DFS_FCC: Country follows DFS master rules from FCC
1989 * @NL80211_DFS_FCC_: Country follows DFS master rules from ETSI 2000 * @NL80211_DFS_ETSI: Country follows DFS master rules from ETSI
1990 * @NL80211_DFS_JP_: Country follows DFS master rules from JP/MKK/Telec 2001 * @NL80211_DFS_JP: Country follows DFS master rules from JP/MKK/Telec
1991 */ 2002 */
1992enum nl80211_dfs_regions { 2003enum nl80211_dfs_regions {
1993 NL80211_DFS_UNSET = 0, 2004 NL80211_DFS_UNSET = 0,
@@ -2142,6 +2153,11 @@ enum nl80211_mntr_flags {
2142 * 2153 *
2143 * @NL80211_MESHCONF_ATTR_MAX: highest possible mesh configuration attribute 2154 * @NL80211_MESHCONF_ATTR_MAX: highest possible mesh configuration attribute
2144 * 2155 *
2156 * @NL80211_MESHCONF_SYNC_OFFSET_MAX_NEIGHBOR: maximum number of neighbors
2157 * to synchronize to for 11s default synchronization method (see 11C.12.2.2)
2158 *
2159 * @NL80211_MESHCONF_HT_OPMODE: set mesh HT protection mode.
2160 *
2145 * @__NL80211_MESHCONF_ATTR_AFTER_LAST: internal use 2161 * @__NL80211_MESHCONF_ATTR_AFTER_LAST: internal use
2146 */ 2162 */
2147enum nl80211_meshconf_params { 2163enum nl80211_meshconf_params {
@@ -2166,6 +2182,8 @@ enum nl80211_meshconf_params {
2166 NL80211_MESHCONF_HWMP_PERR_MIN_INTERVAL, 2182 NL80211_MESHCONF_HWMP_PERR_MIN_INTERVAL,
2167 NL80211_MESHCONF_FORWARDING, 2183 NL80211_MESHCONF_FORWARDING,
2168 NL80211_MESHCONF_RSSI_THRESHOLD, 2184 NL80211_MESHCONF_RSSI_THRESHOLD,
2185 NL80211_MESHCONF_SYNC_OFFSET_MAX_NEIGHBOR,
2186 NL80211_MESHCONF_HT_OPMODE,
2169 2187
2170 /* keep last */ 2188 /* keep last */
2171 __NL80211_MESHCONF_ATTR_AFTER_LAST, 2189 __NL80211_MESHCONF_ATTR_AFTER_LAST,
@@ -2205,6 +2223,11 @@ enum nl80211_meshconf_params {
2205 * complete (unsecured) mesh peering without the need of a userspace daemon. 2223 * complete (unsecured) mesh peering without the need of a userspace daemon.
2206 * 2224 *
2207 * @NL80211_MESH_SETUP_ATTR_MAX: highest possible mesh setup attribute number 2225 * @NL80211_MESH_SETUP_ATTR_MAX: highest possible mesh setup attribute number
2226 *
2227 * @NL80211_MESH_SETUP_ENABLE_VENDOR_SYNC: Enable this option to use a
2228 * vendor specific synchronization method or disable it to use the default
2229 * neighbor offset synchronization
2230 *
2208 * @__NL80211_MESH_SETUP_ATTR_AFTER_LAST: Internal use 2231 * @__NL80211_MESH_SETUP_ATTR_AFTER_LAST: Internal use
2209 */ 2232 */
2210enum nl80211_mesh_setup_params { 2233enum nl80211_mesh_setup_params {
@@ -2214,6 +2237,7 @@ enum nl80211_mesh_setup_params {
2214 NL80211_MESH_SETUP_IE, 2237 NL80211_MESH_SETUP_IE,
2215 NL80211_MESH_SETUP_USERSPACE_AUTH, 2238 NL80211_MESH_SETUP_USERSPACE_AUTH,
2216 NL80211_MESH_SETUP_USERSPACE_AMPE, 2239 NL80211_MESH_SETUP_USERSPACE_AMPE,
2240 NL80211_MESH_SETUP_ENABLE_VENDOR_SYNC,
2217 2241
2218 /* keep last */ 2242 /* keep last */
2219 __NL80211_MESH_SETUP_ATTR_AFTER_LAST, 2243 __NL80211_MESH_SETUP_ATTR_AFTER_LAST,
@@ -2223,7 +2247,7 @@ enum nl80211_mesh_setup_params {
2223/** 2247/**
2224 * enum nl80211_txq_attr - TX queue parameter attributes 2248 * enum nl80211_txq_attr - TX queue parameter attributes
2225 * @__NL80211_TXQ_ATTR_INVALID: Attribute number 0 is reserved 2249 * @__NL80211_TXQ_ATTR_INVALID: Attribute number 0 is reserved
2226 * @NL80211_TXQ_ATTR_QUEUE: TX queue identifier (NL80211_TXQ_Q_*) 2250 * @NL80211_TXQ_ATTR_AC: AC identifier (NL80211_AC_*)
2227 * @NL80211_TXQ_ATTR_TXOP: Maximum burst time in units of 32 usecs, 0 meaning 2251 * @NL80211_TXQ_ATTR_TXOP: Maximum burst time in units of 32 usecs, 0 meaning
2228 * disabled 2252 * disabled
2229 * @NL80211_TXQ_ATTR_CWMIN: Minimum contention window [a value of the form 2253 * @NL80211_TXQ_ATTR_CWMIN: Minimum contention window [a value of the form
@@ -2236,7 +2260,7 @@ enum nl80211_mesh_setup_params {
2236 */ 2260 */
2237enum nl80211_txq_attr { 2261enum nl80211_txq_attr {
2238 __NL80211_TXQ_ATTR_INVALID, 2262 __NL80211_TXQ_ATTR_INVALID,
2239 NL80211_TXQ_ATTR_QUEUE, 2263 NL80211_TXQ_ATTR_AC,
2240 NL80211_TXQ_ATTR_TXOP, 2264 NL80211_TXQ_ATTR_TXOP,
2241 NL80211_TXQ_ATTR_CWMIN, 2265 NL80211_TXQ_ATTR_CWMIN,
2242 NL80211_TXQ_ATTR_CWMAX, 2266 NL80211_TXQ_ATTR_CWMAX,
@@ -2247,13 +2271,21 @@ enum nl80211_txq_attr {
2247 NL80211_TXQ_ATTR_MAX = __NL80211_TXQ_ATTR_AFTER_LAST - 1 2271 NL80211_TXQ_ATTR_MAX = __NL80211_TXQ_ATTR_AFTER_LAST - 1
2248}; 2272};
2249 2273
2250enum nl80211_txq_q { 2274enum nl80211_ac {
2251 NL80211_TXQ_Q_VO, 2275 NL80211_AC_VO,
2252 NL80211_TXQ_Q_VI, 2276 NL80211_AC_VI,
2253 NL80211_TXQ_Q_BE, 2277 NL80211_AC_BE,
2254 NL80211_TXQ_Q_BK 2278 NL80211_AC_BK,
2279 NL80211_NUM_ACS
2255}; 2280};
2256 2281
2282/* backward compat */
2283#define NL80211_TXQ_ATTR_QUEUE NL80211_TXQ_ATTR_AC
2284#define NL80211_TXQ_Q_VO NL80211_AC_VO
2285#define NL80211_TXQ_Q_VI NL80211_AC_VI
2286#define NL80211_TXQ_Q_BE NL80211_AC_BE
2287#define NL80211_TXQ_Q_BK NL80211_AC_BK
2288
2257enum nl80211_channel_type { 2289enum nl80211_channel_type {
2258 NL80211_CHAN_NO_HT, 2290 NL80211_CHAN_NO_HT,
2259 NL80211_CHAN_HT20, 2291 NL80211_CHAN_HT20,
diff --git a/include/linux/nl802154.h b/include/linux/nl802154.h
index 33d9f5175109..5a3db3aa5f17 100644
--- a/include/linux/nl802154.h
+++ b/include/linux/nl802154.h
@@ -68,6 +68,7 @@ enum {
68 IEEE802154_ATTR_CHANNEL_PAGE_LIST, 68 IEEE802154_ATTR_CHANNEL_PAGE_LIST,
69 69
70 IEEE802154_ATTR_PHY_NAME, 70 IEEE802154_ATTR_PHY_NAME,
71 IEEE802154_ATTR_DEV_TYPE,
71 72
72 __IEEE802154_ATTR_MAX, 73 __IEEE802154_ATTR_MAX,
73}; 74};
@@ -126,4 +127,23 @@ enum {
126 127
127#define IEEE802154_CMD_MAX (__IEEE802154_CMD_MAX - 1) 128#define IEEE802154_CMD_MAX (__IEEE802154_CMD_MAX - 1)
128 129
130enum {
131 __IEEE802154_DEV_INVALID = -1,
132
133 /* TODO:
134 * Nowadays three device types supported by this stack at linux-zigbee
135 * project: WPAN = 0, MONITOR = 1 and SMAC = 2.
136 *
137 * Since this stack implementation exists many years, it's definitely
138 * bad idea to change the assigned values due to they are already used
139 * by third-party userspace software like: iz-tools, wireshark...
140 *
141 * Currently only monitor device is added and initialized by '1' for
142 * compatibility.
143 */
144 IEEE802154_DEV_MONITOR = 1,
145
146 __IEEE802154_DEV_MAX,
147};
148
129#endif 149#endif
diff --git a/include/linux/of.h b/include/linux/of.h
index fa7fb1d97458..2ec1083af7ff 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -193,6 +193,17 @@ extern struct device_node *of_get_next_child(const struct device_node *node,
193 for (child = of_get_next_child(parent, NULL); child != NULL; \ 193 for (child = of_get_next_child(parent, NULL); child != NULL; \
194 child = of_get_next_child(parent, child)) 194 child = of_get_next_child(parent, child))
195 195
196static inline int of_get_child_count(const struct device_node *np)
197{
198 struct device_node *child;
199 int num = 0;
200
201 for_each_child_of_node(np, child)
202 num++;
203
204 return num;
205}
206
196extern struct device_node *of_find_node_with_property( 207extern struct device_node *of_find_node_with_property(
197 struct device_node *from, const char *prop_name); 208 struct device_node *from, const char *prop_name);
198#define for_each_node_with_property(dn, prop_name) \ 209#define for_each_node_with_property(dn, prop_name) \
@@ -259,6 +270,37 @@ extern void of_detach_node(struct device_node *);
259#endif 270#endif
260 271
261#define of_match_ptr(_ptr) (_ptr) 272#define of_match_ptr(_ptr) (_ptr)
273
274/*
275 * struct property *prop;
276 * const __be32 *p;
277 * u32 u;
278 *
279 * of_property_for_each_u32(np, "propname", prop, p, u)
280 * printk("U32 value: %x\n", u);
281 */
282const __be32 *of_prop_next_u32(struct property *prop, const __be32 *cur,
283 u32 *pu);
284#define of_property_for_each_u32(np, propname, prop, p, u) \
285 for (prop = of_find_property(np, propname, NULL), \
286 p = of_prop_next_u32(prop, NULL, &u); \
287 p; \
288 p = of_prop_next_u32(prop, p, &u))
289
290/*
291 * struct property *prop;
292 * const char *s;
293 *
294 * of_property_for_each_string(np, "propname", prop, s)
295 * printk("String value: %s\n", s);
296 */
297const char *of_prop_next_string(struct property *prop, const char *cur);
298#define of_property_for_each_string(np, propname, prop, s) \
299 for (prop = of_find_property(np, propname, NULL), \
300 s = of_prop_next_string(prop, NULL); \
301 s; \
302 s = of_prop_next_string(prop, s))
303
262#else /* CONFIG_OF */ 304#else /* CONFIG_OF */
263 305
264static inline bool of_have_populated_dt(void) 306static inline bool of_have_populated_dt(void)
@@ -269,6 +311,11 @@ static inline bool of_have_populated_dt(void)
269#define for_each_child_of_node(parent, child) \ 311#define for_each_child_of_node(parent, child) \
270 while (0) 312 while (0)
271 313
314static inline int of_get_child_count(const struct device_node *np)
315{
316 return 0;
317}
318
272static inline int of_device_is_compatible(const struct device_node *device, 319static inline int of_device_is_compatible(const struct device_node *device,
273 const char *name) 320 const char *name)
274{ 321{
@@ -349,6 +396,10 @@ static inline int of_machine_is_compatible(const char *compat)
349 396
350#define of_match_ptr(_ptr) NULL 397#define of_match_ptr(_ptr) NULL
351#define of_match_node(_matches, _node) NULL 398#define of_match_node(_matches, _node) NULL
399#define of_property_for_each_u32(np, propname, prop, p, u) \
400 while (0)
401#define of_property_for_each_string(np, propname, prop, s) \
402 while (0)
352#endif /* CONFIG_OF */ 403#endif /* CONFIG_OF */
353 404
354/** 405/**
diff --git a/include/linux/of_gpio.h b/include/linux/of_gpio.h
index 81733d12cbea..c454f5796747 100644
--- a/include/linux/of_gpio.h
+++ b/include/linux/of_gpio.h
@@ -58,7 +58,6 @@ extern int of_mm_gpiochip_add(struct device_node *np,
58 58
59extern void of_gpiochip_add(struct gpio_chip *gc); 59extern void of_gpiochip_add(struct gpio_chip *gc);
60extern void of_gpiochip_remove(struct gpio_chip *gc); 60extern void of_gpiochip_remove(struct gpio_chip *gc);
61extern struct gpio_chip *of_node_to_gpiochip(struct device_node *np);
62extern int of_gpio_simple_xlate(struct gpio_chip *gc, 61extern int of_gpio_simple_xlate(struct gpio_chip *gc,
63 const struct of_phandle_args *gpiospec, 62 const struct of_phandle_args *gpiospec,
64 u32 *flags); 63 u32 *flags);
diff --git a/include/linux/of_i2c.h b/include/linux/of_i2c.h
index 0efe8d465f55..1cb775f8e663 100644
--- a/include/linux/of_i2c.h
+++ b/include/linux/of_i2c.h
@@ -20,6 +20,10 @@ extern void of_i2c_register_devices(struct i2c_adapter *adap);
20/* must call put_device() when done with returned i2c_client device */ 20/* must call put_device() when done with returned i2c_client device */
21extern struct i2c_client *of_find_i2c_device_by_node(struct device_node *node); 21extern struct i2c_client *of_find_i2c_device_by_node(struct device_node *node);
22 22
23/* must call put_device() when done with returned i2c_adapter device */
24extern struct i2c_adapter *of_find_i2c_adapter_by_node(
25 struct device_node *node);
26
23#else 27#else
24static inline void of_i2c_register_devices(struct i2c_adapter *adap) 28static inline void of_i2c_register_devices(struct i2c_adapter *adap)
25{ 29{
diff --git a/include/linux/of_irq.h b/include/linux/of_irq.h
index d229ad3edee0..1717cd935e1c 100644
--- a/include/linux/of_irq.h
+++ b/include/linux/of_irq.h
@@ -11,7 +11,7 @@ struct of_irq;
11#include <linux/of.h> 11#include <linux/of.h>
12 12
13/* 13/*
14 * irq_of_parse_and_map() is used ba all OF enabled platforms; but SPARC 14 * irq_of_parse_and_map() is used by all OF enabled platforms; but SPARC
15 * implements it differently. However, the prototype is the same for all, 15 * implements it differently. However, the prototype is the same for all,
16 * so declare it here regardless of the CONFIG_OF_IRQ setting. 16 * so declare it here regardless of the CONFIG_OF_IRQ setting.
17 */ 17 */
@@ -76,5 +76,13 @@ extern struct device_node *of_irq_find_parent(struct device_node *child);
76extern void of_irq_init(const struct of_device_id *matches); 76extern void of_irq_init(const struct of_device_id *matches);
77 77
78#endif /* CONFIG_OF_IRQ */ 78#endif /* CONFIG_OF_IRQ */
79#endif /* CONFIG_OF */ 79
80#else /* !CONFIG_OF */
81static inline unsigned int irq_of_parse_and_map(struct device_node *dev,
82 int index)
83{
84 return 0;
85}
86#endif /* !CONFIG_OF */
87
80#endif /* __OF_IRQ_H */ 88#endif /* __OF_IRQ_H */
diff --git a/include/linux/of_mdio.h b/include/linux/of_mdio.h
index 53b94e025c7c..912c27a0f7ee 100644
--- a/include/linux/of_mdio.h
+++ b/include/linux/of_mdio.h
@@ -22,4 +22,6 @@ extern struct phy_device *of_phy_connect_fixed_link(struct net_device *dev,
22 void (*hndlr)(struct net_device *), 22 void (*hndlr)(struct net_device *),
23 phy_interface_t iface); 23 phy_interface_t iface);
24 24
25extern struct mii_bus *of_mdio_find_bus(struct device_node *mdio_np);
26
25#endif /* __LINUX_OF_MDIO_H */ 27#endif /* __LINUX_OF_MDIO_H */
diff --git a/include/linux/of_serial.h b/include/linux/of_serial.h
new file mode 100644
index 000000000000..4a73ed80b4c0
--- /dev/null
+++ b/include/linux/of_serial.h
@@ -0,0 +1,17 @@
1#ifndef __LINUX_OF_SERIAL_H
2#define __LINUX_OF_SERIAL_H
3
4/*
5 * FIXME remove this file when tegra finishes conversion to open firmware,
6 * expectation is that all quirks will then be self-contained in
7 * drivers/tty/serial/of_serial.c.
8 */
9#ifdef CONFIG_ARCH_TEGRA
10extern void tegra_serial_handle_break(struct uart_port *port);
11#else
12static inline void tegra_serial_handle_break(struct uart_port *port)
13{
14}
15#endif
16
17#endif /* __LINUX_OF_SERIAL */
diff --git a/include/linux/of_spi.h b/include/linux/of_spi.h
deleted file mode 100644
index 9e3e70f78ae6..000000000000
--- a/include/linux/of_spi.h
+++ /dev/null
@@ -1,23 +0,0 @@
1/*
2 * OpenFirmware SPI support routines
3 * Copyright (C) 2008 Secret Lab Technologies Ltd.
4 *
5 * Support routines for deriving SPI device attachments from the device
6 * tree.
7 */
8
9#ifndef __LINUX_OF_SPI_H
10#define __LINUX_OF_SPI_H
11
12#include <linux/spi/spi.h>
13
14#if defined(CONFIG_OF_SPI) || defined(CONFIG_OF_SPI_MODULE)
15extern void of_register_spi_devices(struct spi_master *master);
16#else
17static inline void of_register_spi_devices(struct spi_master *master)
18{
19 return;
20}
21#endif /* CONFIG_OF_SPI */
22
23#endif /* __LINUX_OF_SPI */
diff --git a/include/linux/page-isolation.h b/include/linux/page-isolation.h
index 051c1b1ede4e..3bdcab30ca41 100644
--- a/include/linux/page-isolation.h
+++ b/include/linux/page-isolation.h
@@ -3,7 +3,7 @@
3 3
4/* 4/*
5 * Changes migrate type in [start_pfn, end_pfn) to be MIGRATE_ISOLATE. 5 * Changes migrate type in [start_pfn, end_pfn) to be MIGRATE_ISOLATE.
6 * If specified range includes migrate types other than MOVABLE, 6 * If specified range includes migrate types other than MOVABLE or CMA,
7 * this will fail with -EBUSY. 7 * this will fail with -EBUSY.
8 * 8 *
9 * For isolating all pages in the range finally, the caller have to 9 * For isolating all pages in the range finally, the caller have to
@@ -11,27 +11,27 @@
11 * test it. 11 * test it.
12 */ 12 */
13extern int 13extern int
14start_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn); 14start_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn,
15 unsigned migratetype);
15 16
16/* 17/*
17 * Changes MIGRATE_ISOLATE to MIGRATE_MOVABLE. 18 * Changes MIGRATE_ISOLATE to MIGRATE_MOVABLE.
18 * target range is [start_pfn, end_pfn) 19 * target range is [start_pfn, end_pfn)
19 */ 20 */
20extern int 21extern int
21undo_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn); 22undo_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn,
23 unsigned migratetype);
22 24
23/* 25/*
24 * test all pages in [start_pfn, end_pfn)are isolated or not. 26 * Test all pages in [start_pfn, end_pfn) are isolated or not.
25 */ 27 */
26extern int 28int test_pages_isolated(unsigned long start_pfn, unsigned long end_pfn);
27test_pages_isolated(unsigned long start_pfn, unsigned long end_pfn);
28 29
29/* 30/*
30 * Internal funcs.Changes pageblock's migrate type. 31 * Internal functions. Changes pageblock's migrate type.
31 * Please use make_pagetype_isolated()/make_pagetype_movable().
32 */ 32 */
33extern int set_migratetype_isolate(struct page *page); 33extern int set_migratetype_isolate(struct page *page);
34extern void unset_migratetype_isolate(struct page *page); 34extern void unset_migratetype_isolate(struct page *page, unsigned migratetype);
35 35
36 36
37#endif 37#endif
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index cfaaa6949b8b..efa26b4da8d2 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -426,7 +426,7 @@ static inline int fault_in_pages_writeable(char __user *uaddr, int size)
426 */ 426 */
427 if (((unsigned long)uaddr & PAGE_MASK) != 427 if (((unsigned long)uaddr & PAGE_MASK) !=
428 ((unsigned long)end & PAGE_MASK)) 428 ((unsigned long)end & PAGE_MASK))
429 ret = __put_user(0, end); 429 ret = __put_user(0, end);
430 } 430 }
431 return ret; 431 return ret;
432} 432}
@@ -445,13 +445,73 @@ static inline int fault_in_pages_readable(const char __user *uaddr, int size)
445 445
446 if (((unsigned long)uaddr & PAGE_MASK) != 446 if (((unsigned long)uaddr & PAGE_MASK) !=
447 ((unsigned long)end & PAGE_MASK)) { 447 ((unsigned long)end & PAGE_MASK)) {
448 ret = __get_user(c, end); 448 ret = __get_user(c, end);
449 (void)c; 449 (void)c;
450 } 450 }
451 } 451 }
452 return ret; 452 return ret;
453} 453}
454 454
455/*
456 * Multipage variants of the above prefault helpers, useful if more than
457 * PAGE_SIZE of data needs to be prefaulted. These are separate from the above
458 * functions (which only handle up to PAGE_SIZE) to avoid clobbering the
459 * filemap.c hotpaths.
460 */
461static inline int fault_in_multipages_writeable(char __user *uaddr, int size)
462{
463 int ret;
464 char __user *end = uaddr + size - 1;
465
466 if (unlikely(size == 0))
467 return 0;
468
469 /*
470 * Writing zeroes into userspace here is OK, because we know that if
471 * the zero gets there, we'll be overwriting it.
472 */
473 while (uaddr <= end) {
474 ret = __put_user(0, uaddr);
475 if (ret != 0)
476 return ret;
477 uaddr += PAGE_SIZE;
478 }
479
480 /* Check whether the range spilled into the next page. */
481 if (((unsigned long)uaddr & PAGE_MASK) ==
482 ((unsigned long)end & PAGE_MASK))
483 ret = __put_user(0, end);
484
485 return ret;
486}
487
488static inline int fault_in_multipages_readable(const char __user *uaddr,
489 int size)
490{
491 volatile char c;
492 int ret;
493 const char __user *end = uaddr + size - 1;
494
495 if (unlikely(size == 0))
496 return 0;
497
498 while (uaddr <= end) {
499 ret = __get_user(c, uaddr);
500 if (ret != 0)
501 return ret;
502 uaddr += PAGE_SIZE;
503 }
504
505 /* Check whether the range spilled into the next page. */
506 if (((unsigned long)uaddr & PAGE_MASK) ==
507 ((unsigned long)end & PAGE_MASK)) {
508 ret = __get_user(c, end);
509 (void)c;
510 }
511
512 return ret;
513}
514
455int add_to_page_cache_locked(struct page *page, struct address_space *mapping, 515int add_to_page_cache_locked(struct page *page, struct address_space *mapping,
456 pgoff_t index, gfp_t gfp_mask); 516 pgoff_t index, gfp_t gfp_mask);
457int add_to_page_cache_lru(struct page *page, struct address_space *mapping, 517int add_to_page_cache_lru(struct page *page, struct address_space *mapping,
diff --git a/include/linux/pci.h b/include/linux/pci.h
index e444f5b49118..17b7b5b01b4a 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -375,11 +375,18 @@ struct pci_host_bridge_window {
375}; 375};
376 376
377struct pci_host_bridge { 377struct pci_host_bridge {
378 struct list_head list; 378 struct device dev;
379 struct pci_bus *bus; /* root bus */ 379 struct pci_bus *bus; /* root bus */
380 struct list_head windows; /* pci_host_bridge_windows */ 380 struct list_head windows; /* pci_host_bridge_windows */
381 void (*release_fn)(struct pci_host_bridge *);
382 void *release_data;
381}; 383};
382 384
385#define to_pci_host_bridge(n) container_of(n, struct pci_host_bridge, dev)
386void pci_set_host_bridge_release(struct pci_host_bridge *bridge,
387 void (*release_fn)(struct pci_host_bridge *),
388 void *release_data);
389
383/* 390/*
384 * The first PCI_BRIDGE_RESOURCE_NUM PCI bus resources (those that correspond 391 * The first PCI_BRIDGE_RESOURCE_NUM PCI bus resources (those that correspond
385 * to P2P or CardBus bridge windows) go in a table. Additional ones (for 392 * to P2P or CardBus bridge windows) go in a table. Additional ones (for
diff --git a/include/linux/percpu.h b/include/linux/percpu.h
index 21638ae14e07..2b9f82c037c9 100644
--- a/include/linux/percpu.h
+++ b/include/linux/percpu.h
@@ -166,60 +166,6 @@ extern phys_addr_t per_cpu_ptr_to_phys(void *addr);
166 (typeof(type) __percpu *)__alloc_percpu(sizeof(type), __alignof__(type)) 166 (typeof(type) __percpu *)__alloc_percpu(sizeof(type), __alignof__(type))
167 167
168/* 168/*
169 * Optional methods for optimized non-lvalue per-cpu variable access.
170 *
171 * @var can be a percpu variable or a field of it and its size should
172 * equal char, int or long. percpu_read() evaluates to a lvalue and
173 * all others to void.
174 *
175 * These operations are guaranteed to be atomic.
176 * The generic versions disable interrupts. Archs are
177 * encouraged to implement single-instruction alternatives which don't
178 * require protection.
179 */
180#ifndef percpu_read
181# define percpu_read(var) \
182 ({ \
183 typeof(var) *pr_ptr__ = &(var); \
184 typeof(var) pr_ret__; \
185 pr_ret__ = get_cpu_var(*pr_ptr__); \
186 put_cpu_var(*pr_ptr__); \
187 pr_ret__; \
188 })
189#endif
190
191#define __percpu_generic_to_op(var, val, op) \
192do { \
193 typeof(var) *pgto_ptr__ = &(var); \
194 get_cpu_var(*pgto_ptr__) op val; \
195 put_cpu_var(*pgto_ptr__); \
196} while (0)
197
198#ifndef percpu_write
199# define percpu_write(var, val) __percpu_generic_to_op(var, (val), =)
200#endif
201
202#ifndef percpu_add
203# define percpu_add(var, val) __percpu_generic_to_op(var, (val), +=)
204#endif
205
206#ifndef percpu_sub
207# define percpu_sub(var, val) __percpu_generic_to_op(var, (val), -=)
208#endif
209
210#ifndef percpu_and
211# define percpu_and(var, val) __percpu_generic_to_op(var, (val), &=)
212#endif
213
214#ifndef percpu_or
215# define percpu_or(var, val) __percpu_generic_to_op(var, (val), |=)
216#endif
217
218#ifndef percpu_xor
219# define percpu_xor(var, val) __percpu_generic_to_op(var, (val), ^=)
220#endif
221
222/*
223 * Branching function to split up a function into a set of functions that 169 * Branching function to split up a function into a set of functions that
224 * are called for different scalar sizes of the objects handled. 170 * are called for different scalar sizes of the objects handled.
225 */ 171 */
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index ddbb6a901f65..f32578634d9d 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -1132,11 +1132,14 @@ struct perf_sample_data {
1132 struct perf_branch_stack *br_stack; 1132 struct perf_branch_stack *br_stack;
1133}; 1133};
1134 1134
1135static inline void perf_sample_data_init(struct perf_sample_data *data, u64 addr) 1135static inline void perf_sample_data_init(struct perf_sample_data *data,
1136 u64 addr, u64 period)
1136{ 1137{
1138 /* remaining struct members initialized in perf_prepare_sample() */
1137 data->addr = addr; 1139 data->addr = addr;
1138 data->raw = NULL; 1140 data->raw = NULL;
1139 data->br_stack = NULL; 1141 data->br_stack = NULL;
1142 data->period = period;
1140} 1143}
1141 1144
1142extern void perf_output_sample(struct perf_output_handle *handle, 1145extern void perf_output_sample(struct perf_output_handle *handle,
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 6fe0a37d4abf..c291cae8ce32 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -412,6 +412,9 @@ struct phy_driver {
412 /* Clears up any memory if needed */ 412 /* Clears up any memory if needed */
413 void (*remove)(struct phy_device *phydev); 413 void (*remove)(struct phy_device *phydev);
414 414
415 /* Handles ethtool queries for hardware time stamping. */
416 int (*ts_info)(struct phy_device *phydev, struct ethtool_ts_info *ti);
417
415 /* Handles SIOCSHWTSTAMP ioctl for hardware time stamping. */ 418 /* Handles SIOCSHWTSTAMP ioctl for hardware time stamping. */
416 int (*hwtstamp)(struct phy_device *phydev, struct ifreq *ifr); 419 int (*hwtstamp)(struct phy_device *phydev, struct ifreq *ifr);
417 420
@@ -477,7 +480,6 @@ static inline int phy_write(struct phy_device *phydev, u32 regnum, u16 val)
477 return mdiobus_write(phydev->bus, phydev->addr, regnum, val); 480 return mdiobus_write(phydev->bus, phydev->addr, regnum, val);
478} 481}
479 482
480int get_phy_id(struct mii_bus *bus, int addr, u32 *phy_id);
481struct phy_device* get_phy_device(struct mii_bus *bus, int addr); 483struct phy_device* get_phy_device(struct mii_bus *bus, int addr);
482int phy_device_register(struct phy_device *phy); 484int phy_device_register(struct phy_device *phy);
483int phy_init_hw(struct phy_device *phydev); 485int phy_init_hw(struct phy_device *phydev);
diff --git a/include/linux/pid_namespace.h b/include/linux/pid_namespace.h
index b067bd8c49d0..00474b047145 100644
--- a/include/linux/pid_namespace.h
+++ b/include/linux/pid_namespace.h
@@ -31,7 +31,7 @@ struct pid_namespace {
31#ifdef CONFIG_BSD_PROCESS_ACCT 31#ifdef CONFIG_BSD_PROCESS_ACCT
32 struct bsd_acct_struct *bacct; 32 struct bsd_acct_struct *bacct;
33#endif 33#endif
34 gid_t pid_gid; 34 kgid_t pid_gid;
35 int hide_pid; 35 int hide_pid;
36 int reboot; /* group exit code if this pidns was rebooted */ 36 int reboot; /* group exit code if this pidns was rebooted */
37}; 37};
diff --git a/include/linux/pinctrl/consumer.h b/include/linux/pinctrl/consumer.h
index 191e72688481..6dd96fb45482 100644
--- a/include/linux/pinctrl/consumer.h
+++ b/include/linux/pinctrl/consumer.h
@@ -36,6 +36,9 @@ extern struct pinctrl_state * __must_check pinctrl_lookup_state(
36 const char *name); 36 const char *name);
37extern int pinctrl_select_state(struct pinctrl *p, struct pinctrl_state *s); 37extern int pinctrl_select_state(struct pinctrl *p, struct pinctrl_state *s);
38 38
39extern struct pinctrl * __must_check devm_pinctrl_get(struct device *dev);
40extern void devm_pinctrl_put(struct pinctrl *p);
41
39#else /* !CONFIG_PINCTRL */ 42#else /* !CONFIG_PINCTRL */
40 43
41static inline int pinctrl_request_gpio(unsigned gpio) 44static inline int pinctrl_request_gpio(unsigned gpio)
@@ -79,6 +82,15 @@ static inline int pinctrl_select_state(struct pinctrl *p,
79 return 0; 82 return 0;
80} 83}
81 84
85static inline struct pinctrl * __must_check devm_pinctrl_get(struct device *dev)
86{
87 return NULL;
88}
89
90static inline void devm_pinctrl_put(struct pinctrl *p)
91{
92}
93
82#endif /* CONFIG_PINCTRL */ 94#endif /* CONFIG_PINCTRL */
83 95
84static inline struct pinctrl * __must_check pinctrl_get_select( 96static inline struct pinctrl * __must_check pinctrl_get_select(
@@ -113,6 +125,38 @@ static inline struct pinctrl * __must_check pinctrl_get_select_default(
113 return pinctrl_get_select(dev, PINCTRL_STATE_DEFAULT); 125 return pinctrl_get_select(dev, PINCTRL_STATE_DEFAULT);
114} 126}
115 127
128static inline struct pinctrl * __must_check devm_pinctrl_get_select(
129 struct device *dev, const char *name)
130{
131 struct pinctrl *p;
132 struct pinctrl_state *s;
133 int ret;
134
135 p = devm_pinctrl_get(dev);
136 if (IS_ERR(p))
137 return p;
138
139 s = pinctrl_lookup_state(p, name);
140 if (IS_ERR(s)) {
141 devm_pinctrl_put(p);
142 return ERR_PTR(PTR_ERR(s));
143 }
144
145 ret = pinctrl_select_state(p, s);
146 if (ret < 0) {
147 devm_pinctrl_put(p);
148 return ERR_PTR(ret);
149 }
150
151 return p;
152}
153
154static inline struct pinctrl * __must_check devm_pinctrl_get_select_default(
155 struct device *dev)
156{
157 return devm_pinctrl_get_select(dev, PINCTRL_STATE_DEFAULT);
158}
159
116#ifdef CONFIG_PINCONF 160#ifdef CONFIG_PINCONF
117 161
118extern int pin_config_get(const char *dev_name, const char *name, 162extern int pin_config_get(const char *dev_name, const char *name,
diff --git a/include/linux/pinctrl/machine.h b/include/linux/pinctrl/machine.h
index e4d1de742502..7d22ab00343f 100644
--- a/include/linux/pinctrl/machine.h
+++ b/include/linux/pinctrl/machine.h
@@ -154,7 +154,7 @@ struct pinctrl_map {
154 154
155extern int pinctrl_register_mappings(struct pinctrl_map const *map, 155extern int pinctrl_register_mappings(struct pinctrl_map const *map,
156 unsigned num_maps); 156 unsigned num_maps);
157 157extern void pinctrl_provide_dummies(void);
158#else 158#else
159 159
160static inline int pinctrl_register_mappings(struct pinctrl_map const *map, 160static inline int pinctrl_register_mappings(struct pinctrl_map const *map,
@@ -163,5 +163,8 @@ static inline int pinctrl_register_mappings(struct pinctrl_map const *map,
163 return 0; 163 return 0;
164} 164}
165 165
166#endif /* !CONFIG_PINMUX */ 166static inline void pinctrl_provide_dummies(void)
167{
168}
169#endif /* !CONFIG_PINCTRL */
167#endif 170#endif
diff --git a/include/linux/pinctrl/pinconf.h b/include/linux/pinctrl/pinconf.h
index ec431f03362d..e7a720104a47 100644
--- a/include/linux/pinctrl/pinconf.h
+++ b/include/linux/pinctrl/pinconf.h
@@ -25,7 +25,6 @@ struct seq_file;
25 * @pin_config_get: get the config of a certain pin, if the requested config 25 * @pin_config_get: get the config of a certain pin, if the requested config
26 * is not available on this controller this should return -ENOTSUPP 26 * is not available on this controller this should return -ENOTSUPP
27 * and if it is available but disabled it should return -EINVAL 27 * and if it is available but disabled it should return -EINVAL
28 * @pin_config_get: get the config of a certain pin
29 * @pin_config_set: configure an individual pin 28 * @pin_config_set: configure an individual pin
30 * @pin_config_group_get: get configurations for an entire pin group 29 * @pin_config_group_get: get configurations for an entire pin group
31 * @pin_config_group_set: configure all pins in a group 30 * @pin_config_group_set: configure all pins in a group
@@ -33,6 +32,8 @@ struct seq_file;
33 * per-device info for a certain pin in debugfs 32 * per-device info for a certain pin in debugfs
34 * @pin_config_group_dbg_show: optional debugfs display hook that will provide 33 * @pin_config_group_dbg_show: optional debugfs display hook that will provide
35 * per-device info for a certain group in debugfs 34 * per-device info for a certain group in debugfs
35 * @pin_config_config_dbg_show: optional debugfs display hook that will decode
36 * and display a driver's pin configuration parameter
36 */ 37 */
37struct pinconf_ops { 38struct pinconf_ops {
38#ifdef CONFIG_GENERIC_PINCONF 39#ifdef CONFIG_GENERIC_PINCONF
@@ -56,6 +57,9 @@ struct pinconf_ops {
56 void (*pin_config_group_dbg_show) (struct pinctrl_dev *pctldev, 57 void (*pin_config_group_dbg_show) (struct pinctrl_dev *pctldev,
57 struct seq_file *s, 58 struct seq_file *s,
58 unsigned selector); 59 unsigned selector);
60 void (*pin_config_config_dbg_show) (struct pinctrl_dev *pctldev,
61 struct seq_file *s,
62 unsigned long config);
59}; 63};
60 64
61#endif 65#endif
diff --git a/include/linux/pinctrl/pinctrl-state.h b/include/linux/pinctrl/pinctrl-state.h
index 3920e28b4da7..634608dc6c89 100644
--- a/include/linux/pinctrl/pinctrl-state.h
+++ b/include/linux/pinctrl/pinctrl-state.h
@@ -2,5 +2,18 @@
2 * Standard pin control state definitions 2 * Standard pin control state definitions
3 */ 3 */
4 4
5/**
6 * @PINCTRL_STATE_DEFAULT: the state the pinctrl handle shall be put
7 * into as default, usually this means the pins are up and ready to
8 * be used by the device driver. This state is commonly used by
9 * hogs to configure muxing and pins at boot.
10 * @PINCTRL_STATE_IDLE: the state the pinctrl handle shall be put into
11 * when the pins are idle. Could typically be set from a
12 * pm_runtime_suspend() operation.
13 * @PINCTRL_STATE_SLEEP: the state the pinctrl handle shall be put into
14 * when the pins are sleeping. Could typically be set from a
15 * common suspend() function.
16 */
5#define PINCTRL_STATE_DEFAULT "default" 17#define PINCTRL_STATE_DEFAULT "default"
6#define PINCTRL_STATE_IDLE "idle" 18#define PINCTRL_STATE_IDLE "idle"
19#define PINCTRL_STATE_SLEEP "sleep"
diff --git a/include/linux/pinctrl/pinctrl.h b/include/linux/pinctrl/pinctrl.h
index 4e9f0788c221..3b894a668d32 100644
--- a/include/linux/pinctrl/pinctrl.h
+++ b/include/linux/pinctrl/pinctrl.h
@@ -21,9 +21,11 @@
21 21
22struct device; 22struct device;
23struct pinctrl_dev; 23struct pinctrl_dev;
24struct pinctrl_map;
24struct pinmux_ops; 25struct pinmux_ops;
25struct pinconf_ops; 26struct pinconf_ops;
26struct gpio_chip; 27struct gpio_chip;
28struct device_node;
27 29
28/** 30/**
29 * struct pinctrl_pin_desc - boards/machines provide information on their 31 * struct pinctrl_pin_desc - boards/machines provide information on their
@@ -64,17 +66,24 @@ struct pinctrl_gpio_range {
64/** 66/**
65 * struct pinctrl_ops - global pin control operations, to be implemented by 67 * struct pinctrl_ops - global pin control operations, to be implemented by
66 * pin controller drivers. 68 * pin controller drivers.
67 * @list_groups: list the number of selectable named groups available 69 * @get_groups_count: Returns the count of total number of groups registered.
68 * in this pinmux driver, the core will begin on 0 and call this
69 * repeatedly as long as it returns >= 0 to enumerate the groups
70 * @get_group_name: return the group name of the pin group 70 * @get_group_name: return the group name of the pin group
71 * @get_group_pins: return an array of pins corresponding to a certain 71 * @get_group_pins: return an array of pins corresponding to a certain
72 * group selector @pins, and the size of the array in @num_pins 72 * group selector @pins, and the size of the array in @num_pins
73 * @pin_dbg_show: optional debugfs display hook that will provide per-device 73 * @pin_dbg_show: optional debugfs display hook that will provide per-device
74 * info for a certain pin in debugfs 74 * info for a certain pin in debugfs
75 * @dt_node_to_map: parse a device tree "pin configuration node", and create
76 * mapping table entries for it. These are returned through the @map and
77 * @num_maps output parameters. This function is optional, and may be
78 * omitted for pinctrl drivers that do not support device tree.
79 * @dt_free_map: free mapping table entries created via @dt_node_to_map. The
80 * top-level @map pointer must be freed, along with any dynamically
81 * allocated members of the mapping table entries themselves. This
82 * function is optional, and may be omitted for pinctrl drivers that do
83 * not support device tree.
75 */ 84 */
76struct pinctrl_ops { 85struct pinctrl_ops {
77 int (*list_groups) (struct pinctrl_dev *pctldev, unsigned selector); 86 int (*get_groups_count) (struct pinctrl_dev *pctldev);
78 const char *(*get_group_name) (struct pinctrl_dev *pctldev, 87 const char *(*get_group_name) (struct pinctrl_dev *pctldev,
79 unsigned selector); 88 unsigned selector);
80 int (*get_group_pins) (struct pinctrl_dev *pctldev, 89 int (*get_group_pins) (struct pinctrl_dev *pctldev,
@@ -83,6 +92,11 @@ struct pinctrl_ops {
83 unsigned *num_pins); 92 unsigned *num_pins);
84 void (*pin_dbg_show) (struct pinctrl_dev *pctldev, struct seq_file *s, 93 void (*pin_dbg_show) (struct pinctrl_dev *pctldev, struct seq_file *s,
85 unsigned offset); 94 unsigned offset);
95 int (*dt_node_to_map) (struct pinctrl_dev *pctldev,
96 struct device_node *np_config,
97 struct pinctrl_map **map, unsigned *num_maps);
98 void (*dt_free_map) (struct pinctrl_dev *pctldev,
99 struct pinctrl_map *map, unsigned num_maps);
86}; 100};
87 101
88/** 102/**
diff --git a/include/linux/pinctrl/pinmux.h b/include/linux/pinctrl/pinmux.h
index 47e9237edd47..1818dcbdd9ab 100644
--- a/include/linux/pinctrl/pinmux.h
+++ b/include/linux/pinctrl/pinmux.h
@@ -23,15 +23,14 @@ struct pinctrl_dev;
23/** 23/**
24 * struct pinmux_ops - pinmux operations, to be implemented by pin controller 24 * struct pinmux_ops - pinmux operations, to be implemented by pin controller
25 * drivers that support pinmuxing 25 * drivers that support pinmuxing
26 * @request: called by the core to see if a certain pin can be made available 26 * @request: called by the core to see if a certain pin can be made
27 * available for muxing. This is called by the core to acquire the pins 27 * available for muxing. This is called by the core to acquire the pins
28 * before selecting any actual mux setting across a function. The driver 28 * before selecting any actual mux setting across a function. The driver
29 * is allowed to answer "no" by returning a negative error code 29 * is allowed to answer "no" by returning a negative error code
30 * @free: the reverse function of the request() callback, frees a pin after 30 * @free: the reverse function of the request() callback, frees a pin after
31 * being requested 31 * being requested
32 * @list_functions: list the number of selectable named functions available 32 * @get_functions_count: returns number of selectable named functions available
33 * in this pinmux driver, the core will begin on 0 and call this 33 * in this pinmux driver
34 * repeatedly as long as it returns >= 0 to enumerate mux settings
35 * @get_function_name: return the function name of the muxing selector, 34 * @get_function_name: return the function name of the muxing selector,
36 * called by the core to figure out which mux setting it shall map a 35 * called by the core to figure out which mux setting it shall map a
37 * certain device to 36 * certain device to
@@ -62,7 +61,7 @@ struct pinctrl_dev;
62struct pinmux_ops { 61struct pinmux_ops {
63 int (*request) (struct pinctrl_dev *pctldev, unsigned offset); 62 int (*request) (struct pinctrl_dev *pctldev, unsigned offset);
64 int (*free) (struct pinctrl_dev *pctldev, unsigned offset); 63 int (*free) (struct pinctrl_dev *pctldev, unsigned offset);
65 int (*list_functions) (struct pinctrl_dev *pctldev, unsigned selector); 64 int (*get_functions_count) (struct pinctrl_dev *pctldev);
66 const char *(*get_function_name) (struct pinctrl_dev *pctldev, 65 const char *(*get_function_name) (struct pinctrl_dev *pctldev,
67 unsigned selector); 66 unsigned selector);
68 int (*get_function_groups) (struct pinctrl_dev *pctldev, 67 int (*get_function_groups) (struct pinctrl_dev *pctldev,
diff --git a/include/linux/pkt_sched.h b/include/linux/pkt_sched.h
index 410b33d014d2..32aef0a439ef 100644
--- a/include/linux/pkt_sched.h
+++ b/include/linux/pkt_sched.h
@@ -509,6 +509,7 @@ enum {
509 TCA_NETEM_CORRUPT, 509 TCA_NETEM_CORRUPT,
510 TCA_NETEM_LOSS, 510 TCA_NETEM_LOSS,
511 TCA_NETEM_RATE, 511 TCA_NETEM_RATE,
512 TCA_NETEM_ECN,
512 __TCA_NETEM_MAX, 513 __TCA_NETEM_MAX,
513}; 514};
514 515
@@ -654,4 +655,84 @@ struct tc_qfq_stats {
654 __u32 lmax; 655 __u32 lmax;
655}; 656};
656 657
658/* CODEL */
659
660enum {
661 TCA_CODEL_UNSPEC,
662 TCA_CODEL_TARGET,
663 TCA_CODEL_LIMIT,
664 TCA_CODEL_INTERVAL,
665 TCA_CODEL_ECN,
666 __TCA_CODEL_MAX
667};
668
669#define TCA_CODEL_MAX (__TCA_CODEL_MAX - 1)
670
671struct tc_codel_xstats {
672 __u32 maxpacket; /* largest packet we've seen so far */
673 __u32 count; /* how many drops we've done since the last time we
674 * entered dropping state
675 */
676 __u32 lastcount; /* count at entry to dropping state */
677 __u32 ldelay; /* in-queue delay seen by most recently dequeued packet */
678 __s32 drop_next; /* time to drop next packet */
679 __u32 drop_overlimit; /* number of time max qdisc packet limit was hit */
680 __u32 ecn_mark; /* number of packets we ECN marked instead of dropped */
681 __u32 dropping; /* are we in dropping state ? */
682};
683
684/* FQ_CODEL */
685
686enum {
687 TCA_FQ_CODEL_UNSPEC,
688 TCA_FQ_CODEL_TARGET,
689 TCA_FQ_CODEL_LIMIT,
690 TCA_FQ_CODEL_INTERVAL,
691 TCA_FQ_CODEL_ECN,
692 TCA_FQ_CODEL_FLOWS,
693 TCA_FQ_CODEL_QUANTUM,
694 __TCA_FQ_CODEL_MAX
695};
696
697#define TCA_FQ_CODEL_MAX (__TCA_FQ_CODEL_MAX - 1)
698
699enum {
700 TCA_FQ_CODEL_XSTATS_QDISC,
701 TCA_FQ_CODEL_XSTATS_CLASS,
702};
703
704struct tc_fq_codel_qd_stats {
705 __u32 maxpacket; /* largest packet we've seen so far */
706 __u32 drop_overlimit; /* number of time max qdisc
707 * packet limit was hit
708 */
709 __u32 ecn_mark; /* number of packets we ECN marked
710 * instead of being dropped
711 */
712 __u32 new_flow_count; /* number of time packets
713 * created a 'new flow'
714 */
715 __u32 new_flows_len; /* count of flows in new list */
716 __u32 old_flows_len; /* count of flows in old list */
717};
718
719struct tc_fq_codel_cl_stats {
720 __s32 deficit;
721 __u32 ldelay; /* in-queue delay seen by most recently
722 * dequeued packet
723 */
724 __u32 count;
725 __u32 lastcount;
726 __u32 dropping;
727 __s32 drop_next;
728};
729
730struct tc_fq_codel_xstats {
731 __u32 type;
732 union {
733 struct tc_fq_codel_qd_stats qdisc_stats;
734 struct tc_fq_codel_cl_stats class_stats;
735 };
736};
737
657#endif 738#endif
diff --git a/include/linux/platform_data/at91_adc.h b/include/linux/platform_data/at91_adc.h
new file mode 100644
index 000000000000..e15745b4f3a5
--- /dev/null
+++ b/include/linux/platform_data/at91_adc.h
@@ -0,0 +1,61 @@
1/*
2 * Copyright (C) 2011 Free Electrons
3 *
4 * Licensed under the GPLv2 or later.
5 */
6
7#ifndef _AT91_ADC_H_
8#define _AT91_ADC_H_
9
10/**
11 * struct at91_adc_reg_desc - Various informations relative to registers
12 * @channel_base: Base offset for the channel data registers
13 * @drdy_mask: Mask of the DRDY field in the relevant registers
14 (Interruptions registers mostly)
15 * @status_register: Offset of the Interrupt Status Register
16 * @trigger_register: Offset of the Trigger setup register
17 */
18struct at91_adc_reg_desc {
19 u8 channel_base;
20 u32 drdy_mask;
21 u8 status_register;
22 u8 trigger_register;
23};
24
25/**
26 * struct at91_adc_trigger - description of triggers
27 * @name: name of the trigger advertised to the user
28 * @value: value to set in the ADC's trigger setup register
29 to enable the trigger
30 * @is_external: Does the trigger rely on an external pin?
31 */
32struct at91_adc_trigger {
33 const char *name;
34 u8 value;
35 bool is_external;
36};
37
38/**
39 * struct at91_adc_data - platform data for ADC driver
40 * @channels_used: channels in use on the board as a bitmask
41 * @num_channels: global number of channels available on the board
42 * @registers: Registers definition on the board
43 * @startup_time: startup time of the ADC in microseconds
44 * @trigger_list: Triggers available in the ADC
45 * @trigger_number: Number of triggers available in the ADC
46 * @use_external_triggers: does the board has external triggers availables
47 * @vref: Reference voltage for the ADC in millivolts
48 */
49struct at91_adc_data {
50 unsigned long channels_used;
51 u8 num_channels;
52 struct at91_adc_reg_desc *registers;
53 u8 startup_time;
54 struct at91_adc_trigger *trigger_list;
55 u8 trigger_number;
56 bool use_external_triggers;
57 u16 vref;
58};
59
60extern void __init at91_add_device_adc(struct at91_adc_data *data);
61#endif
diff --git a/include/linux/platform_data/ehci-sh.h b/include/linux/platform_data/ehci-sh.h
new file mode 100644
index 000000000000..5c15a738e116
--- /dev/null
+++ b/include/linux/platform_data/ehci-sh.h
@@ -0,0 +1,28 @@
1/*
2 * EHCI SuperH driver platform data
3 *
4 * Copyright (C) 2012 Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
5 * Copyright (C) 2012 Renesas Solutions Corp.
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; version 2 of the License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21#ifndef __USB_EHCI_SH_H
22#define __USB_EHCI_SH_H
23
24struct ehci_sh_platdata {
25 void (*phy_init)(void); /* Phy init function */
26};
27
28#endif /* __USB_EHCI_SH_H */
diff --git a/include/linux/platform_data/emif_plat.h b/include/linux/platform_data/emif_plat.h
new file mode 100644
index 000000000000..03378ca84061
--- /dev/null
+++ b/include/linux/platform_data/emif_plat.h
@@ -0,0 +1,128 @@
1/*
2 * Definitions for TI EMIF device platform data
3 *
4 * Copyright (C) 2012 Texas Instruments, Inc.
5 *
6 * Aneesh V <aneesh@ti.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 version 2 as
10 * published by the Free Software Foundation.
11 */
12#ifndef __EMIF_PLAT_H
13#define __EMIF_PLAT_H
14
15/* Low power modes - EMIF_PWR_MGMT_CTRL */
16#define EMIF_LP_MODE_DISABLE 0
17#define EMIF_LP_MODE_CLOCK_STOP 1
18#define EMIF_LP_MODE_SELF_REFRESH 2
19#define EMIF_LP_MODE_PWR_DN 4
20
21/* Hardware capabilities */
22#define EMIF_HW_CAPS_LL_INTERFACE 0x00000001
23
24/*
25 * EMIF IP Revisions
26 * EMIF4D - Used in OMAP4
27 * EMIF4D5 - Used in OMAP5
28 */
29#define EMIF_4D 1
30#define EMIF_4D5 2
31
32/*
33 * PHY types
34 * ATTILAPHY - Used in OMAP4
35 * INTELLIPHY - Used in OMAP5
36 */
37#define EMIF_PHY_TYPE_ATTILAPHY 1
38#define EMIF_PHY_TYPE_INTELLIPHY 2
39
40/* Custom config requests */
41#define EMIF_CUSTOM_CONFIG_LPMODE 0x00000001
42#define EMIF_CUSTOM_CONFIG_TEMP_ALERT_POLL_INTERVAL 0x00000002
43
44#ifndef __ASSEMBLY__
45/**
46 * struct ddr_device_info - All information about the DDR device except AC
47 * timing parameters
48 * @type: Device type (LPDDR2-S4, LPDDR2-S2 etc)
49 * @density: Device density
50 * @io_width: Bus width
51 * @cs1_used: Whether there is a DDR device attached to the second
52 * chip-select(CS1) of this EMIF instance
53 * @cal_resistors_per_cs: Whether there is one calibration resistor per
54 * chip-select or whether it's a single one for both
55 * @manufacturer: Manufacturer name string
56 */
57struct ddr_device_info {
58 u32 type;
59 u32 density;
60 u32 io_width;
61 u32 cs1_used;
62 u32 cal_resistors_per_cs;
63 char manufacturer[10];
64};
65
66/**
67 * struct emif_custom_configs - Custom configuration parameters/policies
68 * passed from the platform layer
69 * @mask: Mask to indicate which configs are requested
70 * @lpmode: LPMODE to be used in PWR_MGMT_CTRL register
71 * @lpmode_timeout_performance: Timeout before LPMODE entry when higher
72 * performance is desired at the cost of power (typically
73 * at higher OPPs)
74 * @lpmode_timeout_power: Timeout before LPMODE entry when better power
75 * savings is desired and performance is not important
76 * (typically at lower loads indicated by lower OPPs)
77 * @lpmode_freq_threshold: The DDR frequency threshold to identify between
78 * the above two cases:
79 * timeout = (freq >= lpmode_freq_threshold) ?
80 * lpmode_timeout_performance :
81 * lpmode_timeout_power;
82 * @temp_alert_poll_interval_ms: LPDDR2 MR4 polling interval at nominal
83 * temperature(in milliseconds). When temperature is high
84 * polling is done 4 times as frequently.
85 */
86struct emif_custom_configs {
87 u32 mask;
88 u32 lpmode;
89 u32 lpmode_timeout_performance;
90 u32 lpmode_timeout_power;
91 u32 lpmode_freq_threshold;
92 u32 temp_alert_poll_interval_ms;
93};
94
95/**
96 * struct emif_platform_data - Platform data passed on EMIF platform
97 * device creation. Used by the driver.
98 * @hw_caps: Hw capabilities of the EMIF IP in the respective SoC
99 * @device_info: Device info structure containing information such
100 * as type, bus width, density etc
101 * @timings: Timings information from device datasheet passed
102 * as an array of 'struct lpddr2_timings'. Can be NULL
103 * if if default timings are ok
104 * @timings_arr_size: Size of the timings array. Depends on the number
105 * of different frequencies for which timings data
106 * is provided
107 * @min_tck: Minimum value of some timing parameters in terms
108 * of number of cycles. Can be NULL if default values
109 * are ok
110 * @custom_configs: Custom configurations requested by SoC or board
111 * code and the data for them. Can be NULL if default
112 * configurations done by the driver are ok. See
113 * documentation for 'struct emif_custom_configs' for
114 * more details
115 */
116struct emif_platform_data {
117 u32 hw_caps;
118 struct ddr_device_info *device_info;
119 const struct lpddr2_timings *timings;
120 u32 timings_arr_size;
121 const struct lpddr2_min_tck *min_tck;
122 struct emif_custom_configs *custom_configs;
123 u32 ip_rev;
124 u32 phy_type;
125};
126#endif /* __ASSEMBLY__ */
127
128#endif /* __LINUX_EMIF_H */
diff --git a/include/linux/platform_data/gpio-em.h b/include/linux/platform_data/gpio-em.h
new file mode 100644
index 000000000000..573edfb046c4
--- /dev/null
+++ b/include/linux/platform_data/gpio-em.h
@@ -0,0 +1,10 @@
1#ifndef __GPIO_EM_H__
2#define __GPIO_EM_H__
3
4struct gpio_em_config {
5 unsigned int gpio_base;
6 unsigned int irq_base;
7 unsigned int number_of_pins;
8};
9
10#endif /* __GPIO_EM_H__ */
diff --git a/include/linux/platform_data/ina2xx.h b/include/linux/platform_data/ina2xx.h
new file mode 100644
index 000000000000..9abc0ca7259b
--- /dev/null
+++ b/include/linux/platform_data/ina2xx.h
@@ -0,0 +1,19 @@
1/*
2 * Driver for Texas Instruments INA219, INA226 power monitor chips
3 *
4 * Copyright (C) 2012 Lothar Felten <l-felten@ti.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 * For further information, see the Documentation/hwmon/ina2xx file.
11 */
12
13/**
14 * struct ina2xx_platform_data - ina2xx info
15 * @shunt_uohms shunt resistance in microohms
16 */
17struct ina2xx_platform_data {
18 long shunt_uohms;
19};
diff --git a/include/linux/platform_data/s3c-hsotg.h b/include/linux/platform_data/s3c-hsotg.h
new file mode 100644
index 000000000000..97ec12c2ded4
--- /dev/null
+++ b/include/linux/platform_data/s3c-hsotg.h
@@ -0,0 +1,35 @@
1/* include/linux/platform_data/s3c-hsotg.h
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
6 * http://armlinux.simtec.co.uk/
7 *
8 * S3C USB2.0 High-speed / OtG platform information
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13*/
14
15enum s3c_hsotg_dmamode {
16 S3C_HSOTG_DMA_NONE, /* do not use DMA at-all */
17 S3C_HSOTG_DMA_ONLY, /* always use DMA */
18 S3C_HSOTG_DMA_DRV, /* DMA is chosen by driver */
19};
20
21/**
22 * struct s3c_hsotg_plat - platform data for high-speed otg/udc
23 * @dma: Whether to use DMA or not.
24 * @is_osc: The clock source is an oscillator, not a crystal
25 */
26struct s3c_hsotg_plat {
27 enum s3c_hsotg_dmamode dma;
28 unsigned int is_osc:1;
29 int phy_type;
30
31 int (*phy_init)(struct platform_device *pdev, int type);
32 int (*phy_exit)(struct platform_device *pdev, int type);
33};
34
35extern void s3c_hsotg_set_platdata(struct s3c_hsotg_plat *pd);
diff --git a/include/linux/platform_data/tegra_usb.h b/include/linux/platform_data/tegra_usb.h
index 6bca5b569acb..66c673fef408 100644
--- a/include/linux/platform_data/tegra_usb.h
+++ b/include/linux/platform_data/tegra_usb.h
@@ -26,6 +26,7 @@ struct tegra_ehci_platform_data {
26 /* power down the phy on bus suspend */ 26 /* power down the phy on bus suspend */
27 int power_down_on_bus_suspend; 27 int power_down_on_bus_suspend;
28 void *phy_config; 28 void *phy_config;
29 int vbus_gpio;
29}; 30};
30 31
31#endif /* _TEGRA_USB_H_ */ 32#endif /* _TEGRA_USB_H_ */
diff --git a/include/linux/platform_data/wiznet.h b/include/linux/platform_data/wiznet.h
new file mode 100644
index 000000000000..b5d8c192d84d
--- /dev/null
+++ b/include/linux/platform_data/wiznet.h
@@ -0,0 +1,24 @@
1/*
2 * Ethernet driver for the WIZnet W5x00 chip.
3 *
4 * Licensed under the GPL-2 or later.
5 */
6
7#ifndef PLATFORM_DATA_WIZNET_H
8#define PLATFORM_DATA_WIZNET_H
9
10#include <linux/if_ether.h>
11
12struct wiznet_platform_data {
13 int link_gpio;
14 u8 mac_addr[ETH_ALEN];
15};
16
17#ifndef CONFIG_WIZNET_BUS_SHIFT
18#define CONFIG_WIZNET_BUS_SHIFT 0
19#endif
20
21#define W5100_BUS_DIRECT_SIZE (0x8000 << CONFIG_WIZNET_BUS_SHIFT)
22#define W5300_BUS_DIRECT_SIZE (0x0400 << CONFIG_WIZNET_BUS_SHIFT)
23
24#endif /* PLATFORM_DATA_WIZNET_H */
diff --git a/include/linux/pm.h b/include/linux/pm.h
index 715305e05123..f067e60a3832 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -544,8 +544,6 @@ struct dev_pm_info {
544 unsigned long active_jiffies; 544 unsigned long active_jiffies;
545 unsigned long suspended_jiffies; 545 unsigned long suspended_jiffies;
546 unsigned long accounting_timestamp; 546 unsigned long accounting_timestamp;
547 ktime_t suspend_time;
548 s64 max_time_suspended_ns;
549 struct dev_pm_qos_request *pq_req; 547 struct dev_pm_qos_request *pq_req;
550#endif 548#endif
551 struct pm_subsys_data *subsys_data; /* Owned by the subsystem. */ 549 struct pm_subsys_data *subsys_data; /* Owned by the subsystem. */
diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
index 91f8286106ea..30f794eb3826 100644
--- a/include/linux/pm_domain.h
+++ b/include/linux/pm_domain.h
@@ -14,6 +14,7 @@
14#include <linux/pm.h> 14#include <linux/pm.h>
15#include <linux/err.h> 15#include <linux/err.h>
16#include <linux/of.h> 16#include <linux/of.h>
17#include <linux/notifier.h>
17 18
18enum gpd_status { 19enum gpd_status {
19 GPD_STATE_ACTIVE = 0, /* PM domain is active */ 20 GPD_STATE_ACTIVE = 0, /* PM domain is active */
@@ -70,9 +71,9 @@ struct generic_pm_domain {
70 int (*power_on)(struct generic_pm_domain *domain); 71 int (*power_on)(struct generic_pm_domain *domain);
71 s64 power_on_latency_ns; 72 s64 power_on_latency_ns;
72 struct gpd_dev_ops dev_ops; 73 struct gpd_dev_ops dev_ops;
73 s64 break_even_ns; /* Power break even for the entire domain. */
74 s64 max_off_time_ns; /* Maximum allowed "suspended" time. */ 74 s64 max_off_time_ns; /* Maximum allowed "suspended" time. */
75 ktime_t power_off_time; 75 bool max_off_time_changed;
76 bool cached_power_down_ok;
76 struct device_node *of_node; /* Node in device tree */ 77 struct device_node *of_node; /* Node in device tree */
77}; 78};
78 79
@@ -93,13 +94,17 @@ struct gpd_timing_data {
93 s64 start_latency_ns; 94 s64 start_latency_ns;
94 s64 save_state_latency_ns; 95 s64 save_state_latency_ns;
95 s64 restore_state_latency_ns; 96 s64 restore_state_latency_ns;
96 s64 break_even_ns; 97 s64 effective_constraint_ns;
98 bool constraint_changed;
99 bool cached_stop_ok;
97}; 100};
98 101
99struct generic_pm_domain_data { 102struct generic_pm_domain_data {
100 struct pm_domain_data base; 103 struct pm_domain_data base;
101 struct gpd_dev_ops ops; 104 struct gpd_dev_ops ops;
102 struct gpd_timing_data td; 105 struct gpd_timing_data td;
106 struct notifier_block nb;
107 struct mutex lock;
103 bool need_restore; 108 bool need_restore;
104 bool always_on; 109 bool always_on;
105}; 110};
@@ -141,6 +146,7 @@ static inline int pm_genpd_of_add_device(struct device_node *genpd_node,
141extern int pm_genpd_remove_device(struct generic_pm_domain *genpd, 146extern int pm_genpd_remove_device(struct generic_pm_domain *genpd,
142 struct device *dev); 147 struct device *dev);
143extern void pm_genpd_dev_always_on(struct device *dev, bool val); 148extern void pm_genpd_dev_always_on(struct device *dev, bool val);
149extern void pm_genpd_dev_need_restore(struct device *dev, bool val);
144extern int pm_genpd_add_subdomain(struct generic_pm_domain *genpd, 150extern int pm_genpd_add_subdomain(struct generic_pm_domain *genpd,
145 struct generic_pm_domain *new_subdomain); 151 struct generic_pm_domain *new_subdomain);
146extern int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd, 152extern int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd,
@@ -184,6 +190,7 @@ static inline int pm_genpd_remove_device(struct generic_pm_domain *genpd,
184 return -ENOSYS; 190 return -ENOSYS;
185} 191}
186static inline void pm_genpd_dev_always_on(struct device *dev, bool val) {} 192static inline void pm_genpd_dev_always_on(struct device *dev, bool val) {}
193static inline void pm_genpd_dev_need_restore(struct device *dev, bool val) {}
187static inline int pm_genpd_add_subdomain(struct generic_pm_domain *genpd, 194static inline int pm_genpd_add_subdomain(struct generic_pm_domain *genpd,
188 struct generic_pm_domain *new_sd) 195 struct generic_pm_domain *new_sd)
189{ 196{
diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h
index 609daae7a014..f271860c78d5 100644
--- a/include/linux/pm_runtime.h
+++ b/include/linux/pm_runtime.h
@@ -150,9 +150,6 @@ static inline void pm_runtime_set_autosuspend_delay(struct device *dev,
150static inline unsigned long pm_runtime_autosuspend_expiration( 150static inline unsigned long pm_runtime_autosuspend_expiration(
151 struct device *dev) { return 0; } 151 struct device *dev) { return 0; }
152 152
153static inline void pm_runtime_update_max_time_suspended(struct device *dev,
154 s64 delta_ns) {}
155
156#endif /* !CONFIG_PM_RUNTIME */ 153#endif /* !CONFIG_PM_RUNTIME */
157 154
158static inline int pm_runtime_idle(struct device *dev) 155static inline int pm_runtime_idle(struct device *dev)
diff --git a/include/linux/pm_wakeup.h b/include/linux/pm_wakeup.h
index d9f05113e5fb..569781faa504 100644
--- a/include/linux/pm_wakeup.h
+++ b/include/linux/pm_wakeup.h
@@ -33,12 +33,15 @@
33 * 33 *
34 * @total_time: Total time this wakeup source has been active. 34 * @total_time: Total time this wakeup source has been active.
35 * @max_time: Maximum time this wakeup source has been continuously active. 35 * @max_time: Maximum time this wakeup source has been continuously active.
36 * @last_time: Monotonic clock when the wakeup source's was activated last time. 36 * @last_time: Monotonic clock when the wakeup source's was touched last time.
37 * @prevent_sleep_time: Total time this source has been preventing autosleep.
37 * @event_count: Number of signaled wakeup events. 38 * @event_count: Number of signaled wakeup events.
38 * @active_count: Number of times the wakeup sorce was activated. 39 * @active_count: Number of times the wakeup sorce was activated.
39 * @relax_count: Number of times the wakeup sorce was deactivated. 40 * @relax_count: Number of times the wakeup sorce was deactivated.
40 * @hit_count: Number of times the wakeup sorce might abort system suspend. 41 * @expire_count: Number of times the wakeup source's timeout has expired.
42 * @wakeup_count: Number of times the wakeup source might abort suspend.
41 * @active: Status of the wakeup source. 43 * @active: Status of the wakeup source.
44 * @has_timeout: The wakeup source has been activated with a timeout.
42 */ 45 */
43struct wakeup_source { 46struct wakeup_source {
44 const char *name; 47 const char *name;
@@ -49,11 +52,15 @@ struct wakeup_source {
49 ktime_t total_time; 52 ktime_t total_time;
50 ktime_t max_time; 53 ktime_t max_time;
51 ktime_t last_time; 54 ktime_t last_time;
55 ktime_t start_prevent_time;
56 ktime_t prevent_sleep_time;
52 unsigned long event_count; 57 unsigned long event_count;
53 unsigned long active_count; 58 unsigned long active_count;
54 unsigned long relax_count; 59 unsigned long relax_count;
55 unsigned long hit_count; 60 unsigned long expire_count;
56 unsigned int active:1; 61 unsigned long wakeup_count;
62 bool active:1;
63 bool autosleep_enabled:1;
57}; 64};
58 65
59#ifdef CONFIG_PM_SLEEP 66#ifdef CONFIG_PM_SLEEP
diff --git a/include/linux/prctl.h b/include/linux/prctl.h
index e0cfec2490aa..78b76e24cc7e 100644
--- a/include/linux/prctl.h
+++ b/include/linux/prctl.h
@@ -124,4 +124,19 @@
124#define PR_SET_CHILD_SUBREAPER 36 124#define PR_SET_CHILD_SUBREAPER 36
125#define PR_GET_CHILD_SUBREAPER 37 125#define PR_GET_CHILD_SUBREAPER 37
126 126
127/*
128 * If no_new_privs is set, then operations that grant new privileges (i.e.
129 * execve) will either fail or not grant them. This affects suid/sgid,
130 * file capabilities, and LSMs.
131 *
132 * Operations that merely manipulate or drop existing privileges (setresuid,
133 * capset, etc.) will still work. Drop those privileges if you want them gone.
134 *
135 * Changing LSM security domain is considered a new privilege. So, for example,
136 * asking selinux for a specific new context (e.g. with runcon) will result
137 * in execve returning -EPERM.
138 */
139#define PR_SET_NO_NEW_PRIVS 38
140#define PR_GET_NO_NEW_PRIVS 39
141
127#endif /* _LINUX_PRCTL_H */ 142#endif /* _LINUX_PRCTL_H */
diff --git a/include/linux/printk.h b/include/linux/printk.h
index 0525927f203f..1bec2f7a2d42 100644
--- a/include/linux/printk.h
+++ b/include/linux/printk.h
@@ -95,8 +95,19 @@ extern int printk_needs_cpu(int cpu);
95extern void printk_tick(void); 95extern void printk_tick(void);
96 96
97#ifdef CONFIG_PRINTK 97#ifdef CONFIG_PRINTK
98asmlinkage __printf(5, 0)
99int vprintk_emit(int facility, int level,
100 const char *dict, size_t dictlen,
101 const char *fmt, va_list args);
102
98asmlinkage __printf(1, 0) 103asmlinkage __printf(1, 0)
99int vprintk(const char *fmt, va_list args); 104int vprintk(const char *fmt, va_list args);
105
106asmlinkage __printf(5, 6) __cold
107asmlinkage int printk_emit(int facility, int level,
108 const char *dict, size_t dictlen,
109 const char *fmt, ...);
110
100asmlinkage __printf(1, 2) __cold 111asmlinkage __printf(1, 2) __cold
101int printk(const char *fmt, ...); 112int printk(const char *fmt, ...);
102 113
@@ -289,6 +300,8 @@ extern void dump_stack(void) __cold;
289 no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) 300 no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
290#endif 301#endif
291 302
303extern const struct file_operations kmsg_fops;
304
292enum { 305enum {
293 DUMP_PREFIX_NONE, 306 DUMP_PREFIX_NONE,
294 DUMP_PREFIX_ADDRESS, 307 DUMP_PREFIX_ADDRESS,
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index 85c507306239..3fd2e871ff1b 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -52,8 +52,8 @@ struct proc_dir_entry {
52 unsigned int low_ino; 52 unsigned int low_ino;
53 umode_t mode; 53 umode_t mode;
54 nlink_t nlink; 54 nlink_t nlink;
55 uid_t uid; 55 kuid_t uid;
56 gid_t gid; 56 kgid_t gid;
57 loff_t size; 57 loff_t size;
58 const struct inode_operations *proc_iops; 58 const struct inode_operations *proc_iops;
59 /* 59 /*
diff --git a/include/linux/pstore_ram.h b/include/linux/pstore_ram.h
new file mode 100644
index 000000000000..7ed7fd4dba49
--- /dev/null
+++ b/include/linux/pstore_ram.h
@@ -0,0 +1,98 @@
1/*
2 * Copyright (C) 2010 Marco Stornelli <marco.stornelli@gmail.com>
3 * Copyright (C) 2011 Kees Cook <keescook@chromium.org>
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_PSTORE_RAM_H__
18#define __LINUX_PSTORE_RAM_H__
19
20#include <linux/device.h>
21#include <linux/kernel.h>
22#include <linux/list.h>
23#include <linux/types.h>
24#include <linux/init.h>
25
26struct persistent_ram_buffer;
27
28struct persistent_ram_descriptor {
29 const char *name;
30 phys_addr_t size;
31};
32
33struct persistent_ram {
34 phys_addr_t start;
35 phys_addr_t size;
36
37 int num_descs;
38 struct persistent_ram_descriptor *descs;
39
40 struct list_head node;
41};
42
43struct persistent_ram_zone {
44 phys_addr_t paddr;
45 size_t size;
46 void *vaddr;
47 struct persistent_ram_buffer *buffer;
48 size_t buffer_size;
49
50 /* ECC correction */
51 bool ecc;
52 char *par_buffer;
53 char *par_header;
54 struct rs_control *rs_decoder;
55 int corrected_bytes;
56 int bad_blocks;
57 int ecc_block_size;
58 int ecc_size;
59 int ecc_symsize;
60 int ecc_poly;
61
62 char *old_log;
63 size_t old_log_size;
64};
65
66int persistent_ram_early_init(struct persistent_ram *ram);
67
68struct persistent_ram_zone * __init persistent_ram_new(phys_addr_t start,
69 size_t size,
70 bool ecc);
71void persistent_ram_free(struct persistent_ram_zone *prz);
72struct persistent_ram_zone *persistent_ram_init_ringbuffer(struct device *dev,
73 bool ecc);
74
75int persistent_ram_write(struct persistent_ram_zone *prz, const void *s,
76 unsigned int count);
77
78size_t persistent_ram_old_size(struct persistent_ram_zone *prz);
79void *persistent_ram_old(struct persistent_ram_zone *prz);
80void persistent_ram_free_old(struct persistent_ram_zone *prz);
81ssize_t persistent_ram_ecc_string(struct persistent_ram_zone *prz,
82 char *str, size_t len);
83
84/*
85 * Ramoops platform data
86 * @mem_size memory size for ramoops
87 * @mem_address physical memory address to contain ramoops
88 */
89
90struct ramoops_platform_data {
91 unsigned long mem_size;
92 unsigned long mem_address;
93 unsigned long record_size;
94 int dump_oops;
95 bool ecc;
96};
97
98#endif
diff --git a/include/linux/ptp_clock_kernel.h b/include/linux/ptp_clock_kernel.h
index dd2e44fba63e..945704c2ed65 100644
--- a/include/linux/ptp_clock_kernel.h
+++ b/include/linux/ptp_clock_kernel.h
@@ -136,4 +136,12 @@ struct ptp_clock_event {
136extern void ptp_clock_event(struct ptp_clock *ptp, 136extern void ptp_clock_event(struct ptp_clock *ptp,
137 struct ptp_clock_event *event); 137 struct ptp_clock_event *event);
138 138
139/**
140 * ptp_clock_index() - obtain the device index of a PTP clock
141 *
142 * @ptp: The clock obtained from ptp_clock_register().
143 */
144
145extern int ptp_clock_index(struct ptp_clock *ptp);
146
139#endif 147#endif
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h
index 5c719627c2aa..597e4fdb97fe 100644
--- a/include/linux/ptrace.h
+++ b/include/linux/ptrace.h
@@ -58,6 +58,7 @@
58#define PTRACE_EVENT_EXEC 4 58#define PTRACE_EVENT_EXEC 4
59#define PTRACE_EVENT_VFORK_DONE 5 59#define PTRACE_EVENT_VFORK_DONE 5
60#define PTRACE_EVENT_EXIT 6 60#define PTRACE_EVENT_EXIT 6
61#define PTRACE_EVENT_SECCOMP 7
61/* Extended result codes which enabled by means other than options. */ 62/* Extended result codes which enabled by means other than options. */
62#define PTRACE_EVENT_STOP 128 63#define PTRACE_EVENT_STOP 128
63 64
@@ -69,8 +70,9 @@
69#define PTRACE_O_TRACEEXEC (1 << PTRACE_EVENT_EXEC) 70#define PTRACE_O_TRACEEXEC (1 << PTRACE_EVENT_EXEC)
70#define PTRACE_O_TRACEVFORKDONE (1 << PTRACE_EVENT_VFORK_DONE) 71#define PTRACE_O_TRACEVFORKDONE (1 << PTRACE_EVENT_VFORK_DONE)
71#define PTRACE_O_TRACEEXIT (1 << PTRACE_EVENT_EXIT) 72#define PTRACE_O_TRACEEXIT (1 << PTRACE_EVENT_EXIT)
73#define PTRACE_O_TRACESECCOMP (1 << PTRACE_EVENT_SECCOMP)
72 74
73#define PTRACE_O_MASK 0x0000007f 75#define PTRACE_O_MASK 0x000000ff
74 76
75#include <asm/ptrace.h> 77#include <asm/ptrace.h>
76 78
@@ -98,6 +100,7 @@
98#define PT_TRACE_EXEC PT_EVENT_FLAG(PTRACE_EVENT_EXEC) 100#define PT_TRACE_EXEC PT_EVENT_FLAG(PTRACE_EVENT_EXEC)
99#define PT_TRACE_VFORK_DONE PT_EVENT_FLAG(PTRACE_EVENT_VFORK_DONE) 101#define PT_TRACE_VFORK_DONE PT_EVENT_FLAG(PTRACE_EVENT_VFORK_DONE)
100#define PT_TRACE_EXIT PT_EVENT_FLAG(PTRACE_EVENT_EXIT) 102#define PT_TRACE_EXIT PT_EVENT_FLAG(PTRACE_EVENT_EXIT)
103#define PT_TRACE_SECCOMP PT_EVENT_FLAG(PTRACE_EVENT_SECCOMP)
101 104
102/* single stepping state bits (used on ARM and PA-RISC) */ 105/* single stepping state bits (used on ARM and PA-RISC) */
103#define PT_SINGLESTEP_BIT 31 106#define PT_SINGLESTEP_BIT 31
diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h
index d93f95e6177c..17b977304a09 100644
--- a/include/linux/quotaops.h
+++ b/include/linux/quotaops.h
@@ -22,8 +22,8 @@ static inline struct quota_info *sb_dqopt(struct super_block *sb)
22static inline bool is_quota_modification(struct inode *inode, struct iattr *ia) 22static inline bool is_quota_modification(struct inode *inode, struct iattr *ia)
23{ 23{
24 return (ia->ia_valid & ATTR_SIZE && ia->ia_size != inode->i_size) || 24 return (ia->ia_valid & ATTR_SIZE && ia->ia_size != inode->i_size) ||
25 (ia->ia_valid & ATTR_UID && ia->ia_uid != inode->i_uid) || 25 (ia->ia_valid & ATTR_UID && !uid_eq(ia->ia_uid, inode->i_uid)) ||
26 (ia->ia_valid & ATTR_GID && ia->ia_gid != inode->i_gid); 26 (ia->ia_valid & ATTR_GID && !gid_eq(ia->ia_gid, inode->i_gid));
27} 27}
28 28
29#if defined(CONFIG_QUOTA) 29#if defined(CONFIG_QUOTA)
diff --git a/include/linux/raid/md_p.h b/include/linux/raid/md_p.h
index 8c0a3adc5df5..ee753536ab70 100644
--- a/include/linux/raid/md_p.h
+++ b/include/linux/raid/md_p.h
@@ -233,7 +233,10 @@ struct mdp_superblock_1 {
233 __le32 delta_disks; /* change in number of raid_disks */ 233 __le32 delta_disks; /* change in number of raid_disks */
234 __le32 new_layout; /* new layout */ 234 __le32 new_layout; /* new layout */
235 __le32 new_chunk; /* new chunk size (512byte sectors) */ 235 __le32 new_chunk; /* new chunk size (512byte sectors) */
236 __u8 pad1[128-124]; /* set to 0 when written */ 236 __le32 new_offset; /* signed number to add to data_offset in new
237 * layout. 0 == no-change. This can be
238 * different on each device in the array.
239 */
237 240
238 /* constant this-device information - 64 bytes */ 241 /* constant this-device information - 64 bytes */
239 __le64 data_offset; /* sector start of data, often 0 */ 242 __le64 data_offset; /* sector start of data, often 0 */
@@ -281,10 +284,18 @@ struct mdp_superblock_1 {
281 * active device with same 'role'. 284 * active device with same 'role'.
282 * 'recovery_offset' is also set. 285 * 'recovery_offset' is also set.
283 */ 286 */
287#define MD_FEATURE_RESHAPE_BACKWARDS 32 /* Reshape doesn't change number
288 * of devices, but is going
289 * backwards anyway.
290 */
291#define MD_FEATURE_NEW_OFFSET 64 /* new_offset must be honoured */
284#define MD_FEATURE_ALL (MD_FEATURE_BITMAP_OFFSET \ 292#define MD_FEATURE_ALL (MD_FEATURE_BITMAP_OFFSET \
285 |MD_FEATURE_RECOVERY_OFFSET \ 293 |MD_FEATURE_RECOVERY_OFFSET \
286 |MD_FEATURE_RESHAPE_ACTIVE \ 294 |MD_FEATURE_RESHAPE_ACTIVE \
287 |MD_FEATURE_BAD_BLOCKS \ 295 |MD_FEATURE_BAD_BLOCKS \
288 |MD_FEATURE_REPLACEMENT) 296 |MD_FEATURE_REPLACEMENT \
297 |MD_FEATURE_RESHAPE_BACKWARDS \
298 |MD_FEATURE_NEW_OFFSET \
299 )
289 300
290#endif 301#endif
diff --git a/include/linux/raid/pq.h b/include/linux/raid/pq.h
index 53272e9860a7..640c69ceec96 100644
--- a/include/linux/raid/pq.h
+++ b/include/linux/raid/pq.h
@@ -99,8 +99,20 @@ extern const struct raid6_calls raid6_altivec2;
99extern const struct raid6_calls raid6_altivec4; 99extern const struct raid6_calls raid6_altivec4;
100extern const struct raid6_calls raid6_altivec8; 100extern const struct raid6_calls raid6_altivec8;
101 101
102struct raid6_recov_calls {
103 void (*data2)(int, size_t, int, int, void **);
104 void (*datap)(int, size_t, int, void **);
105 int (*valid)(void);
106 const char *name;
107 int priority;
108};
109
110extern const struct raid6_recov_calls raid6_recov_intx1;
111extern const struct raid6_recov_calls raid6_recov_ssse3;
112
102/* Algorithm list */ 113/* Algorithm list */
103extern const struct raid6_calls * const raid6_algos[]; 114extern const struct raid6_calls * const raid6_algos[];
115extern const struct raid6_recov_calls *const raid6_recov_algos[];
104int raid6_select_algo(void); 116int raid6_select_algo(void);
105 117
106/* Return values from chk_syndrome */ 118/* Return values from chk_syndrome */
@@ -111,14 +123,16 @@ int raid6_select_algo(void);
111 123
112/* Galois field tables */ 124/* Galois field tables */
113extern const u8 raid6_gfmul[256][256] __attribute__((aligned(256))); 125extern const u8 raid6_gfmul[256][256] __attribute__((aligned(256)));
126extern const u8 raid6_vgfmul[256][32] __attribute__((aligned(256)));
114extern const u8 raid6_gfexp[256] __attribute__((aligned(256))); 127extern const u8 raid6_gfexp[256] __attribute__((aligned(256)));
115extern const u8 raid6_gfinv[256] __attribute__((aligned(256))); 128extern const u8 raid6_gfinv[256] __attribute__((aligned(256)));
116extern const u8 raid6_gfexi[256] __attribute__((aligned(256))); 129extern const u8 raid6_gfexi[256] __attribute__((aligned(256)));
117 130
118/* Recovery routines */ 131/* Recovery routines */
119void raid6_2data_recov(int disks, size_t bytes, int faila, int failb, 132extern void (*raid6_2data_recov)(int disks, size_t bytes, int faila, int failb,
120 void **ptrs); 133 void **ptrs);
121void raid6_datap_recov(int disks, size_t bytes, int faila, void **ptrs); 134extern void (*raid6_datap_recov)(int disks, size_t bytes, int faila,
135 void **ptrs);
122void raid6_dual_recov(int disks, size_t bytes, int faila, int failb, 136void raid6_dual_recov(int disks, size_t bytes, int faila, int failb,
123 void **ptrs); 137 void **ptrs);
124 138
diff --git a/include/linux/ramoops.h b/include/linux/ramoops.h
deleted file mode 100644
index 484fef81cd3a..000000000000
--- a/include/linux/ramoops.h
+++ /dev/null
@@ -1,17 +0,0 @@
1#ifndef __RAMOOPS_H
2#define __RAMOOPS_H
3
4/*
5 * Ramoops platform data
6 * @mem_size memory size for ramoops
7 * @mem_address physical memory address to contain ramoops
8 */
9
10struct ramoops_platform_data {
11 unsigned long mem_size;
12 unsigned long mem_address;
13 unsigned long record_size;
14 int dump_oops;
15};
16
17#endif
diff --git a/include/linux/rational.h b/include/linux/rational.h
index 4f532fcd9eea..bfa6a2bcfb32 100644
--- a/include/linux/rational.h
+++ b/include/linux/rational.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * rational fractions 2 * rational fractions
3 * 3 *
4 * Copyright (C) 2009 emlix GmbH, Oskar Schirmer <os@emlix.com> 4 * Copyright (C) 2009 emlix GmbH, Oskar Schirmer <oskar@scara.com>
5 * 5 *
6 * helper functions when coping with rational numbers, 6 * helper functions when coping with rational numbers,
7 * e.g. when calculating optimum numerator/denominator pairs for 7 * e.g. when calculating optimum numerator/denominator pairs for
diff --git a/include/linux/rculist.h b/include/linux/rculist.h
index d079290843a9..e0f0fab20415 100644
--- a/include/linux/rculist.h
+++ b/include/linux/rculist.h
@@ -30,6 +30,7 @@
30 * This is only for internal list manipulation where we know 30 * This is only for internal list manipulation where we know
31 * the prev/next entries already! 31 * the prev/next entries already!
32 */ 32 */
33#ifndef CONFIG_DEBUG_LIST
33static inline void __list_add_rcu(struct list_head *new, 34static inline void __list_add_rcu(struct list_head *new,
34 struct list_head *prev, struct list_head *next) 35 struct list_head *prev, struct list_head *next)
35{ 36{
@@ -38,6 +39,10 @@ static inline void __list_add_rcu(struct list_head *new,
38 rcu_assign_pointer(list_next_rcu(prev), new); 39 rcu_assign_pointer(list_next_rcu(prev), new);
39 next->prev = new; 40 next->prev = new;
40} 41}
42#else
43extern void __list_add_rcu(struct list_head *new,
44 struct list_head *prev, struct list_head *next);
45#endif
41 46
42/** 47/**
43 * list_add_rcu - add a new entry to rcu-protected list 48 * list_add_rcu - add a new entry to rcu-protected list
@@ -108,7 +113,7 @@ static inline void list_add_tail_rcu(struct list_head *new,
108 */ 113 */
109static inline void list_del_rcu(struct list_head *entry) 114static inline void list_del_rcu(struct list_head *entry)
110{ 115{
111 __list_del(entry->prev, entry->next); 116 __list_del_entry(entry);
112 entry->prev = LIST_POISON2; 117 entry->prev = LIST_POISON2;
113} 118}
114 119
@@ -228,18 +233,43 @@ static inline void list_splice_init_rcu(struct list_head *list,
228 }) 233 })
229 234
230/** 235/**
231 * list_first_entry_rcu - get the first element from a list 236 * Where are list_empty_rcu() and list_first_entry_rcu()?
237 *
238 * Implementing those functions following their counterparts list_empty() and
239 * list_first_entry() is not advisable because they lead to subtle race
240 * conditions as the following snippet shows:
241 *
242 * if (!list_empty_rcu(mylist)) {
243 * struct foo *bar = list_first_entry_rcu(mylist, struct foo, list_member);
244 * do_something(bar);
245 * }
246 *
247 * The list may not be empty when list_empty_rcu checks it, but it may be when
248 * list_first_entry_rcu rereads the ->next pointer.
249 *
250 * Rereading the ->next pointer is not a problem for list_empty() and
251 * list_first_entry() because they would be protected by a lock that blocks
252 * writers.
253 *
254 * See list_first_or_null_rcu for an alternative.
255 */
256
257/**
258 * list_first_or_null_rcu - get the first element from a list
232 * @ptr: the list head to take the element from. 259 * @ptr: the list head to take the element from.
233 * @type: the type of the struct this is embedded in. 260 * @type: the type of the struct this is embedded in.
234 * @member: the name of the list_struct within the struct. 261 * @member: the name of the list_struct within the struct.
235 * 262 *
236 * Note, that list is expected to be not empty. 263 * Note that if the list is empty, it returns NULL.
237 * 264 *
238 * This primitive may safely run concurrently with the _rcu list-mutation 265 * This primitive may safely run concurrently with the _rcu list-mutation
239 * primitives such as list_add_rcu() as long as it's guarded by rcu_read_lock(). 266 * primitives such as list_add_rcu() as long as it's guarded by rcu_read_lock().
240 */ 267 */
241#define list_first_entry_rcu(ptr, type, member) \ 268#define list_first_or_null_rcu(ptr, type, member) \
242 list_entry_rcu((ptr)->next, type, member) 269 ({struct list_head *__ptr = (ptr); \
270 struct list_head __rcu *__next = list_next_rcu(__ptr); \
271 likely(__ptr != __next) ? container_of(__next, type, member) : NULL; \
272 })
243 273
244/** 274/**
245 * list_for_each_entry_rcu - iterate over rcu list of given type 275 * list_for_each_entry_rcu - iterate over rcu list of given type
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 20fb776a1d4a..26d1a47591f1 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -184,12 +184,14 @@ static inline int rcu_preempt_depth(void)
184/* Internal to kernel */ 184/* Internal to kernel */
185extern void rcu_sched_qs(int cpu); 185extern void rcu_sched_qs(int cpu);
186extern void rcu_bh_qs(int cpu); 186extern void rcu_bh_qs(int cpu);
187extern void rcu_preempt_note_context_switch(void);
187extern void rcu_check_callbacks(int cpu, int user); 188extern void rcu_check_callbacks(int cpu, int user);
188struct notifier_block; 189struct notifier_block;
189extern void rcu_idle_enter(void); 190extern void rcu_idle_enter(void);
190extern void rcu_idle_exit(void); 191extern void rcu_idle_exit(void);
191extern void rcu_irq_enter(void); 192extern void rcu_irq_enter(void);
192extern void rcu_irq_exit(void); 193extern void rcu_irq_exit(void);
194extern void exit_rcu(void);
193 195
194/** 196/**
195 * RCU_NONIDLE - Indicate idle-loop code that needs RCU readers 197 * RCU_NONIDLE - Indicate idle-loop code that needs RCU readers
@@ -922,6 +924,21 @@ void __kfree_rcu(struct rcu_head *head, unsigned long offset)
922 kfree_call_rcu(head, (rcu_callback)offset); 924 kfree_call_rcu(head, (rcu_callback)offset);
923} 925}
924 926
927/*
928 * Does the specified offset indicate that the corresponding rcu_head
929 * structure can be handled by kfree_rcu()?
930 */
931#define __is_kfree_rcu_offset(offset) ((offset) < 4096)
932
933/*
934 * Helper macro for kfree_rcu() to prevent argument-expansion eyestrain.
935 */
936#define __kfree_rcu(head, offset) \
937 do { \
938 BUILD_BUG_ON(!__is_kfree_rcu_offset(offset)); \
939 call_rcu(head, (void (*)(struct rcu_head *))(unsigned long)(offset)); \
940 } while (0)
941
925/** 942/**
926 * kfree_rcu() - kfree an object after a grace period. 943 * kfree_rcu() - kfree an object after a grace period.
927 * @ptr: pointer to kfree 944 * @ptr: pointer to kfree
@@ -944,6 +961,9 @@ void __kfree_rcu(struct rcu_head *head, unsigned long offset)
944 * 961 *
945 * Note that the allowable offset might decrease in the future, for example, 962 * Note that the allowable offset might decrease in the future, for example,
946 * to allow something like kmem_cache_free_rcu(). 963 * to allow something like kmem_cache_free_rcu().
964 *
965 * The BUILD_BUG_ON check must not involve any function calls, hence the
966 * checks are done in macros here.
947 */ 967 */
948#define kfree_rcu(ptr, rcu_head) \ 968#define kfree_rcu(ptr, rcu_head) \
949 __kfree_rcu(&((ptr)->rcu_head), offsetof(typeof(*(ptr)), rcu_head)) 969 __kfree_rcu(&((ptr)->rcu_head), offsetof(typeof(*(ptr)), rcu_head))
diff --git a/include/linux/rcutiny.h b/include/linux/rcutiny.h
index e93df77176d1..adb5e5a38cae 100644
--- a/include/linux/rcutiny.h
+++ b/include/linux/rcutiny.h
@@ -87,14 +87,6 @@ static inline void kfree_call_rcu(struct rcu_head *head,
87 87
88#ifdef CONFIG_TINY_RCU 88#ifdef CONFIG_TINY_RCU
89 89
90static inline void rcu_preempt_note_context_switch(void)
91{
92}
93
94static inline void exit_rcu(void)
95{
96}
97
98static inline int rcu_needs_cpu(int cpu) 90static inline int rcu_needs_cpu(int cpu)
99{ 91{
100 return 0; 92 return 0;
@@ -102,8 +94,6 @@ static inline int rcu_needs_cpu(int cpu)
102 94
103#else /* #ifdef CONFIG_TINY_RCU */ 95#else /* #ifdef CONFIG_TINY_RCU */
104 96
105void rcu_preempt_note_context_switch(void);
106extern void exit_rcu(void);
107int rcu_preempt_needs_cpu(void); 97int rcu_preempt_needs_cpu(void);
108 98
109static inline int rcu_needs_cpu(int cpu) 99static inline int rcu_needs_cpu(int cpu)
@@ -116,7 +106,6 @@ static inline int rcu_needs_cpu(int cpu)
116static inline void rcu_note_context_switch(int cpu) 106static inline void rcu_note_context_switch(int cpu)
117{ 107{
118 rcu_sched_qs(cpu); 108 rcu_sched_qs(cpu);
119 rcu_preempt_note_context_switch();
120} 109}
121 110
122/* 111/*
diff --git a/include/linux/rcutree.h b/include/linux/rcutree.h
index e8ee5dd0854c..3c6083cde4fc 100644
--- a/include/linux/rcutree.h
+++ b/include/linux/rcutree.h
@@ -45,18 +45,6 @@ static inline void rcu_virt_note_context_switch(int cpu)
45 rcu_note_context_switch(cpu); 45 rcu_note_context_switch(cpu);
46} 46}
47 47
48#ifdef CONFIG_TREE_PREEMPT_RCU
49
50extern void exit_rcu(void);
51
52#else /* #ifdef CONFIG_TREE_PREEMPT_RCU */
53
54static inline void exit_rcu(void)
55{
56}
57
58#endif /* #else #ifdef CONFIG_TREE_PREEMPT_RCU */
59
60extern void synchronize_rcu_bh(void); 48extern void synchronize_rcu_bh(void);
61extern void synchronize_sched_expedited(void); 49extern void synchronize_sched_expedited(void);
62extern void synchronize_rcu_expedited(void); 50extern void synchronize_rcu_expedited(void);
@@ -98,13 +86,6 @@ extern void rcu_force_quiescent_state(void);
98extern void rcu_bh_force_quiescent_state(void); 86extern void rcu_bh_force_quiescent_state(void);
99extern void rcu_sched_force_quiescent_state(void); 87extern void rcu_sched_force_quiescent_state(void);
100 88
101/* A context switch is a grace period for RCU-sched and RCU-bh. */
102static inline int rcu_blocking_is_gp(void)
103{
104 might_sleep(); /* Check for RCU read-side critical section. */
105 return num_online_cpus() == 1;
106}
107
108extern void rcu_scheduler_starting(void); 89extern void rcu_scheduler_starting(void);
109extern int rcu_scheduler_active __read_mostly; 90extern int rcu_scheduler_active __read_mostly;
110 91
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index a90abb6bfa64..56af22ec9aba 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -46,7 +46,13 @@ struct reg_default {
46/** 46/**
47 * Configuration for the register map of a device. 47 * Configuration for the register map of a device.
48 * 48 *
49 * @name: Optional name of the regmap. Useful when a device has multiple
50 * register regions.
51 *
49 * @reg_bits: Number of bits in a register address, mandatory. 52 * @reg_bits: Number of bits in a register address, mandatory.
53 * @reg_stride: The register address stride. Valid register addresses are a
54 * multiple of this value. If set to 0, a value of 1 will be
55 * used.
50 * @pad_bits: Number of bits of padding between register and value. 56 * @pad_bits: Number of bits of padding between register and value.
51 * @val_bits: Number of bits in a register value, mandatory. 57 * @val_bits: Number of bits in a register value, mandatory.
52 * 58 *
@@ -70,6 +76,9 @@ struct reg_default {
70 * @write_flag_mask: Mask to be set in the top byte of the register when doing 76 * @write_flag_mask: Mask to be set in the top byte of the register when doing
71 * a write. If both read_flag_mask and write_flag_mask are 77 * a write. If both read_flag_mask and write_flag_mask are
72 * empty the regmap_bus default masks are used. 78 * empty the regmap_bus default masks are used.
79 * @use_single_rw: If set, converts the bulk read and write operations into
80 * a series of single read and write operations. This is useful
81 * for device that does not support bulk read and write.
73 * 82 *
74 * @cache_type: The actual cache type. 83 * @cache_type: The actual cache type.
75 * @reg_defaults_raw: Power on reset values for registers (for use with 84 * @reg_defaults_raw: Power on reset values for registers (for use with
@@ -77,7 +86,10 @@ struct reg_default {
77 * @num_reg_defaults_raw: Number of elements in reg_defaults_raw. 86 * @num_reg_defaults_raw: Number of elements in reg_defaults_raw.
78 */ 87 */
79struct regmap_config { 88struct regmap_config {
89 const char *name;
90
80 int reg_bits; 91 int reg_bits;
92 int reg_stride;
81 int pad_bits; 93 int pad_bits;
82 int val_bits; 94 int val_bits;
83 95
@@ -95,20 +107,25 @@ struct regmap_config {
95 107
96 u8 read_flag_mask; 108 u8 read_flag_mask;
97 u8 write_flag_mask; 109 u8 write_flag_mask;
110
111 bool use_single_rw;
98}; 112};
99 113
100typedef int (*regmap_hw_write)(struct device *dev, const void *data, 114typedef int (*regmap_hw_write)(void *context, const void *data,
101 size_t count); 115 size_t count);
102typedef int (*regmap_hw_gather_write)(struct device *dev, 116typedef int (*regmap_hw_gather_write)(void *context,
103 const void *reg, size_t reg_len, 117 const void *reg, size_t reg_len,
104 const void *val, size_t val_len); 118 const void *val, size_t val_len);
105typedef int (*regmap_hw_read)(struct device *dev, 119typedef int (*regmap_hw_read)(void *context,
106 const void *reg_buf, size_t reg_size, 120 const void *reg_buf, size_t reg_size,
107 void *val_buf, size_t val_size); 121 void *val_buf, size_t val_size);
122typedef void (*regmap_hw_free_context)(void *context);
108 123
109/** 124/**
110 * Description of a hardware bus for the register map infrastructure. 125 * Description of a hardware bus for the register map infrastructure.
111 * 126 *
127 * @fast_io: Register IO is fast. Use a spinlock instead of a mutex
128 * to perform locking.
112 * @write: Write operation. 129 * @write: Write operation.
113 * @gather_write: Write operation with split register/value, return -ENOTSUPP 130 * @gather_write: Write operation with split register/value, return -ENOTSUPP
114 * if not implemented on a given device. 131 * if not implemented on a given device.
@@ -118,31 +135,42 @@ typedef int (*regmap_hw_read)(struct device *dev,
118 * a read. 135 * a read.
119 */ 136 */
120struct regmap_bus { 137struct regmap_bus {
138 bool fast_io;
121 regmap_hw_write write; 139 regmap_hw_write write;
122 regmap_hw_gather_write gather_write; 140 regmap_hw_gather_write gather_write;
123 regmap_hw_read read; 141 regmap_hw_read read;
142 regmap_hw_free_context free_context;
124 u8 read_flag_mask; 143 u8 read_flag_mask;
125}; 144};
126 145
127struct regmap *regmap_init(struct device *dev, 146struct regmap *regmap_init(struct device *dev,
128 const struct regmap_bus *bus, 147 const struct regmap_bus *bus,
148 void *bus_context,
129 const struct regmap_config *config); 149 const struct regmap_config *config);
130struct regmap *regmap_init_i2c(struct i2c_client *i2c, 150struct regmap *regmap_init_i2c(struct i2c_client *i2c,
131 const struct regmap_config *config); 151 const struct regmap_config *config);
132struct regmap *regmap_init_spi(struct spi_device *dev, 152struct regmap *regmap_init_spi(struct spi_device *dev,
133 const struct regmap_config *config); 153 const struct regmap_config *config);
154struct regmap *regmap_init_mmio(struct device *dev,
155 void __iomem *regs,
156 const struct regmap_config *config);
134 157
135struct regmap *devm_regmap_init(struct device *dev, 158struct regmap *devm_regmap_init(struct device *dev,
136 const struct regmap_bus *bus, 159 const struct regmap_bus *bus,
160 void *bus_context,
137 const struct regmap_config *config); 161 const struct regmap_config *config);
138struct regmap *devm_regmap_init_i2c(struct i2c_client *i2c, 162struct regmap *devm_regmap_init_i2c(struct i2c_client *i2c,
139 const struct regmap_config *config); 163 const struct regmap_config *config);
140struct regmap *devm_regmap_init_spi(struct spi_device *dev, 164struct regmap *devm_regmap_init_spi(struct spi_device *dev,
141 const struct regmap_config *config); 165 const struct regmap_config *config);
166struct regmap *devm_regmap_init_mmio(struct device *dev,
167 void __iomem *regs,
168 const struct regmap_config *config);
142 169
143void regmap_exit(struct regmap *map); 170void regmap_exit(struct regmap *map);
144int regmap_reinit_cache(struct regmap *map, 171int regmap_reinit_cache(struct regmap *map,
145 const struct regmap_config *config); 172 const struct regmap_config *config);
173struct regmap *dev_get_regmap(struct device *dev, const char *name);
146int regmap_write(struct regmap *map, unsigned int reg, unsigned int val); 174int regmap_write(struct regmap *map, unsigned int reg, unsigned int val);
147int regmap_raw_write(struct regmap *map, unsigned int reg, 175int regmap_raw_write(struct regmap *map, unsigned int reg,
148 const void *val, size_t val_len); 176 const void *val, size_t val_len);
@@ -191,6 +219,7 @@ struct regmap_irq {
191 * @status_base: Base status register address. 219 * @status_base: Base status register address.
192 * @mask_base: Base mask register address. 220 * @mask_base: Base mask register address.
193 * @ack_base: Base ack address. If zero then the chip is clear on read. 221 * @ack_base: Base ack address. If zero then the chip is clear on read.
222 * @irq_reg_stride: Stride to use for chips where registers are not contiguous.
194 * 223 *
195 * @num_regs: Number of registers in each control bank. 224 * @num_regs: Number of registers in each control bank.
196 * @irqs: Descriptors for individual IRQs. Interrupt numbers are 225 * @irqs: Descriptors for individual IRQs. Interrupt numbers are
@@ -203,6 +232,7 @@ struct regmap_irq_chip {
203 unsigned int status_base; 232 unsigned int status_base;
204 unsigned int mask_base; 233 unsigned int mask_base;
205 unsigned int ack_base; 234 unsigned int ack_base;
235 unsigned int irq_reg_stride;
206 236
207 int num_regs; 237 int num_regs;
208 238
@@ -217,6 +247,7 @@ int regmap_add_irq_chip(struct regmap *map, int irq, int irq_flags,
217 struct regmap_irq_chip_data **data); 247 struct regmap_irq_chip_data **data);
218void regmap_del_irq_chip(int irq, struct regmap_irq_chip_data *data); 248void regmap_del_irq_chip(int irq, struct regmap_irq_chip_data *data);
219int regmap_irq_chip_get_base(struct regmap_irq_chip_data *data); 249int regmap_irq_chip_get_base(struct regmap_irq_chip_data *data);
250int regmap_irq_get_virq(struct regmap_irq_chip_data *data, int irq);
220 251
221#else 252#else
222 253
@@ -327,6 +358,13 @@ static inline int regmap_register_patch(struct regmap *map,
327 return -EINVAL; 358 return -EINVAL;
328} 359}
329 360
361static inline struct regmap *dev_get_regmap(struct device *dev,
362 const char *name)
363{
364 WARN_ONCE(1, "regmap API is disabled");
365 return NULL;
366}
367
330#endif 368#endif
331 369
332#endif 370#endif
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
index fa8b55b8191c..b0432cc2b169 100644
--- a/include/linux/regulator/driver.h
+++ b/include/linux/regulator/driver.h
@@ -19,6 +19,7 @@
19#include <linux/notifier.h> 19#include <linux/notifier.h>
20#include <linux/regulator/consumer.h> 20#include <linux/regulator/consumer.h>
21 21
22struct regmap;
22struct regulator_dev; 23struct regulator_dev;
23struct regulator_init_data; 24struct regulator_init_data;
24 25
@@ -45,6 +46,7 @@ enum regulator_status {
45 * The driver should select the voltage closest to min_uV. 46 * The driver should select the voltage closest to min_uV.
46 * @set_voltage_sel: Set the voltage for the regulator using the specified 47 * @set_voltage_sel: Set the voltage for the regulator using the specified
47 * selector. 48 * selector.
49 * @map_voltage: Convert a voltage into a selector
48 * @get_voltage: Return the currently configured voltage for the regulator. 50 * @get_voltage: Return the currently configured voltage for the regulator.
49 * @get_voltage_sel: Return the currently configured voltage selector for the 51 * @get_voltage_sel: Return the currently configured voltage selector for the
50 * regulator. 52 * regulator.
@@ -90,6 +92,7 @@ struct regulator_ops {
90 /* get/set regulator voltage */ 92 /* get/set regulator voltage */
91 int (*set_voltage) (struct regulator_dev *, int min_uV, int max_uV, 93 int (*set_voltage) (struct regulator_dev *, int min_uV, int max_uV,
92 unsigned *selector); 94 unsigned *selector);
95 int (*map_voltage)(struct regulator_dev *, int min_uV, int max_uV);
93 int (*set_voltage_sel) (struct regulator_dev *, unsigned selector); 96 int (*set_voltage_sel) (struct regulator_dev *, unsigned selector);
94 int (*get_voltage) (struct regulator_dev *); 97 int (*get_voltage) (struct regulator_dev *);
95 int (*get_voltage_sel) (struct regulator_dev *); 98 int (*get_voltage_sel) (struct regulator_dev *);
@@ -148,19 +151,30 @@ enum regulator_type {
148}; 151};
149 152
150/** 153/**
151 * struct regulator_desc - Regulator descriptor 154 * struct regulator_desc - Static regulator descriptor
152 * 155 *
153 * Each regulator registered with the core is described with a structure of 156 * Each regulator registered with the core is described with a
154 * this type. 157 * structure of this type and a struct regulator_config. This
158 * structure contains the non-varying parts of the regulator
159 * description.
155 * 160 *
156 * @name: Identifying name for the regulator. 161 * @name: Identifying name for the regulator.
157 * @supply_name: Identifying the regulator supply 162 * @supply_name: Identifying the regulator supply
158 * @id: Numerical identifier for the regulator. 163 * @id: Numerical identifier for the regulator.
159 * @n_voltages: Number of selectors available for ops.list_voltage().
160 * @ops: Regulator operations table. 164 * @ops: Regulator operations table.
161 * @irq: Interrupt number for the regulator. 165 * @irq: Interrupt number for the regulator.
162 * @type: Indicates if the regulator is a voltage or current regulator. 166 * @type: Indicates if the regulator is a voltage or current regulator.
163 * @owner: Module providing the regulator, used for refcounting. 167 * @owner: Module providing the regulator, used for refcounting.
168 *
169 * @n_voltages: Number of selectors available for ops.list_voltage().
170 *
171 * @min_uV: Voltage given by the lowest selector (if linear mapping)
172 * @uV_step: Voltage increase with each selector (if linear mapping)
173 *
174 * @vsel_reg: Register for selector when using regulator_regmap_X_voltage_
175 * @vsel_mask: Mask for register bitfield used for selector
176 * @enable_reg: Register for control when using regmap enable/disable ops
177 * @enable_mask: Mask for control when using regmap enable/disable ops
164 */ 178 */
165struct regulator_desc { 179struct regulator_desc {
166 const char *name; 180 const char *name;
@@ -171,6 +185,36 @@ struct regulator_desc {
171 int irq; 185 int irq;
172 enum regulator_type type; 186 enum regulator_type type;
173 struct module *owner; 187 struct module *owner;
188
189 unsigned int min_uV;
190 unsigned int uV_step;
191
192 unsigned int vsel_reg;
193 unsigned int vsel_mask;
194 unsigned int enable_reg;
195 unsigned int enable_mask;
196};
197
198/**
199 * struct regulator_config - Dynamic regulator descriptor
200 *
201 * Each regulator registered with the core is described with a
202 * structure of this type and a struct regulator_desc. This structure
203 * contains the runtime variable parts of the regulator description.
204 *
205 * @dev: struct device for the regulator
206 * @init_data: platform provided init data, passed through by driver
207 * @driver_data: private regulator data
208 * @of_node: OpenFirmware node to parse for device tree bindings (may be
209 * NULL).
210 * @regmap: regmap to use for core regmap helpers
211 */
212struct regulator_config {
213 struct device *dev;
214 const struct regulator_init_data *init_data;
215 void *driver_data;
216 struct device_node *of_node;
217 struct regmap *regmap;
174}; 218};
175 219
176/* 220/*
@@ -184,7 +228,7 @@ struct regulator_desc {
184 * no other direct access). 228 * no other direct access).
185 */ 229 */
186struct regulator_dev { 230struct regulator_dev {
187 struct regulator_desc *desc; 231 const struct regulator_desc *desc;
188 int exclusive; 232 int exclusive;
189 u32 use_count; 233 u32 use_count;
190 u32 open_count; 234 u32 open_count;
@@ -201,6 +245,7 @@ struct regulator_dev {
201 struct device dev; 245 struct device dev;
202 struct regulation_constraints *constraints; 246 struct regulation_constraints *constraints;
203 struct regulator *supply; /* for tree */ 247 struct regulator *supply; /* for tree */
248 struct regmap *regmap;
204 249
205 struct delayed_work disable_work; 250 struct delayed_work disable_work;
206 int deferred_disables; 251 int deferred_disables;
@@ -210,9 +255,9 @@ struct regulator_dev {
210 struct dentry *debugfs; 255 struct dentry *debugfs;
211}; 256};
212 257
213struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc, 258struct regulator_dev *
214 struct device *dev, const struct regulator_init_data *init_data, 259regulator_register(const struct regulator_desc *regulator_desc,
215 void *driver_data, struct device_node *of_node); 260 const struct regulator_config *config);
216void regulator_unregister(struct regulator_dev *rdev); 261void regulator_unregister(struct regulator_dev *rdev);
217 262
218int regulator_notifier_call_chain(struct regulator_dev *rdev, 263int regulator_notifier_call_chain(struct regulator_dev *rdev,
@@ -224,6 +269,18 @@ int rdev_get_id(struct regulator_dev *rdev);
224 269
225int regulator_mode_to_status(unsigned int); 270int regulator_mode_to_status(unsigned int);
226 271
272int regulator_list_voltage_linear(struct regulator_dev *rdev,
273 unsigned int selector);
274int regulator_map_voltage_linear(struct regulator_dev *rdev,
275 int min_uV, int max_uV);
276int regulator_map_voltage_iterate(struct regulator_dev *rdev,
277 int min_uV, int max_uV);
278int regulator_get_voltage_sel_regmap(struct regulator_dev *rdev);
279int regulator_set_voltage_sel_regmap(struct regulator_dev *rdev, unsigned sel);
280int regulator_is_enabled_regmap(struct regulator_dev *rdev);
281int regulator_enable_regmap(struct regulator_dev *rdev);
282int regulator_disable_regmap(struct regulator_dev *rdev);
283
227void *regulator_get_init_drvdata(struct regulator_init_data *reg_init_data); 284void *regulator_get_init_drvdata(struct regulator_init_data *reg_init_data);
228 285
229#endif 286#endif
diff --git a/include/linux/regulator/fixed.h b/include/linux/regulator/fixed.h
index 936a7d8c11a9..f83f7440b488 100644
--- a/include/linux/regulator/fixed.h
+++ b/include/linux/regulator/fixed.h
@@ -26,6 +26,12 @@ struct regulator_init_data;
26 * @gpio: GPIO to use for enable control 26 * @gpio: GPIO to use for enable control
27 * set to -EINVAL if not used 27 * set to -EINVAL if not used
28 * @startup_delay: Start-up time in microseconds 28 * @startup_delay: Start-up time in microseconds
29 * @gpio_is_open_drain: Gpio pin is open drain or normal type.
30 * If it is open drain type then HIGH will be set
31 * through PULL-UP with setting gpio as input
32 * and low will be set as gpio-output with driven
33 * to low. For non-open-drain case, the gpio will
34 * will be in output and drive to low/high accordingly.
29 * @enable_high: Polarity of enable GPIO 35 * @enable_high: Polarity of enable GPIO
30 * 1 = Active high, 0 = Active low 36 * 1 = Active high, 0 = Active low
31 * @enabled_at_boot: Whether regulator has been enabled at 37 * @enabled_at_boot: Whether regulator has been enabled at
@@ -43,6 +49,7 @@ struct fixed_voltage_config {
43 int microvolts; 49 int microvolts;
44 int gpio; 50 int gpio;
45 unsigned startup_delay; 51 unsigned startup_delay;
52 unsigned gpio_is_open_drain:1;
46 unsigned enable_high:1; 53 unsigned enable_high:1;
47 unsigned enabled_at_boot:1; 54 unsigned enabled_at_boot:1;
48 struct regulator_init_data *init_data; 55 struct regulator_init_data *init_data;
diff --git a/include/linux/regulator/of_regulator.h b/include/linux/regulator/of_regulator.h
index 769704f296e5..f9217965aaa3 100644
--- a/include/linux/regulator/of_regulator.h
+++ b/include/linux/regulator/of_regulator.h
@@ -6,10 +6,20 @@
6#ifndef __LINUX_OF_REG_H 6#ifndef __LINUX_OF_REG_H
7#define __LINUX_OF_REG_H 7#define __LINUX_OF_REG_H
8 8
9struct of_regulator_match {
10 const char *name;
11 void *driver_data;
12 struct regulator_init_data *init_data;
13 struct device_node *of_node;
14};
15
9#if defined(CONFIG_OF) 16#if defined(CONFIG_OF)
10extern struct regulator_init_data 17extern struct regulator_init_data
11 *of_get_regulator_init_data(struct device *dev, 18 *of_get_regulator_init_data(struct device *dev,
12 struct device_node *node); 19 struct device_node *node);
20extern int of_regulator_match(struct device *dev, struct device_node *node,
21 struct of_regulator_match *matches,
22 unsigned int num_matches);
13#else 23#else
14static inline struct regulator_init_data 24static inline struct regulator_init_data
15 *of_get_regulator_init_data(struct device *dev, 25 *of_get_regulator_init_data(struct device *dev,
@@ -17,6 +27,14 @@ static inline struct regulator_init_data
17{ 27{
18 return NULL; 28 return NULL;
19} 29}
30
31static inline int of_regulator_match(struct device *dev,
32 struct device_node *node,
33 struct of_regulator_match *matches,
34 unsigned int num_matches)
35{
36 return 0;
37}
20#endif /* CONFIG_OF */ 38#endif /* CONFIG_OF */
21 39
22#endif /* __LINUX_OF_REG_H */ 40#endif /* __LINUX_OF_REG_H */
diff --git a/include/linux/regulator/tps62360.h b/include/linux/regulator/tps62360.h
index 6a5c1b2c751e..a4c49394c497 100644
--- a/include/linux/regulator/tps62360.h
+++ b/include/linux/regulator/tps62360.h
@@ -26,13 +26,10 @@
26#ifndef __LINUX_REGULATOR_TPS62360_H 26#ifndef __LINUX_REGULATOR_TPS62360_H
27#define __LINUX_REGULATOR_TPS62360_H 27#define __LINUX_REGULATOR_TPS62360_H
28 28
29#include <linux/regulator/machine.h>
30
31/* 29/*
32 * struct tps62360_regulator_platform_data - tps62360 regulator platform data. 30 * struct tps62360_regulator_platform_data - tps62360 regulator platform data.
33 * 31 *
34 * @reg_init_data: The regulator init data. 32 * @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 33 * @en_discharge: Enable discharge the output capacitor via internal
37 * register. 34 * register.
38 * @en_internal_pulldn: internal pull down enable or not. 35 * @en_internal_pulldn: internal pull down enable or not.
@@ -44,8 +41,7 @@
44 * @vsel1_def_state: Default state of vsel1. 1 if it is high else 0. 41 * @vsel1_def_state: Default state of vsel1. 1 if it is high else 0.
45 */ 42 */
46struct tps62360_regulator_platform_data { 43struct tps62360_regulator_platform_data {
47 struct regulator_init_data reg_init_data; 44 struct regulator_init_data *reg_init_data;
48 bool en_force_pwm;
49 bool en_discharge; 45 bool en_discharge;
50 bool en_internal_pulldn; 46 bool en_internal_pulldn;
51 int vsel0_gpio; 47 int vsel0_gpio;
diff --git a/include/linux/regulator/tps65090-regulator.h b/include/linux/regulator/tps65090-regulator.h
new file mode 100644
index 000000000000..0fa04b64db3e
--- /dev/null
+++ b/include/linux/regulator/tps65090-regulator.h
@@ -0,0 +1,50 @@
1/*
2 * Regulator driver interface for TI TPS65090 PMIC family
3 *
4 * Copyright (c) 2012, 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
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#ifndef __REGULATOR_TPS65090_H
20#define __REGULATOR_TPS65090_H
21
22#include <linux/regulator/machine.h>
23
24#define tps65090_rails(_name) "tps65090_"#_name
25
26enum {
27 TPS65090_ID_DCDC1,
28 TPS65090_ID_DCDC2,
29 TPS65090_ID_DCDC3,
30 TPS65090_ID_FET1,
31 TPS65090_ID_FET2,
32 TPS65090_ID_FET3,
33 TPS65090_ID_FET4,
34 TPS65090_ID_FET5,
35 TPS65090_ID_FET6,
36 TPS65090_ID_FET7,
37};
38
39/*
40 * struct tps65090_regulator_platform_data
41 *
42 * @regulator: The regulator init data.
43 * @slew_rate_uV_per_us: Slew rate microvolt per microsec.
44 */
45
46struct tps65090_regulator_platform_data {
47 struct regulator_init_data regulator;
48};
49
50#endif /* __REGULATOR_TPS65090_H */
diff --git a/include/linux/res_counter.h b/include/linux/res_counter.h
index da81af086eaf..fb201896a8b0 100644
--- a/include/linux/res_counter.h
+++ b/include/linux/res_counter.h
@@ -116,7 +116,7 @@ void res_counter_init(struct res_counter *counter, struct res_counter *parent);
116 */ 116 */
117 117
118int __must_check res_counter_charge_locked(struct res_counter *counter, 118int __must_check res_counter_charge_locked(struct res_counter *counter,
119 unsigned long val); 119 unsigned long val, bool force);
120int __must_check res_counter_charge(struct res_counter *counter, 120int __must_check res_counter_charge(struct res_counter *counter,
121 unsigned long val, struct res_counter **limit_fail_at); 121 unsigned long val, struct res_counter **limit_fail_at);
122int __must_check res_counter_charge_nofail(struct res_counter *counter, 122int __must_check res_counter_charge_nofail(struct res_counter *counter,
diff --git a/include/linux/ring_buffer.h b/include/linux/ring_buffer.h
index 7be2e88f23fd..6c8835f74f79 100644
--- a/include/linux/ring_buffer.h
+++ b/include/linux/ring_buffer.h
@@ -96,9 +96,11 @@ __ring_buffer_alloc(unsigned long size, unsigned flags, struct lock_class_key *k
96 __ring_buffer_alloc((size), (flags), &__key); \ 96 __ring_buffer_alloc((size), (flags), &__key); \
97}) 97})
98 98
99#define RING_BUFFER_ALL_CPUS -1
100
99void ring_buffer_free(struct ring_buffer *buffer); 101void ring_buffer_free(struct ring_buffer *buffer);
100 102
101int ring_buffer_resize(struct ring_buffer *buffer, unsigned long size); 103int ring_buffer_resize(struct ring_buffer *buffer, unsigned long size, int cpu);
102 104
103void ring_buffer_change_overwrite(struct ring_buffer *buffer, int val); 105void ring_buffer_change_overwrite(struct ring_buffer *buffer, int val);
104 106
@@ -129,7 +131,7 @@ ring_buffer_read(struct ring_buffer_iter *iter, u64 *ts);
129void ring_buffer_iter_reset(struct ring_buffer_iter *iter); 131void ring_buffer_iter_reset(struct ring_buffer_iter *iter);
130int ring_buffer_iter_empty(struct ring_buffer_iter *iter); 132int ring_buffer_iter_empty(struct ring_buffer_iter *iter);
131 133
132unsigned long ring_buffer_size(struct ring_buffer *buffer); 134unsigned long ring_buffer_size(struct ring_buffer *buffer, int cpu);
133 135
134void ring_buffer_reset_cpu(struct ring_buffer *buffer, int cpu); 136void ring_buffer_reset_cpu(struct ring_buffer *buffer, int cpu);
135void ring_buffer_reset(struct ring_buffer *buffer); 137void ring_buffer_reset(struct ring_buffer *buffer);
diff --git a/include/linux/rndis.h b/include/linux/rndis.h
new file mode 100644
index 000000000000..0c8dc7195cdb
--- /dev/null
+++ b/include/linux/rndis.h
@@ -0,0 +1,390 @@
1/*
2 * Remote Network Driver Interface Specification (RNDIS)
3 * definitions of the magic numbers used by this protocol
4 */
5
6/* Remote NDIS Versions */
7#define RNDIS_MAJOR_VERSION 0x00000001
8#define RNDIS_MINOR_VERSION 0x00000000
9
10/* Device Flags */
11#define RNDIS_DF_CONNECTIONLESS 0x00000001U
12#define RNDIS_DF_CONNECTION_ORIENTED 0x00000002U
13#define RNDIS_DF_RAW_DATA 0x00000004U
14
15/*
16 * Codes for "msg_type" field of rndis messages;
17 * only the data channel uses packet messages (maybe batched);
18 * everything else goes on the control channel.
19 */
20#define RNDIS_MSG_COMPLETION 0x80000000
21#define RNDIS_MSG_PACKET 0x00000001 /* 1-N packets */
22#define RNDIS_MSG_INIT 0x00000002
23#define RNDIS_MSG_INIT_C (RNDIS_MSG_INIT|RNDIS_MSG_COMPLETION)
24#define RNDIS_MSG_HALT 0x00000003
25#define RNDIS_MSG_QUERY 0x00000004
26#define RNDIS_MSG_QUERY_C (RNDIS_MSG_QUERY|RNDIS_MSG_COMPLETION)
27#define RNDIS_MSG_SET 0x00000005
28#define RNDIS_MSG_SET_C (RNDIS_MSG_SET|RNDIS_MSG_COMPLETION)
29#define RNDIS_MSG_RESET 0x00000006
30#define RNDIS_MSG_RESET_C (RNDIS_MSG_RESET|RNDIS_MSG_COMPLETION)
31#define RNDIS_MSG_INDICATE 0x00000007
32#define RNDIS_MSG_KEEPALIVE 0x00000008
33#define RNDIS_MSG_KEEPALIVE_C (RNDIS_MSG_KEEPALIVE|RNDIS_MSG_COMPLETION)
34/*
35 * Reserved message type for private communication between lower-layer host
36 * driver and remote device, if necessary.
37 */
38#define RNDIS_MSG_BUS 0xff000001
39
40/* codes for "status" field of completion messages */
41#define RNDIS_STATUS_SUCCESS 0x00000000
42#define RNDIS_STATUS_PENDING 0x00000103
43
44/* Status codes */
45#define RNDIS_STATUS_NOT_RECOGNIZED 0x00010001
46#define RNDIS_STATUS_NOT_COPIED 0x00010002
47#define RNDIS_STATUS_NOT_ACCEPTED 0x00010003
48#define RNDIS_STATUS_CALL_ACTIVE 0x00010007
49
50#define RNDIS_STATUS_ONLINE 0x40010003
51#define RNDIS_STATUS_RESET_START 0x40010004
52#define RNDIS_STATUS_RESET_END 0x40010005
53#define RNDIS_STATUS_RING_STATUS 0x40010006
54#define RNDIS_STATUS_CLOSED 0x40010007
55#define RNDIS_STATUS_WAN_LINE_UP 0x40010008
56#define RNDIS_STATUS_WAN_LINE_DOWN 0x40010009
57#define RNDIS_STATUS_WAN_FRAGMENT 0x4001000A
58#define RNDIS_STATUS_MEDIA_CONNECT 0x4001000B
59#define RNDIS_STATUS_MEDIA_DISCONNECT 0x4001000C
60#define RNDIS_STATUS_HARDWARE_LINE_UP 0x4001000D
61#define RNDIS_STATUS_HARDWARE_LINE_DOWN 0x4001000E
62#define RNDIS_STATUS_INTERFACE_UP 0x4001000F
63#define RNDIS_STATUS_INTERFACE_DOWN 0x40010010
64#define RNDIS_STATUS_MEDIA_BUSY 0x40010011
65#define RNDIS_STATUS_MEDIA_SPECIFIC_INDICATION 0x40010012
66#define RNDIS_STATUS_WW_INDICATION RDIA_SPECIFIC_INDICATION
67#define RNDIS_STATUS_LINK_SPEED_CHANGE 0x40010013L
68
69#define RNDIS_STATUS_NOT_RESETTABLE 0x80010001
70#define RNDIS_STATUS_SOFT_ERRORS 0x80010003
71#define RNDIS_STATUS_HARD_ERRORS 0x80010004
72#define RNDIS_STATUS_BUFFER_OVERFLOW 0x80000005
73
74#define RNDIS_STATUS_FAILURE 0xC0000001
75#define RNDIS_STATUS_RESOURCES 0xC000009A
76#define RNDIS_STATUS_NOT_SUPPORTED 0xc00000BB
77#define RNDIS_STATUS_CLOSING 0xC0010002
78#define RNDIS_STATUS_BAD_VERSION 0xC0010004
79#define RNDIS_STATUS_BAD_CHARACTERISTICS 0xC0010005
80#define RNDIS_STATUS_ADAPTER_NOT_FOUND 0xC0010006
81#define RNDIS_STATUS_OPEN_FAILED 0xC0010007
82#define RNDIS_STATUS_DEVICE_FAILED 0xC0010008
83#define RNDIS_STATUS_MULTICAST_FULL 0xC0010009
84#define RNDIS_STATUS_MULTICAST_EXISTS 0xC001000A
85#define RNDIS_STATUS_MULTICAST_NOT_FOUND 0xC001000B
86#define RNDIS_STATUS_REQUEST_ABORTED 0xC001000C
87#define RNDIS_STATUS_RESET_IN_PROGRESS 0xC001000D
88#define RNDIS_STATUS_CLOSING_INDICATING 0xC001000E
89#define RNDIS_STATUS_INVALID_PACKET 0xC001000F
90#define RNDIS_STATUS_OPEN_LIST_FULL 0xC0010010
91#define RNDIS_STATUS_ADAPTER_NOT_READY 0xC0010011
92#define RNDIS_STATUS_ADAPTER_NOT_OPEN 0xC0010012
93#define RNDIS_STATUS_NOT_INDICATING 0xC0010013
94#define RNDIS_STATUS_INVALID_LENGTH 0xC0010014
95#define RNDIS_STATUS_INVALID_DATA 0xC0010015
96#define RNDIS_STATUS_BUFFER_TOO_SHORT 0xC0010016
97#define RNDIS_STATUS_INVALID_OID 0xC0010017
98#define RNDIS_STATUS_ADAPTER_REMOVED 0xC0010018
99#define RNDIS_STATUS_UNSUPPORTED_MEDIA 0xC0010019
100#define RNDIS_STATUS_GROUP_ADDRESS_IN_USE 0xC001001A
101#define RNDIS_STATUS_FILE_NOT_FOUND 0xC001001B
102#define RNDIS_STATUS_ERROR_READING_FILE 0xC001001C
103#define RNDIS_STATUS_ALREADY_MAPPED 0xC001001D
104#define RNDIS_STATUS_RESOURCE_CONFLICT 0xC001001E
105#define RNDIS_STATUS_NO_CABLE 0xC001001F
106
107#define RNDIS_STATUS_INVALID_SAP 0xC0010020
108#define RNDIS_STATUS_SAP_IN_USE 0xC0010021
109#define RNDIS_STATUS_INVALID_ADDRESS 0xC0010022
110#define RNDIS_STATUS_VC_NOT_ACTIVATED 0xC0010023
111#define RNDIS_STATUS_DEST_OUT_OF_ORDER 0xC0010024
112#define RNDIS_STATUS_VC_NOT_AVAILABLE 0xC0010025
113#define RNDIS_STATUS_CELLRATE_NOT_AVAILABLE 0xC0010026
114#define RNDIS_STATUS_INCOMPATABLE_QOS 0xC0010027
115#define RNDIS_STATUS_AAL_PARAMS_UNSUPPORTED 0xC0010028
116#define RNDIS_STATUS_NO_ROUTE_TO_DESTINATION 0xC0010029
117
118#define RNDIS_STATUS_TOKEN_RING_OPEN_ERROR 0xC0011000
119
120/* codes for RNDIS_OID_GEN_PHYSICAL_MEDIUM */
121#define RNDIS_PHYSICAL_MEDIUM_UNSPECIFIED 0x00000000
122#define RNDIS_PHYSICAL_MEDIUM_WIRELESS_LAN 0x00000001
123#define RNDIS_PHYSICAL_MEDIUM_CABLE_MODEM 0x00000002
124#define RNDIS_PHYSICAL_MEDIUM_PHONE_LINE 0x00000003
125#define RNDIS_PHYSICAL_MEDIUM_POWER_LINE 0x00000004
126#define RNDIS_PHYSICAL_MEDIUM_DSL 0x00000005
127#define RNDIS_PHYSICAL_MEDIUM_FIBRE_CHANNEL 0x00000006
128#define RNDIS_PHYSICAL_MEDIUM_1394 0x00000007
129#define RNDIS_PHYSICAL_MEDIUM_WIRELESS_WAN 0x00000008
130#define RNDIS_PHYSICAL_MEDIUM_MAX 0x00000009
131
132/* Remote NDIS medium types. */
133#define RNDIS_MEDIUM_UNSPECIFIED 0x00000000
134#define RNDIS_MEDIUM_802_3 0x00000000
135#define RNDIS_MEDIUM_802_5 0x00000001
136#define RNDIS_MEDIUM_FDDI 0x00000002
137#define RNDIS_MEDIUM_WAN 0x00000003
138#define RNDIS_MEDIUM_LOCAL_TALK 0x00000004
139#define RNDIS_MEDIUM_ARCNET_RAW 0x00000006
140#define RNDIS_MEDIUM_ARCNET_878_2 0x00000007
141#define RNDIS_MEDIUM_ATM 0x00000008
142#define RNDIS_MEDIUM_WIRELESS_LAN 0x00000009
143#define RNDIS_MEDIUM_IRDA 0x0000000A
144#define RNDIS_MEDIUM_BPC 0x0000000B
145#define RNDIS_MEDIUM_CO_WAN 0x0000000C
146#define RNDIS_MEDIUM_1394 0x0000000D
147/* Not a real medium, defined as an upper-bound */
148#define RNDIS_MEDIUM_MAX 0x0000000E
149
150/* Remote NDIS medium connection states. */
151#define RNDIS_MEDIA_STATE_CONNECTED 0x00000000
152#define RNDIS_MEDIA_STATE_DISCONNECTED 0x00000001
153
154/* packet filter bits used by RNDIS_OID_GEN_CURRENT_PACKET_FILTER */
155#define RNDIS_PACKET_TYPE_DIRECTED 0x00000001
156#define RNDIS_PACKET_TYPE_MULTICAST 0x00000002
157#define RNDIS_PACKET_TYPE_ALL_MULTICAST 0x00000004
158#define RNDIS_PACKET_TYPE_BROADCAST 0x00000008
159#define RNDIS_PACKET_TYPE_SOURCE_ROUTING 0x00000010
160#define RNDIS_PACKET_TYPE_PROMISCUOUS 0x00000020
161#define RNDIS_PACKET_TYPE_SMT 0x00000040
162#define RNDIS_PACKET_TYPE_ALL_LOCAL 0x00000080
163#define RNDIS_PACKET_TYPE_GROUP 0x00001000
164#define RNDIS_PACKET_TYPE_ALL_FUNCTIONAL 0x00002000
165#define RNDIS_PACKET_TYPE_FUNCTIONAL 0x00004000
166#define RNDIS_PACKET_TYPE_MAC_FRAME 0x00008000
167
168/* RNDIS_OID_GEN_MINIPORT_INFO constants */
169#define RNDIS_MINIPORT_BUS_MASTER 0x00000001
170#define RNDIS_MINIPORT_WDM_DRIVER 0x00000002
171#define RNDIS_MINIPORT_SG_LIST 0x00000004
172#define RNDIS_MINIPORT_SUPPORTS_MEDIA_QUERY 0x00000008
173#define RNDIS_MINIPORT_INDICATES_PACKETS 0x00000010
174#define RNDIS_MINIPORT_IGNORE_PACKET_QUEUE 0x00000020
175#define RNDIS_MINIPORT_IGNORE_REQUEST_QUEUE 0x00000040
176#define RNDIS_MINIPORT_IGNORE_TOKEN_RING_ERRORS 0x00000080
177#define RNDIS_MINIPORT_INTERMEDIATE_DRIVER 0x00000100
178#define RNDIS_MINIPORT_IS_NDIS_5 0x00000200
179#define RNDIS_MINIPORT_IS_CO 0x00000400
180#define RNDIS_MINIPORT_DESERIALIZE 0x00000800
181#define RNDIS_MINIPORT_REQUIRES_MEDIA_POLLING 0x00001000
182#define RNDIS_MINIPORT_SUPPORTS_MEDIA_SENSE 0x00002000
183#define RNDIS_MINIPORT_NETBOOT_CARD 0x00004000
184#define RNDIS_MINIPORT_PM_SUPPORTED 0x00008000
185#define RNDIS_MINIPORT_SUPPORTS_MAC_ADDRESS_OVERWRITE 0x00010000
186#define RNDIS_MINIPORT_USES_SAFE_BUFFER_APIS 0x00020000
187#define RNDIS_MINIPORT_HIDDEN 0x00040000
188#define RNDIS_MINIPORT_SWENUM 0x00080000
189#define RNDIS_MINIPORT_SURPRISE_REMOVE_OK 0x00100000
190#define RNDIS_MINIPORT_NO_HALT_ON_SUSPEND 0x00200000
191#define RNDIS_MINIPORT_HARDWARE_DEVICE 0x00400000
192#define RNDIS_MINIPORT_SUPPORTS_CANCEL_SEND_PACKETS 0x00800000
193#define RNDIS_MINIPORT_64BITS_DMA 0x01000000
194
195#define RNDIS_MAC_OPTION_COPY_LOOKAHEAD_DATA 0x00000001
196#define RNDIS_MAC_OPTION_RECEIVE_SERIALIZED 0x00000002
197#define RNDIS_MAC_OPTION_TRANSFERS_NOT_PEND 0x00000004
198#define RNDIS_MAC_OPTION_NO_LOOPBACK 0x00000008
199#define RNDIS_MAC_OPTION_FULL_DUPLEX 0x00000010
200#define RNDIS_MAC_OPTION_EOTX_INDICATION 0x00000020
201#define RNDIS_MAC_OPTION_8021P_PRIORITY 0x00000040
202#define RNDIS_MAC_OPTION_RESERVED 0x80000000
203
204/* Object Identifiers used by NdisRequest Query/Set Information */
205/* General (Required) Objects */
206#define RNDIS_OID_GEN_SUPPORTED_LIST 0x00010101
207#define RNDIS_OID_GEN_HARDWARE_STATUS 0x00010102
208#define RNDIS_OID_GEN_MEDIA_SUPPORTED 0x00010103
209#define RNDIS_OID_GEN_MEDIA_IN_USE 0x00010104
210#define RNDIS_OID_GEN_MAXIMUM_LOOKAHEAD 0x00010105
211#define RNDIS_OID_GEN_MAXIMUM_FRAME_SIZE 0x00010106
212#define RNDIS_OID_GEN_LINK_SPEED 0x00010107
213#define RNDIS_OID_GEN_TRANSMIT_BUFFER_SPACE 0x00010108
214#define RNDIS_OID_GEN_RECEIVE_BUFFER_SPACE 0x00010109
215#define RNDIS_OID_GEN_TRANSMIT_BLOCK_SIZE 0x0001010A
216#define RNDIS_OID_GEN_RECEIVE_BLOCK_SIZE 0x0001010B
217#define RNDIS_OID_GEN_VENDOR_ID 0x0001010C
218#define RNDIS_OID_GEN_VENDOR_DESCRIPTION 0x0001010D
219#define RNDIS_OID_GEN_CURRENT_PACKET_FILTER 0x0001010E
220#define RNDIS_OID_GEN_CURRENT_LOOKAHEAD 0x0001010F
221#define RNDIS_OID_GEN_DRIVER_VERSION 0x00010110
222#define RNDIS_OID_GEN_MAXIMUM_TOTAL_SIZE 0x00010111
223#define RNDIS_OID_GEN_PROTOCOL_OPTIONS 0x00010112
224#define RNDIS_OID_GEN_MAC_OPTIONS 0x00010113
225#define RNDIS_OID_GEN_MEDIA_CONNECT_STATUS 0x00010114
226#define RNDIS_OID_GEN_MAXIMUM_SEND_PACKETS 0x00010115
227#define RNDIS_OID_GEN_VENDOR_DRIVER_VERSION 0x00010116
228#define RNDIS_OID_GEN_SUPPORTED_GUIDS 0x00010117
229#define RNDIS_OID_GEN_NETWORK_LAYER_ADDRESSES 0x00010118
230#define RNDIS_OID_GEN_TRANSPORT_HEADER_OFFSET 0x00010119
231#define RNDIS_OID_GEN_PHYSICAL_MEDIUM 0x00010202
232#define RNDIS_OID_GEN_MACHINE_NAME 0x0001021A
233#define RNDIS_OID_GEN_RNDIS_CONFIG_PARAMETER 0x0001021B
234#define RNDIS_OID_GEN_VLAN_ID 0x0001021C
235
236/* Optional OIDs */
237#define RNDIS_OID_GEN_MEDIA_CAPABILITIES 0x00010201
238
239/* Required statistics OIDs */
240#define RNDIS_OID_GEN_XMIT_OK 0x00020101
241#define RNDIS_OID_GEN_RCV_OK 0x00020102
242#define RNDIS_OID_GEN_XMIT_ERROR 0x00020103
243#define RNDIS_OID_GEN_RCV_ERROR 0x00020104
244#define RNDIS_OID_GEN_RCV_NO_BUFFER 0x00020105
245
246/* Optional statistics OIDs */
247#define RNDIS_OID_GEN_DIRECTED_BYTES_XMIT 0x00020201
248#define RNDIS_OID_GEN_DIRECTED_FRAMES_XMIT 0x00020202
249#define RNDIS_OID_GEN_MULTICAST_BYTES_XMIT 0x00020203
250#define RNDIS_OID_GEN_MULTICAST_FRAMES_XMIT 0x00020204
251#define RNDIS_OID_GEN_BROADCAST_BYTES_XMIT 0x00020205
252#define RNDIS_OID_GEN_BROADCAST_FRAMES_XMIT 0x00020206
253#define RNDIS_OID_GEN_DIRECTED_BYTES_RCV 0x00020207
254#define RNDIS_OID_GEN_DIRECTED_FRAMES_RCV 0x00020208
255#define RNDIS_OID_GEN_MULTICAST_BYTES_RCV 0x00020209
256#define RNDIS_OID_GEN_MULTICAST_FRAMES_RCV 0x0002020A
257#define RNDIS_OID_GEN_BROADCAST_BYTES_RCV 0x0002020B
258#define RNDIS_OID_GEN_BROADCAST_FRAMES_RCV 0x0002020C
259
260#define RNDIS_OID_GEN_RCV_CRC_ERROR 0x0002020D
261#define RNDIS_OID_GEN_TRANSMIT_QUEUE_LENGTH 0x0002020E
262
263#define RNDIS_OID_GEN_GET_TIME_CAPS 0x0002020F
264#define RNDIS_OID_GEN_GET_NETCARD_TIME 0x00020210
265
266#define RNDIS_OID_GEN_NETCARD_LOAD 0x00020211
267#define RNDIS_OID_GEN_DEVICE_PROFILE 0x00020212
268#define RNDIS_OID_GEN_INIT_TIME_MS 0x00020213
269#define RNDIS_OID_GEN_RESET_COUNTS 0x00020214
270#define RNDIS_OID_GEN_MEDIA_SENSE_COUNTS 0x00020215
271#define RNDIS_OID_GEN_FRIENDLY_NAME 0x00020216
272#define RNDIS_OID_GEN_MINIPORT_INFO 0x00020217
273#define RNDIS_OID_GEN_RESET_VERIFY_PARAMETERS 0x00020218
274
275/* These are connection-oriented general OIDs. */
276/* These replace the above OIDs for connection-oriented media. */
277#define RNDIS_OID_GEN_CO_SUPPORTED_LIST 0x00010101
278#define RNDIS_OID_GEN_CO_HARDWARE_STATUS 0x00010102
279#define RNDIS_OID_GEN_CO_MEDIA_SUPPORTED 0x00010103
280#define RNDIS_OID_GEN_CO_MEDIA_IN_USE 0x00010104
281#define RNDIS_OID_GEN_CO_LINK_SPEED 0x00010105
282#define RNDIS_OID_GEN_CO_VENDOR_ID 0x00010106
283#define RNDIS_OID_GEN_CO_VENDOR_DESCRIPTION 0x00010107
284#define RNDIS_OID_GEN_CO_DRIVER_VERSION 0x00010108
285#define RNDIS_OID_GEN_CO_PROTOCOL_OPTIONS 0x00010109
286#define RNDIS_OID_GEN_CO_MAC_OPTIONS 0x0001010A
287#define RNDIS_OID_GEN_CO_MEDIA_CONNECT_STATUS 0x0001010B
288#define RNDIS_OID_GEN_CO_VENDOR_DRIVER_VERSION 0x0001010C
289#define RNDIS_OID_GEN_CO_MINIMUM_LINK_SPEED 0x0001010D
290
291#define RNDIS_OID_GEN_CO_GET_TIME_CAPS 0x00010201
292#define RNDIS_OID_GEN_CO_GET_NETCARD_TIME 0x00010202
293
294/* These are connection-oriented statistics OIDs. */
295#define RNDIS_OID_GEN_CO_XMIT_PDUS_OK 0x00020101
296#define RNDIS_OID_GEN_CO_RCV_PDUS_OK 0x00020102
297#define RNDIS_OID_GEN_CO_XMIT_PDUS_ERROR 0x00020103
298#define RNDIS_OID_GEN_CO_RCV_PDUS_ERROR 0x00020104
299#define RNDIS_OID_GEN_CO_RCV_PDUS_NO_BUFFER 0x00020105
300
301
302#define RNDIS_OID_GEN_CO_RCV_CRC_ERROR 0x00020201
303#define RNDIS_OID_GEN_CO_TRANSMIT_QUEUE_LENGTH 0x00020202
304#define RNDIS_OID_GEN_CO_BYTES_XMIT 0x00020203
305#define RNDIS_OID_GEN_CO_BYTES_RCV 0x00020204
306#define RNDIS_OID_GEN_CO_BYTES_XMIT_OUTSTANDING 0x00020205
307#define RNDIS_OID_GEN_CO_NETCARD_LOAD 0x00020206
308
309/* These are objects for Connection-oriented media call-managers. */
310#define RNDIS_OID_CO_ADD_PVC 0xFF000001
311#define RNDIS_OID_CO_DELETE_PVC 0xFF000002
312#define RNDIS_OID_CO_GET_CALL_INFORMATION 0xFF000003
313#define RNDIS_OID_CO_ADD_ADDRESS 0xFF000004
314#define RNDIS_OID_CO_DELETE_ADDRESS 0xFF000005
315#define RNDIS_OID_CO_GET_ADDRESSES 0xFF000006
316#define RNDIS_OID_CO_ADDRESS_CHANGE 0xFF000007
317#define RNDIS_OID_CO_SIGNALING_ENABLED 0xFF000008
318#define RNDIS_OID_CO_SIGNALING_DISABLED 0xFF000009
319
320/* 802.3 Objects (Ethernet) */
321#define RNDIS_OID_802_3_PERMANENT_ADDRESS 0x01010101
322#define RNDIS_OID_802_3_CURRENT_ADDRESS 0x01010102
323#define RNDIS_OID_802_3_MULTICAST_LIST 0x01010103
324#define RNDIS_OID_802_3_MAXIMUM_LIST_SIZE 0x01010104
325#define RNDIS_OID_802_3_MAC_OPTIONS 0x01010105
326
327#define RNDIS_802_3_MAC_OPTION_PRIORITY 0x00000001
328
329#define RNDIS_OID_802_3_RCV_ERROR_ALIGNMENT 0x01020101
330#define RNDIS_OID_802_3_XMIT_ONE_COLLISION 0x01020102
331#define RNDIS_OID_802_3_XMIT_MORE_COLLISIONS 0x01020103
332
333#define RNDIS_OID_802_3_XMIT_DEFERRED 0x01020201
334#define RNDIS_OID_802_3_XMIT_MAX_COLLISIONS 0x01020202
335#define RNDIS_OID_802_3_RCV_OVERRUN 0x01020203
336#define RNDIS_OID_802_3_XMIT_UNDERRUN 0x01020204
337#define RNDIS_OID_802_3_XMIT_HEARTBEAT_FAILURE 0x01020205
338#define RNDIS_OID_802_3_XMIT_TIMES_CRS_LOST 0x01020206
339#define RNDIS_OID_802_3_XMIT_LATE_COLLISIONS 0x01020207
340
341#define RNDIS_OID_802_11_BSSID 0x0d010101
342#define RNDIS_OID_802_11_SSID 0x0d010102
343#define RNDIS_OID_802_11_INFRASTRUCTURE_MODE 0x0d010108
344#define RNDIS_OID_802_11_ADD_WEP 0x0d010113
345#define RNDIS_OID_802_11_REMOVE_WEP 0x0d010114
346#define RNDIS_OID_802_11_DISASSOCIATE 0x0d010115
347#define RNDIS_OID_802_11_AUTHENTICATION_MODE 0x0d010118
348#define RNDIS_OID_802_11_PRIVACY_FILTER 0x0d010119
349#define RNDIS_OID_802_11_BSSID_LIST_SCAN 0x0d01011a
350#define RNDIS_OID_802_11_ENCRYPTION_STATUS 0x0d01011b
351#define RNDIS_OID_802_11_ADD_KEY 0x0d01011d
352#define RNDIS_OID_802_11_REMOVE_KEY 0x0d01011e
353#define RNDIS_OID_802_11_ASSOCIATION_INFORMATION 0x0d01011f
354#define RNDIS_OID_802_11_CAPABILITY 0x0d010122
355#define RNDIS_OID_802_11_PMKID 0x0d010123
356#define RNDIS_OID_802_11_NETWORK_TYPES_SUPPORTED 0x0d010203
357#define RNDIS_OID_802_11_NETWORK_TYPE_IN_USE 0x0d010204
358#define RNDIS_OID_802_11_TX_POWER_LEVEL 0x0d010205
359#define RNDIS_OID_802_11_RSSI 0x0d010206
360#define RNDIS_OID_802_11_RSSI_TRIGGER 0x0d010207
361#define RNDIS_OID_802_11_FRAGMENTATION_THRESHOLD 0x0d010209
362#define RNDIS_OID_802_11_RTS_THRESHOLD 0x0d01020a
363#define RNDIS_OID_802_11_SUPPORTED_RATES 0x0d01020e
364#define RNDIS_OID_802_11_CONFIGURATION 0x0d010211
365#define RNDIS_OID_802_11_POWER_MODE 0x0d010216
366#define RNDIS_OID_802_11_BSSID_LIST 0x0d010217
367
368/* Plug and Play capabilities */
369#define RNDIS_OID_PNP_CAPABILITIES 0xFD010100
370#define RNDIS_OID_PNP_SET_POWER 0xFD010101
371#define RNDIS_OID_PNP_QUERY_POWER 0xFD010102
372#define RNDIS_OID_PNP_ADD_WAKE_UP_PATTERN 0xFD010103
373#define RNDIS_OID_PNP_REMOVE_WAKE_UP_PATTERN 0xFD010104
374#define RNDIS_OID_PNP_ENABLE_WAKE_UP 0xFD010106
375
376/* RNDIS_PNP_CAPABILITIES.Flags constants */
377#define RNDIS_DEVICE_WAKE_UP_ENABLE 0x00000001
378#define RNDIS_DEVICE_WAKE_ON_PATTERN_MATCH_ENABLE 0x00000002
379#define RNDIS_DEVICE_WAKE_ON_MAGIC_PACKET_ENABLE 0x00000004
380
381#define REMOTE_CONDIS_MP_CREATE_VC_MSG 0x00008001
382#define REMOTE_CONDIS_MP_DELETE_VC_MSG 0x00008002
383#define REMOTE_CONDIS_MP_ACTIVATE_VC_MSG 0x00008005
384#define REMOTE_CONDIS_MP_DEACTIVATE_VC_MSG 0x00008006
385#define REMOTE_CONDIS_INDICATE_STATUS_MSG 0x00008007
386
387#define REMOTE_CONDIS_MP_CREATE_VC_CMPLT 0x80008001
388#define REMOTE_CONDIS_MP_DELETE_VC_CMPLT 0x80008002
389#define REMOTE_CONDIS_MP_ACTIVATE_VC_CMPLT 0x80008005
390#define REMOTE_CONDIS_MP_DEACTIVATE_VC_CMPLT 0x80008006
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index 577592ea0ea0..2c1de8982c85 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -801,6 +801,10 @@ rtattr_failure:
801 return table; 801 return table;
802} 802}
803 803
804extern int ndo_dflt_fdb_dump(struct sk_buff *skb,
805 struct netlink_callback *cb,
806 struct net_device *dev,
807 int idx);
804#endif /* __KERNEL__ */ 808#endif /* __KERNEL__ */
805 809
806 810
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 81a173c0897d..f45c0b280b5d 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -90,6 +90,7 @@ struct sched_param {
90#include <linux/latencytop.h> 90#include <linux/latencytop.h>
91#include <linux/cred.h> 91#include <linux/cred.h>
92#include <linux/llist.h> 92#include <linux/llist.h>
93#include <linux/uidgid.h>
93 94
94#include <asm/processor.h> 95#include <asm/processor.h>
95 96
@@ -728,8 +729,7 @@ struct user_struct {
728 729
729 /* Hash table maintenance information */ 730 /* Hash table maintenance information */
730 struct hlist_node uidhash_node; 731 struct hlist_node uidhash_node;
731 uid_t uid; 732 kuid_t uid;
732 struct user_namespace *user_ns;
733 733
734#ifdef CONFIG_PERF_EVENTS 734#ifdef CONFIG_PERF_EVENTS
735 atomic_long_t locked_vm; 735 atomic_long_t locked_vm;
@@ -738,7 +738,7 @@ struct user_struct {
738 738
739extern int uids_sysfs_init(void); 739extern int uids_sysfs_init(void);
740 740
741extern struct user_struct *find_user(uid_t); 741extern struct user_struct *find_user(kuid_t);
742 742
743extern struct user_struct root_user; 743extern struct user_struct root_user;
744#define INIT_USER (&root_user) 744#define INIT_USER (&root_user)
@@ -855,61 +855,14 @@ enum cpu_idle_type {
855#define SD_WAKE_AFFINE 0x0020 /* Wake task to waking CPU */ 855#define SD_WAKE_AFFINE 0x0020 /* Wake task to waking CPU */
856#define SD_PREFER_LOCAL 0x0040 /* Prefer to keep tasks local to this domain */ 856#define SD_PREFER_LOCAL 0x0040 /* Prefer to keep tasks local to this domain */
857#define SD_SHARE_CPUPOWER 0x0080 /* Domain members share cpu power */ 857#define SD_SHARE_CPUPOWER 0x0080 /* Domain members share cpu power */
858#define SD_POWERSAVINGS_BALANCE 0x0100 /* Balance for power savings */
859#define SD_SHARE_PKG_RESOURCES 0x0200 /* Domain members share cpu pkg resources */ 858#define SD_SHARE_PKG_RESOURCES 0x0200 /* Domain members share cpu pkg resources */
860#define SD_SERIALIZE 0x0400 /* Only a single load balancing instance */ 859#define SD_SERIALIZE 0x0400 /* Only a single load balancing instance */
861#define SD_ASYM_PACKING 0x0800 /* Place busy groups earlier in the domain */ 860#define SD_ASYM_PACKING 0x0800 /* Place busy groups earlier in the domain */
862#define SD_PREFER_SIBLING 0x1000 /* Prefer to place tasks in a sibling domain */ 861#define SD_PREFER_SIBLING 0x1000 /* Prefer to place tasks in a sibling domain */
863#define SD_OVERLAP 0x2000 /* sched_domains of this level overlap */ 862#define SD_OVERLAP 0x2000 /* sched_domains of this level overlap */
864 863
865enum powersavings_balance_level {
866 POWERSAVINGS_BALANCE_NONE = 0, /* No power saving load balance */
867 POWERSAVINGS_BALANCE_BASIC, /* Fill one thread/core/package
868 * first for long running threads
869 */
870 POWERSAVINGS_BALANCE_WAKEUP, /* Also bias task wakeups to semi-idle
871 * cpu package for power savings
872 */
873 MAX_POWERSAVINGS_BALANCE_LEVELS
874};
875
876extern int sched_mc_power_savings, sched_smt_power_savings;
877
878static inline int sd_balance_for_mc_power(void)
879{
880 if (sched_smt_power_savings)
881 return SD_POWERSAVINGS_BALANCE;
882
883 if (!sched_mc_power_savings)
884 return SD_PREFER_SIBLING;
885
886 return 0;
887}
888
889static inline int sd_balance_for_package_power(void)
890{
891 if (sched_mc_power_savings | sched_smt_power_savings)
892 return SD_POWERSAVINGS_BALANCE;
893
894 return SD_PREFER_SIBLING;
895}
896
897extern int __weak arch_sd_sibiling_asym_packing(void); 864extern int __weak arch_sd_sibiling_asym_packing(void);
898 865
899/*
900 * Optimise SD flags for power savings:
901 * SD_BALANCE_NEWIDLE helps aggressive task consolidation and power savings.
902 * Keep default SD flags if sched_{smt,mc}_power_saving=0
903 */
904
905static inline int sd_power_saving_flags(void)
906{
907 if (sched_mc_power_savings | sched_smt_power_savings)
908 return SD_BALANCE_NEWIDLE;
909
910 return 0;
911}
912
913struct sched_group_power { 866struct sched_group_power {
914 atomic_t ref; 867 atomic_t ref;
915 /* 868 /*
@@ -1341,6 +1294,8 @@ struct task_struct {
1341 * execve */ 1294 * execve */
1342 unsigned in_iowait:1; 1295 unsigned in_iowait:1;
1343 1296
1297 /* task may not gain privileges */
1298 unsigned no_new_privs:1;
1344 1299
1345 /* Revert to default priority/policy when forking */ 1300 /* Revert to default priority/policy when forking */
1346 unsigned sched_reset_on_fork:1; 1301 unsigned sched_reset_on_fork:1;
@@ -1450,7 +1405,7 @@ struct task_struct {
1450 uid_t loginuid; 1405 uid_t loginuid;
1451 unsigned int sessionid; 1406 unsigned int sessionid;
1452#endif 1407#endif
1453 seccomp_t seccomp; 1408 struct seccomp seccomp;
1454 1409
1455/* Thread group tracking */ 1410/* Thread group tracking */
1456 u32 parent_exec_id; 1411 u32 parent_exec_id;
@@ -1617,6 +1572,10 @@ struct task_struct {
1617#ifdef CONFIG_HAVE_HW_BREAKPOINT 1572#ifdef CONFIG_HAVE_HW_BREAKPOINT
1618 atomic_t ptrace_bp_refcnt; 1573 atomic_t ptrace_bp_refcnt;
1619#endif 1574#endif
1575#ifdef CONFIG_UPROBES
1576 struct uprobe_task *utask;
1577 int uprobe_srcu_id;
1578#endif
1620}; 1579};
1621 1580
1622/* Future-safe accessor for struct task_struct's cpus_allowed. */ 1581/* Future-safe accessor for struct task_struct's cpus_allowed. */
@@ -1905,12 +1864,22 @@ static inline void rcu_copy_process(struct task_struct *p)
1905 INIT_LIST_HEAD(&p->rcu_node_entry); 1864 INIT_LIST_HEAD(&p->rcu_node_entry);
1906} 1865}
1907 1866
1867static inline void rcu_switch_from(struct task_struct *prev)
1868{
1869 if (prev->rcu_read_lock_nesting != 0)
1870 rcu_preempt_note_context_switch();
1871}
1872
1908#else 1873#else
1909 1874
1910static inline void rcu_copy_process(struct task_struct *p) 1875static inline void rcu_copy_process(struct task_struct *p)
1911{ 1876{
1912} 1877}
1913 1878
1879static inline void rcu_switch_from(struct task_struct *prev)
1880{
1881}
1882
1914#endif 1883#endif
1915 1884
1916#ifdef CONFIG_SMP 1885#ifdef CONFIG_SMP
@@ -1950,7 +1919,7 @@ static inline int set_cpus_allowed(struct task_struct *p, cpumask_t new_mask)
1950 */ 1919 */
1951extern unsigned long long notrace sched_clock(void); 1920extern unsigned long long notrace sched_clock(void);
1952/* 1921/*
1953 * See the comment in kernel/sched_clock.c 1922 * See the comment in kernel/sched/clock.c
1954 */ 1923 */
1955extern u64 cpu_clock(int cpu); 1924extern u64 cpu_clock(int cpu);
1956extern u64 local_clock(void); 1925extern u64 local_clock(void);
@@ -2177,14 +2146,13 @@ extern struct task_struct *find_task_by_pid_ns(pid_t nr,
2177extern void __set_special_pids(struct pid *pid); 2146extern void __set_special_pids(struct pid *pid);
2178 2147
2179/* per-UID process charging. */ 2148/* per-UID process charging. */
2180extern struct user_struct * alloc_uid(struct user_namespace *, uid_t); 2149extern struct user_struct * alloc_uid(kuid_t);
2181static inline struct user_struct *get_uid(struct user_struct *u) 2150static inline struct user_struct *get_uid(struct user_struct *u)
2182{ 2151{
2183 atomic_inc(&u->__count); 2152 atomic_inc(&u->__count);
2184 return u; 2153 return u;
2185} 2154}
2186extern void free_uid(struct user_struct *); 2155extern void free_uid(struct user_struct *);
2187extern void release_uids(struct user_namespace *ns);
2188 2156
2189#include <asm/current.h> 2157#include <asm/current.h>
2190 2158
diff --git a/include/linux/seccomp.h b/include/linux/seccomp.h
index cc7a4e9cc7ad..84f6320da50f 100644
--- a/include/linux/seccomp.h
+++ b/include/linux/seccomp.h
@@ -1,25 +1,90 @@
1#ifndef _LINUX_SECCOMP_H 1#ifndef _LINUX_SECCOMP_H
2#define _LINUX_SECCOMP_H 2#define _LINUX_SECCOMP_H
3 3
4 4#include <linux/compiler.h>
5#include <linux/types.h>
6
7
8/* Valid values for seccomp.mode and prctl(PR_SET_SECCOMP, <mode>) */
9#define SECCOMP_MODE_DISABLED 0 /* seccomp is not in use. */
10#define SECCOMP_MODE_STRICT 1 /* uses hard-coded filter. */
11#define SECCOMP_MODE_FILTER 2 /* uses user-supplied filter. */
12
13/*
14 * All BPF programs must return a 32-bit value.
15 * The bottom 16-bits are for optional return data.
16 * The upper 16-bits are ordered from least permissive values to most.
17 *
18 * The ordering ensures that a min_t() over composed return values always
19 * selects the least permissive choice.
20 */
21#define SECCOMP_RET_KILL 0x00000000U /* kill the task immediately */
22#define SECCOMP_RET_TRAP 0x00030000U /* disallow and force a SIGSYS */
23#define SECCOMP_RET_ERRNO 0x00050000U /* returns an errno */
24#define SECCOMP_RET_TRACE 0x7ff00000U /* pass to a tracer or disallow */
25#define SECCOMP_RET_ALLOW 0x7fff0000U /* allow */
26
27/* Masks for the return value sections. */
28#define SECCOMP_RET_ACTION 0x7fff0000U
29#define SECCOMP_RET_DATA 0x0000ffffU
30
31/**
32 * struct seccomp_data - the format the BPF program executes over.
33 * @nr: the system call number
34 * @arch: indicates system call convention as an AUDIT_ARCH_* value
35 * as defined in <linux/audit.h>.
36 * @instruction_pointer: at the time of the system call.
37 * @args: up to 6 system call arguments always stored as 64-bit values
38 * regardless of the architecture.
39 */
40struct seccomp_data {
41 int nr;
42 __u32 arch;
43 __u64 instruction_pointer;
44 __u64 args[6];
45};
46
47#ifdef __KERNEL__
5#ifdef CONFIG_SECCOMP 48#ifdef CONFIG_SECCOMP
6 49
7#include <linux/thread_info.h> 50#include <linux/thread_info.h>
8#include <asm/seccomp.h> 51#include <asm/seccomp.h>
9 52
10typedef struct { int mode; } seccomp_t; 53struct seccomp_filter;
11 54/**
12extern void __secure_computing(int); 55 * struct seccomp - the state of a seccomp'ed process
13static inline void secure_computing(int this_syscall) 56 *
57 * @mode: indicates one of the valid values above for controlled
58 * system calls available to a process.
59 * @filter: The metadata and ruleset for determining what system calls
60 * are allowed for a task.
61 *
62 * @filter must only be accessed from the context of current as there
63 * is no locking.
64 */
65struct seccomp {
66 int mode;
67 struct seccomp_filter *filter;
68};
69
70extern int __secure_computing(int);
71static inline int secure_computing(int this_syscall)
14{ 72{
15 if (unlikely(test_thread_flag(TIF_SECCOMP))) 73 if (unlikely(test_thread_flag(TIF_SECCOMP)))
16 __secure_computing(this_syscall); 74 return __secure_computing(this_syscall);
75 return 0;
76}
77
78/* A wrapper for architectures supporting only SECCOMP_MODE_STRICT. */
79static inline void secure_computing_strict(int this_syscall)
80{
81 BUG_ON(secure_computing(this_syscall) != 0);
17} 82}
18 83
19extern long prctl_get_seccomp(void); 84extern long prctl_get_seccomp(void);
20extern long prctl_set_seccomp(unsigned long); 85extern long prctl_set_seccomp(unsigned long, char __user *);
21 86
22static inline int seccomp_mode(seccomp_t *s) 87static inline int seccomp_mode(struct seccomp *s)
23{ 88{
24 return s->mode; 89 return s->mode;
25} 90}
@@ -28,25 +93,41 @@ static inline int seccomp_mode(seccomp_t *s)
28 93
29#include <linux/errno.h> 94#include <linux/errno.h>
30 95
31typedef struct { } seccomp_t; 96struct seccomp { };
97struct seccomp_filter { };
32 98
33#define secure_computing(x) do { } while (0) 99static inline int secure_computing(int this_syscall) { return 0; }
100static inline void secure_computing_strict(int this_syscall) { return; }
34 101
35static inline long prctl_get_seccomp(void) 102static inline long prctl_get_seccomp(void)
36{ 103{
37 return -EINVAL; 104 return -EINVAL;
38} 105}
39 106
40static inline long prctl_set_seccomp(unsigned long arg2) 107static inline long prctl_set_seccomp(unsigned long arg2, char __user *arg3)
41{ 108{
42 return -EINVAL; 109 return -EINVAL;
43} 110}
44 111
45static inline int seccomp_mode(seccomp_t *s) 112static inline int seccomp_mode(struct seccomp *s)
46{ 113{
47 return 0; 114 return 0;
48} 115}
49
50#endif /* CONFIG_SECCOMP */ 116#endif /* CONFIG_SECCOMP */
51 117
118#ifdef CONFIG_SECCOMP_FILTER
119extern void put_seccomp_filter(struct task_struct *tsk);
120extern void get_seccomp_filter(struct task_struct *tsk);
121extern u32 seccomp_bpf_load(int off);
122#else /* CONFIG_SECCOMP_FILTER */
123static inline void put_seccomp_filter(struct task_struct *tsk)
124{
125 return;
126}
127static inline void get_seccomp_filter(struct task_struct *tsk)
128{
129 return;
130}
131#endif /* CONFIG_SECCOMP_FILTER */
132#endif /* __KERNEL__ */
52#endif /* _LINUX_SECCOMP_H */ 133#endif /* _LINUX_SECCOMP_H */
diff --git a/include/linux/security.h b/include/linux/security.h
index 673afbb8238a..ab0e091ce5fa 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -144,6 +144,7 @@ struct request_sock;
144#define LSM_UNSAFE_SHARE 1 144#define LSM_UNSAFE_SHARE 1
145#define LSM_UNSAFE_PTRACE 2 145#define LSM_UNSAFE_PTRACE 2
146#define LSM_UNSAFE_PTRACE_CAP 4 146#define LSM_UNSAFE_PTRACE_CAP 4
147#define LSM_UNSAFE_NO_NEW_PRIVS 8
147 148
148#ifdef CONFIG_MMU 149#ifdef CONFIG_MMU
149extern int mmap_min_addr_handler(struct ctl_table *table, int write, 150extern int mmap_min_addr_handler(struct ctl_table *table, int write,
@@ -639,10 +640,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
639 * to receive an open file descriptor via socket IPC. 640 * to receive an open file descriptor via socket IPC.
640 * @file contains the file structure being received. 641 * @file contains the file structure being received.
641 * Return 0 if permission is granted. 642 * Return 0 if permission is granted.
642 * 643 * @file_open
643 * Security hook for dentry
644 *
645 * @dentry_open
646 * Save open-time permission checking state for later use upon 644 * Save open-time permission checking state for later use upon
647 * file_permission, and recheck access if anything has changed 645 * file_permission, and recheck access if anything has changed
648 * since inode_permission. 646 * since inode_permission.
@@ -1497,7 +1495,7 @@ struct security_operations {
1497 int (*file_send_sigiotask) (struct task_struct *tsk, 1495 int (*file_send_sigiotask) (struct task_struct *tsk,
1498 struct fown_struct *fown, int sig); 1496 struct fown_struct *fown, int sig);
1499 int (*file_receive) (struct file *file); 1497 int (*file_receive) (struct file *file);
1500 int (*dentry_open) (struct file *file, const struct cred *cred); 1498 int (*file_open) (struct file *file, const struct cred *cred);
1501 1499
1502 int (*task_create) (unsigned long clone_flags); 1500 int (*task_create) (unsigned long clone_flags);
1503 void (*task_free) (struct task_struct *task); 1501 void (*task_free) (struct task_struct *task);
@@ -1756,7 +1754,7 @@ int security_file_set_fowner(struct file *file);
1756int security_file_send_sigiotask(struct task_struct *tsk, 1754int security_file_send_sigiotask(struct task_struct *tsk,
1757 struct fown_struct *fown, int sig); 1755 struct fown_struct *fown, int sig);
1758int security_file_receive(struct file *file); 1756int security_file_receive(struct file *file);
1759int security_dentry_open(struct file *file, const struct cred *cred); 1757int security_file_open(struct file *file, const struct cred *cred);
1760int security_task_create(unsigned long clone_flags); 1758int security_task_create(unsigned long clone_flags);
1761void security_task_free(struct task_struct *task); 1759void security_task_free(struct task_struct *task);
1762int security_cred_alloc_blank(struct cred *cred, gfp_t gfp); 1760int security_cred_alloc_blank(struct cred *cred, gfp_t gfp);
@@ -2227,8 +2225,8 @@ static inline int security_file_receive(struct file *file)
2227 return 0; 2225 return 0;
2228} 2226}
2229 2227
2230static inline int security_dentry_open(struct file *file, 2228static inline int security_file_open(struct file *file,
2231 const struct cred *cred) 2229 const struct cred *cred)
2232{ 2230{
2233 return 0; 2231 return 0;
2234} 2232}
diff --git a/include/linux/seqlock.h b/include/linux/seqlock.h
index c6db9fb33c44..600060e25ec6 100644
--- a/include/linux/seqlock.h
+++ b/include/linux/seqlock.h
@@ -141,7 +141,7 @@ static inline unsigned __read_seqcount_begin(const seqcount_t *s)
141 unsigned ret; 141 unsigned ret;
142 142
143repeat: 143repeat:
144 ret = s->sequence; 144 ret = ACCESS_ONCE(s->sequence);
145 if (unlikely(ret & 1)) { 145 if (unlikely(ret & 1)) {
146 cpu_relax(); 146 cpu_relax();
147 goto repeat; 147 goto repeat;
@@ -166,6 +166,27 @@ static inline unsigned read_seqcount_begin(const seqcount_t *s)
166} 166}
167 167
168/** 168/**
169 * raw_seqcount_begin - begin a seq-read critical section
170 * @s: pointer to seqcount_t
171 * Returns: count to be passed to read_seqcount_retry
172 *
173 * raw_seqcount_begin opens a read critical section of the given seqcount.
174 * Validity of the critical section is tested by checking read_seqcount_retry
175 * function.
176 *
177 * Unlike read_seqcount_begin(), this function will not wait for the count
178 * to stabilize. If a writer is active when we begin, we will fail the
179 * read_seqcount_retry() instead of stabilizing at the beginning of the
180 * critical section.
181 */
182static inline unsigned raw_seqcount_begin(const seqcount_t *s)
183{
184 unsigned ret = ACCESS_ONCE(s->sequence);
185 smp_rmb();
186 return ret & ~1;
187}
188
189/**
169 * __read_seqcount_retry - end a seq-read critical section (without barrier) 190 * __read_seqcount_retry - end a seq-read critical section (without barrier)
170 * @s: pointer to seqcount_t 191 * @s: pointer to seqcount_t
171 * @start: count, from read_seqcount_begin 192 * @start: count, from read_seqcount_begin
diff --git a/include/linux/serial.h b/include/linux/serial.h
index 441980ecc4e5..90e9f981358a 100644
--- a/include/linux/serial.h
+++ b/include/linux/serial.h
@@ -130,7 +130,6 @@ struct serial_uart_config {
130#define ASYNCB_CHECK_CD 25 /* i.e., CLOCAL */ 130#define ASYNCB_CHECK_CD 25 /* i.e., CLOCAL */
131#define ASYNCB_SHARE_IRQ 24 /* for multifunction cards, no longer used */ 131#define ASYNCB_SHARE_IRQ 24 /* for multifunction cards, no longer used */
132#define ASYNCB_CONS_FLOW 23 /* flow control for console */ 132#define ASYNCB_CONS_FLOW 23 /* flow control for console */
133#define ASYNCB_BOOT_ONLYMCA 22 /* Probe only if MCA bus */
134#define ASYNCB_FIRST_KERNEL 22 133#define ASYNCB_FIRST_KERNEL 22
135 134
136#define ASYNC_HUP_NOTIFY (1U << ASYNCB_HUP_NOTIFY) 135#define ASYNC_HUP_NOTIFY (1U << ASYNCB_HUP_NOTIFY)
@@ -166,7 +165,6 @@ struct serial_uart_config {
166#define ASYNC_CHECK_CD (1U << ASYNCB_CHECK_CD) 165#define ASYNC_CHECK_CD (1U << ASYNCB_CHECK_CD)
167#define ASYNC_SHARE_IRQ (1U << ASYNCB_SHARE_IRQ) 166#define ASYNC_SHARE_IRQ (1U << ASYNCB_SHARE_IRQ)
168#define ASYNC_CONS_FLOW (1U << ASYNCB_CONS_FLOW) 167#define ASYNC_CONS_FLOW (1U << ASYNCB_CONS_FLOW)
169#define ASYNC_BOOT_ONLYMCA (1U << ASYNCB_BOOT_ONLYMCA)
170#define ASYNC_INTERNAL_FLAGS (~((1U << ASYNCB_FIRST_KERNEL) - 1)) 168#define ASYNC_INTERNAL_FLAGS (~((1U << ASYNCB_FIRST_KERNEL) - 1))
171 169
172/* 170/*
diff --git a/include/linux/serial_8250.h b/include/linux/serial_8250.h
index 8f012f8ac8e9..a416e92012ef 100644
--- a/include/linux/serial_8250.h
+++ b/include/linux/serial_8250.h
@@ -38,6 +38,7 @@ struct plat_serial8250_port {
38 int (*handle_irq)(struct uart_port *); 38 int (*handle_irq)(struct uart_port *);
39 void (*pm)(struct uart_port *, unsigned int state, 39 void (*pm)(struct uart_port *, unsigned int state,
40 unsigned old); 40 unsigned old);
41 void (*handle_break)(struct uart_port *);
41}; 42};
42 43
43/* 44/*
@@ -54,7 +55,6 @@ enum {
54 PLAT8250_DEV_BOCA, 55 PLAT8250_DEV_BOCA,
55 PLAT8250_DEV_EXAR_ST16C554, 56 PLAT8250_DEV_EXAR_ST16C554,
56 PLAT8250_DEV_HUB6, 57 PLAT8250_DEV_HUB6,
57 PLAT8250_DEV_MCA,
58 PLAT8250_DEV_AU1X00, 58 PLAT8250_DEV_AU1X00,
59 PLAT8250_DEV_SM501, 59 PLAT8250_DEV_SM501,
60}; 60};
@@ -68,6 +68,7 @@ enum {
68struct uart_port; 68struct uart_port;
69struct uart_8250_port; 69struct uart_8250_port;
70 70
71int serial8250_register_8250_port(struct uart_8250_port *);
71int serial8250_register_port(struct uart_port *); 72int serial8250_register_port(struct uart_port *);
72void serial8250_unregister_port(int line); 73void serial8250_unregister_port(int line);
73void serial8250_suspend_port(int line); 74void serial8250_suspend_port(int line);
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index 2db407a40051..65db9928e15f 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -310,6 +310,7 @@ struct uart_port {
310 int (*handle_irq)(struct uart_port *); 310 int (*handle_irq)(struct uart_port *);
311 void (*pm)(struct uart_port *, unsigned int state, 311 void (*pm)(struct uart_port *, unsigned int state,
312 unsigned int old); 312 unsigned int old);
313 void (*handle_break)(struct uart_port *);
313 unsigned int irq; /* irq number */ 314 unsigned int irq; /* irq number */
314 unsigned long irqflags; /* irq flags */ 315 unsigned long irqflags; /* irq flags */
315 unsigned int uartclk; /* base uart clock */ 316 unsigned int uartclk; /* base uart clock */
@@ -533,6 +534,10 @@ uart_handle_sysrq_char(struct uart_port *port, unsigned int ch)
533static inline int uart_handle_break(struct uart_port *port) 534static inline int uart_handle_break(struct uart_port *port)
534{ 535{
535 struct uart_state *state = port->state; 536 struct uart_state *state = port->state;
537
538 if (port->handle_break)
539 port->handle_break(port);
540
536#ifdef SUPPORT_SYSRQ 541#ifdef SUPPORT_SYSRQ
537 if (port->cons && port->cons->index == port->line) { 542 if (port->cons && port->cons->index == port->line) {
538 if (!port->sysrq) { 543 if (!port->sysrq) {
diff --git a/include/linux/serial_sci.h b/include/linux/serial_sci.h
index 78779074f6e8..eb763adf9815 100644
--- a/include/linux/serial_sci.h
+++ b/include/linux/serial_sci.h
@@ -52,6 +52,8 @@ enum {
52/* SCSPTR, optional */ 52/* SCSPTR, optional */
53#define SCSPTR_RTSIO (1 << 7) 53#define SCSPTR_RTSIO (1 << 7)
54#define SCSPTR_CTSIO (1 << 5) 54#define SCSPTR_CTSIO (1 << 5)
55#define SCSPTR_SPB2IO (1 << 1)
56#define SCSPTR_SPB2DT (1 << 0)
55 57
56/* Offsets into the sci_port->irqs array */ 58/* Offsets into the sci_port->irqs array */
57enum { 59enum {
diff --git a/include/linux/serio.h b/include/linux/serio.h
index ca82861b0e46..6d6cfd3e94a3 100644
--- a/include/linux/serio.h
+++ b/include/linux/serio.h
@@ -96,6 +96,19 @@ int __must_check __serio_register_driver(struct serio_driver *drv,
96 96
97void serio_unregister_driver(struct serio_driver *drv); 97void serio_unregister_driver(struct serio_driver *drv);
98 98
99/**
100 * module_serio_driver() - Helper macro for registering a serio driver
101 * @__serio_driver: serio_driver struct
102 *
103 * Helper macro for serio drivers which do not do anything special in
104 * module init/exit. This eliminates a lot of boilerplate. Each module
105 * may only use this macro once, and calling it replaces module_init()
106 * and module_exit().
107 */
108#define module_serio_driver(__serio_driver) \
109 module_driver(__serio_driver, serio_register_driver, \
110 serio_unregister_driver)
111
99static inline int serio_write(struct serio *serio, unsigned char data) 112static inline int serio_write(struct serio *serio, unsigned char data)
100{ 113{
101 if (serio->write) 114 if (serio->write)
diff --git a/include/linux/sh_clk.h b/include/linux/sh_clk.h
index 0a9d8f2ac519..c513b73cd7cb 100644
--- a/include/linux/sh_clk.h
+++ b/include/linux/sh_clk.h
@@ -59,7 +59,15 @@ struct clk {
59 unsigned int nr_freqs; 59 unsigned int nr_freqs;
60}; 60};
61 61
62#define CLK_ENABLE_ON_INIT (1 << 0) 62#define CLK_ENABLE_ON_INIT BIT(0)
63
64#define CLK_ENABLE_REG_32BIT BIT(1) /* default access size */
65#define CLK_ENABLE_REG_16BIT BIT(2)
66#define CLK_ENABLE_REG_8BIT BIT(3)
67
68#define CLK_ENABLE_REG_MASK (CLK_ENABLE_REG_32BIT | \
69 CLK_ENABLE_REG_16BIT | \
70 CLK_ENABLE_REG_8BIT)
63 71
64/* drivers/sh/clk.c */ 72/* drivers/sh/clk.c */
65unsigned long followparent_recalc(struct clk *); 73unsigned long followparent_recalc(struct clk *);
@@ -102,7 +110,7 @@ long clk_round_parent(struct clk *clk, unsigned long target,
102 unsigned long *best_freq, unsigned long *parent_freq, 110 unsigned long *best_freq, unsigned long *parent_freq,
103 unsigned int div_min, unsigned int div_max); 111 unsigned int div_min, unsigned int div_max);
104 112
105#define SH_CLK_MSTP32(_parent, _enable_reg, _enable_bit, _flags) \ 113#define SH_CLK_MSTP(_parent, _enable_reg, _enable_bit, _flags) \
106{ \ 114{ \
107 .parent = _parent, \ 115 .parent = _parent, \
108 .enable_reg = (void __iomem *)_enable_reg, \ 116 .enable_reg = (void __iomem *)_enable_reg, \
@@ -110,7 +118,27 @@ long clk_round_parent(struct clk *clk, unsigned long target,
110 .flags = _flags, \ 118 .flags = _flags, \
111} 119}
112 120
113int sh_clk_mstp32_register(struct clk *clks, int nr); 121#define SH_CLK_MSTP32(_p, _r, _b, _f) \
122 SH_CLK_MSTP(_p, _r, _b, _f | CLK_ENABLE_REG_32BIT)
123
124#define SH_CLK_MSTP16(_p, _r, _b, _f) \
125 SH_CLK_MSTP(_p, _r, _b, _f | CLK_ENABLE_REG_16BIT)
126
127#define SH_CLK_MSTP8(_p, _r, _b, _f) \
128 SH_CLK_MSTP(_p, _r, _b, _f | CLK_ENABLE_REG_8BIT)
129
130int sh_clk_mstp_register(struct clk *clks, int nr);
131
132/*
133 * MSTP registration never really cared about access size, despite the
134 * original enable/disable pairs assuming a 32-bit access. Clocks are
135 * responsible for defining their access sizes either directly or via the
136 * clock definition wrappers.
137 */
138static inline int __deprecated sh_clk_mstp32_register(struct clk *clks, int nr)
139{
140 return sh_clk_mstp_register(clks, nr);
141}
114 142
115#define SH_CLK_DIV4(_parent, _reg, _shift, _div_bitmap, _flags) \ 143#define SH_CLK_DIV4(_parent, _reg, _shift, _div_bitmap, _flags) \
116{ \ 144{ \
diff --git a/include/linux/sh_intc.h b/include/linux/sh_intc.h
index 6aed0805927f..32383285da68 100644
--- a/include/linux/sh_intc.h
+++ b/include/linux/sh_intc.h
@@ -133,7 +133,6 @@ struct intc_desc symbol __initdata = { \
133} 133}
134 134
135int register_intc_controller(struct intc_desc *desc); 135int register_intc_controller(struct intc_desc *desc);
136void reserve_intc_vectors(struct intc_vect *vectors, unsigned int nr_vecs);
137int intc_set_priority(unsigned int irq, unsigned int prio); 136int intc_set_priority(unsigned int irq, unsigned int prio);
138int intc_irq_lookup(const char *chipname, intc_enum enum_id); 137int intc_irq_lookup(const char *chipname, intc_enum enum_id);
139void intc_finalize(void); 138void intc_finalize(void);
diff --git a/include/linux/shmem_fs.h b/include/linux/shmem_fs.h
index 79ab2555b3b0..bef2cf00b3be 100644
--- a/include/linux/shmem_fs.h
+++ b/include/linux/shmem_fs.h
@@ -28,8 +28,8 @@ struct shmem_sb_info {
28 unsigned long max_inodes; /* How many inodes are allowed */ 28 unsigned long max_inodes; /* How many inodes are allowed */
29 unsigned long free_inodes; /* How many are left for allocation */ 29 unsigned long free_inodes; /* How many are left for allocation */
30 spinlock_t stat_lock; /* Serialize shmem_sb_info changes */ 30 spinlock_t stat_lock; /* Serialize shmem_sb_info changes */
31 uid_t uid; /* Mount uid for root directory */ 31 kuid_t uid; /* Mount uid for root directory */
32 gid_t gid; /* Mount gid for root directory */ 32 kgid_t gid; /* Mount gid for root directory */
33 umode_t mode; /* Mount mode for root directory */ 33 umode_t mode; /* Mount mode for root directory */
34 struct mempolicy *mpol; /* default memory policy for mappings */ 34 struct mempolicy *mpol; /* default memory policy for mappings */
35}; 35};
diff --git a/include/linux/signal.h b/include/linux/signal.h
index 7987ce74874b..17046cc484bc 100644
--- a/include/linux/signal.h
+++ b/include/linux/signal.h
@@ -252,6 +252,7 @@ extern int do_sigtimedwait(const sigset_t *, siginfo_t *,
252extern int sigprocmask(int, sigset_t *, sigset_t *); 252extern int sigprocmask(int, sigset_t *, sigset_t *);
253extern void set_current_blocked(const sigset_t *); 253extern void set_current_blocked(const sigset_t *);
254extern int show_unhandled_signals; 254extern int show_unhandled_signals;
255extern int sigsuspend(sigset_t *);
255 256
256extern int get_signal_to_deliver(siginfo_t *info, struct k_sigaction *return_ka, struct pt_regs *regs, void *cookie); 257extern int get_signal_to_deliver(siginfo_t *info, struct k_sigaction *return_ka, struct pt_regs *regs, void *cookie);
257extern void block_sigmask(struct k_sigaction *ka, int signr); 258extern void block_sigmask(struct k_sigaction *ka, int signr);
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 775292a66fa4..0e501714d47f 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -117,11 +117,11 @@ struct nf_conntrack {
117 117
118#ifdef CONFIG_BRIDGE_NETFILTER 118#ifdef CONFIG_BRIDGE_NETFILTER
119struct nf_bridge_info { 119struct nf_bridge_info {
120 atomic_t use; 120 atomic_t use;
121 struct net_device *physindev; 121 unsigned int mask;
122 struct net_device *physoutdev; 122 struct net_device *physindev;
123 unsigned int mask; 123 struct net_device *physoutdev;
124 unsigned long data[32 / sizeof(unsigned long)]; 124 unsigned long data[32 / sizeof(unsigned long)];
125}; 125};
126#endif 126#endif
127 127
@@ -470,7 +470,8 @@ struct sk_buff {
470 __u8 wifi_acked_valid:1; 470 __u8 wifi_acked_valid:1;
471 __u8 wifi_acked:1; 471 __u8 wifi_acked:1;
472 __u8 no_fcs:1; 472 __u8 no_fcs:1;
473 /* 9/11 bit hole (depending on ndisc_nodetype presence) */ 473 __u8 head_frag:1;
474 /* 8/10 bit hole (depending on ndisc_nodetype presence) */
474 kmemcheck_bitfield_end(flags2); 475 kmemcheck_bitfield_end(flags2);
475 476
476#ifdef CONFIG_NET_DMA 477#ifdef CONFIG_NET_DMA
@@ -560,9 +561,15 @@ static inline struct rtable *skb_rtable(const struct sk_buff *skb)
560extern void kfree_skb(struct sk_buff *skb); 561extern void kfree_skb(struct sk_buff *skb);
561extern void consume_skb(struct sk_buff *skb); 562extern void consume_skb(struct sk_buff *skb);
562extern void __kfree_skb(struct sk_buff *skb); 563extern void __kfree_skb(struct sk_buff *skb);
564extern struct kmem_cache *skbuff_head_cache;
565
566extern void kfree_skb_partial(struct sk_buff *skb, bool head_stolen);
567extern bool skb_try_coalesce(struct sk_buff *to, struct sk_buff *from,
568 bool *fragstolen, int *delta_truesize);
569
563extern struct sk_buff *__alloc_skb(unsigned int size, 570extern struct sk_buff *__alloc_skb(unsigned int size,
564 gfp_t priority, int fclone, int node); 571 gfp_t priority, int fclone, int node);
565extern struct sk_buff *build_skb(void *data); 572extern struct sk_buff *build_skb(void *data, unsigned int frag_size);
566static inline struct sk_buff *alloc_skb(unsigned int size, 573static inline struct sk_buff *alloc_skb(unsigned int size,
567 gfp_t priority) 574 gfp_t priority)
568{ 575{
@@ -643,11 +650,21 @@ static inline unsigned char *skb_end_pointer(const struct sk_buff *skb)
643{ 650{
644 return skb->head + skb->end; 651 return skb->head + skb->end;
645} 652}
653
654static inline unsigned int skb_end_offset(const struct sk_buff *skb)
655{
656 return skb->end;
657}
646#else 658#else
647static inline unsigned char *skb_end_pointer(const struct sk_buff *skb) 659static inline unsigned char *skb_end_pointer(const struct sk_buff *skb)
648{ 660{
649 return skb->end; 661 return skb->end;
650} 662}
663
664static inline unsigned int skb_end_offset(const struct sk_buff *skb)
665{
666 return skb->end - skb->head;
667}
651#endif 668#endif
652 669
653/* Internal */ 670/* Internal */
@@ -881,10 +898,11 @@ static inline struct sk_buff *skb_unshare(struct sk_buff *skb,
881 */ 898 */
882static inline struct sk_buff *skb_peek(const struct sk_buff_head *list_) 899static inline struct sk_buff *skb_peek(const struct sk_buff_head *list_)
883{ 900{
884 struct sk_buff *list = ((const struct sk_buff *)list_)->next; 901 struct sk_buff *skb = list_->next;
885 if (list == (struct sk_buff *)list_) 902
886 list = NULL; 903 if (skb == (struct sk_buff *)list_)
887 return list; 904 skb = NULL;
905 return skb;
888} 906}
889 907
890/** 908/**
@@ -900,6 +918,7 @@ static inline struct sk_buff *skb_peek_next(struct sk_buff *skb,
900 const struct sk_buff_head *list_) 918 const struct sk_buff_head *list_)
901{ 919{
902 struct sk_buff *next = skb->next; 920 struct sk_buff *next = skb->next;
921
903 if (next == (struct sk_buff *)list_) 922 if (next == (struct sk_buff *)list_)
904 next = NULL; 923 next = NULL;
905 return next; 924 return next;
@@ -920,10 +939,12 @@ static inline struct sk_buff *skb_peek_next(struct sk_buff *skb,
920 */ 939 */
921static inline struct sk_buff *skb_peek_tail(const struct sk_buff_head *list_) 940static inline struct sk_buff *skb_peek_tail(const struct sk_buff_head *list_)
922{ 941{
923 struct sk_buff *list = ((const struct sk_buff *)list_)->prev; 942 struct sk_buff *skb = list_->prev;
924 if (list == (struct sk_buff *)list_) 943
925 list = NULL; 944 if (skb == (struct sk_buff *)list_)
926 return list; 945 skb = NULL;
946 return skb;
947
927} 948}
928 949
929/** 950/**
@@ -1020,7 +1041,7 @@ static inline void skb_queue_splice(const struct sk_buff_head *list,
1020} 1041}
1021 1042
1022/** 1043/**
1023 * skb_queue_splice - join two skb lists and reinitialise the emptied list 1044 * skb_queue_splice_init - join two skb lists and reinitialise the emptied list
1024 * @list: the new list to add 1045 * @list: the new list to add
1025 * @head: the place to add it in the first list 1046 * @head: the place to add it in the first list
1026 * 1047 *
@@ -1051,7 +1072,7 @@ static inline void skb_queue_splice_tail(const struct sk_buff_head *list,
1051} 1072}
1052 1073
1053/** 1074/**
1054 * skb_queue_splice_tail - join two skb lists and reinitialise the emptied list 1075 * skb_queue_splice_tail_init - join two skb lists and reinitialise the emptied list
1055 * @list: the new list to add 1076 * @list: the new list to add
1056 * @head: the place to add it in the first list 1077 * @head: the place to add it in the first list
1057 * 1078 *
@@ -1664,31 +1685,11 @@ static inline void __skb_queue_purge(struct sk_buff_head *list)
1664 kfree_skb(skb); 1685 kfree_skb(skb);
1665} 1686}
1666 1687
1667/** 1688extern void *netdev_alloc_frag(unsigned int fragsz);
1668 * __dev_alloc_skb - allocate an skbuff for receiving
1669 * @length: length to allocate
1670 * @gfp_mask: get_free_pages mask, passed to alloc_skb
1671 *
1672 * Allocate a new &sk_buff and assign it a usage count of one. The
1673 * buffer has unspecified headroom built in. Users should allocate
1674 * the headroom they think they need without accounting for the
1675 * built in space. The built in space is used for optimisations.
1676 *
1677 * %NULL is returned if there is no free memory.
1678 */
1679static inline struct sk_buff *__dev_alloc_skb(unsigned int length,
1680 gfp_t gfp_mask)
1681{
1682 struct sk_buff *skb = alloc_skb(length + NET_SKB_PAD, gfp_mask);
1683 if (likely(skb))
1684 skb_reserve(skb, NET_SKB_PAD);
1685 return skb;
1686}
1687
1688extern struct sk_buff *dev_alloc_skb(unsigned int length);
1689 1689
1690extern struct sk_buff *__netdev_alloc_skb(struct net_device *dev, 1690extern struct sk_buff *__netdev_alloc_skb(struct net_device *dev,
1691 unsigned int length, gfp_t gfp_mask); 1691 unsigned int length,
1692 gfp_t gfp_mask);
1692 1693
1693/** 1694/**
1694 * netdev_alloc_skb - allocate an skbuff for rx on a specific device 1695 * netdev_alloc_skb - allocate an skbuff for rx on a specific device
@@ -1704,11 +1705,25 @@ extern struct sk_buff *__netdev_alloc_skb(struct net_device *dev,
1704 * allocates memory it can be called from an interrupt. 1705 * allocates memory it can be called from an interrupt.
1705 */ 1706 */
1706static inline struct sk_buff *netdev_alloc_skb(struct net_device *dev, 1707static inline struct sk_buff *netdev_alloc_skb(struct net_device *dev,
1707 unsigned int length) 1708 unsigned int length)
1708{ 1709{
1709 return __netdev_alloc_skb(dev, length, GFP_ATOMIC); 1710 return __netdev_alloc_skb(dev, length, GFP_ATOMIC);
1710} 1711}
1711 1712
1713/* legacy helper around __netdev_alloc_skb() */
1714static inline struct sk_buff *__dev_alloc_skb(unsigned int length,
1715 gfp_t gfp_mask)
1716{
1717 return __netdev_alloc_skb(NULL, length, gfp_mask);
1718}
1719
1720/* legacy helper around netdev_alloc_skb() */
1721static inline struct sk_buff *dev_alloc_skb(unsigned int length)
1722{
1723 return netdev_alloc_skb(NULL, length);
1724}
1725
1726
1712static inline struct sk_buff *__netdev_alloc_skb_ip_align(struct net_device *dev, 1727static inline struct sk_buff *__netdev_alloc_skb_ip_align(struct net_device *dev,
1713 unsigned int length, gfp_t gfp) 1728 unsigned int length, gfp_t gfp)
1714{ 1729{
@@ -1963,8 +1978,8 @@ static inline int skb_add_data(struct sk_buff *skb,
1963 return -EFAULT; 1978 return -EFAULT;
1964} 1979}
1965 1980
1966static inline int skb_can_coalesce(struct sk_buff *skb, int i, 1981static inline bool skb_can_coalesce(struct sk_buff *skb, int i,
1967 const struct page *page, int off) 1982 const struct page *page, int off)
1968{ 1983{
1969 if (i) { 1984 if (i) {
1970 const struct skb_frag_struct *frag = &skb_shinfo(skb)->frags[i - 1]; 1985 const struct skb_frag_struct *frag = &skb_shinfo(skb)->frags[i - 1];
@@ -1972,7 +1987,7 @@ static inline int skb_can_coalesce(struct sk_buff *skb, int i,
1972 return page == skb_frag_page(frag) && 1987 return page == skb_frag_page(frag) &&
1973 off == frag->page_offset + skb_frag_size(frag); 1988 off == frag->page_offset + skb_frag_size(frag);
1974 } 1989 }
1975 return 0; 1990 return false;
1976} 1991}
1977 1992
1978static inline int __skb_linearize(struct sk_buff *skb) 1993static inline int __skb_linearize(struct sk_buff *skb)
@@ -2552,7 +2567,7 @@ static inline bool skb_is_recycleable(const struct sk_buff *skb, int skb_size)
2552 return false; 2567 return false;
2553 2568
2554 skb_size = SKB_DATA_ALIGN(skb_size + NET_SKB_PAD); 2569 skb_size = SKB_DATA_ALIGN(skb_size + NET_SKB_PAD);
2555 if (skb_end_pointer(skb) - skb->head < skb_size) 2570 if (skb_end_offset(skb) < skb_size)
2556 return false; 2571 return false;
2557 2572
2558 if (skb_shared(skb) || skb_cloned(skb)) 2573 if (skb_shared(skb) || skb_cloned(skb))
@@ -2560,5 +2575,19 @@ static inline bool skb_is_recycleable(const struct sk_buff *skb, int skb_size)
2560 2575
2561 return true; 2576 return true;
2562} 2577}
2578
2579/**
2580 * skb_head_is_locked - Determine if the skb->head is locked down
2581 * @skb: skb to check
2582 *
2583 * The head on skbs build around a head frag can be removed if they are
2584 * not cloned. This function returns true if the skb head is locked down
2585 * due to either being allocated via kmalloc, or by being a clone with
2586 * multiple references to the head.
2587 */
2588static inline bool skb_head_is_locked(const struct sk_buff *skb)
2589{
2590 return !skb->head_frag || skb_cloned(skb);
2591}
2563#endif /* __KERNEL__ */ 2592#endif /* __KERNEL__ */
2564#endif /* _LINUX_SKBUFF_H */ 2593#endif /* _LINUX_SKBUFF_H */
diff --git a/include/linux/smp.h b/include/linux/smp.h
index 10530d92c04b..717fb746c9a8 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -61,7 +61,7 @@ extern void smp_prepare_cpus(unsigned int max_cpus);
61/* 61/*
62 * Bring a CPU up 62 * Bring a CPU up
63 */ 63 */
64extern int __cpu_up(unsigned int cpunum); 64extern int __cpu_up(unsigned int cpunum, struct task_struct *tidle);
65 65
66/* 66/*
67 * Final polishing of CPUs 67 * Final polishing of CPUs
@@ -81,6 +81,8 @@ void __smp_call_function_single(int cpuid, struct call_single_data *data,
81int smp_call_function_any(const struct cpumask *mask, 81int smp_call_function_any(const struct cpumask *mask,
82 smp_call_func_t func, void *info, int wait); 82 smp_call_func_t func, void *info, int wait);
83 83
84void kick_all_cpus_sync(void);
85
84/* 86/*
85 * Generic and arch helpers 87 * Generic and arch helpers
86 */ 88 */
@@ -192,6 +194,8 @@ smp_call_function_any(const struct cpumask *mask, smp_call_func_t func,
192 return smp_call_function_single(0, func, info, wait); 194 return smp_call_function_single(0, func, info, wait);
193} 195}
194 196
197static inline void kick_all_cpus_sync(void) { }
198
195#endif /* !SMP */ 199#endif /* !SMP */
196 200
197/* 201/*
diff --git a/include/linux/sock_diag.h b/include/linux/sock_diag.h
index 251729a47880..db4bae78bda9 100644
--- a/include/linux/sock_diag.h
+++ b/include/linux/sock_diag.h
@@ -32,8 +32,8 @@ struct sock_diag_handler {
32 int (*dump)(struct sk_buff *skb, struct nlmsghdr *nlh); 32 int (*dump)(struct sk_buff *skb, struct nlmsghdr *nlh);
33}; 33};
34 34
35int sock_diag_register(struct sock_diag_handler *h); 35int sock_diag_register(const struct sock_diag_handler *h);
36void sock_diag_unregister(struct sock_diag_handler *h); 36void sock_diag_unregister(const struct sock_diag_handler *h);
37 37
38void sock_diag_register_inet_compat(int (*fn)(struct sk_buff *skb, struct nlmsghdr *nlh)); 38void sock_diag_register_inet_compat(int (*fn)(struct sk_buff *skb, struct nlmsghdr *nlh));
39void sock_diag_unregister_inet_compat(int (*fn)(struct sk_buff *skb, struct nlmsghdr *nlh)); 39void sock_diag_unregister_inet_compat(int (*fn)(struct sk_buff *skb, struct nlmsghdr *nlh));
diff --git a/include/linux/socket.h b/include/linux/socket.h
index b84bbd48b874..25d6322fb635 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -68,13 +68,13 @@ struct msghdr {
68 __kernel_size_t msg_iovlen; /* Number of blocks */ 68 __kernel_size_t msg_iovlen; /* Number of blocks */
69 void * msg_control; /* Per protocol magic (eg BSD file descriptor passing) */ 69 void * msg_control; /* Per protocol magic (eg BSD file descriptor passing) */
70 __kernel_size_t msg_controllen; /* Length of cmsg list */ 70 __kernel_size_t msg_controllen; /* Length of cmsg list */
71 unsigned msg_flags; 71 unsigned int msg_flags;
72}; 72};
73 73
74/* For recvmmsg/sendmmsg */ 74/* For recvmmsg/sendmmsg */
75struct mmsghdr { 75struct mmsghdr {
76 struct msghdr msg_hdr; 76 struct msghdr msg_hdr;
77 unsigned msg_len; 77 unsigned int msg_len;
78}; 78};
79 79
80/* 80/*
diff --git a/include/linux/spi/eeprom.h b/include/linux/spi/eeprom.h
index 306e7b1c69ed..403e007aef68 100644
--- a/include/linux/spi/eeprom.h
+++ b/include/linux/spi/eeprom.h
@@ -20,6 +20,16 @@ struct spi_eeprom {
20#define EE_ADDR3 0x0004 /* 24 bit addrs */ 20#define EE_ADDR3 0x0004 /* 24 bit addrs */
21#define EE_READONLY 0x0008 /* disallow writes */ 21#define EE_READONLY 0x0008 /* disallow writes */
22 22
23 /*
24 * Certain EEPROMS have a size that is larger than the number of address
25 * bytes would allow (e.g. like M95040 from ST that has 512 Byte size
26 * but uses only one address byte (A0 to A7) for addressing.) For
27 * the extra address bit (A8, A16 or A24) bit 3 of the instruction byte
28 * is used. This instruction bit is normally defined as don't care for
29 * other AT25 like chips.
30 */
31#define EE_INSTR_BIT3_IS_ADDR 0x0010
32
23 /* for exporting this chip's data to other kernel code */ 33 /* for exporting this chip's data to other kernel code */
24 void (*setup)(struct memory_accessor *mem, void *context); 34 void (*setup)(struct memory_accessor *mem, void *context);
25 void *context; 35 void *context;
diff --git a/include/linux/spi/orion_spi.h b/include/linux/spi/orion_spi.h
deleted file mode 100644
index b4d9fa6f797c..000000000000
--- a/include/linux/spi/orion_spi.h
+++ /dev/null
@@ -1,17 +0,0 @@
1/*
2 * orion_spi.h
3 *
4 * This file is licensed under the terms of the GNU General Public
5 * License version 2. This program is licensed "as is" without any
6 * warranty of any kind, whether express or implied.
7 */
8
9#ifndef __LINUX_SPI_ORION_SPI_H
10#define __LINUX_SPI_ORION_SPI_H
11
12struct orion_spi_info {
13 u32 tclk; /* no <linux/clk.h> support yet */
14};
15
16
17#endif
diff --git a/include/linux/spi/rspi.h b/include/linux/spi/rspi.h
new file mode 100644
index 000000000000..900f0e328235
--- /dev/null
+++ b/include/linux/spi/rspi.h
@@ -0,0 +1,31 @@
1/*
2 * Renesas SPI driver
3 *
4 * Copyright (C) 2012 Renesas Solutions Corp.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 *
19 */
20
21#ifndef __LINUX_SPI_RENESAS_SPI_H__
22#define __LINUX_SPI_RENESAS_SPI_H__
23
24struct rspi_plat_data {
25 unsigned int dma_tx_id;
26 unsigned int dma_rx_id;
27
28 unsigned dma_width_16bit:1; /* DMAC read/write width = 16-bit */
29};
30
31#endif
diff --git a/include/linux/srcu.h b/include/linux/srcu.h
index d3d5fa54f25e..55a5c52cbb25 100644
--- a/include/linux/srcu.h
+++ b/include/linux/srcu.h
@@ -29,26 +29,35 @@
29 29
30#include <linux/mutex.h> 30#include <linux/mutex.h>
31#include <linux/rcupdate.h> 31#include <linux/rcupdate.h>
32#include <linux/workqueue.h>
32 33
33struct srcu_struct_array { 34struct srcu_struct_array {
34 int c[2]; 35 unsigned long c[2];
36 unsigned long seq[2];
37};
38
39struct rcu_batch {
40 struct rcu_head *head, **tail;
35}; 41};
36 42
37struct srcu_struct { 43struct srcu_struct {
38 int completed; 44 unsigned completed;
39 struct srcu_struct_array __percpu *per_cpu_ref; 45 struct srcu_struct_array __percpu *per_cpu_ref;
40 struct mutex mutex; 46 spinlock_t queue_lock; /* protect ->batch_queue, ->running */
47 bool running;
48 /* callbacks just queued */
49 struct rcu_batch batch_queue;
50 /* callbacks try to do the first check_zero */
51 struct rcu_batch batch_check0;
52 /* callbacks done with the first check_zero and the flip */
53 struct rcu_batch batch_check1;
54 struct rcu_batch batch_done;
55 struct delayed_work work;
41#ifdef CONFIG_DEBUG_LOCK_ALLOC 56#ifdef CONFIG_DEBUG_LOCK_ALLOC
42 struct lockdep_map dep_map; 57 struct lockdep_map dep_map;
43#endif /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */ 58#endif /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */
44}; 59};
45 60
46#ifndef CONFIG_PREEMPT
47#define srcu_barrier() barrier()
48#else /* #ifndef CONFIG_PREEMPT */
49#define srcu_barrier()
50#endif /* #else #ifndef CONFIG_PREEMPT */
51
52#ifdef CONFIG_DEBUG_LOCK_ALLOC 61#ifdef CONFIG_DEBUG_LOCK_ALLOC
53 62
54int __init_srcu_struct(struct srcu_struct *sp, const char *name, 63int __init_srcu_struct(struct srcu_struct *sp, const char *name,
@@ -67,12 +76,33 @@ int init_srcu_struct(struct srcu_struct *sp);
67 76
68#endif /* #else #ifdef CONFIG_DEBUG_LOCK_ALLOC */ 77#endif /* #else #ifdef CONFIG_DEBUG_LOCK_ALLOC */
69 78
79/**
80 * call_srcu() - Queue a callback for invocation after an SRCU grace period
81 * @sp: srcu_struct in queue the callback
82 * @head: structure to be used for queueing the SRCU callback.
83 * @func: function to be invoked after the SRCU grace period
84 *
85 * The callback function will be invoked some time after a full SRCU
86 * grace period elapses, in other words after all pre-existing SRCU
87 * read-side critical sections have completed. However, the callback
88 * function might well execute concurrently with other SRCU read-side
89 * critical sections that started after call_srcu() was invoked. SRCU
90 * read-side critical sections are delimited by srcu_read_lock() and
91 * srcu_read_unlock(), and may be nested.
92 *
93 * The callback will be invoked from process context, but must nevertheless
94 * be fast and must not block.
95 */
96void call_srcu(struct srcu_struct *sp, struct rcu_head *head,
97 void (*func)(struct rcu_head *head));
98
70void cleanup_srcu_struct(struct srcu_struct *sp); 99void cleanup_srcu_struct(struct srcu_struct *sp);
71int __srcu_read_lock(struct srcu_struct *sp) __acquires(sp); 100int __srcu_read_lock(struct srcu_struct *sp) __acquires(sp);
72void __srcu_read_unlock(struct srcu_struct *sp, int idx) __releases(sp); 101void __srcu_read_unlock(struct srcu_struct *sp, int idx) __releases(sp);
73void synchronize_srcu(struct srcu_struct *sp); 102void synchronize_srcu(struct srcu_struct *sp);
74void synchronize_srcu_expedited(struct srcu_struct *sp); 103void synchronize_srcu_expedited(struct srcu_struct *sp);
75long srcu_batches_completed(struct srcu_struct *sp); 104long srcu_batches_completed(struct srcu_struct *sp);
105void srcu_barrier(struct srcu_struct *sp);
76 106
77#ifdef CONFIG_DEBUG_LOCK_ALLOC 107#ifdef CONFIG_DEBUG_LOCK_ALLOC
78 108
diff --git a/include/linux/ssb/ssb.h b/include/linux/ssb/ssb.h
index d27683180025..bc14bd738ade 100644
--- a/include/linux/ssb/ssb.h
+++ b/include/linux/ssb/ssb.h
@@ -188,7 +188,6 @@ struct ssb_sprom {
188struct ssb_boardinfo { 188struct ssb_boardinfo {
189 u16 vendor; 189 u16 vendor;
190 u16 type; 190 u16 type;
191 u8 rev;
192}; 191};
193 192
194 193
diff --git a/include/linux/ssb/ssb_regs.h b/include/linux/ssb/ssb_regs.h
index 40b1ef8595ee..a0525019e1d1 100644
--- a/include/linux/ssb/ssb_regs.h
+++ b/include/linux/ssb/ssb_regs.h
@@ -228,6 +228,7 @@
228#define SSB_SPROM1_AGAIN_BG_SHIFT 0 228#define SSB_SPROM1_AGAIN_BG_SHIFT 0
229#define SSB_SPROM1_AGAIN_A 0xFF00 /* A-PHY */ 229#define SSB_SPROM1_AGAIN_A 0xFF00 /* A-PHY */
230#define SSB_SPROM1_AGAIN_A_SHIFT 8 230#define SSB_SPROM1_AGAIN_A_SHIFT 8
231#define SSB_SPROM1_CCODE 0x0076
231 232
232/* SPROM Revision 2 (inherits from rev 1) */ 233/* SPROM Revision 2 (inherits from rev 1) */
233#define SSB_SPROM2_BFLHI 0x0038 /* Boardflags (high 16 bits) */ 234#define SSB_SPROM2_BFLHI 0x0038 /* Boardflags (high 16 bits) */
@@ -267,6 +268,7 @@
267#define SSB_SPROM3_OFDMGPO 0x107A /* G-PHY OFDM Power Offset (4 bytes, BigEndian) */ 268#define SSB_SPROM3_OFDMGPO 0x107A /* G-PHY OFDM Power Offset (4 bytes, BigEndian) */
268 269
269/* SPROM Revision 4 */ 270/* SPROM Revision 4 */
271#define SSB_SPROM4_BOARDREV 0x0042 /* Board revision */
270#define SSB_SPROM4_BFLLO 0x0044 /* Boardflags (low 16 bits) */ 272#define SSB_SPROM4_BFLLO 0x0044 /* Boardflags (low 16 bits) */
271#define SSB_SPROM4_BFLHI 0x0046 /* Board Flags Hi */ 273#define SSB_SPROM4_BFLHI 0x0046 /* Board Flags Hi */
272#define SSB_SPROM4_BFL2LO 0x0048 /* Board flags 2 (low 16 bits) */ 274#define SSB_SPROM4_BFL2LO 0x0048 /* Board flags 2 (low 16 bits) */
@@ -389,6 +391,11 @@
389#define SSB_SPROM8_GPIOB_P2 0x00FF /* Pin 2 */ 391#define SSB_SPROM8_GPIOB_P2 0x00FF /* Pin 2 */
390#define SSB_SPROM8_GPIOB_P3 0xFF00 /* Pin 3 */ 392#define SSB_SPROM8_GPIOB_P3 0xFF00 /* Pin 3 */
391#define SSB_SPROM8_GPIOB_P3_SHIFT 8 393#define SSB_SPROM8_GPIOB_P3_SHIFT 8
394#define SSB_SPROM8_LEDDC 0x009A
395#define SSB_SPROM8_LEDDC_ON 0xFF00 /* oncount */
396#define SSB_SPROM8_LEDDC_ON_SHIFT 8
397#define SSB_SPROM8_LEDDC_OFF 0x00FF /* offcount */
398#define SSB_SPROM8_LEDDC_OFF_SHIFT 0
392#define SSB_SPROM8_ANTAVAIL 0x009C /* Antenna available bitfields*/ 399#define SSB_SPROM8_ANTAVAIL 0x009C /* Antenna available bitfields*/
393#define SSB_SPROM8_ANTAVAIL_A 0xFF00 /* A-PHY bitfield */ 400#define SSB_SPROM8_ANTAVAIL_A 0xFF00 /* A-PHY bitfield */
394#define SSB_SPROM8_ANTAVAIL_A_SHIFT 8 401#define SSB_SPROM8_ANTAVAIL_A_SHIFT 8
@@ -404,6 +411,13 @@
404#define SSB_SPROM8_AGAIN2_SHIFT 0 411#define SSB_SPROM8_AGAIN2_SHIFT 0
405#define SSB_SPROM8_AGAIN3 0xFF00 /* Antenna 3 */ 412#define SSB_SPROM8_AGAIN3 0xFF00 /* Antenna 3 */
406#define SSB_SPROM8_AGAIN3_SHIFT 8 413#define SSB_SPROM8_AGAIN3_SHIFT 8
414#define SSB_SPROM8_TXRXC 0x00A2
415#define SSB_SPROM8_TXRXC_TXCHAIN 0x000f
416#define SSB_SPROM8_TXRXC_TXCHAIN_SHIFT 0
417#define SSB_SPROM8_TXRXC_RXCHAIN 0x00f0
418#define SSB_SPROM8_TXRXC_RXCHAIN_SHIFT 4
419#define SSB_SPROM8_TXRXC_SWITCH 0xff00
420#define SSB_SPROM8_TXRXC_SWITCH_SHIFT 8
407#define SSB_SPROM8_RSSIPARM2G 0x00A4 /* RSSI params for 2GHz */ 421#define SSB_SPROM8_RSSIPARM2G 0x00A4 /* RSSI params for 2GHz */
408#define SSB_SPROM8_RSSISMF2G 0x000F 422#define SSB_SPROM8_RSSISMF2G 0x000F
409#define SSB_SPROM8_RSSISMC2G 0x00F0 423#define SSB_SPROM8_RSSISMC2G 0x00F0
@@ -430,6 +444,7 @@
430#define SSB_SPROM8_TRI5GH_SHIFT 8 444#define SSB_SPROM8_TRI5GH_SHIFT 8
431#define SSB_SPROM8_RXPO 0x00AC /* RX power offsets */ 445#define SSB_SPROM8_RXPO 0x00AC /* RX power offsets */
432#define SSB_SPROM8_RXPO2G 0x00FF /* 2GHz RX power offset */ 446#define SSB_SPROM8_RXPO2G 0x00FF /* 2GHz RX power offset */
447#define SSB_SPROM8_RXPO2G_SHIFT 0
433#define SSB_SPROM8_RXPO5G 0xFF00 /* 5GHz RX power offset */ 448#define SSB_SPROM8_RXPO5G 0xFF00 /* 5GHz RX power offset */
434#define SSB_SPROM8_RXPO5G_SHIFT 8 449#define SSB_SPROM8_RXPO5G_SHIFT 8
435#define SSB_SPROM8_FEM2G 0x00AE 450#define SSB_SPROM8_FEM2G 0x00AE
@@ -445,10 +460,38 @@
445#define SSB_SROM8_FEM_ANTSWLUT 0xF800 460#define SSB_SROM8_FEM_ANTSWLUT 0xF800
446#define SSB_SROM8_FEM_ANTSWLUT_SHIFT 11 461#define SSB_SROM8_FEM_ANTSWLUT_SHIFT 11
447#define SSB_SPROM8_THERMAL 0x00B2 462#define SSB_SPROM8_THERMAL 0x00B2
448#define SSB_SPROM8_MPWR_RAWTS 0x00B4 463#define SSB_SPROM8_THERMAL_OFFSET 0x00ff
449#define SSB_SPROM8_TS_SLP_OPT_CORRX 0x00B6 464#define SSB_SPROM8_THERMAL_OFFSET_SHIFT 0
450#define SSB_SPROM8_FOC_HWIQ_IQSWP 0x00B8 465#define SSB_SPROM8_THERMAL_TRESH 0xff00
451#define SSB_SPROM8_PHYCAL_TEMPDELTA 0x00BA 466#define SSB_SPROM8_THERMAL_TRESH_SHIFT 8
467/* Temp sense related entries */
468#define SSB_SPROM8_RAWTS 0x00B4
469#define SSB_SPROM8_RAWTS_RAWTEMP 0x01ff
470#define SSB_SPROM8_RAWTS_RAWTEMP_SHIFT 0
471#define SSB_SPROM8_RAWTS_MEASPOWER 0xfe00
472#define SSB_SPROM8_RAWTS_MEASPOWER_SHIFT 9
473#define SSB_SPROM8_OPT_CORRX 0x00B6
474#define SSB_SPROM8_OPT_CORRX_TEMP_SLOPE 0x00ff
475#define SSB_SPROM8_OPT_CORRX_TEMP_SLOPE_SHIFT 0
476#define SSB_SPROM8_OPT_CORRX_TEMPCORRX 0xfc00
477#define SSB_SPROM8_OPT_CORRX_TEMPCORRX_SHIFT 10
478#define SSB_SPROM8_OPT_CORRX_TEMP_OPTION 0x0300
479#define SSB_SPROM8_OPT_CORRX_TEMP_OPTION_SHIFT 8
480/* FOC: freiquency offset correction, HWIQ: H/W IOCAL enable, IQSWP: IQ CAL swap disable */
481#define SSB_SPROM8_HWIQ_IQSWP 0x00B8
482#define SSB_SPROM8_HWIQ_IQSWP_FREQ_CORR 0x000f
483#define SSB_SPROM8_HWIQ_IQSWP_FREQ_CORR_SHIFT 0
484#define SSB_SPROM8_HWIQ_IQSWP_IQCAL_SWP 0x0010
485#define SSB_SPROM8_HWIQ_IQSWP_IQCAL_SWP_SHIFT 4
486#define SSB_SPROM8_HWIQ_IQSWP_HW_IQCAL 0x0020
487#define SSB_SPROM8_HWIQ_IQSWP_HW_IQCAL_SHIFT 5
488#define SSB_SPROM8_TEMPDELTA 0x00BA
489#define SSB_SPROM8_TEMPDELTA_PHYCAL 0x00ff
490#define SSB_SPROM8_TEMPDELTA_PHYCAL_SHIFT 0
491#define SSB_SPROM8_TEMPDELTA_PERIOD 0x0f00
492#define SSB_SPROM8_TEMPDELTA_PERIOD_SHIFT 8
493#define SSB_SPROM8_TEMPDELTA_HYSTERESIS 0xf000
494#define SSB_SPROM8_TEMPDELTA_HYSTERESIS_SHIFT 12
452 495
453/* There are 4 blocks with power info sharing the same layout */ 496/* There are 4 blocks with power info sharing the same layout */
454#define SSB_SROM8_PWR_INFO_CORE0 0x00C0 497#define SSB_SROM8_PWR_INFO_CORE0 0x00C0
@@ -513,6 +556,16 @@
513#define SSB_SPROM8_OFDM5GLPO 0x014A /* 5.2GHz OFDM power offset */ 556#define SSB_SPROM8_OFDM5GLPO 0x014A /* 5.2GHz OFDM power offset */
514#define SSB_SPROM8_OFDM5GHPO 0x014E /* 5.8GHz OFDM power offset */ 557#define SSB_SPROM8_OFDM5GHPO 0x014E /* 5.8GHz OFDM power offset */
515 558
559#define SSB_SPROM8_2G_MCSPO 0x0152
560#define SSB_SPROM8_5G_MCSPO 0x0162
561#define SSB_SPROM8_5GL_MCSPO 0x0172
562#define SSB_SPROM8_5GH_MCSPO 0x0182
563
564#define SSB_SPROM8_CDDPO 0x0192
565#define SSB_SPROM8_STBCPO 0x0194
566#define SSB_SPROM8_BW40PO 0x0196
567#define SSB_SPROM8_BWDUPPO 0x0198
568
516/* Values for boardflags_lo read from SPROM */ 569/* Values for boardflags_lo read from SPROM */
517#define SSB_BFL_BTCOEXIST 0x0001 /* implements Bluetooth coexistance */ 570#define SSB_BFL_BTCOEXIST 0x0001 /* implements Bluetooth coexistance */
518#define SSB_BFL_PACTRL 0x0002 /* GPIO 9 controlling the PA */ 571#define SSB_BFL_PACTRL 0x0002 /* GPIO 9 controlling the PA */
diff --git a/include/linux/stat.h b/include/linux/stat.h
index 611c398dab72..46132409a3f7 100644
--- a/include/linux/stat.h
+++ b/include/linux/stat.h
@@ -58,14 +58,15 @@
58 58
59#include <linux/types.h> 59#include <linux/types.h>
60#include <linux/time.h> 60#include <linux/time.h>
61#include <linux/uidgid.h>
61 62
62struct kstat { 63struct kstat {
63 u64 ino; 64 u64 ino;
64 dev_t dev; 65 dev_t dev;
65 umode_t mode; 66 umode_t mode;
66 unsigned int nlink; 67 unsigned int nlink;
67 uid_t uid; 68 kuid_t uid;
68 gid_t gid; 69 kgid_t gid;
69 dev_t rdev; 70 dev_t rdev;
70 loff_t size; 71 loff_t size;
71 struct timespec atime; 72 struct timespec atime;
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
index 0dddc9e42b6b..b69bdb1e08b6 100644
--- a/include/linux/stmmac.h
+++ b/include/linux/stmmac.h
@@ -28,6 +28,51 @@
28 28
29#include <linux/platform_device.h> 29#include <linux/platform_device.h>
30 30
31#define STMMAC_RX_COE_NONE 0
32#define STMMAC_RX_COE_TYPE1 1
33#define STMMAC_RX_COE_TYPE2 2
34
35/* Define the macros for CSR clock range parameters to be passed by
36 * platform code.
37 * This could also be configured at run time using CPU freq framework. */
38
39/* MDC Clock Selection define*/
40#define STMMAC_CSR_60_100M 0x0 /* MDC = clk_scr_i/42 */
41#define STMMAC_CSR_100_150M 0x1 /* MDC = clk_scr_i/62 */
42#define STMMAC_CSR_20_35M 0x2 /* MDC = clk_scr_i/16 */
43#define STMMAC_CSR_35_60M 0x3 /* MDC = clk_scr_i/26 */
44#define STMMAC_CSR_150_250M 0x4 /* MDC = clk_scr_i/102 */
45#define STMMAC_CSR_250_300M 0x5 /* MDC = clk_scr_i/122 */
46
47/* The MDC clock could be set higher than the IEEE 802.3
48 * specified frequency limit 0f 2.5 MHz, by programming a clock divider
49 * of value different than the above defined values. The resultant MDIO
50 * clock frequency of 12.5 MHz is applicable for the interfacing chips
51 * supporting higher MDC clocks.
52 * The MDC clock selection macros need to be defined for MDC clock rate
53 * of 12.5 MHz, corresponding to the following selection.
54 */
55#define STMMAC_CSR_I_4 0x8 /* clk_csr_i/4 */
56#define STMMAC_CSR_I_6 0x9 /* clk_csr_i/6 */
57#define STMMAC_CSR_I_8 0xA /* clk_csr_i/8 */
58#define STMMAC_CSR_I_10 0xB /* clk_csr_i/10 */
59#define STMMAC_CSR_I_12 0xC /* clk_csr_i/12 */
60#define STMMAC_CSR_I_14 0xD /* clk_csr_i/14 */
61#define STMMAC_CSR_I_16 0xE /* clk_csr_i/16 */
62#define STMMAC_CSR_I_18 0xF /* clk_csr_i/18 */
63
64/* AXI DMA Burst length suported */
65#define DMA_AXI_BLEN_4 (1 << 1)
66#define DMA_AXI_BLEN_8 (1 << 2)
67#define DMA_AXI_BLEN_16 (1 << 3)
68#define DMA_AXI_BLEN_32 (1 << 4)
69#define DMA_AXI_BLEN_64 (1 << 5)
70#define DMA_AXI_BLEN_128 (1 << 6)
71#define DMA_AXI_BLEN_256 (1 << 7)
72#define DMA_AXI_BLEN_ALL (DMA_AXI_BLEN_4 | DMA_AXI_BLEN_8 | DMA_AXI_BLEN_16 \
73 | DMA_AXI_BLEN_32 | DMA_AXI_BLEN_64 \
74 | DMA_AXI_BLEN_128 | DMA_AXI_BLEN_256)
75
31/* Platfrom data for platform device structure's platform_data field */ 76/* Platfrom data for platform device structure's platform_data field */
32 77
33struct stmmac_mdio_bus_data { 78struct stmmac_mdio_bus_data {
@@ -38,16 +83,25 @@ struct stmmac_mdio_bus_data {
38 int probed_phy_irq; 83 int probed_phy_irq;
39}; 84};
40 85
86struct stmmac_dma_cfg {
87 int pbl;
88 int fixed_burst;
89 int mixed_burst;
90 int burst_len;
91};
92
41struct plat_stmmacenet_data { 93struct plat_stmmacenet_data {
94 char *phy_bus_name;
42 int bus_id; 95 int bus_id;
43 int phy_addr; 96 int phy_addr;
44 int interface; 97 int interface;
45 struct stmmac_mdio_bus_data *mdio_bus_data; 98 struct stmmac_mdio_bus_data *mdio_bus_data;
46 int pbl; 99 struct stmmac_dma_cfg *dma_cfg;
47 int clk_csr; 100 int clk_csr;
48 int has_gmac; 101 int has_gmac;
49 int enh_desc; 102 int enh_desc;
50 int tx_coe; 103 int tx_coe;
104 int rx_coe;
51 int bugged_jumbo; 105 int bugged_jumbo;
52 int pmt; 106 int pmt;
53 int force_sf_dma_mode; 107 int force_sf_dma_mode;
@@ -56,6 +110,7 @@ struct plat_stmmacenet_data {
56 int (*init)(struct platform_device *pdev); 110 int (*init)(struct platform_device *pdev);
57 void (*exit)(struct platform_device *pdev); 111 void (*exit)(struct platform_device *pdev);
58 void *custom_cfg; 112 void *custom_cfg;
113 void *custom_data;
59 void *bsp_priv; 114 void *bsp_priv;
60}; 115};
61#endif 116#endif
diff --git a/include/linux/stmp_device.h b/include/linux/stmp_device.h
new file mode 100644
index 000000000000..6cf7ec9547cf
--- /dev/null
+++ b/include/linux/stmp_device.h
@@ -0,0 +1,20 @@
1/*
2 * basic functions for devices following the "stmp" style register layout
3 *
4 * Copyright (C) 2011 Wolfram Sang, Pengutronix e.K.
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
12#ifndef __STMP_DEVICE_H__
13#define __STMP_DEVICE_H__
14
15#define STMP_OFFSET_REG_SET 0x4
16#define STMP_OFFSET_REG_CLR 0x8
17#define STMP_OFFSET_REG_TOG 0xc
18
19extern int stmp_reset_block(void __iomem *);
20#endif /* __STMP_DEVICE_H__ */
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index ac1c114c499d..cd83059fb592 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -356,8 +356,9 @@ extern int unregister_pm_notifier(struct notifier_block *nb);
356extern bool events_check_enabled; 356extern bool events_check_enabled;
357 357
358extern bool pm_wakeup_pending(void); 358extern bool pm_wakeup_pending(void);
359extern bool pm_get_wakeup_count(unsigned int *count); 359extern bool pm_get_wakeup_count(unsigned int *count, bool block);
360extern bool pm_save_wakeup_count(unsigned int count); 360extern bool pm_save_wakeup_count(unsigned int count);
361extern void pm_wakep_autosleep_enabled(bool set);
361 362
362static inline void lock_system_sleep(void) 363static inline void lock_system_sleep(void)
363{ 364{
@@ -407,6 +408,17 @@ static inline void unlock_system_sleep(void) {}
407 408
408#endif /* !CONFIG_PM_SLEEP */ 409#endif /* !CONFIG_PM_SLEEP */
409 410
411#ifdef CONFIG_PM_AUTOSLEEP
412
413/* kernel/power/autosleep.c */
414void queue_up_suspend_work(void);
415
416#else /* !CONFIG_PM_AUTOSLEEP */
417
418static inline void queue_up_suspend_work(void) {}
419
420#endif /* !CONFIG_PM_AUTOSLEEP */
421
410#ifdef CONFIG_ARCH_SAVE_PAGE_KEYS 422#ifdef CONFIG_ARCH_SAVE_PAGE_KEYS
411/* 423/*
412 * The ARCH_SAVE_PAGE_KEYS functions can be used by an architecture 424 * The ARCH_SAVE_PAGE_KEYS functions can be used by an architecture
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index 0010009b2f00..381f06db2fe5 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -27,6 +27,7 @@ struct attribute {
27 const char *name; 27 const char *name;
28 umode_t mode; 28 umode_t mode;
29#ifdef CONFIG_DEBUG_LOCK_ALLOC 29#ifdef CONFIG_DEBUG_LOCK_ALLOC
30 bool ignore_lockdep:1;
30 struct lock_class_key *key; 31 struct lock_class_key *key;
31 struct lock_class_key skey; 32 struct lock_class_key skey;
32#endif 33#endif
@@ -80,6 +81,17 @@ struct attribute_group {
80 81
81#define __ATTR_NULL { .attr = { .name = NULL } } 82#define __ATTR_NULL { .attr = { .name = NULL } }
82 83
84#ifdef CONFIG_DEBUG_LOCK_ALLOC
85#define __ATTR_IGNORE_LOCKDEP(_name, _mode, _show, _store) { \
86 .attr = {.name = __stringify(_name), .mode = _mode, \
87 .ignore_lockdep = true }, \
88 .show = _show, \
89 .store = _store, \
90}
91#else
92#define __ATTR_IGNORE_LOCKDEP __ATTR
93#endif
94
83#define attr_name(_attr) (_attr).attr.name 95#define attr_name(_attr) (_attr).attr.name
84 96
85struct file; 97struct file;
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index b6c62d294380..4c5b63283377 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -106,6 +106,22 @@ enum {
106#define TCP_THIN_LINEAR_TIMEOUTS 16 /* Use linear timeouts for thin streams*/ 106#define TCP_THIN_LINEAR_TIMEOUTS 16 /* Use linear timeouts for thin streams*/
107#define TCP_THIN_DUPACK 17 /* Fast retrans. after 1 dupack */ 107#define TCP_THIN_DUPACK 17 /* Fast retrans. after 1 dupack */
108#define TCP_USER_TIMEOUT 18 /* How long for loss retry before timeout */ 108#define TCP_USER_TIMEOUT 18 /* How long for loss retry before timeout */
109#define TCP_REPAIR 19 /* TCP sock is under repair right now */
110#define TCP_REPAIR_QUEUE 20
111#define TCP_QUEUE_SEQ 21
112#define TCP_REPAIR_OPTIONS 22
113
114struct tcp_repair_opt {
115 __u32 opt_code;
116 __u32 opt_val;
117};
118
119enum {
120 TCP_NO_QUEUE,
121 TCP_RECV_QUEUE,
122 TCP_SEND_QUEUE,
123 TCP_QUEUES_NR,
124};
109 125
110/* for TCP_INFO socket option */ 126/* for TCP_INFO socket option */
111#define TCPI_OPT_TIMESTAMPS 1 127#define TCPI_OPT_TIMESTAMPS 1
@@ -353,7 +369,11 @@ struct tcp_sock {
353 u8 nonagle : 4,/* Disable Nagle algorithm? */ 369 u8 nonagle : 4,/* Disable Nagle algorithm? */
354 thin_lto : 1,/* Use linear timeouts for thin streams */ 370 thin_lto : 1,/* Use linear timeouts for thin streams */
355 thin_dupack : 1,/* Fast retransmit on first dupack */ 371 thin_dupack : 1,/* Fast retransmit on first dupack */
356 unused : 2; 372 repair : 1,
373 unused : 1;
374 u8 repair_queue;
375 u8 do_early_retrans:1,/* Enable RFC5827 early-retransmit */
376 early_retrans_delayed:1; /* Delayed ER timer installed */
357 377
358/* RTT measurement */ 378/* RTT measurement */
359 u32 srtt; /* smoothed round trip time << 3 */ 379 u32 srtt; /* smoothed round trip time << 3 */
@@ -406,7 +426,7 @@ struct tcp_sock {
406 426
407 struct sk_buff_head out_of_order_queue; /* Out of order segments go here */ 427 struct sk_buff_head out_of_order_queue; /* Out of order segments go here */
408 428
409 /* SACKs data, these 2 need to be together (see tcp_build_and_update_options) */ 429 /* SACKs data, these 2 need to be together (see tcp_options_write) */
410 struct tcp_sack_block duplicate_sack[1]; /* D-SACK block */ 430 struct tcp_sack_block duplicate_sack[1]; /* D-SACK block */
411 struct tcp_sack_block selective_acks[4]; /* The SACKS themselves*/ 431 struct tcp_sack_block selective_acks[4]; /* The SACKS themselves*/
412 432
diff --git a/include/linux/thread_info.h b/include/linux/thread_info.h
index 8d03f079688c..db78775eff3b 100644
--- a/include/linux/thread_info.h
+++ b/include/linux/thread_info.h
@@ -54,6 +54,12 @@ extern long do_no_restart_syscall(struct restart_block *parm);
54 54
55#ifdef __KERNEL__ 55#ifdef __KERNEL__
56 56
57#ifdef CONFIG_DEBUG_STACK_USAGE
58# define THREADINFO_GFP (GFP_KERNEL | __GFP_NOTRACK | __GFP_ZERO)
59#else
60# define THREADINFO_GFP (GFP_KERNEL | __GFP_NOTRACK)
61#endif
62
57/* 63/*
58 * flag set/clear/test wrappers 64 * flag set/clear/test wrappers
59 * - pass TIF_xxxx constants to these functions 65 * - pass TIF_xxxx constants to these functions
diff --git a/include/linux/ti_wilink_st.h b/include/linux/ti_wilink_st.h
index 2ef4385da6bf..3ca0269dd0b5 100644
--- a/include/linux/ti_wilink_st.h
+++ b/include/linux/ti_wilink_st.h
@@ -25,6 +25,8 @@
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 27
28#include <linux/skbuff.h>
29
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.
diff --git a/include/linux/time.h b/include/linux/time.h
index 33a92ead4d88..179f4d6755fc 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -167,7 +167,6 @@ extern void get_monotonic_boottime(struct timespec *ts);
167extern struct timespec timespec_trunc(struct timespec t, unsigned gran); 167extern struct timespec timespec_trunc(struct timespec t, unsigned gran);
168extern int timekeeping_valid_for_hres(void); 168extern int timekeeping_valid_for_hres(void);
169extern u64 timekeeping_max_deferment(void); 169extern u64 timekeeping_max_deferment(void);
170extern void timekeeping_leap_insert(int leapsecond);
171extern int timekeeping_inject_offset(struct timespec *ts); 170extern int timekeeping_inject_offset(struct timespec *ts);
172 171
173struct tms; 172struct tms;
diff --git a/include/linux/topology.h b/include/linux/topology.h
index e26db031303b..e91cd43394df 100644
--- a/include/linux/topology.h
+++ b/include/linux/topology.h
@@ -70,7 +70,6 @@ int arch_update_cpu_topology(void);
70 * Below are the 3 major initializers used in building sched_domains: 70 * Below are the 3 major initializers used in building sched_domains:
71 * SD_SIBLING_INIT, for SMT domains 71 * SD_SIBLING_INIT, for SMT domains
72 * SD_CPU_INIT, for SMP domains 72 * SD_CPU_INIT, for SMP domains
73 * SD_NODE_INIT, for NUMA domains
74 * 73 *
75 * Any architecture that cares to do any tuning to these values should do so 74 * Any architecture that cares to do any tuning to these values should do so
76 * by defining their own arch-specific initializer in include/asm/topology.h. 75 * by defining their own arch-specific initializer in include/asm/topology.h.
@@ -99,7 +98,6 @@ int arch_update_cpu_topology(void);
99 | 0*SD_BALANCE_WAKE \ 98 | 0*SD_BALANCE_WAKE \
100 | 1*SD_WAKE_AFFINE \ 99 | 1*SD_WAKE_AFFINE \
101 | 1*SD_SHARE_CPUPOWER \ 100 | 1*SD_SHARE_CPUPOWER \
102 | 0*SD_POWERSAVINGS_BALANCE \
103 | 1*SD_SHARE_PKG_RESOURCES \ 101 | 1*SD_SHARE_PKG_RESOURCES \
104 | 0*SD_SERIALIZE \ 102 | 0*SD_SERIALIZE \
105 | 0*SD_PREFER_SIBLING \ 103 | 0*SD_PREFER_SIBLING \
@@ -135,8 +133,6 @@ int arch_update_cpu_topology(void);
135 | 0*SD_SHARE_CPUPOWER \ 133 | 0*SD_SHARE_CPUPOWER \
136 | 1*SD_SHARE_PKG_RESOURCES \ 134 | 1*SD_SHARE_PKG_RESOURCES \
137 | 0*SD_SERIALIZE \ 135 | 0*SD_SERIALIZE \
138 | sd_balance_for_mc_power() \
139 | sd_power_saving_flags() \
140 , \ 136 , \
141 .last_balance = jiffies, \ 137 .last_balance = jiffies, \
142 .balance_interval = 1, \ 138 .balance_interval = 1, \
@@ -168,56 +164,18 @@ int arch_update_cpu_topology(void);
168 | 0*SD_SHARE_CPUPOWER \ 164 | 0*SD_SHARE_CPUPOWER \
169 | 0*SD_SHARE_PKG_RESOURCES \ 165 | 0*SD_SHARE_PKG_RESOURCES \
170 | 0*SD_SERIALIZE \ 166 | 0*SD_SERIALIZE \
171 | sd_balance_for_package_power() \
172 | sd_power_saving_flags() \
173 , \ 167 , \
174 .last_balance = jiffies, \ 168 .last_balance = jiffies, \
175 .balance_interval = 1, \ 169 .balance_interval = 1, \
176} 170}
177#endif 171#endif
178 172
179/* sched_domains SD_ALLNODES_INIT for NUMA machines */
180#define SD_ALLNODES_INIT (struct sched_domain) { \
181 .min_interval = 64, \
182 .max_interval = 64*num_online_cpus(), \
183 .busy_factor = 128, \
184 .imbalance_pct = 133, \
185 .cache_nice_tries = 1, \
186 .busy_idx = 3, \
187 .idle_idx = 3, \
188 .flags = 1*SD_LOAD_BALANCE \
189 | 1*SD_BALANCE_NEWIDLE \
190 | 0*SD_BALANCE_EXEC \
191 | 0*SD_BALANCE_FORK \
192 | 0*SD_BALANCE_WAKE \
193 | 0*SD_WAKE_AFFINE \
194 | 0*SD_SHARE_CPUPOWER \
195 | 0*SD_POWERSAVINGS_BALANCE \
196 | 0*SD_SHARE_PKG_RESOURCES \
197 | 1*SD_SERIALIZE \
198 | 0*SD_PREFER_SIBLING \
199 , \
200 .last_balance = jiffies, \
201 .balance_interval = 64, \
202}
203
204#ifndef SD_NODES_PER_DOMAIN
205#define SD_NODES_PER_DOMAIN 16
206#endif
207
208#ifdef CONFIG_SCHED_BOOK 173#ifdef CONFIG_SCHED_BOOK
209#ifndef SD_BOOK_INIT 174#ifndef SD_BOOK_INIT
210#error Please define an appropriate SD_BOOK_INIT in include/asm/topology.h!!! 175#error Please define an appropriate SD_BOOK_INIT in include/asm/topology.h!!!
211#endif 176#endif
212#endif /* CONFIG_SCHED_BOOK */ 177#endif /* CONFIG_SCHED_BOOK */
213 178
214#ifdef CONFIG_NUMA
215#ifndef SD_NODE_INIT
216#error Please define an appropriate SD_NODE_INIT in include/asm/topology.h!!!
217#endif
218
219#endif /* CONFIG_NUMA */
220
221#ifdef CONFIG_USE_PERCPU_NUMA_NODE_ID 179#ifdef CONFIG_USE_PERCPU_NUMA_NODE_ID
222DECLARE_PER_CPU(int, numa_node); 180DECLARE_PER_CPU(int, numa_node);
223 181
@@ -239,7 +197,7 @@ static inline int cpu_to_node(int cpu)
239#ifndef set_numa_node 197#ifndef set_numa_node
240static inline void set_numa_node(int node) 198static inline void set_numa_node(int node)
241{ 199{
242 percpu_write(numa_node, node); 200 this_cpu_write(numa_node, node);
243} 201}
244#endif 202#endif
245 203
@@ -274,7 +232,7 @@ DECLARE_PER_CPU(int, _numa_mem_);
274#ifndef set_numa_mem 232#ifndef set_numa_mem
275static inline void set_numa_mem(int node) 233static inline void set_numa_mem(int node)
276{ 234{
277 percpu_write(_numa_mem_, node); 235 this_cpu_write(_numa_mem_, node);
278} 236}
279#endif 237#endif
280 238
diff --git a/include/linux/trdevice.h b/include/linux/trdevice.h
deleted file mode 100644
index bfc84a7aecc5..000000000000
--- a/include/linux/trdevice.h
+++ /dev/null
@@ -1,37 +0,0 @@
1/*
2 * INET An implementation of the TCP/IP protocol suite for the LINUX
3 * operating system. NET is implemented using the BSD Socket
4 * interface as the means of communication with the user level.
5 *
6 * Definitions for the Token-ring handlers.
7 *
8 * Version: @(#)eth.h 1.0.4 05/13/93
9 *
10 * Authors: Ross Biro
11 * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
12 *
13 * Relocated to include/linux where it belongs by Alan Cox
14 * <gw4pts@gw4pts.ampr.org>
15 *
16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License
18 * as published by the Free Software Foundation; either version
19 * 2 of the License, or (at your option) any later version.
20 *
21 * WARNING: This move may well be temporary. This file will get merged with others RSN.
22 *
23 */
24#ifndef _LINUX_TRDEVICE_H
25#define _LINUX_TRDEVICE_H
26
27
28#include <linux/if_tr.h>
29
30#ifdef __KERNEL__
31extern __be16 tr_type_trans(struct sk_buff *skb, struct net_device *dev);
32extern void tr_source_route(struct sk_buff *skb, struct trh_hdr *trh, struct net_device *dev);
33extern struct net_device *alloc_trdev(int sizeof_priv);
34
35#endif
36
37#endif /* _LINUX_TRDEVICE_H */
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 9f47ab540f65..4990ef2b1fb7 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -268,6 +268,7 @@ struct tty_struct {
268 struct mutex ldisc_mutex; 268 struct mutex ldisc_mutex;
269 struct tty_ldisc *ldisc; 269 struct tty_ldisc *ldisc;
270 270
271 struct mutex legacy_mutex;
271 struct mutex termios_mutex; 272 struct mutex termios_mutex;
272 spinlock_t ctrl_lock; 273 spinlock_t ctrl_lock;
273 /* Termios values are protected by the termios mutex */ 274 /* Termios values are protected by the termios mutex */
@@ -605,8 +606,12 @@ extern long vt_compat_ioctl(struct tty_struct *tty,
605 606
606/* tty_mutex.c */ 607/* tty_mutex.c */
607/* functions for preparation of BKL removal */ 608/* functions for preparation of BKL removal */
608extern void __lockfunc tty_lock(void) __acquires(tty_lock); 609extern void __lockfunc tty_lock(struct tty_struct *tty);
609extern void __lockfunc tty_unlock(void) __releases(tty_lock); 610extern void __lockfunc tty_unlock(struct tty_struct *tty);
611extern void __lockfunc tty_lock_pair(struct tty_struct *tty,
612 struct tty_struct *tty2);
613extern void __lockfunc tty_unlock_pair(struct tty_struct *tty,
614 struct tty_struct *tty2);
610 615
611/* 616/*
612 * this shall be called only from where BTM is held (like close) 617 * this shall be called only from where BTM is held (like close)
@@ -621,9 +626,9 @@ extern void __lockfunc tty_unlock(void) __releases(tty_lock);
621static inline void tty_wait_until_sent_from_close(struct tty_struct *tty, 626static inline void tty_wait_until_sent_from_close(struct tty_struct *tty,
622 long timeout) 627 long timeout)
623{ 628{
624 tty_unlock(); /* tty->ops->close holds the BTM, drop it while waiting */ 629 tty_unlock(tty); /* tty->ops->close holds the BTM, drop it while waiting */
625 tty_wait_until_sent(tty, timeout); 630 tty_wait_until_sent(tty, timeout);
626 tty_lock(); 631 tty_lock(tty);
627} 632}
628 633
629/* 634/*
@@ -638,16 +643,16 @@ static inline void tty_wait_until_sent_from_close(struct tty_struct *tty,
638 * 643 *
639 * Do not use in new code. 644 * Do not use in new code.
640 */ 645 */
641#define wait_event_interruptible_tty(wq, condition) \ 646#define wait_event_interruptible_tty(tty, wq, condition) \
642({ \ 647({ \
643 int __ret = 0; \ 648 int __ret = 0; \
644 if (!(condition)) { \ 649 if (!(condition)) { \
645 __wait_event_interruptible_tty(wq, condition, __ret); \ 650 __wait_event_interruptible_tty(tty, wq, condition, __ret); \
646 } \ 651 } \
647 __ret; \ 652 __ret; \
648}) 653})
649 654
650#define __wait_event_interruptible_tty(wq, condition, ret) \ 655#define __wait_event_interruptible_tty(tty, wq, condition, ret) \
651do { \ 656do { \
652 DEFINE_WAIT(__wait); \ 657 DEFINE_WAIT(__wait); \
653 \ 658 \
@@ -656,9 +661,9 @@ do { \
656 if (condition) \ 661 if (condition) \
657 break; \ 662 break; \
658 if (!signal_pending(current)) { \ 663 if (!signal_pending(current)) { \
659 tty_unlock(); \ 664 tty_unlock(tty); \
660 schedule(); \ 665 schedule(); \
661 tty_lock(); \ 666 tty_lock(tty); \
662 continue; \ 667 continue; \
663 } \ 668 } \
664 ret = -ERESTARTSYS; \ 669 ret = -ERESTARTSYS; \
diff --git a/include/linux/tty_ldisc.h b/include/linux/tty_ldisc.h
index ff7dc08696a8..fb79dd8d1537 100644
--- a/include/linux/tty_ldisc.h
+++ b/include/linux/tty_ldisc.h
@@ -110,6 +110,7 @@
110#include <linux/fs.h> 110#include <linux/fs.h>
111#include <linux/wait.h> 111#include <linux/wait.h>
112#include <linux/pps_kernel.h> 112#include <linux/pps_kernel.h>
113#include <linux/wait.h>
113 114
114struct tty_ldisc_ops { 115struct tty_ldisc_ops {
115 int magic; 116 int magic;
@@ -154,6 +155,7 @@ struct tty_ldisc_ops {
154struct tty_ldisc { 155struct tty_ldisc {
155 struct tty_ldisc_ops *ops; 156 struct tty_ldisc_ops *ops;
156 atomic_t users; 157 atomic_t users;
158 wait_queue_head_t wq_idle;
157}; 159};
158 160
159#define TTY_LDISC_MAGIC 0x5403 161#define TTY_LDISC_MAGIC 0x5403
diff --git a/include/linux/uidgid.h b/include/linux/uidgid.h
new file mode 100644
index 000000000000..8e522cbcef29
--- /dev/null
+++ b/include/linux/uidgid.h
@@ -0,0 +1,200 @@
1#ifndef _LINUX_UIDGID_H
2#define _LINUX_UIDGID_H
3
4/*
5 * A set of types for the internal kernel types representing uids and gids.
6 *
7 * The types defined in this header allow distinguishing which uids and gids in
8 * the kernel are values used by userspace and which uid and gid values are
9 * the internal kernel values. With the addition of user namespaces the values
10 * can be different. Using the type system makes it possible for the compiler
11 * to detect when we overlook these differences.
12 *
13 */
14#include <linux/types.h>
15#include <linux/highuid.h>
16
17struct user_namespace;
18extern struct user_namespace init_user_ns;
19
20#ifdef CONFIG_UIDGID_STRICT_TYPE_CHECKS
21
22typedef struct {
23 uid_t val;
24} kuid_t;
25
26
27typedef struct {
28 gid_t val;
29} kgid_t;
30
31#define KUIDT_INIT(value) (kuid_t){ value }
32#define KGIDT_INIT(value) (kgid_t){ value }
33
34static inline uid_t __kuid_val(kuid_t uid)
35{
36 return uid.val;
37}
38
39static inline gid_t __kgid_val(kgid_t gid)
40{
41 return gid.val;
42}
43
44#else
45
46typedef uid_t kuid_t;
47typedef gid_t kgid_t;
48
49static inline uid_t __kuid_val(kuid_t uid)
50{
51 return uid;
52}
53
54static inline gid_t __kgid_val(kgid_t gid)
55{
56 return gid;
57}
58
59#define KUIDT_INIT(value) ((kuid_t) value )
60#define KGIDT_INIT(value) ((kgid_t) value )
61
62#endif
63
64#define GLOBAL_ROOT_UID KUIDT_INIT(0)
65#define GLOBAL_ROOT_GID KGIDT_INIT(0)
66
67#define INVALID_UID KUIDT_INIT(-1)
68#define INVALID_GID KGIDT_INIT(-1)
69
70static inline bool uid_eq(kuid_t left, kuid_t right)
71{
72 return __kuid_val(left) == __kuid_val(right);
73}
74
75static inline bool gid_eq(kgid_t left, kgid_t right)
76{
77 return __kgid_val(left) == __kgid_val(right);
78}
79
80static inline bool uid_gt(kuid_t left, kuid_t right)
81{
82 return __kuid_val(left) > __kuid_val(right);
83}
84
85static inline bool gid_gt(kgid_t left, kgid_t right)
86{
87 return __kgid_val(left) > __kgid_val(right);
88}
89
90static inline bool uid_gte(kuid_t left, kuid_t right)
91{
92 return __kuid_val(left) >= __kuid_val(right);
93}
94
95static inline bool gid_gte(kgid_t left, kgid_t right)
96{
97 return __kgid_val(left) >= __kgid_val(right);
98}
99
100static inline bool uid_lt(kuid_t left, kuid_t right)
101{
102 return __kuid_val(left) < __kuid_val(right);
103}
104
105static inline bool gid_lt(kgid_t left, kgid_t right)
106{
107 return __kgid_val(left) < __kgid_val(right);
108}
109
110static inline bool uid_lte(kuid_t left, kuid_t right)
111{
112 return __kuid_val(left) <= __kuid_val(right);
113}
114
115static inline bool gid_lte(kgid_t left, kgid_t right)
116{
117 return __kgid_val(left) <= __kgid_val(right);
118}
119
120static inline bool uid_valid(kuid_t uid)
121{
122 return !uid_eq(uid, INVALID_UID);
123}
124
125static inline bool gid_valid(kgid_t gid)
126{
127 return !gid_eq(gid, INVALID_GID);
128}
129
130#ifdef CONFIG_USER_NS
131
132extern kuid_t make_kuid(struct user_namespace *from, uid_t uid);
133extern kgid_t make_kgid(struct user_namespace *from, gid_t gid);
134
135extern uid_t from_kuid(struct user_namespace *to, kuid_t uid);
136extern gid_t from_kgid(struct user_namespace *to, kgid_t gid);
137extern uid_t from_kuid_munged(struct user_namespace *to, kuid_t uid);
138extern gid_t from_kgid_munged(struct user_namespace *to, kgid_t gid);
139
140static inline bool kuid_has_mapping(struct user_namespace *ns, kuid_t uid)
141{
142 return from_kuid(ns, uid) != (uid_t) -1;
143}
144
145static inline bool kgid_has_mapping(struct user_namespace *ns, kgid_t gid)
146{
147 return from_kgid(ns, gid) != (gid_t) -1;
148}
149
150#else
151
152static inline kuid_t make_kuid(struct user_namespace *from, uid_t uid)
153{
154 return KUIDT_INIT(uid);
155}
156
157static inline kgid_t make_kgid(struct user_namespace *from, gid_t gid)
158{
159 return KGIDT_INIT(gid);
160}
161
162static inline uid_t from_kuid(struct user_namespace *to, kuid_t kuid)
163{
164 return __kuid_val(kuid);
165}
166
167static inline gid_t from_kgid(struct user_namespace *to, kgid_t kgid)
168{
169 return __kgid_val(kgid);
170}
171
172static inline uid_t from_kuid_munged(struct user_namespace *to, kuid_t kuid)
173{
174 uid_t uid = from_kuid(to, kuid);
175 if (uid == (uid_t)-1)
176 uid = overflowuid;
177 return uid;
178}
179
180static inline gid_t from_kgid_munged(struct user_namespace *to, kgid_t kgid)
181{
182 gid_t gid = from_kgid(to, kgid);
183 if (gid == (gid_t)-1)
184 gid = overflowgid;
185 return gid;
186}
187
188static inline bool kuid_has_mapping(struct user_namespace *ns, kuid_t uid)
189{
190 return true;
191}
192
193static inline bool kgid_has_mapping(struct user_namespace *ns, kgid_t gid)
194{
195 return true;
196}
197
198#endif /* CONFIG_USER_NS */
199
200#endif /* _LINUX_UIDGID_H */
diff --git a/include/linux/uprobes.h b/include/linux/uprobes.h
new file mode 100644
index 000000000000..efe4b3308c74
--- /dev/null
+++ b/include/linux/uprobes.h
@@ -0,0 +1,165 @@
1#ifndef _LINUX_UPROBES_H
2#define _LINUX_UPROBES_H
3/*
4 * User-space Probes (UProbes)
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 *
20 * Copyright (C) IBM Corporation, 2008-2012
21 * Authors:
22 * Srikar Dronamraju
23 * Jim Keniston
24 * Copyright (C) 2011-2012 Red Hat, Inc., Peter Zijlstra <pzijlstr@redhat.com>
25 */
26
27#include <linux/errno.h>
28#include <linux/rbtree.h>
29
30struct vm_area_struct;
31struct mm_struct;
32struct inode;
33
34#ifdef CONFIG_ARCH_SUPPORTS_UPROBES
35# include <asm/uprobes.h>
36#endif
37
38/* flags that denote/change uprobes behaviour */
39
40/* Have a copy of original instruction */
41#define UPROBE_COPY_INSN 0x1
42
43/* Dont run handlers when first register/ last unregister in progress*/
44#define UPROBE_RUN_HANDLER 0x2
45/* Can skip singlestep */
46#define UPROBE_SKIP_SSTEP 0x4
47
48struct uprobe_consumer {
49 int (*handler)(struct uprobe_consumer *self, struct pt_regs *regs);
50 /*
51 * filter is optional; If a filter exists, handler is run
52 * if and only if filter returns true.
53 */
54 bool (*filter)(struct uprobe_consumer *self, struct task_struct *task);
55
56 struct uprobe_consumer *next;
57};
58
59#ifdef CONFIG_UPROBES
60enum uprobe_task_state {
61 UTASK_RUNNING,
62 UTASK_BP_HIT,
63 UTASK_SSTEP,
64 UTASK_SSTEP_ACK,
65 UTASK_SSTEP_TRAPPED,
66};
67
68/*
69 * uprobe_task: Metadata of a task while it singlesteps.
70 */
71struct uprobe_task {
72 enum uprobe_task_state state;
73 struct arch_uprobe_task autask;
74
75 struct uprobe *active_uprobe;
76
77 unsigned long xol_vaddr;
78 unsigned long vaddr;
79};
80
81/*
82 * On a breakpoint hit, thread contests for a slot. It frees the
83 * slot after singlestep. Currently a fixed number of slots are
84 * allocated.
85 */
86struct xol_area {
87 wait_queue_head_t wq; /* if all slots are busy */
88 atomic_t slot_count; /* number of in-use slots */
89 unsigned long *bitmap; /* 0 = free slot */
90 struct page *page;
91
92 /*
93 * We keep the vma's vm_start rather than a pointer to the vma
94 * itself. The probed process or a naughty kernel module could make
95 * the vma go away, and we must handle that reasonably gracefully.
96 */
97 unsigned long vaddr; /* Page(s) of instruction slots */
98};
99
100struct uprobes_state {
101 struct xol_area *xol_area;
102 atomic_t count;
103};
104extern int __weak set_swbp(struct arch_uprobe *aup, struct mm_struct *mm, unsigned long vaddr);
105extern int __weak set_orig_insn(struct arch_uprobe *aup, struct mm_struct *mm, unsigned long vaddr, bool verify);
106extern bool __weak is_swbp_insn(uprobe_opcode_t *insn);
107extern int uprobe_register(struct inode *inode, loff_t offset, struct uprobe_consumer *uc);
108extern void uprobe_unregister(struct inode *inode, loff_t offset, struct uprobe_consumer *uc);
109extern int uprobe_mmap(struct vm_area_struct *vma);
110extern void uprobe_munmap(struct vm_area_struct *vma, unsigned long start, unsigned long end);
111extern void uprobe_free_utask(struct task_struct *t);
112extern void uprobe_copy_process(struct task_struct *t);
113extern unsigned long __weak uprobe_get_swbp_addr(struct pt_regs *regs);
114extern int uprobe_post_sstep_notifier(struct pt_regs *regs);
115extern int uprobe_pre_sstep_notifier(struct pt_regs *regs);
116extern void uprobe_notify_resume(struct pt_regs *regs);
117extern bool uprobe_deny_signal(void);
118extern bool __weak arch_uprobe_skip_sstep(struct arch_uprobe *aup, struct pt_regs *regs);
119extern void uprobe_clear_state(struct mm_struct *mm);
120extern void uprobe_reset_state(struct mm_struct *mm);
121#else /* !CONFIG_UPROBES */
122struct uprobes_state {
123};
124static inline int
125uprobe_register(struct inode *inode, loff_t offset, struct uprobe_consumer *uc)
126{
127 return -ENOSYS;
128}
129static inline void
130uprobe_unregister(struct inode *inode, loff_t offset, struct uprobe_consumer *uc)
131{
132}
133static inline int uprobe_mmap(struct vm_area_struct *vma)
134{
135 return 0;
136}
137static inline void
138uprobe_munmap(struct vm_area_struct *vma, unsigned long start, unsigned long end)
139{
140}
141static inline void uprobe_notify_resume(struct pt_regs *regs)
142{
143}
144static inline bool uprobe_deny_signal(void)
145{
146 return false;
147}
148static inline unsigned long uprobe_get_swbp_addr(struct pt_regs *regs)
149{
150 return 0;
151}
152static inline void uprobe_free_utask(struct task_struct *t)
153{
154}
155static inline void uprobe_copy_process(struct task_struct *t)
156{
157}
158static inline void uprobe_clear_state(struct mm_struct *mm)
159{
160}
161static inline void uprobe_reset_state(struct mm_struct *mm)
162{
163}
164#endif /* !CONFIG_UPROBES */
165#endif /* _LINUX_UPROBES_H */
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 73b68d1f2cb0..dea39dc551d4 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -351,10 +351,6 @@ struct usb_bus {
351 int bandwidth_int_reqs; /* number of Interrupt requests */ 351 int bandwidth_int_reqs; /* number of Interrupt requests */
352 int bandwidth_isoc_reqs; /* number of Isoc. requests */ 352 int bandwidth_isoc_reqs; /* number of Isoc. requests */
353 353
354#ifdef CONFIG_USB_DEVICEFS
355 struct dentry *usbfs_dentry; /* usbfs dentry entry for the bus */
356#endif
357
358#if defined(CONFIG_USB_MON) || defined(CONFIG_USB_MON_MODULE) 354#if defined(CONFIG_USB_MON) || defined(CONFIG_USB_MON_MODULE)
359 struct mon_bus *mon_bus; /* non-null when associated */ 355 struct mon_bus *mon_bus; /* non-null when associated */
360 int monitored; /* non-zero when monitored */ 356 int monitored; /* non-zero when monitored */
@@ -382,6 +378,45 @@ enum usb_device_removable {
382 USB_DEVICE_FIXED, 378 USB_DEVICE_FIXED,
383}; 379};
384 380
381/*
382 * USB 3.0 Link Power Management (LPM) parameters.
383 *
384 * PEL and SEL are USB 3.0 Link PM latencies for device-initiated LPM exit.
385 * MEL is the USB 3.0 Link PM latency for host-initiated LPM exit.
386 * All three are stored in nanoseconds.
387 */
388struct usb3_lpm_parameters {
389 /*
390 * Maximum exit latency (MEL) for the host to send a packet to the
391 * device (either a Ping for isoc endpoints, or a data packet for
392 * interrupt endpoints), the hubs to decode the packet, and for all hubs
393 * in the path to transition the links to U0.
394 */
395 unsigned int mel;
396 /*
397 * Maximum exit latency for a device-initiated LPM transition to bring
398 * all links into U0. Abbreviated as "PEL" in section 9.4.12 of the USB
399 * 3.0 spec, with no explanation of what "P" stands for. "Path"?
400 */
401 unsigned int pel;
402
403 /*
404 * The System Exit Latency (SEL) includes PEL, and three other
405 * latencies. After a device initiates a U0 transition, it will take
406 * some time from when the device sends the ERDY to when it will finally
407 * receive the data packet. Basically, SEL should be the worse-case
408 * latency from when a device starts initiating a U0 transition to when
409 * it will get data.
410 */
411 unsigned int sel;
412 /*
413 * The idle timeout value that is currently programmed into the parent
414 * hub for this device. When the timer counts to zero, the parent hub
415 * will initiate an LPM transition to either U1 or U2.
416 */
417 int timeout;
418};
419
385/** 420/**
386 * struct usb_device - kernel's representation of a USB device 421 * struct usb_device - kernel's representation of a USB device
387 * @devnum: device number; address on a USB bus 422 * @devnum: device number; address on a USB bus
@@ -439,6 +474,12 @@ enum usb_device_removable {
439 * specific data for the device. 474 * specific data for the device.
440 * @slot_id: Slot ID assigned by xHCI 475 * @slot_id: Slot ID assigned by xHCI
441 * @removable: Device can be physically removed from this port 476 * @removable: Device can be physically removed from this port
477 * @u1_params: exit latencies for USB3 U1 LPM state, and hub-initiated timeout.
478 * @u2_params: exit latencies for USB3 U2 LPM state, and hub-initiated timeout.
479 * @lpm_disable_count: Ref count used by usb_disable_lpm() and usb_enable_lpm()
480 * to keep track of the number of functions that require USB 3.0 Link Power
481 * Management to be disabled for this usb_device. This count should only
482 * be manipulated by those functions, with the bandwidth_mutex is held.
442 * 483 *
443 * Notes: 484 * Notes:
444 * Usbcore drivers should not set usbdev->state directly. Instead use 485 * Usbcore drivers should not set usbdev->state directly. Instead use
@@ -485,6 +526,7 @@ struct usb_device {
485 unsigned lpm_capable:1; 526 unsigned lpm_capable:1;
486 unsigned usb2_hw_lpm_capable:1; 527 unsigned usb2_hw_lpm_capable:1;
487 unsigned usb2_hw_lpm_enabled:1; 528 unsigned usb2_hw_lpm_enabled:1;
529 unsigned usb3_lpm_enabled:1;
488 int string_langid; 530 int string_langid;
489 531
490 /* static strings from the device */ 532 /* static strings from the device */
@@ -493,12 +535,6 @@ struct usb_device {
493 char *serial; 535 char *serial;
494 536
495 struct list_head filelist; 537 struct list_head filelist;
496#ifdef CONFIG_USB_DEVICE_CLASS
497 struct device *usb_classdev;
498#endif
499#ifdef CONFIG_USB_DEVICEFS
500 struct dentry *usbfs_dentry;
501#endif
502 538
503 int maxchild; 539 int maxchild;
504 struct usb_device **children; 540 struct usb_device **children;
@@ -517,6 +553,10 @@ struct usb_device {
517 struct wusb_dev *wusb_dev; 553 struct wusb_dev *wusb_dev;
518 int slot_id; 554 int slot_id;
519 enum usb_device_removable removable; 555 enum usb_device_removable removable;
556 struct usb3_lpm_parameters u1_params;
557 struct usb3_lpm_parameters u2_params;
558 unsigned lpm_disable_count;
559 unsigned hub_initiated_lpm_disable_count;
520}; 560};
521#define to_usb_device(d) container_of(d, struct usb_device, dev) 561#define to_usb_device(d) container_of(d, struct usb_device, dev)
522 562
@@ -583,6 +623,12 @@ static inline void usb_mark_last_busy(struct usb_device *udev)
583{ } 623{ }
584#endif 624#endif
585 625
626extern int usb_disable_lpm(struct usb_device *udev);
627extern void usb_enable_lpm(struct usb_device *udev);
628/* Same as above, but these functions lock/unlock the bandwidth_mutex. */
629extern int usb_unlocked_disable_lpm(struct usb_device *udev);
630extern void usb_unlocked_enable_lpm(struct usb_device *udev);
631
586/*-------------------------------------------------------------------------*/ 632/*-------------------------------------------------------------------------*/
587 633
588/* for drivers using iso endpoints */ 634/* for drivers using iso endpoints */
@@ -800,6 +846,8 @@ extern ssize_t usb_store_new_id(struct usb_dynids *dynids,
800 struct device_driver *driver, 846 struct device_driver *driver,
801 const char *buf, size_t count); 847 const char *buf, size_t count);
802 848
849extern ssize_t usb_show_dynids(struct usb_dynids *dynids, char *buf);
850
803/** 851/**
804 * struct usbdrv_wrap - wrapper for driver-model structure 852 * struct usbdrv_wrap - wrapper for driver-model structure
805 * @driver: The driver-model core driver structure. 853 * @driver: The driver-model core driver structure.
@@ -850,6 +898,9 @@ struct usbdrv_wrap {
850 * for interfaces bound to this driver. 898 * for interfaces bound to this driver.
851 * @soft_unbind: if set to 1, the USB core will not kill URBs and disable 899 * @soft_unbind: if set to 1, the USB core will not kill URBs and disable
852 * endpoints before calling the driver's disconnect method. 900 * endpoints before calling the driver's disconnect method.
901 * @disable_hub_initiated_lpm: if set to 0, the USB core will not allow hubs
902 * to initiate lower power link state transitions when an idle timeout
903 * occurs. Device-initiated USB 3.0 link PM will still be allowed.
853 * 904 *
854 * USB interface drivers must provide a name, probe() and disconnect() 905 * USB interface drivers must provide a name, probe() and disconnect()
855 * methods, and an id_table. Other driver fields are optional. 906 * methods, and an id_table. Other driver fields are optional.
@@ -890,6 +941,7 @@ struct usb_driver {
890 struct usbdrv_wrap drvwrap; 941 struct usbdrv_wrap drvwrap;
891 unsigned int no_dynamic_id:1; 942 unsigned int no_dynamic_id:1;
892 unsigned int supports_autosuspend:1; 943 unsigned int supports_autosuspend:1;
944 unsigned int disable_hub_initiated_lpm:1;
893 unsigned int soft_unbind:1; 945 unsigned int soft_unbind:1;
894}; 946};
895#define to_usb_driver(d) container_of(d, struct usb_driver, drvwrap.driver) 947#define to_usb_driver(d) container_of(d, struct usb_driver, drvwrap.driver)
@@ -1379,6 +1431,7 @@ extern int usb_unlink_urb(struct urb *urb);
1379extern void usb_kill_urb(struct urb *urb); 1431extern void usb_kill_urb(struct urb *urb);
1380extern void usb_poison_urb(struct urb *urb); 1432extern void usb_poison_urb(struct urb *urb);
1381extern void usb_unpoison_urb(struct urb *urb); 1433extern void usb_unpoison_urb(struct urb *urb);
1434extern void usb_block_urb(struct urb *urb);
1382extern void usb_kill_anchored_urbs(struct usb_anchor *anchor); 1435extern void usb_kill_anchored_urbs(struct usb_anchor *anchor);
1383extern void usb_poison_anchored_urbs(struct usb_anchor *anchor); 1436extern void usb_poison_anchored_urbs(struct usb_anchor *anchor);
1384extern void usb_unpoison_anchored_urbs(struct usb_anchor *anchor); 1437extern void usb_unpoison_anchored_urbs(struct usb_anchor *anchor);
@@ -1391,6 +1444,8 @@ extern struct urb *usb_get_from_anchor(struct usb_anchor *anchor);
1391extern void usb_scuttle_anchored_urbs(struct usb_anchor *anchor); 1444extern void usb_scuttle_anchored_urbs(struct usb_anchor *anchor);
1392extern int usb_anchor_empty(struct usb_anchor *anchor); 1445extern int usb_anchor_empty(struct usb_anchor *anchor);
1393 1446
1447#define usb_unblock_urb usb_unpoison_urb
1448
1394/** 1449/**
1395 * usb_urb_dir_in - check if an URB describes an IN transfer 1450 * usb_urb_dir_in - check if an URB describes an IN transfer
1396 * @urb: URB to be checked 1451 * @urb: URB to be checked
@@ -1627,6 +1682,7 @@ static inline int usb_translate_errors(int error_code)
1627 case 0: 1682 case 0:
1628 case -ENOMEM: 1683 case -ENOMEM:
1629 case -ENODEV: 1684 case -ENODEV:
1685 case -EOPNOTSUPP:
1630 return error_code; 1686 return error_code;
1631 default: 1687 default:
1632 return -EIO; 1688 return -EIO;
@@ -1652,9 +1708,6 @@ do { \
1652} while (0) 1708} while (0)
1653#endif 1709#endif
1654 1710
1655#define err(format, arg...) \
1656 printk(KERN_ERR KBUILD_MODNAME ": " format "\n", ##arg)
1657
1658/* debugfs stuff */ 1711/* debugfs stuff */
1659extern struct dentry *usb_debug_root; 1712extern struct dentry *usb_debug_root;
1660 1713
diff --git a/include/linux/usb/ch11.h b/include/linux/usb/ch11.h
index f1d26b6067f1..b6c2863b2c94 100644
--- a/include/linux/usb/ch11.h
+++ b/include/linux/usb/ch11.h
@@ -76,6 +76,8 @@
76#define USB_PORT_FEAT_C_BH_PORT_RESET 29 76#define USB_PORT_FEAT_C_BH_PORT_RESET 29
77#define USB_PORT_FEAT_FORCE_LINKPM_ACCEPT 30 77#define USB_PORT_FEAT_FORCE_LINKPM_ACCEPT 30
78 78
79#define USB_PORT_LPM_TIMEOUT(p) (((p) & 0xff) << 8)
80
79/* USB 3.0 hub remote wake mask bits, see table 10-14 */ 81/* USB 3.0 hub remote wake mask bits, see table 10-14 */
80#define USB_PORT_FEAT_REMOTE_WAKE_CONNECT (1 << 8) 82#define USB_PORT_FEAT_REMOTE_WAKE_CONNECT (1 << 8)
81#define USB_PORT_FEAT_REMOTE_WAKE_DISCONNECT (1 << 9) 83#define USB_PORT_FEAT_REMOTE_WAKE_DISCONNECT (1 << 9)
diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h
index af21f3115919..d1d732c2838d 100644
--- a/include/linux/usb/ch9.h
+++ b/include/linux/usb/ch9.h
@@ -88,6 +88,8 @@
88#define USB_REQ_GET_INTERFACE 0x0A 88#define USB_REQ_GET_INTERFACE 0x0A
89#define USB_REQ_SET_INTERFACE 0x0B 89#define USB_REQ_SET_INTERFACE 0x0B
90#define USB_REQ_SYNCH_FRAME 0x0C 90#define USB_REQ_SYNCH_FRAME 0x0C
91#define USB_REQ_SET_SEL 0x30
92#define USB_REQ_SET_ISOCH_DELAY 0x31
91 93
92#define USB_REQ_SET_ENCRYPTION 0x0D /* Wireless USB */ 94#define USB_REQ_SET_ENCRYPTION 0x0D /* Wireless USB */
93#define USB_REQ_GET_ENCRYPTION 0x0E 95#define USB_REQ_GET_ENCRYPTION 0x0E
@@ -390,6 +392,11 @@ struct usb_endpoint_descriptor {
390#define USB_ENDPOINT_XFER_INT 3 392#define USB_ENDPOINT_XFER_INT 3
391#define USB_ENDPOINT_MAX_ADJUSTABLE 0x80 393#define USB_ENDPOINT_MAX_ADJUSTABLE 0x80
392 394
395/* The USB 3.0 spec redefines bits 5:4 of bmAttributes as interrupt ep type. */
396#define USB_ENDPOINT_INTRTYPE 0x30
397#define USB_ENDPOINT_INTR_PERIODIC (0 << 4)
398#define USB_ENDPOINT_INTR_NOTIFICATION (1 << 4)
399
393#define USB_ENDPOINT_SYNCTYPE 0x0c 400#define USB_ENDPOINT_SYNCTYPE 0x0c
394#define USB_ENDPOINT_SYNC_NONE (0 << 2) 401#define USB_ENDPOINT_SYNC_NONE (0 << 2)
395#define USB_ENDPOINT_SYNC_ASYNC (1 << 2) 402#define USB_ENDPOINT_SYNC_ASYNC (1 << 2)
@@ -592,6 +599,12 @@ static inline int usb_endpoint_maxp(const struct usb_endpoint_descriptor *epd)
592 return __le16_to_cpu(epd->wMaxPacketSize); 599 return __le16_to_cpu(epd->wMaxPacketSize);
593} 600}
594 601
602static inline int usb_endpoint_interrupt_type(
603 const struct usb_endpoint_descriptor *epd)
604{
605 return epd->bmAttributes & USB_ENDPOINT_INTRTYPE;
606}
607
595/*-------------------------------------------------------------------------*/ 608/*-------------------------------------------------------------------------*/
596 609
597/* USB_DT_SS_ENDPOINT_COMP: SuperSpeed Endpoint Companion descriptor */ 610/* USB_DT_SS_ENDPOINT_COMP: SuperSpeed Endpoint Companion descriptor */
@@ -933,6 +946,51 @@ enum usb_device_state {
933 */ 946 */
934}; 947};
935 948
949enum usb3_link_state {
950 USB3_LPM_U0 = 0,
951 USB3_LPM_U1,
952 USB3_LPM_U2,
953 USB3_LPM_U3
954};
955
956/*
957 * A U1 timeout of 0x0 means the parent hub will reject any transitions to U1.
958 * 0xff means the parent hub will accept transitions to U1, but will not
959 * initiate a transition.
960 *
961 * A U1 timeout of 0x1 to 0x7F also causes the hub to initiate a transition to
962 * U1 after that many microseconds. Timeouts of 0x80 to 0xFE are reserved
963 * values.
964 *
965 * A U2 timeout of 0x0 means the parent hub will reject any transitions to U2.
966 * 0xff means the parent hub will accept transitions to U2, but will not
967 * initiate a transition.
968 *
969 * A U2 timeout of 0x1 to 0xFE also causes the hub to initiate a transition to
970 * U2 after N*256 microseconds. Therefore a U2 timeout value of 0x1 means a U2
971 * idle timer of 256 microseconds, 0x2 means 512 microseconds, 0xFE means
972 * 65.024ms.
973 */
974#define USB3_LPM_DISABLED 0x0
975#define USB3_LPM_U1_MAX_TIMEOUT 0x7F
976#define USB3_LPM_U2_MAX_TIMEOUT 0xFE
977#define USB3_LPM_DEVICE_INITIATED 0xFF
978
979struct usb_set_sel_req {
980 __u8 u1_sel;
981 __u8 u1_pel;
982 __le16 u2_sel;
983 __le16 u2_pel;
984} __attribute__ ((packed));
985
986/*
987 * The Set System Exit Latency control transfer provides one byte each for
988 * U1 SEL and U1 PEL, so the max exit latency is 0xFF. U2 SEL and U2 PEL each
989 * are two bytes long.
990 */
991#define USB3_LPM_MAX_U1_SEL_PEL 0xFF
992#define USB3_LPM_MAX_U2_SEL_PEL 0xFFFF
993
936/*-------------------------------------------------------------------------*/ 994/*-------------------------------------------------------------------------*/
937 995
938/* 996/*
diff --git a/include/linux/usb/chipidea.h b/include/linux/usb/chipidea.h
new file mode 100644
index 000000000000..edb90d6cfd12
--- /dev/null
+++ b/include/linux/usb/chipidea.h
@@ -0,0 +1,28 @@
1/*
2 * Platform data for the chipidea USB dual role controller
3 */
4
5#ifndef __LINUX_USB_CHIPIDEA_H
6#define __LINUX_USB_CHIPIDEA_H
7
8struct ci13xxx;
9struct ci13xxx_udc_driver {
10 const char *name;
11 /* offset of the capability registers */
12 uintptr_t capoffset;
13 unsigned power_budget;
14 unsigned long flags;
15#define CI13XXX_REGS_SHARED BIT(0)
16#define CI13XXX_REQUIRE_TRANSCEIVER BIT(1)
17#define CI13XXX_PULLUP_ON_VBUS BIT(2)
18#define CI13XXX_DISABLE_STREAMING BIT(3)
19
20#define CI13XXX_CONTROLLER_RESET_EVENT 0
21#define CI13XXX_CONTROLLER_STOPPED_EVENT 1
22 void (*notify_event) (struct ci13xxx *udc, unsigned event);
23};
24
25/* Default offset of capability registers */
26#define DEF_CAPOFFSET 0x100
27
28#endif
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h
index a316fba73518..9d8c3b634493 100644
--- a/include/linux/usb/composite.h
+++ b/include/linux/usb/composite.h
@@ -242,6 +242,9 @@ int usb_add_config(struct usb_composite_dev *,
242 struct usb_configuration *, 242 struct usb_configuration *,
243 int (*)(struct usb_configuration *)); 243 int (*)(struct usb_configuration *));
244 244
245void usb_remove_config(struct usb_composite_dev *,
246 struct usb_configuration *);
247
245/** 248/**
246 * struct usb_composite_driver - groups configurations into a gadget 249 * struct usb_composite_driver - groups configurations into a gadget
247 * @name: For diagnostics, identifies the driver. 250 * @name: For diagnostics, identifies the driver.
@@ -250,6 +253,8 @@ int usb_add_config(struct usb_composite_dev *,
250 * @iManufacturer: Used as iManufacturer override if @dev->iManufacturer is 253 * @iManufacturer: Used as iManufacturer override if @dev->iManufacturer is
251 * not set. If NULL a default "<system> <release> with <udc>" value 254 * not set. If NULL a default "<system> <release> with <udc>" value
252 * will be used. 255 * will be used.
256 * @iSerialNumber: Used as iSerialNumber override if @dev->iSerialNumber is
257 * not set.
253 * @dev: Template descriptor for the device, including default device 258 * @dev: Template descriptor for the device, including default device
254 * identifiers. 259 * identifiers.
255 * @strings: tables of strings, keyed by identifiers assigned during bind() 260 * @strings: tables of strings, keyed by identifiers assigned during bind()
@@ -280,6 +285,7 @@ struct usb_composite_driver {
280 const char *name; 285 const char *name;
281 const char *iProduct; 286 const char *iProduct;
282 const char *iManufacturer; 287 const char *iManufacturer;
288 const char *iSerialNumber;
283 const struct usb_device_descriptor *dev; 289 const struct usb_device_descriptor *dev;
284 struct usb_gadget_strings **strings; 290 struct usb_gadget_strings **strings;
285 enum usb_device_speed max_speed; 291 enum usb_device_speed max_speed;
diff --git a/include/linux/usb/functionfs.h b/include/linux/usb/functionfs.h
index 7587ef934ba8..a843d0851364 100644
--- a/include/linux/usb/functionfs.h
+++ b/include/linux/usb/functionfs.h
@@ -190,8 +190,10 @@ static int functionfs_ready_callback(struct ffs_data *ffs)
190 __attribute__((warn_unused_result, nonnull)); 190 __attribute__((warn_unused_result, nonnull));
191static void functionfs_closed_callback(struct ffs_data *ffs) 191static void functionfs_closed_callback(struct ffs_data *ffs)
192 __attribute__((nonnull)); 192 __attribute__((nonnull));
193static int functionfs_check_dev_callback(const char *dev_name) 193static void *functionfs_acquire_dev_callback(const char *dev_name)
194 __attribute__((warn_unused_result, nonnull)); 194 __attribute__((warn_unused_result, nonnull));
195static void functionfs_release_dev_callback(struct ffs_data *ffs_data)
196 __attribute__((nonnull));
195 197
196 198
197#endif 199#endif
diff --git a/include/linux/usb/gpio_vbus.h b/include/linux/usb/gpio_vbus.h
index d9f03ccc2d60..837bba604a0b 100644
--- a/include/linux/usb/gpio_vbus.h
+++ b/include/linux/usb/gpio_vbus.h
@@ -17,6 +17,7 @@
17 * @gpio_pullup: optional D+ or D- pullup GPIO (else negative/invalid) 17 * @gpio_pullup: optional D+ or D- pullup GPIO (else negative/invalid)
18 * @gpio_vbus_inverted: true if gpio_vbus is active low 18 * @gpio_vbus_inverted: true if gpio_vbus is active low
19 * @gpio_pullup_inverted: true if gpio_pullup is active low 19 * @gpio_pullup_inverted: true if gpio_pullup is active low
20 * @wakeup: configure gpio_vbus as a wake-up source
20 * 21 *
21 * The VBUS sensing GPIO should have a pulldown, which will normally be 22 * The VBUS sensing GPIO should have a pulldown, which will normally be
22 * part of a resistor ladder turning a 4.0V-5.25V level on VBUS into a 23 * part of a resistor ladder turning a 4.0V-5.25V level on VBUS into a
@@ -27,4 +28,5 @@ struct gpio_vbus_mach_info {
27 int gpio_pullup; 28 int gpio_pullup;
28 bool gpio_vbus_inverted; 29 bool gpio_vbus_inverted;
29 bool gpio_pullup_inverted; 30 bool gpio_pullup_inverted;
31 bool wakeup;
30}; 32};
diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h
index d28cc78a38e4..7f855d50cdf5 100644
--- a/include/linux/usb/hcd.h
+++ b/include/linux/usb/hcd.h
@@ -344,6 +344,15 @@ struct hc_driver {
344 */ 344 */
345 int (*update_device)(struct usb_hcd *, struct usb_device *); 345 int (*update_device)(struct usb_hcd *, struct usb_device *);
346 int (*set_usb2_hw_lpm)(struct usb_hcd *, struct usb_device *, int); 346 int (*set_usb2_hw_lpm)(struct usb_hcd *, struct usb_device *, int);
347 /* USB 3.0 Link Power Management */
348 /* Returns the USB3 hub-encoded value for the U1/U2 timeout. */
349 int (*enable_usb3_lpm_timeout)(struct usb_hcd *,
350 struct usb_device *, enum usb3_link_state state);
351 /* The xHCI host controller can still fail the command to
352 * disable the LPM timeouts, so this can return an error code.
353 */
354 int (*disable_usb3_lpm_timeout)(struct usb_hcd *,
355 struct usb_device *, enum usb3_link_state state);
347}; 356};
348 357
349extern int usb_hcd_link_urb_to_ep(struct usb_hcd *hcd, struct urb *urb); 358extern int usb_hcd_link_urb_to_ep(struct usb_hcd *hcd, struct urb *urb);
@@ -584,29 +593,6 @@ static inline void usb_hcd_resume_root_hub(struct usb_hcd *hcd)
584} 593}
585#endif /* CONFIG_USB_SUSPEND */ 594#endif /* CONFIG_USB_SUSPEND */
586 595
587
588/*
589 * USB device fs stuff
590 */
591
592#ifdef CONFIG_USB_DEVICEFS
593
594/*
595 * these are expected to be called from the USB core/hub thread
596 * with the kernel lock held
597 */
598extern void usbfs_update_special(void);
599extern int usbfs_init(void);
600extern void usbfs_cleanup(void);
601
602#else /* CONFIG_USB_DEVICEFS */
603
604static inline void usbfs_update_special(void) {}
605static inline int usbfs_init(void) { return 0; }
606static inline void usbfs_cleanup(void) { }
607
608#endif /* CONFIG_USB_DEVICEFS */
609
610/*-------------------------------------------------------------------------*/ 596/*-------------------------------------------------------------------------*/
611 597
612#if defined(CONFIG_USB_MON) || defined(CONFIG_USB_MON_MODULE) 598#if defined(CONFIG_USB_MON) || defined(CONFIG_USB_MON_MODULE)
diff --git a/include/linux/usb/isp1301.h b/include/linux/usb/isp1301.h
new file mode 100644
index 000000000000..d3a851c28b6a
--- /dev/null
+++ b/include/linux/usb/isp1301.h
@@ -0,0 +1,80 @@
1/*
2 * NXP ISP1301 USB transceiver driver
3 *
4 * Copyright (C) 2012 Roland Stigge <stigge@antcom.de>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 */
16
17#ifndef __LINUX_USB_ISP1301_H
18#define __LINUX_USB_ISP1301_H
19
20#include <linux/of.h>
21
22/* I2C Register definitions: */
23
24#define ISP1301_I2C_MODE_CONTROL_1 0x04 /* u8 read, set, +1 clear */
25
26#define MC1_SPEED_REG (1 << 0)
27#define MC1_SUSPEND_REG (1 << 1)
28#define MC1_DAT_SE0 (1 << 2)
29#define MC1_TRANSPARENT (1 << 3)
30#define MC1_BDIS_ACON_EN (1 << 4)
31#define MC1_OE_INT_EN (1 << 5)
32#define MC1_UART_EN (1 << 6)
33#define MC1_MASK 0x7f
34
35#define ISP1301_I2C_MODE_CONTROL_2 0x12 /* u8 read, set, +1 clear */
36
37#define MC2_GLOBAL_PWR_DN (1 << 0)
38#define MC2_SPD_SUSP_CTRL (1 << 1)
39#define MC2_BI_DI (1 << 2)
40#define MC2_TRANSP_BDIR0 (1 << 3)
41#define MC2_TRANSP_BDIR1 (1 << 4)
42#define MC2_AUDIO_EN (1 << 5)
43#define MC2_PSW_EN (1 << 6)
44#define MC2_EN2V7 (1 << 7)
45
46#define ISP1301_I2C_OTG_CONTROL_1 0x06 /* u8 read, set, +1 clear */
47
48#define OTG1_DP_PULLUP (1 << 0)
49#define OTG1_DM_PULLUP (1 << 1)
50#define OTG1_DP_PULLDOWN (1 << 2)
51#define OTG1_DM_PULLDOWN (1 << 3)
52#define OTG1_ID_PULLDOWN (1 << 4)
53#define OTG1_VBUS_DRV (1 << 5)
54#define OTG1_VBUS_DISCHRG (1 << 6)
55#define OTG1_VBUS_CHRG (1 << 7)
56
57#define ISP1301_I2C_OTG_CONTROL_2 0x10 /* u8 readonly */
58
59#define OTG_B_SESS_END (1 << 6)
60#define OTG_B_SESS_VLD (1 << 7)
61
62#define ISP1301_I2C_INTERRUPT_SOURCE 0x8
63#define ISP1301_I2C_INTERRUPT_LATCH 0xA
64#define ISP1301_I2C_INTERRUPT_FALLING 0xC
65#define ISP1301_I2C_INTERRUPT_RISING 0xE
66
67#define INT_VBUS_VLD (1 << 0)
68#define INT_SESS_VLD (1 << 1)
69#define INT_DP_HI (1 << 2)
70#define INT_ID_GND (1 << 3)
71#define INT_DM_HI (1 << 4)
72#define INT_ID_FLOAT (1 << 5)
73#define INT_BDIS_ACON (1 << 6)
74#define INT_CR_INT (1 << 7)
75
76#define ISP1301_I2C_REG_CLEAR_ADDR 1 /* Register Address Modifier */
77
78struct i2c_client *isp1301_get_client(struct device_node *node);
79
80#endif /* __LINUX_USB_ISP1301_H */
diff --git a/include/linux/usb/langwell_udc.h b/include/linux/usb/langwell_udc.h
deleted file mode 100644
index 2d2d1bbad9d2..000000000000
--- a/include/linux/usb/langwell_udc.h
+++ /dev/null
@@ -1,310 +0,0 @@
1/*
2 * Intel Langwell USB Device Controller driver
3 * Copyright (C) 2008-2009, Intel Corporation.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
17 *
18 */
19
20#ifndef __LANGWELL_UDC_H
21#define __LANGWELL_UDC_H
22
23
24/* MACRO defines */
25#define CAP_REG_OFFSET 0x0
26#define OP_REG_OFFSET 0x28
27
28#define DMA_ADDR_INVALID (~(dma_addr_t)0)
29
30#define DQH_ALIGNMENT 2048
31#define DTD_ALIGNMENT 64
32#define DMA_BOUNDARY 4096
33
34#define EP0_MAX_PKT_SIZE 64
35#define EP_DIR_IN 1
36#define EP_DIR_OUT 0
37
38#define FLUSH_TIMEOUT 1000
39#define RESET_TIMEOUT 1000
40#define SETUPSTAT_TIMEOUT 100
41#define PRIME_TIMEOUT 100
42
43
44/* device memory space registers */
45
46/* Capability Registers, BAR0 + CAP_REG_OFFSET */
47struct langwell_cap_regs {
48 /* offset: 0x0 */
49 u8 caplength; /* offset of Operational Register */
50 u8 _reserved3;
51 u16 hciversion; /* H: BCD encoding of host version */
52 u32 hcsparams; /* H: host port steering logic capability */
53 u32 hccparams; /* H: host multiple mode control capability */
54#define HCC_LEN BIT(17) /* Link power management (LPM) capability */
55 u8 _reserved4[0x20-0xc];
56 /* offset: 0x20 */
57 u16 dciversion; /* BCD encoding of device version */
58 u8 _reserved5[0x24-0x22];
59 u32 dccparams; /* overall device controller capability */
60#define HOSTCAP BIT(8) /* host capable */
61#define DEVCAP BIT(7) /* device capable */
62#define DEN(d) \
63 (((d)>>0)&0x1f) /* bits 4:0, device endpoint number */
64} __attribute__ ((packed));
65
66
67/* Operational Registers, BAR0 + OP_REG_OFFSET */
68struct langwell_op_regs {
69 /* offset: 0x28 */
70 u32 extsts;
71#define EXTS_TI1 BIT(4) /* general purpose timer interrupt 1 */
72#define EXTS_TI1TI0 BIT(3) /* general purpose timer interrupt 0 */
73#define EXTS_TI1UPI BIT(2) /* USB host periodic interrupt */
74#define EXTS_TI1UAI BIT(1) /* USB host asynchronous interrupt */
75#define EXTS_TI1NAKI BIT(0) /* NAK interrupt */
76 u32 extintr;
77#define EXTI_TIE1 BIT(4) /* general purpose timer interrupt enable 1 */
78#define EXTI_TIE0 BIT(3) /* general purpose timer interrupt enable 0 */
79#define EXTI_UPIE BIT(2) /* USB host periodic interrupt enable */
80#define EXTI_UAIE BIT(1) /* USB host asynchronous interrupt enable */
81#define EXTI_NAKE BIT(0) /* NAK interrupt enable */
82 /* offset: 0x30 */
83 u32 usbcmd;
84#define CMD_HIRD(u) \
85 (((u)>>24)&0xf) /* bits 27:24, host init resume duration */
86#define CMD_ITC(u) \
87 (((u)>>16)&0xff) /* bits 23:16, interrupt threshold control */
88#define CMD_PPE BIT(15) /* per-port change events enable */
89#define CMD_ATDTW BIT(14) /* add dTD tripwire */
90#define CMD_SUTW BIT(13) /* setup tripwire */
91#define CMD_ASPE BIT(11) /* asynchronous schedule park mode enable */
92#define CMD_FS2 BIT(10) /* frame list size */
93#define CMD_ASP1 BIT(9) /* asynchronous schedule park mode count */
94#define CMD_ASP0 BIT(8)
95#define CMD_LR BIT(7) /* light host/device controller reset */
96#define CMD_IAA BIT(6) /* interrupt on async advance doorbell */
97#define CMD_ASE BIT(5) /* asynchronous schedule enable */
98#define CMD_PSE BIT(4) /* periodic schedule enable */
99#define CMD_FS1 BIT(3)
100#define CMD_FS0 BIT(2)
101#define CMD_RST BIT(1) /* controller reset */
102#define CMD_RUNSTOP BIT(0) /* run/stop */
103 u32 usbsts;
104#define STS_PPCI(u) \
105 (((u)>>16)&0xffff) /* bits 31:16, port-n change detect */
106#define STS_AS BIT(15) /* asynchronous schedule status */
107#define STS_PS BIT(14) /* periodic schedule status */
108#define STS_RCL BIT(13) /* reclamation */
109#define STS_HCH BIT(12) /* HC halted */
110#define STS_ULPII BIT(10) /* ULPI interrupt */
111#define STS_SLI BIT(8) /* DC suspend */
112#define STS_SRI BIT(7) /* SOF received */
113#define STS_URI BIT(6) /* USB reset received */
114#define STS_AAI BIT(5) /* interrupt on async advance */
115#define STS_SEI BIT(4) /* system error */
116#define STS_FRI BIT(3) /* frame list rollover */
117#define STS_PCI BIT(2) /* port change detect */
118#define STS_UEI BIT(1) /* USB error interrupt */
119#define STS_UI BIT(0) /* USB interrupt */
120 u32 usbintr;
121/* bits 31:16, per-port interrupt enable */
122#define INTR_PPCE(u) (((u)>>16)&0xffff)
123#define INTR_ULPIE BIT(10) /* ULPI enable */
124#define INTR_SLE BIT(8) /* DC sleep/suspend enable */
125#define INTR_SRE BIT(7) /* SOF received enable */
126#define INTR_URE BIT(6) /* USB reset enable */
127#define INTR_AAE BIT(5) /* interrupt on async advance enable */
128#define INTR_SEE BIT(4) /* system error enable */
129#define INTR_FRE BIT(3) /* frame list rollover enable */
130#define INTR_PCE BIT(2) /* port change detect enable */
131#define INTR_UEE BIT(1) /* USB error interrupt enable */
132#define INTR_UE BIT(0) /* USB interrupt enable */
133 u32 frindex; /* frame index */
134#define FRINDEX_MASK (0x3fff << 0)
135 u32 ctrldssegment; /* not used */
136 u32 deviceaddr;
137#define USBADR_SHIFT 25
138#define USBADR(d) \
139 (((d)>>25)&0x7f) /* bits 31:25, device address */
140#define USBADR_MASK (0x7f << 25)
141#define USBADRA BIT(24) /* device address advance */
142 u32 endpointlistaddr;/* endpoint list top memory address */
143/* bits 31:11, endpoint list pointer */
144#define EPBASE(d) (((d)>>11)&0x1fffff)
145#define ENDPOINTLISTADDR_MASK (0x1fffff << 11)
146 u32 ttctrl; /* H: TT operatin, not used */
147 /* offset: 0x50 */
148 u32 burstsize; /* burst size of data movement */
149#define TXPBURST(b) \
150 (((b)>>8)&0xff) /* bits 15:8, TX burst length */
151#define RXPBURST(b) \
152 (((b)>>0)&0xff) /* bits 7:0, RX burst length */
153 u32 txfilltuning; /* TX tuning */
154 u32 txttfilltuning; /* H: TX TT tuning */
155 u32 ic_usb; /* control the IC_USB FS/LS transceiver */
156 /* offset: 0x60 */
157 u32 ulpi_viewport; /* indirect access to ULPI PHY */
158#define ULPIWU BIT(31) /* ULPI wakeup */
159#define ULPIRUN BIT(30) /* ULPI read/write run */
160#define ULPIRW BIT(29) /* ULPI read/write control */
161#define ULPISS BIT(27) /* ULPI sync state */
162#define ULPIPORT(u) \
163 (((u)>>24)&7) /* bits 26:24, ULPI port number */
164#define ULPIADDR(u) \
165 (((u)>>16)&0xff) /* bits 23:16, ULPI data address */
166#define ULPIDATRD(u) \
167 (((u)>>8)&0xff) /* bits 15:8, ULPI data read */
168#define ULPIDATWR(u) \
169 (((u)>>0)&0xff) /* bits 7:0, ULPI date write */
170 u8 _reserved6[0x70-0x64];
171 /* offset: 0x70 */
172 u32 configflag; /* H: not used */
173 u32 portsc1; /* port status */
174#define DA(p) \
175 (((p)>>25)&0x7f) /* bits 31:25, device address */
176#define PORTS_SSTS (BIT(24) | BIT(23)) /* suspend status */
177#define PORTS_WKOC BIT(22) /* wake on over-current enable */
178#define PORTS_WKDS BIT(21) /* wake on disconnect enable */
179#define PORTS_WKCN BIT(20) /* wake on connect enable */
180#define PORTS_PTC(p) (((p)>>16)&0xf) /* bits 19:16, port test control */
181#define PORTS_PIC (BIT(15) | BIT(14)) /* port indicator control */
182#define PORTS_PO BIT(13) /* port owner */
183#define PORTS_PP BIT(12) /* port power */
184#define PORTS_LS (BIT(11) | BIT(10)) /* line status */
185#define PORTS_SLP BIT(9) /* suspend using L1 */
186#define PORTS_PR BIT(8) /* port reset */
187#define PORTS_SUSP BIT(7) /* suspend */
188#define PORTS_FPR BIT(6) /* force port resume */
189#define PORTS_OCC BIT(5) /* over-current change */
190#define PORTS_OCA BIT(4) /* over-current active */
191#define PORTS_PEC BIT(3) /* port enable/disable change */
192#define PORTS_PE BIT(2) /* port enable/disable */
193#define PORTS_CSC BIT(1) /* connect status change */
194#define PORTS_CCS BIT(0) /* current connect status */
195 u8 _reserved7[0xb4-0x78];
196 /* offset: 0xb4 */
197 u32 devlc; /* control LPM and each USB port behavior */
198/* bits 31:29, parallel transceiver select */
199#define LPM_PTS(d) (((d)>>29)&7)
200#define LPM_STS BIT(28) /* serial transceiver select */
201#define LPM_PTW BIT(27) /* parallel transceiver width */
202#define LPM_PSPD(d) (((d)>>25)&3) /* bits 26:25, port speed */
203#define LPM_PSPD_MASK (BIT(26) | BIT(25))
204#define LPM_SPEED_FULL 0
205#define LPM_SPEED_LOW 1
206#define LPM_SPEED_HIGH 2
207#define LPM_SRT BIT(24) /* shorten reset time */
208#define LPM_PFSC BIT(23) /* port force full speed connect */
209#define LPM_PHCD BIT(22) /* PHY low power suspend clock disable */
210#define LPM_STL BIT(16) /* STALL reply to LPM token */
211#define LPM_BA(d) \
212 (((d)>>1)&0x7ff) /* bits 11:1, BmAttributes */
213#define LPM_NYT_ACK BIT(0) /* NYET/ACK reply to LPM token */
214 u8 _reserved8[0xf4-0xb8];
215 /* offset: 0xf4 */
216 u32 otgsc; /* On-The-Go status and control */
217#define OTGSC_DPIE BIT(30) /* data pulse interrupt enable */
218#define OTGSC_MSE BIT(29) /* 1 ms timer interrupt enable */
219#define OTGSC_BSEIE BIT(28) /* B session end interrupt enable */
220#define OTGSC_BSVIE BIT(27) /* B session valid interrupt enable */
221#define OTGSC_ASVIE BIT(26) /* A session valid interrupt enable */
222#define OTGSC_AVVIE BIT(25) /* A VBUS valid interrupt enable */
223#define OTGSC_IDIE BIT(24) /* USB ID interrupt enable */
224#define OTGSC_DPIS BIT(22) /* data pulse interrupt status */
225#define OTGSC_MSS BIT(21) /* 1 ms timer interrupt status */
226#define OTGSC_BSEIS BIT(20) /* B session end interrupt status */
227#define OTGSC_BSVIS BIT(19) /* B session valid interrupt status */
228#define OTGSC_ASVIS BIT(18) /* A session valid interrupt status */
229#define OTGSC_AVVIS BIT(17) /* A VBUS valid interrupt status */
230#define OTGSC_IDIS BIT(16) /* USB ID interrupt status */
231#define OTGSC_DPS BIT(14) /* data bus pulsing status */
232#define OTGSC_MST BIT(13) /* 1 ms timer toggle */
233#define OTGSC_BSE BIT(12) /* B session end */
234#define OTGSC_BSV BIT(11) /* B session valid */
235#define OTGSC_ASV BIT(10) /* A session valid */
236#define OTGSC_AVV BIT(9) /* A VBUS valid */
237#define OTGSC_USBID BIT(8) /* USB ID */
238#define OTGSC_HABA BIT(7) /* hw assist B-disconnect to A-connect */
239#define OTGSC_HADP BIT(6) /* hw assist data pulse */
240#define OTGSC_IDPU BIT(5) /* ID pullup */
241#define OTGSC_DP BIT(4) /* data pulsing */
242#define OTGSC_OT BIT(3) /* OTG termination */
243#define OTGSC_HAAR BIT(2) /* hw assist auto reset */
244#define OTGSC_VC BIT(1) /* VBUS charge */
245#define OTGSC_VD BIT(0) /* VBUS discharge */
246 u32 usbmode;
247#define MODE_VBPS BIT(5) /* R/W VBUS power select */
248#define MODE_SDIS BIT(4) /* R/W stream disable mode */
249#define MODE_SLOM BIT(3) /* R/W setup lockout mode */
250#define MODE_ENSE BIT(2) /* endian select */
251#define MODE_CM(u) (((u)>>0)&3) /* bits 1:0, controller mode */
252#define MODE_IDLE 0
253#define MODE_DEVICE 2
254#define MODE_HOST 3
255 u8 _reserved9[0x100-0xfc];
256 /* offset: 0x100 */
257 u32 endptnak;
258#define EPTN(e) \
259 (((e)>>16)&0xffff) /* bits 31:16, TX endpoint NAK */
260#define EPRN(e) \
261 (((e)>>0)&0xffff) /* bits 15:0, RX endpoint NAK */
262 u32 endptnaken;
263#define EPTNE(e) \
264 (((e)>>16)&0xffff) /* bits 31:16, TX endpoint NAK enable */
265#define EPRNE(e) \
266 (((e)>>0)&0xffff) /* bits 15:0, RX endpoint NAK enable */
267 u32 endptsetupstat;
268#define SETUPSTAT_MASK (0xffff << 0) /* bits 15:0 */
269#define EP0SETUPSTAT_MASK 1
270 u32 endptprime;
271/* bits 31:16, prime endpoint transmit buffer */
272#define PETB(e) (((e)>>16)&0xffff)
273/* bits 15:0, prime endpoint receive buffer */
274#define PERB(e) (((e)>>0)&0xffff)
275 /* offset: 0x110 */
276 u32 endptflush;
277/* bits 31:16, flush endpoint transmit buffer */
278#define FETB(e) (((e)>>16)&0xffff)
279/* bits 15:0, flush endpoint receive buffer */
280#define FERB(e) (((e)>>0)&0xffff)
281 u32 endptstat;
282/* bits 31:16, endpoint transmit buffer ready */
283#define ETBR(e) (((e)>>16)&0xffff)
284/* bits 15:0, endpoint receive buffer ready */
285#define ERBR(e) (((e)>>0)&0xffff)
286 u32 endptcomplete;
287/* bits 31:16, endpoint transmit complete event */
288#define ETCE(e) (((e)>>16)&0xffff)
289/* bits 15:0, endpoint receive complete event */
290#define ERCE(e) (((e)>>0)&0xffff)
291 /* offset: 0x11c */
292 u32 endptctrl[16];
293#define EPCTRL_TXE BIT(23) /* TX endpoint enable */
294#define EPCTRL_TXR BIT(22) /* TX data toggle reset */
295#define EPCTRL_TXI BIT(21) /* TX data toggle inhibit */
296#define EPCTRL_TXT(e) (((e)>>18)&3) /* bits 19:18, TX endpoint type */
297#define EPCTRL_TXT_SHIFT 18
298#define EPCTRL_TXD BIT(17) /* TX endpoint data source */
299#define EPCTRL_TXS BIT(16) /* TX endpoint STALL */
300#define EPCTRL_RXE BIT(7) /* RX endpoint enable */
301#define EPCTRL_RXR BIT(6) /* RX data toggle reset */
302#define EPCTRL_RXI BIT(5) /* RX data toggle inhibit */
303#define EPCTRL_RXT(e) (((e)>>2)&3) /* bits 3:2, RX endpoint type */
304#define EPCTRL_RXT_SHIFT 2 /* bits 19:18, TX endpoint type */
305#define EPCTRL_RXD BIT(1) /* RX endpoint data sink */
306#define EPCTRL_RXS BIT(0) /* RX endpoint STALL */
307} __attribute__ ((packed));
308
309#endif /* __LANGWELL_UDC_H */
310
diff --git a/include/linux/usb/rndis_host.h b/include/linux/usb/rndis_host.h
index 88fceb718c77..d44ef85db177 100644
--- a/include/linux/usb/rndis_host.h
+++ b/include/linux/usb/rndis_host.h
@@ -20,6 +20,8 @@
20#ifndef __LINUX_USB_RNDIS_HOST_H 20#ifndef __LINUX_USB_RNDIS_HOST_H
21#define __LINUX_USB_RNDIS_HOST_H 21#define __LINUX_USB_RNDIS_HOST_H
22 22
23#include <linux/rndis.h>
24
23/* 25/*
24 * CONTROL uses CDC "encapsulated commands" with funky notifications. 26 * CONTROL uses CDC "encapsulated commands" with funky notifications.
25 * - control-out: SEND_ENCAPSULATED 27 * - control-out: SEND_ENCAPSULATED
@@ -49,47 +51,6 @@ struct rndis_msg_hdr {
49 */ 51 */
50#define RNDIS_CONTROL_TIMEOUT_MS (5 * 1000) 52#define RNDIS_CONTROL_TIMEOUT_MS (5 * 1000)
51 53
52#define RNDIS_MSG_COMPLETION cpu_to_le32(0x80000000)
53
54/* codes for "msg_type" field of rndis messages;
55 * only the data channel uses packet messages (maybe batched);
56 * everything else goes on the control channel.
57 */
58#define RNDIS_MSG_PACKET cpu_to_le32(0x00000001) /* 1-N packets */
59#define RNDIS_MSG_INIT cpu_to_le32(0x00000002)
60#define RNDIS_MSG_INIT_C (RNDIS_MSG_INIT|RNDIS_MSG_COMPLETION)
61#define RNDIS_MSG_HALT cpu_to_le32(0x00000003)
62#define RNDIS_MSG_QUERY cpu_to_le32(0x00000004)
63#define RNDIS_MSG_QUERY_C (RNDIS_MSG_QUERY|RNDIS_MSG_COMPLETION)
64#define RNDIS_MSG_SET cpu_to_le32(0x00000005)
65#define RNDIS_MSG_SET_C (RNDIS_MSG_SET|RNDIS_MSG_COMPLETION)
66#define RNDIS_MSG_RESET cpu_to_le32(0x00000006)
67#define RNDIS_MSG_RESET_C (RNDIS_MSG_RESET|RNDIS_MSG_COMPLETION)
68#define RNDIS_MSG_INDICATE cpu_to_le32(0x00000007)
69#define RNDIS_MSG_KEEPALIVE cpu_to_le32(0x00000008)
70#define RNDIS_MSG_KEEPALIVE_C (RNDIS_MSG_KEEPALIVE|RNDIS_MSG_COMPLETION)
71
72/* codes for "status" field of completion messages */
73#define RNDIS_STATUS_SUCCESS cpu_to_le32(0x00000000)
74#define RNDIS_STATUS_FAILURE cpu_to_le32(0xc0000001)
75#define RNDIS_STATUS_INVALID_DATA cpu_to_le32(0xc0010015)
76#define RNDIS_STATUS_NOT_SUPPORTED cpu_to_le32(0xc00000bb)
77#define RNDIS_STATUS_MEDIA_CONNECT cpu_to_le32(0x4001000b)
78#define RNDIS_STATUS_MEDIA_DISCONNECT cpu_to_le32(0x4001000c)
79#define RNDIS_STATUS_MEDIA_SPECIFIC_INDICATION cpu_to_le32(0x40010012)
80
81/* codes for OID_GEN_PHYSICAL_MEDIUM */
82#define RNDIS_PHYSICAL_MEDIUM_UNSPECIFIED cpu_to_le32(0x00000000)
83#define RNDIS_PHYSICAL_MEDIUM_WIRELESS_LAN cpu_to_le32(0x00000001)
84#define RNDIS_PHYSICAL_MEDIUM_CABLE_MODEM cpu_to_le32(0x00000002)
85#define RNDIS_PHYSICAL_MEDIUM_PHONE_LINE cpu_to_le32(0x00000003)
86#define RNDIS_PHYSICAL_MEDIUM_POWER_LINE cpu_to_le32(0x00000004)
87#define RNDIS_PHYSICAL_MEDIUM_DSL cpu_to_le32(0x00000005)
88#define RNDIS_PHYSICAL_MEDIUM_FIBRE_CHANNEL cpu_to_le32(0x00000006)
89#define RNDIS_PHYSICAL_MEDIUM_1394 cpu_to_le32(0x00000007)
90#define RNDIS_PHYSICAL_MEDIUM_WIRELESS_WAN cpu_to_le32(0x00000008)
91#define RNDIS_PHYSICAL_MEDIUM_MAX cpu_to_le32(0x00000009)
92
93struct rndis_data_hdr { 54struct rndis_data_hdr {
94 __le32 msg_type; /* RNDIS_MSG_PACKET */ 55 __le32 msg_type; /* RNDIS_MSG_PACKET */
95 __le32 msg_len; /* rndis_data_hdr + data_len + pad */ 56 __le32 msg_len; /* rndis_data_hdr + data_len + pad */
@@ -222,29 +183,6 @@ struct rndis_keepalive_c { /* IN (optionally OUT) */
222 __le32 status; 183 __le32 status;
223} __attribute__ ((packed)); 184} __attribute__ ((packed));
224 185
225/* NOTE: about 30 OIDs are "mandatory" for peripherals to support ... and
226 * there are gobs more that may optionally be supported. We'll avoid as much
227 * of that mess as possible.
228 */
229#define OID_802_3_PERMANENT_ADDRESS cpu_to_le32(0x01010101)
230#define OID_GEN_MAXIMUM_FRAME_SIZE cpu_to_le32(0x00010106)
231#define OID_GEN_CURRENT_PACKET_FILTER cpu_to_le32(0x0001010e)
232#define OID_GEN_PHYSICAL_MEDIUM cpu_to_le32(0x00010202)
233
234/* packet filter bits used by OID_GEN_CURRENT_PACKET_FILTER */
235#define RNDIS_PACKET_TYPE_DIRECTED cpu_to_le32(0x00000001)
236#define RNDIS_PACKET_TYPE_MULTICAST cpu_to_le32(0x00000002)
237#define RNDIS_PACKET_TYPE_ALL_MULTICAST cpu_to_le32(0x00000004)
238#define RNDIS_PACKET_TYPE_BROADCAST cpu_to_le32(0x00000008)
239#define RNDIS_PACKET_TYPE_SOURCE_ROUTING cpu_to_le32(0x00000010)
240#define RNDIS_PACKET_TYPE_PROMISCUOUS cpu_to_le32(0x00000020)
241#define RNDIS_PACKET_TYPE_SMT cpu_to_le32(0x00000040)
242#define RNDIS_PACKET_TYPE_ALL_LOCAL cpu_to_le32(0x00000080)
243#define RNDIS_PACKET_TYPE_GROUP cpu_to_le32(0x00001000)
244#define RNDIS_PACKET_TYPE_ALL_FUNCTIONAL cpu_to_le32(0x00002000)
245#define RNDIS_PACKET_TYPE_FUNCTIONAL cpu_to_le32(0x00004000)
246#define RNDIS_PACKET_TYPE_MAC_FRAME cpu_to_le32(0x00008000)
247
248/* default filter used with RNDIS devices */ 186/* default filter used with RNDIS devices */
249#define RNDIS_DEFAULT_FILTER ( \ 187#define RNDIS_DEFAULT_FILTER ( \
250 RNDIS_PACKET_TYPE_DIRECTED | \ 188 RNDIS_PACKET_TYPE_DIRECTED | \
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h
index 474283888233..86c0b451745d 100644
--- a/include/linux/usb/serial.h
+++ b/include/linux/usb/serial.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * USB Serial Converter stuff 2 * USB Serial Converter stuff
3 * 3 *
4 * Copyright (C) 1999 - 2005 4 * Copyright (C) 1999 - 2012
5 * Greg Kroah-Hartman (greg@kroah.com) 5 * Greg Kroah-Hartman (greg@kroah.com)
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
@@ -249,6 +249,7 @@ struct usb_serial_driver {
249 249
250 int (*suspend)(struct usb_serial *serial, pm_message_t message); 250 int (*suspend)(struct usb_serial *serial, pm_message_t message);
251 int (*resume)(struct usb_serial *serial); 251 int (*resume)(struct usb_serial *serial);
252 int (*reset_resume)(struct usb_serial *serial);
252 253
253 /* serial function calls */ 254 /* serial function calls */
254 /* Called by console and by the tty layer */ 255 /* Called by console and by the tty layer */
@@ -292,16 +293,11 @@ struct usb_serial_driver {
292#define to_usb_serial_driver(d) \ 293#define to_usb_serial_driver(d) \
293 container_of(d, struct usb_serial_driver, driver) 294 container_of(d, struct usb_serial_driver, driver)
294 295
295extern int usb_serial_register_drivers(struct usb_driver *udriver, 296extern int usb_serial_register_drivers(struct usb_serial_driver *const serial_drivers[],
296 struct usb_serial_driver * const serial_drivers[]); 297 const char *name, const struct usb_device_id *id_table);
297extern void usb_serial_deregister_drivers(struct usb_driver *udriver, 298extern void usb_serial_deregister_drivers(struct usb_serial_driver *const serial_drivers[]);
298 struct usb_serial_driver * const serial_drivers[]);
299extern void usb_serial_port_softint(struct usb_serial_port *port); 299extern void usb_serial_port_softint(struct usb_serial_port *port);
300 300
301extern int usb_serial_probe(struct usb_interface *iface,
302 const struct usb_device_id *id);
303extern void usb_serial_disconnect(struct usb_interface *iface);
304
305extern int usb_serial_suspend(struct usb_interface *intf, pm_message_t message); 301extern int usb_serial_suspend(struct usb_interface *intf, pm_message_t message);
306extern int usb_serial_resume(struct usb_interface *intf); 302extern int usb_serial_resume(struct usb_interface *intf);
307 303
@@ -400,8 +396,8 @@ do { \
400 396
401/* 397/*
402 * module_usb_serial_driver() - Helper macro for registering a USB Serial driver 398 * module_usb_serial_driver() - Helper macro for registering a USB Serial driver
403 * @__usb_driver: usb_driver struct to register
404 * @__serial_drivers: list of usb_serial drivers to register 399 * @__serial_drivers: list of usb_serial drivers to register
400 * @__ids: all device ids that @__serial_drivers bind to
405 * 401 *
406 * Helper macro for USB serial drivers which do not do anything special 402 * Helper macro for USB serial drivers which do not do anything special
407 * in module init/exit. This eliminates a lot of boilerplate. Each 403 * in module init/exit. This eliminates a lot of boilerplate. Each
@@ -409,9 +405,21 @@ do { \
409 * module_init() and module_exit() 405 * module_init() and module_exit()
410 * 406 *
411 */ 407 */
412#define module_usb_serial_driver(__usb_driver, __serial_drivers) \ 408#define usb_serial_module_driver(__name, __serial_drivers, __ids) \
413 module_driver(__usb_driver, usb_serial_register_drivers, \ 409static int __init usb_serial_module_init(void) \
414 usb_serial_deregister_drivers, __serial_drivers) 410{ \
411 return usb_serial_register_drivers(__serial_drivers, \
412 __name, __ids); \
413} \
414module_init(usb_serial_module_init); \
415static void __exit usb_serial_module_exit(void) \
416{ \
417 usb_serial_deregister_drivers(__serial_drivers); \
418} \
419module_exit(usb_serial_module_exit);
420
421#define module_usb_serial_driver(__serial_drivers, __ids) \
422 usb_serial_module_driver(KBUILD_MODNAME, __serial_drivers, __ids)
415 423
416#endif /* __LINUX_USB_SERIAL_H */ 424#endif /* __LINUX_USB_SERIAL_H */
417 425
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
index 605b0aa8d852..76f439647c4b 100644
--- a/include/linux/usb/usbnet.h
+++ b/include/linux/usb/usbnet.h
@@ -191,7 +191,8 @@ extern void usbnet_cdc_status(struct usbnet *, struct urb *);
191enum skb_state { 191enum skb_state {
192 illegal = 0, 192 illegal = 0,
193 tx_start, tx_done, 193 tx_start, tx_done,
194 rx_start, rx_done, rx_cleanup 194 rx_start, rx_done, rx_cleanup,
195 unlink_start
195}; 196};
196 197
197struct skb_data { /* skb->cb is one of these */ 198struct skb_data { /* skb->cb is one of these */
diff --git a/include/linux/user_namespace.h b/include/linux/user_namespace.h
index faf467944baf..4e72922e5a75 100644
--- a/include/linux/user_namespace.h
+++ b/include/linux/user_namespace.h
@@ -6,14 +6,24 @@
6#include <linux/sched.h> 6#include <linux/sched.h>
7#include <linux/err.h> 7#include <linux/err.h>
8 8
9#define UIDHASH_BITS (CONFIG_BASE_SMALL ? 3 : 7) 9#define UID_GID_MAP_MAX_EXTENTS 5
10#define UIDHASH_SZ (1 << UIDHASH_BITS) 10
11struct uid_gid_map { /* 64 bytes -- 1 cache line */
12 u32 nr_extents;
13 struct uid_gid_extent {
14 u32 first;
15 u32 lower_first;
16 u32 count;
17 } extent[UID_GID_MAP_MAX_EXTENTS];
18};
11 19
12struct user_namespace { 20struct user_namespace {
21 struct uid_gid_map uid_map;
22 struct uid_gid_map gid_map;
13 struct kref kref; 23 struct kref kref;
14 struct hlist_head uidhash_table[UIDHASH_SZ]; 24 struct user_namespace *parent;
15 struct user_struct *creator; 25 kuid_t owner;
16 struct work_struct destroyer; 26 kgid_t group;
17}; 27};
18 28
19extern struct user_namespace init_user_ns; 29extern struct user_namespace init_user_ns;
@@ -36,9 +46,11 @@ static inline void put_user_ns(struct user_namespace *ns)
36 kref_put(&ns->kref, free_user_ns); 46 kref_put(&ns->kref, free_user_ns);
37} 47}
38 48
39uid_t user_ns_map_uid(struct user_namespace *to, const struct cred *cred, uid_t uid); 49struct seq_operations;
40gid_t user_ns_map_gid(struct user_namespace *to, const struct cred *cred, gid_t gid); 50extern struct seq_operations proc_uid_seq_operations;
41 51extern struct seq_operations proc_gid_seq_operations;
52extern ssize_t proc_uid_map_write(struct file *, const char __user *, size_t, loff_t *);
53extern ssize_t proc_gid_map_write(struct file *, const char __user *, size_t, loff_t *);
42#else 54#else
43 55
44static inline struct user_namespace *get_user_ns(struct user_namespace *ns) 56static inline struct user_namespace *get_user_ns(struct user_namespace *ns)
@@ -55,17 +67,6 @@ static inline void put_user_ns(struct user_namespace *ns)
55{ 67{
56} 68}
57 69
58static inline uid_t user_ns_map_uid(struct user_namespace *to,
59 const struct cred *cred, uid_t uid)
60{
61 return uid;
62}
63static inline gid_t user_ns_map_gid(struct user_namespace *to,
64 const struct cred *cred, gid_t gid)
65{
66 return gid;
67}
68
69#endif 70#endif
70 71
71#endif /* _LINUX_USER_H */ 72#endif /* _LINUX_USER_H */
diff --git a/include/linux/uuid.h b/include/linux/uuid.h
index 5b7efbfcee4e..f86c37bfd4a0 100644
--- a/include/linux/uuid.h
+++ b/include/linux/uuid.h
@@ -54,6 +54,8 @@ typedef struct {
54 UUID_BE(0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, \ 54 UUID_BE(0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, \
55 0x00, 0x00, 0x00, 0x00) 55 0x00, 0x00, 0x00, 0x00)
56 56
57#ifdef __KERNEL__
58
57static inline int uuid_le_cmp(const uuid_le u1, const uuid_le u2) 59static inline int uuid_le_cmp(const uuid_le u1, const uuid_le u2)
58{ 60{
59 return memcmp(&u1, &u2, sizeof(uuid_le)); 61 return memcmp(&u1, &u2, sizeof(uuid_le));
@@ -67,4 +69,6 @@ static inline int uuid_be_cmp(const uuid_be u1, const uuid_be u2)
67extern void uuid_le_gen(uuid_le *u); 69extern void uuid_le_gen(uuid_le *u);
68extern void uuid_be_gen(uuid_be *u); 70extern void uuid_be_gen(uuid_be *u);
69 71
72#endif /* __KERNEL__ */
73
70#endif 74#endif
diff --git a/include/linux/v4l2-dv-timings.h b/include/linux/v4l2-dv-timings.h
new file mode 100644
index 000000000000..9ef8172e5ed0
--- /dev/null
+++ b/include/linux/v4l2-dv-timings.h
@@ -0,0 +1,816 @@
1/*
2 * V4L2 DV timings header.
3 *
4 * Copyright (C) 2012 Hans Verkuil <hans.verkuil@cisco.com>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * version 2 as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18 * 02110-1301 USA
19 */
20
21#ifndef _V4L2_DV_TIMINGS_H
22#define _V4L2_DV_TIMINGS_H
23
24#if __GNUC__ < 4 || (__GNUC__ == 4 && (__GNUC_MINOR__ < 6))
25/* Sadly gcc versions older than 4.6 have a bug in how they initialize
26 anonymous unions where they require additional curly brackets.
27 This violates the C1x standard. This workaround adds the curly brackets
28 if needed. */
29#define V4L2_INIT_BT_TIMINGS(_width, args...) \
30 { .bt = { _width , ## args } }
31#else
32#define V4L2_INIT_BT_TIMINGS(_width, args...) \
33 .bt = { _width , ## args }
34#endif
35
36/* CEA-861-E timings (i.e. standard HDTV timings) */
37
38#define V4L2_DV_BT_CEA_640X480P59_94 { \
39 .type = V4L2_DV_BT_656_1120, \
40 V4L2_INIT_BT_TIMINGS(640, 480, 0, 0, \
41 25175000, 16, 96, 48, 10, 2, 33, 0, 0, 0, \
42 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CEA861, 0) \
43}
44
45#define V4L2_DV_BT_CEA_720X480P59_94 { \
46 .type = V4L2_DV_BT_656_1120, \
47 V4L2_INIT_BT_TIMINGS(720, 480, 0, 0, \
48 27000000, 16, 62, 60, 9, 6, 30, 0, 0, 0, \
49 V4L2_DV_BT_STD_CEA861, 0) \
50}
51
52#define V4L2_DV_BT_CEA_720X576P50 { \
53 .type = V4L2_DV_BT_656_1120, \
54 V4L2_INIT_BT_TIMINGS(720, 576, 0, 0, \
55 27000000, 12, 64, 68, 5, 5, 39, 0, 0, 0, \
56 V4L2_DV_BT_STD_CEA861, 0) \
57}
58
59#define V4L2_DV_BT_CEA_1280X720P24 { \
60 .type = V4L2_DV_BT_656_1120, \
61 V4L2_INIT_BT_TIMINGS(1280, 720, 0, \
62 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
63 59400000, 1760, 40, 220, 5, 5, 20, 0, 0, 0, \
64 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CEA861, \
65 V4L2_DV_FL_CAN_REDUCE_FPS) \
66}
67
68#define V4L2_DV_BT_CEA_1280X720P25 { \
69 .type = V4L2_DV_BT_656_1120, \
70 V4L2_INIT_BT_TIMINGS(1280, 720, 0, \
71 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
72 74250000, 2420, 40, 220, 5, 5, 20, 0, 0, 0, \
73 V4L2_DV_BT_STD_CEA861, 0) \
74}
75
76#define V4L2_DV_BT_CEA_1280X720P30 { \
77 .type = V4L2_DV_BT_656_1120, \
78 V4L2_INIT_BT_TIMINGS(1280, 720, 0, \
79 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
80 74250000, 1760, 40, 220, 5, 5, 20, 0, 0, 0, \
81 V4L2_DV_BT_STD_CEA861, V4L2_DV_FL_CAN_REDUCE_FPS) \
82}
83
84#define V4L2_DV_BT_CEA_1280X720P50 { \
85 .type = V4L2_DV_BT_656_1120, \
86 V4L2_INIT_BT_TIMINGS(1280, 720, 0, \
87 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
88 74250000, 440, 40, 220, 5, 5, 20, 0, 0, 0, \
89 V4L2_DV_BT_STD_CEA861, 0) \
90}
91
92#define V4L2_DV_BT_CEA_1280X720P60 { \
93 .type = V4L2_DV_BT_656_1120, \
94 V4L2_INIT_BT_TIMINGS(1280, 720, 0, \
95 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
96 74250000, 110, 40, 220, 5, 5, 20, 0, 0, 0, \
97 V4L2_DV_BT_STD_CEA861, V4L2_DV_FL_CAN_REDUCE_FPS) \
98}
99
100#define V4L2_DV_BT_CEA_1920X1080P24 { \
101 .type = V4L2_DV_BT_656_1120, \
102 V4L2_INIT_BT_TIMINGS(1920, 1080, 0, \
103 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
104 74250000, 638, 44, 148, 4, 5, 36, 0, 0, 0, \
105 V4L2_DV_BT_STD_CEA861, V4L2_DV_FL_CAN_REDUCE_FPS) \
106}
107
108#define V4L2_DV_BT_CEA_1920X1080P25 { \
109 .type = V4L2_DV_BT_656_1120, \
110 V4L2_INIT_BT_TIMINGS(1920, 1080, 0, \
111 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
112 74250000, 528, 44, 148, 4, 5, 36, 0, 0, 0, \
113 V4L2_DV_BT_STD_CEA861, 0) \
114}
115
116#define V4L2_DV_BT_CEA_1920X1080P30 { \
117 .type = V4L2_DV_BT_656_1120, \
118 V4L2_INIT_BT_TIMINGS(1920, 1080, 0, \
119 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
120 74250000, 88, 44, 148, 4, 5, 36, 0, 0, 0, \
121 V4L2_DV_BT_STD_CEA861, V4L2_DV_FL_CAN_REDUCE_FPS) \
122}
123
124#define V4L2_DV_BT_CEA_1920X1080I50 { \
125 .type = V4L2_DV_BT_656_1120, \
126 V4L2_INIT_BT_TIMINGS(1920, 1080, 1, \
127 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
128 74250000, 528, 44, 148, 2, 5, 15, 2, 5, 16, \
129 V4L2_DV_BT_STD_CEA861, V4L2_DV_FL_HALF_LINE) \
130}
131
132#define V4L2_DV_BT_CEA_1920X1080P50 { \
133 .type = V4L2_DV_BT_656_1120, \
134 V4L2_INIT_BT_TIMINGS(1920, 1080, 0, \
135 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
136 148500000, 528, 44, 148, 4, 5, 36, 0, 0, 0, \
137 V4L2_DV_BT_STD_CEA861, 0) \
138}
139
140#define V4L2_DV_BT_CEA_1920X1080I60 { \
141 .type = V4L2_DV_BT_656_1120, \
142 V4L2_INIT_BT_TIMINGS(1920, 1080, 1, \
143 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
144 74250000, 88, 44, 148, 2, 5, 15, 2, 5, 16, \
145 V4L2_DV_BT_STD_CEA861, \
146 V4L2_DV_FL_CAN_REDUCE_FPS | V4L2_DV_FL_HALF_LINE) \
147}
148
149#define V4L2_DV_BT_CEA_1920X1080P60 { \
150 .type = V4L2_DV_BT_656_1120, \
151 V4L2_INIT_BT_TIMINGS(1920, 1080, 0, \
152 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
153 148500000, 88, 44, 148, 4, 5, 36, 0, 0, 0, \
154 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CEA861, \
155 V4L2_DV_FL_CAN_REDUCE_FPS) \
156}
157
158
159/* VESA Discrete Monitor Timings as per version 1.0, revision 12 */
160
161#define V4L2_DV_BT_DMT_640X350P85 { \
162 .type = V4L2_DV_BT_656_1120, \
163 V4L2_INIT_BT_TIMINGS(640, 350, 0, V4L2_DV_HSYNC_POS_POL, \
164 31500000, 32, 64, 96, 32, 3, 60, 0, 0, 0, \
165 V4L2_DV_BT_STD_DMT, 0) \
166}
167
168#define V4L2_DV_BT_DMT_640X400P85 { \
169 .type = V4L2_DV_BT_656_1120, \
170 V4L2_INIT_BT_TIMINGS(640, 400, 0, V4L2_DV_VSYNC_POS_POL, \
171 31500000, 32, 64, 96, 1, 3, 41, 0, 0, 0, \
172 V4L2_DV_BT_STD_DMT, 0) \
173}
174
175#define V4L2_DV_BT_DMT_720X400P85 { \
176 .type = V4L2_DV_BT_656_1120, \
177 V4L2_INIT_BT_TIMINGS(720, 400, 0, V4L2_DV_VSYNC_POS_POL, \
178 35500000, 36, 72, 108, 1, 3, 42, 0, 0, 0, \
179 V4L2_DV_BT_STD_DMT, 0) \
180}
181
182/* VGA resolutions */
183#define V4L2_DV_BT_DMT_640X480P60 V4L2_DV_BT_CEA_640X480P59_94
184
185#define V4L2_DV_BT_DMT_640X480P72 { \
186 .type = V4L2_DV_BT_656_1120, \
187 V4L2_INIT_BT_TIMINGS(640, 480, 0, 0, \
188 31500000, 24, 40, 128, 9, 3, 28, 0, 0, 0, \
189 V4L2_DV_BT_STD_DMT, 0) \
190}
191
192#define V4L2_DV_BT_DMT_640X480P75 { \
193 .type = V4L2_DV_BT_656_1120, \
194 V4L2_INIT_BT_TIMINGS(640, 480, 0, 0, \
195 31500000, 16, 64, 120, 1, 3, 16, 0, 0, 0, \
196 V4L2_DV_BT_STD_DMT, 0) \
197}
198
199#define V4L2_DV_BT_DMT_640X480P85 { \
200 .type = V4L2_DV_BT_656_1120, \
201 V4L2_INIT_BT_TIMINGS(640, 480, 0, 0, \
202 36000000, 56, 56, 80, 1, 3, 25, 0, 0, 0, \
203 V4L2_DV_BT_STD_DMT, 0) \
204}
205
206/* SVGA resolutions */
207#define V4L2_DV_BT_DMT_800X600P56 { \
208 .type = V4L2_DV_BT_656_1120, \
209 V4L2_INIT_BT_TIMINGS(800, 600, 0, \
210 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
211 36000000, 24, 72, 128, 1, 2, 22, 0, 0, 0, \
212 V4L2_DV_BT_STD_DMT, 0) \
213}
214
215#define V4L2_DV_BT_DMT_800X600P60 { \
216 .type = V4L2_DV_BT_656_1120, \
217 V4L2_INIT_BT_TIMINGS(800, 600, 0, \
218 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
219 40000000, 40, 128, 88, 1, 4, 23, 0, 0, 0, \
220 V4L2_DV_BT_STD_DMT, 0) \
221}
222
223#define V4L2_DV_BT_DMT_800X600P72 { \
224 .type = V4L2_DV_BT_656_1120, \
225 V4L2_INIT_BT_TIMINGS(800, 600, 0, \
226 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
227 50000000, 56, 120, 64, 37, 6, 23, 0, 0, 0, \
228 V4L2_DV_BT_STD_DMT, 0) \
229}
230
231#define V4L2_DV_BT_DMT_800X600P75 { \
232 .type = V4L2_DV_BT_656_1120, \
233 V4L2_INIT_BT_TIMINGS(800, 600, 0, \
234 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
235 49500000, 16, 80, 160, 1, 3, 21, 0, 0, 0, \
236 V4L2_DV_BT_STD_DMT, 0) \
237}
238
239#define V4L2_DV_BT_DMT_800X600P85 { \
240 .type = V4L2_DV_BT_656_1120, \
241 V4L2_INIT_BT_TIMINGS(800, 600, 0, \
242 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
243 56250000, 32, 64, 152, 1, 3, 27, 0, 0, 0, \
244 V4L2_DV_BT_STD_DMT, 0) \
245}
246
247#define V4L2_DV_BT_DMT_800X600P120_RB { \
248 .type = V4L2_DV_BT_656_1120, \
249 V4L2_INIT_BT_TIMINGS(800, 600, 0, V4L2_DV_HSYNC_POS_POL, \
250 73250000, 48, 32, 80, 3, 4, 29, 0, 0, 0, \
251 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \
252 V4L2_DV_FL_REDUCED_BLANKING) \
253}
254
255#define V4L2_DV_BT_DMT_848X480P60 { \
256 .type = V4L2_DV_BT_656_1120, \
257 V4L2_INIT_BT_TIMINGS(848, 480, 0, \
258 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
259 33750000, 16, 112, 112, 6, 8, 23, 0, 0, 0, \
260 V4L2_DV_BT_STD_DMT, 0) \
261}
262
263#define V4L2_DV_BT_DMT_1024X768I43 { \
264 .type = V4L2_DV_BT_656_1120, \
265 V4L2_INIT_BT_TIMINGS(1024, 768, 1, \
266 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
267 44900000, 8, 176, 56, 0, 4, 20, 0, 4, 21, \
268 V4L2_DV_BT_STD_DMT, 0) \
269}
270
271/* XGA resolutions */
272#define V4L2_DV_BT_DMT_1024X768P60 { \
273 .type = V4L2_DV_BT_656_1120, \
274 V4L2_INIT_BT_TIMINGS(1024, 768, 0, 0, \
275 65000000, 24, 136, 160, 3, 6, 29, 0, 0, 0, \
276 V4L2_DV_BT_STD_DMT, 0) \
277}
278
279#define V4L2_DV_BT_DMT_1024X768P70 { \
280 .type = V4L2_DV_BT_656_1120, \
281 V4L2_INIT_BT_TIMINGS(1024, 768, 0, 0, \
282 75000000, 24, 136, 144, 3, 6, 29, 0, 0, 0, \
283 V4L2_DV_BT_STD_DMT, 0) \
284}
285
286#define V4L2_DV_BT_DMT_1024X768P75 { \
287 .type = V4L2_DV_BT_656_1120, \
288 V4L2_INIT_BT_TIMINGS(1024, 768, 0, \
289 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
290 78750000, 16, 96, 176, 1, 3, 28, 0, 0, 0, \
291 V4L2_DV_BT_STD_DMT, 0) \
292}
293
294#define V4L2_DV_BT_DMT_1024X768P85 { \
295 .type = V4L2_DV_BT_656_1120, \
296 V4L2_INIT_BT_TIMINGS(1024, 768, 0, \
297 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
298 94500000, 48, 96, 208, 1, 3, 36, 0, 0, 0, \
299 V4L2_DV_BT_STD_DMT, 0) \
300}
301
302#define V4L2_DV_BT_DMT_1024X768P120_RB { \
303 .type = V4L2_DV_BT_656_1120, \
304 V4L2_INIT_BT_TIMINGS(1024, 768, 0, V4L2_DV_HSYNC_POS_POL, \
305 115500000, 48, 32, 80, 3, 4, 38, 0, 0, 0, \
306 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \
307 V4L2_DV_FL_REDUCED_BLANKING) \
308}
309
310/* XGA+ resolution */
311#define V4L2_DV_BT_DMT_1152X864P75 { \
312 .type = V4L2_DV_BT_656_1120, \
313 V4L2_INIT_BT_TIMINGS(1152, 864, 0, \
314 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
315 108000000, 64, 128, 256, 1, 3, 32, 0, 0, 0, \
316 V4L2_DV_BT_STD_DMT, 0) \
317}
318
319#define V4L2_DV_BT_DMT_1280X720P60 V4L2_DV_BT_CEA_1280X720P60
320
321/* WXGA resolutions */
322#define V4L2_DV_BT_DMT_1280X768P60_RB { \
323 .type = V4L2_DV_BT_656_1120, \
324 V4L2_INIT_BT_TIMINGS(1280, 768, 0, V4L2_DV_HSYNC_POS_POL, \
325 68250000, 48, 32, 80, 3, 7, 12, 0, 0, 0, \
326 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \
327 V4L2_DV_FL_REDUCED_BLANKING) \
328}
329
330#define V4L2_DV_BT_DMT_1280X768P60 { \
331 .type = V4L2_DV_BT_656_1120, \
332 V4L2_INIT_BT_TIMINGS(1280, 768, 0, V4L2_DV_VSYNC_POS_POL, \
333 79500000, 64, 128, 192, 3, 7, 20, 0, 0, 0, \
334 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \
335}
336
337#define V4L2_DV_BT_DMT_1280X768P75 { \
338 .type = V4L2_DV_BT_656_1120, \
339 V4L2_INIT_BT_TIMINGS(1280, 768, 0, V4L2_DV_VSYNC_POS_POL, \
340 102250000, 80, 128, 208, 3, 7, 27, 0, 0, 0, \
341 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \
342}
343
344#define V4L2_DV_BT_DMT_1280X768P85 { \
345 .type = V4L2_DV_BT_656_1120, \
346 V4L2_INIT_BT_TIMINGS(1280, 768, 0, V4L2_DV_VSYNC_POS_POL, \
347 117500000, 80, 136, 216, 3, 7, 31, 0, 0, 0, \
348 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \
349}
350
351#define V4L2_DV_BT_DMT_1280X768P120_RB { \
352 .type = V4L2_DV_BT_656_1120, \
353 V4L2_INIT_BT_TIMINGS(1280, 768, 0, V4L2_DV_HSYNC_POS_POL, \
354 140250000, 48, 32, 80, 3, 7, 35, 0, 0, 0, \
355 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \
356 V4L2_DV_FL_REDUCED_BLANKING) \
357}
358
359#define V4L2_DV_BT_DMT_1280X800P60_RB { \
360 .type = V4L2_DV_BT_656_1120, \
361 V4L2_INIT_BT_TIMINGS(1280, 800, 0, V4L2_DV_HSYNC_POS_POL, \
362 71000000, 48, 32, 80, 3, 6, 14, 0, 0, 0, \
363 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \
364 V4L2_DV_FL_REDUCED_BLANKING) \
365}
366
367#define V4L2_DV_BT_DMT_1280X800P60 { \
368 .type = V4L2_DV_BT_656_1120, \
369 V4L2_INIT_BT_TIMINGS(1280, 800, 0, V4L2_DV_VSYNC_POS_POL, \
370 83500000, 72, 128, 200, 3, 6, 22, 0, 0, 0, \
371 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \
372}
373
374#define V4L2_DV_BT_DMT_1280X800P75 { \
375 .type = V4L2_DV_BT_656_1120, \
376 V4L2_INIT_BT_TIMINGS(1280, 800, 0, V4L2_DV_VSYNC_POS_POL, \
377 106500000, 80, 128, 208, 3, 6, 29, 0, 0, 0, \
378 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \
379}
380
381#define V4L2_DV_BT_DMT_1280X800P85 { \
382 .type = V4L2_DV_BT_656_1120, \
383 V4L2_INIT_BT_TIMINGS(1280, 800, 0, V4L2_DV_VSYNC_POS_POL, \
384 122500000, 80, 136, 216, 3, 6, 34, 0, 0, 0, \
385 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \
386}
387
388#define V4L2_DV_BT_DMT_1280X800P120_RB { \
389 .type = V4L2_DV_BT_656_1120, \
390 V4L2_INIT_BT_TIMINGS(1280, 800, 0, V4L2_DV_HSYNC_POS_POL, \
391 146250000, 48, 32, 80, 3, 6, 38, 0, 0, 0, \
392 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \
393 V4L2_DV_FL_REDUCED_BLANKING) \
394}
395
396#define V4L2_DV_BT_DMT_1280X960P60 { \
397 .type = V4L2_DV_BT_656_1120, \
398 V4L2_INIT_BT_TIMINGS(1280, 960, 0, \
399 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
400 108000000, 96, 112, 312, 1, 3, 36, 0, 0, 0, \
401 V4L2_DV_BT_STD_DMT, 0) \
402}
403
404#define V4L2_DV_BT_DMT_1280X960P85 { \
405 .type = V4L2_DV_BT_656_1120, \
406 V4L2_INIT_BT_TIMINGS(1280, 960, 0, \
407 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
408 148500000, 64, 160, 224, 1, 3, 47, 0, 0, 0, \
409 V4L2_DV_BT_STD_DMT, 0) \
410}
411
412#define V4L2_DV_BT_DMT_1280X960P120_RB { \
413 .type = V4L2_DV_BT_656_1120, \
414 V4L2_INIT_BT_TIMINGS(1280, 960, 0, V4L2_DV_HSYNC_POS_POL, \
415 175500000, 48, 32, 80, 3, 4, 50, 0, 0, 0, \
416 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \
417 V4L2_DV_FL_REDUCED_BLANKING) \
418}
419
420/* SXGA resolutions */
421#define V4L2_DV_BT_DMT_1280X1024P60 { \
422 .type = V4L2_DV_BT_656_1120, \
423 V4L2_INIT_BT_TIMINGS(1280, 1024, 0, \
424 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
425 108000000, 48, 112, 248, 1, 3, 38, 0, 0, 0, \
426 V4L2_DV_BT_STD_DMT, 0) \
427}
428
429#define V4L2_DV_BT_DMT_1280X1024P75 { \
430 .type = V4L2_DV_BT_656_1120, \
431 V4L2_INIT_BT_TIMINGS(1280, 1024, 0, \
432 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
433 135000000, 16, 144, 248, 1, 3, 38, 0, 0, 0, \
434 V4L2_DV_BT_STD_DMT, 0) \
435}
436
437#define V4L2_DV_BT_DMT_1280X1024P85 { \
438 .type = V4L2_DV_BT_656_1120, \
439 V4L2_INIT_BT_TIMINGS(1280, 1024, 0, \
440 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
441 157500000, 64, 160, 224, 1, 3, 44, 0, 0, 0, \
442 V4L2_DV_BT_STD_DMT, 0) \
443}
444
445#define V4L2_DV_BT_DMT_1280X1024P120_RB { \
446 .type = V4L2_DV_BT_656_1120, \
447 V4L2_INIT_BT_TIMINGS(1280, 1024, 0, V4L2_DV_HSYNC_POS_POL, \
448 187250000, 48, 32, 80, 3, 7, 50, 0, 0, 0, \
449 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \
450 V4L2_DV_FL_REDUCED_BLANKING) \
451}
452
453#define V4L2_DV_BT_DMT_1360X768P60 { \
454 .type = V4L2_DV_BT_656_1120, \
455 V4L2_INIT_BT_TIMINGS(1360, 768, 0, \
456 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
457 85500000, 64, 112, 256, 3, 6, 18, 0, 0, 0, \
458 V4L2_DV_BT_STD_DMT, 0) \
459}
460
461#define V4L2_DV_BT_DMT_1360X768P120_RB { \
462 .type = V4L2_DV_BT_656_1120, \
463 V4L2_INIT_BT_TIMINGS(1360, 768, 0, V4L2_DV_HSYNC_POS_POL, \
464 148250000, 48, 32, 80, 3, 5, 37, 0, 0, 0, \
465 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \
466 V4L2_DV_FL_REDUCED_BLANKING) \
467}
468
469#define V4L2_DV_BT_DMT_1366X768P60 { \
470 .type = V4L2_DV_BT_656_1120, \
471 V4L2_INIT_BT_TIMINGS(1366, 768, 0, \
472 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
473 85500000, 70, 143, 213, 3, 3, 24, 0, 0, 0, \
474 V4L2_DV_BT_STD_DMT, 0) \
475}
476
477#define V4L2_DV_BT_DMT_1366X768P60_RB { \
478 .type = V4L2_DV_BT_656_1120, \
479 V4L2_INIT_BT_TIMINGS(1366, 768, 0, \
480 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
481 72000000, 14, 56, 64, 1, 3, 28, 0, 0, 0, \
482 V4L2_DV_BT_STD_DMT, V4L2_DV_FL_REDUCED_BLANKING) \
483}
484
485/* SXGA+ resolutions */
486#define V4L2_DV_BT_DMT_1400X1050P60_RB { \
487 .type = V4L2_DV_BT_656_1120, \
488 V4L2_INIT_BT_TIMINGS(1400, 1050, 0, V4L2_DV_HSYNC_POS_POL, \
489 101000000, 48, 32, 80, 3, 4, 23, 0, 0, 0, \
490 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \
491 V4L2_DV_FL_REDUCED_BLANKING) \
492}
493
494#define V4L2_DV_BT_DMT_1400X1050P60 { \
495 .type = V4L2_DV_BT_656_1120, \
496 V4L2_INIT_BT_TIMINGS(1400, 1050, 0, V4L2_DV_VSYNC_POS_POL, \
497 121750000, 88, 144, 232, 3, 4, 32, 0, 0, 0, \
498 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \
499}
500
501#define V4L2_DV_BT_DMT_1400X1050P75 { \
502 .type = V4L2_DV_BT_656_1120, \
503 V4L2_INIT_BT_TIMINGS(1400, 1050, 0, V4L2_DV_VSYNC_POS_POL, \
504 156000000, 104, 144, 248, 3, 4, 42, 0, 0, 0, \
505 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \
506}
507
508#define V4L2_DV_BT_DMT_1400X1050P85 { \
509 .type = V4L2_DV_BT_656_1120, \
510 V4L2_INIT_BT_TIMINGS(1400, 1050, 0, V4L2_DV_VSYNC_POS_POL, \
511 179500000, 104, 152, 256, 3, 4, 48, 0, 0, 0, \
512 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \
513}
514
515#define V4L2_DV_BT_DMT_1400X1050P120_RB { \
516 .type = V4L2_DV_BT_656_1120, \
517 V4L2_INIT_BT_TIMINGS(1400, 1050, 0, V4L2_DV_HSYNC_POS_POL, \
518 208000000, 48, 32, 80, 3, 4, 55, 0, 0, 0, \
519 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \
520 V4L2_DV_FL_REDUCED_BLANKING) \
521}
522
523/* WXGA+ resolutions */
524#define V4L2_DV_BT_DMT_1440X900P60_RB { \
525 .type = V4L2_DV_BT_656_1120, \
526 V4L2_INIT_BT_TIMINGS(1440, 900, 0, V4L2_DV_HSYNC_POS_POL, \
527 88750000, 48, 32, 80, 3, 6, 17, 0, 0, 0, \
528 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \
529 V4L2_DV_FL_REDUCED_BLANKING) \
530}
531
532#define V4L2_DV_BT_DMT_1440X900P60 { \
533 .type = V4L2_DV_BT_656_1120, \
534 V4L2_INIT_BT_TIMINGS(1440, 900, 0, V4L2_DV_VSYNC_POS_POL, \
535 106500000, 80, 152, 232, 3, 6, 25, 0, 0, 0, \
536 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \
537}
538
539#define V4L2_DV_BT_DMT_1440X900P75 { \
540 .type = V4L2_DV_BT_656_1120, \
541 V4L2_INIT_BT_TIMINGS(1440, 900, 0, V4L2_DV_VSYNC_POS_POL, \
542 136750000, 96, 152, 248, 3, 6, 33, 0, 0, 0, \
543 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \
544}
545
546#define V4L2_DV_BT_DMT_1440X900P85 { \
547 .type = V4L2_DV_BT_656_1120, \
548 V4L2_INIT_BT_TIMINGS(1440, 900, 0, V4L2_DV_VSYNC_POS_POL, \
549 157000000, 104, 152, 256, 3, 6, 39, 0, 0, 0, \
550 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \
551}
552
553#define V4L2_DV_BT_DMT_1440X900P120_RB { \
554 .type = V4L2_DV_BT_656_1120, \
555 V4L2_INIT_BT_TIMINGS(1440, 900, 0, V4L2_DV_HSYNC_POS_POL, \
556 182750000, 48, 32, 80, 3, 6, 44, 0, 0, 0, \
557 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \
558 V4L2_DV_FL_REDUCED_BLANKING) \
559}
560
561#define V4L2_DV_BT_DMT_1600X900P60_RB { \
562 .type = V4L2_DV_BT_656_1120, \
563 V4L2_INIT_BT_TIMINGS(1600, 900, 0, \
564 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
565 108000000, 24, 80, 96, 1, 3, 96, 0, 0, 0, \
566 V4L2_DV_BT_STD_DMT, V4L2_DV_FL_REDUCED_BLANKING) \
567}
568
569/* UXGA resolutions */
570#define V4L2_DV_BT_DMT_1600X1200P60 { \
571 .type = V4L2_DV_BT_656_1120, \
572 V4L2_INIT_BT_TIMINGS(1600, 1200, 0, \
573 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
574 162000000, 64, 192, 304, 1, 3, 46, 0, 0, 0, \
575 V4L2_DV_BT_STD_DMT, 0) \
576}
577
578#define V4L2_DV_BT_DMT_1600X1200P65 { \
579 .type = V4L2_DV_BT_656_1120, \
580 V4L2_INIT_BT_TIMINGS(1600, 1200, 0, \
581 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
582 175500000, 64, 192, 304, 1, 3, 46, 0, 0, 0, \
583 V4L2_DV_BT_STD_DMT, 0) \
584}
585
586#define V4L2_DV_BT_DMT_1600X1200P70 { \
587 .type = V4L2_DV_BT_656_1120, \
588 V4L2_INIT_BT_TIMINGS(1600, 1200, 0, \
589 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
590 189000000, 64, 192, 304, 1, 3, 46, 0, 0, 0, \
591 V4L2_DV_BT_STD_DMT, 0) \
592}
593
594#define V4L2_DV_BT_DMT_1600X1200P75 { \
595 .type = V4L2_DV_BT_656_1120, \
596 V4L2_INIT_BT_TIMINGS(1600, 1200, 0, \
597 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
598 202500000, 64, 192, 304, 1, 3, 46, 0, 0, 0, \
599 V4L2_DV_BT_STD_DMT, 0) \
600}
601
602#define V4L2_DV_BT_DMT_1600X1200P85 { \
603 .type = V4L2_DV_BT_656_1120, \
604 V4L2_INIT_BT_TIMINGS(1600, 1200, 0, \
605 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
606 229500000, 64, 192, 304, 1, 3, 46, 0, 0, 0, \
607 V4L2_DV_BT_STD_DMT, 0) \
608}
609
610#define V4L2_DV_BT_DMT_1600X1200P120_RB { \
611 .type = V4L2_DV_BT_656_1120, \
612 V4L2_INIT_BT_TIMINGS(1600, 1200, 0, V4L2_DV_HSYNC_POS_POL, \
613 268250000, 48, 32, 80, 3, 4, 64, 0, 0, 0, \
614 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \
615 V4L2_DV_FL_REDUCED_BLANKING) \
616}
617
618/* WSXGA+ resolutions */
619#define V4L2_DV_BT_DMT_1680X1050P60_RB { \
620 .type = V4L2_DV_BT_656_1120, \
621 V4L2_INIT_BT_TIMINGS(1680, 1050, 0, V4L2_DV_HSYNC_POS_POL, \
622 119000000, 48, 32, 80, 3, 6, 21, 0, 0, 0, \
623 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \
624 V4L2_DV_FL_REDUCED_BLANKING) \
625}
626
627#define V4L2_DV_BT_DMT_1680X1050P60 { \
628 .type = V4L2_DV_BT_656_1120, \
629 V4L2_INIT_BT_TIMINGS(1680, 1050, 0, V4L2_DV_VSYNC_POS_POL, \
630 146250000, 104, 176, 280, 3, 6, 30, 0, 0, 0, \
631 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \
632}
633
634#define V4L2_DV_BT_DMT_1680X1050P75 { \
635 .type = V4L2_DV_BT_656_1120, \
636 V4L2_INIT_BT_TIMINGS(1680, 1050, 0, V4L2_DV_VSYNC_POS_POL, \
637 187000000, 120, 176, 296, 3, 6, 40, 0, 0, 0, \
638 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \
639}
640
641#define V4L2_DV_BT_DMT_1680X1050P85 { \
642 .type = V4L2_DV_BT_656_1120, \
643 V4L2_INIT_BT_TIMINGS(1680, 1050, 0, V4L2_DV_VSYNC_POS_POL, \
644 214750000, 128, 176, 304, 3, 6, 46, 0, 0, 0, \
645 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \
646}
647
648#define V4L2_DV_BT_DMT_1680X1050P120_RB { \
649 .type = V4L2_DV_BT_656_1120, \
650 V4L2_INIT_BT_TIMINGS(1680, 1050, 0, V4L2_DV_HSYNC_POS_POL, \
651 245500000, 48, 32, 80, 3, 6, 53, 0, 0, 0, \
652 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \
653 V4L2_DV_FL_REDUCED_BLANKING) \
654}
655
656#define V4L2_DV_BT_DMT_1792X1344P60 { \
657 .type = V4L2_DV_BT_656_1120, \
658 V4L2_INIT_BT_TIMINGS(1792, 1344, 0, V4L2_DV_VSYNC_POS_POL, \
659 204750000, 128, 200, 328, 1, 3, 46, 0, 0, 0, \
660 V4L2_DV_BT_STD_DMT, 0) \
661}
662
663#define V4L2_DV_BT_DMT_1792X1344P75 { \
664 .type = V4L2_DV_BT_656_1120, \
665 V4L2_INIT_BT_TIMINGS(1792, 1344, 0, V4L2_DV_VSYNC_POS_POL, \
666 261000000, 96, 216, 352, 1, 3, 69, 0, 0, 0, \
667 V4L2_DV_BT_STD_DMT, 0) \
668}
669
670#define V4L2_DV_BT_DMT_1792X1344P120_RB { \
671 .type = V4L2_DV_BT_656_1120, \
672 V4L2_INIT_BT_TIMINGS(1792, 1344, 0, V4L2_DV_HSYNC_POS_POL, \
673 333250000, 48, 32, 80, 3, 4, 72, 0, 0, 0, \
674 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \
675 V4L2_DV_FL_REDUCED_BLANKING) \
676}
677
678#define V4L2_DV_BT_DMT_1856X1392P60 { \
679 .type = V4L2_DV_BT_656_1120, \
680 V4L2_INIT_BT_TIMINGS(1856, 1392, 0, V4L2_DV_VSYNC_POS_POL, \
681 218250000, 96, 224, 352, 1, 3, 43, 0, 0, 0, \
682 V4L2_DV_BT_STD_DMT, 0) \
683}
684
685#define V4L2_DV_BT_DMT_1856X1392P75 { \
686 .type = V4L2_DV_BT_656_1120, \
687 V4L2_INIT_BT_TIMINGS(1856, 1392, 0, V4L2_DV_VSYNC_POS_POL, \
688 288000000, 128, 224, 352, 1, 3, 104, 0, 0, 0, \
689 V4L2_DV_BT_STD_DMT, 0) \
690}
691
692#define V4L2_DV_BT_DMT_1856X1392P120_RB { \
693 .type = V4L2_DV_BT_656_1120, \
694 V4L2_INIT_BT_TIMINGS(1856, 1392, 0, V4L2_DV_HSYNC_POS_POL, \
695 356500000, 48, 32, 80, 3, 4, 75, 0, 0, 0, \
696 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \
697 V4L2_DV_FL_REDUCED_BLANKING) \
698}
699
700#define V4L2_DV_BT_DMT_1920X1080P60 V4L2_DV_BT_CEA_1920X1080P60
701
702/* WUXGA resolutions */
703#define V4L2_DV_BT_DMT_1920X1200P60_RB { \
704 .type = V4L2_DV_BT_656_1120, \
705 V4L2_INIT_BT_TIMINGS(1920, 1200, 0, V4L2_DV_HSYNC_POS_POL, \
706 154000000, 48, 32, 80, 3, 6, 26, 0, 0, 0, \
707 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \
708 V4L2_DV_FL_REDUCED_BLANKING) \
709}
710
711#define V4L2_DV_BT_DMT_1920X1200P60 { \
712 .type = V4L2_DV_BT_656_1120, \
713 V4L2_INIT_BT_TIMINGS(1920, 1200, 0, V4L2_DV_VSYNC_POS_POL, \
714 193250000, 136, 200, 336, 3, 6, 36, 0, 0, 0, \
715 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \
716}
717
718#define V4L2_DV_BT_DMT_1920X1200P75 { \
719 .type = V4L2_DV_BT_656_1120, \
720 V4L2_INIT_BT_TIMINGS(1920, 1200, 0, V4L2_DV_VSYNC_POS_POL, \
721 245250000, 136, 208, 344, 3, 6, 46, 0, 0, 0, \
722 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \
723}
724
725#define V4L2_DV_BT_DMT_1920X1200P85 { \
726 .type = V4L2_DV_BT_656_1120, \
727 V4L2_INIT_BT_TIMINGS(1920, 1200, 0, V4L2_DV_VSYNC_POS_POL, \
728 281250000, 144, 208, 352, 3, 6, 53, 0, 0, 0, \
729 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \
730}
731
732#define V4L2_DV_BT_DMT_1920X1200P120_RB { \
733 .type = V4L2_DV_BT_656_1120, \
734 V4L2_INIT_BT_TIMINGS(1920, 1200, 0, V4L2_DV_HSYNC_POS_POL, \
735 317000000, 48, 32, 80, 3, 6, 62, 0, 0, 0, \
736 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \
737 V4L2_DV_FL_REDUCED_BLANKING) \
738}
739
740#define V4L2_DV_BT_DMT_1920X1440P60 { \
741 .type = V4L2_DV_BT_656_1120, \
742 V4L2_INIT_BT_TIMINGS(1920, 1440, 0, V4L2_DV_VSYNC_POS_POL, \
743 234000000, 128, 208, 344, 1, 3, 56, 0, 0, 0, \
744 V4L2_DV_BT_STD_DMT, 0) \
745}
746
747#define V4L2_DV_BT_DMT_1920X1440P75 { \
748 .type = V4L2_DV_BT_656_1120, \
749 V4L2_INIT_BT_TIMINGS(1920, 1440, 0, V4L2_DV_VSYNC_POS_POL, \
750 297000000, 144, 224, 352, 1, 3, 56, 0, 0, 0, \
751 V4L2_DV_BT_STD_DMT, 0) \
752}
753
754#define V4L2_DV_BT_DMT_1920X1440P120_RB { \
755 .type = V4L2_DV_BT_656_1120, \
756 V4L2_INIT_BT_TIMINGS(1920, 1440, 0, V4L2_DV_HSYNC_POS_POL, \
757 380500000, 48, 32, 80, 3, 4, 78, 0, 0, 0, \
758 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \
759 V4L2_DV_FL_REDUCED_BLANKING) \
760}
761
762#define V4L2_DV_BT_DMT_2048X1152P60_RB { \
763 .type = V4L2_DV_BT_656_1120, \
764 V4L2_INIT_BT_TIMINGS(2048, 1152, 0, \
765 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
766 162000000, 26, 80, 96, 1, 3, 44, 0, 0, 0, \
767 V4L2_DV_BT_STD_DMT, V4L2_DV_FL_REDUCED_BLANKING) \
768}
769
770/* WQXGA resolutions */
771#define V4L2_DV_BT_DMT_2560X1600P60_RB { \
772 .type = V4L2_DV_BT_656_1120, \
773 V4L2_INIT_BT_TIMINGS(2560, 1600, 0, V4L2_DV_HSYNC_POS_POL, \
774 268500000, 48, 32, 80, 3, 6, 37, 0, 0, 0, \
775 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \
776 V4L2_DV_FL_REDUCED_BLANKING) \
777}
778
779#define V4L2_DV_BT_DMT_2560X1600P60 { \
780 .type = V4L2_DV_BT_656_1120, \
781 V4L2_INIT_BT_TIMINGS(2560, 1600, 0, V4L2_DV_VSYNC_POS_POL, \
782 348500000, 192, 280, 472, 3, 6, 49, 0, 0, 0, \
783 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \
784}
785
786#define V4L2_DV_BT_DMT_2560X1600P75 { \
787 .type = V4L2_DV_BT_656_1120, \
788 V4L2_INIT_BT_TIMINGS(2560, 1600, 0, V4L2_DV_VSYNC_POS_POL, \
789 443250000, 208, 280, 488, 3, 6, 63, 0, 0, 0, \
790 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \
791}
792
793#define V4L2_DV_BT_DMT_2560X1600P85 { \
794 .type = V4L2_DV_BT_656_1120, \
795 V4L2_INIT_BT_TIMINGS(2560, 1600, 0, V4L2_DV_VSYNC_POS_POL, \
796 505250000, 208, 280, 488, 3, 6, 73, 0, 0, 0, \
797 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \
798}
799
800#define V4L2_DV_BT_DMT_2560X1600P120_RB { \
801 .type = V4L2_DV_BT_656_1120, \
802 V4L2_INIT_BT_TIMINGS(2560, 1600, 0, V4L2_DV_HSYNC_POS_POL, \
803 552750000, 48, 32, 80, 3, 6, 85, 0, 0, 0, \
804 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \
805 V4L2_DV_FL_REDUCED_BLANKING) \
806}
807
808#define V4L2_DV_BT_DMT_1366X768P60 { \
809 .type = V4L2_DV_BT_656_1120, \
810 V4L2_INIT_BT_TIMINGS(1366, 768, 0, \
811 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
812 85500000, 70, 143, 213, 3, 3, 24, 0, 0, 0, \
813 V4L2_DV_BT_STD_DMT, 0) \
814}
815
816#endif
diff --git a/include/linux/v4l2-subdev.h b/include/linux/v4l2-subdev.h
index ed29cbbebfef..812019ee1e06 100644
--- a/include/linux/v4l2-subdev.h
+++ b/include/linux/v4l2-subdev.h
@@ -123,6 +123,43 @@ struct v4l2_subdev_frame_interval_enum {
123 __u32 reserved[9]; 123 __u32 reserved[9];
124}; 124};
125 125
126#define V4L2_SUBDEV_SEL_FLAG_SIZE_GE (1 << 0)
127#define V4L2_SUBDEV_SEL_FLAG_SIZE_LE (1 << 1)
128#define V4L2_SUBDEV_SEL_FLAG_KEEP_CONFIG (1 << 2)
129
130/* active cropping area */
131#define V4L2_SUBDEV_SEL_TGT_CROP_ACTUAL 0x0000
132/* cropping bounds */
133#define V4L2_SUBDEV_SEL_TGT_CROP_BOUNDS 0x0002
134/* current composing area */
135#define V4L2_SUBDEV_SEL_TGT_COMPOSE_ACTUAL 0x0100
136/* composing bounds */
137#define V4L2_SUBDEV_SEL_TGT_COMPOSE_BOUNDS 0x0102
138
139
140/**
141 * struct v4l2_subdev_selection - selection info
142 *
143 * @which: either V4L2_SUBDEV_FORMAT_ACTIVE or V4L2_SUBDEV_FORMAT_TRY
144 * @pad: pad number, as reported by the media API
145 * @target: selection target, used to choose one of possible rectangles
146 * @flags: constraint flags
147 * @r: coordinates of the selection window
148 * @reserved: for future use, set to zero for now
149 *
150 * Hardware may use multiple helper windows to process a video stream.
151 * The structure is used to exchange this selection areas between
152 * an application and a driver.
153 */
154struct v4l2_subdev_selection {
155 __u32 which;
156 __u32 pad;
157 __u32 target;
158 __u32 flags;
159 struct v4l2_rect r;
160 __u32 reserved[8];
161};
162
126#define VIDIOC_SUBDEV_G_FMT _IOWR('V', 4, struct v4l2_subdev_format) 163#define VIDIOC_SUBDEV_G_FMT _IOWR('V', 4, struct v4l2_subdev_format)
127#define VIDIOC_SUBDEV_S_FMT _IOWR('V', 5, struct v4l2_subdev_format) 164#define VIDIOC_SUBDEV_S_FMT _IOWR('V', 5, struct v4l2_subdev_format)
128#define VIDIOC_SUBDEV_G_FRAME_INTERVAL \ 165#define VIDIOC_SUBDEV_G_FRAME_INTERVAL \
@@ -137,5 +174,9 @@ struct v4l2_subdev_frame_interval_enum {
137 _IOWR('V', 75, struct v4l2_subdev_frame_interval_enum) 174 _IOWR('V', 75, struct v4l2_subdev_frame_interval_enum)
138#define VIDIOC_SUBDEV_G_CROP _IOWR('V', 59, struct v4l2_subdev_crop) 175#define VIDIOC_SUBDEV_G_CROP _IOWR('V', 59, struct v4l2_subdev_crop)
139#define VIDIOC_SUBDEV_S_CROP _IOWR('V', 60, struct v4l2_subdev_crop) 176#define VIDIOC_SUBDEV_S_CROP _IOWR('V', 60, struct v4l2_subdev_crop)
177#define VIDIOC_SUBDEV_G_SELECTION \
178 _IOWR('V', 61, struct v4l2_subdev_selection)
179#define VIDIOC_SUBDEV_S_SELECTION \
180 _IOWR('V', 62, struct v4l2_subdev_selection)
140 181
141#endif 182#endif
diff --git a/include/linux/vga_switcheroo.h b/include/linux/vga_switcheroo.h
index 4b9a7f596f92..b455c7c212eb 100644
--- a/include/linux/vga_switcheroo.h
+++ b/include/linux/vga_switcheroo.h
@@ -28,13 +28,19 @@ struct vga_switcheroo_handler {
28 int (*get_client_id)(struct pci_dev *pdev); 28 int (*get_client_id)(struct pci_dev *pdev);
29}; 29};
30 30
31struct vga_switcheroo_client_ops {
32 void (*set_gpu_state)(struct pci_dev *dev, enum vga_switcheroo_state);
33 void (*reprobe)(struct pci_dev *dev);
34 bool (*can_switch)(struct pci_dev *dev);
35};
31 36
32#if defined(CONFIG_VGA_SWITCHEROO) 37#if defined(CONFIG_VGA_SWITCHEROO)
33void vga_switcheroo_unregister_client(struct pci_dev *dev); 38void vga_switcheroo_unregister_client(struct pci_dev *dev);
34int vga_switcheroo_register_client(struct pci_dev *dev, 39int vga_switcheroo_register_client(struct pci_dev *dev,
35 void (*set_gpu_state)(struct pci_dev *dev, enum vga_switcheroo_state), 40 const struct vga_switcheroo_client_ops *ops);
36 void (*reprobe)(struct pci_dev *dev), 41int vga_switcheroo_register_audio_client(struct pci_dev *pdev,
37 bool (*can_switch)(struct pci_dev *dev)); 42 const struct vga_switcheroo_client_ops *ops,
43 int id, bool active);
38 44
39void vga_switcheroo_client_fb_set(struct pci_dev *dev, 45void vga_switcheroo_client_fb_set(struct pci_dev *dev,
40 struct fb_info *info); 46 struct fb_info *info);
@@ -48,11 +54,12 @@ int vga_switcheroo_process_delayed_switch(void);
48 54
49static inline void vga_switcheroo_unregister_client(struct pci_dev *dev) {} 55static inline void vga_switcheroo_unregister_client(struct pci_dev *dev) {}
50static inline int vga_switcheroo_register_client(struct pci_dev *dev, 56static inline int vga_switcheroo_register_client(struct pci_dev *dev,
51 void (*set_gpu_state)(struct pci_dev *dev, enum vga_switcheroo_state), 57 const struct vga_switcheroo_client_ops *ops) { return 0; }
52 void (*reprobe)(struct pci_dev *dev),
53 bool (*can_switch)(struct pci_dev *dev)) { return 0; }
54static inline void vga_switcheroo_client_fb_set(struct pci_dev *dev, struct fb_info *info) {} 58static inline void vga_switcheroo_client_fb_set(struct pci_dev *dev, struct fb_info *info) {}
55static inline int vga_switcheroo_register_handler(struct vga_switcheroo_handler *handler) { return 0; } 59static inline int vga_switcheroo_register_handler(struct vga_switcheroo_handler *handler) { return 0; }
60static inline int vga_switcheroo_register_audio_client(struct pci_dev *pdev,
61 const struct vga_switcheroo_client_ops *ops,
62 int id, bool active) { return 0; }
56static inline void vga_switcheroo_unregister_handler(void) {} 63static inline void vga_switcheroo_unregister_handler(void) {}
57static inline int vga_switcheroo_process_delayed_switch(void) { return 0; } 64static inline int vga_switcheroo_process_delayed_switch(void) { return 0; }
58 65
diff --git a/include/linux/vgaarb.h b/include/linux/vgaarb.h
index b572f80bdfd5..0ee42d9acdc0 100644
--- a/include/linux/vgaarb.h
+++ b/include/linux/vgaarb.h
@@ -31,6 +31,7 @@
31#ifndef LINUX_VGA_H 31#ifndef LINUX_VGA_H
32#define LINUX_VGA_H 32#define LINUX_VGA_H
33 33
34#include <video/vga.h>
34 35
35/* Legacy VGA regions */ 36/* Legacy VGA regions */
36#define VGA_RSRC_NONE 0x00 37#define VGA_RSRC_NONE 0x00
@@ -182,7 +183,13 @@ extern void vga_put(struct pci_dev *pdev, unsigned int rsrc);
182 */ 183 */
183 184
184#ifndef __ARCH_HAS_VGA_DEFAULT_DEVICE 185#ifndef __ARCH_HAS_VGA_DEFAULT_DEVICE
186#ifdef CONFIG_VGA_ARB
185extern struct pci_dev *vga_default_device(void); 187extern struct pci_dev *vga_default_device(void);
188extern void vga_set_default_device(struct pci_dev *pdev);
189#else
190static inline struct pci_dev *vga_default_device(void) { return NULL; };
191static inline void vga_set_default_device(struct pci_dev *pdev) { };
192#endif
186#endif 193#endif
187 194
188/** 195/**
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index c9c9a4680cc5..370d11106c11 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -292,10 +292,10 @@ struct v4l2_pix_format {
292 __u32 width; 292 __u32 width;
293 __u32 height; 293 __u32 height;
294 __u32 pixelformat; 294 __u32 pixelformat;
295 enum v4l2_field field; 295 __u32 field; /* enum v4l2_field */
296 __u32 bytesperline; /* for padding, zero if unused */ 296 __u32 bytesperline; /* for padding, zero if unused */
297 __u32 sizeimage; 297 __u32 sizeimage;
298 enum v4l2_colorspace colorspace; 298 __u32 colorspace; /* enum v4l2_colorspace */
299 __u32 priv; /* private data, depends on pixelformat */ 299 __u32 priv; /* private data, depends on pixelformat */
300}; 300};
301 301
@@ -378,7 +378,10 @@ struct v4l2_pix_format {
378#define V4L2_PIX_FMT_SGRBG12 v4l2_fourcc('B', 'A', '1', '2') /* 12 GRGR.. BGBG.. */ 378#define V4L2_PIX_FMT_SGRBG12 v4l2_fourcc('B', 'A', '1', '2') /* 12 GRGR.. BGBG.. */
379#define V4L2_PIX_FMT_SRGGB12 v4l2_fourcc('R', 'G', '1', '2') /* 12 RGRG.. GBGB.. */ 379#define V4L2_PIX_FMT_SRGGB12 v4l2_fourcc('R', 'G', '1', '2') /* 12 RGRG.. GBGB.. */
380 /* 10bit raw bayer DPCM compressed to 8 bits */ 380 /* 10bit raw bayer DPCM compressed to 8 bits */
381#define V4L2_PIX_FMT_SBGGR10DPCM8 v4l2_fourcc('b', 'B', 'A', '8')
382#define V4L2_PIX_FMT_SGBRG10DPCM8 v4l2_fourcc('b', 'G', 'A', '8')
381#define V4L2_PIX_FMT_SGRBG10DPCM8 v4l2_fourcc('B', 'D', '1', '0') 383#define V4L2_PIX_FMT_SGRBG10DPCM8 v4l2_fourcc('B', 'D', '1', '0')
384#define V4L2_PIX_FMT_SRGGB10DPCM8 v4l2_fourcc('b', 'R', 'A', '8')
382 /* 385 /*
383 * 10bit raw bayer, expanded to 16 bits 386 * 10bit raw bayer, expanded to 16 bits
384 * xxxxrrrrrrrrrrxxxxgggggggggg xxxxggggggggggxxxxbbbbbbbbbb... 387 * xxxxrrrrrrrrrrxxxxgggggggggg xxxxggggggggggxxxxbbbbbbbbbb...
@@ -432,7 +435,7 @@ struct v4l2_pix_format {
432 */ 435 */
433struct v4l2_fmtdesc { 436struct v4l2_fmtdesc {
434 __u32 index; /* Format number */ 437 __u32 index; /* Format number */
435 enum v4l2_buf_type type; /* buffer type */ 438 __u32 type; /* enum v4l2_buf_type */
436 __u32 flags; 439 __u32 flags;
437 __u8 description[32]; /* Description string */ 440 __u8 description[32]; /* Description string */
438 __u32 pixelformat; /* Format fourcc */ 441 __u32 pixelformat; /* Format fourcc */
@@ -573,8 +576,8 @@ struct v4l2_jpegcompression {
573 */ 576 */
574struct v4l2_requestbuffers { 577struct v4l2_requestbuffers {
575 __u32 count; 578 __u32 count;
576 enum v4l2_buf_type type; 579 __u32 type; /* enum v4l2_buf_type */
577 enum v4l2_memory memory; 580 __u32 memory; /* enum v4l2_memory */
578 __u32 reserved[2]; 581 __u32 reserved[2];
579}; 582};
580 583
@@ -610,15 +613,17 @@ struct v4l2_plane {
610/** 613/**
611 * struct v4l2_buffer - video buffer info 614 * struct v4l2_buffer - video buffer info
612 * @index: id number of the buffer 615 * @index: id number of the buffer
613 * @type: buffer type (type == *_MPLANE for multiplanar buffers) 616 * @type: enum v4l2_buf_type; buffer type (type == *_MPLANE for
617 * multiplanar buffers);
614 * @bytesused: number of bytes occupied by data in the buffer (payload); 618 * @bytesused: number of bytes occupied by data in the buffer (payload);
615 * unused (set to 0) for multiplanar buffers 619 * unused (set to 0) for multiplanar buffers
616 * @flags: buffer informational flags 620 * @flags: buffer informational flags
617 * @field: field order of the image in the buffer 621 * @field: enum v4l2_field; field order of the image in the buffer
618 * @timestamp: frame timestamp 622 * @timestamp: frame timestamp
619 * @timecode: frame timecode 623 * @timecode: frame timecode
620 * @sequence: sequence count of this frame 624 * @sequence: sequence count of this frame
621 * @memory: the method, in which the actual video data is passed 625 * @memory: enum v4l2_memory; the method, in which the actual video data is
626 * passed
622 * @offset: for non-multiplanar buffers with memory == V4L2_MEMORY_MMAP; 627 * @offset: for non-multiplanar buffers with memory == V4L2_MEMORY_MMAP;
623 * offset from the start of the device memory for this plane, 628 * offset from the start of the device memory for this plane,
624 * (or a "cookie" that should be passed to mmap() as offset) 629 * (or a "cookie" that should be passed to mmap() as offset)
@@ -636,16 +641,16 @@ struct v4l2_plane {
636 */ 641 */
637struct v4l2_buffer { 642struct v4l2_buffer {
638 __u32 index; 643 __u32 index;
639 enum v4l2_buf_type type; 644 __u32 type;
640 __u32 bytesused; 645 __u32 bytesused;
641 __u32 flags; 646 __u32 flags;
642 enum v4l2_field field; 647 __u32 field;
643 struct timeval timestamp; 648 struct timeval timestamp;
644 struct v4l2_timecode timecode; 649 struct v4l2_timecode timecode;
645 __u32 sequence; 650 __u32 sequence;
646 651
647 /* memory location */ 652 /* memory location */
648 enum v4l2_memory memory; 653 __u32 memory;
649 union { 654 union {
650 __u32 offset; 655 __u32 offset;
651 unsigned long userptr; 656 unsigned long userptr;
@@ -708,7 +713,7 @@ struct v4l2_clip {
708 713
709struct v4l2_window { 714struct v4l2_window {
710 struct v4l2_rect w; 715 struct v4l2_rect w;
711 enum v4l2_field field; 716 __u32 field; /* enum v4l2_field */
712 __u32 chromakey; 717 __u32 chromakey;
713 struct v4l2_clip __user *clips; 718 struct v4l2_clip __user *clips;
714 __u32 clipcount; 719 __u32 clipcount;
@@ -745,14 +750,14 @@ struct v4l2_outputparm {
745 * I N P U T I M A G E C R O P P I N G 750 * I N P U T I M A G E C R O P P I N G
746 */ 751 */
747struct v4l2_cropcap { 752struct v4l2_cropcap {
748 enum v4l2_buf_type type; 753 __u32 type; /* enum v4l2_buf_type */
749 struct v4l2_rect bounds; 754 struct v4l2_rect bounds;
750 struct v4l2_rect defrect; 755 struct v4l2_rect defrect;
751 struct v4l2_fract pixelaspect; 756 struct v4l2_fract pixelaspect;
752}; 757};
753 758
754struct v4l2_crop { 759struct v4l2_crop {
755 enum v4l2_buf_type type; 760 __u32 type; /* enum v4l2_buf_type */
756 struct v4l2_rect c; 761 struct v4l2_rect c;
757}; 762};
758 763
@@ -939,6 +944,9 @@ struct v4l2_standard {
939 __u32 reserved[4]; 944 __u32 reserved[4];
940}; 945};
941 946
947/* The DV Preset API is deprecated in favor of the DV Timings API.
948 New drivers shouldn't use this anymore! */
949
942/* 950/*
943 * V I D E O T I M I N G S D V P R E S E T 951 * V I D E O T I M I N G S D V P R E S E T
944 */ 952 */
@@ -986,29 +994,56 @@ struct v4l2_dv_enum_preset {
986 * D V B T T I M I N G S 994 * D V B T T I M I N G S
987 */ 995 */
988 996
989/* BT.656/BT.1120 timing data */ 997/** struct v4l2_bt_timings - BT.656/BT.1120 timing data
998 * @width: total width of the active video in pixels
999 * @height: total height of the active video in lines
1000 * @interlaced: Interlaced or progressive
1001 * @polarities: Positive or negative polarities
1002 * @pixelclock: Pixel clock in HZ. Ex. 74.25MHz->74250000
1003 * @hfrontporch:Horizontal front porch in pixels
1004 * @hsync: Horizontal Sync length in pixels
1005 * @hbackporch: Horizontal back porch in pixels
1006 * @vfrontporch:Vertical front porch in lines
1007 * @vsync: Vertical Sync length in lines
1008 * @vbackporch: Vertical back porch in lines
1009 * @il_vfrontporch:Vertical front porch for the even field
1010 * (aka field 2) of interlaced field formats
1011 * @il_vsync: Vertical Sync length for the even field
1012 * (aka field 2) of interlaced field formats
1013 * @il_vbackporch:Vertical back porch for the even field
1014 * (aka field 2) of interlaced field formats
1015 * @standards: Standards the timing belongs to
1016 * @flags: Flags
1017 * @reserved: Reserved fields, must be zeroed.
1018 *
1019 * A note regarding vertical interlaced timings: height refers to the total
1020 * height of the active video frame (= two fields). The blanking timings refer
1021 * to the blanking of each field. So the height of the total frame is
1022 * calculated as follows:
1023 *
1024 * tot_height = height + vfrontporch + vsync + vbackporch +
1025 * il_vfrontporch + il_vsync + il_vbackporch
1026 *
1027 * The active height of each field is height / 2.
1028 */
990struct v4l2_bt_timings { 1029struct v4l2_bt_timings {
991 __u32 width; /* width in pixels */ 1030 __u32 width;
992 __u32 height; /* height in lines */ 1031 __u32 height;
993 __u32 interlaced; /* Interlaced or progressive */ 1032 __u32 interlaced;
994 __u32 polarities; /* Positive or negative polarity */ 1033 __u32 polarities;
995 __u64 pixelclock; /* Pixel clock in HZ. Ex. 74.25MHz->74250000 */ 1034 __u64 pixelclock;
996 __u32 hfrontporch; /* Horizpontal front porch in pixels */ 1035 __u32 hfrontporch;
997 __u32 hsync; /* Horizontal Sync length in pixels */ 1036 __u32 hsync;
998 __u32 hbackporch; /* Horizontal back porch in pixels */ 1037 __u32 hbackporch;
999 __u32 vfrontporch; /* Vertical front porch in pixels */ 1038 __u32 vfrontporch;
1000 __u32 vsync; /* Vertical Sync length in lines */ 1039 __u32 vsync;
1001 __u32 vbackporch; /* Vertical back porch in lines */ 1040 __u32 vbackporch;
1002 __u32 il_vfrontporch; /* Vertical front porch for bottom field of 1041 __u32 il_vfrontporch;
1003 * interlaced field formats 1042 __u32 il_vsync;
1004 */ 1043 __u32 il_vbackporch;
1005 __u32 il_vsync; /* Vertical sync length for bottom field of 1044 __u32 standards;
1006 * interlaced field formats 1045 __u32 flags;
1007 */ 1046 __u32 reserved[14];
1008 __u32 il_vbackporch; /* Vertical back porch for bottom field of
1009 * interlaced field formats
1010 */
1011 __u32 reserved[16];
1012} __attribute__ ((packed)); 1047} __attribute__ ((packed));
1013 1048
1014/* Interlaced or progressive format */ 1049/* Interlaced or progressive format */
@@ -1019,8 +1054,42 @@ struct v4l2_bt_timings {
1019#define V4L2_DV_VSYNC_POS_POL 0x00000001 1054#define V4L2_DV_VSYNC_POS_POL 0x00000001
1020#define V4L2_DV_HSYNC_POS_POL 0x00000002 1055#define V4L2_DV_HSYNC_POS_POL 0x00000002
1021 1056
1022 1057/* Timings standards */
1023/* DV timings */ 1058#define V4L2_DV_BT_STD_CEA861 (1 << 0) /* CEA-861 Digital TV Profile */
1059#define V4L2_DV_BT_STD_DMT (1 << 1) /* VESA Discrete Monitor Timings */
1060#define V4L2_DV_BT_STD_CVT (1 << 2) /* VESA Coordinated Video Timings */
1061#define V4L2_DV_BT_STD_GTF (1 << 3) /* VESA Generalized Timings Formula */
1062
1063/* Flags */
1064
1065/* CVT/GTF specific: timing uses reduced blanking (CVT) or the 'Secondary
1066 GTF' curve (GTF). In both cases the horizontal and/or vertical blanking
1067 intervals are reduced, allowing a higher resolution over the same
1068 bandwidth. This is a read-only flag. */
1069#define V4L2_DV_FL_REDUCED_BLANKING (1 << 0)
1070/* CEA-861 specific: set for CEA-861 formats with a framerate of a multiple
1071 of six. These formats can be optionally played at 1 / 1.001 speed.
1072 This is a read-only flag. */
1073#define V4L2_DV_FL_CAN_REDUCE_FPS (1 << 1)
1074/* CEA-861 specific: only valid for video transmitters, the flag is cleared
1075 by receivers.
1076 If the framerate of the format is a multiple of six, then the pixelclock
1077 used to set up the transmitter is divided by 1.001 to make it compatible
1078 with 60 Hz based standards such as NTSC and PAL-M that use a framerate of
1079 29.97 Hz. Otherwise this flag is cleared. If the transmitter can't generate
1080 such frequencies, then the flag will also be cleared. */
1081#define V4L2_DV_FL_REDUCED_FPS (1 << 2)
1082/* Specific to interlaced formats: if set, then field 1 is really one half-line
1083 longer and field 2 is really one half-line shorter, so each field has
1084 exactly the same number of half-lines. Whether half-lines can be detected
1085 or used depends on the hardware. */
1086#define V4L2_DV_FL_HALF_LINE (1 << 0)
1087
1088
1089/** struct v4l2_dv_timings - DV timings
1090 * @type: the type of the timings
1091 * @bt: BT656/1120 timings
1092 */
1024struct v4l2_dv_timings { 1093struct v4l2_dv_timings {
1025 __u32 type; 1094 __u32 type;
1026 union { 1095 union {
@@ -1032,6 +1101,64 @@ struct v4l2_dv_timings {
1032/* Values for the type field */ 1101/* Values for the type field */
1033#define V4L2_DV_BT_656_1120 0 /* BT.656/1120 timing type */ 1102#define V4L2_DV_BT_656_1120 0 /* BT.656/1120 timing type */
1034 1103
1104
1105/** struct v4l2_enum_dv_timings - DV timings enumeration
1106 * @index: enumeration index
1107 * @reserved: must be zeroed
1108 * @timings: the timings for the given index
1109 */
1110struct v4l2_enum_dv_timings {
1111 __u32 index;
1112 __u32 reserved[3];
1113 struct v4l2_dv_timings timings;
1114};
1115
1116/** struct v4l2_bt_timings_cap - BT.656/BT.1120 timing capabilities
1117 * @min_width: width in pixels
1118 * @max_width: width in pixels
1119 * @min_height: height in lines
1120 * @max_height: height in lines
1121 * @min_pixelclock: Pixel clock in HZ. Ex. 74.25MHz->74250000
1122 * @max_pixelclock: Pixel clock in HZ. Ex. 74.25MHz->74250000
1123 * @standards: Supported standards
1124 * @capabilities: Supported capabilities
1125 * @reserved: Must be zeroed
1126 */
1127struct v4l2_bt_timings_cap {
1128 __u32 min_width;
1129 __u32 max_width;
1130 __u32 min_height;
1131 __u32 max_height;
1132 __u64 min_pixelclock;
1133 __u64 max_pixelclock;
1134 __u32 standards;
1135 __u32 capabilities;
1136 __u32 reserved[16];
1137} __attribute__ ((packed));
1138
1139/* Supports interlaced formats */
1140#define V4L2_DV_BT_CAP_INTERLACED (1 << 0)
1141/* Supports progressive formats */
1142#define V4L2_DV_BT_CAP_PROGRESSIVE (1 << 1)
1143/* Supports CVT/GTF reduced blanking */
1144#define V4L2_DV_BT_CAP_REDUCED_BLANKING (1 << 2)
1145/* Supports custom formats */
1146#define V4L2_DV_BT_CAP_CUSTOM (1 << 3)
1147
1148/** struct v4l2_dv_timings_cap - DV timings capabilities
1149 * @type: the type of the timings (same as in struct v4l2_dv_timings)
1150 * @bt: the BT656/1120 timings capabilities
1151 */
1152struct v4l2_dv_timings_cap {
1153 __u32 type;
1154 __u32 reserved[3];
1155 union {
1156 struct v4l2_bt_timings_cap bt;
1157 __u32 raw_data[32];
1158 };
1159};
1160
1161
1035/* 1162/*
1036 * V I D E O I N P U T S 1163 * V I D E O I N P U T S
1037 */ 1164 */
@@ -1040,7 +1167,7 @@ struct v4l2_input {
1040 __u8 name[32]; /* Label */ 1167 __u8 name[32]; /* Label */
1041 __u32 type; /* Type of input */ 1168 __u32 type; /* Type of input */
1042 __u32 audioset; /* Associated audios (bitfield) */ 1169 __u32 audioset; /* Associated audios (bitfield) */
1043 __u32 tuner; /* Associated tuner */ 1170 __u32 tuner; /* enum v4l2_tuner_type */
1044 v4l2_std_id std; 1171 v4l2_std_id std;
1045 __u32 status; 1172 __u32 status;
1046 __u32 capabilities; 1173 __u32 capabilities;
@@ -1137,6 +1264,8 @@ struct v4l2_ext_controls {
1137#define V4L2_CTRL_CLASS_FM_TX 0x009b0000 /* FM Modulator control class */ 1264#define V4L2_CTRL_CLASS_FM_TX 0x009b0000 /* FM Modulator control class */
1138#define V4L2_CTRL_CLASS_FLASH 0x009c0000 /* Camera flash controls */ 1265#define V4L2_CTRL_CLASS_FLASH 0x009c0000 /* Camera flash controls */
1139#define V4L2_CTRL_CLASS_JPEG 0x009d0000 /* JPEG-compression controls */ 1266#define V4L2_CTRL_CLASS_JPEG 0x009d0000 /* JPEG-compression controls */
1267#define V4L2_CTRL_CLASS_IMAGE_SOURCE 0x009e0000 /* Image source controls */
1268#define V4L2_CTRL_CLASS_IMAGE_PROC 0x009f0000 /* Image processing controls */
1140 1269
1141#define V4L2_CTRL_ID_MASK (0x0fffffff) 1270#define V4L2_CTRL_ID_MASK (0x0fffffff)
1142#define V4L2_CTRL_ID2CLASS(id) ((id) & 0x0fff0000UL) 1271#define V4L2_CTRL_ID2CLASS(id) ((id) & 0x0fff0000UL)
@@ -1151,12 +1280,13 @@ enum v4l2_ctrl_type {
1151 V4L2_CTRL_TYPE_CTRL_CLASS = 6, 1280 V4L2_CTRL_TYPE_CTRL_CLASS = 6,
1152 V4L2_CTRL_TYPE_STRING = 7, 1281 V4L2_CTRL_TYPE_STRING = 7,
1153 V4L2_CTRL_TYPE_BITMASK = 8, 1282 V4L2_CTRL_TYPE_BITMASK = 8,
1283 V4L2_CTRL_TYPE_INTEGER_MENU = 9,
1154}; 1284};
1155 1285
1156/* Used in the VIDIOC_QUERYCTRL ioctl for querying controls */ 1286/* Used in the VIDIOC_QUERYCTRL ioctl for querying controls */
1157struct v4l2_queryctrl { 1287struct v4l2_queryctrl {
1158 __u32 id; 1288 __u32 id;
1159 enum v4l2_ctrl_type type; 1289 __u32 type; /* enum v4l2_ctrl_type */
1160 __u8 name[32]; /* Whatever */ 1290 __u8 name[32]; /* Whatever */
1161 __s32 minimum; /* Note signedness */ 1291 __s32 minimum; /* Note signedness */
1162 __s32 maximum; 1292 __s32 maximum;
@@ -1170,9 +1300,12 @@ struct v4l2_queryctrl {
1170struct v4l2_querymenu { 1300struct v4l2_querymenu {
1171 __u32 id; 1301 __u32 id;
1172 __u32 index; 1302 __u32 index;
1173 __u8 name[32]; /* Whatever */ 1303 union {
1304 __u8 name[32]; /* Whatever */
1305 __s64 value;
1306 };
1174 __u32 reserved; 1307 __u32 reserved;
1175}; 1308} __attribute__ ((packed));
1176 1309
1177/* Control flags */ 1310/* Control flags */
1178#define V4L2_CTRL_FLAG_DISABLED 0x0001 1311#define V4L2_CTRL_FLAG_DISABLED 0x0001
@@ -1237,16 +1370,22 @@ enum v4l2_power_line_frequency {
1237#define V4L2_CID_COLOR_KILLER (V4L2_CID_BASE+30) 1370#define V4L2_CID_COLOR_KILLER (V4L2_CID_BASE+30)
1238#define V4L2_CID_COLORFX (V4L2_CID_BASE+31) 1371#define V4L2_CID_COLORFX (V4L2_CID_BASE+31)
1239enum v4l2_colorfx { 1372enum v4l2_colorfx {
1240 V4L2_COLORFX_NONE = 0, 1373 V4L2_COLORFX_NONE = 0,
1241 V4L2_COLORFX_BW = 1, 1374 V4L2_COLORFX_BW = 1,
1242 V4L2_COLORFX_SEPIA = 2, 1375 V4L2_COLORFX_SEPIA = 2,
1243 V4L2_COLORFX_NEGATIVE = 3, 1376 V4L2_COLORFX_NEGATIVE = 3,
1244 V4L2_COLORFX_EMBOSS = 4, 1377 V4L2_COLORFX_EMBOSS = 4,
1245 V4L2_COLORFX_SKETCH = 5, 1378 V4L2_COLORFX_SKETCH = 5,
1246 V4L2_COLORFX_SKY_BLUE = 6, 1379 V4L2_COLORFX_SKY_BLUE = 6,
1247 V4L2_COLORFX_GRASS_GREEN = 7, 1380 V4L2_COLORFX_GRASS_GREEN = 7,
1248 V4L2_COLORFX_SKIN_WHITEN = 8, 1381 V4L2_COLORFX_SKIN_WHITEN = 8,
1249 V4L2_COLORFX_VIVID = 9, 1382 V4L2_COLORFX_VIVID = 9,
1383 V4L2_COLORFX_AQUA = 10,
1384 V4L2_COLORFX_ART_FREEZE = 11,
1385 V4L2_COLORFX_SILHOUETTE = 12,
1386 V4L2_COLORFX_SOLARIZATION = 13,
1387 V4L2_COLORFX_ANTIQUE = 14,
1388 V4L2_COLORFX_SET_CBCR = 15,
1250}; 1389};
1251#define V4L2_CID_AUTOBRIGHTNESS (V4L2_CID_BASE+32) 1390#define V4L2_CID_AUTOBRIGHTNESS (V4L2_CID_BASE+32)
1252#define V4L2_CID_BAND_STOP_FILTER (V4L2_CID_BASE+33) 1391#define V4L2_CID_BAND_STOP_FILTER (V4L2_CID_BASE+33)
@@ -1263,9 +1402,10 @@ enum v4l2_colorfx {
1263#define V4L2_CID_MIN_BUFFERS_FOR_OUTPUT (V4L2_CID_BASE+40) 1402#define V4L2_CID_MIN_BUFFERS_FOR_OUTPUT (V4L2_CID_BASE+40)
1264 1403
1265#define V4L2_CID_ALPHA_COMPONENT (V4L2_CID_BASE+41) 1404#define V4L2_CID_ALPHA_COMPONENT (V4L2_CID_BASE+41)
1405#define V4L2_CID_COLORFX_CBCR (V4L2_CID_BASE+42)
1266 1406
1267/* last CID + 1 */ 1407/* last CID + 1 */
1268#define V4L2_CID_LASTP1 (V4L2_CID_BASE+42) 1408#define V4L2_CID_LASTP1 (V4L2_CID_BASE+43)
1269 1409
1270/* MPEG-class control IDs defined by V4L2 */ 1410/* MPEG-class control IDs defined by V4L2 */
1271#define V4L2_CID_MPEG_BASE (V4L2_CTRL_CLASS_MPEG | 0x900) 1411#define V4L2_CID_MPEG_BASE (V4L2_CTRL_CLASS_MPEG | 0x900)
@@ -1689,6 +1829,78 @@ enum v4l2_exposure_auto_type {
1689#define V4L2_CID_IRIS_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+17) 1829#define V4L2_CID_IRIS_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+17)
1690#define V4L2_CID_IRIS_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+18) 1830#define V4L2_CID_IRIS_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+18)
1691 1831
1832#define V4L2_CID_AUTO_EXPOSURE_BIAS (V4L2_CID_CAMERA_CLASS_BASE+19)
1833
1834#define V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE (V4L2_CID_CAMERA_CLASS_BASE+20)
1835enum v4l2_auto_n_preset_white_balance {
1836 V4L2_WHITE_BALANCE_MANUAL = 0,
1837 V4L2_WHITE_BALANCE_AUTO = 1,
1838 V4L2_WHITE_BALANCE_INCANDESCENT = 2,
1839 V4L2_WHITE_BALANCE_FLUORESCENT = 3,
1840 V4L2_WHITE_BALANCE_FLUORESCENT_H = 4,
1841 V4L2_WHITE_BALANCE_HORIZON = 5,
1842 V4L2_WHITE_BALANCE_DAYLIGHT = 6,
1843 V4L2_WHITE_BALANCE_FLASH = 7,
1844 V4L2_WHITE_BALANCE_CLOUDY = 8,
1845 V4L2_WHITE_BALANCE_SHADE = 9,
1846};
1847
1848#define V4L2_CID_WIDE_DYNAMIC_RANGE (V4L2_CID_CAMERA_CLASS_BASE+21)
1849#define V4L2_CID_IMAGE_STABILIZATION (V4L2_CID_CAMERA_CLASS_BASE+22)
1850
1851#define V4L2_CID_ISO_SENSITIVITY (V4L2_CID_CAMERA_CLASS_BASE+23)
1852#define V4L2_CID_ISO_SENSITIVITY_AUTO (V4L2_CID_CAMERA_CLASS_BASE+24)
1853enum v4l2_iso_sensitivity_auto_type {
1854 V4L2_ISO_SENSITIVITY_MANUAL = 0,
1855 V4L2_ISO_SENSITIVITY_AUTO = 1,
1856};
1857
1858#define V4L2_CID_EXPOSURE_METERING (V4L2_CID_CAMERA_CLASS_BASE+25)
1859enum v4l2_exposure_metering {
1860 V4L2_EXPOSURE_METERING_AVERAGE = 0,
1861 V4L2_EXPOSURE_METERING_CENTER_WEIGHTED = 1,
1862 V4L2_EXPOSURE_METERING_SPOT = 2,
1863};
1864
1865#define V4L2_CID_SCENE_MODE (V4L2_CID_CAMERA_CLASS_BASE+26)
1866enum v4l2_scene_mode {
1867 V4L2_SCENE_MODE_NONE = 0,
1868 V4L2_SCENE_MODE_BACKLIGHT = 1,
1869 V4L2_SCENE_MODE_BEACH_SNOW = 2,
1870 V4L2_SCENE_MODE_CANDLE_LIGHT = 3,
1871 V4L2_SCENE_MODE_DAWN_DUSK = 4,
1872 V4L2_SCENE_MODE_FALL_COLORS = 5,
1873 V4L2_SCENE_MODE_FIREWORKS = 6,
1874 V4L2_SCENE_MODE_LANDSCAPE = 7,
1875 V4L2_SCENE_MODE_NIGHT = 8,
1876 V4L2_SCENE_MODE_PARTY_INDOOR = 9,
1877 V4L2_SCENE_MODE_PORTRAIT = 10,
1878 V4L2_SCENE_MODE_SPORTS = 11,
1879 V4L2_SCENE_MODE_SUNSET = 12,
1880 V4L2_SCENE_MODE_TEXT = 13,
1881};
1882
1883#define V4L2_CID_3A_LOCK (V4L2_CID_CAMERA_CLASS_BASE+27)
1884#define V4L2_LOCK_EXPOSURE (1 << 0)
1885#define V4L2_LOCK_WHITE_BALANCE (1 << 1)
1886#define V4L2_LOCK_FOCUS (1 << 2)
1887
1888#define V4L2_CID_AUTO_FOCUS_START (V4L2_CID_CAMERA_CLASS_BASE+28)
1889#define V4L2_CID_AUTO_FOCUS_STOP (V4L2_CID_CAMERA_CLASS_BASE+29)
1890#define V4L2_CID_AUTO_FOCUS_STATUS (V4L2_CID_CAMERA_CLASS_BASE+30)
1891#define V4L2_AUTO_FOCUS_STATUS_IDLE (0 << 0)
1892#define V4L2_AUTO_FOCUS_STATUS_BUSY (1 << 0)
1893#define V4L2_AUTO_FOCUS_STATUS_REACHED (1 << 1)
1894#define V4L2_AUTO_FOCUS_STATUS_FAILED (1 << 2)
1895
1896#define V4L2_CID_AUTO_FOCUS_RANGE (V4L2_CID_CAMERA_CLASS_BASE+31)
1897enum v4l2_auto_focus_range {
1898 V4L2_AUTO_FOCUS_RANGE_AUTO = 0,
1899 V4L2_AUTO_FOCUS_RANGE_NORMAL = 1,
1900 V4L2_AUTO_FOCUS_RANGE_MACRO = 2,
1901 V4L2_AUTO_FOCUS_RANGE_INFINITY = 3,
1902};
1903
1692/* FM Modulator class control IDs */ 1904/* FM Modulator class control IDs */
1693#define V4L2_CID_FM_TX_CLASS_BASE (V4L2_CTRL_CLASS_FM_TX | 0x900) 1905#define V4L2_CID_FM_TX_CLASS_BASE (V4L2_CTRL_CLASS_FM_TX | 0x900)
1694#define V4L2_CID_FM_TX_CLASS (V4L2_CTRL_CLASS_FM_TX | 1) 1906#define V4L2_CID_FM_TX_CLASS (V4L2_CTRL_CLASS_FM_TX | 1)
@@ -1782,13 +1994,28 @@ enum v4l2_jpeg_chroma_subsampling {
1782#define V4L2_JPEG_ACTIVE_MARKER_DQT (1 << 17) 1994#define V4L2_JPEG_ACTIVE_MARKER_DQT (1 << 17)
1783#define V4L2_JPEG_ACTIVE_MARKER_DHT (1 << 18) 1995#define V4L2_JPEG_ACTIVE_MARKER_DHT (1 << 18)
1784 1996
1997/* Image source controls */
1998#define V4L2_CID_IMAGE_SOURCE_CLASS_BASE (V4L2_CTRL_CLASS_IMAGE_SOURCE | 0x900)
1999#define V4L2_CID_IMAGE_SOURCE_CLASS (V4L2_CTRL_CLASS_IMAGE_SOURCE | 1)
2000
2001#define V4L2_CID_VBLANK (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 1)
2002#define V4L2_CID_HBLANK (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 2)
2003#define V4L2_CID_ANALOGUE_GAIN (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 3)
2004
2005/* Image processing controls */
2006#define V4L2_CID_IMAGE_PROC_CLASS_BASE (V4L2_CTRL_CLASS_IMAGE_PROC | 0x900)
2007#define V4L2_CID_IMAGE_PROC_CLASS (V4L2_CTRL_CLASS_IMAGE_PROC | 1)
2008
2009#define V4L2_CID_LINK_FREQ (V4L2_CID_IMAGE_PROC_CLASS_BASE + 1)
2010#define V4L2_CID_PIXEL_RATE (V4L2_CID_IMAGE_PROC_CLASS_BASE + 2)
2011
1785/* 2012/*
1786 * T U N I N G 2013 * T U N I N G
1787 */ 2014 */
1788struct v4l2_tuner { 2015struct v4l2_tuner {
1789 __u32 index; 2016 __u32 index;
1790 __u8 name[32]; 2017 __u8 name[32];
1791 enum v4l2_tuner_type type; 2018 __u32 type; /* enum v4l2_tuner_type */
1792 __u32 capability; 2019 __u32 capability;
1793 __u32 rangelow; 2020 __u32 rangelow;
1794 __u32 rangehigh; 2021 __u32 rangehigh;
@@ -1838,14 +2065,14 @@ struct v4l2_modulator {
1838 2065
1839struct v4l2_frequency { 2066struct v4l2_frequency {
1840 __u32 tuner; 2067 __u32 tuner;
1841 enum v4l2_tuner_type type; 2068 __u32 type; /* enum v4l2_tuner_type */
1842 __u32 frequency; 2069 __u32 frequency;
1843 __u32 reserved[8]; 2070 __u32 reserved[8];
1844}; 2071};
1845 2072
1846struct v4l2_hw_freq_seek { 2073struct v4l2_hw_freq_seek {
1847 __u32 tuner; 2074 __u32 tuner;
1848 enum v4l2_tuner_type type; 2075 __u32 type; /* enum v4l2_tuner_type */
1849 __u32 seek_upward; 2076 __u32 seek_upward;
1850 __u32 wrap_around; 2077 __u32 wrap_around;
1851 __u32 spacing; 2078 __u32 spacing;
@@ -2056,7 +2283,7 @@ struct v4l2_sliced_vbi_cap {
2056 (equals frame lines 313-336 for 625 line video 2283 (equals frame lines 313-336 for 625 line video
2057 standards, 263-286 for 525 line standards) */ 2284 standards, 263-286 for 525 line standards) */
2058 __u16 service_lines[2][24]; 2285 __u16 service_lines[2][24];
2059 enum v4l2_buf_type type; 2286 __u32 type; /* enum v4l2_buf_type */
2060 __u32 reserved[3]; /* must be 0 */ 2287 __u32 reserved[3]; /* must be 0 */
2061}; 2288};
2062 2289
@@ -2137,8 +2364,8 @@ struct v4l2_plane_pix_format {
2137 * @width: image width in pixels 2364 * @width: image width in pixels
2138 * @height: image height in pixels 2365 * @height: image height in pixels
2139 * @pixelformat: little endian four character code (fourcc) 2366 * @pixelformat: little endian four character code (fourcc)
2140 * @field: field order (for interlaced video) 2367 * @field: enum v4l2_field; field order (for interlaced video)
2141 * @colorspace: supplemental to pixelformat 2368 * @colorspace: enum v4l2_colorspace; supplemental to pixelformat
2142 * @plane_fmt: per-plane information 2369 * @plane_fmt: per-plane information
2143 * @num_planes: number of planes for this format 2370 * @num_planes: number of planes for this format
2144 */ 2371 */
@@ -2146,8 +2373,8 @@ struct v4l2_pix_format_mplane {
2146 __u32 width; 2373 __u32 width;
2147 __u32 height; 2374 __u32 height;
2148 __u32 pixelformat; 2375 __u32 pixelformat;
2149 enum v4l2_field field; 2376 __u32 field;
2150 enum v4l2_colorspace colorspace; 2377 __u32 colorspace;
2151 2378
2152 struct v4l2_plane_pix_format plane_fmt[VIDEO_MAX_PLANES]; 2379 struct v4l2_plane_pix_format plane_fmt[VIDEO_MAX_PLANES];
2153 __u8 num_planes; 2380 __u8 num_planes;
@@ -2156,7 +2383,7 @@ struct v4l2_pix_format_mplane {
2156 2383
2157/** 2384/**
2158 * struct v4l2_format - stream data format 2385 * struct v4l2_format - stream data format
2159 * @type: type of the data stream 2386 * @type: enum v4l2_buf_type; type of the data stream
2160 * @pix: definition of an image format 2387 * @pix: definition of an image format
2161 * @pix_mp: definition of a multiplanar image format 2388 * @pix_mp: definition of a multiplanar image format
2162 * @win: definition of an overlaid image 2389 * @win: definition of an overlaid image
@@ -2165,7 +2392,7 @@ struct v4l2_pix_format_mplane {
2165 * @raw_data: placeholder for future extensions and custom formats 2392 * @raw_data: placeholder for future extensions and custom formats
2166 */ 2393 */
2167struct v4l2_format { 2394struct v4l2_format {
2168 enum v4l2_buf_type type; 2395 __u32 type;
2169 union { 2396 union {
2170 struct v4l2_pix_format pix; /* V4L2_BUF_TYPE_VIDEO_CAPTURE */ 2397 struct v4l2_pix_format pix; /* V4L2_BUF_TYPE_VIDEO_CAPTURE */
2171 struct v4l2_pix_format_mplane pix_mp; /* V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE */ 2398 struct v4l2_pix_format_mplane pix_mp; /* V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE */
@@ -2179,7 +2406,7 @@ struct v4l2_format {
2179/* Stream type-dependent parameters 2406/* Stream type-dependent parameters
2180 */ 2407 */
2181struct v4l2_streamparm { 2408struct v4l2_streamparm {
2182 enum v4l2_buf_type type; 2409 __u32 type; /* enum v4l2_buf_type */
2183 union { 2410 union {
2184 struct v4l2_captureparm capture; 2411 struct v4l2_captureparm capture;
2185 struct v4l2_outputparm output; 2412 struct v4l2_outputparm output;
@@ -2292,14 +2519,14 @@ struct v4l2_dbg_chip_ident {
2292 * @index: on return, index of the first created buffer 2519 * @index: on return, index of the first created buffer
2293 * @count: entry: number of requested buffers, 2520 * @count: entry: number of requested buffers,
2294 * return: number of created buffers 2521 * return: number of created buffers
2295 * @memory: buffer memory type 2522 * @memory: enum v4l2_memory; buffer memory type
2296 * @format: frame format, for which buffers are requested 2523 * @format: frame format, for which buffers are requested
2297 * @reserved: future extensions 2524 * @reserved: future extensions
2298 */ 2525 */
2299struct v4l2_create_buffers { 2526struct v4l2_create_buffers {
2300 __u32 index; 2527 __u32 index;
2301 __u32 count; 2528 __u32 count;
2302 enum v4l2_memory memory; 2529 __u32 memory;
2303 struct v4l2_format format; 2530 struct v4l2_format format;
2304 __u32 reserved[8]; 2531 __u32 reserved[8];
2305}; 2532};
@@ -2356,8 +2583,8 @@ struct v4l2_create_buffers {
2356#define VIDIOC_TRY_FMT _IOWR('V', 64, struct v4l2_format) 2583#define VIDIOC_TRY_FMT _IOWR('V', 64, struct v4l2_format)
2357#define VIDIOC_ENUMAUDIO _IOWR('V', 65, struct v4l2_audio) 2584#define VIDIOC_ENUMAUDIO _IOWR('V', 65, struct v4l2_audio)
2358#define VIDIOC_ENUMAUDOUT _IOWR('V', 66, struct v4l2_audioout) 2585#define VIDIOC_ENUMAUDOUT _IOWR('V', 66, struct v4l2_audioout)
2359#define VIDIOC_G_PRIORITY _IOR('V', 67, enum v4l2_priority) 2586#define VIDIOC_G_PRIORITY _IOR('V', 67, __u32) /* enum v4l2_priority */
2360#define VIDIOC_S_PRIORITY _IOW('V', 68, enum v4l2_priority) 2587#define VIDIOC_S_PRIORITY _IOW('V', 68, __u32) /* enum v4l2_priority */
2361#define VIDIOC_G_SLICED_VBI_CAP _IOWR('V', 69, struct v4l2_sliced_vbi_cap) 2588#define VIDIOC_G_SLICED_VBI_CAP _IOWR('V', 69, struct v4l2_sliced_vbi_cap)
2362#define VIDIOC_LOG_STATUS _IO('V', 70) 2589#define VIDIOC_LOG_STATUS _IO('V', 70)
2363#define VIDIOC_G_EXT_CTRLS _IOWR('V', 71, struct v4l2_ext_controls) 2590#define VIDIOC_G_EXT_CTRLS _IOWR('V', 71, struct v4l2_ext_controls)
@@ -2384,6 +2611,9 @@ struct v4l2_create_buffers {
2384#endif 2611#endif
2385 2612
2386#define VIDIOC_S_HW_FREQ_SEEK _IOW('V', 82, struct v4l2_hw_freq_seek) 2613#define VIDIOC_S_HW_FREQ_SEEK _IOW('V', 82, struct v4l2_hw_freq_seek)
2614
2615/* These four DV Preset ioctls are deprecated in favor of the DV Timings
2616 ioctls. */
2387#define VIDIOC_ENUM_DV_PRESETS _IOWR('V', 83, struct v4l2_dv_enum_preset) 2617#define VIDIOC_ENUM_DV_PRESETS _IOWR('V', 83, struct v4l2_dv_enum_preset)
2388#define VIDIOC_S_DV_PRESET _IOWR('V', 84, struct v4l2_dv_preset) 2618#define VIDIOC_S_DV_PRESET _IOWR('V', 84, struct v4l2_dv_preset)
2389#define VIDIOC_G_DV_PRESET _IOWR('V', 85, struct v4l2_dv_preset) 2619#define VIDIOC_G_DV_PRESET _IOWR('V', 85, struct v4l2_dv_preset)
@@ -2408,6 +2638,12 @@ struct v4l2_create_buffers {
2408#define VIDIOC_DECODER_CMD _IOWR('V', 96, struct v4l2_decoder_cmd) 2638#define VIDIOC_DECODER_CMD _IOWR('V', 96, struct v4l2_decoder_cmd)
2409#define VIDIOC_TRY_DECODER_CMD _IOWR('V', 97, struct v4l2_decoder_cmd) 2639#define VIDIOC_TRY_DECODER_CMD _IOWR('V', 97, struct v4l2_decoder_cmd)
2410 2640
2641/* Experimental, these three ioctls may change over the next couple of kernel
2642 versions. */
2643#define VIDIOC_ENUM_DV_TIMINGS _IOWR('V', 96, struct v4l2_enum_dv_timings)
2644#define VIDIOC_QUERY_DV_TIMINGS _IOR('V', 97, struct v4l2_dv_timings)
2645#define VIDIOC_DV_TIMINGS_CAP _IOWR('V', 98, struct v4l2_dv_timings_cap)
2646
2411/* Reminder: when adding new ioctls please add support for them to 2647/* Reminder: when adding new ioctls please add support for them to
2412 drivers/media/video/v4l2-compat-ioctl32.c as well! */ 2648 drivers/media/video/v4l2-compat-ioctl32.c as well! */
2413 2649
diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h
index 7323a3390206..fc457f452f64 100644
--- a/include/linux/virtio_config.h
+++ b/include/linux/virtio_config.h
@@ -74,15 +74,6 @@
74 * @set_status: write the status byte 74 * @set_status: write the status byte
75 * vdev: the virtio_device 75 * vdev: the virtio_device
76 * status: the new status byte 76 * status: the new status byte
77 * @request_vqs: request the specified number of virtqueues
78 * vdev: the virtio_device
79 * max_vqs: the max number of virtqueues we want
80 * If supplied, must call before any virtqueues are instantiated.
81 * To modify the max number of virtqueues after request_vqs has been
82 * called, call free_vqs and then request_vqs with a new value.
83 * @free_vqs: cleanup resources allocated by request_vqs
84 * vdev: the virtio_device
85 * If supplied, must call after all virtqueues have been deleted.
86 * @reset: reset the device 77 * @reset: reset the device
87 * vdev: the virtio device 78 * vdev: the virtio device
88 * After this, status and feature negotiation must be done again 79 * After this, status and feature negotiation must be done again
@@ -156,7 +147,7 @@ static inline bool virtio_has_feature(const struct virtio_device *vdev,
156 * @vdev: the virtio device 147 * @vdev: the virtio device
157 * @fbit: the feature bit 148 * @fbit: the feature bit
158 * @offset: the type to search for. 149 * @offset: the type to search for.
159 * @val: a pointer to the value to fill in. 150 * @v: a pointer to the value to fill in.
160 * 151 *
161 * The return value is -ENOENT if the feature doesn't exist. Otherwise 152 * The return value is -ENOENT if the feature doesn't exist. Otherwise
162 * the config value is copied into whatever is pointed to by v. */ 153 * the config value is copied into whatever is pointed to by v. */
diff --git a/include/linux/virtio_net.h b/include/linux/virtio_net.h
index 970d5a2a9047..2470f541af50 100644
--- a/include/linux/virtio_net.h
+++ b/include/linux/virtio_net.h
@@ -49,8 +49,11 @@
49#define VIRTIO_NET_F_CTRL_RX 18 /* Control channel RX mode support */ 49#define VIRTIO_NET_F_CTRL_RX 18 /* Control channel RX mode support */
50#define VIRTIO_NET_F_CTRL_VLAN 19 /* Control channel VLAN filtering */ 50#define VIRTIO_NET_F_CTRL_VLAN 19 /* Control channel VLAN filtering */
51#define VIRTIO_NET_F_CTRL_RX_EXTRA 20 /* Extra RX mode control support */ 51#define VIRTIO_NET_F_CTRL_RX_EXTRA 20 /* Extra RX mode control support */
52#define VIRTIO_NET_F_GUEST_ANNOUNCE 21 /* Guest can announce device on the
53 * network */
52 54
53#define VIRTIO_NET_S_LINK_UP 1 /* Link is up */ 55#define VIRTIO_NET_S_LINK_UP 1 /* Link is up */
56#define VIRTIO_NET_S_ANNOUNCE 2 /* Announcement is needed */
54 57
55struct virtio_net_config { 58struct virtio_net_config {
56 /* The config defining mac address (if VIRTIO_NET_F_MAC) */ 59 /* The config defining mac address (if VIRTIO_NET_F_MAC) */
@@ -152,4 +155,15 @@ struct virtio_net_ctrl_mac {
152 #define VIRTIO_NET_CTRL_VLAN_ADD 0 155 #define VIRTIO_NET_CTRL_VLAN_ADD 0
153 #define VIRTIO_NET_CTRL_VLAN_DEL 1 156 #define VIRTIO_NET_CTRL_VLAN_DEL 1
154 157
158/*
159 * Control link announce acknowledgement
160 *
161 * The command VIRTIO_NET_CTRL_ANNOUNCE_ACK is used to indicate that
162 * driver has recevied the notification; device would clear the
163 * VIRTIO_NET_S_ANNOUNCE bit in the status field after it receives
164 * this command.
165 */
166#define VIRTIO_NET_CTRL_ANNOUNCE 3
167 #define VIRTIO_NET_CTRL_ANNOUNCE_ACK 0
168
155#endif /* _LINUX_VIRTIO_NET_H */ 169#endif /* _LINUX_VIRTIO_NET_H */
diff --git a/include/linux/vme.h b/include/linux/vme.h
new file mode 100644
index 000000000000..c9d65bf14cec
--- /dev/null
+++ b/include/linux/vme.h
@@ -0,0 +1,174 @@
1#ifndef _VME_H_
2#define _VME_H_
3
4/* Resource Type */
5enum vme_resource_type {
6 VME_MASTER,
7 VME_SLAVE,
8 VME_DMA,
9 VME_LM
10};
11
12/* VME Address Spaces */
13#define VME_A16 0x1
14#define VME_A24 0x2
15#define VME_A32 0x4
16#define VME_A64 0x8
17#define VME_CRCSR 0x10
18#define VME_USER1 0x20
19#define VME_USER2 0x40
20#define VME_USER3 0x80
21#define VME_USER4 0x100
22
23#define VME_A16_MAX 0x10000ULL
24#define VME_A24_MAX 0x1000000ULL
25#define VME_A32_MAX 0x100000000ULL
26#define VME_A64_MAX 0x10000000000000000ULL
27#define VME_CRCSR_MAX 0x1000000ULL
28
29
30/* VME Cycle Types */
31#define VME_SCT 0x1
32#define VME_BLT 0x2
33#define VME_MBLT 0x4
34#define VME_2eVME 0x8
35#define VME_2eSST 0x10
36#define VME_2eSSTB 0x20
37
38#define VME_2eSST160 0x100
39#define VME_2eSST267 0x200
40#define VME_2eSST320 0x400
41
42#define VME_SUPER 0x1000
43#define VME_USER 0x2000
44#define VME_PROG 0x4000
45#define VME_DATA 0x8000
46
47/* VME Data Widths */
48#define VME_D8 0x1
49#define VME_D16 0x2
50#define VME_D32 0x4
51#define VME_D64 0x8
52
53/* Arbitration Scheduling Modes */
54#define VME_R_ROBIN_MODE 0x1
55#define VME_PRIORITY_MODE 0x2
56
57#define VME_DMA_PATTERN (1<<0)
58#define VME_DMA_PCI (1<<1)
59#define VME_DMA_VME (1<<2)
60
61#define VME_DMA_PATTERN_BYTE (1<<0)
62#define VME_DMA_PATTERN_WORD (1<<1)
63#define VME_DMA_PATTERN_INCREMENT (1<<2)
64
65#define VME_DMA_VME_TO_MEM (1<<0)
66#define VME_DMA_MEM_TO_VME (1<<1)
67#define VME_DMA_VME_TO_VME (1<<2)
68#define VME_DMA_MEM_TO_MEM (1<<3)
69#define VME_DMA_PATTERN_TO_VME (1<<4)
70#define VME_DMA_PATTERN_TO_MEM (1<<5)
71
72struct vme_dma_attr {
73 u32 type;
74 void *private;
75};
76
77struct vme_resource {
78 enum vme_resource_type type;
79 struct list_head *entry;
80};
81
82extern struct bus_type vme_bus_type;
83
84/* VME_MAX_BRIDGES comes from the type of vme_bus_numbers */
85#define VME_MAX_BRIDGES (sizeof(unsigned int)*8)
86#define VME_MAX_SLOTS 32
87
88#define VME_SLOT_CURRENT -1
89#define VME_SLOT_ALL -2
90
91/**
92 * Structure representing a VME device
93 * @num: The device number
94 * @bridge: Pointer to the bridge device this device is on
95 * @dev: Internal device structure
96 * @drv_list: List of devices (per driver)
97 * @bridge_list: List of devices (per bridge)
98 */
99struct vme_dev {
100 int num;
101 struct vme_bridge *bridge;
102 struct device dev;
103 struct list_head drv_list;
104 struct list_head bridge_list;
105};
106
107struct vme_driver {
108 struct list_head node;
109 const char *name;
110 int (*match)(struct vme_dev *);
111 int (*probe)(struct vme_dev *);
112 int (*remove)(struct vme_dev *);
113 void (*shutdown)(void);
114 struct device_driver driver;
115 struct list_head devices;
116};
117
118void *vme_alloc_consistent(struct vme_resource *, size_t, dma_addr_t *);
119void vme_free_consistent(struct vme_resource *, size_t, void *,
120 dma_addr_t);
121
122size_t vme_get_size(struct vme_resource *);
123
124struct vme_resource *vme_slave_request(struct vme_dev *, u32, u32);
125int vme_slave_set(struct vme_resource *, int, unsigned long long,
126 unsigned long long, dma_addr_t, u32, u32);
127int vme_slave_get(struct vme_resource *, int *, unsigned long long *,
128 unsigned long long *, dma_addr_t *, u32 *, u32 *);
129void vme_slave_free(struct vme_resource *);
130
131struct vme_resource *vme_master_request(struct vme_dev *, u32, u32, u32);
132int vme_master_set(struct vme_resource *, int, unsigned long long,
133 unsigned long long, u32, u32, u32);
134int vme_master_get(struct vme_resource *, int *, unsigned long long *,
135 unsigned long long *, u32 *, u32 *, u32 *);
136ssize_t vme_master_read(struct vme_resource *, void *, size_t, loff_t);
137ssize_t vme_master_write(struct vme_resource *, void *, size_t, loff_t);
138unsigned int vme_master_rmw(struct vme_resource *, unsigned int, unsigned int,
139 unsigned int, loff_t);
140void vme_master_free(struct vme_resource *);
141
142struct vme_resource *vme_dma_request(struct vme_dev *, u32);
143struct vme_dma_list *vme_new_dma_list(struct vme_resource *);
144struct vme_dma_attr *vme_dma_pattern_attribute(u32, u32);
145struct vme_dma_attr *vme_dma_pci_attribute(dma_addr_t);
146struct vme_dma_attr *vme_dma_vme_attribute(unsigned long long, u32, u32, u32);
147void vme_dma_free_attribute(struct vme_dma_attr *);
148int vme_dma_list_add(struct vme_dma_list *, struct vme_dma_attr *,
149 struct vme_dma_attr *, size_t);
150int vme_dma_list_exec(struct vme_dma_list *);
151int vme_dma_list_free(struct vme_dma_list *);
152int vme_dma_free(struct vme_resource *);
153
154int vme_irq_request(struct vme_dev *, int, int,
155 void (*callback)(int, int, void *), void *);
156void vme_irq_free(struct vme_dev *, int, int);
157int vme_irq_generate(struct vme_dev *, int, int);
158
159struct vme_resource *vme_lm_request(struct vme_dev *);
160int vme_lm_count(struct vme_resource *);
161int vme_lm_set(struct vme_resource *, unsigned long long, u32, u32);
162int vme_lm_get(struct vme_resource *, unsigned long long *, u32 *, u32 *);
163int vme_lm_attach(struct vme_resource *, int, void (*callback)(int));
164int vme_lm_detach(struct vme_resource *, int);
165void vme_lm_free(struct vme_resource *);
166
167int vme_slot_get(struct vme_dev *);
168
169int vme_register_driver(struct vme_driver *, unsigned int);
170void vme_unregister_driver(struct vme_driver *);
171
172
173#endif /* _VME_H_ */
174
diff --git a/include/linux/vt_kern.h b/include/linux/vt_kern.h
index e33d77f15bda..50ae7d0c279e 100644
--- a/include/linux/vt_kern.h
+++ b/include/linux/vt_kern.h
@@ -70,7 +70,6 @@ int con_set_unimap(struct vc_data *vc, ushort ct, struct unipair __user *list);
70int con_get_unimap(struct vc_data *vc, ushort ct, ushort __user *uct, struct unipair __user *list); 70int con_get_unimap(struct vc_data *vc, ushort ct, ushort __user *uct, struct unipair __user *list);
71int con_set_default_unimap(struct vc_data *vc); 71int con_set_default_unimap(struct vc_data *vc);
72void con_free_unimap(struct vc_data *vc); 72void con_free_unimap(struct vc_data *vc);
73void con_protect_unimap(struct vc_data *vc, int rdonly);
74int con_copy_unimap(struct vc_data *dst_vc, struct vc_data *src_vc); 73int con_copy_unimap(struct vc_data *dst_vc, struct vc_data *src_vc);
75 74
76#define vc_translate(vc, c) ((vc)->vc_translate[(c) | \ 75#define vc_translate(vc, c) ((vc)->vc_translate[(c) | \
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index a2b84f598e2b..6d0a0fcd80e7 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -58,7 +58,6 @@ extern const char *wb_reason_name[];
58 * in a manner such that unspecified fields are set to zero. 58 * in a manner such that unspecified fields are set to zero.
59 */ 59 */
60struct writeback_control { 60struct writeback_control {
61 enum writeback_sync_modes sync_mode;
62 long nr_to_write; /* Write this many pages, and decrement 61 long nr_to_write; /* Write this many pages, and decrement
63 this for each page written */ 62 this for each page written */
64 long pages_skipped; /* Pages which were not written */ 63 long pages_skipped; /* Pages which were not written */
@@ -71,6 +70,8 @@ struct writeback_control {
71 loff_t range_start; 70 loff_t range_start;
72 loff_t range_end; 71 loff_t range_end;
73 72
73 enum writeback_sync_modes sync_mode;
74
74 unsigned for_kupdate:1; /* A kupdate writeback */ 75 unsigned for_kupdate:1; /* A kupdate writeback */
75 unsigned for_background:1; /* A background writeback */ 76 unsigned for_background:1; /* A background writeback */
76 unsigned tagged_writepages:1; /* tag-and-write to avoid livelock */ 77 unsigned tagged_writepages:1; /* tag-and-write to avoid livelock */
@@ -94,6 +95,7 @@ long writeback_inodes_wb(struct bdi_writeback *wb, long nr_pages,
94 enum wb_reason reason); 95 enum wb_reason reason);
95long wb_do_writeback(struct bdi_writeback *wb, int force_wait); 96long wb_do_writeback(struct bdi_writeback *wb, int force_wait);
96void wakeup_flusher_threads(long nr_pages, enum wb_reason reason); 97void wakeup_flusher_threads(long nr_pages, enum wb_reason reason);
98void inode_wait_for_writeback(struct inode *inode);
97 99
98/* writeback.h requires fs.h; it, too, is not included from here. */ 100/* writeback.h requires fs.h; it, too, is not included from here. */
99static inline void wait_on_inode(struct inode *inode) 101static inline void wait_on_inode(struct inode *inode)
@@ -101,12 +103,6 @@ static inline void wait_on_inode(struct inode *inode)
101 might_sleep(); 103 might_sleep();
102 wait_on_bit(&inode->i_state, __I_NEW, inode_wait, TASK_UNINTERRUPTIBLE); 104 wait_on_bit(&inode->i_state, __I_NEW, inode_wait, TASK_UNINTERRUPTIBLE);
103} 105}
104static inline void inode_sync_wait(struct inode *inode)
105{
106 might_sleep();
107 wait_on_bit(&inode->i_state, __I_SYNC, inode_wait,
108 TASK_UNINTERRUPTIBLE);
109}
110 106
111 107
112/* 108/*
diff --git a/include/media/media-entity.h b/include/media/media-entity.h
index 29e7bba78ffe..0c16f518ee09 100644
--- a/include/media/media-entity.h
+++ b/include/media/media-entity.h
@@ -46,6 +46,7 @@ struct media_entity_operations {
46 int (*link_setup)(struct media_entity *entity, 46 int (*link_setup)(struct media_entity *entity,
47 const struct media_pad *local, 47 const struct media_pad *local,
48 const struct media_pad *remote, u32 flags); 48 const struct media_pad *remote, u32 flags);
49 int (*link_validate)(struct media_link *link);
49}; 50};
50 51
51struct media_entity { 52struct media_entity {
@@ -140,8 +141,8 @@ void media_entity_graph_walk_start(struct media_entity_graph *graph,
140 struct media_entity *entity); 141 struct media_entity *entity);
141struct media_entity * 142struct media_entity *
142media_entity_graph_walk_next(struct media_entity_graph *graph); 143media_entity_graph_walk_next(struct media_entity_graph *graph);
143void media_entity_pipeline_start(struct media_entity *entity, 144__must_check int media_entity_pipeline_start(struct media_entity *entity,
144 struct media_pipeline *pipe); 145 struct media_pipeline *pipe);
145void media_entity_pipeline_stop(struct media_entity *entity); 146void media_entity_pipeline_stop(struct media_entity *entity);
146 147
147#define media_entity_call(entity, operation, args...) \ 148#define media_entity_call(entity, operation, args...) \
diff --git a/include/media/mt9p031.h b/include/media/mt9p031.h
index 96448c7a318b..0c97b19af293 100644
--- a/include/media/mt9p031.h
+++ b/include/media/mt9p031.h
@@ -3,17 +3,18 @@
3 3
4struct v4l2_subdev; 4struct v4l2_subdev;
5 5
6enum { 6/*
7 MT9P031_COLOR_VERSION, 7 * struct mt9p031_platform_data - MT9P031 platform data
8 MT9P031_MONOCHROME_VERSION, 8 * @set_xclk: Clock frequency set callback
9}; 9 * @reset: Chip reset GPIO (set to -1 if not used)
10 10 * @ext_freq: Input clock frequency
11 * @target_freq: Pixel clock frequency
12 */
11struct mt9p031_platform_data { 13struct mt9p031_platform_data {
12 int (*set_xclk)(struct v4l2_subdev *subdev, int hz); 14 int (*set_xclk)(struct v4l2_subdev *subdev, int hz);
13 int (*reset)(struct v4l2_subdev *subdev, int active); 15 int reset;
14 int ext_freq; /* input frequency to the mt9p031 for PLL dividers */ 16 int ext_freq;
15 int target_freq; /* frequency target for the PLL */ 17 int target_freq;
16 int version; /* MT9P031_COLOR_VERSION or MT9P031_MONOCHROME_VERSION */
17}; 18};
18 19
19#endif 20#endif
diff --git a/include/media/omap3isp.h b/include/media/omap3isp.h
index 042849a34640..4d94be5226af 100644
--- a/include/media/omap3isp.h
+++ b/include/media/omap3isp.h
@@ -29,6 +29,10 @@
29struct i2c_board_info; 29struct i2c_board_info;
30struct isp_device; 30struct isp_device;
31 31
32#define ISP_XCLK_NONE 0
33#define ISP_XCLK_A 1
34#define ISP_XCLK_B 2
35
32enum isp_interface_type { 36enum isp_interface_type {
33 ISP_INTERFACE_PARALLEL, 37 ISP_INTERFACE_PARALLEL,
34 ISP_INTERFACE_CSI2A_PHY2, 38 ISP_INTERFACE_CSI2A_PHY2,
@@ -87,6 +91,29 @@ enum {
87}; 91};
88 92
89/** 93/**
94 * struct isp_csiphy_lane: CCP2/CSI2 lane position and polarity
95 * @pos: position of the lane
96 * @pol: polarity of the lane
97 */
98struct isp_csiphy_lane {
99 u8 pos;
100 u8 pol;
101};
102
103#define ISP_CSIPHY1_NUM_DATA_LANES 1
104#define ISP_CSIPHY2_NUM_DATA_LANES 2
105
106/**
107 * struct isp_csiphy_lanes_cfg - CCP2/CSI2 lane configuration
108 * @data: Configuration of one or two data lanes
109 * @clk: Clock lane configuration
110 */
111struct isp_csiphy_lanes_cfg {
112 struct isp_csiphy_lane data[ISP_CSIPHY2_NUM_DATA_LANES];
113 struct isp_csiphy_lane clk;
114};
115
116/**
90 * struct isp_ccp2_platform_data - CCP2 interface platform data 117 * struct isp_ccp2_platform_data - CCP2 interface platform data
91 * @strobe_clk_pol: Strobe/clock polarity 118 * @strobe_clk_pol: Strobe/clock polarity
92 * 0 - Non Inverted, 1 - Inverted 119 * 0 - Non Inverted, 1 - Inverted
@@ -105,6 +132,7 @@ struct isp_ccp2_platform_data {
105 unsigned int ccp2_mode:1; 132 unsigned int ccp2_mode:1;
106 unsigned int phy_layer:1; 133 unsigned int phy_layer:1;
107 unsigned int vpclk_div:2; 134 unsigned int vpclk_div:2;
135 struct isp_csiphy_lanes_cfg lanecfg;
108}; 136};
109 137
110/** 138/**
@@ -115,6 +143,7 @@ struct isp_ccp2_platform_data {
115struct isp_csi2_platform_data { 143struct isp_csi2_platform_data {
116 unsigned crc:1; 144 unsigned crc:1;
117 unsigned vpclk_div:2; 145 unsigned vpclk_div:2;
146 struct isp_csiphy_lanes_cfg lanecfg;
118}; 147};
119 148
120struct isp_subdev_i2c_board_info { 149struct isp_subdev_i2c_board_info {
diff --git a/include/media/rc-map.h b/include/media/rc-map.h
index 8db6741c1256..cfd5163ff7f3 100644
--- a/include/media/rc-map.h
+++ b/include/media/rc-map.h
@@ -62,6 +62,7 @@ void rc_map_init(void);
62#define RC_MAP_ANYSEE "rc-anysee" 62#define RC_MAP_ANYSEE "rc-anysee"
63#define RC_MAP_APAC_VIEWCOMP "rc-apac-viewcomp" 63#define RC_MAP_APAC_VIEWCOMP "rc-apac-viewcomp"
64#define RC_MAP_ASUS_PC39 "rc-asus-pc39" 64#define RC_MAP_ASUS_PC39 "rc-asus-pc39"
65#define RC_MAP_ASUS_PS3_100 "rc-asus-ps3-100"
65#define RC_MAP_ATI_TV_WONDER_HD_600 "rc-ati-tv-wonder-hd-600" 66#define RC_MAP_ATI_TV_WONDER_HD_600 "rc-ati-tv-wonder-hd-600"
66#define RC_MAP_ATI_X10 "rc-ati-x10" 67#define RC_MAP_ATI_X10 "rc-ati-x10"
67#define RC_MAP_AVERMEDIA_A16D "rc-avermedia-a16d" 68#define RC_MAP_AVERMEDIA_A16D "rc-avermedia-a16d"
@@ -113,6 +114,8 @@ void rc_map_init(void);
113#define RC_MAP_LME2510 "rc-lme2510" 114#define RC_MAP_LME2510 "rc-lme2510"
114#define RC_MAP_MANLI "rc-manli" 115#define RC_MAP_MANLI "rc-manli"
115#define RC_MAP_MEDION_X10 "rc-medion-x10" 116#define RC_MAP_MEDION_X10 "rc-medion-x10"
117#define RC_MAP_MEDION_X10_DIGITAINER "rc-medion-x10-digitainer"
118#define RC_MAP_MEDION_X10_OR2X "rc-medion-x10-or2x"
116#define RC_MAP_MSI_DIGIVOX_II "rc-msi-digivox-ii" 119#define RC_MAP_MSI_DIGIVOX_II "rc-msi-digivox-ii"
117#define RC_MAP_MSI_DIGIVOX_III "rc-msi-digivox-iii" 120#define RC_MAP_MSI_DIGIVOX_III "rc-msi-digivox-iii"
118#define RC_MAP_MSI_TVANYWHERE_PLUS "rc-msi-tvanywhere-plus" 121#define RC_MAP_MSI_TVANYWHERE_PLUS "rc-msi-tvanywhere-plus"
diff --git a/include/media/s5p_fimc.h b/include/media/s5p_fimc.h
index 688fb3f1dc35..8587aaf73646 100644
--- a/include/media/s5p_fimc.h
+++ b/include/media/s5p_fimc.h
@@ -64,4 +64,20 @@ struct s5p_platform_fimc {
64 */ 64 */
65#define S5P_FIMC_TX_END_NOTIFY _IO('e', 0) 65#define S5P_FIMC_TX_END_NOTIFY _IO('e', 0)
66 66
67enum fimc_subdev_index {
68 IDX_SENSOR,
69 IDX_CSIS,
70 IDX_FLITE,
71 IDX_FIMC,
72 IDX_MAX,
73};
74
75struct media_pipeline;
76struct v4l2_subdev;
77
78struct fimc_pipeline {
79 struct v4l2_subdev *subdevs[IDX_MAX];
80 struct media_pipeline *m_pipeline;
81};
82
67#endif /* S5P_FIMC_H_ */ 83#endif /* S5P_FIMC_H_ */
diff --git a/include/media/saa7146.h b/include/media/saa7146.h
index 0f037e8edf9a..773e527deabe 100644
--- a/include/media/saa7146.h
+++ b/include/media/saa7146.h
@@ -13,12 +13,11 @@
13#include <linux/mutex.h> 13#include <linux/mutex.h>
14#include <linux/scatterlist.h> 14#include <linux/scatterlist.h>
15#include <media/v4l2-device.h> 15#include <media/v4l2-device.h>
16#include <media/v4l2-ctrls.h>
16 17
17#include <linux/vmalloc.h> /* for vmalloc() */ 18#include <linux/vmalloc.h> /* for vmalloc() */
18#include <linux/mm.h> /* for vmalloc_to_page() */ 19#include <linux/mm.h> /* for vmalloc_to_page() */
19 20
20#define SAA7146_VERSION_CODE 0x000600 /* 0.6.0 */
21
22#define saa7146_write(sxy,adr,dat) writel((dat),(sxy->mem+(adr))) 21#define saa7146_write(sxy,adr,dat) writel((dat),(sxy->mem+(adr)))
23#define saa7146_read(sxy,adr) readl(sxy->mem+(adr)) 22#define saa7146_read(sxy,adr) readl(sxy->mem+(adr))
24 23
@@ -121,6 +120,7 @@ struct saa7146_dev
121 struct list_head item; 120 struct list_head item;
122 121
123 struct v4l2_device v4l2_dev; 122 struct v4l2_device v4l2_dev;
123 struct v4l2_ctrl_handler ctrl_handler;
124 124
125 /* different device locks */ 125 /* different device locks */
126 spinlock_t slock; 126 spinlock_t slock;
diff --git a/include/media/saa7146_vv.h b/include/media/saa7146_vv.h
index 4aeff96ff7d8..944ecdf3530f 100644
--- a/include/media/saa7146_vv.h
+++ b/include/media/saa7146_vv.h
@@ -3,6 +3,7 @@
3 3
4#include <media/v4l2-common.h> 4#include <media/v4l2-common.h>
5#include <media/v4l2-ioctl.h> 5#include <media/v4l2-ioctl.h>
6#include <media/v4l2-fh.h>
6#include <media/saa7146.h> 7#include <media/saa7146.h>
7#include <media/videobuf-dma-sg.h> 8#include <media/videobuf-dma-sg.h>
8 9
@@ -84,21 +85,15 @@ struct saa7146_overlay {
84 85
85/* per open data */ 86/* per open data */
86struct saa7146_fh { 87struct saa7146_fh {
88 /* Must be the first field! */
89 struct v4l2_fh fh;
87 struct saa7146_dev *dev; 90 struct saa7146_dev *dev;
88 /* if this is a vbi or capture open */
89 enum v4l2_buf_type type;
90
91 /* video overlay */
92 struct saa7146_overlay ov;
93 91
94 /* video capture */ 92 /* video capture */
95 struct videobuf_queue video_q; 93 struct videobuf_queue video_q;
96 struct v4l2_pix_format video_fmt;
97 94
98 /* vbi capture */ 95 /* vbi capture */
99 struct videobuf_queue vbi_q; 96 struct videobuf_queue vbi_q;
100 struct v4l2_vbi_format vbi_fmt;
101 struct timer_list vbi_read_timeout;
102 97
103 unsigned int resources; /* resource management for device open */ 98 unsigned int resources; /* resource management for device open */
104}; 99};
@@ -109,7 +104,9 @@ struct saa7146_fh {
109struct saa7146_vv 104struct saa7146_vv
110{ 105{
111 /* vbi capture */ 106 /* vbi capture */
112 struct saa7146_dmaqueue vbi_q; 107 struct saa7146_dmaqueue vbi_dmaq;
108 struct v4l2_vbi_format vbi_fmt;
109 struct timer_list vbi_read_timeout;
113 /* vbi workaround interrupt queue */ 110 /* vbi workaround interrupt queue */
114 wait_queue_head_t vbi_wq; 111 wait_queue_head_t vbi_wq;
115 int vbi_fieldcount; 112 int vbi_fieldcount;
@@ -119,13 +116,14 @@ struct saa7146_vv
119 struct saa7146_fh *video_fh; 116 struct saa7146_fh *video_fh;
120 117
121 /* video overlay */ 118 /* video overlay */
119 struct saa7146_overlay ov;
122 struct v4l2_framebuffer ov_fb; 120 struct v4l2_framebuffer ov_fb;
123 struct saa7146_format *ov_fmt; 121 struct saa7146_format *ov_fmt;
124 struct saa7146_overlay *ov_data;
125 struct saa7146_fh *ov_suspend; 122 struct saa7146_fh *ov_suspend;
126 123
127 /* video capture */ 124 /* video capture */
128 struct saa7146_dmaqueue video_q; 125 struct saa7146_dmaqueue video_dmaq;
126 struct v4l2_pix_format video_fmt;
129 enum v4l2_field last_field; 127 enum v4l2_field last_field;
130 128
131 /* common: fixme? shouldn't this be in saa7146_fh? 129 /* common: fixme? shouldn't this be in saa7146_fh?
@@ -163,7 +161,8 @@ struct saa7146_ext_vv
163 int (*std_callback)(struct saa7146_dev*, struct saa7146_standard *); 161 int (*std_callback)(struct saa7146_dev*, struct saa7146_standard *);
164 162
165 /* the extension can override this */ 163 /* the extension can override this */
166 struct v4l2_ioctl_ops ops; 164 struct v4l2_ioctl_ops vid_ops;
165 struct v4l2_ioctl_ops vbi_ops;
167 /* pointer to the saa7146 core ops */ 166 /* pointer to the saa7146 core ops */
168 const struct v4l2_ioctl_ops *core_ops; 167 const struct v4l2_ioctl_ops *core_ops;
169 168
@@ -202,10 +201,12 @@ void saa7146_set_gpio(struct saa7146_dev *saa, u8 pin, u8 data);
202 201
203/* from saa7146_video.c */ 202/* from saa7146_video.c */
204extern const struct v4l2_ioctl_ops saa7146_video_ioctl_ops; 203extern const struct v4l2_ioctl_ops saa7146_video_ioctl_ops;
204extern const struct v4l2_ioctl_ops saa7146_vbi_ioctl_ops;
205extern struct saa7146_use_ops saa7146_video_uops; 205extern struct saa7146_use_ops saa7146_video_uops;
206int saa7146_start_preview(struct saa7146_fh *fh); 206int saa7146_start_preview(struct saa7146_fh *fh);
207int saa7146_stop_preview(struct saa7146_fh *fh); 207int saa7146_stop_preview(struct saa7146_fh *fh);
208long saa7146_video_do_ioctl(struct file *file, unsigned int cmd, void *arg); 208long saa7146_video_do_ioctl(struct file *file, unsigned int cmd, void *arg);
209int saa7146_s_ctrl(struct v4l2_ctrl *ctrl);
209 210
210/* from saa7146_vbi.c */ 211/* from saa7146_vbi.c */
211extern struct saa7146_use_ops saa7146_vbi_uops; 212extern struct saa7146_use_ops saa7146_vbi_uops;
diff --git a/include/media/sh_mobile_ceu.h b/include/media/sh_mobile_ceu.h
index a90a765f18da..6fdb6adf6b2b 100644
--- a/include/media/sh_mobile_ceu.h
+++ b/include/media/sh_mobile_ceu.h
@@ -5,6 +5,7 @@
5#define SH_CEU_FLAG_USE_16BIT_BUS (1 << 1) /* use 16bit bus width */ 5#define SH_CEU_FLAG_USE_16BIT_BUS (1 << 1) /* use 16bit bus width */
6#define SH_CEU_FLAG_HSYNC_LOW (1 << 2) /* default High if possible */ 6#define SH_CEU_FLAG_HSYNC_LOW (1 << 2) /* default High if possible */
7#define SH_CEU_FLAG_VSYNC_LOW (1 << 3) /* default High if possible */ 7#define SH_CEU_FLAG_VSYNC_LOW (1 << 3) /* default High if possible */
8#define SH_CEU_FLAG_LOWER_8BIT (1 << 4) /* default upper 8bit */
8 9
9struct device; 10struct device;
10struct resource; 11struct resource;
diff --git a/include/media/smiapp.h b/include/media/smiapp.h
new file mode 100644
index 000000000000..9ab07fd45d5c
--- /dev/null
+++ b/include/media/smiapp.h
@@ -0,0 +1,84 @@
1/*
2 * include/media/smiapp.h
3 *
4 * Generic driver for SMIA/SMIA++ compliant camera modules
5 *
6 * Copyright (C) 2011--2012 Nokia Corporation
7 * Contact: Sakari Ailus <sakari.ailus@maxwell.research.nokia.com>
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 *
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 __SMIAPP_H_
26#define __SMIAPP_H_
27
28#include <media/v4l2-subdev.h>
29
30#define SMIAPP_NAME "smiapp"
31
32#define SMIAPP_DFL_I2C_ADDR (0x20 >> 1) /* Default I2C Address */
33#define SMIAPP_ALT_I2C_ADDR (0x6e >> 1) /* Alternate I2C Address */
34
35#define SMIAPP_CSI_SIGNALLING_MODE_CCP2_DATA_CLOCK 0
36#define SMIAPP_CSI_SIGNALLING_MODE_CCP2_DATA_STROBE 1
37#define SMIAPP_CSI_SIGNALLING_MODE_CSI2 2
38
39#define SMIAPP_NO_XSHUTDOWN -1
40
41/*
42 * Sometimes due to board layout considerations the camera module can be
43 * mounted rotated. The typical rotation used is 180 degrees which can be
44 * corrected by giving a default H-FLIP and V-FLIP in the sensor readout.
45 * FIXME: rotation also changes the bayer pattern.
46 */
47enum smiapp_module_board_orient {
48 SMIAPP_MODULE_BOARD_ORIENT_0 = 0,
49 SMIAPP_MODULE_BOARD_ORIENT_180,
50};
51
52struct smiapp_flash_strobe_parms {
53 u8 mode;
54 u32 strobe_width_high_us;
55 u16 strobe_delay;
56 u16 stobe_start_point;
57 u8 trigger;
58};
59
60struct smiapp_platform_data {
61 /*
62 * Change the cci address if i2c_addr_alt is set.
63 * Both default and alternate cci addr need to be present
64 */
65 unsigned short i2c_addr_dfl; /* Default i2c addr */
66 unsigned short i2c_addr_alt; /* Alternate i2c addr */
67
68 unsigned int nvm_size; /* bytes */
69 unsigned int ext_clk; /* sensor external clk */
70
71 unsigned int lanes; /* Number of CSI-2 lanes */
72 u8 csi_signalling_mode; /* SMIAPP_CSI_SIGNALLING_MODE_* */
73 const s64 *op_sys_clock;
74
75 enum smiapp_module_board_orient module_board_orient;
76
77 struct smiapp_flash_strobe_parms *strobe_setup;
78
79 int (*set_xclk)(struct v4l2_subdev *sd, int hz);
80 char *ext_clk_name;
81 int xshutdown; /* gpio or SMIAPP_NO_XSHUTDOWN */
82};
83
84#endif /* __SMIAPP_H_ */
diff --git a/include/media/soc_camera.h b/include/media/soc_camera.h
index b5c2b6cb0d81..d865dcf9879f 100644
--- a/include/media/soc_camera.h
+++ b/include/media/soc_camera.h
@@ -56,10 +56,15 @@ struct soc_camera_device {
56 }; 56 };
57}; 57};
58 58
59/* Host supports programmable stride */
60#define SOCAM_HOST_CAP_STRIDE (1 << 0)
61
59struct soc_camera_host { 62struct soc_camera_host {
60 struct v4l2_device v4l2_dev; 63 struct v4l2_device v4l2_dev;
61 struct list_head list; 64 struct list_head list;
62 unsigned char nr; /* Host number */ 65 struct mutex host_lock; /* Protect during probing */
66 unsigned char nr; /* Host number */
67 u32 capabilities;
63 void *priv; 68 void *priv;
64 const char *drv_name; 69 const char *drv_name;
65 struct soc_camera_host_ops *ops; 70 struct soc_camera_host_ops *ops;
@@ -97,7 +102,7 @@ struct soc_camera_host_ops {
97 int (*set_bus_param)(struct soc_camera_device *); 102 int (*set_bus_param)(struct soc_camera_device *);
98 int (*get_parm)(struct soc_camera_device *, struct v4l2_streamparm *); 103 int (*get_parm)(struct soc_camera_device *, struct v4l2_streamparm *);
99 int (*set_parm)(struct soc_camera_device *, struct v4l2_streamparm *); 104 int (*set_parm)(struct soc_camera_device *, struct v4l2_streamparm *);
100 int (*enum_fsizes)(struct soc_camera_device *, struct v4l2_frmsizeenum *); 105 int (*enum_framesizes)(struct soc_camera_device *, struct v4l2_frmsizeenum *);
101 unsigned int (*poll)(struct file *, poll_table *); 106 unsigned int (*poll)(struct file *, poll_table *);
102}; 107};
103 108
diff --git a/include/media/soc_mediabus.h b/include/media/soc_mediabus.h
index 73f1e7eb60f3..0dc6f4625b92 100644
--- a/include/media/soc_mediabus.h
+++ b/include/media/soc_mediabus.h
@@ -47,6 +47,24 @@ enum soc_mbus_order {
47}; 47};
48 48
49/** 49/**
50 * enum soc_mbus_layout - planes layout in memory
51 * @SOC_MBUS_LAYOUT_PACKED: color components packed
52 * @SOC_MBUS_LAYOUT_PLANAR_2Y_U_V: YUV components stored in 3 planes (4:2:2)
53 * @SOC_MBUS_LAYOUT_PLANAR_2Y_C: YUV components stored in a luma and a
54 * chroma plane (C plane is half the size
55 * of Y plane)
56 * @SOC_MBUS_LAYOUT_PLANAR_Y_C: YUV components stored in a luma and a
57 * chroma plane (C plane is the same size
58 * as Y plane)
59 */
60enum soc_mbus_layout {
61 SOC_MBUS_LAYOUT_PACKED = 0,
62 SOC_MBUS_LAYOUT_PLANAR_2Y_U_V,
63 SOC_MBUS_LAYOUT_PLANAR_2Y_C,
64 SOC_MBUS_LAYOUT_PLANAR_Y_C,
65};
66
67/**
50 * struct soc_mbus_pixelfmt - Data format on the media bus 68 * struct soc_mbus_pixelfmt - Data format on the media bus
51 * @name: Name of the format 69 * @name: Name of the format
52 * @fourcc: Fourcc code, that will be obtained if the data is 70 * @fourcc: Fourcc code, that will be obtained if the data is
@@ -60,6 +78,7 @@ struct soc_mbus_pixelfmt {
60 u32 fourcc; 78 u32 fourcc;
61 enum soc_mbus_packing packing; 79 enum soc_mbus_packing packing;
62 enum soc_mbus_order order; 80 enum soc_mbus_order order;
81 enum soc_mbus_layout layout;
63 u8 bits_per_sample; 82 u8 bits_per_sample;
64}; 83};
65 84
@@ -80,6 +99,8 @@ const struct soc_mbus_pixelfmt *soc_mbus_find_fmtdesc(
80const struct soc_mbus_pixelfmt *soc_mbus_get_fmtdesc( 99const struct soc_mbus_pixelfmt *soc_mbus_get_fmtdesc(
81 enum v4l2_mbus_pixelcode code); 100 enum v4l2_mbus_pixelcode code);
82s32 soc_mbus_bytes_per_line(u32 width, const struct soc_mbus_pixelfmt *mf); 101s32 soc_mbus_bytes_per_line(u32 width, const struct soc_mbus_pixelfmt *mf);
102s32 soc_mbus_image_size(const struct soc_mbus_pixelfmt *mf,
103 u32 bytes_per_line, u32 height);
83int soc_mbus_samples_per_pixel(const struct soc_mbus_pixelfmt *mf, 104int soc_mbus_samples_per_pixel(const struct soc_mbus_pixelfmt *mf,
84 unsigned int *numerator, unsigned int *denominator); 105 unsigned int *numerator, unsigned int *denominator);
85unsigned int soc_mbus_config_compatible(const struct v4l2_mbus_config *cfg, 106unsigned int soc_mbus_config_compatible(const struct v4l2_mbus_config *cfg,
diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h
index 11e67562b3ac..776605f1cbe2 100644
--- a/include/media/v4l2-ctrls.h
+++ b/include/media/v4l2-ctrls.h
@@ -25,6 +25,7 @@
25#include <linux/videodev2.h> 25#include <linux/videodev2.h>
26 26
27/* forward references */ 27/* forward references */
28struct file;
28struct v4l2_ctrl_handler; 29struct v4l2_ctrl_handler;
29struct v4l2_ctrl_helper; 30struct v4l2_ctrl_helper;
30struct v4l2_ctrl; 31struct v4l2_ctrl;
@@ -129,7 +130,10 @@ struct v4l2_ctrl {
129 u32 step; 130 u32 step;
130 u32 menu_skip_mask; 131 u32 menu_skip_mask;
131 }; 132 };
132 const char * const *qmenu; 133 union {
134 const char * const *qmenu;
135 const s64 *qmenu_int;
136 };
133 unsigned long flags; 137 unsigned long flags;
134 union { 138 union {
135 s32 val; 139 s32 val;
@@ -164,7 +168,9 @@ struct v4l2_ctrl_ref {
164/** struct v4l2_ctrl_handler - The control handler keeps track of all the 168/** struct v4l2_ctrl_handler - The control handler keeps track of all the
165 * controls: both the controls owned by the handler and those inherited 169 * controls: both the controls owned by the handler and those inherited
166 * from other handlers. 170 * from other handlers.
171 * @_lock: Default for "lock".
167 * @lock: Lock to control access to this handler and its controls. 172 * @lock: Lock to control access to this handler and its controls.
173 * May be replaced by the user right after init.
168 * @ctrls: The list of controls owned by this handler. 174 * @ctrls: The list of controls owned by this handler.
169 * @ctrl_refs: The list of control references. 175 * @ctrl_refs: The list of control references.
170 * @cached: The last found control reference. It is common that the same 176 * @cached: The last found control reference. It is common that the same
@@ -175,7 +181,8 @@ struct v4l2_ctrl_ref {
175 * @error: The error code of the first failed control addition. 181 * @error: The error code of the first failed control addition.
176 */ 182 */
177struct v4l2_ctrl_handler { 183struct v4l2_ctrl_handler {
178 struct mutex lock; 184 struct mutex _lock;
185 struct mutex *lock;
179 struct list_head ctrls; 186 struct list_head ctrls;
180 struct list_head ctrl_refs; 187 struct list_head ctrl_refs;
181 struct v4l2_ctrl_ref *cached; 188 struct v4l2_ctrl_ref *cached;
@@ -219,6 +226,7 @@ struct v4l2_ctrl_config {
219 u32 flags; 226 u32 flags;
220 u32 menu_skip_mask; 227 u32 menu_skip_mask;
221 const char * const *qmenu; 228 const char * const *qmenu;
229 const s64 *qmenu_int;
222 unsigned int is_private:1; 230 unsigned int is_private:1;
223}; 231};
224 232
@@ -343,6 +351,23 @@ struct v4l2_ctrl *v4l2_ctrl_new_std_menu(struct v4l2_ctrl_handler *hdl,
343 const struct v4l2_ctrl_ops *ops, 351 const struct v4l2_ctrl_ops *ops,
344 u32 id, s32 max, s32 mask, s32 def); 352 u32 id, s32 max, s32 mask, s32 def);
345 353
354/** v4l2_ctrl_new_int_menu() - Create a new standard V4L2 integer menu control.
355 * @hdl: The control handler.
356 * @ops: The control ops.
357 * @id: The control ID.
358 * @max: The control's maximum value.
359 * @def: The control's default value.
360 * @qmenu_int: The control's menu entries.
361 *
362 * Same as v4l2_ctrl_new_std_menu(), but @mask is set to 0 and it additionaly
363 * takes as an argument an array of integers determining the menu items.
364 *
365 * If @id refers to a non-integer-menu control, then this function will return NULL.
366 */
367struct v4l2_ctrl *v4l2_ctrl_new_int_menu(struct v4l2_ctrl_handler *hdl,
368 const struct v4l2_ctrl_ops *ops,
369 u32 id, s32 max, s32 def, const s64 *qmenu_int);
370
346/** v4l2_ctrl_add_ctrl() - Add a control from another handler to this handler. 371/** v4l2_ctrl_add_ctrl() - Add a control from another handler to this handler.
347 * @hdl: The control handler. 372 * @hdl: The control handler.
348 * @ctrl: The control to add. 373 * @ctrl: The control to add.
@@ -451,7 +476,7 @@ void v4l2_ctrl_grab(struct v4l2_ctrl *ctrl, bool grabbed);
451 */ 476 */
452static inline void v4l2_ctrl_lock(struct v4l2_ctrl *ctrl) 477static inline void v4l2_ctrl_lock(struct v4l2_ctrl *ctrl)
453{ 478{
454 mutex_lock(&ctrl->handler->lock); 479 mutex_lock(ctrl->handler->lock);
455} 480}
456 481
457/** v4l2_ctrl_lock() - Helper function to unlock the handler 482/** v4l2_ctrl_lock() - Helper function to unlock the handler
@@ -460,7 +485,7 @@ static inline void v4l2_ctrl_lock(struct v4l2_ctrl *ctrl)
460 */ 485 */
461static inline void v4l2_ctrl_unlock(struct v4l2_ctrl *ctrl) 486static inline void v4l2_ctrl_unlock(struct v4l2_ctrl *ctrl)
462{ 487{
463 mutex_unlock(&ctrl->handler->lock); 488 mutex_unlock(ctrl->handler->lock);
464} 489}
465 490
466/** v4l2_ctrl_g_ctrl() - Helper function to get the control's value from within a driver. 491/** v4l2_ctrl_g_ctrl() - Helper function to get the control's value from within a driver.
@@ -487,10 +512,9 @@ s32 v4l2_ctrl_g_ctrl(struct v4l2_ctrl *ctrl);
487int v4l2_ctrl_s_ctrl(struct v4l2_ctrl *ctrl, s32 val); 512int v4l2_ctrl_s_ctrl(struct v4l2_ctrl *ctrl, s32 val);
488 513
489/* Internal helper functions that deal with control events. */ 514/* Internal helper functions that deal with control events. */
490void v4l2_ctrl_add_event(struct v4l2_ctrl *ctrl, 515extern const struct v4l2_subscribed_event_ops v4l2_ctrl_sub_ev_ops;
491 struct v4l2_subscribed_event *sev); 516void v4l2_ctrl_replace(struct v4l2_event *old, const struct v4l2_event *new);
492void v4l2_ctrl_del_event(struct v4l2_ctrl *ctrl, 517void v4l2_ctrl_merge(const struct v4l2_event *old, struct v4l2_event *new);
493 struct v4l2_subscribed_event *sev);
494 518
495/* Can be used as a vidioc_log_status function that just dumps all controls 519/* Can be used as a vidioc_log_status function that just dumps all controls
496 associated with the filehandle. */ 520 associated with the filehandle. */
diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h
index 96d22215cc88..a056e6ee1b68 100644
--- a/include/media/v4l2-dev.h
+++ b/include/media/v4l2-dev.h
@@ -39,6 +39,9 @@ struct v4l2_ctrl_handler;
39#define V4L2_FL_USES_V4L2_FH (1) 39#define V4L2_FL_USES_V4L2_FH (1)
40/* Use the prio field of v4l2_fh for core priority checking */ 40/* Use the prio field of v4l2_fh for core priority checking */
41#define V4L2_FL_USE_FH_PRIO (2) 41#define V4L2_FL_USE_FH_PRIO (2)
42/* If ioctl core locking is in use, then apply that also to all
43 file operations. Don't use this flag in new drivers! */
44#define V4L2_FL_LOCK_ALL_FOPS (3)
42 45
43/* Priority helper functions */ 46/* Priority helper functions */
44 47
@@ -126,8 +129,10 @@ struct video_device
126 129
127 /* ioctl callbacks */ 130 /* ioctl callbacks */
128 const struct v4l2_ioctl_ops *ioctl_ops; 131 const struct v4l2_ioctl_ops *ioctl_ops;
132 DECLARE_BITMAP(valid_ioctls, BASE_VIDIOC_PRIVATE);
129 133
130 /* serialization lock */ 134 /* serialization lock */
135 DECLARE_BITMAP(disable_locking, BASE_VIDIOC_PRIVATE);
131 struct mutex *lock; 136 struct mutex *lock;
132}; 137};
133 138
@@ -173,6 +178,26 @@ void video_device_release(struct video_device *vdev);
173 a dubious construction at best. */ 178 a dubious construction at best. */
174void video_device_release_empty(struct video_device *vdev); 179void video_device_release_empty(struct video_device *vdev);
175 180
181/* returns true if cmd is a known V4L2 ioctl */
182bool v4l2_is_known_ioctl(unsigned int cmd);
183
184/* mark that this command shouldn't use core locking */
185static inline void v4l2_disable_ioctl_locking(struct video_device *vdev, unsigned int cmd)
186{
187 if (_IOC_NR(cmd) < BASE_VIDIOC_PRIVATE)
188 set_bit(_IOC_NR(cmd), vdev->disable_locking);
189}
190
191/* Mark that this command isn't implemented. This must be called before
192 video_device_register. See also the comments in determine_valid_ioctls().
193 This function allows drivers to provide just one v4l2_ioctl_ops struct, but
194 disable ioctls based on the specific card that is actually found. */
195static inline void v4l2_disable_ioctl(struct video_device *vdev, unsigned int cmd)
196{
197 if (_IOC_NR(cmd) < BASE_VIDIOC_PRIVATE)
198 set_bit(_IOC_NR(cmd), vdev->valid_ioctls);
199}
200
176/* helper functions to access driver private data. */ 201/* helper functions to access driver private data. */
177static inline void *video_get_drvdata(struct video_device *vdev) 202static inline void *video_get_drvdata(struct video_device *vdev)
178{ 203{
diff --git a/include/media/v4l2-event.h b/include/media/v4l2-event.h
index 5f14e8895ce2..2885a810a128 100644
--- a/include/media/v4l2-event.h
+++ b/include/media/v4l2-event.h
@@ -78,6 +78,19 @@ struct v4l2_kevent {
78 struct v4l2_event event; 78 struct v4l2_event event;
79}; 79};
80 80
81/** struct v4l2_subscribed_event_ops - Subscribed event operations.
82 * @add: Optional callback, called when a new listener is added
83 * @del: Optional callback, called when a listener stops listening
84 * @replace: Optional callback that can replace event 'old' with event 'new'.
85 * @merge: Optional callback that can merge event 'old' into event 'new'.
86 */
87struct v4l2_subscribed_event_ops {
88 int (*add)(struct v4l2_subscribed_event *sev, unsigned elems);
89 void (*del)(struct v4l2_subscribed_event *sev);
90 void (*replace)(struct v4l2_event *old, const struct v4l2_event *new);
91 void (*merge)(const struct v4l2_event *old, struct v4l2_event *new);
92};
93
81/** struct v4l2_subscribed_event - Internal struct representing a subscribed event. 94/** struct v4l2_subscribed_event - Internal struct representing a subscribed event.
82 * @list: List node for the v4l2_fh->subscribed list. 95 * @list: List node for the v4l2_fh->subscribed list.
83 * @type: Event type. 96 * @type: Event type.
@@ -85,8 +98,7 @@ struct v4l2_kevent {
85 * @flags: Copy of v4l2_event_subscription->flags. 98 * @flags: Copy of v4l2_event_subscription->flags.
86 * @fh: Filehandle that subscribed to this event. 99 * @fh: Filehandle that subscribed to this event.
87 * @node: List node that hooks into the object's event list (if there is one). 100 * @node: List node that hooks into the object's event list (if there is one).
88 * @replace: Optional callback that can replace event 'old' with event 'new'. 101 * @ops: v4l2_subscribed_event_ops
89 * @merge: Optional callback that can merge event 'old' into event 'new'.
90 * @elems: The number of elements in the events array. 102 * @elems: The number of elements in the events array.
91 * @first: The index of the events containing the oldest available event. 103 * @first: The index of the events containing the oldest available event.
92 * @in_use: The number of queued events. 104 * @in_use: The number of queued events.
@@ -99,10 +111,7 @@ struct v4l2_subscribed_event {
99 u32 flags; 111 u32 flags;
100 struct v4l2_fh *fh; 112 struct v4l2_fh *fh;
101 struct list_head node; 113 struct list_head node;
102 void (*replace)(struct v4l2_event *old, 114 const struct v4l2_subscribed_event_ops *ops;
103 const struct v4l2_event *new);
104 void (*merge)(const struct v4l2_event *old,
105 struct v4l2_event *new);
106 unsigned elems; 115 unsigned elems;
107 unsigned first; 116 unsigned first;
108 unsigned in_use; 117 unsigned in_use;
@@ -115,7 +124,8 @@ void v4l2_event_queue(struct video_device *vdev, const struct v4l2_event *ev);
115void v4l2_event_queue_fh(struct v4l2_fh *fh, const struct v4l2_event *ev); 124void v4l2_event_queue_fh(struct v4l2_fh *fh, const struct v4l2_event *ev);
116int v4l2_event_pending(struct v4l2_fh *fh); 125int v4l2_event_pending(struct v4l2_fh *fh);
117int v4l2_event_subscribe(struct v4l2_fh *fh, 126int v4l2_event_subscribe(struct v4l2_fh *fh,
118 struct v4l2_event_subscription *sub, unsigned elems); 127 struct v4l2_event_subscription *sub, unsigned elems,
128 const struct v4l2_subscribed_event_ops *ops);
119int v4l2_event_unsubscribe(struct v4l2_fh *fh, 129int v4l2_event_unsubscribe(struct v4l2_fh *fh,
120 struct v4l2_event_subscription *sub); 130 struct v4l2_event_subscription *sub);
121void v4l2_event_unsubscribe_all(struct v4l2_fh *fh); 131void v4l2_event_unsubscribe_all(struct v4l2_fh *fh);
diff --git a/include/media/v4l2-ioctl.h b/include/media/v4l2-ioctl.h
index 3cb939cd03f9..d8b76f7392f8 100644
--- a/include/media/v4l2-ioctl.h
+++ b/include/media/v4l2-ioctl.h
@@ -271,6 +271,12 @@ struct v4l2_ioctl_ops {
271 struct v4l2_dv_timings *timings); 271 struct v4l2_dv_timings *timings);
272 int (*vidioc_g_dv_timings) (struct file *file, void *fh, 272 int (*vidioc_g_dv_timings) (struct file *file, void *fh,
273 struct v4l2_dv_timings *timings); 273 struct v4l2_dv_timings *timings);
274 int (*vidioc_query_dv_timings) (struct file *file, void *fh,
275 struct v4l2_dv_timings *timings);
276 int (*vidioc_enum_dv_timings) (struct file *file, void *fh,
277 struct v4l2_enum_dv_timings *timings);
278 int (*vidioc_dv_timings_cap) (struct file *file, void *fh,
279 struct v4l2_dv_timings_cap *cap);
274 280
275 int (*vidioc_subscribe_event) (struct v4l2_fh *fh, 281 int (*vidioc_subscribe_event) (struct v4l2_fh *fh,
276 struct v4l2_event_subscription *sub); 282 struct v4l2_event_subscription *sub);
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index f0f3358d1b1b..c35a3545e273 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -307,6 +307,12 @@ struct v4l2_subdev_video_ops {
307 struct v4l2_dv_timings *timings); 307 struct v4l2_dv_timings *timings);
308 int (*g_dv_timings)(struct v4l2_subdev *sd, 308 int (*g_dv_timings)(struct v4l2_subdev *sd,
309 struct v4l2_dv_timings *timings); 309 struct v4l2_dv_timings *timings);
310 int (*enum_dv_timings)(struct v4l2_subdev *sd,
311 struct v4l2_enum_dv_timings *timings);
312 int (*query_dv_timings)(struct v4l2_subdev *sd,
313 struct v4l2_dv_timings *timings);
314 int (*dv_timings_cap)(struct v4l2_subdev *sd,
315 struct v4l2_dv_timings_cap *cap);
310 int (*enum_mbus_fmt)(struct v4l2_subdev *sd, unsigned int index, 316 int (*enum_mbus_fmt)(struct v4l2_subdev *sd, unsigned int index,
311 enum v4l2_mbus_pixelcode *code); 317 enum v4l2_mbus_pixelcode *code);
312 int (*enum_mbus_fsizes)(struct v4l2_subdev *sd, 318 int (*enum_mbus_fsizes)(struct v4l2_subdev *sd,
@@ -466,6 +472,15 @@ struct v4l2_subdev_pad_ops {
466 struct v4l2_subdev_crop *crop); 472 struct v4l2_subdev_crop *crop);
467 int (*get_crop)(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh, 473 int (*get_crop)(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,
468 struct v4l2_subdev_crop *crop); 474 struct v4l2_subdev_crop *crop);
475 int (*get_selection)(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,
476 struct v4l2_subdev_selection *sel);
477 int (*set_selection)(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,
478 struct v4l2_subdev_selection *sel);
479#ifdef CONFIG_MEDIA_CONTROLLER
480 int (*link_validate)(struct v4l2_subdev *sd, struct media_link *link,
481 struct v4l2_subdev_format *source_fmt,
482 struct v4l2_subdev_format *sink_fmt);
483#endif /* CONFIG_MEDIA_CONTROLLER */
469}; 484};
470 485
471struct v4l2_subdev_ops { 486struct v4l2_subdev_ops {
@@ -541,7 +556,7 @@ struct v4l2_subdev {
541#define media_entity_to_v4l2_subdev(ent) \ 556#define media_entity_to_v4l2_subdev(ent) \
542 container_of(ent, struct v4l2_subdev, entity) 557 container_of(ent, struct v4l2_subdev, entity)
543#define vdev_to_v4l2_subdev(vdev) \ 558#define vdev_to_v4l2_subdev(vdev) \
544 video_get_drvdata(vdev) 559 ((struct v4l2_subdev *)video_get_drvdata(vdev))
545 560
546/* 561/*
547 * Used for storing subdev information per file handle 562 * Used for storing subdev information per file handle
@@ -549,8 +564,11 @@ struct v4l2_subdev {
549struct v4l2_subdev_fh { 564struct v4l2_subdev_fh {
550 struct v4l2_fh vfh; 565 struct v4l2_fh vfh;
551#if defined(CONFIG_VIDEO_V4L2_SUBDEV_API) 566#if defined(CONFIG_VIDEO_V4L2_SUBDEV_API)
552 struct v4l2_mbus_framefmt *try_fmt; 567 struct {
553 struct v4l2_rect *try_crop; 568 struct v4l2_mbus_framefmt try_fmt;
569 struct v4l2_rect try_crop;
570 struct v4l2_rect try_compose;
571 } *pad;
554#endif 572#endif
555}; 573};
556 574
@@ -558,17 +576,19 @@ struct v4l2_subdev_fh {
558 container_of(fh, struct v4l2_subdev_fh, vfh) 576 container_of(fh, struct v4l2_subdev_fh, vfh)
559 577
560#if defined(CONFIG_VIDEO_V4L2_SUBDEV_API) 578#if defined(CONFIG_VIDEO_V4L2_SUBDEV_API)
561static inline struct v4l2_mbus_framefmt * 579#define __V4L2_SUBDEV_MK_GET_TRY(rtype, fun_name, field_name) \
562v4l2_subdev_get_try_format(struct v4l2_subdev_fh *fh, unsigned int pad) 580 static inline struct rtype * \
563{ 581 v4l2_subdev_get_try_##fun_name(struct v4l2_subdev_fh *fh, \
564 return &fh->try_fmt[pad]; 582 unsigned int pad) \
565} 583 { \
566 584 BUG_ON(unlikely(pad >= vdev_to_v4l2_subdev( \
567static inline struct v4l2_rect * 585 fh->vfh.vdev)->entity.num_pads)); \
568v4l2_subdev_get_try_crop(struct v4l2_subdev_fh *fh, unsigned int pad) 586 return &fh->pad[pad].field_name; \
569{ 587 }
570 return &fh->try_crop[pad]; 588
571} 589__V4L2_SUBDEV_MK_GET_TRY(v4l2_mbus_framefmt, format, try_fmt)
590__V4L2_SUBDEV_MK_GET_TRY(v4l2_rect, crop, try_compose)
591__V4L2_SUBDEV_MK_GET_TRY(v4l2_rect, compose, try_compose)
572#endif 592#endif
573 593
574extern const struct v4l2_file_operations v4l2_subdev_fops; 594extern const struct v4l2_file_operations v4l2_subdev_fops;
@@ -593,6 +613,13 @@ static inline void *v4l2_get_subdev_hostdata(const struct v4l2_subdev *sd)
593 return sd->host_priv; 613 return sd->host_priv;
594} 614}
595 615
616#ifdef CONFIG_MEDIA_CONTROLLER
617int v4l2_subdev_link_validate_default(struct v4l2_subdev *sd,
618 struct media_link *link,
619 struct v4l2_subdev_format *source_fmt,
620 struct v4l2_subdev_format *sink_fmt);
621int v4l2_subdev_link_validate(struct media_link *link);
622#endif /* CONFIG_MEDIA_CONTROLLER */
596void v4l2_subdev_init(struct v4l2_subdev *sd, 623void v4l2_subdev_init(struct v4l2_subdev *sd,
597 const struct v4l2_subdev_ops *ops); 624 const struct v4l2_subdev_ops *ops);
598 625
diff --git a/include/media/videobuf-dma-contig.h b/include/media/videobuf-dma-contig.h
index f0ed82543d9f..f473aeb86d3f 100644
--- a/include/media/videobuf-dma-contig.h
+++ b/include/media/videobuf-dma-contig.h
@@ -26,6 +26,16 @@ void videobuf_queue_dma_contig_init(struct videobuf_queue *q,
26 void *priv, 26 void *priv,
27 struct mutex *ext_lock); 27 struct mutex *ext_lock);
28 28
29void videobuf_queue_dma_contig_init_cached(struct videobuf_queue *q,
30 const struct videobuf_queue_ops *ops,
31 struct device *dev,
32 spinlock_t *irqlock,
33 enum v4l2_buf_type type,
34 enum v4l2_field field,
35 unsigned int msize,
36 void *priv,
37 struct mutex *ext_lock);
38
29dma_addr_t videobuf_to_dma_contig(struct videobuf_buffer *buf); 39dma_addr_t videobuf_to_dma_contig(struct videobuf_buffer *buf);
30void videobuf_dma_contig_free(struct videobuf_queue *q, 40void videobuf_dma_contig_free(struct videobuf_queue *q,
31 struct videobuf_buffer *buf); 41 struct videobuf_buffer *buf);
diff --git a/include/memory/jedec_ddr.h b/include/memory/jedec_ddr.h
new file mode 100644
index 000000000000..ddad0f870e5d
--- /dev/null
+++ b/include/memory/jedec_ddr.h
@@ -0,0 +1,175 @@
1/*
2 * Definitions for DDR memories based on JEDEC specs
3 *
4 * Copyright (C) 2012 Texas Instruments, Inc.
5 *
6 * Aneesh V <aneesh@ti.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 version 2 as
10 * published by the Free Software Foundation.
11 */
12#ifndef __LINUX_JEDEC_DDR_H
13#define __LINUX_JEDEC_DDR_H
14
15#include <linux/types.h>
16
17/* DDR Densities */
18#define DDR_DENSITY_64Mb 1
19#define DDR_DENSITY_128Mb 2
20#define DDR_DENSITY_256Mb 3
21#define DDR_DENSITY_512Mb 4
22#define DDR_DENSITY_1Gb 5
23#define DDR_DENSITY_2Gb 6
24#define DDR_DENSITY_4Gb 7
25#define DDR_DENSITY_8Gb 8
26#define DDR_DENSITY_16Gb 9
27#define DDR_DENSITY_32Gb 10
28
29/* DDR type */
30#define DDR_TYPE_DDR2 1
31#define DDR_TYPE_DDR3 2
32#define DDR_TYPE_LPDDR2_S4 3
33#define DDR_TYPE_LPDDR2_S2 4
34#define DDR_TYPE_LPDDR2_NVM 5
35
36/* DDR IO width */
37#define DDR_IO_WIDTH_4 1
38#define DDR_IO_WIDTH_8 2
39#define DDR_IO_WIDTH_16 3
40#define DDR_IO_WIDTH_32 4
41
42/* Number of Row bits */
43#define R9 9
44#define R10 10
45#define R11 11
46#define R12 12
47#define R13 13
48#define R14 14
49#define R15 15
50#define R16 16
51
52/* Number of Column bits */
53#define C7 7
54#define C8 8
55#define C9 9
56#define C10 10
57#define C11 11
58#define C12 12
59
60/* Number of Banks */
61#define B1 0
62#define B2 1
63#define B4 2
64#define B8 3
65
66/* Refresh rate in nano-seconds */
67#define T_REFI_15_6 15600
68#define T_REFI_7_8 7800
69#define T_REFI_3_9 3900
70
71/* tRFC values */
72#define T_RFC_90 90000
73#define T_RFC_110 110000
74#define T_RFC_130 130000
75#define T_RFC_160 160000
76#define T_RFC_210 210000
77#define T_RFC_300 300000
78#define T_RFC_350 350000
79
80/* Mode register numbers */
81#define DDR_MR0 0
82#define DDR_MR1 1
83#define DDR_MR2 2
84#define DDR_MR3 3
85#define DDR_MR4 4
86#define DDR_MR5 5
87#define DDR_MR6 6
88#define DDR_MR7 7
89#define DDR_MR8 8
90#define DDR_MR9 9
91#define DDR_MR10 10
92#define DDR_MR11 11
93#define DDR_MR16 16
94#define DDR_MR17 17
95#define DDR_MR18 18
96
97/*
98 * LPDDR2 related defines
99 */
100
101/* MR4 register fields */
102#define MR4_SDRAM_REF_RATE_SHIFT 0
103#define MR4_SDRAM_REF_RATE_MASK 7
104#define MR4_TUF_SHIFT 7
105#define MR4_TUF_MASK (1 << 7)
106
107/* MR4 SDRAM Refresh Rate field values */
108#define SDRAM_TEMP_NOMINAL 0x3
109#define SDRAM_TEMP_RESERVED_4 0x4
110#define SDRAM_TEMP_HIGH_DERATE_REFRESH 0x5
111#define SDRAM_TEMP_HIGH_DERATE_REFRESH_AND_TIMINGS 0x6
112#define SDRAM_TEMP_VERY_HIGH_SHUTDOWN 0x7
113
114#define NUM_DDR_ADDR_TABLE_ENTRIES 11
115#define NUM_DDR_TIMING_TABLE_ENTRIES 4
116
117/* Structure for DDR addressing info from the JEDEC spec */
118struct lpddr2_addressing {
119 u32 num_banks;
120 u32 tREFI_ns;
121 u32 tRFCab_ps;
122};
123
124/*
125 * Structure for timings from the LPDDR2 datasheet
126 * All parameters are in pico seconds(ps) unless explicitly indicated
127 * with a suffix like tRAS_max_ns below
128 */
129struct lpddr2_timings {
130 u32 max_freq;
131 u32 min_freq;
132 u32 tRPab;
133 u32 tRCD;
134 u32 tWR;
135 u32 tRAS_min;
136 u32 tRRD;
137 u32 tWTR;
138 u32 tXP;
139 u32 tRTP;
140 u32 tCKESR;
141 u32 tDQSCK_max;
142 u32 tDQSCK_max_derated;
143 u32 tFAW;
144 u32 tZQCS;
145 u32 tZQCL;
146 u32 tZQinit;
147 u32 tRAS_max_ns;
148};
149
150/*
151 * Min value for some parameters in terms of number of tCK cycles(nCK)
152 * Please set to zero parameters that are not valid for a given memory
153 * type
154 */
155struct lpddr2_min_tck {
156 u32 tRPab;
157 u32 tRCD;
158 u32 tWR;
159 u32 tRASmin;
160 u32 tRRD;
161 u32 tWTR;
162 u32 tXP;
163 u32 tRTP;
164 u32 tCKE;
165 u32 tCKESR;
166 u32 tFAW;
167};
168
169extern const struct lpddr2_addressing
170 lpddr2_jedec_addressing_table[NUM_DDR_ADDR_TABLE_ENTRIES];
171extern const struct lpddr2_timings
172 lpddr2_jedec_timings[NUM_DDR_TIMING_TABLE_ENTRIES];
173extern const struct lpddr2_min_tck lpddr2_jedec_min_tck;
174
175#endif /* __LINUX_JEDEC_DDR_H */
diff --git a/include/mtd/ubi-user.h b/include/mtd/ubi-user.h
index 3c4109777aff..8787349fbafe 100644
--- a/include/mtd/ubi-user.h
+++ b/include/mtd/ubi-user.h
@@ -196,23 +196,6 @@
196#define UBI_MAX_RNVOL 32 196#define UBI_MAX_RNVOL 32
197 197
198/* 198/*
199 * UBI data type hint constants.
200 *
201 * UBI_LONGTERM: long-term data
202 * UBI_SHORTTERM: short-term data
203 * UBI_UNKNOWN: data persistence is unknown
204 *
205 * These constants are used when data is written to UBI volumes in order to
206 * help the UBI wear-leveling unit to find more appropriate physical
207 * eraseblocks.
208 */
209enum {
210 UBI_LONGTERM = 1,
211 UBI_SHORTTERM = 2,
212 UBI_UNKNOWN = 3,
213};
214
215/*
216 * UBI volume type constants. 199 * UBI volume type constants.
217 * 200 *
218 * @UBI_DYNAMIC_VOLUME: dynamic volume 201 * @UBI_DYNAMIC_VOLUME: dynamic volume
@@ -375,25 +358,34 @@ struct ubi_rnvol_req {
375 * requests. 358 * requests.
376 * @lnum: logical eraseblock number to change 359 * @lnum: logical eraseblock number to change
377 * @bytes: how many bytes will be written to the logical eraseblock 360 * @bytes: how many bytes will be written to the logical eraseblock
378 * @dtype: data type (%UBI_LONGTERM, %UBI_SHORTTERM, %UBI_UNKNOWN) 361 * @dtype: pass "3" for better compatibility with old kernels
379 * @padding: reserved for future, not used, has to be zeroed 362 * @padding: reserved for future, not used, has to be zeroed
363 *
364 * The @dtype field used to inform UBI about what kind of data will be written
365 * to the LEB: long term (value 1), short term (value 2), unknown (value 3).
366 * UBI tried to pick a PEB with lower erase counter for short term data and a
367 * PEB with higher erase counter for long term data. But this was not really
368 * used because users usually do not know this and could easily mislead UBI. We
369 * removed this feature in May 2012. UBI currently just ignores the @dtype
370 * field. But for better compatibility with older kernels it is recommended to
371 * set @dtype to 3 (unknown).
380 */ 372 */
381struct ubi_leb_change_req { 373struct ubi_leb_change_req {
382 __s32 lnum; 374 __s32 lnum;
383 __s32 bytes; 375 __s32 bytes;
384 __s8 dtype; 376 __s8 dtype; /* obsolete, do not use! */
385 __s8 padding[7]; 377 __s8 padding[7];
386} __packed; 378} __packed;
387 379
388/** 380/**
389 * struct ubi_map_req - a data structure used in map LEB requests. 381 * struct ubi_map_req - a data structure used in map LEB requests.
382 * @dtype: pass "3" for better compatibility with old kernels
390 * @lnum: logical eraseblock number to unmap 383 * @lnum: logical eraseblock number to unmap
391 * @dtype: data type (%UBI_LONGTERM, %UBI_SHORTTERM, %UBI_UNKNOWN)
392 * @padding: reserved for future, not used, has to be zeroed 384 * @padding: reserved for future, not used, has to be zeroed
393 */ 385 */
394struct ubi_map_req { 386struct ubi_map_req {
395 __s32 lnum; 387 __s32 lnum;
396 __s8 dtype; 388 __s8 dtype; /* obsolete, do not use! */
397 __s8 padding[3]; 389 __s8 padding[3];
398} __packed; 390} __packed;
399 391
diff --git a/include/net/addrconf.h b/include/net/addrconf.h
index 757a17638b1b..f2b801c4b555 100644
--- a/include/net/addrconf.h
+++ b/include/net/addrconf.h
@@ -92,7 +92,7 @@ extern void addrconf_leave_solict(struct inet6_dev *idev,
92 const struct in6_addr *addr); 92 const struct in6_addr *addr);
93 93
94static inline unsigned long addrconf_timeout_fixup(u32 timeout, 94static inline unsigned long addrconf_timeout_fixup(u32 timeout,
95 unsigned unit) 95 unsigned int unit)
96{ 96{
97 if (timeout == 0xffffffff) 97 if (timeout == 0xffffffff)
98 return ~0UL; 98 return ~0UL;
@@ -131,9 +131,9 @@ extern int ipv6_sock_mc_join(struct sock *sk, int ifindex,
131extern int ipv6_sock_mc_drop(struct sock *sk, int ifindex, 131extern int ipv6_sock_mc_drop(struct sock *sk, int ifindex,
132 const struct in6_addr *addr); 132 const struct in6_addr *addr);
133extern void ipv6_sock_mc_close(struct sock *sk); 133extern void ipv6_sock_mc_close(struct sock *sk);
134extern int inet6_mc_check(struct sock *sk, 134extern bool inet6_mc_check(struct sock *sk,
135 const struct in6_addr *mc_addr, 135 const struct in6_addr *mc_addr,
136 const struct in6_addr *src_addr); 136 const struct in6_addr *src_addr);
137 137
138extern int ipv6_dev_mc_inc(struct net_device *dev, const struct in6_addr *addr); 138extern int ipv6_dev_mc_inc(struct net_device *dev, const struct in6_addr *addr);
139extern int __ipv6_dev_mc_dec(struct inet6_dev *idev, const struct in6_addr *addr); 139extern int __ipv6_dev_mc_dec(struct inet6_dev *idev, const struct in6_addr *addr);
@@ -146,10 +146,10 @@ extern void ipv6_mc_init_dev(struct inet6_dev *idev);
146extern void ipv6_mc_destroy_dev(struct inet6_dev *idev); 146extern void ipv6_mc_destroy_dev(struct inet6_dev *idev);
147extern void addrconf_dad_failure(struct inet6_ifaddr *ifp); 147extern void addrconf_dad_failure(struct inet6_ifaddr *ifp);
148 148
149extern int ipv6_chk_mcast_addr(struct net_device *dev, 149extern bool ipv6_chk_mcast_addr(struct net_device *dev,
150 const struct in6_addr *group, 150 const struct in6_addr *group,
151 const struct in6_addr *src_addr); 151 const struct in6_addr *src_addr);
152extern int ipv6_is_mld(struct sk_buff *skb, int nexthdr); 152extern bool ipv6_is_mld(struct sk_buff *skb, int nexthdr);
153 153
154extern void addrconf_prefix_rcv(struct net_device *dev, 154extern void addrconf_prefix_rcv(struct net_device *dev,
155 u8 *opt, int len, bool sllao); 155 u8 *opt, int len, bool sllao);
@@ -163,8 +163,8 @@ extern void ipv6_sock_ac_close(struct sock *sk);
163 163
164extern int ipv6_dev_ac_inc(struct net_device *dev, const struct in6_addr *addr); 164extern int ipv6_dev_ac_inc(struct net_device *dev, const struct in6_addr *addr);
165extern int __ipv6_dev_ac_dec(struct inet6_dev *idev, const struct in6_addr *addr); 165extern int __ipv6_dev_ac_dec(struct inet6_dev *idev, const struct in6_addr *addr);
166extern int ipv6_chk_acast_addr(struct net *net, struct net_device *dev, 166extern bool ipv6_chk_acast_addr(struct net *net, struct net_device *dev,
167 const struct in6_addr *addr); 167 const struct in6_addr *addr);
168 168
169 169
170/* Device notifier */ 170/* Device notifier */
diff --git a/include/net/af_unix.h b/include/net/af_unix.h
index ca68e2cef230..2ee33da36a7a 100644
--- a/include/net/af_unix.h
+++ b/include/net/af_unix.h
@@ -22,7 +22,7 @@ extern struct hlist_head unix_socket_table[UNIX_HASH_SIZE + 1];
22struct unix_address { 22struct unix_address {
23 atomic_t refcnt; 23 atomic_t refcnt;
24 int len; 24 int len;
25 unsigned hash; 25 unsigned int hash;
26 struct sockaddr_un name[0]; 26 struct sockaddr_un name[0];
27}; 27};
28 28
diff --git a/include/net/ax25.h b/include/net/ax25.h
index 94e09d361bb1..5d2352154cf6 100644
--- a/include/net/ax25.h
+++ b/include/net/ax25.h
@@ -215,7 +215,7 @@ typedef struct ax25_dev {
215 struct ax25_dev *next; 215 struct ax25_dev *next;
216 struct net_device *dev; 216 struct net_device *dev;
217 struct net_device *forward; 217 struct net_device *forward;
218 struct ctl_table *systable; 218 struct ctl_table_header *sysheader;
219 int values[AX25_MAX_VALUES]; 219 int values[AX25_MAX_VALUES];
220#if defined(CONFIG_AX25_DAMA_SLAVE) || defined(CONFIG_AX25_DAMA_MASTER) 220#if defined(CONFIG_AX25_DAMA_SLAVE) || defined(CONFIG_AX25_DAMA_MASTER)
221 ax25_dama_info dama; 221 ax25_dama_info dama;
@@ -441,11 +441,11 @@ extern void ax25_uid_free(void);
441 441
442/* sysctl_net_ax25.c */ 442/* sysctl_net_ax25.c */
443#ifdef CONFIG_SYSCTL 443#ifdef CONFIG_SYSCTL
444extern void ax25_register_sysctl(void); 444extern int ax25_register_dev_sysctl(ax25_dev *ax25_dev);
445extern void ax25_unregister_sysctl(void); 445extern void ax25_unregister_dev_sysctl(ax25_dev *ax25_dev);
446#else 446#else
447static inline void ax25_register_sysctl(void) {}; 447static inline int ax25_register_dev_sysctl(ax25_dev *ax25_dev) { return 0; }
448static inline void ax25_unregister_sysctl(void) {}; 448static inline void ax25_unregister_dev_sysctl(ax25_dev *ax25_dev) {}
449#endif /* CONFIG_SYSCTL */ 449#endif /* CONFIG_SYSCTL */
450 450
451#endif 451#endif
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
index 262ebd1747d4..961669b648fd 100644
--- a/include/net/bluetooth/bluetooth.h
+++ b/include/net/bluetooth/bluetooth.h
@@ -163,6 +163,11 @@ typedef struct {
163 __u8 b[6]; 163 __u8 b[6];
164} __packed bdaddr_t; 164} __packed bdaddr_t;
165 165
166/* BD Address type */
167#define BDADDR_BREDR 0x00
168#define BDADDR_LE_PUBLIC 0x01
169#define BDADDR_LE_RANDOM 0x02
170
166#define BDADDR_ANY (&(bdaddr_t) {{0, 0, 0, 0, 0, 0}}) 171#define BDADDR_ANY (&(bdaddr_t) {{0, 0, 0, 0, 0, 0}})
167#define BDADDR_LOCAL (&(bdaddr_t) {{0, 0, 0, 0xff, 0xff, 0xff}}) 172#define BDADDR_LOCAL (&(bdaddr_t) {{0, 0, 0, 0xff, 0xff, 0xff}})
168 173
@@ -178,7 +183,6 @@ static inline void bacpy(bdaddr_t *dst, bdaddr_t *src)
178 183
179void baswap(bdaddr_t *dst, bdaddr_t *src); 184void baswap(bdaddr_t *dst, bdaddr_t *src);
180char *batostr(bdaddr_t *ba); 185char *batostr(bdaddr_t *ba);
181bdaddr_t *strtoba(char *str);
182 186
183/* Common socket structures and functions */ 187/* Common socket structures and functions */
184 188
@@ -190,7 +194,12 @@ struct bt_sock {
190 bdaddr_t dst; 194 bdaddr_t dst;
191 struct list_head accept_q; 195 struct list_head accept_q;
192 struct sock *parent; 196 struct sock *parent;
193 u32 defer_setup; 197 unsigned long flags;
198};
199
200enum {
201 BT_SK_DEFER_SETUP,
202 BT_SK_SUSPEND,
194}; 203};
195 204
196struct bt_sock_list { 205struct bt_sock_list {
@@ -215,14 +224,24 @@ void bt_accept_unlink(struct sock *sk);
215struct sock *bt_accept_dequeue(struct sock *parent, struct socket *newsock); 224struct sock *bt_accept_dequeue(struct sock *parent, struct socket *newsock);
216 225
217/* Skb helpers */ 226/* Skb helpers */
227struct l2cap_ctrl {
228 unsigned int sframe : 1,
229 poll : 1,
230 final : 1,
231 fcs : 1,
232 sar : 2,
233 super : 2;
234 __u16 reqseq;
235 __u16 txseq;
236 __u8 retries;
237};
238
218struct bt_skb_cb { 239struct bt_skb_cb {
219 __u8 pkt_type; 240 __u8 pkt_type;
220 __u8 incoming; 241 __u8 incoming;
221 __u16 expect; 242 __u16 expect;
222 __u16 tx_seq;
223 __u8 retries;
224 __u8 sar;
225 __u8 force_active; 243 __u8 force_active;
244 struct l2cap_ctrl control;
226}; 245};
227#define bt_cb(skb) ((struct bt_skb_cb *)((skb)->cb)) 246#define bt_cb(skb) ((struct bt_skb_cb *)((skb)->cb))
228 247
@@ -242,12 +261,10 @@ static inline struct sk_buff *bt_skb_send_alloc(struct sock *sk,
242{ 261{
243 struct sk_buff *skb; 262 struct sk_buff *skb;
244 263
245 release_sock(sk);
246 if ((skb = sock_alloc_send_skb(sk, len + BT_SKB_RESERVE, nb, err))) { 264 if ((skb = sock_alloc_send_skb(sk, len + BT_SKB_RESERVE, nb, err))) {
247 skb_reserve(skb, BT_SKB_RESERVE); 265 skb_reserve(skb, BT_SKB_RESERVE);
248 bt_cb(skb)->incoming = 0; 266 bt_cb(skb)->incoming = 0;
249 } 267 }
250 lock_sock(sk);
251 268
252 if (!skb && *err) 269 if (!skb && *err)
253 return NULL; 270 return NULL;
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index d47e523c9d83..66a7b579e31c 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -102,6 +102,7 @@ enum {
102 HCI_DISCOVERABLE, 102 HCI_DISCOVERABLE,
103 HCI_LINK_SECURITY, 103 HCI_LINK_SECURITY,
104 HCI_PENDING_CLASS, 104 HCI_PENDING_CLASS,
105 HCI_PERIODIC_INQ,
105}; 106};
106 107
107/* HCI ioctl defines */ 108/* HCI ioctl defines */
@@ -324,6 +325,8 @@ struct hci_cp_inquiry {
324 325
325#define HCI_OP_INQUIRY_CANCEL 0x0402 326#define HCI_OP_INQUIRY_CANCEL 0x0402
326 327
328#define HCI_OP_PERIODIC_INQ 0x0403
329
327#define HCI_OP_EXIT_PERIODIC_INQ 0x0404 330#define HCI_OP_EXIT_PERIODIC_INQ 0x0404
328 331
329#define HCI_OP_CREATE_CONN 0x0405 332#define HCI_OP_CREATE_CONN 0x0405
@@ -717,6 +720,10 @@ struct hci_rp_read_local_oob_data {
717} __packed; 720} __packed;
718 721
719#define HCI_OP_READ_INQ_RSP_TX_POWER 0x0c58 722#define HCI_OP_READ_INQ_RSP_TX_POWER 0x0c58
723struct hci_rp_read_inq_rsp_tx_power {
724 __u8 status;
725 __s8 tx_power;
726} __packed;
720 727
721#define HCI_OP_READ_FLOW_CONTROL_MODE 0x0c66 728#define HCI_OP_READ_FLOW_CONTROL_MODE 0x0c66
722struct hci_rp_read_flow_control_mode { 729struct hci_rp_read_flow_control_mode {
@@ -1431,6 +1438,5 @@ struct hci_inquiry_req {
1431#define IREQ_CACHE_FLUSH 0x0001 1438#define IREQ_CACHE_FLUSH 0x0001
1432 1439
1433extern bool enable_hs; 1440extern bool enable_hs;
1434extern bool enable_le;
1435 1441
1436#endif /* __HCI_H */ 1442#endif /* __HCI_H */
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 6822d2595aff..9fc7728f94e4 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -155,9 +155,14 @@ struct hci_dev {
155 __u16 hci_rev; 155 __u16 hci_rev;
156 __u8 lmp_ver; 156 __u8 lmp_ver;
157 __u16 manufacturer; 157 __u16 manufacturer;
158 __le16 lmp_subver; 158 __u16 lmp_subver;
159 __u16 voice_setting; 159 __u16 voice_setting;
160 __u8 io_capability; 160 __u8 io_capability;
161 __s8 inq_tx_power;
162 __u16 devid_source;
163 __u16 devid_vendor;
164 __u16 devid_product;
165 __u16 devid_version;
161 166
162 __u16 pkt_type; 167 __u16 pkt_type;
163 __u16 esco_type; 168 __u16 esco_type;
@@ -250,9 +255,6 @@ struct hci_dev {
250 255
251 struct list_head remote_oob_data; 256 struct list_head remote_oob_data;
252 257
253 struct list_head adv_entries;
254 struct delayed_work adv_work;
255
256 struct hci_dev_stats stat; 258 struct hci_dev_stats stat;
257 259
258 struct sk_buff_head driver_init; 260 struct sk_buff_head driver_init;
@@ -263,7 +265,6 @@ struct hci_dev {
263 265
264 struct dentry *debugfs; 266 struct dentry *debugfs;
265 267
266 struct device *parent;
267 struct device dev; 268 struct device dev;
268 269
269 struct rfkill *rfkill; 270 struct rfkill *rfkill;
@@ -314,6 +315,7 @@ struct hci_conn {
314 315
315 __u8 remote_cap; 316 __u8 remote_cap;
316 __u8 remote_auth; 317 __u8 remote_auth;
318 bool flush_key;
317 319
318 unsigned int sent; 320 unsigned int sent;
319 321
@@ -570,7 +572,7 @@ int hci_chan_del(struct hci_chan *chan);
570void hci_chan_list_flush(struct hci_conn *conn); 572void hci_chan_list_flush(struct hci_conn *conn);
571 573
572struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst, 574struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst,
573 __u8 sec_level, __u8 auth_type); 575 __u8 dst_type, __u8 sec_level, __u8 auth_type);
574int hci_conn_check_link_mode(struct hci_conn *conn); 576int hci_conn_check_link_mode(struct hci_conn *conn);
575int hci_conn_check_secure(struct hci_conn *conn, __u8 sec_level); 577int hci_conn_check_secure(struct hci_conn *conn, __u8 sec_level);
576int hci_conn_security(struct hci_conn *conn, __u8 sec_level, __u8 auth_type); 578int hci_conn_security(struct hci_conn *conn, __u8 sec_level, __u8 auth_type);
@@ -672,8 +674,8 @@ int hci_add_link_key(struct hci_dev *hdev, struct hci_conn *conn, int new_key,
672 bdaddr_t *bdaddr, u8 *val, u8 type, u8 pin_len); 674 bdaddr_t *bdaddr, u8 *val, u8 type, u8 pin_len);
673struct smp_ltk *hci_find_ltk(struct hci_dev *hdev, __le16 ediv, u8 rand[8]); 675struct smp_ltk *hci_find_ltk(struct hci_dev *hdev, __le16 ediv, u8 rand[8]);
674int hci_add_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 addr_type, u8 type, 676int hci_add_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 addr_type, u8 type,
675 int new_key, u8 authenticated, u8 tk[16], u8 enc_size, u16 ediv, 677 int new_key, u8 authenticated, u8 tk[16], u8 enc_size,
676 u8 rand[8]); 678 __le16 ediv, u8 rand[8]);
677struct smp_ltk *hci_find_ltk_by_addr(struct hci_dev *hdev, bdaddr_t *bdaddr, 679struct smp_ltk *hci_find_ltk_by_addr(struct hci_dev *hdev, bdaddr_t *bdaddr,
678 u8 addr_type); 680 u8 addr_type);
679int hci_remove_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr); 681int hci_remove_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr);
@@ -687,14 +689,6 @@ int hci_add_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 *hash,
687 u8 *randomizer); 689 u8 *randomizer);
688int hci_remove_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr); 690int hci_remove_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr);
689 691
690#define ADV_CLEAR_TIMEOUT (3*60*HZ) /* Three minutes */
691int hci_adv_entries_clear(struct hci_dev *hdev);
692struct adv_entry *hci_find_adv_entry(struct hci_dev *hdev, bdaddr_t *bdaddr);
693int hci_add_adv_entry(struct hci_dev *hdev,
694 struct hci_ev_le_advertising_info *ev);
695
696void hci_del_off_timer(struct hci_dev *hdev);
697
698void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb); 692void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb);
699 693
700int hci_recv_frame(struct sk_buff *skb); 694int hci_recv_frame(struct sk_buff *skb);
@@ -708,7 +702,7 @@ void hci_conn_init_sysfs(struct hci_conn *conn);
708void hci_conn_add_sysfs(struct hci_conn *conn); 702void hci_conn_add_sysfs(struct hci_conn *conn);
709void hci_conn_del_sysfs(struct hci_conn *conn); 703void hci_conn_del_sysfs(struct hci_conn *conn);
710 704
711#define SET_HCIDEV_DEV(hdev, pdev) ((hdev)->parent = (pdev)) 705#define SET_HCIDEV_DEV(hdev, pdev) ((hdev)->dev.parent = (pdev))
712 706
713/* ----- LMP capabilities ----- */ 707/* ----- LMP capabilities ----- */
714#define lmp_rswitch_capable(dev) ((dev)->features[0] & LMP_RSWITCH) 708#define lmp_rswitch_capable(dev) ((dev)->features[0] & LMP_RSWITCH)
@@ -932,6 +926,23 @@ static inline bool eir_has_data_type(u8 *data, size_t data_len, u8 type)
932 return false; 926 return false;
933} 927}
934 928
929static inline size_t eir_get_length(u8 *eir, size_t eir_len)
930{
931 size_t parsed = 0;
932
933 while (parsed < eir_len) {
934 u8 field_len = eir[0];
935
936 if (field_len == 0)
937 return parsed;
938
939 parsed += field_len + 1;
940 eir += field_len + 1;
941 }
942
943 return eir_len;
944}
945
935static inline u16 eir_append_data(u8 *eir, u16 eir_len, u8 type, u8 *data, 946static inline u16 eir_append_data(u8 *eir, u16 eir_len, u8 type, u8 *data,
936 u8 data_len) 947 u8 data_len)
937{ 948{
@@ -960,17 +971,12 @@ void hci_send_to_monitor(struct hci_dev *hdev, struct sk_buff *skb);
960void hci_sock_dev_event(struct hci_dev *hdev, int event); 971void hci_sock_dev_event(struct hci_dev *hdev, int event);
961 972
962/* Management interface */ 973/* Management interface */
963#define MGMT_ADDR_BREDR 0x00 974#define DISCOV_TYPE_BREDR (BIT(BDADDR_BREDR))
964#define MGMT_ADDR_LE_PUBLIC 0x01 975#define DISCOV_TYPE_LE (BIT(BDADDR_LE_PUBLIC) | \
965#define MGMT_ADDR_LE_RANDOM 0x02 976 BIT(BDADDR_LE_RANDOM))
966#define MGMT_ADDR_INVALID 0xff 977#define DISCOV_TYPE_INTERLEAVED (BIT(BDADDR_BREDR) | \
967 978 BIT(BDADDR_LE_PUBLIC) | \
968#define DISCOV_TYPE_BREDR (BIT(MGMT_ADDR_BREDR)) 979 BIT(BDADDR_LE_RANDOM))
969#define DISCOV_TYPE_LE (BIT(MGMT_ADDR_LE_PUBLIC) | \
970 BIT(MGMT_ADDR_LE_RANDOM))
971#define DISCOV_TYPE_INTERLEAVED (BIT(MGMT_ADDR_BREDR) | \
972 BIT(MGMT_ADDR_LE_PUBLIC) | \
973 BIT(MGMT_ADDR_LE_RANDOM))
974 980
975int mgmt_control(struct sock *sk, struct msghdr *msg, size_t len); 981int mgmt_control(struct sock *sk, struct msghdr *msg, size_t len);
976int mgmt_index_added(struct hci_dev *hdev); 982int mgmt_index_added(struct hci_dev *hdev);
@@ -980,7 +986,7 @@ int mgmt_discoverable(struct hci_dev *hdev, u8 discoverable);
980int mgmt_connectable(struct hci_dev *hdev, u8 connectable); 986int mgmt_connectable(struct hci_dev *hdev, u8 connectable);
981int mgmt_write_scan_failed(struct hci_dev *hdev, u8 scan, u8 status); 987int mgmt_write_scan_failed(struct hci_dev *hdev, u8 scan, u8 status);
982int mgmt_new_link_key(struct hci_dev *hdev, struct link_key *key, 988int mgmt_new_link_key(struct hci_dev *hdev, struct link_key *key,
983 u8 persistent); 989 bool persistent);
984int mgmt_device_connected(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, 990int mgmt_device_connected(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
985 u8 addr_type, u32 flags, u8 *name, u8 name_len, 991 u8 addr_type, u32 flags, u8 *name, u8 name_len,
986 u8 *dev_class); 992 u8 *dev_class);
@@ -1066,12 +1072,12 @@ void hci_le_conn_update(struct hci_conn *conn, u16 min, u16 max,
1066 u16 latency, u16 to_multiplier); 1072 u16 latency, u16 to_multiplier);
1067void hci_le_start_enc(struct hci_conn *conn, __le16 ediv, __u8 rand[8], 1073void hci_le_start_enc(struct hci_conn *conn, __le16 ediv, __u8 rand[8],
1068 __u8 ltk[16]); 1074 __u8 ltk[16]);
1069void hci_le_ltk_reply(struct hci_conn *conn, u8 ltk[16]);
1070void hci_le_ltk_neg_reply(struct hci_conn *conn);
1071
1072int hci_do_inquiry(struct hci_dev *hdev, u8 length); 1075int hci_do_inquiry(struct hci_dev *hdev, u8 length);
1073int hci_cancel_inquiry(struct hci_dev *hdev); 1076int hci_cancel_inquiry(struct hci_dev *hdev);
1074int hci_le_scan(struct hci_dev *hdev, u8 type, u16 interval, u16 window, 1077int hci_le_scan(struct hci_dev *hdev, u8 type, u16 interval, u16 window,
1075 int timeout); 1078 int timeout);
1079int hci_cancel_le_scan(struct hci_dev *hdev);
1080
1081u8 bdaddr_to_le(u8 bdaddr_type);
1076 1082
1077#endif /* __HCI_CORE_H */ 1083#endif /* __HCI_CORE_H */
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index 9b242c6bf55b..1c7d1cd5e679 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -44,6 +44,7 @@
44#define L2CAP_DEFAULT_MAX_SDU_SIZE 0xFFFF 44#define L2CAP_DEFAULT_MAX_SDU_SIZE 0xFFFF
45#define L2CAP_DEFAULT_SDU_ITIME 0xFFFFFFFF 45#define L2CAP_DEFAULT_SDU_ITIME 0xFFFFFFFF
46#define L2CAP_DEFAULT_ACC_LAT 0xFFFFFFFF 46#define L2CAP_DEFAULT_ACC_LAT 0xFFFFFFFF
47#define L2CAP_BREDR_MAX_PAYLOAD 1019 /* 3-DH5 packet */
47 48
48#define L2CAP_DISC_TIMEOUT msecs_to_jiffies(100) 49#define L2CAP_DISC_TIMEOUT msecs_to_jiffies(100)
49#define L2CAP_DISC_REJ_TIMEOUT msecs_to_jiffies(5000) 50#define L2CAP_DISC_REJ_TIMEOUT msecs_to_jiffies(5000)
@@ -57,6 +58,7 @@ struct sockaddr_l2 {
57 __le16 l2_psm; 58 __le16 l2_psm;
58 bdaddr_t l2_bdaddr; 59 bdaddr_t l2_bdaddr;
59 __le16 l2_cid; 60 __le16 l2_cid;
61 __u8 l2_bdaddr_type;
60}; 62};
61 63
62/* L2CAP socket options */ 64/* L2CAP socket options */
@@ -139,6 +141,8 @@ struct l2cap_conninfo {
139 141
140#define L2CAP_CTRL_TXSEQ_SHIFT 1 142#define L2CAP_CTRL_TXSEQ_SHIFT 1
141#define L2CAP_CTRL_SUPER_SHIFT 2 143#define L2CAP_CTRL_SUPER_SHIFT 2
144#define L2CAP_CTRL_POLL_SHIFT 4
145#define L2CAP_CTRL_FINAL_SHIFT 7
142#define L2CAP_CTRL_REQSEQ_SHIFT 8 146#define L2CAP_CTRL_REQSEQ_SHIFT 8
143#define L2CAP_CTRL_SAR_SHIFT 14 147#define L2CAP_CTRL_SAR_SHIFT 14
144 148
@@ -152,9 +156,11 @@ struct l2cap_conninfo {
152#define L2CAP_EXT_CTRL_FINAL 0x00000002 156#define L2CAP_EXT_CTRL_FINAL 0x00000002
153#define L2CAP_EXT_CTRL_FRAME_TYPE 0x00000001 /* I- or S-Frame */ 157#define L2CAP_EXT_CTRL_FRAME_TYPE 0x00000001 /* I- or S-Frame */
154 158
159#define L2CAP_EXT_CTRL_FINAL_SHIFT 1
155#define L2CAP_EXT_CTRL_REQSEQ_SHIFT 2 160#define L2CAP_EXT_CTRL_REQSEQ_SHIFT 2
156#define L2CAP_EXT_CTRL_SAR_SHIFT 16 161#define L2CAP_EXT_CTRL_SAR_SHIFT 16
157#define L2CAP_EXT_CTRL_SUPER_SHIFT 16 162#define L2CAP_EXT_CTRL_SUPER_SHIFT 16
163#define L2CAP_EXT_CTRL_POLL_SHIFT 18
158#define L2CAP_EXT_CTRL_TXSEQ_SHIFT 18 164#define L2CAP_EXT_CTRL_TXSEQ_SHIFT 18
159 165
160/* L2CAP Supervisory Function */ 166/* L2CAP Supervisory Function */
@@ -186,6 +192,8 @@ struct l2cap_hdr {
186#define L2CAP_FCS_SIZE 2 192#define L2CAP_FCS_SIZE 2
187#define L2CAP_SDULEN_SIZE 2 193#define L2CAP_SDULEN_SIZE 2
188#define L2CAP_PSMLEN_SIZE 2 194#define L2CAP_PSMLEN_SIZE 2
195#define L2CAP_ENH_CTRL_SIZE 2
196#define L2CAP_EXT_CTRL_SIZE 4
189 197
190struct l2cap_cmd_hdr { 198struct l2cap_cmd_hdr {
191 __u8 code; 199 __u8 code;
@@ -401,6 +409,16 @@ struct l2cap_conn_param_update_rsp {
401#define L2CAP_CONN_PARAM_REJECTED 0x0001 409#define L2CAP_CONN_PARAM_REJECTED 0x0001
402 410
403/* ----- L2CAP channels and connections ----- */ 411/* ----- L2CAP channels and connections ----- */
412struct l2cap_seq_list {
413 __u16 head;
414 __u16 tail;
415 __u16 mask;
416 __u16 *list;
417};
418
419#define L2CAP_SEQ_LIST_CLEAR 0xFFFF
420#define L2CAP_SEQ_LIST_TAIL 0x8000
421
404struct srej_list { 422struct srej_list {
405 __u16 tx_seq; 423 __u16 tx_seq;
406 struct list_head list; 424 struct list_head list;
@@ -446,6 +464,9 @@ struct l2cap_chan {
446 __u16 monitor_timeout; 464 __u16 monitor_timeout;
447 __u16 mps; 465 __u16 mps;
448 466
467 __u8 tx_state;
468 __u8 rx_state;
469
449 unsigned long conf_state; 470 unsigned long conf_state;
450 unsigned long conn_state; 471 unsigned long conn_state;
451 unsigned long flags; 472 unsigned long flags;
@@ -456,9 +477,11 @@ struct l2cap_chan {
456 __u16 buffer_seq; 477 __u16 buffer_seq;
457 __u16 buffer_seq_srej; 478 __u16 buffer_seq_srej;
458 __u16 srej_save_reqseq; 479 __u16 srej_save_reqseq;
480 __u16 last_acked_seq;
459 __u16 frames_sent; 481 __u16 frames_sent;
460 __u16 unacked_frames; 482 __u16 unacked_frames;
461 __u8 retry_count; 483 __u8 retry_count;
484 __u16 srej_queue_next;
462 __u8 num_acked; 485 __u8 num_acked;
463 __u16 sdu_len; 486 __u16 sdu_len;
464 struct sk_buff *sdu; 487 struct sk_buff *sdu;
@@ -490,6 +513,8 @@ struct l2cap_chan {
490 struct sk_buff *tx_send_head; 513 struct sk_buff *tx_send_head;
491 struct sk_buff_head tx_q; 514 struct sk_buff_head tx_q;
492 struct sk_buff_head srej_q; 515 struct sk_buff_head srej_q;
516 struct l2cap_seq_list srej_list;
517 struct l2cap_seq_list retrans_list;
493 struct list_head srej_l; 518 struct list_head srej_l;
494 519
495 struct list_head list; 520 struct list_head list;
@@ -508,8 +533,7 @@ struct l2cap_ops {
508 void (*close) (void *data); 533 void (*close) (void *data);
509 void (*state_change) (void *data, int state); 534 void (*state_change) (void *data, int state);
510 struct sk_buff *(*alloc_skb) (struct l2cap_chan *chan, 535 struct sk_buff *(*alloc_skb) (struct l2cap_chan *chan,
511 unsigned long len, int nb, int *err); 536 unsigned long len, int nb);
512
513}; 537};
514 538
515struct l2cap_conn { 539struct l2cap_conn {
@@ -600,6 +624,44 @@ enum {
600 FLAG_EFS_ENABLE, 624 FLAG_EFS_ENABLE,
601}; 625};
602 626
627enum {
628 L2CAP_TX_STATE_XMIT,
629 L2CAP_TX_STATE_WAIT_F,
630};
631
632enum {
633 L2CAP_RX_STATE_RECV,
634 L2CAP_RX_STATE_SREJ_SENT,
635};
636
637enum {
638 L2CAP_TXSEQ_EXPECTED,
639 L2CAP_TXSEQ_EXPECTED_SREJ,
640 L2CAP_TXSEQ_UNEXPECTED,
641 L2CAP_TXSEQ_UNEXPECTED_SREJ,
642 L2CAP_TXSEQ_DUPLICATE,
643 L2CAP_TXSEQ_DUPLICATE_SREJ,
644 L2CAP_TXSEQ_INVALID,
645 L2CAP_TXSEQ_INVALID_IGNORE,
646};
647
648enum {
649 L2CAP_EV_DATA_REQUEST,
650 L2CAP_EV_LOCAL_BUSY_DETECTED,
651 L2CAP_EV_LOCAL_BUSY_CLEAR,
652 L2CAP_EV_RECV_REQSEQ_AND_FBIT,
653 L2CAP_EV_RECV_FBIT,
654 L2CAP_EV_RETRANS_TO,
655 L2CAP_EV_MONITOR_TO,
656 L2CAP_EV_EXPLICIT_POLL,
657 L2CAP_EV_RECV_IFRAME,
658 L2CAP_EV_RECV_RR,
659 L2CAP_EV_RECV_REJ,
660 L2CAP_EV_RECV_RNR,
661 L2CAP_EV_RECV_SREJ,
662 L2CAP_EV_RECV_FRAME,
663};
664
603static inline void l2cap_chan_hold(struct l2cap_chan *c) 665static inline void l2cap_chan_hold(struct l2cap_chan *c)
604{ 666{
605 atomic_inc(&c->refcnt); 667 atomic_inc(&c->refcnt);
@@ -622,21 +684,26 @@ static inline void l2cap_chan_unlock(struct l2cap_chan *chan)
622} 684}
623 685
624static inline void l2cap_set_timer(struct l2cap_chan *chan, 686static inline void l2cap_set_timer(struct l2cap_chan *chan,
625 struct delayed_work *work, long timeout) 687 struct delayed_work *work, long timeout)
626{ 688{
627 BT_DBG("chan %p state %s timeout %ld", chan, 689 BT_DBG("chan %p state %s timeout %ld", chan,
628 state_to_string(chan->state), timeout); 690 state_to_string(chan->state), timeout);
629 691
692 /* If delayed work cancelled do not hold(chan)
693 since it is already done with previous set_timer */
630 if (!cancel_delayed_work(work)) 694 if (!cancel_delayed_work(work))
631 l2cap_chan_hold(chan); 695 l2cap_chan_hold(chan);
696
632 schedule_delayed_work(work, timeout); 697 schedule_delayed_work(work, timeout);
633} 698}
634 699
635static inline bool l2cap_clear_timer(struct l2cap_chan *chan, 700static inline bool l2cap_clear_timer(struct l2cap_chan *chan,
636 struct delayed_work *work) 701 struct delayed_work *work)
637{ 702{
638 bool ret; 703 bool ret;
639 704
705 /* put(chan) if delayed work cancelled otherwise it
706 is done in delayed work function */
640 ret = cancel_delayed_work(work); 707 ret = cancel_delayed_work(work);
641 if (ret) 708 if (ret)
642 l2cap_chan_put(chan); 709 l2cap_chan_put(chan);
@@ -658,13 +725,10 @@ static inline bool l2cap_clear_timer(struct l2cap_chan *chan,
658 725
659static inline int __seq_offset(struct l2cap_chan *chan, __u16 seq1, __u16 seq2) 726static inline int __seq_offset(struct l2cap_chan *chan, __u16 seq1, __u16 seq2)
660{ 727{
661 int offset; 728 if (seq1 >= seq2)
662 729 return seq1 - seq2;
663 offset = (seq1 - seq2) % (chan->tx_win_max + 1); 730 else
664 if (offset < 0) 731 return chan->tx_win_max + 1 - seq2 + seq1;
665 offset += (chan->tx_win_max + 1);
666
667 return offset;
668} 732}
669 733
670static inline __u16 __next_seq(struct l2cap_chan *chan, __u16 seq) 734static inline __u16 __next_seq(struct l2cap_chan *chan, __u16 seq)
@@ -852,14 +916,15 @@ int __l2cap_wait_ack(struct sock *sk);
852int l2cap_add_psm(struct l2cap_chan *chan, bdaddr_t *src, __le16 psm); 916int l2cap_add_psm(struct l2cap_chan *chan, bdaddr_t *src, __le16 psm);
853int l2cap_add_scid(struct l2cap_chan *chan, __u16 scid); 917int l2cap_add_scid(struct l2cap_chan *chan, __u16 scid);
854 918
855struct l2cap_chan *l2cap_chan_create(struct sock *sk); 919struct l2cap_chan *l2cap_chan_create(void);
856void l2cap_chan_close(struct l2cap_chan *chan, int reason); 920void l2cap_chan_close(struct l2cap_chan *chan, int reason);
857void l2cap_chan_destroy(struct l2cap_chan *chan); 921void l2cap_chan_destroy(struct l2cap_chan *chan);
858int l2cap_chan_connect(struct l2cap_chan *chan, __le16 psm, u16 cid, 922int l2cap_chan_connect(struct l2cap_chan *chan, __le16 psm, u16 cid,
859 bdaddr_t *dst); 923 bdaddr_t *dst, u8 dst_type);
860int l2cap_chan_send(struct l2cap_chan *chan, struct msghdr *msg, size_t len, 924int l2cap_chan_send(struct l2cap_chan *chan, struct msghdr *msg, size_t len,
861 u32 priority); 925 u32 priority);
862void l2cap_chan_busy(struct l2cap_chan *chan, int busy); 926void l2cap_chan_busy(struct l2cap_chan *chan, int busy);
863int l2cap_chan_check_security(struct l2cap_chan *chan); 927int l2cap_chan_check_security(struct l2cap_chan *chan);
928void l2cap_chan_set_defaults(struct l2cap_chan *chan);
864 929
865#endif /* __L2CAP_H */ 930#endif /* __L2CAP_H */
diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h
index ebfd91fc20f8..23fd0546fccb 100644
--- a/include/net/bluetooth/mgmt.h
+++ b/include/net/bluetooth/mgmt.h
@@ -341,6 +341,15 @@ struct mgmt_cp_unblock_device {
341} __packed; 341} __packed;
342#define MGMT_UNBLOCK_DEVICE_SIZE MGMT_ADDR_INFO_SIZE 342#define MGMT_UNBLOCK_DEVICE_SIZE MGMT_ADDR_INFO_SIZE
343 343
344#define MGMT_OP_SET_DEVICE_ID 0x0028
345struct mgmt_cp_set_device_id {
346 __le16 source;
347 __le16 vendor;
348 __le16 product;
349 __le16 version;
350} __packed;
351#define MGMT_SET_DEVICE_ID_SIZE 8
352
344#define MGMT_EV_CMD_COMPLETE 0x0001 353#define MGMT_EV_CMD_COMPLETE 0x0001
345struct mgmt_ev_cmd_complete { 354struct mgmt_ev_cmd_complete {
346 __le16 opcode; 355 __le16 opcode;
diff --git a/include/net/bluetooth/smp.h b/include/net/bluetooth/smp.h
index 7b3acdd29134..ca356a734920 100644
--- a/include/net/bluetooth/smp.h
+++ b/include/net/bluetooth/smp.h
@@ -77,7 +77,7 @@ struct smp_cmd_encrypt_info {
77 77
78#define SMP_CMD_MASTER_IDENT 0x07 78#define SMP_CMD_MASTER_IDENT 0x07
79struct smp_cmd_master_ident { 79struct smp_cmd_master_ident {
80 __u16 ediv; 80 __le16 ediv;
81 __u8 rand[8]; 81 __u8 rand[8];
82} __packed; 82} __packed;
83 83
diff --git a/include/net/caif/caif_hsi.h b/include/net/caif/caif_hsi.h
index 6db8ecf52aa2..439dadc8102f 100644
--- a/include/net/caif/caif_hsi.h
+++ b/include/net/caif/caif_hsi.h
@@ -123,12 +123,21 @@ struct cfhsi_rx_state {
123 bool piggy_desc; 123 bool piggy_desc;
124}; 124};
125 125
126/* Priority mapping */
127enum {
128 CFHSI_PRIO_CTL = 0,
129 CFHSI_PRIO_VI,
130 CFHSI_PRIO_VO,
131 CFHSI_PRIO_BEBK,
132 CFHSI_PRIO_LAST,
133};
134
126/* Structure implemented by CAIF HSI drivers. */ 135/* Structure implemented by CAIF HSI drivers. */
127struct cfhsi { 136struct cfhsi {
128 struct caif_dev_common cfdev; 137 struct caif_dev_common cfdev;
129 struct net_device *ndev; 138 struct net_device *ndev;
130 struct platform_device *pdev; 139 struct platform_device *pdev;
131 struct sk_buff_head qhead; 140 struct sk_buff_head qhead[CFHSI_PRIO_LAST];
132 struct cfhsi_drv drv; 141 struct cfhsi_drv drv;
133 struct cfhsi_dev *dev; 142 struct cfhsi_dev *dev;
134 int tx_state; 143 int tx_state;
@@ -151,8 +160,14 @@ struct cfhsi {
151 wait_queue_head_t wake_up_wait; 160 wait_queue_head_t wake_up_wait;
152 wait_queue_head_t wake_down_wait; 161 wait_queue_head_t wake_down_wait;
153 wait_queue_head_t flush_fifo_wait; 162 wait_queue_head_t flush_fifo_wait;
154 struct timer_list timer; 163 struct timer_list inactivity_timer;
155 struct timer_list rx_slowpath_timer; 164 struct timer_list rx_slowpath_timer;
165
166 /* TX aggregation */
167 unsigned long aggregation_timeout;
168 int aggregation_len;
169 struct timer_list aggregation_timer;
170
156 unsigned long bits; 171 unsigned long bits;
157}; 172};
158 173
diff --git a/include/net/caif/cfpkt.h b/include/net/caif/cfpkt.h
index 6bd200a4754a..83a89ba3005b 100644
--- a/include/net/caif/cfpkt.h
+++ b/include/net/caif/cfpkt.h
@@ -188,11 +188,18 @@ struct cfpkt *cfpkt_fromnative(enum caif_direction dir, void *nativepkt);
188 */ 188 */
189void *cfpkt_tonative(struct cfpkt *pkt); 189void *cfpkt_tonative(struct cfpkt *pkt);
190 190
191
192/* 191/*
193 * Returns packet information for a packet. 192 * Returns packet information for a packet.
194 * pkt Packet to get info from; 193 * pkt Packet to get info from;
195 * @return Packet information 194 * @return Packet information
196 */ 195 */
197struct caif_payload_info *cfpkt_info(struct cfpkt *pkt); 196struct caif_payload_info *cfpkt_info(struct cfpkt *pkt);
197
198/** cfpkt_set_prio - set priority for a CAIF packet.
199 *
200 * @pkt: The CAIF packet to be adjusted.
201 * @prio: one of TC_PRIO_ constants.
202 */
203void cfpkt_set_prio(struct cfpkt *pkt, int prio);
204
198#endif /* CFPKT_H_ */ 205#endif /* CFPKT_H_ */
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 83d800c31e3c..0289d4ce7070 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -521,6 +521,7 @@ struct station_parameters {
521 * @STATION_INFO_ASSOC_REQ_IES: @assoc_req_ies filled 521 * @STATION_INFO_ASSOC_REQ_IES: @assoc_req_ies filled
522 * @STATION_INFO_STA_FLAGS: @sta_flags filled 522 * @STATION_INFO_STA_FLAGS: @sta_flags filled
523 * @STATION_INFO_BEACON_LOSS_COUNT: @beacon_loss_count filled 523 * @STATION_INFO_BEACON_LOSS_COUNT: @beacon_loss_count filled
524 * @STATION_INFO_T_OFFSET: @t_offset filled
524 */ 525 */
525enum station_info_flags { 526enum station_info_flags {
526 STATION_INFO_INACTIVE_TIME = 1<<0, 527 STATION_INFO_INACTIVE_TIME = 1<<0,
@@ -542,7 +543,8 @@ enum station_info_flags {
542 STATION_INFO_CONNECTED_TIME = 1<<16, 543 STATION_INFO_CONNECTED_TIME = 1<<16,
543 STATION_INFO_ASSOC_REQ_IES = 1<<17, 544 STATION_INFO_ASSOC_REQ_IES = 1<<17,
544 STATION_INFO_STA_FLAGS = 1<<18, 545 STATION_INFO_STA_FLAGS = 1<<18,
545 STATION_INFO_BEACON_LOSS_COUNT = 1<<19 546 STATION_INFO_BEACON_LOSS_COUNT = 1<<19,
547 STATION_INFO_T_OFFSET = 1<<20,
546}; 548};
547 549
548/** 550/**
@@ -643,6 +645,7 @@ struct sta_bss_parameters {
643 * @assoc_req_ies_len: Length of assoc_req_ies buffer in octets. 645 * @assoc_req_ies_len: Length of assoc_req_ies buffer in octets.
644 * @sta_flags: station flags mask & values 646 * @sta_flags: station flags mask & values
645 * @beacon_loss_count: Number of times beacon loss event has triggered. 647 * @beacon_loss_count: Number of times beacon loss event has triggered.
648 * @t_offset: Time offset of the station relative to this host.
646 */ 649 */
647struct station_info { 650struct station_info {
648 u32 filled; 651 u32 filled;
@@ -671,6 +674,7 @@ struct station_info {
671 size_t assoc_req_ies_len; 674 size_t assoc_req_ies_len;
672 675
673 u32 beacon_loss_count; 676 u32 beacon_loss_count;
677 s64 t_offset;
674 678
675 /* 679 /*
676 * Note: Add a new enum station_info_flags value for each new field and 680 * Note: Add a new enum station_info_flags value for each new field and
@@ -798,6 +802,8 @@ struct mesh_config {
798 /* ttl used in path selection information elements */ 802 /* ttl used in path selection information elements */
799 u8 element_ttl; 803 u8 element_ttl;
800 bool auto_open_plinks; 804 bool auto_open_plinks;
805 /* neighbor offset synchronization */
806 u32 dot11MeshNbrOffsetMaxNeighbor;
801 /* HWMP parameters */ 807 /* HWMP parameters */
802 u8 dot11MeshHWMPmaxPREQretries; 808 u8 dot11MeshHWMPmaxPREQretries;
803 u32 path_refresh_time; 809 u32 path_refresh_time;
@@ -815,12 +821,14 @@ struct mesh_config {
815 bool dot11MeshGateAnnouncementProtocol; 821 bool dot11MeshGateAnnouncementProtocol;
816 bool dot11MeshForwarding; 822 bool dot11MeshForwarding;
817 s32 rssi_threshold; 823 s32 rssi_threshold;
824 u16 ht_opmode;
818}; 825};
819 826
820/** 827/**
821 * struct mesh_setup - 802.11s mesh setup configuration 828 * struct mesh_setup - 802.11s mesh setup configuration
822 * @mesh_id: the mesh ID 829 * @mesh_id: the mesh ID
823 * @mesh_id_len: length of the mesh ID, at least 1 and at most 32 bytes 830 * @mesh_id_len: length of the mesh ID, at least 1 and at most 32 bytes
831 * @sync_method: which synchronization method to use
824 * @path_sel_proto: which path selection protocol to use 832 * @path_sel_proto: which path selection protocol to use
825 * @path_metric: which metric to use 833 * @path_metric: which metric to use
826 * @ie: vendor information elements (optional) 834 * @ie: vendor information elements (optional)
@@ -834,8 +842,9 @@ struct mesh_config {
834struct mesh_setup { 842struct mesh_setup {
835 const u8 *mesh_id; 843 const u8 *mesh_id;
836 u8 mesh_id_len; 844 u8 mesh_id_len;
837 u8 path_sel_proto; 845 u8 sync_method;
838 u8 path_metric; 846 u8 path_sel_proto;
847 u8 path_metric;
839 const u8 *ie; 848 const u8 *ie;
840 u8 ie_len; 849 u8 ie_len;
841 bool is_authenticated; 850 bool is_authenticated;
@@ -845,7 +854,7 @@ struct mesh_setup {
845 854
846/** 855/**
847 * struct ieee80211_txq_params - TX queue parameters 856 * struct ieee80211_txq_params - TX queue parameters
848 * @queue: TX queue identifier (NL80211_TXQ_Q_*) 857 * @ac: AC identifier
849 * @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled 858 * @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled
850 * @cwmin: Minimum contention window [a value of the form 2^n-1 in the range 859 * @cwmin: Minimum contention window [a value of the form 2^n-1 in the range
851 * 1..32767] 860 * 1..32767]
@@ -854,7 +863,7 @@ struct mesh_setup {
854 * @aifs: Arbitration interframe space [0..255] 863 * @aifs: Arbitration interframe space [0..255]
855 */ 864 */
856struct ieee80211_txq_params { 865struct ieee80211_txq_params {
857 enum nl80211_txq_q queue; 866 enum nl80211_ac ac;
858 u16 txop; 867 u16 txop;
859 u16 cwmin; 868 u16 cwmin;
860 u16 cwmax; 869 u16 cwmax;
@@ -1336,6 +1345,9 @@ struct cfg80211_gtk_rekey_data {
1336 * be %NULL or contain the enabled Wake-on-Wireless triggers that are 1345 * be %NULL or contain the enabled Wake-on-Wireless triggers that are
1337 * configured for the device. 1346 * configured for the device.
1338 * @resume: wiphy device needs to be resumed 1347 * @resume: wiphy device needs to be resumed
1348 * @set_wakeup: Called when WoWLAN is enabled/disabled, use this callback
1349 * to call device_set_wakeup_enable() to enable/disable wakeup from
1350 * the device.
1339 * 1351 *
1340 * @add_virtual_intf: create a new virtual interface with the given name, 1352 * @add_virtual_intf: create a new virtual interface with the given name,
1341 * must set the struct wireless_dev's iftype. Beware: You must create 1353 * must set the struct wireless_dev's iftype. Beware: You must create
@@ -1503,10 +1515,21 @@ struct cfg80211_gtk_rekey_data {
1503 * later passes to cfg80211_probe_status(). 1515 * later passes to cfg80211_probe_status().
1504 * 1516 *
1505 * @set_noack_map: Set the NoAck Map for the TIDs. 1517 * @set_noack_map: Set the NoAck Map for the TIDs.
1518 *
1519 * @get_et_sset_count: Ethtool API to get string-set count.
1520 * See @ethtool_ops.get_sset_count
1521 *
1522 * @get_et_stats: Ethtool API to get a set of u64 stats.
1523 * See @ethtool_ops.get_ethtool_stats
1524 *
1525 * @get_et_strings: Ethtool API to get a set of strings to describe stats
1526 * and perhaps other supported types of ethtool data-sets.
1527 * See @ethtool_ops.get_strings
1506 */ 1528 */
1507struct cfg80211_ops { 1529struct cfg80211_ops {
1508 int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow); 1530 int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
1509 int (*resume)(struct wiphy *wiphy); 1531 int (*resume)(struct wiphy *wiphy);
1532 void (*set_wakeup)(struct wiphy *wiphy, bool enabled);
1510 1533
1511 struct net_device * (*add_virtual_intf)(struct wiphy *wiphy, 1534 struct net_device * (*add_virtual_intf)(struct wiphy *wiphy,
1512 char *name, 1535 char *name,
@@ -1698,7 +1721,15 @@ struct cfg80211_ops {
1698 struct net_device *dev, 1721 struct net_device *dev,
1699 u16 noack_map); 1722 u16 noack_map);
1700 1723
1701 struct ieee80211_channel *(*get_channel)(struct wiphy *wiphy); 1724 struct ieee80211_channel *(*get_channel)(struct wiphy *wiphy,
1725 enum nl80211_channel_type *type);
1726
1727 int (*get_et_sset_count)(struct wiphy *wiphy,
1728 struct net_device *dev, int sset);
1729 void (*get_et_stats)(struct wiphy *wiphy, struct net_device *dev,
1730 struct ethtool_stats *stats, u64 *data);
1731 void (*get_et_strings)(struct wiphy *wiphy, struct net_device *dev,
1732 u32 sset, u8 *data);
1702}; 1733};
1703 1734
1704/* 1735/*
@@ -1732,10 +1763,6 @@ struct cfg80211_ops {
1732 * hints read the documenation for regulatory_hint_found_beacon() 1763 * hints read the documenation for regulatory_hint_found_beacon()
1733 * @WIPHY_FLAG_NETNS_OK: if not set, do not allow changing the netns of this 1764 * @WIPHY_FLAG_NETNS_OK: if not set, do not allow changing the netns of this
1734 * wiphy at all 1765 * wiphy at all
1735 * @WIPHY_FLAG_ENFORCE_COMBINATIONS: Set this flag to enforce interface
1736 * combinations for this device. This flag is used for backward
1737 * compatibility only until all drivers advertise combinations and
1738 * they will always be enforced.
1739 * @WIPHY_FLAG_PS_ON_BY_DEFAULT: if set to true, powersave will be enabled 1766 * @WIPHY_FLAG_PS_ON_BY_DEFAULT: if set to true, powersave will be enabled
1740 * by default -- this flag will be set depending on the kernel's default 1767 * by default -- this flag will be set depending on the kernel's default
1741 * on wiphy_new(), but can be changed by the driver if it has a good 1768 * on wiphy_new(), but can be changed by the driver if it has a good
@@ -1780,7 +1807,7 @@ enum wiphy_flags {
1780 WIPHY_FLAG_IBSS_RSN = BIT(8), 1807 WIPHY_FLAG_IBSS_RSN = BIT(8),
1781 WIPHY_FLAG_MESH_AUTH = BIT(10), 1808 WIPHY_FLAG_MESH_AUTH = BIT(10),
1782 WIPHY_FLAG_SUPPORTS_SCHED_SCAN = BIT(11), 1809 WIPHY_FLAG_SUPPORTS_SCHED_SCAN = BIT(11),
1783 WIPHY_FLAG_ENFORCE_COMBINATIONS = BIT(12), 1810 /* use hole at 12 */
1784 WIPHY_FLAG_SUPPORTS_FW_ROAM = BIT(13), 1811 WIPHY_FLAG_SUPPORTS_FW_ROAM = BIT(13),
1785 WIPHY_FLAG_AP_UAPSD = BIT(14), 1812 WIPHY_FLAG_AP_UAPSD = BIT(14),
1786 WIPHY_FLAG_SUPPORTS_TDLS = BIT(15), 1813 WIPHY_FLAG_SUPPORTS_TDLS = BIT(15),
@@ -3338,9 +3365,20 @@ void cfg80211_report_obss_beacon(struct wiphy *wiphy,
3338 * @chan: main channel 3365 * @chan: main channel
3339 * @channel_type: HT mode 3366 * @channel_type: HT mode
3340 */ 3367 */
3341int cfg80211_can_beacon_sec_chan(struct wiphy *wiphy, 3368bool cfg80211_can_beacon_sec_chan(struct wiphy *wiphy,
3342 struct ieee80211_channel *chan, 3369 struct ieee80211_channel *chan,
3343 enum nl80211_channel_type channel_type); 3370 enum nl80211_channel_type channel_type);
3371
3372/*
3373 * cfg80211_ch_switch_notify - update wdev channel and notify userspace
3374 * @dev: the device which switched channels
3375 * @freq: new channel frequency (in MHz)
3376 * @type: channel type
3377 *
3378 * Acquires wdev_lock, so must only be called from sleepable driver context!
3379 */
3380void cfg80211_ch_switch_notify(struct net_device *dev, int freq,
3381 enum nl80211_channel_type type);
3344 3382
3345/* 3383/*
3346 * cfg80211_calculate_bitrate - calculate actual bitrate (in 100Kbps units) 3384 * cfg80211_calculate_bitrate - calculate actual bitrate (in 100Kbps units)
diff --git a/include/net/codel.h b/include/net/codel.h
new file mode 100644
index 000000000000..550debfc2403
--- /dev/null
+++ b/include/net/codel.h
@@ -0,0 +1,342 @@
1#ifndef __NET_SCHED_CODEL_H
2#define __NET_SCHED_CODEL_H
3
4/*
5 * Codel - The Controlled-Delay Active Queue Management algorithm
6 *
7 * Copyright (C) 2011-2012 Kathleen Nichols <nichols@pollere.com>
8 * Copyright (C) 2011-2012 Van Jacobson <van@pollere.net>
9 * Copyright (C) 2012 Michael D. Taht <dave.taht@bufferbloat.net>
10 * Copyright (C) 2012 Eric Dumazet <edumazet@google.com>
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions, and the following disclaimer,
17 * without modification.
18 * 2. Redistributions in binary form must reproduce the above copyright
19 * notice, this list of conditions and the following disclaimer in the
20 * documentation and/or other materials provided with the distribution.
21 * 3. The names of the authors may not be used to endorse or promote products
22 * derived from this software without specific prior written permission.
23 *
24 * Alternatively, provided that this notice is retained in full, this
25 * software may be distributed under the terms of the GNU General
26 * Public License ("GPL") version 2, in which case the provisions of the
27 * GPL apply INSTEAD OF those given above.
28 *
29 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
30 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
31 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
32 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
33 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
34 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
35 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
36 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
37 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
38 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
39 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
40 * DAMAGE.
41 *
42 */
43
44#include <linux/types.h>
45#include <linux/ktime.h>
46#include <linux/skbuff.h>
47#include <net/pkt_sched.h>
48#include <net/inet_ecn.h>
49#include <linux/reciprocal_div.h>
50
51/* Controlling Queue Delay (CoDel) algorithm
52 * =========================================
53 * Source : Kathleen Nichols and Van Jacobson
54 * http://queue.acm.org/detail.cfm?id=2209336
55 *
56 * Implemented on linux by Dave Taht and Eric Dumazet
57 */
58
59
60/* CoDel uses a 1024 nsec clock, encoded in u32
61 * This gives a range of 2199 seconds, because of signed compares
62 */
63typedef u32 codel_time_t;
64typedef s32 codel_tdiff_t;
65#define CODEL_SHIFT 10
66#define MS2TIME(a) ((a * NSEC_PER_MSEC) >> CODEL_SHIFT)
67
68static inline codel_time_t codel_get_time(void)
69{
70 u64 ns = ktime_to_ns(ktime_get());
71
72 return ns >> CODEL_SHIFT;
73}
74
75#define codel_time_after(a, b) ((s32)(a) - (s32)(b) > 0)
76#define codel_time_after_eq(a, b) ((s32)(a) - (s32)(b) >= 0)
77#define codel_time_before(a, b) ((s32)(a) - (s32)(b) < 0)
78#define codel_time_before_eq(a, b) ((s32)(a) - (s32)(b) <= 0)
79
80/* Qdiscs using codel plugin must use codel_skb_cb in their own cb[] */
81struct codel_skb_cb {
82 codel_time_t enqueue_time;
83};
84
85static struct codel_skb_cb *get_codel_cb(const struct sk_buff *skb)
86{
87 qdisc_cb_private_validate(skb, sizeof(struct codel_skb_cb));
88 return (struct codel_skb_cb *)qdisc_skb_cb(skb)->data;
89}
90
91static codel_time_t codel_get_enqueue_time(const struct sk_buff *skb)
92{
93 return get_codel_cb(skb)->enqueue_time;
94}
95
96static void codel_set_enqueue_time(struct sk_buff *skb)
97{
98 get_codel_cb(skb)->enqueue_time = codel_get_time();
99}
100
101static inline u32 codel_time_to_us(codel_time_t val)
102{
103 u64 valns = ((u64)val << CODEL_SHIFT);
104
105 do_div(valns, NSEC_PER_USEC);
106 return (u32)valns;
107}
108
109/**
110 * struct codel_params - contains codel parameters
111 * @target: target queue size (in time units)
112 * @interval: width of moving time window
113 * @ecn: is Explicit Congestion Notification enabled
114 */
115struct codel_params {
116 codel_time_t target;
117 codel_time_t interval;
118 bool ecn;
119};
120
121/**
122 * struct codel_vars - contains codel variables
123 * @count: how many drops we've done since the last time we
124 * entered dropping state
125 * @lastcount: count at entry to dropping state
126 * @dropping: set to true if in dropping state
127 * @rec_inv_sqrt: reciprocal value of sqrt(count) >> 1
128 * @first_above_time: when we went (or will go) continuously above target
129 * for interval
130 * @drop_next: time to drop next packet, or when we dropped last
131 * @ldelay: sojourn time of last dequeued packet
132 */
133struct codel_vars {
134 u32 count;
135 u32 lastcount;
136 bool dropping;
137 u16 rec_inv_sqrt;
138 codel_time_t first_above_time;
139 codel_time_t drop_next;
140 codel_time_t ldelay;
141};
142
143#define REC_INV_SQRT_BITS (8 * sizeof(u16)) /* or sizeof_in_bits(rec_inv_sqrt) */
144/* needed shift to get a Q0.32 number from rec_inv_sqrt */
145#define REC_INV_SQRT_SHIFT (32 - REC_INV_SQRT_BITS)
146
147/**
148 * struct codel_stats - contains codel shared variables and stats
149 * @maxpacket: largest packet we've seen so far
150 * @drop_count: temp count of dropped packets in dequeue()
151 * ecn_mark: number of packets we ECN marked instead of dropping
152 */
153struct codel_stats {
154 u32 maxpacket;
155 u32 drop_count;
156 u32 ecn_mark;
157};
158
159static void codel_params_init(struct codel_params *params)
160{
161 params->interval = MS2TIME(100);
162 params->target = MS2TIME(5);
163 params->ecn = false;
164}
165
166static void codel_vars_init(struct codel_vars *vars)
167{
168 memset(vars, 0, sizeof(*vars));
169}
170
171static void codel_stats_init(struct codel_stats *stats)
172{
173 stats->maxpacket = 256;
174}
175
176/*
177 * http://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Iterative_methods_for_reciprocal_square_roots
178 * new_invsqrt = (invsqrt / 2) * (3 - count * invsqrt^2)
179 *
180 * Here, invsqrt is a fixed point number (< 1.0), 32bit mantissa, aka Q0.32
181 */
182static void codel_Newton_step(struct codel_vars *vars)
183{
184 u32 invsqrt = ((u32)vars->rec_inv_sqrt) << REC_INV_SQRT_SHIFT;
185 u32 invsqrt2 = ((u64)invsqrt * invsqrt) >> 32;
186 u64 val = (3LL << 32) - ((u64)vars->count * invsqrt2);
187
188 val >>= 2; /* avoid overflow in following multiply */
189 val = (val * invsqrt) >> (32 - 2 + 1);
190
191 vars->rec_inv_sqrt = val >> REC_INV_SQRT_SHIFT;
192}
193
194/*
195 * CoDel control_law is t + interval/sqrt(count)
196 * We maintain in rec_inv_sqrt the reciprocal value of sqrt(count) to avoid
197 * both sqrt() and divide operation.
198 */
199static codel_time_t codel_control_law(codel_time_t t,
200 codel_time_t interval,
201 u32 rec_inv_sqrt)
202{
203 return t + reciprocal_divide(interval, rec_inv_sqrt << REC_INV_SQRT_SHIFT);
204}
205
206
207static bool codel_should_drop(const struct sk_buff *skb,
208 struct Qdisc *sch,
209 struct codel_vars *vars,
210 struct codel_params *params,
211 struct codel_stats *stats,
212 codel_time_t now)
213{
214 bool ok_to_drop;
215
216 if (!skb) {
217 vars->first_above_time = 0;
218 return false;
219 }
220
221 vars->ldelay = now - codel_get_enqueue_time(skb);
222 sch->qstats.backlog -= qdisc_pkt_len(skb);
223
224 if (unlikely(qdisc_pkt_len(skb) > stats->maxpacket))
225 stats->maxpacket = qdisc_pkt_len(skb);
226
227 if (codel_time_before(vars->ldelay, params->target) ||
228 sch->qstats.backlog <= stats->maxpacket) {
229 /* went below - stay below for at least interval */
230 vars->first_above_time = 0;
231 return false;
232 }
233 ok_to_drop = false;
234 if (vars->first_above_time == 0) {
235 /* just went above from below. If we stay above
236 * for at least interval we'll say it's ok to drop
237 */
238 vars->first_above_time = now + params->interval;
239 } else if (codel_time_after(now, vars->first_above_time)) {
240 ok_to_drop = true;
241 }
242 return ok_to_drop;
243}
244
245typedef struct sk_buff * (*codel_skb_dequeue_t)(struct codel_vars *vars,
246 struct Qdisc *sch);
247
248static struct sk_buff *codel_dequeue(struct Qdisc *sch,
249 struct codel_params *params,
250 struct codel_vars *vars,
251 struct codel_stats *stats,
252 codel_skb_dequeue_t dequeue_func)
253{
254 struct sk_buff *skb = dequeue_func(vars, sch);
255 codel_time_t now;
256 bool drop;
257
258 if (!skb) {
259 vars->dropping = false;
260 return skb;
261 }
262 now = codel_get_time();
263 drop = codel_should_drop(skb, sch, vars, params, stats, now);
264 if (vars->dropping) {
265 if (!drop) {
266 /* sojourn time below target - leave dropping state */
267 vars->dropping = false;
268 } else if (codel_time_after_eq(now, vars->drop_next)) {
269 /* It's time for the next drop. Drop the current
270 * packet and dequeue the next. The dequeue might
271 * take us out of dropping state.
272 * If not, schedule the next drop.
273 * A large backlog might result in drop rates so high
274 * that the next drop should happen now,
275 * hence the while loop.
276 */
277 while (vars->dropping &&
278 codel_time_after_eq(now, vars->drop_next)) {
279 vars->count++; /* dont care of possible wrap
280 * since there is no more divide
281 */
282 codel_Newton_step(vars);
283 if (params->ecn && INET_ECN_set_ce(skb)) {
284 stats->ecn_mark++;
285 vars->drop_next =
286 codel_control_law(vars->drop_next,
287 params->interval,
288 vars->rec_inv_sqrt);
289 goto end;
290 }
291 qdisc_drop(skb, sch);
292 stats->drop_count++;
293 skb = dequeue_func(vars, sch);
294 if (!codel_should_drop(skb, sch,
295 vars, params, stats, now)) {
296 /* leave dropping state */
297 vars->dropping = false;
298 } else {
299 /* and schedule the next drop */
300 vars->drop_next =
301 codel_control_law(vars->drop_next,
302 params->interval,
303 vars->rec_inv_sqrt);
304 }
305 }
306 }
307 } else if (drop) {
308 if (params->ecn && INET_ECN_set_ce(skb)) {
309 stats->ecn_mark++;
310 } else {
311 qdisc_drop(skb, sch);
312 stats->drop_count++;
313
314 skb = dequeue_func(vars, sch);
315 drop = codel_should_drop(skb, sch, vars, params,
316 stats, now);
317 }
318 vars->dropping = true;
319 /* if min went above target close to when we last went below it
320 * assume that the drop rate that controlled the queue on the
321 * last cycle is a good starting point to control it now.
322 */
323 if (codel_time_before(now - vars->drop_next,
324 16 * params->interval)) {
325 vars->count = (vars->count - vars->lastcount) | 1;
326 /* we dont care if rec_inv_sqrt approximation
327 * is not very precise :
328 * Next Newton steps will correct it quadratically.
329 */
330 codel_Newton_step(vars);
331 } else {
332 vars->count = 1;
333 vars->rec_inv_sqrt = ~0U >> REC_INV_SQRT_SHIFT;
334 }
335 vars->lastcount = vars->count;
336 vars->drop_next = codel_control_law(now, params->interval,
337 vars->rec_inv_sqrt);
338 }
339end:
340 return skb;
341}
342#endif
diff --git a/include/net/compat.h b/include/net/compat.h
index a974ae92d182..6e9565324989 100644
--- a/include/net/compat.h
+++ b/include/net/compat.h
@@ -42,12 +42,12 @@ extern int compat_sock_get_timestampns(struct sock *, struct timespec __user *);
42 42
43extern int get_compat_msghdr(struct msghdr *, struct compat_msghdr __user *); 43extern int get_compat_msghdr(struct msghdr *, struct compat_msghdr __user *);
44extern int verify_compat_iovec(struct msghdr *, struct iovec *, struct sockaddr_storage *, int); 44extern int verify_compat_iovec(struct msghdr *, struct iovec *, struct sockaddr_storage *, int);
45extern asmlinkage long compat_sys_sendmsg(int,struct compat_msghdr __user *,unsigned); 45extern asmlinkage long compat_sys_sendmsg(int,struct compat_msghdr __user *,unsigned int);
46extern asmlinkage long compat_sys_sendmmsg(int, struct compat_mmsghdr __user *, 46extern asmlinkage long compat_sys_sendmmsg(int, struct compat_mmsghdr __user *,
47 unsigned, unsigned); 47 unsigned int, unsigned int);
48extern asmlinkage long compat_sys_recvmsg(int,struct compat_msghdr __user *,unsigned); 48extern asmlinkage long compat_sys_recvmsg(int,struct compat_msghdr __user *,unsigned int);
49extern asmlinkage long compat_sys_recvmmsg(int, struct compat_mmsghdr __user *, 49extern asmlinkage long compat_sys_recvmmsg(int, struct compat_mmsghdr __user *,
50 unsigned, unsigned, 50 unsigned int, unsigned int,
51 struct compat_timespec __user *); 51 struct compat_timespec __user *);
52extern asmlinkage long compat_sys_getsockopt(int, int, int, char __user *, int __user *); 52extern asmlinkage long compat_sys_getsockopt(int, int, int, char __user *, int __user *);
53extern int put_cmsg_compat(struct msghdr*, int, int, int, void *); 53extern int put_cmsg_compat(struct msghdr*, int, int, int, void *);
diff --git a/include/net/dcbnl.h b/include/net/dcbnl.h
index f55c980d8e23..fc5d5dcebb00 100644
--- a/include/net/dcbnl.h
+++ b/include/net/dcbnl.h
@@ -48,6 +48,8 @@ struct dcbnl_rtnl_ops {
48 /* IEEE 802.1Qaz std */ 48 /* IEEE 802.1Qaz std */
49 int (*ieee_getets) (struct net_device *, struct ieee_ets *); 49 int (*ieee_getets) (struct net_device *, struct ieee_ets *);
50 int (*ieee_setets) (struct net_device *, struct ieee_ets *); 50 int (*ieee_setets) (struct net_device *, struct ieee_ets *);
51 int (*ieee_getmaxrate) (struct net_device *, struct ieee_maxrate *);
52 int (*ieee_setmaxrate) (struct net_device *, struct ieee_maxrate *);
51 int (*ieee_getpfc) (struct net_device *, struct ieee_pfc *); 53 int (*ieee_getpfc) (struct net_device *, struct ieee_pfc *);
52 int (*ieee_setpfc) (struct net_device *, struct ieee_pfc *); 54 int (*ieee_setpfc) (struct net_device *, struct ieee_pfc *);
53 int (*ieee_getapp) (struct net_device *, struct dcb_app *); 55 int (*ieee_getapp) (struct net_device *, struct dcb_app *);
diff --git a/include/net/dn.h b/include/net/dn.h
index 814af0b9387d..c88bf4ebd330 100644
--- a/include/net/dn.h
+++ b/include/net/dn.h
@@ -199,7 +199,7 @@ static inline void dn_sk_ports_copy(struct flowidn *fld, struct dn_scp *scp)
199 fld->fld_dport = scp->addrrem; 199 fld->fld_dport = scp->addrrem;
200} 200}
201 201
202extern unsigned dn_mss_from_pmtu(struct net_device *dev, int mtu); 202extern unsigned int dn_mss_from_pmtu(struct net_device *dev, int mtu);
203 203
204#define DN_MENUVER_ACC 0x01 204#define DN_MENUVER_ACC 0x01
205#define DN_MENUVER_USR 0x02 205#define DN_MENUVER_USR 0x02
diff --git a/include/net/dn_fib.h b/include/net/dn_fib.h
index 782ef7cb4930..1ee9d4bda30d 100644
--- a/include/net/dn_fib.h
+++ b/include/net/dn_fib.h
@@ -31,7 +31,7 @@ struct dn_fib_res {
31 31
32struct dn_fib_nh { 32struct dn_fib_nh {
33 struct net_device *nh_dev; 33 struct net_device *nh_dev;
34 unsigned nh_flags; 34 unsigned int nh_flags;
35 unsigned char nh_scope; 35 unsigned char nh_scope;
36 int nh_weight; 36 int nh_weight;
37 int nh_power; 37 int nh_power;
@@ -45,7 +45,7 @@ struct dn_fib_info {
45 int fib_treeref; 45 int fib_treeref;
46 atomic_t fib_clntref; 46 atomic_t fib_clntref;
47 int fib_dead; 47 int fib_dead;
48 unsigned fib_flags; 48 unsigned int fib_flags;
49 int fib_protocol; 49 int fib_protocol;
50 __le16 fib_prefsrc; 50 __le16 fib_prefsrc;
51 __u32 fib_priority; 51 __u32 fib_priority;
@@ -140,7 +140,7 @@ extern void dn_fib_table_cleanup(void);
140 */ 140 */
141extern void dn_fib_rules_init(void); 141extern void dn_fib_rules_init(void);
142extern void dn_fib_rules_cleanup(void); 142extern void dn_fib_rules_cleanup(void);
143extern unsigned dnet_addr_type(__le16 addr); 143extern unsigned int dnet_addr_type(__le16 addr);
144extern int dn_fib_lookup(struct flowidn *fld, struct dn_fib_res *res); 144extern int dn_fib_lookup(struct flowidn *fld, struct dn_fib_res *res);
145 145
146extern int dn_fib_dump(struct sk_buff *skb, struct netlink_callback *cb); 146extern int dn_fib_dump(struct sk_buff *skb, struct netlink_callback *cb);
diff --git a/include/net/dn_route.h b/include/net/dn_route.h
index 81712cfa1ddf..c507e05d172f 100644
--- a/include/net/dn_route.h
+++ b/include/net/dn_route.h
@@ -76,8 +76,8 @@ struct dn_route {
76 __le16 rt_src_map; 76 __le16 rt_src_map;
77 __le16 rt_dst_map; 77 __le16 rt_dst_map;
78 78
79 unsigned rt_flags; 79 unsigned int rt_flags;
80 unsigned rt_type; 80 unsigned int rt_type;
81}; 81};
82 82
83static inline bool dn_is_input_route(struct dn_route *rt) 83static inline bool dn_is_input_route(struct dn_route *rt)
diff --git a/include/net/dst.h b/include/net/dst.h
index ff4da42fcfc6..bed833d9796a 100644
--- a/include/net/dst.h
+++ b/include/net/dst.h
@@ -59,6 +59,7 @@ struct dst_entry {
59#define DST_NOCACHE 0x0010 59#define DST_NOCACHE 0x0010
60#define DST_NOCOUNT 0x0020 60#define DST_NOCOUNT 0x0020
61#define DST_NOPEER 0x0040 61#define DST_NOPEER 0x0040
62#define DST_FAKE_RTABLE 0x0080
62 63
63 short error; 64 short error;
64 short obsolete; 65 short obsolete;
diff --git a/include/net/dst_ops.h b/include/net/dst_ops.h
index e1c2ee0eef47..3682a0a076c1 100644
--- a/include/net/dst_ops.h
+++ b/include/net/dst_ops.h
@@ -12,7 +12,7 @@ struct sk_buff;
12struct dst_ops { 12struct dst_ops {
13 unsigned short family; 13 unsigned short family;
14 __be16 protocol; 14 __be16 protocol;
15 unsigned gc_thresh; 15 unsigned int gc_thresh;
16 16
17 int (*gc)(struct dst_ops *ops); 17 int (*gc)(struct dst_ops *ops);
18 struct dst_entry * (*check)(struct dst_entry *, __u32 cookie); 18 struct dst_entry * (*check)(struct dst_entry *, __u32 cookie);
diff --git a/include/net/icmp.h b/include/net/icmp.h
index 75d615649071..9ac2524d1402 100644
--- a/include/net/icmp.h
+++ b/include/net/icmp.h
@@ -25,7 +25,7 @@
25 25
26struct icmp_err { 26struct icmp_err {
27 int errno; 27 int errno;
28 unsigned fatal:1; 28 unsigned int fatal:1;
29}; 29};
30 30
31extern const struct icmp_err icmp_err_convert[]; 31extern const struct icmp_err icmp_err_convert[];
@@ -41,7 +41,6 @@ struct net;
41 41
42extern void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info); 42extern void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info);
43extern int icmp_rcv(struct sk_buff *skb); 43extern int icmp_rcv(struct sk_buff *skb);
44extern int icmp_ioctl(struct sock *sk, int cmd, unsigned long arg);
45extern int icmp_init(void); 44extern int icmp_init(void);
46extern void icmp_out_count(struct net *net, unsigned char type); 45extern void icmp_out_count(struct net *net, unsigned char type);
47 46
diff --git a/include/net/ieee802154_netdev.h b/include/net/ieee802154_netdev.h
index 57430555487a..d104c882fc29 100644
--- a/include/net/ieee802154_netdev.h
+++ b/include/net/ieee802154_netdev.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * An interface between IEEE802.15.4 device and rest of the kernel. 2 * An interface between IEEE802.15.4 device and rest of the kernel.
3 * 3 *
4 * Copyright (C) 2007, 2008, 2009 Siemens AG 4 * Copyright (C) 2007-2012 Siemens AG
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 7 * it under the terms of the GNU General Public License version 2
@@ -21,11 +21,14 @@
21 * Maxim Gorbachyov <maxim.gorbachev@siemens.com> 21 * Maxim Gorbachyov <maxim.gorbachev@siemens.com>
22 * Maxim Osipov <maxim.osipov@siemens.com> 22 * Maxim Osipov <maxim.osipov@siemens.com>
23 * Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> 23 * Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
24 * Alexander Smirnov <alex.bluesman.smirnov@gmail.com>
24 */ 25 */
25 26
26#ifndef IEEE802154_NETDEVICE_H 27#ifndef IEEE802154_NETDEVICE_H
27#define IEEE802154_NETDEVICE_H 28#define IEEE802154_NETDEVICE_H
28 29
30#include <net/af_ieee802154.h>
31
29/* 32/*
30 * A control block of skb passed between the ARPHRD_IEEE802154 device 33 * A control block of skb passed between the ARPHRD_IEEE802154 device
31 * and other stack parts. 34 * and other stack parts.
@@ -110,12 +113,26 @@ struct ieee802154_mlme_ops {
110 u8 (*get_bsn)(const struct net_device *dev); 113 u8 (*get_bsn)(const struct net_device *dev);
111}; 114};
112 115
113static inline struct ieee802154_mlme_ops *ieee802154_mlme_ops( 116/* The IEEE 802.15.4 standard defines 2 type of the devices:
114 const struct net_device *dev) 117 * - FFD - full functionality device
118 * - RFD - reduce functionality device
119 *
120 * So 2 sets of mlme operations are needed
121 */
122struct ieee802154_reduced_mlme_ops {
123 struct wpan_phy *(*get_phy)(const struct net_device *dev);
124};
125
126static inline struct ieee802154_mlme_ops *
127ieee802154_mlme_ops(const struct net_device *dev)
115{ 128{
116 return dev->ml_priv; 129 return dev->ml_priv;
117} 130}
118 131
119#endif 132static inline struct ieee802154_reduced_mlme_ops *
120 133ieee802154_reduced_mlme_ops(const struct net_device *dev)
134{
135 return dev->ml_priv;
136}
121 137
138#endif
diff --git a/include/net/if_inet6.h b/include/net/if_inet6.h
index 51a7031b4aa3..93563221d29a 100644
--- a/include/net/if_inet6.h
+++ b/include/net/if_inet6.h
@@ -120,7 +120,7 @@ struct ifmcaddr6 {
120 unsigned char mca_crcount; 120 unsigned char mca_crcount;
121 unsigned long mca_sfcount[2]; 121 unsigned long mca_sfcount[2];
122 struct timer_list mca_timer; 122 struct timer_list mca_timer;
123 unsigned mca_flags; 123 unsigned int mca_flags;
124 int mca_users; 124 int mca_users;
125 atomic_t mca_refcnt; 125 atomic_t mca_refcnt;
126 spinlock_t mca_lock; 126 spinlock_t mca_lock;
@@ -209,60 +209,6 @@ static inline void ipv6_eth_mc_map(const struct in6_addr *addr, char *buf)
209 memcpy(buf + 2, &addr->s6_addr32[3], sizeof(__u32)); 209 memcpy(buf + 2, &addr->s6_addr32[3], sizeof(__u32));
210} 210}
211 211
212static inline void ipv6_tr_mc_map(const struct in6_addr *addr, char *buf)
213{
214 /* All nodes FF01::1, FF02::1, FF02::1:FFxx:xxxx */
215
216 if (((addr->s6_addr[0] == 0xFF) &&
217 ((addr->s6_addr[1] == 0x01) || (addr->s6_addr[1] == 0x02)) &&
218 (addr->s6_addr16[1] == 0) &&
219 (addr->s6_addr32[1] == 0) &&
220 (addr->s6_addr32[2] == 0) &&
221 (addr->s6_addr16[6] == 0) &&
222 (addr->s6_addr[15] == 1)) ||
223 ((addr->s6_addr[0] == 0xFF) &&
224 (addr->s6_addr[1] == 0x02) &&
225 (addr->s6_addr16[1] == 0) &&
226 (addr->s6_addr32[1] == 0) &&
227 (addr->s6_addr16[4] == 0) &&
228 (addr->s6_addr[10] == 0) &&
229 (addr->s6_addr[11] == 1) &&
230 (addr->s6_addr[12] == 0xff)))
231 {
232 buf[0]=0xC0;
233 buf[1]=0x00;
234 buf[2]=0x01;
235 buf[3]=0x00;
236 buf[4]=0x00;
237 buf[5]=0x00;
238 /* All routers FF0x::2 */
239 } else if ((addr->s6_addr[0] ==0xff) &&
240 ((addr->s6_addr[1] & 0xF0) == 0) &&
241 (addr->s6_addr16[1] == 0) &&
242 (addr->s6_addr32[1] == 0) &&
243 (addr->s6_addr32[2] == 0) &&
244 (addr->s6_addr16[6] == 0) &&
245 (addr->s6_addr[15] == 2))
246 {
247 buf[0]=0xC0;
248 buf[1]=0x00;
249 buf[2]=0x02;
250 buf[3]=0x00;
251 buf[4]=0x00;
252 buf[5]=0x00;
253 } else {
254 unsigned char i ;
255
256 i = addr->s6_addr[15] & 7 ;
257 buf[0]=0xC0;
258 buf[1]=0x00;
259 buf[2]=0x00;
260 buf[3]=0x01 << i ;
261 buf[4]=0x00;
262 buf[5]=0x00;
263 }
264}
265
266static inline void ipv6_arcnet_mc_map(const struct in6_addr *addr, char *buf) 212static inline void ipv6_arcnet_mc_map(const struct in6_addr *addr, char *buf)
267{ 213{
268 buf[0] = 0x00; 214 buf[0] = 0x00;
diff --git a/include/net/inet6_connection_sock.h b/include/net/inet6_connection_sock.h
index 3207e58ee019..1866a676c810 100644
--- a/include/net/inet6_connection_sock.h
+++ b/include/net/inet6_connection_sock.h
@@ -23,7 +23,7 @@ struct sock;
23struct sockaddr; 23struct sockaddr;
24 24
25extern int inet6_csk_bind_conflict(const struct sock *sk, 25extern int inet6_csk_bind_conflict(const struct sock *sk,
26 const struct inet_bind_bucket *tb); 26 const struct inet_bind_bucket *tb, bool relax);
27 27
28extern struct dst_entry* inet6_csk_route_req(struct sock *sk, 28extern struct dst_entry* inet6_csk_route_req(struct sock *sk,
29 const struct request_sock *req); 29 const struct request_sock *req);
diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h
index dbf9aab34c82..7d83f90f203f 100644
--- a/include/net/inet_connection_sock.h
+++ b/include/net/inet_connection_sock.h
@@ -45,6 +45,7 @@ struct inet_connection_sock_af_ops {
45 struct dst_entry *dst); 45 struct dst_entry *dst);
46 struct inet_peer *(*get_peer)(struct sock *sk, bool *release_it); 46 struct inet_peer *(*get_peer)(struct sock *sk, bool *release_it);
47 u16 net_header_len; 47 u16 net_header_len;
48 u16 net_frag_header_len;
48 u16 sockaddr_len; 49 u16 sockaddr_len;
49 int (*setsockopt)(struct sock *sk, int level, int optname, 50 int (*setsockopt)(struct sock *sk, int level, int optname,
50 char __user *optval, unsigned int optlen); 51 char __user *optval, unsigned int optlen);
@@ -60,7 +61,7 @@ struct inet_connection_sock_af_ops {
60#endif 61#endif
61 void (*addr2sockaddr)(struct sock *sk, struct sockaddr *); 62 void (*addr2sockaddr)(struct sock *sk, struct sockaddr *);
62 int (*bind_conflict)(const struct sock *sk, 63 int (*bind_conflict)(const struct sock *sk,
63 const struct inet_bind_bucket *tb); 64 const struct inet_bind_bucket *tb, bool relax);
64}; 65};
65 66
66/** inet_connection_sock - INET connection oriented sock 67/** inet_connection_sock - INET connection oriented sock
@@ -245,7 +246,7 @@ extern struct request_sock *inet_csk_search_req(const struct sock *sk,
245 const __be32 raddr, 246 const __be32 raddr,
246 const __be32 laddr); 247 const __be32 laddr);
247extern int inet_csk_bind_conflict(const struct sock *sk, 248extern int inet_csk_bind_conflict(const struct sock *sk,
248 const struct inet_bind_bucket *tb); 249 const struct inet_bind_bucket *tb, bool relax);
249extern int inet_csk_get_port(struct sock *sk, unsigned short snum); 250extern int inet_csk_get_port(struct sock *sk, unsigned short snum);
250 251
251extern struct dst_entry* inet_csk_route_req(struct sock *sk, 252extern struct dst_entry* inet_csk_route_req(struct sock *sk,
diff --git a/include/net/inet_frag.h b/include/net/inet_frag.h
index 16ff29a7bb30..2431cf83aeca 100644
--- a/include/net/inet_frag.h
+++ b/include/net/inet_frag.h
@@ -46,8 +46,7 @@ struct inet_frags {
46 void *arg); 46 void *arg);
47 void (*destructor)(struct inet_frag_queue *); 47 void (*destructor)(struct inet_frag_queue *);
48 void (*skb_free)(struct sk_buff *); 48 void (*skb_free)(struct sk_buff *);
49 int (*match)(struct inet_frag_queue *q, 49 bool (*match)(struct inet_frag_queue *q, void *arg);
50 void *arg);
51 void (*frag_expire)(unsigned long data); 50 void (*frag_expire)(unsigned long data);
52}; 51};
53 52
diff --git a/include/net/ip.h b/include/net/ip.h
index b53d65f24f7b..83e0619f59d0 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -141,23 +141,6 @@ static inline struct sk_buff *ip_finish_skb(struct sock *sk, struct flowi4 *fl4)
141extern int ip4_datagram_connect(struct sock *sk, 141extern int ip4_datagram_connect(struct sock *sk,
142 struct sockaddr *uaddr, int addr_len); 142 struct sockaddr *uaddr, int addr_len);
143 143
144/*
145 * Map a multicast IP onto multicast MAC for type Token Ring.
146 * This conforms to RFC1469 Option 2 Multicasting i.e.
147 * using a functional address to transmit / receive
148 * multicast packets.
149 */
150
151static inline void ip_tr_mc_map(__be32 addr, char *buf)
152{
153 buf[0]=0xC0;
154 buf[1]=0x00;
155 buf[2]=0x00;
156 buf[3]=0x04;
157 buf[4]=0x00;
158 buf[5]=0x00;
159}
160
161struct ip_reply_arg { 144struct ip_reply_arg {
162 struct kvec iov[1]; 145 struct kvec iov[1];
163 int flags; 146 int flags;
@@ -222,9 +205,6 @@ static inline int inet_is_reserved_local_port(int port)
222 205
223extern int sysctl_ip_nonlocal_bind; 206extern int sysctl_ip_nonlocal_bind;
224 207
225extern struct ctl_path net_core_path[];
226extern struct ctl_path net_ipv4_ctl_path[];
227
228/* From inetpeer.c */ 208/* From inetpeer.c */
229extern int inet_peer_threshold; 209extern int inet_peer_threshold;
230extern int inet_peer_minttl; 210extern int inet_peer_minttl;
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
index 2ad92ca4e6f3..37c1a1ed82c1 100644
--- a/include/net/ip6_route.h
+++ b/include/net/ip6_route.h
@@ -146,7 +146,7 @@ struct rt6_rtnl_dump_arg {
146 146
147extern int rt6_dump_route(struct rt6_info *rt, void *p_arg); 147extern int rt6_dump_route(struct rt6_info *rt, void *p_arg);
148extern void rt6_ifdown(struct net *net, struct net_device *dev); 148extern void rt6_ifdown(struct net *net, struct net_device *dev);
149extern void rt6_mtu_change(struct net_device *dev, unsigned mtu); 149extern void rt6_mtu_change(struct net_device *dev, unsigned int mtu);
150extern void rt6_remove_prefsrc(struct inet6_ifaddr *ifp); 150extern void rt6_remove_prefsrc(struct inet6_ifaddr *ifp);
151 151
152 152
@@ -175,7 +175,7 @@ static inline void ip6_dst_store(struct sock *sk, struct dst_entry *dst,
175 spin_unlock(&sk->sk_dst_lock); 175 spin_unlock(&sk->sk_dst_lock);
176} 176}
177 177
178static inline int ipv6_unicast_destination(struct sk_buff *skb) 178static inline bool ipv6_unicast_destination(const struct sk_buff *skb)
179{ 179{
180 struct rt6_info *rt = (struct rt6_info *) skb_dst(skb); 180 struct rt6_info *rt = (struct rt6_info *) skb_dst(skb);
181 181
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
index 10422ef14e28..78df0866cc38 100644
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -49,7 +49,7 @@ struct fib_nh {
49 struct net_device *nh_dev; 49 struct net_device *nh_dev;
50 struct hlist_node nh_hash; 50 struct hlist_node nh_hash;
51 struct fib_info *nh_parent; 51 struct fib_info *nh_parent;
52 unsigned nh_flags; 52 unsigned int nh_flags;
53 unsigned char nh_scope; 53 unsigned char nh_scope;
54#ifdef CONFIG_IP_ROUTE_MULTIPATH 54#ifdef CONFIG_IP_ROUTE_MULTIPATH
55 int nh_weight; 55 int nh_weight;
@@ -74,7 +74,7 @@ struct fib_info {
74 struct net *fib_net; 74 struct net *fib_net;
75 int fib_treeref; 75 int fib_treeref;
76 atomic_t fib_clntref; 76 atomic_t fib_clntref;
77 unsigned fib_flags; 77 unsigned int fib_flags;
78 unsigned char fib_dead; 78 unsigned char fib_dead;
79 unsigned char fib_protocol; 79 unsigned char fib_protocol;
80 unsigned char fib_scope; 80 unsigned char fib_scope;
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index 2bdee51ba30d..d6146b4811c2 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -10,7 +10,6 @@
10 10
11#include <asm/types.h> /* for __uXX types */ 11#include <asm/types.h> /* for __uXX types */
12 12
13#include <linux/sysctl.h> /* for ctl_path */
14#include <linux/list.h> /* for struct list_head */ 13#include <linux/list.h> /* for struct list_head */
15#include <linux/spinlock.h> /* for struct rwlock_t */ 14#include <linux/spinlock.h> /* for struct rwlock_t */
16#include <linux/atomic.h> /* for struct atomic_t */ 15#include <linux/atomic.h> /* for struct atomic_t */
@@ -393,7 +392,7 @@ struct ip_vs_protocol {
393 392
394 void (*exit)(struct ip_vs_protocol *pp); 393 void (*exit)(struct ip_vs_protocol *pp);
395 394
396 void (*init_netns)(struct net *net, struct ip_vs_proto_data *pd); 395 int (*init_netns)(struct net *net, struct ip_vs_proto_data *pd);
397 396
398 void (*exit_netns)(struct net *net, struct ip_vs_proto_data *pd); 397 void (*exit_netns)(struct net *net, struct ip_vs_proto_data *pd);
399 398
@@ -505,6 +504,7 @@ struct ip_vs_conn {
505 * state transition triggerd 504 * state transition triggerd
506 * synchronization 505 * synchronization
507 */ 506 */
507 unsigned long sync_endtime; /* jiffies + sent_retries */
508 508
509 /* Control members */ 509 /* Control members */
510 struct ip_vs_conn *control; /* Master control connection */ 510 struct ip_vs_conn *control; /* Master control connection */
@@ -580,8 +580,8 @@ struct ip_vs_service_user_kern {
580 /* virtual service options */ 580 /* virtual service options */
581 char *sched_name; 581 char *sched_name;
582 char *pe_name; 582 char *pe_name;
583 unsigned flags; /* virtual service flags */ 583 unsigned int flags; /* virtual service flags */
584 unsigned timeout; /* persistent timeout in sec */ 584 unsigned int timeout; /* persistent timeout in sec */
585 u32 netmask; /* persistent netmask */ 585 u32 netmask; /* persistent netmask */
586}; 586};
587 587
@@ -592,7 +592,7 @@ struct ip_vs_dest_user_kern {
592 u16 port; 592 u16 port;
593 593
594 /* real server options */ 594 /* real server options */
595 unsigned conn_flags; /* connection flags */ 595 unsigned int conn_flags; /* connection flags */
596 int weight; /* destination weight */ 596 int weight; /* destination weight */
597 597
598 /* thresholds for active connections */ 598 /* thresholds for active connections */
@@ -616,8 +616,8 @@ struct ip_vs_service {
616 union nf_inet_addr addr; /* IP address for virtual service */ 616 union nf_inet_addr addr; /* IP address for virtual service */
617 __be16 port; /* port number for the service */ 617 __be16 port; /* port number for the service */
618 __u32 fwmark; /* firewall mark of the service */ 618 __u32 fwmark; /* firewall mark of the service */
619 unsigned flags; /* service status flags */ 619 unsigned int flags; /* service status flags */
620 unsigned timeout; /* persistent timeout in ticks */ 620 unsigned int timeout; /* persistent timeout in ticks */
621 __be32 netmask; /* grouping granularity */ 621 __be32 netmask; /* grouping granularity */
622 struct net *net; 622 struct net *net;
623 623
@@ -647,7 +647,7 @@ struct ip_vs_dest {
647 u16 af; /* address family */ 647 u16 af; /* address family */
648 __be16 port; /* port number of the server */ 648 __be16 port; /* port number of the server */
649 union nf_inet_addr addr; /* IP address of the server */ 649 union nf_inet_addr addr; /* IP address of the server */
650 volatile unsigned flags; /* dest status flags */ 650 volatile unsigned int flags; /* dest status flags */
651 atomic_t conn_flags; /* flags to copy to conn */ 651 atomic_t conn_flags; /* flags to copy to conn */
652 atomic_t weight; /* server weight */ 652 atomic_t weight; /* server weight */
653 653
@@ -784,6 +784,16 @@ struct ip_vs_app {
784 void (*timeout_change)(struct ip_vs_app *app, int flags); 784 void (*timeout_change)(struct ip_vs_app *app, int flags);
785}; 785};
786 786
787struct ipvs_master_sync_state {
788 struct list_head sync_queue;
789 struct ip_vs_sync_buff *sync_buff;
790 int sync_queue_len;
791 unsigned int sync_queue_delay;
792 struct task_struct *master_thread;
793 struct delayed_work master_wakeup_work;
794 struct netns_ipvs *ipvs;
795};
796
787/* IPVS in network namespace */ 797/* IPVS in network namespace */
788struct netns_ipvs { 798struct netns_ipvs {
789 int gen; /* Generation */ 799 int gen; /* Generation */
@@ -870,10 +880,15 @@ struct netns_ipvs {
870#endif 880#endif
871 int sysctl_snat_reroute; 881 int sysctl_snat_reroute;
872 int sysctl_sync_ver; 882 int sysctl_sync_ver;
883 int sysctl_sync_ports;
884 int sysctl_sync_qlen_max;
885 int sysctl_sync_sock_size;
873 int sysctl_cache_bypass; 886 int sysctl_cache_bypass;
874 int sysctl_expire_nodest_conn; 887 int sysctl_expire_nodest_conn;
875 int sysctl_expire_quiescent_template; 888 int sysctl_expire_quiescent_template;
876 int sysctl_sync_threshold[2]; 889 int sysctl_sync_threshold[2];
890 unsigned int sysctl_sync_refresh_period;
891 int sysctl_sync_retries;
877 int sysctl_nat_icmp_send; 892 int sysctl_nat_icmp_send;
878 893
879 /* ip_vs_lblc */ 894 /* ip_vs_lblc */
@@ -889,13 +904,11 @@ struct netns_ipvs {
889 spinlock_t est_lock; 904 spinlock_t est_lock;
890 struct timer_list est_timer; /* Estimation timer */ 905 struct timer_list est_timer; /* Estimation timer */
891 /* ip_vs_sync */ 906 /* ip_vs_sync */
892 struct list_head sync_queue;
893 spinlock_t sync_lock; 907 spinlock_t sync_lock;
894 struct ip_vs_sync_buff *sync_buff; 908 struct ipvs_master_sync_state *ms;
895 spinlock_t sync_buff_lock; 909 spinlock_t sync_buff_lock;
896 struct sockaddr_in sync_mcast_addr; 910 struct task_struct **backup_threads;
897 struct task_struct *master_thread; 911 int threads_mask;
898 struct task_struct *backup_thread;
899 int send_mesg_maxlen; 912 int send_mesg_maxlen;
900 int recv_mesg_maxlen; 913 int recv_mesg_maxlen;
901 volatile int sync_state; 914 volatile int sync_state;
@@ -912,6 +925,14 @@ struct netns_ipvs {
912#define DEFAULT_SYNC_THRESHOLD 3 925#define DEFAULT_SYNC_THRESHOLD 3
913#define DEFAULT_SYNC_PERIOD 50 926#define DEFAULT_SYNC_PERIOD 50
914#define DEFAULT_SYNC_VER 1 927#define DEFAULT_SYNC_VER 1
928#define DEFAULT_SYNC_REFRESH_PERIOD (0U * HZ)
929#define DEFAULT_SYNC_RETRIES 0
930#define IPVS_SYNC_WAKEUP_RATE 8
931#define IPVS_SYNC_QLEN_MAX (IPVS_SYNC_WAKEUP_RATE * 4)
932#define IPVS_SYNC_SEND_DELAY (HZ / 50)
933#define IPVS_SYNC_CHECK_PERIOD HZ
934#define IPVS_SYNC_FLUSH_TIME (HZ * 2)
935#define IPVS_SYNC_PORTS_MAX (1 << 6)
915 936
916#ifdef CONFIG_SYSCTL 937#ifdef CONFIG_SYSCTL
917 938
@@ -922,7 +943,17 @@ static inline int sysctl_sync_threshold(struct netns_ipvs *ipvs)
922 943
923static inline int sysctl_sync_period(struct netns_ipvs *ipvs) 944static inline int sysctl_sync_period(struct netns_ipvs *ipvs)
924{ 945{
925 return ipvs->sysctl_sync_threshold[1]; 946 return ACCESS_ONCE(ipvs->sysctl_sync_threshold[1]);
947}
948
949static inline unsigned int sysctl_sync_refresh_period(struct netns_ipvs *ipvs)
950{
951 return ACCESS_ONCE(ipvs->sysctl_sync_refresh_period);
952}
953
954static inline int sysctl_sync_retries(struct netns_ipvs *ipvs)
955{
956 return ipvs->sysctl_sync_retries;
926} 957}
927 958
928static inline int sysctl_sync_ver(struct netns_ipvs *ipvs) 959static inline int sysctl_sync_ver(struct netns_ipvs *ipvs)
@@ -930,6 +961,21 @@ static inline int sysctl_sync_ver(struct netns_ipvs *ipvs)
930 return ipvs->sysctl_sync_ver; 961 return ipvs->sysctl_sync_ver;
931} 962}
932 963
964static inline int sysctl_sync_ports(struct netns_ipvs *ipvs)
965{
966 return ACCESS_ONCE(ipvs->sysctl_sync_ports);
967}
968
969static inline int sysctl_sync_qlen_max(struct netns_ipvs *ipvs)
970{
971 return ipvs->sysctl_sync_qlen_max;
972}
973
974static inline int sysctl_sync_sock_size(struct netns_ipvs *ipvs)
975{
976 return ipvs->sysctl_sync_sock_size;
977}
978
933#else 979#else
934 980
935static inline int sysctl_sync_threshold(struct netns_ipvs *ipvs) 981static inline int sysctl_sync_threshold(struct netns_ipvs *ipvs)
@@ -942,18 +988,43 @@ static inline int sysctl_sync_period(struct netns_ipvs *ipvs)
942 return DEFAULT_SYNC_PERIOD; 988 return DEFAULT_SYNC_PERIOD;
943} 989}
944 990
991static inline unsigned int sysctl_sync_refresh_period(struct netns_ipvs *ipvs)
992{
993 return DEFAULT_SYNC_REFRESH_PERIOD;
994}
995
996static inline int sysctl_sync_retries(struct netns_ipvs *ipvs)
997{
998 return DEFAULT_SYNC_RETRIES & 3;
999}
1000
945static inline int sysctl_sync_ver(struct netns_ipvs *ipvs) 1001static inline int sysctl_sync_ver(struct netns_ipvs *ipvs)
946{ 1002{
947 return DEFAULT_SYNC_VER; 1003 return DEFAULT_SYNC_VER;
948} 1004}
949 1005
1006static inline int sysctl_sync_ports(struct netns_ipvs *ipvs)
1007{
1008 return 1;
1009}
1010
1011static inline int sysctl_sync_qlen_max(struct netns_ipvs *ipvs)
1012{
1013 return IPVS_SYNC_QLEN_MAX;
1014}
1015
1016static inline int sysctl_sync_sock_size(struct netns_ipvs *ipvs)
1017{
1018 return 0;
1019}
1020
950#endif 1021#endif
951 1022
952/* 1023/*
953 * IPVS core functions 1024 * IPVS core functions
954 * (from ip_vs_core.c) 1025 * (from ip_vs_core.c)
955 */ 1026 */
956extern const char *ip_vs_proto_name(unsigned proto); 1027extern const char *ip_vs_proto_name(unsigned int proto);
957extern void ip_vs_init_hash_table(struct list_head *table, int rows); 1028extern void ip_vs_init_hash_table(struct list_head *table, int rows);
958#define IP_VS_INIT_HASH_TABLE(t) ip_vs_init_hash_table((t), ARRAY_SIZE((t))) 1029#define IP_VS_INIT_HASH_TABLE(t) ip_vs_init_hash_table((t), ARRAY_SIZE((t)))
959 1030
@@ -1014,7 +1085,7 @@ extern void ip_vs_conn_fill_cport(struct ip_vs_conn *cp, __be16 cport);
1014 1085
1015struct ip_vs_conn *ip_vs_conn_new(const struct ip_vs_conn_param *p, 1086struct ip_vs_conn *ip_vs_conn_new(const struct ip_vs_conn_param *p,
1016 const union nf_inet_addr *daddr, 1087 const union nf_inet_addr *daddr,
1017 __be16 dport, unsigned flags, 1088 __be16 dport, unsigned int flags,
1018 struct ip_vs_dest *dest, __u32 fwmark); 1089 struct ip_vs_dest *dest, __u32 fwmark);
1019extern void ip_vs_conn_expire_now(struct ip_vs_conn *cp); 1090extern void ip_vs_conn_expire_now(struct ip_vs_conn *cp);
1020 1091
@@ -1184,10 +1255,8 @@ extern void ip_vs_scheduler_err(struct ip_vs_service *svc, const char *msg);
1184 * IPVS control data and functions (from ip_vs_ctl.c) 1255 * IPVS control data and functions (from ip_vs_ctl.c)
1185 */ 1256 */
1186extern struct ip_vs_stats ip_vs_stats; 1257extern struct ip_vs_stats ip_vs_stats;
1187extern const struct ctl_path net_vs_ctl_path[];
1188extern int sysctl_ip_vs_sync_ver; 1258extern int sysctl_ip_vs_sync_ver;
1189 1259
1190extern void ip_vs_sync_switch_mode(struct net *net, int mode);
1191extern struct ip_vs_service * 1260extern struct ip_vs_service *
1192ip_vs_service_get(struct net *net, int af, __u32 fwmark, __u16 protocol, 1261ip_vs_service_get(struct net *net, int af, __u32 fwmark, __u16 protocol,
1193 const union nf_inet_addr *vaddr, __be16 vport); 1262 const union nf_inet_addr *vaddr, __be16 vport);
@@ -1203,6 +1272,8 @@ ip_vs_lookup_real_service(struct net *net, int af, __u16 protocol,
1203 1272
1204extern int ip_vs_use_count_inc(void); 1273extern int ip_vs_use_count_inc(void);
1205extern void ip_vs_use_count_dec(void); 1274extern void ip_vs_use_count_dec(void);
1275extern int ip_vs_register_nl_ioctl(void);
1276extern void ip_vs_unregister_nl_ioctl(void);
1206extern int ip_vs_control_init(void); 1277extern int ip_vs_control_init(void);
1207extern void ip_vs_control_cleanup(void); 1278extern void ip_vs_control_cleanup(void);
1208extern struct ip_vs_dest * 1279extern struct ip_vs_dest *
@@ -1219,7 +1290,7 @@ extern struct ip_vs_dest *ip_vs_try_bind_dest(struct ip_vs_conn *cp);
1219extern int start_sync_thread(struct net *net, int state, char *mcast_ifn, 1290extern int start_sync_thread(struct net *net, int state, char *mcast_ifn,
1220 __u8 syncid); 1291 __u8 syncid);
1221extern int stop_sync_thread(struct net *net, int state); 1292extern int stop_sync_thread(struct net *net, int state);
1222extern void ip_vs_sync_conn(struct net *net, struct ip_vs_conn *cp); 1293extern void ip_vs_sync_conn(struct net *net, struct ip_vs_conn *cp, int pkts);
1223 1294
1224 1295
1225/* 1296/*
diff --git a/include/net/ipip.h b/include/net/ipip.h
index a32654d52730..a93cf6d7e94b 100644
--- a/include/net/ipip.h
+++ b/include/net/ipip.h
@@ -54,8 +54,10 @@ struct ip_tunnel_prl_entry {
54 \ 54 \
55 err = ip_local_out(skb); \ 55 err = ip_local_out(skb); \
56 if (likely(net_xmit_eval(err) == 0)) { \ 56 if (likely(net_xmit_eval(err) == 0)) { \
57 u64_stats_update_begin(&(stats1)->syncp); \
57 (stats1)->tx_bytes += pkt_len; \ 58 (stats1)->tx_bytes += pkt_len; \
58 (stats1)->tx_packets++; \ 59 (stats1)->tx_packets++; \
60 u64_stats_update_end(&(stats1)->syncp); \
59 } else { \ 61 } else { \
60 (stats2)->tx_errors++; \ 62 (stats2)->tx_errors++; \
61 (stats2)->tx_aborted_errors++; \ 63 (stats2)->tx_aborted_errors++; \
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index e4170a22fc6f..aecf88436abf 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -113,7 +113,6 @@ struct frag_hdr {
113 113
114/* sysctls */ 114/* sysctls */
115extern int sysctl_mld_max_msf; 115extern int sysctl_mld_max_msf;
116extern struct ctl_path net_ipv6_ctl_path[];
117 116
118#define _DEVINC(net, statname, modifier, idev, field) \ 117#define _DEVINC(net, statname, modifier, idev, field) \
119({ \ 118({ \
@@ -264,7 +263,7 @@ extern struct ipv6_txoptions * ipv6_renew_options(struct sock *sk, struct ipv6_t
264struct ipv6_txoptions *ipv6_fixup_options(struct ipv6_txoptions *opt_space, 263struct ipv6_txoptions *ipv6_fixup_options(struct ipv6_txoptions *opt_space,
265 struct ipv6_txoptions *opt); 264 struct ipv6_txoptions *opt);
266 265
267extern int ipv6_opt_accepted(struct sock *sk, struct sk_buff *skb); 266extern bool ipv6_opt_accepted(const struct sock *sk, const struct sk_buff *skb);
268 267
269int ip6_frag_nqueues(struct net *net); 268int ip6_frag_nqueues(struct net *net);
270int ip6_frag_mem(struct net *net); 269int ip6_frag_mem(struct net *net);
@@ -333,8 +332,8 @@ static inline void ipv6_addr_set(struct in6_addr *addr,
333 addr->s6_addr32[3] = w4; 332 addr->s6_addr32[3] = w4;
334} 333}
335 334
336static inline int ipv6_addr_equal(const struct in6_addr *a1, 335static inline bool ipv6_addr_equal(const struct in6_addr *a1,
337 const struct in6_addr *a2) 336 const struct in6_addr *a2)
338{ 337{
339 return ((a1->s6_addr32[0] ^ a2->s6_addr32[0]) | 338 return ((a1->s6_addr32[0] ^ a2->s6_addr32[0]) |
340 (a1->s6_addr32[1] ^ a2->s6_addr32[1]) | 339 (a1->s6_addr32[1] ^ a2->s6_addr32[1]) |
@@ -342,27 +341,27 @@ static inline int ipv6_addr_equal(const struct in6_addr *a1,
342 (a1->s6_addr32[3] ^ a2->s6_addr32[3])) == 0; 341 (a1->s6_addr32[3] ^ a2->s6_addr32[3])) == 0;
343} 342}
344 343
345static inline int __ipv6_prefix_equal(const __be32 *a1, const __be32 *a2, 344static inline bool __ipv6_prefix_equal(const __be32 *a1, const __be32 *a2,
346 unsigned int prefixlen) 345 unsigned int prefixlen)
347{ 346{
348 unsigned pdw, pbi; 347 unsigned int pdw, pbi;
349 348
350 /* check complete u32 in prefix */ 349 /* check complete u32 in prefix */
351 pdw = prefixlen >> 5; 350 pdw = prefixlen >> 5;
352 if (pdw && memcmp(a1, a2, pdw << 2)) 351 if (pdw && memcmp(a1, a2, pdw << 2))
353 return 0; 352 return false;
354 353
355 /* check incomplete u32 in prefix */ 354 /* check incomplete u32 in prefix */
356 pbi = prefixlen & 0x1f; 355 pbi = prefixlen & 0x1f;
357 if (pbi && ((a1[pdw] ^ a2[pdw]) & htonl((0xffffffff) << (32 - pbi)))) 356 if (pbi && ((a1[pdw] ^ a2[pdw]) & htonl((0xffffffff) << (32 - pbi))))
358 return 0; 357 return false;
359 358
360 return 1; 359 return true;
361} 360}
362 361
363static inline int ipv6_prefix_equal(const struct in6_addr *a1, 362static inline bool ipv6_prefix_equal(const struct in6_addr *a1,
364 const struct in6_addr *a2, 363 const struct in6_addr *a2,
365 unsigned int prefixlen) 364 unsigned int prefixlen)
366{ 365{
367 return __ipv6_prefix_equal(a1->s6_addr32, a2->s6_addr32, 366 return __ipv6_prefix_equal(a1->s6_addr32, a2->s6_addr32,
368 prefixlen); 367 prefixlen);
@@ -388,21 +387,21 @@ struct ip6_create_arg {
388}; 387};
389 388
390void ip6_frag_init(struct inet_frag_queue *q, void *a); 389void ip6_frag_init(struct inet_frag_queue *q, void *a);
391int ip6_frag_match(struct inet_frag_queue *q, void *a); 390bool ip6_frag_match(struct inet_frag_queue *q, void *a);
392 391
393static inline int ipv6_addr_any(const struct in6_addr *a) 392static inline bool ipv6_addr_any(const struct in6_addr *a)
394{ 393{
395 return (a->s6_addr32[0] | a->s6_addr32[1] | 394 return (a->s6_addr32[0] | a->s6_addr32[1] |
396 a->s6_addr32[2] | a->s6_addr32[3]) == 0; 395 a->s6_addr32[2] | a->s6_addr32[3]) == 0;
397} 396}
398 397
399static inline int ipv6_addr_loopback(const struct in6_addr *a) 398static inline bool ipv6_addr_loopback(const struct in6_addr *a)
400{ 399{
401 return (a->s6_addr32[0] | a->s6_addr32[1] | 400 return (a->s6_addr32[0] | a->s6_addr32[1] |
402 a->s6_addr32[2] | (a->s6_addr32[3] ^ htonl(1))) == 0; 401 a->s6_addr32[2] | (a->s6_addr32[3] ^ htonl(1))) == 0;
403} 402}
404 403
405static inline int ipv6_addr_v4mapped(const struct in6_addr *a) 404static inline bool ipv6_addr_v4mapped(const struct in6_addr *a)
406{ 405{
407 return (a->s6_addr32[0] | a->s6_addr32[1] | 406 return (a->s6_addr32[0] | a->s6_addr32[1] |
408 (a->s6_addr32[2] ^ htonl(0x0000ffff))) == 0; 407 (a->s6_addr32[2] ^ htonl(0x0000ffff))) == 0;
@@ -412,7 +411,7 @@ static inline int ipv6_addr_v4mapped(const struct in6_addr *a)
412 * Check for a RFC 4843 ORCHID address 411 * Check for a RFC 4843 ORCHID address
413 * (Overlay Routable Cryptographic Hash Identifiers) 412 * (Overlay Routable Cryptographic Hash Identifiers)
414 */ 413 */
415static inline int ipv6_addr_orchid(const struct in6_addr *a) 414static inline bool ipv6_addr_orchid(const struct in6_addr *a)
416{ 415{
417 return (a->s6_addr32[0] & htonl(0xfffffff0)) == htonl(0x20010010); 416 return (a->s6_addr32[0] & htonl(0xfffffff0)) == htonl(0x20010010);
418} 417}
@@ -560,7 +559,7 @@ extern void ipv6_push_frag_opts(struct sk_buff *skb,
560extern int ipv6_skip_exthdr(const struct sk_buff *, int start, 559extern int ipv6_skip_exthdr(const struct sk_buff *, int start,
561 u8 *nexthdrp, __be16 *frag_offp); 560 u8 *nexthdrp, __be16 *frag_offp);
562 561
563extern int ipv6_ext_hdr(u8 nexthdr); 562extern bool ipv6_ext_hdr(u8 nexthdr);
564 563
565extern int ipv6_find_tlv(struct sk_buff *skb, int offset, int type); 564extern int ipv6_find_tlv(struct sk_buff *skb, int offset, int type);
566 565
@@ -661,8 +660,6 @@ extern struct ctl_table *ipv6_icmp_sysctl_init(struct net *net);
661extern struct ctl_table *ipv6_route_sysctl_init(struct net *net); 660extern struct ctl_table *ipv6_route_sysctl_init(struct net *net);
662extern int ipv6_sysctl_register(void); 661extern int ipv6_sysctl_register(void);
663extern void ipv6_sysctl_unregister(void); 662extern void ipv6_sysctl_unregister(void);
664extern int ipv6_static_sysctl_register(void);
665extern void ipv6_static_sysctl_unregister(void);
666#endif 663#endif
667 664
668#endif /* _NET_IPV6_H */ 665#endif /* _NET_IPV6_H */
diff --git a/include/net/lapb.h b/include/net/lapb.h
index fd2bf572ee1d..df892a94f2c6 100644
--- a/include/net/lapb.h
+++ b/include/net/lapb.h
@@ -149,4 +149,10 @@ extern int lapb_t1timer_running(struct lapb_cb *lapb);
149 */ 149 */
150#define LAPB_DEBUG 0 150#define LAPB_DEBUG 0
151 151
152#define lapb_dbg(level, fmt, ...) \
153do { \
154 if (level < LAPB_DEBUG) \
155 pr_debug(fmt, ##__VA_ARGS__); \
156} while (0)
157
152#endif 158#endif
diff --git a/include/net/llc_c_ev.h b/include/net/llc_c_ev.h
index 23a409381fa9..6ca3113df39e 100644
--- a/include/net/llc_c_ev.h
+++ b/include/net/llc_c_ev.h
@@ -264,6 +264,6 @@ extern int llc_conn_ev_qlfy_set_status_rst_done(struct sock *sk,
264static __inline__ int llc_conn_space(struct sock *sk, struct sk_buff *skb) 264static __inline__ int llc_conn_space(struct sock *sk, struct sk_buff *skb)
265{ 265{
266 return atomic_read(&sk->sk_rmem_alloc) + skb->truesize < 266 return atomic_read(&sk->sk_rmem_alloc) + skb->truesize <
267 (unsigned)sk->sk_rcvbuf; 267 (unsigned int)sk->sk_rcvbuf;
268} 268}
269#endif /* LLC_C_EV_H */ 269#endif /* LLC_C_EV_H */
diff --git a/include/net/llc_pdu.h b/include/net/llc_pdu.h
index f57e7d46a453..5a93d13ac95c 100644
--- a/include/net/llc_pdu.h
+++ b/include/net/llc_pdu.h
@@ -13,7 +13,6 @@
13 */ 13 */
14 14
15#include <linux/if_ether.h> 15#include <linux/if_ether.h>
16#include <linux/if_tr.h>
17 16
18/* Lengths of frame formats */ 17/* Lengths of frame formats */
19#define LLC_PDU_LEN_I 4 /* header and 2 control bytes */ 18#define LLC_PDU_LEN_I 4 /* header and 2 control bytes */
@@ -253,10 +252,6 @@ static inline void llc_pdu_decode_sa(struct sk_buff *skb, u8 *sa)
253{ 252{
254 if (skb->protocol == htons(ETH_P_802_2)) 253 if (skb->protocol == htons(ETH_P_802_2))
255 memcpy(sa, eth_hdr(skb)->h_source, ETH_ALEN); 254 memcpy(sa, eth_hdr(skb)->h_source, ETH_ALEN);
256 else if (skb->protocol == htons(ETH_P_TR_802_2)) {
257 memcpy(sa, tr_hdr(skb)->saddr, ETH_ALEN);
258 *sa &= 0x7F;
259 }
260} 255}
261 256
262/** 257/**
@@ -270,8 +265,6 @@ static inline void llc_pdu_decode_da(struct sk_buff *skb, u8 *da)
270{ 265{
271 if (skb->protocol == htons(ETH_P_802_2)) 266 if (skb->protocol == htons(ETH_P_802_2))
272 memcpy(da, eth_hdr(skb)->h_dest, ETH_ALEN); 267 memcpy(da, eth_hdr(skb)->h_dest, ETH_ALEN);
273 else if (skb->protocol == htons(ETH_P_TR_802_2))
274 memcpy(da, tr_hdr(skb)->daddr, ETH_ALEN);
275} 268}
276 269
277/** 270/**
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 9210bdc7bd8d..1937c7d98304 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -95,9 +95,11 @@ struct device;
95 * @IEEE80211_MAX_QUEUES: Maximum number of regular device queues. 95 * @IEEE80211_MAX_QUEUES: Maximum number of regular device queues.
96 */ 96 */
97enum ieee80211_max_queues { 97enum ieee80211_max_queues {
98 IEEE80211_MAX_QUEUES = 4, 98 IEEE80211_MAX_QUEUES = 16,
99}; 99};
100 100
101#define IEEE80211_INVAL_HW_QUEUE 0xff
102
101/** 103/**
102 * enum ieee80211_ac_numbers - AC numbers as used in mac80211 104 * enum ieee80211_ac_numbers - AC numbers as used in mac80211
103 * @IEEE80211_AC_VO: voice 105 * @IEEE80211_AC_VO: voice
@@ -244,7 +246,7 @@ enum ieee80211_rssi_event {
244 * @channel_type: Channel type for this BSS -- the hardware might be 246 * @channel_type: Channel type for this BSS -- the hardware might be
245 * configured for HT40+ while this BSS only uses no-HT, for 247 * configured for HT40+ while this BSS only uses no-HT, for
246 * example. 248 * example.
247 * @ht_operation_mode: HT operation mode (like in &struct ieee80211_ht_info). 249 * @ht_operation_mode: HT operation mode like in &struct ieee80211_ht_operation.
248 * This field is only valid when the channel type is one of the HT types. 250 * This field is only valid when the channel type is one of the HT types.
249 * @cqm_rssi_thold: Connection quality monitor RSSI threshold, a zero value 251 * @cqm_rssi_thold: Connection quality monitor RSSI threshold, a zero value
250 * implies disabled 252 * implies disabled
@@ -522,7 +524,7 @@ struct ieee80211_tx_rate {
522 * 524 *
523 * @flags: transmit info flags, defined above 525 * @flags: transmit info flags, defined above
524 * @band: the band to transmit on (use for checking for races) 526 * @band: the band to transmit on (use for checking for races)
525 * @antenna_sel_tx: antenna to use, 0 for automatic diversity 527 * @hw_queue: HW queue to put the frame on, skb_get_queue_mapping() gives the AC
526 * @ack_frame_id: internal frame ID for TX status, used internally 528 * @ack_frame_id: internal frame ID for TX status, used internally
527 * @control: union for control data 529 * @control: union for control data
528 * @status: union for status data 530 * @status: union for status data
@@ -538,7 +540,7 @@ struct ieee80211_tx_info {
538 u32 flags; 540 u32 flags;
539 u8 band; 541 u8 band;
540 542
541 u8 antenna_sel_tx; 543 u8 hw_queue;
542 544
543 u16 ack_frame_id; 545 u16 ack_frame_id;
544 546
@@ -564,7 +566,8 @@ struct ieee80211_tx_info {
564 u8 ampdu_ack_len; 566 u8 ampdu_ack_len;
565 int ack_signal; 567 int ack_signal;
566 u8 ampdu_len; 568 u8 ampdu_len;
567 /* 15 bytes free */ 569 u8 antenna;
570 /* 14 bytes free */
568 } status; 571 } status;
569 struct { 572 struct {
570 struct ieee80211_tx_rate driver_rates[ 573 struct ieee80211_tx_rate driver_rates[
@@ -664,6 +667,9 @@ ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info)
664 * @RX_FLAG_SHORT_GI: Short guard interval was used 667 * @RX_FLAG_SHORT_GI: Short guard interval was used
665 * @RX_FLAG_NO_SIGNAL_VAL: The signal strength value is not present. 668 * @RX_FLAG_NO_SIGNAL_VAL: The signal strength value is not present.
666 * Valid only for data frames (mainly A-MPDU) 669 * Valid only for data frames (mainly A-MPDU)
670 * @RX_FLAG_HT_GF: This frame was received in a HT-greenfield transmission, if
671 * the driver fills this value it should add %IEEE80211_RADIOTAP_MCS_HAVE_FMT
672 * to hw.radiotap_mcs_details to advertise that fact
667 */ 673 */
668enum mac80211_rx_flags { 674enum mac80211_rx_flags {
669 RX_FLAG_MMIC_ERROR = 1<<0, 675 RX_FLAG_MMIC_ERROR = 1<<0,
@@ -678,6 +684,7 @@ enum mac80211_rx_flags {
678 RX_FLAG_40MHZ = 1<<10, 684 RX_FLAG_40MHZ = 1<<10,
679 RX_FLAG_SHORT_GI = 1<<11, 685 RX_FLAG_SHORT_GI = 1<<11,
680 RX_FLAG_NO_SIGNAL_VAL = 1<<12, 686 RX_FLAG_NO_SIGNAL_VAL = 1<<12,
687 RX_FLAG_HT_GF = 1<<13,
681}; 688};
682 689
683/** 690/**
@@ -888,6 +895,8 @@ enum ieee80211_vif_flags {
888 * these need to be set (or cleared) when the interface is added 895 * these need to be set (or cleared) when the interface is added
889 * or, if supported by the driver, the interface type is changed 896 * or, if supported by the driver, the interface type is changed
890 * at runtime, mac80211 will never touch this field 897 * at runtime, mac80211 will never touch this field
898 * @hw_queue: hardware queue for each AC
899 * @cab_queue: content-after-beacon (DTIM beacon really) queue, AP mode only
891 * @drv_priv: data area for driver use, will always be aligned to 900 * @drv_priv: data area for driver use, will always be aligned to
892 * sizeof(void *). 901 * sizeof(void *).
893 */ 902 */
@@ -896,7 +905,12 @@ struct ieee80211_vif {
896 struct ieee80211_bss_conf bss_conf; 905 struct ieee80211_bss_conf bss_conf;
897 u8 addr[ETH_ALEN]; 906 u8 addr[ETH_ALEN];
898 bool p2p; 907 bool p2p;
908
909 u8 cab_queue;
910 u8 hw_queue[IEEE80211_NUM_ACS];
911
899 u32 driver_flags; 912 u32 driver_flags;
913
900 /* must be last */ 914 /* must be last */
901 u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *)))); 915 u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *))));
902}; 916};
@@ -929,7 +943,7 @@ static inline bool ieee80211_vif_is_mesh(struct ieee80211_vif *vif)
929 * CCMP key if it requires CCMP encryption of management frames (MFP) to 943 * CCMP key if it requires CCMP encryption of management frames (MFP) to
930 * be done in software. 944 * be done in software.
931 * @IEEE80211_KEY_FLAG_PUT_IV_SPACE: This flag should be set by the driver 945 * @IEEE80211_KEY_FLAG_PUT_IV_SPACE: This flag should be set by the driver
932 * for a CCMP key if space should be prepared for the IV, but the IV 946 * if space should be prepared for the IV, but the IV
933 * itself should not be generated. Do not set together with 947 * itself should not be generated. Do not set together with
934 * @IEEE80211_KEY_FLAG_GENERATE_IV on the same key. 948 * @IEEE80211_KEY_FLAG_GENERATE_IV on the same key.
935 */ 949 */
@@ -1174,6 +1188,15 @@ enum sta_notify_cmd {
1174 * @IEEE80211_HW_SCAN_WHILE_IDLE: The device can do hw scan while 1188 * @IEEE80211_HW_SCAN_WHILE_IDLE: The device can do hw scan while
1175 * being idle (i.e. mac80211 doesn't have to go idle-off during the 1189 * being idle (i.e. mac80211 doesn't have to go idle-off during the
1176 * the scan). 1190 * the scan).
1191 *
1192 * @IEEE80211_HW_WANT_MONITOR_VIF: The driver would like to be informed of
1193 * a virtual monitor interface when monitor interfaces are the only
1194 * active interfaces.
1195 *
1196 * @IEEE80211_HW_QUEUE_CONTROL: The driver wants to control per-interface
1197 * queue mapping in order to use different queues (not just one per AC)
1198 * for different virtual interfaces. See the doc section on HW queue
1199 * control for more details.
1177 */ 1200 */
1178enum ieee80211_hw_flags { 1201enum ieee80211_hw_flags {
1179 IEEE80211_HW_HAS_RATE_CONTROL = 1<<0, 1202 IEEE80211_HW_HAS_RATE_CONTROL = 1<<0,
@@ -1190,13 +1213,13 @@ enum ieee80211_hw_flags {
1190 IEEE80211_HW_PS_NULLFUNC_STACK = 1<<11, 1213 IEEE80211_HW_PS_NULLFUNC_STACK = 1<<11,
1191 IEEE80211_HW_SUPPORTS_DYNAMIC_PS = 1<<12, 1214 IEEE80211_HW_SUPPORTS_DYNAMIC_PS = 1<<12,
1192 IEEE80211_HW_MFP_CAPABLE = 1<<13, 1215 IEEE80211_HW_MFP_CAPABLE = 1<<13,
1193 /* reuse bit 14 */ 1216 IEEE80211_HW_WANT_MONITOR_VIF = 1<<14,
1194 IEEE80211_HW_SUPPORTS_STATIC_SMPS = 1<<15, 1217 IEEE80211_HW_SUPPORTS_STATIC_SMPS = 1<<15,
1195 IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS = 1<<16, 1218 IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS = 1<<16,
1196 IEEE80211_HW_SUPPORTS_UAPSD = 1<<17, 1219 IEEE80211_HW_SUPPORTS_UAPSD = 1<<17,
1197 IEEE80211_HW_REPORTS_TX_ACK_STATUS = 1<<18, 1220 IEEE80211_HW_REPORTS_TX_ACK_STATUS = 1<<18,
1198 IEEE80211_HW_CONNECTION_MONITOR = 1<<19, 1221 IEEE80211_HW_CONNECTION_MONITOR = 1<<19,
1199 /* reuse bit 20 */ 1222 IEEE80211_HW_QUEUE_CONTROL = 1<<20,
1200 IEEE80211_HW_SUPPORTS_PER_STA_GTK = 1<<21, 1223 IEEE80211_HW_SUPPORTS_PER_STA_GTK = 1<<21,
1201 IEEE80211_HW_AP_LINK_PS = 1<<22, 1224 IEEE80211_HW_AP_LINK_PS = 1<<22,
1202 IEEE80211_HW_TX_AMPDU_SETUP_IN_HW = 1<<23, 1225 IEEE80211_HW_TX_AMPDU_SETUP_IN_HW = 1<<23,
@@ -1266,6 +1289,14 @@ enum ieee80211_hw_flags {
1266 * @max_tx_aggregation_subframes: maximum number of subframes in an 1289 * @max_tx_aggregation_subframes: maximum number of subframes in an
1267 * aggregate an HT driver will transmit, used by the peer as a 1290 * aggregate an HT driver will transmit, used by the peer as a
1268 * hint to size its reorder buffer. 1291 * hint to size its reorder buffer.
1292 *
1293 * @offchannel_tx_hw_queue: HW queue ID to use for offchannel TX
1294 * (if %IEEE80211_HW_QUEUE_CONTROL is set)
1295 *
1296 * @radiotap_mcs_details: lists which MCS information can the HW
1297 * reports, by default it is set to _MCS, _GI and _BW but doesn't
1298 * include _FMT. Use %IEEE80211_RADIOTAP_MCS_HAVE_* values, only
1299 * adding _BW is supported today.
1269 */ 1300 */
1270struct ieee80211_hw { 1301struct ieee80211_hw {
1271 struct ieee80211_conf conf; 1302 struct ieee80211_conf conf;
@@ -1286,6 +1317,8 @@ struct ieee80211_hw {
1286 u8 max_rate_tries; 1317 u8 max_rate_tries;
1287 u8 max_rx_aggregation_subframes; 1318 u8 max_rx_aggregation_subframes;
1288 u8 max_tx_aggregation_subframes; 1319 u8 max_tx_aggregation_subframes;
1320 u8 offchannel_tx_hw_queue;
1321 u8 radiotap_mcs_details;
1289}; 1322};
1290 1323
1291/** 1324/**
@@ -1694,6 +1727,61 @@ void ieee80211_free_txskb(struct ieee80211_hw *hw, struct sk_buff *skb);
1694 */ 1727 */
1695 1728
1696/** 1729/**
1730 * DOC: HW queue control
1731 *
1732 * Before HW queue control was introduced, mac80211 only had a single static
1733 * assignment of per-interface AC software queues to hardware queues. This
1734 * was problematic for a few reasons:
1735 * 1) off-channel transmissions might get stuck behind other frames
1736 * 2) multiple virtual interfaces couldn't be handled correctly
1737 * 3) after-DTIM frames could get stuck behind other frames
1738 *
1739 * To solve this, hardware typically uses multiple different queues for all
1740 * the different usages, and this needs to be propagated into mac80211 so it
1741 * won't have the same problem with the software queues.
1742 *
1743 * Therefore, mac80211 now offers the %IEEE80211_HW_QUEUE_CONTROL capability
1744 * flag that tells it that the driver implements its own queue control. To do
1745 * so, the driver will set up the various queues in each &struct ieee80211_vif
1746 * and the offchannel queue in &struct ieee80211_hw. In response, mac80211 will
1747 * use those queue IDs in the hw_queue field of &struct ieee80211_tx_info and
1748 * if necessary will queue the frame on the right software queue that mirrors
1749 * the hardware queue.
1750 * Additionally, the driver has to then use these HW queue IDs for the queue
1751 * management functions (ieee80211_stop_queue() et al.)
1752 *
1753 * The driver is free to set up the queue mappings as needed, multiple virtual
1754 * interfaces may map to the same hardware queues if needed. The setup has to
1755 * happen during add_interface or change_interface callbacks. For example, a
1756 * driver supporting station+station and station+AP modes might decide to have
1757 * 10 hardware queues to handle different scenarios:
1758 *
1759 * 4 AC HW queues for 1st vif: 0, 1, 2, 3
1760 * 4 AC HW queues for 2nd vif: 4, 5, 6, 7
1761 * after-DTIM queue for AP: 8
1762 * off-channel queue: 9
1763 *
1764 * It would then set up the hardware like this:
1765 * hw.offchannel_tx_hw_queue = 9
1766 *
1767 * and the first virtual interface that is added as follows:
1768 * vif.hw_queue[IEEE80211_AC_VO] = 0
1769 * vif.hw_queue[IEEE80211_AC_VI] = 1
1770 * vif.hw_queue[IEEE80211_AC_BE] = 2
1771 * vif.hw_queue[IEEE80211_AC_BK] = 3
1772 * vif.cab_queue = 8 // if AP mode, otherwise %IEEE80211_INVAL_HW_QUEUE
1773 * and the second virtual interface with 4-7.
1774 *
1775 * If queue 6 gets full, for example, mac80211 would only stop the second
1776 * virtual interface's BE queue since virtual interface queues are per AC.
1777 *
1778 * Note that the vif.cab_queue value should be set to %IEEE80211_INVAL_HW_QUEUE
1779 * whenever the queue is not used (i.e. the interface is not in AP mode) if the
1780 * queue could potentially be shared since mac80211 will look at cab_queue when
1781 * a queue is stopped/woken even if the interface is not in AP mode.
1782 */
1783
1784/**
1697 * enum ieee80211_filter_flags - hardware filter flags 1785 * enum ieee80211_filter_flags - hardware filter flags
1698 * 1786 *
1699 * These flags determine what the filter in hardware should be 1787 * These flags determine what the filter in hardware should be
@@ -1780,6 +1868,18 @@ enum ieee80211_frame_release_type {
1780}; 1868};
1781 1869
1782/** 1870/**
1871 * enum ieee80211_rate_control_changed - flags to indicate what changed
1872 *
1873 * @IEEE80211_RC_BW_CHANGED: The bandwidth that can be used to transmit
1874 * to this station changed.
1875 * @IEEE80211_RC_SMPS_CHANGED: The SMPS state of the station changed.
1876 */
1877enum ieee80211_rate_control_changed {
1878 IEEE80211_RC_BW_CHANGED = BIT(0),
1879 IEEE80211_RC_SMPS_CHANGED = BIT(1),
1880};
1881
1882/**
1783 * struct ieee80211_ops - callbacks from mac80211 to the driver 1883 * struct ieee80211_ops - callbacks from mac80211 to the driver
1784 * 1884 *
1785 * This structure contains various callbacks that the driver may 1885 * This structure contains various callbacks that the driver may
@@ -1980,6 +2080,14 @@ enum ieee80211_frame_release_type {
1980 * up the list of states. 2080 * up the list of states.
1981 * The callback can sleep. 2081 * The callback can sleep.
1982 * 2082 *
2083 * @sta_rc_update: Notifies the driver of changes to the bitrates that can be
2084 * used to transmit to the station. The changes are advertised with bits
2085 * from &enum ieee80211_rate_control_changed and the values are reflected
2086 * in the station data. This callback should only be used when the driver
2087 * uses hardware rate control (%IEEE80211_HW_HAS_RATE_CONTROL) since
2088 * otherwise the rate control algorithm is notified directly.
2089 * Must be atomic.
2090 *
1983 * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max), 2091 * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max),
1984 * bursting) for a hardware TX queue. 2092 * bursting) for a hardware TX queue.
1985 * Returns a negative error code on failure. 2093 * Returns a negative error code on failure.
@@ -2125,6 +2233,14 @@ enum ieee80211_frame_release_type {
2125 * The @tids parameter is a bitmap and tells the driver which TIDs the 2233 * The @tids parameter is a bitmap and tells the driver which TIDs the
2126 * frames will be on; it will at most have two bits set. 2234 * frames will be on; it will at most have two bits set.
2127 * This callback must be atomic. 2235 * This callback must be atomic.
2236 *
2237 * @get_et_sset_count: Ethtool API to get string-set count.
2238 *
2239 * @get_et_stats: Ethtool API to get a set of u64 stats.
2240 *
2241 * @get_et_strings: Ethtool API to get a set of strings to describe stats
2242 * and perhaps other supported types of ethtool data-sets.
2243 *
2128 */ 2244 */
2129struct ieee80211_ops { 2245struct ieee80211_ops {
2130 void (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb); 2246 void (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb);
@@ -2135,6 +2251,7 @@ struct ieee80211_ops {
2135#ifdef CONFIG_PM 2251#ifdef CONFIG_PM
2136 int (*suspend)(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan); 2252 int (*suspend)(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan);
2137 int (*resume)(struct ieee80211_hw *hw); 2253 int (*resume)(struct ieee80211_hw *hw);
2254 void (*set_wakeup)(struct ieee80211_hw *hw, bool enabled);
2138#endif 2255#endif
2139 int (*add_interface)(struct ieee80211_hw *hw, 2256 int (*add_interface)(struct ieee80211_hw *hw,
2140 struct ieee80211_vif *vif); 2257 struct ieee80211_vif *vif);
@@ -2196,8 +2313,12 @@ struct ieee80211_ops {
2196 struct ieee80211_sta *sta, 2313 struct ieee80211_sta *sta,
2197 enum ieee80211_sta_state old_state, 2314 enum ieee80211_sta_state old_state,
2198 enum ieee80211_sta_state new_state); 2315 enum ieee80211_sta_state new_state);
2316 void (*sta_rc_update)(struct ieee80211_hw *hw,
2317 struct ieee80211_vif *vif,
2318 struct ieee80211_sta *sta,
2319 u32 changed);
2199 int (*conf_tx)(struct ieee80211_hw *hw, 2320 int (*conf_tx)(struct ieee80211_hw *hw,
2200 struct ieee80211_vif *vif, u16 queue, 2321 struct ieee80211_vif *vif, u16 ac,
2201 const struct ieee80211_tx_queue_params *params); 2322 const struct ieee80211_tx_queue_params *params);
2202 u64 (*get_tsf)(struct ieee80211_hw *hw, struct ieee80211_vif *vif); 2323 u64 (*get_tsf)(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
2203 void (*set_tsf)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 2324 void (*set_tsf)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
@@ -2250,6 +2371,15 @@ struct ieee80211_ops {
2250 u16 tids, int num_frames, 2371 u16 tids, int num_frames,
2251 enum ieee80211_frame_release_type reason, 2372 enum ieee80211_frame_release_type reason,
2252 bool more_data); 2373 bool more_data);
2374
2375 int (*get_et_sset_count)(struct ieee80211_hw *hw,
2376 struct ieee80211_vif *vif, int sset);
2377 void (*get_et_stats)(struct ieee80211_hw *hw,
2378 struct ieee80211_vif *vif,
2379 struct ethtool_stats *stats, u64 *data);
2380 void (*get_et_strings)(struct ieee80211_hw *hw,
2381 struct ieee80211_vif *vif,
2382 u32 sset, u8 *data);
2253}; 2383};
2254 2384
2255/** 2385/**
@@ -2844,6 +2974,7 @@ __le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw,
2844 */ 2974 */
2845__le16 ieee80211_generic_frame_duration(struct ieee80211_hw *hw, 2975__le16 ieee80211_generic_frame_duration(struct ieee80211_hw *hw,
2846 struct ieee80211_vif *vif, 2976 struct ieee80211_vif *vif,
2977 enum ieee80211_band band,
2847 size_t frame_len, 2978 size_t frame_len,
2848 struct ieee80211_rate *rate); 2979 struct ieee80211_rate *rate);
2849 2980
@@ -3512,19 +3643,6 @@ void ieee80211_send_bar(struct ieee80211_vif *vif, u8 *ra, u16 tid, u16 ssn);
3512/* Rate control API */ 3643/* Rate control API */
3513 3644
3514/** 3645/**
3515 * enum rate_control_changed - flags to indicate which parameter changed
3516 *
3517 * @IEEE80211_RC_HT_CHANGED: The HT parameters of the operating channel have
3518 * changed, rate control algorithm can update its internal state if needed.
3519 * @IEEE80211_RC_SMPS_CHANGED: The SMPS state of the station changed, the rate
3520 * control algorithm needs to adjust accordingly.
3521 */
3522enum rate_control_changed {
3523 IEEE80211_RC_HT_CHANGED = BIT(0),
3524 IEEE80211_RC_SMPS_CHANGED = BIT(1),
3525};
3526
3527/**
3528 * struct ieee80211_tx_rate_control - rate control information for/from RC algo 3646 * struct ieee80211_tx_rate_control - rate control information for/from RC algo
3529 * 3647 *
3530 * @hw: The hardware the algorithm is invoked for. 3648 * @hw: The hardware the algorithm is invoked for.
@@ -3569,9 +3687,8 @@ struct rate_control_ops {
3569 void (*rate_init)(void *priv, struct ieee80211_supported_band *sband, 3687 void (*rate_init)(void *priv, struct ieee80211_supported_band *sband,
3570 struct ieee80211_sta *sta, void *priv_sta); 3688 struct ieee80211_sta *sta, void *priv_sta);
3571 void (*rate_update)(void *priv, struct ieee80211_supported_band *sband, 3689 void (*rate_update)(void *priv, struct ieee80211_supported_band *sband,
3572 struct ieee80211_sta *sta, 3690 struct ieee80211_sta *sta, void *priv_sta,
3573 void *priv_sta, u32 changed, 3691 u32 changed);
3574 enum nl80211_channel_type oper_chan_type);
3575 void (*free_sta)(void *priv, struct ieee80211_sta *sta, 3692 void (*free_sta)(void *priv, struct ieee80211_sta *sta,
3576 void *priv_sta); 3693 void *priv_sta);
3577 3694
@@ -3706,8 +3823,20 @@ void ieee80211_enable_rssi_reports(struct ieee80211_vif *vif,
3706 3823
3707void ieee80211_disable_rssi_reports(struct ieee80211_vif *vif); 3824void ieee80211_disable_rssi_reports(struct ieee80211_vif *vif);
3708 3825
3709int ieee80211_add_srates_ie(struct ieee80211_vif *vif, struct sk_buff *skb); 3826int ieee80211_add_srates_ie(struct ieee80211_vif *vif,
3827 struct sk_buff *skb, bool need_basic);
3710 3828
3711int ieee80211_add_ext_srates_ie(struct ieee80211_vif *vif, 3829int ieee80211_add_ext_srates_ie(struct ieee80211_vif *vif,
3712 struct sk_buff *skb); 3830 struct sk_buff *skb, bool need_basic);
3831
3832/**
3833 * ieee80211_ave_rssi - report the average rssi for the specified interface
3834 *
3835 * @vif: the specified virtual interface
3836 *
3837 * This function return the average rssi value for the requested interface.
3838 * It assumes that the given vif is valid.
3839 */
3840int ieee80211_ave_rssi(struct ieee80211_vif *vif);
3841
3713#endif /* MAC80211_H */ 3842#endif /* MAC80211_H */
diff --git a/include/net/mac802154.h b/include/net/mac802154.h
new file mode 100644
index 000000000000..c9f8ab5cc687
--- /dev/null
+++ b/include/net/mac802154.h
@@ -0,0 +1,136 @@
1/*
2 * IEEE802.15.4-2003 specification
3 *
4 * Copyright (C) 2007-2012 Siemens AG
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
8 * as published 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 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#ifndef NET_MAC802154_H
20#define NET_MAC802154_H
21
22#include <net/af_ieee802154.h>
23
24/* The following flags are used to indicate changed address settings from
25 * the stack to the hardware.
26 */
27
28/* indicates that the Short Address changed */
29#define IEEE802515_AFILT_SADDR_CHANGED 0x00000001
30/* indicates that the IEEE Address changed */
31#define IEEE802515_AFILT_IEEEADDR_CHANGED 0x00000002
32/* indicates that the PAN ID changed */
33#define IEEE802515_AFILT_PANID_CHANGED 0x00000004
34/* indicates that PAN Coordinator status changed */
35#define IEEE802515_AFILT_PANC_CHANGED 0x00000008
36
37struct ieee802154_hw_addr_filt {
38 __le16 pan_id; /* Each independent PAN selects a unique
39 * identifier. This PAN id allows communication
40 * between devices within a network using short
41 * addresses and enables transmissions between
42 * devices across independent networks.
43 */
44 __le16 short_addr;
45 u8 ieee_addr[IEEE802154_ADDR_LEN];
46 u8 pan_coord;
47};
48
49struct ieee802154_dev {
50 /* filled by the driver */
51 int extra_tx_headroom;
52 u32 flags;
53 struct device *parent;
54
55 /* filled by mac802154 core */
56 struct ieee802154_hw_addr_filt hw_filt;
57 void *priv;
58 struct wpan_phy *phy;
59};
60
61/* Checksum is in hardware and is omitted from a packet
62 *
63 * These following flags are used to indicate hardware capabilities to
64 * the stack. Generally, flags here should have their meaning
65 * done in a way that the simplest hardware doesn't need setting
66 * any particular flags. There are some exceptions to this rule,
67 * however, so you are advised to review these flags carefully.
68 */
69
70/* Indicates that receiver omits FCS and xmitter will add FCS on it's own. */
71#define IEEE802154_HW_OMIT_CKSUM 0x00000001
72/* Indicates that receiver will autorespond with ACK frames. */
73#define IEEE802154_HW_AACK 0x00000002
74
75/* struct ieee802154_ops - callbacks from mac802154 to the driver
76 *
77 * This structure contains various callbacks that the driver may
78 * handle or, in some cases, must handle, for example to transmit
79 * a frame.
80 *
81 * start: Handler that 802.15.4 module calls for device initialization.
82 * This function is called before the first interface is attached.
83 *
84 * stop: Handler that 802.15.4 module calls for device cleanup.
85 * This function is called after the last interface is removed.
86 *
87 * xmit: Handler that 802.15.4 module calls for each transmitted frame.
88 * skb cntains the buffer starting from the IEEE 802.15.4 header.
89 * The low-level driver should send the frame based on available
90 * configuration.
91 * This function should return zero or negative errno. Called with
92 * pib_lock held.
93 *
94 * ed: Handler that 802.15.4 module calls for Energy Detection.
95 * This function should place the value for detected energy
96 * (usually device-dependant) in the level pointer and return
97 * either zero or negative errno. Called with pib_lock held.
98 *
99 * set_channel:
100 * Set radio for listening on specific channel.
101 * Set the device for listening on specified channel.
102 * Returns either zero, or negative errno. Called with pib_lock held.
103 *
104 * set_hw_addr_filt:
105 * Set radio for listening on specific address.
106 * Set the device for listening on specified address.
107 * Returns either zero, or negative errno.
108 */
109struct ieee802154_ops {
110 struct module *owner;
111 int (*start)(struct ieee802154_dev *dev);
112 void (*stop)(struct ieee802154_dev *dev);
113 int (*xmit)(struct ieee802154_dev *dev,
114 struct sk_buff *skb);
115 int (*ed)(struct ieee802154_dev *dev, u8 *level);
116 int (*set_channel)(struct ieee802154_dev *dev,
117 int page,
118 int channel);
119 int (*set_hw_addr_filt)(struct ieee802154_dev *dev,
120 struct ieee802154_hw_addr_filt *filt,
121 unsigned long changed);
122 int (*ieee_addr)(struct ieee802154_dev *dev,
123 u8 addr[IEEE802154_ADDR_LEN]);
124};
125
126/* Basic interface to register ieee802154 device */
127struct ieee802154_dev *
128ieee802154_alloc_device(size_t priv_data_lex, struct ieee802154_ops *ops);
129void ieee802154_free_device(struct ieee802154_dev *dev);
130int ieee802154_register_device(struct ieee802154_dev *dev);
131void ieee802154_unregister_device(struct ieee802154_dev *dev);
132
133void ieee802154_rx_irqsafe(struct ieee802154_dev *dev, struct sk_buff *skb,
134 u8 lqi);
135
136#endif /* NET_MAC802154_H */
diff --git a/include/net/ndisc.h b/include/net/ndisc.h
index 6f9c25a76cd1..c02b6ad3f6c5 100644
--- a/include/net/ndisc.h
+++ b/include/net/ndisc.h
@@ -34,6 +34,7 @@ enum {
34 __ND_OPT_ARRAY_MAX, 34 __ND_OPT_ARRAY_MAX,
35 ND_OPT_ROUTE_INFO = 24, /* RFC4191 */ 35 ND_OPT_ROUTE_INFO = 24, /* RFC4191 */
36 ND_OPT_RDNSS = 25, /* RFC5006 */ 36 ND_OPT_RDNSS = 25, /* RFC5006 */
37 ND_OPT_DNSSL = 31, /* RFC6106 */
37 __ND_OPT_MAX 38 __ND_OPT_MAX
38}; 39};
39 40
diff --git a/include/net/neighbour.h b/include/net/neighbour.h
index 34c996f46181..6cdfeedb650b 100644
--- a/include/net/neighbour.h
+++ b/include/net/neighbour.h
@@ -195,7 +195,6 @@ static inline void *neighbour_priv(const struct neighbour *n)
195#define NEIGH_UPDATE_F_ADMIN 0x80000000 195#define NEIGH_UPDATE_F_ADMIN 0x80000000
196 196
197extern void neigh_table_init(struct neigh_table *tbl); 197extern void neigh_table_init(struct neigh_table *tbl);
198extern void neigh_table_init_no_netlink(struct neigh_table *tbl);
199extern int neigh_table_clear(struct neigh_table *tbl); 198extern int neigh_table_clear(struct neigh_table *tbl);
200extern struct neighbour * neigh_lookup(struct neigh_table *tbl, 199extern struct neighbour * neigh_lookup(struct neigh_table *tbl,
201 const void *pkey, 200 const void *pkey,
@@ -323,7 +322,7 @@ static inline int neigh_event_send(struct neighbour *neigh, struct sk_buff *skb)
323#ifdef CONFIG_BRIDGE_NETFILTER 322#ifdef CONFIG_BRIDGE_NETFILTER
324static inline int neigh_hh_bridge(struct hh_cache *hh, struct sk_buff *skb) 323static inline int neigh_hh_bridge(struct hh_cache *hh, struct sk_buff *skb)
325{ 324{
326 unsigned seq, hh_alen; 325 unsigned int seq, hh_alen;
327 326
328 do { 327 do {
329 seq = read_seqbegin(&hh->hh_lock); 328 seq = read_seqbegin(&hh->hh_lock);
@@ -336,7 +335,7 @@ static inline int neigh_hh_bridge(struct hh_cache *hh, struct sk_buff *skb)
336 335
337static inline int neigh_hh_output(struct hh_cache *hh, struct sk_buff *skb) 336static inline int neigh_hh_output(struct hh_cache *hh, struct sk_buff *skb)
338{ 337{
339 unsigned seq; 338 unsigned int seq;
340 int hh_len; 339 int hh_len;
341 340
342 do { 341 do {
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index ee547c149810..ac9195e6a062 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -279,14 +279,25 @@ extern void unregister_pernet_subsys(struct pernet_operations *);
279extern int register_pernet_device(struct pernet_operations *); 279extern int register_pernet_device(struct pernet_operations *);
280extern void unregister_pernet_device(struct pernet_operations *); 280extern void unregister_pernet_device(struct pernet_operations *);
281 281
282struct ctl_path;
283struct ctl_table; 282struct ctl_table;
284struct ctl_table_header; 283struct ctl_table_header;
285 284
286extern struct ctl_table_header *register_net_sysctl_table(struct net *net, 285#ifdef CONFIG_SYSCTL
287 const struct ctl_path *path, struct ctl_table *table); 286extern int net_sysctl_init(void);
288extern struct ctl_table_header *register_net_sysctl_rotable( 287extern struct ctl_table_header *register_net_sysctl(struct net *net,
289 const struct ctl_path *path, struct ctl_table *table); 288 const char *path, struct ctl_table *table);
290extern void unregister_net_sysctl_table(struct ctl_table_header *header); 289extern void unregister_net_sysctl_table(struct ctl_table_header *header);
290#else
291static inline int net_sysctl_init(void) { return 0; }
292static inline struct ctl_table_header *register_net_sysctl(struct net *net,
293 const char *path, struct ctl_table *table)
294{
295 return NULL;
296}
297static inline void unregister_net_sysctl_table(struct ctl_table_header *header)
298{
299}
300#endif
301
291 302
292#endif /* __NET_NET_NAMESPACE_H */ 303#endif /* __NET_NET_NAMESPACE_H */
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h
index ab86036bbf0c..cce7f6a798bf 100644
--- a/include/net/netfilter/nf_conntrack.h
+++ b/include/net/netfilter/nf_conntrack.h
@@ -321,14 +321,8 @@ extern unsigned int nf_conntrack_max;
321extern unsigned int nf_conntrack_hash_rnd; 321extern unsigned int nf_conntrack_hash_rnd;
322void init_nf_conntrack_hash_rnd(void); 322void init_nf_conntrack_hash_rnd(void);
323 323
324#define NF_CT_STAT_INC(net, count) \ 324#define NF_CT_STAT_INC(net, count) __this_cpu_inc((net)->ct.stat->count)
325 __this_cpu_inc((net)->ct.stat->count) 325#define NF_CT_STAT_INC_ATOMIC(net, count) this_cpu_inc((net)->ct.stat->count)
326#define NF_CT_STAT_INC_ATOMIC(net, count) \
327do { \
328 local_bh_disable(); \
329 __this_cpu_inc((net)->ct.stat->count); \
330 local_bh_enable(); \
331} while (0)
332 326
333#define MODULE_ALIAS_NFCT_HELPER(helper) \ 327#define MODULE_ALIAS_NFCT_HELPER(helper) \
334 MODULE_ALIAS("nfct-helper-" helper) 328 MODULE_ALIAS("nfct-helper-" helper)
diff --git a/include/net/netfilter/nf_conntrack_helper.h b/include/net/netfilter/nf_conntrack_helper.h
index 5767dc242dee..1d1889409b9e 100644
--- a/include/net/netfilter/nf_conntrack_helper.h
+++ b/include/net/netfilter/nf_conntrack_helper.h
@@ -60,8 +60,8 @@ static inline struct nf_conn_help *nfct_help(const struct nf_conn *ct)
60 return nf_ct_ext_find(ct, NF_CT_EXT_HELPER); 60 return nf_ct_ext_find(ct, NF_CT_EXT_HELPER);
61} 61}
62 62
63extern int nf_conntrack_helper_init(void); 63extern int nf_conntrack_helper_init(struct net *net);
64extern void nf_conntrack_helper_fini(void); 64extern void nf_conntrack_helper_fini(struct net *net);
65 65
66extern int nf_conntrack_broadcast_help(struct sk_buff *skb, 66extern int nf_conntrack_broadcast_help(struct sk_buff *skb,
67 unsigned int protoff, 67 unsigned int protoff,
diff --git a/include/net/netfilter/nf_conntrack_l3proto.h b/include/net/netfilter/nf_conntrack_l3proto.h
index e8010f445ae1..9699c028b74b 100644
--- a/include/net/netfilter/nf_conntrack_l3proto.h
+++ b/include/net/netfilter/nf_conntrack_l3proto.h
@@ -65,7 +65,7 @@ struct nf_conntrack_l3proto {
65 65
66#ifdef CONFIG_SYSCTL 66#ifdef CONFIG_SYSCTL
67 struct ctl_table_header *ctl_table_header; 67 struct ctl_table_header *ctl_table_header;
68 struct ctl_path *ctl_table_path; 68 const char *ctl_table_path;
69 struct ctl_table *ctl_table; 69 struct ctl_table *ctl_table;
70#endif /* CONFIG_SYSCTL */ 70#endif /* CONFIG_SYSCTL */
71 71
diff --git a/include/net/netlink.h b/include/net/netlink.h
index f394fe5d7641..785f37a3b44e 100644
--- a/include/net/netlink.h
+++ b/include/net/netlink.h
@@ -102,20 +102,6 @@
102 * nla_put_flag(skb, type) add flag attribute to skb 102 * nla_put_flag(skb, type) add flag attribute to skb
103 * nla_put_msecs(skb, type, jiffies) add msecs attribute to skb 103 * nla_put_msecs(skb, type, jiffies) add msecs attribute to skb
104 * 104 *
105 * Exceptions Based Attribute Construction:
106 * NLA_PUT(skb, type, len, data) add attribute to skb
107 * NLA_PUT_U8(skb, type, value) add u8 attribute to skb
108 * NLA_PUT_U16(skb, type, value) add u16 attribute to skb
109 * NLA_PUT_U32(skb, type, value) add u32 attribute to skb
110 * NLA_PUT_U64(skb, type, value) add u64 attribute to skb
111 * NLA_PUT_STRING(skb, type, str) add string attribute to skb
112 * NLA_PUT_FLAG(skb, type) add flag attribute to skb
113 * NLA_PUT_MSECS(skb, type, jiffies) add msecs attribute to skb
114 *
115 * The meaning of these functions is equal to their lower case
116 * variants but they jump to the label nla_put_failure in case
117 * of a failure.
118 *
119 * Nested Attributes Construction: 105 * Nested Attributes Construction:
120 * nla_nest_start(skb, type) start a nested attribute 106 * nla_nest_start(skb, type) start a nested attribute
121 * nla_nest_end(skb, nla) finalize a nested attribute 107 * nla_nest_end(skb, nla) finalize a nested attribute
@@ -772,6 +758,39 @@ static inline int nla_put_u16(struct sk_buff *skb, int attrtype, u16 value)
772} 758}
773 759
774/** 760/**
761 * nla_put_be16 - Add a __be16 netlink attribute to a socket buffer
762 * @skb: socket buffer to add attribute to
763 * @attrtype: attribute type
764 * @value: numeric value
765 */
766static inline int nla_put_be16(struct sk_buff *skb, int attrtype, __be16 value)
767{
768 return nla_put(skb, attrtype, sizeof(__be16), &value);
769}
770
771/**
772 * nla_put_net16 - Add 16-bit network byte order netlink attribute to a socket buffer
773 * @skb: socket buffer to add attribute to
774 * @attrtype: attribute type
775 * @value: numeric value
776 */
777static inline int nla_put_net16(struct sk_buff *skb, int attrtype, __be16 value)
778{
779 return nla_put_be16(skb, attrtype | NLA_F_NET_BYTEORDER, value);
780}
781
782/**
783 * nla_put_le16 - Add a __le16 netlink attribute to a socket buffer
784 * @skb: socket buffer to add attribute to
785 * @attrtype: attribute type
786 * @value: numeric value
787 */
788static inline int nla_put_le16(struct sk_buff *skb, int attrtype, __le16 value)
789{
790 return nla_put(skb, attrtype, sizeof(__le16), &value);
791}
792
793/**
775 * nla_put_u32 - Add a u32 netlink attribute to a socket buffer 794 * nla_put_u32 - Add a u32 netlink attribute to a socket buffer
776 * @skb: socket buffer to add attribute to 795 * @skb: socket buffer to add attribute to
777 * @attrtype: attribute type 796 * @attrtype: attribute type
@@ -783,7 +802,40 @@ static inline int nla_put_u32(struct sk_buff *skb, int attrtype, u32 value)
783} 802}
784 803
785/** 804/**
786 * nla_put_64 - Add a u64 netlink attribute to a socket buffer 805 * nla_put_be32 - Add a __be32 netlink attribute to a socket buffer
806 * @skb: socket buffer to add attribute to
807 * @attrtype: attribute type
808 * @value: numeric value
809 */
810static inline int nla_put_be32(struct sk_buff *skb, int attrtype, __be32 value)
811{
812 return nla_put(skb, attrtype, sizeof(__be32), &value);
813}
814
815/**
816 * nla_put_net32 - Add 32-bit network byte order netlink attribute to a socket buffer
817 * @skb: socket buffer to add attribute to
818 * @attrtype: attribute type
819 * @value: numeric value
820 */
821static inline int nla_put_net32(struct sk_buff *skb, int attrtype, __be32 value)
822{
823 return nla_put_be32(skb, attrtype | NLA_F_NET_BYTEORDER, value);
824}
825
826/**
827 * nla_put_le32 - Add a __le32 netlink attribute to a socket buffer
828 * @skb: socket buffer to add attribute to
829 * @attrtype: attribute type
830 * @value: numeric value
831 */
832static inline int nla_put_le32(struct sk_buff *skb, int attrtype, __le32 value)
833{
834 return nla_put(skb, attrtype, sizeof(__le32), &value);
835}
836
837/**
838 * nla_put_u64 - Add a u64 netlink attribute to a socket buffer
787 * @skb: socket buffer to add attribute to 839 * @skb: socket buffer to add attribute to
788 * @attrtype: attribute type 840 * @attrtype: attribute type
789 * @value: numeric value 841 * @value: numeric value
@@ -794,6 +846,39 @@ static inline int nla_put_u64(struct sk_buff *skb, int attrtype, u64 value)
794} 846}
795 847
796/** 848/**
849 * nla_put_be64 - Add a __be64 netlink attribute to a socket buffer
850 * @skb: socket buffer to add attribute to
851 * @attrtype: attribute type
852 * @value: numeric value
853 */
854static inline int nla_put_be64(struct sk_buff *skb, int attrtype, __be64 value)
855{
856 return nla_put(skb, attrtype, sizeof(__be64), &value);
857}
858
859/**
860 * nla_put_net64 - Add 64-bit network byte order netlink attribute to a socket buffer
861 * @skb: socket buffer to add attribute to
862 * @attrtype: attribute type
863 * @value: numeric value
864 */
865static inline int nla_put_net64(struct sk_buff *skb, int attrtype, __be64 value)
866{
867 return nla_put_be64(skb, attrtype | NLA_F_NET_BYTEORDER, value);
868}
869
870/**
871 * nla_put_le64 - Add a __le64 netlink attribute to a socket buffer
872 * @skb: socket buffer to add attribute to
873 * @attrtype: attribute type
874 * @value: numeric value
875 */
876static inline int nla_put_le64(struct sk_buff *skb, int attrtype, __le64 value)
877{
878 return nla_put(skb, attrtype, sizeof(__le64), &value);
879}
880
881/**
797 * nla_put_string - Add a string netlink attribute to a socket buffer 882 * nla_put_string - Add a string netlink attribute to a socket buffer
798 * @skb: socket buffer to add attribute to 883 * @skb: socket buffer to add attribute to
799 * @attrtype: attribute type 884 * @attrtype: attribute type
@@ -828,60 +913,6 @@ static inline int nla_put_msecs(struct sk_buff *skb, int attrtype,
828 return nla_put(skb, attrtype, sizeof(u64), &tmp); 913 return nla_put(skb, attrtype, sizeof(u64), &tmp);
829} 914}
830 915
831#define NLA_PUT(skb, attrtype, attrlen, data) \
832 do { \
833 if (unlikely(nla_put(skb, attrtype, attrlen, data) < 0)) \
834 goto nla_put_failure; \
835 } while(0)
836
837#define NLA_PUT_TYPE(skb, type, attrtype, value) \
838 do { \
839 type __tmp = value; \
840 NLA_PUT(skb, attrtype, sizeof(type), &__tmp); \
841 } while(0)
842
843#define NLA_PUT_U8(skb, attrtype, value) \
844 NLA_PUT_TYPE(skb, u8, attrtype, value)
845
846#define NLA_PUT_U16(skb, attrtype, value) \
847 NLA_PUT_TYPE(skb, u16, attrtype, value)
848
849#define NLA_PUT_LE16(skb, attrtype, value) \
850 NLA_PUT_TYPE(skb, __le16, attrtype, value)
851
852#define NLA_PUT_BE16(skb, attrtype, value) \
853 NLA_PUT_TYPE(skb, __be16, attrtype, value)
854
855#define NLA_PUT_NET16(skb, attrtype, value) \
856 NLA_PUT_BE16(skb, attrtype | NLA_F_NET_BYTEORDER, value)
857
858#define NLA_PUT_U32(skb, attrtype, value) \
859 NLA_PUT_TYPE(skb, u32, attrtype, value)
860
861#define NLA_PUT_BE32(skb, attrtype, value) \
862 NLA_PUT_TYPE(skb, __be32, attrtype, value)
863
864#define NLA_PUT_NET32(skb, attrtype, value) \
865 NLA_PUT_BE32(skb, attrtype | NLA_F_NET_BYTEORDER, value)
866
867#define NLA_PUT_U64(skb, attrtype, value) \
868 NLA_PUT_TYPE(skb, u64, attrtype, value)
869
870#define NLA_PUT_BE64(skb, attrtype, value) \
871 NLA_PUT_TYPE(skb, __be64, attrtype, value)
872
873#define NLA_PUT_NET64(skb, attrtype, value) \
874 NLA_PUT_BE64(skb, attrtype | NLA_F_NET_BYTEORDER, value)
875
876#define NLA_PUT_STRING(skb, attrtype, value) \
877 NLA_PUT(skb, attrtype, strlen(value) + 1, value)
878
879#define NLA_PUT_FLAG(skb, attrtype) \
880 NLA_PUT(skb, attrtype, 0, NULL)
881
882#define NLA_PUT_MSECS(skb, attrtype, jiffies) \
883 NLA_PUT_U64(skb, attrtype, jiffies_to_msecs(jiffies))
884
885/** 916/**
886 * nla_get_u32 - return payload of u32 attribute 917 * nla_get_u32 - return payload of u32 attribute
887 * @nla: u32 netlink attribute 918 * @nla: u32 netlink attribute
diff --git a/include/net/netns/conntrack.h b/include/net/netns/conntrack.h
index 7a911eca0f18..a053a19870cf 100644
--- a/include/net/netns/conntrack.h
+++ b/include/net/netns/conntrack.h
@@ -26,11 +26,14 @@ struct netns_ct {
26 int sysctl_tstamp; 26 int sysctl_tstamp;
27 int sysctl_checksum; 27 int sysctl_checksum;
28 unsigned int sysctl_log_invalid; /* Log invalid packets */ 28 unsigned int sysctl_log_invalid; /* Log invalid packets */
29 int sysctl_auto_assign_helper;
30 bool auto_assign_helper_warned;
29#ifdef CONFIG_SYSCTL 31#ifdef CONFIG_SYSCTL
30 struct ctl_table_header *sysctl_header; 32 struct ctl_table_header *sysctl_header;
31 struct ctl_table_header *acct_sysctl_header; 33 struct ctl_table_header *acct_sysctl_header;
32 struct ctl_table_header *tstamp_sysctl_header; 34 struct ctl_table_header *tstamp_sysctl_header;
33 struct ctl_table_header *event_sysctl_header; 35 struct ctl_table_header *event_sysctl_header;
36 struct ctl_table_header *helper_sysctl_header;
34#endif 37#endif
35 char *slabname; 38 char *slabname;
36}; 39};
diff --git a/include/net/netns/hash.h b/include/net/netns/hash.h
index 548d78f2cc47..c06ac58ca107 100644
--- a/include/net/netns/hash.h
+++ b/include/net/netns/hash.h
@@ -5,7 +5,7 @@
5 5
6struct net; 6struct net;
7 7
8static inline unsigned net_hash_mix(struct net *net) 8static inline unsigned int net_hash_mix(struct net *net)
9{ 9{
10#ifdef CONFIG_NET_NS 10#ifdef CONFIG_NET_NS
11 /* 11 /*
diff --git a/include/net/netns/ipv6.h b/include/net/netns/ipv6.h
index 81abfcb2eb4e..b42be53587ba 100644
--- a/include/net/netns/ipv6.h
+++ b/include/net/netns/ipv6.h
@@ -12,7 +12,9 @@ struct ctl_table_header;
12 12
13struct netns_sysctl_ipv6 { 13struct netns_sysctl_ipv6 {
14#ifdef CONFIG_SYSCTL 14#ifdef CONFIG_SYSCTL
15 struct ctl_table_header *table; 15 struct ctl_table_header *hdr;
16 struct ctl_table_header *route_hdr;
17 struct ctl_table_header *icmp_hdr;
16 struct ctl_table_header *frags_hdr; 18 struct ctl_table_header *frags_hdr;
17#endif 19#endif
18 int bindv6only; 20 int bindv6only;
diff --git a/include/net/nfc/hci.h b/include/net/nfc/hci.h
new file mode 100644
index 000000000000..4467c9460857
--- /dev/null
+++ b/include/net/nfc/hci.h
@@ -0,0 +1,196 @@
1/*
2 * Copyright (C) 2011 Intel Corporation. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the
16 * Free Software Foundation, Inc.,
17 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 */
19
20#ifndef __NET_HCI_H
21#define __NET_HCI_H
22
23#include <linux/skbuff.h>
24
25#include <net/nfc/nfc.h>
26
27struct nfc_hci_dev;
28
29struct nfc_hci_ops {
30 int (*open) (struct nfc_hci_dev *hdev);
31 void (*close) (struct nfc_hci_dev *hdev);
32 int (*hci_ready) (struct nfc_hci_dev *hdev);
33 int (*xmit) (struct nfc_hci_dev *hdev, struct sk_buff *skb);
34 int (*start_poll) (struct nfc_hci_dev *hdev, u32 protocols);
35 int (*target_from_gate) (struct nfc_hci_dev *hdev, u8 gate,
36 struct nfc_target *target);
37 int (*complete_target_discovered) (struct nfc_hci_dev *hdev, u8 gate,
38 struct nfc_target *target);
39 int (*data_exchange) (struct nfc_hci_dev *hdev,
40 struct nfc_target *target,
41 struct sk_buff *skb, struct sk_buff **res_skb);
42 int (*check_presence)(struct nfc_hci_dev *hdev,
43 struct nfc_target *target);
44};
45
46#define NFC_HCI_MAX_CUSTOM_GATES 15
47struct nfc_hci_init_data {
48 u8 gate_count;
49 u8 gates[NFC_HCI_MAX_CUSTOM_GATES];
50 char session_id[9];
51};
52
53typedef int (*xmit) (struct sk_buff *skb, void *cb_data);
54
55#define NFC_HCI_MAX_GATES 256
56
57struct nfc_hci_dev {
58 struct nfc_dev *ndev;
59
60 u32 max_data_link_payload;
61
62 struct mutex msg_tx_mutex;
63
64 struct list_head msg_tx_queue;
65
66 struct workqueue_struct *msg_tx_wq;
67 struct work_struct msg_tx_work;
68
69 struct timer_list cmd_timer;
70 struct hci_msg *cmd_pending_msg;
71
72 struct sk_buff_head rx_hcp_frags;
73
74 struct workqueue_struct *msg_rx_wq;
75 struct work_struct msg_rx_work;
76
77 struct sk_buff_head msg_rx_queue;
78
79 struct nfc_hci_ops *ops;
80
81 struct nfc_hci_init_data init_data;
82
83 void *clientdata;
84
85 u8 gate2pipe[NFC_HCI_MAX_GATES];
86
87 u8 sw_romlib;
88 u8 sw_patch;
89 u8 sw_flashlib_major;
90 u8 sw_flashlib_minor;
91
92 u8 hw_derivative;
93 u8 hw_version;
94 u8 hw_mpw;
95 u8 hw_software;
96 u8 hw_bsid;
97};
98
99/* hci device allocation */
100struct nfc_hci_dev *nfc_hci_allocate_device(struct nfc_hci_ops *ops,
101 struct nfc_hci_init_data *init_data,
102 u32 protocols,
103 int tx_headroom,
104 int tx_tailroom,
105 int max_link_payload);
106void nfc_hci_free_device(struct nfc_hci_dev *hdev);
107
108int nfc_hci_register_device(struct nfc_hci_dev *hdev);
109void nfc_hci_unregister_device(struct nfc_hci_dev *hdev);
110
111void nfc_hci_set_clientdata(struct nfc_hci_dev *hdev, void *clientdata);
112void *nfc_hci_get_clientdata(struct nfc_hci_dev *hdev);
113
114/* Host IDs */
115#define NFC_HCI_HOST_CONTROLLER_ID 0x00
116#define NFC_HCI_TERMINAL_HOST_ID 0x01
117#define NFC_HCI_UICC_HOST_ID 0x02
118
119/* Host Controller Gates and registry indexes */
120#define NFC_HCI_ADMIN_GATE 0x00
121#define NFC_HCI_ADMIN_SESSION_IDENTITY 0x01
122#define NFC_HCI_ADMIN_MAX_PIPE 0x02
123#define NFC_HCI_ADMIN_WHITELIST 0x03
124#define NFC_HCI_ADMIN_HOST_LIST 0x04
125
126#define NFC_HCI_LOOPBACK_GATE 0x04
127
128#define NFC_HCI_ID_MGMT_GATE 0x05
129#define NFC_HCI_ID_MGMT_VERSION_SW 0x01
130#define NFC_HCI_ID_MGMT_VERSION_HW 0x03
131#define NFC_HCI_ID_MGMT_VENDOR_NAME 0x04
132#define NFC_HCI_ID_MGMT_MODEL_ID 0x05
133#define NFC_HCI_ID_MGMT_HCI_VERSION 0x02
134#define NFC_HCI_ID_MGMT_GATES_LIST 0x06
135
136#define NFC_HCI_LINK_MGMT_GATE 0x06
137#define NFC_HCI_LINK_MGMT_REC_ERROR 0x01
138
139#define NFC_HCI_RF_READER_B_GATE 0x11
140#define NFC_HCI_RF_READER_B_PUPI 0x03
141#define NFC_HCI_RF_READER_B_APPLICATION_DATA 0x04
142#define NFC_HCI_RF_READER_B_AFI 0x02
143#define NFC_HCI_RF_READER_B_HIGHER_LAYER_RESPONSE 0x01
144#define NFC_HCI_RF_READER_B_HIGHER_LAYER_DATA 0x05
145
146#define NFC_HCI_RF_READER_A_GATE 0x13
147#define NFC_HCI_RF_READER_A_UID 0x02
148#define NFC_HCI_RF_READER_A_ATQA 0x04
149#define NFC_HCI_RF_READER_A_APPLICATION_DATA 0x05
150#define NFC_HCI_RF_READER_A_SAK 0x03
151#define NFC_HCI_RF_READER_A_FWI_SFGT 0x06
152#define NFC_HCI_RF_READER_A_DATARATE_MAX 0x01
153
154#define NFC_HCI_TYPE_A_SEL_PROT(x) (((x) & 0x60) >> 5)
155#define NFC_HCI_TYPE_A_SEL_PROT_MIFARE 0
156#define NFC_HCI_TYPE_A_SEL_PROT_ISO14443 1
157#define NFC_HCI_TYPE_A_SEL_PROT_DEP 2
158#define NFC_HCI_TYPE_A_SEL_PROT_ISO14443_DEP 3
159
160/* Generic events */
161#define NFC_HCI_EVT_HCI_END_OF_OPERATION 0x01
162#define NFC_HCI_EVT_POST_DATA 0x02
163#define NFC_HCI_EVT_HOT_PLUG 0x03
164
165/* Reader RF gates events */
166#define NFC_HCI_EVT_READER_REQUESTED 0x10
167#define NFC_HCI_EVT_END_OPERATION 0x11
168
169/* Reader Application gate events */
170#define NFC_HCI_EVT_TARGET_DISCOVERED 0x10
171
172/* receiving messages from lower layer */
173void nfc_hci_resp_received(struct nfc_hci_dev *hdev, u8 result,
174 struct sk_buff *skb);
175void nfc_hci_cmd_received(struct nfc_hci_dev *hdev, u8 pipe, u8 cmd,
176 struct sk_buff *skb);
177void nfc_hci_event_received(struct nfc_hci_dev *hdev, u8 pipe, u8 event,
178 struct sk_buff *skb);
179void nfc_hci_recv_frame(struct nfc_hci_dev *hdev, struct sk_buff *skb);
180
181/* connecting to gates and sending hci instructions */
182int nfc_hci_connect_gate(struct nfc_hci_dev *hdev, u8 dest_host, u8 dest_gate);
183int nfc_hci_disconnect_gate(struct nfc_hci_dev *hdev, u8 gate);
184int nfc_hci_disconnect_all_gates(struct nfc_hci_dev *hdev);
185int nfc_hci_get_param(struct nfc_hci_dev *hdev, u8 gate, u8 idx,
186 struct sk_buff **skb);
187int nfc_hci_set_param(struct nfc_hci_dev *hdev, u8 gate, u8 idx,
188 const u8 *param, size_t param_len);
189int nfc_hci_send_cmd(struct nfc_hci_dev *hdev, u8 gate, u8 cmd,
190 const u8 *param, size_t param_len, struct sk_buff **skb);
191int nfc_hci_send_response(struct nfc_hci_dev *hdev, u8 gate, u8 response,
192 const u8 *param, size_t param_len);
193int nfc_hci_send_event(struct nfc_hci_dev *hdev, u8 gate, u8 event,
194 const u8 *param, size_t param_len);
195
196#endif /* __NET_HCI_H */
diff --git a/include/net/nfc/nfc.h b/include/net/nfc/nfc.h
index bac070bf3514..b7ca4a2a1d72 100644
--- a/include/net/nfc/nfc.h
+++ b/include/net/nfc/nfc.h
@@ -48,20 +48,24 @@ struct nfc_dev;
48typedef void (*data_exchange_cb_t)(void *context, struct sk_buff *skb, 48typedef void (*data_exchange_cb_t)(void *context, struct sk_buff *skb,
49 int err); 49 int err);
50 50
51struct nfc_target;
52
51struct nfc_ops { 53struct nfc_ops {
52 int (*dev_up)(struct nfc_dev *dev); 54 int (*dev_up)(struct nfc_dev *dev);
53 int (*dev_down)(struct nfc_dev *dev); 55 int (*dev_down)(struct nfc_dev *dev);
54 int (*start_poll)(struct nfc_dev *dev, u32 protocols); 56 int (*start_poll)(struct nfc_dev *dev, u32 protocols);
55 void (*stop_poll)(struct nfc_dev *dev); 57 void (*stop_poll)(struct nfc_dev *dev);
56 int (*dep_link_up)(struct nfc_dev *dev, int target_idx, u8 comm_mode, 58 int (*dep_link_up)(struct nfc_dev *dev, struct nfc_target *target,
57 u8 *gb, size_t gb_len); 59 u8 comm_mode, u8 *gb, size_t gb_len);
58 int (*dep_link_down)(struct nfc_dev *dev); 60 int (*dep_link_down)(struct nfc_dev *dev);
59 int (*activate_target)(struct nfc_dev *dev, u32 target_idx, 61 int (*activate_target)(struct nfc_dev *dev, struct nfc_target *target,
60 u32 protocol); 62 u32 protocol);
61 void (*deactivate_target)(struct nfc_dev *dev, u32 target_idx); 63 void (*deactivate_target)(struct nfc_dev *dev,
62 int (*data_exchange)(struct nfc_dev *dev, u32 target_idx, 64 struct nfc_target *target);
65 int (*data_exchange)(struct nfc_dev *dev, struct nfc_target *target,
63 struct sk_buff *skb, data_exchange_cb_t cb, 66 struct sk_buff *skb, data_exchange_cb_t cb,
64 void *cb_context); 67 void *cb_context);
68 int (*check_presence)(struct nfc_dev *dev, struct nfc_target *target);
65}; 69};
66 70
67#define NFC_TARGET_IDX_ANY -1 71#define NFC_TARGET_IDX_ANY -1
@@ -78,6 +82,8 @@ struct nfc_target {
78 u8 sensb_res[NFC_SENSB_RES_MAXSIZE]; 82 u8 sensb_res[NFC_SENSB_RES_MAXSIZE];
79 u8 sensf_res_len; 83 u8 sensf_res_len;
80 u8 sensf_res[NFC_SENSF_RES_MAXSIZE]; 84 u8 sensf_res[NFC_SENSF_RES_MAXSIZE];
85 u8 hci_reader_gate;
86 u8 logical_idx;
81}; 87};
82 88
83struct nfc_genl_data { 89struct nfc_genl_data {
@@ -86,15 +92,15 @@ struct nfc_genl_data {
86}; 92};
87 93
88struct nfc_dev { 94struct nfc_dev {
89 unsigned idx; 95 unsigned int idx;
96 u32 target_next_idx;
90 struct nfc_target *targets; 97 struct nfc_target *targets;
91 int n_targets; 98 int n_targets;
92 int targets_generation; 99 int targets_generation;
93 spinlock_t targets_lock;
94 struct device dev; 100 struct device dev;
95 bool dev_up; 101 bool dev_up;
96 bool polling; 102 bool polling;
97 bool remote_activated; 103 struct nfc_target *active_target;
98 bool dep_link_up; 104 bool dep_link_up;
99 u32 dep_rf_mode; 105 u32 dep_rf_mode;
100 struct nfc_genl_data genl_data; 106 struct nfc_genl_data genl_data;
@@ -103,6 +109,10 @@ struct nfc_dev {
103 int tx_headroom; 109 int tx_headroom;
104 int tx_tailroom; 110 int tx_tailroom;
105 111
112 struct timer_list check_pres_timer;
113 struct workqueue_struct *check_pres_wq;
114 struct work_struct check_pres_work;
115
106 struct nfc_ops *ops; 116 struct nfc_ops *ops;
107}; 117};
108#define to_nfc_dev(_dev) container_of(_dev, struct nfc_dev, dev) 118#define to_nfc_dev(_dev) container_of(_dev, struct nfc_dev, dev)
@@ -181,6 +191,7 @@ int nfc_set_remote_general_bytes(struct nfc_dev *dev,
181 191
182int nfc_targets_found(struct nfc_dev *dev, 192int nfc_targets_found(struct nfc_dev *dev,
183 struct nfc_target *targets, int ntargets); 193 struct nfc_target *targets, int ntargets);
194int nfc_target_lost(struct nfc_dev *dev, u32 target_idx);
184 195
185int nfc_dep_link_is_up(struct nfc_dev *dev, u32 target_idx, 196int nfc_dep_link_is_up(struct nfc_dev *dev, u32 target_idx,
186 u8 comm_mode, u8 rf_mode); 197 u8 comm_mode, u8 rf_mode);
diff --git a/include/net/nfc/shdlc.h b/include/net/nfc/shdlc.h
new file mode 100644
index 000000000000..ab06afd462da
--- /dev/null
+++ b/include/net/nfc/shdlc.h
@@ -0,0 +1,106 @@
1/*
2 * Copyright (C) 2012 Intel Corporation. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the
16 * Free Software Foundation, Inc.,
17 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 */
19
20#ifndef __NFC_SHDLC_H
21#define __NFC_SHDLC_H
22
23struct nfc_shdlc;
24
25struct nfc_shdlc_ops {
26 int (*open) (struct nfc_shdlc *shdlc);
27 void (*close) (struct nfc_shdlc *shdlc);
28 int (*hci_ready) (struct nfc_shdlc *shdlc);
29 int (*xmit) (struct nfc_shdlc *shdlc, struct sk_buff *skb);
30 int (*start_poll) (struct nfc_shdlc *shdlc, u32 protocols);
31 int (*target_from_gate) (struct nfc_shdlc *shdlc, u8 gate,
32 struct nfc_target *target);
33 int (*complete_target_discovered) (struct nfc_shdlc *shdlc, u8 gate,
34 struct nfc_target *target);
35 int (*data_exchange) (struct nfc_shdlc *shdlc,
36 struct nfc_target *target,
37 struct sk_buff *skb, struct sk_buff **res_skb);
38 int (*check_presence)(struct nfc_shdlc *shdlc,
39 struct nfc_target *target);
40};
41
42enum shdlc_state {
43 SHDLC_DISCONNECTED = 0,
44 SHDLC_CONNECTING = 1,
45 SHDLC_NEGOCIATING = 2,
46 SHDLC_CONNECTED = 3
47};
48
49struct nfc_shdlc {
50 struct mutex state_mutex;
51 enum shdlc_state state;
52 int hard_fault;
53
54 struct nfc_hci_dev *hdev;
55
56 wait_queue_head_t *connect_wq;
57 int connect_tries;
58 int connect_result;
59 struct timer_list connect_timer;/* aka T3 in spec 10.6.1 */
60
61 u8 w; /* window size */
62 bool srej_support;
63
64 struct timer_list t1_timer; /* send ack timeout */
65 bool t1_active;
66
67 struct timer_list t2_timer; /* guard/retransmit timeout */
68 bool t2_active;
69
70 int ns; /* next seq num for send */
71 int nr; /* next expected seq num for receive */
72 int dnr; /* oldest sent unacked seq num */
73
74 struct sk_buff_head rcv_q;
75
76 struct sk_buff_head send_q;
77 bool rnr; /* other side is not ready to receive */
78
79 struct sk_buff_head ack_pending_q;
80
81 struct workqueue_struct *sm_wq;
82 struct work_struct sm_work;
83
84 struct nfc_shdlc_ops *ops;
85
86 int client_headroom;
87 int client_tailroom;
88
89 void *clientdata;
90};
91
92void nfc_shdlc_recv_frame(struct nfc_shdlc *shdlc, struct sk_buff *skb);
93
94struct nfc_shdlc *nfc_shdlc_allocate(struct nfc_shdlc_ops *ops,
95 struct nfc_hci_init_data *init_data,
96 u32 protocols,
97 int tx_headroom, int tx_tailroom,
98 int max_link_payload, const char *devname);
99
100void nfc_shdlc_free(struct nfc_shdlc *shdlc);
101
102void nfc_shdlc_set_clientdata(struct nfc_shdlc *shdlc, void *clientdata);
103void *nfc_shdlc_get_clientdata(struct nfc_shdlc *shdlc);
104struct nfc_hci_dev *nfc_shdlc_get_hci_dev(struct nfc_shdlc *shdlc);
105
106#endif /* __NFC_SHDLC_H */
diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h
index fffdc603f4c8..66f5ac370f92 100644
--- a/include/net/pkt_sched.h
+++ b/include/net/pkt_sched.h
@@ -107,7 +107,7 @@ extern int tc_classify(struct sk_buff *skb, const struct tcf_proto *tp,
107/* Calculate maximal size of packet seen by hard_start_xmit 107/* Calculate maximal size of packet seen by hard_start_xmit
108 routine of this device. 108 routine of this device.
109 */ 109 */
110static inline unsigned psched_mtu(const struct net_device *dev) 110static inline unsigned int psched_mtu(const struct net_device *dev)
111{ 111{
112 return dev->mtu + dev->hard_header_len; 112 return dev->mtu + dev->hard_header_len;
113} 113}
diff --git a/include/net/rawv6.h b/include/net/rawv6.h
index cf7577234457..e7ea660e4db6 100644
--- a/include/net/rawv6.h
+++ b/include/net/rawv6.h
@@ -5,7 +5,7 @@
5 5
6void raw6_icmp_error(struct sk_buff *, int nexthdr, 6void raw6_icmp_error(struct sk_buff *, int nexthdr,
7 u8 type, u8 code, int inner_offset, __be32); 7 u8 type, u8 code, int inner_offset, __be32);
8int raw6_local_deliver(struct sk_buff *, int); 8bool raw6_local_deliver(struct sk_buff *, int);
9 9
10extern int rawv6_rcv(struct sock *sk, 10extern int rawv6_rcv(struct sock *sk,
11 struct sk_buff *skb); 11 struct sk_buff *skb);
diff --git a/include/net/route.h b/include/net/route.h
index b1c0d5b564c2..ed2b78e2375d 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -50,7 +50,7 @@ struct rtable {
50 __be32 rt_key_src; 50 __be32 rt_key_src;
51 51
52 int rt_genid; 52 int rt_genid;
53 unsigned rt_flags; 53 unsigned int rt_flags;
54 __u16 rt_type; 54 __u16 rt_type;
55 __u8 rt_key_tos; 55 __u8 rt_key_tos;
56 56
@@ -185,8 +185,8 @@ extern unsigned short ip_rt_frag_needed(struct net *net, const struct iphdr *iph
185 unsigned short new_mtu, struct net_device *dev); 185 unsigned short new_mtu, struct net_device *dev);
186extern void ip_rt_send_redirect(struct sk_buff *skb); 186extern void ip_rt_send_redirect(struct sk_buff *skb);
187 187
188extern unsigned inet_addr_type(struct net *net, __be32 addr); 188extern unsigned int inet_addr_type(struct net *net, __be32 addr);
189extern unsigned inet_dev_addr_type(struct net *net, const struct net_device *dev, __be32 addr); 189extern unsigned int inet_dev_addr_type(struct net *net, const struct net_device *dev, __be32 addr);
190extern void ip_rt_multicast_event(struct in_device *); 190extern void ip_rt_multicast_event(struct in_device *);
191extern int ip_rt_ioctl(struct net *, unsigned int cmd, void __user *arg); 191extern int ip_rt_ioctl(struct net *, unsigned int cmd, void __user *arg);
192extern void ip_rt_get_source(u8 *src, struct sk_buff *skb, struct rtable *rt); 192extern void ip_rt_get_source(u8 *src, struct sk_buff *skb, struct rtable *rt);
diff --git a/include/net/rtnetlink.h b/include/net/rtnetlink.h
index 370293901971..bbcfd0993432 100644
--- a/include/net/rtnetlink.h
+++ b/include/net/rtnetlink.h
@@ -41,9 +41,11 @@ static inline int rtnl_msg_family(const struct nlmsghdr *nlh)
41 * @get_size: Function to calculate required room for dumping device 41 * @get_size: Function to calculate required room for dumping device
42 * specific netlink attributes 42 * specific netlink attributes
43 * @fill_info: Function to dump device specific netlink attributes 43 * @fill_info: Function to dump device specific netlink attributes
44 * @get_xstats_size: Function to calculate required room for dumping devic 44 * @get_xstats_size: Function to calculate required room for dumping device
45 * specific statistics 45 * specific statistics
46 * @fill_xstats: Function to dump device specific statistics 46 * @fill_xstats: Function to dump device specific statistics
47 * @get_tx_queues: Function to determine number of transmit queues to create when
48 * creating a new device.
47 */ 49 */
48struct rtnl_link_ops { 50struct rtnl_link_ops {
49 struct list_head list; 51 struct list_head list;
@@ -75,9 +77,8 @@ struct rtnl_link_ops {
75 size_t (*get_xstats_size)(const struct net_device *dev); 77 size_t (*get_xstats_size)(const struct net_device *dev);
76 int (*fill_xstats)(struct sk_buff *skb, 78 int (*fill_xstats)(struct sk_buff *skb,
77 const struct net_device *dev); 79 const struct net_device *dev);
78 int (*get_tx_queues)(struct net *net, struct nlattr *tb[], 80 int (*get_tx_queues)(struct net *net,
79 unsigned int *tx_queues, 81 struct nlattr *tb[]);
80 unsigned int *real_tx_queues);
81}; 82};
82 83
83extern int __rtnl_link_register(struct rtnl_link_ops *ops); 84extern int __rtnl_link_register(struct rtnl_link_ops *ops);
@@ -94,7 +95,7 @@ extern void rtnl_link_unregister(struct rtnl_link_ops *ops);
94 * @fill_link_af: Function to fill IFLA_AF_SPEC with address family 95 * @fill_link_af: Function to fill IFLA_AF_SPEC with address family
95 * specific netlink attributes. 96 * specific netlink attributes.
96 * @get_link_af_size: Function to calculate size of address family specific 97 * @get_link_af_size: Function to calculate size of address family specific
97 * netlink attributes exlusive the container attribute. 98 * netlink attributes.
98 * @validate_link_af: Validate a IFLA_AF_SPEC attribute, must check attr 99 * @validate_link_af: Validate a IFLA_AF_SPEC attribute, must check attr
99 * for invalid configuration settings. 100 * for invalid configuration settings.
100 * @set_link_af: Function to parse a IFLA_AF_SPEC attribute and modify 101 * @set_link_af: Function to parse a IFLA_AF_SPEC attribute and modify
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index 6ee44b24864a..a2ef81466b00 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -704,4 +704,17 @@ static inline void sctp_v4_map_v6(union sctp_addr *addr)
704 addr->v6.sin6_addr.s6_addr32[2] = htonl(0x0000ffff); 704 addr->v6.sin6_addr.s6_addr32[2] = htonl(0x0000ffff);
705} 705}
706 706
707/* The cookie is always 0 since this is how it's used in the
708 * pmtu code.
709 */
710static inline struct dst_entry *sctp_transport_dst_check(struct sctp_transport *t)
711{
712 if (t->dst && !dst_check(t->dst, 0)) {
713 dst_release(t->dst);
714 t->dst = NULL;
715 }
716
717 return t->dst;
718}
719
707#endif /* __net_sctp_h__ */ 720#endif /* __net_sctp_h__ */
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index 88949a994538..e4652fe58958 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -1145,10 +1145,10 @@ struct sctp_outq {
1145 /* Data pending that has never been transmitted. */ 1145 /* Data pending that has never been transmitted. */
1146 struct list_head out_chunk_list; 1146 struct list_head out_chunk_list;
1147 1147
1148 unsigned out_qlen; /* Total length of queued data chunks. */ 1148 unsigned int out_qlen; /* Total length of queued data chunks. */
1149 1149
1150 /* Error of send failed, may used in SCTP_SEND_FAILED event. */ 1150 /* Error of send failed, may used in SCTP_SEND_FAILED event. */
1151 unsigned error; 1151 unsigned int error;
1152 1152
1153 /* These are control chunks we want to send. */ 1153 /* These are control chunks we want to send. */
1154 struct list_head control_chunk_list; 1154 struct list_head control_chunk_list;
@@ -2000,8 +2000,8 @@ void sctp_assoc_update(struct sctp_association *old,
2000__u32 sctp_association_get_next_tsn(struct sctp_association *); 2000__u32 sctp_association_get_next_tsn(struct sctp_association *);
2001 2001
2002void sctp_assoc_sync_pmtu(struct sctp_association *); 2002void sctp_assoc_sync_pmtu(struct sctp_association *);
2003void sctp_assoc_rwnd_increase(struct sctp_association *, unsigned); 2003void sctp_assoc_rwnd_increase(struct sctp_association *, unsigned int);
2004void sctp_assoc_rwnd_decrease(struct sctp_association *, unsigned); 2004void sctp_assoc_rwnd_decrease(struct sctp_association *, unsigned int);
2005void sctp_assoc_set_primary(struct sctp_association *, 2005void sctp_assoc_set_primary(struct sctp_association *,
2006 struct sctp_transport *); 2006 struct sctp_transport *);
2007void sctp_assoc_del_nonprimary_peers(struct sctp_association *, 2007void sctp_assoc_del_nonprimary_peers(struct sctp_association *,
diff --git a/include/net/sock.h b/include/net/sock.h
index 188532ee88b6..d89f0582b6b6 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -70,16 +70,16 @@
70struct cgroup; 70struct cgroup;
71struct cgroup_subsys; 71struct cgroup_subsys;
72#ifdef CONFIG_NET 72#ifdef CONFIG_NET
73int mem_cgroup_sockets_init(struct cgroup *cgrp, struct cgroup_subsys *ss); 73int mem_cgroup_sockets_init(struct mem_cgroup *memcg, struct cgroup_subsys *ss);
74void mem_cgroup_sockets_destroy(struct cgroup *cgrp); 74void mem_cgroup_sockets_destroy(struct mem_cgroup *memcg);
75#else 75#else
76static inline 76static inline
77int mem_cgroup_sockets_init(struct cgroup *cgrp, struct cgroup_subsys *ss) 77int mem_cgroup_sockets_init(struct mem_cgroup *memcg, struct cgroup_subsys *ss)
78{ 78{
79 return 0; 79 return 0;
80} 80}
81static inline 81static inline
82void mem_cgroup_sockets_destroy(struct cgroup *cgrp) 82void mem_cgroup_sockets_destroy(struct mem_cgroup *memcg)
83{ 83{
84} 84}
85#endif 85#endif
@@ -97,7 +97,7 @@ void mem_cgroup_sockets_destroy(struct cgroup *cgrp)
97#else 97#else
98/* Validate arguments and do nothing */ 98/* Validate arguments and do nothing */
99static inline __printf(2, 3) 99static inline __printf(2, 3)
100void SOCK_DEBUG(struct sock *sk, const char *msg, ...) 100void SOCK_DEBUG(const struct sock *sk, const char *msg, ...)
101{ 101{
102} 102}
103#endif 103#endif
@@ -372,11 +372,22 @@ struct sock {
372 void (*sk_data_ready)(struct sock *sk, int bytes); 372 void (*sk_data_ready)(struct sock *sk, int bytes);
373 void (*sk_write_space)(struct sock *sk); 373 void (*sk_write_space)(struct sock *sk);
374 void (*sk_error_report)(struct sock *sk); 374 void (*sk_error_report)(struct sock *sk);
375 int (*sk_backlog_rcv)(struct sock *sk, 375 int (*sk_backlog_rcv)(struct sock *sk,
376 struct sk_buff *skb); 376 struct sk_buff *skb);
377 void (*sk_destruct)(struct sock *sk); 377 void (*sk_destruct)(struct sock *sk);
378}; 378};
379 379
380/*
381 * SK_CAN_REUSE and SK_NO_REUSE on a socket mean that the socket is OK
382 * or not whether his port will be reused by someone else. SK_FORCE_REUSE
383 * on a socket means that the socket will reuse everybody else's port
384 * without looking at the other's sk_reuse value.
385 */
386
387#define SK_NO_REUSE 0
388#define SK_CAN_REUSE 1
389#define SK_FORCE_REUSE 2
390
380static inline int sk_peek_offset(struct sock *sk, int flags) 391static inline int sk_peek_offset(struct sock *sk, int flags)
381{ 392{
382 if ((flags & MSG_PEEK) && (sk->sk_peek_off >= 0)) 393 if ((flags & MSG_PEEK) && (sk->sk_peek_off >= 0))
@@ -443,40 +454,40 @@ static inline struct sock *sk_nulls_next(const struct sock *sk)
443 NULL; 454 NULL;
444} 455}
445 456
446static inline int sk_unhashed(const struct sock *sk) 457static inline bool sk_unhashed(const struct sock *sk)
447{ 458{
448 return hlist_unhashed(&sk->sk_node); 459 return hlist_unhashed(&sk->sk_node);
449} 460}
450 461
451static inline int sk_hashed(const struct sock *sk) 462static inline bool sk_hashed(const struct sock *sk)
452{ 463{
453 return !sk_unhashed(sk); 464 return !sk_unhashed(sk);
454} 465}
455 466
456static __inline__ void sk_node_init(struct hlist_node *node) 467static inline void sk_node_init(struct hlist_node *node)
457{ 468{
458 node->pprev = NULL; 469 node->pprev = NULL;
459} 470}
460 471
461static __inline__ void sk_nulls_node_init(struct hlist_nulls_node *node) 472static inline void sk_nulls_node_init(struct hlist_nulls_node *node)
462{ 473{
463 node->pprev = NULL; 474 node->pprev = NULL;
464} 475}
465 476
466static __inline__ void __sk_del_node(struct sock *sk) 477static inline void __sk_del_node(struct sock *sk)
467{ 478{
468 __hlist_del(&sk->sk_node); 479 __hlist_del(&sk->sk_node);
469} 480}
470 481
471/* NB: equivalent to hlist_del_init_rcu */ 482/* NB: equivalent to hlist_del_init_rcu */
472static __inline__ int __sk_del_node_init(struct sock *sk) 483static inline bool __sk_del_node_init(struct sock *sk)
473{ 484{
474 if (sk_hashed(sk)) { 485 if (sk_hashed(sk)) {
475 __sk_del_node(sk); 486 __sk_del_node(sk);
476 sk_node_init(&sk->sk_node); 487 sk_node_init(&sk->sk_node);
477 return 1; 488 return true;
478 } 489 }
479 return 0; 490 return false;
480} 491}
481 492
482/* Grab socket reference count. This operation is valid only 493/* Grab socket reference count. This operation is valid only
@@ -498,9 +509,9 @@ static inline void __sock_put(struct sock *sk)
498 atomic_dec(&sk->sk_refcnt); 509 atomic_dec(&sk->sk_refcnt);
499} 510}
500 511
501static __inline__ int sk_del_node_init(struct sock *sk) 512static inline bool sk_del_node_init(struct sock *sk)
502{ 513{
503 int rc = __sk_del_node_init(sk); 514 bool rc = __sk_del_node_init(sk);
504 515
505 if (rc) { 516 if (rc) {
506 /* paranoid for a while -acme */ 517 /* paranoid for a while -acme */
@@ -511,18 +522,18 @@ static __inline__ int sk_del_node_init(struct sock *sk)
511} 522}
512#define sk_del_node_init_rcu(sk) sk_del_node_init(sk) 523#define sk_del_node_init_rcu(sk) sk_del_node_init(sk)
513 524
514static __inline__ int __sk_nulls_del_node_init_rcu(struct sock *sk) 525static inline bool __sk_nulls_del_node_init_rcu(struct sock *sk)
515{ 526{
516 if (sk_hashed(sk)) { 527 if (sk_hashed(sk)) {
517 hlist_nulls_del_init_rcu(&sk->sk_nulls_node); 528 hlist_nulls_del_init_rcu(&sk->sk_nulls_node);
518 return 1; 529 return true;
519 } 530 }
520 return 0; 531 return false;
521} 532}
522 533
523static __inline__ int sk_nulls_del_node_init_rcu(struct sock *sk) 534static inline bool sk_nulls_del_node_init_rcu(struct sock *sk)
524{ 535{
525 int rc = __sk_nulls_del_node_init_rcu(sk); 536 bool rc = __sk_nulls_del_node_init_rcu(sk);
526 537
527 if (rc) { 538 if (rc) {
528 /* paranoid for a while -acme */ 539 /* paranoid for a while -acme */
@@ -532,40 +543,40 @@ static __inline__ int sk_nulls_del_node_init_rcu(struct sock *sk)
532 return rc; 543 return rc;
533} 544}
534 545
535static __inline__ void __sk_add_node(struct sock *sk, struct hlist_head *list) 546static inline void __sk_add_node(struct sock *sk, struct hlist_head *list)
536{ 547{
537 hlist_add_head(&sk->sk_node, list); 548 hlist_add_head(&sk->sk_node, list);
538} 549}
539 550
540static __inline__ void sk_add_node(struct sock *sk, struct hlist_head *list) 551static inline void sk_add_node(struct sock *sk, struct hlist_head *list)
541{ 552{
542 sock_hold(sk); 553 sock_hold(sk);
543 __sk_add_node(sk, list); 554 __sk_add_node(sk, list);
544} 555}
545 556
546static __inline__ void sk_add_node_rcu(struct sock *sk, struct hlist_head *list) 557static inline void sk_add_node_rcu(struct sock *sk, struct hlist_head *list)
547{ 558{
548 sock_hold(sk); 559 sock_hold(sk);
549 hlist_add_head_rcu(&sk->sk_node, list); 560 hlist_add_head_rcu(&sk->sk_node, list);
550} 561}
551 562
552static __inline__ void __sk_nulls_add_node_rcu(struct sock *sk, struct hlist_nulls_head *list) 563static inline void __sk_nulls_add_node_rcu(struct sock *sk, struct hlist_nulls_head *list)
553{ 564{
554 hlist_nulls_add_head_rcu(&sk->sk_nulls_node, list); 565 hlist_nulls_add_head_rcu(&sk->sk_nulls_node, list);
555} 566}
556 567
557static __inline__ void sk_nulls_add_node_rcu(struct sock *sk, struct hlist_nulls_head *list) 568static inline void sk_nulls_add_node_rcu(struct sock *sk, struct hlist_nulls_head *list)
558{ 569{
559 sock_hold(sk); 570 sock_hold(sk);
560 __sk_nulls_add_node_rcu(sk, list); 571 __sk_nulls_add_node_rcu(sk, list);
561} 572}
562 573
563static __inline__ void __sk_del_bind_node(struct sock *sk) 574static inline void __sk_del_bind_node(struct sock *sk)
564{ 575{
565 __hlist_del(&sk->sk_bind_node); 576 __hlist_del(&sk->sk_bind_node);
566} 577}
567 578
568static __inline__ void sk_add_bind_node(struct sock *sk, 579static inline void sk_add_bind_node(struct sock *sk,
569 struct hlist_head *list) 580 struct hlist_head *list)
570{ 581{
571 hlist_add_head(&sk->sk_bind_node, list); 582 hlist_add_head(&sk->sk_bind_node, list);
@@ -639,7 +650,7 @@ static inline void sock_reset_flag(struct sock *sk, enum sock_flags flag)
639 __clear_bit(flag, &sk->sk_flags); 650 __clear_bit(flag, &sk->sk_flags);
640} 651}
641 652
642static inline int sock_flag(struct sock *sk, enum sock_flags flag) 653static inline bool sock_flag(const struct sock *sk, enum sock_flags flag)
643{ 654{
644 return test_bit(flag, &sk->sk_flags); 655 return test_bit(flag, &sk->sk_flags);
645} 656}
@@ -654,7 +665,7 @@ static inline void sk_acceptq_added(struct sock *sk)
654 sk->sk_ack_backlog++; 665 sk->sk_ack_backlog++;
655} 666}
656 667
657static inline int sk_acceptq_is_full(struct sock *sk) 668static inline bool sk_acceptq_is_full(const struct sock *sk)
658{ 669{
659 return sk->sk_ack_backlog > sk->sk_max_ack_backlog; 670 return sk->sk_ack_backlog > sk->sk_max_ack_backlog;
660} 671}
@@ -662,19 +673,19 @@ static inline int sk_acceptq_is_full(struct sock *sk)
662/* 673/*
663 * Compute minimal free write space needed to queue new packets. 674 * Compute minimal free write space needed to queue new packets.
664 */ 675 */
665static inline int sk_stream_min_wspace(struct sock *sk) 676static inline int sk_stream_min_wspace(const struct sock *sk)
666{ 677{
667 return sk->sk_wmem_queued >> 1; 678 return sk->sk_wmem_queued >> 1;
668} 679}
669 680
670static inline int sk_stream_wspace(struct sock *sk) 681static inline int sk_stream_wspace(const struct sock *sk)
671{ 682{
672 return sk->sk_sndbuf - sk->sk_wmem_queued; 683 return sk->sk_sndbuf - sk->sk_wmem_queued;
673} 684}
674 685
675extern void sk_stream_write_space(struct sock *sk); 686extern void sk_stream_write_space(struct sock *sk);
676 687
677static inline int sk_stream_memory_free(struct sock *sk) 688static inline bool sk_stream_memory_free(const struct sock *sk)
678{ 689{
679 return sk->sk_wmem_queued < sk->sk_sndbuf; 690 return sk->sk_wmem_queued < sk->sk_sndbuf;
680} 691}
@@ -699,17 +710,19 @@ static inline void __sk_add_backlog(struct sock *sk, struct sk_buff *skb)
699 * Do not take into account this skb truesize, 710 * Do not take into account this skb truesize,
700 * to allow even a single big packet to come. 711 * to allow even a single big packet to come.
701 */ 712 */
702static inline bool sk_rcvqueues_full(const struct sock *sk, const struct sk_buff *skb) 713static inline bool sk_rcvqueues_full(const struct sock *sk, const struct sk_buff *skb,
714 unsigned int limit)
703{ 715{
704 unsigned int qsize = sk->sk_backlog.len + atomic_read(&sk->sk_rmem_alloc); 716 unsigned int qsize = sk->sk_backlog.len + atomic_read(&sk->sk_rmem_alloc);
705 717
706 return qsize > sk->sk_rcvbuf; 718 return qsize > limit;
707} 719}
708 720
709/* The per-socket spinlock must be held here. */ 721/* The per-socket spinlock must be held here. */
710static inline __must_check int sk_add_backlog(struct sock *sk, struct sk_buff *skb) 722static inline __must_check int sk_add_backlog(struct sock *sk, struct sk_buff *skb,
723 unsigned int limit)
711{ 724{
712 if (sk_rcvqueues_full(sk, skb)) 725 if (sk_rcvqueues_full(sk, skb, limit))
713 return -ENOBUFS; 726 return -ENOBUFS;
714 727
715 __sk_add_backlog(sk, skb); 728 __sk_add_backlog(sk, skb);
@@ -796,26 +809,26 @@ struct module;
796 * transport -> network interface is defined by struct inet_proto 809 * transport -> network interface is defined by struct inet_proto
797 */ 810 */
798struct proto { 811struct proto {
799 void (*close)(struct sock *sk, 812 void (*close)(struct sock *sk,
800 long timeout); 813 long timeout);
801 int (*connect)(struct sock *sk, 814 int (*connect)(struct sock *sk,
802 struct sockaddr *uaddr, 815 struct sockaddr *uaddr,
803 int addr_len); 816 int addr_len);
804 int (*disconnect)(struct sock *sk, int flags); 817 int (*disconnect)(struct sock *sk, int flags);
805 818
806 struct sock * (*accept) (struct sock *sk, int flags, int *err); 819 struct sock * (*accept)(struct sock *sk, int flags, int *err);
807 820
808 int (*ioctl)(struct sock *sk, int cmd, 821 int (*ioctl)(struct sock *sk, int cmd,
809 unsigned long arg); 822 unsigned long arg);
810 int (*init)(struct sock *sk); 823 int (*init)(struct sock *sk);
811 void (*destroy)(struct sock *sk); 824 void (*destroy)(struct sock *sk);
812 void (*shutdown)(struct sock *sk, int how); 825 void (*shutdown)(struct sock *sk, int how);
813 int (*setsockopt)(struct sock *sk, int level, 826 int (*setsockopt)(struct sock *sk, int level,
814 int optname, char __user *optval, 827 int optname, char __user *optval,
815 unsigned int optlen); 828 unsigned int optlen);
816 int (*getsockopt)(struct sock *sk, int level, 829 int (*getsockopt)(struct sock *sk, int level,
817 int optname, char __user *optval, 830 int optname, char __user *optval,
818 int __user *option); 831 int __user *option);
819#ifdef CONFIG_COMPAT 832#ifdef CONFIG_COMPAT
820 int (*compat_setsockopt)(struct sock *sk, 833 int (*compat_setsockopt)(struct sock *sk,
821 int level, 834 int level,
@@ -832,14 +845,14 @@ struct proto {
832 struct msghdr *msg, size_t len); 845 struct msghdr *msg, size_t len);
833 int (*recvmsg)(struct kiocb *iocb, struct sock *sk, 846 int (*recvmsg)(struct kiocb *iocb, struct sock *sk,
834 struct msghdr *msg, 847 struct msghdr *msg,
835 size_t len, int noblock, int flags, 848 size_t len, int noblock, int flags,
836 int *addr_len); 849 int *addr_len);
837 int (*sendpage)(struct sock *sk, struct page *page, 850 int (*sendpage)(struct sock *sk, struct page *page,
838 int offset, size_t size, int flags); 851 int offset, size_t size, int flags);
839 int (*bind)(struct sock *sk, 852 int (*bind)(struct sock *sk,
840 struct sockaddr *uaddr, int addr_len); 853 struct sockaddr *uaddr, int addr_len);
841 854
842 int (*backlog_rcv) (struct sock *sk, 855 int (*backlog_rcv) (struct sock *sk,
843 struct sk_buff *skb); 856 struct sk_buff *skb);
844 857
845 /* Keeping track of sk's, looking them up, and port selection methods. */ 858 /* Keeping track of sk's, looking them up, and port selection methods. */
@@ -901,9 +914,9 @@ struct proto {
901 * This function has to setup any files the protocol want to 914 * This function has to setup any files the protocol want to
902 * appear in the kmem cgroup filesystem. 915 * appear in the kmem cgroup filesystem.
903 */ 916 */
904 int (*init_cgroup)(struct cgroup *cgrp, 917 int (*init_cgroup)(struct mem_cgroup *memcg,
905 struct cgroup_subsys *ss); 918 struct cgroup_subsys *ss);
906 void (*destroy_cgroup)(struct cgroup *cgrp); 919 void (*destroy_cgroup)(struct mem_cgroup *memcg);
907 struct cg_proto *(*proto_cgroup)(struct mem_cgroup *memcg); 920 struct cg_proto *(*proto_cgroup)(struct mem_cgroup *memcg);
908#endif 921#endif
909}; 922};
@@ -1129,9 +1142,9 @@ sk_sockets_allocated_read_positive(struct sock *sk)
1129 struct proto *prot = sk->sk_prot; 1142 struct proto *prot = sk->sk_prot;
1130 1143
1131 if (mem_cgroup_sockets_enabled && sk->sk_cgrp) 1144 if (mem_cgroup_sockets_enabled && sk->sk_cgrp)
1132 return percpu_counter_sum_positive(sk->sk_cgrp->sockets_allocated); 1145 return percpu_counter_read_positive(sk->sk_cgrp->sockets_allocated);
1133 1146
1134 return percpu_counter_sum_positive(prot->sockets_allocated); 1147 return percpu_counter_read_positive(prot->sockets_allocated);
1135} 1148}
1136 1149
1137static inline int 1150static inline int
@@ -1160,7 +1173,7 @@ proto_memory_pressure(struct proto *prot)
1160extern void sock_prot_inuse_add(struct net *net, struct proto *prot, int inc); 1173extern void sock_prot_inuse_add(struct net *net, struct proto *prot, int inc);
1161extern int sock_prot_inuse_get(struct net *net, struct proto *proto); 1174extern int sock_prot_inuse_get(struct net *net, struct proto *proto);
1162#else 1175#else
1163static void inline sock_prot_inuse_add(struct net *net, struct proto *prot, 1176static inline void sock_prot_inuse_add(struct net *net, struct proto *prot,
1164 int inc) 1177 int inc)
1165{ 1178{
1166} 1179}
@@ -1247,24 +1260,24 @@ static inline int sk_mem_pages(int amt)
1247 return (amt + SK_MEM_QUANTUM - 1) >> SK_MEM_QUANTUM_SHIFT; 1260 return (amt + SK_MEM_QUANTUM - 1) >> SK_MEM_QUANTUM_SHIFT;
1248} 1261}
1249 1262
1250static inline int sk_has_account(struct sock *sk) 1263static inline bool sk_has_account(struct sock *sk)
1251{ 1264{
1252 /* return true if protocol supports memory accounting */ 1265 /* return true if protocol supports memory accounting */
1253 return !!sk->sk_prot->memory_allocated; 1266 return !!sk->sk_prot->memory_allocated;
1254} 1267}
1255 1268
1256static inline int sk_wmem_schedule(struct sock *sk, int size) 1269static inline bool sk_wmem_schedule(struct sock *sk, int size)
1257{ 1270{
1258 if (!sk_has_account(sk)) 1271 if (!sk_has_account(sk))
1259 return 1; 1272 return true;
1260 return size <= sk->sk_forward_alloc || 1273 return size <= sk->sk_forward_alloc ||
1261 __sk_mem_schedule(sk, size, SK_MEM_SEND); 1274 __sk_mem_schedule(sk, size, SK_MEM_SEND);
1262} 1275}
1263 1276
1264static inline int sk_rmem_schedule(struct sock *sk, int size) 1277static inline bool sk_rmem_schedule(struct sock *sk, int size)
1265{ 1278{
1266 if (!sk_has_account(sk)) 1279 if (!sk_has_account(sk))
1267 return 1; 1280 return true;
1268 return size <= sk->sk_forward_alloc || 1281 return size <= sk->sk_forward_alloc ||
1269 __sk_mem_schedule(sk, size, SK_MEM_RECV); 1282 __sk_mem_schedule(sk, size, SK_MEM_RECV);
1270} 1283}
@@ -1329,7 +1342,7 @@ static inline void sk_wmem_free_skb(struct sock *sk, struct sk_buff *skb)
1329 * Mark both the sk_lock and the sk_lock.slock as a 1342 * Mark both the sk_lock and the sk_lock.slock as a
1330 * per-address-family lock class. 1343 * per-address-family lock class.
1331 */ 1344 */
1332#define sock_lock_init_class_and_name(sk, sname, skey, name, key) \ 1345#define sock_lock_init_class_and_name(sk, sname, skey, name, key) \
1333do { \ 1346do { \
1334 sk->sk_lock.owned = 0; \ 1347 sk->sk_lock.owned = 0; \
1335 init_waitqueue_head(&sk->sk_lock.wq); \ 1348 init_waitqueue_head(&sk->sk_lock.wq); \
@@ -1337,7 +1350,7 @@ do { \
1337 debug_check_no_locks_freed((void *)&(sk)->sk_lock, \ 1350 debug_check_no_locks_freed((void *)&(sk)->sk_lock, \
1338 sizeof((sk)->sk_lock)); \ 1351 sizeof((sk)->sk_lock)); \
1339 lockdep_set_class_and_name(&(sk)->sk_lock.slock, \ 1352 lockdep_set_class_and_name(&(sk)->sk_lock.slock, \
1340 (skey), (sname)); \ 1353 (skey), (sname)); \
1341 lockdep_init_map(&(sk)->sk_lock.dep_map, (name), (key), 0); \ 1354 lockdep_init_map(&(sk)->sk_lock.dep_map, (name), (key), 0); \
1342} while (0) 1355} while (0)
1343 1356
@@ -1397,13 +1410,13 @@ extern int sock_setsockopt(struct socket *sock, int level,
1397 unsigned int optlen); 1410 unsigned int optlen);
1398 1411
1399extern int sock_getsockopt(struct socket *sock, int level, 1412extern int sock_getsockopt(struct socket *sock, int level,
1400 int op, char __user *optval, 1413 int op, char __user *optval,
1401 int __user *optlen); 1414 int __user *optlen);
1402extern struct sk_buff *sock_alloc_send_skb(struct sock *sk, 1415extern struct sk_buff *sock_alloc_send_skb(struct sock *sk,
1403 unsigned long size, 1416 unsigned long size,
1404 int noblock, 1417 int noblock,
1405 int *errcode); 1418 int *errcode);
1406extern struct sk_buff *sock_alloc_send_pskb(struct sock *sk, 1419extern struct sk_buff *sock_alloc_send_pskb(struct sock *sk,
1407 unsigned long header_len, 1420 unsigned long header_len,
1408 unsigned long data_len, 1421 unsigned long data_len,
1409 int noblock, 1422 int noblock,
@@ -1425,7 +1438,7 @@ static inline void sock_update_classid(struct sock *sk)
1425 * Functions to fill in entries in struct proto_ops when a protocol 1438 * Functions to fill in entries in struct proto_ops when a protocol
1426 * does not implement a particular function. 1439 * does not implement a particular function.
1427 */ 1440 */
1428extern int sock_no_bind(struct socket *, 1441extern int sock_no_bind(struct socket *,
1429 struct sockaddr *, int); 1442 struct sockaddr *, int);
1430extern int sock_no_connect(struct socket *, 1443extern int sock_no_connect(struct socket *,
1431 struct sockaddr *, int, int); 1444 struct sockaddr *, int, int);
@@ -1454,7 +1467,7 @@ extern int sock_no_mmap(struct file *file,
1454 struct vm_area_struct *vma); 1467 struct vm_area_struct *vma);
1455extern ssize_t sock_no_sendpage(struct socket *sock, 1468extern ssize_t sock_no_sendpage(struct socket *sock,
1456 struct page *page, 1469 struct page *page,
1457 int offset, size_t size, 1470 int offset, size_t size,
1458 int flags); 1471 int flags);
1459 1472
1460/* 1473/*
@@ -1477,7 +1490,7 @@ extern void sk_common_release(struct sock *sk);
1477/* 1490/*
1478 * Default socket callbacks and setup code 1491 * Default socket callbacks and setup code
1479 */ 1492 */
1480 1493
1481/* Initialise core socket variables */ 1494/* Initialise core socket variables */
1482extern void sock_init_data(struct socket *sock, struct sock *sk); 1495extern void sock_init_data(struct socket *sock, struct sock *sk);
1483 1496
@@ -1677,7 +1690,7 @@ extern struct dst_entry *__sk_dst_check(struct sock *sk, u32 cookie);
1677 1690
1678extern struct dst_entry *sk_dst_check(struct sock *sk, u32 cookie); 1691extern struct dst_entry *sk_dst_check(struct sock *sk, u32 cookie);
1679 1692
1680static inline int sk_can_gso(const struct sock *sk) 1693static inline bool sk_can_gso(const struct sock *sk)
1681{ 1694{
1682 return net_gso_ok(sk->sk_route_caps, sk->sk_gso_type); 1695 return net_gso_ok(sk->sk_route_caps, sk->sk_gso_type);
1683} 1696}
@@ -1794,7 +1807,7 @@ static inline int sk_rmem_alloc_get(const struct sock *sk)
1794 * 1807 *
1795 * Returns true if socket has write or read allocations 1808 * Returns true if socket has write or read allocations
1796 */ 1809 */
1797static inline int sk_has_allocations(const struct sock *sk) 1810static inline bool sk_has_allocations(const struct sock *sk)
1798{ 1811{
1799 return sk_wmem_alloc_get(sk) || sk_rmem_alloc_get(sk); 1812 return sk_wmem_alloc_get(sk) || sk_rmem_alloc_get(sk);
1800} 1813}
@@ -1833,9 +1846,7 @@ static inline int sk_has_allocations(const struct sock *sk)
1833 */ 1846 */
1834static inline bool wq_has_sleeper(struct socket_wq *wq) 1847static inline bool wq_has_sleeper(struct socket_wq *wq)
1835{ 1848{
1836 1849 /* We need to be sure we are in sync with the
1837 /*
1838 * We need to be sure we are in sync with the
1839 * add_wait_queue modifications to the wait queue. 1850 * add_wait_queue modifications to the wait queue.
1840 * 1851 *
1841 * This memory barrier is paired in the sock_poll_wait. 1852 * This memory barrier is paired in the sock_poll_wait.
@@ -1857,22 +1868,21 @@ static inline void sock_poll_wait(struct file *filp,
1857{ 1868{
1858 if (!poll_does_not_wait(p) && wait_address) { 1869 if (!poll_does_not_wait(p) && wait_address) {
1859 poll_wait(filp, wait_address, p); 1870 poll_wait(filp, wait_address, p);
1860 /* 1871 /* We need to be sure we are in sync with the
1861 * We need to be sure we are in sync with the
1862 * socket flags modification. 1872 * socket flags modification.
1863 * 1873 *
1864 * This memory barrier is paired in the wq_has_sleeper. 1874 * This memory barrier is paired in the wq_has_sleeper.
1865 */ 1875 */
1866 smp_mb(); 1876 smp_mb();
1867 } 1877 }
1868} 1878}
1869 1879
1870/* 1880/*
1871 * Queue a received datagram if it will fit. Stream and sequenced 1881 * Queue a received datagram if it will fit. Stream and sequenced
1872 * protocols can't normally use this as they need to fit buffers in 1882 * protocols can't normally use this as they need to fit buffers in
1873 * and play with them. 1883 * and play with them.
1874 * 1884 *
1875 * Inlined as it's very short and called for pretty much every 1885 * Inlined as it's very short and called for pretty much every
1876 * packet ever received. 1886 * packet ever received.
1877 */ 1887 */
1878 1888
@@ -1898,10 +1908,10 @@ static inline void skb_set_owner_r(struct sk_buff *skb, struct sock *sk)
1898 sk_mem_charge(sk, skb->truesize); 1908 sk_mem_charge(sk, skb->truesize);
1899} 1909}
1900 1910
1901extern void sk_reset_timer(struct sock *sk, struct timer_list* timer, 1911extern void sk_reset_timer(struct sock *sk, struct timer_list *timer,
1902 unsigned long expires); 1912 unsigned long expires);
1903 1913
1904extern void sk_stop_timer(struct sock *sk, struct timer_list* timer); 1914extern void sk_stop_timer(struct sock *sk, struct timer_list *timer);
1905 1915
1906extern int sock_queue_rcv_skb(struct sock *sk, struct sk_buff *skb); 1916extern int sock_queue_rcv_skb(struct sock *sk, struct sk_buff *skb);
1907 1917
@@ -1910,7 +1920,7 @@ extern int sock_queue_err_skb(struct sock *sk, struct sk_buff *skb);
1910/* 1920/*
1911 * Recover an error report and clear atomically 1921 * Recover an error report and clear atomically
1912 */ 1922 */
1913 1923
1914static inline int sock_error(struct sock *sk) 1924static inline int sock_error(struct sock *sk)
1915{ 1925{
1916 int err; 1926 int err;
@@ -1926,7 +1936,7 @@ static inline unsigned long sock_wspace(struct sock *sk)
1926 1936
1927 if (!(sk->sk_shutdown & SEND_SHUTDOWN)) { 1937 if (!(sk->sk_shutdown & SEND_SHUTDOWN)) {
1928 amt = sk->sk_sndbuf - atomic_read(&sk->sk_wmem_alloc); 1938 amt = sk->sk_sndbuf - atomic_read(&sk->sk_wmem_alloc);
1929 if (amt < 0) 1939 if (amt < 0)
1930 amt = 0; 1940 amt = 0;
1931 } 1941 }
1932 return amt; 1942 return amt;
@@ -1970,7 +1980,7 @@ static inline struct page *sk_stream_alloc_page(struct sock *sk)
1970/* 1980/*
1971 * Default write policy as shown to user space via poll/select/SIGIO 1981 * Default write policy as shown to user space via poll/select/SIGIO
1972 */ 1982 */
1973static inline int sock_writeable(const struct sock *sk) 1983static inline bool sock_writeable(const struct sock *sk)
1974{ 1984{
1975 return atomic_read(&sk->sk_wmem_alloc) < (sk->sk_sndbuf >> 1); 1985 return atomic_read(&sk->sk_wmem_alloc) < (sk->sk_sndbuf >> 1);
1976} 1986}
@@ -1980,12 +1990,12 @@ static inline gfp_t gfp_any(void)
1980 return in_softirq() ? GFP_ATOMIC : GFP_KERNEL; 1990 return in_softirq() ? GFP_ATOMIC : GFP_KERNEL;
1981} 1991}
1982 1992
1983static inline long sock_rcvtimeo(const struct sock *sk, int noblock) 1993static inline long sock_rcvtimeo(const struct sock *sk, bool noblock)
1984{ 1994{
1985 return noblock ? 0 : sk->sk_rcvtimeo; 1995 return noblock ? 0 : sk->sk_rcvtimeo;
1986} 1996}
1987 1997
1988static inline long sock_sndtimeo(const struct sock *sk, int noblock) 1998static inline long sock_sndtimeo(const struct sock *sk, bool noblock)
1989{ 1999{
1990 return noblock ? 0 : sk->sk_sndtimeo; 2000 return noblock ? 0 : sk->sk_sndtimeo;
1991} 2001}
@@ -2008,7 +2018,7 @@ extern void __sock_recv_timestamp(struct msghdr *msg, struct sock *sk,
2008extern void __sock_recv_wifi_status(struct msghdr *msg, struct sock *sk, 2018extern void __sock_recv_wifi_status(struct msghdr *msg, struct sock *sk,
2009 struct sk_buff *skb); 2019 struct sk_buff *skb);
2010 2020
2011static __inline__ void 2021static inline void
2012sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb) 2022sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb)
2013{ 2023{
2014 ktime_t kt = skb->tstamp; 2024 ktime_t kt = skb->tstamp;
@@ -2049,7 +2059,7 @@ static inline void sock_recv_ts_and_drops(struct msghdr *msg, struct sock *sk,
2049 (1UL << SOCK_RCVTSTAMP) | \ 2059 (1UL << SOCK_RCVTSTAMP) | \
2050 (1UL << SOCK_TIMESTAMPING_RX_SOFTWARE) | \ 2060 (1UL << SOCK_TIMESTAMPING_RX_SOFTWARE) | \
2051 (1UL << SOCK_TIMESTAMPING_SOFTWARE) | \ 2061 (1UL << SOCK_TIMESTAMPING_SOFTWARE) | \
2052 (1UL << SOCK_TIMESTAMPING_RAW_HARDWARE) | \ 2062 (1UL << SOCK_TIMESTAMPING_RAW_HARDWARE) | \
2053 (1UL << SOCK_TIMESTAMPING_SYS_HARDWARE)) 2063 (1UL << SOCK_TIMESTAMPING_SYS_HARDWARE))
2054 2064
2055 if (sk->sk_flags & FLAGS_TS_OR_DROPS) 2065 if (sk->sk_flags & FLAGS_TS_OR_DROPS)
@@ -2078,7 +2088,7 @@ extern int sock_tx_timestamp(struct sock *sk, __u8 *tx_flags);
2078 * locked so that the sk_buff queue operation is ok. 2088 * locked so that the sk_buff queue operation is ok.
2079*/ 2089*/
2080#ifdef CONFIG_NET_DMA 2090#ifdef CONFIG_NET_DMA
2081static inline void sk_eat_skb(struct sock *sk, struct sk_buff *skb, int copied_early) 2091static inline void sk_eat_skb(struct sock *sk, struct sk_buff *skb, bool copied_early)
2082{ 2092{
2083 __skb_unlink(skb, &sk->sk_receive_queue); 2093 __skb_unlink(skb, &sk->sk_receive_queue);
2084 if (!copied_early) 2094 if (!copied_early)
@@ -2087,7 +2097,7 @@ static inline void sk_eat_skb(struct sock *sk, struct sk_buff *skb, int copied_e
2087 __skb_queue_tail(&sk->sk_async_wait_queue, skb); 2097 __skb_queue_tail(&sk->sk_async_wait_queue, skb);
2088} 2098}
2089#else 2099#else
2090static inline void sk_eat_skb(struct sock *sk, struct sk_buff *skb, int copied_early) 2100static inline void sk_eat_skb(struct sock *sk, struct sk_buff *skb, bool copied_early)
2091{ 2101{
2092 __skb_unlink(skb, &sk->sk_receive_queue); 2102 __skb_unlink(skb, &sk->sk_receive_queue);
2093 __kfree_skb(skb); 2103 __kfree_skb(skb);
@@ -2134,8 +2144,8 @@ extern void sock_enable_timestamp(struct sock *sk, int flag);
2134extern int sock_get_timestamp(struct sock *, struct timeval __user *); 2144extern int sock_get_timestamp(struct sock *, struct timeval __user *);
2135extern int sock_get_timestampns(struct sock *, struct timespec __user *); 2145extern int sock_get_timestampns(struct sock *, struct timespec __user *);
2136 2146
2137/* 2147/*
2138 * Enable debug/info messages 2148 * Enable debug/info messages
2139 */ 2149 */
2140extern int net_msg_warn; 2150extern int net_msg_warn;
2141#define NETDEBUG(fmt, args...) \ 2151#define NETDEBUG(fmt, args...) \
diff --git a/include/net/tcp.h b/include/net/tcp.h
index f75a04d752cb..e79aa48d9fc1 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -123,7 +123,7 @@ extern void tcp_time_wait(struct sock *sk, int state, int timeo);
123#endif 123#endif
124#define TCP_RTO_MAX ((unsigned)(120*HZ)) 124#define TCP_RTO_MAX ((unsigned)(120*HZ))
125#define TCP_RTO_MIN ((unsigned)(HZ/5)) 125#define TCP_RTO_MIN ((unsigned)(HZ/5))
126#define TCP_TIMEOUT_INIT ((unsigned)(1*HZ)) /* RFC2988bis initial RTO value */ 126#define TCP_TIMEOUT_INIT ((unsigned)(1*HZ)) /* RFC6298 2.1 initial RTO value */
127#define TCP_TIMEOUT_FALLBACK ((unsigned)(3*HZ)) /* RFC 1122 initial RTO value, now 127#define TCP_TIMEOUT_FALLBACK ((unsigned)(3*HZ)) /* RFC 1122 initial RTO value, now
128 * used as a fallback RTO for the 128 * used as a fallback RTO for the
129 * initial data transmission if no 129 * initial data transmission if no
@@ -252,6 +252,7 @@ extern int sysctl_tcp_max_ssthresh;
252extern int sysctl_tcp_cookie_size; 252extern int sysctl_tcp_cookie_size;
253extern int sysctl_tcp_thin_linear_timeouts; 253extern int sysctl_tcp_thin_linear_timeouts;
254extern int sysctl_tcp_thin_dupack; 254extern int sysctl_tcp_thin_dupack;
255extern int sysctl_tcp_early_retrans;
255 256
256extern atomic_long_t tcp_memory_allocated; 257extern atomic_long_t tcp_memory_allocated;
257extern struct percpu_counter tcp_sockets_allocated; 258extern struct percpu_counter tcp_sockets_allocated;
@@ -262,14 +263,14 @@ extern int tcp_memory_pressure;
262 * and worry about wraparound (automatic with unsigned arithmetic). 263 * and worry about wraparound (automatic with unsigned arithmetic).
263 */ 264 */
264 265
265static inline int before(__u32 seq1, __u32 seq2) 266static inline bool before(__u32 seq1, __u32 seq2)
266{ 267{
267 return (__s32)(seq1-seq2) < 0; 268 return (__s32)(seq1-seq2) < 0;
268} 269}
269#define after(seq2, seq1) before(seq1, seq2) 270#define after(seq2, seq1) before(seq1, seq2)
270 271
271/* is s2<=s1<=s3 ? */ 272/* is s2<=s1<=s3 ? */
272static inline int between(__u32 seq1, __u32 seq2, __u32 seq3) 273static inline bool between(__u32 seq1, __u32 seq2, __u32 seq3)
273{ 274{
274 return seq3 - seq2 >= seq1 - seq2; 275 return seq3 - seq2 >= seq1 - seq2;
275} 276}
@@ -304,7 +305,7 @@ static inline void tcp_synq_overflow(struct sock *sk)
304} 305}
305 306
306/* syncookies: no recent synqueue overflow on this listening socket? */ 307/* syncookies: no recent synqueue overflow on this listening socket? */
307static inline int tcp_synq_no_recent_overflow(const struct sock *sk) 308static inline bool tcp_synq_no_recent_overflow(const struct sock *sk)
308{ 309{
309 unsigned long last_overflow = tcp_sk(sk)->rx_opt.ts_recent_stamp; 310 unsigned long last_overflow = tcp_sk(sk)->rx_opt.ts_recent_stamp;
310 return time_after(jiffies, last_overflow + TCP_TIMEOUT_FALLBACK); 311 return time_after(jiffies, last_overflow + TCP_TIMEOUT_FALLBACK);
@@ -366,13 +367,6 @@ static inline void tcp_dec_quickack_mode(struct sock *sk,
366#define TCP_ECN_DEMAND_CWR 4 367#define TCP_ECN_DEMAND_CWR 4
367#define TCP_ECN_SEEN 8 368#define TCP_ECN_SEEN 8
368 369
369static __inline__ void
370TCP_ECN_create_request(struct request_sock *req, struct tcphdr *th)
371{
372 if (sysctl_tcp_ecn && th->ece && th->cwr)
373 inet_rsk(req)->ecn_ok = 1;
374}
375
376enum tcp_tw_status { 370enum tcp_tw_status {
377 TCP_TW_SUCCESS = 0, 371 TCP_TW_SUCCESS = 0,
378 TCP_TW_RST = 1, 372 TCP_TW_RST = 1,
@@ -389,12 +383,13 @@ extern struct sock * tcp_check_req(struct sock *sk,struct sk_buff *skb,
389 struct request_sock **prev); 383 struct request_sock **prev);
390extern int tcp_child_process(struct sock *parent, struct sock *child, 384extern int tcp_child_process(struct sock *parent, struct sock *child,
391 struct sk_buff *skb); 385 struct sk_buff *skb);
392extern int tcp_use_frto(struct sock *sk); 386extern bool tcp_use_frto(struct sock *sk);
393extern void tcp_enter_frto(struct sock *sk); 387extern void tcp_enter_frto(struct sock *sk);
394extern void tcp_enter_loss(struct sock *sk, int how); 388extern void tcp_enter_loss(struct sock *sk, int how);
395extern void tcp_clear_retrans(struct tcp_sock *tp); 389extern void tcp_clear_retrans(struct tcp_sock *tp);
396extern void tcp_update_metrics(struct sock *sk); 390extern void tcp_update_metrics(struct sock *sk);
397extern void tcp_close(struct sock *sk, long timeout); 391extern void tcp_close(struct sock *sk, long timeout);
392extern void tcp_init_sock(struct sock *sk);
398extern unsigned int tcp_poll(struct file * file, struct socket *sock, 393extern unsigned int tcp_poll(struct file * file, struct socket *sock,
399 struct poll_table_struct *wait); 394 struct poll_table_struct *wait);
400extern int tcp_getsockopt(struct sock *sk, int level, int optname, 395extern int tcp_getsockopt(struct sock *sk, int level, int optname,
@@ -435,6 +430,9 @@ extern struct sk_buff * tcp_make_synack(struct sock *sk, struct dst_entry *dst,
435 struct request_values *rvp); 430 struct request_values *rvp);
436extern int tcp_disconnect(struct sock *sk, int flags); 431extern int tcp_disconnect(struct sock *sk, int flags);
437 432
433void tcp_connect_init(struct sock *sk);
434void tcp_finish_connect(struct sock *sk, struct sk_buff *skb);
435int tcp_send_rcvq(struct sock *sk, struct msghdr *msg, size_t size);
438 436
439/* From syncookies.c */ 437/* From syncookies.c */
440extern __u32 syncookie_secret[2][16-4+SHA_DIGEST_WORDS]; 438extern __u32 syncookie_secret[2][16-4+SHA_DIGEST_WORDS];
@@ -472,7 +470,7 @@ static inline __u32 cookie_v6_init_sequence(struct sock *sk,
472 470
473extern void __tcp_push_pending_frames(struct sock *sk, unsigned int cur_mss, 471extern void __tcp_push_pending_frames(struct sock *sk, unsigned int cur_mss,
474 int nonagle); 472 int nonagle);
475extern int tcp_may_send_now(struct sock *sk); 473extern bool tcp_may_send_now(struct sock *sk);
476extern int tcp_retransmit_skb(struct sock *, struct sk_buff *); 474extern int tcp_retransmit_skb(struct sock *, struct sk_buff *);
477extern void tcp_retransmit_timer(struct sock *sk); 475extern void tcp_retransmit_timer(struct sock *sk);
478extern void tcp_xmit_retransmit_queue(struct sock *); 476extern void tcp_xmit_retransmit_queue(struct sock *);
@@ -486,15 +484,17 @@ extern int tcp_write_wakeup(struct sock *);
486extern void tcp_send_fin(struct sock *sk); 484extern void tcp_send_fin(struct sock *sk);
487extern void tcp_send_active_reset(struct sock *sk, gfp_t priority); 485extern void tcp_send_active_reset(struct sock *sk, gfp_t priority);
488extern int tcp_send_synack(struct sock *); 486extern int tcp_send_synack(struct sock *);
489extern int tcp_syn_flood_action(struct sock *sk, 487extern bool tcp_syn_flood_action(struct sock *sk,
490 const struct sk_buff *skb, 488 const struct sk_buff *skb,
491 const char *proto); 489 const char *proto);
492extern void tcp_push_one(struct sock *, unsigned int mss_now); 490extern void tcp_push_one(struct sock *, unsigned int mss_now);
493extern void tcp_send_ack(struct sock *sk); 491extern void tcp_send_ack(struct sock *sk);
494extern void tcp_send_delayed_ack(struct sock *sk); 492extern void tcp_send_delayed_ack(struct sock *sk);
495 493
496/* tcp_input.c */ 494/* tcp_input.c */
497extern void tcp_cwnd_application_limited(struct sock *sk); 495extern void tcp_cwnd_application_limited(struct sock *sk);
496extern void tcp_resume_early_retransmit(struct sock *sk);
497extern void tcp_rearm_rto(struct sock *sk);
498 498
499/* tcp_timer.c */ 499/* tcp_timer.c */
500extern void tcp_init_xmit_timers(struct sock *); 500extern void tcp_init_xmit_timers(struct sock *);
@@ -540,8 +540,8 @@ extern int tcp_read_sock(struct sock *sk, read_descriptor_t *desc,
540 540
541extern void tcp_initialize_rcv_mss(struct sock *sk); 541extern void tcp_initialize_rcv_mss(struct sock *sk);
542 542
543extern int tcp_mtu_to_mss(const struct sock *sk, int pmtu); 543extern int tcp_mtu_to_mss(struct sock *sk, int pmtu);
544extern int tcp_mss_to_mtu(const struct sock *sk, int mss); 544extern int tcp_mss_to_mtu(struct sock *sk, int mss);
545extern void tcp_mtup_init(struct sock *sk); 545extern void tcp_mtup_init(struct sock *sk);
546extern void tcp_valid_rtt_meas(struct sock *sk, u32 seq_rtt); 546extern void tcp_valid_rtt_meas(struct sock *sk, u32 seq_rtt);
547 547
@@ -609,6 +609,8 @@ static inline u32 tcp_receive_window(const struct tcp_sock *tp)
609 */ 609 */
610extern u32 __tcp_select_window(struct sock *sk); 610extern u32 __tcp_select_window(struct sock *sk);
611 611
612void tcp_send_window_probe(struct sock *sk);
613
612/* TCP timestamps are only 32-bits, this causes a slight 614/* TCP timestamps are only 32-bits, this causes a slight
613 * complication on 64-bit systems since we store a snapshot 615 * complication on 64-bit systems since we store a snapshot
614 * of jiffies in the buffer control blocks below. We decided 616 * of jiffies in the buffer control blocks below. We decided
@@ -645,21 +647,38 @@ struct tcp_skb_cb {
645 __u32 end_seq; /* SEQ + FIN + SYN + datalen */ 647 __u32 end_seq; /* SEQ + FIN + SYN + datalen */
646 __u32 when; /* used to compute rtt's */ 648 __u32 when; /* used to compute rtt's */
647 __u8 tcp_flags; /* TCP header flags. (tcp[13]) */ 649 __u8 tcp_flags; /* TCP header flags. (tcp[13]) */
650
648 __u8 sacked; /* State flags for SACK/FACK. */ 651 __u8 sacked; /* State flags for SACK/FACK. */
649#define TCPCB_SACKED_ACKED 0x01 /* SKB ACK'd by a SACK block */ 652#define TCPCB_SACKED_ACKED 0x01 /* SKB ACK'd by a SACK block */
650#define TCPCB_SACKED_RETRANS 0x02 /* SKB retransmitted */ 653#define TCPCB_SACKED_RETRANS 0x02 /* SKB retransmitted */
651#define TCPCB_LOST 0x04 /* SKB is lost */ 654#define TCPCB_LOST 0x04 /* SKB is lost */
652#define TCPCB_TAGBITS 0x07 /* All tag bits */ 655#define TCPCB_TAGBITS 0x07 /* All tag bits */
653 __u8 ip_dsfield; /* IPv4 tos or IPv6 dsfield */
654 /* 1 byte hole */
655#define TCPCB_EVER_RETRANS 0x80 /* Ever retransmitted frame */ 656#define TCPCB_EVER_RETRANS 0x80 /* Ever retransmitted frame */
656#define TCPCB_RETRANS (TCPCB_SACKED_RETRANS|TCPCB_EVER_RETRANS) 657#define TCPCB_RETRANS (TCPCB_SACKED_RETRANS|TCPCB_EVER_RETRANS)
657 658
659 __u8 ip_dsfield; /* IPv4 tos or IPv6 dsfield */
660 /* 1 byte hole */
658 __u32 ack_seq; /* Sequence number ACK'd */ 661 __u32 ack_seq; /* Sequence number ACK'd */
659}; 662};
660 663
661#define TCP_SKB_CB(__skb) ((struct tcp_skb_cb *)&((__skb)->cb[0])) 664#define TCP_SKB_CB(__skb) ((struct tcp_skb_cb *)&((__skb)->cb[0]))
662 665
666/* RFC3168 : 6.1.1 SYN packets must not have ECT/ECN bits set
667 *
668 * If we receive a SYN packet with these bits set, it means a network is
669 * playing bad games with TOS bits. In order to avoid possible false congestion
670 * notifications, we disable TCP ECN negociation.
671 */
672static inline void
673TCP_ECN_create_request(struct request_sock *req, const struct sk_buff *skb)
674{
675 const struct tcphdr *th = tcp_hdr(skb);
676
677 if (sysctl_tcp_ecn && th->ece && th->cwr &&
678 INET_ECN_is_not_ect(TCP_SKB_CB(skb)->ip_dsfield))
679 inet_rsk(req)->ecn_ok = 1;
680}
681
663/* Due to TSO, an SKB can be composed of multiple actual 682/* Due to TSO, an SKB can be composed of multiple actual
664 * packets. To keep these tracked properly, we use this. 683 * packets. To keep these tracked properly, we use this.
665 */ 684 */
@@ -775,12 +794,12 @@ static inline int tcp_is_sack(const struct tcp_sock *tp)
775 return tp->rx_opt.sack_ok; 794 return tp->rx_opt.sack_ok;
776} 795}
777 796
778static inline int tcp_is_reno(const struct tcp_sock *tp) 797static inline bool tcp_is_reno(const struct tcp_sock *tp)
779{ 798{
780 return !tcp_is_sack(tp); 799 return !tcp_is_sack(tp);
781} 800}
782 801
783static inline int tcp_is_fack(const struct tcp_sock *tp) 802static inline bool tcp_is_fack(const struct tcp_sock *tp)
784{ 803{
785 return tp->rx_opt.sack_ok & TCP_FACK_ENABLED; 804 return tp->rx_opt.sack_ok & TCP_FACK_ENABLED;
786} 805}
@@ -790,6 +809,21 @@ static inline void tcp_enable_fack(struct tcp_sock *tp)
790 tp->rx_opt.sack_ok |= TCP_FACK_ENABLED; 809 tp->rx_opt.sack_ok |= TCP_FACK_ENABLED;
791} 810}
792 811
812/* TCP early-retransmit (ER) is similar to but more conservative than
813 * the thin-dupack feature. Enable ER only if thin-dupack is disabled.
814 */
815static inline void tcp_enable_early_retrans(struct tcp_sock *tp)
816{
817 tp->do_early_retrans = sysctl_tcp_early_retrans &&
818 !sysctl_tcp_thin_dupack && sysctl_tcp_reordering == 3;
819 tp->early_retrans_delayed = 0;
820}
821
822static inline void tcp_disable_early_retrans(struct tcp_sock *tp)
823{
824 tp->do_early_retrans = 0;
825}
826
793static inline unsigned int tcp_left_out(const struct tcp_sock *tp) 827static inline unsigned int tcp_left_out(const struct tcp_sock *tp)
794{ 828{
795 return tp->sacked_out + tp->lost_out; 829 return tp->sacked_out + tp->lost_out;
@@ -867,7 +901,7 @@ static inline u32 tcp_wnd_end(const struct tcp_sock *tp)
867{ 901{
868 return tp->snd_una + tp->snd_wnd; 902 return tp->snd_una + tp->snd_wnd;
869} 903}
870extern int tcp_is_cwnd_limited(const struct sock *sk, u32 in_flight); 904extern bool tcp_is_cwnd_limited(const struct sock *sk, u32 in_flight);
871 905
872static inline void tcp_minshall_update(struct tcp_sock *tp, unsigned int mss, 906static inline void tcp_minshall_update(struct tcp_sock *tp, unsigned int mss,
873 const struct sk_buff *skb) 907 const struct sk_buff *skb)
@@ -910,7 +944,7 @@ static inline __sum16 __tcp_checksum_complete(struct sk_buff *skb)
910 return __skb_checksum_complete(skb); 944 return __skb_checksum_complete(skb);
911} 945}
912 946
913static inline int tcp_checksum_complete(struct sk_buff *skb) 947static inline bool tcp_checksum_complete(struct sk_buff *skb)
914{ 948{
915 return !skb_csum_unnecessary(skb) && 949 return !skb_csum_unnecessary(skb) &&
916 __tcp_checksum_complete(skb); 950 __tcp_checksum_complete(skb);
@@ -940,12 +974,12 @@ static inline void tcp_prequeue_init(struct tcp_sock *tp)
940 * 974 *
941 * NOTE: is this not too big to inline? 975 * NOTE: is this not too big to inline?
942 */ 976 */
943static inline int tcp_prequeue(struct sock *sk, struct sk_buff *skb) 977static inline bool tcp_prequeue(struct sock *sk, struct sk_buff *skb)
944{ 978{
945 struct tcp_sock *tp = tcp_sk(sk); 979 struct tcp_sock *tp = tcp_sk(sk);
946 980
947 if (sysctl_tcp_low_latency || !tp->ucopy.task) 981 if (sysctl_tcp_low_latency || !tp->ucopy.task)
948 return 0; 982 return false;
949 983
950 __skb_queue_tail(&tp->ucopy.prequeue, skb); 984 __skb_queue_tail(&tp->ucopy.prequeue, skb);
951 tp->ucopy.memory += skb->truesize; 985 tp->ucopy.memory += skb->truesize;
@@ -969,7 +1003,7 @@ static inline int tcp_prequeue(struct sock *sk, struct sk_buff *skb)
969 (3 * tcp_rto_min(sk)) / 4, 1003 (3 * tcp_rto_min(sk)) / 4,
970 TCP_RTO_MAX); 1004 TCP_RTO_MAX);
971 } 1005 }
972 return 1; 1006 return true;
973} 1007}
974 1008
975 1009
@@ -1074,28 +1108,28 @@ static inline int tcp_fin_time(const struct sock *sk)
1074 return fin_timeout; 1108 return fin_timeout;
1075} 1109}
1076 1110
1077static inline int tcp_paws_check(const struct tcp_options_received *rx_opt, 1111static inline bool tcp_paws_check(const struct tcp_options_received *rx_opt,
1078 int paws_win) 1112 int paws_win)
1079{ 1113{
1080 if ((s32)(rx_opt->ts_recent - rx_opt->rcv_tsval) <= paws_win) 1114 if ((s32)(rx_opt->ts_recent - rx_opt->rcv_tsval) <= paws_win)
1081 return 1; 1115 return true;
1082 if (unlikely(get_seconds() >= rx_opt->ts_recent_stamp + TCP_PAWS_24DAYS)) 1116 if (unlikely(get_seconds() >= rx_opt->ts_recent_stamp + TCP_PAWS_24DAYS))
1083 return 1; 1117 return true;
1084 /* 1118 /*
1085 * Some OSes send SYN and SYNACK messages with tsval=0 tsecr=0, 1119 * Some OSes send SYN and SYNACK messages with tsval=0 tsecr=0,
1086 * then following tcp messages have valid values. Ignore 0 value, 1120 * then following tcp messages have valid values. Ignore 0 value,
1087 * or else 'negative' tsval might forbid us to accept their packets. 1121 * or else 'negative' tsval might forbid us to accept their packets.
1088 */ 1122 */
1089 if (!rx_opt->ts_recent) 1123 if (!rx_opt->ts_recent)
1090 return 1; 1124 return true;
1091 return 0; 1125 return false;
1092} 1126}
1093 1127
1094static inline int tcp_paws_reject(const struct tcp_options_received *rx_opt, 1128static inline bool tcp_paws_reject(const struct tcp_options_received *rx_opt,
1095 int rst) 1129 int rst)
1096{ 1130{
1097 if (tcp_paws_check(rx_opt, 0)) 1131 if (tcp_paws_check(rx_opt, 0))
1098 return 0; 1132 return false;
1099 1133
1100 /* RST segments are not recommended to carry timestamp, 1134 /* RST segments are not recommended to carry timestamp,
1101 and, if they do, it is recommended to ignore PAWS because 1135 and, if they do, it is recommended to ignore PAWS because
@@ -1110,8 +1144,8 @@ static inline int tcp_paws_reject(const struct tcp_options_received *rx_opt,
1110 However, we can relax time bounds for RST segments to MSL. 1144 However, we can relax time bounds for RST segments to MSL.
1111 */ 1145 */
1112 if (rst && get_seconds() >= rx_opt->ts_recent_stamp + TCP_PAWS_MSL) 1146 if (rst && get_seconds() >= rx_opt->ts_recent_stamp + TCP_PAWS_MSL)
1113 return 0; 1147 return false;
1114 return 1; 1148 return true;
1115} 1149}
1116 1150
1117static inline void tcp_mib_init(struct net *net) 1151static inline void tcp_mib_init(struct net *net)
@@ -1226,7 +1260,7 @@ extern void tcp_put_md5sig_pool(void);
1226 1260
1227extern int tcp_md5_hash_header(struct tcp_md5sig_pool *, const struct tcphdr *); 1261extern int tcp_md5_hash_header(struct tcp_md5sig_pool *, const struct tcphdr *);
1228extern int tcp_md5_hash_skb_data(struct tcp_md5sig_pool *, const struct sk_buff *, 1262extern int tcp_md5_hash_skb_data(struct tcp_md5sig_pool *, const struct sk_buff *,
1229 unsigned header_len); 1263 unsigned int header_len);
1230extern int tcp_md5_hash_key(struct tcp_md5sig_pool *hp, 1264extern int tcp_md5_hash_key(struct tcp_md5sig_pool *hp,
1231 const struct tcp_md5sig_key *key); 1265 const struct tcp_md5sig_key *key);
1232 1266
@@ -1349,7 +1383,7 @@ static inline void tcp_unlink_write_queue(struct sk_buff *skb, struct sock *sk)
1349 __skb_unlink(skb, &sk->sk_write_queue); 1383 __skb_unlink(skb, &sk->sk_write_queue);
1350} 1384}
1351 1385
1352static inline int tcp_write_queue_empty(struct sock *sk) 1386static inline bool tcp_write_queue_empty(struct sock *sk)
1353{ 1387{
1354 return skb_queue_empty(&sk->sk_write_queue); 1388 return skb_queue_empty(&sk->sk_write_queue);
1355} 1389}
@@ -1406,7 +1440,7 @@ static inline void tcp_highest_sack_combine(struct sock *sk,
1406/* Determines whether this is a thin stream (which may suffer from 1440/* Determines whether this is a thin stream (which may suffer from
1407 * increased latency). Used to trigger latency-reducing mechanisms. 1441 * increased latency). Used to trigger latency-reducing mechanisms.
1408 */ 1442 */
1409static inline unsigned int tcp_stream_is_thin(struct tcp_sock *tp) 1443static inline bool tcp_stream_is_thin(struct tcp_sock *tp)
1410{ 1444{
1411 return tp->packets_out < 4 && !tcp_in_initial_slowstart(tp); 1445 return tp->packets_out < 4 && !tcp_in_initial_slowstart(tp);
1412} 1446}
diff --git a/include/net/tcp_memcontrol.h b/include/net/tcp_memcontrol.h
index 48410ff25c9e..7df18bc43a97 100644
--- a/include/net/tcp_memcontrol.h
+++ b/include/net/tcp_memcontrol.h
@@ -12,8 +12,8 @@ struct tcp_memcontrol {
12}; 12};
13 13
14struct cg_proto *tcp_proto_cgroup(struct mem_cgroup *memcg); 14struct cg_proto *tcp_proto_cgroup(struct mem_cgroup *memcg);
15int tcp_init_cgroup(struct cgroup *cgrp, struct cgroup_subsys *ss); 15int tcp_init_cgroup(struct mem_cgroup *memcg, struct cgroup_subsys *ss);
16void tcp_destroy_cgroup(struct cgroup *cgrp); 16void tcp_destroy_cgroup(struct mem_cgroup *memcg);
17unsigned long long tcp_max_memory(const struct mem_cgroup *memcg); 17unsigned long long tcp_max_memory(const struct mem_cgroup *memcg);
18void tcp_prot_mem(struct mem_cgroup *memcg, long val, int idx); 18void tcp_prot_mem(struct mem_cgroup *memcg, long val, int idx);
19#endif /* _TCP_MEMCG_H */ 19#endif /* _TCP_MEMCG_H */
diff --git a/include/net/udp.h b/include/net/udp.h
index 5d606d9da9e5..065f379c6503 100644
--- a/include/net/udp.h
+++ b/include/net/udp.h
@@ -81,7 +81,7 @@ struct udp_table {
81extern struct udp_table udp_table; 81extern struct udp_table udp_table;
82extern void udp_table_init(struct udp_table *, const char *); 82extern void udp_table_init(struct udp_table *, const char *);
83static inline struct udp_hslot *udp_hashslot(struct udp_table *table, 83static inline struct udp_hslot *udp_hashslot(struct udp_table *table,
84 struct net *net, unsigned num) 84 struct net *net, unsigned int num)
85{ 85{
86 return &table->hash[udp_hashfn(net, num, table->mask)]; 86 return &table->hash[udp_hashfn(net, num, table->mask)];
87} 87}
@@ -267,4 +267,8 @@ extern void udp_init(void);
267extern int udp4_ufo_send_check(struct sk_buff *skb); 267extern int udp4_ufo_send_check(struct sk_buff *skb);
268extern struct sk_buff *udp4_ufo_fragment(struct sk_buff *skb, 268extern struct sk_buff *udp4_ufo_fragment(struct sk_buff *skb,
269 netdev_features_t features); 269 netdev_features_t features);
270extern void udp_encap_enable(void);
271#if IS_ENABLED(CONFIG_IPV6)
272extern void udpv6_encap_enable(void);
273#endif
270#endif /* _UDP_H */ 274#endif /* _UDP_H */
diff --git a/include/net/wimax.h b/include/net/wimax.h
index 322ff4fbdb4a..bbb74f990cab 100644
--- a/include/net/wimax.h
+++ b/include/net/wimax.h
@@ -423,8 +423,8 @@ struct wimax_dev {
423 int (*op_reset)(struct wimax_dev *wimax_dev); 423 int (*op_reset)(struct wimax_dev *wimax_dev);
424 424
425 struct rfkill *rfkill; 425 struct rfkill *rfkill;
426 unsigned rf_hw; 426 unsigned int rf_hw;
427 unsigned rf_sw; 427 unsigned int rf_sw;
428 char name[32]; 428 char name[32];
429 429
430 struct dentry *debugfs_dentry; 430 struct dentry *debugfs_dentry;
diff --git a/include/net/wpan-phy.h b/include/net/wpan-phy.h
index ff27f1b078d1..b52bda8d13b1 100644
--- a/include/net/wpan-phy.h
+++ b/include/net/wpan-phy.h
@@ -25,6 +25,14 @@
25#include <linux/mutex.h> 25#include <linux/mutex.h>
26#include <linux/bug.h> 26#include <linux/bug.h>
27 27
28/* According to the IEEE 802.15.4 stadard the upper most significant bits of
29 * the 32-bit channel bitmaps shall be used as an integer value to specify 32
30 * possible channel pages. The lower 27 bits of the channel bit map shall be
31 * used as a bit mask to specify channel numbers within a channel page.
32 */
33#define WPAN_NUM_CHANNELS 27
34#define WPAN_NUM_PAGES 32
35
28struct wpan_phy { 36struct wpan_phy {
29 struct mutex pib_lock; 37 struct mutex pib_lock;
30 38
@@ -43,7 +51,7 @@ struct wpan_phy {
43 int idx; 51 int idx;
44 52
45 struct net_device *(*add_iface)(struct wpan_phy *phy, 53 struct net_device *(*add_iface)(struct wpan_phy *phy,
46 const char *name); 54 const char *name, int type);
47 void (*del_iface)(struct wpan_phy *phy, struct net_device *dev); 55 void (*del_iface)(struct wpan_phy *phy, struct net_device *dev);
48 56
49 char priv[0] __attribute__((__aligned__(NETDEV_ALIGN))); 57 char priv[0] __attribute__((__aligned__(NETDEV_ALIGN)));
diff --git a/include/net/x25.h b/include/net/x25.h
index a06119a05129..b4a8a8923128 100644
--- a/include/net/x25.h
+++ b/include/net/x25.h
@@ -305,7 +305,7 @@ static inline void x25_unregister_sysctl(void) {};
305#endif /* CONFIG_SYSCTL */ 305#endif /* CONFIG_SYSCTL */
306 306
307struct x25_skb_cb { 307struct x25_skb_cb {
308 unsigned flags; 308 unsigned int flags;
309}; 309};
310#define X25_SKB_CB(s) ((struct x25_skb_cb *) ((s)->cb)) 310#define X25_SKB_CB(s) ((struct x25_skb_cb *) ((s)->cb))
311 311
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 96239e78e621..e0a55df5bde8 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -886,15 +886,15 @@ __be16 xfrm_flowi_dport(const struct flowi *fl, const union flowi_uli *uli)
886 return port; 886 return port;
887} 887}
888 888
889extern int xfrm_selector_match(const struct xfrm_selector *sel, 889extern bool xfrm_selector_match(const struct xfrm_selector *sel,
890 const struct flowi *fl, 890 const struct flowi *fl,
891 unsigned short family); 891 unsigned short family);
892 892
893#ifdef CONFIG_SECURITY_NETWORK_XFRM 893#ifdef CONFIG_SECURITY_NETWORK_XFRM
894/* If neither has a context --> match 894/* If neither has a context --> match
895 * Otherwise, both must have a context and the sids, doi, alg must match 895 * Otherwise, both must have a context and the sids, doi, alg must match
896 */ 896 */
897static inline int xfrm_sec_ctx_match(struct xfrm_sec_ctx *s1, struct xfrm_sec_ctx *s2) 897static inline bool xfrm_sec_ctx_match(struct xfrm_sec_ctx *s1, struct xfrm_sec_ctx *s2)
898{ 898{
899 return ((!s1 && !s2) || 899 return ((!s1 && !s2) ||
900 (s1 && s2 && 900 (s1 && s2 &&
@@ -903,9 +903,9 @@ static inline int xfrm_sec_ctx_match(struct xfrm_sec_ctx *s1, struct xfrm_sec_ct
903 (s1->ctx_alg == s2->ctx_alg))); 903 (s1->ctx_alg == s2->ctx_alg)));
904} 904}
905#else 905#else
906static inline int xfrm_sec_ctx_match(struct xfrm_sec_ctx *s1, struct xfrm_sec_ctx *s2) 906static inline bool xfrm_sec_ctx_match(struct xfrm_sec_ctx *s1, struct xfrm_sec_ctx *s2)
907{ 907{
908 return 1; 908 return true;
909} 909}
910#endif 910#endif
911 911
@@ -1682,8 +1682,9 @@ static inline int xfrm_mark_get(struct nlattr **attrs, struct xfrm_mark *m)
1682 1682
1683static inline int xfrm_mark_put(struct sk_buff *skb, const struct xfrm_mark *m) 1683static inline int xfrm_mark_put(struct sk_buff *skb, const struct xfrm_mark *m)
1684{ 1684{
1685 if (m->m | m->v) 1685 if ((m->m | m->v) &&
1686 NLA_PUT(skb, XFRMA_MARK, sizeof(struct xfrm_mark), m); 1686 nla_put(skb, XFRMA_MARK, sizeof(struct xfrm_mark), m))
1687 goto nla_put_failure;
1687 return 0; 1688 return 0;
1688 1689
1689nla_put_failure: 1690nla_put_failure:
diff --git a/include/rdma/ib_mad.h b/include/rdma/ib_mad.h
index b513f57e1725..3d81b90cc315 100644
--- a/include/rdma/ib_mad.h
+++ b/include/rdma/ib_mad.h
@@ -160,7 +160,7 @@ struct ib_rmpp_hdr {
160 160
161typedef u64 __bitwise ib_sa_comp_mask; 161typedef u64 __bitwise ib_sa_comp_mask;
162 162
163#define IB_SA_COMP_MASK(n) ((__force ib_sa_comp_mask) cpu_to_be64(1ull << n)) 163#define IB_SA_COMP_MASK(n) ((__force ib_sa_comp_mask) cpu_to_be64(1ull << (n)))
164 164
165/* 165/*
166 * ib_sa_hdr and ib_sa_mad structures must be packed because they have 166 * ib_sa_hdr and ib_sa_mad structures must be packed because they have
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index c3cca5a4dacd..07996af8265a 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -605,7 +605,7 @@ enum ib_qp_type {
605 IB_QPT_UD, 605 IB_QPT_UD,
606 IB_QPT_RAW_IPV6, 606 IB_QPT_RAW_IPV6,
607 IB_QPT_RAW_ETHERTYPE, 607 IB_QPT_RAW_ETHERTYPE,
608 /* Save 8 for RAW_PACKET */ 608 IB_QPT_RAW_PACKET = 8,
609 IB_QPT_XRC_INI = 9, 609 IB_QPT_XRC_INI = 9,
610 IB_QPT_XRC_TGT, 610 IB_QPT_XRC_TGT,
611 IB_QPT_MAX 611 IB_QPT_MAX
@@ -964,7 +964,7 @@ struct ib_qp {
964 struct ib_srq *srq; 964 struct ib_srq *srq;
965 struct ib_xrcd *xrcd; /* XRC TGT QPs only */ 965 struct ib_xrcd *xrcd; /* XRC TGT QPs only */
966 struct list_head xrcd_list; 966 struct list_head xrcd_list;
967 atomic_t usecnt; /* count times opened */ 967 atomic_t usecnt; /* count times opened, mcast attaches */
968 struct list_head open_list; 968 struct list_head open_list;
969 struct ib_qp *real_qp; 969 struct ib_qp *real_qp;
970 struct ib_uobject *uobject; 970 struct ib_uobject *uobject;
diff --git a/include/scsi/iscsi_proto.h b/include/scsi/iscsi_proto.h
index 988ba06b3ad6..c1260d80ef30 100644
--- a/include/scsi/iscsi_proto.h
+++ b/include/scsi/iscsi_proto.h
@@ -661,6 +661,8 @@ struct iscsi_reject {
661 661
662#define ISCSI_DEF_TIME2WAIT 2 662#define ISCSI_DEF_TIME2WAIT 2
663 663
664#define ISCSI_NAME_LEN 224
665
664/************************* RFC 3720 End *****************************/ 666/************************* RFC 3720 End *****************************/
665 667
666#endif /* ISCSI_PROTO_H */ 668#endif /* ISCSI_PROTO_H */
diff --git a/include/scsi/libsas.h b/include/scsi/libsas.h
index 5f5ed1b8b41b..f4f1c96dca72 100644
--- a/include/scsi/libsas.h
+++ b/include/scsi/libsas.h
@@ -217,11 +217,29 @@ struct domain_device {
217 struct kref kref; 217 struct kref kref;
218}; 218};
219 219
220struct sas_discovery_event { 220struct sas_work {
221 struct list_head drain_node;
221 struct work_struct work; 222 struct work_struct work;
223};
224
225static inline void INIT_SAS_WORK(struct sas_work *sw, void (*fn)(struct work_struct *))
226{
227 INIT_WORK(&sw->work, fn);
228 INIT_LIST_HEAD(&sw->drain_node);
229}
230
231struct sas_discovery_event {
232 struct sas_work work;
222 struct asd_sas_port *port; 233 struct asd_sas_port *port;
223}; 234};
224 235
236static inline struct sas_discovery_event *to_sas_discovery_event(struct work_struct *work)
237{
238 struct sas_discovery_event *ev = container_of(work, typeof(*ev), work.work);
239
240 return ev;
241}
242
225struct sas_discovery { 243struct sas_discovery {
226 struct sas_discovery_event disc_work[DISC_NUM_EVENTS]; 244 struct sas_discovery_event disc_work[DISC_NUM_EVENTS];
227 unsigned long pending; 245 unsigned long pending;
@@ -244,7 +262,7 @@ struct asd_sas_port {
244 struct list_head destroy_list; 262 struct list_head destroy_list;
245 enum sas_linkrate linkrate; 263 enum sas_linkrate linkrate;
246 264
247 struct work_struct work; 265 struct sas_work work;
248 266
249/* public: */ 267/* public: */
250 int id; 268 int id;
@@ -270,10 +288,17 @@ struct asd_sas_port {
270}; 288};
271 289
272struct asd_sas_event { 290struct asd_sas_event {
273 struct work_struct work; 291 struct sas_work work;
274 struct asd_sas_phy *phy; 292 struct asd_sas_phy *phy;
275}; 293};
276 294
295static inline struct asd_sas_event *to_asd_sas_event(struct work_struct *work)
296{
297 struct asd_sas_event *ev = container_of(work, typeof(*ev), work.work);
298
299 return ev;
300}
301
277/* The phy pretty much is controlled by the LLDD. 302/* The phy pretty much is controlled by the LLDD.
278 * The class only reads those fields. 303 * The class only reads those fields.
279 */ 304 */
@@ -333,10 +358,17 @@ struct scsi_core {
333}; 358};
334 359
335struct sas_ha_event { 360struct sas_ha_event {
336 struct work_struct work; 361 struct sas_work work;
337 struct sas_ha_struct *ha; 362 struct sas_ha_struct *ha;
338}; 363};
339 364
365static inline struct sas_ha_event *to_sas_ha_event(struct work_struct *work)
366{
367 struct sas_ha_event *ev = container_of(work, typeof(*ev), work.work);
368
369 return ev;
370}
371
340enum sas_ha_state { 372enum sas_ha_state {
341 SAS_HA_REGISTERED, 373 SAS_HA_REGISTERED,
342 SAS_HA_DRAINING, 374 SAS_HA_DRAINING,
diff --git a/include/scsi/sas.h b/include/scsi/sas.h
index a577a833603d..be3eb0bf1ac0 100644
--- a/include/scsi/sas.h
+++ b/include/scsi/sas.h
@@ -103,6 +103,7 @@ enum sas_dev_type {
103}; 103};
104 104
105enum sas_protocol { 105enum sas_protocol {
106 SAS_PROTOCOL_NONE = 0,
106 SAS_PROTOCOL_SATA = 0x01, 107 SAS_PROTOCOL_SATA = 0x01,
107 SAS_PROTOCOL_SMP = 0x02, 108 SAS_PROTOCOL_SMP = 0x02,
108 SAS_PROTOCOL_STP = 0x04, 109 SAS_PROTOCOL_STP = 0x04,
diff --git a/include/scsi/sas_ata.h b/include/scsi/sas_ata.h
index cdccd2eb7b6c..77670e823ed8 100644
--- a/include/scsi/sas_ata.h
+++ b/include/scsi/sas_ata.h
@@ -37,7 +37,7 @@ static inline int dev_is_sata(struct domain_device *dev)
37} 37}
38 38
39int sas_get_ata_info(struct domain_device *dev, struct ex_phy *phy); 39int sas_get_ata_info(struct domain_device *dev, struct ex_phy *phy);
40int sas_ata_init_host_and_port(struct domain_device *found_dev); 40int sas_ata_init(struct domain_device *dev);
41void sas_ata_task_abort(struct sas_task *task); 41void sas_ata_task_abort(struct sas_task *task);
42void sas_ata_strategy_handler(struct Scsi_Host *shost); 42void sas_ata_strategy_handler(struct Scsi_Host *shost);
43void sas_ata_eh(struct Scsi_Host *shost, struct list_head *work_q, 43void sas_ata_eh(struct Scsi_Host *shost, struct list_head *work_q,
@@ -52,7 +52,7 @@ static inline int dev_is_sata(struct domain_device *dev)
52{ 52{
53 return 0; 53 return 0;
54} 54}
55static inline int sas_ata_init_host_and_port(struct domain_device *found_dev) 55static inline int sas_ata_init(struct domain_device *dev)
56{ 56{
57 return 0; 57 return 0;
58} 58}
diff --git a/include/sound/asound.h b/include/sound/asound.h
index a2e4ff5ba9e9..0876a1e76aef 100644
--- a/include/sound/asound.h
+++ b/include/sound/asound.h
@@ -70,6 +70,20 @@ struct snd_aes_iec958 {
70 70
71/**************************************************************************** 71/****************************************************************************
72 * * 72 * *
73 * CEA-861 Audio InfoFrame. Used in HDMI and DisplayPort *
74 * *
75 ****************************************************************************/
76
77struct snd_cea_861_aud_if {
78 unsigned char db1_ct_cc; /* coding type and channel count */
79 unsigned char db2_sf_ss; /* sample frequency and size */
80 unsigned char db3; /* not used, all zeros */
81 unsigned char db4_ca; /* channel allocation code */
82 unsigned char db5_dminh_lsv; /* downmix inhibit & level-shit values */
83};
84
85/****************************************************************************
86 * *
73 * Section for driver hardware dependent interface - /dev/snd/hw? * 87 * Section for driver hardware dependent interface - /dev/snd/hw? *
74 * * 88 * *
75 ****************************************************************************/ 89 ****************************************************************************/
diff --git a/include/sound/asoundef.h b/include/sound/asoundef.h
index 20ebf3298eba..bb05c02f89b0 100644
--- a/include/sound/asoundef.h
+++ b/include/sound/asoundef.h
@@ -170,6 +170,47 @@
170#define IEC958_AES5_CON_CGMSA_COPYNOMORE (2<<0) /* condition not be used */ 170#define IEC958_AES5_CON_CGMSA_COPYNOMORE (2<<0) /* condition not be used */
171#define IEC958_AES5_CON_CGMSA_COPYNEVER (3<<0) /* no copying is permitted */ 171#define IEC958_AES5_CON_CGMSA_COPYNEVER (3<<0) /* no copying is permitted */
172 172
173/****************************************************************************
174 * *
175 * CEA-861 Audio InfoFrame. Used in HDMI and DisplayPort *
176 * *
177 ****************************************************************************/
178#define CEA861_AUDIO_INFOFRAME_DB1CC (7<<0) /* mask - channel count */
179#define CEA861_AUDIO_INFOFRAME_DB1CT (0xf<<4) /* mask - coding type */
180#define CEA861_AUDIO_INFOFRAME_DB1CT_FROM_STREAM (0<<4) /* refer to stream */
181#define CEA861_AUDIO_INFOFRAME_DB1CT_IEC60958 (1<<4) /* IEC-60958 L-PCM */
182#define CEA861_AUDIO_INFOFRAME_DB1CT_AC3 (2<<4) /* AC-3 */
183#define CEA861_AUDIO_INFOFRAME_DB1CT_MPEG1 (3<<4) /* MPEG1 Layers 1 & 2 */
184#define CEA861_AUDIO_INFOFRAME_DB1CT_MP3 (4<<4) /* MPEG1 Layer 3 */
185#define CEA861_AUDIO_INFOFRAME_DB1CT_MPEG2_MULTICH (5<<4) /* MPEG2 Multichannel */
186#define CEA861_AUDIO_INFOFRAME_DB1CT_AAC (6<<4) /* AAC */
187#define CEA861_AUDIO_INFOFRAME_DB1CT_DTS (7<<4) /* DTS */
188#define CEA861_AUDIO_INFOFRAME_DB1CT_ATRAC (8<<4) /* ATRAC */
189#define CEA861_AUDIO_INFOFRAME_DB1CT_ONEBIT (9<<4) /* One Bit Audio */
190#define CEA861_AUDIO_INFOFRAME_DB1CT_DOLBY_DIG_PLUS (10<<4) /* Dolby Digital + */
191#define CEA861_AUDIO_INFOFRAME_DB1CT_DTS_HD (11<<4) /* DTS-HD */
192#define CEA861_AUDIO_INFOFRAME_DB1CT_MAT (12<<4) /* MAT (MLP) */
193#define CEA861_AUDIO_INFOFRAME_DB1CT_DST (13<<4) /* DST */
194#define CEA861_AUDIO_INFOFRAME_DB1CT_WMA_PRO (14<<4) /* WMA Pro */
195#define CEA861_AUDIO_INFOFRAME_DB2SF (7<<2) /* mask - sample frequency */
196#define CEA861_AUDIO_INFOFRAME_DB2SF_FROM_STREAM (0<<2) /* refer to stream */
197#define CEA861_AUDIO_INFOFRAME_DB2SF_32000 (1<<2) /* 32kHz */
198#define CEA861_AUDIO_INFOFRAME_DB2SF_44100 (2<<2) /* 44.1kHz */
199#define CEA861_AUDIO_INFOFRAME_DB2SF_48000 (3<<2) /* 48kHz */
200#define CEA861_AUDIO_INFOFRAME_DB2SF_88200 (4<<2) /* 88.2kHz */
201#define CEA861_AUDIO_INFOFRAME_DB2SF_96000 (5<<2) /* 96kHz */
202#define CEA861_AUDIO_INFOFRAME_DB2SF_176400 (6<<2) /* 176.4kHz */
203#define CEA861_AUDIO_INFOFRAME_DB2SF_192000 (7<<2) /* 192kHz */
204#define CEA861_AUDIO_INFOFRAME_DB2SS (3<<0) /* mask - sample size */
205#define CEA861_AUDIO_INFOFRAME_DB2SS_FROM_STREAM (0<<0) /* refer to stream */
206#define CEA861_AUDIO_INFOFRAME_DB2SS_16BIT (1<<0) /* 16 bits */
207#define CEA861_AUDIO_INFOFRAME_DB2SS_20BIT (2<<0) /* 20 bits */
208#define CEA861_AUDIO_INFOFRAME_DB2SS_24BIT (3<<0) /* 24 bits */
209#define CEA861_AUDIO_INFOFRAME_DB5_DM_INH (1<<7) /* mask - inhibit downmixing */
210#define CEA861_AUDIO_INFOFRAME_DB5_DM_INH_PERMITTED (0<<7) /* stereo downmix permitted */
211#define CEA861_AUDIO_INFOFRAME_DB5_DM_INH_PROHIBITED (1<<7) /* stereo downmis prohibited */
212#define CEA861_AUDIO_INFOFRAME_DB5_LSV (0xf<<3) /* mask - level-shift values */
213
173/***************************************************************************** 214/*****************************************************************************
174 * * 215 * *
175 * MIDI v1.0 interface * 216 * MIDI v1.0 interface *
diff --git a/include/sound/cs42l52.h b/include/sound/cs42l52.h
new file mode 100644
index 000000000000..4c68955f7330
--- /dev/null
+++ b/include/sound/cs42l52.h
@@ -0,0 +1,36 @@
1/*
2 * linux/sound/cs42l52.h -- Platform data for CS42L52
3 *
4 * Copyright (c) 2012 Cirrus Logic Inc.
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 __CS42L52_H
12#define __CS42L52_H
13
14struct cs42l52_platform_data {
15
16 /* MICBIAS Level. Check datasheet Pg48 */
17 unsigned int micbias_lvl;
18
19 /* MICA mode selection 0=Single 1=Differential */
20 unsigned int mica_cfg;
21
22 /* MICB mode selection 0=Single 1=Differential */
23 unsigned int micb_cfg;
24
25 /* MICA Select 0=MIC1A 1=MIC2A */
26 unsigned int mica_sel;
27
28 /* MICB Select 0=MIC2A 1=MIC2B */
29 unsigned int micb_sel;
30
31 /* Charge Pump Freq. Check datasheet Pg73 */
32 unsigned int chgfreq;
33
34};
35
36#endif /* __CS42L52_H */
diff --git a/include/sound/max98095.h b/include/sound/max98095.h
index 7513a42dd4aa..e87ae67b0a55 100644
--- a/include/sound/max98095.h
+++ b/include/sound/max98095.h
@@ -49,6 +49,18 @@ struct max98095_pdata {
49 */ 49 */
50 unsigned int digmic_left_mode:1; 50 unsigned int digmic_left_mode:1;
51 unsigned int digmic_right_mode:1; 51 unsigned int digmic_right_mode:1;
52
53 /* Pin5 is the mechanical method of sensing jack insertion
54 * but it is something that might not be supported.
55 * 0 = PIN5 not supported
56 * 1 = PIN5 supported
57 */
58 unsigned int jack_detect_pin5en:1;
59
60 /* Slew amount for jack detection. Calculated as 4 * (delay + 1).
61 * Default delay is 24 to get a time of 100ms.
62 */
63 unsigned int jack_detect_delay;
52}; 64};
53 65
54#endif 66#endif
diff --git a/include/sound/sh_fsi.h b/include/sound/sh_fsi.h
index b457e87fbd08..906010344dd7 100644
--- a/include/sound/sh_fsi.h
+++ b/include/sound/sh_fsi.h
@@ -21,10 +21,11 @@
21/* 21/*
22 * flags format 22 * flags format
23 * 23 *
24 * 0x000000BA 24 * 0x00000CBA
25 * 25 *
26 * A: inversion 26 * A: inversion
27 * B: format mode 27 * B: format mode
28 * C: chip specific
28 */ 29 */
29 30
30/* A: clock inversion */ 31/* A: clock inversion */
@@ -39,6 +40,9 @@
39#define SH_FSI_FMT_DAI (0 << 4) 40#define SH_FSI_FMT_DAI (0 << 4)
40#define SH_FSI_FMT_SPDIF (1 << 4) 41#define SH_FSI_FMT_SPDIF (1 << 4)
41 42
43/* C: chip specific */
44#define SH_FSI_OPTION_MASK 0x00000F00
45#define SH_FSI_ENABLE_STREAM_MODE (1 << 8) /* for 16bit data */
42 46
43/* 47/*
44 * set_rate return value 48 * set_rate return value
@@ -84,16 +88,4 @@ struct sh_fsi_platform_info {
84 struct sh_fsi_port_info port_b; 88 struct sh_fsi_port_info port_b;
85}; 89};
86 90
87/*
88 * for fsi-ak4642
89 */
90struct fsi_ak4642_info {
91 const char *name;
92 const char *card;
93 const char *cpu_dai;
94 const char *codec;
95 const char *platform;
96 int id;
97};
98
99#endif /* __SOUND_FSI_H */ 91#endif /* __SOUND_FSI_H */
diff --git a/include/sound/simple_card.h b/include/sound/simple_card.h
new file mode 100644
index 000000000000..4b62b8dc6a4f
--- /dev/null
+++ b/include/sound/simple_card.h
@@ -0,0 +1,38 @@
1/*
2 * ASoC simple sound card support
3 *
4 * Copyright (C) 2012 Renesas Solutions Corp.
5 * Kuninori Morimoto <kuninori.morimoto.gx@renesas.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 __SIMPLE_CARD_H
13#define __SIMPLE_CARD_H
14
15#include <sound/soc.h>
16
17struct asoc_simple_dai_init_info {
18 unsigned int fmt;
19 unsigned int cpu_daifmt;
20 unsigned int codec_daifmt;
21 unsigned int sysclk;
22};
23
24struct asoc_simple_card_info {
25 const char *name;
26 const char *card;
27 const char *cpu_dai;
28 const char *codec;
29 const char *platform;
30 const char *codec_dai;
31 struct asoc_simple_dai_init_info *init; /* for snd_link.init */
32
33 /* used in simple-card.c */
34 struct snd_soc_dai_link snd_link;
35 struct snd_soc_card snd_card;
36};
37
38#endif /* __SIMPLE_CARD_H */
diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h
index c429f248cf4e..1f69e0af2941 100644
--- a/include/sound/soc-dai.h
+++ b/include/sound/soc-dai.h
@@ -173,6 +173,8 @@ struct snd_soc_dai_ops {
173 struct snd_soc_dai *); 173 struct snd_soc_dai *);
174 int (*trigger)(struct snd_pcm_substream *, int, 174 int (*trigger)(struct snd_pcm_substream *, int,
175 struct snd_soc_dai *); 175 struct snd_soc_dai *);
176 int (*bespoke_trigger)(struct snd_pcm_substream *, int,
177 struct snd_soc_dai *);
176 /* 178 /*
177 * For hardware based FIFO caused delay reporting. 179 * For hardware based FIFO caused delay reporting.
178 * Optional. 180 * Optional.
@@ -196,6 +198,7 @@ struct snd_soc_dai_driver {
196 const char *name; 198 const char *name;
197 unsigned int id; 199 unsigned int id;
198 int ac97_control; 200 int ac97_control;
201 unsigned int base;
199 202
200 /* DAI driver callbacks */ 203 /* DAI driver callbacks */
201 int (*probe)(struct snd_soc_dai *dai); 204 int (*probe)(struct snd_soc_dai *dai);
@@ -241,6 +244,7 @@ struct snd_soc_dai {
241 244
242 struct snd_soc_dapm_widget *playback_widget; 245 struct snd_soc_dapm_widget *playback_widget;
243 struct snd_soc_dapm_widget *capture_widget; 246 struct snd_soc_dapm_widget *capture_widget;
247 struct snd_soc_dapm_context dapm;
244 248
245 /* DAI DMA data */ 249 /* DAI DMA data */
246 void *playback_dma_data; 250 void *playback_dma_data;
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index 8da3c2409060..e3833d9f1914 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -141,10 +141,6 @@ struct device;
141{ .id = snd_soc_dapm_mixer, .name = wname, .reg = wreg, .shift = wshift, \ 141{ .id = snd_soc_dapm_mixer, .name = wname, .reg = wreg, .shift = wshift, \
142 .invert = winvert, .kcontrol_news = wcontrols, \ 142 .invert = winvert, .kcontrol_news = wcontrols, \
143 .num_kcontrols = wncontrols, .event = wevent, .event_flags = wflags} 143 .num_kcontrols = wncontrols, .event = wevent, .event_flags = wflags}
144#define SND_SOC_DAPM_MICBIAS_E(wname, wreg, wshift, winvert, wevent, wflags) \
145{ .id = snd_soc_dapm_micbias, .name = wname, .reg = wreg, .shift = wshift, \
146 .invert = winvert, .kcontrol_news = NULL, .num_kcontrols = 0, \
147 .event = wevent, .event_flags = wflags}
148#define SND_SOC_DAPM_SWITCH_E(wname, wreg, wshift, winvert, wcontrols, \ 144#define SND_SOC_DAPM_SWITCH_E(wname, wreg, wshift, winvert, wcontrols, \
149 wevent, wflags) \ 145 wevent, wflags) \
150{ .id = snd_soc_dapm_switch, .name = wname, .reg = wreg, .shift = wshift, \ 146{ .id = snd_soc_dapm_switch, .name = wname, .reg = wreg, .shift = wshift, \
@@ -324,6 +320,8 @@ struct snd_soc_dapm_path;
324struct snd_soc_dapm_pin; 320struct snd_soc_dapm_pin;
325struct snd_soc_dapm_route; 321struct snd_soc_dapm_route;
326struct snd_soc_dapm_context; 322struct snd_soc_dapm_context;
323struct regulator;
324struct snd_soc_dapm_widget_list;
327 325
328int dapm_reg_event(struct snd_soc_dapm_widget *w, 326int dapm_reg_event(struct snd_soc_dapm_widget *w,
329 struct snd_kcontrol *kcontrol, int event); 327 struct snd_kcontrol *kcontrol, int event);
@@ -359,6 +357,10 @@ int snd_soc_dapm_new_controls(struct snd_soc_dapm_context *dapm,
359int snd_soc_dapm_new_dai_widgets(struct snd_soc_dapm_context *dapm, 357int snd_soc_dapm_new_dai_widgets(struct snd_soc_dapm_context *dapm,
360 struct snd_soc_dai *dai); 358 struct snd_soc_dai *dai);
361int snd_soc_dapm_link_dai_widgets(struct snd_soc_card *card); 359int snd_soc_dapm_link_dai_widgets(struct snd_soc_card *card);
360int snd_soc_dapm_new_pcm(struct snd_soc_card *card,
361 const struct snd_soc_pcm_stream *params,
362 struct snd_soc_dapm_widget *source,
363 struct snd_soc_dapm_widget *sink);
362 364
363/* dapm path setup */ 365/* dapm path setup */
364int snd_soc_dapm_new_widgets(struct snd_soc_dapm_context *dapm); 366int snd_soc_dapm_new_widgets(struct snd_soc_dapm_context *dapm);
@@ -369,8 +371,8 @@ int snd_soc_dapm_weak_routes(struct snd_soc_dapm_context *dapm,
369 const struct snd_soc_dapm_route *route, int num); 371 const struct snd_soc_dapm_route *route, int num);
370 372
371/* dapm events */ 373/* dapm events */
372int snd_soc_dapm_stream_event(struct snd_soc_pcm_runtime *rtd, int stream, 374void snd_soc_dapm_stream_event(struct snd_soc_pcm_runtime *rtd, int stream,
373 struct snd_soc_dai *dai, int event); 375 int event);
374void snd_soc_dapm_shutdown(struct snd_soc_card *card); 376void snd_soc_dapm_shutdown(struct snd_soc_card *card);
375 377
376/* external DAPM widget events */ 378/* external DAPM widget events */
@@ -402,6 +404,10 @@ void snd_soc_dapm_auto_nc_codec_pins(struct snd_soc_codec *codec);
402/* Mostly internal - should not normally be used */ 404/* Mostly internal - should not normally be used */
403void dapm_mark_dirty(struct snd_soc_dapm_widget *w, const char *reason); 405void dapm_mark_dirty(struct snd_soc_dapm_widget *w, const char *reason);
404 406
407/* dapm path query */
408int snd_soc_dapm_dai_get_connected_widgets(struct snd_soc_dai *dai, int stream,
409 struct snd_soc_dapm_widget_list **list);
410
405/* dapm widget types */ 411/* dapm widget types */
406enum snd_soc_dapm_type { 412enum snd_soc_dapm_type {
407 snd_soc_dapm_input = 0, /* input pin */ 413 snd_soc_dapm_input = 0, /* input pin */
@@ -430,6 +436,12 @@ enum snd_soc_dapm_type {
430 snd_soc_dapm_aif_out, /* audio interface output */ 436 snd_soc_dapm_aif_out, /* audio interface output */
431 snd_soc_dapm_siggen, /* signal generator */ 437 snd_soc_dapm_siggen, /* signal generator */
432 snd_soc_dapm_dai, /* link to DAI structure */ 438 snd_soc_dapm_dai, /* link to DAI structure */
439 snd_soc_dapm_dai_link, /* link between two DAI structures */
440};
441
442enum snd_soc_dapm_subclass {
443 SND_SOC_DAPM_CLASS_INIT = 0,
444 SND_SOC_DAPM_CLASS_RUNTIME = 1,
433}; 445};
434 446
435/* 447/*
@@ -482,9 +494,11 @@ struct snd_soc_dapm_widget {
482 struct snd_soc_dapm_context *dapm; 494 struct snd_soc_dapm_context *dapm;
483 495
484 void *priv; /* widget specific data */ 496 void *priv; /* widget specific data */
497 struct regulator *regulator; /* attached regulator */
498 const struct snd_soc_pcm_stream *params; /* params for dai links */
485 499
486 /* dapm control */ 500 /* dapm control */
487 short reg; /* negative reg = no direct dapm */ 501 int reg; /* negative reg = no direct dapm */
488 unsigned char shift; /* bits to shift */ 502 unsigned char shift; /* bits to shift */
489 unsigned int saved_value; /* widget saved value */ 503 unsigned int saved_value; /* widget saved value */
490 unsigned int value; /* widget current value */ 504 unsigned int value; /* widget current value */
diff --git a/include/sound/soc-dpcm.h b/include/sound/soc-dpcm.h
new file mode 100644
index 000000000000..04598f1efd77
--- /dev/null
+++ b/include/sound/soc-dpcm.h
@@ -0,0 +1,138 @@
1/*
2 * linux/sound/soc-dpcm.h -- ALSA SoC Dynamic PCM Support
3 *
4 * Author: Liam Girdwood <lrg@ti.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifndef __LINUX_SND_SOC_DPCM_H
12#define __LINUX_SND_SOC_DPCM_H
13
14#include <linux/list.h>
15#include <sound/pcm.h>
16
17struct snd_soc_pcm_runtime;
18
19/*
20 * Types of runtime_update to perform. e.g. originated from FE PCM ops
21 * or audio route changes triggered by muxes/mixers.
22 */
23enum snd_soc_dpcm_update {
24 SND_SOC_DPCM_UPDATE_NO = 0,
25 SND_SOC_DPCM_UPDATE_BE,
26 SND_SOC_DPCM_UPDATE_FE,
27};
28
29/*
30 * Dynamic PCM Frontend -> Backend link management states.
31 */
32enum snd_soc_dpcm_link_state {
33 SND_SOC_DPCM_LINK_STATE_NEW = 0, /* newly created link */
34 SND_SOC_DPCM_LINK_STATE_FREE, /* link to be dismantled */
35};
36
37/*
38 * Dynamic PCM Frontend -> Backend link PCM states.
39 */
40enum snd_soc_dpcm_state {
41 SND_SOC_DPCM_STATE_NEW = 0,
42 SND_SOC_DPCM_STATE_OPEN,
43 SND_SOC_DPCM_STATE_HW_PARAMS,
44 SND_SOC_DPCM_STATE_PREPARE,
45 SND_SOC_DPCM_STATE_START,
46 SND_SOC_DPCM_STATE_STOP,
47 SND_SOC_DPCM_STATE_PAUSED,
48 SND_SOC_DPCM_STATE_SUSPEND,
49 SND_SOC_DPCM_STATE_HW_FREE,
50 SND_SOC_DPCM_STATE_CLOSE,
51};
52
53/*
54 * Dynamic PCM trigger ordering. Triggering flexibility is required as some
55 * DSPs require triggering before/after their CPU platform and DAIs.
56 *
57 * i.e. some clients may want to manually order this call in their PCM
58 * trigger() whilst others will just use the regular core ordering.
59 */
60enum snd_soc_dpcm_trigger {
61 SND_SOC_DPCM_TRIGGER_PRE = 0,
62 SND_SOC_DPCM_TRIGGER_POST,
63 SND_SOC_DPCM_TRIGGER_BESPOKE,
64};
65
66/*
67 * Dynamic PCM link
68 * This links together a FE and BE DAI at runtime and stores the link
69 * state information and the hw_params configuration.
70 */
71struct snd_soc_dpcm {
72 /* FE and BE DAIs*/
73 struct snd_soc_pcm_runtime *be;
74 struct snd_soc_pcm_runtime *fe;
75
76 /* link state */
77 enum snd_soc_dpcm_link_state state;
78
79 /* list of BE and FE for this DPCM link */
80 struct list_head list_be;
81 struct list_head list_fe;
82
83 /* hw params for this link - may be different for each link */
84 struct snd_pcm_hw_params hw_params;
85#ifdef CONFIG_DEBUG_FS
86 struct dentry *debugfs_state;
87#endif
88};
89
90/*
91 * Dynamic PCM runtime data.
92 */
93struct snd_soc_dpcm_runtime {
94 struct list_head be_clients;
95 struct list_head fe_clients;
96
97 int users;
98 struct snd_pcm_runtime *runtime;
99 struct snd_pcm_hw_params hw_params;
100
101 /* state and update */
102 enum snd_soc_dpcm_update runtime_update;
103 enum snd_soc_dpcm_state state;
104};
105
106/* can this BE stop and free */
107int snd_soc_dpcm_can_be_free_stop(struct snd_soc_pcm_runtime *fe,
108 struct snd_soc_pcm_runtime *be, int stream);
109
110/* can this BE perform a hw_params() */
111int snd_soc_dpcm_can_be_params(struct snd_soc_pcm_runtime *fe,
112 struct snd_soc_pcm_runtime *be, int stream);
113
114/* is the current PCM operation for this FE ? */
115int snd_soc_dpcm_fe_can_update(struct snd_soc_pcm_runtime *fe, int stream);
116
117/* is the current PCM operation for this BE ? */
118int snd_soc_dpcm_be_can_update(struct snd_soc_pcm_runtime *fe,
119 struct snd_soc_pcm_runtime *be, int stream);
120
121/* get the substream for this BE */
122struct snd_pcm_substream *
123 snd_soc_dpcm_get_substream(struct snd_soc_pcm_runtime *be, int stream);
124
125/* get the BE runtime state */
126enum snd_soc_dpcm_state
127 snd_soc_dpcm_be_get_state(struct snd_soc_pcm_runtime *be, int stream);
128
129/* set the BE runtime state */
130void snd_soc_dpcm_be_set_state(struct snd_soc_pcm_runtime *be, int stream,
131 enum snd_soc_dpcm_state state);
132
133/* internal use only */
134int soc_dpcm_be_digital_mute(struct snd_soc_pcm_runtime *fe, int mute);
135int soc_dpcm_debugfs_add(struct snd_soc_pcm_runtime *rtd);
136int soc_dpcm_runtime_update(struct snd_soc_dapm_widget *);
137
138#endif
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 2ebf7877c148..c703871f5f65 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -55,6 +55,18 @@
55 .info = snd_soc_info_volsw, .get = snd_soc_get_volsw,\ 55 .info = snd_soc_info_volsw, .get = snd_soc_get_volsw,\
56 .put = snd_soc_put_volsw, \ 56 .put = snd_soc_put_volsw, \
57 .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert) } 57 .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert) }
58#define SOC_SINGLE_SX_TLV(xname, xreg, xshift, xmin, xmax, tlv_array) \
59{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
60 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
61 SNDRV_CTL_ELEM_ACCESS_READWRITE, \
62 .tlv.p = (tlv_array),\
63 .info = snd_soc_info_volsw, \
64 .get = snd_soc_get_volsw_sx,\
65 .put = snd_soc_put_volsw_sx, \
66 .private_value = (unsigned long)&(struct soc_mixer_control) \
67 {.reg = xreg, .rreg = xreg, \
68 .shift = xshift, .rshift = xshift, \
69 .max = xmax, .min = xmin} }
58#define SOC_DOUBLE(xname, reg, shift_left, shift_right, max, invert) \ 70#define SOC_DOUBLE(xname, reg, shift_left, shift_right, max, invert) \
59{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\ 71{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
60 .info = snd_soc_info_volsw, .get = snd_soc_get_volsw, \ 72 .info = snd_soc_info_volsw, .get = snd_soc_get_volsw, \
@@ -85,6 +97,18 @@
85 .get = snd_soc_get_volsw, .put = snd_soc_put_volsw, \ 97 .get = snd_soc_get_volsw, .put = snd_soc_put_volsw, \
86 .private_value = SOC_DOUBLE_R_VALUE(reg_left, reg_right, xshift, \ 98 .private_value = SOC_DOUBLE_R_VALUE(reg_left, reg_right, xshift, \
87 xmax, xinvert) } 99 xmax, xinvert) }
100#define SOC_DOUBLE_R_SX_TLV(xname, xreg, xrreg, xshift, xmin, xmax, tlv_array) \
101{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
102 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
103 SNDRV_CTL_ELEM_ACCESS_READWRITE, \
104 .tlv.p = (tlv_array), \
105 .info = snd_soc_info_volsw, \
106 .get = snd_soc_get_volsw_sx, \
107 .put = snd_soc_put_volsw_sx, \
108 .private_value = (unsigned long)&(struct soc_mixer_control) \
109 {.reg = xreg, .rreg = xrreg, \
110 .shift = xshift, .rshift = xshift, \
111 .max = xmax, .min = xmin} }
88#define SOC_DOUBLE_S8_TLV(xname, xreg, xmin, xmax, tlv_array) \ 112#define SOC_DOUBLE_S8_TLV(xname, xreg, xmin, xmax, tlv_array) \
89{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \ 113{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
90 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ 114 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
@@ -171,20 +195,6 @@
171 .get = xhandler_get, .put = xhandler_put, \ 195 .get = xhandler_get, .put = xhandler_put, \
172 .private_value = (unsigned long)&xenum } 196 .private_value = (unsigned long)&xenum }
173 197
174#define SOC_DOUBLE_R_SX_TLV(xname, xreg_left, xreg_right, xshift,\
175 xmin, xmax, tlv_array) \
176{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
177 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
178 SNDRV_CTL_ELEM_ACCESS_READWRITE, \
179 .tlv.p = (tlv_array), \
180 .info = snd_soc_info_volsw_2r_sx, \
181 .get = snd_soc_get_volsw_2r_sx, \
182 .put = snd_soc_put_volsw_2r_sx, \
183 .private_value = (unsigned long)&(struct soc_mixer_control) \
184 {.reg = xreg_left, \
185 .rreg = xreg_right, .shift = xshift, \
186 .min = xmin, .max = xmax} }
187
188#define SND_SOC_BYTES(xname, xbase, xregs) \ 198#define SND_SOC_BYTES(xname, xbase, xregs) \
189{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ 199{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
190 .info = snd_soc_bytes_info, .get = snd_soc_bytes_get, \ 200 .info = snd_soc_bytes_info, .get = snd_soc_bytes_get, \
@@ -200,6 +210,19 @@
200 {.base = xbase, .num_regs = xregs, \ 210 {.base = xbase, .num_regs = xregs, \
201 .mask = xmask }) } 211 .mask = xmask }) }
202 212
213#define SOC_SINGLE_XR_SX(xname, xregbase, xregcount, xnbits, \
214 xmin, xmax, xinvert) \
215{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
216 .info = snd_soc_info_xr_sx, .get = snd_soc_get_xr_sx, \
217 .put = snd_soc_put_xr_sx, \
218 .private_value = (unsigned long)&(struct soc_mreg_control) \
219 {.regbase = xregbase, .regcount = xregcount, .nbits = xnbits, \
220 .invert = xinvert, .min = xmin, .max = xmax} }
221
222#define SOC_SINGLE_STROBE(xname, xreg, xshift, xinvert) \
223 SOC_SINGLE_EXT(xname, xreg, xshift, 1, xinvert, \
224 snd_soc_get_strobe, snd_soc_put_strobe)
225
203/* 226/*
204 * Simplified versions of above macros, declaring a struct and calculating 227 * Simplified versions of above macros, declaring a struct and calculating
205 * ARRAY_SIZE internally 228 * ARRAY_SIZE internally
@@ -264,6 +287,7 @@ struct snd_soc_jack_zone;
264struct snd_soc_jack_pin; 287struct snd_soc_jack_pin;
265struct snd_soc_cache_ops; 288struct snd_soc_cache_ops;
266#include <sound/soc-dapm.h> 289#include <sound/soc-dapm.h>
290#include <sound/soc-dpcm.h>
267 291
268#ifdef CONFIG_GPIOLIB 292#ifdef CONFIG_GPIOLIB
269struct snd_soc_jack_gpio; 293struct snd_soc_jack_gpio;
@@ -288,6 +312,11 @@ enum snd_soc_pcm_subclass {
288 SND_SOC_PCM_CLASS_BE = 1, 312 SND_SOC_PCM_CLASS_BE = 1,
289}; 313};
290 314
315enum snd_soc_card_subclass {
316 SND_SOC_CARD_CLASS_INIT = 0,
317 SND_SOC_CARD_CLASS_RUNTIME = 1,
318};
319
291int snd_soc_codec_set_sysclk(struct snd_soc_codec *codec, int clk_id, 320int snd_soc_codec_set_sysclk(struct snd_soc_codec *codec, int clk_id,
292 int source, unsigned int freq, int dir); 321 int source, unsigned int freq, int dir);
293int snd_soc_codec_set_pll(struct snd_soc_codec *codec, int pll_id, int source, 322int snd_soc_codec_set_pll(struct snd_soc_codec *codec, int pll_id, int source,
@@ -333,6 +362,11 @@ int snd_soc_platform_write(struct snd_soc_platform *platform,
333 unsigned int reg, unsigned int val); 362 unsigned int reg, unsigned int val);
334int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num); 363int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num);
335 364
365struct snd_pcm_substream *snd_soc_get_dai_substream(struct snd_soc_card *card,
366 const char *dai_link, int stream);
367struct snd_soc_pcm_runtime *snd_soc_get_pcm_runtime(struct snd_soc_card *card,
368 const char *dai_link);
369
336/* Utility functions to get clock rates from various things */ 370/* Utility functions to get clock rates from various things */
337int snd_soc_calc_frame_size(int sample_size, int channels, int tdm_slots); 371int snd_soc_calc_frame_size(int sample_size, int channels, int tdm_slots);
338int snd_soc_params_to_frame_size(struct snd_pcm_hw_params *params); 372int snd_soc_params_to_frame_size(struct snd_pcm_hw_params *params);
@@ -343,6 +377,9 @@ int snd_soc_params_to_bclk(struct snd_pcm_hw_params *parms);
343int snd_soc_set_runtime_hwparams(struct snd_pcm_substream *substream, 377int snd_soc_set_runtime_hwparams(struct snd_pcm_substream *substream,
344 const struct snd_pcm_hardware *hw); 378 const struct snd_pcm_hardware *hw);
345 379
380int snd_soc_platform_trigger(struct snd_pcm_substream *substream,
381 int cmd, struct snd_soc_platform *platform);
382
346/* Jack reporting */ 383/* Jack reporting */
347int snd_soc_jack_new(struct snd_soc_codec *codec, const char *id, int type, 384int snd_soc_jack_new(struct snd_soc_codec *codec, const char *id, int type,
348 struct snd_soc_jack *jack); 385 struct snd_soc_jack *jack);
@@ -413,6 +450,10 @@ int snd_soc_put_volsw(struct snd_kcontrol *kcontrol,
413 struct snd_ctl_elem_value *ucontrol); 450 struct snd_ctl_elem_value *ucontrol);
414#define snd_soc_get_volsw_2r snd_soc_get_volsw 451#define snd_soc_get_volsw_2r snd_soc_get_volsw
415#define snd_soc_put_volsw_2r snd_soc_put_volsw 452#define snd_soc_put_volsw_2r snd_soc_put_volsw
453int snd_soc_get_volsw_sx(struct snd_kcontrol *kcontrol,
454 struct snd_ctl_elem_value *ucontrol);
455int snd_soc_put_volsw_sx(struct snd_kcontrol *kcontrol,
456 struct snd_ctl_elem_value *ucontrol);
416int snd_soc_info_volsw_s8(struct snd_kcontrol *kcontrol, 457int snd_soc_info_volsw_s8(struct snd_kcontrol *kcontrol,
417 struct snd_ctl_elem_info *uinfo); 458 struct snd_ctl_elem_info *uinfo);
418int snd_soc_get_volsw_s8(struct snd_kcontrol *kcontrol, 459int snd_soc_get_volsw_s8(struct snd_kcontrol *kcontrol,
@@ -421,19 +462,22 @@ int snd_soc_put_volsw_s8(struct snd_kcontrol *kcontrol,
421 struct snd_ctl_elem_value *ucontrol); 462 struct snd_ctl_elem_value *ucontrol);
422int snd_soc_limit_volume(struct snd_soc_codec *codec, 463int snd_soc_limit_volume(struct snd_soc_codec *codec,
423 const char *name, int max); 464 const char *name, int max);
424int snd_soc_info_volsw_2r_sx(struct snd_kcontrol *kcontrol,
425 struct snd_ctl_elem_info *uinfo);
426int snd_soc_get_volsw_2r_sx(struct snd_kcontrol *kcontrol,
427 struct snd_ctl_elem_value *ucontrol);
428int snd_soc_put_volsw_2r_sx(struct snd_kcontrol *kcontrol,
429 struct snd_ctl_elem_value *ucontrol);
430int snd_soc_bytes_info(struct snd_kcontrol *kcontrol, 465int snd_soc_bytes_info(struct snd_kcontrol *kcontrol,
431 struct snd_ctl_elem_info *uinfo); 466 struct snd_ctl_elem_info *uinfo);
432int snd_soc_bytes_get(struct snd_kcontrol *kcontrol, 467int snd_soc_bytes_get(struct snd_kcontrol *kcontrol,
433 struct snd_ctl_elem_value *ucontrol); 468 struct snd_ctl_elem_value *ucontrol);
434int snd_soc_bytes_put(struct snd_kcontrol *kcontrol, 469int snd_soc_bytes_put(struct snd_kcontrol *kcontrol,
435 struct snd_ctl_elem_value *ucontrol); 470 struct snd_ctl_elem_value *ucontrol);
436 471int snd_soc_info_xr_sx(struct snd_kcontrol *kcontrol,
472 struct snd_ctl_elem_info *uinfo);
473int snd_soc_get_xr_sx(struct snd_kcontrol *kcontrol,
474 struct snd_ctl_elem_value *ucontrol);
475int snd_soc_put_xr_sx(struct snd_kcontrol *kcontrol,
476 struct snd_ctl_elem_value *ucontrol);
477int snd_soc_get_strobe(struct snd_kcontrol *kcontrol,
478 struct snd_ctl_elem_value *ucontrol);
479int snd_soc_put_strobe(struct snd_kcontrol *kcontrol,
480 struct snd_ctl_elem_value *ucontrol);
437 481
438/** 482/**
439 * struct snd_soc_reg_access - Describes whether a given register is 483 * struct snd_soc_reg_access - Describes whether a given register is
@@ -513,6 +557,7 @@ struct snd_soc_jack_gpio {
513#endif 557#endif
514 558
515struct snd_soc_jack { 559struct snd_soc_jack {
560 struct mutex mutex;
516 struct snd_jack *jack; 561 struct snd_jack *jack;
517 struct snd_soc_codec *codec; 562 struct snd_soc_codec *codec;
518 struct list_head pins; 563 struct list_head pins;
@@ -711,6 +756,7 @@ struct snd_soc_platform_driver {
711 /* platform IO - used for platform DAPM */ 756 /* platform IO - used for platform DAPM */
712 unsigned int (*read)(struct snd_soc_platform *, unsigned int); 757 unsigned int (*read)(struct snd_soc_platform *, unsigned int);
713 int (*write)(struct snd_soc_platform *, unsigned int, unsigned int); 758 int (*write)(struct snd_soc_platform *, unsigned int, unsigned int);
759 int (*bespoke_trigger)(struct snd_pcm_substream *, int);
714}; 760};
715 761
716struct snd_soc_platform { 762struct snd_soc_platform {
@@ -746,21 +792,36 @@ struct snd_soc_dai_link {
746 const char *cpu_dai_name; 792 const char *cpu_dai_name;
747 const struct device_node *cpu_dai_of_node; 793 const struct device_node *cpu_dai_of_node;
748 const char *codec_dai_name; 794 const char *codec_dai_name;
795 int be_id; /* optional ID for machine driver BE identification */
796
797 const struct snd_soc_pcm_stream *params;
749 798
750 unsigned int dai_fmt; /* format to set on init */ 799 unsigned int dai_fmt; /* format to set on init */
751 800
801 enum snd_soc_dpcm_trigger trigger[2]; /* trigger type for DPCM */
802
752 /* Keep DAI active over suspend */ 803 /* Keep DAI active over suspend */
753 unsigned int ignore_suspend:1; 804 unsigned int ignore_suspend:1;
754 805
755 /* Symmetry requirements */ 806 /* Symmetry requirements */
756 unsigned int symmetric_rates:1; 807 unsigned int symmetric_rates:1;
757 808
809 /* Do not create a PCM for this DAI link (Backend link) */
810 unsigned int no_pcm:1;
811
812 /* This DAI link can route to other DAI links at runtime (Frontend)*/
813 unsigned int dynamic:1;
814
758 /* pmdown_time is ignored at stop */ 815 /* pmdown_time is ignored at stop */
759 unsigned int ignore_pmdown_time:1; 816 unsigned int ignore_pmdown_time:1;
760 817
761 /* codec/machine specific init - e.g. add machine controls */ 818 /* codec/machine specific init - e.g. add machine controls */
762 int (*init)(struct snd_soc_pcm_runtime *rtd); 819 int (*init)(struct snd_soc_pcm_runtime *rtd);
763 820
821 /* optional hw_params re-writing for BE and FE sync */
822 int (*be_hw_params_fixup)(struct snd_soc_pcm_runtime *rtd,
823 struct snd_pcm_hw_params *params);
824
764 /* machine stream operations */ 825 /* machine stream operations */
765 struct snd_soc_ops *ops; 826 struct snd_soc_ops *ops;
766}; 827};
@@ -800,6 +861,7 @@ struct snd_soc_card {
800 861
801 struct list_head list; 862 struct list_head list;
802 struct mutex mutex; 863 struct mutex mutex;
864 struct mutex dapm_mutex;
803 865
804 bool instantiated; 866 bool instantiated;
805 867
@@ -889,9 +951,11 @@ struct snd_soc_pcm_runtime {
889 enum snd_soc_pcm_subclass pcm_subclass; 951 enum snd_soc_pcm_subclass pcm_subclass;
890 struct snd_pcm_ops ops; 952 struct snd_pcm_ops ops;
891 953
892 unsigned int complete:1;
893 unsigned int dev_registered:1; 954 unsigned int dev_registered:1;
894 955
956 /* Dynamic PCM BE runtime data */
957 struct snd_soc_dpcm_runtime dpcm[2];
958
895 long pmdown_time; 959 long pmdown_time;
896 960
897 /* runtime devices */ 961 /* runtime devices */
@@ -902,6 +966,10 @@ struct snd_soc_pcm_runtime {
902 struct snd_soc_dai *cpu_dai; 966 struct snd_soc_dai *cpu_dai;
903 967
904 struct delayed_work delayed_work; 968 struct delayed_work delayed_work;
969#ifdef CONFIG_DEBUG_FS
970 struct dentry *debugfs_dpcm_root;
971 struct dentry *debugfs_dpcm_state;
972#endif
905}; 973};
906 974
907/* mixer control */ 975/* mixer control */
@@ -916,6 +984,12 @@ struct soc_bytes {
916 u32 mask; 984 u32 mask;
917}; 985};
918 986
987/* multi register control */
988struct soc_mreg_control {
989 long min, max;
990 unsigned int regbase, regcount, nbits, invert;
991};
992
919/* enumerated kcontrol */ 993/* enumerated kcontrol */
920struct soc_enum { 994struct soc_enum {
921 unsigned short reg; 995 unsigned short reg;
diff --git a/include/target/target_core_backend.h b/include/target/target_core_backend.h
index 8c9ff1b14396..2d7db85e93ae 100644
--- a/include/target/target_core_backend.h
+++ b/include/target/target_core_backend.h
@@ -23,12 +23,11 @@ struct se_subsystem_api {
23 struct se_device *(*create_virtdevice)(struct se_hba *, 23 struct se_device *(*create_virtdevice)(struct se_hba *,
24 struct se_subsystem_dev *, void *); 24 struct se_subsystem_dev *, void *);
25 void (*free_device)(void *); 25 void (*free_device)(void *);
26 int (*transport_complete)(struct se_task *task); 26 int (*transport_complete)(struct se_cmd *cmd, struct scatterlist *);
27 struct se_task *(*alloc_task)(unsigned char *cdb); 27 int (*execute_cmd)(struct se_cmd *, struct scatterlist *, u32,
28 int (*do_task)(struct se_task *); 28 enum dma_data_direction);
29 int (*do_discard)(struct se_device *, sector_t, u32); 29 int (*do_discard)(struct se_device *, sector_t, u32);
30 void (*do_sync_cache)(struct se_task *); 30 void (*do_sync_cache)(struct se_cmd *);
31 void (*free_task)(struct se_task *);
32 ssize_t (*check_configfs_dev_params)(struct se_hba *, 31 ssize_t (*check_configfs_dev_params)(struct se_hba *,
33 struct se_subsystem_dev *); 32 struct se_subsystem_dev *);
34 ssize_t (*set_configfs_dev_params)(struct se_hba *, 33 ssize_t (*set_configfs_dev_params)(struct se_hba *,
@@ -38,7 +37,7 @@ struct se_subsystem_api {
38 u32 (*get_device_rev)(struct se_device *); 37 u32 (*get_device_rev)(struct se_device *);
39 u32 (*get_device_type)(struct se_device *); 38 u32 (*get_device_type)(struct se_device *);
40 sector_t (*get_blocks)(struct se_device *); 39 sector_t (*get_blocks)(struct se_device *);
41 unsigned char *(*get_sense_buffer)(struct se_task *); 40 unsigned char *(*get_sense_buffer)(struct se_cmd *);
42}; 41};
43 42
44int transport_subsystem_register(struct se_subsystem_api *); 43int transport_subsystem_register(struct se_subsystem_api *);
@@ -48,10 +47,7 @@ struct se_device *transport_add_device_to_core_hba(struct se_hba *,
48 struct se_subsystem_api *, struct se_subsystem_dev *, u32, 47 struct se_subsystem_api *, struct se_subsystem_dev *, u32,
49 void *, struct se_dev_limits *, const char *, const char *); 48 void *, struct se_dev_limits *, const char *, const char *);
50 49
51void transport_complete_sync_cache(struct se_cmd *, int); 50void target_complete_cmd(struct se_cmd *, u8);
52void transport_complete_task(struct se_task *, int);
53
54void target_get_task_cdb(struct se_task *, unsigned char *);
55 51
56void transport_set_vpd_proto_id(struct t10_vpd *, unsigned char *); 52void transport_set_vpd_proto_id(struct t10_vpd *, unsigned char *);
57int transport_set_vpd_assoc(struct t10_vpd *, unsigned char *); 53int transport_set_vpd_assoc(struct t10_vpd *, unsigned char *);
diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h
index aaccc5f5fc9f..dc35d8660aa6 100644
--- a/include/target/target_core_base.h
+++ b/include/target/target_core_base.h
@@ -73,9 +73,8 @@
73/* 73/*
74 * struct se_device->dev_flags 74 * struct se_device->dev_flags
75 */ 75 */
76#define DF_READ_ONLY 0x00000001 76#define DF_SPC2_RESERVATIONS 0x00000001
77#define DF_SPC2_RESERVATIONS 0x00000002 77#define DF_SPC2_RESERVATIONS_WITH_ISID 0x00000002
78#define DF_SPC2_RESERVATIONS_WITH_ISID 0x00000004
79 78
80/* struct se_dev_attrib sanity values */ 79/* struct se_dev_attrib sanity values */
81/* Default max_unmap_lba_count */ 80/* Default max_unmap_lba_count */
@@ -141,14 +140,6 @@ enum transport_tpg_type_table {
141 TRANSPORT_TPG_TYPE_DISCOVERY = 1, 140 TRANSPORT_TPG_TYPE_DISCOVERY = 1,
142}; 141};
143 142
144/* struct se_task->task_flags */
145enum se_task_flags {
146 TF_ACTIVE = (1 << 0),
147 TF_SENT = (1 << 1),
148 TF_REQUEST_STOP = (1 << 2),
149 TF_HAS_SENSE = (1 << 3),
150};
151
152/* Special transport agnostic struct se_cmd->t_states */ 143/* Special transport agnostic struct se_cmd->t_states */
153enum transport_state_table { 144enum transport_state_table {
154 TRANSPORT_NO_STATE = 0, 145 TRANSPORT_NO_STATE = 0,
@@ -234,6 +225,7 @@ enum tcm_sense_reason_table {
234enum target_sc_flags_table { 225enum target_sc_flags_table {
235 TARGET_SCF_BIDI_OP = 0x01, 226 TARGET_SCF_BIDI_OP = 0x01,
236 TARGET_SCF_ACK_KREF = 0x02, 227 TARGET_SCF_ACK_KREF = 0x02,
228 TARGET_SCF_UNKNOWN_SIZE = 0x04,
237}; 229};
238 230
239/* fabric independent task management function values */ 231/* fabric independent task management function values */
@@ -338,6 +330,7 @@ struct t10_alua_tg_pt_gp {
338 int tg_pt_gp_alua_access_type; 330 int tg_pt_gp_alua_access_type;
339 int tg_pt_gp_nonop_delay_msecs; 331 int tg_pt_gp_nonop_delay_msecs;
340 int tg_pt_gp_trans_delay_msecs; 332 int tg_pt_gp_trans_delay_msecs;
333 int tg_pt_gp_implict_trans_secs;
341 int tg_pt_gp_pref; 334 int tg_pt_gp_pref;
342 int tg_pt_gp_write_metadata; 335 int tg_pt_gp_write_metadata;
343 /* Used by struct t10_alua_tg_pt_gp->tg_pt_gp_md_buf_len */ 336 /* Used by struct t10_alua_tg_pt_gp->tg_pt_gp_md_buf_len */
@@ -485,23 +478,6 @@ struct se_queue_obj {
485 wait_queue_head_t thread_wq; 478 wait_queue_head_t thread_wq;
486}; 479};
487 480
488struct se_task {
489 unsigned long long task_lba;
490 u32 task_sectors;
491 u32 task_size;
492 struct se_cmd *task_se_cmd;
493 struct scatterlist *task_sg;
494 u32 task_sg_nents;
495 u16 task_flags;
496 u8 task_scsi_status;
497 enum dma_data_direction task_data_direction;
498 struct list_head t_list;
499 struct list_head t_execute_list;
500 struct list_head t_state_list;
501 bool t_state_active;
502 struct completion task_stop_comp;
503};
504
505struct se_tmr_req { 481struct se_tmr_req {
506 /* Task Management function to be performed */ 482 /* Task Management function to be performed */
507 u8 function; 483 u8 function;
@@ -538,6 +514,7 @@ struct se_cmd {
538 /* Used to signal cmd->se_tfo->check_release_cmd() usage per cmd */ 514 /* Used to signal cmd->se_tfo->check_release_cmd() usage per cmd */
539 unsigned check_release:1; 515 unsigned check_release:1;
540 unsigned cmd_wait_set:1; 516 unsigned cmd_wait_set:1;
517 unsigned unknown_data_length:1;
541 /* See se_cmd_flags_table */ 518 /* See se_cmd_flags_table */
542 u32 se_cmd_flags; 519 u32 se_cmd_flags;
543 u32 se_ordered_id; 520 u32 se_ordered_id;
@@ -565,18 +542,13 @@ struct se_cmd {
565 struct completion cmd_wait_comp; 542 struct completion cmd_wait_comp;
566 struct kref cmd_kref; 543 struct kref cmd_kref;
567 struct target_core_fabric_ops *se_tfo; 544 struct target_core_fabric_ops *se_tfo;
568 int (*execute_task)(struct se_task *); 545 int (*execute_cmd)(struct se_cmd *);
569 void (*transport_complete_callback)(struct se_cmd *); 546 void (*transport_complete_callback)(struct se_cmd *);
570 547
571 unsigned char *t_task_cdb; 548 unsigned char *t_task_cdb;
572 unsigned char __t_task_cdb[TCM_MAX_COMMAND_SIZE]; 549 unsigned char __t_task_cdb[TCM_MAX_COMMAND_SIZE];
573 unsigned long long t_task_lba; 550 unsigned long long t_task_lba;
574 u32 t_tasks_sg_chained_no;
575 atomic_t t_fe_count; 551 atomic_t t_fe_count;
576 atomic_t t_se_count;
577 atomic_t t_task_cdbs_left;
578 atomic_t t_task_cdbs_ex_left;
579 atomic_t t_task_cdbs_sent;
580 unsigned int transport_state; 552 unsigned int transport_state;
581#define CMD_T_ABORTED (1 << 0) 553#define CMD_T_ABORTED (1 << 0)
582#define CMD_T_ACTIVE (1 << 1) 554#define CMD_T_ACTIVE (1 << 1)
@@ -588,11 +560,12 @@ struct se_cmd {
588#define CMD_T_LUN_STOP (1 << 7) 560#define CMD_T_LUN_STOP (1 << 7)
589#define CMD_T_LUN_FE_STOP (1 << 8) 561#define CMD_T_LUN_FE_STOP (1 << 8)
590#define CMD_T_DEV_ACTIVE (1 << 9) 562#define CMD_T_DEV_ACTIVE (1 << 9)
563#define CMD_T_REQUEST_STOP (1 << 10)
564#define CMD_T_BUSY (1 << 11)
591 spinlock_t t_state_lock; 565 spinlock_t t_state_lock;
592 struct completion t_transport_stop_comp; 566 struct completion t_transport_stop_comp;
593 struct completion transport_lun_fe_stop_comp; 567 struct completion transport_lun_fe_stop_comp;
594 struct completion transport_lun_stop_comp; 568 struct completion transport_lun_stop_comp;
595 struct scatterlist *t_tasks_sg_chained;
596 569
597 struct work_struct work; 570 struct work_struct work;
598 571
@@ -602,10 +575,15 @@ struct se_cmd {
602 struct scatterlist *t_bidi_data_sg; 575 struct scatterlist *t_bidi_data_sg;
603 unsigned int t_bidi_data_nents; 576 unsigned int t_bidi_data_nents;
604 577
605 /* Used for BIDI READ */ 578 struct list_head execute_list;
606 struct list_head t_task_list; 579 struct list_head state_list;
607 u32 t_task_list_num; 580 bool state_active;
581
582 /* old task stop completion, consider merging with some of the above */
583 struct completion task_stop_comp;
608 584
585 /* backend private data */
586 void *priv;
609}; 587};
610 588
611struct se_ua { 589struct se_ua {
@@ -731,7 +709,6 @@ struct se_dev_attrib {
731 u32 hw_block_size; 709 u32 hw_block_size;
732 u32 block_size; 710 u32 block_size;
733 u32 hw_max_sectors; 711 u32 hw_max_sectors;
734 u32 max_sectors;
735 u32 fabric_max_sectors; 712 u32 fabric_max_sectors;
736 u32 optimal_sectors; 713 u32 optimal_sectors;
737 u32 hw_queue_depth; 714 u32 hw_queue_depth;
@@ -829,8 +806,8 @@ struct se_device {
829 struct task_struct *process_thread; 806 struct task_struct *process_thread;
830 struct work_struct qf_work_queue; 807 struct work_struct qf_work_queue;
831 struct list_head delayed_cmd_list; 808 struct list_head delayed_cmd_list;
832 struct list_head execute_task_list; 809 struct list_head execute_list;
833 struct list_head state_task_list; 810 struct list_head state_list;
834 struct list_head qf_cmd_list; 811 struct list_head qf_cmd_list;
835 /* Pointer to associated SE HBA */ 812 /* Pointer to associated SE HBA */
836 struct se_hba *se_hba; 813 struct se_hba *se_hba;
diff --git a/include/target/target_core_fabric.h b/include/target/target_core_fabric.h
index 10c690809601..116959933f46 100644
--- a/include/target/target_core_fabric.h
+++ b/include/target/target_core_fabric.h
@@ -3,12 +3,6 @@
3 3
4struct target_core_fabric_ops { 4struct target_core_fabric_ops {
5 struct configfs_subsystem *tf_subsys; 5 struct configfs_subsystem *tf_subsys;
6 /*
7 * Optional to signal struct se_task->task_sg[] padding entries
8 * for scatterlist chaining using transport_do_task_sg_link(),
9 * disabled by default
10 */
11 bool task_sg_chaining;
12 char *(*get_fabric_name)(void); 6 char *(*get_fabric_name)(void);
13 u8 (*get_fabric_proto_ident)(struct se_portal_group *); 7 u8 (*get_fabric_proto_ident)(struct se_portal_group *);
14 char *(*tpg_get_wwn)(struct se_portal_group *); 8 char *(*tpg_get_wwn)(struct se_portal_group *);
@@ -102,7 +96,7 @@ void __transport_register_session(struct se_portal_group *,
102void transport_register_session(struct se_portal_group *, 96void transport_register_session(struct se_portal_group *,
103 struct se_node_acl *, struct se_session *, void *); 97 struct se_node_acl *, struct se_session *, void *);
104void target_get_session(struct se_session *); 98void target_get_session(struct se_session *);
105int target_put_session(struct se_session *); 99void target_put_session(struct se_session *);
106void transport_free_session(struct se_session *); 100void transport_free_session(struct se_session *);
107void target_put_nacl(struct se_node_acl *); 101void target_put_nacl(struct se_node_acl *);
108void transport_deregister_session_configfs(struct se_session *); 102void transport_deregister_session_configfs(struct se_session *);
@@ -112,7 +106,7 @@ void transport_deregister_session(struct se_session *);
112void transport_init_se_cmd(struct se_cmd *, struct target_core_fabric_ops *, 106void transport_init_se_cmd(struct se_cmd *, struct target_core_fabric_ops *,
113 struct se_session *, u32, int, int, unsigned char *); 107 struct se_session *, u32, int, int, unsigned char *);
114int transport_lookup_cmd_lun(struct se_cmd *, u32); 108int transport_lookup_cmd_lun(struct se_cmd *, u32);
115int transport_generic_allocate_tasks(struct se_cmd *, unsigned char *); 109int target_setup_cmd_from_cdb(struct se_cmd *, unsigned char *);
116void target_submit_cmd(struct se_cmd *, struct se_session *, unsigned char *, 110void target_submit_cmd(struct se_cmd *, struct se_session *, unsigned char *,
117 unsigned char *, u32, u32, int, int, int); 111 unsigned char *, u32, u32, int, int, int);
118int target_submit_tmr(struct se_cmd *se_cmd, struct se_session *se_sess, 112int target_submit_tmr(struct se_cmd *se_cmd, struct se_session *se_sess,
@@ -124,7 +118,6 @@ int transport_generic_handle_cdb_map(struct se_cmd *);
124int transport_generic_handle_data(struct se_cmd *); 118int transport_generic_handle_data(struct se_cmd *);
125int transport_generic_map_mem_to_cmd(struct se_cmd *cmd, 119int transport_generic_map_mem_to_cmd(struct se_cmd *cmd,
126 struct scatterlist *, u32, struct scatterlist *, u32); 120 struct scatterlist *, u32, struct scatterlist *, u32);
127void transport_do_task_sg_chain(struct se_cmd *);
128int transport_generic_new_cmd(struct se_cmd *); 121int transport_generic_new_cmd(struct se_cmd *);
129 122
130void transport_generic_process_write(struct se_cmd *); 123void transport_generic_process_write(struct se_cmd *);
diff --git a/include/trace/events/asoc.h b/include/trace/events/asoc.h
index ab26f8aa3c78..5fc2dcdd21cd 100644
--- a/include/trace/events/asoc.h
+++ b/include/trace/events/asoc.h
@@ -7,6 +7,8 @@
7#include <linux/ktime.h> 7#include <linux/ktime.h>
8#include <linux/tracepoint.h> 8#include <linux/tracepoint.h>
9 9
10#define DAPM_DIRECT "(direct)"
11
10struct snd_soc_jack; 12struct snd_soc_jack;
11struct snd_soc_codec; 13struct snd_soc_codec;
12struct snd_soc_platform; 14struct snd_soc_platform;
@@ -241,6 +243,84 @@ TRACE_EVENT(snd_soc_dapm_walk_done,
241 (int)__entry->path_checks, (int)__entry->neighbour_checks) 243 (int)__entry->path_checks, (int)__entry->neighbour_checks)
242); 244);
243 245
246TRACE_EVENT(snd_soc_dapm_output_path,
247
248 TP_PROTO(struct snd_soc_dapm_widget *widget,
249 struct snd_soc_dapm_path *path),
250
251 TP_ARGS(widget, path),
252
253 TP_STRUCT__entry(
254 __string( wname, widget->name )
255 __string( pname, path->name ? path->name : DAPM_DIRECT)
256 __string( psname, path->sink->name )
257 __field( int, path_sink )
258 __field( int, path_connect )
259 ),
260
261 TP_fast_assign(
262 __assign_str(wname, widget->name);
263 __assign_str(pname, path->name ? path->name : DAPM_DIRECT);
264 __assign_str(psname, path->sink->name);
265 __entry->path_connect = path->connect;
266 __entry->path_sink = (long)path->sink;
267 ),
268
269 TP_printk("%c%s -> %s -> %s\n",
270 (int) __entry->path_sink &&
271 (int) __entry->path_connect ? '*' : ' ',
272 __get_str(wname), __get_str(pname), __get_str(psname))
273);
274
275TRACE_EVENT(snd_soc_dapm_input_path,
276
277 TP_PROTO(struct snd_soc_dapm_widget *widget,
278 struct snd_soc_dapm_path *path),
279
280 TP_ARGS(widget, path),
281
282 TP_STRUCT__entry(
283 __string( wname, widget->name )
284 __string( pname, path->name ? path->name : DAPM_DIRECT)
285 __string( psname, path->source->name )
286 __field( int, path_source )
287 __field( int, path_connect )
288 ),
289
290 TP_fast_assign(
291 __assign_str(wname, widget->name);
292 __assign_str(pname, path->name ? path->name : DAPM_DIRECT);
293 __assign_str(psname, path->source->name);
294 __entry->path_connect = path->connect;
295 __entry->path_source = (long)path->source;
296 ),
297
298 TP_printk("%c%s <- %s <- %s\n",
299 (int) __entry->path_source &&
300 (int) __entry->path_connect ? '*' : ' ',
301 __get_str(wname), __get_str(pname), __get_str(psname))
302);
303
304TRACE_EVENT(snd_soc_dapm_connected,
305
306 TP_PROTO(int paths, int stream),
307
308 TP_ARGS(paths, stream),
309
310 TP_STRUCT__entry(
311 __field( int, paths )
312 __field( int, stream )
313 ),
314
315 TP_fast_assign(
316 __entry->paths = paths;
317 __entry->stream = stream;
318 ),
319
320 TP_printk("%s: found %d paths\n",
321 __entry->stream ? "capture" : "playback", __entry->paths)
322);
323
244TRACE_EVENT(snd_soc_jack_irq, 324TRACE_EVENT(snd_soc_jack_irq,
245 325
246 TP_PROTO(const char *name), 326 TP_PROTO(const char *name),
diff --git a/include/trace/events/ext3.h b/include/trace/events/ext3.h
index 7b53c0573dc9..15d11a39be47 100644
--- a/include/trace/events/ext3.h
+++ b/include/trace/events/ext3.h
@@ -24,8 +24,8 @@ TRACE_EVENT(ext3_free_inode,
24 __entry->dev = inode->i_sb->s_dev; 24 __entry->dev = inode->i_sb->s_dev;
25 __entry->ino = inode->i_ino; 25 __entry->ino = inode->i_ino;
26 __entry->mode = inode->i_mode; 26 __entry->mode = inode->i_mode;
27 __entry->uid = inode->i_uid; 27 __entry->uid = i_uid_read(inode);
28 __entry->gid = inode->i_gid; 28 __entry->gid = i_gid_read(inode);
29 __entry->blocks = inode->i_blocks; 29 __entry->blocks = inode->i_blocks;
30 ), 30 ),
31 31
diff --git a/include/trace/events/ext4.h b/include/trace/events/ext4.h
index 319538bf17d2..69d8a69ea831 100644
--- a/include/trace/events/ext4.h
+++ b/include/trace/events/ext4.h
@@ -36,8 +36,8 @@ TRACE_EVENT(ext4_free_inode,
36 __entry->dev = inode->i_sb->s_dev; 36 __entry->dev = inode->i_sb->s_dev;
37 __entry->ino = inode->i_ino; 37 __entry->ino = inode->i_ino;
38 __entry->mode = inode->i_mode; 38 __entry->mode = inode->i_mode;
39 __entry->uid = inode->i_uid; 39 __entry->uid = i_uid_read(inode);
40 __entry->gid = inode->i_gid; 40 __entry->gid = i_gid_read(inode);
41 __entry->blocks = inode->i_blocks; 41 __entry->blocks = inode->i_blocks;
42 ), 42 ),
43 43
diff --git a/include/trace/events/jbd.h b/include/trace/events/jbd.h
index aff64d82d713..da6f2591c25e 100644
--- a/include/trace/events/jbd.h
+++ b/include/trace/events/jbd.h
@@ -36,19 +36,17 @@ DECLARE_EVENT_CLASS(jbd_commit,
36 36
37 TP_STRUCT__entry( 37 TP_STRUCT__entry(
38 __field( dev_t, dev ) 38 __field( dev_t, dev )
39 __field( char, sync_commit )
40 __field( int, transaction ) 39 __field( int, transaction )
41 ), 40 ),
42 41
43 TP_fast_assign( 42 TP_fast_assign(
44 __entry->dev = journal->j_fs_dev->bd_dev; 43 __entry->dev = journal->j_fs_dev->bd_dev;
45 __entry->sync_commit = commit_transaction->t_synchronous_commit;
46 __entry->transaction = commit_transaction->t_tid; 44 __entry->transaction = commit_transaction->t_tid;
47 ), 45 ),
48 46
49 TP_printk("dev %d,%d transaction %d sync %d", 47 TP_printk("dev %d,%d transaction %d",
50 MAJOR(__entry->dev), MINOR(__entry->dev), 48 MAJOR(__entry->dev), MINOR(__entry->dev),
51 __entry->transaction, __entry->sync_commit) 49 __entry->transaction)
52); 50);
53 51
54DEFINE_EVENT(jbd_commit, jbd_start_commit, 52DEFINE_EVENT(jbd_commit, jbd_start_commit,
@@ -87,19 +85,17 @@ TRACE_EVENT(jbd_drop_transaction,
87 85
88 TP_STRUCT__entry( 86 TP_STRUCT__entry(
89 __field( dev_t, dev ) 87 __field( dev_t, dev )
90 __field( char, sync_commit )
91 __field( int, transaction ) 88 __field( int, transaction )
92 ), 89 ),
93 90
94 TP_fast_assign( 91 TP_fast_assign(
95 __entry->dev = journal->j_fs_dev->bd_dev; 92 __entry->dev = journal->j_fs_dev->bd_dev;
96 __entry->sync_commit = commit_transaction->t_synchronous_commit;
97 __entry->transaction = commit_transaction->t_tid; 93 __entry->transaction = commit_transaction->t_tid;
98 ), 94 ),
99 95
100 TP_printk("dev %d,%d transaction %d sync %d", 96 TP_printk("dev %d,%d transaction %d",
101 MAJOR(__entry->dev), MINOR(__entry->dev), 97 MAJOR(__entry->dev), MINOR(__entry->dev),
102 __entry->transaction, __entry->sync_commit) 98 __entry->transaction)
103); 99);
104 100
105TRACE_EVENT(jbd_end_commit, 101TRACE_EVENT(jbd_end_commit,
@@ -109,21 +105,19 @@ TRACE_EVENT(jbd_end_commit,
109 105
110 TP_STRUCT__entry( 106 TP_STRUCT__entry(
111 __field( dev_t, dev ) 107 __field( dev_t, dev )
112 __field( char, sync_commit )
113 __field( int, transaction ) 108 __field( int, transaction )
114 __field( int, head ) 109 __field( int, head )
115 ), 110 ),
116 111
117 TP_fast_assign( 112 TP_fast_assign(
118 __entry->dev = journal->j_fs_dev->bd_dev; 113 __entry->dev = journal->j_fs_dev->bd_dev;
119 __entry->sync_commit = commit_transaction->t_synchronous_commit;
120 __entry->transaction = commit_transaction->t_tid; 114 __entry->transaction = commit_transaction->t_tid;
121 __entry->head = journal->j_tail_sequence; 115 __entry->head = journal->j_tail_sequence;
122 ), 116 ),
123 117
124 TP_printk("dev %d,%d transaction %d sync %d head %d", 118 TP_printk("dev %d,%d transaction %d head %d",
125 MAJOR(__entry->dev), MINOR(__entry->dev), 119 MAJOR(__entry->dev), MINOR(__entry->dev),
126 __entry->transaction, __entry->sync_commit, __entry->head) 120 __entry->transaction, __entry->head)
127); 121);
128 122
129TRACE_EVENT(jbd_do_submit_data, 123TRACE_EVENT(jbd_do_submit_data,
@@ -133,19 +127,17 @@ TRACE_EVENT(jbd_do_submit_data,
133 127
134 TP_STRUCT__entry( 128 TP_STRUCT__entry(
135 __field( dev_t, dev ) 129 __field( dev_t, dev )
136 __field( char, sync_commit )
137 __field( int, transaction ) 130 __field( int, transaction )
138 ), 131 ),
139 132
140 TP_fast_assign( 133 TP_fast_assign(
141 __entry->dev = journal->j_fs_dev->bd_dev; 134 __entry->dev = journal->j_fs_dev->bd_dev;
142 __entry->sync_commit = commit_transaction->t_synchronous_commit;
143 __entry->transaction = commit_transaction->t_tid; 135 __entry->transaction = commit_transaction->t_tid;
144 ), 136 ),
145 137
146 TP_printk("dev %d,%d transaction %d sync %d", 138 TP_printk("dev %d,%d transaction %d",
147 MAJOR(__entry->dev), MINOR(__entry->dev), 139 MAJOR(__entry->dev), MINOR(__entry->dev),
148 __entry->transaction, __entry->sync_commit) 140 __entry->transaction)
149); 141);
150 142
151TRACE_EVENT(jbd_cleanup_journal_tail, 143TRACE_EVENT(jbd_cleanup_journal_tail,
@@ -177,24 +169,23 @@ TRACE_EVENT(jbd_cleanup_journal_tail,
177 __entry->block_nr, __entry->freed) 169 __entry->block_nr, __entry->freed)
178); 170);
179 171
180TRACE_EVENT(jbd_update_superblock_end, 172TRACE_EVENT(journal_write_superblock,
181 TP_PROTO(journal_t *journal, int wait), 173 TP_PROTO(journal_t *journal, int write_op),
182 174
183 TP_ARGS(journal, wait), 175 TP_ARGS(journal, write_op),
184 176
185 TP_STRUCT__entry( 177 TP_STRUCT__entry(
186 __field( dev_t, dev ) 178 __field( dev_t, dev )
187 __field( int, wait ) 179 __field( int, write_op )
188 ), 180 ),
189 181
190 TP_fast_assign( 182 TP_fast_assign(
191 __entry->dev = journal->j_fs_dev->bd_dev; 183 __entry->dev = journal->j_fs_dev->bd_dev;
192 __entry->wait = wait; 184 __entry->write_op = write_op;
193 ), 185 ),
194 186
195 TP_printk("dev %d,%d wait %d", 187 TP_printk("dev %d,%d write_op %x", MAJOR(__entry->dev),
196 MAJOR(__entry->dev), MINOR(__entry->dev), 188 MINOR(__entry->dev), __entry->write_op)
197 __entry->wait)
198); 189);
199 190
200#endif /* _TRACE_JBD_H */ 191#endif /* _TRACE_JBD_H */
diff --git a/include/trace/events/power.h b/include/trace/events/power.h
index cae9a94f025d..0c9783841a30 100644
--- a/include/trace/events/power.h
+++ b/include/trace/events/power.h
@@ -65,6 +65,40 @@ TRACE_EVENT(machine_suspend,
65 TP_printk("state=%lu", (unsigned long)__entry->state) 65 TP_printk("state=%lu", (unsigned long)__entry->state)
66); 66);
67 67
68DECLARE_EVENT_CLASS(wakeup_source,
69
70 TP_PROTO(const char *name, unsigned int state),
71
72 TP_ARGS(name, state),
73
74 TP_STRUCT__entry(
75 __string( name, name )
76 __field( u64, state )
77 ),
78
79 TP_fast_assign(
80 __assign_str(name, name);
81 __entry->state = state;
82 ),
83
84 TP_printk("%s state=0x%lx", __get_str(name),
85 (unsigned long)__entry->state)
86);
87
88DEFINE_EVENT(wakeup_source, wakeup_source_activate,
89
90 TP_PROTO(const char *name, unsigned int state),
91
92 TP_ARGS(name, state)
93);
94
95DEFINE_EVENT(wakeup_source, wakeup_source_deactivate,
96
97 TP_PROTO(const char *name, unsigned int state),
98
99 TP_ARGS(name, state)
100);
101
68#ifdef CONFIG_EVENT_POWER_TRACING_DEPRECATED 102#ifdef CONFIG_EVENT_POWER_TRACING_DEPRECATED
69 103
70/* 104/*
diff --git a/include/trace/events/rcu.h b/include/trace/events/rcu.h
index 337099783f37..1480900c511c 100644
--- a/include/trace/events/rcu.h
+++ b/include/trace/events/rcu.h
@@ -292,6 +292,8 @@ TRACE_EVENT(rcu_dyntick,
292 * "More callbacks": Still more callbacks, try again to clear them out. 292 * "More callbacks": Still more callbacks, try again to clear them out.
293 * "Callbacks drained": All callbacks processed, off to dyntick idle! 293 * "Callbacks drained": All callbacks processed, off to dyntick idle!
294 * "Timer": Timer fired to cause CPU to continue processing callbacks. 294 * "Timer": Timer fired to cause CPU to continue processing callbacks.
295 * "Demigrate": Timer fired on wrong CPU, woke up correct CPU.
296 * "Cleanup after idle": Idle exited, timer canceled.
295 */ 297 */
296TRACE_EVENT(rcu_prep_idle, 298TRACE_EVENT(rcu_prep_idle,
297 299
diff --git a/include/trace/events/workqueue.h b/include/trace/events/workqueue.h
index 7d497291c85d..4018f5058f27 100644
--- a/include/trace/events/workqueue.h
+++ b/include/trace/events/workqueue.h
@@ -103,7 +103,7 @@ TRACE_EVENT(workqueue_execute_start,
103); 103);
104 104
105/** 105/**
106 * workqueue_execute_end - called immediately before the workqueue callback 106 * workqueue_execute_end - called immediately after the workqueue callback
107 * @work: pointer to struct work_struct 107 * @work: pointer to struct work_struct
108 * 108 *
109 * Allows to track workqueue execution. 109 * Allows to track workqueue execution.
diff --git a/include/trace/events/writeback.h b/include/trace/events/writeback.h
index 7b81887b023f..b453d92c2253 100644
--- a/include/trace/events/writeback.h
+++ b/include/trace/events/writeback.h
@@ -372,6 +372,35 @@ TRACE_EVENT(balance_dirty_pages,
372 ) 372 )
373); 373);
374 374
375TRACE_EVENT(writeback_sb_inodes_requeue,
376
377 TP_PROTO(struct inode *inode),
378 TP_ARGS(inode),
379
380 TP_STRUCT__entry(
381 __array(char, name, 32)
382 __field(unsigned long, ino)
383 __field(unsigned long, state)
384 __field(unsigned long, dirtied_when)
385 ),
386
387 TP_fast_assign(
388 strncpy(__entry->name,
389 dev_name(inode_to_bdi(inode)->dev), 32);
390 __entry->ino = inode->i_ino;
391 __entry->state = inode->i_state;
392 __entry->dirtied_when = inode->dirtied_when;
393 ),
394
395 TP_printk("bdi %s: ino=%lu state=%s dirtied_when=%lu age=%lu",
396 __entry->name,
397 __entry->ino,
398 show_inode_state(__entry->state),
399 __entry->dirtied_when,
400 (jiffies - __entry->dirtied_when) / HZ
401 )
402);
403
375DECLARE_EVENT_CLASS(writeback_congest_waited_template, 404DECLARE_EVENT_CLASS(writeback_congest_waited_template,
376 405
377 TP_PROTO(unsigned int usec_timeout, unsigned int usec_delayed), 406 TP_PROTO(unsigned int usec_timeout, unsigned int usec_delayed),
@@ -450,13 +479,6 @@ DECLARE_EVENT_CLASS(writeback_single_inode_template,
450 ) 479 )
451); 480);
452 481
453DEFINE_EVENT(writeback_single_inode_template, writeback_single_inode_requeue,
454 TP_PROTO(struct inode *inode,
455 struct writeback_control *wbc,
456 unsigned long nr_to_write),
457 TP_ARGS(inode, wbc, nr_to_write)
458);
459
460DEFINE_EVENT(writeback_single_inode_template, writeback_single_inode, 482DEFINE_EVENT(writeback_single_inode_template, writeback_single_inode,
461 TP_PROTO(struct inode *inode, 483 TP_PROTO(struct inode *inode,
462 struct writeback_control *wbc, 484 struct writeback_control *wbc,
diff --git a/include/video/omap-panel-nokia-dsi.h b/include/video/omap-panel-nokia-dsi.h
index 7dc71f9c13e6..04219a295539 100644
--- a/include/video/omap-panel-nokia-dsi.h
+++ b/include/video/omap-panel-nokia-dsi.h
@@ -11,6 +11,7 @@ struct omap_dss_device;
11 * @esd_interval: interval of ESD checks, 0 = disabled (ms) 11 * @esd_interval: interval of ESD checks, 0 = disabled (ms)
12 * @ulps_timeout: time to wait before entering ULPS, 0 = disabled (ms) 12 * @ulps_timeout: time to wait before entering ULPS, 0 = disabled (ms)
13 * @use_dsi_backlight: true if panel uses DSI command to control backlight 13 * @use_dsi_backlight: true if panel uses DSI command to control backlight
14 * @pin_config: DSI pin configuration
14 */ 15 */
15struct nokia_dsi_panel_data { 16struct nokia_dsi_panel_data {
16 const char *name; 17 const char *name;
@@ -24,6 +25,8 @@ struct nokia_dsi_panel_data {
24 unsigned ulps_timeout; 25 unsigned ulps_timeout;
25 26
26 bool use_dsi_backlight; 27 bool use_dsi_backlight;
28
29 struct omap_dsi_pin_config pin_config;
27}; 30};
28 31
29#endif /* __OMAP_NOKIA_DSI_PANEL_H */ 32#endif /* __OMAP_NOKIA_DSI_PANEL_H */
diff --git a/include/video/omap-panel-dvi.h b/include/video/omap-panel-tfp410.h
index 87ad567b4229..68c31d79c571 100644
--- a/include/video/omap-panel-dvi.h
+++ b/include/video/omap-panel-tfp410.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Header for DVI output driver 2 * Header for TFP410 chip driver
3 * 3 *
4 * Copyright (C) 2011 Texas Instruments Inc 4 * Copyright (C) 2011 Texas Instruments Inc
5 * Author: Tomi Valkeinen <tomi.valkeinen@ti.com> 5 * Author: Tomi Valkeinen <tomi.valkeinen@ti.com>
@@ -17,21 +17,19 @@
17 * this program. If not, see <http://www.gnu.org/licenses/>. 17 * this program. If not, see <http://www.gnu.org/licenses/>.
18 */ 18 */
19 19
20#ifndef __OMAP_PANEL_DVI_H 20#ifndef __OMAP_PANEL_TFP410_H
21#define __OMAP_PANEL_DVI_H 21#define __OMAP_PANEL_TFP410_H
22 22
23struct omap_dss_device; 23struct omap_dss_device;
24 24
25/** 25/**
26 * struct panel_dvi_platform_data - panel driver configuration data 26 * struct tfp410_platform_data - panel driver configuration data
27 * @platform_enable: platform specific panel enable function
28 * @platform_disable: platform specific panel disable function
29 * @i2c_bus_num: i2c bus id for the panel 27 * @i2c_bus_num: i2c bus id for the panel
28 * @power_down_gpio: gpio number for PD pin (or -1 if not available)
30 */ 29 */
31struct panel_dvi_platform_data { 30struct tfp410_platform_data {
32 int (*platform_enable)(struct omap_dss_device *dssdev);
33 void (*platform_disable)(struct omap_dss_device *dssdev);
34 u16 i2c_bus_num; 31 u16 i2c_bus_num;
32 int power_down_gpio;
35}; 33};
36 34
37#endif /* __OMAP_PANEL_DVI_H */ 35#endif /* __OMAP_PANEL_TFP410_H */
diff --git a/include/video/omapdss.h b/include/video/omapdss.h
index 483f67caa7ad..1c46a14341dd 100644
--- a/include/video/omapdss.h
+++ b/include/video/omapdss.h
@@ -468,6 +468,21 @@ struct omap_overlay_manager {
468 int (*wait_for_vsync)(struct omap_overlay_manager *mgr); 468 int (*wait_for_vsync)(struct omap_overlay_manager *mgr);
469}; 469};
470 470
471/* 22 pins means 1 clk lane and 10 data lanes */
472#define OMAP_DSS_MAX_DSI_PINS 22
473
474struct omap_dsi_pin_config {
475 int num_pins;
476 /*
477 * pin numbers in the following order:
478 * clk+, clk-
479 * data1+, data1-
480 * data2+, data2-
481 * ...
482 */
483 int pins[OMAP_DSS_MAX_DSI_PINS];
484};
485
471struct omap_dss_device { 486struct omap_dss_device {
472 struct device dev; 487 struct device dev;
473 488
@@ -490,17 +505,6 @@ struct omap_dss_device {
490 } sdi; 505 } sdi;
491 506
492 struct { 507 struct {
493 u8 clk_lane;
494 u8 clk_pol;
495 u8 data1_lane;
496 u8 data1_pol;
497 u8 data2_lane;
498 u8 data2_pol;
499 u8 data3_lane;
500 u8 data3_pol;
501 u8 data4_lane;
502 u8 data4_pol;
503
504 int module; 508 int module;
505 509
506 bool ext_te; 510 bool ext_te;
@@ -687,6 +691,8 @@ int omap_dsi_update(struct omap_dss_device *dssdev, int channel,
687int omap_dsi_request_vc(struct omap_dss_device *dssdev, int *channel); 691int omap_dsi_request_vc(struct omap_dss_device *dssdev, int *channel);
688int omap_dsi_set_vc_id(struct omap_dss_device *dssdev, int channel, int vc_id); 692int omap_dsi_set_vc_id(struct omap_dss_device *dssdev, int channel, int vc_id);
689void omap_dsi_release_vc(struct omap_dss_device *dssdev, int channel); 693void omap_dsi_release_vc(struct omap_dss_device *dssdev, int channel);
694int omapdss_dsi_configure_pins(struct omap_dss_device *dssdev,
695 const struct omap_dsi_pin_config *pin_cfg);
690 696
691int omapdss_dsi_display_enable(struct omap_dss_device *dssdev); 697int omapdss_dsi_display_enable(struct omap_dss_device *dssdev);
692void omapdss_dsi_display_disable(struct omap_dss_device *dssdev, 698void omapdss_dsi_display_disable(struct omap_dss_device *dssdev,
diff --git a/include/video/vga.h b/include/video/vga.h
index 2b8691f7d256..cac567f22e62 100644
--- a/include/video/vga.h
+++ b/include/video/vga.h
@@ -19,29 +19,7 @@
19 19
20#include <linux/types.h> 20#include <linux/types.h>
21#include <asm/io.h> 21#include <asm/io.h>
22#ifndef CONFIG_AMIGA
23#include <asm/vga.h> 22#include <asm/vga.h>
24#else
25/*
26 * FIXME
27 * Ugh, we don't have PCI space, so map readb() and friends to use Zorro space
28 * for MMIO accesses. This should make cirrusfb work again on Amiga
29 */
30#undef inb_p
31#undef inw_p
32#undef outb_p
33#undef outw
34#undef readb
35#undef writeb
36#undef writew
37#define inb_p(port) 0
38#define inw_p(port) 0
39#define outb_p(port, val) do { } while (0)
40#define outw(port, val) do { } while (0)
41#define readb z_readb
42#define writeb z_writeb
43#define writew z_writew
44#endif
45#include <asm/byteorder.h> 23#include <asm/byteorder.h>
46 24
47 25
diff --git a/include/xen/acpi.h b/include/xen/acpi.h
new file mode 100644
index 000000000000..48a9c0171b65
--- /dev/null
+++ b/include/xen/acpi.h
@@ -0,0 +1,58 @@
1/******************************************************************************
2 * acpi.h
3 * acpi file for domain 0 kernel
4 *
5 * Copyright (c) 2011 Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
6 * Copyright (c) 2011 Yu Ke <ke.yu@intel.com>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License version 2
10 * as published by the Free Software Foundation; or, when distributed
11 * separately from the Linux kernel or incorporated into other
12 * software packages, subject to the following license:
13 *
14 * Permission is hereby granted, free of charge, to any person obtaining a copy
15 * of this source file (the "Software"), to deal in the Software without
16 * restriction, including without limitation the rights to use, copy, modify,
17 * merge, publish, distribute, sublicense, and/or sell copies of the Software,
18 * and to permit persons to whom the Software is furnished to do so, subject to
19 * the following conditions:
20 *
21 * The above copyright notice and this permission notice shall be included in
22 * all copies or substantial portions of the Software.
23 *
24 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
30 * IN THE SOFTWARE.
31 */
32
33#ifndef _XEN_ACPI_H
34#define _XEN_ACPI_H
35
36#include <linux/types.h>
37
38#ifdef CONFIG_XEN_DOM0
39#include <asm/xen/hypervisor.h>
40#include <xen/xen.h>
41#include <linux/acpi.h>
42
43int xen_acpi_notify_hypervisor_state(u8 sleep_state,
44 u32 pm1a_cnt, u32 pm1b_cnd);
45
46static inline void xen_acpi_sleep_register(void)
47{
48 if (xen_initial_domain())
49 acpi_os_set_prepare_sleep(
50 &xen_acpi_notify_hypervisor_state);
51}
52#else
53static inline void xen_acpi_sleep_register(void)
54{
55}
56#endif
57
58#endif /* _XEN_ACPI_H */
diff --git a/include/xen/events.h b/include/xen/events.h
index 0f773708e02c..04399b28e821 100644
--- a/include/xen/events.h
+++ b/include/xen/events.h
@@ -103,6 +103,9 @@ int xen_irq_from_pirq(unsigned pirq);
103/* Return the pirq allocated to the irq. */ 103/* Return the pirq allocated to the irq. */
104int xen_pirq_from_irq(unsigned irq); 104int xen_pirq_from_irq(unsigned irq);
105 105
106/* Return the irq allocated to the gsi */
107int xen_irq_from_gsi(unsigned gsi);
108
106/* Determine whether to ignore this IRQ if it is passed to a guest. */ 109/* Determine whether to ignore this IRQ if it is passed to a guest. */
107int xen_test_irq_shared(int irq); 110int xen_test_irq_shared(int irq);
108 111
diff --git a/include/xen/grant_table.h b/include/xen/grant_table.h
index 15f8a00ff003..11e27c3af3cb 100644
--- a/include/xen/grant_table.h
+++ b/include/xen/grant_table.h
@@ -46,6 +46,8 @@
46 46
47#include <xen/features.h> 47#include <xen/features.h>
48 48
49#define GNTTAB_RESERVED_XENSTORE 1
50
49/* NR_GRANT_FRAMES must be less than or equal to that configured in Xen */ 51/* NR_GRANT_FRAMES must be less than or equal to that configured in Xen */
50#define NR_GRANT_FRAMES 4 52#define NR_GRANT_FRAMES 4
51 53
diff --git a/include/xen/xenbus_dev.h b/include/xen/xenbus_dev.h
index ac5f0fe47ed9..bbee8c6a349d 100644
--- a/include/xen/xenbus_dev.h
+++ b/include/xen/xenbus_dev.h
@@ -38,4 +38,7 @@
38#define IOCTL_XENBUS_BACKEND_EVTCHN \ 38#define IOCTL_XENBUS_BACKEND_EVTCHN \
39 _IOC(_IOC_NONE, 'B', 0, 0) 39 _IOC(_IOC_NONE, 'B', 0, 0)
40 40
41#define IOCTL_XENBUS_BACKEND_SETUP \
42 _IOC(_IOC_NONE, 'B', 1, 0)
43
41#endif /* __LINUX_XEN_XENBUS_DEV_H__ */ 44#endif /* __LINUX_XEN_XENBUS_DEV_H__ */