aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorOlof Johansson <olof@lixom.net>2014-07-19 17:59:07 -0400
committerOlof Johansson <olof@lixom.net>2014-07-19 17:59:07 -0400
commit4e9816d012dbc28dc89559261c6ffbf8ffc440dd (patch)
treedee9f8b31f3d6d2fb141541da88e1cc1329b017e /include
parentda98f44f27d81d7fe9a41f69af4fe08c18d13b56 (diff)
parent1795cd9b3a91d4b5473c97f491d63892442212ab (diff)
Merge tag 'v3.16-rc5' into next/fixes-non-critical
Linux 3.16-rc5
Diffstat (limited to 'include')
-rw-r--r--include/acpi/acpi.h4
-rw-r--r--include/acpi/acpi_bus.h9
-rw-r--r--include/acpi/acpi_drivers.h5
-rw-r--r--include/acpi/acpi_io.h3
-rw-r--r--include/acpi/acpixf.h838
-rw-r--r--include/acpi/actbl.h11
-rw-r--r--include/acpi/actbl1.h4
-rw-r--r--include/acpi/actbl2.h71
-rw-r--r--include/acpi/actypes.h21
-rw-r--r--include/acpi/platform/acenvex.h63
-rw-r--r--include/acpi/platform/acgcc.h11
-rw-r--r--include/acpi/platform/aclinux.h209
-rw-r--r--include/acpi/platform/aclinuxex.h112
-rw-r--r--include/acpi/processor.h10
-rw-r--r--include/acpi/video.h4
-rw-r--r--include/asm-generic/atomic.h7
-rw-r--r--include/asm-generic/barrier.h8
-rw-r--r--include/asm-generic/bitops.h9
-rw-r--r--include/asm-generic/bitops/atomic.h2
-rw-r--r--include/asm-generic/bitops/lock.h2
-rw-r--r--include/asm-generic/dma-coherent.h13
-rw-r--r--include/asm-generic/ioctl.h5
-rw-r--r--include/asm-generic/pgtable.h8
-rw-r--r--include/asm-generic/qrwlock.h166
-rw-r--r--include/asm-generic/qrwlock_types.h21
-rw-r--r--include/asm-generic/unaligned.h21
-rw-r--r--include/asm-generic/vmlinux.lds.h72
-rw-r--r--include/crypto/internal/hash.h13
-rw-r--r--include/drm/drmP.h54
-rw-r--r--include/drm/drm_crtc.h92
-rw-r--r--include/drm/drm_crtc_helper.h6
-rw-r--r--include/drm/drm_dp_helper.h88
-rw-r--r--include/drm/drm_edid.h5
-rw-r--r--include/drm/drm_fb_helper.h2
-rw-r--r--include/drm/drm_flip_work.h1
-rw-r--r--include/drm/drm_mipi_dsi.h2
-rw-r--r--include/drm/drm_modes.h2
-rw-r--r--include/drm/drm_modeset_lock.h126
-rw-r--r--include/drm/drm_plane_helper.h24
-rw-r--r--include/drm/i915_pciids.h36
-rw-r--r--include/drm/i915_powerwell.h5
-rw-r--r--include/drm/ttm/ttm_bo_api.h5
-rw-r--r--include/dt-bindings/clk/ti-dra7-atl.h40
-rw-r--r--include/dt-bindings/clock/bcm21664.h62
-rw-r--r--include/dt-bindings/clock/bcm281xx.h12
-rw-r--r--include/dt-bindings/clock/berlin2.h45
-rw-r--r--include/dt-bindings/clock/berlin2q.h31
-rw-r--r--include/dt-bindings/clock/exynos3250.h258
-rw-r--r--include/dt-bindings/clock/exynos4.h2
-rw-r--r--include/dt-bindings/clock/exynos5250.h21
-rw-r--r--include/dt-bindings/clock/exynos5260-clk.h469
-rw-r--r--include/dt-bindings/clock/exynos5410.h33
-rw-r--r--include/dt-bindings/clock/exynos5420.h46
-rw-r--r--include/dt-bindings/clock/hix5hd2-clock.h58
-rw-r--r--include/dt-bindings/clock/imx6sl-clock.h3
-rw-r--r--include/dt-bindings/clock/imx6sx-clock.h256
-rw-r--r--include/dt-bindings/clock/lsi,axm5516-clks.h36
-rw-r--r--include/dt-bindings/clock/qcom,gcc-msm8960.h7
-rw-r--r--include/dt-bindings/clock/qcom,gcc-msm8974.h4
-rw-r--r--include/dt-bindings/clock/r7s72100-clock.h41
-rw-r--r--include/dt-bindings/clock/r8a7779-clock.h64
-rw-r--r--include/dt-bindings/clock/r8a7790-clock.h7
-rw-r--r--include/dt-bindings/clock/r8a7791-clock.h8
-rw-r--r--include/dt-bindings/clock/s3c2410.h62
-rw-r--r--include/dt-bindings/clock/s3c2412.h73
-rw-r--r--include/dt-bindings/clock/s3c2443.h92
-rw-r--r--include/dt-bindings/clock/stih415-clks.h16
-rw-r--r--include/dt-bindings/clock/stih416-clks.h16
-rw-r--r--include/dt-bindings/clock/tegra114-car.h3
-rw-r--r--include/dt-bindings/clock/tegra124-car.h3
-rw-r--r--include/dt-bindings/pinctrl/omap.h25
-rw-r--r--include/dt-bindings/reset-controller/stih415-resets.h1
-rw-r--r--include/dt-bindings/reset-controller/stih416-resets.h1
-rw-r--r--include/dt-bindings/reset/altr,rst-mgr.h90
-rw-r--r--include/dt-bindings/reset/qcom,gcc-msm8960.h2
-rw-r--r--include/dt-bindings/soc/qcom,gsbi.h26
-rw-r--r--include/linux/acpi.h30
-rw-r--r--include/linux/ahci_platform.h1
-rw-r--r--include/linux/amba/bus.h1
-rw-r--r--include/linux/amba/mmci.h42
-rw-r--r--include/linux/amba/xilinx_dma.h47
-rw-r--r--include/linux/ath9k_platform.h2
-rw-r--r--include/linux/atomic.h36
-rw-r--r--include/linux/backlight.h7
-rw-r--r--include/linux/bio.h15
-rw-r--r--include/linux/bitops.h20
-rw-r--r--include/linux/blk-mq.h103
-rw-r--r--include/linux/blk_types.h6
-rw-r--r--include/linux/blkdev.h75
-rw-r--r--include/linux/bootmem.h6
-rw-r--r--include/linux/buffer_head.h4
-rw-r--r--include/linux/can/core.h6
-rw-r--r--include/linux/can/dev.h6
-rw-r--r--include/linux/can/led.h6
-rw-r--r--include/linux/can/platform/cc770.h6
-rw-r--r--include/linux/can/platform/mcp251x.h6
-rw-r--r--include/linux/can/platform/rcar_can.h17
-rw-r--r--include/linux/can/platform/sja1000.h6
-rw-r--r--include/linux/can/platform/ti_hecc.h6
-rw-r--r--include/linux/can/skb.h6
-rw-r--r--include/linux/capability.h2
-rw-r--r--include/linux/ceph/ceph_fs.h2
-rw-r--r--include/linux/ceph/libceph.h2
-rw-r--r--include/linux/ceph/mon_client.h11
-rw-r--r--include/linux/cgroup.h272
-rw-r--r--include/linux/cgroup_subsys.h11
-rw-r--r--include/linux/clk-provider.h163
-rw-r--r--include/linux/clk/at91_pmc.h1
-rw-r--r--include/linux/clk/shmobile.h3
-rw-r--r--include/linux/clk/sunxi.h22
-rw-r--r--include/linux/clk/ti.h35
-rw-r--r--include/linux/clocksource.h16
-rw-r--r--include/linux/compaction.h4
-rw-r--r--include/linux/compiler-intel.h3
-rw-r--r--include/linux/compiler.h15
-rw-r--r--include/linux/connector.h1
-rw-r--r--include/linux/console_struct.h5
-rw-r--r--include/linux/cpu.h1
-rw-r--r--include/linux/cpufreq.h75
-rw-r--r--include/linux/cpuidle.h8
-rw-r--r--include/linux/cpumask.h10
-rw-r--r--include/linux/cpuset.h29
-rw-r--r--include/linux/crc7.h8
-rw-r--r--include/linux/dell-led.h10
-rw-r--r--include/linux/devfreq.h35
-rw-r--r--include/linux/device-mapper.h10
-rw-r--r--include/linux/device.h23
-rw-r--r--include/linux/dma-contiguous.h9
-rw-r--r--include/linux/dma-mapping.h20
-rw-r--r--include/linux/dmaengine.h3
-rw-r--r--include/linux/efi.h24
-rw-r--r--include/linux/elevator.h1
-rw-r--r--include/linux/ethtool.h21
-rw-r--r--include/linux/extcon.h37
-rw-r--r--include/linux/f2fs_fs.h8
-rw-r--r--include/linux/fb.h3
-rw-r--r--include/linux/filter.h384
-rw-r--r--include/linux/firewire.h3
-rw-r--r--include/linux/fs.h48
-rw-r--r--include/linux/ftrace.h58
-rw-r--r--include/linux/ftrace_event.h3
-rw-r--r--include/linux/genhd.h2
-rw-r--r--include/linux/gfp.h15
-rw-r--r--include/linux/goldfish.h15
-rw-r--r--include/linux/gpio/consumer.h41
-rw-r--r--include/linux/gpio/driver.h5
-rw-r--r--include/linux/gpio_keys.h48
-rw-r--r--include/linux/hid-sensor-hub.h8
-rw-r--r--include/linux/hid-sensor-ids.h1
-rw-r--r--include/linux/hid.h17
-rw-r--r--include/linux/hsi/hsi.h39
-rw-r--r--include/linux/hsi/ssi_protocol.h42
-rw-r--r--include/linux/hugetlb.h22
-rw-r--r--include/linux/hyperv.h7
-rw-r--r--include/linux/i2c/atmel_mxt_ts.h27
-rw-r--r--include/linux/i2c/twl.h4
-rw-r--r--include/linux/idr.h13
-rw-r--r--include/linux/ieee80211.h1
-rw-r--r--include/linux/if_bridge.h19
-rw-r--r--include/linux/if_link.h3
-rw-r--r--include/linux/if_macvlan.h4
-rw-r--r--include/linux/if_team.h1
-rw-r--r--include/linux/if_vlan.h19
-rw-r--r--include/linux/iio/common/st_sensors.h4
-rw-r--r--include/linux/iio/consumer.h13
-rw-r--r--include/linux/iio/iio.h24
-rw-r--r--include/linux/iio/types.h4
-rw-r--r--include/linux/init.h14
-rw-r--r--include/linux/input-polldev.h3
-rw-r--r--include/linux/input/pixcir_ts.h44
-rw-r--r--include/linux/input/touchscreen.h22
-rw-r--r--include/linux/interrupt.h54
-rw-r--r--include/linux/irq.h38
-rw-r--r--include/linux/irqchip/arm-gic.h2
-rw-r--r--include/linux/irqdesc.h4
-rw-r--r--include/linux/isdn/capiutil.h5
-rw-r--r--include/linux/jump_label.h20
-rw-r--r--include/linux/kernfs.h19
-rw-r--r--include/linux/key.h13
-rw-r--r--include/linux/kmemleak.h4
-rw-r--r--include/linux/kobject.h2
-rw-r--r--include/linux/kprobes.h23
-rw-r--r--include/linux/ktime.h24
-rw-r--r--include/linux/kvm_host.h17
-rw-r--r--include/linux/lockd/lockd.h2
-rw-r--r--include/linux/mbus.h2
-rw-r--r--include/linux/mc146818rtc.h4
-rw-r--r--include/linux/mcb.h6
-rw-r--r--include/linux/memblock.h81
-rw-r--r--include/linux/memcontrol.h32
-rw-r--r--include/linux/memory_hotplug.h14
-rw-r--r--include/linux/mempolicy.h6
-rw-r--r--include/linux/mfd/abx500.h1
-rw-r--r--include/linux/mfd/arizona/core.h3
-rw-r--r--include/linux/mfd/arizona/registers.h14
-rw-r--r--include/linux/mfd/axp20x.h180
-rw-r--r--include/linux/mfd/bcm590xx.h9
-rw-r--r--include/linux/mfd/core.h2
-rw-r--r--include/linux/mfd/cros_ec.h4
-rw-r--r--include/linux/mfd/cros_ec_commands.h1128
-rw-r--r--include/linux/mfd/ipaq-micro.h148
-rw-r--r--include/linux/mfd/kempld.h4
-rw-r--r--include/linux/mfd/max14577-private.h222
-rw-r--r--include/linux/mfd/max14577.h19
-rw-r--r--include/linux/mfd/mc13xxx.h22
-rw-r--r--include/linux/mfd/palmas.h2168
-rw-r--r--include/linux/mfd/pm8xxx/core.h81
-rw-r--r--include/linux/mfd/rdc321x.h2
-rw-r--r--include/linux/mfd/samsung/core.h35
-rw-r--r--include/linux/mfd/samsung/rtc.h86
-rw-r--r--include/linux/mfd/samsung/s2mps14.h2
-rw-r--r--include/linux/mfd/stmpe.h19
-rw-r--r--include/linux/mfd/syscon.h2
-rw-r--r--include/linux/mfd/syscon/exynos5-pmu.h44
-rw-r--r--include/linux/mfd/tc3589x.h1
-rw-r--r--include/linux/mfd/tps65090.h19
-rw-r--r--include/linux/mfd/tps65217.h1
-rw-r--r--include/linux/mfd/tps65218.h1
-rw-r--r--include/linux/mfd/tps6586x.h2
-rw-r--r--include/linux/mfd/twl6040.h3
-rw-r--r--include/linux/migrate.h11
-rw-r--r--include/linux/miscdevice.h2
-rw-r--r--include/linux/mlx4/device.h19
-rw-r--r--include/linux/mlx4/qp.h11
-rw-r--r--include/linux/mlx5/driver.h1
-rw-r--r--include/linux/mm.h39
-rw-r--r--include/linux/mm_types.h8
-rw-r--r--include/linux/mmc/card.h29
-rw-r--r--include/linux/mmc/dw_mmc.h14
-rw-r--r--include/linux/mmc/host.h59
-rw-r--r--include/linux/mmc/mmc.h23
-rw-r--r--include/linux/mmc/sdhci.h15
-rw-r--r--include/linux/mmdebug.h15
-rw-r--r--include/linux/mmzone.h35
-rw-r--r--include/linux/moduleparam.h2
-rw-r--r--include/linux/mtd/nand.h10
-rw-r--r--include/linux/mtd/pfow.h3
-rw-r--r--include/linux/mtd/spi-nor.h214
-rw-r--r--include/linux/net.h15
-rw-r--r--include/linux/netdev_features.h4
-rw-r--r--include/linux/netdevice.h142
-rw-r--r--include/linux/netfilter/nfnetlink_acct.h8
-rw-r--r--include/linux/netlink.h10
-rw-r--r--include/linux/nfs.h5
-rw-r--r--include/linux/nfs4.h2
-rw-r--r--include/linux/nfs_fs.h9
-rw-r--r--include/linux/nfs_page.h46
-rw-r--r--include/linux/nfs_xdr.h106
-rw-r--r--include/linux/nfsd/debug.h19
-rw-r--r--include/linux/nfsd/export.h110
-rw-r--r--include/linux/nfsd/nfsfh.h63
-rw-r--r--include/linux/nfsd/stats.h45
-rw-r--r--include/linux/nl802154.h31
-rw-r--r--include/linux/nmi.h12
-rw-r--r--include/linux/nvme.h14
-rw-r--r--include/linux/of.h29
-rw-r--r--include/linux/of_address.h15
-rw-r--r--include/linux/of_fdt.h64
-rw-r--r--include/linux/of_gpio.h35
-rw-r--r--include/linux/of_irq.h5
-rw-r--r--include/linux/of_mdio.h36
-rw-r--r--include/linux/of_pci.h36
-rw-r--r--include/linux/of_platform.h7
-rw-r--r--include/linux/of_reserved_mem.h22
-rw-r--r--include/linux/omap-dma.h21
-rw-r--r--include/linux/omap-dmaengine.h21
-rw-r--r--include/linux/page-flags.h17
-rw-r--r--include/linux/pageblock-flags.h30
-rw-r--r--include/linux/pagemap.h111
-rw-r--r--include/linux/pci.h57
-rw-r--r--include/linux/pci_ids.h3
-rw-r--r--include/linux/percpu-defs.h4
-rw-r--r--include/linux/percpu-refcount.h40
-rw-r--r--include/linux/percpu.h4
-rw-r--r--include/linux/perf_event.h21
-rw-r--r--include/linux/phy.h17
-rw-r--r--include/linux/phy_fixed.h16
-rw-r--r--include/linux/platform_data/adau17x1.h109
-rw-r--r--include/linux/platform_data/at91_adc.h27
-rw-r--r--include/linux/platform_data/atmel.h8
-rw-r--r--include/linux/platform_data/edma.h28
-rw-r--r--include/linux/platform_data/elm.h3
-rw-r--r--include/linux/platform_data/intel-mid_wdt.h22
-rw-r--r--include/linux/platform_data/ipmmu-vmsa.h24
-rw-r--r--include/linux/platform_data/leds-pca9685.h35
-rw-r--r--include/linux/platform_data/max3421-hcd.h24
-rw-r--r--include/linux/platform_data/mipi-csis.h28
-rw-r--r--include/linux/platform_data/mtd-nand-omap2.h5
-rw-r--r--include/linux/platform_data/mtd-nand-pxa3xx.h3
-rw-r--r--include/linux/platform_data/omap4-keypad.h13
-rw-r--r--include/linux/platform_data/pwm-renesas-tpu.h16
-rw-r--r--include/linux/platform_data/shtc1.h23
-rw-r--r--include/linux/platform_data/st21nfca.h32
-rw-r--r--include/linux/platform_data/syscon.h8
-rw-r--r--include/linux/plist.h45
-rw-r--r--include/linux/pm.h36
-rw-r--r--include/linux/pm_opp.h20
-rw-r--r--include/linux/pm_runtime.h6
-rw-r--r--include/linux/power_supply.h2
-rw-r--r--include/linux/printk.h38
-rw-r--r--include/linux/proc_fs.h4
-rw-r--r--include/linux/profile.h1
-rw-r--r--include/linux/ptrace.h35
-rw-r--r--include/linux/pwm.h6
-rw-r--r--include/linux/pwm_backlight.h5
-rw-r--r--include/linux/quota.h1
-rw-r--r--include/linux/rcupdate.h72
-rw-r--r--include/linux/rcutiny.h4
-rw-r--r--include/linux/rcutree.h1
-rw-r--r--include/linux/regmap.h6
-rw-r--r--include/linux/regulator/consumer.h47
-rw-r--r--include/linux/rfkill-gpio.h10
-rw-r--r--include/linux/ring_buffer.h2
-rw-r--r--include/linux/rmap.h11
-rw-r--r--include/linux/rtnetlink.h5
-rw-r--r--include/linux/rwsem.h25
-rw-r--r--include/linux/sched.h149
-rw-r--r--include/linux/sched/prio.h16
-rw-r--r--include/linux/sched/sysctl.h4
-rw-r--r--include/linux/sched_clock.h1
-rw-r--r--include/linux/security.h6
-rw-r--r--include/linux/serial_core.h22
-rw-r--r--include/linux/sh_timer.h1
-rw-r--r--include/linux/shdma-base.h1
-rw-r--r--include/linux/shm.h3
-rw-r--r--include/linux/signal.h21
-rw-r--r--include/linux/skbuff.h172
-rw-r--r--include/linux/slab.h20
-rw-r--r--include/linux/smp.h2
-rw-r--r--include/linux/socket.h4
-rw-r--r--include/linux/spi/adi_spi3.h254
-rw-r--r--include/linux/spi/at86rf230.h14
-rw-r--r--include/linux/spi/rspi.h2
-rw-r--r--include/linux/splice.h10
-rw-r--r--include/linux/ssb/ssb.h1
-rw-r--r--include/linux/string.h3
-rw-r--r--include/linux/sunrpc/sched.h8
-rw-r--r--include/linux/sunrpc/svc.h13
-rw-r--r--include/linux/sunrpc/svc_rdma.h3
-rw-r--r--include/linux/sunrpc/svc_xprt.h2
-rw-r--r--include/linux/sunrpc/xdr.h3
-rw-r--r--include/linux/sunrpc/xprt.h14
-rw-r--r--include/linux/suspend.h11
-rw-r--r--include/linux/swap.h38
-rw-r--r--include/linux/swapfile.h2
-rw-r--r--include/linux/swapops.h2
-rw-r--r--include/linux/swiotlb.h2
-rw-r--r--include/linux/syscalls.h4
-rw-r--r--include/linux/sysfs.h2
-rw-r--r--include/linux/tcp.h10
-rw-r--r--include/linux/thread_info.h16
-rw-r--r--include/linux/topology.h131
-rw-r--r--include/linux/torture.h8
-rw-r--r--include/linux/trace_seq.h10
-rw-r--r--include/linux/tracehook.h2
-rw-r--r--include/linux/tracepoint.h10
-rw-r--r--include/linux/tty_ldisc.h5
-rw-r--r--include/linux/types.h1
-rw-r--r--include/linux/udp.h24
-rw-r--r--include/linux/uio.h66
-rw-r--r--include/linux/uprobes.h7
-rw-r--r--include/linux/usb.h2
-rw-r--r--include/linux/usb/cdc_ncm.h35
-rw-r--r--include/linux/usb/composite.h79
-rw-r--r--include/linux/usb/msm_hsusb.h39
-rw-r--r--include/linux/usb/msm_hsusb_hw.h14
-rw-r--r--include/linux/usb/usb_phy_generic.h (renamed from include/linux/usb/usb_phy_gen_xceiv.h)13
-rw-r--r--include/linux/usb_usual.h4
-rw-r--r--include/linux/vexpress.h94
-rw-r--r--include/linux/vfio.h5
-rw-r--r--include/linux/virtio.h2
-rw-r--r--include/linux/virtio_scsi.h15
-rw-r--r--include/linux/vm_event_item.h4
-rw-r--r--include/linux/vmstat.h6
-rw-r--r--include/linux/workqueue.h40
-rw-r--r--include/linux/zbud.h2
-rw-r--r--include/media/adv7604.h124
-rw-r--r--include/media/davinci/vpbe_display.h6
-rw-r--r--include/media/davinci/vpfe_capture.h6
-rw-r--r--include/media/exynos-fimc.h (renamed from include/media/s5p_fimc.h)21
-rw-r--r--include/media/media-device.h4
-rw-r--r--include/media/media-devnode.h3
-rw-r--r--include/media/v4l2-device.h8
-rw-r--r--include/media/v4l2-event.h4
-rw-r--r--include/media/v4l2-subdev.h37
-rw-r--r--include/media/videobuf2-core.h52
-rw-r--r--include/media/videobuf2-dvb.h58
-rw-r--r--include/net/6lowpan.h1
-rw-r--r--include/net/addrconf.h5
-rw-r--r--include/net/af_ieee802154.h10
-rw-r--r--include/net/bluetooth/hci.h22
-rw-r--r--include/net/bluetooth/hci_core.h24
-rw-r--r--include/net/bluetooth/mgmt.h15
-rw-r--r--include/net/bluetooth/rfcomm.h6
-rw-r--r--include/net/cfg80211.h287
-rw-r--r--include/net/checksum.h2
-rw-r--r--include/net/dsa.h5
-rw-r--r--include/net/gre.h5
-rw-r--r--include/net/ieee802154.h9
-rw-r--r--include/net/ieee802154_netdev.h187
-rw-r--r--include/net/inet_ecn.h2
-rw-r--r--include/net/inet_hashtables.h8
-rw-r--r--include/net/inet_sock.h10
-rw-r--r--include/net/inetpeer.h24
-rw-r--r--include/net/ip.h83
-rw-r--r--include/net/ip6_checksum.h19
-rw-r--r--include/net/ip6_route.h3
-rw-r--r--include/net/ip_vs.h4
-rw-r--r--include/net/ipv6.h24
-rw-r--r--include/net/mac80211.h155
-rw-r--r--include/net/net_namespace.h8
-rw-r--r--include/net/netfilter/nf_nat.h2
-rw-r--r--include/net/netfilter/nf_tables.h136
-rw-r--r--include/net/netfilter/nft_meta.h36
-rw-r--r--include/net/netns/ipv4.h16
-rw-r--r--include/net/netns/ipv6.h1
-rw-r--r--include/net/nfc/digital.h4
-rw-r--r--include/net/nfc/hci.h1
-rw-r--r--include/net/nfc/nfc.h3
-rw-r--r--include/net/pkt_cls.h2
-rw-r--r--include/net/pkt_sched.h2
-rw-r--r--include/net/protocol.h1
-rw-r--r--include/net/regulatory.h6
-rw-r--r--include/net/sch_generic.h2
-rw-r--r--include/net/sctp/structs.h6
-rw-r--r--include/net/secure_seq.h2
-rw-r--r--include/net/snmp.h32
-rw-r--r--include/net/sock.h10
-rw-r--r--include/net/tcp.h47
-rw-r--r--include/net/tso.h20
-rw-r--r--include/net/udp.h22
-rw-r--r--include/net/vxlan.h14
-rw-r--r--include/net/wimax.h4
-rw-r--r--include/net/xfrm.h57
-rw-r--r--include/rdma/ib_verbs.h11
-rw-r--r--include/rdma/iw_portmap.h199
-rw-r--r--include/rdma/rdma_netlink.h23
-rw-r--r--include/scsi/osd_protocol.h10
-rw-r--r--include/scsi/scsi_cmnd.h26
-rw-r--r--include/scsi/scsi_device.h1
-rw-r--r--include/scsi/scsi_driver.h9
-rw-r--r--include/sound/atmel-ac97c.h2
-rw-r--r--include/sound/core.h9
-rw-r--r--include/sound/cs42l56.h48
-rw-r--r--include/sound/omap-pcm.h30
-rw-r--r--include/sound/pcm.h2
-rw-r--r--include/sound/rcar_snd.h32
-rw-r--r--include/sound/rt5640.h4
-rw-r--r--include/sound/rt5645.h25
-rw-r--r--include/sound/rt5651.h21
-rw-r--r--include/sound/rt5677.h21
-rw-r--r--include/sound/soc-dai.h2
-rw-r--r--include/sound/soc-dapm.h20
-rw-r--r--include/sound/soc.h204
-rw-r--r--include/sound/sta350.h57
-rw-r--r--include/target/iscsi/iscsi_transport.h3
-rw-r--r--include/target/target_core_backend.h1
-rw-r--r--include/trace/events/asoc.h92
-rw-r--r--include/trace/events/compaction.h25
-rw-r--r--include/trace/events/ext4.h9
-rw-r--r--include/trace/events/f2fs.h146
-rw-r--r--include/trace/events/filelock.h96
-rw-r--r--include/trace/events/gfpflags.h1
-rw-r--r--include/trace/events/power.h84
-rw-r--r--include/trace/events/sched.h20
-rw-r--r--include/trace/events/vmscan.h19
-rw-r--r--include/trace/ftrace.h99
-rw-r--r--include/trace/syscall.h15
-rw-r--r--include/uapi/drm/drm_mode.h16
-rw-r--r--include/uapi/drm/i915_drm.h17
-rw-r--r--include/uapi/drm/radeon_drm.h2
-rw-r--r--include/uapi/linux/Kbuild1
-rw-r--r--include/uapi/linux/audit.h10
-rw-r--r--include/uapi/linux/btrfs.h20
-rw-r--r--include/uapi/linux/can.h6
-rw-r--r--include/uapi/linux/can/bcm.h6
-rw-r--r--include/uapi/linux/can/error.h6
-rw-r--r--include/uapi/linux/can/gw.h6
-rw-r--r--include/uapi/linux/can/netlink.h6
-rw-r--r--include/uapi/linux/can/raw.h6
-rw-r--r--include/uapi/linux/capability.h7
-rw-r--r--include/uapi/linux/ethtool.h35
-rw-r--r--include/uapi/linux/filter.h3
-rw-r--r--include/uapi/linux/gfs2_ondisk.h2
-rw-r--r--include/uapi/linux/if_fddi.h90
-rw-r--r--include/uapi/linux/if_link.h12
-rw-r--r--include/uapi/linux/if_tunnel.h2
-rw-r--r--include/uapi/linux/input.h17
-rw-r--r--include/uapi/linux/kvm.h17
-rw-r--r--include/uapi/linux/kvm_para.h3
-rw-r--r--include/uapi/linux/l2tp.h2
-rw-r--r--include/uapi/linux/neighbour.h1
-rw-r--r--include/uapi/linux/netfilter/nf_tables.h37
-rw-r--r--include/uapi/linux/netfilter/nfnetlink.h2
-rw-r--r--include/uapi/linux/netfilter/nfnetlink_acct.h9
-rw-r--r--include/uapi/linux/nfc.h16
-rw-r--r--include/uapi/linux/nfsd/nfsfh.h32
-rw-r--r--include/uapi/linux/nl80211.h71
-rw-r--r--include/uapi/linux/nvme.h50
-rw-r--r--include/uapi/linux/openvswitch.h4
-rw-r--r--include/uapi/linux/perf_event.h21
-rw-r--r--include/uapi/linux/psci.h90
-rw-r--r--include/uapi/linux/serial_core.h8
-rw-r--r--include/uapi/linux/serial_reg.h2
-rw-r--r--include/uapi/linux/shm.h17
-rw-r--r--include/uapi/linux/tipc.h23
-rw-r--r--include/uapi/linux/tipc_config.h10
-rw-r--r--include/uapi/linux/udp.h2
-rw-r--r--include/uapi/linux/usb/Kbuild1
-rw-r--r--include/uapi/linux/usb/cdc-wdm.h2
-rw-r--r--include/uapi/linux/usb/functionfs.h7
-rw-r--r--include/uapi/linux/v4l2-common.h2
-rw-r--r--include/uapi/linux/v4l2-dv-timings.h70
-rw-r--r--include/uapi/linux/v4l2-mediabus.h14
-rw-r--r--include/uapi/linux/v4l2-subdev.h40
-rw-r--r--include/uapi/linux/videodev2.h19
-rw-r--r--include/uapi/mtd/mtd-abi.h1
-rw-r--r--include/uapi/rdma/rdma_netlink.h96
-rw-r--r--include/uapi/sound/asound.h4
-rw-r--r--include/uapi/sound/compress_offload.h14
-rw-r--r--include/uapi/sound/compress_params.h14
-rw-r--r--include/uapi/sound/firewire.h23
-rw-r--r--include/video/imx-ipu-v3.h347
-rw-r--r--include/video/omapdss.h8
-rw-r--r--include/xen/interface/io/blkif.h2
-rw-r--r--include/xen/interface/io/netif.h53
-rw-r--r--include/xen/interface/xen.h6
-rw-r--r--include/xen/xen-ops.h4
528 files changed, 14567 insertions, 4903 deletions
diff --git a/include/acpi/acpi.h b/include/acpi/acpi.h
index ca0cb603b171..a08e55a263c9 100644
--- a/include/acpi/acpi.h
+++ b/include/acpi/acpi.h
@@ -62,8 +62,6 @@
62#include <acpi/acrestyp.h> /* Resource Descriptor structs */ 62#include <acpi/acrestyp.h> /* Resource Descriptor structs */
63#include <acpi/acpiosxf.h> /* OSL interfaces (ACPICA-to-OS) */ 63#include <acpi/acpiosxf.h> /* OSL interfaces (ACPICA-to-OS) */
64#include <acpi/acpixf.h> /* ACPI core subsystem external interfaces */ 64#include <acpi/acpixf.h> /* ACPI core subsystem external interfaces */
65#ifdef ACPI_NATIVE_INTERFACE_HEADER 65#include <acpi/platform/acenvex.h> /* Extra environment-specific items */
66#include ACPI_NATIVE_INTERFACE_HEADER
67#endif
68 66
69#endif /* __ACPI_H__ */ 67#endif /* __ACPI_H__ */
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index 84a2e29a2314..b5714580801a 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -131,6 +131,7 @@ static inline struct acpi_hotplug_profile *to_acpi_hotplug_profile(
131struct acpi_scan_handler { 131struct acpi_scan_handler {
132 const struct acpi_device_id *ids; 132 const struct acpi_device_id *ids;
133 struct list_head list_node; 133 struct list_head list_node;
134 bool (*match)(char *idstr, const struct acpi_device_id **matchid);
134 int (*attach)(struct acpi_device *dev, const struct acpi_device_id *id); 135 int (*attach)(struct acpi_device *dev, const struct acpi_device_id *id);
135 void (*detach)(struct acpi_device *dev); 136 void (*detach)(struct acpi_device *dev);
136 void (*bind)(struct device *phys_dev); 137 void (*bind)(struct device *phys_dev);
@@ -232,7 +233,8 @@ struct acpi_hardware_id {
232struct acpi_pnp_type { 233struct acpi_pnp_type {
233 u32 hardware_id:1; 234 u32 hardware_id:1;
234 u32 bus_address:1; 235 u32 bus_address:1;
235 u32 reserved:30; 236 u32 platform_id:1;
237 u32 reserved:29;
236}; 238};
237 239
238struct acpi_device_pnp { 240struct acpi_device_pnp {
@@ -261,7 +263,8 @@ struct acpi_device_power_flags {
261 u32 inrush_current:1; /* Serialize Dx->D0 */ 263 u32 inrush_current:1; /* Serialize Dx->D0 */
262 u32 power_removed:1; /* Optimize Dx->D0 */ 264 u32 power_removed:1; /* Optimize Dx->D0 */
263 u32 ignore_parent:1; /* Power is independent of parent power state */ 265 u32 ignore_parent:1; /* Power is independent of parent power state */
264 u32 reserved:27; 266 u32 dsw_present:1; /* _DSW present? */
267 u32 reserved:26;
265}; 268};
266 269
267struct acpi_device_power_state { 270struct acpi_device_power_state {
@@ -406,6 +409,8 @@ extern struct kobject *acpi_kobj;
406extern int acpi_bus_generate_netlink_event(const char*, const char*, u8, int); 409extern int acpi_bus_generate_netlink_event(const char*, const char*, u8, int);
407void acpi_bus_private_data_handler(acpi_handle, void *); 410void acpi_bus_private_data_handler(acpi_handle, void *);
408int acpi_bus_get_private_data(acpi_handle, void **); 411int acpi_bus_get_private_data(acpi_handle, void **);
412int acpi_bus_attach_private_data(acpi_handle, void *);
413void acpi_bus_detach_private_data(acpi_handle);
409void acpi_bus_no_hotplug(acpi_handle handle); 414void acpi_bus_no_hotplug(acpi_handle handle);
410extern int acpi_notifier_call_chain(struct acpi_device *, u32, u32); 415extern int acpi_notifier_call_chain(struct acpi_device *, u32, u32);
411extern int register_acpi_notifier(struct notifier_block *); 416extern int register_acpi_notifier(struct notifier_block *);
diff --git a/include/acpi/acpi_drivers.h b/include/acpi/acpi_drivers.h
index d504613bbf80..ea6428b7dacb 100644
--- a/include/acpi/acpi_drivers.h
+++ b/include/acpi/acpi_drivers.h
@@ -96,7 +96,12 @@ struct pci_dev *acpi_get_pci_dev(acpi_handle);
96/* Arch-defined function to add a bus to the system */ 96/* Arch-defined function to add a bus to the system */
97 97
98struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root); 98struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root);
99
100#ifdef CONFIG_X86
99void pci_acpi_crs_quirks(void); 101void pci_acpi_crs_quirks(void);
102#else
103static inline void pci_acpi_crs_quirks(void) { }
104#endif
100 105
101/* -------------------------------------------------------------------------- 106/* --------------------------------------------------------------------------
102 Processor 107 Processor
diff --git a/include/acpi/acpi_io.h b/include/acpi/acpi_io.h
index 2be858018c7f..444671e9c65d 100644
--- a/include/acpi/acpi_io.h
+++ b/include/acpi/acpi_io.h
@@ -9,6 +9,9 @@ static inline void __iomem *acpi_os_ioremap(acpi_physical_address phys,
9 return ioremap_cache(phys, size); 9 return ioremap_cache(phys, size);
10} 10}
11 11
12void __iomem *__init_refok
13acpi_os_map_iomem(acpi_physical_address phys, acpi_size size);
14void __ref acpi_os_unmap_iomem(void __iomem *virt, acpi_size size);
12void __iomem *acpi_os_get_iomem(acpi_physical_address phys, unsigned int size); 15void __iomem *acpi_os_get_iomem(acpi_physical_address phys, unsigned int size);
13 16
14int acpi_os_map_generic_address(struct acpi_generic_address *addr); 17int acpi_os_map_generic_address(struct acpi_generic_address *addr);
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index 44f5e9749601..35b525c19711 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -46,7 +46,7 @@
46 46
47/* Current ACPICA subsystem version in YYYYMMDD format */ 47/* Current ACPICA subsystem version in YYYYMMDD format */
48 48
49#define ACPI_CA_VERSION 0x20140214 49#define ACPI_CA_VERSION 0x20140424
50 50
51#include <acpi/acconfig.h> 51#include <acpi/acconfig.h>
52#include <acpi/actypes.h> 52#include <acpi/actypes.h>
@@ -55,233 +55,478 @@
55 55
56extern u8 acpi_gbl_permanent_mmap; 56extern u8 acpi_gbl_permanent_mmap;
57 57
58/*****************************************************************************
59 *
60 * Macros used for ACPICA globals and configuration
61 *
62 ****************************************************************************/
63
58/* 64/*
59 * Globals that are publically available 65 * Ensure that global variables are defined and initialized only once.
66 *
67 * The use of these macros allows for a single list of globals (here)
68 * in order to simplify maintenance of the code.
60 */ 69 */
61extern u32 acpi_current_gpe_count; 70#ifdef DEFINE_ACPI_GLOBALS
62extern struct acpi_table_fadt acpi_gbl_FADT; 71#define ACPI_GLOBAL(type,name) \
63extern u8 acpi_gbl_system_awake_and_running; 72 extern type name; \
64extern u8 acpi_gbl_reduced_hardware; /* ACPI 5.0 */ 73 type name
65extern u8 acpi_gbl_osi_data;
66 74
67/* Runtime configuration of debug print levels */ 75#define ACPI_INIT_GLOBAL(type,name,value) \
76 type name=value
68 77
69extern u32 acpi_dbg_level; 78#else
70extern u32 acpi_dbg_layer; 79#ifndef ACPI_GLOBAL
71 80#define ACPI_GLOBAL(type,name) \
72/* ACPICA runtime options */ 81 extern type name
82#endif
73 83
74extern u8 acpi_gbl_auto_serialize_methods; 84#ifndef ACPI_INIT_GLOBAL
75extern u8 acpi_gbl_copy_dsdt_locally; 85#define ACPI_INIT_GLOBAL(type,name,value) \
76extern u8 acpi_gbl_create_osi_method; 86 extern type name
77extern u8 acpi_gbl_disable_auto_repair; 87#endif
78extern u8 acpi_gbl_disable_ssdt_table_load; 88#endif
79extern u8 acpi_gbl_do_not_use_xsdt;
80extern u8 acpi_gbl_enable_aml_debug_object;
81extern u8 acpi_gbl_enable_interpreter_slack;
82extern u32 acpi_gbl_trace_flags;
83extern acpi_name acpi_gbl_trace_method_name;
84extern u8 acpi_gbl_truncate_io_addresses;
85extern u8 acpi_gbl_use32_bit_fadt_addresses;
86extern u8 acpi_gbl_use_default_register_widths;
87 89
88/* 90/*
89 * Hardware-reduced prototypes. All interfaces that use these macros will 91 * These macros configure the various ACPICA interfaces. They are
90 * be configured out of the ACPICA build if the ACPI_REDUCED_HARDWARE flag 92 * useful for generating stub inline functions for features that are
91 * is set to TRUE. 93 * configured out of the current kernel or ACPICA application.
92 */ 94 */
93#if (!ACPI_REDUCED_HARDWARE) 95#ifndef ACPI_EXTERNAL_RETURN_STATUS
94#define ACPI_HW_DEPENDENT_RETURN_STATUS(prototype) \ 96#define ACPI_EXTERNAL_RETURN_STATUS(prototype) \
95 prototype; 97 prototype;
98#endif
96 99
97#define ACPI_HW_DEPENDENT_RETURN_OK(prototype) \ 100#ifndef ACPI_EXTERNAL_RETURN_OK
101#define ACPI_EXTERNAL_RETURN_OK(prototype) \
98 prototype; 102 prototype;
103#endif
99 104
100#define ACPI_HW_DEPENDENT_RETURN_VOID(prototype) \ 105#ifndef ACPI_EXTERNAL_RETURN_VOID
106#define ACPI_EXTERNAL_RETURN_VOID(prototype) \
101 prototype; 107 prototype;
108#endif
102 109
103#else 110#ifndef ACPI_EXTERNAL_RETURN_UINT32
104#define ACPI_HW_DEPENDENT_RETURN_STATUS(prototype) \ 111#define ACPI_EXTERNAL_RETURN_UINT32(prototype) \
105 static ACPI_INLINE prototype {return(AE_NOT_CONFIGURED);} 112 prototype;
106 113#endif
107#define ACPI_HW_DEPENDENT_RETURN_OK(prototype) \
108 static ACPI_INLINE prototype {return(AE_OK);}
109 114
110#define ACPI_HW_DEPENDENT_RETURN_VOID(prototype) \ 115#ifndef ACPI_EXTERNAL_RETURN_PTR
111 static ACPI_INLINE prototype {return;} 116#define ACPI_EXTERNAL_RETURN_PTR(prototype) \
117 prototype;
118#endif
112 119
113#endif /* !ACPI_REDUCED_HARDWARE */ 120/*****************************************************************************
121 *
122 * Public globals and runtime configuration options
123 *
124 ****************************************************************************/
114 125
115/* 126/*
116 * Initialization 127 * Enable "slack mode" of the AML interpreter? Default is FALSE, and the
128 * interpreter strictly follows the ACPI specification. Setting to TRUE
129 * allows the interpreter to ignore certain errors and/or bad AML constructs.
130 *
131 * Currently, these features are enabled by this flag:
132 *
133 * 1) Allow "implicit return" of last value in a control method
134 * 2) Allow access beyond the end of an operation region
135 * 3) Allow access to uninitialized locals/args (auto-init to integer 0)
136 * 4) Allow ANY object type to be a source operand for the Store() operator
137 * 5) Allow unresolved references (invalid target name) in package objects
138 * 6) Enable warning messages for behavior that is not ACPI spec compliant
117 */ 139 */
118acpi_status __init 140ACPI_INIT_GLOBAL(u8, acpi_gbl_enable_interpreter_slack, FALSE);
119acpi_initialize_tables(struct acpi_table_desc *initial_storage,
120 u32 initial_table_count, u8 allow_resize);
121
122acpi_status __init acpi_initialize_subsystem(void);
123 141
124acpi_status __init acpi_enable_subsystem(u32 flags); 142/*
125 143 * Automatically serialize all methods that create named objects? Default
126acpi_status __init acpi_initialize_objects(u32 flags); 144 * is TRUE, meaning that all non_serialized methods are scanned once at
145 * table load time to determine those that create named objects. Methods
146 * that create named objects are marked Serialized in order to prevent
147 * possible run-time problems if they are entered by more than one thread.
148 */
149ACPI_INIT_GLOBAL(u8, acpi_gbl_auto_serialize_methods, TRUE);
127 150
128acpi_status __init acpi_terminate(void); 151/*
152 * Create the predefined _OSI method in the namespace? Default is TRUE
153 * because ACPICA is fully compatible with other ACPI implementations.
154 * Changing this will revert ACPICA (and machine ASL) to pre-OSI behavior.
155 */
156ACPI_INIT_GLOBAL(u8, acpi_gbl_create_osi_method, TRUE);
129 157
130/* 158/*
131 * Miscellaneous global interfaces 159 * Optionally use default values for the ACPI register widths. Set this to
160 * TRUE to use the defaults, if an FADT contains incorrect widths/lengths.
132 */ 161 */
133ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_enable(void)) 162ACPI_INIT_GLOBAL(u8, acpi_gbl_use_default_register_widths, TRUE);
134ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_disable(void))
135#ifdef ACPI_FUTURE_USAGE
136acpi_status acpi_subsystem_status(void);
137#endif
138 163
139#ifdef ACPI_FUTURE_USAGE 164/*
140acpi_status acpi_get_system_info(struct acpi_buffer *ret_buffer); 165 * Whether or not to verify the table checksum before installation. Set
141#endif 166 * this to TRUE to verify the table checksum before install it to the table
167 * manager. Note that enabling this option causes errors to happen in some
168 * OSPMs during early initialization stages. Default behavior is to do such
169 * verification.
170 */
171ACPI_INIT_GLOBAL(u8, acpi_gbl_verify_table_checksum, TRUE);
142 172
143acpi_status acpi_get_statistics(struct acpi_statistics *stats); 173/*
174 * Optionally enable output from the AML Debug Object.
175 */
176ACPI_INIT_GLOBAL(u8, acpi_gbl_enable_aml_debug_object, FALSE);
144 177
145const char *acpi_format_exception(acpi_status exception); 178/*
179 * Optionally copy the entire DSDT to local memory (instead of simply
180 * mapping it.) There are some BIOSs that corrupt or replace the original
181 * DSDT, creating the need for this option. Default is FALSE, do not copy
182 * the DSDT.
183 */
184ACPI_INIT_GLOBAL(u8, acpi_gbl_copy_dsdt_locally, FALSE);
146 185
147acpi_status acpi_purge_cached_objects(void); 186/*
187 * Optionally ignore an XSDT if present and use the RSDT instead.
188 * Although the ACPI specification requires that an XSDT be used instead
189 * of the RSDT, the XSDT has been found to be corrupt or ill-formed on
190 * some machines. Default behavior is to use the XSDT if present.
191 */
192ACPI_INIT_GLOBAL(u8, acpi_gbl_do_not_use_xsdt, FALSE);
148 193
149acpi_status acpi_install_interface(acpi_string interface_name); 194/*
195 * Optionally use 32-bit FADT addresses if and when there is a conflict
196 * (address mismatch) between the 32-bit and 64-bit versions of the
197 * address. Although ACPICA adheres to the ACPI specification which
198 * requires the use of the corresponding 64-bit address if it is non-zero,
199 * some machines have been found to have a corrupted non-zero 64-bit
200 * address. Default is TRUE, favor the 32-bit addresses.
201 */
202ACPI_INIT_GLOBAL(u8, acpi_gbl_use32_bit_fadt_addresses, TRUE);
150 203
151acpi_status acpi_remove_interface(acpi_string interface_name); 204/*
205 * Optionally truncate I/O addresses to 16 bits. Provides compatibility
206 * with other ACPI implementations. NOTE: During ACPICA initialization,
207 * this value is set to TRUE if any Windows OSI strings have been
208 * requested by the BIOS.
209 */
210ACPI_INIT_GLOBAL(u8, acpi_gbl_truncate_io_addresses, FALSE);
152 211
153acpi_status acpi_update_interfaces(u8 action); 212/*
213 * Disable runtime checking and repair of values returned by control methods.
214 * Use only if the repair is causing a problem on a particular machine.
215 */
216ACPI_INIT_GLOBAL(u8, acpi_gbl_disable_auto_repair, FALSE);
154 217
155u32 218/*
156acpi_check_address_range(acpi_adr_space_type space_id, 219 * Optionally do not install any SSDTs from the RSDT/XSDT during initialization.
157 acpi_physical_address address, 220 * This can be useful for debugging ACPI problems on some machines.
158 acpi_size length, u8 warn); 221 */
222ACPI_INIT_GLOBAL(u8, acpi_gbl_disable_ssdt_table_install, FALSE);
159 223
160acpi_status 224/*
161acpi_decode_pld_buffer(u8 *in_buffer, 225 * We keep track of the latest version of Windows that has been requested by
162 acpi_size length, struct acpi_pld_info **return_buffer); 226 * the BIOS. ACPI 5.0.
227 */
228ACPI_INIT_GLOBAL(u8, acpi_gbl_osi_data, 0);
163 229
164/* 230/*
165 * ACPI table load/unload interfaces 231 * ACPI 5.0 introduces the concept of a "reduced hardware platform", meaning
232 * that the ACPI hardware is no longer required. A flag in the FADT indicates
233 * a reduced HW machine, and that flag is duplicated here for convenience.
166 */ 234 */
167acpi_status acpi_load_table(struct acpi_table_header *table); 235ACPI_INIT_GLOBAL(u8, acpi_gbl_reduced_hardware, FALSE);
168 236
169acpi_status acpi_unload_parent_table(acpi_handle object); 237/*
238 * This mechanism is used to trace a specified AML method. The method is
239 * traced each time it is executed.
240 */
241ACPI_INIT_GLOBAL(u32, acpi_gbl_trace_flags, 0);
242ACPI_INIT_GLOBAL(acpi_name, acpi_gbl_trace_method_name, 0);
170 243
171acpi_status __init acpi_load_tables(void); 244/*
245 * Runtime configuration of debug output control masks. We want the debug
246 * switches statically initialized so they are already set when the debugger
247 * is entered.
248 */
249ACPI_INIT_GLOBAL(u32, acpi_dbg_level, ACPI_DEBUG_DEFAULT);
250ACPI_INIT_GLOBAL(u32, acpi_dbg_layer, 0);
172 251
173/* 252/*
174 * ACPI table manipulation interfaces 253 * Other miscellaneous globals
175 */ 254 */
176acpi_status __init acpi_reallocate_root_table(void); 255ACPI_GLOBAL(struct acpi_table_fadt, acpi_gbl_FADT);
256ACPI_GLOBAL(u32, acpi_current_gpe_count);
257ACPI_GLOBAL(u8, acpi_gbl_system_awake_and_running);
177 258
178acpi_status __init acpi_find_root_pointer(acpi_size *rsdp_address); 259/*****************************************************************************
260 *
261 * ACPICA public interface configuration.
262 *
263 * Interfaces that are configured out of the ACPICA build are replaced
264 * by inlined stubs by default.
265 *
266 ****************************************************************************/
179 267
180acpi_status acpi_unload_table_id(acpi_owner_id id); 268/*
269 * Hardware-reduced prototypes (default: Not hardware reduced).
270 *
271 * All ACPICA hardware-related interfaces that use these macros will be
272 * configured out of the ACPICA build if the ACPI_REDUCED_HARDWARE flag
273 * is set to TRUE.
274 *
275 * Note: This static build option for reduced hardware is intended to
276 * reduce ACPICA code size if desired or necessary. However, even if this
277 * option is not specified, the runtime behavior of ACPICA is dependent
278 * on the actual FADT reduced hardware flag (HW_REDUCED_ACPI). If set,
279 * the flag will enable similar behavior -- ACPICA will not attempt
280 * to access any ACPI-relate hardware (SCI, GPEs, Fixed Events, etc.)
281 */
282#if (!ACPI_REDUCED_HARDWARE)
283#define ACPI_HW_DEPENDENT_RETURN_STATUS(prototype) \
284 ACPI_EXTERNAL_RETURN_STATUS(prototype)
181 285
182acpi_status 286#define ACPI_HW_DEPENDENT_RETURN_OK(prototype) \
183acpi_get_table_header(acpi_string signature, 287 ACPI_EXTERNAL_RETURN_OK(prototype)
184 u32 instance, struct acpi_table_header *out_table_header);
185 288
186acpi_status 289#define ACPI_HW_DEPENDENT_RETURN_VOID(prototype) \
187acpi_get_table_with_size(acpi_string signature, 290 ACPI_EXTERNAL_RETURN_VOID(prototype)
188 u32 instance, struct acpi_table_header **out_table,
189 acpi_size *tbl_size);
190 291
191acpi_status 292#else
192acpi_get_table(acpi_string signature, 293#define ACPI_HW_DEPENDENT_RETURN_STATUS(prototype) \
193 u32 instance, struct acpi_table_header **out_table); 294 static ACPI_INLINE prototype {return(AE_NOT_CONFIGURED);}
194 295
195acpi_status 296#define ACPI_HW_DEPENDENT_RETURN_OK(prototype) \
196acpi_get_table_by_index(u32 table_index, struct acpi_table_header **out_table); 297 static ACPI_INLINE prototype {return(AE_OK);}
197 298
198acpi_status 299#define ACPI_HW_DEPENDENT_RETURN_VOID(prototype) \
199acpi_install_table_handler(acpi_table_handler handler, void *context); 300 static ACPI_INLINE prototype {return;}
200 301
201acpi_status acpi_remove_table_handler(acpi_table_handler handler); 302#endif /* !ACPI_REDUCED_HARDWARE */
202 303
203/* 304/*
204 * Namespace and name interfaces 305 * Error message prototypes (default: error messages enabled).
306 *
307 * All interfaces related to error and warning messages
308 * will be configured out of the ACPICA build if the
309 * ACPI_NO_ERROR_MESSAGE flag is defined.
205 */ 310 */
206acpi_status 311#ifndef ACPI_NO_ERROR_MESSAGES
207acpi_walk_namespace(acpi_object_type type, 312#define ACPI_MSG_DEPENDENT_RETURN_VOID(prototype) \
208 acpi_handle start_object, 313 prototype;
209 u32 max_depth,
210 acpi_walk_callback descending_callback,
211 acpi_walk_callback ascending_callback,
212 void *context, void **return_value);
213 314
214acpi_status 315#else
215acpi_get_devices(const char *HID, 316#define ACPI_MSG_DEPENDENT_RETURN_VOID(prototype) \
216 acpi_walk_callback user_function, 317 static ACPI_INLINE prototype {return;}
217 void *context, void **return_value);
218 318
219acpi_status 319#endif /* ACPI_NO_ERROR_MESSAGES */
220acpi_get_name(acpi_handle object,
221 u32 name_type, struct acpi_buffer *ret_path_ptr);
222 320
223acpi_status 321/*
224acpi_get_handle(acpi_handle parent, 322 * Debugging output prototypes (default: no debug output).
225 acpi_string pathname, acpi_handle * ret_handle); 323 *
324 * All interfaces related to debug output messages
325 * will be configured out of the ACPICA build unless the
326 * ACPI_DEBUG_OUTPUT flag is defined.
327 */
328#ifdef ACPI_DEBUG_OUTPUT
329#define ACPI_DBG_DEPENDENT_RETURN_VOID(prototype) \
330 prototype;
226 331
227acpi_status 332#else
228acpi_attach_data(acpi_handle object, acpi_object_handler handler, void *data); 333#define ACPI_DBG_DEPENDENT_RETURN_VOID(prototype) \
334 static ACPI_INLINE prototype {return;}
229 335
230acpi_status acpi_detach_data(acpi_handle object, acpi_object_handler handler); 336#endif /* ACPI_DEBUG_OUTPUT */
231 337
232acpi_status 338/*****************************************************************************
233acpi_get_data_full(acpi_handle object, acpi_object_handler handler, void **data, 339 *
234 void (*callback)(void *)); 340 * ACPICA public interface prototypes
341 *
342 ****************************************************************************/
235 343
236acpi_status 344/*
237acpi_get_data(acpi_handle object, acpi_object_handler handler, void **data); 345 * Initialization
346 */
347ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init
348 acpi_initialize_tables(struct acpi_table_desc
349 *initial_storage,
350 u32 initial_table_count,
351 u8 allow_resize))
352ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init acpi_initialize_subsystem(void))
238 353
239acpi_status 354ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init acpi_enable_subsystem(u32 flags))
240acpi_debug_trace(char *name, u32 debug_level, u32 debug_layer, u32 flags); 355
356ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init
357 acpi_initialize_objects(u32 flags))
358ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init acpi_terminate(void))
241 359
242/* 360/*
243 * Object manipulation and enumeration 361 * Miscellaneous global interfaces
244 */ 362 */
245acpi_status 363ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_enable(void))
246acpi_evaluate_object(acpi_handle object, 364ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_disable(void))
247 acpi_string pathname, 365#ifdef ACPI_FUTURE_USAGE
248 struct acpi_object_list *parameter_objects, 366ACPI_EXTERNAL_RETURN_STATUS(acpi_status acpi_subsystem_status(void))
249 struct acpi_buffer *return_object_buffer); 367#endif
250 368
251acpi_status 369#ifdef ACPI_FUTURE_USAGE
252acpi_evaluate_object_typed(acpi_handle object, 370ACPI_EXTERNAL_RETURN_STATUS(acpi_status
253 acpi_string pathname, 371 acpi_get_system_info(struct acpi_buffer
254 struct acpi_object_list *external_params, 372 *ret_buffer))
255 struct acpi_buffer *return_buffer, 373#endif
256 acpi_object_type return_type); 374ACPI_EXTERNAL_RETURN_STATUS(acpi_status
375 acpi_get_statistics(struct acpi_statistics *stats))
376ACPI_EXTERNAL_RETURN_PTR(const char
377 *acpi_format_exception(acpi_status exception))
378ACPI_EXTERNAL_RETURN_STATUS(acpi_status acpi_purge_cached_objects(void))
379
380ACPI_EXTERNAL_RETURN_STATUS(acpi_status
381 acpi_install_interface(acpi_string interface_name))
382
383ACPI_EXTERNAL_RETURN_STATUS(acpi_status
384 acpi_remove_interface(acpi_string interface_name))
385ACPI_EXTERNAL_RETURN_STATUS(acpi_status acpi_update_interfaces(u8 action))
386
387ACPI_EXTERNAL_RETURN_UINT32(u32
388 acpi_check_address_range(acpi_adr_space_type
389 space_id,
390 acpi_physical_address
391 address, acpi_size length,
392 u8 warn))
393ACPI_EXTERNAL_RETURN_STATUS(acpi_status
394 acpi_decode_pld_buffer(u8 *in_buffer,
395 acpi_size length,
396 struct acpi_pld_info
397 **return_buffer))
257 398
258acpi_status 399/*
259acpi_get_object_info(acpi_handle object, 400 * ACPI table load/unload interfaces
260 struct acpi_device_info **return_buffer); 401 */
402ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init
403 acpi_install_table(acpi_physical_address address,
404 u8 physical))
261 405
262acpi_status acpi_install_method(u8 *buffer); 406ACPI_EXTERNAL_RETURN_STATUS(acpi_status
407 acpi_load_table(struct acpi_table_header *table))
263 408
264acpi_status 409ACPI_EXTERNAL_RETURN_STATUS(acpi_status
265acpi_get_next_object(acpi_object_type type, 410 acpi_unload_parent_table(acpi_handle object))
266 acpi_handle parent, 411ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init acpi_load_tables(void))
267 acpi_handle child, acpi_handle * out_handle);
268 412
269acpi_status acpi_get_type(acpi_handle object, acpi_object_type * out_type); 413/*
414 * ACPI table manipulation interfaces
415 */
416ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init acpi_reallocate_root_table(void))
417
418ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init
419 acpi_find_root_pointer(acpi_size * rsdp_address))
420
421ACPI_EXTERNAL_RETURN_STATUS(acpi_status
422 acpi_get_table_header(acpi_string signature,
423 u32 instance,
424 struct acpi_table_header
425 *out_table_header))
426ACPI_EXTERNAL_RETURN_STATUS(acpi_status
427 acpi_get_table(acpi_string signature, u32 instance,
428 struct acpi_table_header
429 **out_table))
430ACPI_EXTERNAL_RETURN_STATUS(acpi_status
431 acpi_get_table_by_index(u32 table_index,
432 struct acpi_table_header
433 **out_table))
434ACPI_EXTERNAL_RETURN_STATUS(acpi_status
435 acpi_install_table_handler(acpi_table_handler
436 handler, void *context))
437ACPI_EXTERNAL_RETURN_STATUS(acpi_status
438 acpi_remove_table_handler(acpi_table_handler
439 handler))
270 440
271acpi_status acpi_get_id(acpi_handle object, acpi_owner_id * out_type); 441/*
442 * Namespace and name interfaces
443 */
444ACPI_EXTERNAL_RETURN_STATUS(acpi_status
445 acpi_walk_namespace(acpi_object_type type,
446 acpi_handle start_object,
447 u32 max_depth,
448 acpi_walk_callback
449 descending_callback,
450 acpi_walk_callback
451 ascending_callback,
452 void *context,
453 void **return_value))
454ACPI_EXTERNAL_RETURN_STATUS(acpi_status
455 acpi_get_devices(const char *HID,
456 acpi_walk_callback user_function,
457 void *context,
458 void **return_value))
459ACPI_EXTERNAL_RETURN_STATUS(acpi_status
460 acpi_get_name(acpi_handle object, u32 name_type,
461 struct acpi_buffer *ret_path_ptr))
462ACPI_EXTERNAL_RETURN_STATUS(acpi_status
463 acpi_get_handle(acpi_handle parent,
464 acpi_string pathname,
465 acpi_handle * ret_handle))
466ACPI_EXTERNAL_RETURN_STATUS(acpi_status
467 acpi_attach_data(acpi_handle object,
468 acpi_object_handler handler,
469 void *data))
470ACPI_EXTERNAL_RETURN_STATUS(acpi_status
471 acpi_detach_data(acpi_handle object,
472 acpi_object_handler handler))
473ACPI_EXTERNAL_RETURN_STATUS(acpi_status
474 acpi_get_data(acpi_handle object,
475 acpi_object_handler handler,
476 void **data))
477ACPI_EXTERNAL_RETURN_STATUS(acpi_status
478 acpi_debug_trace(char *name, u32 debug_level,
479 u32 debug_layer, u32 flags))
272 480
273acpi_status acpi_get_parent(acpi_handle object, acpi_handle * out_handle); 481/*
482 * Object manipulation and enumeration
483 */
484ACPI_EXTERNAL_RETURN_STATUS(acpi_status
485 acpi_evaluate_object(acpi_handle object,
486 acpi_string pathname,
487 struct acpi_object_list
488 *parameter_objects,
489 struct acpi_buffer
490 *return_object_buffer))
491ACPI_EXTERNAL_RETURN_STATUS(acpi_status
492 acpi_evaluate_object_typed(acpi_handle object,
493 acpi_string pathname,
494 struct acpi_object_list
495 *external_params,
496 struct acpi_buffer
497 *return_buffer,
498 acpi_object_type
499 return_type))
500ACPI_EXTERNAL_RETURN_STATUS(acpi_status
501 acpi_get_object_info(acpi_handle object,
502 struct acpi_device_info
503 **return_buffer))
504ACPI_EXTERNAL_RETURN_STATUS(acpi_status acpi_install_method(u8 *buffer))
505
506ACPI_EXTERNAL_RETURN_STATUS(acpi_status
507 acpi_get_next_object(acpi_object_type type,
508 acpi_handle parent,
509 acpi_handle child,
510 acpi_handle * out_handle))
511
512ACPI_EXTERNAL_RETURN_STATUS(acpi_status
513 acpi_get_type(acpi_handle object,
514 acpi_object_type * out_type))
515
516ACPI_EXTERNAL_RETURN_STATUS(acpi_status
517 acpi_get_parent(acpi_handle object,
518 acpi_handle * out_handle))
274 519
275/* 520/*
276 * Handler interfaces 521 * Handler interfaces
277 */ 522 */
278acpi_status 523ACPI_EXTERNAL_RETURN_STATUS(acpi_status
279acpi_install_initialization_handler(acpi_init_handler handler, u32 function); 524 acpi_install_initialization_handler
280 525 (acpi_init_handler handler, u32 function))
281ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status 526ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
282 acpi_install_sci_handler(acpi_sci_handler 527 acpi_install_sci_handler(acpi_sci_handler
283 address, 528 address,
284 void *context)) 529 void *context))
285ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status 530ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
286 acpi_remove_sci_handler(acpi_sci_handler 531 acpi_remove_sci_handler(acpi_sci_handler
287 address)) 532 address))
@@ -313,30 +558,42 @@ ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
313 u32 gpe_number, 558 u32 gpe_number,
314 acpi_gpe_handler 559 acpi_gpe_handler
315 address)) 560 address))
316acpi_status acpi_install_notify_handler(acpi_handle device, u32 handler_type, 561ACPI_EXTERNAL_RETURN_STATUS(acpi_status
317 acpi_notify_handler handler, 562 acpi_install_notify_handler(acpi_handle device,
318 void *context); 563 u32 handler_type,
319 564 acpi_notify_handler
320acpi_status 565 handler,
321acpi_remove_notify_handler(acpi_handle device, 566 void *context))
322 u32 handler_type, acpi_notify_handler handler); 567ACPI_EXTERNAL_RETURN_STATUS(acpi_status
323 568 acpi_remove_notify_handler(acpi_handle device,
324acpi_status 569 u32 handler_type,
325acpi_install_address_space_handler(acpi_handle device, 570 acpi_notify_handler
326 acpi_adr_space_type space_id, 571 handler))
327 acpi_adr_space_handler handler, 572ACPI_EXTERNAL_RETURN_STATUS(acpi_status
328 acpi_adr_space_setup setup, void *context); 573 acpi_install_address_space_handler(acpi_handle
329 574 device,
330acpi_status 575 acpi_adr_space_type
331acpi_remove_address_space_handler(acpi_handle device, 576 space_id,
332 acpi_adr_space_type space_id, 577 acpi_adr_space_handler
333 acpi_adr_space_handler handler); 578 handler,
334 579 acpi_adr_space_setup
580 setup,
581 void *context))
582ACPI_EXTERNAL_RETURN_STATUS(acpi_status
583 acpi_remove_address_space_handler(acpi_handle
584 device,
585 acpi_adr_space_type
586 space_id,
587 acpi_adr_space_handler
588 handler))
335#ifdef ACPI_FUTURE_USAGE 589#ifdef ACPI_FUTURE_USAGE
336acpi_status acpi_install_exception_handler(acpi_exception_handler handler); 590ACPI_EXTERNAL_RETURN_STATUS(acpi_status
591 acpi_install_exception_handler
592 (acpi_exception_handler handler))
337#endif 593#endif
338 594ACPI_EXTERNAL_RETURN_STATUS(acpi_status
339acpi_status acpi_install_interface_handler(acpi_interface_handler handler); 595 acpi_install_interface_handler
596 (acpi_interface_handler handler))
340 597
341/* 598/*
342 * Global Lock interfaces 599 * Global Lock interfaces
@@ -351,10 +608,14 @@ ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
351/* 608/*
352 * Interfaces to AML mutex objects 609 * Interfaces to AML mutex objects
353 */ 610 */
354acpi_status 611ACPI_EXTERNAL_RETURN_STATUS(acpi_status
355acpi_acquire_mutex(acpi_handle handle, acpi_string pathname, u16 timeout); 612 acpi_acquire_mutex(acpi_handle handle,
613 acpi_string pathname,
614 u16 timeout))
356 615
357acpi_status acpi_release_mutex(acpi_handle handle, acpi_string pathname); 616ACPI_EXTERNAL_RETURN_STATUS(acpi_status
617 acpi_release_mutex(acpi_handle handle,
618 acpi_string pathname))
358 619
359/* 620/*
360 * Fixed Event interfaces 621 * Fixed Event interfaces
@@ -434,57 +695,69 @@ typedef
434acpi_status(*acpi_walk_resource_callback) (struct acpi_resource * resource, 695acpi_status(*acpi_walk_resource_callback) (struct acpi_resource * resource,
435 void *context); 696 void *context);
436 697
437acpi_status 698ACPI_EXTERNAL_RETURN_STATUS(acpi_status
438acpi_get_vendor_resource(acpi_handle device, 699 acpi_get_vendor_resource(acpi_handle device,
439 char *name, 700 char *name,
440 struct acpi_vendor_uuid *uuid, 701 struct acpi_vendor_uuid
441 struct acpi_buffer *ret_buffer); 702 *uuid,
442 703 struct acpi_buffer
443acpi_status 704 *ret_buffer))
444acpi_get_current_resources(acpi_handle device, struct acpi_buffer *ret_buffer); 705ACPI_EXTERNAL_RETURN_STATUS(acpi_status
445 706 acpi_get_current_resources(acpi_handle device,
707 struct acpi_buffer
708 *ret_buffer))
446#ifdef ACPI_FUTURE_USAGE 709#ifdef ACPI_FUTURE_USAGE
447acpi_status 710ACPI_EXTERNAL_RETURN_STATUS(acpi_status
448acpi_get_possible_resources(acpi_handle device, struct acpi_buffer *ret_buffer); 711 acpi_get_possible_resources(acpi_handle device,
712 struct acpi_buffer
713 *ret_buffer))
449#endif 714#endif
450 715ACPI_EXTERNAL_RETURN_STATUS(acpi_status
451acpi_status 716 acpi_get_event_resources(acpi_handle device_handle,
452acpi_get_event_resources(acpi_handle device_handle, 717 struct acpi_buffer
453 struct acpi_buffer *ret_buffer); 718 *ret_buffer))
454 719ACPI_EXTERNAL_RETURN_STATUS(acpi_status
455acpi_status 720 acpi_walk_resource_buffer(struct acpi_buffer
456acpi_walk_resource_buffer(struct acpi_buffer *buffer, 721 *buffer,
457 acpi_walk_resource_callback user_function, 722 acpi_walk_resource_callback
458 void *context); 723 user_function,
459 724 void *context))
460acpi_status 725ACPI_EXTERNAL_RETURN_STATUS(acpi_status
461acpi_walk_resources(acpi_handle device, 726 acpi_walk_resources(acpi_handle device, char *name,
462 char *name, 727 acpi_walk_resource_callback
463 acpi_walk_resource_callback user_function, void *context); 728 user_function, void *context))
464 729ACPI_EXTERNAL_RETURN_STATUS(acpi_status
465acpi_status 730 acpi_set_current_resources(acpi_handle device,
466acpi_set_current_resources(acpi_handle device, struct acpi_buffer *in_buffer); 731 struct acpi_buffer
467 732 *in_buffer))
468acpi_status 733ACPI_EXTERNAL_RETURN_STATUS(acpi_status
469acpi_get_irq_routing_table(acpi_handle device, struct acpi_buffer *ret_buffer); 734 acpi_get_irq_routing_table(acpi_handle device,
470 735 struct acpi_buffer
471acpi_status 736 *ret_buffer))
472acpi_resource_to_address64(struct acpi_resource *resource, 737ACPI_EXTERNAL_RETURN_STATUS(acpi_status
473 struct acpi_resource_address64 *out); 738 acpi_resource_to_address64(struct acpi_resource
474 739 *resource,
475acpi_status 740 struct
476acpi_buffer_to_resource(u8 *aml_buffer, 741 acpi_resource_address64
477 u16 aml_buffer_length, 742 *out))
478 struct acpi_resource **resource_ptr); 743ACPI_EXTERNAL_RETURN_STATUS(acpi_status
744 acpi_buffer_to_resource(u8 *aml_buffer,
745 u16 aml_buffer_length,
746 struct acpi_resource
747 **resource_ptr))
479 748
480/* 749/*
481 * Hardware (ACPI device) interfaces 750 * Hardware (ACPI device) interfaces
482 */ 751 */
483acpi_status acpi_reset(void); 752ACPI_EXTERNAL_RETURN_STATUS(acpi_status acpi_reset(void))
484 753
485acpi_status acpi_read(u64 *value, struct acpi_generic_address *reg); 754ACPI_EXTERNAL_RETURN_STATUS(acpi_status
755 acpi_read(u64 *value,
756 struct acpi_generic_address *reg))
486 757
487acpi_status acpi_write(u64 value, struct acpi_generic_address *reg); 758ACPI_EXTERNAL_RETURN_STATUS(acpi_status
759 acpi_write(u64 value,
760 struct acpi_generic_address *reg))
488 761
489ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status 762ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
490 acpi_read_bit_register(u32 register_id, 763 acpi_read_bit_register(u32 register_id,
@@ -497,18 +770,20 @@ ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
497/* 770/*
498 * Sleep/Wake interfaces 771 * Sleep/Wake interfaces
499 */ 772 */
500acpi_status 773ACPI_EXTERNAL_RETURN_STATUS(acpi_status
501acpi_get_sleep_type_data(u8 sleep_state, u8 *slp_typ_a, u8 *slp_typ_b); 774 acpi_get_sleep_type_data(u8 sleep_state,
502 775 u8 *slp_typ_a,
503acpi_status acpi_enter_sleep_state_prep(u8 sleep_state); 776 u8 *slp_typ_b))
504 777
505acpi_status acpi_enter_sleep_state(u8 sleep_state); 778ACPI_EXTERNAL_RETURN_STATUS(acpi_status
779 acpi_enter_sleep_state_prep(u8 sleep_state))
780ACPI_EXTERNAL_RETURN_STATUS(acpi_status acpi_enter_sleep_state(u8 sleep_state))
506 781
507ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_enter_sleep_state_s4bios(void)) 782ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_enter_sleep_state_s4bios(void))
508 783
509acpi_status acpi_leave_sleep_state_prep(u8 sleep_state); 784ACPI_EXTERNAL_RETURN_STATUS(acpi_status
510 785 acpi_leave_sleep_state_prep(u8 sleep_state))
511acpi_status acpi_leave_sleep_state(u8 sleep_state); 786ACPI_EXTERNAL_RETURN_STATUS(acpi_status acpi_leave_sleep_state(u8 sleep_state))
512 787
513ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status 788ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
514 acpi_set_firmware_waking_vector(u32 789 acpi_set_firmware_waking_vector(u32
@@ -535,53 +810,72 @@ ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
535/* 810/*
536 * Error/Warning output 811 * Error/Warning output
537 */ 812 */
538ACPI_PRINTF_LIKE(3) 813ACPI_MSG_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(3)
539void ACPI_INTERNAL_VAR_XFACE 814 void ACPI_INTERNAL_VAR_XFACE
540acpi_error(const char *module_name, u32 line_number, const char *format, ...); 815 acpi_error(const char *module_name,
541 816 u32 line_number,
542ACPI_PRINTF_LIKE(4) 817 const char *format, ...))
543void ACPI_INTERNAL_VAR_XFACE 818ACPI_MSG_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(4)
544acpi_exception(const char *module_name, 819 void ACPI_INTERNAL_VAR_XFACE
545 u32 line_number, acpi_status status, const char *format, ...); 820 acpi_exception(const char *module_name,
546 821 u32 line_number,
547ACPI_PRINTF_LIKE(3) 822 acpi_status status,
548void ACPI_INTERNAL_VAR_XFACE 823 const char *format, ...))
549acpi_warning(const char *module_name, u32 line_number, const char *format, ...); 824ACPI_MSG_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(3)
550 825 void ACPI_INTERNAL_VAR_XFACE
551ACPI_PRINTF_LIKE(3) 826 acpi_warning(const char *module_name,
552void ACPI_INTERNAL_VAR_XFACE 827 u32 line_number,
553acpi_info(const char *module_name, u32 line_number, const char *format, ...); 828 const char *format, ...))
554 829ACPI_MSG_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(3)
555ACPI_PRINTF_LIKE(3) 830 void ACPI_INTERNAL_VAR_XFACE
556void ACPI_INTERNAL_VAR_XFACE 831 acpi_info(const char *module_name,
557acpi_bios_error(const char *module_name, 832 u32 line_number,
558 u32 line_number, const char *format, ...); 833 const char *format, ...))
559 834ACPI_MSG_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(3)
560ACPI_PRINTF_LIKE(3) 835 void ACPI_INTERNAL_VAR_XFACE
561void ACPI_INTERNAL_VAR_XFACE 836 acpi_bios_error(const char *module_name,
562acpi_bios_warning(const char *module_name, 837 u32 line_number,
563 u32 line_number, const char *format, ...); 838 const char *format, ...))
839ACPI_MSG_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(3)
840 void ACPI_INTERNAL_VAR_XFACE
841 acpi_bios_warning(const char *module_name,
842 u32 line_number,
843 const char *format, ...))
564 844
565/* 845/*
566 * Debug output 846 * Debug output
567 */ 847 */
568#ifdef ACPI_DEBUG_OUTPUT 848ACPI_DBG_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(6)
849 void ACPI_INTERNAL_VAR_XFACE
850 acpi_debug_print(u32 requested_debug_level,
851 u32 line_number,
852 const char *function_name,
853 const char *module_name,
854 u32 component_id,
855 const char *format, ...))
856ACPI_DBG_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(6)
857 void ACPI_INTERNAL_VAR_XFACE
858 acpi_debug_print_raw(u32 requested_debug_level,
859 u32 line_number,
860 const char *function_name,
861 const char *module_name,
862 u32 component_id,
863 const char *format, ...))
569 864
570ACPI_PRINTF_LIKE(6) 865/*
571void ACPI_INTERNAL_VAR_XFACE 866 * Divergences
572acpi_debug_print(u32 requested_debug_level, 867 */
573 u32 line_number, 868acpi_status acpi_get_id(acpi_handle object, acpi_owner_id * out_type);
574 const char *function_name, 869
575 const char *module_name, 870acpi_status acpi_unload_table_id(acpi_owner_id id);
576 u32 component_id, const char *format, ...); 871
577 872acpi_status
578ACPI_PRINTF_LIKE(6) 873acpi_get_table_with_size(acpi_string signature,
579void ACPI_INTERNAL_VAR_XFACE 874 u32 instance, struct acpi_table_header **out_table,
580acpi_debug_print_raw(u32 requested_debug_level, 875 acpi_size *tbl_size);
581 u32 line_number, 876
582 const char *function_name, 877acpi_status
583 const char *module_name, 878acpi_get_data_full(acpi_handle object, acpi_object_handler handler, void **data,
584 u32 component_id, const char *format, ...); 879 void (*callback)(void *));
585#endif
586 880
587#endif /* __ACXFACE_H__ */ 881#endif /* __ACXFACE_H__ */
diff --git a/include/acpi/actbl.h b/include/acpi/actbl.h
index 3b30e36b53b5..1cc7ef13c01a 100644
--- a/include/acpi/actbl.h
+++ b/include/acpi/actbl.h
@@ -367,12 +367,11 @@ struct acpi_table_desc {
367 367
368/* Masks for Flags field above */ 368/* Masks for Flags field above */
369 369
370#define ACPI_TABLE_ORIGIN_UNKNOWN (0) 370#define ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL (0) /* Virtual address, external maintained */
371#define ACPI_TABLE_ORIGIN_MAPPED (1) 371#define ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL (1) /* Physical address, internally mapped */
372#define ACPI_TABLE_ORIGIN_ALLOCATED (2) 372#define ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL (2) /* Virtual address, internallly allocated */
373#define ACPI_TABLE_ORIGIN_OVERRIDE (4) 373#define ACPI_TABLE_ORIGIN_MASK (3)
374#define ACPI_TABLE_ORIGIN_MASK (7) 374#define ACPI_TABLE_IS_LOADED (8)
375#define ACPI_TABLE_IS_LOADED (8)
376 375
377/* 376/*
378 * Get the remaining ACPI tables 377 * Get the remaining ACPI tables
diff --git a/include/acpi/actbl1.h b/include/acpi/actbl1.h
index 212c65de75df..4ad7da805180 100644
--- a/include/acpi/actbl1.h
+++ b/include/acpi/actbl1.h
@@ -675,7 +675,7 @@ enum acpi_madt_type {
675}; 675};
676 676
677/* 677/*
678 * MADT Sub-tables, correspond to Type in struct acpi_subtable_header 678 * MADT Subtables, correspond to Type in struct acpi_subtable_header
679 */ 679 */
680 680
681/* 0: Processor Local APIC */ 681/* 0: Processor Local APIC */
@@ -918,7 +918,7 @@ enum acpi_srat_type {
918}; 918};
919 919
920/* 920/*
921 * SRAT Sub-tables, correspond to Type in struct acpi_subtable_header 921 * SRAT Subtables, correspond to Type in struct acpi_subtable_header
922 */ 922 */
923 923
924/* 0: Processor Local APIC/SAPIC Affinity */ 924/* 0: Processor Local APIC/SAPIC Affinity */
diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h
index c8adad9c6b6a..860e5c883eb3 100644
--- a/include/acpi/actbl2.h
+++ b/include/acpi/actbl2.h
@@ -70,6 +70,7 @@
70#define ACPI_SIG_HPET "HPET" /* High Precision Event Timer table */ 70#define ACPI_SIG_HPET "HPET" /* High Precision Event Timer table */
71#define ACPI_SIG_IBFT "IBFT" /* iSCSI Boot Firmware Table */ 71#define ACPI_SIG_IBFT "IBFT" /* iSCSI Boot Firmware Table */
72#define ACPI_SIG_IVRS "IVRS" /* I/O Virtualization Reporting Structure */ 72#define ACPI_SIG_IVRS "IVRS" /* I/O Virtualization Reporting Structure */
73#define ACPI_SIG_LPIT "LPIT" /* Low Power Idle Table */
73#define ACPI_SIG_MCFG "MCFG" /* PCI Memory Mapped Configuration table */ 74#define ACPI_SIG_MCFG "MCFG" /* PCI Memory Mapped Configuration table */
74#define ACPI_SIG_MCHI "MCHI" /* Management Controller Host Interface table */ 75#define ACPI_SIG_MCHI "MCHI" /* Management Controller Host Interface table */
75#define ACPI_SIG_MTMR "MTMR" /* MID Timer table */ 76#define ACPI_SIG_MTMR "MTMR" /* MID Timer table */
@@ -456,7 +457,7 @@ struct acpi_dmar_pci_path {
456}; 457};
457 458
458/* 459/*
459 * DMAR Sub-tables, correspond to Type in struct acpi_dmar_header 460 * DMAR Subtables, correspond to Type in struct acpi_dmar_header
460 */ 461 */
461 462
462/* 0: Hardware Unit Definition */ 463/* 0: Hardware Unit Definition */
@@ -820,7 +821,71 @@ struct acpi_ivrs_memory {
820 821
821/******************************************************************************* 822/*******************************************************************************
822 * 823 *
823 * MCFG - PCI Memory Mapped Configuration table and sub-table 824 * LPIT - Low Power Idle Table
825 *
826 * Conforms to "ACPI Low Power Idle Table (LPIT) and _LPD Proposal (DRAFT)"
827 *
828 ******************************************************************************/
829
830struct acpi_table_lpit {
831 struct acpi_table_header header; /* Common ACPI table header */
832};
833
834/* LPIT subtable header */
835
836struct acpi_lpit_header {
837 u32 type; /* Subtable type */
838 u32 length; /* Subtable length */
839 u16 unique_id;
840 u16 reserved;
841 u32 flags;
842};
843
844/* Values for subtable Type above */
845
846enum acpi_lpit_type {
847 ACPI_LPIT_TYPE_NATIVE_CSTATE = 0x00,
848 ACPI_LPIT_TYPE_SIMPLE_IO = 0x01
849};
850
851/* Masks for Flags field above */
852
853#define ACPI_LPIT_STATE_DISABLED (1)
854#define ACPI_LPIT_NO_COUNTER (1<<1)
855
856/*
857 * LPIT subtables, correspond to Type in struct acpi_lpit_header
858 */
859
860/* 0x00: Native C-state instruction based LPI structure */
861
862struct acpi_lpit_native {
863 struct acpi_lpit_header header;
864 struct acpi_generic_address entry_trigger;
865 u32 residency;
866 u32 latency;
867 struct acpi_generic_address residency_counter;
868 u64 counter_frequency;
869};
870
871/* 0x01: Simple I/O based LPI structure */
872
873struct acpi_lpit_io {
874 struct acpi_lpit_header header;
875 struct acpi_generic_address entry_trigger;
876 u32 trigger_action;
877 u64 trigger_value;
878 u64 trigger_mask;
879 struct acpi_generic_address minimum_idle_state;
880 u32 residency;
881 u32 latency;
882 struct acpi_generic_address residency_counter;
883 u64 counter_frequency;
884};
885
886/*******************************************************************************
887 *
888 * MCFG - PCI Memory Mapped Configuration table and subtable
824 * Version 1 889 * Version 1
825 * 890 *
826 * Conforms to "PCI Firmware Specification", Revision 3.0, June 20, 2005 891 * Conforms to "PCI Firmware Specification", Revision 3.0, June 20, 2005
@@ -923,7 +988,7 @@ enum acpi_slic_type {
923}; 988};
924 989
925/* 990/*
926 * SLIC Sub-tables, correspond to Type in struct acpi_slic_header 991 * SLIC Subtables, correspond to Type in struct acpi_slic_header
927 */ 992 */
928 993
929/* 0: Public Key Structure */ 994/* 0: Public Key Structure */
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
index e76356574374..19b26bb69a70 100644
--- a/include/acpi/actypes.h
+++ b/include/acpi/actypes.h
@@ -329,6 +329,15 @@ typedef u32 acpi_physical_address;
329 * 329 *
330 ******************************************************************************/ 330 ******************************************************************************/
331 331
332#ifdef ACPI_NO_MEM_ALLOCATIONS
333
334#define ACPI_ALLOCATE(a) NULL
335#define ACPI_ALLOCATE_ZEROED(a) NULL
336#define ACPI_FREE(a)
337#define ACPI_MEM_TRACKING(a)
338
339#else /* ACPI_NO_MEM_ALLOCATIONS */
340
332#ifdef ACPI_DBG_TRACK_ALLOCATIONS 341#ifdef ACPI_DBG_TRACK_ALLOCATIONS
333/* 342/*
334 * Memory allocation tracking (used by acpi_exec to detect memory leaks) 343 * Memory allocation tracking (used by acpi_exec to detect memory leaks)
@@ -350,6 +359,8 @@ typedef u32 acpi_physical_address;
350 359
351#endif /* ACPI_DBG_TRACK_ALLOCATIONS */ 360#endif /* ACPI_DBG_TRACK_ALLOCATIONS */
352 361
362#endif /* ACPI_NO_MEM_ALLOCATIONS */
363
353/****************************************************************************** 364/******************************************************************************
354 * 365 *
355 * ACPI Specification constants (Do not change unless the specification changes) 366 * ACPI Specification constants (Do not change unless the specification changes)
@@ -928,9 +939,19 @@ struct acpi_object_list {
928 * Miscellaneous common Data Structures used by the interfaces 939 * Miscellaneous common Data Structures used by the interfaces
929 */ 940 */
930#define ACPI_NO_BUFFER 0 941#define ACPI_NO_BUFFER 0
942
943#ifdef ACPI_NO_MEM_ALLOCATIONS
944
945#define ACPI_ALLOCATE_BUFFER (acpi_size) (0)
946#define ACPI_ALLOCATE_LOCAL_BUFFER (acpi_size) (0)
947
948#else /* ACPI_NO_MEM_ALLOCATIONS */
949
931#define ACPI_ALLOCATE_BUFFER (acpi_size) (-1) /* Let ACPICA allocate buffer */ 950#define ACPI_ALLOCATE_BUFFER (acpi_size) (-1) /* Let ACPICA allocate buffer */
932#define ACPI_ALLOCATE_LOCAL_BUFFER (acpi_size) (-2) /* For internal use only (enables tracking) */ 951#define ACPI_ALLOCATE_LOCAL_BUFFER (acpi_size) (-2) /* For internal use only (enables tracking) */
933 952
953#endif /* ACPI_NO_MEM_ALLOCATIONS */
954
934struct acpi_buffer { 955struct acpi_buffer {
935 acpi_size length; /* Length in bytes of the buffer */ 956 acpi_size length; /* Length in bytes of the buffer */
936 void *pointer; /* pointer to buffer */ 957 void *pointer; /* pointer to buffer */
diff --git a/include/acpi/platform/acenvex.h b/include/acpi/platform/acenvex.h
new file mode 100644
index 000000000000..2b612384c994
--- /dev/null
+++ b/include/acpi/platform/acenvex.h
@@ -0,0 +1,63 @@
1/******************************************************************************
2 *
3 * Name: acenvex.h - Extra host and compiler configuration
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2014, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44#ifndef __ACENVEX_H__
45#define __ACENVEX_H__
46
47/*! [Begin] no source code translation */
48
49/******************************************************************************
50 *
51 * Extra host configuration files. All ACPICA headers are included before
52 * including these files.
53 *
54 *****************************************************************************/
55
56#if defined(_LINUX) || defined(__linux__)
57#include <acpi/platform/aclinuxex.h>
58
59#endif
60
61/*! [End] no source code translation !*/
62
63#endif /* __ACENVEX_H__ */
diff --git a/include/acpi/platform/acgcc.h b/include/acpi/platform/acgcc.h
index a476b9118b49..384875da3713 100644
--- a/include/acpi/platform/acgcc.h
+++ b/include/acpi/platform/acgcc.h
@@ -64,4 +64,15 @@
64 */ 64 */
65#define ACPI_UNUSED_VAR __attribute__ ((unused)) 65#define ACPI_UNUSED_VAR __attribute__ ((unused))
66 66
67/*
68 * Some versions of gcc implement strchr() with a buggy macro. So,
69 * undef it here. Prevents error messages of this form (usually from the
70 * file getopt.c):
71 *
72 * error: logical '&&' with non-zero constant will always evaluate as true
73 */
74#ifdef strchr
75#undef strchr
76#endif
77
67#endif /* __ACGCC_H__ */ 78#endif /* __ACGCC_H__ */
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index 93c55ed7c53d..cd1f052d55bb 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -48,7 +48,6 @@
48 48
49#define ACPI_USE_SYSTEM_CLIBRARY 49#define ACPI_USE_SYSTEM_CLIBRARY
50#define ACPI_USE_DO_WHILE_0 50#define ACPI_USE_DO_WHILE_0
51#define ACPI_MUTEX_TYPE ACPI_BINARY_SEMAPHORE
52 51
53#ifdef __KERNEL__ 52#ifdef __KERNEL__
54 53
@@ -71,169 +70,65 @@
71#ifdef EXPORT_ACPI_INTERFACES 70#ifdef EXPORT_ACPI_INTERFACES
72#include <linux/export.h> 71#include <linux/export.h>
73#endif 72#endif
74#include <asm/acpi.h> 73#include <asm/acenv.h>
75 74
76/* Host-dependent types and defines for in-kernel ACPICA */ 75#ifndef CONFIG_ACPI
77 76
78#define ACPI_MACHINE_WIDTH BITS_PER_LONG 77/* External globals for __KERNEL__, stubs is needed */
79#define ACPI_EXPORT_SYMBOL(symbol) EXPORT_SYMBOL(symbol);
80#define strtoul simple_strtoul
81 78
82#define acpi_cache_t struct kmem_cache 79#define ACPI_GLOBAL(t,a)
83#define acpi_spinlock spinlock_t * 80#define ACPI_INIT_GLOBAL(t,a,b)
84#define acpi_cpu_flags unsigned long
85 81
86#else /* !__KERNEL__ */ 82/* Generating stubs for configurable ACPICA macros */
87 83
88#include <stdarg.h> 84#define ACPI_NO_MEM_ALLOCATIONS
89#include <string.h>
90#include <stdlib.h>
91#include <ctype.h>
92#include <unistd.h>
93 85
94/* Disable kernel specific declarators */ 86/* Generating stubs for configurable ACPICA functions */
95 87
96#ifndef __init 88#define ACPI_NO_ERROR_MESSAGES
97#define __init 89#undef ACPI_DEBUG_OUTPUT
98#endif
99
100#ifndef __iomem
101#define __iomem
102#endif
103 90
104/* Host-dependent types and defines for user-space ACPICA */ 91/* External interface for __KERNEL__, stub is needed */
105
106#define ACPI_FLUSH_CPU_CACHE()
107#define ACPI_CAST_PTHREAD_T(pthread) ((acpi_thread_id) (pthread))
108 92
109#if defined(__ia64__) || defined(__x86_64__) || defined(__aarch64__) 93#define ACPI_EXTERNAL_RETURN_STATUS(prototype) \
110#define ACPI_MACHINE_WIDTH 64 94 static ACPI_INLINE prototype {return(AE_NOT_CONFIGURED);}
111#define COMPILER_DEPENDENT_INT64 long 95#define ACPI_EXTERNAL_RETURN_OK(prototype) \
112#define COMPILER_DEPENDENT_UINT64 unsigned long 96 static ACPI_INLINE prototype {return(AE_OK);}
113#else 97#define ACPI_EXTERNAL_RETURN_VOID(prototype) \
114#define ACPI_MACHINE_WIDTH 32 98 static ACPI_INLINE prototype {return;}
115#define COMPILER_DEPENDENT_INT64 long long 99#define ACPI_EXTERNAL_RETURN_UINT32(prototype) \
116#define COMPILER_DEPENDENT_UINT64 unsigned long long 100 static ACPI_INLINE prototype {return(0);}
117#define ACPI_USE_NATIVE_DIVIDE 101#define ACPI_EXTERNAL_RETURN_PTR(prototype) \
118#endif 102 static ACPI_INLINE prototype {return(NULL);}
119 103
120#ifndef __cdecl 104#endif /* CONFIG_ACPI */
121#define __cdecl
122#endif
123 105
124#endif /* __KERNEL__ */ 106/* Host-dependent types and defines for in-kernel ACPICA */
125 107
126/* Linux uses GCC */ 108#define ACPI_MACHINE_WIDTH BITS_PER_LONG
109#define ACPI_EXPORT_SYMBOL(symbol) EXPORT_SYMBOL(symbol);
110#define strtoul simple_strtoul
127 111
128#include <acpi/platform/acgcc.h> 112#define acpi_cache_t struct kmem_cache
113#define acpi_spinlock spinlock_t *
114#define acpi_cpu_flags unsigned long
129 115
130#ifdef __KERNEL__ 116/* Use native linux version of acpi_os_allocate_zeroed */
131 117
132/* 118#define USE_NATIVE_ALLOCATE_ZEROED
133 * FIXME: Inclusion of actypes.h
134 * Linux kernel need this before defining inline OSL interfaces as
135 * actypes.h need to be included to find ACPICA type definitions.
136 * Since from ACPICA's perspective, the actypes.h should be included after
137 * acenv.h (aclinux.h), this leads to a inclusion mis-ordering issue.
138 */
139#include <acpi/actypes.h>
140 119
141/* 120/*
142 * Overrides for in-kernel ACPICA 121 * Overrides for in-kernel ACPICA
143 */ 122 */
144acpi_status __init acpi_os_initialize(void);
145#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_initialize 123#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_initialize
146
147acpi_status acpi_os_terminate(void);
148#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_terminate 124#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_terminate
149
150/*
151 * Memory allocation/deallocation
152 */
153
154/*
155 * The irqs_disabled() check is for resume from RAM.
156 * Interrupts are off during resume, just like they are for boot.
157 * However, boot has (system_state != SYSTEM_RUNNING)
158 * to quiet __might_sleep() in kmalloc() and resume does not.
159 */
160static inline void *acpi_os_allocate(acpi_size size)
161{
162 return kmalloc(size, irqs_disabled()? GFP_ATOMIC : GFP_KERNEL);
163}
164
165#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_allocate 125#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_allocate
166
167/* Use native linux version of acpi_os_allocate_zeroed */
168
169static inline void *acpi_os_allocate_zeroed(acpi_size size)
170{
171 return kzalloc(size, irqs_disabled()? GFP_ATOMIC : GFP_KERNEL);
172}
173
174#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_allocate_zeroed 126#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_allocate_zeroed
175#define USE_NATIVE_ALLOCATE_ZEROED
176
177static inline void acpi_os_free(void *memory)
178{
179 kfree(memory);
180}
181
182#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_free 127#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_free
183
184static inline void *acpi_os_acquire_object(acpi_cache_t * cache)
185{
186 return kmem_cache_zalloc(cache,
187 irqs_disabled()? GFP_ATOMIC : GFP_KERNEL);
188}
189
190#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_acquire_object 128#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_acquire_object
191
192static inline acpi_thread_id acpi_os_get_thread_id(void)
193{
194 return (acpi_thread_id) (unsigned long)current;
195}
196
197#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_thread_id 129#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_thread_id
198
199#ifndef CONFIG_PREEMPT
200
201/*
202 * Used within ACPICA to show where it is safe to preempt execution
203 * when CONFIG_PREEMPT=n
204 */
205#define ACPI_PREEMPTION_POINT() \
206 do { \
207 if (!irqs_disabled()) \
208 cond_resched(); \
209 } while (0)
210
211#endif
212
213/*
214 * When lockdep is enabled, the spin_lock_init() macro stringifies it's
215 * argument and uses that as a name for the lock in debugging.
216 * By executing spin_lock_init() in a macro the key changes from "lock" for
217 * all locks to the name of the argument of acpi_os_create_lock(), which
218 * prevents lockdep from reporting false positives for ACPICA locks.
219 */
220#define acpi_os_create_lock(__handle) \
221 ({ \
222 spinlock_t *lock = ACPI_ALLOCATE(sizeof(*lock)); \
223 if (lock) { \
224 *(__handle) = lock; \
225 spin_lock_init(*(__handle)); \
226 } \
227 lock ? AE_OK : AE_NO_MEMORY; \
228 })
229#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_create_lock 130#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_create_lock
230 131
231void __iomem *acpi_os_map_memory(acpi_physical_address where, acpi_size length);
232#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_map_memory
233
234void acpi_os_unmap_memory(void __iomem * logical_address, acpi_size size);
235#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_unmap_memory
236
237/* 132/*
238 * OSL interfaces used by debugger/disassembler 133 * OSL interfaces used by debugger/disassembler
239 */ 134 */
@@ -252,11 +147,45 @@ void acpi_os_unmap_memory(void __iomem * logical_address, acpi_size size);
252#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_next_filename 147#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_get_next_filename
253#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_close_directory 148#define ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_close_directory
254 149
255/* 150#else /* !__KERNEL__ */
256 * OSL interfaces added by Linux 151
257 */ 152#include <stdarg.h>
258void early_acpi_os_unmap_memory(void __iomem * virt, acpi_size size); 153#include <string.h>
154#include <stdlib.h>
155#include <ctype.h>
156#include <unistd.h>
157
158/* Define/disable kernel-specific declarators */
159
160#ifndef __init
161#define __init
162#endif
163
164/* Host-dependent types and defines for user-space ACPICA */
165
166#define ACPI_FLUSH_CPU_CACHE()
167#define ACPI_CAST_PTHREAD_T(pthread) ((acpi_thread_id) (pthread))
168
169#if defined(__ia64__) || defined(__x86_64__) ||\
170 defined(__aarch64__) || defined(__PPC64__)
171#define ACPI_MACHINE_WIDTH 64
172#define COMPILER_DEPENDENT_INT64 long
173#define COMPILER_DEPENDENT_UINT64 unsigned long
174#else
175#define ACPI_MACHINE_WIDTH 32
176#define COMPILER_DEPENDENT_INT64 long long
177#define COMPILER_DEPENDENT_UINT64 unsigned long long
178#define ACPI_USE_NATIVE_DIVIDE
179#endif
180
181#ifndef __cdecl
182#define __cdecl
183#endif
259 184
260#endif /* __KERNEL__ */ 185#endif /* __KERNEL__ */
261 186
187/* Linux uses GCC */
188
189#include <acpi/platform/acgcc.h>
190
262#endif /* __ACLINUX_H__ */ 191#endif /* __ACLINUX_H__ */
diff --git a/include/acpi/platform/aclinuxex.h b/include/acpi/platform/aclinuxex.h
new file mode 100644
index 000000000000..191e741cfa0e
--- /dev/null
+++ b/include/acpi/platform/aclinuxex.h
@@ -0,0 +1,112 @@
1/******************************************************************************
2 *
3 * Name: aclinuxex.h - Extra OS specific defines, etc. for Linux
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2014, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44#ifndef __ACLINUXEX_H__
45#define __ACLINUXEX_H__
46
47#ifdef __KERNEL__
48
49/*
50 * Overrides for in-kernel ACPICA
51 */
52acpi_status __init acpi_os_initialize(void);
53
54acpi_status acpi_os_terminate(void);
55
56/*
57 * The irqs_disabled() check is for resume from RAM.
58 * Interrupts are off during resume, just like they are for boot.
59 * However, boot has (system_state != SYSTEM_RUNNING)
60 * to quiet __might_sleep() in kmalloc() and resume does not.
61 */
62static inline void *acpi_os_allocate(acpi_size size)
63{
64 return kmalloc(size, irqs_disabled()? GFP_ATOMIC : GFP_KERNEL);
65}
66
67static inline void *acpi_os_allocate_zeroed(acpi_size size)
68{
69 return kzalloc(size, irqs_disabled()? GFP_ATOMIC : GFP_KERNEL);
70}
71
72static inline void acpi_os_free(void *memory)
73{
74 kfree(memory);
75}
76
77static inline void *acpi_os_acquire_object(acpi_cache_t * cache)
78{
79 return kmem_cache_zalloc(cache,
80 irqs_disabled()? GFP_ATOMIC : GFP_KERNEL);
81}
82
83static inline acpi_thread_id acpi_os_get_thread_id(void)
84{
85 return (acpi_thread_id) (unsigned long)current;
86}
87
88/*
89 * When lockdep is enabled, the spin_lock_init() macro stringifies it's
90 * argument and uses that as a name for the lock in debugging.
91 * By executing spin_lock_init() in a macro the key changes from "lock" for
92 * all locks to the name of the argument of acpi_os_create_lock(), which
93 * prevents lockdep from reporting false positives for ACPICA locks.
94 */
95#define acpi_os_create_lock(__handle) \
96 ({ \
97 spinlock_t *lock = ACPI_ALLOCATE(sizeof(*lock)); \
98 if (lock) { \
99 *(__handle) = lock; \
100 spin_lock_init(*(__handle)); \
101 } \
102 lock ? AE_OK : AE_NO_MEMORY; \
103 })
104
105/*
106 * OSL interfaces added by Linux
107 */
108void early_acpi_os_unmap_memory(void __iomem * virt, acpi_size size);
109
110#endif /* __KERNEL__ */
111
112#endif /* __ACLINUXEX_H__ */
diff --git a/include/acpi/processor.h b/include/acpi/processor.h
index 6eb1d3cb5104..9b9b6f29bbf3 100644
--- a/include/acpi/processor.h
+++ b/include/acpi/processor.h
@@ -53,7 +53,7 @@ struct acpi_power_register {
53 u8 bit_offset; 53 u8 bit_offset;
54 u8 access_size; 54 u8 access_size;
55 u64 address; 55 u64 address;
56} __attribute__ ((packed)); 56} __packed;
57 57
58struct acpi_processor_cx { 58struct acpi_processor_cx {
59 u8 valid; 59 u8 valid;
@@ -83,7 +83,7 @@ struct acpi_psd_package {
83 u64 domain; 83 u64 domain;
84 u64 coord_type; 84 u64 coord_type;
85 u64 num_processors; 85 u64 num_processors;
86} __attribute__ ((packed)); 86} __packed;
87 87
88struct acpi_pct_register { 88struct acpi_pct_register {
89 u8 descriptor; 89 u8 descriptor;
@@ -93,7 +93,7 @@ struct acpi_pct_register {
93 u8 bit_offset; 93 u8 bit_offset;
94 u8 reserved; 94 u8 reserved;
95 u64 address; 95 u64 address;
96} __attribute__ ((packed)); 96} __packed;
97 97
98struct acpi_processor_px { 98struct acpi_processor_px {
99 u64 core_frequency; /* megahertz */ 99 u64 core_frequency; /* megahertz */
@@ -124,7 +124,7 @@ struct acpi_tsd_package {
124 u64 domain; 124 u64 domain;
125 u64 coord_type; 125 u64 coord_type;
126 u64 num_processors; 126 u64 num_processors;
127} __attribute__ ((packed)); 127} __packed;
128 128
129struct acpi_ptc_register { 129struct acpi_ptc_register {
130 u8 descriptor; 130 u8 descriptor;
@@ -134,7 +134,7 @@ struct acpi_ptc_register {
134 u8 bit_offset; 134 u8 bit_offset;
135 u8 reserved; 135 u8 reserved;
136 u64 address; 136 u64 address;
137} __attribute__ ((packed)); 137} __packed;
138 138
139struct acpi_processor_tx_tss { 139struct acpi_processor_tx_tss {
140 u64 freqpercentage; /* */ 140 u64 freqpercentage; /* */
diff --git a/include/acpi/video.h b/include/acpi/video.h
index 61109f2609fc..843ef1adfbfa 100644
--- a/include/acpi/video.h
+++ b/include/acpi/video.h
@@ -19,16 +19,20 @@ struct acpi_device;
19#if (defined CONFIG_ACPI_VIDEO || defined CONFIG_ACPI_VIDEO_MODULE) 19#if (defined CONFIG_ACPI_VIDEO || defined CONFIG_ACPI_VIDEO_MODULE)
20extern int acpi_video_register(void); 20extern int acpi_video_register(void);
21extern void acpi_video_unregister(void); 21extern void acpi_video_unregister(void);
22extern void acpi_video_unregister_backlight(void);
22extern int acpi_video_get_edid(struct acpi_device *device, int type, 23extern int acpi_video_get_edid(struct acpi_device *device, int type,
23 int device_id, void **edid); 24 int device_id, void **edid);
25extern bool acpi_video_verify_backlight_support(void);
24#else 26#else
25static inline int acpi_video_register(void) { return 0; } 27static inline int acpi_video_register(void) { return 0; }
26static inline void acpi_video_unregister(void) { return; } 28static inline void acpi_video_unregister(void) { return; }
29static inline void acpi_video_unregister_backlight(void) { return; }
27static inline int acpi_video_get_edid(struct acpi_device *device, int type, 30static inline int acpi_video_get_edid(struct acpi_device *device, int type,
28 int device_id, void **edid) 31 int device_id, void **edid)
29{ 32{
30 return -ENODEV; 33 return -ENODEV;
31} 34}
35static inline bool acpi_video_verify_backlight_support(void) { return false; }
32#endif 36#endif
33 37
34#endif 38#endif
diff --git a/include/asm-generic/atomic.h b/include/asm-generic/atomic.h
index 33bd2de3bc1e..9c79e7603459 100644
--- a/include/asm-generic/atomic.h
+++ b/include/asm-generic/atomic.h
@@ -16,6 +16,7 @@
16#define __ASM_GENERIC_ATOMIC_H 16#define __ASM_GENERIC_ATOMIC_H
17 17
18#include <asm/cmpxchg.h> 18#include <asm/cmpxchg.h>
19#include <asm/barrier.h>
19 20
20#ifdef CONFIG_SMP 21#ifdef CONFIG_SMP
21/* Force people to define core atomics */ 22/* Force people to define core atomics */
@@ -182,11 +183,5 @@ static inline void atomic_set_mask(unsigned int mask, atomic_t *v)
182} 183}
183#endif 184#endif
184 185
185/* Assume that atomic operations are already serializing */
186#define smp_mb__before_atomic_dec() barrier()
187#define smp_mb__after_atomic_dec() barrier()
188#define smp_mb__before_atomic_inc() barrier()
189#define smp_mb__after_atomic_inc() barrier()
190
191#endif /* __KERNEL__ */ 186#endif /* __KERNEL__ */
192#endif /* __ASM_GENERIC_ATOMIC_H */ 187#endif /* __ASM_GENERIC_ATOMIC_H */
diff --git a/include/asm-generic/barrier.h b/include/asm-generic/barrier.h
index 6f692f8ac664..1402fa855388 100644
--- a/include/asm-generic/barrier.h
+++ b/include/asm-generic/barrier.h
@@ -62,6 +62,14 @@
62#define set_mb(var, value) do { (var) = (value); mb(); } while (0) 62#define set_mb(var, value) do { (var) = (value); mb(); } while (0)
63#endif 63#endif
64 64
65#ifndef smp_mb__before_atomic
66#define smp_mb__before_atomic() smp_mb()
67#endif
68
69#ifndef smp_mb__after_atomic
70#define smp_mb__after_atomic() smp_mb()
71#endif
72
65#define smp_store_release(p, v) \ 73#define smp_store_release(p, v) \
66do { \ 74do { \
67 compiletime_assert_atomic_type(*p); \ 75 compiletime_assert_atomic_type(*p); \
diff --git a/include/asm-generic/bitops.h b/include/asm-generic/bitops.h
index 280ca7a96f75..dcdcacf2fd2b 100644
--- a/include/asm-generic/bitops.h
+++ b/include/asm-generic/bitops.h
@@ -11,14 +11,7 @@
11 11
12#include <linux/irqflags.h> 12#include <linux/irqflags.h>
13#include <linux/compiler.h> 13#include <linux/compiler.h>
14 14#include <asm/barrier.h>
15/*
16 * clear_bit may not imply a memory barrier
17 */
18#ifndef smp_mb__before_clear_bit
19#define smp_mb__before_clear_bit() smp_mb()
20#define smp_mb__after_clear_bit() smp_mb()
21#endif
22 15
23#include <asm-generic/bitops/__ffs.h> 16#include <asm-generic/bitops/__ffs.h>
24#include <asm-generic/bitops/ffz.h> 17#include <asm-generic/bitops/ffz.h>
diff --git a/include/asm-generic/bitops/atomic.h b/include/asm-generic/bitops/atomic.h
index 9ae6c34dc191..49673510b484 100644
--- a/include/asm-generic/bitops/atomic.h
+++ b/include/asm-generic/bitops/atomic.h
@@ -80,7 +80,7 @@ static inline void set_bit(int nr, volatile unsigned long *addr)
80 * 80 *
81 * clear_bit() is atomic and may not be reordered. However, it does 81 * clear_bit() is atomic and may not be reordered. However, it does
82 * not contain a memory barrier, so if it is used for locking purposes, 82 * not contain a memory barrier, so if it is used for locking purposes,
83 * you should call smp_mb__before_clear_bit() and/or smp_mb__after_clear_bit() 83 * you should call smp_mb__before_atomic() and/or smp_mb__after_atomic()
84 * in order to ensure changes are visible on other processors. 84 * in order to ensure changes are visible on other processors.
85 */ 85 */
86static inline void clear_bit(int nr, volatile unsigned long *addr) 86static inline void clear_bit(int nr, volatile unsigned long *addr)
diff --git a/include/asm-generic/bitops/lock.h b/include/asm-generic/bitops/lock.h
index 308a9e22c802..c30266e94806 100644
--- a/include/asm-generic/bitops/lock.h
+++ b/include/asm-generic/bitops/lock.h
@@ -20,7 +20,7 @@
20 */ 20 */
21#define clear_bit_unlock(nr, addr) \ 21#define clear_bit_unlock(nr, addr) \
22do { \ 22do { \
23 smp_mb__before_clear_bit(); \ 23 smp_mb__before_atomic(); \
24 clear_bit(nr, addr); \ 24 clear_bit(nr, addr); \
25} while (0) 25} while (0)
26 26
diff --git a/include/asm-generic/dma-coherent.h b/include/asm-generic/dma-coherent.h
index 2be8a2dbc868..0297e5875798 100644
--- a/include/asm-generic/dma-coherent.h
+++ b/include/asm-generic/dma-coherent.h
@@ -16,16 +16,13 @@ int dma_mmap_from_coherent(struct device *dev, struct vm_area_struct *vma,
16 * Standard interface 16 * Standard interface
17 */ 17 */
18#define ARCH_HAS_DMA_DECLARE_COHERENT_MEMORY 18#define ARCH_HAS_DMA_DECLARE_COHERENT_MEMORY
19extern int 19int dma_declare_coherent_memory(struct device *dev, phys_addr_t phys_addr,
20dma_declare_coherent_memory(struct device *dev, dma_addr_t bus_addr, 20 dma_addr_t device_addr, size_t size, int flags);
21 dma_addr_t device_addr, size_t size, int flags);
22 21
23extern void 22void dma_release_declared_memory(struct device *dev);
24dma_release_declared_memory(struct device *dev);
25 23
26extern void * 24void *dma_mark_declared_memory_occupied(struct device *dev,
27dma_mark_declared_memory_occupied(struct device *dev, 25 dma_addr_t device_addr, size_t size);
28 dma_addr_t device_addr, size_t size);
29#else 26#else
30#define dma_alloc_from_coherent(dev, size, handle, ret) (0) 27#define dma_alloc_from_coherent(dev, size, handle, ret) (0)
31#define dma_release_from_coherent(dev, order, vaddr) (0) 28#define dma_release_from_coherent(dev, order, vaddr) (0)
diff --git a/include/asm-generic/ioctl.h b/include/asm-generic/ioctl.h
index d17295b290fa..297fb0d7cd6c 100644
--- a/include/asm-generic/ioctl.h
+++ b/include/asm-generic/ioctl.h
@@ -3,10 +3,15 @@
3 3
4#include <uapi/asm-generic/ioctl.h> 4#include <uapi/asm-generic/ioctl.h>
5 5
6#ifdef __CHECKER__
7#define _IOC_TYPECHECK(t) (sizeof(t))
8#else
6/* provoke compile error for invalid uses of size argument */ 9/* provoke compile error for invalid uses of size argument */
7extern unsigned int __invalid_size_argument_for_IOC; 10extern unsigned int __invalid_size_argument_for_IOC;
8#define _IOC_TYPECHECK(t) \ 11#define _IOC_TYPECHECK(t) \
9 ((sizeof(t) == sizeof(t[1]) && \ 12 ((sizeof(t) == sizeof(t[1]) && \
10 sizeof(t) < (1 << _IOC_SIZEBITS)) ? \ 13 sizeof(t) < (1 << _IOC_SIZEBITS)) ? \
11 sizeof(t) : __invalid_size_argument_for_IOC) 14 sizeof(t) : __invalid_size_argument_for_IOC)
15#endif
16
12#endif /* _ASM_GENERIC_IOCTL_H */ 17#endif /* _ASM_GENERIC_IOCTL_H */
diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h
index a8015a7a55bb..53b2acc38213 100644
--- a/include/asm-generic/pgtable.h
+++ b/include/asm-generic/pgtable.h
@@ -233,6 +233,10 @@ static inline int pmd_same(pmd_t pmd_a, pmd_t pmd_b)
233# define pte_accessible(mm, pte) ((void)(pte), 1) 233# define pte_accessible(mm, pte) ((void)(pte), 1)
234#endif 234#endif
235 235
236#ifndef pte_present_nonuma
237#define pte_present_nonuma(pte) pte_present(pte)
238#endif
239
236#ifndef flush_tlb_fix_spurious_fault 240#ifndef flush_tlb_fix_spurious_fault
237#define flush_tlb_fix_spurious_fault(vma, address) flush_tlb_page(vma, address) 241#define flush_tlb_fix_spurious_fault(vma, address) flush_tlb_page(vma, address)
238#endif 242#endif
@@ -670,7 +674,7 @@ static inline int pmd_trans_unstable(pmd_t *pmd)
670static inline int pte_numa(pte_t pte) 674static inline int pte_numa(pte_t pte)
671{ 675{
672 return (pte_flags(pte) & 676 return (pte_flags(pte) &
673 (_PAGE_NUMA|_PAGE_PRESENT)) == _PAGE_NUMA; 677 (_PAGE_NUMA|_PAGE_PROTNONE|_PAGE_PRESENT)) == _PAGE_NUMA;
674} 678}
675#endif 679#endif
676 680
@@ -678,7 +682,7 @@ static inline int pte_numa(pte_t pte)
678static inline int pmd_numa(pmd_t pmd) 682static inline int pmd_numa(pmd_t pmd)
679{ 683{
680 return (pmd_flags(pmd) & 684 return (pmd_flags(pmd) &
681 (_PAGE_NUMA|_PAGE_PRESENT)) == _PAGE_NUMA; 685 (_PAGE_NUMA|_PAGE_PROTNONE|_PAGE_PRESENT)) == _PAGE_NUMA;
682} 686}
683#endif 687#endif
684 688
diff --git a/include/asm-generic/qrwlock.h b/include/asm-generic/qrwlock.h
new file mode 100644
index 000000000000..6383d54bf983
--- /dev/null
+++ b/include/asm-generic/qrwlock.h
@@ -0,0 +1,166 @@
1/*
2 * Queue read/write lock
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 * (C) Copyright 2013-2014 Hewlett-Packard Development Company, L.P.
15 *
16 * Authors: Waiman Long <waiman.long@hp.com>
17 */
18#ifndef __ASM_GENERIC_QRWLOCK_H
19#define __ASM_GENERIC_QRWLOCK_H
20
21#include <linux/atomic.h>
22#include <asm/barrier.h>
23#include <asm/processor.h>
24
25#include <asm-generic/qrwlock_types.h>
26
27/*
28 * Writer states & reader shift and bias
29 */
30#define _QW_WAITING 1 /* A writer is waiting */
31#define _QW_LOCKED 0xff /* A writer holds the lock */
32#define _QW_WMASK 0xff /* Writer mask */
33#define _QR_SHIFT 8 /* Reader count shift */
34#define _QR_BIAS (1U << _QR_SHIFT)
35
36/*
37 * External function declarations
38 */
39extern void queue_read_lock_slowpath(struct qrwlock *lock);
40extern void queue_write_lock_slowpath(struct qrwlock *lock);
41
42/**
43 * queue_read_can_lock- would read_trylock() succeed?
44 * @lock: Pointer to queue rwlock structure
45 */
46static inline int queue_read_can_lock(struct qrwlock *lock)
47{
48 return !(atomic_read(&lock->cnts) & _QW_WMASK);
49}
50
51/**
52 * queue_write_can_lock- would write_trylock() succeed?
53 * @lock: Pointer to queue rwlock structure
54 */
55static inline int queue_write_can_lock(struct qrwlock *lock)
56{
57 return !atomic_read(&lock->cnts);
58}
59
60/**
61 * queue_read_trylock - try to acquire read lock of a queue rwlock
62 * @lock : Pointer to queue rwlock structure
63 * Return: 1 if lock acquired, 0 if failed
64 */
65static inline int queue_read_trylock(struct qrwlock *lock)
66{
67 u32 cnts;
68
69 cnts = atomic_read(&lock->cnts);
70 if (likely(!(cnts & _QW_WMASK))) {
71 cnts = (u32)atomic_add_return(_QR_BIAS, &lock->cnts);
72 if (likely(!(cnts & _QW_WMASK)))
73 return 1;
74 atomic_sub(_QR_BIAS, &lock->cnts);
75 }
76 return 0;
77}
78
79/**
80 * queue_write_trylock - try to acquire write lock of a queue rwlock
81 * @lock : Pointer to queue rwlock structure
82 * Return: 1 if lock acquired, 0 if failed
83 */
84static inline int queue_write_trylock(struct qrwlock *lock)
85{
86 u32 cnts;
87
88 cnts = atomic_read(&lock->cnts);
89 if (unlikely(cnts))
90 return 0;
91
92 return likely(atomic_cmpxchg(&lock->cnts,
93 cnts, cnts | _QW_LOCKED) == cnts);
94}
95/**
96 * queue_read_lock - acquire read lock of a queue rwlock
97 * @lock: Pointer to queue rwlock structure
98 */
99static inline void queue_read_lock(struct qrwlock *lock)
100{
101 u32 cnts;
102
103 cnts = atomic_add_return(_QR_BIAS, &lock->cnts);
104 if (likely(!(cnts & _QW_WMASK)))
105 return;
106
107 /* The slowpath will decrement the reader count, if necessary. */
108 queue_read_lock_slowpath(lock);
109}
110
111/**
112 * queue_write_lock - acquire write lock of a queue rwlock
113 * @lock : Pointer to queue rwlock structure
114 */
115static inline void queue_write_lock(struct qrwlock *lock)
116{
117 /* Optimize for the unfair lock case where the fair flag is 0. */
118 if (atomic_cmpxchg(&lock->cnts, 0, _QW_LOCKED) == 0)
119 return;
120
121 queue_write_lock_slowpath(lock);
122}
123
124/**
125 * queue_read_unlock - release read lock of a queue rwlock
126 * @lock : Pointer to queue rwlock structure
127 */
128static inline void queue_read_unlock(struct qrwlock *lock)
129{
130 /*
131 * Atomically decrement the reader count
132 */
133 smp_mb__before_atomic();
134 atomic_sub(_QR_BIAS, &lock->cnts);
135}
136
137#ifndef queue_write_unlock
138/**
139 * queue_write_unlock - release write lock of a queue rwlock
140 * @lock : Pointer to queue rwlock structure
141 */
142static inline void queue_write_unlock(struct qrwlock *lock)
143{
144 /*
145 * If the writer field is atomic, it can be cleared directly.
146 * Otherwise, an atomic subtraction will be used to clear it.
147 */
148 smp_mb__before_atomic();
149 atomic_sub(_QW_LOCKED, &lock->cnts);
150}
151#endif
152
153/*
154 * Remapping rwlock architecture specific functions to the corresponding
155 * queue rwlock functions.
156 */
157#define arch_read_can_lock(l) queue_read_can_lock(l)
158#define arch_write_can_lock(l) queue_write_can_lock(l)
159#define arch_read_lock(l) queue_read_lock(l)
160#define arch_write_lock(l) queue_write_lock(l)
161#define arch_read_trylock(l) queue_read_trylock(l)
162#define arch_write_trylock(l) queue_write_trylock(l)
163#define arch_read_unlock(l) queue_read_unlock(l)
164#define arch_write_unlock(l) queue_write_unlock(l)
165
166#endif /* __ASM_GENERIC_QRWLOCK_H */
diff --git a/include/asm-generic/qrwlock_types.h b/include/asm-generic/qrwlock_types.h
new file mode 100644
index 000000000000..4d76f24df518
--- /dev/null
+++ b/include/asm-generic/qrwlock_types.h
@@ -0,0 +1,21 @@
1#ifndef __ASM_GENERIC_QRWLOCK_TYPES_H
2#define __ASM_GENERIC_QRWLOCK_TYPES_H
3
4#include <linux/types.h>
5#include <asm/spinlock_types.h>
6
7/*
8 * The queue read/write lock data structure
9 */
10
11typedef struct qrwlock {
12 atomic_t cnts;
13 arch_spinlock_t lock;
14} arch_rwlock_t;
15
16#define __ARCH_RW_LOCK_UNLOCKED { \
17 .cnts = ATOMIC_INIT(0), \
18 .lock = __ARCH_SPIN_LOCK_UNLOCKED, \
19}
20
21#endif /* __ASM_GENERIC_QRWLOCK_TYPES_H */
diff --git a/include/asm-generic/unaligned.h b/include/asm-generic/unaligned.h
index 03cf5936bad6..1ac097279db1 100644
--- a/include/asm-generic/unaligned.h
+++ b/include/asm-generic/unaligned.h
@@ -4,22 +4,27 @@
4/* 4/*
5 * This is the most generic implementation of unaligned accesses 5 * This is the most generic implementation of unaligned accesses
6 * and should work almost anywhere. 6 * and should work almost anywhere.
7 *
8 * If an architecture can handle unaligned accesses in hardware,
9 * it may want to use the linux/unaligned/access_ok.h implementation
10 * instead.
11 */ 7 */
12#include <asm/byteorder.h> 8#include <asm/byteorder.h>
13 9
10/* Set by the arch if it can handle unaligned accesses in hardware. */
11#ifdef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
12# include <linux/unaligned/access_ok.h>
13#endif
14
14#if defined(__LITTLE_ENDIAN) 15#if defined(__LITTLE_ENDIAN)
15# include <linux/unaligned/le_struct.h> 16# ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
16# include <linux/unaligned/be_byteshift.h> 17# include <linux/unaligned/le_struct.h>
18# include <linux/unaligned/be_byteshift.h>
19# endif
17# include <linux/unaligned/generic.h> 20# include <linux/unaligned/generic.h>
18# define get_unaligned __get_unaligned_le 21# define get_unaligned __get_unaligned_le
19# define put_unaligned __put_unaligned_le 22# define put_unaligned __put_unaligned_le
20#elif defined(__BIG_ENDIAN) 23#elif defined(__BIG_ENDIAN)
21# include <linux/unaligned/be_struct.h> 24# ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
22# include <linux/unaligned/le_byteshift.h> 25# include <linux/unaligned/be_struct.h>
26# include <linux/unaligned/le_byteshift.h>
27# endif
23# include <linux/unaligned/generic.h> 28# include <linux/unaligned/generic.h>
24# define get_unaligned __get_unaligned_be 29# define get_unaligned __get_unaligned_be
25# define put_unaligned __put_unaligned_be 30# define put_unaligned __put_unaligned_be
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 146e4fffd710..c1c0b0cf39b4 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -109,6 +109,15 @@
109#define BRANCH_PROFILE() 109#define BRANCH_PROFILE()
110#endif 110#endif
111 111
112#ifdef CONFIG_KPROBES
113#define KPROBE_BLACKLIST() . = ALIGN(8); \
114 VMLINUX_SYMBOL(__start_kprobe_blacklist) = .; \
115 *(_kprobe_blacklist) \
116 VMLINUX_SYMBOL(__stop_kprobe_blacklist) = .;
117#else
118#define KPROBE_BLACKLIST()
119#endif
120
112#ifdef CONFIG_EVENT_TRACING 121#ifdef CONFIG_EVENT_TRACING
113#define FTRACE_EVENTS() . = ALIGN(8); \ 122#define FTRACE_EVENTS() . = ALIGN(8); \
114 VMLINUX_SYMBOL(__start_ftrace_events) = .; \ 123 VMLINUX_SYMBOL(__start_ftrace_events) = .; \
@@ -139,52 +148,23 @@
139#define TRACE_SYSCALLS() 148#define TRACE_SYSCALLS()
140#endif 149#endif
141 150
142#ifdef CONFIG_CLKSRC_OF
143#define CLKSRC_OF_TABLES() . = ALIGN(8); \
144 VMLINUX_SYMBOL(__clksrc_of_table) = .; \
145 *(__clksrc_of_table) \
146 *(__clksrc_of_table_end)
147#else
148#define CLKSRC_OF_TABLES()
149#endif
150 151
151#ifdef CONFIG_IRQCHIP 152#define ___OF_TABLE(cfg, name) _OF_TABLE_##cfg(name)
152#define IRQCHIP_OF_MATCH_TABLE() \ 153#define __OF_TABLE(cfg, name) ___OF_TABLE(cfg, name)
154#define OF_TABLE(cfg, name) __OF_TABLE(config_enabled(cfg), name)
155#define _OF_TABLE_0(name)
156#define _OF_TABLE_1(name) \
153 . = ALIGN(8); \ 157 . = ALIGN(8); \
154 VMLINUX_SYMBOL(__irqchip_begin) = .; \ 158 VMLINUX_SYMBOL(__##name##_of_table) = .; \
155 *(__irqchip_of_table) \ 159 *(__##name##_of_table) \
156 *(__irqchip_of_end) 160 *(__##name##_of_table_end)
157#else
158#define IRQCHIP_OF_MATCH_TABLE()
159#endif
160 161
161#ifdef CONFIG_COMMON_CLK 162#define CLKSRC_OF_TABLES() OF_TABLE(CONFIG_CLKSRC_OF, clksrc)
162#define CLK_OF_TABLES() . = ALIGN(8); \ 163#define IRQCHIP_OF_MATCH_TABLE() OF_TABLE(CONFIG_IRQCHIP, irqchip)
163 VMLINUX_SYMBOL(__clk_of_table) = .; \ 164#define CLK_OF_TABLES() OF_TABLE(CONFIG_COMMON_CLK, clk)
164 *(__clk_of_table) \ 165#define RESERVEDMEM_OF_TABLES() OF_TABLE(CONFIG_OF_RESERVED_MEM, reservedmem)
165 *(__clk_of_table_end) 166#define CPU_METHOD_OF_TABLES() OF_TABLE(CONFIG_SMP, cpu_method)
166#else 167#define EARLYCON_OF_TABLES() OF_TABLE(CONFIG_SERIAL_EARLYCON, earlycon)
167#define CLK_OF_TABLES()
168#endif
169
170#ifdef CONFIG_OF_RESERVED_MEM
171#define RESERVEDMEM_OF_TABLES() \
172 . = ALIGN(8); \
173 VMLINUX_SYMBOL(__reservedmem_of_table) = .; \
174 *(__reservedmem_of_table) \
175 *(__reservedmem_of_table_end)
176#else
177#define RESERVEDMEM_OF_TABLES()
178#endif
179
180#ifdef CONFIG_SMP
181#define CPU_METHOD_OF_TABLES() . = ALIGN(8); \
182 VMLINUX_SYMBOL(__cpu_method_of_table_begin) = .; \
183 *(__cpu_method_of_table) \
184 VMLINUX_SYMBOL(__cpu_method_of_table_end) = .;
185#else
186#define CPU_METHOD_OF_TABLES()
187#endif
188 168
189#define KERNEL_DTB() \ 169#define KERNEL_DTB() \
190 STRUCT_ALIGN(); \ 170 STRUCT_ALIGN(); \
@@ -507,13 +487,15 @@
507 *(.init.rodata) \ 487 *(.init.rodata) \
508 FTRACE_EVENTS() \ 488 FTRACE_EVENTS() \
509 TRACE_SYSCALLS() \ 489 TRACE_SYSCALLS() \
490 KPROBE_BLACKLIST() \
510 MEM_DISCARD(init.rodata) \ 491 MEM_DISCARD(init.rodata) \
511 CLK_OF_TABLES() \ 492 CLK_OF_TABLES() \
512 RESERVEDMEM_OF_TABLES() \ 493 RESERVEDMEM_OF_TABLES() \
513 CLKSRC_OF_TABLES() \ 494 CLKSRC_OF_TABLES() \
514 CPU_METHOD_OF_TABLES() \ 495 CPU_METHOD_OF_TABLES() \
515 KERNEL_DTB() \ 496 KERNEL_DTB() \
516 IRQCHIP_OF_MATCH_TABLE() 497 IRQCHIP_OF_MATCH_TABLE() \
498 EARLYCON_OF_TABLES()
517 499
518#define INIT_TEXT \ 500#define INIT_TEXT \
519 *(.init.text) \ 501 *(.init.text) \
@@ -711,7 +693,7 @@
711 . = ALIGN(PAGE_SIZE); \ 693 . = ALIGN(PAGE_SIZE); \
712 *(.data..percpu..page_aligned) \ 694 *(.data..percpu..page_aligned) \
713 . = ALIGN(cacheline); \ 695 . = ALIGN(cacheline); \
714 *(.data..percpu..readmostly) \ 696 *(.data..percpu..read_mostly) \
715 . = ALIGN(cacheline); \ 697 . = ALIGN(cacheline); \
716 *(.data..percpu) \ 698 *(.data..percpu) \
717 *(.data..percpu..shared_aligned) \ 699 *(.data..percpu..shared_aligned) \
diff --git a/include/crypto/internal/hash.h b/include/crypto/internal/hash.h
index 821eae8cbd8c..9b6f32a6cad1 100644
--- a/include/crypto/internal/hash.h
+++ b/include/crypto/internal/hash.h
@@ -55,15 +55,28 @@ extern const struct crypto_type crypto_ahash_type;
55int crypto_hash_walk_done(struct crypto_hash_walk *walk, int err); 55int crypto_hash_walk_done(struct crypto_hash_walk *walk, int err);
56int crypto_hash_walk_first(struct ahash_request *req, 56int crypto_hash_walk_first(struct ahash_request *req,
57 struct crypto_hash_walk *walk); 57 struct crypto_hash_walk *walk);
58int crypto_ahash_walk_first(struct ahash_request *req,
59 struct crypto_hash_walk *walk);
58int crypto_hash_walk_first_compat(struct hash_desc *hdesc, 60int crypto_hash_walk_first_compat(struct hash_desc *hdesc,
59 struct crypto_hash_walk *walk, 61 struct crypto_hash_walk *walk,
60 struct scatterlist *sg, unsigned int len); 62 struct scatterlist *sg, unsigned int len);
61 63
64static inline int crypto_ahash_walk_done(struct crypto_hash_walk *walk,
65 int err)
66{
67 return crypto_hash_walk_done(walk, err);
68}
69
62static inline int crypto_hash_walk_last(struct crypto_hash_walk *walk) 70static inline int crypto_hash_walk_last(struct crypto_hash_walk *walk)
63{ 71{
64 return !(walk->entrylen | walk->total); 72 return !(walk->entrylen | walk->total);
65} 73}
66 74
75static inline int crypto_ahash_walk_last(struct crypto_hash_walk *walk)
76{
77 return crypto_hash_walk_last(walk);
78}
79
67int crypto_register_ahash(struct ahash_alg *alg); 80int crypto_register_ahash(struct ahash_alg *alg);
68int crypto_unregister_ahash(struct ahash_alg *alg); 81int crypto_unregister_ahash(struct ahash_alg *alg);
69int ahash_register_instance(struct crypto_template *tmpl, 82int ahash_register_instance(struct crypto_template *tmpl,
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index a7c2a862b4f4..8af71a8e2c00 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -143,11 +143,6 @@ int drm_err(const char *func, const char *format, ...);
143#define DRIVER_PRIME 0x4000 143#define DRIVER_PRIME 0x4000
144#define DRIVER_RENDER 0x8000 144#define DRIVER_RENDER 0x8000
145 145
146#define DRIVER_BUS_PCI 0x1
147#define DRIVER_BUS_PLATFORM 0x2
148#define DRIVER_BUS_USB 0x3
149#define DRIVER_BUS_HOST1X 0x4
150
151/***********************************************************************/ 146/***********************************************************************/
152/** \name Begin the DRM... */ 147/** \name Begin the DRM... */
153/*@{*/ 148/*@{*/
@@ -239,8 +234,6 @@ int drm_err(const char *func, const char *format, ...);
239/** \name Internal types and structures */ 234/** \name Internal types and structures */
240/*@{*/ 235/*@{*/
241 236
242#define DRM_ARRAY_SIZE(x) ARRAY_SIZE(x)
243
244#define DRM_IF_VERSION(maj, min) (maj << 16 | min) 237#define DRM_IF_VERSION(maj, min) (maj << 16 | min)
245 238
246/** 239/**
@@ -731,13 +724,7 @@ struct drm_master {
731#define DRM_SCANOUTPOS_ACCURATE (1 << 2) 724#define DRM_SCANOUTPOS_ACCURATE (1 << 2)
732 725
733struct drm_bus { 726struct drm_bus {
734 int bus_type;
735 int (*get_irq)(struct drm_device *dev);
736 const char *(*get_name)(struct drm_device *dev);
737 int (*set_busid)(struct drm_device *dev, struct drm_master *master); 727 int (*set_busid)(struct drm_device *dev, struct drm_master *master);
738 int (*set_unique)(struct drm_device *dev, struct drm_master *master,
739 struct drm_unique *unique);
740 int (*irq_by_busid)(struct drm_device *dev, struct drm_irq_busid *p);
741}; 728};
742 729
743/** 730/**
@@ -974,11 +961,6 @@ struct drm_driver {
974 const struct drm_ioctl_desc *ioctls; 961 const struct drm_ioctl_desc *ioctls;
975 int num_ioctls; 962 int num_ioctls;
976 const struct file_operations *fops; 963 const struct file_operations *fops;
977 union {
978 struct pci_driver *pci;
979 struct platform_device *platform_device;
980 struct usb_driver *usb;
981 } kdriver;
982 struct drm_bus *bus; 964 struct drm_bus *bus;
983 965
984 /* List of devices hanging off this driver with stealth attach. */ 966 /* List of devices hanging off this driver with stealth attach. */
@@ -1040,14 +1022,17 @@ struct drm_pending_vblank_event {
1040}; 1022};
1041 1023
1042struct drm_vblank_crtc { 1024struct drm_vblank_crtc {
1025 struct drm_device *dev; /* pointer to the drm_device */
1043 wait_queue_head_t queue; /**< VBLANK wait queue */ 1026 wait_queue_head_t queue; /**< VBLANK wait queue */
1044 struct timeval time[DRM_VBLANKTIME_RBSIZE]; /**< timestamp of current count */ 1027 struct timeval time[DRM_VBLANKTIME_RBSIZE]; /**< timestamp of current count */
1028 struct timer_list disable_timer; /* delayed disable timer */
1045 atomic_t count; /**< number of VBLANK interrupts */ 1029 atomic_t count; /**< number of VBLANK interrupts */
1046 atomic_t refcount; /* number of users of vblank interruptsper crtc */ 1030 atomic_t refcount; /* number of users of vblank interruptsper crtc */
1047 u32 last; /* protected by dev->vbl_lock, used */ 1031 u32 last; /* protected by dev->vbl_lock, used */
1048 /* for wraparound handling */ 1032 /* for wraparound handling */
1049 u32 last_wait; /* Last vblank seqno waited per CRTC */ 1033 u32 last_wait; /* Last vblank seqno waited per CRTC */
1050 unsigned int inmodeset; /* Display driver is setting mode */ 1034 unsigned int inmodeset; /* Display driver is setting mode */
1035 int crtc; /* crtc index */
1051 bool enabled; /* so we don't call enable more than 1036 bool enabled; /* so we don't call enable more than
1052 once per disable */ 1037 once per disable */
1053}; 1038};
@@ -1058,7 +1043,6 @@ struct drm_vblank_crtc {
1058 */ 1043 */
1059struct drm_device { 1044struct drm_device {
1060 struct list_head legacy_dev_list;/**< list of devices per driver for stealth attach cleanup */ 1045 struct list_head legacy_dev_list;/**< list of devices per driver for stealth attach cleanup */
1061 char *devname; /**< For /proc/interrupts */
1062 int if_version; /**< Highest interface version set */ 1046 int if_version; /**< Highest interface version set */
1063 1047
1064 /** \name Lifetime Management */ 1048 /** \name Lifetime Management */
@@ -1072,18 +1056,19 @@ struct drm_device {
1072 struct drm_minor *render; /**< Render node */ 1056 struct drm_minor *render; /**< Render node */
1073 atomic_t unplugged; /**< Flag whether dev is dead */ 1057 atomic_t unplugged; /**< Flag whether dev is dead */
1074 struct inode *anon_inode; /**< inode for private address-space */ 1058 struct inode *anon_inode; /**< inode for private address-space */
1059 char *unique; /**< unique name of the device */
1075 /*@} */ 1060 /*@} */
1076 1061
1077 /** \name Locks */ 1062 /** \name Locks */
1078 /*@{ */ 1063 /*@{ */
1079 spinlock_t count_lock; /**< For inuse, drm_device::open_count, drm_device::buf_use */
1080 struct mutex struct_mutex; /**< For others */ 1064 struct mutex struct_mutex; /**< For others */
1081 struct mutex master_mutex; /**< For drm_minor::master and drm_file::is_master */ 1065 struct mutex master_mutex; /**< For drm_minor::master and drm_file::is_master */
1082 /*@} */ 1066 /*@} */
1083 1067
1084 /** \name Usage Counters */ 1068 /** \name Usage Counters */
1085 /*@{ */ 1069 /*@{ */
1086 int open_count; /**< Outstanding files open */ 1070 int open_count; /**< Outstanding files open, protected by drm_global_mutex. */
1071 spinlock_t buf_lock; /**< For drm_device::buf_use and a few other things. */
1087 int buf_use; /**< Buffers in use -- cannot alloc */ 1072 int buf_use; /**< Buffers in use -- cannot alloc */
1088 atomic_t buf_alloc; /**< Buffer allocation in progress */ 1073 atomic_t buf_alloc; /**< Buffer allocation in progress */
1089 /*@} */ 1074 /*@} */
@@ -1114,6 +1099,8 @@ struct drm_device {
1114 /** \name Context support */ 1099 /** \name Context support */
1115 /*@{ */ 1100 /*@{ */
1116 bool irq_enabled; /**< True if irq handler is enabled */ 1101 bool irq_enabled; /**< True if irq handler is enabled */
1102 int irq;
1103
1117 __volatile__ long context_flag; /**< Context swapping flag */ 1104 __volatile__ long context_flag; /**< Context swapping flag */
1118 int last_context; /**< Last current context */ 1105 int last_context; /**< Last current context */
1119 /*@} */ 1106 /*@} */
@@ -1134,7 +1121,6 @@ struct drm_device {
1134 1121
1135 spinlock_t vblank_time_lock; /**< Protects vblank count and time updates during vblank enable/disable */ 1122 spinlock_t vblank_time_lock; /**< Protects vblank count and time updates during vblank enable/disable */
1136 spinlock_t vbl_lock; 1123 spinlock_t vbl_lock;
1137 struct timer_list vblank_disable_timer;
1138 1124
1139 u32 max_vblank_count; /**< size of vblank counter register */ 1125 u32 max_vblank_count; /**< size of vblank counter register */
1140 1126
@@ -1186,11 +1172,6 @@ static __inline__ int drm_core_check_feature(struct drm_device *dev,
1186 return ((dev->driver->driver_features & feature) ? 1 : 0); 1172 return ((dev->driver->driver_features & feature) ? 1 : 0);
1187} 1173}
1188 1174
1189static inline int drm_dev_to_irq(struct drm_device *dev)
1190{
1191 return dev->driver->bus->get_irq(dev);
1192}
1193
1194static inline void drm_device_set_unplugged(struct drm_device *dev) 1175static inline void drm_device_set_unplugged(struct drm_device *dev)
1195{ 1176{
1196 smp_wmb(); 1177 smp_wmb();
@@ -1204,11 +1185,6 @@ static inline int drm_device_is_unplugged(struct drm_device *dev)
1204 return ret; 1185 return ret;
1205} 1186}
1206 1187
1207static inline bool drm_modeset_is_locked(struct drm_device *dev)
1208{
1209 return mutex_is_locked(&dev->mode_config.mutex);
1210}
1211
1212static inline bool drm_is_render_client(const struct drm_file *file_priv) 1188static inline bool drm_is_render_client(const struct drm_file *file_priv)
1213{ 1189{
1214 return file_priv->minor->type == DRM_MINOR_RENDER; 1190 return file_priv->minor->type == DRM_MINOR_RENDER;
@@ -1310,7 +1286,7 @@ extern int drm_remove_magic(struct drm_master *master, drm_magic_t magic);
1310/* Cache management (drm_cache.c) */ 1286/* Cache management (drm_cache.c) */
1311void drm_clflush_pages(struct page *pages[], unsigned long num_pages); 1287void drm_clflush_pages(struct page *pages[], unsigned long num_pages);
1312void drm_clflush_sg(struct sg_table *st); 1288void drm_clflush_sg(struct sg_table *st);
1313void drm_clflush_virt_range(char *addr, unsigned long length); 1289void drm_clflush_virt_range(void *addr, unsigned long length);
1314 1290
1315 /* Locking IOCTL support (drm_lock.h) */ 1291 /* Locking IOCTL support (drm_lock.h) */
1316extern int drm_lock(struct drm_device *dev, void *data, 1292extern int drm_lock(struct drm_device *dev, void *data,
@@ -1363,7 +1339,7 @@ extern void drm_core_reclaim_buffers(struct drm_device *dev,
1363 /* IRQ support (drm_irq.h) */ 1339 /* IRQ support (drm_irq.h) */
1364extern int drm_control(struct drm_device *dev, void *data, 1340extern int drm_control(struct drm_device *dev, void *data,
1365 struct drm_file *file_priv); 1341 struct drm_file *file_priv);
1366extern int drm_irq_install(struct drm_device *dev); 1342extern int drm_irq_install(struct drm_device *dev, int irq);
1367extern int drm_irq_uninstall(struct drm_device *dev); 1343extern int drm_irq_uninstall(struct drm_device *dev);
1368 1344
1369extern int drm_vblank_init(struct drm_device *dev, int num_crtcs); 1345extern int drm_vblank_init(struct drm_device *dev, int num_crtcs);
@@ -1377,8 +1353,14 @@ extern void drm_send_vblank_event(struct drm_device *dev, int crtc,
1377extern bool drm_handle_vblank(struct drm_device *dev, int crtc); 1353extern bool drm_handle_vblank(struct drm_device *dev, int crtc);
1378extern int drm_vblank_get(struct drm_device *dev, int crtc); 1354extern int drm_vblank_get(struct drm_device *dev, int crtc);
1379extern void drm_vblank_put(struct drm_device *dev, int crtc); 1355extern void drm_vblank_put(struct drm_device *dev, int crtc);
1356extern int drm_crtc_vblank_get(struct drm_crtc *crtc);
1357extern void drm_crtc_vblank_put(struct drm_crtc *crtc);
1380extern void drm_vblank_off(struct drm_device *dev, int crtc); 1358extern void drm_vblank_off(struct drm_device *dev, int crtc);
1359extern void drm_vblank_on(struct drm_device *dev, int crtc);
1360extern void drm_crtc_vblank_off(struct drm_crtc *crtc);
1361extern void drm_crtc_vblank_on(struct drm_crtc *crtc);
1381extern void drm_vblank_cleanup(struct drm_device *dev); 1362extern void drm_vblank_cleanup(struct drm_device *dev);
1363
1382extern u32 drm_get_last_vbltimestamp(struct drm_device *dev, int crtc, 1364extern u32 drm_get_last_vbltimestamp(struct drm_device *dev, int crtc,
1383 struct timeval *tvblank, unsigned flags); 1365 struct timeval *tvblank, unsigned flags);
1384extern int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev, 1366extern int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
@@ -1522,6 +1504,9 @@ extern drm_dma_handle_t *drm_pci_alloc(struct drm_device *dev, size_t size,
1522 size_t align); 1504 size_t align);
1523extern void __drm_pci_free(struct drm_device *dev, drm_dma_handle_t * dmah); 1505extern void __drm_pci_free(struct drm_device *dev, drm_dma_handle_t * dmah);
1524extern void drm_pci_free(struct drm_device *dev, drm_dma_handle_t * dmah); 1506extern void drm_pci_free(struct drm_device *dev, drm_dma_handle_t * dmah);
1507extern int drm_pci_set_unique(struct drm_device *dev,
1508 struct drm_master *master,
1509 struct drm_unique *u);
1525 1510
1526 /* sysfs support (drm_sysfs.c) */ 1511 /* sysfs support (drm_sysfs.c) */
1527struct drm_sysfs_class; 1512struct drm_sysfs_class;
@@ -1631,6 +1616,7 @@ void drm_dev_ref(struct drm_device *dev);
1631void drm_dev_unref(struct drm_device *dev); 1616void drm_dev_unref(struct drm_device *dev);
1632int drm_dev_register(struct drm_device *dev, unsigned long flags); 1617int drm_dev_register(struct drm_device *dev, unsigned long flags);
1633void drm_dev_unregister(struct drm_device *dev); 1618void drm_dev_unregister(struct drm_device *dev);
1619int drm_dev_set_unique(struct drm_device *dev, const char *fmt, ...);
1634 1620
1635struct drm_minor *drm_minor_acquire(unsigned int minor_id); 1621struct drm_minor *drm_minor_acquire(unsigned int minor_id);
1636void drm_minor_release(struct drm_minor *minor); 1622void drm_minor_release(struct drm_minor *minor);
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index e55fccbe7c42..251b75e6bf7a 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -33,6 +33,7 @@
33#include <linux/hdmi.h> 33#include <linux/hdmi.h>
34#include <drm/drm_mode.h> 34#include <drm/drm_mode.h>
35#include <drm/drm_fourcc.h> 35#include <drm/drm_fourcc.h>
36#include <drm/drm_modeset_lock.h>
36 37
37struct drm_device; 38struct drm_device;
38struct drm_mode_set; 39struct drm_mode_set;
@@ -50,6 +51,7 @@ struct drm_clip_rect;
50#define DRM_MODE_OBJECT_BLOB 0xbbbbbbbb 51#define DRM_MODE_OBJECT_BLOB 0xbbbbbbbb
51#define DRM_MODE_OBJECT_PLANE 0xeeeeeeee 52#define DRM_MODE_OBJECT_PLANE 0xeeeeeeee
52#define DRM_MODE_OBJECT_BRIDGE 0xbdbdbdbd 53#define DRM_MODE_OBJECT_BRIDGE 0xbdbdbdbd
54#define DRM_MODE_OBJECT_ANY 0
53 55
54struct drm_mode_object { 56struct drm_mode_object {
55 uint32_t id; 57 uint32_t id;
@@ -64,6 +66,15 @@ struct drm_object_properties {
64 uint64_t values[DRM_OBJECT_MAX_PROPERTY]; 66 uint64_t values[DRM_OBJECT_MAX_PROPERTY];
65}; 67};
66 68
69static inline int64_t U642I64(uint64_t val)
70{
71 return (int64_t)*((int64_t *)&val);
72}
73static inline uint64_t I642U64(int64_t val)
74{
75 return (uint64_t)*((uint64_t *)&val);
76}
77
67enum drm_connector_force { 78enum drm_connector_force {
68 DRM_FORCE_UNSPECIFIED, 79 DRM_FORCE_UNSPECIFIED,
69 DRM_FORCE_OFF, 80 DRM_FORCE_OFF,
@@ -110,6 +121,9 @@ struct drm_display_info {
110 enum subpixel_order subpixel_order; 121 enum subpixel_order subpixel_order;
111 u32 color_formats; 122 u32 color_formats;
112 123
124 /* Mask of supported hdmi deep color modes */
125 u8 edid_hdmi_dc_modes;
126
113 u8 cea_rev; 127 u8 cea_rev;
114}; 128};
115 129
@@ -190,10 +204,15 @@ struct drm_property {
190 char name[DRM_PROP_NAME_LEN]; 204 char name[DRM_PROP_NAME_LEN];
191 uint32_t num_values; 205 uint32_t num_values;
192 uint64_t *values; 206 uint64_t *values;
207 struct drm_device *dev;
193 208
194 struct list_head enum_blob_list; 209 struct list_head enum_blob_list;
195}; 210};
196 211
212void drm_modeset_lock_all(struct drm_device *dev);
213void drm_modeset_unlock_all(struct drm_device *dev);
214void drm_warn_on_modeset_not_all_locked(struct drm_device *dev);
215
197struct drm_crtc; 216struct drm_crtc;
198struct drm_connector; 217struct drm_connector;
199struct drm_encoder; 218struct drm_encoder;
@@ -269,6 +288,7 @@ struct drm_crtc_funcs {
269 * drm_crtc - central CRTC control structure 288 * drm_crtc - central CRTC control structure
270 * @dev: parent DRM device 289 * @dev: parent DRM device
271 * @head: list management 290 * @head: list management
291 * @mutex: per-CRTC locking
272 * @base: base KMS object for ID tracking etc. 292 * @base: base KMS object for ID tracking etc.
273 * @primary: primary plane for this CRTC 293 * @primary: primary plane for this CRTC
274 * @cursor: cursor plane for this CRTC 294 * @cursor: cursor plane for this CRTC
@@ -303,7 +323,7 @@ struct drm_crtc {
303 * state, ...) and a write lock for everything which can be update 323 * state, ...) and a write lock for everything which can be update
304 * without a full modeset (fb, cursor data, ...) 324 * without a full modeset (fb, cursor data, ...)
305 */ 325 */
306 struct mutex mutex; 326 struct drm_modeset_lock mutex;
307 327
308 struct drm_mode_object base; 328 struct drm_mode_object base;
309 329
@@ -400,6 +420,7 @@ struct drm_encoder_funcs {
400 * @dev: parent DRM device 420 * @dev: parent DRM device
401 * @head: list management 421 * @head: list management
402 * @base: base KMS object 422 * @base: base KMS object
423 * @name: encoder name
403 * @encoder_type: one of the %DRM_MODE_ENCODER_<foo> types in drm_mode.h 424 * @encoder_type: one of the %DRM_MODE_ENCODER_<foo> types in drm_mode.h
404 * @possible_crtcs: bitmask of potential CRTC bindings 425 * @possible_crtcs: bitmask of potential CRTC bindings
405 * @possible_clones: bitmask of potential sibling encoders for cloning 426 * @possible_clones: bitmask of potential sibling encoders for cloning
@@ -416,6 +437,7 @@ struct drm_encoder {
416 struct list_head head; 437 struct list_head head;
417 438
418 struct drm_mode_object base; 439 struct drm_mode_object base;
440 char *name;
419 int encoder_type; 441 int encoder_type;
420 uint32_t possible_crtcs; 442 uint32_t possible_crtcs;
421 uint32_t possible_clones; 443 uint32_t possible_clones;
@@ -444,6 +466,7 @@ struct drm_encoder {
444 * @attr: sysfs attributes 466 * @attr: sysfs attributes
445 * @head: list management 467 * @head: list management
446 * @base: base KMS object 468 * @base: base KMS object
469 * @name: connector name
447 * @connector_type: one of the %DRM_MODE_CONNECTOR_<foo> types from drm_mode.h 470 * @connector_type: one of the %DRM_MODE_CONNECTOR_<foo> types from drm_mode.h
448 * @connector_type_id: index into connector type enum 471 * @connector_type_id: index into connector type enum
449 * @interlace_allowed: can this connector handle interlaced modes? 472 * @interlace_allowed: can this connector handle interlaced modes?
@@ -482,6 +505,7 @@ struct drm_connector {
482 505
483 struct drm_mode_object base; 506 struct drm_mode_object base;
484 507
508 char *name;
485 int connector_type; 509 int connector_type;
486 int connector_type_id; 510 int connector_type_id;
487 bool interlace_allowed; 511 bool interlace_allowed;
@@ -723,6 +747,8 @@ struct drm_mode_group {
723 */ 747 */
724struct drm_mode_config { 748struct drm_mode_config {
725 struct mutex mutex; /* protects configuration (mode lists etc.) */ 749 struct mutex mutex; /* protects configuration (mode lists etc.) */
750 struct drm_modeset_lock connection_mutex; /* protects connector->encoder and encoder->crtc links */
751 struct drm_modeset_acquire_ctx *acquire_ctx; /* for legacy _lock_all() / _unlock_all() */
726 struct mutex idr_mutex; /* for IDR management */ 752 struct mutex idr_mutex; /* for IDR management */
727 struct idr crtc_idr; /* use this idr for all IDs, fb, crtc, connector, modes - just makes life easier */ 753 struct idr crtc_idr; /* use this idr for all IDs, fb, crtc, connector, modes - just makes life easier */
728 /* this is limited to one for now */ 754 /* this is limited to one for now */
@@ -823,10 +849,6 @@ struct drm_prop_enum_list {
823 char *name; 849 char *name;
824}; 850};
825 851
826extern void drm_modeset_lock_all(struct drm_device *dev);
827extern void drm_modeset_unlock_all(struct drm_device *dev);
828extern void drm_warn_on_modeset_not_all_locked(struct drm_device *dev);
829
830extern int drm_crtc_init_with_planes(struct drm_device *dev, 852extern int drm_crtc_init_with_planes(struct drm_device *dev,
831 struct drm_crtc *crtc, 853 struct drm_crtc *crtc,
832 struct drm_plane *primary, 854 struct drm_plane *primary,
@@ -905,7 +927,6 @@ extern int drm_crtc_check_viewport(const struct drm_crtc *crtc,
905 927
906extern void drm_encoder_cleanup(struct drm_encoder *encoder); 928extern void drm_encoder_cleanup(struct drm_encoder *encoder);
907 929
908extern const char *drm_get_connector_name(const struct drm_connector *connector);
909extern const char *drm_get_connector_status_name(enum drm_connector_status status); 930extern const char *drm_get_connector_status_name(enum drm_connector_status status);
910extern const char *drm_get_subpixel_order_name(enum subpixel_order order); 931extern const char *drm_get_subpixel_order_name(enum subpixel_order order);
911extern const char *drm_get_dpms_name(int val); 932extern const char *drm_get_dpms_name(int val);
@@ -915,6 +936,7 @@ extern const char *drm_get_tv_subconnector_name(int val);
915extern const char *drm_get_tv_select_name(int val); 936extern const char *drm_get_tv_select_name(int val);
916extern void drm_fb_release(struct drm_file *file_priv); 937extern void drm_fb_release(struct drm_file *file_priv);
917extern int drm_mode_group_init_legacy_group(struct drm_device *dev, struct drm_mode_group *group); 938extern int drm_mode_group_init_legacy_group(struct drm_device *dev, struct drm_mode_group *group);
939extern void drm_mode_group_destroy(struct drm_mode_group *group);
918extern bool drm_probe_ddc(struct i2c_adapter *adapter); 940extern bool drm_probe_ddc(struct i2c_adapter *adapter);
919extern struct edid *drm_get_edid(struct drm_connector *connector, 941extern struct edid *drm_get_edid(struct drm_connector *connector,
920 struct i2c_adapter *adapter); 942 struct i2c_adapter *adapter);
@@ -926,6 +948,23 @@ extern void drm_mode_config_cleanup(struct drm_device *dev);
926 948
927extern int drm_mode_connector_update_edid_property(struct drm_connector *connector, 949extern int drm_mode_connector_update_edid_property(struct drm_connector *connector,
928 struct edid *edid); 950 struct edid *edid);
951
952static inline bool drm_property_type_is(struct drm_property *property,
953 uint32_t type)
954{
955 /* instanceof for props.. handles extended type vs original types: */
956 if (property->flags & DRM_MODE_PROP_EXTENDED_TYPE)
957 return (property->flags & DRM_MODE_PROP_EXTENDED_TYPE) == type;
958 return property->flags & type;
959}
960
961static inline bool drm_property_type_valid(struct drm_property *property)
962{
963 if (property->flags & DRM_MODE_PROP_EXTENDED_TYPE)
964 return !(property->flags & DRM_MODE_PROP_LEGACY_TYPE);
965 return !!(property->flags & DRM_MODE_PROP_LEGACY_TYPE);
966}
967
929extern int drm_object_property_set_value(struct drm_mode_object *obj, 968extern int drm_object_property_set_value(struct drm_mode_object *obj,
930 struct drm_property *property, 969 struct drm_property *property,
931 uint64_t val); 970 uint64_t val);
@@ -959,6 +998,11 @@ struct drm_property *drm_property_create_bitmask(struct drm_device *dev,
959struct drm_property *drm_property_create_range(struct drm_device *dev, int flags, 998struct drm_property *drm_property_create_range(struct drm_device *dev, int flags,
960 const char *name, 999 const char *name,
961 uint64_t min, uint64_t max); 1000 uint64_t min, uint64_t max);
1001struct drm_property *drm_property_create_signed_range(struct drm_device *dev,
1002 int flags, const char *name,
1003 int64_t min, int64_t max);
1004struct drm_property *drm_property_create_object(struct drm_device *dev,
1005 int flags, const char *name, uint32_t type);
962extern void drm_property_destroy(struct drm_device *dev, struct drm_property *property); 1006extern void drm_property_destroy(struct drm_device *dev, struct drm_property *property);
963extern int drm_property_add_enum(struct drm_property *property, int index, 1007extern int drm_property_add_enum(struct drm_property *property, int index,
964 uint64_t value, const char *name); 1008 uint64_t value, const char *name);
@@ -967,7 +1011,6 @@ extern int drm_mode_create_tv_properties(struct drm_device *dev, int num_formats
967 char *formats[]); 1011 char *formats[]);
968extern int drm_mode_create_scaling_mode_property(struct drm_device *dev); 1012extern int drm_mode_create_scaling_mode_property(struct drm_device *dev);
969extern int drm_mode_create_dirty_info_property(struct drm_device *dev); 1013extern int drm_mode_create_dirty_info_property(struct drm_device *dev);
970extern const char *drm_get_encoder_name(const struct drm_encoder *encoder);
971 1014
972extern int drm_mode_connector_attach_encoder(struct drm_connector *connector, 1015extern int drm_mode_connector_attach_encoder(struct drm_connector *connector,
973 struct drm_encoder *encoder); 1016 struct drm_encoder *encoder);
@@ -975,6 +1018,7 @@ extern int drm_mode_crtc_set_gamma_size(struct drm_crtc *crtc,
975 int gamma_size); 1018 int gamma_size);
976extern struct drm_mode_object *drm_mode_object_find(struct drm_device *dev, 1019extern struct drm_mode_object *drm_mode_object_find(struct drm_device *dev,
977 uint32_t id, uint32_t type); 1020 uint32_t id, uint32_t type);
1021
978/* IOCTLs */ 1022/* IOCTLs */
979extern int drm_mode_getresources(struct drm_device *dev, 1023extern int drm_mode_getresources(struct drm_device *dev,
980 void *data, struct drm_file *file_priv); 1024 void *data, struct drm_file *file_priv);
@@ -1020,6 +1064,7 @@ extern int drm_mode_gamma_get_ioctl(struct drm_device *dev,
1020extern int drm_mode_gamma_set_ioctl(struct drm_device *dev, 1064extern int drm_mode_gamma_set_ioctl(struct drm_device *dev,
1021 void *data, struct drm_file *file_priv); 1065 void *data, struct drm_file *file_priv);
1022extern u8 drm_match_cea_mode(const struct drm_display_mode *to_match); 1066extern u8 drm_match_cea_mode(const struct drm_display_mode *to_match);
1067extern enum hdmi_picture_aspect drm_get_cea_aspect_ratio(const u8 video_code);
1023extern bool drm_detect_hdmi_monitor(struct edid *edid); 1068extern bool drm_detect_hdmi_monitor(struct edid *edid);
1024extern bool drm_detect_monitor_audio(struct edid *edid); 1069extern bool drm_detect_monitor_audio(struct edid *edid);
1025extern bool drm_rgb_quant_range_selectable(struct edid *edid); 1070extern bool drm_rgb_quant_range_selectable(struct edid *edid);
@@ -1057,6 +1102,15 @@ extern int drm_format_vert_chroma_subsampling(uint32_t format);
1057extern const char *drm_get_format_name(uint32_t format); 1102extern const char *drm_get_format_name(uint32_t format);
1058 1103
1059/* Helpers */ 1104/* Helpers */
1105
1106static inline struct drm_plane *drm_plane_find(struct drm_device *dev,
1107 uint32_t id)
1108{
1109 struct drm_mode_object *mo;
1110 mo = drm_mode_object_find(dev, id, DRM_MODE_OBJECT_PLANE);
1111 return mo ? obj_to_plane(mo) : NULL;
1112}
1113
1060static inline struct drm_crtc *drm_crtc_find(struct drm_device *dev, 1114static inline struct drm_crtc *drm_crtc_find(struct drm_device *dev,
1061 uint32_t id) 1115 uint32_t id)
1062{ 1116{
@@ -1073,6 +1127,30 @@ static inline struct drm_encoder *drm_encoder_find(struct drm_device *dev,
1073 return mo ? obj_to_encoder(mo) : NULL; 1127 return mo ? obj_to_encoder(mo) : NULL;
1074} 1128}
1075 1129
1130static inline struct drm_connector *drm_connector_find(struct drm_device *dev,
1131 uint32_t id)
1132{
1133 struct drm_mode_object *mo;
1134 mo = drm_mode_object_find(dev, id, DRM_MODE_OBJECT_CONNECTOR);
1135 return mo ? obj_to_connector(mo) : NULL;
1136}
1137
1138static inline struct drm_property *drm_property_find(struct drm_device *dev,
1139 uint32_t id)
1140{
1141 struct drm_mode_object *mo;
1142 mo = drm_mode_object_find(dev, id, DRM_MODE_OBJECT_PROPERTY);
1143 return mo ? obj_to_property(mo) : NULL;
1144}
1145
1146static inline struct drm_property_blob *
1147drm_property_blob_find(struct drm_device *dev, uint32_t id)
1148{
1149 struct drm_mode_object *mo;
1150 mo = drm_mode_object_find(dev, id, DRM_MODE_OBJECT_BLOB);
1151 return mo ? obj_to_blob(mo) : NULL;
1152}
1153
1076/* Plane list iterator for legacy (overlay only) planes. */ 1154/* Plane list iterator for legacy (overlay only) planes. */
1077#define drm_for_each_legacy_plane(plane, planelist) \ 1155#define drm_for_each_legacy_plane(plane, planelist) \
1078 list_for_each_entry(plane, planelist, head) \ 1156 list_for_each_entry(plane, planelist, head) \
diff --git a/include/drm/drm_crtc_helper.h b/include/drm/drm_crtc_helper.h
index 36a5febac2a6..a3d75fefd010 100644
--- a/include/drm/drm_crtc_helper.h
+++ b/include/drm/drm_crtc_helper.h
@@ -114,7 +114,7 @@ struct drm_encoder_helper_funcs {
114/** 114/**
115 * drm_connector_helper_funcs - helper operations for connectors 115 * drm_connector_helper_funcs - helper operations for connectors
116 * @get_modes: get mode list for this connector 116 * @get_modes: get mode list for this connector
117 * @mode_valid: is this mode valid on the given connector? 117 * @mode_valid (optional): is this mode valid on the given connector?
118 * 118 *
119 * The helper operations are called by the mid-layer CRTC helper. 119 * The helper operations are called by the mid-layer CRTC helper.
120 */ 120 */
@@ -165,6 +165,10 @@ extern void drm_helper_resume_force_mode(struct drm_device *dev);
165extern int drm_helper_probe_single_connector_modes(struct drm_connector 165extern int drm_helper_probe_single_connector_modes(struct drm_connector
166 *connector, uint32_t maxX, 166 *connector, uint32_t maxX,
167 uint32_t maxY); 167 uint32_t maxY);
168extern int drm_helper_probe_single_connector_modes_nomerge(struct drm_connector
169 *connector,
170 uint32_t maxX,
171 uint32_t maxY);
168extern void drm_kms_helper_poll_init(struct drm_device *dev); 172extern void drm_kms_helper_poll_init(struct drm_device *dev);
169extern void drm_kms_helper_poll_fini(struct drm_device *dev); 173extern void drm_kms_helper_poll_fini(struct drm_device *dev);
170extern bool drm_helper_hpd_irq_event(struct drm_device *dev); 174extern bool drm_helper_hpd_irq_event(struct drm_device *dev);
diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h
index cfcacec5b89d..a21568bf1514 100644
--- a/include/drm/drm_dp_helper.h
+++ b/include/drm/drm_dp_helper.h
@@ -37,6 +37,7 @@
37 * eDP: Embedded DisplayPort version 1 37 * eDP: Embedded DisplayPort version 1
38 * DPI: DisplayPort Interoperability Guideline v1.1a 38 * DPI: DisplayPort Interoperability Guideline v1.1a
39 * 1.2: DisplayPort 1.2 39 * 1.2: DisplayPort 1.2
40 * MST: Multistream Transport - part of DP 1.2a
40 * 41 *
41 * 1.2 formally includes both eDP and DPI definitions. 42 * 1.2 formally includes both eDP and DPI definitions.
42 */ 43 */
@@ -103,9 +104,14 @@
103#define DP_TRAINING_AUX_RD_INTERVAL 0x00e /* XXX 1.2? */ 104#define DP_TRAINING_AUX_RD_INTERVAL 0x00e /* XXX 1.2? */
104 105
105/* Multiple stream transport */ 106/* Multiple stream transport */
107#define DP_FAUX_CAP 0x020 /* 1.2 */
108# define DP_FAUX_CAP_1 (1 << 0)
109
106#define DP_MSTM_CAP 0x021 /* 1.2 */ 110#define DP_MSTM_CAP 0x021 /* 1.2 */
107# define DP_MST_CAP (1 << 0) 111# define DP_MST_CAP (1 << 0)
108 112
113#define DP_GUID 0x030 /* 1.2 */
114
109#define DP_PSR_SUPPORT 0x070 /* XXX 1.2? */ 115#define DP_PSR_SUPPORT 0x070 /* XXX 1.2? */
110# define DP_PSR_IS_SUPPORTED 1 116# define DP_PSR_IS_SUPPORTED 1
111#define DP_PSR_CAPS 0x071 /* XXX 1.2? */ 117#define DP_PSR_CAPS 0x071 /* XXX 1.2? */
@@ -221,6 +227,16 @@
221# define DP_PSR_CRC_VERIFICATION (1 << 2) 227# define DP_PSR_CRC_VERIFICATION (1 << 2)
222# define DP_PSR_FRAME_CAPTURE (1 << 3) 228# define DP_PSR_FRAME_CAPTURE (1 << 3)
223 229
230#define DP_ADAPTER_CTRL 0x1a0
231# define DP_ADAPTER_CTRL_FORCE_LOAD_SENSE (1 << 0)
232
233#define DP_BRANCH_DEVICE_CTRL 0x1a1
234# define DP_BRANCH_DEVICE_IRQ_HPD (1 << 0)
235
236#define DP_PAYLOAD_ALLOCATE_SET 0x1c0
237#define DP_PAYLOAD_ALLOCATE_START_TIME_SLOT 0x1c1
238#define DP_PAYLOAD_ALLOCATE_TIME_SLOT_COUNT 0x1c2
239
224#define DP_SINK_COUNT 0x200 240#define DP_SINK_COUNT 0x200
225/* prior to 1.2 bit 7 was reserved mbz */ 241/* prior to 1.2 bit 7 was reserved mbz */
226# define DP_GET_SINK_COUNT(x) ((((x) & 0x80) >> 1) | ((x) & 0x3f)) 242# define DP_GET_SINK_COUNT(x) ((((x) & 0x80) >> 1) | ((x) & 0x3f))
@@ -230,6 +246,9 @@
230# define DP_REMOTE_CONTROL_COMMAND_PENDING (1 << 0) 246# define DP_REMOTE_CONTROL_COMMAND_PENDING (1 << 0)
231# define DP_AUTOMATED_TEST_REQUEST (1 << 1) 247# define DP_AUTOMATED_TEST_REQUEST (1 << 1)
232# define DP_CP_IRQ (1 << 2) 248# define DP_CP_IRQ (1 << 2)
249# define DP_MCCS_IRQ (1 << 3)
250# define DP_DOWN_REP_MSG_RDY (1 << 4) /* 1.2 MST */
251# define DP_UP_REQ_MSG_RDY (1 << 5) /* 1.2 MST */
233# define DP_SINK_SPECIFIC_IRQ (1 << 6) 252# define DP_SINK_SPECIFIC_IRQ (1 << 6)
234 253
235#define DP_LANE0_1_STATUS 0x202 254#define DP_LANE0_1_STATUS 0x202
@@ -291,9 +310,18 @@
291# define DP_TEST_NAK (1 << 1) 310# define DP_TEST_NAK (1 << 1)
292# define DP_TEST_EDID_CHECKSUM_WRITE (1 << 2) 311# define DP_TEST_EDID_CHECKSUM_WRITE (1 << 2)
293 312
313#define DP_TEST_EDID_CHECKSUM 0x261
314
294#define DP_TEST_SINK 0x270 315#define DP_TEST_SINK 0x270
295#define DP_TEST_SINK_START (1 << 0) 316#define DP_TEST_SINK_START (1 << 0)
296 317
318#define DP_PAYLOAD_TABLE_UPDATE_STATUS 0x2c0 /* 1.2 MST */
319# define DP_PAYLOAD_TABLE_UPDATED (1 << 0)
320# define DP_PAYLOAD_ACT_HANDLED (1 << 1)
321
322#define DP_VC_PAYLOAD_ID_SLOT_1 0x2c1 /* 1.2 MST */
323/* up to ID_SLOT_63 at 0x2ff */
324
297#define DP_SOURCE_OUI 0x300 325#define DP_SOURCE_OUI 0x300
298#define DP_SINK_OUI 0x400 326#define DP_SINK_OUI 0x400
299#define DP_BRANCH_OUI 0x500 327#define DP_BRANCH_OUI 0x500
@@ -303,6 +331,21 @@
303# define DP_SET_POWER_D3 0x2 331# define DP_SET_POWER_D3 0x2
304# define DP_SET_POWER_MASK 0x3 332# define DP_SET_POWER_MASK 0x3
305 333
334#define DP_SIDEBAND_MSG_DOWN_REQ_BASE 0x1000 /* 1.2 MST */
335#define DP_SIDEBAND_MSG_UP_REP_BASE 0x1200 /* 1.2 MST */
336#define DP_SIDEBAND_MSG_DOWN_REP_BASE 0x1400 /* 1.2 MST */
337#define DP_SIDEBAND_MSG_UP_REQ_BASE 0x1600 /* 1.2 MST */
338
339#define DP_SINK_COUNT_ESI 0x2002 /* 1.2 */
340/* 0-5 sink count */
341# define DP_SINK_COUNT_CP_READY (1 << 6)
342
343#define DP_DEVICE_SERVICE_IRQ_VECTOR_ESI0 0x2003 /* 1.2 */
344
345#define DP_DEVICE_SERVICE_IRQ_VECTOR_ESI1 0x2004 /* 1.2 */
346
347#define DP_LINK_SERVICE_IRQ_VECTOR_ESI0 0x2005 /* 1.2 */
348
306#define DP_PSR_ERROR_STATUS 0x2006 /* XXX 1.2? */ 349#define DP_PSR_ERROR_STATUS 0x2006 /* XXX 1.2? */
307# define DP_PSR_LINK_CRC_ERROR (1 << 0) 350# define DP_PSR_LINK_CRC_ERROR (1 << 0)
308# define DP_PSR_RFB_STORAGE_ERROR (1 << 1) 351# define DP_PSR_RFB_STORAGE_ERROR (1 << 1)
@@ -319,6 +362,43 @@
319# define DP_PSR_SINK_INTERNAL_ERROR 7 362# define DP_PSR_SINK_INTERNAL_ERROR 7
320# define DP_PSR_SINK_STATE_MASK 0x07 363# define DP_PSR_SINK_STATE_MASK 0x07
321 364
365/* DP 1.2 Sideband message defines */
366/* peer device type - DP 1.2a Table 2-92 */
367#define DP_PEER_DEVICE_NONE 0x0
368#define DP_PEER_DEVICE_SOURCE_OR_SST 0x1
369#define DP_PEER_DEVICE_MST_BRANCHING 0x2
370#define DP_PEER_DEVICE_SST_SINK 0x3
371#define DP_PEER_DEVICE_DP_LEGACY_CONV 0x4
372
373/* DP 1.2 MST sideband request names DP 1.2a Table 2-80 */
374#define DP_LINK_ADDRESS 0x01
375#define DP_CONNECTION_STATUS_NOTIFY 0x02
376#define DP_ENUM_PATH_RESOURCES 0x10
377#define DP_ALLOCATE_PAYLOAD 0x11
378#define DP_QUERY_PAYLOAD 0x12
379#define DP_RESOURCE_STATUS_NOTIFY 0x13
380#define DP_CLEAR_PAYLOAD_ID_TABLE 0x14
381#define DP_REMOTE_DPCD_READ 0x20
382#define DP_REMOTE_DPCD_WRITE 0x21
383#define DP_REMOTE_I2C_READ 0x22
384#define DP_REMOTE_I2C_WRITE 0x23
385#define DP_POWER_UP_PHY 0x24
386#define DP_POWER_DOWN_PHY 0x25
387#define DP_SINK_EVENT_NOTIFY 0x30
388#define DP_QUERY_STREAM_ENC_STATUS 0x38
389
390/* DP 1.2 MST sideband nak reasons - table 2.84 */
391#define DP_NAK_WRITE_FAILURE 0x01
392#define DP_NAK_INVALID_READ 0x02
393#define DP_NAK_CRC_FAILURE 0x03
394#define DP_NAK_BAD_PARAM 0x04
395#define DP_NAK_DEFER 0x05
396#define DP_NAK_LINK_FAILURE 0x06
397#define DP_NAK_NO_RESOURCES 0x07
398#define DP_NAK_DPCD_FAIL 0x08
399#define DP_NAK_I2C_NAK 0x09
400#define DP_NAK_ALLOCATE_FAIL 0x0a
401
322#define MODE_I2C_START 1 402#define MODE_I2C_START 1
323#define MODE_I2C_WRITE 2 403#define MODE_I2C_WRITE 2
324#define MODE_I2C_READ 4 404#define MODE_I2C_READ 4
@@ -431,8 +511,10 @@ struct drm_dp_aux_msg {
431 511
432/** 512/**
433 * struct drm_dp_aux - DisplayPort AUX channel 513 * struct drm_dp_aux - DisplayPort AUX channel
514 * @name: user-visible name of this AUX channel and the I2C-over-AUX adapter
434 * @ddc: I2C adapter that can be used for I2C-over-AUX communication 515 * @ddc: I2C adapter that can be used for I2C-over-AUX communication
435 * @dev: pointer to struct device that is the parent for this AUX channel 516 * @dev: pointer to struct device that is the parent for this AUX channel
517 * @hw_mutex: internal mutex used for locking transfers
436 * @transfer: transfers a message representing a single AUX transaction 518 * @transfer: transfers a message representing a single AUX transaction
437 * 519 *
438 * The .dev field should be set to a pointer to the device that implements 520 * The .dev field should be set to a pointer to the device that implements
@@ -465,7 +547,7 @@ struct drm_dp_aux {
465 const char *name; 547 const char *name;
466 struct i2c_adapter ddc; 548 struct i2c_adapter ddc;
467 struct device *dev; 549 struct device *dev;
468 550 struct mutex hw_mutex;
469 ssize_t (*transfer)(struct drm_dp_aux *aux, 551 ssize_t (*transfer)(struct drm_dp_aux *aux,
470 struct drm_dp_aux_msg *msg); 552 struct drm_dp_aux_msg *msg);
471}; 553};
@@ -524,7 +606,7 @@ int drm_dp_link_probe(struct drm_dp_aux *aux, struct drm_dp_link *link);
524int drm_dp_link_power_up(struct drm_dp_aux *aux, struct drm_dp_link *link); 606int drm_dp_link_power_up(struct drm_dp_aux *aux, struct drm_dp_link *link);
525int drm_dp_link_configure(struct drm_dp_aux *aux, struct drm_dp_link *link); 607int drm_dp_link_configure(struct drm_dp_aux *aux, struct drm_dp_link *link);
526 608
527int drm_dp_aux_register_i2c_bus(struct drm_dp_aux *aux); 609int drm_dp_aux_register(struct drm_dp_aux *aux);
528void drm_dp_aux_unregister_i2c_bus(struct drm_dp_aux *aux); 610void drm_dp_aux_unregister(struct drm_dp_aux *aux);
529 611
530#endif /* _DRM_DP_HELPER_H_ */ 612#endif /* _DRM_DP_HELPER_H_ */
diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h
index a1441c5ac63d..b96031d947a0 100644
--- a/include/drm/drm_edid.h
+++ b/include/drm/drm_edid.h
@@ -202,6 +202,11 @@ struct detailed_timing {
202#define DRM_EDID_FEATURE_PM_SUSPEND (1 << 6) 202#define DRM_EDID_FEATURE_PM_SUSPEND (1 << 6)
203#define DRM_EDID_FEATURE_PM_STANDBY (1 << 7) 203#define DRM_EDID_FEATURE_PM_STANDBY (1 << 7)
204 204
205#define DRM_EDID_HDMI_DC_48 (1 << 6)
206#define DRM_EDID_HDMI_DC_36 (1 << 5)
207#define DRM_EDID_HDMI_DC_30 (1 << 4)
208#define DRM_EDID_HDMI_DC_Y444 (1 << 3)
209
205struct edid { 210struct edid {
206 u8 header[8]; 211 u8 header[8];
207 /* Vendor & product info */ 212 /* Vendor & product info */
diff --git a/include/drm/drm_fb_helper.h b/include/drm/drm_fb_helper.h
index 6e622f7d481d..7997246d4039 100644
--- a/include/drm/drm_fb_helper.h
+++ b/include/drm/drm_fb_helper.h
@@ -108,7 +108,7 @@ int drm_fb_helper_set_par(struct fb_info *info);
108int drm_fb_helper_check_var(struct fb_var_screeninfo *var, 108int drm_fb_helper_check_var(struct fb_var_screeninfo *var,
109 struct fb_info *info); 109 struct fb_info *info);
110 110
111bool drm_fb_helper_restore_fbdev_mode(struct drm_fb_helper *fb_helper); 111bool drm_fb_helper_restore_fbdev_mode_unlocked(struct drm_fb_helper *fb_helper);
112void drm_fb_helper_fill_var(struct fb_info *info, struct drm_fb_helper *fb_helper, 112void drm_fb_helper_fill_var(struct fb_info *info, struct drm_fb_helper *fb_helper,
113 uint32_t fb_width, uint32_t fb_height); 113 uint32_t fb_width, uint32_t fb_height);
114void drm_fb_helper_fill_fix(struct fb_info *info, uint32_t pitch, 114void drm_fb_helper_fill_fix(struct fb_info *info, uint32_t pitch,
diff --git a/include/drm/drm_flip_work.h b/include/drm/drm_flip_work.h
index 35c776ae7d3b..9eed34dcd6af 100644
--- a/include/drm/drm_flip_work.h
+++ b/include/drm/drm_flip_work.h
@@ -57,6 +57,7 @@ typedef void (*drm_flip_func_t)(struct drm_flip_work *work, void *val);
57 * @count: number of committed items 57 * @count: number of committed items
58 * @func: callback fxn called for each committed item 58 * @func: callback fxn called for each committed item
59 * @worker: worker which calls @func 59 * @worker: worker which calls @func
60 * @fifo: queue of committed items
60 */ 61 */
61struct drm_flip_work { 62struct drm_flip_work {
62 const char *name; 63 const char *name;
diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h
index 7209df15a3cd..944f33f8ba38 100644
--- a/include/drm/drm_mipi_dsi.h
+++ b/include/drm/drm_mipi_dsi.h
@@ -135,11 +135,13 @@ ssize_t mipi_dsi_dcs_read(struct mipi_dsi_device *dsi, unsigned int channel,
135 * @driver: device driver model driver 135 * @driver: device driver model driver
136 * @probe: callback for device binding 136 * @probe: callback for device binding
137 * @remove: callback for device unbinding 137 * @remove: callback for device unbinding
138 * @shutdown: called at shutdown time to quiesce the device
138 */ 139 */
139struct mipi_dsi_driver { 140struct mipi_dsi_driver {
140 struct device_driver driver; 141 struct device_driver driver;
141 int(*probe)(struct mipi_dsi_device *dsi); 142 int(*probe)(struct mipi_dsi_device *dsi);
142 int(*remove)(struct mipi_dsi_device *dsi); 143 int(*remove)(struct mipi_dsi_device *dsi);
144 void (*shutdown)(struct mipi_dsi_device *dsi);
143}; 145};
144 146
145#define to_mipi_dsi_driver(d) container_of(d, struct mipi_dsi_driver, driver) 147#define to_mipi_dsi_driver(d) container_of(d, struct mipi_dsi_driver, driver)
diff --git a/include/drm/drm_modes.h b/include/drm/drm_modes.h
index 2dbbf9976669..91d0582f924e 100644
--- a/include/drm/drm_modes.h
+++ b/include/drm/drm_modes.h
@@ -223,7 +223,7 @@ void drm_mode_validate_size(struct drm_device *dev,
223void drm_mode_prune_invalid(struct drm_device *dev, 223void drm_mode_prune_invalid(struct drm_device *dev,
224 struct list_head *mode_list, bool verbose); 224 struct list_head *mode_list, bool verbose);
225void drm_mode_sort(struct list_head *mode_list); 225void drm_mode_sort(struct list_head *mode_list);
226void drm_mode_connector_list_update(struct drm_connector *connector); 226void drm_mode_connector_list_update(struct drm_connector *connector, bool merge_type_bits);
227 227
228/* parsing cmdline modes */ 228/* parsing cmdline modes */
229bool 229bool
diff --git a/include/drm/drm_modeset_lock.h b/include/drm/drm_modeset_lock.h
new file mode 100644
index 000000000000..402aa7a6a058
--- /dev/null
+++ b/include/drm/drm_modeset_lock.h
@@ -0,0 +1,126 @@
1/*
2 * Copyright (C) 2014 Red Hat
3 * Author: Rob Clark <robdclark@gmail.com>
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
19 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
20 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
21 * OTHER DEALINGS IN THE SOFTWARE.
22 */
23
24#ifndef DRM_MODESET_LOCK_H_
25#define DRM_MODESET_LOCK_H_
26
27#include <linux/ww_mutex.h>
28
29struct drm_modeset_lock;
30
31/**
32 * drm_modeset_acquire_ctx - locking context (see ww_acquire_ctx)
33 * @ww_ctx: base acquire ctx
34 * @contended: used internally for -EDEADLK handling
35 * @locked: list of held locks
36 *
37 * Each thread competing for a set of locks must use one acquire
38 * ctx. And if any lock fxn returns -EDEADLK, it must backoff and
39 * retry.
40 */
41struct drm_modeset_acquire_ctx {
42
43 struct ww_acquire_ctx ww_ctx;
44
45 /**
46 * Contended lock: if a lock is contended you should only call
47 * drm_modeset_backoff() which drops locks and slow-locks the
48 * contended lock.
49 */
50 struct drm_modeset_lock *contended;
51
52 /**
53 * list of held locks (drm_modeset_lock)
54 */
55 struct list_head locked;
56};
57
58/**
59 * drm_modeset_lock - used for locking modeset resources.
60 * @mutex: resource locking
61 * @head: used to hold it's place on state->locked list when
62 * part of an atomic update
63 *
64 * Used for locking CRTCs and other modeset resources.
65 */
66struct drm_modeset_lock {
67 /**
68 * modeset lock
69 */
70 struct ww_mutex mutex;
71
72 /**
73 * Resources that are locked as part of an atomic update are added
74 * to a list (so we know what to unlock at the end).
75 */
76 struct list_head head;
77};
78
79extern struct ww_class crtc_ww_class;
80
81void drm_modeset_acquire_init(struct drm_modeset_acquire_ctx *ctx,
82 uint32_t flags);
83void drm_modeset_acquire_fini(struct drm_modeset_acquire_ctx *ctx);
84void drm_modeset_drop_locks(struct drm_modeset_acquire_ctx *ctx);
85void drm_modeset_backoff(struct drm_modeset_acquire_ctx *ctx);
86int drm_modeset_backoff_interruptible(struct drm_modeset_acquire_ctx *ctx);
87
88/**
89 * drm_modeset_lock_init - initialize lock
90 * @lock: lock to init
91 */
92static inline void drm_modeset_lock_init(struct drm_modeset_lock *lock)
93{
94 ww_mutex_init(&lock->mutex, &crtc_ww_class);
95 INIT_LIST_HEAD(&lock->head);
96}
97
98/**
99 * drm_modeset_lock_fini - cleanup lock
100 * @lock: lock to cleanup
101 */
102static inline void drm_modeset_lock_fini(struct drm_modeset_lock *lock)
103{
104 WARN_ON(!list_empty(&lock->head));
105}
106
107/**
108 * drm_modeset_is_locked - equivalent to mutex_is_locked()
109 * @lock: lock to check
110 */
111static inline bool drm_modeset_is_locked(struct drm_modeset_lock *lock)
112{
113 return ww_mutex_is_locked(&lock->mutex);
114}
115
116int drm_modeset_lock(struct drm_modeset_lock *lock,
117 struct drm_modeset_acquire_ctx *ctx);
118int drm_modeset_lock_interruptible(struct drm_modeset_lock *lock,
119 struct drm_modeset_acquire_ctx *ctx);
120void drm_modeset_unlock(struct drm_modeset_lock *lock);
121
122struct drm_device;
123int drm_modeset_lock_all_crtcs(struct drm_device *dev,
124 struct drm_modeset_acquire_ctx *ctx);
125
126#endif /* DRM_MODESET_LOCK_H_ */
diff --git a/include/drm/drm_plane_helper.h b/include/drm/drm_plane_helper.h
index 09824becee3e..52e6870534b2 100644
--- a/include/drm/drm_plane_helper.h
+++ b/include/drm/drm_plane_helper.h
@@ -24,6 +24,17 @@
24#ifndef DRM_PLANE_HELPER_H 24#ifndef DRM_PLANE_HELPER_H
25#define DRM_PLANE_HELPER_H 25#define DRM_PLANE_HELPER_H
26 26
27#include <drm/drm_rect.h>
28
29/*
30 * Drivers that don't allow primary plane scaling may pass this macro in place
31 * of the min/max scale parameters of the update checker function.
32 *
33 * Due to src being in 16.16 fixed point and dest being in integer pixels,
34 * 1<<16 represents no scaling.
35 */
36#define DRM_PLANE_HELPER_NO_SCALING (1<<16)
37
27/** 38/**
28 * DOC: plane helpers 39 * DOC: plane helpers
29 * 40 *
@@ -31,6 +42,17 @@
31 * planes. 42 * planes.
32 */ 43 */
33 44
45extern int drm_plane_helper_check_update(struct drm_plane *plane,
46 struct drm_crtc *crtc,
47 struct drm_framebuffer *fb,
48 struct drm_rect *src,
49 struct drm_rect *dest,
50 const struct drm_rect *clip,
51 int min_scale,
52 int max_scale,
53 bool can_position,
54 bool can_update_disabled,
55 bool *visible);
34extern int drm_primary_helper_update(struct drm_plane *plane, 56extern int drm_primary_helper_update(struct drm_plane *plane,
35 struct drm_crtc *crtc, 57 struct drm_crtc *crtc,
36 struct drm_framebuffer *fb, 58 struct drm_framebuffer *fb,
@@ -42,7 +64,7 @@ extern int drm_primary_helper_disable(struct drm_plane *plane);
42extern void drm_primary_helper_destroy(struct drm_plane *plane); 64extern void drm_primary_helper_destroy(struct drm_plane *plane);
43extern const struct drm_plane_funcs drm_primary_helper_funcs; 65extern const struct drm_plane_funcs drm_primary_helper_funcs;
44extern struct drm_plane *drm_primary_helper_create_plane(struct drm_device *dev, 66extern struct drm_plane *drm_primary_helper_create_plane(struct drm_device *dev,
45 uint32_t *formats, 67 const uint32_t *formats,
46 int num_formats); 68 int num_formats);
47 69
48 70
diff --git a/include/drm/i915_pciids.h b/include/drm/i915_pciids.h
index 012d58fa8ff0..a70d45647898 100644
--- a/include/drm/i915_pciids.h
+++ b/include/drm/i915_pciids.h
@@ -223,14 +223,40 @@
223 _INTEL_BDW_D(gt, 0x160A, info), /* Server */ \ 223 _INTEL_BDW_D(gt, 0x160A, info), /* Server */ \
224 _INTEL_BDW_D(gt, 0x160D, info) /* Workstation */ 224 _INTEL_BDW_D(gt, 0x160D, info) /* Workstation */
225 225
226#define INTEL_BDW_M_IDS(info) \ 226#define INTEL_BDW_GT12M_IDS(info) \
227 _INTEL_BDW_M_IDS(1, info), \ 227 _INTEL_BDW_M_IDS(1, info), \
228 _INTEL_BDW_M_IDS(2, info), \ 228 _INTEL_BDW_M_IDS(2, info)
229 _INTEL_BDW_M_IDS(3, info)
230 229
231#define INTEL_BDW_D_IDS(info) \ 230#define INTEL_BDW_GT12D_IDS(info) \
232 _INTEL_BDW_D_IDS(1, info), \ 231 _INTEL_BDW_D_IDS(1, info), \
233 _INTEL_BDW_D_IDS(2, info), \ 232 _INTEL_BDW_D_IDS(2, info)
233
234#define INTEL_BDW_GT3M_IDS(info) \
235 _INTEL_BDW_M_IDS(3, info)
236
237#define INTEL_BDW_GT3D_IDS(info) \
234 _INTEL_BDW_D_IDS(3, info) 238 _INTEL_BDW_D_IDS(3, info)
235 239
240#define INTEL_BDW_RSVDM_IDS(info) \
241 _INTEL_BDW_M_IDS(4, info)
242
243#define INTEL_BDW_RSVDD_IDS(info) \
244 _INTEL_BDW_D_IDS(4, info)
245
246#define INTEL_BDW_M_IDS(info) \
247 INTEL_BDW_GT12M_IDS(info), \
248 INTEL_BDW_GT3M_IDS(info), \
249 INTEL_BDW_RSVDM_IDS(info)
250
251#define INTEL_BDW_D_IDS(info) \
252 INTEL_BDW_GT12D_IDS(info), \
253 INTEL_BDW_GT3D_IDS(info), \
254 INTEL_BDW_RSVDD_IDS(info)
255
256#define INTEL_CHV_IDS(info) \
257 INTEL_VGA_DEVICE(0x22b0, info), \
258 INTEL_VGA_DEVICE(0x22b1, info), \
259 INTEL_VGA_DEVICE(0x22b2, info), \
260 INTEL_VGA_DEVICE(0x22b3, info)
261
236#endif /* _I915_PCIIDS_H */ 262#endif /* _I915_PCIIDS_H */
diff --git a/include/drm/i915_powerwell.h b/include/drm/i915_powerwell.h
index cfdc884405b7..baa6f11b1837 100644
--- a/include/drm/i915_powerwell.h
+++ b/include/drm/i915_powerwell.h
@@ -30,7 +30,8 @@
30#define _I915_POWERWELL_H_ 30#define _I915_POWERWELL_H_
31 31
32/* For use by hda_i915 driver */ 32/* For use by hda_i915 driver */
33extern void i915_request_power_well(void); 33extern int i915_request_power_well(void);
34extern void i915_release_power_well(void); 34extern int i915_release_power_well(void);
35extern int i915_get_cdclk_freq(void);
35 36
36#endif /* _I915_POWERWELL_H_ */ 37#endif /* _I915_POWERWELL_H_ */
diff --git a/include/drm/ttm/ttm_bo_api.h b/include/drm/ttm/ttm_bo_api.h
index ee127ec33c60..7526c5bf5610 100644
--- a/include/drm/ttm/ttm_bo_api.h
+++ b/include/drm/ttm/ttm_bo_api.h
@@ -485,13 +485,12 @@ extern int ttm_bo_init(struct ttm_bo_device *bdev,
485 void (*destroy) (struct ttm_buffer_object *)); 485 void (*destroy) (struct ttm_buffer_object *));
486 486
487/** 487/**
488 * ttm_bo_synccpu_object_init 488 * ttm_bo_create
489 * 489 *
490 * @bdev: Pointer to a ttm_bo_device struct. 490 * @bdev: Pointer to a ttm_bo_device struct.
491 * @bo: Pointer to a ttm_buffer_object to be initialized.
492 * @size: Requested size of buffer object. 491 * @size: Requested size of buffer object.
493 * @type: Requested type of buffer object. 492 * @type: Requested type of buffer object.
494 * @flags: Initial placement flags. 493 * @placement: Initial placement.
495 * @page_alignment: Data alignment in pages. 494 * @page_alignment: Data alignment in pages.
496 * @interruptible: If needing to sleep while waiting for GPU resources, 495 * @interruptible: If needing to sleep while waiting for GPU resources,
497 * sleep interruptible. 496 * sleep interruptible.
diff --git a/include/dt-bindings/clk/ti-dra7-atl.h b/include/dt-bindings/clk/ti-dra7-atl.h
new file mode 100644
index 000000000000..42dd4164f6f4
--- /dev/null
+++ b/include/dt-bindings/clk/ti-dra7-atl.h
@@ -0,0 +1,40 @@
1/*
2 * This header provides constants for DRA7 ATL (Audio Tracking Logic)
3 *
4 * The constants defined in this header are used in dts files
5 *
6 * Copyright (C) 2013 Texas Instruments, Inc.
7 *
8 * Peter Ujfalusi <peter.ujfalusi@ti.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 *
14 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
15 * kind, whether express or implied; without even the implied warranty
16 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 */
19
20#ifndef _DT_BINDINGS_CLK_DRA7_ATL_H
21#define _DT_BINDINGS_CLK_DRA7_ATL_H
22
23#define DRA7_ATL_WS_MCASP1_FSR 0
24#define DRA7_ATL_WS_MCASP1_FSX 1
25#define DRA7_ATL_WS_MCASP2_FSR 2
26#define DRA7_ATL_WS_MCASP2_FSX 3
27#define DRA7_ATL_WS_MCASP3_FSX 4
28#define DRA7_ATL_WS_MCASP4_FSX 5
29#define DRA7_ATL_WS_MCASP5_FSX 6
30#define DRA7_ATL_WS_MCASP6_FSX 7
31#define DRA7_ATL_WS_MCASP7_FSX 8
32#define DRA7_ATL_WS_MCASP8_FSX 9
33#define DRA7_ATL_WS_MCASP8_AHCLKX 10
34#define DRA7_ATL_WS_XREF_CLK3 11
35#define DRA7_ATL_WS_XREF_CLK0 12
36#define DRA7_ATL_WS_XREF_CLK1 13
37#define DRA7_ATL_WS_XREF_CLK2 14
38#define DRA7_ATL_WS_OSC1_X1 15
39
40#endif
diff --git a/include/dt-bindings/clock/bcm21664.h b/include/dt-bindings/clock/bcm21664.h
new file mode 100644
index 000000000000..5a7f0e4750a8
--- /dev/null
+++ b/include/dt-bindings/clock/bcm21664.h
@@ -0,0 +1,62 @@
1/*
2 * Copyright (C) 2013 Broadcom Corporation
3 * Copyright 2013 Linaro Limited
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation version 2.
8 *
9 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
10 * kind, whether express or implied; without even the implied warranty
11 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14
15#ifndef _CLOCK_BCM21664_H
16#define _CLOCK_BCM21664_H
17
18/*
19 * This file defines the values used to specify clocks provided by
20 * the clock control units (CCUs) on Broadcom BCM21664 family SoCs.
21 */
22
23/* bcm21664 CCU device tree "compatible" strings */
24#define BCM21664_DT_ROOT_CCU_COMPAT "brcm,bcm21664-root-ccu"
25#define BCM21664_DT_AON_CCU_COMPAT "brcm,bcm21664-aon-ccu"
26#define BCM21664_DT_MASTER_CCU_COMPAT "brcm,bcm21664-master-ccu"
27#define BCM21664_DT_SLAVE_CCU_COMPAT "brcm,bcm21664-slave-ccu"
28
29/* root CCU clock ids */
30
31#define BCM21664_ROOT_CCU_FRAC_1M 0
32#define BCM21664_ROOT_CCU_CLOCK_COUNT 1
33
34/* aon CCU clock ids */
35
36#define BCM21664_AON_CCU_HUB_TIMER 0
37#define BCM21664_AON_CCU_CLOCK_COUNT 1
38
39/* master CCU clock ids */
40
41#define BCM21664_MASTER_CCU_SDIO1 0
42#define BCM21664_MASTER_CCU_SDIO2 1
43#define BCM21664_MASTER_CCU_SDIO3 2
44#define BCM21664_MASTER_CCU_SDIO4 3
45#define BCM21664_MASTER_CCU_SDIO1_SLEEP 4
46#define BCM21664_MASTER_CCU_SDIO2_SLEEP 5
47#define BCM21664_MASTER_CCU_SDIO3_SLEEP 6
48#define BCM21664_MASTER_CCU_SDIO4_SLEEP 7
49#define BCM21664_MASTER_CCU_CLOCK_COUNT 8
50
51/* slave CCU clock ids */
52
53#define BCM21664_SLAVE_CCU_UARTB 0
54#define BCM21664_SLAVE_CCU_UARTB2 1
55#define BCM21664_SLAVE_CCU_UARTB3 2
56#define BCM21664_SLAVE_CCU_BSC1 3
57#define BCM21664_SLAVE_CCU_BSC2 4
58#define BCM21664_SLAVE_CCU_BSC3 5
59#define BCM21664_SLAVE_CCU_BSC4 6
60#define BCM21664_SLAVE_CCU_CLOCK_COUNT 7
61
62#endif /* _CLOCK_BCM21664_H */
diff --git a/include/dt-bindings/clock/bcm281xx.h b/include/dt-bindings/clock/bcm281xx.h
index e0096940886d..a763460cf1af 100644
--- a/include/dt-bindings/clock/bcm281xx.h
+++ b/include/dt-bindings/clock/bcm281xx.h
@@ -20,6 +20,18 @@
20 * the clock control units (CCUs) on Broadcom BCM281XX family SoCs. 20 * the clock control units (CCUs) on Broadcom BCM281XX family SoCs.
21 */ 21 */
22 22
23/*
24 * These are the bcm281xx CCU device tree "compatible" strings.
25 * We're stuck with using "bcm11351" in the string because wild
26 * cards aren't allowed, and that name was the first one defined
27 * in this family of devices.
28 */
29#define BCM281XX_DT_ROOT_CCU_COMPAT "brcm,bcm11351-root-ccu"
30#define BCM281XX_DT_AON_CCU_COMPAT "brcm,bcm11351-aon-ccu"
31#define BCM281XX_DT_HUB_CCU_COMPAT "brcm,bcm11351-hub-ccu"
32#define BCM281XX_DT_MASTER_CCU_COMPAT "brcm,bcm11351-master-ccu"
33#define BCM281XX_DT_SLAVE_CCU_COMPAT "brcm,bcm11351-slave-ccu"
34
23/* root CCU clock ids */ 35/* root CCU clock ids */
24 36
25#define BCM281XX_ROOT_CCU_FRAC_1M 0 37#define BCM281XX_ROOT_CCU_FRAC_1M 0
diff --git a/include/dt-bindings/clock/berlin2.h b/include/dt-bindings/clock/berlin2.h
new file mode 100644
index 000000000000..0c30800175df
--- /dev/null
+++ b/include/dt-bindings/clock/berlin2.h
@@ -0,0 +1,45 @@
1/*
2 * Berlin2 BG2/BG2CD clock tree IDs
3 */
4
5#define CLKID_SYS 0
6#define CLKID_CPU 1
7#define CLKID_DRMFIGO 2
8#define CLKID_CFG 3
9#define CLKID_GFX 4
10#define CLKID_ZSP 5
11#define CLKID_PERIF 6
12#define CLKID_PCUBE 7
13#define CLKID_VSCOPE 8
14#define CLKID_NFC_ECC 9
15#define CLKID_VPP 10
16#define CLKID_APP 11
17#define CLKID_AUDIO0 12
18#define CLKID_AUDIO2 13
19#define CLKID_AUDIO3 14
20#define CLKID_AUDIO1 15
21#define CLKID_GFX3D_CORE 16
22#define CLKID_GFX3D_SYS 17
23#define CLKID_ARC 18
24#define CLKID_VIP 19
25#define CLKID_SDIO0XIN 20
26#define CLKID_SDIO1XIN 21
27#define CLKID_GFX3D_EXTRA 22
28#define CLKID_GC360 23
29#define CLKID_SDIO_DLLMST 24
30#define CLKID_GETH0 25
31#define CLKID_GETH1 26
32#define CLKID_SATA 27
33#define CLKID_AHBAPB 28
34#define CLKID_USB0 29
35#define CLKID_USB1 30
36#define CLKID_PBRIDGE 31
37#define CLKID_SDIO0 32
38#define CLKID_SDIO1 33
39#define CLKID_NFC 34
40#define CLKID_SMEMC 35
41#define CLKID_AUDIOHD 36
42#define CLKID_VIDEO0 37
43#define CLKID_VIDEO1 38
44#define CLKID_VIDEO2 39
45#define CLKID_TWD 40
diff --git a/include/dt-bindings/clock/berlin2q.h b/include/dt-bindings/clock/berlin2q.h
new file mode 100644
index 000000000000..287fc3b4afb2
--- /dev/null
+++ b/include/dt-bindings/clock/berlin2q.h
@@ -0,0 +1,31 @@
1/*
2 * Berlin2 BG2Q clock tree IDs
3 */
4
5#define CLKID_SYS 0
6#define CLKID_DRMFIGO 1
7#define CLKID_CFG 2
8#define CLKID_GFX2D 3
9#define CLKID_ZSP 4
10#define CLKID_PERIF 5
11#define CLKID_PCUBE 6
12#define CLKID_VSCOPE 7
13#define CLKID_NFC_ECC 8
14#define CLKID_VPP 9
15#define CLKID_APP 10
16#define CLKID_SDIO0XIN 11
17#define CLKID_SDIO1XIN 12
18#define CLKID_GFX2DAXI 13
19#define CLKID_GETH0 14
20#define CLKID_SATA 15
21#define CLKID_AHBAPB 16
22#define CLKID_USB0 17
23#define CLKID_USB1 18
24#define CLKID_USB2 19
25#define CLKID_USB3 20
26#define CLKID_PBRIDGE 21
27#define CLKID_SDIO 22
28#define CLKID_NFC 23
29#define CLKID_SMEMC 24
30#define CLKID_PCIE 25
31#define CLKID_TWD 26
diff --git a/include/dt-bindings/clock/exynos3250.h b/include/dt-bindings/clock/exynos3250.h
new file mode 100644
index 000000000000..b535e9da7de6
--- /dev/null
+++ b/include/dt-bindings/clock/exynos3250.h
@@ -0,0 +1,258 @@
1/*
2 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
3 * Author: Tomasz Figa <t.figa@samsung.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 *
9 * Device Tree binding constants for Samsung Exynos3250 clock controllers.
10 */
11
12#ifndef _DT_BINDINGS_CLOCK_SAMSUNG_EXYNOS3250_CLOCK_H
13#define _DT_BINDINGS_CLOCK_SAMSUNG_EXYNOS3250_CLOCK_H
14
15/*
16 * Let each exported clock get a unique index, which is used on DT-enabled
17 * platforms to lookup the clock from a clock specifier. These indices are
18 * therefore considered an ABI and so must not be changed. This implies
19 * that new clocks should be added either in free spaces between clock groups
20 * or at the end.
21 */
22
23
24/*
25 * Main CMU
26 */
27
28#define CLK_OSCSEL 1
29#define CLK_FIN_PLL 2
30#define CLK_FOUT_APLL 3
31#define CLK_FOUT_VPLL 4
32#define CLK_FOUT_UPLL 5
33#define CLK_FOUT_MPLL 6
34
35/* Muxes */
36#define CLK_MOUT_MPLL_USER_L 16
37#define CLK_MOUT_GDL 17
38#define CLK_MOUT_MPLL_USER_R 18
39#define CLK_MOUT_GDR 19
40#define CLK_MOUT_EBI 20
41#define CLK_MOUT_ACLK_200 21
42#define CLK_MOUT_ACLK_160 22
43#define CLK_MOUT_ACLK_100 23
44#define CLK_MOUT_ACLK_266_1 24
45#define CLK_MOUT_ACLK_266_0 25
46#define CLK_MOUT_ACLK_266 26
47#define CLK_MOUT_VPLL 27
48#define CLK_MOUT_EPLL_USER 28
49#define CLK_MOUT_EBI_1 29
50#define CLK_MOUT_UPLL 30
51#define CLK_MOUT_ACLK_400_MCUISP_SUB 31
52#define CLK_MOUT_MPLL 32
53#define CLK_MOUT_ACLK_400_MCUISP 33
54#define CLK_MOUT_VPLLSRC 34
55#define CLK_MOUT_CAM1 35
56#define CLK_MOUT_CAM_BLK 36
57#define CLK_MOUT_MFC 37
58#define CLK_MOUT_MFC_1 38
59#define CLK_MOUT_MFC_0 39
60#define CLK_MOUT_G3D 40
61#define CLK_MOUT_G3D_1 41
62#define CLK_MOUT_G3D_0 42
63#define CLK_MOUT_MIPI0 43
64#define CLK_MOUT_FIMD0 44
65#define CLK_MOUT_UART_ISP 45
66#define CLK_MOUT_SPI1_ISP 46
67#define CLK_MOUT_SPI0_ISP 47
68#define CLK_MOUT_TSADC 48
69#define CLK_MOUT_MMC1 49
70#define CLK_MOUT_MMC0 50
71#define CLK_MOUT_UART1 51
72#define CLK_MOUT_UART0 52
73#define CLK_MOUT_SPI1 53
74#define CLK_MOUT_SPI0 54
75#define CLK_MOUT_AUDIO 55
76#define CLK_MOUT_MPLL_USER_C 56
77#define CLK_MOUT_HPM 57
78#define CLK_MOUT_CORE 58
79#define CLK_MOUT_APLL 59
80#define CLK_MOUT_ACLK_266_SUB 60
81
82/* Dividers */
83#define CLK_DIV_GPL 64
84#define CLK_DIV_GDL 65
85#define CLK_DIV_GPR 66
86#define CLK_DIV_GDR 67
87#define CLK_DIV_MPLL_PRE 68
88#define CLK_DIV_ACLK_400_MCUISP 69
89#define CLK_DIV_EBI 70
90#define CLK_DIV_ACLK_200 71
91#define CLK_DIV_ACLK_160 72
92#define CLK_DIV_ACLK_100 73
93#define CLK_DIV_ACLK_266 74
94#define CLK_DIV_CAM1 75
95#define CLK_DIV_CAM_BLK 76
96#define CLK_DIV_MFC 77
97#define CLK_DIV_G3D 78
98#define CLK_DIV_MIPI0_PRE 79
99#define CLK_DIV_MIPI0 80
100#define CLK_DIV_FIMD0 81
101#define CLK_DIV_UART_ISP 82
102#define CLK_DIV_SPI1_ISP_PRE 83
103#define CLK_DIV_SPI1_ISP 84
104#define CLK_DIV_SPI0_ISP_PRE 85
105#define CLK_DIV_SPI0_ISP 86
106#define CLK_DIV_TSADC_PRE 87
107#define CLK_DIV_TSADC 88
108#define CLK_DIV_MMC1_PRE 89
109#define CLK_DIV_MMC1 90
110#define CLK_DIV_MMC0_PRE 91
111#define CLK_DIV_MMC0 92
112#define CLK_DIV_UART1 93
113#define CLK_DIV_UART0 94
114#define CLK_DIV_SPI1_PRE 95
115#define CLK_DIV_SPI1 96
116#define CLK_DIV_SPI0_PRE 97
117#define CLK_DIV_SPI0 98
118#define CLK_DIV_PCM 99
119#define CLK_DIV_AUDIO 100
120#define CLK_DIV_I2S 101
121#define CLK_DIV_CORE2 102
122#define CLK_DIV_APLL 103
123#define CLK_DIV_PCLK_DBG 104
124#define CLK_DIV_ATB 105
125#define CLK_DIV_COREM 106
126#define CLK_DIV_CORE 107
127#define CLK_DIV_HPM 108
128#define CLK_DIV_COPY 109
129
130/* Gates */
131#define CLK_ASYNC_G3D 128
132#define CLK_ASYNC_MFCL 129
133#define CLK_PPMULEFT 130
134#define CLK_GPIO_LEFT 131
135#define CLK_ASYNC_ISPMX 132
136#define CLK_ASYNC_FSYSD 133
137#define CLK_ASYNC_LCD0X 134
138#define CLK_ASYNC_CAMX 135
139#define CLK_PPMURIGHT 136
140#define CLK_GPIO_RIGHT 137
141#define CLK_MONOCNT 138
142#define CLK_TZPC6 139
143#define CLK_PROVISIONKEY1 140
144#define CLK_PROVISIONKEY0 141
145#define CLK_CMU_ISPPART 142
146#define CLK_TMU_APBIF 143
147#define CLK_KEYIF 144
148#define CLK_RTC 145
149#define CLK_WDT 146
150#define CLK_MCT 147
151#define CLK_SECKEY 148
152#define CLK_TZPC5 149
153#define CLK_TZPC4 150
154#define CLK_TZPC3 151
155#define CLK_TZPC2 152
156#define CLK_TZPC1 153
157#define CLK_TZPC0 154
158#define CLK_CMU_COREPART 155
159#define CLK_CMU_TOPPART 156
160#define CLK_PMU_APBIF 157
161#define CLK_SYSREG 158
162#define CLK_CHIP_ID 159
163#define CLK_QEJPEG 160
164#define CLK_PIXELASYNCM1 161
165#define CLK_PIXELASYNCM0 162
166#define CLK_PPMUCAMIF 163
167#define CLK_QEM2MSCALER 164
168#define CLK_QEGSCALER1 165
169#define CLK_QEGSCALER0 166
170#define CLK_SMMUJPEG 167
171#define CLK_SMMUM2M2SCALER 168
172#define CLK_SMMUGSCALER1 169
173#define CLK_SMMUGSCALER0 170
174#define CLK_JPEG 171
175#define CLK_M2MSCALER 172
176#define CLK_GSCALER1 173
177#define CLK_GSCALER0 174
178#define CLK_QEMFC 175
179#define CLK_PPMUMFC_L 176
180#define CLK_SMMUMFC_L 177
181#define CLK_MFC 178
182#define CLK_SMMUG3D 179
183#define CLK_QEG3D 180
184#define CLK_PPMUG3D 181
185#define CLK_G3D 182
186#define CLK_QE_CH1_LCD 183
187#define CLK_QE_CH0_LCD 184
188#define CLK_PPMULCD0 185
189#define CLK_SMMUFIMD0 186
190#define CLK_DSIM0 187
191#define CLK_FIMD0 188
192#define CLK_CAM1 189
193#define CLK_UART_ISP_TOP 190
194#define CLK_SPI1_ISP_TOP 191
195#define CLK_SPI0_ISP_TOP 192
196#define CLK_TSADC 193
197#define CLK_PPMUFILE 194
198#define CLK_USBOTG 195
199#define CLK_USBHOST 196
200#define CLK_SROMC 197
201#define CLK_SDMMC1 198
202#define CLK_SDMMC0 199
203#define CLK_PDMA1 200
204#define CLK_PDMA0 201
205#define CLK_PWM 202
206#define CLK_PCM 203
207#define CLK_I2S 204
208#define CLK_SPI1 205
209#define CLK_SPI0 206
210#define CLK_I2C7 207
211#define CLK_I2C6 208
212#define CLK_I2C5 209
213#define CLK_I2C4 210
214#define CLK_I2C3 211
215#define CLK_I2C2 212
216#define CLK_I2C1 213
217#define CLK_I2C0 214
218#define CLK_UART1 215
219#define CLK_UART0 216
220#define CLK_BLOCK_LCD 217
221#define CLK_BLOCK_G3D 218
222#define CLK_BLOCK_MFC 219
223#define CLK_BLOCK_CAM 220
224#define CLK_SMIES 221
225
226/* Special clocks */
227#define CLK_SCLK_JPEG 224
228#define CLK_SCLK_M2MSCALER 225
229#define CLK_SCLK_GSCALER1 226
230#define CLK_SCLK_GSCALER0 227
231#define CLK_SCLK_MFC 228
232#define CLK_SCLK_G3D 229
233#define CLK_SCLK_MIPIDPHY2L 230
234#define CLK_SCLK_MIPI0 231
235#define CLK_SCLK_FIMD0 232
236#define CLK_SCLK_CAM1 233
237#define CLK_SCLK_UART_ISP 234
238#define CLK_SCLK_SPI1_ISP 235
239#define CLK_SCLK_SPI0_ISP 236
240#define CLK_SCLK_UPLL 237
241#define CLK_SCLK_TSADC 238
242#define CLK_SCLK_EBI 239
243#define CLK_SCLK_MMC1 240
244#define CLK_SCLK_MMC0 241
245#define CLK_SCLK_I2S 242
246#define CLK_SCLK_PCM 243
247#define CLK_SCLK_SPI1 244
248#define CLK_SCLK_SPI0 245
249#define CLK_SCLK_UART1 246
250#define CLK_SCLK_UART0 247
251
252/*
253 * Total number of clocks of main CMU.
254 * NOTE: Must be equal to last clock ID increased by one.
255 */
256#define CLK_NR_CLKS 248
257
258#endif /* _DT_BINDINGS_CLOCK_SAMSUNG_EXYNOS3250_CLOCK_H */
diff --git a/include/dt-bindings/clock/exynos4.h b/include/dt-bindings/clock/exynos4.h
index 75aff336dfb0..1106ca540a96 100644
--- a/include/dt-bindings/clock/exynos4.h
+++ b/include/dt-bindings/clock/exynos4.h
@@ -33,6 +33,7 @@
33#define CLK_MOUT_MPLL_USER_C 18 /* Exynos4x12 only */ 33#define CLK_MOUT_MPLL_USER_C 18 /* Exynos4x12 only */
34#define CLK_MOUT_CORE 19 34#define CLK_MOUT_CORE 19
35#define CLK_MOUT_APLL 20 35#define CLK_MOUT_APLL 20
36#define CLK_SCLK_HDMIPHY 22
36 37
37/* gate for special clocks (sclk) */ 38/* gate for special clocks (sclk) */
38#define CLK_SCLK_FIMC0 128 39#define CLK_SCLK_FIMC0 128
@@ -181,7 +182,6 @@
181#define CLK_KEYIF 347 182#define CLK_KEYIF 347
182#define CLK_AUDSS 348 183#define CLK_AUDSS 348
183#define CLK_MIPI_HSI 349 /* Exynos4210 only */ 184#define CLK_MIPI_HSI 349 /* Exynos4210 only */
184#define CLK_MDMA2 350 /* Exynos4210 only */
185#define CLK_PIXELASYNCM0 351 185#define CLK_PIXELASYNCM0 351
186#define CLK_PIXELASYNCM1 352 186#define CLK_PIXELASYNCM1 352
187#define CLK_FIMC_LITE0 353 /* Exynos4x12 only */ 187#define CLK_FIMC_LITE0 353 /* Exynos4x12 only */
diff --git a/include/dt-bindings/clock/exynos5250.h b/include/dt-bindings/clock/exynos5250.h
index 922f2dca9bf0..be6e97c54f54 100644
--- a/include/dt-bindings/clock/exynos5250.h
+++ b/include/dt-bindings/clock/exynos5250.h
@@ -150,11 +150,30 @@
150#define CLK_G2D 345 150#define CLK_G2D 345
151#define CLK_MDMA0 346 151#define CLK_MDMA0 346
152#define CLK_SMMU_MDMA0 347 152#define CLK_SMMU_MDMA0 347
153#define CLK_SSS 348
154#define CLK_G3D 349
155#define CLK_SMMU_TV 350
156#define CLK_SMMU_FIMD1 351
157#define CLK_SMMU_2D 352
158#define CLK_SMMU_FIMC_ISP 353
159#define CLK_SMMU_FIMC_DRC 354
160#define CLK_SMMU_FIMC_SCC 355
161#define CLK_SMMU_FIMC_SCP 356
162#define CLK_SMMU_FIMC_FD 357
163#define CLK_SMMU_FIMC_MCU 358
164#define CLK_SMMU_FIMC_ODC 359
165#define CLK_SMMU_FIMC_DIS0 360
166#define CLK_SMMU_FIMC_DIS1 361
167#define CLK_SMMU_FIMC_3DNR 362
168#define CLK_SMMU_FIMC_LITE0 363
169#define CLK_SMMU_FIMC_LITE1 364
170#define CLK_CAMIF_TOP 365
153 171
154/* mux clocks */ 172/* mux clocks */
155#define CLK_MOUT_HDMI 1024 173#define CLK_MOUT_HDMI 1024
174#define CLK_MOUT_GPLL 1025
156 175
157/* must be greater than maximal clock id */ 176/* must be greater than maximal clock id */
158#define CLK_NR_CLKS 1025 177#define CLK_NR_CLKS 1026
159 178
160#endif /* _DT_BINDINGS_CLOCK_EXYNOS_5250_H */ 179#endif /* _DT_BINDINGS_CLOCK_EXYNOS_5250_H */
diff --git a/include/dt-bindings/clock/exynos5260-clk.h b/include/dt-bindings/clock/exynos5260-clk.h
new file mode 100644
index 000000000000..a4bac9a1764f
--- /dev/null
+++ b/include/dt-bindings/clock/exynos5260-clk.h
@@ -0,0 +1,469 @@
1/*
2 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
3 * Author: Rahul Sharma <rahul.sharma@samsung.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 *
9 * Provides Constants for Exynos5260 clocks.
10*/
11
12#ifndef _DT_BINDINGS_CLK_EXYNOS5260_H
13#define _DT_BINDINGS_CLK_EXYNOS5260_H
14
15/* Clock names: <cmu><type><IP> */
16
17/* List Of Clocks For CMU_TOP */
18
19#define TOP_FOUT_DISP_PLL 1
20#define TOP_FOUT_AUD_PLL 2
21#define TOP_MOUT_AUDTOP_PLL_USER 3
22#define TOP_MOUT_AUD_PLL 4
23#define TOP_MOUT_DISP_PLL 5
24#define TOP_MOUT_BUSTOP_PLL_USER 6
25#define TOP_MOUT_MEMTOP_PLL_USER 7
26#define TOP_MOUT_MEDIATOP_PLL_USER 8
27#define TOP_MOUT_DISP_DISP_333 9
28#define TOP_MOUT_ACLK_DISP_333 10
29#define TOP_MOUT_DISP_DISP_222 11
30#define TOP_MOUT_ACLK_DISP_222 12
31#define TOP_MOUT_DISP_MEDIA_PIXEL 13
32#define TOP_MOUT_FIMD1 14
33#define TOP_MOUT_SCLK_PERI_SPI0_CLK 15
34#define TOP_MOUT_SCLK_PERI_SPI1_CLK 16
35#define TOP_MOUT_SCLK_PERI_SPI2_CLK 17
36#define TOP_MOUT_SCLK_PERI_UART0_UCLK 18
37#define TOP_MOUT_SCLK_PERI_UART2_UCLK 19
38#define TOP_MOUT_SCLK_PERI_UART1_UCLK 20
39#define TOP_MOUT_BUS4_BUSTOP_100 21
40#define TOP_MOUT_BUS4_BUSTOP_400 22
41#define TOP_MOUT_BUS3_BUSTOP_100 23
42#define TOP_MOUT_BUS3_BUSTOP_400 24
43#define TOP_MOUT_BUS2_BUSTOP_400 25
44#define TOP_MOUT_BUS2_BUSTOP_100 26
45#define TOP_MOUT_BUS1_BUSTOP_100 27
46#define TOP_MOUT_BUS1_BUSTOP_400 28
47#define TOP_MOUT_SCLK_FSYS_USB 29
48#define TOP_MOUT_SCLK_FSYS_MMC0_SDCLKIN_A 30
49#define TOP_MOUT_SCLK_FSYS_MMC1_SDCLKIN_A 31
50#define TOP_MOUT_SCLK_FSYS_MMC2_SDCLKIN_A 32
51#define TOP_MOUT_SCLK_FSYS_MMC0_SDCLKIN_B 33
52#define TOP_MOUT_SCLK_FSYS_MMC1_SDCLKIN_B 34
53#define TOP_MOUT_SCLK_FSYS_MMC2_SDCLKIN_B 35
54#define TOP_MOUT_ACLK_ISP1_266 36
55#define TOP_MOUT_ISP1_MEDIA_266 37
56#define TOP_MOUT_ACLK_ISP1_400 38
57#define TOP_MOUT_ISP1_MEDIA_400 39
58#define TOP_MOUT_SCLK_ISP1_SPI0 40
59#define TOP_MOUT_SCLK_ISP1_SPI1 41
60#define TOP_MOUT_SCLK_ISP1_UART 42
61#define TOP_MOUT_SCLK_ISP1_SENSOR2 43
62#define TOP_MOUT_SCLK_ISP1_SENSOR1 44
63#define TOP_MOUT_SCLK_ISP1_SENSOR0 45
64#define TOP_MOUT_ACLK_MFC_333 46
65#define TOP_MOUT_MFC_BUSTOP_333 47
66#define TOP_MOUT_ACLK_G2D_333 48
67#define TOP_MOUT_G2D_BUSTOP_333 49
68#define TOP_MOUT_ACLK_GSCL_FIMC 50
69#define TOP_MOUT_GSCL_BUSTOP_FIMC 51
70#define TOP_MOUT_ACLK_GSCL_333 52
71#define TOP_MOUT_GSCL_BUSTOP_333 53
72#define TOP_MOUT_ACLK_GSCL_400 54
73#define TOP_MOUT_M2M_MEDIATOP_400 55
74#define TOP_DOUT_ACLK_MFC_333 56
75#define TOP_DOUT_ACLK_G2D_333 57
76#define TOP_DOUT_SCLK_ISP1_SENSOR2_A 58
77#define TOP_DOUT_SCLK_ISP1_SENSOR1_A 59
78#define TOP_DOUT_SCLK_ISP1_SENSOR0_A 60
79#define TOP_DOUT_ACLK_GSCL_FIMC 61
80#define TOP_DOUT_ACLK_GSCL_400 62
81#define TOP_DOUT_ACLK_GSCL_333 63
82#define TOP_DOUT_SCLK_ISP1_SPI0_B 64
83#define TOP_DOUT_SCLK_ISP1_SPI0_A 65
84#define TOP_DOUT_ACLK_ISP1_400 66
85#define TOP_DOUT_ACLK_ISP1_266 67
86#define TOP_DOUT_SCLK_ISP1_UART 68
87#define TOP_DOUT_SCLK_ISP1_SPI1_B 69
88#define TOP_DOUT_SCLK_ISP1_SPI1_A 70
89#define TOP_DOUT_SCLK_ISP1_SENSOR2_B 71
90#define TOP_DOUT_SCLK_ISP1_SENSOR1_B 72
91#define TOP_DOUT_SCLK_ISP1_SENSOR0_B 73
92#define TOP_DOUTTOP__SCLK_HPM_TARGETCLK 74
93#define TOP_DOUT_SCLK_DISP_PIXEL 75
94#define TOP_DOUT_ACLK_DISP_222 76
95#define TOP_DOUT_ACLK_DISP_333 77
96#define TOP_DOUT_ACLK_BUS4_100 78
97#define TOP_DOUT_ACLK_BUS4_400 79
98#define TOP_DOUT_ACLK_BUS3_100 80
99#define TOP_DOUT_ACLK_BUS3_400 81
100#define TOP_DOUT_ACLK_BUS2_100 82
101#define TOP_DOUT_ACLK_BUS2_400 83
102#define TOP_DOUT_ACLK_BUS1_100 84
103#define TOP_DOUT_ACLK_BUS1_400 85
104#define TOP_DOUT_SCLK_PERI_SPI1_B 86
105#define TOP_DOUT_SCLK_PERI_SPI1_A 87
106#define TOP_DOUT_SCLK_PERI_SPI0_B 88
107#define TOP_DOUT_SCLK_PERI_SPI0_A 89
108#define TOP_DOUT_SCLK_PERI_UART0 90
109#define TOP_DOUT_SCLK_PERI_UART2 91
110#define TOP_DOUT_SCLK_PERI_UART1 92
111#define TOP_DOUT_SCLK_PERI_SPI2_B 93
112#define TOP_DOUT_SCLK_PERI_SPI2_A 94
113#define TOP_DOUT_ACLK_PERI_AUD 95
114#define TOP_DOUT_ACLK_PERI_66 96
115#define TOP_DOUT_SCLK_FSYS_MMC0_SDCLKIN_B 97
116#define TOP_DOUT_SCLK_FSYS_MMC0_SDCLKIN_A 98
117#define TOP_DOUT_SCLK_FSYS_USBDRD30_SUSPEND_CLK 99
118#define TOP_DOUT_ACLK_FSYS_200 100
119#define TOP_DOUT_SCLK_FSYS_MMC2_SDCLKIN_B 101
120#define TOP_DOUT_SCLK_FSYS_MMC2_SDCLKIN_A 102
121#define TOP_DOUT_SCLK_FSYS_MMC1_SDCLKIN_B 103
122#define TOP_DOUT_SCLK_FSYS_MMC1_SDCLKIN_A 104
123#define TOP_SCLK_FIMD1 105
124#define TOP_SCLK_MMC2 106
125#define TOP_SCLK_MMC1 107
126#define TOP_SCLK_MMC0 108
127#define PHYCLK_DPTX_PHY_CH3_TXD_CLK 109
128#define PHYCLK_DPTX_PHY_CH2_TXD_CLK 110
129#define PHYCLK_DPTX_PHY_CH1_TXD_CLK 111
130#define PHYCLK_DPTX_PHY_CH0_TXD_CLK 112
131#define phyclk_hdmi_phy_tmds_clko 113
132#define PHYCLK_HDMI_PHY_PIXEL_CLKO 114
133#define PHYCLK_HDMI_LINK_O_TMDS_CLKHI 115
134#define PHYCLK_MIPI_DPHY_4L_M_TXBYTECLKHS 116
135#define PHYCLK_DPTX_PHY_O_REF_CLK_24M 117
136#define PHYCLK_DPTX_PHY_CLK_DIV2 118
137#define PHYCLK_MIPI_DPHY_4L_M_RXCLKESC0 119
138#define PHYCLK_USBHOST20_PHY_PHYCLOCK 120
139#define PHYCLK_USBHOST20_PHY_FREECLK 121
140#define PHYCLK_USBHOST20_PHY_CLK48MOHCI 122
141#define PHYCLK_USBDRD30_UDRD30_PIPE_PCLK 123
142#define PHYCLK_USBDRD30_UDRD30_PHYCLOCK 124
143#define TOP_NR_CLK 125
144
145
146/* List Of Clocks For CMU_EGL */
147
148#define EGL_FOUT_EGL_PLL 1
149#define EGL_FOUT_EGL_DPLL 2
150#define EGL_MOUT_EGL_B 3
151#define EGL_MOUT_EGL_PLL 4
152#define EGL_DOUT_EGL_PLL 5
153#define EGL_DOUT_EGL_PCLK_DBG 6
154#define EGL_DOUT_EGL_ATCLK 7
155#define EGL_DOUT_PCLK_EGL 8
156#define EGL_DOUT_ACLK_EGL 9
157#define EGL_DOUT_EGL2 10
158#define EGL_DOUT_EGL1 11
159#define EGL_NR_CLK 12
160
161
162/* List Of Clocks For CMU_KFC */
163
164#define KFC_FOUT_KFC_PLL 1
165#define KFC_MOUT_KFC_PLL 2
166#define KFC_MOUT_KFC 3
167#define KFC_DOUT_KFC_PLL 4
168#define KFC_DOUT_PCLK_KFC 5
169#define KFC_DOUT_ACLK_KFC 6
170#define KFC_DOUT_KFC_PCLK_DBG 7
171#define KFC_DOUT_KFC_ATCLK 8
172#define KFC_DOUT_KFC2 9
173#define KFC_DOUT_KFC1 10
174#define KFC_NR_CLK 11
175
176
177/* List Of Clocks For CMU_MIF */
178
179#define MIF_FOUT_MEM_PLL 1
180#define MIF_FOUT_MEDIA_PLL 2
181#define MIF_FOUT_BUS_PLL 3
182#define MIF_MOUT_CLK2X_PHY 4
183#define MIF_MOUT_MIF_DREX2X 5
184#define MIF_MOUT_CLKM_PHY 6
185#define MIF_MOUT_MIF_DREX 7
186#define MIF_MOUT_MEDIA_PLL 8
187#define MIF_MOUT_BUS_PLL 9
188#define MIF_MOUT_MEM_PLL 10
189#define MIF_DOUT_ACLK_BUS_100 11
190#define MIF_DOUT_ACLK_BUS_200 12
191#define MIF_DOUT_ACLK_MIF_466 13
192#define MIF_DOUT_CLK2X_PHY 14
193#define MIF_DOUT_CLKM_PHY 15
194#define MIF_DOUT_BUS_PLL 16
195#define MIF_DOUT_MEM_PLL 17
196#define MIF_DOUT_MEDIA_PLL 18
197#define MIF_CLK_LPDDR3PHY_WRAP1 19
198#define MIF_CLK_LPDDR3PHY_WRAP0 20
199#define MIF_CLK_MONOCNT 21
200#define MIF_CLK_MIF_RTC 22
201#define MIF_CLK_DREX1 23
202#define MIF_CLK_DREX0 24
203#define MIF_CLK_INTMEM 25
204#define MIF_SCLK_LPDDR3PHY_WRAP_U1 26
205#define MIF_SCLK_LPDDR3PHY_WRAP_U0 27
206#define MIF_NR_CLK 28
207
208
209/* List Of Clocks For CMU_G3D */
210
211#define G3D_FOUT_G3D_PLL 1
212#define G3D_MOUT_G3D_PLL 2
213#define G3D_DOUT_PCLK_G3D 3
214#define G3D_DOUT_ACLK_G3D 4
215#define G3D_CLK_G3D_HPM 5
216#define G3D_CLK_G3D 6
217#define G3D_NR_CLK 7
218
219
220/* List Of Clocks For CMU_AUD */
221
222#define AUD_MOUT_SCLK_AUD_PCM 1
223#define AUD_MOUT_SCLK_AUD_I2S 2
224#define AUD_MOUT_AUD_PLL_USER 3
225#define AUD_DOUT_ACLK_AUD_131 4
226#define AUD_DOUT_SCLK_AUD_UART 5
227#define AUD_DOUT_SCLK_AUD_PCM 6
228#define AUD_DOUT_SCLK_AUD_I2S 7
229#define AUD_CLK_AUD_UART 8
230#define AUD_CLK_PCM 9
231#define AUD_CLK_I2S 10
232#define AUD_CLK_DMAC 11
233#define AUD_CLK_SRAMC 12
234#define AUD_SCLK_AUD_UART 13
235#define AUD_SCLK_PCM 14
236#define AUD_SCLK_I2S 15
237#define AUD_NR_CLK 16
238
239
240/* List Of Clocks For CMU_MFC */
241
242#define MFC_MOUT_ACLK_MFC_333_USER 1
243#define MFC_DOUT_PCLK_MFC_83 2
244#define MFC_CLK_MFC 3
245#define MFC_CLK_SMMU2_MFCM1 4
246#define MFC_CLK_SMMU2_MFCM0 5
247#define MFC_NR_CLK 6
248
249
250/* List Of Clocks For CMU_GSCL */
251
252#define GSCL_MOUT_ACLK_CSIS 1
253#define GSCL_MOUT_ACLK_GSCL_FIMC_USER 2
254#define GSCL_MOUT_ACLK_M2M_400_USER 3
255#define GSCL_MOUT_ACLK_GSCL_333_USER 4
256#define GSCL_DOUT_ACLK_CSIS_200 5
257#define GSCL_DOUT_PCLK_M2M_100 6
258#define GSCL_CLK_PIXEL_GSCL1 7
259#define GSCL_CLK_PIXEL_GSCL0 8
260#define GSCL_CLK_MSCL1 9
261#define GSCL_CLK_MSCL0 10
262#define GSCL_CLK_GSCL1 11
263#define GSCL_CLK_GSCL0 12
264#define GSCL_CLK_FIMC_LITE_D 13
265#define GSCL_CLK_FIMC_LITE_B 14
266#define GSCL_CLK_FIMC_LITE_A 15
267#define GSCL_CLK_CSIS1 16
268#define GSCL_CLK_CSIS0 17
269#define GSCL_CLK_SMMU3_LITE_D 18
270#define GSCL_CLK_SMMU3_LITE_B 19
271#define GSCL_CLK_SMMU3_LITE_A 20
272#define GSCL_CLK_SMMU3_GSCL0 21
273#define GSCL_CLK_SMMU3_GSCL1 22
274#define GSCL_CLK_SMMU3_MSCL0 23
275#define GSCL_CLK_SMMU3_MSCL1 24
276#define GSCL_SCLK_CSIS1_WRAP 25
277#define GSCL_SCLK_CSIS0_WRAP 26
278#define GSCL_NR_CLK 27
279
280
281/* List Of Clocks For CMU_FSYS */
282
283#define FSYS_MOUT_PHYCLK_USBHOST20_PHYCLK_USER 1
284#define FSYS_MOUT_PHYCLK_USBHOST20_FREECLK_USER 2
285#define FSYS_MOUT_PHYCLK_USBHOST20_CLK48MOHCI_USER 3
286#define FSYS_MOUT_PHYCLK_USBDRD30_PIPE_PCLK_USER 4
287#define FSYS_MOUT_PHYCLK_USBDRD30_PHYCLOCK_USER 5
288#define FSYS_CLK_TSI 6
289#define FSYS_CLK_USBLINK 7
290#define FSYS_CLK_USBHOST20 8
291#define FSYS_CLK_USBDRD30 9
292#define FSYS_CLK_SROMC 10
293#define FSYS_CLK_PDMA 11
294#define FSYS_CLK_MMC2 12
295#define FSYS_CLK_MMC1 13
296#define FSYS_CLK_MMC0 14
297#define FSYS_CLK_RTIC 15
298#define FSYS_CLK_SMMU_RTIC 16
299#define FSYS_PHYCLK_USBDRD30 17
300#define FSYS_PHYCLK_USBHOST20 18
301#define FSYS_NR_CLK 19
302
303
304/* List Of Clocks For CMU_PERI */
305
306#define PERI_MOUT_SCLK_SPDIF 1
307#define PERI_MOUT_SCLK_I2SCOD 2
308#define PERI_MOUT_SCLK_PCM 3
309#define PERI_DOUT_I2S 4
310#define PERI_DOUT_PCM 5
311#define PERI_CLK_WDT_KFC 6
312#define PERI_CLK_WDT_EGL 7
313#define PERI_CLK_HSIC3 8
314#define PERI_CLK_HSIC2 9
315#define PERI_CLK_HSIC1 10
316#define PERI_CLK_HSIC0 11
317#define PERI_CLK_PCM 12
318#define PERI_CLK_MCT 13
319#define PERI_CLK_I2S 14
320#define PERI_CLK_I2CHDMI 15
321#define PERI_CLK_I2C7 16
322#define PERI_CLK_I2C6 17
323#define PERI_CLK_I2C5 18
324#define PERI_CLK_I2C4 19
325#define PERI_CLK_I2C9 20
326#define PERI_CLK_I2C8 21
327#define PERI_CLK_I2C11 22
328#define PERI_CLK_I2C10 23
329#define PERI_CLK_HDMICEC 24
330#define PERI_CLK_EFUSE_WRITER 25
331#define PERI_CLK_ABB 26
332#define PERI_CLK_UART2 27
333#define PERI_CLK_UART1 28
334#define PERI_CLK_UART0 29
335#define PERI_CLK_ADC 30
336#define PERI_CLK_TMU4 31
337#define PERI_CLK_TMU3 32
338#define PERI_CLK_TMU2 33
339#define PERI_CLK_TMU1 34
340#define PERI_CLK_TMU0 35
341#define PERI_CLK_SPI2 36
342#define PERI_CLK_SPI1 37
343#define PERI_CLK_SPI0 38
344#define PERI_CLK_SPDIF 39
345#define PERI_CLK_PWM 40
346#define PERI_CLK_UART4 41
347#define PERI_CLK_CHIPID 42
348#define PERI_CLK_PROVKEY0 43
349#define PERI_CLK_PROVKEY1 44
350#define PERI_CLK_SECKEY 45
351#define PERI_CLK_TOP_RTC 46
352#define PERI_CLK_TZPC10 47
353#define PERI_CLK_TZPC9 48
354#define PERI_CLK_TZPC8 49
355#define PERI_CLK_TZPC7 50
356#define PERI_CLK_TZPC6 51
357#define PERI_CLK_TZPC5 52
358#define PERI_CLK_TZPC4 53
359#define PERI_CLK_TZPC3 54
360#define PERI_CLK_TZPC2 55
361#define PERI_CLK_TZPC1 56
362#define PERI_CLK_TZPC0 57
363#define PERI_SCLK_UART2 58
364#define PERI_SCLK_UART1 59
365#define PERI_SCLK_UART0 60
366#define PERI_SCLK_SPI2 61
367#define PERI_SCLK_SPI1 62
368#define PERI_SCLK_SPI0 63
369#define PERI_SCLK_SPDIF 64
370#define PERI_SCLK_I2S 65
371#define PERI_SCLK_PCM1 66
372#define PERI_NR_CLK 67
373
374
375/* List Of Clocks For CMU_DISP */
376
377#define DISP_MOUT_SCLK_HDMI_SPDIF 1
378#define DISP_MOUT_SCLK_HDMI_PIXEL 2
379#define DISP_MOUT_PHYCLK_MIPI_DPHY_4LMRXCLK_ESC0_USER 3
380#define DISP_MOUT_PHYCLK_HDMI_PHY_TMDS_CLKO_USER 4
381#define DISP_MOUT_PHYCLK_HDMI_PHY_REF_CLKO_USER 5
382#define DISP_MOUT_HDMI_PHY_PIXEL 6
383#define DISP_MOUT_PHYCLK_HDMI_LINK_O_TMDS_CLKHI_USER 7
384#define DISP_MOUT_PHYCLK_MIPI_DPHY_4L_M_TXBYTE_CLKHS 8
385#define DISP_MOUT_PHYCLK_DPTX_PHY_O_REF_CLK_24M_USER 9
386#define DISP_MOUT_PHYCLK_DPTX_PHY_CLK_DIV2_USER 10
387#define DISP_MOUT_PHYCLK_DPTX_PHY_CH3_TXD_CLK_USER 11
388#define DISP_MOUT_PHYCLK_DPTX_PHY_CH2_TXD_CLK_USER 12
389#define DISP_MOUT_PHYCLK_DPTX_PHY_CH1_TXD_CLK_USER 13
390#define DISP_MOUT_PHYCLK_DPTX_PHY_CH0_TXD_CLK_USER 14
391#define DISP_MOUT_ACLK_DISP_222_USER 15
392#define DISP_MOUT_SCLK_DISP_PIXEL_USER 16
393#define DISP_MOUT_ACLK_DISP_333_USER 17
394#define DISP_DOUT_SCLK_HDMI_PHY_PIXEL_CLKI 18
395#define DISP_DOUT_SCLK_FIMD1_EXTCLKPLL 19
396#define DISP_DOUT_PCLK_DISP_111 20
397#define DISP_CLK_SMMU_TV 21
398#define DISP_CLK_SMMU_FIMD1M1 22
399#define DISP_CLK_SMMU_FIMD1M0 23
400#define DISP_CLK_PIXEL_MIXER 24
401#define DISP_CLK_PIXEL_DISP 25
402#define DISP_CLK_MIXER 26
403#define DISP_CLK_MIPIPHY 27
404#define DISP_CLK_HDMIPHY 28
405#define DISP_CLK_HDMI 29
406#define DISP_CLK_FIMD1 30
407#define DISP_CLK_DSIM1 31
408#define DISP_CLK_DPPHY 32
409#define DISP_CLK_DP 33
410#define DISP_SCLK_PIXEL 34
411#define DISP_MOUT_HDMI_PHY_PIXEL_USER 35
412#define DISP_NR_CLK 36
413
414
415/* List Of Clocks For CMU_G2D */
416
417#define G2D_MOUT_ACLK_G2D_333_USER 1
418#define G2D_DOUT_PCLK_G2D_83 2
419#define G2D_CLK_SMMU3_JPEG 3
420#define G2D_CLK_MDMA 4
421#define G2D_CLK_JPEG 5
422#define G2D_CLK_G2D 6
423#define G2D_CLK_SSS 7
424#define G2D_CLK_SLIM_SSS 8
425#define G2D_CLK_SMMU_SLIM_SSS 9
426#define G2D_CLK_SMMU_SSS 10
427#define G2D_CLK_SMMU_MDMA 11
428#define G2D_CLK_SMMU3_G2D 12
429#define G2D_NR_CLK 13
430
431
432/* List Of Clocks For CMU_ISP */
433
434#define ISP_MOUT_ISP_400_USER 1
435#define ISP_MOUT_ISP_266_USER 2
436#define ISP_DOUT_SCLK_MPWM 3
437#define ISP_DOUT_CA5_PCLKDBG 4
438#define ISP_DOUT_CA5_ATCLKIN 5
439#define ISP_DOUT_PCLK_ISP_133 6
440#define ISP_DOUT_PCLK_ISP_66 7
441#define ISP_CLK_GIC 8
442#define ISP_CLK_WDT 9
443#define ISP_CLK_UART 10
444#define ISP_CLK_SPI1 11
445#define ISP_CLK_SPI0 12
446#define ISP_CLK_SMMU_SCALERP 13
447#define ISP_CLK_SMMU_SCALERC 14
448#define ISP_CLK_SMMU_ISPCX 15
449#define ISP_CLK_SMMU_ISP 16
450#define ISP_CLK_SMMU_FD 17
451#define ISP_CLK_SMMU_DRC 18
452#define ISP_CLK_PWM 19
453#define ISP_CLK_MTCADC 20
454#define ISP_CLK_MPWM 21
455#define ISP_CLK_MCUCTL 22
456#define ISP_CLK_I2C1 23
457#define ISP_CLK_I2C0 24
458#define ISP_CLK_FIMC_SCALERP 25
459#define ISP_CLK_FIMC_SCALERC 26
460#define ISP_CLK_FIMC 27
461#define ISP_CLK_FIMC_FD 28
462#define ISP_CLK_FIMC_DRC 29
463#define ISP_CLK_CA5 30
464#define ISP_SCLK_SPI0_EXT 31
465#define ISP_SCLK_SPI1_EXT 32
466#define ISP_SCLK_UART_EXT 33
467#define ISP_NR_CLK 34
468
469#endif
diff --git a/include/dt-bindings/clock/exynos5410.h b/include/dt-bindings/clock/exynos5410.h
new file mode 100644
index 000000000000..9b180f032e2d
--- /dev/null
+++ b/include/dt-bindings/clock/exynos5410.h
@@ -0,0 +1,33 @@
1#ifndef _DT_BINDINGS_CLOCK_EXYNOS_5410_H
2#define _DT_BINDINGS_CLOCK_EXYNOS_5410_H
3
4/* core clocks */
5#define CLK_FIN_PLL 1
6#define CLK_FOUT_APLL 2
7#define CLK_FOUT_CPLL 3
8#define CLK_FOUT_MPLL 4
9#define CLK_FOUT_BPLL 5
10#define CLK_FOUT_KPLL 6
11
12/* gate for special clocks (sclk) */
13#define CLK_SCLK_UART0 128
14#define CLK_SCLK_UART1 129
15#define CLK_SCLK_UART2 130
16#define CLK_SCLK_UART3 131
17#define CLK_SCLK_MMC0 132
18#define CLK_SCLK_MMC1 133
19#define CLK_SCLK_MMC2 134
20
21/* gate clocks */
22#define CLK_UART0 257
23#define CLK_UART1 258
24#define CLK_UART2 259
25#define CLK_UART3 260
26#define CLK_MCT 315
27#define CLK_MMC0 351
28#define CLK_MMC1 352
29#define CLK_MMC2 353
30
31#define CLK_NR_CLKS 512
32
33#endif /* _DT_BINDINGS_CLOCK_EXYNOS_5410_H */
diff --git a/include/dt-bindings/clock/exynos5420.h b/include/dt-bindings/clock/exynos5420.h
index 5eefd8813f02..21d51ae1d242 100644
--- a/include/dt-bindings/clock/exynos5420.h
+++ b/include/dt-bindings/clock/exynos5420.h
@@ -58,9 +58,11 @@
58#define CLK_SCLK_GSCL_WA 156 58#define CLK_SCLK_GSCL_WA 156
59#define CLK_SCLK_GSCL_WB 157 59#define CLK_SCLK_GSCL_WB 157
60#define CLK_SCLK_HDMIPHY 158 60#define CLK_SCLK_HDMIPHY 158
61#define CLK_MAU_EPLL 159
62#define CLK_SCLK_HSIC_12M 160
63#define CLK_SCLK_MPHY_IXTAL24 161
61 64
62/* gate clocks */ 65/* gate clocks */
63#define CLK_ACLK66_PERIC 256
64#define CLK_UART0 257 66#define CLK_UART0 257
65#define CLK_UART1 258 67#define CLK_UART1 258
66#define CLK_UART2 259 68#define CLK_UART2 259
@@ -69,10 +71,10 @@
69#define CLK_I2C1 262 71#define CLK_I2C1 262
70#define CLK_I2C2 263 72#define CLK_I2C2 263
71#define CLK_I2C3 264 73#define CLK_I2C3 264
72#define CLK_I2C4 265 74#define CLK_USI0 265
73#define CLK_I2C5 266 75#define CLK_USI1 266
74#define CLK_I2C6 267 76#define CLK_USI2 267
75#define CLK_I2C7 268 77#define CLK_USI3 268
76#define CLK_I2C_HDMI 269 78#define CLK_I2C_HDMI 269
77#define CLK_TSADC 270 79#define CLK_TSADC 270
78#define CLK_SPI0 271 80#define CLK_SPI0 271
@@ -85,9 +87,9 @@
85#define CLK_PCM2 278 87#define CLK_PCM2 278
86#define CLK_PWM 279 88#define CLK_PWM 279
87#define CLK_SPDIF 280 89#define CLK_SPDIF 280
88#define CLK_I2C8 281 90#define CLK_USI4 281
89#define CLK_I2C9 282 91#define CLK_USI5 282
90#define CLK_I2C10 283 92#define CLK_USI6 283
91#define CLK_ACLK66_PSGEN 300 93#define CLK_ACLK66_PSGEN 300
92#define CLK_CHIPID 301 94#define CLK_CHIPID 301
93#define CLK_SYSREG 302 95#define CLK_SYSREG 302
@@ -140,7 +142,8 @@
140#define CLK_HDMI 413 142#define CLK_HDMI 413
141#define CLK_ACLK300_DISP1 420 143#define CLK_ACLK300_DISP1 420
142#define CLK_FIMD1 421 144#define CLK_FIMD1 421
143#define CLK_SMMU_FIMD1 422 145#define CLK_SMMU_FIMD1M0 422
146#define CLK_SMMU_FIMD1M1 423
144#define CLK_ACLK166 430 147#define CLK_ACLK166 430
145#define CLK_MIXER 431 148#define CLK_MIXER 431
146#define CLK_ACLK266 440 149#define CLK_ACLK266 440
@@ -152,6 +155,7 @@
152#define CLK_JPEG 451 155#define CLK_JPEG 451
153#define CLK_JPEG2 452 156#define CLK_JPEG2 452
154#define CLK_SMMU_JPEG 453 157#define CLK_SMMU_JPEG 453
158#define CLK_SMMU_JPEG2 454
155#define CLK_ACLK300_GSCL 460 159#define CLK_ACLK300_GSCL 460
156#define CLK_SMMU_GSCL0 461 160#define CLK_SMMU_GSCL0 461
157#define CLK_SMMU_GSCL1 462 161#define CLK_SMMU_GSCL1 462
@@ -159,7 +163,7 @@
159#define CLK_GSCL_WB 464 163#define CLK_GSCL_WB 464
160#define CLK_GSCL0 465 164#define CLK_GSCL0 465
161#define CLK_GSCL1 466 165#define CLK_GSCL1 466
162#define CLK_CLK_3AA 467 166#define CLK_FIMC_3AA 467
163#define CLK_ACLK266_G2D 470 167#define CLK_ACLK266_G2D 470
164#define CLK_SSS 471 168#define CLK_SSS 471
165#define CLK_SLIM_SSS 472 169#define CLK_SLIM_SSS 472
@@ -172,12 +176,34 @@
172#define CLK_SMMU_FIMCL1 493 176#define CLK_SMMU_FIMCL1 493
173#define CLK_SMMU_FIMCL3 494 177#define CLK_SMMU_FIMCL3 494
174#define CLK_FIMC_LITE3 495 178#define CLK_FIMC_LITE3 495
179#define CLK_FIMC_LITE0 496
180#define CLK_FIMC_LITE1 497
175#define CLK_ACLK_G3D 500 181#define CLK_ACLK_G3D 500
176#define CLK_G3D 501 182#define CLK_G3D 501
177#define CLK_SMMU_MIXER 502 183#define CLK_SMMU_MIXER 502
184#define CLK_SMMU_G2D 503
185#define CLK_SMMU_MDMA0 504
186#define CLK_MC 505
187#define CLK_TOP_RTC 506
188#define CLK_SCLK_UART_ISP 510
189#define CLK_SCLK_SPI0_ISP 511
190#define CLK_SCLK_SPI1_ISP 512
191#define CLK_SCLK_PWM_ISP 513
192#define CLK_SCLK_ISP_SENSOR0 514
193#define CLK_SCLK_ISP_SENSOR1 515
194#define CLK_SCLK_ISP_SENSOR2 516
195#define CLK_ACLK432_SCALER 517
196#define CLK_ACLK432_CAM 518
197#define CLK_ACLK_FL1550_CAM 519
198#define CLK_ACLK550_CAM 520
178 199
179/* mux clocks */ 200/* mux clocks */
180#define CLK_MOUT_HDMI 640 201#define CLK_MOUT_HDMI 640
202#define CLK_MOUT_G3D 641
203#define CLK_MOUT_VPLL 642
204#define CLK_MOUT_MAUDIO0 643
205#define CLK_MOUT_USER_ACLK333 644
206#define CLK_MOUT_SW_ACLK333 645
181 207
182/* divider clocks */ 208/* divider clocks */
183#define CLK_DOUT_PIXEL 768 209#define CLK_DOUT_PIXEL 768
diff --git a/include/dt-bindings/clock/hix5hd2-clock.h b/include/dt-bindings/clock/hix5hd2-clock.h
new file mode 100644
index 000000000000..aad579a75802
--- /dev/null
+++ b/include/dt-bindings/clock/hix5hd2-clock.h
@@ -0,0 +1,58 @@
1/*
2 * Copyright (c) 2014 Linaro Ltd.
3 * Copyright (c) 2014 Hisilicon Limited.
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
10#ifndef __DTS_HIX5HD2_CLOCK_H
11#define __DTS_HIX5HD2_CLOCK_H
12
13/* fixed rate */
14#define HIX5HD2_FIXED_1200M 1
15#define HIX5HD2_FIXED_400M 2
16#define HIX5HD2_FIXED_48M 3
17#define HIX5HD2_FIXED_24M 4
18#define HIX5HD2_FIXED_600M 5
19#define HIX5HD2_FIXED_300M 6
20#define HIX5HD2_FIXED_75M 7
21#define HIX5HD2_FIXED_200M 8
22#define HIX5HD2_FIXED_100M 9
23#define HIX5HD2_FIXED_40M 10
24#define HIX5HD2_FIXED_150M 11
25#define HIX5HD2_FIXED_1728M 12
26#define HIX5HD2_FIXED_28P8M 13
27#define HIX5HD2_FIXED_432M 14
28#define HIX5HD2_FIXED_345P6M 15
29#define HIX5HD2_FIXED_288M 16
30#define HIX5HD2_FIXED_60M 17
31#define HIX5HD2_FIXED_750M 18
32#define HIX5HD2_FIXED_500M 19
33#define HIX5HD2_FIXED_54M 20
34#define HIX5HD2_FIXED_27M 21
35#define HIX5HD2_FIXED_1500M 22
36#define HIX5HD2_FIXED_375M 23
37#define HIX5HD2_FIXED_187M 24
38#define HIX5HD2_FIXED_250M 25
39#define HIX5HD2_FIXED_125M 26
40#define HIX5HD2_FIXED_2P02M 27
41#define HIX5HD2_FIXED_50M 28
42#define HIX5HD2_FIXED_25M 29
43#define HIX5HD2_FIXED_83M 30
44
45/* mux clocks */
46#define HIX5HD2_SFC_MUX 64
47#define HIX5HD2_MMC_MUX 65
48#define HIX5HD2_FEPHY_MUX 66
49
50/* gate clocks */
51#define HIX5HD2_SFC_RST 128
52#define HIX5HD2_SFC_CLK 129
53#define HIX5HD2_MMC_CIU_CLK 130
54#define HIX5HD2_MMC_BIU_CLK 131
55#define HIX5HD2_MMC_CIU_RST 132
56
57#define HIX5HD2_NR_CLKS 256
58#endif /* __DTS_HIX5HD2_CLOCK_H */
diff --git a/include/dt-bindings/clock/imx6sl-clock.h b/include/dt-bindings/clock/imx6sl-clock.h
index 7cf5c9969336..b91dd462ba85 100644
--- a/include/dt-bindings/clock/imx6sl-clock.h
+++ b/include/dt-bindings/clock/imx6sl-clock.h
@@ -145,6 +145,7 @@
145#define IMX6SL_CLK_USDHC4 132 145#define IMX6SL_CLK_USDHC4 132
146#define IMX6SL_CLK_PLL4_AUDIO_DIV 133 146#define IMX6SL_CLK_PLL4_AUDIO_DIV 133
147#define IMX6SL_CLK_SPBA 134 147#define IMX6SL_CLK_SPBA 134
148#define IMX6SL_CLK_END 135 148#define IMX6SL_CLK_ENET 135
149#define IMX6SL_CLK_END 136
149 150
150#endif /* __DT_BINDINGS_CLOCK_IMX6SL_H */ 151#endif /* __DT_BINDINGS_CLOCK_IMX6SL_H */
diff --git a/include/dt-bindings/clock/imx6sx-clock.h b/include/dt-bindings/clock/imx6sx-clock.h
new file mode 100644
index 000000000000..421d8bb76f2f
--- /dev/null
+++ b/include/dt-bindings/clock/imx6sx-clock.h
@@ -0,0 +1,256 @@
1/*
2 * Copyright (C) 2014 Freescale Semiconductor, Inc.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 */
9
10#ifndef __DT_BINDINGS_CLOCK_IMX6SX_H
11#define __DT_BINDINGS_CLOCK_IMX6SX_H
12
13#define IMX6SX_CLK_DUMMY 0
14#define IMX6SX_CLK_CKIL 1
15#define IMX6SX_CLK_CKIH 2
16#define IMX6SX_CLK_OSC 3
17#define IMX6SX_CLK_PLL1_SYS 4
18#define IMX6SX_CLK_PLL2_BUS 5
19#define IMX6SX_CLK_PLL3_USB_OTG 6
20#define IMX6SX_CLK_PLL4_AUDIO 7
21#define IMX6SX_CLK_PLL5_VIDEO 8
22#define IMX6SX_CLK_PLL6_ENET 9
23#define IMX6SX_CLK_PLL7_USB_HOST 10
24#define IMX6SX_CLK_USBPHY1 11
25#define IMX6SX_CLK_USBPHY2 12
26#define IMX6SX_CLK_USBPHY1_GATE 13
27#define IMX6SX_CLK_USBPHY2_GATE 14
28#define IMX6SX_CLK_PCIE_REF 15
29#define IMX6SX_CLK_PCIE_REF_125M 16
30#define IMX6SX_CLK_ENET_REF 17
31#define IMX6SX_CLK_PLL2_PFD0 18
32#define IMX6SX_CLK_PLL2_PFD1 19
33#define IMX6SX_CLK_PLL2_PFD2 20
34#define IMX6SX_CLK_PLL2_PFD3 21
35#define IMX6SX_CLK_PLL3_PFD0 22
36#define IMX6SX_CLK_PLL3_PFD1 23
37#define IMX6SX_CLK_PLL3_PFD2 24
38#define IMX6SX_CLK_PLL3_PFD3 25
39#define IMX6SX_CLK_PLL2_198M 26
40#define IMX6SX_CLK_PLL3_120M 27
41#define IMX6SX_CLK_PLL3_80M 28
42#define IMX6SX_CLK_PLL3_60M 29
43#define IMX6SX_CLK_TWD 30
44#define IMX6SX_CLK_PLL4_POST_DIV 31
45#define IMX6SX_CLK_PLL4_AUDIO_DIV 32
46#define IMX6SX_CLK_PLL5_POST_DIV 33
47#define IMX6SX_CLK_PLL5_VIDEO_DIV 34
48#define IMX6SX_CLK_STEP 35
49#define IMX6SX_CLK_PLL1_SW 36
50#define IMX6SX_CLK_OCRAM_SEL 37
51#define IMX6SX_CLK_PERIPH_PRE 38
52#define IMX6SX_CLK_PERIPH2_PRE 39
53#define IMX6SX_CLK_PERIPH_CLK2_SEL 40
54#define IMX6SX_CLK_PERIPH2_CLK2_SEL 41
55#define IMX6SX_CLK_PCIE_AXI_SEL 42
56#define IMX6SX_CLK_GPU_AXI_SEL 43
57#define IMX6SX_CLK_GPU_CORE_SEL 44
58#define IMX6SX_CLK_EIM_SLOW_SEL 45
59#define IMX6SX_CLK_USDHC1_SEL 46
60#define IMX6SX_CLK_USDHC2_SEL 47
61#define IMX6SX_CLK_USDHC3_SEL 48
62#define IMX6SX_CLK_USDHC4_SEL 49
63#define IMX6SX_CLK_SSI1_SEL 50
64#define IMX6SX_CLK_SSI2_SEL 51
65#define IMX6SX_CLK_SSI3_SEL 52
66#define IMX6SX_CLK_QSPI1_SEL 53
67#define IMX6SX_CLK_PERCLK_SEL 54
68#define IMX6SX_CLK_VID_SEL 55
69#define IMX6SX_CLK_ESAI_SEL 56
70#define IMX6SX_CLK_LDB_DI0_DIV_SEL 57
71#define IMX6SX_CLK_LDB_DI1_DIV_SEL 58
72#define IMX6SX_CLK_CAN_SEL 59
73#define IMX6SX_CLK_UART_SEL 60
74#define IMX6SX_CLK_QSPI2_SEL 61
75#define IMX6SX_CLK_LDB_DI1_SEL 62
76#define IMX6SX_CLK_LDB_DI0_SEL 63
77#define IMX6SX_CLK_SPDIF_SEL 64
78#define IMX6SX_CLK_AUDIO_SEL 65
79#define IMX6SX_CLK_ENET_PRE_SEL 66
80#define IMX6SX_CLK_ENET_SEL 67
81#define IMX6SX_CLK_M4_PRE_SEL 68
82#define IMX6SX_CLK_M4_SEL 69
83#define IMX6SX_CLK_ECSPI_SEL 70
84#define IMX6SX_CLK_LCDIF1_PRE_SEL 71
85#define IMX6SX_CLK_LCDIF2_PRE_SEL 72
86#define IMX6SX_CLK_LCDIF1_SEL 73
87#define IMX6SX_CLK_LCDIF2_SEL 74
88#define IMX6SX_CLK_DISPLAY_SEL 75
89#define IMX6SX_CLK_CSI_SEL 76
90#define IMX6SX_CLK_CKO1_SEL 77
91#define IMX6SX_CLK_CKO2_SEL 78
92#define IMX6SX_CLK_CKO 79
93#define IMX6SX_CLK_PERIPH_CLK2 80
94#define IMX6SX_CLK_PERIPH2_CLK2 81
95#define IMX6SX_CLK_IPG 82
96#define IMX6SX_CLK_GPU_CORE_PODF 83
97#define IMX6SX_CLK_GPU_AXI_PODF 84
98#define IMX6SX_CLK_LCDIF1_PODF 85
99#define IMX6SX_CLK_QSPI1_PODF 86
100#define IMX6SX_CLK_EIM_SLOW_PODF 87
101#define IMX6SX_CLK_LCDIF2_PODF 88
102#define IMX6SX_CLK_PERCLK 89
103#define IMX6SX_CLK_VID_PODF 90
104#define IMX6SX_CLK_CAN_PODF 91
105#define IMX6SX_CLK_USDHC1_PODF 92
106#define IMX6SX_CLK_USDHC2_PODF 93
107#define IMX6SX_CLK_USDHC3_PODF 94
108#define IMX6SX_CLK_USDHC4_PODF 95
109#define IMX6SX_CLK_UART_PODF 96
110#define IMX6SX_CLK_ESAI_PRED 97
111#define IMX6SX_CLK_ESAI_PODF 98
112#define IMX6SX_CLK_SSI3_PRED 99
113#define IMX6SX_CLK_SSI3_PODF 100
114#define IMX6SX_CLK_SSI1_PRED 101
115#define IMX6SX_CLK_SSI1_PODF 102
116#define IMX6SX_CLK_QSPI2_PRED 103
117#define IMX6SX_CLK_QSPI2_PODF 104
118#define IMX6SX_CLK_SSI2_PRED 105
119#define IMX6SX_CLK_SSI2_PODF 106
120#define IMX6SX_CLK_SPDIF_PRED 107
121#define IMX6SX_CLK_SPDIF_PODF 108
122#define IMX6SX_CLK_AUDIO_PRED 109
123#define IMX6SX_CLK_AUDIO_PODF 110
124#define IMX6SX_CLK_ENET_PODF 111
125#define IMX6SX_CLK_M4_PODF 112
126#define IMX6SX_CLK_ECSPI_PODF 113
127#define IMX6SX_CLK_LCDIF1_PRED 114
128#define IMX6SX_CLK_LCDIF2_PRED 115
129#define IMX6SX_CLK_DISPLAY_PODF 116
130#define IMX6SX_CLK_CSI_PODF 117
131#define IMX6SX_CLK_LDB_DI0_DIV_3_5 118
132#define IMX6SX_CLK_LDB_DI0_DIV_7 119
133#define IMX6SX_CLK_LDB_DI1_DIV_3_5 120
134#define IMX6SX_CLK_LDB_DI1_DIV_7 121
135#define IMX6SX_CLK_CKO1_PODF 122
136#define IMX6SX_CLK_CKO2_PODF 123
137#define IMX6SX_CLK_PERIPH 124
138#define IMX6SX_CLK_PERIPH2 125
139#define IMX6SX_CLK_OCRAM 126
140#define IMX6SX_CLK_AHB 127
141#define IMX6SX_CLK_MMDC_PODF 128
142#define IMX6SX_CLK_ARM 129
143#define IMX6SX_CLK_AIPS_TZ1 130
144#define IMX6SX_CLK_AIPS_TZ2 131
145#define IMX6SX_CLK_APBH_DMA 132
146#define IMX6SX_CLK_ASRC_GATE 133
147#define IMX6SX_CLK_CAAM_MEM 134
148#define IMX6SX_CLK_CAAM_ACLK 135
149#define IMX6SX_CLK_CAAM_IPG 136
150#define IMX6SX_CLK_CAN1_IPG 137
151#define IMX6SX_CLK_CAN1_SERIAL 138
152#define IMX6SX_CLK_CAN2_IPG 139
153#define IMX6SX_CLK_CAN2_SERIAL 140
154#define IMX6SX_CLK_CPU_DEBUG 141
155#define IMX6SX_CLK_DCIC1 142
156#define IMX6SX_CLK_DCIC2 143
157#define IMX6SX_CLK_AIPS_TZ3 144
158#define IMX6SX_CLK_ECSPI1 145
159#define IMX6SX_CLK_ECSPI2 146
160#define IMX6SX_CLK_ECSPI3 147
161#define IMX6SX_CLK_ECSPI4 148
162#define IMX6SX_CLK_ECSPI5 149
163#define IMX6SX_CLK_EPIT1 150
164#define IMX6SX_CLK_EPIT2 151
165#define IMX6SX_CLK_ESAI_EXTAL 152
166#define IMX6SX_CLK_WAKEUP 153
167#define IMX6SX_CLK_GPT_BUS 154
168#define IMX6SX_CLK_GPT_SERIAL 155
169#define IMX6SX_CLK_GPU 156
170#define IMX6SX_CLK_OCRAM_S 157
171#define IMX6SX_CLK_CANFD 158
172#define IMX6SX_CLK_CSI 159
173#define IMX6SX_CLK_I2C1 160
174#define IMX6SX_CLK_I2C2 161
175#define IMX6SX_CLK_I2C3 162
176#define IMX6SX_CLK_OCOTP 163
177#define IMX6SX_CLK_IOMUXC 164
178#define IMX6SX_CLK_IPMUX1 165
179#define IMX6SX_CLK_IPMUX2 166
180#define IMX6SX_CLK_IPMUX3 167
181#define IMX6SX_CLK_TZASC1 168
182#define IMX6SX_CLK_LCDIF_APB 169
183#define IMX6SX_CLK_PXP_AXI 170
184#define IMX6SX_CLK_M4 171
185#define IMX6SX_CLK_ENET 172
186#define IMX6SX_CLK_DISPLAY_AXI 173
187#define IMX6SX_CLK_LCDIF2_PIX 174
188#define IMX6SX_CLK_LCDIF1_PIX 175
189#define IMX6SX_CLK_LDB_DI0 176
190#define IMX6SX_CLK_QSPI1 177
191#define IMX6SX_CLK_MLB 178
192#define IMX6SX_CLK_MMDC_P0_FAST 179
193#define IMX6SX_CLK_MMDC_P0_IPG 180
194#define IMX6SX_CLK_AXI 181
195#define IMX6SX_CLK_PCIE_AXI 182
196#define IMX6SX_CLK_QSPI2 183
197#define IMX6SX_CLK_PER1_BCH 184
198#define IMX6SX_CLK_PER2_MAIN 185
199#define IMX6SX_CLK_PWM1 186
200#define IMX6SX_CLK_PWM2 187
201#define IMX6SX_CLK_PWM3 188
202#define IMX6SX_CLK_PWM4 189
203#define IMX6SX_CLK_GPMI_BCH_APB 190
204#define IMX6SX_CLK_GPMI_BCH 191
205#define IMX6SX_CLK_GPMI_IO 192
206#define IMX6SX_CLK_GPMI_APB 193
207#define IMX6SX_CLK_ROM 194
208#define IMX6SX_CLK_SDMA 195
209#define IMX6SX_CLK_SPBA 196
210#define IMX6SX_CLK_SPDIF 197
211#define IMX6SX_CLK_SSI1_IPG 198
212#define IMX6SX_CLK_SSI2_IPG 199
213#define IMX6SX_CLK_SSI3_IPG 200
214#define IMX6SX_CLK_SSI1 201
215#define IMX6SX_CLK_SSI2 202
216#define IMX6SX_CLK_SSI3 203
217#define IMX6SX_CLK_UART_IPG 204
218#define IMX6SX_CLK_UART_SERIAL 205
219#define IMX6SX_CLK_SAI1 206
220#define IMX6SX_CLK_SAI2 207
221#define IMX6SX_CLK_USBOH3 208
222#define IMX6SX_CLK_USDHC1 209
223#define IMX6SX_CLK_USDHC2 210
224#define IMX6SX_CLK_USDHC3 211
225#define IMX6SX_CLK_USDHC4 212
226#define IMX6SX_CLK_EIM_SLOW 213
227#define IMX6SX_CLK_PWM8 214
228#define IMX6SX_CLK_VADC 215
229#define IMX6SX_CLK_GIS 216
230#define IMX6SX_CLK_I2C4 217
231#define IMX6SX_CLK_PWM5 218
232#define IMX6SX_CLK_PWM6 219
233#define IMX6SX_CLK_PWM7 220
234#define IMX6SX_CLK_CKO1 221
235#define IMX6SX_CLK_CKO2 222
236#define IMX6SX_CLK_IPP_DI0 223
237#define IMX6SX_CLK_IPP_DI1 224
238#define IMX6SX_CLK_ENET_AHB 225
239#define IMX6SX_CLK_OCRAM_PODF 226
240#define IMX6SX_CLK_GPT_3M 227
241#define IMX6SX_CLK_ENET_PTP 228
242#define IMX6SX_CLK_ENET_PTP_REF 229
243#define IMX6SX_CLK_ENET2_REF 230
244#define IMX6SX_CLK_ENET2_REF_125M 231
245#define IMX6SX_CLK_AUDIO 232
246#define IMX6SX_CLK_LVDS1_SEL 233
247#define IMX6SX_CLK_LVDS1_OUT 234
248#define IMX6SX_CLK_ASRC_IPG 235
249#define IMX6SX_CLK_ASRC_MEM 236
250#define IMX6SX_CLK_SAI1_IPG 237
251#define IMX6SX_CLK_SAI2_IPG 238
252#define IMX6SX_CLK_ESAI_IPG 239
253#define IMX6SX_CLK_ESAI_MEM 240
254#define IMX6SX_CLK_CLK_END 241
255
256#endif /* __DT_BINDINGS_CLOCK_IMX6SX_H */
diff --git a/include/dt-bindings/clock/lsi,axm5516-clks.h b/include/dt-bindings/clock/lsi,axm5516-clks.h
new file mode 100644
index 000000000000..beb41ace5dd6
--- /dev/null
+++ b/include/dt-bindings/clock/lsi,axm5516-clks.h
@@ -0,0 +1,36 @@
1/*
2 * Copyright (c) 2014 LSI Corporation
3 *
4 * This software is licensed under the terms of the GNU General Public
5 * License version 2, as published by the Free Software Foundation, and
6 * may be copied, distributed, and modified under those terms.
7 */
8
9#ifndef _DT_BINDINGS_CLK_AXM5516_H
10#define _DT_BINDINGS_CLK_AXM5516_H
11
12#define AXXIA_CLK_FAB_PLL 0
13#define AXXIA_CLK_CPU_PLL 1
14#define AXXIA_CLK_SYS_PLL 2
15#define AXXIA_CLK_SM0_PLL 3
16#define AXXIA_CLK_SM1_PLL 4
17#define AXXIA_CLK_FAB_DIV 5
18#define AXXIA_CLK_SYS_DIV 6
19#define AXXIA_CLK_NRCP_DIV 7
20#define AXXIA_CLK_CPU0_DIV 8
21#define AXXIA_CLK_CPU1_DIV 9
22#define AXXIA_CLK_CPU2_DIV 10
23#define AXXIA_CLK_CPU3_DIV 11
24#define AXXIA_CLK_PER_DIV 12
25#define AXXIA_CLK_MMC_DIV 13
26#define AXXIA_CLK_FAB 14
27#define AXXIA_CLK_SYS 15
28#define AXXIA_CLK_NRCP 16
29#define AXXIA_CLK_CPU0 17
30#define AXXIA_CLK_CPU1 18
31#define AXXIA_CLK_CPU2 19
32#define AXXIA_CLK_CPU3 20
33#define AXXIA_CLK_PER 21
34#define AXXIA_CLK_MMC 22
35
36#endif
diff --git a/include/dt-bindings/clock/qcom,gcc-msm8960.h b/include/dt-bindings/clock/qcom,gcc-msm8960.h
index 03bbf49d43b7..f9f547146a15 100644
--- a/include/dt-bindings/clock/qcom,gcc-msm8960.h
+++ b/include/dt-bindings/clock/qcom,gcc-msm8960.h
@@ -51,7 +51,7 @@
51#define QDSS_TSCTR_CLK 34 51#define QDSS_TSCTR_CLK 34
52#define SFAB_ADM0_M0_A_CLK 35 52#define SFAB_ADM0_M0_A_CLK 35
53#define SFAB_ADM0_M1_A_CLK 36 53#define SFAB_ADM0_M1_A_CLK 36
54#define SFAB_ADM0_M2_A_CLK 37 54#define SFAB_ADM0_M2_H_CLK 37
55#define ADM0_CLK 38 55#define ADM0_CLK 38
56#define ADM0_PBUS_CLK 39 56#define ADM0_PBUS_CLK 39
57#define MSS_XPU_CLK 40 57#define MSS_XPU_CLK 40
@@ -99,7 +99,7 @@
99#define CFPB2_H_CLK 82 99#define CFPB2_H_CLK 82
100#define SFAB_CFPB_M_H_CLK 83 100#define SFAB_CFPB_M_H_CLK 83
101#define CFPB_MASTER_H_CLK 84 101#define CFPB_MASTER_H_CLK 84
102#define SFAB_CFPB_S_HCLK 85 102#define SFAB_CFPB_S_H_CLK 85
103#define CFPB_SPLITTER_H_CLK 86 103#define CFPB_SPLITTER_H_CLK 86
104#define TSIF_H_CLK 87 104#define TSIF_H_CLK 87
105#define TSIF_INACTIVITY_TIMERS_CLK 88 105#define TSIF_INACTIVITY_TIMERS_CLK 88
@@ -110,7 +110,6 @@
110#define CE1_SLEEP_CLK 93 110#define CE1_SLEEP_CLK 93
111#define CE2_H_CLK 94 111#define CE2_H_CLK 94
112#define CE2_CORE_CLK 95 112#define CE2_CORE_CLK 95
113#define CE2_SLEEP_CLK 96
114#define SFPB_H_CLK_SRC 97 113#define SFPB_H_CLK_SRC 97
115#define SFPB_H_CLK 98 114#define SFPB_H_CLK 98
116#define SFAB_SFPB_M_H_CLK 99 115#define SFAB_SFPB_M_H_CLK 99
@@ -252,7 +251,7 @@
252#define MSS_S_H_CLK 235 251#define MSS_S_H_CLK 235
253#define MSS_CXO_SRC_CLK 236 252#define MSS_CXO_SRC_CLK 236
254#define SATA_H_CLK 237 253#define SATA_H_CLK 237
255#define SATA_SRC_CLK 238 254#define SATA_CLK_SRC 238
256#define SATA_RXOOB_CLK 239 255#define SATA_RXOOB_CLK 239
257#define SATA_PMALIVE_CLK 240 256#define SATA_PMALIVE_CLK 240
258#define SATA_PHY_REF_CLK 241 257#define SATA_PHY_REF_CLK 241
diff --git a/include/dt-bindings/clock/qcom,gcc-msm8974.h b/include/dt-bindings/clock/qcom,gcc-msm8974.h
index 223ca174d9d3..51e51c860fe6 100644
--- a/include/dt-bindings/clock/qcom,gcc-msm8974.h
+++ b/include/dt-bindings/clock/qcom,gcc-msm8974.h
@@ -316,5 +316,9 @@
316#define GCC_CE2_CLK_SLEEP_ENA 299 316#define GCC_CE2_CLK_SLEEP_ENA 299
317#define GCC_CE2_AXI_CLK_SLEEP_ENA 300 317#define GCC_CE2_AXI_CLK_SLEEP_ENA 300
318#define GCC_CE2_AHB_CLK_SLEEP_ENA 301 318#define GCC_CE2_AHB_CLK_SLEEP_ENA 301
319#define GPLL4 302
320#define GPLL4_VOTE 303
321#define GCC_SDCC1_CDCCAL_SLEEP_CLK 304
322#define GCC_SDCC1_CDCCAL_FF_CLK 305
319 323
320#endif 324#endif
diff --git a/include/dt-bindings/clock/r7s72100-clock.h b/include/dt-bindings/clock/r7s72100-clock.h
new file mode 100644
index 000000000000..5128f4d94f44
--- /dev/null
+++ b/include/dt-bindings/clock/r7s72100-clock.h
@@ -0,0 +1,41 @@
1/*
2 * Copyright (C) 2014 Renesas Solutions Corp.
3 * Copyright (C) 2014 Wolfram Sang, Sang Engineering <wsa@sang-engineering.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; version 2 of the License.
8 */
9
10#ifndef __DT_BINDINGS_CLOCK_R7S72100_H__
11#define __DT_BINDINGS_CLOCK_R7S72100_H__
12
13#define R7S72100_CLK_PLL 0
14
15/* MSTP3 */
16#define R7S72100_CLK_MTU2 3
17
18/* MSTP4 */
19#define R7S72100_CLK_SCIF0 7
20#define R7S72100_CLK_SCIF1 6
21#define R7S72100_CLK_SCIF2 5
22#define R7S72100_CLK_SCIF3 4
23#define R7S72100_CLK_SCIF4 3
24#define R7S72100_CLK_SCIF5 2
25#define R7S72100_CLK_SCIF6 1
26#define R7S72100_CLK_SCIF7 0
27
28/* MSTP9 */
29#define R7S72100_CLK_I2C0 7
30#define R7S72100_CLK_I2C1 6
31#define R7S72100_CLK_I2C2 5
32#define R7S72100_CLK_I2C3 4
33
34/* MSTP10 */
35#define R7S72100_CLK_SPI0 7
36#define R7S72100_CLK_SPI1 6
37#define R7S72100_CLK_SPI2 5
38#define R7S72100_CLK_SPI3 4
39#define R7S72100_CLK_SPI4 3
40
41#endif /* __DT_BINDINGS_CLOCK_R7S72100_H__ */
diff --git a/include/dt-bindings/clock/r8a7779-clock.h b/include/dt-bindings/clock/r8a7779-clock.h
new file mode 100644
index 000000000000..381a6114237a
--- /dev/null
+++ b/include/dt-bindings/clock/r8a7779-clock.h
@@ -0,0 +1,64 @@
1/*
2 * Copyright (C) 2013 Horms Solutions Ltd.
3 *
4 * Contact: Simon Horman <horms@verge.net.au>
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 __DT_BINDINGS_CLOCK_R8A7779_H__
13#define __DT_BINDINGS_CLOCK_R8A7779_H__
14
15/* CPG */
16#define R8A7779_CLK_PLLA 0
17#define R8A7779_CLK_Z 1
18#define R8A7779_CLK_ZS 2
19#define R8A7779_CLK_S 3
20#define R8A7779_CLK_S1 4
21#define R8A7779_CLK_P 5
22#define R8A7779_CLK_B 6
23#define R8A7779_CLK_OUT 7
24
25/* MSTP 0 */
26#define R8A7779_CLK_HSPI 7
27#define R8A7779_CLK_TMU2 14
28#define R8A7779_CLK_TMU1 15
29#define R8A7779_CLK_TMU0 16
30#define R8A7779_CLK_HSCIF1 18
31#define R8A7779_CLK_HSCIF0 19
32#define R8A7779_CLK_SCIF5 21
33#define R8A7779_CLK_SCIF4 22
34#define R8A7779_CLK_SCIF3 23
35#define R8A7779_CLK_SCIF2 24
36#define R8A7779_CLK_SCIF1 25
37#define R8A7779_CLK_SCIF0 26
38#define R8A7779_CLK_I2C3 27
39#define R8A7779_CLK_I2C2 28
40#define R8A7779_CLK_I2C1 29
41#define R8A7779_CLK_I2C0 30
42
43/* MSTP 1 */
44#define R8A7779_CLK_USB01 0
45#define R8A7779_CLK_USB2 1
46#define R8A7779_CLK_DU 3
47#define R8A7779_CLK_VIN2 8
48#define R8A7779_CLK_VIN1 9
49#define R8A7779_CLK_VIN0 10
50#define R8A7779_CLK_ETHER 14
51#define R8A7779_CLK_SATA 15
52#define R8A7779_CLK_PCIE 16
53#define R8A7779_CLK_VIN3 20
54
55/* MSTP 3 */
56#define R8A7779_CLK_SDHI3 20
57#define R8A7779_CLK_SDHI2 21
58#define R8A7779_CLK_SDHI1 22
59#define R8A7779_CLK_SDHI0 23
60#define R8A7779_CLK_MMC1 30
61#define R8A7779_CLK_MMC0 31
62
63
64#endif /* __DT_BINDINGS_CLOCK_R8A7779_H__ */
diff --git a/include/dt-bindings/clock/r8a7790-clock.h b/include/dt-bindings/clock/r8a7790-clock.h
index 6548a5fbcf4a..1118f7a4bca6 100644
--- a/include/dt-bindings/clock/r8a7790-clock.h
+++ b/include/dt-bindings/clock/r8a7790-clock.h
@@ -33,8 +33,8 @@
33#define R8A7790_CLK_TMU0 25 33#define R8A7790_CLK_TMU0 25
34#define R8A7790_CLK_VSP1_DU1 27 34#define R8A7790_CLK_VSP1_DU1 27
35#define R8A7790_CLK_VSP1_DU0 28 35#define R8A7790_CLK_VSP1_DU0 28
36#define R8A7790_CLK_VSP1_RT 30 36#define R8A7790_CLK_VSP1_R 30
37#define R8A7790_CLK_VSP1_SY 31 37#define R8A7790_CLK_VSP1_S 31
38 38
39/* MSTP2 */ 39/* MSTP2 */
40#define R8A7790_CLK_SCIFA2 2 40#define R8A7790_CLK_SCIFA2 2
@@ -50,6 +50,7 @@
50#define R8A7790_CLK_SYS_DMAC0 19 50#define R8A7790_CLK_SYS_DMAC0 19
51 51
52/* MSTP3 */ 52/* MSTP3 */
53#define R8A7790_CLK_IIC2 0
53#define R8A7790_CLK_TPU0 4 54#define R8A7790_CLK_TPU0 4
54#define R8A7790_CLK_MMCIF1 5 55#define R8A7790_CLK_MMCIF1 5
55#define R8A7790_CLK_SDHI3 11 56#define R8A7790_CLK_SDHI3 11
@@ -57,6 +58,8 @@
57#define R8A7790_CLK_SDHI1 13 58#define R8A7790_CLK_SDHI1 13
58#define R8A7790_CLK_SDHI0 14 59#define R8A7790_CLK_SDHI0 14
59#define R8A7790_CLK_MMCIF0 15 60#define R8A7790_CLK_MMCIF0 15
61#define R8A7790_CLK_IIC0 18
62#define R8A7790_CLK_IIC1 23
60#define R8A7790_CLK_SSUSB 28 63#define R8A7790_CLK_SSUSB 28
61#define R8A7790_CLK_CMT1 29 64#define R8A7790_CLK_CMT1 29
62#define R8A7790_CLK_USBDMAC0 30 65#define R8A7790_CLK_USBDMAC0 30
diff --git a/include/dt-bindings/clock/r8a7791-clock.h b/include/dt-bindings/clock/r8a7791-clock.h
index 30f82f286e29..b050d18437ce 100644
--- a/include/dt-bindings/clock/r8a7791-clock.h
+++ b/include/dt-bindings/clock/r8a7791-clock.h
@@ -32,7 +32,7 @@
32#define R8A7791_CLK_TMU0 25 32#define R8A7791_CLK_TMU0 25
33#define R8A7791_CLK_VSP1_DU1 27 33#define R8A7791_CLK_VSP1_DU1 27
34#define R8A7791_CLK_VSP1_DU0 28 34#define R8A7791_CLK_VSP1_DU0 28
35#define R8A7791_CLK_VSP1_SY 31 35#define R8A7791_CLK_VSP1_S 31
36 36
37/* MSTP2 */ 37/* MSTP2 */
38#define R8A7791_CLK_SCIFA2 2 38#define R8A7791_CLK_SCIFA2 2
@@ -43,7 +43,8 @@
43#define R8A7791_CLK_SCIFB1 7 43#define R8A7791_CLK_SCIFB1 7
44#define R8A7791_CLK_MSIOF1 8 44#define R8A7791_CLK_MSIOF1 8
45#define R8A7791_CLK_SCIFB2 16 45#define R8A7791_CLK_SCIFB2 16
46#define R8A7791_CLK_DMAC 18 46#define R8A7791_CLK_SYS_DMAC1 18
47#define R8A7791_CLK_SYS_DMAC0 19
47 48
48/* MSTP3 */ 49/* MSTP3 */
49#define R8A7791_CLK_TPU0 4 50#define R8A7791_CLK_TPU0 4
@@ -51,6 +52,8 @@
51#define R8A7791_CLK_SDHI1 12 52#define R8A7791_CLK_SDHI1 12
52#define R8A7791_CLK_SDHI0 14 53#define R8A7791_CLK_SDHI0 14
53#define R8A7791_CLK_MMCIF0 15 54#define R8A7791_CLK_MMCIF0 15
55#define R8A7791_CLK_IIC0 18
56#define R8A7791_CLK_IIC1 23
54#define R8A7791_CLK_SSUSB 28 57#define R8A7791_CLK_SSUSB 28
55#define R8A7791_CLK_CMT1 29 58#define R8A7791_CLK_CMT1 29
56#define R8A7791_CLK_USBDMAC0 30 59#define R8A7791_CLK_USBDMAC0 30
@@ -61,6 +64,7 @@
61#define R8A7791_CLK_PWM 23 64#define R8A7791_CLK_PWM 23
62 65
63/* MSTP7 */ 66/* MSTP7 */
67#define R8A7791_CLK_EHCI 3
64#define R8A7791_CLK_HSUSB 4 68#define R8A7791_CLK_HSUSB 4
65#define R8A7791_CLK_HSCIF2 13 69#define R8A7791_CLK_HSCIF2 13
66#define R8A7791_CLK_SCIF5 14 70#define R8A7791_CLK_SCIF5 14
diff --git a/include/dt-bindings/clock/s3c2410.h b/include/dt-bindings/clock/s3c2410.h
new file mode 100644
index 000000000000..352a7673fc69
--- /dev/null
+++ b/include/dt-bindings/clock/s3c2410.h
@@ -0,0 +1,62 @@
1/*
2 * Copyright (c) 2013 Heiko Stuebner <heiko@sntech.de>
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 * Device Tree binding constants clock controllers of Samsung S3C2410 and later.
9 */
10
11#ifndef _DT_BINDINGS_CLOCK_SAMSUNG_S3C2410_CLOCK_H
12#define _DT_BINDINGS_CLOCK_SAMSUNG_S3C2410_CLOCK_H
13
14/*
15 * Let each exported clock get a unique index, which is used on DT-enabled
16 * platforms to lookup the clock from a clock specifier. These indices are
17 * therefore considered an ABI and so must not be changed. This implies
18 * that new clocks should be added either in free spaces between clock groups
19 * or at the end.
20 */
21
22/* Core clocks. */
23
24/* id 1 is reserved */
25#define MPLL 2
26#define UPLL 3
27#define FCLK 4
28#define HCLK 5
29#define PCLK 6
30#define UCLK 7
31#define ARMCLK 8
32
33/* pclk-gates */
34#define PCLK_UART0 16
35#define PCLK_UART1 17
36#define PCLK_UART2 18
37#define PCLK_I2C 19
38#define PCLK_SDI 20
39#define PCLK_SPI 21
40#define PCLK_ADC 22
41#define PCLK_AC97 23
42#define PCLK_I2S 24
43#define PCLK_PWM 25
44#define PCLK_RTC 26
45#define PCLK_GPIO 27
46
47
48/* hclk-gates */
49#define HCLK_LCD 32
50#define HCLK_USBH 33
51#define HCLK_USBD 34
52#define HCLK_NAND 35
53#define HCLK_CAM 36
54
55
56#define CAMIF 40
57
58
59/* Total number of clocks. */
60#define NR_CLKS (CAMIF + 1)
61
62#endif /* _DT_BINDINGS_CLOCK_SAMSUNG_S3C2443_CLOCK_H */
diff --git a/include/dt-bindings/clock/s3c2412.h b/include/dt-bindings/clock/s3c2412.h
new file mode 100644
index 000000000000..aac1dcfda81c
--- /dev/null
+++ b/include/dt-bindings/clock/s3c2412.h
@@ -0,0 +1,73 @@
1/*
2 * Copyright (c) 2013 Heiko Stuebner <heiko@sntech.de>
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 * Device Tree binding constants clock controllers of Samsung S3C2412.
9 */
10
11#ifndef _DT_BINDINGS_CLOCK_SAMSUNG_S3C2412_CLOCK_H
12#define _DT_BINDINGS_CLOCK_SAMSUNG_S3C2412_CLOCK_H
13
14/*
15 * Let each exported clock get a unique index, which is used on DT-enabled
16 * platforms to lookup the clock from a clock specifier. These indices are
17 * therefore considered an ABI and so must not be changed. This implies
18 * that new clocks should be added either in free spaces between clock groups
19 * or at the end.
20 */
21
22/* Core clocks. */
23
24/* id 1 is reserved */
25#define MPLL 2
26#define UPLL 3
27#define MDIVCLK 4
28#define MSYSCLK 5
29#define USYSCLK 6
30#define HCLK 7
31#define PCLK 8
32#define ARMDIV 9
33#define ARMCLK 10
34
35
36/* Special clocks */
37#define SCLK_CAM 16
38#define SCLK_UART 17
39#define SCLK_I2S 18
40#define SCLK_USBD 19
41#define SCLK_USBH 20
42
43/* pclk-gates */
44#define PCLK_WDT 32
45#define PCLK_SPI 33
46#define PCLK_I2S 34
47#define PCLK_I2C 35
48#define PCLK_ADC 36
49#define PCLK_RTC 37
50#define PCLK_GPIO 38
51#define PCLK_UART2 39
52#define PCLK_UART1 40
53#define PCLK_UART0 41
54#define PCLK_SDI 42
55#define PCLK_PWM 43
56#define PCLK_USBD 44
57
58/* hclk-gates */
59#define HCLK_HALF 48
60#define HCLK_X2 49
61#define HCLK_SDRAM 50
62#define HCLK_USBH 51
63#define HCLK_LCD 52
64#define HCLK_NAND 53
65#define HCLK_DMA3 54
66#define HCLK_DMA2 55
67#define HCLK_DMA1 56
68#define HCLK_DMA0 57
69
70/* Total number of clocks. */
71#define NR_CLKS (HCLK_DMA0 + 1)
72
73#endif /* _DT_BINDINGS_CLOCK_SAMSUNG_S3C2412_CLOCK_H */
diff --git a/include/dt-bindings/clock/s3c2443.h b/include/dt-bindings/clock/s3c2443.h
new file mode 100644
index 000000000000..37e66b054d64
--- /dev/null
+++ b/include/dt-bindings/clock/s3c2443.h
@@ -0,0 +1,92 @@
1/*
2 * Copyright (c) 2013 Heiko Stuebner <heiko@sntech.de>
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 * Device Tree binding constants clock controllers of Samsung S3C2443 and later.
9 */
10
11#ifndef _DT_BINDINGS_CLOCK_SAMSUNG_S3C2443_CLOCK_H
12#define _DT_BINDINGS_CLOCK_SAMSUNG_S3C2443_CLOCK_H
13
14/*
15 * Let each exported clock get a unique index, which is used on DT-enabled
16 * platforms to lookup the clock from a clock specifier. These indices are
17 * therefore considered an ABI and so must not be changed. This implies
18 * that new clocks should be added either in free spaces between clock groups
19 * or at the end.
20 */
21
22/* Core clocks. */
23#define MSYSCLK 1
24#define ESYSCLK 2
25#define ARMDIV 3
26#define ARMCLK 4
27#define HCLK 5
28#define PCLK 6
29
30/* Special clocks */
31#define SCLK_HSSPI0 16
32#define SCLK_FIMD 17
33#define SCLK_I2S0 18
34#define SCLK_I2S1 19
35#define SCLK_HSMMC1 20
36#define SCLK_HSMMC_EXT 21
37#define SCLK_CAM 22
38#define SCLK_UART 23
39#define SCLK_USBH 24
40
41/* Muxes */
42#define MUX_HSSPI0 32
43#define MUX_HSSPI1 33
44#define MUX_HSMMC0 34
45#define MUX_HSMMC1 35
46
47/* hclk-gates */
48#define HCLK_DMA0 48
49#define HCLK_DMA1 49
50#define HCLK_DMA2 50
51#define HCLK_DMA3 51
52#define HCLK_DMA4 52
53#define HCLK_DMA5 53
54#define HCLK_DMA6 54
55#define HCLK_DMA7 55
56#define HCLK_CAM 56
57#define HCLK_LCD 57
58#define HCLK_USBH 58
59#define HCLK_USBD 59
60#define HCLK_IROM 60
61#define HCLK_HSMMC0 61
62#define HCLK_HSMMC1 62
63#define HCLK_CFC 63
64#define HCLK_SSMC 64
65#define HCLK_DRAM 65
66#define HCLK_2D 66
67
68/* pclk-gates */
69#define PCLK_UART0 72
70#define PCLK_UART1 73
71#define PCLK_UART2 74
72#define PCLK_UART3 75
73#define PCLK_I2C0 76
74#define PCLK_SDI 77
75#define PCLK_SPI0 78
76#define PCLK_ADC 79
77#define PCLK_AC97 80
78#define PCLK_I2S0 81
79#define PCLK_PWM 82
80#define PCLK_WDT 83
81#define PCLK_RTC 84
82#define PCLK_GPIO 85
83#define PCLK_SPI1 86
84#define PCLK_CHIPID 87
85#define PCLK_I2C1 88
86#define PCLK_I2S1 89
87#define PCLK_PCM 90
88
89/* Total number of clocks. */
90#define NR_CLKS (PCLK_PCM + 1)
91
92#endif /* _DT_BINDINGS_CLOCK_SAMSUNG_S3C2443_CLOCK_H */
diff --git a/include/dt-bindings/clock/stih415-clks.h b/include/dt-bindings/clock/stih415-clks.h
new file mode 100644
index 000000000000..d80caa68aebd
--- /dev/null
+++ b/include/dt-bindings/clock/stih415-clks.h
@@ -0,0 +1,16 @@
1/*
2 * This header provides constants clk index STMicroelectronics
3 * STiH415 SoC.
4 */
5#ifndef _CLK_STIH415
6#define _CLK_STIH415
7
8/* CLOCKGEN A0 */
9#define CLK_ICN_REG 0
10#define CLK_ETH1_PHY 4
11
12/* CLOCKGEN A1 */
13#define CLK_ICN_IF_2 0
14#define CLK_GMAC0_PHY 3
15
16#endif
diff --git a/include/dt-bindings/clock/stih416-clks.h b/include/dt-bindings/clock/stih416-clks.h
new file mode 100644
index 000000000000..f9bdbd13568d
--- /dev/null
+++ b/include/dt-bindings/clock/stih416-clks.h
@@ -0,0 +1,16 @@
1/*
2 * This header provides constants clk index STMicroelectronics
3 * STiH416 SoC.
4 */
5#ifndef _CLK_STIH416
6#define _CLK_STIH416
7
8/* CLOCKGEN A0 */
9#define CLK_ICN_REG 0
10#define CLK_ETH1_PHY 4
11
12/* CLOCKGEN A1 */
13#define CLK_ICN_IF_2 0
14#define CLK_GMAC0_PHY 3
15
16#endif
diff --git a/include/dt-bindings/clock/tegra114-car.h b/include/dt-bindings/clock/tegra114-car.h
index 6d0d8d8ef31e..fc12621fb432 100644
--- a/include/dt-bindings/clock/tegra114-car.h
+++ b/include/dt-bindings/clock/tegra114-car.h
@@ -337,6 +337,7 @@
337#define TEGRA114_CLK_CLK_OUT_3_MUX 308 337#define TEGRA114_CLK_CLK_OUT_3_MUX 308
338#define TEGRA114_CLK_DSIA_MUX 309 338#define TEGRA114_CLK_DSIA_MUX 309
339#define TEGRA114_CLK_DSIB_MUX 310 339#define TEGRA114_CLK_DSIB_MUX 310
340#define TEGRA114_CLK_CLK_MAX 311 340#define TEGRA114_CLK_XUSB_SS_DIV2 311
341#define TEGRA114_CLK_CLK_MAX 312
341 342
342#endif /* _DT_BINDINGS_CLOCK_TEGRA114_CAR_H */ 343#endif /* _DT_BINDINGS_CLOCK_TEGRA114_CAR_H */
diff --git a/include/dt-bindings/clock/tegra124-car.h b/include/dt-bindings/clock/tegra124-car.h
index 433528ab5161..8a4c5892890f 100644
--- a/include/dt-bindings/clock/tegra124-car.h
+++ b/include/dt-bindings/clock/tegra124-car.h
@@ -336,6 +336,7 @@
336#define TEGRA124_CLK_DSIA_MUX 309 336#define TEGRA124_CLK_DSIA_MUX 309
337#define TEGRA124_CLK_DSIB_MUX 310 337#define TEGRA124_CLK_DSIB_MUX 310
338#define TEGRA124_CLK_SOR0_LVDS 311 338#define TEGRA124_CLK_SOR0_LVDS 311
339#define TEGRA124_CLK_CLK_MAX 312 339#define TEGRA124_CLK_XUSB_SS_DIV2 312
340#define TEGRA124_CLK_CLK_MAX 313
340 341
341#endif /* _DT_BINDINGS_CLOCK_TEGRA124_CAR_H */ 342#endif /* _DT_BINDINGS_CLOCK_TEGRA124_CAR_H */
diff --git a/include/dt-bindings/pinctrl/omap.h b/include/dt-bindings/pinctrl/omap.h
index b04528cd033c..1c75b8ca5228 100644
--- a/include/dt-bindings/pinctrl/omap.h
+++ b/include/dt-bindings/pinctrl/omap.h
@@ -62,12 +62,29 @@
62#define OMAP3630_CORE2_IOPAD(pa, val) OMAP_IOPAD_OFFSET((pa), 0x25a0) (val) 62#define OMAP3630_CORE2_IOPAD(pa, val) OMAP_IOPAD_OFFSET((pa), 0x25a0) (val)
63#define OMAP3_WKUP_IOPAD(pa, val) OMAP_IOPAD_OFFSET((pa), 0x2a00) (val) 63#define OMAP3_WKUP_IOPAD(pa, val) OMAP_IOPAD_OFFSET((pa), 0x2a00) (val)
64#define AM33XX_IOPAD(pa, val) OMAP_IOPAD_OFFSET((pa), 0x0800) (val) 64#define AM33XX_IOPAD(pa, val) OMAP_IOPAD_OFFSET((pa), 0x0800) (val)
65#define OMAP4_CORE_IOPAD(pa, val) OMAP_IOPAD_OFFSET((pa), 0x0040) (val)
66#define OMAP4_WKUP_IOPAD(pa, val) OMAP_IOPAD_OFFSET((pa), 0xe040) (val)
67#define AM4372_IOPAD(pa, val) OMAP_IOPAD_OFFSET((pa), 0x0800) (val) 65#define AM4372_IOPAD(pa, val) OMAP_IOPAD_OFFSET((pa), 0x0800) (val)
68#define OMAP5_CORE_IOPAD(pa, val) OMAP_IOPAD_OFFSET((pa), 0x2840) (val)
69#define OMAP5_WKUP_IOPAD(pa, val) OMAP_IOPAD_OFFSET((pa), 0xc840) (val)
70#define DRA7XX_CORE_IOPAD(pa, val) OMAP_IOPAD_OFFSET((pa), 0x3400) (val) 66#define DRA7XX_CORE_IOPAD(pa, val) OMAP_IOPAD_OFFSET((pa), 0x3400) (val)
71 67
68/*
69 * Macros to allow using the offset from the padconf physical address
70 * instead of the offset from padconf base.
71 */
72#define OMAP_PADCONF_OFFSET(offset, base_offset) ((offset) - (base_offset))
73
74#define OMAP4_IOPAD(offset, val) OMAP_PADCONF_OFFSET((offset), 0x0040) (val)
75#define OMAP5_IOPAD(offset, val) OMAP_PADCONF_OFFSET((offset), 0x0040) (val)
76
77/*
78 * Define some commonly used pins configured by the boards.
79 * Note that some boards use alternative pins, so check
80 * the schematics before using these.
81 */
82#define OMAP3_UART1_RX 0x152
83#define OMAP3_UART2_RX 0x14a
84#define OMAP3_UART3_RX 0x16e
85#define OMAP4_UART2_RX 0xdc
86#define OMAP4_UART3_RX 0x104
87#define OMAP4_UART4_RX 0x11c
88
72#endif 89#endif
73 90
diff --git a/include/dt-bindings/reset-controller/stih415-resets.h b/include/dt-bindings/reset-controller/stih415-resets.h
index c2f8a66913c5..c2329fe29cf6 100644
--- a/include/dt-bindings/reset-controller/stih415-resets.h
+++ b/include/dt-bindings/reset-controller/stih415-resets.h
@@ -22,5 +22,6 @@
22#define STIH415_USB0_SOFTRESET 3 22#define STIH415_USB0_SOFTRESET 3
23#define STIH415_USB1_SOFTRESET 4 23#define STIH415_USB1_SOFTRESET 4
24#define STIH415_USB2_SOFTRESET 5 24#define STIH415_USB2_SOFTRESET 5
25#define STIH415_KEYSCAN_SOFTRESET 6
25 26
26#endif /* _DT_BINDINGS_RESET_CONTROLLER_STIH415 */ 27#endif /* _DT_BINDINGS_RESET_CONTROLLER_STIH415 */
diff --git a/include/dt-bindings/reset-controller/stih416-resets.h b/include/dt-bindings/reset-controller/stih416-resets.h
index 2127743f23e3..fcf9af1ac0b2 100644
--- a/include/dt-bindings/reset-controller/stih416-resets.h
+++ b/include/dt-bindings/reset-controller/stih416-resets.h
@@ -46,5 +46,6 @@
46#define STIH416_COMPO_A_SOFTRESET 25 46#define STIH416_COMPO_A_SOFTRESET 25
47#define STIH416_VP8_DEC_SOFTRESET 26 47#define STIH416_VP8_DEC_SOFTRESET 26
48#define STIH416_VTG_MAIN_SOFTRESET 27 48#define STIH416_VTG_MAIN_SOFTRESET 27
49#define STIH416_KEYSCAN_SOFTRESET 28
49 50
50#endif /* _DT_BINDINGS_RESET_CONTROLLER_STIH416 */ 51#endif /* _DT_BINDINGS_RESET_CONTROLLER_STIH416 */
diff --git a/include/dt-bindings/reset/altr,rst-mgr.h b/include/dt-bindings/reset/altr,rst-mgr.h
new file mode 100644
index 000000000000..3f04908fb87c
--- /dev/null
+++ b/include/dt-bindings/reset/altr,rst-mgr.h
@@ -0,0 +1,90 @@
1/*
2 * Copyright (c) 2014, Steffen Trumtrar <s.trumtrar@pengutronix.de>
3 *
4 * This software is licensed under the terms of the GNU General Public
5 * License version 2, as published by the Free Software Foundation, and
6 * may be copied, distributed, and modified under those terms.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 */
13
14#ifndef _DT_BINDINGS_RESET_ALTR_RST_MGR_H
15#define _DT_BINDINGS_RESET_ALTR_RST_MGR_H
16
17/* MPUMODRST */
18#define CPU0_RESET 0
19#define CPU1_RESET 1
20#define WDS_RESET 2
21#define SCUPER_RESET 3
22#define L2_RESET 4
23
24/* PERMODRST */
25#define EMAC0_RESET 32
26#define EMAC1_RESET 33
27#define USB0_RESET 34
28#define USB1_RESET 35
29#define NAND_RESET 36
30#define QSPI_RESET 37
31#define L4WD0_RESET 38
32#define L4WD1_RESET 39
33#define OSC1TIMER0_RESET 40
34#define OSC1TIMER1_RESET 41
35#define SPTIMER0_RESET 42
36#define SPTIMER1_RESET 43
37#define I2C0_RESET 44
38#define I2C1_RESET 45
39#define I2C2_RESET 46
40#define I2C3_RESET 47
41#define UART0_RESET 48
42#define UART1_RESET 49
43#define SPIM0_RESET 50
44#define SPIM1_RESET 51
45#define SPIS0_RESET 52
46#define SPIS1_RESET 53
47#define SDMMC_RESET 54
48#define CAN0_RESET 55
49#define CAN1_RESET 56
50#define GPIO0_RESET 57
51#define GPIO1_RESET 58
52#define GPIO2_RESET 59
53#define DMA_RESET 60
54#define SDR_RESET 61
55
56/* PER2MODRST */
57#define DMAIF0_RESET 64
58#define DMAIF1_RESET 65
59#define DMAIF2_RESET 66
60#define DMAIF3_RESET 67
61#define DMAIF4_RESET 68
62#define DMAIF5_RESET 69
63#define DMAIF6_RESET 70
64#define DMAIF7_RESET 71
65
66/* BRGMODRST */
67#define HPS2FPGA_RESET 96
68#define LWHPS2FPGA_RESET 97
69#define FPGA2HPS_RESET 98
70
71/* MISCMODRST*/
72#define ROM_RESET 128
73#define OCRAM_RESET 129
74#define SYSMGR_RESET 130
75#define SYSMGRCOLD_RESET 131
76#define FPGAMGR_RESET 132
77#define ACPIDMAP_RESET 133
78#define S2F_RESET 134
79#define S2FCOLD_RESET 135
80#define NRSTPIN_RESET 136
81#define TIMESTAMPCOLD_RESET 137
82#define CLKMGRCOLD_RESET 138
83#define SCANMGR_RESET 139
84#define FRZCTRLCOLD_RESET 140
85#define SYSDBG_RESET 141
86#define DBG_RESET 142
87#define TAPCOLD_RESET 143
88#define SDRCOLD_RESET 144
89
90#endif
diff --git a/include/dt-bindings/reset/qcom,gcc-msm8960.h b/include/dt-bindings/reset/qcom,gcc-msm8960.h
index a840e680323c..07edd0e65eed 100644
--- a/include/dt-bindings/reset/qcom,gcc-msm8960.h
+++ b/include/dt-bindings/reset/qcom,gcc-msm8960.h
@@ -58,7 +58,7 @@
58#define PPSS_PROC_RESET 41 58#define PPSS_PROC_RESET 41
59#define PPSS_RESET 42 59#define PPSS_RESET 42
60#define DMA_BAM_RESET 43 60#define DMA_BAM_RESET 43
61#define SIC_TIC_RESET 44 61#define SPS_TIC_H_RESET 44
62#define SLIMBUS_H_RESET 45 62#define SLIMBUS_H_RESET 45
63#define SFAB_CFPB_M_RESET 46 63#define SFAB_CFPB_M_RESET 46
64#define SFAB_CFPB_S_RESET 47 64#define SFAB_CFPB_S_RESET 47
diff --git a/include/dt-bindings/soc/qcom,gsbi.h b/include/dt-bindings/soc/qcom,gsbi.h
new file mode 100644
index 000000000000..7ac4292333aa
--- /dev/null
+++ b/include/dt-bindings/soc/qcom,gsbi.h
@@ -0,0 +1,26 @@
1/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 */
12#ifndef __DT_BINDINGS_QCOM_GSBI_H
13#define __DT_BINDINGS_QCOM_GSBI_H
14
15#define GSBI_PROT_IDLE 0
16#define GSBI_PROT_I2C_UIM 1
17#define GSBI_PROT_I2C 2
18#define GSBI_PROT_SPI 3
19#define GSBI_PROT_UART_W_FC 4
20#define GSBI_PROT_UIM 5
21#define GSBI_PROT_I2C_UART 6
22
23#define GSBI_CRCI_QUP 0
24#define GSBI_CRCI_UART 1
25
26#endif
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 7a8f2cd66c8b..358c01b971db 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -37,6 +37,7 @@
37 37
38#include <linux/list.h> 38#include <linux/list.h>
39#include <linux/mod_devicetable.h> 39#include <linux/mod_devicetable.h>
40#include <linux/dynamic_debug.h>
40 41
41#include <acpi/acpi.h> 42#include <acpi/acpi.h>
42#include <acpi/acpi_bus.h> 43#include <acpi/acpi_bus.h>
@@ -184,6 +185,8 @@ extern int ec_transaction(u8 command,
184 u8 *rdata, unsigned rdata_len); 185 u8 *rdata, unsigned rdata_len);
185extern acpi_handle ec_get_handle(void); 186extern acpi_handle ec_get_handle(void);
186 187
188extern bool acpi_is_pnp_device(struct acpi_device *);
189
187#if defined(CONFIG_ACPI_WMI) || defined(CONFIG_ACPI_WMI_MODULE) 190#if defined(CONFIG_ACPI_WMI) || defined(CONFIG_ACPI_WMI_MODULE)
188 191
189typedef void (*wmi_notify_handler) (u32 value, void *context); 192typedef void (*wmi_notify_handler) (u32 value, void *context);
@@ -554,14 +557,20 @@ static inline int acpi_subsys_runtime_resume(struct device *dev) { return 0; }
554int acpi_dev_suspend_late(struct device *dev); 557int acpi_dev_suspend_late(struct device *dev);
555int acpi_dev_resume_early(struct device *dev); 558int acpi_dev_resume_early(struct device *dev);
556int acpi_subsys_prepare(struct device *dev); 559int acpi_subsys_prepare(struct device *dev);
560void acpi_subsys_complete(struct device *dev);
557int acpi_subsys_suspend_late(struct device *dev); 561int acpi_subsys_suspend_late(struct device *dev);
558int acpi_subsys_resume_early(struct device *dev); 562int acpi_subsys_resume_early(struct device *dev);
563int acpi_subsys_suspend(struct device *dev);
564int acpi_subsys_freeze(struct device *dev);
559#else 565#else
560static inline int acpi_dev_suspend_late(struct device *dev) { return 0; } 566static inline int acpi_dev_suspend_late(struct device *dev) { return 0; }
561static inline int acpi_dev_resume_early(struct device *dev) { return 0; } 567static inline int acpi_dev_resume_early(struct device *dev) { return 0; }
562static inline int acpi_subsys_prepare(struct device *dev) { return 0; } 568static inline int acpi_subsys_prepare(struct device *dev) { return 0; }
569static inline void acpi_subsys_complete(struct device *dev) {}
563static inline int acpi_subsys_suspend_late(struct device *dev) { return 0; } 570static inline int acpi_subsys_suspend_late(struct device *dev) { return 0; }
564static inline int acpi_subsys_resume_early(struct device *dev) { return 0; } 571static inline int acpi_subsys_resume_early(struct device *dev) { return 0; }
572static inline int acpi_subsys_suspend(struct device *dev) { return 0; }
573static inline int acpi_subsys_freeze(struct device *dev) { return 0; }
565#endif 574#endif
566 575
567#if defined(CONFIG_ACPI) && defined(CONFIG_PM) 576#if defined(CONFIG_ACPI) && defined(CONFIG_PM)
@@ -589,6 +598,14 @@ static inline __printf(3, 4) void
589acpi_handle_printk(const char *level, void *handle, const char *fmt, ...) {} 598acpi_handle_printk(const char *level, void *handle, const char *fmt, ...) {}
590#endif /* !CONFIG_ACPI */ 599#endif /* !CONFIG_ACPI */
591 600
601#if defined(CONFIG_ACPI) && defined(CONFIG_DYNAMIC_DEBUG)
602__printf(3, 4)
603void __acpi_handle_debug(struct _ddebug *descriptor, acpi_handle handle, const char *fmt, ...);
604#else
605#define __acpi_handle_debug(descriptor, handle, fmt, ...) \
606 acpi_handle_printk(KERN_DEBUG, handle, fmt, ##__VA_ARGS__);
607#endif
608
592/* 609/*
593 * acpi_handle_<level>: Print message with ACPI prefix and object path 610 * acpi_handle_<level>: Print message with ACPI prefix and object path
594 * 611 *
@@ -610,11 +627,19 @@ acpi_handle_printk(const char *level, void *handle, const char *fmt, ...) {}
610#define acpi_handle_info(handle, fmt, ...) \ 627#define acpi_handle_info(handle, fmt, ...) \
611 acpi_handle_printk(KERN_INFO, handle, fmt, ##__VA_ARGS__) 628 acpi_handle_printk(KERN_INFO, handle, fmt, ##__VA_ARGS__)
612 629
613/* REVISIT: Support CONFIG_DYNAMIC_DEBUG when necessary */ 630#if defined(DEBUG)
614#if defined(DEBUG) || defined(CONFIG_DYNAMIC_DEBUG)
615#define acpi_handle_debug(handle, fmt, ...) \ 631#define acpi_handle_debug(handle, fmt, ...) \
616 acpi_handle_printk(KERN_DEBUG, handle, fmt, ##__VA_ARGS__) 632 acpi_handle_printk(KERN_DEBUG, handle, fmt, ##__VA_ARGS__)
617#else 633#else
634#if defined(CONFIG_DYNAMIC_DEBUG)
635#define acpi_handle_debug(handle, fmt, ...) \
636do { \
637 DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \
638 if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT)) \
639 __acpi_handle_debug(&descriptor, handle, pr_fmt(fmt), \
640 ##__VA_ARGS__); \
641} while (0)
642#else
618#define acpi_handle_debug(handle, fmt, ...) \ 643#define acpi_handle_debug(handle, fmt, ...) \
619({ \ 644({ \
620 if (0) \ 645 if (0) \
@@ -622,5 +647,6 @@ acpi_handle_printk(const char *level, void *handle, const char *fmt, ...) {}
622 0; \ 647 0; \
623}) 648})
624#endif 649#endif
650#endif
625 651
626#endif /*_LINUX_ACPI_H*/ 652#endif /*_LINUX_ACPI_H*/
diff --git a/include/linux/ahci_platform.h b/include/linux/ahci_platform.h
index 1f16d502600c..6dfd51a04d77 100644
--- a/include/linux/ahci_platform.h
+++ b/include/linux/ahci_platform.h
@@ -44,6 +44,7 @@ struct ahci_host_priv *ahci_platform_get_resources(
44int ahci_platform_init_host(struct platform_device *pdev, 44int ahci_platform_init_host(struct platform_device *pdev,
45 struct ahci_host_priv *hpriv, 45 struct ahci_host_priv *hpriv,
46 const struct ata_port_info *pi_template, 46 const struct ata_port_info *pi_template,
47 unsigned long host_flags,
47 unsigned int force_port_map, 48 unsigned int force_port_map,
48 unsigned int mask_port_map); 49 unsigned int mask_port_map);
49 50
diff --git a/include/linux/amba/bus.h b/include/linux/amba/bus.h
index 63b5eff0a80f..fdd7e1b61f60 100644
--- a/include/linux/amba/bus.h
+++ b/include/linux/amba/bus.h
@@ -47,6 +47,7 @@ struct amba_driver {
47enum amba_vendor { 47enum amba_vendor {
48 AMBA_VENDOR_ARM = 0x41, 48 AMBA_VENDOR_ARM = 0x41,
49 AMBA_VENDOR_ST = 0x80, 49 AMBA_VENDOR_ST = 0x80,
50 AMBA_VENDOR_QCOM = 0x51,
50}; 51};
51 52
52extern struct bus_type amba_bustype; 53extern struct bus_type amba_bustype;
diff --git a/include/linux/amba/mmci.h b/include/linux/amba/mmci.h
index 32a89cf5ec45..8c98113069ce 100644
--- a/include/linux/amba/mmci.h
+++ b/include/linux/amba/mmci.h
@@ -6,28 +6,9 @@
6 6
7#include <linux/mmc/host.h> 7#include <linux/mmc/host.h>
8 8
9
10/*
11 * These defines is places here due to access is needed from machine
12 * configuration files. The ST Micro version does not have ROD and
13 * reuse the voltage registers for direction settings.
14 */
15#define MCI_ST_DATA2DIREN (1 << 2)
16#define MCI_ST_CMDDIREN (1 << 3)
17#define MCI_ST_DATA0DIREN (1 << 4)
18#define MCI_ST_DATA31DIREN (1 << 5)
19#define MCI_ST_FBCLKEN (1 << 7)
20#define MCI_ST_DATA74DIREN (1 << 8)
21
22/* Just some dummy forwarding */
23struct dma_chan;
24
25/** 9/**
26 * struct mmci_platform_data - platform configuration for the MMCI 10 * struct mmci_platform_data - platform configuration for the MMCI
27 * (also known as PL180) block. 11 * (also known as PL180) block.
28 * @f_max: the maximum operational frequency for this host in this
29 * platform configuration. When this is specified it takes precedence
30 * over the module parameter for the same frequency.
31 * @ocr_mask: available voltages on the 4 pins from the block, this 12 * @ocr_mask: available voltages on the 4 pins from the block, this
32 * is ignored if a regulator is used, see the MMC_VDD_* masks in 13 * is ignored if a regulator is used, see the MMC_VDD_* masks in
33 * mmc/host.h 14 * mmc/host.h
@@ -42,37 +23,14 @@ struct dma_chan;
42 * @gpio_wp: read this GPIO pin to see if the card is write protected 23 * @gpio_wp: read this GPIO pin to see if the card is write protected
43 * @gpio_cd: read this GPIO pin to detect card insertion 24 * @gpio_cd: read this GPIO pin to detect card insertion
44 * @cd_invert: true if the gpio_cd pin value is active low 25 * @cd_invert: true if the gpio_cd pin value is active low
45 * @capabilities: the capabilities of the block as implemented in
46 * this platform, signify anything MMC_CAP_* from mmc/host.h
47 * @capabilities2: more capabilities, MMC_CAP2_* from mmc/host.h
48 * @sigdir: a bit field indicating for what bits in the MMC bus the host
49 * should enable signal direction indication.
50 * @dma_filter: function used to select an appropriate RX and TX
51 * DMA channel to be used for DMA, if and only if you're deploying the
52 * generic DMA engine
53 * @dma_rx_param: parameter passed to the DMA allocation
54 * filter in order to select an appropriate RX channel. If
55 * there is a bidirectional RX+TX channel, then just specify
56 * this and leave dma_tx_param set to NULL
57 * @dma_tx_param: parameter passed to the DMA allocation
58 * filter in order to select an appropriate TX channel. If this
59 * is NULL the driver will attempt to use the RX channel as a
60 * bidirectional channel
61 */ 26 */
62struct mmci_platform_data { 27struct mmci_platform_data {
63 unsigned int f_max;
64 unsigned int ocr_mask; 28 unsigned int ocr_mask;
65 int (*ios_handler)(struct device *, struct mmc_ios *); 29 int (*ios_handler)(struct device *, struct mmc_ios *);
66 unsigned int (*status)(struct device *); 30 unsigned int (*status)(struct device *);
67 int gpio_wp; 31 int gpio_wp;
68 int gpio_cd; 32 int gpio_cd;
69 bool cd_invert; 33 bool cd_invert;
70 unsigned long capabilities;
71 unsigned long capabilities2;
72 u32 sigdir;
73 bool (*dma_filter)(struct dma_chan *chan, void *filter_param);
74 void *dma_rx_param;
75 void *dma_tx_param;
76}; 34};
77 35
78#endif 36#endif
diff --git a/include/linux/amba/xilinx_dma.h b/include/linux/amba/xilinx_dma.h
new file mode 100644
index 000000000000..34b98f276ed0
--- /dev/null
+++ b/include/linux/amba/xilinx_dma.h
@@ -0,0 +1,47 @@
1/*
2 * Xilinx DMA Engine drivers support header file
3 *
4 * Copyright (C) 2010-2014 Xilinx, Inc. All rights reserved.
5 *
6 * This 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 __DMA_XILINX_DMA_H
13#define __DMA_XILINX_DMA_H
14
15#include <linux/dma-mapping.h>
16#include <linux/dmaengine.h>
17
18/**
19 * struct xilinx_vdma_config - VDMA Configuration structure
20 * @frm_dly: Frame delay
21 * @gen_lock: Whether in gen-lock mode
22 * @master: Master that it syncs to
23 * @frm_cnt_en: Enable frame count enable
24 * @park: Whether wants to park
25 * @park_frm: Frame to park on
26 * @coalesc: Interrupt coalescing threshold
27 * @delay: Delay counter
28 * @reset: Reset Channel
29 * @ext_fsync: External Frame Sync source
30 */
31struct xilinx_vdma_config {
32 int frm_dly;
33 int gen_lock;
34 int master;
35 int frm_cnt_en;
36 int park;
37 int park_frm;
38 int coalesc;
39 int delay;
40 int reset;
41 int ext_fsync;
42};
43
44int xilinx_vdma_channel_set_config(struct dma_chan *dchan,
45 struct xilinx_vdma_config *cfg);
46
47#endif
diff --git a/include/linux/ath9k_platform.h b/include/linux/ath9k_platform.h
index 8598f8eacb20..a495a959e8a7 100644
--- a/include/linux/ath9k_platform.h
+++ b/include/linux/ath9k_platform.h
@@ -36,6 +36,8 @@ struct ath9k_platform_data {
36 36
37 int (*get_mac_revision)(void); 37 int (*get_mac_revision)(void);
38 int (*external_reset)(void); 38 int (*external_reset)(void);
39
40 bool use_eeprom;
39}; 41};
40 42
41#endif /* _LINUX_ATH9K_PLATFORM_H */ 43#endif /* _LINUX_ATH9K_PLATFORM_H */
diff --git a/include/linux/atomic.h b/include/linux/atomic.h
index 5b08a8540ecf..fef3a809e7cf 100644
--- a/include/linux/atomic.h
+++ b/include/linux/atomic.h
@@ -3,6 +3,42 @@
3#define _LINUX_ATOMIC_H 3#define _LINUX_ATOMIC_H
4#include <asm/atomic.h> 4#include <asm/atomic.h>
5 5
6/*
7 * Provide __deprecated wrappers for the new interface, avoid flag day changes.
8 * We need the ugly external functions to break header recursion hell.
9 */
10#ifndef smp_mb__before_atomic_inc
11static inline void __deprecated smp_mb__before_atomic_inc(void)
12{
13 extern void __smp_mb__before_atomic(void);
14 __smp_mb__before_atomic();
15}
16#endif
17
18#ifndef smp_mb__after_atomic_inc
19static inline void __deprecated smp_mb__after_atomic_inc(void)
20{
21 extern void __smp_mb__after_atomic(void);
22 __smp_mb__after_atomic();
23}
24#endif
25
26#ifndef smp_mb__before_atomic_dec
27static inline void __deprecated smp_mb__before_atomic_dec(void)
28{
29 extern void __smp_mb__before_atomic(void);
30 __smp_mb__before_atomic();
31}
32#endif
33
34#ifndef smp_mb__after_atomic_dec
35static inline void __deprecated smp_mb__after_atomic_dec(void)
36{
37 extern void __smp_mb__after_atomic(void);
38 __smp_mb__after_atomic();
39}
40#endif
41
6/** 42/**
7 * atomic_add_unless - add unless the number is already a given value 43 * atomic_add_unless - add unless the number is already a given value
8 * @v: pointer of type atomic_t 44 * @v: pointer of type atomic_t
diff --git a/include/linux/backlight.h b/include/linux/backlight.h
index 72647429adf6..adb14a8616df 100644
--- a/include/linux/backlight.h
+++ b/include/linux/backlight.h
@@ -40,6 +40,11 @@ enum backlight_type {
40 BACKLIGHT_TYPE_MAX, 40 BACKLIGHT_TYPE_MAX,
41}; 41};
42 42
43enum backlight_notification {
44 BACKLIGHT_REGISTERED,
45 BACKLIGHT_UNREGISTERED,
46};
47
43struct backlight_device; 48struct backlight_device;
44struct fb_info; 49struct fb_info;
45 50
@@ -133,6 +138,8 @@ extern void devm_backlight_device_unregister(struct device *dev,
133extern void backlight_force_update(struct backlight_device *bd, 138extern void backlight_force_update(struct backlight_device *bd,
134 enum backlight_update_reason reason); 139 enum backlight_update_reason reason);
135extern bool backlight_device_registered(enum backlight_type type); 140extern bool backlight_device_registered(enum backlight_type type);
141extern int backlight_register_notifier(struct notifier_block *nb);
142extern int backlight_unregister_notifier(struct notifier_block *nb);
136 143
137#define to_backlight_device(obj) container_of(obj, struct backlight_device, dev) 144#define to_backlight_device(obj) container_of(obj, struct backlight_device, dev)
138 145
diff --git a/include/linux/bio.h b/include/linux/bio.h
index bba550826921..d2633ee099d9 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -186,6 +186,15 @@ static inline void *bio_data(struct bio *bio)
186#define BIOVEC_SEG_BOUNDARY(q, b1, b2) \ 186#define BIOVEC_SEG_BOUNDARY(q, b1, b2) \
187 __BIO_SEG_BOUNDARY(bvec_to_phys((b1)), bvec_to_phys((b2)) + (b2)->bv_len, queue_segment_boundary((q))) 187 __BIO_SEG_BOUNDARY(bvec_to_phys((b1)), bvec_to_phys((b2)) + (b2)->bv_len, queue_segment_boundary((q)))
188 188
189/*
190 * Check if adding a bio_vec after bprv with offset would create a gap in
191 * the SG list. Most drivers don't care about this, but some do.
192 */
193static inline bool bvec_gap_to_prev(struct bio_vec *bprv, unsigned int offset)
194{
195 return offset || ((bprv->bv_offset + bprv->bv_len) & (PAGE_SIZE - 1));
196}
197
189#define bio_io_error(bio) bio_endio((bio), -EIO) 198#define bio_io_error(bio) bio_endio((bio), -EIO)
190 199
191/* 200/*
@@ -333,7 +342,7 @@ static inline struct bio *bio_next_split(struct bio *bio, int sectors,
333 342
334extern struct bio_set *bioset_create(unsigned int, unsigned int); 343extern struct bio_set *bioset_create(unsigned int, unsigned int);
335extern void bioset_free(struct bio_set *); 344extern void bioset_free(struct bio_set *);
336extern mempool_t *biovec_create_pool(struct bio_set *bs, int pool_entries); 345extern mempool_t *biovec_create_pool(int pool_entries);
337 346
338extern struct bio *bio_alloc_bioset(gfp_t, int, struct bio_set *); 347extern struct bio *bio_alloc_bioset(gfp_t, int, struct bio_set *);
339extern void bio_put(struct bio *); 348extern void bio_put(struct bio *);
@@ -644,10 +653,6 @@ struct biovec_slab {
644 653
645#if defined(CONFIG_BLK_DEV_INTEGRITY) 654#if defined(CONFIG_BLK_DEV_INTEGRITY)
646 655
647
648
649#define bip_vec_idx(bip, idx) (&(bip->bip_vec[(idx)]))
650
651#define bip_for_each_vec(bvl, bip, iter) \ 656#define bip_for_each_vec(bvl, bip, iter) \
652 for_each_bvec(bvl, (bip)->bip_vec, iter, (bip)->bip_iter) 657 for_each_bvec(bvl, (bip)->bip_vec, iter, (bip)->bip_iter)
653 658
diff --git a/include/linux/bitops.h b/include/linux/bitops.h
index be5fd38bd5a0..cbc5833fb221 100644
--- a/include/linux/bitops.h
+++ b/include/linux/bitops.h
@@ -32,6 +32,26 @@ extern unsigned long __sw_hweight64(__u64 w);
32 */ 32 */
33#include <asm/bitops.h> 33#include <asm/bitops.h>
34 34
35/*
36 * Provide __deprecated wrappers for the new interface, avoid flag day changes.
37 * We need the ugly external functions to break header recursion hell.
38 */
39#ifndef smp_mb__before_clear_bit
40static inline void __deprecated smp_mb__before_clear_bit(void)
41{
42 extern void __smp_mb__before_atomic(void);
43 __smp_mb__before_atomic();
44}
45#endif
46
47#ifndef smp_mb__after_clear_bit
48static inline void __deprecated smp_mb__after_clear_bit(void)
49{
50 extern void __smp_mb__after_atomic(void);
51 __smp_mb__after_atomic();
52}
53#endif
54
35#define for_each_set_bit(bit, addr, size) \ 55#define for_each_set_bit(bit, addr, size) \
36 for ((bit) = find_first_bit((addr), (size)); \ 56 for ((bit) = find_first_bit((addr), (size)); \
37 (bit) < (size); \ 57 (bit) < (size); \
diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
index 0120451545d8..eb726b9c5762 100644
--- a/include/linux/blk-mq.h
+++ b/include/linux/blk-mq.h
@@ -8,7 +8,13 @@ struct blk_mq_tags;
8struct blk_mq_cpu_notifier { 8struct blk_mq_cpu_notifier {
9 struct list_head list; 9 struct list_head list;
10 void *data; 10 void *data;
11 void (*notify)(void *data, unsigned long action, unsigned int cpu); 11 int (*notify)(void *data, unsigned long action, unsigned int cpu);
12};
13
14struct blk_mq_ctxmap {
15 unsigned int map_size;
16 unsigned int bits_per_word;
17 struct blk_align_bitmap *map;
12}; 18};
13 19
14struct blk_mq_hw_ctx { 20struct blk_mq_hw_ctx {
@@ -18,7 +24,11 @@ struct blk_mq_hw_ctx {
18 } ____cacheline_aligned_in_smp; 24 } ____cacheline_aligned_in_smp;
19 25
20 unsigned long state; /* BLK_MQ_S_* flags */ 26 unsigned long state; /* BLK_MQ_S_* flags */
21 struct delayed_work delayed_work; 27 struct delayed_work run_work;
28 struct delayed_work delay_work;
29 cpumask_var_t cpumask;
30 int next_cpu;
31 int next_cpu_batch;
22 32
23 unsigned long flags; /* BLK_MQ_F_* flags */ 33 unsigned long flags; /* BLK_MQ_F_* flags */
24 34
@@ -27,13 +37,13 @@ struct blk_mq_hw_ctx {
27 37
28 void *driver_data; 38 void *driver_data;
29 39
40 struct blk_mq_ctxmap ctx_map;
41
30 unsigned int nr_ctx; 42 unsigned int nr_ctx;
31 struct blk_mq_ctx **ctxs; 43 struct blk_mq_ctx **ctxs;
32 unsigned int nr_ctx_map;
33 unsigned long *ctx_map;
34 44
35 struct request **rqs; 45 atomic_t wait_index;
36 struct list_head page_list; 46
37 struct blk_mq_tags *tags; 47 struct blk_mq_tags *tags;
38 48
39 unsigned long queued; 49 unsigned long queued;
@@ -41,31 +51,40 @@ struct blk_mq_hw_ctx {
41#define BLK_MQ_MAX_DISPATCH_ORDER 10 51#define BLK_MQ_MAX_DISPATCH_ORDER 10
42 unsigned long dispatched[BLK_MQ_MAX_DISPATCH_ORDER]; 52 unsigned long dispatched[BLK_MQ_MAX_DISPATCH_ORDER];
43 53
44 unsigned int queue_depth;
45 unsigned int numa_node; 54 unsigned int numa_node;
46 unsigned int cmd_size; /* per-request extra data */ 55 unsigned int cmd_size; /* per-request extra data */
47 56
57 atomic_t nr_active;
58
48 struct blk_mq_cpu_notifier cpu_notifier; 59 struct blk_mq_cpu_notifier cpu_notifier;
49 struct kobject kobj; 60 struct kobject kobj;
50}; 61};
51 62
52struct blk_mq_reg { 63struct blk_mq_tag_set {
53 struct blk_mq_ops *ops; 64 struct blk_mq_ops *ops;
54 unsigned int nr_hw_queues; 65 unsigned int nr_hw_queues;
55 unsigned int queue_depth; 66 unsigned int queue_depth; /* max hw supported */
56 unsigned int reserved_tags; 67 unsigned int reserved_tags;
57 unsigned int cmd_size; /* per-request extra data */ 68 unsigned int cmd_size; /* per-request extra data */
58 int numa_node; 69 int numa_node;
59 unsigned int timeout; 70 unsigned int timeout;
60 unsigned int flags; /* BLK_MQ_F_* */ 71 unsigned int flags; /* BLK_MQ_F_* */
72 void *driver_data;
73
74 struct blk_mq_tags **tags;
75
76 struct mutex tag_list_lock;
77 struct list_head tag_list;
61}; 78};
62 79
63typedef int (queue_rq_fn)(struct blk_mq_hw_ctx *, struct request *); 80typedef int (queue_rq_fn)(struct blk_mq_hw_ctx *, struct request *);
64typedef struct blk_mq_hw_ctx *(map_queue_fn)(struct request_queue *, const int); 81typedef struct blk_mq_hw_ctx *(map_queue_fn)(struct request_queue *, const int);
65typedef struct blk_mq_hw_ctx *(alloc_hctx_fn)(struct blk_mq_reg *,unsigned int);
66typedef void (free_hctx_fn)(struct blk_mq_hw_ctx *, unsigned int);
67typedef int (init_hctx_fn)(struct blk_mq_hw_ctx *, void *, unsigned int); 82typedef int (init_hctx_fn)(struct blk_mq_hw_ctx *, void *, unsigned int);
68typedef void (exit_hctx_fn)(struct blk_mq_hw_ctx *, unsigned int); 83typedef void (exit_hctx_fn)(struct blk_mq_hw_ctx *, unsigned int);
84typedef int (init_request_fn)(void *, struct request *, unsigned int,
85 unsigned int, unsigned int);
86typedef void (exit_request_fn)(void *, struct request *, unsigned int,
87 unsigned int);
69 88
70struct blk_mq_ops { 89struct blk_mq_ops {
71 /* 90 /*
@@ -86,18 +105,20 @@ struct blk_mq_ops {
86 softirq_done_fn *complete; 105 softirq_done_fn *complete;
87 106
88 /* 107 /*
89 * Override for hctx allocations (should probably go)
90 */
91 alloc_hctx_fn *alloc_hctx;
92 free_hctx_fn *free_hctx;
93
94 /*
95 * Called when the block layer side of a hardware queue has been 108 * Called when the block layer side of a hardware queue has been
96 * set up, allowing the driver to allocate/init matching structures. 109 * set up, allowing the driver to allocate/init matching structures.
97 * Ditto for exit/teardown. 110 * Ditto for exit/teardown.
98 */ 111 */
99 init_hctx_fn *init_hctx; 112 init_hctx_fn *init_hctx;
100 exit_hctx_fn *exit_hctx; 113 exit_hctx_fn *exit_hctx;
114
115 /*
116 * Called for every command allocated by the block layer to allow
117 * the driver to set up driver specific data.
118 * Ditto for exit/teardown.
119 */
120 init_request_fn *init_request;
121 exit_request_fn *exit_request;
101}; 122};
102 123
103enum { 124enum {
@@ -107,18 +128,24 @@ enum {
107 128
108 BLK_MQ_F_SHOULD_MERGE = 1 << 0, 129 BLK_MQ_F_SHOULD_MERGE = 1 << 0,
109 BLK_MQ_F_SHOULD_SORT = 1 << 1, 130 BLK_MQ_F_SHOULD_SORT = 1 << 1,
110 BLK_MQ_F_SHOULD_IPI = 1 << 2, 131 BLK_MQ_F_TAG_SHARED = 1 << 2,
132 BLK_MQ_F_SG_MERGE = 1 << 3,
133 BLK_MQ_F_SYSFS_UP = 1 << 4,
111 134
112 BLK_MQ_S_STOPPED = 0, 135 BLK_MQ_S_STOPPED = 0,
136 BLK_MQ_S_TAG_ACTIVE = 1,
137
138 BLK_MQ_MAX_DEPTH = 10240,
113 139
114 BLK_MQ_MAX_DEPTH = 2048, 140 BLK_MQ_CPU_WORK_BATCH = 8,
115}; 141};
116 142
117struct request_queue *blk_mq_init_queue(struct blk_mq_reg *, void *); 143struct request_queue *blk_mq_init_queue(struct blk_mq_tag_set *);
118int blk_mq_register_disk(struct gendisk *); 144int blk_mq_register_disk(struct gendisk *);
119void blk_mq_unregister_disk(struct gendisk *); 145void blk_mq_unregister_disk(struct gendisk *);
120int blk_mq_init_commands(struct request_queue *, int (*init)(void *data, struct blk_mq_hw_ctx *, struct request *, unsigned int), void *data); 146
121void blk_mq_free_commands(struct request_queue *, void (*free)(void *data, struct blk_mq_hw_ctx *, struct request *, unsigned int), void *data); 147int blk_mq_alloc_tag_set(struct blk_mq_tag_set *set);
148void blk_mq_free_tag_set(struct blk_mq_tag_set *set);
122 149
123void blk_mq_flush_plug_list(struct blk_plug *plug, bool from_schedule); 150void blk_mq_flush_plug_list(struct blk_plug *plug, bool from_schedule);
124 151
@@ -126,28 +153,28 @@ void blk_mq_insert_request(struct request *, bool, bool, bool);
126void blk_mq_run_queues(struct request_queue *q, bool async); 153void blk_mq_run_queues(struct request_queue *q, bool async);
127void blk_mq_free_request(struct request *rq); 154void blk_mq_free_request(struct request *rq);
128bool blk_mq_can_queue(struct blk_mq_hw_ctx *); 155bool blk_mq_can_queue(struct blk_mq_hw_ctx *);
129struct request *blk_mq_alloc_request(struct request_queue *q, int rw, gfp_t gfp); 156struct request *blk_mq_alloc_request(struct request_queue *q, int rw,
130struct request *blk_mq_alloc_reserved_request(struct request_queue *q, int rw, gfp_t gfp); 157 gfp_t gfp, bool reserved);
131struct request *blk_mq_rq_from_tag(struct request_queue *q, unsigned int tag); 158struct request *blk_mq_tag_to_rq(struct blk_mq_tags *tags, unsigned int tag);
132 159
133struct blk_mq_hw_ctx *blk_mq_map_queue(struct request_queue *, const int ctx_index); 160struct blk_mq_hw_ctx *blk_mq_map_queue(struct request_queue *, const int ctx_index);
134struct blk_mq_hw_ctx *blk_mq_alloc_single_hw_queue(struct blk_mq_reg *, unsigned int); 161struct blk_mq_hw_ctx *blk_mq_alloc_single_hw_queue(struct blk_mq_tag_set *, unsigned int, int);
135void blk_mq_free_single_hw_queue(struct blk_mq_hw_ctx *, unsigned int);
136 162
137bool blk_mq_end_io_partial(struct request *rq, int error, 163void blk_mq_end_io(struct request *rq, int error);
138 unsigned int nr_bytes); 164void __blk_mq_end_io(struct request *rq, int error);
139static inline void blk_mq_end_io(struct request *rq, int error)
140{
141 bool done = !blk_mq_end_io_partial(rq, error, blk_rq_bytes(rq));
142 BUG_ON(!done);
143}
144 165
166void blk_mq_requeue_request(struct request *rq);
167void blk_mq_add_to_requeue_list(struct request *rq, bool at_head);
168void blk_mq_kick_requeue_list(struct request_queue *q);
145void blk_mq_complete_request(struct request *rq); 169void blk_mq_complete_request(struct request *rq);
146 170
147void blk_mq_stop_hw_queue(struct blk_mq_hw_ctx *hctx); 171void blk_mq_stop_hw_queue(struct blk_mq_hw_ctx *hctx);
148void blk_mq_start_hw_queue(struct blk_mq_hw_ctx *hctx); 172void blk_mq_start_hw_queue(struct blk_mq_hw_ctx *hctx);
149void blk_mq_stop_hw_queues(struct request_queue *q); 173void blk_mq_stop_hw_queues(struct request_queue *q);
150void blk_mq_start_stopped_hw_queues(struct request_queue *q); 174void blk_mq_start_hw_queues(struct request_queue *q);
175void blk_mq_start_stopped_hw_queues(struct request_queue *q, bool async);
176void blk_mq_delay_queue(struct blk_mq_hw_ctx *hctx, unsigned long msecs);
177void blk_mq_tag_busy_iter(struct blk_mq_tags *tags, void (*fn)(void *data, unsigned long *), void *data);
151 178
152/* 179/*
153 * Driver command data is immediately after the request. So subtract request 180 * Driver command data is immediately after the request. So subtract request
@@ -162,12 +189,6 @@ static inline void *blk_mq_rq_to_pdu(struct request *rq)
162 return (void *) rq + sizeof(*rq); 189 return (void *) rq + sizeof(*rq);
163} 190}
164 191
165static inline struct request *blk_mq_tag_to_rq(struct blk_mq_hw_ctx *hctx,
166 unsigned int tag)
167{
168 return hctx->rqs[tag];
169}
170
171#define queue_for_each_hw_ctx(q, hctx, i) \ 192#define queue_for_each_hw_ctx(q, hctx, i) \
172 for ((i) = 0; (i) < (q)->nr_hw_queues && \ 193 for ((i) = 0; (i) < (q)->nr_hw_queues && \
173 ({ hctx = (q)->queue_hw_ctx[i]; 1; }); (i)++) 194 ({ hctx = (q)->queue_hw_ctx[i]; 1; }); (i)++)
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
index aa0eaa2d0bd8..66c2167f04a9 100644
--- a/include/linux/blk_types.h
+++ b/include/linux/blk_types.h
@@ -5,8 +5,6 @@
5#ifndef __LINUX_BLK_TYPES_H 5#ifndef __LINUX_BLK_TYPES_H
6#define __LINUX_BLK_TYPES_H 6#define __LINUX_BLK_TYPES_H
7 7
8#ifdef CONFIG_BLOCK
9
10#include <linux/types.h> 8#include <linux/types.h>
11 9
12struct bio_set; 10struct bio_set;
@@ -28,6 +26,8 @@ struct bio_vec {
28 unsigned int bv_offset; 26 unsigned int bv_offset;
29}; 27};
30 28
29#ifdef CONFIG_BLOCK
30
31struct bvec_iter { 31struct bvec_iter {
32 sector_t bi_sector; /* device address in 512 byte 32 sector_t bi_sector; /* device address in 512 byte
33 sectors */ 33 sectors */
@@ -190,6 +190,7 @@ enum rq_flag_bits {
190 __REQ_PM, /* runtime pm request */ 190 __REQ_PM, /* runtime pm request */
191 __REQ_END, /* last of chain of requests */ 191 __REQ_END, /* last of chain of requests */
192 __REQ_HASHED, /* on IO scheduler merge hash */ 192 __REQ_HASHED, /* on IO scheduler merge hash */
193 __REQ_MQ_INFLIGHT, /* track inflight for MQ */
193 __REQ_NR_BITS, /* stops here */ 194 __REQ_NR_BITS, /* stops here */
194}; 195};
195 196
@@ -243,5 +244,6 @@ enum rq_flag_bits {
243#define REQ_PM (1ULL << __REQ_PM) 244#define REQ_PM (1ULL << __REQ_PM)
244#define REQ_END (1ULL << __REQ_END) 245#define REQ_END (1ULL << __REQ_END)
245#define REQ_HASHED (1ULL << __REQ_HASHED) 246#define REQ_HASHED (1ULL << __REQ_HASHED)
247#define REQ_MQ_INFLIGHT (1ULL << __REQ_MQ_INFLIGHT)
246 248
247#endif /* __LINUX_BLK_TYPES_H */ 249#endif /* __LINUX_BLK_TYPES_H */
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 0d84981ee03f..8699bcf5f099 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -90,15 +90,15 @@ enum rq_cmd_type_bits {
90#define BLK_MAX_CDB 16 90#define BLK_MAX_CDB 16
91 91
92/* 92/*
93 * try to put the fields that are referenced together in the same cacheline. 93 * Try to put the fields that are referenced together in the same cacheline.
94 * if you modify this structure, be sure to check block/blk-core.c:blk_rq_init() 94 *
95 * as well! 95 * If you modify this structure, make sure to update blk_rq_init() and
96 * especially blk_mq_rq_ctx_init() to take care of the added fields.
96 */ 97 */
97struct request { 98struct request {
98 struct list_head queuelist; 99 struct list_head queuelist;
99 union { 100 union {
100 struct call_single_data csd; 101 struct call_single_data csd;
101 struct work_struct mq_flush_work;
102 unsigned long fifo_time; 102 unsigned long fifo_time;
103 }; 103 };
104 104
@@ -178,7 +178,6 @@ struct request {
178 unsigned short ioprio; 178 unsigned short ioprio;
179 179
180 void *special; /* opaque pointer available for LLD use */ 180 void *special; /* opaque pointer available for LLD use */
181 char *buffer; /* kaddr of the current segment if available */
182 181
183 int tag; 182 int tag;
184 int errors; 183 int errors;
@@ -281,6 +280,7 @@ struct queue_limits {
281 unsigned long seg_boundary_mask; 280 unsigned long seg_boundary_mask;
282 281
283 unsigned int max_hw_sectors; 282 unsigned int max_hw_sectors;
283 unsigned int chunk_sectors;
284 unsigned int max_sectors; 284 unsigned int max_sectors;
285 unsigned int max_segment_size; 285 unsigned int max_segment_size;
286 unsigned int physical_block_size; 286 unsigned int physical_block_size;
@@ -336,7 +336,7 @@ struct request_queue {
336 unsigned int *mq_map; 336 unsigned int *mq_map;
337 337
338 /* sw queues */ 338 /* sw queues */
339 struct blk_mq_ctx *queue_ctx; 339 struct blk_mq_ctx __percpu *queue_ctx;
340 unsigned int nr_queues; 340 unsigned int nr_queues;
341 341
342 /* hw dispatch queues */ 342 /* hw dispatch queues */
@@ -463,6 +463,10 @@ struct request_queue {
463 struct request *flush_rq; 463 struct request *flush_rq;
464 spinlock_t mq_flush_lock; 464 spinlock_t mq_flush_lock;
465 465
466 struct list_head requeue_list;
467 spinlock_t requeue_lock;
468 struct work_struct requeue_work;
469
466 struct mutex sysfs_lock; 470 struct mutex sysfs_lock;
467 471
468 int bypass_depth; 472 int bypass_depth;
@@ -481,6 +485,9 @@ struct request_queue {
481 wait_queue_head_t mq_freeze_wq; 485 wait_queue_head_t mq_freeze_wq;
482 struct percpu_counter mq_usage_counter; 486 struct percpu_counter mq_usage_counter;
483 struct list_head all_q_node; 487 struct list_head all_q_node;
488
489 struct blk_mq_tag_set *tag_set;
490 struct list_head tag_set_list;
484}; 491};
485 492
486#define QUEUE_FLAG_QUEUED 1 /* uses generic tag queueing */ 493#define QUEUE_FLAG_QUEUED 1 /* uses generic tag queueing */
@@ -504,6 +511,8 @@ struct request_queue {
504#define QUEUE_FLAG_SAME_FORCE 18 /* force complete on same CPU */ 511#define QUEUE_FLAG_SAME_FORCE 18 /* force complete on same CPU */
505#define QUEUE_FLAG_DEAD 19 /* queue tear-down finished */ 512#define QUEUE_FLAG_DEAD 19 /* queue tear-down finished */
506#define QUEUE_FLAG_INIT_DONE 20 /* queue is initialized */ 513#define QUEUE_FLAG_INIT_DONE 20 /* queue is initialized */
514#define QUEUE_FLAG_NO_SG_MERGE 21 /* don't attempt to merge SG segments*/
515#define QUEUE_FLAG_SG_GAPS 22 /* queue doesn't support SG gaps */
507 516
508#define QUEUE_FLAG_DEFAULT ((1 << QUEUE_FLAG_IO_STAT) | \ 517#define QUEUE_FLAG_DEFAULT ((1 << QUEUE_FLAG_IO_STAT) | \
509 (1 << QUEUE_FLAG_STACKABLE) | \ 518 (1 << QUEUE_FLAG_STACKABLE) | \
@@ -613,6 +622,15 @@ static inline void queue_flag_clear(unsigned int flag, struct request_queue *q)
613 622
614#define rq_data_dir(rq) (((rq)->cmd_flags & 1) != 0) 623#define rq_data_dir(rq) (((rq)->cmd_flags & 1) != 0)
615 624
625/*
626 * Driver can handle struct request, if it either has an old style
627 * request_fn defined, or is blk-mq based.
628 */
629static inline bool queue_is_rq_based(struct request_queue *q)
630{
631 return q->request_fn || q->mq_ops;
632}
633
616static inline unsigned int blk_queue_cluster(struct request_queue *q) 634static inline unsigned int blk_queue_cluster(struct request_queue *q)
617{ 635{
618 return q->limits.cluster; 636 return q->limits.cluster;
@@ -779,6 +797,7 @@ extern void __blk_put_request(struct request_queue *, struct request *);
779extern struct request *blk_get_request(struct request_queue *, int, gfp_t); 797extern struct request *blk_get_request(struct request_queue *, int, gfp_t);
780extern struct request *blk_make_request(struct request_queue *, struct bio *, 798extern struct request *blk_make_request(struct request_queue *, struct bio *,
781 gfp_t); 799 gfp_t);
800extern void blk_rq_set_block_pc(struct request *);
782extern void blk_requeue_request(struct request_queue *, struct request *); 801extern void blk_requeue_request(struct request_queue *, struct request *);
783extern void blk_add_request_payload(struct request *rq, struct page *page, 802extern void blk_add_request_payload(struct request *rq, struct page *page,
784 unsigned int len); 803 unsigned int len);
@@ -894,6 +913,20 @@ static inline unsigned int blk_queue_get_max_sectors(struct request_queue *q,
894 return q->limits.max_sectors; 913 return q->limits.max_sectors;
895} 914}
896 915
916/*
917 * Return maximum size of a request at given offset. Only valid for
918 * file system requests.
919 */
920static inline unsigned int blk_max_size_offset(struct request_queue *q,
921 sector_t offset)
922{
923 if (!q->limits.chunk_sectors)
924 return q->limits.max_sectors;
925
926 return q->limits.chunk_sectors -
927 (offset & (q->limits.chunk_sectors - 1));
928}
929
897static inline unsigned int blk_rq_get_max_sectors(struct request *rq) 930static inline unsigned int blk_rq_get_max_sectors(struct request *rq)
898{ 931{
899 struct request_queue *q = rq->q; 932 struct request_queue *q = rq->q;
@@ -901,7 +934,11 @@ static inline unsigned int blk_rq_get_max_sectors(struct request *rq)
901 if (unlikely(rq->cmd_type == REQ_TYPE_BLOCK_PC)) 934 if (unlikely(rq->cmd_type == REQ_TYPE_BLOCK_PC))
902 return q->limits.max_hw_sectors; 935 return q->limits.max_hw_sectors;
903 936
904 return blk_queue_get_max_sectors(q, rq->cmd_flags); 937 if (!q->limits.chunk_sectors)
938 return blk_queue_get_max_sectors(q, rq->cmd_flags);
939
940 return min(blk_max_size_offset(q, blk_rq_pos(rq)),
941 blk_queue_get_max_sectors(q, rq->cmd_flags));
905} 942}
906 943
907static inline unsigned int blk_rq_count_bios(struct request *rq) 944static inline unsigned int blk_rq_count_bios(struct request *rq)
@@ -937,6 +974,7 @@ extern struct request *blk_fetch_request(struct request_queue *q);
937 */ 974 */
938extern bool blk_update_request(struct request *rq, int error, 975extern bool blk_update_request(struct request *rq, int error,
939 unsigned int nr_bytes); 976 unsigned int nr_bytes);
977extern void blk_finish_request(struct request *rq, int error);
940extern bool blk_end_request(struct request *rq, int error, 978extern bool blk_end_request(struct request *rq, int error,
941 unsigned int nr_bytes); 979 unsigned int nr_bytes);
942extern void blk_end_request_all(struct request *rq, int error); 980extern void blk_end_request_all(struct request *rq, int error);
@@ -966,6 +1004,7 @@ extern void blk_queue_make_request(struct request_queue *, make_request_fn *);
966extern void blk_queue_bounce_limit(struct request_queue *, u64); 1004extern void blk_queue_bounce_limit(struct request_queue *, u64);
967extern void blk_limits_max_hw_sectors(struct queue_limits *, unsigned int); 1005extern void blk_limits_max_hw_sectors(struct queue_limits *, unsigned int);
968extern void blk_queue_max_hw_sectors(struct request_queue *, unsigned int); 1006extern void blk_queue_max_hw_sectors(struct request_queue *, unsigned int);
1007extern void blk_queue_chunk_sectors(struct request_queue *, unsigned int);
969extern void blk_queue_max_segments(struct request_queue *, unsigned short); 1008extern void blk_queue_max_segments(struct request_queue *, unsigned short);
970extern void blk_queue_max_segment_size(struct request_queue *, unsigned int); 1009extern void blk_queue_max_segment_size(struct request_queue *, unsigned int);
971extern void blk_queue_max_discard_sectors(struct request_queue *q, 1010extern void blk_queue_max_discard_sectors(struct request_queue *q,
@@ -1053,7 +1092,6 @@ static inline void blk_post_runtime_resume(struct request_queue *q, int err) {}
1053 * schedule() where blk_schedule_flush_plug() is called. 1092 * schedule() where blk_schedule_flush_plug() is called.
1054 */ 1093 */
1055struct blk_plug { 1094struct blk_plug {
1056 unsigned long magic; /* detect uninitialized use-cases */
1057 struct list_head list; /* requests */ 1095 struct list_head list; /* requests */
1058 struct list_head mq_list; /* blk-mq requests */ 1096 struct list_head mq_list; /* blk-mq requests */
1059 struct list_head cb_list; /* md requires an unplug callback */ 1097 struct list_head cb_list; /* md requires an unplug callback */
@@ -1102,7 +1140,8 @@ static inline bool blk_needs_flush_plug(struct task_struct *tsk)
1102/* 1140/*
1103 * tag stuff 1141 * tag stuff
1104 */ 1142 */
1105#define blk_rq_tagged(rq) ((rq)->cmd_flags & REQ_QUEUED) 1143#define blk_rq_tagged(rq) \
1144 ((rq)->mq_ctx || ((rq)->cmd_flags & REQ_QUEUED))
1106extern int blk_queue_start_tag(struct request_queue *, struct request *); 1145extern int blk_queue_start_tag(struct request_queue *, struct request *);
1107extern struct request *blk_queue_find_tag(struct request_queue *, int); 1146extern struct request *blk_queue_find_tag(struct request_queue *, int);
1108extern void blk_queue_end_tag(struct request_queue *, struct request *); 1147extern void blk_queue_end_tag(struct request_queue *, struct request *);
@@ -1370,8 +1409,9 @@ static inline void put_dev_sector(Sector p)
1370} 1409}
1371 1410
1372struct work_struct; 1411struct work_struct;
1373int kblockd_schedule_work(struct request_queue *q, struct work_struct *work); 1412int kblockd_schedule_work(struct work_struct *work);
1374int kblockd_schedule_delayed_work(struct request_queue *q, struct delayed_work *dwork, unsigned long delay); 1413int kblockd_schedule_delayed_work(struct delayed_work *dwork, unsigned long delay);
1414int kblockd_schedule_delayed_work_on(int cpu, struct delayed_work *dwork, unsigned long delay);
1375 1415
1376#ifdef CONFIG_BLK_CGROUP 1416#ifdef CONFIG_BLK_CGROUP
1377/* 1417/*
@@ -1570,6 +1610,7 @@ static inline bool blk_integrity_is_initialized(struct gendisk *g)
1570struct block_device_operations { 1610struct block_device_operations {
1571 int (*open) (struct block_device *, fmode_t); 1611 int (*open) (struct block_device *, fmode_t);
1572 void (*release) (struct gendisk *, fmode_t); 1612 void (*release) (struct gendisk *, fmode_t);
1613 int (*rw_page)(struct block_device *, sector_t, struct page *, int rw);
1573 int (*ioctl) (struct block_device *, fmode_t, unsigned, unsigned long); 1614 int (*ioctl) (struct block_device *, fmode_t, unsigned, unsigned long);
1574 int (*compat_ioctl) (struct block_device *, fmode_t, unsigned, unsigned long); 1615 int (*compat_ioctl) (struct block_device *, fmode_t, unsigned, unsigned long);
1575 int (*direct_access) (struct block_device *, sector_t, 1616 int (*direct_access) (struct block_device *, sector_t,
@@ -1588,7 +1629,13 @@ struct block_device_operations {
1588 1629
1589extern int __blkdev_driver_ioctl(struct block_device *, fmode_t, unsigned int, 1630extern int __blkdev_driver_ioctl(struct block_device *, fmode_t, unsigned int,
1590 unsigned long); 1631 unsigned long);
1632extern int bdev_read_page(struct block_device *, sector_t, struct page *);
1633extern int bdev_write_page(struct block_device *, sector_t, struct page *,
1634 struct writeback_control *);
1591#else /* CONFIG_BLOCK */ 1635#else /* CONFIG_BLOCK */
1636
1637struct block_device;
1638
1592/* 1639/*
1593 * stubs for when the block layer is configured out 1640 * stubs for when the block layer is configured out
1594 */ 1641 */
@@ -1624,6 +1671,12 @@ static inline bool blk_needs_flush_plug(struct task_struct *tsk)
1624 return false; 1671 return false;
1625} 1672}
1626 1673
1674static inline int blkdev_issue_flush(struct block_device *bdev, gfp_t gfp_mask,
1675 sector_t *error_sector)
1676{
1677 return 0;
1678}
1679
1627#endif /* CONFIG_BLOCK */ 1680#endif /* CONFIG_BLOCK */
1628 1681
1629#endif 1682#endif
diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h
index db51fe4fe317..4e2bd4c95b66 100644
--- a/include/linux/bootmem.h
+++ b/include/linux/bootmem.h
@@ -58,9 +58,9 @@ extern void free_bootmem_late(unsigned long physaddr, unsigned long size);
58 * Flags for reserve_bootmem (also if CONFIG_HAVE_ARCH_BOOTMEM_NODE, 58 * Flags for reserve_bootmem (also if CONFIG_HAVE_ARCH_BOOTMEM_NODE,
59 * the architecture-specific code should honor this). 59 * the architecture-specific code should honor this).
60 * 60 *
61 * If flags is 0, then the return value is always 0 (success). If 61 * If flags is BOOTMEM_DEFAULT, then the return value is always 0 (success).
62 * flags contains BOOTMEM_EXCLUSIVE, then -EBUSY is returned if the 62 * If flags contains BOOTMEM_EXCLUSIVE, then -EBUSY is returned if the memory
63 * memory already was reserved. 63 * already was reserved.
64 */ 64 */
65#define BOOTMEM_DEFAULT 0 65#define BOOTMEM_DEFAULT 0
66#define BOOTMEM_EXCLUSIVE (1<<0) 66#define BOOTMEM_EXCLUSIVE (1<<0)
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index c40302f909ce..324329ceea1e 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -207,8 +207,6 @@ void block_invalidatepage(struct page *page, unsigned int offset,
207 unsigned int length); 207 unsigned int length);
208int block_write_full_page(struct page *page, get_block_t *get_block, 208int block_write_full_page(struct page *page, get_block_t *get_block,
209 struct writeback_control *wbc); 209 struct writeback_control *wbc);
210int block_write_full_page_endio(struct page *page, get_block_t *get_block,
211 struct writeback_control *wbc, bh_end_io_t *handler);
212int block_read_full_page(struct page*, get_block_t*); 210int block_read_full_page(struct page*, get_block_t*);
213int block_is_partially_uptodate(struct page *page, unsigned long from, 211int block_is_partially_uptodate(struct page *page, unsigned long from,
214 unsigned long count); 212 unsigned long count);
@@ -278,7 +276,7 @@ static inline void get_bh(struct buffer_head *bh)
278 276
279static inline void put_bh(struct buffer_head *bh) 277static inline void put_bh(struct buffer_head *bh)
280{ 278{
281 smp_mb__before_atomic_dec(); 279 smp_mb__before_atomic();
282 atomic_dec(&bh->b_count); 280 atomic_dec(&bh->b_count);
283} 281}
284 282
diff --git a/include/linux/can/core.h b/include/linux/can/core.h
index 78c6c52073ad..a0875001b13c 100644
--- a/include/linux/can/core.h
+++ b/include/linux/can/core.h
@@ -10,8 +10,8 @@
10 * 10 *
11 */ 11 */
12 12
13#ifndef CAN_CORE_H 13#ifndef _CAN_CORE_H
14#define CAN_CORE_H 14#define _CAN_CORE_H
15 15
16#include <linux/can.h> 16#include <linux/can.h>
17#include <linux/skbuff.h> 17#include <linux/skbuff.h>
@@ -58,4 +58,4 @@ extern void can_rx_unregister(struct net_device *dev, canid_t can_id,
58extern int can_send(struct sk_buff *skb, int loop); 58extern int can_send(struct sk_buff *skb, int loop);
59extern int can_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg); 59extern int can_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg);
60 60
61#endif /* CAN_CORE_H */ 61#endif /* !_CAN_CORE_H */
diff --git a/include/linux/can/dev.h b/include/linux/can/dev.h
index 3ce5e526525f..6992afc6ba7f 100644
--- a/include/linux/can/dev.h
+++ b/include/linux/can/dev.h
@@ -10,8 +10,8 @@
10 * 10 *
11 */ 11 */
12 12
13#ifndef CAN_DEV_H 13#ifndef _CAN_DEV_H
14#define CAN_DEV_H 14#define _CAN_DEV_H
15 15
16#include <linux/can.h> 16#include <linux/can.h>
17#include <linux/can/netlink.h> 17#include <linux/can/netlink.h>
@@ -132,4 +132,4 @@ struct sk_buff *alloc_canfd_skb(struct net_device *dev,
132struct sk_buff *alloc_can_err_skb(struct net_device *dev, 132struct sk_buff *alloc_can_err_skb(struct net_device *dev,
133 struct can_frame **cf); 133 struct can_frame **cf);
134 134
135#endif /* CAN_DEV_H */ 135#endif /* !_CAN_DEV_H */
diff --git a/include/linux/can/led.h b/include/linux/can/led.h
index 9c1167baf273..e0475c5cbb92 100644
--- a/include/linux/can/led.h
+++ b/include/linux/can/led.h
@@ -6,8 +6,8 @@
6 * published by the Free Software Foundation. 6 * published by the Free Software Foundation.
7 */ 7 */
8 8
9#ifndef CAN_LED_H 9#ifndef _CAN_LED_H
10#define CAN_LED_H 10#define _CAN_LED_H
11 11
12#include <linux/if.h> 12#include <linux/if.h>
13#include <linux/leds.h> 13#include <linux/leds.h>
@@ -48,4 +48,4 @@ static inline void can_led_notifier_exit(void)
48 48
49#endif 49#endif
50 50
51#endif 51#endif /* !_CAN_LED_H */
diff --git a/include/linux/can/platform/cc770.h b/include/linux/can/platform/cc770.h
index 7702641f87ee..78b2d44f04cf 100644
--- a/include/linux/can/platform/cc770.h
+++ b/include/linux/can/platform/cc770.h
@@ -1,5 +1,5 @@
1#ifndef _CAN_PLATFORM_CC770_H_ 1#ifndef _CAN_PLATFORM_CC770_H
2#define _CAN_PLATFORM_CC770_H_ 2#define _CAN_PLATFORM_CC770_H
3 3
4/* CPU Interface Register (0x02) */ 4/* CPU Interface Register (0x02) */
5#define CPUIF_CEN 0x01 /* Clock Out Enable */ 5#define CPUIF_CEN 0x01 /* Clock Out Enable */
@@ -30,4 +30,4 @@ struct cc770_platform_data {
30 u8 bcr; /* Bus Configuration Register */ 30 u8 bcr; /* Bus Configuration Register */
31}; 31};
32 32
33#endif /* !_CAN_PLATFORM_CC770_H_ */ 33#endif /* !_CAN_PLATFORM_CC770_H */
diff --git a/include/linux/can/platform/mcp251x.h b/include/linux/can/platform/mcp251x.h
index dc029dba7a03..d44fcae274ff 100644
--- a/include/linux/can/platform/mcp251x.h
+++ b/include/linux/can/platform/mcp251x.h
@@ -1,5 +1,5 @@
1#ifndef __CAN_PLATFORM_MCP251X_H__ 1#ifndef _CAN_PLATFORM_MCP251X_H
2#define __CAN_PLATFORM_MCP251X_H__ 2#define _CAN_PLATFORM_MCP251X_H
3 3
4/* 4/*
5 * 5 *
@@ -18,4 +18,4 @@ struct mcp251x_platform_data {
18 unsigned long oscillator_frequency; 18 unsigned long oscillator_frequency;
19}; 19};
20 20
21#endif /* __CAN_PLATFORM_MCP251X_H__ */ 21#endif /* !_CAN_PLATFORM_MCP251X_H */
diff --git a/include/linux/can/platform/rcar_can.h b/include/linux/can/platform/rcar_can.h
new file mode 100644
index 000000000000..0f4a2f3df504
--- /dev/null
+++ b/include/linux/can/platform/rcar_can.h
@@ -0,0 +1,17 @@
1#ifndef _CAN_PLATFORM_RCAR_CAN_H_
2#define _CAN_PLATFORM_RCAR_CAN_H_
3
4#include <linux/types.h>
5
6/* Clock Select Register settings */
7enum CLKR {
8 CLKR_CLKP1 = 0, /* Peripheral clock (clkp1) */
9 CLKR_CLKP2 = 1, /* Peripheral clock (clkp2) */
10 CLKR_CLKEXT = 3 /* Externally input clock */
11};
12
13struct rcar_can_platform_data {
14 enum CLKR clock_select; /* Clock source select */
15};
16
17#endif /* !_CAN_PLATFORM_RCAR_CAN_H_ */
diff --git a/include/linux/can/platform/sja1000.h b/include/linux/can/platform/sja1000.h
index 96f8fcc78d78..93570b61ec6c 100644
--- a/include/linux/can/platform/sja1000.h
+++ b/include/linux/can/platform/sja1000.h
@@ -1,5 +1,5 @@
1#ifndef _CAN_PLATFORM_SJA1000_H_ 1#ifndef _CAN_PLATFORM_SJA1000_H
2#define _CAN_PLATFORM_SJA1000_H_ 2#define _CAN_PLATFORM_SJA1000_H
3 3
4/* clock divider register */ 4/* clock divider register */
5#define CDR_CLKOUT_MASK 0x07 5#define CDR_CLKOUT_MASK 0x07
@@ -32,4 +32,4 @@ struct sja1000_platform_data {
32 u8 cdr; /* clock divider register */ 32 u8 cdr; /* clock divider register */
33}; 33};
34 34
35#endif /* !_CAN_PLATFORM_SJA1000_H_ */ 35#endif /* !_CAN_PLATFORM_SJA1000_H */
diff --git a/include/linux/can/platform/ti_hecc.h b/include/linux/can/platform/ti_hecc.h
index af17cb3f7a84..a52f47ca6c8a 100644
--- a/include/linux/can/platform/ti_hecc.h
+++ b/include/linux/can/platform/ti_hecc.h
@@ -1,5 +1,5 @@
1#ifndef __CAN_PLATFORM_TI_HECC_H__ 1#ifndef _CAN_PLATFORM_TI_HECC_H
2#define __CAN_PLATFORM_TI_HECC_H__ 2#define _CAN_PLATFORM_TI_HECC_H
3 3
4/* 4/*
5 * TI HECC (High End CAN Controller) driver platform header 5 * TI HECC (High End CAN Controller) driver platform header
@@ -41,4 +41,4 @@ struct ti_hecc_platform_data {
41 u32 version; 41 u32 version;
42 void (*transceiver_switch) (int); 42 void (*transceiver_switch) (int);
43}; 43};
44#endif 44#endif /* !_CAN_PLATFORM_TI_HECC_H */
diff --git a/include/linux/can/skb.h b/include/linux/can/skb.h
index f9bbbb472663..cc00d15c6107 100644
--- a/include/linux/can/skb.h
+++ b/include/linux/can/skb.h
@@ -7,8 +7,8 @@
7 * 7 *
8 */ 8 */
9 9
10#ifndef CAN_SKB_H 10#ifndef _CAN_SKB_H
11#define CAN_SKB_H 11#define _CAN_SKB_H
12 12
13#include <linux/types.h> 13#include <linux/types.h>
14#include <linux/skbuff.h> 14#include <linux/skbuff.h>
@@ -80,4 +80,4 @@ static inline struct sk_buff *can_create_echo_skb(struct sk_buff *skb)
80 return skb; 80 return skb;
81} 81}
82 82
83#endif /* CAN_SKB_H */ 83#endif /* !_CAN_SKB_H */
diff --git a/include/linux/capability.h b/include/linux/capability.h
index a6ee1f9a5018..84b13ad67c1c 100644
--- a/include/linux/capability.h
+++ b/include/linux/capability.h
@@ -210,7 +210,7 @@ extern bool has_ns_capability_noaudit(struct task_struct *t,
210 struct user_namespace *ns, int cap); 210 struct user_namespace *ns, int cap);
211extern bool capable(int cap); 211extern bool capable(int cap);
212extern bool ns_capable(struct user_namespace *ns, int cap); 212extern bool ns_capable(struct user_namespace *ns, int cap);
213extern bool inode_capable(const struct inode *inode, int cap); 213extern bool capable_wrt_inode_uidgid(const struct inode *inode, int cap);
214extern bool file_ns_capable(const struct file *file, struct user_namespace *ns, int cap); 214extern bool file_ns_capable(const struct file *file, struct user_namespace *ns, int cap);
215 215
216/* audit system wants to get cap info from files as well */ 216/* audit system wants to get cap info from files as well */
diff --git a/include/linux/ceph/ceph_fs.h b/include/linux/ceph/ceph_fs.h
index 5f6db18d72e8..3c97d5e9b951 100644
--- a/include/linux/ceph/ceph_fs.h
+++ b/include/linux/ceph/ceph_fs.h
@@ -625,6 +625,8 @@ int ceph_flags_to_mode(int flags);
625 CEPH_CAP_LINK_EXCL | \ 625 CEPH_CAP_LINK_EXCL | \
626 CEPH_CAP_XATTR_EXCL | \ 626 CEPH_CAP_XATTR_EXCL | \
627 CEPH_CAP_FILE_EXCL) 627 CEPH_CAP_FILE_EXCL)
628#define CEPH_CAP_ANY_FILE_RD (CEPH_CAP_FILE_RD | CEPH_CAP_FILE_CACHE | \
629 CEPH_CAP_FILE_SHARED)
628#define CEPH_CAP_ANY_FILE_WR (CEPH_CAP_FILE_WR | CEPH_CAP_FILE_BUFFER | \ 630#define CEPH_CAP_ANY_FILE_WR (CEPH_CAP_FILE_WR | CEPH_CAP_FILE_BUFFER | \
629 CEPH_CAP_FILE_EXCL) 631 CEPH_CAP_FILE_EXCL)
630#define CEPH_CAP_ANY_WR (CEPH_CAP_ANY_EXCL | CEPH_CAP_ANY_FILE_WR) 632#define CEPH_CAP_ANY_WR (CEPH_CAP_ANY_EXCL | CEPH_CAP_ANY_FILE_WR)
diff --git a/include/linux/ceph/libceph.h b/include/linux/ceph/libceph.h
index 2f49aa4c4f7f..279b0afac1c1 100644
--- a/include/linux/ceph/libceph.h
+++ b/include/linux/ceph/libceph.h
@@ -222,8 +222,6 @@ extern void ceph_copy_to_page_vector(struct page **pages,
222extern void ceph_copy_from_page_vector(struct page **pages, 222extern void ceph_copy_from_page_vector(struct page **pages,
223 void *data, 223 void *data,
224 loff_t off, size_t len); 224 loff_t off, size_t len);
225extern int ceph_copy_page_vector_to_user(struct page **pages, void __user *data,
226 loff_t off, size_t len);
227extern void ceph_zero_page_vector_range(int off, int len, struct page **pages); 225extern void ceph_zero_page_vector_range(int off, int len, struct page **pages);
228 226
229 227
diff --git a/include/linux/ceph/mon_client.h b/include/linux/ceph/mon_client.h
index a486f390dfbe..deb47e45ac7c 100644
--- a/include/linux/ceph/mon_client.h
+++ b/include/linux/ceph/mon_client.h
@@ -40,9 +40,9 @@ struct ceph_mon_request {
40}; 40};
41 41
42/* 42/*
43 * ceph_mon_generic_request is being used for the statfs and poolop requests 43 * ceph_mon_generic_request is being used for the statfs, poolop and
44 * which are bening done a bit differently because we need to get data back 44 * mon_get_version requests which are being done a bit differently
45 * to the caller 45 * because we need to get data back to the caller
46 */ 46 */
47struct ceph_mon_generic_request { 47struct ceph_mon_generic_request {
48 struct kref kref; 48 struct kref kref;
@@ -104,10 +104,15 @@ extern int ceph_monc_got_mdsmap(struct ceph_mon_client *monc, u32 have);
104extern int ceph_monc_got_osdmap(struct ceph_mon_client *monc, u32 have); 104extern int ceph_monc_got_osdmap(struct ceph_mon_client *monc, u32 have);
105 105
106extern void ceph_monc_request_next_osdmap(struct ceph_mon_client *monc); 106extern void ceph_monc_request_next_osdmap(struct ceph_mon_client *monc);
107extern int ceph_monc_wait_osdmap(struct ceph_mon_client *monc, u32 epoch,
108 unsigned long timeout);
107 109
108extern int ceph_monc_do_statfs(struct ceph_mon_client *monc, 110extern int ceph_monc_do_statfs(struct ceph_mon_client *monc,
109 struct ceph_statfs *buf); 111 struct ceph_statfs *buf);
110 112
113extern int ceph_monc_do_get_version(struct ceph_mon_client *monc,
114 const char *what, u64 *newest);
115
111extern int ceph_monc_open_session(struct ceph_mon_client *monc); 116extern int ceph_monc_open_session(struct ceph_mon_client *monc);
112 117
113extern int ceph_monc_validate_auth(struct ceph_mon_client *monc); 118extern int ceph_monc_validate_auth(struct ceph_mon_client *monc);
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index d60904b9e505..8a111dd42d7a 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -21,6 +21,7 @@
21#include <linux/percpu-refcount.h> 21#include <linux/percpu-refcount.h>
22#include <linux/seq_file.h> 22#include <linux/seq_file.h>
23#include <linux/kernfs.h> 23#include <linux/kernfs.h>
24#include <linux/wait.h>
24 25
25#ifdef CONFIG_CGROUPS 26#ifdef CONFIG_CGROUPS
26 27
@@ -47,21 +48,45 @@ enum cgroup_subsys_id {
47}; 48};
48#undef SUBSYS 49#undef SUBSYS
49 50
50/* Per-subsystem/per-cgroup state maintained by the system. */ 51/*
52 * Per-subsystem/per-cgroup state maintained by the system. This is the
53 * fundamental structural building block that controllers deal with.
54 *
55 * Fields marked with "PI:" are public and immutable and may be accessed
56 * directly without synchronization.
57 */
51struct cgroup_subsys_state { 58struct cgroup_subsys_state {
52 /* the cgroup that this css is attached to */ 59 /* PI: the cgroup that this css is attached to */
53 struct cgroup *cgroup; 60 struct cgroup *cgroup;
54 61
55 /* the cgroup subsystem that this css is attached to */ 62 /* PI: the cgroup subsystem that this css is attached to */
56 struct cgroup_subsys *ss; 63 struct cgroup_subsys *ss;
57 64
58 /* reference count - access via css_[try]get() and css_put() */ 65 /* reference count - access via css_[try]get() and css_put() */
59 struct percpu_ref refcnt; 66 struct percpu_ref refcnt;
60 67
61 /* the parent css */ 68 /* PI: the parent css */
62 struct cgroup_subsys_state *parent; 69 struct cgroup_subsys_state *parent;
63 70
64 unsigned long flags; 71 /* siblings list anchored at the parent's ->children */
72 struct list_head sibling;
73 struct list_head children;
74
75 /*
76 * PI: Subsys-unique ID. 0 is unused and root is always 1. The
77 * matching css can be looked up using css_from_id().
78 */
79 int id;
80
81 unsigned int flags;
82
83 /*
84 * Monotonically increasing unique serial number which defines a
85 * uniform order among all csses. It's guaranteed that all
86 * ->children lists are in the ascending order of ->serial_nr and
87 * used to allow interrupting and resuming iterations.
88 */
89 u64 serial_nr;
65 90
66 /* percpu_ref killing and RCU release */ 91 /* percpu_ref killing and RCU release */
67 struct rcu_head rcu_head; 92 struct rcu_head rcu_head;
@@ -70,8 +95,9 @@ struct cgroup_subsys_state {
70 95
71/* bits in struct cgroup_subsys_state flags field */ 96/* bits in struct cgroup_subsys_state flags field */
72enum { 97enum {
73 CSS_ROOT = (1 << 0), /* this CSS is the root of the subsystem */ 98 CSS_NO_REF = (1 << 0), /* no reference counting for this css */
74 CSS_ONLINE = (1 << 1), /* between ->css_online() and ->css_offline() */ 99 CSS_ONLINE = (1 << 1), /* between ->css_online() and ->css_offline() */
100 CSS_RELEASED = (1 << 2), /* refcnt reached zero, released */
75}; 101};
76 102
77/** 103/**
@@ -82,8 +108,7 @@ enum {
82 */ 108 */
83static inline void css_get(struct cgroup_subsys_state *css) 109static inline void css_get(struct cgroup_subsys_state *css)
84{ 110{
85 /* We don't need to reference count the root state */ 111 if (!(css->flags & CSS_NO_REF))
86 if (!(css->flags & CSS_ROOT))
87 percpu_ref_get(&css->refcnt); 112 percpu_ref_get(&css->refcnt);
88} 113}
89 114
@@ -91,35 +116,51 @@ static inline void css_get(struct cgroup_subsys_state *css)
91 * css_tryget - try to obtain a reference on the specified css 116 * css_tryget - try to obtain a reference on the specified css
92 * @css: target css 117 * @css: target css
93 * 118 *
94 * Obtain a reference on @css if it's alive. The caller naturally needs to 119 * Obtain a reference on @css unless it already has reached zero and is
95 * ensure that @css is accessible but doesn't have to be holding a 120 * being released. This function doesn't care whether @css is on or
121 * offline. The caller naturally needs to ensure that @css is accessible
122 * but doesn't have to be holding a reference on it - IOW, RCU protected
123 * access is good enough for this function. Returns %true if a reference
124 * count was successfully obtained; %false otherwise.
125 */
126static inline bool css_tryget(struct cgroup_subsys_state *css)
127{
128 if (!(css->flags & CSS_NO_REF))
129 return percpu_ref_tryget(&css->refcnt);
130 return true;
131}
132
133/**
134 * css_tryget_online - try to obtain a reference on the specified css if online
135 * @css: target css
136 *
137 * Obtain a reference on @css if it's online. The caller naturally needs
138 * to ensure that @css is accessible but doesn't have to be holding a
96 * reference on it - IOW, RCU protected access is good enough for this 139 * reference on it - IOW, RCU protected access is good enough for this
97 * function. Returns %true if a reference count was successfully obtained; 140 * function. Returns %true if a reference count was successfully obtained;
98 * %false otherwise. 141 * %false otherwise.
99 */ 142 */
100static inline bool css_tryget(struct cgroup_subsys_state *css) 143static inline bool css_tryget_online(struct cgroup_subsys_state *css)
101{ 144{
102 if (css->flags & CSS_ROOT) 145 if (!(css->flags & CSS_NO_REF))
103 return true; 146 return percpu_ref_tryget_live(&css->refcnt);
104 return percpu_ref_tryget(&css->refcnt); 147 return true;
105} 148}
106 149
107/** 150/**
108 * css_put - put a css reference 151 * css_put - put a css reference
109 * @css: target css 152 * @css: target css
110 * 153 *
111 * Put a reference obtained via css_get() and css_tryget(). 154 * Put a reference obtained via css_get() and css_tryget_online().
112 */ 155 */
113static inline void css_put(struct cgroup_subsys_state *css) 156static inline void css_put(struct cgroup_subsys_state *css)
114{ 157{
115 if (!(css->flags & CSS_ROOT)) 158 if (!(css->flags & CSS_NO_REF))
116 percpu_ref_put(&css->refcnt); 159 percpu_ref_put(&css->refcnt);
117} 160}
118 161
119/* bits in struct cgroup flags field */ 162/* bits in struct cgroup flags field */
120enum { 163enum {
121 /* Control Group is dead */
122 CGRP_DEAD,
123 /* 164 /*
124 * Control Group has previously had a child cgroup or a task, 165 * Control Group has previously had a child cgroup or a task,
125 * but no longer (only if CGRP_NOTIFY_ON_RELEASE is set) 166 * but no longer (only if CGRP_NOTIFY_ON_RELEASE is set)
@@ -133,48 +174,37 @@ enum {
133 * specified at mount time and thus is implemented here. 174 * specified at mount time and thus is implemented here.
134 */ 175 */
135 CGRP_CPUSET_CLONE_CHILDREN, 176 CGRP_CPUSET_CLONE_CHILDREN,
136 /* see the comment above CGRP_ROOT_SANE_BEHAVIOR for details */
137 CGRP_SANE_BEHAVIOR,
138}; 177};
139 178
140struct cgroup { 179struct cgroup {
180 /* self css with NULL ->ss, points back to this cgroup */
181 struct cgroup_subsys_state self;
182
141 unsigned long flags; /* "unsigned long" so bitops work */ 183 unsigned long flags; /* "unsigned long" so bitops work */
142 184
143 /* 185 /*
144 * idr allocated in-hierarchy ID. 186 * idr allocated in-hierarchy ID.
145 * 187 *
146 * The ID of the root cgroup is always 0, and a new cgroup 188 * ID 0 is not used, the ID of the root cgroup is always 1, and a
147 * will be assigned with a smallest available ID. 189 * new cgroup will be assigned with a smallest available ID.
148 * 190 *
149 * Allocating/Removing ID must be protected by cgroup_mutex. 191 * Allocating/Removing ID must be protected by cgroup_mutex.
150 */ 192 */
151 int id; 193 int id;
152 194
153 /* the number of attached css's */
154 int nr_css;
155
156 atomic_t refcnt;
157
158 /* 195 /*
159 * We link our 'sibling' struct into our parent's 'children'. 196 * If this cgroup contains any tasks, it contributes one to
160 * Our children link their 'sibling' into our 'children'. 197 * populated_cnt. All children with non-zero popuplated_cnt of
198 * their own contribute one. The count is zero iff there's no task
199 * in this cgroup or its subtree.
161 */ 200 */
162 struct list_head sibling; /* my parent's children */ 201 int populated_cnt;
163 struct list_head children; /* my children */
164 202
165 struct cgroup *parent; /* my parent */
166 struct kernfs_node *kn; /* cgroup kernfs entry */ 203 struct kernfs_node *kn; /* cgroup kernfs entry */
204 struct kernfs_node *populated_kn; /* kn for "cgroup.subtree_populated" */
167 205
168 /* 206 /* the bitmask of subsystems enabled on the child cgroups */
169 * Monotonically increasing unique serial number which defines a 207 unsigned int child_subsys_mask;
170 * uniform order among all cgroups. It's guaranteed that all
171 * ->children lists are in the ascending order of ->serial_nr.
172 * It's used to allow interrupting and resuming iterations.
173 */
174 u64 serial_nr;
175
176 /* The bitmask of subsystems attached to this cgroup */
177 unsigned long subsys_mask;
178 208
179 /* Private pointers for each registered subsystem */ 209 /* Private pointers for each registered subsystem */
180 struct cgroup_subsys_state __rcu *subsys[CGROUP_SUBSYS_COUNT]; 210 struct cgroup_subsys_state __rcu *subsys[CGROUP_SUBSYS_COUNT];
@@ -188,6 +218,15 @@ struct cgroup {
188 struct list_head cset_links; 218 struct list_head cset_links;
189 219
190 /* 220 /*
221 * On the default hierarchy, a css_set for a cgroup with some
222 * susbsys disabled will point to css's which are associated with
223 * the closest ancestor which has the subsys enabled. The
224 * following lists all css_sets which point to this cgroup's css
225 * for the given subsystem.
226 */
227 struct list_head e_csets[CGROUP_SUBSYS_COUNT];
228
229 /*
191 * Linked list running through all cgroups that can 230 * Linked list running through all cgroups that can
192 * potentially be reaped by the release agent. Protected by 231 * potentially be reaped by the release agent. Protected by
193 * release_list_lock 232 * release_list_lock
@@ -201,12 +240,8 @@ struct cgroup {
201 struct list_head pidlists; 240 struct list_head pidlists;
202 struct mutex pidlist_mutex; 241 struct mutex pidlist_mutex;
203 242
204 /* dummy css with NULL ->ss, points back to this cgroup */ 243 /* used to wait for offlining of csses */
205 struct cgroup_subsys_state dummy_css; 244 wait_queue_head_t offline_waitq;
206
207 /* For css percpu_ref killing and RCU-protected deletion */
208 struct rcu_head rcu_head;
209 struct work_struct destroy_work;
210}; 245};
211 246
212#define MAX_CGROUP_ROOT_NAMELEN 64 247#define MAX_CGROUP_ROOT_NAMELEN 64
@@ -250,6 +285,12 @@ enum {
250 * 285 *
251 * - "cgroup.clone_children" is removed. 286 * - "cgroup.clone_children" is removed.
252 * 287 *
288 * - "cgroup.subtree_populated" is available. Its value is 0 if
289 * the cgroup and its descendants contain no task; otherwise, 1.
290 * The file also generates kernfs notification which can be
291 * monitored through poll and [di]notify when the value of the
292 * file changes.
293 *
253 * - If mount is requested with sane_behavior but without any 294 * - If mount is requested with sane_behavior but without any
254 * subsystem, the default unified hierarchy is mounted. 295 * subsystem, the default unified hierarchy is mounted.
255 * 296 *
@@ -264,6 +305,8 @@ enum {
264 * the flag is not created. 305 * the flag is not created.
265 * 306 *
266 * - blkcg: blk-throttle becomes properly hierarchical. 307 * - blkcg: blk-throttle becomes properly hierarchical.
308 *
309 * - debug: disallowed on the default hierarchy.
267 */ 310 */
268 CGRP_ROOT_SANE_BEHAVIOR = (1 << 0), 311 CGRP_ROOT_SANE_BEHAVIOR = (1 << 0),
269 312
@@ -282,6 +325,9 @@ enum {
282struct cgroup_root { 325struct cgroup_root {
283 struct kernfs_root *kf_root; 326 struct kernfs_root *kf_root;
284 327
328 /* The bitmask of subsystems attached to this hierarchy */
329 unsigned int subsys_mask;
330
285 /* Unique id for this hierarchy. */ 331 /* Unique id for this hierarchy. */
286 int hierarchy_id; 332 int hierarchy_id;
287 333
@@ -295,7 +341,7 @@ struct cgroup_root {
295 struct list_head root_list; 341 struct list_head root_list;
296 342
297 /* Hierarchy-specific flags */ 343 /* Hierarchy-specific flags */
298 unsigned long flags; 344 unsigned int flags;
299 345
300 /* IDs for cgroups in this hierarchy */ 346 /* IDs for cgroups in this hierarchy */
301 struct idr cgroup_idr; 347 struct idr cgroup_idr;
@@ -342,6 +388,9 @@ struct css_set {
342 */ 388 */
343 struct list_head cgrp_links; 389 struct list_head cgrp_links;
344 390
391 /* the default cgroup associated with this css_set */
392 struct cgroup *dfl_cgrp;
393
345 /* 394 /*
346 * Set of subsystem states, one for each subsystem. This array is 395 * Set of subsystem states, one for each subsystem. This array is
347 * immutable after creation apart from the init_css_set during 396 * immutable after creation apart from the init_css_set during
@@ -366,6 +415,15 @@ struct css_set {
366 struct cgroup *mg_src_cgrp; 415 struct cgroup *mg_src_cgrp;
367 struct css_set *mg_dst_cset; 416 struct css_set *mg_dst_cset;
368 417
418 /*
419 * On the default hierarhcy, ->subsys[ssid] may point to a css
420 * attached to an ancestor instead of the cgroup this css_set is
421 * associated with. The following node is anchored at
422 * ->subsys[ssid]->cgroup->e_csets[ssid] and provides a way to
423 * iterate through all css's attached to a given cgroup.
424 */
425 struct list_head e_cset_node[CGROUP_SUBSYS_COUNT];
426
369 /* For RCU-protected deletion */ 427 /* For RCU-protected deletion */
370 struct rcu_head rcu_head; 428 struct rcu_head rcu_head;
371}; 429};
@@ -405,8 +463,7 @@ struct cftype {
405 463
406 /* 464 /*
407 * The maximum length of string, excluding trailing nul, that can 465 * The maximum length of string, excluding trailing nul, that can
408 * be passed to write_string. If < PAGE_SIZE-1, PAGE_SIZE-1 is 466 * be passed to write. If < PAGE_SIZE-1, PAGE_SIZE-1 is assumed.
409 * assumed.
410 */ 467 */
411 size_t max_write_len; 468 size_t max_write_len;
412 469
@@ -453,19 +510,13 @@ struct cftype {
453 s64 val); 510 s64 val);
454 511
455 /* 512 /*
456 * write_string() is passed a nul-terminated kernelspace 513 * write() is the generic write callback which maps directly to
457 * buffer of maximum length determined by max_write_len. 514 * kernfs write operation and overrides all other operations.
458 * Returns 0 or -ve error code. 515 * Maximum write size is determined by ->max_write_len. Use
459 */ 516 * of_css/cft() to access the associated css and cft.
460 int (*write_string)(struct cgroup_subsys_state *css, struct cftype *cft,
461 char *buffer);
462 /*
463 * trigger() callback can be used to get some kick from the
464 * userspace, when the actual string written is not important
465 * at all. The private field can be used to determine the
466 * kick type for multiplexing.
467 */ 517 */
468 int (*trigger)(struct cgroup_subsys_state *css, unsigned int event); 518 ssize_t (*write)(struct kernfs_open_file *of,
519 char *buf, size_t nbytes, loff_t off);
469 520
470#ifdef CONFIG_DEBUG_LOCK_ALLOC 521#ifdef CONFIG_DEBUG_LOCK_ALLOC
471 struct lock_class_key lockdep_key; 522 struct lock_class_key lockdep_key;
@@ -504,14 +555,24 @@ static inline ino_t cgroup_ino(struct cgroup *cgrp)
504 return 0; 555 return 0;
505} 556}
506 557
507static inline struct cftype *seq_cft(struct seq_file *seq) 558/* cft/css accessors for cftype->write() operation */
559static inline struct cftype *of_cft(struct kernfs_open_file *of)
508{ 560{
509 struct kernfs_open_file *of = seq->private;
510
511 return of->kn->priv; 561 return of->kn->priv;
512} 562}
513 563
514struct cgroup_subsys_state *seq_css(struct seq_file *seq); 564struct cgroup_subsys_state *of_css(struct kernfs_open_file *of);
565
566/* cft/css accessors for cftype->seq_*() operations */
567static inline struct cftype *seq_cft(struct seq_file *seq)
568{
569 return of_cft(seq->private);
570}
571
572static inline struct cgroup_subsys_state *seq_css(struct seq_file *seq)
573{
574 return of_css(seq->private);
575}
515 576
516/* 577/*
517 * Name / path handling functions. All are thin wrappers around the kernfs 578 * Name / path handling functions. All are thin wrappers around the kernfs
@@ -612,6 +673,9 @@ struct cgroup_subsys {
612 /* link to parent, protected by cgroup_lock() */ 673 /* link to parent, protected by cgroup_lock() */
613 struct cgroup_root *root; 674 struct cgroup_root *root;
614 675
676 /* idr for css->id */
677 struct idr css_idr;
678
615 /* 679 /*
616 * List of cftypes. Each entry is the first entry of an array 680 * List of cftypes. Each entry is the first entry of an array
617 * terminated by zero length name. 681 * terminated by zero length name.
@@ -627,19 +691,6 @@ struct cgroup_subsys {
627#undef SUBSYS 691#undef SUBSYS
628 692
629/** 693/**
630 * css_parent - find the parent css
631 * @css: the target cgroup_subsys_state
632 *
633 * Return the parent css of @css. This function is guaranteed to return
634 * non-NULL parent as long as @css isn't the root.
635 */
636static inline
637struct cgroup_subsys_state *css_parent(struct cgroup_subsys_state *css)
638{
639 return css->parent;
640}
641
642/**
643 * task_css_set_check - obtain a task's css_set with extra access conditions 694 * task_css_set_check - obtain a task's css_set with extra access conditions
644 * @task: the task to obtain css_set for 695 * @task: the task to obtain css_set for
645 * @__c: extra condition expression to be passed to rcu_dereference_check() 696 * @__c: extra condition expression to be passed to rcu_dereference_check()
@@ -731,14 +782,14 @@ struct cgroup_subsys_state *css_from_id(int id, struct cgroup_subsys *ss);
731 * @pos: the css * to use as the loop cursor 782 * @pos: the css * to use as the loop cursor
732 * @parent: css whose children to walk 783 * @parent: css whose children to walk
733 * 784 *
734 * Walk @parent's children. Must be called under rcu_read_lock(). A child 785 * Walk @parent's children. Must be called under rcu_read_lock().
735 * css which hasn't finished ->css_online() or already has finished
736 * ->css_offline() may show up during traversal and it's each subsystem's
737 * responsibility to verify that each @pos is alive.
738 * 786 *
739 * If a subsystem synchronizes against the parent in its ->css_online() and 787 * If a subsystem synchronizes ->css_online() and the start of iteration, a
740 * before starting iterating, a css which finished ->css_online() is 788 * css which finished ->css_online() is guaranteed to be visible in the
741 * guaranteed to be visible in the future iterations. 789 * future iterations and will stay visible until the last reference is put.
790 * A css which hasn't finished ->css_online() or already finished
791 * ->css_offline() may show up during traversal. It's each subsystem's
792 * responsibility to synchronize against on/offlining.
742 * 793 *
743 * It is allowed to temporarily drop RCU read lock during iteration. The 794 * It is allowed to temporarily drop RCU read lock during iteration. The
744 * caller is responsible for ensuring that @pos remains accessible until 795 * caller is responsible for ensuring that @pos remains accessible until
@@ -761,17 +812,16 @@ css_rightmost_descendant(struct cgroup_subsys_state *pos);
761 * @root: css whose descendants to walk 812 * @root: css whose descendants to walk
762 * 813 *
763 * Walk @root's descendants. @root is included in the iteration and the 814 * Walk @root's descendants. @root is included in the iteration and the
764 * first node to be visited. Must be called under rcu_read_lock(). A 815 * first node to be visited. Must be called under rcu_read_lock().
765 * descendant css which hasn't finished ->css_online() or already has
766 * finished ->css_offline() may show up during traversal and it's each
767 * subsystem's responsibility to verify that each @pos is alive.
768 * 816 *
769 * If a subsystem synchronizes against the parent in its ->css_online() and 817 * If a subsystem synchronizes ->css_online() and the start of iteration, a
770 * before starting iterating, and synchronizes against @pos on each 818 * css which finished ->css_online() is guaranteed to be visible in the
771 * iteration, any descendant css which finished ->css_online() is 819 * future iterations and will stay visible until the last reference is put.
772 * guaranteed to be visible in the future iterations. 820 * A css which hasn't finished ->css_online() or already finished
821 * ->css_offline() may show up during traversal. It's each subsystem's
822 * responsibility to synchronize against on/offlining.
773 * 823 *
774 * In other words, the following guarantees that a descendant can't escape 824 * For example, the following guarantees that a descendant can't escape
775 * state updates of its ancestors. 825 * state updates of its ancestors.
776 * 826 *
777 * my_online(@css) 827 * my_online(@css)
@@ -827,18 +877,34 @@ css_next_descendant_post(struct cgroup_subsys_state *pos,
827 * 877 *
828 * Similar to css_for_each_descendant_pre() but performs post-order 878 * Similar to css_for_each_descendant_pre() but performs post-order
829 * traversal instead. @root is included in the iteration and the last 879 * traversal instead. @root is included in the iteration and the last
830 * node to be visited. Note that the walk visibility guarantee described 880 * node to be visited.
831 * in pre-order walk doesn't apply the same to post-order walks. 881 *
882 * If a subsystem synchronizes ->css_online() and the start of iteration, a
883 * css which finished ->css_online() is guaranteed to be visible in the
884 * future iterations and will stay visible until the last reference is put.
885 * A css which hasn't finished ->css_online() or already finished
886 * ->css_offline() may show up during traversal. It's each subsystem's
887 * responsibility to synchronize against on/offlining.
888 *
889 * Note that the walk visibility guarantee example described in pre-order
890 * walk doesn't apply the same to post-order walks.
832 */ 891 */
833#define css_for_each_descendant_post(pos, css) \ 892#define css_for_each_descendant_post(pos, css) \
834 for ((pos) = css_next_descendant_post(NULL, (css)); (pos); \ 893 for ((pos) = css_next_descendant_post(NULL, (css)); (pos); \
835 (pos) = css_next_descendant_post((pos), (css))) 894 (pos) = css_next_descendant_post((pos), (css)))
836 895
896bool css_has_online_children(struct cgroup_subsys_state *css);
897
837/* A css_task_iter should be treated as an opaque object */ 898/* A css_task_iter should be treated as an opaque object */
838struct css_task_iter { 899struct css_task_iter {
839 struct cgroup_subsys_state *origin_css; 900 struct cgroup_subsys *ss;
840 struct list_head *cset_link; 901
841 struct list_head *task; 902 struct list_head *cset_pos;
903 struct list_head *cset_head;
904
905 struct list_head *task_pos;
906 struct list_head *tasks_head;
907 struct list_head *mg_tasks_head;
842}; 908};
843 909
844void css_task_iter_start(struct cgroup_subsys_state *css, 910void css_task_iter_start(struct cgroup_subsys_state *css,
@@ -849,8 +915,8 @@ void css_task_iter_end(struct css_task_iter *it);
849int cgroup_attach_task_all(struct task_struct *from, struct task_struct *); 915int cgroup_attach_task_all(struct task_struct *from, struct task_struct *);
850int cgroup_transfer_tasks(struct cgroup *to, struct cgroup *from); 916int cgroup_transfer_tasks(struct cgroup *to, struct cgroup *from);
851 917
852struct cgroup_subsys_state *css_tryget_from_dir(struct dentry *dentry, 918struct cgroup_subsys_state *css_tryget_online_from_dir(struct dentry *dentry,
853 struct cgroup_subsys *ss); 919 struct cgroup_subsys *ss);
854 920
855#else /* !CONFIG_CGROUPS */ 921#else /* !CONFIG_CGROUPS */
856 922
diff --git a/include/linux/cgroup_subsys.h b/include/linux/cgroup_subsys.h
index 768fe44e19f0..98c4f9b12b03 100644
--- a/include/linux/cgroup_subsys.h
+++ b/include/linux/cgroup_subsys.h
@@ -7,10 +7,6 @@
7SUBSYS(cpuset) 7SUBSYS(cpuset)
8#endif 8#endif
9 9
10#if IS_ENABLED(CONFIG_CGROUP_DEBUG)
11SUBSYS(debug)
12#endif
13
14#if IS_ENABLED(CONFIG_CGROUP_SCHED) 10#if IS_ENABLED(CONFIG_CGROUP_SCHED)
15SUBSYS(cpu) 11SUBSYS(cpu)
16#endif 12#endif
@@ -50,6 +46,13 @@ SUBSYS(net_prio)
50#if IS_ENABLED(CONFIG_CGROUP_HUGETLB) 46#if IS_ENABLED(CONFIG_CGROUP_HUGETLB)
51SUBSYS(hugetlb) 47SUBSYS(hugetlb)
52#endif 48#endif
49
50/*
51 * The following subsystems are not supported on the default hierarchy.
52 */
53#if IS_ENABLED(CONFIG_CGROUP_DEBUG)
54SUBSYS(debug)
55#endif
53/* 56/*
54 * DO NOT ADD ANY SUBSYSTEM WITHOUT EXPLICIT ACKS FROM CGROUP MAINTAINERS. 57 * DO NOT ADD ANY SUBSYSTEM WITHOUT EXPLICIT ACKS FROM CGROUP MAINTAINERS.
55 */ 58 */
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
index 511917416fb0..0c287dbbb144 100644
--- a/include/linux/clk-provider.h
+++ b/include/linux/clk-provider.h
@@ -40,14 +40,14 @@ struct dentry;
40 * through the clk_* api. 40 * through the clk_* api.
41 * 41 *
42 * @prepare: Prepare the clock for enabling. This must not return until 42 * @prepare: Prepare the clock for enabling. This must not return until
43 * the clock is fully prepared, and it's safe to call clk_enable. 43 * the clock is fully prepared, and it's safe to call clk_enable.
44 * This callback is intended to allow clock implementations to 44 * This callback is intended to allow clock implementations to
45 * do any initialisation that may sleep. Called with 45 * do any initialisation that may sleep. Called with
46 * prepare_lock held. 46 * prepare_lock held.
47 * 47 *
48 * @unprepare: Release the clock from its prepared state. This will typically 48 * @unprepare: Release the clock from its prepared state. This will typically
49 * undo any work done in the @prepare callback. Called with 49 * undo any work done in the @prepare callback. Called with
50 * prepare_lock held. 50 * prepare_lock held.
51 * 51 *
52 * @is_prepared: Queries the hardware to determine if the clock is prepared. 52 * @is_prepared: Queries the hardware to determine if the clock is prepared.
53 * This function is allowed to sleep. Optional, if this op is not 53 * This function is allowed to sleep. Optional, if this op is not
@@ -58,16 +58,16 @@ struct dentry;
58 * Called with prepare mutex held. This function may sleep. 58 * Called with prepare mutex held. This function may sleep.
59 * 59 *
60 * @enable: Enable the clock atomically. This must not return until the 60 * @enable: Enable the clock atomically. This must not return until the
61 * clock is generating a valid clock signal, usable by consumer 61 * clock is generating a valid clock signal, usable by consumer
62 * devices. Called with enable_lock held. This function must not 62 * devices. Called with enable_lock held. This function must not
63 * sleep. 63 * sleep.
64 * 64 *
65 * @disable: Disable the clock atomically. Called with enable_lock held. 65 * @disable: Disable the clock atomically. Called with enable_lock held.
66 * This function must not sleep. 66 * This function must not sleep.
67 * 67 *
68 * @is_enabled: Queries the hardware to determine if the clock is enabled. 68 * @is_enabled: Queries the hardware to determine if the clock is enabled.
69 * This function must not sleep. Optional, if this op is not 69 * This function must not sleep. Optional, if this op is not
70 * set then the enable count will be used. 70 * set then the enable count will be used.
71 * 71 *
72 * @disable_unused: Disable the clock atomically. Only called from 72 * @disable_unused: Disable the clock atomically. Only called from
73 * clk_disable_unused for gate clocks with special needs. 73 * clk_disable_unused for gate clocks with special needs.
@@ -75,34 +75,35 @@ struct dentry;
75 * sleep. 75 * sleep.
76 * 76 *
77 * @recalc_rate Recalculate the rate of this clock, by querying hardware. The 77 * @recalc_rate Recalculate the rate of this clock, by querying hardware. The
78 * parent rate is an input parameter. It is up to the caller to 78 * parent rate is an input parameter. It is up to the caller to
79 * ensure that the prepare_mutex is held across this call. 79 * ensure that the prepare_mutex is held across this call.
80 * Returns the calculated rate. Optional, but recommended - if 80 * Returns the calculated rate. Optional, but recommended - if
81 * this op is not set then clock rate will be initialized to 0. 81 * this op is not set then clock rate will be initialized to 0.
82 * 82 *
83 * @round_rate: Given a target rate as input, returns the closest rate actually 83 * @round_rate: Given a target rate as input, returns the closest rate actually
84 * supported by the clock. 84 * supported by the clock. The parent rate is an input/output
85 * parameter.
85 * 86 *
86 * @determine_rate: Given a target rate as input, returns the closest rate 87 * @determine_rate: Given a target rate as input, returns the closest rate
87 * actually supported by the clock, and optionally the parent clock 88 * actually supported by the clock, and optionally the parent clock
88 * that should be used to provide the clock rate. 89 * that should be used to provide the clock rate.
89 * 90 *
90 * @get_parent: Queries the hardware to determine the parent of a clock. The
91 * return value is a u8 which specifies the index corresponding to
92 * the parent clock. This index can be applied to either the
93 * .parent_names or .parents arrays. In short, this function
94 * translates the parent value read from hardware into an array
95 * index. Currently only called when the clock is initialized by
96 * __clk_init. This callback is mandatory for clocks with
97 * multiple parents. It is optional (and unnecessary) for clocks
98 * with 0 or 1 parents.
99 *
100 * @set_parent: Change the input source of this clock; for clocks with multiple 91 * @set_parent: Change the input source of this clock; for clocks with multiple
101 * possible parents specify a new parent by passing in the index 92 * possible parents specify a new parent by passing in the index
102 * as a u8 corresponding to the parent in either the .parent_names 93 * as a u8 corresponding to the parent in either the .parent_names
103 * or .parents arrays. This function in affect translates an 94 * or .parents arrays. This function in affect translates an
104 * array index into the value programmed into the hardware. 95 * array index into the value programmed into the hardware.
105 * Returns 0 on success, -EERROR otherwise. 96 * Returns 0 on success, -EERROR otherwise.
97 *
98 * @get_parent: Queries the hardware to determine the parent of a clock. The
99 * return value is a u8 which specifies the index corresponding to
100 * the parent clock. This index can be applied to either the
101 * .parent_names or .parents arrays. In short, this function
102 * translates the parent value read from hardware into an array
103 * index. Currently only called when the clock is initialized by
104 * __clk_init. This callback is mandatory for clocks with
105 * multiple parents. It is optional (and unnecessary) for clocks
106 * with 0 or 1 parents.
106 * 107 *
107 * @set_rate: Change the rate of this clock. The requested rate is specified 108 * @set_rate: Change the rate of this clock. The requested rate is specified
108 * by the second argument, which should typically be the return 109 * by the second argument, which should typically be the return
@@ -110,13 +111,6 @@ struct dentry;
110 * which is likely helpful for most .set_rate implementation. 111 * which is likely helpful for most .set_rate implementation.
111 * Returns 0 on success, -EERROR otherwise. 112 * Returns 0 on success, -EERROR otherwise.
112 * 113 *
113 * @recalc_accuracy: Recalculate the accuracy of this clock. The clock accuracy
114 * is expressed in ppb (parts per billion). The parent accuracy is
115 * an input parameter.
116 * Returns the calculated accuracy. Optional - if this op is not
117 * set then clock accuracy will be initialized to parent accuracy
118 * or 0 (perfect clock) if clock has no parent.
119 *
120 * @set_rate_and_parent: Change the rate and the parent of this clock. The 114 * @set_rate_and_parent: Change the rate and the parent of this clock. The
121 * requested rate is specified by the second argument, which 115 * requested rate is specified by the second argument, which
122 * should typically be the return of .round_rate call. The 116 * should typically be the return of .round_rate call. The
@@ -128,6 +122,18 @@ struct dentry;
128 * separately via calls to .set_parent and .set_rate. 122 * separately via calls to .set_parent and .set_rate.
129 * Returns 0 on success, -EERROR otherwise. 123 * Returns 0 on success, -EERROR otherwise.
130 * 124 *
125 * @recalc_accuracy: Recalculate the accuracy of this clock. The clock accuracy
126 * is expressed in ppb (parts per billion). The parent accuracy is
127 * an input parameter.
128 * Returns the calculated accuracy. Optional - if this op is not
129 * set then clock accuracy will be initialized to parent accuracy
130 * or 0 (perfect clock) if clock has no parent.
131 *
132 * @init: Perform platform-specific initialization magic.
133 * This is not not used by any of the basic clock types.
134 * Please consider other ways of solving initialization problems
135 * before using this callback, as its use is discouraged.
136 *
131 * @debug_init: Set up type-specific debugfs entries for this clock. This 137 * @debug_init: Set up type-specific debugfs entries for this clock. This
132 * is called once, after the debugfs directory entry for this 138 * is called once, after the debugfs directory entry for this
133 * clock has been created. The dentry pointer representing that 139 * clock has been created. The dentry pointer representing that
@@ -157,15 +163,15 @@ struct clk_ops {
157 void (*disable_unused)(struct clk_hw *hw); 163 void (*disable_unused)(struct clk_hw *hw);
158 unsigned long (*recalc_rate)(struct clk_hw *hw, 164 unsigned long (*recalc_rate)(struct clk_hw *hw,
159 unsigned long parent_rate); 165 unsigned long parent_rate);
160 long (*round_rate)(struct clk_hw *hw, unsigned long, 166 long (*round_rate)(struct clk_hw *hw, unsigned long rate,
161 unsigned long *); 167 unsigned long *parent_rate);
162 long (*determine_rate)(struct clk_hw *hw, unsigned long rate, 168 long (*determine_rate)(struct clk_hw *hw, unsigned long rate,
163 unsigned long *best_parent_rate, 169 unsigned long *best_parent_rate,
164 struct clk **best_parent_clk); 170 struct clk **best_parent_clk);
165 int (*set_parent)(struct clk_hw *hw, u8 index); 171 int (*set_parent)(struct clk_hw *hw, u8 index);
166 u8 (*get_parent)(struct clk_hw *hw); 172 u8 (*get_parent)(struct clk_hw *hw);
167 int (*set_rate)(struct clk_hw *hw, unsigned long, 173 int (*set_rate)(struct clk_hw *hw, unsigned long rate,
168 unsigned long); 174 unsigned long parent_rate);
169 int (*set_rate_and_parent)(struct clk_hw *hw, 175 int (*set_rate_and_parent)(struct clk_hw *hw,
170 unsigned long rate, 176 unsigned long rate,
171 unsigned long parent_rate, u8 index); 177 unsigned long parent_rate, u8 index);
@@ -254,12 +260,12 @@ void of_fixed_clk_setup(struct device_node *np);
254 * 260 *
255 * Flags: 261 * Flags:
256 * CLK_GATE_SET_TO_DISABLE - by default this clock sets the bit at bit_idx to 262 * CLK_GATE_SET_TO_DISABLE - by default this clock sets the bit at bit_idx to
257 * enable the clock. Setting this flag does the opposite: setting the bit 263 * enable the clock. Setting this flag does the opposite: setting the bit
258 * disable the clock and clearing it enables the clock 264 * disable the clock and clearing it enables the clock
259 * CLK_GATE_HIWORD_MASK - The gate settings are only in lower 16-bit 265 * CLK_GATE_HIWORD_MASK - The gate settings are only in lower 16-bit
260 * of this register, and mask of gate bits are in higher 16-bit of this 266 * of this register, and mask of gate bits are in higher 16-bit of this
261 * register. While setting the gate bits, higher 16-bit should also be 267 * register. While setting the gate bits, higher 16-bit should also be
262 * updated to indicate changing gate bits. 268 * updated to indicate changing gate bits.
263 */ 269 */
264struct clk_gate { 270struct clk_gate {
265 struct clk_hw hw; 271 struct clk_hw hw;
@@ -298,20 +304,24 @@ struct clk_div_table {
298 * 304 *
299 * Flags: 305 * Flags:
300 * CLK_DIVIDER_ONE_BASED - by default the divisor is the value read from the 306 * CLK_DIVIDER_ONE_BASED - by default the divisor is the value read from the
301 * register plus one. If CLK_DIVIDER_ONE_BASED is set then the divider is 307 * register plus one. If CLK_DIVIDER_ONE_BASED is set then the divider is
302 * the raw value read from the register, with the value of zero considered 308 * the raw value read from the register, with the value of zero considered
303 * invalid, unless CLK_DIVIDER_ALLOW_ZERO is set. 309 * invalid, unless CLK_DIVIDER_ALLOW_ZERO is set.
304 * CLK_DIVIDER_POWER_OF_TWO - clock divisor is 2 raised to the value read from 310 * CLK_DIVIDER_POWER_OF_TWO - clock divisor is 2 raised to the value read from
305 * the hardware register 311 * the hardware register
306 * CLK_DIVIDER_ALLOW_ZERO - Allow zero divisors. For dividers which have 312 * CLK_DIVIDER_ALLOW_ZERO - Allow zero divisors. For dividers which have
307 * CLK_DIVIDER_ONE_BASED set, it is possible to end up with a zero divisor. 313 * CLK_DIVIDER_ONE_BASED set, it is possible to end up with a zero divisor.
308 * Some hardware implementations gracefully handle this case and allow a 314 * Some hardware implementations gracefully handle this case and allow a
309 * zero divisor by not modifying their input clock 315 * zero divisor by not modifying their input clock
310 * (divide by one / bypass). 316 * (divide by one / bypass).
311 * CLK_DIVIDER_HIWORD_MASK - The divider settings are only in lower 16-bit 317 * CLK_DIVIDER_HIWORD_MASK - The divider settings are only in lower 16-bit
312 * of this register, and mask of divider bits are in higher 16-bit of this 318 * of this register, and mask of divider bits are in higher 16-bit of this
313 * register. While setting the divider bits, higher 16-bit should also be 319 * register. While setting the divider bits, higher 16-bit should also be
314 * updated to indicate changing divider bits. 320 * updated to indicate changing divider bits.
321 * CLK_DIVIDER_ROUND_CLOSEST - Makes the best calculated divider to be rounded
322 * to the closest integer instead of the up one.
323 * CLK_DIVIDER_READ_ONLY - The divider settings are preconfigured and should
324 * not be changed by the clock framework.
315 */ 325 */
316struct clk_divider { 326struct clk_divider {
317 struct clk_hw hw; 327 struct clk_hw hw;
@@ -327,8 +337,11 @@ struct clk_divider {
327#define CLK_DIVIDER_POWER_OF_TWO BIT(1) 337#define CLK_DIVIDER_POWER_OF_TWO BIT(1)
328#define CLK_DIVIDER_ALLOW_ZERO BIT(2) 338#define CLK_DIVIDER_ALLOW_ZERO BIT(2)
329#define CLK_DIVIDER_HIWORD_MASK BIT(3) 339#define CLK_DIVIDER_HIWORD_MASK BIT(3)
340#define CLK_DIVIDER_ROUND_CLOSEST BIT(4)
341#define CLK_DIVIDER_READ_ONLY BIT(5)
330 342
331extern const struct clk_ops clk_divider_ops; 343extern const struct clk_ops clk_divider_ops;
344extern const struct clk_ops clk_divider_ro_ops;
332struct clk *clk_register_divider(struct device *dev, const char *name, 345struct clk *clk_register_divider(struct device *dev, const char *name,
333 const char *parent_name, unsigned long flags, 346 const char *parent_name, unsigned long flags,
334 void __iomem *reg, u8 shift, u8 width, 347 void __iomem *reg, u8 shift, u8 width,
@@ -356,9 +369,9 @@ struct clk *clk_register_divider_table(struct device *dev, const char *name,
356 * CLK_MUX_INDEX_ONE - register index starts at 1, not 0 369 * CLK_MUX_INDEX_ONE - register index starts at 1, not 0
357 * CLK_MUX_INDEX_BIT - register index is a single bit (power of two) 370 * CLK_MUX_INDEX_BIT - register index is a single bit (power of two)
358 * CLK_MUX_HIWORD_MASK - The mux settings are only in lower 16-bit of this 371 * CLK_MUX_HIWORD_MASK - The mux settings are only in lower 16-bit of this
359 * register, and mask of mux bits are in higher 16-bit of this register. 372 * register, and mask of mux bits are in higher 16-bit of this register.
360 * While setting the mux bits, higher 16-bit should also be updated to 373 * While setting the mux bits, higher 16-bit should also be updated to
361 * indicate changing mux bits. 374 * indicate changing mux bits.
362 */ 375 */
363struct clk_mux { 376struct clk_mux {
364 struct clk_hw hw; 377 struct clk_hw hw;
@@ -413,6 +426,37 @@ struct clk *clk_register_fixed_factor(struct device *dev, const char *name,
413 const char *parent_name, unsigned long flags, 426 const char *parent_name, unsigned long flags,
414 unsigned int mult, unsigned int div); 427 unsigned int mult, unsigned int div);
415 428
429/**
430 * struct clk_fractional_divider - adjustable fractional divider clock
431 *
432 * @hw: handle between common and hardware-specific interfaces
433 * @reg: register containing the divider
434 * @mshift: shift to the numerator bit field
435 * @mwidth: width of the numerator bit field
436 * @nshift: shift to the denominator bit field
437 * @nwidth: width of the denominator bit field
438 * @lock: register lock
439 *
440 * Clock with adjustable fractional divider affecting its output frequency.
441 */
442
443struct clk_fractional_divider {
444 struct clk_hw hw;
445 void __iomem *reg;
446 u8 mshift;
447 u32 mmask;
448 u8 nshift;
449 u32 nmask;
450 u8 flags;
451 spinlock_t *lock;
452};
453
454extern const struct clk_ops clk_fractional_divider_ops;
455struct clk *clk_register_fractional_divider(struct device *dev,
456 const char *name, const char *parent_name, unsigned long flags,
457 void __iomem *reg, u8 mshift, u8 mwidth, u8 nshift, u8 nwidth,
458 u8 clk_divider_flags, spinlock_t *lock);
459
416/*** 460/***
417 * struct clk_composite - aggregate clock of mux, divider and gate clocks 461 * struct clk_composite - aggregate clock of mux, divider and gate clocks
418 * 462 *
@@ -498,10 +542,7 @@ struct clk_onecell_data {
498 542
499extern struct of_device_id __clk_of_table; 543extern struct of_device_id __clk_of_table;
500 544
501#define CLK_OF_DECLARE(name, compat, fn) \ 545#define CLK_OF_DECLARE(name, compat, fn) OF_DECLARE_1(clk, name, compat, fn)
502 static const struct of_device_id __clk_of_table_##name \
503 __used __section(__clk_of_table) \
504 = { .compatible = compat, .data = fn };
505 546
506#ifdef CONFIG_OF 547#ifdef CONFIG_OF
507int of_clk_add_provider(struct device_node *np, 548int of_clk_add_provider(struct device_node *np,
diff --git a/include/linux/clk/at91_pmc.h b/include/linux/clk/at91_pmc.h
index a6911ebbd02a..de4268d4987a 100644
--- a/include/linux/clk/at91_pmc.h
+++ b/include/linux/clk/at91_pmc.h
@@ -155,6 +155,7 @@ extern void __iomem *at91_pmc_base;
155#define AT91_PMC_LOCKB (1 << 2) /* PLLB Lock */ 155#define AT91_PMC_LOCKB (1 << 2) /* PLLB Lock */
156#define AT91_PMC_MCKRDY (1 << 3) /* Master Clock */ 156#define AT91_PMC_MCKRDY (1 << 3) /* Master Clock */
157#define AT91_PMC_LOCKU (1 << 6) /* UPLL Lock [some SAM9] */ 157#define AT91_PMC_LOCKU (1 << 6) /* UPLL Lock [some SAM9] */
158#define AT91_PMC_OSCSEL (1 << 7) /* Slow Oscillator Selection [some SAM9] */
158#define AT91_PMC_PCK0RDY (1 << 8) /* Programmable Clock 0 */ 159#define AT91_PMC_PCK0RDY (1 << 8) /* Programmable Clock 0 */
159#define AT91_PMC_PCK1RDY (1 << 9) /* Programmable Clock 1 */ 160#define AT91_PMC_PCK1RDY (1 << 9) /* Programmable Clock 1 */
160#define AT91_PMC_PCK2RDY (1 << 10) /* Programmable Clock 2 */ 161#define AT91_PMC_PCK2RDY (1 << 10) /* Programmable Clock 2 */
diff --git a/include/linux/clk/shmobile.h b/include/linux/clk/shmobile.h
index f9bf080a1123..9f8a14041dd5 100644
--- a/include/linux/clk/shmobile.h
+++ b/include/linux/clk/shmobile.h
@@ -1,7 +1,9 @@
1/* 1/*
2 * Copyright 2013 Ideas On Board SPRL 2 * Copyright 2013 Ideas On Board SPRL
3 * Copyright 2013, 2014 Horms Solutions Ltd.
3 * 4 *
4 * Contact: Laurent Pinchart <laurent.pinchart@ideasonboard.com> 5 * Contact: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
6 * Contact: Simon Horman <horms@verge.net.au>
5 * 7 *
6 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by 9 * it under the terms of the GNU General Public License as published by
@@ -14,6 +16,7 @@
14 16
15#include <linux/types.h> 17#include <linux/types.h>
16 18
19void r8a7779_clocks_init(u32 mode);
17void rcar_gen2_clocks_init(u32 mode); 20void rcar_gen2_clocks_init(u32 mode);
18 21
19#endif 22#endif
diff --git a/include/linux/clk/sunxi.h b/include/linux/clk/sunxi.h
new file mode 100644
index 000000000000..aed28c4451d9
--- /dev/null
+++ b/include/linux/clk/sunxi.h
@@ -0,0 +1,22 @@
1/*
2 * Copyright 2013 - Hans de Goede <hdegoede@redhat.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 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
15#ifndef __LINUX_CLK_SUNXI_H_
16#define __LINUX_CLK_SUNXI_H_
17
18#include <linux/clk.h>
19
20void clk_sunxi_mmc_phase_control(struct clk *clk, u8 sample, u8 output);
21
22#endif
diff --git a/include/linux/clk/ti.h b/include/linux/clk/ti.h
index 4a21a872dbbd..e8d8a35034a5 100644
--- a/include/linux/clk/ti.h
+++ b/include/linux/clk/ti.h
@@ -41,6 +41,8 @@
41 * @idlest_reg: register containing the DPLL idle status bitfield 41 * @idlest_reg: register containing the DPLL idle status bitfield
42 * @autoidle_mask: mask of the DPLL autoidle mode bitfield in @autoidle_reg 42 * @autoidle_mask: mask of the DPLL autoidle mode bitfield in @autoidle_reg
43 * @freqsel_mask: mask of the DPLL jitter correction bitfield in @control_reg 43 * @freqsel_mask: mask of the DPLL jitter correction bitfield in @control_reg
44 * @dcc_mask: mask of the DPLL DCC correction bitfield @mult_div1_reg
45 * @dcc_rate: rate atleast which DCC @dcc_mask must be set
44 * @idlest_mask: mask of the DPLL idle status bitfield in @idlest_reg 46 * @idlest_mask: mask of the DPLL idle status bitfield in @idlest_reg
45 * @lpmode_mask: mask of the DPLL low-power mode bitfield in @control_reg 47 * @lpmode_mask: mask of the DPLL low-power mode bitfield in @control_reg
46 * @m4xen_mask: mask of the DPLL M4X multiplier bitfield in @control_reg 48 * @m4xen_mask: mask of the DPLL M4X multiplier bitfield in @control_reg
@@ -86,6 +88,8 @@ struct dpll_data {
86 u32 idlest_mask; 88 u32 idlest_mask;
87 u32 dco_mask; 89 u32 dco_mask;
88 u32 sddiv_mask; 90 u32 sddiv_mask;
91 u32 dcc_mask;
92 unsigned long dcc_rate;
89 u32 lpmode_mask; 93 u32 lpmode_mask;
90 u32 m4xen_mask; 94 u32 m4xen_mask;
91 u8 auto_recal_bit; 95 u8 auto_recal_bit;
@@ -94,7 +98,26 @@ struct dpll_data {
94 u8 flags; 98 u8 flags;
95}; 99};
96 100
97struct clk_hw_omap_ops; 101struct clk_hw_omap;
102
103/**
104 * struct clk_hw_omap_ops - OMAP clk ops
105 * @find_idlest: find idlest register information for a clock
106 * @find_companion: find companion clock register information for a clock,
107 * basically converts CM_ICLKEN* <-> CM_FCLKEN*
108 * @allow_idle: enables autoidle hardware functionality for a clock
109 * @deny_idle: prevent autoidle hardware functionality for a clock
110 */
111struct clk_hw_omap_ops {
112 void (*find_idlest)(struct clk_hw_omap *oclk,
113 void __iomem **idlest_reg,
114 u8 *idlest_bit, u8 *idlest_val);
115 void (*find_companion)(struct clk_hw_omap *oclk,
116 void __iomem **other_reg,
117 u8 *other_bit);
118 void (*allow_idle)(struct clk_hw_omap *oclk);
119 void (*deny_idle)(struct clk_hw_omap *oclk);
120};
98 121
99/** 122/**
100 * struct clk_hw_omap - OMAP struct clk 123 * struct clk_hw_omap - OMAP struct clk
@@ -259,6 +282,12 @@ int omap2_dflt_clk_enable(struct clk_hw *hw);
259void omap2_dflt_clk_disable(struct clk_hw *hw); 282void omap2_dflt_clk_disable(struct clk_hw *hw);
260int omap2_dflt_clk_is_enabled(struct clk_hw *hw); 283int omap2_dflt_clk_is_enabled(struct clk_hw *hw);
261void omap3_clk_lock_dpll5(void); 284void omap3_clk_lock_dpll5(void);
285unsigned long omap2_dpllcore_recalc(struct clk_hw *hw,
286 unsigned long parent_rate);
287int omap2_reprogram_dpllcore(struct clk_hw *clk, unsigned long rate,
288 unsigned long parent_rate);
289void omap2xxx_clkt_dpllcore_init(struct clk_hw *hw);
290void omap2xxx_clkt_vps_init(void);
262 291
263void __iomem *ti_clk_get_reg_addr(struct device_node *node, int index); 292void __iomem *ti_clk_get_reg_addr(struct device_node *node, int index);
264void ti_dt_clocks_register(struct ti_dt_clk *oclks); 293void ti_dt_clocks_register(struct ti_dt_clk *oclks);
@@ -278,6 +307,8 @@ int omap5xxx_dt_clk_init(void);
278int dra7xx_dt_clk_init(void); 307int dra7xx_dt_clk_init(void);
279int am33xx_dt_clk_init(void); 308int am33xx_dt_clk_init(void);
280int am43xx_dt_clk_init(void); 309int am43xx_dt_clk_init(void);
310int omap2420_dt_clk_init(void);
311int omap2430_dt_clk_init(void);
281 312
282#ifdef CONFIG_OF 313#ifdef CONFIG_OF
283void of_ti_clk_allow_autoidle_all(void); 314void of_ti_clk_allow_autoidle_all(void);
@@ -287,6 +318,8 @@ static inline void of_ti_clk_allow_autoidle_all(void) { }
287static inline void of_ti_clk_deny_autoidle_all(void) { } 318static inline void of_ti_clk_deny_autoidle_all(void) { }
288#endif 319#endif
289 320
321extern const struct clk_hw_omap_ops clkhwops_omap2xxx_dpll;
322extern const struct clk_hw_omap_ops clkhwops_omap2430_i2chs_wait;
290extern const struct clk_hw_omap_ops clkhwops_omap3_dpll; 323extern const struct clk_hw_omap_ops clkhwops_omap3_dpll;
291extern const struct clk_hw_omap_ops clkhwops_omap4_dpllmx; 324extern const struct clk_hw_omap_ops clkhwops_omap4_dpllmx;
292extern const struct clk_hw_omap_ops clkhwops_wait; 325extern const struct clk_hw_omap_ops clkhwops_wait;
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index 67301a405712..a16b497d5159 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -339,23 +339,13 @@ extern int clocksource_mmio_init(void __iomem *, const char *,
339 339
340extern int clocksource_i8253_init(void); 340extern int clocksource_i8253_init(void);
341 341
342struct device_node; 342#define CLOCKSOURCE_OF_DECLARE(name, compat, fn) \
343typedef void(*clocksource_of_init_fn)(struct device_node *); 343 OF_DECLARE_1(clksrc, name, compat, fn)
344
344#ifdef CONFIG_CLKSRC_OF 345#ifdef CONFIG_CLKSRC_OF
345extern void clocksource_of_init(void); 346extern void clocksource_of_init(void);
346
347#define CLOCKSOURCE_OF_DECLARE(name, compat, fn) \
348 static const struct of_device_id __clksrc_of_table_##name \
349 __used __section(__clksrc_of_table) \
350 = { .compatible = compat, \
351 .data = (fn == (clocksource_of_init_fn)NULL) ? fn : fn }
352#else 347#else
353static inline void clocksource_of_init(void) {} 348static inline void clocksource_of_init(void) {}
354#define CLOCKSOURCE_OF_DECLARE(name, compat, fn) \
355 static const struct of_device_id __clksrc_of_table_##name \
356 __attribute__((unused)) \
357 = { .compatible = compat, \
358 .data = (fn == (clocksource_of_init_fn)NULL) ? fn : fn }
359#endif 349#endif
360 350
361#endif /* _LINUX_CLOCKSOURCE_H */ 351#endif /* _LINUX_CLOCKSOURCE_H */
diff --git a/include/linux/compaction.h b/include/linux/compaction.h
index 7e1c76e3cd68..01e3132820da 100644
--- a/include/linux/compaction.h
+++ b/include/linux/compaction.h
@@ -22,7 +22,7 @@ extern int sysctl_extfrag_handler(struct ctl_table *table, int write,
22extern int fragmentation_index(struct zone *zone, unsigned int order); 22extern int fragmentation_index(struct zone *zone, unsigned int order);
23extern unsigned long try_to_compact_pages(struct zonelist *zonelist, 23extern unsigned long try_to_compact_pages(struct zonelist *zonelist,
24 int order, gfp_t gfp_mask, nodemask_t *mask, 24 int order, gfp_t gfp_mask, nodemask_t *mask,
25 bool sync, bool *contended); 25 enum migrate_mode mode, bool *contended);
26extern void compact_pgdat(pg_data_t *pgdat, int order); 26extern void compact_pgdat(pg_data_t *pgdat, int order);
27extern void reset_isolation_suitable(pg_data_t *pgdat); 27extern void reset_isolation_suitable(pg_data_t *pgdat);
28extern unsigned long compaction_suitable(struct zone *zone, int order); 28extern unsigned long compaction_suitable(struct zone *zone, int order);
@@ -91,7 +91,7 @@ static inline bool compaction_restarting(struct zone *zone, int order)
91#else 91#else
92static inline unsigned long try_to_compact_pages(struct zonelist *zonelist, 92static inline unsigned long try_to_compact_pages(struct zonelist *zonelist,
93 int order, gfp_t gfp_mask, nodemask_t *nodemask, 93 int order, gfp_t gfp_mask, nodemask_t *nodemask,
94 bool sync, bool *contended) 94 enum migrate_mode mode, bool *contended)
95{ 95{
96 return COMPACT_CONTINUE; 96 return COMPACT_CONTINUE;
97} 97}
diff --git a/include/linux/compiler-intel.h b/include/linux/compiler-intel.h
index 5529c5239421..ba147a1727e6 100644
--- a/include/linux/compiler-intel.h
+++ b/include/linux/compiler-intel.h
@@ -13,12 +13,9 @@
13/* Intel ECC compiler doesn't support gcc specific asm stmts. 13/* Intel ECC compiler doesn't support gcc specific asm stmts.
14 * It uses intrinsics to do the equivalent things. 14 * It uses intrinsics to do the equivalent things.
15 */ 15 */
16#undef barrier
17#undef RELOC_HIDE 16#undef RELOC_HIDE
18#undef OPTIMIZER_HIDE_VAR 17#undef OPTIMIZER_HIDE_VAR
19 18
20#define barrier() __memory_barrier()
21
22#define RELOC_HIDE(ptr, off) \ 19#define RELOC_HIDE(ptr, off) \
23 ({ unsigned long __ptr; \ 20 ({ unsigned long __ptr; \
24 __ptr = (unsigned long) (ptr); \ 21 __ptr = (unsigned long) (ptr); \
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index ee7239ea1583..d5ad7b1118fc 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -323,9 +323,18 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect);
323#endif 323#endif
324#ifndef __compiletime_error 324#ifndef __compiletime_error
325# define __compiletime_error(message) 325# define __compiletime_error(message)
326# define __compiletime_error_fallback(condition) \ 326/*
327 * Sparse complains of variable sized arrays due to the temporary variable in
328 * __compiletime_assert. Unfortunately we can't just expand it out to make
329 * sparse see a constant array size without breaking compiletime_assert on old
330 * versions of GCC (e.g. 4.2.4), so hide the array from sparse altogether.
331 */
332# ifndef __CHECKER__
333# define __compiletime_error_fallback(condition) \
327 do { ((void)sizeof(char[1 - 2 * condition])); } while (0) 334 do { ((void)sizeof(char[1 - 2 * condition])); } while (0)
328#else 335# endif
336#endif
337#ifndef __compiletime_error_fallback
329# define __compiletime_error_fallback(condition) do { } while (0) 338# define __compiletime_error_fallback(condition) do { } while (0)
330#endif 339#endif
331 340
@@ -374,7 +383,9 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect);
374/* Ignore/forbid kprobes attach on very low level functions marked by this attribute: */ 383/* Ignore/forbid kprobes attach on very low level functions marked by this attribute: */
375#ifdef CONFIG_KPROBES 384#ifdef CONFIG_KPROBES
376# define __kprobes __attribute__((__section__(".kprobes.text"))) 385# define __kprobes __attribute__((__section__(".kprobes.text")))
386# define nokprobe_inline __always_inline
377#else 387#else
378# define __kprobes 388# define __kprobes
389# define nokprobe_inline inline
379#endif 390#endif
380#endif /* __LINUX_COMPILER_H */ 391#endif /* __LINUX_COMPILER_H */
diff --git a/include/linux/connector.h b/include/linux/connector.h
index be9c4747d511..f8fe8637d771 100644
--- a/include/linux/connector.h
+++ b/include/linux/connector.h
@@ -71,6 +71,7 @@ struct cn_dev {
71int cn_add_callback(struct cb_id *id, const char *name, 71int cn_add_callback(struct cb_id *id, const char *name,
72 void (*callback)(struct cn_msg *, struct netlink_skb_parms *)); 72 void (*callback)(struct cn_msg *, struct netlink_skb_parms *));
73void cn_del_callback(struct cb_id *); 73void cn_del_callback(struct cb_id *);
74int cn_netlink_send_mult(struct cn_msg *msg, u16 len, u32 portid, u32 group, gfp_t gfp_mask);
74int cn_netlink_send(struct cn_msg *msg, u32 portid, u32 group, gfp_t gfp_mask); 75int cn_netlink_send(struct cn_msg *msg, u32 portid, u32 group, gfp_t gfp_mask);
75 76
76int cn_queue_add_callback(struct cn_queue_dev *dev, const char *name, 77int cn_queue_add_callback(struct cn_queue_dev *dev, const char *name,
diff --git a/include/linux/console_struct.h b/include/linux/console_struct.h
index 7f0c32908568..e859c98d1767 100644
--- a/include/linux/console_struct.h
+++ b/include/linux/console_struct.h
@@ -17,6 +17,7 @@
17#include <linux/workqueue.h> 17#include <linux/workqueue.h>
18 18
19struct vt_struct; 19struct vt_struct;
20struct uni_pagedir;
20 21
21#define NPAR 16 22#define NPAR 16
22 23
@@ -104,8 +105,8 @@ struct vc_data {
104 unsigned int vc_bell_pitch; /* Console bell pitch */ 105 unsigned int vc_bell_pitch; /* Console bell pitch */
105 unsigned int vc_bell_duration; /* Console bell duration */ 106 unsigned int vc_bell_duration; /* Console bell duration */
106 struct vc_data **vc_display_fg; /* [!] Ptr to var holding fg console for this display */ 107 struct vc_data **vc_display_fg; /* [!] Ptr to var holding fg console for this display */
107 unsigned long vc_uni_pagedir; 108 struct uni_pagedir *vc_uni_pagedir;
108 unsigned long *vc_uni_pagedir_loc; /* [!] Location of uni_pagedir variable for this console */ 109 struct uni_pagedir **vc_uni_pagedir_loc; /* [!] Location of uni_pagedir variable for this console */
109 bool vc_panic_force_write; /* when oops/panic this VC can accept forced output/blanking */ 110 bool vc_panic_force_write; /* when oops/panic this VC can accept forced output/blanking */
110 /* additional information is in vt_kern.h */ 111 /* additional information is in vt_kern.h */
111}; 112};
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index 81887120395c..95978ad7fcdd 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -256,7 +256,6 @@ enum cpuhp_state {
256}; 256};
257 257
258void cpu_startup_entry(enum cpuhp_state state); 258void cpu_startup_entry(enum cpuhp_state state);
259void cpu_idle(void);
260 259
261void cpu_idle_poll_ctrl(bool enable); 260void cpu_idle_poll_ctrl(bool enable);
262 261
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index 5ae5100c1f24..ec4112d257bc 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -75,6 +75,7 @@ struct cpufreq_policy {
75 unsigned int max; /* in kHz */ 75 unsigned int max; /* in kHz */
76 unsigned int cur; /* in kHz, only needed if cpufreq 76 unsigned int cur; /* in kHz, only needed if cpufreq
77 * governors are used */ 77 * governors are used */
78 unsigned int restore_freq; /* = policy->cur before transition */
78 unsigned int suspend_freq; /* freq to set during suspend */ 79 unsigned int suspend_freq; /* freq to set during suspend */
79 80
80 unsigned int policy; /* see above */ 81 unsigned int policy; /* see above */
@@ -110,6 +111,7 @@ struct cpufreq_policy {
110 bool transition_ongoing; /* Tracks transition status */ 111 bool transition_ongoing; /* Tracks transition status */
111 spinlock_t transition_lock; 112 spinlock_t transition_lock;
112 wait_queue_head_t transition_wait; 113 wait_queue_head_t transition_wait;
114 struct task_struct *transition_task; /* Task which is doing the transition */
113}; 115};
114 116
115/* Only for ACPI */ 117/* Only for ACPI */
@@ -220,11 +222,35 @@ struct cpufreq_driver {
220 222
221 /* define one out of two */ 223 /* define one out of two */
222 int (*setpolicy) (struct cpufreq_policy *policy); 224 int (*setpolicy) (struct cpufreq_policy *policy);
225
226 /*
227 * On failure, should always restore frequency to policy->restore_freq
228 * (i.e. old freq).
229 */
223 int (*target) (struct cpufreq_policy *policy, /* Deprecated */ 230 int (*target) (struct cpufreq_policy *policy, /* Deprecated */
224 unsigned int target_freq, 231 unsigned int target_freq,
225 unsigned int relation); 232 unsigned int relation);
226 int (*target_index) (struct cpufreq_policy *policy, 233 int (*target_index) (struct cpufreq_policy *policy,
227 unsigned int index); 234 unsigned int index);
235 /*
236 * Only for drivers with target_index() and CPUFREQ_ASYNC_NOTIFICATION
237 * unset.
238 *
239 * get_intermediate should return a stable intermediate frequency
240 * platform wants to switch to and target_intermediate() should set CPU
241 * to to that frequency, before jumping to the frequency corresponding
242 * to 'index'. Core will take care of sending notifications and driver
243 * doesn't have to handle them in target_intermediate() or
244 * target_index().
245 *
246 * Drivers can return '0' from get_intermediate() in case they don't
247 * wish to switch to intermediate frequency for some target frequency.
248 * In that case core will directly call ->target_index().
249 */
250 unsigned int (*get_intermediate)(struct cpufreq_policy *policy,
251 unsigned int index);
252 int (*target_intermediate)(struct cpufreq_policy *policy,
253 unsigned int index);
228 254
229 /* should be defined, if possible */ 255 /* should be defined, if possible */
230 unsigned int (*get) (unsigned int cpu); 256 unsigned int (*get) (unsigned int cpu);
@@ -468,6 +494,55 @@ struct cpufreq_frequency_table {
468 * order */ 494 * order */
469}; 495};
470 496
497#if defined(CONFIG_CPU_FREQ) && defined(CONFIG_PM_OPP)
498int dev_pm_opp_init_cpufreq_table(struct device *dev,
499 struct cpufreq_frequency_table **table);
500void dev_pm_opp_free_cpufreq_table(struct device *dev,
501 struct cpufreq_frequency_table **table);
502#else
503static inline int dev_pm_opp_init_cpufreq_table(struct device *dev,
504 struct cpufreq_frequency_table
505 **table)
506{
507 return -EINVAL;
508}
509
510static inline void dev_pm_opp_free_cpufreq_table(struct device *dev,
511 struct cpufreq_frequency_table
512 **table)
513{
514}
515#endif
516
517static inline bool cpufreq_next_valid(struct cpufreq_frequency_table **pos)
518{
519 while ((*pos)->frequency != CPUFREQ_TABLE_END)
520 if ((*pos)->frequency != CPUFREQ_ENTRY_INVALID)
521 return true;
522 else
523 (*pos)++;
524 return false;
525}
526
527/*
528 * cpufreq_for_each_entry - iterate over a cpufreq_frequency_table
529 * @pos: the cpufreq_frequency_table * to use as a loop cursor.
530 * @table: the cpufreq_frequency_table * to iterate over.
531 */
532
533#define cpufreq_for_each_entry(pos, table) \
534 for (pos = table; pos->frequency != CPUFREQ_TABLE_END; pos++)
535
536/*
537 * cpufreq_for_each_valid_entry - iterate over a cpufreq_frequency_table
538 * excluding CPUFREQ_ENTRY_INVALID frequencies.
539 * @pos: the cpufreq_frequency_table * to use as a loop cursor.
540 * @table: the cpufreq_frequency_table * to iterate over.
541 */
542
543#define cpufreq_for_each_valid_entry(pos, table) \
544 for (pos = table; cpufreq_next_valid(&pos); pos++)
545
471int cpufreq_frequency_table_cpuinfo(struct cpufreq_policy *policy, 546int cpufreq_frequency_table_cpuinfo(struct cpufreq_policy *policy,
472 struct cpufreq_frequency_table *table); 547 struct cpufreq_frequency_table *table);
473 548
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
index b0238cba440b..25e0df6155a4 100644
--- a/include/linux/cpuidle.h
+++ b/include/linux/cpuidle.h
@@ -84,6 +84,7 @@ struct cpuidle_device {
84}; 84};
85 85
86DECLARE_PER_CPU(struct cpuidle_device *, cpuidle_devices); 86DECLARE_PER_CPU(struct cpuidle_device *, cpuidle_devices);
87DECLARE_PER_CPU(struct cpuidle_device, cpuidle_dev);
87 88
88/** 89/**
89 * cpuidle_get_last_residency - retrieves the last state's residency time 90 * cpuidle_get_last_residency - retrieves the last state's residency time
@@ -120,8 +121,6 @@ struct cpuidle_driver {
120#ifdef CONFIG_CPU_IDLE 121#ifdef CONFIG_CPU_IDLE
121extern void disable_cpuidle(void); 122extern void disable_cpuidle(void);
122 123
123extern int cpuidle_enabled(struct cpuidle_driver *drv,
124 struct cpuidle_device *dev);
125extern int cpuidle_select(struct cpuidle_driver *drv, 124extern int cpuidle_select(struct cpuidle_driver *drv,
126 struct cpuidle_device *dev); 125 struct cpuidle_device *dev);
127extern int cpuidle_enter(struct cpuidle_driver *drv, 126extern int cpuidle_enter(struct cpuidle_driver *drv,
@@ -145,13 +144,11 @@ extern void cpuidle_resume(void);
145extern int cpuidle_enable_device(struct cpuidle_device *dev); 144extern int cpuidle_enable_device(struct cpuidle_device *dev);
146extern void cpuidle_disable_device(struct cpuidle_device *dev); 145extern void cpuidle_disable_device(struct cpuidle_device *dev);
147extern int cpuidle_play_dead(void); 146extern int cpuidle_play_dead(void);
147extern void cpuidle_use_deepest_state(bool enable);
148 148
149extern struct cpuidle_driver *cpuidle_get_cpu_driver(struct cpuidle_device *dev); 149extern struct cpuidle_driver *cpuidle_get_cpu_driver(struct cpuidle_device *dev);
150#else 150#else
151static inline void disable_cpuidle(void) { } 151static inline void disable_cpuidle(void) { }
152static inline int cpuidle_enabled(struct cpuidle_driver *drv,
153 struct cpuidle_device *dev)
154{return -ENODEV; }
155static inline int cpuidle_select(struct cpuidle_driver *drv, 152static inline int cpuidle_select(struct cpuidle_driver *drv,
156 struct cpuidle_device *dev) 153 struct cpuidle_device *dev)
157{return -ENODEV; } 154{return -ENODEV; }
@@ -180,6 +177,7 @@ static inline int cpuidle_enable_device(struct cpuidle_device *dev)
180{return -ENODEV; } 177{return -ENODEV; }
181static inline void cpuidle_disable_device(struct cpuidle_device *dev) { } 178static inline void cpuidle_disable_device(struct cpuidle_device *dev) { }
182static inline int cpuidle_play_dead(void) {return -ENODEV; } 179static inline int cpuidle_play_dead(void) {return -ENODEV; }
180static inline void cpuidle_use_deepest_state(bool enable) {}
183static inline struct cpuidle_driver *cpuidle_get_cpu_driver( 181static inline struct cpuidle_driver *cpuidle_get_cpu_driver(
184 struct cpuidle_device *dev) {return NULL; } 182 struct cpuidle_device *dev) {return NULL; }
185#endif 183#endif
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
index d08e4d2a9b92..2997af6d2ccd 100644
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@ -142,6 +142,13 @@ static inline unsigned int cpumask_any_but(const struct cpumask *mask,
142 return 1; 142 return 1;
143} 143}
144 144
145static inline int cpumask_set_cpu_local_first(int i, int numa_node, cpumask_t *dstp)
146{
147 set_bit(0, cpumask_bits(dstp));
148
149 return 0;
150}
151
145#define for_each_cpu(cpu, mask) \ 152#define for_each_cpu(cpu, mask) \
146 for ((cpu) = 0; (cpu) < 1; (cpu)++, (void)mask) 153 for ((cpu) = 0; (cpu) < 1; (cpu)++, (void)mask)
147#define for_each_cpu_not(cpu, mask) \ 154#define for_each_cpu_not(cpu, mask) \
@@ -192,6 +199,7 @@ static inline unsigned int cpumask_next_zero(int n, const struct cpumask *srcp)
192 199
193int cpumask_next_and(int n, const struct cpumask *, const struct cpumask *); 200int cpumask_next_and(int n, const struct cpumask *, const struct cpumask *);
194int cpumask_any_but(const struct cpumask *mask, unsigned int cpu); 201int cpumask_any_but(const struct cpumask *mask, unsigned int cpu);
202int cpumask_set_cpu_local_first(int i, int numa_node, cpumask_t *dstp);
195 203
196/** 204/**
197 * for_each_cpu - iterate over every cpu in a mask 205 * for_each_cpu - iterate over every cpu in a mask
@@ -600,7 +608,7 @@ static inline int cpulist_scnprintf(char *buf, int len,
600static inline int cpumask_parse(const char *buf, struct cpumask *dstp) 608static inline int cpumask_parse(const char *buf, struct cpumask *dstp)
601{ 609{
602 char *nl = strchr(buf, '\n'); 610 char *nl = strchr(buf, '\n');
603 int len = nl ? nl - buf : strlen(buf); 611 unsigned int len = nl ? (unsigned int)(nl - buf) : strlen(buf);
604 612
605 return bitmap_parse(buf, len, cpumask_bits(dstp), nr_cpumask_bits); 613 return bitmap_parse(buf, len, cpumask_bits(dstp), nr_cpumask_bits);
606} 614}
diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h
index b19d3dc2e651..ade2390ffe92 100644
--- a/include/linux/cpuset.h
+++ b/include/linux/cpuset.h
@@ -12,10 +12,31 @@
12#include <linux/cpumask.h> 12#include <linux/cpumask.h>
13#include <linux/nodemask.h> 13#include <linux/nodemask.h>
14#include <linux/mm.h> 14#include <linux/mm.h>
15#include <linux/jump_label.h>
15 16
16#ifdef CONFIG_CPUSETS 17#ifdef CONFIG_CPUSETS
17 18
18extern int number_of_cpusets; /* How many cpusets are defined in system? */ 19extern struct static_key cpusets_enabled_key;
20static inline bool cpusets_enabled(void)
21{
22 return static_key_false(&cpusets_enabled_key);
23}
24
25static inline int nr_cpusets(void)
26{
27 /* jump label reference count + the top-level cpuset */
28 return static_key_count(&cpusets_enabled_key) + 1;
29}
30
31static inline void cpuset_inc(void)
32{
33 static_key_slow_inc(&cpusets_enabled_key);
34}
35
36static inline void cpuset_dec(void)
37{
38 static_key_slow_dec(&cpusets_enabled_key);
39}
19 40
20extern int cpuset_init(void); 41extern int cpuset_init(void);
21extern void cpuset_init_smp(void); 42extern void cpuset_init_smp(void);
@@ -32,13 +53,13 @@ extern int __cpuset_node_allowed_hardwall(int node, gfp_t gfp_mask);
32 53
33static inline int cpuset_node_allowed_softwall(int node, gfp_t gfp_mask) 54static inline int cpuset_node_allowed_softwall(int node, gfp_t gfp_mask)
34{ 55{
35 return number_of_cpusets <= 1 || 56 return nr_cpusets() <= 1 ||
36 __cpuset_node_allowed_softwall(node, gfp_mask); 57 __cpuset_node_allowed_softwall(node, gfp_mask);
37} 58}
38 59
39static inline int cpuset_node_allowed_hardwall(int node, gfp_t gfp_mask) 60static inline int cpuset_node_allowed_hardwall(int node, gfp_t gfp_mask)
40{ 61{
41 return number_of_cpusets <= 1 || 62 return nr_cpusets() <= 1 ||
42 __cpuset_node_allowed_hardwall(node, gfp_mask); 63 __cpuset_node_allowed_hardwall(node, gfp_mask);
43} 64}
44 65
@@ -124,6 +145,8 @@ static inline void set_mems_allowed(nodemask_t nodemask)
124 145
125#else /* !CONFIG_CPUSETS */ 146#else /* !CONFIG_CPUSETS */
126 147
148static inline bool cpusets_enabled(void) { return false; }
149
127static inline int cpuset_init(void) { return 0; } 150static inline int cpuset_init(void) { return 0; }
128static inline void cpuset_init_smp(void) {} 151static inline void cpuset_init_smp(void) {}
129 152
diff --git a/include/linux/crc7.h b/include/linux/crc7.h
index 1786e772d5c6..d590765106f3 100644
--- a/include/linux/crc7.h
+++ b/include/linux/crc7.h
@@ -2,13 +2,13 @@
2#define _LINUX_CRC7_H 2#define _LINUX_CRC7_H
3#include <linux/types.h> 3#include <linux/types.h>
4 4
5extern const u8 crc7_syndrome_table[256]; 5extern const u8 crc7_be_syndrome_table[256];
6 6
7static inline u8 crc7_byte(u8 crc, u8 data) 7static inline u8 crc7_be_byte(u8 crc, u8 data)
8{ 8{
9 return crc7_syndrome_table[(crc << 1) ^ data]; 9 return crc7_be_syndrome_table[crc ^ data];
10} 10}
11 11
12extern u8 crc7(u8 crc, const u8 *buffer, size_t len); 12extern u8 crc7_be(u8 crc, const u8 *buffer, size_t len);
13 13
14#endif 14#endif
diff --git a/include/linux/dell-led.h b/include/linux/dell-led.h
new file mode 100644
index 000000000000..7009b8bec77b
--- /dev/null
+++ b/include/linux/dell-led.h
@@ -0,0 +1,10 @@
1#ifndef __DELL_LED_H__
2#define __DELL_LED_H__
3
4enum {
5 DELL_LED_MICMUTE,
6};
7
8int dell_app_wmi_led_set(int whichled, int on);
9
10#endif
diff --git a/include/linux/devfreq.h b/include/linux/devfreq.h
index d48dc00232a4..f1863dcd83ea 100644
--- a/include/linux/devfreq.h
+++ b/include/linux/devfreq.h
@@ -181,6 +181,12 @@ extern struct devfreq *devfreq_add_device(struct device *dev,
181 const char *governor_name, 181 const char *governor_name,
182 void *data); 182 void *data);
183extern int devfreq_remove_device(struct devfreq *devfreq); 183extern int devfreq_remove_device(struct devfreq *devfreq);
184extern struct devfreq *devm_devfreq_add_device(struct device *dev,
185 struct devfreq_dev_profile *profile,
186 const char *governor_name,
187 void *data);
188extern void devm_devfreq_remove_device(struct device *dev,
189 struct devfreq *devfreq);
184 190
185/* Supposed to be called by PM_SLEEP/PM_RUNTIME callbacks */ 191/* Supposed to be called by PM_SLEEP/PM_RUNTIME callbacks */
186extern int devfreq_suspend_device(struct devfreq *devfreq); 192extern int devfreq_suspend_device(struct devfreq *devfreq);
@@ -193,6 +199,10 @@ extern int devfreq_register_opp_notifier(struct device *dev,
193 struct devfreq *devfreq); 199 struct devfreq *devfreq);
194extern int devfreq_unregister_opp_notifier(struct device *dev, 200extern int devfreq_unregister_opp_notifier(struct device *dev,
195 struct devfreq *devfreq); 201 struct devfreq *devfreq);
202extern int devm_devfreq_register_opp_notifier(struct device *dev,
203 struct devfreq *devfreq);
204extern void devm_devfreq_unregister_opp_notifier(struct device *dev,
205 struct devfreq *devfreq);
196 206
197#if IS_ENABLED(CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND) 207#if IS_ENABLED(CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND)
198/** 208/**
@@ -220,7 +230,7 @@ static inline struct devfreq *devfreq_add_device(struct device *dev,
220 const char *governor_name, 230 const char *governor_name,
221 void *data) 231 void *data)
222{ 232{
223 return NULL; 233 return ERR_PTR(-ENOSYS);
224} 234}
225 235
226static inline int devfreq_remove_device(struct devfreq *devfreq) 236static inline int devfreq_remove_device(struct devfreq *devfreq)
@@ -228,6 +238,19 @@ static inline int devfreq_remove_device(struct devfreq *devfreq)
228 return 0; 238 return 0;
229} 239}
230 240
241static inline struct devfreq *devm_devfreq_add_device(struct device *dev,
242 struct devfreq_dev_profile *profile,
243 const char *governor_name,
244 void *data)
245{
246 return ERR_PTR(-ENOSYS);
247}
248
249static inline void devm_devfreq_remove_device(struct device *dev,
250 struct devfreq *devfreq)
251{
252}
253
231static inline int devfreq_suspend_device(struct devfreq *devfreq) 254static inline int devfreq_suspend_device(struct devfreq *devfreq)
232{ 255{
233 return 0; 256 return 0;
@@ -256,6 +279,16 @@ static inline int devfreq_unregister_opp_notifier(struct device *dev,
256 return -EINVAL; 279 return -EINVAL;
257} 280}
258 281
282static inline int devm_devfreq_register_opp_notifier(struct device *dev,
283 struct devfreq *devfreq)
284{
285 return -EINVAL;
286}
287
288static inline void devm_devfreq_unregister_opp_notifier(struct device *dev,
289 struct devfreq *devfreq)
290{
291}
259#endif /* CONFIG_PM_DEVFREQ */ 292#endif /* CONFIG_PM_DEVFREQ */
260 293
261#endif /* __LINUX_DEVFREQ_H__ */ 294#endif /* __LINUX_DEVFREQ_H__ */
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h
index 63da56ed9796..e1707de043ae 100644
--- a/include/linux/device-mapper.h
+++ b/include/linux/device-mapper.h
@@ -115,12 +115,6 @@ typedef int (*dm_busy_fn) (struct dm_target *ti);
115 115
116void dm_error(const char *message); 116void dm_error(const char *message);
117 117
118/*
119 * Combine device limits.
120 */
121int dm_set_device_limits(struct dm_target *ti, struct dm_dev *dev,
122 sector_t start, sector_t len, void *data);
123
124struct dm_dev { 118struct dm_dev {
125 struct block_device *bdev; 119 struct block_device *bdev;
126 fmode_t mode; 120 fmode_t mode;
@@ -132,7 +126,7 @@ struct dm_dev {
132 * are opened/closed correctly. 126 * are opened/closed correctly.
133 */ 127 */
134int dm_get_device(struct dm_target *ti, const char *path, fmode_t mode, 128int dm_get_device(struct dm_target *ti, const char *path, fmode_t mode,
135 struct dm_dev **result); 129 struct dm_dev **result);
136void dm_put_device(struct dm_target *ti, struct dm_dev *d); 130void dm_put_device(struct dm_target *ti, struct dm_dev *d);
137 131
138/* 132/*
@@ -291,6 +285,7 @@ struct dm_target_io {
291 struct dm_io *io; 285 struct dm_io *io;
292 struct dm_target *ti; 286 struct dm_target *ti;
293 unsigned target_bio_nr; 287 unsigned target_bio_nr;
288 unsigned *len_ptr;
294 struct bio clone; 289 struct bio clone;
295}; 290};
296 291
@@ -401,6 +396,7 @@ int dm_copy_name_and_uuid(struct mapped_device *md, char *name, char *uuid);
401struct gendisk *dm_disk(struct mapped_device *md); 396struct gendisk *dm_disk(struct mapped_device *md);
402int dm_suspended(struct dm_target *ti); 397int dm_suspended(struct dm_target *ti);
403int dm_noflush_suspending(struct dm_target *ti); 398int dm_noflush_suspending(struct dm_target *ti);
399void dm_accept_partial_bio(struct bio *bio, unsigned n_sectors);
404union map_info *dm_get_rq_mapinfo(struct request *rq); 400union map_info *dm_get_rq_mapinfo(struct request *rq);
405 401
406struct queue_limits *dm_get_queue_limits(struct mapped_device *md); 402struct queue_limits *dm_get_queue_limits(struct mapped_device *md);
diff --git a/include/linux/device.h b/include/linux/device.h
index d1d1c055b48e..af424acd393d 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -623,6 +623,12 @@ static inline void *devm_kcalloc(struct device *dev,
623} 623}
624extern void devm_kfree(struct device *dev, void *p); 624extern void devm_kfree(struct device *dev, void *p);
625extern char *devm_kstrdup(struct device *dev, const char *s, gfp_t gfp); 625extern char *devm_kstrdup(struct device *dev, const char *s, gfp_t gfp);
626extern void *devm_kmemdup(struct device *dev, const void *src, size_t len,
627 gfp_t gfp);
628
629extern unsigned long devm_get_free_pages(struct device *dev,
630 gfp_t gfp_mask, unsigned int order);
631extern void devm_free_pages(struct device *dev, unsigned long addr);
626 632
627void __iomem *devm_ioremap_resource(struct device *dev, struct resource *res); 633void __iomem *devm_ioremap_resource(struct device *dev, struct resource *res);
628void __iomem *devm_request_and_ioremap(struct device *dev, 634void __iomem *devm_request_and_ioremap(struct device *dev,
@@ -673,6 +679,7 @@ struct acpi_dev_node {
673 * variants, which GPIO pins act in what additional roles, and so 679 * variants, which GPIO pins act in what additional roles, and so
674 * on. This shrinks the "Board Support Packages" (BSPs) and 680 * on. This shrinks the "Board Support Packages" (BSPs) and
675 * minimizes board-specific #ifdefs in drivers. 681 * minimizes board-specific #ifdefs in drivers.
682 * @driver_data: Private pointer for driver specific info.
676 * @power: For device power management. 683 * @power: For device power management.
677 * See Documentation/power/devices.txt for details. 684 * See Documentation/power/devices.txt for details.
678 * @pm_domain: Provide callbacks that are executed during system suspend, 685 * @pm_domain: Provide callbacks that are executed during system suspend,
@@ -685,6 +692,7 @@ struct acpi_dev_node {
685 * @coherent_dma_mask: Like dma_mask, but for alloc_coherent mapping as not all 692 * @coherent_dma_mask: Like dma_mask, but for alloc_coherent mapping as not all
686 * hardware supports 64-bit addresses for consistent allocations 693 * hardware supports 64-bit addresses for consistent allocations
687 * such descriptors. 694 * such descriptors.
695 * @dma_pfn_offset: offset of DMA memory range relatively of RAM
688 * @dma_parms: A low level driver may set these to teach IOMMU code about 696 * @dma_parms: A low level driver may set these to teach IOMMU code about
689 * segment limitations. 697 * segment limitations.
690 * @dma_pools: Dma pools (if dma'ble device). 698 * @dma_pools: Dma pools (if dma'ble device).
@@ -734,6 +742,8 @@ struct device {
734 device */ 742 device */
735 void *platform_data; /* Platform specific data, device 743 void *platform_data; /* Platform specific data, device
736 core doesn't touch it */ 744 core doesn't touch it */
745 void *driver_data; /* Driver data, set and get with
746 dev_set/get_drvdata */
737 struct dev_pm_info power; 747 struct dev_pm_info power;
738 struct dev_pm_domain *pm_domain; 748 struct dev_pm_domain *pm_domain;
739 749
@@ -750,6 +760,7 @@ struct device {
750 not all hardware supports 760 not all hardware supports
751 64 bit addresses for consistent 761 64 bit addresses for consistent
752 allocations such descriptors. */ 762 allocations such descriptors. */
763 unsigned long dma_pfn_offset;
753 764
754 struct device_dma_parameters *dma_parms; 765 struct device_dma_parameters *dma_parms;
755 766
@@ -823,6 +834,16 @@ static inline void set_dev_node(struct device *dev, int node)
823} 834}
824#endif 835#endif
825 836
837static inline void *dev_get_drvdata(const struct device *dev)
838{
839 return dev->driver_data;
840}
841
842static inline void dev_set_drvdata(struct device *dev, void *data)
843{
844 dev->driver_data = data;
845}
846
826static inline struct pm_subsys_data *dev_to_psd(struct device *dev) 847static inline struct pm_subsys_data *dev_to_psd(struct device *dev)
827{ 848{
828 return dev ? dev->power.subsys_data : NULL; 849 return dev ? dev->power.subsys_data : NULL;
@@ -907,8 +928,6 @@ extern int device_move(struct device *dev, struct device *new_parent,
907extern const char *device_get_devnode(struct device *dev, 928extern const char *device_get_devnode(struct device *dev,
908 umode_t *mode, kuid_t *uid, kgid_t *gid, 929 umode_t *mode, kuid_t *uid, kgid_t *gid,
909 const char **tmp); 930 const char **tmp);
910extern void *dev_get_drvdata(const struct device *dev);
911extern int dev_set_drvdata(struct device *dev, void *data);
912 931
913static inline bool device_supports_offline(struct device *dev) 932static inline bool device_supports_offline(struct device *dev)
914{ 933{
diff --git a/include/linux/dma-contiguous.h b/include/linux/dma-contiguous.h
index 3b28f937d959..772eab5d524a 100644
--- a/include/linux/dma-contiguous.h
+++ b/include/linux/dma-contiguous.h
@@ -88,7 +88,8 @@ static inline void dma_contiguous_set_default(struct cma *cma)
88void dma_contiguous_reserve(phys_addr_t addr_limit); 88void dma_contiguous_reserve(phys_addr_t addr_limit);
89 89
90int __init dma_contiguous_reserve_area(phys_addr_t size, phys_addr_t base, 90int __init dma_contiguous_reserve_area(phys_addr_t size, phys_addr_t base,
91 phys_addr_t limit, struct cma **res_cma); 91 phys_addr_t limit, struct cma **res_cma,
92 bool fixed);
92 93
93/** 94/**
94 * dma_declare_contiguous() - reserve area for contiguous memory handling 95 * dma_declare_contiguous() - reserve area for contiguous memory handling
@@ -108,7 +109,7 @@ static inline int dma_declare_contiguous(struct device *dev, phys_addr_t size,
108{ 109{
109 struct cma *cma; 110 struct cma *cma;
110 int ret; 111 int ret;
111 ret = dma_contiguous_reserve_area(size, base, limit, &cma); 112 ret = dma_contiguous_reserve_area(size, base, limit, &cma, true);
112 if (ret == 0) 113 if (ret == 0)
113 dev_set_cma_area(dev, cma); 114 dev_set_cma_area(dev, cma);
114 115
@@ -136,7 +137,9 @@ static inline void dma_contiguous_set_default(struct cma *cma) { }
136static inline void dma_contiguous_reserve(phys_addr_t limit) { } 137static inline void dma_contiguous_reserve(phys_addr_t limit) { }
137 138
138static inline int dma_contiguous_reserve_area(phys_addr_t size, phys_addr_t base, 139static inline int dma_contiguous_reserve_area(phys_addr_t size, phys_addr_t base,
139 phys_addr_t limit, struct cma **res_cma) { 140 phys_addr_t limit, struct cma **res_cma,
141 bool fixed)
142{
140 return -ENOSYS; 143 return -ENOSYS;
141} 144}
142 145
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index fd4aee29ad10..931b70986272 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -8,6 +8,12 @@
8#include <linux/dma-direction.h> 8#include <linux/dma-direction.h>
9#include <linux/scatterlist.h> 9#include <linux/scatterlist.h>
10 10
11/*
12 * A dma_addr_t can hold any valid DMA or bus address for the platform.
13 * It can be given to a device to use as a DMA source or target. A CPU cannot
14 * reference a dma_addr_t directly because there may be translation between
15 * its physical address space and the bus address space.
16 */
11struct dma_map_ops { 17struct dma_map_ops {
12 void* (*alloc)(struct device *dev, size_t size, 18 void* (*alloc)(struct device *dev, size_t size,
13 dma_addr_t *dma_handle, gfp_t gfp, 19 dma_addr_t *dma_handle, gfp_t gfp,
@@ -123,6 +129,13 @@ static inline int dma_coerce_mask_and_coherent(struct device *dev, u64 mask)
123 129
124extern u64 dma_get_required_mask(struct device *dev); 130extern u64 dma_get_required_mask(struct device *dev);
125 131
132#ifndef set_arch_dma_coherent_ops
133static inline int set_arch_dma_coherent_ops(struct device *dev)
134{
135 return 0;
136}
137#endif
138
126static inline unsigned int dma_get_max_seg_size(struct device *dev) 139static inline unsigned int dma_get_max_seg_size(struct device *dev)
127{ 140{
128 return dev->dma_parms ? dev->dma_parms->max_segment_size : 65536; 141 return dev->dma_parms ? dev->dma_parms->max_segment_size : 65536;
@@ -186,7 +199,7 @@ static inline int dma_get_cache_alignment(void)
186 199
187#ifndef ARCH_HAS_DMA_DECLARE_COHERENT_MEMORY 200#ifndef ARCH_HAS_DMA_DECLARE_COHERENT_MEMORY
188static inline int 201static inline int
189dma_declare_coherent_memory(struct device *dev, dma_addr_t bus_addr, 202dma_declare_coherent_memory(struct device *dev, phys_addr_t phys_addr,
190 dma_addr_t device_addr, size_t size, int flags) 203 dma_addr_t device_addr, size_t size, int flags)
191{ 204{
192 return 0; 205 return 0;
@@ -217,13 +230,14 @@ extern void *dmam_alloc_noncoherent(struct device *dev, size_t size,
217extern void dmam_free_noncoherent(struct device *dev, size_t size, void *vaddr, 230extern void dmam_free_noncoherent(struct device *dev, size_t size, void *vaddr,
218 dma_addr_t dma_handle); 231 dma_addr_t dma_handle);
219#ifdef ARCH_HAS_DMA_DECLARE_COHERENT_MEMORY 232#ifdef ARCH_HAS_DMA_DECLARE_COHERENT_MEMORY
220extern int dmam_declare_coherent_memory(struct device *dev, dma_addr_t bus_addr, 233extern int dmam_declare_coherent_memory(struct device *dev,
234 phys_addr_t phys_addr,
221 dma_addr_t device_addr, size_t size, 235 dma_addr_t device_addr, size_t size,
222 int flags); 236 int flags);
223extern void dmam_release_declared_memory(struct device *dev); 237extern void dmam_release_declared_memory(struct device *dev);
224#else /* ARCH_HAS_DMA_DECLARE_COHERENT_MEMORY */ 238#else /* ARCH_HAS_DMA_DECLARE_COHERENT_MEMORY */
225static inline int dmam_declare_coherent_memory(struct device *dev, 239static inline int dmam_declare_coherent_memory(struct device *dev,
226 dma_addr_t bus_addr, dma_addr_t device_addr, 240 phys_addr_t phys_addr, dma_addr_t device_addr,
227 size_t size, gfp_t gfp) 241 size_t size, gfp_t gfp)
228{ 242{
229 return 0; 243 return 0;
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index 8300fb87b84a..d2c5cc7c583c 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -292,7 +292,7 @@ struct dma_chan_dev {
292}; 292};
293 293
294/** 294/**
295 * enum dma_slave_buswidth - defines bus with of the DMA slave 295 * enum dma_slave_buswidth - defines bus width of the DMA slave
296 * device, source or target buses 296 * device, source or target buses
297 */ 297 */
298enum dma_slave_buswidth { 298enum dma_slave_buswidth {
@@ -429,6 +429,7 @@ typedef bool (*dma_filter_fn)(struct dma_chan *chan, void *filter_param);
429typedef void (*dma_async_tx_callback)(void *dma_async_param); 429typedef void (*dma_async_tx_callback)(void *dma_async_param);
430 430
431struct dmaengine_unmap_data { 431struct dmaengine_unmap_data {
432 u8 map_cnt;
432 u8 to_cnt; 433 u8 to_cnt;
433 u8 from_cnt; 434 u8 from_cnt;
434 u8 bidi_cnt; 435 u8 bidi_cnt;
diff --git a/include/linux/efi.h b/include/linux/efi.h
index 6c100ff0cae4..41bbf8ba4ba8 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -575,6 +575,9 @@ typedef efi_status_t efi_query_variable_store_t(u32 attributes, unsigned long si
575#define EFI_FILE_SYSTEM_GUID \ 575#define EFI_FILE_SYSTEM_GUID \
576 EFI_GUID( 0x964e5b22, 0x6459, 0x11d2, 0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b ) 576 EFI_GUID( 0x964e5b22, 0x6459, 0x11d2, 0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b )
577 577
578#define DEVICE_TREE_GUID \
579 EFI_GUID( 0xb1b621d5, 0xf19c, 0x41a5, 0x83, 0x0b, 0xd9, 0x15, 0x2c, 0x69, 0xaa, 0xe0 )
580
578typedef struct { 581typedef struct {
579 efi_guid_t guid; 582 efi_guid_t guid;
580 u64 table; 583 u64 table;
@@ -664,6 +667,14 @@ struct efi_memory_map {
664 unsigned long desc_size; 667 unsigned long desc_size;
665}; 668};
666 669
670struct efi_fdt_params {
671 u64 system_table;
672 u64 mmap;
673 u32 mmap_size;
674 u32 desc_size;
675 u32 desc_ver;
676};
677
667typedef struct { 678typedef struct {
668 u32 revision; 679 u32 revision;
669 u32 parent_handle; 680 u32 parent_handle;
@@ -861,8 +872,15 @@ extern void efi_initialize_iomem_resources(struct resource *code_resource,
861extern void efi_get_time(struct timespec *now); 872extern void efi_get_time(struct timespec *now);
862extern int efi_set_rtc_mmss(const struct timespec *now); 873extern int efi_set_rtc_mmss(const struct timespec *now);
863extern void efi_reserve_boot_services(void); 874extern void efi_reserve_boot_services(void);
875extern int efi_get_fdt_params(struct efi_fdt_params *params, int verbose);
864extern struct efi_memory_map memmap; 876extern struct efi_memory_map memmap;
865 877
878/* Iterate through an efi_memory_map */
879#define for_each_efi_memory_desc(m, md) \
880 for ((md) = (m)->map; \
881 (md) <= (efi_memory_desc_t *)((m)->map_end - (m)->desc_size); \
882 (md) = (void *)(md) + (m)->desc_size)
883
866/** 884/**
867 * efi_range_is_wc - check the WC bit on an address range 885 * efi_range_is_wc - check the WC bit on an address range
868 * @start: starting kvirt address 886 * @start: starting kvirt address
@@ -1033,8 +1051,10 @@ struct efivars {
1033 * and we use a page for reading/writing. 1051 * and we use a page for reading/writing.
1034 */ 1052 */
1035 1053
1054#define EFI_VAR_NAME_LEN 1024
1055
1036struct efi_variable { 1056struct efi_variable {
1037 efi_char16_t VariableName[1024/sizeof(efi_char16_t)]; 1057 efi_char16_t VariableName[EFI_VAR_NAME_LEN/sizeof(efi_char16_t)];
1038 efi_guid_t VendorGuid; 1058 efi_guid_t VendorGuid;
1039 unsigned long DataSize; 1059 unsigned long DataSize;
1040 __u8 Data[1024]; 1060 __u8 Data[1024];
@@ -1116,7 +1136,7 @@ int efivar_entry_iter(int (*func)(struct efivar_entry *, void *),
1116struct efivar_entry *efivar_entry_find(efi_char16_t *name, efi_guid_t guid, 1136struct efivar_entry *efivar_entry_find(efi_char16_t *name, efi_guid_t guid,
1117 struct list_head *head, bool remove); 1137 struct list_head *head, bool remove);
1118 1138
1119bool efivar_validate(struct efi_variable *var, u8 *data, unsigned long len); 1139bool efivar_validate(efi_char16_t *var_name, u8 *data, unsigned long len);
1120 1140
1121extern struct work_struct efivar_work; 1141extern struct work_struct efivar_work;
1122void efivar_run_worker(void); 1142void efivar_run_worker(void);
diff --git a/include/linux/elevator.h b/include/linux/elevator.h
index df63bd3a8cf1..45a91474487d 100644
--- a/include/linux/elevator.h
+++ b/include/linux/elevator.h
@@ -133,7 +133,6 @@ extern struct request *elv_latter_request(struct request_queue *, struct request
133extern int elv_register_queue(struct request_queue *q); 133extern int elv_register_queue(struct request_queue *q);
134extern void elv_unregister_queue(struct request_queue *q); 134extern void elv_unregister_queue(struct request_queue *q);
135extern int elv_may_queue(struct request_queue *, int); 135extern int elv_may_queue(struct request_queue *, int);
136extern void elv_abort_queue(struct request_queue *);
137extern void elv_completed_request(struct request_queue *, struct request *); 136extern void elv_completed_request(struct request_queue *, struct request *);
138extern int elv_set_request(struct request_queue *q, struct request *rq, 137extern int elv_set_request(struct request_queue *q, struct request *rq,
139 struct bio *bio, gfp_t gfp_mask); 138 struct bio *bio, gfp_t gfp_mask);
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index 0a114d05f68d..e658229fee39 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -154,13 +154,20 @@ static inline u32 ethtool_rxfh_indir_default(u32 index, u32 n_rx_rings)
154 * @reset: Reset (part of) the device, as specified by a bitmask of 154 * @reset: Reset (part of) the device, as specified by a bitmask of
155 * flags from &enum ethtool_reset_flags. Returns a negative 155 * flags from &enum ethtool_reset_flags. Returns a negative
156 * error code or zero. 156 * error code or zero.
157 * @get_rxfh_key_size: Get the size of the RX flow hash key.
158 * Returns zero if not supported for this specific device.
157 * @get_rxfh_indir_size: Get the size of the RX flow hash indirection table. 159 * @get_rxfh_indir_size: Get the size of the RX flow hash indirection table.
158 * Returns zero if not supported for this specific device. 160 * Returns zero if not supported for this specific device.
159 * @get_rxfh_indir: Get the contents of the RX flow hash indirection table. 161 * @get_rxfh: Get the contents of the RX flow hash indirection table and hash
160 * Will not be called if @get_rxfh_indir_size returns zero. 162 * key.
163 * Will only be called if one or both of @get_rxfh_indir_size and
164 * @get_rxfh_key_size are implemented and return non-zero.
161 * Returns a negative error code or zero. 165 * Returns a negative error code or zero.
162 * @set_rxfh_indir: Set the contents of the RX flow hash indirection table. 166 * @set_rxfh: Set the contents of the RX flow hash indirection table and/or
163 * Will not be called if @get_rxfh_indir_size returns zero. 167 * hash key. In case only the indirection table or hash key is to be
168 * changed, the other argument will be %NULL.
169 * Will only be called if one or both of @get_rxfh_indir_size and
170 * @get_rxfh_key_size are implemented and return non-zero.
164 * Returns a negative error code or zero. 171 * Returns a negative error code or zero.
165 * @get_channels: Get number of channels. 172 * @get_channels: Get number of channels.
166 * @set_channels: Set number of channels. Returns a negative error code or 173 * @set_channels: Set number of channels. Returns a negative error code or
@@ -232,9 +239,11 @@ struct ethtool_ops {
232 int (*set_rxnfc)(struct net_device *, struct ethtool_rxnfc *); 239 int (*set_rxnfc)(struct net_device *, struct ethtool_rxnfc *);
233 int (*flash_device)(struct net_device *, struct ethtool_flash *); 240 int (*flash_device)(struct net_device *, struct ethtool_flash *);
234 int (*reset)(struct net_device *, u32 *); 241 int (*reset)(struct net_device *, u32 *);
242 u32 (*get_rxfh_key_size)(struct net_device *);
235 u32 (*get_rxfh_indir_size)(struct net_device *); 243 u32 (*get_rxfh_indir_size)(struct net_device *);
236 int (*get_rxfh_indir)(struct net_device *, u32 *); 244 int (*get_rxfh)(struct net_device *, u32 *indir, u8 *key);
237 int (*set_rxfh_indir)(struct net_device *, const u32 *); 245 int (*set_rxfh)(struct net_device *, const u32 *indir,
246 const u8 *key);
238 void (*get_channels)(struct net_device *, struct ethtool_channels *); 247 void (*get_channels)(struct net_device *, struct ethtool_channels *);
239 int (*set_channels)(struct net_device *, struct ethtool_channels *); 248 int (*set_channels)(struct net_device *, struct ethtool_channels *);
240 int (*get_dump_flag)(struct net_device *, struct ethtool_dump *); 249 int (*get_dump_flag)(struct net_device *, struct ethtool_dump *);
diff --git a/include/linux/extcon.h b/include/linux/extcon.h
index f488145bb2d4..36f49c405dfb 100644
--- a/include/linux/extcon.h
+++ b/include/linux/extcon.h
@@ -185,9 +185,22 @@ struct extcon_specific_cable_nb {
185 */ 185 */
186extern int extcon_dev_register(struct extcon_dev *edev); 186extern int extcon_dev_register(struct extcon_dev *edev);
187extern void extcon_dev_unregister(struct extcon_dev *edev); 187extern void extcon_dev_unregister(struct extcon_dev *edev);
188extern int devm_extcon_dev_register(struct device *dev,
189 struct extcon_dev *edev);
190extern void devm_extcon_dev_unregister(struct device *dev,
191 struct extcon_dev *edev);
188extern struct extcon_dev *extcon_get_extcon_dev(const char *extcon_name); 192extern struct extcon_dev *extcon_get_extcon_dev(const char *extcon_name);
189 193
190/* 194/*
195 * Following APIs control the memory of extcon device.
196 */
197extern struct extcon_dev *extcon_dev_allocate(const char **cables);
198extern void extcon_dev_free(struct extcon_dev *edev);
199extern struct extcon_dev *devm_extcon_dev_allocate(struct device *dev,
200 const char **cables);
201extern void devm_extcon_dev_free(struct device *dev, struct extcon_dev *edev);
202
203/*
191 * get/set/update_state access the 32b encoded state value, which represents 204 * get/set/update_state access the 32b encoded state value, which represents
192 * states of all possible cables of the multistate port. For example, if one 205 * states of all possible cables of the multistate port. For example, if one
193 * calls extcon_set_state(edev, 0x7), it may mean that all the three cables 206 * calls extcon_set_state(edev, 0x7), it may mean that all the three cables
@@ -254,6 +267,30 @@ static inline int extcon_dev_register(struct extcon_dev *edev)
254 267
255static inline void extcon_dev_unregister(struct extcon_dev *edev) { } 268static inline void extcon_dev_unregister(struct extcon_dev *edev) { }
256 269
270static inline int devm_extcon_dev_register(struct device *dev,
271 struct extcon_dev *edev)
272{
273 return -EINVAL;
274}
275
276static inline void devm_extcon_dev_unregister(struct device *dev,
277 struct extcon_dev *edev) { }
278
279static inline struct extcon_dev *extcon_dev_allocate(const char **cables)
280{
281 return ERR_PTR(-ENOSYS);
282}
283
284static inline void extcon_dev_free(struct extcon_dev *edev) { }
285
286static inline struct extcon_dev *devm_extcon_dev_allocate(struct device *dev,
287 const char **cables)
288{
289 return ERR_PTR(-ENOSYS);
290}
291
292static inline void devm_extcon_dev_free(struct extcon_dev *edev) { }
293
257static inline u32 extcon_get_state(struct extcon_dev *edev) 294static inline u32 extcon_get_state(struct extcon_dev *edev)
258{ 295{
259 return 0; 296 return 0;
diff --git a/include/linux/f2fs_fs.h b/include/linux/f2fs_fs.h
index df53e1753a76..6ff0b0b42d47 100644
--- a/include/linux/f2fs_fs.h
+++ b/include/linux/f2fs_fs.h
@@ -19,6 +19,7 @@
19#define F2FS_LOG_SECTORS_PER_BLOCK 3 /* 4KB: F2FS_BLKSIZE */ 19#define F2FS_LOG_SECTORS_PER_BLOCK 3 /* 4KB: F2FS_BLKSIZE */
20#define F2FS_BLKSIZE 4096 /* support only 4KB block */ 20#define F2FS_BLKSIZE 4096 /* support only 4KB block */
21#define F2FS_MAX_EXTENSION 64 /* # of extension entries */ 21#define F2FS_MAX_EXTENSION 64 /* # of extension entries */
22#define F2FS_BLK_ALIGN(x) (((x) + F2FS_BLKSIZE - 1) / F2FS_BLKSIZE)
22 23
23#define NULL_ADDR ((block_t)0) /* used as block_t addresses */ 24#define NULL_ADDR ((block_t)0) /* used as block_t addresses */
24#define NEW_ADDR ((block_t)-1) /* used as block_t addresses */ 25#define NEW_ADDR ((block_t)-1) /* used as block_t addresses */
@@ -75,6 +76,7 @@ struct f2fs_super_block {
75 __le16 volume_name[512]; /* volume name */ 76 __le16 volume_name[512]; /* volume name */
76 __le32 extension_count; /* # of extensions below */ 77 __le32 extension_count; /* # of extensions below */
77 __u8 extension_list[F2FS_MAX_EXTENSION][8]; /* extension array */ 78 __u8 extension_list[F2FS_MAX_EXTENSION][8]; /* extension array */
79 __le32 cp_payload;
78} __packed; 80} __packed;
79 81
80/* 82/*
@@ -146,6 +148,9 @@ struct f2fs_extent {
146#define ADDRS_PER_BLOCK 1018 /* Address Pointers in a Direct Block */ 148#define ADDRS_PER_BLOCK 1018 /* Address Pointers in a Direct Block */
147#define NIDS_PER_BLOCK 1018 /* Node IDs in an Indirect Block */ 149#define NIDS_PER_BLOCK 1018 /* Node IDs in an Indirect Block */
148 150
151#define ADDRS_PER_PAGE(page, fi) \
152 (IS_INODE(page) ? ADDRS_PER_INODE(fi) : ADDRS_PER_BLOCK)
153
149#define NODE_DIR1_BLOCK (DEF_ADDRS_PER_INODE + 1) 154#define NODE_DIR1_BLOCK (DEF_ADDRS_PER_INODE + 1)
150#define NODE_DIR2_BLOCK (DEF_ADDRS_PER_INODE + 2) 155#define NODE_DIR2_BLOCK (DEF_ADDRS_PER_INODE + 2)
151#define NODE_IND1_BLOCK (DEF_ADDRS_PER_INODE + 3) 156#define NODE_IND1_BLOCK (DEF_ADDRS_PER_INODE + 3)
@@ -391,6 +396,9 @@ typedef __le32 f2fs_hash_t;
391/* MAX level for dir lookup */ 396/* MAX level for dir lookup */
392#define MAX_DIR_HASH_DEPTH 63 397#define MAX_DIR_HASH_DEPTH 63
393 398
399/* MAX buckets in one level of dir */
400#define MAX_DIR_BUCKETS (1 << ((MAX_DIR_HASH_DEPTH / 2) - 1))
401
394#define SIZE_OF_DIR_ENTRY 11 /* by byte */ 402#define SIZE_OF_DIR_ENTRY 11 /* by byte */
395#define SIZE_OF_DENTRY_BITMAP ((NR_DENTRY_IN_BLOCK + BITS_PER_BYTE - 1) / \ 403#define SIZE_OF_DENTRY_BITMAP ((NR_DENTRY_IN_BLOCK + BITS_PER_BYTE - 1) / \
396 BITS_PER_BYTE) 404 BITS_PER_BYTE)
diff --git a/include/linux/fb.h b/include/linux/fb.h
index fe6ac956550e..b6bfda99add3 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -47,6 +47,7 @@ struct device_node;
47 47
48#define FB_MISC_PRIM_COLOR 1 48#define FB_MISC_PRIM_COLOR 1
49#define FB_MISC_1ST_DETAIL 2 /* First Detailed Timing is preferred */ 49#define FB_MISC_1ST_DETAIL 2 /* First Detailed Timing is preferred */
50#define FB_MISC_HDMI 4
50struct fb_chroma { 51struct fb_chroma {
51 __u32 redx; /* in fraction of 1024 */ 52 __u32 redx; /* in fraction of 1024 */
52 __u32 greenx; 53 __u32 greenx;
@@ -641,7 +642,7 @@ static inline void unlock_fb_info(struct fb_info *info)
641static inline void __fb_pad_aligned_buffer(u8 *dst, u32 d_pitch, 642static inline void __fb_pad_aligned_buffer(u8 *dst, u32 d_pitch,
642 u8 *src, u32 s_pitch, u32 height) 643 u8 *src, u32 s_pitch, u32 height)
643{ 644{
644 int i, j; 645 u32 i, j;
645 646
646 d_pitch -= s_pitch; 647 d_pitch -= s_pitch;
647 648
diff --git a/include/linux/filter.h b/include/linux/filter.h
index 024fd03e5d18..a7e3c48d73a7 100644
--- a/include/linux/filter.h
+++ b/include/linux/filter.h
@@ -37,21 +37,270 @@
37#define BPF_CALL 0x80 /* function call */ 37#define BPF_CALL 0x80 /* function call */
38#define BPF_EXIT 0x90 /* function return */ 38#define BPF_EXIT 0x90 /* function return */
39 39
40/* Register numbers */
41enum {
42 BPF_REG_0 = 0,
43 BPF_REG_1,
44 BPF_REG_2,
45 BPF_REG_3,
46 BPF_REG_4,
47 BPF_REG_5,
48 BPF_REG_6,
49 BPF_REG_7,
50 BPF_REG_8,
51 BPF_REG_9,
52 BPF_REG_10,
53 __MAX_BPF_REG,
54};
55
40/* BPF has 10 general purpose 64-bit registers and stack frame. */ 56/* BPF has 10 general purpose 64-bit registers and stack frame. */
41#define MAX_BPF_REG 11 57#define MAX_BPF_REG __MAX_BPF_REG
58
59/* ArgX, context and stack frame pointer register positions. Note,
60 * Arg1, Arg2, Arg3, etc are used as argument mappings of function
61 * calls in BPF_CALL instruction.
62 */
63#define BPF_REG_ARG1 BPF_REG_1
64#define BPF_REG_ARG2 BPF_REG_2
65#define BPF_REG_ARG3 BPF_REG_3
66#define BPF_REG_ARG4 BPF_REG_4
67#define BPF_REG_ARG5 BPF_REG_5
68#define BPF_REG_CTX BPF_REG_6
69#define BPF_REG_FP BPF_REG_10
70
71/* Additional register mappings for converted user programs. */
72#define BPF_REG_A BPF_REG_0
73#define BPF_REG_X BPF_REG_7
74#define BPF_REG_TMP BPF_REG_8
42 75
43/* BPF program can access up to 512 bytes of stack space. */ 76/* BPF program can access up to 512 bytes of stack space. */
44#define MAX_BPF_STACK 512 77#define MAX_BPF_STACK 512
45 78
46/* Arg1, context and stack frame pointer register positions. */ 79/* Helper macros for filter block array initializers. */
47#define ARG1_REG 1 80
48#define CTX_REG 6 81/* ALU ops on registers, bpf_add|sub|...: dst_reg += src_reg */
49#define FP_REG 10 82
83#define BPF_ALU64_REG(OP, DST, SRC) \
84 ((struct sock_filter_int) { \
85 .code = BPF_ALU64 | BPF_OP(OP) | BPF_X, \
86 .dst_reg = DST, \
87 .src_reg = SRC, \
88 .off = 0, \
89 .imm = 0 })
90
91#define BPF_ALU32_REG(OP, DST, SRC) \
92 ((struct sock_filter_int) { \
93 .code = BPF_ALU | BPF_OP(OP) | BPF_X, \
94 .dst_reg = DST, \
95 .src_reg = SRC, \
96 .off = 0, \
97 .imm = 0 })
98
99/* ALU ops on immediates, bpf_add|sub|...: dst_reg += imm32 */
100
101#define BPF_ALU64_IMM(OP, DST, IMM) \
102 ((struct sock_filter_int) { \
103 .code = BPF_ALU64 | BPF_OP(OP) | BPF_K, \
104 .dst_reg = DST, \
105 .src_reg = 0, \
106 .off = 0, \
107 .imm = IMM })
108
109#define BPF_ALU32_IMM(OP, DST, IMM) \
110 ((struct sock_filter_int) { \
111 .code = BPF_ALU | BPF_OP(OP) | BPF_K, \
112 .dst_reg = DST, \
113 .src_reg = 0, \
114 .off = 0, \
115 .imm = IMM })
116
117/* Endianess conversion, cpu_to_{l,b}e(), {l,b}e_to_cpu() */
118
119#define BPF_ENDIAN(TYPE, DST, LEN) \
120 ((struct sock_filter_int) { \
121 .code = BPF_ALU | BPF_END | BPF_SRC(TYPE), \
122 .dst_reg = DST, \
123 .src_reg = 0, \
124 .off = 0, \
125 .imm = LEN })
126
127/* Short form of mov, dst_reg = src_reg */
128
129#define BPF_MOV64_REG(DST, SRC) \
130 ((struct sock_filter_int) { \
131 .code = BPF_ALU64 | BPF_MOV | BPF_X, \
132 .dst_reg = DST, \
133 .src_reg = SRC, \
134 .off = 0, \
135 .imm = 0 })
136
137#define BPF_MOV32_REG(DST, SRC) \
138 ((struct sock_filter_int) { \
139 .code = BPF_ALU | BPF_MOV | BPF_X, \
140 .dst_reg = DST, \
141 .src_reg = SRC, \
142 .off = 0, \
143 .imm = 0 })
144
145/* Short form of mov, dst_reg = imm32 */
146
147#define BPF_MOV64_IMM(DST, IMM) \
148 ((struct sock_filter_int) { \
149 .code = BPF_ALU64 | BPF_MOV | BPF_K, \
150 .dst_reg = DST, \
151 .src_reg = 0, \
152 .off = 0, \
153 .imm = IMM })
154
155#define BPF_MOV32_IMM(DST, IMM) \
156 ((struct sock_filter_int) { \
157 .code = BPF_ALU | BPF_MOV | BPF_K, \
158 .dst_reg = DST, \
159 .src_reg = 0, \
160 .off = 0, \
161 .imm = IMM })
162
163/* Short form of mov based on type, BPF_X: dst_reg = src_reg, BPF_K: dst_reg = imm32 */
164
165#define BPF_MOV64_RAW(TYPE, DST, SRC, IMM) \
166 ((struct sock_filter_int) { \
167 .code = BPF_ALU64 | BPF_MOV | BPF_SRC(TYPE), \
168 .dst_reg = DST, \
169 .src_reg = SRC, \
170 .off = 0, \
171 .imm = IMM })
172
173#define BPF_MOV32_RAW(TYPE, DST, SRC, IMM) \
174 ((struct sock_filter_int) { \
175 .code = BPF_ALU | BPF_MOV | BPF_SRC(TYPE), \
176 .dst_reg = DST, \
177 .src_reg = SRC, \
178 .off = 0, \
179 .imm = IMM })
180
181/* Direct packet access, R0 = *(uint *) (skb->data + imm32) */
182
183#define BPF_LD_ABS(SIZE, IMM) \
184 ((struct sock_filter_int) { \
185 .code = BPF_LD | BPF_SIZE(SIZE) | BPF_ABS, \
186 .dst_reg = 0, \
187 .src_reg = 0, \
188 .off = 0, \
189 .imm = IMM })
190
191/* Indirect packet access, R0 = *(uint *) (skb->data + src_reg + imm32) */
192
193#define BPF_LD_IND(SIZE, SRC, IMM) \
194 ((struct sock_filter_int) { \
195 .code = BPF_LD | BPF_SIZE(SIZE) | BPF_IND, \
196 .dst_reg = 0, \
197 .src_reg = SRC, \
198 .off = 0, \
199 .imm = IMM })
200
201/* Memory load, dst_reg = *(uint *) (src_reg + off16) */
202
203#define BPF_LDX_MEM(SIZE, DST, SRC, OFF) \
204 ((struct sock_filter_int) { \
205 .code = BPF_LDX | BPF_SIZE(SIZE) | BPF_MEM, \
206 .dst_reg = DST, \
207 .src_reg = SRC, \
208 .off = OFF, \
209 .imm = 0 })
210
211/* Memory store, *(uint *) (dst_reg + off16) = src_reg */
212
213#define BPF_STX_MEM(SIZE, DST, SRC, OFF) \
214 ((struct sock_filter_int) { \
215 .code = BPF_STX | BPF_SIZE(SIZE) | BPF_MEM, \
216 .dst_reg = DST, \
217 .src_reg = SRC, \
218 .off = OFF, \
219 .imm = 0 })
220
221/* Memory store, *(uint *) (dst_reg + off16) = imm32 */
222
223#define BPF_ST_MEM(SIZE, DST, OFF, IMM) \
224 ((struct sock_filter_int) { \
225 .code = BPF_ST | BPF_SIZE(SIZE) | BPF_MEM, \
226 .dst_reg = DST, \
227 .src_reg = 0, \
228 .off = OFF, \
229 .imm = IMM })
230
231/* Conditional jumps against registers, if (dst_reg 'op' src_reg) goto pc + off16 */
232
233#define BPF_JMP_REG(OP, DST, SRC, OFF) \
234 ((struct sock_filter_int) { \
235 .code = BPF_JMP | BPF_OP(OP) | BPF_X, \
236 .dst_reg = DST, \
237 .src_reg = SRC, \
238 .off = OFF, \
239 .imm = 0 })
240
241/* Conditional jumps against immediates, if (dst_reg 'op' imm32) goto pc + off16 */
242
243#define BPF_JMP_IMM(OP, DST, IMM, OFF) \
244 ((struct sock_filter_int) { \
245 .code = BPF_JMP | BPF_OP(OP) | BPF_K, \
246 .dst_reg = DST, \
247 .src_reg = 0, \
248 .off = OFF, \
249 .imm = IMM })
250
251/* Function call */
252
253#define BPF_EMIT_CALL(FUNC) \
254 ((struct sock_filter_int) { \
255 .code = BPF_JMP | BPF_CALL, \
256 .dst_reg = 0, \
257 .src_reg = 0, \
258 .off = 0, \
259 .imm = ((FUNC) - __bpf_call_base) })
260
261/* Raw code statement block */
262
263#define BPF_RAW_INSN(CODE, DST, SRC, OFF, IMM) \
264 ((struct sock_filter_int) { \
265 .code = CODE, \
266 .dst_reg = DST, \
267 .src_reg = SRC, \
268 .off = OFF, \
269 .imm = IMM })
270
271/* Program exit */
272
273#define BPF_EXIT_INSN() \
274 ((struct sock_filter_int) { \
275 .code = BPF_JMP | BPF_EXIT, \
276 .dst_reg = 0, \
277 .src_reg = 0, \
278 .off = 0, \
279 .imm = 0 })
280
281#define bytes_to_bpf_size(bytes) \
282({ \
283 int bpf_size = -EINVAL; \
284 \
285 if (bytes == sizeof(u8)) \
286 bpf_size = BPF_B; \
287 else if (bytes == sizeof(u16)) \
288 bpf_size = BPF_H; \
289 else if (bytes == sizeof(u32)) \
290 bpf_size = BPF_W; \
291 else if (bytes == sizeof(u64)) \
292 bpf_size = BPF_DW; \
293 \
294 bpf_size; \
295})
296
297/* Macro to invoke filter function. */
298#define SK_RUN_FILTER(filter, ctx) (*filter->bpf_func)(ctx, filter->insnsi)
50 299
51struct sock_filter_int { 300struct sock_filter_int {
52 __u8 code; /* opcode */ 301 __u8 code; /* opcode */
53 __u8 a_reg:4; /* dest register */ 302 __u8 dst_reg:4; /* dest register */
54 __u8 x_reg:4; /* source register */ 303 __u8 src_reg:4; /* source register */
55 __s16 off; /* signed offset */ 304 __s16 off; /* signed offset */
56 __s32 imm; /* signed immediate constant */ 305 __s32 imm; /* signed immediate constant */
57}; 306};
@@ -97,21 +346,16 @@ static inline unsigned int sk_filter_size(unsigned int proglen)
97#define sk_filter_proglen(fprog) \ 346#define sk_filter_proglen(fprog) \
98 (fprog->len * sizeof(fprog->filter[0])) 347 (fprog->len * sizeof(fprog->filter[0]))
99 348
100#define SK_RUN_FILTER(filter, ctx) \
101 (*filter->bpf_func)(ctx, filter->insnsi)
102
103int sk_filter(struct sock *sk, struct sk_buff *skb); 349int sk_filter(struct sock *sk, struct sk_buff *skb);
104 350
105u32 sk_run_filter_int_seccomp(const struct seccomp_data *ctx, 351void sk_filter_select_runtime(struct sk_filter *fp);
106 const struct sock_filter_int *insni); 352void sk_filter_free(struct sk_filter *fp);
107u32 sk_run_filter_int_skb(const struct sk_buff *ctx,
108 const struct sock_filter_int *insni);
109 353
110int sk_convert_filter(struct sock_filter *prog, int len, 354int sk_convert_filter(struct sock_filter *prog, int len,
111 struct sock_filter_int *new_prog, int *new_len); 355 struct sock_filter_int *new_prog, int *new_len);
112 356
113int sk_unattached_filter_create(struct sk_filter **pfp, 357int sk_unattached_filter_create(struct sk_filter **pfp,
114 struct sock_fprog *fprog); 358 struct sock_fprog_kern *fprog);
115void sk_unattached_filter_destroy(struct sk_filter *fp); 359void sk_unattached_filter_destroy(struct sk_filter *fp);
116 360
117int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk); 361int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk);
@@ -120,11 +364,48 @@ int sk_detach_filter(struct sock *sk);
120int sk_chk_filter(struct sock_filter *filter, unsigned int flen); 364int sk_chk_filter(struct sock_filter *filter, unsigned int flen);
121int sk_get_filter(struct sock *sk, struct sock_filter __user *filter, 365int sk_get_filter(struct sock *sk, struct sock_filter __user *filter,
122 unsigned int len); 366 unsigned int len);
123void sk_decode_filter(struct sock_filter *filt, struct sock_filter *to);
124 367
125void sk_filter_charge(struct sock *sk, struct sk_filter *fp); 368void sk_filter_charge(struct sock *sk, struct sk_filter *fp);
126void sk_filter_uncharge(struct sock *sk, struct sk_filter *fp); 369void sk_filter_uncharge(struct sock *sk, struct sk_filter *fp);
127 370
371u64 __bpf_call_base(u64 r1, u64 r2, u64 r3, u64 r4, u64 r5);
372void bpf_int_jit_compile(struct sk_filter *fp);
373
374#define BPF_ANC BIT(15)
375
376static inline u16 bpf_anc_helper(const struct sock_filter *ftest)
377{
378 BUG_ON(ftest->code & BPF_ANC);
379
380 switch (ftest->code) {
381 case BPF_LD | BPF_W | BPF_ABS:
382 case BPF_LD | BPF_H | BPF_ABS:
383 case BPF_LD | BPF_B | BPF_ABS:
384#define BPF_ANCILLARY(CODE) case SKF_AD_OFF + SKF_AD_##CODE: \
385 return BPF_ANC | SKF_AD_##CODE
386 switch (ftest->k) {
387 BPF_ANCILLARY(PROTOCOL);
388 BPF_ANCILLARY(PKTTYPE);
389 BPF_ANCILLARY(IFINDEX);
390 BPF_ANCILLARY(NLATTR);
391 BPF_ANCILLARY(NLATTR_NEST);
392 BPF_ANCILLARY(MARK);
393 BPF_ANCILLARY(QUEUE);
394 BPF_ANCILLARY(HATYPE);
395 BPF_ANCILLARY(RXHASH);
396 BPF_ANCILLARY(CPU);
397 BPF_ANCILLARY(ALU_XOR_X);
398 BPF_ANCILLARY(VLAN_TAG);
399 BPF_ANCILLARY(VLAN_TAG_PRESENT);
400 BPF_ANCILLARY(PAY_OFFSET);
401 BPF_ANCILLARY(RANDOM);
402 }
403 /* Fallthrough. */
404 default:
405 return ftest->code;
406 }
407}
408
128#ifdef CONFIG_BPF_JIT 409#ifdef CONFIG_BPF_JIT
129#include <stdarg.h> 410#include <stdarg.h>
130#include <linux/linkage.h> 411#include <linux/linkage.h>
@@ -144,85 +425,20 @@ static inline void bpf_jit_dump(unsigned int flen, unsigned int proglen,
144} 425}
145#else 426#else
146#include <linux/slab.h> 427#include <linux/slab.h>
428
147static inline void bpf_jit_compile(struct sk_filter *fp) 429static inline void bpf_jit_compile(struct sk_filter *fp)
148{ 430{
149} 431}
432
150static inline void bpf_jit_free(struct sk_filter *fp) 433static inline void bpf_jit_free(struct sk_filter *fp)
151{ 434{
152 kfree(fp); 435 kfree(fp);
153} 436}
154#endif 437#endif /* CONFIG_BPF_JIT */
155 438
156static inline int bpf_tell_extensions(void) 439static inline int bpf_tell_extensions(void)
157{ 440{
158 return SKF_AD_MAX; 441 return SKF_AD_MAX;
159} 442}
160 443
161enum {
162 BPF_S_RET_K = 1,
163 BPF_S_RET_A,
164 BPF_S_ALU_ADD_K,
165 BPF_S_ALU_ADD_X,
166 BPF_S_ALU_SUB_K,
167 BPF_S_ALU_SUB_X,
168 BPF_S_ALU_MUL_K,
169 BPF_S_ALU_MUL_X,
170 BPF_S_ALU_DIV_X,
171 BPF_S_ALU_MOD_K,
172 BPF_S_ALU_MOD_X,
173 BPF_S_ALU_AND_K,
174 BPF_S_ALU_AND_X,
175 BPF_S_ALU_OR_K,
176 BPF_S_ALU_OR_X,
177 BPF_S_ALU_XOR_K,
178 BPF_S_ALU_XOR_X,
179 BPF_S_ALU_LSH_K,
180 BPF_S_ALU_LSH_X,
181 BPF_S_ALU_RSH_K,
182 BPF_S_ALU_RSH_X,
183 BPF_S_ALU_NEG,
184 BPF_S_LD_W_ABS,
185 BPF_S_LD_H_ABS,
186 BPF_S_LD_B_ABS,
187 BPF_S_LD_W_LEN,
188 BPF_S_LD_W_IND,
189 BPF_S_LD_H_IND,
190 BPF_S_LD_B_IND,
191 BPF_S_LD_IMM,
192 BPF_S_LDX_W_LEN,
193 BPF_S_LDX_B_MSH,
194 BPF_S_LDX_IMM,
195 BPF_S_MISC_TAX,
196 BPF_S_MISC_TXA,
197 BPF_S_ALU_DIV_K,
198 BPF_S_LD_MEM,
199 BPF_S_LDX_MEM,
200 BPF_S_ST,
201 BPF_S_STX,
202 BPF_S_JMP_JA,
203 BPF_S_JMP_JEQ_K,
204 BPF_S_JMP_JEQ_X,
205 BPF_S_JMP_JGE_K,
206 BPF_S_JMP_JGE_X,
207 BPF_S_JMP_JGT_K,
208 BPF_S_JMP_JGT_X,
209 BPF_S_JMP_JSET_K,
210 BPF_S_JMP_JSET_X,
211 /* Ancillary data */
212 BPF_S_ANC_PROTOCOL,
213 BPF_S_ANC_PKTTYPE,
214 BPF_S_ANC_IFINDEX,
215 BPF_S_ANC_NLATTR,
216 BPF_S_ANC_NLATTR_NEST,
217 BPF_S_ANC_MARK,
218 BPF_S_ANC_QUEUE,
219 BPF_S_ANC_HATYPE,
220 BPF_S_ANC_RXHASH,
221 BPF_S_ANC_CPU,
222 BPF_S_ANC_ALU_XOR_X,
223 BPF_S_ANC_VLAN_TAG,
224 BPF_S_ANC_VLAN_TAG_PRESENT,
225 BPF_S_ANC_PAY_OFFSET,
226};
227
228#endif /* __LINUX_FILTER_H__ */ 444#endif /* __LINUX_FILTER_H__ */
diff --git a/include/linux/firewire.h b/include/linux/firewire.h
index c3683bdf28fe..d4b7683c722d 100644
--- a/include/linux/firewire.h
+++ b/include/linux/firewire.h
@@ -367,6 +367,9 @@ static inline int fw_stream_packet_destination_id(int tag, int channel, int sy)
367 return tag << 14 | channel << 8 | sy; 367 return tag << 14 | channel << 8 | sy;
368} 368}
369 369
370void fw_schedule_bus_reset(struct fw_card *card, bool delayed,
371 bool short_reset);
372
370struct fw_descriptor { 373struct fw_descriptor {
371 struct list_head link; 374 struct list_head link;
372 size_t length; 375 size_t length;
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 878031227c57..e11d60cc867b 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -128,6 +128,10 @@ typedef void (dio_iodone_t)(struct kiocb *iocb, loff_t offset,
128#define FMODE_ATOMIC_POS ((__force fmode_t)0x8000) 128#define FMODE_ATOMIC_POS ((__force fmode_t)0x8000)
129/* Write access to underlying fs */ 129/* Write access to underlying fs */
130#define FMODE_WRITER ((__force fmode_t)0x10000) 130#define FMODE_WRITER ((__force fmode_t)0x10000)
131/* Has read method(s) */
132#define FMODE_CAN_READ ((__force fmode_t)0x20000)
133/* Has write method(s) */
134#define FMODE_CAN_WRITE ((__force fmode_t)0x40000)
131 135
132/* File was opened by fanotify and shouldn't generate fanotify events */ 136/* File was opened by fanotify and shouldn't generate fanotify events */
133#define FMODE_NONOTIFY ((__force fmode_t)0x1000000) 137#define FMODE_NONOTIFY ((__force fmode_t)0x1000000)
@@ -343,8 +347,7 @@ struct address_space_operations {
343 void (*invalidatepage) (struct page *, unsigned int, unsigned int); 347 void (*invalidatepage) (struct page *, unsigned int, unsigned int);
344 int (*releasepage) (struct page *, gfp_t); 348 int (*releasepage) (struct page *, gfp_t);
345 void (*freepage)(struct page *); 349 void (*freepage)(struct page *);
346 ssize_t (*direct_IO)(int, struct kiocb *, const struct iovec *iov, 350 ssize_t (*direct_IO)(int, struct kiocb *, struct iov_iter *iter, loff_t offset);
347 loff_t offset, unsigned long nr_segs);
348 int (*get_xip_mem)(struct address_space *, pgoff_t, int, 351 int (*get_xip_mem)(struct address_space *, pgoff_t, int,
349 void **, unsigned long *); 352 void **, unsigned long *);
350 /* 353 /*
@@ -1448,6 +1451,8 @@ struct block_device_operations;
1448#define HAVE_COMPAT_IOCTL 1 1451#define HAVE_COMPAT_IOCTL 1
1449#define HAVE_UNLOCKED_IOCTL 1 1452#define HAVE_UNLOCKED_IOCTL 1
1450 1453
1454struct iov_iter;
1455
1451struct file_operations { 1456struct file_operations {
1452 struct module *owner; 1457 struct module *owner;
1453 loff_t (*llseek) (struct file *, loff_t, int); 1458 loff_t (*llseek) (struct file *, loff_t, int);
@@ -1455,6 +1460,8 @@ struct file_operations {
1455 ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *); 1460 ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *);
1456 ssize_t (*aio_read) (struct kiocb *, const struct iovec *, unsigned long, loff_t); 1461 ssize_t (*aio_read) (struct kiocb *, const struct iovec *, unsigned long, loff_t);
1457 ssize_t (*aio_write) (struct kiocb *, const struct iovec *, unsigned long, loff_t); 1462 ssize_t (*aio_write) (struct kiocb *, const struct iovec *, unsigned long, loff_t);
1463 ssize_t (*read_iter) (struct kiocb *, struct iov_iter *);
1464 ssize_t (*write_iter) (struct kiocb *, struct iov_iter *);
1458 int (*iterate) (struct file *, struct dir_context *); 1465 int (*iterate) (struct file *, struct dir_context *);
1459 unsigned int (*poll) (struct file *, struct poll_table_struct *); 1466 unsigned int (*poll) (struct file *, struct poll_table_struct *);
1460 long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long); 1467 long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long);
@@ -1914,6 +1921,12 @@ static inline int break_lease(struct inode *inode, unsigned int mode)
1914 1921
1915static inline int break_deleg(struct inode *inode, unsigned int mode) 1922static inline int break_deleg(struct inode *inode, unsigned int mode)
1916{ 1923{
1924 /*
1925 * Since this check is lockless, we must ensure that any refcounts
1926 * taken are done before checking inode->i_flock. Otherwise, we could
1927 * end up racing with tasks trying to set a new lease on this file.
1928 */
1929 smp_mb();
1917 if (inode->i_flock) 1930 if (inode->i_flock)
1918 return __break_lease(inode, mode, FL_DELEG); 1931 return __break_lease(inode, mode, FL_DELEG);
1919 return 0; 1932 return 0;
@@ -2404,20 +2417,18 @@ extern int generic_file_readonly_mmap(struct file *, struct vm_area_struct *);
2404extern int generic_file_remap_pages(struct vm_area_struct *, unsigned long addr, 2417extern int generic_file_remap_pages(struct vm_area_struct *, unsigned long addr,
2405 unsigned long size, pgoff_t pgoff); 2418 unsigned long size, pgoff_t pgoff);
2406int generic_write_checks(struct file *file, loff_t *pos, size_t *count, int isblk); 2419int generic_write_checks(struct file *file, loff_t *pos, size_t *count, int isblk);
2407extern ssize_t generic_file_aio_read(struct kiocb *, const struct iovec *, unsigned long, loff_t); 2420extern ssize_t generic_file_read_iter(struct kiocb *, struct iov_iter *);
2408extern ssize_t __generic_file_aio_write(struct kiocb *, const struct iovec *, unsigned long); 2421extern ssize_t __generic_file_write_iter(struct kiocb *, struct iov_iter *);
2409extern ssize_t generic_file_aio_write(struct kiocb *, const struct iovec *, unsigned long, loff_t); 2422extern ssize_t generic_file_write_iter(struct kiocb *, struct iov_iter *);
2410extern ssize_t generic_file_direct_write(struct kiocb *, const struct iovec *, 2423extern ssize_t generic_file_direct_write(struct kiocb *, struct iov_iter *, loff_t);
2411 unsigned long *, loff_t, size_t, size_t);
2412extern ssize_t generic_perform_write(struct file *, struct iov_iter *, loff_t); 2424extern ssize_t generic_perform_write(struct file *, struct iov_iter *, loff_t);
2413extern ssize_t do_sync_read(struct file *filp, char __user *buf, size_t len, loff_t *ppos); 2425extern ssize_t do_sync_read(struct file *filp, char __user *buf, size_t len, loff_t *ppos);
2414extern ssize_t do_sync_write(struct file *filp, const char __user *buf, size_t len, loff_t *ppos); 2426extern ssize_t do_sync_write(struct file *filp, const char __user *buf, size_t len, loff_t *ppos);
2415extern int generic_segment_checks(const struct iovec *iov, 2427extern ssize_t new_sync_read(struct file *filp, char __user *buf, size_t len, loff_t *ppos);
2416 unsigned long *nr_segs, size_t *count, int access_flags); 2428extern ssize_t new_sync_write(struct file *filp, const char __user *buf, size_t len, loff_t *ppos);
2417 2429
2418/* fs/block_dev.c */ 2430/* fs/block_dev.c */
2419extern ssize_t blkdev_aio_write(struct kiocb *iocb, const struct iovec *iov, 2431extern ssize_t blkdev_write_iter(struct kiocb *iocb, struct iov_iter *from);
2420 unsigned long nr_segs, loff_t pos);
2421extern int blkdev_fsync(struct file *filp, loff_t start, loff_t end, 2432extern int blkdev_fsync(struct file *filp, loff_t start, loff_t end,
2422 int datasync); 2433 int datasync);
2423extern void block_sync_page(struct page *page); 2434extern void block_sync_page(struct page *page);
@@ -2427,7 +2438,7 @@ extern ssize_t generic_file_splice_read(struct file *, loff_t *,
2427 struct pipe_inode_info *, size_t, unsigned int); 2438 struct pipe_inode_info *, size_t, unsigned int);
2428extern ssize_t default_file_splice_read(struct file *, loff_t *, 2439extern ssize_t default_file_splice_read(struct file *, loff_t *,
2429 struct pipe_inode_info *, size_t, unsigned int); 2440 struct pipe_inode_info *, size_t, unsigned int);
2430extern ssize_t generic_file_splice_write(struct pipe_inode_info *, 2441extern ssize_t iter_file_splice_write(struct pipe_inode_info *,
2431 struct file *, loff_t *, size_t, unsigned int); 2442 struct file *, loff_t *, size_t, unsigned int);
2432extern ssize_t generic_splice_sendpage(struct pipe_inode_info *pipe, 2443extern ssize_t generic_splice_sendpage(struct pipe_inode_info *pipe,
2433 struct file *out, loff_t *, size_t len, unsigned int flags); 2444 struct file *out, loff_t *, size_t len, unsigned int flags);
@@ -2477,16 +2488,16 @@ enum {
2477void dio_end_io(struct bio *bio, int error); 2488void dio_end_io(struct bio *bio, int error);
2478 2489
2479ssize_t __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode, 2490ssize_t __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode,
2480 struct block_device *bdev, const struct iovec *iov, loff_t offset, 2491 struct block_device *bdev, struct iov_iter *iter, loff_t offset,
2481 unsigned long nr_segs, get_block_t get_block, dio_iodone_t end_io, 2492 get_block_t get_block, dio_iodone_t end_io,
2482 dio_submit_t submit_io, int flags); 2493 dio_submit_t submit_io, int flags);
2483 2494
2484static inline ssize_t blockdev_direct_IO(int rw, struct kiocb *iocb, 2495static inline ssize_t blockdev_direct_IO(int rw, struct kiocb *iocb,
2485 struct inode *inode, const struct iovec *iov, loff_t offset, 2496 struct inode *inode, struct iov_iter *iter, loff_t offset,
2486 unsigned long nr_segs, get_block_t get_block) 2497 get_block_t get_block)
2487{ 2498{
2488 return __blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev, iov, 2499 return __blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev, iter,
2489 offset, nr_segs, get_block, NULL, NULL, 2500 offset, get_block, NULL, NULL,
2490 DIO_LOCKING | DIO_SKIP_HOLES); 2501 DIO_LOCKING | DIO_SKIP_HOLES);
2491} 2502}
2492#endif 2503#endif
@@ -2590,6 +2601,7 @@ extern ssize_t simple_read_from_buffer(void __user *to, size_t count,
2590extern ssize_t simple_write_to_buffer(void *to, size_t available, loff_t *ppos, 2601extern ssize_t simple_write_to_buffer(void *to, size_t available, loff_t *ppos,
2591 const void __user *from, size_t count); 2602 const void __user *from, size_t count);
2592 2603
2604extern int __generic_file_fsync(struct file *, loff_t, loff_t, int);
2593extern int generic_file_fsync(struct file *, loff_t, loff_t, int); 2605extern int generic_file_fsync(struct file *, loff_t, loff_t, int);
2594 2606
2595extern int generic_check_addressable(unsigned, u64); 2607extern int generic_check_addressable(unsigned, u64);
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index ae9504b4b67d..404a686a3644 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -62,9 +62,6 @@ typedef void (*ftrace_func_t)(unsigned long ip, unsigned long parent_ip,
62 * set in the flags member. 62 * set in the flags member.
63 * 63 *
64 * ENABLED - set/unset when ftrace_ops is registered/unregistered 64 * ENABLED - set/unset when ftrace_ops is registered/unregistered
65 * GLOBAL - set manualy by ftrace_ops user to denote the ftrace_ops
66 * is part of the global tracers sharing the same filter
67 * via set_ftrace_* debugfs files.
68 * DYNAMIC - set when ftrace_ops is registered to denote dynamically 65 * DYNAMIC - set when ftrace_ops is registered to denote dynamically
69 * allocated ftrace_ops which need special care 66 * allocated ftrace_ops which need special care
70 * CONTROL - set manualy by ftrace_ops user to denote the ftrace_ops 67 * CONTROL - set manualy by ftrace_ops user to denote the ftrace_ops
@@ -96,15 +93,14 @@ typedef void (*ftrace_func_t)(unsigned long ip, unsigned long parent_ip,
96 */ 93 */
97enum { 94enum {
98 FTRACE_OPS_FL_ENABLED = 1 << 0, 95 FTRACE_OPS_FL_ENABLED = 1 << 0,
99 FTRACE_OPS_FL_GLOBAL = 1 << 1, 96 FTRACE_OPS_FL_DYNAMIC = 1 << 1,
100 FTRACE_OPS_FL_DYNAMIC = 1 << 2, 97 FTRACE_OPS_FL_CONTROL = 1 << 2,
101 FTRACE_OPS_FL_CONTROL = 1 << 3, 98 FTRACE_OPS_FL_SAVE_REGS = 1 << 3,
102 FTRACE_OPS_FL_SAVE_REGS = 1 << 4, 99 FTRACE_OPS_FL_SAVE_REGS_IF_SUPPORTED = 1 << 4,
103 FTRACE_OPS_FL_SAVE_REGS_IF_SUPPORTED = 1 << 5, 100 FTRACE_OPS_FL_RECURSION_SAFE = 1 << 5,
104 FTRACE_OPS_FL_RECURSION_SAFE = 1 << 6, 101 FTRACE_OPS_FL_STUB = 1 << 6,
105 FTRACE_OPS_FL_STUB = 1 << 7, 102 FTRACE_OPS_FL_INITIALIZED = 1 << 7,
106 FTRACE_OPS_FL_INITIALIZED = 1 << 8, 103 FTRACE_OPS_FL_DELETED = 1 << 8,
107 FTRACE_OPS_FL_DELETED = 1 << 9,
108}; 104};
109 105
110/* 106/*
@@ -366,14 +362,12 @@ enum {
366 * IGNORE - The function is already what we want it to be 362 * IGNORE - The function is already what we want it to be
367 * MAKE_CALL - Start tracing the function 363 * MAKE_CALL - Start tracing the function
368 * MODIFY_CALL - Stop saving regs for the function 364 * MODIFY_CALL - Stop saving regs for the function
369 * MODIFY_CALL_REGS - Start saving regs for the function
370 * MAKE_NOP - Stop tracing the function 365 * MAKE_NOP - Stop tracing the function
371 */ 366 */
372enum { 367enum {
373 FTRACE_UPDATE_IGNORE, 368 FTRACE_UPDATE_IGNORE,
374 FTRACE_UPDATE_MAKE_CALL, 369 FTRACE_UPDATE_MAKE_CALL,
375 FTRACE_UPDATE_MODIFY_CALL, 370 FTRACE_UPDATE_MODIFY_CALL,
376 FTRACE_UPDATE_MODIFY_CALL_REGS,
377 FTRACE_UPDATE_MAKE_NOP, 371 FTRACE_UPDATE_MAKE_NOP,
378}; 372};
379 373
@@ -404,6 +398,8 @@ int ftrace_update_record(struct dyn_ftrace *rec, int enable);
404int ftrace_test_record(struct dyn_ftrace *rec, int enable); 398int ftrace_test_record(struct dyn_ftrace *rec, int enable);
405void ftrace_run_stop_machine(int command); 399void ftrace_run_stop_machine(int command);
406unsigned long ftrace_location(unsigned long ip); 400unsigned long ftrace_location(unsigned long ip);
401unsigned long ftrace_get_addr_new(struct dyn_ftrace *rec);
402unsigned long ftrace_get_addr_curr(struct dyn_ftrace *rec);
407 403
408extern ftrace_func_t ftrace_trace_function; 404extern ftrace_func_t ftrace_trace_function;
409 405
@@ -616,25 +612,27 @@ static inline void __ftrace_enabled_restore(int enabled)
616#endif 612#endif
617} 613}
618 614
619#ifndef HAVE_ARCH_CALLER_ADDR 615/* All archs should have this, but we define it for consistency */
616#ifndef ftrace_return_address0
617# define ftrace_return_address0 __builtin_return_address(0)
618#endif
619
620/* Archs may use other ways for ADDR1 and beyond */
621#ifndef ftrace_return_address
620# ifdef CONFIG_FRAME_POINTER 622# ifdef CONFIG_FRAME_POINTER
621# define CALLER_ADDR0 ((unsigned long)__builtin_return_address(0)) 623# define ftrace_return_address(n) __builtin_return_address(n)
622# define CALLER_ADDR1 ((unsigned long)__builtin_return_address(1))
623# define CALLER_ADDR2 ((unsigned long)__builtin_return_address(2))
624# define CALLER_ADDR3 ((unsigned long)__builtin_return_address(3))
625# define CALLER_ADDR4 ((unsigned long)__builtin_return_address(4))
626# define CALLER_ADDR5 ((unsigned long)__builtin_return_address(5))
627# define CALLER_ADDR6 ((unsigned long)__builtin_return_address(6))
628# else 624# else
629# define CALLER_ADDR0 ((unsigned long)__builtin_return_address(0)) 625# define ftrace_return_address(n) 0UL
630# define CALLER_ADDR1 0UL
631# define CALLER_ADDR2 0UL
632# define CALLER_ADDR3 0UL
633# define CALLER_ADDR4 0UL
634# define CALLER_ADDR5 0UL
635# define CALLER_ADDR6 0UL
636# endif 626# endif
637#endif /* ifndef HAVE_ARCH_CALLER_ADDR */ 627#endif
628
629#define CALLER_ADDR0 ((unsigned long)ftrace_return_address0)
630#define CALLER_ADDR1 ((unsigned long)ftrace_return_address(1))
631#define CALLER_ADDR2 ((unsigned long)ftrace_return_address(2))
632#define CALLER_ADDR3 ((unsigned long)ftrace_return_address(3))
633#define CALLER_ADDR4 ((unsigned long)ftrace_return_address(4))
634#define CALLER_ADDR5 ((unsigned long)ftrace_return_address(5))
635#define CALLER_ADDR6 ((unsigned long)ftrace_return_address(6))
638 636
639#ifdef CONFIG_IRQSOFF_TRACER 637#ifdef CONFIG_IRQSOFF_TRACER
640 extern void time_hardirqs_on(unsigned long a0, unsigned long a1); 638 extern void time_hardirqs_on(unsigned long a0, unsigned long a1);
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
index d16da3e53bc7..cff3106ffe2c 100644
--- a/include/linux/ftrace_event.h
+++ b/include/linux/ftrace_event.h
@@ -38,6 +38,9 @@ const char *ftrace_print_symbols_seq_u64(struct trace_seq *p,
38 *symbol_array); 38 *symbol_array);
39#endif 39#endif
40 40
41const char *ftrace_print_bitmask_seq(struct trace_seq *p, void *bitmask_ptr,
42 unsigned int bitmask_size);
43
41const char *ftrace_print_hex_seq(struct trace_seq *p, 44const char *ftrace_print_hex_seq(struct trace_seq *p,
42 const unsigned char *buf, int len); 45 const unsigned char *buf, int len);
43 46
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 9f3c275e053e..ec274e0f4ed2 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -649,7 +649,7 @@ static inline void hd_ref_init(struct hd_struct *part)
649static inline void hd_struct_get(struct hd_struct *part) 649static inline void hd_struct_get(struct hd_struct *part)
650{ 650{
651 atomic_inc(&part->ref); 651 atomic_inc(&part->ref);
652 smp_mb__after_atomic_inc(); 652 smp_mb__after_atomic();
653} 653}
654 654
655static inline int hd_struct_try_get(struct hd_struct *part) 655static inline int hd_struct_try_get(struct hd_struct *part)
diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index 39b81dc7d01a..6eb1fb37de9a 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -6,7 +6,6 @@
6#include <linux/stddef.h> 6#include <linux/stddef.h>
7#include <linux/linkage.h> 7#include <linux/linkage.h>
8#include <linux/topology.h> 8#include <linux/topology.h>
9#include <linux/mmdebug.h>
10 9
11struct vm_area_struct; 10struct vm_area_struct;
12 11
@@ -31,7 +30,6 @@ struct vm_area_struct;
31#define ___GFP_HARDWALL 0x20000u 30#define ___GFP_HARDWALL 0x20000u
32#define ___GFP_THISNODE 0x40000u 31#define ___GFP_THISNODE 0x40000u
33#define ___GFP_RECLAIMABLE 0x80000u 32#define ___GFP_RECLAIMABLE 0x80000u
34#define ___GFP_KMEMCG 0x100000u
35#define ___GFP_NOTRACK 0x200000u 33#define ___GFP_NOTRACK 0x200000u
36#define ___GFP_NO_KSWAPD 0x400000u 34#define ___GFP_NO_KSWAPD 0x400000u
37#define ___GFP_OTHER_NODE 0x800000u 35#define ___GFP_OTHER_NODE 0x800000u
@@ -91,7 +89,6 @@ struct vm_area_struct;
91 89
92#define __GFP_NO_KSWAPD ((__force gfp_t)___GFP_NO_KSWAPD) 90#define __GFP_NO_KSWAPD ((__force gfp_t)___GFP_NO_KSWAPD)
93#define __GFP_OTHER_NODE ((__force gfp_t)___GFP_OTHER_NODE) /* On behalf of other node */ 91#define __GFP_OTHER_NODE ((__force gfp_t)___GFP_OTHER_NODE) /* On behalf of other node */
94#define __GFP_KMEMCG ((__force gfp_t)___GFP_KMEMCG) /* Allocation comes from a memcg-accounted resource */
95#define __GFP_WRITE ((__force gfp_t)___GFP_WRITE) /* Allocator intends to dirty page */ 92#define __GFP_WRITE ((__force gfp_t)___GFP_WRITE) /* Allocator intends to dirty page */
96 93
97/* 94/*
@@ -353,6 +350,10 @@ extern struct page *alloc_pages_vma(gfp_t gfp_mask, int order,
353#define alloc_page_vma_node(gfp_mask, vma, addr, node) \ 350#define alloc_page_vma_node(gfp_mask, vma, addr, node) \
354 alloc_pages_vma(gfp_mask, 0, vma, addr, node) 351 alloc_pages_vma(gfp_mask, 0, vma, addr, node)
355 352
353extern struct page *alloc_kmem_pages(gfp_t gfp_mask, unsigned int order);
354extern struct page *alloc_kmem_pages_node(int nid, gfp_t gfp_mask,
355 unsigned int order);
356
356extern unsigned long __get_free_pages(gfp_t gfp_mask, unsigned int order); 357extern unsigned long __get_free_pages(gfp_t gfp_mask, unsigned int order);
357extern unsigned long get_zeroed_page(gfp_t gfp_mask); 358extern unsigned long get_zeroed_page(gfp_t gfp_mask);
358 359
@@ -369,11 +370,11 @@ void *alloc_pages_exact_nid(int nid, size_t size, gfp_t gfp_mask);
369 370
370extern void __free_pages(struct page *page, unsigned int order); 371extern void __free_pages(struct page *page, unsigned int order);
371extern void free_pages(unsigned long addr, unsigned int order); 372extern void free_pages(unsigned long addr, unsigned int order);
372extern void free_hot_cold_page(struct page *page, int cold); 373extern void free_hot_cold_page(struct page *page, bool cold);
373extern void free_hot_cold_page_list(struct list_head *list, int cold); 374extern void free_hot_cold_page_list(struct list_head *list, bool cold);
374 375
375extern void __free_memcg_kmem_pages(struct page *page, unsigned int order); 376extern void __free_kmem_pages(struct page *page, unsigned int order);
376extern void free_memcg_kmem_pages(unsigned long addr, unsigned int order); 377extern void free_kmem_pages(unsigned long addr, unsigned int order);
377 378
378#define __free_page(page) __free_pages((page), 0) 379#define __free_page(page) __free_pages((page), 0)
379#define free_page(addr) free_pages((addr), 0) 380#define free_page(addr) free_pages((addr), 0)
diff --git a/include/linux/goldfish.h b/include/linux/goldfish.h
new file mode 100644
index 000000000000..569236e6b2bc
--- /dev/null
+++ b/include/linux/goldfish.h
@@ -0,0 +1,15 @@
1#ifndef __LINUX_GOLDFISH_H
2#define __LINUX_GOLDFISH_H
3
4/* Helpers for Goldfish virtual platform */
5
6static inline void gf_write64(unsigned long data,
7 void __iomem *portl, void __iomem *porth)
8{
9 writel((u32)data, portl);
10#ifdef CONFIG_64BIT
11 writel(data>>32, porth);
12#endif
13}
14
15#endif /* __LINUX_GOLDFISH_H */
diff --git a/include/linux/gpio/consumer.h b/include/linux/gpio/consumer.h
index bed128e8f4b1..05e53ccb708b 100644
--- a/include/linux/gpio/consumer.h
+++ b/include/linux/gpio/consumer.h
@@ -1,6 +1,7 @@
1#ifndef __LINUX_GPIO_CONSUMER_H 1#ifndef __LINUX_GPIO_CONSUMER_H
2#define __LINUX_GPIO_CONSUMER_H 2#define __LINUX_GPIO_CONSUMER_H
3 3
4#include <linux/bug.h>
4#include <linux/err.h> 5#include <linux/err.h>
5#include <linux/kernel.h> 6#include <linux/kernel.h>
6 7
@@ -23,6 +24,12 @@ struct gpio_desc *__must_check gpiod_get(struct device *dev,
23struct gpio_desc *__must_check gpiod_get_index(struct device *dev, 24struct gpio_desc *__must_check gpiod_get_index(struct device *dev,
24 const char *con_id, 25 const char *con_id,
25 unsigned int idx); 26 unsigned int idx);
27struct gpio_desc *__must_check gpiod_get_optional(struct device *dev,
28 const char *con_id);
29struct gpio_desc *__must_check gpiod_get_index_optional(struct device *dev,
30 const char *con_id,
31 unsigned int index);
32
26void gpiod_put(struct gpio_desc *desc); 33void gpiod_put(struct gpio_desc *desc);
27 34
28struct gpio_desc *__must_check devm_gpiod_get(struct device *dev, 35struct gpio_desc *__must_check devm_gpiod_get(struct device *dev,
@@ -30,6 +37,12 @@ struct gpio_desc *__must_check devm_gpiod_get(struct device *dev,
30struct gpio_desc *__must_check devm_gpiod_get_index(struct device *dev, 37struct gpio_desc *__must_check devm_gpiod_get_index(struct device *dev,
31 const char *con_id, 38 const char *con_id,
32 unsigned int idx); 39 unsigned int idx);
40struct gpio_desc *__must_check devm_gpiod_get_optional(struct device *dev,
41 const char *con_id);
42struct gpio_desc *__must_check
43devm_gpiod_get_index_optional(struct device *dev, const char *con_id,
44 unsigned int index);
45
33void devm_gpiod_put(struct device *dev, struct gpio_desc *desc); 46void devm_gpiod_put(struct device *dev, struct gpio_desc *desc);
34 47
35int gpiod_get_direction(const struct gpio_desc *desc); 48int gpiod_get_direction(const struct gpio_desc *desc);
@@ -73,6 +86,20 @@ static inline struct gpio_desc *__must_check gpiod_get_index(struct device *dev,
73{ 86{
74 return ERR_PTR(-ENOSYS); 87 return ERR_PTR(-ENOSYS);
75} 88}
89
90static inline struct gpio_desc *__must_check
91gpiod_get_optional(struct device *dev, const char *con_id)
92{
93 return ERR_PTR(-ENOSYS);
94}
95
96static inline struct gpio_desc *__must_check
97gpiod_get_index_optional(struct device *dev, const char *con_id,
98 unsigned int index)
99{
100 return ERR_PTR(-ENOSYS);
101}
102
76static inline void gpiod_put(struct gpio_desc *desc) 103static inline void gpiod_put(struct gpio_desc *desc)
77{ 104{
78 might_sleep(); 105 might_sleep();
@@ -93,6 +120,20 @@ struct gpio_desc *__must_check devm_gpiod_get_index(struct device *dev,
93{ 120{
94 return ERR_PTR(-ENOSYS); 121 return ERR_PTR(-ENOSYS);
95} 122}
123
124static inline struct gpio_desc *__must_check
125devm_gpiod_get_optional(struct device *dev, const char *con_id)
126{
127 return ERR_PTR(-ENOSYS);
128}
129
130static inline struct gpio_desc *__must_check
131devm_gpiod_get_index_optional(struct device *dev, const char *con_id,
132 unsigned int index)
133{
134 return ERR_PTR(-ENOSYS);
135}
136
96static inline void devm_gpiod_put(struct device *dev, struct gpio_desc *desc) 137static inline void devm_gpiod_put(struct device *dev, struct gpio_desc *desc)
97{ 138{
98 might_sleep(); 139 might_sleep();
diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h
index 1827b43966d9..573e4f3243d0 100644
--- a/include/linux/gpio/driver.h
+++ b/include/linux/gpio/driver.h
@@ -51,7 +51,10 @@ struct seq_file;
51 * format specifier for an unsigned int. It is substituted by the actual 51 * format specifier for an unsigned int. It is substituted by the actual
52 * number of the gpio. 52 * number of the gpio.
53 * @can_sleep: flag must be set iff get()/set() methods sleep, as they 53 * @can_sleep: flag must be set iff get()/set() methods sleep, as they
54 * must while accessing GPIO expander chips over I2C or SPI 54 * must while accessing GPIO expander chips over I2C or SPI. This
55 * implies that if the chip supports IRQs, these IRQs need to be threaded
56 * as the chip access may sleep when e.g. reading out the IRQ status
57 * registers.
55 * @exported: flags if the gpiochip is exported for use from sysfs. Private. 58 * @exported: flags if the gpiochip is exported for use from sysfs. Private.
56 * 59 *
57 * A gpio_chip can help platforms abstract various sources of GPIOs so 60 * A gpio_chip can help platforms abstract various sources of GPIOs so
diff --git a/include/linux/gpio_keys.h b/include/linux/gpio_keys.h
index a7e977ff4abf..8b622468952c 100644
--- a/include/linux/gpio_keys.h
+++ b/include/linux/gpio_keys.h
@@ -3,29 +3,53 @@
3 3
4struct device; 4struct device;
5 5
6/**
7 * struct gpio_keys_button - configuration parameters
8 * @code: input event code (KEY_*, SW_*)
9 * @gpio: %-1 if this key does not support gpio
10 * @active_low: %true indicates that button is considered
11 * depressed when gpio is low
12 * @desc: label that will be attached to button's gpio
13 * @type: input event type (%EV_KEY, %EV_SW, %EV_ABS)
14 * @wakeup: configure the button as a wake-up source
15 * @debounce_interval: debounce ticks interval in msecs
16 * @can_disable: %true indicates that userspace is allowed to
17 * disable button via sysfs
18 * @value: axis value for %EV_ABS
19 * @irq: Irq number in case of interrupt keys
20 */
6struct gpio_keys_button { 21struct gpio_keys_button {
7 /* Configuration parameters */ 22 unsigned int code;
8 unsigned int code; /* input event code (KEY_*, SW_*) */ 23 int gpio;
9 int gpio; /* -1 if this key does not support gpio */
10 int active_low; 24 int active_low;
11 const char *desc; 25 const char *desc;
12 unsigned int type; /* input event type (EV_KEY, EV_SW, EV_ABS) */ 26 unsigned int type;
13 int wakeup; /* configure the button as a wake-up source */ 27 int wakeup;
14 int debounce_interval; /* debounce ticks interval in msecs */ 28 int debounce_interval;
15 bool can_disable; 29 bool can_disable;
16 int value; /* axis value for EV_ABS */ 30 int value;
17 unsigned int irq; /* Irq number in case of interrupt keys */ 31 unsigned int irq;
18}; 32};
19 33
34/**
35 * struct gpio_keys_platform_data - platform data for gpio_keys driver
36 * @buttons: pointer to array of &gpio_keys_button structures
37 * describing buttons attached to the device
38 * @nbuttons: number of elements in @buttons array
39 * @poll_interval: polling interval in msecs - for polling driver only
40 * @rep: enable input subsystem auto repeat
41 * @enable: platform hook for enabling the device
42 * @disable: platform hook for disabling the device
43 * @name: input device name
44 */
20struct gpio_keys_platform_data { 45struct gpio_keys_platform_data {
21 struct gpio_keys_button *buttons; 46 struct gpio_keys_button *buttons;
22 int nbuttons; 47 int nbuttons;
23 unsigned int poll_interval; /* polling interval in msecs - 48 unsigned int poll_interval;
24 for polling driver only */ 49 unsigned int rep:1;
25 unsigned int rep:1; /* enable input subsystem auto repeat */
26 int (*enable)(struct device *dev); 50 int (*enable)(struct device *dev);
27 void (*disable)(struct device *dev); 51 void (*disable)(struct device *dev);
28 const char *name; /* input device name */ 52 const char *name;
29}; 53};
30 54
31#endif 55#endif
diff --git a/include/linux/hid-sensor-hub.h b/include/linux/hid-sensor-hub.h
index b70cfd7ff29c..51f7ccadf923 100644
--- a/include/linux/hid-sensor-hub.h
+++ b/include/linux/hid-sensor-hub.h
@@ -189,7 +189,7 @@ struct hid_sensor_common {
189 struct hid_sensor_hub_device *hsdev; 189 struct hid_sensor_hub_device *hsdev;
190 struct platform_device *pdev; 190 struct platform_device *pdev;
191 unsigned usage_id; 191 unsigned usage_id;
192 bool data_ready; 192 atomic_t data_ready;
193 struct iio_trigger *trigger; 193 struct iio_trigger *trigger;
194 struct hid_sensor_hub_attribute_info poll; 194 struct hid_sensor_hub_attribute_info poll;
195 struct hid_sensor_hub_attribute_info report_state; 195 struct hid_sensor_hub_attribute_info report_state;
@@ -223,4 +223,10 @@ int hid_sensor_read_samp_freq_value(struct hid_sensor_common *st,
223int hid_sensor_get_usage_index(struct hid_sensor_hub_device *hsdev, 223int hid_sensor_get_usage_index(struct hid_sensor_hub_device *hsdev,
224 u32 report_id, int field_index, u32 usage_id); 224 u32 report_id, int field_index, u32 usage_id);
225 225
226int hid_sensor_format_scale(u32 usage_id,
227 struct hid_sensor_hub_attribute_info *attr_info,
228 int *val0, int *val1);
229
230s32 hid_sensor_read_poll_value(struct hid_sensor_common *st);
231
226#endif 232#endif
diff --git a/include/linux/hid-sensor-ids.h b/include/linux/hid-sensor-ids.h
index 14ead9e8eda8..109f0e633e01 100644
--- a/include/linux/hid-sensor-ids.h
+++ b/include/linux/hid-sensor-ids.h
@@ -76,6 +76,7 @@
76#define HID_USAGE_SENSOR_ORIENT_TILT_Y 0x200480 76#define HID_USAGE_SENSOR_ORIENT_TILT_Y 0x200480
77#define HID_USAGE_SENSOR_ORIENT_TILT_Z 0x200481 77#define HID_USAGE_SENSOR_ORIENT_TILT_Z 0x200481
78 78
79#define HID_USAGE_SENSOR_DEVICE_ORIENTATION 0x20008A
79#define HID_USAGE_SENSOR_ORIENT_ROTATION_MATRIX 0x200482 80#define HID_USAGE_SENSOR_ORIENT_ROTATION_MATRIX 0x200482
80#define HID_USAGE_SENSOR_ORIENT_QUATERNION 0x200483 81#define HID_USAGE_SENSOR_ORIENT_QUATERNION 0x200483
81#define HID_USAGE_SENSOR_ORIENT_MAGN_FLUX 0x200484 82#define HID_USAGE_SENSOR_ORIENT_MAGN_FLUX 0x200484
diff --git a/include/linux/hid.h b/include/linux/hid.h
index 720e3a10608c..77632cf159c0 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -233,11 +233,6 @@ struct hid_item {
233#define HID_DG_BARRELSWITCH 0x000d0044 233#define HID_DG_BARRELSWITCH 0x000d0044
234#define HID_DG_ERASER 0x000d0045 234#define HID_DG_ERASER 0x000d0045
235#define HID_DG_TABLETPICK 0x000d0046 235#define HID_DG_TABLETPICK 0x000d0046
236/*
237 * as of May 20, 2009 the usages below are not yet in the official USB spec
238 * but are being pushed by Microsft as described in their paper "Digitizer
239 * Drivers for Windows Touch and Pen-Based Computers"
240 */
241#define HID_DG_CONFIDENCE 0x000d0047 236#define HID_DG_CONFIDENCE 0x000d0047
242#define HID_DG_WIDTH 0x000d0048 237#define HID_DG_WIDTH 0x000d0048
243#define HID_DG_HEIGHT 0x000d0049 238#define HID_DG_HEIGHT 0x000d0049
@@ -246,6 +241,8 @@ struct hid_item {
246#define HID_DG_DEVICEINDEX 0x000d0053 241#define HID_DG_DEVICEINDEX 0x000d0053
247#define HID_DG_CONTACTCOUNT 0x000d0054 242#define HID_DG_CONTACTCOUNT 0x000d0054
248#define HID_DG_CONTACTMAX 0x000d0055 243#define HID_DG_CONTACTMAX 0x000d0055
244#define HID_DG_BARRELSWITCH2 0x000d005a
245#define HID_DG_TOOLSERIALNUMBER 0x000d005b
249 246
250/* 247/*
251 * HID report types --- Ouch! HID spec says 1 2 3! 248 * HID report types --- Ouch! HID spec says 1 2 3!
@@ -299,6 +296,9 @@ struct hid_item {
299 296
300/* 297/*
301 * HID device groups 298 * HID device groups
299 *
300 * Note: HID_GROUP_ANY is declared in linux/mod_devicetable.h
301 * and has a value of 0x0000
302 */ 302 */
303#define HID_GROUP_GENERIC 0x0001 303#define HID_GROUP_GENERIC 0x0001
304#define HID_GROUP_MULTITOUCH 0x0002 304#define HID_GROUP_MULTITOUCH 0x0002
@@ -306,6 +306,11 @@ struct hid_item {
306#define HID_GROUP_MULTITOUCH_WIN_8 0x0004 306#define HID_GROUP_MULTITOUCH_WIN_8 0x0004
307 307
308/* 308/*
309 * Vendor specific HID device groups
310 */
311#define HID_GROUP_RMI 0x0100
312
313/*
309 * This is the global environment of the parser. This information is 314 * This is the global environment of the parser. This information is
310 * persistent for main-items. The global environment can be saved and 315 * persistent for main-items. The global environment can be saved and
311 * restored with PUSH/POP statements. 316 * restored with PUSH/POP statements.
@@ -570,6 +575,8 @@ struct hid_descriptor {
570 .bus = BUS_USB, .vendor = (ven), .product = (prod) 575 .bus = BUS_USB, .vendor = (ven), .product = (prod)
571#define HID_BLUETOOTH_DEVICE(ven, prod) \ 576#define HID_BLUETOOTH_DEVICE(ven, prod) \
572 .bus = BUS_BLUETOOTH, .vendor = (ven), .product = (prod) 577 .bus = BUS_BLUETOOTH, .vendor = (ven), .product = (prod)
578#define HID_I2C_DEVICE(ven, prod) \
579 .bus = BUS_I2C, .vendor = (ven), .product = (prod)
573 580
574#define HID_REPORT_ID(rep) \ 581#define HID_REPORT_ID(rep) \
575 .report_type = (rep) 582 .report_type = (rep)
diff --git a/include/linux/hsi/hsi.h b/include/linux/hsi/hsi.h
index 39bfd5b89077..3ec06300d535 100644
--- a/include/linux/hsi/hsi.h
+++ b/include/linux/hsi/hsi.h
@@ -68,17 +68,31 @@ enum {
68}; 68};
69 69
70/** 70/**
71 * struct hsi_channel - channel resource used by the hsi clients
72 * @id: Channel number
73 * @name: Channel name
74 */
75struct hsi_channel {
76 unsigned int id;
77 const char *name;
78};
79
80/**
71 * struct hsi_config - Configuration for RX/TX HSI modules 81 * struct hsi_config - Configuration for RX/TX HSI modules
72 * @mode: Bit transmission mode (STREAM or FRAME) 82 * @mode: Bit transmission mode (STREAM or FRAME)
73 * @channels: Number of channels to use [1..16] 83 * @channels: Channel resources used by the client
84 * @num_channels: Number of channel resources
85 * @num_hw_channels: Number of channels the transceiver is configured for [1..16]
74 * @speed: Max bit transmission speed (Kbit/s) 86 * @speed: Max bit transmission speed (Kbit/s)
75 * @flow: RX flow type (SYNCHRONIZED or PIPELINE) 87 * @flow: RX flow type (SYNCHRONIZED or PIPELINE)
76 * @arb_mode: Arbitration mode for TX frame (Round robin, priority) 88 * @arb_mode: Arbitration mode for TX frame (Round robin, priority)
77 */ 89 */
78struct hsi_config { 90struct hsi_config {
79 unsigned int mode; 91 unsigned int mode;
80 unsigned int channels; 92 struct hsi_channel *channels;
81 unsigned int speed; 93 unsigned int num_channels;
94 unsigned int num_hw_channels;
95 unsigned int speed;
82 union { 96 union {
83 unsigned int flow; /* RX only */ 97 unsigned int flow; /* RX only */
84 unsigned int arb_mode; /* TX only */ 98 unsigned int arb_mode; /* TX only */
@@ -282,6 +296,21 @@ struct hsi_controller *hsi_alloc_controller(unsigned int n_ports, gfp_t flags);
282void hsi_put_controller(struct hsi_controller *hsi); 296void hsi_put_controller(struct hsi_controller *hsi);
283int hsi_register_controller(struct hsi_controller *hsi); 297int hsi_register_controller(struct hsi_controller *hsi);
284void hsi_unregister_controller(struct hsi_controller *hsi); 298void hsi_unregister_controller(struct hsi_controller *hsi);
299struct hsi_client *hsi_new_client(struct hsi_port *port,
300 struct hsi_board_info *info);
301int hsi_remove_client(struct device *dev, void *data);
302void hsi_port_unregister_clients(struct hsi_port *port);
303
304#ifdef CONFIG_OF
305void hsi_add_clients_from_dt(struct hsi_port *port,
306 struct device_node *clients);
307#else
308static inline void hsi_add_clients_from_dt(struct hsi_port *port,
309 struct device_node *clients)
310{
311 return;
312}
313#endif
285 314
286static inline void hsi_controller_set_drvdata(struct hsi_controller *hsi, 315static inline void hsi_controller_set_drvdata(struct hsi_controller *hsi,
287 void *data) 316 void *data)
@@ -305,6 +334,8 @@ static inline struct hsi_port *hsi_find_port_num(struct hsi_controller *hsi,
305 */ 334 */
306int hsi_async(struct hsi_client *cl, struct hsi_msg *msg); 335int hsi_async(struct hsi_client *cl, struct hsi_msg *msg);
307 336
337int hsi_get_channel_id_by_name(struct hsi_client *cl, char *name);
338
308/** 339/**
309 * hsi_id - Get HSI controller ID associated to a client 340 * hsi_id - Get HSI controller ID associated to a client
310 * @cl: Pointer to a HSI client 341 * @cl: Pointer to a HSI client
diff --git a/include/linux/hsi/ssi_protocol.h b/include/linux/hsi/ssi_protocol.h
new file mode 100644
index 000000000000..1433651be0dc
--- /dev/null
+++ b/include/linux/hsi/ssi_protocol.h
@@ -0,0 +1,42 @@
1/*
2 * ssip_slave.h
3 *
4 * SSIP slave support header file
5 *
6 * Copyright (C) 2010 Nokia Corporation. All rights reserved.
7 *
8 * Contact: Carlos Chinea <carlos.chinea@nokia.com>
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * version 2 as published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
22 * 02110-1301 USA
23 */
24
25#ifndef __LINUX_SSIP_SLAVE_H__
26#define __LINUX_SSIP_SLAVE_H__
27
28#include <linux/hsi/hsi.h>
29
30static inline void ssip_slave_put_master(struct hsi_client *master)
31{
32}
33
34struct hsi_client *ssip_slave_get_master(struct hsi_client *slave);
35int ssip_slave_start_tx(struct hsi_client *master);
36int ssip_slave_stop_tx(struct hsi_client *master);
37void ssip_reset_event(struct hsi_client *master);
38
39int ssip_slave_running(struct hsi_client *master);
40
41#endif /* __LINUX_SSIP_SLAVE_H__ */
42
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index b65166de1d9d..255cd5cc0754 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -343,6 +343,11 @@ static inline unsigned huge_page_shift(struct hstate *h)
343 return h->order + PAGE_SHIFT; 343 return h->order + PAGE_SHIFT;
344} 344}
345 345
346static inline bool hstate_is_gigantic(struct hstate *h)
347{
348 return huge_page_order(h) >= MAX_ORDER;
349}
350
346static inline unsigned int pages_per_huge_page(struct hstate *h) 351static inline unsigned int pages_per_huge_page(struct hstate *h)
347{ 352{
348 return 1 << h->order; 353 return 1 << h->order;
@@ -392,15 +397,13 @@ static inline pgoff_t basepage_index(struct page *page)
392 397
393extern void dissolve_free_huge_pages(unsigned long start_pfn, 398extern void dissolve_free_huge_pages(unsigned long start_pfn,
394 unsigned long end_pfn); 399 unsigned long end_pfn);
395int pmd_huge_support(void); 400static inline int hugepage_migration_supported(struct hstate *h)
396/*
397 * Currently hugepage migration is enabled only for pmd-based hugepage.
398 * This function will be updated when hugepage migration is more widely
399 * supported.
400 */
401static inline int hugepage_migration_support(struct hstate *h)
402{ 401{
403 return pmd_huge_support() && (huge_page_shift(h) == PMD_SHIFT); 402#ifdef CONFIG_ARCH_ENABLE_HUGEPAGE_MIGRATION
403 return huge_page_shift(h) == PMD_SHIFT;
404#else
405 return 0;
406#endif
404} 407}
405 408
406static inline spinlock_t *huge_pte_lockptr(struct hstate *h, 409static inline spinlock_t *huge_pte_lockptr(struct hstate *h,
@@ -450,8 +453,7 @@ static inline pgoff_t basepage_index(struct page *page)
450 return page->index; 453 return page->index;
451} 454}
452#define dissolve_free_huge_pages(s, e) do {} while (0) 455#define dissolve_free_huge_pages(s, e) do {} while (0)
453#define pmd_huge_support() 0 456#define hugepage_migration_supported(h) 0
454#define hugepage_migration_support(h) 0
455 457
456static inline spinlock_t *huge_pte_lockptr(struct hstate *h, 458static inline spinlock_t *huge_pte_lockptr(struct hstate *h,
457 struct mm_struct *mm, pte_t *pte) 459 struct mm_struct *mm, pte_t *pte)
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index 2d7b4f139c32..08cfaff8a072 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -696,6 +696,8 @@ struct vmbus_channel {
696 * preserve the earlier behavior. 696 * preserve the earlier behavior.
697 */ 697 */
698 u32 target_vp; 698 u32 target_vp;
699 /* The corresponding CPUID in the guest */
700 u32 target_cpu;
699 /* 701 /*
700 * Support for sub-channels. For high performance devices, 702 * Support for sub-channels. For high performance devices,
701 * it will be useful to have multiple sub-channels to support 703 * it will be useful to have multiple sub-channels to support
@@ -732,6 +734,11 @@ struct vmbus_channel {
732 * Support per-channel state for use by vmbus drivers. 734 * Support per-channel state for use by vmbus drivers.
733 */ 735 */
734 void *per_channel_state; 736 void *per_channel_state;
737 /*
738 * To support per-cpu lookup mapping of relid to channel,
739 * link up channels based on their CPU affinity.
740 */
741 struct list_head percpu_list;
735}; 742};
736 743
737static inline void set_channel_read_state(struct vmbus_channel *c, bool state) 744static inline void set_channel_read_state(struct vmbus_channel *c, bool state)
diff --git a/include/linux/i2c/atmel_mxt_ts.h b/include/linux/i2c/atmel_mxt_ts.h
index 99e379b74398..3891dc1de21c 100644
--- a/include/linux/i2c/atmel_mxt_ts.h
+++ b/include/linux/i2c/atmel_mxt_ts.h
@@ -15,35 +15,14 @@
15 15
16#include <linux/types.h> 16#include <linux/types.h>
17 17
18/* For key_map array */
19#define MXT_NUM_GPIO 4
20
21/* Orient */
22#define MXT_NORMAL 0x0
23#define MXT_DIAGONAL 0x1
24#define MXT_HORIZONTAL_FLIP 0x2
25#define MXT_ROTATED_90_COUNTER 0x3
26#define MXT_VERTICAL_FLIP 0x4
27#define MXT_ROTATED_90 0x5
28#define MXT_ROTATED_180 0x6
29#define MXT_DIAGONAL_COUNTER 0x7
30
31/* The platform data for the Atmel maXTouch touchscreen driver */ 18/* The platform data for the Atmel maXTouch touchscreen driver */
32struct mxt_platform_data { 19struct mxt_platform_data {
33 const u8 *config; 20 const u8 *config;
34 size_t config_length; 21 size_t config_length;
35 22 u32 config_crc;
36 unsigned int x_line;
37 unsigned int y_line;
38 unsigned int x_size;
39 unsigned int y_size;
40 unsigned int blen;
41 unsigned int threshold;
42 unsigned int voltage;
43 unsigned char orient;
44 unsigned long irqflags; 23 unsigned long irqflags;
45 bool is_tp; 24 u8 t19_num_keys;
46 const unsigned int key_map[MXT_NUM_GPIO]; 25 const unsigned int *t19_keymap;
47}; 26};
48 27
49#endif /* __LINUX_ATMEL_MXT_TS_H */ 28#endif /* __LINUX_ATMEL_MXT_TS_H */
diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h
index d2b16704624c..8cfb50f38529 100644
--- a/include/linux/i2c/twl.h
+++ b/include/linux/i2c/twl.h
@@ -498,7 +498,10 @@ static inline int twl6030_mmc_card_detect(struct device *dev, int slot)
498#define RES_GRP_ALL 0x7 /* All resource groups */ 498#define RES_GRP_ALL 0x7 /* All resource groups */
499 499
500#define RES_TYPE2_R0 0x0 500#define RES_TYPE2_R0 0x0
501#define RES_TYPE2_R1 0x1
502#define RES_TYPE2_R2 0x2
501 503
504#define RES_TYPE_R0 0x0
502#define RES_TYPE_ALL 0x7 505#define RES_TYPE_ALL 0x7
503 506
504/* Resource states */ 507/* Resource states */
@@ -671,6 +674,7 @@ struct twl4030_power_data {
671 struct twl4030_script **scripts; 674 struct twl4030_script **scripts;
672 unsigned num; 675 unsigned num;
673 struct twl4030_resconfig *resource_config; 676 struct twl4030_resconfig *resource_config;
677 struct twl4030_resconfig *board_config;
674#define TWL4030_RESCONFIG_UNDEF ((u8)-1) 678#define TWL4030_RESCONFIG_UNDEF ((u8)-1)
675 bool use_poweroff; /* Board is wired for TWL poweroff */ 679 bool use_poweroff; /* Board is wired for TWL poweroff */
676}; 680};
diff --git a/include/linux/idr.h b/include/linux/idr.h
index 6af3400b9b2f..013fd9bc4cb6 100644
--- a/include/linux/idr.h
+++ b/include/linux/idr.h
@@ -29,21 +29,24 @@
29 29
30struct idr_layer { 30struct idr_layer {
31 int prefix; /* the ID prefix of this idr_layer */ 31 int prefix; /* the ID prefix of this idr_layer */
32 DECLARE_BITMAP(bitmap, IDR_SIZE); /* A zero bit means "space here" */ 32 int layer; /* distance from leaf */
33 struct idr_layer __rcu *ary[1<<IDR_BITS]; 33 struct idr_layer __rcu *ary[1<<IDR_BITS];
34 int count; /* When zero, we can release it */ 34 int count; /* When zero, we can release it */
35 int layer; /* distance from leaf */ 35 union {
36 struct rcu_head rcu_head; 36 /* A zero bit means "space here" */
37 DECLARE_BITMAP(bitmap, IDR_SIZE);
38 struct rcu_head rcu_head;
39 };
37}; 40};
38 41
39struct idr { 42struct idr {
40 struct idr_layer __rcu *hint; /* the last layer allocated from */ 43 struct idr_layer __rcu *hint; /* the last layer allocated from */
41 struct idr_layer __rcu *top; 44 struct idr_layer __rcu *top;
42 struct idr_layer *id_free;
43 int layers; /* only valid w/o concurrent changes */ 45 int layers; /* only valid w/o concurrent changes */
44 int id_free_cnt;
45 int cur; /* current pos for cyclic allocation */ 46 int cur; /* current pos for cyclic allocation */
46 spinlock_t lock; 47 spinlock_t lock;
48 int id_free_cnt;
49 struct idr_layer *id_free;
47}; 50};
48 51
49#define IDR_INIT(name) \ 52#define IDR_INIT(name) \
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index f194ccb8539c..6bff13f74050 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -1711,6 +1711,7 @@ enum ieee80211_eid {
1711 WLAN_EID_RRM_ENABLED_CAPABILITIES = 70, 1711 WLAN_EID_RRM_ENABLED_CAPABILITIES = 70,
1712 WLAN_EID_MULTIPLE_BSSID = 71, 1712 WLAN_EID_MULTIPLE_BSSID = 71,
1713 WLAN_EID_BSS_COEX_2040 = 72, 1713 WLAN_EID_BSS_COEX_2040 = 72,
1714 WLAN_EID_BSS_INTOLERANT_CHL_REPORT = 73,
1714 WLAN_EID_OVERLAP_BSS_SCAN_PARAM = 74, 1715 WLAN_EID_OVERLAP_BSS_SCAN_PARAM = 74,
1715 WLAN_EID_RIC_DESCRIPTOR = 75, 1716 WLAN_EID_RIC_DESCRIPTOR = 75,
1716 WLAN_EID_MMIE = 76, 1717 WLAN_EID_MMIE = 76,
diff --git a/include/linux/if_bridge.h b/include/linux/if_bridge.h
index 1085ffeef956..fd22789d7b2e 100644
--- a/include/linux/if_bridge.h
+++ b/include/linux/if_bridge.h
@@ -16,9 +16,28 @@
16#include <linux/netdevice.h> 16#include <linux/netdevice.h>
17#include <uapi/linux/if_bridge.h> 17#include <uapi/linux/if_bridge.h>
18 18
19struct br_ip {
20 union {
21 __be32 ip4;
22#if IS_ENABLED(CONFIG_IPV6)
23 struct in6_addr ip6;
24#endif
25 } u;
26 __be16 proto;
27 __u16 vid;
28};
29
30struct br_ip_list {
31 struct list_head list;
32 struct br_ip addr;
33};
34
19extern void brioctl_set(int (*ioctl_hook)(struct net *, unsigned int, void __user *)); 35extern void brioctl_set(int (*ioctl_hook)(struct net *, unsigned int, void __user *));
20 36
21typedef int br_should_route_hook_t(struct sk_buff *skb); 37typedef int br_should_route_hook_t(struct sk_buff *skb);
22extern br_should_route_hook_t __rcu *br_should_route_hook; 38extern br_should_route_hook_t __rcu *br_should_route_hook;
39int br_multicast_list_adjacent(struct net_device *dev,
40 struct list_head *br_ip_list);
41bool br_multicast_has_querier_adjacent(struct net_device *dev, int proto);
23 42
24#endif 43#endif
diff --git a/include/linux/if_link.h b/include/linux/if_link.h
index a86784dec3d3..119130e9298b 100644
--- a/include/linux/if_link.h
+++ b/include/linux/if_link.h
@@ -10,8 +10,9 @@ struct ifla_vf_info {
10 __u8 mac[32]; 10 __u8 mac[32];
11 __u32 vlan; 11 __u32 vlan;
12 __u32 qos; 12 __u32 qos;
13 __u32 tx_rate;
14 __u32 spoofchk; 13 __u32 spoofchk;
15 __u32 linkstate; 14 __u32 linkstate;
15 __u32 min_tx_rate;
16 __u32 max_tx_rate;
16}; 17};
17#endif /* _LINUX_IF_LINK_H */ 18#endif /* _LINUX_IF_LINK_H */
diff --git a/include/linux/if_macvlan.h b/include/linux/if_macvlan.h
index 7c8b20b120ea..6b2c7cf352a5 100644
--- a/include/linux/if_macvlan.h
+++ b/include/linux/if_macvlan.h
@@ -56,6 +56,10 @@ struct macvlan_dev {
56 int numqueues; 56 int numqueues;
57 netdev_features_t tap_features; 57 netdev_features_t tap_features;
58 int minor; 58 int minor;
59 int nest_level;
60#ifdef CONFIG_NET_POLL_CONTROLLER
61 struct netpoll *netpoll;
62#endif
59}; 63};
60 64
61static inline void macvlan_count_rx(const struct macvlan_dev *vlan, 65static inline void macvlan_count_rx(const struct macvlan_dev *vlan,
diff --git a/include/linux/if_team.h b/include/linux/if_team.h
index a899dc24be15..a6aa970758a2 100644
--- a/include/linux/if_team.h
+++ b/include/linux/if_team.h
@@ -194,6 +194,7 @@ struct team {
194 bool user_carrier_enabled; 194 bool user_carrier_enabled;
195 bool queue_override_enabled; 195 bool queue_override_enabled;
196 struct list_head *qom_lists; /* array of queue override mapping lists */ 196 struct list_head *qom_lists; /* array of queue override mapping lists */
197 bool port_mtu_change_allowed;
197 struct { 198 struct {
198 unsigned int count; 199 unsigned int count;
199 unsigned int interval; /* in ms */ 200 unsigned int interval; /* in ms */
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index 13bbbde00e68..4967916fe4ac 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -73,7 +73,7 @@ static inline struct vlan_ethhdr *vlan_eth_hdr(const struct sk_buff *skb)
73/* found in socket.c */ 73/* found in socket.c */
74extern void vlan_ioctl_set(int (*hook)(struct net *, void __user *)); 74extern void vlan_ioctl_set(int (*hook)(struct net *, void __user *));
75 75
76static inline int is_vlan_dev(struct net_device *dev) 76static inline bool is_vlan_dev(struct net_device *dev)
77{ 77{
78 return dev->priv_flags & IFF_802_1Q_VLAN; 78 return dev->priv_flags & IFF_802_1Q_VLAN;
79} 79}
@@ -106,7 +106,7 @@ struct vlan_pcpu_stats {
106 106
107#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) 107#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
108 108
109extern struct net_device *__vlan_find_dev_deep(struct net_device *real_dev, 109extern struct net_device *__vlan_find_dev_deep_rcu(struct net_device *real_dev,
110 __be16 vlan_proto, u16 vlan_id); 110 __be16 vlan_proto, u16 vlan_id);
111extern struct net_device *vlan_dev_real_dev(const struct net_device *dev); 111extern struct net_device *vlan_dev_real_dev(const struct net_device *dev);
112extern u16 vlan_dev_vlan_id(const struct net_device *dev); 112extern u16 vlan_dev_vlan_id(const struct net_device *dev);
@@ -159,6 +159,7 @@ struct vlan_dev_priv {
159#ifdef CONFIG_NET_POLL_CONTROLLER 159#ifdef CONFIG_NET_POLL_CONTROLLER
160 struct netpoll *netpoll; 160 struct netpoll *netpoll;
161#endif 161#endif
162 unsigned int nest_level;
162}; 163};
163 164
164static inline struct vlan_dev_priv *vlan_dev_priv(const struct net_device *dev) 165static inline struct vlan_dev_priv *vlan_dev_priv(const struct net_device *dev)
@@ -197,9 +198,15 @@ extern void vlan_vids_del_by_dev(struct net_device *dev,
197 const struct net_device *by_dev); 198 const struct net_device *by_dev);
198 199
199extern bool vlan_uses_dev(const struct net_device *dev); 200extern bool vlan_uses_dev(const struct net_device *dev);
201
202static inline int vlan_get_encap_level(struct net_device *dev)
203{
204 BUG_ON(!is_vlan_dev(dev));
205 return vlan_dev_priv(dev)->nest_level;
206}
200#else 207#else
201static inline struct net_device * 208static inline struct net_device *
202__vlan_find_dev_deep(struct net_device *real_dev, 209__vlan_find_dev_deep_rcu(struct net_device *real_dev,
203 __be16 vlan_proto, u16 vlan_id) 210 __be16 vlan_proto, u16 vlan_id)
204{ 211{
205 return NULL; 212 return NULL;
@@ -263,6 +270,11 @@ static inline bool vlan_uses_dev(const struct net_device *dev)
263{ 270{
264 return false; 271 return false;
265} 272}
273static inline int vlan_get_encap_level(struct net_device *dev)
274{
275 BUG();
276 return 0;
277}
266#endif 278#endif
267 279
268static inline bool vlan_hw_offload_capable(netdev_features_t features, 280static inline bool vlan_hw_offload_capable(netdev_features_t features,
@@ -483,4 +495,5 @@ static inline void vlan_set_encap_proto(struct sk_buff *skb,
483 */ 495 */
484 skb->protocol = htons(ETH_P_802_2); 496 skb->protocol = htons(ETH_P_802_2);
485} 497}
498
486#endif /* !(_LINUX_IF_VLAN_H_) */ 499#endif /* !(_LINUX_IF_VLAN_H_) */
diff --git a/include/linux/iio/common/st_sensors.h b/include/linux/iio/common/st_sensors.h
index 3c005eb3a0a4..96f51f0e0096 100644
--- a/include/linux/iio/common/st_sensors.h
+++ b/include/linux/iio/common/st_sensors.h
@@ -269,6 +269,10 @@ int st_sensors_set_enable(struct iio_dev *indio_dev, bool enable);
269 269
270int st_sensors_set_axis_enable(struct iio_dev *indio_dev, u8 axis_enable); 270int st_sensors_set_axis_enable(struct iio_dev *indio_dev, u8 axis_enable);
271 271
272void st_sensors_power_enable(struct iio_dev *indio_dev);
273
274void st_sensors_power_disable(struct iio_dev *indio_dev);
275
272int st_sensors_set_odr(struct iio_dev *indio_dev, unsigned int odr); 276int st_sensors_set_odr(struct iio_dev *indio_dev, unsigned int odr);
273 277
274int st_sensors_set_dataready_irq(struct iio_dev *indio_dev, bool enable); 278int st_sensors_set_dataready_irq(struct iio_dev *indio_dev, bool enable);
diff --git a/include/linux/iio/consumer.h b/include/linux/iio/consumer.h
index 2752b1fd12be..651f9a0e2765 100644
--- a/include/linux/iio/consumer.h
+++ b/include/linux/iio/consumer.h
@@ -123,6 +123,19 @@ int iio_read_channel_raw(struct iio_channel *chan,
123 int *val); 123 int *val);
124 124
125/** 125/**
126 * iio_read_channel_average_raw() - read from a given channel
127 * @chan: The channel being queried.
128 * @val: Value read back.
129 *
130 * Note raw reads from iio channels are in adc counts and hence
131 * scale will need to be applied if standard units required.
132 *
133 * In opposit to the normal iio_read_channel_raw this function
134 * returns the average of multiple reads.
135 */
136int iio_read_channel_average_raw(struct iio_channel *chan, int *val);
137
138/**
126 * iio_read_channel_processed() - read processed value from a given channel 139 * iio_read_channel_processed() - read processed value from a given channel
127 * @chan: The channel being queried. 140 * @chan: The channel being queried.
128 * @val: Value read back. 141 * @val: Value read back.
diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h
index 5f2d00e7e488..ccde91725f98 100644
--- a/include/linux/iio/iio.h
+++ b/include/linux/iio/iio.h
@@ -177,6 +177,12 @@ struct iio_event_spec {
177 * shift: Shift right by this before masking out 177 * shift: Shift right by this before masking out
178 * realbits. 178 * realbits.
179 * endianness: little or big endian 179 * endianness: little or big endian
180 * repeat: Number of times real/storage bits
181 * repeats. When the repeat element is
182 * more than 1, then the type element in
183 * sysfs will show a repeat value.
184 * Otherwise, the number of repetitions is
185 * omitted.
180 * @info_mask_separate: What information is to be exported that is specific to 186 * @info_mask_separate: What information is to be exported that is specific to
181 * this channel. 187 * this channel.
182 * @info_mask_shared_by_type: What information is to be exported that is shared 188 * @info_mask_shared_by_type: What information is to be exported that is shared
@@ -219,6 +225,7 @@ struct iio_chan_spec {
219 u8 realbits; 225 u8 realbits;
220 u8 storagebits; 226 u8 storagebits;
221 u8 shift; 227 u8 shift;
228 u8 repeat;
222 enum iio_endian endianness; 229 enum iio_endian endianness;
223 } scan_type; 230 } scan_type;
224 long info_mask_separate; 231 long info_mask_separate;
@@ -288,6 +295,8 @@ static inline s64 iio_get_time_ns(void)
288#define INDIO_ALL_BUFFER_MODES \ 295#define INDIO_ALL_BUFFER_MODES \
289 (INDIO_BUFFER_TRIGGERED | INDIO_BUFFER_HARDWARE) 296 (INDIO_BUFFER_TRIGGERED | INDIO_BUFFER_HARDWARE)
290 297
298#define INDIO_MAX_RAW_ELEMENTS 4
299
291struct iio_trigger; /* forward declaration */ 300struct iio_trigger; /* forward declaration */
292struct iio_dev; 301struct iio_dev;
293 302
@@ -302,6 +311,14 @@ struct iio_dev;
302 * the channel in question. Return value will specify the 311 * the channel in question. Return value will specify the
303 * type of value returned by the device. val and val2 will 312 * type of value returned by the device. val and val2 will
304 * contain the elements making up the returned value. 313 * contain the elements making up the returned value.
314 * @read_raw_multi: function to return values from the device.
315 * mask specifies which value. Note 0 means a reading of
316 * the channel in question. Return value will specify the
317 * type of value returned by the device. vals pointer
318 * contain the elements making up the returned value.
319 * max_len specifies maximum number of elements
320 * vals pointer can contain. val_len is used to return
321 * length of valid elements in vals.
305 * @write_raw: function to write a value to the device. 322 * @write_raw: function to write a value to the device.
306 * Parameters are the same as for read_raw. 323 * Parameters are the same as for read_raw.
307 * @write_raw_get_fmt: callback function to query the expected 324 * @write_raw_get_fmt: callback function to query the expected
@@ -328,6 +345,13 @@ struct iio_info {
328 int *val2, 345 int *val2,
329 long mask); 346 long mask);
330 347
348 int (*read_raw_multi)(struct iio_dev *indio_dev,
349 struct iio_chan_spec const *chan,
350 int max_len,
351 int *vals,
352 int *val_len,
353 long mask);
354
331 int (*write_raw)(struct iio_dev *indio_dev, 355 int (*write_raw)(struct iio_dev *indio_dev,
332 struct iio_chan_spec const *chan, 356 struct iio_chan_spec const *chan,
333 int val, 357 int val,
diff --git a/include/linux/iio/types.h b/include/linux/iio/types.h
index 084d882fe01b..d480631eabc2 100644
--- a/include/linux/iio/types.h
+++ b/include/linux/iio/types.h
@@ -53,6 +53,9 @@ enum iio_modifier {
53 IIO_MOD_LIGHT_RED, 53 IIO_MOD_LIGHT_RED,
54 IIO_MOD_LIGHT_GREEN, 54 IIO_MOD_LIGHT_GREEN,
55 IIO_MOD_LIGHT_BLUE, 55 IIO_MOD_LIGHT_BLUE,
56 IIO_MOD_QUATERNION,
57 IIO_MOD_TEMP_AMBIENT,
58 IIO_MOD_TEMP_OBJECT,
56}; 59};
57 60
58enum iio_event_type { 61enum iio_event_type {
@@ -79,6 +82,7 @@ enum iio_event_direction {
79#define IIO_VAL_INT_PLUS_MICRO 2 82#define IIO_VAL_INT_PLUS_MICRO 2
80#define IIO_VAL_INT_PLUS_NANO 3 83#define IIO_VAL_INT_PLUS_NANO 3
81#define IIO_VAL_INT_PLUS_MICRO_DB 4 84#define IIO_VAL_INT_PLUS_MICRO_DB 4
85#define IIO_VAL_INT_MULTIPLE 5
82#define IIO_VAL_FRACTIONAL 10 86#define IIO_VAL_FRACTIONAL 10
83#define IIO_VAL_FRACTIONAL_LOG2 11 87#define IIO_VAL_FRACTIONAL_LOG2 11
84 88
diff --git a/include/linux/init.h b/include/linux/init.h
index a3ba27076342..2df8e8dd10a4 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -297,16 +297,28 @@ void __init parse_early_options(char *cmdline);
297 297
298#else /* MODULE */ 298#else /* MODULE */
299 299
300/* Don't use these in loadable modules, but some people do... */ 300/*
301 * In most cases loadable modules do not need custom
302 * initcall levels. There are still some valid cases where
303 * a driver may be needed early if built in, and does not
304 * matter when built as a loadable module. Like bus
305 * snooping debug drivers.
306 */
301#define early_initcall(fn) module_init(fn) 307#define early_initcall(fn) module_init(fn)
302#define core_initcall(fn) module_init(fn) 308#define core_initcall(fn) module_init(fn)
309#define core_initcall_sync(fn) module_init(fn)
303#define postcore_initcall(fn) module_init(fn) 310#define postcore_initcall(fn) module_init(fn)
311#define postcore_initcall_sync(fn) module_init(fn)
304#define arch_initcall(fn) module_init(fn) 312#define arch_initcall(fn) module_init(fn)
305#define subsys_initcall(fn) module_init(fn) 313#define subsys_initcall(fn) module_init(fn)
314#define subsys_initcall_sync(fn) module_init(fn)
306#define fs_initcall(fn) module_init(fn) 315#define fs_initcall(fn) module_init(fn)
316#define fs_initcall_sync(fn) module_init(fn)
307#define rootfs_initcall(fn) module_init(fn) 317#define rootfs_initcall(fn) module_init(fn)
308#define device_initcall(fn) module_init(fn) 318#define device_initcall(fn) module_init(fn)
319#define device_initcall_sync(fn) module_init(fn)
309#define late_initcall(fn) module_init(fn) 320#define late_initcall(fn) module_init(fn)
321#define late_initcall_sync(fn) module_init(fn)
310 322
311#define console_initcall(fn) module_init(fn) 323#define console_initcall(fn) module_init(fn)
312#define security_initcall(fn) module_init(fn) 324#define security_initcall(fn) module_init(fn)
diff --git a/include/linux/input-polldev.h b/include/linux/input-polldev.h
index ce0b72464eb8..2465182670db 100644
--- a/include/linux/input-polldev.h
+++ b/include/linux/input-polldev.h
@@ -48,9 +48,12 @@ struct input_polled_dev {
48 48
49/* private: */ 49/* private: */
50 struct delayed_work work; 50 struct delayed_work work;
51
52 bool devres_managed;
51}; 53};
52 54
53struct input_polled_dev *input_allocate_polled_device(void); 55struct input_polled_dev *input_allocate_polled_device(void);
56struct input_polled_dev *devm_input_allocate_polled_device(struct device *dev);
54void input_free_polled_device(struct input_polled_dev *dev); 57void input_free_polled_device(struct input_polled_dev *dev);
55int input_register_polled_device(struct input_polled_dev *dev); 58int input_register_polled_device(struct input_polled_dev *dev);
56void input_unregister_polled_device(struct input_polled_dev *dev); 59void input_unregister_polled_device(struct input_polled_dev *dev);
diff --git a/include/linux/input/pixcir_ts.h b/include/linux/input/pixcir_ts.h
index 7163d91c0373..160cf353aa39 100644
--- a/include/linux/input/pixcir_ts.h
+++ b/include/linux/input/pixcir_ts.h
@@ -1,10 +1,52 @@
1#ifndef _PIXCIR_I2C_TS_H 1#ifndef _PIXCIR_I2C_TS_H
2#define _PIXCIR_I2C_TS_H 2#define _PIXCIR_I2C_TS_H
3 3
4/*
5 * Register map
6 */
7#define PIXCIR_REG_POWER_MODE 51
8#define PIXCIR_REG_INT_MODE 52
9
10/*
11 * Power modes:
12 * active: max scan speed
13 * idle: lower scan speed with automatic transition to active on touch
14 * halt: datasheet says sleep but this is more like halt as the chip
15 * clocks are cut and it can only be brought out of this mode
16 * using the RESET pin.
17 */
18enum pixcir_power_mode {
19 PIXCIR_POWER_ACTIVE,
20 PIXCIR_POWER_IDLE,
21 PIXCIR_POWER_HALT,
22};
23
24#define PIXCIR_POWER_MODE_MASK 0x03
25#define PIXCIR_POWER_ALLOW_IDLE (1UL << 2)
26
27/*
28 * Interrupt modes:
29 * periodical: interrupt is asserted periodicaly
30 * diff coordinates: interrupt is asserted when coordinates change
31 * level on touch: interrupt level asserted during touch
32 * pulse on touch: interrupt pulse asserted druing touch
33 *
34 */
35enum pixcir_int_mode {
36 PIXCIR_INT_PERIODICAL,
37 PIXCIR_INT_DIFF_COORD,
38 PIXCIR_INT_LEVEL_TOUCH,
39 PIXCIR_INT_PULSE_TOUCH,
40};
41
42#define PIXCIR_INT_MODE_MASK 0x03
43#define PIXCIR_INT_ENABLE (1UL << 3)
44#define PIXCIR_INT_POL_HIGH (1UL << 2)
45
4struct pixcir_ts_platform_data { 46struct pixcir_ts_platform_data {
5 int (*attb_read_val)(void);
6 int x_max; 47 int x_max;
7 int y_max; 48 int y_max;
49 int gpio_attb; /* GPIO connected to ATTB line */
8}; 50};
9 51
10#endif 52#endif
diff --git a/include/linux/input/touchscreen.h b/include/linux/input/touchscreen.h
new file mode 100644
index 000000000000..08a5ef6e8f25
--- /dev/null
+++ b/include/linux/input/touchscreen.h
@@ -0,0 +1,22 @@
1/*
2 * Copyright (c) 2014 Sebastian Reichel <sre@kernel.org>
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 2 as published by
6 * the Free Software Foundation.
7 */
8
9#ifndef _TOUCHSCREEN_H
10#define _TOUCHSCREEN_H
11
12#include <linux/input.h>
13
14#ifdef CONFIG_OF
15void touchscreen_parse_of_params(struct input_dev *dev);
16#else
17static inline void touchscreen_parse_of_params(struct input_dev *dev)
18{
19}
20#endif
21
22#endif
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 051c85032f48..698ad053d064 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -199,6 +199,26 @@ extern int check_wakeup_irqs(void);
199static inline int check_wakeup_irqs(void) { return 0; } 199static inline int check_wakeup_irqs(void) { return 0; }
200#endif 200#endif
201 201
202/**
203 * struct irq_affinity_notify - context for notification of IRQ affinity changes
204 * @irq: Interrupt to which notification applies
205 * @kref: Reference count, for internal use
206 * @work: Work item, for internal use
207 * @notify: Function to be called on change. This will be
208 * called in process context.
209 * @release: Function to be called on release. This will be
210 * called in process context. Once registered, the
211 * structure must only be freed when this function is
212 * called or later.
213 */
214struct irq_affinity_notify {
215 unsigned int irq;
216 struct kref kref;
217 struct work_struct work;
218 void (*notify)(struct irq_affinity_notify *, const cpumask_t *mask);
219 void (*release)(struct kref *ref);
220};
221
202#if defined(CONFIG_SMP) 222#if defined(CONFIG_SMP)
203 223
204extern cpumask_var_t irq_default_affinity; 224extern cpumask_var_t irq_default_affinity;
@@ -242,26 +262,6 @@ extern int irq_select_affinity(unsigned int irq);
242 262
243extern int irq_set_affinity_hint(unsigned int irq, const struct cpumask *m); 263extern int irq_set_affinity_hint(unsigned int irq, const struct cpumask *m);
244 264
245/**
246 * struct irq_affinity_notify - context for notification of IRQ affinity changes
247 * @irq: Interrupt to which notification applies
248 * @kref: Reference count, for internal use
249 * @work: Work item, for internal use
250 * @notify: Function to be called on change. This will be
251 * called in process context.
252 * @release: Function to be called on release. This will be
253 * called in process context. Once registered, the
254 * structure must only be freed when this function is
255 * called or later.
256 */
257struct irq_affinity_notify {
258 unsigned int irq;
259 struct kref kref;
260 struct work_struct work;
261 void (*notify)(struct irq_affinity_notify *, const cpumask_t *mask);
262 void (*release)(struct kref *ref);
263};
264
265extern int 265extern int
266irq_set_affinity_notifier(unsigned int irq, struct irq_affinity_notify *notify); 266irq_set_affinity_notifier(unsigned int irq, struct irq_affinity_notify *notify);
267 267
@@ -289,6 +289,12 @@ static inline int irq_set_affinity_hint(unsigned int irq,
289{ 289{
290 return -EINVAL; 290 return -EINVAL;
291} 291}
292
293static inline int
294irq_set_affinity_notifier(unsigned int irq, struct irq_affinity_notify *notify)
295{
296 return 0;
297}
292#endif /* CONFIG_SMP */ 298#endif /* CONFIG_SMP */
293 299
294/* 300/*
@@ -491,7 +497,7 @@ static inline int tasklet_trylock(struct tasklet_struct *t)
491 497
492static inline void tasklet_unlock(struct tasklet_struct *t) 498static inline void tasklet_unlock(struct tasklet_struct *t)
493{ 499{
494 smp_mb__before_clear_bit(); 500 smp_mb__before_atomic();
495 clear_bit(TASKLET_STATE_RUN, &(t)->state); 501 clear_bit(TASKLET_STATE_RUN, &(t)->state);
496} 502}
497 503
@@ -539,7 +545,7 @@ static inline void tasklet_hi_schedule_first(struct tasklet_struct *t)
539static inline void tasklet_disable_nosync(struct tasklet_struct *t) 545static inline void tasklet_disable_nosync(struct tasklet_struct *t)
540{ 546{
541 atomic_inc(&t->count); 547 atomic_inc(&t->count);
542 smp_mb__after_atomic_inc(); 548 smp_mb__after_atomic();
543} 549}
544 550
545static inline void tasklet_disable(struct tasklet_struct *t) 551static inline void tasklet_disable(struct tasklet_struct *t)
@@ -551,13 +557,13 @@ static inline void tasklet_disable(struct tasklet_struct *t)
551 557
552static inline void tasklet_enable(struct tasklet_struct *t) 558static inline void tasklet_enable(struct tasklet_struct *t)
553{ 559{
554 smp_mb__before_atomic_dec(); 560 smp_mb__before_atomic();
555 atomic_dec(&t->count); 561 atomic_dec(&t->count);
556} 562}
557 563
558static inline void tasklet_hi_enable(struct tasklet_struct *t) 564static inline void tasklet_hi_enable(struct tasklet_struct *t)
559{ 565{
560 smp_mb__before_atomic_dec(); 566 smp_mb__before_atomic();
561 atomic_dec(&t->count); 567 atomic_dec(&t->count);
562} 568}
563 569
diff --git a/include/linux/irq.h b/include/linux/irq.h
index 5c57efb863d0..0d998d8b01d8 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -525,24 +525,6 @@ static inline void irq_set_percpu_devid_flags(unsigned int irq)
525 IRQ_NOPROBE | IRQ_PER_CPU_DEVID); 525 IRQ_NOPROBE | IRQ_PER_CPU_DEVID);
526} 526}
527 527
528/* Handle dynamic irq creation and destruction */
529extern unsigned int create_irq_nr(unsigned int irq_want, int node);
530extern unsigned int __create_irqs(unsigned int from, unsigned int count,
531 int node);
532extern int create_irq(void);
533extern void destroy_irq(unsigned int irq);
534extern void destroy_irqs(unsigned int irq, unsigned int count);
535
536/*
537 * Dynamic irq helper functions. Obsolete. Use irq_alloc_desc* and
538 * irq_free_desc instead.
539 */
540extern void dynamic_irq_cleanup(unsigned int irq);
541static inline void dynamic_irq_init(unsigned int irq)
542{
543 dynamic_irq_cleanup(irq);
544}
545
546/* Set/get chip/data for an IRQ: */ 528/* Set/get chip/data for an IRQ: */
547extern int irq_set_chip(unsigned int irq, struct irq_chip *chip); 529extern int irq_set_chip(unsigned int irq, struct irq_chip *chip);
548extern int irq_set_handler_data(unsigned int irq, void *data); 530extern int irq_set_handler_data(unsigned int irq, void *data);
@@ -625,17 +607,29 @@ int __irq_alloc_descs(int irq, unsigned int from, unsigned int cnt, int node,
625 irq_alloc_descs(-1, from, cnt, node) 607 irq_alloc_descs(-1, from, cnt, node)
626 608
627void irq_free_descs(unsigned int irq, unsigned int cnt); 609void irq_free_descs(unsigned int irq, unsigned int cnt);
628int irq_reserve_irqs(unsigned int from, unsigned int cnt);
629
630static inline void irq_free_desc(unsigned int irq) 610static inline void irq_free_desc(unsigned int irq)
631{ 611{
632 irq_free_descs(irq, 1); 612 irq_free_descs(irq, 1);
633} 613}
634 614
635static inline int irq_reserve_irq(unsigned int irq) 615#ifdef CONFIG_GENERIC_IRQ_LEGACY_ALLOC_HWIRQ
616unsigned int irq_alloc_hwirqs(int cnt, int node);
617static inline unsigned int irq_alloc_hwirq(int node)
618{
619 return irq_alloc_hwirqs(1, node);
620}
621void irq_free_hwirqs(unsigned int from, int cnt);
622static inline void irq_free_hwirq(unsigned int irq)
636{ 623{
637 return irq_reserve_irqs(irq, 1); 624 return irq_free_hwirqs(irq, 1);
638} 625}
626int arch_setup_hwirq(unsigned int irq, int node);
627void arch_teardown_hwirq(unsigned int irq);
628#endif
629
630#ifdef CONFIG_GENERIC_IRQ_LEGACY
631void irq_init_desc(unsigned int irq);
632#endif
639 633
640#ifndef irq_reg_writel 634#ifndef irq_reg_writel
641# define irq_reg_writel(val, addr) writel(val, addr) 635# define irq_reg_writel(val, addr) writel(val, addr)
diff --git a/include/linux/irqchip/arm-gic.h b/include/linux/irqchip/arm-gic.h
index 7ed92d0560d5..45e2d8c15bd2 100644
--- a/include/linux/irqchip/arm-gic.h
+++ b/include/linux/irqchip/arm-gic.h
@@ -21,6 +21,8 @@
21#define GIC_CPU_ACTIVEPRIO 0xd0 21#define GIC_CPU_ACTIVEPRIO 0xd0
22#define GIC_CPU_IDENT 0xfc 22#define GIC_CPU_IDENT 0xfc
23 23
24#define GICC_IAR_INT_ID_MASK 0x3ff
25
24#define GIC_DIST_CTRL 0x000 26#define GIC_DIST_CTRL 0x000
25#define GIC_DIST_CTR 0x004 27#define GIC_DIST_CTR 0x004
26#define GIC_DIST_IGROUP 0x080 28#define GIC_DIST_IGROUP 0x080
diff --git a/include/linux/irqdesc.h b/include/linux/irqdesc.h
index 26e2661d3935..472c021a2d4f 100644
--- a/include/linux/irqdesc.h
+++ b/include/linux/irqdesc.h
@@ -27,6 +27,8 @@ struct irq_desc;
27 * @irq_count: stats field to detect stalled irqs 27 * @irq_count: stats field to detect stalled irqs
28 * @last_unhandled: aging timer for unhandled count 28 * @last_unhandled: aging timer for unhandled count
29 * @irqs_unhandled: stats field for spurious unhandled interrupts 29 * @irqs_unhandled: stats field for spurious unhandled interrupts
30 * @threads_handled: stats field for deferred spurious detection of threaded handlers
31 * @threads_handled_last: comparator field for deferred spurious detection of theraded handlers
30 * @lock: locking for SMP 32 * @lock: locking for SMP
31 * @affinity_hint: hint to user space for preferred irq affinity 33 * @affinity_hint: hint to user space for preferred irq affinity
32 * @affinity_notify: context for notification of affinity changes 34 * @affinity_notify: context for notification of affinity changes
@@ -52,6 +54,8 @@ struct irq_desc {
52 unsigned int irq_count; /* For detecting broken IRQs */ 54 unsigned int irq_count; /* For detecting broken IRQs */
53 unsigned long last_unhandled; /* Aging timer for unhandled count */ 55 unsigned long last_unhandled; /* Aging timer for unhandled count */
54 unsigned int irqs_unhandled; 56 unsigned int irqs_unhandled;
57 atomic_t threads_handled;
58 int threads_handled_last;
55 raw_spinlock_t lock; 59 raw_spinlock_t lock;
56 struct cpumask *percpu_enabled; 60 struct cpumask *percpu_enabled;
57#ifdef CONFIG_SMP 61#ifdef CONFIG_SMP
diff --git a/include/linux/isdn/capiutil.h b/include/linux/isdn/capiutil.h
index 5a52f2c94f3f..44bd6046e6e2 100644
--- a/include/linux/isdn/capiutil.h
+++ b/include/linux/isdn/capiutil.h
@@ -164,11 +164,6 @@ unsigned capi_cmsg_header(_cmsg * cmsg, __u16 _ApplId,
164 __u8 _Command, __u8 _Subcommand, 164 __u8 _Command, __u8 _Subcommand,
165 __u16 _Messagenumber, __u32 _Controller); 165 __u16 _Messagenumber, __u32 _Controller);
166 166
167/*
168 * capi_info2str generated a readable string for Capi2.0 reasons.
169 */
170char *capi_info2str(__u16 reason);
171
172/*-----------------------------------------------------------------------*/ 167/*-----------------------------------------------------------------------*/
173 168
174/* 169/*
diff --git a/include/linux/jump_label.h b/include/linux/jump_label.h
index 5c1dfb2a9e73..784304b222b3 100644
--- a/include/linux/jump_label.h
+++ b/include/linux/jump_label.h
@@ -69,6 +69,10 @@ struct static_key {
69 69
70# include <asm/jump_label.h> 70# include <asm/jump_label.h>
71# define HAVE_JUMP_LABEL 71# define HAVE_JUMP_LABEL
72#else
73struct static_key {
74 atomic_t enabled;
75};
72#endif /* CC_HAVE_ASM_GOTO && CONFIG_JUMP_LABEL */ 76#endif /* CC_HAVE_ASM_GOTO && CONFIG_JUMP_LABEL */
73 77
74enum jump_label_type { 78enum jump_label_type {
@@ -79,6 +83,12 @@ enum jump_label_type {
79struct module; 83struct module;
80 84
81#include <linux/atomic.h> 85#include <linux/atomic.h>
86
87static inline int static_key_count(struct static_key *key)
88{
89 return atomic_read(&key->enabled);
90}
91
82#ifdef HAVE_JUMP_LABEL 92#ifdef HAVE_JUMP_LABEL
83 93
84#define JUMP_LABEL_TYPE_FALSE_BRANCH 0UL 94#define JUMP_LABEL_TYPE_FALSE_BRANCH 0UL
@@ -134,10 +144,6 @@ extern void jump_label_apply_nops(struct module *mod);
134 144
135#else /* !HAVE_JUMP_LABEL */ 145#else /* !HAVE_JUMP_LABEL */
136 146
137struct static_key {
138 atomic_t enabled;
139};
140
141static __always_inline void jump_label_init(void) 147static __always_inline void jump_label_init(void)
142{ 148{
143 static_key_initialized = true; 149 static_key_initialized = true;
@@ -145,14 +151,14 @@ static __always_inline void jump_label_init(void)
145 151
146static __always_inline bool static_key_false(struct static_key *key) 152static __always_inline bool static_key_false(struct static_key *key)
147{ 153{
148 if (unlikely(atomic_read(&key->enabled) > 0)) 154 if (unlikely(static_key_count(key) > 0))
149 return true; 155 return true;
150 return false; 156 return false;
151} 157}
152 158
153static __always_inline bool static_key_true(struct static_key *key) 159static __always_inline bool static_key_true(struct static_key *key)
154{ 160{
155 if (likely(atomic_read(&key->enabled) > 0)) 161 if (likely(static_key_count(key) > 0))
156 return true; 162 return true;
157 return false; 163 return false;
158} 164}
@@ -194,7 +200,7 @@ static inline int jump_label_apply_nops(struct module *mod)
194 200
195static inline bool static_key_enabled(struct static_key *key) 201static inline bool static_key_enabled(struct static_key *key)
196{ 202{
197 return (atomic_read(&key->enabled) > 0); 203 return static_key_count(key) > 0;
198} 204}
199 205
200#endif /* _LINUX_JUMP_LABEL_H */ 206#endif /* _LINUX_JUMP_LABEL_H */
diff --git a/include/linux/kernfs.h b/include/linux/kernfs.h
index ca1be5c9136c..30faf797c2c3 100644
--- a/include/linux/kernfs.h
+++ b/include/linux/kernfs.h
@@ -91,6 +91,7 @@ struct kernfs_elem_attr {
91 const struct kernfs_ops *ops; 91 const struct kernfs_ops *ops;
92 struct kernfs_open_node *open; 92 struct kernfs_open_node *open;
93 loff_t size; 93 loff_t size;
94 struct kernfs_node *notify_next; /* for kernfs_notify() */
94}; 95};
95 96
96/* 97/*
@@ -161,6 +162,10 @@ struct kernfs_root {
161 /* private fields, do not use outside kernfs proper */ 162 /* private fields, do not use outside kernfs proper */
162 struct ida ino_ida; 163 struct ida ino_ida;
163 struct kernfs_syscall_ops *syscall_ops; 164 struct kernfs_syscall_ops *syscall_ops;
165
166 /* list of kernfs_super_info of this root, protected by kernfs_mutex */
167 struct list_head supers;
168
164 wait_queue_head_t deactivate_waitq; 169 wait_queue_head_t deactivate_waitq;
165}; 170};
166 171
@@ -297,9 +302,10 @@ void kernfs_notify(struct kernfs_node *kn);
297 302
298const void *kernfs_super_ns(struct super_block *sb); 303const void *kernfs_super_ns(struct super_block *sb);
299struct dentry *kernfs_mount_ns(struct file_system_type *fs_type, int flags, 304struct dentry *kernfs_mount_ns(struct file_system_type *fs_type, int flags,
300 struct kernfs_root *root, bool *new_sb_created, 305 struct kernfs_root *root, unsigned long magic,
301 const void *ns); 306 bool *new_sb_created, const void *ns);
302void kernfs_kill_sb(struct super_block *sb); 307void kernfs_kill_sb(struct super_block *sb);
308struct super_block *kernfs_pin_sb(struct kernfs_root *root, const void *ns);
303 309
304void kernfs_init(void); 310void kernfs_init(void);
305 311
@@ -391,7 +397,8 @@ static inline const void *kernfs_super_ns(struct super_block *sb)
391 397
392static inline struct dentry * 398static inline struct dentry *
393kernfs_mount_ns(struct file_system_type *fs_type, int flags, 399kernfs_mount_ns(struct file_system_type *fs_type, int flags,
394 struct kernfs_root *root, bool *new_sb_created, const void *ns) 400 struct kernfs_root *root, unsigned long magic,
401 bool *new_sb_created, const void *ns)
395{ return ERR_PTR(-ENOSYS); } 402{ return ERR_PTR(-ENOSYS); }
396 403
397static inline void kernfs_kill_sb(struct super_block *sb) { } 404static inline void kernfs_kill_sb(struct super_block *sb) { }
@@ -449,9 +456,11 @@ static inline int kernfs_rename(struct kernfs_node *kn,
449 456
450static inline struct dentry * 457static inline struct dentry *
451kernfs_mount(struct file_system_type *fs_type, int flags, 458kernfs_mount(struct file_system_type *fs_type, int flags,
452 struct kernfs_root *root, bool *new_sb_created) 459 struct kernfs_root *root, unsigned long magic,
460 bool *new_sb_created)
453{ 461{
454 return kernfs_mount_ns(fs_type, flags, root, new_sb_created, NULL); 462 return kernfs_mount_ns(fs_type, flags, root,
463 magic, new_sb_created, NULL);
455} 464}
456 465
457#endif /* __LINUX_KERNFS_H */ 466#endif /* __LINUX_KERNFS_H */
diff --git a/include/linux/key.h b/include/linux/key.h
index 80d677483e31..017b0826642f 100644
--- a/include/linux/key.h
+++ b/include/linux/key.h
@@ -309,6 +309,17 @@ static inline key_serial_t key_serial(const struct key *key)
309 309
310extern void key_set_timeout(struct key *, unsigned); 310extern void key_set_timeout(struct key *, unsigned);
311 311
312/*
313 * The permissions required on a key that we're looking up.
314 */
315#define KEY_NEED_VIEW 0x01 /* Require permission to view attributes */
316#define KEY_NEED_READ 0x02 /* Require permission to read content */
317#define KEY_NEED_WRITE 0x04 /* Require permission to update / modify */
318#define KEY_NEED_SEARCH 0x08 /* Require permission to search (keyring) or find (key) */
319#define KEY_NEED_LINK 0x10 /* Require permission to link */
320#define KEY_NEED_SETATTR 0x20 /* Require permission to change attributes */
321#define KEY_NEED_ALL 0x3f /* All the above permissions */
322
312/** 323/**
313 * key_is_instantiated - Determine if a key has been positively instantiated 324 * key_is_instantiated - Determine if a key has been positively instantiated
314 * @key: The key to check. 325 * @key: The key to check.
@@ -332,7 +343,7 @@ do { \
332} while (0) 343} while (0)
333 344
334#ifdef CONFIG_SYSCTL 345#ifdef CONFIG_SYSCTL
335extern ctl_table key_sysctls[]; 346extern struct ctl_table key_sysctls[];
336#endif 347#endif
337/* 348/*
338 * the userspace interface 349 * the userspace interface
diff --git a/include/linux/kmemleak.h b/include/linux/kmemleak.h
index 5bb424659c04..057e95971014 100644
--- a/include/linux/kmemleak.h
+++ b/include/linux/kmemleak.h
@@ -30,6 +30,7 @@ extern void kmemleak_alloc_percpu(const void __percpu *ptr, size_t size) __ref;
30extern void kmemleak_free(const void *ptr) __ref; 30extern void kmemleak_free(const void *ptr) __ref;
31extern void kmemleak_free_part(const void *ptr, size_t size) __ref; 31extern void kmemleak_free_part(const void *ptr, size_t size) __ref;
32extern void kmemleak_free_percpu(const void __percpu *ptr) __ref; 32extern void kmemleak_free_percpu(const void __percpu *ptr) __ref;
33extern void kmemleak_update_trace(const void *ptr) __ref;
33extern void kmemleak_not_leak(const void *ptr) __ref; 34extern void kmemleak_not_leak(const void *ptr) __ref;
34extern void kmemleak_ignore(const void *ptr) __ref; 35extern void kmemleak_ignore(const void *ptr) __ref;
35extern void kmemleak_scan_area(const void *ptr, size_t size, gfp_t gfp) __ref; 36extern void kmemleak_scan_area(const void *ptr, size_t size, gfp_t gfp) __ref;
@@ -83,6 +84,9 @@ static inline void kmemleak_free_recursive(const void *ptr, unsigned long flags)
83static inline void kmemleak_free_percpu(const void __percpu *ptr) 84static inline void kmemleak_free_percpu(const void __percpu *ptr)
84{ 85{
85} 86}
87static inline void kmemleak_update_trace(const void *ptr)
88{
89}
86static inline void kmemleak_not_leak(const void *ptr) 90static inline void kmemleak_not_leak(const void *ptr)
87{ 91{
88} 92}
diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index f896a33e8341..2d61b909f414 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -32,8 +32,10 @@
32#define UEVENT_NUM_ENVP 32 /* number of env pointers */ 32#define UEVENT_NUM_ENVP 32 /* number of env pointers */
33#define UEVENT_BUFFER_SIZE 2048 /* buffer for the variables */ 33#define UEVENT_BUFFER_SIZE 2048 /* buffer for the variables */
34 34
35#ifdef CONFIG_UEVENT_HELPER
35/* path to the userspace helper executed on an event */ 36/* path to the userspace helper executed on an event */
36extern char uevent_helper[]; 37extern char uevent_helper[];
38#endif
37 39
38/* counter to tag the uevent, read only except for the kobject core */ 40/* counter to tag the uevent, read only except for the kobject core */
39extern u64 uevent_seqnum; 41extern u64 uevent_seqnum;
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h
index 925eaf28fca9..f7296e57d614 100644
--- a/include/linux/kprobes.h
+++ b/include/linux/kprobes.h
@@ -205,10 +205,10 @@ struct kretprobe_blackpoint {
205 void *addr; 205 void *addr;
206}; 206};
207 207
208struct kprobe_blackpoint { 208struct kprobe_blacklist_entry {
209 const char *name; 209 struct list_head list;
210 unsigned long start_addr; 210 unsigned long start_addr;
211 unsigned long range; 211 unsigned long end_addr;
212}; 212};
213 213
214#ifdef CONFIG_KPROBES 214#ifdef CONFIG_KPROBES
@@ -265,6 +265,7 @@ extern void arch_disarm_kprobe(struct kprobe *p);
265extern int arch_init_kprobes(void); 265extern int arch_init_kprobes(void);
266extern void show_registers(struct pt_regs *regs); 266extern void show_registers(struct pt_regs *regs);
267extern void kprobes_inc_nmissed_count(struct kprobe *p); 267extern void kprobes_inc_nmissed_count(struct kprobe *p);
268extern bool arch_within_kprobe_blacklist(unsigned long addr);
268 269
269struct kprobe_insn_cache { 270struct kprobe_insn_cache {
270 struct mutex mutex; 271 struct mutex mutex;
@@ -355,7 +356,7 @@ static inline void reset_current_kprobe(void)
355 356
356static inline struct kprobe_ctlblk *get_kprobe_ctlblk(void) 357static inline struct kprobe_ctlblk *get_kprobe_ctlblk(void)
357{ 358{
358 return (&__get_cpu_var(kprobe_ctlblk)); 359 return this_cpu_ptr(&kprobe_ctlblk);
359} 360}
360 361
361int register_kprobe(struct kprobe *p); 362int register_kprobe(struct kprobe *p);
@@ -476,4 +477,18 @@ static inline int enable_jprobe(struct jprobe *jp)
476 return enable_kprobe(&jp->kp); 477 return enable_kprobe(&jp->kp);
477} 478}
478 479
480#ifdef CONFIG_KPROBES
481/*
482 * Blacklist ganerating macro. Specify functions which is not probed
483 * by using this macro.
484 */
485#define __NOKPROBE_SYMBOL(fname) \
486static unsigned long __used \
487 __attribute__((section("_kprobe_blacklist"))) \
488 _kbl_addr_##fname = (unsigned long)fname;
489#define NOKPROBE_SYMBOL(fname) __NOKPROBE_SYMBOL(fname)
490#else
491#define NOKPROBE_SYMBOL(fname)
492#endif
493
479#endif /* _LINUX_KPROBES_H */ 494#endif /* _LINUX_KPROBES_H */
diff --git a/include/linux/ktime.h b/include/linux/ktime.h
index 31c0cd1c941a..de9e46e6bcc9 100644
--- a/include/linux/ktime.h
+++ b/include/linux/ktime.h
@@ -304,6 +304,30 @@ static inline int ktime_compare(const ktime_t cmp1, const ktime_t cmp2)
304 return 0; 304 return 0;
305} 305}
306 306
307/**
308 * ktime_after - Compare if a ktime_t value is bigger than another one.
309 * @cmp1: comparable1
310 * @cmp2: comparable2
311 *
312 * Return: true if cmp1 happened after cmp2.
313 */
314static inline bool ktime_after(const ktime_t cmp1, const ktime_t cmp2)
315{
316 return ktime_compare(cmp1, cmp2) > 0;
317}
318
319/**
320 * ktime_before - Compare if a ktime_t value is smaller than another one.
321 * @cmp1: comparable1
322 * @cmp2: comparable2
323 *
324 * Return: true if cmp1 happened before cmp2.
325 */
326static inline bool ktime_before(const ktime_t cmp1, const ktime_t cmp2)
327{
328 return ktime_compare(cmp1, cmp2) < 0;
329}
330
307static inline s64 ktime_to_us(const ktime_t kt) 331static inline s64 ktime_to_us(const ktime_t kt)
308{ 332{
309 struct timeval tv = ktime_to_timeval(kt); 333 struct timeval tv = ktime_to_timeval(kt);
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index 7d21cf9f4380..ec4e3bd83d47 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -134,6 +134,8 @@ static inline bool is_error_page(struct page *page)
134#define KVM_REQ_EPR_EXIT 20 134#define KVM_REQ_EPR_EXIT 20
135#define KVM_REQ_SCAN_IOAPIC 21 135#define KVM_REQ_SCAN_IOAPIC 21
136#define KVM_REQ_GLOBAL_CLOCK_UPDATE 22 136#define KVM_REQ_GLOBAL_CLOCK_UPDATE 22
137#define KVM_REQ_ENABLE_IBS 23
138#define KVM_REQ_DISABLE_IBS 24
137 139
138#define KVM_USERSPACE_IRQ_SOURCE_ID 0 140#define KVM_USERSPACE_IRQ_SOURCE_ID 0
139#define KVM_IRQFD_RESAMPLE_IRQ_SOURCE_ID 1 141#define KVM_IRQFD_RESAMPLE_IRQ_SOURCE_ID 1
@@ -163,6 +165,7 @@ enum kvm_bus {
163 KVM_MMIO_BUS, 165 KVM_MMIO_BUS,
164 KVM_PIO_BUS, 166 KVM_PIO_BUS,
165 KVM_VIRTIO_CCW_NOTIFY_BUS, 167 KVM_VIRTIO_CCW_NOTIFY_BUS,
168 KVM_FAST_MMIO_BUS,
166 KVM_NR_BUSES 169 KVM_NR_BUSES
167}; 170};
168 171
@@ -367,6 +370,7 @@ struct kvm {
367 struct mm_struct *mm; /* userspace tied to this vm */ 370 struct mm_struct *mm; /* userspace tied to this vm */
368 struct kvm_memslots *memslots; 371 struct kvm_memslots *memslots;
369 struct srcu_struct srcu; 372 struct srcu_struct srcu;
373 struct srcu_struct irq_srcu;
370#ifdef CONFIG_KVM_APIC_ARCHITECTURE 374#ifdef CONFIG_KVM_APIC_ARCHITECTURE
371 u32 bsp_vcpu_id; 375 u32 bsp_vcpu_id;
372#endif 376#endif
@@ -410,9 +414,7 @@ struct kvm {
410 unsigned long mmu_notifier_seq; 414 unsigned long mmu_notifier_seq;
411 long mmu_notifier_count; 415 long mmu_notifier_count;
412#endif 416#endif
413 /* Protected by mmu_lock */ 417 long tlbs_dirty;
414 bool tlbs_dirty;
415
416 struct list_head devices; 418 struct list_head devices;
417}; 419};
418 420
@@ -584,7 +586,7 @@ void mark_page_dirty(struct kvm *kvm, gfn_t gfn);
584 586
585void kvm_vcpu_block(struct kvm_vcpu *vcpu); 587void kvm_vcpu_block(struct kvm_vcpu *vcpu);
586void kvm_vcpu_kick(struct kvm_vcpu *vcpu); 588void kvm_vcpu_kick(struct kvm_vcpu *vcpu);
587bool kvm_vcpu_yield_to(struct kvm_vcpu *target); 589int kvm_vcpu_yield_to(struct kvm_vcpu *target);
588void kvm_vcpu_on_spin(struct kvm_vcpu *vcpu); 590void kvm_vcpu_on_spin(struct kvm_vcpu *vcpu);
589void kvm_load_guest_fpu(struct kvm_vcpu *vcpu); 591void kvm_load_guest_fpu(struct kvm_vcpu *vcpu);
590void kvm_put_guest_fpu(struct kvm_vcpu *vcpu); 592void kvm_put_guest_fpu(struct kvm_vcpu *vcpu);
@@ -879,6 +881,13 @@ static inline hpa_t pfn_to_hpa(pfn_t pfn)
879 return (hpa_t)pfn << PAGE_SHIFT; 881 return (hpa_t)pfn << PAGE_SHIFT;
880} 882}
881 883
884static inline bool kvm_is_error_gpa(struct kvm *kvm, gpa_t gpa)
885{
886 unsigned long hva = gfn_to_hva(kvm, gpa_to_gfn(gpa));
887
888 return kvm_is_error_hva(hva);
889}
890
882static inline void kvm_migrate_timers(struct kvm_vcpu *vcpu) 891static inline void kvm_migrate_timers(struct kvm_vcpu *vcpu)
883{ 892{
884 set_bit(KVM_REQ_MIGRATE_TIMER, &vcpu->requests); 893 set_bit(KVM_REQ_MIGRATE_TIMER, &vcpu->requests);
diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h
index dcaad79f54ed..219d79627c05 100644
--- a/include/linux/lockd/lockd.h
+++ b/include/linux/lockd/lockd.h
@@ -17,13 +17,13 @@
17#include <linux/fs.h> 17#include <linux/fs.h>
18#include <linux/kref.h> 18#include <linux/kref.h>
19#include <linux/utsname.h> 19#include <linux/utsname.h>
20#include <linux/nfsd/nfsfh.h>
21#include <linux/lockd/bind.h> 20#include <linux/lockd/bind.h>
22#include <linux/lockd/xdr.h> 21#include <linux/lockd/xdr.h>
23#ifdef CONFIG_LOCKD_V4 22#ifdef CONFIG_LOCKD_V4
24#include <linux/lockd/xdr4.h> 23#include <linux/lockd/xdr4.h>
25#endif 24#endif
26#include <linux/lockd/debug.h> 25#include <linux/lockd/debug.h>
26#include <linux/sunrpc/svc.h>
27 27
28/* 28/*
29 * Version string 29 * Version string
diff --git a/include/linux/mbus.h b/include/linux/mbus.h
index 345b8c53b897..550c88fb0267 100644
--- a/include/linux/mbus.h
+++ b/include/linux/mbus.h
@@ -73,6 +73,6 @@ int mvebu_mbus_del_window(phys_addr_t base, size_t size);
73int mvebu_mbus_init(const char *soc, phys_addr_t mbus_phys_base, 73int mvebu_mbus_init(const char *soc, phys_addr_t mbus_phys_base,
74 size_t mbus_size, phys_addr_t sdram_phys_base, 74 size_t mbus_size, phys_addr_t sdram_phys_base,
75 size_t sdram_size); 75 size_t sdram_size);
76int mvebu_mbus_dt_init(void); 76int mvebu_mbus_dt_init(bool is_coherent);
77 77
78#endif /* __LINUX_MBUS_H */ 78#endif /* __LINUX_MBUS_H */
diff --git a/include/linux/mc146818rtc.h b/include/linux/mc146818rtc.h
index 2f4e957af656..433e0c74d643 100644
--- a/include/linux/mc146818rtc.h
+++ b/include/linux/mc146818rtc.h
@@ -31,6 +31,10 @@ struct cmos_rtc_board_info {
31 void (*wake_on)(struct device *dev); 31 void (*wake_on)(struct device *dev);
32 void (*wake_off)(struct device *dev); 32 void (*wake_off)(struct device *dev);
33 33
34 u32 flags;
35#define CMOS_RTC_FLAGS_NOFREQ (1 << 0)
36 int address_space;
37
34 u8 rtc_day_alarm; /* zero, or register index */ 38 u8 rtc_day_alarm; /* zero, or register index */
35 u8 rtc_mon_alarm; /* zero, or register index */ 39 u8 rtc_mon_alarm; /* zero, or register index */
36 u8 rtc_century; /* zero, or register index */ 40 u8 rtc_century; /* zero, or register index */
diff --git a/include/linux/mcb.h b/include/linux/mcb.h
index 2db284d14064..ed06e15a36aa 100644
--- a/include/linux/mcb.h
+++ b/include/linux/mcb.h
@@ -16,6 +16,7 @@
16#include <linux/irqreturn.h> 16#include <linux/irqreturn.h>
17 17
18struct mcb_driver; 18struct mcb_driver;
19struct mcb_device;
19 20
20/** 21/**
21 * struct mcb_bus - MEN Chameleon Bus 22 * struct mcb_bus - MEN Chameleon Bus
@@ -23,11 +24,14 @@ struct mcb_driver;
23 * @dev: pointer to carrier device 24 * @dev: pointer to carrier device
24 * @children: the child busses 25 * @children: the child busses
25 * @bus_nr: mcb bus number 26 * @bus_nr: mcb bus number
27 * @get_irq: callback to get IRQ number
26 */ 28 */
27struct mcb_bus { 29struct mcb_bus {
28 struct list_head children; 30 struct list_head children;
29 struct device dev; 31 struct device dev;
32 struct device *carrier;
30 int bus_nr; 33 int bus_nr;
34 int (*get_irq)(struct mcb_device *dev);
31}; 35};
32#define to_mcb_bus(b) container_of((b), struct mcb_bus, dev) 36#define to_mcb_bus(b) container_of((b), struct mcb_bus, dev)
33 37
@@ -105,7 +109,7 @@ extern void mcb_unregister_driver(struct mcb_driver *driver);
105 module_driver(__mcb_driver, mcb_register_driver, mcb_unregister_driver); 109 module_driver(__mcb_driver, mcb_register_driver, mcb_unregister_driver);
106extern void mcb_bus_add_devices(const struct mcb_bus *bus); 110extern void mcb_bus_add_devices(const struct mcb_bus *bus);
107extern int mcb_device_register(struct mcb_bus *bus, struct mcb_device *dev); 111extern int mcb_device_register(struct mcb_bus *bus, struct mcb_device *dev);
108extern struct mcb_bus *mcb_alloc_bus(void); 112extern struct mcb_bus *mcb_alloc_bus(struct device *carrier);
109extern struct mcb_bus *mcb_bus_get(struct mcb_bus *bus); 113extern struct mcb_bus *mcb_bus_get(struct mcb_bus *bus);
110extern void mcb_bus_put(struct mcb_bus *bus); 114extern void mcb_bus_put(struct mcb_bus *bus);
111extern struct mcb_device *mcb_alloc_dev(struct mcb_bus *bus); 115extern struct mcb_device *mcb_alloc_dev(struct mcb_bus *bus);
diff --git a/include/linux/memblock.h b/include/linux/memblock.h
index 8a20a51ed42d..b660e05b63d4 100644
--- a/include/linux/memblock.h
+++ b/include/linux/memblock.h
@@ -18,6 +18,7 @@
18#include <linux/mm.h> 18#include <linux/mm.h>
19 19
20#define INIT_MEMBLOCK_REGIONS 128 20#define INIT_MEMBLOCK_REGIONS 128
21#define INIT_PHYSMEM_REGIONS 4
21 22
22/* Definition of memblock flags. */ 23/* Definition of memblock flags. */
23#define MEMBLOCK_HOTPLUG 0x1 /* hotpluggable region */ 24#define MEMBLOCK_HOTPLUG 0x1 /* hotpluggable region */
@@ -43,6 +44,9 @@ struct memblock {
43 phys_addr_t current_limit; 44 phys_addr_t current_limit;
44 struct memblock_type memory; 45 struct memblock_type memory;
45 struct memblock_type reserved; 46 struct memblock_type reserved;
47#ifdef CONFIG_HAVE_MEMBLOCK_PHYS_MAP
48 struct memblock_type physmem;
49#endif
46}; 50};
47 51
48extern struct memblock memblock; 52extern struct memblock memblock;
@@ -71,6 +75,63 @@ int memblock_reserve(phys_addr_t base, phys_addr_t size);
71void memblock_trim_memory(phys_addr_t align); 75void memblock_trim_memory(phys_addr_t align);
72int memblock_mark_hotplug(phys_addr_t base, phys_addr_t size); 76int memblock_mark_hotplug(phys_addr_t base, phys_addr_t size);
73int memblock_clear_hotplug(phys_addr_t base, phys_addr_t size); 77int memblock_clear_hotplug(phys_addr_t base, phys_addr_t size);
78
79/* Low level functions */
80int memblock_add_range(struct memblock_type *type,
81 phys_addr_t base, phys_addr_t size,
82 int nid, unsigned long flags);
83
84int memblock_remove_range(struct memblock_type *type,
85 phys_addr_t base,
86 phys_addr_t size);
87
88void __next_mem_range(u64 *idx, int nid, struct memblock_type *type_a,
89 struct memblock_type *type_b, phys_addr_t *out_start,
90 phys_addr_t *out_end, int *out_nid);
91
92void __next_mem_range_rev(u64 *idx, int nid, struct memblock_type *type_a,
93 struct memblock_type *type_b, phys_addr_t *out_start,
94 phys_addr_t *out_end, int *out_nid);
95
96/**
97 * for_each_mem_range - iterate through memblock areas from type_a and not
98 * included in type_b. Or just type_a if type_b is NULL.
99 * @i: u64 used as loop variable
100 * @type_a: ptr to memblock_type to iterate
101 * @type_b: ptr to memblock_type which excludes from the iteration
102 * @nid: node selector, %NUMA_NO_NODE for all nodes
103 * @p_start: ptr to phys_addr_t for start address of the range, can be %NULL
104 * @p_end: ptr to phys_addr_t for end address of the range, can be %NULL
105 * @p_nid: ptr to int for nid of the range, can be %NULL
106 */
107#define for_each_mem_range(i, type_a, type_b, nid, \
108 p_start, p_end, p_nid) \
109 for (i = 0, __next_mem_range(&i, nid, type_a, type_b, \
110 p_start, p_end, p_nid); \
111 i != (u64)ULLONG_MAX; \
112 __next_mem_range(&i, nid, type_a, type_b, \
113 p_start, p_end, p_nid))
114
115/**
116 * for_each_mem_range_rev - reverse iterate through memblock areas from
117 * type_a and not included in type_b. Or just type_a if type_b is NULL.
118 * @i: u64 used as loop variable
119 * @type_a: ptr to memblock_type to iterate
120 * @type_b: ptr to memblock_type which excludes from the iteration
121 * @nid: node selector, %NUMA_NO_NODE for all nodes
122 * @p_start: ptr to phys_addr_t for start address of the range, can be %NULL
123 * @p_end: ptr to phys_addr_t for end address of the range, can be %NULL
124 * @p_nid: ptr to int for nid of the range, can be %NULL
125 */
126#define for_each_mem_range_rev(i, type_a, type_b, nid, \
127 p_start, p_end, p_nid) \
128 for (i = (u64)ULLONG_MAX, \
129 __next_mem_range_rev(&i, nid, type_a, type_b, \
130 p_start, p_end, p_nid); \
131 i != (u64)ULLONG_MAX; \
132 __next_mem_range_rev(&i, nid, type_a, type_b, \
133 p_start, p_end, p_nid))
134
74#ifdef CONFIG_MOVABLE_NODE 135#ifdef CONFIG_MOVABLE_NODE
75static inline bool memblock_is_hotpluggable(struct memblock_region *m) 136static inline bool memblock_is_hotpluggable(struct memblock_region *m)
76{ 137{
@@ -113,9 +174,6 @@ void __next_mem_pfn_range(int *idx, int nid, unsigned long *out_start_pfn,
113 i >= 0; __next_mem_pfn_range(&i, nid, p_start, p_end, p_nid)) 174 i >= 0; __next_mem_pfn_range(&i, nid, p_start, p_end, p_nid))
114#endif /* CONFIG_HAVE_MEMBLOCK_NODE_MAP */ 175#endif /* CONFIG_HAVE_MEMBLOCK_NODE_MAP */
115 176
116void __next_free_mem_range(u64 *idx, int nid, phys_addr_t *out_start,
117 phys_addr_t *out_end, int *out_nid);
118
119/** 177/**
120 * for_each_free_mem_range - iterate through free memblock areas 178 * for_each_free_mem_range - iterate through free memblock areas
121 * @i: u64 used as loop variable 179 * @i: u64 used as loop variable
@@ -128,13 +186,8 @@ void __next_free_mem_range(u64 *idx, int nid, phys_addr_t *out_start,
128 * soon as memblock is initialized. 186 * soon as memblock is initialized.
129 */ 187 */
130#define for_each_free_mem_range(i, nid, p_start, p_end, p_nid) \ 188#define for_each_free_mem_range(i, nid, p_start, p_end, p_nid) \
131 for (i = 0, \ 189 for_each_mem_range(i, &memblock.memory, &memblock.reserved, \
132 __next_free_mem_range(&i, nid, p_start, p_end, p_nid); \ 190 nid, p_start, p_end, p_nid)
133 i != (u64)ULLONG_MAX; \
134 __next_free_mem_range(&i, nid, p_start, p_end, p_nid))
135
136void __next_free_mem_range_rev(u64 *idx, int nid, phys_addr_t *out_start,
137 phys_addr_t *out_end, int *out_nid);
138 191
139/** 192/**
140 * for_each_free_mem_range_reverse - rev-iterate through free memblock areas 193 * for_each_free_mem_range_reverse - rev-iterate through free memblock areas
@@ -148,10 +201,8 @@ void __next_free_mem_range_rev(u64 *idx, int nid, phys_addr_t *out_start,
148 * order. Available as soon as memblock is initialized. 201 * order. Available as soon as memblock is initialized.
149 */ 202 */
150#define for_each_free_mem_range_reverse(i, nid, p_start, p_end, p_nid) \ 203#define for_each_free_mem_range_reverse(i, nid, p_start, p_end, p_nid) \
151 for (i = (u64)ULLONG_MAX, \ 204 for_each_mem_range_rev(i, &memblock.memory, &memblock.reserved, \
152 __next_free_mem_range_rev(&i, nid, p_start, p_end, p_nid); \ 205 nid, p_start, p_end, p_nid)
153 i != (u64)ULLONG_MAX; \
154 __next_free_mem_range_rev(&i, nid, p_start, p_end, p_nid))
155 206
156static inline void memblock_set_region_flags(struct memblock_region *r, 207static inline void memblock_set_region_flags(struct memblock_region *r,
157 unsigned long flags) 208 unsigned long flags)
@@ -221,6 +272,8 @@ static inline bool memblock_bottom_up(void) { return false; }
221#define MEMBLOCK_ALLOC_ANYWHERE (~(phys_addr_t)0) 272#define MEMBLOCK_ALLOC_ANYWHERE (~(phys_addr_t)0)
222#define MEMBLOCK_ALLOC_ACCESSIBLE 0 273#define MEMBLOCK_ALLOC_ACCESSIBLE 0
223 274
275phys_addr_t __init memblock_alloc_range(phys_addr_t size, phys_addr_t align,
276 phys_addr_t start, phys_addr_t end);
224phys_addr_t memblock_alloc_base(phys_addr_t size, phys_addr_t align, 277phys_addr_t memblock_alloc_base(phys_addr_t size, phys_addr_t align,
225 phys_addr_t max_addr); 278 phys_addr_t max_addr);
226phys_addr_t __memblock_alloc_base(phys_addr_t size, phys_addr_t align, 279phys_addr_t __memblock_alloc_base(phys_addr_t size, phys_addr_t align,
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index b569b8be5c5a..eb65d29516ca 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -492,13 +492,9 @@ void __memcg_kmem_uncharge_pages(struct page *page, int order);
492 492
493int memcg_cache_id(struct mem_cgroup *memcg); 493int memcg_cache_id(struct mem_cgroup *memcg);
494 494
495char *memcg_create_cache_name(struct mem_cgroup *memcg,
496 struct kmem_cache *root_cache);
497int memcg_alloc_cache_params(struct mem_cgroup *memcg, struct kmem_cache *s, 495int memcg_alloc_cache_params(struct mem_cgroup *memcg, struct kmem_cache *s,
498 struct kmem_cache *root_cache); 496 struct kmem_cache *root_cache);
499void memcg_free_cache_params(struct kmem_cache *s); 497void memcg_free_cache_params(struct kmem_cache *s);
500void memcg_register_cache(struct kmem_cache *s);
501void memcg_unregister_cache(struct kmem_cache *s);
502 498
503int memcg_update_cache_size(struct kmem_cache *s, int num_groups); 499int memcg_update_cache_size(struct kmem_cache *s, int num_groups);
504void memcg_update_array_size(int num_groups); 500void memcg_update_array_size(int num_groups);
@@ -506,8 +502,10 @@ void memcg_update_array_size(int num_groups);
506struct kmem_cache * 502struct kmem_cache *
507__memcg_kmem_get_cache(struct kmem_cache *cachep, gfp_t gfp); 503__memcg_kmem_get_cache(struct kmem_cache *cachep, gfp_t gfp);
508 504
509void mem_cgroup_destroy_cache(struct kmem_cache *cachep); 505int __memcg_charge_slab(struct kmem_cache *cachep, gfp_t gfp, int order);
510int __kmem_cache_destroy_memcg_children(struct kmem_cache *s); 506void __memcg_uncharge_slab(struct kmem_cache *cachep, int order);
507
508int __memcg_cleanup_cache_params(struct kmem_cache *s);
511 509
512/** 510/**
513 * memcg_kmem_newpage_charge: verify if a new kmem allocation is allowed. 511 * memcg_kmem_newpage_charge: verify if a new kmem allocation is allowed.
@@ -534,7 +532,7 @@ memcg_kmem_newpage_charge(gfp_t gfp, struct mem_cgroup **memcg, int order)
534 * res_counter_charge_nofail, but we hope those allocations are rare, 532 * res_counter_charge_nofail, but we hope those allocations are rare,
535 * and won't be worth the trouble. 533 * and won't be worth the trouble.
536 */ 534 */
537 if (!(gfp & __GFP_KMEMCG) || (gfp & __GFP_NOFAIL)) 535 if (gfp & __GFP_NOFAIL)
538 return true; 536 return true;
539 if (in_interrupt() || (!current->mm) || (current->flags & PF_KTHREAD)) 537 if (in_interrupt() || (!current->mm) || (current->flags & PF_KTHREAD))
540 return true; 538 return true;
@@ -583,17 +581,7 @@ memcg_kmem_commit_charge(struct page *page, struct mem_cgroup *memcg, int order)
583 * @cachep: the original global kmem cache 581 * @cachep: the original global kmem cache
584 * @gfp: allocation flags. 582 * @gfp: allocation flags.
585 * 583 *
586 * This function assumes that the task allocating, which determines the memcg 584 * All memory allocated from a per-memcg cache is charged to the owner memcg.
587 * in the page allocator, belongs to the same cgroup throughout the whole
588 * process. Misacounting can happen if the task calls memcg_kmem_get_cache()
589 * while belonging to a cgroup, and later on changes. This is considered
590 * acceptable, and should only happen upon task migration.
591 *
592 * Before the cache is created by the memcg core, there is also a possible
593 * imbalance: the task belongs to a memcg, but the cache being allocated from
594 * is the global cache, since the child cache is not yet guaranteed to be
595 * ready. This case is also fine, since in this case the GFP_KMEMCG will not be
596 * passed and the page allocator will not attempt any cgroup accounting.
597 */ 585 */
598static __always_inline struct kmem_cache * 586static __always_inline struct kmem_cache *
599memcg_kmem_get_cache(struct kmem_cache *cachep, gfp_t gfp) 587memcg_kmem_get_cache(struct kmem_cache *cachep, gfp_t gfp)
@@ -648,14 +636,6 @@ static inline void memcg_free_cache_params(struct kmem_cache *s)
648{ 636{
649} 637}
650 638
651static inline void memcg_register_cache(struct kmem_cache *s)
652{
653}
654
655static inline void memcg_unregister_cache(struct kmem_cache *s)
656{
657}
658
659static inline struct kmem_cache * 639static inline struct kmem_cache *
660memcg_kmem_get_cache(struct kmem_cache *cachep, gfp_t gfp) 640memcg_kmem_get_cache(struct kmem_cache *cachep, gfp_t gfp)
661{ 641{
diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h
index 4ca3d951fe91..010d125bffbf 100644
--- a/include/linux/memory_hotplug.h
+++ b/include/linux/memory_hotplug.h
@@ -187,14 +187,8 @@ extern void put_page_bootmem(struct page *page);
187extern void get_page_bootmem(unsigned long ingo, struct page *page, 187extern void get_page_bootmem(unsigned long ingo, struct page *page,
188 unsigned long type); 188 unsigned long type);
189 189
190/* 190void get_online_mems(void);
191 * Lock for memory hotplug guarantees 1) all callbacks for memory hotplug 191void put_online_mems(void);
192 * notifier will be called under this. 2) offline/online/add/remove memory
193 * will not run simultaneously.
194 */
195
196void lock_memory_hotplug(void);
197void unlock_memory_hotplug(void);
198 192
199#else /* ! CONFIG_MEMORY_HOTPLUG */ 193#else /* ! CONFIG_MEMORY_HOTPLUG */
200/* 194/*
@@ -232,8 +226,8 @@ static inline int try_online_node(int nid)
232 return 0; 226 return 0;
233} 227}
234 228
235static inline void lock_memory_hotplug(void) {} 229static inline void get_online_mems(void) {}
236static inline void unlock_memory_hotplug(void) {} 230static inline void put_online_mems(void) {}
237 231
238#endif /* ! CONFIG_MEMORY_HOTPLUG */ 232#endif /* ! CONFIG_MEMORY_HOTPLUG */
239 233
diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h
index 3c1b968da0ca..f230a978e6ba 100644
--- a/include/linux/mempolicy.h
+++ b/include/linux/mempolicy.h
@@ -175,6 +175,12 @@ static inline int vma_migratable(struct vm_area_struct *vma)
175{ 175{
176 if (vma->vm_flags & (VM_IO | VM_PFNMAP)) 176 if (vma->vm_flags & (VM_IO | VM_PFNMAP))
177 return 0; 177 return 0;
178
179#ifndef CONFIG_ARCH_ENABLE_HUGEPAGE_MIGRATION
180 if (vma->vm_flags & VM_HUGETLB)
181 return 0;
182#endif
183
178 /* 184 /*
179 * Migration allocates pages in the highest zone. If we cannot 185 * Migration allocates pages in the highest zone. If we cannot
180 * do so then migration (at least from node to node) is not 186 * do so then migration (at least from node to node) is not
diff --git a/include/linux/mfd/abx500.h b/include/linux/mfd/abx500.h
index 3301b2031c8d..552cc1d61cc7 100644
--- a/include/linux/mfd/abx500.h
+++ b/include/linux/mfd/abx500.h
@@ -330,7 +330,6 @@ int abx500_mask_and_set_register_interruptible(struct device *dev, u8 bank,
330int abx500_get_chip_id(struct device *dev); 330int abx500_get_chip_id(struct device *dev);
331int abx500_event_registers_startup_state_get(struct device *dev, u8 *event); 331int abx500_event_registers_startup_state_get(struct device *dev, u8 *event);
332int abx500_startup_irq_enabled(struct device *dev, unsigned int irq); 332int abx500_startup_irq_enabled(struct device *dev, unsigned int irq);
333void abx500_dump_all_banks(void);
334 333
335struct abx500_ops { 334struct abx500_ops {
336 int (*get_chip_id) (struct device *); 335 int (*get_chip_id) (struct device *);
diff --git a/include/linux/mfd/arizona/core.h b/include/linux/mfd/arizona/core.h
index 5cf8b91ce996..6d9371f88875 100644
--- a/include/linux/mfd/arizona/core.h
+++ b/include/linux/mfd/arizona/core.h
@@ -124,4 +124,7 @@ int wm5102_patch(struct arizona *arizona);
124int wm5110_patch(struct arizona *arizona); 124int wm5110_patch(struct arizona *arizona);
125int wm8997_patch(struct arizona *arizona); 125int wm8997_patch(struct arizona *arizona);
126 126
127extern int arizona_of_get_named_gpio(struct arizona *arizona, const char *prop,
128 bool mandatory);
129
127#endif 130#endif
diff --git a/include/linux/mfd/arizona/registers.h b/include/linux/mfd/arizona/registers.h
index 7b35c21170d5..7204d8138b24 100644
--- a/include/linux/mfd/arizona/registers.h
+++ b/include/linux/mfd/arizona/registers.h
@@ -42,12 +42,14 @@
42#define ARIZONA_SAMPLE_RATE_SEQUENCE_SELECT_2 0x62 42#define ARIZONA_SAMPLE_RATE_SEQUENCE_SELECT_2 0x62
43#define ARIZONA_SAMPLE_RATE_SEQUENCE_SELECT_3 0x63 43#define ARIZONA_SAMPLE_RATE_SEQUENCE_SELECT_3 0x63
44#define ARIZONA_SAMPLE_RATE_SEQUENCE_SELECT_4 0x64 44#define ARIZONA_SAMPLE_RATE_SEQUENCE_SELECT_4 0x64
45#define ARIZONA_ALWAYS_ON_TRIGGERS_SEQUENCE_SELECT_1 0x68 45#define ARIZONA_ALWAYS_ON_TRIGGERS_SEQUENCE_SELECT_1 0x66
46#define ARIZONA_ALWAYS_ON_TRIGGERS_SEQUENCE_SELECT_2 0x69 46#define ARIZONA_ALWAYS_ON_TRIGGERS_SEQUENCE_SELECT_2 0x67
47#define ARIZONA_ALWAYS_ON_TRIGGERS_SEQUENCE_SELECT_3 0x6A 47#define ARIZONA_ALWAYS_ON_TRIGGERS_SEQUENCE_SELECT_3 0x68
48#define ARIZONA_ALWAYS_ON_TRIGGERS_SEQUENCE_SELECT_4 0x6B 48#define ARIZONA_ALWAYS_ON_TRIGGERS_SEQUENCE_SELECT_4 0x69
49#define ARIZONA_ALWAYS_ON_TRIGGERS_SEQUENCE_SELECT_5 0x6C 49#define ARIZONA_ALWAYS_ON_TRIGGERS_SEQUENCE_SELECT_5 0x6A
50#define ARIZONA_ALWAYS_ON_TRIGGERS_SEQUENCE_SELECT_6 0x6D 50#define ARIZONA_ALWAYS_ON_TRIGGERS_SEQUENCE_SELECT_6 0x6B
51#define ARIZONA_ALWAYS_ON_TRIGGERS_SEQUENCE_SELECT_7 0x6C
52#define ARIZONA_ALWAYS_ON_TRIGGERS_SEQUENCE_SELECT_8 0x6D
51#define ARIZONA_COMFORT_NOISE_GENERATOR 0x70 53#define ARIZONA_COMFORT_NOISE_GENERATOR 0x70
52#define ARIZONA_HAPTICS_CONTROL_1 0x90 54#define ARIZONA_HAPTICS_CONTROL_1 0x90
53#define ARIZONA_HAPTICS_CONTROL_2 0x91 55#define ARIZONA_HAPTICS_CONTROL_2 0x91
diff --git a/include/linux/mfd/axp20x.h b/include/linux/mfd/axp20x.h
new file mode 100644
index 000000000000..d0e31a2287ac
--- /dev/null
+++ b/include/linux/mfd/axp20x.h
@@ -0,0 +1,180 @@
1/*
2 * Functions and registers to access AXP20X power management chip.
3 *
4 * Copyright (C) 2013, Carlo Caione <carlo@caione.org>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifndef __LINUX_MFD_AXP20X_H
12#define __LINUX_MFD_AXP20X_H
13
14enum {
15 AXP202_ID = 0,
16 AXP209_ID,
17};
18
19#define AXP20X_DATACACHE(m) (0x04 + (m))
20
21/* Power supply */
22#define AXP20X_PWR_INPUT_STATUS 0x00
23#define AXP20X_PWR_OP_MODE 0x01
24#define AXP20X_USB_OTG_STATUS 0x02
25#define AXP20X_PWR_OUT_CTRL 0x12
26#define AXP20X_DCDC2_V_OUT 0x23
27#define AXP20X_DCDC2_LDO3_V_SCAL 0x25
28#define AXP20X_DCDC3_V_OUT 0x27
29#define AXP20X_LDO24_V_OUT 0x28
30#define AXP20X_LDO3_V_OUT 0x29
31#define AXP20X_VBUS_IPSOUT_MGMT 0x30
32#define AXP20X_V_OFF 0x31
33#define AXP20X_OFF_CTRL 0x32
34#define AXP20X_CHRG_CTRL1 0x33
35#define AXP20X_CHRG_CTRL2 0x34
36#define AXP20X_CHRG_BAK_CTRL 0x35
37#define AXP20X_PEK_KEY 0x36
38#define AXP20X_DCDC_FREQ 0x37
39#define AXP20X_V_LTF_CHRG 0x38
40#define AXP20X_V_HTF_CHRG 0x39
41#define AXP20X_APS_WARN_L1 0x3a
42#define AXP20X_APS_WARN_L2 0x3b
43#define AXP20X_V_LTF_DISCHRG 0x3c
44#define AXP20X_V_HTF_DISCHRG 0x3d
45
46/* Interrupt */
47#define AXP20X_IRQ1_EN 0x40
48#define AXP20X_IRQ2_EN 0x41
49#define AXP20X_IRQ3_EN 0x42
50#define AXP20X_IRQ4_EN 0x43
51#define AXP20X_IRQ5_EN 0x44
52#define AXP20X_IRQ1_STATE 0x48
53#define AXP20X_IRQ2_STATE 0x49
54#define AXP20X_IRQ3_STATE 0x4a
55#define AXP20X_IRQ4_STATE 0x4b
56#define AXP20X_IRQ5_STATE 0x4c
57
58/* ADC */
59#define AXP20X_ACIN_V_ADC_H 0x56
60#define AXP20X_ACIN_V_ADC_L 0x57
61#define AXP20X_ACIN_I_ADC_H 0x58
62#define AXP20X_ACIN_I_ADC_L 0x59
63#define AXP20X_VBUS_V_ADC_H 0x5a
64#define AXP20X_VBUS_V_ADC_L 0x5b
65#define AXP20X_VBUS_I_ADC_H 0x5c
66#define AXP20X_VBUS_I_ADC_L 0x5d
67#define AXP20X_TEMP_ADC_H 0x5e
68#define AXP20X_TEMP_ADC_L 0x5f
69#define AXP20X_TS_IN_H 0x62
70#define AXP20X_TS_IN_L 0x63
71#define AXP20X_GPIO0_V_ADC_H 0x64
72#define AXP20X_GPIO0_V_ADC_L 0x65
73#define AXP20X_GPIO1_V_ADC_H 0x66
74#define AXP20X_GPIO1_V_ADC_L 0x67
75#define AXP20X_PWR_BATT_H 0x70
76#define AXP20X_PWR_BATT_M 0x71
77#define AXP20X_PWR_BATT_L 0x72
78#define AXP20X_BATT_V_H 0x78
79#define AXP20X_BATT_V_L 0x79
80#define AXP20X_BATT_CHRG_I_H 0x7a
81#define AXP20X_BATT_CHRG_I_L 0x7b
82#define AXP20X_BATT_DISCHRG_I_H 0x7c
83#define AXP20X_BATT_DISCHRG_I_L 0x7d
84#define AXP20X_IPSOUT_V_HIGH_H 0x7e
85#define AXP20X_IPSOUT_V_HIGH_L 0x7f
86
87/* Power supply */
88#define AXP20X_DCDC_MODE 0x80
89#define AXP20X_ADC_EN1 0x82
90#define AXP20X_ADC_EN2 0x83
91#define AXP20X_ADC_RATE 0x84
92#define AXP20X_GPIO10_IN_RANGE 0x85
93#define AXP20X_GPIO1_ADC_IRQ_RIS 0x86
94#define AXP20X_GPIO1_ADC_IRQ_FAL 0x87
95#define AXP20X_TIMER_CTRL 0x8a
96#define AXP20X_VBUS_MON 0x8b
97#define AXP20X_OVER_TMP 0x8f
98
99/* GPIO */
100#define AXP20X_GPIO0_CTRL 0x90
101#define AXP20X_LDO5_V_OUT 0x91
102#define AXP20X_GPIO1_CTRL 0x92
103#define AXP20X_GPIO2_CTRL 0x93
104#define AXP20X_GPIO20_SS 0x94
105#define AXP20X_GPIO3_CTRL 0x95
106
107/* Battery */
108#define AXP20X_CHRG_CC_31_24 0xb0
109#define AXP20X_CHRG_CC_23_16 0xb1
110#define AXP20X_CHRG_CC_15_8 0xb2
111#define AXP20X_CHRG_CC_7_0 0xb3
112#define AXP20X_DISCHRG_CC_31_24 0xb4
113#define AXP20X_DISCHRG_CC_23_16 0xb5
114#define AXP20X_DISCHRG_CC_15_8 0xb6
115#define AXP20X_DISCHRG_CC_7_0 0xb7
116#define AXP20X_CC_CTRL 0xb8
117#define AXP20X_FG_RES 0xb9
118
119/* Regulators IDs */
120enum {
121 AXP20X_LDO1 = 0,
122 AXP20X_LDO2,
123 AXP20X_LDO3,
124 AXP20X_LDO4,
125 AXP20X_LDO5,
126 AXP20X_DCDC2,
127 AXP20X_DCDC3,
128 AXP20X_REG_ID_MAX,
129};
130
131/* IRQs */
132enum {
133 AXP20X_IRQ_ACIN_OVER_V = 1,
134 AXP20X_IRQ_ACIN_PLUGIN,
135 AXP20X_IRQ_ACIN_REMOVAL,
136 AXP20X_IRQ_VBUS_OVER_V,
137 AXP20X_IRQ_VBUS_PLUGIN,
138 AXP20X_IRQ_VBUS_REMOVAL,
139 AXP20X_IRQ_VBUS_V_LOW,
140 AXP20X_IRQ_BATT_PLUGIN,
141 AXP20X_IRQ_BATT_REMOVAL,
142 AXP20X_IRQ_BATT_ENT_ACT_MODE,
143 AXP20X_IRQ_BATT_EXIT_ACT_MODE,
144 AXP20X_IRQ_CHARG,
145 AXP20X_IRQ_CHARG_DONE,
146 AXP20X_IRQ_BATT_TEMP_HIGH,
147 AXP20X_IRQ_BATT_TEMP_LOW,
148 AXP20X_IRQ_DIE_TEMP_HIGH,
149 AXP20X_IRQ_CHARG_I_LOW,
150 AXP20X_IRQ_DCDC1_V_LONG,
151 AXP20X_IRQ_DCDC2_V_LONG,
152 AXP20X_IRQ_DCDC3_V_LONG,
153 AXP20X_IRQ_PEK_SHORT = 22,
154 AXP20X_IRQ_PEK_LONG,
155 AXP20X_IRQ_N_OE_PWR_ON,
156 AXP20X_IRQ_N_OE_PWR_OFF,
157 AXP20X_IRQ_VBUS_VALID,
158 AXP20X_IRQ_VBUS_NOT_VALID,
159 AXP20X_IRQ_VBUS_SESS_VALID,
160 AXP20X_IRQ_VBUS_SESS_END,
161 AXP20X_IRQ_LOW_PWR_LVL1,
162 AXP20X_IRQ_LOW_PWR_LVL2,
163 AXP20X_IRQ_TIMER,
164 AXP20X_IRQ_PEK_RIS_EDGE,
165 AXP20X_IRQ_PEK_FAL_EDGE,
166 AXP20X_IRQ_GPIO3_INPUT,
167 AXP20X_IRQ_GPIO2_INPUT,
168 AXP20X_IRQ_GPIO1_INPUT,
169 AXP20X_IRQ_GPIO0_INPUT,
170};
171
172struct axp20x_dev {
173 struct device *dev;
174 struct i2c_client *i2c_client;
175 struct regmap *regmap;
176 struct regmap_irq_chip_data *regmap_irqc;
177 long variant;
178};
179
180#endif /* __LINUX_MFD_AXP20X_H */
diff --git a/include/linux/mfd/bcm590xx.h b/include/linux/mfd/bcm590xx.h
index 434df2d4e587..267aedee1c7a 100644
--- a/include/linux/mfd/bcm590xx.h
+++ b/include/linux/mfd/bcm590xx.h
@@ -19,12 +19,15 @@
19#include <linux/regmap.h> 19#include <linux/regmap.h>
20 20
21/* max register address */ 21/* max register address */
22#define BCM590XX_MAX_REGISTER 0xe7 22#define BCM590XX_MAX_REGISTER_PRI 0xe7
23#define BCM590XX_MAX_REGISTER_SEC 0xf0
23 24
24struct bcm590xx { 25struct bcm590xx {
25 struct device *dev; 26 struct device *dev;
26 struct i2c_client *i2c_client; 27 struct i2c_client *i2c_pri;
27 struct regmap *regmap; 28 struct i2c_client *i2c_sec;
29 struct regmap *regmap_pri;
30 struct regmap *regmap_sec;
28 unsigned int id; 31 unsigned int id;
29}; 32};
30 33
diff --git a/include/linux/mfd/core.h b/include/linux/mfd/core.h
index bdba8c61207b..f543de91ce19 100644
--- a/include/linux/mfd/core.h
+++ b/include/linux/mfd/core.h
@@ -63,7 +63,7 @@ struct mfd_cell {
63 /* A list of regulator supplies that should be mapped to the MFD 63 /* A list of regulator supplies that should be mapped to the MFD
64 * device rather than the child device when requested 64 * device rather than the child device when requested
65 */ 65 */
66 const char **parent_supplies; 66 const char * const *parent_supplies;
67 int num_parent_supplies; 67 int num_parent_supplies;
68}; 68};
69 69
diff --git a/include/linux/mfd/cros_ec.h b/include/linux/mfd/cros_ec.h
index 032af7fc5b2e..887ef4f7bef7 100644
--- a/include/linux/mfd/cros_ec.h
+++ b/include/linux/mfd/cros_ec.h
@@ -29,8 +29,8 @@ enum {
29 EC_MSG_RX_PROTO_BYTES = 3, 29 EC_MSG_RX_PROTO_BYTES = 3,
30 30
31 /* Max length of messages */ 31 /* Max length of messages */
32 EC_MSG_BYTES = EC_HOST_PARAM_SIZE + EC_MSG_TX_PROTO_BYTES, 32 EC_MSG_BYTES = EC_PROTO2_MAX_PARAM_SIZE +
33 33 EC_MSG_TX_PROTO_BYTES,
34}; 34};
35 35
36/** 36/**
diff --git a/include/linux/mfd/cros_ec_commands.h b/include/linux/mfd/cros_ec_commands.h
index 86fd06953bcd..7853a6410d14 100644
--- a/include/linux/mfd/cros_ec_commands.h
+++ b/include/linux/mfd/cros_ec_commands.h
@@ -24,25 +24,12 @@
24#define __CROS_EC_COMMANDS_H 24#define __CROS_EC_COMMANDS_H
25 25
26/* 26/*
27 * Protocol overview 27 * Current version of this protocol
28 * 28 *
29 * request: CMD [ P0 P1 P2 ... Pn S ] 29 * TODO(crosbug.com/p/11223): This is effectively useless; protocol is
30 * response: ERR [ P0 P1 P2 ... Pn S ] 30 * determined in other ways. Remove this once the kernel code no longer
31 * 31 * depends on it.
32 * where the bytes are defined as follow :
33 * - CMD is the command code. (defined by EC_CMD_ constants)
34 * - ERR is the error code. (defined by EC_RES_ constants)
35 * - Px is the optional payload.
36 * it is not sent if the error code is not success.
37 * (defined by ec_params_ and ec_response_ structures)
38 * - S is the checksum which is the sum of all payload bytes.
39 *
40 * On LPC, CMD and ERR are sent/received at EC_LPC_ADDR_KERNEL|USER_CMD
41 * and the payloads are sent/received at EC_LPC_ADDR_KERNEL|USER_PARAM.
42 * On I2C, all bytes are sent serially in the same message.
43 */ 32 */
44
45/* Current version of this protocol */
46#define EC_PROTO_VERSION 0x00000002 33#define EC_PROTO_VERSION 0x00000002
47 34
48/* Command version mask */ 35/* Command version mask */
@@ -57,13 +44,19 @@
57#define EC_LPC_ADDR_HOST_CMD 0x204 44#define EC_LPC_ADDR_HOST_CMD 0x204
58 45
59/* I/O addresses for host command args and params */ 46/* I/O addresses for host command args and params */
60#define EC_LPC_ADDR_HOST_ARGS 0x800 47/* Protocol version 2 */
61#define EC_LPC_ADDR_HOST_PARAM 0x804 48#define EC_LPC_ADDR_HOST_ARGS 0x800 /* And 0x801, 0x802, 0x803 */
62#define EC_HOST_PARAM_SIZE 0x0fc /* Size of param area in bytes */ 49#define EC_LPC_ADDR_HOST_PARAM 0x804 /* For version 2 params; size is
63 50 * EC_PROTO2_MAX_PARAM_SIZE */
64/* I/O addresses for host command params, old interface */ 51/* Protocol version 3 */
65#define EC_LPC_ADDR_OLD_PARAM 0x880 52#define EC_LPC_ADDR_HOST_PACKET 0x800 /* Offset of version 3 packet */
66#define EC_OLD_PARAM_SIZE 0x080 /* Size of param area in bytes */ 53#define EC_LPC_HOST_PACKET_SIZE 0x100 /* Max size of version 3 packet */
54
55/* The actual block is 0x800-0x8ff, but some BIOSes think it's 0x880-0x8ff
56 * and they tell the kernel that so we have to think of it as two parts. */
57#define EC_HOST_CMD_REGION0 0x800
58#define EC_HOST_CMD_REGION1 0x880
59#define EC_HOST_CMD_REGION_SIZE 0x80
67 60
68/* EC command register bit functions */ 61/* EC command register bit functions */
69#define EC_LPC_CMDR_DATA (1 << 0) /* Data ready for host to read */ 62#define EC_LPC_CMDR_DATA (1 << 0) /* Data ready for host to read */
@@ -79,18 +72,22 @@
79#define EC_MEMMAP_TEXT_MAX 8 /* Size of a string in the memory map */ 72#define EC_MEMMAP_TEXT_MAX 8 /* Size of a string in the memory map */
80 73
81/* The offset address of each type of data in mapped memory. */ 74/* The offset address of each type of data in mapped memory. */
82#define EC_MEMMAP_TEMP_SENSOR 0x00 /* Temp sensors */ 75#define EC_MEMMAP_TEMP_SENSOR 0x00 /* Temp sensors 0x00 - 0x0f */
83#define EC_MEMMAP_FAN 0x10 /* Fan speeds */ 76#define EC_MEMMAP_FAN 0x10 /* Fan speeds 0x10 - 0x17 */
84#define EC_MEMMAP_TEMP_SENSOR_B 0x18 /* Temp sensors (second set) */ 77#define EC_MEMMAP_TEMP_SENSOR_B 0x18 /* More temp sensors 0x18 - 0x1f */
85#define EC_MEMMAP_ID 0x20 /* 'E' 'C' */ 78#define EC_MEMMAP_ID 0x20 /* 0x20 == 'E', 0x21 == 'C' */
86#define EC_MEMMAP_ID_VERSION 0x22 /* Version of data in 0x20 - 0x2f */ 79#define EC_MEMMAP_ID_VERSION 0x22 /* Version of data in 0x20 - 0x2f */
87#define EC_MEMMAP_THERMAL_VERSION 0x23 /* Version of data in 0x00 - 0x1f */ 80#define EC_MEMMAP_THERMAL_VERSION 0x23 /* Version of data in 0x00 - 0x1f */
88#define EC_MEMMAP_BATTERY_VERSION 0x24 /* Version of data in 0x40 - 0x7f */ 81#define EC_MEMMAP_BATTERY_VERSION 0x24 /* Version of data in 0x40 - 0x7f */
89#define EC_MEMMAP_SWITCHES_VERSION 0x25 /* Version of data in 0x30 - 0x33 */ 82#define EC_MEMMAP_SWITCHES_VERSION 0x25 /* Version of data in 0x30 - 0x33 */
90#define EC_MEMMAP_EVENTS_VERSION 0x26 /* Version of data in 0x34 - 0x3f */ 83#define EC_MEMMAP_EVENTS_VERSION 0x26 /* Version of data in 0x34 - 0x3f */
91#define EC_MEMMAP_HOST_CMD_FLAGS 0x27 /* Host command interface flags */ 84#define EC_MEMMAP_HOST_CMD_FLAGS 0x27 /* Host cmd interface flags (8 bits) */
92#define EC_MEMMAP_SWITCHES 0x30 85/* Unused 0x28 - 0x2f */
93#define EC_MEMMAP_HOST_EVENTS 0x34 86#define EC_MEMMAP_SWITCHES 0x30 /* 8 bits */
87/* Unused 0x31 - 0x33 */
88#define EC_MEMMAP_HOST_EVENTS 0x34 /* 32 bits */
89/* Reserve 0x38 - 0x3f for additional host event-related stuff */
90/* Battery values are all 32 bits */
94#define EC_MEMMAP_BATT_VOLT 0x40 /* Battery Present Voltage */ 91#define EC_MEMMAP_BATT_VOLT 0x40 /* Battery Present Voltage */
95#define EC_MEMMAP_BATT_RATE 0x44 /* Battery Present Rate */ 92#define EC_MEMMAP_BATT_RATE 0x44 /* Battery Present Rate */
96#define EC_MEMMAP_BATT_CAP 0x48 /* Battery Remaining Capacity */ 93#define EC_MEMMAP_BATT_CAP 0x48 /* Battery Remaining Capacity */
@@ -99,10 +96,24 @@
99#define EC_MEMMAP_BATT_DVLT 0x54 /* Battery Design Voltage */ 96#define EC_MEMMAP_BATT_DVLT 0x54 /* Battery Design Voltage */
100#define EC_MEMMAP_BATT_LFCC 0x58 /* Battery Last Full Charge Capacity */ 97#define EC_MEMMAP_BATT_LFCC 0x58 /* Battery Last Full Charge Capacity */
101#define EC_MEMMAP_BATT_CCNT 0x5c /* Battery Cycle Count */ 98#define EC_MEMMAP_BATT_CCNT 0x5c /* Battery Cycle Count */
99/* Strings are all 8 bytes (EC_MEMMAP_TEXT_MAX) */
102#define EC_MEMMAP_BATT_MFGR 0x60 /* Battery Manufacturer String */ 100#define EC_MEMMAP_BATT_MFGR 0x60 /* Battery Manufacturer String */
103#define EC_MEMMAP_BATT_MODEL 0x68 /* Battery Model Number String */ 101#define EC_MEMMAP_BATT_MODEL 0x68 /* Battery Model Number String */
104#define EC_MEMMAP_BATT_SERIAL 0x70 /* Battery Serial Number String */ 102#define EC_MEMMAP_BATT_SERIAL 0x70 /* Battery Serial Number String */
105#define EC_MEMMAP_BATT_TYPE 0x78 /* Battery Type String */ 103#define EC_MEMMAP_BATT_TYPE 0x78 /* Battery Type String */
104#define EC_MEMMAP_ALS 0x80 /* ALS readings in lux (2 X 16 bits) */
105/* Unused 0x84 - 0x8f */
106#define EC_MEMMAP_ACC_STATUS 0x90 /* Accelerometer status (8 bits )*/
107/* Unused 0x91 */
108#define EC_MEMMAP_ACC_DATA 0x92 /* Accelerometer data 0x92 - 0x9f */
109#define EC_MEMMAP_GYRO_DATA 0xa0 /* Gyroscope data 0xa0 - 0xa5 */
110/* Unused 0xa6 - 0xfe (remember, 0xff is NOT part of the memmap region) */
111
112
113/* Define the format of the accelerometer mapped memory status byte. */
114#define EC_MEMMAP_ACC_STATUS_SAMPLE_ID_MASK 0x0f
115#define EC_MEMMAP_ACC_STATUS_BUSY_BIT (1 << 4)
116#define EC_MEMMAP_ACC_STATUS_PRESENCE_BIT (1 << 7)
106 117
107/* Number of temp sensors at EC_MEMMAP_TEMP_SENSOR */ 118/* Number of temp sensors at EC_MEMMAP_TEMP_SENSOR */
108#define EC_TEMP_SENSOR_ENTRIES 16 119#define EC_TEMP_SENSOR_ENTRIES 16
@@ -112,6 +123,8 @@
112 * Valid only if EC_MEMMAP_THERMAL_VERSION returns >= 2. 123 * Valid only if EC_MEMMAP_THERMAL_VERSION returns >= 2.
113 */ 124 */
114#define EC_TEMP_SENSOR_B_ENTRIES 8 125#define EC_TEMP_SENSOR_B_ENTRIES 8
126
127/* Special values for mapped temperature sensors */
115#define EC_TEMP_SENSOR_NOT_PRESENT 0xff 128#define EC_TEMP_SENSOR_NOT_PRESENT 0xff
116#define EC_TEMP_SENSOR_ERROR 0xfe 129#define EC_TEMP_SENSOR_ERROR 0xfe
117#define EC_TEMP_SENSOR_NOT_POWERED 0xfd 130#define EC_TEMP_SENSOR_NOT_POWERED 0xfd
@@ -122,6 +135,18 @@
122 */ 135 */
123#define EC_TEMP_SENSOR_OFFSET 200 136#define EC_TEMP_SENSOR_OFFSET 200
124 137
138/*
139 * Number of ALS readings at EC_MEMMAP_ALS
140 */
141#define EC_ALS_ENTRIES 2
142
143/*
144 * The default value a temperature sensor will return when it is present but
145 * has not been read this boot. This is a reasonable number to avoid
146 * triggering alarms on the host.
147 */
148#define EC_TEMP_SENSOR_DEFAULT (296 - EC_TEMP_SENSOR_OFFSET)
149
125#define EC_FAN_SPEED_ENTRIES 4 /* Number of fans at EC_MEMMAP_FAN */ 150#define EC_FAN_SPEED_ENTRIES 4 /* Number of fans at EC_MEMMAP_FAN */
126#define EC_FAN_SPEED_NOT_PRESENT 0xffff /* Entry not present */ 151#define EC_FAN_SPEED_NOT_PRESENT 0xffff /* Entry not present */
127#define EC_FAN_SPEED_STALLED 0xfffe /* Fan stalled */ 152#define EC_FAN_SPEED_STALLED 0xfffe /* Fan stalled */
@@ -137,8 +162,8 @@
137#define EC_SWITCH_LID_OPEN 0x01 162#define EC_SWITCH_LID_OPEN 0x01
138#define EC_SWITCH_POWER_BUTTON_PRESSED 0x02 163#define EC_SWITCH_POWER_BUTTON_PRESSED 0x02
139#define EC_SWITCH_WRITE_PROTECT_DISABLED 0x04 164#define EC_SWITCH_WRITE_PROTECT_DISABLED 0x04
140/* Recovery requested via keyboard */ 165/* Was recovery requested via keyboard; now unused. */
141#define EC_SWITCH_KEYBOARD_RECOVERY 0x08 166#define EC_SWITCH_IGNORE1 0x08
142/* Recovery requested via dedicated signal (from servo board) */ 167/* Recovery requested via dedicated signal (from servo board) */
143#define EC_SWITCH_DEDICATED_RECOVERY 0x10 168#define EC_SWITCH_DEDICATED_RECOVERY 0x10
144/* Was fake developer mode switch; now unused. Remove in next refactor. */ 169/* Was fake developer mode switch; now unused. Remove in next refactor. */
@@ -147,10 +172,15 @@
147/* Host command interface flags */ 172/* Host command interface flags */
148/* Host command interface supports LPC args (LPC interface only) */ 173/* Host command interface supports LPC args (LPC interface only) */
149#define EC_HOST_CMD_FLAG_LPC_ARGS_SUPPORTED 0x01 174#define EC_HOST_CMD_FLAG_LPC_ARGS_SUPPORTED 0x01
175/* Host command interface supports version 3 protocol */
176#define EC_HOST_CMD_FLAG_VERSION_3 0x02
150 177
151/* Wireless switch flags */ 178/* Wireless switch flags */
152#define EC_WIRELESS_SWITCH_WLAN 0x01 179#define EC_WIRELESS_SWITCH_ALL ~0x00 /* All flags */
153#define EC_WIRELESS_SWITCH_BLUETOOTH 0x02 180#define EC_WIRELESS_SWITCH_WLAN 0x01 /* WLAN radio */
181#define EC_WIRELESS_SWITCH_BLUETOOTH 0x02 /* Bluetooth radio */
182#define EC_WIRELESS_SWITCH_WWAN 0x04 /* WWAN power */
183#define EC_WIRELESS_SWITCH_WLAN_POWER 0x08 /* WLAN power */
154 184
155/* 185/*
156 * This header file is used in coreboot both in C and ACPI code. The ACPI code 186 * This header file is used in coreboot both in C and ACPI code. The ACPI code
@@ -159,6 +189,14 @@
159 */ 189 */
160#ifndef __ACPI__ 190#ifndef __ACPI__
161 191
192/*
193 * Define __packed if someone hasn't beat us to it. Linux kernel style
194 * checking prefers __packed over __attribute__((packed)).
195 */
196#ifndef __packed
197#define __packed __attribute__((packed))
198#endif
199
162/* LPC command status byte masks */ 200/* LPC command status byte masks */
163/* EC has written a byte in the data register and host hasn't read it yet */ 201/* EC has written a byte in the data register and host hasn't read it yet */
164#define EC_LPC_STATUS_TO_HOST 0x01 202#define EC_LPC_STATUS_TO_HOST 0x01
@@ -198,6 +236,9 @@ enum ec_status {
198 EC_RES_UNAVAILABLE = 9, /* No response available */ 236 EC_RES_UNAVAILABLE = 9, /* No response available */
199 EC_RES_TIMEOUT = 10, /* We got a timeout */ 237 EC_RES_TIMEOUT = 10, /* We got a timeout */
200 EC_RES_OVERFLOW = 11, /* Table / data overflow */ 238 EC_RES_OVERFLOW = 11, /* Table / data overflow */
239 EC_RES_INVALID_HEADER = 12, /* Header contains invalid data */
240 EC_RES_REQUEST_TRUNCATED = 13, /* Didn't get the entire request */
241 EC_RES_RESPONSE_TOO_BIG = 14 /* Response was too big to handle */
201}; 242};
202 243
203/* 244/*
@@ -235,6 +276,16 @@ enum host_event_code {
235 /* Shutdown due to battery level too low */ 276 /* Shutdown due to battery level too low */
236 EC_HOST_EVENT_BATTERY_SHUTDOWN = 17, 277 EC_HOST_EVENT_BATTERY_SHUTDOWN = 17,
237 278
279 /* Suggest that the AP throttle itself */
280 EC_HOST_EVENT_THROTTLE_START = 18,
281 /* Suggest that the AP resume normal speed */
282 EC_HOST_EVENT_THROTTLE_STOP = 19,
283
284 /* Hang detect logic detected a hang and host event timeout expired */
285 EC_HOST_EVENT_HANG_DETECT = 20,
286 /* Hang detect logic detected a hang and warm rebooted the AP */
287 EC_HOST_EVENT_HANG_REBOOT = 21,
288
238 /* 289 /*
239 * The high bit of the event mask is not used as a host event code. If 290 * The high bit of the event mask is not used as a host event code. If
240 * it reads back as set, then the entire event mask should be 291 * it reads back as set, then the entire event mask should be
@@ -279,6 +330,188 @@ struct ec_lpc_host_args {
279 */ 330 */
280#define EC_HOST_ARGS_FLAG_TO_HOST 0x02 331#define EC_HOST_ARGS_FLAG_TO_HOST 0x02
281 332
333/*****************************************************************************/
334/*
335 * Byte codes returned by EC over SPI interface.
336 *
337 * These can be used by the AP to debug the EC interface, and to determine
338 * when the EC is not in a state where it will ever get around to responding
339 * to the AP.
340 *
341 * Example of sequence of bytes read from EC for a current good transfer:
342 * 1. - - AP asserts chip select (CS#)
343 * 2. EC_SPI_OLD_READY - AP sends first byte(s) of request
344 * 3. - - EC starts handling CS# interrupt
345 * 4. EC_SPI_RECEIVING - AP sends remaining byte(s) of request
346 * 5. EC_SPI_PROCESSING - EC starts processing request; AP is clocking in
347 * bytes looking for EC_SPI_FRAME_START
348 * 6. - - EC finishes processing and sets up response
349 * 7. EC_SPI_FRAME_START - AP reads frame byte
350 * 8. (response packet) - AP reads response packet
351 * 9. EC_SPI_PAST_END - Any additional bytes read by AP
352 * 10 - - AP deasserts chip select
353 * 11 - - EC processes CS# interrupt and sets up DMA for
354 * next request
355 *
356 * If the AP is waiting for EC_SPI_FRAME_START and sees any value other than
357 * the following byte values:
358 * EC_SPI_OLD_READY
359 * EC_SPI_RX_READY
360 * EC_SPI_RECEIVING
361 * EC_SPI_PROCESSING
362 *
363 * Then the EC found an error in the request, or was not ready for the request
364 * and lost data. The AP should give up waiting for EC_SPI_FRAME_START,
365 * because the EC is unable to tell when the AP is done sending its request.
366 */
367
368/*
369 * Framing byte which precedes a response packet from the EC. After sending a
370 * request, the AP will clock in bytes until it sees the framing byte, then
371 * clock in the response packet.
372 */
373#define EC_SPI_FRAME_START 0xec
374
375/*
376 * Padding bytes which are clocked out after the end of a response packet.
377 */
378#define EC_SPI_PAST_END 0xed
379
380/*
381 * EC is ready to receive, and has ignored the byte sent by the AP. EC expects
382 * that the AP will send a valid packet header (starting with
383 * EC_COMMAND_PROTOCOL_3) in the next 32 bytes.
384 */
385#define EC_SPI_RX_READY 0xf8
386
387/*
388 * EC has started receiving the request from the AP, but hasn't started
389 * processing it yet.
390 */
391#define EC_SPI_RECEIVING 0xf9
392
393/* EC has received the entire request from the AP and is processing it. */
394#define EC_SPI_PROCESSING 0xfa
395
396/*
397 * EC received bad data from the AP, such as a packet header with an invalid
398 * length. EC will ignore all data until chip select deasserts.
399 */
400#define EC_SPI_RX_BAD_DATA 0xfb
401
402/*
403 * EC received data from the AP before it was ready. That is, the AP asserted
404 * chip select and started clocking data before the EC was ready to receive it.
405 * EC will ignore all data until chip select deasserts.
406 */
407#define EC_SPI_NOT_READY 0xfc
408
409/*
410 * EC was ready to receive a request from the AP. EC has treated the byte sent
411 * by the AP as part of a request packet, or (for old-style ECs) is processing
412 * a fully received packet but is not ready to respond yet.
413 */
414#define EC_SPI_OLD_READY 0xfd
415
416/*****************************************************************************/
417
418/*
419 * Protocol version 2 for I2C and SPI send a request this way:
420 *
421 * 0 EC_CMD_VERSION0 + (command version)
422 * 1 Command number
423 * 2 Length of params = N
424 * 3..N+2 Params, if any
425 * N+3 8-bit checksum of bytes 0..N+2
426 *
427 * The corresponding response is:
428 *
429 * 0 Result code (EC_RES_*)
430 * 1 Length of params = M
431 * 2..M+1 Params, if any
432 * M+2 8-bit checksum of bytes 0..M+1
433 */
434#define EC_PROTO2_REQUEST_HEADER_BYTES 3
435#define EC_PROTO2_REQUEST_TRAILER_BYTES 1
436#define EC_PROTO2_REQUEST_OVERHEAD (EC_PROTO2_REQUEST_HEADER_BYTES + \
437 EC_PROTO2_REQUEST_TRAILER_BYTES)
438
439#define EC_PROTO2_RESPONSE_HEADER_BYTES 2
440#define EC_PROTO2_RESPONSE_TRAILER_BYTES 1
441#define EC_PROTO2_RESPONSE_OVERHEAD (EC_PROTO2_RESPONSE_HEADER_BYTES + \
442 EC_PROTO2_RESPONSE_TRAILER_BYTES)
443
444/* Parameter length was limited by the LPC interface */
445#define EC_PROTO2_MAX_PARAM_SIZE 0xfc
446
447/* Maximum request and response packet sizes for protocol version 2 */
448#define EC_PROTO2_MAX_REQUEST_SIZE (EC_PROTO2_REQUEST_OVERHEAD + \
449 EC_PROTO2_MAX_PARAM_SIZE)
450#define EC_PROTO2_MAX_RESPONSE_SIZE (EC_PROTO2_RESPONSE_OVERHEAD + \
451 EC_PROTO2_MAX_PARAM_SIZE)
452
453/*****************************************************************************/
454
455/*
456 * Value written to legacy command port / prefix byte to indicate protocol
457 * 3+ structs are being used. Usage is bus-dependent.
458 */
459#define EC_COMMAND_PROTOCOL_3 0xda
460
461#define EC_HOST_REQUEST_VERSION 3
462
463/* Version 3 request from host */
464struct ec_host_request {
465 /* Struct version (=3)
466 *
467 * EC will return EC_RES_INVALID_HEADER if it receives a header with a
468 * version it doesn't know how to parse.
469 */
470 uint8_t struct_version;
471
472 /*
473 * Checksum of request and data; sum of all bytes including checksum
474 * should total to 0.
475 */
476 uint8_t checksum;
477
478 /* Command code */
479 uint16_t command;
480
481 /* Command version */
482 uint8_t command_version;
483
484 /* Unused byte in current protocol version; set to 0 */
485 uint8_t reserved;
486
487 /* Length of data which follows this header */
488 uint16_t data_len;
489} __packed;
490
491#define EC_HOST_RESPONSE_VERSION 3
492
493/* Version 3 response from EC */
494struct ec_host_response {
495 /* Struct version (=3) */
496 uint8_t struct_version;
497
498 /*
499 * Checksum of response and data; sum of all bytes including checksum
500 * should total to 0.
501 */
502 uint8_t checksum;
503
504 /* Result code (EC_RES_*) */
505 uint16_t result;
506
507 /* Length of data which follows this header */
508 uint16_t data_len;
509
510 /* Unused bytes in current protocol version; set to 0 */
511 uint16_t reserved;
512} __packed;
513
514/*****************************************************************************/
282/* 515/*
283 * Notes on commands: 516 * Notes on commands:
284 * 517 *
@@ -418,6 +651,68 @@ struct ec_response_get_comms_status {
418 uint32_t flags; /* Mask of enum ec_comms_status */ 651 uint32_t flags; /* Mask of enum ec_comms_status */
419} __packed; 652} __packed;
420 653
654/* Fake a variety of responses, purely for testing purposes. */
655#define EC_CMD_TEST_PROTOCOL 0x0a
656
657/* Tell the EC what to send back to us. */
658struct ec_params_test_protocol {
659 uint32_t ec_result;
660 uint32_t ret_len;
661 uint8_t buf[32];
662} __packed;
663
664/* Here it comes... */
665struct ec_response_test_protocol {
666 uint8_t buf[32];
667} __packed;
668
669/* Get prococol information */
670#define EC_CMD_GET_PROTOCOL_INFO 0x0b
671
672/* Flags for ec_response_get_protocol_info.flags */
673/* EC_RES_IN_PROGRESS may be returned if a command is slow */
674#define EC_PROTOCOL_INFO_IN_PROGRESS_SUPPORTED (1 << 0)
675
676struct ec_response_get_protocol_info {
677 /* Fields which exist if at least protocol version 3 supported */
678
679 /* Bitmask of protocol versions supported (1 << n means version n)*/
680 uint32_t protocol_versions;
681
682 /* Maximum request packet size, in bytes */
683 uint16_t max_request_packet_size;
684
685 /* Maximum response packet size, in bytes */
686 uint16_t max_response_packet_size;
687
688 /* Flags; see EC_PROTOCOL_INFO_* */
689 uint32_t flags;
690} __packed;
691
692
693/*****************************************************************************/
694/* Get/Set miscellaneous values */
695
696/* The upper byte of .flags tells what to do (nothing means "get") */
697#define EC_GSV_SET 0x80000000
698
699/* The lower three bytes of .flags identifies the parameter, if that has
700 meaning for an individual command. */
701#define EC_GSV_PARAM_MASK 0x00ffffff
702
703struct ec_params_get_set_value {
704 uint32_t flags;
705 uint32_t value;
706} __packed;
707
708struct ec_response_get_set_value {
709 uint32_t flags;
710 uint32_t value;
711} __packed;
712
713/* More than one command can use these structs to get/set paramters. */
714#define EC_CMD_GSV_PAUSE_IN_S5 0x0c
715
421 716
422/*****************************************************************************/ 717/*****************************************************************************/
423/* Flash commands */ 718/* Flash commands */
@@ -425,6 +720,7 @@ struct ec_response_get_comms_status {
425/* Get flash info */ 720/* Get flash info */
426#define EC_CMD_FLASH_INFO 0x10 721#define EC_CMD_FLASH_INFO 0x10
427 722
723/* Version 0 returns these fields */
428struct ec_response_flash_info { 724struct ec_response_flash_info {
429 /* Usable flash size, in bytes */ 725 /* Usable flash size, in bytes */
430 uint32_t flash_size; 726 uint32_t flash_size;
@@ -445,6 +741,37 @@ struct ec_response_flash_info {
445 uint32_t protect_block_size; 741 uint32_t protect_block_size;
446} __packed; 742} __packed;
447 743
744/* Flags for version 1+ flash info command */
745/* EC flash erases bits to 0 instead of 1 */
746#define EC_FLASH_INFO_ERASE_TO_0 (1 << 0)
747
748/*
749 * Version 1 returns the same initial fields as version 0, with additional
750 * fields following.
751 *
752 * gcc anonymous structs don't seem to get along with the __packed directive;
753 * if they did we'd define the version 0 struct as a sub-struct of this one.
754 */
755struct ec_response_flash_info_1 {
756 /* Version 0 fields; see above for description */
757 uint32_t flash_size;
758 uint32_t write_block_size;
759 uint32_t erase_block_size;
760 uint32_t protect_block_size;
761
762 /* Version 1 adds these fields: */
763 /*
764 * Ideal write size in bytes. Writes will be fastest if size is
765 * exactly this and offset is a multiple of this. For example, an EC
766 * may have a write buffer which can do half-page operations if data is
767 * aligned, and a slower word-at-a-time write mode.
768 */
769 uint32_t write_ideal_size;
770
771 /* Flags; see EC_FLASH_INFO_* */
772 uint32_t flags;
773} __packed;
774
448/* 775/*
449 * Read flash 776 * Read flash
450 * 777 *
@@ -459,15 +786,15 @@ struct ec_params_flash_read {
459 786
460/* Write flash */ 787/* Write flash */
461#define EC_CMD_FLASH_WRITE 0x12 788#define EC_CMD_FLASH_WRITE 0x12
789#define EC_VER_FLASH_WRITE 1
790
791/* Version 0 of the flash command supported only 64 bytes of data */
792#define EC_FLASH_WRITE_VER0_SIZE 64
462 793
463struct ec_params_flash_write { 794struct ec_params_flash_write {
464 uint32_t offset; /* Byte offset to write */ 795 uint32_t offset; /* Byte offset to write */
465 uint32_t size; /* Size to write in bytes */ 796 uint32_t size; /* Size to write in bytes */
466 /* 797 /* Followed by data to write */
467 * Data to write. Could really use EC_PARAM_SIZE - 8, but tidiest to
468 * use a power of 2 so writes stay aligned.
469 */
470 uint8_t data[64];
471} __packed; 798} __packed;
472 799
473/* Erase flash */ 800/* Erase flash */
@@ -543,7 +870,7 @@ struct ec_response_flash_protect {
543 870
544enum ec_flash_region { 871enum ec_flash_region {
545 /* Region which holds read-only EC image */ 872 /* Region which holds read-only EC image */
546 EC_FLASH_REGION_RO, 873 EC_FLASH_REGION_RO = 0,
547 /* Region which holds rewritable EC image */ 874 /* Region which holds rewritable EC image */
548 EC_FLASH_REGION_RW, 875 EC_FLASH_REGION_RW,
549 /* 876 /*
@@ -551,6 +878,8 @@ enum ec_flash_region {
551 * EC_FLASH_REGION_RO) 878 * EC_FLASH_REGION_RO)
552 */ 879 */
553 EC_FLASH_REGION_WP_RO, 880 EC_FLASH_REGION_WP_RO,
881 /* Number of regions */
882 EC_FLASH_REGION_COUNT,
554}; 883};
555 884
556struct ec_params_flash_region_info { 885struct ec_params_flash_region_info {
@@ -639,15 +968,15 @@ struct rgb_s {
639 */ 968 */
640struct lightbar_params { 969struct lightbar_params {
641 /* Timing */ 970 /* Timing */
642 int google_ramp_up; 971 int32_t google_ramp_up;
643 int google_ramp_down; 972 int32_t google_ramp_down;
644 int s3s0_ramp_up; 973 int32_t s3s0_ramp_up;
645 int s0_tick_delay[2]; /* AC=0/1 */ 974 int32_t s0_tick_delay[2]; /* AC=0/1 */
646 int s0a_tick_delay[2]; /* AC=0/1 */ 975 int32_t s0a_tick_delay[2]; /* AC=0/1 */
647 int s0s3_ramp_down; 976 int32_t s0s3_ramp_down;
648 int s3_sleep_for; 977 int32_t s3_sleep_for;
649 int s3_ramp_up; 978 int32_t s3_ramp_up;
650 int s3_ramp_down; 979 int32_t s3_ramp_down;
651 980
652 /* Oscillation */ 981 /* Oscillation */
653 uint8_t new_s0; 982 uint8_t new_s0;
@@ -676,7 +1005,7 @@ struct ec_params_lightbar {
676 union { 1005 union {
677 struct { 1006 struct {
678 /* no args */ 1007 /* no args */
679 } dump, off, on, init, get_seq, get_params; 1008 } dump, off, on, init, get_seq, get_params, version;
680 1009
681 struct num { 1010 struct num {
682 uint8_t num; 1011 uint8_t num;
@@ -710,6 +1039,11 @@ struct ec_response_lightbar {
710 1039
711 struct lightbar_params get_params; 1040 struct lightbar_params get_params;
712 1041
1042 struct version {
1043 uint32_t num;
1044 uint32_t flags;
1045 } version;
1046
713 struct { 1047 struct {
714 /* no return params */ 1048 /* no return params */
715 } off, on, init, brightness, seq, reg, rgb, demo, set_params; 1049 } off, on, init, brightness, seq, reg, rgb, demo, set_params;
@@ -730,10 +1064,62 @@ enum lightbar_command {
730 LIGHTBAR_CMD_DEMO = 9, 1064 LIGHTBAR_CMD_DEMO = 9,
731 LIGHTBAR_CMD_GET_PARAMS = 10, 1065 LIGHTBAR_CMD_GET_PARAMS = 10,
732 LIGHTBAR_CMD_SET_PARAMS = 11, 1066 LIGHTBAR_CMD_SET_PARAMS = 11,
1067 LIGHTBAR_CMD_VERSION = 12,
733 LIGHTBAR_NUM_CMDS 1068 LIGHTBAR_NUM_CMDS
734}; 1069};
735 1070
736/*****************************************************************************/ 1071/*****************************************************************************/
1072/* LED control commands */
1073
1074#define EC_CMD_LED_CONTROL 0x29
1075
1076enum ec_led_id {
1077 /* LED to indicate battery state of charge */
1078 EC_LED_ID_BATTERY_LED = 0,
1079 /*
1080 * LED to indicate system power state (on or in suspend).
1081 * May be on power button or on C-panel.
1082 */
1083 EC_LED_ID_POWER_LED,
1084 /* LED on power adapter or its plug */
1085 EC_LED_ID_ADAPTER_LED,
1086
1087 EC_LED_ID_COUNT
1088};
1089
1090/* LED control flags */
1091#define EC_LED_FLAGS_QUERY (1 << 0) /* Query LED capability only */
1092#define EC_LED_FLAGS_AUTO (1 << 1) /* Switch LED back to automatic control */
1093
1094enum ec_led_colors {
1095 EC_LED_COLOR_RED = 0,
1096 EC_LED_COLOR_GREEN,
1097 EC_LED_COLOR_BLUE,
1098 EC_LED_COLOR_YELLOW,
1099 EC_LED_COLOR_WHITE,
1100
1101 EC_LED_COLOR_COUNT
1102};
1103
1104struct ec_params_led_control {
1105 uint8_t led_id; /* Which LED to control */
1106 uint8_t flags; /* Control flags */
1107
1108 uint8_t brightness[EC_LED_COLOR_COUNT];
1109} __packed;
1110
1111struct ec_response_led_control {
1112 /*
1113 * Available brightness value range.
1114 *
1115 * Range 0 means color channel not present.
1116 * Range 1 means on/off control.
1117 * Other values means the LED is control by PWM.
1118 */
1119 uint8_t brightness_range[EC_LED_COLOR_COUNT];
1120} __packed;
1121
1122/*****************************************************************************/
737/* Verified boot commands */ 1123/* Verified boot commands */
738 1124
739/* 1125/*
@@ -790,6 +1176,181 @@ enum ec_vboot_hash_status {
790#define EC_VBOOT_HASH_OFFSET_RW 0xfffffffd 1176#define EC_VBOOT_HASH_OFFSET_RW 0xfffffffd
791 1177
792/*****************************************************************************/ 1178/*****************************************************************************/
1179/*
1180 * Motion sense commands. We'll make separate structs for sub-commands with
1181 * different input args, so that we know how much to expect.
1182 */
1183#define EC_CMD_MOTION_SENSE_CMD 0x2B
1184
1185/* Motion sense commands */
1186enum motionsense_command {
1187 /*
1188 * Dump command returns all motion sensor data including motion sense
1189 * module flags and individual sensor flags.
1190 */
1191 MOTIONSENSE_CMD_DUMP = 0,
1192
1193 /*
1194 * Info command returns data describing the details of a given sensor,
1195 * including enum motionsensor_type, enum motionsensor_location, and
1196 * enum motionsensor_chip.
1197 */
1198 MOTIONSENSE_CMD_INFO = 1,
1199
1200 /*
1201 * EC Rate command is a setter/getter command for the EC sampling rate
1202 * of all motion sensors in milliseconds.
1203 */
1204 MOTIONSENSE_CMD_EC_RATE = 2,
1205
1206 /*
1207 * Sensor ODR command is a setter/getter command for the output data
1208 * rate of a specific motion sensor in millihertz.
1209 */
1210 MOTIONSENSE_CMD_SENSOR_ODR = 3,
1211
1212 /*
1213 * Sensor range command is a setter/getter command for the range of
1214 * a specified motion sensor in +/-G's or +/- deg/s.
1215 */
1216 MOTIONSENSE_CMD_SENSOR_RANGE = 4,
1217
1218 /*
1219 * Setter/getter command for the keyboard wake angle. When the lid
1220 * angle is greater than this value, keyboard wake is disabled in S3,
1221 * and when the lid angle goes less than this value, keyboard wake is
1222 * enabled. Note, the lid angle measurement is an approximate,
1223 * un-calibrated value, hence the wake angle isn't exact.
1224 */
1225 MOTIONSENSE_CMD_KB_WAKE_ANGLE = 5,
1226
1227 /* Number of motionsense sub-commands. */
1228 MOTIONSENSE_NUM_CMDS
1229};
1230
1231enum motionsensor_id {
1232 EC_MOTION_SENSOR_ACCEL_BASE = 0,
1233 EC_MOTION_SENSOR_ACCEL_LID = 1,
1234 EC_MOTION_SENSOR_GYRO = 2,
1235
1236 /*
1237 * Note, if more sensors are added and this count changes, the padding
1238 * in ec_response_motion_sense dump command must be modified.
1239 */
1240 EC_MOTION_SENSOR_COUNT = 3
1241};
1242
1243/* List of motion sensor types. */
1244enum motionsensor_type {
1245 MOTIONSENSE_TYPE_ACCEL = 0,
1246 MOTIONSENSE_TYPE_GYRO = 1,
1247};
1248
1249/* List of motion sensor locations. */
1250enum motionsensor_location {
1251 MOTIONSENSE_LOC_BASE = 0,
1252 MOTIONSENSE_LOC_LID = 1,
1253};
1254
1255/* List of motion sensor chips. */
1256enum motionsensor_chip {
1257 MOTIONSENSE_CHIP_KXCJ9 = 0,
1258};
1259
1260/* Module flag masks used for the dump sub-command. */
1261#define MOTIONSENSE_MODULE_FLAG_ACTIVE (1<<0)
1262
1263/* Sensor flag masks used for the dump sub-command. */
1264#define MOTIONSENSE_SENSOR_FLAG_PRESENT (1<<0)
1265
1266/*
1267 * Send this value for the data element to only perform a read. If you
1268 * send any other value, the EC will interpret it as data to set and will
1269 * return the actual value set.
1270 */
1271#define EC_MOTION_SENSE_NO_VALUE -1
1272
1273struct ec_params_motion_sense {
1274 uint8_t cmd;
1275 union {
1276 /* Used for MOTIONSENSE_CMD_DUMP. */
1277 struct {
1278 /* no args */
1279 } dump;
1280
1281 /*
1282 * Used for MOTIONSENSE_CMD_EC_RATE and
1283 * MOTIONSENSE_CMD_KB_WAKE_ANGLE.
1284 */
1285 struct {
1286 /* Data to set or EC_MOTION_SENSE_NO_VALUE to read. */
1287 int16_t data;
1288 } ec_rate, kb_wake_angle;
1289
1290 /* Used for MOTIONSENSE_CMD_INFO. */
1291 struct {
1292 /* Should be element of enum motionsensor_id. */
1293 uint8_t sensor_num;
1294 } info;
1295
1296 /*
1297 * Used for MOTIONSENSE_CMD_SENSOR_ODR and
1298 * MOTIONSENSE_CMD_SENSOR_RANGE.
1299 */
1300 struct {
1301 /* Should be element of enum motionsensor_id. */
1302 uint8_t sensor_num;
1303
1304 /* Rounding flag, true for round-up, false for down. */
1305 uint8_t roundup;
1306
1307 uint16_t reserved;
1308
1309 /* Data to set or EC_MOTION_SENSE_NO_VALUE to read. */
1310 int32_t data;
1311 } sensor_odr, sensor_range;
1312 };
1313} __packed;
1314
1315struct ec_response_motion_sense {
1316 union {
1317 /* Used for MOTIONSENSE_CMD_DUMP. */
1318 struct {
1319 /* Flags representing the motion sensor module. */
1320 uint8_t module_flags;
1321
1322 /* Flags for each sensor in enum motionsensor_id. */
1323 uint8_t sensor_flags[EC_MOTION_SENSOR_COUNT];
1324
1325 /* Array of all sensor data. Each sensor is 3-axis. */
1326 int16_t data[3*EC_MOTION_SENSOR_COUNT];
1327 } dump;
1328
1329 /* Used for MOTIONSENSE_CMD_INFO. */
1330 struct {
1331 /* Should be element of enum motionsensor_type. */
1332 uint8_t type;
1333
1334 /* Should be element of enum motionsensor_location. */
1335 uint8_t location;
1336
1337 /* Should be element of enum motionsensor_chip. */
1338 uint8_t chip;
1339 } info;
1340
1341 /*
1342 * Used for MOTIONSENSE_CMD_EC_RATE, MOTIONSENSE_CMD_SENSOR_ODR,
1343 * MOTIONSENSE_CMD_SENSOR_RANGE, and
1344 * MOTIONSENSE_CMD_KB_WAKE_ANGLE.
1345 */
1346 struct {
1347 /* Current value of the parameter queried. */
1348 int32_t ret;
1349 } ec_rate, sensor_odr, sensor_range, kb_wake_angle;
1350 };
1351} __packed;
1352
1353/*****************************************************************************/
793/* USB charging control commands */ 1354/* USB charging control commands */
794 1355
795/* Set USB port charging mode */ 1356/* Set USB port charging mode */
@@ -868,20 +1429,27 @@ struct ec_response_port80_last_boot {
868} __packed; 1429} __packed;
869 1430
870/*****************************************************************************/ 1431/*****************************************************************************/
871/* Thermal engine commands */ 1432/* Thermal engine commands. Note that there are two implementations. We'll
1433 * reuse the command number, but the data and behavior is incompatible.
1434 * Version 0 is what originally shipped on Link.
1435 * Version 1 separates the CPU thermal limits from the fan control.
1436 */
872 1437
873/* Set thershold value */
874#define EC_CMD_THERMAL_SET_THRESHOLD 0x50 1438#define EC_CMD_THERMAL_SET_THRESHOLD 0x50
1439#define EC_CMD_THERMAL_GET_THRESHOLD 0x51
1440
1441/* The version 0 structs are opaque. You have to know what they are for
1442 * the get/set commands to make any sense.
1443 */
875 1444
1445/* Version 0 - set */
876struct ec_params_thermal_set_threshold { 1446struct ec_params_thermal_set_threshold {
877 uint8_t sensor_type; 1447 uint8_t sensor_type;
878 uint8_t threshold_id; 1448 uint8_t threshold_id;
879 uint16_t value; 1449 uint16_t value;
880} __packed; 1450} __packed;
881 1451
882/* Get threshold value */ 1452/* Version 0 - get */
883#define EC_CMD_THERMAL_GET_THRESHOLD 0x51
884
885struct ec_params_thermal_get_threshold { 1453struct ec_params_thermal_get_threshold {
886 uint8_t sensor_type; 1454 uint8_t sensor_type;
887 uint8_t threshold_id; 1455 uint8_t threshold_id;
@@ -891,6 +1459,41 @@ struct ec_response_thermal_get_threshold {
891 uint16_t value; 1459 uint16_t value;
892} __packed; 1460} __packed;
893 1461
1462
1463/* The version 1 structs are visible. */
1464enum ec_temp_thresholds {
1465 EC_TEMP_THRESH_WARN = 0,
1466 EC_TEMP_THRESH_HIGH,
1467 EC_TEMP_THRESH_HALT,
1468
1469 EC_TEMP_THRESH_COUNT
1470};
1471
1472/* Thermal configuration for one temperature sensor. Temps are in degrees K.
1473 * Zero values will be silently ignored by the thermal task.
1474 */
1475struct ec_thermal_config {
1476 uint32_t temp_host[EC_TEMP_THRESH_COUNT]; /* levels of hotness */
1477 uint32_t temp_fan_off; /* no active cooling needed */
1478 uint32_t temp_fan_max; /* max active cooling needed */
1479} __packed;
1480
1481/* Version 1 - get config for one sensor. */
1482struct ec_params_thermal_get_threshold_v1 {
1483 uint32_t sensor_num;
1484} __packed;
1485/* This returns a struct ec_thermal_config */
1486
1487/* Version 1 - set config for one sensor.
1488 * Use read-modify-write for best results! */
1489struct ec_params_thermal_set_threshold_v1 {
1490 uint32_t sensor_num;
1491 struct ec_thermal_config cfg;
1492} __packed;
1493/* This returns no data */
1494
1495/****************************************************************************/
1496
894/* Toggle automatic fan control */ 1497/* Toggle automatic fan control */
895#define EC_CMD_THERMAL_AUTO_FAN_CTRL 0x52 1498#define EC_CMD_THERMAL_AUTO_FAN_CTRL 0x52
896 1499
@@ -920,6 +1523,18 @@ struct ec_params_tmp006_set_calibration {
920 float b2; 1523 float b2;
921} __packed; 1524} __packed;
922 1525
1526/* Read raw TMP006 data */
1527#define EC_CMD_TMP006_GET_RAW 0x55
1528
1529struct ec_params_tmp006_get_raw {
1530 uint8_t index;
1531} __packed;
1532
1533struct ec_response_tmp006_get_raw {
1534 int32_t t; /* In 1/100 K */
1535 int32_t v; /* In nV */
1536};
1537
923/*****************************************************************************/ 1538/*****************************************************************************/
924/* MKBP - Matrix KeyBoard Protocol */ 1539/* MKBP - Matrix KeyBoard Protocol */
925 1540
@@ -1118,11 +1733,41 @@ struct ec_params_switch_enable_backlight {
1118 1733
1119/* Enable/disable WLAN/Bluetooth */ 1734/* Enable/disable WLAN/Bluetooth */
1120#define EC_CMD_SWITCH_ENABLE_WIRELESS 0x91 1735#define EC_CMD_SWITCH_ENABLE_WIRELESS 0x91
1736#define EC_VER_SWITCH_ENABLE_WIRELESS 1
1121 1737
1122struct ec_params_switch_enable_wireless { 1738/* Version 0 params; no response */
1739struct ec_params_switch_enable_wireless_v0 {
1123 uint8_t enabled; 1740 uint8_t enabled;
1124} __packed; 1741} __packed;
1125 1742
1743/* Version 1 params */
1744struct ec_params_switch_enable_wireless_v1 {
1745 /* Flags to enable now */
1746 uint8_t now_flags;
1747
1748 /* Which flags to copy from now_flags */
1749 uint8_t now_mask;
1750
1751 /*
1752 * Flags to leave enabled in S3, if they're on at the S0->S3
1753 * transition. (Other flags will be disabled by the S0->S3
1754 * transition.)
1755 */
1756 uint8_t suspend_flags;
1757
1758 /* Which flags to copy from suspend_flags */
1759 uint8_t suspend_mask;
1760} __packed;
1761
1762/* Version 1 response */
1763struct ec_response_switch_enable_wireless_v1 {
1764 /* Flags to enable now */
1765 uint8_t now_flags;
1766
1767 /* Flags to leave enabled in S3 */
1768 uint8_t suspend_flags;
1769} __packed;
1770
1126/*****************************************************************************/ 1771/*****************************************************************************/
1127/* GPIO commands. Only available on EC if write protect has been disabled. */ 1772/* GPIO commands. Only available on EC if write protect has been disabled. */
1128 1773
@@ -1147,11 +1792,16 @@ struct ec_response_gpio_get {
1147/*****************************************************************************/ 1792/*****************************************************************************/
1148/* I2C commands. Only available when flash write protect is unlocked. */ 1793/* I2C commands. Only available when flash write protect is unlocked. */
1149 1794
1795/*
1796 * TODO(crosbug.com/p/23570): These commands are deprecated, and will be
1797 * removed soon. Use EC_CMD_I2C_XFER instead.
1798 */
1799
1150/* Read I2C bus */ 1800/* Read I2C bus */
1151#define EC_CMD_I2C_READ 0x94 1801#define EC_CMD_I2C_READ 0x94
1152 1802
1153struct ec_params_i2c_read { 1803struct ec_params_i2c_read {
1154 uint16_t addr; 1804 uint16_t addr; /* 8-bit address (7-bit shifted << 1) */
1155 uint8_t read_size; /* Either 8 or 16. */ 1805 uint8_t read_size; /* Either 8 or 16. */
1156 uint8_t port; 1806 uint8_t port;
1157 uint8_t offset; 1807 uint8_t offset;
@@ -1165,7 +1815,7 @@ struct ec_response_i2c_read {
1165 1815
1166struct ec_params_i2c_write { 1816struct ec_params_i2c_write {
1167 uint16_t data; 1817 uint16_t data;
1168 uint16_t addr; 1818 uint16_t addr; /* 8-bit address (7-bit shifted << 1) */
1169 uint8_t write_size; /* Either 8 or 16. */ 1819 uint8_t write_size; /* Either 8 or 16. */
1170 uint8_t port; 1820 uint8_t port;
1171 uint8_t offset; 1821 uint8_t offset;
@@ -1174,11 +1824,20 @@ struct ec_params_i2c_write {
1174/*****************************************************************************/ 1824/*****************************************************************************/
1175/* Charge state commands. Only available when flash write protect unlocked. */ 1825/* Charge state commands. Only available when flash write protect unlocked. */
1176 1826
1177/* Force charge state machine to stop in idle mode */ 1827/* Force charge state machine to stop charging the battery or force it to
1178#define EC_CMD_CHARGE_FORCE_IDLE 0x96 1828 * discharge the battery.
1829 */
1830#define EC_CMD_CHARGE_CONTROL 0x96
1831#define EC_VER_CHARGE_CONTROL 1
1179 1832
1180struct ec_params_force_idle { 1833enum ec_charge_control_mode {
1181 uint8_t enabled; 1834 CHARGE_CONTROL_NORMAL = 0,
1835 CHARGE_CONTROL_IDLE,
1836 CHARGE_CONTROL_DISCHARGE,
1837};
1838
1839struct ec_params_charge_control {
1840 uint32_t mode; /* enum charge_control_mode */
1182} __packed; 1841} __packed;
1183 1842
1184/*****************************************************************************/ 1843/*****************************************************************************/
@@ -1206,14 +1865,231 @@ struct ec_params_force_idle {
1206#define EC_CMD_BATTERY_CUT_OFF 0x99 1865#define EC_CMD_BATTERY_CUT_OFF 0x99
1207 1866
1208/*****************************************************************************/ 1867/*****************************************************************************/
1209/* Temporary debug commands. TODO: remove this crosbug.com/p/13849 */ 1868/* USB port mux control. */
1210 1869
1211/* 1870/*
1212 * Dump charge state machine context. 1871 * Switch USB mux or return to automatic switching.
1213 * 1872 */
1214 * Response is a binary dump of charge state machine context. 1873#define EC_CMD_USB_MUX 0x9a
1874
1875struct ec_params_usb_mux {
1876 uint8_t mux;
1877} __packed;
1878
1879/*****************************************************************************/
1880/* LDOs / FETs control. */
1881
1882enum ec_ldo_state {
1883 EC_LDO_STATE_OFF = 0, /* the LDO / FET is shut down */
1884 EC_LDO_STATE_ON = 1, /* the LDO / FET is ON / providing power */
1885};
1886
1887/*
1888 * Switch on/off a LDO.
1889 */
1890#define EC_CMD_LDO_SET 0x9b
1891
1892struct ec_params_ldo_set {
1893 uint8_t index;
1894 uint8_t state;
1895} __packed;
1896
1897/*
1898 * Get LDO state.
1899 */
1900#define EC_CMD_LDO_GET 0x9c
1901
1902struct ec_params_ldo_get {
1903 uint8_t index;
1904} __packed;
1905
1906struct ec_response_ldo_get {
1907 uint8_t state;
1908} __packed;
1909
1910/*****************************************************************************/
1911/* Power info. */
1912
1913/*
1914 * Get power info.
1915 */
1916#define EC_CMD_POWER_INFO 0x9d
1917
1918struct ec_response_power_info {
1919 uint32_t usb_dev_type;
1920 uint16_t voltage_ac;
1921 uint16_t voltage_system;
1922 uint16_t current_system;
1923 uint16_t usb_current_limit;
1924} __packed;
1925
1926/*****************************************************************************/
1927/* I2C passthru command */
1928
1929#define EC_CMD_I2C_PASSTHRU 0x9e
1930
1931/* Slave address is 10 (not 7) bit */
1932#define EC_I2C_FLAG_10BIT (1 << 16)
1933
1934/* Read data; if not present, message is a write */
1935#define EC_I2C_FLAG_READ (1 << 15)
1936
1937/* Mask for address */
1938#define EC_I2C_ADDR_MASK 0x3ff
1939
1940#define EC_I2C_STATUS_NAK (1 << 0) /* Transfer was not acknowledged */
1941#define EC_I2C_STATUS_TIMEOUT (1 << 1) /* Timeout during transfer */
1942
1943/* Any error */
1944#define EC_I2C_STATUS_ERROR (EC_I2C_STATUS_NAK | EC_I2C_STATUS_TIMEOUT)
1945
1946struct ec_params_i2c_passthru_msg {
1947 uint16_t addr_flags; /* I2C slave address (7 or 10 bits) and flags */
1948 uint16_t len; /* Number of bytes to read or write */
1949} __packed;
1950
1951struct ec_params_i2c_passthru {
1952 uint8_t port; /* I2C port number */
1953 uint8_t num_msgs; /* Number of messages */
1954 struct ec_params_i2c_passthru_msg msg[];
1955 /* Data to write for all messages is concatenated here */
1956} __packed;
1957
1958struct ec_response_i2c_passthru {
1959 uint8_t i2c_status; /* Status flags (EC_I2C_STATUS_...) */
1960 uint8_t num_msgs; /* Number of messages processed */
1961 uint8_t data[]; /* Data read by messages concatenated here */
1962} __packed;
1963
1964/*****************************************************************************/
1965/* Power button hang detect */
1966
1967#define EC_CMD_HANG_DETECT 0x9f
1968
1969/* Reasons to start hang detection timer */
1970/* Power button pressed */
1971#define EC_HANG_START_ON_POWER_PRESS (1 << 0)
1972
1973/* Lid closed */
1974#define EC_HANG_START_ON_LID_CLOSE (1 << 1)
1975
1976 /* Lid opened */
1977#define EC_HANG_START_ON_LID_OPEN (1 << 2)
1978
1979/* Start of AP S3->S0 transition (booting or resuming from suspend) */
1980#define EC_HANG_START_ON_RESUME (1 << 3)
1981
1982/* Reasons to cancel hang detection */
1983
1984/* Power button released */
1985#define EC_HANG_STOP_ON_POWER_RELEASE (1 << 8)
1986
1987/* Any host command from AP received */
1988#define EC_HANG_STOP_ON_HOST_COMMAND (1 << 9)
1989
1990/* Stop on end of AP S0->S3 transition (suspending or shutting down) */
1991#define EC_HANG_STOP_ON_SUSPEND (1 << 10)
1992
1993/*
1994 * If this flag is set, all the other fields are ignored, and the hang detect
1995 * timer is started. This provides the AP a way to start the hang timer
1996 * without reconfiguring any of the other hang detect settings. Note that
1997 * you must previously have configured the timeouts.
1998 */
1999#define EC_HANG_START_NOW (1 << 30)
2000
2001/*
2002 * If this flag is set, all the other fields are ignored (including
2003 * EC_HANG_START_NOW). This provides the AP a way to stop the hang timer
2004 * without reconfiguring any of the other hang detect settings.
1215 */ 2005 */
1216#define EC_CMD_CHARGE_DUMP 0xa0 2006#define EC_HANG_STOP_NOW (1 << 31)
2007
2008struct ec_params_hang_detect {
2009 /* Flags; see EC_HANG_* */
2010 uint32_t flags;
2011
2012 /* Timeout in msec before generating host event, if enabled */
2013 uint16_t host_event_timeout_msec;
2014
2015 /* Timeout in msec before generating warm reboot, if enabled */
2016 uint16_t warm_reboot_timeout_msec;
2017} __packed;
2018
2019/*****************************************************************************/
2020/* Commands for battery charging */
2021
2022/*
2023 * This is the single catch-all host command to exchange data regarding the
2024 * charge state machine (v2 and up).
2025 */
2026#define EC_CMD_CHARGE_STATE 0xa0
2027
2028/* Subcommands for this host command */
2029enum charge_state_command {
2030 CHARGE_STATE_CMD_GET_STATE,
2031 CHARGE_STATE_CMD_GET_PARAM,
2032 CHARGE_STATE_CMD_SET_PARAM,
2033 CHARGE_STATE_NUM_CMDS
2034};
2035
2036/*
2037 * Known param numbers are defined here. Ranges are reserved for board-specific
2038 * params, which are handled by the particular implementations.
2039 */
2040enum charge_state_params {
2041 CS_PARAM_CHG_VOLTAGE, /* charger voltage limit */
2042 CS_PARAM_CHG_CURRENT, /* charger current limit */
2043 CS_PARAM_CHG_INPUT_CURRENT, /* charger input current limit */
2044 CS_PARAM_CHG_STATUS, /* charger-specific status */
2045 CS_PARAM_CHG_OPTION, /* charger-specific options */
2046 /* How many so far? */
2047 CS_NUM_BASE_PARAMS,
2048
2049 /* Range for CONFIG_CHARGER_PROFILE_OVERRIDE params */
2050 CS_PARAM_CUSTOM_PROFILE_MIN = 0x10000,
2051 CS_PARAM_CUSTOM_PROFILE_MAX = 0x1ffff,
2052
2053 /* Other custom param ranges go here... */
2054};
2055
2056struct ec_params_charge_state {
2057 uint8_t cmd; /* enum charge_state_command */
2058 union {
2059 struct {
2060 /* no args */
2061 } get_state;
2062
2063 struct {
2064 uint32_t param; /* enum charge_state_param */
2065 } get_param;
2066
2067 struct {
2068 uint32_t param; /* param to set */
2069 uint32_t value; /* value to set */
2070 } set_param;
2071 };
2072} __packed;
2073
2074struct ec_response_charge_state {
2075 union {
2076 struct {
2077 int ac;
2078 int chg_voltage;
2079 int chg_current;
2080 int chg_input_current;
2081 int batt_state_of_charge;
2082 } get_state;
2083
2084 struct {
2085 uint32_t value;
2086 } get_param;
2087 struct {
2088 /* no return values */
2089 } set_param;
2090 };
2091} __packed;
2092
1217 2093
1218/* 2094/*
1219 * Set maximum battery charging current. 2095 * Set maximum battery charging current.
@@ -1221,15 +2097,59 @@ struct ec_params_force_idle {
1221#define EC_CMD_CHARGE_CURRENT_LIMIT 0xa1 2097#define EC_CMD_CHARGE_CURRENT_LIMIT 0xa1
1222 2098
1223struct ec_params_current_limit { 2099struct ec_params_current_limit {
1224 uint32_t limit; 2100 uint32_t limit; /* in mA */
2101} __packed;
2102
2103/*
2104 * Set maximum external power current.
2105 */
2106#define EC_CMD_EXT_POWER_CURRENT_LIMIT 0xa2
2107
2108struct ec_params_ext_power_current_limit {
2109 uint32_t limit; /* in mA */
2110} __packed;
2111
2112/*****************************************************************************/
2113/* Smart battery pass-through */
2114
2115/* Get / Set 16-bit smart battery registers */
2116#define EC_CMD_SB_READ_WORD 0xb0
2117#define EC_CMD_SB_WRITE_WORD 0xb1
2118
2119/* Get / Set string smart battery parameters
2120 * formatted as SMBUS "block".
2121 */
2122#define EC_CMD_SB_READ_BLOCK 0xb2
2123#define EC_CMD_SB_WRITE_BLOCK 0xb3
2124
2125struct ec_params_sb_rd {
2126 uint8_t reg;
2127} __packed;
2128
2129struct ec_response_sb_rd_word {
2130 uint16_t value;
2131} __packed;
2132
2133struct ec_params_sb_wr_word {
2134 uint8_t reg;
2135 uint16_t value;
2136} __packed;
2137
2138struct ec_response_sb_rd_block {
2139 uint8_t data[32];
2140} __packed;
2141
2142struct ec_params_sb_wr_block {
2143 uint8_t reg;
2144 uint16_t data[32];
1225} __packed; 2145} __packed;
1226 2146
1227/*****************************************************************************/ 2147/*****************************************************************************/
1228/* System commands */ 2148/* System commands */
1229 2149
1230/* 2150/*
1231 * TODO: this is a confusing name, since it doesn't necessarily reboot the EC. 2151 * TODO(crosbug.com/p/23747): This is a confusing name, since it doesn't
1232 * Rename to "set image" or something similar. 2152 * necessarily reboot the EC. Rename to "image" or something similar?
1233 */ 2153 */
1234#define EC_CMD_REBOOT_EC 0xd2 2154#define EC_CMD_REBOOT_EC 0xd2
1235 2155
@@ -1308,6 +2228,7 @@ struct ec_params_reboot_ec {
1308#define EC_CMD_ACPI_QUERY_EVENT 0x84 2228#define EC_CMD_ACPI_QUERY_EVENT 0x84
1309 2229
1310/* Valid addresses in ACPI memory space, for read/write commands */ 2230/* Valid addresses in ACPI memory space, for read/write commands */
2231
1311/* Memory space version; set to EC_ACPI_MEM_VERSION_CURRENT */ 2232/* Memory space version; set to EC_ACPI_MEM_VERSION_CURRENT */
1312#define EC_ACPI_MEM_VERSION 0x00 2233#define EC_ACPI_MEM_VERSION 0x00
1313/* 2234/*
@@ -1317,8 +2238,60 @@ struct ec_params_reboot_ec {
1317#define EC_ACPI_MEM_TEST 0x01 2238#define EC_ACPI_MEM_TEST 0x01
1318/* Test compliment; writes here are ignored. */ 2239/* Test compliment; writes here are ignored. */
1319#define EC_ACPI_MEM_TEST_COMPLIMENT 0x02 2240#define EC_ACPI_MEM_TEST_COMPLIMENT 0x02
2241
1320/* Keyboard backlight brightness percent (0 - 100) */ 2242/* Keyboard backlight brightness percent (0 - 100) */
1321#define EC_ACPI_MEM_KEYBOARD_BACKLIGHT 0x03 2243#define EC_ACPI_MEM_KEYBOARD_BACKLIGHT 0x03
2244/* DPTF Target Fan Duty (0-100, 0xff for auto/none) */
2245#define EC_ACPI_MEM_FAN_DUTY 0x04
2246
2247/*
2248 * DPTF temp thresholds. Any of the EC's temp sensors can have up to two
2249 * independent thresholds attached to them. The current value of the ID
2250 * register determines which sensor is affected by the THRESHOLD and COMMIT
2251 * registers. The THRESHOLD register uses the same EC_TEMP_SENSOR_OFFSET scheme
2252 * as the memory-mapped sensors. The COMMIT register applies those settings.
2253 *
2254 * The spec does not mandate any way to read back the threshold settings
2255 * themselves, but when a threshold is crossed the AP needs a way to determine
2256 * which sensor(s) are responsible. Each reading of the ID register clears and
2257 * returns one sensor ID that has crossed one of its threshold (in either
2258 * direction) since the last read. A value of 0xFF means "no new thresholds
2259 * have tripped". Setting or enabling the thresholds for a sensor will clear
2260 * the unread event count for that sensor.
2261 */
2262#define EC_ACPI_MEM_TEMP_ID 0x05
2263#define EC_ACPI_MEM_TEMP_THRESHOLD 0x06
2264#define EC_ACPI_MEM_TEMP_COMMIT 0x07
2265/*
2266 * Here are the bits for the COMMIT register:
2267 * bit 0 selects the threshold index for the chosen sensor (0/1)
2268 * bit 1 enables/disables the selected threshold (0 = off, 1 = on)
2269 * Each write to the commit register affects one threshold.
2270 */
2271#define EC_ACPI_MEM_TEMP_COMMIT_SELECT_MASK (1 << 0)
2272#define EC_ACPI_MEM_TEMP_COMMIT_ENABLE_MASK (1 << 1)
2273/*
2274 * Example:
2275 *
2276 * Set the thresholds for sensor 2 to 50 C and 60 C:
2277 * write 2 to [0x05] -- select temp sensor 2
2278 * write 0x7b to [0x06] -- C_TO_K(50) - EC_TEMP_SENSOR_OFFSET
2279 * write 0x2 to [0x07] -- enable threshold 0 with this value
2280 * write 0x85 to [0x06] -- C_TO_K(60) - EC_TEMP_SENSOR_OFFSET
2281 * write 0x3 to [0x07] -- enable threshold 1 with this value
2282 *
2283 * Disable the 60 C threshold, leaving the 50 C threshold unchanged:
2284 * write 2 to [0x05] -- select temp sensor 2
2285 * write 0x1 to [0x07] -- disable threshold 1
2286 */
2287
2288/* DPTF battery charging current limit */
2289#define EC_ACPI_MEM_CHARGING_LIMIT 0x08
2290
2291/* Charging limit is specified in 64 mA steps */
2292#define EC_ACPI_MEM_CHARGING_LIMIT_STEP_MA 64
2293/* Value to disable DPTF battery charging limit */
2294#define EC_ACPI_MEM_CHARGING_LIMIT_DISABLED 0xff
1322 2295
1323/* Current version of ACPI memory address space */ 2296/* Current version of ACPI memory address space */
1324#define EC_ACPI_MEM_VERSION_CURRENT 1 2297#define EC_ACPI_MEM_VERSION_CURRENT 1
@@ -1360,10 +2333,21 @@ struct ec_params_reboot_ec {
1360 * Header bytes greater than this indicate a later version. For example, 2333 * Header bytes greater than this indicate a later version. For example,
1361 * EC_CMD_VERSION0 + 1 means we are using version 1. 2334 * EC_CMD_VERSION0 + 1 means we are using version 1.
1362 * 2335 *
1363 * The old EC interface must not use commands 0dc or higher. 2336 * The old EC interface must not use commands 0xdc or higher.
1364 */ 2337 */
1365#define EC_CMD_VERSION0 0xdc 2338#define EC_CMD_VERSION0 0xdc
1366 2339
1367#endif /* !__ACPI__ */ 2340#endif /* !__ACPI__ */
1368 2341
2342/*****************************************************************************/
2343/*
2344 * Deprecated constants. These constants have been renamed for clarity. The
2345 * meaning and size has not changed. Programs that use the old names should
2346 * switch to the new names soon, as the old names may not be carried forward
2347 * forever.
2348 */
2349#define EC_HOST_PARAM_SIZE EC_PROTO2_MAX_PARAM_SIZE
2350#define EC_LPC_ADDR_OLD_PARAM EC_HOST_CMD_REGION1
2351#define EC_OLD_PARAM_SIZE EC_HOST_CMD_REGION_SIZE
2352
1369#endif /* __CROS_EC_COMMANDS_H */ 2353#endif /* __CROS_EC_COMMANDS_H */
diff --git a/include/linux/mfd/ipaq-micro.h b/include/linux/mfd/ipaq-micro.h
new file mode 100644
index 000000000000..5c4d29f6674f
--- /dev/null
+++ b/include/linux/mfd/ipaq-micro.h
@@ -0,0 +1,148 @@
1/*
2 * Header file for the compaq Micro MFD
3 */
4
5#ifndef _MFD_IPAQ_MICRO_H_
6#define _MFD_IPAQ_MICRO_H_
7
8#include <linux/spinlock.h>
9#include <linux/completion.h>
10#include <linux/list.h>
11
12#define TX_BUF_SIZE 32
13#define RX_BUF_SIZE 16
14#define CHAR_SOF 0x02
15
16/*
17 * These are the different messages that can be sent to the microcontroller
18 * to control various aspects.
19 */
20#define MSG_VERSION 0x0
21#define MSG_KEYBOARD 0x2
22#define MSG_TOUCHSCREEN 0x3
23#define MSG_EEPROM_READ 0x4
24#define MSG_EEPROM_WRITE 0x5
25#define MSG_THERMAL_SENSOR 0x6
26#define MSG_NOTIFY_LED 0x8
27#define MSG_BATTERY 0x9
28#define MSG_SPI_READ 0xb
29#define MSG_SPI_WRITE 0xc
30#define MSG_BACKLIGHT 0xd /* H3600 only */
31#define MSG_CODEC_CTRL 0xe /* H3100 only */
32#define MSG_DISPLAY_CTRL 0xf /* H3100 only */
33
34/* state of receiver parser */
35enum rx_state {
36 STATE_SOF = 0, /* Next byte should be start of frame */
37 STATE_ID, /* Next byte is ID & message length */
38 STATE_DATA, /* Next byte is a data byte */
39 STATE_CHKSUM /* Next byte should be checksum */
40};
41
42/**
43 * struct ipaq_micro_txdev - TX state
44 * @len: length of message in TX buffer
45 * @index: current index into TX buffer
46 * @buf: TX buffer
47 */
48struct ipaq_micro_txdev {
49 u8 len;
50 u8 index;
51 u8 buf[TX_BUF_SIZE];
52};
53
54/**
55 * struct ipaq_micro_rxdev - RX state
56 * @state: context of RX state machine
57 * @chksum: calculated checksum
58 * @id: message ID from packet
59 * @len: RX buffer length
60 * @index: RX buffer index
61 * @buf: RX buffer
62 */
63struct ipaq_micro_rxdev {
64 enum rx_state state;
65 unsigned char chksum;
66 u8 id;
67 unsigned int len;
68 unsigned int index;
69 u8 buf[RX_BUF_SIZE];
70};
71
72/**
73 * struct ipaq_micro_msg - message to the iPAQ microcontroller
74 * @id: 4-bit ID of the message
75 * @tx_len: length of TX data
76 * @tx_data: TX data to send
77 * @rx_len: length of receieved RX data
78 * @rx_data: RX data to recieve
79 * @ack: a completion that will be completed when RX is complete
80 * @node: list node if message gets queued
81 */
82struct ipaq_micro_msg {
83 u8 id;
84 u8 tx_len;
85 u8 tx_data[TX_BUF_SIZE];
86 u8 rx_len;
87 u8 rx_data[RX_BUF_SIZE];
88 struct completion ack;
89 struct list_head node;
90};
91
92/**
93 * struct ipaq_micro - iPAQ microcontroller state
94 * @dev: corresponding platform device
95 * @base: virtual memory base for underlying serial device
96 * @sdlc: virtual memory base for Synchronous Data Link Controller
97 * @version: version string
98 * @tx: TX state
99 * @rx: RX state
100 * @lock: lock for this state container
101 * @msg: current message
102 * @queue: message queue
103 * @key: callback for asynchronous key events
104 * @key_data: data to pass along with key events
105 * @ts: callback for asynchronous touchscreen events
106 * @ts_data: data to pass along with key events
107 */
108struct ipaq_micro {
109 struct device *dev;
110 void __iomem *base;
111 void __iomem *sdlc;
112 char version[5];
113 struct ipaq_micro_txdev tx; /* transmit ISR state */
114 struct ipaq_micro_rxdev rx; /* receive ISR state */
115 spinlock_t lock;
116 struct ipaq_micro_msg *msg;
117 struct list_head queue;
118 void (*key) (void *data, int len, unsigned char *rxdata);
119 void *key_data;
120 void (*ts) (void *data, int len, unsigned char *rxdata);
121 void *ts_data;
122};
123
124extern int
125ipaq_micro_tx_msg(struct ipaq_micro *micro, struct ipaq_micro_msg *msg);
126
127static inline int
128ipaq_micro_tx_msg_sync(struct ipaq_micro *micro,
129 struct ipaq_micro_msg *msg)
130{
131 int ret;
132
133 init_completion(&msg->ack);
134 ret = ipaq_micro_tx_msg(micro, msg);
135 wait_for_completion(&msg->ack);
136
137 return ret;
138}
139
140static inline int
141ipaq_micro_tx_msg_async(struct ipaq_micro *micro,
142 struct ipaq_micro_msg *msg)
143{
144 init_completion(&msg->ack);
145 return ipaq_micro_tx_msg(micro, msg);
146}
147
148#endif /* _MFD_IPAQ_MICRO_H_ */
diff --git a/include/linux/mfd/kempld.h b/include/linux/mfd/kempld.h
index b911ef3add03..26e0b469e567 100644
--- a/include/linux/mfd/kempld.h
+++ b/include/linux/mfd/kempld.h
@@ -51,6 +51,8 @@
51#define KEMPLD_TYPE_DEBUG 0x1 51#define KEMPLD_TYPE_DEBUG 0x1
52#define KEMPLD_TYPE_CUSTOM 0x2 52#define KEMPLD_TYPE_CUSTOM 0x2
53 53
54#define KEMPLD_VERSION_LEN 10
55
54/** 56/**
55 * struct kempld_info - PLD device information structure 57 * struct kempld_info - PLD device information structure
56 * @major: PLD major revision 58 * @major: PLD major revision
@@ -60,6 +62,7 @@
60 * @type: PLD type 62 * @type: PLD type
61 * @spec_major: PLD FW specification major revision 63 * @spec_major: PLD FW specification major revision
62 * @spec_minor: PLD FW specification minor revision 64 * @spec_minor: PLD FW specification minor revision
65 * @version: PLD version string
63 */ 66 */
64struct kempld_info { 67struct kempld_info {
65 unsigned int major; 68 unsigned int major;
@@ -69,6 +72,7 @@ struct kempld_info {
69 unsigned int type; 72 unsigned int type;
70 unsigned int spec_major; 73 unsigned int spec_major;
71 unsigned int spec_minor; 74 unsigned int spec_minor;
75 char version[KEMPLD_VERSION_LEN];
72}; 76};
73 77
74/** 78/**
diff --git a/include/linux/mfd/max14577-private.h b/include/linux/mfd/max14577-private.h
index c9b332fb0d5d..499253604026 100644
--- a/include/linux/mfd/max14577-private.h
+++ b/include/linux/mfd/max14577-private.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * max14577-private.h - Common API for the Maxim 14577 internal sub chip 2 * max14577-private.h - Common API for the Maxim 14577/77836 internal sub chip
3 * 3 *
4 * Copyright (C) 2013 Samsung Electrnoics 4 * Copyright (C) 2014 Samsung Electrnoics
5 * Chanwoo Choi <cw00.choi@samsung.com> 5 * Chanwoo Choi <cw00.choi@samsung.com>
6 * Krzysztof Kozlowski <k.kozlowski@samsung.com> 6 * Krzysztof Kozlowski <k.kozlowski@samsung.com>
7 * 7 *
@@ -22,9 +22,19 @@
22#include <linux/i2c.h> 22#include <linux/i2c.h>
23#include <linux/regmap.h> 23#include <linux/regmap.h>
24 24
25#define MAX14577_REG_INVALID (0xff) 25#define I2C_ADDR_PMIC (0x46 >> 1)
26#define I2C_ADDR_MUIC (0x4A >> 1)
27#define I2C_ADDR_FG (0x6C >> 1)
26 28
27/* Slave addr = 0x4A: Interrupt */ 29enum maxim_device_type {
30 MAXIM_DEVICE_TYPE_UNKNOWN = 0,
31 MAXIM_DEVICE_TYPE_MAX14577,
32 MAXIM_DEVICE_TYPE_MAX77836,
33
34 MAXIM_DEVICE_TYPE_NUM,
35};
36
37/* Slave addr = 0x4A: MUIC and Charger */
28enum max14577_reg { 38enum max14577_reg {
29 MAX14577_REG_DEVICEID = 0x00, 39 MAX14577_REG_DEVICEID = 0x00,
30 MAX14577_REG_INT1 = 0x01, 40 MAX14577_REG_INT1 = 0x01,
@@ -74,20 +84,22 @@ enum max14577_muic_charger_type {
74}; 84};
75 85
76/* MAX14577 interrupts */ 86/* MAX14577 interrupts */
77#define INT1_ADC_MASK (0x1 << 0) 87#define MAX14577_INT1_ADC_MASK BIT(0)
78#define INT1_ADCLOW_MASK (0x1 << 1) 88#define MAX14577_INT1_ADCLOW_MASK BIT(1)
79#define INT1_ADCERR_MASK (0x1 << 2) 89#define MAX14577_INT1_ADCERR_MASK BIT(2)
80 90#define MAX77836_INT1_ADC1K_MASK BIT(3)
81#define INT2_CHGTYP_MASK (0x1 << 0) 91
82#define INT2_CHGDETRUN_MASK (0x1 << 1) 92#define MAX14577_INT2_CHGTYP_MASK BIT(0)
83#define INT2_DCDTMR_MASK (0x1 << 2) 93#define MAX14577_INT2_CHGDETRUN_MASK BIT(1)
84#define INT2_DBCHG_MASK (0x1 << 3) 94#define MAX14577_INT2_DCDTMR_MASK BIT(2)
85#define INT2_VBVOLT_MASK (0x1 << 4) 95#define MAX14577_INT2_DBCHG_MASK BIT(3)
86 96#define MAX14577_INT2_VBVOLT_MASK BIT(4)
87#define INT3_EOC_MASK (0x1 << 0) 97#define MAX77836_INT2_VIDRM_MASK BIT(5)
88#define INT3_CGMBC_MASK (0x1 << 1) 98
89#define INT3_OVP_MASK (0x1 << 2) 99#define MAX14577_INT3_EOC_MASK BIT(0)
90#define INT3_MBCCHGERR_MASK (0x1 << 3) 100#define MAX14577_INT3_CGMBC_MASK BIT(1)
101#define MAX14577_INT3_OVP_MASK BIT(2)
102#define MAX14577_INT3_MBCCHGERR_MASK BIT(3)
91 103
92/* MAX14577 DEVICE ID register */ 104/* MAX14577 DEVICE ID register */
93#define DEVID_VENDORID_SHIFT 0 105#define DEVID_VENDORID_SHIFT 0
@@ -99,9 +111,11 @@ enum max14577_muic_charger_type {
99#define STATUS1_ADC_SHIFT 0 111#define STATUS1_ADC_SHIFT 0
100#define STATUS1_ADCLOW_SHIFT 5 112#define STATUS1_ADCLOW_SHIFT 5
101#define STATUS1_ADCERR_SHIFT 6 113#define STATUS1_ADCERR_SHIFT 6
114#define MAX77836_STATUS1_ADC1K_SHIFT 7
102#define STATUS1_ADC_MASK (0x1f << STATUS1_ADC_SHIFT) 115#define STATUS1_ADC_MASK (0x1f << STATUS1_ADC_SHIFT)
103#define STATUS1_ADCLOW_MASK (0x1 << STATUS1_ADCLOW_SHIFT) 116#define STATUS1_ADCLOW_MASK BIT(STATUS1_ADCLOW_SHIFT)
104#define STATUS1_ADCERR_MASK (0x1 << STATUS1_ADCERR_SHIFT) 117#define STATUS1_ADCERR_MASK BIT(STATUS1_ADCERR_SHIFT)
118#define MAX77836_STATUS1_ADC1K_MASK BIT(MAX77836_STATUS1_ADC1K_SHIFT)
105 119
106/* MAX14577 STATUS2 register */ 120/* MAX14577 STATUS2 register */
107#define STATUS2_CHGTYP_SHIFT 0 121#define STATUS2_CHGTYP_SHIFT 0
@@ -109,11 +123,13 @@ enum max14577_muic_charger_type {
109#define STATUS2_DCDTMR_SHIFT 4 123#define STATUS2_DCDTMR_SHIFT 4
110#define STATUS2_DBCHG_SHIFT 5 124#define STATUS2_DBCHG_SHIFT 5
111#define STATUS2_VBVOLT_SHIFT 6 125#define STATUS2_VBVOLT_SHIFT 6
126#define MAX77836_STATUS2_VIDRM_SHIFT 7
112#define STATUS2_CHGTYP_MASK (0x7 << STATUS2_CHGTYP_SHIFT) 127#define STATUS2_CHGTYP_MASK (0x7 << STATUS2_CHGTYP_SHIFT)
113#define STATUS2_CHGDETRUN_MASK (0x1 << STATUS2_CHGDETRUN_SHIFT) 128#define STATUS2_CHGDETRUN_MASK BIT(STATUS2_CHGDETRUN_SHIFT)
114#define STATUS2_DCDTMR_MASK (0x1 << STATUS2_DCDTMR_SHIFT) 129#define STATUS2_DCDTMR_MASK BIT(STATUS2_DCDTMR_SHIFT)
115#define STATUS2_DBCHG_MASK (0x1 << STATUS2_DBCHG_SHIFT) 130#define STATUS2_DBCHG_MASK BIT(STATUS2_DBCHG_SHIFT)
116#define STATUS2_VBVOLT_MASK (0x1 << STATUS2_VBVOLT_SHIFT) 131#define STATUS2_VBVOLT_MASK BIT(STATUS2_VBVOLT_SHIFT)
132#define MAX77836_STATUS2_VIDRM_MASK BIT(MAX77836_STATUS2_VIDRM_SHIFT)
117 133
118/* MAX14577 CONTROL1 register */ 134/* MAX14577 CONTROL1 register */
119#define COMN1SW_SHIFT 0 135#define COMN1SW_SHIFT 0
@@ -122,8 +138,8 @@ enum max14577_muic_charger_type {
122#define IDBEN_SHIFT 7 138#define IDBEN_SHIFT 7
123#define COMN1SW_MASK (0x7 << COMN1SW_SHIFT) 139#define COMN1SW_MASK (0x7 << COMN1SW_SHIFT)
124#define COMP2SW_MASK (0x7 << COMP2SW_SHIFT) 140#define COMP2SW_MASK (0x7 << COMP2SW_SHIFT)
125#define MICEN_MASK (0x1 << MICEN_SHIFT) 141#define MICEN_MASK BIT(MICEN_SHIFT)
126#define IDBEN_MASK (0x1 << IDBEN_SHIFT) 142#define IDBEN_MASK BIT(IDBEN_SHIFT)
127#define CLEAR_IDBEN_MICEN_MASK (COMN1SW_MASK | COMP2SW_MASK) 143#define CLEAR_IDBEN_MICEN_MASK (COMN1SW_MASK | COMP2SW_MASK)
128#define CTRL1_SW_USB ((1 << COMP2SW_SHIFT) \ 144#define CTRL1_SW_USB ((1 << COMP2SW_SHIFT) \
129 | (1 << COMN1SW_SHIFT)) 145 | (1 << COMN1SW_SHIFT))
@@ -143,14 +159,14 @@ enum max14577_muic_charger_type {
143#define CTRL2_ACCDET_SHIFT (5) 159#define CTRL2_ACCDET_SHIFT (5)
144#define CTRL2_USBCPINT_SHIFT (6) 160#define CTRL2_USBCPINT_SHIFT (6)
145#define CTRL2_RCPS_SHIFT (7) 161#define CTRL2_RCPS_SHIFT (7)
146#define CTRL2_LOWPWR_MASK (0x1 << CTRL2_LOWPWR_SHIFT) 162#define CTRL2_LOWPWR_MASK BIT(CTRL2_LOWPWR_SHIFT)
147#define CTRL2_ADCEN_MASK (0x1 << CTRL2_ADCEN_SHIFT) 163#define CTRL2_ADCEN_MASK BIT(CTRL2_ADCEN_SHIFT)
148#define CTRL2_CPEN_MASK (0x1 << CTRL2_CPEN_SHIFT) 164#define CTRL2_CPEN_MASK BIT(CTRL2_CPEN_SHIFT)
149#define CTRL2_SFOUTASRT_MASK (0x1 << CTRL2_SFOUTASRT_SHIFT) 165#define CTRL2_SFOUTASRT_MASK BIT(CTRL2_SFOUTASRT_SHIFT)
150#define CTRL2_SFOUTORD_MASK (0x1 << CTRL2_SFOUTORD_SHIFT) 166#define CTRL2_SFOUTORD_MASK BIT(CTRL2_SFOUTORD_SHIFT)
151#define CTRL2_ACCDET_MASK (0x1 << CTRL2_ACCDET_SHIFT) 167#define CTRL2_ACCDET_MASK BIT(CTRL2_ACCDET_SHIFT)
152#define CTRL2_USBCPINT_MASK (0x1 << CTRL2_USBCPINT_SHIFT) 168#define CTRL2_USBCPINT_MASK BIT(CTRL2_USBCPINT_SHIFT)
153#define CTRL2_RCPS_MASK (0x1 << CTR2_RCPS_SHIFT) 169#define CTRL2_RCPS_MASK BIT(CTRL2_RCPS_SHIFT)
154 170
155#define CTRL2_CPEN1_LOWPWR0 ((1 << CTRL2_CPEN_SHIFT) | \ 171#define CTRL2_CPEN1_LOWPWR0 ((1 << CTRL2_CPEN_SHIFT) | \
156 (0 << CTRL2_LOWPWR_SHIFT)) 172 (0 << CTRL2_LOWPWR_SHIFT))
@@ -198,14 +214,14 @@ enum max14577_charger_reg {
198#define CDETCTRL1_DBEXIT_SHIFT 5 214#define CDETCTRL1_DBEXIT_SHIFT 5
199#define CDETCTRL1_DBIDLE_SHIFT 6 215#define CDETCTRL1_DBIDLE_SHIFT 6
200#define CDETCTRL1_CDPDET_SHIFT 7 216#define CDETCTRL1_CDPDET_SHIFT 7
201#define CDETCTRL1_CHGDETEN_MASK (0x1 << CDETCTRL1_CHGDETEN_SHIFT) 217#define CDETCTRL1_CHGDETEN_MASK BIT(CDETCTRL1_CHGDETEN_SHIFT)
202#define CDETCTRL1_CHGTYPMAN_MASK (0x1 << CDETCTRL1_CHGTYPMAN_SHIFT) 218#define CDETCTRL1_CHGTYPMAN_MASK BIT(CDETCTRL1_CHGTYPMAN_SHIFT)
203#define CDETCTRL1_DCDEN_MASK (0x1 << CDETCTRL1_DCDEN_SHIFT) 219#define CDETCTRL1_DCDEN_MASK BIT(CDETCTRL1_DCDEN_SHIFT)
204#define CDETCTRL1_DCD2SCT_MASK (0x1 << CDETCTRL1_DCD2SCT_SHIFT) 220#define CDETCTRL1_DCD2SCT_MASK BIT(CDETCTRL1_DCD2SCT_SHIFT)
205#define CDETCTRL1_DCHKTM_MASK (0x1 << CDETCTRL1_DCHKTM_SHIFT) 221#define CDETCTRL1_DCHKTM_MASK BIT(CDETCTRL1_DCHKTM_SHIFT)
206#define CDETCTRL1_DBEXIT_MASK (0x1 << CDETCTRL1_DBEXIT_SHIFT) 222#define CDETCTRL1_DBEXIT_MASK BIT(CDETCTRL1_DBEXIT_SHIFT)
207#define CDETCTRL1_DBIDLE_MASK (0x1 << CDETCTRL1_DBIDLE_SHIFT) 223#define CDETCTRL1_DBIDLE_MASK BIT(CDETCTRL1_DBIDLE_SHIFT)
208#define CDETCTRL1_CDPDET_MASK (0x1 << CDETCTRL1_CDPDET_SHIFT) 224#define CDETCTRL1_CDPDET_MASK BIT(CDETCTRL1_CDPDET_SHIFT)
209 225
210/* MAX14577 CHGCTRL1 register */ 226/* MAX14577 CHGCTRL1 register */
211#define CHGCTRL1_TCHW_SHIFT 4 227#define CHGCTRL1_TCHW_SHIFT 4
@@ -213,9 +229,9 @@ enum max14577_charger_reg {
213 229
214/* MAX14577 CHGCTRL2 register */ 230/* MAX14577 CHGCTRL2 register */
215#define CHGCTRL2_MBCHOSTEN_SHIFT 6 231#define CHGCTRL2_MBCHOSTEN_SHIFT 6
216#define CHGCTRL2_MBCHOSTEN_MASK (0x1 << CHGCTRL2_MBCHOSTEN_SHIFT) 232#define CHGCTRL2_MBCHOSTEN_MASK BIT(CHGCTRL2_MBCHOSTEN_SHIFT)
217#define CHGCTRL2_VCHGR_RC_SHIFT 7 233#define CHGCTRL2_VCHGR_RC_SHIFT 7
218#define CHGCTRL2_VCHGR_RC_MASK (0x1 << CHGCTRL2_VCHGR_RC_SHIFT) 234#define CHGCTRL2_VCHGR_RC_MASK BIT(CHGCTRL2_VCHGR_RC_SHIFT)
219 235
220/* MAX14577 CHGCTRL3 register */ 236/* MAX14577 CHGCTRL3 register */
221#define CHGCTRL3_MBCCVWRC_SHIFT 0 237#define CHGCTRL3_MBCCVWRC_SHIFT 0
@@ -225,7 +241,7 @@ enum max14577_charger_reg {
225#define CHGCTRL4_MBCICHWRCH_SHIFT 0 241#define CHGCTRL4_MBCICHWRCH_SHIFT 0
226#define CHGCTRL4_MBCICHWRCH_MASK (0xf << CHGCTRL4_MBCICHWRCH_SHIFT) 242#define CHGCTRL4_MBCICHWRCH_MASK (0xf << CHGCTRL4_MBCICHWRCH_SHIFT)
227#define CHGCTRL4_MBCICHWRCL_SHIFT 4 243#define CHGCTRL4_MBCICHWRCL_SHIFT 4
228#define CHGCTRL4_MBCICHWRCL_MASK (0x1 << CHGCTRL4_MBCICHWRCL_SHIFT) 244#define CHGCTRL4_MBCICHWRCL_MASK BIT(CHGCTRL4_MBCICHWRCL_SHIFT)
229 245
230/* MAX14577 CHGCTRL5 register */ 246/* MAX14577 CHGCTRL5 register */
231#define CHGCTRL5_EOCS_SHIFT 0 247#define CHGCTRL5_EOCS_SHIFT 0
@@ -233,7 +249,7 @@ enum max14577_charger_reg {
233 249
234/* MAX14577 CHGCTRL6 register */ 250/* MAX14577 CHGCTRL6 register */
235#define CHGCTRL6_AUTOSTOP_SHIFT 5 251#define CHGCTRL6_AUTOSTOP_SHIFT 5
236#define CHGCTRL6_AUTOSTOP_MASK (0x1 << CHGCTRL6_AUTOSTOP_SHIFT) 252#define CHGCTRL6_AUTOSTOP_MASK BIT(CHGCTRL6_AUTOSTOP_SHIFT)
237 253
238/* MAX14577 CHGCTRL7 register */ 254/* MAX14577 CHGCTRL7 register */
239#define CHGCTRL7_OTPCGHCVS_SHIFT 0 255#define CHGCTRL7_OTPCGHCVS_SHIFT 0
@@ -245,14 +261,111 @@ enum max14577_charger_reg {
245#define MAX14577_REGULATOR_CURRENT_LIMIT_HIGH_STEP 50000 261#define MAX14577_REGULATOR_CURRENT_LIMIT_HIGH_STEP 50000
246#define MAX14577_REGULATOR_CURRENT_LIMIT_MAX 950000 262#define MAX14577_REGULATOR_CURRENT_LIMIT_MAX 950000
247 263
264/* MAX77836 regulator current limits (as in CHGCTRL4 register), uA */
265#define MAX77836_REGULATOR_CURRENT_LIMIT_MIN 45000
266#define MAX77836_REGULATOR_CURRENT_LIMIT_HIGH_START 100000
267#define MAX77836_REGULATOR_CURRENT_LIMIT_HIGH_STEP 25000
268#define MAX77836_REGULATOR_CURRENT_LIMIT_MAX 475000
269
248/* MAX14577 regulator SFOUT LDO voltage, fixed, uV */ 270/* MAX14577 regulator SFOUT LDO voltage, fixed, uV */
249#define MAX14577_REGULATOR_SAFEOUT_VOLTAGE 4900000 271#define MAX14577_REGULATOR_SAFEOUT_VOLTAGE 4900000
250 272
273/* MAX77836 regulator LDOx voltage, uV */
274#define MAX77836_REGULATOR_LDO_VOLTAGE_MIN 800000
275#define MAX77836_REGULATOR_LDO_VOLTAGE_MAX 3950000
276#define MAX77836_REGULATOR_LDO_VOLTAGE_STEP 50000
277#define MAX77836_REGULATOR_LDO_VOLTAGE_STEPS_NUM 64
278
279/* Slave addr = 0x46: PMIC */
280enum max77836_pmic_reg {
281 MAX77836_PMIC_REG_PMIC_ID = 0x20,
282 MAX77836_PMIC_REG_PMIC_REV = 0x21,
283 MAX77836_PMIC_REG_INTSRC = 0x22,
284 MAX77836_PMIC_REG_INTSRC_MASK = 0x23,
285 MAX77836_PMIC_REG_TOPSYS_INT = 0x24,
286 MAX77836_PMIC_REG_TOPSYS_INT_MASK = 0x26,
287 MAX77836_PMIC_REG_TOPSYS_STAT = 0x28,
288 MAX77836_PMIC_REG_MRSTB_CNTL = 0x2A,
289 MAX77836_PMIC_REG_LSCNFG = 0x2B,
290
291 MAX77836_LDO_REG_CNFG1_LDO1 = 0x51,
292 MAX77836_LDO_REG_CNFG2_LDO1 = 0x52,
293 MAX77836_LDO_REG_CNFG1_LDO2 = 0x53,
294 MAX77836_LDO_REG_CNFG2_LDO2 = 0x54,
295 MAX77836_LDO_REG_CNFG_LDO_BIAS = 0x55,
296
297 MAX77836_COMP_REG_COMP1 = 0x60,
298
299 MAX77836_PMIC_REG_END,
300};
301
302#define MAX77836_INTSRC_MASK_TOP_INT_SHIFT 1
303#define MAX77836_INTSRC_MASK_MUIC_CHG_INT_SHIFT 3
304#define MAX77836_INTSRC_MASK_TOP_INT_MASK BIT(MAX77836_INTSRC_MASK_TOP_INT_SHIFT)
305#define MAX77836_INTSRC_MASK_MUIC_CHG_INT_MASK BIT(MAX77836_INTSRC_MASK_MUIC_CHG_INT_SHIFT)
306
307/* MAX77836 PMIC interrupts */
308#define MAX77836_TOPSYS_INT_T120C_SHIFT 0
309#define MAX77836_TOPSYS_INT_T140C_SHIFT 1
310#define MAX77836_TOPSYS_INT_T120C_MASK BIT(MAX77836_TOPSYS_INT_T120C_SHIFT)
311#define MAX77836_TOPSYS_INT_T140C_MASK BIT(MAX77836_TOPSYS_INT_T140C_SHIFT)
312
313/* LDO1/LDO2 CONFIG1 register */
314#define MAX77836_CNFG1_LDO_PWRMD_SHIFT 6
315#define MAX77836_CNFG1_LDO_TV_SHIFT 0
316#define MAX77836_CNFG1_LDO_PWRMD_MASK (0x3 << MAX77836_CNFG1_LDO_PWRMD_SHIFT)
317#define MAX77836_CNFG1_LDO_TV_MASK (0x3f << MAX77836_CNFG1_LDO_TV_SHIFT)
318
319/* LDO1/LDO2 CONFIG2 register */
320#define MAX77836_CNFG2_LDO_OVCLMPEN_SHIFT 7
321#define MAX77836_CNFG2_LDO_ALPMEN_SHIFT 6
322#define MAX77836_CNFG2_LDO_COMP_SHIFT 4
323#define MAX77836_CNFG2_LDO_POK_SHIFT 3
324#define MAX77836_CNFG2_LDO_ADE_SHIFT 1
325#define MAX77836_CNFG2_LDO_SS_SHIFT 0
326#define MAX77836_CNFG2_LDO_OVCLMPEN_MASK BIT(MAX77836_CNFG2_LDO_OVCLMPEN_SHIFT)
327#define MAX77836_CNFG2_LDO_ALPMEN_MASK BIT(MAX77836_CNFG2_LDO_ALPMEN_SHIFT)
328#define MAX77836_CNFG2_LDO_COMP_MASK (0x3 << MAX77836_CNFG2_LDO_COMP_SHIFT)
329#define MAX77836_CNFG2_LDO_POK_MASK BIT(MAX77836_CNFG2_LDO_POK_SHIFT)
330#define MAX77836_CNFG2_LDO_ADE_MASK BIT(MAX77836_CNFG2_LDO_ADE_SHIFT)
331#define MAX77836_CNFG2_LDO_SS_MASK BIT(MAX77836_CNFG2_LDO_SS_SHIFT)
332
333/* Slave addr = 0x6C: Fuel-Gauge/Battery */
334enum max77836_fg_reg {
335 MAX77836_FG_REG_VCELL_MSB = 0x02,
336 MAX77836_FG_REG_VCELL_LSB = 0x03,
337 MAX77836_FG_REG_SOC_MSB = 0x04,
338 MAX77836_FG_REG_SOC_LSB = 0x05,
339 MAX77836_FG_REG_MODE_H = 0x06,
340 MAX77836_FG_REG_MODE_L = 0x07,
341 MAX77836_FG_REG_VERSION_MSB = 0x08,
342 MAX77836_FG_REG_VERSION_LSB = 0x09,
343 MAX77836_FG_REG_HIBRT_H = 0x0A,
344 MAX77836_FG_REG_HIBRT_L = 0x0B,
345 MAX77836_FG_REG_CONFIG_H = 0x0C,
346 MAX77836_FG_REG_CONFIG_L = 0x0D,
347 MAX77836_FG_REG_VALRT_MIN = 0x14,
348 MAX77836_FG_REG_VALRT_MAX = 0x15,
349 MAX77836_FG_REG_CRATE_MSB = 0x16,
350 MAX77836_FG_REG_CRATE_LSB = 0x17,
351 MAX77836_FG_REG_VRESET = 0x18,
352 MAX77836_FG_REG_FGID = 0x19,
353 MAX77836_FG_REG_STATUS_H = 0x1A,
354 MAX77836_FG_REG_STATUS_L = 0x1B,
355 /*
356 * TODO: TABLE registers
357 * TODO: CMD register
358 */
359
360 MAX77836_FG_REG_END,
361};
362
251enum max14577_irq { 363enum max14577_irq {
252 /* INT1 */ 364 /* INT1 */
253 MAX14577_IRQ_INT1_ADC, 365 MAX14577_IRQ_INT1_ADC,
254 MAX14577_IRQ_INT1_ADCLOW, 366 MAX14577_IRQ_INT1_ADCLOW,
255 MAX14577_IRQ_INT1_ADCERR, 367 MAX14577_IRQ_INT1_ADCERR,
368 MAX77836_IRQ_INT1_ADC1K,
256 369
257 /* INT2 */ 370 /* INT2 */
258 MAX14577_IRQ_INT2_CHGTYP, 371 MAX14577_IRQ_INT2_CHGTYP,
@@ -260,6 +373,7 @@ enum max14577_irq {
260 MAX14577_IRQ_INT2_DCDTMR, 373 MAX14577_IRQ_INT2_DCDTMR,
261 MAX14577_IRQ_INT2_DBCHG, 374 MAX14577_IRQ_INT2_DBCHG,
262 MAX14577_IRQ_INT2_VBVOLT, 375 MAX14577_IRQ_INT2_VBVOLT,
376 MAX77836_IRQ_INT2_VIDRM,
263 377
264 /* INT3 */ 378 /* INT3 */
265 MAX14577_IRQ_INT3_EOC, 379 MAX14577_IRQ_INT3_EOC,
@@ -267,21 +381,25 @@ enum max14577_irq {
267 MAX14577_IRQ_INT3_OVP, 381 MAX14577_IRQ_INT3_OVP,
268 MAX14577_IRQ_INT3_MBCCHGERR, 382 MAX14577_IRQ_INT3_MBCCHGERR,
269 383
384 /* TOPSYS_INT, only MAX77836 */
385 MAX77836_IRQ_TOPSYS_T140C,
386 MAX77836_IRQ_TOPSYS_T120C,
387
270 MAX14577_IRQ_NUM, 388 MAX14577_IRQ_NUM,
271}; 389};
272 390
273struct max14577 { 391struct max14577 {
274 struct device *dev; 392 struct device *dev;
275 struct i2c_client *i2c; /* Slave addr = 0x4A */ 393 struct i2c_client *i2c; /* Slave addr = 0x4A */
394 struct i2c_client *i2c_pmic; /* Slave addr = 0x46 */
395 enum maxim_device_type dev_type;
276 396
277 struct regmap *regmap; 397 struct regmap *regmap; /* For MUIC and Charger */
398 struct regmap *regmap_pmic;
278 399
279 struct regmap_irq_chip_data *irq_data; 400 struct regmap_irq_chip_data *irq_data; /* For MUIC and Charger */
401 struct regmap_irq_chip_data *irq_data_pmic;
280 int irq; 402 int irq;
281
282 /* Device ID */
283 u8 vendor_id; /* Vendor Identification */
284 u8 device_id; /* Chip Version */
285}; 403};
286 404
287/* MAX14577 shared regmap API function */ 405/* MAX14577 shared regmap API function */
diff --git a/include/linux/mfd/max14577.h b/include/linux/mfd/max14577.h
index 736d39c3ec0d..c83fbed1c7b6 100644
--- a/include/linux/mfd/max14577.h
+++ b/include/linux/mfd/max14577.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * max14577.h - Driver for the Maxim 14577 2 * max14577.h - Driver for the Maxim 14577/77836
3 * 3 *
4 * Copyright (C) 2013 Samsung Electrnoics 4 * Copyright (C) 2014 Samsung Electrnoics
5 * Chanwoo Choi <cw00.choi@samsung.com> 5 * Chanwoo Choi <cw00.choi@samsung.com>
6 * Krzysztof Kozlowski <k.kozlowski@samsung.com> 6 * Krzysztof Kozlowski <k.kozlowski@samsung.com>
7 * 7 *
@@ -20,6 +20,9 @@
20 * MAX14577 has MUIC, Charger devices. 20 * MAX14577 has MUIC, Charger devices.
21 * The devices share the same I2C bus and interrupt line 21 * The devices share the same I2C bus and interrupt line
22 * included in this mfd driver. 22 * included in this mfd driver.
23 *
24 * MAX77836 has additional PMIC and Fuel-Gauge on different I2C slave
25 * addresses.
23 */ 26 */
24 27
25#ifndef __MAX14577_H__ 28#ifndef __MAX14577_H__
@@ -32,7 +35,17 @@ enum max14577_regulators {
32 MAX14577_SAFEOUT = 0, 35 MAX14577_SAFEOUT = 0,
33 MAX14577_CHARGER, 36 MAX14577_CHARGER,
34 37
35 MAX14577_REG_MAX, 38 MAX14577_REGULATOR_NUM,
39};
40
41/* MAX77836 regulator IDs */
42enum max77836_regulators {
43 MAX77836_SAFEOUT = 0,
44 MAX77836_CHARGER,
45 MAX77836_LDO1,
46 MAX77836_LDO2,
47
48 MAX77836_REGULATOR_NUM,
36}; 49};
37 50
38struct max14577_regulator_platform_data { 51struct max14577_regulator_platform_data {
diff --git a/include/linux/mfd/mc13xxx.h b/include/linux/mfd/mc13xxx.h
index a326c850f046..d63b1d309106 100644
--- a/include/linux/mfd/mc13xxx.h
+++ b/include/linux/mfd/mc13xxx.h
@@ -117,10 +117,6 @@ struct mc13xxx_led_platform_data {
117 117
118#define MAX_LED_CONTROL_REGS 6 118#define MAX_LED_CONTROL_REGS 6
119 119
120struct mc13xxx_leds_platform_data {
121 struct mc13xxx_led_platform_data *led;
122 int num_leds;
123
124/* MC13783 LED Control 0 */ 120/* MC13783 LED Control 0 */
125#define MC13783_LED_C0_ENABLE (1 << 0) 121#define MC13783_LED_C0_ENABLE (1 << 0)
126#define MC13783_LED_C0_TRIODE_MD (1 << 7) 122#define MC13783_LED_C0_TRIODE_MD (1 << 7)
@@ -169,10 +165,13 @@ struct mc13xxx_leds_platform_data {
169/* MC34708 LED Control 0 */ 165/* MC34708 LED Control 0 */
170#define MC34708_LED_C0_CURRENT_R(x) (((x) & 0x3) << 9) 166#define MC34708_LED_C0_CURRENT_R(x) (((x) & 0x3) << 9)
171#define MC34708_LED_C0_CURRENT_G(x) (((x) & 0x3) << 21) 167#define MC34708_LED_C0_CURRENT_G(x) (((x) & 0x3) << 21)
168
169struct mc13xxx_leds_platform_data {
170 struct mc13xxx_led_platform_data *led;
171 int num_leds;
172 u32 led_control[MAX_LED_CONTROL_REGS]; 172 u32 led_control[MAX_LED_CONTROL_REGS];
173}; 173};
174 174
175struct mc13xxx_buttons_platform_data {
176#define MC13783_BUTTON_DBNC_0MS 0 175#define MC13783_BUTTON_DBNC_0MS 0
177#define MC13783_BUTTON_DBNC_30MS 1 176#define MC13783_BUTTON_DBNC_30MS 1
178#define MC13783_BUTTON_DBNC_150MS 2 177#define MC13783_BUTTON_DBNC_150MS 2
@@ -180,6 +179,8 @@ struct mc13xxx_buttons_platform_data {
180#define MC13783_BUTTON_ENABLE (1 << 2) 179#define MC13783_BUTTON_ENABLE (1 << 2)
181#define MC13783_BUTTON_POL_INVERT (1 << 3) 180#define MC13783_BUTTON_POL_INVERT (1 << 3)
182#define MC13783_BUTTON_RESET_EN (1 << 4) 181#define MC13783_BUTTON_RESET_EN (1 << 4)
182
183struct mc13xxx_buttons_platform_data {
183 int b1on_flags; 184 int b1on_flags;
184 unsigned short b1on_key; 185 unsigned short b1on_key;
185 int b2on_flags; 186 int b2on_flags;
@@ -188,14 +189,14 @@ struct mc13xxx_buttons_platform_data {
188 unsigned short b3on_key; 189 unsigned short b3on_key;
189}; 190};
190 191
192#define MC13783_TS_ATO_FIRST false
193#define MC13783_TS_ATO_EACH true
194
191struct mc13xxx_ts_platform_data { 195struct mc13xxx_ts_platform_data {
192 /* Delay between Touchscreen polarization and ADC Conversion. 196 /* Delay between Touchscreen polarization and ADC Conversion.
193 * Given in clock ticks of a 32 kHz clock which gives a granularity of 197 * Given in clock ticks of a 32 kHz clock which gives a granularity of
194 * about 30.5ms */ 198 * about 30.5ms */
195 u8 ato; 199 u8 ato;
196
197#define MC13783_TS_ATO_FIRST false
198#define MC13783_TS_ATO_EACH true
199 /* Use the ATO delay only for the first conversion or for each one */ 200 /* Use the ATO delay only for the first conversion or for each one */
200 bool atox; 201 bool atox;
201}; 202};
@@ -210,11 +211,12 @@ struct mc13xxx_codec_platform_data {
210 enum mc13783_ssi_port dac_ssi_port; 211 enum mc13783_ssi_port dac_ssi_port;
211}; 212};
212 213
213struct mc13xxx_platform_data { 214#define MC13XXX_USE_TOUCHSCREEN (1 << 0)
214#define MC13XXX_USE_TOUCHSCREEN (1 << 0)
215#define MC13XXX_USE_CODEC (1 << 1) 215#define MC13XXX_USE_CODEC (1 << 1)
216#define MC13XXX_USE_ADC (1 << 2) 216#define MC13XXX_USE_ADC (1 << 2)
217#define MC13XXX_USE_RTC (1 << 3) 217#define MC13XXX_USE_RTC (1 << 3)
218
219struct mc13xxx_platform_data {
218 unsigned int flags; 220 unsigned int flags;
219 221
220 struct mc13xxx_regulator_platform_data regulators; 222 struct mc13xxx_regulator_platform_data regulators;
diff --git a/include/linux/mfd/palmas.h b/include/linux/mfd/palmas.h
index 9974e387e483..3420e09e2e20 100644
--- a/include/linux/mfd/palmas.h
+++ b/include/linux/mfd/palmas.h
@@ -415,7 +415,7 @@ struct palmas_usb {
415 struct palmas *palmas; 415 struct palmas *palmas;
416 struct device *dev; 416 struct device *dev;
417 417
418 struct extcon_dev edev; 418 struct extcon_dev *edev;
419 419
420 int id_otg_irq; 420 int id_otg_irq;
421 int id_irq; 421 int id_irq;
@@ -482,10 +482,10 @@ enum usb_irq_events {
482 482
483/* helper macro to get correct slave number */ 483/* helper macro to get correct slave number */
484#define PALMAS_BASE_TO_SLAVE(x) ((x >> 8) - 1) 484#define PALMAS_BASE_TO_SLAVE(x) ((x >> 8) - 1)
485#define PALMAS_BASE_TO_REG(x, y) ((x & 0xff) + y) 485#define PALMAS_BASE_TO_REG(x, y) ((x & 0xFF) + y)
486 486
487/* Base addresses of IP blocks in Palmas */ 487/* Base addresses of IP blocks in Palmas */
488#define PALMAS_SMPS_DVS_BASE 0x20 488#define PALMAS_SMPS_DVS_BASE 0x020
489#define PALMAS_RTC_BASE 0x100 489#define PALMAS_RTC_BASE 0x100
490#define PALMAS_VALIDITY_BASE 0x118 490#define PALMAS_VALIDITY_BASE 0x118
491#define PALMAS_SMPS_BASE 0x120 491#define PALMAS_SMPS_BASE 0x120
@@ -504,19 +504,19 @@ enum usb_irq_events {
504#define PALMAS_TRIM_GPADC_BASE 0x3CD 504#define PALMAS_TRIM_GPADC_BASE 0x3CD
505 505
506/* Registers for function RTC */ 506/* Registers for function RTC */
507#define PALMAS_SECONDS_REG 0x0 507#define PALMAS_SECONDS_REG 0x00
508#define PALMAS_MINUTES_REG 0x1 508#define PALMAS_MINUTES_REG 0x01
509#define PALMAS_HOURS_REG 0x2 509#define PALMAS_HOURS_REG 0x02
510#define PALMAS_DAYS_REG 0x3 510#define PALMAS_DAYS_REG 0x03
511#define PALMAS_MONTHS_REG 0x4 511#define PALMAS_MONTHS_REG 0x04
512#define PALMAS_YEARS_REG 0x5 512#define PALMAS_YEARS_REG 0x05
513#define PALMAS_WEEKS_REG 0x6 513#define PALMAS_WEEKS_REG 0x06
514#define PALMAS_ALARM_SECONDS_REG 0x8 514#define PALMAS_ALARM_SECONDS_REG 0x08
515#define PALMAS_ALARM_MINUTES_REG 0x9 515#define PALMAS_ALARM_MINUTES_REG 0x09
516#define PALMAS_ALARM_HOURS_REG 0xA 516#define PALMAS_ALARM_HOURS_REG 0x0A
517#define PALMAS_ALARM_DAYS_REG 0xB 517#define PALMAS_ALARM_DAYS_REG 0x0B
518#define PALMAS_ALARM_MONTHS_REG 0xC 518#define PALMAS_ALARM_MONTHS_REG 0x0C
519#define PALMAS_ALARM_YEARS_REG 0xD 519#define PALMAS_ALARM_YEARS_REG 0x0D
520#define PALMAS_RTC_CTRL_REG 0x10 520#define PALMAS_RTC_CTRL_REG 0x10
521#define PALMAS_RTC_STATUS_REG 0x11 521#define PALMAS_RTC_STATUS_REG 0x11
522#define PALMAS_RTC_INTERRUPTS_REG 0x12 522#define PALMAS_RTC_INTERRUPTS_REG 0x12
@@ -527,201 +527,201 @@ enum usb_irq_events {
527 527
528/* Bit definitions for SECONDS_REG */ 528/* Bit definitions for SECONDS_REG */
529#define PALMAS_SECONDS_REG_SEC1_MASK 0x70 529#define PALMAS_SECONDS_REG_SEC1_MASK 0x70
530#define PALMAS_SECONDS_REG_SEC1_SHIFT 4 530#define PALMAS_SECONDS_REG_SEC1_SHIFT 0x04
531#define PALMAS_SECONDS_REG_SEC0_MASK 0x0f 531#define PALMAS_SECONDS_REG_SEC0_MASK 0x0F
532#define PALMAS_SECONDS_REG_SEC0_SHIFT 0 532#define PALMAS_SECONDS_REG_SEC0_SHIFT 0x00
533 533
534/* Bit definitions for MINUTES_REG */ 534/* Bit definitions for MINUTES_REG */
535#define PALMAS_MINUTES_REG_MIN1_MASK 0x70 535#define PALMAS_MINUTES_REG_MIN1_MASK 0x70
536#define PALMAS_MINUTES_REG_MIN1_SHIFT 4 536#define PALMAS_MINUTES_REG_MIN1_SHIFT 0x04
537#define PALMAS_MINUTES_REG_MIN0_MASK 0x0f 537#define PALMAS_MINUTES_REG_MIN0_MASK 0x0F
538#define PALMAS_MINUTES_REG_MIN0_SHIFT 0 538#define PALMAS_MINUTES_REG_MIN0_SHIFT 0x00
539 539
540/* Bit definitions for HOURS_REG */ 540/* Bit definitions for HOURS_REG */
541#define PALMAS_HOURS_REG_PM_NAM 0x80 541#define PALMAS_HOURS_REG_PM_NAM 0x80
542#define PALMAS_HOURS_REG_PM_NAM_SHIFT 7 542#define PALMAS_HOURS_REG_PM_NAM_SHIFT 0x07
543#define PALMAS_HOURS_REG_HOUR1_MASK 0x30 543#define PALMAS_HOURS_REG_HOUR1_MASK 0x30
544#define PALMAS_HOURS_REG_HOUR1_SHIFT 4 544#define PALMAS_HOURS_REG_HOUR1_SHIFT 0x04
545#define PALMAS_HOURS_REG_HOUR0_MASK 0x0f 545#define PALMAS_HOURS_REG_HOUR0_MASK 0x0F
546#define PALMAS_HOURS_REG_HOUR0_SHIFT 0 546#define PALMAS_HOURS_REG_HOUR0_SHIFT 0x00
547 547
548/* Bit definitions for DAYS_REG */ 548/* Bit definitions for DAYS_REG */
549#define PALMAS_DAYS_REG_DAY1_MASK 0x30 549#define PALMAS_DAYS_REG_DAY1_MASK 0x30
550#define PALMAS_DAYS_REG_DAY1_SHIFT 4 550#define PALMAS_DAYS_REG_DAY1_SHIFT 0x04
551#define PALMAS_DAYS_REG_DAY0_MASK 0x0f 551#define PALMAS_DAYS_REG_DAY0_MASK 0x0F
552#define PALMAS_DAYS_REG_DAY0_SHIFT 0 552#define PALMAS_DAYS_REG_DAY0_SHIFT 0x00
553 553
554/* Bit definitions for MONTHS_REG */ 554/* Bit definitions for MONTHS_REG */
555#define PALMAS_MONTHS_REG_MONTH1 0x10 555#define PALMAS_MONTHS_REG_MONTH1 0x10
556#define PALMAS_MONTHS_REG_MONTH1_SHIFT 4 556#define PALMAS_MONTHS_REG_MONTH1_SHIFT 0x04
557#define PALMAS_MONTHS_REG_MONTH0_MASK 0x0f 557#define PALMAS_MONTHS_REG_MONTH0_MASK 0x0F
558#define PALMAS_MONTHS_REG_MONTH0_SHIFT 0 558#define PALMAS_MONTHS_REG_MONTH0_SHIFT 0x00
559 559
560/* Bit definitions for YEARS_REG */ 560/* Bit definitions for YEARS_REG */
561#define PALMAS_YEARS_REG_YEAR1_MASK 0xf0 561#define PALMAS_YEARS_REG_YEAR1_MASK 0xf0
562#define PALMAS_YEARS_REG_YEAR1_SHIFT 4 562#define PALMAS_YEARS_REG_YEAR1_SHIFT 0x04
563#define PALMAS_YEARS_REG_YEAR0_MASK 0x0f 563#define PALMAS_YEARS_REG_YEAR0_MASK 0x0F
564#define PALMAS_YEARS_REG_YEAR0_SHIFT 0 564#define PALMAS_YEARS_REG_YEAR0_SHIFT 0x00
565 565
566/* Bit definitions for WEEKS_REG */ 566/* Bit definitions for WEEKS_REG */
567#define PALMAS_WEEKS_REG_WEEK_MASK 0x07 567#define PALMAS_WEEKS_REG_WEEK_MASK 0x07
568#define PALMAS_WEEKS_REG_WEEK_SHIFT 0 568#define PALMAS_WEEKS_REG_WEEK_SHIFT 0x00
569 569
570/* Bit definitions for ALARM_SECONDS_REG */ 570/* Bit definitions for ALARM_SECONDS_REG */
571#define PALMAS_ALARM_SECONDS_REG_ALARM_SEC1_MASK 0x70 571#define PALMAS_ALARM_SECONDS_REG_ALARM_SEC1_MASK 0x70
572#define PALMAS_ALARM_SECONDS_REG_ALARM_SEC1_SHIFT 4 572#define PALMAS_ALARM_SECONDS_REG_ALARM_SEC1_SHIFT 0x04
573#define PALMAS_ALARM_SECONDS_REG_ALARM_SEC0_MASK 0x0f 573#define PALMAS_ALARM_SECONDS_REG_ALARM_SEC0_MASK 0x0F
574#define PALMAS_ALARM_SECONDS_REG_ALARM_SEC0_SHIFT 0 574#define PALMAS_ALARM_SECONDS_REG_ALARM_SEC0_SHIFT 0x00
575 575
576/* Bit definitions for ALARM_MINUTES_REG */ 576/* Bit definitions for ALARM_MINUTES_REG */
577#define PALMAS_ALARM_MINUTES_REG_ALARM_MIN1_MASK 0x70 577#define PALMAS_ALARM_MINUTES_REG_ALARM_MIN1_MASK 0x70
578#define PALMAS_ALARM_MINUTES_REG_ALARM_MIN1_SHIFT 4 578#define PALMAS_ALARM_MINUTES_REG_ALARM_MIN1_SHIFT 0x04
579#define PALMAS_ALARM_MINUTES_REG_ALARM_MIN0_MASK 0x0f 579#define PALMAS_ALARM_MINUTES_REG_ALARM_MIN0_MASK 0x0F
580#define PALMAS_ALARM_MINUTES_REG_ALARM_MIN0_SHIFT 0 580#define PALMAS_ALARM_MINUTES_REG_ALARM_MIN0_SHIFT 0x00
581 581
582/* Bit definitions for ALARM_HOURS_REG */ 582/* Bit definitions for ALARM_HOURS_REG */
583#define PALMAS_ALARM_HOURS_REG_ALARM_PM_NAM 0x80 583#define PALMAS_ALARM_HOURS_REG_ALARM_PM_NAM 0x80
584#define PALMAS_ALARM_HOURS_REG_ALARM_PM_NAM_SHIFT 7 584#define PALMAS_ALARM_HOURS_REG_ALARM_PM_NAM_SHIFT 0x07
585#define PALMAS_ALARM_HOURS_REG_ALARM_HOUR1_MASK 0x30 585#define PALMAS_ALARM_HOURS_REG_ALARM_HOUR1_MASK 0x30
586#define PALMAS_ALARM_HOURS_REG_ALARM_HOUR1_SHIFT 4 586#define PALMAS_ALARM_HOURS_REG_ALARM_HOUR1_SHIFT 0x04
587#define PALMAS_ALARM_HOURS_REG_ALARM_HOUR0_MASK 0x0f 587#define PALMAS_ALARM_HOURS_REG_ALARM_HOUR0_MASK 0x0F
588#define PALMAS_ALARM_HOURS_REG_ALARM_HOUR0_SHIFT 0 588#define PALMAS_ALARM_HOURS_REG_ALARM_HOUR0_SHIFT 0x00
589 589
590/* Bit definitions for ALARM_DAYS_REG */ 590/* Bit definitions for ALARM_DAYS_REG */
591#define PALMAS_ALARM_DAYS_REG_ALARM_DAY1_MASK 0x30 591#define PALMAS_ALARM_DAYS_REG_ALARM_DAY1_MASK 0x30
592#define PALMAS_ALARM_DAYS_REG_ALARM_DAY1_SHIFT 4 592#define PALMAS_ALARM_DAYS_REG_ALARM_DAY1_SHIFT 0x04
593#define PALMAS_ALARM_DAYS_REG_ALARM_DAY0_MASK 0x0f 593#define PALMAS_ALARM_DAYS_REG_ALARM_DAY0_MASK 0x0F
594#define PALMAS_ALARM_DAYS_REG_ALARM_DAY0_SHIFT 0 594#define PALMAS_ALARM_DAYS_REG_ALARM_DAY0_SHIFT 0x00
595 595
596/* Bit definitions for ALARM_MONTHS_REG */ 596/* Bit definitions for ALARM_MONTHS_REG */
597#define PALMAS_ALARM_MONTHS_REG_ALARM_MONTH1 0x10 597#define PALMAS_ALARM_MONTHS_REG_ALARM_MONTH1 0x10
598#define PALMAS_ALARM_MONTHS_REG_ALARM_MONTH1_SHIFT 4 598#define PALMAS_ALARM_MONTHS_REG_ALARM_MONTH1_SHIFT 0x04
599#define PALMAS_ALARM_MONTHS_REG_ALARM_MONTH0_MASK 0x0f 599#define PALMAS_ALARM_MONTHS_REG_ALARM_MONTH0_MASK 0x0F
600#define PALMAS_ALARM_MONTHS_REG_ALARM_MONTH0_SHIFT 0 600#define PALMAS_ALARM_MONTHS_REG_ALARM_MONTH0_SHIFT 0x00
601 601
602/* Bit definitions for ALARM_YEARS_REG */ 602/* Bit definitions for ALARM_YEARS_REG */
603#define PALMAS_ALARM_YEARS_REG_ALARM_YEAR1_MASK 0xf0 603#define PALMAS_ALARM_YEARS_REG_ALARM_YEAR1_MASK 0xf0
604#define PALMAS_ALARM_YEARS_REG_ALARM_YEAR1_SHIFT 4 604#define PALMAS_ALARM_YEARS_REG_ALARM_YEAR1_SHIFT 0x04
605#define PALMAS_ALARM_YEARS_REG_ALARM_YEAR0_MASK 0x0f 605#define PALMAS_ALARM_YEARS_REG_ALARM_YEAR0_MASK 0x0F
606#define PALMAS_ALARM_YEARS_REG_ALARM_YEAR0_SHIFT 0 606#define PALMAS_ALARM_YEARS_REG_ALARM_YEAR0_SHIFT 0x00
607 607
608/* Bit definitions for RTC_CTRL_REG */ 608/* Bit definitions for RTC_CTRL_REG */
609#define PALMAS_RTC_CTRL_REG_RTC_V_OPT 0x80 609#define PALMAS_RTC_CTRL_REG_RTC_V_OPT 0x80
610#define PALMAS_RTC_CTRL_REG_RTC_V_OPT_SHIFT 7 610#define PALMAS_RTC_CTRL_REG_RTC_V_OPT_SHIFT 0x07
611#define PALMAS_RTC_CTRL_REG_GET_TIME 0x40 611#define PALMAS_RTC_CTRL_REG_GET_TIME 0x40
612#define PALMAS_RTC_CTRL_REG_GET_TIME_SHIFT 6 612#define PALMAS_RTC_CTRL_REG_GET_TIME_SHIFT 0x06
613#define PALMAS_RTC_CTRL_REG_SET_32_COUNTER 0x20 613#define PALMAS_RTC_CTRL_REG_SET_32_COUNTER 0x20
614#define PALMAS_RTC_CTRL_REG_SET_32_COUNTER_SHIFT 5 614#define PALMAS_RTC_CTRL_REG_SET_32_COUNTER_SHIFT 0x05
615#define PALMAS_RTC_CTRL_REG_TEST_MODE 0x10 615#define PALMAS_RTC_CTRL_REG_TEST_MODE 0x10
616#define PALMAS_RTC_CTRL_REG_TEST_MODE_SHIFT 4 616#define PALMAS_RTC_CTRL_REG_TEST_MODE_SHIFT 0x04
617#define PALMAS_RTC_CTRL_REG_MODE_12_24 0x08 617#define PALMAS_RTC_CTRL_REG_MODE_12_24 0x08
618#define PALMAS_RTC_CTRL_REG_MODE_12_24_SHIFT 3 618#define PALMAS_RTC_CTRL_REG_MODE_12_24_SHIFT 0x03
619#define PALMAS_RTC_CTRL_REG_AUTO_COMP 0x04 619#define PALMAS_RTC_CTRL_REG_AUTO_COMP 0x04
620#define PALMAS_RTC_CTRL_REG_AUTO_COMP_SHIFT 2 620#define PALMAS_RTC_CTRL_REG_AUTO_COMP_SHIFT 0x02
621#define PALMAS_RTC_CTRL_REG_ROUND_30S 0x02 621#define PALMAS_RTC_CTRL_REG_ROUND_30S 0x02
622#define PALMAS_RTC_CTRL_REG_ROUND_30S_SHIFT 1 622#define PALMAS_RTC_CTRL_REG_ROUND_30S_SHIFT 0x01
623#define PALMAS_RTC_CTRL_REG_STOP_RTC 0x01 623#define PALMAS_RTC_CTRL_REG_STOP_RTC 0x01
624#define PALMAS_RTC_CTRL_REG_STOP_RTC_SHIFT 0 624#define PALMAS_RTC_CTRL_REG_STOP_RTC_SHIFT 0x00
625 625
626/* Bit definitions for RTC_STATUS_REG */ 626/* Bit definitions for RTC_STATUS_REG */
627#define PALMAS_RTC_STATUS_REG_POWER_UP 0x80 627#define PALMAS_RTC_STATUS_REG_POWER_UP 0x80
628#define PALMAS_RTC_STATUS_REG_POWER_UP_SHIFT 7 628#define PALMAS_RTC_STATUS_REG_POWER_UP_SHIFT 0x07
629#define PALMAS_RTC_STATUS_REG_ALARM 0x40 629#define PALMAS_RTC_STATUS_REG_ALARM 0x40
630#define PALMAS_RTC_STATUS_REG_ALARM_SHIFT 6 630#define PALMAS_RTC_STATUS_REG_ALARM_SHIFT 0x06
631#define PALMAS_RTC_STATUS_REG_EVENT_1D 0x20 631#define PALMAS_RTC_STATUS_REG_EVENT_1D 0x20
632#define PALMAS_RTC_STATUS_REG_EVENT_1D_SHIFT 5 632#define PALMAS_RTC_STATUS_REG_EVENT_1D_SHIFT 0x05
633#define PALMAS_RTC_STATUS_REG_EVENT_1H 0x10 633#define PALMAS_RTC_STATUS_REG_EVENT_1H 0x10
634#define PALMAS_RTC_STATUS_REG_EVENT_1H_SHIFT 4 634#define PALMAS_RTC_STATUS_REG_EVENT_1H_SHIFT 0x04
635#define PALMAS_RTC_STATUS_REG_EVENT_1M 0x08 635#define PALMAS_RTC_STATUS_REG_EVENT_1M 0x08
636#define PALMAS_RTC_STATUS_REG_EVENT_1M_SHIFT 3 636#define PALMAS_RTC_STATUS_REG_EVENT_1M_SHIFT 0x03
637#define PALMAS_RTC_STATUS_REG_EVENT_1S 0x04 637#define PALMAS_RTC_STATUS_REG_EVENT_1S 0x04
638#define PALMAS_RTC_STATUS_REG_EVENT_1S_SHIFT 2 638#define PALMAS_RTC_STATUS_REG_EVENT_1S_SHIFT 0x02
639#define PALMAS_RTC_STATUS_REG_RUN 0x02 639#define PALMAS_RTC_STATUS_REG_RUN 0x02
640#define PALMAS_RTC_STATUS_REG_RUN_SHIFT 1 640#define PALMAS_RTC_STATUS_REG_RUN_SHIFT 0x01
641 641
642/* Bit definitions for RTC_INTERRUPTS_REG */ 642/* Bit definitions for RTC_INTERRUPTS_REG */
643#define PALMAS_RTC_INTERRUPTS_REG_IT_SLEEP_MASK_EN 0x10 643#define PALMAS_RTC_INTERRUPTS_REG_IT_SLEEP_MASK_EN 0x10
644#define PALMAS_RTC_INTERRUPTS_REG_IT_SLEEP_MASK_EN_SHIFT 4 644#define PALMAS_RTC_INTERRUPTS_REG_IT_SLEEP_MASK_EN_SHIFT 0x04
645#define PALMAS_RTC_INTERRUPTS_REG_IT_ALARM 0x08 645#define PALMAS_RTC_INTERRUPTS_REG_IT_ALARM 0x08
646#define PALMAS_RTC_INTERRUPTS_REG_IT_ALARM_SHIFT 3 646#define PALMAS_RTC_INTERRUPTS_REG_IT_ALARM_SHIFT 0x03
647#define PALMAS_RTC_INTERRUPTS_REG_IT_TIMER 0x04 647#define PALMAS_RTC_INTERRUPTS_REG_IT_TIMER 0x04
648#define PALMAS_RTC_INTERRUPTS_REG_IT_TIMER_SHIFT 2 648#define PALMAS_RTC_INTERRUPTS_REG_IT_TIMER_SHIFT 0x02
649#define PALMAS_RTC_INTERRUPTS_REG_EVERY_MASK 0x03 649#define PALMAS_RTC_INTERRUPTS_REG_EVERY_MASK 0x03
650#define PALMAS_RTC_INTERRUPTS_REG_EVERY_SHIFT 0 650#define PALMAS_RTC_INTERRUPTS_REG_EVERY_SHIFT 0x00
651 651
652/* Bit definitions for RTC_COMP_LSB_REG */ 652/* Bit definitions for RTC_COMP_LSB_REG */
653#define PALMAS_RTC_COMP_LSB_REG_RTC_COMP_LSB_MASK 0xff 653#define PALMAS_RTC_COMP_LSB_REG_RTC_COMP_LSB_MASK 0xFF
654#define PALMAS_RTC_COMP_LSB_REG_RTC_COMP_LSB_SHIFT 0 654#define PALMAS_RTC_COMP_LSB_REG_RTC_COMP_LSB_SHIFT 0x00
655 655
656/* Bit definitions for RTC_COMP_MSB_REG */ 656/* Bit definitions for RTC_COMP_MSB_REG */
657#define PALMAS_RTC_COMP_MSB_REG_RTC_COMP_MSB_MASK 0xff 657#define PALMAS_RTC_COMP_MSB_REG_RTC_COMP_MSB_MASK 0xFF
658#define PALMAS_RTC_COMP_MSB_REG_RTC_COMP_MSB_SHIFT 0 658#define PALMAS_RTC_COMP_MSB_REG_RTC_COMP_MSB_SHIFT 0x00
659 659
660/* Bit definitions for RTC_RES_PROG_REG */ 660/* Bit definitions for RTC_RES_PROG_REG */
661#define PALMAS_RTC_RES_PROG_REG_SW_RES_PROG_MASK 0x3f 661#define PALMAS_RTC_RES_PROG_REG_SW_RES_PROG_MASK 0x3F
662#define PALMAS_RTC_RES_PROG_REG_SW_RES_PROG_SHIFT 0 662#define PALMAS_RTC_RES_PROG_REG_SW_RES_PROG_SHIFT 0x00
663 663
664/* Bit definitions for RTC_RESET_STATUS_REG */ 664/* Bit definitions for RTC_RESET_STATUS_REG */
665#define PALMAS_RTC_RESET_STATUS_REG_RESET_STATUS 0x01 665#define PALMAS_RTC_RESET_STATUS_REG_RESET_STATUS 0x01
666#define PALMAS_RTC_RESET_STATUS_REG_RESET_STATUS_SHIFT 0 666#define PALMAS_RTC_RESET_STATUS_REG_RESET_STATUS_SHIFT 0x00
667 667
668/* Registers for function BACKUP */ 668/* Registers for function BACKUP */
669#define PALMAS_BACKUP0 0x0 669#define PALMAS_BACKUP0 0x00
670#define PALMAS_BACKUP1 0x1 670#define PALMAS_BACKUP1 0x01
671#define PALMAS_BACKUP2 0x2 671#define PALMAS_BACKUP2 0x02
672#define PALMAS_BACKUP3 0x3 672#define PALMAS_BACKUP3 0x03
673#define PALMAS_BACKUP4 0x4 673#define PALMAS_BACKUP4 0x04
674#define PALMAS_BACKUP5 0x5 674#define PALMAS_BACKUP5 0x05
675#define PALMAS_BACKUP6 0x6 675#define PALMAS_BACKUP6 0x06
676#define PALMAS_BACKUP7 0x7 676#define PALMAS_BACKUP7 0x07
677 677
678/* Bit definitions for BACKUP0 */ 678/* Bit definitions for BACKUP0 */
679#define PALMAS_BACKUP0_BACKUP_MASK 0xff 679#define PALMAS_BACKUP0_BACKUP_MASK 0xFF
680#define PALMAS_BACKUP0_BACKUP_SHIFT 0 680#define PALMAS_BACKUP0_BACKUP_SHIFT 0x00
681 681
682/* Bit definitions for BACKUP1 */ 682/* Bit definitions for BACKUP1 */
683#define PALMAS_BACKUP1_BACKUP_MASK 0xff 683#define PALMAS_BACKUP1_BACKUP_MASK 0xFF
684#define PALMAS_BACKUP1_BACKUP_SHIFT 0 684#define PALMAS_BACKUP1_BACKUP_SHIFT 0x00
685 685
686/* Bit definitions for BACKUP2 */ 686/* Bit definitions for BACKUP2 */
687#define PALMAS_BACKUP2_BACKUP_MASK 0xff 687#define PALMAS_BACKUP2_BACKUP_MASK 0xFF
688#define PALMAS_BACKUP2_BACKUP_SHIFT 0 688#define PALMAS_BACKUP2_BACKUP_SHIFT 0x00
689 689
690/* Bit definitions for BACKUP3 */ 690/* Bit definitions for BACKUP3 */
691#define PALMAS_BACKUP3_BACKUP_MASK 0xff 691#define PALMAS_BACKUP3_BACKUP_MASK 0xFF
692#define PALMAS_BACKUP3_BACKUP_SHIFT 0 692#define PALMAS_BACKUP3_BACKUP_SHIFT 0x00
693 693
694/* Bit definitions for BACKUP4 */ 694/* Bit definitions for BACKUP4 */
695#define PALMAS_BACKUP4_BACKUP_MASK 0xff 695#define PALMAS_BACKUP4_BACKUP_MASK 0xFF
696#define PALMAS_BACKUP4_BACKUP_SHIFT 0 696#define PALMAS_BACKUP4_BACKUP_SHIFT 0x00
697 697
698/* Bit definitions for BACKUP5 */ 698/* Bit definitions for BACKUP5 */
699#define PALMAS_BACKUP5_BACKUP_MASK 0xff 699#define PALMAS_BACKUP5_BACKUP_MASK 0xFF
700#define PALMAS_BACKUP5_BACKUP_SHIFT 0 700#define PALMAS_BACKUP5_BACKUP_SHIFT 0x00
701 701
702/* Bit definitions for BACKUP6 */ 702/* Bit definitions for BACKUP6 */
703#define PALMAS_BACKUP6_BACKUP_MASK 0xff 703#define PALMAS_BACKUP6_BACKUP_MASK 0xFF
704#define PALMAS_BACKUP6_BACKUP_SHIFT 0 704#define PALMAS_BACKUP6_BACKUP_SHIFT 0x00
705 705
706/* Bit definitions for BACKUP7 */ 706/* Bit definitions for BACKUP7 */
707#define PALMAS_BACKUP7_BACKUP_MASK 0xff 707#define PALMAS_BACKUP7_BACKUP_MASK 0xFF
708#define PALMAS_BACKUP7_BACKUP_SHIFT 0 708#define PALMAS_BACKUP7_BACKUP_SHIFT 0x00
709 709
710/* Registers for function SMPS */ 710/* Registers for function SMPS */
711#define PALMAS_SMPS12_CTRL 0x0 711#define PALMAS_SMPS12_CTRL 0x00
712#define PALMAS_SMPS12_TSTEP 0x1 712#define PALMAS_SMPS12_TSTEP 0x01
713#define PALMAS_SMPS12_FORCE 0x2 713#define PALMAS_SMPS12_FORCE 0x02
714#define PALMAS_SMPS12_VOLTAGE 0x3 714#define PALMAS_SMPS12_VOLTAGE 0x03
715#define PALMAS_SMPS3_CTRL 0x4 715#define PALMAS_SMPS3_CTRL 0x04
716#define PALMAS_SMPS3_VOLTAGE 0x7 716#define PALMAS_SMPS3_VOLTAGE 0x07
717#define PALMAS_SMPS45_CTRL 0x8 717#define PALMAS_SMPS45_CTRL 0x08
718#define PALMAS_SMPS45_TSTEP 0x9 718#define PALMAS_SMPS45_TSTEP 0x09
719#define PALMAS_SMPS45_FORCE 0xA 719#define PALMAS_SMPS45_FORCE 0x0A
720#define PALMAS_SMPS45_VOLTAGE 0xB 720#define PALMAS_SMPS45_VOLTAGE 0x0B
721#define PALMAS_SMPS6_CTRL 0xC 721#define PALMAS_SMPS6_CTRL 0x0C
722#define PALMAS_SMPS6_TSTEP 0xD 722#define PALMAS_SMPS6_TSTEP 0x0D
723#define PALMAS_SMPS6_FORCE 0xE 723#define PALMAS_SMPS6_FORCE 0x0E
724#define PALMAS_SMPS6_VOLTAGE 0xF 724#define PALMAS_SMPS6_VOLTAGE 0x0F
725#define PALMAS_SMPS7_CTRL 0x10 725#define PALMAS_SMPS7_CTRL 0x10
726#define PALMAS_SMPS7_VOLTAGE 0x13 726#define PALMAS_SMPS7_VOLTAGE 0x13
727#define PALMAS_SMPS8_CTRL 0x14 727#define PALMAS_SMPS8_CTRL 0x14
@@ -744,303 +744,303 @@ enum usb_irq_events {
744 744
745/* Bit definitions for SMPS12_CTRL */ 745/* Bit definitions for SMPS12_CTRL */
746#define PALMAS_SMPS12_CTRL_WR_S 0x80 746#define PALMAS_SMPS12_CTRL_WR_S 0x80
747#define PALMAS_SMPS12_CTRL_WR_S_SHIFT 7 747#define PALMAS_SMPS12_CTRL_WR_S_SHIFT 0x07
748#define PALMAS_SMPS12_CTRL_ROOF_FLOOR_EN 0x40 748#define PALMAS_SMPS12_CTRL_ROOF_FLOOR_EN 0x40
749#define PALMAS_SMPS12_CTRL_ROOF_FLOOR_EN_SHIFT 6 749#define PALMAS_SMPS12_CTRL_ROOF_FLOOR_EN_SHIFT 0x06
750#define PALMAS_SMPS12_CTRL_STATUS_MASK 0x30 750#define PALMAS_SMPS12_CTRL_STATUS_MASK 0x30
751#define PALMAS_SMPS12_CTRL_STATUS_SHIFT 4 751#define PALMAS_SMPS12_CTRL_STATUS_SHIFT 0x04
752#define PALMAS_SMPS12_CTRL_MODE_SLEEP_MASK 0x0c 752#define PALMAS_SMPS12_CTRL_MODE_SLEEP_MASK 0x0c
753#define PALMAS_SMPS12_CTRL_MODE_SLEEP_SHIFT 2 753#define PALMAS_SMPS12_CTRL_MODE_SLEEP_SHIFT 0x02
754#define PALMAS_SMPS12_CTRL_MODE_ACTIVE_MASK 0x03 754#define PALMAS_SMPS12_CTRL_MODE_ACTIVE_MASK 0x03
755#define PALMAS_SMPS12_CTRL_MODE_ACTIVE_SHIFT 0 755#define PALMAS_SMPS12_CTRL_MODE_ACTIVE_SHIFT 0x00
756 756
757/* Bit definitions for SMPS12_TSTEP */ 757/* Bit definitions for SMPS12_TSTEP */
758#define PALMAS_SMPS12_TSTEP_TSTEP_MASK 0x03 758#define PALMAS_SMPS12_TSTEP_TSTEP_MASK 0x03
759#define PALMAS_SMPS12_TSTEP_TSTEP_SHIFT 0 759#define PALMAS_SMPS12_TSTEP_TSTEP_SHIFT 0x00
760 760
761/* Bit definitions for SMPS12_FORCE */ 761/* Bit definitions for SMPS12_FORCE */
762#define PALMAS_SMPS12_FORCE_CMD 0x80 762#define PALMAS_SMPS12_FORCE_CMD 0x80
763#define PALMAS_SMPS12_FORCE_CMD_SHIFT 7 763#define PALMAS_SMPS12_FORCE_CMD_SHIFT 0x07
764#define PALMAS_SMPS12_FORCE_VSEL_MASK 0x7f 764#define PALMAS_SMPS12_FORCE_VSEL_MASK 0x7F
765#define PALMAS_SMPS12_FORCE_VSEL_SHIFT 0 765#define PALMAS_SMPS12_FORCE_VSEL_SHIFT 0x00
766 766
767/* Bit definitions for SMPS12_VOLTAGE */ 767/* Bit definitions for SMPS12_VOLTAGE */
768#define PALMAS_SMPS12_VOLTAGE_RANGE 0x80 768#define PALMAS_SMPS12_VOLTAGE_RANGE 0x80
769#define PALMAS_SMPS12_VOLTAGE_RANGE_SHIFT 7 769#define PALMAS_SMPS12_VOLTAGE_RANGE_SHIFT 0x07
770#define PALMAS_SMPS12_VOLTAGE_VSEL_MASK 0x7f 770#define PALMAS_SMPS12_VOLTAGE_VSEL_MASK 0x7F
771#define PALMAS_SMPS12_VOLTAGE_VSEL_SHIFT 0 771#define PALMAS_SMPS12_VOLTAGE_VSEL_SHIFT 0x00
772 772
773/* Bit definitions for SMPS3_CTRL */ 773/* Bit definitions for SMPS3_CTRL */
774#define PALMAS_SMPS3_CTRL_WR_S 0x80 774#define PALMAS_SMPS3_CTRL_WR_S 0x80
775#define PALMAS_SMPS3_CTRL_WR_S_SHIFT 7 775#define PALMAS_SMPS3_CTRL_WR_S_SHIFT 0x07
776#define PALMAS_SMPS3_CTRL_STATUS_MASK 0x30 776#define PALMAS_SMPS3_CTRL_STATUS_MASK 0x30
777#define PALMAS_SMPS3_CTRL_STATUS_SHIFT 4 777#define PALMAS_SMPS3_CTRL_STATUS_SHIFT 0x04
778#define PALMAS_SMPS3_CTRL_MODE_SLEEP_MASK 0x0c 778#define PALMAS_SMPS3_CTRL_MODE_SLEEP_MASK 0x0c
779#define PALMAS_SMPS3_CTRL_MODE_SLEEP_SHIFT 2 779#define PALMAS_SMPS3_CTRL_MODE_SLEEP_SHIFT 0x02
780#define PALMAS_SMPS3_CTRL_MODE_ACTIVE_MASK 0x03 780#define PALMAS_SMPS3_CTRL_MODE_ACTIVE_MASK 0x03
781#define PALMAS_SMPS3_CTRL_MODE_ACTIVE_SHIFT 0 781#define PALMAS_SMPS3_CTRL_MODE_ACTIVE_SHIFT 0x00
782 782
783/* Bit definitions for SMPS3_VOLTAGE */ 783/* Bit definitions for SMPS3_VOLTAGE */
784#define PALMAS_SMPS3_VOLTAGE_RANGE 0x80 784#define PALMAS_SMPS3_VOLTAGE_RANGE 0x80
785#define PALMAS_SMPS3_VOLTAGE_RANGE_SHIFT 7 785#define PALMAS_SMPS3_VOLTAGE_RANGE_SHIFT 0x07
786#define PALMAS_SMPS3_VOLTAGE_VSEL_MASK 0x7f 786#define PALMAS_SMPS3_VOLTAGE_VSEL_MASK 0x7F
787#define PALMAS_SMPS3_VOLTAGE_VSEL_SHIFT 0 787#define PALMAS_SMPS3_VOLTAGE_VSEL_SHIFT 0x00
788 788
789/* Bit definitions for SMPS45_CTRL */ 789/* Bit definitions for SMPS45_CTRL */
790#define PALMAS_SMPS45_CTRL_WR_S 0x80 790#define PALMAS_SMPS45_CTRL_WR_S 0x80
791#define PALMAS_SMPS45_CTRL_WR_S_SHIFT 7 791#define PALMAS_SMPS45_CTRL_WR_S_SHIFT 0x07
792#define PALMAS_SMPS45_CTRL_ROOF_FLOOR_EN 0x40 792#define PALMAS_SMPS45_CTRL_ROOF_FLOOR_EN 0x40
793#define PALMAS_SMPS45_CTRL_ROOF_FLOOR_EN_SHIFT 6 793#define PALMAS_SMPS45_CTRL_ROOF_FLOOR_EN_SHIFT 0x06
794#define PALMAS_SMPS45_CTRL_STATUS_MASK 0x30 794#define PALMAS_SMPS45_CTRL_STATUS_MASK 0x30
795#define PALMAS_SMPS45_CTRL_STATUS_SHIFT 4 795#define PALMAS_SMPS45_CTRL_STATUS_SHIFT 0x04
796#define PALMAS_SMPS45_CTRL_MODE_SLEEP_MASK 0x0c 796#define PALMAS_SMPS45_CTRL_MODE_SLEEP_MASK 0x0c
797#define PALMAS_SMPS45_CTRL_MODE_SLEEP_SHIFT 2 797#define PALMAS_SMPS45_CTRL_MODE_SLEEP_SHIFT 0x02
798#define PALMAS_SMPS45_CTRL_MODE_ACTIVE_MASK 0x03 798#define PALMAS_SMPS45_CTRL_MODE_ACTIVE_MASK 0x03
799#define PALMAS_SMPS45_CTRL_MODE_ACTIVE_SHIFT 0 799#define PALMAS_SMPS45_CTRL_MODE_ACTIVE_SHIFT 0x00
800 800
801/* Bit definitions for SMPS45_TSTEP */ 801/* Bit definitions for SMPS45_TSTEP */
802#define PALMAS_SMPS45_TSTEP_TSTEP_MASK 0x03 802#define PALMAS_SMPS45_TSTEP_TSTEP_MASK 0x03
803#define PALMAS_SMPS45_TSTEP_TSTEP_SHIFT 0 803#define PALMAS_SMPS45_TSTEP_TSTEP_SHIFT 0x00
804 804
805/* Bit definitions for SMPS45_FORCE */ 805/* Bit definitions for SMPS45_FORCE */
806#define PALMAS_SMPS45_FORCE_CMD 0x80 806#define PALMAS_SMPS45_FORCE_CMD 0x80
807#define PALMAS_SMPS45_FORCE_CMD_SHIFT 7 807#define PALMAS_SMPS45_FORCE_CMD_SHIFT 0x07
808#define PALMAS_SMPS45_FORCE_VSEL_MASK 0x7f 808#define PALMAS_SMPS45_FORCE_VSEL_MASK 0x7F
809#define PALMAS_SMPS45_FORCE_VSEL_SHIFT 0 809#define PALMAS_SMPS45_FORCE_VSEL_SHIFT 0x00
810 810
811/* Bit definitions for SMPS45_VOLTAGE */ 811/* Bit definitions for SMPS45_VOLTAGE */
812#define PALMAS_SMPS45_VOLTAGE_RANGE 0x80 812#define PALMAS_SMPS45_VOLTAGE_RANGE 0x80
813#define PALMAS_SMPS45_VOLTAGE_RANGE_SHIFT 7 813#define PALMAS_SMPS45_VOLTAGE_RANGE_SHIFT 0x07
814#define PALMAS_SMPS45_VOLTAGE_VSEL_MASK 0x7f 814#define PALMAS_SMPS45_VOLTAGE_VSEL_MASK 0x7F
815#define PALMAS_SMPS45_VOLTAGE_VSEL_SHIFT 0 815#define PALMAS_SMPS45_VOLTAGE_VSEL_SHIFT 0x00
816 816
817/* Bit definitions for SMPS6_CTRL */ 817/* Bit definitions for SMPS6_CTRL */
818#define PALMAS_SMPS6_CTRL_WR_S 0x80 818#define PALMAS_SMPS6_CTRL_WR_S 0x80
819#define PALMAS_SMPS6_CTRL_WR_S_SHIFT 7 819#define PALMAS_SMPS6_CTRL_WR_S_SHIFT 0x07
820#define PALMAS_SMPS6_CTRL_ROOF_FLOOR_EN 0x40 820#define PALMAS_SMPS6_CTRL_ROOF_FLOOR_EN 0x40
821#define PALMAS_SMPS6_CTRL_ROOF_FLOOR_EN_SHIFT 6 821#define PALMAS_SMPS6_CTRL_ROOF_FLOOR_EN_SHIFT 0x06
822#define PALMAS_SMPS6_CTRL_STATUS_MASK 0x30 822#define PALMAS_SMPS6_CTRL_STATUS_MASK 0x30
823#define PALMAS_SMPS6_CTRL_STATUS_SHIFT 4 823#define PALMAS_SMPS6_CTRL_STATUS_SHIFT 0x04
824#define PALMAS_SMPS6_CTRL_MODE_SLEEP_MASK 0x0c 824#define PALMAS_SMPS6_CTRL_MODE_SLEEP_MASK 0x0c
825#define PALMAS_SMPS6_CTRL_MODE_SLEEP_SHIFT 2 825#define PALMAS_SMPS6_CTRL_MODE_SLEEP_SHIFT 0x02
826#define PALMAS_SMPS6_CTRL_MODE_ACTIVE_MASK 0x03 826#define PALMAS_SMPS6_CTRL_MODE_ACTIVE_MASK 0x03
827#define PALMAS_SMPS6_CTRL_MODE_ACTIVE_SHIFT 0 827#define PALMAS_SMPS6_CTRL_MODE_ACTIVE_SHIFT 0x00
828 828
829/* Bit definitions for SMPS6_TSTEP */ 829/* Bit definitions for SMPS6_TSTEP */
830#define PALMAS_SMPS6_TSTEP_TSTEP_MASK 0x03 830#define PALMAS_SMPS6_TSTEP_TSTEP_MASK 0x03
831#define PALMAS_SMPS6_TSTEP_TSTEP_SHIFT 0 831#define PALMAS_SMPS6_TSTEP_TSTEP_SHIFT 0x00
832 832
833/* Bit definitions for SMPS6_FORCE */ 833/* Bit definitions for SMPS6_FORCE */
834#define PALMAS_SMPS6_FORCE_CMD 0x80 834#define PALMAS_SMPS6_FORCE_CMD 0x80
835#define PALMAS_SMPS6_FORCE_CMD_SHIFT 7 835#define PALMAS_SMPS6_FORCE_CMD_SHIFT 0x07
836#define PALMAS_SMPS6_FORCE_VSEL_MASK 0x7f 836#define PALMAS_SMPS6_FORCE_VSEL_MASK 0x7F
837#define PALMAS_SMPS6_FORCE_VSEL_SHIFT 0 837#define PALMAS_SMPS6_FORCE_VSEL_SHIFT 0x00
838 838
839/* Bit definitions for SMPS6_VOLTAGE */ 839/* Bit definitions for SMPS6_VOLTAGE */
840#define PALMAS_SMPS6_VOLTAGE_RANGE 0x80 840#define PALMAS_SMPS6_VOLTAGE_RANGE 0x80
841#define PALMAS_SMPS6_VOLTAGE_RANGE_SHIFT 7 841#define PALMAS_SMPS6_VOLTAGE_RANGE_SHIFT 0x07
842#define PALMAS_SMPS6_VOLTAGE_VSEL_MASK 0x7f 842#define PALMAS_SMPS6_VOLTAGE_VSEL_MASK 0x7F
843#define PALMAS_SMPS6_VOLTAGE_VSEL_SHIFT 0 843#define PALMAS_SMPS6_VOLTAGE_VSEL_SHIFT 0x00
844 844
845/* Bit definitions for SMPS7_CTRL */ 845/* Bit definitions for SMPS7_CTRL */
846#define PALMAS_SMPS7_CTRL_WR_S 0x80 846#define PALMAS_SMPS7_CTRL_WR_S 0x80
847#define PALMAS_SMPS7_CTRL_WR_S_SHIFT 7 847#define PALMAS_SMPS7_CTRL_WR_S_SHIFT 0x07
848#define PALMAS_SMPS7_CTRL_STATUS_MASK 0x30 848#define PALMAS_SMPS7_CTRL_STATUS_MASK 0x30
849#define PALMAS_SMPS7_CTRL_STATUS_SHIFT 4 849#define PALMAS_SMPS7_CTRL_STATUS_SHIFT 0x04
850#define PALMAS_SMPS7_CTRL_MODE_SLEEP_MASK 0x0c 850#define PALMAS_SMPS7_CTRL_MODE_SLEEP_MASK 0x0c
851#define PALMAS_SMPS7_CTRL_MODE_SLEEP_SHIFT 2 851#define PALMAS_SMPS7_CTRL_MODE_SLEEP_SHIFT 0x02
852#define PALMAS_SMPS7_CTRL_MODE_ACTIVE_MASK 0x03 852#define PALMAS_SMPS7_CTRL_MODE_ACTIVE_MASK 0x03
853#define PALMAS_SMPS7_CTRL_MODE_ACTIVE_SHIFT 0 853#define PALMAS_SMPS7_CTRL_MODE_ACTIVE_SHIFT 0x00
854 854
855/* Bit definitions for SMPS7_VOLTAGE */ 855/* Bit definitions for SMPS7_VOLTAGE */
856#define PALMAS_SMPS7_VOLTAGE_RANGE 0x80 856#define PALMAS_SMPS7_VOLTAGE_RANGE 0x80
857#define PALMAS_SMPS7_VOLTAGE_RANGE_SHIFT 7 857#define PALMAS_SMPS7_VOLTAGE_RANGE_SHIFT 0x07
858#define PALMAS_SMPS7_VOLTAGE_VSEL_MASK 0x7f 858#define PALMAS_SMPS7_VOLTAGE_VSEL_MASK 0x7F
859#define PALMAS_SMPS7_VOLTAGE_VSEL_SHIFT 0 859#define PALMAS_SMPS7_VOLTAGE_VSEL_SHIFT 0x00
860 860
861/* Bit definitions for SMPS8_CTRL */ 861/* Bit definitions for SMPS8_CTRL */
862#define PALMAS_SMPS8_CTRL_WR_S 0x80 862#define PALMAS_SMPS8_CTRL_WR_S 0x80
863#define PALMAS_SMPS8_CTRL_WR_S_SHIFT 7 863#define PALMAS_SMPS8_CTRL_WR_S_SHIFT 0x07
864#define PALMAS_SMPS8_CTRL_ROOF_FLOOR_EN 0x40 864#define PALMAS_SMPS8_CTRL_ROOF_FLOOR_EN 0x40
865#define PALMAS_SMPS8_CTRL_ROOF_FLOOR_EN_SHIFT 6 865#define PALMAS_SMPS8_CTRL_ROOF_FLOOR_EN_SHIFT 0x06
866#define PALMAS_SMPS8_CTRL_STATUS_MASK 0x30 866#define PALMAS_SMPS8_CTRL_STATUS_MASK 0x30
867#define PALMAS_SMPS8_CTRL_STATUS_SHIFT 4 867#define PALMAS_SMPS8_CTRL_STATUS_SHIFT 0x04
868#define PALMAS_SMPS8_CTRL_MODE_SLEEP_MASK 0x0c 868#define PALMAS_SMPS8_CTRL_MODE_SLEEP_MASK 0x0c
869#define PALMAS_SMPS8_CTRL_MODE_SLEEP_SHIFT 2 869#define PALMAS_SMPS8_CTRL_MODE_SLEEP_SHIFT 0x02
870#define PALMAS_SMPS8_CTRL_MODE_ACTIVE_MASK 0x03 870#define PALMAS_SMPS8_CTRL_MODE_ACTIVE_MASK 0x03
871#define PALMAS_SMPS8_CTRL_MODE_ACTIVE_SHIFT 0 871#define PALMAS_SMPS8_CTRL_MODE_ACTIVE_SHIFT 0x00
872 872
873/* Bit definitions for SMPS8_TSTEP */ 873/* Bit definitions for SMPS8_TSTEP */
874#define PALMAS_SMPS8_TSTEP_TSTEP_MASK 0x03 874#define PALMAS_SMPS8_TSTEP_TSTEP_MASK 0x03
875#define PALMAS_SMPS8_TSTEP_TSTEP_SHIFT 0 875#define PALMAS_SMPS8_TSTEP_TSTEP_SHIFT 0x00
876 876
877/* Bit definitions for SMPS8_FORCE */ 877/* Bit definitions for SMPS8_FORCE */
878#define PALMAS_SMPS8_FORCE_CMD 0x80 878#define PALMAS_SMPS8_FORCE_CMD 0x80
879#define PALMAS_SMPS8_FORCE_CMD_SHIFT 7 879#define PALMAS_SMPS8_FORCE_CMD_SHIFT 0x07
880#define PALMAS_SMPS8_FORCE_VSEL_MASK 0x7f 880#define PALMAS_SMPS8_FORCE_VSEL_MASK 0x7F
881#define PALMAS_SMPS8_FORCE_VSEL_SHIFT 0 881#define PALMAS_SMPS8_FORCE_VSEL_SHIFT 0x00
882 882
883/* Bit definitions for SMPS8_VOLTAGE */ 883/* Bit definitions for SMPS8_VOLTAGE */
884#define PALMAS_SMPS8_VOLTAGE_RANGE 0x80 884#define PALMAS_SMPS8_VOLTAGE_RANGE 0x80
885#define PALMAS_SMPS8_VOLTAGE_RANGE_SHIFT 7 885#define PALMAS_SMPS8_VOLTAGE_RANGE_SHIFT 0x07
886#define PALMAS_SMPS8_VOLTAGE_VSEL_MASK 0x7f 886#define PALMAS_SMPS8_VOLTAGE_VSEL_MASK 0x7F
887#define PALMAS_SMPS8_VOLTAGE_VSEL_SHIFT 0 887#define PALMAS_SMPS8_VOLTAGE_VSEL_SHIFT 0x00
888 888
889/* Bit definitions for SMPS9_CTRL */ 889/* Bit definitions for SMPS9_CTRL */
890#define PALMAS_SMPS9_CTRL_WR_S 0x80 890#define PALMAS_SMPS9_CTRL_WR_S 0x80
891#define PALMAS_SMPS9_CTRL_WR_S_SHIFT 7 891#define PALMAS_SMPS9_CTRL_WR_S_SHIFT 0x07
892#define PALMAS_SMPS9_CTRL_STATUS_MASK 0x30 892#define PALMAS_SMPS9_CTRL_STATUS_MASK 0x30
893#define PALMAS_SMPS9_CTRL_STATUS_SHIFT 4 893#define PALMAS_SMPS9_CTRL_STATUS_SHIFT 0x04
894#define PALMAS_SMPS9_CTRL_MODE_SLEEP_MASK 0x0c 894#define PALMAS_SMPS9_CTRL_MODE_SLEEP_MASK 0x0c
895#define PALMAS_SMPS9_CTRL_MODE_SLEEP_SHIFT 2 895#define PALMAS_SMPS9_CTRL_MODE_SLEEP_SHIFT 0x02
896#define PALMAS_SMPS9_CTRL_MODE_ACTIVE_MASK 0x03 896#define PALMAS_SMPS9_CTRL_MODE_ACTIVE_MASK 0x03
897#define PALMAS_SMPS9_CTRL_MODE_ACTIVE_SHIFT 0 897#define PALMAS_SMPS9_CTRL_MODE_ACTIVE_SHIFT 0x00
898 898
899/* Bit definitions for SMPS9_VOLTAGE */ 899/* Bit definitions for SMPS9_VOLTAGE */
900#define PALMAS_SMPS9_VOLTAGE_RANGE 0x80 900#define PALMAS_SMPS9_VOLTAGE_RANGE 0x80
901#define PALMAS_SMPS9_VOLTAGE_RANGE_SHIFT 7 901#define PALMAS_SMPS9_VOLTAGE_RANGE_SHIFT 0x07
902#define PALMAS_SMPS9_VOLTAGE_VSEL_MASK 0x7f 902#define PALMAS_SMPS9_VOLTAGE_VSEL_MASK 0x7F
903#define PALMAS_SMPS9_VOLTAGE_VSEL_SHIFT 0 903#define PALMAS_SMPS9_VOLTAGE_VSEL_SHIFT 0x00
904 904
905/* Bit definitions for SMPS10_CTRL */ 905/* Bit definitions for SMPS10_CTRL */
906#define PALMAS_SMPS10_CTRL_MODE_SLEEP_MASK 0xf0 906#define PALMAS_SMPS10_CTRL_MODE_SLEEP_MASK 0xf0
907#define PALMAS_SMPS10_CTRL_MODE_SLEEP_SHIFT 4 907#define PALMAS_SMPS10_CTRL_MODE_SLEEP_SHIFT 0x04
908#define PALMAS_SMPS10_CTRL_MODE_ACTIVE_MASK 0x0f 908#define PALMAS_SMPS10_CTRL_MODE_ACTIVE_MASK 0x0F
909#define PALMAS_SMPS10_CTRL_MODE_ACTIVE_SHIFT 0 909#define PALMAS_SMPS10_CTRL_MODE_ACTIVE_SHIFT 0x00
910 910
911/* Bit definitions for SMPS10_STATUS */ 911/* Bit definitions for SMPS10_STATUS */
912#define PALMAS_SMPS10_STATUS_STATUS_MASK 0x0f 912#define PALMAS_SMPS10_STATUS_STATUS_MASK 0x0F
913#define PALMAS_SMPS10_STATUS_STATUS_SHIFT 0 913#define PALMAS_SMPS10_STATUS_STATUS_SHIFT 0x00
914 914
915/* Bit definitions for SMPS_CTRL */ 915/* Bit definitions for SMPS_CTRL */
916#define PALMAS_SMPS_CTRL_SMPS45_SMPS457_EN 0x20 916#define PALMAS_SMPS_CTRL_SMPS45_SMPS457_EN 0x20
917#define PALMAS_SMPS_CTRL_SMPS45_SMPS457_EN_SHIFT 5 917#define PALMAS_SMPS_CTRL_SMPS45_SMPS457_EN_SHIFT 0x05
918#define PALMAS_SMPS_CTRL_SMPS12_SMPS123_EN 0x10 918#define PALMAS_SMPS_CTRL_SMPS12_SMPS123_EN 0x10
919#define PALMAS_SMPS_CTRL_SMPS12_SMPS123_EN_SHIFT 4 919#define PALMAS_SMPS_CTRL_SMPS12_SMPS123_EN_SHIFT 0x04
920#define PALMAS_SMPS_CTRL_SMPS45_PHASE_CTRL_MASK 0x0c 920#define PALMAS_SMPS_CTRL_SMPS45_PHASE_CTRL_MASK 0x0c
921#define PALMAS_SMPS_CTRL_SMPS45_PHASE_CTRL_SHIFT 2 921#define PALMAS_SMPS_CTRL_SMPS45_PHASE_CTRL_SHIFT 0x02
922#define PALMAS_SMPS_CTRL_SMPS123_PHASE_CTRL_MASK 0x03 922#define PALMAS_SMPS_CTRL_SMPS123_PHASE_CTRL_MASK 0x03
923#define PALMAS_SMPS_CTRL_SMPS123_PHASE_CTRL_SHIFT 0 923#define PALMAS_SMPS_CTRL_SMPS123_PHASE_CTRL_SHIFT 0x00
924 924
925/* Bit definitions for SMPS_PD_CTRL */ 925/* Bit definitions for SMPS_PD_CTRL */
926#define PALMAS_SMPS_PD_CTRL_SMPS9 0x40 926#define PALMAS_SMPS_PD_CTRL_SMPS9 0x40
927#define PALMAS_SMPS_PD_CTRL_SMPS9_SHIFT 6 927#define PALMAS_SMPS_PD_CTRL_SMPS9_SHIFT 0x06
928#define PALMAS_SMPS_PD_CTRL_SMPS8 0x20 928#define PALMAS_SMPS_PD_CTRL_SMPS8 0x20
929#define PALMAS_SMPS_PD_CTRL_SMPS8_SHIFT 5 929#define PALMAS_SMPS_PD_CTRL_SMPS8_SHIFT 0x05
930#define PALMAS_SMPS_PD_CTRL_SMPS7 0x10 930#define PALMAS_SMPS_PD_CTRL_SMPS7 0x10
931#define PALMAS_SMPS_PD_CTRL_SMPS7_SHIFT 4 931#define PALMAS_SMPS_PD_CTRL_SMPS7_SHIFT 0x04
932#define PALMAS_SMPS_PD_CTRL_SMPS6 0x08 932#define PALMAS_SMPS_PD_CTRL_SMPS6 0x08
933#define PALMAS_SMPS_PD_CTRL_SMPS6_SHIFT 3 933#define PALMAS_SMPS_PD_CTRL_SMPS6_SHIFT 0x03
934#define PALMAS_SMPS_PD_CTRL_SMPS45 0x04 934#define PALMAS_SMPS_PD_CTRL_SMPS45 0x04
935#define PALMAS_SMPS_PD_CTRL_SMPS45_SHIFT 2 935#define PALMAS_SMPS_PD_CTRL_SMPS45_SHIFT 0x02
936#define PALMAS_SMPS_PD_CTRL_SMPS3 0x02 936#define PALMAS_SMPS_PD_CTRL_SMPS3 0x02
937#define PALMAS_SMPS_PD_CTRL_SMPS3_SHIFT 1 937#define PALMAS_SMPS_PD_CTRL_SMPS3_SHIFT 0x01
938#define PALMAS_SMPS_PD_CTRL_SMPS12 0x01 938#define PALMAS_SMPS_PD_CTRL_SMPS12 0x01
939#define PALMAS_SMPS_PD_CTRL_SMPS12_SHIFT 0 939#define PALMAS_SMPS_PD_CTRL_SMPS12_SHIFT 0x00
940 940
941/* Bit definitions for SMPS_THERMAL_EN */ 941/* Bit definitions for SMPS_THERMAL_EN */
942#define PALMAS_SMPS_THERMAL_EN_SMPS9 0x40 942#define PALMAS_SMPS_THERMAL_EN_SMPS9 0x40
943#define PALMAS_SMPS_THERMAL_EN_SMPS9_SHIFT 6 943#define PALMAS_SMPS_THERMAL_EN_SMPS9_SHIFT 0x06
944#define PALMAS_SMPS_THERMAL_EN_SMPS8 0x20 944#define PALMAS_SMPS_THERMAL_EN_SMPS8 0x20
945#define PALMAS_SMPS_THERMAL_EN_SMPS8_SHIFT 5 945#define PALMAS_SMPS_THERMAL_EN_SMPS8_SHIFT 0x05
946#define PALMAS_SMPS_THERMAL_EN_SMPS6 0x08 946#define PALMAS_SMPS_THERMAL_EN_SMPS6 0x08
947#define PALMAS_SMPS_THERMAL_EN_SMPS6_SHIFT 3 947#define PALMAS_SMPS_THERMAL_EN_SMPS6_SHIFT 0x03
948#define PALMAS_SMPS_THERMAL_EN_SMPS457 0x04 948#define PALMAS_SMPS_THERMAL_EN_SMPS457 0x04
949#define PALMAS_SMPS_THERMAL_EN_SMPS457_SHIFT 2 949#define PALMAS_SMPS_THERMAL_EN_SMPS457_SHIFT 0x02
950#define PALMAS_SMPS_THERMAL_EN_SMPS123 0x01 950#define PALMAS_SMPS_THERMAL_EN_SMPS123 0x01
951#define PALMAS_SMPS_THERMAL_EN_SMPS123_SHIFT 0 951#define PALMAS_SMPS_THERMAL_EN_SMPS123_SHIFT 0x00
952 952
953/* Bit definitions for SMPS_THERMAL_STATUS */ 953/* Bit definitions for SMPS_THERMAL_STATUS */
954#define PALMAS_SMPS_THERMAL_STATUS_SMPS9 0x40 954#define PALMAS_SMPS_THERMAL_STATUS_SMPS9 0x40
955#define PALMAS_SMPS_THERMAL_STATUS_SMPS9_SHIFT 6 955#define PALMAS_SMPS_THERMAL_STATUS_SMPS9_SHIFT 0x06
956#define PALMAS_SMPS_THERMAL_STATUS_SMPS8 0x20 956#define PALMAS_SMPS_THERMAL_STATUS_SMPS8 0x20
957#define PALMAS_SMPS_THERMAL_STATUS_SMPS8_SHIFT 5 957#define PALMAS_SMPS_THERMAL_STATUS_SMPS8_SHIFT 0x05
958#define PALMAS_SMPS_THERMAL_STATUS_SMPS6 0x08 958#define PALMAS_SMPS_THERMAL_STATUS_SMPS6 0x08
959#define PALMAS_SMPS_THERMAL_STATUS_SMPS6_SHIFT 3 959#define PALMAS_SMPS_THERMAL_STATUS_SMPS6_SHIFT 0x03
960#define PALMAS_SMPS_THERMAL_STATUS_SMPS457 0x04 960#define PALMAS_SMPS_THERMAL_STATUS_SMPS457 0x04
961#define PALMAS_SMPS_THERMAL_STATUS_SMPS457_SHIFT 2 961#define PALMAS_SMPS_THERMAL_STATUS_SMPS457_SHIFT 0x02
962#define PALMAS_SMPS_THERMAL_STATUS_SMPS123 0x01 962#define PALMAS_SMPS_THERMAL_STATUS_SMPS123 0x01
963#define PALMAS_SMPS_THERMAL_STATUS_SMPS123_SHIFT 0 963#define PALMAS_SMPS_THERMAL_STATUS_SMPS123_SHIFT 0x00
964 964
965/* Bit definitions for SMPS_SHORT_STATUS */ 965/* Bit definitions for SMPS_SHORT_STATUS */
966#define PALMAS_SMPS_SHORT_STATUS_SMPS10 0x80 966#define PALMAS_SMPS_SHORT_STATUS_SMPS10 0x80
967#define PALMAS_SMPS_SHORT_STATUS_SMPS10_SHIFT 7 967#define PALMAS_SMPS_SHORT_STATUS_SMPS10_SHIFT 0x07
968#define PALMAS_SMPS_SHORT_STATUS_SMPS9 0x40 968#define PALMAS_SMPS_SHORT_STATUS_SMPS9 0x40
969#define PALMAS_SMPS_SHORT_STATUS_SMPS9_SHIFT 6 969#define PALMAS_SMPS_SHORT_STATUS_SMPS9_SHIFT 0x06
970#define PALMAS_SMPS_SHORT_STATUS_SMPS8 0x20 970#define PALMAS_SMPS_SHORT_STATUS_SMPS8 0x20
971#define PALMAS_SMPS_SHORT_STATUS_SMPS8_SHIFT 5 971#define PALMAS_SMPS_SHORT_STATUS_SMPS8_SHIFT 0x05
972#define PALMAS_SMPS_SHORT_STATUS_SMPS7 0x10 972#define PALMAS_SMPS_SHORT_STATUS_SMPS7 0x10
973#define PALMAS_SMPS_SHORT_STATUS_SMPS7_SHIFT 4 973#define PALMAS_SMPS_SHORT_STATUS_SMPS7_SHIFT 0x04
974#define PALMAS_SMPS_SHORT_STATUS_SMPS6 0x08 974#define PALMAS_SMPS_SHORT_STATUS_SMPS6 0x08
975#define PALMAS_SMPS_SHORT_STATUS_SMPS6_SHIFT 3 975#define PALMAS_SMPS_SHORT_STATUS_SMPS6_SHIFT 0x03
976#define PALMAS_SMPS_SHORT_STATUS_SMPS45 0x04 976#define PALMAS_SMPS_SHORT_STATUS_SMPS45 0x04
977#define PALMAS_SMPS_SHORT_STATUS_SMPS45_SHIFT 2 977#define PALMAS_SMPS_SHORT_STATUS_SMPS45_SHIFT 0x02
978#define PALMAS_SMPS_SHORT_STATUS_SMPS3 0x02 978#define PALMAS_SMPS_SHORT_STATUS_SMPS3 0x02
979#define PALMAS_SMPS_SHORT_STATUS_SMPS3_SHIFT 1 979#define PALMAS_SMPS_SHORT_STATUS_SMPS3_SHIFT 0x01
980#define PALMAS_SMPS_SHORT_STATUS_SMPS12 0x01 980#define PALMAS_SMPS_SHORT_STATUS_SMPS12 0x01
981#define PALMAS_SMPS_SHORT_STATUS_SMPS12_SHIFT 0 981#define PALMAS_SMPS_SHORT_STATUS_SMPS12_SHIFT 0x00
982 982
983/* Bit definitions for SMPS_NEGATIVE_CURRENT_LIMIT_EN */ 983/* Bit definitions for SMPS_NEGATIVE_CURRENT_LIMIT_EN */
984#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS9 0x40 984#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS9 0x40
985#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS9_SHIFT 6 985#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS9_SHIFT 0x06
986#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS8 0x20 986#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS8 0x20
987#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS8_SHIFT 5 987#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS8_SHIFT 0x05
988#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS7 0x10 988#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS7 0x10
989#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS7_SHIFT 4 989#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS7_SHIFT 0x04
990#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS6 0x08 990#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS6 0x08
991#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS6_SHIFT 3 991#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS6_SHIFT 0x03
992#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS45 0x04 992#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS45 0x04
993#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS45_SHIFT 2 993#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS45_SHIFT 0x02
994#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS3 0x02 994#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS3 0x02
995#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS3_SHIFT 1 995#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS3_SHIFT 0x01
996#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS12 0x01 996#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS12 0x01
997#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS12_SHIFT 0 997#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS12_SHIFT 0x00
998 998
999/* Bit definitions for SMPS_POWERGOOD_MASK1 */ 999/* Bit definitions for SMPS_POWERGOOD_MASK1 */
1000#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS10 0x80 1000#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS10 0x80
1001#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS10_SHIFT 7 1001#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS10_SHIFT 0x07
1002#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS9 0x40 1002#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS9 0x40
1003#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS9_SHIFT 6 1003#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS9_SHIFT 0x06
1004#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS8 0x20 1004#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS8 0x20
1005#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS8_SHIFT 5 1005#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS8_SHIFT 0x05
1006#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS7 0x10 1006#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS7 0x10
1007#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS7_SHIFT 4 1007#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS7_SHIFT 0x04
1008#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS6 0x08 1008#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS6 0x08
1009#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS6_SHIFT 3 1009#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS6_SHIFT 0x03
1010#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS45 0x04 1010#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS45 0x04
1011#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS45_SHIFT 2 1011#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS45_SHIFT 0x02
1012#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS3 0x02 1012#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS3 0x02
1013#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS3_SHIFT 1 1013#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS3_SHIFT 0x01
1014#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS12 0x01 1014#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS12 0x01
1015#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS12_SHIFT 0 1015#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS12_SHIFT 0x00
1016 1016
1017/* Bit definitions for SMPS_POWERGOOD_MASK2 */ 1017/* Bit definitions for SMPS_POWERGOOD_MASK2 */
1018#define PALMAS_SMPS_POWERGOOD_MASK2_POWERGOOD_TYPE_SELECT 0x80 1018#define PALMAS_SMPS_POWERGOOD_MASK2_POWERGOOD_TYPE_SELECT 0x80
1019#define PALMAS_SMPS_POWERGOOD_MASK2_POWERGOOD_TYPE_SELECT_SHIFT 7 1019#define PALMAS_SMPS_POWERGOOD_MASK2_POWERGOOD_TYPE_SELECT_SHIFT 0x07
1020#define PALMAS_SMPS_POWERGOOD_MASK2_GPIO_7 0x04 1020#define PALMAS_SMPS_POWERGOOD_MASK2_GPIO_7 0x04
1021#define PALMAS_SMPS_POWERGOOD_MASK2_GPIO_7_SHIFT 2 1021#define PALMAS_SMPS_POWERGOOD_MASK2_GPIO_7_SHIFT 0x02
1022#define PALMAS_SMPS_POWERGOOD_MASK2_VBUS 0x02 1022#define PALMAS_SMPS_POWERGOOD_MASK2_VBUS 0x02
1023#define PALMAS_SMPS_POWERGOOD_MASK2_VBUS_SHIFT 1 1023#define PALMAS_SMPS_POWERGOOD_MASK2_VBUS_SHIFT 0x01
1024#define PALMAS_SMPS_POWERGOOD_MASK2_ACOK 0x01 1024#define PALMAS_SMPS_POWERGOOD_MASK2_ACOK 0x01
1025#define PALMAS_SMPS_POWERGOOD_MASK2_ACOK_SHIFT 0 1025#define PALMAS_SMPS_POWERGOOD_MASK2_ACOK_SHIFT 0x00
1026 1026
1027/* Registers for function LDO */ 1027/* Registers for function LDO */
1028#define PALMAS_LDO1_CTRL 0x0 1028#define PALMAS_LDO1_CTRL 0x00
1029#define PALMAS_LDO1_VOLTAGE 0x1 1029#define PALMAS_LDO1_VOLTAGE 0x01
1030#define PALMAS_LDO2_CTRL 0x2 1030#define PALMAS_LDO2_CTRL 0x02
1031#define PALMAS_LDO2_VOLTAGE 0x3 1031#define PALMAS_LDO2_VOLTAGE 0x03
1032#define PALMAS_LDO3_CTRL 0x4 1032#define PALMAS_LDO3_CTRL 0x04
1033#define PALMAS_LDO3_VOLTAGE 0x5 1033#define PALMAS_LDO3_VOLTAGE 0x05
1034#define PALMAS_LDO4_CTRL 0x6 1034#define PALMAS_LDO4_CTRL 0x06
1035#define PALMAS_LDO4_VOLTAGE 0x7 1035#define PALMAS_LDO4_VOLTAGE 0x07
1036#define PALMAS_LDO5_CTRL 0x8 1036#define PALMAS_LDO5_CTRL 0x08
1037#define PALMAS_LDO5_VOLTAGE 0x9 1037#define PALMAS_LDO5_VOLTAGE 0x09
1038#define PALMAS_LDO6_CTRL 0xA 1038#define PALMAS_LDO6_CTRL 0x0A
1039#define PALMAS_LDO6_VOLTAGE 0xB 1039#define PALMAS_LDO6_VOLTAGE 0x0B
1040#define PALMAS_LDO7_CTRL 0xC 1040#define PALMAS_LDO7_CTRL 0x0C
1041#define PALMAS_LDO7_VOLTAGE 0xD 1041#define PALMAS_LDO7_VOLTAGE 0x0D
1042#define PALMAS_LDO8_CTRL 0xE 1042#define PALMAS_LDO8_CTRL 0x0E
1043#define PALMAS_LDO8_VOLTAGE 0xF 1043#define PALMAS_LDO8_VOLTAGE 0x0F
1044#define PALMAS_LDO9_CTRL 0x10 1044#define PALMAS_LDO9_CTRL 0x10
1045#define PALMAS_LDO9_VOLTAGE 0x11 1045#define PALMAS_LDO9_VOLTAGE 0x11
1046#define PALMAS_LDOLN_CTRL 0x12 1046#define PALMAS_LDOLN_CTRL 0x12
@@ -1055,236 +1055,236 @@ enum usb_irq_events {
1055 1055
1056/* Bit definitions for LDO1_CTRL */ 1056/* Bit definitions for LDO1_CTRL */
1057#define PALMAS_LDO1_CTRL_WR_S 0x80 1057#define PALMAS_LDO1_CTRL_WR_S 0x80
1058#define PALMAS_LDO1_CTRL_WR_S_SHIFT 7 1058#define PALMAS_LDO1_CTRL_WR_S_SHIFT 0x07
1059#define PALMAS_LDO1_CTRL_STATUS 0x10 1059#define PALMAS_LDO1_CTRL_STATUS 0x10
1060#define PALMAS_LDO1_CTRL_STATUS_SHIFT 4 1060#define PALMAS_LDO1_CTRL_STATUS_SHIFT 0x04
1061#define PALMAS_LDO1_CTRL_MODE_SLEEP 0x04 1061#define PALMAS_LDO1_CTRL_MODE_SLEEP 0x04
1062#define PALMAS_LDO1_CTRL_MODE_SLEEP_SHIFT 2 1062#define PALMAS_LDO1_CTRL_MODE_SLEEP_SHIFT 0x02
1063#define PALMAS_LDO1_CTRL_MODE_ACTIVE 0x01 1063#define PALMAS_LDO1_CTRL_MODE_ACTIVE 0x01
1064#define PALMAS_LDO1_CTRL_MODE_ACTIVE_SHIFT 0 1064#define PALMAS_LDO1_CTRL_MODE_ACTIVE_SHIFT 0x00
1065 1065
1066/* Bit definitions for LDO1_VOLTAGE */ 1066/* Bit definitions for LDO1_VOLTAGE */
1067#define PALMAS_LDO1_VOLTAGE_VSEL_MASK 0x3f 1067#define PALMAS_LDO1_VOLTAGE_VSEL_MASK 0x3F
1068#define PALMAS_LDO1_VOLTAGE_VSEL_SHIFT 0 1068#define PALMAS_LDO1_VOLTAGE_VSEL_SHIFT 0x00
1069 1069
1070/* Bit definitions for LDO2_CTRL */ 1070/* Bit definitions for LDO2_CTRL */
1071#define PALMAS_LDO2_CTRL_WR_S 0x80 1071#define PALMAS_LDO2_CTRL_WR_S 0x80
1072#define PALMAS_LDO2_CTRL_WR_S_SHIFT 7 1072#define PALMAS_LDO2_CTRL_WR_S_SHIFT 0x07
1073#define PALMAS_LDO2_CTRL_STATUS 0x10 1073#define PALMAS_LDO2_CTRL_STATUS 0x10
1074#define PALMAS_LDO2_CTRL_STATUS_SHIFT 4 1074#define PALMAS_LDO2_CTRL_STATUS_SHIFT 0x04
1075#define PALMAS_LDO2_CTRL_MODE_SLEEP 0x04 1075#define PALMAS_LDO2_CTRL_MODE_SLEEP 0x04
1076#define PALMAS_LDO2_CTRL_MODE_SLEEP_SHIFT 2 1076#define PALMAS_LDO2_CTRL_MODE_SLEEP_SHIFT 0x02
1077#define PALMAS_LDO2_CTRL_MODE_ACTIVE 0x01 1077#define PALMAS_LDO2_CTRL_MODE_ACTIVE 0x01
1078#define PALMAS_LDO2_CTRL_MODE_ACTIVE_SHIFT 0 1078#define PALMAS_LDO2_CTRL_MODE_ACTIVE_SHIFT 0x00
1079 1079
1080/* Bit definitions for LDO2_VOLTAGE */ 1080/* Bit definitions for LDO2_VOLTAGE */
1081#define PALMAS_LDO2_VOLTAGE_VSEL_MASK 0x3f 1081#define PALMAS_LDO2_VOLTAGE_VSEL_MASK 0x3F
1082#define PALMAS_LDO2_VOLTAGE_VSEL_SHIFT 0 1082#define PALMAS_LDO2_VOLTAGE_VSEL_SHIFT 0x00
1083 1083
1084/* Bit definitions for LDO3_CTRL */ 1084/* Bit definitions for LDO3_CTRL */
1085#define PALMAS_LDO3_CTRL_WR_S 0x80 1085#define PALMAS_LDO3_CTRL_WR_S 0x80
1086#define PALMAS_LDO3_CTRL_WR_S_SHIFT 7 1086#define PALMAS_LDO3_CTRL_WR_S_SHIFT 0x07
1087#define PALMAS_LDO3_CTRL_STATUS 0x10 1087#define PALMAS_LDO3_CTRL_STATUS 0x10
1088#define PALMAS_LDO3_CTRL_STATUS_SHIFT 4 1088#define PALMAS_LDO3_CTRL_STATUS_SHIFT 0x04
1089#define PALMAS_LDO3_CTRL_MODE_SLEEP 0x04 1089#define PALMAS_LDO3_CTRL_MODE_SLEEP 0x04
1090#define PALMAS_LDO3_CTRL_MODE_SLEEP_SHIFT 2 1090#define PALMAS_LDO3_CTRL_MODE_SLEEP_SHIFT 0x02
1091#define PALMAS_LDO3_CTRL_MODE_ACTIVE 0x01 1091#define PALMAS_LDO3_CTRL_MODE_ACTIVE 0x01
1092#define PALMAS_LDO3_CTRL_MODE_ACTIVE_SHIFT 0 1092#define PALMAS_LDO3_CTRL_MODE_ACTIVE_SHIFT 0x00
1093 1093
1094/* Bit definitions for LDO3_VOLTAGE */ 1094/* Bit definitions for LDO3_VOLTAGE */
1095#define PALMAS_LDO3_VOLTAGE_VSEL_MASK 0x3f 1095#define PALMAS_LDO3_VOLTAGE_VSEL_MASK 0x3F
1096#define PALMAS_LDO3_VOLTAGE_VSEL_SHIFT 0 1096#define PALMAS_LDO3_VOLTAGE_VSEL_SHIFT 0x00
1097 1097
1098/* Bit definitions for LDO4_CTRL */ 1098/* Bit definitions for LDO4_CTRL */
1099#define PALMAS_LDO4_CTRL_WR_S 0x80 1099#define PALMAS_LDO4_CTRL_WR_S 0x80
1100#define PALMAS_LDO4_CTRL_WR_S_SHIFT 7 1100#define PALMAS_LDO4_CTRL_WR_S_SHIFT 0x07
1101#define PALMAS_LDO4_CTRL_STATUS 0x10 1101#define PALMAS_LDO4_CTRL_STATUS 0x10
1102#define PALMAS_LDO4_CTRL_STATUS_SHIFT 4 1102#define PALMAS_LDO4_CTRL_STATUS_SHIFT 0x04
1103#define PALMAS_LDO4_CTRL_MODE_SLEEP 0x04 1103#define PALMAS_LDO4_CTRL_MODE_SLEEP 0x04
1104#define PALMAS_LDO4_CTRL_MODE_SLEEP_SHIFT 2 1104#define PALMAS_LDO4_CTRL_MODE_SLEEP_SHIFT 0x02
1105#define PALMAS_LDO4_CTRL_MODE_ACTIVE 0x01 1105#define PALMAS_LDO4_CTRL_MODE_ACTIVE 0x01
1106#define PALMAS_LDO4_CTRL_MODE_ACTIVE_SHIFT 0 1106#define PALMAS_LDO4_CTRL_MODE_ACTIVE_SHIFT 0x00
1107 1107
1108/* Bit definitions for LDO4_VOLTAGE */ 1108/* Bit definitions for LDO4_VOLTAGE */
1109#define PALMAS_LDO4_VOLTAGE_VSEL_MASK 0x3f 1109#define PALMAS_LDO4_VOLTAGE_VSEL_MASK 0x3F
1110#define PALMAS_LDO4_VOLTAGE_VSEL_SHIFT 0 1110#define PALMAS_LDO4_VOLTAGE_VSEL_SHIFT 0x00
1111 1111
1112/* Bit definitions for LDO5_CTRL */ 1112/* Bit definitions for LDO5_CTRL */
1113#define PALMAS_LDO5_CTRL_WR_S 0x80 1113#define PALMAS_LDO5_CTRL_WR_S 0x80
1114#define PALMAS_LDO5_CTRL_WR_S_SHIFT 7 1114#define PALMAS_LDO5_CTRL_WR_S_SHIFT 0x07
1115#define PALMAS_LDO5_CTRL_STATUS 0x10 1115#define PALMAS_LDO5_CTRL_STATUS 0x10
1116#define PALMAS_LDO5_CTRL_STATUS_SHIFT 4 1116#define PALMAS_LDO5_CTRL_STATUS_SHIFT 0x04
1117#define PALMAS_LDO5_CTRL_MODE_SLEEP 0x04 1117#define PALMAS_LDO5_CTRL_MODE_SLEEP 0x04
1118#define PALMAS_LDO5_CTRL_MODE_SLEEP_SHIFT 2 1118#define PALMAS_LDO5_CTRL_MODE_SLEEP_SHIFT 0x02
1119#define PALMAS_LDO5_CTRL_MODE_ACTIVE 0x01 1119#define PALMAS_LDO5_CTRL_MODE_ACTIVE 0x01
1120#define PALMAS_LDO5_CTRL_MODE_ACTIVE_SHIFT 0 1120#define PALMAS_LDO5_CTRL_MODE_ACTIVE_SHIFT 0x00
1121 1121
1122/* Bit definitions for LDO5_VOLTAGE */ 1122/* Bit definitions for LDO5_VOLTAGE */
1123#define PALMAS_LDO5_VOLTAGE_VSEL_MASK 0x3f 1123#define PALMAS_LDO5_VOLTAGE_VSEL_MASK 0x3F
1124#define PALMAS_LDO5_VOLTAGE_VSEL_SHIFT 0 1124#define PALMAS_LDO5_VOLTAGE_VSEL_SHIFT 0x00
1125 1125
1126/* Bit definitions for LDO6_CTRL */ 1126/* Bit definitions for LDO6_CTRL */
1127#define PALMAS_LDO6_CTRL_WR_S 0x80 1127#define PALMAS_LDO6_CTRL_WR_S 0x80
1128#define PALMAS_LDO6_CTRL_WR_S_SHIFT 7 1128#define PALMAS_LDO6_CTRL_WR_S_SHIFT 0x07
1129#define PALMAS_LDO6_CTRL_LDO_VIB_EN 0x40 1129#define PALMAS_LDO6_CTRL_LDO_VIB_EN 0x40
1130#define PALMAS_LDO6_CTRL_LDO_VIB_EN_SHIFT 6 1130#define PALMAS_LDO6_CTRL_LDO_VIB_EN_SHIFT 0x06
1131#define PALMAS_LDO6_CTRL_STATUS 0x10 1131#define PALMAS_LDO6_CTRL_STATUS 0x10
1132#define PALMAS_LDO6_CTRL_STATUS_SHIFT 4 1132#define PALMAS_LDO6_CTRL_STATUS_SHIFT 0x04
1133#define PALMAS_LDO6_CTRL_MODE_SLEEP 0x04 1133#define PALMAS_LDO6_CTRL_MODE_SLEEP 0x04
1134#define PALMAS_LDO6_CTRL_MODE_SLEEP_SHIFT 2 1134#define PALMAS_LDO6_CTRL_MODE_SLEEP_SHIFT 0x02
1135#define PALMAS_LDO6_CTRL_MODE_ACTIVE 0x01 1135#define PALMAS_LDO6_CTRL_MODE_ACTIVE 0x01
1136#define PALMAS_LDO6_CTRL_MODE_ACTIVE_SHIFT 0 1136#define PALMAS_LDO6_CTRL_MODE_ACTIVE_SHIFT 0x00
1137 1137
1138/* Bit definitions for LDO6_VOLTAGE */ 1138/* Bit definitions for LDO6_VOLTAGE */
1139#define PALMAS_LDO6_VOLTAGE_VSEL_MASK 0x3f 1139#define PALMAS_LDO6_VOLTAGE_VSEL_MASK 0x3F
1140#define PALMAS_LDO6_VOLTAGE_VSEL_SHIFT 0 1140#define PALMAS_LDO6_VOLTAGE_VSEL_SHIFT 0x00
1141 1141
1142/* Bit definitions for LDO7_CTRL */ 1142/* Bit definitions for LDO7_CTRL */
1143#define PALMAS_LDO7_CTRL_WR_S 0x80 1143#define PALMAS_LDO7_CTRL_WR_S 0x80
1144#define PALMAS_LDO7_CTRL_WR_S_SHIFT 7 1144#define PALMAS_LDO7_CTRL_WR_S_SHIFT 0x07
1145#define PALMAS_LDO7_CTRL_STATUS 0x10 1145#define PALMAS_LDO7_CTRL_STATUS 0x10
1146#define PALMAS_LDO7_CTRL_STATUS_SHIFT 4 1146#define PALMAS_LDO7_CTRL_STATUS_SHIFT 0x04
1147#define PALMAS_LDO7_CTRL_MODE_SLEEP 0x04 1147#define PALMAS_LDO7_CTRL_MODE_SLEEP 0x04
1148#define PALMAS_LDO7_CTRL_MODE_SLEEP_SHIFT 2 1148#define PALMAS_LDO7_CTRL_MODE_SLEEP_SHIFT 0x02
1149#define PALMAS_LDO7_CTRL_MODE_ACTIVE 0x01 1149#define PALMAS_LDO7_CTRL_MODE_ACTIVE 0x01
1150#define PALMAS_LDO7_CTRL_MODE_ACTIVE_SHIFT 0 1150#define PALMAS_LDO7_CTRL_MODE_ACTIVE_SHIFT 0x00
1151 1151
1152/* Bit definitions for LDO7_VOLTAGE */ 1152/* Bit definitions for LDO7_VOLTAGE */
1153#define PALMAS_LDO7_VOLTAGE_VSEL_MASK 0x3f 1153#define PALMAS_LDO7_VOLTAGE_VSEL_MASK 0x3F
1154#define PALMAS_LDO7_VOLTAGE_VSEL_SHIFT 0 1154#define PALMAS_LDO7_VOLTAGE_VSEL_SHIFT 0x00
1155 1155
1156/* Bit definitions for LDO8_CTRL */ 1156/* Bit definitions for LDO8_CTRL */
1157#define PALMAS_LDO8_CTRL_WR_S 0x80 1157#define PALMAS_LDO8_CTRL_WR_S 0x80
1158#define PALMAS_LDO8_CTRL_WR_S_SHIFT 7 1158#define PALMAS_LDO8_CTRL_WR_S_SHIFT 0x07
1159#define PALMAS_LDO8_CTRL_LDO_TRACKING_EN 0x40 1159#define PALMAS_LDO8_CTRL_LDO_TRACKING_EN 0x40
1160#define PALMAS_LDO8_CTRL_LDO_TRACKING_EN_SHIFT 6 1160#define PALMAS_LDO8_CTRL_LDO_TRACKING_EN_SHIFT 0x06
1161#define PALMAS_LDO8_CTRL_STATUS 0x10 1161#define PALMAS_LDO8_CTRL_STATUS 0x10
1162#define PALMAS_LDO8_CTRL_STATUS_SHIFT 4 1162#define PALMAS_LDO8_CTRL_STATUS_SHIFT 0x04
1163#define PALMAS_LDO8_CTRL_MODE_SLEEP 0x04 1163#define PALMAS_LDO8_CTRL_MODE_SLEEP 0x04
1164#define PALMAS_LDO8_CTRL_MODE_SLEEP_SHIFT 2 1164#define PALMAS_LDO8_CTRL_MODE_SLEEP_SHIFT 0x02
1165#define PALMAS_LDO8_CTRL_MODE_ACTIVE 0x01 1165#define PALMAS_LDO8_CTRL_MODE_ACTIVE 0x01
1166#define PALMAS_LDO8_CTRL_MODE_ACTIVE_SHIFT 0 1166#define PALMAS_LDO8_CTRL_MODE_ACTIVE_SHIFT 0x00
1167 1167
1168/* Bit definitions for LDO8_VOLTAGE */ 1168/* Bit definitions for LDO8_VOLTAGE */
1169#define PALMAS_LDO8_VOLTAGE_VSEL_MASK 0x3f 1169#define PALMAS_LDO8_VOLTAGE_VSEL_MASK 0x3F
1170#define PALMAS_LDO8_VOLTAGE_VSEL_SHIFT 0 1170#define PALMAS_LDO8_VOLTAGE_VSEL_SHIFT 0x00
1171 1171
1172/* Bit definitions for LDO9_CTRL */ 1172/* Bit definitions for LDO9_CTRL */
1173#define PALMAS_LDO9_CTRL_WR_S 0x80 1173#define PALMAS_LDO9_CTRL_WR_S 0x80
1174#define PALMAS_LDO9_CTRL_WR_S_SHIFT 7 1174#define PALMAS_LDO9_CTRL_WR_S_SHIFT 0x07
1175#define PALMAS_LDO9_CTRL_LDO_BYPASS_EN 0x40 1175#define PALMAS_LDO9_CTRL_LDO_BYPASS_EN 0x40
1176#define PALMAS_LDO9_CTRL_LDO_BYPASS_EN_SHIFT 6 1176#define PALMAS_LDO9_CTRL_LDO_BYPASS_EN_SHIFT 0x06
1177#define PALMAS_LDO9_CTRL_STATUS 0x10 1177#define PALMAS_LDO9_CTRL_STATUS 0x10
1178#define PALMAS_LDO9_CTRL_STATUS_SHIFT 4 1178#define PALMAS_LDO9_CTRL_STATUS_SHIFT 0x04
1179#define PALMAS_LDO9_CTRL_MODE_SLEEP 0x04 1179#define PALMAS_LDO9_CTRL_MODE_SLEEP 0x04
1180#define PALMAS_LDO9_CTRL_MODE_SLEEP_SHIFT 2 1180#define PALMAS_LDO9_CTRL_MODE_SLEEP_SHIFT 0x02
1181#define PALMAS_LDO9_CTRL_MODE_ACTIVE 0x01 1181#define PALMAS_LDO9_CTRL_MODE_ACTIVE 0x01
1182#define PALMAS_LDO9_CTRL_MODE_ACTIVE_SHIFT 0 1182#define PALMAS_LDO9_CTRL_MODE_ACTIVE_SHIFT 0x00
1183 1183
1184/* Bit definitions for LDO9_VOLTAGE */ 1184/* Bit definitions for LDO9_VOLTAGE */
1185#define PALMAS_LDO9_VOLTAGE_VSEL_MASK 0x3f 1185#define PALMAS_LDO9_VOLTAGE_VSEL_MASK 0x3F
1186#define PALMAS_LDO9_VOLTAGE_VSEL_SHIFT 0 1186#define PALMAS_LDO9_VOLTAGE_VSEL_SHIFT 0x00
1187 1187
1188/* Bit definitions for LDOLN_CTRL */ 1188/* Bit definitions for LDOLN_CTRL */
1189#define PALMAS_LDOLN_CTRL_WR_S 0x80 1189#define PALMAS_LDOLN_CTRL_WR_S 0x80
1190#define PALMAS_LDOLN_CTRL_WR_S_SHIFT 7 1190#define PALMAS_LDOLN_CTRL_WR_S_SHIFT 0x07
1191#define PALMAS_LDOLN_CTRL_STATUS 0x10 1191#define PALMAS_LDOLN_CTRL_STATUS 0x10
1192#define PALMAS_LDOLN_CTRL_STATUS_SHIFT 4 1192#define PALMAS_LDOLN_CTRL_STATUS_SHIFT 0x04
1193#define PALMAS_LDOLN_CTRL_MODE_SLEEP 0x04 1193#define PALMAS_LDOLN_CTRL_MODE_SLEEP 0x04
1194#define PALMAS_LDOLN_CTRL_MODE_SLEEP_SHIFT 2 1194#define PALMAS_LDOLN_CTRL_MODE_SLEEP_SHIFT 0x02
1195#define PALMAS_LDOLN_CTRL_MODE_ACTIVE 0x01 1195#define PALMAS_LDOLN_CTRL_MODE_ACTIVE 0x01
1196#define PALMAS_LDOLN_CTRL_MODE_ACTIVE_SHIFT 0 1196#define PALMAS_LDOLN_CTRL_MODE_ACTIVE_SHIFT 0x00
1197 1197
1198/* Bit definitions for LDOLN_VOLTAGE */ 1198/* Bit definitions for LDOLN_VOLTAGE */
1199#define PALMAS_LDOLN_VOLTAGE_VSEL_MASK 0x3f 1199#define PALMAS_LDOLN_VOLTAGE_VSEL_MASK 0x3F
1200#define PALMAS_LDOLN_VOLTAGE_VSEL_SHIFT 0 1200#define PALMAS_LDOLN_VOLTAGE_VSEL_SHIFT 0x00
1201 1201
1202/* Bit definitions for LDOUSB_CTRL */ 1202/* Bit definitions for LDOUSB_CTRL */
1203#define PALMAS_LDOUSB_CTRL_WR_S 0x80 1203#define PALMAS_LDOUSB_CTRL_WR_S 0x80
1204#define PALMAS_LDOUSB_CTRL_WR_S_SHIFT 7 1204#define PALMAS_LDOUSB_CTRL_WR_S_SHIFT 0x07
1205#define PALMAS_LDOUSB_CTRL_STATUS 0x10 1205#define PALMAS_LDOUSB_CTRL_STATUS 0x10
1206#define PALMAS_LDOUSB_CTRL_STATUS_SHIFT 4 1206#define PALMAS_LDOUSB_CTRL_STATUS_SHIFT 0x04
1207#define PALMAS_LDOUSB_CTRL_MODE_SLEEP 0x04 1207#define PALMAS_LDOUSB_CTRL_MODE_SLEEP 0x04
1208#define PALMAS_LDOUSB_CTRL_MODE_SLEEP_SHIFT 2 1208#define PALMAS_LDOUSB_CTRL_MODE_SLEEP_SHIFT 0x02
1209#define PALMAS_LDOUSB_CTRL_MODE_ACTIVE 0x01 1209#define PALMAS_LDOUSB_CTRL_MODE_ACTIVE 0x01
1210#define PALMAS_LDOUSB_CTRL_MODE_ACTIVE_SHIFT 0 1210#define PALMAS_LDOUSB_CTRL_MODE_ACTIVE_SHIFT 0x00
1211 1211
1212/* Bit definitions for LDOUSB_VOLTAGE */ 1212/* Bit definitions for LDOUSB_VOLTAGE */
1213#define PALMAS_LDOUSB_VOLTAGE_VSEL_MASK 0x3f 1213#define PALMAS_LDOUSB_VOLTAGE_VSEL_MASK 0x3F
1214#define PALMAS_LDOUSB_VOLTAGE_VSEL_SHIFT 0 1214#define PALMAS_LDOUSB_VOLTAGE_VSEL_SHIFT 0x00
1215 1215
1216/* Bit definitions for LDO_CTRL */ 1216/* Bit definitions for LDO_CTRL */
1217#define PALMAS_LDO_CTRL_LDOUSB_ON_VBUS_VSYS 0x01 1217#define PALMAS_LDO_CTRL_LDOUSB_ON_VBUS_VSYS 0x01
1218#define PALMAS_LDO_CTRL_LDOUSB_ON_VBUS_VSYS_SHIFT 0 1218#define PALMAS_LDO_CTRL_LDOUSB_ON_VBUS_VSYS_SHIFT 0x00
1219 1219
1220/* Bit definitions for LDO_PD_CTRL1 */ 1220/* Bit definitions for LDO_PD_CTRL1 */
1221#define PALMAS_LDO_PD_CTRL1_LDO8 0x80 1221#define PALMAS_LDO_PD_CTRL1_LDO8 0x80
1222#define PALMAS_LDO_PD_CTRL1_LDO8_SHIFT 7 1222#define PALMAS_LDO_PD_CTRL1_LDO8_SHIFT 0x07
1223#define PALMAS_LDO_PD_CTRL1_LDO7 0x40 1223#define PALMAS_LDO_PD_CTRL1_LDO7 0x40
1224#define PALMAS_LDO_PD_CTRL1_LDO7_SHIFT 6 1224#define PALMAS_LDO_PD_CTRL1_LDO7_SHIFT 0x06
1225#define PALMAS_LDO_PD_CTRL1_LDO6 0x20 1225#define PALMAS_LDO_PD_CTRL1_LDO6 0x20
1226#define PALMAS_LDO_PD_CTRL1_LDO6_SHIFT 5 1226#define PALMAS_LDO_PD_CTRL1_LDO6_SHIFT 0x05
1227#define PALMAS_LDO_PD_CTRL1_LDO5 0x10 1227#define PALMAS_LDO_PD_CTRL1_LDO5 0x10
1228#define PALMAS_LDO_PD_CTRL1_LDO5_SHIFT 4 1228#define PALMAS_LDO_PD_CTRL1_LDO5_SHIFT 0x04
1229#define PALMAS_LDO_PD_CTRL1_LDO4 0x08 1229#define PALMAS_LDO_PD_CTRL1_LDO4 0x08
1230#define PALMAS_LDO_PD_CTRL1_LDO4_SHIFT 3 1230#define PALMAS_LDO_PD_CTRL1_LDO4_SHIFT 0x03
1231#define PALMAS_LDO_PD_CTRL1_LDO3 0x04 1231#define PALMAS_LDO_PD_CTRL1_LDO3 0x04
1232#define PALMAS_LDO_PD_CTRL1_LDO3_SHIFT 2 1232#define PALMAS_LDO_PD_CTRL1_LDO3_SHIFT 0x02
1233#define PALMAS_LDO_PD_CTRL1_LDO2 0x02 1233#define PALMAS_LDO_PD_CTRL1_LDO2 0x02
1234#define PALMAS_LDO_PD_CTRL1_LDO2_SHIFT 1 1234#define PALMAS_LDO_PD_CTRL1_LDO2_SHIFT 0x01
1235#define PALMAS_LDO_PD_CTRL1_LDO1 0x01 1235#define PALMAS_LDO_PD_CTRL1_LDO1 0x01
1236#define PALMAS_LDO_PD_CTRL1_LDO1_SHIFT 0 1236#define PALMAS_LDO_PD_CTRL1_LDO1_SHIFT 0x00
1237 1237
1238/* Bit definitions for LDO_PD_CTRL2 */ 1238/* Bit definitions for LDO_PD_CTRL2 */
1239#define PALMAS_LDO_PD_CTRL2_LDOUSB 0x04 1239#define PALMAS_LDO_PD_CTRL2_LDOUSB 0x04
1240#define PALMAS_LDO_PD_CTRL2_LDOUSB_SHIFT 2 1240#define PALMAS_LDO_PD_CTRL2_LDOUSB_SHIFT 0x02
1241#define PALMAS_LDO_PD_CTRL2_LDOLN 0x02 1241#define PALMAS_LDO_PD_CTRL2_LDOLN 0x02
1242#define PALMAS_LDO_PD_CTRL2_LDOLN_SHIFT 1 1242#define PALMAS_LDO_PD_CTRL2_LDOLN_SHIFT 0x01
1243#define PALMAS_LDO_PD_CTRL2_LDO9 0x01 1243#define PALMAS_LDO_PD_CTRL2_LDO9 0x01
1244#define PALMAS_LDO_PD_CTRL2_LDO9_SHIFT 0 1244#define PALMAS_LDO_PD_CTRL2_LDO9_SHIFT 0x00
1245 1245
1246/* Bit definitions for LDO_SHORT_STATUS1 */ 1246/* Bit definitions for LDO_SHORT_STATUS1 */
1247#define PALMAS_LDO_SHORT_STATUS1_LDO8 0x80 1247#define PALMAS_LDO_SHORT_STATUS1_LDO8 0x80
1248#define PALMAS_LDO_SHORT_STATUS1_LDO8_SHIFT 7 1248#define PALMAS_LDO_SHORT_STATUS1_LDO8_SHIFT 0x07
1249#define PALMAS_LDO_SHORT_STATUS1_LDO7 0x40 1249#define PALMAS_LDO_SHORT_STATUS1_LDO7 0x40
1250#define PALMAS_LDO_SHORT_STATUS1_LDO7_SHIFT 6 1250#define PALMAS_LDO_SHORT_STATUS1_LDO7_SHIFT 0x06
1251#define PALMAS_LDO_SHORT_STATUS1_LDO6 0x20 1251#define PALMAS_LDO_SHORT_STATUS1_LDO6 0x20
1252#define PALMAS_LDO_SHORT_STATUS1_LDO6_SHIFT 5 1252#define PALMAS_LDO_SHORT_STATUS1_LDO6_SHIFT 0x05
1253#define PALMAS_LDO_SHORT_STATUS1_LDO5 0x10 1253#define PALMAS_LDO_SHORT_STATUS1_LDO5 0x10
1254#define PALMAS_LDO_SHORT_STATUS1_LDO5_SHIFT 4 1254#define PALMAS_LDO_SHORT_STATUS1_LDO5_SHIFT 0x04
1255#define PALMAS_LDO_SHORT_STATUS1_LDO4 0x08 1255#define PALMAS_LDO_SHORT_STATUS1_LDO4 0x08
1256#define PALMAS_LDO_SHORT_STATUS1_LDO4_SHIFT 3 1256#define PALMAS_LDO_SHORT_STATUS1_LDO4_SHIFT 0x03
1257#define PALMAS_LDO_SHORT_STATUS1_LDO3 0x04 1257#define PALMAS_LDO_SHORT_STATUS1_LDO3 0x04
1258#define PALMAS_LDO_SHORT_STATUS1_LDO3_SHIFT 2 1258#define PALMAS_LDO_SHORT_STATUS1_LDO3_SHIFT 0x02
1259#define PALMAS_LDO_SHORT_STATUS1_LDO2 0x02 1259#define PALMAS_LDO_SHORT_STATUS1_LDO2 0x02
1260#define PALMAS_LDO_SHORT_STATUS1_LDO2_SHIFT 1 1260#define PALMAS_LDO_SHORT_STATUS1_LDO2_SHIFT 0x01
1261#define PALMAS_LDO_SHORT_STATUS1_LDO1 0x01 1261#define PALMAS_LDO_SHORT_STATUS1_LDO1 0x01
1262#define PALMAS_LDO_SHORT_STATUS1_LDO1_SHIFT 0 1262#define PALMAS_LDO_SHORT_STATUS1_LDO1_SHIFT 0x00
1263 1263
1264/* Bit definitions for LDO_SHORT_STATUS2 */ 1264/* Bit definitions for LDO_SHORT_STATUS2 */
1265#define PALMAS_LDO_SHORT_STATUS2_LDOVANA 0x08 1265#define PALMAS_LDO_SHORT_STATUS2_LDOVANA 0x08
1266#define PALMAS_LDO_SHORT_STATUS2_LDOVANA_SHIFT 3 1266#define PALMAS_LDO_SHORT_STATUS2_LDOVANA_SHIFT 0x03
1267#define PALMAS_LDO_SHORT_STATUS2_LDOUSB 0x04 1267#define PALMAS_LDO_SHORT_STATUS2_LDOUSB 0x04
1268#define PALMAS_LDO_SHORT_STATUS2_LDOUSB_SHIFT 2 1268#define PALMAS_LDO_SHORT_STATUS2_LDOUSB_SHIFT 0x02
1269#define PALMAS_LDO_SHORT_STATUS2_LDOLN 0x02 1269#define PALMAS_LDO_SHORT_STATUS2_LDOLN 0x02
1270#define PALMAS_LDO_SHORT_STATUS2_LDOLN_SHIFT 1 1270#define PALMAS_LDO_SHORT_STATUS2_LDOLN_SHIFT 0x01
1271#define PALMAS_LDO_SHORT_STATUS2_LDO9 0x01 1271#define PALMAS_LDO_SHORT_STATUS2_LDO9 0x01
1272#define PALMAS_LDO_SHORT_STATUS2_LDO9_SHIFT 0 1272#define PALMAS_LDO_SHORT_STATUS2_LDO9_SHIFT 0x00
1273 1273
1274/* Registers for function PMU_CONTROL */ 1274/* Registers for function PMU_CONTROL */
1275#define PALMAS_DEV_CTRL 0x0 1275#define PALMAS_DEV_CTRL 0x00
1276#define PALMAS_POWER_CTRL 0x1 1276#define PALMAS_POWER_CTRL 0x01
1277#define PALMAS_VSYS_LO 0x2 1277#define PALMAS_VSYS_LO 0x02
1278#define PALMAS_VSYS_MON 0x3 1278#define PALMAS_VSYS_MON 0x03
1279#define PALMAS_VBAT_MON 0x4 1279#define PALMAS_VBAT_MON 0x04
1280#define PALMAS_WATCHDOG 0x5 1280#define PALMAS_WATCHDOG 0x05
1281#define PALMAS_BOOT_STATUS 0x6 1281#define PALMAS_BOOT_STATUS 0x06
1282#define PALMAS_BATTERY_BOUNCE 0x7 1282#define PALMAS_BATTERY_BOUNCE 0x07
1283#define PALMAS_BACKUP_BATTERY_CTRL 0x8 1283#define PALMAS_BACKUP_BATTERY_CTRL 0x08
1284#define PALMAS_LONG_PRESS_KEY 0x9 1284#define PALMAS_LONG_PRESS_KEY 0x09
1285#define PALMAS_OSC_THERM_CTRL 0xA 1285#define PALMAS_OSC_THERM_CTRL 0x0A
1286#define PALMAS_BATDEBOUNCING 0xB 1286#define PALMAS_BATDEBOUNCING 0x0B
1287#define PALMAS_SWOFF_HWRST 0xF 1287#define PALMAS_SWOFF_HWRST 0x0F
1288#define PALMAS_SWOFF_COLDRST 0x10 1288#define PALMAS_SWOFF_COLDRST 0x10
1289#define PALMAS_SWOFF_STATUS 0x11 1289#define PALMAS_SWOFF_STATUS 0x11
1290#define PALMAS_PMU_CONFIG 0x12 1290#define PALMAS_PMU_CONFIG 0x12
@@ -1296,668 +1296,668 @@ enum usb_irq_events {
1296 1296
1297/* Bit definitions for DEV_CTRL */ 1297/* Bit definitions for DEV_CTRL */
1298#define PALMAS_DEV_CTRL_DEV_STATUS_MASK 0x0c 1298#define PALMAS_DEV_CTRL_DEV_STATUS_MASK 0x0c
1299#define PALMAS_DEV_CTRL_DEV_STATUS_SHIFT 2 1299#define PALMAS_DEV_CTRL_DEV_STATUS_SHIFT 0x02
1300#define PALMAS_DEV_CTRL_SW_RST 0x02 1300#define PALMAS_DEV_CTRL_SW_RST 0x02
1301#define PALMAS_DEV_CTRL_SW_RST_SHIFT 1 1301#define PALMAS_DEV_CTRL_SW_RST_SHIFT 0x01
1302#define PALMAS_DEV_CTRL_DEV_ON 0x01 1302#define PALMAS_DEV_CTRL_DEV_ON 0x01
1303#define PALMAS_DEV_CTRL_DEV_ON_SHIFT 0 1303#define PALMAS_DEV_CTRL_DEV_ON_SHIFT 0x00
1304 1304
1305/* Bit definitions for POWER_CTRL */ 1305/* Bit definitions for POWER_CTRL */
1306#define PALMAS_POWER_CTRL_ENABLE2_MASK 0x04 1306#define PALMAS_POWER_CTRL_ENABLE2_MASK 0x04
1307#define PALMAS_POWER_CTRL_ENABLE2_MASK_SHIFT 2 1307#define PALMAS_POWER_CTRL_ENABLE2_MASK_SHIFT 0x02
1308#define PALMAS_POWER_CTRL_ENABLE1_MASK 0x02 1308#define PALMAS_POWER_CTRL_ENABLE1_MASK 0x02
1309#define PALMAS_POWER_CTRL_ENABLE1_MASK_SHIFT 1 1309#define PALMAS_POWER_CTRL_ENABLE1_MASK_SHIFT 0x01
1310#define PALMAS_POWER_CTRL_NSLEEP_MASK 0x01 1310#define PALMAS_POWER_CTRL_NSLEEP_MASK 0x01
1311#define PALMAS_POWER_CTRL_NSLEEP_MASK_SHIFT 0 1311#define PALMAS_POWER_CTRL_NSLEEP_MASK_SHIFT 0x00
1312 1312
1313/* Bit definitions for VSYS_LO */ 1313/* Bit definitions for VSYS_LO */
1314#define PALMAS_VSYS_LO_THRESHOLD_MASK 0x1f 1314#define PALMAS_VSYS_LO_THRESHOLD_MASK 0x1F
1315#define PALMAS_VSYS_LO_THRESHOLD_SHIFT 0 1315#define PALMAS_VSYS_LO_THRESHOLD_SHIFT 0x00
1316 1316
1317/* Bit definitions for VSYS_MON */ 1317/* Bit definitions for VSYS_MON */
1318#define PALMAS_VSYS_MON_ENABLE 0x80 1318#define PALMAS_VSYS_MON_ENABLE 0x80
1319#define PALMAS_VSYS_MON_ENABLE_SHIFT 7 1319#define PALMAS_VSYS_MON_ENABLE_SHIFT 0x07
1320#define PALMAS_VSYS_MON_THRESHOLD_MASK 0x3f 1320#define PALMAS_VSYS_MON_THRESHOLD_MASK 0x3F
1321#define PALMAS_VSYS_MON_THRESHOLD_SHIFT 0 1321#define PALMAS_VSYS_MON_THRESHOLD_SHIFT 0x00
1322 1322
1323/* Bit definitions for VBAT_MON */ 1323/* Bit definitions for VBAT_MON */
1324#define PALMAS_VBAT_MON_ENABLE 0x80 1324#define PALMAS_VBAT_MON_ENABLE 0x80
1325#define PALMAS_VBAT_MON_ENABLE_SHIFT 7 1325#define PALMAS_VBAT_MON_ENABLE_SHIFT 0x07
1326#define PALMAS_VBAT_MON_THRESHOLD_MASK 0x3f 1326#define PALMAS_VBAT_MON_THRESHOLD_MASK 0x3F
1327#define PALMAS_VBAT_MON_THRESHOLD_SHIFT 0 1327#define PALMAS_VBAT_MON_THRESHOLD_SHIFT 0x00
1328 1328
1329/* Bit definitions for WATCHDOG */ 1329/* Bit definitions for WATCHDOG */
1330#define PALMAS_WATCHDOG_LOCK 0x20 1330#define PALMAS_WATCHDOG_LOCK 0x20
1331#define PALMAS_WATCHDOG_LOCK_SHIFT 5 1331#define PALMAS_WATCHDOG_LOCK_SHIFT 0x05
1332#define PALMAS_WATCHDOG_ENABLE 0x10 1332#define PALMAS_WATCHDOG_ENABLE 0x10
1333#define PALMAS_WATCHDOG_ENABLE_SHIFT 4 1333#define PALMAS_WATCHDOG_ENABLE_SHIFT 0x04
1334#define PALMAS_WATCHDOG_MODE 0x08 1334#define PALMAS_WATCHDOG_MODE 0x08
1335#define PALMAS_WATCHDOG_MODE_SHIFT 3 1335#define PALMAS_WATCHDOG_MODE_SHIFT 0x03
1336#define PALMAS_WATCHDOG_TIMER_MASK 0x07 1336#define PALMAS_WATCHDOG_TIMER_MASK 0x07
1337#define PALMAS_WATCHDOG_TIMER_SHIFT 0 1337#define PALMAS_WATCHDOG_TIMER_SHIFT 0x00
1338 1338
1339/* Bit definitions for BOOT_STATUS */ 1339/* Bit definitions for BOOT_STATUS */
1340#define PALMAS_BOOT_STATUS_BOOT1 0x02 1340#define PALMAS_BOOT_STATUS_BOOT1 0x02
1341#define PALMAS_BOOT_STATUS_BOOT1_SHIFT 1 1341#define PALMAS_BOOT_STATUS_BOOT1_SHIFT 0x01
1342#define PALMAS_BOOT_STATUS_BOOT0 0x01 1342#define PALMAS_BOOT_STATUS_BOOT0 0x01
1343#define PALMAS_BOOT_STATUS_BOOT0_SHIFT 0 1343#define PALMAS_BOOT_STATUS_BOOT0_SHIFT 0x00
1344 1344
1345/* Bit definitions for BATTERY_BOUNCE */ 1345/* Bit definitions for BATTERY_BOUNCE */
1346#define PALMAS_BATTERY_BOUNCE_BB_DELAY_MASK 0x3f 1346#define PALMAS_BATTERY_BOUNCE_BB_DELAY_MASK 0x3F
1347#define PALMAS_BATTERY_BOUNCE_BB_DELAY_SHIFT 0 1347#define PALMAS_BATTERY_BOUNCE_BB_DELAY_SHIFT 0x00
1348 1348
1349/* Bit definitions for BACKUP_BATTERY_CTRL */ 1349/* Bit definitions for BACKUP_BATTERY_CTRL */
1350#define PALMAS_BACKUP_BATTERY_CTRL_VRTC_18_15 0x80 1350#define PALMAS_BACKUP_BATTERY_CTRL_VRTC_18_15 0x80
1351#define PALMAS_BACKUP_BATTERY_CTRL_VRTC_18_15_SHIFT 7 1351#define PALMAS_BACKUP_BATTERY_CTRL_VRTC_18_15_SHIFT 0x07
1352#define PALMAS_BACKUP_BATTERY_CTRL_VRTC_EN_SLP 0x40 1352#define PALMAS_BACKUP_BATTERY_CTRL_VRTC_EN_SLP 0x40
1353#define PALMAS_BACKUP_BATTERY_CTRL_VRTC_EN_SLP_SHIFT 6 1353#define PALMAS_BACKUP_BATTERY_CTRL_VRTC_EN_SLP_SHIFT 0x06
1354#define PALMAS_BACKUP_BATTERY_CTRL_VRTC_EN_OFF 0x20 1354#define PALMAS_BACKUP_BATTERY_CTRL_VRTC_EN_OFF 0x20
1355#define PALMAS_BACKUP_BATTERY_CTRL_VRTC_EN_OFF_SHIFT 5 1355#define PALMAS_BACKUP_BATTERY_CTRL_VRTC_EN_OFF_SHIFT 0x05
1356#define PALMAS_BACKUP_BATTERY_CTRL_VRTC_PWEN 0x10 1356#define PALMAS_BACKUP_BATTERY_CTRL_VRTC_PWEN 0x10
1357#define PALMAS_BACKUP_BATTERY_CTRL_VRTC_PWEN_SHIFT 4 1357#define PALMAS_BACKUP_BATTERY_CTRL_VRTC_PWEN_SHIFT 0x04
1358#define PALMAS_BACKUP_BATTERY_CTRL_BBS_BBC_LOW_ICHRG 0x08 1358#define PALMAS_BACKUP_BATTERY_CTRL_BBS_BBC_LOW_ICHRG 0x08
1359#define PALMAS_BACKUP_BATTERY_CTRL_BBS_BBC_LOW_ICHRG_SHIFT 3 1359#define PALMAS_BACKUP_BATTERY_CTRL_BBS_BBC_LOW_ICHRG_SHIFT 0x03
1360#define PALMAS_BACKUP_BATTERY_CTRL_BB_SEL_MASK 0x06 1360#define PALMAS_BACKUP_BATTERY_CTRL_BB_SEL_MASK 0x06
1361#define PALMAS_BACKUP_BATTERY_CTRL_BB_SEL_SHIFT 1 1361#define PALMAS_BACKUP_BATTERY_CTRL_BB_SEL_SHIFT 0x01
1362#define PALMAS_BACKUP_BATTERY_CTRL_BB_CHG_EN 0x01 1362#define PALMAS_BACKUP_BATTERY_CTRL_BB_CHG_EN 0x01
1363#define PALMAS_BACKUP_BATTERY_CTRL_BB_CHG_EN_SHIFT 0 1363#define PALMAS_BACKUP_BATTERY_CTRL_BB_CHG_EN_SHIFT 0x00
1364 1364
1365/* Bit definitions for LONG_PRESS_KEY */ 1365/* Bit definitions for LONG_PRESS_KEY */
1366#define PALMAS_LONG_PRESS_KEY_LPK_LOCK 0x80 1366#define PALMAS_LONG_PRESS_KEY_LPK_LOCK 0x80
1367#define PALMAS_LONG_PRESS_KEY_LPK_LOCK_SHIFT 7 1367#define PALMAS_LONG_PRESS_KEY_LPK_LOCK_SHIFT 0x07
1368#define PALMAS_LONG_PRESS_KEY_LPK_INT_CLR 0x10 1368#define PALMAS_LONG_PRESS_KEY_LPK_INT_CLR 0x10
1369#define PALMAS_LONG_PRESS_KEY_LPK_INT_CLR_SHIFT 4 1369#define PALMAS_LONG_PRESS_KEY_LPK_INT_CLR_SHIFT 0x04
1370#define PALMAS_LONG_PRESS_KEY_LPK_TIME_MASK 0x0c 1370#define PALMAS_LONG_PRESS_KEY_LPK_TIME_MASK 0x0c
1371#define PALMAS_LONG_PRESS_KEY_LPK_TIME_SHIFT 2 1371#define PALMAS_LONG_PRESS_KEY_LPK_TIME_SHIFT 0x02
1372#define PALMAS_LONG_PRESS_KEY_PWRON_DEBOUNCE_MASK 0x03 1372#define PALMAS_LONG_PRESS_KEY_PWRON_DEBOUNCE_MASK 0x03
1373#define PALMAS_LONG_PRESS_KEY_PWRON_DEBOUNCE_SHIFT 0 1373#define PALMAS_LONG_PRESS_KEY_PWRON_DEBOUNCE_SHIFT 0x00
1374 1374
1375/* Bit definitions for OSC_THERM_CTRL */ 1375/* Bit definitions for OSC_THERM_CTRL */
1376#define PALMAS_OSC_THERM_CTRL_VANA_ON_IN_SLEEP 0x80 1376#define PALMAS_OSC_THERM_CTRL_VANA_ON_IN_SLEEP 0x80
1377#define PALMAS_OSC_THERM_CTRL_VANA_ON_IN_SLEEP_SHIFT 7 1377#define PALMAS_OSC_THERM_CTRL_VANA_ON_IN_SLEEP_SHIFT 0x07
1378#define PALMAS_OSC_THERM_CTRL_INT_MASK_IN_SLEEP 0x40 1378#define PALMAS_OSC_THERM_CTRL_INT_MASK_IN_SLEEP 0x40
1379#define PALMAS_OSC_THERM_CTRL_INT_MASK_IN_SLEEP_SHIFT 6 1379#define PALMAS_OSC_THERM_CTRL_INT_MASK_IN_SLEEP_SHIFT 0x06
1380#define PALMAS_OSC_THERM_CTRL_RC15MHZ_ON_IN_SLEEP 0x20 1380#define PALMAS_OSC_THERM_CTRL_RC15MHZ_ON_IN_SLEEP 0x20
1381#define PALMAS_OSC_THERM_CTRL_RC15MHZ_ON_IN_SLEEP_SHIFT 5 1381#define PALMAS_OSC_THERM_CTRL_RC15MHZ_ON_IN_SLEEP_SHIFT 0x05
1382#define PALMAS_OSC_THERM_CTRL_THERM_OFF_IN_SLEEP 0x10 1382#define PALMAS_OSC_THERM_CTRL_THERM_OFF_IN_SLEEP 0x10
1383#define PALMAS_OSC_THERM_CTRL_THERM_OFF_IN_SLEEP_SHIFT 4 1383#define PALMAS_OSC_THERM_CTRL_THERM_OFF_IN_SLEEP_SHIFT 0x04
1384#define PALMAS_OSC_THERM_CTRL_THERM_HD_SEL_MASK 0x0c 1384#define PALMAS_OSC_THERM_CTRL_THERM_HD_SEL_MASK 0x0c
1385#define PALMAS_OSC_THERM_CTRL_THERM_HD_SEL_SHIFT 2 1385#define PALMAS_OSC_THERM_CTRL_THERM_HD_SEL_SHIFT 0x02
1386#define PALMAS_OSC_THERM_CTRL_OSC_BYPASS 0x02 1386#define PALMAS_OSC_THERM_CTRL_OSC_BYPASS 0x02
1387#define PALMAS_OSC_THERM_CTRL_OSC_BYPASS_SHIFT 1 1387#define PALMAS_OSC_THERM_CTRL_OSC_BYPASS_SHIFT 0x01
1388#define PALMAS_OSC_THERM_CTRL_OSC_HPMODE 0x01 1388#define PALMAS_OSC_THERM_CTRL_OSC_HPMODE 0x01
1389#define PALMAS_OSC_THERM_CTRL_OSC_HPMODE_SHIFT 0 1389#define PALMAS_OSC_THERM_CTRL_OSC_HPMODE_SHIFT 0x00
1390 1390
1391/* Bit definitions for BATDEBOUNCING */ 1391/* Bit definitions for BATDEBOUNCING */
1392#define PALMAS_BATDEBOUNCING_BAT_DEB_BYPASS 0x80 1392#define PALMAS_BATDEBOUNCING_BAT_DEB_BYPASS 0x80
1393#define PALMAS_BATDEBOUNCING_BAT_DEB_BYPASS_SHIFT 7 1393#define PALMAS_BATDEBOUNCING_BAT_DEB_BYPASS_SHIFT 0x07
1394#define PALMAS_BATDEBOUNCING_BINS_DEB_MASK 0x78 1394#define PALMAS_BATDEBOUNCING_BINS_DEB_MASK 0x78
1395#define PALMAS_BATDEBOUNCING_BINS_DEB_SHIFT 3 1395#define PALMAS_BATDEBOUNCING_BINS_DEB_SHIFT 0x03
1396#define PALMAS_BATDEBOUNCING_BEXT_DEB_MASK 0x07 1396#define PALMAS_BATDEBOUNCING_BEXT_DEB_MASK 0x07
1397#define PALMAS_BATDEBOUNCING_BEXT_DEB_SHIFT 0 1397#define PALMAS_BATDEBOUNCING_BEXT_DEB_SHIFT 0x00
1398 1398
1399/* Bit definitions for SWOFF_HWRST */ 1399/* Bit definitions for SWOFF_HWRST */
1400#define PALMAS_SWOFF_HWRST_PWRON_LPK 0x80 1400#define PALMAS_SWOFF_HWRST_PWRON_LPK 0x80
1401#define PALMAS_SWOFF_HWRST_PWRON_LPK_SHIFT 7 1401#define PALMAS_SWOFF_HWRST_PWRON_LPK_SHIFT 0x07
1402#define PALMAS_SWOFF_HWRST_PWRDOWN 0x40 1402#define PALMAS_SWOFF_HWRST_PWRDOWN 0x40
1403#define PALMAS_SWOFF_HWRST_PWRDOWN_SHIFT 6 1403#define PALMAS_SWOFF_HWRST_PWRDOWN_SHIFT 0x06
1404#define PALMAS_SWOFF_HWRST_WTD 0x20 1404#define PALMAS_SWOFF_HWRST_WTD 0x20
1405#define PALMAS_SWOFF_HWRST_WTD_SHIFT 5 1405#define PALMAS_SWOFF_HWRST_WTD_SHIFT 0x05
1406#define PALMAS_SWOFF_HWRST_TSHUT 0x10 1406#define PALMAS_SWOFF_HWRST_TSHUT 0x10
1407#define PALMAS_SWOFF_HWRST_TSHUT_SHIFT 4 1407#define PALMAS_SWOFF_HWRST_TSHUT_SHIFT 0x04
1408#define PALMAS_SWOFF_HWRST_RESET_IN 0x08 1408#define PALMAS_SWOFF_HWRST_RESET_IN 0x08
1409#define PALMAS_SWOFF_HWRST_RESET_IN_SHIFT 3 1409#define PALMAS_SWOFF_HWRST_RESET_IN_SHIFT 0x03
1410#define PALMAS_SWOFF_HWRST_SW_RST 0x04 1410#define PALMAS_SWOFF_HWRST_SW_RST 0x04
1411#define PALMAS_SWOFF_HWRST_SW_RST_SHIFT 2 1411#define PALMAS_SWOFF_HWRST_SW_RST_SHIFT 0x02
1412#define PALMAS_SWOFF_HWRST_VSYS_LO 0x02 1412#define PALMAS_SWOFF_HWRST_VSYS_LO 0x02
1413#define PALMAS_SWOFF_HWRST_VSYS_LO_SHIFT 1 1413#define PALMAS_SWOFF_HWRST_VSYS_LO_SHIFT 0x01
1414#define PALMAS_SWOFF_HWRST_GPADC_SHUTDOWN 0x01 1414#define PALMAS_SWOFF_HWRST_GPADC_SHUTDOWN 0x01
1415#define PALMAS_SWOFF_HWRST_GPADC_SHUTDOWN_SHIFT 0 1415#define PALMAS_SWOFF_HWRST_GPADC_SHUTDOWN_SHIFT 0x00
1416 1416
1417/* Bit definitions for SWOFF_COLDRST */ 1417/* Bit definitions for SWOFF_COLDRST */
1418#define PALMAS_SWOFF_COLDRST_PWRON_LPK 0x80 1418#define PALMAS_SWOFF_COLDRST_PWRON_LPK 0x80
1419#define PALMAS_SWOFF_COLDRST_PWRON_LPK_SHIFT 7 1419#define PALMAS_SWOFF_COLDRST_PWRON_LPK_SHIFT 0x07
1420#define PALMAS_SWOFF_COLDRST_PWRDOWN 0x40 1420#define PALMAS_SWOFF_COLDRST_PWRDOWN 0x40
1421#define PALMAS_SWOFF_COLDRST_PWRDOWN_SHIFT 6 1421#define PALMAS_SWOFF_COLDRST_PWRDOWN_SHIFT 0x06
1422#define PALMAS_SWOFF_COLDRST_WTD 0x20 1422#define PALMAS_SWOFF_COLDRST_WTD 0x20
1423#define PALMAS_SWOFF_COLDRST_WTD_SHIFT 5 1423#define PALMAS_SWOFF_COLDRST_WTD_SHIFT 0x05
1424#define PALMAS_SWOFF_COLDRST_TSHUT 0x10 1424#define PALMAS_SWOFF_COLDRST_TSHUT 0x10
1425#define PALMAS_SWOFF_COLDRST_TSHUT_SHIFT 4 1425#define PALMAS_SWOFF_COLDRST_TSHUT_SHIFT 0x04
1426#define PALMAS_SWOFF_COLDRST_RESET_IN 0x08 1426#define PALMAS_SWOFF_COLDRST_RESET_IN 0x08
1427#define PALMAS_SWOFF_COLDRST_RESET_IN_SHIFT 3 1427#define PALMAS_SWOFF_COLDRST_RESET_IN_SHIFT 0x03
1428#define PALMAS_SWOFF_COLDRST_SW_RST 0x04 1428#define PALMAS_SWOFF_COLDRST_SW_RST 0x04
1429#define PALMAS_SWOFF_COLDRST_SW_RST_SHIFT 2 1429#define PALMAS_SWOFF_COLDRST_SW_RST_SHIFT 0x02
1430#define PALMAS_SWOFF_COLDRST_VSYS_LO 0x02 1430#define PALMAS_SWOFF_COLDRST_VSYS_LO 0x02
1431#define PALMAS_SWOFF_COLDRST_VSYS_LO_SHIFT 1 1431#define PALMAS_SWOFF_COLDRST_VSYS_LO_SHIFT 0x01
1432#define PALMAS_SWOFF_COLDRST_GPADC_SHUTDOWN 0x01 1432#define PALMAS_SWOFF_COLDRST_GPADC_SHUTDOWN 0x01
1433#define PALMAS_SWOFF_COLDRST_GPADC_SHUTDOWN_SHIFT 0 1433#define PALMAS_SWOFF_COLDRST_GPADC_SHUTDOWN_SHIFT 0x00
1434 1434
1435/* Bit definitions for SWOFF_STATUS */ 1435/* Bit definitions for SWOFF_STATUS */
1436#define PALMAS_SWOFF_STATUS_PWRON_LPK 0x80 1436#define PALMAS_SWOFF_STATUS_PWRON_LPK 0x80
1437#define PALMAS_SWOFF_STATUS_PWRON_LPK_SHIFT 7 1437#define PALMAS_SWOFF_STATUS_PWRON_LPK_SHIFT 0x07
1438#define PALMAS_SWOFF_STATUS_PWRDOWN 0x40 1438#define PALMAS_SWOFF_STATUS_PWRDOWN 0x40
1439#define PALMAS_SWOFF_STATUS_PWRDOWN_SHIFT 6 1439#define PALMAS_SWOFF_STATUS_PWRDOWN_SHIFT 0x06
1440#define PALMAS_SWOFF_STATUS_WTD 0x20 1440#define PALMAS_SWOFF_STATUS_WTD 0x20
1441#define PALMAS_SWOFF_STATUS_WTD_SHIFT 5 1441#define PALMAS_SWOFF_STATUS_WTD_SHIFT 0x05
1442#define PALMAS_SWOFF_STATUS_TSHUT 0x10 1442#define PALMAS_SWOFF_STATUS_TSHUT 0x10
1443#define PALMAS_SWOFF_STATUS_TSHUT_SHIFT 4 1443#define PALMAS_SWOFF_STATUS_TSHUT_SHIFT 0x04
1444#define PALMAS_SWOFF_STATUS_RESET_IN 0x08 1444#define PALMAS_SWOFF_STATUS_RESET_IN 0x08
1445#define PALMAS_SWOFF_STATUS_RESET_IN_SHIFT 3 1445#define PALMAS_SWOFF_STATUS_RESET_IN_SHIFT 0x03
1446#define PALMAS_SWOFF_STATUS_SW_RST 0x04 1446#define PALMAS_SWOFF_STATUS_SW_RST 0x04
1447#define PALMAS_SWOFF_STATUS_SW_RST_SHIFT 2 1447#define PALMAS_SWOFF_STATUS_SW_RST_SHIFT 0x02
1448#define PALMAS_SWOFF_STATUS_VSYS_LO 0x02 1448#define PALMAS_SWOFF_STATUS_VSYS_LO 0x02
1449#define PALMAS_SWOFF_STATUS_VSYS_LO_SHIFT 1 1449#define PALMAS_SWOFF_STATUS_VSYS_LO_SHIFT 0x01
1450#define PALMAS_SWOFF_STATUS_GPADC_SHUTDOWN 0x01 1450#define PALMAS_SWOFF_STATUS_GPADC_SHUTDOWN 0x01
1451#define PALMAS_SWOFF_STATUS_GPADC_SHUTDOWN_SHIFT 0 1451#define PALMAS_SWOFF_STATUS_GPADC_SHUTDOWN_SHIFT 0x00
1452 1452
1453/* Bit definitions for PMU_CONFIG */ 1453/* Bit definitions for PMU_CONFIG */
1454#define PALMAS_PMU_CONFIG_MULTI_CELL_EN 0x40 1454#define PALMAS_PMU_CONFIG_MULTI_CELL_EN 0x40
1455#define PALMAS_PMU_CONFIG_MULTI_CELL_EN_SHIFT 6 1455#define PALMAS_PMU_CONFIG_MULTI_CELL_EN_SHIFT 0x06
1456#define PALMAS_PMU_CONFIG_SPARE_MASK 0x30 1456#define PALMAS_PMU_CONFIG_SPARE_MASK 0x30
1457#define PALMAS_PMU_CONFIG_SPARE_SHIFT 4 1457#define PALMAS_PMU_CONFIG_SPARE_SHIFT 0x04
1458#define PALMAS_PMU_CONFIG_SWOFF_DLY_MASK 0x0c 1458#define PALMAS_PMU_CONFIG_SWOFF_DLY_MASK 0x0c
1459#define PALMAS_PMU_CONFIG_SWOFF_DLY_SHIFT 2 1459#define PALMAS_PMU_CONFIG_SWOFF_DLY_SHIFT 0x02
1460#define PALMAS_PMU_CONFIG_GATE_RESET_OUT 0x02 1460#define PALMAS_PMU_CONFIG_GATE_RESET_OUT 0x02
1461#define PALMAS_PMU_CONFIG_GATE_RESET_OUT_SHIFT 1 1461#define PALMAS_PMU_CONFIG_GATE_RESET_OUT_SHIFT 0x01
1462#define PALMAS_PMU_CONFIG_AUTODEVON 0x01 1462#define PALMAS_PMU_CONFIG_AUTODEVON 0x01
1463#define PALMAS_PMU_CONFIG_AUTODEVON_SHIFT 0 1463#define PALMAS_PMU_CONFIG_AUTODEVON_SHIFT 0x00
1464 1464
1465/* Bit definitions for SPARE */ 1465/* Bit definitions for SPARE */
1466#define PALMAS_SPARE_SPARE_MASK 0xf8 1466#define PALMAS_SPARE_SPARE_MASK 0xf8
1467#define PALMAS_SPARE_SPARE_SHIFT 3 1467#define PALMAS_SPARE_SPARE_SHIFT 0x03
1468#define PALMAS_SPARE_REGEN3_OD 0x04 1468#define PALMAS_SPARE_REGEN3_OD 0x04
1469#define PALMAS_SPARE_REGEN3_OD_SHIFT 2 1469#define PALMAS_SPARE_REGEN3_OD_SHIFT 0x02
1470#define PALMAS_SPARE_REGEN2_OD 0x02 1470#define PALMAS_SPARE_REGEN2_OD 0x02
1471#define PALMAS_SPARE_REGEN2_OD_SHIFT 1 1471#define PALMAS_SPARE_REGEN2_OD_SHIFT 0x01
1472#define PALMAS_SPARE_REGEN1_OD 0x01 1472#define PALMAS_SPARE_REGEN1_OD 0x01
1473#define PALMAS_SPARE_REGEN1_OD_SHIFT 0 1473#define PALMAS_SPARE_REGEN1_OD_SHIFT 0x00
1474 1474
1475/* Bit definitions for PMU_SECONDARY_INT */ 1475/* Bit definitions for PMU_SECONDARY_INT */
1476#define PALMAS_PMU_SECONDARY_INT_VBUS_OVV_INT_SRC 0x80 1476#define PALMAS_PMU_SECONDARY_INT_VBUS_OVV_INT_SRC 0x80
1477#define PALMAS_PMU_SECONDARY_INT_VBUS_OVV_INT_SRC_SHIFT 7 1477#define PALMAS_PMU_SECONDARY_INT_VBUS_OVV_INT_SRC_SHIFT 0x07
1478#define PALMAS_PMU_SECONDARY_INT_CHARG_DET_N_INT_SRC 0x40 1478#define PALMAS_PMU_SECONDARY_INT_CHARG_DET_N_INT_SRC 0x40
1479#define PALMAS_PMU_SECONDARY_INT_CHARG_DET_N_INT_SRC_SHIFT 6 1479#define PALMAS_PMU_SECONDARY_INT_CHARG_DET_N_INT_SRC_SHIFT 0x06
1480#define PALMAS_PMU_SECONDARY_INT_BB_INT_SRC 0x20 1480#define PALMAS_PMU_SECONDARY_INT_BB_INT_SRC 0x20
1481#define PALMAS_PMU_SECONDARY_INT_BB_INT_SRC_SHIFT 5 1481#define PALMAS_PMU_SECONDARY_INT_BB_INT_SRC_SHIFT 0x05
1482#define PALMAS_PMU_SECONDARY_INT_FBI_INT_SRC 0x10 1482#define PALMAS_PMU_SECONDARY_INT_FBI_INT_SRC 0x10
1483#define PALMAS_PMU_SECONDARY_INT_FBI_INT_SRC_SHIFT 4 1483#define PALMAS_PMU_SECONDARY_INT_FBI_INT_SRC_SHIFT 0x04
1484#define PALMAS_PMU_SECONDARY_INT_VBUS_OVV_MASK 0x08 1484#define PALMAS_PMU_SECONDARY_INT_VBUS_OVV_MASK 0x08
1485#define PALMAS_PMU_SECONDARY_INT_VBUS_OVV_MASK_SHIFT 3 1485#define PALMAS_PMU_SECONDARY_INT_VBUS_OVV_MASK_SHIFT 0x03
1486#define PALMAS_PMU_SECONDARY_INT_CHARG_DET_N_MASK 0x04 1486#define PALMAS_PMU_SECONDARY_INT_CHARG_DET_N_MASK 0x04
1487#define PALMAS_PMU_SECONDARY_INT_CHARG_DET_N_MASK_SHIFT 2 1487#define PALMAS_PMU_SECONDARY_INT_CHARG_DET_N_MASK_SHIFT 0x02
1488#define PALMAS_PMU_SECONDARY_INT_BB_MASK 0x02 1488#define PALMAS_PMU_SECONDARY_INT_BB_MASK 0x02
1489#define PALMAS_PMU_SECONDARY_INT_BB_MASK_SHIFT 1 1489#define PALMAS_PMU_SECONDARY_INT_BB_MASK_SHIFT 0x01
1490#define PALMAS_PMU_SECONDARY_INT_FBI_MASK 0x01 1490#define PALMAS_PMU_SECONDARY_INT_FBI_MASK 0x01
1491#define PALMAS_PMU_SECONDARY_INT_FBI_MASK_SHIFT 0 1491#define PALMAS_PMU_SECONDARY_INT_FBI_MASK_SHIFT 0x00
1492 1492
1493/* Bit definitions for SW_REVISION */ 1493/* Bit definitions for SW_REVISION */
1494#define PALMAS_SW_REVISION_SW_REVISION_MASK 0xff 1494#define PALMAS_SW_REVISION_SW_REVISION_MASK 0xFF
1495#define PALMAS_SW_REVISION_SW_REVISION_SHIFT 0 1495#define PALMAS_SW_REVISION_SW_REVISION_SHIFT 0x00
1496 1496
1497/* Bit definitions for EXT_CHRG_CTRL */ 1497/* Bit definitions for EXT_CHRG_CTRL */
1498#define PALMAS_EXT_CHRG_CTRL_VBUS_OVV_STATUS 0x80 1498#define PALMAS_EXT_CHRG_CTRL_VBUS_OVV_STATUS 0x80
1499#define PALMAS_EXT_CHRG_CTRL_VBUS_OVV_STATUS_SHIFT 7 1499#define PALMAS_EXT_CHRG_CTRL_VBUS_OVV_STATUS_SHIFT 0x07
1500#define PALMAS_EXT_CHRG_CTRL_CHARG_DET_N_STATUS 0x40 1500#define PALMAS_EXT_CHRG_CTRL_CHARG_DET_N_STATUS 0x40
1501#define PALMAS_EXT_CHRG_CTRL_CHARG_DET_N_STATUS_SHIFT 6 1501#define PALMAS_EXT_CHRG_CTRL_CHARG_DET_N_STATUS_SHIFT 0x06
1502#define PALMAS_EXT_CHRG_CTRL_VSYS_DEBOUNCE_DELAY 0x08 1502#define PALMAS_EXT_CHRG_CTRL_VSYS_DEBOUNCE_DELAY 0x08
1503#define PALMAS_EXT_CHRG_CTRL_VSYS_DEBOUNCE_DELAY_SHIFT 3 1503#define PALMAS_EXT_CHRG_CTRL_VSYS_DEBOUNCE_DELAY_SHIFT 0x03
1504#define PALMAS_EXT_CHRG_CTRL_CHRG_DET_N 0x04 1504#define PALMAS_EXT_CHRG_CTRL_CHRG_DET_N 0x04
1505#define PALMAS_EXT_CHRG_CTRL_CHRG_DET_N_SHIFT 2 1505#define PALMAS_EXT_CHRG_CTRL_CHRG_DET_N_SHIFT 0x02
1506#define PALMAS_EXT_CHRG_CTRL_AUTO_ACA_EN 0x02 1506#define PALMAS_EXT_CHRG_CTRL_AUTO_ACA_EN 0x02
1507#define PALMAS_EXT_CHRG_CTRL_AUTO_ACA_EN_SHIFT 1 1507#define PALMAS_EXT_CHRG_CTRL_AUTO_ACA_EN_SHIFT 0x01
1508#define PALMAS_EXT_CHRG_CTRL_AUTO_LDOUSB_EN 0x01 1508#define PALMAS_EXT_CHRG_CTRL_AUTO_LDOUSB_EN 0x01
1509#define PALMAS_EXT_CHRG_CTRL_AUTO_LDOUSB_EN_SHIFT 0 1509#define PALMAS_EXT_CHRG_CTRL_AUTO_LDOUSB_EN_SHIFT 0x00
1510 1510
1511/* Bit definitions for PMU_SECONDARY_INT2 */ 1511/* Bit definitions for PMU_SECONDARY_INT2 */
1512#define PALMAS_PMU_SECONDARY_INT2_DVFS2_INT_SRC 0x20 1512#define PALMAS_PMU_SECONDARY_INT2_DVFS2_INT_SRC 0x20
1513#define PALMAS_PMU_SECONDARY_INT2_DVFS2_INT_SRC_SHIFT 5 1513#define PALMAS_PMU_SECONDARY_INT2_DVFS2_INT_SRC_SHIFT 0x05
1514#define PALMAS_PMU_SECONDARY_INT2_DVFS1_INT_SRC 0x10 1514#define PALMAS_PMU_SECONDARY_INT2_DVFS1_INT_SRC 0x10
1515#define PALMAS_PMU_SECONDARY_INT2_DVFS1_INT_SRC_SHIFT 4 1515#define PALMAS_PMU_SECONDARY_INT2_DVFS1_INT_SRC_SHIFT 0x04
1516#define PALMAS_PMU_SECONDARY_INT2_DVFS2_MASK 0x02 1516#define PALMAS_PMU_SECONDARY_INT2_DVFS2_MASK 0x02
1517#define PALMAS_PMU_SECONDARY_INT2_DVFS2_MASK_SHIFT 1 1517#define PALMAS_PMU_SECONDARY_INT2_DVFS2_MASK_SHIFT 0x01
1518#define PALMAS_PMU_SECONDARY_INT2_DVFS1_MASK 0x01 1518#define PALMAS_PMU_SECONDARY_INT2_DVFS1_MASK 0x01
1519#define PALMAS_PMU_SECONDARY_INT2_DVFS1_MASK_SHIFT 0 1519#define PALMAS_PMU_SECONDARY_INT2_DVFS1_MASK_SHIFT 0x00
1520 1520
1521/* Registers for function RESOURCE */ 1521/* Registers for function RESOURCE */
1522#define PALMAS_CLK32KG_CTRL 0x0 1522#define PALMAS_CLK32KG_CTRL 0x00
1523#define PALMAS_CLK32KGAUDIO_CTRL 0x1 1523#define PALMAS_CLK32KGAUDIO_CTRL 0x01
1524#define PALMAS_REGEN1_CTRL 0x2 1524#define PALMAS_REGEN1_CTRL 0x02
1525#define PALMAS_REGEN2_CTRL 0x3 1525#define PALMAS_REGEN2_CTRL 0x03
1526#define PALMAS_SYSEN1_CTRL 0x4 1526#define PALMAS_SYSEN1_CTRL 0x04
1527#define PALMAS_SYSEN2_CTRL 0x5 1527#define PALMAS_SYSEN2_CTRL 0x05
1528#define PALMAS_NSLEEP_RES_ASSIGN 0x6 1528#define PALMAS_NSLEEP_RES_ASSIGN 0x06
1529#define PALMAS_NSLEEP_SMPS_ASSIGN 0x7 1529#define PALMAS_NSLEEP_SMPS_ASSIGN 0x07
1530#define PALMAS_NSLEEP_LDO_ASSIGN1 0x8 1530#define PALMAS_NSLEEP_LDO_ASSIGN1 0x08
1531#define PALMAS_NSLEEP_LDO_ASSIGN2 0x9 1531#define PALMAS_NSLEEP_LDO_ASSIGN2 0x09
1532#define PALMAS_ENABLE1_RES_ASSIGN 0xA 1532#define PALMAS_ENABLE1_RES_ASSIGN 0x0A
1533#define PALMAS_ENABLE1_SMPS_ASSIGN 0xB 1533#define PALMAS_ENABLE1_SMPS_ASSIGN 0x0B
1534#define PALMAS_ENABLE1_LDO_ASSIGN1 0xC 1534#define PALMAS_ENABLE1_LDO_ASSIGN1 0x0C
1535#define PALMAS_ENABLE1_LDO_ASSIGN2 0xD 1535#define PALMAS_ENABLE1_LDO_ASSIGN2 0x0D
1536#define PALMAS_ENABLE2_RES_ASSIGN 0xE 1536#define PALMAS_ENABLE2_RES_ASSIGN 0x0E
1537#define PALMAS_ENABLE2_SMPS_ASSIGN 0xF 1537#define PALMAS_ENABLE2_SMPS_ASSIGN 0x0F
1538#define PALMAS_ENABLE2_LDO_ASSIGN1 0x10 1538#define PALMAS_ENABLE2_LDO_ASSIGN1 0x10
1539#define PALMAS_ENABLE2_LDO_ASSIGN2 0x11 1539#define PALMAS_ENABLE2_LDO_ASSIGN2 0x11
1540#define PALMAS_REGEN3_CTRL 0x12 1540#define PALMAS_REGEN3_CTRL 0x12
1541 1541
1542/* Bit definitions for CLK32KG_CTRL */ 1542/* Bit definitions for CLK32KG_CTRL */
1543#define PALMAS_CLK32KG_CTRL_STATUS 0x10 1543#define PALMAS_CLK32KG_CTRL_STATUS 0x10
1544#define PALMAS_CLK32KG_CTRL_STATUS_SHIFT 4 1544#define PALMAS_CLK32KG_CTRL_STATUS_SHIFT 0x04
1545#define PALMAS_CLK32KG_CTRL_MODE_SLEEP 0x04 1545#define PALMAS_CLK32KG_CTRL_MODE_SLEEP 0x04
1546#define PALMAS_CLK32KG_CTRL_MODE_SLEEP_SHIFT 2 1546#define PALMAS_CLK32KG_CTRL_MODE_SLEEP_SHIFT 0x02
1547#define PALMAS_CLK32KG_CTRL_MODE_ACTIVE 0x01 1547#define PALMAS_CLK32KG_CTRL_MODE_ACTIVE 0x01
1548#define PALMAS_CLK32KG_CTRL_MODE_ACTIVE_SHIFT 0 1548#define PALMAS_CLK32KG_CTRL_MODE_ACTIVE_SHIFT 0x00
1549 1549
1550/* Bit definitions for CLK32KGAUDIO_CTRL */ 1550/* Bit definitions for CLK32KGAUDIO_CTRL */
1551#define PALMAS_CLK32KGAUDIO_CTRL_STATUS 0x10 1551#define PALMAS_CLK32KGAUDIO_CTRL_STATUS 0x10
1552#define PALMAS_CLK32KGAUDIO_CTRL_STATUS_SHIFT 4 1552#define PALMAS_CLK32KGAUDIO_CTRL_STATUS_SHIFT 0x04
1553#define PALMAS_CLK32KGAUDIO_CTRL_RESERVED3 0x08 1553#define PALMAS_CLK32KGAUDIO_CTRL_RESERVED3 0x08
1554#define PALMAS_CLK32KGAUDIO_CTRL_RESERVED3_SHIFT 3 1554#define PALMAS_CLK32KGAUDIO_CTRL_RESERVED3_SHIFT 0x03
1555#define PALMAS_CLK32KGAUDIO_CTRL_MODE_SLEEP 0x04 1555#define PALMAS_CLK32KGAUDIO_CTRL_MODE_SLEEP 0x04
1556#define PALMAS_CLK32KGAUDIO_CTRL_MODE_SLEEP_SHIFT 2 1556#define PALMAS_CLK32KGAUDIO_CTRL_MODE_SLEEP_SHIFT 0x02
1557#define PALMAS_CLK32KGAUDIO_CTRL_MODE_ACTIVE 0x01 1557#define PALMAS_CLK32KGAUDIO_CTRL_MODE_ACTIVE 0x01
1558#define PALMAS_CLK32KGAUDIO_CTRL_MODE_ACTIVE_SHIFT 0 1558#define PALMAS_CLK32KGAUDIO_CTRL_MODE_ACTIVE_SHIFT 0x00
1559 1559
1560/* Bit definitions for REGEN1_CTRL */ 1560/* Bit definitions for REGEN1_CTRL */
1561#define PALMAS_REGEN1_CTRL_STATUS 0x10 1561#define PALMAS_REGEN1_CTRL_STATUS 0x10
1562#define PALMAS_REGEN1_CTRL_STATUS_SHIFT 4 1562#define PALMAS_REGEN1_CTRL_STATUS_SHIFT 0x04
1563#define PALMAS_REGEN1_CTRL_MODE_SLEEP 0x04 1563#define PALMAS_REGEN1_CTRL_MODE_SLEEP 0x04
1564#define PALMAS_REGEN1_CTRL_MODE_SLEEP_SHIFT 2 1564#define PALMAS_REGEN1_CTRL_MODE_SLEEP_SHIFT 0x02
1565#define PALMAS_REGEN1_CTRL_MODE_ACTIVE 0x01 1565#define PALMAS_REGEN1_CTRL_MODE_ACTIVE 0x01
1566#define PALMAS_REGEN1_CTRL_MODE_ACTIVE_SHIFT 0 1566#define PALMAS_REGEN1_CTRL_MODE_ACTIVE_SHIFT 0x00
1567 1567
1568/* Bit definitions for REGEN2_CTRL */ 1568/* Bit definitions for REGEN2_CTRL */
1569#define PALMAS_REGEN2_CTRL_STATUS 0x10 1569#define PALMAS_REGEN2_CTRL_STATUS 0x10
1570#define PALMAS_REGEN2_CTRL_STATUS_SHIFT 4 1570#define PALMAS_REGEN2_CTRL_STATUS_SHIFT 0x04
1571#define PALMAS_REGEN2_CTRL_MODE_SLEEP 0x04 1571#define PALMAS_REGEN2_CTRL_MODE_SLEEP 0x04
1572#define PALMAS_REGEN2_CTRL_MODE_SLEEP_SHIFT 2 1572#define PALMAS_REGEN2_CTRL_MODE_SLEEP_SHIFT 0x02
1573#define PALMAS_REGEN2_CTRL_MODE_ACTIVE 0x01 1573#define PALMAS_REGEN2_CTRL_MODE_ACTIVE 0x01
1574#define PALMAS_REGEN2_CTRL_MODE_ACTIVE_SHIFT 0 1574#define PALMAS_REGEN2_CTRL_MODE_ACTIVE_SHIFT 0x00
1575 1575
1576/* Bit definitions for SYSEN1_CTRL */ 1576/* Bit definitions for SYSEN1_CTRL */
1577#define PALMAS_SYSEN1_CTRL_STATUS 0x10 1577#define PALMAS_SYSEN1_CTRL_STATUS 0x10
1578#define PALMAS_SYSEN1_CTRL_STATUS_SHIFT 4 1578#define PALMAS_SYSEN1_CTRL_STATUS_SHIFT 0x04
1579#define PALMAS_SYSEN1_CTRL_MODE_SLEEP 0x04 1579#define PALMAS_SYSEN1_CTRL_MODE_SLEEP 0x04
1580#define PALMAS_SYSEN1_CTRL_MODE_SLEEP_SHIFT 2 1580#define PALMAS_SYSEN1_CTRL_MODE_SLEEP_SHIFT 0x02
1581#define PALMAS_SYSEN1_CTRL_MODE_ACTIVE 0x01 1581#define PALMAS_SYSEN1_CTRL_MODE_ACTIVE 0x01
1582#define PALMAS_SYSEN1_CTRL_MODE_ACTIVE_SHIFT 0 1582#define PALMAS_SYSEN1_CTRL_MODE_ACTIVE_SHIFT 0x00
1583 1583
1584/* Bit definitions for SYSEN2_CTRL */ 1584/* Bit definitions for SYSEN2_CTRL */
1585#define PALMAS_SYSEN2_CTRL_STATUS 0x10 1585#define PALMAS_SYSEN2_CTRL_STATUS 0x10
1586#define PALMAS_SYSEN2_CTRL_STATUS_SHIFT 4 1586#define PALMAS_SYSEN2_CTRL_STATUS_SHIFT 0x04
1587#define PALMAS_SYSEN2_CTRL_MODE_SLEEP 0x04 1587#define PALMAS_SYSEN2_CTRL_MODE_SLEEP 0x04
1588#define PALMAS_SYSEN2_CTRL_MODE_SLEEP_SHIFT 2 1588#define PALMAS_SYSEN2_CTRL_MODE_SLEEP_SHIFT 0x02
1589#define PALMAS_SYSEN2_CTRL_MODE_ACTIVE 0x01 1589#define PALMAS_SYSEN2_CTRL_MODE_ACTIVE 0x01
1590#define PALMAS_SYSEN2_CTRL_MODE_ACTIVE_SHIFT 0 1590#define PALMAS_SYSEN2_CTRL_MODE_ACTIVE_SHIFT 0x00
1591 1591
1592/* Bit definitions for NSLEEP_RES_ASSIGN */ 1592/* Bit definitions for NSLEEP_RES_ASSIGN */
1593#define PALMAS_NSLEEP_RES_ASSIGN_REGEN3 0x40 1593#define PALMAS_NSLEEP_RES_ASSIGN_REGEN3 0x40
1594#define PALMAS_NSLEEP_RES_ASSIGN_REGEN3_SHIFT 6 1594#define PALMAS_NSLEEP_RES_ASSIGN_REGEN3_SHIFT 0x06
1595#define PALMAS_NSLEEP_RES_ASSIGN_CLK32KGAUDIO 0x20 1595#define PALMAS_NSLEEP_RES_ASSIGN_CLK32KGAUDIO 0x20
1596#define PALMAS_NSLEEP_RES_ASSIGN_CLK32KGAUDIO_SHIFT 5 1596#define PALMAS_NSLEEP_RES_ASSIGN_CLK32KGAUDIO_SHIFT 0x05
1597#define PALMAS_NSLEEP_RES_ASSIGN_CLK32KG 0x10 1597#define PALMAS_NSLEEP_RES_ASSIGN_CLK32KG 0x10
1598#define PALMAS_NSLEEP_RES_ASSIGN_CLK32KG_SHIFT 4 1598#define PALMAS_NSLEEP_RES_ASSIGN_CLK32KG_SHIFT 0x04
1599#define PALMAS_NSLEEP_RES_ASSIGN_SYSEN2 0x08 1599#define PALMAS_NSLEEP_RES_ASSIGN_SYSEN2 0x08
1600#define PALMAS_NSLEEP_RES_ASSIGN_SYSEN2_SHIFT 3 1600#define PALMAS_NSLEEP_RES_ASSIGN_SYSEN2_SHIFT 0x03
1601#define PALMAS_NSLEEP_RES_ASSIGN_SYSEN1 0x04 1601#define PALMAS_NSLEEP_RES_ASSIGN_SYSEN1 0x04
1602#define PALMAS_NSLEEP_RES_ASSIGN_SYSEN1_SHIFT 2 1602#define PALMAS_NSLEEP_RES_ASSIGN_SYSEN1_SHIFT 0x02
1603#define PALMAS_NSLEEP_RES_ASSIGN_REGEN2 0x02 1603#define PALMAS_NSLEEP_RES_ASSIGN_REGEN2 0x02
1604#define PALMAS_NSLEEP_RES_ASSIGN_REGEN2_SHIFT 1 1604#define PALMAS_NSLEEP_RES_ASSIGN_REGEN2_SHIFT 0x01
1605#define PALMAS_NSLEEP_RES_ASSIGN_REGEN1 0x01 1605#define PALMAS_NSLEEP_RES_ASSIGN_REGEN1 0x01
1606#define PALMAS_NSLEEP_RES_ASSIGN_REGEN1_SHIFT 0 1606#define PALMAS_NSLEEP_RES_ASSIGN_REGEN1_SHIFT 0x00
1607 1607
1608/* Bit definitions for NSLEEP_SMPS_ASSIGN */ 1608/* Bit definitions for NSLEEP_SMPS_ASSIGN */
1609#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS10 0x80 1609#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS10 0x80
1610#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS10_SHIFT 7 1610#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS10_SHIFT 0x07
1611#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS9 0x40 1611#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS9 0x40
1612#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS9_SHIFT 6 1612#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS9_SHIFT 0x06
1613#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS8 0x20 1613#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS8 0x20
1614#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS8_SHIFT 5 1614#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS8_SHIFT 0x05
1615#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS7 0x10 1615#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS7 0x10
1616#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS7_SHIFT 4 1616#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS7_SHIFT 0x04
1617#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS6 0x08 1617#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS6 0x08
1618#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS6_SHIFT 3 1618#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS6_SHIFT 0x03
1619#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS45 0x04 1619#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS45 0x04
1620#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS45_SHIFT 2 1620#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS45_SHIFT 0x02
1621#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS3 0x02 1621#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS3 0x02
1622#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS3_SHIFT 1 1622#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS3_SHIFT 0x01
1623#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS12 0x01 1623#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS12 0x01
1624#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS12_SHIFT 0 1624#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS12_SHIFT 0x00
1625 1625
1626/* Bit definitions for NSLEEP_LDO_ASSIGN1 */ 1626/* Bit definitions for NSLEEP_LDO_ASSIGN1 */
1627#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO8 0x80 1627#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO8 0x80
1628#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO8_SHIFT 7 1628#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO8_SHIFT 0x07
1629#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO7 0x40 1629#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO7 0x40
1630#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO7_SHIFT 6 1630#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO7_SHIFT 0x06
1631#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO6 0x20 1631#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO6 0x20
1632#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO6_SHIFT 5 1632#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO6_SHIFT 0x05
1633#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO5 0x10 1633#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO5 0x10
1634#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO5_SHIFT 4 1634#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO5_SHIFT 0x04
1635#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO4 0x08 1635#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO4 0x08
1636#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO4_SHIFT 3 1636#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO4_SHIFT 0x03
1637#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO3 0x04 1637#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO3 0x04
1638#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO3_SHIFT 2 1638#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO3_SHIFT 0x02
1639#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO2 0x02 1639#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO2 0x02
1640#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO2_SHIFT 1 1640#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO2_SHIFT 0x01
1641#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO1 0x01 1641#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO1 0x01
1642#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO1_SHIFT 0 1642#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO1_SHIFT 0x00
1643 1643
1644/* Bit definitions for NSLEEP_LDO_ASSIGN2 */ 1644/* Bit definitions for NSLEEP_LDO_ASSIGN2 */
1645#define PALMAS_NSLEEP_LDO_ASSIGN2_LDOUSB 0x04 1645#define PALMAS_NSLEEP_LDO_ASSIGN2_LDOUSB 0x04
1646#define PALMAS_NSLEEP_LDO_ASSIGN2_LDOUSB_SHIFT 2 1646#define PALMAS_NSLEEP_LDO_ASSIGN2_LDOUSB_SHIFT 0x02
1647#define PALMAS_NSLEEP_LDO_ASSIGN2_LDOLN 0x02 1647#define PALMAS_NSLEEP_LDO_ASSIGN2_LDOLN 0x02
1648#define PALMAS_NSLEEP_LDO_ASSIGN2_LDOLN_SHIFT 1 1648#define PALMAS_NSLEEP_LDO_ASSIGN2_LDOLN_SHIFT 0x01
1649#define PALMAS_NSLEEP_LDO_ASSIGN2_LDO9 0x01 1649#define PALMAS_NSLEEP_LDO_ASSIGN2_LDO9 0x01
1650#define PALMAS_NSLEEP_LDO_ASSIGN2_LDO9_SHIFT 0 1650#define PALMAS_NSLEEP_LDO_ASSIGN2_LDO9_SHIFT 0x00
1651 1651
1652/* Bit definitions for ENABLE1_RES_ASSIGN */ 1652/* Bit definitions for ENABLE1_RES_ASSIGN */
1653#define PALMAS_ENABLE1_RES_ASSIGN_REGEN3 0x40 1653#define PALMAS_ENABLE1_RES_ASSIGN_REGEN3 0x40
1654#define PALMAS_ENABLE1_RES_ASSIGN_REGEN3_SHIFT 6 1654#define PALMAS_ENABLE1_RES_ASSIGN_REGEN3_SHIFT 0x06
1655#define PALMAS_ENABLE1_RES_ASSIGN_CLK32KGAUDIO 0x20 1655#define PALMAS_ENABLE1_RES_ASSIGN_CLK32KGAUDIO 0x20
1656#define PALMAS_ENABLE1_RES_ASSIGN_CLK32KGAUDIO_SHIFT 5 1656#define PALMAS_ENABLE1_RES_ASSIGN_CLK32KGAUDIO_SHIFT 0x05
1657#define PALMAS_ENABLE1_RES_ASSIGN_CLK32KG 0x10 1657#define PALMAS_ENABLE1_RES_ASSIGN_CLK32KG 0x10
1658#define PALMAS_ENABLE1_RES_ASSIGN_CLK32KG_SHIFT 4 1658#define PALMAS_ENABLE1_RES_ASSIGN_CLK32KG_SHIFT 0x04
1659#define PALMAS_ENABLE1_RES_ASSIGN_SYSEN2 0x08 1659#define PALMAS_ENABLE1_RES_ASSIGN_SYSEN2 0x08
1660#define PALMAS_ENABLE1_RES_ASSIGN_SYSEN2_SHIFT 3 1660#define PALMAS_ENABLE1_RES_ASSIGN_SYSEN2_SHIFT 0x03
1661#define PALMAS_ENABLE1_RES_ASSIGN_SYSEN1 0x04 1661#define PALMAS_ENABLE1_RES_ASSIGN_SYSEN1 0x04
1662#define PALMAS_ENABLE1_RES_ASSIGN_SYSEN1_SHIFT 2 1662#define PALMAS_ENABLE1_RES_ASSIGN_SYSEN1_SHIFT 0x02
1663#define PALMAS_ENABLE1_RES_ASSIGN_REGEN2 0x02 1663#define PALMAS_ENABLE1_RES_ASSIGN_REGEN2 0x02
1664#define PALMAS_ENABLE1_RES_ASSIGN_REGEN2_SHIFT 1 1664#define PALMAS_ENABLE1_RES_ASSIGN_REGEN2_SHIFT 0x01
1665#define PALMAS_ENABLE1_RES_ASSIGN_REGEN1 0x01 1665#define PALMAS_ENABLE1_RES_ASSIGN_REGEN1 0x01
1666#define PALMAS_ENABLE1_RES_ASSIGN_REGEN1_SHIFT 0 1666#define PALMAS_ENABLE1_RES_ASSIGN_REGEN1_SHIFT 0x00
1667 1667
1668/* Bit definitions for ENABLE1_SMPS_ASSIGN */ 1668/* Bit definitions for ENABLE1_SMPS_ASSIGN */
1669#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS10 0x80 1669#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS10 0x80
1670#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS10_SHIFT 7 1670#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS10_SHIFT 0x07
1671#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS9 0x40 1671#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS9 0x40
1672#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS9_SHIFT 6 1672#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS9_SHIFT 0x06
1673#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS8 0x20 1673#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS8 0x20
1674#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS8_SHIFT 5 1674#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS8_SHIFT 0x05
1675#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS7 0x10 1675#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS7 0x10
1676#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS7_SHIFT 4 1676#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS7_SHIFT 0x04
1677#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS6 0x08 1677#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS6 0x08
1678#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS6_SHIFT 3 1678#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS6_SHIFT 0x03
1679#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS45 0x04 1679#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS45 0x04
1680#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS45_SHIFT 2 1680#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS45_SHIFT 0x02
1681#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS3 0x02 1681#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS3 0x02
1682#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS3_SHIFT 1 1682#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS3_SHIFT 0x01
1683#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS12 0x01 1683#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS12 0x01
1684#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS12_SHIFT 0 1684#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS12_SHIFT 0x00
1685 1685
1686/* Bit definitions for ENABLE1_LDO_ASSIGN1 */ 1686/* Bit definitions for ENABLE1_LDO_ASSIGN1 */
1687#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO8 0x80 1687#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO8 0x80
1688#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO8_SHIFT 7 1688#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO8_SHIFT 0x07
1689#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO7 0x40 1689#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO7 0x40
1690#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO7_SHIFT 6 1690#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO7_SHIFT 0x06
1691#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO6 0x20 1691#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO6 0x20
1692#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO6_SHIFT 5 1692#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO6_SHIFT 0x05
1693#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO5 0x10 1693#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO5 0x10
1694#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO5_SHIFT 4 1694#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO5_SHIFT 0x04
1695#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO4 0x08 1695#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO4 0x08
1696#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO4_SHIFT 3 1696#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO4_SHIFT 0x03
1697#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO3 0x04 1697#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO3 0x04
1698#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO3_SHIFT 2 1698#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO3_SHIFT 0x02
1699#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO2 0x02 1699#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO2 0x02
1700#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO2_SHIFT 1 1700#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO2_SHIFT 0x01
1701#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO1 0x01 1701#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO1 0x01
1702#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO1_SHIFT 0 1702#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO1_SHIFT 0x00
1703 1703
1704/* Bit definitions for ENABLE1_LDO_ASSIGN2 */ 1704/* Bit definitions for ENABLE1_LDO_ASSIGN2 */
1705#define PALMAS_ENABLE1_LDO_ASSIGN2_LDOUSB 0x04 1705#define PALMAS_ENABLE1_LDO_ASSIGN2_LDOUSB 0x04
1706#define PALMAS_ENABLE1_LDO_ASSIGN2_LDOUSB_SHIFT 2 1706#define PALMAS_ENABLE1_LDO_ASSIGN2_LDOUSB_SHIFT 0x02
1707#define PALMAS_ENABLE1_LDO_ASSIGN2_LDOLN 0x02 1707#define PALMAS_ENABLE1_LDO_ASSIGN2_LDOLN 0x02
1708#define PALMAS_ENABLE1_LDO_ASSIGN2_LDOLN_SHIFT 1 1708#define PALMAS_ENABLE1_LDO_ASSIGN2_LDOLN_SHIFT 0x01
1709#define PALMAS_ENABLE1_LDO_ASSIGN2_LDO9 0x01 1709#define PALMAS_ENABLE1_LDO_ASSIGN2_LDO9 0x01
1710#define PALMAS_ENABLE1_LDO_ASSIGN2_LDO9_SHIFT 0 1710#define PALMAS_ENABLE1_LDO_ASSIGN2_LDO9_SHIFT 0x00
1711 1711
1712/* Bit definitions for ENABLE2_RES_ASSIGN */ 1712/* Bit definitions for ENABLE2_RES_ASSIGN */
1713#define PALMAS_ENABLE2_RES_ASSIGN_REGEN3 0x40 1713#define PALMAS_ENABLE2_RES_ASSIGN_REGEN3 0x40
1714#define PALMAS_ENABLE2_RES_ASSIGN_REGEN3_SHIFT 6 1714#define PALMAS_ENABLE2_RES_ASSIGN_REGEN3_SHIFT 0x06
1715#define PALMAS_ENABLE2_RES_ASSIGN_CLK32KGAUDIO 0x20 1715#define PALMAS_ENABLE2_RES_ASSIGN_CLK32KGAUDIO 0x20
1716#define PALMAS_ENABLE2_RES_ASSIGN_CLK32KGAUDIO_SHIFT 5 1716#define PALMAS_ENABLE2_RES_ASSIGN_CLK32KGAUDIO_SHIFT 0x05
1717#define PALMAS_ENABLE2_RES_ASSIGN_CLK32KG 0x10 1717#define PALMAS_ENABLE2_RES_ASSIGN_CLK32KG 0x10
1718#define PALMAS_ENABLE2_RES_ASSIGN_CLK32KG_SHIFT 4 1718#define PALMAS_ENABLE2_RES_ASSIGN_CLK32KG_SHIFT 0x04
1719#define PALMAS_ENABLE2_RES_ASSIGN_SYSEN2 0x08 1719#define PALMAS_ENABLE2_RES_ASSIGN_SYSEN2 0x08
1720#define PALMAS_ENABLE2_RES_ASSIGN_SYSEN2_SHIFT 3 1720#define PALMAS_ENABLE2_RES_ASSIGN_SYSEN2_SHIFT 0x03
1721#define PALMAS_ENABLE2_RES_ASSIGN_SYSEN1 0x04 1721#define PALMAS_ENABLE2_RES_ASSIGN_SYSEN1 0x04
1722#define PALMAS_ENABLE2_RES_ASSIGN_SYSEN1_SHIFT 2 1722#define PALMAS_ENABLE2_RES_ASSIGN_SYSEN1_SHIFT 0x02
1723#define PALMAS_ENABLE2_RES_ASSIGN_REGEN2 0x02 1723#define PALMAS_ENABLE2_RES_ASSIGN_REGEN2 0x02
1724#define PALMAS_ENABLE2_RES_ASSIGN_REGEN2_SHIFT 1 1724#define PALMAS_ENABLE2_RES_ASSIGN_REGEN2_SHIFT 0x01
1725#define PALMAS_ENABLE2_RES_ASSIGN_REGEN1 0x01 1725#define PALMAS_ENABLE2_RES_ASSIGN_REGEN1 0x01
1726#define PALMAS_ENABLE2_RES_ASSIGN_REGEN1_SHIFT 0 1726#define PALMAS_ENABLE2_RES_ASSIGN_REGEN1_SHIFT 0x00
1727 1727
1728/* Bit definitions for ENABLE2_SMPS_ASSIGN */ 1728/* Bit definitions for ENABLE2_SMPS_ASSIGN */
1729#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS10 0x80 1729#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS10 0x80
1730#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS10_SHIFT 7 1730#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS10_SHIFT 0x07
1731#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS9 0x40 1731#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS9 0x40
1732#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS9_SHIFT 6 1732#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS9_SHIFT 0x06
1733#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS8 0x20 1733#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS8 0x20
1734#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS8_SHIFT 5 1734#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS8_SHIFT 0x05
1735#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS7 0x10 1735#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS7 0x10
1736#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS7_SHIFT 4 1736#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS7_SHIFT 0x04
1737#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS6 0x08 1737#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS6 0x08
1738#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS6_SHIFT 3 1738#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS6_SHIFT 0x03
1739#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS45 0x04 1739#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS45 0x04
1740#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS45_SHIFT 2 1740#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS45_SHIFT 0x02
1741#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS3 0x02 1741#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS3 0x02
1742#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS3_SHIFT 1 1742#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS3_SHIFT 0x01
1743#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS12 0x01 1743#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS12 0x01
1744#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS12_SHIFT 0 1744#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS12_SHIFT 0x00
1745 1745
1746/* Bit definitions for ENABLE2_LDO_ASSIGN1 */ 1746/* Bit definitions for ENABLE2_LDO_ASSIGN1 */
1747#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO8 0x80 1747#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO8 0x80
1748#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO8_SHIFT 7 1748#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO8_SHIFT 0x07
1749#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO7 0x40 1749#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO7 0x40
1750#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO7_SHIFT 6 1750#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO7_SHIFT 0x06
1751#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO6 0x20 1751#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO6 0x20
1752#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO6_SHIFT 5 1752#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO6_SHIFT 0x05
1753#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO5 0x10 1753#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO5 0x10
1754#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO5_SHIFT 4 1754#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO5_SHIFT 0x04
1755#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO4 0x08 1755#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO4 0x08
1756#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO4_SHIFT 3 1756#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO4_SHIFT 0x03
1757#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO3 0x04 1757#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO3 0x04
1758#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO3_SHIFT 2 1758#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO3_SHIFT 0x02
1759#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO2 0x02 1759#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO2 0x02
1760#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO2_SHIFT 1 1760#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO2_SHIFT 0x01
1761#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO1 0x01 1761#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO1 0x01
1762#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO1_SHIFT 0 1762#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO1_SHIFT 0x00
1763 1763
1764/* Bit definitions for ENABLE2_LDO_ASSIGN2 */ 1764/* Bit definitions for ENABLE2_LDO_ASSIGN2 */
1765#define PALMAS_ENABLE2_LDO_ASSIGN2_LDOUSB 0x04 1765#define PALMAS_ENABLE2_LDO_ASSIGN2_LDOUSB 0x04
1766#define PALMAS_ENABLE2_LDO_ASSIGN2_LDOUSB_SHIFT 2 1766#define PALMAS_ENABLE2_LDO_ASSIGN2_LDOUSB_SHIFT 0x02
1767#define PALMAS_ENABLE2_LDO_ASSIGN2_LDOLN 0x02 1767#define PALMAS_ENABLE2_LDO_ASSIGN2_LDOLN 0x02
1768#define PALMAS_ENABLE2_LDO_ASSIGN2_LDOLN_SHIFT 1 1768#define PALMAS_ENABLE2_LDO_ASSIGN2_LDOLN_SHIFT 0x01
1769#define PALMAS_ENABLE2_LDO_ASSIGN2_LDO9 0x01 1769#define PALMAS_ENABLE2_LDO_ASSIGN2_LDO9 0x01
1770#define PALMAS_ENABLE2_LDO_ASSIGN2_LDO9_SHIFT 0 1770#define PALMAS_ENABLE2_LDO_ASSIGN2_LDO9_SHIFT 0x00
1771 1771
1772/* Bit definitions for REGEN3_CTRL */ 1772/* Bit definitions for REGEN3_CTRL */
1773#define PALMAS_REGEN3_CTRL_STATUS 0x10 1773#define PALMAS_REGEN3_CTRL_STATUS 0x10
1774#define PALMAS_REGEN3_CTRL_STATUS_SHIFT 4 1774#define PALMAS_REGEN3_CTRL_STATUS_SHIFT 0x04
1775#define PALMAS_REGEN3_CTRL_MODE_SLEEP 0x04 1775#define PALMAS_REGEN3_CTRL_MODE_SLEEP 0x04
1776#define PALMAS_REGEN3_CTRL_MODE_SLEEP_SHIFT 2 1776#define PALMAS_REGEN3_CTRL_MODE_SLEEP_SHIFT 0x02
1777#define PALMAS_REGEN3_CTRL_MODE_ACTIVE 0x01 1777#define PALMAS_REGEN3_CTRL_MODE_ACTIVE 0x01
1778#define PALMAS_REGEN3_CTRL_MODE_ACTIVE_SHIFT 0 1778#define PALMAS_REGEN3_CTRL_MODE_ACTIVE_SHIFT 0x00
1779 1779
1780/* Registers for function PAD_CONTROL */ 1780/* Registers for function PAD_CONTROL */
1781#define PALMAS_OD_OUTPUT_CTRL2 0x2 1781#define PALMAS_OD_OUTPUT_CTRL2 0x02
1782#define PALMAS_POLARITY_CTRL2 0x3 1782#define PALMAS_POLARITY_CTRL2 0x03
1783#define PALMAS_PU_PD_INPUT_CTRL1 0x4 1783#define PALMAS_PU_PD_INPUT_CTRL1 0x04
1784#define PALMAS_PU_PD_INPUT_CTRL2 0x5 1784#define PALMAS_PU_PD_INPUT_CTRL2 0x05
1785#define PALMAS_PU_PD_INPUT_CTRL3 0x6 1785#define PALMAS_PU_PD_INPUT_CTRL3 0x06
1786#define PALMAS_PU_PD_INPUT_CTRL5 0x7 1786#define PALMAS_PU_PD_INPUT_CTRL5 0x07
1787#define PALMAS_OD_OUTPUT_CTRL 0x8 1787#define PALMAS_OD_OUTPUT_CTRL 0x08
1788#define PALMAS_POLARITY_CTRL 0x9 1788#define PALMAS_POLARITY_CTRL 0x09
1789#define PALMAS_PRIMARY_SECONDARY_PAD1 0xA 1789#define PALMAS_PRIMARY_SECONDARY_PAD1 0x0A
1790#define PALMAS_PRIMARY_SECONDARY_PAD2 0xB 1790#define PALMAS_PRIMARY_SECONDARY_PAD2 0x0B
1791#define PALMAS_I2C_SPI 0xC 1791#define PALMAS_I2C_SPI 0x0C
1792#define PALMAS_PU_PD_INPUT_CTRL4 0xD 1792#define PALMAS_PU_PD_INPUT_CTRL4 0x0D
1793#define PALMAS_PRIMARY_SECONDARY_PAD3 0xE 1793#define PALMAS_PRIMARY_SECONDARY_PAD3 0x0E
1794#define PALMAS_PRIMARY_SECONDARY_PAD4 0xF 1794#define PALMAS_PRIMARY_SECONDARY_PAD4 0x0F
1795 1795
1796/* Bit definitions for PU_PD_INPUT_CTRL1 */ 1796/* Bit definitions for PU_PD_INPUT_CTRL1 */
1797#define PALMAS_PU_PD_INPUT_CTRL1_RESET_IN_PD 0x40 1797#define PALMAS_PU_PD_INPUT_CTRL1_RESET_IN_PD 0x40
1798#define PALMAS_PU_PD_INPUT_CTRL1_RESET_IN_PD_SHIFT 6 1798#define PALMAS_PU_PD_INPUT_CTRL1_RESET_IN_PD_SHIFT 0x06
1799#define PALMAS_PU_PD_INPUT_CTRL1_GPADC_START_PU 0x20 1799#define PALMAS_PU_PD_INPUT_CTRL1_GPADC_START_PU 0x20
1800#define PALMAS_PU_PD_INPUT_CTRL1_GPADC_START_PU_SHIFT 5 1800#define PALMAS_PU_PD_INPUT_CTRL1_GPADC_START_PU_SHIFT 0x05
1801#define PALMAS_PU_PD_INPUT_CTRL1_GPADC_START_PD 0x10 1801#define PALMAS_PU_PD_INPUT_CTRL1_GPADC_START_PD 0x10
1802#define PALMAS_PU_PD_INPUT_CTRL1_GPADC_START_PD_SHIFT 4 1802#define PALMAS_PU_PD_INPUT_CTRL1_GPADC_START_PD_SHIFT 0x04
1803#define PALMAS_PU_PD_INPUT_CTRL1_PWRDOWN_PD 0x04 1803#define PALMAS_PU_PD_INPUT_CTRL1_PWRDOWN_PD 0x04
1804#define PALMAS_PU_PD_INPUT_CTRL1_PWRDOWN_PD_SHIFT 2 1804#define PALMAS_PU_PD_INPUT_CTRL1_PWRDOWN_PD_SHIFT 0x02
1805#define PALMAS_PU_PD_INPUT_CTRL1_NRESWARM_PU 0x02 1805#define PALMAS_PU_PD_INPUT_CTRL1_NRESWARM_PU 0x02
1806#define PALMAS_PU_PD_INPUT_CTRL1_NRESWARM_PU_SHIFT 1 1806#define PALMAS_PU_PD_INPUT_CTRL1_NRESWARM_PU_SHIFT 0x01
1807 1807
1808/* Bit definitions for PU_PD_INPUT_CTRL2 */ 1808/* Bit definitions for PU_PD_INPUT_CTRL2 */
1809#define PALMAS_PU_PD_INPUT_CTRL2_ENABLE2_PU 0x20 1809#define PALMAS_PU_PD_INPUT_CTRL2_ENABLE2_PU 0x20
1810#define PALMAS_PU_PD_INPUT_CTRL2_ENABLE2_PU_SHIFT 5 1810#define PALMAS_PU_PD_INPUT_CTRL2_ENABLE2_PU_SHIFT 0x05
1811#define PALMAS_PU_PD_INPUT_CTRL2_ENABLE2_PD 0x10 1811#define PALMAS_PU_PD_INPUT_CTRL2_ENABLE2_PD 0x10
1812#define PALMAS_PU_PD_INPUT_CTRL2_ENABLE2_PD_SHIFT 4 1812#define PALMAS_PU_PD_INPUT_CTRL2_ENABLE2_PD_SHIFT 0x04
1813#define PALMAS_PU_PD_INPUT_CTRL2_ENABLE1_PU 0x08 1813#define PALMAS_PU_PD_INPUT_CTRL2_ENABLE1_PU 0x08
1814#define PALMAS_PU_PD_INPUT_CTRL2_ENABLE1_PU_SHIFT 3 1814#define PALMAS_PU_PD_INPUT_CTRL2_ENABLE1_PU_SHIFT 0x03
1815#define PALMAS_PU_PD_INPUT_CTRL2_ENABLE1_PD 0x04 1815#define PALMAS_PU_PD_INPUT_CTRL2_ENABLE1_PD 0x04
1816#define PALMAS_PU_PD_INPUT_CTRL2_ENABLE1_PD_SHIFT 2 1816#define PALMAS_PU_PD_INPUT_CTRL2_ENABLE1_PD_SHIFT 0x02
1817#define PALMAS_PU_PD_INPUT_CTRL2_NSLEEP_PU 0x02 1817#define PALMAS_PU_PD_INPUT_CTRL2_NSLEEP_PU 0x02
1818#define PALMAS_PU_PD_INPUT_CTRL2_NSLEEP_PU_SHIFT 1 1818#define PALMAS_PU_PD_INPUT_CTRL2_NSLEEP_PU_SHIFT 0x01
1819#define PALMAS_PU_PD_INPUT_CTRL2_NSLEEP_PD 0x01 1819#define PALMAS_PU_PD_INPUT_CTRL2_NSLEEP_PD 0x01
1820#define PALMAS_PU_PD_INPUT_CTRL2_NSLEEP_PD_SHIFT 0 1820#define PALMAS_PU_PD_INPUT_CTRL2_NSLEEP_PD_SHIFT 0x00
1821 1821
1822/* Bit definitions for PU_PD_INPUT_CTRL3 */ 1822/* Bit definitions for PU_PD_INPUT_CTRL3 */
1823#define PALMAS_PU_PD_INPUT_CTRL3_ACOK_PD 0x40 1823#define PALMAS_PU_PD_INPUT_CTRL3_ACOK_PD 0x40
1824#define PALMAS_PU_PD_INPUT_CTRL3_ACOK_PD_SHIFT 6 1824#define PALMAS_PU_PD_INPUT_CTRL3_ACOK_PD_SHIFT 0x06
1825#define PALMAS_PU_PD_INPUT_CTRL3_CHRG_DET_N_PD 0x10 1825#define PALMAS_PU_PD_INPUT_CTRL3_CHRG_DET_N_PD 0x10
1826#define PALMAS_PU_PD_INPUT_CTRL3_CHRG_DET_N_PD_SHIFT 4 1826#define PALMAS_PU_PD_INPUT_CTRL3_CHRG_DET_N_PD_SHIFT 0x04
1827#define PALMAS_PU_PD_INPUT_CTRL3_POWERHOLD_PD 0x04 1827#define PALMAS_PU_PD_INPUT_CTRL3_POWERHOLD_PD 0x04
1828#define PALMAS_PU_PD_INPUT_CTRL3_POWERHOLD_PD_SHIFT 2 1828#define PALMAS_PU_PD_INPUT_CTRL3_POWERHOLD_PD_SHIFT 0x02
1829#define PALMAS_PU_PD_INPUT_CTRL3_MSECURE_PD 0x01 1829#define PALMAS_PU_PD_INPUT_CTRL3_MSECURE_PD 0x01
1830#define PALMAS_PU_PD_INPUT_CTRL3_MSECURE_PD_SHIFT 0 1830#define PALMAS_PU_PD_INPUT_CTRL3_MSECURE_PD_SHIFT 0x00
1831 1831
1832/* Bit definitions for OD_OUTPUT_CTRL */ 1832/* Bit definitions for OD_OUTPUT_CTRL */
1833#define PALMAS_OD_OUTPUT_CTRL_PWM_2_OD 0x80 1833#define PALMAS_OD_OUTPUT_CTRL_PWM_2_OD 0x80
1834#define PALMAS_OD_OUTPUT_CTRL_PWM_2_OD_SHIFT 7 1834#define PALMAS_OD_OUTPUT_CTRL_PWM_2_OD_SHIFT 0x07
1835#define PALMAS_OD_OUTPUT_CTRL_VBUSDET_OD 0x40 1835#define PALMAS_OD_OUTPUT_CTRL_VBUSDET_OD 0x40
1836#define PALMAS_OD_OUTPUT_CTRL_VBUSDET_OD_SHIFT 6 1836#define PALMAS_OD_OUTPUT_CTRL_VBUSDET_OD_SHIFT 0x06
1837#define PALMAS_OD_OUTPUT_CTRL_PWM_1_OD 0x20 1837#define PALMAS_OD_OUTPUT_CTRL_PWM_1_OD 0x20
1838#define PALMAS_OD_OUTPUT_CTRL_PWM_1_OD_SHIFT 5 1838#define PALMAS_OD_OUTPUT_CTRL_PWM_1_OD_SHIFT 0x05
1839#define PALMAS_OD_OUTPUT_CTRL_INT_OD 0x08 1839#define PALMAS_OD_OUTPUT_CTRL_INT_OD 0x08
1840#define PALMAS_OD_OUTPUT_CTRL_INT_OD_SHIFT 3 1840#define PALMAS_OD_OUTPUT_CTRL_INT_OD_SHIFT 0x03
1841 1841
1842/* Bit definitions for POLARITY_CTRL */ 1842/* Bit definitions for POLARITY_CTRL */
1843#define PALMAS_POLARITY_CTRL_INT_POLARITY 0x80 1843#define PALMAS_POLARITY_CTRL_INT_POLARITY 0x80
1844#define PALMAS_POLARITY_CTRL_INT_POLARITY_SHIFT 7 1844#define PALMAS_POLARITY_CTRL_INT_POLARITY_SHIFT 0x07
1845#define PALMAS_POLARITY_CTRL_ENABLE2_POLARITY 0x40 1845#define PALMAS_POLARITY_CTRL_ENABLE2_POLARITY 0x40
1846#define PALMAS_POLARITY_CTRL_ENABLE2_POLARITY_SHIFT 6 1846#define PALMAS_POLARITY_CTRL_ENABLE2_POLARITY_SHIFT 0x06
1847#define PALMAS_POLARITY_CTRL_ENABLE1_POLARITY 0x20 1847#define PALMAS_POLARITY_CTRL_ENABLE1_POLARITY 0x20
1848#define PALMAS_POLARITY_CTRL_ENABLE1_POLARITY_SHIFT 5 1848#define PALMAS_POLARITY_CTRL_ENABLE1_POLARITY_SHIFT 0x05
1849#define PALMAS_POLARITY_CTRL_NSLEEP_POLARITY 0x10 1849#define PALMAS_POLARITY_CTRL_NSLEEP_POLARITY 0x10
1850#define PALMAS_POLARITY_CTRL_NSLEEP_POLARITY_SHIFT 4 1850#define PALMAS_POLARITY_CTRL_NSLEEP_POLARITY_SHIFT 0x04
1851#define PALMAS_POLARITY_CTRL_RESET_IN_POLARITY 0x08 1851#define PALMAS_POLARITY_CTRL_RESET_IN_POLARITY 0x08
1852#define PALMAS_POLARITY_CTRL_RESET_IN_POLARITY_SHIFT 3 1852#define PALMAS_POLARITY_CTRL_RESET_IN_POLARITY_SHIFT 0x03
1853#define PALMAS_POLARITY_CTRL_GPIO_3_CHRG_DET_N_POLARITY 0x04 1853#define PALMAS_POLARITY_CTRL_GPIO_3_CHRG_DET_N_POLARITY 0x04
1854#define PALMAS_POLARITY_CTRL_GPIO_3_CHRG_DET_N_POLARITY_SHIFT 2 1854#define PALMAS_POLARITY_CTRL_GPIO_3_CHRG_DET_N_POLARITY_SHIFT 0x02
1855#define PALMAS_POLARITY_CTRL_POWERGOOD_USB_PSEL_POLARITY 0x02 1855#define PALMAS_POLARITY_CTRL_POWERGOOD_USB_PSEL_POLARITY 0x02
1856#define PALMAS_POLARITY_CTRL_POWERGOOD_USB_PSEL_POLARITY_SHIFT 1 1856#define PALMAS_POLARITY_CTRL_POWERGOOD_USB_PSEL_POLARITY_SHIFT 0x01
1857#define PALMAS_POLARITY_CTRL_PWRDOWN_POLARITY 0x01 1857#define PALMAS_POLARITY_CTRL_PWRDOWN_POLARITY 0x01
1858#define PALMAS_POLARITY_CTRL_PWRDOWN_POLARITY_SHIFT 0 1858#define PALMAS_POLARITY_CTRL_PWRDOWN_POLARITY_SHIFT 0x00
1859 1859
1860/* Bit definitions for PRIMARY_SECONDARY_PAD1 */ 1860/* Bit definitions for PRIMARY_SECONDARY_PAD1 */
1861#define PALMAS_PRIMARY_SECONDARY_PAD1_GPIO_3 0x80 1861#define PALMAS_PRIMARY_SECONDARY_PAD1_GPIO_3 0x80
1862#define PALMAS_PRIMARY_SECONDARY_PAD1_GPIO_3_SHIFT 7 1862#define PALMAS_PRIMARY_SECONDARY_PAD1_GPIO_3_SHIFT 0x07
1863#define PALMAS_PRIMARY_SECONDARY_PAD1_GPIO_2_MASK 0x60 1863#define PALMAS_PRIMARY_SECONDARY_PAD1_GPIO_2_MASK 0x60
1864#define PALMAS_PRIMARY_SECONDARY_PAD1_GPIO_2_SHIFT 5 1864#define PALMAS_PRIMARY_SECONDARY_PAD1_GPIO_2_SHIFT 0x05
1865#define PALMAS_PRIMARY_SECONDARY_PAD1_GPIO_1_MASK 0x18 1865#define PALMAS_PRIMARY_SECONDARY_PAD1_GPIO_1_MASK 0x18
1866#define PALMAS_PRIMARY_SECONDARY_PAD1_GPIO_1_SHIFT 3 1866#define PALMAS_PRIMARY_SECONDARY_PAD1_GPIO_1_SHIFT 0x03
1867#define PALMAS_PRIMARY_SECONDARY_PAD1_GPIO_0 0x04 1867#define PALMAS_PRIMARY_SECONDARY_PAD1_GPIO_0 0x04
1868#define PALMAS_PRIMARY_SECONDARY_PAD1_GPIO_0_SHIFT 2 1868#define PALMAS_PRIMARY_SECONDARY_PAD1_GPIO_0_SHIFT 0x02
1869#define PALMAS_PRIMARY_SECONDARY_PAD1_VAC 0x02 1869#define PALMAS_PRIMARY_SECONDARY_PAD1_VAC 0x02
1870#define PALMAS_PRIMARY_SECONDARY_PAD1_VAC_SHIFT 1 1870#define PALMAS_PRIMARY_SECONDARY_PAD1_VAC_SHIFT 0x01
1871#define PALMAS_PRIMARY_SECONDARY_PAD1_POWERGOOD 0x01 1871#define PALMAS_PRIMARY_SECONDARY_PAD1_POWERGOOD 0x01
1872#define PALMAS_PRIMARY_SECONDARY_PAD1_POWERGOOD_SHIFT 0 1872#define PALMAS_PRIMARY_SECONDARY_PAD1_POWERGOOD_SHIFT 0x00
1873 1873
1874/* Bit definitions for PRIMARY_SECONDARY_PAD2 */ 1874/* Bit definitions for PRIMARY_SECONDARY_PAD2 */
1875#define PALMAS_PRIMARY_SECONDARY_PAD2_GPIO_7_MASK 0x30 1875#define PALMAS_PRIMARY_SECONDARY_PAD2_GPIO_7_MASK 0x30
1876#define PALMAS_PRIMARY_SECONDARY_PAD2_GPIO_7_SHIFT 4 1876#define PALMAS_PRIMARY_SECONDARY_PAD2_GPIO_7_SHIFT 0x04
1877#define PALMAS_PRIMARY_SECONDARY_PAD2_GPIO_6 0x08 1877#define PALMAS_PRIMARY_SECONDARY_PAD2_GPIO_6 0x08
1878#define PALMAS_PRIMARY_SECONDARY_PAD2_GPIO_6_SHIFT 3 1878#define PALMAS_PRIMARY_SECONDARY_PAD2_GPIO_6_SHIFT 0x03
1879#define PALMAS_PRIMARY_SECONDARY_PAD2_GPIO_5_MASK 0x06 1879#define PALMAS_PRIMARY_SECONDARY_PAD2_GPIO_5_MASK 0x06
1880#define PALMAS_PRIMARY_SECONDARY_PAD2_GPIO_5_SHIFT 1 1880#define PALMAS_PRIMARY_SECONDARY_PAD2_GPIO_5_SHIFT 0x01
1881#define PALMAS_PRIMARY_SECONDARY_PAD2_GPIO_4 0x01 1881#define PALMAS_PRIMARY_SECONDARY_PAD2_GPIO_4 0x01
1882#define PALMAS_PRIMARY_SECONDARY_PAD2_GPIO_4_SHIFT 0 1882#define PALMAS_PRIMARY_SECONDARY_PAD2_GPIO_4_SHIFT 0x00
1883 1883
1884/* Bit definitions for I2C_SPI */ 1884/* Bit definitions for I2C_SPI */
1885#define PALMAS_I2C_SPI_I2C2OTP_EN 0x80 1885#define PALMAS_I2C_SPI_I2C2OTP_EN 0x80
1886#define PALMAS_I2C_SPI_I2C2OTP_EN_SHIFT 7 1886#define PALMAS_I2C_SPI_I2C2OTP_EN_SHIFT 0x07
1887#define PALMAS_I2C_SPI_I2C2OTP_PAGESEL 0x40 1887#define PALMAS_I2C_SPI_I2C2OTP_PAGESEL 0x40
1888#define PALMAS_I2C_SPI_I2C2OTP_PAGESEL_SHIFT 6 1888#define PALMAS_I2C_SPI_I2C2OTP_PAGESEL_SHIFT 0x06
1889#define PALMAS_I2C_SPI_ID_I2C2 0x20 1889#define PALMAS_I2C_SPI_ID_I2C2 0x20
1890#define PALMAS_I2C_SPI_ID_I2C2_SHIFT 5 1890#define PALMAS_I2C_SPI_ID_I2C2_SHIFT 0x05
1891#define PALMAS_I2C_SPI_I2C_SPI 0x10 1891#define PALMAS_I2C_SPI_I2C_SPI 0x10
1892#define PALMAS_I2C_SPI_I2C_SPI_SHIFT 4 1892#define PALMAS_I2C_SPI_I2C_SPI_SHIFT 0x04
1893#define PALMAS_I2C_SPI_ID_I2C1_MASK 0x0f 1893#define PALMAS_I2C_SPI_ID_I2C1_MASK 0x0F
1894#define PALMAS_I2C_SPI_ID_I2C1_SHIFT 0 1894#define PALMAS_I2C_SPI_ID_I2C1_SHIFT 0x00
1895 1895
1896/* Bit definitions for PU_PD_INPUT_CTRL4 */ 1896/* Bit definitions for PU_PD_INPUT_CTRL4 */
1897#define PALMAS_PU_PD_INPUT_CTRL4_DVFS2_DAT_PD 0x40 1897#define PALMAS_PU_PD_INPUT_CTRL4_DVFS2_DAT_PD 0x40
1898#define PALMAS_PU_PD_INPUT_CTRL4_DVFS2_DAT_PD_SHIFT 6 1898#define PALMAS_PU_PD_INPUT_CTRL4_DVFS2_DAT_PD_SHIFT 0x06
1899#define PALMAS_PU_PD_INPUT_CTRL4_DVFS2_CLK_PD 0x10 1899#define PALMAS_PU_PD_INPUT_CTRL4_DVFS2_CLK_PD 0x10
1900#define PALMAS_PU_PD_INPUT_CTRL4_DVFS2_CLK_PD_SHIFT 4 1900#define PALMAS_PU_PD_INPUT_CTRL4_DVFS2_CLK_PD_SHIFT 0x04
1901#define PALMAS_PU_PD_INPUT_CTRL4_DVFS1_DAT_PD 0x04 1901#define PALMAS_PU_PD_INPUT_CTRL4_DVFS1_DAT_PD 0x04
1902#define PALMAS_PU_PD_INPUT_CTRL4_DVFS1_DAT_PD_SHIFT 2 1902#define PALMAS_PU_PD_INPUT_CTRL4_DVFS1_DAT_PD_SHIFT 0x02
1903#define PALMAS_PU_PD_INPUT_CTRL4_DVFS1_CLK_PD 0x01 1903#define PALMAS_PU_PD_INPUT_CTRL4_DVFS1_CLK_PD 0x01
1904#define PALMAS_PU_PD_INPUT_CTRL4_DVFS1_CLK_PD_SHIFT 0 1904#define PALMAS_PU_PD_INPUT_CTRL4_DVFS1_CLK_PD_SHIFT 0x00
1905 1905
1906/* Bit definitions for PRIMARY_SECONDARY_PAD3 */ 1906/* Bit definitions for PRIMARY_SECONDARY_PAD3 */
1907#define PALMAS_PRIMARY_SECONDARY_PAD3_DVFS2 0x02 1907#define PALMAS_PRIMARY_SECONDARY_PAD3_DVFS2 0x02
1908#define PALMAS_PRIMARY_SECONDARY_PAD3_DVFS2_SHIFT 1 1908#define PALMAS_PRIMARY_SECONDARY_PAD3_DVFS2_SHIFT 0x01
1909#define PALMAS_PRIMARY_SECONDARY_PAD3_DVFS1 0x01 1909#define PALMAS_PRIMARY_SECONDARY_PAD3_DVFS1 0x01
1910#define PALMAS_PRIMARY_SECONDARY_PAD3_DVFS1_SHIFT 0 1910#define PALMAS_PRIMARY_SECONDARY_PAD3_DVFS1_SHIFT 0x00
1911 1911
1912/* Registers for function LED_PWM */ 1912/* Registers for function LED_PWM */
1913#define PALMAS_LED_PERIOD_CTRL 0x0 1913#define PALMAS_LED_PERIOD_CTRL 0x00
1914#define PALMAS_LED_CTRL 0x1 1914#define PALMAS_LED_CTRL 0x01
1915#define PALMAS_PWM_CTRL1 0x2 1915#define PALMAS_PWM_CTRL1 0x02
1916#define PALMAS_PWM_CTRL2 0x3 1916#define PALMAS_PWM_CTRL2 0x03
1917 1917
1918/* Bit definitions for LED_PERIOD_CTRL */ 1918/* Bit definitions for LED_PERIOD_CTRL */
1919#define PALMAS_LED_PERIOD_CTRL_LED_2_PERIOD_MASK 0x38 1919#define PALMAS_LED_PERIOD_CTRL_LED_2_PERIOD_MASK 0x38
1920#define PALMAS_LED_PERIOD_CTRL_LED_2_PERIOD_SHIFT 3 1920#define PALMAS_LED_PERIOD_CTRL_LED_2_PERIOD_SHIFT 0x03
1921#define PALMAS_LED_PERIOD_CTRL_LED_1_PERIOD_MASK 0x07 1921#define PALMAS_LED_PERIOD_CTRL_LED_1_PERIOD_MASK 0x07
1922#define PALMAS_LED_PERIOD_CTRL_LED_1_PERIOD_SHIFT 0 1922#define PALMAS_LED_PERIOD_CTRL_LED_1_PERIOD_SHIFT 0x00
1923 1923
1924/* Bit definitions for LED_CTRL */ 1924/* Bit definitions for LED_CTRL */
1925#define PALMAS_LED_CTRL_LED_2_SEQ 0x20 1925#define PALMAS_LED_CTRL_LED_2_SEQ 0x20
1926#define PALMAS_LED_CTRL_LED_2_SEQ_SHIFT 5 1926#define PALMAS_LED_CTRL_LED_2_SEQ_SHIFT 0x05
1927#define PALMAS_LED_CTRL_LED_1_SEQ 0x10 1927#define PALMAS_LED_CTRL_LED_1_SEQ 0x10
1928#define PALMAS_LED_CTRL_LED_1_SEQ_SHIFT 4 1928#define PALMAS_LED_CTRL_LED_1_SEQ_SHIFT 0x04
1929#define PALMAS_LED_CTRL_LED_2_ON_TIME_MASK 0x0c 1929#define PALMAS_LED_CTRL_LED_2_ON_TIME_MASK 0x0c
1930#define PALMAS_LED_CTRL_LED_2_ON_TIME_SHIFT 2 1930#define PALMAS_LED_CTRL_LED_2_ON_TIME_SHIFT 0x02
1931#define PALMAS_LED_CTRL_LED_1_ON_TIME_MASK 0x03 1931#define PALMAS_LED_CTRL_LED_1_ON_TIME_MASK 0x03
1932#define PALMAS_LED_CTRL_LED_1_ON_TIME_SHIFT 0 1932#define PALMAS_LED_CTRL_LED_1_ON_TIME_SHIFT 0x00
1933 1933
1934/* Bit definitions for PWM_CTRL1 */ 1934/* Bit definitions for PWM_CTRL1 */
1935#define PALMAS_PWM_CTRL1_PWM_FREQ_EN 0x02 1935#define PALMAS_PWM_CTRL1_PWM_FREQ_EN 0x02
1936#define PALMAS_PWM_CTRL1_PWM_FREQ_EN_SHIFT 1 1936#define PALMAS_PWM_CTRL1_PWM_FREQ_EN_SHIFT 0x01
1937#define PALMAS_PWM_CTRL1_PWM_FREQ_SEL 0x01 1937#define PALMAS_PWM_CTRL1_PWM_FREQ_SEL 0x01
1938#define PALMAS_PWM_CTRL1_PWM_FREQ_SEL_SHIFT 0 1938#define PALMAS_PWM_CTRL1_PWM_FREQ_SEL_SHIFT 0x00
1939 1939
1940/* Bit definitions for PWM_CTRL2 */ 1940/* Bit definitions for PWM_CTRL2 */
1941#define PALMAS_PWM_CTRL2_PWM_DUTY_SEL_MASK 0xff 1941#define PALMAS_PWM_CTRL2_PWM_DUTY_SEL_MASK 0xFF
1942#define PALMAS_PWM_CTRL2_PWM_DUTY_SEL_SHIFT 0 1942#define PALMAS_PWM_CTRL2_PWM_DUTY_SEL_SHIFT 0x00
1943 1943
1944/* Registers for function INTERRUPT */ 1944/* Registers for function INTERRUPT */
1945#define PALMAS_INT1_STATUS 0x0 1945#define PALMAS_INT1_STATUS 0x00
1946#define PALMAS_INT1_MASK 0x1 1946#define PALMAS_INT1_MASK 0x01
1947#define PALMAS_INT1_LINE_STATE 0x2 1947#define PALMAS_INT1_LINE_STATE 0x02
1948#define PALMAS_INT1_EDGE_DETECT1_RESERVED 0x3 1948#define PALMAS_INT1_EDGE_DETECT1_RESERVED 0x03
1949#define PALMAS_INT1_EDGE_DETECT2_RESERVED 0x4 1949#define PALMAS_INT1_EDGE_DETECT2_RESERVED 0x04
1950#define PALMAS_INT2_STATUS 0x5 1950#define PALMAS_INT2_STATUS 0x05
1951#define PALMAS_INT2_MASK 0x6 1951#define PALMAS_INT2_MASK 0x06
1952#define PALMAS_INT2_LINE_STATE 0x7 1952#define PALMAS_INT2_LINE_STATE 0x07
1953#define PALMAS_INT2_EDGE_DETECT1_RESERVED 0x8 1953#define PALMAS_INT2_EDGE_DETECT1_RESERVED 0x08
1954#define PALMAS_INT2_EDGE_DETECT2_RESERVED 0x9 1954#define PALMAS_INT2_EDGE_DETECT2_RESERVED 0x09
1955#define PALMAS_INT3_STATUS 0xA 1955#define PALMAS_INT3_STATUS 0x0A
1956#define PALMAS_INT3_MASK 0xB 1956#define PALMAS_INT3_MASK 0x0B
1957#define PALMAS_INT3_LINE_STATE 0xC 1957#define PALMAS_INT3_LINE_STATE 0x0C
1958#define PALMAS_INT3_EDGE_DETECT1_RESERVED 0xD 1958#define PALMAS_INT3_EDGE_DETECT1_RESERVED 0x0D
1959#define PALMAS_INT3_EDGE_DETECT2_RESERVED 0xE 1959#define PALMAS_INT3_EDGE_DETECT2_RESERVED 0x0E
1960#define PALMAS_INT4_STATUS 0xF 1960#define PALMAS_INT4_STATUS 0x0F
1961#define PALMAS_INT4_MASK 0x10 1961#define PALMAS_INT4_MASK 0x10
1962#define PALMAS_INT4_LINE_STATE 0x11 1962#define PALMAS_INT4_LINE_STATE 0x11
1963#define PALMAS_INT4_EDGE_DETECT1 0x12 1963#define PALMAS_INT4_EDGE_DETECT1 0x12
@@ -1966,276 +1966,276 @@ enum usb_irq_events {
1966 1966
1967/* Bit definitions for INT1_STATUS */ 1967/* Bit definitions for INT1_STATUS */
1968#define PALMAS_INT1_STATUS_VBAT_MON 0x80 1968#define PALMAS_INT1_STATUS_VBAT_MON 0x80
1969#define PALMAS_INT1_STATUS_VBAT_MON_SHIFT 7 1969#define PALMAS_INT1_STATUS_VBAT_MON_SHIFT 0x07
1970#define PALMAS_INT1_STATUS_VSYS_MON 0x40 1970#define PALMAS_INT1_STATUS_VSYS_MON 0x40
1971#define PALMAS_INT1_STATUS_VSYS_MON_SHIFT 6 1971#define PALMAS_INT1_STATUS_VSYS_MON_SHIFT 0x06
1972#define PALMAS_INT1_STATUS_HOTDIE 0x20 1972#define PALMAS_INT1_STATUS_HOTDIE 0x20
1973#define PALMAS_INT1_STATUS_HOTDIE_SHIFT 5 1973#define PALMAS_INT1_STATUS_HOTDIE_SHIFT 0x05
1974#define PALMAS_INT1_STATUS_PWRDOWN 0x10 1974#define PALMAS_INT1_STATUS_PWRDOWN 0x10
1975#define PALMAS_INT1_STATUS_PWRDOWN_SHIFT 4 1975#define PALMAS_INT1_STATUS_PWRDOWN_SHIFT 0x04
1976#define PALMAS_INT1_STATUS_RPWRON 0x08 1976#define PALMAS_INT1_STATUS_RPWRON 0x08
1977#define PALMAS_INT1_STATUS_RPWRON_SHIFT 3 1977#define PALMAS_INT1_STATUS_RPWRON_SHIFT 0x03
1978#define PALMAS_INT1_STATUS_LONG_PRESS_KEY 0x04 1978#define PALMAS_INT1_STATUS_LONG_PRESS_KEY 0x04
1979#define PALMAS_INT1_STATUS_LONG_PRESS_KEY_SHIFT 2 1979#define PALMAS_INT1_STATUS_LONG_PRESS_KEY_SHIFT 0x02
1980#define PALMAS_INT1_STATUS_PWRON 0x02 1980#define PALMAS_INT1_STATUS_PWRON 0x02
1981#define PALMAS_INT1_STATUS_PWRON_SHIFT 1 1981#define PALMAS_INT1_STATUS_PWRON_SHIFT 0x01
1982#define PALMAS_INT1_STATUS_CHARG_DET_N_VBUS_OVV 0x01 1982#define PALMAS_INT1_STATUS_CHARG_DET_N_VBUS_OVV 0x01
1983#define PALMAS_INT1_STATUS_CHARG_DET_N_VBUS_OVV_SHIFT 0 1983#define PALMAS_INT1_STATUS_CHARG_DET_N_VBUS_OVV_SHIFT 0x00
1984 1984
1985/* Bit definitions for INT1_MASK */ 1985/* Bit definitions for INT1_MASK */
1986#define PALMAS_INT1_MASK_VBAT_MON 0x80 1986#define PALMAS_INT1_MASK_VBAT_MON 0x80
1987#define PALMAS_INT1_MASK_VBAT_MON_SHIFT 7 1987#define PALMAS_INT1_MASK_VBAT_MON_SHIFT 0x07
1988#define PALMAS_INT1_MASK_VSYS_MON 0x40 1988#define PALMAS_INT1_MASK_VSYS_MON 0x40
1989#define PALMAS_INT1_MASK_VSYS_MON_SHIFT 6 1989#define PALMAS_INT1_MASK_VSYS_MON_SHIFT 0x06
1990#define PALMAS_INT1_MASK_HOTDIE 0x20 1990#define PALMAS_INT1_MASK_HOTDIE 0x20
1991#define PALMAS_INT1_MASK_HOTDIE_SHIFT 5 1991#define PALMAS_INT1_MASK_HOTDIE_SHIFT 0x05
1992#define PALMAS_INT1_MASK_PWRDOWN 0x10 1992#define PALMAS_INT1_MASK_PWRDOWN 0x10
1993#define PALMAS_INT1_MASK_PWRDOWN_SHIFT 4 1993#define PALMAS_INT1_MASK_PWRDOWN_SHIFT 0x04
1994#define PALMAS_INT1_MASK_RPWRON 0x08 1994#define PALMAS_INT1_MASK_RPWRON 0x08
1995#define PALMAS_INT1_MASK_RPWRON_SHIFT 3 1995#define PALMAS_INT1_MASK_RPWRON_SHIFT 0x03
1996#define PALMAS_INT1_MASK_LONG_PRESS_KEY 0x04 1996#define PALMAS_INT1_MASK_LONG_PRESS_KEY 0x04
1997#define PALMAS_INT1_MASK_LONG_PRESS_KEY_SHIFT 2 1997#define PALMAS_INT1_MASK_LONG_PRESS_KEY_SHIFT 0x02
1998#define PALMAS_INT1_MASK_PWRON 0x02 1998#define PALMAS_INT1_MASK_PWRON 0x02
1999#define PALMAS_INT1_MASK_PWRON_SHIFT 1 1999#define PALMAS_INT1_MASK_PWRON_SHIFT 0x01
2000#define PALMAS_INT1_MASK_CHARG_DET_N_VBUS_OVV 0x01 2000#define PALMAS_INT1_MASK_CHARG_DET_N_VBUS_OVV 0x01
2001#define PALMAS_INT1_MASK_CHARG_DET_N_VBUS_OVV_SHIFT 0 2001#define PALMAS_INT1_MASK_CHARG_DET_N_VBUS_OVV_SHIFT 0x00
2002 2002
2003/* Bit definitions for INT1_LINE_STATE */ 2003/* Bit definitions for INT1_LINE_STATE */
2004#define PALMAS_INT1_LINE_STATE_VBAT_MON 0x80 2004#define PALMAS_INT1_LINE_STATE_VBAT_MON 0x80
2005#define PALMAS_INT1_LINE_STATE_VBAT_MON_SHIFT 7 2005#define PALMAS_INT1_LINE_STATE_VBAT_MON_SHIFT 0x07
2006#define PALMAS_INT1_LINE_STATE_VSYS_MON 0x40 2006#define PALMAS_INT1_LINE_STATE_VSYS_MON 0x40
2007#define PALMAS_INT1_LINE_STATE_VSYS_MON_SHIFT 6 2007#define PALMAS_INT1_LINE_STATE_VSYS_MON_SHIFT 0x06
2008#define PALMAS_INT1_LINE_STATE_HOTDIE 0x20 2008#define PALMAS_INT1_LINE_STATE_HOTDIE 0x20
2009#define PALMAS_INT1_LINE_STATE_HOTDIE_SHIFT 5 2009#define PALMAS_INT1_LINE_STATE_HOTDIE_SHIFT 0x05
2010#define PALMAS_INT1_LINE_STATE_PWRDOWN 0x10 2010#define PALMAS_INT1_LINE_STATE_PWRDOWN 0x10
2011#define PALMAS_INT1_LINE_STATE_PWRDOWN_SHIFT 4 2011#define PALMAS_INT1_LINE_STATE_PWRDOWN_SHIFT 0x04
2012#define PALMAS_INT1_LINE_STATE_RPWRON 0x08 2012#define PALMAS_INT1_LINE_STATE_RPWRON 0x08
2013#define PALMAS_INT1_LINE_STATE_RPWRON_SHIFT 3 2013#define PALMAS_INT1_LINE_STATE_RPWRON_SHIFT 0x03
2014#define PALMAS_INT1_LINE_STATE_LONG_PRESS_KEY 0x04 2014#define PALMAS_INT1_LINE_STATE_LONG_PRESS_KEY 0x04
2015#define PALMAS_INT1_LINE_STATE_LONG_PRESS_KEY_SHIFT 2 2015#define PALMAS_INT1_LINE_STATE_LONG_PRESS_KEY_SHIFT 0x02
2016#define PALMAS_INT1_LINE_STATE_PWRON 0x02 2016#define PALMAS_INT1_LINE_STATE_PWRON 0x02
2017#define PALMAS_INT1_LINE_STATE_PWRON_SHIFT 1 2017#define PALMAS_INT1_LINE_STATE_PWRON_SHIFT 0x01
2018#define PALMAS_INT1_LINE_STATE_CHARG_DET_N_VBUS_OVV 0x01 2018#define PALMAS_INT1_LINE_STATE_CHARG_DET_N_VBUS_OVV 0x01
2019#define PALMAS_INT1_LINE_STATE_CHARG_DET_N_VBUS_OVV_SHIFT 0 2019#define PALMAS_INT1_LINE_STATE_CHARG_DET_N_VBUS_OVV_SHIFT 0x00
2020 2020
2021/* Bit definitions for INT2_STATUS */ 2021/* Bit definitions for INT2_STATUS */
2022#define PALMAS_INT2_STATUS_VAC_ACOK 0x80 2022#define PALMAS_INT2_STATUS_VAC_ACOK 0x80
2023#define PALMAS_INT2_STATUS_VAC_ACOK_SHIFT 7 2023#define PALMAS_INT2_STATUS_VAC_ACOK_SHIFT 0x07
2024#define PALMAS_INT2_STATUS_SHORT 0x40 2024#define PALMAS_INT2_STATUS_SHORT 0x40
2025#define PALMAS_INT2_STATUS_SHORT_SHIFT 6 2025#define PALMAS_INT2_STATUS_SHORT_SHIFT 0x06
2026#define PALMAS_INT2_STATUS_FBI_BB 0x20 2026#define PALMAS_INT2_STATUS_FBI_BB 0x20
2027#define PALMAS_INT2_STATUS_FBI_BB_SHIFT 5 2027#define PALMAS_INT2_STATUS_FBI_BB_SHIFT 0x05
2028#define PALMAS_INT2_STATUS_RESET_IN 0x10 2028#define PALMAS_INT2_STATUS_RESET_IN 0x10
2029#define PALMAS_INT2_STATUS_RESET_IN_SHIFT 4 2029#define PALMAS_INT2_STATUS_RESET_IN_SHIFT 0x04
2030#define PALMAS_INT2_STATUS_BATREMOVAL 0x08 2030#define PALMAS_INT2_STATUS_BATREMOVAL 0x08
2031#define PALMAS_INT2_STATUS_BATREMOVAL_SHIFT 3 2031#define PALMAS_INT2_STATUS_BATREMOVAL_SHIFT 0x03
2032#define PALMAS_INT2_STATUS_WDT 0x04 2032#define PALMAS_INT2_STATUS_WDT 0x04
2033#define PALMAS_INT2_STATUS_WDT_SHIFT 2 2033#define PALMAS_INT2_STATUS_WDT_SHIFT 0x02
2034#define PALMAS_INT2_STATUS_RTC_TIMER 0x02 2034#define PALMAS_INT2_STATUS_RTC_TIMER 0x02
2035#define PALMAS_INT2_STATUS_RTC_TIMER_SHIFT 1 2035#define PALMAS_INT2_STATUS_RTC_TIMER_SHIFT 0x01
2036#define PALMAS_INT2_STATUS_RTC_ALARM 0x01 2036#define PALMAS_INT2_STATUS_RTC_ALARM 0x01
2037#define PALMAS_INT2_STATUS_RTC_ALARM_SHIFT 0 2037#define PALMAS_INT2_STATUS_RTC_ALARM_SHIFT 0x00
2038 2038
2039/* Bit definitions for INT2_MASK */ 2039/* Bit definitions for INT2_MASK */
2040#define PALMAS_INT2_MASK_VAC_ACOK 0x80 2040#define PALMAS_INT2_MASK_VAC_ACOK 0x80
2041#define PALMAS_INT2_MASK_VAC_ACOK_SHIFT 7 2041#define PALMAS_INT2_MASK_VAC_ACOK_SHIFT 0x07
2042#define PALMAS_INT2_MASK_SHORT 0x40 2042#define PALMAS_INT2_MASK_SHORT 0x40
2043#define PALMAS_INT2_MASK_SHORT_SHIFT 6 2043#define PALMAS_INT2_MASK_SHORT_SHIFT 0x06
2044#define PALMAS_INT2_MASK_FBI_BB 0x20 2044#define PALMAS_INT2_MASK_FBI_BB 0x20
2045#define PALMAS_INT2_MASK_FBI_BB_SHIFT 5 2045#define PALMAS_INT2_MASK_FBI_BB_SHIFT 0x05
2046#define PALMAS_INT2_MASK_RESET_IN 0x10 2046#define PALMAS_INT2_MASK_RESET_IN 0x10
2047#define PALMAS_INT2_MASK_RESET_IN_SHIFT 4 2047#define PALMAS_INT2_MASK_RESET_IN_SHIFT 0x04
2048#define PALMAS_INT2_MASK_BATREMOVAL 0x08 2048#define PALMAS_INT2_MASK_BATREMOVAL 0x08
2049#define PALMAS_INT2_MASK_BATREMOVAL_SHIFT 3 2049#define PALMAS_INT2_MASK_BATREMOVAL_SHIFT 0x03
2050#define PALMAS_INT2_MASK_WDT 0x04 2050#define PALMAS_INT2_MASK_WDT 0x04
2051#define PALMAS_INT2_MASK_WDT_SHIFT 2 2051#define PALMAS_INT2_MASK_WDT_SHIFT 0x02
2052#define PALMAS_INT2_MASK_RTC_TIMER 0x02 2052#define PALMAS_INT2_MASK_RTC_TIMER 0x02
2053#define PALMAS_INT2_MASK_RTC_TIMER_SHIFT 1 2053#define PALMAS_INT2_MASK_RTC_TIMER_SHIFT 0x01
2054#define PALMAS_INT2_MASK_RTC_ALARM 0x01 2054#define PALMAS_INT2_MASK_RTC_ALARM 0x01
2055#define PALMAS_INT2_MASK_RTC_ALARM_SHIFT 0 2055#define PALMAS_INT2_MASK_RTC_ALARM_SHIFT 0x00
2056 2056
2057/* Bit definitions for INT2_LINE_STATE */ 2057/* Bit definitions for INT2_LINE_STATE */
2058#define PALMAS_INT2_LINE_STATE_VAC_ACOK 0x80 2058#define PALMAS_INT2_LINE_STATE_VAC_ACOK 0x80
2059#define PALMAS_INT2_LINE_STATE_VAC_ACOK_SHIFT 7 2059#define PALMAS_INT2_LINE_STATE_VAC_ACOK_SHIFT 0x07
2060#define PALMAS_INT2_LINE_STATE_SHORT 0x40 2060#define PALMAS_INT2_LINE_STATE_SHORT 0x40
2061#define PALMAS_INT2_LINE_STATE_SHORT_SHIFT 6 2061#define PALMAS_INT2_LINE_STATE_SHORT_SHIFT 0x06
2062#define PALMAS_INT2_LINE_STATE_FBI_BB 0x20 2062#define PALMAS_INT2_LINE_STATE_FBI_BB 0x20
2063#define PALMAS_INT2_LINE_STATE_FBI_BB_SHIFT 5 2063#define PALMAS_INT2_LINE_STATE_FBI_BB_SHIFT 0x05
2064#define PALMAS_INT2_LINE_STATE_RESET_IN 0x10 2064#define PALMAS_INT2_LINE_STATE_RESET_IN 0x10
2065#define PALMAS_INT2_LINE_STATE_RESET_IN_SHIFT 4 2065#define PALMAS_INT2_LINE_STATE_RESET_IN_SHIFT 0x04
2066#define PALMAS_INT2_LINE_STATE_BATREMOVAL 0x08 2066#define PALMAS_INT2_LINE_STATE_BATREMOVAL 0x08
2067#define PALMAS_INT2_LINE_STATE_BATREMOVAL_SHIFT 3 2067#define PALMAS_INT2_LINE_STATE_BATREMOVAL_SHIFT 0x03
2068#define PALMAS_INT2_LINE_STATE_WDT 0x04 2068#define PALMAS_INT2_LINE_STATE_WDT 0x04
2069#define PALMAS_INT2_LINE_STATE_WDT_SHIFT 2 2069#define PALMAS_INT2_LINE_STATE_WDT_SHIFT 0x02
2070#define PALMAS_INT2_LINE_STATE_RTC_TIMER 0x02 2070#define PALMAS_INT2_LINE_STATE_RTC_TIMER 0x02
2071#define PALMAS_INT2_LINE_STATE_RTC_TIMER_SHIFT 1 2071#define PALMAS_INT2_LINE_STATE_RTC_TIMER_SHIFT 0x01
2072#define PALMAS_INT2_LINE_STATE_RTC_ALARM 0x01 2072#define PALMAS_INT2_LINE_STATE_RTC_ALARM 0x01
2073#define PALMAS_INT2_LINE_STATE_RTC_ALARM_SHIFT 0 2073#define PALMAS_INT2_LINE_STATE_RTC_ALARM_SHIFT 0x00
2074 2074
2075/* Bit definitions for INT3_STATUS */ 2075/* Bit definitions for INT3_STATUS */
2076#define PALMAS_INT3_STATUS_VBUS 0x80 2076#define PALMAS_INT3_STATUS_VBUS 0x80
2077#define PALMAS_INT3_STATUS_VBUS_SHIFT 7 2077#define PALMAS_INT3_STATUS_VBUS_SHIFT 0x07
2078#define PALMAS_INT3_STATUS_VBUS_OTG 0x40 2078#define PALMAS_INT3_STATUS_VBUS_OTG 0x40
2079#define PALMAS_INT3_STATUS_VBUS_OTG_SHIFT 6 2079#define PALMAS_INT3_STATUS_VBUS_OTG_SHIFT 0x06
2080#define PALMAS_INT3_STATUS_ID 0x20 2080#define PALMAS_INT3_STATUS_ID 0x20
2081#define PALMAS_INT3_STATUS_ID_SHIFT 5 2081#define PALMAS_INT3_STATUS_ID_SHIFT 0x05
2082#define PALMAS_INT3_STATUS_ID_OTG 0x10 2082#define PALMAS_INT3_STATUS_ID_OTG 0x10
2083#define PALMAS_INT3_STATUS_ID_OTG_SHIFT 4 2083#define PALMAS_INT3_STATUS_ID_OTG_SHIFT 0x04
2084#define PALMAS_INT3_STATUS_GPADC_EOC_RT 0x08 2084#define PALMAS_INT3_STATUS_GPADC_EOC_RT 0x08
2085#define PALMAS_INT3_STATUS_GPADC_EOC_RT_SHIFT 3 2085#define PALMAS_INT3_STATUS_GPADC_EOC_RT_SHIFT 0x03
2086#define PALMAS_INT3_STATUS_GPADC_EOC_SW 0x04 2086#define PALMAS_INT3_STATUS_GPADC_EOC_SW 0x04
2087#define PALMAS_INT3_STATUS_GPADC_EOC_SW_SHIFT 2 2087#define PALMAS_INT3_STATUS_GPADC_EOC_SW_SHIFT 0x02
2088#define PALMAS_INT3_STATUS_GPADC_AUTO_1 0x02 2088#define PALMAS_INT3_STATUS_GPADC_AUTO_1 0x02
2089#define PALMAS_INT3_STATUS_GPADC_AUTO_1_SHIFT 1 2089#define PALMAS_INT3_STATUS_GPADC_AUTO_1_SHIFT 0x01
2090#define PALMAS_INT3_STATUS_GPADC_AUTO_0 0x01 2090#define PALMAS_INT3_STATUS_GPADC_AUTO_0 0x01
2091#define PALMAS_INT3_STATUS_GPADC_AUTO_0_SHIFT 0 2091#define PALMAS_INT3_STATUS_GPADC_AUTO_0_SHIFT 0x00
2092 2092
2093/* Bit definitions for INT3_MASK */ 2093/* Bit definitions for INT3_MASK */
2094#define PALMAS_INT3_MASK_VBUS 0x80 2094#define PALMAS_INT3_MASK_VBUS 0x80
2095#define PALMAS_INT3_MASK_VBUS_SHIFT 7 2095#define PALMAS_INT3_MASK_VBUS_SHIFT 0x07
2096#define PALMAS_INT3_MASK_VBUS_OTG 0x40 2096#define PALMAS_INT3_MASK_VBUS_OTG 0x40
2097#define PALMAS_INT3_MASK_VBUS_OTG_SHIFT 6 2097#define PALMAS_INT3_MASK_VBUS_OTG_SHIFT 0x06
2098#define PALMAS_INT3_MASK_ID 0x20 2098#define PALMAS_INT3_MASK_ID 0x20
2099#define PALMAS_INT3_MASK_ID_SHIFT 5 2099#define PALMAS_INT3_MASK_ID_SHIFT 0x05
2100#define PALMAS_INT3_MASK_ID_OTG 0x10 2100#define PALMAS_INT3_MASK_ID_OTG 0x10
2101#define PALMAS_INT3_MASK_ID_OTG_SHIFT 4 2101#define PALMAS_INT3_MASK_ID_OTG_SHIFT 0x04
2102#define PALMAS_INT3_MASK_GPADC_EOC_RT 0x08 2102#define PALMAS_INT3_MASK_GPADC_EOC_RT 0x08
2103#define PALMAS_INT3_MASK_GPADC_EOC_RT_SHIFT 3 2103#define PALMAS_INT3_MASK_GPADC_EOC_RT_SHIFT 0x03
2104#define PALMAS_INT3_MASK_GPADC_EOC_SW 0x04 2104#define PALMAS_INT3_MASK_GPADC_EOC_SW 0x04
2105#define PALMAS_INT3_MASK_GPADC_EOC_SW_SHIFT 2 2105#define PALMAS_INT3_MASK_GPADC_EOC_SW_SHIFT 0x02
2106#define PALMAS_INT3_MASK_GPADC_AUTO_1 0x02 2106#define PALMAS_INT3_MASK_GPADC_AUTO_1 0x02
2107#define PALMAS_INT3_MASK_GPADC_AUTO_1_SHIFT 1 2107#define PALMAS_INT3_MASK_GPADC_AUTO_1_SHIFT 0x01
2108#define PALMAS_INT3_MASK_GPADC_AUTO_0 0x01 2108#define PALMAS_INT3_MASK_GPADC_AUTO_0 0x01
2109#define PALMAS_INT3_MASK_GPADC_AUTO_0_SHIFT 0 2109#define PALMAS_INT3_MASK_GPADC_AUTO_0_SHIFT 0x00
2110 2110
2111/* Bit definitions for INT3_LINE_STATE */ 2111/* Bit definitions for INT3_LINE_STATE */
2112#define PALMAS_INT3_LINE_STATE_VBUS 0x80 2112#define PALMAS_INT3_LINE_STATE_VBUS 0x80
2113#define PALMAS_INT3_LINE_STATE_VBUS_SHIFT 7 2113#define PALMAS_INT3_LINE_STATE_VBUS_SHIFT 0x07
2114#define PALMAS_INT3_LINE_STATE_VBUS_OTG 0x40 2114#define PALMAS_INT3_LINE_STATE_VBUS_OTG 0x40
2115#define PALMAS_INT3_LINE_STATE_VBUS_OTG_SHIFT 6 2115#define PALMAS_INT3_LINE_STATE_VBUS_OTG_SHIFT 0x06
2116#define PALMAS_INT3_LINE_STATE_ID 0x20 2116#define PALMAS_INT3_LINE_STATE_ID 0x20
2117#define PALMAS_INT3_LINE_STATE_ID_SHIFT 5 2117#define PALMAS_INT3_LINE_STATE_ID_SHIFT 0x05
2118#define PALMAS_INT3_LINE_STATE_ID_OTG 0x10 2118#define PALMAS_INT3_LINE_STATE_ID_OTG 0x10
2119#define PALMAS_INT3_LINE_STATE_ID_OTG_SHIFT 4 2119#define PALMAS_INT3_LINE_STATE_ID_OTG_SHIFT 0x04
2120#define PALMAS_INT3_LINE_STATE_GPADC_EOC_RT 0x08 2120#define PALMAS_INT3_LINE_STATE_GPADC_EOC_RT 0x08
2121#define PALMAS_INT3_LINE_STATE_GPADC_EOC_RT_SHIFT 3 2121#define PALMAS_INT3_LINE_STATE_GPADC_EOC_RT_SHIFT 0x03
2122#define PALMAS_INT3_LINE_STATE_GPADC_EOC_SW 0x04 2122#define PALMAS_INT3_LINE_STATE_GPADC_EOC_SW 0x04
2123#define PALMAS_INT3_LINE_STATE_GPADC_EOC_SW_SHIFT 2 2123#define PALMAS_INT3_LINE_STATE_GPADC_EOC_SW_SHIFT 0x02
2124#define PALMAS_INT3_LINE_STATE_GPADC_AUTO_1 0x02 2124#define PALMAS_INT3_LINE_STATE_GPADC_AUTO_1 0x02
2125#define PALMAS_INT3_LINE_STATE_GPADC_AUTO_1_SHIFT 1 2125#define PALMAS_INT3_LINE_STATE_GPADC_AUTO_1_SHIFT 0x01
2126#define PALMAS_INT3_LINE_STATE_GPADC_AUTO_0 0x01 2126#define PALMAS_INT3_LINE_STATE_GPADC_AUTO_0 0x01
2127#define PALMAS_INT3_LINE_STATE_GPADC_AUTO_0_SHIFT 0 2127#define PALMAS_INT3_LINE_STATE_GPADC_AUTO_0_SHIFT 0x00
2128 2128
2129/* Bit definitions for INT4_STATUS */ 2129/* Bit definitions for INT4_STATUS */
2130#define PALMAS_INT4_STATUS_GPIO_7 0x80 2130#define PALMAS_INT4_STATUS_GPIO_7 0x80
2131#define PALMAS_INT4_STATUS_GPIO_7_SHIFT 7 2131#define PALMAS_INT4_STATUS_GPIO_7_SHIFT 0x07
2132#define PALMAS_INT4_STATUS_GPIO_6 0x40 2132#define PALMAS_INT4_STATUS_GPIO_6 0x40
2133#define PALMAS_INT4_STATUS_GPIO_6_SHIFT 6 2133#define PALMAS_INT4_STATUS_GPIO_6_SHIFT 0x06
2134#define PALMAS_INT4_STATUS_GPIO_5 0x20 2134#define PALMAS_INT4_STATUS_GPIO_5 0x20
2135#define PALMAS_INT4_STATUS_GPIO_5_SHIFT 5 2135#define PALMAS_INT4_STATUS_GPIO_5_SHIFT 0x05
2136#define PALMAS_INT4_STATUS_GPIO_4 0x10 2136#define PALMAS_INT4_STATUS_GPIO_4 0x10
2137#define PALMAS_INT4_STATUS_GPIO_4_SHIFT 4 2137#define PALMAS_INT4_STATUS_GPIO_4_SHIFT 0x04
2138#define PALMAS_INT4_STATUS_GPIO_3 0x08 2138#define PALMAS_INT4_STATUS_GPIO_3 0x08
2139#define PALMAS_INT4_STATUS_GPIO_3_SHIFT 3 2139#define PALMAS_INT4_STATUS_GPIO_3_SHIFT 0x03
2140#define PALMAS_INT4_STATUS_GPIO_2 0x04 2140#define PALMAS_INT4_STATUS_GPIO_2 0x04
2141#define PALMAS_INT4_STATUS_GPIO_2_SHIFT 2 2141#define PALMAS_INT4_STATUS_GPIO_2_SHIFT 0x02
2142#define PALMAS_INT4_STATUS_GPIO_1 0x02 2142#define PALMAS_INT4_STATUS_GPIO_1 0x02
2143#define PALMAS_INT4_STATUS_GPIO_1_SHIFT 1 2143#define PALMAS_INT4_STATUS_GPIO_1_SHIFT 0x01
2144#define PALMAS_INT4_STATUS_GPIO_0 0x01 2144#define PALMAS_INT4_STATUS_GPIO_0 0x01
2145#define PALMAS_INT4_STATUS_GPIO_0_SHIFT 0 2145#define PALMAS_INT4_STATUS_GPIO_0_SHIFT 0x00
2146 2146
2147/* Bit definitions for INT4_MASK */ 2147/* Bit definitions for INT4_MASK */
2148#define PALMAS_INT4_MASK_GPIO_7 0x80 2148#define PALMAS_INT4_MASK_GPIO_7 0x80
2149#define PALMAS_INT4_MASK_GPIO_7_SHIFT 7 2149#define PALMAS_INT4_MASK_GPIO_7_SHIFT 0x07
2150#define PALMAS_INT4_MASK_GPIO_6 0x40 2150#define PALMAS_INT4_MASK_GPIO_6 0x40
2151#define PALMAS_INT4_MASK_GPIO_6_SHIFT 6 2151#define PALMAS_INT4_MASK_GPIO_6_SHIFT 0x06
2152#define PALMAS_INT4_MASK_GPIO_5 0x20 2152#define PALMAS_INT4_MASK_GPIO_5 0x20
2153#define PALMAS_INT4_MASK_GPIO_5_SHIFT 5 2153#define PALMAS_INT4_MASK_GPIO_5_SHIFT 0x05
2154#define PALMAS_INT4_MASK_GPIO_4 0x10 2154#define PALMAS_INT4_MASK_GPIO_4 0x10
2155#define PALMAS_INT4_MASK_GPIO_4_SHIFT 4 2155#define PALMAS_INT4_MASK_GPIO_4_SHIFT 0x04
2156#define PALMAS_INT4_MASK_GPIO_3 0x08 2156#define PALMAS_INT4_MASK_GPIO_3 0x08
2157#define PALMAS_INT4_MASK_GPIO_3_SHIFT 3 2157#define PALMAS_INT4_MASK_GPIO_3_SHIFT 0x03
2158#define PALMAS_INT4_MASK_GPIO_2 0x04 2158#define PALMAS_INT4_MASK_GPIO_2 0x04
2159#define PALMAS_INT4_MASK_GPIO_2_SHIFT 2 2159#define PALMAS_INT4_MASK_GPIO_2_SHIFT 0x02
2160#define PALMAS_INT4_MASK_GPIO_1 0x02 2160#define PALMAS_INT4_MASK_GPIO_1 0x02
2161#define PALMAS_INT4_MASK_GPIO_1_SHIFT 1 2161#define PALMAS_INT4_MASK_GPIO_1_SHIFT 0x01
2162#define PALMAS_INT4_MASK_GPIO_0 0x01 2162#define PALMAS_INT4_MASK_GPIO_0 0x01
2163#define PALMAS_INT4_MASK_GPIO_0_SHIFT 0 2163#define PALMAS_INT4_MASK_GPIO_0_SHIFT 0x00
2164 2164
2165/* Bit definitions for INT4_LINE_STATE */ 2165/* Bit definitions for INT4_LINE_STATE */
2166#define PALMAS_INT4_LINE_STATE_GPIO_7 0x80 2166#define PALMAS_INT4_LINE_STATE_GPIO_7 0x80
2167#define PALMAS_INT4_LINE_STATE_GPIO_7_SHIFT 7 2167#define PALMAS_INT4_LINE_STATE_GPIO_7_SHIFT 0x07
2168#define PALMAS_INT4_LINE_STATE_GPIO_6 0x40 2168#define PALMAS_INT4_LINE_STATE_GPIO_6 0x40
2169#define PALMAS_INT4_LINE_STATE_GPIO_6_SHIFT 6 2169#define PALMAS_INT4_LINE_STATE_GPIO_6_SHIFT 0x06
2170#define PALMAS_INT4_LINE_STATE_GPIO_5 0x20 2170#define PALMAS_INT4_LINE_STATE_GPIO_5 0x20
2171#define PALMAS_INT4_LINE_STATE_GPIO_5_SHIFT 5 2171#define PALMAS_INT4_LINE_STATE_GPIO_5_SHIFT 0x05
2172#define PALMAS_INT4_LINE_STATE_GPIO_4 0x10 2172#define PALMAS_INT4_LINE_STATE_GPIO_4 0x10
2173#define PALMAS_INT4_LINE_STATE_GPIO_4_SHIFT 4 2173#define PALMAS_INT4_LINE_STATE_GPIO_4_SHIFT 0x04
2174#define PALMAS_INT4_LINE_STATE_GPIO_3 0x08 2174#define PALMAS_INT4_LINE_STATE_GPIO_3 0x08
2175#define PALMAS_INT4_LINE_STATE_GPIO_3_SHIFT 3 2175#define PALMAS_INT4_LINE_STATE_GPIO_3_SHIFT 0x03
2176#define PALMAS_INT4_LINE_STATE_GPIO_2 0x04 2176#define PALMAS_INT4_LINE_STATE_GPIO_2 0x04
2177#define PALMAS_INT4_LINE_STATE_GPIO_2_SHIFT 2 2177#define PALMAS_INT4_LINE_STATE_GPIO_2_SHIFT 0x02
2178#define PALMAS_INT4_LINE_STATE_GPIO_1 0x02 2178#define PALMAS_INT4_LINE_STATE_GPIO_1 0x02
2179#define PALMAS_INT4_LINE_STATE_GPIO_1_SHIFT 1 2179#define PALMAS_INT4_LINE_STATE_GPIO_1_SHIFT 0x01
2180#define PALMAS_INT4_LINE_STATE_GPIO_0 0x01 2180#define PALMAS_INT4_LINE_STATE_GPIO_0 0x01
2181#define PALMAS_INT4_LINE_STATE_GPIO_0_SHIFT 0 2181#define PALMAS_INT4_LINE_STATE_GPIO_0_SHIFT 0x00
2182 2182
2183/* Bit definitions for INT4_EDGE_DETECT1 */ 2183/* Bit definitions for INT4_EDGE_DETECT1 */
2184#define PALMAS_INT4_EDGE_DETECT1_GPIO_3_RISING 0x80 2184#define PALMAS_INT4_EDGE_DETECT1_GPIO_3_RISING 0x80
2185#define PALMAS_INT4_EDGE_DETECT1_GPIO_3_RISING_SHIFT 7 2185#define PALMAS_INT4_EDGE_DETECT1_GPIO_3_RISING_SHIFT 0x07
2186#define PALMAS_INT4_EDGE_DETECT1_GPIO_3_FALLING 0x40 2186#define PALMAS_INT4_EDGE_DETECT1_GPIO_3_FALLING 0x40
2187#define PALMAS_INT4_EDGE_DETECT1_GPIO_3_FALLING_SHIFT 6 2187#define PALMAS_INT4_EDGE_DETECT1_GPIO_3_FALLING_SHIFT 0x06
2188#define PALMAS_INT4_EDGE_DETECT1_GPIO_2_RISING 0x20 2188#define PALMAS_INT4_EDGE_DETECT1_GPIO_2_RISING 0x20
2189#define PALMAS_INT4_EDGE_DETECT1_GPIO_2_RISING_SHIFT 5 2189#define PALMAS_INT4_EDGE_DETECT1_GPIO_2_RISING_SHIFT 0x05
2190#define PALMAS_INT4_EDGE_DETECT1_GPIO_2_FALLING 0x10 2190#define PALMAS_INT4_EDGE_DETECT1_GPIO_2_FALLING 0x10
2191#define PALMAS_INT4_EDGE_DETECT1_GPIO_2_FALLING_SHIFT 4 2191#define PALMAS_INT4_EDGE_DETECT1_GPIO_2_FALLING_SHIFT 0x04
2192#define PALMAS_INT4_EDGE_DETECT1_GPIO_1_RISING 0x08 2192#define PALMAS_INT4_EDGE_DETECT1_GPIO_1_RISING 0x08
2193#define PALMAS_INT4_EDGE_DETECT1_GPIO_1_RISING_SHIFT 3 2193#define PALMAS_INT4_EDGE_DETECT1_GPIO_1_RISING_SHIFT 0x03
2194#define PALMAS_INT4_EDGE_DETECT1_GPIO_1_FALLING 0x04 2194#define PALMAS_INT4_EDGE_DETECT1_GPIO_1_FALLING 0x04
2195#define PALMAS_INT4_EDGE_DETECT1_GPIO_1_FALLING_SHIFT 2 2195#define PALMAS_INT4_EDGE_DETECT1_GPIO_1_FALLING_SHIFT 0x02
2196#define PALMAS_INT4_EDGE_DETECT1_GPIO_0_RISING 0x02 2196#define PALMAS_INT4_EDGE_DETECT1_GPIO_0_RISING 0x02
2197#define PALMAS_INT4_EDGE_DETECT1_GPIO_0_RISING_SHIFT 1 2197#define PALMAS_INT4_EDGE_DETECT1_GPIO_0_RISING_SHIFT 0x01
2198#define PALMAS_INT4_EDGE_DETECT1_GPIO_0_FALLING 0x01 2198#define PALMAS_INT4_EDGE_DETECT1_GPIO_0_FALLING 0x01
2199#define PALMAS_INT4_EDGE_DETECT1_GPIO_0_FALLING_SHIFT 0 2199#define PALMAS_INT4_EDGE_DETECT1_GPIO_0_FALLING_SHIFT 0x00
2200 2200
2201/* Bit definitions for INT4_EDGE_DETECT2 */ 2201/* Bit definitions for INT4_EDGE_DETECT2 */
2202#define PALMAS_INT4_EDGE_DETECT2_GPIO_7_RISING 0x80 2202#define PALMAS_INT4_EDGE_DETECT2_GPIO_7_RISING 0x80
2203#define PALMAS_INT4_EDGE_DETECT2_GPIO_7_RISING_SHIFT 7 2203#define PALMAS_INT4_EDGE_DETECT2_GPIO_7_RISING_SHIFT 0x07
2204#define PALMAS_INT4_EDGE_DETECT2_GPIO_7_FALLING 0x40 2204#define PALMAS_INT4_EDGE_DETECT2_GPIO_7_FALLING 0x40
2205#define PALMAS_INT4_EDGE_DETECT2_GPIO_7_FALLING_SHIFT 6 2205#define PALMAS_INT4_EDGE_DETECT2_GPIO_7_FALLING_SHIFT 0x06
2206#define PALMAS_INT4_EDGE_DETECT2_GPIO_6_RISING 0x20 2206#define PALMAS_INT4_EDGE_DETECT2_GPIO_6_RISING 0x20
2207#define PALMAS_INT4_EDGE_DETECT2_GPIO_6_RISING_SHIFT 5 2207#define PALMAS_INT4_EDGE_DETECT2_GPIO_6_RISING_SHIFT 0x05
2208#define PALMAS_INT4_EDGE_DETECT2_GPIO_6_FALLING 0x10 2208#define PALMAS_INT4_EDGE_DETECT2_GPIO_6_FALLING 0x10
2209#define PALMAS_INT4_EDGE_DETECT2_GPIO_6_FALLING_SHIFT 4 2209#define PALMAS_INT4_EDGE_DETECT2_GPIO_6_FALLING_SHIFT 0x04
2210#define PALMAS_INT4_EDGE_DETECT2_GPIO_5_RISING 0x08 2210#define PALMAS_INT4_EDGE_DETECT2_GPIO_5_RISING 0x08
2211#define PALMAS_INT4_EDGE_DETECT2_GPIO_5_RISING_SHIFT 3 2211#define PALMAS_INT4_EDGE_DETECT2_GPIO_5_RISING_SHIFT 0x03
2212#define PALMAS_INT4_EDGE_DETECT2_GPIO_5_FALLING 0x04 2212#define PALMAS_INT4_EDGE_DETECT2_GPIO_5_FALLING 0x04
2213#define PALMAS_INT4_EDGE_DETECT2_GPIO_5_FALLING_SHIFT 2 2213#define PALMAS_INT4_EDGE_DETECT2_GPIO_5_FALLING_SHIFT 0x02
2214#define PALMAS_INT4_EDGE_DETECT2_GPIO_4_RISING 0x02 2214#define PALMAS_INT4_EDGE_DETECT2_GPIO_4_RISING 0x02
2215#define PALMAS_INT4_EDGE_DETECT2_GPIO_4_RISING_SHIFT 1 2215#define PALMAS_INT4_EDGE_DETECT2_GPIO_4_RISING_SHIFT 0x01
2216#define PALMAS_INT4_EDGE_DETECT2_GPIO_4_FALLING 0x01 2216#define PALMAS_INT4_EDGE_DETECT2_GPIO_4_FALLING 0x01
2217#define PALMAS_INT4_EDGE_DETECT2_GPIO_4_FALLING_SHIFT 0 2217#define PALMAS_INT4_EDGE_DETECT2_GPIO_4_FALLING_SHIFT 0x00
2218 2218
2219/* Bit definitions for INT_CTRL */ 2219/* Bit definitions for INT_CTRL */
2220#define PALMAS_INT_CTRL_INT_PENDING 0x04 2220#define PALMAS_INT_CTRL_INT_PENDING 0x04
2221#define PALMAS_INT_CTRL_INT_PENDING_SHIFT 2 2221#define PALMAS_INT_CTRL_INT_PENDING_SHIFT 0x02
2222#define PALMAS_INT_CTRL_INT_CLEAR 0x01 2222#define PALMAS_INT_CTRL_INT_CLEAR 0x01
2223#define PALMAS_INT_CTRL_INT_CLEAR_SHIFT 0 2223#define PALMAS_INT_CTRL_INT_CLEAR_SHIFT 0x00
2224 2224
2225/* Registers for function USB_OTG */ 2225/* Registers for function USB_OTG */
2226#define PALMAS_USB_WAKEUP 0x3 2226#define PALMAS_USB_WAKEUP 0x03
2227#define PALMAS_USB_VBUS_CTRL_SET 0x4 2227#define PALMAS_USB_VBUS_CTRL_SET 0x04
2228#define PALMAS_USB_VBUS_CTRL_CLR 0x5 2228#define PALMAS_USB_VBUS_CTRL_CLR 0x05
2229#define PALMAS_USB_ID_CTRL_SET 0x6 2229#define PALMAS_USB_ID_CTRL_SET 0x06
2230#define PALMAS_USB_ID_CTRL_CLEAR 0x7 2230#define PALMAS_USB_ID_CTRL_CLEAR 0x07
2231#define PALMAS_USB_VBUS_INT_SRC 0x8 2231#define PALMAS_USB_VBUS_INT_SRC 0x08
2232#define PALMAS_USB_VBUS_INT_LATCH_SET 0x9 2232#define PALMAS_USB_VBUS_INT_LATCH_SET 0x09
2233#define PALMAS_USB_VBUS_INT_LATCH_CLR 0xA 2233#define PALMAS_USB_VBUS_INT_LATCH_CLR 0x0A
2234#define PALMAS_USB_VBUS_INT_EN_LO_SET 0xB 2234#define PALMAS_USB_VBUS_INT_EN_LO_SET 0x0B
2235#define PALMAS_USB_VBUS_INT_EN_LO_CLR 0xC 2235#define PALMAS_USB_VBUS_INT_EN_LO_CLR 0x0C
2236#define PALMAS_USB_VBUS_INT_EN_HI_SET 0xD 2236#define PALMAS_USB_VBUS_INT_EN_HI_SET 0x0D
2237#define PALMAS_USB_VBUS_INT_EN_HI_CLR 0xE 2237#define PALMAS_USB_VBUS_INT_EN_HI_CLR 0x0E
2238#define PALMAS_USB_ID_INT_SRC 0xF 2238#define PALMAS_USB_ID_INT_SRC 0x0F
2239#define PALMAS_USB_ID_INT_LATCH_SET 0x10 2239#define PALMAS_USB_ID_INT_LATCH_SET 0x10
2240#define PALMAS_USB_ID_INT_LATCH_CLR 0x11 2240#define PALMAS_USB_ID_INT_LATCH_CLR 0x11
2241#define PALMAS_USB_ID_INT_EN_LO_SET 0x12 2241#define PALMAS_USB_ID_INT_EN_LO_SET 0x12
@@ -2250,306 +2250,306 @@ enum usb_irq_events {
2250 2250
2251/* Bit definitions for USB_WAKEUP */ 2251/* Bit definitions for USB_WAKEUP */
2252#define PALMAS_USB_WAKEUP_ID_WK_UP_COMP 0x01 2252#define PALMAS_USB_WAKEUP_ID_WK_UP_COMP 0x01
2253#define PALMAS_USB_WAKEUP_ID_WK_UP_COMP_SHIFT 0 2253#define PALMAS_USB_WAKEUP_ID_WK_UP_COMP_SHIFT 0x00
2254 2254
2255/* Bit definitions for USB_VBUS_CTRL_SET */ 2255/* Bit definitions for USB_VBUS_CTRL_SET */
2256#define PALMAS_USB_VBUS_CTRL_SET_VBUS_CHRG_VSYS 0x80 2256#define PALMAS_USB_VBUS_CTRL_SET_VBUS_CHRG_VSYS 0x80
2257#define PALMAS_USB_VBUS_CTRL_SET_VBUS_CHRG_VSYS_SHIFT 7 2257#define PALMAS_USB_VBUS_CTRL_SET_VBUS_CHRG_VSYS_SHIFT 0x07
2258#define PALMAS_USB_VBUS_CTRL_SET_VBUS_DISCHRG 0x20 2258#define PALMAS_USB_VBUS_CTRL_SET_VBUS_DISCHRG 0x20
2259#define PALMAS_USB_VBUS_CTRL_SET_VBUS_DISCHRG_SHIFT 5 2259#define PALMAS_USB_VBUS_CTRL_SET_VBUS_DISCHRG_SHIFT 0x05
2260#define PALMAS_USB_VBUS_CTRL_SET_VBUS_IADP_SRC 0x10 2260#define PALMAS_USB_VBUS_CTRL_SET_VBUS_IADP_SRC 0x10
2261#define PALMAS_USB_VBUS_CTRL_SET_VBUS_IADP_SRC_SHIFT 4 2261#define PALMAS_USB_VBUS_CTRL_SET_VBUS_IADP_SRC_SHIFT 0x04
2262#define PALMAS_USB_VBUS_CTRL_SET_VBUS_IADP_SINK 0x08 2262#define PALMAS_USB_VBUS_CTRL_SET_VBUS_IADP_SINK 0x08
2263#define PALMAS_USB_VBUS_CTRL_SET_VBUS_IADP_SINK_SHIFT 3 2263#define PALMAS_USB_VBUS_CTRL_SET_VBUS_IADP_SINK_SHIFT 0x03
2264#define PALMAS_USB_VBUS_CTRL_SET_VBUS_ACT_COMP 0x04 2264#define PALMAS_USB_VBUS_CTRL_SET_VBUS_ACT_COMP 0x04
2265#define PALMAS_USB_VBUS_CTRL_SET_VBUS_ACT_COMP_SHIFT 2 2265#define PALMAS_USB_VBUS_CTRL_SET_VBUS_ACT_COMP_SHIFT 0x02
2266 2266
2267/* Bit definitions for USB_VBUS_CTRL_CLR */ 2267/* Bit definitions for USB_VBUS_CTRL_CLR */
2268#define PALMAS_USB_VBUS_CTRL_CLR_VBUS_CHRG_VSYS 0x80 2268#define PALMAS_USB_VBUS_CTRL_CLR_VBUS_CHRG_VSYS 0x80
2269#define PALMAS_USB_VBUS_CTRL_CLR_VBUS_CHRG_VSYS_SHIFT 7 2269#define PALMAS_USB_VBUS_CTRL_CLR_VBUS_CHRG_VSYS_SHIFT 0x07
2270#define PALMAS_USB_VBUS_CTRL_CLR_VBUS_DISCHRG 0x20 2270#define PALMAS_USB_VBUS_CTRL_CLR_VBUS_DISCHRG 0x20
2271#define PALMAS_USB_VBUS_CTRL_CLR_VBUS_DISCHRG_SHIFT 5 2271#define PALMAS_USB_VBUS_CTRL_CLR_VBUS_DISCHRG_SHIFT 0x05
2272#define PALMAS_USB_VBUS_CTRL_CLR_VBUS_IADP_SRC 0x10 2272#define PALMAS_USB_VBUS_CTRL_CLR_VBUS_IADP_SRC 0x10
2273#define PALMAS_USB_VBUS_CTRL_CLR_VBUS_IADP_SRC_SHIFT 4 2273#define PALMAS_USB_VBUS_CTRL_CLR_VBUS_IADP_SRC_SHIFT 0x04
2274#define PALMAS_USB_VBUS_CTRL_CLR_VBUS_IADP_SINK 0x08 2274#define PALMAS_USB_VBUS_CTRL_CLR_VBUS_IADP_SINK 0x08
2275#define PALMAS_USB_VBUS_CTRL_CLR_VBUS_IADP_SINK_SHIFT 3 2275#define PALMAS_USB_VBUS_CTRL_CLR_VBUS_IADP_SINK_SHIFT 0x03
2276#define PALMAS_USB_VBUS_CTRL_CLR_VBUS_ACT_COMP 0x04 2276#define PALMAS_USB_VBUS_CTRL_CLR_VBUS_ACT_COMP 0x04
2277#define PALMAS_USB_VBUS_CTRL_CLR_VBUS_ACT_COMP_SHIFT 2 2277#define PALMAS_USB_VBUS_CTRL_CLR_VBUS_ACT_COMP_SHIFT 0x02
2278 2278
2279/* Bit definitions for USB_ID_CTRL_SET */ 2279/* Bit definitions for USB_ID_CTRL_SET */
2280#define PALMAS_USB_ID_CTRL_SET_ID_PU_220K 0x80 2280#define PALMAS_USB_ID_CTRL_SET_ID_PU_220K 0x80
2281#define PALMAS_USB_ID_CTRL_SET_ID_PU_220K_SHIFT 7 2281#define PALMAS_USB_ID_CTRL_SET_ID_PU_220K_SHIFT 0x07
2282#define PALMAS_USB_ID_CTRL_SET_ID_PU_100K 0x40 2282#define PALMAS_USB_ID_CTRL_SET_ID_PU_100K 0x40
2283#define PALMAS_USB_ID_CTRL_SET_ID_PU_100K_SHIFT 6 2283#define PALMAS_USB_ID_CTRL_SET_ID_PU_100K_SHIFT 0x06
2284#define PALMAS_USB_ID_CTRL_SET_ID_GND_DRV 0x20 2284#define PALMAS_USB_ID_CTRL_SET_ID_GND_DRV 0x20
2285#define PALMAS_USB_ID_CTRL_SET_ID_GND_DRV_SHIFT 5 2285#define PALMAS_USB_ID_CTRL_SET_ID_GND_DRV_SHIFT 0x05
2286#define PALMAS_USB_ID_CTRL_SET_ID_SRC_16U 0x10 2286#define PALMAS_USB_ID_CTRL_SET_ID_SRC_16U 0x10
2287#define PALMAS_USB_ID_CTRL_SET_ID_SRC_16U_SHIFT 4 2287#define PALMAS_USB_ID_CTRL_SET_ID_SRC_16U_SHIFT 0x04
2288#define PALMAS_USB_ID_CTRL_SET_ID_SRC_5U 0x08 2288#define PALMAS_USB_ID_CTRL_SET_ID_SRC_5U 0x08
2289#define PALMAS_USB_ID_CTRL_SET_ID_SRC_5U_SHIFT 3 2289#define PALMAS_USB_ID_CTRL_SET_ID_SRC_5U_SHIFT 0x03
2290#define PALMAS_USB_ID_CTRL_SET_ID_ACT_COMP 0x04 2290#define PALMAS_USB_ID_CTRL_SET_ID_ACT_COMP 0x04
2291#define PALMAS_USB_ID_CTRL_SET_ID_ACT_COMP_SHIFT 2 2291#define PALMAS_USB_ID_CTRL_SET_ID_ACT_COMP_SHIFT 0x02
2292 2292
2293/* Bit definitions for USB_ID_CTRL_CLEAR */ 2293/* Bit definitions for USB_ID_CTRL_CLEAR */
2294#define PALMAS_USB_ID_CTRL_CLEAR_ID_PU_220K 0x80 2294#define PALMAS_USB_ID_CTRL_CLEAR_ID_PU_220K 0x80
2295#define PALMAS_USB_ID_CTRL_CLEAR_ID_PU_220K_SHIFT 7 2295#define PALMAS_USB_ID_CTRL_CLEAR_ID_PU_220K_SHIFT 0x07
2296#define PALMAS_USB_ID_CTRL_CLEAR_ID_PU_100K 0x40 2296#define PALMAS_USB_ID_CTRL_CLEAR_ID_PU_100K 0x40
2297#define PALMAS_USB_ID_CTRL_CLEAR_ID_PU_100K_SHIFT 6 2297#define PALMAS_USB_ID_CTRL_CLEAR_ID_PU_100K_SHIFT 0x06
2298#define PALMAS_USB_ID_CTRL_CLEAR_ID_GND_DRV 0x20 2298#define PALMAS_USB_ID_CTRL_CLEAR_ID_GND_DRV 0x20
2299#define PALMAS_USB_ID_CTRL_CLEAR_ID_GND_DRV_SHIFT 5 2299#define PALMAS_USB_ID_CTRL_CLEAR_ID_GND_DRV_SHIFT 0x05
2300#define PALMAS_USB_ID_CTRL_CLEAR_ID_SRC_16U 0x10 2300#define PALMAS_USB_ID_CTRL_CLEAR_ID_SRC_16U 0x10
2301#define PALMAS_USB_ID_CTRL_CLEAR_ID_SRC_16U_SHIFT 4 2301#define PALMAS_USB_ID_CTRL_CLEAR_ID_SRC_16U_SHIFT 0x04
2302#define PALMAS_USB_ID_CTRL_CLEAR_ID_SRC_5U 0x08 2302#define PALMAS_USB_ID_CTRL_CLEAR_ID_SRC_5U 0x08
2303#define PALMAS_USB_ID_CTRL_CLEAR_ID_SRC_5U_SHIFT 3 2303#define PALMAS_USB_ID_CTRL_CLEAR_ID_SRC_5U_SHIFT 0x03
2304#define PALMAS_USB_ID_CTRL_CLEAR_ID_ACT_COMP 0x04 2304#define PALMAS_USB_ID_CTRL_CLEAR_ID_ACT_COMP 0x04
2305#define PALMAS_USB_ID_CTRL_CLEAR_ID_ACT_COMP_SHIFT 2 2305#define PALMAS_USB_ID_CTRL_CLEAR_ID_ACT_COMP_SHIFT 0x02
2306 2306
2307/* Bit definitions for USB_VBUS_INT_SRC */ 2307/* Bit definitions for USB_VBUS_INT_SRC */
2308#define PALMAS_USB_VBUS_INT_SRC_VOTG_SESS_VLD 0x80 2308#define PALMAS_USB_VBUS_INT_SRC_VOTG_SESS_VLD 0x80
2309#define PALMAS_USB_VBUS_INT_SRC_VOTG_SESS_VLD_SHIFT 7 2309#define PALMAS_USB_VBUS_INT_SRC_VOTG_SESS_VLD_SHIFT 0x07
2310#define PALMAS_USB_VBUS_INT_SRC_VADP_PRB 0x40 2310#define PALMAS_USB_VBUS_INT_SRC_VADP_PRB 0x40
2311#define PALMAS_USB_VBUS_INT_SRC_VADP_PRB_SHIFT 6 2311#define PALMAS_USB_VBUS_INT_SRC_VADP_PRB_SHIFT 0x06
2312#define PALMAS_USB_VBUS_INT_SRC_VADP_SNS 0x20 2312#define PALMAS_USB_VBUS_INT_SRC_VADP_SNS 0x20
2313#define PALMAS_USB_VBUS_INT_SRC_VADP_SNS_SHIFT 5 2313#define PALMAS_USB_VBUS_INT_SRC_VADP_SNS_SHIFT 0x05
2314#define PALMAS_USB_VBUS_INT_SRC_VA_VBUS_VLD 0x08 2314#define PALMAS_USB_VBUS_INT_SRC_VA_VBUS_VLD 0x08
2315#define PALMAS_USB_VBUS_INT_SRC_VA_VBUS_VLD_SHIFT 3 2315#define PALMAS_USB_VBUS_INT_SRC_VA_VBUS_VLD_SHIFT 0x03
2316#define PALMAS_USB_VBUS_INT_SRC_VA_SESS_VLD 0x04 2316#define PALMAS_USB_VBUS_INT_SRC_VA_SESS_VLD 0x04
2317#define PALMAS_USB_VBUS_INT_SRC_VA_SESS_VLD_SHIFT 2 2317#define PALMAS_USB_VBUS_INT_SRC_VA_SESS_VLD_SHIFT 0x02
2318#define PALMAS_USB_VBUS_INT_SRC_VB_SESS_VLD 0x02 2318#define PALMAS_USB_VBUS_INT_SRC_VB_SESS_VLD 0x02
2319#define PALMAS_USB_VBUS_INT_SRC_VB_SESS_VLD_SHIFT 1 2319#define PALMAS_USB_VBUS_INT_SRC_VB_SESS_VLD_SHIFT 0x01
2320#define PALMAS_USB_VBUS_INT_SRC_VB_SESS_END 0x01 2320#define PALMAS_USB_VBUS_INT_SRC_VB_SESS_END 0x01
2321#define PALMAS_USB_VBUS_INT_SRC_VB_SESS_END_SHIFT 0 2321#define PALMAS_USB_VBUS_INT_SRC_VB_SESS_END_SHIFT 0x00
2322 2322
2323/* Bit definitions for USB_VBUS_INT_LATCH_SET */ 2323/* Bit definitions for USB_VBUS_INT_LATCH_SET */
2324#define PALMAS_USB_VBUS_INT_LATCH_SET_VOTG_SESS_VLD 0x80 2324#define PALMAS_USB_VBUS_INT_LATCH_SET_VOTG_SESS_VLD 0x80
2325#define PALMAS_USB_VBUS_INT_LATCH_SET_VOTG_SESS_VLD_SHIFT 7 2325#define PALMAS_USB_VBUS_INT_LATCH_SET_VOTG_SESS_VLD_SHIFT 0x07
2326#define PALMAS_USB_VBUS_INT_LATCH_SET_VADP_PRB 0x40 2326#define PALMAS_USB_VBUS_INT_LATCH_SET_VADP_PRB 0x40
2327#define PALMAS_USB_VBUS_INT_LATCH_SET_VADP_PRB_SHIFT 6 2327#define PALMAS_USB_VBUS_INT_LATCH_SET_VADP_PRB_SHIFT 0x06
2328#define PALMAS_USB_VBUS_INT_LATCH_SET_VADP_SNS 0x20 2328#define PALMAS_USB_VBUS_INT_LATCH_SET_VADP_SNS 0x20
2329#define PALMAS_USB_VBUS_INT_LATCH_SET_VADP_SNS_SHIFT 5 2329#define PALMAS_USB_VBUS_INT_LATCH_SET_VADP_SNS_SHIFT 0x05
2330#define PALMAS_USB_VBUS_INT_LATCH_SET_ADP 0x10 2330#define PALMAS_USB_VBUS_INT_LATCH_SET_ADP 0x10
2331#define PALMAS_USB_VBUS_INT_LATCH_SET_ADP_SHIFT 4 2331#define PALMAS_USB_VBUS_INT_LATCH_SET_ADP_SHIFT 0x04
2332#define PALMAS_USB_VBUS_INT_LATCH_SET_VA_VBUS_VLD 0x08 2332#define PALMAS_USB_VBUS_INT_LATCH_SET_VA_VBUS_VLD 0x08
2333#define PALMAS_USB_VBUS_INT_LATCH_SET_VA_VBUS_VLD_SHIFT 3 2333#define PALMAS_USB_VBUS_INT_LATCH_SET_VA_VBUS_VLD_SHIFT 0x03
2334#define PALMAS_USB_VBUS_INT_LATCH_SET_VA_SESS_VLD 0x04 2334#define PALMAS_USB_VBUS_INT_LATCH_SET_VA_SESS_VLD 0x04
2335#define PALMAS_USB_VBUS_INT_LATCH_SET_VA_SESS_VLD_SHIFT 2 2335#define PALMAS_USB_VBUS_INT_LATCH_SET_VA_SESS_VLD_SHIFT 0x02
2336#define PALMAS_USB_VBUS_INT_LATCH_SET_VB_SESS_VLD 0x02 2336#define PALMAS_USB_VBUS_INT_LATCH_SET_VB_SESS_VLD 0x02
2337#define PALMAS_USB_VBUS_INT_LATCH_SET_VB_SESS_VLD_SHIFT 1 2337#define PALMAS_USB_VBUS_INT_LATCH_SET_VB_SESS_VLD_SHIFT 0x01
2338#define PALMAS_USB_VBUS_INT_LATCH_SET_VB_SESS_END 0x01 2338#define PALMAS_USB_VBUS_INT_LATCH_SET_VB_SESS_END 0x01
2339#define PALMAS_USB_VBUS_INT_LATCH_SET_VB_SESS_END_SHIFT 0 2339#define PALMAS_USB_VBUS_INT_LATCH_SET_VB_SESS_END_SHIFT 0x00
2340 2340
2341/* Bit definitions for USB_VBUS_INT_LATCH_CLR */ 2341/* Bit definitions for USB_VBUS_INT_LATCH_CLR */
2342#define PALMAS_USB_VBUS_INT_LATCH_CLR_VOTG_SESS_VLD 0x80 2342#define PALMAS_USB_VBUS_INT_LATCH_CLR_VOTG_SESS_VLD 0x80
2343#define PALMAS_USB_VBUS_INT_LATCH_CLR_VOTG_SESS_VLD_SHIFT 7 2343#define PALMAS_USB_VBUS_INT_LATCH_CLR_VOTG_SESS_VLD_SHIFT 0x07
2344#define PALMAS_USB_VBUS_INT_LATCH_CLR_VADP_PRB 0x40 2344#define PALMAS_USB_VBUS_INT_LATCH_CLR_VADP_PRB 0x40
2345#define PALMAS_USB_VBUS_INT_LATCH_CLR_VADP_PRB_SHIFT 6 2345#define PALMAS_USB_VBUS_INT_LATCH_CLR_VADP_PRB_SHIFT 0x06
2346#define PALMAS_USB_VBUS_INT_LATCH_CLR_VADP_SNS 0x20 2346#define PALMAS_USB_VBUS_INT_LATCH_CLR_VADP_SNS 0x20
2347#define PALMAS_USB_VBUS_INT_LATCH_CLR_VADP_SNS_SHIFT 5 2347#define PALMAS_USB_VBUS_INT_LATCH_CLR_VADP_SNS_SHIFT 0x05
2348#define PALMAS_USB_VBUS_INT_LATCH_CLR_ADP 0x10 2348#define PALMAS_USB_VBUS_INT_LATCH_CLR_ADP 0x10
2349#define PALMAS_USB_VBUS_INT_LATCH_CLR_ADP_SHIFT 4 2349#define PALMAS_USB_VBUS_INT_LATCH_CLR_ADP_SHIFT 0x04
2350#define PALMAS_USB_VBUS_INT_LATCH_CLR_VA_VBUS_VLD 0x08 2350#define PALMAS_USB_VBUS_INT_LATCH_CLR_VA_VBUS_VLD 0x08
2351#define PALMAS_USB_VBUS_INT_LATCH_CLR_VA_VBUS_VLD_SHIFT 3 2351#define PALMAS_USB_VBUS_INT_LATCH_CLR_VA_VBUS_VLD_SHIFT 0x03
2352#define PALMAS_USB_VBUS_INT_LATCH_CLR_VA_SESS_VLD 0x04 2352#define PALMAS_USB_VBUS_INT_LATCH_CLR_VA_SESS_VLD 0x04
2353#define PALMAS_USB_VBUS_INT_LATCH_CLR_VA_SESS_VLD_SHIFT 2 2353#define PALMAS_USB_VBUS_INT_LATCH_CLR_VA_SESS_VLD_SHIFT 0x02
2354#define PALMAS_USB_VBUS_INT_LATCH_CLR_VB_SESS_VLD 0x02 2354#define PALMAS_USB_VBUS_INT_LATCH_CLR_VB_SESS_VLD 0x02
2355#define PALMAS_USB_VBUS_INT_LATCH_CLR_VB_SESS_VLD_SHIFT 1 2355#define PALMAS_USB_VBUS_INT_LATCH_CLR_VB_SESS_VLD_SHIFT 0x01
2356#define PALMAS_USB_VBUS_INT_LATCH_CLR_VB_SESS_END 0x01 2356#define PALMAS_USB_VBUS_INT_LATCH_CLR_VB_SESS_END 0x01
2357#define PALMAS_USB_VBUS_INT_LATCH_CLR_VB_SESS_END_SHIFT 0 2357#define PALMAS_USB_VBUS_INT_LATCH_CLR_VB_SESS_END_SHIFT 0x00
2358 2358
2359/* Bit definitions for USB_VBUS_INT_EN_LO_SET */ 2359/* Bit definitions for USB_VBUS_INT_EN_LO_SET */
2360#define PALMAS_USB_VBUS_INT_EN_LO_SET_VOTG_SESS_VLD 0x80 2360#define PALMAS_USB_VBUS_INT_EN_LO_SET_VOTG_SESS_VLD 0x80
2361#define PALMAS_USB_VBUS_INT_EN_LO_SET_VOTG_SESS_VLD_SHIFT 7 2361#define PALMAS_USB_VBUS_INT_EN_LO_SET_VOTG_SESS_VLD_SHIFT 0x07
2362#define PALMAS_USB_VBUS_INT_EN_LO_SET_VADP_PRB 0x40 2362#define PALMAS_USB_VBUS_INT_EN_LO_SET_VADP_PRB 0x40
2363#define PALMAS_USB_VBUS_INT_EN_LO_SET_VADP_PRB_SHIFT 6 2363#define PALMAS_USB_VBUS_INT_EN_LO_SET_VADP_PRB_SHIFT 0x06
2364#define PALMAS_USB_VBUS_INT_EN_LO_SET_VADP_SNS 0x20 2364#define PALMAS_USB_VBUS_INT_EN_LO_SET_VADP_SNS 0x20
2365#define PALMAS_USB_VBUS_INT_EN_LO_SET_VADP_SNS_SHIFT 5 2365#define PALMAS_USB_VBUS_INT_EN_LO_SET_VADP_SNS_SHIFT 0x05
2366#define PALMAS_USB_VBUS_INT_EN_LO_SET_VA_VBUS_VLD 0x08 2366#define PALMAS_USB_VBUS_INT_EN_LO_SET_VA_VBUS_VLD 0x08
2367#define PALMAS_USB_VBUS_INT_EN_LO_SET_VA_VBUS_VLD_SHIFT 3 2367#define PALMAS_USB_VBUS_INT_EN_LO_SET_VA_VBUS_VLD_SHIFT 0x03
2368#define PALMAS_USB_VBUS_INT_EN_LO_SET_VA_SESS_VLD 0x04 2368#define PALMAS_USB_VBUS_INT_EN_LO_SET_VA_SESS_VLD 0x04
2369#define PALMAS_USB_VBUS_INT_EN_LO_SET_VA_SESS_VLD_SHIFT 2 2369#define PALMAS_USB_VBUS_INT_EN_LO_SET_VA_SESS_VLD_SHIFT 0x02
2370#define PALMAS_USB_VBUS_INT_EN_LO_SET_VB_SESS_VLD 0x02 2370#define PALMAS_USB_VBUS_INT_EN_LO_SET_VB_SESS_VLD 0x02
2371#define PALMAS_USB_VBUS_INT_EN_LO_SET_VB_SESS_VLD_SHIFT 1 2371#define PALMAS_USB_VBUS_INT_EN_LO_SET_VB_SESS_VLD_SHIFT 0x01
2372#define PALMAS_USB_VBUS_INT_EN_LO_SET_VB_SESS_END 0x01 2372#define PALMAS_USB_VBUS_INT_EN_LO_SET_VB_SESS_END 0x01
2373#define PALMAS_USB_VBUS_INT_EN_LO_SET_VB_SESS_END_SHIFT 0 2373#define PALMAS_USB_VBUS_INT_EN_LO_SET_VB_SESS_END_SHIFT 0x00
2374 2374
2375/* Bit definitions for USB_VBUS_INT_EN_LO_CLR */ 2375/* Bit definitions for USB_VBUS_INT_EN_LO_CLR */
2376#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VOTG_SESS_VLD 0x80 2376#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VOTG_SESS_VLD 0x80
2377#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VOTG_SESS_VLD_SHIFT 7 2377#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VOTG_SESS_VLD_SHIFT 0x07
2378#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VADP_PRB 0x40 2378#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VADP_PRB 0x40
2379#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VADP_PRB_SHIFT 6 2379#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VADP_PRB_SHIFT 0x06
2380#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VADP_SNS 0x20 2380#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VADP_SNS 0x20
2381#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VADP_SNS_SHIFT 5 2381#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VADP_SNS_SHIFT 0x05
2382#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VA_VBUS_VLD 0x08 2382#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VA_VBUS_VLD 0x08
2383#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VA_VBUS_VLD_SHIFT 3 2383#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VA_VBUS_VLD_SHIFT 0x03
2384#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VA_SESS_VLD 0x04 2384#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VA_SESS_VLD 0x04
2385#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VA_SESS_VLD_SHIFT 2 2385#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VA_SESS_VLD_SHIFT 0x02
2386#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VB_SESS_VLD 0x02 2386#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VB_SESS_VLD 0x02
2387#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VB_SESS_VLD_SHIFT 1 2387#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VB_SESS_VLD_SHIFT 0x01
2388#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VB_SESS_END 0x01 2388#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VB_SESS_END 0x01
2389#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VB_SESS_END_SHIFT 0 2389#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VB_SESS_END_SHIFT 0x00
2390 2390
2391/* Bit definitions for USB_VBUS_INT_EN_HI_SET */ 2391/* Bit definitions for USB_VBUS_INT_EN_HI_SET */
2392#define PALMAS_USB_VBUS_INT_EN_HI_SET_VOTG_SESS_VLD 0x80 2392#define PALMAS_USB_VBUS_INT_EN_HI_SET_VOTG_SESS_VLD 0x80
2393#define PALMAS_USB_VBUS_INT_EN_HI_SET_VOTG_SESS_VLD_SHIFT 7 2393#define PALMAS_USB_VBUS_INT_EN_HI_SET_VOTG_SESS_VLD_SHIFT 0x07
2394#define PALMAS_USB_VBUS_INT_EN_HI_SET_VADP_PRB 0x40 2394#define PALMAS_USB_VBUS_INT_EN_HI_SET_VADP_PRB 0x40
2395#define PALMAS_USB_VBUS_INT_EN_HI_SET_VADP_PRB_SHIFT 6 2395#define PALMAS_USB_VBUS_INT_EN_HI_SET_VADP_PRB_SHIFT 0x06
2396#define PALMAS_USB_VBUS_INT_EN_HI_SET_VADP_SNS 0x20 2396#define PALMAS_USB_VBUS_INT_EN_HI_SET_VADP_SNS 0x20
2397#define PALMAS_USB_VBUS_INT_EN_HI_SET_VADP_SNS_SHIFT 5 2397#define PALMAS_USB_VBUS_INT_EN_HI_SET_VADP_SNS_SHIFT 0x05
2398#define PALMAS_USB_VBUS_INT_EN_HI_SET_ADP 0x10 2398#define PALMAS_USB_VBUS_INT_EN_HI_SET_ADP 0x10
2399#define PALMAS_USB_VBUS_INT_EN_HI_SET_ADP_SHIFT 4 2399#define PALMAS_USB_VBUS_INT_EN_HI_SET_ADP_SHIFT 0x04
2400#define PALMAS_USB_VBUS_INT_EN_HI_SET_VA_VBUS_VLD 0x08 2400#define PALMAS_USB_VBUS_INT_EN_HI_SET_VA_VBUS_VLD 0x08
2401#define PALMAS_USB_VBUS_INT_EN_HI_SET_VA_VBUS_VLD_SHIFT 3 2401#define PALMAS_USB_VBUS_INT_EN_HI_SET_VA_VBUS_VLD_SHIFT 0x03
2402#define PALMAS_USB_VBUS_INT_EN_HI_SET_VA_SESS_VLD 0x04 2402#define PALMAS_USB_VBUS_INT_EN_HI_SET_VA_SESS_VLD 0x04
2403#define PALMAS_USB_VBUS_INT_EN_HI_SET_VA_SESS_VLD_SHIFT 2 2403#define PALMAS_USB_VBUS_INT_EN_HI_SET_VA_SESS_VLD_SHIFT 0x02
2404#define PALMAS_USB_VBUS_INT_EN_HI_SET_VB_SESS_VLD 0x02 2404#define PALMAS_USB_VBUS_INT_EN_HI_SET_VB_SESS_VLD 0x02
2405#define PALMAS_USB_VBUS_INT_EN_HI_SET_VB_SESS_VLD_SHIFT 1 2405#define PALMAS_USB_VBUS_INT_EN_HI_SET_VB_SESS_VLD_SHIFT 0x01
2406#define PALMAS_USB_VBUS_INT_EN_HI_SET_VB_SESS_END 0x01 2406#define PALMAS_USB_VBUS_INT_EN_HI_SET_VB_SESS_END 0x01
2407#define PALMAS_USB_VBUS_INT_EN_HI_SET_VB_SESS_END_SHIFT 0 2407#define PALMAS_USB_VBUS_INT_EN_HI_SET_VB_SESS_END_SHIFT 0x00
2408 2408
2409/* Bit definitions for USB_VBUS_INT_EN_HI_CLR */ 2409/* Bit definitions for USB_VBUS_INT_EN_HI_CLR */
2410#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VOTG_SESS_VLD 0x80 2410#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VOTG_SESS_VLD 0x80
2411#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VOTG_SESS_VLD_SHIFT 7 2411#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VOTG_SESS_VLD_SHIFT 0x07
2412#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VADP_PRB 0x40 2412#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VADP_PRB 0x40
2413#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VADP_PRB_SHIFT 6 2413#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VADP_PRB_SHIFT 0x06
2414#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VADP_SNS 0x20 2414#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VADP_SNS 0x20
2415#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VADP_SNS_SHIFT 5 2415#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VADP_SNS_SHIFT 0x05
2416#define PALMAS_USB_VBUS_INT_EN_HI_CLR_ADP 0x10 2416#define PALMAS_USB_VBUS_INT_EN_HI_CLR_ADP 0x10
2417#define PALMAS_USB_VBUS_INT_EN_HI_CLR_ADP_SHIFT 4 2417#define PALMAS_USB_VBUS_INT_EN_HI_CLR_ADP_SHIFT 0x04
2418#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VA_VBUS_VLD 0x08 2418#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VA_VBUS_VLD 0x08
2419#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VA_VBUS_VLD_SHIFT 3 2419#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VA_VBUS_VLD_SHIFT 0x03
2420#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VA_SESS_VLD 0x04 2420#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VA_SESS_VLD 0x04
2421#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VA_SESS_VLD_SHIFT 2 2421#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VA_SESS_VLD_SHIFT 0x02
2422#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VB_SESS_VLD 0x02 2422#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VB_SESS_VLD 0x02
2423#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VB_SESS_VLD_SHIFT 1 2423#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VB_SESS_VLD_SHIFT 0x01
2424#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VB_SESS_END 0x01 2424#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VB_SESS_END 0x01
2425#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VB_SESS_END_SHIFT 0 2425#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VB_SESS_END_SHIFT 0x00
2426 2426
2427/* Bit definitions for USB_ID_INT_SRC */ 2427/* Bit definitions for USB_ID_INT_SRC */
2428#define PALMAS_USB_ID_INT_SRC_ID_FLOAT 0x10 2428#define PALMAS_USB_ID_INT_SRC_ID_FLOAT 0x10
2429#define PALMAS_USB_ID_INT_SRC_ID_FLOAT_SHIFT 4 2429#define PALMAS_USB_ID_INT_SRC_ID_FLOAT_SHIFT 0x04
2430#define PALMAS_USB_ID_INT_SRC_ID_A 0x08 2430#define PALMAS_USB_ID_INT_SRC_ID_A 0x08
2431#define PALMAS_USB_ID_INT_SRC_ID_A_SHIFT 3 2431#define PALMAS_USB_ID_INT_SRC_ID_A_SHIFT 0x03
2432#define PALMAS_USB_ID_INT_SRC_ID_B 0x04 2432#define PALMAS_USB_ID_INT_SRC_ID_B 0x04
2433#define PALMAS_USB_ID_INT_SRC_ID_B_SHIFT 2 2433#define PALMAS_USB_ID_INT_SRC_ID_B_SHIFT 0x02
2434#define PALMAS_USB_ID_INT_SRC_ID_C 0x02 2434#define PALMAS_USB_ID_INT_SRC_ID_C 0x02
2435#define PALMAS_USB_ID_INT_SRC_ID_C_SHIFT 1 2435#define PALMAS_USB_ID_INT_SRC_ID_C_SHIFT 0x01
2436#define PALMAS_USB_ID_INT_SRC_ID_GND 0x01 2436#define PALMAS_USB_ID_INT_SRC_ID_GND 0x01
2437#define PALMAS_USB_ID_INT_SRC_ID_GND_SHIFT 0 2437#define PALMAS_USB_ID_INT_SRC_ID_GND_SHIFT 0x00
2438 2438
2439/* Bit definitions for USB_ID_INT_LATCH_SET */ 2439/* Bit definitions for USB_ID_INT_LATCH_SET */
2440#define PALMAS_USB_ID_INT_LATCH_SET_ID_FLOAT 0x10 2440#define PALMAS_USB_ID_INT_LATCH_SET_ID_FLOAT 0x10
2441#define PALMAS_USB_ID_INT_LATCH_SET_ID_FLOAT_SHIFT 4 2441#define PALMAS_USB_ID_INT_LATCH_SET_ID_FLOAT_SHIFT 0x04
2442#define PALMAS_USB_ID_INT_LATCH_SET_ID_A 0x08 2442#define PALMAS_USB_ID_INT_LATCH_SET_ID_A 0x08
2443#define PALMAS_USB_ID_INT_LATCH_SET_ID_A_SHIFT 3 2443#define PALMAS_USB_ID_INT_LATCH_SET_ID_A_SHIFT 0x03
2444#define PALMAS_USB_ID_INT_LATCH_SET_ID_B 0x04 2444#define PALMAS_USB_ID_INT_LATCH_SET_ID_B 0x04
2445#define PALMAS_USB_ID_INT_LATCH_SET_ID_B_SHIFT 2 2445#define PALMAS_USB_ID_INT_LATCH_SET_ID_B_SHIFT 0x02
2446#define PALMAS_USB_ID_INT_LATCH_SET_ID_C 0x02 2446#define PALMAS_USB_ID_INT_LATCH_SET_ID_C 0x02
2447#define PALMAS_USB_ID_INT_LATCH_SET_ID_C_SHIFT 1 2447#define PALMAS_USB_ID_INT_LATCH_SET_ID_C_SHIFT 0x01
2448#define PALMAS_USB_ID_INT_LATCH_SET_ID_GND 0x01 2448#define PALMAS_USB_ID_INT_LATCH_SET_ID_GND 0x01
2449#define PALMAS_USB_ID_INT_LATCH_SET_ID_GND_SHIFT 0 2449#define PALMAS_USB_ID_INT_LATCH_SET_ID_GND_SHIFT 0x00
2450 2450
2451/* Bit definitions for USB_ID_INT_LATCH_CLR */ 2451/* Bit definitions for USB_ID_INT_LATCH_CLR */
2452#define PALMAS_USB_ID_INT_LATCH_CLR_ID_FLOAT 0x10 2452#define PALMAS_USB_ID_INT_LATCH_CLR_ID_FLOAT 0x10
2453#define PALMAS_USB_ID_INT_LATCH_CLR_ID_FLOAT_SHIFT 4 2453#define PALMAS_USB_ID_INT_LATCH_CLR_ID_FLOAT_SHIFT 0x04
2454#define PALMAS_USB_ID_INT_LATCH_CLR_ID_A 0x08 2454#define PALMAS_USB_ID_INT_LATCH_CLR_ID_A 0x08
2455#define PALMAS_USB_ID_INT_LATCH_CLR_ID_A_SHIFT 3 2455#define PALMAS_USB_ID_INT_LATCH_CLR_ID_A_SHIFT 0x03
2456#define PALMAS_USB_ID_INT_LATCH_CLR_ID_B 0x04 2456#define PALMAS_USB_ID_INT_LATCH_CLR_ID_B 0x04
2457#define PALMAS_USB_ID_INT_LATCH_CLR_ID_B_SHIFT 2 2457#define PALMAS_USB_ID_INT_LATCH_CLR_ID_B_SHIFT 0x02
2458#define PALMAS_USB_ID_INT_LATCH_CLR_ID_C 0x02 2458#define PALMAS_USB_ID_INT_LATCH_CLR_ID_C 0x02
2459#define PALMAS_USB_ID_INT_LATCH_CLR_ID_C_SHIFT 1 2459#define PALMAS_USB_ID_INT_LATCH_CLR_ID_C_SHIFT 0x01
2460#define PALMAS_USB_ID_INT_LATCH_CLR_ID_GND 0x01 2460#define PALMAS_USB_ID_INT_LATCH_CLR_ID_GND 0x01
2461#define PALMAS_USB_ID_INT_LATCH_CLR_ID_GND_SHIFT 0 2461#define PALMAS_USB_ID_INT_LATCH_CLR_ID_GND_SHIFT 0x00
2462 2462
2463/* Bit definitions for USB_ID_INT_EN_LO_SET */ 2463/* Bit definitions for USB_ID_INT_EN_LO_SET */
2464#define PALMAS_USB_ID_INT_EN_LO_SET_ID_FLOAT 0x10 2464#define PALMAS_USB_ID_INT_EN_LO_SET_ID_FLOAT 0x10
2465#define PALMAS_USB_ID_INT_EN_LO_SET_ID_FLOAT_SHIFT 4 2465#define PALMAS_USB_ID_INT_EN_LO_SET_ID_FLOAT_SHIFT 0x04
2466#define PALMAS_USB_ID_INT_EN_LO_SET_ID_A 0x08 2466#define PALMAS_USB_ID_INT_EN_LO_SET_ID_A 0x08
2467#define PALMAS_USB_ID_INT_EN_LO_SET_ID_A_SHIFT 3 2467#define PALMAS_USB_ID_INT_EN_LO_SET_ID_A_SHIFT 0x03
2468#define PALMAS_USB_ID_INT_EN_LO_SET_ID_B 0x04 2468#define PALMAS_USB_ID_INT_EN_LO_SET_ID_B 0x04
2469#define PALMAS_USB_ID_INT_EN_LO_SET_ID_B_SHIFT 2 2469#define PALMAS_USB_ID_INT_EN_LO_SET_ID_B_SHIFT 0x02
2470#define PALMAS_USB_ID_INT_EN_LO_SET_ID_C 0x02 2470#define PALMAS_USB_ID_INT_EN_LO_SET_ID_C 0x02
2471#define PALMAS_USB_ID_INT_EN_LO_SET_ID_C_SHIFT 1 2471#define PALMAS_USB_ID_INT_EN_LO_SET_ID_C_SHIFT 0x01
2472#define PALMAS_USB_ID_INT_EN_LO_SET_ID_GND 0x01 2472#define PALMAS_USB_ID_INT_EN_LO_SET_ID_GND 0x01
2473#define PALMAS_USB_ID_INT_EN_LO_SET_ID_GND_SHIFT 0 2473#define PALMAS_USB_ID_INT_EN_LO_SET_ID_GND_SHIFT 0x00
2474 2474
2475/* Bit definitions for USB_ID_INT_EN_LO_CLR */ 2475/* Bit definitions for USB_ID_INT_EN_LO_CLR */
2476#define PALMAS_USB_ID_INT_EN_LO_CLR_ID_FLOAT 0x10 2476#define PALMAS_USB_ID_INT_EN_LO_CLR_ID_FLOAT 0x10
2477#define PALMAS_USB_ID_INT_EN_LO_CLR_ID_FLOAT_SHIFT 4 2477#define PALMAS_USB_ID_INT_EN_LO_CLR_ID_FLOAT_SHIFT 0x04
2478#define PALMAS_USB_ID_INT_EN_LO_CLR_ID_A 0x08 2478#define PALMAS_USB_ID_INT_EN_LO_CLR_ID_A 0x08
2479#define PALMAS_USB_ID_INT_EN_LO_CLR_ID_A_SHIFT 3 2479#define PALMAS_USB_ID_INT_EN_LO_CLR_ID_A_SHIFT 0x03
2480#define PALMAS_USB_ID_INT_EN_LO_CLR_ID_B 0x04 2480#define PALMAS_USB_ID_INT_EN_LO_CLR_ID_B 0x04
2481#define PALMAS_USB_ID_INT_EN_LO_CLR_ID_B_SHIFT 2 2481#define PALMAS_USB_ID_INT_EN_LO_CLR_ID_B_SHIFT 0x02
2482#define PALMAS_USB_ID_INT_EN_LO_CLR_ID_C 0x02 2482#define PALMAS_USB_ID_INT_EN_LO_CLR_ID_C 0x02
2483#define PALMAS_USB_ID_INT_EN_LO_CLR_ID_C_SHIFT 1 2483#define PALMAS_USB_ID_INT_EN_LO_CLR_ID_C_SHIFT 0x01
2484#define PALMAS_USB_ID_INT_EN_LO_CLR_ID_GND 0x01 2484#define PALMAS_USB_ID_INT_EN_LO_CLR_ID_GND 0x01
2485#define PALMAS_USB_ID_INT_EN_LO_CLR_ID_GND_SHIFT 0 2485#define PALMAS_USB_ID_INT_EN_LO_CLR_ID_GND_SHIFT 0x00
2486 2486
2487/* Bit definitions for USB_ID_INT_EN_HI_SET */ 2487/* Bit definitions for USB_ID_INT_EN_HI_SET */
2488#define PALMAS_USB_ID_INT_EN_HI_SET_ID_FLOAT 0x10 2488#define PALMAS_USB_ID_INT_EN_HI_SET_ID_FLOAT 0x10
2489#define PALMAS_USB_ID_INT_EN_HI_SET_ID_FLOAT_SHIFT 4 2489#define PALMAS_USB_ID_INT_EN_HI_SET_ID_FLOAT_SHIFT 0x04
2490#define PALMAS_USB_ID_INT_EN_HI_SET_ID_A 0x08 2490#define PALMAS_USB_ID_INT_EN_HI_SET_ID_A 0x08
2491#define PALMAS_USB_ID_INT_EN_HI_SET_ID_A_SHIFT 3 2491#define PALMAS_USB_ID_INT_EN_HI_SET_ID_A_SHIFT 0x03
2492#define PALMAS_USB_ID_INT_EN_HI_SET_ID_B 0x04 2492#define PALMAS_USB_ID_INT_EN_HI_SET_ID_B 0x04
2493#define PALMAS_USB_ID_INT_EN_HI_SET_ID_B_SHIFT 2 2493#define PALMAS_USB_ID_INT_EN_HI_SET_ID_B_SHIFT 0x02
2494#define PALMAS_USB_ID_INT_EN_HI_SET_ID_C 0x02 2494#define PALMAS_USB_ID_INT_EN_HI_SET_ID_C 0x02
2495#define PALMAS_USB_ID_INT_EN_HI_SET_ID_C_SHIFT 1 2495#define PALMAS_USB_ID_INT_EN_HI_SET_ID_C_SHIFT 0x01
2496#define PALMAS_USB_ID_INT_EN_HI_SET_ID_GND 0x01 2496#define PALMAS_USB_ID_INT_EN_HI_SET_ID_GND 0x01
2497#define PALMAS_USB_ID_INT_EN_HI_SET_ID_GND_SHIFT 0 2497#define PALMAS_USB_ID_INT_EN_HI_SET_ID_GND_SHIFT 0x00
2498 2498
2499/* Bit definitions for USB_ID_INT_EN_HI_CLR */ 2499/* Bit definitions for USB_ID_INT_EN_HI_CLR */
2500#define PALMAS_USB_ID_INT_EN_HI_CLR_ID_FLOAT 0x10 2500#define PALMAS_USB_ID_INT_EN_HI_CLR_ID_FLOAT 0x10
2501#define PALMAS_USB_ID_INT_EN_HI_CLR_ID_FLOAT_SHIFT 4 2501#define PALMAS_USB_ID_INT_EN_HI_CLR_ID_FLOAT_SHIFT 0x04
2502#define PALMAS_USB_ID_INT_EN_HI_CLR_ID_A 0x08 2502#define PALMAS_USB_ID_INT_EN_HI_CLR_ID_A 0x08
2503#define PALMAS_USB_ID_INT_EN_HI_CLR_ID_A_SHIFT 3 2503#define PALMAS_USB_ID_INT_EN_HI_CLR_ID_A_SHIFT 0x03
2504#define PALMAS_USB_ID_INT_EN_HI_CLR_ID_B 0x04 2504#define PALMAS_USB_ID_INT_EN_HI_CLR_ID_B 0x04
2505#define PALMAS_USB_ID_INT_EN_HI_CLR_ID_B_SHIFT 2 2505#define PALMAS_USB_ID_INT_EN_HI_CLR_ID_B_SHIFT 0x02
2506#define PALMAS_USB_ID_INT_EN_HI_CLR_ID_C 0x02 2506#define PALMAS_USB_ID_INT_EN_HI_CLR_ID_C 0x02
2507#define PALMAS_USB_ID_INT_EN_HI_CLR_ID_C_SHIFT 1 2507#define PALMAS_USB_ID_INT_EN_HI_CLR_ID_C_SHIFT 0x01
2508#define PALMAS_USB_ID_INT_EN_HI_CLR_ID_GND 0x01 2508#define PALMAS_USB_ID_INT_EN_HI_CLR_ID_GND 0x01
2509#define PALMAS_USB_ID_INT_EN_HI_CLR_ID_GND_SHIFT 0 2509#define PALMAS_USB_ID_INT_EN_HI_CLR_ID_GND_SHIFT 0x00
2510 2510
2511/* Bit definitions for USB_OTG_ADP_CTRL */ 2511/* Bit definitions for USB_OTG_ADP_CTRL */
2512#define PALMAS_USB_OTG_ADP_CTRL_ADP_EN 0x04 2512#define PALMAS_USB_OTG_ADP_CTRL_ADP_EN 0x04
2513#define PALMAS_USB_OTG_ADP_CTRL_ADP_EN_SHIFT 2 2513#define PALMAS_USB_OTG_ADP_CTRL_ADP_EN_SHIFT 0x02
2514#define PALMAS_USB_OTG_ADP_CTRL_ADP_MODE_MASK 0x03 2514#define PALMAS_USB_OTG_ADP_CTRL_ADP_MODE_MASK 0x03
2515#define PALMAS_USB_OTG_ADP_CTRL_ADP_MODE_SHIFT 0 2515#define PALMAS_USB_OTG_ADP_CTRL_ADP_MODE_SHIFT 0x00
2516 2516
2517/* Bit definitions for USB_OTG_ADP_HIGH */ 2517/* Bit definitions for USB_OTG_ADP_HIGH */
2518#define PALMAS_USB_OTG_ADP_HIGH_T_ADP_HIGH_MASK 0xff 2518#define PALMAS_USB_OTG_ADP_HIGH_T_ADP_HIGH_MASK 0xFF
2519#define PALMAS_USB_OTG_ADP_HIGH_T_ADP_HIGH_SHIFT 0 2519#define PALMAS_USB_OTG_ADP_HIGH_T_ADP_HIGH_SHIFT 0x00
2520 2520
2521/* Bit definitions for USB_OTG_ADP_LOW */ 2521/* Bit definitions for USB_OTG_ADP_LOW */
2522#define PALMAS_USB_OTG_ADP_LOW_T_ADP_LOW_MASK 0xff 2522#define PALMAS_USB_OTG_ADP_LOW_T_ADP_LOW_MASK 0xFF
2523#define PALMAS_USB_OTG_ADP_LOW_T_ADP_LOW_SHIFT 0 2523#define PALMAS_USB_OTG_ADP_LOW_T_ADP_LOW_SHIFT 0x00
2524 2524
2525/* Bit definitions for USB_OTG_ADP_RISE */ 2525/* Bit definitions for USB_OTG_ADP_RISE */
2526#define PALMAS_USB_OTG_ADP_RISE_T_ADP_RISE_MASK 0xff 2526#define PALMAS_USB_OTG_ADP_RISE_T_ADP_RISE_MASK 0xFF
2527#define PALMAS_USB_OTG_ADP_RISE_T_ADP_RISE_SHIFT 0 2527#define PALMAS_USB_OTG_ADP_RISE_T_ADP_RISE_SHIFT 0x00
2528 2528
2529/* Bit definitions for USB_OTG_REVISION */ 2529/* Bit definitions for USB_OTG_REVISION */
2530#define PALMAS_USB_OTG_REVISION_OTG_REV 0x01 2530#define PALMAS_USB_OTG_REVISION_OTG_REV 0x01
2531#define PALMAS_USB_OTG_REVISION_OTG_REV_SHIFT 0 2531#define PALMAS_USB_OTG_REVISION_OTG_REV_SHIFT 0x00
2532 2532
2533/* Registers for function VIBRATOR */ 2533/* Registers for function VIBRATOR */
2534#define PALMAS_VIBRA_CTRL 0x0 2534#define PALMAS_VIBRA_CTRL 0x00
2535 2535
2536/* Bit definitions for VIBRA_CTRL */ 2536/* Bit definitions for VIBRA_CTRL */
2537#define PALMAS_VIBRA_CTRL_PWM_DUTY_SEL_MASK 0x06 2537#define PALMAS_VIBRA_CTRL_PWM_DUTY_SEL_MASK 0x06
2538#define PALMAS_VIBRA_CTRL_PWM_DUTY_SEL_SHIFT 1 2538#define PALMAS_VIBRA_CTRL_PWM_DUTY_SEL_SHIFT 0x01
2539#define PALMAS_VIBRA_CTRL_PWM_FREQ_SEL 0x01 2539#define PALMAS_VIBRA_CTRL_PWM_FREQ_SEL 0x01
2540#define PALMAS_VIBRA_CTRL_PWM_FREQ_SEL_SHIFT 0 2540#define PALMAS_VIBRA_CTRL_PWM_FREQ_SEL_SHIFT 0x00
2541 2541
2542/* Registers for function GPIO */ 2542/* Registers for function GPIO */
2543#define PALMAS_GPIO_DATA_IN 0x0 2543#define PALMAS_GPIO_DATA_IN 0x00
2544#define PALMAS_GPIO_DATA_DIR 0x1 2544#define PALMAS_GPIO_DATA_DIR 0x01
2545#define PALMAS_GPIO_DATA_OUT 0x2 2545#define PALMAS_GPIO_DATA_OUT 0x02
2546#define PALMAS_GPIO_DEBOUNCE_EN 0x3 2546#define PALMAS_GPIO_DEBOUNCE_EN 0x03
2547#define PALMAS_GPIO_CLEAR_DATA_OUT 0x4 2547#define PALMAS_GPIO_CLEAR_DATA_OUT 0x04
2548#define PALMAS_GPIO_SET_DATA_OUT 0x5 2548#define PALMAS_GPIO_SET_DATA_OUT 0x05
2549#define PALMAS_PU_PD_GPIO_CTRL1 0x6 2549#define PALMAS_PU_PD_GPIO_CTRL1 0x06
2550#define PALMAS_PU_PD_GPIO_CTRL2 0x7 2550#define PALMAS_PU_PD_GPIO_CTRL2 0x07
2551#define PALMAS_OD_OUTPUT_GPIO_CTRL 0x8 2551#define PALMAS_OD_OUTPUT_GPIO_CTRL 0x08
2552#define PALMAS_GPIO_DATA_IN2 0x9 2552#define PALMAS_GPIO_DATA_IN2 0x09
2553#define PALMAS_GPIO_DATA_DIR2 0x0A 2553#define PALMAS_GPIO_DATA_DIR2 0x0A
2554#define PALMAS_GPIO_DATA_OUT2 0x0B 2554#define PALMAS_GPIO_DATA_OUT2 0x0B
2555#define PALMAS_GPIO_DEBOUNCE_EN2 0x0C 2555#define PALMAS_GPIO_DEBOUNCE_EN2 0x0C
@@ -2561,167 +2561,167 @@ enum usb_irq_events {
2561 2561
2562/* Bit definitions for GPIO_DATA_IN */ 2562/* Bit definitions for GPIO_DATA_IN */
2563#define PALMAS_GPIO_DATA_IN_GPIO_7_IN 0x80 2563#define PALMAS_GPIO_DATA_IN_GPIO_7_IN 0x80
2564#define PALMAS_GPIO_DATA_IN_GPIO_7_IN_SHIFT 7 2564#define PALMAS_GPIO_DATA_IN_GPIO_7_IN_SHIFT 0x07
2565#define PALMAS_GPIO_DATA_IN_GPIO_6_IN 0x40 2565#define PALMAS_GPIO_DATA_IN_GPIO_6_IN 0x40
2566#define PALMAS_GPIO_DATA_IN_GPIO_6_IN_SHIFT 6 2566#define PALMAS_GPIO_DATA_IN_GPIO_6_IN_SHIFT 0x06
2567#define PALMAS_GPIO_DATA_IN_GPIO_5_IN 0x20 2567#define PALMAS_GPIO_DATA_IN_GPIO_5_IN 0x20
2568#define PALMAS_GPIO_DATA_IN_GPIO_5_IN_SHIFT 5 2568#define PALMAS_GPIO_DATA_IN_GPIO_5_IN_SHIFT 0x05
2569#define PALMAS_GPIO_DATA_IN_GPIO_4_IN 0x10 2569#define PALMAS_GPIO_DATA_IN_GPIO_4_IN 0x10
2570#define PALMAS_GPIO_DATA_IN_GPIO_4_IN_SHIFT 4 2570#define PALMAS_GPIO_DATA_IN_GPIO_4_IN_SHIFT 0x04
2571#define PALMAS_GPIO_DATA_IN_GPIO_3_IN 0x08 2571#define PALMAS_GPIO_DATA_IN_GPIO_3_IN 0x08
2572#define PALMAS_GPIO_DATA_IN_GPIO_3_IN_SHIFT 3 2572#define PALMAS_GPIO_DATA_IN_GPIO_3_IN_SHIFT 0x03
2573#define PALMAS_GPIO_DATA_IN_GPIO_2_IN 0x04 2573#define PALMAS_GPIO_DATA_IN_GPIO_2_IN 0x04
2574#define PALMAS_GPIO_DATA_IN_GPIO_2_IN_SHIFT 2 2574#define PALMAS_GPIO_DATA_IN_GPIO_2_IN_SHIFT 0x02
2575#define PALMAS_GPIO_DATA_IN_GPIO_1_IN 0x02 2575#define PALMAS_GPIO_DATA_IN_GPIO_1_IN 0x02
2576#define PALMAS_GPIO_DATA_IN_GPIO_1_IN_SHIFT 1 2576#define PALMAS_GPIO_DATA_IN_GPIO_1_IN_SHIFT 0x01
2577#define PALMAS_GPIO_DATA_IN_GPIO_0_IN 0x01 2577#define PALMAS_GPIO_DATA_IN_GPIO_0_IN 0x01
2578#define PALMAS_GPIO_DATA_IN_GPIO_0_IN_SHIFT 0 2578#define PALMAS_GPIO_DATA_IN_GPIO_0_IN_SHIFT 0x00
2579 2579
2580/* Bit definitions for GPIO_DATA_DIR */ 2580/* Bit definitions for GPIO_DATA_DIR */
2581#define PALMAS_GPIO_DATA_DIR_GPIO_7_DIR 0x80 2581#define PALMAS_GPIO_DATA_DIR_GPIO_7_DIR 0x80
2582#define PALMAS_GPIO_DATA_DIR_GPIO_7_DIR_SHIFT 7 2582#define PALMAS_GPIO_DATA_DIR_GPIO_7_DIR_SHIFT 0x07
2583#define PALMAS_GPIO_DATA_DIR_GPIO_6_DIR 0x40 2583#define PALMAS_GPIO_DATA_DIR_GPIO_6_DIR 0x40
2584#define PALMAS_GPIO_DATA_DIR_GPIO_6_DIR_SHIFT 6 2584#define PALMAS_GPIO_DATA_DIR_GPIO_6_DIR_SHIFT 0x06
2585#define PALMAS_GPIO_DATA_DIR_GPIO_5_DIR 0x20 2585#define PALMAS_GPIO_DATA_DIR_GPIO_5_DIR 0x20
2586#define PALMAS_GPIO_DATA_DIR_GPIO_5_DIR_SHIFT 5 2586#define PALMAS_GPIO_DATA_DIR_GPIO_5_DIR_SHIFT 0x05
2587#define PALMAS_GPIO_DATA_DIR_GPIO_4_DIR 0x10 2587#define PALMAS_GPIO_DATA_DIR_GPIO_4_DIR 0x10
2588#define PALMAS_GPIO_DATA_DIR_GPIO_4_DIR_SHIFT 4 2588#define PALMAS_GPIO_DATA_DIR_GPIO_4_DIR_SHIFT 0x04
2589#define PALMAS_GPIO_DATA_DIR_GPIO_3_DIR 0x08 2589#define PALMAS_GPIO_DATA_DIR_GPIO_3_DIR 0x08
2590#define PALMAS_GPIO_DATA_DIR_GPIO_3_DIR_SHIFT 3 2590#define PALMAS_GPIO_DATA_DIR_GPIO_3_DIR_SHIFT 0x03
2591#define PALMAS_GPIO_DATA_DIR_GPIO_2_DIR 0x04 2591#define PALMAS_GPIO_DATA_DIR_GPIO_2_DIR 0x04
2592#define PALMAS_GPIO_DATA_DIR_GPIO_2_DIR_SHIFT 2 2592#define PALMAS_GPIO_DATA_DIR_GPIO_2_DIR_SHIFT 0x02
2593#define PALMAS_GPIO_DATA_DIR_GPIO_1_DIR 0x02 2593#define PALMAS_GPIO_DATA_DIR_GPIO_1_DIR 0x02
2594#define PALMAS_GPIO_DATA_DIR_GPIO_1_DIR_SHIFT 1 2594#define PALMAS_GPIO_DATA_DIR_GPIO_1_DIR_SHIFT 0x01
2595#define PALMAS_GPIO_DATA_DIR_GPIO_0_DIR 0x01 2595#define PALMAS_GPIO_DATA_DIR_GPIO_0_DIR 0x01
2596#define PALMAS_GPIO_DATA_DIR_GPIO_0_DIR_SHIFT 0 2596#define PALMAS_GPIO_DATA_DIR_GPIO_0_DIR_SHIFT 0x00
2597 2597
2598/* Bit definitions for GPIO_DATA_OUT */ 2598/* Bit definitions for GPIO_DATA_OUT */
2599#define PALMAS_GPIO_DATA_OUT_GPIO_7_OUT 0x80 2599#define PALMAS_GPIO_DATA_OUT_GPIO_7_OUT 0x80
2600#define PALMAS_GPIO_DATA_OUT_GPIO_7_OUT_SHIFT 7 2600#define PALMAS_GPIO_DATA_OUT_GPIO_7_OUT_SHIFT 0x07
2601#define PALMAS_GPIO_DATA_OUT_GPIO_6_OUT 0x40 2601#define PALMAS_GPIO_DATA_OUT_GPIO_6_OUT 0x40
2602#define PALMAS_GPIO_DATA_OUT_GPIO_6_OUT_SHIFT 6 2602#define PALMAS_GPIO_DATA_OUT_GPIO_6_OUT_SHIFT 0x06
2603#define PALMAS_GPIO_DATA_OUT_GPIO_5_OUT 0x20 2603#define PALMAS_GPIO_DATA_OUT_GPIO_5_OUT 0x20
2604#define PALMAS_GPIO_DATA_OUT_GPIO_5_OUT_SHIFT 5 2604#define PALMAS_GPIO_DATA_OUT_GPIO_5_OUT_SHIFT 0x05
2605#define PALMAS_GPIO_DATA_OUT_GPIO_4_OUT 0x10 2605#define PALMAS_GPIO_DATA_OUT_GPIO_4_OUT 0x10
2606#define PALMAS_GPIO_DATA_OUT_GPIO_4_OUT_SHIFT 4 2606#define PALMAS_GPIO_DATA_OUT_GPIO_4_OUT_SHIFT 0x04
2607#define PALMAS_GPIO_DATA_OUT_GPIO_3_OUT 0x08 2607#define PALMAS_GPIO_DATA_OUT_GPIO_3_OUT 0x08
2608#define PALMAS_GPIO_DATA_OUT_GPIO_3_OUT_SHIFT 3 2608#define PALMAS_GPIO_DATA_OUT_GPIO_3_OUT_SHIFT 0x03
2609#define PALMAS_GPIO_DATA_OUT_GPIO_2_OUT 0x04 2609#define PALMAS_GPIO_DATA_OUT_GPIO_2_OUT 0x04
2610#define PALMAS_GPIO_DATA_OUT_GPIO_2_OUT_SHIFT 2 2610#define PALMAS_GPIO_DATA_OUT_GPIO_2_OUT_SHIFT 0x02
2611#define PALMAS_GPIO_DATA_OUT_GPIO_1_OUT 0x02 2611#define PALMAS_GPIO_DATA_OUT_GPIO_1_OUT 0x02
2612#define PALMAS_GPIO_DATA_OUT_GPIO_1_OUT_SHIFT 1 2612#define PALMAS_GPIO_DATA_OUT_GPIO_1_OUT_SHIFT 0x01
2613#define PALMAS_GPIO_DATA_OUT_GPIO_0_OUT 0x01 2613#define PALMAS_GPIO_DATA_OUT_GPIO_0_OUT 0x01
2614#define PALMAS_GPIO_DATA_OUT_GPIO_0_OUT_SHIFT 0 2614#define PALMAS_GPIO_DATA_OUT_GPIO_0_OUT_SHIFT 0x00
2615 2615
2616/* Bit definitions for GPIO_DEBOUNCE_EN */ 2616/* Bit definitions for GPIO_DEBOUNCE_EN */
2617#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_7_DEBOUNCE_EN 0x80 2617#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_7_DEBOUNCE_EN 0x80
2618#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_7_DEBOUNCE_EN_SHIFT 7 2618#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_7_DEBOUNCE_EN_SHIFT 0x07
2619#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_6_DEBOUNCE_EN 0x40 2619#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_6_DEBOUNCE_EN 0x40
2620#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_6_DEBOUNCE_EN_SHIFT 6 2620#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_6_DEBOUNCE_EN_SHIFT 0x06
2621#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_5_DEBOUNCE_EN 0x20 2621#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_5_DEBOUNCE_EN 0x20
2622#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_5_DEBOUNCE_EN_SHIFT 5 2622#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_5_DEBOUNCE_EN_SHIFT 0x05
2623#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_4_DEBOUNCE_EN 0x10 2623#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_4_DEBOUNCE_EN 0x10
2624#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_4_DEBOUNCE_EN_SHIFT 4 2624#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_4_DEBOUNCE_EN_SHIFT 0x04
2625#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_3_DEBOUNCE_EN 0x08 2625#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_3_DEBOUNCE_EN 0x08
2626#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_3_DEBOUNCE_EN_SHIFT 3 2626#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_3_DEBOUNCE_EN_SHIFT 0x03
2627#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_2_DEBOUNCE_EN 0x04 2627#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_2_DEBOUNCE_EN 0x04
2628#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_2_DEBOUNCE_EN_SHIFT 2 2628#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_2_DEBOUNCE_EN_SHIFT 0x02
2629#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_1_DEBOUNCE_EN 0x02 2629#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_1_DEBOUNCE_EN 0x02
2630#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_1_DEBOUNCE_EN_SHIFT 1 2630#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_1_DEBOUNCE_EN_SHIFT 0x01
2631#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_0_DEBOUNCE_EN 0x01 2631#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_0_DEBOUNCE_EN 0x01
2632#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_0_DEBOUNCE_EN_SHIFT 0 2632#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_0_DEBOUNCE_EN_SHIFT 0x00
2633 2633
2634/* Bit definitions for GPIO_CLEAR_DATA_OUT */ 2634/* Bit definitions for GPIO_CLEAR_DATA_OUT */
2635#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_7_CLEAR_DATA_OUT 0x80 2635#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_7_CLEAR_DATA_OUT 0x80
2636#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_7_CLEAR_DATA_OUT_SHIFT 7 2636#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_7_CLEAR_DATA_OUT_SHIFT 0x07
2637#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_6_CLEAR_DATA_OUT 0x40 2637#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_6_CLEAR_DATA_OUT 0x40
2638#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_6_CLEAR_DATA_OUT_SHIFT 6 2638#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_6_CLEAR_DATA_OUT_SHIFT 0x06
2639#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_5_CLEAR_DATA_OUT 0x20 2639#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_5_CLEAR_DATA_OUT 0x20
2640#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_5_CLEAR_DATA_OUT_SHIFT 5 2640#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_5_CLEAR_DATA_OUT_SHIFT 0x05
2641#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_4_CLEAR_DATA_OUT 0x10 2641#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_4_CLEAR_DATA_OUT 0x10
2642#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_4_CLEAR_DATA_OUT_SHIFT 4 2642#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_4_CLEAR_DATA_OUT_SHIFT 0x04
2643#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_3_CLEAR_DATA_OUT 0x08 2643#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_3_CLEAR_DATA_OUT 0x08
2644#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_3_CLEAR_DATA_OUT_SHIFT 3 2644#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_3_CLEAR_DATA_OUT_SHIFT 0x03
2645#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_2_CLEAR_DATA_OUT 0x04 2645#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_2_CLEAR_DATA_OUT 0x04
2646#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_2_CLEAR_DATA_OUT_SHIFT 2 2646#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_2_CLEAR_DATA_OUT_SHIFT 0x02
2647#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_1_CLEAR_DATA_OUT 0x02 2647#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_1_CLEAR_DATA_OUT 0x02
2648#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_1_CLEAR_DATA_OUT_SHIFT 1 2648#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_1_CLEAR_DATA_OUT_SHIFT 0x01
2649#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_0_CLEAR_DATA_OUT 0x01 2649#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_0_CLEAR_DATA_OUT 0x01
2650#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_0_CLEAR_DATA_OUT_SHIFT 0 2650#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_0_CLEAR_DATA_OUT_SHIFT 0x00
2651 2651
2652/* Bit definitions for GPIO_SET_DATA_OUT */ 2652/* Bit definitions for GPIO_SET_DATA_OUT */
2653#define PALMAS_GPIO_SET_DATA_OUT_GPIO_7_SET_DATA_OUT 0x80 2653#define PALMAS_GPIO_SET_DATA_OUT_GPIO_7_SET_DATA_OUT 0x80
2654#define PALMAS_GPIO_SET_DATA_OUT_GPIO_7_SET_DATA_OUT_SHIFT 7 2654#define PALMAS_GPIO_SET_DATA_OUT_GPIO_7_SET_DATA_OUT_SHIFT 0x07
2655#define PALMAS_GPIO_SET_DATA_OUT_GPIO_6_SET_DATA_OUT 0x40 2655#define PALMAS_GPIO_SET_DATA_OUT_GPIO_6_SET_DATA_OUT 0x40
2656#define PALMAS_GPIO_SET_DATA_OUT_GPIO_6_SET_DATA_OUT_SHIFT 6 2656#define PALMAS_GPIO_SET_DATA_OUT_GPIO_6_SET_DATA_OUT_SHIFT 0x06
2657#define PALMAS_GPIO_SET_DATA_OUT_GPIO_5_SET_DATA_OUT 0x20 2657#define PALMAS_GPIO_SET_DATA_OUT_GPIO_5_SET_DATA_OUT 0x20
2658#define PALMAS_GPIO_SET_DATA_OUT_GPIO_5_SET_DATA_OUT_SHIFT 5 2658#define PALMAS_GPIO_SET_DATA_OUT_GPIO_5_SET_DATA_OUT_SHIFT 0x05
2659#define PALMAS_GPIO_SET_DATA_OUT_GPIO_4_SET_DATA_OUT 0x10 2659#define PALMAS_GPIO_SET_DATA_OUT_GPIO_4_SET_DATA_OUT 0x10
2660#define PALMAS_GPIO_SET_DATA_OUT_GPIO_4_SET_DATA_OUT_SHIFT 4 2660#define PALMAS_GPIO_SET_DATA_OUT_GPIO_4_SET_DATA_OUT_SHIFT 0x04
2661#define PALMAS_GPIO_SET_DATA_OUT_GPIO_3_SET_DATA_OUT 0x08 2661#define PALMAS_GPIO_SET_DATA_OUT_GPIO_3_SET_DATA_OUT 0x08
2662#define PALMAS_GPIO_SET_DATA_OUT_GPIO_3_SET_DATA_OUT_SHIFT 3 2662#define PALMAS_GPIO_SET_DATA_OUT_GPIO_3_SET_DATA_OUT_SHIFT 0x03
2663#define PALMAS_GPIO_SET_DATA_OUT_GPIO_2_SET_DATA_OUT 0x04 2663#define PALMAS_GPIO_SET_DATA_OUT_GPIO_2_SET_DATA_OUT 0x04
2664#define PALMAS_GPIO_SET_DATA_OUT_GPIO_2_SET_DATA_OUT_SHIFT 2 2664#define PALMAS_GPIO_SET_DATA_OUT_GPIO_2_SET_DATA_OUT_SHIFT 0x02
2665#define PALMAS_GPIO_SET_DATA_OUT_GPIO_1_SET_DATA_OUT 0x02 2665#define PALMAS_GPIO_SET_DATA_OUT_GPIO_1_SET_DATA_OUT 0x02
2666#define PALMAS_GPIO_SET_DATA_OUT_GPIO_1_SET_DATA_OUT_SHIFT 1 2666#define PALMAS_GPIO_SET_DATA_OUT_GPIO_1_SET_DATA_OUT_SHIFT 0x01
2667#define PALMAS_GPIO_SET_DATA_OUT_GPIO_0_SET_DATA_OUT 0x01 2667#define PALMAS_GPIO_SET_DATA_OUT_GPIO_0_SET_DATA_OUT 0x01
2668#define PALMAS_GPIO_SET_DATA_OUT_GPIO_0_SET_DATA_OUT_SHIFT 0 2668#define PALMAS_GPIO_SET_DATA_OUT_GPIO_0_SET_DATA_OUT_SHIFT 0x00
2669 2669
2670/* Bit definitions for PU_PD_GPIO_CTRL1 */ 2670/* Bit definitions for PU_PD_GPIO_CTRL1 */
2671#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_3_PD 0x40 2671#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_3_PD 0x40
2672#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_3_PD_SHIFT 6 2672#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_3_PD_SHIFT 0x06
2673#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_2_PU 0x20 2673#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_2_PU 0x20
2674#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_2_PU_SHIFT 5 2674#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_2_PU_SHIFT 0x05
2675#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_2_PD 0x10 2675#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_2_PD 0x10
2676#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_2_PD_SHIFT 4 2676#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_2_PD_SHIFT 0x04
2677#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_1_PU 0x08 2677#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_1_PU 0x08
2678#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_1_PU_SHIFT 3 2678#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_1_PU_SHIFT 0x03
2679#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_1_PD 0x04 2679#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_1_PD 0x04
2680#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_1_PD_SHIFT 2 2680#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_1_PD_SHIFT 0x02
2681#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_0_PD 0x01 2681#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_0_PD 0x01
2682#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_0_PD_SHIFT 0 2682#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_0_PD_SHIFT 0x00
2683 2683
2684/* Bit definitions for PU_PD_GPIO_CTRL2 */ 2684/* Bit definitions for PU_PD_GPIO_CTRL2 */
2685#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_7_PD 0x40 2685#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_7_PD 0x40
2686#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_7_PD_SHIFT 6 2686#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_7_PD_SHIFT 0x06
2687#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_6_PU 0x20 2687#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_6_PU 0x20
2688#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_6_PU_SHIFT 5 2688#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_6_PU_SHIFT 0x05
2689#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_6_PD 0x10 2689#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_6_PD 0x10
2690#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_6_PD_SHIFT 4 2690#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_6_PD_SHIFT 0x04
2691#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_5_PU 0x08 2691#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_5_PU 0x08
2692#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_5_PU_SHIFT 3 2692#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_5_PU_SHIFT 0x03
2693#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_5_PD 0x04 2693#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_5_PD 0x04
2694#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_5_PD_SHIFT 2 2694#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_5_PD_SHIFT 0x02
2695#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_4_PU 0x02 2695#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_4_PU 0x02
2696#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_4_PU_SHIFT 1 2696#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_4_PU_SHIFT 0x01
2697#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_4_PD 0x01 2697#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_4_PD 0x01
2698#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_4_PD_SHIFT 0 2698#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_4_PD_SHIFT 0x00
2699 2699
2700/* Bit definitions for OD_OUTPUT_GPIO_CTRL */ 2700/* Bit definitions for OD_OUTPUT_GPIO_CTRL */
2701#define PALMAS_OD_OUTPUT_GPIO_CTRL_GPIO_5_OD 0x20 2701#define PALMAS_OD_OUTPUT_GPIO_CTRL_GPIO_5_OD 0x20
2702#define PALMAS_OD_OUTPUT_GPIO_CTRL_GPIO_5_OD_SHIFT 5 2702#define PALMAS_OD_OUTPUT_GPIO_CTRL_GPIO_5_OD_SHIFT 0x05
2703#define PALMAS_OD_OUTPUT_GPIO_CTRL_GPIO_2_OD 0x04 2703#define PALMAS_OD_OUTPUT_GPIO_CTRL_GPIO_2_OD 0x04
2704#define PALMAS_OD_OUTPUT_GPIO_CTRL_GPIO_2_OD_SHIFT 2 2704#define PALMAS_OD_OUTPUT_GPIO_CTRL_GPIO_2_OD_SHIFT 0x02
2705#define PALMAS_OD_OUTPUT_GPIO_CTRL_GPIO_1_OD 0x02 2705#define PALMAS_OD_OUTPUT_GPIO_CTRL_GPIO_1_OD 0x02
2706#define PALMAS_OD_OUTPUT_GPIO_CTRL_GPIO_1_OD_SHIFT 1 2706#define PALMAS_OD_OUTPUT_GPIO_CTRL_GPIO_1_OD_SHIFT 0x01
2707 2707
2708/* Registers for function GPADC */ 2708/* Registers for function GPADC */
2709#define PALMAS_GPADC_CTRL1 0x0 2709#define PALMAS_GPADC_CTRL1 0x00
2710#define PALMAS_GPADC_CTRL2 0x1 2710#define PALMAS_GPADC_CTRL2 0x01
2711#define PALMAS_GPADC_RT_CTRL 0x2 2711#define PALMAS_GPADC_RT_CTRL 0x02
2712#define PALMAS_GPADC_AUTO_CTRL 0x3 2712#define PALMAS_GPADC_AUTO_CTRL 0x03
2713#define PALMAS_GPADC_STATUS 0x4 2713#define PALMAS_GPADC_STATUS 0x04
2714#define PALMAS_GPADC_RT_SELECT 0x5 2714#define PALMAS_GPADC_RT_SELECT 0x05
2715#define PALMAS_GPADC_RT_CONV0_LSB 0x6 2715#define PALMAS_GPADC_RT_CONV0_LSB 0x06
2716#define PALMAS_GPADC_RT_CONV0_MSB 0x7 2716#define PALMAS_GPADC_RT_CONV0_MSB 0x07
2717#define PALMAS_GPADC_AUTO_SELECT 0x8 2717#define PALMAS_GPADC_AUTO_SELECT 0x08
2718#define PALMAS_GPADC_AUTO_CONV0_LSB 0x9 2718#define PALMAS_GPADC_AUTO_CONV0_LSB 0x09
2719#define PALMAS_GPADC_AUTO_CONV0_MSB 0xA 2719#define PALMAS_GPADC_AUTO_CONV0_MSB 0x0A
2720#define PALMAS_GPADC_AUTO_CONV1_LSB 0xB 2720#define PALMAS_GPADC_AUTO_CONV1_LSB 0x0B
2721#define PALMAS_GPADC_AUTO_CONV1_MSB 0xC 2721#define PALMAS_GPADC_AUTO_CONV1_MSB 0x0C
2722#define PALMAS_GPADC_SW_SELECT 0xD 2722#define PALMAS_GPADC_SW_SELECT 0x0D
2723#define PALMAS_GPADC_SW_CONV0_LSB 0xE 2723#define PALMAS_GPADC_SW_CONV0_LSB 0x0E
2724#define PALMAS_GPADC_SW_CONV0_MSB 0xF 2724#define PALMAS_GPADC_SW_CONV0_MSB 0x0F
2725#define PALMAS_GPADC_THRES_CONV0_LSB 0x10 2725#define PALMAS_GPADC_THRES_CONV0_LSB 0x10
2726#define PALMAS_GPADC_THRES_CONV0_MSB 0x11 2726#define PALMAS_GPADC_THRES_CONV0_MSB 0x11
2727#define PALMAS_GPADC_THRES_CONV1_LSB 0x12 2727#define PALMAS_GPADC_THRES_CONV1_LSB 0x12
@@ -2731,150 +2731,150 @@ enum usb_irq_events {
2731 2731
2732/* Bit definitions for GPADC_CTRL1 */ 2732/* Bit definitions for GPADC_CTRL1 */
2733#define PALMAS_GPADC_CTRL1_RESERVED_MASK 0xc0 2733#define PALMAS_GPADC_CTRL1_RESERVED_MASK 0xc0
2734#define PALMAS_GPADC_CTRL1_RESERVED_SHIFT 6 2734#define PALMAS_GPADC_CTRL1_RESERVED_SHIFT 0x06
2735#define PALMAS_GPADC_CTRL1_CURRENT_SRC_CH3_MASK 0x30 2735#define PALMAS_GPADC_CTRL1_CURRENT_SRC_CH3_MASK 0x30
2736#define PALMAS_GPADC_CTRL1_CURRENT_SRC_CH3_SHIFT 4 2736#define PALMAS_GPADC_CTRL1_CURRENT_SRC_CH3_SHIFT 0x04
2737#define PALMAS_GPADC_CTRL1_CURRENT_SRC_CH0_MASK 0x0c 2737#define PALMAS_GPADC_CTRL1_CURRENT_SRC_CH0_MASK 0x0c
2738#define PALMAS_GPADC_CTRL1_CURRENT_SRC_CH0_SHIFT 2 2738#define PALMAS_GPADC_CTRL1_CURRENT_SRC_CH0_SHIFT 0x02
2739#define PALMAS_GPADC_CTRL1_BAT_REMOVAL_DET 0x02 2739#define PALMAS_GPADC_CTRL1_BAT_REMOVAL_DET 0x02
2740#define PALMAS_GPADC_CTRL1_BAT_REMOVAL_DET_SHIFT 1 2740#define PALMAS_GPADC_CTRL1_BAT_REMOVAL_DET_SHIFT 0x01
2741#define PALMAS_GPADC_CTRL1_GPADC_FORCE 0x01 2741#define PALMAS_GPADC_CTRL1_GPADC_FORCE 0x01
2742#define PALMAS_GPADC_CTRL1_GPADC_FORCE_SHIFT 0 2742#define PALMAS_GPADC_CTRL1_GPADC_FORCE_SHIFT 0x00
2743 2743
2744/* Bit definitions for GPADC_CTRL2 */ 2744/* Bit definitions for GPADC_CTRL2 */
2745#define PALMAS_GPADC_CTRL2_RESERVED_MASK 0x06 2745#define PALMAS_GPADC_CTRL2_RESERVED_MASK 0x06
2746#define PALMAS_GPADC_CTRL2_RESERVED_SHIFT 1 2746#define PALMAS_GPADC_CTRL2_RESERVED_SHIFT 0x01
2747 2747
2748/* Bit definitions for GPADC_RT_CTRL */ 2748/* Bit definitions for GPADC_RT_CTRL */
2749#define PALMAS_GPADC_RT_CTRL_EXTEND_DELAY 0x02 2749#define PALMAS_GPADC_RT_CTRL_EXTEND_DELAY 0x02
2750#define PALMAS_GPADC_RT_CTRL_EXTEND_DELAY_SHIFT 1 2750#define PALMAS_GPADC_RT_CTRL_EXTEND_DELAY_SHIFT 0x01
2751#define PALMAS_GPADC_RT_CTRL_START_POLARITY 0x01 2751#define PALMAS_GPADC_RT_CTRL_START_POLARITY 0x01
2752#define PALMAS_GPADC_RT_CTRL_START_POLARITY_SHIFT 0 2752#define PALMAS_GPADC_RT_CTRL_START_POLARITY_SHIFT 0x00
2753 2753
2754/* Bit definitions for GPADC_AUTO_CTRL */ 2754/* Bit definitions for GPADC_AUTO_CTRL */
2755#define PALMAS_GPADC_AUTO_CTRL_SHUTDOWN_CONV1 0x80 2755#define PALMAS_GPADC_AUTO_CTRL_SHUTDOWN_CONV1 0x80
2756#define PALMAS_GPADC_AUTO_CTRL_SHUTDOWN_CONV1_SHIFT 7 2756#define PALMAS_GPADC_AUTO_CTRL_SHUTDOWN_CONV1_SHIFT 0x07
2757#define PALMAS_GPADC_AUTO_CTRL_SHUTDOWN_CONV0 0x40 2757#define PALMAS_GPADC_AUTO_CTRL_SHUTDOWN_CONV0 0x40
2758#define PALMAS_GPADC_AUTO_CTRL_SHUTDOWN_CONV0_SHIFT 6 2758#define PALMAS_GPADC_AUTO_CTRL_SHUTDOWN_CONV0_SHIFT 0x06
2759#define PALMAS_GPADC_AUTO_CTRL_AUTO_CONV1_EN 0x20 2759#define PALMAS_GPADC_AUTO_CTRL_AUTO_CONV1_EN 0x20
2760#define PALMAS_GPADC_AUTO_CTRL_AUTO_CONV1_EN_SHIFT 5 2760#define PALMAS_GPADC_AUTO_CTRL_AUTO_CONV1_EN_SHIFT 0x05
2761#define PALMAS_GPADC_AUTO_CTRL_AUTO_CONV0_EN 0x10 2761#define PALMAS_GPADC_AUTO_CTRL_AUTO_CONV0_EN 0x10
2762#define PALMAS_GPADC_AUTO_CTRL_AUTO_CONV0_EN_SHIFT 4 2762#define PALMAS_GPADC_AUTO_CTRL_AUTO_CONV0_EN_SHIFT 0x04
2763#define PALMAS_GPADC_AUTO_CTRL_COUNTER_CONV_MASK 0x0f 2763#define PALMAS_GPADC_AUTO_CTRL_COUNTER_CONV_MASK 0x0F
2764#define PALMAS_GPADC_AUTO_CTRL_COUNTER_CONV_SHIFT 0 2764#define PALMAS_GPADC_AUTO_CTRL_COUNTER_CONV_SHIFT 0x00
2765 2765
2766/* Bit definitions for GPADC_STATUS */ 2766/* Bit definitions for GPADC_STATUS */
2767#define PALMAS_GPADC_STATUS_GPADC_AVAILABLE 0x10 2767#define PALMAS_GPADC_STATUS_GPADC_AVAILABLE 0x10
2768#define PALMAS_GPADC_STATUS_GPADC_AVAILABLE_SHIFT 4 2768#define PALMAS_GPADC_STATUS_GPADC_AVAILABLE_SHIFT 0x04
2769 2769
2770/* Bit definitions for GPADC_RT_SELECT */ 2770/* Bit definitions for GPADC_RT_SELECT */
2771#define PALMAS_GPADC_RT_SELECT_RT_CONV_EN 0x80 2771#define PALMAS_GPADC_RT_SELECT_RT_CONV_EN 0x80
2772#define PALMAS_GPADC_RT_SELECT_RT_CONV_EN_SHIFT 7 2772#define PALMAS_GPADC_RT_SELECT_RT_CONV_EN_SHIFT 0x07
2773#define PALMAS_GPADC_RT_SELECT_RT_CONV0_SEL_MASK 0x0f 2773#define PALMAS_GPADC_RT_SELECT_RT_CONV0_SEL_MASK 0x0F
2774#define PALMAS_GPADC_RT_SELECT_RT_CONV0_SEL_SHIFT 0 2774#define PALMAS_GPADC_RT_SELECT_RT_CONV0_SEL_SHIFT 0x00
2775 2775
2776/* Bit definitions for GPADC_RT_CONV0_LSB */ 2776/* Bit definitions for GPADC_RT_CONV0_LSB */
2777#define PALMAS_GPADC_RT_CONV0_LSB_RT_CONV0_LSB_MASK 0xff 2777#define PALMAS_GPADC_RT_CONV0_LSB_RT_CONV0_LSB_MASK 0xFF
2778#define PALMAS_GPADC_RT_CONV0_LSB_RT_CONV0_LSB_SHIFT 0 2778#define PALMAS_GPADC_RT_CONV0_LSB_RT_CONV0_LSB_SHIFT 0x00
2779 2779
2780/* Bit definitions for GPADC_RT_CONV0_MSB */ 2780/* Bit definitions for GPADC_RT_CONV0_MSB */
2781#define PALMAS_GPADC_RT_CONV0_MSB_RT_CONV0_MSB_MASK 0x0f 2781#define PALMAS_GPADC_RT_CONV0_MSB_RT_CONV0_MSB_MASK 0x0F
2782#define PALMAS_GPADC_RT_CONV0_MSB_RT_CONV0_MSB_SHIFT 0 2782#define PALMAS_GPADC_RT_CONV0_MSB_RT_CONV0_MSB_SHIFT 0x00
2783 2783
2784/* Bit definitions for GPADC_AUTO_SELECT */ 2784/* Bit definitions for GPADC_AUTO_SELECT */
2785#define PALMAS_GPADC_AUTO_SELECT_AUTO_CONV1_SEL_MASK 0xf0 2785#define PALMAS_GPADC_AUTO_SELECT_AUTO_CONV1_SEL_MASK 0xF0
2786#define PALMAS_GPADC_AUTO_SELECT_AUTO_CONV1_SEL_SHIFT 4 2786#define PALMAS_GPADC_AUTO_SELECT_AUTO_CONV1_SEL_SHIFT 0x04
2787#define PALMAS_GPADC_AUTO_SELECT_AUTO_CONV0_SEL_MASK 0x0f 2787#define PALMAS_GPADC_AUTO_SELECT_AUTO_CONV0_SEL_MASK 0x0F
2788#define PALMAS_GPADC_AUTO_SELECT_AUTO_CONV0_SEL_SHIFT 0 2788#define PALMAS_GPADC_AUTO_SELECT_AUTO_CONV0_SEL_SHIFT 0x00
2789 2789
2790/* Bit definitions for GPADC_AUTO_CONV0_LSB */ 2790/* Bit definitions for GPADC_AUTO_CONV0_LSB */
2791#define PALMAS_GPADC_AUTO_CONV0_LSB_AUTO_CONV0_LSB_MASK 0xff 2791#define PALMAS_GPADC_AUTO_CONV0_LSB_AUTO_CONV0_LSB_MASK 0xFF
2792#define PALMAS_GPADC_AUTO_CONV0_LSB_AUTO_CONV0_LSB_SHIFT 0 2792#define PALMAS_GPADC_AUTO_CONV0_LSB_AUTO_CONV0_LSB_SHIFT 0x00
2793 2793
2794/* Bit definitions for GPADC_AUTO_CONV0_MSB */ 2794/* Bit definitions for GPADC_AUTO_CONV0_MSB */
2795#define PALMAS_GPADC_AUTO_CONV0_MSB_AUTO_CONV0_MSB_MASK 0x0f 2795#define PALMAS_GPADC_AUTO_CONV0_MSB_AUTO_CONV0_MSB_MASK 0x0F
2796#define PALMAS_GPADC_AUTO_CONV0_MSB_AUTO_CONV0_MSB_SHIFT 0 2796#define PALMAS_GPADC_AUTO_CONV0_MSB_AUTO_CONV0_MSB_SHIFT 0x00
2797 2797
2798/* Bit definitions for GPADC_AUTO_CONV1_LSB */ 2798/* Bit definitions for GPADC_AUTO_CONV1_LSB */
2799#define PALMAS_GPADC_AUTO_CONV1_LSB_AUTO_CONV1_LSB_MASK 0xff 2799#define PALMAS_GPADC_AUTO_CONV1_LSB_AUTO_CONV1_LSB_MASK 0xFF
2800#define PALMAS_GPADC_AUTO_CONV1_LSB_AUTO_CONV1_LSB_SHIFT 0 2800#define PALMAS_GPADC_AUTO_CONV1_LSB_AUTO_CONV1_LSB_SHIFT 0x00
2801 2801
2802/* Bit definitions for GPADC_AUTO_CONV1_MSB */ 2802/* Bit definitions for GPADC_AUTO_CONV1_MSB */
2803#define PALMAS_GPADC_AUTO_CONV1_MSB_AUTO_CONV1_MSB_MASK 0x0f 2803#define PALMAS_GPADC_AUTO_CONV1_MSB_AUTO_CONV1_MSB_MASK 0x0F
2804#define PALMAS_GPADC_AUTO_CONV1_MSB_AUTO_CONV1_MSB_SHIFT 0 2804#define PALMAS_GPADC_AUTO_CONV1_MSB_AUTO_CONV1_MSB_SHIFT 0x00
2805 2805
2806/* Bit definitions for GPADC_SW_SELECT */ 2806/* Bit definitions for GPADC_SW_SELECT */
2807#define PALMAS_GPADC_SW_SELECT_SW_CONV_EN 0x80 2807#define PALMAS_GPADC_SW_SELECT_SW_CONV_EN 0x80
2808#define PALMAS_GPADC_SW_SELECT_SW_CONV_EN_SHIFT 7 2808#define PALMAS_GPADC_SW_SELECT_SW_CONV_EN_SHIFT 0x07
2809#define PALMAS_GPADC_SW_SELECT_SW_START_CONV0 0x10 2809#define PALMAS_GPADC_SW_SELECT_SW_START_CONV0 0x10
2810#define PALMAS_GPADC_SW_SELECT_SW_START_CONV0_SHIFT 4 2810#define PALMAS_GPADC_SW_SELECT_SW_START_CONV0_SHIFT 0x04
2811#define PALMAS_GPADC_SW_SELECT_SW_CONV0_SEL_MASK 0x0f 2811#define PALMAS_GPADC_SW_SELECT_SW_CONV0_SEL_MASK 0x0F
2812#define PALMAS_GPADC_SW_SELECT_SW_CONV0_SEL_SHIFT 0 2812#define PALMAS_GPADC_SW_SELECT_SW_CONV0_SEL_SHIFT 0x00
2813 2813
2814/* Bit definitions for GPADC_SW_CONV0_LSB */ 2814/* Bit definitions for GPADC_SW_CONV0_LSB */
2815#define PALMAS_GPADC_SW_CONV0_LSB_SW_CONV0_LSB_MASK 0xff 2815#define PALMAS_GPADC_SW_CONV0_LSB_SW_CONV0_LSB_MASK 0xFF
2816#define PALMAS_GPADC_SW_CONV0_LSB_SW_CONV0_LSB_SHIFT 0 2816#define PALMAS_GPADC_SW_CONV0_LSB_SW_CONV0_LSB_SHIFT 0x00
2817 2817
2818/* Bit definitions for GPADC_SW_CONV0_MSB */ 2818/* Bit definitions for GPADC_SW_CONV0_MSB */
2819#define PALMAS_GPADC_SW_CONV0_MSB_SW_CONV0_MSB_MASK 0x0f 2819#define PALMAS_GPADC_SW_CONV0_MSB_SW_CONV0_MSB_MASK 0x0F
2820#define PALMAS_GPADC_SW_CONV0_MSB_SW_CONV0_MSB_SHIFT 0 2820#define PALMAS_GPADC_SW_CONV0_MSB_SW_CONV0_MSB_SHIFT 0x00
2821 2821
2822/* Bit definitions for GPADC_THRES_CONV0_LSB */ 2822/* Bit definitions for GPADC_THRES_CONV0_LSB */
2823#define PALMAS_GPADC_THRES_CONV0_LSB_THRES_CONV0_LSB_MASK 0xff 2823#define PALMAS_GPADC_THRES_CONV0_LSB_THRES_CONV0_LSB_MASK 0xFF
2824#define PALMAS_GPADC_THRES_CONV0_LSB_THRES_CONV0_LSB_SHIFT 0 2824#define PALMAS_GPADC_THRES_CONV0_LSB_THRES_CONV0_LSB_SHIFT 0x00
2825 2825
2826/* Bit definitions for GPADC_THRES_CONV0_MSB */ 2826/* Bit definitions for GPADC_THRES_CONV0_MSB */
2827#define PALMAS_GPADC_THRES_CONV0_MSB_THRES_CONV0_POL 0x80 2827#define PALMAS_GPADC_THRES_CONV0_MSB_THRES_CONV0_POL 0x80
2828#define PALMAS_GPADC_THRES_CONV0_MSB_THRES_CONV0_POL_SHIFT 7 2828#define PALMAS_GPADC_THRES_CONV0_MSB_THRES_CONV0_POL_SHIFT 0x07
2829#define PALMAS_GPADC_THRES_CONV0_MSB_THRES_CONV0_MSB_MASK 0x0f 2829#define PALMAS_GPADC_THRES_CONV0_MSB_THRES_CONV0_MSB_MASK 0x0F
2830#define PALMAS_GPADC_THRES_CONV0_MSB_THRES_CONV0_MSB_SHIFT 0 2830#define PALMAS_GPADC_THRES_CONV0_MSB_THRES_CONV0_MSB_SHIFT 0x00
2831 2831
2832/* Bit definitions for GPADC_THRES_CONV1_LSB */ 2832/* Bit definitions for GPADC_THRES_CONV1_LSB */
2833#define PALMAS_GPADC_THRES_CONV1_LSB_THRES_CONV1_LSB_MASK 0xff 2833#define PALMAS_GPADC_THRES_CONV1_LSB_THRES_CONV1_LSB_MASK 0xFF
2834#define PALMAS_GPADC_THRES_CONV1_LSB_THRES_CONV1_LSB_SHIFT 0 2834#define PALMAS_GPADC_THRES_CONV1_LSB_THRES_CONV1_LSB_SHIFT 0x00
2835 2835
2836/* Bit definitions for GPADC_THRES_CONV1_MSB */ 2836/* Bit definitions for GPADC_THRES_CONV1_MSB */
2837#define PALMAS_GPADC_THRES_CONV1_MSB_THRES_CONV1_POL 0x80 2837#define PALMAS_GPADC_THRES_CONV1_MSB_THRES_CONV1_POL 0x80
2838#define PALMAS_GPADC_THRES_CONV1_MSB_THRES_CONV1_POL_SHIFT 7 2838#define PALMAS_GPADC_THRES_CONV1_MSB_THRES_CONV1_POL_SHIFT 0x07
2839#define PALMAS_GPADC_THRES_CONV1_MSB_THRES_CONV1_MSB_MASK 0x0f 2839#define PALMAS_GPADC_THRES_CONV1_MSB_THRES_CONV1_MSB_MASK 0x0F
2840#define PALMAS_GPADC_THRES_CONV1_MSB_THRES_CONV1_MSB_SHIFT 0 2840#define PALMAS_GPADC_THRES_CONV1_MSB_THRES_CONV1_MSB_SHIFT 0x00
2841 2841
2842/* Bit definitions for GPADC_SMPS_ILMONITOR_EN */ 2842/* Bit definitions for GPADC_SMPS_ILMONITOR_EN */
2843#define PALMAS_GPADC_SMPS_ILMONITOR_EN_SMPS_ILMON_EN 0x20 2843#define PALMAS_GPADC_SMPS_ILMONITOR_EN_SMPS_ILMON_EN 0x20
2844#define PALMAS_GPADC_SMPS_ILMONITOR_EN_SMPS_ILMON_EN_SHIFT 5 2844#define PALMAS_GPADC_SMPS_ILMONITOR_EN_SMPS_ILMON_EN_SHIFT 0x05
2845#define PALMAS_GPADC_SMPS_ILMONITOR_EN_SMPS_ILMON_REXT 0x10 2845#define PALMAS_GPADC_SMPS_ILMONITOR_EN_SMPS_ILMON_REXT 0x10
2846#define PALMAS_GPADC_SMPS_ILMONITOR_EN_SMPS_ILMON_REXT_SHIFT 4 2846#define PALMAS_GPADC_SMPS_ILMONITOR_EN_SMPS_ILMON_REXT_SHIFT 0x04
2847#define PALMAS_GPADC_SMPS_ILMONITOR_EN_SMPS_ILMON_SEL_MASK 0x0f 2847#define PALMAS_GPADC_SMPS_ILMONITOR_EN_SMPS_ILMON_SEL_MASK 0x0F
2848#define PALMAS_GPADC_SMPS_ILMONITOR_EN_SMPS_ILMON_SEL_SHIFT 0 2848#define PALMAS_GPADC_SMPS_ILMONITOR_EN_SMPS_ILMON_SEL_SHIFT 0x00
2849 2849
2850/* Bit definitions for GPADC_SMPS_VSEL_MONITORING */ 2850/* Bit definitions for GPADC_SMPS_VSEL_MONITORING */
2851#define PALMAS_GPADC_SMPS_VSEL_MONITORING_ACTIVE_PHASE 0x80 2851#define PALMAS_GPADC_SMPS_VSEL_MONITORING_ACTIVE_PHASE 0x80
2852#define PALMAS_GPADC_SMPS_VSEL_MONITORING_ACTIVE_PHASE_SHIFT 7 2852#define PALMAS_GPADC_SMPS_VSEL_MONITORING_ACTIVE_PHASE_SHIFT 0x07
2853#define PALMAS_GPADC_SMPS_VSEL_MONITORING_SMPS_VSEL_MONITORING_MASK 0x7f 2853#define PALMAS_GPADC_SMPS_VSEL_MONITORING_SMPS_VSEL_MONITORING_MASK 0x7F
2854#define PALMAS_GPADC_SMPS_VSEL_MONITORING_SMPS_VSEL_MONITORING_SHIFT 0 2854#define PALMAS_GPADC_SMPS_VSEL_MONITORING_SMPS_VSEL_MONITORING_SHIFT 0x00
2855 2855
2856/* Registers for function GPADC */ 2856/* Registers for function GPADC */
2857#define PALMAS_GPADC_TRIM1 0x0 2857#define PALMAS_GPADC_TRIM1 0x00
2858#define PALMAS_GPADC_TRIM2 0x1 2858#define PALMAS_GPADC_TRIM2 0x01
2859#define PALMAS_GPADC_TRIM3 0x2 2859#define PALMAS_GPADC_TRIM3 0x02
2860#define PALMAS_GPADC_TRIM4 0x3 2860#define PALMAS_GPADC_TRIM4 0x03
2861#define PALMAS_GPADC_TRIM5 0x4 2861#define PALMAS_GPADC_TRIM5 0x04
2862#define PALMAS_GPADC_TRIM6 0x5 2862#define PALMAS_GPADC_TRIM6 0x05
2863#define PALMAS_GPADC_TRIM7 0x6 2863#define PALMAS_GPADC_TRIM7 0x06
2864#define PALMAS_GPADC_TRIM8 0x7 2864#define PALMAS_GPADC_TRIM8 0x07
2865#define PALMAS_GPADC_TRIM9 0x8 2865#define PALMAS_GPADC_TRIM9 0x08
2866#define PALMAS_GPADC_TRIM10 0x9 2866#define PALMAS_GPADC_TRIM10 0x09
2867#define PALMAS_GPADC_TRIM11 0xA 2867#define PALMAS_GPADC_TRIM11 0x0A
2868#define PALMAS_GPADC_TRIM12 0xB 2868#define PALMAS_GPADC_TRIM12 0x0B
2869#define PALMAS_GPADC_TRIM13 0xC 2869#define PALMAS_GPADC_TRIM13 0x0C
2870#define PALMAS_GPADC_TRIM14 0xD 2870#define PALMAS_GPADC_TRIM14 0x0D
2871#define PALMAS_GPADC_TRIM15 0xE 2871#define PALMAS_GPADC_TRIM15 0x0E
2872#define PALMAS_GPADC_TRIM16 0xF 2872#define PALMAS_GPADC_TRIM16 0x0F
2873 2873
2874static inline int palmas_read(struct palmas *palmas, unsigned int base, 2874static inline int palmas_read(struct palmas *palmas, unsigned int base,
2875 unsigned int reg, unsigned int *val) 2875 unsigned int reg, unsigned int *val)
2876{ 2876{
2877 unsigned int addr = PALMAS_BASE_TO_REG(base, reg); 2877 unsigned int addr = PALMAS_BASE_TO_REG(base, reg);
2878 int slave_id = PALMAS_BASE_TO_SLAVE(base); 2878 int slave_id = PALMAS_BASE_TO_SLAVE(base);
2879 2879
2880 return regmap_read(palmas->regmap[slave_id], addr, val); 2880 return regmap_read(palmas->regmap[slave_id], addr, val);
diff --git a/include/linux/mfd/pm8xxx/core.h b/include/linux/mfd/pm8xxx/core.h
deleted file mode 100644
index bd2f4f64e931..000000000000
--- a/include/linux/mfd/pm8xxx/core.h
+++ /dev/null
@@ -1,81 +0,0 @@
1/*
2 * Copyright (c) 2011, Code Aurora Forum. 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 and
6 * only version 2 as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 */
13/*
14 * Qualcomm PMIC 8xxx driver header file
15 *
16 */
17
18#ifndef __MFD_PM8XXX_CORE_H
19#define __MFD_PM8XXX_CORE_H
20
21#include <linux/mfd/core.h>
22
23struct pm8xxx_drvdata {
24 int (*pmic_readb) (const struct device *dev, u16 addr, u8 *val);
25 int (*pmic_writeb) (const struct device *dev, u16 addr, u8 val);
26 int (*pmic_read_buf) (const struct device *dev, u16 addr, u8 *buf,
27 int n);
28 int (*pmic_write_buf) (const struct device *dev, u16 addr, u8 *buf,
29 int n);
30 int (*pmic_read_irq_stat) (const struct device *dev, int irq);
31 void *pm_chip_data;
32};
33
34static inline int pm8xxx_readb(const struct device *dev, u16 addr, u8 *val)
35{
36 struct pm8xxx_drvdata *dd = dev_get_drvdata(dev);
37
38 if (!dd)
39 return -EINVAL;
40 return dd->pmic_readb(dev, addr, val);
41}
42
43static inline int pm8xxx_writeb(const struct device *dev, u16 addr, u8 val)
44{
45 struct pm8xxx_drvdata *dd = dev_get_drvdata(dev);
46
47 if (!dd)
48 return -EINVAL;
49 return dd->pmic_writeb(dev, addr, val);
50}
51
52static inline int pm8xxx_read_buf(const struct device *dev, u16 addr, u8 *buf,
53 int n)
54{
55 struct pm8xxx_drvdata *dd = dev_get_drvdata(dev);
56
57 if (!dd)
58 return -EINVAL;
59 return dd->pmic_read_buf(dev, addr, buf, n);
60}
61
62static inline int pm8xxx_write_buf(const struct device *dev, u16 addr, u8 *buf,
63 int n)
64{
65 struct pm8xxx_drvdata *dd = dev_get_drvdata(dev);
66
67 if (!dd)
68 return -EINVAL;
69 return dd->pmic_write_buf(dev, addr, buf, n);
70}
71
72static inline int pm8xxx_read_irq_stat(const struct device *dev, int irq)
73{
74 struct pm8xxx_drvdata *dd = dev_get_drvdata(dev);
75
76 if (!dd)
77 return -EINVAL;
78 return dd->pmic_read_irq_stat(dev, irq);
79}
80
81#endif
diff --git a/include/linux/mfd/rdc321x.h b/include/linux/mfd/rdc321x.h
index 4bdf19c8eedf..442743a8f915 100644
--- a/include/linux/mfd/rdc321x.h
+++ b/include/linux/mfd/rdc321x.h
@@ -12,7 +12,7 @@
12#define RDC321X_GPIO_CTRL_REG2 0x84 12#define RDC321X_GPIO_CTRL_REG2 0x84
13#define RDC321X_GPIO_DATA_REG2 0x88 13#define RDC321X_GPIO_DATA_REG2 0x88
14 14
15#define RDC321X_MAX_GPIO 58 15#define RDC321X_NUM_GPIO 59
16 16
17struct rdc321x_gpio_pdata { 17struct rdc321x_gpio_pdata {
18 struct pci_dev *sb_pdev; 18 struct pci_dev *sb_pdev;
diff --git a/include/linux/mfd/samsung/core.h b/include/linux/mfd/samsung/core.h
index 157e32b6ca28..47d84242940b 100644
--- a/include/linux/mfd/samsung/core.h
+++ b/include/linux/mfd/samsung/core.h
@@ -24,35 +24,36 @@ enum sec_device_type {
24}; 24};
25 25
26/** 26/**
27 * struct sec_pmic_dev - s5m87xx master device for sub-drivers 27 * struct sec_pmic_dev - s2m/s5m master device for sub-drivers
28 * @dev: master device of the chip (can be used to access platform data) 28 * @dev: Master device of the chip
29 * @pdata: pointer to private data used to pass platform data to child 29 * @pdata: Platform data populated with data from DTS
30 * @i2c: i2c client private data for regulator 30 * or board files
31 * @rtc: i2c client private data for rtc 31 * @regmap_pmic: Regmap associated with PMIC's I2C address
32 * @iolock: mutex for serializing io access 32 * @i2c: I2C client of the main driver
33 * @irqlock: mutex for buslock 33 * @device_type: Type of device, matches enum sec_device_type
34 * @irq_base: base IRQ number for sec-pmic, required for IRQs 34 * @irq_base: Base IRQ number for device, required for IRQs
35 * @irq: generic IRQ number for s5m87xx 35 * @irq: Generic IRQ number for device
36 * @ono: power onoff IRQ number for s5m87xx 36 * @irq_data: Runtime data structure for IRQ controller
37 * @irq_masks_cur: currently active value 37 * @ono: Power onoff IRQ number for s5m87xx
38 * @irq_masks_cache: cached hardware value 38 * @wakeup: Whether or not this is a wakeup device
39 * @type: indicate which s5m87xx "variant" is used 39 * @wtsr_smpl: Whether or not to enable in RTC driver the Watchdog
40 * Timer Software Reset (registers set to default value
41 * after PWRHOLD falling) and Sudden Momentary Power Loss
42 * (PMIC will enter power on sequence after short drop in
43 * VBATT voltage).
40 */ 44 */
41struct sec_pmic_dev { 45struct sec_pmic_dev {
42 struct device *dev; 46 struct device *dev;
43 struct sec_platform_data *pdata; 47 struct sec_platform_data *pdata;
44 struct regmap *regmap_pmic; 48 struct regmap *regmap_pmic;
45 struct regmap *regmap_rtc;
46 struct i2c_client *i2c; 49 struct i2c_client *i2c;
47 struct i2c_client *rtc;
48 50
49 int device_type; 51 unsigned long device_type;
50 int irq_base; 52 int irq_base;
51 int irq; 53 int irq;
52 struct regmap_irq_chip_data *irq_data; 54 struct regmap_irq_chip_data *irq_data;
53 55
54 int ono; 56 int ono;
55 unsigned long type;
56 bool wakeup; 57 bool wakeup;
57 bool wtsr_smpl; 58 bool wtsr_smpl;
58}; 59};
diff --git a/include/linux/mfd/samsung/rtc.h b/include/linux/mfd/samsung/rtc.h
index 3e02b768d537..b6401e7661c7 100644
--- a/include/linux/mfd/samsung/rtc.h
+++ b/include/linux/mfd/samsung/rtc.h
@@ -18,38 +18,38 @@
18#ifndef __LINUX_MFD_SEC_RTC_H 18#ifndef __LINUX_MFD_SEC_RTC_H
19#define __LINUX_MFD_SEC_RTC_H 19#define __LINUX_MFD_SEC_RTC_H
20 20
21enum sec_rtc_reg { 21enum s5m_rtc_reg {
22 SEC_RTC_SEC, 22 S5M_RTC_SEC,
23 SEC_RTC_MIN, 23 S5M_RTC_MIN,
24 SEC_RTC_HOUR, 24 S5M_RTC_HOUR,
25 SEC_RTC_WEEKDAY, 25 S5M_RTC_WEEKDAY,
26 SEC_RTC_DATE, 26 S5M_RTC_DATE,
27 SEC_RTC_MONTH, 27 S5M_RTC_MONTH,
28 SEC_RTC_YEAR1, 28 S5M_RTC_YEAR1,
29 SEC_RTC_YEAR2, 29 S5M_RTC_YEAR2,
30 SEC_ALARM0_SEC, 30 S5M_ALARM0_SEC,
31 SEC_ALARM0_MIN, 31 S5M_ALARM0_MIN,
32 SEC_ALARM0_HOUR, 32 S5M_ALARM0_HOUR,
33 SEC_ALARM0_WEEKDAY, 33 S5M_ALARM0_WEEKDAY,
34 SEC_ALARM0_DATE, 34 S5M_ALARM0_DATE,
35 SEC_ALARM0_MONTH, 35 S5M_ALARM0_MONTH,
36 SEC_ALARM0_YEAR1, 36 S5M_ALARM0_YEAR1,
37 SEC_ALARM0_YEAR2, 37 S5M_ALARM0_YEAR2,
38 SEC_ALARM1_SEC, 38 S5M_ALARM1_SEC,
39 SEC_ALARM1_MIN, 39 S5M_ALARM1_MIN,
40 SEC_ALARM1_HOUR, 40 S5M_ALARM1_HOUR,
41 SEC_ALARM1_WEEKDAY, 41 S5M_ALARM1_WEEKDAY,
42 SEC_ALARM1_DATE, 42 S5M_ALARM1_DATE,
43 SEC_ALARM1_MONTH, 43 S5M_ALARM1_MONTH,
44 SEC_ALARM1_YEAR1, 44 S5M_ALARM1_YEAR1,
45 SEC_ALARM1_YEAR2, 45 S5M_ALARM1_YEAR2,
46 SEC_ALARM0_CONF, 46 S5M_ALARM0_CONF,
47 SEC_ALARM1_CONF, 47 S5M_ALARM1_CONF,
48 SEC_RTC_STATUS, 48 S5M_RTC_STATUS,
49 SEC_WTSR_SMPL_CNTL, 49 S5M_WTSR_SMPL_CNTL,
50 SEC_RTC_UDR_CON, 50 S5M_RTC_UDR_CON,
51 51
52 SEC_RTC_REG_MAX, 52 S5M_RTC_REG_MAX,
53}; 53};
54 54
55enum s2mps_rtc_reg { 55enum s2mps_rtc_reg {
@@ -88,9 +88,9 @@ enum s2mps_rtc_reg {
88#define HOUR_12 (1 << 7) 88#define HOUR_12 (1 << 7)
89#define HOUR_AMPM (1 << 6) 89#define HOUR_AMPM (1 << 6)
90#define HOUR_PM (1 << 5) 90#define HOUR_PM (1 << 5)
91#define ALARM0_STATUS (1 << 1) 91#define S5M_ALARM0_STATUS (1 << 1)
92#define ALARM1_STATUS (1 << 2) 92#define S5M_ALARM1_STATUS (1 << 2)
93#define UPDATE_AD (1 << 0) 93#define S5M_UPDATE_AD (1 << 0)
94 94
95#define S2MPS_ALARM0_STATUS (1 << 2) 95#define S2MPS_ALARM0_STATUS (1 << 2)
96#define S2MPS_ALARM1_STATUS (1 << 1) 96#define S2MPS_ALARM1_STATUS (1 << 1)
@@ -101,16 +101,26 @@ enum s2mps_rtc_reg {
101#define MODEL24_SHIFT 1 101#define MODEL24_SHIFT 1
102#define MODEL24_MASK (1 << MODEL24_SHIFT) 102#define MODEL24_MASK (1 << MODEL24_SHIFT)
103/* RTC Update Register1 */ 103/* RTC Update Register1 */
104#define RTC_UDR_SHIFT 0 104#define S5M_RTC_UDR_SHIFT 0
105#define RTC_UDR_MASK (1 << RTC_UDR_SHIFT) 105#define S5M_RTC_UDR_MASK (1 << S5M_RTC_UDR_SHIFT)
106#define S2MPS_RTC_WUDR_SHIFT 4 106#define S2MPS_RTC_WUDR_SHIFT 4
107#define S2MPS_RTC_WUDR_MASK (1 << S2MPS_RTC_WUDR_SHIFT) 107#define S2MPS_RTC_WUDR_MASK (1 << S2MPS_RTC_WUDR_SHIFT)
108#define S2MPS_RTC_RUDR_SHIFT 0 108#define S2MPS_RTC_RUDR_SHIFT 0
109#define S2MPS_RTC_RUDR_MASK (1 << S2MPS_RTC_RUDR_SHIFT) 109#define S2MPS_RTC_RUDR_MASK (1 << S2MPS_RTC_RUDR_SHIFT)
110#define RTC_TCON_SHIFT 1 110#define RTC_TCON_SHIFT 1
111#define RTC_TCON_MASK (1 << RTC_TCON_SHIFT) 111#define RTC_TCON_MASK (1 << RTC_TCON_SHIFT)
112#define RTC_TIME_EN_SHIFT 3 112#define S5M_RTC_TIME_EN_SHIFT 3
113#define RTC_TIME_EN_MASK (1 << RTC_TIME_EN_SHIFT) 113#define S5M_RTC_TIME_EN_MASK (1 << S5M_RTC_TIME_EN_SHIFT)
114/*
115 * UDR_T field in S5M_RTC_UDR_CON register determines the time needed
116 * for updating alarm and time registers. Default is 7.32 ms.
117 */
118#define S5M_RTC_UDR_T_SHIFT 6
119#define S5M_RTC_UDR_T_MASK (0x3 << S5M_RTC_UDR_T_SHIFT)
120#define S5M_RTC_UDR_T_7320_US (0x0 << S5M_RTC_UDR_T_SHIFT)
121#define S5M_RTC_UDR_T_1830_US (0x1 << S5M_RTC_UDR_T_SHIFT)
122#define S5M_RTC_UDR_T_3660_US (0x2 << S5M_RTC_UDR_T_SHIFT)
123#define S5M_RTC_UDR_T_450_US (0x3 << S5M_RTC_UDR_T_SHIFT)
114 124
115/* RTC Hour register */ 125/* RTC Hour register */
116#define HOUR_PM_SHIFT 6 126#define HOUR_PM_SHIFT 6
diff --git a/include/linux/mfd/samsung/s2mps14.h b/include/linux/mfd/samsung/s2mps14.h
index 4b449b8ac548..900cd7a04314 100644
--- a/include/linux/mfd/samsung/s2mps14.h
+++ b/include/linux/mfd/samsung/s2mps14.h
@@ -148,6 +148,8 @@ enum s2mps14_regulators {
148#define S2MPS14_ENABLE_SHIFT 6 148#define S2MPS14_ENABLE_SHIFT 6
149/* On/Off controlled by PWREN */ 149/* On/Off controlled by PWREN */
150#define S2MPS14_ENABLE_SUSPEND (0x01 << S2MPS14_ENABLE_SHIFT) 150#define S2MPS14_ENABLE_SUSPEND (0x01 << S2MPS14_ENABLE_SHIFT)
151/* On/Off controlled by LDO10EN or EMMCEN */
152#define S2MPS14_ENABLE_EXT_CONTROL (0x00 << S2MPS14_ENABLE_SHIFT)
151#define S2MPS14_LDO_N_VOLTAGES (S2MPS14_LDO_VSEL_MASK + 1) 153#define S2MPS14_LDO_N_VOLTAGES (S2MPS14_LDO_VSEL_MASK + 1)
152#define S2MPS14_BUCK_N_VOLTAGES (S2MPS14_BUCK_VSEL_MASK + 1) 154#define S2MPS14_BUCK_N_VOLTAGES (S2MPS14_BUCK_VSEL_MASK + 1)
153 155
diff --git a/include/linux/mfd/stmpe.h b/include/linux/mfd/stmpe.h
index 48395a69a7e9..575a86c7fcbd 100644
--- a/include/linux/mfd/stmpe.h
+++ b/include/linux/mfd/stmpe.h
@@ -11,6 +11,7 @@
11#include <linux/mutex.h> 11#include <linux/mutex.h>
12 12
13struct device; 13struct device;
14struct regulator;
14 15
15enum stmpe_block { 16enum stmpe_block {
16 STMPE_BLOCK_GPIO = 1 << 0, 17 STMPE_BLOCK_GPIO = 1 << 0,
@@ -62,6 +63,8 @@ struct stmpe_client_info;
62 63
63/** 64/**
64 * struct stmpe - STMPE MFD structure 65 * struct stmpe - STMPE MFD structure
66 * @vcc: optional VCC regulator
67 * @vio: optional VIO regulator
65 * @lock: lock protecting I/O operations 68 * @lock: lock protecting I/O operations
66 * @irq_lock: IRQ bus lock 69 * @irq_lock: IRQ bus lock
67 * @dev: device, mostly for dev_dbg() 70 * @dev: device, mostly for dev_dbg()
@@ -73,13 +76,14 @@ struct stmpe_client_info;
73 * @regs: list of addresses of registers which are at different addresses on 76 * @regs: list of addresses of registers which are at different addresses on
74 * different variants. Indexed by one of STMPE_IDX_*. 77 * different variants. Indexed by one of STMPE_IDX_*.
75 * @irq: irq number for stmpe 78 * @irq: irq number for stmpe
76 * @irq_base: starting IRQ number for internal IRQs
77 * @num_gpios: number of gpios, differs for variants 79 * @num_gpios: number of gpios, differs for variants
78 * @ier: cache of IER registers for bus_lock 80 * @ier: cache of IER registers for bus_lock
79 * @oldier: cache of IER registers for bus_lock 81 * @oldier: cache of IER registers for bus_lock
80 * @pdata: platform data 82 * @pdata: platform data
81 */ 83 */
82struct stmpe { 84struct stmpe {
85 struct regulator *vcc;
86 struct regulator *vio;
83 struct mutex lock; 87 struct mutex lock;
84 struct mutex irq_lock; 88 struct mutex irq_lock;
85 struct device *dev; 89 struct device *dev;
@@ -91,7 +95,6 @@ struct stmpe {
91 const u8 *regs; 95 const u8 *regs;
92 96
93 int irq; 97 int irq;
94 int irq_base;
95 int num_gpios; 98 int num_gpios;
96 u8 ier[2]; 99 u8 ier[2];
97 u8 oldier[2]; 100 u8 oldier[2];
@@ -132,8 +135,6 @@ struct stmpe_keypad_platform_data {
132 135
133/** 136/**
134 * struct stmpe_gpio_platform_data - STMPE GPIO platform data 137 * struct stmpe_gpio_platform_data - STMPE GPIO platform data
135 * @gpio_base: first gpio number assigned. A maximum of
136 * %STMPE_NR_GPIOS GPIOs will be allocated.
137 * @norequest_mask: bitmask specifying which GPIOs should _not_ be 138 * @norequest_mask: bitmask specifying which GPIOs should _not_ be
138 * requestable due to different usage (e.g. touch, keypad) 139 * requestable due to different usage (e.g. touch, keypad)
139 * STMPE_GPIO_NOREQ_* macros can be used here. 140 * STMPE_GPIO_NOREQ_* macros can be used here.
@@ -141,7 +142,6 @@ struct stmpe_keypad_platform_data {
141 * @remove: board specific remove callback 142 * @remove: board specific remove callback
142 */ 143 */
143struct stmpe_gpio_platform_data { 144struct stmpe_gpio_platform_data {
144 int gpio_base;
145 unsigned norequest_mask; 145 unsigned norequest_mask;
146 void (*setup)(struct stmpe *stmpe, unsigned gpio_base); 146 void (*setup)(struct stmpe *stmpe, unsigned gpio_base);
147 void (*remove)(struct stmpe *stmpe, unsigned gpio_base); 147 void (*remove)(struct stmpe *stmpe, unsigned gpio_base);
@@ -195,8 +195,6 @@ struct stmpe_ts_platform_data {
195 * @irq_trigger: IRQ trigger to use for the interrupt to the host 195 * @irq_trigger: IRQ trigger to use for the interrupt to the host
196 * @autosleep: bool to enable/disable stmpe autosleep 196 * @autosleep: bool to enable/disable stmpe autosleep
197 * @autosleep_timeout: inactivity timeout in milliseconds for autosleep 197 * @autosleep_timeout: inactivity timeout in milliseconds for autosleep
198 * @irq_base: base IRQ number. %STMPE_NR_IRQS irqs will be used, or
199 * %STMPE_NR_INTERNAL_IRQS if the GPIO driver is not used.
200 * @irq_over_gpio: true if gpio is used to get irq 198 * @irq_over_gpio: true if gpio is used to get irq
201 * @irq_gpio: gpio number over which irq will be requested (significant only if 199 * @irq_gpio: gpio number over which irq will be requested (significant only if
202 * irq_over_gpio is true) 200 * irq_over_gpio is true)
@@ -207,7 +205,6 @@ struct stmpe_ts_platform_data {
207struct stmpe_platform_data { 205struct stmpe_platform_data {
208 int id; 206 int id;
209 unsigned int blocks; 207 unsigned int blocks;
210 int irq_base;
211 unsigned int irq_trigger; 208 unsigned int irq_trigger;
212 bool autosleep; 209 bool autosleep;
213 bool irq_over_gpio; 210 bool irq_over_gpio;
@@ -219,10 +216,4 @@ struct stmpe_platform_data {
219 struct stmpe_ts_platform_data *ts; 216 struct stmpe_ts_platform_data *ts;
220}; 217};
221 218
222#define STMPE_NR_INTERNAL_IRQS 9
223#define STMPE_INT_GPIO(x) (STMPE_NR_INTERNAL_IRQS + (x))
224
225#define STMPE_NR_GPIOS 24
226#define STMPE_NR_IRQS STMPE_INT_GPIO(STMPE_NR_GPIOS)
227
228#endif 219#endif
diff --git a/include/linux/mfd/syscon.h b/include/linux/mfd/syscon.h
index 8789fa3c7fd9..75e543b78f53 100644
--- a/include/linux/mfd/syscon.h
+++ b/include/linux/mfd/syscon.h
@@ -15,6 +15,8 @@
15#ifndef __LINUX_MFD_SYSCON_H__ 15#ifndef __LINUX_MFD_SYSCON_H__
16#define __LINUX_MFD_SYSCON_H__ 16#define __LINUX_MFD_SYSCON_H__
17 17
18#include <linux/err.h>
19
18struct device_node; 20struct device_node;
19 21
20#ifdef CONFIG_MFD_SYSCON 22#ifdef CONFIG_MFD_SYSCON
diff --git a/include/linux/mfd/syscon/exynos5-pmu.h b/include/linux/mfd/syscon/exynos5-pmu.h
new file mode 100644
index 000000000000..00ef24bf6ede
--- /dev/null
+++ b/include/linux/mfd/syscon/exynos5-pmu.h
@@ -0,0 +1,44 @@
1/*
2 * Exynos5 SoC series Power Management Unit (PMU) register offsets
3 * and bit definitions.
4 *
5 * Copyright (C) 2014 Samsung Electronics Co., Ltd.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef _LINUX_MFD_SYSCON_PMU_EXYNOS5_H_
13#define _LINUX_MFD_SYSCON_PMU_EXYNOS5_H_
14
15/* Exynos5 PMU register definitions */
16#define EXYNOS5_HDMI_PHY_CONTROL (0x700)
17#define EXYNOS5_USBDRD_PHY_CONTROL (0x704)
18
19/* Exynos5250 specific register definitions */
20#define EXYNOS5_USBHOST_PHY_CONTROL (0x708)
21#define EXYNOS5_EFNAND_PHY_CONTROL (0x70c)
22#define EXYNOS5_MIPI_PHY0_CONTROL (0x710)
23#define EXYNOS5_MIPI_PHY1_CONTROL (0x714)
24#define EXYNOS5_ADC_PHY_CONTROL (0x718)
25#define EXYNOS5_MTCADC_PHY_CONTROL (0x71c)
26#define EXYNOS5_DPTX_PHY_CONTROL (0x720)
27#define EXYNOS5_SATA_PHY_CONTROL (0x724)
28
29/* Exynos5420 specific register definitions */
30#define EXYNOS5420_USBDRD1_PHY_CONTROL (0x708)
31#define EXYNOS5420_USBHOST_PHY_CONTROL (0x70c)
32#define EXYNOS5420_MIPI_PHY0_CONTROL (0x714)
33#define EXYNOS5420_MIPI_PHY1_CONTROL (0x718)
34#define EXYNOS5420_MIPI_PHY2_CONTROL (0x71c)
35#define EXYNOS5420_ADC_PHY_CONTROL (0x720)
36#define EXYNOS5420_MTCADC_PHY_CONTROL (0x724)
37#define EXYNOS5420_DPTX_PHY_CONTROL (0x728)
38
39#define EXYNOS5_PHY_ENABLE BIT(0)
40
41#define EXYNOS5_MIPI_PHY_S_RESETN BIT(1)
42#define EXYNOS5_MIPI_PHY_M_RESETN BIT(2)
43
44#endif /* _LINUX_MFD_SYSCON_PMU_EXYNOS5_H_ */
diff --git a/include/linux/mfd/tc3589x.h b/include/linux/mfd/tc3589x.h
index 6b8e1ff4672b..e6088c2e2092 100644
--- a/include/linux/mfd/tc3589x.h
+++ b/include/linux/mfd/tc3589x.h
@@ -111,7 +111,6 @@ enum tx3589x_block {
111#define TC3589x_INT_PORIRQ 7 111#define TC3589x_INT_PORIRQ 7
112 112
113#define TC3589x_NR_INTERNAL_IRQS 8 113#define TC3589x_NR_INTERNAL_IRQS 8
114#define TC3589x_INT_GPIO(x) (TC3589x_NR_INTERNAL_IRQS + (x))
115 114
116struct tc3589x { 115struct tc3589x {
117 struct mutex lock; 116 struct mutex lock;
diff --git a/include/linux/mfd/tps65090.h b/include/linux/mfd/tps65090.h
index 3f43069413e7..0bf2708df150 100644
--- a/include/linux/mfd/tps65090.h
+++ b/include/linux/mfd/tps65090.h
@@ -64,6 +64,20 @@ enum {
64 TPS65090_REGULATOR_MAX, 64 TPS65090_REGULATOR_MAX,
65}; 65};
66 66
67/* Register addresses */
68#define TPS65090_REG_INTR_STS 0x00
69#define TPS65090_REG_INTR_STS2 0x01
70#define TPS65090_REG_INTR_MASK 0x02
71#define TPS65090_REG_INTR_MASK2 0x03
72#define TPS65090_REG_CG_CTRL0 0x04
73#define TPS65090_REG_CG_CTRL1 0x05
74#define TPS65090_REG_CG_CTRL2 0x06
75#define TPS65090_REG_CG_CTRL3 0x07
76#define TPS65090_REG_CG_CTRL4 0x08
77#define TPS65090_REG_CG_CTRL5 0x09
78#define TPS65090_REG_CG_STATUS1 0x0a
79#define TPS65090_REG_CG_STATUS2 0x0b
80
67struct tps65090 { 81struct tps65090 {
68 struct device *dev; 82 struct device *dev;
69 struct regmap *rmap; 83 struct regmap *rmap;
@@ -78,11 +92,16 @@ struct tps65090 {
78 * DCDC1, DCDC2 and DCDC3. 92 * DCDC1, DCDC2 and DCDC3.
79 * @gpio: Gpio number if external control is enabled and controlled through 93 * @gpio: Gpio number if external control is enabled and controlled through
80 * gpio. 94 * gpio.
95 * @overcurrent_wait_valid: True if the overcurrent_wait should be applied.
96 * @overcurrent_wait: Value to set as the overcurrent wait time. This is the
97 * actual bitfield value, not a time in ms (valid value are 0 - 3).
81 */ 98 */
82struct tps65090_regulator_plat_data { 99struct tps65090_regulator_plat_data {
83 struct regulator_init_data *reg_init_data; 100 struct regulator_init_data *reg_init_data;
84 bool enable_ext_control; 101 bool enable_ext_control;
85 int gpio; 102 int gpio;
103 bool overcurrent_wait_valid;
104 int overcurrent_wait;
86}; 105};
87 106
88struct tps65090_platform_data { 107struct tps65090_platform_data {
diff --git a/include/linux/mfd/tps65217.h b/include/linux/mfd/tps65217.h
index 54b5458ec084..95d6938737fd 100644
--- a/include/linux/mfd/tps65217.h
+++ b/include/linux/mfd/tps65217.h
@@ -254,7 +254,6 @@ struct tps65217 {
254 struct tps65217_board *pdata; 254 struct tps65217_board *pdata;
255 unsigned long id; 255 unsigned long id;
256 struct regulator_desc desc[TPS65217_NUM_REGULATOR]; 256 struct regulator_desc desc[TPS65217_NUM_REGULATOR];
257 struct regulator_dev *rdev[TPS65217_NUM_REGULATOR];
258 struct regmap *regmap; 257 struct regmap *regmap;
259}; 258};
260 259
diff --git a/include/linux/mfd/tps65218.h b/include/linux/mfd/tps65218.h
index d2e357df5a0e..2f9b593246ee 100644
--- a/include/linux/mfd/tps65218.h
+++ b/include/linux/mfd/tps65218.h
@@ -267,7 +267,6 @@ struct tps65218 {
267 u32 irq_mask; 267 u32 irq_mask;
268 struct regmap_irq_chip_data *irq_data; 268 struct regmap_irq_chip_data *irq_data;
269 struct regulator_desc desc[TPS65218_NUM_REGULATOR]; 269 struct regulator_desc desc[TPS65218_NUM_REGULATOR];
270 struct regulator_dev *rdev[TPS65218_NUM_REGULATOR];
271 struct tps_info *info[TPS65218_NUM_REGULATOR]; 270 struct tps_info *info[TPS65218_NUM_REGULATOR];
272 struct regmap *regmap; 271 struct regmap *regmap;
273}; 272};
diff --git a/include/linux/mfd/tps6586x.h b/include/linux/mfd/tps6586x.h
index cbecec2e353a..96187ed9f9bb 100644
--- a/include/linux/mfd/tps6586x.h
+++ b/include/linux/mfd/tps6586x.h
@@ -17,6 +17,8 @@
17#define TPS658621A 0x15 17#define TPS658621A 0x15
18#define TPS658621CD 0x2c 18#define TPS658621CD 0x2c
19#define TPS658623 0x1b 19#define TPS658623 0x1b
20#define TPS658640 0x01
21#define TPS658640v2 0x02
20#define TPS658643 0x03 22#define TPS658643 0x03
21 23
22enum { 24enum {
diff --git a/include/linux/mfd/twl6040.h b/include/linux/mfd/twl6040.h
index 81f639bc1ae6..8f9fc3d26e6d 100644
--- a/include/linux/mfd/twl6040.h
+++ b/include/linux/mfd/twl6040.h
@@ -28,6 +28,7 @@
28#include <linux/interrupt.h> 28#include <linux/interrupt.h>
29#include <linux/mfd/core.h> 29#include <linux/mfd/core.h>
30#include <linux/regulator/consumer.h> 30#include <linux/regulator/consumer.h>
31#include <linux/clk.h>
31 32
32#define TWL6040_REG_ASICID 0x01 33#define TWL6040_REG_ASICID 0x01
33#define TWL6040_REG_ASICREV 0x02 34#define TWL6040_REG_ASICREV 0x02
@@ -157,6 +158,7 @@
157#define TWL6040_I2CSEL 0x01 158#define TWL6040_I2CSEL 0x01
158#define TWL6040_RESETSPLIT 0x04 159#define TWL6040_RESETSPLIT 0x04
159#define TWL6040_INTCLRMODE 0x08 160#define TWL6040_INTCLRMODE 0x08
161#define TWL6040_I2CMODE(x) ((x & 0x3) << 4)
160 162
161/* STATUS (0x2E) fields */ 163/* STATUS (0x2E) fields */
162 164
@@ -222,6 +224,7 @@ struct twl6040 {
222 struct regmap *regmap; 224 struct regmap *regmap;
223 struct regmap_irq_chip_data *irq_data; 225 struct regmap_irq_chip_data *irq_data;
224 struct regulator_bulk_data supplies[2]; /* supplies for vio, v2v1 */ 226 struct regulator_bulk_data supplies[2]; /* supplies for vio, v2v1 */
227 struct clk *clk32k;
225 struct mutex mutex; 228 struct mutex mutex;
226 struct mutex irq_mutex; 229 struct mutex irq_mutex;
227 struct mfd_cell cells[TWL6040_CELLS]; 230 struct mfd_cell cells[TWL6040_CELLS];
diff --git a/include/linux/migrate.h b/include/linux/migrate.h
index 84a31ad0b791..a2901c414664 100644
--- a/include/linux/migrate.h
+++ b/include/linux/migrate.h
@@ -5,7 +5,9 @@
5#include <linux/mempolicy.h> 5#include <linux/mempolicy.h>
6#include <linux/migrate_mode.h> 6#include <linux/migrate_mode.h>
7 7
8typedef struct page *new_page_t(struct page *, unsigned long private, int **); 8typedef struct page *new_page_t(struct page *page, unsigned long private,
9 int **reason);
10typedef void free_page_t(struct page *page, unsigned long private);
9 11
10/* 12/*
11 * Return values from addresss_space_operations.migratepage(): 13 * Return values from addresss_space_operations.migratepage():
@@ -38,7 +40,7 @@ enum migrate_reason {
38extern void putback_movable_pages(struct list_head *l); 40extern void putback_movable_pages(struct list_head *l);
39extern int migrate_page(struct address_space *, 41extern int migrate_page(struct address_space *,
40 struct page *, struct page *, enum migrate_mode); 42 struct page *, struct page *, enum migrate_mode);
41extern int migrate_pages(struct list_head *l, new_page_t x, 43extern int migrate_pages(struct list_head *l, new_page_t new, free_page_t free,
42 unsigned long private, enum migrate_mode mode, int reason); 44 unsigned long private, enum migrate_mode mode, int reason);
43 45
44extern int migrate_prep(void); 46extern int migrate_prep(void);
@@ -56,8 +58,9 @@ extern int migrate_page_move_mapping(struct address_space *mapping,
56#else 58#else
57 59
58static inline void putback_movable_pages(struct list_head *l) {} 60static inline void putback_movable_pages(struct list_head *l) {}
59static inline int migrate_pages(struct list_head *l, new_page_t x, 61static inline int migrate_pages(struct list_head *l, new_page_t new,
60 unsigned long private, enum migrate_mode mode, int reason) 62 free_page_t free, unsigned long private, enum migrate_mode mode,
63 int reason)
61 { return -ENOSYS; } 64 { return -ENOSYS; }
62 65
63static inline int migrate_prep(void) { return -ENOSYS; } 66static inline int migrate_prep(void) { return -ENOSYS; }
diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h
index 51e26f3cd3b3..ee80dd7d9f60 100644
--- a/include/linux/miscdevice.h
+++ b/include/linux/miscdevice.h
@@ -64,7 +64,7 @@ struct miscdevice {
64 umode_t mode; 64 umode_t mode;
65}; 65};
66 66
67extern int misc_register(struct miscdevice * misc); 67extern int misc_register(struct miscdevice *misc);
68extern int misc_deregister(struct miscdevice *misc); 68extern int misc_deregister(struct miscdevice *misc);
69 69
70#define MODULE_ALIAS_MISCDEV(minor) \ 70#define MODULE_ALIAS_MISCDEV(minor) \
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index ba87bd21295a..b12f4bbd064c 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -401,6 +401,7 @@ struct mlx4_caps {
401 int max_rq_desc_sz; 401 int max_rq_desc_sz;
402 int max_qp_init_rdma; 402 int max_qp_init_rdma;
403 int max_qp_dest_rdma; 403 int max_qp_dest_rdma;
404 u32 *qp0_qkey;
404 u32 *qp0_proxy; 405 u32 *qp0_proxy;
405 u32 *qp1_proxy; 406 u32 *qp1_proxy;
406 u32 *qp0_tunnel; 407 u32 *qp0_tunnel;
@@ -449,7 +450,6 @@ struct mlx4_caps {
449 int reserved_qps_base[MLX4_NUM_QP_REGION]; 450 int reserved_qps_base[MLX4_NUM_QP_REGION];
450 int log_num_macs; 451 int log_num_macs;
451 int log_num_vlans; 452 int log_num_vlans;
452 int log_num_prios;
453 enum mlx4_port_type port_type[MLX4_MAX_PORTS + 1]; 453 enum mlx4_port_type port_type[MLX4_MAX_PORTS + 1];
454 u8 supported_type[MLX4_MAX_PORTS + 1]; 454 u8 supported_type[MLX4_MAX_PORTS + 1];
455 u8 suggested_type[MLX4_MAX_PORTS + 1]; 455 u8 suggested_type[MLX4_MAX_PORTS + 1];
@@ -577,6 +577,9 @@ struct mlx4_cq {
577 577
578 u32 cons_index; 578 u32 cons_index;
579 579
580 u16 irq;
581 bool irq_affinity_change;
582
580 __be32 *set_ci_db; 583 __be32 *set_ci_db;
581 __be32 *arm_db; 584 __be32 *arm_db;
582 int arm_sn; 585 int arm_sn;
@@ -837,7 +840,7 @@ static inline int mlx4_is_slave(struct mlx4_dev *dev)
837} 840}
838 841
839int mlx4_buf_alloc(struct mlx4_dev *dev, int size, int max_direct, 842int mlx4_buf_alloc(struct mlx4_dev *dev, int size, int max_direct,
840 struct mlx4_buf *buf); 843 struct mlx4_buf *buf, gfp_t gfp);
841void mlx4_buf_free(struct mlx4_dev *dev, int size, struct mlx4_buf *buf); 844void mlx4_buf_free(struct mlx4_dev *dev, int size, struct mlx4_buf *buf);
842static inline void *mlx4_buf_offset(struct mlx4_buf *buf, int offset) 845static inline void *mlx4_buf_offset(struct mlx4_buf *buf, int offset)
843{ 846{
@@ -874,9 +877,10 @@ int mlx4_mw_enable(struct mlx4_dev *dev, struct mlx4_mw *mw);
874int mlx4_write_mtt(struct mlx4_dev *dev, struct mlx4_mtt *mtt, 877int mlx4_write_mtt(struct mlx4_dev *dev, struct mlx4_mtt *mtt,
875 int start_index, int npages, u64 *page_list); 878 int start_index, int npages, u64 *page_list);
876int mlx4_buf_write_mtt(struct mlx4_dev *dev, struct mlx4_mtt *mtt, 879int mlx4_buf_write_mtt(struct mlx4_dev *dev, struct mlx4_mtt *mtt,
877 struct mlx4_buf *buf); 880 struct mlx4_buf *buf, gfp_t gfp);
878 881
879int mlx4_db_alloc(struct mlx4_dev *dev, struct mlx4_db *db, int order); 882int mlx4_db_alloc(struct mlx4_dev *dev, struct mlx4_db *db, int order,
883 gfp_t gfp);
880void mlx4_db_free(struct mlx4_dev *dev, struct mlx4_db *db); 884void mlx4_db_free(struct mlx4_dev *dev, struct mlx4_db *db);
881 885
882int mlx4_alloc_hwq_res(struct mlx4_dev *dev, struct mlx4_hwq_resources *wqres, 886int mlx4_alloc_hwq_res(struct mlx4_dev *dev, struct mlx4_hwq_resources *wqres,
@@ -892,7 +896,8 @@ void mlx4_cq_free(struct mlx4_dev *dev, struct mlx4_cq *cq);
892int mlx4_qp_reserve_range(struct mlx4_dev *dev, int cnt, int align, int *base); 896int mlx4_qp_reserve_range(struct mlx4_dev *dev, int cnt, int align, int *base);
893void mlx4_qp_release_range(struct mlx4_dev *dev, int base_qpn, int cnt); 897void mlx4_qp_release_range(struct mlx4_dev *dev, int base_qpn, int cnt);
894 898
895int mlx4_qp_alloc(struct mlx4_dev *dev, int qpn, struct mlx4_qp *qp); 899int mlx4_qp_alloc(struct mlx4_dev *dev, int qpn, struct mlx4_qp *qp,
900 gfp_t gfp);
896void mlx4_qp_free(struct mlx4_dev *dev, struct mlx4_qp *qp); 901void mlx4_qp_free(struct mlx4_dev *dev, struct mlx4_qp *qp);
897 902
898int mlx4_srq_alloc(struct mlx4_dev *dev, u32 pdn, u32 cqn, u16 xrcdn, 903int mlx4_srq_alloc(struct mlx4_dev *dev, u32 pdn, u32 cqn, u16 xrcdn,
@@ -1234,4 +1239,8 @@ int mlx4_phys_to_slave_port(struct mlx4_dev *dev, int slave, int port);
1234int mlx4_get_base_gid_ix(struct mlx4_dev *dev, int slave, int port); 1239int mlx4_get_base_gid_ix(struct mlx4_dev *dev, int slave, int port);
1235 1240
1236int mlx4_config_vxlan_port(struct mlx4_dev *dev, __be16 udp_port); 1241int mlx4_config_vxlan_port(struct mlx4_dev *dev, __be16 udp_port);
1242int mlx4_vf_smi_enabled(struct mlx4_dev *dev, int slave, int port);
1243int mlx4_vf_get_enable_smi_admin(struct mlx4_dev *dev, int slave, int port);
1244int mlx4_vf_set_enable_smi_admin(struct mlx4_dev *dev, int slave, int port,
1245 int enable);
1237#endif /* MLX4_DEVICE_H */ 1246#endif /* MLX4_DEVICE_H */
diff --git a/include/linux/mlx4/qp.h b/include/linux/mlx4/qp.h
index b66e7610d4ee..7040dc98ff8b 100644
--- a/include/linux/mlx4/qp.h
+++ b/include/linux/mlx4/qp.h
@@ -421,6 +421,17 @@ struct mlx4_wqe_inline_seg {
421 __be32 byte_count; 421 __be32 byte_count;
422}; 422};
423 423
424enum mlx4_update_qp_attr {
425 MLX4_UPDATE_QP_SMAC = 1 << 0,
426};
427
428struct mlx4_update_qp_params {
429 u8 smac_index;
430};
431
432int mlx4_update_qp(struct mlx4_dev *dev, struct mlx4_qp *qp,
433 enum mlx4_update_qp_attr attr,
434 struct mlx4_update_qp_params *params);
424int mlx4_qp_modify(struct mlx4_dev *dev, struct mlx4_mtt *mtt, 435int mlx4_qp_modify(struct mlx4_dev *dev, struct mlx4_mtt *mtt,
425 enum mlx4_qp_state cur_state, enum mlx4_qp_state new_state, 436 enum mlx4_qp_state cur_state, enum mlx4_qp_state new_state,
426 struct mlx4_qp_context *context, enum mlx4_qp_optpar optpar, 437 struct mlx4_qp_context *context, enum mlx4_qp_optpar optpar,
diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h
index 93cef6313e72..2bce4aad2570 100644
--- a/include/linux/mlx5/driver.h
+++ b/include/linux/mlx5/driver.h
@@ -427,7 +427,6 @@ struct mlx5_core_mr {
427 u64 size; 427 u64 size;
428 u32 key; 428 u32 key;
429 u32 pd; 429 u32 pd;
430 u32 access;
431}; 430};
432 431
433struct mlx5_core_srq { 432struct mlx5_core_srq {
diff --git a/include/linux/mm.h b/include/linux/mm.h
index d6777060449f..e03dd29145a0 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -239,6 +239,12 @@ struct vm_operations_struct {
239 */ 239 */
240 int (*access)(struct vm_area_struct *vma, unsigned long addr, 240 int (*access)(struct vm_area_struct *vma, unsigned long addr,
241 void *buf, int len, int write); 241 void *buf, int len, int write);
242
243 /* Called by the /proc/PID/maps code to ask the vma whether it
244 * has a special name. Returning non-NULL will also cause this
245 * vma to be dumped unconditionally. */
246 const char *(*name)(struct vm_area_struct *vma);
247
242#ifdef CONFIG_NUMA 248#ifdef CONFIG_NUMA
243 /* 249 /*
244 * set_policy() op must add a reference to any non-NULL @new mempolicy 250 * set_policy() op must add a reference to any non-NULL @new mempolicy
@@ -407,20 +413,25 @@ static inline void compound_unlock_irqrestore(struct page *page,
407#endif 413#endif
408} 414}
409 415
416static inline struct page *compound_head_by_tail(struct page *tail)
417{
418 struct page *head = tail->first_page;
419
420 /*
421 * page->first_page may be a dangling pointer to an old
422 * compound page, so recheck that it is still a tail
423 * page before returning.
424 */
425 smp_rmb();
426 if (likely(PageTail(tail)))
427 return head;
428 return tail;
429}
430
410static inline struct page *compound_head(struct page *page) 431static inline struct page *compound_head(struct page *page)
411{ 432{
412 if (unlikely(PageTail(page))) { 433 if (unlikely(PageTail(page)))
413 struct page *head = page->first_page; 434 return compound_head_by_tail(page);
414
415 /*
416 * page->first_page may be a dangling pointer to an old
417 * compound page, so recheck that it is still a tail
418 * page before returning.
419 */
420 smp_rmb();
421 if (likely(PageTail(page)))
422 return head;
423 }
424 return page; 435 return page;
425} 436}
426 437
@@ -1778,7 +1789,9 @@ extern struct file *get_mm_exe_file(struct mm_struct *mm);
1778extern int may_expand_vm(struct mm_struct *mm, unsigned long npages); 1789extern int may_expand_vm(struct mm_struct *mm, unsigned long npages);
1779extern struct vm_area_struct *_install_special_mapping(struct mm_struct *mm, 1790extern struct vm_area_struct *_install_special_mapping(struct mm_struct *mm,
1780 unsigned long addr, unsigned long len, 1791 unsigned long addr, unsigned long len,
1781 unsigned long flags, struct page **pages); 1792 unsigned long flags,
1793 const struct vm_special_mapping *spec);
1794/* This is an obsolete alternative to _install_special_mapping. */
1782extern int install_special_mapping(struct mm_struct *mm, 1795extern int install_special_mapping(struct mm_struct *mm,
1783 unsigned long addr, unsigned long len, 1796 unsigned long addr, unsigned long len,
1784 unsigned long flags, struct page **pages); 1797 unsigned long flags, struct page **pages);
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index 8967e20cbe57..96c5750e3110 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -406,7 +406,7 @@ struct mm_struct {
406 spinlock_t ioctx_lock; 406 spinlock_t ioctx_lock;
407 struct kioctx_table __rcu *ioctx_table; 407 struct kioctx_table __rcu *ioctx_table;
408#endif 408#endif
409#ifdef CONFIG_MM_OWNER 409#ifdef CONFIG_MEMCG
410 /* 410 /*
411 * "owner" points to a task that is regarded as the canonical 411 * "owner" points to a task that is regarded as the canonical
412 * user/owner of this mm. All of the following must be true in 412 * user/owner of this mm. All of the following must be true in
@@ -510,4 +510,10 @@ static inline void clear_tlb_flush_pending(struct mm_struct *mm)
510} 510}
511#endif 511#endif
512 512
513struct vm_special_mapping
514{
515 const char *name;
516 struct page **pages;
517};
518
513#endif /* _LINUX_MM_TYPES_H */ 519#endif /* _LINUX_MM_TYPES_H */
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index b73027298b3a..d424b9de3aff 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -63,12 +63,12 @@ struct mmc_ext_csd {
63 unsigned int power_off_longtime; /* Units: ms */ 63 unsigned int power_off_longtime; /* Units: ms */
64 u8 power_off_notification; /* state */ 64 u8 power_off_notification; /* state */
65 unsigned int hs_max_dtr; 65 unsigned int hs_max_dtr;
66 unsigned int hs200_max_dtr;
66#define MMC_HIGH_26_MAX_DTR 26000000 67#define MMC_HIGH_26_MAX_DTR 26000000
67#define MMC_HIGH_52_MAX_DTR 52000000 68#define MMC_HIGH_52_MAX_DTR 52000000
68#define MMC_HIGH_DDR_MAX_DTR 52000000 69#define MMC_HIGH_DDR_MAX_DTR 52000000
69#define MMC_HS200_MAX_DTR 200000000 70#define MMC_HS200_MAX_DTR 200000000
70 unsigned int sectors; 71 unsigned int sectors;
71 unsigned int card_type;
72 unsigned int hc_erase_size; /* In sectors */ 72 unsigned int hc_erase_size; /* In sectors */
73 unsigned int hc_erase_timeout; /* In milliseconds */ 73 unsigned int hc_erase_timeout; /* In milliseconds */
74 unsigned int sec_trim_mult; /* Secure trim multiplier */ 74 unsigned int sec_trim_mult; /* Secure trim multiplier */
@@ -110,6 +110,7 @@ struct mmc_ext_csd {
110 u8 raw_pwr_cl_200_360; /* 237 */ 110 u8 raw_pwr_cl_200_360; /* 237 */
111 u8 raw_pwr_cl_ddr_52_195; /* 238 */ 111 u8 raw_pwr_cl_ddr_52_195; /* 238 */
112 u8 raw_pwr_cl_ddr_52_360; /* 239 */ 112 u8 raw_pwr_cl_ddr_52_360; /* 239 */
113 u8 raw_pwr_cl_ddr_200_360; /* 253 */
113 u8 raw_bkops_status; /* 246 */ 114 u8 raw_bkops_status; /* 246 */
114 u8 raw_sectors[4]; /* 212 - 4 bytes */ 115 u8 raw_sectors[4]; /* 212 - 4 bytes */
115 116
@@ -194,6 +195,7 @@ struct sdio_cis {
194}; 195};
195 196
196struct mmc_host; 197struct mmc_host;
198struct mmc_ios;
197struct sdio_func; 199struct sdio_func;
198struct sdio_func_tuple; 200struct sdio_func_tuple;
199 201
@@ -250,15 +252,11 @@ struct mmc_card {
250 unsigned int state; /* (our) card state */ 252 unsigned int state; /* (our) card state */
251#define MMC_STATE_PRESENT (1<<0) /* present in sysfs */ 253#define MMC_STATE_PRESENT (1<<0) /* present in sysfs */
252#define MMC_STATE_READONLY (1<<1) /* card is read-only */ 254#define MMC_STATE_READONLY (1<<1) /* card is read-only */
253#define MMC_STATE_HIGHSPEED (1<<2) /* card is in high speed mode */ 255#define MMC_STATE_BLOCKADDR (1<<2) /* card uses block-addressing */
254#define MMC_STATE_BLOCKADDR (1<<3) /* card uses block-addressing */ 256#define MMC_CARD_SDXC (1<<3) /* card is SDXC */
255#define MMC_STATE_HIGHSPEED_DDR (1<<4) /* card is in high speed mode */ 257#define MMC_CARD_REMOVED (1<<4) /* card has been removed */
256#define MMC_STATE_ULTRAHIGHSPEED (1<<5) /* card is in ultra high speed mode */ 258#define MMC_STATE_DOING_BKOPS (1<<5) /* card is doing BKOPS */
257#define MMC_CARD_SDXC (1<<6) /* card is SDXC */ 259#define MMC_STATE_SUSPENDED (1<<6) /* card is suspended */
258#define MMC_CARD_REMOVED (1<<7) /* card has been removed */
259#define MMC_STATE_HIGHSPEED_200 (1<<8) /* card is in HS200 mode */
260#define MMC_STATE_DOING_BKOPS (1<<10) /* card is doing BKOPS */
261#define MMC_STATE_SUSPENDED (1<<11) /* card is suspended */
262 unsigned int quirks; /* card quirks */ 260 unsigned int quirks; /* card quirks */
263#define MMC_QUIRK_LENIENT_FN0 (1<<0) /* allow SDIO FN0 writes outside of the VS CCCR range */ 261#define MMC_QUIRK_LENIENT_FN0 (1<<0) /* allow SDIO FN0 writes outside of the VS CCCR range */
264#define MMC_QUIRK_BLKSZ_FOR_BYTE_MODE (1<<1) /* use func->cur_blksize */ 262#define MMC_QUIRK_BLKSZ_FOR_BYTE_MODE (1<<1) /* use func->cur_blksize */
@@ -301,6 +299,7 @@ struct mmc_card {
301 struct sdio_func_tuple *tuples; /* unknown common tuples */ 299 struct sdio_func_tuple *tuples; /* unknown common tuples */
302 300
303 unsigned int sd_bus_speed; /* Bus Speed Mode set for the card */ 301 unsigned int sd_bus_speed; /* Bus Speed Mode set for the card */
302 unsigned int mmc_avail_type; /* supported device type by both host and card */
304 303
305 struct dentry *debugfs_root; 304 struct dentry *debugfs_root;
306 struct mmc_part part[MMC_NUM_PHY_PARTITION]; /* physical partitions */ 305 struct mmc_part part[MMC_NUM_PHY_PARTITION]; /* physical partitions */
@@ -353,7 +352,7 @@ struct mmc_fixup {
353#define CID_OEMID_ANY ((unsigned short) -1) 352#define CID_OEMID_ANY ((unsigned short) -1)
354#define CID_NAME_ANY (NULL) 353#define CID_NAME_ANY (NULL)
355 354
356#define END_FIXUP { 0 } 355#define END_FIXUP { NULL }
357 356
358#define _FIXUP_EXT(_name, _manfid, _oemid, _rev_start, _rev_end, \ 357#define _FIXUP_EXT(_name, _manfid, _oemid, _rev_start, _rev_end, \
359 _cis_vendor, _cis_device, \ 358 _cis_vendor, _cis_device, \
@@ -418,11 +417,7 @@ static inline void __maybe_unused remove_quirk(struct mmc_card *card, int data)
418 417
419#define mmc_card_present(c) ((c)->state & MMC_STATE_PRESENT) 418#define mmc_card_present(c) ((c)->state & MMC_STATE_PRESENT)
420#define mmc_card_readonly(c) ((c)->state & MMC_STATE_READONLY) 419#define mmc_card_readonly(c) ((c)->state & MMC_STATE_READONLY)
421#define mmc_card_highspeed(c) ((c)->state & MMC_STATE_HIGHSPEED)
422#define mmc_card_hs200(c) ((c)->state & MMC_STATE_HIGHSPEED_200)
423#define mmc_card_blockaddr(c) ((c)->state & MMC_STATE_BLOCKADDR) 420#define mmc_card_blockaddr(c) ((c)->state & MMC_STATE_BLOCKADDR)
424#define mmc_card_ddr_mode(c) ((c)->state & MMC_STATE_HIGHSPEED_DDR)
425#define mmc_card_uhs(c) ((c)->state & MMC_STATE_ULTRAHIGHSPEED)
426#define mmc_card_ext_capacity(c) ((c)->state & MMC_CARD_SDXC) 421#define mmc_card_ext_capacity(c) ((c)->state & MMC_CARD_SDXC)
427#define mmc_card_removed(c) ((c) && ((c)->state & MMC_CARD_REMOVED)) 422#define mmc_card_removed(c) ((c) && ((c)->state & MMC_CARD_REMOVED))
428#define mmc_card_doing_bkops(c) ((c)->state & MMC_STATE_DOING_BKOPS) 423#define mmc_card_doing_bkops(c) ((c)->state & MMC_STATE_DOING_BKOPS)
@@ -430,11 +425,7 @@ static inline void __maybe_unused remove_quirk(struct mmc_card *card, int data)
430 425
431#define mmc_card_set_present(c) ((c)->state |= MMC_STATE_PRESENT) 426#define mmc_card_set_present(c) ((c)->state |= MMC_STATE_PRESENT)
432#define mmc_card_set_readonly(c) ((c)->state |= MMC_STATE_READONLY) 427#define mmc_card_set_readonly(c) ((c)->state |= MMC_STATE_READONLY)
433#define mmc_card_set_highspeed(c) ((c)->state |= MMC_STATE_HIGHSPEED)
434#define mmc_card_set_hs200(c) ((c)->state |= MMC_STATE_HIGHSPEED_200)
435#define mmc_card_set_blockaddr(c) ((c)->state |= MMC_STATE_BLOCKADDR) 428#define mmc_card_set_blockaddr(c) ((c)->state |= MMC_STATE_BLOCKADDR)
436#define mmc_card_set_ddr_mode(c) ((c)->state |= MMC_STATE_HIGHSPEED_DDR)
437#define mmc_card_set_uhs(c) ((c)->state |= MMC_STATE_ULTRAHIGHSPEED)
438#define mmc_card_set_ext_capacity(c) ((c)->state |= MMC_CARD_SDXC) 429#define mmc_card_set_ext_capacity(c) ((c)->state |= MMC_CARD_SDXC)
439#define mmc_card_set_removed(c) ((c)->state |= MMC_CARD_REMOVED) 430#define mmc_card_set_removed(c) ((c)->state |= MMC_CARD_REMOVED)
440#define mmc_card_set_doing_bkops(c) ((c)->state |= MMC_STATE_DOING_BKOPS) 431#define mmc_card_set_doing_bkops(c) ((c)->state |= MMC_STATE_DOING_BKOPS)
diff --git a/include/linux/mmc/dw_mmc.h b/include/linux/mmc/dw_mmc.h
index 6ce7d2cd3c7a..babaea93bca6 100644
--- a/include/linux/mmc/dw_mmc.h
+++ b/include/linux/mmc/dw_mmc.h
@@ -248,20 +248,6 @@ struct dw_mci_board {
248 /* delay in mS before detecting cards after interrupt */ 248 /* delay in mS before detecting cards after interrupt */
249 u32 detect_delay_ms; 249 u32 detect_delay_ms;
250 250
251 int (*init)(u32 slot_id, irq_handler_t , void *);
252 int (*get_ro)(u32 slot_id);
253 int (*get_cd)(u32 slot_id);
254 int (*get_ocr)(u32 slot_id);
255 int (*get_bus_wd)(u32 slot_id);
256 /*
257 * Enable power to selected slot and set voltage to desired level.
258 * Voltage levels are specified using MMC_VDD_xxx defines defined
259 * in linux/mmc/host.h file.
260 */
261 void (*setpower)(u32 slot_id, u32 volt);
262 void (*exit)(u32 slot_id);
263 void (*select_slot)(u32 slot_id);
264
265 struct dw_mci_dma_ops *dma_ops; 251 struct dw_mci_dma_ops *dma_ops;
266 struct dma_pdata *data; 252 struct dma_pdata *data;
267 struct block_settings *blk_settings; 253 struct block_settings *blk_settings;
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index cb61ea4d6945..7960424d0bc0 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -17,6 +17,7 @@
17#include <linux/fault-inject.h> 17#include <linux/fault-inject.h>
18 18
19#include <linux/mmc/core.h> 19#include <linux/mmc/core.h>
20#include <linux/mmc/card.h>
20#include <linux/mmc/pm.h> 21#include <linux/mmc/pm.h>
21 22
22struct mmc_ios { 23struct mmc_ios {
@@ -58,13 +59,9 @@ struct mmc_ios {
58#define MMC_TIMING_UHS_SDR50 5 59#define MMC_TIMING_UHS_SDR50 5
59#define MMC_TIMING_UHS_SDR104 6 60#define MMC_TIMING_UHS_SDR104 6
60#define MMC_TIMING_UHS_DDR50 7 61#define MMC_TIMING_UHS_DDR50 7
61#define MMC_TIMING_MMC_HS200 8 62#define MMC_TIMING_MMC_DDR52 8
62 63#define MMC_TIMING_MMC_HS200 9
63#define MMC_SDR_MODE 0 64#define MMC_TIMING_MMC_HS400 10
64#define MMC_1_2V_DDR_MODE 1
65#define MMC_1_8V_DDR_MODE 2
66#define MMC_1_2V_SDR_MODE 3
67#define MMC_1_8V_SDR_MODE 4
68 65
69 unsigned char signal_voltage; /* signalling voltage (1.8V or 3.3V) */ 66 unsigned char signal_voltage; /* signalling voltage (1.8V or 3.3V) */
70 67
@@ -136,6 +133,9 @@ struct mmc_host_ops {
136 133
137 /* The tuning command opcode value is different for SD and eMMC cards */ 134 /* The tuning command opcode value is different for SD and eMMC cards */
138 int (*execute_tuning)(struct mmc_host *host, u32 opcode); 135 int (*execute_tuning)(struct mmc_host *host, u32 opcode);
136
137 /* Prepare HS400 target operating frequency depending host driver */
138 int (*prepare_hs400_tuning)(struct mmc_host *host, struct mmc_ios *ios);
139 int (*select_drive_strength)(unsigned int max_dtr, int host_drv, int card_drv); 139 int (*select_drive_strength)(unsigned int max_dtr, int host_drv, int card_drv);
140 void (*hw_reset)(struct mmc_host *host); 140 void (*hw_reset)(struct mmc_host *host);
141 void (*card_event)(struct mmc_host *host); 141 void (*card_event)(struct mmc_host *host);
@@ -278,6 +278,11 @@ struct mmc_host {
278#define MMC_CAP2_PACKED_CMD (MMC_CAP2_PACKED_RD | \ 278#define MMC_CAP2_PACKED_CMD (MMC_CAP2_PACKED_RD | \
279 MMC_CAP2_PACKED_WR) 279 MMC_CAP2_PACKED_WR)
280#define MMC_CAP2_NO_PRESCAN_POWERUP (1 << 14) /* Don't power up before scan */ 280#define MMC_CAP2_NO_PRESCAN_POWERUP (1 << 14) /* Don't power up before scan */
281#define MMC_CAP2_HS400_1_8V (1 << 15) /* Can support HS400 1.8V */
282#define MMC_CAP2_HS400_1_2V (1 << 16) /* Can support HS400 1.2V */
283#define MMC_CAP2_HS400 (MMC_CAP2_HS400_1_8V | \
284 MMC_CAP2_HS400_1_2V)
285#define MMC_CAP2_SDIO_IRQ_NOTHREAD (1 << 17)
281 286
282 mmc_pm_flag_t pm_caps; /* supported pm features */ 287 mmc_pm_flag_t pm_caps; /* supported pm features */
283 288
@@ -318,6 +323,8 @@ struct mmc_host {
318 int rescan_disable; /* disable card detection */ 323 int rescan_disable; /* disable card detection */
319 int rescan_entered; /* used with nonremovable devices */ 324 int rescan_entered; /* used with nonremovable devices */
320 325
326 bool trigger_card_event; /* card_event necessary */
327
321 struct mmc_card *card; /* device attached to this host */ 328 struct mmc_card *card; /* device attached to this host */
322 329
323 wait_queue_head_t wq; 330 wait_queue_head_t wq;
@@ -391,12 +398,13 @@ static inline void mmc_signal_sdio_irq(struct mmc_host *host)
391 wake_up_process(host->sdio_irq_thread); 398 wake_up_process(host->sdio_irq_thread);
392} 399}
393 400
401void sdio_run_irqs(struct mmc_host *host);
402
394#ifdef CONFIG_REGULATOR 403#ifdef CONFIG_REGULATOR
395int mmc_regulator_get_ocrmask(struct regulator *supply); 404int mmc_regulator_get_ocrmask(struct regulator *supply);
396int mmc_regulator_set_ocr(struct mmc_host *mmc, 405int mmc_regulator_set_ocr(struct mmc_host *mmc,
397 struct regulator *supply, 406 struct regulator *supply,
398 unsigned short vdd_bit); 407 unsigned short vdd_bit);
399int mmc_regulator_get_supply(struct mmc_host *mmc);
400#else 408#else
401static inline int mmc_regulator_get_ocrmask(struct regulator *supply) 409static inline int mmc_regulator_get_ocrmask(struct regulator *supply)
402{ 410{
@@ -409,13 +417,10 @@ static inline int mmc_regulator_set_ocr(struct mmc_host *mmc,
409{ 417{
410 return 0; 418 return 0;
411} 419}
412
413static inline int mmc_regulator_get_supply(struct mmc_host *mmc)
414{
415 return 0;
416}
417#endif 420#endif
418 421
422int mmc_regulator_get_supply(struct mmc_host *mmc);
423
419int mmc_pm_notify(struct notifier_block *notify_block, unsigned long, void *); 424int mmc_pm_notify(struct notifier_block *notify_block, unsigned long, void *);
420 425
421static inline int mmc_card_is_removable(struct mmc_host *host) 426static inline int mmc_card_is_removable(struct mmc_host *host)
@@ -475,4 +480,32 @@ static inline unsigned int mmc_host_clk_rate(struct mmc_host *host)
475 return host->ios.clock; 480 return host->ios.clock;
476} 481}
477#endif 482#endif
483
484static inline int mmc_card_hs(struct mmc_card *card)
485{
486 return card->host->ios.timing == MMC_TIMING_SD_HS ||
487 card->host->ios.timing == MMC_TIMING_MMC_HS;
488}
489
490static inline int mmc_card_uhs(struct mmc_card *card)
491{
492 return card->host->ios.timing >= MMC_TIMING_UHS_SDR12 &&
493 card->host->ios.timing <= MMC_TIMING_UHS_DDR50;
494}
495
496static inline bool mmc_card_hs200(struct mmc_card *card)
497{
498 return card->host->ios.timing == MMC_TIMING_MMC_HS200;
499}
500
501static inline bool mmc_card_ddr52(struct mmc_card *card)
502{
503 return card->host->ios.timing == MMC_TIMING_MMC_DDR52;
504}
505
506static inline bool mmc_card_hs400(struct mmc_card *card)
507{
508 return card->host->ios.timing == MMC_TIMING_MMC_HS400;
509}
510
478#endif /* LINUX_MMC_HOST_H */ 511#endif /* LINUX_MMC_HOST_H */
diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h
index 50bcde3677ca..64ec963ed347 100644
--- a/include/linux/mmc/mmc.h
+++ b/include/linux/mmc/mmc.h
@@ -325,6 +325,7 @@ struct _mmc_csd {
325#define EXT_CSD_POWER_OFF_LONG_TIME 247 /* RO */ 325#define EXT_CSD_POWER_OFF_LONG_TIME 247 /* RO */
326#define EXT_CSD_GENERIC_CMD6_TIME 248 /* RO */ 326#define EXT_CSD_GENERIC_CMD6_TIME 248 /* RO */
327#define EXT_CSD_CACHE_SIZE 249 /* RO, 4 bytes */ 327#define EXT_CSD_CACHE_SIZE 249 /* RO, 4 bytes */
328#define EXT_CSD_PWR_CL_DDR_200_360 253 /* RO */
328#define EXT_CSD_TAG_UNIT_SIZE 498 /* RO */ 329#define EXT_CSD_TAG_UNIT_SIZE 498 /* RO */
329#define EXT_CSD_DATA_TAG_SUPPORT 499 /* RO */ 330#define EXT_CSD_DATA_TAG_SUPPORT 499 /* RO */
330#define EXT_CSD_MAX_PACKED_WRITES 500 /* RO */ 331#define EXT_CSD_MAX_PACKED_WRITES 500 /* RO */
@@ -354,18 +355,25 @@ struct _mmc_csd {
354#define EXT_CSD_CMD_SET_SECURE (1<<1) 355#define EXT_CSD_CMD_SET_SECURE (1<<1)
355#define EXT_CSD_CMD_SET_CPSECURE (1<<2) 356#define EXT_CSD_CMD_SET_CPSECURE (1<<2)
356 357
357#define EXT_CSD_CARD_TYPE_26 (1<<0) /* Card can run at 26MHz */ 358#define EXT_CSD_CARD_TYPE_HS_26 (1<<0) /* Card can run at 26MHz */
358#define EXT_CSD_CARD_TYPE_52 (1<<1) /* Card can run at 52MHz */ 359#define EXT_CSD_CARD_TYPE_HS_52 (1<<1) /* Card can run at 52MHz */
359#define EXT_CSD_CARD_TYPE_MASK 0x3F /* Mask out reserved bits */ 360#define EXT_CSD_CARD_TYPE_HS (EXT_CSD_CARD_TYPE_HS_26 | \
361 EXT_CSD_CARD_TYPE_HS_52)
360#define EXT_CSD_CARD_TYPE_DDR_1_8V (1<<2) /* Card can run at 52MHz */ 362#define EXT_CSD_CARD_TYPE_DDR_1_8V (1<<2) /* Card can run at 52MHz */
361 /* DDR mode @1.8V or 3V I/O */ 363 /* DDR mode @1.8V or 3V I/O */
362#define EXT_CSD_CARD_TYPE_DDR_1_2V (1<<3) /* Card can run at 52MHz */ 364#define EXT_CSD_CARD_TYPE_DDR_1_2V (1<<3) /* Card can run at 52MHz */
363 /* DDR mode @1.2V I/O */ 365 /* DDR mode @1.2V I/O */
364#define EXT_CSD_CARD_TYPE_DDR_52 (EXT_CSD_CARD_TYPE_DDR_1_8V \ 366#define EXT_CSD_CARD_TYPE_DDR_52 (EXT_CSD_CARD_TYPE_DDR_1_8V \
365 | EXT_CSD_CARD_TYPE_DDR_1_2V) 367 | EXT_CSD_CARD_TYPE_DDR_1_2V)
366#define EXT_CSD_CARD_TYPE_SDR_1_8V (1<<4) /* Card can run at 200MHz */ 368#define EXT_CSD_CARD_TYPE_HS200_1_8V (1<<4) /* Card can run at 200MHz */
367#define EXT_CSD_CARD_TYPE_SDR_1_2V (1<<5) /* Card can run at 200MHz */ 369#define EXT_CSD_CARD_TYPE_HS200_1_2V (1<<5) /* Card can run at 200MHz */
368 /* SDR mode @1.2V I/O */ 370 /* SDR mode @1.2V I/O */
371#define EXT_CSD_CARD_TYPE_HS200 (EXT_CSD_CARD_TYPE_HS200_1_8V | \
372 EXT_CSD_CARD_TYPE_HS200_1_2V)
373#define EXT_CSD_CARD_TYPE_HS400_1_8V (1<<6) /* Card can run at 200MHz DDR, 1.8V */
374#define EXT_CSD_CARD_TYPE_HS400_1_2V (1<<7) /* Card can run at 200MHz DDR, 1.2V */
375#define EXT_CSD_CARD_TYPE_HS400 (EXT_CSD_CARD_TYPE_HS400_1_8V | \
376 EXT_CSD_CARD_TYPE_HS400_1_2V)
369 377
370#define EXT_CSD_BUS_WIDTH_1 0 /* Card is in 1 bit mode */ 378#define EXT_CSD_BUS_WIDTH_1 0 /* Card is in 1 bit mode */
371#define EXT_CSD_BUS_WIDTH_4 1 /* Card is in 4 bit mode */ 379#define EXT_CSD_BUS_WIDTH_4 1 /* Card is in 4 bit mode */
@@ -373,6 +381,11 @@ struct _mmc_csd {
373#define EXT_CSD_DDR_BUS_WIDTH_4 5 /* Card is in 4 bit DDR mode */ 381#define EXT_CSD_DDR_BUS_WIDTH_4 5 /* Card is in 4 bit DDR mode */
374#define EXT_CSD_DDR_BUS_WIDTH_8 6 /* Card is in 8 bit DDR mode */ 382#define EXT_CSD_DDR_BUS_WIDTH_8 6 /* Card is in 8 bit DDR mode */
375 383
384#define EXT_CSD_TIMING_BC 0 /* Backwards compatility */
385#define EXT_CSD_TIMING_HS 1 /* High speed */
386#define EXT_CSD_TIMING_HS200 2 /* HS200 */
387#define EXT_CSD_TIMING_HS400 3 /* HS400 */
388
376#define EXT_CSD_SEC_ER_EN BIT(0) 389#define EXT_CSD_SEC_ER_EN BIT(0)
377#define EXT_CSD_SEC_BD_BLK_EN BIT(2) 390#define EXT_CSD_SEC_BD_BLK_EN BIT(2)
378#define EXT_CSD_SEC_GB_CL_EN BIT(4) 391#define EXT_CSD_SEC_GB_CL_EN BIT(4)
diff --git a/include/linux/mmc/sdhci.h b/include/linux/mmc/sdhci.h
index 7be12b883485..08abe9941884 100644
--- a/include/linux/mmc/sdhci.h
+++ b/include/linux/mmc/sdhci.h
@@ -57,12 +57,8 @@ struct sdhci_host {
57#define SDHCI_QUIRK_BROKEN_CARD_DETECTION (1<<15) 57#define SDHCI_QUIRK_BROKEN_CARD_DETECTION (1<<15)
58/* Controller reports inverted write-protect state */ 58/* Controller reports inverted write-protect state */
59#define SDHCI_QUIRK_INVERTED_WRITE_PROTECT (1<<16) 59#define SDHCI_QUIRK_INVERTED_WRITE_PROTECT (1<<16)
60/* Controller has nonstandard clock management */
61#define SDHCI_QUIRK_NONSTANDARD_CLOCK (1<<17)
62/* Controller does not like fast PIO transfers */ 60/* Controller does not like fast PIO transfers */
63#define SDHCI_QUIRK_PIO_NEEDS_DELAY (1<<18) 61#define SDHCI_QUIRK_PIO_NEEDS_DELAY (1<<18)
64/* Controller losing signal/interrupt enable states after reset */
65#define SDHCI_QUIRK_RESTORE_IRQS_AFTER_RESET (1<<19)
66/* Controller has to be forced to use block size of 2048 bytes */ 62/* Controller has to be forced to use block size of 2048 bytes */
67#define SDHCI_QUIRK_FORCE_BLK_SZ_2048 (1<<20) 63#define SDHCI_QUIRK_FORCE_BLK_SZ_2048 (1<<20)
68/* Controller cannot do multi-block transfers */ 64/* Controller cannot do multi-block transfers */
@@ -147,6 +143,7 @@ struct sdhci_host {
147 143
148 bool runtime_suspended; /* Host is runtime suspended */ 144 bool runtime_suspended; /* Host is runtime suspended */
149 bool bus_on; /* Bus power prevents runtime suspend */ 145 bool bus_on; /* Bus power prevents runtime suspend */
146 bool preset_enabled; /* Preset is enabled */
150 147
151 struct mmc_request *mrq; /* Current request */ 148 struct mmc_request *mrq; /* Current request */
152 struct mmc_command *cmd; /* Current command */ 149 struct mmc_command *cmd; /* Current command */
@@ -164,8 +161,7 @@ struct sdhci_host {
164 dma_addr_t adma_addr; /* Mapped ADMA descr. table */ 161 dma_addr_t adma_addr; /* Mapped ADMA descr. table */
165 dma_addr_t align_addr; /* Mapped bounce buffer */ 162 dma_addr_t align_addr; /* Mapped bounce buffer */
166 163
167 struct tasklet_struct card_tasklet; /* Tasklet structures */ 164 struct tasklet_struct finish_tasklet; /* Tasklet structures */
168 struct tasklet_struct finish_tasklet;
169 165
170 struct timer_list timer; /* Timer for timeouts */ 166 struct timer_list timer; /* Timer for timeouts */
171 167
@@ -177,6 +173,13 @@ struct sdhci_host {
177 unsigned int ocr_avail_mmc; 173 unsigned int ocr_avail_mmc;
178 u32 ocr_mask; /* available voltages */ 174 u32 ocr_mask; /* available voltages */
179 175
176 unsigned timing; /* Current timing */
177
178 u32 thread_isr;
179
180 /* cached registers */
181 u32 ier;
182
180 wait_queue_head_t buf_ready_int; /* Waitqueue for Buffer Read Ready interrupt */ 183 wait_queue_head_t buf_ready_int; /* Waitqueue for Buffer Read Ready interrupt */
181 unsigned int tuning_done; /* Condition flag set when CMD19 succeeds */ 184 unsigned int tuning_done; /* Condition flag set when CMD19 succeeds */
182 185
diff --git a/include/linux/mmdebug.h b/include/linux/mmdebug.h
index 2d57efa64cc1..edd82a105220 100644
--- a/include/linux/mmdebug.h
+++ b/include/linux/mmdebug.h
@@ -1,6 +1,8 @@
1#ifndef LINUX_MM_DEBUG_H 1#ifndef LINUX_MM_DEBUG_H
2#define LINUX_MM_DEBUG_H 1 2#define LINUX_MM_DEBUG_H 1
3 3
4#include <linux/stringify.h>
5
4struct page; 6struct page;
5 7
6extern void dump_page(struct page *page, const char *reason); 8extern void dump_page(struct page *page, const char *reason);
@@ -9,11 +11,20 @@ extern void dump_page_badflags(struct page *page, const char *reason,
9 11
10#ifdef CONFIG_DEBUG_VM 12#ifdef CONFIG_DEBUG_VM
11#define VM_BUG_ON(cond) BUG_ON(cond) 13#define VM_BUG_ON(cond) BUG_ON(cond)
12#define VM_BUG_ON_PAGE(cond, page) \ 14#define VM_BUG_ON_PAGE(cond, page) \
13 do { if (unlikely(cond)) { dump_page(page, NULL); BUG(); } } while (0) 15 do { \
16 if (unlikely(cond)) { \
17 dump_page(page, "VM_BUG_ON_PAGE(" __stringify(cond)")");\
18 BUG(); \
19 } \
20 } while (0)
21#define VM_WARN_ON(cond) WARN_ON(cond)
22#define VM_WARN_ON_ONCE(cond) WARN_ON_ONCE(cond)
14#else 23#else
15#define VM_BUG_ON(cond) BUILD_BUG_ON_INVALID(cond) 24#define VM_BUG_ON(cond) BUILD_BUG_ON_INVALID(cond)
16#define VM_BUG_ON_PAGE(cond, page) VM_BUG_ON(cond) 25#define VM_BUG_ON_PAGE(cond, page) VM_BUG_ON(cond)
26#define VM_WARN_ON(cond) BUILD_BUG_ON_INVALID(cond)
27#define VM_WARN_ON_ONCE(cond) BUILD_BUG_ON_INVALID(cond)
17#endif 28#endif
18 29
19#ifdef CONFIG_DEBUG_VIRTUAL 30#ifdef CONFIG_DEBUG_VIRTUAL
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index fac5509c18f0..6cbd1b6c3d20 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -75,9 +75,18 @@ enum {
75 75
76extern int page_group_by_mobility_disabled; 76extern int page_group_by_mobility_disabled;
77 77
78static inline int get_pageblock_migratetype(struct page *page) 78#define NR_MIGRATETYPE_BITS (PB_migrate_end - PB_migrate + 1)
79#define MIGRATETYPE_MASK ((1UL << NR_MIGRATETYPE_BITS) - 1)
80
81#define get_pageblock_migratetype(page) \
82 get_pfnblock_flags_mask(page, page_to_pfn(page), \
83 PB_migrate_end, MIGRATETYPE_MASK)
84
85static inline int get_pfnblock_migratetype(struct page *page, unsigned long pfn)
79{ 86{
80 return get_pageblock_flags_group(page, PB_migrate, PB_migrate_end); 87 BUILD_BUG_ON(PB_migrate_end - PB_migrate != 2);
88 return get_pfnblock_flags_mask(page, pfn, PB_migrate_end,
89 MIGRATETYPE_MASK);
81} 90}
82 91
83struct free_area { 92struct free_area {
@@ -360,9 +369,10 @@ struct zone {
360 /* Set to true when the PG_migrate_skip bits should be cleared */ 369 /* Set to true when the PG_migrate_skip bits should be cleared */
361 bool compact_blockskip_flush; 370 bool compact_blockskip_flush;
362 371
363 /* pfns where compaction scanners should start */ 372 /* pfn where compaction free scanner should start */
364 unsigned long compact_cached_free_pfn; 373 unsigned long compact_cached_free_pfn;
365 unsigned long compact_cached_migrate_pfn; 374 /* pfn where async and sync compaction migration scanner should start */
375 unsigned long compact_cached_migrate_pfn[2];
366#endif 376#endif
367#ifdef CONFIG_MEMORY_HOTPLUG 377#ifdef CONFIG_MEMORY_HOTPLUG
368 /* see spanned/present_pages for more description */ 378 /* see spanned/present_pages for more description */
@@ -481,9 +491,8 @@ struct zone {
481 * give them a chance of being in the same cacheline. 491 * give them a chance of being in the same cacheline.
482 * 492 *
483 * Write access to present_pages at runtime should be protected by 493 * Write access to present_pages at runtime should be protected by
484 * lock_memory_hotplug()/unlock_memory_hotplug(). Any reader who can't 494 * mem_hotplug_begin/end(). Any reader who can't tolerant drift of
485 * tolerant drift of present_pages should hold memory hotplug lock to 495 * present_pages should get_online_mems() to get a stable value.
486 * get a stable value.
487 * 496 *
488 * Read access to managed_pages should be safe because it's unsigned 497 * Read access to managed_pages should be safe because it's unsigned
489 * long. Write access to zone->managed_pages and totalram_pages are 498 * long. Write access to zone->managed_pages and totalram_pages are
@@ -763,10 +772,10 @@ typedef struct pglist_data {
763 unsigned long node_spanned_pages; /* total size of physical page 772 unsigned long node_spanned_pages; /* total size of physical page
764 range, including holes */ 773 range, including holes */
765 int node_id; 774 int node_id;
766 nodemask_t reclaim_nodes; /* Nodes allowed to reclaim from */
767 wait_queue_head_t kswapd_wait; 775 wait_queue_head_t kswapd_wait;
768 wait_queue_head_t pfmemalloc_wait; 776 wait_queue_head_t pfmemalloc_wait;
769 struct task_struct *kswapd; /* Protected by lock_memory_hotplug() */ 777 struct task_struct *kswapd; /* Protected by
778 mem_hotplug_begin/end() */
770 int kswapd_max_order; 779 int kswapd_max_order;
771 enum zone_type classzone_idx; 780 enum zone_type classzone_idx;
772#ifdef CONFIG_NUMA_BALANCING 781#ifdef CONFIG_NUMA_BALANCING
@@ -808,10 +817,10 @@ static inline bool pgdat_is_empty(pg_data_t *pgdat)
808extern struct mutex zonelists_mutex; 817extern struct mutex zonelists_mutex;
809void build_all_zonelists(pg_data_t *pgdat, struct zone *zone); 818void build_all_zonelists(pg_data_t *pgdat, struct zone *zone);
810void wakeup_kswapd(struct zone *zone, int order, enum zone_type classzone_idx); 819void wakeup_kswapd(struct zone *zone, int order, enum zone_type classzone_idx);
811bool zone_watermark_ok(struct zone *z, int order, unsigned long mark, 820bool zone_watermark_ok(struct zone *z, unsigned int order,
812 int classzone_idx, int alloc_flags); 821 unsigned long mark, int classzone_idx, int alloc_flags);
813bool zone_watermark_ok_safe(struct zone *z, int order, unsigned long mark, 822bool zone_watermark_ok_safe(struct zone *z, unsigned int order,
814 int classzone_idx, int alloc_flags); 823 unsigned long mark, int classzone_idx, int alloc_flags);
815enum memmap_context { 824enum memmap_context {
816 MEMMAP_EARLY, 825 MEMMAP_EARLY,
817 MEMMAP_HOTPLUG, 826 MEMMAP_HOTPLUG,
diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h
index 204a67743804..b1990c5524e1 100644
--- a/include/linux/moduleparam.h
+++ b/include/linux/moduleparam.h
@@ -321,7 +321,7 @@ extern bool parameq(const char *name1, const char *name2);
321extern bool parameqn(const char *name1, const char *name2, size_t n); 321extern bool parameqn(const char *name1, const char *name2, size_t n);
322 322
323/* Called on module insert or kernel boot */ 323/* Called on module insert or kernel boot */
324extern int parse_args(const char *name, 324extern char *parse_args(const char *name,
325 char *args, 325 char *args,
326 const struct kernel_param *params, 326 const struct kernel_param *params,
327 unsigned num, 327 unsigned num,
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 450d61ec7f06..2f0af2891f0f 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -176,6 +176,11 @@ typedef enum {
176/* Chip may not exist, so silence any errors in scan */ 176/* Chip may not exist, so silence any errors in scan */
177#define NAND_SCAN_SILENT_NODEV 0x00040000 177#define NAND_SCAN_SILENT_NODEV 0x00040000
178/* 178/*
179 * This option could be defined by controller drivers to protect against
180 * kmap'ed, vmalloc'ed highmem buffers being passed from upper layers
181 */
182#define NAND_USE_BOUNCE_BUFFER 0x00080000
183/*
179 * Autodetect nand buswidth with readid/onfi. 184 * Autodetect nand buswidth with readid/onfi.
180 * This suppose the driver will configure the hardware in 8 bits mode 185 * This suppose the driver will configure the hardware in 8 bits mode
181 * when calling nand_scan_ident, and update its configuration 186 * when calling nand_scan_ident, and update its configuration
@@ -552,8 +557,7 @@ struct nand_buffers {
552 * @ecc: [BOARDSPECIFIC] ECC control structure 557 * @ecc: [BOARDSPECIFIC] ECC control structure
553 * @buffers: buffer structure for read/write 558 * @buffers: buffer structure for read/write
554 * @hwcontrol: platform-specific hardware control structure 559 * @hwcontrol: platform-specific hardware control structure
555 * @erase_cmd: [INTERN] erase command write function, selectable due 560 * @erase: [REPLACEABLE] erase function
556 * to AND support.
557 * @scan_bbt: [REPLACEABLE] function to scan bad block table 561 * @scan_bbt: [REPLACEABLE] function to scan bad block table
558 * @chip_delay: [BOARDSPECIFIC] chip dependent delay for transferring 562 * @chip_delay: [BOARDSPECIFIC] chip dependent delay for transferring
559 * data from array to read regs (tR). 563 * data from array to read regs (tR).
@@ -637,7 +641,7 @@ struct nand_chip {
637 void (*cmdfunc)(struct mtd_info *mtd, unsigned command, int column, 641 void (*cmdfunc)(struct mtd_info *mtd, unsigned command, int column,
638 int page_addr); 642 int page_addr);
639 int(*waitfunc)(struct mtd_info *mtd, struct nand_chip *this); 643 int(*waitfunc)(struct mtd_info *mtd, struct nand_chip *this);
640 void (*erase_cmd)(struct mtd_info *mtd, int page); 644 int (*erase)(struct mtd_info *mtd, int page);
641 int (*scan_bbt)(struct mtd_info *mtd); 645 int (*scan_bbt)(struct mtd_info *mtd);
642 int (*errstat)(struct mtd_info *mtd, struct nand_chip *this, int state, 646 int (*errstat)(struct mtd_info *mtd, struct nand_chip *this, int state,
643 int status, int page); 647 int status, int page);
diff --git a/include/linux/mtd/pfow.h b/include/linux/mtd/pfow.h
index b730d4f84655..42ff7ff09bf5 100644
--- a/include/linux/mtd/pfow.h
+++ b/include/linux/mtd/pfow.h
@@ -101,9 +101,6 @@ static inline void send_pfow_command(struct map_info *map,
101 unsigned long len, map_word *datum) 101 unsigned long len, map_word *datum)
102{ 102{
103 int bits_per_chip = map_bankwidth(map) * 8; 103 int bits_per_chip = map_bankwidth(map) * 8;
104 int chipnum;
105 struct lpddr_private *lpddr = map->fldrv_priv;
106 chipnum = adr >> lpddr->chipshift;
107 104
108 map_write(map, CMD(cmd_code), map->pfow_base + PFOW_COMMAND_CODE); 105 map_write(map, CMD(cmd_code), map->pfow_base + PFOW_COMMAND_CODE);
109 map_write(map, CMD(adr & ((1<<bits_per_chip) - 1)), 106 map_write(map, CMD(adr & ((1<<bits_per_chip) - 1)),
diff --git a/include/linux/mtd/spi-nor.h b/include/linux/mtd/spi-nor.h
new file mode 100644
index 000000000000..53241842a7ab
--- /dev/null
+++ b/include/linux/mtd/spi-nor.h
@@ -0,0 +1,214 @@
1/*
2 * Copyright (C) 2014 Freescale Semiconductor, Inc.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 */
9
10#ifndef __LINUX_MTD_SPI_NOR_H
11#define __LINUX_MTD_SPI_NOR_H
12
13/*
14 * Note on opcode nomenclature: some opcodes have a format like
15 * SPINOR_OP_FUNCTION{4,}_x_y_z. The numbers x, y, and z stand for the number
16 * of I/O lines used for the opcode, address, and data (respectively). The
17 * FUNCTION has an optional suffix of '4', to represent an opcode which
18 * requires a 4-byte (32-bit) address.
19 */
20
21/* Flash opcodes. */
22#define SPINOR_OP_WREN 0x06 /* Write enable */
23#define SPINOR_OP_RDSR 0x05 /* Read status register */
24#define SPINOR_OP_WRSR 0x01 /* Write status register 1 byte */
25#define SPINOR_OP_READ 0x03 /* Read data bytes (low frequency) */
26#define SPINOR_OP_READ_FAST 0x0b /* Read data bytes (high frequency) */
27#define SPINOR_OP_READ_1_1_2 0x3b /* Read data bytes (Dual SPI) */
28#define SPINOR_OP_READ_1_1_4 0x6b /* Read data bytes (Quad SPI) */
29#define SPINOR_OP_PP 0x02 /* Page program (up to 256 bytes) */
30#define SPINOR_OP_BE_4K 0x20 /* Erase 4KiB block */
31#define SPINOR_OP_BE_4K_PMC 0xd7 /* Erase 4KiB block on PMC chips */
32#define SPINOR_OP_BE_32K 0x52 /* Erase 32KiB block */
33#define SPINOR_OP_CHIP_ERASE 0xc7 /* Erase whole flash chip */
34#define SPINOR_OP_SE 0xd8 /* Sector erase (usually 64KiB) */
35#define SPINOR_OP_RDID 0x9f /* Read JEDEC ID */
36#define SPINOR_OP_RDCR 0x35 /* Read configuration register */
37
38/* 4-byte address opcodes - used on Spansion and some Macronix flashes. */
39#define SPINOR_OP_READ4 0x13 /* Read data bytes (low frequency) */
40#define SPINOR_OP_READ4_FAST 0x0c /* Read data bytes (high frequency) */
41#define SPINOR_OP_READ4_1_1_2 0x3c /* Read data bytes (Dual SPI) */
42#define SPINOR_OP_READ4_1_1_4 0x6c /* Read data bytes (Quad SPI) */
43#define SPINOR_OP_PP_4B 0x12 /* Page program (up to 256 bytes) */
44#define SPINOR_OP_SE_4B 0xdc /* Sector erase (usually 64KiB) */
45
46/* Used for SST flashes only. */
47#define SPINOR_OP_BP 0x02 /* Byte program */
48#define SPINOR_OP_WRDI 0x04 /* Write disable */
49#define SPINOR_OP_AAI_WP 0xad /* Auto address increment word program */
50
51/* Used for Macronix and Winbond flashes. */
52#define SPINOR_OP_EN4B 0xb7 /* Enter 4-byte mode */
53#define SPINOR_OP_EX4B 0xe9 /* Exit 4-byte mode */
54
55/* Used for Spansion flashes only. */
56#define SPINOR_OP_BRWR 0x17 /* Bank register write */
57
58/* Status Register bits. */
59#define SR_WIP 1 /* Write in progress */
60#define SR_WEL 2 /* Write enable latch */
61/* meaning of other SR_* bits may differ between vendors */
62#define SR_BP0 4 /* Block protect 0 */
63#define SR_BP1 8 /* Block protect 1 */
64#define SR_BP2 0x10 /* Block protect 2 */
65#define SR_SRWD 0x80 /* SR write protect */
66
67#define SR_QUAD_EN_MX 0x40 /* Macronix Quad I/O */
68
69/* Configuration Register bits. */
70#define CR_QUAD_EN_SPAN 0x2 /* Spansion Quad I/O */
71
72enum read_mode {
73 SPI_NOR_NORMAL = 0,
74 SPI_NOR_FAST,
75 SPI_NOR_DUAL,
76 SPI_NOR_QUAD,
77};
78
79/**
80 * struct spi_nor_xfer_cfg - Structure for defining a Serial Flash transfer
81 * @wren: command for "Write Enable", or 0x00 for not required
82 * @cmd: command for operation
83 * @cmd_pins: number of pins to send @cmd (1, 2, 4)
84 * @addr: address for operation
85 * @addr_pins: number of pins to send @addr (1, 2, 4)
86 * @addr_width: number of address bytes
87 * (3,4, or 0 for address not required)
88 * @mode: mode data
89 * @mode_pins: number of pins to send @mode (1, 2, 4)
90 * @mode_cycles: number of mode cycles (0 for mode not required)
91 * @dummy_cycles: number of dummy cycles (0 for dummy not required)
92 */
93struct spi_nor_xfer_cfg {
94 u8 wren;
95 u8 cmd;
96 u8 cmd_pins;
97 u32 addr;
98 u8 addr_pins;
99 u8 addr_width;
100 u8 mode;
101 u8 mode_pins;
102 u8 mode_cycles;
103 u8 dummy_cycles;
104};
105
106#define SPI_NOR_MAX_CMD_SIZE 8
107enum spi_nor_ops {
108 SPI_NOR_OPS_READ = 0,
109 SPI_NOR_OPS_WRITE,
110 SPI_NOR_OPS_ERASE,
111 SPI_NOR_OPS_LOCK,
112 SPI_NOR_OPS_UNLOCK,
113};
114
115/**
116 * struct spi_nor - Structure for defining a the SPI NOR layer
117 * @mtd: point to a mtd_info structure
118 * @lock: the lock for the read/write/erase/lock/unlock operations
119 * @dev: point to a spi device, or a spi nor controller device.
120 * @page_size: the page size of the SPI NOR
121 * @addr_width: number of address bytes
122 * @erase_opcode: the opcode for erasing a sector
123 * @read_opcode: the read opcode
124 * @read_dummy: the dummy needed by the read operation
125 * @program_opcode: the program opcode
126 * @flash_read: the mode of the read
127 * @sst_write_second: used by the SST write operation
128 * @cfg: used by the read_xfer/write_xfer
129 * @cmd_buf: used by the write_reg
130 * @prepare: [OPTIONAL] do some preparations for the
131 * read/write/erase/lock/unlock operations
132 * @unprepare: [OPTIONAL] do some post work after the
133 * read/write/erase/lock/unlock operations
134 * @read_xfer: [OPTIONAL] the read fundamental primitive
135 * @write_xfer: [OPTIONAL] the writefundamental primitive
136 * @read_reg: [DRIVER-SPECIFIC] read out the register
137 * @write_reg: [DRIVER-SPECIFIC] write data to the register
138 * @read_id: [REPLACEABLE] read out the ID data, and find
139 * the proper spi_device_id
140 * @wait_till_ready: [REPLACEABLE] wait till the NOR becomes ready
141 * @read: [DRIVER-SPECIFIC] read data from the SPI NOR
142 * @write: [DRIVER-SPECIFIC] write data to the SPI NOR
143 * @erase: [DRIVER-SPECIFIC] erase a sector of the SPI NOR
144 * at the offset @offs
145 * @priv: the private data
146 */
147struct spi_nor {
148 struct mtd_info *mtd;
149 struct mutex lock;
150 struct device *dev;
151 u32 page_size;
152 u8 addr_width;
153 u8 erase_opcode;
154 u8 read_opcode;
155 u8 read_dummy;
156 u8 program_opcode;
157 enum read_mode flash_read;
158 bool sst_write_second;
159 struct spi_nor_xfer_cfg cfg;
160 u8 cmd_buf[SPI_NOR_MAX_CMD_SIZE];
161
162 int (*prepare)(struct spi_nor *nor, enum spi_nor_ops ops);
163 void (*unprepare)(struct spi_nor *nor, enum spi_nor_ops ops);
164 int (*read_xfer)(struct spi_nor *nor, struct spi_nor_xfer_cfg *cfg,
165 u8 *buf, size_t len);
166 int (*write_xfer)(struct spi_nor *nor, struct spi_nor_xfer_cfg *cfg,
167 u8 *buf, size_t len);
168 int (*read_reg)(struct spi_nor *nor, u8 opcode, u8 *buf, int len);
169 int (*write_reg)(struct spi_nor *nor, u8 opcode, u8 *buf, int len,
170 int write_enable);
171 const struct spi_device_id *(*read_id)(struct spi_nor *nor);
172 int (*wait_till_ready)(struct spi_nor *nor);
173
174 int (*read)(struct spi_nor *nor, loff_t from,
175 size_t len, size_t *retlen, u_char *read_buf);
176 void (*write)(struct spi_nor *nor, loff_t to,
177 size_t len, size_t *retlen, const u_char *write_buf);
178 int (*erase)(struct spi_nor *nor, loff_t offs);
179
180 void *priv;
181};
182
183/**
184 * spi_nor_scan() - scan the SPI NOR
185 * @nor: the spi_nor structure
186 * @id: the spi_device_id provided by the driver
187 * @mode: the read mode supported by the driver
188 *
189 * The drivers can use this fuction to scan the SPI NOR.
190 * In the scanning, it will try to get all the necessary information to
191 * fill the mtd_info{} and the spi_nor{}.
192 *
193 * The board may assigns a spi_device_id with @id which be used to compared with
194 * the spi_device_id detected by the scanning.
195 *
196 * Return: 0 for success, others for failure.
197 */
198int spi_nor_scan(struct spi_nor *nor, const struct spi_device_id *id,
199 enum read_mode mode);
200extern const struct spi_device_id spi_nor_ids[];
201
202/**
203 * spi_nor_match_id() - find the spi_device_id by the name
204 * @name: the name of the spi_device_id
205 *
206 * The drivers use this function to find the spi_device_id
207 * specified by the @name.
208 *
209 * Return: returns the right spi_device_id pointer on success,
210 * and returns NULL on failure.
211 */
212const struct spi_device_id *spi_nor_match_id(char *name);
213
214#endif
diff --git a/include/linux/net.h b/include/linux/net.h
index 94734a6259a4..17d83393afcc 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -248,24 +248,17 @@ do { \
248bool __net_get_random_once(void *buf, int nbytes, bool *done, 248bool __net_get_random_once(void *buf, int nbytes, bool *done,
249 struct static_key *done_key); 249 struct static_key *done_key);
250 250
251#ifdef HAVE_JUMP_LABEL
252#define ___NET_RANDOM_STATIC_KEY_INIT ((struct static_key) \
253 { .enabled = ATOMIC_INIT(0), .entries = (void *)1 })
254#else /* !HAVE_JUMP_LABEL */
255#define ___NET_RANDOM_STATIC_KEY_INIT STATIC_KEY_INIT_FALSE
256#endif /* HAVE_JUMP_LABEL */
257
258#define net_get_random_once(buf, nbytes) \ 251#define net_get_random_once(buf, nbytes) \
259 ({ \ 252 ({ \
260 bool ___ret = false; \ 253 bool ___ret = false; \
261 static bool ___done = false; \ 254 static bool ___done = false; \
262 static struct static_key ___done_key = \ 255 static struct static_key ___once_key = \
263 ___NET_RANDOM_STATIC_KEY_INIT; \ 256 STATIC_KEY_INIT_TRUE; \
264 if (!static_key_true(&___done_key)) \ 257 if (static_key_true(&___once_key)) \
265 ___ret = __net_get_random_once(buf, \ 258 ___ret = __net_get_random_once(buf, \
266 nbytes, \ 259 nbytes, \
267 &___done, \ 260 &___done, \
268 &___done_key); \ 261 &___once_key); \
269 ___ret; \ 262 ___ret; \
270 }) 263 })
271 264
diff --git a/include/linux/netdev_features.h b/include/linux/netdev_features.h
index c26d0ec2ef3a..d99800cbdcf3 100644
--- a/include/linux/netdev_features.h
+++ b/include/linux/netdev_features.h
@@ -42,9 +42,11 @@ enum {
42 NETIF_F_TSO6_BIT, /* ... TCPv6 segmentation */ 42 NETIF_F_TSO6_BIT, /* ... TCPv6 segmentation */
43 NETIF_F_FSO_BIT, /* ... FCoE segmentation */ 43 NETIF_F_FSO_BIT, /* ... FCoE segmentation */
44 NETIF_F_GSO_GRE_BIT, /* ... GRE with TSO */ 44 NETIF_F_GSO_GRE_BIT, /* ... GRE with TSO */
45 NETIF_F_GSO_GRE_CSUM_BIT, /* ... GRE with csum with TSO */
45 NETIF_F_GSO_IPIP_BIT, /* ... IPIP tunnel with TSO */ 46 NETIF_F_GSO_IPIP_BIT, /* ... IPIP tunnel with TSO */
46 NETIF_F_GSO_SIT_BIT, /* ... SIT tunnel with TSO */ 47 NETIF_F_GSO_SIT_BIT, /* ... SIT tunnel with TSO */
47 NETIF_F_GSO_UDP_TUNNEL_BIT, /* ... UDP TUNNEL with TSO */ 48 NETIF_F_GSO_UDP_TUNNEL_BIT, /* ... UDP TUNNEL with TSO */
49 NETIF_F_GSO_UDP_TUNNEL_CSUM_BIT,/* ... UDP TUNNEL with TSO & CSUM */
48 NETIF_F_GSO_MPLS_BIT, /* ... MPLS segmentation */ 50 NETIF_F_GSO_MPLS_BIT, /* ... MPLS segmentation */
49 /**/NETIF_F_GSO_LAST = /* last bit, see GSO_MASK */ 51 /**/NETIF_F_GSO_LAST = /* last bit, see GSO_MASK */
50 NETIF_F_GSO_MPLS_BIT, 52 NETIF_F_GSO_MPLS_BIT,
@@ -111,9 +113,11 @@ enum {
111#define NETIF_F_RXFCS __NETIF_F(RXFCS) 113#define NETIF_F_RXFCS __NETIF_F(RXFCS)
112#define NETIF_F_RXALL __NETIF_F(RXALL) 114#define NETIF_F_RXALL __NETIF_F(RXALL)
113#define NETIF_F_GSO_GRE __NETIF_F(GSO_GRE) 115#define NETIF_F_GSO_GRE __NETIF_F(GSO_GRE)
116#define NETIF_F_GSO_GRE_CSUM __NETIF_F(GSO_GRE_CSUM)
114#define NETIF_F_GSO_IPIP __NETIF_F(GSO_IPIP) 117#define NETIF_F_GSO_IPIP __NETIF_F(GSO_IPIP)
115#define NETIF_F_GSO_SIT __NETIF_F(GSO_SIT) 118#define NETIF_F_GSO_SIT __NETIF_F(GSO_SIT)
116#define NETIF_F_GSO_UDP_TUNNEL __NETIF_F(GSO_UDP_TUNNEL) 119#define NETIF_F_GSO_UDP_TUNNEL __NETIF_F(GSO_UDP_TUNNEL)
120#define NETIF_F_GSO_UDP_TUNNEL_CSUM __NETIF_F(GSO_UDP_TUNNEL_CSUM)
117#define NETIF_F_GSO_MPLS __NETIF_F(GSO_MPLS) 121#define NETIF_F_GSO_MPLS __NETIF_F(GSO_MPLS)
118#define NETIF_F_HW_VLAN_STAG_FILTER __NETIF_F(HW_VLAN_STAG_FILTER) 122#define NETIF_F_HW_VLAN_STAG_FILTER __NETIF_F(HW_VLAN_STAG_FILTER)
119#define NETIF_F_HW_VLAN_STAG_RX __NETIF_F(HW_VLAN_STAG_RX) 123#define NETIF_F_HW_VLAN_STAG_RX __NETIF_F(HW_VLAN_STAG_RX)
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 7ed3a3aa6604..66f9a04ec270 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -56,9 +56,6 @@ struct device;
56struct phy_device; 56struct phy_device;
57/* 802.11 specific */ 57/* 802.11 specific */
58struct wireless_dev; 58struct wireless_dev;
59 /* source back-compat hooks */
60#define SET_ETHTOOL_OPS(netdev,ops) \
61 ( (netdev)->ethtool_ops = (ops) )
62 59
63void netdev_set_default_ethtool_ops(struct net_device *dev, 60void netdev_set_default_ethtool_ops(struct net_device *dev,
64 const struct ethtool_ops *ops); 61 const struct ethtool_ops *ops);
@@ -493,7 +490,7 @@ static inline void napi_disable(struct napi_struct *n)
493static inline void napi_enable(struct napi_struct *n) 490static inline void napi_enable(struct napi_struct *n)
494{ 491{
495 BUG_ON(!test_bit(NAPI_STATE_SCHED, &n->state)); 492 BUG_ON(!test_bit(NAPI_STATE_SCHED, &n->state));
496 smp_mb__before_clear_bit(); 493 smp_mb__before_atomic();
497 clear_bit(NAPI_STATE_SCHED, &n->state); 494 clear_bit(NAPI_STATE_SCHED, &n->state);
498} 495}
499 496
@@ -853,7 +850,8 @@ typedef u16 (*select_queue_fallback_t)(struct net_device *dev,
853 * SR-IOV management functions. 850 * SR-IOV management functions.
854 * int (*ndo_set_vf_mac)(struct net_device *dev, int vf, u8* mac); 851 * int (*ndo_set_vf_mac)(struct net_device *dev, int vf, u8* mac);
855 * int (*ndo_set_vf_vlan)(struct net_device *dev, int vf, u16 vlan, u8 qos); 852 * int (*ndo_set_vf_vlan)(struct net_device *dev, int vf, u16 vlan, u8 qos);
856 * int (*ndo_set_vf_tx_rate)(struct net_device *dev, int vf, int rate); 853 * int (*ndo_set_vf_rate)(struct net_device *dev, int vf, int min_tx_rate,
854 * int max_tx_rate);
857 * int (*ndo_set_vf_spoofchk)(struct net_device *dev, int vf, bool setting); 855 * int (*ndo_set_vf_spoofchk)(struct net_device *dev, int vf, bool setting);
858 * int (*ndo_get_vf_config)(struct net_device *dev, 856 * int (*ndo_get_vf_config)(struct net_device *dev,
859 * int vf, struct ifla_vf_info *ivf); 857 * int vf, struct ifla_vf_info *ivf);
@@ -1047,8 +1045,9 @@ struct net_device_ops {
1047 int queue, u8 *mac); 1045 int queue, u8 *mac);
1048 int (*ndo_set_vf_vlan)(struct net_device *dev, 1046 int (*ndo_set_vf_vlan)(struct net_device *dev,
1049 int queue, u16 vlan, u8 qos); 1047 int queue, u16 vlan, u8 qos);
1050 int (*ndo_set_vf_tx_rate)(struct net_device *dev, 1048 int (*ndo_set_vf_rate)(struct net_device *dev,
1051 int vf, int rate); 1049 int vf, int min_tx_rate,
1050 int max_tx_rate);
1052 int (*ndo_set_vf_spoofchk)(struct net_device *dev, 1051 int (*ndo_set_vf_spoofchk)(struct net_device *dev,
1053 int vf, bool setting); 1052 int vf, bool setting);
1054 int (*ndo_get_vf_config)(struct net_device *dev, 1053 int (*ndo_get_vf_config)(struct net_device *dev,
@@ -1144,6 +1143,7 @@ struct net_device_ops {
1144 netdev_tx_t (*ndo_dfwd_start_xmit) (struct sk_buff *skb, 1143 netdev_tx_t (*ndo_dfwd_start_xmit) (struct sk_buff *skb,
1145 struct net_device *dev, 1144 struct net_device *dev,
1146 void *priv); 1145 void *priv);
1146 int (*ndo_get_lock_subclass)(struct net_device *dev);
1147}; 1147};
1148 1148
1149/** 1149/**
@@ -2633,6 +2633,7 @@ int dev_get_phys_port_id(struct net_device *dev,
2633 struct netdev_phys_port_id *ppid); 2633 struct netdev_phys_port_id *ppid);
2634int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev, 2634int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
2635 struct netdev_queue *txq); 2635 struct netdev_queue *txq);
2636int __dev_forward_skb(struct net_device *dev, struct sk_buff *skb);
2636int dev_forward_skb(struct net_device *dev, struct sk_buff *skb); 2637int dev_forward_skb(struct net_device *dev, struct sk_buff *skb);
2637bool is_skb_forwardable(struct net_device *dev, struct sk_buff *skb); 2638bool is_skb_forwardable(struct net_device *dev, struct sk_buff *skb);
2638 2639
@@ -2950,7 +2951,12 @@ static inline void netif_addr_lock(struct net_device *dev)
2950 2951
2951static inline void netif_addr_lock_nested(struct net_device *dev) 2952static inline void netif_addr_lock_nested(struct net_device *dev)
2952{ 2953{
2953 spin_lock_nested(&dev->addr_list_lock, SINGLE_DEPTH_NESTING); 2954 int subclass = SINGLE_DEPTH_NESTING;
2955
2956 if (dev->netdev_ops->ndo_get_lock_subclass)
2957 subclass = dev->netdev_ops->ndo_get_lock_subclass(dev);
2958
2959 spin_lock_nested(&dev->addr_list_lock, subclass);
2954} 2960}
2955 2961
2956static inline void netif_addr_lock_bh(struct net_device *dev) 2962static inline void netif_addr_lock_bh(struct net_device *dev)
@@ -2997,6 +3003,15 @@ int __hw_addr_sync(struct netdev_hw_addr_list *to_list,
2997 struct netdev_hw_addr_list *from_list, int addr_len); 3003 struct netdev_hw_addr_list *from_list, int addr_len);
2998void __hw_addr_unsync(struct netdev_hw_addr_list *to_list, 3004void __hw_addr_unsync(struct netdev_hw_addr_list *to_list,
2999 struct netdev_hw_addr_list *from_list, int addr_len); 3005 struct netdev_hw_addr_list *from_list, int addr_len);
3006int __hw_addr_sync_dev(struct netdev_hw_addr_list *list,
3007 struct net_device *dev,
3008 int (*sync)(struct net_device *, const unsigned char *),
3009 int (*unsync)(struct net_device *,
3010 const unsigned char *));
3011void __hw_addr_unsync_dev(struct netdev_hw_addr_list *list,
3012 struct net_device *dev,
3013 int (*unsync)(struct net_device *,
3014 const unsigned char *));
3000void __hw_addr_init(struct netdev_hw_addr_list *list); 3015void __hw_addr_init(struct netdev_hw_addr_list *list);
3001 3016
3002/* Functions used for device addresses handling */ 3017/* Functions used for device addresses handling */
@@ -3017,6 +3032,38 @@ void dev_uc_unsync(struct net_device *to, struct net_device *from);
3017void dev_uc_flush(struct net_device *dev); 3032void dev_uc_flush(struct net_device *dev);
3018void dev_uc_init(struct net_device *dev); 3033void dev_uc_init(struct net_device *dev);
3019 3034
3035/**
3036 * __dev_uc_sync - Synchonize device's unicast list
3037 * @dev: device to sync
3038 * @sync: function to call if address should be added
3039 * @unsync: function to call if address should be removed
3040 *
3041 * Add newly added addresses to the interface, and release
3042 * addresses that have been deleted.
3043 **/
3044static inline int __dev_uc_sync(struct net_device *dev,
3045 int (*sync)(struct net_device *,
3046 const unsigned char *),
3047 int (*unsync)(struct net_device *,
3048 const unsigned char *))
3049{
3050 return __hw_addr_sync_dev(&dev->uc, dev, sync, unsync);
3051}
3052
3053/**
3054 * __dev_uc_unsync - Remove synchonized addresses from device
3055 * @dev: device to sync
3056 * @unsync: function to call if address should be removed
3057 *
3058 * Remove all addresses that were added to the device by dev_uc_sync().
3059 **/
3060static inline void __dev_uc_unsync(struct net_device *dev,
3061 int (*unsync)(struct net_device *,
3062 const unsigned char *))
3063{
3064 __hw_addr_unsync_dev(&dev->uc, dev, unsync);
3065}
3066
3020/* Functions used for multicast addresses handling */ 3067/* Functions used for multicast addresses handling */
3021int dev_mc_add(struct net_device *dev, const unsigned char *addr); 3068int dev_mc_add(struct net_device *dev, const unsigned char *addr);
3022int dev_mc_add_global(struct net_device *dev, const unsigned char *addr); 3069int dev_mc_add_global(struct net_device *dev, const unsigned char *addr);
@@ -3029,6 +3076,38 @@ void dev_mc_unsync(struct net_device *to, struct net_device *from);
3029void dev_mc_flush(struct net_device *dev); 3076void dev_mc_flush(struct net_device *dev);
3030void dev_mc_init(struct net_device *dev); 3077void dev_mc_init(struct net_device *dev);
3031 3078
3079/**
3080 * __dev_mc_sync - Synchonize device's multicast list
3081 * @dev: device to sync
3082 * @sync: function to call if address should be added
3083 * @unsync: function to call if address should be removed
3084 *
3085 * Add newly added addresses to the interface, and release
3086 * addresses that have been deleted.
3087 **/
3088static inline int __dev_mc_sync(struct net_device *dev,
3089 int (*sync)(struct net_device *,
3090 const unsigned char *),
3091 int (*unsync)(struct net_device *,
3092 const unsigned char *))
3093{
3094 return __hw_addr_sync_dev(&dev->mc, dev, sync, unsync);
3095}
3096
3097/**
3098 * __dev_mc_unsync - Remove synchonized addresses from device
3099 * @dev: device to sync
3100 * @unsync: function to call if address should be removed
3101 *
3102 * Remove all addresses that were added to the device by dev_mc_sync().
3103 **/
3104static inline void __dev_mc_unsync(struct net_device *dev,
3105 int (*unsync)(struct net_device *,
3106 const unsigned char *))
3107{
3108 __hw_addr_unsync_dev(&dev->mc, dev, unsync);
3109}
3110
3032/* Functions used for secondary unicast and multicast support */ 3111/* Functions used for secondary unicast and multicast support */
3033void dev_set_rx_mode(struct net_device *dev); 3112void dev_set_rx_mode(struct net_device *dev);
3034void __dev_set_rx_mode(struct net_device *dev); 3113void __dev_set_rx_mode(struct net_device *dev);
@@ -3050,10 +3129,19 @@ extern int weight_p;
3050extern int bpf_jit_enable; 3129extern int bpf_jit_enable;
3051 3130
3052bool netdev_has_upper_dev(struct net_device *dev, struct net_device *upper_dev); 3131bool netdev_has_upper_dev(struct net_device *dev, struct net_device *upper_dev);
3132struct net_device *netdev_upper_get_next_dev_rcu(struct net_device *dev,
3133 struct list_head **iter);
3053struct net_device *netdev_all_upper_get_next_dev_rcu(struct net_device *dev, 3134struct net_device *netdev_all_upper_get_next_dev_rcu(struct net_device *dev,
3054 struct list_head **iter); 3135 struct list_head **iter);
3055 3136
3056/* iterate through upper list, must be called under RCU read lock */ 3137/* iterate through upper list, must be called under RCU read lock */
3138#define netdev_for_each_upper_dev_rcu(dev, updev, iter) \
3139 for (iter = &(dev)->adj_list.upper, \
3140 updev = netdev_upper_get_next_dev_rcu(dev, &(iter)); \
3141 updev; \
3142 updev = netdev_upper_get_next_dev_rcu(dev, &(iter)))
3143
3144/* iterate through upper list, must be called under RCU read lock */
3057#define netdev_for_each_all_upper_dev_rcu(dev, updev, iter) \ 3145#define netdev_for_each_all_upper_dev_rcu(dev, updev, iter) \
3058 for (iter = &(dev)->all_adj_list.upper, \ 3146 for (iter = &(dev)->all_adj_list.upper, \
3059 updev = netdev_all_upper_get_next_dev_rcu(dev, &(iter)); \ 3147 updev = netdev_all_upper_get_next_dev_rcu(dev, &(iter)); \
@@ -3077,6 +3165,14 @@ void *netdev_lower_get_next_private_rcu(struct net_device *dev,
3077 priv; \ 3165 priv; \
3078 priv = netdev_lower_get_next_private_rcu(dev, &(iter))) 3166 priv = netdev_lower_get_next_private_rcu(dev, &(iter)))
3079 3167
3168void *netdev_lower_get_next(struct net_device *dev,
3169 struct list_head **iter);
3170#define netdev_for_each_lower_dev(dev, ldev, iter) \
3171 for (iter = &(dev)->adj_list.lower, \
3172 ldev = netdev_lower_get_next(dev, &(iter)); \
3173 ldev; \
3174 ldev = netdev_lower_get_next(dev, &(iter)))
3175
3080void *netdev_adjacent_get_private(struct list_head *adj_list); 3176void *netdev_adjacent_get_private(struct list_head *adj_list);
3081void *netdev_lower_get_first_private_rcu(struct net_device *dev); 3177void *netdev_lower_get_first_private_rcu(struct net_device *dev);
3082struct net_device *netdev_master_upper_dev_get(struct net_device *dev); 3178struct net_device *netdev_master_upper_dev_get(struct net_device *dev);
@@ -3092,6 +3188,8 @@ void netdev_upper_dev_unlink(struct net_device *dev,
3092void netdev_adjacent_rename_links(struct net_device *dev, char *oldname); 3188void netdev_adjacent_rename_links(struct net_device *dev, char *oldname);
3093void *netdev_lower_dev_get_private(struct net_device *dev, 3189void *netdev_lower_dev_get_private(struct net_device *dev,
3094 struct net_device *lower_dev); 3190 struct net_device *lower_dev);
3191int dev_get_nest_level(struct net_device *dev,
3192 bool (*type_check)(struct net_device *dev));
3095int skb_checksum_help(struct sk_buff *skb); 3193int skb_checksum_help(struct sk_buff *skb);
3096struct sk_buff *__skb_gso_segment(struct sk_buff *skb, 3194struct sk_buff *__skb_gso_segment(struct sk_buff *skb,
3097 netdev_features_t features, bool tx_path); 3195 netdev_features_t features, bool tx_path);
@@ -3155,6 +3253,20 @@ const char *netdev_drivername(const struct net_device *dev);
3155 3253
3156void linkwatch_run_queue(void); 3254void linkwatch_run_queue(void);
3157 3255
3256static inline netdev_features_t netdev_intersect_features(netdev_features_t f1,
3257 netdev_features_t f2)
3258{
3259 if (f1 & NETIF_F_GEN_CSUM)
3260 f1 |= (NETIF_F_ALL_CSUM & ~NETIF_F_GEN_CSUM);
3261 if (f2 & NETIF_F_GEN_CSUM)
3262 f2 |= (NETIF_F_ALL_CSUM & ~NETIF_F_GEN_CSUM);
3263 f1 &= f2;
3264 if (f1 & NETIF_F_GEN_CSUM)
3265 f1 &= ~(NETIF_F_ALL_CSUM & ~NETIF_F_GEN_CSUM);
3266
3267 return f1;
3268}
3269
3158static inline netdev_features_t netdev_get_wanted_features( 3270static inline netdev_features_t netdev_get_wanted_features(
3159 struct net_device *dev) 3271 struct net_device *dev)
3160{ 3272{
@@ -3180,12 +3292,7 @@ void netdev_change_features(struct net_device *dev);
3180void netif_stacked_transfer_operstate(const struct net_device *rootdev, 3292void netif_stacked_transfer_operstate(const struct net_device *rootdev,
3181 struct net_device *dev); 3293 struct net_device *dev);
3182 3294
3183netdev_features_t netif_skb_dev_features(struct sk_buff *skb, 3295netdev_features_t netif_skb_features(struct sk_buff *skb);
3184 const struct net_device *dev);
3185static inline netdev_features_t netif_skb_features(struct sk_buff *skb)
3186{
3187 return netif_skb_dev_features(skb, skb->dev);
3188}
3189 3296
3190static inline bool net_gso_ok(netdev_features_t features, int gso_type) 3297static inline bool net_gso_ok(netdev_features_t features, int gso_type)
3191{ 3298{
@@ -3198,6 +3305,13 @@ static inline bool net_gso_ok(netdev_features_t features, int gso_type)
3198 BUILD_BUG_ON(SKB_GSO_TCP_ECN != (NETIF_F_TSO_ECN >> NETIF_F_GSO_SHIFT)); 3305 BUILD_BUG_ON(SKB_GSO_TCP_ECN != (NETIF_F_TSO_ECN >> NETIF_F_GSO_SHIFT));
3199 BUILD_BUG_ON(SKB_GSO_TCPV6 != (NETIF_F_TSO6 >> NETIF_F_GSO_SHIFT)); 3306 BUILD_BUG_ON(SKB_GSO_TCPV6 != (NETIF_F_TSO6 >> NETIF_F_GSO_SHIFT));
3200 BUILD_BUG_ON(SKB_GSO_FCOE != (NETIF_F_FSO >> NETIF_F_GSO_SHIFT)); 3307 BUILD_BUG_ON(SKB_GSO_FCOE != (NETIF_F_FSO >> NETIF_F_GSO_SHIFT));
3308 BUILD_BUG_ON(SKB_GSO_GRE != (NETIF_F_GSO_GRE >> NETIF_F_GSO_SHIFT));
3309 BUILD_BUG_ON(SKB_GSO_GRE_CSUM != (NETIF_F_GSO_GRE_CSUM >> NETIF_F_GSO_SHIFT));
3310 BUILD_BUG_ON(SKB_GSO_IPIP != (NETIF_F_GSO_IPIP >> NETIF_F_GSO_SHIFT));
3311 BUILD_BUG_ON(SKB_GSO_SIT != (NETIF_F_GSO_SIT >> NETIF_F_GSO_SHIFT));
3312 BUILD_BUG_ON(SKB_GSO_UDP_TUNNEL != (NETIF_F_GSO_UDP_TUNNEL >> NETIF_F_GSO_SHIFT));
3313 BUILD_BUG_ON(SKB_GSO_UDP_TUNNEL_CSUM != (NETIF_F_GSO_UDP_TUNNEL_CSUM >> NETIF_F_GSO_SHIFT));
3314 BUILD_BUG_ON(SKB_GSO_MPLS != (NETIF_F_GSO_MPLS >> NETIF_F_GSO_SHIFT));
3201 3315
3202 return (features & feature) == feature; 3316 return (features & feature) == feature;
3203} 3317}
diff --git a/include/linux/netfilter/nfnetlink_acct.h b/include/linux/netfilter/nfnetlink_acct.h
index b2e85e59f760..6ec975748742 100644
--- a/include/linux/netfilter/nfnetlink_acct.h
+++ b/include/linux/netfilter/nfnetlink_acct.h
@@ -3,11 +3,17 @@
3 3
4#include <uapi/linux/netfilter/nfnetlink_acct.h> 4#include <uapi/linux/netfilter/nfnetlink_acct.h>
5 5
6enum {
7 NFACCT_NO_QUOTA = -1,
8 NFACCT_UNDERQUOTA,
9 NFACCT_OVERQUOTA,
10};
6 11
7struct nf_acct; 12struct nf_acct;
8 13
9struct nf_acct *nfnl_acct_find_get(const char *filter_name); 14struct nf_acct *nfnl_acct_find_get(const char *filter_name);
10void nfnl_acct_put(struct nf_acct *acct); 15void nfnl_acct_put(struct nf_acct *acct);
11void nfnl_acct_update(const struct sk_buff *skb, struct nf_acct *nfacct); 16void nfnl_acct_update(const struct sk_buff *skb, struct nf_acct *nfacct);
12 17extern int nfnl_acct_overquota(const struct sk_buff *skb,
18 struct nf_acct *nfacct);
13#endif /* _NFNL_ACCT_H */ 19#endif /* _NFNL_ACCT_H */
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index f64b01787ddc..9e572daa15d5 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -16,9 +16,10 @@ static inline struct nlmsghdr *nlmsg_hdr(const struct sk_buff *skb)
16} 16}
17 17
18enum netlink_skb_flags { 18enum netlink_skb_flags {
19 NETLINK_SKB_MMAPED = 0x1, /* Packet data is mmaped */ 19 NETLINK_SKB_MMAPED = 0x1, /* Packet data is mmaped */
20 NETLINK_SKB_TX = 0x2, /* Packet was sent by userspace */ 20 NETLINK_SKB_TX = 0x2, /* Packet was sent by userspace */
21 NETLINK_SKB_DELIVERED = 0x4, /* Packet was delivered */ 21 NETLINK_SKB_DELIVERED = 0x4, /* Packet was delivered */
22 NETLINK_SKB_DST = 0x8, /* Dst set in sendto or sendmsg */
22}; 23};
23 24
24struct netlink_skb_parms { 25struct netlink_skb_parms {
@@ -45,7 +46,8 @@ struct netlink_kernel_cfg {
45 unsigned int flags; 46 unsigned int flags;
46 void (*input)(struct sk_buff *skb); 47 void (*input)(struct sk_buff *skb);
47 struct mutex *cb_mutex; 48 struct mutex *cb_mutex;
48 void (*bind)(int group); 49 int (*bind)(int group);
50 void (*unbind)(int group);
49 bool (*compare)(struct net *net, struct sock *sk); 51 bool (*compare)(struct net *net, struct sock *sk);
50}; 52};
51 53
diff --git a/include/linux/nfs.h b/include/linux/nfs.h
index 3e794c12e90a..610af5155ef2 100644
--- a/include/linux/nfs.h
+++ b/include/linux/nfs.h
@@ -46,6 +46,9 @@ static inline void nfs_copy_fh(struct nfs_fh *target, const struct nfs_fh *sourc
46enum nfs3_stable_how { 46enum nfs3_stable_how {
47 NFS_UNSTABLE = 0, 47 NFS_UNSTABLE = 0,
48 NFS_DATA_SYNC = 1, 48 NFS_DATA_SYNC = 1,
49 NFS_FILE_SYNC = 2 49 NFS_FILE_SYNC = 2,
50
51 /* used by direct.c to mark verf as invalid */
52 NFS_INVALID_STABLE_HOW = -1
50}; 53};
51#endif /* _LINUX_NFS_H */ 54#endif /* _LINUX_NFS_H */
diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h
index 12c2cb947df5..a1e3064a8d99 100644
--- a/include/linux/nfs4.h
+++ b/include/linux/nfs4.h
@@ -399,8 +399,6 @@ enum lock_type4 {
399#define FATTR4_WORD2_LAYOUT_BLKSIZE (1UL << 1) 399#define FATTR4_WORD2_LAYOUT_BLKSIZE (1UL << 1)
400#define FATTR4_WORD2_MDSTHRESHOLD (1UL << 4) 400#define FATTR4_WORD2_MDSTHRESHOLD (1UL << 4)
401#define FATTR4_WORD2_SECURITY_LABEL (1UL << 16) 401#define FATTR4_WORD2_SECURITY_LABEL (1UL << 16)
402#define FATTR4_WORD2_CHANGE_SECURITY_LABEL \
403 (1UL << 17)
404 402
405/* MDS threshold bitmap bits */ 403/* MDS threshold bitmap bits */
406#define THRESHOLD_RD (1UL << 0) 404#define THRESHOLD_RD (1UL << 0)
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index fa6918b0f829..e30f6059ecd6 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -459,13 +459,12 @@ extern int nfs3_removexattr (struct dentry *, const char *name);
459/* 459/*
460 * linux/fs/nfs/direct.c 460 * linux/fs/nfs/direct.c
461 */ 461 */
462extern ssize_t nfs_direct_IO(int, struct kiocb *, const struct iovec *, loff_t, 462extern ssize_t nfs_direct_IO(int, struct kiocb *, struct iov_iter *, loff_t);
463 unsigned long);
464extern ssize_t nfs_file_direct_read(struct kiocb *iocb, 463extern ssize_t nfs_file_direct_read(struct kiocb *iocb,
465 const struct iovec *iov, unsigned long nr_segs, 464 struct iov_iter *iter,
466 loff_t pos, bool uio); 465 loff_t pos, bool uio);
467extern ssize_t nfs_file_direct_write(struct kiocb *iocb, 466extern ssize_t nfs_file_direct_write(struct kiocb *iocb,
468 const struct iovec *iov, unsigned long nr_segs, 467 struct iov_iter *iter,
469 loff_t pos, bool uio); 468 loff_t pos, bool uio);
470 469
471/* 470/*
@@ -520,7 +519,6 @@ extern int nfs_writepage(struct page *page, struct writeback_control *wbc);
520extern int nfs_writepages(struct address_space *, struct writeback_control *); 519extern int nfs_writepages(struct address_space *, struct writeback_control *);
521extern int nfs_flush_incompatible(struct file *file, struct page *page); 520extern int nfs_flush_incompatible(struct file *file, struct page *page);
522extern int nfs_updatepage(struct file *, struct page *, unsigned int, unsigned int); 521extern int nfs_updatepage(struct file *, struct page *, unsigned int, unsigned int);
523extern void nfs_writeback_done(struct rpc_task *, struct nfs_write_data *);
524 522
525/* 523/*
526 * Try to write back everything synchronously (but check the 524 * Try to write back everything synchronously (but check the
@@ -553,7 +551,6 @@ nfs_have_writebacks(struct inode *inode)
553extern int nfs_readpage(struct file *, struct page *); 551extern int nfs_readpage(struct file *, struct page *);
554extern int nfs_readpages(struct file *, struct address_space *, 552extern int nfs_readpages(struct file *, struct address_space *,
555 struct list_head *, unsigned); 553 struct list_head *, unsigned);
556extern int nfs_readpage_result(struct rpc_task *, struct nfs_read_data *);
557extern int nfs_readpage_async(struct nfs_open_context *, struct inode *, 554extern int nfs_readpage_async(struct nfs_open_context *, struct inode *,
558 struct page *); 555 struct page *);
559 556
diff --git a/include/linux/nfs_page.h b/include/linux/nfs_page.h
index 92ce5783b707..7d9096d95d4a 100644
--- a/include/linux/nfs_page.h
+++ b/include/linux/nfs_page.h
@@ -22,12 +22,17 @@
22 * Valid flags for a dirty buffer 22 * Valid flags for a dirty buffer
23 */ 23 */
24enum { 24enum {
25 PG_BUSY = 0, 25 PG_BUSY = 0, /* nfs_{un}lock_request */
26 PG_MAPPED, 26 PG_MAPPED, /* page private set for buffered io */
27 PG_CLEAN, 27 PG_CLEAN, /* write succeeded */
28 PG_NEED_COMMIT, 28 PG_COMMIT_TO_DS, /* used by pnfs layouts */
29 PG_NEED_RESCHED, 29 PG_INODE_REF, /* extra ref held by inode (head req only) */
30 PG_COMMIT_TO_DS, 30 PG_HEADLOCK, /* page group lock of wb_head */
31 PG_TEARDOWN, /* page group sync for destroy */
32 PG_UNLOCKPAGE, /* page group sync bit in read path */
33 PG_UPTODATE, /* page group sync bit in read path */
34 PG_WB_END, /* page group sync bit in write path */
35 PG_REMOVE, /* page group sync bit in write path */
31}; 36};
32 37
33struct nfs_inode; 38struct nfs_inode;
@@ -43,15 +48,29 @@ struct nfs_page {
43 struct kref wb_kref; /* reference count */ 48 struct kref wb_kref; /* reference count */
44 unsigned long wb_flags; 49 unsigned long wb_flags;
45 struct nfs_write_verifier wb_verf; /* Commit cookie */ 50 struct nfs_write_verifier wb_verf; /* Commit cookie */
51 struct nfs_page *wb_this_page; /* list of reqs for this page */
52 struct nfs_page *wb_head; /* head pointer for req list */
46}; 53};
47 54
48struct nfs_pageio_descriptor; 55struct nfs_pageio_descriptor;
49struct nfs_pageio_ops { 56struct nfs_pageio_ops {
50 void (*pg_init)(struct nfs_pageio_descriptor *, struct nfs_page *); 57 void (*pg_init)(struct nfs_pageio_descriptor *, struct nfs_page *);
51 bool (*pg_test)(struct nfs_pageio_descriptor *, struct nfs_page *, struct nfs_page *); 58 size_t (*pg_test)(struct nfs_pageio_descriptor *, struct nfs_page *,
59 struct nfs_page *);
52 int (*pg_doio)(struct nfs_pageio_descriptor *); 60 int (*pg_doio)(struct nfs_pageio_descriptor *);
53}; 61};
54 62
63struct nfs_rw_ops {
64 const fmode_t rw_mode;
65 struct nfs_rw_header *(*rw_alloc_header)(void);
66 void (*rw_free_header)(struct nfs_rw_header *);
67 void (*rw_release)(struct nfs_pgio_data *);
68 int (*rw_done)(struct rpc_task *, struct nfs_pgio_data *, struct inode *);
69 void (*rw_result)(struct rpc_task *, struct nfs_pgio_data *);
70 void (*rw_initiate)(struct nfs_pgio_data *, struct rpc_message *,
71 struct rpc_task_setup *, int);
72};
73
55struct nfs_pageio_descriptor { 74struct nfs_pageio_descriptor {
56 struct list_head pg_list; 75 struct list_head pg_list;
57 unsigned long pg_bytes_written; 76 unsigned long pg_bytes_written;
@@ -63,6 +82,7 @@ struct nfs_pageio_descriptor {
63 82
64 struct inode *pg_inode; 83 struct inode *pg_inode;
65 const struct nfs_pageio_ops *pg_ops; 84 const struct nfs_pageio_ops *pg_ops;
85 const struct nfs_rw_ops *pg_rw_ops;
66 int pg_ioflags; 86 int pg_ioflags;
67 int pg_error; 87 int pg_error;
68 const struct rpc_call_ops *pg_rpc_callops; 88 const struct rpc_call_ops *pg_rpc_callops;
@@ -75,29 +95,33 @@ struct nfs_pageio_descriptor {
75#define NFS_WBACK_BUSY(req) (test_bit(PG_BUSY,&(req)->wb_flags)) 95#define NFS_WBACK_BUSY(req) (test_bit(PG_BUSY,&(req)->wb_flags))
76 96
77extern struct nfs_page *nfs_create_request(struct nfs_open_context *ctx, 97extern struct nfs_page *nfs_create_request(struct nfs_open_context *ctx,
78 struct inode *inode,
79 struct page *page, 98 struct page *page,
99 struct nfs_page *last,
80 unsigned int offset, 100 unsigned int offset,
81 unsigned int count); 101 unsigned int count);
82extern void nfs_release_request(struct nfs_page *req); 102extern void nfs_release_request(struct nfs_page *);
83 103
84 104
85extern void nfs_pageio_init(struct nfs_pageio_descriptor *desc, 105extern void nfs_pageio_init(struct nfs_pageio_descriptor *desc,
86 struct inode *inode, 106 struct inode *inode,
87 const struct nfs_pageio_ops *pg_ops, 107 const struct nfs_pageio_ops *pg_ops,
88 const struct nfs_pgio_completion_ops *compl_ops, 108 const struct nfs_pgio_completion_ops *compl_ops,
109 const struct nfs_rw_ops *rw_ops,
89 size_t bsize, 110 size_t bsize,
90 int how); 111 int how);
91extern int nfs_pageio_add_request(struct nfs_pageio_descriptor *, 112extern int nfs_pageio_add_request(struct nfs_pageio_descriptor *,
92 struct nfs_page *); 113 struct nfs_page *);
93extern void nfs_pageio_complete(struct nfs_pageio_descriptor *desc); 114extern void nfs_pageio_complete(struct nfs_pageio_descriptor *desc);
94extern void nfs_pageio_cond_complete(struct nfs_pageio_descriptor *, pgoff_t); 115extern void nfs_pageio_cond_complete(struct nfs_pageio_descriptor *, pgoff_t);
95extern bool nfs_generic_pg_test(struct nfs_pageio_descriptor *desc, 116extern size_t nfs_generic_pg_test(struct nfs_pageio_descriptor *desc,
96 struct nfs_page *prev, 117 struct nfs_page *prev,
97 struct nfs_page *req); 118 struct nfs_page *req);
98extern int nfs_wait_on_request(struct nfs_page *); 119extern int nfs_wait_on_request(struct nfs_page *);
99extern void nfs_unlock_request(struct nfs_page *req); 120extern void nfs_unlock_request(struct nfs_page *req);
100extern void nfs_unlock_and_release_request(struct nfs_page *req); 121extern void nfs_unlock_and_release_request(struct nfs_page *);
122extern void nfs_page_group_lock(struct nfs_page *);
123extern void nfs_page_group_unlock(struct nfs_page *);
124extern bool nfs_page_group_sync_on_bit(struct nfs_page *, unsigned int);
101 125
102/* 126/*
103 * Lock the page of an asynchronous request 127 * Lock the page of an asynchronous request
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index 6fb5b2335b59..9a1396e70310 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -489,31 +489,21 @@ struct nfs4_delegreturnres {
489}; 489};
490 490
491/* 491/*
492 * Arguments to the read call. 492 * Arguments to the write call.
493 */ 493 */
494struct nfs_readargs { 494struct nfs_write_verifier {
495 struct nfs4_sequence_args seq_args; 495 char data[8];
496 struct nfs_fh * fh;
497 struct nfs_open_context *context;
498 struct nfs_lock_context *lock_context;
499 nfs4_stateid stateid;
500 __u64 offset;
501 __u32 count;
502 unsigned int pgbase;
503 struct page ** pages;
504}; 496};
505 497
506struct nfs_readres { 498struct nfs_writeverf {
507 struct nfs4_sequence_res seq_res; 499 struct nfs_write_verifier verifier;
508 struct nfs_fattr * fattr; 500 enum nfs3_stable_how committed;
509 __u32 count;
510 int eof;
511}; 501};
512 502
513/* 503/*
514 * Arguments to the write call. 504 * Arguments shared by the read and write call.
515 */ 505 */
516struct nfs_writeargs { 506struct nfs_pgio_args {
517 struct nfs4_sequence_args seq_args; 507 struct nfs4_sequence_args seq_args;
518 struct nfs_fh * fh; 508 struct nfs_fh * fh;
519 struct nfs_open_context *context; 509 struct nfs_open_context *context;
@@ -521,27 +511,20 @@ struct nfs_writeargs {
521 nfs4_stateid stateid; 511 nfs4_stateid stateid;
522 __u64 offset; 512 __u64 offset;
523 __u32 count; 513 __u32 count;
524 enum nfs3_stable_how stable;
525 unsigned int pgbase; 514 unsigned int pgbase;
526 struct page ** pages; 515 struct page ** pages;
527 const u32 * bitmask; 516 const u32 * bitmask; /* used by write */
528}; 517 enum nfs3_stable_how stable; /* used by write */
529
530struct nfs_write_verifier {
531 char data[8];
532}; 518};
533 519
534struct nfs_writeverf { 520struct nfs_pgio_res {
535 struct nfs_write_verifier verifier;
536 enum nfs3_stable_how committed;
537};
538
539struct nfs_writeres {
540 struct nfs4_sequence_res seq_res; 521 struct nfs4_sequence_res seq_res;
541 struct nfs_fattr * fattr; 522 struct nfs_fattr * fattr;
542 struct nfs_writeverf * verf;
543 __u32 count; 523 __u32 count;
544 const struct nfs_server *server; 524 int eof; /* used by read */
525 struct nfs_writeverf * verf; /* used by write */
526 const struct nfs_server *server; /* used by write */
527
545}; 528};
546 529
547/* 530/*
@@ -1129,6 +1112,7 @@ struct pnfs_commit_bucket {
1129 struct list_head committing; 1112 struct list_head committing;
1130 struct pnfs_layout_segment *wlseg; 1113 struct pnfs_layout_segment *wlseg;
1131 struct pnfs_layout_segment *clseg; 1114 struct pnfs_layout_segment *clseg;
1115 struct nfs_writeverf direct_verf;
1132}; 1116};
1133 1117
1134struct pnfs_ds_commit_info { 1118struct pnfs_ds_commit_info {
@@ -1264,20 +1248,6 @@ struct nfs_page_array {
1264 struct page *page_array[NFS_PAGEVEC_SIZE]; 1248 struct page *page_array[NFS_PAGEVEC_SIZE];
1265}; 1249};
1266 1250
1267struct nfs_read_data {
1268 struct nfs_pgio_header *header;
1269 struct list_head list;
1270 struct rpc_task task;
1271 struct nfs_fattr fattr; /* fattr storage */
1272 struct nfs_readargs args;
1273 struct nfs_readres res;
1274 unsigned long timestamp; /* For lease renewal */
1275 int (*read_done_cb) (struct rpc_task *task, struct nfs_read_data *data);
1276 __u64 mds_offset;
1277 struct nfs_page_array pages;
1278 struct nfs_client *ds_clp; /* pNFS data server */
1279};
1280
1281/* used as flag bits in nfs_pgio_header */ 1251/* used as flag bits in nfs_pgio_header */
1282enum { 1252enum {
1283 NFS_IOHDR_ERROR = 0, 1253 NFS_IOHDR_ERROR = 0,
@@ -1287,19 +1257,22 @@ enum {
1287 NFS_IOHDR_NEED_RESCHED, 1257 NFS_IOHDR_NEED_RESCHED,
1288}; 1258};
1289 1259
1260struct nfs_pgio_data;
1261
1290struct nfs_pgio_header { 1262struct nfs_pgio_header {
1291 struct inode *inode; 1263 struct inode *inode;
1292 struct rpc_cred *cred; 1264 struct rpc_cred *cred;
1293 struct list_head pages; 1265 struct list_head pages;
1294 struct list_head rpc_list; 1266 struct nfs_pgio_data *data;
1295 atomic_t refcnt; 1267 atomic_t refcnt;
1296 struct nfs_page *req; 1268 struct nfs_page *req;
1297 struct nfs_writeverf *verf; 1269 struct nfs_writeverf verf; /* Used for writes */
1298 struct pnfs_layout_segment *lseg; 1270 struct pnfs_layout_segment *lseg;
1299 loff_t io_start; 1271 loff_t io_start;
1300 const struct rpc_call_ops *mds_ops; 1272 const struct rpc_call_ops *mds_ops;
1301 void (*release) (struct nfs_pgio_header *hdr); 1273 void (*release) (struct nfs_pgio_header *hdr);
1302 const struct nfs_pgio_completion_ops *completion_ops; 1274 const struct nfs_pgio_completion_ops *completion_ops;
1275 const struct nfs_rw_ops *rw_ops;
1303 struct nfs_direct_req *dreq; 1276 struct nfs_direct_req *dreq;
1304 void *layout_private; 1277 void *layout_private;
1305 spinlock_t lock; 1278 spinlock_t lock;
@@ -1310,30 +1283,24 @@ struct nfs_pgio_header {
1310 unsigned long flags; 1283 unsigned long flags;
1311}; 1284};
1312 1285
1313struct nfs_read_header { 1286struct nfs_pgio_data {
1314 struct nfs_pgio_header header;
1315 struct nfs_read_data rpc_data;
1316};
1317
1318struct nfs_write_data {
1319 struct nfs_pgio_header *header; 1287 struct nfs_pgio_header *header;
1320 struct list_head list;
1321 struct rpc_task task; 1288 struct rpc_task task;
1322 struct nfs_fattr fattr; 1289 struct nfs_fattr fattr;
1323 struct nfs_writeverf verf; 1290 struct nfs_writeverf verf; /* Used for writes */
1324 struct nfs_writeargs args; /* argument struct */ 1291 struct nfs_pgio_args args; /* argument struct */
1325 struct nfs_writeres res; /* result struct */ 1292 struct nfs_pgio_res res; /* result struct */
1326 unsigned long timestamp; /* For lease renewal */ 1293 unsigned long timestamp; /* For lease renewal */
1327 int (*write_done_cb) (struct rpc_task *task, struct nfs_write_data *data); 1294 int (*pgio_done_cb) (struct rpc_task *task, struct nfs_pgio_data *data);
1328 __u64 mds_offset; /* Filelayout dense stripe */ 1295 __u64 mds_offset; /* Filelayout dense stripe */
1329 struct nfs_page_array pages; 1296 struct nfs_page_array pages;
1330 struct nfs_client *ds_clp; /* pNFS data server */ 1297 struct nfs_client *ds_clp; /* pNFS data server */
1298 int ds_idx; /* ds index if ds_clp is set */
1331}; 1299};
1332 1300
1333struct nfs_write_header { 1301struct nfs_rw_header {
1334 struct nfs_pgio_header header; 1302 struct nfs_pgio_header header;
1335 struct nfs_write_data rpc_data; 1303 struct nfs_pgio_data rpc_data;
1336 struct nfs_writeverf verf;
1337}; 1304};
1338 1305
1339struct nfs_mds_commit_info { 1306struct nfs_mds_commit_info {
@@ -1465,16 +1432,11 @@ struct nfs_rpc_ops {
1465 struct nfs_pathconf *); 1432 struct nfs_pathconf *);
1466 int (*set_capabilities)(struct nfs_server *, struct nfs_fh *); 1433 int (*set_capabilities)(struct nfs_server *, struct nfs_fh *);
1467 int (*decode_dirent)(struct xdr_stream *, struct nfs_entry *, int); 1434 int (*decode_dirent)(struct xdr_stream *, struct nfs_entry *, int);
1468 void (*read_setup) (struct nfs_read_data *, struct rpc_message *); 1435 int (*pgio_rpc_prepare)(struct rpc_task *, struct nfs_pgio_data *);
1469 void (*read_pageio_init)(struct nfs_pageio_descriptor *, struct inode *, 1436 void (*read_setup) (struct nfs_pgio_data *, struct rpc_message *);
1470 const struct nfs_pgio_completion_ops *); 1437 int (*read_done) (struct rpc_task *, struct nfs_pgio_data *);
1471 int (*read_rpc_prepare)(struct rpc_task *, struct nfs_read_data *); 1438 void (*write_setup) (struct nfs_pgio_data *, struct rpc_message *);
1472 int (*read_done) (struct rpc_task *, struct nfs_read_data *); 1439 int (*write_done) (struct rpc_task *, struct nfs_pgio_data *);
1473 void (*write_setup) (struct nfs_write_data *, struct rpc_message *);
1474 void (*write_pageio_init)(struct nfs_pageio_descriptor *, struct inode *, int,
1475 const struct nfs_pgio_completion_ops *);
1476 int (*write_rpc_prepare)(struct rpc_task *, struct nfs_write_data *);
1477 int (*write_done) (struct rpc_task *, struct nfs_write_data *);
1478 void (*commit_setup) (struct nfs_commit_data *, struct rpc_message *); 1440 void (*commit_setup) (struct nfs_commit_data *, struct rpc_message *);
1479 void (*commit_rpc_prepare)(struct rpc_task *, struct nfs_commit_data *); 1441 void (*commit_rpc_prepare)(struct rpc_task *, struct nfs_commit_data *);
1480 int (*commit_done) (struct rpc_task *, struct nfs_commit_data *); 1442 int (*commit_done) (struct rpc_task *, struct nfs_commit_data *);
diff --git a/include/linux/nfsd/debug.h b/include/linux/nfsd/debug.h
deleted file mode 100644
index 19ef8375b577..000000000000
--- a/include/linux/nfsd/debug.h
+++ /dev/null
@@ -1,19 +0,0 @@
1/*
2 * linux/include/linux/nfsd/debug.h
3 *
4 * Debugging-related stuff for nfsd
5 *
6 * Copyright (C) 1995 Olaf Kirch <okir@monad.swb.de>
7 */
8#ifndef LINUX_NFSD_DEBUG_H
9#define LINUX_NFSD_DEBUG_H
10
11#include <uapi/linux/nfsd/debug.h>
12
13# undef ifdebug
14# ifdef NFSD_DEBUG
15# define ifdebug(flag) if (nfsd_debug & NFSDDBG_##flag)
16# else
17# define ifdebug(flag) if (0)
18# endif
19#endif /* LINUX_NFSD_DEBUG_H */
diff --git a/include/linux/nfsd/export.h b/include/linux/nfsd/export.h
deleted file mode 100644
index 7898c997dfea..000000000000
--- a/include/linux/nfsd/export.h
+++ /dev/null
@@ -1,110 +0,0 @@
1/*
2 * include/linux/nfsd/export.h
3 *
4 * Public declarations for NFS exports. The definitions for the
5 * syscall interface are in nfsctl.h
6 *
7 * Copyright (C) 1995-1997 Olaf Kirch <okir@monad.swb.de>
8 */
9#ifndef NFSD_EXPORT_H
10#define NFSD_EXPORT_H
11
12# include <linux/nfsd/nfsfh.h>
13#include <uapi/linux/nfsd/export.h>
14
15/*
16 * FS Locations
17 */
18
19#define MAX_FS_LOCATIONS 128
20
21struct nfsd4_fs_location {
22 char *hosts; /* colon separated list of hosts */
23 char *path; /* slash separated list of path components */
24};
25
26struct nfsd4_fs_locations {
27 uint32_t locations_count;
28 struct nfsd4_fs_location *locations;
29/* If we're not actually serving this data ourselves (only providing a
30 * list of replicas that do serve it) then we set "migrated": */
31 int migrated;
32};
33
34/*
35 * We keep an array of pseudoflavors with the export, in order from most
36 * to least preferred. For the foreseeable future, we don't expect more
37 * than the eight pseudoflavors null, unix, krb5, krb5i, krb5p, skpm3,
38 * spkm3i, and spkm3p (and using all 8 at once should be rare).
39 */
40#define MAX_SECINFO_LIST 8
41
42struct exp_flavor_info {
43 u32 pseudoflavor;
44 u32 flags;
45};
46
47struct svc_export {
48 struct cache_head h;
49 struct auth_domain * ex_client;
50 int ex_flags;
51 struct path ex_path;
52 kuid_t ex_anon_uid;
53 kgid_t ex_anon_gid;
54 int ex_fsid;
55 unsigned char * ex_uuid; /* 16 byte fsid */
56 struct nfsd4_fs_locations ex_fslocs;
57 int ex_nflavors;
58 struct exp_flavor_info ex_flavors[MAX_SECINFO_LIST];
59 struct cache_detail *cd;
60};
61
62/* an "export key" (expkey) maps a filehandlefragement to an
63 * svc_export for a given client. There can be several per export,
64 * for the different fsid types.
65 */
66struct svc_expkey {
67 struct cache_head h;
68
69 struct auth_domain * ek_client;
70 int ek_fsidtype;
71 u32 ek_fsid[6];
72
73 struct path ek_path;
74};
75
76#define EX_ISSYNC(exp) (!((exp)->ex_flags & NFSEXP_ASYNC))
77#define EX_NOHIDE(exp) ((exp)->ex_flags & NFSEXP_NOHIDE)
78#define EX_WGATHER(exp) ((exp)->ex_flags & NFSEXP_GATHERED_WRITES)
79
80int nfsexp_flags(struct svc_rqst *rqstp, struct svc_export *exp);
81__be32 check_nfsd_access(struct svc_export *exp, struct svc_rqst *rqstp);
82
83/*
84 * Function declarations
85 */
86int nfsd_export_init(struct net *);
87void nfsd_export_shutdown(struct net *);
88void nfsd_export_flush(struct net *);
89struct svc_export * rqst_exp_get_by_name(struct svc_rqst *,
90 struct path *);
91struct svc_export * rqst_exp_parent(struct svc_rqst *,
92 struct path *);
93struct svc_export * rqst_find_fsidzero_export(struct svc_rqst *);
94int exp_rootfh(struct net *, struct auth_domain *,
95 char *path, struct knfsd_fh *, int maxsize);
96__be32 exp_pseudoroot(struct svc_rqst *, struct svc_fh *);
97__be32 nfserrno(int errno);
98
99static inline void exp_put(struct svc_export *exp)
100{
101 cache_put(&exp->h, exp->cd);
102}
103
104static inline void exp_get(struct svc_export *exp)
105{
106 cache_get(&exp->h);
107}
108struct svc_export * rqst_exp_find(struct svc_rqst *, int, u32 *);
109
110#endif /* NFSD_EXPORT_H */
diff --git a/include/linux/nfsd/nfsfh.h b/include/linux/nfsd/nfsfh.h
deleted file mode 100644
index a93593f1fa4e..000000000000
--- a/include/linux/nfsd/nfsfh.h
+++ /dev/null
@@ -1,63 +0,0 @@
1/*
2 * include/linux/nfsd/nfsfh.h
3 *
4 * This file describes the layout of the file handles as passed
5 * over the wire.
6 *
7 * Earlier versions of knfsd used to sign file handles using keyed MD5
8 * or SHA. I've removed this code, because it doesn't give you more
9 * security than blocking external access to port 2049 on your firewall.
10 *
11 * Copyright (C) 1995, 1996, 1997 Olaf Kirch <okir@monad.swb.de>
12 */
13#ifndef _LINUX_NFSD_FH_H
14#define _LINUX_NFSD_FH_H
15
16# include <linux/sunrpc/svc.h>
17#include <uapi/linux/nfsd/nfsfh.h>
18
19static inline __u32 ino_t_to_u32(ino_t ino)
20{
21 return (__u32) ino;
22}
23
24static inline ino_t u32_to_ino_t(__u32 uino)
25{
26 return (ino_t) uino;
27}
28
29/*
30 * This is the internal representation of an NFS handle used in knfsd.
31 * pre_mtime/post_version will be used to support wcc_attr's in NFSv3.
32 */
33typedef struct svc_fh {
34 struct knfsd_fh fh_handle; /* FH data */
35 struct dentry * fh_dentry; /* validated dentry */
36 struct svc_export * fh_export; /* export pointer */
37 int fh_maxsize; /* max size for fh_handle */
38
39 unsigned char fh_locked; /* inode locked by us */
40 unsigned char fh_want_write; /* remount protection taken */
41
42#ifdef CONFIG_NFSD_V3
43 unsigned char fh_post_saved; /* post-op attrs saved */
44 unsigned char fh_pre_saved; /* pre-op attrs saved */
45
46 /* Pre-op attributes saved during fh_lock */
47 __u64 fh_pre_size; /* size before operation */
48 struct timespec fh_pre_mtime; /* mtime before oper */
49 struct timespec fh_pre_ctime; /* ctime before oper */
50 /*
51 * pre-op nfsv4 change attr: note must check IS_I_VERSION(inode)
52 * to find out if it is valid.
53 */
54 u64 fh_pre_change;
55
56 /* Post-op attributes saved in fh_unlock */
57 struct kstat fh_post_attr; /* full attrs after operation */
58 u64 fh_post_change; /* nfsv4 change; see above */
59#endif /* CONFIG_NFSD_V3 */
60
61} svc_fh;
62
63#endif /* _LINUX_NFSD_FH_H */
diff --git a/include/linux/nfsd/stats.h b/include/linux/nfsd/stats.h
deleted file mode 100644
index e75b2544ff12..000000000000
--- a/include/linux/nfsd/stats.h
+++ /dev/null
@@ -1,45 +0,0 @@
1/*
2 * linux/include/linux/nfsd/stats.h
3 *
4 * Statistics for NFS server.
5 *
6 * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de>
7 */
8#ifndef LINUX_NFSD_STATS_H
9#define LINUX_NFSD_STATS_H
10
11#include <uapi/linux/nfsd/stats.h>
12
13
14struct nfsd_stats {
15 unsigned int rchits; /* repcache hits */
16 unsigned int rcmisses; /* repcache hits */
17 unsigned int rcnocache; /* uncached reqs */
18 unsigned int fh_stale; /* FH stale error */
19 unsigned int fh_lookup; /* dentry cached */
20 unsigned int fh_anon; /* anon file dentry returned */
21 unsigned int fh_nocache_dir; /* filehandle not found in dcache */
22 unsigned int fh_nocache_nondir; /* filehandle not found in dcache */
23 unsigned int io_read; /* bytes returned to read requests */
24 unsigned int io_write; /* bytes passed in write requests */
25 unsigned int th_cnt; /* number of available threads */
26 unsigned int th_usage[10]; /* number of ticks during which n perdeciles
27 * of available threads were in use */
28 unsigned int th_fullcnt; /* number of times last free thread was used */
29 unsigned int ra_size; /* size of ra cache */
30 unsigned int ra_depth[11]; /* number of times ra entry was found that deep
31 * in the cache (10percentiles). [10] = not found */
32#ifdef CONFIG_NFSD_V4
33 unsigned int nfs4_opcount[LAST_NFS4_OP + 1]; /* count of individual nfsv4 operations */
34#endif
35
36};
37
38
39extern struct nfsd_stats nfsdstats;
40extern struct svc_stat nfsd_svcstats;
41
42void nfsd_stat_init(void);
43void nfsd_stat_shutdown(void);
44
45#endif /* LINUX_NFSD_STATS_H */
diff --git a/include/linux/nl802154.h b/include/linux/nl802154.h
index c8d7f3965fff..20163b9a0eae 100644
--- a/include/linux/nl802154.h
+++ b/include/linux/nl802154.h
@@ -80,6 +80,22 @@ enum {
80 80
81 IEEE802154_ATTR_FRAME_RETRIES, 81 IEEE802154_ATTR_FRAME_RETRIES,
82 82
83 IEEE802154_ATTR_LLSEC_ENABLED,
84 IEEE802154_ATTR_LLSEC_SECLEVEL,
85 IEEE802154_ATTR_LLSEC_KEY_MODE,
86 IEEE802154_ATTR_LLSEC_KEY_SOURCE_SHORT,
87 IEEE802154_ATTR_LLSEC_KEY_SOURCE_EXTENDED,
88 IEEE802154_ATTR_LLSEC_KEY_ID,
89 IEEE802154_ATTR_LLSEC_FRAME_COUNTER,
90 IEEE802154_ATTR_LLSEC_KEY_BYTES,
91 IEEE802154_ATTR_LLSEC_KEY_USAGE_FRAME_TYPES,
92 IEEE802154_ATTR_LLSEC_KEY_USAGE_COMMANDS,
93 IEEE802154_ATTR_LLSEC_FRAME_TYPE,
94 IEEE802154_ATTR_LLSEC_CMD_FRAME_ID,
95 IEEE802154_ATTR_LLSEC_SECLEVELS,
96 IEEE802154_ATTR_LLSEC_DEV_OVERRIDE,
97 IEEE802154_ATTR_LLSEC_DEV_KEY_MODE,
98
83 __IEEE802154_ATTR_MAX, 99 __IEEE802154_ATTR_MAX,
84}; 100};
85 101
@@ -134,6 +150,21 @@ enum {
134 150
135 IEEE802154_SET_MACPARAMS, 151 IEEE802154_SET_MACPARAMS,
136 152
153 IEEE802154_LLSEC_GETPARAMS,
154 IEEE802154_LLSEC_SETPARAMS,
155 IEEE802154_LLSEC_LIST_KEY,
156 IEEE802154_LLSEC_ADD_KEY,
157 IEEE802154_LLSEC_DEL_KEY,
158 IEEE802154_LLSEC_LIST_DEV,
159 IEEE802154_LLSEC_ADD_DEV,
160 IEEE802154_LLSEC_DEL_DEV,
161 IEEE802154_LLSEC_LIST_DEVKEY,
162 IEEE802154_LLSEC_ADD_DEVKEY,
163 IEEE802154_LLSEC_DEL_DEVKEY,
164 IEEE802154_LLSEC_LIST_SECLEVEL,
165 IEEE802154_LLSEC_ADD_SECLEVEL,
166 IEEE802154_LLSEC_DEL_SECLEVEL,
167
137 __IEEE802154_CMD_MAX, 168 __IEEE802154_CMD_MAX,
138}; 169};
139 170
diff --git a/include/linux/nmi.h b/include/linux/nmi.h
index 6a45fb583ff1..447775ee2c4b 100644
--- a/include/linux/nmi.h
+++ b/include/linux/nmi.h
@@ -32,15 +32,24 @@ static inline void touch_nmi_watchdog(void)
32#ifdef arch_trigger_all_cpu_backtrace 32#ifdef arch_trigger_all_cpu_backtrace
33static inline bool trigger_all_cpu_backtrace(void) 33static inline bool trigger_all_cpu_backtrace(void)
34{ 34{
35 arch_trigger_all_cpu_backtrace(); 35 arch_trigger_all_cpu_backtrace(true);
36 36
37 return true; 37 return true;
38} 38}
39static inline bool trigger_allbutself_cpu_backtrace(void)
40{
41 arch_trigger_all_cpu_backtrace(false);
42 return true;
43}
39#else 44#else
40static inline bool trigger_all_cpu_backtrace(void) 45static inline bool trigger_all_cpu_backtrace(void)
41{ 46{
42 return false; 47 return false;
43} 48}
49static inline bool trigger_allbutself_cpu_backtrace(void)
50{
51 return false;
52}
44#endif 53#endif
45 54
46#ifdef CONFIG_LOCKUP_DETECTOR 55#ifdef CONFIG_LOCKUP_DETECTOR
@@ -48,6 +57,7 @@ int hw_nmi_is_cpu_stuck(struct pt_regs *);
48u64 hw_nmi_get_sample_period(int watchdog_thresh); 57u64 hw_nmi_get_sample_period(int watchdog_thresh);
49extern int watchdog_user_enabled; 58extern int watchdog_user_enabled;
50extern int watchdog_thresh; 59extern int watchdog_thresh;
60extern int sysctl_softlockup_all_cpu_backtrace;
51struct ctl_table; 61struct ctl_table;
52extern int proc_dowatchdog(struct ctl_table *, int , 62extern int proc_dowatchdog(struct ctl_table *, int ,
53 void __user *, size_t *, loff_t *); 63 void __user *, size_t *, loff_t *);
diff --git a/include/linux/nvme.h b/include/linux/nvme.h
index a50173ca1d72..2bf403195c09 100644
--- a/include/linux/nvme.h
+++ b/include/linux/nvme.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * Definitions for the NVM Express interface 2 * Definitions for the NVM Express interface
3 * Copyright (c) 2011-2013, Intel Corporation. 3 * Copyright (c) 2011-2014, Intel Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 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, 6 * under the terms and conditions of the GNU General Public License,
@@ -10,10 +10,6 @@
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details. 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 */ 13 */
18 14
19#ifndef _LINUX_NVME_H 15#ifndef _LINUX_NVME_H
@@ -66,8 +62,8 @@ enum {
66 62
67#define NVME_VS(major, minor) (major << 16 | minor) 63#define NVME_VS(major, minor) (major << 16 | minor)
68 64
69extern unsigned char io_timeout; 65extern unsigned char nvme_io_timeout;
70#define NVME_IO_TIMEOUT (io_timeout * HZ) 66#define NVME_IO_TIMEOUT (nvme_io_timeout * HZ)
71 67
72/* 68/*
73 * Represents an NVM Express device. Each nvme_dev is a PCI function. 69 * Represents an NVM Express device. Each nvme_dev is a PCI function.
@@ -94,7 +90,7 @@ struct nvme_dev {
94 struct miscdevice miscdev; 90 struct miscdevice miscdev;
95 work_func_t reset_workfn; 91 work_func_t reset_workfn;
96 struct work_struct reset_work; 92 struct work_struct reset_work;
97 struct notifier_block nb; 93 struct work_struct cpu_work;
98 char name[12]; 94 char name[12];
99 char serial[20]; 95 char serial[20];
100 char model[40]; 96 char model[40];
@@ -103,6 +99,7 @@ struct nvme_dev {
103 u32 stripe_size; 99 u32 stripe_size;
104 u16 oncs; 100 u16 oncs;
105 u16 abort_limit; 101 u16 abort_limit;
102 u8 vwc;
106 u8 initialized; 103 u8 initialized;
107}; 104};
108 105
@@ -159,7 +156,6 @@ struct nvme_iod *nvme_map_user_pages(struct nvme_dev *dev, int write,
159void nvme_unmap_user_pages(struct nvme_dev *dev, int write, 156void nvme_unmap_user_pages(struct nvme_dev *dev, int write,
160 struct nvme_iod *iod); 157 struct nvme_iod *iod);
161int nvme_submit_io_cmd(struct nvme_dev *, struct nvme_command *, u32 *); 158int nvme_submit_io_cmd(struct nvme_dev *, struct nvme_command *, u32 *);
162int nvme_submit_flush_data(struct nvme_queue *nvmeq, struct nvme_ns *ns);
163int nvme_submit_admin_cmd(struct nvme_dev *, struct nvme_command *, 159int nvme_submit_admin_cmd(struct nvme_dev *, struct nvme_command *,
164 u32 *result); 160 u32 *result);
165int nvme_identify(struct nvme_dev *, unsigned nsid, unsigned cns, 161int nvme_identify(struct nvme_dev *, unsigned nsid, unsigned cns,
diff --git a/include/linux/of.h b/include/linux/of.h
index e6f0988c1c68..196b34c1ef4e 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -130,6 +130,12 @@ static inline int of_node_check_flag(struct device_node *n, unsigned long flag)
130 return test_bit(flag, &n->_flags); 130 return test_bit(flag, &n->_flags);
131} 131}
132 132
133static inline int of_node_test_and_set_flag(struct device_node *n,
134 unsigned long flag)
135{
136 return test_and_set_bit(flag, &n->_flags);
137}
138
133static inline void of_node_set_flag(struct device_node *n, unsigned long flag) 139static inline void of_node_set_flag(struct device_node *n, unsigned long flag)
134{ 140{
135 set_bit(flag, &n->_flags); 141 set_bit(flag, &n->_flags);
@@ -197,6 +203,7 @@ static inline unsigned long of_read_ulong(const __be32 *cell, int size)
197/* flag descriptions */ 203/* flag descriptions */
198#define OF_DYNAMIC 1 /* node and properties were allocated via kmalloc */ 204#define OF_DYNAMIC 1 /* node and properties were allocated via kmalloc */
199#define OF_DETACHED 2 /* node has been detached from the device tree */ 205#define OF_DETACHED 2 /* node has been detached from the device tree */
206#define OF_POPULATED 3 /* device already created for the node */
200 207
201#define OF_IS_DYNAMIC(x) test_bit(OF_DYNAMIC, &x->_flags) 208#define OF_IS_DYNAMIC(x) test_bit(OF_DYNAMIC, &x->_flags)
202#define OF_MARK_DYNAMIC(x) set_bit(OF_DYNAMIC, &x->_flags) 209#define OF_MARK_DYNAMIC(x) set_bit(OF_DYNAMIC, &x->_flags)
@@ -757,4 +764,26 @@ static inline int of_get_available_child_count(const struct device_node *np)
757 return num; 764 return num;
758} 765}
759 766
767#ifdef CONFIG_OF
768#define _OF_DECLARE(table, name, compat, fn, fn_type) \
769 static const struct of_device_id __of_table_##name \
770 __used __section(__##table##_of_table) \
771 = { .compatible = compat, \
772 .data = (fn == (fn_type)NULL) ? fn : fn }
773#else
774#define _OF_DECLARE(table, name, compat, fn, fn_type) \
775 static const struct of_device_id __of_table_##name \
776 __attribute__((unused)) \
777 = { .compatible = compat, \
778 .data = (fn == (fn_type)NULL) ? fn : fn }
779#endif
780
781typedef int (*of_init_fn_2)(struct device_node *, struct device_node *);
782typedef void (*of_init_fn_1)(struct device_node *);
783
784#define OF_DECLARE_1(table, name, compat, fn) \
785 _OF_DECLARE(table, name, compat, fn, of_init_fn_1)
786#define OF_DECLARE_2(table, name, compat, fn) \
787 _OF_DECLARE(table, name, compat, fn, of_init_fn_2)
788
760#endif /* _LINUX_OF_H */ 789#endif /* _LINUX_OF_H */
diff --git a/include/linux/of_address.h b/include/linux/of_address.h
index 5f6ed6b182b8..c13b8782a4eb 100644
--- a/include/linux/of_address.h
+++ b/include/linux/of_address.h
@@ -40,7 +40,6 @@ extern u64 of_translate_dma_address(struct device_node *dev,
40 40
41#ifdef CONFIG_OF_ADDRESS 41#ifdef CONFIG_OF_ADDRESS
42extern u64 of_translate_address(struct device_node *np, const __be32 *addr); 42extern u64 of_translate_address(struct device_node *np, const __be32 *addr);
43extern bool of_can_translate_address(struct device_node *dev);
44extern int of_address_to_resource(struct device_node *dev, int index, 43extern int of_address_to_resource(struct device_node *dev, int index,
45 struct resource *r); 44 struct resource *r);
46extern struct device_node *of_find_matching_node_by_address( 45extern struct device_node *of_find_matching_node_by_address(
@@ -63,6 +62,9 @@ extern int of_pci_range_parser_init(struct of_pci_range_parser *parser,
63extern struct of_pci_range *of_pci_range_parser_one( 62extern struct of_pci_range *of_pci_range_parser_one(
64 struct of_pci_range_parser *parser, 63 struct of_pci_range_parser *parser,
65 struct of_pci_range *range); 64 struct of_pci_range *range);
65extern int of_dma_get_range(struct device_node *np, u64 *dma_addr,
66 u64 *paddr, u64 *size);
67extern bool of_dma_is_coherent(struct device_node *np);
66#else /* CONFIG_OF_ADDRESS */ 68#else /* CONFIG_OF_ADDRESS */
67static inline struct device_node *of_find_matching_node_by_address( 69static inline struct device_node *of_find_matching_node_by_address(
68 struct device_node *from, 70 struct device_node *from,
@@ -90,6 +92,17 @@ static inline struct of_pci_range *of_pci_range_parser_one(
90{ 92{
91 return NULL; 93 return NULL;
92} 94}
95
96static inline int of_dma_get_range(struct device_node *np, u64 *dma_addr,
97 u64 *paddr, u64 *size)
98{
99 return -ENODEV;
100}
101
102static inline bool of_dma_is_coherent(struct device_node *np)
103{
104 return false;
105}
93#endif /* CONFIG_OF_ADDRESS */ 106#endif /* CONFIG_OF_ADDRESS */
94 107
95#ifdef CONFIG_OF 108#ifdef CONFIG_OF
diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
index ddd7219af8ac..05117899fcb4 100644
--- a/include/linux/of_fdt.h
+++ b/include/linux/of_fdt.h
@@ -17,60 +17,23 @@
17 17
18/* Definitions used by the flattened device tree */ 18/* Definitions used by the flattened device tree */
19#define OF_DT_HEADER 0xd00dfeed /* marker */ 19#define OF_DT_HEADER 0xd00dfeed /* marker */
20#define OF_DT_BEGIN_NODE 0x1 /* Start of node, full name */
21#define OF_DT_END_NODE 0x2 /* End node */
22#define OF_DT_PROP 0x3 /* Property: name off, size,
23 * content */
24#define OF_DT_NOP 0x4 /* nop */
25#define OF_DT_END 0x9
26
27#define OF_DT_VERSION 0x10
28 20
29#ifndef __ASSEMBLY__ 21#ifndef __ASSEMBLY__
30/*
31 * This is what gets passed to the kernel by prom_init or kexec
32 *
33 * The dt struct contains the device tree structure, full pathes and
34 * property contents. The dt strings contain a separate block with just
35 * the strings for the property names, and is fully page aligned and
36 * self contained in a page, so that it can be kept around by the kernel,
37 * each property name appears only once in this page (cheap compression)
38 *
39 * the mem_rsvmap contains a map of reserved ranges of physical memory,
40 * passing it here instead of in the device-tree itself greatly simplifies
41 * the job of everybody. It's just a list of u64 pairs (base/size) that
42 * ends when size is 0
43 */
44struct boot_param_header {
45 __be32 magic; /* magic word OF_DT_HEADER */
46 __be32 totalsize; /* total size of DT block */
47 __be32 off_dt_struct; /* offset to structure */
48 __be32 off_dt_strings; /* offset to strings */
49 __be32 off_mem_rsvmap; /* offset to memory reserve map */
50 __be32 version; /* format version */
51 __be32 last_comp_version; /* last compatible version */
52 /* version 2 fields below */
53 __be32 boot_cpuid_phys; /* Physical CPU id we're booting on */
54 /* version 3 fields below */
55 __be32 dt_strings_size; /* size of the DT strings block */
56 /* version 17 fields below */
57 __be32 dt_struct_size; /* size of the DT structure block */
58};
59 22
60#if defined(CONFIG_OF_FLATTREE) 23#if defined(CONFIG_OF_FLATTREE)
61 24
62struct device_node; 25struct device_node;
63 26
64/* For scanning an arbitrary device-tree at any time */ 27/* For scanning an arbitrary device-tree at any time */
65extern char *of_fdt_get_string(struct boot_param_header *blob, u32 offset); 28extern char *of_fdt_get_string(const void *blob, u32 offset);
66extern void *of_fdt_get_property(struct boot_param_header *blob, 29extern void *of_fdt_get_property(const void *blob,
67 unsigned long node, 30 unsigned long node,
68 const char *name, 31 const char *name,
69 unsigned long *size); 32 int *size);
70extern int of_fdt_is_compatible(struct boot_param_header *blob, 33extern int of_fdt_is_compatible(const void *blob,
71 unsigned long node, 34 unsigned long node,
72 const char *compat); 35 const char *compat);
73extern int of_fdt_match(struct boot_param_header *blob, unsigned long node, 36extern int of_fdt_match(const void *blob, unsigned long node,
74 const char *const *compat); 37 const char *const *compat);
75extern void of_fdt_unflatten_tree(unsigned long *blob, 38extern void of_fdt_unflatten_tree(unsigned long *blob,
76 struct device_node **mynodes); 39 struct device_node **mynodes);
@@ -78,21 +41,21 @@ extern void of_fdt_unflatten_tree(unsigned long *blob,
78/* TBD: Temporary export of fdt globals - remove when code fully merged */ 41/* TBD: Temporary export of fdt globals - remove when code fully merged */
79extern int __initdata dt_root_addr_cells; 42extern int __initdata dt_root_addr_cells;
80extern int __initdata dt_root_size_cells; 43extern int __initdata dt_root_size_cells;
81extern struct boot_param_header *initial_boot_params; 44extern void *initial_boot_params;
45
46extern char __dtb_start[];
47extern char __dtb_end[];
82 48
83/* For scanning the flat device-tree at boot time */ 49/* For scanning the flat device-tree at boot time */
84extern char *find_flat_dt_string(u32 offset);
85extern int of_scan_flat_dt(int (*it)(unsigned long node, const char *uname, 50extern int of_scan_flat_dt(int (*it)(unsigned long node, const char *uname,
86 int depth, void *data), 51 int depth, void *data),
87 void *data); 52 void *data);
88extern void *of_get_flat_dt_prop(unsigned long node, const char *name, 53extern const void *of_get_flat_dt_prop(unsigned long node, const char *name,
89 unsigned long *size); 54 int *size);
90extern int of_flat_dt_is_compatible(unsigned long node, const char *name); 55extern int of_flat_dt_is_compatible(unsigned long node, const char *name);
91extern int of_flat_dt_match(unsigned long node, const char *const *matches); 56extern int of_flat_dt_match(unsigned long node, const char *const *matches);
92extern unsigned long of_get_flat_dt_root(void); 57extern unsigned long of_get_flat_dt_root(void);
93extern int of_scan_flat_dt_by_path(const char *path, 58extern int of_get_flat_dt_size(void);
94 int (*it)(unsigned long node, const char *name, int depth, void *data),
95 void *data);
96 59
97extern int early_init_dt_scan_chosen(unsigned long node, const char *uname, 60extern int early_init_dt_scan_chosen(unsigned long node, const char *uname,
98 int depth, void *data); 61 int depth, void *data);
@@ -103,7 +66,7 @@ extern void early_init_dt_add_memory_arch(u64 base, u64 size);
103extern int early_init_dt_reserve_memory_arch(phys_addr_t base, phys_addr_t size, 66extern int early_init_dt_reserve_memory_arch(phys_addr_t base, phys_addr_t size,
104 bool no_map); 67 bool no_map);
105extern void * early_init_dt_alloc_memory_arch(u64 size, u64 align); 68extern void * early_init_dt_alloc_memory_arch(u64 size, u64 align);
106extern u64 dt_mem_next_cell(int s, __be32 **cellp); 69extern u64 dt_mem_next_cell(int s, const __be32 **cellp);
107 70
108/* Early flat tree scan hooks */ 71/* Early flat tree scan hooks */
109extern int early_init_dt_scan_root(unsigned long node, const char *uname, 72extern int early_init_dt_scan_root(unsigned long node, const char *uname,
@@ -120,6 +83,7 @@ extern void unflatten_device_tree(void);
120extern void unflatten_and_copy_device_tree(void); 83extern void unflatten_and_copy_device_tree(void);
121extern void early_init_devtree(void *); 84extern void early_init_devtree(void *);
122extern void early_get_first_memblock_info(void *, phys_addr_t *); 85extern void early_get_first_memblock_info(void *, phys_addr_t *);
86extern u64 fdt_translate_address(const void *blob, int node_offset);
123#else /* CONFIG_OF_FLATTREE */ 87#else /* CONFIG_OF_FLATTREE */
124static inline void early_init_fdt_scan_reserved_mem(void) {} 88static inline void early_init_fdt_scan_reserved_mem(void) {}
125static inline const char *of_flat_dt_get_machine_name(void) { return NULL; } 89static inline const char *of_flat_dt_get_machine_name(void) { return NULL; }
diff --git a/include/linux/of_gpio.h b/include/linux/of_gpio.h
index f14123a5a9df..38fc05036015 100644
--- a/include/linux/of_gpio.h
+++ b/include/linux/of_gpio.h
@@ -19,7 +19,6 @@
19#include <linux/errno.h> 19#include <linux/errno.h>
20#include <linux/gpio.h> 20#include <linux/gpio.h>
21#include <linux/of.h> 21#include <linux/of.h>
22#include <linux/gpio/consumer.h>
23 22
24struct device_node; 23struct device_node;
25 24
@@ -48,7 +47,7 @@ static inline struct of_mm_gpio_chip *to_of_mm_gpio_chip(struct gpio_chip *gc)
48 return container_of(gc, struct of_mm_gpio_chip, gc); 47 return container_of(gc, struct of_mm_gpio_chip, gc);
49} 48}
50 49
51extern struct gpio_desc *of_get_named_gpiod_flags(struct device_node *np, 50extern int of_get_named_gpio_flags(struct device_node *np,
52 const char *list_name, int index, enum of_gpio_flags *flags); 51 const char *list_name, int index, enum of_gpio_flags *flags);
53 52
54extern int of_mm_gpiochip_add(struct device_node *np, 53extern int of_mm_gpiochip_add(struct device_node *np,
@@ -63,10 +62,10 @@ extern int of_gpio_simple_xlate(struct gpio_chip *gc,
63#else /* CONFIG_OF_GPIO */ 62#else /* CONFIG_OF_GPIO */
64 63
65/* Drivers may not strictly depend on the GPIO support, so let them link. */ 64/* Drivers may not strictly depend on the GPIO support, so let them link. */
66static inline struct gpio_desc *of_get_named_gpiod_flags(struct device_node *np, 65static inline int of_get_named_gpio_flags(struct device_node *np,
67 const char *list_name, int index, enum of_gpio_flags *flags) 66 const char *list_name, int index, enum of_gpio_flags *flags)
68{ 67{
69 return ERR_PTR(-ENOSYS); 68 return -ENOSYS;
70} 69}
71 70
72static inline int of_gpio_simple_xlate(struct gpio_chip *gc, 71static inline int of_gpio_simple_xlate(struct gpio_chip *gc,
@@ -81,18 +80,6 @@ static inline void of_gpiochip_remove(struct gpio_chip *gc) { }
81 80
82#endif /* CONFIG_OF_GPIO */ 81#endif /* CONFIG_OF_GPIO */
83 82
84static inline int of_get_named_gpio_flags(struct device_node *np,
85 const char *list_name, int index, enum of_gpio_flags *flags)
86{
87 struct gpio_desc *desc;
88 desc = of_get_named_gpiod_flags(np, list_name, index, flags);
89
90 if (IS_ERR(desc))
91 return PTR_ERR(desc);
92 else
93 return desc_to_gpio(desc);
94}
95
96/** 83/**
97 * of_gpio_named_count() - Count GPIOs for a device 84 * of_gpio_named_count() - Count GPIOs for a device
98 * @np: device node to count GPIOs for 85 * @np: device node to count GPIOs for
@@ -129,22 +116,6 @@ static inline int of_gpio_count(struct device_node *np)
129 return of_gpio_named_count(np, "gpios"); 116 return of_gpio_named_count(np, "gpios");
130} 117}
131 118
132/**
133 * of_get_gpiod_flags() - Get a GPIO descriptor and flags to use with GPIO API
134 * @np: device node to get GPIO from
135 * @index: index of the GPIO
136 * @flags: a flags pointer to fill in
137 *
138 * Returns GPIO descriptor to use with Linux generic GPIO API, or a errno
139 * value on the error condition. If @flags is not NULL the function also fills
140 * in flags for the GPIO.
141 */
142static inline struct gpio_desc *of_get_gpiod_flags(struct device_node *np,
143 int index, enum of_gpio_flags *flags)
144{
145 return of_get_named_gpiod_flags(np, "gpios", index, flags);
146}
147
148static inline int of_get_gpio_flags(struct device_node *np, int index, 119static inline int of_get_gpio_flags(struct device_node *np, int index,
149 enum of_gpio_flags *flags) 120 enum of_gpio_flags *flags)
150{ 121{
diff --git a/include/linux/of_irq.h b/include/linux/of_irq.h
index 6404253d810d..bfec136a6d1e 100644
--- a/include/linux/of_irq.h
+++ b/include/linux/of_irq.h
@@ -45,6 +45,7 @@ extern void of_irq_init(const struct of_device_id *matches);
45#ifdef CONFIG_OF_IRQ 45#ifdef CONFIG_OF_IRQ
46extern int of_irq_count(struct device_node *dev); 46extern int of_irq_count(struct device_node *dev);
47extern int of_irq_get(struct device_node *dev, int index); 47extern int of_irq_get(struct device_node *dev, int index);
48extern int of_irq_get_byname(struct device_node *dev, const char *name);
48#else 49#else
49static inline int of_irq_count(struct device_node *dev) 50static inline int of_irq_count(struct device_node *dev)
50{ 51{
@@ -54,6 +55,10 @@ static inline int of_irq_get(struct device_node *dev, int index)
54{ 55{
55 return 0; 56 return 0;
56} 57}
58static inline int of_irq_get_byname(struct device_node *dev, const char *name)
59{
60 return 0;
61}
57#endif 62#endif
58 63
59#if defined(CONFIG_OF) 64#if defined(CONFIG_OF)
diff --git a/include/linux/of_mdio.h b/include/linux/of_mdio.h
index 6fe8464ed767..a70c9493d55a 100644
--- a/include/linux/of_mdio.h
+++ b/include/linux/of_mdio.h
@@ -22,16 +22,21 @@ extern struct phy_device *of_phy_connect(struct net_device *dev,
22struct phy_device *of_phy_attach(struct net_device *dev, 22struct phy_device *of_phy_attach(struct net_device *dev,
23 struct device_node *phy_np, u32 flags, 23 struct device_node *phy_np, u32 flags,
24 phy_interface_t iface); 24 phy_interface_t iface);
25extern struct phy_device *of_phy_connect_fixed_link(struct net_device *dev,
26 void (*hndlr)(struct net_device *),
27 phy_interface_t iface);
28 25
29extern struct mii_bus *of_mdio_find_bus(struct device_node *mdio_np); 26extern struct mii_bus *of_mdio_find_bus(struct device_node *mdio_np);
30 27
28extern void of_mdiobus_link_phydev(struct mii_bus *mdio,
29 struct phy_device *phydev);
30
31#else /* CONFIG_OF */ 31#else /* CONFIG_OF */
32static inline int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np) 32static inline int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np)
33{ 33{
34 return -ENOSYS; 34 /*
35 * Fall back to the non-DT function to register a bus.
36 * This way, we don't have to keep compat bits around in drivers.
37 */
38
39 return mdiobus_register(mdio);
35} 40}
36 41
37static inline struct phy_device *of_phy_find_device(struct device_node *phy_np) 42static inline struct phy_device *of_phy_find_device(struct device_node *phy_np)
@@ -54,17 +59,30 @@ static inline struct phy_device *of_phy_attach(struct net_device *dev,
54 return NULL; 59 return NULL;
55} 60}
56 61
57static inline struct phy_device *of_phy_connect_fixed_link(struct net_device *dev, 62static inline struct mii_bus *of_mdio_find_bus(struct device_node *mdio_np)
58 void (*hndlr)(struct net_device *),
59 phy_interface_t iface)
60{ 63{
61 return NULL; 64 return NULL;
62} 65}
63 66
64static inline struct mii_bus *of_mdio_find_bus(struct device_node *mdio_np) 67static inline void of_mdiobus_link_phydev(struct mii_bus *mdio,
68 struct phy_device *phydev)
65{ 69{
66 return NULL;
67} 70}
68#endif /* CONFIG_OF */ 71#endif /* CONFIG_OF */
69 72
73#if defined(CONFIG_OF) && defined(CONFIG_FIXED_PHY)
74extern int of_phy_register_fixed_link(struct device_node *np);
75extern bool of_phy_is_fixed_link(struct device_node *np);
76#else
77static inline int of_phy_register_fixed_link(struct device_node *np)
78{
79 return -ENOSYS;
80}
81static inline bool of_phy_is_fixed_link(struct device_node *np)
82{
83 return false;
84}
85#endif
86
87
70#endif /* __LINUX_OF_MDIO_H */ 88#endif /* __LINUX_OF_MDIO_H */
diff --git a/include/linux/of_pci.h b/include/linux/of_pci.h
index 1a1f5ffd5288..dde3a4a0fa5d 100644
--- a/include/linux/of_pci.h
+++ b/include/linux/of_pci.h
@@ -6,14 +6,44 @@
6 6
7struct pci_dev; 7struct pci_dev;
8struct of_phandle_args; 8struct of_phandle_args;
9int of_irq_parse_pci(const struct pci_dev *pdev, struct of_phandle_args *out_irq);
10int of_irq_parse_and_map_pci(const struct pci_dev *dev, u8 slot, u8 pin);
11
12struct device_node; 9struct device_node;
10
11#ifdef CONFIG_OF
12int of_irq_parse_pci(const struct pci_dev *pdev, struct of_phandle_args *out_irq);
13struct device_node *of_pci_find_child_device(struct device_node *parent, 13struct device_node *of_pci_find_child_device(struct device_node *parent,
14 unsigned int devfn); 14 unsigned int devfn);
15int of_pci_get_devfn(struct device_node *np); 15int of_pci_get_devfn(struct device_node *np);
16int of_irq_parse_and_map_pci(const struct pci_dev *dev, u8 slot, u8 pin);
16int of_pci_parse_bus_range(struct device_node *node, struct resource *res); 17int of_pci_parse_bus_range(struct device_node *node, struct resource *res);
18#else
19static inline int of_irq_parse_pci(const struct pci_dev *pdev, struct of_phandle_args *out_irq)
20{
21 return 0;
22}
23
24static inline struct device_node *of_pci_find_child_device(struct device_node *parent,
25 unsigned int devfn)
26{
27 return NULL;
28}
29
30static inline int of_pci_get_devfn(struct device_node *np)
31{
32 return -EINVAL;
33}
34
35static inline int
36of_irq_parse_and_map_pci(const struct pci_dev *dev, u8 slot, u8 pin)
37{
38 return 0;
39}
40
41static inline int
42of_pci_parse_bus_range(struct device_node *node, struct resource *res)
43{
44 return -EINVAL;
45}
46#endif
17 47
18#if defined(CONFIG_OF) && defined(CONFIG_PCI_MSI) 48#if defined(CONFIG_OF) && defined(CONFIG_PCI_MSI)
19int of_pci_msi_chip_add(struct msi_chip *chip); 49int of_pci_msi_chip_add(struct msi_chip *chip);
diff --git a/include/linux/of_platform.h b/include/linux/of_platform.h
index 05cb4a928252..d96e1badbee0 100644
--- a/include/linux/of_platform.h
+++ b/include/linux/of_platform.h
@@ -37,7 +37,7 @@
37 * Note: Using an auxdata lookup table should be considered a last resort when 37 * Note: Using an auxdata lookup table should be considered a last resort when
38 * converting a platform to use the DT. Normally the automatically generated 38 * converting a platform to use the DT. Normally the automatically generated
39 * device name will not matter, and drivers should obtain data from the device 39 * device name will not matter, and drivers should obtain data from the device
40 * node instead of from an anonymouns platform_data pointer. 40 * node instead of from an anonymous platform_data pointer.
41 */ 41 */
42struct of_dev_auxdata { 42struct of_dev_auxdata {
43 char *compatible; 43 char *compatible;
@@ -72,6 +72,7 @@ extern int of_platform_populate(struct device_node *root,
72 const struct of_device_id *matches, 72 const struct of_device_id *matches,
73 const struct of_dev_auxdata *lookup, 73 const struct of_dev_auxdata *lookup,
74 struct device *parent); 74 struct device *parent);
75extern int of_platform_depopulate(struct device *parent);
75#else 76#else
76static inline int of_platform_populate(struct device_node *root, 77static inline int of_platform_populate(struct device_node *root,
77 const struct of_device_id *matches, 78 const struct of_device_id *matches,
@@ -80,6 +81,10 @@ static inline int of_platform_populate(struct device_node *root,
80{ 81{
81 return -ENODEV; 82 return -ENODEV;
82} 83}
84static inline int of_platform_depopulate(struct device *parent)
85{
86 return -ENODEV;
87}
83#endif 88#endif
84 89
85#endif /* _LINUX_OF_PLATFORM_H */ 90#endif /* _LINUX_OF_PLATFORM_H */
diff --git a/include/linux/of_reserved_mem.h b/include/linux/of_reserved_mem.h
index 9b1fbb7f29fc..4669ddfdd5af 100644
--- a/include/linux/of_reserved_mem.h
+++ b/include/linux/of_reserved_mem.h
@@ -21,33 +21,19 @@ struct reserved_mem_ops {
21 struct device *dev); 21 struct device *dev);
22}; 22};
23 23
24typedef int (*reservedmem_of_init_fn)(struct reserved_mem *rmem, 24typedef int (*reservedmem_of_init_fn)(struct reserved_mem *rmem);
25 unsigned long node, const char *uname); 25
26#define RESERVEDMEM_OF_DECLARE(name, compat, init) \
27 _OF_DECLARE(reservedmem, name, compat, init, reservedmem_of_init_fn)
26 28
27#ifdef CONFIG_OF_RESERVED_MEM 29#ifdef CONFIG_OF_RESERVED_MEM
28void fdt_init_reserved_mem(void); 30void fdt_init_reserved_mem(void);
29void fdt_reserved_mem_save_node(unsigned long node, const char *uname, 31void fdt_reserved_mem_save_node(unsigned long node, const char *uname,
30 phys_addr_t base, phys_addr_t size); 32 phys_addr_t base, phys_addr_t size);
31
32#define RESERVEDMEM_OF_DECLARE(name, compat, init) \
33 static const struct of_device_id __reservedmem_of_table_##name \
34 __used __section(__reservedmem_of_table) \
35 = { .compatible = compat, \
36 .data = (init == (reservedmem_of_init_fn)NULL) ? \
37 init : init }
38
39#else 33#else
40static inline void fdt_init_reserved_mem(void) { } 34static inline void fdt_init_reserved_mem(void) { }
41static inline void fdt_reserved_mem_save_node(unsigned long node, 35static inline void fdt_reserved_mem_save_node(unsigned long node,
42 const char *uname, phys_addr_t base, phys_addr_t size) { } 36 const char *uname, phys_addr_t base, phys_addr_t size) { }
43
44#define RESERVEDMEM_OF_DECLARE(name, compat, init) \
45 static const struct of_device_id __reservedmem_of_table_##name \
46 __attribute__((unused)) \
47 = { .compatible = compat, \
48 .data = (init == (reservedmem_of_init_fn)NULL) ? \
49 init : init }
50
51#endif 37#endif
52 38
53#endif /* __OF_RESERVED_MEM_H */ 39#endif /* __OF_RESERVED_MEM_H */
diff --git a/include/linux/omap-dma.h b/include/linux/omap-dma.h
index 41a13e70f41f..88e6ea4a5d36 100644
--- a/include/linux/omap-dma.h
+++ b/include/linux/omap-dma.h
@@ -1,23 +1,6 @@
1/*
2 * OMAP DMA Engine support
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8#ifndef __LINUX_OMAP_DMA_H 1#ifndef __LINUX_OMAP_DMA_H
9#define __LINUX_OMAP_DMA_H 2#define __LINUX_OMAP_DMA_H
10 3#include <linux/omap-dmaengine.h>
11struct dma_chan;
12
13#if defined(CONFIG_DMA_OMAP) || defined(CONFIG_DMA_OMAP_MODULE)
14bool omap_dma_filter_fn(struct dma_chan *, void *);
15#else
16static inline bool omap_dma_filter_fn(struct dma_chan *c, void *d)
17{
18 return false;
19}
20#endif
21 4
22/* 5/*
23 * Legacy OMAP DMA handling defines and functions 6 * Legacy OMAP DMA handling defines and functions
@@ -393,7 +376,7 @@ extern int omap_modify_dma_chain_params(int chain_id,
393extern int omap_dma_chain_status(int chain_id); 376extern int omap_dma_chain_status(int chain_id);
394#endif 377#endif
395 378
396#if defined(CONFIG_ARCH_OMAP1) && defined(CONFIG_FB_OMAP) 379#if defined(CONFIG_ARCH_OMAP1) && IS_ENABLED(CONFIG_FB_OMAP)
397#include <mach/lcd_dma.h> 380#include <mach/lcd_dma.h>
398#else 381#else
399static inline int omap_lcd_dma_running(void) 382static inline int omap_lcd_dma_running(void)
diff --git a/include/linux/omap-dmaengine.h b/include/linux/omap-dmaengine.h
new file mode 100644
index 000000000000..8e6906c72e90
--- /dev/null
+++ b/include/linux/omap-dmaengine.h
@@ -0,0 +1,21 @@
1/*
2 * OMAP DMA Engine support
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8#ifndef __LINUX_OMAP_DMAENGINE_H
9#define __LINUX_OMAP_DMAENGINE_H
10
11struct dma_chan;
12
13#if defined(CONFIG_DMA_OMAP) || (defined(CONFIG_DMA_OMAP_MODULE) && defined(MODULE))
14bool omap_dma_filter_fn(struct dma_chan *, void *);
15#else
16static inline bool omap_dma_filter_fn(struct dma_chan *c, void *d)
17{
18 return false;
19}
20#endif
21#endif /* __LINUX_OMAP_DMAENGINE_H */
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index d1fe1a761047..8304959ad336 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -198,6 +198,7 @@ struct page; /* forward declaration */
198TESTPAGEFLAG(Locked, locked) 198TESTPAGEFLAG(Locked, locked)
199PAGEFLAG(Error, error) TESTCLEARFLAG(Error, error) 199PAGEFLAG(Error, error) TESTCLEARFLAG(Error, error)
200PAGEFLAG(Referenced, referenced) TESTCLEARFLAG(Referenced, referenced) 200PAGEFLAG(Referenced, referenced) TESTCLEARFLAG(Referenced, referenced)
201 __SETPAGEFLAG(Referenced, referenced)
201PAGEFLAG(Dirty, dirty) TESTSCFLAG(Dirty, dirty) __CLEARPAGEFLAG(Dirty, dirty) 202PAGEFLAG(Dirty, dirty) TESTSCFLAG(Dirty, dirty) __CLEARPAGEFLAG(Dirty, dirty)
202PAGEFLAG(LRU, lru) __CLEARPAGEFLAG(LRU, lru) 203PAGEFLAG(LRU, lru) __CLEARPAGEFLAG(LRU, lru)
203PAGEFLAG(Active, active) __CLEARPAGEFLAG(Active, active) 204PAGEFLAG(Active, active) __CLEARPAGEFLAG(Active, active)
@@ -208,6 +209,7 @@ PAGEFLAG(Pinned, pinned) TESTSCFLAG(Pinned, pinned) /* Xen */
208PAGEFLAG(SavePinned, savepinned); /* Xen */ 209PAGEFLAG(SavePinned, savepinned); /* Xen */
209PAGEFLAG(Reserved, reserved) __CLEARPAGEFLAG(Reserved, reserved) 210PAGEFLAG(Reserved, reserved) __CLEARPAGEFLAG(Reserved, reserved)
210PAGEFLAG(SwapBacked, swapbacked) __CLEARPAGEFLAG(SwapBacked, swapbacked) 211PAGEFLAG(SwapBacked, swapbacked) __CLEARPAGEFLAG(SwapBacked, swapbacked)
212 __SETPAGEFLAG(SwapBacked, swapbacked)
211 213
212__PAGEFLAG(SlobFree, slob_free) 214__PAGEFLAG(SlobFree, slob_free)
213 215
@@ -317,13 +319,23 @@ CLEARPAGEFLAG(Uptodate, uptodate)
317extern void cancel_dirty_page(struct page *page, unsigned int account_size); 319extern void cancel_dirty_page(struct page *page, unsigned int account_size);
318 320
319int test_clear_page_writeback(struct page *page); 321int test_clear_page_writeback(struct page *page);
320int test_set_page_writeback(struct page *page); 322int __test_set_page_writeback(struct page *page, bool keep_write);
323
324#define test_set_page_writeback(page) \
325 __test_set_page_writeback(page, false)
326#define test_set_page_writeback_keepwrite(page) \
327 __test_set_page_writeback(page, true)
321 328
322static inline void set_page_writeback(struct page *page) 329static inline void set_page_writeback(struct page *page)
323{ 330{
324 test_set_page_writeback(page); 331 test_set_page_writeback(page);
325} 332}
326 333
334static inline void set_page_writeback_keepwrite(struct page *page)
335{
336 test_set_page_writeback_keepwrite(page);
337}
338
327#ifdef CONFIG_PAGEFLAGS_EXTENDED 339#ifdef CONFIG_PAGEFLAGS_EXTENDED
328/* 340/*
329 * System with lots of page flags available. This allows separate 341 * System with lots of page flags available. This allows separate
@@ -348,6 +360,9 @@ static inline void ClearPageCompound(struct page *page)
348 ClearPageHead(page); 360 ClearPageHead(page);
349} 361}
350#endif 362#endif
363
364#define PG_head_mask ((1L << PG_head))
365
351#else 366#else
352/* 367/*
353 * Reduce page flag use as much as possible by overlapping 368 * Reduce page flag use as much as possible by overlapping
diff --git a/include/linux/pageblock-flags.h b/include/linux/pageblock-flags.h
index 2ee8cd2466b5..2baeee12f48e 100644
--- a/include/linux/pageblock-flags.h
+++ b/include/linux/pageblock-flags.h
@@ -30,9 +30,12 @@ enum pageblock_bits {
30 PB_migrate, 30 PB_migrate,
31 PB_migrate_end = PB_migrate + 3 - 1, 31 PB_migrate_end = PB_migrate + 3 - 1,
32 /* 3 bits required for migrate types */ 32 /* 3 bits required for migrate types */
33#ifdef CONFIG_COMPACTION
34 PB_migrate_skip,/* If set the block is skipped by compaction */ 33 PB_migrate_skip,/* If set the block is skipped by compaction */
35#endif /* CONFIG_COMPACTION */ 34
35 /*
36 * Assume the bits will always align on a word. If this assumption
37 * changes then get/set pageblock needs updating.
38 */
36 NR_PAGEBLOCK_BITS 39 NR_PAGEBLOCK_BITS
37}; 40};
38 41
@@ -62,11 +65,26 @@ extern int pageblock_order;
62/* Forward declaration */ 65/* Forward declaration */
63struct page; 66struct page;
64 67
68unsigned long get_pfnblock_flags_mask(struct page *page,
69 unsigned long pfn,
70 unsigned long end_bitidx,
71 unsigned long mask);
72
73void set_pfnblock_flags_mask(struct page *page,
74 unsigned long flags,
75 unsigned long pfn,
76 unsigned long end_bitidx,
77 unsigned long mask);
78
65/* Declarations for getting and setting flags. See mm/page_alloc.c */ 79/* Declarations for getting and setting flags. See mm/page_alloc.c */
66unsigned long get_pageblock_flags_group(struct page *page, 80#define get_pageblock_flags_group(page, start_bitidx, end_bitidx) \
67 int start_bitidx, int end_bitidx); 81 get_pfnblock_flags_mask(page, page_to_pfn(page), \
68void set_pageblock_flags_group(struct page *page, unsigned long flags, 82 end_bitidx, \
69 int start_bitidx, int end_bitidx); 83 (1 << (end_bitidx - start_bitidx + 1)) - 1)
84#define set_pageblock_flags_group(page, flags, start_bitidx, end_bitidx) \
85 set_pfnblock_flags_mask(page, flags, page_to_pfn(page), \
86 end_bitidx, \
87 (1 << (end_bitidx - start_bitidx + 1)) - 1)
70 88
71#ifdef CONFIG_COMPACTION 89#ifdef CONFIG_COMPACTION
72#define get_pageblock_skip(page) \ 90#define get_pageblock_skip(page) \
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index 45598f1e9aa3..0a97b583ee8d 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -110,7 +110,7 @@ static inline void mapping_set_gfp_mask(struct address_space *m, gfp_t mask)
110 110
111#define page_cache_get(page) get_page(page) 111#define page_cache_get(page) get_page(page)
112#define page_cache_release(page) put_page(page) 112#define page_cache_release(page) put_page(page)
113void release_pages(struct page **pages, int nr, int cold); 113void release_pages(struct page **pages, int nr, bool cold);
114 114
115/* 115/*
116 * speculatively take a reference to a page. 116 * speculatively take a reference to a page.
@@ -259,12 +259,109 @@ pgoff_t page_cache_next_hole(struct address_space *mapping,
259pgoff_t page_cache_prev_hole(struct address_space *mapping, 259pgoff_t page_cache_prev_hole(struct address_space *mapping,
260 pgoff_t index, unsigned long max_scan); 260 pgoff_t index, unsigned long max_scan);
261 261
262#define FGP_ACCESSED 0x00000001
263#define FGP_LOCK 0x00000002
264#define FGP_CREAT 0x00000004
265#define FGP_WRITE 0x00000008
266#define FGP_NOFS 0x00000010
267#define FGP_NOWAIT 0x00000020
268
269struct page *pagecache_get_page(struct address_space *mapping, pgoff_t offset,
270 int fgp_flags, gfp_t cache_gfp_mask, gfp_t radix_gfp_mask);
271
272/**
273 * find_get_page - find and get a page reference
274 * @mapping: the address_space to search
275 * @offset: the page index
276 *
277 * Looks up the page cache slot at @mapping & @offset. If there is a
278 * page cache page, it is returned with an increased refcount.
279 *
280 * Otherwise, %NULL is returned.
281 */
282static inline struct page *find_get_page(struct address_space *mapping,
283 pgoff_t offset)
284{
285 return pagecache_get_page(mapping, offset, 0, 0, 0);
286}
287
288static inline struct page *find_get_page_flags(struct address_space *mapping,
289 pgoff_t offset, int fgp_flags)
290{
291 return pagecache_get_page(mapping, offset, fgp_flags, 0, 0);
292}
293
294/**
295 * find_lock_page - locate, pin and lock a pagecache page
296 * pagecache_get_page - find and get a page reference
297 * @mapping: the address_space to search
298 * @offset: the page index
299 *
300 * Looks up the page cache slot at @mapping & @offset. If there is a
301 * page cache page, it is returned locked and with an increased
302 * refcount.
303 *
304 * Otherwise, %NULL is returned.
305 *
306 * find_lock_page() may sleep.
307 */
308static inline struct page *find_lock_page(struct address_space *mapping,
309 pgoff_t offset)
310{
311 return pagecache_get_page(mapping, offset, FGP_LOCK, 0, 0);
312}
313
314/**
315 * find_or_create_page - locate or add a pagecache page
316 * @mapping: the page's address_space
317 * @index: the page's index into the mapping
318 * @gfp_mask: page allocation mode
319 *
320 * Looks up the page cache slot at @mapping & @offset. If there is a
321 * page cache page, it is returned locked and with an increased
322 * refcount.
323 *
324 * If the page is not present, a new page is allocated using @gfp_mask
325 * and added to the page cache and the VM's LRU list. The page is
326 * returned locked and with an increased refcount.
327 *
328 * On memory exhaustion, %NULL is returned.
329 *
330 * find_or_create_page() may sleep, even if @gfp_flags specifies an
331 * atomic allocation!
332 */
333static inline struct page *find_or_create_page(struct address_space *mapping,
334 pgoff_t offset, gfp_t gfp_mask)
335{
336 return pagecache_get_page(mapping, offset,
337 FGP_LOCK|FGP_ACCESSED|FGP_CREAT,
338 gfp_mask, gfp_mask & GFP_RECLAIM_MASK);
339}
340
341/**
342 * grab_cache_page_nowait - returns locked page at given index in given cache
343 * @mapping: target address_space
344 * @index: the page index
345 *
346 * Same as grab_cache_page(), but do not wait if the page is unavailable.
347 * This is intended for speculative data generators, where the data can
348 * be regenerated if the page couldn't be grabbed. This routine should
349 * be safe to call while holding the lock for another page.
350 *
351 * Clear __GFP_FS when allocating the page to avoid recursion into the fs
352 * and deadlock against the caller's locked page.
353 */
354static inline struct page *grab_cache_page_nowait(struct address_space *mapping,
355 pgoff_t index)
356{
357 return pagecache_get_page(mapping, index,
358 FGP_LOCK|FGP_CREAT|FGP_NOFS|FGP_NOWAIT,
359 mapping_gfp_mask(mapping),
360 GFP_NOFS);
361}
362
262struct page *find_get_entry(struct address_space *mapping, pgoff_t offset); 363struct page *find_get_entry(struct address_space *mapping, pgoff_t offset);
263struct page *find_get_page(struct address_space *mapping, pgoff_t offset);
264struct page *find_lock_entry(struct address_space *mapping, pgoff_t offset); 364struct page *find_lock_entry(struct address_space *mapping, pgoff_t offset);
265struct page *find_lock_page(struct address_space *mapping, pgoff_t offset);
266struct page *find_or_create_page(struct address_space *mapping, pgoff_t index,
267 gfp_t gfp_mask);
268unsigned find_get_entries(struct address_space *mapping, pgoff_t start, 365unsigned find_get_entries(struct address_space *mapping, pgoff_t start,
269 unsigned int nr_entries, struct page **entries, 366 unsigned int nr_entries, struct page **entries,
270 pgoff_t *indices); 367 pgoff_t *indices);
@@ -287,8 +384,6 @@ static inline struct page *grab_cache_page(struct address_space *mapping,
287 return find_or_create_page(mapping, index, mapping_gfp_mask(mapping)); 384 return find_or_create_page(mapping, index, mapping_gfp_mask(mapping));
288} 385}
289 386
290extern struct page * grab_cache_page_nowait(struct address_space *mapping,
291 pgoff_t index);
292extern struct page * read_cache_page(struct address_space *mapping, 387extern struct page * read_cache_page(struct address_space *mapping,
293 pgoff_t index, filler_t *filler, void *data); 388 pgoff_t index, filler_t *filler, void *data);
294extern struct page * read_cache_page_gfp(struct address_space *mapping, 389extern struct page * read_cache_page_gfp(struct address_space *mapping,
@@ -425,6 +520,8 @@ static inline void wait_on_page_writeback(struct page *page)
425extern void end_page_writeback(struct page *page); 520extern void end_page_writeback(struct page *page);
426void wait_for_stable_page(struct page *page); 521void wait_for_stable_page(struct page *page);
427 522
523void page_endio(struct page *page, int rw, int err);
524
428/* 525/*
429 * Add an arbitrary waiter to a page's wait queue 526 * Add an arbitrary waiter to a page's wait queue
430 */ 527 */
diff --git a/include/linux/pci.h b/include/linux/pci.h
index aab57b4abe7f..466bcd111d85 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -164,13 +164,17 @@ enum pci_dev_flags {
164 /* INTX_DISABLE in PCI_COMMAND register disables MSI 164 /* INTX_DISABLE in PCI_COMMAND register disables MSI
165 * generation too. 165 * generation too.
166 */ 166 */
167 PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG = (__force pci_dev_flags_t) 1, 167 PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG = (__force pci_dev_flags_t) (1 << 0),
168 /* Device configuration is irrevocably lost if disabled into D3 */ 168 /* Device configuration is irrevocably lost if disabled into D3 */
169 PCI_DEV_FLAGS_NO_D3 = (__force pci_dev_flags_t) 2, 169 PCI_DEV_FLAGS_NO_D3 = (__force pci_dev_flags_t) (1 << 1),
170 /* Provide indication device is assigned by a Virtual Machine Manager */ 170 /* Provide indication device is assigned by a Virtual Machine Manager */
171 PCI_DEV_FLAGS_ASSIGNED = (__force pci_dev_flags_t) 4, 171 PCI_DEV_FLAGS_ASSIGNED = (__force pci_dev_flags_t) (1 << 2),
172 /* Flag for quirk use to store if quirk-specific ACS is enabled */ 172 /* Flag for quirk use to store if quirk-specific ACS is enabled */
173 PCI_DEV_FLAGS_ACS_ENABLED_QUIRK = (__force pci_dev_flags_t) 8, 173 PCI_DEV_FLAGS_ACS_ENABLED_QUIRK = (__force pci_dev_flags_t) (1 << 3),
174 /* Flag to indicate the device uses dma_alias_devfn */
175 PCI_DEV_FLAGS_DMA_ALIAS_DEVFN = (__force pci_dev_flags_t) (1 << 4),
176 /* Use a PCIe-to-PCI bridge alias even if !pci_is_pcie */
177 PCI_DEV_FLAG_PCIE_BRIDGE_ALIAS = (__force pci_dev_flags_t) (1 << 5),
174}; 178};
175 179
176enum pci_irq_reroute_variant { 180enum pci_irq_reroute_variant {
@@ -268,6 +272,7 @@ struct pci_dev {
268 u8 rom_base_reg; /* which config register controls the ROM */ 272 u8 rom_base_reg; /* which config register controls the ROM */
269 u8 pin; /* which interrupt pin this device uses */ 273 u8 pin; /* which interrupt pin this device uses */
270 u16 pcie_flags_reg; /* cached PCIe Capabilities Register */ 274 u16 pcie_flags_reg; /* cached PCIe Capabilities Register */
275 u8 dma_alias_devfn;/* devfn of DMA alias, if any */
271 276
272 struct pci_driver *driver; /* which driver has allocated this device */ 277 struct pci_driver *driver; /* which driver has allocated this device */
273 u64 dma_mask; /* Mask of the bits of bus address this 278 u64 dma_mask; /* Mask of the bits of bus address this
@@ -365,6 +370,7 @@ struct pci_dev {
365#endif 370#endif
366 phys_addr_t rom; /* Physical address of ROM if it's not from the BAR */ 371 phys_addr_t rom; /* Physical address of ROM if it's not from the BAR */
367 size_t romlen; /* Length of ROM if it's not from the BAR */ 372 size_t romlen; /* Length of ROM if it's not from the BAR */
373 char *driver_override; /* Driver name to force a match */
368}; 374};
369 375
370static inline struct pci_dev *pci_physfn(struct pci_dev *dev) 376static inline struct pci_dev *pci_physfn(struct pci_dev *dev)
@@ -477,6 +483,19 @@ static inline bool pci_is_root_bus(struct pci_bus *pbus)
477 return !(pbus->parent); 483 return !(pbus->parent);
478} 484}
479 485
486/**
487 * pci_is_bridge - check if the PCI device is a bridge
488 * @dev: PCI device
489 *
490 * Return true if the PCI device is bridge whether it has subordinate
491 * or not.
492 */
493static inline bool pci_is_bridge(struct pci_dev *dev)
494{
495 return dev->hdr_type == PCI_HEADER_TYPE_BRIDGE ||
496 dev->hdr_type == PCI_HEADER_TYPE_CARDBUS;
497}
498
480static inline struct pci_dev *pci_upstream_bridge(struct pci_dev *dev) 499static inline struct pci_dev *pci_upstream_bridge(struct pci_dev *dev)
481{ 500{
482 dev = pci_physfn(dev); 501 dev = pci_physfn(dev);
@@ -518,7 +537,7 @@ static inline int pcibios_err_to_errno(int err)
518 case PCIBIOS_FUNC_NOT_SUPPORTED: 537 case PCIBIOS_FUNC_NOT_SUPPORTED:
519 return -ENOENT; 538 return -ENOENT;
520 case PCIBIOS_BAD_VENDOR_ID: 539 case PCIBIOS_BAD_VENDOR_ID:
521 return -EINVAL; 540 return -ENOTTY;
522 case PCIBIOS_DEVICE_NOT_FOUND: 541 case PCIBIOS_DEVICE_NOT_FOUND:
523 return -ENODEV; 542 return -ENODEV;
524 case PCIBIOS_BAD_REGISTER_NUMBER: 543 case PCIBIOS_BAD_REGISTER_NUMBER:
@@ -529,7 +548,7 @@ static inline int pcibios_err_to_errno(int err)
529 return -ENOSPC; 548 return -ENOSPC;
530 } 549 }
531 550
532 return -ENOTTY; 551 return -ERANGE;
533} 552}
534 553
535/* Low-level architecture-dependent routines */ 554/* Low-level architecture-dependent routines */
@@ -603,6 +622,9 @@ struct pci_error_handlers {
603 /* PCI slot has been reset */ 622 /* PCI slot has been reset */
604 pci_ers_result_t (*slot_reset)(struct pci_dev *dev); 623 pci_ers_result_t (*slot_reset)(struct pci_dev *dev);
605 624
625 /* PCI function reset prepare or completed */
626 void (*reset_notify)(struct pci_dev *dev, bool prepare);
627
606 /* Device driver may resume normal operations */ 628 /* Device driver may resume normal operations */
607 void (*resume)(struct pci_dev *dev); 629 void (*resume)(struct pci_dev *dev);
608}; 630};
@@ -680,8 +702,8 @@ struct pci_driver {
680 702
681/** 703/**
682 * PCI_VDEVICE - macro used to describe a specific pci device in short form 704 * PCI_VDEVICE - macro used to describe a specific pci device in short form
683 * @vendor: the vendor name 705 * @vend: the vendor name
684 * @device: the 16 bit PCI Device ID 706 * @dev: the 16 bit PCI Device ID
685 * 707 *
686 * This macro is used to create a struct pci_device_id that matches a 708 * This macro is used to create a struct pci_device_id that matches a
687 * specific PCI device. The subvendor, and subdevice fields will be set 709 * specific PCI device. The subvendor, and subdevice fields will be set
@@ -689,9 +711,9 @@ struct pci_driver {
689 * private data. 711 * private data.
690 */ 712 */
691 713
692#define PCI_VDEVICE(vendor, device) \ 714#define PCI_VDEVICE(vend, dev) \
693 PCI_VENDOR_ID_##vendor, (device), \ 715 .vendor = PCI_VENDOR_ID_##vend, .device = (dev), \
694 PCI_ANY_ID, PCI_ANY_ID, 0, 0 716 .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID, 0, 0
695 717
696/* these external functions are only available when PCI support is enabled */ 718/* these external functions are only available when PCI support is enabled */
697#ifdef CONFIG_PCI 719#ifdef CONFIG_PCI
@@ -764,7 +786,7 @@ int pci_scan_slot(struct pci_bus *bus, int devfn);
764struct pci_dev *pci_scan_single_device(struct pci_bus *bus, int devfn); 786struct pci_dev *pci_scan_single_device(struct pci_bus *bus, int devfn);
765void pci_device_add(struct pci_dev *dev, struct pci_bus *bus); 787void pci_device_add(struct pci_dev *dev, struct pci_bus *bus);
766unsigned int pci_scan_child_bus(struct pci_bus *bus); 788unsigned int pci_scan_child_bus(struct pci_bus *bus);
767int __must_check pci_bus_add_device(struct pci_dev *dev); 789void pci_bus_add_device(struct pci_dev *dev);
768void pci_read_bridge_bases(struct pci_bus *child); 790void pci_read_bridge_bases(struct pci_bus *child);
769struct resource *pci_find_parent_resource(const struct pci_dev *dev, 791struct resource *pci_find_parent_resource(const struct pci_dev *dev,
770 struct resource *res); 792 struct resource *res);
@@ -1158,7 +1180,6 @@ struct msix_entry {
1158 1180
1159#ifdef CONFIG_PCI_MSI 1181#ifdef CONFIG_PCI_MSI
1160int pci_msi_vec_count(struct pci_dev *dev); 1182int pci_msi_vec_count(struct pci_dev *dev);
1161int pci_enable_msi_block(struct pci_dev *dev, int nvec);
1162void pci_msi_shutdown(struct pci_dev *dev); 1183void pci_msi_shutdown(struct pci_dev *dev);
1163void pci_disable_msi(struct pci_dev *dev); 1184void pci_disable_msi(struct pci_dev *dev);
1164int pci_msix_vec_count(struct pci_dev *dev); 1185int pci_msix_vec_count(struct pci_dev *dev);
@@ -1188,8 +1209,6 @@ static inline int pci_enable_msix_exact(struct pci_dev *dev,
1188} 1209}
1189#else 1210#else
1190static inline int pci_msi_vec_count(struct pci_dev *dev) { return -ENOSYS; } 1211static inline int pci_msi_vec_count(struct pci_dev *dev) { return -ENOSYS; }
1191static inline int pci_enable_msi_block(struct pci_dev *dev, int nvec)
1192{ return -ENOSYS; }
1193static inline void pci_msi_shutdown(struct pci_dev *dev) { } 1212static inline void pci_msi_shutdown(struct pci_dev *dev) { }
1194static inline void pci_disable_msi(struct pci_dev *dev) { } 1213static inline void pci_disable_msi(struct pci_dev *dev) { }
1195static inline int pci_msix_vec_count(struct pci_dev *dev) { return -ENOSYS; } 1214static inline int pci_msix_vec_count(struct pci_dev *dev) { return -ENOSYS; }
@@ -1244,7 +1263,7 @@ static inline void pcie_set_ecrc_checking(struct pci_dev *dev) { }
1244static inline void pcie_ecrc_get_policy(char *str) { } 1263static inline void pcie_ecrc_get_policy(char *str) { }
1245#endif 1264#endif
1246 1265
1247#define pci_enable_msi(pdev) pci_enable_msi_block(pdev, 1) 1266#define pci_enable_msi(pdev) pci_enable_msi_exact(pdev, 1)
1248 1267
1249#ifdef CONFIG_HT_IRQ 1268#ifdef CONFIG_HT_IRQ
1250/* The functions a driver should call */ 1269/* The functions a driver should call */
@@ -1572,13 +1591,13 @@ extern unsigned long pci_hotplug_io_size;
1572extern unsigned long pci_hotplug_mem_size; 1591extern unsigned long pci_hotplug_mem_size;
1573 1592
1574/* Architecture-specific versions may override these (weak) */ 1593/* Architecture-specific versions may override these (weak) */
1575int pcibios_add_platform_entries(struct pci_dev *dev);
1576void pcibios_disable_device(struct pci_dev *dev); 1594void pcibios_disable_device(struct pci_dev *dev);
1577void pcibios_set_master(struct pci_dev *dev); 1595void pcibios_set_master(struct pci_dev *dev);
1578int pcibios_set_pcie_reset_state(struct pci_dev *dev, 1596int pcibios_set_pcie_reset_state(struct pci_dev *dev,
1579 enum pcie_reset_state state); 1597 enum pcie_reset_state state);
1580int pcibios_add_device(struct pci_dev *dev); 1598int pcibios_add_device(struct pci_dev *dev);
1581void pcibios_release_device(struct pci_dev *dev); 1599void pcibios_release_device(struct pci_dev *dev);
1600void pcibios_penalize_isa_irq(int irq, int active);
1582 1601
1583#ifdef CONFIG_HIBERNATE_CALLBACKS 1602#ifdef CONFIG_HIBERNATE_CALLBACKS
1584extern struct dev_pm_ops pcibios_pm_ops; 1603extern struct dev_pm_ops pcibios_pm_ops;
@@ -1795,6 +1814,10 @@ static inline struct eeh_dev *pci_dev_to_eeh_dev(struct pci_dev *pdev)
1795} 1814}
1796#endif 1815#endif
1797 1816
1817int pci_for_each_dma_alias(struct pci_dev *pdev,
1818 int (*fn)(struct pci_dev *pdev,
1819 u16 alias, void *data), void *data);
1820
1798/** 1821/**
1799 * pci_find_upstream_pcie_bridge - find upstream PCIe-to-PCI bridge of a device 1822 * pci_find_upstream_pcie_bridge - find upstream PCIe-to-PCI bridge of a device
1800 * @pdev: the PCI device 1823 * @pdev: the PCI device
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index d4de24b4d4c6..7fa31731c854 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -1631,8 +1631,6 @@
1631#define PCI_DEVICE_ID_ATT_VENUS_MODEM 0x480 1631#define PCI_DEVICE_ID_ATT_VENUS_MODEM 0x480
1632 1632
1633#define PCI_VENDOR_ID_SPECIALIX 0x11cb 1633#define PCI_VENDOR_ID_SPECIALIX 0x11cb
1634#define PCI_DEVICE_ID_SPECIALIX_IO8 0x2000
1635#define PCI_DEVICE_ID_SPECIALIX_RIO 0x8000
1636#define PCI_SUBDEVICE_ID_SPECIALIX_SPEED4 0xa004 1634#define PCI_SUBDEVICE_ID_SPECIALIX_SPEED4 0xa004
1637 1635
1638#define PCI_VENDOR_ID_ANALOG_DEVICES 0x11d4 1636#define PCI_VENDOR_ID_ANALOG_DEVICES 0x11d4
@@ -2874,7 +2872,6 @@
2874#define PCI_DEVICE_ID_SCALEMP_VSMP_CTL 0x1010 2872#define PCI_DEVICE_ID_SCALEMP_VSMP_CTL 0x1010
2875 2873
2876#define PCI_VENDOR_ID_COMPUTONE 0x8e0e 2874#define PCI_VENDOR_ID_COMPUTONE 0x8e0e
2877#define PCI_DEVICE_ID_COMPUTONE_IP2EX 0x0291
2878#define PCI_DEVICE_ID_COMPUTONE_PG 0x0302 2875#define PCI_DEVICE_ID_COMPUTONE_PG 0x0302
2879#define PCI_SUBVENDOR_ID_COMPUTONE 0x8e0e 2876#define PCI_SUBVENDOR_ID_COMPUTONE 0x8e0e
2880#define PCI_SUBDEVICE_ID_COMPUTONE_PG4 0x0001 2877#define PCI_SUBDEVICE_ID_COMPUTONE_PG4 0x0001
diff --git a/include/linux/percpu-defs.h b/include/linux/percpu-defs.h
index a5fc7d01aad6..dec01d6c3f80 100644
--- a/include/linux/percpu-defs.h
+++ b/include/linux/percpu-defs.h
@@ -146,10 +146,10 @@
146 * Declaration/definition used for per-CPU variables that must be read mostly. 146 * Declaration/definition used for per-CPU variables that must be read mostly.
147 */ 147 */
148#define DECLARE_PER_CPU_READ_MOSTLY(type, name) \ 148#define DECLARE_PER_CPU_READ_MOSTLY(type, name) \
149 DECLARE_PER_CPU_SECTION(type, name, "..readmostly") 149 DECLARE_PER_CPU_SECTION(type, name, "..read_mostly")
150 150
151#define DEFINE_PER_CPU_READ_MOSTLY(type, name) \ 151#define DEFINE_PER_CPU_READ_MOSTLY(type, name) \
152 DEFINE_PER_CPU_SECTION(type, name, "..readmostly") 152 DEFINE_PER_CPU_SECTION(type, name, "..read_mostly")
153 153
154/* 154/*
155 * Intermodule exports for per-CPU variables. sparse forgets about 155 * Intermodule exports for per-CPU variables. sparse forgets about
diff --git a/include/linux/percpu-refcount.h b/include/linux/percpu-refcount.h
index 95961f0bf62d..5d8920e23073 100644
--- a/include/linux/percpu-refcount.h
+++ b/include/linux/percpu-refcount.h
@@ -110,7 +110,7 @@ static inline void percpu_ref_get(struct percpu_ref *ref)
110 pcpu_count = ACCESS_ONCE(ref->pcpu_count); 110 pcpu_count = ACCESS_ONCE(ref->pcpu_count);
111 111
112 if (likely(REF_STATUS(pcpu_count) == PCPU_REF_PTR)) 112 if (likely(REF_STATUS(pcpu_count) == PCPU_REF_PTR))
113 __this_cpu_inc(*pcpu_count); 113 this_cpu_inc(*pcpu_count);
114 else 114 else
115 atomic_inc(&ref->count); 115 atomic_inc(&ref->count);
116 116
@@ -121,6 +121,36 @@ static inline void percpu_ref_get(struct percpu_ref *ref)
121 * percpu_ref_tryget - try to increment a percpu refcount 121 * percpu_ref_tryget - try to increment a percpu refcount
122 * @ref: percpu_ref to try-get 122 * @ref: percpu_ref to try-get
123 * 123 *
124 * Increment a percpu refcount unless its count already reached zero.
125 * Returns %true on success; %false on failure.
126 *
127 * The caller is responsible for ensuring that @ref stays accessible.
128 */
129static inline bool percpu_ref_tryget(struct percpu_ref *ref)
130{
131 unsigned __percpu *pcpu_count;
132 int ret = false;
133
134 rcu_read_lock_sched();
135
136 pcpu_count = ACCESS_ONCE(ref->pcpu_count);
137
138 if (likely(REF_STATUS(pcpu_count) == PCPU_REF_PTR)) {
139 this_cpu_inc(*pcpu_count);
140 ret = true;
141 } else {
142 ret = atomic_inc_not_zero(&ref->count);
143 }
144
145 rcu_read_unlock_sched();
146
147 return ret;
148}
149
150/**
151 * percpu_ref_tryget_live - try to increment a live percpu refcount
152 * @ref: percpu_ref to try-get
153 *
124 * Increment a percpu refcount unless it has already been killed. Returns 154 * Increment a percpu refcount unless it has already been killed. Returns
125 * %true on success; %false on failure. 155 * %true on success; %false on failure.
126 * 156 *
@@ -128,8 +158,10 @@ static inline void percpu_ref_get(struct percpu_ref *ref)
128 * will fail. For such guarantee, percpu_ref_kill_and_confirm() should be 158 * will fail. For such guarantee, percpu_ref_kill_and_confirm() should be
129 * used. After the confirm_kill callback is invoked, it's guaranteed that 159 * used. After the confirm_kill callback is invoked, it's guaranteed that
130 * no new reference will be given out by percpu_ref_tryget(). 160 * no new reference will be given out by percpu_ref_tryget().
161 *
162 * The caller is responsible for ensuring that @ref stays accessible.
131 */ 163 */
132static inline bool percpu_ref_tryget(struct percpu_ref *ref) 164static inline bool percpu_ref_tryget_live(struct percpu_ref *ref)
133{ 165{
134 unsigned __percpu *pcpu_count; 166 unsigned __percpu *pcpu_count;
135 int ret = false; 167 int ret = false;
@@ -139,7 +171,7 @@ static inline bool percpu_ref_tryget(struct percpu_ref *ref)
139 pcpu_count = ACCESS_ONCE(ref->pcpu_count); 171 pcpu_count = ACCESS_ONCE(ref->pcpu_count);
140 172
141 if (likely(REF_STATUS(pcpu_count) == PCPU_REF_PTR)) { 173 if (likely(REF_STATUS(pcpu_count) == PCPU_REF_PTR)) {
142 __this_cpu_inc(*pcpu_count); 174 this_cpu_inc(*pcpu_count);
143 ret = true; 175 ret = true;
144 } 176 }
145 177
@@ -164,7 +196,7 @@ static inline void percpu_ref_put(struct percpu_ref *ref)
164 pcpu_count = ACCESS_ONCE(ref->pcpu_count); 196 pcpu_count = ACCESS_ONCE(ref->pcpu_count);
165 197
166 if (likely(REF_STATUS(pcpu_count) == PCPU_REF_PTR)) 198 if (likely(REF_STATUS(pcpu_count) == PCPU_REF_PTR))
167 __this_cpu_dec(*pcpu_count); 199 this_cpu_dec(*pcpu_count);
168 else if (unlikely(atomic_dec_and_test(&ref->count))) 200 else if (unlikely(atomic_dec_and_test(&ref->count)))
169 ref->release(ref); 201 ref->release(ref);
170 202
diff --git a/include/linux/percpu.h b/include/linux/percpu.h
index e7a0b95ed527..8419053d0f2e 100644
--- a/include/linux/percpu.h
+++ b/include/linux/percpu.h
@@ -29,7 +29,7 @@
29 */ 29 */
30#define get_cpu_var(var) (*({ \ 30#define get_cpu_var(var) (*({ \
31 preempt_disable(); \ 31 preempt_disable(); \
32 &__get_cpu_var(var); })) 32 this_cpu_ptr(&var); }))
33 33
34/* 34/*
35 * The weird & is necessary because sparse considers (void)(var) to be 35 * The weird & is necessary because sparse considers (void)(var) to be
@@ -639,7 +639,7 @@ do { \
639# define raw_cpu_add_return_8(pcp, val) raw_cpu_generic_add_return(pcp, val) 639# define raw_cpu_add_return_8(pcp, val) raw_cpu_generic_add_return(pcp, val)
640# endif 640# endif
641# define raw_cpu_add_return(pcp, val) \ 641# define raw_cpu_add_return(pcp, val) \
642 __pcpu_size_call_return2(raw_add_return_, pcp, val) 642 __pcpu_size_call_return2(raw_cpu_add_return_, pcp, val)
643#endif 643#endif
644 644
645#define raw_cpu_sub_return(pcp, val) raw_cpu_add_return(pcp, -(typeof(pcp))(val)) 645#define raw_cpu_sub_return(pcp, val) raw_cpu_add_return(pcp, -(typeof(pcp))(val))
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 3356abcfff18..707617a8c0f6 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -167,16 +167,27 @@ struct perf_event;
167#define PERF_EVENT_TXN 0x1 167#define PERF_EVENT_TXN 0x1
168 168
169/** 169/**
170 * pmu::capabilities flags
171 */
172#define PERF_PMU_CAP_NO_INTERRUPT 0x01
173
174/**
170 * struct pmu - generic performance monitoring unit 175 * struct pmu - generic performance monitoring unit
171 */ 176 */
172struct pmu { 177struct pmu {
173 struct list_head entry; 178 struct list_head entry;
174 179
180 struct module *module;
175 struct device *dev; 181 struct device *dev;
176 const struct attribute_group **attr_groups; 182 const struct attribute_group **attr_groups;
177 const char *name; 183 const char *name;
178 int type; 184 int type;
179 185
186 /*
187 * various common per-pmu feature flags
188 */
189 int capabilities;
190
180 int * __percpu pmu_disable_count; 191 int * __percpu pmu_disable_count;
181 struct perf_cpu_context * __percpu pmu_cpu_context; 192 struct perf_cpu_context * __percpu pmu_cpu_context;
182 int task_ctx_nr; 193 int task_ctx_nr;
@@ -402,6 +413,8 @@ struct perf_event {
402 413
403 struct ring_buffer *rb; 414 struct ring_buffer *rb;
404 struct list_head rb_entry; 415 struct list_head rb_entry;
416 unsigned long rcu_batches;
417 int rcu_pending;
405 418
406 /* poll related */ 419 /* poll related */
407 wait_queue_head_t waitq; 420 wait_queue_head_t waitq;
@@ -693,7 +706,8 @@ extern struct perf_guest_info_callbacks *perf_guest_cbs;
693extern int perf_register_guest_info_callbacks(struct perf_guest_info_callbacks *callbacks); 706extern int perf_register_guest_info_callbacks(struct perf_guest_info_callbacks *callbacks);
694extern int perf_unregister_guest_info_callbacks(struct perf_guest_info_callbacks *callbacks); 707extern int perf_unregister_guest_info_callbacks(struct perf_guest_info_callbacks *callbacks);
695 708
696extern void perf_event_comm(struct task_struct *tsk); 709extern void perf_event_exec(void);
710extern void perf_event_comm(struct task_struct *tsk, bool exec);
697extern void perf_event_fork(struct task_struct *tsk); 711extern void perf_event_fork(struct task_struct *tsk);
698 712
699/* Callchains */ 713/* Callchains */
@@ -770,7 +784,7 @@ extern void perf_event_enable(struct perf_event *event);
770extern void perf_event_disable(struct perf_event *event); 784extern void perf_event_disable(struct perf_event *event);
771extern int __perf_event_disable(void *info); 785extern int __perf_event_disable(void *info);
772extern void perf_event_task_tick(void); 786extern void perf_event_task_tick(void);
773#else 787#else /* !CONFIG_PERF_EVENTS: */
774static inline void 788static inline void
775perf_event_task_sched_in(struct task_struct *prev, 789perf_event_task_sched_in(struct task_struct *prev,
776 struct task_struct *task) { } 790 struct task_struct *task) { }
@@ -800,7 +814,8 @@ static inline int perf_unregister_guest_info_callbacks
800(struct perf_guest_info_callbacks *callbacks) { return 0; } 814(struct perf_guest_info_callbacks *callbacks) { return 0; }
801 815
802static inline void perf_event_mmap(struct vm_area_struct *vma) { } 816static inline void perf_event_mmap(struct vm_area_struct *vma) { }
803static inline void perf_event_comm(struct task_struct *tsk) { } 817static inline void perf_event_exec(void) { }
818static inline void perf_event_comm(struct task_struct *tsk, bool exec) { }
804static inline void perf_event_fork(struct task_struct *tsk) { } 819static inline void perf_event_fork(struct task_struct *tsk) { }
805static inline void perf_event_init(void) { } 820static inline void perf_event_init(void) { }
806static inline int perf_swevent_get_recursion_context(void) { return -1; } 821static inline int perf_swevent_get_recursion_context(void) { return -1; }
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 4d0221fd0688..68041446c450 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -198,6 +198,13 @@ static inline struct mii_bus *mdiobus_alloc(void)
198int mdiobus_register(struct mii_bus *bus); 198int mdiobus_register(struct mii_bus *bus);
199void mdiobus_unregister(struct mii_bus *bus); 199void mdiobus_unregister(struct mii_bus *bus);
200void mdiobus_free(struct mii_bus *bus); 200void mdiobus_free(struct mii_bus *bus);
201struct mii_bus *devm_mdiobus_alloc_size(struct device *dev, int sizeof_priv);
202static inline struct mii_bus *devm_mdiobus_alloc(struct device *dev)
203{
204 return devm_mdiobus_alloc_size(dev, 0);
205}
206
207void devm_mdiobus_free(struct device *dev, struct mii_bus *bus);
201struct phy_device *mdiobus_scan(struct mii_bus *bus, int addr); 208struct phy_device *mdiobus_scan(struct mii_bus *bus, int addr);
202int mdiobus_read(struct mii_bus *bus, int addr, u32 regnum); 209int mdiobus_read(struct mii_bus *bus, int addr, u32 regnum);
203int mdiobus_write(struct mii_bus *bus, int addr, u32 regnum, u16 val); 210int mdiobus_write(struct mii_bus *bus, int addr, u32 regnum, u16 val);
@@ -529,6 +536,15 @@ struct phy_driver {
529 /* See set_wol, but for checking whether Wake on LAN is enabled. */ 536 /* See set_wol, but for checking whether Wake on LAN is enabled. */
530 void (*get_wol)(struct phy_device *dev, struct ethtool_wolinfo *wol); 537 void (*get_wol)(struct phy_device *dev, struct ethtool_wolinfo *wol);
531 538
539 /*
540 * Called to inform a PHY device driver when the core is about to
541 * change the link state. This callback is supposed to be used as
542 * fixup hook for drivers that need to take action when the link
543 * state changes. Drivers are by no means allowed to mess with the
544 * PHY device structure in their implementations.
545 */
546 void (*link_change_notify)(struct phy_device *dev);
547
532 struct device_driver driver; 548 struct device_driver driver;
533}; 549};
534#define to_phy_driver(d) container_of(d, struct phy_driver, driver) 550#define to_phy_driver(d) container_of(d, struct phy_driver, driver)
@@ -666,6 +682,7 @@ static inline int phy_read_status(struct phy_device *phydev)
666 return phydev->drv->read_status(phydev); 682 return phydev->drv->read_status(phydev);
667} 683}
668 684
685int genphy_config_init(struct phy_device *phydev);
669int genphy_setup_forced(struct phy_device *phydev); 686int genphy_setup_forced(struct phy_device *phydev);
670int genphy_restart_aneg(struct phy_device *phydev); 687int genphy_restart_aneg(struct phy_device *phydev);
671int genphy_config_aneg(struct phy_device *phydev); 688int genphy_config_aneg(struct phy_device *phydev);
diff --git a/include/linux/phy_fixed.h b/include/linux/phy_fixed.h
index 509d8f5f984e..ae612acebb53 100644
--- a/include/linux/phy_fixed.h
+++ b/include/linux/phy_fixed.h
@@ -9,15 +9,31 @@ struct fixed_phy_status {
9 int asym_pause; 9 int asym_pause;
10}; 10};
11 11
12struct device_node;
13
12#ifdef CONFIG_FIXED_PHY 14#ifdef CONFIG_FIXED_PHY
13extern int fixed_phy_add(unsigned int irq, int phy_id, 15extern int fixed_phy_add(unsigned int irq, int phy_id,
14 struct fixed_phy_status *status); 16 struct fixed_phy_status *status);
17extern int fixed_phy_register(unsigned int irq,
18 struct fixed_phy_status *status,
19 struct device_node *np);
20extern void fixed_phy_del(int phy_addr);
15#else 21#else
16static inline int fixed_phy_add(unsigned int irq, int phy_id, 22static inline int fixed_phy_add(unsigned int irq, int phy_id,
17 struct fixed_phy_status *status) 23 struct fixed_phy_status *status)
18{ 24{
19 return -ENODEV; 25 return -ENODEV;
20} 26}
27static inline int fixed_phy_register(unsigned int irq,
28 struct fixed_phy_status *status,
29 struct device_node *np)
30{
31 return -ENODEV;
32}
33static inline int fixed_phy_del(int phy_addr)
34{
35 return -ENODEV;
36}
21#endif /* CONFIG_FIXED_PHY */ 37#endif /* CONFIG_FIXED_PHY */
22 38
23/* 39/*
diff --git a/include/linux/platform_data/adau17x1.h b/include/linux/platform_data/adau17x1.h
new file mode 100644
index 000000000000..a81766cae230
--- /dev/null
+++ b/include/linux/platform_data/adau17x1.h
@@ -0,0 +1,109 @@
1/*
2 * Driver for ADAU1761/ADAU1461/ADAU1761/ADAU1961/ADAU1781/ADAU1781 codecs
3 *
4 * Copyright 2011-2014 Analog Devices Inc.
5 * Author: Lars-Peter Clausen <lars@metafoo.de>
6 *
7 * Licensed under the GPL-2 or later.
8 */
9
10#ifndef __LINUX_PLATFORM_DATA_ADAU17X1_H__
11#define __LINUX_PLATFORM_DATA_ADAU17X1_H__
12
13/**
14 * enum adau17x1_micbias_voltage - Microphone bias voltage
15 * @ADAU17X1_MICBIAS_0_90_AVDD: 0.9 * AVDD
16 * @ADAU17X1_MICBIAS_0_65_AVDD: 0.65 * AVDD
17 */
18enum adau17x1_micbias_voltage {
19 ADAU17X1_MICBIAS_0_90_AVDD = 0,
20 ADAU17X1_MICBIAS_0_65_AVDD = 1,
21};
22
23/**
24 * enum adau1761_digmic_jackdet_pin_mode - Configuration of the JACKDET/MICIN pin
25 * @ADAU1761_DIGMIC_JACKDET_PIN_MODE_NONE: Disable the pin
26 * @ADAU1761_DIGMIC_JACKDET_PIN_MODE_DIGMIC: Configure the pin for usage as
27 * digital microphone input.
28 * @ADAU1761_DIGMIC_JACKDET_PIN_MODE_JACKDETECT: Configure the pin for jack
29 * insertion detection.
30 */
31enum adau1761_digmic_jackdet_pin_mode {
32 ADAU1761_DIGMIC_JACKDET_PIN_MODE_NONE,
33 ADAU1761_DIGMIC_JACKDET_PIN_MODE_DIGMIC,
34 ADAU1761_DIGMIC_JACKDET_PIN_MODE_JACKDETECT,
35};
36
37/**
38 * adau1761_jackdetect_debounce_time - Jack insertion detection debounce time
39 * @ADAU1761_JACKDETECT_DEBOUNCE_5MS: 5 milliseconds
40 * @ADAU1761_JACKDETECT_DEBOUNCE_10MS: 10 milliseconds
41 * @ADAU1761_JACKDETECT_DEBOUNCE_20MS: 20 milliseconds
42 * @ADAU1761_JACKDETECT_DEBOUNCE_40MS: 40 milliseconds
43 */
44enum adau1761_jackdetect_debounce_time {
45 ADAU1761_JACKDETECT_DEBOUNCE_5MS = 0,
46 ADAU1761_JACKDETECT_DEBOUNCE_10MS = 1,
47 ADAU1761_JACKDETECT_DEBOUNCE_20MS = 2,
48 ADAU1761_JACKDETECT_DEBOUNCE_40MS = 3,
49};
50
51/**
52 * enum adau1761_output_mode - Output mode configuration
53 * @ADAU1761_OUTPUT_MODE_HEADPHONE: Headphone output
54 * @ADAU1761_OUTPUT_MODE_HEADPHONE_CAPLESS: Capless headphone output
55 * @ADAU1761_OUTPUT_MODE_LINE: Line output
56 */
57enum adau1761_output_mode {
58 ADAU1761_OUTPUT_MODE_HEADPHONE,
59 ADAU1761_OUTPUT_MODE_HEADPHONE_CAPLESS,
60 ADAU1761_OUTPUT_MODE_LINE,
61};
62
63/**
64 * struct adau1761_platform_data - ADAU1761 Codec driver platform data
65 * @input_differential: If true the input pins will be configured in
66 * differential mode.
67 * @lineout_mode: Output mode for the LOUT/ROUT pins
68 * @headphone_mode: Output mode for the LHP/RHP pins
69 * @digmic_jackdetect_pin_mode: JACKDET/MICIN pin configuration
70 * @jackdetect_debounce_time: Jack insertion detection debounce time.
71 * Note: This value will only be used, if the JACKDET/MICIN pin is configured
72 * for jack insertion detection.
73 * @jackdetect_active_low: If true the jack insertion detection is active low.
74 * Othwise it will be active high.
75 * @micbias_voltage: Microphone voltage bias
76 */
77struct adau1761_platform_data {
78 bool input_differential;
79 enum adau1761_output_mode lineout_mode;
80 enum adau1761_output_mode headphone_mode;
81
82 enum adau1761_digmic_jackdet_pin_mode digmic_jackdetect_pin_mode;
83
84 enum adau1761_jackdetect_debounce_time jackdetect_debounce_time;
85 bool jackdetect_active_low;
86
87 enum adau17x1_micbias_voltage micbias_voltage;
88};
89
90/**
91 * struct adau1781_platform_data - ADAU1781 Codec driver platform data
92 * @left_input_differential: If true configure the left input as
93 * differential input.
94 * @right_input_differential: If true configure the right input as differntial
95 * input.
96 * @use_dmic: If true configure the MIC pins as digital microphone pins instead
97 * of analog microphone pins.
98 * @micbias_voltage: Microphone voltage bias
99 */
100struct adau1781_platform_data {
101 bool left_input_differential;
102 bool right_input_differential;
103
104 bool use_dmic;
105
106 enum adau17x1_micbias_voltage micbias_voltage;
107};
108
109#endif
diff --git a/include/linux/platform_data/at91_adc.h b/include/linux/platform_data/at91_adc.h
index b3ca1e94e0c8..7819fc787731 100644
--- a/include/linux/platform_data/at91_adc.h
+++ b/include/linux/platform_data/at91_adc.h
@@ -7,23 +7,10 @@
7#ifndef _AT91_ADC_H_ 7#ifndef _AT91_ADC_H_
8#define _AT91_ADC_H_ 8#define _AT91_ADC_H_
9 9
10/** 10enum atmel_adc_ts_type {
11 * struct at91_adc_reg_desc - Various informations relative to registers 11 ATMEL_ADC_TOUCHSCREEN_NONE = 0,
12 * @channel_base: Base offset for the channel data registers 12 ATMEL_ADC_TOUCHSCREEN_4WIRE = 4,
13 * @drdy_mask: Mask of the DRDY field in the relevant registers 13 ATMEL_ADC_TOUCHSCREEN_5WIRE = 5,
14 (Interruptions registers mostly)
15 * @status_register: Offset of the Interrupt Status Register
16 * @trigger_register: Offset of the Trigger setup register
17 * @mr_prescal_mask: Mask of the PRESCAL field in the adc MR register
18 * @mr_startup_mask: Mask of the STARTUP field in the adc MR register
19 */
20struct at91_adc_reg_desc {
21 u8 channel_base;
22 u32 drdy_mask;
23 u8 status_register;
24 u8 trigger_register;
25 u32 mr_prescal_mask;
26 u32 mr_startup_mask;
27}; 14};
28 15
29/** 16/**
@@ -42,23 +29,21 @@ struct at91_adc_trigger {
42/** 29/**
43 * struct at91_adc_data - platform data for ADC driver 30 * struct at91_adc_data - platform data for ADC driver
44 * @channels_used: channels in use on the board as a bitmask 31 * @channels_used: channels in use on the board as a bitmask
45 * @num_channels: global number of channels available on the board
46 * @registers: Registers definition on the board
47 * @startup_time: startup time of the ADC in microseconds 32 * @startup_time: startup time of the ADC in microseconds
48 * @trigger_list: Triggers available in the ADC 33 * @trigger_list: Triggers available in the ADC
49 * @trigger_number: Number of triggers available in the ADC 34 * @trigger_number: Number of triggers available in the ADC
50 * @use_external_triggers: does the board has external triggers availables 35 * @use_external_triggers: does the board has external triggers availables
51 * @vref: Reference voltage for the ADC in millivolts 36 * @vref: Reference voltage for the ADC in millivolts
37 * @touchscreen_type: If a touchscreen is connected, its type (4 or 5 wires)
52 */ 38 */
53struct at91_adc_data { 39struct at91_adc_data {
54 unsigned long channels_used; 40 unsigned long channels_used;
55 u8 num_channels;
56 struct at91_adc_reg_desc *registers;
57 u8 startup_time; 41 u8 startup_time;
58 struct at91_adc_trigger *trigger_list; 42 struct at91_adc_trigger *trigger_list;
59 u8 trigger_number; 43 u8 trigger_number;
60 bool use_external_triggers; 44 bool use_external_triggers;
61 u16 vref; 45 u16 vref;
46 enum atmel_adc_ts_type touchscreen_type;
62}; 47};
63 48
64extern void __init at91_add_device_adc(struct at91_adc_data *data); 49extern void __init at91_add_device_adc(struct at91_adc_data *data);
diff --git a/include/linux/platform_data/atmel.h b/include/linux/platform_data/atmel.h
index e26b0c14edea..4b452c6a2f7b 100644
--- a/include/linux/platform_data/atmel.h
+++ b/include/linux/platform_data/atmel.h
@@ -84,14 +84,6 @@ struct atmel_uart_data {
84 short use_dma_rx; /* use receive DMA? */ 84 short use_dma_rx; /* use receive DMA? */
85 void __iomem *regs; /* virt. base address, if any */ 85 void __iomem *regs; /* virt. base address, if any */
86 struct serial_rs485 rs485; /* rs485 settings */ 86 struct serial_rs485 rs485; /* rs485 settings */
87 int rts_gpio; /* optional RTS GPIO */
88};
89
90 /* Touchscreen Controller */
91struct at91_tsadcc_data {
92 unsigned int adc_clock;
93 u8 pendet_debounce;
94 u8 ts_sample_hold_time;
95}; 87};
96 88
97/* CAN */ 89/* CAN */
diff --git a/include/linux/platform_data/edma.h b/include/linux/platform_data/edma.h
index f50821cb64be..eb8d5627d080 100644
--- a/include/linux/platform_data/edma.h
+++ b/include/linux/platform_data/edma.h
@@ -43,15 +43,15 @@
43 43
44/* PaRAM slots are laid out like this */ 44/* PaRAM slots are laid out like this */
45struct edmacc_param { 45struct edmacc_param {
46 unsigned int opt; 46 u32 opt;
47 unsigned int src; 47 u32 src;
48 unsigned int a_b_cnt; 48 u32 a_b_cnt;
49 unsigned int dst; 49 u32 dst;
50 unsigned int src_dst_bidx; 50 u32 src_dst_bidx;
51 unsigned int link_bcntrld; 51 u32 link_bcntrld;
52 unsigned int src_dst_cidx; 52 u32 src_dst_cidx;
53 unsigned int ccnt; 53 u32 ccnt;
54}; 54} __packed;
55 55
56/* fields in edmacc_param.opt */ 56/* fields in edmacc_param.opt */
57#define SAM BIT(0) 57#define SAM BIT(0)
@@ -130,7 +130,7 @@ void edma_set_src(unsigned slot, dma_addr_t src_port,
130 enum address_mode mode, enum fifo_width); 130 enum address_mode mode, enum fifo_width);
131void edma_set_dest(unsigned slot, dma_addr_t dest_port, 131void edma_set_dest(unsigned slot, dma_addr_t dest_port,
132 enum address_mode mode, enum fifo_width); 132 enum address_mode mode, enum fifo_width);
133void edma_get_position(unsigned slot, dma_addr_t *src, dma_addr_t *dst); 133dma_addr_t edma_get_position(unsigned slot, bool dst);
134void edma_set_src_index(unsigned slot, s16 src_bidx, s16 src_cidx); 134void edma_set_src_index(unsigned slot, s16 src_bidx, s16 src_cidx);
135void edma_set_dest_index(unsigned slot, s16 dest_bidx, s16 dest_cidx); 135void edma_set_dest_index(unsigned slot, s16 dest_bidx, s16 dest_cidx);
136void edma_set_transfer_params(unsigned slot, u16 acnt, u16 bcnt, u16 ccnt, 136void edma_set_transfer_params(unsigned slot, u16 acnt, u16 bcnt, u16 ccnt,
@@ -158,13 +158,6 @@ struct edma_rsv_info {
158 158
159/* platform_data for EDMA driver */ 159/* platform_data for EDMA driver */
160struct edma_soc_info { 160struct edma_soc_info {
161
162 /* how many dma resources of each type */
163 unsigned n_channel;
164 unsigned n_region;
165 unsigned n_slot;
166 unsigned n_tc;
167 unsigned n_cc;
168 /* 161 /*
169 * Default queue is expected to be a low-priority queue. 162 * Default queue is expected to be a low-priority queue.
170 * This way, long transfers on the default queue started 163 * This way, long transfers on the default queue started
@@ -175,7 +168,6 @@ struct edma_soc_info {
175 /* Resource reservation for other cores */ 168 /* Resource reservation for other cores */
176 struct edma_rsv_info *rsv; 169 struct edma_rsv_info *rsv;
177 170
178 s8 (*queue_tc_mapping)[2];
179 s8 (*queue_priority_mapping)[2]; 171 s8 (*queue_priority_mapping)[2];
180 const s16 (*xbar_chans)[2]; 172 const s16 (*xbar_chans)[2];
181}; 173};
diff --git a/include/linux/platform_data/elm.h b/include/linux/platform_data/elm.h
index 4edb40676b3f..780d1e97f620 100644
--- a/include/linux/platform_data/elm.h
+++ b/include/linux/platform_data/elm.h
@@ -21,6 +21,7 @@
21enum bch_ecc { 21enum bch_ecc {
22 BCH4_ECC = 0, 22 BCH4_ECC = 0,
23 BCH8_ECC, 23 BCH8_ECC,
24 BCH16_ECC,
24}; 25};
25 26
26/* ELM support 8 error syndrome process */ 27/* ELM support 8 error syndrome process */
@@ -38,7 +39,7 @@ struct elm_errorvec {
38 bool error_reported; 39 bool error_reported;
39 bool error_uncorrectable; 40 bool error_uncorrectable;
40 int error_count; 41 int error_count;
41 int error_loc[ERROR_VECTOR_MAX]; 42 int error_loc[16];
42}; 43};
43 44
44void elm_decode_bch_error_page(struct device *dev, u8 *ecc_calc, 45void elm_decode_bch_error_page(struct device *dev, u8 *ecc_calc,
diff --git a/include/linux/platform_data/intel-mid_wdt.h b/include/linux/platform_data/intel-mid_wdt.h
new file mode 100644
index 000000000000..b98253466ace
--- /dev/null
+++ b/include/linux/platform_data/intel-mid_wdt.h
@@ -0,0 +1,22 @@
1/*
2 * intel-mid_wdt: generic Intel MID SCU watchdog driver
3 *
4 * Copyright (C) 2014 Intel Corporation. All rights reserved.
5 * Contact: David Cohen <david.a.cohen@linux.intel.com>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of version 2 of the GNU General
9 * Public License as published by the Free Software Foundation.
10 */
11
12#ifndef __INTEL_MID_WDT_H__
13#define __INTEL_MID_WDT_H__
14
15#include <linux/platform_device.h>
16
17struct intel_mid_wdt_pdata {
18 int irq;
19 int (*probe)(struct platform_device *pdev);
20};
21
22#endif /*__INTEL_MID_WDT_H__*/
diff --git a/include/linux/platform_data/ipmmu-vmsa.h b/include/linux/platform_data/ipmmu-vmsa.h
new file mode 100644
index 000000000000..5275b3ac6d37
--- /dev/null
+++ b/include/linux/platform_data/ipmmu-vmsa.h
@@ -0,0 +1,24 @@
1/*
2 * IPMMU VMSA Platform Data
3 *
4 * Copyright (C) 2014 Renesas Electronics Corporation
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 */
10
11#ifndef __IPMMU_VMSA_H__
12#define __IPMMU_VMSA_H__
13
14struct ipmmu_vmsa_master {
15 const char *name;
16 unsigned int utlb;
17};
18
19struct ipmmu_vmsa_platform_data {
20 const struct ipmmu_vmsa_master *masters;
21 unsigned int num_masters;
22};
23
24#endif /* __IPMMU_VMSA_H__ */
diff --git a/include/linux/platform_data/leds-pca9685.h b/include/linux/platform_data/leds-pca9685.h
deleted file mode 100644
index 778e9e4249cc..000000000000
--- a/include/linux/platform_data/leds-pca9685.h
+++ /dev/null
@@ -1,35 +0,0 @@
1/*
2 * Copyright 2013 Maximilian Güntner <maximilian.guentner@gmail.com>
3 *
4 * This file is subject to the terms and conditions of version 2 of
5 * the GNU General Public License. See the file COPYING in the main
6 * directory of this archive for more details.
7 *
8 * Based on leds-pca963x.h by Peter Meerwald <p.meerwald@bct-electronic.com>
9 *
10 * LED driver for the NXP PCA9685 PWM chip
11 *
12 */
13
14#ifndef __LINUX_PCA9685_H
15#define __LINUX_PCA9685_H
16
17#include <linux/leds.h>
18
19enum pca9685_outdrv {
20 PCA9685_OPEN_DRAIN,
21 PCA9685_TOTEM_POLE,
22};
23
24enum pca9685_inverted {
25 PCA9685_NOT_INVERTED,
26 PCA9685_INVERTED,
27};
28
29struct pca9685_platform_data {
30 struct led_platform_data leds;
31 enum pca9685_outdrv outdrv;
32 enum pca9685_inverted inverted;
33};
34
35#endif /* __LINUX_PCA9685_H */
diff --git a/include/linux/platform_data/max3421-hcd.h b/include/linux/platform_data/max3421-hcd.h
new file mode 100644
index 000000000000..0303d1970084
--- /dev/null
+++ b/include/linux/platform_data/max3421-hcd.h
@@ -0,0 +1,24 @@
1/*
2 * Copyright (c) 2014 eGauge Systems LLC
3 * Contributed by David Mosberger-Tang <davidm@egauge.net>
4 *
5 * Platform-data structure for MAX3421 USB HCD driver.
6 *
7 */
8#ifndef MAX3421_HCD_PLAT_H_INCLUDED
9#define MAX3421_HCD_PLAT_H_INCLUDED
10
11/*
12 * This structure defines the mapping of certain auxiliary functions to the
13 * MAX3421E GPIO pins. The chip has eight GP inputs and eight GP outputs.
14 * A value of 0 indicates that the pin is not used/wired to anything.
15 *
16 * At this point, the only control the max3421-hcd driver cares about is
17 * to control Vbus (5V to the peripheral).
18 */
19struct max3421_hcd_platform_data {
20 u8 vbus_gpout; /* pin controlling Vbus */
21 u8 vbus_active_level; /* level that turns on power */
22};
23
24#endif /* MAX3421_HCD_PLAT_H_INCLUDED */
diff --git a/include/linux/platform_data/mipi-csis.h b/include/linux/platform_data/mipi-csis.h
deleted file mode 100644
index c2fd9024717c..000000000000
--- a/include/linux/platform_data/mipi-csis.h
+++ /dev/null
@@ -1,28 +0,0 @@
1/*
2 * Copyright (C) 2010 - 2012 Samsung Electronics Co., Ltd.
3 *
4 * Samsung S5P/Exynos SoC series MIPI CSIS device support
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 __PLAT_SAMSUNG_MIPI_CSIS_H_
12#define __PLAT_SAMSUNG_MIPI_CSIS_H_ __FILE__
13
14/**
15 * struct s5p_platform_mipi_csis - platform data for S5P MIPI-CSIS driver
16 * @clk_rate: bus clock frequency
17 * @wclk_source: CSI wrapper clock selection: 0 - bus clock, 1 - ext. SCLK_CAM
18 * @lanes: number of data lanes used
19 * @hs_settle: HS-RX settle time
20 */
21struct s5p_platform_mipi_csis {
22 unsigned long clk_rate;
23 u8 wclk_source;
24 u8 lanes;
25 u8 hs_settle;
26};
27
28#endif /* __PLAT_SAMSUNG_MIPI_CSIS_H_ */
diff --git a/include/linux/platform_data/mtd-nand-omap2.h b/include/linux/platform_data/mtd-nand-omap2.h
index 3e9dd6676b97..660c029d694f 100644
--- a/include/linux/platform_data/mtd-nand-omap2.h
+++ b/include/linux/platform_data/mtd-nand-omap2.h
@@ -31,6 +31,8 @@ enum omap_ecc {
31 OMAP_ECC_BCH8_CODE_HW_DETECTION_SW, 31 OMAP_ECC_BCH8_CODE_HW_DETECTION_SW,
32 /* 8-bit ECC calculation by GPMC, Error detection by ELM */ 32 /* 8-bit ECC calculation by GPMC, Error detection by ELM */
33 OMAP_ECC_BCH8_CODE_HW, 33 OMAP_ECC_BCH8_CODE_HW,
34 /* 16-bit ECC calculation by GPMC, Error detection by ELM */
35 OMAP_ECC_BCH16_CODE_HW,
34}; 36};
35 37
36struct gpmc_nand_regs { 38struct gpmc_nand_regs {
@@ -50,6 +52,9 @@ struct gpmc_nand_regs {
50 void __iomem *gpmc_bch_result1[GPMC_BCH_NUM_REMAINDER]; 52 void __iomem *gpmc_bch_result1[GPMC_BCH_NUM_REMAINDER];
51 void __iomem *gpmc_bch_result2[GPMC_BCH_NUM_REMAINDER]; 53 void __iomem *gpmc_bch_result2[GPMC_BCH_NUM_REMAINDER];
52 void __iomem *gpmc_bch_result3[GPMC_BCH_NUM_REMAINDER]; 54 void __iomem *gpmc_bch_result3[GPMC_BCH_NUM_REMAINDER];
55 void __iomem *gpmc_bch_result4[GPMC_BCH_NUM_REMAINDER];
56 void __iomem *gpmc_bch_result5[GPMC_BCH_NUM_REMAINDER];
57 void __iomem *gpmc_bch_result6[GPMC_BCH_NUM_REMAINDER];
53}; 58};
54 59
55struct omap_nand_platform_data { 60struct omap_nand_platform_data {
diff --git a/include/linux/platform_data/mtd-nand-pxa3xx.h b/include/linux/platform_data/mtd-nand-pxa3xx.h
index a94147124929..ac4ea2e641c7 100644
--- a/include/linux/platform_data/mtd-nand-pxa3xx.h
+++ b/include/linux/platform_data/mtd-nand-pxa3xx.h
@@ -58,6 +58,9 @@ struct pxa3xx_nand_platform_data {
58 /* use an flash-based bad block table */ 58 /* use an flash-based bad block table */
59 bool flash_bbt; 59 bool flash_bbt;
60 60
61 /* requested ECC strength and ECC step size */
62 int ecc_strength, ecc_step_size;
63
61 const struct mtd_partition *parts[NUM_CHIP_SELECT]; 64 const struct mtd_partition *parts[NUM_CHIP_SELECT];
62 unsigned int nr_parts[NUM_CHIP_SELECT]; 65 unsigned int nr_parts[NUM_CHIP_SELECT];
63 66
diff --git a/include/linux/platform_data/omap4-keypad.h b/include/linux/platform_data/omap4-keypad.h
deleted file mode 100644
index 4eef5fb05a17..000000000000
--- a/include/linux/platform_data/omap4-keypad.h
+++ /dev/null
@@ -1,13 +0,0 @@
1#ifndef __LINUX_INPUT_OMAP4_KEYPAD_H
2#define __LINUX_INPUT_OMAP4_KEYPAD_H
3
4#include <linux/input/matrix_keypad.h>
5
6struct omap4_keypad_platform_data {
7 const struct matrix_keymap_data *keymap_data;
8
9 u8 rows;
10 u8 cols;
11};
12
13#endif /* __LINUX_INPUT_OMAP4_KEYPAD_H */
diff --git a/include/linux/platform_data/pwm-renesas-tpu.h b/include/linux/platform_data/pwm-renesas-tpu.h
deleted file mode 100644
index a7220b10ddab..000000000000
--- a/include/linux/platform_data/pwm-renesas-tpu.h
+++ /dev/null
@@ -1,16 +0,0 @@
1#ifndef __PWM_RENESAS_TPU_H__
2#define __PWM_RENESAS_TPU_H__
3
4#include <linux/pwm.h>
5
6#define TPU_CHANNEL_MAX 4
7
8struct tpu_pwm_channel_data {
9 enum pwm_polarity polarity;
10};
11
12struct tpu_pwm_platform_data {
13 struct tpu_pwm_channel_data channels[TPU_CHANNEL_MAX];
14};
15
16#endif /* __PWM_RENESAS_TPU_H__ */
diff --git a/include/linux/platform_data/shtc1.h b/include/linux/platform_data/shtc1.h
new file mode 100644
index 000000000000..7b8c353f7dc8
--- /dev/null
+++ b/include/linux/platform_data/shtc1.h
@@ -0,0 +1,23 @@
1/*
2 * Copyright (C) 2014 Sensirion AG, Switzerland
3 * Author: Johannes Winkelmann <johannes.winkelmann@sensirion.com>
4 *
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 */
15
16#ifndef __SHTC1_H_
17#define __SHTC1_H_
18
19struct shtc1_platform_data {
20 bool blocking_io;
21 bool high_precision;
22};
23#endif /* __SHTC1_H_ */
diff --git a/include/linux/platform_data/st21nfca.h b/include/linux/platform_data/st21nfca.h
new file mode 100644
index 000000000000..1730312398ff
--- /dev/null
+++ b/include/linux/platform_data/st21nfca.h
@@ -0,0 +1,32 @@
1/*
2 * Driver include for the ST21NFCA NFC chip.
3 *
4 * Copyright (C) 2014 STMicroelectronics SAS. 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 that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, see <http://www.gnu.org/licenses/>.
17 */
18
19#ifndef _ST21NFCA_HCI_H_
20#define _ST21NFCA_HCI_H_
21
22#include <linux/i2c.h>
23
24#define ST21NFCA_HCI_DRIVER_NAME "st21nfca_hci"
25
26struct st21nfca_nfc_platform_data {
27 unsigned int gpio_irq;
28 unsigned int gpio_ena;
29 unsigned int irq_polarity;
30};
31
32#endif /* _ST21NFCA_HCI_H_ */
diff --git a/include/linux/platform_data/syscon.h b/include/linux/platform_data/syscon.h
new file mode 100644
index 000000000000..2354c6fa3726
--- /dev/null
+++ b/include/linux/platform_data/syscon.h
@@ -0,0 +1,8 @@
1#ifndef PLATFORM_DATA_SYSCON_H
2#define PLATFORM_DATA_SYSCON_H
3
4struct syscon_platform_data {
5 const char *label;
6};
7
8#endif
diff --git a/include/linux/plist.h b/include/linux/plist.h
index aa0fb390bd29..8b6c970cff6c 100644
--- a/include/linux/plist.h
+++ b/include/linux/plist.h
@@ -98,6 +98,13 @@ struct plist_node {
98} 98}
99 99
100/** 100/**
101 * PLIST_HEAD - declare and init plist_head
102 * @head: name for struct plist_head variable
103 */
104#define PLIST_HEAD(head) \
105 struct plist_head head = PLIST_HEAD_INIT(head)
106
107/**
101 * PLIST_NODE_INIT - static struct plist_node initializer 108 * PLIST_NODE_INIT - static struct plist_node initializer
102 * @node: struct plist_node variable name 109 * @node: struct plist_node variable name
103 * @__prio: initial node priority 110 * @__prio: initial node priority
@@ -134,6 +141,8 @@ static inline void plist_node_init(struct plist_node *node, int prio)
134extern void plist_add(struct plist_node *node, struct plist_head *head); 141extern void plist_add(struct plist_node *node, struct plist_head *head);
135extern void plist_del(struct plist_node *node, struct plist_head *head); 142extern void plist_del(struct plist_node *node, struct plist_head *head);
136 143
144extern void plist_requeue(struct plist_node *node, struct plist_head *head);
145
137/** 146/**
138 * plist_for_each - iterate over the plist 147 * plist_for_each - iterate over the plist
139 * @pos: the type * to use as a loop counter 148 * @pos: the type * to use as a loop counter
@@ -143,6 +152,16 @@ extern void plist_del(struct plist_node *node, struct plist_head *head);
143 list_for_each_entry(pos, &(head)->node_list, node_list) 152 list_for_each_entry(pos, &(head)->node_list, node_list)
144 153
145/** 154/**
155 * plist_for_each_continue - continue iteration over the plist
156 * @pos: the type * to use as a loop cursor
157 * @head: the head for your list
158 *
159 * Continue to iterate over plist, continuing after the current position.
160 */
161#define plist_for_each_continue(pos, head) \
162 list_for_each_entry_continue(pos, &(head)->node_list, node_list)
163
164/**
146 * plist_for_each_safe - iterate safely over a plist of given type 165 * plist_for_each_safe - iterate safely over a plist of given type
147 * @pos: the type * to use as a loop counter 166 * @pos: the type * to use as a loop counter
148 * @n: another type * to use as temporary storage 167 * @n: another type * to use as temporary storage
@@ -163,6 +182,18 @@ extern void plist_del(struct plist_node *node, struct plist_head *head);
163 list_for_each_entry(pos, &(head)->node_list, mem.node_list) 182 list_for_each_entry(pos, &(head)->node_list, mem.node_list)
164 183
165/** 184/**
185 * plist_for_each_entry_continue - continue iteration over list of given type
186 * @pos: the type * to use as a loop cursor
187 * @head: the head for your list
188 * @m: the name of the list_struct within the struct
189 *
190 * Continue to iterate over list of given type, continuing after
191 * the current position.
192 */
193#define plist_for_each_entry_continue(pos, head, m) \
194 list_for_each_entry_continue(pos, &(head)->node_list, m.node_list)
195
196/**
166 * plist_for_each_entry_safe - iterate safely over list of given type 197 * plist_for_each_entry_safe - iterate safely over list of given type
167 * @pos: the type * to use as a loop counter 198 * @pos: the type * to use as a loop counter
168 * @n: another type * to use as temporary storage 199 * @n: another type * to use as temporary storage
@@ -229,6 +260,20 @@ static inline int plist_node_empty(const struct plist_node *node)
229#endif 260#endif
230 261
231/** 262/**
263 * plist_next - get the next entry in list
264 * @pos: the type * to cursor
265 */
266#define plist_next(pos) \
267 list_next_entry(pos, node_list)
268
269/**
270 * plist_prev - get the prev entry in list
271 * @pos: the type * to cursor
272 */
273#define plist_prev(pos) \
274 list_prev_entry(pos, node_list)
275
276/**
232 * plist_first - return the first node (and thus, highest priority) 277 * plist_first - return the first node (and thus, highest priority)
233 * @head: the &struct plist_head pointer 278 * @head: the &struct plist_head pointer
234 * 279 *
diff --git a/include/linux/pm.h b/include/linux/pm.h
index d915d0345fa1..72c0fe098a27 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -93,13 +93,23 @@ typedef struct pm_message {
93 * been registered) to recover from the race condition. 93 * been registered) to recover from the race condition.
94 * This method is executed for all kinds of suspend transitions and is 94 * This method is executed for all kinds of suspend transitions and is
95 * followed by one of the suspend callbacks: @suspend(), @freeze(), or 95 * followed by one of the suspend callbacks: @suspend(), @freeze(), or
96 * @poweroff(). The PM core executes subsystem-level @prepare() for all 96 * @poweroff(). If the transition is a suspend to memory or standby (that
97 * devices before starting to invoke suspend callbacks for any of them, so 97 * is, not related to hibernation), the return value of @prepare() may be
98 * generally devices may be assumed to be functional or to respond to 98 * used to indicate to the PM core to leave the device in runtime suspend
99 * runtime resume requests while @prepare() is being executed. However, 99 * if applicable. Namely, if @prepare() returns a positive number, the PM
100 * device drivers may NOT assume anything about the availability of user 100 * core will understand that as a declaration that the device appears to be
101 * space at that time and it is NOT valid to request firmware from within 101 * runtime-suspended and it may be left in that state during the entire
102 * @prepare() (it's too late to do that). It also is NOT valid to allocate 102 * transition and during the subsequent resume if all of its descendants
103 * are left in runtime suspend too. If that happens, @complete() will be
104 * executed directly after @prepare() and it must ensure the proper
105 * functioning of the device after the system resume.
106 * The PM core executes subsystem-level @prepare() for all devices before
107 * starting to invoke suspend callbacks for any of them, so generally
108 * devices may be assumed to be functional or to respond to runtime resume
109 * requests while @prepare() is being executed. However, device drivers
110 * may NOT assume anything about the availability of user space at that
111 * time and it is NOT valid to request firmware from within @prepare()
112 * (it's too late to do that). It also is NOT valid to allocate
103 * substantial amounts of memory from @prepare() in the GFP_KERNEL mode. 113 * substantial amounts of memory from @prepare() in the GFP_KERNEL mode.
104 * [To work around these limitations, drivers may register suspend and 114 * [To work around these limitations, drivers may register suspend and
105 * hibernation notifiers to be executed before the freezing of tasks.] 115 * hibernation notifiers to be executed before the freezing of tasks.]
@@ -112,7 +122,16 @@ typedef struct pm_message {
112 * of the other devices that the PM core has unsuccessfully attempted to 122 * of the other devices that the PM core has unsuccessfully attempted to
113 * suspend earlier). 123 * suspend earlier).
114 * The PM core executes subsystem-level @complete() after it has executed 124 * The PM core executes subsystem-level @complete() after it has executed
115 * the appropriate resume callbacks for all devices. 125 * the appropriate resume callbacks for all devices. If the corresponding
126 * @prepare() at the beginning of the suspend transition returned a
127 * positive number and the device was left in runtime suspend (without
128 * executing any suspend and resume callbacks for it), @complete() will be
129 * the only callback executed for the device during resume. In that case,
130 * @complete() must be prepared to do whatever is necessary to ensure the
131 * proper functioning of the device after the system resume. To this end,
132 * @complete() can check the power.direct_complete flag of the device to
133 * learn whether (unset) or not (set) the previous suspend and resume
134 * callbacks have been executed for it.
116 * 135 *
117 * @suspend: Executed before putting the system into a sleep state in which the 136 * @suspend: Executed before putting the system into a sleep state in which the
118 * contents of main memory are preserved. The exact action to perform 137 * contents of main memory are preserved. The exact action to perform
@@ -546,6 +565,7 @@ struct dev_pm_info {
546 bool is_late_suspended:1; 565 bool is_late_suspended:1;
547 bool ignore_children:1; 566 bool ignore_children:1;
548 bool early_init:1; /* Owned by the PM core */ 567 bool early_init:1; /* Owned by the PM core */
568 bool direct_complete:1; /* Owned by the PM core */
549 spinlock_t lock; 569 spinlock_t lock;
550#ifdef CONFIG_PM_SLEEP 570#ifdef CONFIG_PM_SLEEP
551 struct list_head entry; 571 struct list_head entry;
diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h
index 5151b0059585..0330217abfad 100644
--- a/include/linux/pm_opp.h
+++ b/include/linux/pm_opp.h
@@ -15,7 +15,6 @@
15#define __LINUX_OPP_H__ 15#define __LINUX_OPP_H__
16 16
17#include <linux/err.h> 17#include <linux/err.h>
18#include <linux/cpufreq.h>
19#include <linux/notifier.h> 18#include <linux/notifier.h>
20 19
21struct dev_pm_opp; 20struct dev_pm_opp;
@@ -117,23 +116,4 @@ static inline int of_init_opp_table(struct device *dev)
117} 116}
118#endif 117#endif
119 118
120#if defined(CONFIG_CPU_FREQ) && defined(CONFIG_PM_OPP)
121int dev_pm_opp_init_cpufreq_table(struct device *dev,
122 struct cpufreq_frequency_table **table);
123void dev_pm_opp_free_cpufreq_table(struct device *dev,
124 struct cpufreq_frequency_table **table);
125#else
126static inline int dev_pm_opp_init_cpufreq_table(struct device *dev,
127 struct cpufreq_frequency_table **table)
128{
129 return -EINVAL;
130}
131
132static inline
133void dev_pm_opp_free_cpufreq_table(struct device *dev,
134 struct cpufreq_frequency_table **table)
135{
136}
137#endif /* CONFIG_CPU_FREQ */
138
139#endif /* __LINUX_OPP_H__ */ 119#endif /* __LINUX_OPP_H__ */
diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h
index 2a5897a4afbc..43fd6716f662 100644
--- a/include/linux/pm_runtime.h
+++ b/include/linux/pm_runtime.h
@@ -101,6 +101,11 @@ static inline bool pm_runtime_status_suspended(struct device *dev)
101 return dev->power.runtime_status == RPM_SUSPENDED; 101 return dev->power.runtime_status == RPM_SUSPENDED;
102} 102}
103 103
104static inline bool pm_runtime_suspended_if_enabled(struct device *dev)
105{
106 return pm_runtime_status_suspended(dev) && dev->power.disable_depth == 1;
107}
108
104static inline bool pm_runtime_enabled(struct device *dev) 109static inline bool pm_runtime_enabled(struct device *dev)
105{ 110{
106 return !dev->power.disable_depth; 111 return !dev->power.disable_depth;
@@ -150,6 +155,7 @@ static inline void device_set_run_wake(struct device *dev, bool enable) {}
150static inline bool pm_runtime_suspended(struct device *dev) { return false; } 155static inline bool pm_runtime_suspended(struct device *dev) { return false; }
151static inline bool pm_runtime_active(struct device *dev) { return true; } 156static inline bool pm_runtime_active(struct device *dev) { return true; }
152static inline bool pm_runtime_status_suspended(struct device *dev) { return false; } 157static inline bool pm_runtime_status_suspended(struct device *dev) { return false; }
158static inline bool pm_runtime_suspended_if_enabled(struct device *dev) { return false; }
153static inline bool pm_runtime_enabled(struct device *dev) { return false; } 159static inline bool pm_runtime_enabled(struct device *dev) { return false; }
154 160
155static inline void pm_runtime_no_callbacks(struct device *dev) {} 161static inline void pm_runtime_no_callbacks(struct device *dev) {}
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index c9dc4e09854c..f2b76aeaf4e4 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -264,6 +264,8 @@ static inline int power_supply_is_system_supplied(void) { return -ENOSYS; }
264 264
265extern int power_supply_register(struct device *parent, 265extern int power_supply_register(struct device *parent,
266 struct power_supply *psy); 266 struct power_supply *psy);
267extern int power_supply_register_no_ws(struct device *parent,
268 struct power_supply *psy);
267extern void power_supply_unregister(struct power_supply *psy); 269extern void power_supply_unregister(struct power_supply *psy);
268extern int power_supply_powers(struct power_supply *psy, struct device *dev); 270extern int power_supply_powers(struct power_supply *psy, struct device *dev);
269 271
diff --git a/include/linux/printk.h b/include/linux/printk.h
index 8752f7595b27..319ff7e53efb 100644
--- a/include/linux/printk.h
+++ b/include/linux/printk.h
@@ -30,6 +30,17 @@ static inline const char *printk_skip_level(const char *buffer)
30 return buffer; 30 return buffer;
31} 31}
32 32
33/* printk's without a loglevel use this.. */
34#define DEFAULT_MESSAGE_LOGLEVEL CONFIG_DEFAULT_MESSAGE_LOGLEVEL
35
36/* We show everything that is MORE important than this.. */
37#define CONSOLE_LOGLEVEL_SILENT 0 /* Mum's the word */
38#define CONSOLE_LOGLEVEL_MIN 1 /* Minimum loglevel we let people use */
39#define CONSOLE_LOGLEVEL_QUIET 4 /* Shhh ..., when booted with "quiet" */
40#define CONSOLE_LOGLEVEL_DEFAULT 7 /* anything MORE serious than KERN_DEBUG */
41#define CONSOLE_LOGLEVEL_DEBUG 10 /* issue debug messages */
42#define CONSOLE_LOGLEVEL_MOTORMOUTH 15 /* You can't shut this one up */
43
33extern int console_printk[]; 44extern int console_printk[];
34 45
35#define console_loglevel (console_printk[0]) 46#define console_loglevel (console_printk[0])
@@ -39,13 +50,13 @@ extern int console_printk[];
39 50
40static inline void console_silent(void) 51static inline void console_silent(void)
41{ 52{
42 console_loglevel = 0; 53 console_loglevel = CONSOLE_LOGLEVEL_SILENT;
43} 54}
44 55
45static inline void console_verbose(void) 56static inline void console_verbose(void)
46{ 57{
47 if (console_loglevel) 58 if (console_loglevel)
48 console_loglevel = 15; 59 console_loglevel = CONSOLE_LOGLEVEL_MOTORMOUTH;
49} 60}
50 61
51struct va_format { 62struct va_format {
@@ -128,9 +139,9 @@ asmlinkage __printf(1, 2) __cold
128int printk(const char *fmt, ...); 139int printk(const char *fmt, ...);
129 140
130/* 141/*
131 * Special printk facility for scheduler use only, _DO_NOT_USE_ ! 142 * Special printk facility for scheduler/timekeeping use only, _DO_NOT_USE_ !
132 */ 143 */
133__printf(1, 2) __cold int printk_sched(const char *fmt, ...); 144__printf(1, 2) __cold int printk_deferred(const char *fmt, ...);
134 145
135/* 146/*
136 * Please don't use printk_ratelimit(), because it shares ratelimiting state 147 * Please don't use printk_ratelimit(), because it shares ratelimiting state
@@ -165,7 +176,7 @@ int printk(const char *s, ...)
165 return 0; 176 return 0;
166} 177}
167static inline __printf(1, 2) __cold 178static inline __printf(1, 2) __cold
168int printk_sched(const char *s, ...) 179int printk_deferred(const char *s, ...)
169{ 180{
170 return 0; 181 return 0;
171} 182}
@@ -210,6 +221,12 @@ extern asmlinkage void dump_stack(void) __cold;
210#define pr_fmt(fmt) fmt 221#define pr_fmt(fmt) fmt
211#endif 222#endif
212 223
224/*
225 * These can be used to print at the various log levels.
226 * All of these will print unconditionally, although note that pr_debug()
227 * and other debug macros are compiled out unless either DEBUG is defined
228 * or CONFIG_DYNAMIC_DEBUG is set.
229 */
213#define pr_emerg(fmt, ...) \ 230#define pr_emerg(fmt, ...) \
214 printk(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__) 231 printk(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__)
215#define pr_alert(fmt, ...) \ 232#define pr_alert(fmt, ...) \
@@ -266,9 +283,20 @@ extern asmlinkage void dump_stack(void) __cold;
266 printk(fmt, ##__VA_ARGS__); \ 283 printk(fmt, ##__VA_ARGS__); \
267 } \ 284 } \
268}) 285})
286#define printk_deferred_once(fmt, ...) \
287({ \
288 static bool __print_once __read_mostly; \
289 \
290 if (!__print_once) { \
291 __print_once = true; \
292 printk_deferred(fmt, ##__VA_ARGS__); \
293 } \
294})
269#else 295#else
270#define printk_once(fmt, ...) \ 296#define printk_once(fmt, ...) \
271 no_printk(fmt, ##__VA_ARGS__) 297 no_printk(fmt, ##__VA_ARGS__)
298#define printk_deferred_once(fmt, ...) \
299 no_printk(fmt, ##__VA_ARGS__)
272#endif 300#endif
273 301
274#define pr_emerg_once(fmt, ...) \ 302#define pr_emerg_once(fmt, ...) \
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index 608e60a74c3c..9d117f61d976 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -44,6 +44,10 @@ extern int remove_proc_subtree(const char *, struct proc_dir_entry *);
44 44
45#else /* CONFIG_PROC_FS */ 45#else /* CONFIG_PROC_FS */
46 46
47static inline void proc_root_init(void)
48{
49}
50
47static inline void proc_flush_task(struct task_struct *task) 51static inline void proc_flush_task(struct task_struct *task)
48{ 52{
49} 53}
diff --git a/include/linux/profile.h b/include/linux/profile.h
index aaad3861beb8..b537a25ffa17 100644
--- a/include/linux/profile.h
+++ b/include/linux/profile.h
@@ -44,6 +44,7 @@ extern int prof_on __read_mostly;
44int profile_init(void); 44int profile_init(void);
45int profile_setup(char *str); 45int profile_setup(char *str);
46void profile_tick(int type); 46void profile_tick(int type);
47int setup_profiling_timer(unsigned int multiplier);
47 48
48/* 49/*
49 * Add multiple profiler hits to a given address: 50 * Add multiple profiler hits to a given address:
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h
index 07d0df6bf768..cc79eff4a1ad 100644
--- a/include/linux/ptrace.h
+++ b/include/linux/ptrace.h
@@ -5,6 +5,7 @@
5#include <linux/sched.h> /* For struct task_struct. */ 5#include <linux/sched.h> /* For struct task_struct. */
6#include <linux/err.h> /* for IS_ERR_VALUE */ 6#include <linux/err.h> /* for IS_ERR_VALUE */
7#include <linux/bug.h> /* For BUG_ON. */ 7#include <linux/bug.h> /* For BUG_ON. */
8#include <linux/pid_namespace.h> /* For task_active_pid_ns. */
8#include <uapi/linux/ptrace.h> 9#include <uapi/linux/ptrace.h>
9 10
10/* 11/*
@@ -129,6 +130,37 @@ static inline void ptrace_event(int event, unsigned long message)
129} 130}
130 131
131/** 132/**
133 * ptrace_event_pid - possibly stop for a ptrace event notification
134 * @event: %PTRACE_EVENT_* value to report
135 * @pid: process identifier for %PTRACE_GETEVENTMSG to return
136 *
137 * Check whether @event is enabled and, if so, report @event and @pid
138 * to the ptrace parent. @pid is reported as the pid_t seen from the
139 * the ptrace parent's pid namespace.
140 *
141 * Called without locks.
142 */
143static inline void ptrace_event_pid(int event, struct pid *pid)
144{
145 /*
146 * FIXME: There's a potential race if a ptracer in a different pid
147 * namespace than parent attaches between computing message below and
148 * when we acquire tasklist_lock in ptrace_stop(). If this happens,
149 * the ptracer will get a bogus pid from PTRACE_GETEVENTMSG.
150 */
151 unsigned long message = 0;
152 struct pid_namespace *ns;
153
154 rcu_read_lock();
155 ns = task_active_pid_ns(rcu_dereference(current->parent));
156 if (ns)
157 message = pid_nr_ns(pid, ns);
158 rcu_read_unlock();
159
160 ptrace_event(event, message);
161}
162
163/**
132 * ptrace_init_task - initialize ptrace state for a new child 164 * ptrace_init_task - initialize ptrace state for a new child
133 * @child: new child task 165 * @child: new child task
134 * @ptrace: true if child should be ptrace'd by parent's tracer 166 * @ptrace: true if child should be ptrace'd by parent's tracer
@@ -302,6 +334,9 @@ static inline void user_single_step_siginfo(struct task_struct *tsk,
302 * calling arch_ptrace_stop() when it would be superfluous. For example, 334 * calling arch_ptrace_stop() when it would be superfluous. For example,
303 * if the thread has not been back to user mode since the last stop, the 335 * if the thread has not been back to user mode since the last stop, the
304 * thread state might indicate that nothing needs to be done. 336 * thread state might indicate that nothing needs to be done.
337 *
338 * This is guaranteed to be invoked once before a task stops for ptrace and
339 * may include arch-specific operations necessary prior to a ptrace stop.
305 */ 340 */
306#define arch_ptrace_stop_needed(code, info) (0) 341#define arch_ptrace_stop_needed(code, info) (0)
307#endif 342#endif
diff --git a/include/linux/pwm.h b/include/linux/pwm.h
index 4717f54051cb..e90628cac8fa 100644
--- a/include/linux/pwm.h
+++ b/include/linux/pwm.h
@@ -274,14 +274,18 @@ struct pwm_lookup {
274 unsigned int index; 274 unsigned int index;
275 const char *dev_id; 275 const char *dev_id;
276 const char *con_id; 276 const char *con_id;
277 unsigned int period;
278 enum pwm_polarity polarity;
277}; 279};
278 280
279#define PWM_LOOKUP(_provider, _index, _dev_id, _con_id) \ 281#define PWM_LOOKUP(_provider, _index, _dev_id, _con_id, _period, _polarity) \
280 { \ 282 { \
281 .provider = _provider, \ 283 .provider = _provider, \
282 .index = _index, \ 284 .index = _index, \
283 .dev_id = _dev_id, \ 285 .dev_id = _dev_id, \
284 .con_id = _con_id, \ 286 .con_id = _con_id, \
287 .period = _period, \
288 .polarity = _polarity \
285 } 289 }
286 290
287#if IS_ENABLED(CONFIG_PWM) 291#if IS_ENABLED(CONFIG_PWM)
diff --git a/include/linux/pwm_backlight.h b/include/linux/pwm_backlight.h
index 2de2e275b2cb..efdd9227a49c 100644
--- a/include/linux/pwm_backlight.h
+++ b/include/linux/pwm_backlight.h
@@ -6,9 +6,6 @@
6 6
7#include <linux/backlight.h> 7#include <linux/backlight.h>
8 8
9/* TODO: convert to gpiod_*() API once it has been merged */
10#define PWM_BACKLIGHT_GPIO_ACTIVE_LOW (1 << 0)
11
12struct platform_pwm_backlight_data { 9struct platform_pwm_backlight_data {
13 int pwm_id; 10 int pwm_id;
14 unsigned int max_brightness; 11 unsigned int max_brightness;
@@ -16,8 +13,8 @@ struct platform_pwm_backlight_data {
16 unsigned int lth_brightness; 13 unsigned int lth_brightness;
17 unsigned int pwm_period_ns; 14 unsigned int pwm_period_ns;
18 unsigned int *levels; 15 unsigned int *levels;
16 /* TODO remove once all users are switched to gpiod_* API */
19 int enable_gpio; 17 int enable_gpio;
20 unsigned long enable_gpio_flags;
21 int (*init)(struct device *dev); 18 int (*init)(struct device *dev);
22 int (*notify)(struct device *dev, int brightness); 19 int (*notify)(struct device *dev, int brightness);
23 void (*notify_after)(struct device *dev, int brightness); 20 void (*notify_after)(struct device *dev, int brightness);
diff --git a/include/linux/quota.h b/include/linux/quota.h
index cc7494a35429..0f3c5d38da1f 100644
--- a/include/linux/quota.h
+++ b/include/linux/quota.h
@@ -329,6 +329,7 @@ struct quotactl_ops {
329 int (*get_xstate)(struct super_block *, struct fs_quota_stat *); 329 int (*get_xstate)(struct super_block *, struct fs_quota_stat *);
330 int (*set_xstate)(struct super_block *, unsigned int, int); 330 int (*set_xstate)(struct super_block *, unsigned int, int);
331 int (*get_xstatev)(struct super_block *, struct fs_quota_statv *); 331 int (*get_xstatev)(struct super_block *, struct fs_quota_statv *);
332 int (*rm_xquota)(struct super_block *, unsigned int);
332}; 333};
333 334
334struct quota_format_type { 335struct quota_format_type {
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 00a7fd61b3c6..5a75d19aa661 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -44,6 +44,7 @@
44#include <linux/debugobjects.h> 44#include <linux/debugobjects.h>
45#include <linux/bug.h> 45#include <linux/bug.h>
46#include <linux/compiler.h> 46#include <linux/compiler.h>
47#include <linux/percpu.h>
47#include <asm/barrier.h> 48#include <asm/barrier.h>
48 49
49extern int rcu_expedited; /* for sysctl */ 50extern int rcu_expedited; /* for sysctl */
@@ -51,7 +52,17 @@ extern int rcu_expedited; /* for sysctl */
51extern int rcutorture_runnable; /* for sysctl */ 52extern int rcutorture_runnable; /* for sysctl */
52#endif /* #ifdef CONFIG_RCU_TORTURE_TEST */ 53#endif /* #ifdef CONFIG_RCU_TORTURE_TEST */
53 54
55enum rcutorture_type {
56 RCU_FLAVOR,
57 RCU_BH_FLAVOR,
58 RCU_SCHED_FLAVOR,
59 SRCU_FLAVOR,
60 INVALID_RCU_FLAVOR
61};
62
54#if defined(CONFIG_TREE_RCU) || defined(CONFIG_TREE_PREEMPT_RCU) 63#if defined(CONFIG_TREE_RCU) || defined(CONFIG_TREE_PREEMPT_RCU)
64void rcutorture_get_gp_data(enum rcutorture_type test_type, int *flags,
65 unsigned long *gpnum, unsigned long *completed);
55void rcutorture_record_test_transition(void); 66void rcutorture_record_test_transition(void);
56void rcutorture_record_progress(unsigned long vernum); 67void rcutorture_record_progress(unsigned long vernum);
57void do_trace_rcu_torture_read(const char *rcutorturename, 68void do_trace_rcu_torture_read(const char *rcutorturename,
@@ -60,6 +71,15 @@ void do_trace_rcu_torture_read(const char *rcutorturename,
60 unsigned long c_old, 71 unsigned long c_old,
61 unsigned long c); 72 unsigned long c);
62#else 73#else
74static inline void rcutorture_get_gp_data(enum rcutorture_type test_type,
75 int *flags,
76 unsigned long *gpnum,
77 unsigned long *completed)
78{
79 *flags = 0;
80 *gpnum = 0;
81 *completed = 0;
82}
63static inline void rcutorture_record_test_transition(void) 83static inline void rcutorture_record_test_transition(void)
64{ 84{
65} 85}
@@ -228,6 +248,18 @@ void rcu_idle_exit(void);
228void rcu_irq_enter(void); 248void rcu_irq_enter(void);
229void rcu_irq_exit(void); 249void rcu_irq_exit(void);
230 250
251#ifdef CONFIG_RCU_STALL_COMMON
252void rcu_sysrq_start(void);
253void rcu_sysrq_end(void);
254#else /* #ifdef CONFIG_RCU_STALL_COMMON */
255static inline void rcu_sysrq_start(void)
256{
257}
258static inline void rcu_sysrq_end(void)
259{
260}
261#endif /* #else #ifdef CONFIG_RCU_STALL_COMMON */
262
231#ifdef CONFIG_RCU_USER_QS 263#ifdef CONFIG_RCU_USER_QS
232void rcu_user_enter(void); 264void rcu_user_enter(void);
233void rcu_user_exit(void); 265void rcu_user_exit(void);
@@ -268,6 +300,41 @@ bool __rcu_is_watching(void);
268#endif /* #if defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_RCU_TRACE) || defined(CONFIG_SMP) */ 300#endif /* #if defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_RCU_TRACE) || defined(CONFIG_SMP) */
269 301
270/* 302/*
303 * Hooks for cond_resched() and friends to avoid RCU CPU stall warnings.
304 */
305
306#define RCU_COND_RESCHED_LIM 256 /* ms vs. 100s of ms. */
307DECLARE_PER_CPU(int, rcu_cond_resched_count);
308void rcu_resched(void);
309
310/*
311 * Is it time to report RCU quiescent states?
312 *
313 * Note unsynchronized access to rcu_cond_resched_count. Yes, we might
314 * increment some random CPU's count, and possibly also load the result from
315 * yet another CPU's count. We might even clobber some other CPU's attempt
316 * to zero its counter. This is all OK because the goal is not precision,
317 * but rather reasonable amortization of rcu_note_context_switch() overhead
318 * and extremely high probability of avoiding RCU CPU stall warnings.
319 * Note that this function has to be preempted in just the wrong place,
320 * many thousands of times in a row, for anything bad to happen.
321 */
322static inline bool rcu_should_resched(void)
323{
324 return raw_cpu_inc_return(rcu_cond_resched_count) >=
325 RCU_COND_RESCHED_LIM;
326}
327
328/*
329 * Report quiscent states to RCU if it is time to do so.
330 */
331static inline void rcu_cond_resched(void)
332{
333 if (unlikely(rcu_should_resched()))
334 rcu_resched();
335}
336
337/*
271 * Infrastructure to implement the synchronize_() primitives in 338 * Infrastructure to implement the synchronize_() primitives in
272 * TREE_RCU and rcu_barrier_() primitives in TINY_RCU. 339 * TREE_RCU and rcu_barrier_() primitives in TINY_RCU.
273 */ 340 */
@@ -328,7 +395,7 @@ extern struct lockdep_map rcu_lock_map;
328extern struct lockdep_map rcu_bh_lock_map; 395extern struct lockdep_map rcu_bh_lock_map;
329extern struct lockdep_map rcu_sched_lock_map; 396extern struct lockdep_map rcu_sched_lock_map;
330extern struct lockdep_map rcu_callback_map; 397extern struct lockdep_map rcu_callback_map;
331extern int debug_lockdep_rcu_enabled(void); 398int debug_lockdep_rcu_enabled(void);
332 399
333/** 400/**
334 * rcu_read_lock_held() - might we be in RCU read-side critical section? 401 * rcu_read_lock_held() - might we be in RCU read-side critical section?
@@ -949,6 +1016,9 @@ static inline notrace void rcu_read_unlock_sched_notrace(void)
949 * pointers, but you must use rcu_assign_pointer() to initialize the 1016 * pointers, but you must use rcu_assign_pointer() to initialize the
950 * external-to-structure pointer -after- you have completely initialized 1017 * external-to-structure pointer -after- you have completely initialized
951 * the reader-accessible portions of the linked structure. 1018 * the reader-accessible portions of the linked structure.
1019 *
1020 * Note that unlike rcu_assign_pointer(), RCU_INIT_POINTER() provides no
1021 * ordering guarantees for either the CPU or the compiler.
952 */ 1022 */
953#define RCU_INIT_POINTER(p, v) \ 1023#define RCU_INIT_POINTER(p, v) \
954 do { \ 1024 do { \
diff --git a/include/linux/rcutiny.h b/include/linux/rcutiny.h
index 425c659d54e5..d40a6a451330 100644
--- a/include/linux/rcutiny.h
+++ b/include/linux/rcutiny.h
@@ -119,6 +119,10 @@ static inline void rcu_sched_force_quiescent_state(void)
119{ 119{
120} 120}
121 121
122static inline void show_rcu_gp_kthreads(void)
123{
124}
125
122static inline void rcu_cpu_stall_reset(void) 126static inline void rcu_cpu_stall_reset(void)
123{ 127{
124} 128}
diff --git a/include/linux/rcutree.h b/include/linux/rcutree.h
index a59ca05fd4e3..3e2f5d432743 100644
--- a/include/linux/rcutree.h
+++ b/include/linux/rcutree.h
@@ -84,6 +84,7 @@ extern unsigned long rcutorture_vernum;
84long rcu_batches_completed(void); 84long rcu_batches_completed(void);
85long rcu_batches_completed_bh(void); 85long rcu_batches_completed_bh(void);
86long rcu_batches_completed_sched(void); 86long rcu_batches_completed_sched(void);
87void show_rcu_gp_kthreads(void);
87 88
88void rcu_force_quiescent_state(void); 89void rcu_force_quiescent_state(void);
89void rcu_bh_force_quiescent_state(void); 90void rcu_bh_force_quiescent_state(void);
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index 85691b9b4fa7..7b0e4b425cdf 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -276,6 +276,10 @@ typedef int (*regmap_hw_async_write)(void *context,
276typedef int (*regmap_hw_read)(void *context, 276typedef int (*regmap_hw_read)(void *context,
277 const void *reg_buf, size_t reg_size, 277 const void *reg_buf, size_t reg_size,
278 void *val_buf, size_t val_size); 278 void *val_buf, size_t val_size);
279typedef int (*regmap_hw_reg_read)(void *context, unsigned int reg,
280 unsigned int *val);
281typedef int (*regmap_hw_reg_write)(void *context, unsigned int reg,
282 unsigned int val);
279typedef struct regmap_async *(*regmap_hw_async_alloc)(void); 283typedef struct regmap_async *(*regmap_hw_async_alloc)(void);
280typedef void (*regmap_hw_free_context)(void *context); 284typedef void (*regmap_hw_free_context)(void *context);
281 285
@@ -309,7 +313,9 @@ struct regmap_bus {
309 regmap_hw_write write; 313 regmap_hw_write write;
310 regmap_hw_gather_write gather_write; 314 regmap_hw_gather_write gather_write;
311 regmap_hw_async_write async_write; 315 regmap_hw_async_write async_write;
316 regmap_hw_reg_write reg_write;
312 regmap_hw_read read; 317 regmap_hw_read read;
318 regmap_hw_reg_read reg_read;
313 regmap_hw_free_context free_context; 319 regmap_hw_free_context free_context;
314 regmap_hw_async_alloc async_alloc; 320 regmap_hw_async_alloc async_alloc;
315 u8 read_flag_mask; 321 u8 read_flag_mask;
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
index 1a4a8c157b31..14ec18d5e18b 100644
--- a/include/linux/regulator/consumer.h
+++ b/include/linux/regulator/consumer.h
@@ -151,11 +151,13 @@ int regulator_register_supply_alias(struct device *dev, const char *id,
151 const char *alias_id); 151 const char *alias_id);
152void regulator_unregister_supply_alias(struct device *dev, const char *id); 152void regulator_unregister_supply_alias(struct device *dev, const char *id);
153 153
154int regulator_bulk_register_supply_alias(struct device *dev, const char **id, 154int regulator_bulk_register_supply_alias(struct device *dev,
155 const char *const *id,
155 struct device *alias_dev, 156 struct device *alias_dev,
156 const char **alias_id, int num_id); 157 const char *const *alias_id,
158 int num_id);
157void regulator_bulk_unregister_supply_alias(struct device *dev, 159void regulator_bulk_unregister_supply_alias(struct device *dev,
158 const char **id, int num_id); 160 const char * const *id, int num_id);
159 161
160int devm_regulator_register_supply_alias(struct device *dev, const char *id, 162int devm_regulator_register_supply_alias(struct device *dev, const char *id,
161 struct device *alias_dev, 163 struct device *alias_dev,
@@ -164,12 +166,12 @@ void devm_regulator_unregister_supply_alias(struct device *dev,
164 const char *id); 166 const char *id);
165 167
166int devm_regulator_bulk_register_supply_alias(struct device *dev, 168int devm_regulator_bulk_register_supply_alias(struct device *dev,
167 const char **id, 169 const char *const *id,
168 struct device *alias_dev, 170 struct device *alias_dev,
169 const char **alias_id, 171 const char *const *alias_id,
170 int num_id); 172 int num_id);
171void devm_regulator_bulk_unregister_supply_alias(struct device *dev, 173void devm_regulator_bulk_unregister_supply_alias(struct device *dev,
172 const char **id, 174 const char *const *id,
173 int num_id); 175 int num_id);
174 176
175/* regulator output control and status */ 177/* regulator output control and status */
@@ -290,17 +292,17 @@ static inline void regulator_unregister_supply_alias(struct device *dev,
290} 292}
291 293
292static inline int regulator_bulk_register_supply_alias(struct device *dev, 294static inline int regulator_bulk_register_supply_alias(struct device *dev,
293 const char **id, 295 const char *const *id,
294 struct device *alias_dev, 296 struct device *alias_dev,
295 const char **alias_id, 297 const char * const *alias_id,
296 int num_id) 298 int num_id)
297{ 299{
298 return 0; 300 return 0;
299} 301}
300 302
301static inline void regulator_bulk_unregister_supply_alias(struct device *dev, 303static inline void regulator_bulk_unregister_supply_alias(struct device *dev,
302 const char **id, 304 const char * const *id,
303 int num_id) 305 int num_id)
304{ 306{
305} 307}
306 308
@@ -317,15 +319,17 @@ static inline void devm_regulator_unregister_supply_alias(struct device *dev,
317{ 319{
318} 320}
319 321
320static inline int devm_regulator_bulk_register_supply_alias( 322static inline int devm_regulator_bulk_register_supply_alias(struct device *dev,
321 struct device *dev, const char **id, struct device *alias_dev, 323 const char *const *id,
322 const char **alias_id, int num_id) 324 struct device *alias_dev,
325 const char *const *alias_id,
326 int num_id)
323{ 327{
324 return 0; 328 return 0;
325} 329}
326 330
327static inline void devm_regulator_bulk_unregister_supply_alias( 331static inline void devm_regulator_bulk_unregister_supply_alias(
328 struct device *dev, const char **id, int num_id) 332 struct device *dev, const char *const *id, int num_id)
329{ 333{
330} 334}
331 335
@@ -391,12 +395,23 @@ static inline void regulator_bulk_free(int num_consumers,
391{ 395{
392} 396}
393 397
398static inline int regulator_can_change_voltage(struct regulator *regulator)
399{
400 return 0;
401}
402
394static inline int regulator_set_voltage(struct regulator *regulator, 403static inline int regulator_set_voltage(struct regulator *regulator,
395 int min_uV, int max_uV) 404 int min_uV, int max_uV)
396{ 405{
397 return 0; 406 return 0;
398} 407}
399 408
409static inline int regulator_set_voltage_time(struct regulator *regulator,
410 int old_uV, int new_uV)
411{
412 return 0;
413}
414
400static inline int regulator_get_voltage(struct regulator *regulator) 415static inline int regulator_get_voltage(struct regulator *regulator)
401{ 416{
402 return -EINVAL; 417 return -EINVAL;
diff --git a/include/linux/rfkill-gpio.h b/include/linux/rfkill-gpio.h
index 4d09f6eab359..20bcb55498cd 100644
--- a/include/linux/rfkill-gpio.h
+++ b/include/linux/rfkill-gpio.h
@@ -27,21 +27,11 @@
27 * struct rfkill_gpio_platform_data - platform data for rfkill gpio device. 27 * struct rfkill_gpio_platform_data - platform data for rfkill gpio device.
28 * for unused gpio's, the expected value is -1. 28 * for unused gpio's, the expected value is -1.
29 * @name: name for the gpio rf kill instance 29 * @name: name for the gpio rf kill instance
30 * @reset_gpio: GPIO which is used for reseting rfkill switch
31 * @shutdown_gpio: GPIO which is used for shutdown of rfkill switch
32 * @power_clk_name: [optional] name of clk to turn off while blocked
33 * @gpio_runtime_close: clean up platform specific gpio configuration
34 * @gpio_runtime_setup: set up platform specific gpio configuration
35 */ 30 */
36 31
37struct rfkill_gpio_platform_data { 32struct rfkill_gpio_platform_data {
38 char *name; 33 char *name;
39 int reset_gpio;
40 int shutdown_gpio;
41 const char *power_clk_name;
42 enum rfkill_type type; 34 enum rfkill_type type;
43 void (*gpio_runtime_close)(struct platform_device *);
44 int (*gpio_runtime_setup)(struct platform_device *);
45}; 35};
46 36
47#endif /* __RFKILL_GPIO_H */ 37#endif /* __RFKILL_GPIO_H */
diff --git a/include/linux/ring_buffer.h b/include/linux/ring_buffer.h
index d69cf637a15a..49a4d6f59108 100644
--- a/include/linux/ring_buffer.h
+++ b/include/linux/ring_buffer.h
@@ -97,7 +97,7 @@ __ring_buffer_alloc(unsigned long size, unsigned flags, struct lock_class_key *k
97 __ring_buffer_alloc((size), (flags), &__key); \ 97 __ring_buffer_alloc((size), (flags), &__key); \
98}) 98})
99 99
100void ring_buffer_wait(struct ring_buffer *buffer, int cpu); 100int ring_buffer_wait(struct ring_buffer *buffer, int cpu);
101int ring_buffer_poll_wait(struct ring_buffer *buffer, int cpu, 101int ring_buffer_poll_wait(struct ring_buffer *buffer, int cpu,
102 struct file *filp, poll_table *poll_table); 102 struct file *filp, poll_table *poll_table);
103 103
diff --git a/include/linux/rmap.h b/include/linux/rmap.h
index b66c2110cb1f..be574506e6a9 100644
--- a/include/linux/rmap.h
+++ b/include/linux/rmap.h
@@ -72,10 +72,9 @@ struct anon_vma_chain {
72}; 72};
73 73
74enum ttu_flags { 74enum ttu_flags {
75 TTU_UNMAP = 0, /* unmap mode */ 75 TTU_UNMAP = 1, /* unmap mode */
76 TTU_MIGRATION = 1, /* migration mode */ 76 TTU_MIGRATION = 2, /* migration mode */
77 TTU_MUNLOCK = 2, /* munlock mode */ 77 TTU_MUNLOCK = 4, /* munlock mode */
78 TTU_ACTION_MASK = 0xff,
79 78
80 TTU_IGNORE_MLOCK = (1 << 8), /* ignore mlock */ 79 TTU_IGNORE_MLOCK = (1 << 8), /* ignore mlock */
81 TTU_IGNORE_ACCESS = (1 << 9), /* don't age */ 80 TTU_IGNORE_ACCESS = (1 << 9), /* don't age */
@@ -183,14 +182,10 @@ static inline void page_dup_rmap(struct page *page)
183 */ 182 */
184int page_referenced(struct page *, int is_locked, 183int page_referenced(struct page *, int is_locked,
185 struct mem_cgroup *memcg, unsigned long *vm_flags); 184 struct mem_cgroup *memcg, unsigned long *vm_flags);
186int page_referenced_one(struct page *, struct vm_area_struct *,
187 unsigned long address, void *arg);
188 185
189#define TTU_ACTION(x) ((x) & TTU_ACTION_MASK) 186#define TTU_ACTION(x) ((x) & TTU_ACTION_MASK)
190 187
191int try_to_unmap(struct page *, enum ttu_flags flags); 188int try_to_unmap(struct page *, enum ttu_flags flags);
192int try_to_unmap_one(struct page *, struct vm_area_struct *,
193 unsigned long address, void *arg);
194 189
195/* 190/*
196 * Called from mm/filemap_xip.c to unmap empty zero page 191 * Called from mm/filemap_xip.c to unmap empty zero page
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index 8e3e66ac0a52..953937ea5233 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -4,6 +4,7 @@
4 4
5#include <linux/mutex.h> 5#include <linux/mutex.h>
6#include <linux/netdevice.h> 6#include <linux/netdevice.h>
7#include <linux/wait.h>
7#include <uapi/linux/rtnetlink.h> 8#include <uapi/linux/rtnetlink.h>
8 9
9extern int rtnetlink_send(struct sk_buff *skb, struct net *net, u32 pid, u32 group, int echo); 10extern int rtnetlink_send(struct sk_buff *skb, struct net *net, u32 pid, u32 group, int echo);
@@ -22,6 +23,10 @@ extern void rtnl_lock(void);
22extern void rtnl_unlock(void); 23extern void rtnl_unlock(void);
23extern int rtnl_trylock(void); 24extern int rtnl_trylock(void);
24extern int rtnl_is_locked(void); 25extern int rtnl_is_locked(void);
26
27extern wait_queue_head_t netdev_unregistering_wq;
28extern struct mutex net_mutex;
29
25#ifdef CONFIG_PROVE_LOCKING 30#ifdef CONFIG_PROVE_LOCKING
26extern int lockdep_rtnl_is_held(void); 31extern int lockdep_rtnl_is_held(void);
27#else 32#else
diff --git a/include/linux/rwsem.h b/include/linux/rwsem.h
index 03f3b05e8ec1..8d79708146aa 100644
--- a/include/linux/rwsem.h
+++ b/include/linux/rwsem.h
@@ -16,6 +16,7 @@
16 16
17#include <linux/atomic.h> 17#include <linux/atomic.h>
18 18
19struct optimistic_spin_queue;
19struct rw_semaphore; 20struct rw_semaphore;
20 21
21#ifdef CONFIG_RWSEM_GENERIC_SPINLOCK 22#ifdef CONFIG_RWSEM_GENERIC_SPINLOCK
@@ -23,9 +24,17 @@ struct rw_semaphore;
23#else 24#else
24/* All arch specific implementations share the same struct */ 25/* All arch specific implementations share the same struct */
25struct rw_semaphore { 26struct rw_semaphore {
26 long count; 27 long count;
27 raw_spinlock_t wait_lock; 28 raw_spinlock_t wait_lock;
28 struct list_head wait_list; 29 struct list_head wait_list;
30#ifdef CONFIG_SMP
31 /*
32 * Write owner. Used as a speculative check to see
33 * if the owner is running on the cpu.
34 */
35 struct task_struct *owner;
36 struct optimistic_spin_queue *osq; /* spinner MCS lock */
37#endif
29#ifdef CONFIG_DEBUG_LOCK_ALLOC 38#ifdef CONFIG_DEBUG_LOCK_ALLOC
30 struct lockdep_map dep_map; 39 struct lockdep_map dep_map;
31#endif 40#endif
@@ -55,11 +64,21 @@ static inline int rwsem_is_locked(struct rw_semaphore *sem)
55# define __RWSEM_DEP_MAP_INIT(lockname) 64# define __RWSEM_DEP_MAP_INIT(lockname)
56#endif 65#endif
57 66
67#if defined(CONFIG_SMP) && !defined(CONFIG_RWSEM_GENERIC_SPINLOCK)
68#define __RWSEM_INITIALIZER(name) \
69 { RWSEM_UNLOCKED_VALUE, \
70 __RAW_SPIN_LOCK_UNLOCKED(name.wait_lock), \
71 LIST_HEAD_INIT((name).wait_list), \
72 NULL, /* owner */ \
73 NULL /* mcs lock */ \
74 __RWSEM_DEP_MAP_INIT(name) }
75#else
58#define __RWSEM_INITIALIZER(name) \ 76#define __RWSEM_INITIALIZER(name) \
59 { RWSEM_UNLOCKED_VALUE, \ 77 { RWSEM_UNLOCKED_VALUE, \
60 __RAW_SPIN_LOCK_UNLOCKED(name.wait_lock), \ 78 __RAW_SPIN_LOCK_UNLOCKED(name.wait_lock), \
61 LIST_HEAD_INIT((name).wait_list) \ 79 LIST_HEAD_INIT((name).wait_list) \
62 __RWSEM_DEP_MAP_INIT(name) } 80 __RWSEM_DEP_MAP_INIT(name) }
81#endif
63 82
64#define DECLARE_RWSEM(name) \ 83#define DECLARE_RWSEM(name) \
65 struct rw_semaphore name = __RWSEM_INITIALIZER(name) 84 struct rw_semaphore name = __RWSEM_INITIALIZER(name)
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 25f54c79f757..306f4f0c987a 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -137,12 +137,6 @@ struct filename;
137#define VMACACHE_MASK (VMACACHE_SIZE - 1) 137#define VMACACHE_MASK (VMACACHE_SIZE - 1)
138 138
139/* 139/*
140 * List of flags we want to share for kernel threads,
141 * if only because they are not used by them anyway.
142 */
143#define CLONE_KERNEL (CLONE_FS | CLONE_FILES | CLONE_SIGHAND)
144
145/*
146 * These are the constant used to fake the fixed-point load-average 140 * These are the constant used to fake the fixed-point load-average
147 * counting. Some notes: 141 * counting. Some notes:
148 * - 11 bit fractions expand to 22 bits by the multiplies: this gives 142 * - 11 bit fractions expand to 22 bits by the multiplies: this gives
@@ -220,7 +214,7 @@ print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq);
220#define TASK_PARKED 512 214#define TASK_PARKED 512
221#define TASK_STATE_MAX 1024 215#define TASK_STATE_MAX 1024
222 216
223#define TASK_STATE_TO_CHAR_STR "RSDTtZXxKWP" 217#define TASK_STATE_TO_CHAR_STR "RSDTtXZxKWP"
224 218
225extern char ___assert_task_state[1 - 2*!!( 219extern char ___assert_task_state[1 - 2*!!(
226 sizeof(TASK_STATE_TO_CHAR_STR)-1 != ilog2(TASK_STATE_MAX)+1)]; 220 sizeof(TASK_STATE_TO_CHAR_STR)-1 != ilog2(TASK_STATE_MAX)+1)];
@@ -745,7 +739,6 @@ static inline int signal_group_exit(const struct signal_struct *sig)
745struct user_struct { 739struct user_struct {
746 atomic_t __count; /* reference count */ 740 atomic_t __count; /* reference count */
747 atomic_t processes; /* How many processes does this user have? */ 741 atomic_t processes; /* How many processes does this user have? */
748 atomic_t files; /* How many open files does this user have? */
749 atomic_t sigpending; /* How many pending signals does this user have? */ 742 atomic_t sigpending; /* How many pending signals does this user have? */
750#ifdef CONFIG_INOTIFY_USER 743#ifdef CONFIG_INOTIFY_USER
751 atomic_t inotify_watches; /* How many inotify watches does this user have? */ 744 atomic_t inotify_watches; /* How many inotify watches does this user have? */
@@ -854,10 +847,10 @@ enum cpu_idle_type {
854}; 847};
855 848
856/* 849/*
857 * Increase resolution of cpu_power calculations 850 * Increase resolution of cpu_capacity calculations
858 */ 851 */
859#define SCHED_POWER_SHIFT 10 852#define SCHED_CAPACITY_SHIFT 10
860#define SCHED_POWER_SCALE (1L << SCHED_POWER_SHIFT) 853#define SCHED_CAPACITY_SCALE (1L << SCHED_CAPACITY_SHIFT)
861 854
862/* 855/*
863 * sched-domains (multiprocessor balancing) declarations: 856 * sched-domains (multiprocessor balancing) declarations:
@@ -869,7 +862,8 @@ enum cpu_idle_type {
869#define SD_BALANCE_FORK 0x0008 /* Balance on fork, clone */ 862#define SD_BALANCE_FORK 0x0008 /* Balance on fork, clone */
870#define SD_BALANCE_WAKE 0x0010 /* Balance on wakeup */ 863#define SD_BALANCE_WAKE 0x0010 /* Balance on wakeup */
871#define SD_WAKE_AFFINE 0x0020 /* Wake task to waking CPU */ 864#define SD_WAKE_AFFINE 0x0020 /* Wake task to waking CPU */
872#define SD_SHARE_CPUPOWER 0x0080 /* Domain members share cpu power */ 865#define SD_SHARE_CPUCAPACITY 0x0080 /* Domain members share cpu power */
866#define SD_SHARE_POWERDOMAIN 0x0100 /* Domain members share power domain */
873#define SD_SHARE_PKG_RESOURCES 0x0200 /* Domain members share cpu pkg resources */ 867#define SD_SHARE_PKG_RESOURCES 0x0200 /* Domain members share cpu pkg resources */
874#define SD_SERIALIZE 0x0400 /* Only a single load balancing instance */ 868#define SD_SERIALIZE 0x0400 /* Only a single load balancing instance */
875#define SD_ASYM_PACKING 0x0800 /* Place busy groups earlier in the domain */ 869#define SD_ASYM_PACKING 0x0800 /* Place busy groups earlier in the domain */
@@ -877,7 +871,26 @@ enum cpu_idle_type {
877#define SD_OVERLAP 0x2000 /* sched_domains of this level overlap */ 871#define SD_OVERLAP 0x2000 /* sched_domains of this level overlap */
878#define SD_NUMA 0x4000 /* cross-node balancing */ 872#define SD_NUMA 0x4000 /* cross-node balancing */
879 873
880extern int __weak arch_sd_sibiling_asym_packing(void); 874#ifdef CONFIG_SCHED_SMT
875static inline const int cpu_smt_flags(void)
876{
877 return SD_SHARE_CPUCAPACITY | SD_SHARE_PKG_RESOURCES;
878}
879#endif
880
881#ifdef CONFIG_SCHED_MC
882static inline const int cpu_core_flags(void)
883{
884 return SD_SHARE_PKG_RESOURCES;
885}
886#endif
887
888#ifdef CONFIG_NUMA
889static inline const int cpu_numa_flags(void)
890{
891 return SD_NUMA;
892}
893#endif
881 894
882struct sched_domain_attr { 895struct sched_domain_attr {
883 int relax_domain_level; 896 int relax_domain_level;
@@ -985,6 +998,38 @@ void free_sched_domains(cpumask_var_t doms[], unsigned int ndoms);
985 998
986bool cpus_share_cache(int this_cpu, int that_cpu); 999bool cpus_share_cache(int this_cpu, int that_cpu);
987 1000
1001typedef const struct cpumask *(*sched_domain_mask_f)(int cpu);
1002typedef const int (*sched_domain_flags_f)(void);
1003
1004#define SDTL_OVERLAP 0x01
1005
1006struct sd_data {
1007 struct sched_domain **__percpu sd;
1008 struct sched_group **__percpu sg;
1009 struct sched_group_capacity **__percpu sgc;
1010};
1011
1012struct sched_domain_topology_level {
1013 sched_domain_mask_f mask;
1014 sched_domain_flags_f sd_flags;
1015 int flags;
1016 int numa_level;
1017 struct sd_data data;
1018#ifdef CONFIG_SCHED_DEBUG
1019 char *name;
1020#endif
1021};
1022
1023extern struct sched_domain_topology_level *sched_domain_topology;
1024
1025extern void set_sched_topology(struct sched_domain_topology_level *tl);
1026
1027#ifdef CONFIG_SCHED_DEBUG
1028# define SD_INIT_NAME(type) .name = #type
1029#else
1030# define SD_INIT_NAME(type)
1031#endif
1032
988#else /* CONFIG_SMP */ 1033#else /* CONFIG_SMP */
989 1034
990struct sched_domain_attr; 1035struct sched_domain_attr;
@@ -1123,8 +1168,8 @@ struct sched_dl_entity {
1123 1168
1124 /* 1169 /*
1125 * Original scheduling parameters. Copied here from sched_attr 1170 * Original scheduling parameters. Copied here from sched_attr
1126 * during sched_setscheduler2(), they will remain the same until 1171 * during sched_setattr(), they will remain the same until
1127 * the next sched_setscheduler2(). 1172 * the next sched_setattr().
1128 */ 1173 */
1129 u64 dl_runtime; /* maximum runtime for each instance */ 1174 u64 dl_runtime; /* maximum runtime for each instance */
1130 u64 dl_deadline; /* relative deadline of each instance */ 1175 u64 dl_deadline; /* relative deadline of each instance */
@@ -1153,9 +1198,12 @@ struct sched_dl_entity {
1153 * 1198 *
1154 * @dl_boosted tells if we are boosted due to DI. If so we are 1199 * @dl_boosted tells if we are boosted due to DI. If so we are
1155 * outside bandwidth enforcement mechanism (but only until we 1200 * outside bandwidth enforcement mechanism (but only until we
1156 * exit the critical section). 1201 * exit the critical section);
1202 *
1203 * @dl_yielded tells if task gave up the cpu before consuming
1204 * all its available runtime during the last job.
1157 */ 1205 */
1158 int dl_throttled, dl_new, dl_boosted; 1206 int dl_throttled, dl_new, dl_boosted, dl_yielded;
1159 1207
1160 /* 1208 /*
1161 * Bandwidth enforcement timer. Each -deadline task has its 1209 * Bandwidth enforcement timer. Each -deadline task has its
@@ -2125,7 +2173,7 @@ static inline void sched_autogroup_fork(struct signal_struct *sig) { }
2125static inline void sched_autogroup_exit(struct signal_struct *sig) { } 2173static inline void sched_autogroup_exit(struct signal_struct *sig) { }
2126#endif 2174#endif
2127 2175
2128extern bool yield_to(struct task_struct *p, bool preempt); 2176extern int yield_to(struct task_struct *p, bool preempt);
2129extern void set_user_nice(struct task_struct *p, long nice); 2177extern void set_user_nice(struct task_struct *p, long nice);
2130extern int task_prio(const struct task_struct *p); 2178extern int task_prio(const struct task_struct *p);
2131/** 2179/**
@@ -2366,9 +2414,6 @@ extern void flush_itimer_signals(void);
2366 2414
2367extern void do_group_exit(int); 2415extern void do_group_exit(int);
2368 2416
2369extern int allow_signal(int);
2370extern int disallow_signal(int);
2371
2372extern int do_execve(struct filename *, 2417extern int do_execve(struct filename *,
2373 const char __user * const __user *, 2418 const char __user * const __user *,
2374 const char __user * const __user *); 2419 const char __user * const __user *);
@@ -2376,7 +2421,11 @@ extern long do_fork(unsigned long, unsigned long, unsigned long, int __user *, i
2376struct task_struct *fork_idle(int); 2421struct task_struct *fork_idle(int);
2377extern pid_t kernel_thread(int (*fn)(void *), void *arg, unsigned long flags); 2422extern pid_t kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
2378 2423
2379extern void set_task_comm(struct task_struct *tsk, const char *from); 2424extern void __set_task_comm(struct task_struct *tsk, const char *from, bool exec);
2425static inline void set_task_comm(struct task_struct *tsk, const char *from)
2426{
2427 __set_task_comm(tsk, from, false);
2428}
2380extern char *get_task_comm(char *to, struct task_struct *tsk); 2429extern char *get_task_comm(char *to, struct task_struct *tsk);
2381 2430
2382#ifdef CONFIG_SMP 2431#ifdef CONFIG_SMP
@@ -2720,51 +2769,9 @@ static inline int spin_needbreak(spinlock_t *lock)
2720 2769
2721/* 2770/*
2722 * Idle thread specific functions to determine the need_resched 2771 * Idle thread specific functions to determine the need_resched
2723 * polling state. We have two versions, one based on TS_POLLING in 2772 * polling state.
2724 * thread_info.status and one based on TIF_POLLING_NRFLAG in
2725 * thread_info.flags
2726 */ 2773 */
2727#ifdef TS_POLLING 2774#ifdef TIF_POLLING_NRFLAG
2728static inline int tsk_is_polling(struct task_struct *p)
2729{
2730 return task_thread_info(p)->status & TS_POLLING;
2731}
2732static inline void __current_set_polling(void)
2733{
2734 current_thread_info()->status |= TS_POLLING;
2735}
2736
2737static inline bool __must_check current_set_polling_and_test(void)
2738{
2739 __current_set_polling();
2740
2741 /*
2742 * Polling state must be visible before we test NEED_RESCHED,
2743 * paired by resched_task()
2744 */
2745 smp_mb();
2746
2747 return unlikely(tif_need_resched());
2748}
2749
2750static inline void __current_clr_polling(void)
2751{
2752 current_thread_info()->status &= ~TS_POLLING;
2753}
2754
2755static inline bool __must_check current_clr_polling_and_test(void)
2756{
2757 __current_clr_polling();
2758
2759 /*
2760 * Polling state must be visible before we test NEED_RESCHED,
2761 * paired by resched_task()
2762 */
2763 smp_mb();
2764
2765 return unlikely(tif_need_resched());
2766}
2767#elif defined(TIF_POLLING_NRFLAG)
2768static inline int tsk_is_polling(struct task_struct *p) 2775static inline int tsk_is_polling(struct task_struct *p)
2769{ 2776{
2770 return test_tsk_thread_flag(p, TIF_POLLING_NRFLAG); 2777 return test_tsk_thread_flag(p, TIF_POLLING_NRFLAG);
@@ -2782,10 +2789,8 @@ static inline bool __must_check current_set_polling_and_test(void)
2782 /* 2789 /*
2783 * Polling state must be visible before we test NEED_RESCHED, 2790 * Polling state must be visible before we test NEED_RESCHED,
2784 * paired by resched_task() 2791 * paired by resched_task()
2785 *
2786 * XXX: assumes set/clear bit are identical barrier wise.
2787 */ 2792 */
2788 smp_mb__after_clear_bit(); 2793 smp_mb__after_atomic();
2789 2794
2790 return unlikely(tif_need_resched()); 2795 return unlikely(tif_need_resched());
2791} 2796}
@@ -2803,7 +2808,7 @@ static inline bool __must_check current_clr_polling_and_test(void)
2803 * Polling state must be visible before we test NEED_RESCHED, 2808 * Polling state must be visible before we test NEED_RESCHED,
2804 * paired by resched_task() 2809 * paired by resched_task()
2805 */ 2810 */
2806 smp_mb__after_clear_bit(); 2811 smp_mb__after_atomic();
2807 2812
2808 return unlikely(tif_need_resched()); 2813 return unlikely(tif_need_resched());
2809} 2814}
@@ -2956,7 +2961,7 @@ static inline void inc_syscw(struct task_struct *tsk)
2956#define TASK_SIZE_OF(tsk) TASK_SIZE 2961#define TASK_SIZE_OF(tsk) TASK_SIZE
2957#endif 2962#endif
2958 2963
2959#ifdef CONFIG_MM_OWNER 2964#ifdef CONFIG_MEMCG
2960extern void mm_update_next_owner(struct mm_struct *mm); 2965extern void mm_update_next_owner(struct mm_struct *mm);
2961extern void mm_init_owner(struct mm_struct *mm, struct task_struct *p); 2966extern void mm_init_owner(struct mm_struct *mm, struct task_struct *p);
2962#else 2967#else
@@ -2967,7 +2972,7 @@ static inline void mm_update_next_owner(struct mm_struct *mm)
2967static inline void mm_init_owner(struct mm_struct *mm, struct task_struct *p) 2972static inline void mm_init_owner(struct mm_struct *mm, struct task_struct *p)
2968{ 2973{
2969} 2974}
2970#endif /* CONFIG_MM_OWNER */ 2975#endif /* CONFIG_MEMCG */
2971 2976
2972static inline unsigned long task_rlimit(const struct task_struct *tsk, 2977static inline unsigned long task_rlimit(const struct task_struct *tsk,
2973 unsigned int limit) 2978 unsigned int limit)
diff --git a/include/linux/sched/prio.h b/include/linux/sched/prio.h
index ac322583c820..d9cf5a5762d9 100644
--- a/include/linux/sched/prio.h
+++ b/include/linux/sched/prio.h
@@ -41,4 +41,20 @@
41#define TASK_USER_PRIO(p) USER_PRIO((p)->static_prio) 41#define TASK_USER_PRIO(p) USER_PRIO((p)->static_prio)
42#define MAX_USER_PRIO (USER_PRIO(MAX_PRIO)) 42#define MAX_USER_PRIO (USER_PRIO(MAX_PRIO))
43 43
44/*
45 * Convert nice value [19,-20] to rlimit style value [1,40].
46 */
47static inline long nice_to_rlimit(long nice)
48{
49 return (MAX_NICE - nice + 1);
50}
51
52/*
53 * Convert rlimit style value [1,40] to nice value [-20, 19].
54 */
55static inline long rlimit_to_nice(long prio)
56{
57 return (MAX_NICE - prio + 1);
58}
59
44#endif /* _SCHED_PRIO_H */ 60#endif /* _SCHED_PRIO_H */
diff --git a/include/linux/sched/sysctl.h b/include/linux/sched/sysctl.h
index 8045a554cafb..596a0e007c62 100644
--- a/include/linux/sched/sysctl.h
+++ b/include/linux/sched/sysctl.h
@@ -25,6 +25,10 @@ enum { sysctl_hung_task_timeout_secs = 0 };
25 * Because the kernel adds some informative sections to a image of program at 25 * Because the kernel adds some informative sections to a image of program at
26 * generating coredump, we need some margin. The number of extra sections is 26 * generating coredump, we need some margin. The number of extra sections is
27 * 1-3 now and depends on arch. We use "5" as safe margin, here. 27 * 1-3 now and depends on arch. We use "5" as safe margin, here.
28 *
29 * ELF extended numbering allows more than 65535 sections, so 16-bit bound is
30 * not a hard limit any more. Although some userspace tools can be surprised by
31 * that.
28 */ 32 */
29#define MAPCOUNT_ELF_CORE_MARGIN (5) 33#define MAPCOUNT_ELF_CORE_MARGIN (5)
30#define DEFAULT_MAX_MAP_COUNT (USHRT_MAX - MAPCOUNT_ELF_CORE_MARGIN) 34#define DEFAULT_MAX_MAP_COUNT (USHRT_MAX - MAPCOUNT_ELF_CORE_MARGIN)
diff --git a/include/linux/sched_clock.h b/include/linux/sched_clock.h
index cddf0c2940b6..efa931c5cef1 100644
--- a/include/linux/sched_clock.h
+++ b/include/linux/sched_clock.h
@@ -14,7 +14,6 @@ extern void sched_clock_postinit(void);
14static inline void sched_clock_postinit(void) { } 14static inline void sched_clock_postinit(void) { }
15#endif 15#endif
16 16
17extern void setup_sched_clock(u32 (*read)(void), int bits, unsigned long rate);
18extern void sched_clock_register(u64 (*read)(void), int bits, 17extern void sched_clock_register(u64 (*read)(void), int bits,
19 unsigned long rate); 18 unsigned long rate);
20 19
diff --git a/include/linux/security.h b/include/linux/security.h
index 6478ce3252c7..9c6b9722ff48 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -1708,7 +1708,7 @@ struct security_operations {
1708 void (*key_free) (struct key *key); 1708 void (*key_free) (struct key *key);
1709 int (*key_permission) (key_ref_t key_ref, 1709 int (*key_permission) (key_ref_t key_ref,
1710 const struct cred *cred, 1710 const struct cred *cred,
1711 key_perm_t perm); 1711 unsigned perm);
1712 int (*key_getsecurity)(struct key *key, char **_buffer); 1712 int (*key_getsecurity)(struct key *key, char **_buffer);
1713#endif /* CONFIG_KEYS */ 1713#endif /* CONFIG_KEYS */
1714 1714
@@ -3034,7 +3034,7 @@ static inline int security_path_chroot(struct path *path)
3034int security_key_alloc(struct key *key, const struct cred *cred, unsigned long flags); 3034int security_key_alloc(struct key *key, const struct cred *cred, unsigned long flags);
3035void security_key_free(struct key *key); 3035void security_key_free(struct key *key);
3036int security_key_permission(key_ref_t key_ref, 3036int security_key_permission(key_ref_t key_ref,
3037 const struct cred *cred, key_perm_t perm); 3037 const struct cred *cred, unsigned perm);
3038int security_key_getsecurity(struct key *key, char **_buffer); 3038int security_key_getsecurity(struct key *key, char **_buffer);
3039 3039
3040#else 3040#else
@@ -3052,7 +3052,7 @@ static inline void security_key_free(struct key *key)
3052 3052
3053static inline int security_key_permission(key_ref_t key_ref, 3053static inline int security_key_permission(key_ref_t key_ref,
3054 const struct cred *cred, 3054 const struct cred *cred,
3055 key_perm_t perm) 3055 unsigned perm)
3056{ 3056{
3057 return 0; 3057 return 0;
3058} 3058}
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index f729be981da0..5bbb809ee197 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -285,6 +285,28 @@ static inline int uart_poll_timeout(struct uart_port *port)
285/* 285/*
286 * Console helpers. 286 * Console helpers.
287 */ 287 */
288struct earlycon_device {
289 struct console *con;
290 struct uart_port port;
291 char options[16]; /* e.g., 115200n8 */
292 unsigned int baud;
293};
294int setup_earlycon(char *buf, const char *match,
295 int (*setup)(struct earlycon_device *, const char *));
296
297extern int of_setup_earlycon(unsigned long addr,
298 int (*setup)(struct earlycon_device *, const char *));
299
300#define EARLYCON_DECLARE(name, func) \
301static int __init name ## _setup_earlycon(char *buf) \
302{ \
303 return setup_earlycon(buf, __stringify(name), func); \
304} \
305early_param("earlycon", name ## _setup_earlycon);
306
307#define OF_EARLYCON_DECLARE(name, compat, fn) \
308 _OF_DECLARE(earlycon, name, compat, fn, void *)
309
288struct uart_port *uart_get_console(struct uart_port *ports, int nr, 310struct uart_port *uart_get_console(struct uart_port *ports, int nr,
289 struct console *c); 311 struct console *c);
290void uart_parse_options(char *options, int *baud, int *parity, int *bits, 312void uart_parse_options(char *options, int *baud, int *parity, int *bits,
diff --git a/include/linux/sh_timer.h b/include/linux/sh_timer.h
index 4d9dcd138315..8e1e036d6d45 100644
--- a/include/linux/sh_timer.h
+++ b/include/linux/sh_timer.h
@@ -7,6 +7,7 @@ struct sh_timer_config {
7 int timer_bit; 7 int timer_bit;
8 unsigned long clockevent_rating; 8 unsigned long clockevent_rating;
9 unsigned long clocksource_rating; 9 unsigned long clocksource_rating;
10 unsigned int channels_mask;
10}; 11};
11 12
12#endif /* __SH_TIMER_H__ */ 13#endif /* __SH_TIMER_H__ */
diff --git a/include/linux/shdma-base.h b/include/linux/shdma-base.h
index f92c0a43c54c..abdf1f229dc3 100644
--- a/include/linux/shdma-base.h
+++ b/include/linux/shdma-base.h
@@ -54,6 +54,7 @@ struct shdma_desc {
54 dma_cookie_t cookie; 54 dma_cookie_t cookie;
55 int chunks; 55 int chunks;
56 int mark; 56 int mark;
57 bool cyclic; /* used as cyclic transfer */
57}; 58};
58 59
59struct shdma_chan { 60struct shdma_chan {
diff --git a/include/linux/shm.h b/include/linux/shm.h
index 1e2cd2e6b540..57d77709fbe2 100644
--- a/include/linux/shm.h
+++ b/include/linux/shm.h
@@ -3,9 +3,8 @@
3 3
4#include <asm/page.h> 4#include <asm/page.h>
5#include <uapi/linux/shm.h> 5#include <uapi/linux/shm.h>
6
7#define SHMALL (SHMMAX/PAGE_SIZE*(SHMMNI/16)) /* max shm system wide (pages) */
8#include <asm/shmparam.h> 6#include <asm/shmparam.h>
7
9struct shmid_kernel /* private to the kernel */ 8struct shmid_kernel /* private to the kernel */
10{ 9{
11 struct kern_ipc_perm shm_perm; 10 struct kern_ipc_perm shm_perm;
diff --git a/include/linux/signal.h b/include/linux/signal.h
index 2ac423bdb676..c9e65360c49a 100644
--- a/include/linux/signal.h
+++ b/include/linux/signal.h
@@ -63,11 +63,6 @@ static inline int sigismember(sigset_t *set, int _sig)
63 return 1 & (set->sig[sig / _NSIG_BPW] >> (sig % _NSIG_BPW)); 63 return 1 & (set->sig[sig / _NSIG_BPW] >> (sig % _NSIG_BPW));
64} 64}
65 65
66static inline int sigfindinword(unsigned long word)
67{
68 return ffz(~word);
69}
70
71#endif /* __HAVE_ARCH_SIG_BITOPS */ 66#endif /* __HAVE_ARCH_SIG_BITOPS */
72 67
73static inline int sigisemptyset(sigset_t *set) 68static inline int sigisemptyset(sigset_t *set)
@@ -289,6 +284,22 @@ extern int get_signal_to_deliver(siginfo_t *info, struct k_sigaction *return_ka,
289extern void signal_setup_done(int failed, struct ksignal *ksig, int stepping); 284extern void signal_setup_done(int failed, struct ksignal *ksig, int stepping);
290extern void signal_delivered(int sig, siginfo_t *info, struct k_sigaction *ka, struct pt_regs *regs, int stepping); 285extern void signal_delivered(int sig, siginfo_t *info, struct k_sigaction *ka, struct pt_regs *regs, int stepping);
291extern void exit_signals(struct task_struct *tsk); 286extern void exit_signals(struct task_struct *tsk);
287extern void kernel_sigaction(int, __sighandler_t);
288
289static inline void allow_signal(int sig)
290{
291 /*
292 * Kernel threads handle their own signals. Let the signal code
293 * know it'll be handled, so that they don't get converted to
294 * SIGKILL or just silently dropped.
295 */
296 kernel_sigaction(sig, (__force __sighandler_t)2);
297}
298
299static inline void disallow_signal(int sig)
300{
301 kernel_sigaction(sig, SIG_IGN);
302}
292 303
293/* 304/*
294 * Eventually that'll replace get_signal_to_deliver(); macro for now, 305 * Eventually that'll replace get_signal_to_deliver(); macro for now,
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 08074a810164..ec89301ada41 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -338,13 +338,18 @@ enum {
338 338
339 SKB_GSO_GRE = 1 << 6, 339 SKB_GSO_GRE = 1 << 6,
340 340
341 SKB_GSO_IPIP = 1 << 7, 341 SKB_GSO_GRE_CSUM = 1 << 7,
342 342
343 SKB_GSO_SIT = 1 << 8, 343 SKB_GSO_IPIP = 1 << 8,
344 344
345 SKB_GSO_UDP_TUNNEL = 1 << 9, 345 SKB_GSO_SIT = 1 << 9,
346
347 SKB_GSO_UDP_TUNNEL = 1 << 10,
348
349 SKB_GSO_UDP_TUNNEL_CSUM = 1 << 11,
350
351 SKB_GSO_MPLS = 1 << 12,
346 352
347 SKB_GSO_MPLS = 1 << 10,
348}; 353};
349 354
350#if BITS_PER_LONG > 32 355#if BITS_PER_LONG > 32
@@ -426,7 +431,7 @@ static inline u32 skb_mstamp_us_delta(const struct skb_mstamp *t1,
426 * @csum_start: Offset from skb->head where checksumming should start 431 * @csum_start: Offset from skb->head where checksumming should start
427 * @csum_offset: Offset from csum_start where checksum should be stored 432 * @csum_offset: Offset from csum_start where checksum should be stored
428 * @priority: Packet queueing priority 433 * @priority: Packet queueing priority
429 * @local_df: allow local fragmentation 434 * @ignore_df: allow local fragmentation
430 * @cloned: Head may be cloned (check refcnt to be sure) 435 * @cloned: Head may be cloned (check refcnt to be sure)
431 * @ip_summed: Driver fed us an IP checksum 436 * @ip_summed: Driver fed us an IP checksum
432 * @nohdr: Payload reference only, must not modify header 437 * @nohdr: Payload reference only, must not modify header
@@ -514,7 +519,7 @@ struct sk_buff {
514 }; 519 };
515 __u32 priority; 520 __u32 priority;
516 kmemcheck_bitfield_begin(flags1); 521 kmemcheck_bitfield_begin(flags1);
517 __u8 local_df:1, 522 __u8 ignore_df:1,
518 cloned:1, 523 cloned:1,
519 ip_summed:2, 524 ip_summed:2,
520 nohdr:1, 525 nohdr:1,
@@ -567,7 +572,10 @@ struct sk_buff {
567 * headers if needed 572 * headers if needed
568 */ 573 */
569 __u8 encapsulation:1; 574 __u8 encapsulation:1;
570 /* 6/8 bit hole (depending on ndisc_nodetype presence) */ 575 __u8 encap_hdr_csum:1;
576 __u8 csum_valid:1;
577 __u8 csum_complete_sw:1;
578 /* 3/5 bit hole (depending on ndisc_nodetype presence) */
571 kmemcheck_bitfield_end(flags2); 579 kmemcheck_bitfield_end(flags2);
572 580
573#if defined CONFIG_NET_DMA || defined CONFIG_NET_RX_BUSY_POLL 581#if defined CONFIG_NET_DMA || defined CONFIG_NET_RX_BUSY_POLL
@@ -739,7 +747,13 @@ struct sk_buff *skb_morph(struct sk_buff *dst, struct sk_buff *src);
739int skb_copy_ubufs(struct sk_buff *skb, gfp_t gfp_mask); 747int skb_copy_ubufs(struct sk_buff *skb, gfp_t gfp_mask);
740struct sk_buff *skb_clone(struct sk_buff *skb, gfp_t priority); 748struct sk_buff *skb_clone(struct sk_buff *skb, gfp_t priority);
741struct sk_buff *skb_copy(const struct sk_buff *skb, gfp_t priority); 749struct sk_buff *skb_copy(const struct sk_buff *skb, gfp_t priority);
742struct sk_buff *__pskb_copy(struct sk_buff *skb, int headroom, gfp_t gfp_mask); 750struct sk_buff *__pskb_copy_fclone(struct sk_buff *skb, int headroom,
751 gfp_t gfp_mask, bool fclone);
752static inline struct sk_buff *__pskb_copy(struct sk_buff *skb, int headroom,
753 gfp_t gfp_mask)
754{
755 return __pskb_copy_fclone(skb, headroom, gfp_mask, false);
756}
743 757
744int pskb_expand_head(struct sk_buff *skb, int nhead, int ntail, gfp_t gfp_mask); 758int pskb_expand_head(struct sk_buff *skb, int nhead, int ntail, gfp_t gfp_mask);
745struct sk_buff *skb_realloc_headroom(struct sk_buff *skb, 759struct sk_buff *skb_realloc_headroom(struct sk_buff *skb,
@@ -1840,6 +1854,18 @@ static inline int pskb_network_may_pull(struct sk_buff *skb, unsigned int len)
1840 return pskb_may_pull(skb, skb_network_offset(skb) + len); 1854 return pskb_may_pull(skb, skb_network_offset(skb) + len);
1841} 1855}
1842 1856
1857static inline void skb_pop_rcv_encapsulation(struct sk_buff *skb)
1858{
1859 /* Only continue with checksum unnecessary if device indicated
1860 * it is valid across encapsulation (skb->encapsulation was set).
1861 */
1862 if (skb->ip_summed == CHECKSUM_UNNECESSARY && !skb->encapsulation)
1863 skb->ip_summed = CHECKSUM_NONE;
1864
1865 skb->encapsulation = 0;
1866 skb->csum_valid = 0;
1867}
1868
1843/* 1869/*
1844 * CPUs often take a performance hit when accessing unaligned memory 1870 * CPUs often take a performance hit when accessing unaligned memory
1845 * locations. The actual performance hit varies, it can be small if the 1871 * locations. The actual performance hit varies, it can be small if the
@@ -2233,6 +2259,14 @@ static inline struct sk_buff *pskb_copy(struct sk_buff *skb,
2233 return __pskb_copy(skb, skb_headroom(skb), gfp_mask); 2259 return __pskb_copy(skb, skb_headroom(skb), gfp_mask);
2234} 2260}
2235 2261
2262
2263static inline struct sk_buff *pskb_copy_for_clone(struct sk_buff *skb,
2264 gfp_t gfp_mask)
2265{
2266 return __pskb_copy_fclone(skb, skb_headroom(skb), gfp_mask, true);
2267}
2268
2269
2236/** 2270/**
2237 * skb_clone_writable - is the header of a clone writable 2271 * skb_clone_writable - is the header of a clone writable
2238 * @skb: buffer to check 2272 * @skb: buffer to check
@@ -2716,7 +2750,7 @@ __sum16 __skb_checksum_complete(struct sk_buff *skb);
2716 2750
2717static inline int skb_csum_unnecessary(const struct sk_buff *skb) 2751static inline int skb_csum_unnecessary(const struct sk_buff *skb)
2718{ 2752{
2719 return skb->ip_summed & CHECKSUM_UNNECESSARY; 2753 return ((skb->ip_summed & CHECKSUM_UNNECESSARY) || skb->csum_valid);
2720} 2754}
2721 2755
2722/** 2756/**
@@ -2741,6 +2775,103 @@ static inline __sum16 skb_checksum_complete(struct sk_buff *skb)
2741 0 : __skb_checksum_complete(skb); 2775 0 : __skb_checksum_complete(skb);
2742} 2776}
2743 2777
2778/* Check if we need to perform checksum complete validation.
2779 *
2780 * Returns true if checksum complete is needed, false otherwise
2781 * (either checksum is unnecessary or zero checksum is allowed).
2782 */
2783static inline bool __skb_checksum_validate_needed(struct sk_buff *skb,
2784 bool zero_okay,
2785 __sum16 check)
2786{
2787 if (skb_csum_unnecessary(skb) || (zero_okay && !check)) {
2788 skb->csum_valid = 1;
2789 return false;
2790 }
2791
2792 return true;
2793}
2794
2795/* For small packets <= CHECKSUM_BREAK peform checksum complete directly
2796 * in checksum_init.
2797 */
2798#define CHECKSUM_BREAK 76
2799
2800/* Validate (init) checksum based on checksum complete.
2801 *
2802 * Return values:
2803 * 0: checksum is validated or try to in skb_checksum_complete. In the latter
2804 * case the ip_summed will not be CHECKSUM_UNNECESSARY and the pseudo
2805 * checksum is stored in skb->csum for use in __skb_checksum_complete
2806 * non-zero: value of invalid checksum
2807 *
2808 */
2809static inline __sum16 __skb_checksum_validate_complete(struct sk_buff *skb,
2810 bool complete,
2811 __wsum psum)
2812{
2813 if (skb->ip_summed == CHECKSUM_COMPLETE) {
2814 if (!csum_fold(csum_add(psum, skb->csum))) {
2815 skb->csum_valid = 1;
2816 return 0;
2817 }
2818 }
2819
2820 skb->csum = psum;
2821
2822 if (complete || skb->len <= CHECKSUM_BREAK) {
2823 __sum16 csum;
2824
2825 csum = __skb_checksum_complete(skb);
2826 skb->csum_valid = !csum;
2827 return csum;
2828 }
2829
2830 return 0;
2831}
2832
2833static inline __wsum null_compute_pseudo(struct sk_buff *skb, int proto)
2834{
2835 return 0;
2836}
2837
2838/* Perform checksum validate (init). Note that this is a macro since we only
2839 * want to calculate the pseudo header which is an input function if necessary.
2840 * First we try to validate without any computation (checksum unnecessary) and
2841 * then calculate based on checksum complete calling the function to compute
2842 * pseudo header.
2843 *
2844 * Return values:
2845 * 0: checksum is validated or try to in skb_checksum_complete
2846 * non-zero: value of invalid checksum
2847 */
2848#define __skb_checksum_validate(skb, proto, complete, \
2849 zero_okay, check, compute_pseudo) \
2850({ \
2851 __sum16 __ret = 0; \
2852 skb->csum_valid = 0; \
2853 if (__skb_checksum_validate_needed(skb, zero_okay, check)) \
2854 __ret = __skb_checksum_validate_complete(skb, \
2855 complete, compute_pseudo(skb, proto)); \
2856 __ret; \
2857})
2858
2859#define skb_checksum_init(skb, proto, compute_pseudo) \
2860 __skb_checksum_validate(skb, proto, false, false, 0, compute_pseudo)
2861
2862#define skb_checksum_init_zero_check(skb, proto, check, compute_pseudo) \
2863 __skb_checksum_validate(skb, proto, false, true, check, compute_pseudo)
2864
2865#define skb_checksum_validate(skb, proto, compute_pseudo) \
2866 __skb_checksum_validate(skb, proto, true, false, 0, compute_pseudo)
2867
2868#define skb_checksum_validate_zero_check(skb, proto, check, \
2869 compute_pseudo) \
2870 __skb_checksum_validate_(skb, proto, true, true, check, compute_pseudo)
2871
2872#define skb_checksum_simple_validate(skb) \
2873 __skb_checksum_validate(skb, 0, true, false, 0, null_compute_pseudo)
2874
2744#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 2875#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
2745void nf_conntrack_destroy(struct nf_conntrack *nfct); 2876void nf_conntrack_destroy(struct nf_conntrack *nfct);
2746static inline void nf_conntrack_put(struct nf_conntrack *nfct) 2877static inline void nf_conntrack_put(struct nf_conntrack *nfct)
@@ -2895,6 +3026,7 @@ static inline struct sec_path *skb_sec_path(struct sk_buff *skb)
2895struct skb_gso_cb { 3026struct skb_gso_cb {
2896 int mac_offset; 3027 int mac_offset;
2897 int encap_level; 3028 int encap_level;
3029 __u16 csum_start;
2898}; 3030};
2899#define SKB_GSO_CB(skb) ((struct skb_gso_cb *)(skb)->cb) 3031#define SKB_GSO_CB(skb) ((struct skb_gso_cb *)(skb)->cb)
2900 3032
@@ -2919,6 +3051,28 @@ static inline int gso_pskb_expand_head(struct sk_buff *skb, int extra)
2919 return 0; 3051 return 0;
2920} 3052}
2921 3053
3054/* Compute the checksum for a gso segment. First compute the checksum value
3055 * from the start of transport header to SKB_GSO_CB(skb)->csum_start, and
3056 * then add in skb->csum (checksum from csum_start to end of packet).
3057 * skb->csum and csum_start are then updated to reflect the checksum of the
3058 * resultant packet starting from the transport header-- the resultant checksum
3059 * is in the res argument (i.e. normally zero or ~ of checksum of a pseudo
3060 * header.
3061 */
3062static inline __sum16 gso_make_checksum(struct sk_buff *skb, __wsum res)
3063{
3064 int plen = SKB_GSO_CB(skb)->csum_start - skb_headroom(skb) -
3065 skb_transport_offset(skb);
3066 __u16 csum;
3067
3068 csum = csum_fold(csum_partial(skb_transport_header(skb),
3069 plen, skb->csum));
3070 skb->csum = res;
3071 SKB_GSO_CB(skb)->csum_start -= plen;
3072
3073 return csum;
3074}
3075
2922static inline bool skb_is_gso(const struct sk_buff *skb) 3076static inline bool skb_is_gso(const struct sk_buff *skb)
2923{ 3077{
2924 return skb_shinfo(skb)->gso_size; 3078 return skb_shinfo(skb)->gso_size;
diff --git a/include/linux/slab.h b/include/linux/slab.h
index 307bfbe62387..1d9abb7d22a0 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -116,7 +116,9 @@ struct kmem_cache *kmem_cache_create(const char *, size_t, size_t,
116 unsigned long, 116 unsigned long,
117 void (*)(void *)); 117 void (*)(void *));
118#ifdef CONFIG_MEMCG_KMEM 118#ifdef CONFIG_MEMCG_KMEM
119void kmem_cache_create_memcg(struct mem_cgroup *, struct kmem_cache *); 119struct kmem_cache *memcg_create_kmem_cache(struct mem_cgroup *,
120 struct kmem_cache *,
121 const char *);
120#endif 122#endif
121void kmem_cache_destroy(struct kmem_cache *); 123void kmem_cache_destroy(struct kmem_cache *);
122int kmem_cache_shrink(struct kmem_cache *); 124int kmem_cache_shrink(struct kmem_cache *);
@@ -369,16 +371,7 @@ kmem_cache_alloc_node_trace(struct kmem_cache *s,
369#include <linux/slub_def.h> 371#include <linux/slub_def.h>
370#endif 372#endif
371 373
372static __always_inline void * 374extern void *kmalloc_order(size_t size, gfp_t flags, unsigned int order);
373kmalloc_order(size_t size, gfp_t flags, unsigned int order)
374{
375 void *ret;
376
377 flags |= (__GFP_COMP | __GFP_KMEMCG);
378 ret = (void *) __get_free_pages(flags, order);
379 kmemleak_alloc(ret, size, 1, flags);
380 return ret;
381}
382 375
383#ifdef CONFIG_TRACING 376#ifdef CONFIG_TRACING
384extern void *kmalloc_order_trace(size_t size, gfp_t flags, unsigned int order); 377extern void *kmalloc_order_trace(size_t size, gfp_t flags, unsigned int order);
@@ -533,10 +526,7 @@ static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node)
533 * @memcg: pointer to the memcg this cache belongs to 526 * @memcg: pointer to the memcg this cache belongs to
534 * @list: list_head for the list of all caches in this memcg 527 * @list: list_head for the list of all caches in this memcg
535 * @root_cache: pointer to the global, root cache, this cache was derived from 528 * @root_cache: pointer to the global, root cache, this cache was derived from
536 * @dead: set to true after the memcg dies; the cache may still be around.
537 * @nr_pages: number of pages that belongs to this cache. 529 * @nr_pages: number of pages that belongs to this cache.
538 * @destroy: worker to be called whenever we are ready, or believe we may be
539 * ready, to destroy this cache.
540 */ 530 */
541struct memcg_cache_params { 531struct memcg_cache_params {
542 bool is_root_cache; 532 bool is_root_cache;
@@ -549,9 +539,7 @@ struct memcg_cache_params {
549 struct mem_cgroup *memcg; 539 struct mem_cgroup *memcg;
550 struct list_head list; 540 struct list_head list;
551 struct kmem_cache *root_cache; 541 struct kmem_cache *root_cache;
552 bool dead;
553 atomic_t nr_pages; 542 atomic_t nr_pages;
554 struct work_struct destroy;
555 }; 543 };
556 }; 544 };
557}; 545};
diff --git a/include/linux/smp.h b/include/linux/smp.h
index 633f5edd7470..34347f26be9b 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -13,8 +13,6 @@
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/llist.h> 14#include <linux/llist.h>
15 15
16extern void cpu_idle(void);
17
18typedef void (*smp_call_func_t)(void *info); 16typedef void (*smp_call_func_t)(void *info);
19struct call_single_data { 17struct call_single_data {
20 struct llist_node llist; 18 struct llist_node llist;
diff --git a/include/linux/socket.h b/include/linux/socket.h
index 8e98297f1388..ec538fc287a6 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -305,8 +305,6 @@ struct ucred {
305/* IPX options */ 305/* IPX options */
306#define IPX_TYPE 1 306#define IPX_TYPE 1
307 307
308extern int memcpy_fromiovecend(unsigned char *kdata, const struct iovec *iov,
309 int offset, int len);
310extern int csum_partial_copy_fromiovecend(unsigned char *kdata, 308extern int csum_partial_copy_fromiovecend(unsigned char *kdata,
311 struct iovec *iov, 309 struct iovec *iov,
312 int offset, 310 int offset,
@@ -315,8 +313,6 @@ extern unsigned long iov_pages(const struct iovec *iov, int offset,
315 unsigned long nr_segs); 313 unsigned long nr_segs);
316 314
317extern int verify_iovec(struct msghdr *m, struct iovec *iov, struct sockaddr_storage *address, int mode); 315extern int verify_iovec(struct msghdr *m, struct iovec *iov, struct sockaddr_storage *address, int mode);
318extern int memcpy_toiovecend(const struct iovec *v, unsigned char *kdata,
319 int offset, int len);
320extern int move_addr_to_kernel(void __user *uaddr, int ulen, struct sockaddr_storage *kaddr); 316extern int move_addr_to_kernel(void __user *uaddr, int ulen, struct sockaddr_storage *kaddr);
321extern int put_cmsg(struct msghdr*, int level, int type, int len, void *data); 317extern int put_cmsg(struct msghdr*, int level, int type, int len, void *data);
322 318
diff --git a/include/linux/spi/adi_spi3.h b/include/linux/spi/adi_spi3.h
new file mode 100644
index 000000000000..c84123aa1d06
--- /dev/null
+++ b/include/linux/spi/adi_spi3.h
@@ -0,0 +1,254 @@
1/*
2 * Analog Devices SPI3 controller driver
3 *
4 * Copyright (c) 2014 Analog Devices 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 * 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#ifndef _ADI_SPI3_H_
17#define _ADI_SPI3_H_
18
19#include <linux/types.h>
20
21/* SPI_CONTROL */
22#define SPI_CTL_EN 0x00000001 /* Enable */
23#define SPI_CTL_MSTR 0x00000002 /* Master/Slave */
24#define SPI_CTL_PSSE 0x00000004 /* controls modf error in master mode */
25#define SPI_CTL_ODM 0x00000008 /* Open Drain Mode */
26#define SPI_CTL_CPHA 0x00000010 /* Clock Phase */
27#define SPI_CTL_CPOL 0x00000020 /* Clock Polarity */
28#define SPI_CTL_ASSEL 0x00000040 /* Slave Select Pin Control */
29#define SPI_CTL_SELST 0x00000080 /* Slave Select Polarity in-between transfers */
30#define SPI_CTL_EMISO 0x00000100 /* Enable MISO */
31#define SPI_CTL_SIZE 0x00000600 /* Word Transfer Size */
32#define SPI_CTL_SIZE08 0x00000000 /* SIZE: 8 bits */
33#define SPI_CTL_SIZE16 0x00000200 /* SIZE: 16 bits */
34#define SPI_CTL_SIZE32 0x00000400 /* SIZE: 32 bits */
35#define SPI_CTL_LSBF 0x00001000 /* LSB First */
36#define SPI_CTL_FCEN 0x00002000 /* Flow-Control Enable */
37#define SPI_CTL_FCCH 0x00004000 /* Flow-Control Channel Selection */
38#define SPI_CTL_FCPL 0x00008000 /* Flow-Control Polarity */
39#define SPI_CTL_FCWM 0x00030000 /* Flow-Control Water-Mark */
40#define SPI_CTL_FIFO0 0x00000000 /* FCWM: TFIFO empty or RFIFO Full */
41#define SPI_CTL_FIFO1 0x00010000 /* FCWM: TFIFO 75% or more empty or RFIFO 75% or more full */
42#define SPI_CTL_FIFO2 0x00020000 /* FCWM: TFIFO 50% or more empty or RFIFO 50% or more full */
43#define SPI_CTL_FMODE 0x00040000 /* Fast-mode Enable */
44#define SPI_CTL_MIOM 0x00300000 /* Multiple I/O Mode */
45#define SPI_CTL_MIO_DIS 0x00000000 /* MIOM: Disable */
46#define SPI_CTL_MIO_DUAL 0x00100000 /* MIOM: Enable DIOM (Dual I/O Mode) */
47#define SPI_CTL_MIO_QUAD 0x00200000 /* MIOM: Enable QUAD (Quad SPI Mode) */
48#define SPI_CTL_SOSI 0x00400000 /* Start on MOSI */
49/* SPI_RX_CONTROL */
50#define SPI_RXCTL_REN 0x00000001 /* Receive Channel Enable */
51#define SPI_RXCTL_RTI 0x00000004 /* Receive Transfer Initiate */
52#define SPI_RXCTL_RWCEN 0x00000008 /* Receive Word Counter Enable */
53#define SPI_RXCTL_RDR 0x00000070 /* Receive Data Request */
54#define SPI_RXCTL_RDR_DIS 0x00000000 /* RDR: Disabled */
55#define SPI_RXCTL_RDR_NE 0x00000010 /* RDR: RFIFO not empty */
56#define SPI_RXCTL_RDR_25 0x00000020 /* RDR: RFIFO 25% full */
57#define SPI_RXCTL_RDR_50 0x00000030 /* RDR: RFIFO 50% full */
58#define SPI_RXCTL_RDR_75 0x00000040 /* RDR: RFIFO 75% full */
59#define SPI_RXCTL_RDR_FULL 0x00000050 /* RDR: RFIFO full */
60#define SPI_RXCTL_RDO 0x00000100 /* Receive Data Over-Run */
61#define SPI_RXCTL_RRWM 0x00003000 /* FIFO Regular Water-Mark */
62#define SPI_RXCTL_RWM_0 0x00000000 /* RRWM: RFIFO Empty */
63#define SPI_RXCTL_RWM_25 0x00001000 /* RRWM: RFIFO 25% full */
64#define SPI_RXCTL_RWM_50 0x00002000 /* RRWM: RFIFO 50% full */
65#define SPI_RXCTL_RWM_75 0x00003000 /* RRWM: RFIFO 75% full */
66#define SPI_RXCTL_RUWM 0x00070000 /* FIFO Urgent Water-Mark */
67#define SPI_RXCTL_UWM_DIS 0x00000000 /* RUWM: Disabled */
68#define SPI_RXCTL_UWM_25 0x00010000 /* RUWM: RFIFO 25% full */
69#define SPI_RXCTL_UWM_50 0x00020000 /* RUWM: RFIFO 50% full */
70#define SPI_RXCTL_UWM_75 0x00030000 /* RUWM: RFIFO 75% full */
71#define SPI_RXCTL_UWM_FULL 0x00040000 /* RUWM: RFIFO full */
72/* SPI_TX_CONTROL */
73#define SPI_TXCTL_TEN 0x00000001 /* Transmit Channel Enable */
74#define SPI_TXCTL_TTI 0x00000004 /* Transmit Transfer Initiate */
75#define SPI_TXCTL_TWCEN 0x00000008 /* Transmit Word Counter Enable */
76#define SPI_TXCTL_TDR 0x00000070 /* Transmit Data Request */
77#define SPI_TXCTL_TDR_DIS 0x00000000 /* TDR: Disabled */
78#define SPI_TXCTL_TDR_NF 0x00000010 /* TDR: TFIFO not full */
79#define SPI_TXCTL_TDR_25 0x00000020 /* TDR: TFIFO 25% empty */
80#define SPI_TXCTL_TDR_50 0x00000030 /* TDR: TFIFO 50% empty */
81#define SPI_TXCTL_TDR_75 0x00000040 /* TDR: TFIFO 75% empty */
82#define SPI_TXCTL_TDR_EMPTY 0x00000050 /* TDR: TFIFO empty */
83#define SPI_TXCTL_TDU 0x00000100 /* Transmit Data Under-Run */
84#define SPI_TXCTL_TRWM 0x00003000 /* FIFO Regular Water-Mark */
85#define SPI_TXCTL_RWM_FULL 0x00000000 /* TRWM: TFIFO full */
86#define SPI_TXCTL_RWM_25 0x00001000 /* TRWM: TFIFO 25% empty */
87#define SPI_TXCTL_RWM_50 0x00002000 /* TRWM: TFIFO 50% empty */
88#define SPI_TXCTL_RWM_75 0x00003000 /* TRWM: TFIFO 75% empty */
89#define SPI_TXCTL_TUWM 0x00070000 /* FIFO Urgent Water-Mark */
90#define SPI_TXCTL_UWM_DIS 0x00000000 /* TUWM: Disabled */
91#define SPI_TXCTL_UWM_25 0x00010000 /* TUWM: TFIFO 25% empty */
92#define SPI_TXCTL_UWM_50 0x00020000 /* TUWM: TFIFO 50% empty */
93#define SPI_TXCTL_UWM_75 0x00030000 /* TUWM: TFIFO 75% empty */
94#define SPI_TXCTL_UWM_EMPTY 0x00040000 /* TUWM: TFIFO empty */
95/* SPI_CLOCK */
96#define SPI_CLK_BAUD 0x0000FFFF /* Baud Rate */
97/* SPI_DELAY */
98#define SPI_DLY_STOP 0x000000FF /* Transfer delay time in multiples of SCK period */
99#define SPI_DLY_LEADX 0x00000100 /* Extended (1 SCK) LEAD Control */
100#define SPI_DLY_LAGX 0x00000200 /* Extended (1 SCK) LAG control */
101/* SPI_SSEL */
102#define SPI_SLVSEL_SSE1 0x00000002 /* SPISSEL1 Enable */
103#define SPI_SLVSEL_SSE2 0x00000004 /* SPISSEL2 Enable */
104#define SPI_SLVSEL_SSE3 0x00000008 /* SPISSEL3 Enable */
105#define SPI_SLVSEL_SSE4 0x00000010 /* SPISSEL4 Enable */
106#define SPI_SLVSEL_SSE5 0x00000020 /* SPISSEL5 Enable */
107#define SPI_SLVSEL_SSE6 0x00000040 /* SPISSEL6 Enable */
108#define SPI_SLVSEL_SSE7 0x00000080 /* SPISSEL7 Enable */
109#define SPI_SLVSEL_SSEL1 0x00000200 /* SPISSEL1 Value */
110#define SPI_SLVSEL_SSEL2 0x00000400 /* SPISSEL2 Value */
111#define SPI_SLVSEL_SSEL3 0x00000800 /* SPISSEL3 Value */
112#define SPI_SLVSEL_SSEL4 0x00001000 /* SPISSEL4 Value */
113#define SPI_SLVSEL_SSEL5 0x00002000 /* SPISSEL5 Value */
114#define SPI_SLVSEL_SSEL6 0x00004000 /* SPISSEL6 Value */
115#define SPI_SLVSEL_SSEL7 0x00008000 /* SPISSEL7 Value */
116/* SPI_RWC */
117#define SPI_RWC_VALUE 0x0000FFFF /* Received Word-Count */
118/* SPI_RWCR */
119#define SPI_RWCR_VALUE 0x0000FFFF /* Received Word-Count Reload */
120/* SPI_TWC */
121#define SPI_TWC_VALUE 0x0000FFFF /* Transmitted Word-Count */
122/* SPI_TWCR */
123#define SPI_TWCR_VALUE 0x0000FFFF /* Transmitted Word-Count Reload */
124/* SPI_IMASK */
125#define SPI_IMSK_RUWM 0x00000002 /* Receive Urgent Water-Mark Interrupt Mask */
126#define SPI_IMSK_TUWM 0x00000004 /* Transmit Urgent Water-Mark Interrupt Mask */
127#define SPI_IMSK_ROM 0x00000010 /* Receive Over-Run Error Interrupt Mask */
128#define SPI_IMSK_TUM 0x00000020 /* Transmit Under-Run Error Interrupt Mask */
129#define SPI_IMSK_TCM 0x00000040 /* Transmit Collision Error Interrupt Mask */
130#define SPI_IMSK_MFM 0x00000080 /* Mode Fault Error Interrupt Mask */
131#define SPI_IMSK_RSM 0x00000100 /* Receive Start Interrupt Mask */
132#define SPI_IMSK_TSM 0x00000200 /* Transmit Start Interrupt Mask */
133#define SPI_IMSK_RFM 0x00000400 /* Receive Finish Interrupt Mask */
134#define SPI_IMSK_TFM 0x00000800 /* Transmit Finish Interrupt Mask */
135/* SPI_IMASKCL */
136#define SPI_IMSK_CLR_RUW 0x00000002 /* Receive Urgent Water-Mark Interrupt Mask */
137#define SPI_IMSK_CLR_TUWM 0x00000004 /* Transmit Urgent Water-Mark Interrupt Mask */
138#define SPI_IMSK_CLR_ROM 0x00000010 /* Receive Over-Run Error Interrupt Mask */
139#define SPI_IMSK_CLR_TUM 0x00000020 /* Transmit Under-Run Error Interrupt Mask */
140#define SPI_IMSK_CLR_TCM 0x00000040 /* Transmit Collision Error Interrupt Mask */
141#define SPI_IMSK_CLR_MFM 0x00000080 /* Mode Fault Error Interrupt Mask */
142#define SPI_IMSK_CLR_RSM 0x00000100 /* Receive Start Interrupt Mask */
143#define SPI_IMSK_CLR_TSM 0x00000200 /* Transmit Start Interrupt Mask */
144#define SPI_IMSK_CLR_RFM 0x00000400 /* Receive Finish Interrupt Mask */
145#define SPI_IMSK_CLR_TFM 0x00000800 /* Transmit Finish Interrupt Mask */
146/* SPI_IMASKST */
147#define SPI_IMSK_SET_RUWM 0x00000002 /* Receive Urgent Water-Mark Interrupt Mask */
148#define SPI_IMSK_SET_TUWM 0x00000004 /* Transmit Urgent Water-Mark Interrupt Mask */
149#define SPI_IMSK_SET_ROM 0x00000010 /* Receive Over-Run Error Interrupt Mask */
150#define SPI_IMSK_SET_TUM 0x00000020 /* Transmit Under-Run Error Interrupt Mask */
151#define SPI_IMSK_SET_TCM 0x00000040 /* Transmit Collision Error Interrupt Mask */
152#define SPI_IMSK_SET_MFM 0x00000080 /* Mode Fault Error Interrupt Mask */
153#define SPI_IMSK_SET_RSM 0x00000100 /* Receive Start Interrupt Mask */
154#define SPI_IMSK_SET_TSM 0x00000200 /* Transmit Start Interrupt Mask */
155#define SPI_IMSK_SET_RFM 0x00000400 /* Receive Finish Interrupt Mask */
156#define SPI_IMSK_SET_TFM 0x00000800 /* Transmit Finish Interrupt Mask */
157/* SPI_STATUS */
158#define SPI_STAT_SPIF 0x00000001 /* SPI Finished */
159#define SPI_STAT_RUWM 0x00000002 /* Receive Urgent Water-Mark Breached */
160#define SPI_STAT_TUWM 0x00000004 /* Transmit Urgent Water-Mark Breached */
161#define SPI_STAT_ROE 0x00000010 /* Receive Over-Run Error Indication */
162#define SPI_STAT_TUE 0x00000020 /* Transmit Under-Run Error Indication */
163#define SPI_STAT_TCE 0x00000040 /* Transmit Collision Error Indication */
164#define SPI_STAT_MODF 0x00000080 /* Mode Fault Error Indication */
165#define SPI_STAT_RS 0x00000100 /* Receive Start Indication */
166#define SPI_STAT_TS 0x00000200 /* Transmit Start Indication */
167#define SPI_STAT_RF 0x00000400 /* Receive Finish Indication */
168#define SPI_STAT_TF 0x00000800 /* Transmit Finish Indication */
169#define SPI_STAT_RFS 0x00007000 /* SPI_RFIFO status */
170#define SPI_STAT_RFIFO_EMPTY 0x00000000 /* RFS: RFIFO Empty */
171#define SPI_STAT_RFIFO_25 0x00001000 /* RFS: RFIFO 25% Full */
172#define SPI_STAT_RFIFO_50 0x00002000 /* RFS: RFIFO 50% Full */
173#define SPI_STAT_RFIFO_75 0x00003000 /* RFS: RFIFO 75% Full */
174#define SPI_STAT_RFIFO_FULL 0x00004000 /* RFS: RFIFO Full */
175#define SPI_STAT_TFS 0x00070000 /* SPI_TFIFO status */
176#define SPI_STAT_TFIFO_FULL 0x00000000 /* TFS: TFIFO full */
177#define SPI_STAT_TFIFO_25 0x00010000 /* TFS: TFIFO 25% empty */
178#define SPI_STAT_TFIFO_50 0x00020000 /* TFS: TFIFO 50% empty */
179#define SPI_STAT_TFIFO_75 0x00030000 /* TFS: TFIFO 75% empty */
180#define SPI_STAT_TFIFO_EMPTY 0x00040000 /* TFS: TFIFO empty */
181#define SPI_STAT_FCS 0x00100000 /* Flow-Control Stall Indication */
182#define SPI_STAT_RFE 0x00400000 /* SPI_RFIFO Empty */
183#define SPI_STAT_TFF 0x00800000 /* SPI_TFIFO Full */
184/* SPI_ILAT */
185#define SPI_ILAT_RUWMI 0x00000002 /* Receive Urgent Water Mark Interrupt */
186#define SPI_ILAT_TUWMI 0x00000004 /* Transmit Urgent Water Mark Interrupt */
187#define SPI_ILAT_ROI 0x00000010 /* Receive Over-Run Error Indication */
188#define SPI_ILAT_TUI 0x00000020 /* Transmit Under-Run Error Indication */
189#define SPI_ILAT_TCI 0x00000040 /* Transmit Collision Error Indication */
190#define SPI_ILAT_MFI 0x00000080 /* Mode Fault Error Indication */
191#define SPI_ILAT_RSI 0x00000100 /* Receive Start Indication */
192#define SPI_ILAT_TSI 0x00000200 /* Transmit Start Indication */
193#define SPI_ILAT_RFI 0x00000400 /* Receive Finish Indication */
194#define SPI_ILAT_TFI 0x00000800 /* Transmit Finish Indication */
195/* SPI_ILATCL */
196#define SPI_ILAT_CLR_RUWMI 0x00000002 /* Receive Urgent Water Mark Interrupt */
197#define SPI_ILAT_CLR_TUWMI 0x00000004 /* Transmit Urgent Water Mark Interrupt */
198#define SPI_ILAT_CLR_ROI 0x00000010 /* Receive Over-Run Error Indication */
199#define SPI_ILAT_CLR_TUI 0x00000020 /* Transmit Under-Run Error Indication */
200#define SPI_ILAT_CLR_TCI 0x00000040 /* Transmit Collision Error Indication */
201#define SPI_ILAT_CLR_MFI 0x00000080 /* Mode Fault Error Indication */
202#define SPI_ILAT_CLR_RSI 0x00000100 /* Receive Start Indication */
203#define SPI_ILAT_CLR_TSI 0x00000200 /* Transmit Start Indication */
204#define SPI_ILAT_CLR_RFI 0x00000400 /* Receive Finish Indication */
205#define SPI_ILAT_CLR_TFI 0x00000800 /* Transmit Finish Indication */
206
207/*
208 * adi spi3 registers layout
209 */
210struct adi_spi_regs {
211 u32 revid;
212 u32 control;
213 u32 rx_control;
214 u32 tx_control;
215 u32 clock;
216 u32 delay;
217 u32 ssel;
218 u32 rwc;
219 u32 rwcr;
220 u32 twc;
221 u32 twcr;
222 u32 reserved0;
223 u32 emask;
224 u32 emaskcl;
225 u32 emaskst;
226 u32 reserved1;
227 u32 status;
228 u32 elat;
229 u32 elatcl;
230 u32 reserved2;
231 u32 rfifo;
232 u32 reserved3;
233 u32 tfifo;
234};
235
236#define MAX_CTRL_CS 8 /* cs in spi controller */
237
238/* device.platform_data for SSP controller devices */
239struct adi_spi3_master {
240 u16 num_chipselect;
241 u16 pin_req[7];
242};
243
244/* spi_board_info.controller_data for SPI slave devices,
245 * copied to spi_device.platform_data ... mostly for dma tuning
246 */
247struct adi_spi3_chip {
248 u32 control;
249 u16 cs_chg_udelay; /* Some devices require 16-bit delays */
250 u32 tx_dummy_val; /* tx value for rx only transfer */
251 bool enable_dma;
252};
253
254#endif /* _ADI_SPI3_H_ */
diff --git a/include/linux/spi/at86rf230.h b/include/linux/spi/at86rf230.h
index aa327a8105ad..b2b1afbb3202 100644
--- a/include/linux/spi/at86rf230.h
+++ b/include/linux/spi/at86rf230.h
@@ -26,20 +26,6 @@ struct at86rf230_platform_data {
26 int rstn; 26 int rstn;
27 int slp_tr; 27 int slp_tr;
28 int dig2; 28 int dig2;
29
30 /* Setting the irq_type will configure the driver to request
31 * the platform irq trigger type according to the given value
32 * and configure the interrupt polarity of the device to the
33 * corresponding polarity.
34 *
35 * Allowed values are: IRQF_TRIGGER_RISING, IRQF_TRIGGER_FALLING,
36 * IRQF_TRIGGER_HIGH and IRQF_TRIGGER_LOW
37 *
38 * Setting it to 0, the driver does not touch the trigger type
39 * configuration of the interrupt and sets the interrupt polarity
40 * of the device to high active (the default value).
41 */
42 int irq_type;
43}; 29};
44 30
45#endif 31#endif
diff --git a/include/linux/spi/rspi.h b/include/linux/spi/rspi.h
index a25bd6f65e7f..e546b2ceb623 100644
--- a/include/linux/spi/rspi.h
+++ b/include/linux/spi/rspi.h
@@ -25,8 +25,6 @@ struct rspi_plat_data {
25 unsigned int dma_tx_id; 25 unsigned int dma_tx_id;
26 unsigned int dma_rx_id; 26 unsigned int dma_rx_id;
27 27
28 unsigned dma_width_16bit:1; /* DMAC read/write width = 16-bit */
29
30 u16 num_chipselect; 28 u16 num_chipselect;
31}; 29};
32 30
diff --git a/include/linux/splice.h b/include/linux/splice.h
index 0e43906d2fda..da2751d3b93d 100644
--- a/include/linux/splice.h
+++ b/include/linux/splice.h
@@ -70,16 +70,6 @@ extern ssize_t splice_from_pipe(struct pipe_inode_info *, struct file *,
70 splice_actor *); 70 splice_actor *);
71extern ssize_t __splice_from_pipe(struct pipe_inode_info *, 71extern ssize_t __splice_from_pipe(struct pipe_inode_info *,
72 struct splice_desc *, splice_actor *); 72 struct splice_desc *, splice_actor *);
73extern int splice_from_pipe_feed(struct pipe_inode_info *, struct splice_desc *,
74 splice_actor *);
75extern int splice_from_pipe_next(struct pipe_inode_info *,
76 struct splice_desc *);
77extern void splice_from_pipe_begin(struct splice_desc *);
78extern void splice_from_pipe_end(struct pipe_inode_info *,
79 struct splice_desc *);
80extern int pipe_to_file(struct pipe_inode_info *, struct pipe_buffer *,
81 struct splice_desc *);
82
83extern ssize_t splice_to_pipe(struct pipe_inode_info *, 73extern ssize_t splice_to_pipe(struct pipe_inode_info *,
84 struct splice_pipe_desc *); 74 struct splice_pipe_desc *);
85extern ssize_t splice_direct_to_actor(struct file *, struct splice_desc *, 75extern ssize_t splice_direct_to_actor(struct file *, struct splice_desc *,
diff --git a/include/linux/ssb/ssb.h b/include/linux/ssb/ssb.h
index 07ef9b82b66d..4568a5cc9ab8 100644
--- a/include/linux/ssb/ssb.h
+++ b/include/linux/ssb/ssb.h
@@ -33,6 +33,7 @@ struct ssb_sprom {
33 u8 et1phyaddr; /* MII address for enet1 */ 33 u8 et1phyaddr; /* MII address for enet1 */
34 u8 et0mdcport; /* MDIO for enet0 */ 34 u8 et0mdcport; /* MDIO for enet0 */
35 u8 et1mdcport; /* MDIO for enet1 */ 35 u8 et1mdcport; /* MDIO for enet1 */
36 u16 dev_id; /* Device ID overriding e.g. PCI ID */
36 u16 board_rev; /* Board revision number from SPROM. */ 37 u16 board_rev; /* Board revision number from SPROM. */
37 u16 board_num; /* Board number from SPROM. */ 38 u16 board_num; /* Board number from SPROM. */
38 u16 board_type; /* Board type from SPROM. */ 39 u16 board_type; /* Board type from SPROM. */
diff --git a/include/linux/string.h b/include/linux/string.h
index ac889c5ea11b..d36977e029af 100644
--- a/include/linux/string.h
+++ b/include/linux/string.h
@@ -52,6 +52,9 @@ extern int strncasecmp(const char *s1, const char *s2, size_t n);
52#ifndef __HAVE_ARCH_STRCHR 52#ifndef __HAVE_ARCH_STRCHR
53extern char * strchr(const char *,int); 53extern char * strchr(const char *,int);
54#endif 54#endif
55#ifndef __HAVE_ARCH_STRCHRNUL
56extern char * strchrnul(const char *,int);
57#endif
55#ifndef __HAVE_ARCH_STRNCHR 58#ifndef __HAVE_ARCH_STRNCHR
56extern char * strnchr(const char *, size_t, int); 59extern char * strnchr(const char *, size_t, int);
57#endif 60#endif
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h
index 3a847de83fab..ad7dbe2cfecd 100644
--- a/include/linux/sunrpc/sched.h
+++ b/include/linux/sunrpc/sched.h
@@ -142,18 +142,18 @@ struct rpc_task_setup {
142 test_and_set_bit(RPC_TASK_RUNNING, &(t)->tk_runstate) 142 test_and_set_bit(RPC_TASK_RUNNING, &(t)->tk_runstate)
143#define rpc_clear_running(t) \ 143#define rpc_clear_running(t) \
144 do { \ 144 do { \
145 smp_mb__before_clear_bit(); \ 145 smp_mb__before_atomic(); \
146 clear_bit(RPC_TASK_RUNNING, &(t)->tk_runstate); \ 146 clear_bit(RPC_TASK_RUNNING, &(t)->tk_runstate); \
147 smp_mb__after_clear_bit(); \ 147 smp_mb__after_atomic(); \
148 } while (0) 148 } while (0)
149 149
150#define RPC_IS_QUEUED(t) test_bit(RPC_TASK_QUEUED, &(t)->tk_runstate) 150#define RPC_IS_QUEUED(t) test_bit(RPC_TASK_QUEUED, &(t)->tk_runstate)
151#define rpc_set_queued(t) set_bit(RPC_TASK_QUEUED, &(t)->tk_runstate) 151#define rpc_set_queued(t) set_bit(RPC_TASK_QUEUED, &(t)->tk_runstate)
152#define rpc_clear_queued(t) \ 152#define rpc_clear_queued(t) \
153 do { \ 153 do { \
154 smp_mb__before_clear_bit(); \ 154 smp_mb__before_atomic(); \
155 clear_bit(RPC_TASK_QUEUED, &(t)->tk_runstate); \ 155 clear_bit(RPC_TASK_QUEUED, &(t)->tk_runstate); \
156 smp_mb__after_clear_bit(); \ 156 smp_mb__after_atomic(); \
157 } while (0) 157 } while (0)
158 158
159#define RPC_IS_ACTIVATED(t) test_bit(RPC_TASK_ACTIVE, &(t)->tk_runstate) 159#define RPC_IS_ACTIVATED(t) test_bit(RPC_TASK_ACTIVE, &(t)->tk_runstate)
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h
index 04e763221246..1bc7cd05b22e 100644
--- a/include/linux/sunrpc/svc.h
+++ b/include/linux/sunrpc/svc.h
@@ -244,6 +244,7 @@ struct svc_rqst {
244 struct page * rq_pages[RPCSVC_MAXPAGES]; 244 struct page * rq_pages[RPCSVC_MAXPAGES];
245 struct page * *rq_respages; /* points into rq_pages */ 245 struct page * *rq_respages; /* points into rq_pages */
246 struct page * *rq_next_page; /* next reply page to use */ 246 struct page * *rq_next_page; /* next reply page to use */
247 struct page * *rq_page_end; /* one past the last page */
247 248
248 struct kvec rq_vec[RPCSVC_MAXPAGES]; /* generally useful.. */ 249 struct kvec rq_vec[RPCSVC_MAXPAGES]; /* generally useful.. */
249 250
@@ -254,11 +255,15 @@ struct svc_rqst {
254 u32 rq_prot; /* IP protocol */ 255 u32 rq_prot; /* IP protocol */
255 unsigned short 256 unsigned short
256 rq_secure : 1; /* secure port */ 257 rq_secure : 1; /* secure port */
258 unsigned short rq_local : 1; /* local request */
257 259
258 void * rq_argp; /* decoded arguments */ 260 void * rq_argp; /* decoded arguments */
259 void * rq_resp; /* xdr'd results */ 261 void * rq_resp; /* xdr'd results */
260 void * rq_auth_data; /* flavor-specific data */ 262 void * rq_auth_data; /* flavor-specific data */
261 263 int rq_auth_slack; /* extra space xdr code
264 * should leave in head
265 * for krb5i, krb5p.
266 */
262 int rq_reserved; /* space on socket outq 267 int rq_reserved; /* space on socket outq
263 * reserved for this request 268 * reserved for this request
264 */ 269 */
@@ -454,11 +459,7 @@ char * svc_print_addr(struct svc_rqst *, char *, size_t);
454 */ 459 */
455static inline void svc_reserve_auth(struct svc_rqst *rqstp, int space) 460static inline void svc_reserve_auth(struct svc_rqst *rqstp, int space)
456{ 461{
457 int added_space = 0; 462 svc_reserve(rqstp, space + rqstp->rq_auth_slack);
458
459 if (rqstp->rq_authop->flavour)
460 added_space = RPC_MAX_AUTH_SIZE;
461 svc_reserve(rqstp, space + added_space);
462} 463}
463 464
464#endif /* SUNRPC_SVC_H */ 465#endif /* SUNRPC_SVC_H */
diff --git a/include/linux/sunrpc/svc_rdma.h b/include/linux/sunrpc/svc_rdma.h
index 0b8e3e6bdacf..5cf99a016368 100644
--- a/include/linux/sunrpc/svc_rdma.h
+++ b/include/linux/sunrpc/svc_rdma.h
@@ -115,14 +115,13 @@ struct svc_rdma_fastreg_mr {
115 struct list_head frmr_list; 115 struct list_head frmr_list;
116}; 116};
117struct svc_rdma_req_map { 117struct svc_rdma_req_map {
118 struct svc_rdma_fastreg_mr *frmr;
119 unsigned long count; 118 unsigned long count;
120 union { 119 union {
121 struct kvec sge[RPCSVC_MAXPAGES]; 120 struct kvec sge[RPCSVC_MAXPAGES];
122 struct svc_rdma_chunk_sge ch[RPCSVC_MAXPAGES]; 121 struct svc_rdma_chunk_sge ch[RPCSVC_MAXPAGES];
122 unsigned long lkey[RPCSVC_MAXPAGES];
123 }; 123 };
124}; 124};
125#define RDMACTXT_F_FAST_UNREG 1
126#define RDMACTXT_F_LAST_CTXT 2 125#define RDMACTXT_F_LAST_CTXT 2
127 126
128#define SVCRDMA_DEVCAP_FAST_REG 1 /* fast mr registration */ 127#define SVCRDMA_DEVCAP_FAST_REG 1 /* fast mr registration */
diff --git a/include/linux/sunrpc/svc_xprt.h b/include/linux/sunrpc/svc_xprt.h
index b05963f09ebf..7235040a19b2 100644
--- a/include/linux/sunrpc/svc_xprt.h
+++ b/include/linux/sunrpc/svc_xprt.h
@@ -24,6 +24,7 @@ struct svc_xprt_ops {
24 void (*xpo_release_rqst)(struct svc_rqst *); 24 void (*xpo_release_rqst)(struct svc_rqst *);
25 void (*xpo_detach)(struct svc_xprt *); 25 void (*xpo_detach)(struct svc_xprt *);
26 void (*xpo_free)(struct svc_xprt *); 26 void (*xpo_free)(struct svc_xprt *);
27 int (*xpo_secure_port)(struct svc_rqst *);
27}; 28};
28 29
29struct svc_xprt_class { 30struct svc_xprt_class {
@@ -63,6 +64,7 @@ struct svc_xprt {
63#define XPT_DETACHED 10 /* detached from tempsocks list */ 64#define XPT_DETACHED 10 /* detached from tempsocks list */
64#define XPT_LISTENER 11 /* listening endpoint */ 65#define XPT_LISTENER 11 /* listening endpoint */
65#define XPT_CACHE_AUTH 12 /* cache auth info */ 66#define XPT_CACHE_AUTH 12 /* cache auth info */
67#define XPT_LOCAL 13 /* connection from loopback interface */
66 68
67 struct svc_serv *xpt_server; /* service for transport */ 69 struct svc_serv *xpt_server; /* service for transport */
68 atomic_t xpt_reserved; /* space on outq that is rsvd */ 70 atomic_t xpt_reserved; /* space on outq that is rsvd */
diff --git a/include/linux/sunrpc/xdr.h b/include/linux/sunrpc/xdr.h
index 15f9204ee70b..70c6b92e15a7 100644
--- a/include/linux/sunrpc/xdr.h
+++ b/include/linux/sunrpc/xdr.h
@@ -215,6 +215,9 @@ typedef int (*kxdrdproc_t)(void *rqstp, struct xdr_stream *xdr, void *obj);
215 215
216extern void xdr_init_encode(struct xdr_stream *xdr, struct xdr_buf *buf, __be32 *p); 216extern void xdr_init_encode(struct xdr_stream *xdr, struct xdr_buf *buf, __be32 *p);
217extern __be32 *xdr_reserve_space(struct xdr_stream *xdr, size_t nbytes); 217extern __be32 *xdr_reserve_space(struct xdr_stream *xdr, size_t nbytes);
218extern void xdr_commit_encode(struct xdr_stream *xdr);
219extern void xdr_truncate_encode(struct xdr_stream *xdr, size_t len);
220extern int xdr_restrict_buflen(struct xdr_stream *xdr, int newbuflen);
218extern void xdr_write_pages(struct xdr_stream *xdr, struct page **pages, 221extern void xdr_write_pages(struct xdr_stream *xdr, struct page **pages,
219 unsigned int base, unsigned int len); 222 unsigned int base, unsigned int len);
220extern unsigned int xdr_stream_pos(const struct xdr_stream *xdr); 223extern unsigned int xdr_stream_pos(const struct xdr_stream *xdr);
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h
index 3e5efb2b236e..fcbfe8783243 100644
--- a/include/linux/sunrpc/xprt.h
+++ b/include/linux/sunrpc/xprt.h
@@ -24,6 +24,12 @@
24#define RPC_MAX_SLOT_TABLE_LIMIT (65536U) 24#define RPC_MAX_SLOT_TABLE_LIMIT (65536U)
25#define RPC_MAX_SLOT_TABLE RPC_MAX_SLOT_TABLE_LIMIT 25#define RPC_MAX_SLOT_TABLE RPC_MAX_SLOT_TABLE_LIMIT
26 26
27#define RPC_CWNDSHIFT (8U)
28#define RPC_CWNDSCALE (1U << RPC_CWNDSHIFT)
29#define RPC_INITCWND RPC_CWNDSCALE
30#define RPC_MAXCWND(xprt) ((xprt)->max_reqs << RPC_CWNDSHIFT)
31#define RPCXPRT_CONGESTED(xprt) ((xprt)->cong >= (xprt)->cwnd)
32
27/* 33/*
28 * This describes a timeout strategy 34 * This describes a timeout strategy
29 */ 35 */
@@ -379,9 +385,9 @@ static inline int xprt_test_and_clear_connected(struct rpc_xprt *xprt)
379 385
380static inline void xprt_clear_connecting(struct rpc_xprt *xprt) 386static inline void xprt_clear_connecting(struct rpc_xprt *xprt)
381{ 387{
382 smp_mb__before_clear_bit(); 388 smp_mb__before_atomic();
383 clear_bit(XPRT_CONNECTING, &xprt->state); 389 clear_bit(XPRT_CONNECTING, &xprt->state);
384 smp_mb__after_clear_bit(); 390 smp_mb__after_atomic();
385} 391}
386 392
387static inline int xprt_connecting(struct rpc_xprt *xprt) 393static inline int xprt_connecting(struct rpc_xprt *xprt)
@@ -411,9 +417,9 @@ static inline void xprt_clear_bound(struct rpc_xprt *xprt)
411 417
412static inline void xprt_clear_binding(struct rpc_xprt *xprt) 418static inline void xprt_clear_binding(struct rpc_xprt *xprt)
413{ 419{
414 smp_mb__before_clear_bit(); 420 smp_mb__before_atomic();
415 clear_bit(XPRT_BINDING, &xprt->state); 421 clear_bit(XPRT_BINDING, &xprt->state);
416 smp_mb__after_clear_bit(); 422 smp_mb__after_atomic();
417} 423}
418 424
419static inline int xprt_test_and_set_binding(struct rpc_xprt *xprt) 425static inline int xprt_test_and_set_binding(struct rpc_xprt *xprt)
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index f73cabf59012..519064e0c943 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -187,6 +187,11 @@ struct platform_suspend_ops {
187 void (*recover)(void); 187 void (*recover)(void);
188}; 188};
189 189
190struct platform_freeze_ops {
191 int (*begin)(void);
192 void (*end)(void);
193};
194
190#ifdef CONFIG_SUSPEND 195#ifdef CONFIG_SUSPEND
191/** 196/**
192 * suspend_set_ops - set platform dependent suspend operations 197 * suspend_set_ops - set platform dependent suspend operations
@@ -194,6 +199,7 @@ struct platform_suspend_ops {
194 */ 199 */
195extern void suspend_set_ops(const struct platform_suspend_ops *ops); 200extern void suspend_set_ops(const struct platform_suspend_ops *ops);
196extern int suspend_valid_only_mem(suspend_state_t state); 201extern int suspend_valid_only_mem(suspend_state_t state);
202extern void freeze_set_ops(const struct platform_freeze_ops *ops);
197extern void freeze_wake(void); 203extern void freeze_wake(void);
198 204
199/** 205/**
@@ -220,6 +226,7 @@ extern int pm_suspend(suspend_state_t state);
220 226
221static inline void suspend_set_ops(const struct platform_suspend_ops *ops) {} 227static inline void suspend_set_ops(const struct platform_suspend_ops *ops) {}
222static inline int pm_suspend(suspend_state_t state) { return -ENOSYS; } 228static inline int pm_suspend(suspend_state_t state) { return -ENOSYS; }
229static inline void freeze_set_ops(const struct platform_freeze_ops *ops) {}
223static inline void freeze_wake(void) {} 230static inline void freeze_wake(void) {}
224#endif /* !CONFIG_SUSPEND */ 231#endif /* !CONFIG_SUSPEND */
225 232
@@ -320,6 +327,9 @@ extern unsigned long get_safe_page(gfp_t gfp_mask);
320extern void hibernation_set_ops(const struct platform_hibernation_ops *ops); 327extern void hibernation_set_ops(const struct platform_hibernation_ops *ops);
321extern int hibernate(void); 328extern int hibernate(void);
322extern bool system_entering_hibernation(void); 329extern bool system_entering_hibernation(void);
330extern bool hibernation_available(void);
331asmlinkage int swsusp_save(void);
332extern struct pbe *restore_pblist;
323#else /* CONFIG_HIBERNATION */ 333#else /* CONFIG_HIBERNATION */
324static inline void register_nosave_region(unsigned long b, unsigned long e) {} 334static inline void register_nosave_region(unsigned long b, unsigned long e) {}
325static inline void register_nosave_region_late(unsigned long b, unsigned long e) {} 335static inline void register_nosave_region_late(unsigned long b, unsigned long e) {}
@@ -330,6 +340,7 @@ static inline void swsusp_unset_page_free(struct page *p) {}
330static inline void hibernation_set_ops(const struct platform_hibernation_ops *ops) {} 340static inline void hibernation_set_ops(const struct platform_hibernation_ops *ops) {}
331static inline int hibernate(void) { return -ENOSYS; } 341static inline int hibernate(void) { return -ENOSYS; }
332static inline bool system_entering_hibernation(void) { return false; } 342static inline bool system_entering_hibernation(void) { return false; }
343static inline bool hibernation_available(void) { return false; }
333#endif /* CONFIG_HIBERNATION */ 344#endif /* CONFIG_HIBERNATION */
334 345
335/* Hibernation and suspend events */ 346/* Hibernation and suspend events */
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 350711560753..4bdbee80eede 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -166,10 +166,10 @@ enum {
166#define COMPACT_CLUSTER_MAX SWAP_CLUSTER_MAX 166#define COMPACT_CLUSTER_MAX SWAP_CLUSTER_MAX
167 167
168/* 168/*
169 * Ratio between the present memory in the zone and the "gap" that 169 * Ratio between zone->managed_pages and the "gap" that above the per-zone
170 * we're allowing kswapd to shrink in addition to the per-zone high 170 * "high_wmark". While balancing nodes, We allow kswapd to shrink zones that
171 * wmark, even for zones that already have the high wmark satisfied, 171 * do not meet the (high_wmark + gap) watermark, even which already met the
172 * in order to provide better per-zone lru behavior. We are ok to 172 * high_wmark, in order to provide better per-zone lru behavior. We are ok to
173 * spend not more than 1% of the memory for this zone balancing "gap". 173 * spend not more than 1% of the memory for this zone balancing "gap".
174 */ 174 */
175#define KSWAPD_ZONE_BALANCE_GAP_RATIO 100 175#define KSWAPD_ZONE_BALANCE_GAP_RATIO 100
@@ -214,8 +214,9 @@ struct percpu_cluster {
214struct swap_info_struct { 214struct swap_info_struct {
215 unsigned long flags; /* SWP_USED etc: see above */ 215 unsigned long flags; /* SWP_USED etc: see above */
216 signed short prio; /* swap priority of this type */ 216 signed short prio; /* swap priority of this type */
217 struct plist_node list; /* entry in swap_active_head */
218 struct plist_node avail_list; /* entry in swap_avail_head */
217 signed char type; /* strange name for an index */ 219 signed char type; /* strange name for an index */
218 signed char next; /* next type on the swap list */
219 unsigned int max; /* extent of the swap_map */ 220 unsigned int max; /* extent of the swap_map */
220 unsigned char *swap_map; /* vmalloc'ed array of usage counts */ 221 unsigned char *swap_map; /* vmalloc'ed array of usage counts */
221 struct swap_cluster_info *cluster_info; /* cluster info. Only for SSD */ 222 struct swap_cluster_info *cluster_info; /* cluster info. Only for SSD */
@@ -255,11 +256,6 @@ struct swap_info_struct {
255 struct swap_cluster_info discard_cluster_tail; /* list tail of discard clusters */ 256 struct swap_cluster_info discard_cluster_tail; /* list tail of discard clusters */
256}; 257};
257 258
258struct swap_list_t {
259 int head; /* head of priority-ordered swapfile list */
260 int next; /* swapfile to be used next */
261};
262
263/* linux/mm/workingset.c */ 259/* linux/mm/workingset.c */
264void *workingset_eviction(struct address_space *mapping, struct page *page); 260void *workingset_eviction(struct address_space *mapping, struct page *page);
265bool workingset_refault(void *shadow); 261bool workingset_refault(void *shadow);
@@ -308,12 +304,14 @@ extern unsigned long nr_free_pagecache_pages(void);
308 304
309 305
310/* linux/mm/swap.c */ 306/* linux/mm/swap.c */
311extern void __lru_cache_add(struct page *);
312extern void lru_cache_add(struct page *); 307extern void lru_cache_add(struct page *);
308extern void lru_cache_add_anon(struct page *page);
309extern void lru_cache_add_file(struct page *page);
313extern void lru_add_page_tail(struct page *page, struct page *page_tail, 310extern void lru_add_page_tail(struct page *page, struct page *page_tail,
314 struct lruvec *lruvec, struct list_head *head); 311 struct lruvec *lruvec, struct list_head *head);
315extern void activate_page(struct page *); 312extern void activate_page(struct page *);
316extern void mark_page_accessed(struct page *); 313extern void mark_page_accessed(struct page *);
314extern void init_page_accessed(struct page *page);
317extern void lru_add_drain(void); 315extern void lru_add_drain(void);
318extern void lru_add_drain_cpu(int cpu); 316extern void lru_add_drain_cpu(int cpu);
319extern void lru_add_drain_all(void); 317extern void lru_add_drain_all(void);
@@ -323,22 +321,6 @@ extern void swap_setup(void);
323 321
324extern void add_page_to_unevictable_list(struct page *page); 322extern void add_page_to_unevictable_list(struct page *page);
325 323
326/**
327 * lru_cache_add: add a page to the page lists
328 * @page: the page to add
329 */
330static inline void lru_cache_add_anon(struct page *page)
331{
332 ClearPageActive(page);
333 __lru_cache_add(page);
334}
335
336static inline void lru_cache_add_file(struct page *page)
337{
338 ClearPageActive(page);
339 __lru_cache_add(page);
340}
341
342/* linux/mm/vmscan.c */ 324/* linux/mm/vmscan.c */
343extern unsigned long try_to_free_pages(struct zonelist *zonelist, int order, 325extern unsigned long try_to_free_pages(struct zonelist *zonelist, int order,
344 gfp_t gfp_mask, nodemask_t *mask); 326 gfp_t gfp_mask, nodemask_t *mask);
@@ -496,7 +478,7 @@ mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent, bool swapout)
496#define free_page_and_swap_cache(page) \ 478#define free_page_and_swap_cache(page) \
497 page_cache_release(page) 479 page_cache_release(page)
498#define free_pages_and_swap_cache(pages, nr) \ 480#define free_pages_and_swap_cache(pages, nr) \
499 release_pages((pages), (nr), 0); 481 release_pages((pages), (nr), false);
500 482
501static inline void show_swap_cache_info(void) 483static inline void show_swap_cache_info(void)
502{ 484{
diff --git a/include/linux/swapfile.h b/include/linux/swapfile.h
index e282624e8c10..388293a91e8c 100644
--- a/include/linux/swapfile.h
+++ b/include/linux/swapfile.h
@@ -6,7 +6,7 @@
6 * want to expose them to the dozens of source files that include swap.h 6 * want to expose them to the dozens of source files that include swap.h
7 */ 7 */
8extern spinlock_t swap_lock; 8extern spinlock_t swap_lock;
9extern struct swap_list_t swap_list; 9extern struct plist_head swap_active_head;
10extern struct swap_info_struct *swap_info[]; 10extern struct swap_info_struct *swap_info[];
11extern int try_to_unuse(unsigned int, bool, unsigned long); 11extern int try_to_unuse(unsigned int, bool, unsigned long);
12 12
diff --git a/include/linux/swapops.h b/include/linux/swapops.h
index c0f75261a728..6adfb7bfbf44 100644
--- a/include/linux/swapops.h
+++ b/include/linux/swapops.h
@@ -54,7 +54,7 @@ static inline pgoff_t swp_offset(swp_entry_t entry)
54/* check whether a pte points to a swap entry */ 54/* check whether a pte points to a swap entry */
55static inline int is_swap_pte(pte_t pte) 55static inline int is_swap_pte(pte_t pte)
56{ 56{
57 return !pte_none(pte) && !pte_present(pte) && !pte_file(pte); 57 return !pte_none(pte) && !pte_present_nonuma(pte) && !pte_file(pte);
58} 58}
59#endif 59#endif
60 60
diff --git a/include/linux/swiotlb.h b/include/linux/swiotlb.h
index a5ffd32642fd..e7a018eaf3a2 100644
--- a/include/linux/swiotlb.h
+++ b/include/linux/swiotlb.h
@@ -116,4 +116,6 @@ static inline void swiotlb_free(void) { }
116#endif 116#endif
117 117
118extern void swiotlb_print_info(void); 118extern void swiotlb_print_info(void);
119extern int is_swiotlb_buffer(phys_addr_t paddr);
120
119#endif /* __LINUX_SWIOTLB_H */ 121#endif /* __LINUX_SWIOTLB_H */
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index a4a0588c5397..b0881a0ed322 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -711,7 +711,7 @@ asmlinkage long sys_keyctl(int cmd, unsigned long arg2, unsigned long arg3,
711 711
712asmlinkage long sys_ioprio_set(int which, int who, int ioprio); 712asmlinkage long sys_ioprio_set(int which, int who, int ioprio);
713asmlinkage long sys_ioprio_get(int which, int who); 713asmlinkage long sys_ioprio_get(int which, int who);
714asmlinkage long sys_set_mempolicy(int mode, unsigned long __user *nmask, 714asmlinkage long sys_set_mempolicy(int mode, const unsigned long __user *nmask,
715 unsigned long maxnode); 715 unsigned long maxnode);
716asmlinkage long sys_migrate_pages(pid_t pid, unsigned long maxnode, 716asmlinkage long sys_migrate_pages(pid_t pid, unsigned long maxnode,
717 const unsigned long __user *from, 717 const unsigned long __user *from,
@@ -723,7 +723,7 @@ asmlinkage long sys_move_pages(pid_t pid, unsigned long nr_pages,
723 int flags); 723 int flags);
724asmlinkage long sys_mbind(unsigned long start, unsigned long len, 724asmlinkage long sys_mbind(unsigned long start, unsigned long len,
725 unsigned long mode, 725 unsigned long mode,
726 unsigned long __user *nmask, 726 const unsigned long __user *nmask,
727 unsigned long maxnode, 727 unsigned long maxnode,
728 unsigned flags); 728 unsigned flags);
729asmlinkage long sys_get_mempolicy(int __user *policy, 729asmlinkage long sys_get_mempolicy(int __user *policy,
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index 5ffaa3443712..f97d0dbb59fa 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -437,7 +437,7 @@ static inline int __must_check sysfs_create_file(struct kobject *kobj,
437static inline void sysfs_remove_file(struct kobject *kobj, 437static inline void sysfs_remove_file(struct kobject *kobj,
438 const struct attribute *attr) 438 const struct attribute *attr)
439{ 439{
440 return sysfs_remove_file_ns(kobj, attr, NULL); 440 sysfs_remove_file_ns(kobj, attr, NULL);
441} 441}
442 442
443static inline int sysfs_rename_link(struct kobject *kobj, struct kobject *target, 443static inline int sysfs_rename_link(struct kobject *kobj, struct kobject *target,
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 239946868142..a0513210798f 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -197,7 +197,8 @@ struct tcp_sock {
197 u8 do_early_retrans:1,/* Enable RFC5827 early-retransmit */ 197 u8 do_early_retrans:1,/* Enable RFC5827 early-retransmit */
198 syn_data:1, /* SYN includes data */ 198 syn_data:1, /* SYN includes data */
199 syn_fastopen:1, /* SYN includes Fast Open option */ 199 syn_fastopen:1, /* SYN includes Fast Open option */
200 syn_data_acked:1;/* data in SYN is acked by SYN-ACK */ 200 syn_data_acked:1,/* data in SYN is acked by SYN-ACK */
201 is_cwnd_limited:1;/* forward progress limited by snd_cwnd? */
201 u32 tlp_high_seq; /* snd_nxt at the time of TLP retransmit. */ 202 u32 tlp_high_seq; /* snd_nxt at the time of TLP retransmit. */
202 203
203/* RTT measurement */ 204/* RTT measurement */
@@ -209,6 +210,8 @@ struct tcp_sock {
209 210
210 u32 packets_out; /* Packets which are "in flight" */ 211 u32 packets_out; /* Packets which are "in flight" */
211 u32 retrans_out; /* Retransmitted packets out */ 212 u32 retrans_out; /* Retransmitted packets out */
213 u32 max_packets_out; /* max packets_out in last window */
214 u32 max_packets_seq; /* right edge of max_packets_out flight */
212 215
213 u16 urg_data; /* Saved octet of OOB data and control flags */ 216 u16 urg_data; /* Saved octet of OOB data and control flags */
214 u8 ecn_flags; /* ECN status bits. */ 217 u8 ecn_flags; /* ECN status bits. */
@@ -365,11 +368,6 @@ static inline bool tcp_passive_fastopen(const struct sock *sk)
365 tcp_sk(sk)->fastopen_rsk != NULL); 368 tcp_sk(sk)->fastopen_rsk != NULL);
366} 369}
367 370
368static inline bool fastopen_cookie_present(struct tcp_fastopen_cookie *foc)
369{
370 return foc->len != -1;
371}
372
373extern void tcp_sock_destruct(struct sock *sk); 371extern void tcp_sock_destruct(struct sock *sk);
374 372
375static inline int fastopen_init_queue(struct sock *sk, int backlog) 373static inline int fastopen_init_queue(struct sock *sk, int backlog)
diff --git a/include/linux/thread_info.h b/include/linux/thread_info.h
index fddbe2023a5d..ff307b548ed3 100644
--- a/include/linux/thread_info.h
+++ b/include/linux/thread_info.h
@@ -61,8 +61,6 @@ extern long do_no_restart_syscall(struct restart_block *parm);
61# define THREADINFO_GFP (GFP_KERNEL | __GFP_NOTRACK) 61# define THREADINFO_GFP (GFP_KERNEL | __GFP_NOTRACK)
62#endif 62#endif
63 63
64#define THREADINFO_GFP_ACCOUNTED (THREADINFO_GFP | __GFP_KMEMCG)
65
66/* 64/*
67 * flag set/clear/test wrappers 65 * flag set/clear/test wrappers
68 * - pass TIF_xxxx constants to these functions 66 * - pass TIF_xxxx constants to these functions
@@ -104,20 +102,6 @@ static inline int test_ti_thread_flag(struct thread_info *ti, int flag)
104#define test_thread_flag(flag) \ 102#define test_thread_flag(flag) \
105 test_ti_thread_flag(current_thread_info(), flag) 103 test_ti_thread_flag(current_thread_info(), flag)
106 104
107static inline __deprecated void set_need_resched(void)
108{
109 /*
110 * Use of this function in deprecated.
111 *
112 * As of this writing there are only a few users in the DRM tree left
113 * all of which are wrong and can be removed without causing too much
114 * grief.
115 *
116 * The DRM people are aware and are working on removing the last few
117 * instances.
118 */
119}
120
121#define tif_need_resched() test_thread_flag(TIF_NEED_RESCHED) 105#define tif_need_resched() test_thread_flag(TIF_NEED_RESCHED)
122 106
123#if defined TIF_RESTORE_SIGMASK && !defined HAVE_SET_RESTORE_SIGMASK 107#if defined TIF_RESTORE_SIGMASK && !defined HAVE_SET_RESTORE_SIGMASK
diff --git a/include/linux/topology.h b/include/linux/topology.h
index 7062330a1329..dda6ee521e74 100644
--- a/include/linux/topology.h
+++ b/include/linux/topology.h
@@ -58,7 +58,8 @@ int arch_update_cpu_topology(void);
58/* 58/*
59 * If the distance between nodes in a system is larger than RECLAIM_DISTANCE 59 * If the distance between nodes in a system is larger than RECLAIM_DISTANCE
60 * (in whatever arch specific measurement units returned by node_distance()) 60 * (in whatever arch specific measurement units returned by node_distance())
61 * then switch on zone reclaim on boot. 61 * and zone_reclaim_mode is enabled then the VM will only call zone_reclaim()
62 * on nodes within this distance.
62 */ 63 */
63#define RECLAIM_DISTANCE 30 64#define RECLAIM_DISTANCE 30
64#endif 65#endif
@@ -66,121 +67,6 @@ int arch_update_cpu_topology(void);
66#define PENALTY_FOR_NODE_WITH_CPUS (1) 67#define PENALTY_FOR_NODE_WITH_CPUS (1)
67#endif 68#endif
68 69
69/*
70 * Below are the 3 major initializers used in building sched_domains:
71 * SD_SIBLING_INIT, for SMT domains
72 * SD_CPU_INIT, for SMP domains
73 *
74 * Any architecture that cares to do any tuning to these values should do so
75 * by defining their own arch-specific initializer in include/asm/topology.h.
76 * A definition there will automagically override these default initializers
77 * and allow arch-specific performance tuning of sched_domains.
78 * (Only non-zero and non-null fields need be specified.)
79 */
80
81#ifdef CONFIG_SCHED_SMT
82/* MCD - Do we really need this? It is always on if CONFIG_SCHED_SMT is,
83 * so can't we drop this in favor of CONFIG_SCHED_SMT?
84 */
85#define ARCH_HAS_SCHED_WAKE_IDLE
86/* Common values for SMT siblings */
87#ifndef SD_SIBLING_INIT
88#define SD_SIBLING_INIT (struct sched_domain) { \
89 .min_interval = 1, \
90 .max_interval = 2, \
91 .busy_factor = 64, \
92 .imbalance_pct = 110, \
93 \
94 .flags = 1*SD_LOAD_BALANCE \
95 | 1*SD_BALANCE_NEWIDLE \
96 | 1*SD_BALANCE_EXEC \
97 | 1*SD_BALANCE_FORK \
98 | 0*SD_BALANCE_WAKE \
99 | 1*SD_WAKE_AFFINE \
100 | 1*SD_SHARE_CPUPOWER \
101 | 1*SD_SHARE_PKG_RESOURCES \
102 | 0*SD_SERIALIZE \
103 | 0*SD_PREFER_SIBLING \
104 | arch_sd_sibling_asym_packing() \
105 , \
106 .last_balance = jiffies, \
107 .balance_interval = 1, \
108 .smt_gain = 1178, /* 15% */ \
109 .max_newidle_lb_cost = 0, \
110 .next_decay_max_lb_cost = jiffies, \
111}
112#endif
113#endif /* CONFIG_SCHED_SMT */
114
115#ifdef CONFIG_SCHED_MC
116/* Common values for MC siblings. for now mostly derived from SD_CPU_INIT */
117#ifndef SD_MC_INIT
118#define SD_MC_INIT (struct sched_domain) { \
119 .min_interval = 1, \
120 .max_interval = 4, \
121 .busy_factor = 64, \
122 .imbalance_pct = 125, \
123 .cache_nice_tries = 1, \
124 .busy_idx = 2, \
125 .wake_idx = 0, \
126 .forkexec_idx = 0, \
127 \
128 .flags = 1*SD_LOAD_BALANCE \
129 | 1*SD_BALANCE_NEWIDLE \
130 | 1*SD_BALANCE_EXEC \
131 | 1*SD_BALANCE_FORK \
132 | 0*SD_BALANCE_WAKE \
133 | 1*SD_WAKE_AFFINE \
134 | 0*SD_SHARE_CPUPOWER \
135 | 1*SD_SHARE_PKG_RESOURCES \
136 | 0*SD_SERIALIZE \
137 , \
138 .last_balance = jiffies, \
139 .balance_interval = 1, \
140 .max_newidle_lb_cost = 0, \
141 .next_decay_max_lb_cost = jiffies, \
142}
143#endif
144#endif /* CONFIG_SCHED_MC */
145
146/* Common values for CPUs */
147#ifndef SD_CPU_INIT
148#define SD_CPU_INIT (struct sched_domain) { \
149 .min_interval = 1, \
150 .max_interval = 4, \
151 .busy_factor = 64, \
152 .imbalance_pct = 125, \
153 .cache_nice_tries = 1, \
154 .busy_idx = 2, \
155 .idle_idx = 1, \
156 .newidle_idx = 0, \
157 .wake_idx = 0, \
158 .forkexec_idx = 0, \
159 \
160 .flags = 1*SD_LOAD_BALANCE \
161 | 1*SD_BALANCE_NEWIDLE \
162 | 1*SD_BALANCE_EXEC \
163 | 1*SD_BALANCE_FORK \
164 | 0*SD_BALANCE_WAKE \
165 | 1*SD_WAKE_AFFINE \
166 | 0*SD_SHARE_CPUPOWER \
167 | 0*SD_SHARE_PKG_RESOURCES \
168 | 0*SD_SERIALIZE \
169 | 1*SD_PREFER_SIBLING \
170 , \
171 .last_balance = jiffies, \
172 .balance_interval = 1, \
173 .max_newidle_lb_cost = 0, \
174 .next_decay_max_lb_cost = jiffies, \
175}
176#endif
177
178#ifdef CONFIG_SCHED_BOOK
179#ifndef SD_BOOK_INIT
180#error Please define an appropriate SD_BOOK_INIT in include/asm/topology.h!!!
181#endif
182#endif /* CONFIG_SCHED_BOOK */
183
184#ifdef CONFIG_USE_PERCPU_NUMA_NODE_ID 70#ifdef CONFIG_USE_PERCPU_NUMA_NODE_ID
185DECLARE_PER_CPU(int, numa_node); 71DECLARE_PER_CPU(int, numa_node);
186 72
@@ -295,4 +181,17 @@ static inline int cpu_to_mem(int cpu)
295#define topology_core_cpumask(cpu) cpumask_of(cpu) 181#define topology_core_cpumask(cpu) cpumask_of(cpu)
296#endif 182#endif
297 183
184#ifdef CONFIG_SCHED_SMT
185static inline const struct cpumask *cpu_smt_mask(int cpu)
186{
187 return topology_thread_cpumask(cpu);
188}
189#endif
190
191static inline const struct cpumask *cpu_cpu_mask(int cpu)
192{
193 return cpumask_of_node(cpu_to_node(cpu));
194}
195
196
298#endif /* _LINUX_TOPOLOGY_H */ 197#endif /* _LINUX_TOPOLOGY_H */
diff --git a/include/linux/torture.h b/include/linux/torture.h
index b2e2b468e511..5ca58fcbaf1b 100644
--- a/include/linux/torture.h
+++ b/include/linux/torture.h
@@ -49,12 +49,6 @@
49#define VERBOSE_TOROUT_ERRSTRING(s) \ 49#define VERBOSE_TOROUT_ERRSTRING(s) \
50 do { if (verbose) pr_alert("%s" TORTURE_FLAG "!!! %s\n", torture_type, s); } while (0) 50 do { if (verbose) pr_alert("%s" TORTURE_FLAG "!!! %s\n", torture_type, s); } while (0)
51 51
52/* Definitions for a non-string torture-test module parameter. */
53#define torture_parm(type, name, init, msg) \
54 static type name = init; \
55 module_param(name, type, 0444); \
56 MODULE_PARM_DESC(name, msg);
57
58/* Definitions for online/offline exerciser. */ 52/* Definitions for online/offline exerciser. */
59int torture_onoff_init(long ooholdoff, long oointerval); 53int torture_onoff_init(long ooholdoff, long oointerval);
60char *torture_onoff_stats(char *page); 54char *torture_onoff_stats(char *page);
@@ -81,7 +75,7 @@ void stutter_wait(const char *title);
81int torture_stutter_init(int s); 75int torture_stutter_init(int s);
82 76
83/* Initialization and cleanup. */ 77/* Initialization and cleanup. */
84void torture_init_begin(char *ttype, bool v, int *runnable); 78bool torture_init_begin(char *ttype, bool v, int *runnable);
85void torture_init_end(void); 79void torture_init_end(void);
86bool torture_cleanup(void); 80bool torture_cleanup(void);
87bool torture_must_stop(void); 81bool torture_must_stop(void);
diff --git a/include/linux/trace_seq.h b/include/linux/trace_seq.h
index a32d86ec8bf2..136116924d8d 100644
--- a/include/linux/trace_seq.h
+++ b/include/linux/trace_seq.h
@@ -46,6 +46,9 @@ extern int trace_seq_putmem_hex(struct trace_seq *s, const void *mem,
46extern void *trace_seq_reserve(struct trace_seq *s, size_t len); 46extern void *trace_seq_reserve(struct trace_seq *s, size_t len);
47extern int trace_seq_path(struct trace_seq *s, const struct path *path); 47extern int trace_seq_path(struct trace_seq *s, const struct path *path);
48 48
49extern int trace_seq_bitmask(struct trace_seq *s, const unsigned long *maskp,
50 int nmaskbits);
51
49#else /* CONFIG_TRACING */ 52#else /* CONFIG_TRACING */
50static inline int trace_seq_printf(struct trace_seq *s, const char *fmt, ...) 53static inline int trace_seq_printf(struct trace_seq *s, const char *fmt, ...)
51{ 54{
@@ -57,6 +60,13 @@ trace_seq_bprintf(struct trace_seq *s, const char *fmt, const u32 *binary)
57 return 0; 60 return 0;
58} 61}
59 62
63static inline int
64trace_seq_bitmask(struct trace_seq *s, const unsigned long *maskp,
65 int nmaskbits)
66{
67 return 0;
68}
69
60static inline int trace_print_seq(struct seq_file *m, struct trace_seq *s) 70static inline int trace_print_seq(struct seq_file *m, struct trace_seq *s)
61{ 71{
62 return 0; 72 return 0;
diff --git a/include/linux/tracehook.h b/include/linux/tracehook.h
index 1e98b5530425..6f8ab7da27c4 100644
--- a/include/linux/tracehook.h
+++ b/include/linux/tracehook.h
@@ -191,7 +191,7 @@ static inline void tracehook_notify_resume(struct pt_regs *regs)
191 * pairs with task_work_add()->set_notify_resume() after 191 * pairs with task_work_add()->set_notify_resume() after
192 * hlist_add_head(task->task_works); 192 * hlist_add_head(task->task_works);
193 */ 193 */
194 smp_mb__after_clear_bit(); 194 smp_mb__after_atomic();
195 if (unlikely(current->task_works)) 195 if (unlikely(current->task_works))
196 task_work_run(); 196 task_work_run();
197} 197}
diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
index 9d30ee469c2a..2e2a5f7717e5 100644
--- a/include/linux/tracepoint.h
+++ b/include/linux/tracepoint.h
@@ -185,6 +185,11 @@ extern void syscall_unregfunc(void);
185 static inline void \ 185 static inline void \
186 check_trace_callback_type_##name(void (*cb)(data_proto)) \ 186 check_trace_callback_type_##name(void (*cb)(data_proto)) \
187 { \ 187 { \
188 } \
189 static inline bool \
190 trace_##name##_enabled(void) \
191 { \
192 return static_key_false(&__tracepoint_##name.key); \
188 } 193 }
189 194
190/* 195/*
@@ -230,6 +235,11 @@ extern void syscall_unregfunc(void);
230 } \ 235 } \
231 static inline void check_trace_callback_type_##name(void (*cb)(data_proto)) \ 236 static inline void check_trace_callback_type_##name(void (*cb)(data_proto)) \
232 { \ 237 { \
238 } \
239 static inline bool \
240 trace_##name##_enabled(void) \
241 { \
242 return false; \
233 } 243 }
234 244
235#define DEFINE_TRACE_FN(name, reg, unreg) 245#define DEFINE_TRACE_FN(name, reg, unreg)
diff --git a/include/linux/tty_ldisc.h b/include/linux/tty_ldisc.h
index add26da2faeb..00c9d688d7b7 100644
--- a/include/linux/tty_ldisc.h
+++ b/include/linux/tty_ldisc.h
@@ -92,7 +92,10 @@
92 * This function is called by the low-level tty driver to signal 92 * This function is called by the low-level tty driver to signal
93 * that line discpline should try to send more characters to the 93 * that line discpline should try to send more characters to the
94 * low-level driver for transmission. If the line discpline does 94 * low-level driver for transmission. If the line discpline does
95 * not have any more data to send, it can just return. 95 * not have any more data to send, it can just return. If the line
96 * discipline does have some data to send, please arise a tasklet
97 * or workqueue to do the real data transfer. Do not send data in
98 * this hook, it may leads to a deadlock.
96 * 99 *
97 * int (*hangup)(struct tty_struct *) 100 * int (*hangup)(struct tty_struct *)
98 * 101 *
diff --git a/include/linux/types.h b/include/linux/types.h
index 4d118ba11349..a0bb7048687f 100644
--- a/include/linux/types.h
+++ b/include/linux/types.h
@@ -142,6 +142,7 @@ typedef unsigned long blkcnt_t;
142#define pgoff_t unsigned long 142#define pgoff_t unsigned long
143#endif 143#endif
144 144
145/* A dma_addr_t can hold any valid DMA or bus address for the platform */
145#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT 146#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
146typedef u64 dma_addr_t; 147typedef u64 dma_addr_t;
147#else 148#else
diff --git a/include/linux/udp.h b/include/linux/udp.h
index 42278bbf7a88..247cfdcc4b08 100644
--- a/include/linux/udp.h
+++ b/include/linux/udp.h
@@ -47,7 +47,9 @@ struct udp_sock {
47#define udp_portaddr_node inet.sk.__sk_common.skc_portaddr_node 47#define udp_portaddr_node inet.sk.__sk_common.skc_portaddr_node
48 int pending; /* Any pending frames ? */ 48 int pending; /* Any pending frames ? */
49 unsigned int corkflag; /* Cork is required */ 49 unsigned int corkflag; /* Cork is required */
50 __u16 encap_type; /* Is this an Encapsulation socket? */ 50 __u8 encap_type; /* Is this an Encapsulation socket? */
51 unsigned char no_check6_tx:1,/* Send zero UDP6 checksums on TX? */
52 no_check6_rx:1;/* Allow zero UDP6 checksums on RX? */
51 /* 53 /*
52 * Following member retains the information to create a UDP header 54 * Following member retains the information to create a UDP header
53 * when the socket is uncorked. 55 * when the socket is uncorked.
@@ -76,6 +78,26 @@ static inline struct udp_sock *udp_sk(const struct sock *sk)
76 return (struct udp_sock *)sk; 78 return (struct udp_sock *)sk;
77} 79}
78 80
81static inline void udp_set_no_check6_tx(struct sock *sk, bool val)
82{
83 udp_sk(sk)->no_check6_tx = val;
84}
85
86static inline void udp_set_no_check6_rx(struct sock *sk, bool val)
87{
88 udp_sk(sk)->no_check6_rx = val;
89}
90
91static inline bool udp_get_no_check6_tx(struct sock *sk)
92{
93 return udp_sk(sk)->no_check6_tx;
94}
95
96static inline bool udp_get_no_check6_rx(struct sock *sk)
97{
98 return udp_sk(sk)->no_check6_rx;
99}
100
79#define udp_portaddr_for_each_entry(__sk, node, list) \ 101#define udp_portaddr_for_each_entry(__sk, node, list) \
80 hlist_nulls_for_each_entry(__sk, node, list, __sk_common.skc_portaddr_node) 102 hlist_nulls_for_each_entry(__sk, node, list, __sk_common.skc_portaddr_node)
81 103
diff --git a/include/linux/uio.h b/include/linux/uio.h
index 199bcc34241b..09a7cffc224e 100644
--- a/include/linux/uio.h
+++ b/include/linux/uio.h
@@ -19,11 +19,21 @@ struct kvec {
19 size_t iov_len; 19 size_t iov_len;
20}; 20};
21 21
22enum {
23 ITER_IOVEC = 0,
24 ITER_KVEC = 2,
25 ITER_BVEC = 4,
26};
27
22struct iov_iter { 28struct iov_iter {
23 const struct iovec *iov; 29 int type;
24 unsigned long nr_segs;
25 size_t iov_offset; 30 size_t iov_offset;
26 size_t count; 31 size_t count;
32 union {
33 const struct iovec *iov;
34 const struct bio_vec *bvec;
35 };
36 unsigned long nr_segs;
27}; 37};
28 38
29/* 39/*
@@ -53,6 +63,7 @@ static inline struct iovec iov_iter_iovec(const struct iov_iter *iter)
53} 63}
54 64
55#define iov_for_each(iov, iter, start) \ 65#define iov_for_each(iov, iter, start) \
66 if (!((start).type & ITER_BVEC)) \
56 for (iter = (start); \ 67 for (iter = (start); \
57 (iter).count && \ 68 (iter).count && \
58 ((iov = iov_iter_iovec(&(iter))), 1); \ 69 ((iov = iov_iter_iovec(&(iter))), 1); \
@@ -62,32 +73,59 @@ unsigned long iov_shorten(struct iovec *iov, unsigned long nr_segs, size_t to);
62 73
63size_t iov_iter_copy_from_user_atomic(struct page *page, 74size_t iov_iter_copy_from_user_atomic(struct page *page,
64 struct iov_iter *i, unsigned long offset, size_t bytes); 75 struct iov_iter *i, unsigned long offset, size_t bytes);
65size_t iov_iter_copy_from_user(struct page *page,
66 struct iov_iter *i, unsigned long offset, size_t bytes);
67void iov_iter_advance(struct iov_iter *i, size_t bytes); 76void iov_iter_advance(struct iov_iter *i, size_t bytes);
68int iov_iter_fault_in_readable(struct iov_iter *i, size_t bytes); 77int iov_iter_fault_in_readable(struct iov_iter *i, size_t bytes);
69size_t iov_iter_single_seg_count(const struct iov_iter *i); 78size_t iov_iter_single_seg_count(const struct iov_iter *i);
70size_t copy_page_to_iter(struct page *page, size_t offset, size_t bytes, 79size_t copy_page_to_iter(struct page *page, size_t offset, size_t bytes,
71 struct iov_iter *i); 80 struct iov_iter *i);
81size_t copy_page_from_iter(struct page *page, size_t offset, size_t bytes,
82 struct iov_iter *i);
83unsigned long iov_iter_alignment(const struct iov_iter *i);
84void iov_iter_init(struct iov_iter *i, int direction, const struct iovec *iov,
85 unsigned long nr_segs, size_t count);
86ssize_t iov_iter_get_pages(struct iov_iter *i, struct page **pages,
87 size_t maxsize, size_t *start);
88ssize_t iov_iter_get_pages_alloc(struct iov_iter *i, struct page ***pages,
89 size_t maxsize, size_t *start);
90int iov_iter_npages(const struct iov_iter *i, int maxpages);
72 91
73static inline void iov_iter_init(struct iov_iter *i, 92static inline size_t iov_iter_count(struct iov_iter *i)
74 const struct iovec *iov, unsigned long nr_segs,
75 size_t count, size_t written)
76{ 93{
77 i->iov = iov; 94 return i->count;
78 i->nr_segs = nr_segs; 95}
79 i->iov_offset = 0;
80 i->count = count + written;
81 96
82 iov_iter_advance(i, written); 97/*
98 * Cap the iov_iter by given limit; note that the second argument is
99 * *not* the new size - it's upper limit for such. Passing it a value
100 * greater than the amount of data in iov_iter is fine - it'll just do
101 * nothing in that case.
102 */
103static inline void iov_iter_truncate(struct iov_iter *i, u64 count)
104{
105 /*
106 * count doesn't have to fit in size_t - comparison extends both
107 * operands to u64 here and any value that would be truncated by
108 * conversion in assignement is by definition greater than all
109 * values of size_t, including old i->count.
110 */
111 if (i->count > count)
112 i->count = count;
83} 113}
84 114
85static inline size_t iov_iter_count(struct iov_iter *i) 115/*
116 * reexpand a previously truncated iterator; count must be no more than how much
117 * we had shrunk it.
118 */
119static inline void iov_iter_reexpand(struct iov_iter *i, size_t count)
86{ 120{
87 return i->count; 121 i->count = count;
88} 122}
89 123
90int memcpy_fromiovec(unsigned char *kdata, struct iovec *iov, int len); 124int memcpy_fromiovec(unsigned char *kdata, struct iovec *iov, int len);
91int memcpy_toiovec(struct iovec *iov, unsigned char *kdata, int len); 125int memcpy_toiovec(struct iovec *iov, unsigned char *kdata, int len);
126int memcpy_fromiovecend(unsigned char *kdata, const struct iovec *iov,
127 int offset, int len);
128int memcpy_toiovecend(const struct iovec *v, unsigned char *kdata,
129 int offset, int len);
92 130
93#endif 131#endif
diff --git a/include/linux/uprobes.h b/include/linux/uprobes.h
index edff2b97b864..4f844c6b03ee 100644
--- a/include/linux/uprobes.h
+++ b/include/linux/uprobes.h
@@ -32,6 +32,7 @@ struct vm_area_struct;
32struct mm_struct; 32struct mm_struct;
33struct inode; 33struct inode;
34struct notifier_block; 34struct notifier_block;
35struct page;
35 36
36#define UPROBE_HANDLER_REMOVE 1 37#define UPROBE_HANDLER_REMOVE 1
37#define UPROBE_HANDLER_MASK 1 38#define UPROBE_HANDLER_MASK 1
@@ -102,6 +103,7 @@ extern int __weak set_orig_insn(struct arch_uprobe *aup, struct mm_struct *mm, u
102extern bool __weak is_swbp_insn(uprobe_opcode_t *insn); 103extern bool __weak is_swbp_insn(uprobe_opcode_t *insn);
103extern bool __weak is_trap_insn(uprobe_opcode_t *insn); 104extern bool __weak is_trap_insn(uprobe_opcode_t *insn);
104extern unsigned long __weak uprobe_get_swbp_addr(struct pt_regs *regs); 105extern unsigned long __weak uprobe_get_swbp_addr(struct pt_regs *regs);
106extern unsigned long uprobe_get_trap_addr(struct pt_regs *regs);
105extern int uprobe_write_opcode(struct mm_struct *mm, unsigned long vaddr, uprobe_opcode_t); 107extern int uprobe_write_opcode(struct mm_struct *mm, unsigned long vaddr, uprobe_opcode_t);
106extern int uprobe_register(struct inode *inode, loff_t offset, struct uprobe_consumer *uc); 108extern int uprobe_register(struct inode *inode, loff_t offset, struct uprobe_consumer *uc);
107extern int uprobe_apply(struct inode *inode, loff_t offset, struct uprobe_consumer *uc, bool); 109extern int uprobe_apply(struct inode *inode, loff_t offset, struct uprobe_consumer *uc, bool);
@@ -127,9 +129,14 @@ extern int arch_uprobe_exception_notify(struct notifier_block *self, unsigned l
127extern void arch_uprobe_abort_xol(struct arch_uprobe *aup, struct pt_regs *regs); 129extern void arch_uprobe_abort_xol(struct arch_uprobe *aup, struct pt_regs *regs);
128extern unsigned long arch_uretprobe_hijack_return_addr(unsigned long trampoline_vaddr, struct pt_regs *regs); 130extern unsigned long arch_uretprobe_hijack_return_addr(unsigned long trampoline_vaddr, struct pt_regs *regs);
129extern bool __weak arch_uprobe_ignore(struct arch_uprobe *aup, struct pt_regs *regs); 131extern bool __weak arch_uprobe_ignore(struct arch_uprobe *aup, struct pt_regs *regs);
132extern void __weak arch_uprobe_copy_ixol(struct page *page, unsigned long vaddr,
133 void *src, unsigned long len);
130#else /* !CONFIG_UPROBES */ 134#else /* !CONFIG_UPROBES */
131struct uprobes_state { 135struct uprobes_state {
132}; 136};
137
138#define uprobe_get_trap_addr(regs) instruction_pointer(regs)
139
133static inline int 140static inline int
134uprobe_register(struct inode *inode, loff_t offset, struct uprobe_consumer *uc) 141uprobe_register(struct inode *inode, loff_t offset, struct uprobe_consumer *uc)
135{ 142{
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 6b7ec376fb4d..d2465bc0e73c 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -352,6 +352,8 @@ struct usb_bus {
352 struct usb_bus *hs_companion; /* Companion EHCI bus, if any */ 352 struct usb_bus *hs_companion; /* Companion EHCI bus, if any */
353 struct list_head bus_list; /* list of busses */ 353 struct list_head bus_list; /* list of busses */
354 354
355 struct mutex usb_address0_mutex; /* unaddressed device mutex */
356
355 int bandwidth_allocated; /* on this bus: how much of the time 357 int bandwidth_allocated; /* on this bus: how much of the time
356 * reserved for periodic (intr/iso) 358 * reserved for periodic (intr/iso)
357 * requests is used, on average? 359 * requests is used, on average?
diff --git a/include/linux/usb/cdc_ncm.h b/include/linux/usb/cdc_ncm.h
index 44b38b92236a..7c9b484735c5 100644
--- a/include/linux/usb/cdc_ncm.h
+++ b/include/linux/usb/cdc_ncm.h
@@ -52,6 +52,10 @@
52#define CDC_NCM_NTB_MAX_SIZE_TX 32768 /* bytes */ 52#define CDC_NCM_NTB_MAX_SIZE_TX 32768 /* bytes */
53#define CDC_NCM_NTB_MAX_SIZE_RX 32768 /* bytes */ 53#define CDC_NCM_NTB_MAX_SIZE_RX 32768 /* bytes */
54 54
55/* Initial NTB length */
56#define CDC_NCM_NTB_DEF_SIZE_TX 16384 /* bytes */
57#define CDC_NCM_NTB_DEF_SIZE_RX 16384 /* bytes */
58
55/* Minimum value for MaxDatagramSize, ch. 6.2.9 */ 59/* Minimum value for MaxDatagramSize, ch. 6.2.9 */
56#define CDC_NCM_MIN_DATAGRAM_SIZE 1514 /* bytes */ 60#define CDC_NCM_MIN_DATAGRAM_SIZE 1514 /* bytes */
57 61
@@ -72,16 +76,9 @@
72/* Restart the timer, if amount of datagrams is less than given value */ 76/* Restart the timer, if amount of datagrams is less than given value */
73#define CDC_NCM_RESTART_TIMER_DATAGRAM_CNT 3 77#define CDC_NCM_RESTART_TIMER_DATAGRAM_CNT 3
74#define CDC_NCM_TIMER_PENDING_CNT 2 78#define CDC_NCM_TIMER_PENDING_CNT 2
75#define CDC_NCM_TIMER_INTERVAL (400UL * NSEC_PER_USEC) 79#define CDC_NCM_TIMER_INTERVAL_USEC 400UL
76 80#define CDC_NCM_TIMER_INTERVAL_MIN 5UL
77/* The following macro defines the minimum header space */ 81#define CDC_NCM_TIMER_INTERVAL_MAX (U32_MAX / NSEC_PER_USEC)
78#define CDC_NCM_MIN_HDR_SIZE \
79 (sizeof(struct usb_cdc_ncm_nth16) + sizeof(struct usb_cdc_ncm_ndp16) + \
80 (CDC_NCM_DPT_DATAGRAMS_MAX + 1) * sizeof(struct usb_cdc_ncm_dpe16))
81
82#define CDC_NCM_NDP_SIZE \
83 (sizeof(struct usb_cdc_ncm_ndp16) + \
84 (CDC_NCM_DPT_DATAGRAMS_MAX + 1) * sizeof(struct usb_cdc_ncm_dpe16))
85 82
86#define cdc_ncm_comm_intf_is_mbim(x) ((x)->desc.bInterfaceSubClass == USB_CDC_SUBCLASS_MBIM && \ 83#define cdc_ncm_comm_intf_is_mbim(x) ((x)->desc.bInterfaceSubClass == USB_CDC_SUBCLASS_MBIM && \
87 (x)->desc.bInterfaceProtocol == USB_CDC_PROTO_NONE) 84 (x)->desc.bInterfaceProtocol == USB_CDC_PROTO_NONE)
@@ -107,6 +104,9 @@ struct cdc_ncm_ctx {
107 spinlock_t mtx; 104 spinlock_t mtx;
108 atomic_t stop; 105 atomic_t stop;
109 106
107 u32 timer_interval;
108 u32 max_ndp_size;
109
110 u32 tx_timer_pending; 110 u32 tx_timer_pending;
111 u32 tx_curr_frame_num; 111 u32 tx_curr_frame_num;
112 u32 rx_max; 112 u32 rx_max;
@@ -118,10 +118,21 @@ struct cdc_ncm_ctx {
118 u16 tx_ndp_modulus; 118 u16 tx_ndp_modulus;
119 u16 tx_seq; 119 u16 tx_seq;
120 u16 rx_seq; 120 u16 rx_seq;
121 u16 connected; 121 u16 min_tx_pkt;
122
123 /* statistics */
124 u32 tx_curr_frame_payload;
125 u32 tx_reason_ntb_full;
126 u32 tx_reason_ndp_full;
127 u32 tx_reason_timeout;
128 u32 tx_reason_max_datagram;
129 u64 tx_overhead;
130 u64 tx_ntbs;
131 u64 rx_overhead;
132 u64 rx_ntbs;
122}; 133};
123 134
124u8 cdc_ncm_select_altsetting(struct usbnet *dev, struct usb_interface *intf); 135u8 cdc_ncm_select_altsetting(struct usb_interface *intf);
125int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_altsetting); 136int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_altsetting);
126void cdc_ncm_unbind(struct usbnet *dev, struct usb_interface *intf); 137void cdc_ncm_unbind(struct usbnet *dev, struct usb_interface *intf);
127struct sk_buff *cdc_ncm_fill_tx_frame(struct usbnet *dev, struct sk_buff *skb, __le32 sign); 138struct sk_buff *cdc_ncm_fill_tx_frame(struct usbnet *dev, struct sk_buff *skb, __le32 sign);
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h
index d3ca3b53837c..7373203140e7 100644
--- a/include/linux/usb/composite.h
+++ b/include/linux/usb/composite.h
@@ -57,6 +57,61 @@
57struct usb_configuration; 57struct usb_configuration;
58 58
59/** 59/**
60 * struct usb_os_desc_ext_prop - describes one "Extended Property"
61 * @entry: used to keep a list of extended properties
62 * @type: Extended Property type
63 * @name_len: Extended Property unicode name length, including terminating '\0'
64 * @name: Extended Property name
65 * @data_len: Length of Extended Property blob (for unicode store double len)
66 * @data: Extended Property blob
67 * @item: Represents this Extended Property in configfs
68 */
69struct usb_os_desc_ext_prop {
70 struct list_head entry;
71 u8 type;
72 int name_len;
73 char *name;
74 int data_len;
75 char *data;
76 struct config_item item;
77};
78
79/**
80 * struct usb_os_desc - describes OS descriptors associated with one interface
81 * @ext_compat_id: 16 bytes of "Compatible ID" and "Subcompatible ID"
82 * @ext_prop: Extended Properties list
83 * @ext_prop_len: Total length of Extended Properties blobs
84 * @ext_prop_count: Number of Extended Properties
85 * @opts_mutex: Optional mutex protecting config data of a usb_function_instance
86 * @group: Represents OS descriptors associated with an interface in configfs
87 * @owner: Module associated with this OS descriptor
88 */
89struct usb_os_desc {
90 char *ext_compat_id;
91 struct list_head ext_prop;
92 int ext_prop_len;
93 int ext_prop_count;
94 struct mutex *opts_mutex;
95 struct config_group group;
96 struct module *owner;
97};
98
99/**
100 * struct usb_os_desc_table - describes OS descriptors associated with one
101 * interface of a usb_function
102 * @if_id: Interface id
103 * @os_desc: "Extended Compatibility ID" and "Extended Properties" of the
104 * interface
105 *
106 * Each interface can have at most one "Extended Compatibility ID" and a
107 * number of "Extended Properties".
108 */
109struct usb_os_desc_table {
110 int if_id;
111 struct usb_os_desc *os_desc;
112};
113
114/**
60 * struct usb_function - describes one function of a configuration 115 * struct usb_function - describes one function of a configuration
61 * @name: For diagnostics, identifies the function. 116 * @name: For diagnostics, identifies the function.
62 * @strings: tables of strings, keyed by identifiers assigned during bind() 117 * @strings: tables of strings, keyed by identifiers assigned during bind()
@@ -73,6 +128,10 @@ struct usb_configuration;
73 * be available at super speed. 128 * be available at super speed.
74 * @config: assigned when @usb_add_function() is called; this is the 129 * @config: assigned when @usb_add_function() is called; this is the
75 * configuration with which this function is associated. 130 * configuration with which this function is associated.
131 * @os_desc_table: Table of (interface id, os descriptors) pairs. The function
132 * can expose more than one interface. If an interface is a member of
133 * an IAD, only the first interface of IAD has its entry in the table.
134 * @os_desc_n: Number of entries in os_desc_table
76 * @bind: Before the gadget can register, all of its functions bind() to the 135 * @bind: Before the gadget can register, all of its functions bind() to the
77 * available resources including string and interface identifiers used 136 * available resources including string and interface identifiers used
78 * in interface or class descriptors; endpoints; I/O buffers; and so on. 137 * in interface or class descriptors; endpoints; I/O buffers; and so on.
@@ -129,6 +188,9 @@ struct usb_function {
129 188
130 struct usb_configuration *config; 189 struct usb_configuration *config;
131 190
191 struct usb_os_desc_table *os_desc_table;
192 unsigned os_desc_n;
193
132 /* REVISIT: bind() functions can be marked __init, which 194 /* REVISIT: bind() functions can be marked __init, which
133 * makes trouble for section mismatch analysis. See if 195 * makes trouble for section mismatch analysis. See if
134 * we can't restructure things to avoid mismatching. 196 * we can't restructure things to avoid mismatching.
@@ -327,6 +389,8 @@ extern void usb_composite_unregister(struct usb_composite_driver *driver);
327extern void usb_composite_setup_continue(struct usb_composite_dev *cdev); 389extern void usb_composite_setup_continue(struct usb_composite_dev *cdev);
328extern int composite_dev_prepare(struct usb_composite_driver *composite, 390extern int composite_dev_prepare(struct usb_composite_driver *composite,
329 struct usb_composite_dev *cdev); 391 struct usb_composite_dev *cdev);
392extern int composite_os_desc_req_prepare(struct usb_composite_dev *cdev,
393 struct usb_ep *ep0);
330void composite_dev_cleanup(struct usb_composite_dev *cdev); 394void composite_dev_cleanup(struct usb_composite_dev *cdev);
331 395
332static inline struct usb_composite_driver *to_cdriver( 396static inline struct usb_composite_driver *to_cdriver(
@@ -335,11 +399,19 @@ static inline struct usb_composite_driver *to_cdriver(
335 return container_of(gdrv, struct usb_composite_driver, gadget_driver); 399 return container_of(gdrv, struct usb_composite_driver, gadget_driver);
336} 400}
337 401
402#define OS_STRING_QW_SIGN_LEN 14
403#define OS_STRING_IDX 0xEE
404
338/** 405/**
339 * struct usb_composite_device - represents one composite usb gadget 406 * struct usb_composite_device - represents one composite usb gadget
340 * @gadget: read-only, abstracts the gadget's usb peripheral controller 407 * @gadget: read-only, abstracts the gadget's usb peripheral controller
341 * @req: used for control responses; buffer is pre-allocated 408 * @req: used for control responses; buffer is pre-allocated
409 * @os_desc_req: used for OS descriptors responses; buffer is pre-allocated
342 * @config: the currently active configuration 410 * @config: the currently active configuration
411 * @qw_sign: qwSignature part of the OS string
412 * @b_vendor_code: bMS_VendorCode part of the OS string
413 * @use_os_string: false by default, interested gadgets set it
414 * @os_desc_config: the configuration to be used with OS descriptors
343 * 415 *
344 * One of these devices is allocated and initialized before the 416 * One of these devices is allocated and initialized before the
345 * associated device driver's bind() is called. 417 * associated device driver's bind() is called.
@@ -369,9 +441,16 @@ static inline struct usb_composite_driver *to_cdriver(
369struct usb_composite_dev { 441struct usb_composite_dev {
370 struct usb_gadget *gadget; 442 struct usb_gadget *gadget;
371 struct usb_request *req; 443 struct usb_request *req;
444 struct usb_request *os_desc_req;
372 445
373 struct usb_configuration *config; 446 struct usb_configuration *config;
374 447
448 /* OS String is a custom (yet popular) extension to the USB standard. */
449 u8 qw_sign[OS_STRING_QW_SIGN_LEN];
450 u8 b_vendor_code;
451 struct usb_configuration *os_desc_config;
452 unsigned int use_os_string:1;
453
375 /* private: */ 454 /* private: */
376 /* internals */ 455 /* internals */
377 unsigned int suspended:1; 456 unsigned int suspended:1;
diff --git a/include/linux/usb/msm_hsusb.h b/include/linux/usb/msm_hsusb.h
index 32754835a39b..b0a39243295a 100644
--- a/include/linux/usb/msm_hsusb.h
+++ b/include/linux/usb/msm_hsusb.h
@@ -23,21 +23,6 @@
23#include <linux/clk.h> 23#include <linux/clk.h>
24 24
25/** 25/**
26 * Supported USB modes
27 *
28 * USB_PERIPHERAL Only peripheral mode is supported.
29 * USB_HOST Only host mode is supported.
30 * USB_OTG OTG mode is supported.
31 *
32 */
33enum usb_mode_type {
34 USB_NONE = 0,
35 USB_PERIPHERAL,
36 USB_HOST,
37 USB_OTG,
38};
39
40/**
41 * OTG control 26 * OTG control
42 * 27 *
43 * OTG_NO_CONTROL Id/VBUS notifications not required. Useful in host 28 * OTG_NO_CONTROL Id/VBUS notifications not required. Useful in host
@@ -115,27 +100,23 @@ enum usb_chg_type {
115/** 100/**
116 * struct msm_otg_platform_data - platform device data 101 * struct msm_otg_platform_data - platform device data
117 * for msm_otg driver. 102 * for msm_otg driver.
118 * @phy_init_seq: PHY configuration sequence. val, reg pairs 103 * @phy_init_seq: PHY configuration sequence values. Value of -1 is reserved as
119 * terminated by -1. 104 * "do not overwrite default vaule at this address".
105 * @phy_init_sz: PHY configuration sequence size.
120 * @vbus_power: VBUS power on/off routine. 106 * @vbus_power: VBUS power on/off routine.
121 * @power_budget: VBUS power budget in mA (0 will be treated as 500mA). 107 * @power_budget: VBUS power budget in mA (0 will be treated as 500mA).
122 * @mode: Supported mode (OTG/peripheral/host). 108 * @mode: Supported mode (OTG/peripheral/host).
123 * @otg_control: OTG switch controlled by user/Id pin 109 * @otg_control: OTG switch controlled by user/Id pin
124 * @default_mode: Default operational mode. Applicable only if
125 * OTG switch is controller by user.
126 * @pclk_src_name: pclk is derived from ebi1_usb_clk in case of 7x27 and 8k
127 * dfab_usb_hs_clk in case of 8660 and 8960.
128 */ 110 */
129struct msm_otg_platform_data { 111struct msm_otg_platform_data {
130 int *phy_init_seq; 112 int *phy_init_seq;
113 int phy_init_sz;
131 void (*vbus_power)(bool on); 114 void (*vbus_power)(bool on);
132 unsigned power_budget; 115 unsigned power_budget;
133 enum usb_mode_type mode; 116 enum usb_dr_mode mode;
134 enum otg_control_type otg_control; 117 enum otg_control_type otg_control;
135 enum usb_mode_type default_mode;
136 enum msm_usb_phy_type phy_type; 118 enum msm_usb_phy_type phy_type;
137 void (*setup_gpio)(enum usb_otg_state state); 119 void (*setup_gpio)(enum usb_otg_state state);
138 char *pclk_src_name;
139 int (*link_clk_reset)(struct clk *link_clk, bool assert); 120 int (*link_clk_reset)(struct clk *link_clk, bool assert);
140 int (*phy_clk_reset)(struct clk *phy_clk); 121 int (*phy_clk_reset)(struct clk *phy_clk);
141}; 122};
@@ -147,7 +128,6 @@ struct msm_otg_platform_data {
147 * @irq: IRQ number assigned for HSUSB controller. 128 * @irq: IRQ number assigned for HSUSB controller.
148 * @clk: clock struct of usb_hs_clk. 129 * @clk: clock struct of usb_hs_clk.
149 * @pclk: clock struct of usb_hs_pclk. 130 * @pclk: clock struct of usb_hs_pclk.
150 * @pclk_src: pclk source for voting.
151 * @phy_reset_clk: clock struct of usb_phy_clk. 131 * @phy_reset_clk: clock struct of usb_phy_clk.
152 * @core_clk: clock struct of usb_hs_core_clk. 132 * @core_clk: clock struct of usb_hs_core_clk.
153 * @regs: ioremapped register base address. 133 * @regs: ioremapped register base address.
@@ -168,7 +148,6 @@ struct msm_otg {
168 int irq; 148 int irq;
169 struct clk *clk; 149 struct clk *clk;
170 struct clk *pclk; 150 struct clk *pclk;
171 struct clk *pclk_src;
172 struct clk *phy_reset_clk; 151 struct clk *phy_reset_clk;
173 struct clk *core_clk; 152 struct clk *core_clk;
174 void __iomem *regs; 153 void __iomem *regs;
@@ -179,10 +158,18 @@ struct msm_otg {
179 atomic_t in_lpm; 158 atomic_t in_lpm;
180 int async_int; 159 int async_int;
181 unsigned cur_power; 160 unsigned cur_power;
161 int phy_number;
182 struct delayed_work chg_work; 162 struct delayed_work chg_work;
183 enum usb_chg_state chg_state; 163 enum usb_chg_state chg_state;
184 enum usb_chg_type chg_type; 164 enum usb_chg_type chg_type;
185 u8 dcd_retries; 165 u8 dcd_retries;
166 struct regulator *v3p3;
167 struct regulator *v1p8;
168 struct regulator *vddcx;
169
170 struct reset_control *phy_rst;
171 struct reset_control *link_rst;
172 int vdd_levels[3];
186}; 173};
187 174
188#endif 175#endif
diff --git a/include/linux/usb/msm_hsusb_hw.h b/include/linux/usb/msm_hsusb_hw.h
index 6e97a2d3d39f..a29f6030afb1 100644
--- a/include/linux/usb/msm_hsusb_hw.h
+++ b/include/linux/usb/msm_hsusb_hw.h
@@ -16,6 +16,9 @@
16#ifndef __LINUX_USB_GADGET_MSM72K_UDC_H__ 16#ifndef __LINUX_USB_GADGET_MSM72K_UDC_H__
17#define __LINUX_USB_GADGET_MSM72K_UDC_H__ 17#define __LINUX_USB_GADGET_MSM72K_UDC_H__
18 18
19/* USB phy selector - in TCSR address range */
20#define USB2_PHY_SEL 0xfd4ab000
21
19#define USB_AHBBURST (MSM_USB_BASE + 0x0090) 22#define USB_AHBBURST (MSM_USB_BASE + 0x0090)
20#define USB_AHBMODE (MSM_USB_BASE + 0x0098) 23#define USB_AHBMODE (MSM_USB_BASE + 0x0098)
21#define USB_CAPLENGTH (MSM_USB_BASE + 0x0100) /* 8 bit */ 24#define USB_CAPLENGTH (MSM_USB_BASE + 0x0100) /* 8 bit */
@@ -25,13 +28,15 @@
25#define USB_OTGSC (MSM_USB_BASE + 0x01A4) 28#define USB_OTGSC (MSM_USB_BASE + 0x01A4)
26#define USB_USBMODE (MSM_USB_BASE + 0x01A8) 29#define USB_USBMODE (MSM_USB_BASE + 0x01A8)
27#define USB_PHY_CTRL (MSM_USB_BASE + 0x0240) 30#define USB_PHY_CTRL (MSM_USB_BASE + 0x0240)
31#define USB_PHY_CTRL2 (MSM_USB_BASE + 0x0278)
28 32
29#define USBCMD_RESET 2 33#define USBCMD_RESET 2
30#define USB_USBINTR (MSM_USB_BASE + 0x0148) 34#define USB_USBINTR (MSM_USB_BASE + 0x0148)
31 35
32#define PORTSC_PHCD (1 << 23) /* phy suspend mode */ 36#define PORTSC_PHCD (1 << 23) /* phy suspend mode */
33#define PORTSC_PTS_MASK (3 << 30) 37#define PORTSC_PTS_MASK (3 << 30)
34#define PORTSC_PTS_ULPI (3 << 30) 38#define PORTSC_PTS_ULPI (2 << 30)
39#define PORTSC_PTS_SERIAL (3 << 30)
35 40
36#define USB_ULPI_VIEWPORT (MSM_USB_BASE + 0x0170) 41#define USB_ULPI_VIEWPORT (MSM_USB_BASE + 0x0170)
37#define ULPI_RUN (1 << 30) 42#define ULPI_RUN (1 << 30)
@@ -41,9 +46,14 @@
41#define ULPI_DATA(n) ((n) & 255) 46#define ULPI_DATA(n) ((n) & 255)
42#define ULPI_DATA_READ(n) (((n) >> 8) & 255) 47#define ULPI_DATA_READ(n) (((n) >> 8) & 255)
43 48
49/* synopsys 28nm phy registers */
50#define ULPI_PWR_CLK_MNG_REG 0x88
51#define OTG_COMP_DISABLE BIT(0)
52
44#define ASYNC_INTR_CTRL (1 << 29) /* Enable async interrupt */ 53#define ASYNC_INTR_CTRL (1 << 29) /* Enable async interrupt */
45#define ULPI_STP_CTRL (1 << 30) /* Block communication with PHY */ 54#define ULPI_STP_CTRL (1 << 30) /* Block communication with PHY */
46#define PHY_RETEN (1 << 1) /* PHY retention enable/disable */ 55#define PHY_RETEN (1 << 1) /* PHY retention enable/disable */
56#define PHY_POR_ASSERT (1 << 0) /* USB2 28nm PHY POR ASSERT */
47 57
48/* OTG definitions */ 58/* OTG definitions */
49#define OTGSC_INTSTS_MASK (0x7f << 16) 59#define OTGSC_INTSTS_MASK (0x7f << 16)
diff --git a/include/linux/usb/usb_phy_gen_xceiv.h b/include/linux/usb/usb_phy_generic.h
index cc8d818a83be..68adae83affc 100644
--- a/include/linux/usb/usb_phy_gen_xceiv.h
+++ b/include/linux/usb/usb_phy_generic.h
@@ -3,7 +3,7 @@
3 3
4#include <linux/usb/otg.h> 4#include <linux/usb/otg.h>
5 5
6struct usb_phy_gen_xceiv_platform_data { 6struct usb_phy_generic_platform_data {
7 enum usb_phy_type type; 7 enum usb_phy_type type;
8 unsigned long clk_rate; 8 unsigned long clk_rate;
9 9
@@ -13,16 +13,17 @@ struct usb_phy_gen_xceiv_platform_data {
13 int gpio_reset; 13 int gpio_reset;
14}; 14};
15 15
16#if defined(CONFIG_NOP_USB_XCEIV) || (defined(CONFIG_NOP_USB_XCEIV_MODULE) && defined(MODULE)) 16#if IS_ENABLED(CONFIG_NOP_USB_XCEIV)
17/* sometimes transceivers are accessed only through e.g. ULPI */ 17/* sometimes transceivers are accessed only through e.g. ULPI */
18extern void usb_nop_xceiv_register(void); 18extern struct platform_device *usb_phy_generic_register(void);
19extern void usb_nop_xceiv_unregister(void); 19extern void usb_phy_generic_unregister(struct platform_device *);
20#else 20#else
21static inline void usb_nop_xceiv_register(void) 21static inline struct platform_device *usb_phy_generic_register(void)
22{ 22{
23 return NULL;
23} 24}
24 25
25static inline void usb_nop_xceiv_unregister(void) 26static inline void usb_phy_generic_unregister(struct platform_device *pdev)
26{ 27{
27} 28}
28#endif 29#endif
diff --git a/include/linux/usb_usual.h b/include/linux/usb_usual.h
index 1a64b26046ed..9b7de1b46437 100644
--- a/include/linux/usb_usual.h
+++ b/include/linux/usb_usual.h
@@ -70,7 +70,9 @@
70 US_FLAG(NEEDS_CAP16, 0x00400000) \ 70 US_FLAG(NEEDS_CAP16, 0x00400000) \
71 /* cannot handle READ_CAPACITY_10 */ \ 71 /* cannot handle READ_CAPACITY_10 */ \
72 US_FLAG(IGNORE_UAS, 0x00800000) \ 72 US_FLAG(IGNORE_UAS, 0x00800000) \
73 /* Device advertises UAS but it is broken */ 73 /* Device advertises UAS but it is broken */ \
74 US_FLAG(BROKEN_FUA, 0x01000000) \
75 /* Cannot handle FUA in WRITE or READ CDBs */ \
74 76
75#define US_FLAG(name, value) US_FL_##name = value , 77#define US_FLAG(name, value) US_FL_##name = value ,
76enum { US_DO_ALL_FLAGS }; 78enum { US_DO_ALL_FLAGS };
diff --git a/include/linux/vexpress.h b/include/linux/vexpress.h
index 617c01b8f74a..a4c9547aae64 100644
--- a/include/linux/vexpress.h
+++ b/include/linux/vexpress.h
@@ -15,28 +15,15 @@
15#define _LINUX_VEXPRESS_H 15#define _LINUX_VEXPRESS_H
16 16
17#include <linux/device.h> 17#include <linux/device.h>
18#include <linux/platform_device.h>
18#include <linux/reboot.h> 19#include <linux/reboot.h>
20#include <linux/regmap.h>
19 21
20#define VEXPRESS_SITE_MB 0 22#define VEXPRESS_SITE_MB 0
21#define VEXPRESS_SITE_DB1 1 23#define VEXPRESS_SITE_DB1 1
22#define VEXPRESS_SITE_DB2 2 24#define VEXPRESS_SITE_DB2 2
23#define VEXPRESS_SITE_MASTER 0xf 25#define VEXPRESS_SITE_MASTER 0xf
24 26
25#define VEXPRESS_CONFIG_STATUS_DONE 0
26#define VEXPRESS_CONFIG_STATUS_WAIT 1
27
28#define VEXPRESS_GPIO_MMC_CARDIN 0
29#define VEXPRESS_GPIO_MMC_WPROT 1
30#define VEXPRESS_GPIO_FLASH_WPn 2
31#define VEXPRESS_GPIO_LED0 3
32#define VEXPRESS_GPIO_LED1 4
33#define VEXPRESS_GPIO_LED2 5
34#define VEXPRESS_GPIO_LED3 6
35#define VEXPRESS_GPIO_LED4 7
36#define VEXPRESS_GPIO_LED5 8
37#define VEXPRESS_GPIO_LED6 9
38#define VEXPRESS_GPIO_LED7 10
39
40#define VEXPRESS_RES_FUNC(_site, _func) \ 27#define VEXPRESS_RES_FUNC(_site, _func) \
41{ \ 28{ \
42 .start = (_site), \ 29 .start = (_site), \
@@ -44,84 +31,43 @@
44 .flags = IORESOURCE_BUS, \ 31 .flags = IORESOURCE_BUS, \
45} 32}
46 33
47/* Config bridge API */ 34/* Config infrastructure */
48 35
49/** 36void vexpress_config_set_master(u32 site);
50 * struct vexpress_config_bridge_info - description of the platform 37u32 vexpress_config_get_master(void);
51 * configuration infrastructure bridge.
52 *
53 * @name: Bridge name
54 *
55 * @func_get: Obtains pointer to a configuration function for a given
56 * device or a Device Tree node, to be used with @func_put
57 * and @func_exec. The node pointer should take precedence
58 * over device pointer when both are passed.
59 *
60 * @func_put: Tells the bridge that the function will not be used any
61 * more, so all allocated resources can be released.
62 *
63 * @func_exec: Executes a configuration function read or write operation.
64 * The offset selects a 32 bit word of the value accessed.
65 * Must return VEXPRESS_CONFIG_STATUS_DONE when operation
66 * is finished immediately, VEXPRESS_CONFIG_STATUS_WAIT when
67 * will be completed in some time or negative value in case
68 * of error.
69 */
70struct vexpress_config_bridge_info {
71 const char *name;
72 void *(*func_get)(struct device *dev, struct device_node *node);
73 void (*func_put)(void *func);
74 int (*func_exec)(void *func, int offset, bool write, u32 *data);
75};
76 38
77struct vexpress_config_bridge; 39void vexpress_config_lock(void *arg);
40void vexpress_config_unlock(void *arg);
78 41
79struct vexpress_config_bridge *vexpress_config_bridge_register( 42int vexpress_config_get_topo(struct device_node *node, u32 *site,
80 struct device_node *node, 43 u32 *position, u32 *dcc);
81 struct vexpress_config_bridge_info *info);
82void vexpress_config_bridge_unregister(struct vexpress_config_bridge *bridge);
83 44
84void vexpress_config_complete(struct vexpress_config_bridge *bridge, 45/* Config bridge API */
85 int status);
86 46
87/* Config function API */ 47struct vexpress_config_bridge_ops {
48 struct regmap * (*regmap_init)(struct device *dev, void *context);
49 void (*regmap_exit)(struct regmap *regmap, void *context);
50};
88 51
89struct vexpress_config_func; 52struct device *vexpress_config_bridge_register(struct device *parent,
53 struct vexpress_config_bridge_ops *ops, void *context);
90 54
91struct vexpress_config_func *__vexpress_config_func_get(struct device *dev, 55/* Config regmap API */
92 struct device_node *node);
93#define vexpress_config_func_get_by_dev(dev) \
94 __vexpress_config_func_get(dev, NULL)
95#define vexpress_config_func_get_by_node(node) \
96 __vexpress_config_func_get(NULL, node)
97void vexpress_config_func_put(struct vexpress_config_func *func);
98 56
99/* Both may sleep! */ 57struct regmap *devm_regmap_init_vexpress_config(struct device *dev);
100int vexpress_config_read(struct vexpress_config_func *func, int offset,
101 u32 *data);
102int vexpress_config_write(struct vexpress_config_func *func, int offset,
103 u32 data);
104 58
105/* Platform control */ 59/* Platform control */
106 60
61unsigned int vexpress_get_mci_cardin(struct device *dev);
107u32 vexpress_get_procid(int site); 62u32 vexpress_get_procid(int site);
108u32 vexpress_get_hbi(int site);
109void *vexpress_get_24mhz_clock_base(void); 63void *vexpress_get_24mhz_clock_base(void);
110void vexpress_flags_set(u32 data); 64void vexpress_flags_set(u32 data);
111 65
112#define vexpress_get_site_by_node(node) __vexpress_get_site(NULL, node)
113#define vexpress_get_site_by_dev(dev) __vexpress_get_site(dev, NULL)
114unsigned __vexpress_get_site(struct device *dev, struct device_node *node);
115
116void vexpress_sysreg_early_init(void __iomem *base); 66void vexpress_sysreg_early_init(void __iomem *base);
117void vexpress_sysreg_of_early_init(void); 67int vexpress_syscfg_device_register(struct platform_device *pdev);
118 68
119/* Clocks */ 69/* Clocks */
120 70
121struct clk *vexpress_osc_setup(struct device *dev);
122void vexpress_osc_of_setup(struct device_node *node);
123
124void vexpress_clk_init(void __iomem *sp810_base); 71void vexpress_clk_init(void __iomem *sp810_base);
125void vexpress_clk_of_init(void);
126 72
127#endif 73#endif
diff --git a/include/linux/vfio.h b/include/linux/vfio.h
index 81022a52bc34..8ec980b5e3af 100644
--- a/include/linux/vfio.h
+++ b/include/linux/vfio.h
@@ -86,9 +86,8 @@ extern void vfio_unregister_iommu_driver(
86 * from user space. This allows us to easily determine if the provided 86 * from user space. This allows us to easily determine if the provided
87 * structure is sized to include various fields. 87 * structure is sized to include various fields.
88 */ 88 */
89#define offsetofend(TYPE, MEMBER) ({ \ 89#define offsetofend(TYPE, MEMBER) \
90 TYPE tmp; \ 90 (offsetof(TYPE, MEMBER) + sizeof(((TYPE *)0)->MEMBER))
91 offsetof(TYPE, MEMBER) + sizeof(tmp.MEMBER); }) \
92 91
93/* 92/*
94 * External user API 93 * External user API
diff --git a/include/linux/virtio.h b/include/linux/virtio.h
index e4abb84199be..b46671e28de2 100644
--- a/include/linux/virtio.h
+++ b/include/linux/virtio.h
@@ -106,6 +106,8 @@ static inline struct virtio_device *dev_to_virtio(struct device *_dev)
106int register_virtio_device(struct virtio_device *dev); 106int register_virtio_device(struct virtio_device *dev);
107void unregister_virtio_device(struct virtio_device *dev); 107void unregister_virtio_device(struct virtio_device *dev);
108 108
109void virtio_break_device(struct virtio_device *dev);
110
109/** 111/**
110 * virtio_driver - operations for a virtio I/O driver 112 * virtio_driver - operations for a virtio I/O driver
111 * @driver: underlying device driver (populate name and owner). 113 * @driver: underlying device driver (populate name and owner).
diff --git a/include/linux/virtio_scsi.h b/include/linux/virtio_scsi.h
index 4195b97a3def..de429d1f4357 100644
--- a/include/linux/virtio_scsi.h
+++ b/include/linux/virtio_scsi.h
@@ -35,11 +35,23 @@ struct virtio_scsi_cmd_req {
35 u8 lun[8]; /* Logical Unit Number */ 35 u8 lun[8]; /* Logical Unit Number */
36 u64 tag; /* Command identifier */ 36 u64 tag; /* Command identifier */
37 u8 task_attr; /* Task attribute */ 37 u8 task_attr; /* Task attribute */
38 u8 prio; 38 u8 prio; /* SAM command priority field */
39 u8 crn; 39 u8 crn;
40 u8 cdb[VIRTIO_SCSI_CDB_SIZE]; 40 u8 cdb[VIRTIO_SCSI_CDB_SIZE];
41} __packed; 41} __packed;
42 42
43/* SCSI command request, followed by protection information */
44struct virtio_scsi_cmd_req_pi {
45 u8 lun[8]; /* Logical Unit Number */
46 u64 tag; /* Command identifier */
47 u8 task_attr; /* Task attribute */
48 u8 prio; /* SAM command priority field */
49 u8 crn;
50 u32 pi_bytesout; /* DataOUT PI Number of bytes */
51 u32 pi_bytesin; /* DataIN PI Number of bytes */
52 u8 cdb[VIRTIO_SCSI_CDB_SIZE];
53} __packed;
54
43/* Response, followed by sense data and data-in */ 55/* Response, followed by sense data and data-in */
44struct virtio_scsi_cmd_resp { 56struct virtio_scsi_cmd_resp {
45 u32 sense_len; /* Sense data length */ 57 u32 sense_len; /* Sense data length */
@@ -97,6 +109,7 @@ struct virtio_scsi_config {
97#define VIRTIO_SCSI_F_INOUT 0 109#define VIRTIO_SCSI_F_INOUT 0
98#define VIRTIO_SCSI_F_HOTPLUG 1 110#define VIRTIO_SCSI_F_HOTPLUG 1
99#define VIRTIO_SCSI_F_CHANGE 2 111#define VIRTIO_SCSI_F_CHANGE 2
112#define VIRTIO_SCSI_F_T10_PI 3
100 113
101/* Response codes */ 114/* Response codes */
102#define VIRTIO_SCSI_S_OK 0 115#define VIRTIO_SCSI_S_OK 0
diff --git a/include/linux/vm_event_item.h b/include/linux/vm_event_item.h
index 486c3972c0be..ced92345c963 100644
--- a/include/linux/vm_event_item.h
+++ b/include/linux/vm_event_item.h
@@ -80,6 +80,10 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
80 NR_TLB_LOCAL_FLUSH_ALL, 80 NR_TLB_LOCAL_FLUSH_ALL,
81 NR_TLB_LOCAL_FLUSH_ONE, 81 NR_TLB_LOCAL_FLUSH_ONE,
82#endif /* CONFIG_DEBUG_TLBFLUSH */ 82#endif /* CONFIG_DEBUG_TLBFLUSH */
83#ifdef CONFIG_DEBUG_VM_VMACACHE
84 VMACACHE_FIND_CALLS,
85 VMACACHE_FIND_HITS,
86#endif
83 NR_VM_EVENT_ITEMS 87 NR_VM_EVENT_ITEMS
84}; 88};
85 89
diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h
index 45c9cd1daf7a..82e7db7f7100 100644
--- a/include/linux/vmstat.h
+++ b/include/linux/vmstat.h
@@ -95,6 +95,12 @@ static inline void vm_events_fold_cpu(int cpu)
95#define count_vm_tlb_events(x, y) do { (void)(y); } while (0) 95#define count_vm_tlb_events(x, y) do { (void)(y); } while (0)
96#endif 96#endif
97 97
98#ifdef CONFIG_DEBUG_VM_VMACACHE
99#define count_vm_vmacache_event(x) count_vm_event(x)
100#else
101#define count_vm_vmacache_event(x) do {} while (0)
102#endif
103
98#define __count_zone_vm_events(item, zone, delta) \ 104#define __count_zone_vm_events(item, zone, delta) \
99 __count_vm_events(item##_NORMAL - ZONE_NORMAL + \ 105 __count_vm_events(item##_NORMAL - ZONE_NORMAL + \
100 zone_idx(zone), delta) 106 zone_idx(zone), delta)
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
index 1b22c42e9c2d..a0cc2e95ed1b 100644
--- a/include/linux/workqueue.h
+++ b/include/linux/workqueue.h
@@ -56,9 +56,8 @@ enum {
56 WORK_NR_COLORS = (1 << WORK_STRUCT_COLOR_BITS) - 1, 56 WORK_NR_COLORS = (1 << WORK_STRUCT_COLOR_BITS) - 1,
57 WORK_NO_COLOR = WORK_NR_COLORS, 57 WORK_NO_COLOR = WORK_NR_COLORS,
58 58
59 /* special cpu IDs */ 59 /* not bound to any CPU, prefer the local CPU */
60 WORK_CPU_UNBOUND = NR_CPUS, 60 WORK_CPU_UNBOUND = NR_CPUS,
61 WORK_CPU_END = NR_CPUS + 1,
62 61
63 /* 62 /*
64 * Reserve 7 bits off of pwq pointer w/ debugobjects turned off. 63 * Reserve 7 bits off of pwq pointer w/ debugobjects turned off.
@@ -274,13 +273,6 @@ static inline unsigned int work_static(struct work_struct *work) { return 0; }
274#define delayed_work_pending(w) \ 273#define delayed_work_pending(w) \
275 work_pending(&(w)->work) 274 work_pending(&(w)->work)
276 275
277/**
278 * work_clear_pending - for internal use only, mark a work item as not pending
279 * @work: The work item in question
280 */
281#define work_clear_pending(work) \
282 clear_bit(WORK_STRUCT_PENDING_BIT, work_data_bits(work))
283
284/* 276/*
285 * Workqueue flags and constants. For details, please refer to 277 * Workqueue flags and constants. For details, please refer to
286 * Documentation/workqueue.txt. 278 * Documentation/workqueue.txt.
@@ -340,6 +332,9 @@ enum {
340 * short queue flush time. Don't queue works which can run for too 332 * short queue flush time. Don't queue works which can run for too
341 * long. 333 * long.
342 * 334 *
335 * system_highpri_wq is similar to system_wq but for work items which
336 * require WQ_HIGHPRI.
337 *
343 * system_long_wq is similar to system_wq but may host long running 338 * system_long_wq is similar to system_wq but may host long running
344 * works. Queue flushing might take relatively long. 339 * works. Queue flushing might take relatively long.
345 * 340 *
@@ -358,26 +353,13 @@ enum {
358 * 'wq_power_efficient' is disabled. See WQ_POWER_EFFICIENT for more info. 353 * 'wq_power_efficient' is disabled. See WQ_POWER_EFFICIENT for more info.
359 */ 354 */
360extern struct workqueue_struct *system_wq; 355extern struct workqueue_struct *system_wq;
356extern struct workqueue_struct *system_highpri_wq;
361extern struct workqueue_struct *system_long_wq; 357extern struct workqueue_struct *system_long_wq;
362extern struct workqueue_struct *system_unbound_wq; 358extern struct workqueue_struct *system_unbound_wq;
363extern struct workqueue_struct *system_freezable_wq; 359extern struct workqueue_struct *system_freezable_wq;
364extern struct workqueue_struct *system_power_efficient_wq; 360extern struct workqueue_struct *system_power_efficient_wq;
365extern struct workqueue_struct *system_freezable_power_efficient_wq; 361extern struct workqueue_struct *system_freezable_power_efficient_wq;
366 362
367static inline struct workqueue_struct * __deprecated __system_nrt_wq(void)
368{
369 return system_wq;
370}
371
372static inline struct workqueue_struct * __deprecated __system_nrt_freezable_wq(void)
373{
374 return system_freezable_wq;
375}
376
377/* equivlalent to system_wq and system_freezable_wq, deprecated */
378#define system_nrt_wq __system_nrt_wq()
379#define system_nrt_freezable_wq __system_nrt_freezable_wq()
380
381extern struct workqueue_struct * 363extern struct workqueue_struct *
382__alloc_workqueue_key(const char *fmt, unsigned int flags, int max_active, 364__alloc_workqueue_key(const char *fmt, unsigned int flags, int max_active,
383 struct lock_class_key *key, const char *lock_name, ...) __printf(1, 6); 365 struct lock_class_key *key, const char *lock_name, ...) __printf(1, 6);
@@ -587,18 +569,6 @@ static inline bool keventd_up(void)
587 return system_wq != NULL; 569 return system_wq != NULL;
588} 570}
589 571
590/* used to be different but now identical to flush_work(), deprecated */
591static inline bool __deprecated flush_work_sync(struct work_struct *work)
592{
593 return flush_work(work);
594}
595
596/* used to be different but now identical to flush_delayed_work(), deprecated */
597static inline bool __deprecated flush_delayed_work_sync(struct delayed_work *dwork)
598{
599 return flush_delayed_work(dwork);
600}
601
602#ifndef CONFIG_SMP 572#ifndef CONFIG_SMP
603static inline long work_on_cpu(int cpu, long (*fn)(void *), void *arg) 573static inline long work_on_cpu(int cpu, long (*fn)(void *), void *arg)
604{ 574{
diff --git a/include/linux/zbud.h b/include/linux/zbud.h
index 2571a5cfa5fc..13af0d450bf6 100644
--- a/include/linux/zbud.h
+++ b/include/linux/zbud.h
@@ -11,7 +11,7 @@ struct zbud_ops {
11 11
12struct zbud_pool *zbud_create_pool(gfp_t gfp, struct zbud_ops *ops); 12struct zbud_pool *zbud_create_pool(gfp_t gfp, struct zbud_ops *ops);
13void zbud_destroy_pool(struct zbud_pool *pool); 13void zbud_destroy_pool(struct zbud_pool *pool);
14int zbud_alloc(struct zbud_pool *pool, int size, gfp_t gfp, 14int zbud_alloc(struct zbud_pool *pool, unsigned int size, gfp_t gfp,
15 unsigned long *handle); 15 unsigned long *handle);
16void zbud_free(struct zbud_pool *pool, unsigned long handle); 16void zbud_free(struct zbud_pool *pool, unsigned long handle);
17int zbud_reclaim_page(struct zbud_pool *pool, unsigned int retries); 17int zbud_reclaim_page(struct zbud_pool *pool, unsigned int retries);
diff --git a/include/media/adv7604.h b/include/media/adv7604.h
index d262a3a922bd..aa1c4477722d 100644
--- a/include/media/adv7604.h
+++ b/include/media/adv7604.h
@@ -21,6 +21,8 @@
21#ifndef _ADV7604_ 21#ifndef _ADV7604_
22#define _ADV7604_ 22#define _ADV7604_
23 23
24#include <linux/types.h>
25
24/* Analog input muxing modes (AFE register 0x02, [2:0]) */ 26/* Analog input muxing modes (AFE register 0x02, [2:0]) */
25enum adv7604_ain_sel { 27enum adv7604_ain_sel {
26 ADV7604_AIN1_2_3_NC_SYNC_1_2 = 0, 28 ADV7604_AIN1_2_3_NC_SYNC_1_2 = 0,
@@ -30,14 +32,18 @@ enum adv7604_ain_sel {
30 ADV7604_AIN9_4_5_6_SYNC_2_1 = 4, 32 ADV7604_AIN9_4_5_6_SYNC_2_1 = 4,
31}; 33};
32 34
33/* Bus rotation and reordering (IO register 0x04, [7:5]) */ 35/*
34enum adv7604_op_ch_sel { 36 * Bus rotation and reordering. This is used to specify component reordering on
35 ADV7604_OP_CH_SEL_GBR = 0, 37 * the board and describes the components order on the bus when the ADV7604
36 ADV7604_OP_CH_SEL_GRB = 1, 38 * outputs RGB.
37 ADV7604_OP_CH_SEL_BGR = 2, 39 */
38 ADV7604_OP_CH_SEL_RGB = 3, 40enum adv7604_bus_order {
39 ADV7604_OP_CH_SEL_BRG = 4, 41 ADV7604_BUS_ORDER_RGB, /* No operation */
40 ADV7604_OP_CH_SEL_RBG = 5, 42 ADV7604_BUS_ORDER_GRB, /* Swap 1-2 */
43 ADV7604_BUS_ORDER_RBG, /* Swap 2-3 */
44 ADV7604_BUS_ORDER_BGR, /* Swap 1-3 */
45 ADV7604_BUS_ORDER_BRG, /* Rotate right */
46 ADV7604_BUS_ORDER_GBR, /* Rotate left */
41}; 47};
42 48
43/* Input Color Space (IO register 0x02, [7:4]) */ 49/* Input Color Space (IO register 0x02, [7:4]) */
@@ -53,29 +59,11 @@ enum adv7604_inp_color_space {
53 ADV7604_INP_COLOR_SPACE_AUTO = 0xf, 59 ADV7604_INP_COLOR_SPACE_AUTO = 0xf,
54}; 60};
55 61
56/* Select output format (IO register 0x03, [7:0]) */ 62/* Select output format (IO register 0x03, [4:2]) */
57enum adv7604_op_format_sel { 63enum adv7604_op_format_mode_sel {
58 ADV7604_OP_FORMAT_SEL_SDR_ITU656_8 = 0x00, 64 ADV7604_OP_FORMAT_MODE0 = 0x00,
59 ADV7604_OP_FORMAT_SEL_SDR_ITU656_10 = 0x01, 65 ADV7604_OP_FORMAT_MODE1 = 0x04,
60 ADV7604_OP_FORMAT_SEL_SDR_ITU656_12_MODE0 = 0x02, 66 ADV7604_OP_FORMAT_MODE2 = 0x08,
61 ADV7604_OP_FORMAT_SEL_SDR_ITU656_12_MODE1 = 0x06,
62 ADV7604_OP_FORMAT_SEL_SDR_ITU656_12_MODE2 = 0x0a,
63 ADV7604_OP_FORMAT_SEL_DDR_422_8 = 0x20,
64 ADV7604_OP_FORMAT_SEL_DDR_422_10 = 0x21,
65 ADV7604_OP_FORMAT_SEL_DDR_422_12_MODE0 = 0x22,
66 ADV7604_OP_FORMAT_SEL_DDR_422_12_MODE1 = 0x23,
67 ADV7604_OP_FORMAT_SEL_DDR_422_12_MODE2 = 0x24,
68 ADV7604_OP_FORMAT_SEL_SDR_444_24 = 0x40,
69 ADV7604_OP_FORMAT_SEL_SDR_444_30 = 0x41,
70 ADV7604_OP_FORMAT_SEL_SDR_444_36_MODE0 = 0x42,
71 ADV7604_OP_FORMAT_SEL_DDR_444_24 = 0x60,
72 ADV7604_OP_FORMAT_SEL_DDR_444_30 = 0x61,
73 ADV7604_OP_FORMAT_SEL_DDR_444_36 = 0x62,
74 ADV7604_OP_FORMAT_SEL_SDR_ITU656_16 = 0x80,
75 ADV7604_OP_FORMAT_SEL_SDR_ITU656_20 = 0x81,
76 ADV7604_OP_FORMAT_SEL_SDR_ITU656_24_MODE0 = 0x82,
77 ADV7604_OP_FORMAT_SEL_SDR_ITU656_24_MODE1 = 0x86,
78 ADV7604_OP_FORMAT_SEL_SDR_ITU656_24_MODE2 = 0x8a,
79}; 67};
80 68
81enum adv7604_drive_strength { 69enum adv7604_drive_strength {
@@ -84,6 +72,30 @@ enum adv7604_drive_strength {
84 ADV7604_DR_STR_HIGH = 3, 72 ADV7604_DR_STR_HIGH = 3,
85}; 73};
86 74
75enum adv7604_int1_config {
76 ADV7604_INT1_CONFIG_OPEN_DRAIN,
77 ADV7604_INT1_CONFIG_ACTIVE_LOW,
78 ADV7604_INT1_CONFIG_ACTIVE_HIGH,
79 ADV7604_INT1_CONFIG_DISABLED,
80};
81
82enum adv7604_page {
83 ADV7604_PAGE_IO,
84 ADV7604_PAGE_AVLINK,
85 ADV7604_PAGE_CEC,
86 ADV7604_PAGE_INFOFRAME,
87 ADV7604_PAGE_ESDP,
88 ADV7604_PAGE_DPP,
89 ADV7604_PAGE_AFE,
90 ADV7604_PAGE_REP,
91 ADV7604_PAGE_EDID,
92 ADV7604_PAGE_HDMI,
93 ADV7604_PAGE_TEST,
94 ADV7604_PAGE_CP,
95 ADV7604_PAGE_VDP,
96 ADV7604_PAGE_MAX,
97};
98
87/* Platform dependent definition */ 99/* Platform dependent definition */
88struct adv7604_platform_data { 100struct adv7604_platform_data {
89 /* DIS_PWRDNB: 1 if the PWRDNB pin is unused and unconnected */ 101 /* DIS_PWRDNB: 1 if the PWRDNB pin is unused and unconnected */
@@ -92,30 +104,34 @@ struct adv7604_platform_data {
92 /* DIS_CABLE_DET_RST: 1 if the 5V pins are unused and unconnected */ 104 /* DIS_CABLE_DET_RST: 1 if the 5V pins are unused and unconnected */
93 unsigned disable_cable_det_rst:1; 105 unsigned disable_cable_det_rst:1;
94 106
107 int default_input;
108
95 /* Analog input muxing mode */ 109 /* Analog input muxing mode */
96 enum adv7604_ain_sel ain_sel; 110 enum adv7604_ain_sel ain_sel;
97 111
98 /* Bus rotation and reordering */ 112 /* Bus rotation and reordering */
99 enum adv7604_op_ch_sel op_ch_sel; 113 enum adv7604_bus_order bus_order;
100 114
101 /* Select output format */ 115 /* Select output format mode */
102 enum adv7604_op_format_sel op_format_sel; 116 enum adv7604_op_format_mode_sel op_format_mode_sel;
117
118 /* Configuration of the INT1 pin */
119 enum adv7604_int1_config int1_config;
103 120
104 /* IO register 0x02 */ 121 /* IO register 0x02 */
105 unsigned alt_gamma:1; 122 unsigned alt_gamma:1;
106 unsigned op_656_range:1; 123 unsigned op_656_range:1;
107 unsigned rgb_out:1;
108 unsigned alt_data_sat:1; 124 unsigned alt_data_sat:1;
109 125
110 /* IO register 0x05 */ 126 /* IO register 0x05 */
111 unsigned blank_data:1; 127 unsigned blank_data:1;
112 unsigned insert_av_codes:1; 128 unsigned insert_av_codes:1;
113 unsigned replicate_av_codes:1; 129 unsigned replicate_av_codes:1;
114 unsigned invert_cbcr:1;
115 130
116 /* IO register 0x06 */ 131 /* IO register 0x06 */
117 unsigned inv_vs_pol:1; 132 unsigned inv_vs_pol:1;
118 unsigned inv_hs_pol:1; 133 unsigned inv_hs_pol:1;
134 unsigned inv_llc_pol:1;
119 135
120 /* IO register 0x14 */ 136 /* IO register 0x14 */
121 enum adv7604_drive_strength dr_str_data; 137 enum adv7604_drive_strength dr_str_data;
@@ -129,34 +145,22 @@ struct adv7604_platform_data {
129 unsigned hdmi_free_run_mode; 145 unsigned hdmi_free_run_mode;
130 146
131 /* i2c addresses: 0 == use default */ 147 /* i2c addresses: 0 == use default */
132 u8 i2c_avlink; 148 u8 i2c_addresses[ADV7604_PAGE_MAX];
133 u8 i2c_cec;
134 u8 i2c_infoframe;
135 u8 i2c_esdp;
136 u8 i2c_dpp;
137 u8 i2c_afe;
138 u8 i2c_repeater;
139 u8 i2c_edid;
140 u8 i2c_hdmi;
141 u8 i2c_test;
142 u8 i2c_cp;
143 u8 i2c_vdp;
144}; 149};
145 150
146enum adv7604_input_port { 151enum adv7604_pad {
147 ADV7604_INPUT_HDMI_PORT_A, 152 ADV7604_PAD_HDMI_PORT_A = 0,
148 ADV7604_INPUT_HDMI_PORT_B, 153 ADV7604_PAD_HDMI_PORT_B = 1,
149 ADV7604_INPUT_HDMI_PORT_C, 154 ADV7604_PAD_HDMI_PORT_C = 2,
150 ADV7604_INPUT_HDMI_PORT_D, 155 ADV7604_PAD_HDMI_PORT_D = 3,
151 ADV7604_INPUT_VGA_RGB, 156 ADV7604_PAD_VGA_RGB = 4,
152 ADV7604_INPUT_VGA_COMP, 157 ADV7604_PAD_VGA_COMP = 5,
158 /* The source pad is either 1 (ADV7611) or 6 (ADV7604) */
159 ADV7604_PAD_SOURCE = 6,
160 ADV7611_PAD_SOURCE = 1,
161 ADV7604_PAD_MAX = 7,
153}; 162};
154 163
155#define ADV7604_EDID_PORT_A 0
156#define ADV7604_EDID_PORT_B 1
157#define ADV7604_EDID_PORT_C 2
158#define ADV7604_EDID_PORT_D 3
159
160#define V4L2_CID_ADV_RX_ANALOG_SAMPLING_PHASE (V4L2_CID_DV_CLASS_BASE + 0x1000) 164#define V4L2_CID_ADV_RX_ANALOG_SAMPLING_PHASE (V4L2_CID_DV_CLASS_BASE + 0x1000)
161#define V4L2_CID_ADV_RX_FREE_RUN_COLOR_MANUAL (V4L2_CID_DV_CLASS_BASE + 0x1001) 165#define V4L2_CID_ADV_RX_FREE_RUN_COLOR_MANUAL (V4L2_CID_DV_CLASS_BASE + 0x1001)
162#define V4L2_CID_ADV_RX_FREE_RUN_COLOR (V4L2_CID_DV_CLASS_BASE + 0x1002) 166#define V4L2_CID_ADV_RX_FREE_RUN_COLOR (V4L2_CID_DV_CLASS_BASE + 0x1002)
diff --git a/include/media/davinci/vpbe_display.h b/include/media/davinci/vpbe_display.h
index 8dffffedbb59..637749a91432 100644
--- a/include/media/davinci/vpbe_display.h
+++ b/include/media/davinci/vpbe_display.h
@@ -16,6 +16,7 @@
16/* Header files */ 16/* Header files */
17#include <linux/videodev2.h> 17#include <linux/videodev2.h>
18#include <media/v4l2-common.h> 18#include <media/v4l2-common.h>
19#include <media/v4l2-fh.h>
19#include <media/videobuf2-dma-contig.h> 20#include <media/videobuf2-dma-contig.h>
20#include <media/davinci/vpbe_types.h> 21#include <media/davinci/vpbe_types.h>
21#include <media/davinci/vpbe_osd.h> 22#include <media/davinci/vpbe_osd.h>
@@ -94,8 +95,6 @@ struct vpbe_layer {
94 * has selected 95 * has selected
95 */ 96 */
96 enum v4l2_memory memory; 97 enum v4l2_memory memory;
97 /* Used to keep track of state of the priority */
98 struct v4l2_prio_state prio;
99 /* Used to store pixel format */ 98 /* Used to store pixel format */
100 struct v4l2_pix_format pix_fmt; 99 struct v4l2_pix_format pix_fmt;
101 enum v4l2_field buf_field; 100 enum v4l2_field buf_field;
@@ -134,14 +133,13 @@ struct vpbe_display {
134 133
135/* File handle structure */ 134/* File handle structure */
136struct vpbe_fh { 135struct vpbe_fh {
136 struct v4l2_fh fh;
137 /* vpbe device structure */ 137 /* vpbe device structure */
138 struct vpbe_display *disp_dev; 138 struct vpbe_display *disp_dev;
139 /* pointer to layer object for opened device */ 139 /* pointer to layer object for opened device */
140 struct vpbe_layer *layer; 140 struct vpbe_layer *layer;
141 /* Indicates whether this file handle is doing IO */ 141 /* Indicates whether this file handle is doing IO */
142 unsigned char io_allowed; 142 unsigned char io_allowed;
143 /* Used to keep track priority of this instance */
144 enum v4l2_priority prio;
145}; 143};
146 144
147struct buf_config_params { 145struct buf_config_params {
diff --git a/include/media/davinci/vpfe_capture.h b/include/media/davinci/vpfe_capture.h
index cc973ed845a7..288772e6900a 100644
--- a/include/media/davinci/vpfe_capture.h
+++ b/include/media/davinci/vpfe_capture.h
@@ -26,6 +26,7 @@
26#include <linux/videodev2.h> 26#include <linux/videodev2.h>
27#include <linux/clk.h> 27#include <linux/clk.h>
28#include <linux/i2c.h> 28#include <linux/i2c.h>
29#include <media/v4l2-fh.h>
29#include <media/v4l2-ioctl.h> 30#include <media/v4l2-ioctl.h>
30#include <media/v4l2-device.h> 31#include <media/v4l2-device.h>
31#include <media/videobuf-dma-contig.h> 32#include <media/videobuf-dma-contig.h>
@@ -110,8 +111,6 @@ struct vpfe_device {
110 struct v4l2_device v4l2_dev; 111 struct v4l2_device v4l2_dev;
111 /* parent device */ 112 /* parent device */
112 struct device *pdev; 113 struct device *pdev;
113 /* Used to keep track of state of the priority */
114 struct v4l2_prio_state prio;
115 /* number of open instances of the channel */ 114 /* number of open instances of the channel */
116 u32 usrs; 115 u32 usrs;
117 /* Indicates id of the field which is being displayed */ 116 /* Indicates id of the field which is being displayed */
@@ -174,11 +173,10 @@ struct vpfe_device {
174 173
175/* File handle structure */ 174/* File handle structure */
176struct vpfe_fh { 175struct vpfe_fh {
176 struct v4l2_fh fh;
177 struct vpfe_device *vpfe_dev; 177 struct vpfe_device *vpfe_dev;
178 /* Indicates whether this file handle is doing IO */ 178 /* Indicates whether this file handle is doing IO */
179 u8 io_allowed; 179 u8 io_allowed;
180 /* Used to keep track priority of this instance */
181 enum v4l2_priority prio;
182}; 180};
183 181
184struct vpfe_config_params { 182struct vpfe_config_params {
diff --git a/include/media/s5p_fimc.h b/include/media/exynos-fimc.h
index b975c285c8a9..aa44660e2041 100644
--- a/include/media/s5p_fimc.h
+++ b/include/media/exynos-fimc.h
@@ -61,41 +61,20 @@ enum fimc_bus_type {
61#define GRP_ID_FLITE (1 << 13) 61#define GRP_ID_FLITE (1 << 13)
62#define GRP_ID_FIMC_IS (1 << 14) 62#define GRP_ID_FIMC_IS (1 << 14)
63 63
64struct i2c_board_info;
65
66/** 64/**
67 * struct fimc_source_info - video source description required for the host 65 * struct fimc_source_info - video source description required for the host
68 * interface configuration 66 * interface configuration
69 * 67 *
70 * @board_info: pointer to I2C subdevice's board info
71 * @clk_frequency: frequency of the clock the host interface provides to sensor
72 * @fimc_bus_type: FIMC camera input type 68 * @fimc_bus_type: FIMC camera input type
73 * @sensor_bus_type: image sensor bus type, MIPI, ITU-R BT.601 etc. 69 * @sensor_bus_type: image sensor bus type, MIPI, ITU-R BT.601 etc.
74 * @flags: the parallel sensor bus flags defining signals polarity (V4L2_MBUS_*) 70 * @flags: the parallel sensor bus flags defining signals polarity (V4L2_MBUS_*)
75 * @i2c_bus_num: i2c control bus id the sensor is attached to
76 * @mux_id: FIMC camera interface multiplexer index (separate for MIPI and ITU) 71 * @mux_id: FIMC camera interface multiplexer index (separate for MIPI and ITU)
77 * @clk_id: index of the SoC peripheral clock for sensors
78 */ 72 */
79struct fimc_source_info { 73struct fimc_source_info {
80 struct i2c_board_info *board_info;
81 unsigned long clk_frequency;
82 enum fimc_bus_type fimc_bus_type; 74 enum fimc_bus_type fimc_bus_type;
83 enum fimc_bus_type sensor_bus_type; 75 enum fimc_bus_type sensor_bus_type;
84 u16 flags; 76 u16 flags;
85 u16 i2c_bus_num;
86 u16 mux_id; 77 u16 mux_id;
87 u8 clk_id;
88};
89
90/**
91 * struct s5p_platform_fimc - camera host interface platform data
92 *
93 * @source_info: properties of an image source for the host interface setup
94 * @num_clients: the number of attached image sources
95 */
96struct s5p_platform_fimc {
97 struct fimc_source_info *source_info;
98 int num_clients;
99}; 78};
100 79
101/* 80/*
diff --git a/include/media/media-device.h b/include/media/media-device.h
index 12155a9596c4..6e6db78f1ee2 100644
--- a/include/media/media-device.h
+++ b/include/media/media-device.h
@@ -87,7 +87,9 @@ struct media_device {
87/* media_devnode to media_device */ 87/* media_devnode to media_device */
88#define to_media_device(node) container_of(node, struct media_device, devnode) 88#define to_media_device(node) container_of(node, struct media_device, devnode)
89 89
90int __must_check media_device_register(struct media_device *mdev); 90int __must_check __media_device_register(struct media_device *mdev,
91 struct module *owner);
92#define media_device_register(mdev) __media_device_register(mdev, THIS_MODULE)
91void media_device_unregister(struct media_device *mdev); 93void media_device_unregister(struct media_device *mdev);
92 94
93int __must_check media_device_register_entity(struct media_device *mdev, 95int __must_check media_device_register_entity(struct media_device *mdev,
diff --git a/include/media/media-devnode.h b/include/media/media-devnode.h
index 3446af279fca..0dc7060f9625 100644
--- a/include/media/media-devnode.h
+++ b/include/media/media-devnode.h
@@ -82,7 +82,8 @@ struct media_devnode {
82/* dev to media_devnode */ 82/* dev to media_devnode */
83#define to_media_devnode(cd) container_of(cd, struct media_devnode, dev) 83#define to_media_devnode(cd) container_of(cd, struct media_devnode, dev)
84 84
85int __must_check media_devnode_register(struct media_devnode *mdev); 85int __must_check media_devnode_register(struct media_devnode *mdev,
86 struct module *owner);
86void media_devnode_unregister(struct media_devnode *mdev); 87void media_devnode_unregister(struct media_devnode *mdev);
87 88
88static inline struct media_devnode *media_devnode_data(struct file *filp) 89static inline struct media_devnode *media_devnode_data(struct file *filp)
diff --git a/include/media/v4l2-device.h b/include/media/v4l2-device.h
index c9b1593923f6..ffb69da3ce9e 100644
--- a/include/media/v4l2-device.h
+++ b/include/media/v4l2-device.h
@@ -120,6 +120,14 @@ void v4l2_device_unregister_subdev(struct v4l2_subdev *sd);
120int __must_check 120int __must_check
121v4l2_device_register_subdev_nodes(struct v4l2_device *v4l2_dev); 121v4l2_device_register_subdev_nodes(struct v4l2_device *v4l2_dev);
122 122
123/* Send a notification to v4l2_device. */
124static inline void v4l2_subdev_notify(struct v4l2_subdev *sd,
125 unsigned int notification, void *arg)
126{
127 if (sd && sd->v4l2_dev && sd->v4l2_dev->notify)
128 sd->v4l2_dev->notify(sd, notification, arg);
129}
130
123/* Iterate over all subdevs. */ 131/* Iterate over all subdevs. */
124#define v4l2_device_for_each_subdev(sd, v4l2_dev) \ 132#define v4l2_device_for_each_subdev(sd, v4l2_dev) \
125 list_for_each_entry(sd, &(v4l2_dev)->subdevs, list) 133 list_for_each_entry(sd, &(v4l2_dev)->subdevs, list)
diff --git a/include/media/v4l2-event.h b/include/media/v4l2-event.h
index be05d019de25..1ab9045e52e3 100644
--- a/include/media/v4l2-event.h
+++ b/include/media/v4l2-event.h
@@ -132,4 +132,8 @@ int v4l2_event_unsubscribe(struct v4l2_fh *fh,
132void v4l2_event_unsubscribe_all(struct v4l2_fh *fh); 132void v4l2_event_unsubscribe_all(struct v4l2_fh *fh);
133int v4l2_event_subdev_unsubscribe(struct v4l2_subdev *sd, struct v4l2_fh *fh, 133int v4l2_event_subdev_unsubscribe(struct v4l2_subdev *sd, struct v4l2_fh *fh,
134 struct v4l2_event_subscription *sub); 134 struct v4l2_event_subscription *sub);
135int v4l2_src_change_event_subscribe(struct v4l2_fh *fh,
136 const struct v4l2_event_subscription *sub);
137int v4l2_src_change_event_subdev_subscribe(struct v4l2_subdev *sd,
138 struct v4l2_fh *fh, struct v4l2_event_subscription *sub);
135#endif /* V4L2_EVENT_H */ 139#endif /* V4L2_EVENT_H */
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index 28f4d8c3cf7d..d7465725773d 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -159,8 +159,6 @@ struct v4l2_subdev_core_ops {
159 int (*s_ext_ctrls)(struct v4l2_subdev *sd, struct v4l2_ext_controls *ctrls); 159 int (*s_ext_ctrls)(struct v4l2_subdev *sd, struct v4l2_ext_controls *ctrls);
160 int (*try_ext_ctrls)(struct v4l2_subdev *sd, struct v4l2_ext_controls *ctrls); 160 int (*try_ext_ctrls)(struct v4l2_subdev *sd, struct v4l2_ext_controls *ctrls);
161 int (*querymenu)(struct v4l2_subdev *sd, struct v4l2_querymenu *qm); 161 int (*querymenu)(struct v4l2_subdev *sd, struct v4l2_querymenu *qm);
162 int (*g_std)(struct v4l2_subdev *sd, v4l2_std_id *norm);
163 int (*s_std)(struct v4l2_subdev *sd, v4l2_std_id norm);
164 long (*ioctl)(struct v4l2_subdev *sd, unsigned int cmd, void *arg); 162 long (*ioctl)(struct v4l2_subdev *sd, unsigned int cmd, void *arg);
165#ifdef CONFIG_COMPAT 163#ifdef CONFIG_COMPAT
166 long (*compat_ioctl32)(struct v4l2_subdev *sd, unsigned int cmd, 164 long (*compat_ioctl32)(struct v4l2_subdev *sd, unsigned int cmd,
@@ -234,15 +232,18 @@ struct v4l2_subdev_audio_ops {
234 232
235/* Indicates the @length field specifies maximum data length. */ 233/* Indicates the @length field specifies maximum data length. */
236#define V4L2_MBUS_FRAME_DESC_FL_LEN_MAX (1U << 0) 234#define V4L2_MBUS_FRAME_DESC_FL_LEN_MAX (1U << 0)
237/* Indicates user defined data format, i.e. non standard frame format. */ 235/*
236 * Indicates that the format does not have line offsets, i.e. the
237 * receiver should use 1D DMA.
238 */
238#define V4L2_MBUS_FRAME_DESC_FL_BLOB (1U << 1) 239#define V4L2_MBUS_FRAME_DESC_FL_BLOB (1U << 1)
239 240
240/** 241/**
241 * struct v4l2_mbus_frame_desc_entry - media bus frame description structure 242 * struct v4l2_mbus_frame_desc_entry - media bus frame description structure
242 * @flags: V4L2_MBUS_FRAME_DESC_FL_* flags 243 * @flags: V4L2_MBUS_FRAME_DESC_FL_* flags
243 * @pixelcode: media bus pixel code, valid if FRAME_DESC_FL_BLOB is not set 244 * @pixelcode: media bus pixel code, valid if FRAME_DESC_FL_BLOB is not set
244 * @length: number of octets per frame, valid for compressed or unspecified 245 * @length: number of octets per frame, valid if V4L2_MBUS_FRAME_DESC_FL_BLOB
245 * formats 246 * is set
246 */ 247 */
247struct v4l2_mbus_frame_desc_entry { 248struct v4l2_mbus_frame_desc_entry {
248 u16 flags; 249 u16 flags;
@@ -269,8 +270,11 @@ struct v4l2_mbus_frame_desc {
269 g_std_output: get current standard for video OUTPUT devices. This is ignored 270 g_std_output: get current standard for video OUTPUT devices. This is ignored
270 by video input devices. 271 by video input devices.
271 272
272 g_tvnorms_output: get v4l2_std_id with all standards supported by video 273 g_tvnorms: get v4l2_std_id with all standards supported by the video
273 OUTPUT device. This is ignored by video input devices. 274 CAPTURE device. This is ignored by video output devices.
275
276 g_tvnorms_output: get v4l2_std_id with all standards supported by the video
277 OUTPUT device. This is ignored by video capture devices.
274 278
275 s_crystal_freq: sets the frequency of the crystal used to generate the 279 s_crystal_freq: sets the frequency of the crystal used to generate the
276 clocks in Hz. An extra flags field allows device specific configuration 280 clocks in Hz. An extra flags field allows device specific configuration
@@ -310,9 +314,12 @@ struct v4l2_mbus_frame_desc {
310struct v4l2_subdev_video_ops { 314struct v4l2_subdev_video_ops {
311 int (*s_routing)(struct v4l2_subdev *sd, u32 input, u32 output, u32 config); 315 int (*s_routing)(struct v4l2_subdev *sd, u32 input, u32 output, u32 config);
312 int (*s_crystal_freq)(struct v4l2_subdev *sd, u32 freq, u32 flags); 316 int (*s_crystal_freq)(struct v4l2_subdev *sd, u32 freq, u32 flags);
317 int (*g_std)(struct v4l2_subdev *sd, v4l2_std_id *norm);
318 int (*s_std)(struct v4l2_subdev *sd, v4l2_std_id norm);
313 int (*s_std_output)(struct v4l2_subdev *sd, v4l2_std_id std); 319 int (*s_std_output)(struct v4l2_subdev *sd, v4l2_std_id std);
314 int (*g_std_output)(struct v4l2_subdev *sd, v4l2_std_id *std); 320 int (*g_std_output)(struct v4l2_subdev *sd, v4l2_std_id *std);
315 int (*querystd)(struct v4l2_subdev *sd, v4l2_std_id *std); 321 int (*querystd)(struct v4l2_subdev *sd, v4l2_std_id *std);
322 int (*g_tvnorms)(struct v4l2_subdev *sd, v4l2_std_id *std);
316 int (*g_tvnorms_output)(struct v4l2_subdev *sd, v4l2_std_id *std); 323 int (*g_tvnorms_output)(struct v4l2_subdev *sd, v4l2_std_id *std);
317 int (*g_input_status)(struct v4l2_subdev *sd, u32 *status); 324 int (*g_input_status)(struct v4l2_subdev *sd, u32 *status);
318 int (*s_stream)(struct v4l2_subdev *sd, int enable); 325 int (*s_stream)(struct v4l2_subdev *sd, int enable);
@@ -331,12 +338,8 @@ struct v4l2_subdev_video_ops {
331 struct v4l2_dv_timings *timings); 338 struct v4l2_dv_timings *timings);
332 int (*g_dv_timings)(struct v4l2_subdev *sd, 339 int (*g_dv_timings)(struct v4l2_subdev *sd,
333 struct v4l2_dv_timings *timings); 340 struct v4l2_dv_timings *timings);
334 int (*enum_dv_timings)(struct v4l2_subdev *sd,
335 struct v4l2_enum_dv_timings *timings);
336 int (*query_dv_timings)(struct v4l2_subdev *sd, 341 int (*query_dv_timings)(struct v4l2_subdev *sd,
337 struct v4l2_dv_timings *timings); 342 struct v4l2_dv_timings *timings);
338 int (*dv_timings_cap)(struct v4l2_subdev *sd,
339 struct v4l2_dv_timings_cap *cap);
340 int (*enum_mbus_fmt)(struct v4l2_subdev *sd, unsigned int index, 343 int (*enum_mbus_fmt)(struct v4l2_subdev *sd, unsigned int index,
341 enum v4l2_mbus_pixelcode *code); 344 enum v4l2_mbus_pixelcode *code);
342 int (*enum_mbus_fsizes)(struct v4l2_subdev *sd, 345 int (*enum_mbus_fsizes)(struct v4l2_subdev *sd,
@@ -510,6 +513,10 @@ struct v4l2_subdev_pad_ops {
510 struct v4l2_subdev_selection *sel); 513 struct v4l2_subdev_selection *sel);
511 int (*get_edid)(struct v4l2_subdev *sd, struct v4l2_edid *edid); 514 int (*get_edid)(struct v4l2_subdev *sd, struct v4l2_edid *edid);
512 int (*set_edid)(struct v4l2_subdev *sd, struct v4l2_edid *edid); 515 int (*set_edid)(struct v4l2_subdev *sd, struct v4l2_edid *edid);
516 int (*dv_timings_cap)(struct v4l2_subdev *sd,
517 struct v4l2_dv_timings_cap *cap);
518 int (*enum_dv_timings)(struct v4l2_subdev *sd,
519 struct v4l2_enum_dv_timings *timings);
513#ifdef CONFIG_MEDIA_CONTROLLER 520#ifdef CONFIG_MEDIA_CONTROLLER
514 int (*link_validate)(struct v4l2_subdev *sd, struct media_link *link, 521 int (*link_validate)(struct v4l2_subdev *sd, struct media_link *link,
515 struct v4l2_subdev_format *source_fmt, 522 struct v4l2_subdev_format *source_fmt,
@@ -584,6 +591,7 @@ struct v4l2_subdev {
584#endif 591#endif
585 struct list_head list; 592 struct list_head list;
586 struct module *owner; 593 struct module *owner;
594 bool owner_v4l2_dev;
587 u32 flags; 595 u32 flags;
588 struct v4l2_device *v4l2_dev; 596 struct v4l2_device *v4l2_dev;
589 const struct v4l2_subdev_ops *ops; 597 const struct v4l2_subdev_ops *ops;
@@ -685,17 +693,12 @@ void v4l2_subdev_init(struct v4l2_subdev *sd,
685/* Call an ops of a v4l2_subdev, doing the right checks against 693/* Call an ops of a v4l2_subdev, doing the right checks against
686 NULL pointers. 694 NULL pointers.
687 695
688 Example: err = v4l2_subdev_call(sd, core, s_std, norm); 696 Example: err = v4l2_subdev_call(sd, video, s_std, norm);
689 */ 697 */
690#define v4l2_subdev_call(sd, o, f, args...) \ 698#define v4l2_subdev_call(sd, o, f, args...) \
691 (!(sd) ? -ENODEV : (((sd)->ops->o && (sd)->ops->o->f) ? \ 699 (!(sd) ? -ENODEV : (((sd)->ops->o && (sd)->ops->o->f) ? \
692 (sd)->ops->o->f((sd) , ##args) : -ENOIOCTLCMD)) 700 (sd)->ops->o->f((sd) , ##args) : -ENOIOCTLCMD))
693 701
694/* Send a notification to v4l2_device. */
695#define v4l2_subdev_notify(sd, notification, arg) \
696 ((!(sd) || !(sd)->v4l2_dev || !(sd)->v4l2_dev->notify) ? -ENODEV : \
697 (sd)->v4l2_dev->notify((sd), (notification), (arg)))
698
699#define v4l2_subdev_has_op(sd, o, f) \ 702#define v4l2_subdev_has_op(sd, o, f) \
700 ((sd)->ops->o && (sd)->ops->o->f) 703 ((sd)->ops->o && (sd)->ops->o->f)
701 704
diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h
index af4621109726..8fab6fa0dbfb 100644
--- a/include/media/videobuf2-core.h
+++ b/include/media/videobuf2-core.h
@@ -20,6 +20,7 @@
20 20
21struct vb2_alloc_ctx; 21struct vb2_alloc_ctx;
22struct vb2_fileio_data; 22struct vb2_fileio_data;
23struct vb2_threadio_data;
23 24
24/** 25/**
25 * struct vb2_mem_ops - memory handling/memory allocator operations 26 * struct vb2_mem_ops - memory handling/memory allocator operations
@@ -323,7 +324,7 @@ struct vb2_ops {
323 void (*buf_cleanup)(struct vb2_buffer *vb); 324 void (*buf_cleanup)(struct vb2_buffer *vb);
324 325
325 int (*start_streaming)(struct vb2_queue *q, unsigned int count); 326 int (*start_streaming)(struct vb2_queue *q, unsigned int count);
326 int (*stop_streaming)(struct vb2_queue *q); 327 void (*stop_streaming)(struct vb2_queue *q);
327 328
328 void (*buf_queue)(struct vb2_buffer *vb); 329 void (*buf_queue)(struct vb2_buffer *vb);
329}; 330};
@@ -375,6 +376,7 @@ struct v4l2_fh;
375 * @start_streaming_called: start_streaming() was called successfully and we 376 * @start_streaming_called: start_streaming() was called successfully and we
376 * started streaming. 377 * started streaming.
377 * @fileio: file io emulator internal data, used only if emulator is active 378 * @fileio: file io emulator internal data, used only if emulator is active
379 * @threadio: thread io internal data, used only if thread is active
378 */ 380 */
379struct vb2_queue { 381struct vb2_queue {
380 enum v4l2_buf_type type; 382 enum v4l2_buf_type type;
@@ -411,6 +413,7 @@ struct vb2_queue {
411 unsigned int start_streaming_called:1; 413 unsigned int start_streaming_called:1;
412 414
413 struct vb2_fileio_data *fileio; 415 struct vb2_fileio_data *fileio;
416 struct vb2_threadio_data *threadio;
414 417
415#ifdef CONFIG_VIDEO_ADV_DEBUG 418#ifdef CONFIG_VIDEO_ADV_DEBUG
416 /* 419 /*
@@ -429,6 +432,7 @@ void *vb2_plane_vaddr(struct vb2_buffer *vb, unsigned int plane_no);
429void *vb2_plane_cookie(struct vb2_buffer *vb, unsigned int plane_no); 432void *vb2_plane_cookie(struct vb2_buffer *vb, unsigned int plane_no);
430 433
431void vb2_buffer_done(struct vb2_buffer *vb, enum vb2_buffer_state state); 434void vb2_buffer_done(struct vb2_buffer *vb, enum vb2_buffer_state state);
435void vb2_discard_done(struct vb2_queue *q);
432int vb2_wait_for_all_buffers(struct vb2_queue *q); 436int vb2_wait_for_all_buffers(struct vb2_queue *q);
433 437
434int vb2_querybuf(struct vb2_queue *q, struct v4l2_buffer *b); 438int vb2_querybuf(struct vb2_queue *q, struct v4l2_buffer *b);
@@ -461,6 +465,35 @@ size_t vb2_read(struct vb2_queue *q, char __user *data, size_t count,
461 loff_t *ppos, int nonblock); 465 loff_t *ppos, int nonblock);
462size_t vb2_write(struct vb2_queue *q, const char __user *data, size_t count, 466size_t vb2_write(struct vb2_queue *q, const char __user *data, size_t count,
463 loff_t *ppos, int nonblock); 467 loff_t *ppos, int nonblock);
468/**
469 * vb2_thread_fnc - callback function for use with vb2_thread
470 *
471 * This is called whenever a buffer is dequeued in the thread.
472 */
473typedef int (*vb2_thread_fnc)(struct vb2_buffer *vb, void *priv);
474
475/**
476 * vb2_thread_start() - start a thread for the given queue.
477 * @q: videobuf queue
478 * @fnc: callback function
479 * @priv: priv pointer passed to the callback function
480 * @thread_name:the name of the thread. This will be prefixed with "vb2-".
481 *
482 * This starts a thread that will queue and dequeue until an error occurs
483 * or @vb2_thread_stop is called.
484 *
485 * This function should not be used for anything else but the videobuf2-dvb
486 * support. If you think you have another good use-case for this, then please
487 * contact the linux-media mailinglist first.
488 */
489int vb2_thread_start(struct vb2_queue *q, vb2_thread_fnc fnc, void *priv,
490 const char *thread_name);
491
492/**
493 * vb2_thread_stop() - stop the thread for the given queue.
494 * @q: videobuf queue
495 */
496int vb2_thread_stop(struct vb2_queue *q);
464 497
465/** 498/**
466 * vb2_is_streaming() - return streaming status of the queue 499 * vb2_is_streaming() - return streaming status of the queue
@@ -472,6 +505,23 @@ static inline bool vb2_is_streaming(struct vb2_queue *q)
472} 505}
473 506
474/** 507/**
508 * vb2_fileio_is_active() - return true if fileio is active.
509 * @q: videobuf queue
510 *
511 * This returns true if read() or write() is used to stream the data
512 * as opposed to stream I/O. This is almost never an important distinction,
513 * except in rare cases. One such case is that using read() or write() to
514 * stream a format using V4L2_FIELD_ALTERNATE is not allowed since there
515 * is no way you can pass the field information of each buffer to/from
516 * userspace. A driver that supports this field format should check for
517 * this in the queue_setup op and reject it if this function returns true.
518 */
519static inline bool vb2_fileio_is_active(struct vb2_queue *q)
520{
521 return q->fileio;
522}
523
524/**
475 * vb2_is_busy() - return busy status of the queue 525 * vb2_is_busy() - return busy status of the queue
476 * @q: videobuf queue 526 * @q: videobuf queue
477 * 527 *
diff --git a/include/media/videobuf2-dvb.h b/include/media/videobuf2-dvb.h
new file mode 100644
index 000000000000..8f61456f1394
--- /dev/null
+++ b/include/media/videobuf2-dvb.h
@@ -0,0 +1,58 @@
1#ifndef _VIDEOBUF2_DVB_H_
2#define _VIDEOBUF2_DVB_H_
3
4#include <dvbdev.h>
5#include <dmxdev.h>
6#include <dvb_demux.h>
7#include <dvb_net.h>
8#include <dvb_frontend.h>
9#include <media/videobuf2-core.h>
10
11struct vb2_dvb {
12 /* filling that the job of the driver */
13 char *name;
14 struct dvb_frontend *frontend;
15 struct vb2_queue dvbq;
16
17 /* video-buf-dvb state info */
18 struct mutex lock;
19 int nfeeds;
20
21 /* vb2_dvb_(un)register manages this */
22 struct dvb_demux demux;
23 struct dmxdev dmxdev;
24 struct dmx_frontend fe_hw;
25 struct dmx_frontend fe_mem;
26 struct dvb_net net;
27};
28
29struct vb2_dvb_frontend {
30 struct list_head felist;
31 int id;
32 struct vb2_dvb dvb;
33};
34
35struct vb2_dvb_frontends {
36 struct list_head felist;
37 struct mutex lock;
38 struct dvb_adapter adapter;
39 int active_fe_id; /* Indicates which frontend in the felist is in use */
40 int gate; /* Frontend with gate control 0=!MFE,1=fe0,2=fe1 etc */
41};
42
43int vb2_dvb_register_bus(struct vb2_dvb_frontends *f,
44 struct module *module,
45 void *adapter_priv,
46 struct device *device,
47 short *adapter_nr,
48 int mfe_shared);
49
50void vb2_dvb_unregister_bus(struct vb2_dvb_frontends *f);
51
52struct vb2_dvb_frontend *vb2_dvb_alloc_frontend(struct vb2_dvb_frontends *f, int id);
53void vb2_dvb_dealloc_frontends(struct vb2_dvb_frontends *f);
54
55struct vb2_dvb_frontend *vb2_dvb_get_frontend(struct vb2_dvb_frontends *f, int id);
56int vb2_dvb_find_frontend(struct vb2_dvb_frontends *f, struct dvb_frontend *p);
57
58#endif /* _VIDEOBUF2_DVB_H_ */
diff --git a/include/net/6lowpan.h b/include/net/6lowpan.h
index f7d372b7d4ff..79b530fb2c4d 100644
--- a/include/net/6lowpan.h
+++ b/include/net/6lowpan.h
@@ -54,6 +54,7 @@
54#define __6LOWPAN_H__ 54#define __6LOWPAN_H__
55 55
56#include <net/ipv6.h> 56#include <net/ipv6.h>
57#include <net/net_namespace.h>
57 58
58#define UIP_802154_SHORTADDR_LEN 2 /* compressed ipv6 address length */ 59#define UIP_802154_SHORTADDR_LEN 2 /* compressed ipv6 address length */
59#define UIP_IPH_LEN 40 /* ipv6 fixed header size */ 60#define UIP_IPH_LEN 40 /* ipv6 fixed header size */
diff --git a/include/net/addrconf.h b/include/net/addrconf.h
index 933a9f22a05f..f679877bb601 100644
--- a/include/net/addrconf.h
+++ b/include/net/addrconf.h
@@ -306,11 +306,6 @@ static inline void addrconf_addr_solict_mult(const struct in6_addr *addr,
306 htonl(0xFF000000) | addr->s6_addr32[3]); 306 htonl(0xFF000000) | addr->s6_addr32[3]);
307} 307}
308 308
309static inline bool ipv6_addr_is_multicast(const struct in6_addr *addr)
310{
311 return (addr->s6_addr32[0] & htonl(0xFF000000)) == htonl(0xFF000000);
312}
313
314static inline bool ipv6_addr_is_ll_all_nodes(const struct in6_addr *addr) 309static inline bool ipv6_addr_is_ll_all_nodes(const struct in6_addr *addr)
315{ 310{
316#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && BITS_PER_LONG == 64 311#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && BITS_PER_LONG == 64
diff --git a/include/net/af_ieee802154.h b/include/net/af_ieee802154.h
index f79ae2aa76d6..085940f7eeec 100644
--- a/include/net/af_ieee802154.h
+++ b/include/net/af_ieee802154.h
@@ -57,6 +57,14 @@ struct sockaddr_ieee802154 {
57/* get/setsockopt */ 57/* get/setsockopt */
58#define SOL_IEEE802154 0 58#define SOL_IEEE802154 0
59 59
60#define WPAN_WANTACK 0 60#define WPAN_WANTACK 0
61#define WPAN_SECURITY 1
62#define WPAN_SECURITY_LEVEL 2
63
64#define WPAN_SECURITY_DEFAULT 0
65#define WPAN_SECURITY_OFF 1
66#define WPAN_SECURITY_ON 2
67
68#define WPAN_SECURITY_LEVEL_DEFAULT (-1)
61 69
62#endif 70#endif
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index be150cf8cd43..16587dcd6a91 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -367,6 +367,7 @@ enum {
367#define HCI_ERROR_REMOTE_POWER_OFF 0x15 367#define HCI_ERROR_REMOTE_POWER_OFF 0x15
368#define HCI_ERROR_LOCAL_HOST_TERM 0x16 368#define HCI_ERROR_LOCAL_HOST_TERM 0x16
369#define HCI_ERROR_PAIRING_NOT_ALLOWED 0x18 369#define HCI_ERROR_PAIRING_NOT_ALLOWED 0x18
370#define HCI_ERROR_ADVERTISING_TIMEOUT 0x3c
370 371
371/* Flow control modes */ 372/* Flow control modes */
372#define HCI_FLOW_CTL_MODE_PACKET_BASED 0x00 373#define HCI_FLOW_CTL_MODE_PACKET_BASED 0x00
@@ -1053,6 +1054,17 @@ struct hci_cp_write_page_scan_activity {
1053 __le16 window; 1054 __le16 window;
1054} __packed; 1055} __packed;
1055 1056
1057#define HCI_OP_READ_TX_POWER 0x0c2d
1058struct hci_cp_read_tx_power {
1059 __le16 handle;
1060 __u8 type;
1061} __packed;
1062struct hci_rp_read_tx_power {
1063 __u8 status;
1064 __le16 handle;
1065 __s8 tx_power;
1066} __packed;
1067
1056#define HCI_OP_READ_PAGE_SCAN_TYPE 0x0c46 1068#define HCI_OP_READ_PAGE_SCAN_TYPE 0x0c46
1057struct hci_rp_read_page_scan_type { 1069struct hci_rp_read_page_scan_type {
1058 __u8 status; 1070 __u8 status;
@@ -1063,6 +1075,16 @@ struct hci_rp_read_page_scan_type {
1063 #define PAGE_SCAN_TYPE_STANDARD 0x00 1075 #define PAGE_SCAN_TYPE_STANDARD 0x00
1064 #define PAGE_SCAN_TYPE_INTERLACED 0x01 1076 #define PAGE_SCAN_TYPE_INTERLACED 0x01
1065 1077
1078#define HCI_OP_READ_RSSI 0x1405
1079struct hci_cp_read_rssi {
1080 __le16 handle;
1081} __packed;
1082struct hci_rp_read_rssi {
1083 __u8 status;
1084 __le16 handle;
1085 __s8 rssi;
1086} __packed;
1087
1066#define HCI_OP_READ_LOCAL_AMP_INFO 0x1409 1088#define HCI_OP_READ_LOCAL_AMP_INFO 0x1409
1067struct hci_rp_read_local_amp_info { 1089struct hci_rp_read_local_amp_info {
1068 __u8 status; 1090 __u8 status;
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 5f8bc05694ac..b386bf17e6c2 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -68,6 +68,11 @@ struct discovery_state {
68 struct list_head unknown; /* Name state not known */ 68 struct list_head unknown; /* Name state not known */
69 struct list_head resolve; /* Name needs to be resolved */ 69 struct list_head resolve; /* Name needs to be resolved */
70 __u32 timestamp; 70 __u32 timestamp;
71 bdaddr_t last_adv_addr;
72 u8 last_adv_addr_type;
73 s8 last_adv_rssi;
74 u8 last_adv_data[HCI_MAX_AD_LENGTH];
75 u8 last_adv_data_len;
71}; 76};
72 77
73struct hci_conn_hash { 78struct hci_conn_hash {
@@ -140,6 +145,10 @@ struct oob_data {
140/* Default LE RPA expiry time, 15 minutes */ 145/* Default LE RPA expiry time, 15 minutes */
141#define HCI_DEFAULT_RPA_TIMEOUT (15 * 60) 146#define HCI_DEFAULT_RPA_TIMEOUT (15 * 60)
142 147
148/* Default min/max age of connection information (1s/3s) */
149#define DEFAULT_CONN_INFO_MIN_AGE 1000
150#define DEFAULT_CONN_INFO_MAX_AGE 3000
151
143struct amp_assoc { 152struct amp_assoc {
144 __u16 len; 153 __u16 len;
145 __u16 offset; 154 __u16 offset;
@@ -194,6 +203,9 @@ struct hci_dev {
194 __u16 le_scan_window; 203 __u16 le_scan_window;
195 __u16 le_conn_min_interval; 204 __u16 le_conn_min_interval;
196 __u16 le_conn_max_interval; 205 __u16 le_conn_max_interval;
206 __u16 discov_interleaved_timeout;
207 __u16 conn_info_min_age;
208 __u16 conn_info_max_age;
197 __u8 ssp_debug_mode; 209 __u8 ssp_debug_mode;
198 210
199 __u16 devid_source; 211 __u16 devid_source;
@@ -368,8 +380,13 @@ struct hci_conn {
368 __u16 setting; 380 __u16 setting;
369 __u16 le_conn_min_interval; 381 __u16 le_conn_min_interval;
370 __u16 le_conn_max_interval; 382 __u16 le_conn_max_interval;
383 __s8 rssi;
384 __s8 tx_power;
385 __s8 max_tx_power;
371 unsigned long flags; 386 unsigned long flags;
372 387
388 unsigned long conn_info_timestamp;
389
373 __u8 remote_cap; 390 __u8 remote_cap;
374 __u8 remote_auth; 391 __u8 remote_auth;
375 __u8 remote_id; 392 __u8 remote_id;
@@ -1204,8 +1221,8 @@ void hci_sock_dev_event(struct hci_dev *hdev, int event);
1204 */ 1221 */
1205#define DISCOV_LE_SCAN_WIN 0x12 1222#define DISCOV_LE_SCAN_WIN 0x12
1206#define DISCOV_LE_SCAN_INT 0x12 1223#define DISCOV_LE_SCAN_INT 0x12
1207#define DISCOV_LE_TIMEOUT msecs_to_jiffies(10240) 1224#define DISCOV_LE_TIMEOUT 10240 /* msec */
1208#define DISCOV_INTERLEAVED_TIMEOUT msecs_to_jiffies(5120) 1225#define DISCOV_INTERLEAVED_TIMEOUT 5120 /* msec */
1209#define DISCOV_INTERLEAVED_INQUIRY_LEN 0x04 1226#define DISCOV_INTERLEAVED_INQUIRY_LEN 0x04
1210#define DISCOV_BREDR_INQUIRY_LEN 0x08 1227#define DISCOV_BREDR_INQUIRY_LEN 0x08
1211 1228
@@ -1265,7 +1282,8 @@ void mgmt_read_local_oob_data_complete(struct hci_dev *hdev, u8 *hash192,
1265 u8 *randomizer256, u8 status); 1282 u8 *randomizer256, u8 status);
1266void mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, 1283void mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
1267 u8 addr_type, u8 *dev_class, s8 rssi, u8 cfm_name, 1284 u8 addr_type, u8 *dev_class, s8 rssi, u8 cfm_name,
1268 u8 ssp, u8 *eir, u16 eir_len); 1285 u8 ssp, u8 *eir, u16 eir_len, u8 *scan_rsp,
1286 u8 scan_rsp_len);
1269void mgmt_remote_name(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, 1287void mgmt_remote_name(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
1270 u8 addr_type, s8 rssi, u8 *name, u8 name_len); 1288 u8 addr_type, s8 rssi, u8 *name, u8 name_len);
1271void mgmt_discovering(struct hci_dev *hdev, u8 discovering); 1289void mgmt_discovering(struct hci_dev *hdev, u8 discovering);
diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h
index d4b571c2f9fd..bcffc9ae0c89 100644
--- a/include/net/bluetooth/mgmt.h
+++ b/include/net/bluetooth/mgmt.h
@@ -181,6 +181,9 @@ struct mgmt_cp_load_link_keys {
181} __packed; 181} __packed;
182#define MGMT_LOAD_LINK_KEYS_SIZE 3 182#define MGMT_LOAD_LINK_KEYS_SIZE 3
183 183
184#define MGMT_LTK_UNAUTHENTICATED 0x00
185#define MGMT_LTK_AUTHENTICATED 0x01
186
184struct mgmt_ltk_info { 187struct mgmt_ltk_info {
185 struct mgmt_addr_info addr; 188 struct mgmt_addr_info addr;
186 __u8 type; 189 __u8 type;
@@ -409,6 +412,18 @@ struct mgmt_cp_load_irks {
409} __packed; 412} __packed;
410#define MGMT_LOAD_IRKS_SIZE 2 413#define MGMT_LOAD_IRKS_SIZE 2
411 414
415#define MGMT_OP_GET_CONN_INFO 0x0031
416struct mgmt_cp_get_conn_info {
417 struct mgmt_addr_info addr;
418} __packed;
419#define MGMT_GET_CONN_INFO_SIZE MGMT_ADDR_INFO_SIZE
420struct mgmt_rp_get_conn_info {
421 struct mgmt_addr_info addr;
422 __s8 rssi;
423 __s8 tx_power;
424 __s8 max_tx_power;
425} __packed;
426
412#define MGMT_EV_CMD_COMPLETE 0x0001 427#define MGMT_EV_CMD_COMPLETE 0x0001
413struct mgmt_ev_cmd_complete { 428struct mgmt_ev_cmd_complete {
414 __le16 opcode; 429 __le16 opcode;
diff --git a/include/net/bluetooth/rfcomm.h b/include/net/bluetooth/rfcomm.h
index 2611cc389d7d..578b83127af1 100644
--- a/include/net/bluetooth/rfcomm.h
+++ b/include/net/bluetooth/rfcomm.h
@@ -173,7 +173,7 @@ struct rfcomm_dlc {
173 struct sk_buff_head tx_queue; 173 struct sk_buff_head tx_queue;
174 struct timer_list timer; 174 struct timer_list timer;
175 175
176 spinlock_t lock; 176 struct mutex lock;
177 unsigned long state; 177 unsigned long state;
178 unsigned long flags; 178 unsigned long flags;
179 atomic_t refcnt; 179 atomic_t refcnt;
@@ -244,8 +244,8 @@ int rfcomm_dlc_get_modem_status(struct rfcomm_dlc *d, u8 *v24_sig);
244void rfcomm_dlc_accept(struct rfcomm_dlc *d); 244void rfcomm_dlc_accept(struct rfcomm_dlc *d);
245struct rfcomm_dlc *rfcomm_dlc_exists(bdaddr_t *src, bdaddr_t *dst, u8 channel); 245struct rfcomm_dlc *rfcomm_dlc_exists(bdaddr_t *src, bdaddr_t *dst, u8 channel);
246 246
247#define rfcomm_dlc_lock(d) spin_lock(&d->lock) 247#define rfcomm_dlc_lock(d) mutex_lock(&d->lock)
248#define rfcomm_dlc_unlock(d) spin_unlock(&d->lock) 248#define rfcomm_dlc_unlock(d) mutex_unlock(&d->lock)
249 249
250static inline void rfcomm_dlc_hold(struct rfcomm_dlc *d) 250static inline void rfcomm_dlc_hold(struct rfcomm_dlc *d)
251{ 251{
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index f3539a15c411..e46c437944f7 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -109,6 +109,13 @@ enum ieee80211_band {
109 * channel as the control or any of the secondary channels. 109 * channel as the control or any of the secondary channels.
110 * This may be due to the driver or due to regulatory bandwidth 110 * This may be due to the driver or due to regulatory bandwidth
111 * restrictions. 111 * restrictions.
112 * @IEEE80211_CHAN_INDOOR_ONLY: see %NL80211_FREQUENCY_ATTR_INDOOR_ONLY
113 * @IEEE80211_CHAN_GO_CONCURRENT: see %NL80211_FREQUENCY_ATTR_GO_CONCURRENT
114 * @IEEE80211_CHAN_NO_20MHZ: 20 MHz bandwidth is not permitted
115 * on this channel.
116 * @IEEE80211_CHAN_NO_10MHZ: 10 MHz bandwidth is not permitted
117 * on this channel.
118 *
112 */ 119 */
113enum ieee80211_channel_flags { 120enum ieee80211_channel_flags {
114 IEEE80211_CHAN_DISABLED = 1<<0, 121 IEEE80211_CHAN_DISABLED = 1<<0,
@@ -120,6 +127,10 @@ enum ieee80211_channel_flags {
120 IEEE80211_CHAN_NO_OFDM = 1<<6, 127 IEEE80211_CHAN_NO_OFDM = 1<<6,
121 IEEE80211_CHAN_NO_80MHZ = 1<<7, 128 IEEE80211_CHAN_NO_80MHZ = 1<<7,
122 IEEE80211_CHAN_NO_160MHZ = 1<<8, 129 IEEE80211_CHAN_NO_160MHZ = 1<<8,
130 IEEE80211_CHAN_INDOOR_ONLY = 1<<9,
131 IEEE80211_CHAN_GO_CONCURRENT = 1<<10,
132 IEEE80211_CHAN_NO_20MHZ = 1<<11,
133 IEEE80211_CHAN_NO_10MHZ = 1<<12,
123}; 134};
124 135
125#define IEEE80211_CHAN_NO_HT40 \ 136#define IEEE80211_CHAN_NO_HT40 \
@@ -330,8 +341,8 @@ struct vif_params {
330 * @seq_len: length of @seq. 341 * @seq_len: length of @seq.
331 */ 342 */
332struct key_params { 343struct key_params {
333 u8 *key; 344 const u8 *key;
334 u8 *seq; 345 const u8 *seq;
335 int key_len; 346 int key_len;
336 int seq_len; 347 int seq_len;
337 u32 cipher; 348 u32 cipher;
@@ -441,10 +452,13 @@ bool cfg80211_chandef_usable(struct wiphy *wiphy,
441 * cfg80211_chandef_dfs_required - checks if radar detection is required 452 * cfg80211_chandef_dfs_required - checks if radar detection is required
442 * @wiphy: the wiphy to validate against 453 * @wiphy: the wiphy to validate against
443 * @chandef: the channel definition to check 454 * @chandef: the channel definition to check
444 * Return: 1 if radar detection is required, 0 if it is not, < 0 on error 455 * @iftype: the interface type as specified in &enum nl80211_iftype
456 * Returns:
457 * 1 if radar detection is required, 0 if it is not, < 0 on error
445 */ 458 */
446int cfg80211_chandef_dfs_required(struct wiphy *wiphy, 459int cfg80211_chandef_dfs_required(struct wiphy *wiphy,
447 const struct cfg80211_chan_def *chandef); 460 const struct cfg80211_chan_def *chandef,
461 enum nl80211_iftype iftype);
448 462
449/** 463/**
450 * ieee80211_chandef_rate_flags - returns rate flags for a channel 464 * ieee80211_chandef_rate_flags - returns rate flags for a channel
@@ -654,7 +668,6 @@ struct cfg80211_acl_data {
654 * @p2p_opp_ps: P2P opportunistic PS 668 * @p2p_opp_ps: P2P opportunistic PS
655 * @acl: ACL configuration used by the drivers which has support for 669 * @acl: ACL configuration used by the drivers which has support for
656 * MAC address based access control 670 * MAC address based access control
657 * @radar_required: set if radar detection is required
658 */ 671 */
659struct cfg80211_ap_settings { 672struct cfg80211_ap_settings {
660 struct cfg80211_chan_def chandef; 673 struct cfg80211_chan_def chandef;
@@ -672,7 +685,6 @@ struct cfg80211_ap_settings {
672 u8 p2p_ctwindow; 685 u8 p2p_ctwindow;
673 bool p2p_opp_ps; 686 bool p2p_opp_ps;
674 const struct cfg80211_acl_data *acl; 687 const struct cfg80211_acl_data *acl;
675 bool radar_required;
676}; 688};
677 689
678/** 690/**
@@ -682,8 +694,10 @@ struct cfg80211_ap_settings {
682 * 694 *
683 * @chandef: defines the channel to use after the switch 695 * @chandef: defines the channel to use after the switch
684 * @beacon_csa: beacon data while performing the switch 696 * @beacon_csa: beacon data while performing the switch
685 * @counter_offset_beacon: offset for the counter within the beacon (tail) 697 * @counter_offsets_beacon: offsets of the counters within the beacon (tail)
686 * @counter_offset_presp: offset for the counter within the probe response 698 * @counter_offsets_presp: offsets of the counters within the probe response
699 * @n_counter_offsets_beacon: number of csa counters the beacon (tail)
700 * @n_counter_offsets_presp: number of csa counters in the probe response
687 * @beacon_after: beacon data to be used on the new channel 701 * @beacon_after: beacon data to be used on the new channel
688 * @radar_required: whether radar detection is required on the new channel 702 * @radar_required: whether radar detection is required on the new channel
689 * @block_tx: whether transmissions should be blocked while changing 703 * @block_tx: whether transmissions should be blocked while changing
@@ -692,7 +706,10 @@ struct cfg80211_ap_settings {
692struct cfg80211_csa_settings { 706struct cfg80211_csa_settings {
693 struct cfg80211_chan_def chandef; 707 struct cfg80211_chan_def chandef;
694 struct cfg80211_beacon_data beacon_csa; 708 struct cfg80211_beacon_data beacon_csa;
695 u16 counter_offset_beacon, counter_offset_presp; 709 const u16 *counter_offsets_beacon;
710 const u16 *counter_offsets_presp;
711 unsigned int n_counter_offsets_beacon;
712 unsigned int n_counter_offsets_presp;
696 struct cfg80211_beacon_data beacon_after; 713 struct cfg80211_beacon_data beacon_after;
697 bool radar_required; 714 bool radar_required;
698 bool block_tx; 715 bool block_tx;
@@ -856,36 +873,38 @@ int cfg80211_check_station_change(struct wiphy *wiphy,
856 * @STATION_INFO_NONPEER_PM: @nonpeer_pm filled 873 * @STATION_INFO_NONPEER_PM: @nonpeer_pm filled
857 * @STATION_INFO_CHAIN_SIGNAL: @chain_signal filled 874 * @STATION_INFO_CHAIN_SIGNAL: @chain_signal filled
858 * @STATION_INFO_CHAIN_SIGNAL_AVG: @chain_signal_avg filled 875 * @STATION_INFO_CHAIN_SIGNAL_AVG: @chain_signal_avg filled
876 * @STATION_INFO_EXPECTED_THROUGHPUT: @expected_throughput filled
859 */ 877 */
860enum station_info_flags { 878enum station_info_flags {
861 STATION_INFO_INACTIVE_TIME = 1<<0, 879 STATION_INFO_INACTIVE_TIME = BIT(0),
862 STATION_INFO_RX_BYTES = 1<<1, 880 STATION_INFO_RX_BYTES = BIT(1),
863 STATION_INFO_TX_BYTES = 1<<2, 881 STATION_INFO_TX_BYTES = BIT(2),
864 STATION_INFO_LLID = 1<<3, 882 STATION_INFO_LLID = BIT(3),
865 STATION_INFO_PLID = 1<<4, 883 STATION_INFO_PLID = BIT(4),
866 STATION_INFO_PLINK_STATE = 1<<5, 884 STATION_INFO_PLINK_STATE = BIT(5),
867 STATION_INFO_SIGNAL = 1<<6, 885 STATION_INFO_SIGNAL = BIT(6),
868 STATION_INFO_TX_BITRATE = 1<<7, 886 STATION_INFO_TX_BITRATE = BIT(7),
869 STATION_INFO_RX_PACKETS = 1<<8, 887 STATION_INFO_RX_PACKETS = BIT(8),
870 STATION_INFO_TX_PACKETS = 1<<9, 888 STATION_INFO_TX_PACKETS = BIT(9),
871 STATION_INFO_TX_RETRIES = 1<<10, 889 STATION_INFO_TX_RETRIES = BIT(10),
872 STATION_INFO_TX_FAILED = 1<<11, 890 STATION_INFO_TX_FAILED = BIT(11),
873 STATION_INFO_RX_DROP_MISC = 1<<12, 891 STATION_INFO_RX_DROP_MISC = BIT(12),
874 STATION_INFO_SIGNAL_AVG = 1<<13, 892 STATION_INFO_SIGNAL_AVG = BIT(13),
875 STATION_INFO_RX_BITRATE = 1<<14, 893 STATION_INFO_RX_BITRATE = BIT(14),
876 STATION_INFO_BSS_PARAM = 1<<15, 894 STATION_INFO_BSS_PARAM = BIT(15),
877 STATION_INFO_CONNECTED_TIME = 1<<16, 895 STATION_INFO_CONNECTED_TIME = BIT(16),
878 STATION_INFO_ASSOC_REQ_IES = 1<<17, 896 STATION_INFO_ASSOC_REQ_IES = BIT(17),
879 STATION_INFO_STA_FLAGS = 1<<18, 897 STATION_INFO_STA_FLAGS = BIT(18),
880 STATION_INFO_BEACON_LOSS_COUNT = 1<<19, 898 STATION_INFO_BEACON_LOSS_COUNT = BIT(19),
881 STATION_INFO_T_OFFSET = 1<<20, 899 STATION_INFO_T_OFFSET = BIT(20),
882 STATION_INFO_LOCAL_PM = 1<<21, 900 STATION_INFO_LOCAL_PM = BIT(21),
883 STATION_INFO_PEER_PM = 1<<22, 901 STATION_INFO_PEER_PM = BIT(22),
884 STATION_INFO_NONPEER_PM = 1<<23, 902 STATION_INFO_NONPEER_PM = BIT(23),
885 STATION_INFO_RX_BYTES64 = 1<<24, 903 STATION_INFO_RX_BYTES64 = BIT(24),
886 STATION_INFO_TX_BYTES64 = 1<<25, 904 STATION_INFO_TX_BYTES64 = BIT(25),
887 STATION_INFO_CHAIN_SIGNAL = 1<<26, 905 STATION_INFO_CHAIN_SIGNAL = BIT(26),
888 STATION_INFO_CHAIN_SIGNAL_AVG = 1<<27, 906 STATION_INFO_CHAIN_SIGNAL_AVG = BIT(27),
907 STATION_INFO_EXPECTED_THROUGHPUT = BIT(28),
889}; 908};
890 909
891/** 910/**
@@ -1007,6 +1026,8 @@ struct sta_bss_parameters {
1007 * @local_pm: local mesh STA power save mode 1026 * @local_pm: local mesh STA power save mode
1008 * @peer_pm: peer mesh STA power save mode 1027 * @peer_pm: peer mesh STA power save mode
1009 * @nonpeer_pm: non-peer mesh STA power save mode 1028 * @nonpeer_pm: non-peer mesh STA power save mode
1029 * @expected_throughput: expected throughput in kbps (including 802.11 headers)
1030 * towards this station.
1010 */ 1031 */
1011struct station_info { 1032struct station_info {
1012 u32 filled; 1033 u32 filled;
@@ -1045,6 +1066,8 @@ struct station_info {
1045 enum nl80211_mesh_power_mode peer_pm; 1066 enum nl80211_mesh_power_mode peer_pm;
1046 enum nl80211_mesh_power_mode nonpeer_pm; 1067 enum nl80211_mesh_power_mode nonpeer_pm;
1047 1068
1069 u32 expected_throughput;
1070
1048 /* 1071 /*
1049 * Note: Add a new enum station_info_flags value for each new field and 1072 * Note: Add a new enum station_info_flags value for each new field and
1050 * use it to check which fields are initialized. 1073 * use it to check which fields are initialized.
@@ -1052,6 +1075,19 @@ struct station_info {
1052}; 1075};
1053 1076
1054/** 1077/**
1078 * cfg80211_get_station - retrieve information about a given station
1079 * @dev: the device where the station is supposed to be connected to
1080 * @mac_addr: the mac address of the station of interest
1081 * @sinfo: pointer to the structure to fill with the information
1082 *
1083 * Returns 0 on success and sinfo is filled with the available information
1084 * otherwise returns a negative error code and the content of sinfo has to be
1085 * considered undefined.
1086 */
1087int cfg80211_get_station(struct net_device *dev, const u8 *mac_addr,
1088 struct station_info *sinfo);
1089
1090/**
1055 * enum monitor_flags - monitor flags 1091 * enum monitor_flags - monitor flags
1056 * 1092 *
1057 * Monitor interface configuration flags. Note that these must be the bits 1093 * Monitor interface configuration flags. Note that these must be the bits
@@ -1152,7 +1188,7 @@ struct bss_parameters {
1152 int use_cts_prot; 1188 int use_cts_prot;
1153 int use_short_preamble; 1189 int use_short_preamble;
1154 int use_short_slot_time; 1190 int use_short_slot_time;
1155 u8 *basic_rates; 1191 const u8 *basic_rates;
1156 u8 basic_rates_len; 1192 u8 basic_rates_len;
1157 int ap_isolate; 1193 int ap_isolate;
1158 int ht_opmode; 1194 int ht_opmode;
@@ -1682,10 +1718,10 @@ struct cfg80211_disassoc_request {
1682 * @ht_capa_mask: The bits of ht_capa which are to be used. 1718 * @ht_capa_mask: The bits of ht_capa which are to be used.
1683 */ 1719 */
1684struct cfg80211_ibss_params { 1720struct cfg80211_ibss_params {
1685 u8 *ssid; 1721 const u8 *ssid;
1686 u8 *bssid; 1722 const u8 *bssid;
1687 struct cfg80211_chan_def chandef; 1723 struct cfg80211_chan_def chandef;
1688 u8 *ie; 1724 const u8 *ie;
1689 u8 ssid_len, ie_len; 1725 u8 ssid_len, ie_len;
1690 u16 beacon_interval; 1726 u16 beacon_interval;
1691 u32 basic_rates; 1727 u32 basic_rates;
@@ -1794,8 +1830,8 @@ struct cfg80211_bitrate_mask {
1794 * @pmkid: The PMK material itself. 1830 * @pmkid: The PMK material itself.
1795 */ 1831 */
1796struct cfg80211_pmksa { 1832struct cfg80211_pmksa {
1797 u8 *bssid; 1833 const u8 *bssid;
1798 u8 *pmkid; 1834 const u8 *pmkid;
1799}; 1835};
1800 1836
1801/** 1837/**
@@ -1810,7 +1846,7 @@ struct cfg80211_pmksa {
1810 * memory, free @mask only! 1846 * memory, free @mask only!
1811 */ 1847 */
1812struct cfg80211_pkt_pattern { 1848struct cfg80211_pkt_pattern {
1813 u8 *mask, *pattern; 1849 const u8 *mask, *pattern;
1814 int pattern_len; 1850 int pattern_len;
1815 int pkt_offset; 1851 int pkt_offset;
1816}; 1852};
@@ -1974,6 +2010,8 @@ struct cfg80211_update_ft_ies_params {
1974 * @len: buffer length 2010 * @len: buffer length
1975 * @no_cck: don't use cck rates for this frame 2011 * @no_cck: don't use cck rates for this frame
1976 * @dont_wait_for_ack: tells the low level not to wait for an ack 2012 * @dont_wait_for_ack: tells the low level not to wait for an ack
2013 * @n_csa_offsets: length of csa_offsets array
2014 * @csa_offsets: array of all the csa offsets in the frame
1977 */ 2015 */
1978struct cfg80211_mgmt_tx_params { 2016struct cfg80211_mgmt_tx_params {
1979 struct ieee80211_channel *chan; 2017 struct ieee80211_channel *chan;
@@ -1983,6 +2021,8 @@ struct cfg80211_mgmt_tx_params {
1983 size_t len; 2021 size_t len;
1984 bool no_cck; 2022 bool no_cck;
1985 bool dont_wait_for_ack; 2023 bool dont_wait_for_ack;
2024 int n_csa_offsets;
2025 const u16 *csa_offsets;
1986}; 2026};
1987 2027
1988/** 2028/**
@@ -2278,6 +2318,10 @@ struct cfg80211_qos_map {
2278 * @channel_switch: initiate channel-switch procedure (with CSA) 2318 * @channel_switch: initiate channel-switch procedure (with CSA)
2279 * 2319 *
2280 * @set_qos_map: Set QoS mapping information to the driver 2320 * @set_qos_map: Set QoS mapping information to the driver
2321 *
2322 * @set_ap_chanwidth: Set the AP (including P2P GO) mode channel width for the
2323 * given interface This is used e.g. for dynamic HT 20/40 MHz channel width
2324 * changes during the lifetime of the BSS.
2281 */ 2325 */
2282struct cfg80211_ops { 2326struct cfg80211_ops {
2283 int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow); 2327 int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
@@ -2320,28 +2364,29 @@ struct cfg80211_ops {
2320 2364
2321 2365
2322 int (*add_station)(struct wiphy *wiphy, struct net_device *dev, 2366 int (*add_station)(struct wiphy *wiphy, struct net_device *dev,
2323 u8 *mac, struct station_parameters *params); 2367 const u8 *mac,
2368 struct station_parameters *params);
2324 int (*del_station)(struct wiphy *wiphy, struct net_device *dev, 2369 int (*del_station)(struct wiphy *wiphy, struct net_device *dev,
2325 u8 *mac); 2370 const u8 *mac);
2326 int (*change_station)(struct wiphy *wiphy, struct net_device *dev, 2371 int (*change_station)(struct wiphy *wiphy, struct net_device *dev,
2327 u8 *mac, struct station_parameters *params); 2372 const u8 *mac,
2373 struct station_parameters *params);
2328 int (*get_station)(struct wiphy *wiphy, struct net_device *dev, 2374 int (*get_station)(struct wiphy *wiphy, struct net_device *dev,
2329 u8 *mac, struct station_info *sinfo); 2375 const u8 *mac, struct station_info *sinfo);
2330 int (*dump_station)(struct wiphy *wiphy, struct net_device *dev, 2376 int (*dump_station)(struct wiphy *wiphy, struct net_device *dev,
2331 int idx, u8 *mac, struct station_info *sinfo); 2377 int idx, u8 *mac, struct station_info *sinfo);
2332 2378
2333 int (*add_mpath)(struct wiphy *wiphy, struct net_device *dev, 2379 int (*add_mpath)(struct wiphy *wiphy, struct net_device *dev,
2334 u8 *dst, u8 *next_hop); 2380 const u8 *dst, const u8 *next_hop);
2335 int (*del_mpath)(struct wiphy *wiphy, struct net_device *dev, 2381 int (*del_mpath)(struct wiphy *wiphy, struct net_device *dev,
2336 u8 *dst); 2382 const u8 *dst);
2337 int (*change_mpath)(struct wiphy *wiphy, struct net_device *dev, 2383 int (*change_mpath)(struct wiphy *wiphy, struct net_device *dev,
2338 u8 *dst, u8 *next_hop); 2384 const u8 *dst, const u8 *next_hop);
2339 int (*get_mpath)(struct wiphy *wiphy, struct net_device *dev, 2385 int (*get_mpath)(struct wiphy *wiphy, struct net_device *dev,
2340 u8 *dst, u8 *next_hop, 2386 u8 *dst, u8 *next_hop, struct mpath_info *pinfo);
2341 struct mpath_info *pinfo);
2342 int (*dump_mpath)(struct wiphy *wiphy, struct net_device *dev, 2387 int (*dump_mpath)(struct wiphy *wiphy, struct net_device *dev,
2343 int idx, u8 *dst, u8 *next_hop, 2388 int idx, u8 *dst, u8 *next_hop,
2344 struct mpath_info *pinfo); 2389 struct mpath_info *pinfo);
2345 int (*get_mesh_config)(struct wiphy *wiphy, 2390 int (*get_mesh_config)(struct wiphy *wiphy,
2346 struct net_device *dev, 2391 struct net_device *dev,
2347 struct mesh_config *conf); 2392 struct mesh_config *conf);
@@ -2471,11 +2516,11 @@ struct cfg80211_ops {
2471 struct cfg80211_gtk_rekey_data *data); 2516 struct cfg80211_gtk_rekey_data *data);
2472 2517
2473 int (*tdls_mgmt)(struct wiphy *wiphy, struct net_device *dev, 2518 int (*tdls_mgmt)(struct wiphy *wiphy, struct net_device *dev,
2474 u8 *peer, u8 action_code, u8 dialog_token, 2519 const u8 *peer, u8 action_code, u8 dialog_token,
2475 u16 status_code, u32 peer_capability, 2520 u16 status_code, u32 peer_capability,
2476 const u8 *buf, size_t len); 2521 const u8 *buf, size_t len);
2477 int (*tdls_oper)(struct wiphy *wiphy, struct net_device *dev, 2522 int (*tdls_oper)(struct wiphy *wiphy, struct net_device *dev,
2478 u8 *peer, enum nl80211_tdls_operation oper); 2523 const u8 *peer, enum nl80211_tdls_operation oper);
2479 2524
2480 int (*probe_client)(struct wiphy *wiphy, struct net_device *dev, 2525 int (*probe_client)(struct wiphy *wiphy, struct net_device *dev,
2481 const u8 *peer, u64 *cookie); 2526 const u8 *peer, u64 *cookie);
@@ -2521,9 +2566,13 @@ struct cfg80211_ops {
2521 int (*channel_switch)(struct wiphy *wiphy, 2566 int (*channel_switch)(struct wiphy *wiphy,
2522 struct net_device *dev, 2567 struct net_device *dev,
2523 struct cfg80211_csa_settings *params); 2568 struct cfg80211_csa_settings *params);
2569
2524 int (*set_qos_map)(struct wiphy *wiphy, 2570 int (*set_qos_map)(struct wiphy *wiphy,
2525 struct net_device *dev, 2571 struct net_device *dev,
2526 struct cfg80211_qos_map *qos_map); 2572 struct cfg80211_qos_map *qos_map);
2573
2574 int (*set_ap_chanwidth)(struct wiphy *wiphy, struct net_device *dev,
2575 struct cfg80211_chan_def *chandef);
2527}; 2576};
2528 2577
2529/* 2578/*
@@ -2618,6 +2667,7 @@ struct ieee80211_iface_limit {
2618 * between infrastructure and AP types must match. This is required 2667 * between infrastructure and AP types must match. This is required
2619 * only in special cases. 2668 * only in special cases.
2620 * @radar_detect_widths: bitmap of channel widths supported for radar detection 2669 * @radar_detect_widths: bitmap of channel widths supported for radar detection
2670 * @radar_detect_regions: bitmap of regions supported for radar detection
2621 * 2671 *
2622 * With this structure the driver can describe which interface 2672 * With this structure the driver can describe which interface
2623 * combinations it supports concurrently. 2673 * combinations it supports concurrently.
@@ -2675,6 +2725,7 @@ struct ieee80211_iface_combination {
2675 u8 n_limits; 2725 u8 n_limits;
2676 bool beacon_int_infra_match; 2726 bool beacon_int_infra_match;
2677 u8 radar_detect_widths; 2727 u8 radar_detect_widths;
2728 u8 radar_detect_regions;
2678}; 2729};
2679 2730
2680struct ieee80211_txrx_stypes { 2731struct ieee80211_txrx_stypes {
@@ -2905,6 +2956,17 @@ struct wiphy_vendor_command {
2905 * (including P2P GO) or 0 to indicate no such limit is advertised. The 2956 * (including P2P GO) or 0 to indicate no such limit is advertised. The
2906 * driver is allowed to advertise a theoretical limit that it can reach in 2957 * driver is allowed to advertise a theoretical limit that it can reach in
2907 * some cases, but may not always reach. 2958 * some cases, but may not always reach.
2959 *
2960 * @max_num_csa_counters: Number of supported csa_counters in beacons
2961 * and probe responses. This value should be set if the driver
2962 * wishes to limit the number of csa counters. Default (0) means
2963 * infinite.
2964 * @max_adj_channel_rssi_comp: max offset of between the channel on which the
2965 * frame was sent and the channel on which the frame was heard for which
2966 * the reported rssi is still valid. If a driver is able to compensate the
2967 * low rssi when a frame is heard on different channel, then it should set
2968 * this variable to the maximal offset for which it can compensate.
2969 * This value should be set in MHz.
2908 */ 2970 */
2909struct wiphy { 2971struct wiphy {
2910 /* assign these fields before you register the wiphy */ 2972 /* assign these fields before you register the wiphy */
@@ -3022,6 +3084,9 @@ struct wiphy {
3022 3084
3023 u16 max_ap_assoc_sta; 3085 u16 max_ap_assoc_sta;
3024 3086
3087 u8 max_num_csa_counters;
3088 u8 max_adj_channel_rssi_comp;
3089
3025 char priv[0] __aligned(NETDEV_ALIGN); 3090 char priv[0] __aligned(NETDEV_ALIGN);
3026}; 3091};
3027 3092
@@ -3194,6 +3259,7 @@ struct cfg80211_cached_keys;
3194 * @ibss_dfs_possible: (private) IBSS may change to a DFS channel 3259 * @ibss_dfs_possible: (private) IBSS may change to a DFS channel
3195 * @event_list: (private) list for internal event processing 3260 * @event_list: (private) list for internal event processing
3196 * @event_lock: (private) lock for event list 3261 * @event_lock: (private) lock for event list
3262 * @owner_nlportid: (private) owner socket port ID
3197 */ 3263 */
3198struct wireless_dev { 3264struct wireless_dev {
3199 struct wiphy *wiphy; 3265 struct wiphy *wiphy;
@@ -3241,13 +3307,15 @@ struct wireless_dev {
3241 unsigned long cac_start_time; 3307 unsigned long cac_start_time;
3242 unsigned int cac_time_ms; 3308 unsigned int cac_time_ms;
3243 3309
3310 u32 owner_nlportid;
3311
3244#ifdef CONFIG_CFG80211_WEXT 3312#ifdef CONFIG_CFG80211_WEXT
3245 /* wext data */ 3313 /* wext data */
3246 struct { 3314 struct {
3247 struct cfg80211_ibss_params ibss; 3315 struct cfg80211_ibss_params ibss;
3248 struct cfg80211_connect_params connect; 3316 struct cfg80211_connect_params connect;
3249 struct cfg80211_cached_keys *keys; 3317 struct cfg80211_cached_keys *keys;
3250 u8 *ie; 3318 const u8 *ie;
3251 size_t ie_len; 3319 size_t ie_len;
3252 u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN]; 3320 u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN];
3253 u8 ssid[IEEE80211_MAX_SSID_LEN]; 3321 u8 ssid[IEEE80211_MAX_SSID_LEN];
@@ -3488,7 +3556,8 @@ int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr,
3488 * Return: 0 on success, or a negative error code. 3556 * Return: 0 on success, or a negative error code.
3489 */ 3557 */
3490int ieee80211_data_from_8023(struct sk_buff *skb, const u8 *addr, 3558int ieee80211_data_from_8023(struct sk_buff *skb, const u8 *addr,
3491 enum nl80211_iftype iftype, u8 *bssid, bool qos); 3559 enum nl80211_iftype iftype, const u8 *bssid,
3560 bool qos);
3492 3561
3493/** 3562/**
3494 * ieee80211_amsdu_to_8023s - decode an IEEE 802.11n A-MSDU frame 3563 * ieee80211_amsdu_to_8023s - decode an IEEE 802.11n A-MSDU frame
@@ -3600,7 +3669,7 @@ int regulatory_hint(struct wiphy *wiphy, const char *alpha2);
3600 * default channel settings will be disregarded. If no rule is found for a 3669 * default channel settings will be disregarded. If no rule is found for a
3601 * channel on the regulatory domain the channel will be disabled. 3670 * channel on the regulatory domain the channel will be disabled.
3602 * Drivers using this for a wiphy should also set the wiphy flag 3671 * Drivers using this for a wiphy should also set the wiphy flag
3603 * WIPHY_FLAG_CUSTOM_REGULATORY or cfg80211 will set it for the wiphy 3672 * REGULATORY_CUSTOM_REG or cfg80211 will set it for the wiphy
3604 * that called this helper. 3673 * that called this helper.
3605 */ 3674 */
3606void wiphy_apply_custom_regulatory(struct wiphy *wiphy, 3675void wiphy_apply_custom_regulatory(struct wiphy *wiphy,
@@ -3669,6 +3738,18 @@ void cfg80211_sched_scan_results(struct wiphy *wiphy);
3669void cfg80211_sched_scan_stopped(struct wiphy *wiphy); 3738void cfg80211_sched_scan_stopped(struct wiphy *wiphy);
3670 3739
3671/** 3740/**
3741 * cfg80211_sched_scan_stopped_rtnl - notify that the scheduled scan has stopped
3742 *
3743 * @wiphy: the wiphy on which the scheduled scan stopped
3744 *
3745 * The driver can call this function to inform cfg80211 that the
3746 * scheduled scan had to be stopped, for whatever reason. The driver
3747 * is then called back via the sched_scan_stop operation when done.
3748 * This function should be called with rtnl locked.
3749 */
3750void cfg80211_sched_scan_stopped_rtnl(struct wiphy *wiphy);
3751
3752/**
3672 * cfg80211_inform_bss_width_frame - inform cfg80211 of a received BSS frame 3753 * cfg80211_inform_bss_width_frame - inform cfg80211 of a received BSS frame
3673 * 3754 *
3674 * @wiphy: the wiphy reporting the BSS 3755 * @wiphy: the wiphy reporting the BSS
@@ -4277,7 +4358,7 @@ void cfg80211_roamed_bss(struct net_device *dev, struct cfg80211_bss *bss,
4277 * and not try to connect to any AP any more. 4358 * and not try to connect to any AP any more.
4278 */ 4359 */
4279void cfg80211_disconnected(struct net_device *dev, u16 reason, 4360void cfg80211_disconnected(struct net_device *dev, u16 reason,
4280 u8 *ie, size_t ie_len, gfp_t gfp); 4361 const u8 *ie, size_t ie_len, gfp_t gfp);
4281 4362
4282/** 4363/**
4283 * cfg80211_ready_on_channel - notification of remain_on_channel start 4364 * cfg80211_ready_on_channel - notification of remain_on_channel start
@@ -4531,12 +4612,14 @@ void cfg80211_report_obss_beacon(struct wiphy *wiphy,
4531 * cfg80211_reg_can_beacon - check if beaconing is allowed 4612 * cfg80211_reg_can_beacon - check if beaconing is allowed
4532 * @wiphy: the wiphy 4613 * @wiphy: the wiphy
4533 * @chandef: the channel definition 4614 * @chandef: the channel definition
4615 * @iftype: interface type
4534 * 4616 *
4535 * Return: %true if there is no secondary channel or the secondary channel(s) 4617 * Return: %true if there is no secondary channel or the secondary channel(s)
4536 * can be used for beaconing (i.e. is not a radar channel etc.) 4618 * can be used for beaconing (i.e. is not a radar channel etc.)
4537 */ 4619 */
4538bool cfg80211_reg_can_beacon(struct wiphy *wiphy, 4620bool cfg80211_reg_can_beacon(struct wiphy *wiphy,
4539 struct cfg80211_chan_def *chandef); 4621 struct cfg80211_chan_def *chandef,
4622 enum nl80211_iftype iftype);
4540 4623
4541/* 4624/*
4542 * cfg80211_ch_switch_notify - update wdev channel and notify userspace 4625 * cfg80211_ch_switch_notify - update wdev channel and notify userspace
@@ -4682,6 +4765,84 @@ void cfg80211_crit_proto_stopped(struct wireless_dev *wdev, gfp_t gfp);
4682 */ 4765 */
4683unsigned int ieee80211_get_num_supported_channels(struct wiphy *wiphy); 4766unsigned int ieee80211_get_num_supported_channels(struct wiphy *wiphy);
4684 4767
4768/**
4769 * cfg80211_check_combinations - check interface combinations
4770 *
4771 * @wiphy: the wiphy
4772 * @num_different_channels: the number of different channels we want
4773 * to use for verification
4774 * @radar_detect: a bitmap where each bit corresponds to a channel
4775 * width where radar detection is needed, as in the definition of
4776 * &struct ieee80211_iface_combination.@radar_detect_widths
4777 * @iftype_num: array with the numbers of interfaces of each interface
4778 * type. The index is the interface type as specified in &enum
4779 * nl80211_iftype.
4780 *
4781 * This function can be called by the driver to check whether a
4782 * combination of interfaces and their types are allowed according to
4783 * the interface combinations.
4784 */
4785int cfg80211_check_combinations(struct wiphy *wiphy,
4786 const int num_different_channels,
4787 const u8 radar_detect,
4788 const int iftype_num[NUM_NL80211_IFTYPES]);
4789
4790/**
4791 * cfg80211_iter_combinations - iterate over matching combinations
4792 *
4793 * @wiphy: the wiphy
4794 * @num_different_channels: the number of different channels we want
4795 * to use for verification
4796 * @radar_detect: a bitmap where each bit corresponds to a channel
4797 * width where radar detection is needed, as in the definition of
4798 * &struct ieee80211_iface_combination.@radar_detect_widths
4799 * @iftype_num: array with the numbers of interfaces of each interface
4800 * type. The index is the interface type as specified in &enum
4801 * nl80211_iftype.
4802 * @iter: function to call for each matching combination
4803 * @data: pointer to pass to iter function
4804 *
4805 * This function can be called by the driver to check what possible
4806 * combinations it fits in at a given moment, e.g. for channel switching
4807 * purposes.
4808 */
4809int cfg80211_iter_combinations(struct wiphy *wiphy,
4810 const int num_different_channels,
4811 const u8 radar_detect,
4812 const int iftype_num[NUM_NL80211_IFTYPES],
4813 void (*iter)(const struct ieee80211_iface_combination *c,
4814 void *data),
4815 void *data);
4816
4817/*
4818 * cfg80211_stop_iface - trigger interface disconnection
4819 *
4820 * @wiphy: the wiphy
4821 * @wdev: wireless device
4822 * @gfp: context flags
4823 *
4824 * Trigger interface to be stopped as if AP was stopped, IBSS/mesh left, STA
4825 * disconnected.
4826 *
4827 * Note: This doesn't need any locks and is asynchronous.
4828 */
4829void cfg80211_stop_iface(struct wiphy *wiphy, struct wireless_dev *wdev,
4830 gfp_t gfp);
4831
4832/**
4833 * cfg80211_shutdown_all_interfaces - shut down all interfaces for a wiphy
4834 * @wiphy: the wiphy to shut down
4835 *
4836 * This function shuts down all interfaces belonging to this wiphy by
4837 * calling dev_close() (and treating non-netdev interfaces as needed).
4838 * It shouldn't really be used unless there are some fatal device errors
4839 * that really can't be recovered in any other way.
4840 *
4841 * Callers must hold the RTNL and be able to deal with callbacks into
4842 * the driver while the function is running.
4843 */
4844void cfg80211_shutdown_all_interfaces(struct wiphy *wiphy);
4845
4685/* Logging, debugging and troubleshooting/diagnostic helpers. */ 4846/* Logging, debugging and troubleshooting/diagnostic helpers. */
4686 4847
4687/* wiphy_printk helpers, similar to dev_printk */ 4848/* wiphy_printk helpers, similar to dev_printk */
diff --git a/include/net/checksum.h b/include/net/checksum.h
index a28f4e0f6251..87cb1903640d 100644
--- a/include/net/checksum.h
+++ b/include/net/checksum.h
@@ -57,12 +57,14 @@ static __inline__ __wsum csum_and_copy_to_user
57} 57}
58#endif 58#endif
59 59
60#ifndef HAVE_ARCH_CSUM_ADD
60static inline __wsum csum_add(__wsum csum, __wsum addend) 61static inline __wsum csum_add(__wsum csum, __wsum addend)
61{ 62{
62 u32 res = (__force u32)csum; 63 u32 res = (__force u32)csum;
63 res += (__force u32)addend; 64 res += (__force u32)addend;
64 return (__force __wsum)(res + (res < (__force u32)addend)); 65 return (__force __wsum)(res + (res < (__force u32)addend));
65} 66}
67#endif
66 68
67static inline __wsum csum_sub(__wsum csum, __wsum addend) 69static inline __wsum csum_sub(__wsum csum, __wsum addend)
68{ 70{
diff --git a/include/net/dsa.h b/include/net/dsa.h
index 7828ebf99ee1..6efce384451e 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -181,6 +181,11 @@ struct dsa_switch_driver {
181void register_switch_driver(struct dsa_switch_driver *type); 181void register_switch_driver(struct dsa_switch_driver *type);
182void unregister_switch_driver(struct dsa_switch_driver *type); 182void unregister_switch_driver(struct dsa_switch_driver *type);
183 183
184static inline void *ds_to_priv(struct dsa_switch *ds)
185{
186 return (void *)(ds + 1);
187}
188
184/* 189/*
185 * The original DSA tag format and some other tag formats have no 190 * The original DSA tag format and some other tag formats have no
186 * ethertype, which means that we need to add a little hack to the 191 * ethertype, which means that we need to add a little hack to the
diff --git a/include/net/gre.h b/include/net/gre.h
index 70046a0b0b89..b53182018743 100644
--- a/include/net/gre.h
+++ b/include/net/gre.h
@@ -37,9 +37,10 @@ void gre_build_header(struct sk_buff *skb, const struct tnl_ptk_info *tpi,
37 int hdr_len); 37 int hdr_len);
38 38
39static inline struct sk_buff *gre_handle_offloads(struct sk_buff *skb, 39static inline struct sk_buff *gre_handle_offloads(struct sk_buff *skb,
40 bool gre_csum) 40 bool csum)
41{ 41{
42 return iptunnel_handle_offloads(skb, gre_csum, SKB_GSO_GRE); 42 return iptunnel_handle_offloads(skb, csum,
43 csum ? SKB_GSO_GRE_CSUM : SKB_GSO_GRE);
43} 44}
44 45
45 46
diff --git a/include/net/ieee802154.h b/include/net/ieee802154.h
index c7ae0ac528dc..0aa7122e8f15 100644
--- a/include/net/ieee802154.h
+++ b/include/net/ieee802154.h
@@ -79,6 +79,15 @@
79#define IEEE802154_SCF_KEY_SHORT_INDEX 2 79#define IEEE802154_SCF_KEY_SHORT_INDEX 2
80#define IEEE802154_SCF_KEY_HW_INDEX 3 80#define IEEE802154_SCF_KEY_HW_INDEX 3
81 81
82#define IEEE802154_SCF_SECLEVEL_NONE 0
83#define IEEE802154_SCF_SECLEVEL_MIC32 1
84#define IEEE802154_SCF_SECLEVEL_MIC64 2
85#define IEEE802154_SCF_SECLEVEL_MIC128 3
86#define IEEE802154_SCF_SECLEVEL_ENC 4
87#define IEEE802154_SCF_SECLEVEL_ENC_MIC32 5
88#define IEEE802154_SCF_SECLEVEL_ENC_MIC64 6
89#define IEEE802154_SCF_SECLEVEL_ENC_MIC128 7
90
82/* MAC footer size */ 91/* MAC footer size */
83#define IEEE802154_MFR_SIZE 2 /* 2 octets */ 92#define IEEE802154_MFR_SIZE 2 /* 2 octets */
84 93
diff --git a/include/net/ieee802154_netdev.h b/include/net/ieee802154_netdev.h
index 5a719ca892f4..3b53c8e405e4 100644
--- a/include/net/ieee802154_netdev.h
+++ b/include/net/ieee802154_netdev.h
@@ -27,6 +27,7 @@
27#ifndef IEEE802154_NETDEVICE_H 27#ifndef IEEE802154_NETDEVICE_H
28#define IEEE802154_NETDEVICE_H 28#define IEEE802154_NETDEVICE_H
29 29
30#include <net/ieee802154.h>
30#include <net/af_ieee802154.h> 31#include <net/af_ieee802154.h>
31#include <linux/netdevice.h> 32#include <linux/netdevice.h>
32#include <linux/skbuff.h> 33#include <linux/skbuff.h>
@@ -114,6 +115,34 @@ int ieee802154_hdr_pull(struct sk_buff *skb, struct ieee802154_hdr *hdr);
114int ieee802154_hdr_peek_addrs(const struct sk_buff *skb, 115int ieee802154_hdr_peek_addrs(const struct sk_buff *skb,
115 struct ieee802154_hdr *hdr); 116 struct ieee802154_hdr *hdr);
116 117
118/* parses the full 802.15.4 header a given skb and stores them into hdr,
119 * performing pan id decompression and length checks to be suitable for use in
120 * header_ops.parse
121 */
122int ieee802154_hdr_peek(const struct sk_buff *skb, struct ieee802154_hdr *hdr);
123
124int ieee802154_max_payload(const struct ieee802154_hdr *hdr);
125
126static inline int
127ieee802154_sechdr_authtag_len(const struct ieee802154_sechdr *sec)
128{
129 switch (sec->level) {
130 case IEEE802154_SCF_SECLEVEL_MIC32:
131 case IEEE802154_SCF_SECLEVEL_ENC_MIC32:
132 return 4;
133 case IEEE802154_SCF_SECLEVEL_MIC64:
134 case IEEE802154_SCF_SECLEVEL_ENC_MIC64:
135 return 8;
136 case IEEE802154_SCF_SECLEVEL_MIC128:
137 case IEEE802154_SCF_SECLEVEL_ENC_MIC128:
138 return 16;
139 case IEEE802154_SCF_SECLEVEL_NONE:
140 case IEEE802154_SCF_SECLEVEL_ENC:
141 default:
142 return 0;
143 }
144}
145
117static inline int ieee802154_hdr_length(struct sk_buff *skb) 146static inline int ieee802154_hdr_length(struct sk_buff *skb)
118{ 147{
119 struct ieee802154_hdr hdr; 148 struct ieee802154_hdr hdr;
@@ -193,8 +222,12 @@ static inline void ieee802154_addr_to_sa(struct ieee802154_addr_sa *sa,
193 */ 222 */
194struct ieee802154_mac_cb { 223struct ieee802154_mac_cb {
195 u8 lqi; 224 u8 lqi;
196 u8 flags; 225 u8 type;
197 u8 seq; 226 bool ackreq;
227 bool secen;
228 bool secen_override;
229 u8 seclevel;
230 bool seclevel_override;
198 struct ieee802154_addr source; 231 struct ieee802154_addr source;
199 struct ieee802154_addr dest; 232 struct ieee802154_addr dest;
200}; 233};
@@ -204,25 +237,96 @@ static inline struct ieee802154_mac_cb *mac_cb(struct sk_buff *skb)
204 return (struct ieee802154_mac_cb *)skb->cb; 237 return (struct ieee802154_mac_cb *)skb->cb;
205} 238}
206 239
207#define MAC_CB_FLAG_TYPEMASK ((1 << 3) - 1) 240static inline struct ieee802154_mac_cb *mac_cb_init(struct sk_buff *skb)
208
209#define MAC_CB_FLAG_ACKREQ (1 << 3)
210#define MAC_CB_FLAG_SECEN (1 << 4)
211
212static inline bool mac_cb_is_ackreq(struct sk_buff *skb)
213{ 241{
214 return mac_cb(skb)->flags & MAC_CB_FLAG_ACKREQ; 242 BUILD_BUG_ON(sizeof(struct ieee802154_mac_cb) > sizeof(skb->cb));
215}
216 243
217static inline bool mac_cb_is_secen(struct sk_buff *skb) 244 memset(skb->cb, 0, sizeof(struct ieee802154_mac_cb));
218{ 245 return mac_cb(skb);
219 return mac_cb(skb)->flags & MAC_CB_FLAG_SECEN;
220} 246}
221 247
222static inline int mac_cb_type(struct sk_buff *skb) 248#define IEEE802154_LLSEC_KEY_SIZE 16
223{ 249
224 return mac_cb(skb)->flags & MAC_CB_FLAG_TYPEMASK; 250struct ieee802154_llsec_key_id {
225} 251 u8 mode;
252 u8 id;
253 union {
254 struct ieee802154_addr device_addr;
255 __le32 short_source;
256 __le64 extended_source;
257 };
258};
259
260struct ieee802154_llsec_key {
261 u8 frame_types;
262 u32 cmd_frame_ids;
263 u8 key[IEEE802154_LLSEC_KEY_SIZE];
264};
265
266struct ieee802154_llsec_key_entry {
267 struct list_head list;
268
269 struct ieee802154_llsec_key_id id;
270 struct ieee802154_llsec_key *key;
271};
272
273struct ieee802154_llsec_device_key {
274 struct list_head list;
275
276 struct ieee802154_llsec_key_id key_id;
277 u32 frame_counter;
278};
279
280enum {
281 IEEE802154_LLSEC_DEVKEY_IGNORE,
282 IEEE802154_LLSEC_DEVKEY_RESTRICT,
283 IEEE802154_LLSEC_DEVKEY_RECORD,
284
285 __IEEE802154_LLSEC_DEVKEY_MAX,
286};
287
288struct ieee802154_llsec_device {
289 struct list_head list;
290
291 __le16 pan_id;
292 __le16 short_addr;
293 __le64 hwaddr;
294 u32 frame_counter;
295 bool seclevel_exempt;
296
297 u8 key_mode;
298 struct list_head keys;
299};
300
301struct ieee802154_llsec_seclevel {
302 struct list_head list;
303
304 u8 frame_type;
305 u8 cmd_frame_id;
306 bool device_override;
307 u32 sec_levels;
308};
309
310struct ieee802154_llsec_params {
311 bool enabled;
312
313 __be32 frame_counter;
314 u8 out_level;
315 struct ieee802154_llsec_key_id out_key;
316
317 __le64 default_key_source;
318
319 __le16 pan_id;
320 __le64 hwaddr;
321 __le64 coord_hwaddr;
322 __le16 coord_shortaddr;
323};
324
325struct ieee802154_llsec_table {
326 struct list_head keys;
327 struct list_head devices;
328 struct list_head security_levels;
329};
226 330
227#define IEEE802154_MAC_SCAN_ED 0 331#define IEEE802154_MAC_SCAN_ED 0
228#define IEEE802154_MAC_SCAN_ACTIVE 1 332#define IEEE802154_MAC_SCAN_ACTIVE 1
@@ -242,6 +346,53 @@ struct ieee802154_mac_params {
242}; 346};
243 347
244struct wpan_phy; 348struct wpan_phy;
349
350enum {
351 IEEE802154_LLSEC_PARAM_ENABLED = 1 << 0,
352 IEEE802154_LLSEC_PARAM_FRAME_COUNTER = 1 << 1,
353 IEEE802154_LLSEC_PARAM_OUT_LEVEL = 1 << 2,
354 IEEE802154_LLSEC_PARAM_OUT_KEY = 1 << 3,
355 IEEE802154_LLSEC_PARAM_KEY_SOURCE = 1 << 4,
356 IEEE802154_LLSEC_PARAM_PAN_ID = 1 << 5,
357 IEEE802154_LLSEC_PARAM_HWADDR = 1 << 6,
358 IEEE802154_LLSEC_PARAM_COORD_HWADDR = 1 << 7,
359 IEEE802154_LLSEC_PARAM_COORD_SHORTADDR = 1 << 8,
360};
361
362struct ieee802154_llsec_ops {
363 int (*get_params)(struct net_device *dev,
364 struct ieee802154_llsec_params *params);
365 int (*set_params)(struct net_device *dev,
366 const struct ieee802154_llsec_params *params,
367 int changed);
368
369 int (*add_key)(struct net_device *dev,
370 const struct ieee802154_llsec_key_id *id,
371 const struct ieee802154_llsec_key *key);
372 int (*del_key)(struct net_device *dev,
373 const struct ieee802154_llsec_key_id *id);
374
375 int (*add_dev)(struct net_device *dev,
376 const struct ieee802154_llsec_device *llsec_dev);
377 int (*del_dev)(struct net_device *dev, __le64 dev_addr);
378
379 int (*add_devkey)(struct net_device *dev,
380 __le64 device_addr,
381 const struct ieee802154_llsec_device_key *key);
382 int (*del_devkey)(struct net_device *dev,
383 __le64 device_addr,
384 const struct ieee802154_llsec_device_key *key);
385
386 int (*add_seclevel)(struct net_device *dev,
387 const struct ieee802154_llsec_seclevel *sl);
388 int (*del_seclevel)(struct net_device *dev,
389 const struct ieee802154_llsec_seclevel *sl);
390
391 void (*lock_table)(struct net_device *dev);
392 void (*get_table)(struct net_device *dev,
393 struct ieee802154_llsec_table **t);
394 void (*unlock_table)(struct net_device *dev);
395};
245/* 396/*
246 * This should be located at net_device->ml_priv 397 * This should be located at net_device->ml_priv
247 * 398 *
@@ -272,6 +423,8 @@ struct ieee802154_mlme_ops {
272 void (*get_mac_params)(struct net_device *dev, 423 void (*get_mac_params)(struct net_device *dev,
273 struct ieee802154_mac_params *params); 424 struct ieee802154_mac_params *params);
274 425
426 struct ieee802154_llsec_ops *llsec;
427
275 /* The fields below are required. */ 428 /* The fields below are required. */
276 429
277 struct wpan_phy *(*get_phy)(const struct net_device *dev); 430 struct wpan_phy *(*get_phy)(const struct net_device *dev);
diff --git a/include/net/inet_ecn.h b/include/net/inet_ecn.h
index 3bd22795c3e2..84b20835b736 100644
--- a/include/net/inet_ecn.h
+++ b/include/net/inet_ecn.h
@@ -150,7 +150,7 @@ static inline int INET_ECN_set_ce(struct sk_buff *skb)
150} 150}
151 151
152/* 152/*
153 * RFC 6080 4.2 153 * RFC 6040 4.2
154 * To decapsulate the inner header at the tunnel egress, a compliant 154 * To decapsulate the inner header at the tunnel egress, a compliant
155 * tunnel egress MUST set the outgoing ECN field to the codepoint at the 155 * tunnel egress MUST set the outgoing ECN field to the codepoint at the
156 * intersection of the appropriate arriving inner header (row) and outer 156 * intersection of the appropriate arriving inner header (row) and outer
diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h
index 1bdb47715def..dd1950a7e273 100644
--- a/include/net/inet_hashtables.h
+++ b/include/net/inet_hashtables.h
@@ -292,12 +292,12 @@ static inline struct sock *inet_lookup_listener(struct net *net,
292#define INET_ADDR_COOKIE(__name, __saddr, __daddr) \ 292#define INET_ADDR_COOKIE(__name, __saddr, __daddr) \
293 const __addrpair __name = (__force __addrpair) ( \ 293 const __addrpair __name = (__force __addrpair) ( \
294 (((__force __u64)(__be32)(__saddr)) << 32) | \ 294 (((__force __u64)(__be32)(__saddr)) << 32) | \
295 ((__force __u64)(__be32)(__daddr))); 295 ((__force __u64)(__be32)(__daddr)))
296#else /* __LITTLE_ENDIAN */ 296#else /* __LITTLE_ENDIAN */
297#define INET_ADDR_COOKIE(__name, __saddr, __daddr) \ 297#define INET_ADDR_COOKIE(__name, __saddr, __daddr) \
298 const __addrpair __name = (__force __addrpair) ( \ 298 const __addrpair __name = (__force __addrpair) ( \
299 (((__force __u64)(__be32)(__daddr)) << 32) | \ 299 (((__force __u64)(__be32)(__daddr)) << 32) | \
300 ((__force __u64)(__be32)(__saddr))); 300 ((__force __u64)(__be32)(__saddr)))
301#endif /* __BIG_ENDIAN */ 301#endif /* __BIG_ENDIAN */
302#define INET_MATCH(__sk, __net, __cookie, __saddr, __daddr, __ports, __dif) \ 302#define INET_MATCH(__sk, __net, __cookie, __saddr, __daddr, __ports, __dif) \
303 (((__sk)->sk_portpair == (__ports)) && \ 303 (((__sk)->sk_portpair == (__ports)) && \
@@ -306,7 +306,9 @@ static inline struct sock *inet_lookup_listener(struct net *net,
306 ((__sk)->sk_bound_dev_if == (__dif))) && \ 306 ((__sk)->sk_bound_dev_if == (__dif))) && \
307 net_eq(sock_net(__sk), (__net))) 307 net_eq(sock_net(__sk), (__net)))
308#else /* 32-bit arch */ 308#else /* 32-bit arch */
309#define INET_ADDR_COOKIE(__name, __saddr, __daddr) 309#define INET_ADDR_COOKIE(__name, __saddr, __daddr) \
310 const int __name __deprecated __attribute__((unused))
311
310#define INET_MATCH(__sk, __net, __cookie, __saddr, __daddr, __ports, __dif) \ 312#define INET_MATCH(__sk, __net, __cookie, __saddr, __daddr, __ports, __dif) \
311 (((__sk)->sk_portpair == (__ports)) && \ 313 (((__sk)->sk_portpair == (__ports)) && \
312 ((__sk)->sk_daddr == (__saddr)) && \ 314 ((__sk)->sk_daddr == (__saddr)) && \
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h
index 1833c3f389ee..b1edf17bec01 100644
--- a/include/net/inet_sock.h
+++ b/include/net/inet_sock.h
@@ -90,6 +90,7 @@ struct inet_request_sock {
90 kmemcheck_bitfield_end(flags); 90 kmemcheck_bitfield_end(flags);
91 struct ip_options_rcu *opt; 91 struct ip_options_rcu *opt;
92 struct sk_buff *pktopts; 92 struct sk_buff *pktopts;
93 u32 ir_mark;
93}; 94};
94 95
95static inline struct inet_request_sock *inet_rsk(const struct request_sock *sk) 96static inline struct inet_request_sock *inet_rsk(const struct request_sock *sk)
@@ -97,6 +98,15 @@ static inline struct inet_request_sock *inet_rsk(const struct request_sock *sk)
97 return (struct inet_request_sock *)sk; 98 return (struct inet_request_sock *)sk;
98} 99}
99 100
101static inline u32 inet_request_mark(struct sock *sk, struct sk_buff *skb)
102{
103 if (!sk->sk_mark && sock_net(sk)->ipv4.sysctl_tcp_fwmark_accept) {
104 return skb->mark;
105 } else {
106 return sk->sk_mark;
107 }
108}
109
100struct inet_cork { 110struct inet_cork {
101 unsigned int flags; 111 unsigned int flags;
102 __be32 addr; 112 __be32 addr;
diff --git a/include/net/inetpeer.h b/include/net/inetpeer.h
index 6efe73c79c52..01d590ee5e7e 100644
--- a/include/net/inetpeer.h
+++ b/include/net/inetpeer.h
@@ -41,14 +41,13 @@ struct inet_peer {
41 struct rcu_head gc_rcu; 41 struct rcu_head gc_rcu;
42 }; 42 };
43 /* 43 /*
44 * Once inet_peer is queued for deletion (refcnt == -1), following fields 44 * Once inet_peer is queued for deletion (refcnt == -1), following field
45 * are not available: rid, ip_id_count 45 * is not available: rid
46 * We can share memory with rcu_head to help keep inet_peer small. 46 * We can share memory with rcu_head to help keep inet_peer small.
47 */ 47 */
48 union { 48 union {
49 struct { 49 struct {
50 atomic_t rid; /* Frag reception counter */ 50 atomic_t rid; /* Frag reception counter */
51 atomic_t ip_id_count; /* IP ID for the next packet */
52 }; 51 };
53 struct rcu_head rcu; 52 struct rcu_head rcu;
54 struct inet_peer *gc_next; 53 struct inet_peer *gc_next;
@@ -165,28 +164,11 @@ bool inet_peer_xrlim_allow(struct inet_peer *peer, int timeout);
165void inetpeer_invalidate_tree(struct inet_peer_base *); 164void inetpeer_invalidate_tree(struct inet_peer_base *);
166 165
167/* 166/*
168 * temporary check to make sure we dont access rid, ip_id_count, tcp_ts, 167 * temporary check to make sure we dont access rid, tcp_ts,
169 * tcp_ts_stamp if no refcount is taken on inet_peer 168 * tcp_ts_stamp if no refcount is taken on inet_peer
170 */ 169 */
171static inline void inet_peer_refcheck(const struct inet_peer *p) 170static inline void inet_peer_refcheck(const struct inet_peer *p)
172{ 171{
173 WARN_ON_ONCE(atomic_read(&p->refcnt) <= 0); 172 WARN_ON_ONCE(atomic_read(&p->refcnt) <= 0);
174} 173}
175
176
177/* can be called with or without local BH being disabled */
178static inline int inet_getid(struct inet_peer *p, int more)
179{
180 int old, new;
181 more++;
182 inet_peer_refcheck(p);
183 do {
184 old = atomic_read(&p->ip_id_count);
185 new = old + more;
186 if (!new)
187 new = 1;
188 } while (atomic_cmpxchg(&p->ip_id_count, old, new) != old);
189 return new;
190}
191
192#endif /* _NET_INETPEER_H */ 174#endif /* _NET_INETPEER_H */
diff --git a/include/net/ip.h b/include/net/ip.h
index 3ec2b0fb9d83..0e795df05ec9 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -196,35 +196,31 @@ void ip_send_unicast_reply(struct net *net, struct sk_buff *skb, __be32 daddr,
196#define NET_ADD_STATS_BH(net, field, adnd) SNMP_ADD_STATS_BH((net)->mib.net_statistics, field, adnd) 196#define NET_ADD_STATS_BH(net, field, adnd) SNMP_ADD_STATS_BH((net)->mib.net_statistics, field, adnd)
197#define NET_ADD_STATS_USER(net, field, adnd) SNMP_ADD_STATS_USER((net)->mib.net_statistics, field, adnd) 197#define NET_ADD_STATS_USER(net, field, adnd) SNMP_ADD_STATS_USER((net)->mib.net_statistics, field, adnd)
198 198
199unsigned long snmp_fold_field(void __percpu *mib[], int offt); 199unsigned long snmp_fold_field(void __percpu *mib, int offt);
200#if BITS_PER_LONG==32 200#if BITS_PER_LONG==32
201u64 snmp_fold_field64(void __percpu *mib[], int offt, size_t sync_off); 201u64 snmp_fold_field64(void __percpu *mib, int offt, size_t sync_off);
202#else 202#else
203static inline u64 snmp_fold_field64(void __percpu *mib[], int offt, size_t syncp_off) 203static inline u64 snmp_fold_field64(void __percpu *mib, int offt, size_t syncp_off)
204{ 204{
205 return snmp_fold_field(mib, offt); 205 return snmp_fold_field(mib, offt);
206} 206}
207#endif 207#endif
208int snmp_mib_init(void __percpu *ptr[2], size_t mibsize, size_t align);
209
210static inline void snmp_mib_free(void __percpu *ptr[SNMP_ARRAY_SZ])
211{
212 int i;
213
214 BUG_ON(ptr == NULL);
215 for (i = 0; i < SNMP_ARRAY_SZ; i++) {
216 free_percpu(ptr[i]);
217 ptr[i] = NULL;
218 }
219}
220 208
221void inet_get_local_port_range(struct net *net, int *low, int *high); 209void inet_get_local_port_range(struct net *net, int *low, int *high);
222 210
223extern unsigned long *sysctl_local_reserved_ports; 211#ifdef CONFIG_SYSCTL
224static inline int inet_is_reserved_local_port(int port) 212static inline int inet_is_local_reserved_port(struct net *net, int port)
225{ 213{
226 return test_bit(port, sysctl_local_reserved_ports); 214 if (!net->ipv4.sysctl_local_reserved_ports)
215 return 0;
216 return test_bit(port, net->ipv4.sysctl_local_reserved_ports);
227} 217}
218#else
219static inline int inet_is_local_reserved_port(struct net *net, int port)
220{
221 return 0;
222}
223#endif
228 224
229extern int sysctl_ip_nonlocal_bind; 225extern int sysctl_ip_nonlocal_bind;
230 226
@@ -243,6 +239,9 @@ void ipfrag_init(void);
243 239
244void ip_static_sysctl_init(void); 240void ip_static_sysctl_init(void);
245 241
242#define IP4_REPLY_MARK(net, mark) \
243 ((net)->ipv4.sysctl_fwmark_reflect ? (mark) : 0)
244
246static inline bool ip_is_fragment(const struct iphdr *iph) 245static inline bool ip_is_fragment(const struct iphdr *iph)
247{ 246{
248 return (iph->frag_off & htons(IP_MF | IP_OFFSET)) != 0; 247 return (iph->frag_off & htons(IP_MF | IP_OFFSET)) != 0;
@@ -281,7 +280,7 @@ static inline bool ip_sk_use_pmtu(const struct sock *sk)
281 return inet_sk(sk)->pmtudisc < IP_PMTUDISC_PROBE; 280 return inet_sk(sk)->pmtudisc < IP_PMTUDISC_PROBE;
282} 281}
283 282
284static inline bool ip_sk_local_df(const struct sock *sk) 283static inline bool ip_sk_ignore_df(const struct sock *sk)
285{ 284{
286 return inet_sk(sk)->pmtudisc < IP_PMTUDISC_DO || 285 return inet_sk(sk)->pmtudisc < IP_PMTUDISC_DO ||
287 inet_sk(sk)->pmtudisc == IP_PMTUDISC_OMIT; 286 inet_sk(sk)->pmtudisc == IP_PMTUDISC_OMIT;
@@ -310,36 +309,48 @@ static inline unsigned int ip_skb_dst_mtu(const struct sk_buff *skb)
310 } 309 }
311} 310}
312 311
313void __ip_select_ident(struct iphdr *iph, struct dst_entry *dst, int more); 312#define IP_IDENTS_SZ 2048u
313extern atomic_t *ip_idents;
314
315static inline u32 ip_idents_reserve(u32 hash, int segs)
316{
317 atomic_t *id_ptr = ip_idents + hash % IP_IDENTS_SZ;
318
319 return atomic_add_return(segs, id_ptr) - segs;
320}
321
322void __ip_select_ident(struct iphdr *iph, int segs);
314 323
315static inline void ip_select_ident(struct sk_buff *skb, struct dst_entry *dst, struct sock *sk) 324static inline void ip_select_ident_segs(struct sk_buff *skb, struct sock *sk, int segs)
316{ 325{
317 struct iphdr *iph = ip_hdr(skb); 326 struct iphdr *iph = ip_hdr(skb);
318 327
319 if ((iph->frag_off & htons(IP_DF)) && !skb->local_df) { 328 if ((iph->frag_off & htons(IP_DF)) && !skb->ignore_df) {
320 /* This is only to work around buggy Windows95/2000 329 /* This is only to work around buggy Windows95/2000
321 * VJ compression implementations. If the ID field 330 * VJ compression implementations. If the ID field
322 * does not change, they drop every other packet in 331 * does not change, they drop every other packet in
323 * a TCP stream using header compression. 332 * a TCP stream using header compression.
324 */ 333 */
325 iph->id = (sk && inet_sk(sk)->inet_daddr) ? 334 if (sk && inet_sk(sk)->inet_daddr) {
326 htons(inet_sk(sk)->inet_id++) : 0; 335 iph->id = htons(inet_sk(sk)->inet_id);
327 } else 336 inet_sk(sk)->inet_id += segs;
328 __ip_select_ident(iph, dst, 0); 337 } else {
338 iph->id = 0;
339 }
340 } else {
341 __ip_select_ident(iph, segs);
342 }
329} 343}
330 344
331static inline void ip_select_ident_more(struct sk_buff *skb, struct dst_entry *dst, struct sock *sk, int more) 345static inline void ip_select_ident(struct sk_buff *skb, struct sock *sk)
332{ 346{
333 struct iphdr *iph = ip_hdr(skb); 347 ip_select_ident_segs(skb, sk, 1);
348}
334 349
335 if ((iph->frag_off & htons(IP_DF)) && !skb->local_df) { 350static inline __wsum inet_compute_pseudo(struct sk_buff *skb, int proto)
336 if (sk && inet_sk(sk)->inet_daddr) { 351{
337 iph->id = htons(inet_sk(sk)->inet_id); 352 return csum_tcpudp_nofold(ip_hdr(skb)->saddr, ip_hdr(skb)->daddr,
338 inet_sk(sk)->inet_id += 1 + more; 353 skb->len, proto, 0);
339 } else
340 iph->id = 0;
341 } else
342 __ip_select_ident(iph, dst, more);
343} 354}
344 355
345/* 356/*
diff --git a/include/net/ip6_checksum.h b/include/net/ip6_checksum.h
index 9e3c540c1b11..55236cb71174 100644
--- a/include/net/ip6_checksum.h
+++ b/include/net/ip6_checksum.h
@@ -41,6 +41,13 @@ __sum16 csum_ipv6_magic(const struct in6_addr *saddr,
41 __wsum csum); 41 __wsum csum);
42#endif 42#endif
43 43
44static inline __wsum ip6_compute_pseudo(struct sk_buff *skb, int proto)
45{
46 return ~csum_unfold(csum_ipv6_magic(&ipv6_hdr(skb)->saddr,
47 &ipv6_hdr(skb)->daddr,
48 skb->len, proto, 0));
49}
50
44static __inline__ __sum16 tcp_v6_check(int len, 51static __inline__ __sum16 tcp_v6_check(int len,
45 const struct in6_addr *saddr, 52 const struct in6_addr *saddr,
46 const struct in6_addr *daddr, 53 const struct in6_addr *daddr,
@@ -75,5 +82,17 @@ static inline void tcp_v6_send_check(struct sock *sk, struct sk_buff *skb)
75} 82}
76#endif 83#endif
77 84
85static inline __sum16 udp_v6_check(int len,
86 const struct in6_addr *saddr,
87 const struct in6_addr *daddr,
88 __wsum base)
89{
90 return csum_ipv6_magic(saddr, daddr, len, IPPROTO_UDP, base);
91}
92
93void udp6_set_csum(bool nocheck, struct sk_buff *skb,
94 const struct in6_addr *saddr,
95 const struct in6_addr *daddr, int len);
96
78int udp6_csum_init(struct sk_buff *skb, struct udphdr *uh, int proto); 97int udp6_csum_init(struct sk_buff *skb, struct udphdr *uh, int proto);
79#endif 98#endif
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
index 6c4f5eac98e7..1d09b46c1e48 100644
--- a/include/net/ip6_route.h
+++ b/include/net/ip6_route.h
@@ -127,6 +127,7 @@ int rt6_dump_route(struct rt6_info *rt, void *p_arg);
127void rt6_ifdown(struct net *net, struct net_device *dev); 127void rt6_ifdown(struct net *net, struct net_device *dev);
128void rt6_mtu_change(struct net_device *dev, unsigned int mtu); 128void rt6_mtu_change(struct net_device *dev, unsigned int mtu);
129void rt6_remove_prefsrc(struct inet6_ifaddr *ifp); 129void rt6_remove_prefsrc(struct inet6_ifaddr *ifp);
130void rt6_clean_tohost(struct net *net, struct in6_addr *gateway);
130 131
131 132
132/* 133/*
@@ -185,7 +186,7 @@ static inline bool ip6_sk_accept_pmtu(const struct sock *sk)
185 inet6_sk(sk)->pmtudisc != IPV6_PMTUDISC_OMIT; 186 inet6_sk(sk)->pmtudisc != IPV6_PMTUDISC_OMIT;
186} 187}
187 188
188static inline bool ip6_sk_local_df(const struct sock *sk) 189static inline bool ip6_sk_ignore_df(const struct sock *sk)
189{ 190{
190 return inet6_sk(sk)->pmtudisc < IPV6_PMTUDISC_DO || 191 return inet6_sk(sk)->pmtudisc < IPV6_PMTUDISC_DO ||
191 inet6_sk(sk)->pmtudisc == IPV6_PMTUDISC_OMIT; 192 inet6_sk(sk)->pmtudisc == IPV6_PMTUDISC_OMIT;
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index 5679d927562b..624a8a54806d 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -1204,7 +1204,7 @@ static inline bool __ip_vs_conn_get(struct ip_vs_conn *cp)
1204/* put back the conn without restarting its timer */ 1204/* put back the conn without restarting its timer */
1205static inline void __ip_vs_conn_put(struct ip_vs_conn *cp) 1205static inline void __ip_vs_conn_put(struct ip_vs_conn *cp)
1206{ 1206{
1207 smp_mb__before_atomic_dec(); 1207 smp_mb__before_atomic();
1208 atomic_dec(&cp->refcnt); 1208 atomic_dec(&cp->refcnt);
1209} 1209}
1210void ip_vs_conn_put(struct ip_vs_conn *cp); 1210void ip_vs_conn_put(struct ip_vs_conn *cp);
@@ -1408,7 +1408,7 @@ static inline void ip_vs_dest_hold(struct ip_vs_dest *dest)
1408 1408
1409static inline void ip_vs_dest_put(struct ip_vs_dest *dest) 1409static inline void ip_vs_dest_put(struct ip_vs_dest *dest)
1410{ 1410{
1411 smp_mb__before_atomic_dec(); 1411 smp_mb__before_atomic();
1412 atomic_dec(&dest->refcnt); 1412 atomic_dec(&dest->refcnt);
1413} 1413}
1414 1414
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index d640925bc454..574337fe72dd 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -113,6 +113,9 @@ struct frag_hdr {
113#define IP6_MF 0x0001 113#define IP6_MF 0x0001
114#define IP6_OFFSET 0xFFF8 114#define IP6_OFFSET 0xFFF8
115 115
116#define IP6_REPLY_MARK(net, mark) \
117 ((net)->ipv6.sysctl.fwmark_reflect ? (mark) : 0)
118
116#include <net/sock.h> 119#include <net/sock.h>
117 120
118/* sysctls */ 121/* sysctls */
@@ -583,6 +586,11 @@ static inline bool ipv6_addr_orchid(const struct in6_addr *a)
583 return (a->s6_addr32[0] & htonl(0xfffffff0)) == htonl(0x20010010); 586 return (a->s6_addr32[0] & htonl(0xfffffff0)) == htonl(0x20010010);
584} 587}
585 588
589static inline bool ipv6_addr_is_multicast(const struct in6_addr *addr)
590{
591 return (addr->s6_addr32[0] & htonl(0xFF000000)) == htonl(0xFF000000);
592}
593
586static inline void ipv6_addr_set_v4mapped(const __be32 addr, 594static inline void ipv6_addr_set_v4mapped(const __be32 addr,
587 struct in6_addr *v4mapped) 595 struct in6_addr *v4mapped)
588{ 596{
@@ -660,10 +668,22 @@ static inline int ipv6_addr_diff(const struct in6_addr *a1, const struct in6_add
660 return __ipv6_addr_diff(a1, a2, sizeof(struct in6_addr)); 668 return __ipv6_addr_diff(a1, a2, sizeof(struct in6_addr));
661} 669}
662 670
663void ipv6_select_ident(struct frag_hdr *fhdr, struct rt6_info *rt);
664
665int ip6_dst_hoplimit(struct dst_entry *dst); 671int ip6_dst_hoplimit(struct dst_entry *dst);
666 672
673static inline int ip6_sk_dst_hoplimit(struct ipv6_pinfo *np, struct flowi6 *fl6,
674 struct dst_entry *dst)
675{
676 int hlimit;
677
678 if (ipv6_addr_is_multicast(&fl6->daddr))
679 hlimit = np->mcast_hops;
680 else
681 hlimit = np->hop_limit;
682 if (hlimit < 0)
683 hlimit = ip6_dst_hoplimit(dst);
684 return hlimit;
685}
686
667/* 687/*
668 * Header manipulation 688 * Header manipulation
669 */ 689 */
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 8248e3909fdf..421b6ecb4b2c 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -189,6 +189,43 @@ struct ieee80211_chanctx_conf {
189}; 189};
190 190
191/** 191/**
192 * enum ieee80211_chanctx_switch_mode - channel context switch mode
193 * @CHANCTX_SWMODE_REASSIGN_VIF: Both old and new contexts already
194 * exist (and will continue to exist), but the virtual interface
195 * needs to be switched from one to the other.
196 * @CHANCTX_SWMODE_SWAP_CONTEXTS: The old context exists but will stop
197 * to exist with this call, the new context doesn't exist but
198 * will be active after this call, the virtual interface switches
199 * from the old to the new (note that the driver may of course
200 * implement this as an on-the-fly chandef switch of the existing
201 * hardware context, but the mac80211 pointer for the old context
202 * will cease to exist and only the new one will later be used
203 * for changes/removal.)
204 */
205enum ieee80211_chanctx_switch_mode {
206 CHANCTX_SWMODE_REASSIGN_VIF,
207 CHANCTX_SWMODE_SWAP_CONTEXTS,
208};
209
210/**
211 * struct ieee80211_vif_chanctx_switch - vif chanctx switch information
212 *
213 * This is structure is used to pass information about a vif that
214 * needs to switch from one chanctx to another. The
215 * &ieee80211_chanctx_switch_mode defines how the switch should be
216 * done.
217 *
218 * @vif: the vif that should be switched from old_ctx to new_ctx
219 * @old_ctx: the old context to which the vif was assigned
220 * @new_ctx: the new context to which the vif must be assigned
221 */
222struct ieee80211_vif_chanctx_switch {
223 struct ieee80211_vif *vif;
224 struct ieee80211_chanctx_conf *old_ctx;
225 struct ieee80211_chanctx_conf *new_ctx;
226};
227
228/**
192 * enum ieee80211_bss_change - BSS change notification flags 229 * enum ieee80211_bss_change - BSS change notification flags
193 * 230 *
194 * These flags are used with the bss_info_changed() callback 231 * These flags are used with the bss_info_changed() callback
@@ -1113,7 +1150,9 @@ enum ieee80211_vif_flags {
1113 * @addr: address of this interface 1150 * @addr: address of this interface
1114 * @p2p: indicates whether this AP or STA interface is a p2p 1151 * @p2p: indicates whether this AP or STA interface is a p2p
1115 * interface, i.e. a GO or p2p-sta respectively 1152 * interface, i.e. a GO or p2p-sta respectively
1116 * @csa_active: marks whether a channel switch is going on 1153 * @csa_active: marks whether a channel switch is going on. Internally it is
1154 * write-protected by sdata_lock and local->mtx so holding either is fine
1155 * for read access.
1117 * @driver_flags: flags/capabilities the driver has for this interface, 1156 * @driver_flags: flags/capabilities the driver has for this interface,
1118 * these need to be set (or cleared) when the interface is added 1157 * these need to be set (or cleared) when the interface is added
1119 * or, if supported by the driver, the interface type is changed 1158 * or, if supported by the driver, the interface type is changed
@@ -1202,14 +1241,18 @@ struct ieee80211_vif *wdev_to_ieee80211_vif(struct wireless_dev *wdev);
1202 * fall back to software crypto. Note that this flag deals only with 1241 * fall back to software crypto. Note that this flag deals only with
1203 * RX, if your crypto engine can't deal with TX you can also set the 1242 * RX, if your crypto engine can't deal with TX you can also set the
1204 * %IEEE80211_KEY_FLAG_SW_MGMT_TX flag to encrypt such frames in SW. 1243 * %IEEE80211_KEY_FLAG_SW_MGMT_TX flag to encrypt such frames in SW.
1244 * @IEEE80211_KEY_FLAG_GENERATE_IV_MGMT: This flag should be set by the
1245 * driver for a CCMP key to indicate that is requires IV generation
1246 * only for managment frames (MFP).
1205 */ 1247 */
1206enum ieee80211_key_flags { 1248enum ieee80211_key_flags {
1207 IEEE80211_KEY_FLAG_GENERATE_IV = 1<<1, 1249 IEEE80211_KEY_FLAG_GENERATE_IV_MGMT = BIT(0),
1208 IEEE80211_KEY_FLAG_GENERATE_MMIC= 1<<2, 1250 IEEE80211_KEY_FLAG_GENERATE_IV = BIT(1),
1209 IEEE80211_KEY_FLAG_PAIRWISE = 1<<3, 1251 IEEE80211_KEY_FLAG_GENERATE_MMIC = BIT(2),
1210 IEEE80211_KEY_FLAG_SW_MGMT_TX = 1<<4, 1252 IEEE80211_KEY_FLAG_PAIRWISE = BIT(3),
1211 IEEE80211_KEY_FLAG_PUT_IV_SPACE = 1<<5, 1253 IEEE80211_KEY_FLAG_SW_MGMT_TX = BIT(4),
1212 IEEE80211_KEY_FLAG_RX_MGMT = 1<<6, 1254 IEEE80211_KEY_FLAG_PUT_IV_SPACE = BIT(5),
1255 IEEE80211_KEY_FLAG_RX_MGMT = BIT(6),
1213}; 1256};
1214 1257
1215/** 1258/**
@@ -1370,6 +1413,7 @@ struct ieee80211_sta_rates {
1370 * the station moves to associated state. 1413 * the station moves to associated state.
1371 * @smps_mode: current SMPS mode (off, static or dynamic) 1414 * @smps_mode: current SMPS mode (off, static or dynamic)
1372 * @rates: rate control selection table 1415 * @rates: rate control selection table
1416 * @tdls: indicates whether the STA is a TDLS peer
1373 */ 1417 */
1374struct ieee80211_sta { 1418struct ieee80211_sta {
1375 u32 supp_rates[IEEE80211_NUM_BANDS]; 1419 u32 supp_rates[IEEE80211_NUM_BANDS];
@@ -1384,6 +1428,7 @@ struct ieee80211_sta {
1384 enum ieee80211_sta_rx_bandwidth bandwidth; 1428 enum ieee80211_sta_rx_bandwidth bandwidth;
1385 enum ieee80211_smps_mode smps_mode; 1429 enum ieee80211_smps_mode smps_mode;
1386 struct ieee80211_sta_rates __rcu *rates; 1430 struct ieee80211_sta_rates __rcu *rates;
1431 bool tdls;
1387 1432
1388 /* must be last */ 1433 /* must be last */
1389 u8 drv_priv[0] __aligned(sizeof(void *)); 1434 u8 drv_priv[0] __aligned(sizeof(void *));
@@ -1555,6 +1600,12 @@ struct ieee80211_tx_control {
1555 * for a single active channel while using channel contexts. When support 1600 * for a single active channel while using channel contexts. When support
1556 * is not enabled the default action is to disconnect when getting the 1601 * is not enabled the default action is to disconnect when getting the
1557 * CSA frame. 1602 * CSA frame.
1603 *
1604 * @IEEE80211_HW_CHANGE_RUNNING_CHANCTX: The hardware can change a
1605 * channel context on-the-fly. This is needed for channel switch
1606 * on single-channel hardware. It can also be used as an
1607 * optimization in certain channel switch cases with
1608 * multi-channel.
1558 */ 1609 */
1559enum ieee80211_hw_flags { 1610enum ieee80211_hw_flags {
1560 IEEE80211_HW_HAS_RATE_CONTROL = 1<<0, 1611 IEEE80211_HW_HAS_RATE_CONTROL = 1<<0,
@@ -1586,6 +1637,7 @@ enum ieee80211_hw_flags {
1586 IEEE80211_HW_TIMING_BEACON_ONLY = 1<<26, 1637 IEEE80211_HW_TIMING_BEACON_ONLY = 1<<26,
1587 IEEE80211_HW_SUPPORTS_HT_CCK_RATES = 1<<27, 1638 IEEE80211_HW_SUPPORTS_HT_CCK_RATES = 1<<27,
1588 IEEE80211_HW_CHANCTX_STA_CSA = 1<<28, 1639 IEEE80211_HW_CHANCTX_STA_CSA = 1<<28,
1640 IEEE80211_HW_CHANGE_RUNNING_CHANCTX = 1<<29,
1589}; 1641};
1590 1642
1591/** 1643/**
@@ -2609,6 +2661,7 @@ enum ieee80211_roc_type {
2609 * of queues to flush, which is useful if different virtual interfaces 2661 * of queues to flush, which is useful if different virtual interfaces
2610 * use different hardware queues; it may also indicate all queues. 2662 * use different hardware queues; it may also indicate all queues.
2611 * If the parameter @drop is set to %true, pending frames may be dropped. 2663 * If the parameter @drop is set to %true, pending frames may be dropped.
2664 * Note that vif can be NULL.
2612 * The callback can sleep. 2665 * The callback can sleep.
2613 * 2666 *
2614 * @channel_switch: Drivers that need (or want) to offload the channel 2667 * @channel_switch: Drivers that need (or want) to offload the channel
@@ -2720,6 +2773,11 @@ enum ieee80211_roc_type {
2720 * to vif. Possible use is for hw queue remapping. 2773 * to vif. Possible use is for hw queue remapping.
2721 * @unassign_vif_chanctx: Notifies device driver about channel context being 2774 * @unassign_vif_chanctx: Notifies device driver about channel context being
2722 * unbound from vif. 2775 * unbound from vif.
2776 * @switch_vif_chanctx: switch a number of vifs from one chanctx to
2777 * another, as specified in the list of
2778 * @ieee80211_vif_chanctx_switch passed to the driver, according
2779 * to the mode defined in &ieee80211_chanctx_switch_mode.
2780 *
2723 * @start_ap: Start operation on the AP interface, this is called after all the 2781 * @start_ap: Start operation on the AP interface, this is called after all the
2724 * information in bss_conf is set and beacon can be retrieved. A channel 2782 * information in bss_conf is set and beacon can be retrieved. A channel
2725 * context is bound before this is called. Note that if the driver uses 2783 * context is bound before this is called. Note that if the driver uses
@@ -2753,6 +2811,10 @@ enum ieee80211_roc_type {
2753 * information in bss_conf is set up and the beacon can be retrieved. A 2811 * information in bss_conf is set up and the beacon can be retrieved. A
2754 * channel context is bound before this is called. 2812 * channel context is bound before this is called.
2755 * @leave_ibss: Leave the IBSS again. 2813 * @leave_ibss: Leave the IBSS again.
2814 *
2815 * @get_expected_throughput: extract the expected throughput towards the
2816 * specified station. The returned value is expressed in Kbps. It returns 0
2817 * if the RC algorithm does not have proper data to provide.
2756 */ 2818 */
2757struct ieee80211_ops { 2819struct ieee80211_ops {
2758 void (*tx)(struct ieee80211_hw *hw, 2820 void (*tx)(struct ieee80211_hw *hw,
@@ -2871,7 +2933,8 @@ struct ieee80211_ops {
2871 struct netlink_callback *cb, 2933 struct netlink_callback *cb,
2872 void *data, int len); 2934 void *data, int len);
2873#endif 2935#endif
2874 void (*flush)(struct ieee80211_hw *hw, u32 queues, bool drop); 2936 void (*flush)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
2937 u32 queues, bool drop);
2875 void (*channel_switch)(struct ieee80211_hw *hw, 2938 void (*channel_switch)(struct ieee80211_hw *hw,
2876 struct ieee80211_channel_switch *ch_switch); 2939 struct ieee80211_channel_switch *ch_switch);
2877 int (*set_antenna)(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant); 2940 int (*set_antenna)(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant);
@@ -2931,6 +2994,10 @@ struct ieee80211_ops {
2931 void (*unassign_vif_chanctx)(struct ieee80211_hw *hw, 2994 void (*unassign_vif_chanctx)(struct ieee80211_hw *hw,
2932 struct ieee80211_vif *vif, 2995 struct ieee80211_vif *vif,
2933 struct ieee80211_chanctx_conf *ctx); 2996 struct ieee80211_chanctx_conf *ctx);
2997 int (*switch_vif_chanctx)(struct ieee80211_hw *hw,
2998 struct ieee80211_vif_chanctx_switch *vifs,
2999 int n_vifs,
3000 enum ieee80211_chanctx_switch_mode mode);
2934 3001
2935 void (*restart_complete)(struct ieee80211_hw *hw); 3002 void (*restart_complete)(struct ieee80211_hw *hw);
2936 3003
@@ -2945,6 +3012,7 @@ struct ieee80211_ops {
2945 3012
2946 int (*join_ibss)(struct ieee80211_hw *hw, struct ieee80211_vif *vif); 3013 int (*join_ibss)(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
2947 void (*leave_ibss)(struct ieee80211_hw *hw, struct ieee80211_vif *vif); 3014 void (*leave_ibss)(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
3015 u32 (*get_expected_throughput)(struct ieee80211_sta *sta);
2948}; 3016};
2949 3017
2950/** 3018/**
@@ -3394,6 +3462,47 @@ void ieee80211_tx_status_irqsafe(struct ieee80211_hw *hw,
3394 */ 3462 */
3395void ieee80211_report_low_ack(struct ieee80211_sta *sta, u32 num_packets); 3463void ieee80211_report_low_ack(struct ieee80211_sta *sta, u32 num_packets);
3396 3464
3465#define IEEE80211_MAX_CSA_COUNTERS_NUM 2
3466
3467/**
3468 * struct ieee80211_mutable_offsets - mutable beacon offsets
3469 * @tim_offset: position of TIM element
3470 * @tim_length: size of TIM element
3471 * @csa_counter_offs: array of IEEE80211_MAX_CSA_COUNTERS_NUM offsets
3472 * to CSA counters. This array can contain zero values which
3473 * should be ignored.
3474 */
3475struct ieee80211_mutable_offsets {
3476 u16 tim_offset;
3477 u16 tim_length;
3478
3479 u16 csa_counter_offs[IEEE80211_MAX_CSA_COUNTERS_NUM];
3480};
3481
3482/**
3483 * ieee80211_beacon_get_template - beacon template generation function
3484 * @hw: pointer obtained from ieee80211_alloc_hw().
3485 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
3486 * @offs: &struct ieee80211_mutable_offsets pointer to struct that will
3487 * receive the offsets that may be updated by the driver.
3488 *
3489 * If the driver implements beaconing modes, it must use this function to
3490 * obtain the beacon template.
3491 *
3492 * This function should be used if the beacon frames are generated by the
3493 * device, and then the driver must use the returned beacon as the template
3494 * The driver or the device are responsible to update the DTIM and, when
3495 * applicable, the CSA count.
3496 *
3497 * The driver is responsible for freeing the returned skb.
3498 *
3499 * Return: The beacon template. %NULL on error.
3500 */
3501struct sk_buff *
3502ieee80211_beacon_get_template(struct ieee80211_hw *hw,
3503 struct ieee80211_vif *vif,
3504 struct ieee80211_mutable_offsets *offs);
3505
3397/** 3506/**
3398 * ieee80211_beacon_get_tim - beacon generation function 3507 * ieee80211_beacon_get_tim - beacon generation function
3399 * @hw: pointer obtained from ieee80211_alloc_hw(). 3508 * @hw: pointer obtained from ieee80211_alloc_hw().
@@ -3405,16 +3514,12 @@ void ieee80211_report_low_ack(struct ieee80211_sta *sta, u32 num_packets);
3405 * Set to 0 if invalid (in non-AP modes). 3514 * Set to 0 if invalid (in non-AP modes).
3406 * 3515 *
3407 * If the driver implements beaconing modes, it must use this function to 3516 * If the driver implements beaconing modes, it must use this function to
3408 * obtain the beacon frame/template. 3517 * obtain the beacon frame.
3409 * 3518 *
3410 * If the beacon frames are generated by the host system (i.e., not in 3519 * If the beacon frames are generated by the host system (i.e., not in
3411 * hardware/firmware), the driver uses this function to get each beacon 3520 * hardware/firmware), the driver uses this function to get each beacon
3412 * frame from mac80211 -- it is responsible for calling this function 3521 * frame from mac80211 -- it is responsible for calling this function exactly
3413 * before the beacon is needed (e.g. based on hardware interrupt). 3522 * once before the beacon is needed (e.g. based on hardware interrupt).
3414 *
3415 * If the beacon frames are generated by the device, then the driver
3416 * must use the returned beacon as the template and change the TIM IE
3417 * according to the current DTIM parameters/TIM bitmap.
3418 * 3523 *
3419 * The driver is responsible for freeing the returned skb. 3524 * The driver is responsible for freeing the returned skb.
3420 * 3525 *
@@ -3440,6 +3545,20 @@ static inline struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw,
3440} 3545}
3441 3546
3442/** 3547/**
3548 * ieee80211_csa_update_counter - request mac80211 to decrement the csa counter
3549 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
3550 *
3551 * The csa counter should be updated after each beacon transmission.
3552 * This function is called implicitly when
3553 * ieee80211_beacon_get/ieee80211_beacon_get_tim are called, however if the
3554 * beacon frames are generated by the device, the driver should call this
3555 * function after each beacon transmission to sync mac80211's csa counters.
3556 *
3557 * Return: new csa counter value
3558 */
3559u8 ieee80211_csa_update_counter(struct ieee80211_vif *vif);
3560
3561/**
3443 * ieee80211_csa_finish - notify mac80211 about channel switch 3562 * ieee80211_csa_finish - notify mac80211 about channel switch
3444 * @vif: &struct ieee80211_vif pointer from the add_interface callback. 3563 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
3445 * 3564 *
@@ -4467,6 +4586,8 @@ struct rate_control_ops {
4467 void (*add_sta_debugfs)(void *priv, void *priv_sta, 4586 void (*add_sta_debugfs)(void *priv, void *priv_sta,
4468 struct dentry *dir); 4587 struct dentry *dir);
4469 void (*remove_sta_debugfs)(void *priv, void *priv_sta); 4588 void (*remove_sta_debugfs)(void *priv, void *priv_sta);
4589
4590 u32 (*get_expected_throughput)(void *priv_sta);
4470}; 4591};
4471 4592
4472static inline int rate_supported(struct ieee80211_sta *sta, 4593static inline int rate_supported(struct ieee80211_sta *sta,
@@ -4576,7 +4697,9 @@ conf_is_ht40(struct ieee80211_conf *conf)
4576static inline bool 4697static inline bool
4577conf_is_ht(struct ieee80211_conf *conf) 4698conf_is_ht(struct ieee80211_conf *conf)
4578{ 4699{
4579 return conf->chandef.width != NL80211_CHAN_WIDTH_20_NOHT; 4700 return (conf->chandef.width != NL80211_CHAN_WIDTH_5) &&
4701 (conf->chandef.width != NL80211_CHAN_WIDTH_10) &&
4702 (conf->chandef.width != NL80211_CHAN_WIDTH_20_NOHT);
4580} 4703}
4581 4704
4582static inline enum nl80211_iftype 4705static inline enum nl80211_iftype
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index 5f9eb260990f..361d26077196 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -373,6 +373,14 @@ static inline void rt_genid_bump_ipv6(struct net *net)
373} 373}
374#endif 374#endif
375 375
376#if IS_ENABLED(CONFIG_IEEE802154_6LOWPAN)
377static inline struct netns_ieee802154_lowpan *
378net_ieee802154_lowpan(struct net *net)
379{
380 return &net->ieee802154_lowpan;
381}
382#endif
383
376/* For callers who don't really care about whether it's IPv4 or IPv6 */ 384/* For callers who don't really care about whether it's IPv4 or IPv6 */
377static inline void rt_genid_bump_all(struct net *net) 385static inline void rt_genid_bump_all(struct net *net)
378{ 386{
diff --git a/include/net/netfilter/nf_nat.h b/include/net/netfilter/nf_nat.h
index 07eaaf604092..a71dd333ac68 100644
--- a/include/net/netfilter/nf_nat.h
+++ b/include/net/netfilter/nf_nat.h
@@ -48,6 +48,8 @@ unsigned int nf_nat_setup_info(struct nf_conn *ct,
48extern unsigned int nf_nat_alloc_null_binding(struct nf_conn *ct, 48extern unsigned int nf_nat_alloc_null_binding(struct nf_conn *ct,
49 unsigned int hooknum); 49 unsigned int hooknum);
50 50
51struct nf_conn_nat *nf_ct_nat_ext_add(struct nf_conn *ct);
52
51/* Is this tuple already taken? (not by us)*/ 53/* Is this tuple already taken? (not by us)*/
52int nf_nat_used_tuple(const struct nf_conntrack_tuple *tuple, 54int nf_nat_used_tuple(const struct nf_conntrack_tuple *tuple,
53 const struct nf_conn *ignored_conntrack); 55 const struct nf_conn *ignored_conntrack);
diff --git a/include/net/netfilter/nf_tables.h b/include/net/netfilter/nf_tables.h
index e6bc14d8fa9a..713b0b88bd5a 100644
--- a/include/net/netfilter/nf_tables.h
+++ b/include/net/netfilter/nf_tables.h
@@ -72,21 +72,23 @@ static inline void nft_data_debug(const struct nft_data *data)
72 * struct nft_ctx - nf_tables rule/set context 72 * struct nft_ctx - nf_tables rule/set context
73 * 73 *
74 * @net: net namespace 74 * @net: net namespace
75 * @skb: netlink skb
76 * @nlh: netlink message header
77 * @afi: address family info 75 * @afi: address family info
78 * @table: the table the chain is contained in 76 * @table: the table the chain is contained in
79 * @chain: the chain the rule is contained in 77 * @chain: the chain the rule is contained in
80 * @nla: netlink attributes 78 * @nla: netlink attributes
79 * @portid: netlink portID of the original message
80 * @seq: netlink sequence number
81 * @report: notify via unicast netlink message
81 */ 82 */
82struct nft_ctx { 83struct nft_ctx {
83 struct net *net; 84 struct net *net;
84 const struct sk_buff *skb; 85 struct nft_af_info *afi;
85 const struct nlmsghdr *nlh; 86 struct nft_table *table;
86 const struct nft_af_info *afi; 87 struct nft_chain *chain;
87 const struct nft_table *table;
88 const struct nft_chain *chain;
89 const struct nlattr * const *nla; 88 const struct nlattr * const *nla;
89 u32 portid;
90 u32 seq;
91 bool report;
90}; 92};
91 93
92struct nft_data_desc { 94struct nft_data_desc {
@@ -146,6 +148,44 @@ struct nft_set_iter {
146}; 148};
147 149
148/** 150/**
151 * struct nft_set_desc - description of set elements
152 *
153 * @klen: key length
154 * @dlen: data length
155 * @size: number of set elements
156 */
157struct nft_set_desc {
158 unsigned int klen;
159 unsigned int dlen;
160 unsigned int size;
161};
162
163/**
164 * enum nft_set_class - performance class
165 *
166 * @NFT_LOOKUP_O_1: constant, O(1)
167 * @NFT_LOOKUP_O_LOG_N: logarithmic, O(log N)
168 * @NFT_LOOKUP_O_N: linear, O(N)
169 */
170enum nft_set_class {
171 NFT_SET_CLASS_O_1,
172 NFT_SET_CLASS_O_LOG_N,
173 NFT_SET_CLASS_O_N,
174};
175
176/**
177 * struct nft_set_estimate - estimation of memory and performance
178 * characteristics
179 *
180 * @size: required memory
181 * @class: lookup performance class
182 */
183struct nft_set_estimate {
184 unsigned int size;
185 enum nft_set_class class;
186};
187
188/**
149 * struct nft_set_ops - nf_tables set operations 189 * struct nft_set_ops - nf_tables set operations
150 * 190 *
151 * @lookup: look up an element within the set 191 * @lookup: look up an element within the set
@@ -174,7 +214,11 @@ struct nft_set_ops {
174 struct nft_set_iter *iter); 214 struct nft_set_iter *iter);
175 215
176 unsigned int (*privsize)(const struct nlattr * const nla[]); 216 unsigned int (*privsize)(const struct nlattr * const nla[]);
217 bool (*estimate)(const struct nft_set_desc *desc,
218 u32 features,
219 struct nft_set_estimate *est);
177 int (*init)(const struct nft_set *set, 220 int (*init)(const struct nft_set *set,
221 const struct nft_set_desc *desc,
178 const struct nlattr * const nla[]); 222 const struct nlattr * const nla[]);
179 void (*destroy)(const struct nft_set *set); 223 void (*destroy)(const struct nft_set *set);
180 224
@@ -194,6 +238,8 @@ void nft_unregister_set(struct nft_set_ops *ops);
194 * @name: name of the set 238 * @name: name of the set
195 * @ktype: key type (numeric type defined by userspace, not used in the kernel) 239 * @ktype: key type (numeric type defined by userspace, not used in the kernel)
196 * @dtype: data type (verdict or numeric type defined by userspace) 240 * @dtype: data type (verdict or numeric type defined by userspace)
241 * @size: maximum set size
242 * @nelems: number of elements
197 * @ops: set ops 243 * @ops: set ops
198 * @flags: set flags 244 * @flags: set flags
199 * @klen: key length 245 * @klen: key length
@@ -206,6 +252,8 @@ struct nft_set {
206 char name[IFNAMSIZ]; 252 char name[IFNAMSIZ];
207 u32 ktype; 253 u32 ktype;
208 u32 dtype; 254 u32 dtype;
255 u32 size;
256 u32 nelems;
209 /* runtime data below here */ 257 /* runtime data below here */
210 const struct nft_set_ops *ops ____cacheline_aligned; 258 const struct nft_set_ops *ops ____cacheline_aligned;
211 u16 flags; 259 u16 flags;
@@ -222,6 +270,8 @@ static inline void *nft_set_priv(const struct nft_set *set)
222 270
223struct nft_set *nf_tables_set_lookup(const struct nft_table *table, 271struct nft_set *nf_tables_set_lookup(const struct nft_table *table,
224 const struct nlattr *nla); 272 const struct nlattr *nla);
273struct nft_set *nf_tables_set_lookup_byid(const struct net *net,
274 const struct nlattr *nla);
225 275
226/** 276/**
227 * struct nft_set_binding - nf_tables set binding 277 * struct nft_set_binding - nf_tables set binding
@@ -341,18 +391,75 @@ struct nft_rule {
341}; 391};
342 392
343/** 393/**
344 * struct nft_rule_trans - nf_tables rule update in transaction 394 * struct nft_trans - nf_tables object update in transaction
345 * 395 *
396 * @rcu_head: rcu head to defer release of transaction data
346 * @list: used internally 397 * @list: used internally
347 * @ctx: rule context 398 * @msg_type: message type
348 * @rule: rule that needs to be updated 399 * @ctx: transaction context
400 * @data: internal information related to the transaction
349 */ 401 */
350struct nft_rule_trans { 402struct nft_trans {
403 struct rcu_head rcu_head;
351 struct list_head list; 404 struct list_head list;
405 int msg_type;
352 struct nft_ctx ctx; 406 struct nft_ctx ctx;
407 char data[0];
408};
409
410struct nft_trans_rule {
353 struct nft_rule *rule; 411 struct nft_rule *rule;
354}; 412};
355 413
414#define nft_trans_rule(trans) \
415 (((struct nft_trans_rule *)trans->data)->rule)
416
417struct nft_trans_set {
418 struct nft_set *set;
419 u32 set_id;
420};
421
422#define nft_trans_set(trans) \
423 (((struct nft_trans_set *)trans->data)->set)
424#define nft_trans_set_id(trans) \
425 (((struct nft_trans_set *)trans->data)->set_id)
426
427struct nft_trans_chain {
428 bool update;
429 char name[NFT_CHAIN_MAXNAMELEN];
430 struct nft_stats __percpu *stats;
431 u8 policy;
432};
433
434#define nft_trans_chain_update(trans) \
435 (((struct nft_trans_chain *)trans->data)->update)
436#define nft_trans_chain_name(trans) \
437 (((struct nft_trans_chain *)trans->data)->name)
438#define nft_trans_chain_stats(trans) \
439 (((struct nft_trans_chain *)trans->data)->stats)
440#define nft_trans_chain_policy(trans) \
441 (((struct nft_trans_chain *)trans->data)->policy)
442
443struct nft_trans_table {
444 bool update;
445 bool enable;
446};
447
448#define nft_trans_table_update(trans) \
449 (((struct nft_trans_table *)trans->data)->update)
450#define nft_trans_table_enable(trans) \
451 (((struct nft_trans_table *)trans->data)->enable)
452
453struct nft_trans_elem {
454 struct nft_set *set;
455 struct nft_set_elem elem;
456};
457
458#define nft_trans_elem_set(trans) \
459 (((struct nft_trans_elem *)trans->data)->set)
460#define nft_trans_elem(trans) \
461 (((struct nft_trans_elem *)trans->data)->elem)
462
356static inline struct nft_expr *nft_expr_first(const struct nft_rule *rule) 463static inline struct nft_expr *nft_expr_first(const struct nft_rule *rule)
357{ 464{
358 return (struct nft_expr *)&rule->data[0]; 465 return (struct nft_expr *)&rule->data[0];
@@ -385,6 +492,7 @@ static inline void *nft_userdata(const struct nft_rule *rule)
385 492
386enum nft_chain_flags { 493enum nft_chain_flags {
387 NFT_BASE_CHAIN = 0x1, 494 NFT_BASE_CHAIN = 0x1,
495 NFT_CHAIN_INACTIVE = 0x2,
388}; 496};
389 497
390/** 498/**
@@ -395,9 +503,9 @@ enum nft_chain_flags {
395 * @net: net namespace that this chain belongs to 503 * @net: net namespace that this chain belongs to
396 * @table: table that this chain belongs to 504 * @table: table that this chain belongs to
397 * @handle: chain handle 505 * @handle: chain handle
398 * @flags: bitmask of enum nft_chain_flags
399 * @use: number of jump references to this chain 506 * @use: number of jump references to this chain
400 * @level: length of longest path to this chain 507 * @level: length of longest path to this chain
508 * @flags: bitmask of enum nft_chain_flags
401 * @name: name of the chain 509 * @name: name of the chain
402 */ 510 */
403struct nft_chain { 511struct nft_chain {
@@ -406,9 +514,9 @@ struct nft_chain {
406 struct net *net; 514 struct net *net;
407 struct nft_table *table; 515 struct nft_table *table;
408 u64 handle; 516 u64 handle;
409 u8 flags; 517 u32 use;
410 u16 use;
411 u16 level; 518 u16 level;
519 u8 flags;
412 char name[NFT_CHAIN_MAXNAMELEN]; 520 char name[NFT_CHAIN_MAXNAMELEN];
413}; 521};
414 522
diff --git a/include/net/netfilter/nft_meta.h b/include/net/netfilter/nft_meta.h
new file mode 100644
index 000000000000..0ee47c3e2e31
--- /dev/null
+++ b/include/net/netfilter/nft_meta.h
@@ -0,0 +1,36 @@
1#ifndef _NFT_META_H_
2#define _NFT_META_H_
3
4struct nft_meta {
5 enum nft_meta_keys key:8;
6 union {
7 enum nft_registers dreg:8;
8 enum nft_registers sreg:8;
9 };
10};
11
12extern const struct nla_policy nft_meta_policy[];
13
14int nft_meta_get_init(const struct nft_ctx *ctx,
15 const struct nft_expr *expr,
16 const struct nlattr * const tb[]);
17
18int nft_meta_set_init(const struct nft_ctx *ctx,
19 const struct nft_expr *expr,
20 const struct nlattr * const tb[]);
21
22int nft_meta_get_dump(struct sk_buff *skb,
23 const struct nft_expr *expr);
24
25int nft_meta_set_dump(struct sk_buff *skb,
26 const struct nft_expr *expr);
27
28void nft_meta_get_eval(const struct nft_expr *expr,
29 struct nft_data data[NFT_REG_MAX + 1],
30 const struct nft_pktinfo *pkt);
31
32void nft_meta_set_eval(const struct nft_expr *expr,
33 struct nft_data data[NFT_REG_MAX + 1],
34 const struct nft_pktinfo *pkt);
35
36#endif
diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h
index 80f500a29498..aec5e12f9f19 100644
--- a/include/net/netns/ipv4.h
+++ b/include/net/netns/ipv4.h
@@ -20,6 +20,11 @@ struct local_ports {
20 int range[2]; 20 int range[2];
21}; 21};
22 22
23struct ping_group_range {
24 seqlock_t lock;
25 kgid_t range[2];
26};
27
23struct netns_ipv4 { 28struct netns_ipv4 {
24#ifdef CONFIG_SYSCTL 29#ifdef CONFIG_SYSCTL
25 struct ctl_table_header *forw_hdr; 30 struct ctl_table_header *forw_hdr;
@@ -66,16 +71,23 @@ struct netns_ipv4 {
66 int sysctl_icmp_ratemask; 71 int sysctl_icmp_ratemask;
67 int sysctl_icmp_errors_use_inbound_ifaddr; 72 int sysctl_icmp_errors_use_inbound_ifaddr;
68 73
69 struct local_ports sysctl_local_ports; 74 struct local_ports ip_local_ports;
70 75
71 int sysctl_tcp_ecn; 76 int sysctl_tcp_ecn;
72 int sysctl_ip_no_pmtu_disc; 77 int sysctl_ip_no_pmtu_disc;
73 int sysctl_ip_fwd_use_pmtu; 78 int sysctl_ip_fwd_use_pmtu;
74 79
75 kgid_t sysctl_ping_group_range[2]; 80 int sysctl_fwmark_reflect;
81 int sysctl_tcp_fwmark_accept;
82
83 struct ping_group_range ping_group_range;
76 84
77 atomic_t dev_addr_genid; 85 atomic_t dev_addr_genid;
78 86
87#ifdef CONFIG_SYSCTL
88 unsigned long *sysctl_local_reserved_ports;
89#endif
90
79#ifdef CONFIG_IP_MROUTE 91#ifdef CONFIG_IP_MROUTE
80#ifndef CONFIG_IP_MROUTE_MULTIPLE_TABLES 92#ifndef CONFIG_IP_MROUTE_MULTIPLE_TABLES
81 struct mr_table *mrt; 93 struct mr_table *mrt;
diff --git a/include/net/netns/ipv6.h b/include/net/netns/ipv6.h
index 21edaf1f7916..19d3446e59d2 100644
--- a/include/net/netns/ipv6.h
+++ b/include/net/netns/ipv6.h
@@ -30,6 +30,7 @@ struct netns_sysctl_ipv6 {
30 int flowlabel_consistency; 30 int flowlabel_consistency;
31 int icmpv6_time; 31 int icmpv6_time;
32 int anycast_src_echo_reply; 32 int anycast_src_echo_reply;
33 int fwmark_reflect;
33}; 34};
34 35
35struct netns_ipv6 { 36struct netns_ipv6 {
diff --git a/include/net/nfc/digital.h b/include/net/nfc/digital.h
index 7655cfe27c34..bdf55c3b7a19 100644
--- a/include/net/nfc/digital.h
+++ b/include/net/nfc/digital.h
@@ -36,6 +36,7 @@ enum {
36 NFC_DIGITAL_RF_TECH_212F, 36 NFC_DIGITAL_RF_TECH_212F,
37 NFC_DIGITAL_RF_TECH_424F, 37 NFC_DIGITAL_RF_TECH_424F,
38 NFC_DIGITAL_RF_TECH_ISO15693, 38 NFC_DIGITAL_RF_TECH_ISO15693,
39 NFC_DIGITAL_RF_TECH_106B,
39 40
40 NFC_DIGITAL_RF_TECH_LAST, 41 NFC_DIGITAL_RF_TECH_LAST,
41}; 42};
@@ -62,6 +63,9 @@ enum {
62 NFC_DIGITAL_FRAMING_ISO15693_INVENTORY, 63 NFC_DIGITAL_FRAMING_ISO15693_INVENTORY,
63 NFC_DIGITAL_FRAMING_ISO15693_T5T, 64 NFC_DIGITAL_FRAMING_ISO15693_T5T,
64 65
66 NFC_DIGITAL_FRAMING_NFCB,
67 NFC_DIGITAL_FRAMING_NFCB_T4T,
68
65 NFC_DIGITAL_FRAMING_LAST, 69 NFC_DIGITAL_FRAMING_LAST,
66}; 70};
67 71
diff --git a/include/net/nfc/hci.h b/include/net/nfc/hci.h
index 03c4650b548c..61286db54388 100644
--- a/include/net/nfc/hci.h
+++ b/include/net/nfc/hci.h
@@ -27,6 +27,7 @@ struct nfc_hci_dev;
27struct nfc_hci_ops { 27struct nfc_hci_ops {
28 int (*open) (struct nfc_hci_dev *hdev); 28 int (*open) (struct nfc_hci_dev *hdev);
29 void (*close) (struct nfc_hci_dev *hdev); 29 void (*close) (struct nfc_hci_dev *hdev);
30 int (*load_session) (struct nfc_hci_dev *hdev);
30 int (*hci_ready) (struct nfc_hci_dev *hdev); 31 int (*hci_ready) (struct nfc_hci_dev *hdev);
31 /* 32 /*
32 * xmit must always send the complete buffer before 33 * xmit must always send the complete buffer before
diff --git a/include/net/nfc/nfc.h b/include/net/nfc/nfc.h
index 2e8b40c16274..6c583e244de2 100644
--- a/include/net/nfc/nfc.h
+++ b/include/net/nfc/nfc.h
@@ -264,4 +264,7 @@ int nfc_add_se(struct nfc_dev *dev, u32 se_idx, u16 type);
264int nfc_remove_se(struct nfc_dev *dev, u32 se_idx); 264int nfc_remove_se(struct nfc_dev *dev, u32 se_idx);
265struct nfc_se *nfc_find_se(struct nfc_dev *dev, u32 se_idx); 265struct nfc_se *nfc_find_se(struct nfc_dev *dev, u32 se_idx);
266 266
267void nfc_send_to_raw_sock(struct nfc_dev *dev, struct sk_buff *skb,
268 u8 payload_type, u8 direction);
269
267#endif /* __NET_NFC_H */ 270#endif /* __NET_NFC_H */
diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h
index a2441fb1428f..6da46dcf1049 100644
--- a/include/net/pkt_cls.h
+++ b/include/net/pkt_cls.h
@@ -136,7 +136,7 @@ tcf_exts_exec(struct sk_buff *skb, struct tcf_exts *exts,
136 136
137int tcf_exts_validate(struct net *net, struct tcf_proto *tp, 137int tcf_exts_validate(struct net *net, struct tcf_proto *tp,
138 struct nlattr **tb, struct nlattr *rate_tlv, 138 struct nlattr **tb, struct nlattr *rate_tlv,
139 struct tcf_exts *exts); 139 struct tcf_exts *exts, bool ovr);
140void tcf_exts_destroy(struct tcf_proto *tp, struct tcf_exts *exts); 140void tcf_exts_destroy(struct tcf_proto *tp, struct tcf_exts *exts);
141void tcf_exts_change(struct tcf_proto *tp, struct tcf_exts *dst, 141void tcf_exts_change(struct tcf_proto *tp, struct tcf_exts *dst,
142 struct tcf_exts *src); 142 struct tcf_exts *src);
diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h
index 891d80d2c4d2..ec030cd76616 100644
--- a/include/net/pkt_sched.h
+++ b/include/net/pkt_sched.h
@@ -96,7 +96,7 @@ struct qdisc_rate_table *qdisc_get_rtab(struct tc_ratespec *r,
96 struct nlattr *tab); 96 struct nlattr *tab);
97void qdisc_put_rtab(struct qdisc_rate_table *tab); 97void qdisc_put_rtab(struct qdisc_rate_table *tab);
98void qdisc_put_stab(struct qdisc_size_table *tab); 98void qdisc_put_stab(struct qdisc_size_table *tab);
99void qdisc_warn_nonwc(char *txt, struct Qdisc *qdisc); 99void qdisc_warn_nonwc(const char *txt, struct Qdisc *qdisc);
100int sch_direct_xmit(struct sk_buff *skb, struct Qdisc *q, 100int sch_direct_xmit(struct sk_buff *skb, struct Qdisc *q,
101 struct net_device *dev, struct netdev_queue *txq, 101 struct net_device *dev, struct netdev_queue *txq,
102 spinlock_t *root_lock); 102 spinlock_t *root_lock);
diff --git a/include/net/protocol.h b/include/net/protocol.h
index a7e986b08147..d6fcc1fcdb5b 100644
--- a/include/net/protocol.h
+++ b/include/net/protocol.h
@@ -86,7 +86,6 @@ struct inet_protosw {
86 struct proto *prot; 86 struct proto *prot;
87 const struct proto_ops *ops; 87 const struct proto_ops *ops;
88 88
89 char no_check; /* checksum on rcv/xmit/none? */
90 unsigned char flags; /* See INET_PROTOSW_* below. */ 89 unsigned char flags; /* See INET_PROTOSW_* below. */
91}; 90};
92#define INET_PROTOSW_REUSE 0x01 /* Are ports automatically reusable? */ 91#define INET_PROTOSW_REUSE 0x01 /* Are ports automatically reusable? */
diff --git a/include/net/regulatory.h b/include/net/regulatory.h
index 75fc1f5a948d..259992444e80 100644
--- a/include/net/regulatory.h
+++ b/include/net/regulatory.h
@@ -131,6 +131,11 @@ struct regulatory_request {
131 * all country IE information processed by the regulatory core. This will 131 * all country IE information processed by the regulatory core. This will
132 * override %REGULATORY_COUNTRY_IE_FOLLOW_POWER as all country IEs will 132 * override %REGULATORY_COUNTRY_IE_FOLLOW_POWER as all country IEs will
133 * be ignored. 133 * be ignored.
134 * @REGULATORY_ENABLE_RELAX_NO_IR: for devices that wish to allow the
135 * NO_IR relaxation, which enables transmissions on channels on which
136 * otherwise initiating radiation is not allowed. This will enable the
137 * relaxations enabled under the CFG80211_REG_RELAX_NO_IR configuration
138 * option
134 */ 139 */
135enum ieee80211_regulatory_flags { 140enum ieee80211_regulatory_flags {
136 REGULATORY_CUSTOM_REG = BIT(0), 141 REGULATORY_CUSTOM_REG = BIT(0),
@@ -138,6 +143,7 @@ enum ieee80211_regulatory_flags {
138 REGULATORY_DISABLE_BEACON_HINTS = BIT(2), 143 REGULATORY_DISABLE_BEACON_HINTS = BIT(2),
139 REGULATORY_COUNTRY_IE_FOLLOW_POWER = BIT(3), 144 REGULATORY_COUNTRY_IE_FOLLOW_POWER = BIT(3),
140 REGULATORY_COUNTRY_IE_IGNORE = BIT(4), 145 REGULATORY_COUNTRY_IE_IGNORE = BIT(4),
146 REGULATORY_ENABLE_RELAX_NO_IR = BIT(5),
141}; 147};
142 148
143struct ieee80211_freq_range { 149struct ieee80211_freq_range {
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index d062f81c692f..624f9857c83e 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -199,7 +199,7 @@ struct tcf_proto_ops {
199 int (*change)(struct net *net, struct sk_buff *, 199 int (*change)(struct net *net, struct sk_buff *,
200 struct tcf_proto*, unsigned long, 200 struct tcf_proto*, unsigned long,
201 u32 handle, struct nlattr **, 201 u32 handle, struct nlattr **,
202 unsigned long *); 202 unsigned long *, bool);
203 int (*delete)(struct tcf_proto*, unsigned long); 203 int (*delete)(struct tcf_proto*, unsigned long);
204 void (*walk)(struct tcf_proto*, struct tcf_walker *arg); 204 void (*walk)(struct tcf_proto*, struct tcf_walker *arg);
205 205
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index 0dfcc92600e8..f38588bf3462 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -838,10 +838,10 @@ struct sctp_transport {
838 unsigned long sackdelay; 838 unsigned long sackdelay;
839 __u32 sackfreq; 839 __u32 sackfreq;
840 840
841 /* When was the last time (in jiffies) that we heard from this 841 /* When was the last time that we heard from this transport? We use
842 * transport? We use this to pick new active and retran paths. 842 * this to pick new active and retran paths.
843 */ 843 */
844 unsigned long last_time_heard; 844 ktime_t last_time_heard;
845 845
846 /* Last time(in jiffies) when cwnd is reduced due to the congestion 846 /* Last time(in jiffies) when cwnd is reduced due to the congestion
847 * indication based on ECNE chunk. 847 * indication based on ECNE chunk.
diff --git a/include/net/secure_seq.h b/include/net/secure_seq.h
index f257486f17be..3f36d45b714a 100644
--- a/include/net/secure_seq.h
+++ b/include/net/secure_seq.h
@@ -3,8 +3,6 @@
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5 5
6__u32 secure_ip_id(__be32 daddr);
7__u32 secure_ipv6_id(const __be32 daddr[4]);
8u32 secure_ipv4_port_ephemeral(__be32 saddr, __be32 daddr, __be16 dport); 6u32 secure_ipv4_port_ephemeral(__be32 saddr, __be32 daddr, __be16 dport);
9u32 secure_ipv6_port_ephemeral(const __be32 *saddr, const __be32 *daddr, 7u32 secure_ipv6_port_ephemeral(const __be32 *saddr, const __be32 *daddr,
10 __be16 dport); 8 __be16 dport);
diff --git a/include/net/snmp.h b/include/net/snmp.h
index 71596261fa99..f1f27fdbb0d5 100644
--- a/include/net/snmp.h
+++ b/include/net/snmp.h
@@ -116,51 +116,49 @@ struct linux_xfrm_mib {
116 unsigned long mibs[LINUX_MIB_XFRMMAX]; 116 unsigned long mibs[LINUX_MIB_XFRMMAX];
117}; 117};
118 118
119#define SNMP_ARRAY_SZ 1
120
121#define DEFINE_SNMP_STAT(type, name) \ 119#define DEFINE_SNMP_STAT(type, name) \
122 __typeof__(type) __percpu *name[SNMP_ARRAY_SZ] 120 __typeof__(type) __percpu *name
123#define DEFINE_SNMP_STAT_ATOMIC(type, name) \ 121#define DEFINE_SNMP_STAT_ATOMIC(type, name) \
124 __typeof__(type) *name 122 __typeof__(type) *name
125#define DECLARE_SNMP_STAT(type, name) \ 123#define DECLARE_SNMP_STAT(type, name) \
126 extern __typeof__(type) __percpu *name[SNMP_ARRAY_SZ] 124 extern __typeof__(type) __percpu *name
127 125
128#define SNMP_INC_STATS_BH(mib, field) \ 126#define SNMP_INC_STATS_BH(mib, field) \
129 __this_cpu_inc(mib[0]->mibs[field]) 127 __this_cpu_inc(mib->mibs[field])
130 128
131#define SNMP_INC_STATS_USER(mib, field) \ 129#define SNMP_INC_STATS_USER(mib, field) \
132 this_cpu_inc(mib[0]->mibs[field]) 130 this_cpu_inc(mib->mibs[field])
133 131
134#define SNMP_INC_STATS_ATOMIC_LONG(mib, field) \ 132#define SNMP_INC_STATS_ATOMIC_LONG(mib, field) \
135 atomic_long_inc(&mib->mibs[field]) 133 atomic_long_inc(&mib->mibs[field])
136 134
137#define SNMP_INC_STATS(mib, field) \ 135#define SNMP_INC_STATS(mib, field) \
138 this_cpu_inc(mib[0]->mibs[field]) 136 this_cpu_inc(mib->mibs[field])
139 137
140#define SNMP_DEC_STATS(mib, field) \ 138#define SNMP_DEC_STATS(mib, field) \
141 this_cpu_dec(mib[0]->mibs[field]) 139 this_cpu_dec(mib->mibs[field])
142 140
143#define SNMP_ADD_STATS_BH(mib, field, addend) \ 141#define SNMP_ADD_STATS_BH(mib, field, addend) \
144 __this_cpu_add(mib[0]->mibs[field], addend) 142 __this_cpu_add(mib->mibs[field], addend)
145 143
146#define SNMP_ADD_STATS_USER(mib, field, addend) \ 144#define SNMP_ADD_STATS_USER(mib, field, addend) \
147 this_cpu_add(mib[0]->mibs[field], addend) 145 this_cpu_add(mib->mibs[field], addend)
148 146
149#define SNMP_ADD_STATS(mib, field, addend) \ 147#define SNMP_ADD_STATS(mib, field, addend) \
150 this_cpu_add(mib[0]->mibs[field], addend) 148 this_cpu_add(mib->mibs[field], addend)
151/* 149/*
152 * Use "__typeof__(*mib[0]) *ptr" instead of "__typeof__(mib[0]) ptr" 150 * Use "__typeof__(*mib) *ptr" instead of "__typeof__(mib) ptr"
153 * to make @ptr a non-percpu pointer. 151 * to make @ptr a non-percpu pointer.
154 */ 152 */
155#define SNMP_UPD_PO_STATS(mib, basefield, addend) \ 153#define SNMP_UPD_PO_STATS(mib, basefield, addend) \
156 do { \ 154 do { \
157 __typeof__(*mib[0]->mibs) *ptr = mib[0]->mibs; \ 155 __typeof__(*mib->mibs) *ptr = mib->mibs; \
158 this_cpu_inc(ptr[basefield##PKTS]); \ 156 this_cpu_inc(ptr[basefield##PKTS]); \
159 this_cpu_add(ptr[basefield##OCTETS], addend); \ 157 this_cpu_add(ptr[basefield##OCTETS], addend); \
160 } while (0) 158 } while (0)
161#define SNMP_UPD_PO_STATS_BH(mib, basefield, addend) \ 159#define SNMP_UPD_PO_STATS_BH(mib, basefield, addend) \
162 do { \ 160 do { \
163 __typeof__(*mib[0]->mibs) *ptr = mib[0]->mibs; \ 161 __typeof__(*mib->mibs) *ptr = mib->mibs; \
164 __this_cpu_inc(ptr[basefield##PKTS]); \ 162 __this_cpu_inc(ptr[basefield##PKTS]); \
165 __this_cpu_add(ptr[basefield##OCTETS], addend); \ 163 __this_cpu_add(ptr[basefield##OCTETS], addend); \
166 } while (0) 164 } while (0)
@@ -170,7 +168,7 @@ struct linux_xfrm_mib {
170 168
171#define SNMP_ADD_STATS64_BH(mib, field, addend) \ 169#define SNMP_ADD_STATS64_BH(mib, field, addend) \
172 do { \ 170 do { \
173 __typeof__(*mib[0]) *ptr = __this_cpu_ptr((mib)[0]); \ 171 __typeof__(*mib) *ptr = __this_cpu_ptr(mib); \
174 u64_stats_update_begin(&ptr->syncp); \ 172 u64_stats_update_begin(&ptr->syncp); \
175 ptr->mibs[field] += addend; \ 173 ptr->mibs[field] += addend; \
176 u64_stats_update_end(&ptr->syncp); \ 174 u64_stats_update_end(&ptr->syncp); \
@@ -191,8 +189,8 @@ struct linux_xfrm_mib {
191#define SNMP_INC_STATS64(mib, field) SNMP_ADD_STATS64(mib, field, 1) 189#define SNMP_INC_STATS64(mib, field) SNMP_ADD_STATS64(mib, field, 1)
192#define SNMP_UPD_PO_STATS64_BH(mib, basefield, addend) \ 190#define SNMP_UPD_PO_STATS64_BH(mib, basefield, addend) \
193 do { \ 191 do { \
194 __typeof__(*mib[0]) *ptr; \ 192 __typeof__(*mib) *ptr; \
195 ptr = __this_cpu_ptr((mib)[0]); \ 193 ptr = __this_cpu_ptr(mib); \
196 u64_stats_update_begin(&ptr->syncp); \ 194 u64_stats_update_begin(&ptr->syncp); \
197 ptr->mibs[basefield##PKTS]++; \ 195 ptr->mibs[basefield##PKTS]++; \
198 ptr->mibs[basefield##OCTETS] += addend; \ 196 ptr->mibs[basefield##OCTETS] += addend; \
diff --git a/include/net/sock.h b/include/net/sock.h
index 21569cf456ed..173cae485de1 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -243,7 +243,8 @@ struct cg_proto;
243 * @sk_sndbuf: size of send buffer in bytes 243 * @sk_sndbuf: size of send buffer in bytes
244 * @sk_flags: %SO_LINGER (l_onoff), %SO_BROADCAST, %SO_KEEPALIVE, 244 * @sk_flags: %SO_LINGER (l_onoff), %SO_BROADCAST, %SO_KEEPALIVE,
245 * %SO_OOBINLINE settings, %SO_TIMESTAMPING settings 245 * %SO_OOBINLINE settings, %SO_TIMESTAMPING settings
246 * @sk_no_check: %SO_NO_CHECK setting, whether or not checkup packets 246 * @sk_no_check_tx: %SO_NO_CHECK setting, set checksum in TX packets
247 * @sk_no_check_rx: allow zero checksum in RX packets
247 * @sk_route_caps: route capabilities (e.g. %NETIF_F_TSO) 248 * @sk_route_caps: route capabilities (e.g. %NETIF_F_TSO)
248 * @sk_route_nocaps: forbidden route capabilities (e.g NETIF_F_GSO_MASK) 249 * @sk_route_nocaps: forbidden route capabilities (e.g NETIF_F_GSO_MASK)
249 * @sk_gso_type: GSO type (e.g. %SKB_GSO_TCPV4) 250 * @sk_gso_type: GSO type (e.g. %SKB_GSO_TCPV4)
@@ -371,7 +372,8 @@ struct sock {
371 struct sk_buff_head sk_write_queue; 372 struct sk_buff_head sk_write_queue;
372 kmemcheck_bitfield_begin(flags); 373 kmemcheck_bitfield_begin(flags);
373 unsigned int sk_shutdown : 2, 374 unsigned int sk_shutdown : 2,
374 sk_no_check : 2, 375 sk_no_check_tx : 1,
376 sk_no_check_rx : 1,
375 sk_userlocks : 4, 377 sk_userlocks : 4,
376 sk_protocol : 8, 378 sk_protocol : 8,
377 sk_type : 16; 379 sk_type : 16;
@@ -1728,8 +1730,8 @@ sk_dst_get(struct sock *sk)
1728 1730
1729 rcu_read_lock(); 1731 rcu_read_lock();
1730 dst = rcu_dereference(sk->sk_dst_cache); 1732 dst = rcu_dereference(sk->sk_dst_cache);
1731 if (dst) 1733 if (dst && !atomic_inc_not_zero(&dst->__refcnt))
1732 dst_hold(dst); 1734 dst = NULL;
1733 rcu_read_unlock(); 1735 rcu_read_unlock();
1734 return dst; 1736 return dst;
1735} 1737}
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 87d877408188..7286db80e8b8 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -220,8 +220,6 @@ void tcp_time_wait(struct sock *sk, int state, int timeo);
220#define TFO_SERVER_ENABLE 2 220#define TFO_SERVER_ENABLE 2
221#define TFO_CLIENT_NO_COOKIE 4 /* Data in SYN w/o cookie option */ 221#define TFO_CLIENT_NO_COOKIE 4 /* Data in SYN w/o cookie option */
222 222
223/* Process SYN data but skip cookie validation */
224#define TFO_SERVER_COOKIE_NOT_CHKED 0x100
225/* Accept SYN data w/o any cookie option */ 223/* Accept SYN data w/o any cookie option */
226#define TFO_SERVER_COOKIE_NOT_REQD 0x200 224#define TFO_SERVER_COOKIE_NOT_REQD 0x200
227 225
@@ -230,10 +228,6 @@ void tcp_time_wait(struct sock *sk, int state, int timeo);
230 */ 228 */
231#define TFO_SERVER_WO_SOCKOPT1 0x400 229#define TFO_SERVER_WO_SOCKOPT1 0x400
232#define TFO_SERVER_WO_SOCKOPT2 0x800 230#define TFO_SERVER_WO_SOCKOPT2 0x800
233/* Always create TFO child sockets on a TFO listener even when
234 * cookie/data not present. (For testing purpose!)
235 */
236#define TFO_SERVER_ALWAYS 0x1000
237 231
238extern struct inet_timewait_death_row tcp_death_row; 232extern struct inet_timewait_death_row tcp_death_row;
239 233
@@ -541,7 +535,7 @@ void tcp_retransmit_timer(struct sock *sk);
541void tcp_xmit_retransmit_queue(struct sock *); 535void tcp_xmit_retransmit_queue(struct sock *);
542void tcp_simple_retransmit(struct sock *); 536void tcp_simple_retransmit(struct sock *);
543int tcp_trim_head(struct sock *, struct sk_buff *, u32); 537int tcp_trim_head(struct sock *, struct sk_buff *, u32);
544int tcp_fragment(struct sock *, struct sk_buff *, u32, unsigned int); 538int tcp_fragment(struct sock *, struct sk_buff *, u32, unsigned int, gfp_t);
545 539
546void tcp_send_probe0(struct sock *); 540void tcp_send_probe0(struct sock *);
547void tcp_send_partial(struct sock *); 541void tcp_send_partial(struct sock *);
@@ -558,7 +552,6 @@ void tcp_send_loss_probe(struct sock *sk);
558bool tcp_schedule_loss_probe(struct sock *sk); 552bool tcp_schedule_loss_probe(struct sock *sk);
559 553
560/* tcp_input.c */ 554/* tcp_input.c */
561void tcp_cwnd_application_limited(struct sock *sk);
562void tcp_resume_early_retransmit(struct sock *sk); 555void tcp_resume_early_retransmit(struct sock *sk);
563void tcp_rearm_rto(struct sock *sk); 556void tcp_rearm_rto(struct sock *sk);
564void tcp_reset(struct sock *sk); 557void tcp_reset(struct sock *sk);
@@ -797,7 +790,7 @@ struct tcp_congestion_ops {
797 /* return slow start threshold (required) */ 790 /* return slow start threshold (required) */
798 u32 (*ssthresh)(struct sock *sk); 791 u32 (*ssthresh)(struct sock *sk);
799 /* do new cwnd calculation (required) */ 792 /* do new cwnd calculation (required) */
800 void (*cong_avoid)(struct sock *sk, u32 ack, u32 acked, u32 in_flight); 793 void (*cong_avoid)(struct sock *sk, u32 ack, u32 acked);
801 /* call before changing ca_state (optional) */ 794 /* call before changing ca_state (optional) */
802 void (*set_state)(struct sock *sk, u8 new_state); 795 void (*set_state)(struct sock *sk, u8 new_state);
803 /* call when cwnd event occurs (optional) */ 796 /* call when cwnd event occurs (optional) */
@@ -829,7 +822,7 @@ void tcp_cong_avoid_ai(struct tcp_sock *tp, u32 w);
829 822
830extern struct tcp_congestion_ops tcp_init_congestion_ops; 823extern struct tcp_congestion_ops tcp_init_congestion_ops;
831u32 tcp_reno_ssthresh(struct sock *sk); 824u32 tcp_reno_ssthresh(struct sock *sk);
832void tcp_reno_cong_avoid(struct sock *sk, u32 ack, u32 acked, u32 in_flight); 825void tcp_reno_cong_avoid(struct sock *sk, u32 ack, u32 acked);
833extern struct tcp_congestion_ops tcp_reno; 826extern struct tcp_congestion_ops tcp_reno;
834 827
835static inline void tcp_set_ca_state(struct sock *sk, const u8 ca_state) 828static inline void tcp_set_ca_state(struct sock *sk, const u8 ca_state)
@@ -975,7 +968,30 @@ static inline u32 tcp_wnd_end(const struct tcp_sock *tp)
975{ 968{
976 return tp->snd_una + tp->snd_wnd; 969 return tp->snd_una + tp->snd_wnd;
977} 970}
978bool tcp_is_cwnd_limited(const struct sock *sk, u32 in_flight); 971
972/* We follow the spirit of RFC2861 to validate cwnd but implement a more
973 * flexible approach. The RFC suggests cwnd should not be raised unless
974 * it was fully used previously. And that's exactly what we do in
975 * congestion avoidance mode. But in slow start we allow cwnd to grow
976 * as long as the application has used half the cwnd.
977 * Example :
978 * cwnd is 10 (IW10), but application sends 9 frames.
979 * We allow cwnd to reach 18 when all frames are ACKed.
980 * This check is safe because it's as aggressive as slow start which already
981 * risks 100% overshoot. The advantage is that we discourage application to
982 * either send more filler packets or data to artificially blow up the cwnd
983 * usage, and allow application-limited process to probe bw more aggressively.
984 */
985static inline bool tcp_is_cwnd_limited(const struct sock *sk)
986{
987 const struct tcp_sock *tp = tcp_sk(sk);
988
989 /* If in slow start, ensure cwnd grows to twice what was ACKed. */
990 if (tp->snd_cwnd <= tp->snd_ssthresh)
991 return tp->snd_cwnd < 2 * tp->max_packets_out;
992
993 return tp->is_cwnd_limited;
994}
979 995
980static inline void tcp_check_probe_timer(struct sock *sk) 996static inline void tcp_check_probe_timer(struct sock *sk)
981{ 997{
@@ -1103,6 +1119,9 @@ static inline void tcp_openreq_init(struct request_sock *req,
1103 ireq->ir_num = ntohs(tcp_hdr(skb)->dest); 1119 ireq->ir_num = ntohs(tcp_hdr(skb)->dest);
1104} 1120}
1105 1121
1122extern void tcp_openreq_init_rwin(struct request_sock *req,
1123 struct sock *sk, struct dst_entry *dst);
1124
1106void tcp_enter_memory_pressure(struct sock *sk); 1125void tcp_enter_memory_pressure(struct sock *sk);
1107 1126
1108static inline int keepalive_intvl_when(const struct tcp_sock *tp) 1127static inline int keepalive_intvl_when(const struct tcp_sock *tp)
@@ -1312,8 +1331,10 @@ void tcp_free_fastopen_req(struct tcp_sock *tp);
1312 1331
1313extern struct tcp_fastopen_context __rcu *tcp_fastopen_ctx; 1332extern struct tcp_fastopen_context __rcu *tcp_fastopen_ctx;
1314int tcp_fastopen_reset_cipher(void *key, unsigned int len); 1333int tcp_fastopen_reset_cipher(void *key, unsigned int len);
1315void tcp_fastopen_cookie_gen(__be32 src, __be32 dst, 1334bool tcp_try_fastopen(struct sock *sk, struct sk_buff *skb,
1316 struct tcp_fastopen_cookie *foc); 1335 struct request_sock *req,
1336 struct tcp_fastopen_cookie *foc,
1337 struct dst_entry *dst);
1317void tcp_fastopen_init_key_once(bool publish); 1338void tcp_fastopen_init_key_once(bool publish);
1318#define TCP_FASTOPEN_KEY_LENGTH 16 1339#define TCP_FASTOPEN_KEY_LENGTH 16
1319 1340
diff --git a/include/net/tso.h b/include/net/tso.h
new file mode 100644
index 000000000000..47e5444f7d15
--- /dev/null
+++ b/include/net/tso.h
@@ -0,0 +1,20 @@
1#ifndef _TSO_H
2#define _TSO_H
3
4#include <net/ip.h>
5
6struct tso_t {
7 int next_frag_idx;
8 void *data;
9 size_t size;
10 u16 ip_id;
11 u32 tcp_seq;
12};
13
14int tso_count_descs(struct sk_buff *skb);
15void tso_build_hdr(struct sk_buff *skb, char *hdr, struct tso_t *tso,
16 int size, bool is_last);
17void tso_build_data(struct sk_buff *skb, struct tso_t *tso, int size);
18void tso_start(struct sk_buff *skb, struct tso_t *tso);
19
20#endif /* _TSO_H */
diff --git a/include/net/udp.h b/include/net/udp.h
index a24f0f3e107f..68a1fefe3dfe 100644
--- a/include/net/udp.h
+++ b/include/net/udp.h
@@ -95,15 +95,6 @@ static inline struct udp_hslot *udp_hashslot2(struct udp_table *table,
95 return &table->hash2[hash & table->mask]; 95 return &table->hash2[hash & table->mask];
96} 96}
97 97
98/* Note: this must match 'valbool' in sock_setsockopt */
99#define UDP_CSUM_NOXMIT 1
100
101/* Used by SunRPC/xprt layer. */
102#define UDP_CSUM_NORCV 2
103
104/* Default, as per the RFC, is to always do csums. */
105#define UDP_CSUM_DEFAULT 0
106
107extern struct proto udp_prot; 98extern struct proto udp_prot;
108 99
109extern atomic_long_t udp_memory_allocated; 100extern atomic_long_t udp_memory_allocated;
@@ -120,7 +111,9 @@ struct sk_buff;
120 */ 111 */
121static inline __sum16 __udp_lib_checksum_complete(struct sk_buff *skb) 112static inline __sum16 __udp_lib_checksum_complete(struct sk_buff *skb)
122{ 113{
123 return __skb_checksum_complete_head(skb, UDP_SKB_CB(skb)->cscov); 114 return (UDP_SKB_CB(skb)->cscov == skb->len ?
115 __skb_checksum_complete(skb) :
116 __skb_checksum_complete_head(skb, UDP_SKB_CB(skb)->cscov));
124} 117}
125 118
126static inline int udp_lib_checksum_complete(struct sk_buff *skb) 119static inline int udp_lib_checksum_complete(struct sk_buff *skb)
@@ -156,6 +149,15 @@ static inline __wsum udp_csum(struct sk_buff *skb)
156 return csum; 149 return csum;
157} 150}
158 151
152static inline __sum16 udp_v4_check(int len, __be32 saddr,
153 __be32 daddr, __wsum base)
154{
155 return csum_tcpudp_magic(saddr, daddr, len, IPPROTO_UDP, base);
156}
157
158void udp_set_csum(bool nocheck, struct sk_buff *skb,
159 __be32 saddr, __be32 daddr, int len);
160
159/* hash routines shared between UDPv4/6 and UDP-Litev4/6 */ 161/* hash routines shared between UDPv4/6 and UDP-Litev4/6 */
160static inline void udp_lib_hash(struct sock *sk) 162static inline void udp_lib_hash(struct sock *sk)
161{ 163{
diff --git a/include/net/vxlan.h b/include/net/vxlan.h
index 5deef1ae78c9..12196ce661d9 100644
--- a/include/net/vxlan.h
+++ b/include/net/vxlan.h
@@ -24,16 +24,26 @@ struct vxlan_sock {
24 struct udp_offload udp_offloads; 24 struct udp_offload udp_offloads;
25}; 25};
26 26
27#define VXLAN_F_LEARN 0x01
28#define VXLAN_F_PROXY 0x02
29#define VXLAN_F_RSC 0x04
30#define VXLAN_F_L2MISS 0x08
31#define VXLAN_F_L3MISS 0x10
32#define VXLAN_F_IPV6 0x20
33#define VXLAN_F_UDP_CSUM 0x40
34#define VXLAN_F_UDP_ZERO_CSUM6_TX 0x80
35#define VXLAN_F_UDP_ZERO_CSUM6_RX 0x100
36
27struct vxlan_sock *vxlan_sock_add(struct net *net, __be16 port, 37struct vxlan_sock *vxlan_sock_add(struct net *net, __be16 port,
28 vxlan_rcv_t *rcv, void *data, 38 vxlan_rcv_t *rcv, void *data,
29 bool no_share, bool ipv6); 39 bool no_share, u32 flags);
30 40
31void vxlan_sock_release(struct vxlan_sock *vs); 41void vxlan_sock_release(struct vxlan_sock *vs);
32 42
33int vxlan_xmit_skb(struct vxlan_sock *vs, 43int vxlan_xmit_skb(struct vxlan_sock *vs,
34 struct rtable *rt, struct sk_buff *skb, 44 struct rtable *rt, struct sk_buff *skb,
35 __be32 src, __be32 dst, __u8 tos, __u8 ttl, __be16 df, 45 __be32 src, __be32 dst, __u8 tos, __u8 ttl, __be16 df,
36 __be16 src_port, __be16 dst_port, __be32 vni); 46 __be16 src_port, __be16 dst_port, __be32 vni, bool xnet);
37 47
38__be16 vxlan_src_port(__u16 port_min, __u16 port_max, struct sk_buff *skb); 48__be16 vxlan_src_port(__u16 port_min, __u16 port_max, struct sk_buff *skb);
39 49
diff --git a/include/net/wimax.h b/include/net/wimax.h
index 98498e1daa06..e52ef5357e08 100644
--- a/include/net/wimax.h
+++ b/include/net/wimax.h
@@ -483,8 +483,8 @@ void wimax_report_rfkill_sw(struct wimax_dev *, enum wimax_rf_state);
483 * Be sure not to modify skb->data in the middle (ie: don't use 483 * Be sure not to modify skb->data in the middle (ie: don't use
484 * skb_push()/skb_pull()/skb_reserve() on the skb). 484 * skb_push()/skb_pull()/skb_reserve() on the skb).
485 * 485 *
486 * "pipe_name" is any string, than can be interpreted as the name of 486 * "pipe_name" is any string, that can be interpreted as the name of
487 * the pipe or destinatary; the interpretation of it is driver 487 * the pipe or recipient; the interpretation of it is driver
488 * specific, so the recipient can multiplex it as wished. It can be 488 * specific, so the recipient can multiplex it as wished. It can be
489 * NULL, it won't be used - an example is using a "diagnostics" tag to 489 * NULL, it won't be used - an example is using a "diagnostics" tag to
490 * send diagnostics information that a device-specific diagnostics 490 * send diagnostics information that a device-specific diagnostics
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 116e9c7e19cb..721e9c3b11bd 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -691,13 +691,6 @@ struct xfrm_spi_skb_cb {
691 691
692#define XFRM_SPI_SKB_CB(__skb) ((struct xfrm_spi_skb_cb *)&((__skb)->cb[0])) 692#define XFRM_SPI_SKB_CB(__skb) ((struct xfrm_spi_skb_cb *)&((__skb)->cb[0]))
693 693
694/* Audit Information */
695struct xfrm_audit {
696 u32 secid;
697 kuid_t loginuid;
698 unsigned int sessionid;
699};
700
701#ifdef CONFIG_AUDITSYSCALL 694#ifdef CONFIG_AUDITSYSCALL
702static inline struct audit_buffer *xfrm_audit_start(const char *op) 695static inline struct audit_buffer *xfrm_audit_start(const char *op)
703{ 696{
@@ -713,30 +706,24 @@ static inline struct audit_buffer *xfrm_audit_start(const char *op)
713 return audit_buf; 706 return audit_buf;
714} 707}
715 708
716static inline void xfrm_audit_helper_usrinfo(kuid_t auid, unsigned int ses, u32 secid, 709static inline void xfrm_audit_helper_usrinfo(bool task_valid,
717 struct audit_buffer *audit_buf) 710 struct audit_buffer *audit_buf)
718{ 711{
719 char *secctx; 712 const unsigned int auid = from_kuid(&init_user_ns, task_valid ?
720 u32 secctx_len; 713 audit_get_loginuid(current) :
721 714 INVALID_UID);
722 audit_log_format(audit_buf, " auid=%u ses=%u", 715 const unsigned int ses = task_valid ? audit_get_sessionid(current) :
723 from_kuid(&init_user_ns, auid), ses); 716 (unsigned int) -1;
724 if (secid != 0 && 717
725 security_secid_to_secctx(secid, &secctx, &secctx_len) == 0) { 718 audit_log_format(audit_buf, " auid=%u ses=%u", auid, ses);
726 audit_log_format(audit_buf, " subj=%s", secctx); 719 audit_log_task_context(audit_buf);
727 security_release_secctx(secctx, secctx_len); 720}
728 } else 721
729 audit_log_task_context(audit_buf); 722void xfrm_audit_policy_add(struct xfrm_policy *xp, int result, bool task_valid);
730} 723void xfrm_audit_policy_delete(struct xfrm_policy *xp, int result,
731 724 bool task_valid);
732void xfrm_audit_policy_add(struct xfrm_policy *xp, int result, kuid_t auid, 725void xfrm_audit_state_add(struct xfrm_state *x, int result, bool task_valid);
733 unsigned int ses, u32 secid); 726void xfrm_audit_state_delete(struct xfrm_state *x, int result, bool task_valid);
734void xfrm_audit_policy_delete(struct xfrm_policy *xp, int result, kuid_t auid,
735 unsigned int ses, u32 secid);
736void xfrm_audit_state_add(struct xfrm_state *x, int result, kuid_t auid,
737 unsigned int ses, u32 secid);
738void xfrm_audit_state_delete(struct xfrm_state *x, int result, kuid_t auid,
739 unsigned int ses, u32 secid);
740void xfrm_audit_state_replay_overflow(struct xfrm_state *x, 727void xfrm_audit_state_replay_overflow(struct xfrm_state *x,
741 struct sk_buff *skb); 728 struct sk_buff *skb);
742void xfrm_audit_state_replay(struct xfrm_state *x, struct sk_buff *skb, 729void xfrm_audit_state_replay(struct xfrm_state *x, struct sk_buff *skb,
@@ -749,22 +736,22 @@ void xfrm_audit_state_icvfail(struct xfrm_state *x, struct sk_buff *skb,
749#else 736#else
750 737
751static inline void xfrm_audit_policy_add(struct xfrm_policy *xp, int result, 738static inline void xfrm_audit_policy_add(struct xfrm_policy *xp, int result,
752 kuid_t auid, unsigned int ses, u32 secid) 739 bool task_valid)
753{ 740{
754} 741}
755 742
756static inline void xfrm_audit_policy_delete(struct xfrm_policy *xp, int result, 743static inline void xfrm_audit_policy_delete(struct xfrm_policy *xp, int result,
757 kuid_t auid, unsigned int ses, u32 secid) 744 bool task_valid)
758{ 745{
759} 746}
760 747
761static inline void xfrm_audit_state_add(struct xfrm_state *x, int result, 748static inline void xfrm_audit_state_add(struct xfrm_state *x, int result,
762 kuid_t auid, unsigned int ses, u32 secid) 749 bool task_valid)
763{ 750{
764} 751}
765 752
766static inline void xfrm_audit_state_delete(struct xfrm_state *x, int result, 753static inline void xfrm_audit_state_delete(struct xfrm_state *x, int result,
767 kuid_t auid, unsigned int ses, u32 secid) 754 bool task_valid)
768{ 755{
769} 756}
770 757
@@ -1508,7 +1495,7 @@ struct xfrmk_spdinfo {
1508 1495
1509struct xfrm_state *xfrm_find_acq_byseq(struct net *net, u32 mark, u32 seq); 1496struct xfrm_state *xfrm_find_acq_byseq(struct net *net, u32 mark, u32 seq);
1510int xfrm_state_delete(struct xfrm_state *x); 1497int xfrm_state_delete(struct xfrm_state *x);
1511int xfrm_state_flush(struct net *net, u8 proto, struct xfrm_audit *audit_info); 1498int xfrm_state_flush(struct net *net, u8 proto, bool task_valid);
1512void xfrm_sad_getinfo(struct net *net, struct xfrmk_sadinfo *si); 1499void xfrm_sad_getinfo(struct net *net, struct xfrmk_sadinfo *si);
1513void xfrm_spd_getinfo(struct net *net, struct xfrmk_spdinfo *si); 1500void xfrm_spd_getinfo(struct net *net, struct xfrmk_spdinfo *si);
1514u32 xfrm_replay_seqhi(struct xfrm_state *x, __be32 net_seq); 1501u32 xfrm_replay_seqhi(struct xfrm_state *x, __be32 net_seq);
@@ -1603,7 +1590,7 @@ struct xfrm_policy *xfrm_policy_bysel_ctx(struct net *net, u32 mark,
1603 int *err); 1590 int *err);
1604struct xfrm_policy *xfrm_policy_byid(struct net *net, u32 mark, u8, int dir, 1591struct xfrm_policy *xfrm_policy_byid(struct net *net, u32 mark, u8, int dir,
1605 u32 id, int delete, int *err); 1592 u32 id, int delete, int *err);
1606int xfrm_policy_flush(struct net *net, u8 type, struct xfrm_audit *audit_info); 1593int xfrm_policy_flush(struct net *net, u8 type, bool task_valid);
1607u32 xfrm_get_acqseq(void); 1594u32 xfrm_get_acqseq(void);
1608int verify_spi_info(u8 proto, u32 min, u32 max); 1595int verify_spi_info(u8 proto, u32 min, u32 max);
1609int xfrm_alloc_spi(struct xfrm_state *x, u32 minspi, u32 maxspi); 1596int xfrm_alloc_spi(struct xfrm_state *x, u32 minspi, u32 maxspi);
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index acd825182977..7ccef342f724 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -80,8 +80,8 @@ enum rdma_transport_type {
80 RDMA_TRANSPORT_USNIC_UDP 80 RDMA_TRANSPORT_USNIC_UDP
81}; 81};
82 82
83enum rdma_transport_type 83__attribute_const__ enum rdma_transport_type
84rdma_node_get_transport(enum rdma_node_type node_type) __attribute_const__; 84rdma_node_get_transport(enum rdma_node_type node_type);
85 85
86enum rdma_link_layer { 86enum rdma_link_layer {
87 IB_LINK_LAYER_UNSPECIFIED, 87 IB_LINK_LAYER_UNSPECIFIED,
@@ -466,14 +466,14 @@ enum ib_rate {
466 * converted to 2, since 5 Gbit/sec is 2 * 2.5 Gbit/sec. 466 * converted to 2, since 5 Gbit/sec is 2 * 2.5 Gbit/sec.
467 * @rate: rate to convert. 467 * @rate: rate to convert.
468 */ 468 */
469int ib_rate_to_mult(enum ib_rate rate) __attribute_const__; 469__attribute_const__ int ib_rate_to_mult(enum ib_rate rate);
470 470
471/** 471/**
472 * ib_rate_to_mbps - Convert the IB rate enum to Mbps. 472 * ib_rate_to_mbps - Convert the IB rate enum to Mbps.
473 * For example, IB_RATE_2_5_GBPS will be converted to 2500. 473 * For example, IB_RATE_2_5_GBPS will be converted to 2500.
474 * @rate: rate to convert. 474 * @rate: rate to convert.
475 */ 475 */
476int ib_rate_to_mbps(enum ib_rate rate) __attribute_const__; 476__attribute_const__ int ib_rate_to_mbps(enum ib_rate rate);
477 477
478enum ib_mr_create_flags { 478enum ib_mr_create_flags {
479 IB_MR_SIGNATURE_EN = 1, 479 IB_MR_SIGNATURE_EN = 1,
@@ -604,7 +604,7 @@ struct ib_mr_status {
604 * enum. 604 * enum.
605 * @mult: multiple to convert. 605 * @mult: multiple to convert.
606 */ 606 */
607enum ib_rate mult_to_ib_rate(int mult) __attribute_const__; 607__attribute_const__ enum ib_rate mult_to_ib_rate(int mult);
608 608
609struct ib_ah_attr { 609struct ib_ah_attr {
610 struct ib_global_route grh; 610 struct ib_global_route grh;
@@ -783,6 +783,7 @@ enum ib_qp_create_flags {
783 IB_QP_CREATE_BLOCK_MULTICAST_LOOPBACK = 1 << 1, 783 IB_QP_CREATE_BLOCK_MULTICAST_LOOPBACK = 1 << 1,
784 IB_QP_CREATE_NETIF_QP = 1 << 5, 784 IB_QP_CREATE_NETIF_QP = 1 << 5,
785 IB_QP_CREATE_SIGNATURE_EN = 1 << 6, 785 IB_QP_CREATE_SIGNATURE_EN = 1 << 6,
786 IB_QP_CREATE_USE_GFP_NOIO = 1 << 7,
786 /* reserve bits 26-31 for low level drivers' internal use */ 787 /* reserve bits 26-31 for low level drivers' internal use */
787 IB_QP_CREATE_RESERVED_START = 1 << 26, 788 IB_QP_CREATE_RESERVED_START = 1 << 26,
788 IB_QP_CREATE_RESERVED_END = 1 << 31, 789 IB_QP_CREATE_RESERVED_END = 1 << 31,
diff --git a/include/rdma/iw_portmap.h b/include/rdma/iw_portmap.h
new file mode 100644
index 000000000000..928b2775e992
--- /dev/null
+++ b/include/rdma/iw_portmap.h
@@ -0,0 +1,199 @@
1/*
2 * Copyright (c) 2014 Intel Corporation. All rights reserved.
3 * Copyright (c) 2014 Chelsio, Inc. All rights reserved.
4 *
5 * This software is available to you under a choice of one of two
6 * licenses. You may choose to be licensed under the terms of the GNU
7 * General Public License (GPL) Version 2, available from the file
8 * COPYING in the main directory of this source tree, or the
9 * OpenIB.org BSD license below:
10 *
11 * Redistribution and use in source and binary forms, with or
12 * without modification, are permitted provided that the following
13 * conditions are met:
14 *
15 * - Redistributions of source code must retain the above
16 * copyright notice, this list of conditions and the following
17 * disclaimer.
18 *
19 * - Redistributions in binary form must reproduce the above
20 * copyright notice, this list of conditions and the following
21 * disclaimer in the documentation and/or other materials
22 * provided with the distribution.
23 *
24 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
28 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
29 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
30 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31 * SOFTWARE.
32 */
33#ifndef _IW_PORTMAP_H
34#define _IW_PORTMAP_H
35
36#define IWPM_ULIBNAME_SIZE 32
37#define IWPM_DEVNAME_SIZE 32
38#define IWPM_IFNAME_SIZE 16
39#define IWPM_IPADDR_SIZE 16
40
41enum {
42 IWPM_INVALID_NLMSG_ERR = 10,
43 IWPM_CREATE_MAPPING_ERR,
44 IWPM_DUPLICATE_MAPPING_ERR,
45 IWPM_UNKNOWN_MAPPING_ERR,
46 IWPM_CLIENT_DEV_INFO_ERR,
47 IWPM_USER_LIB_INFO_ERR,
48 IWPM_REMOTE_QUERY_REJECT
49};
50
51struct iwpm_dev_data {
52 char dev_name[IWPM_DEVNAME_SIZE];
53 char if_name[IWPM_IFNAME_SIZE];
54};
55
56struct iwpm_sa_data {
57 struct sockaddr_storage loc_addr;
58 struct sockaddr_storage mapped_loc_addr;
59 struct sockaddr_storage rem_addr;
60 struct sockaddr_storage mapped_rem_addr;
61};
62
63/**
64 * iwpm_init - Allocate resources for the iwarp port mapper
65 *
66 * Should be called when network interface goes up.
67 */
68int iwpm_init(u8);
69
70/**
71 * iwpm_exit - Deallocate resources for the iwarp port mapper
72 *
73 * Should be called when network interface goes down.
74 */
75int iwpm_exit(u8);
76
77/**
78 * iwpm_valid_pid - Check if the userspace iwarp port mapper pid is valid
79 *
80 * Returns true if the pid is greater than zero, otherwise returns false
81 */
82int iwpm_valid_pid(void);
83
84/**
85 * iwpm_register_pid - Send a netlink query to userspace
86 * to get the iwarp port mapper pid
87 * @pm_msg: Contains driver info to send to the userspace port mapper
88 * @nl_client: The index of the netlink client
89 */
90int iwpm_register_pid(struct iwpm_dev_data *pm_msg, u8 nl_client);
91
92/**
93 * iwpm_add_mapping - Send a netlink add mapping request to
94 * the userspace port mapper
95 * @pm_msg: Contains the local ip/tcp address info to send
96 * @nl_client: The index of the netlink client
97 *
98 * If the request is successful, the pm_msg stores
99 * the port mapper response (mapped address info)
100 */
101int iwpm_add_mapping(struct iwpm_sa_data *pm_msg, u8 nl_client);
102
103/**
104 * iwpm_add_and_query_mapping - Send a netlink add and query mapping request
105 * to the userspace port mapper
106 * @pm_msg: Contains the local and remote ip/tcp address info to send
107 * @nl_client: The index of the netlink client
108 *
109 * If the request is successful, the pm_msg stores the
110 * port mapper response (mapped local and remote address info)
111 */
112int iwpm_add_and_query_mapping(struct iwpm_sa_data *pm_msg, u8 nl_client);
113
114/**
115 * iwpm_remove_mapping - Send a netlink remove mapping request
116 * to the userspace port mapper
117 *
118 * @local_addr: Local ip/tcp address to remove
119 * @nl_client: The index of the netlink client
120 */
121int iwpm_remove_mapping(struct sockaddr_storage *local_addr, u8 nl_client);
122
123/**
124 * iwpm_register_pid_cb - Process the port mapper response to
125 * iwpm_register_pid query
126 * @skb:
127 * @cb: Contains the received message (payload and netlink header)
128 *
129 * If successful, the function receives the userspace port mapper pid
130 * which is used in future communication with the port mapper
131 */
132int iwpm_register_pid_cb(struct sk_buff *, struct netlink_callback *);
133
134/**
135 * iwpm_add_mapping_cb - Process the port mapper response to
136 * iwpm_add_mapping request
137 * @skb:
138 * @cb: Contains the received message (payload and netlink header)
139 */
140int iwpm_add_mapping_cb(struct sk_buff *, struct netlink_callback *);
141
142/**
143 * iwpm_add_and_query_mapping_cb - Process the port mapper response to
144 * iwpm_add_and_query_mapping request
145 * @skb:
146 * @cb: Contains the received message (payload and netlink header)
147 */
148int iwpm_add_and_query_mapping_cb(struct sk_buff *, struct netlink_callback *);
149
150/**
151 * iwpm_mapping_error_cb - Process port mapper notification for error
152 *
153 * @skb:
154 * @cb: Contains the received message (payload and netlink header)
155 */
156int iwpm_mapping_error_cb(struct sk_buff *, struct netlink_callback *);
157
158/**
159 * iwpm_mapping_info_cb - Process a notification that the userspace
160 * port mapper daemon is started
161 * @skb:
162 * @cb: Contains the received message (payload and netlink header)
163 *
164 * Using the received port mapper pid, send all the local mapping
165 * info records to the userspace port mapper
166 */
167int iwpm_mapping_info_cb(struct sk_buff *, struct netlink_callback *);
168
169/**
170 * iwpm_ack_mapping_info_cb - Process the port mapper ack for
171 * the provided local mapping info records
172 * @skb:
173 * @cb: Contains the received message (payload and netlink header)
174 */
175int iwpm_ack_mapping_info_cb(struct sk_buff *, struct netlink_callback *);
176
177/**
178 * iwpm_create_mapinfo - Store local and mapped IPv4/IPv6 address
179 * info in a hash table
180 * @local_addr: Local ip/tcp address
181 * @mapped_addr: Mapped local ip/tcp address
182 * @nl_client: The index of the netlink client
183 */
184int iwpm_create_mapinfo(struct sockaddr_storage *local_addr,
185 struct sockaddr_storage *mapped_addr, u8 nl_client);
186
187/**
188 * iwpm_remove_mapinfo - Remove local and mapped IPv4/IPv6 address
189 * info from the hash table
190 * @local_addr: Local ip/tcp address
191 * @mapped_addr: Mapped local ip/tcp address
192 *
193 * Returns err code if mapping info is not found in the hash table,
194 * otherwise returns 0
195 */
196int iwpm_remove_mapinfo(struct sockaddr_storage *local_addr,
197 struct sockaddr_storage *mapped_addr);
198
199#endif /* _IW_PORTMAP_H */
diff --git a/include/rdma/rdma_netlink.h b/include/rdma/rdma_netlink.h
index e38de79eeb48..0790882e0c9b 100644
--- a/include/rdma/rdma_netlink.h
+++ b/include/rdma/rdma_netlink.h
@@ -43,7 +43,7 @@ int ibnl_remove_client(int index);
43 * Returns the allocated buffer on success and NULL on failure. 43 * Returns the allocated buffer on success and NULL on failure.
44 */ 44 */
45void *ibnl_put_msg(struct sk_buff *skb, struct nlmsghdr **nlh, int seq, 45void *ibnl_put_msg(struct sk_buff *skb, struct nlmsghdr **nlh, int seq,
46 int len, int client, int op); 46 int len, int client, int op, int flags);
47/** 47/**
48 * Put a new attribute in a supplied skb. 48 * Put a new attribute in a supplied skb.
49 * @skb: The netlink skb. 49 * @skb: The netlink skb.
@@ -56,4 +56,25 @@ void *ibnl_put_msg(struct sk_buff *skb, struct nlmsghdr **nlh, int seq,
56int ibnl_put_attr(struct sk_buff *skb, struct nlmsghdr *nlh, 56int ibnl_put_attr(struct sk_buff *skb, struct nlmsghdr *nlh,
57 int len, void *data, int type); 57 int len, void *data, int type);
58 58
59/**
60 * Send the supplied skb to a specific userspace PID.
61 * @skb: The netlink skb
62 * @nlh: Header of the netlink message to send
63 * @pid: Userspace netlink process ID
64 * Returns 0 on success or a negative error code.
65 */
66int ibnl_unicast(struct sk_buff *skb, struct nlmsghdr *nlh,
67 __u32 pid);
68
69/**
70 * Send the supplied skb to a netlink group.
71 * @skb: The netlink skb
72 * @nlh: Header of the netlink message to send
73 * @group: Netlink group ID
74 * @flags: allocation flags
75 * Returns 0 on success or a negative error code.
76 */
77int ibnl_multicast(struct sk_buff *skb, struct nlmsghdr *nlh,
78 unsigned int group, gfp_t flags);
79
59#endif /* _RDMA_NETLINK_H */ 80#endif /* _RDMA_NETLINK_H */
diff --git a/include/scsi/osd_protocol.h b/include/scsi/osd_protocol.h
index 25ac6283b9c7..a2594afe05c7 100644
--- a/include/scsi/osd_protocol.h
+++ b/include/scsi/osd_protocol.h
@@ -263,16 +263,16 @@ static inline struct osd_cdb_head *osd_cdb_head(struct osd_cdb *ocdb)
263 * Ex name = FORMAT_OSD we have OSD_ACT_FORMAT_OSD && OSDv1_ACT_FORMAT_OSD 263 * Ex name = FORMAT_OSD we have OSD_ACT_FORMAT_OSD && OSDv1_ACT_FORMAT_OSD
264 */ 264 */
265#define OSD_ACT___(Name, Num) \ 265#define OSD_ACT___(Name, Num) \
266 OSD_ACT_##Name = __constant_cpu_to_be16(0x8880 + Num), \ 266 OSD_ACT_##Name = cpu_to_be16(0x8880 + Num), \
267 OSDv1_ACT_##Name = __constant_cpu_to_be16(0x8800 + Num), 267 OSDv1_ACT_##Name = cpu_to_be16(0x8800 + Num),
268 268
269/* V2 only actions */ 269/* V2 only actions */
270#define OSD_ACT_V2(Name, Num) \ 270#define OSD_ACT_V2(Name, Num) \
271 OSD_ACT_##Name = __constant_cpu_to_be16(0x8880 + Num), 271 OSD_ACT_##Name = cpu_to_be16(0x8880 + Num),
272 272
273#define OSD_ACT_V1_V2(Name, Num1, Num2) \ 273#define OSD_ACT_V1_V2(Name, Num1, Num2) \
274 OSD_ACT_##Name = __constant_cpu_to_be16(Num2), \ 274 OSD_ACT_##Name = cpu_to_be16(Num2), \
275 OSDv1_ACT_##Name = __constant_cpu_to_be16(Num1), 275 OSDv1_ACT_##Name = cpu_to_be16(Num1),
276 276
277enum osd_service_actions { 277enum osd_service_actions {
278 OSD_ACT_V2(OBJECT_STRUCTURE_CHECK, 0x00) 278 OSD_ACT_V2(OBJECT_STRUCTURE_CHECK, 0x00)
diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h
index dd7c998221b3..e0ae71098144 100644
--- a/include/scsi/scsi_cmnd.h
+++ b/include/scsi/scsi_cmnd.h
@@ -7,6 +7,7 @@
7#include <linux/types.h> 7#include <linux/types.h>
8#include <linux/timer.h> 8#include <linux/timer.h>
9#include <linux/scatterlist.h> 9#include <linux/scatterlist.h>
10#include <scsi/scsi_device.h>
10 11
11struct Scsi_Host; 12struct Scsi_Host;
12struct scsi_device; 13struct scsi_device;
@@ -133,6 +134,15 @@ struct scsi_cmnd {
133 unsigned char tag; /* SCSI-II queued command tag */ 134 unsigned char tag; /* SCSI-II queued command tag */
134}; 135};
135 136
137/*
138 * Return the driver private allocation behind the command.
139 * Only works if cmd_size is set in the host template.
140 */
141static inline void *scsi_cmd_priv(struct scsi_cmnd *cmd)
142{
143 return cmd + 1;
144}
145
136/* make sure not to use it with REQ_TYPE_BLOCK_PC commands */ 146/* make sure not to use it with REQ_TYPE_BLOCK_PC commands */
137static inline struct scsi_driver *scsi_cmd_to_driver(struct scsi_cmnd *cmd) 147static inline struct scsi_driver *scsi_cmd_to_driver(struct scsi_cmnd *cmd)
138{ 148{
@@ -306,4 +316,20 @@ static inline void set_driver_byte(struct scsi_cmnd *cmd, char status)
306 cmd->result = (cmd->result & 0x00ffffff) | (status << 24); 316 cmd->result = (cmd->result & 0x00ffffff) | (status << 24);
307} 317}
308 318
319static inline unsigned scsi_transfer_length(struct scsi_cmnd *scmd)
320{
321 unsigned int xfer_len = scsi_out(scmd)->length;
322 unsigned int prot_op = scsi_get_prot_op(scmd);
323 unsigned int sector_size = scmd->device->sector_size;
324
325 switch (prot_op) {
326 case SCSI_PROT_NORMAL:
327 case SCSI_PROT_WRITE_STRIP:
328 case SCSI_PROT_READ_INSERT:
329 return xfer_len;
330 }
331
332 return xfer_len + (xfer_len >> ilog2(sector_size)) * 8;
333}
334
309#endif /* _SCSI_SCSI_CMND_H */ 335#endif /* _SCSI_SCSI_CMND_H */
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index 5853c913d2b0..27ab31017f09 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -173,6 +173,7 @@ struct scsi_device {
173 unsigned is_visible:1; /* is the device visible in sysfs */ 173 unsigned is_visible:1; /* is the device visible in sysfs */
174 unsigned wce_default_on:1; /* Cache is ON by default */ 174 unsigned wce_default_on:1; /* Cache is ON by default */
175 unsigned no_dif:1; /* T10 PI (DIF) should be disabled */ 175 unsigned no_dif:1; /* T10 PI (DIF) should be disabled */
176 unsigned broken_fua:1; /* Don't set FUA bit */
176 177
177 atomic_t disk_events_disable_depth; /* disable depth for disk events */ 178 atomic_t disk_events_disable_depth; /* disable depth for disk events */
178 179
diff --git a/include/scsi/scsi_driver.h b/include/scsi/scsi_driver.h
index 20fdfc2526ad..36c4114ed9bc 100644
--- a/include/scsi/scsi_driver.h
+++ b/include/scsi/scsi_driver.h
@@ -4,17 +4,17 @@
4#include <linux/device.h> 4#include <linux/device.h>
5 5
6struct module; 6struct module;
7struct request;
7struct scsi_cmnd; 8struct scsi_cmnd;
8struct scsi_device; 9struct scsi_device;
9struct request;
10struct request_queue;
11
12 10
13struct scsi_driver { 11struct scsi_driver {
14 struct module *owner; 12 struct module *owner;
15 struct device_driver gendrv; 13 struct device_driver gendrv;
16 14
17 void (*rescan)(struct device *); 15 void (*rescan)(struct device *);
16 int (*init_command)(struct scsi_cmnd *);
17 void (*uninit_command)(struct scsi_cmnd *);
18 int (*done)(struct scsi_cmnd *); 18 int (*done)(struct scsi_cmnd *);
19 int (*eh_action)(struct scsi_cmnd *, int); 19 int (*eh_action)(struct scsi_cmnd *, int);
20}; 20};
@@ -31,8 +31,5 @@ extern int scsi_register_interface(struct class_interface *);
31 31
32int scsi_setup_blk_pc_cmnd(struct scsi_device *sdev, struct request *req); 32int scsi_setup_blk_pc_cmnd(struct scsi_device *sdev, struct request *req);
33int scsi_setup_fs_cmnd(struct scsi_device *sdev, struct request *req); 33int scsi_setup_fs_cmnd(struct scsi_device *sdev, struct request *req);
34int scsi_prep_state_check(struct scsi_device *sdev, struct request *req);
35int scsi_prep_return(struct request_queue *q, struct request *req, int ret);
36int scsi_prep_fn(struct request_queue *, struct request *);
37 34
38#endif /* _SCSI_SCSI_DRIVER_H */ 35#endif /* _SCSI_SCSI_DRIVER_H */
diff --git a/include/sound/atmel-ac97c.h b/include/sound/atmel-ac97c.h
index e6aabdb45865..00e6c289a936 100644
--- a/include/sound/atmel-ac97c.h
+++ b/include/sound/atmel-ac97c.h
@@ -23,7 +23,6 @@
23 * @reset_pin: GPIO pin wired to the reset input on the external AC97 codec, 23 * @reset_pin: GPIO pin wired to the reset input on the external AC97 codec,
24 * optional to use, set to -ENODEV if not in use. AC97 layer will 24 * optional to use, set to -ENODEV if not in use. AC97 layer will
25 * try to do a software reset of the external codec anyway. 25 * try to do a software reset of the external codec anyway.
26 * @flags: Flags for which directions should be enabled.
27 * 26 *
28 * If the user do not want to use a DMA channel for playback or capture, i.e. 27 * If the user do not want to use a DMA channel for playback or capture, i.e.
29 * only one feature is required on the board. The slave for playback or capture 28 * only one feature is required on the board. The slave for playback or capture
@@ -33,7 +32,6 @@
33struct ac97c_platform_data { 32struct ac97c_platform_data {
34 struct dw_dma_slave rx_dws; 33 struct dw_dma_slave rx_dws;
35 struct dw_dma_slave tx_dws; 34 struct dw_dma_slave tx_dws;
36 unsigned int flags;
37 int reset_pin; 35 int reset_pin;
38}; 36};
39 37
diff --git a/include/sound/core.h b/include/sound/core.h
index d3f5f818e0b9..1df3f2fe5350 100644
--- a/include/sound/core.h
+++ b/include/sound/core.h
@@ -116,6 +116,8 @@ struct snd_card {
116 int user_ctl_count; /* count of all user controls */ 116 int user_ctl_count; /* count of all user controls */
117 struct list_head controls; /* all controls for this card */ 117 struct list_head controls; /* all controls for this card */
118 struct list_head ctl_files; /* active control files */ 118 struct list_head ctl_files; /* active control files */
119 struct mutex user_ctl_lock; /* protects user controls against
120 concurrent access */
119 121
120 struct snd_info_entry *proc_root; /* root for soundcard specific files */ 122 struct snd_info_entry *proc_root; /* root for soundcard specific files */
121 struct snd_info_entry *proc_id; /* the card id */ 123 struct snd_info_entry *proc_id; /* the card id */
@@ -282,13 +284,6 @@ int snd_card_new(struct device *parent, int idx, const char *xid,
282 struct module *module, int extra_size, 284 struct module *module, int extra_size,
283 struct snd_card **card_ret); 285 struct snd_card **card_ret);
284 286
285static inline int __deprecated
286snd_card_create(int idx, const char *id, struct module *module, int extra_size,
287 struct snd_card **ret)
288{
289 return snd_card_new(NULL, idx, id, module, extra_size, ret);
290}
291
292int snd_card_disconnect(struct snd_card *card); 287int snd_card_disconnect(struct snd_card *card);
293int snd_card_free(struct snd_card *card); 288int snd_card_free(struct snd_card *card);
294int snd_card_free_when_closed(struct snd_card *card); 289int snd_card_free_when_closed(struct snd_card *card);
diff --git a/include/sound/cs42l56.h b/include/sound/cs42l56.h
new file mode 100644
index 000000000000..2467c8ff132c
--- /dev/null
+++ b/include/sound/cs42l56.h
@@ -0,0 +1,48 @@
1/*
2 * linux/sound/cs42l56.h -- Platform data for CS42L56
3 *
4 * Copyright (c) 2014 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 __CS42L56_H
12#define __CS42L56_H
13
14struct cs42l56_platform_data {
15
16 /* GPIO for Reset */
17 unsigned int gpio_nreset;
18
19 /* MICBIAS Level. Check datasheet Pg48 */
20 unsigned int micbias_lvl;
21
22 /* Analog Input 1A Reference 0=Single 1=Pseudo-Differential */
23 unsigned int ain1a_ref_cfg;
24
25 /* Analog Input 2A Reference 0=Single 1=Pseudo-Differential */
26 unsigned int ain2a_ref_cfg;
27
28 /* Analog Input 1B Reference 0=Single 1=Pseudo-Differential */
29 unsigned int ain1b_ref_cfg;
30
31 /* Analog Input 2B Reference 0=Single 1=Pseudo-Differential */
32 unsigned int ain2b_ref_cfg;
33
34 /* Charge Pump Freq. Check datasheet Pg62 */
35 unsigned int chgfreq;
36
37 /* HighPass Filter Right Channel Corner Frequency */
38 unsigned int hpfb_freq;
39
40 /* HighPass Filter Left Channel Corner Frequency */
41 unsigned int hpfa_freq;
42
43 /* Adaptive Power Control for LO/HP */
44 unsigned int adaptive_pwr;
45
46};
47
48#endif /* __CS42L56_H */
diff --git a/include/sound/omap-pcm.h b/include/sound/omap-pcm.h
new file mode 100644
index 000000000000..c1d2f31d71e9
--- /dev/null
+++ b/include/sound/omap-pcm.h
@@ -0,0 +1,30 @@
1/*
2 * omap-pcm.h - OMAP PCM driver
3 *
4 * Copyright (C) 2014 Texas Instruments, Inc.
5 *
6 * Author: Peter Ujfalusi <peter.ujfalusi@ti.com>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * version 2 as published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 */
17
18#ifndef __OMAP_PCM_H__
19#define __OMAP_PCM_H__
20
21#if IS_ENABLED(CONFIG_SND_OMAP_SOC)
22int omap_pcm_platform_register(struct device *dev);
23#else
24static inline int omap_pcm_platform_register(struct device *dev)
25{
26 return 0;
27}
28#endif /* CONFIG_SND_OMAP_SOC */
29
30#endif /* __OMAP_PCM_H__ */
diff --git a/include/sound/pcm.h b/include/sound/pcm.h
index b4d6697085fe..d854fb31c000 100644
--- a/include/sound/pcm.h
+++ b/include/sound/pcm.h
@@ -932,7 +932,7 @@ static inline void snd_pcm_gettime(struct snd_pcm_runtime *runtime,
932 struct timespec *tv) 932 struct timespec *tv)
933{ 933{
934 if (runtime->tstamp_type == SNDRV_PCM_TSTAMP_TYPE_MONOTONIC) 934 if (runtime->tstamp_type == SNDRV_PCM_TSTAMP_TYPE_MONOTONIC)
935 do_posix_clock_monotonic_gettime(tv); 935 ktime_get_ts(tv);
936 else 936 else
937 getnstimeofday(tv); 937 getnstimeofday(tv);
938} 938}
diff --git a/include/sound/rcar_snd.h b/include/sound/rcar_snd.h
index 34a3c02a4576..f4a706f82cb7 100644
--- a/include/sound/rcar_snd.h
+++ b/include/sound/rcar_snd.h
@@ -34,47 +34,39 @@
34 * B : SSI direction 34 * B : SSI direction
35 */ 35 */
36#define RSND_SSI_CLK_PIN_SHARE (1 << 31) 36#define RSND_SSI_CLK_PIN_SHARE (1 << 31)
37#define RSND_SSI_PLAY (1 << 24)
38 37
39#define RSND_SSI(_dma_id, _pio_irq, _flags) \ 38#define RSND_SSI(_dma_id, _pio_irq, _flags) \
40{ .dma_id = _dma_id, .pio_irq = _pio_irq, .flags = _flags } 39{ .dma_id = _dma_id, .pio_irq = _pio_irq, .flags = _flags }
41#define RSND_SSI_SET(_dai_id, _dma_id, _pio_irq, _flags) \
42{ .dai_id = _dai_id, .dma_id = _dma_id, .pio_irq = _pio_irq, .flags = _flags }
43#define RSND_SSI_UNUSED \ 40#define RSND_SSI_UNUSED \
44{ .dai_id = -1, .dma_id = -1, .pio_irq = -1, .flags = 0 } 41{ .dma_id = -1, .pio_irq = -1, .flags = 0 }
45 42
46struct rsnd_ssi_platform_info { 43struct rsnd_ssi_platform_info {
47 int dai_id; /* will be removed */
48 int dma_id; 44 int dma_id;
49 int pio_irq; 45 int pio_irq;
50 u32 flags; 46 u32 flags;
51}; 47};
52 48
53/*
54 * flags
55 */
56#define RSND_SCU_USE_HPBIF (1 << 31) /* it needs RSND_SSI_DEPENDENT */
57
58#define RSND_SRC(rate, _dma_id) \ 49#define RSND_SRC(rate, _dma_id) \
59{ .flags = RSND_SCU_USE_HPBIF, .convert_rate = rate, .dma_id = _dma_id, } 50{ .convert_rate = rate, .dma_id = _dma_id, }
60#define RSND_SRC_SET(rate, _dma_id) \
61 { .flags = RSND_SCU_USE_HPBIF, .convert_rate = rate, .dma_id = _dma_id, }
62#define RSND_SRC_UNUSED \ 51#define RSND_SRC_UNUSED \
63 { .flags = 0, .convert_rate = 0, .dma_id = 0, } 52{ .convert_rate = 0, .dma_id = -1, }
64
65#define rsnd_scu_platform_info rsnd_src_platform_info
66#define src_info scu_info
67#define src_info_nr scu_info_nr
68 53
69struct rsnd_src_platform_info { 54struct rsnd_src_platform_info {
70 u32 flags;
71 u32 convert_rate; /* sampling rate convert */ 55 u32 convert_rate; /* sampling rate convert */
72 int dma_id; /* for Gen2 SCU */ 56 int dma_id; /* for Gen2 SCU */
73}; 57};
74 58
59/*
60 * flags
61 */
62struct rsnd_dvc_platform_info {
63 u32 flags;
64};
65
75struct rsnd_dai_path_info { 66struct rsnd_dai_path_info {
76 struct rsnd_ssi_platform_info *ssi; 67 struct rsnd_ssi_platform_info *ssi;
77 struct rsnd_src_platform_info *src; 68 struct rsnd_src_platform_info *src;
69 struct rsnd_dvc_platform_info *dvc;
78}; 70};
79 71
80struct rsnd_dai_platform_info { 72struct rsnd_dai_platform_info {
@@ -99,6 +91,8 @@ struct rcar_snd_info {
99 int ssi_info_nr; 91 int ssi_info_nr;
100 struct rsnd_src_platform_info *src_info; 92 struct rsnd_src_platform_info *src_info;
101 int src_info_nr; 93 int src_info_nr;
94 struct rsnd_dvc_platform_info *dvc_info;
95 int dvc_info_nr;
102 struct rsnd_dai_platform_info *dai_info; 96 struct rsnd_dai_platform_info *dai_info;
103 int dai_info_nr; 97 int dai_info_nr;
104 int (*start)(int id); 98 int (*start)(int id);
diff --git a/include/sound/rt5640.h b/include/sound/rt5640.h
index 27cc75ed67f8..59d26dd81e45 100644
--- a/include/sound/rt5640.h
+++ b/include/sound/rt5640.h
@@ -16,6 +16,10 @@ struct rt5640_platform_data {
16 bool in1_diff; 16 bool in1_diff;
17 bool in2_diff; 17 bool in2_diff;
18 18
19 bool dmic_en;
20 bool dmic1_data_pin; /* 0 = IN1P; 1 = GPIO3 */
21 bool dmic2_data_pin; /* 0 = IN1N; 1 = GPIO4 */
22
19 int ldo1_en; /* GPIO for LDO1_EN */ 23 int ldo1_en; /* GPIO for LDO1_EN */
20}; 24};
21 25
diff --git a/include/sound/rt5645.h b/include/sound/rt5645.h
new file mode 100644
index 000000000000..1de744c242f6
--- /dev/null
+++ b/include/sound/rt5645.h
@@ -0,0 +1,25 @@
1/*
2 * linux/sound/rt5645.h -- Platform data for RT5645
3 *
4 * Copyright 2013 Realtek Microelectronics
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_RT5645_H
12#define __LINUX_SND_RT5645_H
13
14struct rt5645_platform_data {
15 /* IN2 can optionally be differential */
16 bool in2_diff;
17
18 bool dmic_en;
19 unsigned int dmic1_data_pin;
20 /* 0 = IN2N; 1 = GPIO5; 2 = GPIO11 */
21 unsigned int dmic2_data_pin;
22 /* 0 = IN2P; 1 = GPIO6; 2 = GPIO10; 3 = GPIO12 */
23};
24
25#endif
diff --git a/include/sound/rt5651.h b/include/sound/rt5651.h
new file mode 100644
index 000000000000..d35de758dfb5
--- /dev/null
+++ b/include/sound/rt5651.h
@@ -0,0 +1,21 @@
1/*
2 * linux/sound/rt286.h -- Platform data for RT286
3 *
4 * Copyright 2013 Realtek Microelectronics
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_RT5651_H
12#define __LINUX_SND_RT5651_H
13
14struct rt5651_platform_data {
15 /* IN2 can optionally be differential */
16 bool in2_diff;
17
18 bool dmic_en;
19};
20
21#endif
diff --git a/include/sound/rt5677.h b/include/sound/rt5677.h
new file mode 100644
index 000000000000..3da14313bcfc
--- /dev/null
+++ b/include/sound/rt5677.h
@@ -0,0 +1,21 @@
1/*
2 * linux/sound/rt5677.h -- Platform data for RT5677
3 *
4 * Copyright 2013 Realtek Semiconductor Corp.
5 * Author: Oder Chiou <oder_chiou@realtek.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef __LINUX_SND_RT5677_H
13#define __LINUX_SND_RT5677_H
14
15struct rt5677_platform_data {
16 /* IN1 IN2 can optionally be differential */
17 bool in1_diff;
18 bool in2_diff;
19};
20
21#endif
diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h
index fad76769f153..688f2ba8009f 100644
--- a/include/sound/soc-dai.h
+++ b/include/sound/soc-dai.h
@@ -252,7 +252,6 @@ struct snd_soc_dai {
252 unsigned int symmetric_rates:1; 252 unsigned int symmetric_rates:1;
253 unsigned int symmetric_channels:1; 253 unsigned int symmetric_channels:1;
254 unsigned int symmetric_samplebits:1; 254 unsigned int symmetric_samplebits:1;
255 struct snd_pcm_runtime *runtime;
256 unsigned int active; 255 unsigned int active;
257 unsigned char probed:1; 256 unsigned char probed:1;
258 257
@@ -277,7 +276,6 @@ struct snd_soc_dai {
277 struct snd_soc_card *card; 276 struct snd_soc_card *card;
278 277
279 struct list_head list; 278 struct list_head list;
280 struct list_head card_list;
281}; 279};
282 280
283static inline void *snd_soc_dai_get_dma_data(const struct snd_soc_dai *dai, 281static inline void *snd_soc_dai_get_dma_data(const struct snd_soc_dai *dai,
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index ef78f562f4a8..6b59471cdf44 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -107,10 +107,6 @@ struct device;
107{ .id = snd_soc_dapm_mux, .name = wname, \ 107{ .id = snd_soc_dapm_mux, .name = wname, \
108 SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \ 108 SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
109 .kcontrol_news = wcontrols, .num_kcontrols = 1} 109 .kcontrol_news = wcontrols, .num_kcontrols = 1}
110#define SND_SOC_DAPM_VIRT_MUX(wname, wreg, wshift, winvert, wcontrols) \
111 SND_SOC_DAPM_MUX(wname, wreg, wshift, winvert, wcontrols)
112#define SND_SOC_DAPM_VALUE_MUX(wname, wreg, wshift, winvert, wcontrols) \
113 SND_SOC_DAPM_MUX(wname, wreg, wshift, winvert, wcontrols)
114 110
115/* Simplified versions of above macros, assuming wncontrols = ARRAY_SIZE(wcontrols) */ 111/* Simplified versions of above macros, assuming wncontrols = ARRAY_SIZE(wcontrols) */
116#define SOC_PGA_ARRAY(wname, wreg, wshift, winvert,\ 112#define SOC_PGA_ARRAY(wname, wreg, wshift, winvert,\
@@ -166,10 +162,6 @@ struct device;
166 SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \ 162 SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
167 .kcontrol_news = wcontrols, .num_kcontrols = 1, \ 163 .kcontrol_news = wcontrols, .num_kcontrols = 1, \
168 .event = wevent, .event_flags = wflags} 164 .event = wevent, .event_flags = wflags}
169#define SND_SOC_DAPM_VIRT_MUX_E(wname, wreg, wshift, winvert, wcontrols, \
170 wevent, wflags) \
171 SND_SOC_DAPM_MUX_E(wname, wreg, wshift, winvert, wcontrols, wevent, \
172 wflags)
173 165
174/* additional sequencing control within an event type */ 166/* additional sequencing control within an event type */
175#define SND_SOC_DAPM_PGA_S(wname, wsubseq, wreg, wshift, winvert, \ 167#define SND_SOC_DAPM_PGA_S(wname, wsubseq, wreg, wshift, winvert, \
@@ -256,9 +248,8 @@ struct device;
256/* generic widgets */ 248/* generic widgets */
257#define SND_SOC_DAPM_REG(wid, wname, wreg, wshift, wmask, won_val, woff_val) \ 249#define SND_SOC_DAPM_REG(wid, wname, wreg, wshift, wmask, won_val, woff_val) \
258{ .id = wid, .name = wname, .kcontrol_news = NULL, .num_kcontrols = 0, \ 250{ .id = wid, .name = wname, .kcontrol_news = NULL, .num_kcontrols = 0, \
259 .reg = -((wreg) + 1), .shift = wshift, .mask = wmask, \ 251 .reg = wreg, .shift = wshift, .mask = wmask, \
260 .on_val = won_val, .off_val = woff_val, .event = dapm_reg_event, \ 252 .on_val = won_val, .off_val = woff_val, }
261 .event_flags = SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD}
262#define SND_SOC_DAPM_SUPPLY(wname, wreg, wshift, winvert, wevent, wflags) \ 253#define SND_SOC_DAPM_SUPPLY(wname, wreg, wshift, winvert, wevent, wflags) \
263{ .id = snd_soc_dapm_supply, .name = wname, \ 254{ .id = snd_soc_dapm_supply, .name = wname, \
264 SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \ 255 SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
@@ -305,16 +296,12 @@ struct device;
305 .get = snd_soc_dapm_get_enum_double, \ 296 .get = snd_soc_dapm_get_enum_double, \
306 .put = snd_soc_dapm_put_enum_double, \ 297 .put = snd_soc_dapm_put_enum_double, \
307 .private_value = (unsigned long)&xenum } 298 .private_value = (unsigned long)&xenum }
308#define SOC_DAPM_ENUM_VIRT(xname, xenum) \
309 SOC_DAPM_ENUM(xname, xenum)
310#define SOC_DAPM_ENUM_EXT(xname, xenum, xget, xput) \ 299#define SOC_DAPM_ENUM_EXT(xname, xenum, xget, xput) \
311{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ 300{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
312 .info = snd_soc_info_enum_double, \ 301 .info = snd_soc_info_enum_double, \
313 .get = xget, \ 302 .get = xget, \
314 .put = xput, \ 303 .put = xput, \
315 .private_value = (unsigned long)&xenum } 304 .private_value = (unsigned long)&xenum }
316#define SOC_DAPM_VALUE_ENUM(xname, xenum) \
317 SOC_DAPM_ENUM(xname, xenum)
318#define SOC_DAPM_PIN_SWITCH(xname) \ 305#define SOC_DAPM_PIN_SWITCH(xname) \
319{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname " Switch", \ 306{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname " Switch", \
320 .info = snd_soc_dapm_info_pin_switch, \ 307 .info = snd_soc_dapm_info_pin_switch, \
@@ -362,8 +349,6 @@ struct regulator;
362struct snd_soc_dapm_widget_list; 349struct snd_soc_dapm_widget_list;
363struct snd_soc_dapm_update; 350struct snd_soc_dapm_update;
364 351
365int dapm_reg_event(struct snd_soc_dapm_widget *w,
366 struct snd_kcontrol *kcontrol, int event);
367int dapm_regulator_event(struct snd_soc_dapm_widget *w, 352int dapm_regulator_event(struct snd_soc_dapm_widget *w,
368 struct snd_kcontrol *kcontrol, int event); 353 struct snd_kcontrol *kcontrol, int event);
369int dapm_clock_event(struct snd_soc_dapm_widget *w, 354int dapm_clock_event(struct snd_soc_dapm_widget *w,
@@ -606,6 +591,7 @@ struct snd_soc_dapm_context {
606 enum snd_soc_dapm_type, int); 591 enum snd_soc_dapm_type, int);
607 592
608 struct device *dev; /* from parent - for debug */ 593 struct device *dev; /* from parent - for debug */
594 struct snd_soc_component *component; /* parent component */
609 struct snd_soc_codec *codec; /* parent codec */ 595 struct snd_soc_codec *codec; /* parent codec */
610 struct snd_soc_platform *platform; /* parent platform */ 596 struct snd_soc_platform *platform; /* parent platform */
611 struct snd_soc_card *card; /* parent card */ 597 struct snd_soc_card *card; /* parent card */
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 0b83168d8ff4..ed9e2d7e5fdc 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -196,8 +196,6 @@
196 .info = snd_soc_info_enum_double, \ 196 .info = snd_soc_info_enum_double, \
197 .get = snd_soc_get_enum_double, .put = snd_soc_put_enum_double, \ 197 .get = snd_soc_get_enum_double, .put = snd_soc_put_enum_double, \
198 .private_value = (unsigned long)&xenum } 198 .private_value = (unsigned long)&xenum }
199#define SOC_VALUE_ENUM(xname, xenum) \
200 SOC_ENUM(xname, xenum)
201#define SOC_SINGLE_EXT(xname, xreg, xshift, xmax, xinvert,\ 199#define SOC_SINGLE_EXT(xname, xreg, xshift, xmax, xinvert,\
202 xhandler_get, xhandler_put) \ 200 xhandler_get, xhandler_put) \
203{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ 201{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
@@ -266,6 +264,13 @@
266 {.base = xbase, .num_regs = xregs, \ 264 {.base = xbase, .num_regs = xregs, \
267 .mask = xmask }) } 265 .mask = xmask }) }
268 266
267#define SND_SOC_BYTES_EXT(xname, xcount, xhandler_get, xhandler_put) \
268{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
269 .info = snd_soc_bytes_info_ext, \
270 .get = xhandler_get, .put = xhandler_put, \
271 .private_value = (unsigned long)&(struct soc_bytes_ext) \
272 {.max = xcount} }
273
269#define SOC_SINGLE_XR_SX(xname, xregbase, xregcount, xnbits, \ 274#define SOC_SINGLE_XR_SX(xname, xregbase, xregcount, xnbits, \
270 xmin, xmax, xinvert) \ 275 xmin, xmax, xinvert) \
271{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \ 276{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
@@ -377,6 +382,8 @@ int snd_soc_resume(struct device *dev);
377int snd_soc_poweroff(struct device *dev); 382int snd_soc_poweroff(struct device *dev);
378int snd_soc_register_platform(struct device *dev, 383int snd_soc_register_platform(struct device *dev,
379 const struct snd_soc_platform_driver *platform_drv); 384 const struct snd_soc_platform_driver *platform_drv);
385int devm_snd_soc_register_platform(struct device *dev,
386 const struct snd_soc_platform_driver *platform_drv);
380void snd_soc_unregister_platform(struct device *dev); 387void snd_soc_unregister_platform(struct device *dev);
381int snd_soc_add_platform(struct device *dev, struct snd_soc_platform *platform, 388int snd_soc_add_platform(struct device *dev, struct snd_soc_platform *platform,
382 const struct snd_soc_platform_driver *platform_drv); 389 const struct snd_soc_platform_driver *platform_drv);
@@ -393,14 +400,6 @@ int devm_snd_soc_register_component(struct device *dev,
393 const struct snd_soc_component_driver *cmpnt_drv, 400 const struct snd_soc_component_driver *cmpnt_drv,
394 struct snd_soc_dai_driver *dai_drv, int num_dai); 401 struct snd_soc_dai_driver *dai_drv, int num_dai);
395void snd_soc_unregister_component(struct device *dev); 402void snd_soc_unregister_component(struct device *dev);
396int snd_soc_codec_volatile_register(struct snd_soc_codec *codec,
397 unsigned int reg);
398int snd_soc_codec_readable_register(struct snd_soc_codec *codec,
399 unsigned int reg);
400int snd_soc_codec_writable_register(struct snd_soc_codec *codec,
401 unsigned int reg);
402int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec,
403 struct regmap *regmap);
404int snd_soc_cache_sync(struct snd_soc_codec *codec); 403int snd_soc_cache_sync(struct snd_soc_codec *codec);
405int snd_soc_cache_init(struct snd_soc_codec *codec); 404int snd_soc_cache_init(struct snd_soc_codec *codec);
406int snd_soc_cache_exit(struct snd_soc_codec *codec); 405int snd_soc_cache_exit(struct snd_soc_codec *codec);
@@ -453,6 +452,9 @@ int snd_soc_jack_get_type(struct snd_soc_jack *jack, int micbias_voltage);
453#ifdef CONFIG_GPIOLIB 452#ifdef CONFIG_GPIOLIB
454int snd_soc_jack_add_gpios(struct snd_soc_jack *jack, int count, 453int snd_soc_jack_add_gpios(struct snd_soc_jack *jack, int count,
455 struct snd_soc_jack_gpio *gpios); 454 struct snd_soc_jack_gpio *gpios);
455int snd_soc_jack_add_gpiods(struct device *gpiod_dev,
456 struct snd_soc_jack *jack,
457 int count, struct snd_soc_jack_gpio *gpios);
456void snd_soc_jack_free_gpios(struct snd_soc_jack *jack, int count, 458void snd_soc_jack_free_gpios(struct snd_soc_jack *jack, int count,
457 struct snd_soc_jack_gpio *gpios); 459 struct snd_soc_jack_gpio *gpios);
458#else 460#else
@@ -462,6 +464,14 @@ static inline int snd_soc_jack_add_gpios(struct snd_soc_jack *jack, int count,
462 return 0; 464 return 0;
463} 465}
464 466
467static inline int snd_soc_jack_add_gpiods(struct device *gpiod_dev,
468 struct snd_soc_jack *jack,
469 int count,
470 struct snd_soc_jack_gpio *gpios)
471{
472 return 0;
473}
474
465static inline void snd_soc_jack_free_gpios(struct snd_soc_jack *jack, int count, 475static inline void snd_soc_jack_free_gpios(struct snd_soc_jack *jack, int count,
466 struct snd_soc_jack_gpio *gpios) 476 struct snd_soc_jack_gpio *gpios)
467{ 477{
@@ -469,12 +479,12 @@ static inline void snd_soc_jack_free_gpios(struct snd_soc_jack *jack, int count,
469#endif 479#endif
470 480
471/* codec register bit access */ 481/* codec register bit access */
472int snd_soc_update_bits(struct snd_soc_codec *codec, unsigned short reg, 482int snd_soc_update_bits(struct snd_soc_codec *codec, unsigned int reg,
473 unsigned int mask, unsigned int value); 483 unsigned int mask, unsigned int value);
474int snd_soc_update_bits_locked(struct snd_soc_codec *codec, 484int snd_soc_update_bits_locked(struct snd_soc_codec *codec,
475 unsigned short reg, unsigned int mask, 485 unsigned int reg, unsigned int mask,
476 unsigned int value); 486 unsigned int value);
477int snd_soc_test_bits(struct snd_soc_codec *codec, unsigned short reg, 487int snd_soc_test_bits(struct snd_soc_codec *codec, unsigned int reg,
478 unsigned int mask, unsigned int value); 488 unsigned int mask, unsigned int value);
479 489
480int snd_soc_new_ac97_codec(struct snd_soc_codec *codec, 490int snd_soc_new_ac97_codec(struct snd_soc_codec *codec,
@@ -540,6 +550,8 @@ int snd_soc_bytes_get(struct snd_kcontrol *kcontrol,
540 struct snd_ctl_elem_value *ucontrol); 550 struct snd_ctl_elem_value *ucontrol);
541int snd_soc_bytes_put(struct snd_kcontrol *kcontrol, 551int snd_soc_bytes_put(struct snd_kcontrol *kcontrol,
542 struct snd_ctl_elem_value *ucontrol); 552 struct snd_ctl_elem_value *ucontrol);
553int snd_soc_bytes_info_ext(struct snd_kcontrol *kcontrol,
554 struct snd_ctl_elem_info *ucontrol);
543int snd_soc_info_xr_sx(struct snd_kcontrol *kcontrol, 555int snd_soc_info_xr_sx(struct snd_kcontrol *kcontrol,
544 struct snd_ctl_elem_info *uinfo); 556 struct snd_ctl_elem_info *uinfo);
545int snd_soc_get_xr_sx(struct snd_kcontrol *kcontrol, 557int snd_soc_get_xr_sx(struct snd_kcontrol *kcontrol,
@@ -586,8 +598,12 @@ struct snd_soc_jack_zone {
586/** 598/**
587 * struct snd_soc_jack_gpio - Describes a gpio pin for jack detection 599 * struct snd_soc_jack_gpio - Describes a gpio pin for jack detection
588 * 600 *
589 * @gpio: gpio number 601 * @gpio: legacy gpio number
590 * @name: gpio name 602 * @idx: gpio descriptor index within the function of the GPIO
603 * consumer device
604 * @gpiod_dev GPIO consumer device
605 * @name: gpio name. Also as connection ID for the GPIO consumer
606 * device function name lookup
591 * @report: value to report when jack detected 607 * @report: value to report when jack detected
592 * @invert: report presence in low state 608 * @invert: report presence in low state
593 * @debouce_time: debouce time in ms 609 * @debouce_time: debouce time in ms
@@ -598,6 +614,8 @@ struct snd_soc_jack_zone {
598 */ 614 */
599struct snd_soc_jack_gpio { 615struct snd_soc_jack_gpio {
600 unsigned int gpio; 616 unsigned int gpio;
617 unsigned int idx;
618 struct device *gpiod_dev;
601 const char *name; 619 const char *name;
602 int report; 620 int report;
603 int invert; 621 int invert;
@@ -606,6 +624,7 @@ struct snd_soc_jack_gpio {
606 624
607 struct snd_soc_jack *jack; 625 struct snd_soc_jack *jack;
608 struct delayed_work work; 626 struct delayed_work work;
627 struct gpio_desc *desc;
609 628
610 void *data; 629 void *data;
611 int (*jack_status_check)(void *data); 630 int (*jack_status_check)(void *data);
@@ -668,6 +687,7 @@ struct snd_soc_component {
668 unsigned int active; 687 unsigned int active;
669 688
670 unsigned int ignore_pmdown_time:1; /* pmdown_time is ignored at stop */ 689 unsigned int ignore_pmdown_time:1; /* pmdown_time is ignored at stop */
690 unsigned int registered_as_component:1;
671 691
672 struct list_head list; 692 struct list_head list;
673 693
@@ -677,6 +697,14 @@ struct snd_soc_component {
677 const struct snd_soc_component_driver *driver; 697 const struct snd_soc_component_driver *driver;
678 698
679 struct list_head dai_list; 699 struct list_head dai_list;
700
701 int (*read)(struct snd_soc_component *, unsigned int, unsigned int *);
702 int (*write)(struct snd_soc_component *, unsigned int, unsigned int);
703
704 struct regmap *regmap;
705 int val_bytes;
706
707 struct mutex io_mutex;
680}; 708};
681 709
682/* SoC Audio Codec device */ 710/* SoC Audio Codec device */
@@ -691,10 +719,6 @@ struct snd_soc_codec {
691 struct snd_soc_card *card; 719 struct snd_soc_card *card;
692 struct list_head list; 720 struct list_head list;
693 struct list_head card_list; 721 struct list_head card_list;
694 int num_dai;
695 int (*volatile_register)(struct snd_soc_codec *, unsigned int);
696 int (*readable_register)(struct snd_soc_codec *, unsigned int);
697 int (*writable_register)(struct snd_soc_codec *, unsigned int);
698 722
699 /* runtime */ 723 /* runtime */
700 struct snd_ac97 *ac97; /* for ad-hoc ac97 devices */ 724 struct snd_ac97 *ac97; /* for ad-hoc ac97 devices */
@@ -704,18 +728,14 @@ struct snd_soc_codec {
704 unsigned int ac97_registered:1; /* Codec has been AC97 registered */ 728 unsigned int ac97_registered:1; /* Codec has been AC97 registered */
705 unsigned int ac97_created:1; /* Codec has been created by SoC */ 729 unsigned int ac97_created:1; /* Codec has been created by SoC */
706 unsigned int cache_init:1; /* codec cache has been initialized */ 730 unsigned int cache_init:1; /* codec cache has been initialized */
707 unsigned int using_regmap:1; /* using regmap access */
708 u32 cache_only; /* Suppress writes to hardware */ 731 u32 cache_only; /* Suppress writes to hardware */
709 u32 cache_sync; /* Cache needs to be synced to hardware */ 732 u32 cache_sync; /* Cache needs to be synced to hardware */
710 733
711 /* codec IO */ 734 /* codec IO */
712 void *control_data; /* codec control (i2c/3wire) data */ 735 void *control_data; /* codec control (i2c/3wire) data */
713 hw_write_t hw_write; 736 hw_write_t hw_write;
714 unsigned int (*read)(struct snd_soc_codec *, unsigned int);
715 int (*write)(struct snd_soc_codec *, unsigned int, unsigned int);
716 void *reg_cache; 737 void *reg_cache;
717 struct mutex cache_rw_mutex; 738 struct mutex cache_rw_mutex;
718 int val_bytes;
719 739
720 /* component */ 740 /* component */
721 struct snd_soc_component component; 741 struct snd_soc_component component;
@@ -754,13 +774,9 @@ struct snd_soc_codec_driver {
754 unsigned int freq_in, unsigned int freq_out); 774 unsigned int freq_in, unsigned int freq_out);
755 775
756 /* codec IO */ 776 /* codec IO */
777 struct regmap *(*get_regmap)(struct device *);
757 unsigned int (*read)(struct snd_soc_codec *, unsigned int); 778 unsigned int (*read)(struct snd_soc_codec *, unsigned int);
758 int (*write)(struct snd_soc_codec *, unsigned int, unsigned int); 779 int (*write)(struct snd_soc_codec *, unsigned int, unsigned int);
759 int (*display_register)(struct snd_soc_codec *, char *,
760 size_t, unsigned int);
761 int (*volatile_register)(struct snd_soc_codec *, unsigned int);
762 int (*readable_register)(struct snd_soc_codec *, unsigned int);
763 int (*writable_register)(struct snd_soc_codec *, unsigned int);
764 unsigned int reg_cache_size; 780 unsigned int reg_cache_size;
765 short reg_cache_step; 781 short reg_cache_step;
766 short reg_word_size; 782 short reg_word_size;
@@ -791,6 +807,7 @@ struct snd_soc_platform_driver {
791 int (*remove)(struct snd_soc_platform *); 807 int (*remove)(struct snd_soc_platform *);
792 int (*suspend)(struct snd_soc_dai *dai); 808 int (*suspend)(struct snd_soc_dai *dai);
793 int (*resume)(struct snd_soc_dai *dai); 809 int (*resume)(struct snd_soc_dai *dai);
810 struct snd_soc_component_driver component_driver;
794 811
795 /* pcm creation and destruction */ 812 /* pcm creation and destruction */
796 int (*pcm_new)(struct snd_soc_pcm_runtime *); 813 int (*pcm_new)(struct snd_soc_pcm_runtime *);
@@ -835,7 +852,6 @@ struct snd_soc_platform {
835 int id; 852 int id;
836 struct device *dev; 853 struct device *dev;
837 const struct snd_soc_platform_driver *driver; 854 const struct snd_soc_platform_driver *driver;
838 struct mutex mutex;
839 855
840 unsigned int suspended:1; /* platform is suspended */ 856 unsigned int suspended:1; /* platform is suspended */
841 unsigned int probed:1; 857 unsigned int probed:1;
@@ -844,6 +860,8 @@ struct snd_soc_platform {
844 struct list_head list; 860 struct list_head list;
845 struct list_head card_list; 861 struct list_head card_list;
846 862
863 struct snd_soc_component component;
864
847 struct snd_soc_dapm_context dapm; 865 struct snd_soc_dapm_context dapm;
848 866
849#ifdef CONFIG_DEBUG_FS 867#ifdef CONFIG_DEBUG_FS
@@ -931,7 +949,12 @@ struct snd_soc_dai_link {
931}; 949};
932 950
933struct snd_soc_codec_conf { 951struct snd_soc_codec_conf {
952 /*
953 * specify device either by device name, or by
954 * DT/OF node, but not both.
955 */
934 const char *dev_name; 956 const char *dev_name;
957 const struct device_node *of_node;
935 958
936 /* 959 /*
937 * optional map of kcontrol, widget and path name prefixes that are 960 * optional map of kcontrol, widget and path name prefixes that are
@@ -942,7 +965,13 @@ struct snd_soc_codec_conf {
942 965
943struct snd_soc_aux_dev { 966struct snd_soc_aux_dev {
944 const char *name; /* Codec name */ 967 const char *name; /* Codec name */
945 const char *codec_name; /* for multi-codec */ 968
969 /*
970 * specify multi-codec either by device name, or by
971 * DT/OF node, but not both.
972 */
973 const char *codec_name;
974 const struct device_node *codec_of_node;
946 975
947 /* codec/machine specific init - e.g. add machine controls */ 976 /* codec/machine specific init - e.g. add machine controls */
948 int (*init)(struct snd_soc_dapm_context *dapm); 977 int (*init)(struct snd_soc_dapm_context *dapm);
@@ -957,7 +986,6 @@ struct snd_soc_card {
957 struct snd_card *snd_card; 986 struct snd_card *snd_card;
958 struct module *owner; 987 struct module *owner;
959 988
960 struct list_head list;
961 struct mutex mutex; 989 struct mutex mutex;
962 struct mutex dapm_mutex; 990 struct mutex dapm_mutex;
963 991
@@ -1020,7 +1048,6 @@ struct snd_soc_card {
1020 /* lists of probed devices belonging to this card */ 1048 /* lists of probed devices belonging to this card */
1021 struct list_head codec_dev_list; 1049 struct list_head codec_dev_list;
1022 struct list_head platform_dev_list; 1050 struct list_head platform_dev_list;
1023 struct list_head dai_dev_list;
1024 1051
1025 struct list_head widgets; 1052 struct list_head widgets;
1026 struct list_head paths; 1053 struct list_head paths;
@@ -1090,6 +1117,10 @@ struct soc_bytes {
1090 u32 mask; 1117 u32 mask;
1091}; 1118};
1092 1119
1120struct soc_bytes_ext {
1121 int max;
1122};
1123
1093/* multi register control */ 1124/* multi register control */
1094struct soc_mreg_control { 1125struct soc_mreg_control {
1095 long min, max; 1126 long min, max;
@@ -1120,10 +1151,66 @@ static inline struct snd_soc_codec *snd_soc_component_to_codec(
1120 return container_of(component, struct snd_soc_codec, component); 1151 return container_of(component, struct snd_soc_codec, component);
1121} 1152}
1122 1153
1154/**
1155 * snd_soc_component_to_platform() - Casts a component to the platform it is embedded in
1156 * @component: The component to cast to a platform
1157 *
1158 * This function must only be used on components that are known to be platforms.
1159 * Otherwise the behavior is undefined.
1160 */
1161static inline struct snd_soc_platform *snd_soc_component_to_platform(
1162 struct snd_soc_component *component)
1163{
1164 return container_of(component, struct snd_soc_platform, component);
1165}
1166
1167/**
1168 * snd_soc_dapm_to_codec() - Casts a DAPM context to the CODEC it is embedded in
1169 * @dapm: The DAPM context to cast to the CODEC
1170 *
1171 * This function must only be used on DAPM contexts that are known to be part of
1172 * a CODEC (e.g. in a CODEC driver). Otherwise the behavior is undefined.
1173 */
1174static inline struct snd_soc_codec *snd_soc_dapm_to_codec(
1175 struct snd_soc_dapm_context *dapm)
1176{
1177 return container_of(dapm, struct snd_soc_codec, dapm);
1178}
1179
1180/**
1181 * snd_soc_dapm_to_platform() - Casts a DAPM context to the platform it is
1182 * embedded in
1183 * @dapm: The DAPM context to cast to the platform.
1184 *
1185 * This function must only be used on DAPM contexts that are known to be part of
1186 * a platform (e.g. in a platform driver). Otherwise the behavior is undefined.
1187 */
1188static inline struct snd_soc_platform *snd_soc_dapm_to_platform(
1189 struct snd_soc_dapm_context *dapm)
1190{
1191 return container_of(dapm, struct snd_soc_platform, dapm);
1192}
1193
1123/* codec IO */ 1194/* codec IO */
1124unsigned int snd_soc_read(struct snd_soc_codec *codec, unsigned int reg); 1195unsigned int snd_soc_read(struct snd_soc_codec *codec, unsigned int reg);
1125unsigned int snd_soc_write(struct snd_soc_codec *codec, 1196int snd_soc_write(struct snd_soc_codec *codec, unsigned int reg,
1126 unsigned int reg, unsigned int val); 1197 unsigned int val);
1198
1199/* component IO */
1200int snd_soc_component_read(struct snd_soc_component *component,
1201 unsigned int reg, unsigned int *val);
1202int snd_soc_component_write(struct snd_soc_component *component,
1203 unsigned int reg, unsigned int val);
1204int snd_soc_component_update_bits(struct snd_soc_component *component,
1205 unsigned int reg, unsigned int mask, unsigned int val);
1206int snd_soc_component_update_bits_async(struct snd_soc_component *component,
1207 unsigned int reg, unsigned int mask, unsigned int val);
1208void snd_soc_component_async_complete(struct snd_soc_component *component);
1209int snd_soc_component_test_bits(struct snd_soc_component *component,
1210 unsigned int reg, unsigned int mask, unsigned int value);
1211
1212int snd_soc_component_init_io(struct snd_soc_component *component,
1213 struct regmap *regmap);
1127 1214
1128/* device driver data */ 1215/* device driver data */
1129 1216
@@ -1173,7 +1260,6 @@ static inline void *snd_soc_pcm_get_drvdata(struct snd_soc_pcm_runtime *rtd)
1173 1260
1174static inline void snd_soc_initialize_card_lists(struct snd_soc_card *card) 1261static inline void snd_soc_initialize_card_lists(struct snd_soc_card *card)
1175{ 1262{
1176 INIT_LIST_HEAD(&card->dai_dev_list);
1177 INIT_LIST_HEAD(&card->codec_dev_list); 1263 INIT_LIST_HEAD(&card->codec_dev_list);
1178 INIT_LIST_HEAD(&card->platform_dev_list); 1264 INIT_LIST_HEAD(&card->platform_dev_list);
1179 INIT_LIST_HEAD(&card->widgets); 1265 INIT_LIST_HEAD(&card->widgets);
@@ -1228,6 +1314,50 @@ static inline bool snd_soc_codec_is_active(struct snd_soc_codec *codec)
1228 return snd_soc_component_is_active(&codec->component); 1314 return snd_soc_component_is_active(&codec->component);
1229} 1315}
1230 1316
1317/**
1318 * snd_soc_kcontrol_component() - Returns the component that registered the
1319 * control
1320 * @kcontrol: The control for which to get the component
1321 *
1322 * Note: This function will work correctly if the control has been registered
1323 * for a component. Either with snd_soc_add_codec_controls() or
1324 * snd_soc_add_platform_controls() or via table based setup for either a
1325 * CODEC, a platform or component driver. Otherwise the behavior is undefined.
1326 */
1327static inline struct snd_soc_component *snd_soc_kcontrol_component(
1328 struct snd_kcontrol *kcontrol)
1329{
1330 return snd_kcontrol_chip(kcontrol);
1331}
1332
1333/**
1334 * snd_soc_kcontrol_codec() - Returns the CODEC that registered the control
1335 * @kcontrol: The control for which to get the CODEC
1336 *
1337 * Note: This function will only work correctly if the control has been
1338 * registered with snd_soc_add_codec_controls() or via table based setup of
1339 * snd_soc_codec_driver. Otherwise the behavior is undefined.
1340 */
1341static inline struct snd_soc_codec *snd_soc_kcontrol_codec(
1342 struct snd_kcontrol *kcontrol)
1343{
1344 return snd_soc_component_to_codec(snd_soc_kcontrol_component(kcontrol));
1345}
1346
1347/**
1348 * snd_soc_kcontrol_platform() - Returns the platform that registerd the control
1349 * @kcontrol: The control for which to get the platform
1350 *
1351 * Note: This function will only work correctly if the control has been
1352 * registered with snd_soc_add_platform_controls() or via table based setup of
1353 * a snd_soc_platform_driver. Otherwise the behavior is undefined.
1354 */
1355static inline struct snd_soc_platform *snd_soc_kcontrol_platform(
1356 struct snd_kcontrol *kcontrol)
1357{
1358 return snd_soc_component_to_platform(snd_soc_kcontrol_component(kcontrol));
1359}
1360
1231int snd_soc_util_init(void); 1361int snd_soc_util_init(void);
1232void snd_soc_util_exit(void); 1362void snd_soc_util_exit(void);
1233 1363
@@ -1241,7 +1371,9 @@ int snd_soc_of_parse_tdm_slot(struct device_node *np,
1241int snd_soc_of_parse_audio_routing(struct snd_soc_card *card, 1371int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
1242 const char *propname); 1372 const char *propname);
1243unsigned int snd_soc_of_parse_daifmt(struct device_node *np, 1373unsigned int snd_soc_of_parse_daifmt(struct device_node *np,
1244 const char *prefix); 1374 const char *prefix,
1375 struct device_node **bitclkmaster,
1376 struct device_node **framemaster);
1245int snd_soc_of_get_dai_name(struct device_node *of_node, 1377int snd_soc_of_get_dai_name(struct device_node *of_node,
1246 const char **dai_name); 1378 const char **dai_name);
1247 1379
diff --git a/include/sound/sta350.h b/include/sound/sta350.h
new file mode 100644
index 000000000000..42edceb096a0
--- /dev/null
+++ b/include/sound/sta350.h
@@ -0,0 +1,57 @@
1/*
2 * Platform data for ST STA350 ASoC codec driver.
3 *
4 * Copyright: 2014 Raumfeld GmbH
5 * Author: Sven Brandau <info@brandau.biz>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 */
12#ifndef __LINUX_SND__STA350_H
13#define __LINUX_SND__STA350_H
14
15#define STA350_OCFG_2CH 0
16#define STA350_OCFG_2_1CH 1
17#define STA350_OCFG_1CH 3
18
19#define STA350_OM_CH1 0
20#define STA350_OM_CH2 1
21#define STA350_OM_CH3 2
22
23#define STA350_THERMAL_ADJUSTMENT_ENABLE 1
24#define STA350_THERMAL_RECOVERY_ENABLE 2
25#define STA350_FAULT_DETECT_RECOVERY_BYPASS 1
26
27#define STA350_FFX_PM_DROP_COMP 0
28#define STA350_FFX_PM_TAPERED_COMP 1
29#define STA350_FFX_PM_FULL_POWER 2
30#define STA350_FFX_PM_VARIABLE_DROP_COMP 3
31
32
33struct sta350_platform_data {
34 u8 output_conf;
35 u8 ch1_output_mapping;
36 u8 ch2_output_mapping;
37 u8 ch3_output_mapping;
38 u8 ffx_power_output_mode;
39 u8 drop_compensation_ns;
40 u8 powerdown_delay_divider;
41 unsigned int thermal_warning_recovery:1;
42 unsigned int thermal_warning_adjustment:1;
43 unsigned int fault_detect_recovery:1;
44 unsigned int oc_warning_adjustment:1;
45 unsigned int max_power_use_mpcc:1;
46 unsigned int max_power_correction:1;
47 unsigned int am_reduction_mode:1;
48 unsigned int odd_pwm_speed_mode:1;
49 unsigned int distortion_compensation:1;
50 unsigned int invalid_input_detect_mute:1;
51 unsigned int activate_mute_output:1;
52 unsigned int bridge_immediate_off:1;
53 unsigned int noise_shape_dc_cut:1;
54 unsigned int powerdown_master_vol:1;
55};
56
57#endif /* __LINUX_SND__STA350_H */
diff --git a/include/target/iscsi/iscsi_transport.h b/include/target/iscsi/iscsi_transport.h
index 33b487b5da92..daef9daa500c 100644
--- a/include/target/iscsi/iscsi_transport.h
+++ b/include/target/iscsi/iscsi_transport.h
@@ -70,7 +70,8 @@ extern void iscsit_build_nopin_rsp(struct iscsi_cmd *, struct iscsi_conn *,
70extern void iscsit_build_task_mgt_rsp(struct iscsi_cmd *, struct iscsi_conn *, 70extern void iscsit_build_task_mgt_rsp(struct iscsi_cmd *, struct iscsi_conn *,
71 struct iscsi_tm_rsp *); 71 struct iscsi_tm_rsp *);
72extern int iscsit_build_text_rsp(struct iscsi_cmd *, struct iscsi_conn *, 72extern int iscsit_build_text_rsp(struct iscsi_cmd *, struct iscsi_conn *,
73 struct iscsi_text_rsp *); 73 struct iscsi_text_rsp *,
74 enum iscsit_transport_type);
74extern void iscsit_build_reject(struct iscsi_cmd *, struct iscsi_conn *, 75extern void iscsit_build_reject(struct iscsi_cmd *, struct iscsi_conn *,
75 struct iscsi_reject *); 76 struct iscsi_reject *);
76extern int iscsit_build_logout_rsp(struct iscsi_cmd *, struct iscsi_conn *, 77extern int iscsit_build_logout_rsp(struct iscsi_cmd *, struct iscsi_conn *,
diff --git a/include/target/target_core_backend.h b/include/target/target_core_backend.h
index 3a1c1eea1fff..9adc1bca1178 100644
--- a/include/target/target_core_backend.h
+++ b/include/target/target_core_backend.h
@@ -59,6 +59,7 @@ int transport_subsystem_register(struct se_subsystem_api *);
59void transport_subsystem_release(struct se_subsystem_api *); 59void transport_subsystem_release(struct se_subsystem_api *);
60 60
61void target_complete_cmd(struct se_cmd *, u8); 61void target_complete_cmd(struct se_cmd *, u8);
62void target_complete_cmd_with_length(struct se_cmd *, u8, int);
62 63
63sense_reason_t spc_parse_cdb(struct se_cmd *cmd, unsigned int *size); 64sense_reason_t spc_parse_cdb(struct se_cmd *cmd, unsigned int *size);
64sense_reason_t spc_emulate_report_luns(struct se_cmd *cmd); 65sense_reason_t spc_emulate_report_luns(struct se_cmd *cmd);
diff --git a/include/trace/events/asoc.h b/include/trace/events/asoc.h
index 03996b2bb04f..c75c795a377b 100644
--- a/include/trace/events/asoc.h
+++ b/include/trace/events/asoc.h
@@ -11,102 +11,10 @@
11 11
12struct snd_soc_jack; 12struct snd_soc_jack;
13struct snd_soc_codec; 13struct snd_soc_codec;
14struct snd_soc_platform;
15struct snd_soc_card; 14struct snd_soc_card;
16struct snd_soc_dapm_widget; 15struct snd_soc_dapm_widget;
17struct snd_soc_dapm_path; 16struct snd_soc_dapm_path;
18 17
19/*
20 * Log register events
21 */
22DECLARE_EVENT_CLASS(snd_soc_reg,
23
24 TP_PROTO(struct snd_soc_codec *codec, unsigned int reg,
25 unsigned int val),
26
27 TP_ARGS(codec, reg, val),
28
29 TP_STRUCT__entry(
30 __string( name, codec->name )
31 __field( int, id )
32 __field( unsigned int, reg )
33 __field( unsigned int, val )
34 ),
35
36 TP_fast_assign(
37 __assign_str(name, codec->name);
38 __entry->id = codec->id;
39 __entry->reg = reg;
40 __entry->val = val;
41 ),
42
43 TP_printk("codec=%s.%d reg=%x val=%x", __get_str(name),
44 (int)__entry->id, (unsigned int)__entry->reg,
45 (unsigned int)__entry->val)
46);
47
48DEFINE_EVENT(snd_soc_reg, snd_soc_reg_write,
49
50 TP_PROTO(struct snd_soc_codec *codec, unsigned int reg,
51 unsigned int val),
52
53 TP_ARGS(codec, reg, val)
54
55);
56
57DEFINE_EVENT(snd_soc_reg, snd_soc_reg_read,
58
59 TP_PROTO(struct snd_soc_codec *codec, unsigned int reg,
60 unsigned int val),
61
62 TP_ARGS(codec, reg, val)
63
64);
65
66DECLARE_EVENT_CLASS(snd_soc_preg,
67
68 TP_PROTO(struct snd_soc_platform *platform, unsigned int reg,
69 unsigned int val),
70
71 TP_ARGS(platform, reg, val),
72
73 TP_STRUCT__entry(
74 __string( name, platform->name )
75 __field( int, id )
76 __field( unsigned int, reg )
77 __field( unsigned int, val )
78 ),
79
80 TP_fast_assign(
81 __assign_str(name, platform->name);
82 __entry->id = platform->id;
83 __entry->reg = reg;
84 __entry->val = val;
85 ),
86
87 TP_printk("platform=%s.%d reg=%x val=%x", __get_str(name),
88 (int)__entry->id, (unsigned int)__entry->reg,
89 (unsigned int)__entry->val)
90);
91
92DEFINE_EVENT(snd_soc_preg, snd_soc_preg_write,
93
94 TP_PROTO(struct snd_soc_platform *platform, unsigned int reg,
95 unsigned int val),
96
97 TP_ARGS(platform, reg, val)
98
99);
100
101DEFINE_EVENT(snd_soc_preg, snd_soc_preg_read,
102
103 TP_PROTO(struct snd_soc_platform *platform, unsigned int reg,
104 unsigned int val),
105
106 TP_ARGS(platform, reg, val)
107
108);
109
110DECLARE_EVENT_CLASS(snd_soc_card, 18DECLARE_EVENT_CLASS(snd_soc_card,
111 19
112 TP_PROTO(struct snd_soc_card *card, int val), 20 TP_PROTO(struct snd_soc_card *card, int val),
diff --git a/include/trace/events/compaction.h b/include/trace/events/compaction.h
index 06f544ef2f6f..c6814b917bdf 100644
--- a/include/trace/events/compaction.h
+++ b/include/trace/events/compaction.h
@@ -5,6 +5,7 @@
5#define _TRACE_COMPACTION_H 5#define _TRACE_COMPACTION_H
6 6
7#include <linux/types.h> 7#include <linux/types.h>
8#include <linux/list.h>
8#include <linux/tracepoint.h> 9#include <linux/tracepoint.h>
9#include <trace/events/gfpflags.h> 10#include <trace/events/gfpflags.h>
10 11
@@ -47,10 +48,11 @@ DEFINE_EVENT(mm_compaction_isolate_template, mm_compaction_isolate_freepages,
47 48
48TRACE_EVENT(mm_compaction_migratepages, 49TRACE_EVENT(mm_compaction_migratepages,
49 50
50 TP_PROTO(unsigned long nr_migrated, 51 TP_PROTO(unsigned long nr_all,
51 unsigned long nr_failed), 52 int migrate_rc,
53 struct list_head *migratepages),
52 54
53 TP_ARGS(nr_migrated, nr_failed), 55 TP_ARGS(nr_all, migrate_rc, migratepages),
54 56
55 TP_STRUCT__entry( 57 TP_STRUCT__entry(
56 __field(unsigned long, nr_migrated) 58 __field(unsigned long, nr_migrated)
@@ -58,7 +60,22 @@ TRACE_EVENT(mm_compaction_migratepages,
58 ), 60 ),
59 61
60 TP_fast_assign( 62 TP_fast_assign(
61 __entry->nr_migrated = nr_migrated; 63 unsigned long nr_failed = 0;
64 struct list_head *page_lru;
65
66 /*
67 * migrate_pages() returns either a non-negative number
68 * with the number of pages that failed migration, or an
69 * error code, in which case we need to count the remaining
70 * pages manually
71 */
72 if (migrate_rc >= 0)
73 nr_failed = migrate_rc;
74 else
75 list_for_each(page_lru, migratepages)
76 nr_failed++;
77
78 __entry->nr_migrated = nr_all - nr_failed;
62 __entry->nr_failed = nr_failed; 79 __entry->nr_failed = nr_failed;
63 ), 80 ),
64 81
diff --git a/include/trace/events/ext4.h b/include/trace/events/ext4.h
index 6a1a0245474f..d4f70a7fe876 100644
--- a/include/trace/events/ext4.h
+++ b/include/trace/events/ext4.h
@@ -36,7 +36,7 @@ struct extent_status;
36 36
37#define show_map_flags(flags) __print_flags(flags, "|", \ 37#define show_map_flags(flags) __print_flags(flags, "|", \
38 { EXT4_GET_BLOCKS_CREATE, "CREATE" }, \ 38 { EXT4_GET_BLOCKS_CREATE, "CREATE" }, \
39 { EXT4_GET_BLOCKS_UNINIT_EXT, "UNINIT" }, \ 39 { EXT4_GET_BLOCKS_UNWRIT_EXT, "UNWRIT" }, \
40 { EXT4_GET_BLOCKS_DELALLOC_RESERVE, "DELALLOC" }, \ 40 { EXT4_GET_BLOCKS_DELALLOC_RESERVE, "DELALLOC" }, \
41 { EXT4_GET_BLOCKS_PRE_IO, "PRE_IO" }, \ 41 { EXT4_GET_BLOCKS_PRE_IO, "PRE_IO" }, \
42 { EXT4_GET_BLOCKS_CONVERT, "CONVERT" }, \ 42 { EXT4_GET_BLOCKS_CONVERT, "CONVERT" }, \
@@ -51,7 +51,6 @@ struct extent_status;
51 { EXT4_MAP_MAPPED, "M" }, \ 51 { EXT4_MAP_MAPPED, "M" }, \
52 { EXT4_MAP_UNWRITTEN, "U" }, \ 52 { EXT4_MAP_UNWRITTEN, "U" }, \
53 { EXT4_MAP_BOUNDARY, "B" }, \ 53 { EXT4_MAP_BOUNDARY, "B" }, \
54 { EXT4_MAP_UNINIT, "u" }, \
55 { EXT4_MAP_FROM_CLUSTER, "C" }) 54 { EXT4_MAP_FROM_CLUSTER, "C" })
56 55
57#define show_free_flags(flags) __print_flags(flags, "|", \ 56#define show_free_flags(flags) __print_flags(flags, "|", \
@@ -1497,7 +1496,7 @@ DEFINE_EVENT(ext4__truncate, ext4_truncate_exit,
1497 TP_ARGS(inode) 1496 TP_ARGS(inode)
1498); 1497);
1499 1498
1500/* 'ux' is the uninitialized extent. */ 1499/* 'ux' is the unwritten extent. */
1501TRACE_EVENT(ext4_ext_convert_to_initialized_enter, 1500TRACE_EVENT(ext4_ext_convert_to_initialized_enter,
1502 TP_PROTO(struct inode *inode, struct ext4_map_blocks *map, 1501 TP_PROTO(struct inode *inode, struct ext4_map_blocks *map,
1503 struct ext4_extent *ux), 1502 struct ext4_extent *ux),
@@ -1533,7 +1532,7 @@ TRACE_EVENT(ext4_ext_convert_to_initialized_enter,
1533); 1532);
1534 1533
1535/* 1534/*
1536 * 'ux' is the uninitialized extent. 1535 * 'ux' is the unwritten extent.
1537 * 'ix' is the initialized extent to which blocks are transferred. 1536 * 'ix' is the initialized extent to which blocks are transferred.
1538 */ 1537 */
1539TRACE_EVENT(ext4_ext_convert_to_initialized_fastpath, 1538TRACE_EVENT(ext4_ext_convert_to_initialized_fastpath,
@@ -1811,7 +1810,7 @@ DEFINE_EVENT(ext4__trim, ext4_trim_all_free,
1811 TP_ARGS(sb, group, start, len) 1810 TP_ARGS(sb, group, start, len)
1812); 1811);
1813 1812
1814TRACE_EVENT(ext4_ext_handle_uninitialized_extents, 1813TRACE_EVENT(ext4_ext_handle_unwritten_extents,
1815 TP_PROTO(struct inode *inode, struct ext4_map_blocks *map, int flags, 1814 TP_PROTO(struct inode *inode, struct ext4_map_blocks *map, int flags,
1816 unsigned int allocated, ext4_fsblk_t newblock), 1815 unsigned int allocated, ext4_fsblk_t newblock),
1817 1816
diff --git a/include/trace/events/f2fs.h b/include/trace/events/f2fs.h
index 67f38faac589..b983990b4a9f 100644
--- a/include/trace/events/f2fs.h
+++ b/include/trace/events/f2fs.h
@@ -659,6 +659,66 @@ DEFINE_EVENT_CONDITION(f2fs__submit_bio, f2fs_submit_read_bio,
659 TP_CONDITION(bio) 659 TP_CONDITION(bio)
660); 660);
661 661
662TRACE_EVENT(f2fs_write_begin,
663
664 TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
665 unsigned int flags),
666
667 TP_ARGS(inode, pos, len, flags),
668
669 TP_STRUCT__entry(
670 __field(dev_t, dev)
671 __field(ino_t, ino)
672 __field(loff_t, pos)
673 __field(unsigned int, len)
674 __field(unsigned int, flags)
675 ),
676
677 TP_fast_assign(
678 __entry->dev = inode->i_sb->s_dev;
679 __entry->ino = inode->i_ino;
680 __entry->pos = pos;
681 __entry->len = len;
682 __entry->flags = flags;
683 ),
684
685 TP_printk("dev = (%d,%d), ino = %lu, pos = %llu, len = %u, flags = %u",
686 show_dev_ino(__entry),
687 (unsigned long long)__entry->pos,
688 __entry->len,
689 __entry->flags)
690);
691
692TRACE_EVENT(f2fs_write_end,
693
694 TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
695 unsigned int copied),
696
697 TP_ARGS(inode, pos, len, copied),
698
699 TP_STRUCT__entry(
700 __field(dev_t, dev)
701 __field(ino_t, ino)
702 __field(loff_t, pos)
703 __field(unsigned int, len)
704 __field(unsigned int, copied)
705 ),
706
707 TP_fast_assign(
708 __entry->dev = inode->i_sb->s_dev;
709 __entry->ino = inode->i_ino;
710 __entry->pos = pos;
711 __entry->len = len;
712 __entry->copied = copied;
713 ),
714
715 TP_printk("dev = (%d,%d), ino = %lu, pos = %llu, len = %u, copied = %u",
716 show_dev_ino(__entry),
717 (unsigned long long)__entry->pos,
718 __entry->len,
719 __entry->copied)
720);
721
662DECLARE_EVENT_CLASS(f2fs__page, 722DECLARE_EVENT_CLASS(f2fs__page,
663 723
664 TP_PROTO(struct page *page, int type), 724 TP_PROTO(struct page *page, int type),
@@ -672,6 +732,7 @@ DECLARE_EVENT_CLASS(f2fs__page,
672 __field(int, dir) 732 __field(int, dir)
673 __field(pgoff_t, index) 733 __field(pgoff_t, index)
674 __field(int, dirty) 734 __field(int, dirty)
735 __field(int, uptodate)
675 ), 736 ),
676 737
677 TP_fast_assign( 738 TP_fast_assign(
@@ -681,14 +742,31 @@ DECLARE_EVENT_CLASS(f2fs__page,
681 __entry->dir = S_ISDIR(page->mapping->host->i_mode); 742 __entry->dir = S_ISDIR(page->mapping->host->i_mode);
682 __entry->index = page->index; 743 __entry->index = page->index;
683 __entry->dirty = PageDirty(page); 744 __entry->dirty = PageDirty(page);
745 __entry->uptodate = PageUptodate(page);
684 ), 746 ),
685 747
686 TP_printk("dev = (%d,%d), ino = %lu, %s, %s, index = %lu, dirty = %d", 748 TP_printk("dev = (%d,%d), ino = %lu, %s, %s, index = %lu, "
749 "dirty = %d, uptodate = %d",
687 show_dev_ino(__entry), 750 show_dev_ino(__entry),
688 show_block_type(__entry->type), 751 show_block_type(__entry->type),
689 show_file_type(__entry->dir), 752 show_file_type(__entry->dir),
690 (unsigned long)__entry->index, 753 (unsigned long)__entry->index,
691 __entry->dirty) 754 __entry->dirty,
755 __entry->uptodate)
756);
757
758DEFINE_EVENT(f2fs__page, f2fs_writepage,
759
760 TP_PROTO(struct page *page, int type),
761
762 TP_ARGS(page, type)
763);
764
765DEFINE_EVENT(f2fs__page, f2fs_readpage,
766
767 TP_PROTO(struct page *page, int type),
768
769 TP_ARGS(page, type)
692); 770);
693 771
694DEFINE_EVENT(f2fs__page, f2fs_set_page_dirty, 772DEFINE_EVENT(f2fs__page, f2fs_set_page_dirty,
@@ -705,6 +783,70 @@ DEFINE_EVENT(f2fs__page, f2fs_vm_page_mkwrite,
705 TP_ARGS(page, type) 783 TP_ARGS(page, type)
706); 784);
707 785
786TRACE_EVENT(f2fs_writepages,
787
788 TP_PROTO(struct inode *inode, struct writeback_control *wbc, int type),
789
790 TP_ARGS(inode, wbc, type),
791
792 TP_STRUCT__entry(
793 __field(dev_t, dev)
794 __field(ino_t, ino)
795 __field(int, type)
796 __field(int, dir)
797 __field(long, nr_to_write)
798 __field(long, pages_skipped)
799 __field(loff_t, range_start)
800 __field(loff_t, range_end)
801 __field(pgoff_t, writeback_index)
802 __field(int, sync_mode)
803 __field(char, for_kupdate)
804 __field(char, for_background)
805 __field(char, tagged_writepages)
806 __field(char, for_reclaim)
807 __field(char, range_cyclic)
808 __field(char, for_sync)
809 ),
810
811 TP_fast_assign(
812 __entry->dev = inode->i_sb->s_dev;
813 __entry->ino = inode->i_ino;
814 __entry->type = type;
815 __entry->dir = S_ISDIR(inode->i_mode);
816 __entry->nr_to_write = wbc->nr_to_write;
817 __entry->pages_skipped = wbc->pages_skipped;
818 __entry->range_start = wbc->range_start;
819 __entry->range_end = wbc->range_end;
820 __entry->writeback_index = inode->i_mapping->writeback_index;
821 __entry->sync_mode = wbc->sync_mode;
822 __entry->for_kupdate = wbc->for_kupdate;
823 __entry->for_background = wbc->for_background;
824 __entry->tagged_writepages = wbc->tagged_writepages;
825 __entry->for_reclaim = wbc->for_reclaim;
826 __entry->range_cyclic = wbc->range_cyclic;
827 __entry->for_sync = wbc->for_sync;
828 ),
829
830 TP_printk("dev = (%d,%d), ino = %lu, %s, %s, nr_to_write %ld, "
831 "skipped %ld, start %lld, end %lld, wb_idx %lu, sync_mode %d, "
832 "kupdate %u background %u tagged %u reclaim %u cyclic %u sync %u",
833 show_dev_ino(__entry),
834 show_block_type(__entry->type),
835 show_file_type(__entry->dir),
836 __entry->nr_to_write,
837 __entry->pages_skipped,
838 __entry->range_start,
839 __entry->range_end,
840 (unsigned long)__entry->writeback_index,
841 __entry->sync_mode,
842 __entry->for_kupdate,
843 __entry->for_background,
844 __entry->tagged_writepages,
845 __entry->for_reclaim,
846 __entry->range_cyclic,
847 __entry->for_sync)
848);
849
708TRACE_EVENT(f2fs_submit_page_mbio, 850TRACE_EVENT(f2fs_submit_page_mbio,
709 851
710 TP_PROTO(struct page *page, int rw, int type, block_t blk_addr), 852 TP_PROTO(struct page *page, int rw, int type, block_t blk_addr),
diff --git a/include/trace/events/filelock.h b/include/trace/events/filelock.h
new file mode 100644
index 000000000000..59d11c22f076
--- /dev/null
+++ b/include/trace/events/filelock.h
@@ -0,0 +1,96 @@
1/*
2 * Events for filesystem locks
3 *
4 * Copyright 2013 Jeff Layton <jlayton@poochiereds.net>
5 */
6#undef TRACE_SYSTEM
7#define TRACE_SYSTEM filelock
8
9#if !defined(_TRACE_FILELOCK_H) || defined(TRACE_HEADER_MULTI_READ)
10#define _TRACE_FILELOCK_H
11
12#include <linux/tracepoint.h>
13#include <linux/fs.h>
14#include <linux/device.h>
15#include <linux/kdev_t.h>
16
17#define show_fl_flags(val) \
18 __print_flags(val, "|", \
19 { FL_POSIX, "FL_POSIX" }, \
20 { FL_FLOCK, "FL_FLOCK" }, \
21 { FL_DELEG, "FL_DELEG" }, \
22 { FL_ACCESS, "FL_ACCESS" }, \
23 { FL_EXISTS, "FL_EXISTS" }, \
24 { FL_LEASE, "FL_LEASE" }, \
25 { FL_CLOSE, "FL_CLOSE" }, \
26 { FL_SLEEP, "FL_SLEEP" }, \
27 { FL_DOWNGRADE_PENDING, "FL_DOWNGRADE_PENDING" }, \
28 { FL_UNLOCK_PENDING, "FL_UNLOCK_PENDING" }, \
29 { FL_OFDLCK, "FL_OFDLCK" })
30
31#define show_fl_type(val) \
32 __print_symbolic(val, \
33 { F_RDLCK, "F_RDLCK" }, \
34 { F_WRLCK, "F_WRLCK" }, \
35 { F_UNLCK, "F_UNLCK" })
36
37DECLARE_EVENT_CLASS(filelock_lease,
38
39 TP_PROTO(struct inode *inode, struct file_lock *fl),
40
41 TP_ARGS(inode, fl),
42
43 TP_STRUCT__entry(
44 __field(struct file_lock *, fl)
45 __field(unsigned long, i_ino)
46 __field(dev_t, s_dev)
47 __field(struct file_lock *, fl_next)
48 __field(fl_owner_t, fl_owner)
49 __field(unsigned int, fl_flags)
50 __field(unsigned char, fl_type)
51 __field(unsigned long, fl_break_time)
52 __field(unsigned long, fl_downgrade_time)
53 ),
54
55 TP_fast_assign(
56 __entry->fl = fl;
57 __entry->s_dev = inode->i_sb->s_dev;
58 __entry->i_ino = inode->i_ino;
59 __entry->fl_next = fl->fl_next;
60 __entry->fl_owner = fl->fl_owner;
61 __entry->fl_flags = fl->fl_flags;
62 __entry->fl_type = fl->fl_type;
63 __entry->fl_break_time = fl->fl_break_time;
64 __entry->fl_downgrade_time = fl->fl_downgrade_time;
65 ),
66
67 TP_printk("fl=0x%p dev=0x%x:0x%x ino=0x%lx fl_next=0x%p fl_owner=0x%p fl_flags=%s fl_type=%s fl_break_time=%lu fl_downgrade_time=%lu",
68 __entry->fl, MAJOR(__entry->s_dev), MINOR(__entry->s_dev),
69 __entry->i_ino, __entry->fl_next, __entry->fl_owner,
70 show_fl_flags(__entry->fl_flags),
71 show_fl_type(__entry->fl_type),
72 __entry->fl_break_time, __entry->fl_downgrade_time)
73);
74
75DEFINE_EVENT(filelock_lease, break_lease_noblock, TP_PROTO(struct inode *inode, struct file_lock *fl),
76 TP_ARGS(inode, fl));
77
78DEFINE_EVENT(filelock_lease, break_lease_block, TP_PROTO(struct inode *inode, struct file_lock *fl),
79 TP_ARGS(inode, fl));
80
81DEFINE_EVENT(filelock_lease, break_lease_unblock, TP_PROTO(struct inode *inode, struct file_lock *fl),
82 TP_ARGS(inode, fl));
83
84DEFINE_EVENT(filelock_lease, generic_add_lease, TP_PROTO(struct inode *inode, struct file_lock *fl),
85 TP_ARGS(inode, fl));
86
87DEFINE_EVENT(filelock_lease, generic_delete_lease, TP_PROTO(struct inode *inode, struct file_lock *fl),
88 TP_ARGS(inode, fl));
89
90DEFINE_EVENT(filelock_lease, time_out_leases, TP_PROTO(struct inode *inode, struct file_lock *fl),
91 TP_ARGS(inode, fl));
92
93#endif /* _TRACE_FILELOCK_H */
94
95/* This part must be outside protection */
96#include <trace/define_trace.h>
diff --git a/include/trace/events/gfpflags.h b/include/trace/events/gfpflags.h
index 1eddbf1557f2..d6fd8e5b14b7 100644
--- a/include/trace/events/gfpflags.h
+++ b/include/trace/events/gfpflags.h
@@ -34,7 +34,6 @@
34 {(unsigned long)__GFP_HARDWALL, "GFP_HARDWALL"}, \ 34 {(unsigned long)__GFP_HARDWALL, "GFP_HARDWALL"}, \
35 {(unsigned long)__GFP_THISNODE, "GFP_THISNODE"}, \ 35 {(unsigned long)__GFP_THISNODE, "GFP_THISNODE"}, \
36 {(unsigned long)__GFP_RECLAIMABLE, "GFP_RECLAIMABLE"}, \ 36 {(unsigned long)__GFP_RECLAIMABLE, "GFP_RECLAIMABLE"}, \
37 {(unsigned long)__GFP_KMEMCG, "GFP_KMEMCG"}, \
38 {(unsigned long)__GFP_MOVABLE, "GFP_MOVABLE"}, \ 37 {(unsigned long)__GFP_MOVABLE, "GFP_MOVABLE"}, \
39 {(unsigned long)__GFP_NOTRACK, "GFP_NOTRACK"}, \ 38 {(unsigned long)__GFP_NOTRACK, "GFP_NOTRACK"}, \
40 {(unsigned long)__GFP_NO_KSWAPD, "GFP_NO_KSWAPD"}, \ 39 {(unsigned long)__GFP_NO_KSWAPD, "GFP_NO_KSWAPD"}, \
diff --git a/include/trace/events/power.h b/include/trace/events/power.h
index 9a7e08d61258..d19840b0cac8 100644
--- a/include/trace/events/power.h
+++ b/include/trace/events/power.h
@@ -7,6 +7,9 @@
7#include <linux/ktime.h> 7#include <linux/ktime.h>
8#include <linux/pm_qos.h> 8#include <linux/pm_qos.h>
9#include <linux/tracepoint.h> 9#include <linux/tracepoint.h>
10#include <linux/ftrace_event.h>
11
12#define TPS(x) tracepoint_string(x)
10 13
11DECLARE_EVENT_CLASS(cpu, 14DECLARE_EVENT_CLASS(cpu,
12 15
@@ -90,6 +93,17 @@ TRACE_EVENT(pstate_sample,
90#define PWR_EVENT_EXIT -1 93#define PWR_EVENT_EXIT -1
91#endif 94#endif
92 95
96#define pm_verb_symbolic(event) \
97 __print_symbolic(event, \
98 { PM_EVENT_SUSPEND, "suspend" }, \
99 { PM_EVENT_RESUME, "resume" }, \
100 { PM_EVENT_FREEZE, "freeze" }, \
101 { PM_EVENT_QUIESCE, "quiesce" }, \
102 { PM_EVENT_HIBERNATE, "hibernate" }, \
103 { PM_EVENT_THAW, "thaw" }, \
104 { PM_EVENT_RESTORE, "restore" }, \
105 { PM_EVENT_RECOVER, "recover" })
106
93DEFINE_EVENT(cpu, cpu_frequency, 107DEFINE_EVENT(cpu, cpu_frequency,
94 108
95 TP_PROTO(unsigned int frequency, unsigned int cpu_id), 109 TP_PROTO(unsigned int frequency, unsigned int cpu_id),
@@ -97,58 +111,76 @@ DEFINE_EVENT(cpu, cpu_frequency,
97 TP_ARGS(frequency, cpu_id) 111 TP_ARGS(frequency, cpu_id)
98); 112);
99 113
100TRACE_EVENT(machine_suspend, 114TRACE_EVENT(device_pm_callback_start,
101 115
102 TP_PROTO(unsigned int state), 116 TP_PROTO(struct device *dev, const char *pm_ops, int event),
103 117
104 TP_ARGS(state), 118 TP_ARGS(dev, pm_ops, event),
105 119
106 TP_STRUCT__entry( 120 TP_STRUCT__entry(
107 __field( u32, state ) 121 __string(device, dev_name(dev))
122 __string(driver, dev_driver_string(dev))
123 __string(parent, dev->parent ? dev_name(dev->parent) : "none")
124 __string(pm_ops, pm_ops ? pm_ops : "none ")
125 __field(int, event)
108 ), 126 ),
109 127
110 TP_fast_assign( 128 TP_fast_assign(
111 __entry->state = state; 129 __assign_str(device, dev_name(dev));
130 __assign_str(driver, dev_driver_string(dev));
131 __assign_str(parent,
132 dev->parent ? dev_name(dev->parent) : "none");
133 __assign_str(pm_ops, pm_ops ? pm_ops : "none ");
134 __entry->event = event;
112 ), 135 ),
113 136
114 TP_printk("state=%lu", (unsigned long)__entry->state) 137 TP_printk("%s %s, parent: %s, %s[%s]", __get_str(driver),
138 __get_str(device), __get_str(parent), __get_str(pm_ops),
139 pm_verb_symbolic(__entry->event))
115); 140);
116 141
117TRACE_EVENT(device_pm_report_time, 142TRACE_EVENT(device_pm_callback_end,
118 143
119 TP_PROTO(struct device *dev, const char *pm_ops, s64 ops_time, 144 TP_PROTO(struct device *dev, int error),
120 char *pm_event_str, int error),
121 145
122 TP_ARGS(dev, pm_ops, ops_time, pm_event_str, error), 146 TP_ARGS(dev, error),
123 147
124 TP_STRUCT__entry( 148 TP_STRUCT__entry(
125 __string(device, dev_name(dev)) 149 __string(device, dev_name(dev))
126 __string(driver, dev_driver_string(dev)) 150 __string(driver, dev_driver_string(dev))
127 __string(parent, dev->parent ? dev_name(dev->parent) : "none")
128 __string(pm_ops, pm_ops ? pm_ops : "none ")
129 __string(pm_event_str, pm_event_str)
130 __field(s64, ops_time)
131 __field(int, error) 151 __field(int, error)
132 ), 152 ),
133 153
134 TP_fast_assign( 154 TP_fast_assign(
135 const char *tmp = dev->parent ? dev_name(dev->parent) : "none";
136 const char *tmp_i = pm_ops ? pm_ops : "none ";
137
138 __assign_str(device, dev_name(dev)); 155 __assign_str(device, dev_name(dev));
139 __assign_str(driver, dev_driver_string(dev)); 156 __assign_str(driver, dev_driver_string(dev));
140 __assign_str(parent, tmp);
141 __assign_str(pm_ops, tmp_i);
142 __assign_str(pm_event_str, pm_event_str);
143 __entry->ops_time = ops_time;
144 __entry->error = error; 157 __entry->error = error;
145 ), 158 ),
146 159
147 /* ops_str has an extra space at the end */ 160 TP_printk("%s %s, err=%d",
148 TP_printk("%s %s parent=%s state=%s ops=%snsecs=%lld err=%d", 161 __get_str(driver), __get_str(device), __entry->error)
149 __get_str(driver), __get_str(device), __get_str(parent), 162);
150 __get_str(pm_event_str), __get_str(pm_ops), 163
151 __entry->ops_time, __entry->error) 164TRACE_EVENT(suspend_resume,
165
166 TP_PROTO(const char *action, int val, bool start),
167
168 TP_ARGS(action, val, start),
169
170 TP_STRUCT__entry(
171 __field(const char *, action)
172 __field(int, val)
173 __field(bool, start)
174 ),
175
176 TP_fast_assign(
177 __entry->action = action;
178 __entry->val = val;
179 __entry->start = start;
180 ),
181
182 TP_printk("%s[%u] %s", __entry->action, (unsigned int)__entry->val,
183 (__entry->start)?"begin":"end")
152); 184);
153 185
154DECLARE_EVENT_CLASS(wakeup_source, 186DECLARE_EVENT_CLASS(wakeup_source,
diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h
index 67e1bbf83695..0a68d5ae584e 100644
--- a/include/trace/events/sched.h
+++ b/include/trace/events/sched.h
@@ -530,6 +530,26 @@ TRACE_EVENT(sched_swap_numa,
530 __entry->dst_pid, __entry->dst_tgid, __entry->dst_ngid, 530 __entry->dst_pid, __entry->dst_tgid, __entry->dst_ngid,
531 __entry->dst_cpu, __entry->dst_nid) 531 __entry->dst_cpu, __entry->dst_nid)
532); 532);
533
534/*
535 * Tracepoint for waking a polling cpu without an IPI.
536 */
537TRACE_EVENT(sched_wake_idle_without_ipi,
538
539 TP_PROTO(int cpu),
540
541 TP_ARGS(cpu),
542
543 TP_STRUCT__entry(
544 __field( int, cpu )
545 ),
546
547 TP_fast_assign(
548 __entry->cpu = cpu;
549 ),
550
551 TP_printk("cpu=%d", __entry->cpu)
552);
533#endif /* _TRACE_SCHED_H */ 553#endif /* _TRACE_SCHED_H */
534 554
535/* This part must be outside protection */ 555/* This part must be outside protection */
diff --git a/include/trace/events/vmscan.h b/include/trace/events/vmscan.h
index 132a985aba8b..69590b6ffc09 100644
--- a/include/trace/events/vmscan.h
+++ b/include/trace/events/vmscan.h
@@ -191,6 +191,7 @@ TRACE_EVENT(mm_shrink_slab_start,
191 TP_STRUCT__entry( 191 TP_STRUCT__entry(
192 __field(struct shrinker *, shr) 192 __field(struct shrinker *, shr)
193 __field(void *, shrink) 193 __field(void *, shrink)
194 __field(int, nid)
194 __field(long, nr_objects_to_shrink) 195 __field(long, nr_objects_to_shrink)
195 __field(gfp_t, gfp_flags) 196 __field(gfp_t, gfp_flags)
196 __field(unsigned long, pgs_scanned) 197 __field(unsigned long, pgs_scanned)
@@ -203,6 +204,7 @@ TRACE_EVENT(mm_shrink_slab_start,
203 TP_fast_assign( 204 TP_fast_assign(
204 __entry->shr = shr; 205 __entry->shr = shr;
205 __entry->shrink = shr->scan_objects; 206 __entry->shrink = shr->scan_objects;
207 __entry->nid = sc->nid;
206 __entry->nr_objects_to_shrink = nr_objects_to_shrink; 208 __entry->nr_objects_to_shrink = nr_objects_to_shrink;
207 __entry->gfp_flags = sc->gfp_mask; 209 __entry->gfp_flags = sc->gfp_mask;
208 __entry->pgs_scanned = pgs_scanned; 210 __entry->pgs_scanned = pgs_scanned;
@@ -212,9 +214,10 @@ TRACE_EVENT(mm_shrink_slab_start,
212 __entry->total_scan = total_scan; 214 __entry->total_scan = total_scan;
213 ), 215 ),
214 216
215 TP_printk("%pF %p: objects to shrink %ld gfp_flags %s pgs_scanned %ld lru_pgs %ld cache items %ld delta %lld total_scan %ld", 217 TP_printk("%pF %p: nid: %d objects to shrink %ld gfp_flags %s pgs_scanned %ld lru_pgs %ld cache items %ld delta %lld total_scan %ld",
216 __entry->shrink, 218 __entry->shrink,
217 __entry->shr, 219 __entry->shr,
220 __entry->nid,
218 __entry->nr_objects_to_shrink, 221 __entry->nr_objects_to_shrink,
219 show_gfp_flags(__entry->gfp_flags), 222 show_gfp_flags(__entry->gfp_flags),
220 __entry->pgs_scanned, 223 __entry->pgs_scanned,
@@ -225,13 +228,15 @@ TRACE_EVENT(mm_shrink_slab_start,
225); 228);
226 229
227TRACE_EVENT(mm_shrink_slab_end, 230TRACE_EVENT(mm_shrink_slab_end,
228 TP_PROTO(struct shrinker *shr, int shrinker_retval, 231 TP_PROTO(struct shrinker *shr, int nid, int shrinker_retval,
229 long unused_scan_cnt, long new_scan_cnt), 232 long unused_scan_cnt, long new_scan_cnt, long total_scan),
230 233
231 TP_ARGS(shr, shrinker_retval, unused_scan_cnt, new_scan_cnt), 234 TP_ARGS(shr, nid, shrinker_retval, unused_scan_cnt, new_scan_cnt,
235 total_scan),
232 236
233 TP_STRUCT__entry( 237 TP_STRUCT__entry(
234 __field(struct shrinker *, shr) 238 __field(struct shrinker *, shr)
239 __field(int, nid)
235 __field(void *, shrink) 240 __field(void *, shrink)
236 __field(long, unused_scan) 241 __field(long, unused_scan)
237 __field(long, new_scan) 242 __field(long, new_scan)
@@ -241,16 +246,18 @@ TRACE_EVENT(mm_shrink_slab_end,
241 246
242 TP_fast_assign( 247 TP_fast_assign(
243 __entry->shr = shr; 248 __entry->shr = shr;
249 __entry->nid = nid;
244 __entry->shrink = shr->scan_objects; 250 __entry->shrink = shr->scan_objects;
245 __entry->unused_scan = unused_scan_cnt; 251 __entry->unused_scan = unused_scan_cnt;
246 __entry->new_scan = new_scan_cnt; 252 __entry->new_scan = new_scan_cnt;
247 __entry->retval = shrinker_retval; 253 __entry->retval = shrinker_retval;
248 __entry->total_scan = new_scan_cnt - unused_scan_cnt; 254 __entry->total_scan = total_scan;
249 ), 255 ),
250 256
251 TP_printk("%pF %p: unused scan count %ld new scan count %ld total_scan %ld last shrinker return val %d", 257 TP_printk("%pF %p: nid: %d unused scan count %ld new scan count %ld total_scan %ld last shrinker return val %d",
252 __entry->shrink, 258 __entry->shrink,
253 __entry->shr, 259 __entry->shr,
260 __entry->nid,
254 __entry->unused_scan, 261 __entry->unused_scan,
255 __entry->new_scan, 262 __entry->new_scan,
256 __entry->total_scan, 263 __entry->total_scan,
diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h
index 0a1a4f7caf09..26b4f2e13275 100644
--- a/include/trace/ftrace.h
+++ b/include/trace/ftrace.h
@@ -44,6 +44,12 @@
44#undef __field_ext 44#undef __field_ext
45#define __field_ext(type, item, filter_type) type item; 45#define __field_ext(type, item, filter_type) type item;
46 46
47#undef __field_struct
48#define __field_struct(type, item) type item;
49
50#undef __field_struct_ext
51#define __field_struct_ext(type, item, filter_type) type item;
52
47#undef __array 53#undef __array
48#define __array(type, item, len) type item[len]; 54#define __array(type, item, len) type item[len];
49 55
@@ -53,6 +59,9 @@
53#undef __string 59#undef __string
54#define __string(item, src) __dynamic_array(char, item, -1) 60#define __string(item, src) __dynamic_array(char, item, -1)
55 61
62#undef __bitmask
63#define __bitmask(item, nr_bits) __dynamic_array(char, item, -1)
64
56#undef TP_STRUCT__entry 65#undef TP_STRUCT__entry
57#define TP_STRUCT__entry(args...) args 66#define TP_STRUCT__entry(args...) args
58 67
@@ -119,6 +128,12 @@
119#undef __field_ext 128#undef __field_ext
120#define __field_ext(type, item, filter_type) 129#define __field_ext(type, item, filter_type)
121 130
131#undef __field_struct
132#define __field_struct(type, item)
133
134#undef __field_struct_ext
135#define __field_struct_ext(type, item, filter_type)
136
122#undef __array 137#undef __array
123#define __array(type, item, len) 138#define __array(type, item, len)
124 139
@@ -128,6 +143,9 @@
128#undef __string 143#undef __string
129#define __string(item, src) __dynamic_array(char, item, -1) 144#define __string(item, src) __dynamic_array(char, item, -1)
130 145
146#undef __bitmask
147#define __bitmask(item, nr_bits) __dynamic_array(unsigned long, item, -1)
148
131#undef DECLARE_EVENT_CLASS 149#undef DECLARE_EVENT_CLASS
132#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \ 150#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \
133 struct ftrace_data_offsets_##call { \ 151 struct ftrace_data_offsets_##call { \
@@ -197,9 +215,22 @@
197#define __get_dynamic_array(field) \ 215#define __get_dynamic_array(field) \
198 ((void *)__entry + (__entry->__data_loc_##field & 0xffff)) 216 ((void *)__entry + (__entry->__data_loc_##field & 0xffff))
199 217
218#undef __get_dynamic_array_len
219#define __get_dynamic_array_len(field) \
220 ((__entry->__data_loc_##field >> 16) & 0xffff)
221
200#undef __get_str 222#undef __get_str
201#define __get_str(field) (char *)__get_dynamic_array(field) 223#define __get_str(field) (char *)__get_dynamic_array(field)
202 224
225#undef __get_bitmask
226#define __get_bitmask(field) \
227 ({ \
228 void *__bitmask = __get_dynamic_array(field); \
229 unsigned int __bitmask_size; \
230 __bitmask_size = __get_dynamic_array_len(field); \
231 ftrace_print_bitmask_seq(p, __bitmask, __bitmask_size); \
232 })
233
203#undef __print_flags 234#undef __print_flags
204#define __print_flags(flag, delim, flag_array...) \ 235#define __print_flags(flag, delim, flag_array...) \
205 ({ \ 236 ({ \
@@ -296,9 +327,21 @@ static struct trace_event_functions ftrace_event_type_funcs_##call = { \
296 if (ret) \ 327 if (ret) \
297 return ret; 328 return ret;
298 329
330#undef __field_struct_ext
331#define __field_struct_ext(type, item, filter_type) \
332 ret = trace_define_field(event_call, #type, #item, \
333 offsetof(typeof(field), item), \
334 sizeof(field.item), \
335 0, filter_type); \
336 if (ret) \
337 return ret;
338
299#undef __field 339#undef __field
300#define __field(type, item) __field_ext(type, item, FILTER_OTHER) 340#define __field(type, item) __field_ext(type, item, FILTER_OTHER)
301 341
342#undef __field_struct
343#define __field_struct(type, item) __field_struct_ext(type, item, FILTER_OTHER)
344
302#undef __array 345#undef __array
303#define __array(type, item, len) \ 346#define __array(type, item, len) \
304 do { \ 347 do { \
@@ -322,6 +365,9 @@ static struct trace_event_functions ftrace_event_type_funcs_##call = { \
322#undef __string 365#undef __string
323#define __string(item, src) __dynamic_array(char, item, -1) 366#define __string(item, src) __dynamic_array(char, item, -1)
324 367
368#undef __bitmask
369#define __bitmask(item, nr_bits) __dynamic_array(unsigned long, item, -1)
370
325#undef DECLARE_EVENT_CLASS 371#undef DECLARE_EVENT_CLASS
326#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, func, print) \ 372#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, func, print) \
327static int notrace __init \ 373static int notrace __init \
@@ -357,6 +403,12 @@ ftrace_define_fields_##call(struct ftrace_event_call *event_call) \
357#undef __field_ext 403#undef __field_ext
358#define __field_ext(type, item, filter_type) 404#define __field_ext(type, item, filter_type)
359 405
406#undef __field_struct
407#define __field_struct(type, item)
408
409#undef __field_struct_ext
410#define __field_struct_ext(type, item, filter_type)
411
360#undef __array 412#undef __array
361#define __array(type, item, len) 413#define __array(type, item, len)
362 414
@@ -372,6 +424,29 @@ ftrace_define_fields_##call(struct ftrace_event_call *event_call) \
372#define __string(item, src) __dynamic_array(char, item, \ 424#define __string(item, src) __dynamic_array(char, item, \
373 strlen((src) ? (const char *)(src) : "(null)") + 1) 425 strlen((src) ? (const char *)(src) : "(null)") + 1)
374 426
427/*
428 * __bitmask_size_in_bytes_raw is the number of bytes needed to hold
429 * num_possible_cpus().
430 */
431#define __bitmask_size_in_bytes_raw(nr_bits) \
432 (((nr_bits) + 7) / 8)
433
434#define __bitmask_size_in_longs(nr_bits) \
435 ((__bitmask_size_in_bytes_raw(nr_bits) + \
436 ((BITS_PER_LONG / 8) - 1)) / (BITS_PER_LONG / 8))
437
438/*
439 * __bitmask_size_in_bytes is the number of bytes needed to hold
440 * num_possible_cpus() padded out to the nearest long. This is what
441 * is saved in the buffer, just to be consistent.
442 */
443#define __bitmask_size_in_bytes(nr_bits) \
444 (__bitmask_size_in_longs(nr_bits) * (BITS_PER_LONG / 8))
445
446#undef __bitmask
447#define __bitmask(item, nr_bits) __dynamic_array(unsigned long, item, \
448 __bitmask_size_in_longs(nr_bits))
449
375#undef DECLARE_EVENT_CLASS 450#undef DECLARE_EVENT_CLASS
376#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \ 451#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \
377static inline notrace int ftrace_get_offsets_##call( \ 452static inline notrace int ftrace_get_offsets_##call( \
@@ -505,6 +580,9 @@ static inline notrace int ftrace_get_offsets_##call( \
505#undef __field 580#undef __field
506#define __field(type, item) 581#define __field(type, item)
507 582
583#undef __field_struct
584#define __field_struct(type, item)
585
508#undef __array 586#undef __array
509#define __array(type, item, len) 587#define __array(type, item, len)
510 588
@@ -513,12 +591,22 @@ static inline notrace int ftrace_get_offsets_##call( \
513 __entry->__data_loc_##item = __data_offsets.item; 591 __entry->__data_loc_##item = __data_offsets.item;
514 592
515#undef __string 593#undef __string
516#define __string(item, src) __dynamic_array(char, item, -1) \ 594#define __string(item, src) __dynamic_array(char, item, -1)
517 595
518#undef __assign_str 596#undef __assign_str
519#define __assign_str(dst, src) \ 597#define __assign_str(dst, src) \
520 strcpy(__get_str(dst), (src) ? (const char *)(src) : "(null)"); 598 strcpy(__get_str(dst), (src) ? (const char *)(src) : "(null)");
521 599
600#undef __bitmask
601#define __bitmask(item, nr_bits) __dynamic_array(unsigned long, item, -1)
602
603#undef __get_bitmask
604#define __get_bitmask(field) (char *)__get_dynamic_array(field)
605
606#undef __assign_bitmask
607#define __assign_bitmask(dst, src, nr_bits) \
608 memcpy(__get_bitmask(dst), (src), __bitmask_size_in_bytes(nr_bits))
609
522#undef TP_fast_assign 610#undef TP_fast_assign
523#define TP_fast_assign(args...) args 611#define TP_fast_assign(args...) args
524 612
@@ -585,7 +673,9 @@ static inline void ftrace_test_probe_##call(void) \
585#undef __print_symbolic 673#undef __print_symbolic
586#undef __print_hex 674#undef __print_hex
587#undef __get_dynamic_array 675#undef __get_dynamic_array
676#undef __get_dynamic_array_len
588#undef __get_str 677#undef __get_str
678#undef __get_bitmask
589 679
590#undef TP_printk 680#undef TP_printk
591#define TP_printk(fmt, args...) "\"" fmt "\", " __stringify(args) 681#define TP_printk(fmt, args...) "\"" fmt "\", " __stringify(args)
@@ -648,9 +738,16 @@ __attribute__((section("_ftrace_events"))) *__event_##call = &event_##call
648#define __get_dynamic_array(field) \ 738#define __get_dynamic_array(field) \
649 ((void *)__entry + (__entry->__data_loc_##field & 0xffff)) 739 ((void *)__entry + (__entry->__data_loc_##field & 0xffff))
650 740
741#undef __get_dynamic_array_len
742#define __get_dynamic_array_len(field) \
743 ((__entry->__data_loc_##field >> 16) & 0xffff)
744
651#undef __get_str 745#undef __get_str
652#define __get_str(field) (char *)__get_dynamic_array(field) 746#define __get_str(field) (char *)__get_dynamic_array(field)
653 747
748#undef __get_bitmask
749#define __get_bitmask(field) (char *)__get_dynamic_array(field)
750
654#undef __perf_addr 751#undef __perf_addr
655#define __perf_addr(a) (__addr = (a)) 752#define __perf_addr(a) (__addr = (a))
656 753
diff --git a/include/trace/syscall.h b/include/trace/syscall.h
index fed853f3d7aa..9674145e2f6a 100644
--- a/include/trace/syscall.h
+++ b/include/trace/syscall.h
@@ -4,6 +4,7 @@
4#include <linux/tracepoint.h> 4#include <linux/tracepoint.h>
5#include <linux/unistd.h> 5#include <linux/unistd.h>
6#include <linux/ftrace_event.h> 6#include <linux/ftrace_event.h>
7#include <linux/thread_info.h>
7 8
8#include <asm/ptrace.h> 9#include <asm/ptrace.h>
9 10
@@ -32,4 +33,18 @@ struct syscall_metadata {
32 struct ftrace_event_call *exit_event; 33 struct ftrace_event_call *exit_event;
33}; 34};
34 35
36#if defined(CONFIG_TRACEPOINTS) && defined(CONFIG_HAVE_SYSCALL_TRACEPOINTS)
37static inline void syscall_tracepoint_update(struct task_struct *p)
38{
39 if (test_thread_flag(TIF_SYSCALL_TRACEPOINT))
40 set_tsk_thread_flag(p, TIF_SYSCALL_TRACEPOINT);
41 else
42 clear_tsk_thread_flag(p, TIF_SYSCALL_TRACEPOINT);
43}
44#else
45static inline void syscall_tracepoint_update(struct task_struct *p)
46{
47}
48#endif
49
35#endif /* _TRACE_SYSCALL_H */ 50#endif /* _TRACE_SYSCALL_H */
diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h
index f104c2603ebe..def54f9e07ca 100644
--- a/include/uapi/drm/drm_mode.h
+++ b/include/uapi/drm/drm_mode.h
@@ -181,6 +181,7 @@ struct drm_mode_get_plane_res {
181#define DRM_MODE_ENCODER_TVDAC 4 181#define DRM_MODE_ENCODER_TVDAC 4
182#define DRM_MODE_ENCODER_VIRTUAL 5 182#define DRM_MODE_ENCODER_VIRTUAL 5
183#define DRM_MODE_ENCODER_DSI 6 183#define DRM_MODE_ENCODER_DSI 6
184#define DRM_MODE_ENCODER_DPMST 7
184 185
185struct drm_mode_get_encoder { 186struct drm_mode_get_encoder {
186 __u32 encoder_id; 187 __u32 encoder_id;
@@ -251,6 +252,21 @@ struct drm_mode_get_connector {
251#define DRM_MODE_PROP_BLOB (1<<4) 252#define DRM_MODE_PROP_BLOB (1<<4)
252#define DRM_MODE_PROP_BITMASK (1<<5) /* bitmask of enumerated types */ 253#define DRM_MODE_PROP_BITMASK (1<<5) /* bitmask of enumerated types */
253 254
255/* non-extended types: legacy bitmask, one bit per type: */
256#define DRM_MODE_PROP_LEGACY_TYPE ( \
257 DRM_MODE_PROP_RANGE | \
258 DRM_MODE_PROP_ENUM | \
259 DRM_MODE_PROP_BLOB | \
260 DRM_MODE_PROP_BITMASK)
261
262/* extended-types: rather than continue to consume a bit per type,
263 * grab a chunk of the bits to use as integer type id.
264 */
265#define DRM_MODE_PROP_EXTENDED_TYPE 0x0000ffc0
266#define DRM_MODE_PROP_TYPE(n) ((n) << 6)
267#define DRM_MODE_PROP_OBJECT DRM_MODE_PROP_TYPE(1)
268#define DRM_MODE_PROP_SIGNED_RANGE DRM_MODE_PROP_TYPE(2)
269
254struct drm_mode_property_enum { 270struct drm_mode_property_enum {
255 __u64 value; 271 __u64 value;
256 char name[DRM_PROP_NAME_LEN]; 272 char name[DRM_PROP_NAME_LEN];
diff --git a/include/uapi/drm/i915_drm.h b/include/uapi/drm/i915_drm.h
index 126bfaa8bb6b..ff57f07c3249 100644
--- a/include/uapi/drm/i915_drm.h
+++ b/include/uapi/drm/i915_drm.h
@@ -223,6 +223,7 @@ typedef struct _drm_i915_sarea {
223#define DRM_I915_GEM_GET_CACHING 0x30 223#define DRM_I915_GEM_GET_CACHING 0x30
224#define DRM_I915_REG_READ 0x31 224#define DRM_I915_REG_READ 0x31
225#define DRM_I915_GET_RESET_STATS 0x32 225#define DRM_I915_GET_RESET_STATS 0x32
226#define DRM_I915_GEM_USERPTR 0x33
226 227
227#define DRM_IOCTL_I915_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t) 228#define DRM_IOCTL_I915_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t)
228#define DRM_IOCTL_I915_FLUSH DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLUSH) 229#define DRM_IOCTL_I915_FLUSH DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLUSH)
@@ -273,6 +274,7 @@ typedef struct _drm_i915_sarea {
273#define DRM_IOCTL_I915_GEM_CONTEXT_DESTROY DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_CONTEXT_DESTROY, struct drm_i915_gem_context_destroy) 274#define DRM_IOCTL_I915_GEM_CONTEXT_DESTROY DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_CONTEXT_DESTROY, struct drm_i915_gem_context_destroy)
274#define DRM_IOCTL_I915_REG_READ DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_REG_READ, struct drm_i915_reg_read) 275#define DRM_IOCTL_I915_REG_READ DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_REG_READ, struct drm_i915_reg_read)
275#define DRM_IOCTL_I915_GET_RESET_STATS DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GET_RESET_STATS, struct drm_i915_reset_stats) 276#define DRM_IOCTL_I915_GET_RESET_STATS DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GET_RESET_STATS, struct drm_i915_reset_stats)
277#define DRM_IOCTL_I915_GEM_USERPTR DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_USERPTR, struct drm_i915_gem_userptr)
276 278
277/* Allow drivers to submit batchbuffers directly to hardware, relying 279/* Allow drivers to submit batchbuffers directly to hardware, relying
278 * on the security mechanisms provided by hardware. 280 * on the security mechanisms provided by hardware.
@@ -337,6 +339,7 @@ typedef struct drm_i915_irq_wait {
337#define I915_PARAM_HAS_EXEC_NO_RELOC 25 339#define I915_PARAM_HAS_EXEC_NO_RELOC 25
338#define I915_PARAM_HAS_EXEC_HANDLE_LUT 26 340#define I915_PARAM_HAS_EXEC_HANDLE_LUT 26
339#define I915_PARAM_HAS_WT 27 341#define I915_PARAM_HAS_WT 27
342#define I915_PARAM_CMD_PARSER_VERSION 28
340 343
341typedef struct drm_i915_getparam { 344typedef struct drm_i915_getparam {
342 int param; 345 int param;
@@ -1049,4 +1052,18 @@ struct drm_i915_reset_stats {
1049 __u32 pad; 1052 __u32 pad;
1050}; 1053};
1051 1054
1055struct drm_i915_gem_userptr {
1056 __u64 user_ptr;
1057 __u64 user_size;
1058 __u32 flags;
1059#define I915_USERPTR_READ_ONLY 0x1
1060#define I915_USERPTR_UNSYNCHRONIZED 0x80000000
1061 /**
1062 * Returned handle for the object.
1063 *
1064 * Object handles are nonzero.
1065 */
1066 __u32 handle;
1067};
1068
1052#endif /* _UAPI_I915_DRM_H_ */ 1069#endif /* _UAPI_I915_DRM_H_ */
diff --git a/include/uapi/drm/radeon_drm.h b/include/uapi/drm/radeon_drm.h
index aefa2f6afa3b..1cc0b610f162 100644
--- a/include/uapi/drm/radeon_drm.h
+++ b/include/uapi/drm/radeon_drm.h
@@ -1007,7 +1007,7 @@ struct drm_radeon_cs {
1007#define RADEON_INFO_NUM_BYTES_MOVED 0x1d 1007#define RADEON_INFO_NUM_BYTES_MOVED 0x1d
1008#define RADEON_INFO_VRAM_USAGE 0x1e 1008#define RADEON_INFO_VRAM_USAGE 0x1e
1009#define RADEON_INFO_GTT_USAGE 0x1f 1009#define RADEON_INFO_GTT_USAGE 0x1f
1010 1010#define RADEON_INFO_ACTIVE_CU_COUNT 0x20
1011 1011
1012struct drm_radeon_info { 1012struct drm_radeon_info {
1013 uint32_t request; 1013 uint32_t request;
diff --git a/include/uapi/linux/Kbuild b/include/uapi/linux/Kbuild
index 6929571b79b0..24e9033f8b3f 100644
--- a/include/uapi/linux/Kbuild
+++ b/include/uapi/linux/Kbuild
@@ -317,6 +317,7 @@ header-y += ppp-ioctl.h
317header-y += ppp_defs.h 317header-y += ppp_defs.h
318header-y += pps.h 318header-y += pps.h
319header-y += prctl.h 319header-y += prctl.h
320header-y += psci.h
320header-y += ptp_clock.h 321header-y += ptp_clock.h
321header-y += ptrace.h 322header-y += ptrace.h
322header-y += qnx4_fs.h 323header-y += qnx4_fs.h
diff --git a/include/uapi/linux/audit.h b/include/uapi/linux/audit.h
index 1b1efddb91cd..cf6714752b69 100644
--- a/include/uapi/linux/audit.h
+++ b/include/uapi/linux/audit.h
@@ -357,7 +357,7 @@ enum {
357#define AUDIT_ARCH_MIPS64N32 (EM_MIPS|__AUDIT_ARCH_64BIT|\ 357#define AUDIT_ARCH_MIPS64N32 (EM_MIPS|__AUDIT_ARCH_64BIT|\
358 __AUDIT_ARCH_CONVENTION_MIPS64_N32) 358 __AUDIT_ARCH_CONVENTION_MIPS64_N32)
359#define AUDIT_ARCH_MIPSEL64 (EM_MIPS|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE) 359#define AUDIT_ARCH_MIPSEL64 (EM_MIPS|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
360#define AUDIT_ARCH_MIPSEL64N32 (EM_MIPS|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE\ 360#define AUDIT_ARCH_MIPSEL64N32 (EM_MIPS|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE|\
361 __AUDIT_ARCH_CONVENTION_MIPS64_N32) 361 __AUDIT_ARCH_CONVENTION_MIPS64_N32)
362#define AUDIT_ARCH_OPENRISC (EM_OPENRISC) 362#define AUDIT_ARCH_OPENRISC (EM_OPENRISC)
363#define AUDIT_ARCH_PARISC (EM_PARISC) 363#define AUDIT_ARCH_PARISC (EM_PARISC)
@@ -385,6 +385,14 @@ enum {
385 */ 385 */
386#define AUDIT_MESSAGE_TEXT_MAX 8560 386#define AUDIT_MESSAGE_TEXT_MAX 8560
387 387
388/* Multicast Netlink socket groups (default up to 32) */
389enum audit_nlgrps {
390 AUDIT_NLGRP_NONE, /* Group 0 not used */
391 AUDIT_NLGRP_READLOG, /* "best effort" read only socket */
392 __AUDIT_NLGRP_MAX
393};
394#define AUDIT_NLGRP_MAX (__AUDIT_NLGRP_MAX - 1)
395
388struct audit_status { 396struct audit_status {
389 __u32 mask; /* Bit mask for valid entries */ 397 __u32 mask; /* Bit mask for valid entries */
390 __u32 enabled; /* 1 = enabled, 0 = disabled */ 398 __u32 enabled; /* 1 = enabled, 0 = disabled */
diff --git a/include/uapi/linux/btrfs.h b/include/uapi/linux/btrfs.h
index b4d69092fbdb..2f47824e7a36 100644
--- a/include/uapi/linux/btrfs.h
+++ b/include/uapi/linux/btrfs.h
@@ -38,6 +38,7 @@ struct btrfs_ioctl_vol_args {
38#define BTRFS_SUBVOL_QGROUP_INHERIT (1ULL << 2) 38#define BTRFS_SUBVOL_QGROUP_INHERIT (1ULL << 2)
39#define BTRFS_FSID_SIZE 16 39#define BTRFS_FSID_SIZE 16
40#define BTRFS_UUID_SIZE 16 40#define BTRFS_UUID_SIZE 16
41#define BTRFS_UUID_UNPARSED_SIZE 37
41 42
42#define BTRFS_QGROUP_INHERIT_SET_LIMITS (1ULL << 0) 43#define BTRFS_QGROUP_INHERIT_SET_LIMITS (1ULL << 0)
43 44
@@ -181,7 +182,11 @@ struct btrfs_ioctl_fs_info_args {
181 __u64 max_id; /* out */ 182 __u64 max_id; /* out */
182 __u64 num_devices; /* out */ 183 __u64 num_devices; /* out */
183 __u8 fsid[BTRFS_FSID_SIZE]; /* out */ 184 __u8 fsid[BTRFS_FSID_SIZE]; /* out */
184 __u64 reserved[124]; /* pad to 1k */ 185 __u32 nodesize; /* out */
186 __u32 sectorsize; /* out */
187 __u32 clone_alignment; /* out */
188 __u32 reserved32;
189 __u64 reserved[122]; /* pad to 1k */
185}; 190};
186 191
187struct btrfs_ioctl_feature_flags { 192struct btrfs_ioctl_feature_flags {
@@ -211,7 +216,8 @@ struct btrfs_balance_args {
211 216
212 __u64 flags; 217 __u64 flags;
213 218
214 __u64 unused[8]; 219 __u64 limit; /* limit number of processed chunks */
220 __u64 unused[7];
215} __attribute__ ((__packed__)); 221} __attribute__ ((__packed__));
216 222
217/* report balance progress to userspace */ 223/* report balance progress to userspace */
@@ -301,6 +307,14 @@ struct btrfs_ioctl_search_args {
301 char buf[BTRFS_SEARCH_ARGS_BUFSIZE]; 307 char buf[BTRFS_SEARCH_ARGS_BUFSIZE];
302}; 308};
303 309
310struct btrfs_ioctl_search_args_v2 {
311 struct btrfs_ioctl_search_key key; /* in/out - search parameters */
312 __u64 buf_size; /* in - size of buffer
313 * out - on EOVERFLOW: needed size
314 * to store item */
315 __u64 buf[0]; /* out - found items */
316};
317
304struct btrfs_ioctl_clone_range_args { 318struct btrfs_ioctl_clone_range_args {
305 __s64 src_fd; 319 __s64 src_fd;
306 __u64 src_offset, src_length; 320 __u64 src_offset, src_length;
@@ -553,6 +567,8 @@ static inline char *btrfs_err_str(enum btrfs_err_code err_code)
553 struct btrfs_ioctl_defrag_range_args) 567 struct btrfs_ioctl_defrag_range_args)
554#define BTRFS_IOC_TREE_SEARCH _IOWR(BTRFS_IOCTL_MAGIC, 17, \ 568#define BTRFS_IOC_TREE_SEARCH _IOWR(BTRFS_IOCTL_MAGIC, 17, \
555 struct btrfs_ioctl_search_args) 569 struct btrfs_ioctl_search_args)
570#define BTRFS_IOC_TREE_SEARCH_V2 _IOWR(BTRFS_IOCTL_MAGIC, 17, \
571 struct btrfs_ioctl_search_args_v2)
556#define BTRFS_IOC_INO_LOOKUP _IOWR(BTRFS_IOCTL_MAGIC, 18, \ 572#define BTRFS_IOC_INO_LOOKUP _IOWR(BTRFS_IOCTL_MAGIC, 18, \
557 struct btrfs_ioctl_ino_lookup_args) 573 struct btrfs_ioctl_ino_lookup_args)
558#define BTRFS_IOC_DEFAULT_SUBVOL _IOW(BTRFS_IOCTL_MAGIC, 19, __u64) 574#define BTRFS_IOC_DEFAULT_SUBVOL _IOW(BTRFS_IOCTL_MAGIC, 19, __u64)
diff --git a/include/uapi/linux/can.h b/include/uapi/linux/can.h
index 5d9d1d140718..41892f720057 100644
--- a/include/uapi/linux/can.h
+++ b/include/uapi/linux/can.h
@@ -42,8 +42,8 @@
42 * DAMAGE. 42 * DAMAGE.
43 */ 43 */
44 44
45#ifndef CAN_H 45#ifndef _UAPI_CAN_H
46#define CAN_H 46#define _UAPI_CAN_H
47 47
48#include <linux/types.h> 48#include <linux/types.h>
49#include <linux/socket.h> 49#include <linux/socket.h>
@@ -191,4 +191,4 @@ struct can_filter {
191 191
192#define CAN_INV_FILTER 0x20000000U /* to be set in can_filter.can_id */ 192#define CAN_INV_FILTER 0x20000000U /* to be set in can_filter.can_id */
193 193
194#endif /* CAN_H */ 194#endif /* !_UAPI_CAN_H */
diff --git a/include/uapi/linux/can/bcm.h b/include/uapi/linux/can/bcm.h
index 382251a1d214..89ddb9dc9bdf 100644
--- a/include/uapi/linux/can/bcm.h
+++ b/include/uapi/linux/can/bcm.h
@@ -41,8 +41,8 @@
41 * DAMAGE. 41 * DAMAGE.
42 */ 42 */
43 43
44#ifndef CAN_BCM_H 44#ifndef _UAPI_CAN_BCM_H
45#define CAN_BCM_H 45#define _UAPI_CAN_BCM_H
46 46
47#include <linux/types.h> 47#include <linux/types.h>
48#include <linux/can.h> 48#include <linux/can.h>
@@ -95,4 +95,4 @@ enum {
95#define TX_RESET_MULTI_IDX 0x0200 95#define TX_RESET_MULTI_IDX 0x0200
96#define RX_RTR_FRAME 0x0400 96#define RX_RTR_FRAME 0x0400
97 97
98#endif /* CAN_BCM_H */ 98#endif /* !_UAPI_CAN_BCM_H */
diff --git a/include/uapi/linux/can/error.h b/include/uapi/linux/can/error.h
index b63204545320..c247446ab25a 100644
--- a/include/uapi/linux/can/error.h
+++ b/include/uapi/linux/can/error.h
@@ -41,8 +41,8 @@
41 * DAMAGE. 41 * DAMAGE.
42 */ 42 */
43 43
44#ifndef CAN_ERROR_H 44#ifndef _UAPI_CAN_ERROR_H
45#define CAN_ERROR_H 45#define _UAPI_CAN_ERROR_H
46 46
47#define CAN_ERR_DLC 8 /* dlc for error message frames */ 47#define CAN_ERR_DLC 8 /* dlc for error message frames */
48 48
@@ -120,4 +120,4 @@
120 120
121/* controller specific additional information / data[5..7] */ 121/* controller specific additional information / data[5..7] */
122 122
123#endif /* CAN_ERROR_H */ 123#endif /* _UAPI_CAN_ERROR_H */
diff --git a/include/uapi/linux/can/gw.h b/include/uapi/linux/can/gw.h
index 844c8964bdfe..3e6184cf2f6d 100644
--- a/include/uapi/linux/can/gw.h
+++ b/include/uapi/linux/can/gw.h
@@ -41,8 +41,8 @@
41 * DAMAGE. 41 * DAMAGE.
42 */ 42 */
43 43
44#ifndef CAN_GW_H 44#ifndef _UAPI_CAN_GW_H
45#define CAN_GW_H 45#define _UAPI_CAN_GW_H
46 46
47#include <linux/types.h> 47#include <linux/types.h>
48#include <linux/can.h> 48#include <linux/can.h>
@@ -200,4 +200,4 @@ enum {
200 * Beware of sending unpacked or aligned structs! 200 * Beware of sending unpacked or aligned structs!
201 */ 201 */
202 202
203#endif 203#endif /* !_UAPI_CAN_GW_H */
diff --git a/include/uapi/linux/can/netlink.h b/include/uapi/linux/can/netlink.h
index 7e2e1863db16..813d11f54977 100644
--- a/include/uapi/linux/can/netlink.h
+++ b/include/uapi/linux/can/netlink.h
@@ -15,8 +15,8 @@
15 * GNU General Public License for more details. 15 * GNU General Public License for more details.
16 */ 16 */
17 17
18#ifndef CAN_NETLINK_H 18#ifndef _UAPI_CAN_NETLINK_H
19#define CAN_NETLINK_H 19#define _UAPI_CAN_NETLINK_H
20 20
21#include <linux/types.h> 21#include <linux/types.h>
22 22
@@ -130,4 +130,4 @@ enum {
130 130
131#define IFLA_CAN_MAX (__IFLA_CAN_MAX - 1) 131#define IFLA_CAN_MAX (__IFLA_CAN_MAX - 1)
132 132
133#endif /* CAN_NETLINK_H */ 133#endif /* !_UAPI_CAN_NETLINK_H */
diff --git a/include/uapi/linux/can/raw.h b/include/uapi/linux/can/raw.h
index c7d8c334e0ce..78ec76fd89a6 100644
--- a/include/uapi/linux/can/raw.h
+++ b/include/uapi/linux/can/raw.h
@@ -42,8 +42,8 @@
42 * DAMAGE. 42 * DAMAGE.
43 */ 43 */
44 44
45#ifndef CAN_RAW_H 45#ifndef _UAPI_CAN_RAW_H
46#define CAN_RAW_H 46#define _UAPI_CAN_RAW_H
47 47
48#include <linux/can.h> 48#include <linux/can.h>
49 49
@@ -59,4 +59,4 @@ enum {
59 CAN_RAW_FD_FRAMES, /* allow CAN FD frames (default:off) */ 59 CAN_RAW_FD_FRAMES, /* allow CAN FD frames (default:off) */
60}; 60};
61 61
62#endif 62#endif /* !_UAPI_CAN_RAW_H */
diff --git a/include/uapi/linux/capability.h b/include/uapi/linux/capability.h
index 154dd6d3c8fe..12c37a197d24 100644
--- a/include/uapi/linux/capability.h
+++ b/include/uapi/linux/capability.h
@@ -347,7 +347,12 @@ struct vfs_cap_data {
347 347
348#define CAP_BLOCK_SUSPEND 36 348#define CAP_BLOCK_SUSPEND 36
349 349
350#define CAP_LAST_CAP CAP_BLOCK_SUSPEND 350/* Allow reading the audit log via multicast netlink socket */
351
352#define CAP_AUDIT_READ 37
353
354
355#define CAP_LAST_CAP CAP_AUDIT_READ
351 356
352#define cap_valid(x) ((x) >= 0 && (x) <= CAP_LAST_CAP) 357#define cap_valid(x) ((x) >= 0 && (x) <= CAP_LAST_CAP)
353 358
diff --git a/include/uapi/linux/ethtool.h b/include/uapi/linux/ethtool.h
index fd161e91b6d7..e3c7a719c76b 100644
--- a/include/uapi/linux/ethtool.h
+++ b/include/uapi/linux/ethtool.h
@@ -847,6 +847,38 @@ struct ethtool_rxfh_indir {
847}; 847};
848 848
849/** 849/**
850 * struct ethtool_rxfh - command to get/set RX flow hash indir or/and hash key.
851 * @cmd: Specific command number - %ETHTOOL_GRSSH or %ETHTOOL_SRSSH
852 * @rss_context: RSS context identifier.
853 * @indir_size: On entry, the array size of the user buffer for the
854 * indirection table, which may be zero, or (for %ETHTOOL_SRSSH),
855 * %ETH_RXFH_INDIR_NO_CHANGE. On return from %ETHTOOL_GRSSH,
856 * the array size of the hardware indirection table.
857 * @key_size: On entry, the array size of the user buffer for the hash key,
858 * which may be zero. On return from %ETHTOOL_GRSSH, the size of the
859 * hardware hash key.
860 * @rsvd: Reserved for future extensions.
861 * @rss_config: RX ring/queue index for each hash value i.e., indirection table
862 * of @indir_size __u32 elements, followed by hash key of @key_size
863 * bytes.
864 *
865 * For %ETHTOOL_GRSSH, a @indir_size and key_size of zero means that only the
866 * size should be returned. For %ETHTOOL_SRSSH, an @indir_size of
867 * %ETH_RXFH_INDIR_NO_CHANGE means that indir table setting is not requested
868 * and a @indir_size of zero means the indir table should be reset to default
869 * values.
870 */
871struct ethtool_rxfh {
872 __u32 cmd;
873 __u32 rss_context;
874 __u32 indir_size;
875 __u32 key_size;
876 __u32 rsvd[2];
877 __u32 rss_config[0];
878};
879#define ETH_RXFH_INDIR_NO_CHANGE 0xffffffff
880
881/**
850 * struct ethtool_rx_ntuple_flow_spec - specification for RX flow filter 882 * struct ethtool_rx_ntuple_flow_spec - specification for RX flow filter
851 * @flow_type: Type of match to perform, e.g. %TCP_V4_FLOW 883 * @flow_type: Type of match to perform, e.g. %TCP_V4_FLOW
852 * @h_u: Flow field values to match (dependent on @flow_type) 884 * @h_u: Flow field values to match (dependent on @flow_type)
@@ -1118,6 +1150,9 @@ enum ethtool_sfeatures_retval_bits {
1118#define ETHTOOL_GEEE 0x00000044 /* Get EEE settings */ 1150#define ETHTOOL_GEEE 0x00000044 /* Get EEE settings */
1119#define ETHTOOL_SEEE 0x00000045 /* Set EEE settings */ 1151#define ETHTOOL_SEEE 0x00000045 /* Set EEE settings */
1120 1152
1153#define ETHTOOL_GRSSH 0x00000046 /* Get RX flow hash configuration */
1154#define ETHTOOL_SRSSH 0x00000047 /* Set RX flow hash configuration */
1155
1121/* compatibility with older code */ 1156/* compatibility with older code */
1122#define SPARC_ETH_GSET ETHTOOL_GSET 1157#define SPARC_ETH_GSET ETHTOOL_GSET
1123#define SPARC_ETH_SSET ETHTOOL_SSET 1158#define SPARC_ETH_SSET ETHTOOL_SSET
diff --git a/include/uapi/linux/filter.h b/include/uapi/linux/filter.h
index 8eb9ccaa5b48..253b4d42cf2b 100644
--- a/include/uapi/linux/filter.h
+++ b/include/uapi/linux/filter.h
@@ -130,7 +130,8 @@ struct sock_fprog { /* Required for SO_ATTACH_FILTER. */
130#define SKF_AD_VLAN_TAG 44 130#define SKF_AD_VLAN_TAG 44
131#define SKF_AD_VLAN_TAG_PRESENT 48 131#define SKF_AD_VLAN_TAG_PRESENT 48
132#define SKF_AD_PAY_OFFSET 52 132#define SKF_AD_PAY_OFFSET 52
133#define SKF_AD_MAX 56 133#define SKF_AD_RANDOM 56
134#define SKF_AD_MAX 60
134#define SKF_NET_OFF (-0x100000) 135#define SKF_NET_OFF (-0x100000)
135#define SKF_LL_OFF (-0x200000) 136#define SKF_LL_OFF (-0x200000)
136 137
diff --git a/include/uapi/linux/gfs2_ondisk.h b/include/uapi/linux/gfs2_ondisk.h
index db3fdd083882..1a763eaae0bb 100644
--- a/include/uapi/linux/gfs2_ondisk.h
+++ b/include/uapi/linux/gfs2_ondisk.h
@@ -20,7 +20,7 @@
20 20
21#define GFS2_MOUNT_LOCK 0 21#define GFS2_MOUNT_LOCK 0
22#define GFS2_LIVE_LOCK 1 22#define GFS2_LIVE_LOCK 1
23#define GFS2_TRANS_LOCK 2 23#define GFS2_FREEZE_LOCK 2
24#define GFS2_RENAME_LOCK 3 24#define GFS2_RENAME_LOCK 3
25#define GFS2_CONTROL_LOCK 4 25#define GFS2_CONTROL_LOCK 4
26#define GFS2_MOUNTED_LOCK 5 26#define GFS2_MOUNTED_LOCK 5
diff --git a/include/uapi/linux/if_fddi.h b/include/uapi/linux/if_fddi.h
index 0d36909c3aef..1086cd9f6754 100644
--- a/include/uapi/linux/if_fddi.h
+++ b/include/uapi/linux/if_fddi.h
@@ -30,74 +30,76 @@
30 * Define max and min legal sizes. The frame sizes do not include 30 * Define max and min legal sizes. The frame sizes do not include
31 * 4 byte FCS/CRC (frame check sequence). 31 * 4 byte FCS/CRC (frame check sequence).
32 */ 32 */
33#define FDDI_K_ALEN 6 /* Octets in one FDDI address */ 33#define FDDI_K_ALEN 6 /* Octets in one FDDI address */
34#define FDDI_K_8022_HLEN 16 /* Total octets in 802.2 header */ 34#define FDDI_K_8022_HLEN 16 /* Total octets in 802.2 header */
35#define FDDI_K_SNAP_HLEN 21 /* Total octets in 802.2 SNAP header */ 35#define FDDI_K_SNAP_HLEN 21 /* Total octets in 802.2 SNAP header */
36#define FDDI_K_8022_ZLEN 16 /* Min octets in 802.2 frame sans FCS */ 36#define FDDI_K_8022_ZLEN 16 /* Min octets in 802.2 frame sans
37#define FDDI_K_SNAP_ZLEN 21 /* Min octets in 802.2 SNAP frame sans FCS */ 37 FCS */
38#define FDDI_K_SNAP_ZLEN 21 /* Min octets in 802.2 SNAP frame sans
39 FCS */
38#define FDDI_K_8022_DLEN 4475 /* Max octets in 802.2 payload */ 40#define FDDI_K_8022_DLEN 4475 /* Max octets in 802.2 payload */
39#define FDDI_K_SNAP_DLEN 4470 /* Max octets in 802.2 SNAP payload */ 41#define FDDI_K_SNAP_DLEN 4470 /* Max octets in 802.2 SNAP payload */
40#define FDDI_K_LLC_ZLEN 13 /* Min octets in LLC frame sans FCS */ 42#define FDDI_K_LLC_ZLEN 13 /* Min octets in LLC frame sans FCS */
41#define FDDI_K_LLC_LEN 4491 /* Max octets in LLC frame sans FCS */ 43#define FDDI_K_LLC_LEN 4491 /* Max octets in LLC frame sans FCS */
44#define FDDI_K_OUI_LEN 3 /* Octets in OUI in 802.2 SNAP
45 header */
42 46
43/* Define FDDI Frame Control (FC) Byte values */ 47/* Define FDDI Frame Control (FC) Byte values */
44#define FDDI_FC_K_VOID 0x00 48#define FDDI_FC_K_VOID 0x00
45#define FDDI_FC_K_NON_RESTRICTED_TOKEN 0x80 49#define FDDI_FC_K_NON_RESTRICTED_TOKEN 0x80
46#define FDDI_FC_K_RESTRICTED_TOKEN 0xC0 50#define FDDI_FC_K_RESTRICTED_TOKEN 0xC0
47#define FDDI_FC_K_SMT_MIN 0x41 51#define FDDI_FC_K_SMT_MIN 0x41
48#define FDDI_FC_K_SMT_MAX 0x4F 52#define FDDI_FC_K_SMT_MAX 0x4F
49#define FDDI_FC_K_MAC_MIN 0xC1 53#define FDDI_FC_K_MAC_MIN 0xC1
50#define FDDI_FC_K_MAC_MAX 0xCF 54#define FDDI_FC_K_MAC_MAX 0xCF
51#define FDDI_FC_K_ASYNC_LLC_MIN 0x50 55#define FDDI_FC_K_ASYNC_LLC_MIN 0x50
52#define FDDI_FC_K_ASYNC_LLC_DEF 0x54 56#define FDDI_FC_K_ASYNC_LLC_DEF 0x54
53#define FDDI_FC_K_ASYNC_LLC_MAX 0x5F 57#define FDDI_FC_K_ASYNC_LLC_MAX 0x5F
54#define FDDI_FC_K_SYNC_LLC_MIN 0xD0 58#define FDDI_FC_K_SYNC_LLC_MIN 0xD0
55#define FDDI_FC_K_SYNC_LLC_MAX 0xD7 59#define FDDI_FC_K_SYNC_LLC_MAX 0xD7
56#define FDDI_FC_K_IMPLEMENTOR_MIN 0x60 60#define FDDI_FC_K_IMPLEMENTOR_MIN 0x60
57#define FDDI_FC_K_IMPLEMENTOR_MAX 0x6F 61#define FDDI_FC_K_IMPLEMENTOR_MAX 0x6F
58#define FDDI_FC_K_RESERVED_MIN 0x70 62#define FDDI_FC_K_RESERVED_MIN 0x70
59#define FDDI_FC_K_RESERVED_MAX 0x7F 63#define FDDI_FC_K_RESERVED_MAX 0x7F
60 64
61/* Define LLC and SNAP constants */ 65/* Define LLC and SNAP constants */
62#define FDDI_EXTENDED_SAP 0xAA 66#define FDDI_EXTENDED_SAP 0xAA
63#define FDDI_UI_CMD 0x03 67#define FDDI_UI_CMD 0x03
64 68
65/* Define 802.2 Type 1 header */ 69/* Define 802.2 Type 1 header */
66struct fddi_8022_1_hdr { 70struct fddi_8022_1_hdr {
67 __u8 dsap; /* destination service access point */ 71 __u8 dsap; /* destination service access point */
68 __u8 ssap; /* source service access point */ 72 __u8 ssap; /* source service access point */
69 __u8 ctrl; /* control byte #1 */ 73 __u8 ctrl; /* control byte #1 */
70} __attribute__((packed)); 74} __attribute__((packed));
71 75
72/* Define 802.2 Type 2 header */ 76/* Define 802.2 Type 2 header */
73struct fddi_8022_2_hdr { 77struct fddi_8022_2_hdr {
74 __u8 dsap; /* destination service access point */ 78 __u8 dsap; /* destination service access point */
75 __u8 ssap; /* source service access point */ 79 __u8 ssap; /* source service access point */
76 __u8 ctrl_1; /* control byte #1 */ 80 __u8 ctrl_1; /* control byte #1 */
77 __u8 ctrl_2; /* control byte #2 */ 81 __u8 ctrl_2; /* control byte #2 */
78} __attribute__((packed)); 82} __attribute__((packed));
79 83
80/* Define 802.2 SNAP header */ 84/* Define 802.2 SNAP header */
81#define FDDI_K_OUI_LEN 3
82struct fddi_snap_hdr { 85struct fddi_snap_hdr {
83 __u8 dsap; /* always 0xAA */ 86 __u8 dsap; /* always 0xAA */
84 __u8 ssap; /* always 0xAA */ 87 __u8 ssap; /* always 0xAA */
85 __u8 ctrl; /* always 0x03 */ 88 __u8 ctrl; /* always 0x03 */
86 __u8 oui[FDDI_K_OUI_LEN]; /* organizational universal id */ 89 __u8 oui[FDDI_K_OUI_LEN]; /* organizational universal id */
87 __be16 ethertype; /* packet type ID field */ 90 __be16 ethertype; /* packet type ID field */
88} __attribute__((packed)); 91} __attribute__((packed));
89 92
90/* Define FDDI LLC frame header */ 93/* Define FDDI LLC frame header */
91struct fddihdr { 94struct fddihdr {
92 __u8 fc; /* frame control */ 95 __u8 fc; /* frame control */
93 __u8 daddr[FDDI_K_ALEN]; /* destination address */ 96 __u8 daddr[FDDI_K_ALEN]; /* destination address */
94 __u8 saddr[FDDI_K_ALEN]; /* source address */ 97 __u8 saddr[FDDI_K_ALEN]; /* source address */
95 union 98 union {
96 { 99 struct fddi_8022_1_hdr llc_8022_1;
97 struct fddi_8022_1_hdr llc_8022_1; 100 struct fddi_8022_2_hdr llc_8022_2;
98 struct fddi_8022_2_hdr llc_8022_2; 101 struct fddi_snap_hdr llc_snap;
99 struct fddi_snap_hdr llc_snap; 102 } hdr;
100 } hdr;
101} __attribute__((packed)); 103} __attribute__((packed));
102 104
103 105
diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
index 9a7f7ace6649..b38534895db5 100644
--- a/include/uapi/linux/if_link.h
+++ b/include/uapi/linux/if_link.h
@@ -319,6 +319,9 @@ enum {
319 IFLA_VXLAN_PORT, /* destination port */ 319 IFLA_VXLAN_PORT, /* destination port */
320 IFLA_VXLAN_GROUP6, 320 IFLA_VXLAN_GROUP6,
321 IFLA_VXLAN_LOCAL6, 321 IFLA_VXLAN_LOCAL6,
322 IFLA_VXLAN_UDP_CSUM,
323 IFLA_VXLAN_UDP_ZERO_CSUM6_TX,
324 IFLA_VXLAN_UDP_ZERO_CSUM6_RX,
322 __IFLA_VXLAN_MAX 325 __IFLA_VXLAN_MAX
323}; 326};
324#define IFLA_VXLAN_MAX (__IFLA_VXLAN_MAX - 1) 327#define IFLA_VXLAN_MAX (__IFLA_VXLAN_MAX - 1)
@@ -399,9 +402,10 @@ enum {
399 IFLA_VF_UNSPEC, 402 IFLA_VF_UNSPEC,
400 IFLA_VF_MAC, /* Hardware queue specific attributes */ 403 IFLA_VF_MAC, /* Hardware queue specific attributes */
401 IFLA_VF_VLAN, 404 IFLA_VF_VLAN,
402 IFLA_VF_TX_RATE, /* TX Bandwidth Allocation */ 405 IFLA_VF_TX_RATE, /* Max TX Bandwidth Allocation */
403 IFLA_VF_SPOOFCHK, /* Spoof Checking on/off switch */ 406 IFLA_VF_SPOOFCHK, /* Spoof Checking on/off switch */
404 IFLA_VF_LINK_STATE, /* link state enable/disable/auto switch */ 407 IFLA_VF_LINK_STATE, /* link state enable/disable/auto switch */
408 IFLA_VF_RATE, /* Min and Max TX Bandwidth Allocation */
405 __IFLA_VF_MAX, 409 __IFLA_VF_MAX,
406}; 410};
407 411
@@ -423,6 +427,12 @@ struct ifla_vf_tx_rate {
423 __u32 rate; /* Max TX bandwidth in Mbps, 0 disables throttling */ 427 __u32 rate; /* Max TX bandwidth in Mbps, 0 disables throttling */
424}; 428};
425 429
430struct ifla_vf_rate {
431 __u32 vf;
432 __u32 min_tx_rate; /* Min Bandwidth in Mbps */
433 __u32 max_tx_rate; /* Max Bandwidth in Mbps */
434};
435
426struct ifla_vf_spoofchk { 436struct ifla_vf_spoofchk {
427 __u32 vf; 437 __u32 vf;
428 __u32 setting; 438 __u32 setting;
diff --git a/include/uapi/linux/if_tunnel.h b/include/uapi/linux/if_tunnel.h
index aee73d0611fb..3bce9e9d9f7c 100644
--- a/include/uapi/linux/if_tunnel.h
+++ b/include/uapi/linux/if_tunnel.h
@@ -100,7 +100,7 @@ enum {
100#define IFLA_GRE_MAX (__IFLA_GRE_MAX - 1) 100#define IFLA_GRE_MAX (__IFLA_GRE_MAX - 1)
101 101
102/* VTI-mode i_flags */ 102/* VTI-mode i_flags */
103#define VTI_ISVTI 0x0001 103#define VTI_ISVTI ((__force __be16)0x0001)
104 104
105enum { 105enum {
106 IFLA_VTI_UNSPEC, 106 IFLA_VTI_UNSPEC,
diff --git a/include/uapi/linux/input.h b/include/uapi/linux/input.h
index f4849525519c..19df18c9b8be 100644
--- a/include/uapi/linux/input.h
+++ b/include/uapi/linux/input.h
@@ -462,7 +462,10 @@ struct input_keymap_entry {
462#define KEY_VIDEO_NEXT 241 /* drive next video source */ 462#define KEY_VIDEO_NEXT 241 /* drive next video source */
463#define KEY_VIDEO_PREV 242 /* drive previous video source */ 463#define KEY_VIDEO_PREV 242 /* drive previous video source */
464#define KEY_BRIGHTNESS_CYCLE 243 /* brightness up, after max is min */ 464#define KEY_BRIGHTNESS_CYCLE 243 /* brightness up, after max is min */
465#define KEY_BRIGHTNESS_ZERO 244 /* brightness off, use ambient */ 465#define KEY_BRIGHTNESS_AUTO 244 /* Set Auto Brightness: manual
466 brightness control is off,
467 rely on ambient */
468#define KEY_BRIGHTNESS_ZERO KEY_BRIGHTNESS_AUTO
466#define KEY_DISPLAY_OFF 245 /* display device to off state */ 469#define KEY_DISPLAY_OFF 245 /* display device to off state */
467 470
468#define KEY_WWAN 246 /* Wireless WAN (LTE, UMTS, GSM, etc.) */ 471#define KEY_WWAN 246 /* Wireless WAN (LTE, UMTS, GSM, etc.) */
@@ -632,6 +635,7 @@ struct input_keymap_entry {
632#define KEY_ADDRESSBOOK 0x1ad /* AL Contacts/Address Book */ 635#define KEY_ADDRESSBOOK 0x1ad /* AL Contacts/Address Book */
633#define KEY_MESSENGER 0x1ae /* AL Instant Messaging */ 636#define KEY_MESSENGER 0x1ae /* AL Instant Messaging */
634#define KEY_DISPLAYTOGGLE 0x1af /* Turn display (LCD) on and off */ 637#define KEY_DISPLAYTOGGLE 0x1af /* Turn display (LCD) on and off */
638#define KEY_BRIGHTNESS_TOGGLE KEY_DISPLAYTOGGLE
635#define KEY_SPELLCHECK 0x1b0 /* AL Spell Check */ 639#define KEY_SPELLCHECK 0x1b0 /* AL Spell Check */
636#define KEY_LOGOFF 0x1b1 /* AL Logoff */ 640#define KEY_LOGOFF 0x1b1 /* AL Logoff */
637 641
@@ -723,6 +727,17 @@ struct input_keymap_entry {
723 727
724#define KEY_ALS_TOGGLE 0x230 /* Ambient light sensor */ 728#define KEY_ALS_TOGGLE 0x230 /* Ambient light sensor */
725 729
730#define KEY_BUTTONCONFIG 0x240 /* AL Button Configuration */
731#define KEY_TASKMANAGER 0x241 /* AL Task/Project Manager */
732#define KEY_JOURNAL 0x242 /* AL Log/Journal/Timecard */
733#define KEY_CONTROLPANEL 0x243 /* AL Control Panel */
734#define KEY_APPSELECT 0x244 /* AL Select Task/Application */
735#define KEY_SCREENSAVER 0x245 /* AL Screen Saver */
736#define KEY_VOICECOMMAND 0x246 /* Listening Voice Command */
737
738#define KEY_BRIGHTNESS_MIN 0x250 /* Set Brightness to Minimum */
739#define KEY_BRIGHTNESS_MAX 0x251 /* Set Brightness to Maximum */
740
726#define BTN_TRIGGER_HAPPY 0x2c0 741#define BTN_TRIGGER_HAPPY 0x2c0
727#define BTN_TRIGGER_HAPPY1 0x2c0 742#define BTN_TRIGGER_HAPPY1 0x2c0
728#define BTN_TRIGGER_HAPPY2 0x2c1 743#define BTN_TRIGGER_HAPPY2 0x2c1
diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h
index a8f4ee5d2e82..e11d8f170a62 100644
--- a/include/uapi/linux/kvm.h
+++ b/include/uapi/linux/kvm.h
@@ -171,6 +171,7 @@ struct kvm_pit_config {
171#define KVM_EXIT_WATCHDOG 21 171#define KVM_EXIT_WATCHDOG 21
172#define KVM_EXIT_S390_TSCH 22 172#define KVM_EXIT_S390_TSCH 22
173#define KVM_EXIT_EPR 23 173#define KVM_EXIT_EPR 23
174#define KVM_EXIT_SYSTEM_EVENT 24
174 175
175/* For KVM_EXIT_INTERNAL_ERROR */ 176/* For KVM_EXIT_INTERNAL_ERROR */
176/* Emulate instruction failed. */ 177/* Emulate instruction failed. */
@@ -301,6 +302,13 @@ struct kvm_run {
301 struct { 302 struct {
302 __u32 epr; 303 __u32 epr;
303 } epr; 304 } epr;
305 /* KVM_EXIT_SYSTEM_EVENT */
306 struct {
307#define KVM_SYSTEM_EVENT_SHUTDOWN 1
308#define KVM_SYSTEM_EVENT_RESET 2
309 __u32 type;
310 __u64 flags;
311 } system_event;
304 /* Fix the size of the union. */ 312 /* Fix the size of the union. */
305 char padding[256]; 313 char padding[256];
306 }; 314 };
@@ -416,6 +424,8 @@ struct kvm_s390_psw {
416#define KVM_S390_INT_PFAULT_INIT 0xfffe0004u 424#define KVM_S390_INT_PFAULT_INIT 0xfffe0004u
417#define KVM_S390_INT_PFAULT_DONE 0xfffe0005u 425#define KVM_S390_INT_PFAULT_DONE 0xfffe0005u
418#define KVM_S390_MCHK 0xfffe1000u 426#define KVM_S390_MCHK 0xfffe1000u
427#define KVM_S390_INT_CLOCK_COMP 0xffff1004u
428#define KVM_S390_INT_CPU_TIMER 0xffff1005u
419#define KVM_S390_INT_VIRTIO 0xffff2603u 429#define KVM_S390_INT_VIRTIO 0xffff2603u
420#define KVM_S390_INT_SERVICE 0xffff2401u 430#define KVM_S390_INT_SERVICE 0xffff2401u
421#define KVM_S390_INT_EMERGENCY 0xffff1201u 431#define KVM_S390_INT_EMERGENCY 0xffff1201u
@@ -515,6 +525,7 @@ enum {
515 kvm_ioeventfd_flag_nr_pio, 525 kvm_ioeventfd_flag_nr_pio,
516 kvm_ioeventfd_flag_nr_deassign, 526 kvm_ioeventfd_flag_nr_deassign,
517 kvm_ioeventfd_flag_nr_virtio_ccw_notify, 527 kvm_ioeventfd_flag_nr_virtio_ccw_notify,
528 kvm_ioeventfd_flag_nr_fast_mmio,
518 kvm_ioeventfd_flag_nr_max, 529 kvm_ioeventfd_flag_nr_max,
519}; 530};
520 531
@@ -529,7 +540,7 @@ enum {
529struct kvm_ioeventfd { 540struct kvm_ioeventfd {
530 __u64 datamatch; 541 __u64 datamatch;
531 __u64 addr; /* legal pio/mmio address */ 542 __u64 addr; /* legal pio/mmio address */
532 __u32 len; /* 1, 2, 4, or 8 bytes */ 543 __u32 len; /* 1, 2, 4, or 8 bytes; or 0 to ignore length */
533 __s32 fd; 544 __s32 fd;
534 __u32 flags; 545 __u32 flags;
535 __u8 pad[36]; 546 __u8 pad[36];
@@ -743,6 +754,10 @@ struct kvm_ppc_smmu_info {
743#define KVM_CAP_IOAPIC_POLARITY_IGNORED 97 754#define KVM_CAP_IOAPIC_POLARITY_IGNORED 97
744#define KVM_CAP_ENABLE_CAP_VM 98 755#define KVM_CAP_ENABLE_CAP_VM 98
745#define KVM_CAP_S390_IRQCHIP 99 756#define KVM_CAP_S390_IRQCHIP 99
757#define KVM_CAP_IOEVENTFD_NO_LENGTH 100
758#define KVM_CAP_VM_ATTRIBUTES 101
759#define KVM_CAP_ARM_PSCI_0_2 102
760#define KVM_CAP_PPC_FIXUP_HCALL 103
746 761
747#ifdef KVM_CAP_IRQ_ROUTING 762#ifdef KVM_CAP_IRQ_ROUTING
748 763
diff --git a/include/uapi/linux/kvm_para.h b/include/uapi/linux/kvm_para.h
index 2841f86eae0b..bf6cd7d5cac2 100644
--- a/include/uapi/linux/kvm_para.h
+++ b/include/uapi/linux/kvm_para.h
@@ -20,6 +20,9 @@
20#define KVM_HC_FEATURES 3 20#define KVM_HC_FEATURES 3
21#define KVM_HC_PPC_MAP_MAGIC_PAGE 4 21#define KVM_HC_PPC_MAP_MAGIC_PAGE 4
22#define KVM_HC_KICK_CPU 5 22#define KVM_HC_KICK_CPU 5
23#define KVM_HC_MIPS_GET_CLOCK_FREQ 6
24#define KVM_HC_MIPS_EXIT_VM 7
25#define KVM_HC_MIPS_CONSOLE_OUTPUT 8
23 26
24/* 27/*
25 * hypercalls use architecture specific 28 * hypercalls use architecture specific
diff --git a/include/uapi/linux/l2tp.h b/include/uapi/linux/l2tp.h
index 8adb68160327..21caa2631c20 100644
--- a/include/uapi/linux/l2tp.h
+++ b/include/uapi/linux/l2tp.h
@@ -124,6 +124,8 @@ enum {
124 L2TP_ATTR_STATS, /* nested */ 124 L2TP_ATTR_STATS, /* nested */
125 L2TP_ATTR_IP6_SADDR, /* struct in6_addr */ 125 L2TP_ATTR_IP6_SADDR, /* struct in6_addr */
126 L2TP_ATTR_IP6_DADDR, /* struct in6_addr */ 126 L2TP_ATTR_IP6_DADDR, /* struct in6_addr */
127 L2TP_ATTR_UDP_ZERO_CSUM6_TX, /* u8 */
128 L2TP_ATTR_UDP_ZERO_CSUM6_RX, /* u8 */
127 __L2TP_ATTR_MAX, 129 __L2TP_ATTR_MAX,
128}; 130};
129 131
diff --git a/include/uapi/linux/neighbour.h b/include/uapi/linux/neighbour.h
index d3ef583104e0..4a1d7e96dfe3 100644
--- a/include/uapi/linux/neighbour.h
+++ b/include/uapi/linux/neighbour.h
@@ -24,6 +24,7 @@ enum {
24 NDA_PORT, 24 NDA_PORT,
25 NDA_VNI, 25 NDA_VNI,
26 NDA_IFINDEX, 26 NDA_IFINDEX,
27 NDA_MASTER,
27 __NDA_MAX 28 __NDA_MAX
28}; 29};
29 30
diff --git a/include/uapi/linux/netfilter/nf_tables.h b/include/uapi/linux/netfilter/nf_tables.h
index c88ccbfda5f1..2a88f645a5d8 100644
--- a/include/uapi/linux/netfilter/nf_tables.h
+++ b/include/uapi/linux/netfilter/nf_tables.h
@@ -212,6 +212,29 @@ enum nft_set_flags {
212}; 212};
213 213
214/** 214/**
215 * enum nft_set_policies - set selection policy
216 *
217 * @NFT_SET_POL_PERFORMANCE: prefer high performance over low memory use
218 * @NFT_SET_POL_MEMORY: prefer low memory use over high performance
219 */
220enum nft_set_policies {
221 NFT_SET_POL_PERFORMANCE,
222 NFT_SET_POL_MEMORY,
223};
224
225/**
226 * enum nft_set_desc_attributes - set element description
227 *
228 * @NFTA_SET_DESC_SIZE: number of elements in set (NLA_U32)
229 */
230enum nft_set_desc_attributes {
231 NFTA_SET_DESC_UNSPEC,
232 NFTA_SET_DESC_SIZE,
233 __NFTA_SET_DESC_MAX
234};
235#define NFTA_SET_DESC_MAX (__NFTA_SET_DESC_MAX - 1)
236
237/**
215 * enum nft_set_attributes - nf_tables set netlink attributes 238 * enum nft_set_attributes - nf_tables set netlink attributes
216 * 239 *
217 * @NFTA_SET_TABLE: table name (NLA_STRING) 240 * @NFTA_SET_TABLE: table name (NLA_STRING)
@@ -221,6 +244,9 @@ enum nft_set_flags {
221 * @NFTA_SET_KEY_LEN: key data length (NLA_U32) 244 * @NFTA_SET_KEY_LEN: key data length (NLA_U32)
222 * @NFTA_SET_DATA_TYPE: mapping data type (NLA_U32) 245 * @NFTA_SET_DATA_TYPE: mapping data type (NLA_U32)
223 * @NFTA_SET_DATA_LEN: mapping data length (NLA_U32) 246 * @NFTA_SET_DATA_LEN: mapping data length (NLA_U32)
247 * @NFTA_SET_POLICY: selection policy (NLA_U32)
248 * @NFTA_SET_DESC: set description (NLA_NESTED)
249 * @NFTA_SET_ID: uniquely identifies a set in a transaction (NLA_U32)
224 */ 250 */
225enum nft_set_attributes { 251enum nft_set_attributes {
226 NFTA_SET_UNSPEC, 252 NFTA_SET_UNSPEC,
@@ -231,6 +257,9 @@ enum nft_set_attributes {
231 NFTA_SET_KEY_LEN, 257 NFTA_SET_KEY_LEN,
232 NFTA_SET_DATA_TYPE, 258 NFTA_SET_DATA_TYPE,
233 NFTA_SET_DATA_LEN, 259 NFTA_SET_DATA_LEN,
260 NFTA_SET_POLICY,
261 NFTA_SET_DESC,
262 NFTA_SET_ID,
234 __NFTA_SET_MAX 263 __NFTA_SET_MAX
235}; 264};
236#define NFTA_SET_MAX (__NFTA_SET_MAX - 1) 265#define NFTA_SET_MAX (__NFTA_SET_MAX - 1)
@@ -266,12 +295,14 @@ enum nft_set_elem_attributes {
266 * @NFTA_SET_ELEM_LIST_TABLE: table of the set to be changed (NLA_STRING) 295 * @NFTA_SET_ELEM_LIST_TABLE: table of the set to be changed (NLA_STRING)
267 * @NFTA_SET_ELEM_LIST_SET: name of the set to be changed (NLA_STRING) 296 * @NFTA_SET_ELEM_LIST_SET: name of the set to be changed (NLA_STRING)
268 * @NFTA_SET_ELEM_LIST_ELEMENTS: list of set elements (NLA_NESTED: nft_set_elem_attributes) 297 * @NFTA_SET_ELEM_LIST_ELEMENTS: list of set elements (NLA_NESTED: nft_set_elem_attributes)
298 * @NFTA_SET_ELEM_LIST_SET_ID: uniquely identifies a set in a transaction (NLA_U32)
269 */ 299 */
270enum nft_set_elem_list_attributes { 300enum nft_set_elem_list_attributes {
271 NFTA_SET_ELEM_LIST_UNSPEC, 301 NFTA_SET_ELEM_LIST_UNSPEC,
272 NFTA_SET_ELEM_LIST_TABLE, 302 NFTA_SET_ELEM_LIST_TABLE,
273 NFTA_SET_ELEM_LIST_SET, 303 NFTA_SET_ELEM_LIST_SET,
274 NFTA_SET_ELEM_LIST_ELEMENTS, 304 NFTA_SET_ELEM_LIST_ELEMENTS,
305 NFTA_SET_ELEM_LIST_SET_ID,
275 __NFTA_SET_ELEM_LIST_MAX 306 __NFTA_SET_ELEM_LIST_MAX
276}; 307};
277#define NFTA_SET_ELEM_LIST_MAX (__NFTA_SET_ELEM_LIST_MAX - 1) 308#define NFTA_SET_ELEM_LIST_MAX (__NFTA_SET_ELEM_LIST_MAX - 1)
@@ -457,12 +488,14 @@ enum nft_cmp_attributes {
457 * @NFTA_LOOKUP_SET: name of the set where to look for (NLA_STRING) 488 * @NFTA_LOOKUP_SET: name of the set where to look for (NLA_STRING)
458 * @NFTA_LOOKUP_SREG: source register of the data to look for (NLA_U32: nft_registers) 489 * @NFTA_LOOKUP_SREG: source register of the data to look for (NLA_U32: nft_registers)
459 * @NFTA_LOOKUP_DREG: destination register (NLA_U32: nft_registers) 490 * @NFTA_LOOKUP_DREG: destination register (NLA_U32: nft_registers)
491 * @NFTA_LOOKUP_SET_ID: uniquely identifies a set in a transaction (NLA_U32)
460 */ 492 */
461enum nft_lookup_attributes { 493enum nft_lookup_attributes {
462 NFTA_LOOKUP_UNSPEC, 494 NFTA_LOOKUP_UNSPEC,
463 NFTA_LOOKUP_SET, 495 NFTA_LOOKUP_SET,
464 NFTA_LOOKUP_SREG, 496 NFTA_LOOKUP_SREG,
465 NFTA_LOOKUP_DREG, 497 NFTA_LOOKUP_DREG,
498 NFTA_LOOKUP_SET_ID,
466 __NFTA_LOOKUP_MAX 499 __NFTA_LOOKUP_MAX
467}; 500};
468#define NFTA_LOOKUP_MAX (__NFTA_LOOKUP_MAX - 1) 501#define NFTA_LOOKUP_MAX (__NFTA_LOOKUP_MAX - 1)
@@ -536,6 +569,8 @@ enum nft_exthdr_attributes {
536 * @NFT_META_SECMARK: packet secmark (skb->secmark) 569 * @NFT_META_SECMARK: packet secmark (skb->secmark)
537 * @NFT_META_NFPROTO: netfilter protocol 570 * @NFT_META_NFPROTO: netfilter protocol
538 * @NFT_META_L4PROTO: layer 4 protocol number 571 * @NFT_META_L4PROTO: layer 4 protocol number
572 * @NFT_META_BRI_IIFNAME: packet input bridge interface name
573 * @NFT_META_BRI_OIFNAME: packet output bridge interface name
539 */ 574 */
540enum nft_meta_keys { 575enum nft_meta_keys {
541 NFT_META_LEN, 576 NFT_META_LEN,
@@ -555,6 +590,8 @@ enum nft_meta_keys {
555 NFT_META_SECMARK, 590 NFT_META_SECMARK,
556 NFT_META_NFPROTO, 591 NFT_META_NFPROTO,
557 NFT_META_L4PROTO, 592 NFT_META_L4PROTO,
593 NFT_META_BRI_IIFNAME,
594 NFT_META_BRI_OIFNAME,
558}; 595};
559 596
560/** 597/**
diff --git a/include/uapi/linux/netfilter/nfnetlink.h b/include/uapi/linux/netfilter/nfnetlink.h
index 596ddd45253c..354a7e5e50f2 100644
--- a/include/uapi/linux/netfilter/nfnetlink.h
+++ b/include/uapi/linux/netfilter/nfnetlink.h
@@ -20,6 +20,8 @@ enum nfnetlink_groups {
20#define NFNLGRP_CONNTRACK_EXP_DESTROY NFNLGRP_CONNTRACK_EXP_DESTROY 20#define NFNLGRP_CONNTRACK_EXP_DESTROY NFNLGRP_CONNTRACK_EXP_DESTROY
21 NFNLGRP_NFTABLES, 21 NFNLGRP_NFTABLES,
22#define NFNLGRP_NFTABLES NFNLGRP_NFTABLES 22#define NFNLGRP_NFTABLES NFNLGRP_NFTABLES
23 NFNLGRP_ACCT_QUOTA,
24#define NFNLGRP_ACCT_QUOTA NFNLGRP_ACCT_QUOTA
23 __NFNLGRP_MAX, 25 __NFNLGRP_MAX,
24}; 26};
25#define NFNLGRP_MAX (__NFNLGRP_MAX - 1) 27#define NFNLGRP_MAX (__NFNLGRP_MAX - 1)
diff --git a/include/uapi/linux/netfilter/nfnetlink_acct.h b/include/uapi/linux/netfilter/nfnetlink_acct.h
index c7b6269e760b..51404ec19022 100644
--- a/include/uapi/linux/netfilter/nfnetlink_acct.h
+++ b/include/uapi/linux/netfilter/nfnetlink_acct.h
@@ -10,15 +10,24 @@ enum nfnl_acct_msg_types {
10 NFNL_MSG_ACCT_GET, 10 NFNL_MSG_ACCT_GET,
11 NFNL_MSG_ACCT_GET_CTRZERO, 11 NFNL_MSG_ACCT_GET_CTRZERO,
12 NFNL_MSG_ACCT_DEL, 12 NFNL_MSG_ACCT_DEL,
13 NFNL_MSG_ACCT_OVERQUOTA,
13 NFNL_MSG_ACCT_MAX 14 NFNL_MSG_ACCT_MAX
14}; 15};
15 16
17enum nfnl_acct_flags {
18 NFACCT_F_QUOTA_PKTS = (1 << 0),
19 NFACCT_F_QUOTA_BYTES = (1 << 1),
20 NFACCT_F_OVERQUOTA = (1 << 2), /* can't be set from userspace */
21};
22
16enum nfnl_acct_type { 23enum nfnl_acct_type {
17 NFACCT_UNSPEC, 24 NFACCT_UNSPEC,
18 NFACCT_NAME, 25 NFACCT_NAME,
19 NFACCT_PKTS, 26 NFACCT_PKTS,
20 NFACCT_BYTES, 27 NFACCT_BYTES,
21 NFACCT_USE, 28 NFACCT_USE,
29 NFACCT_FLAGS,
30 NFACCT_QUOTA,
22 __NFACCT_MAX 31 __NFACCT_MAX
23}; 32};
24#define NFACCT_MAX (__NFACCT_MAX - 1) 33#define NFACCT_MAX (__NFACCT_MAX - 1)
diff --git a/include/uapi/linux/nfc.h b/include/uapi/linux/nfc.h
index 9789dc95b6a8..9b19b4461928 100644
--- a/include/uapi/linux/nfc.h
+++ b/include/uapi/linux/nfc.h
@@ -273,11 +273,19 @@ struct sockaddr_nfc_llcp {
273 * First byte is the adapter index 273 * First byte is the adapter index
274 * Second byte contains flags 274 * Second byte contains flags
275 * - 0x01 - Direction (0=RX, 1=TX) 275 * - 0x01 - Direction (0=RX, 1=TX)
276 * - 0x02-0x80 - Reserved 276 * - 0x02-0x04 - Payload type (000=LLCP, 001=NCI, 010=HCI, 011=Digital,
277 * 100=Proprietary)
278 * - 0x05-0x80 - Reserved
277 **/ 279 **/
278#define NFC_LLCP_RAW_HEADER_SIZE 2 280#define NFC_RAW_HEADER_SIZE 2
279#define NFC_LLCP_DIRECTION_RX 0x00 281#define NFC_DIRECTION_RX 0x00
280#define NFC_LLCP_DIRECTION_TX 0x01 282#define NFC_DIRECTION_TX 0x01
283
284#define RAW_PAYLOAD_LLCP 0
285#define RAW_PAYLOAD_NCI 1
286#define RAW_PAYLOAD_HCI 2
287#define RAW_PAYLOAD_DIGITAL 3
288#define RAW_PAYLOAD_PROPRIETARY 4
281 289
282/* socket option names */ 290/* socket option names */
283#define NFC_LLCP_RW 0 291#define NFC_LLCP_RW 0
diff --git a/include/uapi/linux/nfsd/nfsfh.h b/include/uapi/linux/nfsd/nfsfh.h
index 616e3b396476..20391235d088 100644
--- a/include/uapi/linux/nfsd/nfsfh.h
+++ b/include/uapi/linux/nfsd/nfsfh.h
@@ -1,13 +1,7 @@
1/* 1/*
2 * include/linux/nfsd/nfsfh.h
3 *
4 * This file describes the layout of the file handles as passed 2 * This file describes the layout of the file handles as passed
5 * over the wire. 3 * over the wire.
6 * 4 *
7 * Earlier versions of knfsd used to sign file handles using keyed MD5
8 * or SHA. I've removed this code, because it doesn't give you more
9 * security than blocking external access to port 2049 on your firewall.
10 *
11 * Copyright (C) 1995, 1996, 1997 Olaf Kirch <okir@monad.swb.de> 5 * Copyright (C) 1995, 1996, 1997 Olaf Kirch <okir@monad.swb.de>
12 */ 6 */
13 7
@@ -37,7 +31,7 @@ struct nfs_fhbase_old {
37}; 31};
38 32
39/* 33/*
40 * This is the new flexible, extensible style NFSv2/v3 file handle. 34 * This is the new flexible, extensible style NFSv2/v3/v4 file handle.
41 * by Neil Brown <neilb@cse.unsw.edu.au> - March 2000 35 * by Neil Brown <neilb@cse.unsw.edu.au> - March 2000
42 * 36 *
43 * The file handle starts with a sequence of four-byte words. 37 * The file handle starts with a sequence of four-byte words.
@@ -47,14 +41,7 @@ struct nfs_fhbase_old {
47 * 41 *
48 * All four-byte values are in host-byte-order. 42 * All four-byte values are in host-byte-order.
49 * 43 *
50 * The auth_type field specifies how the filehandle can be authenticated 44 * The auth_type field is deprecated and must be set to 0.
51 * This might allow a file to be confirmed to be in a writable part of a
52 * filetree without checking the path from it up to the root.
53 * Current values:
54 * 0 - No authentication. fb_auth is 0 bytes long
55 * Possible future values:
56 * 1 - 4 bytes taken from MD5 hash of the remainer of the file handle
57 * prefixed by a secret and with the important export flags.
58 * 45 *
59 * The fsid_type identifies how the filesystem (or export point) is 46 * The fsid_type identifies how the filesystem (or export point) is
60 * encoded. 47 * encoded.
@@ -71,14 +58,9 @@ struct nfs_fhbase_old {
71 * 7 - 8 byte inode number and 16 byte uuid 58 * 7 - 8 byte inode number and 16 byte uuid
72 * 59 *
73 * The fileid_type identified how the file within the filesystem is encoded. 60 * The fileid_type identified how the file within the filesystem is encoded.
74 * This is (will be) passed to, and set by, the underlying filesystem if it supports 61 * The values for this field are filesystem specific, exccept that
75 * filehandle operations. The filesystem must not use the value '0' or '0xff' and may 62 * filesystems must not use the values '0' or '0xff'. 'See enum fid_type'
76 * only use the values 1 and 2 as defined below: 63 * in include/linux/exportfs.h for currently registered values.
77 * Current values:
78 * 0 - The root, or export point, of the filesystem. fb_fileid is 0 bytes.
79 * 1 - 32bit inode number, 32 bit generation number.
80 * 2 - 32bit inode number, 32 bit generation number, 32 bit parent directory inode number.
81 *
82 */ 64 */
83struct nfs_fhbase_new { 65struct nfs_fhbase_new {
84 __u8 fb_version; /* == 1, even => nfs_fhbase_old */ 66 __u8 fb_version; /* == 1, even => nfs_fhbase_old */
@@ -114,9 +96,9 @@ struct knfsd_fh {
114#define fh_fsid_type fh_base.fh_new.fb_fsid_type 96#define fh_fsid_type fh_base.fh_new.fb_fsid_type
115#define fh_auth_type fh_base.fh_new.fb_auth_type 97#define fh_auth_type fh_base.fh_new.fb_auth_type
116#define fh_fileid_type fh_base.fh_new.fb_fileid_type 98#define fh_fileid_type fh_base.fh_new.fb_fileid_type
117#define fh_auth fh_base.fh_new.fb_auth
118#define fh_fsid fh_base.fh_new.fb_auth 99#define fh_fsid fh_base.fh_new.fb_auth
119 100
120 101/* Do not use, provided for userspace compatiblity. */
102#define fh_auth fh_base.fh_new.fb_auth
121 103
122#endif /* _UAPI_LINUX_NFSD_FH_H */ 104#endif /* _UAPI_LINUX_NFSD_FH_H */
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 1ba9d626aa83..be9519b52bb1 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -503,6 +503,9 @@
503 * TX status event pertaining to the TX request. 503 * TX status event pertaining to the TX request.
504 * %NL80211_ATTR_TX_NO_CCK_RATE is used to decide whether to send the 504 * %NL80211_ATTR_TX_NO_CCK_RATE is used to decide whether to send the
505 * management frames at CCK rate or not in 2GHz band. 505 * management frames at CCK rate or not in 2GHz band.
506 * %NL80211_ATTR_CSA_C_OFFSETS_TX is an array of offsets to CSA
507 * counters which will be updated to the current value. This attribute
508 * is used during CSA period.
506 * @NL80211_CMD_FRAME_WAIT_CANCEL: When an off-channel TX was requested, this 509 * @NL80211_CMD_FRAME_WAIT_CANCEL: When an off-channel TX was requested, this
507 * command may be used with the corresponding cookie to cancel the wait 510 * command may be used with the corresponding cookie to cancel the wait
508 * time if it is known that it is no longer necessary. 511 * time if it is known that it is no longer necessary.
@@ -1525,10 +1528,10 @@ enum nl80211_commands {
1525 * operation). 1528 * operation).
1526 * @NL80211_ATTR_CSA_IES: Nested set of attributes containing the IE information 1529 * @NL80211_ATTR_CSA_IES: Nested set of attributes containing the IE information
1527 * for the time while performing a channel switch. 1530 * for the time while performing a channel switch.
1528 * @NL80211_ATTR_CSA_C_OFF_BEACON: Offset of the channel switch counter 1531 * @NL80211_ATTR_CSA_C_OFF_BEACON: An array of offsets (u16) to the channel
1529 * field in the beacons tail (%NL80211_ATTR_BEACON_TAIL). 1532 * switch counters in the beacons tail (%NL80211_ATTR_BEACON_TAIL).
1530 * @NL80211_ATTR_CSA_C_OFF_PRESP: Offset of the channel switch counter 1533 * @NL80211_ATTR_CSA_C_OFF_PRESP: An array of offsets (u16) to the channel
1531 * field in the probe response (%NL80211_ATTR_PROBE_RESP). 1534 * switch counters in the probe response (%NL80211_ATTR_PROBE_RESP).
1532 * 1535 *
1533 * @NL80211_ATTR_RXMGMT_FLAGS: flags for nl80211_send_mgmt(), u32. 1536 * @NL80211_ATTR_RXMGMT_FLAGS: flags for nl80211_send_mgmt(), u32.
1534 * As specified in the &enum nl80211_rxmgmt_flags. 1537 * As specified in the &enum nl80211_rxmgmt_flags.
@@ -1576,9 +1579,18 @@ enum nl80211_commands {
1576 * advertise values that cannot always be met. In such cases, an attempt 1579 * advertise values that cannot always be met. In such cases, an attempt
1577 * to add a new station entry with @NL80211_CMD_NEW_STATION may fail. 1580 * to add a new station entry with @NL80211_CMD_NEW_STATION may fail.
1578 * 1581 *
1582 * @NL80211_ATTR_CSA_C_OFFSETS_TX: An array of csa counter offsets (u16) which
1583 * should be updated when the frame is transmitted.
1584 * @NL80211_ATTR_MAX_CSA_COUNTERS: U8 attribute used to advertise the maximum
1585 * supported number of csa counters.
1586 *
1579 * @NL80211_ATTR_TDLS_PEER_CAPABILITY: flags for TDLS peer capabilities, u32. 1587 * @NL80211_ATTR_TDLS_PEER_CAPABILITY: flags for TDLS peer capabilities, u32.
1580 * As specified in the &enum nl80211_tdls_peer_capability. 1588 * As specified in the &enum nl80211_tdls_peer_capability.
1581 * 1589 *
1590 * @NL80211_ATTR_IFACE_SOCKET_OWNER: flag attribute, if set during interface
1591 * creation then the new interface will be owned by the netlink socket
1592 * that created it and will be destroyed when the socket is closed
1593 *
1582 * @NL80211_ATTR_MAX: highest attribute number currently defined 1594 * @NL80211_ATTR_MAX: highest attribute number currently defined
1583 * @__NL80211_ATTR_AFTER_LAST: internal use 1595 * @__NL80211_ATTR_AFTER_LAST: internal use
1584 */ 1596 */
@@ -1914,6 +1926,11 @@ enum nl80211_attrs {
1914 1926
1915 NL80211_ATTR_TDLS_PEER_CAPABILITY, 1927 NL80211_ATTR_TDLS_PEER_CAPABILITY,
1916 1928
1929 NL80211_ATTR_IFACE_SOCKET_OWNER,
1930
1931 NL80211_ATTR_CSA_C_OFFSETS_TX,
1932 NL80211_ATTR_MAX_CSA_COUNTERS,
1933
1917 /* add attributes here, update the policy in nl80211.c */ 1934 /* add attributes here, update the policy in nl80211.c */
1918 1935
1919 __NL80211_ATTR_AFTER_LAST, 1936 __NL80211_ATTR_AFTER_LAST,
@@ -2182,6 +2199,8 @@ enum nl80211_sta_bss_param {
2182 * Contains a nested array of signal strength attributes (u8, dBm) 2199 * Contains a nested array of signal strength attributes (u8, dBm)
2183 * @NL80211_STA_INFO_CHAIN_SIGNAL_AVG: per-chain signal strength average 2200 * @NL80211_STA_INFO_CHAIN_SIGNAL_AVG: per-chain signal strength average
2184 * Same format as NL80211_STA_INFO_CHAIN_SIGNAL. 2201 * Same format as NL80211_STA_INFO_CHAIN_SIGNAL.
2202 * @NL80211_STA_EXPECTED_THROUGHPUT: expected throughput considering also the
2203 * 802.11 header (u32, kbps)
2185 * @__NL80211_STA_INFO_AFTER_LAST: internal 2204 * @__NL80211_STA_INFO_AFTER_LAST: internal
2186 * @NL80211_STA_INFO_MAX: highest possible station info attribute 2205 * @NL80211_STA_INFO_MAX: highest possible station info attribute
2187 */ 2206 */
@@ -2213,6 +2232,7 @@ enum nl80211_sta_info {
2213 NL80211_STA_INFO_TX_BYTES64, 2232 NL80211_STA_INFO_TX_BYTES64,
2214 NL80211_STA_INFO_CHAIN_SIGNAL, 2233 NL80211_STA_INFO_CHAIN_SIGNAL,
2215 NL80211_STA_INFO_CHAIN_SIGNAL_AVG, 2234 NL80211_STA_INFO_CHAIN_SIGNAL_AVG,
2235 NL80211_STA_INFO_EXPECTED_THROUGHPUT,
2216 2236
2217 /* keep last */ 2237 /* keep last */
2218 __NL80211_STA_INFO_AFTER_LAST, 2238 __NL80211_STA_INFO_AFTER_LAST,
@@ -2336,9 +2356,34 @@ enum nl80211_band_attr {
2336 * using this channel as the primary or any of the secondary channels 2356 * using this channel as the primary or any of the secondary channels
2337 * isn't possible 2357 * isn't possible
2338 * @NL80211_FREQUENCY_ATTR_DFS_CAC_TIME: DFS CAC time in milliseconds. 2358 * @NL80211_FREQUENCY_ATTR_DFS_CAC_TIME: DFS CAC time in milliseconds.
2359 * @NL80211_FREQUENCY_ATTR_INDOOR_ONLY: Only indoor use is permitted on this
2360 * channel. A channel that has the INDOOR_ONLY attribute can only be
2361 * used when there is a clear assessment that the device is operating in
2362 * an indoor surroundings, i.e., it is connected to AC power (and not
2363 * through portable DC inverters) or is under the control of a master
2364 * that is acting as an AP and is connected to AC power.
2365 * @NL80211_FREQUENCY_ATTR_GO_CONCURRENT: GO operation is allowed on this
2366 * channel if it's connected concurrently to a BSS on the same channel on
2367 * the 2 GHz band or to a channel in the same UNII band (on the 5 GHz
2368 * band), and IEEE80211_CHAN_RADAR is not set. Instantiating a GO on a
2369 * channel that has the GO_CONCURRENT attribute set can be done when there
2370 * is a clear assessment that the device is operating under the guidance of
2371 * an authorized master, i.e., setting up a GO while the device is also
2372 * connected to an AP with DFS and radar detection on the UNII band (it is
2373 * up to user-space, i.e., wpa_supplicant to perform the required
2374 * verifications)
2375 * @NL80211_FREQUENCY_ATTR_NO_20MHZ: 20 MHz operation is not allowed
2376 * on this channel in current regulatory domain.
2377 * @NL80211_FREQUENCY_ATTR_NO_10MHZ: 10 MHz operation is not allowed
2378 * on this channel in current regulatory domain.
2339 * @NL80211_FREQUENCY_ATTR_MAX: highest frequency attribute number 2379 * @NL80211_FREQUENCY_ATTR_MAX: highest frequency attribute number
2340 * currently defined 2380 * currently defined
2341 * @__NL80211_FREQUENCY_ATTR_AFTER_LAST: internal use 2381 * @__NL80211_FREQUENCY_ATTR_AFTER_LAST: internal use
2382 *
2383 * See https://apps.fcc.gov/eas/comments/GetPublishedDocument.html?id=327&tn=528122
2384 * for more information on the FCC description of the relaxations allowed
2385 * by NL80211_FREQUENCY_ATTR_INDOOR_ONLY and
2386 * NL80211_FREQUENCY_ATTR_GO_CONCURRENT.
2342 */ 2387 */
2343enum nl80211_frequency_attr { 2388enum nl80211_frequency_attr {
2344 __NL80211_FREQUENCY_ATTR_INVALID, 2389 __NL80211_FREQUENCY_ATTR_INVALID,
@@ -2355,6 +2400,10 @@ enum nl80211_frequency_attr {
2355 NL80211_FREQUENCY_ATTR_NO_80MHZ, 2400 NL80211_FREQUENCY_ATTR_NO_80MHZ,
2356 NL80211_FREQUENCY_ATTR_NO_160MHZ, 2401 NL80211_FREQUENCY_ATTR_NO_160MHZ,
2357 NL80211_FREQUENCY_ATTR_DFS_CAC_TIME, 2402 NL80211_FREQUENCY_ATTR_DFS_CAC_TIME,
2403 NL80211_FREQUENCY_ATTR_INDOOR_ONLY,
2404 NL80211_FREQUENCY_ATTR_GO_CONCURRENT,
2405 NL80211_FREQUENCY_ATTR_NO_20MHZ,
2406 NL80211_FREQUENCY_ATTR_NO_10MHZ,
2358 2407
2359 /* keep last */ 2408 /* keep last */
2360 __NL80211_FREQUENCY_ATTR_AFTER_LAST, 2409 __NL80211_FREQUENCY_ATTR_AFTER_LAST,
@@ -2573,10 +2622,13 @@ enum nl80211_dfs_regions {
2573 * present has been registered with the wireless core that 2622 * present has been registered with the wireless core that
2574 * has listed NL80211_FEATURE_CELL_BASE_REG_HINTS as a 2623 * has listed NL80211_FEATURE_CELL_BASE_REG_HINTS as a
2575 * supported feature. 2624 * supported feature.
2625 * @NL80211_USER_REG_HINT_INDOOR: a user sent an hint indicating that the
2626 * platform is operating in an indoor environment.
2576 */ 2627 */
2577enum nl80211_user_reg_hint_type { 2628enum nl80211_user_reg_hint_type {
2578 NL80211_USER_REG_HINT_USER = 0, 2629 NL80211_USER_REG_HINT_USER = 0,
2579 NL80211_USER_REG_HINT_CELL_BASE = 1, 2630 NL80211_USER_REG_HINT_CELL_BASE = 1,
2631 NL80211_USER_REG_HINT_INDOOR = 2,
2580}; 2632};
2581 2633
2582/** 2634/**
@@ -3650,6 +3702,8 @@ enum nl80211_iface_limit_attrs {
3650 * different channels may be used within this group. 3702 * different channels may be used within this group.
3651 * @NL80211_IFACE_COMB_RADAR_DETECT_WIDTHS: u32 attribute containing the bitmap 3703 * @NL80211_IFACE_COMB_RADAR_DETECT_WIDTHS: u32 attribute containing the bitmap
3652 * of supported channel widths for radar detection. 3704 * of supported channel widths for radar detection.
3705 * @NL80211_IFACE_COMB_RADAR_DETECT_REGIONS: u32 attribute containing the bitmap
3706 * of supported regulatory regions for radar detection.
3653 * @NUM_NL80211_IFACE_COMB: number of attributes 3707 * @NUM_NL80211_IFACE_COMB: number of attributes
3654 * @MAX_NL80211_IFACE_COMB: highest attribute number 3708 * @MAX_NL80211_IFACE_COMB: highest attribute number
3655 * 3709 *
@@ -3683,6 +3737,7 @@ enum nl80211_if_combination_attrs {
3683 NL80211_IFACE_COMB_STA_AP_BI_MATCH, 3737 NL80211_IFACE_COMB_STA_AP_BI_MATCH,
3684 NL80211_IFACE_COMB_NUM_CHANNELS, 3738 NL80211_IFACE_COMB_NUM_CHANNELS,
3685 NL80211_IFACE_COMB_RADAR_DETECT_WIDTHS, 3739 NL80211_IFACE_COMB_RADAR_DETECT_WIDTHS,
3740 NL80211_IFACE_COMB_RADAR_DETECT_REGIONS,
3686 3741
3687 /* keep last */ 3742 /* keep last */
3688 NUM_NL80211_IFACE_COMB, 3743 NUM_NL80211_IFACE_COMB,
@@ -3856,6 +3911,8 @@ enum nl80211_ap_sme_features {
3856 * @NL80211_FEATURE_CELL_BASE_REG_HINTS: This driver has been tested 3911 * @NL80211_FEATURE_CELL_BASE_REG_HINTS: This driver has been tested
3857 * to work properly to suppport receiving regulatory hints from 3912 * to work properly to suppport receiving regulatory hints from
3858 * cellular base stations. 3913 * cellular base stations.
3914 * @NL80211_FEATURE_P2P_DEVICE_NEEDS_CHANNEL: (no longer available, only
3915 * here to reserve the value for API/ABI compatibility)
3859 * @NL80211_FEATURE_SAE: This driver supports simultaneous authentication of 3916 * @NL80211_FEATURE_SAE: This driver supports simultaneous authentication of
3860 * equals (SAE) with user space SME (NL80211_CMD_AUTHENTICATE) in station 3917 * equals (SAE) with user space SME (NL80211_CMD_AUTHENTICATE) in station
3861 * mode 3918 * mode
@@ -3891,13 +3948,16 @@ enum nl80211_ap_sme_features {
3891 * interface. An active monitor interface behaves like a normal monitor 3948 * interface. An active monitor interface behaves like a normal monitor
3892 * interface, but gets added to the driver. It ensures that incoming 3949 * interface, but gets added to the driver. It ensures that incoming
3893 * unicast packets directed at the configured interface address get ACKed. 3950 * unicast packets directed at the configured interface address get ACKed.
3951 * @NL80211_FEATURE_AP_MODE_CHAN_WIDTH_CHANGE: This driver supports dynamic
3952 * channel bandwidth change (e.g., HT 20 <-> 40 MHz channel) during the
3953 * lifetime of a BSS.
3894 */ 3954 */
3895enum nl80211_feature_flags { 3955enum nl80211_feature_flags {
3896 NL80211_FEATURE_SK_TX_STATUS = 1 << 0, 3956 NL80211_FEATURE_SK_TX_STATUS = 1 << 0,
3897 NL80211_FEATURE_HT_IBSS = 1 << 1, 3957 NL80211_FEATURE_HT_IBSS = 1 << 1,
3898 NL80211_FEATURE_INACTIVITY_TIMER = 1 << 2, 3958 NL80211_FEATURE_INACTIVITY_TIMER = 1 << 2,
3899 NL80211_FEATURE_CELL_BASE_REG_HINTS = 1 << 3, 3959 NL80211_FEATURE_CELL_BASE_REG_HINTS = 1 << 3,
3900 /* bit 4 is reserved - don't use */ 3960 NL80211_FEATURE_P2P_DEVICE_NEEDS_CHANNEL = 1 << 4,
3901 NL80211_FEATURE_SAE = 1 << 5, 3961 NL80211_FEATURE_SAE = 1 << 5,
3902 NL80211_FEATURE_LOW_PRIORITY_SCAN = 1 << 6, 3962 NL80211_FEATURE_LOW_PRIORITY_SCAN = 1 << 6,
3903 NL80211_FEATURE_SCAN_FLUSH = 1 << 7, 3963 NL80211_FEATURE_SCAN_FLUSH = 1 << 7,
@@ -3911,6 +3971,7 @@ enum nl80211_feature_flags {
3911 NL80211_FEATURE_FULL_AP_CLIENT_STATE = 1 << 15, 3971 NL80211_FEATURE_FULL_AP_CLIENT_STATE = 1 << 15,
3912 NL80211_FEATURE_USERSPACE_MPM = 1 << 16, 3972 NL80211_FEATURE_USERSPACE_MPM = 1 << 16,
3913 NL80211_FEATURE_ACTIVE_MONITOR = 1 << 17, 3973 NL80211_FEATURE_ACTIVE_MONITOR = 1 << 17,
3974 NL80211_FEATURE_AP_MODE_CHAN_WIDTH_CHANGE = 1 << 18,
3914}; 3975};
3915 3976
3916/** 3977/**
diff --git a/include/uapi/linux/nvme.h b/include/uapi/linux/nvme.h
index 096fe1c6f83d..29a7d8619d8d 100644
--- a/include/uapi/linux/nvme.h
+++ b/include/uapi/linux/nvme.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * Definitions for the NVM Express interface 2 * Definitions for the NVM Express interface
3 * Copyright (c) 2011-2013, Intel Corporation. 3 * Copyright (c) 2011-2014, Intel Corporation.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 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, 6 * under the terms and conditions of the GNU General Public License,
@@ -10,10 +10,6 @@
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details. 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 */ 13 */
18 14
19#ifndef _UAPI_LINUX_NVME_H 15#ifndef _UAPI_LINUX_NVME_H
@@ -31,7 +27,12 @@ struct nvme_id_power_state {
31 __u8 read_lat; 27 __u8 read_lat;
32 __u8 write_tput; 28 __u8 write_tput;
33 __u8 write_lat; 29 __u8 write_lat;
34 __u8 rsvd16[16]; 30 __le16 idle_power;
31 __u8 idle_scale;
32 __u8 rsvd19;
33 __le16 active_power;
34 __u8 active_work_scale;
35 __u8 rsvd23[9];
35}; 36};
36 37
37enum { 38enum {
@@ -49,7 +50,9 @@ struct nvme_id_ctrl {
49 __u8 ieee[3]; 50 __u8 ieee[3];
50 __u8 mic; 51 __u8 mic;
51 __u8 mdts; 52 __u8 mdts;
52 __u8 rsvd78[178]; 53 __u16 cntlid;
54 __u32 ver;
55 __u8 rsvd84[172];
53 __le16 oacs; 56 __le16 oacs;
54 __u8 acl; 57 __u8 acl;
55 __u8 aerl; 58 __u8 aerl;
@@ -57,7 +60,11 @@ struct nvme_id_ctrl {
57 __u8 lpa; 60 __u8 lpa;
58 __u8 elpe; 61 __u8 elpe;
59 __u8 npss; 62 __u8 npss;
60 __u8 rsvd264[248]; 63 __u8 avscc;
64 __u8 apsta;
65 __le16 wctemp;
66 __le16 cctemp;
67 __u8 rsvd270[242];
61 __u8 sqes; 68 __u8 sqes;
62 __u8 cqes; 69 __u8 cqes;
63 __u8 rsvd514[2]; 70 __u8 rsvd514[2];
@@ -68,7 +75,12 @@ struct nvme_id_ctrl {
68 __u8 vwc; 75 __u8 vwc;
69 __le16 awun; 76 __le16 awun;
70 __le16 awupf; 77 __le16 awupf;
71 __u8 rsvd530[1518]; 78 __u8 nvscc;
79 __u8 rsvd531;
80 __le16 acwu;
81 __u8 rsvd534[2];
82 __le32 sgls;
83 __u8 rsvd540[1508];
72 struct nvme_id_power_state psd[32]; 84 struct nvme_id_power_state psd[32];
73 __u8 vs[1024]; 85 __u8 vs[1024];
74}; 86};
@@ -77,6 +89,7 @@ enum {
77 NVME_CTRL_ONCS_COMPARE = 1 << 0, 89 NVME_CTRL_ONCS_COMPARE = 1 << 0,
78 NVME_CTRL_ONCS_WRITE_UNCORRECTABLE = 1 << 1, 90 NVME_CTRL_ONCS_WRITE_UNCORRECTABLE = 1 << 1,
79 NVME_CTRL_ONCS_DSM = 1 << 2, 91 NVME_CTRL_ONCS_DSM = 1 << 2,
92 NVME_CTRL_VWC_PRESENT = 1 << 0,
80}; 93};
81 94
82struct nvme_lbaf { 95struct nvme_lbaf {
@@ -95,7 +108,15 @@ struct nvme_id_ns {
95 __u8 mc; 108 __u8 mc;
96 __u8 dpc; 109 __u8 dpc;
97 __u8 dps; 110 __u8 dps;
98 __u8 rsvd30[98]; 111 __u8 nmic;
112 __u8 rescap;
113 __u8 fpi;
114 __u8 rsvd33;
115 __le16 nawun;
116 __le16 nawupf;
117 __le16 nacwu;
118 __u8 rsvd40[80];
119 __u8 eui64[8];
99 struct nvme_lbaf lbaf[16]; 120 struct nvme_lbaf lbaf[16];
100 __u8 rsvd192[192]; 121 __u8 rsvd192[192];
101 __u8 vs[3712]; 122 __u8 vs[3712];
@@ -126,7 +147,10 @@ struct nvme_smart_log {
126 __u8 unsafe_shutdowns[16]; 147 __u8 unsafe_shutdowns[16];
127 __u8 media_errors[16]; 148 __u8 media_errors[16];
128 __u8 num_err_log_entries[16]; 149 __u8 num_err_log_entries[16];
129 __u8 rsvd192[320]; 150 __le32 warning_temp_time;
151 __le32 critical_comp_time;
152 __le16 temp_sensor[8];
153 __u8 rsvd216[296];
130}; 154};
131 155
132enum { 156enum {
@@ -282,6 +306,10 @@ enum {
282 NVME_FEAT_WRITE_ATOMIC = 0x0a, 306 NVME_FEAT_WRITE_ATOMIC = 0x0a,
283 NVME_FEAT_ASYNC_EVENT = 0x0b, 307 NVME_FEAT_ASYNC_EVENT = 0x0b,
284 NVME_FEAT_SW_PROGRESS = 0x0c, 308 NVME_FEAT_SW_PROGRESS = 0x0c,
309 NVME_LOG_ERROR = 0x01,
310 NVME_LOG_SMART = 0x02,
311 NVME_LOG_FW_SLOT = 0x03,
312 NVME_LOG_RESERVATION = 0x80,
285 NVME_FWACT_REPL = (0 << 3), 313 NVME_FWACT_REPL = (0 << 3),
286 NVME_FWACT_REPL_ACTV = (1 << 3), 314 NVME_FWACT_REPL_ACTV = (1 << 3),
287 NVME_FWACT_ACTV = (2 << 3), 315 NVME_FWACT_ACTV = (2 << 3),
diff --git a/include/uapi/linux/openvswitch.h b/include/uapi/linux/openvswitch.h
index 970553cbbc8e..0b979ee4bfc0 100644
--- a/include/uapi/linux/openvswitch.h
+++ b/include/uapi/linux/openvswitch.h
@@ -395,7 +395,9 @@ struct ovs_key_nd {
395 * @OVS_FLOW_ATTR_ACTIONS: Nested %OVS_ACTION_ATTR_* attributes specifying 395 * @OVS_FLOW_ATTR_ACTIONS: Nested %OVS_ACTION_ATTR_* attributes specifying
396 * the actions to take for packets that match the key. Always present in 396 * the actions to take for packets that match the key. Always present in
397 * notifications. Required for %OVS_FLOW_CMD_NEW requests, optional for 397 * notifications. Required for %OVS_FLOW_CMD_NEW requests, optional for
398 * %OVS_FLOW_CMD_SET requests. 398 * %OVS_FLOW_CMD_SET requests. An %OVS_FLOW_CMD_SET without
399 * %OVS_FLOW_ATTR_ACTIONS will not modify the actions. To clear the actions,
400 * an %OVS_FLOW_ATTR_ACTIONS without any nested attributes must be given.
399 * @OVS_FLOW_ATTR_STATS: &struct ovs_flow_stats giving statistics for this 401 * @OVS_FLOW_ATTR_STATS: &struct ovs_flow_stats giving statistics for this
400 * flow. Present in notifications if the stats would be nonzero. Ignored in 402 * flow. Present in notifications if the stats would be nonzero. Ignored in
401 * requests. 403 * requests.
diff --git a/include/uapi/linux/perf_event.h b/include/uapi/linux/perf_event.h
index 853bc1ccb395..9269de254874 100644
--- a/include/uapi/linux/perf_event.h
+++ b/include/uapi/linux/perf_event.h
@@ -163,8 +163,9 @@ enum perf_branch_sample_type {
163 PERF_SAMPLE_BRANCH_ABORT_TX = 1U << 7, /* transaction aborts */ 163 PERF_SAMPLE_BRANCH_ABORT_TX = 1U << 7, /* transaction aborts */
164 PERF_SAMPLE_BRANCH_IN_TX = 1U << 8, /* in transaction */ 164 PERF_SAMPLE_BRANCH_IN_TX = 1U << 8, /* in transaction */
165 PERF_SAMPLE_BRANCH_NO_TX = 1U << 9, /* not in transaction */ 165 PERF_SAMPLE_BRANCH_NO_TX = 1U << 9, /* not in transaction */
166 PERF_SAMPLE_BRANCH_COND = 1U << 10, /* conditional branches */
166 167
167 PERF_SAMPLE_BRANCH_MAX = 1U << 10, /* non-ABI */ 168 PERF_SAMPLE_BRANCH_MAX = 1U << 11, /* non-ABI */
168}; 169};
169 170
170#define PERF_SAMPLE_BRANCH_PLM_ALL \ 171#define PERF_SAMPLE_BRANCH_PLM_ALL \
@@ -301,8 +302,8 @@ struct perf_event_attr {
301 exclude_callchain_kernel : 1, /* exclude kernel callchains */ 302 exclude_callchain_kernel : 1, /* exclude kernel callchains */
302 exclude_callchain_user : 1, /* exclude user callchains */ 303 exclude_callchain_user : 1, /* exclude user callchains */
303 mmap2 : 1, /* include mmap with inode data */ 304 mmap2 : 1, /* include mmap with inode data */
304 305 comm_exec : 1, /* flag comm events that are due to an exec */
305 __reserved_1 : 40; 306 __reserved_1 : 39;
306 307
307 union { 308 union {
308 __u32 wakeup_events; /* wakeup every n events */ 309 __u32 wakeup_events; /* wakeup every n events */
@@ -501,7 +502,12 @@ struct perf_event_mmap_page {
501#define PERF_RECORD_MISC_GUEST_KERNEL (4 << 0) 502#define PERF_RECORD_MISC_GUEST_KERNEL (4 << 0)
502#define PERF_RECORD_MISC_GUEST_USER (5 << 0) 503#define PERF_RECORD_MISC_GUEST_USER (5 << 0)
503 504
505/*
506 * PERF_RECORD_MISC_MMAP_DATA and PERF_RECORD_MISC_COMM_EXEC are used on
507 * different events so can reuse the same bit position.
508 */
504#define PERF_RECORD_MISC_MMAP_DATA (1 << 13) 509#define PERF_RECORD_MISC_MMAP_DATA (1 << 13)
510#define PERF_RECORD_MISC_COMM_EXEC (1 << 13)
505/* 511/*
506 * Indicates that the content of PERF_SAMPLE_IP points to 512 * Indicates that the content of PERF_SAMPLE_IP points to
507 * the actual instruction that triggered the event. See also 513 * the actual instruction that triggered the event. See also
@@ -699,6 +705,7 @@ enum perf_event_type {
699 * u32 min; 705 * u32 min;
700 * u64 ino; 706 * u64 ino;
701 * u64 ino_generation; 707 * u64 ino_generation;
708 * u32 prot, flags;
702 * char filename[]; 709 * char filename[];
703 * struct sample_id sample_id; 710 * struct sample_id sample_id;
704 * }; 711 * };
@@ -722,10 +729,10 @@ enum perf_callchain_context {
722 PERF_CONTEXT_MAX = (__u64)-4095, 729 PERF_CONTEXT_MAX = (__u64)-4095,
723}; 730};
724 731
725#define PERF_FLAG_FD_NO_GROUP (1U << 0) 732#define PERF_FLAG_FD_NO_GROUP (1UL << 0)
726#define PERF_FLAG_FD_OUTPUT (1U << 1) 733#define PERF_FLAG_FD_OUTPUT (1UL << 1)
727#define PERF_FLAG_PID_CGROUP (1U << 2) /* pid=cgroup id, per-cpu mode only */ 734#define PERF_FLAG_PID_CGROUP (1UL << 2) /* pid=cgroup id, per-cpu mode only */
728#define PERF_FLAG_FD_CLOEXEC (1U << 3) /* O_CLOEXEC */ 735#define PERF_FLAG_FD_CLOEXEC (1UL << 3) /* O_CLOEXEC */
729 736
730union perf_mem_data_src { 737union perf_mem_data_src {
731 __u64 val; 738 __u64 val;
diff --git a/include/uapi/linux/psci.h b/include/uapi/linux/psci.h
new file mode 100644
index 000000000000..310d83e0a91b
--- /dev/null
+++ b/include/uapi/linux/psci.h
@@ -0,0 +1,90 @@
1/*
2 * ARM Power State and Coordination Interface (PSCI) header
3 *
4 * This header holds common PSCI defines and macros shared
5 * by: ARM kernel, ARM64 kernel, KVM ARM/ARM64 and user space.
6 *
7 * Copyright (C) 2014 Linaro Ltd.
8 * Author: Anup Patel <anup.patel@linaro.org>
9 */
10
11#ifndef _UAPI_LINUX_PSCI_H
12#define _UAPI_LINUX_PSCI_H
13
14/*
15 * PSCI v0.1 interface
16 *
17 * The PSCI v0.1 function numbers are implementation defined.
18 *
19 * Only PSCI return values such as: SUCCESS, NOT_SUPPORTED,
20 * INVALID_PARAMS, and DENIED defined below are applicable
21 * to PSCI v0.1.
22 */
23
24/* PSCI v0.2 interface */
25#define PSCI_0_2_FN_BASE 0x84000000
26#define PSCI_0_2_FN(n) (PSCI_0_2_FN_BASE + (n))
27#define PSCI_0_2_64BIT 0x40000000
28#define PSCI_0_2_FN64_BASE \
29 (PSCI_0_2_FN_BASE + PSCI_0_2_64BIT)
30#define PSCI_0_2_FN64(n) (PSCI_0_2_FN64_BASE + (n))
31
32#define PSCI_0_2_FN_PSCI_VERSION PSCI_0_2_FN(0)
33#define PSCI_0_2_FN_CPU_SUSPEND PSCI_0_2_FN(1)
34#define PSCI_0_2_FN_CPU_OFF PSCI_0_2_FN(2)
35#define PSCI_0_2_FN_CPU_ON PSCI_0_2_FN(3)
36#define PSCI_0_2_FN_AFFINITY_INFO PSCI_0_2_FN(4)
37#define PSCI_0_2_FN_MIGRATE PSCI_0_2_FN(5)
38#define PSCI_0_2_FN_MIGRATE_INFO_TYPE PSCI_0_2_FN(6)
39#define PSCI_0_2_FN_MIGRATE_INFO_UP_CPU PSCI_0_2_FN(7)
40#define PSCI_0_2_FN_SYSTEM_OFF PSCI_0_2_FN(8)
41#define PSCI_0_2_FN_SYSTEM_RESET PSCI_0_2_FN(9)
42
43#define PSCI_0_2_FN64_CPU_SUSPEND PSCI_0_2_FN64(1)
44#define PSCI_0_2_FN64_CPU_ON PSCI_0_2_FN64(3)
45#define PSCI_0_2_FN64_AFFINITY_INFO PSCI_0_2_FN64(4)
46#define PSCI_0_2_FN64_MIGRATE PSCI_0_2_FN64(5)
47#define PSCI_0_2_FN64_MIGRATE_INFO_UP_CPU PSCI_0_2_FN64(7)
48
49/* PSCI v0.2 power state encoding for CPU_SUSPEND function */
50#define PSCI_0_2_POWER_STATE_ID_MASK 0xffff
51#define PSCI_0_2_POWER_STATE_ID_SHIFT 0
52#define PSCI_0_2_POWER_STATE_TYPE_SHIFT 16
53#define PSCI_0_2_POWER_STATE_TYPE_MASK \
54 (0x1 << PSCI_0_2_POWER_STATE_TYPE_SHIFT)
55#define PSCI_0_2_POWER_STATE_AFFL_SHIFT 24
56#define PSCI_0_2_POWER_STATE_AFFL_MASK \
57 (0x3 << PSCI_0_2_POWER_STATE_AFFL_SHIFT)
58
59/* PSCI v0.2 affinity level state returned by AFFINITY_INFO */
60#define PSCI_0_2_AFFINITY_LEVEL_ON 0
61#define PSCI_0_2_AFFINITY_LEVEL_OFF 1
62#define PSCI_0_2_AFFINITY_LEVEL_ON_PENDING 2
63
64/* PSCI v0.2 multicore support in Trusted OS returned by MIGRATE_INFO_TYPE */
65#define PSCI_0_2_TOS_UP_MIGRATE 0
66#define PSCI_0_2_TOS_UP_NO_MIGRATE 1
67#define PSCI_0_2_TOS_MP 2
68
69/* PSCI version decoding (independent of PSCI version) */
70#define PSCI_VERSION_MAJOR_SHIFT 16
71#define PSCI_VERSION_MINOR_MASK \
72 ((1U << PSCI_VERSION_MAJOR_SHIFT) - 1)
73#define PSCI_VERSION_MAJOR_MASK ~PSCI_VERSION_MINOR_MASK
74#define PSCI_VERSION_MAJOR(ver) \
75 (((ver) & PSCI_VERSION_MAJOR_MASK) >> PSCI_VERSION_MAJOR_SHIFT)
76#define PSCI_VERSION_MINOR(ver) \
77 ((ver) & PSCI_VERSION_MINOR_MASK)
78
79/* PSCI return values (inclusive of all PSCI versions) */
80#define PSCI_RET_SUCCESS 0
81#define PSCI_RET_NOT_SUPPORTED -1
82#define PSCI_RET_INVALID_PARAMS -2
83#define PSCI_RET_DENIED -3
84#define PSCI_RET_ALREADY_ON -4
85#define PSCI_RET_ON_PENDING -5
86#define PSCI_RET_INTERNAL_FAILURE -6
87#define PSCI_RET_NOT_PRESENT -7
88#define PSCI_RET_DISABLED -8
89
90#endif /* _UAPI_LINUX_PSCI_H */
diff --git a/include/uapi/linux/serial_core.h b/include/uapi/linux/serial_core.h
index b47dba2c1e6f..5820269aa132 100644
--- a/include/uapi/linux/serial_core.h
+++ b/include/uapi/linux/serial_core.h
@@ -211,7 +211,7 @@
211/* VIA VT8500 SoC */ 211/* VIA VT8500 SoC */
212#define PORT_VT8500 97 212#define PORT_VT8500 97
213 213
214/* Xilinx PSS UART */ 214/* Cadence (Xilinx Zynq) UART */
215#define PORT_XUARTPS 98 215#define PORT_XUARTPS 98
216 216
217/* Atheros AR933X SoC */ 217/* Atheros AR933X SoC */
@@ -238,4 +238,10 @@
238/* Tilera TILE-Gx UART */ 238/* Tilera TILE-Gx UART */
239#define PORT_TILEGX 106 239#define PORT_TILEGX 106
240 240
241/* MEN 16z135 UART */
242#define PORT_MEN_Z135 107
243
244/* SC16IS74xx */
245#define PORT_SC16IS7XX 108
246
241#endif /* _UAPILINUX_SERIAL_CORE_H */ 247#endif /* _UAPILINUX_SERIAL_CORE_H */
diff --git a/include/uapi/linux/serial_reg.h b/include/uapi/linux/serial_reg.h
index e6322605b138..99b47058816a 100644
--- a/include/uapi/linux/serial_reg.h
+++ b/include/uapi/linux/serial_reg.h
@@ -32,7 +32,7 @@
32 32
33#define UART_IIR 2 /* In: Interrupt ID Register */ 33#define UART_IIR 2 /* In: Interrupt ID Register */
34#define UART_IIR_NO_INT 0x01 /* No interrupts pending */ 34#define UART_IIR_NO_INT 0x01 /* No interrupts pending */
35#define UART_IIR_ID 0x06 /* Mask for the interrupt ID */ 35#define UART_IIR_ID 0x0e /* Mask for the interrupt ID */
36#define UART_IIR_MSI 0x00 /* Modem status interrupt */ 36#define UART_IIR_MSI 0x00 /* Modem status interrupt */
37#define UART_IIR_THRI 0x02 /* Transmitter holding register empty */ 37#define UART_IIR_THRI 0x02 /* Transmitter holding register empty */
38#define UART_IIR_RDI 0x04 /* Receiver data interrupt */ 38#define UART_IIR_RDI 0x04 /* Receiver data interrupt */
diff --git a/include/uapi/linux/shm.h b/include/uapi/linux/shm.h
index 78b69413f582..1fbf24ea37fd 100644
--- a/include/uapi/linux/shm.h
+++ b/include/uapi/linux/shm.h
@@ -8,19 +8,20 @@
8#endif 8#endif
9 9
10/* 10/*
11 * SHMMAX, SHMMNI and SHMALL are upper limits are defaults which can 11 * SHMMNI, SHMMAX and SHMALL are default upper limits which can be
12 * be increased by sysctl 12 * modified by sysctl. The SHMMAX and SHMALL values have been chosen to
13 * be as large possible without facilitating scenarios where userspace
14 * causes overflows when adjusting the limits via operations of the form
15 * "retrieve current limit; add X; update limit". It is therefore not
16 * advised to make SHMMAX and SHMALL any larger. These limits are
17 * suitable for both 32 and 64-bit systems.
13 */ 18 */
14
15#define SHMMAX 0x2000000 /* max shared seg size (bytes) */
16#define SHMMIN 1 /* min shared seg size (bytes) */ 19#define SHMMIN 1 /* min shared seg size (bytes) */
17#define SHMMNI 4096 /* max num of segs system wide */ 20#define SHMMNI 4096 /* max num of segs system wide */
18#ifndef __KERNEL__ 21#define SHMMAX (ULONG_MAX - (1UL << 24)) /* max shared seg size (bytes) */
19#define SHMALL (SHMMAX/getpagesize()*(SHMMNI/16)) 22#define SHMALL (ULONG_MAX - (1UL << 24)) /* max shm system wide (pages) */
20#endif
21#define SHMSEG SHMMNI /* max shared segs per process */ 23#define SHMSEG SHMMNI /* max shared segs per process */
22 24
23
24/* Obsolete, used only for backwards compatibility and libc5 compiles */ 25/* Obsolete, used only for backwards compatibility and libc5 compiles */
25struct shmid_ds { 26struct shmid_ds {
26 struct ipc_perm shm_perm; /* operation perms */ 27 struct ipc_perm shm_perm; /* operation perms */
diff --git a/include/uapi/linux/tipc.h b/include/uapi/linux/tipc.h
index 852373d27dbb..6f71b9b41595 100644
--- a/include/uapi/linux/tipc.h
+++ b/include/uapi/linux/tipc.h
@@ -38,6 +38,7 @@
38#define _LINUX_TIPC_H_ 38#define _LINUX_TIPC_H_
39 39
40#include <linux/types.h> 40#include <linux/types.h>
41#include <linux/sockios.h>
41 42
42/* 43/*
43 * TIPC addressing primitives 44 * TIPC addressing primitives
@@ -87,6 +88,7 @@ static inline unsigned int tipc_node(__u32 addr)
87 88
88#define TIPC_CFG_SRV 0 /* configuration service name type */ 89#define TIPC_CFG_SRV 0 /* configuration service name type */
89#define TIPC_TOP_SRV 1 /* topology service name type */ 90#define TIPC_TOP_SRV 1 /* topology service name type */
91#define TIPC_LINK_STATE 2 /* link state name type */
90#define TIPC_RESERVED_TYPES 64 /* lowest user-publishable name type */ 92#define TIPC_RESERVED_TYPES 64 /* lowest user-publishable name type */
91 93
92/* 94/*
@@ -206,4 +208,25 @@ struct sockaddr_tipc {
206#define TIPC_NODE_RECVQ_DEPTH 131 /* Default: none (read only) */ 208#define TIPC_NODE_RECVQ_DEPTH 131 /* Default: none (read only) */
207#define TIPC_SOCK_RECVQ_DEPTH 132 /* Default: none (read only) */ 209#define TIPC_SOCK_RECVQ_DEPTH 132 /* Default: none (read only) */
208 210
211/*
212 * Maximum sizes of TIPC bearer-related names (including terminating NULL)
213 * The string formatting for each name element is:
214 * media: media
215 * interface: media:interface name
216 * link: Z.C.N:interface-Z.C.N:interface
217 *
218 */
219
220#define TIPC_MAX_MEDIA_NAME 16
221#define TIPC_MAX_IF_NAME 16
222#define TIPC_MAX_BEARER_NAME 32
223#define TIPC_MAX_LINK_NAME 60
224
225#define SIOCGETLINKNAME SIOCPROTOPRIVATE
226
227struct tipc_sioc_ln_req {
228 __u32 peer;
229 __u32 bearer_id;
230 char linkname[TIPC_MAX_LINK_NAME];
231};
209#endif 232#endif
diff --git a/include/uapi/linux/tipc_config.h b/include/uapi/linux/tipc_config.h
index 6b0bff09b3a7..41a76acbb305 100644
--- a/include/uapi/linux/tipc_config.h
+++ b/include/uapi/linux/tipc_config.h
@@ -39,6 +39,7 @@
39 39
40#include <linux/types.h> 40#include <linux/types.h>
41#include <linux/string.h> 41#include <linux/string.h>
42#include <linux/tipc.h>
42#include <asm/byteorder.h> 43#include <asm/byteorder.h>
43 44
44#ifndef __KERNEL__ 45#ifndef __KERNEL__
@@ -155,15 +156,6 @@
155#define TIPC_TLV_PORT_REF 26 /* 32-bit port reference */ 156#define TIPC_TLV_PORT_REF 26 /* 32-bit port reference */
156 157
157/* 158/*
158 * Maximum sizes of TIPC bearer-related names (including terminating NUL)
159 */
160
161#define TIPC_MAX_MEDIA_NAME 16 /* format = media */
162#define TIPC_MAX_IF_NAME 16 /* format = interface */
163#define TIPC_MAX_BEARER_NAME 32 /* format = media:interface */
164#define TIPC_MAX_LINK_NAME 60 /* format = Z.C.N:interface-Z.C.N:interface */
165
166/*
167 * Link priority limits (min, default, max, media default) 159 * Link priority limits (min, default, max, media default)
168 */ 160 */
169 161
diff --git a/include/uapi/linux/udp.h b/include/uapi/linux/udp.h
index e2bcfd75a30d..16574ea18f0c 100644
--- a/include/uapi/linux/udp.h
+++ b/include/uapi/linux/udp.h
@@ -29,6 +29,8 @@ struct udphdr {
29/* UDP socket options */ 29/* UDP socket options */
30#define UDP_CORK 1 /* Never send partially complete segments */ 30#define UDP_CORK 1 /* Never send partially complete segments */
31#define UDP_ENCAP 100 /* Set the socket to accept encapsulated packets */ 31#define UDP_ENCAP 100 /* Set the socket to accept encapsulated packets */
32#define UDP_NO_CHECK6_TX 101 /* Disable sending checksum for UDP6X */
33#define UDP_NO_CHECK6_RX 102 /* Disable accpeting checksum for UDP6 */
32 34
33/* UDP encapsulation types */ 35/* UDP encapsulation types */
34#define UDP_ENCAP_ESPINUDP_NON_IKE 1 /* draft-ietf-ipsec-nat-t-ike-00/01 */ 36#define UDP_ENCAP_ESPINUDP_NON_IKE 1 /* draft-ietf-ipsec-nat-t-ike-00/01 */
diff --git a/include/uapi/linux/usb/Kbuild b/include/uapi/linux/usb/Kbuild
index 6cb4ea826834..4cc4d6e7e523 100644
--- a/include/uapi/linux/usb/Kbuild
+++ b/include/uapi/linux/usb/Kbuild
@@ -1,6 +1,7 @@
1# UAPI Header export list 1# UAPI Header export list
2header-y += audio.h 2header-y += audio.h
3header-y += cdc.h 3header-y += cdc.h
4header-y += cdc-wdm.h
4header-y += ch11.h 5header-y += ch11.h
5header-y += ch9.h 6header-y += ch9.h
6header-y += functionfs.h 7header-y += functionfs.h
diff --git a/include/uapi/linux/usb/cdc-wdm.h b/include/uapi/linux/usb/cdc-wdm.h
index f03134feebd6..0dc132e75030 100644
--- a/include/uapi/linux/usb/cdc-wdm.h
+++ b/include/uapi/linux/usb/cdc-wdm.h
@@ -9,6 +9,8 @@
9#ifndef _UAPI__LINUX_USB_CDC_WDM_H 9#ifndef _UAPI__LINUX_USB_CDC_WDM_H
10#define _UAPI__LINUX_USB_CDC_WDM_H 10#define _UAPI__LINUX_USB_CDC_WDM_H
11 11
12#include <linux/types.h>
13
12/* 14/*
13 * This IOCTL is used to retrieve the wMaxCommand for the device, 15 * This IOCTL is used to retrieve the wMaxCommand for the device,
14 * defining the message limit for both reading and writing. 16 * defining the message limit for both reading and writing.
diff --git a/include/uapi/linux/usb/functionfs.h b/include/uapi/linux/usb/functionfs.h
index 2a4b4a72a4f9..24b68c59dcf8 100644
--- a/include/uapi/linux/usb/functionfs.h
+++ b/include/uapi/linux/usb/functionfs.h
@@ -33,6 +33,13 @@ struct usb_endpoint_descriptor_no_audio {
33 __u8 bInterval; 33 __u8 bInterval;
34} __attribute__((packed)); 34} __attribute__((packed));
35 35
36/* Legacy format, deprecated as of 3.14. */
37struct usb_functionfs_descs_head {
38 __le32 magic;
39 __le32 length;
40 __le32 fs_count;
41 __le32 hs_count;
42} __attribute__((packed, deprecated));
36 43
37/* 44/*
38 * Descriptors format: 45 * Descriptors format:
diff --git a/include/uapi/linux/v4l2-common.h b/include/uapi/linux/v4l2-common.h
index 9bf508ad0957..2f6f8cafe773 100644
--- a/include/uapi/linux/v4l2-common.h
+++ b/include/uapi/linux/v4l2-common.h
@@ -75,7 +75,7 @@ struct v4l2_edid {
75 __u32 start_block; 75 __u32 start_block;
76 __u32 blocks; 76 __u32 blocks;
77 __u32 reserved[5]; 77 __u32 reserved[5];
78 __u8 __user *edid; 78 __u8 *edid;
79}; 79};
80 80
81#endif /* __V4L2_COMMON__ */ 81#endif /* __V4L2_COMMON__ */
diff --git a/include/uapi/linux/v4l2-dv-timings.h b/include/uapi/linux/v4l2-dv-timings.h
index b6a5fe00a470..6c8f159e416e 100644
--- a/include/uapi/linux/v4l2-dv-timings.h
+++ b/include/uapi/linux/v4l2-dv-timings.h
@@ -173,6 +173,76 @@
173 V4L2_DV_FL_CAN_REDUCE_FPS) \ 173 V4L2_DV_FL_CAN_REDUCE_FPS) \
174} 174}
175 175
176#define V4L2_DV_BT_CEA_3840X2160P24 { \
177 .type = V4L2_DV_BT_656_1120, \
178 V4L2_INIT_BT_TIMINGS(3840, 2160, 0, V4L2_DV_HSYNC_POS_POL, \
179 297000000, 1276, 88, 296, 8, 10, 72, 0, 0, 0, \
180 V4L2_DV_BT_STD_CEA861, V4L2_DV_FL_CAN_REDUCE_FPS) \
181}
182
183#define V4L2_DV_BT_CEA_3840X2160P25 { \
184 .type = V4L2_DV_BT_656_1120, \
185 V4L2_INIT_BT_TIMINGS(3840, 2160, 0, V4L2_DV_HSYNC_POS_POL, \
186 297000000, 1056, 88, 296, 8, 10, 72, 0, 0, 0, \
187 V4L2_DV_BT_STD_CEA861, 0) \
188}
189
190#define V4L2_DV_BT_CEA_3840X2160P30 { \
191 .type = V4L2_DV_BT_656_1120, \
192 V4L2_INIT_BT_TIMINGS(3840, 2160, 0, V4L2_DV_HSYNC_POS_POL, \
193 297000000, 176, 88, 296, 8, 10, 72, 0, 0, 0, \
194 V4L2_DV_BT_STD_CEA861, V4L2_DV_FL_CAN_REDUCE_FPS) \
195}
196
197#define V4L2_DV_BT_CEA_3840X2160P50 { \
198 .type = V4L2_DV_BT_656_1120, \
199 V4L2_INIT_BT_TIMINGS(3840, 2160, 0, V4L2_DV_HSYNC_POS_POL, \
200 594000000, 1056, 88, 296, 8, 10, 72, 0, 0, 0, \
201 V4L2_DV_BT_STD_CEA861, 0) \
202}
203
204#define V4L2_DV_BT_CEA_3840X2160P60 { \
205 .type = V4L2_DV_BT_656_1120, \
206 V4L2_INIT_BT_TIMINGS(3840, 2160, 0, V4L2_DV_HSYNC_POS_POL, \
207 594000000, 176, 88, 296, 8, 10, 72, 0, 0, 0, \
208 V4L2_DV_BT_STD_CEA861, V4L2_DV_FL_CAN_REDUCE_FPS) \
209}
210
211#define V4L2_DV_BT_CEA_4096X2160P24 { \
212 .type = V4L2_DV_BT_656_1120, \
213 V4L2_INIT_BT_TIMINGS(4096, 2160, 0, V4L2_DV_HSYNC_POS_POL, \
214 297000000, 1020, 88, 296, 8, 10, 72, 0, 0, 0, \
215 V4L2_DV_BT_STD_CEA861, V4L2_DV_FL_CAN_REDUCE_FPS) \
216}
217
218#define V4L2_DV_BT_CEA_4096X2160P25 { \
219 .type = V4L2_DV_BT_656_1120, \
220 V4L2_INIT_BT_TIMINGS(4096, 2160, 0, V4L2_DV_HSYNC_POS_POL, \
221 297000000, 968, 88, 128, 8, 10, 72, 0, 0, 0, \
222 V4L2_DV_BT_STD_CEA861, 0) \
223}
224
225#define V4L2_DV_BT_CEA_4096X2160P30 { \
226 .type = V4L2_DV_BT_656_1120, \
227 V4L2_INIT_BT_TIMINGS(4096, 2160, 0, V4L2_DV_HSYNC_POS_POL, \
228 297000000, 88, 88, 128, 8, 10, 72, 0, 0, 0, \
229 V4L2_DV_BT_STD_CEA861, V4L2_DV_FL_CAN_REDUCE_FPS) \
230}
231
232#define V4L2_DV_BT_CEA_4096X2160P50 { \
233 .type = V4L2_DV_BT_656_1120, \
234 V4L2_INIT_BT_TIMINGS(4096, 2160, 0, V4L2_DV_HSYNC_POS_POL, \
235 594000000, 968, 88, 128, 8, 10, 72, 0, 0, 0, \
236 V4L2_DV_BT_STD_CEA861, 0) \
237}
238
239#define V4L2_DV_BT_CEA_4096X2160P60 { \
240 .type = V4L2_DV_BT_656_1120, \
241 V4L2_INIT_BT_TIMINGS(4096, 2160, 0, V4L2_DV_HSYNC_POS_POL, \
242 594000000, 88, 88, 128, 8, 10, 72, 0, 0, 0, \
243 V4L2_DV_BT_STD_CEA861, V4L2_DV_FL_CAN_REDUCE_FPS) \
244}
245
176 246
177/* VESA Discrete Monitor Timings as per version 1.0, revision 12 */ 247/* VESA Discrete Monitor Timings as per version 1.0, revision 12 */
178 248
diff --git a/include/uapi/linux/v4l2-mediabus.h b/include/uapi/linux/v4l2-mediabus.h
index b5c3aab6e82c..1445e858854f 100644
--- a/include/uapi/linux/v4l2-mediabus.h
+++ b/include/uapi/linux/v4l2-mediabus.h
@@ -52,7 +52,7 @@ enum v4l2_mbus_pixelcode {
52 V4L2_MBUS_FMT_RGB888_2X12_LE = 0x100c, 52 V4L2_MBUS_FMT_RGB888_2X12_LE = 0x100c,
53 V4L2_MBUS_FMT_ARGB8888_1X32 = 0x100d, 53 V4L2_MBUS_FMT_ARGB8888_1X32 = 0x100d,
54 54
55 /* YUV (including grey) - next is 0x2018 */ 55 /* YUV (including grey) - next is 0x2024 */
56 V4L2_MBUS_FMT_Y8_1X8 = 0x2001, 56 V4L2_MBUS_FMT_Y8_1X8 = 0x2001,
57 V4L2_MBUS_FMT_UV8_1X8 = 0x2015, 57 V4L2_MBUS_FMT_UV8_1X8 = 0x2015,
58 V4L2_MBUS_FMT_UYVY8_1_5X8 = 0x2002, 58 V4L2_MBUS_FMT_UYVY8_1_5X8 = 0x2002,
@@ -64,6 +64,8 @@ enum v4l2_mbus_pixelcode {
64 V4L2_MBUS_FMT_YUYV8_2X8 = 0x2008, 64 V4L2_MBUS_FMT_YUYV8_2X8 = 0x2008,
65 V4L2_MBUS_FMT_YVYU8_2X8 = 0x2009, 65 V4L2_MBUS_FMT_YVYU8_2X8 = 0x2009,
66 V4L2_MBUS_FMT_Y10_1X10 = 0x200a, 66 V4L2_MBUS_FMT_Y10_1X10 = 0x200a,
67 V4L2_MBUS_FMT_UYVY10_2X10 = 0x2018,
68 V4L2_MBUS_FMT_VYUY10_2X10 = 0x2019,
67 V4L2_MBUS_FMT_YUYV10_2X10 = 0x200b, 69 V4L2_MBUS_FMT_YUYV10_2X10 = 0x200b,
68 V4L2_MBUS_FMT_YVYU10_2X10 = 0x200c, 70 V4L2_MBUS_FMT_YVYU10_2X10 = 0x200c,
69 V4L2_MBUS_FMT_Y12_1X12 = 0x2013, 71 V4L2_MBUS_FMT_Y12_1X12 = 0x2013,
@@ -72,10 +74,20 @@ enum v4l2_mbus_pixelcode {
72 V4L2_MBUS_FMT_YUYV8_1X16 = 0x2011, 74 V4L2_MBUS_FMT_YUYV8_1X16 = 0x2011,
73 V4L2_MBUS_FMT_YVYU8_1X16 = 0x2012, 75 V4L2_MBUS_FMT_YVYU8_1X16 = 0x2012,
74 V4L2_MBUS_FMT_YDYUYDYV8_1X16 = 0x2014, 76 V4L2_MBUS_FMT_YDYUYDYV8_1X16 = 0x2014,
77 V4L2_MBUS_FMT_UYVY10_1X20 = 0x201a,
78 V4L2_MBUS_FMT_VYUY10_1X20 = 0x201b,
75 V4L2_MBUS_FMT_YUYV10_1X20 = 0x200d, 79 V4L2_MBUS_FMT_YUYV10_1X20 = 0x200d,
76 V4L2_MBUS_FMT_YVYU10_1X20 = 0x200e, 80 V4L2_MBUS_FMT_YVYU10_1X20 = 0x200e,
77 V4L2_MBUS_FMT_YUV10_1X30 = 0x2016, 81 V4L2_MBUS_FMT_YUV10_1X30 = 0x2016,
78 V4L2_MBUS_FMT_AYUV8_1X32 = 0x2017, 82 V4L2_MBUS_FMT_AYUV8_1X32 = 0x2017,
83 V4L2_MBUS_FMT_UYVY12_2X12 = 0x201c,
84 V4L2_MBUS_FMT_VYUY12_2X12 = 0x201d,
85 V4L2_MBUS_FMT_YUYV12_2X12 = 0x201e,
86 V4L2_MBUS_FMT_YVYU12_2X12 = 0x201f,
87 V4L2_MBUS_FMT_UYVY12_1X24 = 0x2020,
88 V4L2_MBUS_FMT_VYUY12_1X24 = 0x2021,
89 V4L2_MBUS_FMT_YUYV12_1X24 = 0x2022,
90 V4L2_MBUS_FMT_YVYU12_1X24 = 0x2023,
79 91
80 /* Bayer - next is 0x3019 */ 92 /* Bayer - next is 0x3019 */
81 V4L2_MBUS_FMT_SBGGR8_1X8 = 0x3001, 93 V4L2_MBUS_FMT_SBGGR8_1X8 = 0x3001,
diff --git a/include/uapi/linux/v4l2-subdev.h b/include/uapi/linux/v4l2-subdev.h
index 87e05159f637..a619cdd300ac 100644
--- a/include/uapi/linux/v4l2-subdev.h
+++ b/include/uapi/linux/v4l2-subdev.h
@@ -151,26 +151,24 @@ struct v4l2_subdev_selection {
151/* Backwards compatibility define --- to be removed */ 151/* Backwards compatibility define --- to be removed */
152#define v4l2_subdev_edid v4l2_edid 152#define v4l2_subdev_edid v4l2_edid
153 153
154#define VIDIOC_SUBDEV_G_FMT _IOWR('V', 4, struct v4l2_subdev_format) 154#define VIDIOC_SUBDEV_G_FMT _IOWR('V', 4, struct v4l2_subdev_format)
155#define VIDIOC_SUBDEV_S_FMT _IOWR('V', 5, struct v4l2_subdev_format) 155#define VIDIOC_SUBDEV_S_FMT _IOWR('V', 5, struct v4l2_subdev_format)
156#define VIDIOC_SUBDEV_G_FRAME_INTERVAL \ 156#define VIDIOC_SUBDEV_G_FRAME_INTERVAL _IOWR('V', 21, struct v4l2_subdev_frame_interval)
157 _IOWR('V', 21, struct v4l2_subdev_frame_interval) 157#define VIDIOC_SUBDEV_S_FRAME_INTERVAL _IOWR('V', 22, struct v4l2_subdev_frame_interval)
158#define VIDIOC_SUBDEV_S_FRAME_INTERVAL \ 158#define VIDIOC_SUBDEV_ENUM_MBUS_CODE _IOWR('V', 2, struct v4l2_subdev_mbus_code_enum)
159 _IOWR('V', 22, struct v4l2_subdev_frame_interval) 159#define VIDIOC_SUBDEV_ENUM_FRAME_SIZE _IOWR('V', 74, struct v4l2_subdev_frame_size_enum)
160#define VIDIOC_SUBDEV_ENUM_MBUS_CODE \ 160#define VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL _IOWR('V', 75, struct v4l2_subdev_frame_interval_enum)
161 _IOWR('V', 2, struct v4l2_subdev_mbus_code_enum) 161#define VIDIOC_SUBDEV_G_CROP _IOWR('V', 59, struct v4l2_subdev_crop)
162#define VIDIOC_SUBDEV_ENUM_FRAME_SIZE \ 162#define VIDIOC_SUBDEV_S_CROP _IOWR('V', 60, struct v4l2_subdev_crop)
163 _IOWR('V', 74, struct v4l2_subdev_frame_size_enum) 163#define VIDIOC_SUBDEV_G_SELECTION _IOWR('V', 61, struct v4l2_subdev_selection)
164#define VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL \ 164#define VIDIOC_SUBDEV_S_SELECTION _IOWR('V', 62, struct v4l2_subdev_selection)
165 _IOWR('V', 75, struct v4l2_subdev_frame_interval_enum) 165/* The following ioctls are identical to the ioctls in videodev2.h */
166#define VIDIOC_SUBDEV_G_CROP _IOWR('V', 59, struct v4l2_subdev_crop) 166#define VIDIOC_SUBDEV_G_EDID _IOWR('V', 40, struct v4l2_edid)
167#define VIDIOC_SUBDEV_S_CROP _IOWR('V', 60, struct v4l2_subdev_crop) 167#define VIDIOC_SUBDEV_S_EDID _IOWR('V', 41, struct v4l2_edid)
168#define VIDIOC_SUBDEV_G_SELECTION \ 168#define VIDIOC_SUBDEV_S_DV_TIMINGS _IOWR('V', 87, struct v4l2_dv_timings)
169 _IOWR('V', 61, struct v4l2_subdev_selection) 169#define VIDIOC_SUBDEV_G_DV_TIMINGS _IOWR('V', 88, struct v4l2_dv_timings)
170#define VIDIOC_SUBDEV_S_SELECTION \ 170#define VIDIOC_SUBDEV_ENUM_DV_TIMINGS _IOWR('V', 98, struct v4l2_enum_dv_timings)
171 _IOWR('V', 62, struct v4l2_subdev_selection) 171#define VIDIOC_SUBDEV_QUERY_DV_TIMINGS _IOR('V', 99, struct v4l2_dv_timings)
172/* These two G/S_EDID ioctls are identical to the ioctls in videodev2.h */ 172#define VIDIOC_SUBDEV_DV_TIMINGS_CAP _IOWR('V', 100, struct v4l2_dv_timings_cap)
173#define VIDIOC_SUBDEV_G_EDID _IOWR('V', 40, struct v4l2_edid)
174#define VIDIOC_SUBDEV_S_EDID _IOWR('V', 41, struct v4l2_edid)
175 173
176#endif 174#endif
diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
index ea468ee8fe21..168ff507bf75 100644
--- a/include/uapi/linux/videodev2.h
+++ b/include/uapi/linux/videodev2.h
@@ -649,7 +649,6 @@ struct v4l2_plane {
649 * @length: size in bytes of the buffer (NOT its payload) for single-plane 649 * @length: size in bytes of the buffer (NOT its payload) for single-plane
650 * buffers (when type != *_MPLANE); number of elements in the 650 * buffers (when type != *_MPLANE); number of elements in the
651 * planes array for multi-plane buffers 651 * planes array for multi-plane buffers
652 * @input: input number from which the video data has has been captured
653 * 652 *
654 * Contains data exchanged by application and driver using one of the Streaming 653 * Contains data exchanged by application and driver using one of the Streaming
655 * I/O methods. 654 * I/O methods.
@@ -1107,12 +1106,15 @@ struct v4l2_dv_timings {
1107 1106
1108/** struct v4l2_enum_dv_timings - DV timings enumeration 1107/** struct v4l2_enum_dv_timings - DV timings enumeration
1109 * @index: enumeration index 1108 * @index: enumeration index
1109 * @pad: the pad number for which to enumerate timings (used with
1110 * v4l-subdev nodes only)
1110 * @reserved: must be zeroed 1111 * @reserved: must be zeroed
1111 * @timings: the timings for the given index 1112 * @timings: the timings for the given index
1112 */ 1113 */
1113struct v4l2_enum_dv_timings { 1114struct v4l2_enum_dv_timings {
1114 __u32 index; 1115 __u32 index;
1115 __u32 reserved[3]; 1116 __u32 pad;
1117 __u32 reserved[2];
1116 struct v4l2_dv_timings timings; 1118 struct v4l2_dv_timings timings;
1117}; 1119};
1118 1120
@@ -1150,11 +1152,14 @@ struct v4l2_bt_timings_cap {
1150 1152
1151/** struct v4l2_dv_timings_cap - DV timings capabilities 1153/** struct v4l2_dv_timings_cap - DV timings capabilities
1152 * @type: the type of the timings (same as in struct v4l2_dv_timings) 1154 * @type: the type of the timings (same as in struct v4l2_dv_timings)
1155 * @pad: the pad number for which to query capabilities (used with
1156 * v4l-subdev nodes only)
1153 * @bt: the BT656/1120 timings capabilities 1157 * @bt: the BT656/1120 timings capabilities
1154 */ 1158 */
1155struct v4l2_dv_timings_cap { 1159struct v4l2_dv_timings_cap {
1156 __u32 type; 1160 __u32 type;
1157 __u32 reserved[3]; 1161 __u32 pad;
1162 __u32 reserved[2];
1158 union { 1163 union {
1159 struct v4l2_bt_timings_cap bt; 1164 struct v4l2_bt_timings_cap bt;
1160 __u32 raw_data[32]; 1165 __u32 raw_data[32];
@@ -1765,6 +1770,7 @@ struct v4l2_streamparm {
1765#define V4L2_EVENT_EOS 2 1770#define V4L2_EVENT_EOS 2
1766#define V4L2_EVENT_CTRL 3 1771#define V4L2_EVENT_CTRL 3
1767#define V4L2_EVENT_FRAME_SYNC 4 1772#define V4L2_EVENT_FRAME_SYNC 4
1773#define V4L2_EVENT_SOURCE_CHANGE 5
1768#define V4L2_EVENT_PRIVATE_START 0x08000000 1774#define V4L2_EVENT_PRIVATE_START 0x08000000
1769 1775
1770/* Payload for V4L2_EVENT_VSYNC */ 1776/* Payload for V4L2_EVENT_VSYNC */
@@ -1796,12 +1802,19 @@ struct v4l2_event_frame_sync {
1796 __u32 frame_sequence; 1802 __u32 frame_sequence;
1797}; 1803};
1798 1804
1805#define V4L2_EVENT_SRC_CH_RESOLUTION (1 << 0)
1806
1807struct v4l2_event_src_change {
1808 __u32 changes;
1809};
1810
1799struct v4l2_event { 1811struct v4l2_event {
1800 __u32 type; 1812 __u32 type;
1801 union { 1813 union {
1802 struct v4l2_event_vsync vsync; 1814 struct v4l2_event_vsync vsync;
1803 struct v4l2_event_ctrl ctrl; 1815 struct v4l2_event_ctrl ctrl;
1804 struct v4l2_event_frame_sync frame_sync; 1816 struct v4l2_event_frame_sync frame_sync;
1817 struct v4l2_event_src_change src_change;
1805 __u8 data[64]; 1818 __u8 data[64];
1806 } u; 1819 } u;
1807 __u32 pending; 1820 __u32 pending;
diff --git a/include/uapi/mtd/mtd-abi.h b/include/uapi/mtd/mtd-abi.h
index e272ea060e38..763bb6950402 100644
--- a/include/uapi/mtd/mtd-abi.h
+++ b/include/uapi/mtd/mtd-abi.h
@@ -109,6 +109,7 @@ struct mtd_write_req {
109#define MTD_CAP_RAM (MTD_WRITEABLE | MTD_BIT_WRITEABLE | MTD_NO_ERASE) 109#define MTD_CAP_RAM (MTD_WRITEABLE | MTD_BIT_WRITEABLE | MTD_NO_ERASE)
110#define MTD_CAP_NORFLASH (MTD_WRITEABLE | MTD_BIT_WRITEABLE) 110#define MTD_CAP_NORFLASH (MTD_WRITEABLE | MTD_BIT_WRITEABLE)
111#define MTD_CAP_NANDFLASH (MTD_WRITEABLE) 111#define MTD_CAP_NANDFLASH (MTD_WRITEABLE)
112#define MTD_CAP_NVRAM (MTD_WRITEABLE | MTD_BIT_WRITEABLE | MTD_NO_ERASE)
112 113
113/* Obsolete ECC byte placement modes (used with obsolete MEMGETOOBSEL) */ 114/* Obsolete ECC byte placement modes (used with obsolete MEMGETOOBSEL) */
114#define MTD_NANDECC_OFF 0 // Switch off ECC (Not recommended) 115#define MTD_NANDECC_OFF 0 // Switch off ECC (Not recommended)
diff --git a/include/uapi/rdma/rdma_netlink.h b/include/uapi/rdma/rdma_netlink.h
index 8297285b6288..de69170a30ce 100644
--- a/include/uapi/rdma/rdma_netlink.h
+++ b/include/uapi/rdma/rdma_netlink.h
@@ -4,7 +4,16 @@
4#include <linux/types.h> 4#include <linux/types.h>
5 5
6enum { 6enum {
7 RDMA_NL_RDMA_CM = 1 7 RDMA_NL_RDMA_CM = 1,
8 RDMA_NL_NES,
9 RDMA_NL_C4IW,
10 RDMA_NL_NUM_CLIENTS
11};
12
13enum {
14 RDMA_NL_GROUP_CM = 1,
15 RDMA_NL_GROUP_IWPM,
16 RDMA_NL_NUM_GROUPS
8}; 17};
9 18
10#define RDMA_NL_GET_CLIENT(type) ((type & (((1 << 6) - 1) << 10)) >> 10) 19#define RDMA_NL_GET_CLIENT(type) ((type & (((1 << 6) - 1) << 10)) >> 10)
@@ -22,6 +31,18 @@ enum {
22 RDMA_NL_RDMA_CM_NUM_ATTR, 31 RDMA_NL_RDMA_CM_NUM_ATTR,
23}; 32};
24 33
34/* iwarp port mapper op-codes */
35enum {
36 RDMA_NL_IWPM_REG_PID = 0,
37 RDMA_NL_IWPM_ADD_MAPPING,
38 RDMA_NL_IWPM_QUERY_MAPPING,
39 RDMA_NL_IWPM_REMOVE_MAPPING,
40 RDMA_NL_IWPM_HANDLE_ERR,
41 RDMA_NL_IWPM_MAPINFO,
42 RDMA_NL_IWPM_MAPINFO_NUM,
43 RDMA_NL_IWPM_NUM_OPS
44};
45
25struct rdma_cm_id_stats { 46struct rdma_cm_id_stats {
26 __u32 qp_num; 47 __u32 qp_num;
27 __u32 bound_dev_if; 48 __u32 bound_dev_if;
@@ -33,5 +54,78 @@ struct rdma_cm_id_stats {
33 __u8 qp_type; 54 __u8 qp_type;
34}; 55};
35 56
57enum {
58 IWPM_NLA_REG_PID_UNSPEC = 0,
59 IWPM_NLA_REG_PID_SEQ,
60 IWPM_NLA_REG_IF_NAME,
61 IWPM_NLA_REG_IBDEV_NAME,
62 IWPM_NLA_REG_ULIB_NAME,
63 IWPM_NLA_REG_PID_MAX
64};
65
66enum {
67 IWPM_NLA_RREG_PID_UNSPEC = 0,
68 IWPM_NLA_RREG_PID_SEQ,
69 IWPM_NLA_RREG_IBDEV_NAME,
70 IWPM_NLA_RREG_ULIB_NAME,
71 IWPM_NLA_RREG_ULIB_VER,
72 IWPM_NLA_RREG_PID_ERR,
73 IWPM_NLA_RREG_PID_MAX
74
75};
76
77enum {
78 IWPM_NLA_MANAGE_MAPPING_UNSPEC = 0,
79 IWPM_NLA_MANAGE_MAPPING_SEQ,
80 IWPM_NLA_MANAGE_ADDR,
81 IWPM_NLA_MANAGE_MAPPED_LOC_ADDR,
82 IWPM_NLA_RMANAGE_MAPPING_ERR,
83 IWPM_NLA_RMANAGE_MAPPING_MAX
84};
85
86#define IWPM_NLA_MANAGE_MAPPING_MAX 3
87#define IWPM_NLA_QUERY_MAPPING_MAX 4
88#define IWPM_NLA_MAPINFO_SEND_MAX 3
89
90enum {
91 IWPM_NLA_QUERY_MAPPING_UNSPEC = 0,
92 IWPM_NLA_QUERY_MAPPING_SEQ,
93 IWPM_NLA_QUERY_LOCAL_ADDR,
94 IWPM_NLA_QUERY_REMOTE_ADDR,
95 IWPM_NLA_RQUERY_MAPPED_LOC_ADDR,
96 IWPM_NLA_RQUERY_MAPPED_REM_ADDR,
97 IWPM_NLA_RQUERY_MAPPING_ERR,
98 IWPM_NLA_RQUERY_MAPPING_MAX
99};
100
101enum {
102 IWPM_NLA_MAPINFO_REQ_UNSPEC = 0,
103 IWPM_NLA_MAPINFO_ULIB_NAME,
104 IWPM_NLA_MAPINFO_ULIB_VER,
105 IWPM_NLA_MAPINFO_REQ_MAX
106};
107
108enum {
109 IWPM_NLA_MAPINFO_UNSPEC = 0,
110 IWPM_NLA_MAPINFO_LOCAL_ADDR,
111 IWPM_NLA_MAPINFO_MAPPED_ADDR,
112 IWPM_NLA_MAPINFO_MAX
113};
114
115enum {
116 IWPM_NLA_MAPINFO_NUM_UNSPEC = 0,
117 IWPM_NLA_MAPINFO_SEQ,
118 IWPM_NLA_MAPINFO_SEND_NUM,
119 IWPM_NLA_MAPINFO_ACK_NUM,
120 IWPM_NLA_MAPINFO_NUM_MAX
121};
122
123enum {
124 IWPM_NLA_ERR_UNSPEC = 0,
125 IWPM_NLA_ERR_SEQ,
126 IWPM_NLA_ERR_CODE,
127 IWPM_NLA_ERR_MAX
128};
129
36 130
37#endif /* _UAPI_RDMA_NETLINK_H */ 131#endif /* _UAPI_RDMA_NETLINK_H */
diff --git a/include/uapi/sound/asound.h b/include/uapi/sound/asound.h
index 9fc6219d3848..224948342f14 100644
--- a/include/uapi/sound/asound.h
+++ b/include/uapi/sound/asound.h
@@ -94,9 +94,11 @@ enum {
94 SNDRV_HWDEP_IFACE_HDA, /* HD-audio */ 94 SNDRV_HWDEP_IFACE_HDA, /* HD-audio */
95 SNDRV_HWDEP_IFACE_USB_STREAM, /* direct access to usb stream */ 95 SNDRV_HWDEP_IFACE_USB_STREAM, /* direct access to usb stream */
96 SNDRV_HWDEP_IFACE_FW_DICE, /* TC DICE FireWire device */ 96 SNDRV_HWDEP_IFACE_FW_DICE, /* TC DICE FireWire device */
97 SNDRV_HWDEP_IFACE_FW_FIREWORKS, /* Echo Audio Fireworks based device */
98 SNDRV_HWDEP_IFACE_FW_BEBOB, /* BridgeCo BeBoB based device */
97 99
98 /* Don't forget to change the following: */ 100 /* Don't forget to change the following: */
99 SNDRV_HWDEP_IFACE_LAST = SNDRV_HWDEP_IFACE_FW_DICE 101 SNDRV_HWDEP_IFACE_LAST = SNDRV_HWDEP_IFACE_FW_BEBOB
100}; 102};
101 103
102struct snd_hwdep_info { 104struct snd_hwdep_info {
diff --git a/include/uapi/sound/compress_offload.h b/include/uapi/sound/compress_offload.h
index 5759810e1c1b..1964026b5e09 100644
--- a/include/uapi/sound/compress_offload.h
+++ b/include/uapi/sound/compress_offload.h
@@ -39,7 +39,7 @@
39struct snd_compressed_buffer { 39struct snd_compressed_buffer {
40 __u32 fragment_size; 40 __u32 fragment_size;
41 __u32 fragments; 41 __u32 fragments;
42}; 42} __attribute__((packed, aligned(4)));
43 43
44/** 44/**
45 * struct snd_compr_params: compressed stream params 45 * struct snd_compr_params: compressed stream params
@@ -51,7 +51,7 @@ struct snd_compr_params {
51 struct snd_compressed_buffer buffer; 51 struct snd_compressed_buffer buffer;
52 struct snd_codec codec; 52 struct snd_codec codec;
53 __u8 no_wake_mode; 53 __u8 no_wake_mode;
54}; 54} __attribute__((packed, aligned(4)));
55 55
56/** 56/**
57 * struct snd_compr_tstamp: timestamp descriptor 57 * struct snd_compr_tstamp: timestamp descriptor
@@ -70,7 +70,7 @@ struct snd_compr_tstamp {
70 __u32 pcm_frames; 70 __u32 pcm_frames;
71 __u32 pcm_io_frames; 71 __u32 pcm_io_frames;
72 __u32 sampling_rate; 72 __u32 sampling_rate;
73}; 73} __attribute__((packed, aligned(4)));
74 74
75/** 75/**
76 * struct snd_compr_avail: avail descriptor 76 * struct snd_compr_avail: avail descriptor
@@ -80,7 +80,7 @@ struct snd_compr_tstamp {
80struct snd_compr_avail { 80struct snd_compr_avail {
81 __u64 avail; 81 __u64 avail;
82 struct snd_compr_tstamp tstamp; 82 struct snd_compr_tstamp tstamp;
83}; 83} __attribute__((packed, aligned(4)));
84 84
85enum snd_compr_direction { 85enum snd_compr_direction {
86 SND_COMPRESS_PLAYBACK = 0, 86 SND_COMPRESS_PLAYBACK = 0,
@@ -107,7 +107,7 @@ struct snd_compr_caps {
107 __u32 max_fragments; 107 __u32 max_fragments;
108 __u32 codecs[MAX_NUM_CODECS]; 108 __u32 codecs[MAX_NUM_CODECS];
109 __u32 reserved[11]; 109 __u32 reserved[11];
110}; 110} __attribute__((packed, aligned(4)));
111 111
112/** 112/**
113 * struct snd_compr_codec_caps: query capability of codec 113 * struct snd_compr_codec_caps: query capability of codec
@@ -119,7 +119,7 @@ struct snd_compr_codec_caps {
119 __u32 codec; 119 __u32 codec;
120 __u32 num_descriptors; 120 __u32 num_descriptors;
121 struct snd_codec_desc descriptor[MAX_NUM_CODEC_DESCRIPTORS]; 121 struct snd_codec_desc descriptor[MAX_NUM_CODEC_DESCRIPTORS];
122}; 122} __attribute__((packed, aligned(4)));
123 123
124/** 124/**
125 * @SNDRV_COMPRESS_ENCODER_PADDING: no of samples appended by the encoder at the 125 * @SNDRV_COMPRESS_ENCODER_PADDING: no of samples appended by the encoder at the
@@ -140,7 +140,7 @@ enum {
140struct snd_compr_metadata { 140struct snd_compr_metadata {
141 __u32 key; 141 __u32 key;
142 __u32 value[8]; 142 __u32 value[8];
143}; 143} __attribute__((packed, aligned(4)));
144 144
145/** 145/**
146 * compress path ioctl definitions 146 * compress path ioctl definitions
diff --git a/include/uapi/sound/compress_params.h b/include/uapi/sound/compress_params.h
index 165e7059de75..d9bd9ca0d5b0 100644
--- a/include/uapi/sound/compress_params.h
+++ b/include/uapi/sound/compress_params.h
@@ -268,7 +268,7 @@ struct snd_enc_vorbis {
268 __u32 max_bit_rate; 268 __u32 max_bit_rate;
269 __u32 min_bit_rate; 269 __u32 min_bit_rate;
270 __u32 downmix; 270 __u32 downmix;
271}; 271} __attribute__((packed, aligned(4)));
272 272
273 273
274/** 274/**
@@ -284,7 +284,7 @@ struct snd_enc_real {
284 __u32 quant_bits; 284 __u32 quant_bits;
285 __u32 start_region; 285 __u32 start_region;
286 __u32 num_regions; 286 __u32 num_regions;
287}; 287} __attribute__((packed, aligned(4)));
288 288
289/** 289/**
290 * struct snd_enc_flac 290 * struct snd_enc_flac
@@ -308,12 +308,12 @@ struct snd_enc_real {
308struct snd_enc_flac { 308struct snd_enc_flac {
309 __u32 num; 309 __u32 num;
310 __u32 gain; 310 __u32 gain;
311}; 311} __attribute__((packed, aligned(4)));
312 312
313struct snd_enc_generic { 313struct snd_enc_generic {
314 __u32 bw; /* encoder bandwidth */ 314 __u32 bw; /* encoder bandwidth */
315 __s32 reserved[15]; 315 __s32 reserved[15];
316}; 316} __attribute__((packed, aligned(4)));
317 317
318union snd_codec_options { 318union snd_codec_options {
319 struct snd_enc_wma wma; 319 struct snd_enc_wma wma;
@@ -321,7 +321,7 @@ union snd_codec_options {
321 struct snd_enc_real real; 321 struct snd_enc_real real;
322 struct snd_enc_flac flac; 322 struct snd_enc_flac flac;
323 struct snd_enc_generic generic; 323 struct snd_enc_generic generic;
324}; 324} __attribute__((packed, aligned(4)));
325 325
326/** struct snd_codec_desc - description of codec capabilities 326/** struct snd_codec_desc - description of codec capabilities
327 * @max_ch: Maximum number of audio channels 327 * @max_ch: Maximum number of audio channels
@@ -358,7 +358,7 @@ struct snd_codec_desc {
358 __u32 formats; 358 __u32 formats;
359 __u32 min_buffer; 359 __u32 min_buffer;
360 __u32 reserved[15]; 360 __u32 reserved[15];
361}; 361} __attribute__((packed, aligned(4)));
362 362
363/** struct snd_codec 363/** struct snd_codec
364 * @id: Identifies the supported audio encoder/decoder. 364 * @id: Identifies the supported audio encoder/decoder.
@@ -399,6 +399,6 @@ struct snd_codec {
399 __u32 align; 399 __u32 align;
400 union snd_codec_options options; 400 union snd_codec_options options;
401 __u32 reserved[3]; 401 __u32 reserved[3];
402}; 402} __attribute__((packed, aligned(4)));
403 403
404#endif 404#endif
diff --git a/include/uapi/sound/firewire.h b/include/uapi/sound/firewire.h
index 59f5961302bf..af4bd136c75d 100644
--- a/include/uapi/sound/firewire.h
+++ b/include/uapi/sound/firewire.h
@@ -2,11 +2,13 @@
2#define _UAPI_SOUND_FIREWIRE_H_INCLUDED 2#define _UAPI_SOUND_FIREWIRE_H_INCLUDED
3 3
4#include <linux/ioctl.h> 4#include <linux/ioctl.h>
5#include <linux/types.h>
5 6
6/* events can be read() from the hwdep device */ 7/* events can be read() from the hwdep device */
7 8
8#define SNDRV_FIREWIRE_EVENT_LOCK_STATUS 0x000010cc 9#define SNDRV_FIREWIRE_EVENT_LOCK_STATUS 0x000010cc
9#define SNDRV_FIREWIRE_EVENT_DICE_NOTIFICATION 0xd1ce004e 10#define SNDRV_FIREWIRE_EVENT_DICE_NOTIFICATION 0xd1ce004e
11#define SNDRV_FIREWIRE_EVENT_EFW_RESPONSE 0x4e617475
10 12
11struct snd_firewire_event_common { 13struct snd_firewire_event_common {
12 unsigned int type; /* SNDRV_FIREWIRE_EVENT_xxx */ 14 unsigned int type; /* SNDRV_FIREWIRE_EVENT_xxx */
@@ -22,10 +24,27 @@ struct snd_firewire_event_dice_notification {
22 unsigned int notification; /* DICE-specific bits */ 24 unsigned int notification; /* DICE-specific bits */
23}; 25};
24 26
27#define SND_EFW_TRANSACTION_USER_SEQNUM_MAX ((__u32)((__u16)~0) - 1)
28/* each field should be in big endian */
29struct snd_efw_transaction {
30 __be32 length;
31 __be32 version;
32 __be32 seqnum;
33 __be32 category;
34 __be32 command;
35 __be32 status;
36 __be32 params[0];
37};
38struct snd_firewire_event_efw_response {
39 unsigned int type;
40 __be32 response[0]; /* some responses */
41};
42
25union snd_firewire_event { 43union snd_firewire_event {
26 struct snd_firewire_event_common common; 44 struct snd_firewire_event_common common;
27 struct snd_firewire_event_lock_status lock_status; 45 struct snd_firewire_event_lock_status lock_status;
28 struct snd_firewire_event_dice_notification dice_notification; 46 struct snd_firewire_event_dice_notification dice_notification;
47 struct snd_firewire_event_efw_response efw_response;
29}; 48};
30 49
31 50
@@ -34,7 +53,9 @@ union snd_firewire_event {
34#define SNDRV_FIREWIRE_IOCTL_UNLOCK _IO('H', 0xfa) 53#define SNDRV_FIREWIRE_IOCTL_UNLOCK _IO('H', 0xfa)
35 54
36#define SNDRV_FIREWIRE_TYPE_DICE 1 55#define SNDRV_FIREWIRE_TYPE_DICE 1
37/* Fireworks, AV/C, RME, MOTU, ... */ 56#define SNDRV_FIREWIRE_TYPE_FIREWORKS 2
57#define SNDRV_FIREWIRE_TYPE_BEBOB 3
58/* AV/C, RME, MOTU, ... */
38 59
39struct snd_firewire_get_info { 60struct snd_firewire_get_info {
40 unsigned int type; /* SNDRV_FIREWIRE_TYPE_xxx */ 61 unsigned int type; /* SNDRV_FIREWIRE_TYPE_xxx */
diff --git a/include/video/imx-ipu-v3.h b/include/video/imx-ipu-v3.h
new file mode 100644
index 000000000000..3e43e22cdff9
--- /dev/null
+++ b/include/video/imx-ipu-v3.h
@@ -0,0 +1,347 @@
1/*
2 * Copyright 2005-2009 Freescale Semiconductor, Inc.
3 *
4 * The code contained herein is licensed under the GNU Lesser General
5 * Public License. You may obtain a copy of the GNU Lesser General
6 * Public License Version 2.1 or later at the following locations:
7 *
8 * http://www.opensource.org/licenses/lgpl-license.html
9 * http://www.gnu.org/copyleft/lgpl.html
10 */
11
12#ifndef __DRM_IPU_H__
13#define __DRM_IPU_H__
14
15#include <linux/types.h>
16#include <linux/videodev2.h>
17#include <linux/bitmap.h>
18#include <linux/fb.h>
19
20struct ipu_soc;
21
22enum ipuv3_type {
23 IPUV3EX,
24 IPUV3M,
25 IPUV3H,
26};
27
28#define IPU_PIX_FMT_GBR24 v4l2_fourcc('G', 'B', 'R', '3')
29
30/*
31 * Bitfield of Display Interface signal polarities.
32 */
33struct ipu_di_signal_cfg {
34 unsigned datamask_en:1;
35 unsigned interlaced:1;
36 unsigned odd_field_first:1;
37 unsigned clksel_en:1;
38 unsigned clkidle_en:1;
39 unsigned data_pol:1; /* true = inverted */
40 unsigned clk_pol:1; /* true = rising edge */
41 unsigned enable_pol:1;
42 unsigned Hsync_pol:1; /* true = active high */
43 unsigned Vsync_pol:1;
44
45 u16 width;
46 u16 height;
47 u32 pixel_fmt;
48 u16 h_start_width;
49 u16 h_sync_width;
50 u16 h_end_width;
51 u16 v_start_width;
52 u16 v_sync_width;
53 u16 v_end_width;
54 u32 v_to_h_sync;
55 unsigned long pixelclock;
56#define IPU_DI_CLKMODE_SYNC (1 << 0)
57#define IPU_DI_CLKMODE_EXT (1 << 1)
58 unsigned long clkflags;
59
60 u8 hsync_pin;
61 u8 vsync_pin;
62};
63
64enum ipu_color_space {
65 IPUV3_COLORSPACE_RGB,
66 IPUV3_COLORSPACE_YUV,
67 IPUV3_COLORSPACE_UNKNOWN,
68};
69
70struct ipuv3_channel;
71
72enum ipu_channel_irq {
73 IPU_IRQ_EOF = 0,
74 IPU_IRQ_NFACK = 64,
75 IPU_IRQ_NFB4EOF = 128,
76 IPU_IRQ_EOS = 192,
77};
78
79int ipu_map_irq(struct ipu_soc *ipu, int irq);
80int ipu_idmac_channel_irq(struct ipu_soc *ipu, struct ipuv3_channel *channel,
81 enum ipu_channel_irq irq);
82
83#define IPU_IRQ_DP_SF_START (448 + 2)
84#define IPU_IRQ_DP_SF_END (448 + 3)
85#define IPU_IRQ_BG_SF_END IPU_IRQ_DP_SF_END,
86#define IPU_IRQ_DC_FC_0 (448 + 8)
87#define IPU_IRQ_DC_FC_1 (448 + 9)
88#define IPU_IRQ_DC_FC_2 (448 + 10)
89#define IPU_IRQ_DC_FC_3 (448 + 11)
90#define IPU_IRQ_DC_FC_4 (448 + 12)
91#define IPU_IRQ_DC_FC_6 (448 + 13)
92#define IPU_IRQ_VSYNC_PRE_0 (448 + 14)
93#define IPU_IRQ_VSYNC_PRE_1 (448 + 15)
94
95/*
96 * IPU Image DMA Controller (idmac) functions
97 */
98struct ipuv3_channel *ipu_idmac_get(struct ipu_soc *ipu, unsigned channel);
99void ipu_idmac_put(struct ipuv3_channel *);
100
101int ipu_idmac_enable_channel(struct ipuv3_channel *channel);
102int ipu_idmac_disable_channel(struct ipuv3_channel *channel);
103int ipu_idmac_wait_busy(struct ipuv3_channel *channel, int ms);
104
105void ipu_idmac_set_double_buffer(struct ipuv3_channel *channel,
106 bool doublebuffer);
107int ipu_idmac_get_current_buffer(struct ipuv3_channel *channel);
108void ipu_idmac_select_buffer(struct ipuv3_channel *channel, u32 buf_num);
109
110/*
111 * IPU Display Controller (dc) functions
112 */
113struct ipu_dc;
114struct ipu_di;
115struct ipu_dc *ipu_dc_get(struct ipu_soc *ipu, int channel);
116void ipu_dc_put(struct ipu_dc *dc);
117int ipu_dc_init_sync(struct ipu_dc *dc, struct ipu_di *di, bool interlaced,
118 u32 pixel_fmt, u32 width);
119void ipu_dc_enable(struct ipu_soc *ipu);
120void ipu_dc_enable_channel(struct ipu_dc *dc);
121void ipu_dc_disable_channel(struct ipu_dc *dc);
122void ipu_dc_disable(struct ipu_soc *ipu);
123
124/*
125 * IPU Display Interface (di) functions
126 */
127struct ipu_di *ipu_di_get(struct ipu_soc *ipu, int disp);
128void ipu_di_put(struct ipu_di *);
129int ipu_di_disable(struct ipu_di *);
130int ipu_di_enable(struct ipu_di *);
131int ipu_di_get_num(struct ipu_di *);
132int ipu_di_init_sync_panel(struct ipu_di *, struct ipu_di_signal_cfg *sig);
133
134/*
135 * IPU Display Multi FIFO Controller (dmfc) functions
136 */
137struct dmfc_channel;
138int ipu_dmfc_enable_channel(struct dmfc_channel *dmfc);
139void ipu_dmfc_disable_channel(struct dmfc_channel *dmfc);
140int ipu_dmfc_alloc_bandwidth(struct dmfc_channel *dmfc,
141 unsigned long bandwidth_mbs, int burstsize);
142void ipu_dmfc_free_bandwidth(struct dmfc_channel *dmfc);
143int ipu_dmfc_init_channel(struct dmfc_channel *dmfc, int width);
144struct dmfc_channel *ipu_dmfc_get(struct ipu_soc *ipu, int ipuv3_channel);
145void ipu_dmfc_put(struct dmfc_channel *dmfc);
146
147/*
148 * IPU Display Processor (dp) functions
149 */
150#define IPU_DP_FLOW_SYNC_BG 0
151#define IPU_DP_FLOW_SYNC_FG 1
152#define IPU_DP_FLOW_ASYNC0_BG 2
153#define IPU_DP_FLOW_ASYNC0_FG 3
154#define IPU_DP_FLOW_ASYNC1_BG 4
155#define IPU_DP_FLOW_ASYNC1_FG 5
156
157struct ipu_dp *ipu_dp_get(struct ipu_soc *ipu, unsigned int flow);
158void ipu_dp_put(struct ipu_dp *);
159int ipu_dp_enable(struct ipu_soc *ipu);
160int ipu_dp_enable_channel(struct ipu_dp *dp);
161void ipu_dp_disable_channel(struct ipu_dp *dp);
162void ipu_dp_disable(struct ipu_soc *ipu);
163int ipu_dp_setup_channel(struct ipu_dp *dp,
164 enum ipu_color_space in, enum ipu_color_space out);
165int ipu_dp_set_window_pos(struct ipu_dp *, u16 x_pos, u16 y_pos);
166int ipu_dp_set_global_alpha(struct ipu_dp *dp, bool enable, u8 alpha,
167 bool bg_chan);
168
169/*
170 * IPU CMOS Sensor Interface (csi) functions
171 */
172int ipu_csi_enable(struct ipu_soc *ipu, int csi);
173int ipu_csi_disable(struct ipu_soc *ipu, int csi);
174
175/*
176 * IPU Sensor Multiple FIFO Controller (SMFC) functions
177 */
178int ipu_smfc_enable(struct ipu_soc *ipu);
179int ipu_smfc_disable(struct ipu_soc *ipu);
180int ipu_smfc_map_channel(struct ipu_soc *ipu, int channel, int csi_id, int mipi_id);
181int ipu_smfc_set_burstsize(struct ipu_soc *ipu, int channel, int burstsize);
182
183#define IPU_CPMEM_WORD(word, ofs, size) ((((word) * 160 + (ofs)) << 8) | (size))
184
185#define IPU_FIELD_UBO IPU_CPMEM_WORD(0, 46, 22)
186#define IPU_FIELD_VBO IPU_CPMEM_WORD(0, 68, 22)
187#define IPU_FIELD_IOX IPU_CPMEM_WORD(0, 90, 4)
188#define IPU_FIELD_RDRW IPU_CPMEM_WORD(0, 94, 1)
189#define IPU_FIELD_SO IPU_CPMEM_WORD(0, 113, 1)
190#define IPU_FIELD_SLY IPU_CPMEM_WORD(1, 102, 14)
191#define IPU_FIELD_SLUV IPU_CPMEM_WORD(1, 128, 14)
192
193#define IPU_FIELD_XV IPU_CPMEM_WORD(0, 0, 10)
194#define IPU_FIELD_YV IPU_CPMEM_WORD(0, 10, 9)
195#define IPU_FIELD_XB IPU_CPMEM_WORD(0, 19, 13)
196#define IPU_FIELD_YB IPU_CPMEM_WORD(0, 32, 12)
197#define IPU_FIELD_NSB_B IPU_CPMEM_WORD(0, 44, 1)
198#define IPU_FIELD_CF IPU_CPMEM_WORD(0, 45, 1)
199#define IPU_FIELD_SX IPU_CPMEM_WORD(0, 46, 12)
200#define IPU_FIELD_SY IPU_CPMEM_WORD(0, 58, 11)
201#define IPU_FIELD_NS IPU_CPMEM_WORD(0, 69, 10)
202#define IPU_FIELD_SDX IPU_CPMEM_WORD(0, 79, 7)
203#define IPU_FIELD_SM IPU_CPMEM_WORD(0, 86, 10)
204#define IPU_FIELD_SCC IPU_CPMEM_WORD(0, 96, 1)
205#define IPU_FIELD_SCE IPU_CPMEM_WORD(0, 97, 1)
206#define IPU_FIELD_SDY IPU_CPMEM_WORD(0, 98, 7)
207#define IPU_FIELD_SDRX IPU_CPMEM_WORD(0, 105, 1)
208#define IPU_FIELD_SDRY IPU_CPMEM_WORD(0, 106, 1)
209#define IPU_FIELD_BPP IPU_CPMEM_WORD(0, 107, 3)
210#define IPU_FIELD_DEC_SEL IPU_CPMEM_WORD(0, 110, 2)
211#define IPU_FIELD_DIM IPU_CPMEM_WORD(0, 112, 1)
212#define IPU_FIELD_BNDM IPU_CPMEM_WORD(0, 114, 3)
213#define IPU_FIELD_BM IPU_CPMEM_WORD(0, 117, 2)
214#define IPU_FIELD_ROT IPU_CPMEM_WORD(0, 119, 1)
215#define IPU_FIELD_HF IPU_CPMEM_WORD(0, 120, 1)
216#define IPU_FIELD_VF IPU_CPMEM_WORD(0, 121, 1)
217#define IPU_FIELD_THE IPU_CPMEM_WORD(0, 122, 1)
218#define IPU_FIELD_CAP IPU_CPMEM_WORD(0, 123, 1)
219#define IPU_FIELD_CAE IPU_CPMEM_WORD(0, 124, 1)
220#define IPU_FIELD_FW IPU_CPMEM_WORD(0, 125, 13)
221#define IPU_FIELD_FH IPU_CPMEM_WORD(0, 138, 12)
222#define IPU_FIELD_EBA0 IPU_CPMEM_WORD(1, 0, 29)
223#define IPU_FIELD_EBA1 IPU_CPMEM_WORD(1, 29, 29)
224#define IPU_FIELD_ILO IPU_CPMEM_WORD(1, 58, 20)
225#define IPU_FIELD_NPB IPU_CPMEM_WORD(1, 78, 7)
226#define IPU_FIELD_PFS IPU_CPMEM_WORD(1, 85, 4)
227#define IPU_FIELD_ALU IPU_CPMEM_WORD(1, 89, 1)
228#define IPU_FIELD_ALBM IPU_CPMEM_WORD(1, 90, 3)
229#define IPU_FIELD_ID IPU_CPMEM_WORD(1, 93, 2)
230#define IPU_FIELD_TH IPU_CPMEM_WORD(1, 95, 7)
231#define IPU_FIELD_SL IPU_CPMEM_WORD(1, 102, 14)
232#define IPU_FIELD_WID0 IPU_CPMEM_WORD(1, 116, 3)
233#define IPU_FIELD_WID1 IPU_CPMEM_WORD(1, 119, 3)
234#define IPU_FIELD_WID2 IPU_CPMEM_WORD(1, 122, 3)
235#define IPU_FIELD_WID3 IPU_CPMEM_WORD(1, 125, 3)
236#define IPU_FIELD_OFS0 IPU_CPMEM_WORD(1, 128, 5)
237#define IPU_FIELD_OFS1 IPU_CPMEM_WORD(1, 133, 5)
238#define IPU_FIELD_OFS2 IPU_CPMEM_WORD(1, 138, 5)
239#define IPU_FIELD_OFS3 IPU_CPMEM_WORD(1, 143, 5)
240#define IPU_FIELD_SXYS IPU_CPMEM_WORD(1, 148, 1)
241#define IPU_FIELD_CRE IPU_CPMEM_WORD(1, 149, 1)
242#define IPU_FIELD_DEC_SEL2 IPU_CPMEM_WORD(1, 150, 1)
243
244struct ipu_cpmem_word {
245 u32 data[5];
246 u32 res[3];
247};
248
249struct ipu_ch_param {
250 struct ipu_cpmem_word word[2];
251};
252
253void ipu_ch_param_write_field(struct ipu_ch_param __iomem *base, u32 wbs, u32 v);
254u32 ipu_ch_param_read_field(struct ipu_ch_param __iomem *base, u32 wbs);
255struct ipu_ch_param __iomem *ipu_get_cpmem(struct ipuv3_channel *channel);
256void ipu_ch_param_dump(struct ipu_ch_param __iomem *p);
257
258static inline void ipu_ch_param_zero(struct ipu_ch_param __iomem *p)
259{
260 int i;
261 void __iomem *base = p;
262
263 for (i = 0; i < sizeof(*p) / sizeof(u32); i++)
264 writel(0, base + i * sizeof(u32));
265}
266
267static inline void ipu_cpmem_set_buffer(struct ipu_ch_param __iomem *p,
268 int bufnum, dma_addr_t buf)
269{
270 if (bufnum)
271 ipu_ch_param_write_field(p, IPU_FIELD_EBA1, buf >> 3);
272 else
273 ipu_ch_param_write_field(p, IPU_FIELD_EBA0, buf >> 3);
274}
275
276static inline void ipu_cpmem_set_resolution(struct ipu_ch_param __iomem *p,
277 int xres, int yres)
278{
279 ipu_ch_param_write_field(p, IPU_FIELD_FW, xres - 1);
280 ipu_ch_param_write_field(p, IPU_FIELD_FH, yres - 1);
281}
282
283static inline void ipu_cpmem_set_stride(struct ipu_ch_param __iomem *p,
284 int stride)
285{
286 ipu_ch_param_write_field(p, IPU_FIELD_SLY, stride - 1);
287}
288
289void ipu_cpmem_set_high_priority(struct ipuv3_channel *channel);
290
291struct ipu_rgb {
292 struct fb_bitfield red;
293 struct fb_bitfield green;
294 struct fb_bitfield blue;
295 struct fb_bitfield transp;
296 int bits_per_pixel;
297};
298
299struct ipu_image {
300 struct v4l2_pix_format pix;
301 struct v4l2_rect rect;
302 dma_addr_t phys;
303};
304
305int ipu_cpmem_set_format_passthrough(struct ipu_ch_param __iomem *p,
306 int width);
307
308int ipu_cpmem_set_format_rgb(struct ipu_ch_param __iomem *,
309 const struct ipu_rgb *rgb);
310
311static inline void ipu_cpmem_interlaced_scan(struct ipu_ch_param *p,
312 int stride)
313{
314 ipu_ch_param_write_field(p, IPU_FIELD_SO, 1);
315 ipu_ch_param_write_field(p, IPU_FIELD_ILO, stride / 8);
316 ipu_ch_param_write_field(p, IPU_FIELD_SLY, (stride * 2) - 1);
317};
318
319void ipu_cpmem_set_yuv_planar(struct ipu_ch_param __iomem *p, u32 pixel_format,
320 int stride, int height);
321void ipu_cpmem_set_yuv_interleaved(struct ipu_ch_param __iomem *p,
322 u32 pixel_format);
323void ipu_cpmem_set_yuv_planar_full(struct ipu_ch_param __iomem *p,
324 u32 pixel_format, int stride, int u_offset, int v_offset);
325int ipu_cpmem_set_fmt(struct ipu_ch_param __iomem *cpmem, u32 pixelformat);
326int ipu_cpmem_set_image(struct ipu_ch_param __iomem *cpmem,
327 struct ipu_image *image);
328
329enum ipu_color_space ipu_drm_fourcc_to_colorspace(u32 drm_fourcc);
330enum ipu_color_space ipu_pixelformat_to_colorspace(u32 pixelformat);
331
332static inline void ipu_cpmem_set_burstsize(struct ipu_ch_param __iomem *p,
333 int burstsize)
334{
335 ipu_ch_param_write_field(p, IPU_FIELD_NPB, burstsize - 1);
336};
337
338struct ipu_client_platformdata {
339 int csi;
340 int di;
341 int dc;
342 int dp;
343 int dmfc;
344 int dma[2];
345};
346
347#endif /* __DRM_IPU_H__ */
diff --git a/include/video/omapdss.h b/include/video/omapdss.h
index 6adb44534606..fc06c5b5f12a 100644
--- a/include/video/omapdss.h
+++ b/include/video/omapdss.h
@@ -319,6 +319,7 @@ enum omapdss_version {
319 OMAPDSS_VER_OMAP4430_ES2, /* OMAP4430 ES2.0, 2.1, 2.2 */ 319 OMAPDSS_VER_OMAP4430_ES2, /* OMAP4430 ES2.0, 2.1, 2.2 */
320 OMAPDSS_VER_OMAP4, /* All other OMAP4s */ 320 OMAPDSS_VER_OMAP4, /* All other OMAP4s */
321 OMAPDSS_VER_OMAP5, 321 OMAPDSS_VER_OMAP5,
322 OMAPDSS_VER_AM43xx,
322}; 323};
323 324
324/* Board specific data */ 325/* Board specific data */
@@ -388,8 +389,8 @@ struct omap_dss_cpr_coefs {
388}; 389};
389 390
390struct omap_overlay_info { 391struct omap_overlay_info {
391 u32 paddr; 392 dma_addr_t paddr;
392 u32 p_uv_addr; /* for NV12 format */ 393 dma_addr_t p_uv_addr; /* for NV12 format */
393 u16 screen_width; 394 u16 screen_width;
394 u16 width; 395 u16 width;
395 u16 height; 396 u16 height;
@@ -964,9 +965,6 @@ int dispc_ovl_setup(enum omap_plane plane, const struct omap_overlay_info *oi,
964 bool replication, const struct omap_video_timings *mgr_timings, 965 bool replication, const struct omap_video_timings *mgr_timings,
965 bool mem_to_mem); 966 bool mem_to_mem);
966 967
967#define to_dss_driver(x) container_of((x), struct omap_dss_driver, driver)
968#define to_dss_device(x) container_of((x), struct omap_dss_device, old_dev)
969
970int omapdss_compat_init(void); 968int omapdss_compat_init(void);
971void omapdss_compat_uninit(void); 969void omapdss_compat_uninit(void);
972 970
diff --git a/include/xen/interface/io/blkif.h b/include/xen/interface/io/blkif.h
index 32ec05a6572f..c33e1c489eb2 100644
--- a/include/xen/interface/io/blkif.h
+++ b/include/xen/interface/io/blkif.h
@@ -86,7 +86,7 @@ typedef uint64_t blkif_sector_t;
86 * Interface%20manuals/100293068c.pdf 86 * Interface%20manuals/100293068c.pdf
87 * The backend can optionally provide three extra XenBus attributes to 87 * The backend can optionally provide three extra XenBus attributes to
88 * further optimize the discard functionality: 88 * further optimize the discard functionality:
89 * 'discard-aligment' - Devices that support discard functionality may 89 * 'discard-alignment' - Devices that support discard functionality may
90 * internally allocate space in units that are bigger than the exported 90 * internally allocate space in units that are bigger than the exported
91 * logical block size. The discard-alignment parameter indicates how many bytes 91 * logical block size. The discard-alignment parameter indicates how many bytes
92 * the beginning of the partition is offset from the internal allocation unit's 92 * the beginning of the partition is offset from the internal allocation unit's
diff --git a/include/xen/interface/io/netif.h b/include/xen/interface/io/netif.h
index c50061db6098..70054cc0708d 100644
--- a/include/xen/interface/io/netif.h
+++ b/include/xen/interface/io/netif.h
@@ -51,6 +51,59 @@
51 */ 51 */
52 52
53/* 53/*
54 * Multiple transmit and receive queues:
55 * If supported, the backend will write the key "multi-queue-max-queues" to
56 * the directory for that vif, and set its value to the maximum supported
57 * number of queues.
58 * Frontends that are aware of this feature and wish to use it can write the
59 * key "multi-queue-num-queues", set to the number they wish to use, which
60 * must be greater than zero, and no more than the value reported by the backend
61 * in "multi-queue-max-queues".
62 *
63 * Queues replicate the shared rings and event channels.
64 * "feature-split-event-channels" may optionally be used when using
65 * multiple queues, but is not mandatory.
66 *
67 * Each queue consists of one shared ring pair, i.e. there must be the same
68 * number of tx and rx rings.
69 *
70 * For frontends requesting just one queue, the usual event-channel and
71 * ring-ref keys are written as before, simplifying the backend processing
72 * to avoid distinguishing between a frontend that doesn't understand the
73 * multi-queue feature, and one that does, but requested only one queue.
74 *
75 * Frontends requesting two or more queues must not write the toplevel
76 * event-channel (or event-channel-{tx,rx}) and {tx,rx}-ring-ref keys,
77 * instead writing those keys under sub-keys having the name "queue-N" where
78 * N is the integer ID of the queue for which those keys belong. Queues
79 * are indexed from zero. For example, a frontend with two queues and split
80 * event channels must write the following set of queue-related keys:
81 *
82 * /local/domain/1/device/vif/0/multi-queue-num-queues = "2"
83 * /local/domain/1/device/vif/0/queue-0 = ""
84 * /local/domain/1/device/vif/0/queue-0/tx-ring-ref = "<ring-ref-tx0>"
85 * /local/domain/1/device/vif/0/queue-0/rx-ring-ref = "<ring-ref-rx0>"
86 * /local/domain/1/device/vif/0/queue-0/event-channel-tx = "<evtchn-tx0>"
87 * /local/domain/1/device/vif/0/queue-0/event-channel-rx = "<evtchn-rx0>"
88 * /local/domain/1/device/vif/0/queue-1 = ""
89 * /local/domain/1/device/vif/0/queue-1/tx-ring-ref = "<ring-ref-tx1>"
90 * /local/domain/1/device/vif/0/queue-1/rx-ring-ref = "<ring-ref-rx1"
91 * /local/domain/1/device/vif/0/queue-1/event-channel-tx = "<evtchn-tx1>"
92 * /local/domain/1/device/vif/0/queue-1/event-channel-rx = "<evtchn-rx1>"
93 *
94 * If there is any inconsistency in the XenStore data, the backend may
95 * choose not to connect any queues, instead treating the request as an
96 * error. This includes scenarios where more (or fewer) queues were
97 * requested than the frontend provided details for.
98 *
99 * Mapping of packets to queues is considered to be a function of the
100 * transmitting system (backend or frontend) and is not negotiated
101 * between the two. Guests are free to transmit packets on any queue
102 * they choose, provided it has been set up correctly. Guests must be
103 * prepared to receive packets on any queue they have requested be set up.
104 */
105
106/*
54 * "feature-no-csum-offload" should be used to turn IPv4 TCP/UDP checksum 107 * "feature-no-csum-offload" should be used to turn IPv4 TCP/UDP checksum
55 * offload off or on. If it is missing then the feature is assumed to be on. 108 * offload off or on. If it is missing then the feature is assumed to be on.
56 * "feature-ipv6-csum-offload" should be used to turn IPv6 TCP/UDP checksum 109 * "feature-ipv6-csum-offload" should be used to turn IPv6 TCP/UDP checksum
diff --git a/include/xen/interface/xen.h b/include/xen/interface/xen.h
index 0cd5ca333fac..de082130ba4b 100644
--- a/include/xen/interface/xen.h
+++ b/include/xen/interface/xen.h
@@ -275,9 +275,9 @@ DEFINE_GUEST_HANDLE_STRUCT(mmu_update);
275 * NB. The fields are natural register size for this architecture. 275 * NB. The fields are natural register size for this architecture.
276 */ 276 */
277struct multicall_entry { 277struct multicall_entry {
278 unsigned long op; 278 xen_ulong_t op;
279 long result; 279 xen_long_t result;
280 unsigned long args[6]; 280 xen_ulong_t args[6];
281}; 281};
282DEFINE_GUEST_HANDLE_STRUCT(multicall_entry); 282DEFINE_GUEST_HANDLE_STRUCT(multicall_entry);
283 283
diff --git a/include/xen/xen-ops.h b/include/xen/xen-ops.h
index 2cf47175b12b..0b3149ed7eaa 100644
--- a/include/xen/xen-ops.h
+++ b/include/xen/xen-ops.h
@@ -9,10 +9,6 @@ DECLARE_PER_CPU(struct vcpu_info *, xen_vcpu);
9 9
10void xen_arch_pre_suspend(void); 10void xen_arch_pre_suspend(void);
11void xen_arch_post_suspend(int suspend_cancelled); 11void xen_arch_post_suspend(int suspend_cancelled);
12void xen_arch_hvm_post_suspend(int suspend_cancelled);
13
14void xen_mm_pin_all(void);
15void xen_mm_unpin_all(void);
16 12
17void xen_timer_resume(void); 13void xen_timer_resume(void);
18void xen_arch_resume(void); 14void xen_arch_resume(void);