aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/acpi/acpi_bus.h36
-rw-r--r--include/asm-generic/pci-bridge.h6
-rw-r--r--include/asm-generic/siginfo.h22
-rw-r--r--include/asm-generic/syscall.h14
-rw-r--r--include/asm-generic/vmlinux.lds.h2
-rw-r--r--include/keys/keyring-type.h2
-rw-r--r--include/linux/Kbuild4
-rw-r--r--include/linux/alarmtimer.h3
-rw-r--r--include/linux/amba/bus.h8
-rw-r--r--include/linux/audit.h8
-rw-r--r--include/linux/bcma/bcma.h1
-rw-r--r--include/linux/blkdev.h3
-rw-r--r--include/linux/capability.h5
-rw-r--r--include/linux/cgroup.h81
-rw-r--r--include/linux/clk.h32
-rw-r--r--include/linux/clkdev.h3
-rw-r--r--include/linux/cpu.h2
-rw-r--r--include/linux/cs5535.h1
-rw-r--r--include/linux/dcache.h21
-rw-r--r--include/linux/device.h34
-rw-r--r--include/linux/dlm.h1
-rw-r--r--include/linux/dmar.h85
-rw-r--r--include/linux/dynamic_debug.h22
-rw-r--r--include/linux/eventpoll.h12
-rw-r--r--include/linux/extcon.h324
-rw-r--r--include/linux/extcon/extcon_gpio.h52
-rw-r--r--include/linux/filter.h12
-rw-r--r--include/linux/firewire.h15
-rw-r--r--include/linux/fs.h1
-rw-r--r--include/linux/fsl_devices.h9
-rw-r--r--include/linux/ftrace.h19
-rw-r--r--include/linux/ftrace_event.h2
-rw-r--r--include/linux/generic_serial.h64
-rw-r--r--include/linux/genhd.h6
-rw-r--r--include/linux/hid.h36
-rw-r--r--include/linux/hidraw.h4
-rw-r--r--include/linux/hyperv.h4
-rw-r--r--include/linux/i2c-pnx.h10
-rw-r--r--include/linux/i2c/twl.h13
-rw-r--r--include/linux/if_ec.h68
-rw-r--r--include/linux/iio/buffer.h191
-rw-r--r--include/linux/iio/consumer.h96
-rw-r--r--include/linux/iio/driver.h34
-rw-r--r--include/linux/iio/events.h105
-rw-r--r--include/linux/iio/iio.h492
-rw-r--r--include/linux/iio/kfifo_buf.h8
-rw-r--r--include/linux/iio/machine.h24
-rw-r--r--include/linux/iio/sysfs.h117
-rw-r--r--include/linux/iio/trigger.h119
-rw-r--r--include/linux/iio/trigger_consumer.h52
-rw-r--r--include/linux/iio/types.h55
-rw-r--r--include/linux/interrupt.h8
-rw-r--r--include/linux/ioport.h7
-rw-r--r--include/linux/irq.h5
-rw-r--r--include/linux/isdn.h26
-rw-r--r--include/linux/kernel.h13
-rw-r--r--include/linux/key.h11
-rw-r--r--include/linux/keyctl.h1
-rw-r--r--include/linux/libata.h1
-rw-r--r--include/linux/lockdep.h18
-rw-r--r--include/linux/lsm_audit.h6
-rw-r--r--include/linux/mei.h110
-rw-r--r--include/linux/mfd/abx500.h5
-rw-r--r--include/linux/mfd/abx500/ab5500.h140
-rw-r--r--include/linux/mfd/asic3.h1
-rw-r--r--include/linux/mfd/da9052/da9052.h1
-rw-r--r--include/linux/mfd/db5500-prcmu.h105
-rw-r--r--include/linux/mfd/dbx500-prcmu.h242
-rw-r--r--include/linux/mfd/max8997.h23
-rw-r--r--include/linux/mfd/mc13xxx.h11
-rw-r--r--include/linux/mfd/palmas.h2620
-rw-r--r--include/linux/mfd/rc5t583.h29
-rw-r--r--include/linux/mfd/s5m87xx/s5m-core.h1
-rw-r--r--include/linux/mfd/s5m87xx/s5m-pmic.h29
-rw-r--r--include/linux/mfd/tps65090.h13
-rw-r--r--include/linux/mfd/tps6586x.h1
-rw-r--r--include/linux/mfd/wm831x/pdata.h2
-rw-r--r--include/linux/mfd/wm8994/core.h12
-rw-r--r--include/linux/mlx4/device.h8
-rw-r--r--include/linux/mlx4/qp.h3
-rw-r--r--include/linux/mm.h6
-rw-r--r--include/linux/mmzone.h2
-rw-r--r--include/linux/mod_devicetable.h4
-rw-r--r--include/linux/moduleparam.h3
-rw-r--r--include/linux/mtd/ubi.h31
-rw-r--r--include/linux/netdevice.h2
-rw-r--r--include/linux/of.h51
-rw-r--r--include/linux/of_serial.h17
-rw-r--r--include/linux/pci.h9
-rw-r--r--include/linux/percpu.h54
-rw-r--r--include/linux/perf_event.h5
-rw-r--r--include/linux/pinctrl/consumer.h44
-rw-r--r--include/linux/pinctrl/machine.h7
-rw-r--r--include/linux/pinctrl/pinconf.h6
-rw-r--r--include/linux/pinctrl/pinctrl-state.h13
-rw-r--r--include/linux/pinctrl/pinctrl.h22
-rw-r--r--include/linux/pinctrl/pinmux.h9
-rw-r--r--include/linux/platform_data/at91_adc.h61
-rw-r--r--include/linux/platform_data/ehci-sh.h28
-rw-r--r--include/linux/platform_data/emif_plat.h128
-rw-r--r--include/linux/platform_data/gpio-em.h10
-rw-r--r--include/linux/platform_data/ina2xx.h19
-rw-r--r--include/linux/platform_data/s3c-hsotg.h35
-rw-r--r--include/linux/platform_data/tegra_usb.h1
-rw-r--r--include/linux/pm.h2
-rw-r--r--include/linux/pm_domain.h13
-rw-r--r--include/linux/pm_runtime.h3
-rw-r--r--include/linux/pm_wakeup.h15
-rw-r--r--include/linux/prctl.h15
-rw-r--r--include/linux/printk.h13
-rw-r--r--include/linux/pstore_ram.h98
-rw-r--r--include/linux/ptrace.h5
-rw-r--r--include/linux/raid/md_p.h15
-rw-r--r--include/linux/raid/pq.h18
-rw-r--r--include/linux/ramoops.h17
-rw-r--r--include/linux/rational.h2
-rw-r--r--include/linux/rculist.h40
-rw-r--r--include/linux/rcupdate.h20
-rw-r--r--include/linux/rcutiny.h11
-rw-r--r--include/linux/rcutree.h19
-rw-r--r--include/linux/regmap.h44
-rw-r--r--include/linux/regulator/driver.h73
-rw-r--r--include/linux/regulator/fixed.h7
-rw-r--r--include/linux/regulator/of_regulator.h18
-rw-r--r--include/linux/regulator/tps62360.h6
-rw-r--r--include/linux/regulator/tps65090-regulator.h50
-rw-r--r--include/linux/res_counter.h2
-rw-r--r--include/linux/ring_buffer.h6
-rw-r--r--include/linux/sched.h63
-rw-r--r--include/linux/seccomp.h107
-rw-r--r--include/linux/security.h14
-rw-r--r--include/linux/serial_8250.h2
-rw-r--r--include/linux/serial_core.h5
-rw-r--r--include/linux/serial_sci.h2
-rw-r--r--include/linux/sh_clk.h34
-rw-r--r--include/linux/sh_intc.h1
-rw-r--r--include/linux/skbuff.h47
-rw-r--r--include/linux/smp.h6
-rw-r--r--include/linux/spi/eeprom.h10
-rw-r--r--include/linux/srcu.h48
-rw-r--r--include/linux/suspend.h14
-rw-r--r--include/linux/sysfs.h12
-rw-r--r--include/linux/tcp.h2
-rw-r--r--include/linux/thread_info.h6
-rw-r--r--include/linux/ti_wilink_st.h2
-rw-r--r--include/linux/topology.h46
-rw-r--r--include/linux/tty.h23
-rw-r--r--include/linux/tty_ldisc.h2
-rw-r--r--include/linux/usb.h79
-rw-r--r--include/linux/usb/ch11.h2
-rw-r--r--include/linux/usb/ch9.h58
-rw-r--r--include/linux/usb/chipidea.h28
-rw-r--r--include/linux/usb/composite.h6
-rw-r--r--include/linux/usb/functionfs.h4
-rw-r--r--include/linux/usb/gpio_vbus.h2
-rw-r--r--include/linux/usb/hcd.h32
-rw-r--r--include/linux/usb/isp1301.h80
-rw-r--r--include/linux/usb/langwell_udc.h310
-rw-r--r--include/linux/usb/serial.h34
-rw-r--r--include/linux/uuid.h4
-rw-r--r--include/linux/virtio_config.h11
-rw-r--r--include/linux/vme.h174
-rw-r--r--include/linux/vt_kern.h1
-rw-r--r--include/memory/jedec_ddr.h175
-rw-r--r--include/mtd/ubi-user.h34
-rw-r--r--include/net/addrconf.h18
-rw-r--r--include/net/inet_frag.h3
-rw-r--r--include/net/ip6_route.h2
-rw-r--r--include/net/ipv6.h34
-rw-r--r--include/net/lapb.h6
-rw-r--r--include/net/rawv6.h2
-rw-r--r--include/net/sock.h12
-rw-r--r--include/net/tcp_memcontrol.h4
-rw-r--r--include/rdma/ib_mad.h2
-rw-r--r--include/rdma/ib_verbs.h4
-rw-r--r--include/scsi/iscsi_proto.h2
-rw-r--r--include/scsi/sas.h1
-rw-r--r--include/sound/asound.h14
-rw-r--r--include/sound/asoundef.h41
-rw-r--r--include/sound/cs42l52.h36
-rw-r--r--include/sound/max98095.h12
-rw-r--r--include/sound/sh_fsi.h18
-rw-r--r--include/sound/simple_card.h38
-rw-r--r--include/sound/soc-dai.h4
-rw-r--r--include/sound/soc-dapm.h28
-rw-r--r--include/sound/soc-dpcm.h138
-rw-r--r--include/sound/soc.h118
-rw-r--r--include/target/target_core_backend.h16
-rw-r--r--include/target/target_core_base.h59
-rw-r--r--include/target/target_core_fabric.h11
-rw-r--r--include/trace/events/asoc.h80
-rw-r--r--include/trace/events/power.h34
-rw-r--r--include/trace/events/rcu.h2
-rw-r--r--include/trace/events/workqueue.h2
-rw-r--r--include/video/omap-panel-nokia-dsi.h3
-rw-r--r--include/video/omap-panel-tfp410.h (renamed from include/video/omap-panel-dvi.h)18
-rw-r--r--include/video/omapdss.h28
-rw-r--r--include/video/vga.h22
198 files changed, 7406 insertions, 1757 deletions
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index f1c8ca60e824..b0d62820ada1 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -51,6 +51,37 @@ acpi_evaluate_reference(acpi_handle handle,
51 struct acpi_object_list *arguments, 51 struct acpi_object_list *arguments,
52 struct acpi_handle_list *list); 52 struct acpi_handle_list *list);
53 53
54struct acpi_pld {
55 unsigned int revision:7; /* 0 */
56 unsigned int ignore_colour:1; /* 7 */
57 unsigned int colour:24; /* 8 */
58 unsigned int width:16; /* 32 */
59 unsigned int height:16; /* 48 */
60 unsigned int user_visible:1; /* 64 */
61 unsigned int dock:1; /* 65 */
62 unsigned int lid:1; /* 66 */
63 unsigned int panel:3; /* 67 */
64 unsigned int vertical_pos:2; /* 70 */
65 unsigned int horizontal_pos:2; /* 72 */
66 unsigned int shape:4; /* 74 */
67 unsigned int group_orientation:1; /* 78 */
68 unsigned int group_token:8; /* 79 */
69 unsigned int group_position:8; /* 87 */
70 unsigned int bay:1; /* 95 */
71 unsigned int ejectable:1; /* 96 */
72 unsigned int ospm_eject_required:1; /* 97 */
73 unsigned int cabinet_number:8; /* 98 */
74 unsigned int card_cage_number:8; /* 106 */
75 unsigned int reference:1; /* 114 */
76 unsigned int rotation:4; /* 115 */
77 unsigned int order:5; /* 119 */
78 unsigned int reserved:4; /* 124 */
79 unsigned int vertical_offset:16; /* 128 */
80 unsigned int horizontal_offset:16; /* 144 */
81} __attribute__((__packed__));
82
83acpi_status
84acpi_get_physical_device_location(acpi_handle handle, struct acpi_pld *pld);
54#ifdef CONFIG_ACPI 85#ifdef CONFIG_ACPI
55 86
56#include <linux/proc_fs.h> 87#include <linux/proc_fs.h>
@@ -407,6 +438,11 @@ static inline int acpi_pm_device_sleep_wake(struct device *dev, bool enable)
407} 438}
408#endif 439#endif
409 440
441#else /* CONFIG_ACPI */
442
443static int register_acpi_bus_type(struct acpi_bus_type *bus) { return 0; }
444static int unregister_acpi_bus_type(struct acpi_bus_type *bus) { return 0; }
445
410#endif /* CONFIG_ACPI */ 446#endif /* CONFIG_ACPI */
411 447
412#endif /*__ACPI_BUS_H__*/ 448#endif /*__ACPI_BUS_H__*/
diff --git a/include/asm-generic/pci-bridge.h b/include/asm-generic/pci-bridge.h
index a5b5d5a89a4f..20db2e5a0a69 100644
--- a/include/asm-generic/pci-bridge.h
+++ b/include/asm-generic/pci-bridge.h
@@ -30,6 +30,12 @@ enum {
30 PCI_ENABLE_PROC_DOMAINS = 0x00000010, 30 PCI_ENABLE_PROC_DOMAINS = 0x00000010,
31 /* ... except for domain 0 */ 31 /* ... except for domain 0 */
32 PCI_COMPAT_DOMAIN_0 = 0x00000020, 32 PCI_COMPAT_DOMAIN_0 = 0x00000020,
33
34 /* PCIe downstream ports are bridges that normally lead to only a
35 * device 0, but if this is set, we scan all possible devices, not
36 * just device 0.
37 */
38 PCI_SCAN_ALL_PCIE_DEVS = 0x00000040,
33}; 39};
34 40
35#ifdef CONFIG_PCI 41#ifdef CONFIG_PCI
diff --git a/include/asm-generic/siginfo.h b/include/asm-generic/siginfo.h
index 5e5e3865f1ed..8ed67779fc09 100644
--- a/include/asm-generic/siginfo.h
+++ b/include/asm-generic/siginfo.h
@@ -98,9 +98,18 @@ typedef struct siginfo {
98 __ARCH_SI_BAND_T _band; /* POLL_IN, POLL_OUT, POLL_MSG */ 98 __ARCH_SI_BAND_T _band; /* POLL_IN, POLL_OUT, POLL_MSG */
99 int _fd; 99 int _fd;
100 } _sigpoll; 100 } _sigpoll;
101
102 /* SIGSYS */
103 struct {
104 void __user *_call_addr; /* calling user insn */
105 int _syscall; /* triggering system call number */
106 unsigned int _arch; /* AUDIT_ARCH_* of syscall */
107 } _sigsys;
101 } _sifields; 108 } _sifields;
102} __ARCH_SI_ATTRIBUTES siginfo_t; 109} __ARCH_SI_ATTRIBUTES siginfo_t;
103 110
111/* If the arch shares siginfo, then it has SIGSYS. */
112#define __ARCH_SIGSYS
104#endif 113#endif
105 114
106/* 115/*
@@ -124,6 +133,11 @@ typedef struct siginfo {
124#define si_addr_lsb _sifields._sigfault._addr_lsb 133#define si_addr_lsb _sifields._sigfault._addr_lsb
125#define si_band _sifields._sigpoll._band 134#define si_band _sifields._sigpoll._band
126#define si_fd _sifields._sigpoll._fd 135#define si_fd _sifields._sigpoll._fd
136#ifdef __ARCH_SIGSYS
137#define si_call_addr _sifields._sigsys._call_addr
138#define si_syscall _sifields._sigsys._syscall
139#define si_arch _sifields._sigsys._arch
140#endif
127 141
128#ifdef __KERNEL__ 142#ifdef __KERNEL__
129#define __SI_MASK 0xffff0000u 143#define __SI_MASK 0xffff0000u
@@ -134,6 +148,7 @@ typedef struct siginfo {
134#define __SI_CHLD (4 << 16) 148#define __SI_CHLD (4 << 16)
135#define __SI_RT (5 << 16) 149#define __SI_RT (5 << 16)
136#define __SI_MESGQ (6 << 16) 150#define __SI_MESGQ (6 << 16)
151#define __SI_SYS (7 << 16)
137#define __SI_CODE(T,N) ((T) | ((N) & 0xffff)) 152#define __SI_CODE(T,N) ((T) | ((N) & 0xffff))
138#else 153#else
139#define __SI_KILL 0 154#define __SI_KILL 0
@@ -143,6 +158,7 @@ typedef struct siginfo {
143#define __SI_CHLD 0 158#define __SI_CHLD 0
144#define __SI_RT 0 159#define __SI_RT 0
145#define __SI_MESGQ 0 160#define __SI_MESGQ 0
161#define __SI_SYS 0
146#define __SI_CODE(T,N) (N) 162#define __SI_CODE(T,N) (N)
147#endif 163#endif
148 164
@@ -240,6 +256,12 @@ typedef struct siginfo {
240#define NSIGPOLL 6 256#define NSIGPOLL 6
241 257
242/* 258/*
259 * SIGSYS si_codes
260 */
261#define SYS_SECCOMP (__SI_SYS|1) /* seccomp triggered */
262#define NSIGSYS 1
263
264/*
243 * sigevent definitions 265 * sigevent definitions
244 * 266 *
245 * It seems likely that SIGEV_THREAD will have to be handled from 267 * It seems likely that SIGEV_THREAD will have to be handled from
diff --git a/include/asm-generic/syscall.h b/include/asm-generic/syscall.h
index 5c122ae6bfa6..5b09392db673 100644
--- a/include/asm-generic/syscall.h
+++ b/include/asm-generic/syscall.h
@@ -142,4 +142,18 @@ void syscall_set_arguments(struct task_struct *task, struct pt_regs *regs,
142 unsigned int i, unsigned int n, 142 unsigned int i, unsigned int n,
143 const unsigned long *args); 143 const unsigned long *args);
144 144
145/**
146 * syscall_get_arch - return the AUDIT_ARCH for the current system call
147 * @task: task of interest, must be in system call entry tracing
148 * @regs: task_pt_regs() of @task
149 *
150 * Returns the AUDIT_ARCH_* based on the system call convention in use.
151 *
152 * It's only valid to call this when @task is stopped on entry to a system
153 * call, due to %TIF_SYSCALL_TRACE, %TIF_SYSCALL_AUDIT, or %TIF_SECCOMP.
154 *
155 * Architectures which permit CONFIG_HAVE_ARCH_SECCOMP_FILTER must
156 * provide an implementation of this.
157 */
158int syscall_get_arch(struct task_struct *task, struct pt_regs *regs);
145#endif /* _ASM_SYSCALL_H */ 159#endif /* _ASM_SYSCALL_H */
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 8aeadf6b553a..4e2e1cc505ab 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -486,8 +486,8 @@
486 CPU_DISCARD(init.data) \ 486 CPU_DISCARD(init.data) \
487 MEM_DISCARD(init.data) \ 487 MEM_DISCARD(init.data) \
488 KERNEL_CTORS() \ 488 KERNEL_CTORS() \
489 *(.init.rodata) \
490 MCOUNT_REC() \ 489 MCOUNT_REC() \
490 *(.init.rodata) \
491 FTRACE_EVENTS() \ 491 FTRACE_EVENTS() \
492 TRACE_SYSCALLS() \ 492 TRACE_SYSCALLS() \
493 DEV_DISCARD(init.rodata) \ 493 DEV_DISCARD(init.rodata) \
diff --git a/include/keys/keyring-type.h b/include/keys/keyring-type.h
index 843f872a4b63..cf49159b0e3a 100644
--- a/include/keys/keyring-type.h
+++ b/include/keys/keyring-type.h
@@ -24,7 +24,7 @@ struct keyring_list {
24 unsigned short maxkeys; /* max keys this list can hold */ 24 unsigned short maxkeys; /* max keys this list can hold */
25 unsigned short nkeys; /* number of keys currently held */ 25 unsigned short nkeys; /* number of keys currently held */
26 unsigned short delkey; /* key to be unlinked by RCU */ 26 unsigned short delkey; /* key to be unlinked by RCU */
27 struct key *keys[0]; 27 struct key __rcu *keys[0];
28}; 28};
29 29
30 30
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index b738f2dc38d9..39737839ce29 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -167,7 +167,6 @@ header-y += if_arp.h
167header-y += if_bonding.h 167header-y += if_bonding.h
168header-y += if_bridge.h 168header-y += if_bridge.h
169header-y += if_cablemodem.h 169header-y += if_cablemodem.h
170header-y += if_ec.h
171header-y += if_eql.h 170header-y += if_eql.h
172header-y += if_ether.h 171header-y += if_ether.h
173header-y += if_fc.h 172header-y += if_fc.h
@@ -239,6 +238,7 @@ header-y += map_to_7segment.h
239header-y += matroxfb.h 238header-y += matroxfb.h
240header-y += mdio.h 239header-y += mdio.h
241header-y += media.h 240header-y += media.h
241header-y += mei.h
242header-y += mempolicy.h 242header-y += mempolicy.h
243header-y += meye.h 243header-y += meye.h
244header-y += mii.h 244header-y += mii.h
@@ -331,6 +331,7 @@ header-y += scc.h
331header-y += sched.h 331header-y += sched.h
332header-y += screen_info.h 332header-y += screen_info.h
333header-y += sdla.h 333header-y += sdla.h
334header-y += seccomp.h
334header-y += securebits.h 335header-y += securebits.h
335header-y += selinux_netlink.h 336header-y += selinux_netlink.h
336header-y += sem.h 337header-y += sem.h
@@ -380,6 +381,7 @@ header-y += unistd.h
380header-y += usbdevice_fs.h 381header-y += usbdevice_fs.h
381header-y += utime.h 382header-y += utime.h
382header-y += utsname.h 383header-y += utsname.h
384header-y += uuid.h
383header-y += uvcvideo.h 385header-y += uvcvideo.h
384header-y += v4l2-mediabus.h 386header-y += v4l2-mediabus.h
385header-y += v4l2-subdev.h 387header-y += v4l2-subdev.h
diff --git a/include/linux/alarmtimer.h b/include/linux/alarmtimer.h
index 975009e1cbe6..96c5c249b086 100644
--- a/include/linux/alarmtimer.h
+++ b/include/linux/alarmtimer.h
@@ -76,4 +76,7 @@ static inline int alarmtimer_callback_running(struct alarm *timer)
76} 76}
77 77
78 78
79/* Provide way to access the rtc device being used by alarmtimers */
80struct rtc_device *alarmtimer_get_rtcdev(void);
81
79#endif 82#endif
diff --git a/include/linux/amba/bus.h b/include/linux/amba/bus.h
index 8d54f79457ba..d36417158d8f 100644
--- a/include/linux/amba/bus.h
+++ b/include/linux/amba/bus.h
@@ -63,6 +63,14 @@ struct amba_device *amba_device_alloc(const char *, resource_size_t, size_t);
63void amba_device_put(struct amba_device *); 63void amba_device_put(struct amba_device *);
64int amba_device_add(struct amba_device *, struct resource *); 64int amba_device_add(struct amba_device *, struct resource *);
65int amba_device_register(struct amba_device *, struct resource *); 65int amba_device_register(struct amba_device *, struct resource *);
66struct amba_device *amba_apb_device_add(struct device *parent, const char *name,
67 resource_size_t base, size_t size,
68 int irq1, int irq2, void *pdata,
69 unsigned int periphid);
70struct amba_device *amba_ahb_device_add(struct device *parent, const char *name,
71 resource_size_t base, size_t size,
72 int irq1, int irq2, void *pdata,
73 unsigned int periphid);
66void amba_device_unregister(struct amba_device *); 74void amba_device_unregister(struct amba_device *);
67struct amba_device *amba_find_device(const char *, struct device *, unsigned int, unsigned int); 75struct amba_device *amba_find_device(const char *, struct device *, unsigned int, unsigned int);
68int amba_request_regions(struct amba_device *, const char *); 76int amba_request_regions(struct amba_device *, const char *);
diff --git a/include/linux/audit.h b/include/linux/audit.h
index ed3ef1972496..22f292a917a3 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -463,7 +463,7 @@ extern void audit_putname(const char *name);
463extern void __audit_inode(const char *name, const struct dentry *dentry); 463extern void __audit_inode(const char *name, const struct dentry *dentry);
464extern void __audit_inode_child(const struct dentry *dentry, 464extern void __audit_inode_child(const struct dentry *dentry,
465 const struct inode *parent); 465 const struct inode *parent);
466extern void __audit_seccomp(unsigned long syscall); 466extern void __audit_seccomp(unsigned long syscall, long signr, int code);
467extern void __audit_ptrace(struct task_struct *t); 467extern void __audit_ptrace(struct task_struct *t);
468 468
469static inline int audit_dummy_context(void) 469static inline int audit_dummy_context(void)
@@ -508,10 +508,10 @@ static inline void audit_inode_child(const struct dentry *dentry,
508} 508}
509void audit_core_dumps(long signr); 509void audit_core_dumps(long signr);
510 510
511static inline void audit_seccomp(unsigned long syscall) 511static inline void audit_seccomp(unsigned long syscall, long signr, int code)
512{ 512{
513 if (unlikely(!audit_dummy_context())) 513 if (unlikely(!audit_dummy_context()))
514 __audit_seccomp(syscall); 514 __audit_seccomp(syscall, signr, code);
515} 515}
516 516
517static inline void audit_ptrace(struct task_struct *t) 517static inline void audit_ptrace(struct task_struct *t)
@@ -634,7 +634,7 @@ extern int audit_signals;
634#define audit_inode(n,d) do { (void)(d); } while (0) 634#define audit_inode(n,d) do { (void)(d); } while (0)
635#define audit_inode_child(i,p) do { ; } while (0) 635#define audit_inode_child(i,p) do { ; } while (0)
636#define audit_core_dumps(i) do { ; } while (0) 636#define audit_core_dumps(i) do { ; } while (0)
637#define audit_seccomp(i) do { ; } while (0) 637#define audit_seccomp(i,s,c) do { ; } while (0)
638#define auditsc_get_stamp(c,t,s) (0) 638#define auditsc_get_stamp(c,t,s) (0)
639#define audit_get_loginuid(t) (-1) 639#define audit_get_loginuid(t) (-1)
640#define audit_get_sessionid(t) (-1) 640#define audit_get_sessionid(t) (-1)
diff --git a/include/linux/bcma/bcma.h b/include/linux/bcma/bcma.h
index 5af9a075498f..98bb2901d7b7 100644
--- a/include/linux/bcma/bcma.h
+++ b/include/linux/bcma/bcma.h
@@ -139,6 +139,7 @@ struct bcma_device {
139 u8 core_unit; 139 u8 core_unit;
140 140
141 u32 addr; 141 u32 addr;
142 u32 addr1;
142 u32 wrap; 143 u32 wrap;
143 144
144 void __iomem *io_addr; 145 void __iomem *io_addr;
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 2aa24664a5b5..4d4ac24a263e 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -1,9 +1,10 @@
1#ifndef _LINUX_BLKDEV_H 1#ifndef _LINUX_BLKDEV_H
2#define _LINUX_BLKDEV_H 2#define _LINUX_BLKDEV_H
3 3
4#include <linux/sched.h>
5
4#ifdef CONFIG_BLOCK 6#ifdef CONFIG_BLOCK
5 7
6#include <linux/sched.h>
7#include <linux/major.h> 8#include <linux/major.h>
8#include <linux/genhd.h> 9#include <linux/genhd.h>
9#include <linux/list.h> 10#include <linux/list.h>
diff --git a/include/linux/capability.h b/include/linux/capability.h
index 12d52dedb229..c398cff3dab7 100644
--- a/include/linux/capability.h
+++ b/include/linux/capability.h
@@ -360,8 +360,11 @@ struct cpu_vfs_cap_data {
360 360
361#define CAP_WAKE_ALARM 35 361#define CAP_WAKE_ALARM 35
362 362
363/* Allow preventing system suspends while epoll events are pending */
363 364
364#define CAP_LAST_CAP CAP_WAKE_ALARM 365#define CAP_EPOLLWAKEUP 36
366
367#define CAP_LAST_CAP CAP_EPOLLWAKEUP
365 368
366#define cap_valid(x) ((x) >= 0 && (x) <= CAP_LAST_CAP) 369#define cap_valid(x) ((x) >= 0 && (x) <= CAP_LAST_CAP)
367 370
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index 5a85b3415c1b..d3f5fba2c159 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -16,6 +16,7 @@
16#include <linux/prio_heap.h> 16#include <linux/prio_heap.h>
17#include <linux/rwsem.h> 17#include <linux/rwsem.h>
18#include <linux/idr.h> 18#include <linux/idr.h>
19#include <linux/workqueue.h>
19 20
20#ifdef CONFIG_CGROUPS 21#ifdef CONFIG_CGROUPS
21 22
@@ -76,12 +77,16 @@ struct cgroup_subsys_state {
76 unsigned long flags; 77 unsigned long flags;
77 /* ID for this css, if possible */ 78 /* ID for this css, if possible */
78 struct css_id __rcu *id; 79 struct css_id __rcu *id;
80
81 /* Used to put @cgroup->dentry on the last css_put() */
82 struct work_struct dput_work;
79}; 83};
80 84
81/* bits in struct cgroup_subsys_state flags field */ 85/* bits in struct cgroup_subsys_state flags field */
82enum { 86enum {
83 CSS_ROOT, /* This CSS is the root of the subsystem */ 87 CSS_ROOT, /* This CSS is the root of the subsystem */
84 CSS_REMOVED, /* This CSS is dead */ 88 CSS_REMOVED, /* This CSS is dead */
89 CSS_CLEAR_CSS_REFS, /* @ss->__DEPRECATED_clear_css_refs */
85}; 90};
86 91
87/* Caller must verify that the css is not for root cgroup */ 92/* Caller must verify that the css is not for root cgroup */
@@ -115,16 +120,12 @@ static inline bool css_is_removed(struct cgroup_subsys_state *css)
115 * the css has been destroyed. 120 * the css has been destroyed.
116 */ 121 */
117 122
123extern bool __css_tryget(struct cgroup_subsys_state *css);
118static inline bool css_tryget(struct cgroup_subsys_state *css) 124static inline bool css_tryget(struct cgroup_subsys_state *css)
119{ 125{
120 if (test_bit(CSS_ROOT, &css->flags)) 126 if (test_bit(CSS_ROOT, &css->flags))
121 return true; 127 return true;
122 while (!atomic_inc_not_zero(&css->refcnt)) { 128 return __css_tryget(css);
123 if (test_bit(CSS_REMOVED, &css->flags))
124 return false;
125 cpu_relax();
126 }
127 return true;
128} 129}
129 130
130/* 131/*
@@ -132,11 +133,11 @@ static inline bool css_tryget(struct cgroup_subsys_state *css)
132 * css_get() or css_tryget() 133 * css_get() or css_tryget()
133 */ 134 */
134 135
135extern void __css_put(struct cgroup_subsys_state *css, int count); 136extern void __css_put(struct cgroup_subsys_state *css);
136static inline void css_put(struct cgroup_subsys_state *css) 137static inline void css_put(struct cgroup_subsys_state *css)
137{ 138{
138 if (!test_bit(CSS_ROOT, &css->flags)) 139 if (!test_bit(CSS_ROOT, &css->flags))
139 __css_put(css, 1); 140 __css_put(css);
140} 141}
141 142
142/* bits in struct cgroup flags field */ 143/* bits in struct cgroup flags field */
@@ -175,6 +176,7 @@ struct cgroup {
175 */ 176 */
176 struct list_head sibling; /* my parent's children */ 177 struct list_head sibling; /* my parent's children */
177 struct list_head children; /* my children */ 178 struct list_head children; /* my children */
179 struct list_head files; /* my files */
178 180
179 struct cgroup *parent; /* my parent */ 181 struct cgroup *parent; /* my parent */
180 struct dentry __rcu *dentry; /* cgroup fs entry, RCU protected */ 182 struct dentry __rcu *dentry; /* cgroup fs entry, RCU protected */
@@ -191,6 +193,9 @@ struct cgroup {
191 */ 193 */
192 struct list_head css_sets; 194 struct list_head css_sets;
193 195
196 struct list_head allcg_node; /* cgroupfs_root->allcg_list */
197 struct list_head cft_q_node; /* used during cftype add/rm */
198
194 /* 199 /*
195 * Linked list running through all cgroups that can 200 * Linked list running through all cgroups that can
196 * potentially be reaped by the release agent. Protected by 201 * potentially be reaped by the release agent. Protected by
@@ -275,11 +280,17 @@ struct cgroup_map_cb {
275 * - the 'cftype' of the file is file->f_dentry->d_fsdata 280 * - the 'cftype' of the file is file->f_dentry->d_fsdata
276 */ 281 */
277 282
278#define MAX_CFTYPE_NAME 64 283/* cftype->flags */
284#define CFTYPE_ONLY_ON_ROOT (1U << 0) /* only create on root cg */
285#define CFTYPE_NOT_ON_ROOT (1U << 1) /* don't create onp root cg */
286
287#define MAX_CFTYPE_NAME 64
288
279struct cftype { 289struct cftype {
280 /* 290 /*
281 * By convention, the name should begin with the name of the 291 * By convention, the name should begin with the name of the
282 * subsystem, followed by a period 292 * subsystem, followed by a period. Zero length string indicates
293 * end of cftype array.
283 */ 294 */
284 char name[MAX_CFTYPE_NAME]; 295 char name[MAX_CFTYPE_NAME];
285 int private; 296 int private;
@@ -295,6 +306,9 @@ struct cftype {
295 */ 306 */
296 size_t max_write_len; 307 size_t max_write_len;
297 308
309 /* CFTYPE_* flags */
310 unsigned int flags;
311
298 int (*open)(struct inode *inode, struct file *file); 312 int (*open)(struct inode *inode, struct file *file);
299 ssize_t (*read)(struct cgroup *cgrp, struct cftype *cft, 313 ssize_t (*read)(struct cgroup *cgrp, struct cftype *cft,
300 struct file *file, 314 struct file *file,
@@ -373,6 +387,16 @@ struct cftype {
373 struct eventfd_ctx *eventfd); 387 struct eventfd_ctx *eventfd);
374}; 388};
375 389
390/*
391 * cftype_sets describe cftypes belonging to a subsystem and are chained at
392 * cgroup_subsys->cftsets. Each cftset points to an array of cftypes
393 * terminated by zero length name.
394 */
395struct cftype_set {
396 struct list_head node; /* chained at subsys->cftsets */
397 const struct cftype *cfts;
398};
399
376struct cgroup_scanner { 400struct cgroup_scanner {
377 struct cgroup *cg; 401 struct cgroup *cg;
378 int (*test_task)(struct task_struct *p, struct cgroup_scanner *scan); 402 int (*test_task)(struct task_struct *p, struct cgroup_scanner *scan);
@@ -382,21 +406,8 @@ struct cgroup_scanner {
382 void *data; 406 void *data;
383}; 407};
384 408
385/* 409int cgroup_add_cftypes(struct cgroup_subsys *ss, const struct cftype *cfts);
386 * Add a new file to the given cgroup directory. Should only be 410int cgroup_rm_cftypes(struct cgroup_subsys *ss, const struct cftype *cfts);
387 * called by subsystems from within a populate() method
388 */
389int cgroup_add_file(struct cgroup *cgrp, struct cgroup_subsys *subsys,
390 const struct cftype *cft);
391
392/*
393 * Add a set of new files to the given cgroup directory. Should
394 * only be called by subsystems from within a populate() method
395 */
396int cgroup_add_files(struct cgroup *cgrp,
397 struct cgroup_subsys *subsys,
398 const struct cftype cft[],
399 int count);
400 411
401int cgroup_is_removed(const struct cgroup *cgrp); 412int cgroup_is_removed(const struct cgroup *cgrp);
402 413
@@ -461,7 +472,6 @@ struct cgroup_subsys {
461 void (*fork)(struct task_struct *task); 472 void (*fork)(struct task_struct *task);
462 void (*exit)(struct cgroup *cgrp, struct cgroup *old_cgrp, 473 void (*exit)(struct cgroup *cgrp, struct cgroup *old_cgrp,
463 struct task_struct *task); 474 struct task_struct *task);
464 int (*populate)(struct cgroup_subsys *ss, struct cgroup *cgrp);
465 void (*post_clone)(struct cgroup *cgrp); 475 void (*post_clone)(struct cgroup *cgrp);
466 void (*bind)(struct cgroup *root); 476 void (*bind)(struct cgroup *root);
467 477
@@ -474,6 +484,18 @@ struct cgroup_subsys {
474 * (not available in early_init time.) 484 * (not available in early_init time.)
475 */ 485 */
476 bool use_id; 486 bool use_id;
487
488 /*
489 * If %true, cgroup removal will try to clear css refs by retrying
490 * ss->pre_destroy() until there's no css ref left. This behavior
491 * is strictly for backward compatibility and will be removed as
492 * soon as the current user (memcg) is updated.
493 *
494 * If %false, ss->pre_destroy() can't fail and cgroup removal won't
495 * wait for css refs to drop to zero before proceeding.
496 */
497 bool __DEPRECATED_clear_css_refs;
498
477#define MAX_CGROUP_TYPE_NAMELEN 32 499#define MAX_CGROUP_TYPE_NAMELEN 32
478 const char *name; 500 const char *name;
479 501
@@ -500,6 +522,13 @@ struct cgroup_subsys {
500 struct idr idr; 522 struct idr idr;
501 spinlock_t id_lock; 523 spinlock_t id_lock;
502 524
525 /* list of cftype_sets */
526 struct list_head cftsets;
527
528 /* base cftypes, automatically [de]registered with subsys itself */
529 struct cftype *base_cftypes;
530 struct cftype_set base_cftset;
531
503 /* should be defined only by modular subsystems */ 532 /* should be defined only by modular subsystems */
504 struct module *module; 533 struct module *module;
505}; 534};
diff --git a/include/linux/clk.h b/include/linux/clk.h
index b0252726df61..70cf722ac3af 100644
--- a/include/linux/clk.h
+++ b/include/linux/clk.h
@@ -101,6 +101,26 @@ int clk_notifier_unregister(struct clk *clk, struct notifier_block *nb);
101struct clk *clk_get(struct device *dev, const char *id); 101struct clk *clk_get(struct device *dev, const char *id);
102 102
103/** 103/**
104 * devm_clk_get - lookup and obtain a managed reference to a clock producer.
105 * @dev: device for clock "consumer"
106 * @id: clock comsumer ID
107 *
108 * Returns a struct clk corresponding to the clock producer, or
109 * valid IS_ERR() condition containing errno. The implementation
110 * uses @dev and @id to determine the clock consumer, and thereby
111 * the clock producer. (IOW, @id may be identical strings, but
112 * clk_get may return different clock producers depending on @dev.)
113 *
114 * Drivers must assume that the clock source is not enabled.
115 *
116 * devm_clk_get should not be called from within interrupt context.
117 *
118 * The clock will automatically be freed when the device is unbound
119 * from the bus.
120 */
121struct clk *devm_clk_get(struct device *dev, const char *id);
122
123/**
104 * clk_prepare - prepare a clock source 124 * clk_prepare - prepare a clock source
105 * @clk: clock source 125 * @clk: clock source
106 * 126 *
@@ -206,6 +226,18 @@ unsigned long clk_get_rate(struct clk *clk);
206 */ 226 */
207void clk_put(struct clk *clk); 227void clk_put(struct clk *clk);
208 228
229/**
230 * devm_clk_put - "free" a managed clock source
231 * @dev: device used to acuqire the clock
232 * @clk: clock source acquired with devm_clk_get()
233 *
234 * Note: drivers must ensure that all clk_enable calls made on this
235 * clock source are balanced by clk_disable calls prior to calling
236 * this function.
237 *
238 * clk_put should not be called from within interrupt context.
239 */
240void devm_clk_put(struct device *dev, struct clk *clk);
209 241
210/* 242/*
211 * The remaining APIs are optional for machine class support. 243 * The remaining APIs are optional for machine class support.
diff --git a/include/linux/clkdev.h b/include/linux/clkdev.h
index d9a4fd028c9d..a6a6f603103b 100644
--- a/include/linux/clkdev.h
+++ b/include/linux/clkdev.h
@@ -40,4 +40,7 @@ void clkdev_drop(struct clk_lookup *cl);
40void clkdev_add_table(struct clk_lookup *, size_t); 40void clkdev_add_table(struct clk_lookup *, size_t);
41int clk_add_alias(const char *, const char *, char *, struct device *); 41int clk_add_alias(const char *, const char *, char *, struct device *);
42 42
43int clk_register_clkdev(struct clk *, const char *, const char *, ...);
44int clk_register_clkdevs(struct clk *, struct clk_lookup *, size_t);
45
43#endif 46#endif
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index ee28844ae68e..7230bb59a06f 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -36,8 +36,6 @@ extern void cpu_remove_dev_attr(struct device_attribute *attr);
36extern int cpu_add_dev_attr_group(struct attribute_group *attrs); 36extern int cpu_add_dev_attr_group(struct attribute_group *attrs);
37extern void cpu_remove_dev_attr_group(struct attribute_group *attrs); 37extern void cpu_remove_dev_attr_group(struct attribute_group *attrs);
38 38
39extern int sched_create_sysfs_power_savings_entries(struct device *dev);
40
41#ifdef CONFIG_HOTPLUG_CPU 39#ifdef CONFIG_HOTPLUG_CPU
42extern void unregister_cpu(struct cpu *cpu); 40extern void unregister_cpu(struct cpu *cpu);
43extern ssize_t arch_cpu_probe(const char *, size_t); 41extern ssize_t arch_cpu_probe(const char *, size_t);
diff --git a/include/linux/cs5535.h b/include/linux/cs5535.h
index c077aec3a6ff..cfe83239d7f0 100644
--- a/include/linux/cs5535.h
+++ b/include/linux/cs5535.h
@@ -95,6 +95,7 @@ static inline int cs5535_pic_unreqz_select_high(unsigned int group,
95 95
96/* CS5536_PM1_STS bits */ 96/* CS5536_PM1_STS bits */
97#define CS5536_WAK_FLAG (1 << 15) 97#define CS5536_WAK_FLAG (1 << 15)
98#define CS5536_RTC_FLAG (1 << 10)
98#define CS5536_PWRBTN_FLAG (1 << 8) 99#define CS5536_PWRBTN_FLAG (1 << 8)
99 100
100/* CS5536_PM1_EN bits */ 101/* CS5536_PM1_EN bits */
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index 7e11f1418203..094789ff3e9f 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -25,6 +25,13 @@ struct vfsmount;
25 25
26#define IS_ROOT(x) ((x) == (x)->d_parent) 26#define IS_ROOT(x) ((x) == (x)->d_parent)
27 27
28/* The hash is always the low bits of hash_len */
29#ifdef __LITTLE_ENDIAN
30 #define HASH_LEN_DECLARE u32 hash; u32 len;
31#else
32 #define HASH_LEN_DECLARE u32 len; u32 hash;
33#endif
34
28/* 35/*
29 * "quick string" -- eases parameter passing, but more importantly 36 * "quick string" -- eases parameter passing, but more importantly
30 * saves "metadata" about the string (ie length and the hash). 37 * saves "metadata" about the string (ie length and the hash).
@@ -33,11 +40,19 @@ struct vfsmount;
33 * dentry. 40 * dentry.
34 */ 41 */
35struct qstr { 42struct qstr {
36 unsigned int hash; 43 union {
37 unsigned int len; 44 struct {
45 HASH_LEN_DECLARE;
46 };
47 u64 hash_len;
48 };
38 const unsigned char *name; 49 const unsigned char *name;
39}; 50};
40 51
52#define QSTR_INIT(n,l) { { { .len = l } }, .name = n }
53#define hashlen_hash(hashlen) ((u32) (hashlen))
54#define hashlen_len(hashlen) ((u32)((hashlen) >> 32))
55
41struct dentry_stat_t { 56struct dentry_stat_t {
42 int nr_dentry; 57 int nr_dentry;
43 int nr_unused; 58 int nr_unused;
@@ -282,7 +297,7 @@ extern struct dentry *d_hash_and_lookup(struct dentry *, struct qstr *);
282extern struct dentry *__d_lookup(struct dentry *, struct qstr *); 297extern struct dentry *__d_lookup(struct dentry *, struct qstr *);
283extern struct dentry *__d_lookup_rcu(const struct dentry *parent, 298extern struct dentry *__d_lookup_rcu(const struct dentry *parent,
284 const struct qstr *name, 299 const struct qstr *name,
285 unsigned *seq, struct inode **inode); 300 unsigned *seq, struct inode *inode);
286 301
287/** 302/**
288 * __d_rcu_to_refcount - take a refcount on dentry if sequence check is ok 303 * __d_rcu_to_refcount - take a refcount on dentry if sequence check is ok
diff --git a/include/linux/device.h b/include/linux/device.h
index 5ad17cccdd71..e04f5776f6d0 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -23,6 +23,7 @@
23#include <linux/mutex.h> 23#include <linux/mutex.h>
24#include <linux/pm.h> 24#include <linux/pm.h>
25#include <linux/atomic.h> 25#include <linux/atomic.h>
26#include <linux/ratelimit.h>
26#include <asm/device.h> 27#include <asm/device.h>
27 28
28struct device; 29struct device;
@@ -502,7 +503,10 @@ ssize_t device_store_int(struct device *dev, struct device_attribute *attr,
502 { __ATTR(_name, _mode, device_show_ulong, device_store_ulong), &(_var) } 503 { __ATTR(_name, _mode, device_show_ulong, device_store_ulong), &(_var) }
503#define DEVICE_INT_ATTR(_name, _mode, _var) \ 504#define DEVICE_INT_ATTR(_name, _mode, _var) \
504 struct dev_ext_attribute dev_attr_##_name = \ 505 struct dev_ext_attribute dev_attr_##_name = \
505 { __ATTR(_name, _mode, device_show_ulong, device_store_ulong), &(_var) } 506 { __ATTR(_name, _mode, device_show_int, device_store_int), &(_var) }
507#define DEVICE_ATTR_IGNORE_LOCKDEP(_name, _mode, _show, _store) \
508 struct device_attribute dev_attr_##_name = \
509 __ATTR_IGNORE_LOCKDEP(_name, _mode, _show, _store)
506 510
507extern int device_create_file(struct device *device, 511extern int device_create_file(struct device *device,
508 const struct device_attribute *entry); 512 const struct device_attribute *entry);
@@ -541,6 +545,8 @@ extern void *devres_remove(struct device *dev, dr_release_t release,
541 dr_match_t match, void *match_data); 545 dr_match_t match, void *match_data);
542extern int devres_destroy(struct device *dev, dr_release_t release, 546extern int devres_destroy(struct device *dev, dr_release_t release,
543 dr_match_t match, void *match_data); 547 dr_match_t match, void *match_data);
548extern int devres_release(struct device *dev, dr_release_t release,
549 dr_match_t match, void *match_data);
544 550
545/* devres group */ 551/* devres group */
546extern void * __must_check devres_open_group(struct device *dev, void *id, 552extern void * __must_check devres_open_group(struct device *dev, void *id,
@@ -931,6 +937,32 @@ int _dev_info(const struct device *dev, const char *fmt, ...)
931 937
932#endif 938#endif
933 939
940#define dev_level_ratelimited(dev_level, dev, fmt, ...) \
941do { \
942 static DEFINE_RATELIMIT_STATE(_rs, \
943 DEFAULT_RATELIMIT_INTERVAL, \
944 DEFAULT_RATELIMIT_BURST); \
945 if (__ratelimit(&_rs)) \
946 dev_level(dev, fmt, ##__VA_ARGS__); \
947} while (0)
948
949#define dev_emerg_ratelimited(dev, fmt, ...) \
950 dev_level_ratelimited(dev_emerg, dev, fmt, ##__VA_ARGS__)
951#define dev_alert_ratelimited(dev, fmt, ...) \
952 dev_level_ratelimited(dev_alert, dev, fmt, ##__VA_ARGS__)
953#define dev_crit_ratelimited(dev, fmt, ...) \
954 dev_level_ratelimited(dev_crit, dev, fmt, ##__VA_ARGS__)
955#define dev_err_ratelimited(dev, fmt, ...) \
956 dev_level_ratelimited(dev_err, dev, fmt, ##__VA_ARGS__)
957#define dev_warn_ratelimited(dev, fmt, ...) \
958 dev_level_ratelimited(dev_warn, dev, fmt, ##__VA_ARGS__)
959#define dev_notice_ratelimited(dev, fmt, ...) \
960 dev_level_ratelimited(dev_notice, dev, fmt, ##__VA_ARGS__)
961#define dev_info_ratelimited(dev, fmt, ...) \
962 dev_level_ratelimited(dev_info, dev, fmt, ##__VA_ARGS__)
963#define dev_dbg_ratelimited(dev, fmt, ...) \
964 dev_level_ratelimited(dev_dbg, dev, fmt, ##__VA_ARGS__)
965
934/* 966/*
935 * Stupid hackaround for existing uses of non-printk uses dev_info 967 * Stupid hackaround for existing uses of non-printk uses dev_info
936 * 968 *
diff --git a/include/linux/dlm.h b/include/linux/dlm.h
index 6c7f6e9546c7..520152411cd1 100644
--- a/include/linux/dlm.h
+++ b/include/linux/dlm.h
@@ -67,7 +67,6 @@ struct dlm_lksb {
67 67
68/* dlm_new_lockspace() flags */ 68/* dlm_new_lockspace() flags */
69 69
70#define DLM_LSFL_NODIR 0x00000001
71#define DLM_LSFL_TIMEWARN 0x00000002 70#define DLM_LSFL_TIMEWARN 0x00000002
72#define DLM_LSFL_FS 0x00000004 71#define DLM_LSFL_FS 0x00000004
73#define DLM_LSFL_NEWEXCL 0x00000008 72#define DLM_LSFL_NEWEXCL 0x00000008
diff --git a/include/linux/dmar.h b/include/linux/dmar.h
index 731a60975101..b029d1aa2d12 100644
--- a/include/linux/dmar.h
+++ b/include/linux/dmar.h
@@ -114,91 +114,6 @@ struct irte {
114 }; 114 };
115}; 115};
116 116
117#ifdef CONFIG_IRQ_REMAP
118extern int intr_remapping_enabled;
119extern int intr_remapping_supported(void);
120extern int enable_intr_remapping(void);
121extern void disable_intr_remapping(void);
122extern int reenable_intr_remapping(int);
123
124extern int get_irte(int irq, struct irte *entry);
125extern int modify_irte(int irq, struct irte *irte_modified);
126extern int alloc_irte(struct intel_iommu *iommu, int irq, u16 count);
127extern int set_irte_irq(int irq, struct intel_iommu *iommu, u16 index,
128 u16 sub_handle);
129extern int map_irq_to_irte_handle(int irq, u16 *sub_handle);
130extern int free_irte(int irq);
131
132extern struct intel_iommu *map_dev_to_ir(struct pci_dev *dev);
133extern struct intel_iommu *map_ioapic_to_ir(int apic);
134extern struct intel_iommu *map_hpet_to_ir(u8 id);
135extern int set_ioapic_sid(struct irte *irte, int apic);
136extern int set_hpet_sid(struct irte *irte, u8 id);
137extern int set_msi_sid(struct irte *irte, struct pci_dev *dev);
138#else
139static inline int alloc_irte(struct intel_iommu *iommu, int irq, u16 count)
140{
141 return -1;
142}
143static inline int modify_irte(int irq, struct irte *irte_modified)
144{
145 return -1;
146}
147static inline int free_irte(int irq)
148{
149 return -1;
150}
151static inline int map_irq_to_irte_handle(int irq, u16 *sub_handle)
152{
153 return -1;
154}
155static inline int set_irte_irq(int irq, struct intel_iommu *iommu, u16 index,
156 u16 sub_handle)
157{
158 return -1;
159}
160static inline struct intel_iommu *map_dev_to_ir(struct pci_dev *dev)
161{
162 return NULL;
163}
164static inline struct intel_iommu *map_ioapic_to_ir(int apic)
165{
166 return NULL;
167}
168static inline struct intel_iommu *map_hpet_to_ir(unsigned int hpet_id)
169{
170 return NULL;
171}
172static inline int set_ioapic_sid(struct irte *irte, int apic)
173{
174 return 0;
175}
176static inline int set_hpet_sid(struct irte *irte, u8 id)
177{
178 return -1;
179}
180static inline int set_msi_sid(struct irte *irte, struct pci_dev *dev)
181{
182 return 0;
183}
184
185#define intr_remapping_enabled (0)
186
187static inline int enable_intr_remapping(void)
188{
189 return -1;
190}
191
192static inline void disable_intr_remapping(void)
193{
194}
195
196static inline int reenable_intr_remapping(int eim)
197{
198 return 0;
199}
200#endif
201
202enum { 117enum {
203 IRQ_REMAP_XAPIC_MODE, 118 IRQ_REMAP_XAPIC_MODE,
204 IRQ_REMAP_X2APIC_MODE, 119 IRQ_REMAP_X2APIC_MODE,
diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h
index 7e3c53a900d8..c18257b0fa72 100644
--- a/include/linux/dynamic_debug.h
+++ b/include/linux/dynamic_debug.h
@@ -17,8 +17,8 @@ struct _ddebug {
17 const char *format; 17 const char *format;
18 unsigned int lineno:18; 18 unsigned int lineno:18;
19 /* 19 /*
20 * The flags field controls the behaviour at the callsite. 20 * The flags field controls the behaviour at the callsite.
21 * The bits here are changed dynamically when the user 21 * The bits here are changed dynamically when the user
22 * writes commands to <debugfs>/dynamic_debug/control 22 * writes commands to <debugfs>/dynamic_debug/control
23 */ 23 */
24#define _DPRINTK_FLAGS_NONE 0 24#define _DPRINTK_FLAGS_NONE 0
@@ -44,6 +44,9 @@ extern int ddebug_remove_module(const char *mod_name);
44extern __printf(2, 3) 44extern __printf(2, 3)
45int __dynamic_pr_debug(struct _ddebug *descriptor, const char *fmt, ...); 45int __dynamic_pr_debug(struct _ddebug *descriptor, const char *fmt, ...);
46 46
47extern int ddebug_dyndbg_module_param_cb(char *param, char *val,
48 const char *modname);
49
47struct device; 50struct device;
48 51
49extern __printf(3, 4) 52extern __printf(3, 4)
@@ -94,11 +97,26 @@ do { \
94 97
95#else 98#else
96 99
100#include <linux/string.h>
101#include <linux/errno.h>
102
97static inline int ddebug_remove_module(const char *mod) 103static inline int ddebug_remove_module(const char *mod)
98{ 104{
99 return 0; 105 return 0;
100} 106}
101 107
108static inline int ddebug_dyndbg_module_param_cb(char *param, char *val,
109 const char *modname)
110{
111 if (strstr(param, "dyndbg")) {
112 /* avoid pr_warn(), which wants pr_fmt() fully defined */
113 printk(KERN_WARNING "dyndbg param is supported only in "
114 "CONFIG_DYNAMIC_DEBUG builds\n");
115 return 0; /* allow and ignore */
116 }
117 return -EINVAL;
118}
119
102#define dynamic_pr_debug(fmt, ...) \ 120#define dynamic_pr_debug(fmt, ...) \
103 do { if (0) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); } while (0) 121 do { if (0) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); } while (0)
104#define dynamic_dev_dbg(dev, fmt, ...) \ 122#define dynamic_dev_dbg(dev, fmt, ...) \
diff --git a/include/linux/eventpoll.h b/include/linux/eventpoll.h
index 657ab55beda0..6f8be328770a 100644
--- a/include/linux/eventpoll.h
+++ b/include/linux/eventpoll.h
@@ -26,6 +26,18 @@
26#define EPOLL_CTL_DEL 2 26#define EPOLL_CTL_DEL 2
27#define EPOLL_CTL_MOD 3 27#define EPOLL_CTL_MOD 3
28 28
29/*
30 * Request the handling of system wakeup events so as to prevent system suspends
31 * from happening while those events are being processed.
32 *
33 * Assuming neither EPOLLET nor EPOLLONESHOT is set, system suspends will not be
34 * re-allowed until epoll_wait is called again after consuming the wakeup
35 * event(s).
36 *
37 * Requires CAP_EPOLLWAKEUP
38 */
39#define EPOLLWAKEUP (1 << 29)
40
29/* Set the One Shot behaviour for the target file descriptor */ 41/* Set the One Shot behaviour for the target file descriptor */
30#define EPOLLONESHOT (1 << 30) 42#define EPOLLONESHOT (1 << 30)
31 43
diff --git a/include/linux/extcon.h b/include/linux/extcon.h
new file mode 100644
index 000000000000..cdd401477656
--- /dev/null
+++ b/include/linux/extcon.h
@@ -0,0 +1,324 @@
1/*
2 * External connector (extcon) class driver
3 *
4 * Copyright (C) 2012 Samsung Electronics
5 * Author: Donggeun Kim <dg77.kim@samsung.com>
6 * Author: MyungJoo Ham <myungjoo.ham@samsung.com>
7 *
8 * based on switch class driver
9 * Copyright (C) 2008 Google, Inc.
10 * Author: Mike Lockwood <lockwood@android.com>
11 *
12 * This software is licensed under the terms of the GNU General Public
13 * License version 2, as published by the Free Software Foundation, and
14 * may be copied, distributed, and modified under those terms.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21*/
22
23#ifndef __LINUX_EXTCON_H__
24#define __LINUX_EXTCON_H__
25
26#include <linux/notifier.h>
27
28#define SUPPORTED_CABLE_MAX 32
29#define CABLE_NAME_MAX 30
30
31/*
32 * The standard cable name is to help support general notifier
33 * and notifee device drivers to share the common names.
34 * Please use standard cable names unless your notifier device has
35 * a very unique and abnormal cable or
36 * the cable type is supposed to be used with only one unique
37 * pair of notifier/notifee devices.
38 *
39 * Please add any other "standard" cables used with extcon dev.
40 *
41 * You may add a dot and number to specify version or specification
42 * of the specific cable if it is required. (e.g., "Fast-charger.18"
43 * and "Fast-charger.10" for 1.8A and 1.0A chargers)
44 * However, the notifee and notifier should be able to handle such
45 * string and if the notifee can negotiate the protocol or idenify,
46 * you don't need such convention. This convention is helpful when
47 * notifier can distinguish but notifiee cannot.
48 */
49enum extcon_cable_name {
50 EXTCON_USB = 0,
51 EXTCON_USB_HOST,
52 EXTCON_TA, /* Travel Adaptor */
53 EXTCON_FAST_CHARGER,
54 EXTCON_SLOW_CHARGER,
55 EXTCON_CHARGE_DOWNSTREAM, /* Charging an external device */
56 EXTCON_HDMI,
57 EXTCON_MHL,
58 EXTCON_DVI,
59 EXTCON_VGA,
60 EXTCON_DOCK,
61 EXTCON_LINE_IN,
62 EXTCON_LINE_OUT,
63 EXTCON_MIC_IN,
64 EXTCON_HEADPHONE_OUT,
65 EXTCON_SPDIF_IN,
66 EXTCON_SPDIF_OUT,
67 EXTCON_VIDEO_IN,
68 EXTCON_VIDEO_OUT,
69 EXTCON_MECHANICAL,
70};
71extern const char *extcon_cable_name[];
72
73struct extcon_cable;
74
75/**
76 * struct extcon_dev - An extcon device represents one external connector.
77 * @name The name of this extcon device. Parent device name is used
78 * if NULL.
79 * @supported_cable Array of supported cable name ending with NULL.
80 * If supported_cable is NULL, cable name related APIs
81 * are disabled.
82 * @mutually_exclusive Array of mutually exclusive set of cables that cannot
83 * be attached simultaneously. The array should be
84 * ending with NULL or be NULL (no mutually exclusive
85 * cables). For example, if it is { 0x7, 0x30, 0}, then,
86 * {0, 1}, {0, 1, 2}, {0, 2}, {1, 2}, or {4, 5} cannot
87 * be attached simulataneously. {0x7, 0} is equivalent to
88 * {0x3, 0x6, 0x5, 0}. If it is {0xFFFFFFFF, 0}, there
89 * can be no simultaneous connections.
90 * @print_name An optional callback to override the method to print the
91 * name of the extcon device.
92 * @print_state An optional callback to override the method to print the
93 * status of the extcon device.
94 * @dev Device of this extcon. Do not provide at register-time.
95 * @state Attach/detach state of this extcon. Do not provide at
96 * register-time
97 * @nh Notifier for the state change events from this extcon
98 * @entry To support list of extcon devices so that uses can search
99 * for extcon devices based on the extcon name.
100 * @lock
101 * @max_supported Internal value to store the number of cables.
102 * @extcon_dev_type Device_type struct to provide attribute_groups
103 * customized for each extcon device.
104 * @cables Sysfs subdirectories. Each represents one cable.
105 *
106 * In most cases, users only need to provide "User initializing data" of
107 * this struct when registering an extcon. In some exceptional cases,
108 * optional callbacks may be needed. However, the values in "internal data"
109 * are overwritten by register function.
110 */
111struct extcon_dev {
112 /* --- Optional user initializing data --- */
113 const char *name;
114 const char **supported_cable;
115 const u32 *mutually_exclusive;
116
117 /* --- Optional callbacks to override class functions --- */
118 ssize_t (*print_name)(struct extcon_dev *edev, char *buf);
119 ssize_t (*print_state)(struct extcon_dev *edev, char *buf);
120
121 /* --- Internal data. Please do not set. --- */
122 struct device *dev;
123 u32 state;
124 struct raw_notifier_head nh;
125 struct list_head entry;
126 spinlock_t lock; /* could be called by irq handler */
127 int max_supported;
128
129 /* /sys/class/extcon/.../cable.n/... */
130 struct device_type extcon_dev_type;
131 struct extcon_cable *cables;
132 /* /sys/class/extcon/.../mutually_exclusive/... */
133 struct attribute_group attr_g_muex;
134 struct attribute **attrs_muex;
135 struct device_attribute *d_attrs_muex;
136};
137
138/**
139 * struct extcon_cable - An internal data for each cable of extcon device.
140 * @edev The extcon device
141 * @cable_index Index of this cable in the edev
142 * @attr_g Attribute group for the cable
143 * @attr_name "name" sysfs entry
144 * @attr_state "state" sysfs entry
145 * @attrs Array pointing to attr_name and attr_state for attr_g
146 */
147struct extcon_cable {
148 struct extcon_dev *edev;
149 int cable_index;
150
151 struct attribute_group attr_g;
152 struct device_attribute attr_name;
153 struct device_attribute attr_state;
154
155 struct attribute *attrs[3]; /* to be fed to attr_g.attrs */
156};
157
158/**
159 * struct extcon_specific_cable_nb - An internal data for
160 * extcon_register_interest().
161 * @internal_nb a notifier block bridging extcon notifier and cable notifier.
162 * @user_nb user provided notifier block for events from a specific cable.
163 * @cable_index the target cable.
164 * @edev the target extcon device.
165 * @previous_value the saved previous event value.
166 */
167struct extcon_specific_cable_nb {
168 struct notifier_block internal_nb;
169 struct notifier_block *user_nb;
170 int cable_index;
171 struct extcon_dev *edev;
172 unsigned long previous_value;
173};
174
175#if IS_ENABLED(CONFIG_EXTCON)
176
177/*
178 * Following APIs are for notifiers or configurations.
179 * Notifiers are the external port and connection devices.
180 */
181extern int extcon_dev_register(struct extcon_dev *edev, struct device *dev);
182extern void extcon_dev_unregister(struct extcon_dev *edev);
183extern struct extcon_dev *extcon_get_extcon_dev(const char *extcon_name);
184
185/*
186 * get/set/update_state access the 32b encoded state value, which represents
187 * states of all possible cables of the multistate port. For example, if one
188 * calls extcon_set_state(edev, 0x7), it may mean that all the three cables
189 * are attached to the port.
190 */
191static inline u32 extcon_get_state(struct extcon_dev *edev)
192{
193 return edev->state;
194}
195
196extern int extcon_set_state(struct extcon_dev *edev, u32 state);
197extern int extcon_update_state(struct extcon_dev *edev, u32 mask, u32 state);
198
199/*
200 * get/set_cable_state access each bit of the 32b encoded state value.
201 * They are used to access the status of each cable based on the cable_name
202 * or cable_index, which is retrived by extcon_find_cable_index
203 */
204extern int extcon_find_cable_index(struct extcon_dev *sdev,
205 const char *cable_name);
206extern int extcon_get_cable_state_(struct extcon_dev *edev, int cable_index);
207extern int extcon_set_cable_state_(struct extcon_dev *edev, int cable_index,
208 bool cable_state);
209
210extern int extcon_get_cable_state(struct extcon_dev *edev,
211 const char *cable_name);
212extern int extcon_set_cable_state(struct extcon_dev *edev,
213 const char *cable_name, bool cable_state);
214
215/*
216 * Following APIs are for notifiees (those who want to be notified)
217 * to register a callback for events from a specific cable of the extcon.
218 * Notifiees are the connected device drivers wanting to get notified by
219 * a specific external port of a connection device.
220 */
221extern int extcon_register_interest(struct extcon_specific_cable_nb *obj,
222 const char *extcon_name,
223 const char *cable_name,
224 struct notifier_block *nb);
225extern int extcon_unregister_interest(struct extcon_specific_cable_nb *nb);
226
227/*
228 * Following APIs are to monitor every action of a notifier.
229 * Registerer gets notified for every external port of a connection device.
230 * Probably this could be used to debug an action of notifier; however,
231 * we do not recommend to use this at normal 'notifiee' device drivers who
232 * want to be notified by a specific external port of the notifier.
233 */
234extern int extcon_register_notifier(struct extcon_dev *edev,
235 struct notifier_block *nb);
236extern int extcon_unregister_notifier(struct extcon_dev *edev,
237 struct notifier_block *nb);
238#else /* CONFIG_EXTCON */
239static inline int extcon_dev_register(struct extcon_dev *edev,
240 struct device *dev)
241{
242 return 0;
243}
244
245static inline void extcon_dev_unregister(struct extcon_dev *edev) { }
246
247static inline u32 extcon_get_state(struct extcon_dev *edev)
248{
249 return 0;
250}
251
252static inline int extcon_set_state(struct extcon_dev *edev, u32 state)
253{
254 return 0;
255}
256
257static inline int extcon_update_state(struct extcon_dev *edev, u32 mask,
258 u32 state)
259{
260 return 0;
261}
262
263static inline int extcon_find_cable_index(struct extcon_dev *edev,
264 const char *cable_name)
265{
266 return 0;
267}
268
269static inline int extcon_get_cable_state_(struct extcon_dev *edev,
270 int cable_index)
271{
272 return 0;
273}
274
275static inline int extcon_set_cable_state_(struct extcon_dev *edev,
276 int cable_index, bool cable_state)
277{
278 return 0;
279}
280
281static inline int extcon_get_cable_state(struct extcon_dev *edev,
282 const char *cable_name)
283{
284 return 0;
285}
286
287static inline int extcon_set_cable_state(struct extcon_dev *edev,
288 const char *cable_name, int state)
289{
290 return 0;
291}
292
293static inline struct extcon_dev *extcon_get_extcon_dev(const char *extcon_name)
294{
295 return NULL;
296}
297
298static inline int extcon_register_notifier(struct extcon_dev *edev,
299 struct notifier_block *nb)
300{
301 return 0;
302}
303
304static inline int extcon_unregister_notifier(struct extcon_dev *edev,
305 struct notifier_block *nb)
306{
307 return 0;
308}
309
310static inline int extcon_register_interest(struct extcon_specific_cable_nb *obj,
311 const char *extcon_name,
312 const char *cable_name,
313 struct notifier_block *nb)
314{
315 return 0;
316}
317
318static inline int extcon_unregister_interest(struct extcon_specific_cable_nb
319 *obj)
320{
321 return 0;
322}
323#endif /* CONFIG_EXTCON */
324#endif /* __LINUX_EXTCON_H__ */
diff --git a/include/linux/extcon/extcon_gpio.h b/include/linux/extcon/extcon_gpio.h
new file mode 100644
index 000000000000..a2129b73dcb1
--- /dev/null
+++ b/include/linux/extcon/extcon_gpio.h
@@ -0,0 +1,52 @@
1/*
2 * External connector (extcon) class generic GPIO driver
3 *
4 * Copyright (C) 2012 Samsung Electronics
5 * Author: MyungJoo Ham <myungjoo.ham@samsung.com>
6 *
7 * based on switch class driver
8 * Copyright (C) 2008 Google, Inc.
9 * Author: Mike Lockwood <lockwood@android.com>
10 *
11 * This software is licensed under the terms of the GNU General Public
12 * License version 2, as published by the Free Software Foundation, and
13 * may be copied, distributed, and modified under those terms.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20*/
21#ifndef __EXTCON_GPIO_H__
22#define __EXTCON_GPIO_H__ __FILE__
23
24#include <linux/extcon.h>
25
26/**
27 * struct gpio_extcon_platform_data - A simple GPIO-controlled extcon device.
28 * @name The name of this GPIO extcon device.
29 * @gpio Corresponding GPIO.
30 * @debounce Debounce time for GPIO IRQ in ms.
31 * @irq_flags IRQ Flags (e.g., IRQF_TRIGGER_LOW).
32 * @state_on print_state is overriden with state_on if attached. If Null,
33 * default method of extcon class is used.
34 * @state_off print_state is overriden with state_on if dettached. If Null,
35 * default method of extcon class is used.
36 *
37 * Note that in order for state_on or state_off to be valid, both state_on
38 * and state_off should be not NULL. If at least one of them is NULL,
39 * the print_state is not overriden.
40 */
41struct gpio_extcon_platform_data {
42 const char *name;
43 unsigned gpio;
44 unsigned long debounce;
45 unsigned long irq_flags;
46
47 /* if NULL, "0" or "1" will be printed */
48 const char *state_on;
49 const char *state_off;
50};
51
52#endif /* __EXTCON_GPIO_H__ */
diff --git a/include/linux/filter.h b/include/linux/filter.h
index 72090994d789..82b01357af8b 100644
--- a/include/linux/filter.h
+++ b/include/linux/filter.h
@@ -10,6 +10,7 @@
10 10
11#ifdef __KERNEL__ 11#ifdef __KERNEL__
12#include <linux/atomic.h> 12#include <linux/atomic.h>
13#include <linux/compat.h>
13#endif 14#endif
14 15
15/* 16/*
@@ -133,6 +134,16 @@ struct sock_fprog { /* Required for SO_ATTACH_FILTER. */
133 134
134#ifdef __KERNEL__ 135#ifdef __KERNEL__
135 136
137#ifdef CONFIG_COMPAT
138/*
139 * A struct sock_filter is architecture independent.
140 */
141struct compat_sock_fprog {
142 u16 len;
143 compat_uptr_t filter; /* struct sock_filter * */
144};
145#endif
146
136struct sk_buff; 147struct sk_buff;
137struct sock; 148struct sock;
138 149
@@ -233,6 +244,7 @@ enum {
233 BPF_S_ANC_RXHASH, 244 BPF_S_ANC_RXHASH,
234 BPF_S_ANC_CPU, 245 BPF_S_ANC_CPU,
235 BPF_S_ANC_ALU_XOR_X, 246 BPF_S_ANC_ALU_XOR_X,
247 BPF_S_ANC_SECCOMP_LD_W,
236}; 248};
237 249
238#endif /* __KERNEL__ */ 250#endif /* __KERNEL__ */
diff --git a/include/linux/firewire.h b/include/linux/firewire.h
index cdc9b719e9c7..e83c24af358a 100644
--- a/include/linux/firewire.h
+++ b/include/linux/firewire.h
@@ -135,6 +135,20 @@ struct fw_card {
135 __be32 maint_utility_register; 135 __be32 maint_utility_register;
136}; 136};
137 137
138static inline struct fw_card *fw_card_get(struct fw_card *card)
139{
140 kref_get(&card->kref);
141
142 return card;
143}
144
145void fw_card_release(struct kref *kref);
146
147static inline void fw_card_put(struct fw_card *card)
148{
149 kref_put(&card->kref, fw_card_release);
150}
151
138struct fw_attribute_group { 152struct fw_attribute_group {
139 struct attribute_group *groups[2]; 153 struct attribute_group *groups[2];
140 struct attribute_group group; 154 struct attribute_group group;
@@ -325,6 +339,7 @@ int fw_core_add_address_handler(struct fw_address_handler *handler,
325void fw_core_remove_address_handler(struct fw_address_handler *handler); 339void fw_core_remove_address_handler(struct fw_address_handler *handler);
326void fw_send_response(struct fw_card *card, 340void fw_send_response(struct fw_card *card,
327 struct fw_request *request, int rcode); 341 struct fw_request *request, int rcode);
342int fw_get_request_speed(struct fw_request *request);
328void fw_send_request(struct fw_card *card, struct fw_transaction *t, 343void fw_send_request(struct fw_card *card, struct fw_transaction *t,
329 int tcode, int destination_id, int generation, int speed, 344 int tcode, int destination_id, int generation, int speed,
330 unsigned long long offset, void *payload, size_t length, 345 unsigned long long offset, void *payload, size_t length,
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 8de675523e46..25c40b9f848a 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -2051,6 +2051,7 @@ extern void unregister_blkdev(unsigned int, const char *);
2051extern struct block_device *bdget(dev_t); 2051extern struct block_device *bdget(dev_t);
2052extern struct block_device *bdgrab(struct block_device *bdev); 2052extern struct block_device *bdgrab(struct block_device *bdev);
2053extern void bd_set_size(struct block_device *, loff_t size); 2053extern void bd_set_size(struct block_device *, loff_t size);
2054extern sector_t blkdev_max_block(struct block_device *bdev);
2054extern void bd_forget(struct inode *inode); 2055extern void bd_forget(struct inode *inode);
2055extern void bdput(struct block_device *); 2056extern void bdput(struct block_device *);
2056extern void invalidate_bdev(struct block_device *); 2057extern void invalidate_bdev(struct block_device *);
diff --git a/include/linux/fsl_devices.h b/include/linux/fsl_devices.h
index fffdf00f87b9..15be561e7397 100644
--- a/include/linux/fsl_devices.h
+++ b/include/linux/fsl_devices.h
@@ -6,7 +6,7 @@
6 * 6 *
7 * Maintainer: Kumar Gala <galak@kernel.crashing.org> 7 * Maintainer: Kumar Gala <galak@kernel.crashing.org>
8 * 8 *
9 * Copyright 2004 Freescale Semiconductor, Inc 9 * Copyright 2004,2012 Freescale Semiconductor, Inc
10 * 10 *
11 * This program is free software; you can redistribute it and/or modify it 11 * This program is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License as published by the 12 * under the terms of the GNU General Public License as published by the
@@ -17,6 +17,12 @@
17#ifndef _FSL_DEVICE_H_ 17#ifndef _FSL_DEVICE_H_
18#define _FSL_DEVICE_H_ 18#define _FSL_DEVICE_H_
19 19
20#define FSL_UTMI_PHY_DLY 10 /*As per P1010RM, delay for UTMI
21 PHY CLK to become stable - 10ms*/
22#define FSL_USB_VER_OLD 0
23#define FSL_USB_VER_1_6 1
24#define FSL_USB_VER_2_2 2
25
20#include <linux/types.h> 26#include <linux/types.h>
21 27
22/* 28/*
@@ -63,6 +69,7 @@ struct platform_device;
63 69
64struct fsl_usb2_platform_data { 70struct fsl_usb2_platform_data {
65 /* board specific information */ 71 /* board specific information */
72 int controller_ver;
66 enum fsl_usb2_operating_modes operating_mode; 73 enum fsl_usb2_operating_modes operating_mode;
67 enum fsl_usb2_phy_modes phy_mode; 74 enum fsl_usb2_phy_modes phy_mode;
68 unsigned int port_enables; 75 unsigned int port_enables;
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index 72a6cabb4d5b..55e6d63d46d0 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -286,10 +286,16 @@ struct ftrace_rec_iter *ftrace_rec_iter_start(void);
286struct ftrace_rec_iter *ftrace_rec_iter_next(struct ftrace_rec_iter *iter); 286struct ftrace_rec_iter *ftrace_rec_iter_next(struct ftrace_rec_iter *iter);
287struct dyn_ftrace *ftrace_rec_iter_record(struct ftrace_rec_iter *iter); 287struct dyn_ftrace *ftrace_rec_iter_record(struct ftrace_rec_iter *iter);
288 288
289#define for_ftrace_rec_iter(iter) \
290 for (iter = ftrace_rec_iter_start(); \
291 iter; \
292 iter = ftrace_rec_iter_next(iter))
293
294
289int ftrace_update_record(struct dyn_ftrace *rec, int enable); 295int ftrace_update_record(struct dyn_ftrace *rec, int enable);
290int ftrace_test_record(struct dyn_ftrace *rec, int enable); 296int ftrace_test_record(struct dyn_ftrace *rec, int enable);
291void ftrace_run_stop_machine(int command); 297void ftrace_run_stop_machine(int command);
292int ftrace_location(unsigned long ip); 298unsigned long ftrace_location(unsigned long ip);
293 299
294extern ftrace_func_t ftrace_trace_function; 300extern ftrace_func_t ftrace_trace_function;
295 301
@@ -308,11 +314,14 @@ ftrace_set_early_filter(struct ftrace_ops *ops, char *buf, int enable);
308/* defined in arch */ 314/* defined in arch */
309extern int ftrace_ip_converted(unsigned long ip); 315extern int ftrace_ip_converted(unsigned long ip);
310extern int ftrace_dyn_arch_init(void *data); 316extern int ftrace_dyn_arch_init(void *data);
317extern void ftrace_replace_code(int enable);
311extern int ftrace_update_ftrace_func(ftrace_func_t func); 318extern int ftrace_update_ftrace_func(ftrace_func_t func);
312extern void ftrace_caller(void); 319extern void ftrace_caller(void);
313extern void ftrace_call(void); 320extern void ftrace_call(void);
314extern void mcount_call(void); 321extern void mcount_call(void);
315 322
323void ftrace_modify_all_code(int command);
324
316#ifndef FTRACE_ADDR 325#ifndef FTRACE_ADDR
317#define FTRACE_ADDR ((unsigned long)ftrace_caller) 326#define FTRACE_ADDR ((unsigned long)ftrace_caller)
318#endif 327#endif
@@ -485,8 +494,12 @@ static inline void __ftrace_enabled_restore(int enabled)
485 extern void trace_preempt_on(unsigned long a0, unsigned long a1); 494 extern void trace_preempt_on(unsigned long a0, unsigned long a1);
486 extern void trace_preempt_off(unsigned long a0, unsigned long a1); 495 extern void trace_preempt_off(unsigned long a0, unsigned long a1);
487#else 496#else
488 static inline void trace_preempt_on(unsigned long a0, unsigned long a1) { } 497/*
489 static inline void trace_preempt_off(unsigned long a0, unsigned long a1) { } 498 * Use defines instead of static inlines because some arches will make code out
499 * of the CALLER_ADDR, when we really want these to be a real nop.
500 */
501# define trace_preempt_on(a0, a1) do { } while (0)
502# define trace_preempt_off(a0, a1) do { } while (0)
490#endif 503#endif
491 504
492#ifdef CONFIG_FTRACE_MCOUNT_RECORD 505#ifdef CONFIG_FTRACE_MCOUNT_RECORD
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
index 5f3f3be5af09..176a939d1547 100644
--- a/include/linux/ftrace_event.h
+++ b/include/linux/ftrace_event.h
@@ -179,6 +179,7 @@ enum {
179 TRACE_EVENT_FL_RECORDED_CMD_BIT, 179 TRACE_EVENT_FL_RECORDED_CMD_BIT,
180 TRACE_EVENT_FL_CAP_ANY_BIT, 180 TRACE_EVENT_FL_CAP_ANY_BIT,
181 TRACE_EVENT_FL_NO_SET_FILTER_BIT, 181 TRACE_EVENT_FL_NO_SET_FILTER_BIT,
182 TRACE_EVENT_FL_IGNORE_ENABLE_BIT,
182}; 183};
183 184
184enum { 185enum {
@@ -187,6 +188,7 @@ enum {
187 TRACE_EVENT_FL_RECORDED_CMD = (1 << TRACE_EVENT_FL_RECORDED_CMD_BIT), 188 TRACE_EVENT_FL_RECORDED_CMD = (1 << TRACE_EVENT_FL_RECORDED_CMD_BIT),
188 TRACE_EVENT_FL_CAP_ANY = (1 << TRACE_EVENT_FL_CAP_ANY_BIT), 189 TRACE_EVENT_FL_CAP_ANY = (1 << TRACE_EVENT_FL_CAP_ANY_BIT),
189 TRACE_EVENT_FL_NO_SET_FILTER = (1 << TRACE_EVENT_FL_NO_SET_FILTER_BIT), 190 TRACE_EVENT_FL_NO_SET_FILTER = (1 << TRACE_EVENT_FL_NO_SET_FILTER_BIT),
191 TRACE_EVENT_FL_IGNORE_ENABLE = (1 << TRACE_EVENT_FL_IGNORE_ENABLE_BIT),
190}; 192};
191 193
192struct ftrace_event_call { 194struct ftrace_event_call {
diff --git a/include/linux/generic_serial.h b/include/linux/generic_serial.h
index fadff28505bb..79b3eb37243a 100644
--- a/include/linux/generic_serial.h
+++ b/include/linux/generic_serial.h
@@ -4,7 +4,6 @@
4 * Copyright (C) 1998 R.E.Wolff@BitWizard.nl 4 * Copyright (C) 1998 R.E.Wolff@BitWizard.nl
5 * 5 *
6 * written for the SX serial driver. 6 * written for the SX serial driver.
7 * Contains the code that should be shared over all the serial drivers.
8 * 7 *
9 * Version 0.1 -- December, 1998. 8 * Version 0.1 -- December, 1998.
10 */ 9 */
@@ -12,45 +11,8 @@
12#ifndef GENERIC_SERIAL_H 11#ifndef GENERIC_SERIAL_H
13#define GENERIC_SERIAL_H 12#define GENERIC_SERIAL_H
14 13
15#ifdef __KERNEL__ 14#warning Use of this header is deprecated.
16#include <linux/mutex.h> 15#warning Since nobody sets the constants defined here for you, you should not, in any case, use them. Including the header is thus pointless.
17#include <linux/tty.h>
18
19struct real_driver {
20 void (*disable_tx_interrupts) (void *);
21 void (*enable_tx_interrupts) (void *);
22 void (*disable_rx_interrupts) (void *);
23 void (*enable_rx_interrupts) (void *);
24 void (*shutdown_port) (void*);
25 int (*set_real_termios) (void*);
26 int (*chars_in_buffer) (void*);
27 void (*close) (void*);
28 void (*hungup) (void*);
29 void (*getserial) (void*, struct serial_struct *sp);
30};
31
32
33
34struct gs_port {
35 int magic;
36 struct tty_port port;
37 unsigned char *xmit_buf;
38 int xmit_head;
39 int xmit_tail;
40 int xmit_cnt;
41 struct mutex port_write_mutex;
42 unsigned long event;
43 unsigned short closing_wait;
44 int close_delay;
45 struct real_driver *rd;
46 int wakeup_chars;
47 int baud_base;
48 int baud;
49 int custom_divisor;
50 spinlock_t driver_lock;
51};
52
53#endif /* __KERNEL__ */
54 16
55/* Flags */ 17/* Flags */
56/* Warning: serial.h defines some ASYNC_ flags, they say they are "only" 18/* Warning: serial.h defines some ASYNC_ flags, they say they are "only"
@@ -60,8 +22,6 @@ struct gs_port {
60#define GS_RX_INTEN 0x00400000 22#define GS_RX_INTEN 0x00400000
61#define GS_ACTIVE 0x00200000 23#define GS_ACTIVE 0x00200000
62 24
63
64
65#define GS_TYPE_NORMAL 1 25#define GS_TYPE_NORMAL 1
66 26
67#define GS_DEBUG_FLUSH 0x00000001 27#define GS_DEBUG_FLUSH 0x00000001
@@ -72,24 +32,4 @@ struct gs_port {
72#define GS_DEBUG_FLOW 0x00000020 32#define GS_DEBUG_FLOW 0x00000020
73#define GS_DEBUG_WRITE 0x00000040 33#define GS_DEBUG_WRITE 0x00000040
74 34
75#ifdef __KERNEL__
76int gs_put_char(struct tty_struct *tty, unsigned char ch);
77int gs_write(struct tty_struct *tty,
78 const unsigned char *buf, int count);
79int gs_write_room(struct tty_struct *tty);
80int gs_chars_in_buffer(struct tty_struct *tty);
81void gs_flush_buffer(struct tty_struct *tty);
82void gs_flush_chars(struct tty_struct *tty);
83void gs_stop(struct tty_struct *tty);
84void gs_start(struct tty_struct *tty);
85void gs_hangup(struct tty_struct *tty);
86int gs_block_til_ready(void *port, struct file *filp);
87void gs_close(struct tty_struct *tty, struct file *filp);
88void gs_set_termios (struct tty_struct * tty,
89 struct ktermios * old_termios);
90int gs_init_port(struct gs_port *port);
91int gs_setserial(struct gs_port *port, struct serial_struct __user *sp);
92int gs_getserial(struct gs_port *port, struct serial_struct __user *sp);
93void gs_got_break(struct gs_port *port);
94#endif /* __KERNEL__ */
95#endif 35#endif
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index e61d3192448e..017a7fb5a1fc 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -222,12 +222,6 @@ static inline void part_pack_uuid(const u8 *uuid_str, u8 *to)
222 } 222 }
223} 223}
224 224
225static inline char *part_unpack_uuid(const u8 *uuid, char *out)
226{
227 sprintf(out, "%pU", uuid);
228 return out;
229}
230
231static inline int disk_max_parts(struct gendisk *disk) 225static inline int disk_max_parts(struct gendisk *disk)
232{ 226{
233 if (disk->flags & GENHD_FL_EXT_DEVT) 227 if (disk->flags & GENHD_FL_EXT_DEVT)
diff --git a/include/linux/hid.h b/include/linux/hid.h
index 3a95da60fd3e..449fa385703d 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -317,7 +317,6 @@ struct hid_item {
317#define HID_QUIRK_BADPAD 0x00000020 317#define HID_QUIRK_BADPAD 0x00000020
318#define HID_QUIRK_MULTI_INPUT 0x00000040 318#define HID_QUIRK_MULTI_INPUT 0x00000040
319#define HID_QUIRK_HIDINPUT_FORCE 0x00000080 319#define HID_QUIRK_HIDINPUT_FORCE 0x00000080
320#define HID_QUIRK_MULTITOUCH 0x00000100
321#define HID_QUIRK_SKIP_OUTPUT_REPORTS 0x00010000 320#define HID_QUIRK_SKIP_OUTPUT_REPORTS 0x00010000
322#define HID_QUIRK_FULLSPEED_INTERVAL 0x10000000 321#define HID_QUIRK_FULLSPEED_INTERVAL 0x10000000
323#define HID_QUIRK_NO_INIT_REPORTS 0x20000000 322#define HID_QUIRK_NO_INIT_REPORTS 0x20000000
@@ -325,6 +324,12 @@ struct hid_item {
325#define HID_QUIRK_NO_INPUT_SYNC 0x80000000 324#define HID_QUIRK_NO_INPUT_SYNC 0x80000000
326 325
327/* 326/*
327 * HID device groups
328 */
329#define HID_GROUP_GENERIC 0x0001
330#define HID_GROUP_MULTITOUCH 0x0002
331
332/*
328 * This is the global environment of the parser. This information is 333 * This is the global environment of the parser. This information is
329 * persistent for main-items. The global environment can be saved and 334 * persistent for main-items. The global environment can be saved and
330 * restored with PUSH/POP statements. 335 * restored with PUSH/POP statements.
@@ -467,6 +472,8 @@ struct hid_driver;
467struct hid_ll_driver; 472struct hid_ll_driver;
468 473
469struct hid_device { /* device report descriptor */ 474struct hid_device { /* device report descriptor */
475 __u8 *dev_rdesc;
476 unsigned dev_rsize;
470 __u8 *rdesc; 477 __u8 *rdesc;
471 unsigned rsize; 478 unsigned rsize;
472 struct hid_collection *collection; /* List of HID collections */ 479 struct hid_collection *collection; /* List of HID collections */
@@ -474,6 +481,7 @@ struct hid_device { /* device report descriptor */
474 unsigned maxcollection; /* Number of parsed collections */ 481 unsigned maxcollection; /* Number of parsed collections */
475 unsigned maxapplication; /* Number of applications */ 482 unsigned maxapplication; /* Number of applications */
476 __u16 bus; /* BUS ID */ 483 __u16 bus; /* BUS ID */
484 __u16 group; /* Report group */
477 __u32 vendor; /* Vendor ID */ 485 __u32 vendor; /* Vendor ID */
478 __u32 product; /* Product ID */ 486 __u32 product; /* Product ID */
479 __u32 version; /* HID version */ 487 __u32 version; /* HID version */
@@ -578,12 +586,12 @@ struct hid_descriptor {
578 struct hid_class_descriptor desc[1]; 586 struct hid_class_descriptor desc[1];
579} __attribute__ ((packed)); 587} __attribute__ ((packed));
580 588
581#define HID_DEVICE(b, ven, prod) \ 589#define HID_DEVICE(b, g, ven, prod) \
582 .bus = (b), \ 590 .bus = (b), .group = (g), .vendor = (ven), .product = (prod)
583 .vendor = (ven), .product = (prod) 591#define HID_USB_DEVICE(ven, prod) \
584 592 .bus = BUS_USB, .vendor = (ven), .product = (prod)
585#define HID_USB_DEVICE(ven, prod) HID_DEVICE(BUS_USB, ven, prod) 593#define HID_BLUETOOTH_DEVICE(ven, prod) \
586#define HID_BLUETOOTH_DEVICE(ven, prod) HID_DEVICE(BUS_BLUETOOTH, ven, prod) 594 .bus = BUS_BLUETOOTH, .vendor = (ven), .product = (prod)
587 595
588#define HID_REPORT_ID(rep) \ 596#define HID_REPORT_ID(rep) \
589 .report_type = (rep) 597 .report_type = (rep)
@@ -735,6 +743,7 @@ void hid_output_report(struct hid_report *report, __u8 *data);
735struct hid_device *hid_allocate_device(void); 743struct hid_device *hid_allocate_device(void);
736struct hid_report *hid_register_report(struct hid_device *device, unsigned type, unsigned id); 744struct hid_report *hid_register_report(struct hid_device *device, unsigned type, unsigned id);
737int hid_parse_report(struct hid_device *hid, __u8 *start, unsigned size); 745int hid_parse_report(struct hid_device *hid, __u8 *start, unsigned size);
746int hid_open_report(struct hid_device *device);
738int hid_check_keys_pressed(struct hid_device *hid); 747int hid_check_keys_pressed(struct hid_device *hid);
739int hid_connect(struct hid_device *hid, unsigned int connect_mask); 748int hid_connect(struct hid_device *hid, unsigned int connect_mask);
740void hid_disconnect(struct hid_device *hid); 749void hid_disconnect(struct hid_device *hid);
@@ -805,16 +814,7 @@ static inline void hid_map_usage_clear(struct hid_input *hidinput,
805 */ 814 */
806static inline int __must_check hid_parse(struct hid_device *hdev) 815static inline int __must_check hid_parse(struct hid_device *hdev)
807{ 816{
808 int ret; 817 return hid_open_report(hdev);
809
810 if (hdev->status & HID_STAT_PARSED)
811 return 0;
812
813 ret = hdev->ll_driver->parse(hdev);
814 if (!ret)
815 hdev->status |= HID_STAT_PARSED;
816
817 return ret;
818} 818}
819 819
820/** 820/**
@@ -896,7 +896,7 @@ static inline int hid_hw_power(struct hid_device *hdev, int level)
896 return hdev->ll_driver->power ? hdev->ll_driver->power(hdev, level) : 0; 896 return hdev->ll_driver->power ? hdev->ll_driver->power(hdev, level) : 0;
897} 897}
898 898
899void hid_report_raw_event(struct hid_device *hid, int type, u8 *data, int size, 899int hid_report_raw_event(struct hid_device *hid, int type, u8 *data, int size,
900 int interrupt); 900 int interrupt);
901 901
902extern int hid_generic_init(void); 902extern int hid_generic_init(void);
diff --git a/include/linux/hidraw.h b/include/linux/hidraw.h
index 4b88e697c4e9..45e9fcb8d877 100644
--- a/include/linux/hidraw.h
+++ b/include/linux/hidraw.h
@@ -76,13 +76,13 @@ struct hidraw_list {
76#ifdef CONFIG_HIDRAW 76#ifdef CONFIG_HIDRAW
77int hidraw_init(void); 77int hidraw_init(void);
78void hidraw_exit(void); 78void hidraw_exit(void);
79void hidraw_report_event(struct hid_device *, u8 *, int); 79int hidraw_report_event(struct hid_device *, u8 *, int);
80int hidraw_connect(struct hid_device *); 80int hidraw_connect(struct hid_device *);
81void hidraw_disconnect(struct hid_device *); 81void hidraw_disconnect(struct hid_device *);
82#else 82#else
83static inline int hidraw_init(void) { return 0; } 83static inline int hidraw_init(void) { return 0; }
84static inline void hidraw_exit(void) { } 84static inline void hidraw_exit(void) { }
85static inline void hidraw_report_event(struct hid_device *hid, u8 *data, int len) { } 85static inline int hidraw_report_event(struct hid_device *hid, u8 *data, int len) { return 0; }
86static inline int hidraw_connect(struct hid_device *hid) { return -1; } 86static inline int hidraw_connect(struct hid_device *hid) { return -1; }
87static inline void hidraw_disconnect(struct hid_device *hid) { } 87static inline void hidraw_disconnect(struct hid_device *hid) { }
88#endif 88#endif
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index 6af8738ae7e9..68ed7f7e1fc9 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -1062,8 +1062,10 @@ struct hyperv_service_callback {
1062 void (*callback) (void *context); 1062 void (*callback) (void *context);
1063}; 1063};
1064 1064
1065#define MAX_SRV_VER 0x7ffffff
1065extern void vmbus_prep_negotiate_resp(struct icmsg_hdr *, 1066extern void vmbus_prep_negotiate_resp(struct icmsg_hdr *,
1066 struct icmsg_negotiate *, u8 *); 1067 struct icmsg_negotiate *, u8 *, int,
1068 int);
1067 1069
1068int hv_kvp_init(struct hv_util_service *); 1070int hv_kvp_init(struct hv_util_service *);
1069void hv_kvp_deinit(void); 1071void hv_kvp_deinit(void);
diff --git a/include/linux/i2c-pnx.h b/include/linux/i2c-pnx.h
index a87124d4d533..1bc74afe7a35 100644
--- a/include/linux/i2c-pnx.h
+++ b/include/linux/i2c-pnx.h
@@ -29,14 +29,10 @@ struct i2c_pnx_algo_data {
29 struct i2c_pnx_mif mif; 29 struct i2c_pnx_mif mif;
30 int last; 30 int last;
31 struct clk *clk; 31 struct clk *clk;
32 struct i2c_pnx_data *i2c_pnx;
33 struct i2c_adapter adapter; 32 struct i2c_adapter adapter;
34}; 33 phys_addr_t base;
35 34 int irq;
36struct i2c_pnx_data { 35 u32 timeout;
37 const char *name;
38 u32 base;
39 int irq;
40}; 36};
41 37
42#endif /* __I2C_PNX_H__ */ 38#endif /* __I2C_PNX_H__ */
diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h
index 1f90de0cfdbe..3993477103a5 100644
--- a/include/linux/i2c/twl.h
+++ b/include/linux/i2c/twl.h
@@ -171,8 +171,6 @@ static inline int twl_class_is_ ##class(void) \
171TWL_CLASS_IS(4030, TWL4030_CLASS_ID) 171TWL_CLASS_IS(4030, TWL4030_CLASS_ID)
172TWL_CLASS_IS(6030, TWL6030_CLASS_ID) 172TWL_CLASS_IS(6030, TWL6030_CLASS_ID)
173 173
174#define TWL6025_SUBCLASS BIT(4) /* TWL6025 has changed registers */
175
176/* 174/*
177 * Read and write single 8-bit registers 175 * Read and write single 8-bit registers
178 */ 176 */
@@ -746,6 +744,17 @@ struct twl_regulator_driver_data {
746 void *data; 744 void *data;
747 unsigned long features; 745 unsigned long features;
748}; 746};
747/* chip-specific feature flags, for twl_regulator_driver_data.features */
748#define TWL4030_VAUX2 BIT(0) /* pre-5030 voltage ranges */
749#define TPS_SUBSET BIT(1) /* tps659[23]0 have fewer LDOs */
750#define TWL5031 BIT(2) /* twl5031 has different registers */
751#define TWL6030_CLASS BIT(3) /* TWL6030 class */
752#define TWL6025_SUBCLASS BIT(4) /* TWL6025 has changed registers */
753#define TWL4030_ALLOW_UNSUPPORTED BIT(5) /* Some voltages are possible
754 * but not officially supported.
755 * This flag is necessary to
756 * enable them.
757 */
749 758
750/*----------------------------------------------------------------------*/ 759/*----------------------------------------------------------------------*/
751 760
diff --git a/include/linux/if_ec.h b/include/linux/if_ec.h
deleted file mode 100644
index d85f9f48129f..000000000000
--- a/include/linux/if_ec.h
+++ /dev/null
@@ -1,68 +0,0 @@
1/* Definitions for Econet sockets. */
2
3#ifndef __LINUX_IF_EC
4#define __LINUX_IF_EC
5
6/* User visible stuff. Glibc provides its own but libc5 folk will use these */
7
8struct ec_addr {
9 unsigned char station; /* Station number. */
10 unsigned char net; /* Network number. */
11};
12
13struct sockaddr_ec {
14 unsigned short sec_family;
15 unsigned char port; /* Port number. */
16 unsigned char cb; /* Control/flag byte. */
17 unsigned char type; /* Type of message. */
18 struct ec_addr addr;
19 unsigned long cookie;
20};
21
22#define ECTYPE_PACKET_RECEIVED 0 /* Packet received */
23#define ECTYPE_TRANSMIT_STATUS 0x10 /* Transmit completed,
24 low nibble holds status */
25
26#define ECTYPE_TRANSMIT_OK 1
27#define ECTYPE_TRANSMIT_NOT_LISTENING 2
28#define ECTYPE_TRANSMIT_NET_ERROR 3
29#define ECTYPE_TRANSMIT_NO_CLOCK 4
30#define ECTYPE_TRANSMIT_LINE_JAMMED 5
31#define ECTYPE_TRANSMIT_NOT_PRESENT 6
32
33#ifdef __KERNEL__
34
35#define EC_HLEN 6
36
37/* This is what an Econet frame looks like on the wire. */
38struct ec_framehdr {
39 unsigned char dst_stn;
40 unsigned char dst_net;
41 unsigned char src_stn;
42 unsigned char src_net;
43 unsigned char cb;
44 unsigned char port;
45};
46
47struct econet_sock {
48 /* struct sock has to be the first member of econet_sock */
49 struct sock sk;
50 unsigned char cb;
51 unsigned char port;
52 unsigned char station;
53 unsigned char net;
54 unsigned short num;
55};
56
57static inline struct econet_sock *ec_sk(const struct sock *sk)
58{
59 return (struct econet_sock *)sk;
60}
61
62struct ec_device {
63 unsigned char station, net; /* Econet protocol address */
64};
65
66#endif
67
68#endif
diff --git a/include/linux/iio/buffer.h b/include/linux/iio/buffer.h
new file mode 100644
index 000000000000..fb0fe46fd659
--- /dev/null
+++ b/include/linux/iio/buffer.h
@@ -0,0 +1,191 @@
1/* The industrial I/O core - generic buffer interfaces.
2 *
3 * Copyright (c) 2008 Jonathan Cameron
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 as published by
7 * the Free Software Foundation.
8 */
9
10#ifndef _IIO_BUFFER_GENERIC_H_
11#define _IIO_BUFFER_GENERIC_H_
12#include <linux/sysfs.h>
13#include <linux/iio/iio.h>
14
15#ifdef CONFIG_IIO_BUFFER
16
17struct iio_buffer;
18
19/**
20 * struct iio_buffer_access_funcs - access functions for buffers.
21 * @store_to: actually store stuff to the buffer
22 * @read_first_n: try to get a specified number of bytes (must exist)
23 * @request_update: if a parameter change has been marked, update underlying
24 * storage.
25 * @get_bytes_per_datum:get current bytes per datum
26 * @set_bytes_per_datum:set number of bytes per datum
27 * @get_length: get number of datums in buffer
28 * @set_length: set number of datums in buffer
29 *
30 * The purpose of this structure is to make the buffer element
31 * modular as event for a given driver, different usecases may require
32 * different buffer designs (space efficiency vs speed for example).
33 *
34 * It is worth noting that a given buffer implementation may only support a
35 * small proportion of these functions. The core code 'should' cope fine with
36 * any of them not existing.
37 **/
38struct iio_buffer_access_funcs {
39 int (*store_to)(struct iio_buffer *buffer, u8 *data, s64 timestamp);
40 int (*read_first_n)(struct iio_buffer *buffer,
41 size_t n,
42 char __user *buf);
43
44 int (*request_update)(struct iio_buffer *buffer);
45
46 int (*get_bytes_per_datum)(struct iio_buffer *buffer);
47 int (*set_bytes_per_datum)(struct iio_buffer *buffer, size_t bpd);
48 int (*get_length)(struct iio_buffer *buffer);
49 int (*set_length)(struct iio_buffer *buffer, int length);
50};
51
52/**
53 * struct iio_buffer - general buffer structure
54 * @length: [DEVICE] number of datums in buffer
55 * @bytes_per_datum: [DEVICE] size of individual datum including timestamp
56 * @scan_el_attrs: [DRIVER] control of scan elements if that scan mode
57 * control method is used
58 * @scan_mask: [INTERN] bitmask used in masking scan mode elements
59 * @scan_timestamp: [INTERN] does the scan mode include a timestamp
60 * @access: [DRIVER] buffer access functions associated with the
61 * implementation.
62 * @scan_el_dev_attr_list:[INTERN] list of scan element related attributes.
63 * @scan_el_group: [DRIVER] attribute group for those attributes not
64 * created from the iio_chan_info array.
65 * @pollq: [INTERN] wait queue to allow for polling on the buffer.
66 * @stufftoread: [INTERN] flag to indicate new data.
67 * @demux_list: [INTERN] list of operations required to demux the scan.
68 * @demux_bounce: [INTERN] buffer for doing gather from incoming scan.
69 **/
70struct iio_buffer {
71 int length;
72 int bytes_per_datum;
73 struct attribute_group *scan_el_attrs;
74 long *scan_mask;
75 bool scan_timestamp;
76 const struct iio_buffer_access_funcs *access;
77 struct list_head scan_el_dev_attr_list;
78 struct attribute_group scan_el_group;
79 wait_queue_head_t pollq;
80 bool stufftoread;
81 const struct attribute_group *attrs;
82 struct list_head demux_list;
83 unsigned char *demux_bounce;
84};
85
86/**
87 * iio_buffer_init() - Initialize the buffer structure
88 * @buffer: buffer to be initialized
89 **/
90void iio_buffer_init(struct iio_buffer *buffer);
91
92/**
93 * __iio_update_buffer() - update common elements of buffers
94 * @buffer: buffer that is the event source
95 * @bytes_per_datum: size of individual datum including timestamp
96 * @length: number of datums in buffer
97 **/
98static inline void __iio_update_buffer(struct iio_buffer *buffer,
99 int bytes_per_datum, int length)
100{
101 buffer->bytes_per_datum = bytes_per_datum;
102 buffer->length = length;
103}
104
105int iio_scan_mask_query(struct iio_dev *indio_dev,
106 struct iio_buffer *buffer, int bit);
107
108/**
109 * iio_scan_mask_set() - set particular bit in the scan mask
110 * @buffer: the buffer whose scan mask we are interested in
111 * @bit: the bit to be set.
112 **/
113int iio_scan_mask_set(struct iio_dev *indio_dev,
114 struct iio_buffer *buffer, int bit);
115
116/**
117 * iio_push_to_buffer() - push to a registered buffer.
118 * @buffer: IIO buffer structure for device
119 * @scan: Full scan.
120 * @timestamp:
121 */
122int iio_push_to_buffer(struct iio_buffer *buffer, unsigned char *data,
123 s64 timestamp);
124
125int iio_update_demux(struct iio_dev *indio_dev);
126
127/**
128 * iio_buffer_register() - register the buffer with IIO core
129 * @indio_dev: device with the buffer to be registered
130 **/
131int iio_buffer_register(struct iio_dev *indio_dev,
132 const struct iio_chan_spec *channels,
133 int num_channels);
134
135/**
136 * iio_buffer_unregister() - unregister the buffer from IIO core
137 * @indio_dev: the device with the buffer to be unregistered
138 **/
139void iio_buffer_unregister(struct iio_dev *indio_dev);
140
141/**
142 * iio_buffer_read_length() - attr func to get number of datums in the buffer
143 **/
144ssize_t iio_buffer_read_length(struct device *dev,
145 struct device_attribute *attr,
146 char *buf);
147/**
148 * iio_buffer_write_length() - attr func to set number of datums in the buffer
149 **/
150ssize_t iio_buffer_write_length(struct device *dev,
151 struct device_attribute *attr,
152 const char *buf,
153 size_t len);
154/**
155 * iio_buffer_store_enable() - attr to turn the buffer on
156 **/
157ssize_t iio_buffer_store_enable(struct device *dev,
158 struct device_attribute *attr,
159 const char *buf,
160 size_t len);
161/**
162 * iio_buffer_show_enable() - attr to see if the buffer is on
163 **/
164ssize_t iio_buffer_show_enable(struct device *dev,
165 struct device_attribute *attr,
166 char *buf);
167#define IIO_BUFFER_LENGTH_ATTR DEVICE_ATTR(length, S_IRUGO | S_IWUSR, \
168 iio_buffer_read_length, \
169 iio_buffer_write_length)
170
171#define IIO_BUFFER_ENABLE_ATTR DEVICE_ATTR(enable, S_IRUGO | S_IWUSR, \
172 iio_buffer_show_enable, \
173 iio_buffer_store_enable)
174
175int iio_sw_buffer_preenable(struct iio_dev *indio_dev);
176
177#else /* CONFIG_IIO_BUFFER */
178
179static inline int iio_buffer_register(struct iio_dev *indio_dev,
180 struct iio_chan_spec *channels,
181 int num_channels)
182{
183 return 0;
184}
185
186static inline void iio_buffer_unregister(struct iio_dev *indio_dev)
187{};
188
189#endif /* CONFIG_IIO_BUFFER */
190
191#endif /* _IIO_BUFFER_GENERIC_H_ */
diff --git a/include/linux/iio/consumer.h b/include/linux/iio/consumer.h
new file mode 100644
index 000000000000..1a15e560a5a1
--- /dev/null
+++ b/include/linux/iio/consumer.h
@@ -0,0 +1,96 @@
1/*
2 * Industrial I/O in kernel consumer interface
3 *
4 * Copyright (c) 2011 Jonathan Cameron
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published by
8 * the Free Software Foundation.
9 */
10#ifndef _IIO_INKERN_CONSUMER_H_
11#define _IIO_INKERN_CONSUMER_H
12#include <linux/iio/types.h>
13
14struct iio_dev;
15struct iio_chan_spec;
16
17/**
18 * struct iio_channel - everything needed for a consumer to use a channel
19 * @indio_dev: Device on which the channel exists.
20 * @channel: Full description of the channel.
21 */
22struct iio_channel {
23 struct iio_dev *indio_dev;
24 const struct iio_chan_spec *channel;
25};
26
27/**
28 * iio_channel_get() - get description of all that is needed to access channel.
29 * @name: Unique name of the device as provided in the iio_map
30 * with which the desired provider to consumer mapping
31 * was registered.
32 * @consumer_channel: Unique name to identify the channel on the consumer
33 * side. This typically describes the channels use within
34 * the consumer. E.g. 'battery_voltage'
35 */
36struct iio_channel *iio_st_channel_get(const char *name,
37 const char *consumer_channel);
38
39/**
40 * iio_st_channel_release() - release channels obtained via iio_st_channel_get
41 * @chan: The channel to be released.
42 */
43void iio_st_channel_release(struct iio_channel *chan);
44
45/**
46 * iio_st_channel_get_all() - get all channels associated with a client
47 * @name: name of consumer device.
48 *
49 * Returns an array of iio_channel structures terminated with one with
50 * null iio_dev pointer.
51 * This function is used by fairly generic consumers to get all the
52 * channels registered as having this consumer.
53 */
54struct iio_channel *iio_st_channel_get_all(const char *name);
55
56/**
57 * iio_st_channel_release_all() - reverse iio_st_get_all
58 * @chan: Array of channels to be released.
59 */
60void iio_st_channel_release_all(struct iio_channel *chan);
61
62/**
63 * iio_st_read_channel_raw() - read from a given channel
64 * @channel: The channel being queried.
65 * @val: Value read back.
66 *
67 * Note raw reads from iio channels are in adc counts and hence
68 * scale will need to be applied if standard units required.
69 */
70int iio_st_read_channel_raw(struct iio_channel *chan,
71 int *val);
72
73/**
74 * iio_st_get_channel_type() - get the type of a channel
75 * @channel: The channel being queried.
76 * @type: The type of the channel.
77 *
78 * returns the enum iio_chan_type of the channel
79 */
80int iio_st_get_channel_type(struct iio_channel *channel,
81 enum iio_chan_type *type);
82
83/**
84 * iio_st_read_channel_scale() - read the scale value for a channel
85 * @channel: The channel being queried.
86 * @val: First part of value read back.
87 * @val2: Second part of value read back.
88 *
89 * Note returns a description of what is in val and val2, such
90 * as IIO_VAL_INT_PLUS_MICRO telling us we have a value of val
91 * + val2/1e6
92 */
93int iio_st_read_channel_scale(struct iio_channel *chan, int *val,
94 int *val2);
95
96#endif
diff --git a/include/linux/iio/driver.h b/include/linux/iio/driver.h
new file mode 100644
index 000000000000..a4f8b2e05af5
--- /dev/null
+++ b/include/linux/iio/driver.h
@@ -0,0 +1,34 @@
1/*
2 * Industrial I/O in kernel access map interface.
3 *
4 * Copyright (c) 2011 Jonathan Cameron
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published by
8 * the Free Software Foundation.
9 */
10
11#ifndef _IIO_INKERN_H_
12#define _IIO_INKERN_H_
13
14struct iio_map;
15
16/**
17 * iio_map_array_register() - tell the core about inkernel consumers
18 * @indio_dev: provider device
19 * @map: array of mappings specifying association of channel with client
20 */
21int iio_map_array_register(struct iio_dev *indio_dev,
22 struct iio_map *map);
23
24/**
25 * iio_map_array_unregister() - tell the core to remove consumer mappings
26 * @indio_dev: provider device
27 * @map: array of mappings to remove. Note these must have same memory
28 * addresses as those originally added not just equal parameter
29 * values.
30 */
31int iio_map_array_unregister(struct iio_dev *indio_dev,
32 struct iio_map *map);
33
34#endif
diff --git a/include/linux/iio/events.h b/include/linux/iio/events.h
new file mode 100644
index 000000000000..b5acbf93c5da
--- /dev/null
+++ b/include/linux/iio/events.h
@@ -0,0 +1,105 @@
1/* The industrial I/O - event passing to userspace
2 *
3 * Copyright (c) 2008-2011 Jonathan Cameron
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 as published by
7 * the Free Software Foundation.
8 */
9#ifndef _IIO_EVENTS_H_
10#define _IIO_EVENTS_H_
11
12#include <linux/ioctl.h>
13#include <linux/types.h>
14#include <linux/iio/types.h>
15
16/**
17 * struct iio_event_data - The actual event being pushed to userspace
18 * @id: event identifier
19 * @timestamp: best estimate of time of event occurrence (often from
20 * the interrupt handler)
21 */
22struct iio_event_data {
23 __u64 id;
24 __s64 timestamp;
25};
26
27#define IIO_GET_EVENT_FD_IOCTL _IOR('i', 0x90, int)
28
29enum iio_event_type {
30 IIO_EV_TYPE_THRESH,
31 IIO_EV_TYPE_MAG,
32 IIO_EV_TYPE_ROC,
33 IIO_EV_TYPE_THRESH_ADAPTIVE,
34 IIO_EV_TYPE_MAG_ADAPTIVE,
35};
36
37enum iio_event_direction {
38 IIO_EV_DIR_EITHER,
39 IIO_EV_DIR_RISING,
40 IIO_EV_DIR_FALLING,
41};
42
43/**
44 * IIO_EVENT_CODE() - create event identifier
45 * @chan_type: Type of the channel. Should be one of enum iio_chan_type.
46 * @diff: Whether the event is for an differential channel or not.
47 * @modifier: Modifier for the channel. Should be one of enum iio_modifier.
48 * @direction: Direction of the event. One of enum iio_event_direction.
49 * @type: Type of the event. Should be one enum iio_event_type.
50 * @chan: Channel number for non-differential channels.
51 * @chan1: First channel number for differential channels.
52 * @chan2: Second channel number for differential channels.
53 */
54
55#define IIO_EVENT_CODE(chan_type, diff, modifier, direction, \
56 type, chan, chan1, chan2) \
57 (((u64)type << 56) | ((u64)diff << 55) | \
58 ((u64)direction << 48) | ((u64)modifier << 40) | \
59 ((u64)chan_type << 32) | (((u16)chan2) << 16) | ((u16)chan1) | \
60 ((u16)chan))
61
62
63#define IIO_EV_DIR_MAX 4
64#define IIO_EV_BIT(type, direction) \
65 (1 << (type*IIO_EV_DIR_MAX + direction))
66
67/**
68 * IIO_MOD_EVENT_CODE() - create event identifier for modified channels
69 * @chan_type: Type of the channel. Should be one of enum iio_chan_type.
70 * @number: Channel number.
71 * @modifier: Modifier for the channel. Should be one of enum iio_modifier.
72 * @type: Type of the event. Should be one enum iio_event_type.
73 * @direction: Direction of the event. One of enum iio_event_direction.
74 */
75
76#define IIO_MOD_EVENT_CODE(chan_type, number, modifier, \
77 type, direction) \
78 IIO_EVENT_CODE(chan_type, 0, modifier, direction, type, number, 0, 0)
79
80/**
81 * IIO_UNMOD_EVENT_CODE() - create event identifier for unmodified channels
82 * @chan_type: Type of the channel. Should be one of enum iio_chan_type.
83 * @number: Channel number.
84 * @type: Type of the event. Should be one enum iio_event_type.
85 * @direction: Direction of the event. One of enum iio_event_direction.
86 */
87
88#define IIO_UNMOD_EVENT_CODE(chan_type, number, type, direction) \
89 IIO_EVENT_CODE(chan_type, 0, 0, direction, type, number, 0, 0)
90
91#define IIO_EVENT_CODE_EXTRACT_TYPE(mask) ((mask >> 56) & 0xFF)
92
93#define IIO_EVENT_CODE_EXTRACT_DIR(mask) ((mask >> 48) & 0xCF)
94
95#define IIO_EVENT_CODE_EXTRACT_CHAN_TYPE(mask) ((mask >> 32) & 0xFF)
96
97/* Event code number extraction depends on which type of event we have.
98 * Perhaps review this function in the future*/
99#define IIO_EVENT_CODE_EXTRACT_CHAN(mask) ((__s16)(mask & 0xFFFF))
100#define IIO_EVENT_CODE_EXTRACT_CHAN2(mask) ((__s16)(((mask) >> 16) & 0xFFFF))
101
102#define IIO_EVENT_CODE_EXTRACT_MODIFIER(mask) ((mask >> 40) & 0xFF)
103#define IIO_EVENT_CODE_EXTRACT_DIFF(mask) (((mask) >> 55) & 0x1)
104
105#endif
diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h
new file mode 100644
index 000000000000..3a4f6a3ab80d
--- /dev/null
+++ b/include/linux/iio/iio.h
@@ -0,0 +1,492 @@
1
2/* The industrial I/O core
3 *
4 * Copyright (c) 2008 Jonathan Cameron
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published by
8 * the Free Software Foundation.
9 */
10#ifndef _INDUSTRIAL_IO_H_
11#define _INDUSTRIAL_IO_H_
12
13#include <linux/device.h>
14#include <linux/cdev.h>
15#include <linux/iio/types.h>
16/* IIO TODO LIST */
17/*
18 * Provide means of adjusting timer accuracy.
19 * Currently assumes nano seconds.
20 */
21
22enum iio_chan_info_enum {
23 IIO_CHAN_INFO_RAW = 0,
24 IIO_CHAN_INFO_PROCESSED,
25 IIO_CHAN_INFO_SCALE,
26 IIO_CHAN_INFO_OFFSET,
27 IIO_CHAN_INFO_CALIBSCALE,
28 IIO_CHAN_INFO_CALIBBIAS,
29 IIO_CHAN_INFO_PEAK,
30 IIO_CHAN_INFO_PEAK_SCALE,
31 IIO_CHAN_INFO_QUADRATURE_CORRECTION_RAW,
32 IIO_CHAN_INFO_AVERAGE_RAW,
33 IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY,
34 IIO_CHAN_INFO_SAMP_FREQ,
35 IIO_CHAN_INFO_FREQUENCY,
36 IIO_CHAN_INFO_PHASE,
37 IIO_CHAN_INFO_HARDWAREGAIN,
38};
39
40#define IIO_CHAN_INFO_SHARED_BIT(type) BIT(type*2)
41#define IIO_CHAN_INFO_SEPARATE_BIT(type) BIT(type*2 + 1)
42
43#define IIO_CHAN_INFO_RAW_SEPARATE_BIT \
44 IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_RAW)
45#define IIO_CHAN_INFO_PROCESSED_SEPARATE_BIT \
46 IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_PROCESSED)
47#define IIO_CHAN_INFO_SCALE_SEPARATE_BIT \
48 IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_SCALE)
49#define IIO_CHAN_INFO_SCALE_SHARED_BIT \
50 IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_SCALE)
51#define IIO_CHAN_INFO_OFFSET_SEPARATE_BIT \
52 IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_OFFSET)
53#define IIO_CHAN_INFO_OFFSET_SHARED_BIT \
54 IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_OFFSET)
55#define IIO_CHAN_INFO_CALIBSCALE_SEPARATE_BIT \
56 IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_CALIBSCALE)
57#define IIO_CHAN_INFO_CALIBSCALE_SHARED_BIT \
58 IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_CALIBSCALE)
59#define IIO_CHAN_INFO_CALIBBIAS_SEPARATE_BIT \
60 IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_CALIBBIAS)
61#define IIO_CHAN_INFO_CALIBBIAS_SHARED_BIT \
62 IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_CALIBBIAS)
63#define IIO_CHAN_INFO_PEAK_SEPARATE_BIT \
64 IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_PEAK)
65#define IIO_CHAN_INFO_PEAK_SHARED_BIT \
66 IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_PEAK)
67#define IIO_CHAN_INFO_PEAKSCALE_SEPARATE_BIT \
68 IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_PEAKSCALE)
69#define IIO_CHAN_INFO_PEAKSCALE_SHARED_BIT \
70 IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_PEAKSCALE)
71#define IIO_CHAN_INFO_QUADRATURE_CORRECTION_RAW_SEPARATE_BIT \
72 IIO_CHAN_INFO_SEPARATE_BIT( \
73 IIO_CHAN_INFO_QUADRATURE_CORRECTION_RAW)
74#define IIO_CHAN_INFO_QUADRATURE_CORRECTION_RAW_SHARED_BIT \
75 IIO_CHAN_INFO_SHARED_BIT( \
76 IIO_CHAN_INFO_QUADRATURE_CORRECTION_RAW)
77#define IIO_CHAN_INFO_AVERAGE_RAW_SEPARATE_BIT \
78 IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_AVERAGE_RAW)
79#define IIO_CHAN_INFO_AVERAGE_RAW_SHARED_BIT \
80 IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_AVERAGE_RAW)
81#define IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY_SHARED_BIT \
82 IIO_CHAN_INFO_SHARED_BIT( \
83 IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY)
84#define IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY_SEPARATE_BIT \
85 IIO_CHAN_INFO_SEPARATE_BIT( \
86 IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY)
87#define IIO_CHAN_INFO_SAMP_FREQ_SEPARATE_BIT \
88 IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_SAMP_FREQ)
89#define IIO_CHAN_INFO_SAMP_FREQ_SHARED_BIT \
90 IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_SAMP_FREQ)
91#define IIO_CHAN_INFO_FREQUENCY_SEPARATE_BIT \
92 IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_FREQUENCY)
93#define IIO_CHAN_INFO_FREQUENCY_SHARED_BIT \
94 IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_FREQUENCY)
95#define IIO_CHAN_INFO_PHASE_SEPARATE_BIT \
96 IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_PHASE)
97#define IIO_CHAN_INFO_PHASE_SHARED_BIT \
98 IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_PHASE)
99#define IIO_CHAN_INFO_HARDWAREGAIN_SEPARATE_BIT \
100 IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_HARDWAREGAIN)
101#define IIO_CHAN_INFO_HARDWAREGAIN_SHARED_BIT \
102 IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_HARDWAREGAIN)
103
104enum iio_endian {
105 IIO_CPU,
106 IIO_BE,
107 IIO_LE,
108};
109
110struct iio_chan_spec;
111struct iio_dev;
112
113/**
114 * struct iio_chan_spec_ext_info - Extended channel info attribute
115 * @name: Info attribute name
116 * @shared: Whether this attribute is shared between all channels.
117 * @read: Read callback for this info attribute, may be NULL.
118 * @write: Write callback for this info attribute, may be NULL.
119 * @private: Data private to the driver.
120 */
121struct iio_chan_spec_ext_info {
122 const char *name;
123 bool shared;
124 ssize_t (*read)(struct iio_dev *, uintptr_t private,
125 struct iio_chan_spec const *, char *buf);
126 ssize_t (*write)(struct iio_dev *, uintptr_t private,
127 struct iio_chan_spec const *, const char *buf,
128 size_t len);
129 uintptr_t private;
130};
131
132/**
133 * struct iio_chan_spec - specification of a single channel
134 * @type: What type of measurement is the channel making.
135 * @channel: What number or name do we wish to assign the channel.
136 * @channel2: If there is a second number for a differential
137 * channel then this is it. If modified is set then the
138 * value here specifies the modifier.
139 * @address: Driver specific identifier.
140 * @scan_index: Monotonic index to give ordering in scans when read
141 * from a buffer.
142 * @scan_type: Sign: 's' or 'u' to specify signed or unsigned
143 * realbits: Number of valid bits of data
144 * storage_bits: Realbits + padding
145 * shift: Shift right by this before masking out
146 * realbits.
147 * endianness: little or big endian
148 * @info_mask: What information is to be exported about this channel.
149 * This includes calibbias, scale etc.
150 * @event_mask: What events can this channel produce.
151 * @ext_info: Array of extended info attributes for this channel.
152 * The array is NULL terminated, the last element should
153 * have it's name field set to NULL.
154 * @extend_name: Allows labeling of channel attributes with an
155 * informative name. Note this has no effect codes etc,
156 * unlike modifiers.
157 * @datasheet_name: A name used in in kernel mapping of channels. It should
158 * correspond to the first name that the channel is referred
159 * to by in the datasheet (e.g. IND), or the nearest
160 * possible compound name (e.g. IND-INC).
161 * @modified: Does a modifier apply to this channel. What these are
162 * depends on the channel type. Modifier is set in
163 * channel2. Examples are IIO_MOD_X for axial sensors about
164 * the 'x' axis.
165 * @indexed: Specify the channel has a numerical index. If not,
166 * the value in channel will be suppressed for attribute
167 * but not for event codes. Typically set it to 0 when
168 * the index is false.
169 * @differential: Channel is differential.
170 */
171struct iio_chan_spec {
172 enum iio_chan_type type;
173 int channel;
174 int channel2;
175 unsigned long address;
176 int scan_index;
177 struct {
178 char sign;
179 u8 realbits;
180 u8 storagebits;
181 u8 shift;
182 enum iio_endian endianness;
183 } scan_type;
184 long info_mask;
185 long event_mask;
186 const struct iio_chan_spec_ext_info *ext_info;
187 const char *extend_name;
188 const char *datasheet_name;
189 unsigned modified:1;
190 unsigned indexed:1;
191 unsigned output:1;
192 unsigned differential:1;
193};
194
195#define IIO_ST(si, rb, sb, sh) \
196 { .sign = si, .realbits = rb, .storagebits = sb, .shift = sh }
197
198#define IIO_CHAN_SOFT_TIMESTAMP(_si) \
199 { .type = IIO_TIMESTAMP, .channel = -1, \
200 .scan_index = _si, .scan_type = IIO_ST('s', 64, 64, 0) }
201
202/**
203 * iio_get_time_ns() - utility function to get a time stamp for events etc
204 **/
205static inline s64 iio_get_time_ns(void)
206{
207 struct timespec ts;
208 /*
209 * calls getnstimeofday.
210 * If hrtimers then up to ns accurate, if not microsecond.
211 */
212 ktime_get_real_ts(&ts);
213
214 return timespec_to_ns(&ts);
215}
216
217/* Device operating modes */
218#define INDIO_DIRECT_MODE 0x01
219#define INDIO_BUFFER_TRIGGERED 0x02
220#define INDIO_BUFFER_HARDWARE 0x08
221
222#define INDIO_ALL_BUFFER_MODES \
223 (INDIO_BUFFER_TRIGGERED | INDIO_BUFFER_HARDWARE)
224
225struct iio_trigger; /* forward declaration */
226struct iio_dev;
227
228/**
229 * struct iio_info - constant information about device
230 * @driver_module: module structure used to ensure correct
231 * ownership of chrdevs etc
232 * @event_attrs: event control attributes
233 * @attrs: general purpose device attributes
234 * @read_raw: function to request a value from the device.
235 * mask specifies which value. Note 0 means a reading of
236 * the channel in question. Return value will specify the
237 * type of value returned by the device. val and val2 will
238 * contain the elements making up the returned value.
239 * @write_raw: function to write a value to the device.
240 * Parameters are the same as for read_raw.
241 * @write_raw_get_fmt: callback function to query the expected
242 * format/precision. If not set by the driver, write_raw
243 * returns IIO_VAL_INT_PLUS_MICRO.
244 * @read_event_config: find out if the event is enabled.
245 * @write_event_config: set if the event is enabled.
246 * @read_event_value: read a value associated with the event. Meaning
247 * is event dependant. event_code specifies which event.
248 * @write_event_value: write the value associated with the event.
249 * Meaning is event dependent.
250 * @validate_trigger: function to validate the trigger when the
251 * current trigger gets changed.
252 **/
253struct iio_info {
254 struct module *driver_module;
255 struct attribute_group *event_attrs;
256 const struct attribute_group *attrs;
257
258 int (*read_raw)(struct iio_dev *indio_dev,
259 struct iio_chan_spec const *chan,
260 int *val,
261 int *val2,
262 long mask);
263
264 int (*write_raw)(struct iio_dev *indio_dev,
265 struct iio_chan_spec const *chan,
266 int val,
267 int val2,
268 long mask);
269
270 int (*write_raw_get_fmt)(struct iio_dev *indio_dev,
271 struct iio_chan_spec const *chan,
272 long mask);
273
274 int (*read_event_config)(struct iio_dev *indio_dev,
275 u64 event_code);
276
277 int (*write_event_config)(struct iio_dev *indio_dev,
278 u64 event_code,
279 int state);
280
281 int (*read_event_value)(struct iio_dev *indio_dev,
282 u64 event_code,
283 int *val);
284 int (*write_event_value)(struct iio_dev *indio_dev,
285 u64 event_code,
286 int val);
287 int (*validate_trigger)(struct iio_dev *indio_dev,
288 struct iio_trigger *trig);
289 int (*update_scan_mode)(struct iio_dev *indio_dev,
290 const unsigned long *scan_mask);
291 int (*debugfs_reg_access)(struct iio_dev *indio_dev,
292 unsigned reg, unsigned writeval,
293 unsigned *readval);
294};
295
296/**
297 * struct iio_buffer_setup_ops - buffer setup related callbacks
298 * @preenable: [DRIVER] function to run prior to marking buffer enabled
299 * @postenable: [DRIVER] function to run after marking buffer enabled
300 * @predisable: [DRIVER] function to run prior to marking buffer
301 * disabled
302 * @postdisable: [DRIVER] function to run after marking buffer disabled
303 */
304struct iio_buffer_setup_ops {
305 int (*preenable)(struct iio_dev *);
306 int (*postenable)(struct iio_dev *);
307 int (*predisable)(struct iio_dev *);
308 int (*postdisable)(struct iio_dev *);
309};
310
311/**
312 * struct iio_dev - industrial I/O device
313 * @id: [INTERN] used to identify device internally
314 * @modes: [DRIVER] operating modes supported by device
315 * @currentmode: [DRIVER] current operating mode
316 * @dev: [DRIVER] device structure, should be assigned a parent
317 * and owner
318 * @event_interface: [INTERN] event chrdevs associated with interrupt lines
319 * @buffer: [DRIVER] any buffer present
320 * @scan_bytes: [INTERN] num bytes captured to be fed to buffer demux
321 * @mlock: [INTERN] lock used to prevent simultaneous device state
322 * changes
323 * @available_scan_masks: [DRIVER] optional array of allowed bitmasks
324 * @masklength: [INTERN] the length of the mask established from
325 * channels
326 * @active_scan_mask: [INTERN] union of all scan masks requested by buffers
327 * @scan_timestamp: [INTERN] set if any buffers have requested timestamp
328 * @scan_index_timestamp:[INTERN] cache of the index to the timestamp
329 * @trig: [INTERN] current device trigger (buffer modes)
330 * @pollfunc: [DRIVER] function run on trigger being received
331 * @channels: [DRIVER] channel specification structure table
332 * @num_channels: [DRIVER] number of chanels specified in @channels.
333 * @channel_attr_list: [INTERN] keep track of automatically created channel
334 * attributes
335 * @chan_attr_group: [INTERN] group for all attrs in base directory
336 * @name: [DRIVER] name of the device.
337 * @info: [DRIVER] callbacks and constant info from driver
338 * @info_exist_lock: [INTERN] lock to prevent use during removal
339 * @setup_ops: [DRIVER] callbacks to call before and after buffer
340 * enable/disable
341 * @chrdev: [INTERN] associated character device
342 * @groups: [INTERN] attribute groups
343 * @groupcounter: [INTERN] index of next attribute group
344 * @flags: [INTERN] file ops related flags including busy flag.
345 * @debugfs_dentry: [INTERN] device specific debugfs dentry.
346 * @cached_reg_addr: [INTERN] cached register address for debugfs reads.
347 */
348struct iio_dev {
349 int id;
350
351 int modes;
352 int currentmode;
353 struct device dev;
354
355 struct iio_event_interface *event_interface;
356
357 struct iio_buffer *buffer;
358 int scan_bytes;
359 struct mutex mlock;
360
361 const unsigned long *available_scan_masks;
362 unsigned masklength;
363 const unsigned long *active_scan_mask;
364 bool scan_timestamp;
365 unsigned scan_index_timestamp;
366 struct iio_trigger *trig;
367 struct iio_poll_func *pollfunc;
368
369 struct iio_chan_spec const *channels;
370 int num_channels;
371
372 struct list_head channel_attr_list;
373 struct attribute_group chan_attr_group;
374 const char *name;
375 const struct iio_info *info;
376 struct mutex info_exist_lock;
377 const struct iio_buffer_setup_ops *setup_ops;
378 struct cdev chrdev;
379#define IIO_MAX_GROUPS 6
380 const struct attribute_group *groups[IIO_MAX_GROUPS + 1];
381 int groupcounter;
382
383 unsigned long flags;
384#if defined(CONFIG_DEBUG_FS)
385 struct dentry *debugfs_dentry;
386 unsigned cached_reg_addr;
387#endif
388};
389
390/**
391 * iio_find_channel_from_si() - get channel from its scan index
392 * @indio_dev: device
393 * @si: scan index to match
394 */
395const struct iio_chan_spec
396*iio_find_channel_from_si(struct iio_dev *indio_dev, int si);
397
398/**
399 * iio_device_register() - register a device with the IIO subsystem
400 * @indio_dev: Device structure filled by the device driver
401 **/
402int iio_device_register(struct iio_dev *indio_dev);
403
404/**
405 * iio_device_unregister() - unregister a device from the IIO subsystem
406 * @indio_dev: Device structure representing the device.
407 **/
408void iio_device_unregister(struct iio_dev *indio_dev);
409
410/**
411 * iio_push_event() - try to add event to the list for userspace reading
412 * @indio_dev: IIO device structure
413 * @ev_code: What event
414 * @timestamp: When the event occurred
415 **/
416int iio_push_event(struct iio_dev *indio_dev, u64 ev_code, s64 timestamp);
417
418extern struct bus_type iio_bus_type;
419
420/**
421 * iio_device_put() - reference counted deallocation of struct device
422 * @dev: the iio_device containing the device
423 **/
424static inline void iio_device_put(struct iio_dev *indio_dev)
425{
426 if (indio_dev)
427 put_device(&indio_dev->dev);
428};
429
430/**
431 * dev_to_iio_dev() - Get IIO device struct from a device struct
432 * @dev: The device embedded in the IIO device
433 *
434 * Note: The device must be a IIO device, otherwise the result is undefined.
435 */
436static inline struct iio_dev *dev_to_iio_dev(struct device *dev)
437{
438 return container_of(dev, struct iio_dev, dev);
439}
440
441/* Can we make this smaller? */
442#define IIO_ALIGN L1_CACHE_BYTES
443/**
444 * iio_device_alloc() - allocate an iio_dev from a driver
445 * @sizeof_priv: Space to allocate for private structure.
446 **/
447struct iio_dev *iio_device_alloc(int sizeof_priv);
448
449static inline void *iio_priv(const struct iio_dev *indio_dev)
450{
451 return (char *)indio_dev + ALIGN(sizeof(struct iio_dev), IIO_ALIGN);
452}
453
454static inline struct iio_dev *iio_priv_to_dev(void *priv)
455{
456 return (struct iio_dev *)((char *)priv -
457 ALIGN(sizeof(struct iio_dev), IIO_ALIGN));
458}
459
460/**
461 * iio_device_free() - free an iio_dev from a driver
462 * @dev: the iio_dev associated with the device
463 **/
464void iio_device_free(struct iio_dev *indio_dev);
465
466/**
467 * iio_buffer_enabled() - helper function to test if the buffer is enabled
468 * @indio_dev: IIO device info structure for device
469 **/
470static inline bool iio_buffer_enabled(struct iio_dev *indio_dev)
471{
472 return indio_dev->currentmode
473 & (INDIO_BUFFER_TRIGGERED | INDIO_BUFFER_HARDWARE);
474};
475
476/**
477 * iio_get_debugfs_dentry() - helper function to get the debugfs_dentry
478 * @indio_dev: IIO device info structure for device
479 **/
480#if defined(CONFIG_DEBUG_FS)
481static inline struct dentry *iio_get_debugfs_dentry(struct iio_dev *indio_dev)
482{
483 return indio_dev->debugfs_dentry;
484};
485#else
486static inline struct dentry *iio_get_debugfs_dentry(struct iio_dev *indio_dev)
487{
488 return NULL;
489};
490#endif
491
492#endif /* _INDUSTRIAL_IO_H_ */
diff --git a/include/linux/iio/kfifo_buf.h b/include/linux/iio/kfifo_buf.h
new file mode 100644
index 000000000000..014d5a13b32b
--- /dev/null
+++ b/include/linux/iio/kfifo_buf.h
@@ -0,0 +1,8 @@
1
2#include <linux/kfifo.h>
3#include <linux/iio/iio.h>
4#include <linux/iio/buffer.h>
5
6struct iio_buffer *iio_kfifo_allocate(struct iio_dev *indio_dev);
7void iio_kfifo_free(struct iio_buffer *r);
8
diff --git a/include/linux/iio/machine.h b/include/linux/iio/machine.h
new file mode 100644
index 000000000000..0b1f19bfdc44
--- /dev/null
+++ b/include/linux/iio/machine.h
@@ -0,0 +1,24 @@
1/*
2 * Industrial I/O in kernel access map definitions for board files.
3 *
4 * Copyright (c) 2011 Jonathan Cameron
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published by
8 * the Free Software Foundation.
9 */
10
11/**
12 * struct iio_map - description of link between consumer and device channels
13 * @adc_channel_label: Label used to identify the channel on the provider.
14 * This is matched against the datasheet_name element
15 * of struct iio_chan_spec.
16 * @consumer_dev_name: Name to uniquely identify the consumer device.
17 * @consumer_channel: Unique name used to idenitify the channel on the
18 * consumer side.
19 */
20struct iio_map {
21 const char *adc_channel_label;
22 const char *consumer_dev_name;
23 const char *consumer_channel;
24};
diff --git a/include/linux/iio/sysfs.h b/include/linux/iio/sysfs.h
new file mode 100644
index 000000000000..bfedb73b850e
--- /dev/null
+++ b/include/linux/iio/sysfs.h
@@ -0,0 +1,117 @@
1/* The industrial I/O core
2 *
3 *Copyright (c) 2008 Jonathan Cameron
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 as published by
7 * the Free Software Foundation.
8 *
9 * General attributes
10 */
11
12#ifndef _INDUSTRIAL_IO_SYSFS_H_
13#define _INDUSTRIAL_IO_SYSFS_H_
14
15struct iio_chan_spec;
16
17/**
18 * struct iio_dev_attr - iio specific device attribute
19 * @dev_attr: underlying device attribute
20 * @address: associated register address
21 * @l: list head for maintaining list of dynamically created attrs.
22 */
23struct iio_dev_attr {
24 struct device_attribute dev_attr;
25 u64 address;
26 struct list_head l;
27 struct iio_chan_spec const *c;
28};
29
30#define to_iio_dev_attr(_dev_attr) \
31 container_of(_dev_attr, struct iio_dev_attr, dev_attr)
32
33ssize_t iio_read_const_attr(struct device *dev,
34 struct device_attribute *attr,
35 char *len);
36
37/**
38 * struct iio_const_attr - constant device specific attribute
39 * often used for things like available modes
40 * @string: attribute string
41 * @dev_attr: underlying device attribute
42 */
43struct iio_const_attr {
44 const char *string;
45 struct device_attribute dev_attr;
46};
47
48#define to_iio_const_attr(_dev_attr) \
49 container_of(_dev_attr, struct iio_const_attr, dev_attr)
50
51/* Some attributes will be hard coded (device dependent) and not require an
52 address, in these cases pass a negative */
53#define IIO_ATTR(_name, _mode, _show, _store, _addr) \
54 { .dev_attr = __ATTR(_name, _mode, _show, _store), \
55 .address = _addr }
56
57#define IIO_DEVICE_ATTR(_name, _mode, _show, _store, _addr) \
58 struct iio_dev_attr iio_dev_attr_##_name \
59 = IIO_ATTR(_name, _mode, _show, _store, _addr)
60
61#define IIO_DEVICE_ATTR_NAMED(_vname, _name, _mode, _show, _store, _addr) \
62 struct iio_dev_attr iio_dev_attr_##_vname \
63 = IIO_ATTR(_name, _mode, _show, _store, _addr)
64
65#define IIO_CONST_ATTR(_name, _string) \
66 struct iio_const_attr iio_const_attr_##_name \
67 = { .string = _string, \
68 .dev_attr = __ATTR(_name, S_IRUGO, iio_read_const_attr, NULL)}
69
70#define IIO_CONST_ATTR_NAMED(_vname, _name, _string) \
71 struct iio_const_attr iio_const_attr_##_vname \
72 = { .string = _string, \
73 .dev_attr = __ATTR(_name, S_IRUGO, iio_read_const_attr, NULL)}
74
75/* Generic attributes of onetype or another */
76/**
77 * IIO_DEV_ATTR_RESET: resets the device
78 **/
79#define IIO_DEV_ATTR_RESET(_store) \
80 IIO_DEVICE_ATTR(reset, S_IWUSR, NULL, _store, 0)
81
82/**
83 * IIO_DEV_ATTR_SAMP_FREQ - sets any internal clock frequency
84 * @_mode: sysfs file mode/permissions
85 * @_show: output method for the attribute
86 * @_store: input method for the attribute
87 **/
88#define IIO_DEV_ATTR_SAMP_FREQ(_mode, _show, _store) \
89 IIO_DEVICE_ATTR(sampling_frequency, _mode, _show, _store, 0)
90
91/**
92 * IIO_DEV_ATTR_SAMP_FREQ_AVAIL - list available sampling frequencies
93 * @_show: output method for the attribute
94 *
95 * May be mode dependent on some devices
96 **/
97#define IIO_DEV_ATTR_SAMP_FREQ_AVAIL(_show) \
98 IIO_DEVICE_ATTR(sampling_frequency_available, S_IRUGO, _show, NULL, 0)
99/**
100 * IIO_CONST_ATTR_AVAIL_SAMP_FREQ - list available sampling frequencies
101 * @_string: frequency string for the attribute
102 *
103 * Constant version
104 **/
105#define IIO_CONST_ATTR_SAMP_FREQ_AVAIL(_string) \
106 IIO_CONST_ATTR(sampling_frequency_available, _string)
107
108#define IIO_DEV_ATTR_TEMP_RAW(_show) \
109 IIO_DEVICE_ATTR(in_temp_raw, S_IRUGO, _show, NULL, 0)
110
111#define IIO_CONST_ATTR_TEMP_OFFSET(_string) \
112 IIO_CONST_ATTR(in_temp_offset, _string)
113
114#define IIO_CONST_ATTR_TEMP_SCALE(_string) \
115 IIO_CONST_ATTR(in_temp_scale, _string)
116
117#endif /* _INDUSTRIAL_IO_SYSFS_H_ */
diff --git a/include/linux/iio/trigger.h b/include/linux/iio/trigger.h
new file mode 100644
index 000000000000..a9819940a84c
--- /dev/null
+++ b/include/linux/iio/trigger.h
@@ -0,0 +1,119 @@
1/* The industrial I/O core, trigger handling functions
2 *
3 * Copyright (c) 2008 Jonathan Cameron
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 as published by
7 * the Free Software Foundation.
8 */
9#include <linux/irq.h>
10#include <linux/module.h>
11
12#ifndef _IIO_TRIGGER_H_
13#define _IIO_TRIGGER_H_
14
15struct iio_subirq {
16 bool enabled;
17};
18
19/**
20 * struct iio_trigger_ops - operations structure for an iio_trigger.
21 * @owner: used to monitor usage count of the trigger.
22 * @set_trigger_state: switch on/off the trigger on demand
23 * @try_reenable: function to reenable the trigger when the
24 * use count is zero (may be NULL)
25 * @validate_device: function to validate the device when the
26 * current trigger gets changed.
27 *
28 * This is typically static const within a driver and shared by
29 * instances of a given device.
30 **/
31struct iio_trigger_ops {
32 struct module *owner;
33 int (*set_trigger_state)(struct iio_trigger *trig, bool state);
34 int (*try_reenable)(struct iio_trigger *trig);
35 int (*validate_device)(struct iio_trigger *trig,
36 struct iio_dev *indio_dev);
37};
38
39
40/**
41 * struct iio_trigger - industrial I/O trigger device
42 *
43 * @id: [INTERN] unique id number
44 * @name: [DRIVER] unique name
45 * @dev: [DRIVER] associated device (if relevant)
46 * @private_data: [DRIVER] device specific data
47 * @list: [INTERN] used in maintenance of global trigger list
48 * @alloc_list: [DRIVER] used for driver specific trigger list
49 * @use_count: use count for the trigger
50 * @subirq_chip: [INTERN] associate 'virtual' irq chip.
51 * @subirq_base: [INTERN] base number for irqs provided by trigger.
52 * @subirqs: [INTERN] information about the 'child' irqs.
53 * @pool: [INTERN] bitmap of irqs currently in use.
54 * @pool_lock: [INTERN] protection of the irq pool.
55 **/
56struct iio_trigger {
57 const struct iio_trigger_ops *ops;
58 int id;
59 const char *name;
60 struct device dev;
61
62 void *private_data;
63 struct list_head list;
64 struct list_head alloc_list;
65 int use_count;
66
67 struct irq_chip subirq_chip;
68 int subirq_base;
69
70 struct iio_subirq subirqs[CONFIG_IIO_CONSUMERS_PER_TRIGGER];
71 unsigned long pool[BITS_TO_LONGS(CONFIG_IIO_CONSUMERS_PER_TRIGGER)];
72 struct mutex pool_lock;
73};
74
75
76static inline struct iio_trigger *to_iio_trigger(struct device *d)
77{
78 return container_of(d, struct iio_trigger, dev);
79};
80
81static inline void iio_trigger_put(struct iio_trigger *trig)
82{
83 module_put(trig->ops->owner);
84 put_device(&trig->dev);
85};
86
87static inline void iio_trigger_get(struct iio_trigger *trig)
88{
89 get_device(&trig->dev);
90 __module_get(trig->ops->owner);
91};
92
93/**
94 * iio_trigger_register() - register a trigger with the IIO core
95 * @trig_info: trigger to be registered
96 **/
97int iio_trigger_register(struct iio_trigger *trig_info);
98
99/**
100 * iio_trigger_unregister() - unregister a trigger from the core
101 * @trig_info: trigger to be unregistered
102 **/
103void iio_trigger_unregister(struct iio_trigger *trig_info);
104
105/**
106 * iio_trigger_poll() - called on a trigger occurring
107 * @trig: trigger which occurred
108 *
109 * Typically called in relevant hardware interrupt handler.
110 **/
111void iio_trigger_poll(struct iio_trigger *trig, s64 time);
112void iio_trigger_poll_chained(struct iio_trigger *trig, s64 time);
113
114irqreturn_t iio_trigger_generic_data_rdy_poll(int irq, void *private);
115
116__printf(1, 2) struct iio_trigger *iio_trigger_alloc(const char *fmt, ...);
117void iio_trigger_free(struct iio_trigger *trig);
118
119#endif /* _IIO_TRIGGER_H_ */
diff --git a/include/linux/iio/trigger_consumer.h b/include/linux/iio/trigger_consumer.h
new file mode 100644
index 000000000000..60d64b356945
--- /dev/null
+++ b/include/linux/iio/trigger_consumer.h
@@ -0,0 +1,52 @@
1/* The industrial I/O core, trigger consumer functions
2 *
3 * Copyright (c) 2008-2011 Jonathan Cameron
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 as published by
7 * the Free Software Foundation.
8 */
9
10/**
11 * struct iio_poll_func - poll function pair
12 *
13 * @indio_dev: data specific to device (passed into poll func)
14 * @h: the function that is actually run on trigger
15 * @thread: threaded interrupt part
16 * @type: the type of interrupt (basically if oneshot)
17 * @name: name used to identify the trigger consumer.
18 * @irq: the corresponding irq as allocated from the
19 * trigger pool
20 * @timestamp: some devices need a timestamp grabbed as soon
21 * as possible after the trigger - hence handler
22 * passes it via here.
23 **/
24struct iio_poll_func {
25 struct iio_dev *indio_dev;
26 irqreturn_t (*h)(int irq, void *p);
27 irqreturn_t (*thread)(int irq, void *p);
28 int type;
29 char *name;
30 int irq;
31 s64 timestamp;
32};
33
34
35struct iio_poll_func
36*iio_alloc_pollfunc(irqreturn_t (*h)(int irq, void *p),
37 irqreturn_t (*thread)(int irq, void *p),
38 int type,
39 struct iio_dev *indio_dev,
40 const char *fmt,
41 ...);
42void iio_dealloc_pollfunc(struct iio_poll_func *pf);
43irqreturn_t iio_pollfunc_store_time(int irq, void *p);
44
45void iio_trigger_notify_done(struct iio_trigger *trig);
46
47/*
48 * Two functions for common case where all that happens is a pollfunc
49 * is attached and detached from a trigger
50 */
51int iio_triggered_buffer_postenable(struct iio_dev *indio_dev);
52int iio_triggered_buffer_predisable(struct iio_dev *indio_dev);
diff --git a/include/linux/iio/types.h b/include/linux/iio/types.h
new file mode 100644
index 000000000000..1b073b1cc7c2
--- /dev/null
+++ b/include/linux/iio/types.h
@@ -0,0 +1,55 @@
1/* industrial I/O data types needed both in and out of kernel
2 *
3 * Copyright (c) 2008 Jonathan Cameron
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 as published by
7 * the Free Software Foundation.
8 */
9
10#ifndef _IIO_TYPES_H_
11#define _IIO_TYPES_H_
12
13enum iio_chan_type {
14 /* real channel types */
15 IIO_VOLTAGE,
16 IIO_CURRENT,
17 IIO_POWER,
18 IIO_ACCEL,
19 IIO_ANGL_VEL,
20 IIO_MAGN,
21 IIO_LIGHT,
22 IIO_INTENSITY,
23 IIO_PROXIMITY,
24 IIO_TEMP,
25 IIO_INCLI,
26 IIO_ROT,
27 IIO_ANGL,
28 IIO_TIMESTAMP,
29 IIO_CAPACITANCE,
30 IIO_ALTVOLTAGE,
31};
32
33enum iio_modifier {
34 IIO_NO_MOD,
35 IIO_MOD_X,
36 IIO_MOD_Y,
37 IIO_MOD_Z,
38 IIO_MOD_X_AND_Y,
39 IIO_MOD_X_AND_Z,
40 IIO_MOD_Y_AND_Z,
41 IIO_MOD_X_AND_Y_AND_Z,
42 IIO_MOD_X_OR_Y,
43 IIO_MOD_X_OR_Z,
44 IIO_MOD_Y_OR_Z,
45 IIO_MOD_X_OR_Y_OR_Z,
46 IIO_MOD_LIGHT_BOTH,
47 IIO_MOD_LIGHT_IR,
48};
49
50#define IIO_VAL_INT 1
51#define IIO_VAL_INT_PLUS_MICRO 2
52#define IIO_VAL_INT_PLUS_NANO 3
53#define IIO_VAL_INT_PLUS_MICRO_DB 4
54
55#endif /* _IIO_TYPES_H_ */
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 2aea5d22db07..c91171599cb6 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -93,27 +93,27 @@ typedef irqreturn_t (*irq_handler_t)(int, void *);
93/** 93/**
94 * struct irqaction - per interrupt action descriptor 94 * struct irqaction - per interrupt action descriptor
95 * @handler: interrupt handler function 95 * @handler: interrupt handler function
96 * @flags: flags (see IRQF_* above)
97 * @name: name of the device 96 * @name: name of the device
98 * @dev_id: cookie to identify the device 97 * @dev_id: cookie to identify the device
99 * @percpu_dev_id: cookie to identify the device 98 * @percpu_dev_id: cookie to identify the device
100 * @next: pointer to the next irqaction for shared interrupts 99 * @next: pointer to the next irqaction for shared interrupts
101 * @irq: interrupt number 100 * @irq: interrupt number
102 * @dir: pointer to the proc/irq/NN/name entry 101 * @flags: flags (see IRQF_* above)
103 * @thread_fn: interrupt handler function for threaded interrupts 102 * @thread_fn: interrupt handler function for threaded interrupts
104 * @thread: thread pointer for threaded interrupts 103 * @thread: thread pointer for threaded interrupts
105 * @thread_flags: flags related to @thread 104 * @thread_flags: flags related to @thread
106 * @thread_mask: bitmask for keeping track of @thread activity 105 * @thread_mask: bitmask for keeping track of @thread activity
106 * @dir: pointer to the proc/irq/NN/name entry
107 */ 107 */
108struct irqaction { 108struct irqaction {
109 irq_handler_t handler; 109 irq_handler_t handler;
110 unsigned long flags;
111 void *dev_id; 110 void *dev_id;
112 void __percpu *percpu_dev_id; 111 void __percpu *percpu_dev_id;
113 struct irqaction *next; 112 struct irqaction *next;
114 int irq;
115 irq_handler_t thread_fn; 113 irq_handler_t thread_fn;
116 struct task_struct *thread; 114 struct task_struct *thread;
115 unsigned int irq;
116 unsigned int flags;
117 unsigned long thread_flags; 117 unsigned long thread_flags;
118 unsigned long thread_mask; 118 unsigned long thread_mask;
119 const char *name; 119 const char *name;
diff --git a/include/linux/ioport.h b/include/linux/ioport.h
index e885ba23de70..589e0e75efae 100644
--- a/include/linux/ioport.h
+++ b/include/linux/ioport.h
@@ -223,5 +223,12 @@ extern int
223walk_system_ram_range(unsigned long start_pfn, unsigned long nr_pages, 223walk_system_ram_range(unsigned long start_pfn, unsigned long nr_pages,
224 void *arg, int (*func)(unsigned long, unsigned long, void *)); 224 void *arg, int (*func)(unsigned long, unsigned long, void *));
225 225
226/* True if any part of r1 overlaps r2 */
227static inline bool resource_overlaps(struct resource *r1, struct resource *r2)
228{
229 return (r1->start <= r2->end && r1->end >= r2->start);
230}
231
232
226#endif /* __ASSEMBLY__ */ 233#endif /* __ASSEMBLY__ */
227#endif /* _LINUX_IOPORT_H */ 234#endif /* _LINUX_IOPORT_H */
diff --git a/include/linux/irq.h b/include/linux/irq.h
index b27cfcfd3a59..61f5cec031e0 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -335,11 +335,6 @@ struct irq_chip {
335 void (*irq_print_chip)(struct irq_data *data, struct seq_file *p); 335 void (*irq_print_chip)(struct irq_data *data, struct seq_file *p);
336 336
337 unsigned long flags; 337 unsigned long flags;
338
339 /* Currently used only by UML, might disappear one day.*/
340#ifdef CONFIG_IRQ_RELEASE_METHOD
341 void (*release)(unsigned int irq, void *dev_id);
342#endif
343}; 338};
344 339
345/* 340/*
diff --git a/include/linux/isdn.h b/include/linux/isdn.h
index 292f27a793d4..215c41602af8 100644
--- a/include/linux/isdn.h
+++ b/include/linux/isdn.h
@@ -15,6 +15,7 @@
15#define __ISDN_H__ 15#define __ISDN_H__
16 16
17#include <linux/ioctl.h> 17#include <linux/ioctl.h>
18#include <linux/tty.h>
18 19
19#define ISDN_MAX_DRIVERS 32 20#define ISDN_MAX_DRIVERS 32
20#define ISDN_MAX_CHANNELS 64 21#define ISDN_MAX_CHANNELS 64
@@ -392,21 +393,8 @@ typedef struct isdn_net_dev_s {
392/*======================= Start of ISDN-tty stuff ===========================*/ 393/*======================= Start of ISDN-tty stuff ===========================*/
393 394
394#define ISDN_ASYNC_MAGIC 0x49344C01 /* for paranoia-checking */ 395#define ISDN_ASYNC_MAGIC 0x49344C01 /* for paranoia-checking */
395#define ISDN_ASYNC_INITIALIZED 0x80000000 /* port was initialized */
396#define ISDN_ASYNC_CALLOUT_ACTIVE 0x40000000 /* Call out device active */
397#define ISDN_ASYNC_NORMAL_ACTIVE 0x20000000 /* Normal device active */
398#define ISDN_ASYNC_CLOSING 0x08000000 /* Serial port is closing */
399#define ISDN_ASYNC_CTS_FLOW 0x04000000 /* Do CTS flow control */
400#define ISDN_ASYNC_CHECK_CD 0x02000000 /* i.e., CLOCAL */
401#define ISDN_ASYNC_HUP_NOTIFY 0x0001 /* Notify tty on hangups/closes */
402#define ISDN_ASYNC_SESSION_LOCKOUT 0x0100 /* Lock cua opens on session */
403#define ISDN_ASYNC_PGRP_LOCKOUT 0x0200 /* Lock cua opens on pgrp */
404#define ISDN_ASYNC_CALLOUT_NOHUP 0x0400 /* No hangup for cui */
405#define ISDN_ASYNC_SPLIT_TERMIOS 0x0008 /* Sep. termios for dialin/out */
406#define ISDN_SERIAL_XMIT_SIZE 1024 /* Default bufsize for write */ 396#define ISDN_SERIAL_XMIT_SIZE 1024 /* Default bufsize for write */
407#define ISDN_SERIAL_XMIT_MAX 4000 /* Maximum bufsize for write */ 397#define ISDN_SERIAL_XMIT_MAX 4000 /* Maximum bufsize for write */
408#define ISDN_SERIAL_TYPE_NORMAL 1
409#define ISDN_SERIAL_TYPE_CALLOUT 2
410 398
411#ifdef CONFIG_ISDN_AUDIO 399#ifdef CONFIG_ISDN_AUDIO
412/* For using sk_buffs with audio we need some private variables 400/* For using sk_buffs with audio we need some private variables
@@ -448,17 +436,12 @@ typedef struct atemu {
448/* Private data (similar to async_struct in <linux/serial.h>) */ 436/* Private data (similar to async_struct in <linux/serial.h>) */
449typedef struct modem_info { 437typedef struct modem_info {
450 int magic; 438 int magic;
451 struct module *owner; 439 struct tty_port port;
452 int flags; /* defined in tty.h */
453 int x_char; /* xon/xoff character */ 440 int x_char; /* xon/xoff character */
454 int mcr; /* Modem control register */ 441 int mcr; /* Modem control register */
455 int msr; /* Modem status register */ 442 int msr; /* Modem status register */
456 int lsr; /* Line status register */ 443 int lsr; /* Line status register */
457 int line; 444 int line;
458 int count; /* # of fd on device */
459 int blocked_open; /* # of blocked opens */
460 long session; /* Session of opening process */
461 long pgrp; /* pgrp of opening process */
462 int online; /* 1 = B-Channel is up, drop data */ 445 int online; /* 1 = B-Channel is up, drop data */
463 /* 2 = B-Channel is up, deliver d.*/ 446 /* 2 = B-Channel is up, deliver d.*/
464 int dialing; /* Dial in progress or ATA */ 447 int dialing; /* Dial in progress or ATA */
@@ -478,7 +461,6 @@ typedef struct modem_info {
478 int send_outstanding;/* # of outstanding send-requests */ 461 int send_outstanding;/* # of outstanding send-requests */
479 int xmit_size; /* max. # of chars in xmit_buf */ 462 int xmit_size; /* max. # of chars in xmit_buf */
480 int xmit_count; /* # of chars in xmit_buf */ 463 int xmit_count; /* # of chars in xmit_buf */
481 unsigned char *xmit_buf; /* transmit buffer */
482 struct sk_buff_head xmit_queue; /* transmit queue */ 464 struct sk_buff_head xmit_queue; /* transmit queue */
483 atomic_t xmit_lock; /* Semaphore for isdn_tty_write */ 465 atomic_t xmit_lock; /* Semaphore for isdn_tty_write */
484#ifdef CONFIG_ISDN_AUDIO 466#ifdef CONFIG_ISDN_AUDIO
@@ -496,11 +478,7 @@ typedef struct modem_info {
496 struct T30_s *fax; /* T30 Fax Group 3 data/interface */ 478 struct T30_s *fax; /* T30 Fax Group 3 data/interface */
497 int faxonline; /* Fax-channel status */ 479 int faxonline; /* Fax-channel status */
498#endif 480#endif
499 struct tty_struct *tty; /* Pointer to corresponding tty */
500 atemu emu; /* AT-emulator data */ 481 atemu emu; /* AT-emulator data */
501 struct ktermios normal_termios; /* For saving termios structs */
502 struct ktermios callout_termios;
503 wait_queue_head_t open_wait, close_wait;
504 spinlock_t readlock; 482 spinlock_t readlock;
505} modem_info; 483} modem_info;
506 484
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 645231c373c8..c0d34420a913 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -480,15 +480,16 @@ do { \
480 480
481#define trace_printk(fmt, args...) \ 481#define trace_printk(fmt, args...) \
482do { \ 482do { \
483 static const char *trace_printk_fmt \
484 __attribute__((section("__trace_printk_fmt"))) = \
485 __builtin_constant_p(fmt) ? fmt : NULL; \
486 \
483 __trace_printk_check_format(fmt, ##args); \ 487 __trace_printk_check_format(fmt, ##args); \
484 if (__builtin_constant_p(fmt)) { \
485 static const char *trace_printk_fmt \
486 __attribute__((section("__trace_printk_fmt"))) = \
487 __builtin_constant_p(fmt) ? fmt : NULL; \
488 \ 488 \
489 if (__builtin_constant_p(fmt)) \
489 __trace_bprintk(_THIS_IP_, trace_printk_fmt, ##args); \ 490 __trace_bprintk(_THIS_IP_, trace_printk_fmt, ##args); \
490 } else \ 491 else \
491 __trace_printk(_THIS_IP_, fmt, ##args); \ 492 __trace_printk(_THIS_IP_, fmt, ##args); \
492} while (0) 493} while (0)
493 494
494extern __printf(2, 3) 495extern __printf(2, 3)
diff --git a/include/linux/key.h b/include/linux/key.h
index 96933b1e5d24..5231800770e1 100644
--- a/include/linux/key.h
+++ b/include/linux/key.h
@@ -124,7 +124,10 @@ static inline unsigned long is_key_possessed(const key_ref_t key_ref)
124struct key { 124struct key {
125 atomic_t usage; /* number of references */ 125 atomic_t usage; /* number of references */
126 key_serial_t serial; /* key serial number */ 126 key_serial_t serial; /* key serial number */
127 struct rb_node serial_node; 127 union {
128 struct list_head graveyard_link;
129 struct rb_node serial_node;
130 };
128 struct key_type *type; /* type of key */ 131 struct key_type *type; /* type of key */
129 struct rw_semaphore sem; /* change vs change sem */ 132 struct rw_semaphore sem; /* change vs change sem */
130 struct key_user *user; /* owner of this key */ 133 struct key_user *user; /* owner of this key */
@@ -133,6 +136,7 @@ struct key {
133 time_t expiry; /* time at which key expires (or 0) */ 136 time_t expiry; /* time at which key expires (or 0) */
134 time_t revoked_at; /* time at which key was revoked */ 137 time_t revoked_at; /* time at which key was revoked */
135 }; 138 };
139 time_t last_used_at; /* last time used for LRU keyring discard */
136 uid_t uid; 140 uid_t uid;
137 gid_t gid; 141 gid_t gid;
138 key_perm_t perm; /* access permissions */ 142 key_perm_t perm; /* access permissions */
@@ -156,6 +160,7 @@ struct key {
156#define KEY_FLAG_USER_CONSTRUCT 4 /* set if key is being constructed in userspace */ 160#define KEY_FLAG_USER_CONSTRUCT 4 /* set if key is being constructed in userspace */
157#define KEY_FLAG_NEGATIVE 5 /* set if key is negative */ 161#define KEY_FLAG_NEGATIVE 5 /* set if key is negative */
158#define KEY_FLAG_ROOT_CAN_CLEAR 6 /* set if key can be cleared by root without permission */ 162#define KEY_FLAG_ROOT_CAN_CLEAR 6 /* set if key can be cleared by root without permission */
163#define KEY_FLAG_INVALIDATED 7 /* set if key has been invalidated */
159 164
160 /* the description string 165 /* the description string
161 * - this is used to match a key against search criteria 166 * - this is used to match a key against search criteria
@@ -199,6 +204,7 @@ extern struct key *key_alloc(struct key_type *type,
199#define KEY_ALLOC_NOT_IN_QUOTA 0x0002 /* not in quota */ 204#define KEY_ALLOC_NOT_IN_QUOTA 0x0002 /* not in quota */
200 205
201extern void key_revoke(struct key *key); 206extern void key_revoke(struct key *key);
207extern void key_invalidate(struct key *key);
202extern void key_put(struct key *key); 208extern void key_put(struct key *key);
203 209
204static inline struct key *key_get(struct key *key) 210static inline struct key *key_get(struct key *key)
@@ -236,7 +242,7 @@ extern struct key *request_key_async_with_auxdata(struct key_type *type,
236 242
237extern int wait_for_key_construction(struct key *key, bool intr); 243extern int wait_for_key_construction(struct key *key, bool intr);
238 244
239extern int key_validate(struct key *key); 245extern int key_validate(const struct key *key);
240 246
241extern key_ref_t key_create_or_update(key_ref_t keyring, 247extern key_ref_t key_create_or_update(key_ref_t keyring,
242 const char *type, 248 const char *type,
@@ -319,6 +325,7 @@ extern void key_init(void);
319#define key_serial(k) 0 325#define key_serial(k) 0
320#define key_get(k) ({ NULL; }) 326#define key_get(k) ({ NULL; })
321#define key_revoke(k) do { } while(0) 327#define key_revoke(k) do { } while(0)
328#define key_invalidate(k) do { } while(0)
322#define key_put(k) do { } while(0) 329#define key_put(k) do { } while(0)
323#define key_ref_put(k) do { } while(0) 330#define key_ref_put(k) do { } while(0)
324#define make_key_ref(k, p) NULL 331#define make_key_ref(k, p) NULL
diff --git a/include/linux/keyctl.h b/include/linux/keyctl.h
index 9b0b865ce622..c9b7f4faf97a 100644
--- a/include/linux/keyctl.h
+++ b/include/linux/keyctl.h
@@ -55,5 +55,6 @@
55#define KEYCTL_SESSION_TO_PARENT 18 /* apply session keyring to parent process */ 55#define KEYCTL_SESSION_TO_PARENT 18 /* apply session keyring to parent process */
56#define KEYCTL_REJECT 19 /* reject a partially constructed key */ 56#define KEYCTL_REJECT 19 /* reject a partially constructed key */
57#define KEYCTL_INSTANTIATE_IOV 20 /* instantiate a partially constructed key */ 57#define KEYCTL_INSTANTIATE_IOV 20 /* instantiate a partially constructed key */
58#define KEYCTL_INVALIDATE 21 /* invalidate a key */
58 59
59#endif /* _LINUX_KEYCTL_H */ 60#endif /* _LINUX_KEYCTL_H */
diff --git a/include/linux/libata.h b/include/linux/libata.h
index e926df7b54c9..6e887c742a27 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -247,6 +247,7 @@ enum {
247 ATA_HOST_SIMPLEX = (1 << 0), /* Host is simplex, one DMA channel per host only */ 247 ATA_HOST_SIMPLEX = (1 << 0), /* Host is simplex, one DMA channel per host only */
248 ATA_HOST_STARTED = (1 << 1), /* Host started */ 248 ATA_HOST_STARTED = (1 << 1), /* Host started */
249 ATA_HOST_PARALLEL_SCAN = (1 << 2), /* Ports on this host can be scanned in parallel */ 249 ATA_HOST_PARALLEL_SCAN = (1 << 2), /* Ports on this host can be scanned in parallel */
250 ATA_HOST_IGNORE_ATA = (1 << 3), /* Ignore ATA devices on this host. */
250 251
251 /* bits 24:31 of host->flags are reserved for LLD specific flags */ 252 /* bits 24:31 of host->flags are reserved for LLD specific flags */
252 253
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h
index d36619ead3ba..00e46376e28f 100644
--- a/include/linux/lockdep.h
+++ b/include/linux/lockdep.h
@@ -157,6 +157,24 @@ struct lockdep_map {
157#endif 157#endif
158}; 158};
159 159
160static inline void lockdep_copy_map(struct lockdep_map *to,
161 struct lockdep_map *from)
162{
163 int i;
164
165 *to = *from;
166 /*
167 * Since the class cache can be modified concurrently we could observe
168 * half pointers (64bit arch using 32bit copy insns). Therefore clear
169 * the caches and take the performance hit.
170 *
171 * XXX it doesn't work well with lockdep_set_class_and_subclass(), since
172 * that relies on cache abuse.
173 */
174 for (i = 0; i < NR_LOCKDEP_CACHING_CLASSES; i++)
175 to->class_cache[i] = NULL;
176}
177
160/* 178/*
161 * Every lock has a list of other locks that were taken after it. 179 * Every lock has a list of other locks that were taken after it.
162 * We only grow the list, never remove from it: 180 * We only grow the list, never remove from it:
diff --git a/include/linux/lsm_audit.h b/include/linux/lsm_audit.h
index fad48aab893b..1cc89e9df480 100644
--- a/include/linux/lsm_audit.h
+++ b/include/linux/lsm_audit.h
@@ -53,7 +53,6 @@ struct common_audit_data {
53#define LSM_AUDIT_DATA_KMOD 8 53#define LSM_AUDIT_DATA_KMOD 8
54#define LSM_AUDIT_DATA_INODE 9 54#define LSM_AUDIT_DATA_INODE 9
55#define LSM_AUDIT_DATA_DENTRY 10 55#define LSM_AUDIT_DATA_DENTRY 10
56 struct task_struct *tsk;
57 union { 56 union {
58 struct path path; 57 struct path path;
59 struct dentry *dentry; 58 struct dentry *dentry;
@@ -93,11 +92,6 @@ int ipv4_skb_to_auditdata(struct sk_buff *skb,
93int ipv6_skb_to_auditdata(struct sk_buff *skb, 92int ipv6_skb_to_auditdata(struct sk_buff *skb,
94 struct common_audit_data *ad, u8 *proto); 93 struct common_audit_data *ad, u8 *proto);
95 94
96/* Initialize an LSM audit data structure. */
97#define COMMON_AUDIT_DATA_INIT(_d, _t) \
98 { memset((_d), 0, sizeof(struct common_audit_data)); \
99 (_d)->type = LSM_AUDIT_DATA_##_t; }
100
101void common_lsm_audit(struct common_audit_data *a, 95void common_lsm_audit(struct common_audit_data *a,
102 void (*pre_audit)(struct audit_buffer *, void *), 96 void (*pre_audit)(struct audit_buffer *, void *),
103 void (*post_audit)(struct audit_buffer *, void *)); 97 void (*post_audit)(struct audit_buffer *, void *));
diff --git a/include/linux/mei.h b/include/linux/mei.h
new file mode 100644
index 000000000000..bc0d8b69c49e
--- /dev/null
+++ b/include/linux/mei.h
@@ -0,0 +1,110 @@
1/******************************************************************************
2 * Intel Management Engine Interface (Intel MEI) Linux driver
3 * Intel MEI Interface Header
4 *
5 * This file is provided under a dual BSD/GPLv2 license. When using or
6 * redistributing this file, you may do so under either license.
7 *
8 * GPL LICENSE SUMMARY
9 *
10 * Copyright(c) 2003 - 2012 Intel Corporation. All rights reserved.
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of version 2 of the GNU General Public License as
14 * published by the Free Software Foundation.
15 *
16 * This program is distributed in the hope that it will be useful, but
17 * WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
24 * USA
25 *
26 * The full GNU General Public License is included in this distribution
27 * in the file called LICENSE.GPL.
28 *
29 * Contact Information:
30 * Intel Corporation.
31 * linux-mei@linux.intel.com
32 * http://www.intel.com
33 *
34 * BSD LICENSE
35 *
36 * Copyright(c) 2003 - 2012 Intel Corporation. All rights reserved.
37 * All rights reserved.
38 *
39 * Redistribution and use in source and binary forms, with or without
40 * modification, are permitted provided that the following conditions
41 * are met:
42 *
43 * * Redistributions of source code must retain the above copyright
44 * notice, this list of conditions and the following disclaimer.
45 * * Redistributions in binary form must reproduce the above copyright
46 * notice, this list of conditions and the following disclaimer in
47 * the documentation and/or other materials provided with the
48 * distribution.
49 * * Neither the name Intel Corporation nor the names of its
50 * contributors may be used to endorse or promote products derived
51 * from this software without specific prior written permission.
52 *
53 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
54 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
55 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
56 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
57 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
58 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
59 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
60 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
61 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
62 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
63 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
64 *
65 *****************************************************************************/
66
67#ifndef _LINUX_MEI_H
68#define _LINUX_MEI_H
69
70#include <linux/uuid.h>
71
72/*
73 * This IOCTL is used to associate the current file descriptor with a
74 * FW Client (given by UUID). This opens a communication channel
75 * between a host client and a FW client. From this point every read and write
76 * will communicate with the associated FW client.
77 * Only in close() (file_operation release()) the communication between
78 * the clients is disconnected
79 *
80 * The IOCTL argument is a struct with a union that contains
81 * the input parameter and the output parameter for this IOCTL.
82 *
83 * The input parameter is UUID of the FW Client.
84 * The output parameter is the properties of the FW client
85 * (FW protocol version and max message size).
86 *
87 */
88#define IOCTL_MEI_CONNECT_CLIENT \
89 _IOWR('H' , 0x01, struct mei_connect_client_data)
90
91/*
92 * Intel MEI client information struct
93 */
94struct mei_client {
95 __u32 max_msg_length;
96 __u8 protocol_version;
97 __u8 reserved[3];
98};
99
100/*
101 * IOCTL Connect Client Data structure
102 */
103struct mei_connect_client_data {
104 union {
105 uuid_le in_client_uuid;
106 struct mei_client out_client_properties;
107 };
108};
109
110#endif /* _LINUX_MEI_H */
diff --git a/include/linux/mfd/abx500.h b/include/linux/mfd/abx500.h
index ee96cd51d8b2..1318ca622633 100644
--- a/include/linux/mfd/abx500.h
+++ b/include/linux/mfd/abx500.h
@@ -6,7 +6,7 @@
6 * 6 *
7 * ABX500 core access functions. 7 * ABX500 core access functions.
8 * The abx500 interface is used for the Analog Baseband chip 8 * The abx500 interface is used for the Analog Baseband chip
9 * ab3100, ab5500, and ab8500. 9 * ab3100 and ab8500.
10 * 10 *
11 * Author: Mattias Wallin <mattias.wallin@stericsson.com> 11 * Author: Mattias Wallin <mattias.wallin@stericsson.com>
12 * Author: Mattias Nilsson <mattias.i.nilsson@stericsson.com> 12 * Author: Mattias Nilsson <mattias.i.nilsson@stericsson.com>
@@ -30,9 +30,6 @@ struct device;
30#define AB3100_P1G 0xc6 30#define AB3100_P1G 0xc6
31#define AB3100_R2A 0xc7 31#define AB3100_R2A 0xc7
32#define AB3100_R2B 0xc8 32#define AB3100_R2B 0xc8
33#define AB5500_1_0 0x20
34#define AB5500_1_1 0x21
35#define AB5500_2_0 0x24
36 33
37/* 34/*
38 * AB3100, EVENTA1, A2 and A3 event register flags 35 * AB3100, EVENTA1, A2 and A3 event register flags
diff --git a/include/linux/mfd/abx500/ab5500.h b/include/linux/mfd/abx500/ab5500.h
deleted file mode 100644
index 54f820ed73bb..000000000000
--- a/include/linux/mfd/abx500/ab5500.h
+++ /dev/null
@@ -1,140 +0,0 @@
1/*
2 * Copyright (C) ST-Ericsson 2011
3 *
4 * License Terms: GNU General Public License v2
5 */
6#ifndef MFD_AB5500_H
7#define MFD_AB5500_H
8
9struct device;
10
11enum ab5500_devid {
12 AB5500_DEVID_ADC,
13 AB5500_DEVID_LEDS,
14 AB5500_DEVID_POWER,
15 AB5500_DEVID_REGULATORS,
16 AB5500_DEVID_SIM,
17 AB5500_DEVID_RTC,
18 AB5500_DEVID_CHARGER,
19 AB5500_DEVID_FUELGAUGE,
20 AB5500_DEVID_VIBRATOR,
21 AB5500_DEVID_CODEC,
22 AB5500_DEVID_USB,
23 AB5500_DEVID_OTP,
24 AB5500_DEVID_VIDEO,
25 AB5500_DEVID_DBIECI,
26 AB5500_DEVID_ONSWA,
27 AB5500_NUM_DEVICES,
28};
29
30enum ab5500_banks {
31 AB5500_BANK_VIT_IO_I2C_CLK_TST_OTP = 0,
32 AB5500_BANK_VDDDIG_IO_I2C_CLK_TST = 1,
33 AB5500_BANK_VDENC = 2,
34 AB5500_BANK_SIM_USBSIM = 3,
35 AB5500_BANK_LED = 4,
36 AB5500_BANK_ADC = 5,
37 AB5500_BANK_RTC = 6,
38 AB5500_BANK_STARTUP = 7,
39 AB5500_BANK_DBI_ECI = 8,
40 AB5500_BANK_CHG = 9,
41 AB5500_BANK_FG_BATTCOM_ACC = 10,
42 AB5500_BANK_USB = 11,
43 AB5500_BANK_IT = 12,
44 AB5500_BANK_VIBRA = 13,
45 AB5500_BANK_AUDIO_HEADSETUSB = 14,
46 AB5500_NUM_BANKS = 15,
47};
48
49enum ab5500_banks_addr {
50 AB5500_ADDR_VIT_IO_I2C_CLK_TST_OTP = 0x4A,
51 AB5500_ADDR_VDDDIG_IO_I2C_CLK_TST = 0x4B,
52 AB5500_ADDR_VDENC = 0x06,
53 AB5500_ADDR_SIM_USBSIM = 0x04,
54 AB5500_ADDR_LED = 0x10,
55 AB5500_ADDR_ADC = 0x0A,
56 AB5500_ADDR_RTC = 0x0F,
57 AB5500_ADDR_STARTUP = 0x03,
58 AB5500_ADDR_DBI_ECI = 0x07,
59 AB5500_ADDR_CHG = 0x0B,
60 AB5500_ADDR_FG_BATTCOM_ACC = 0x0C,
61 AB5500_ADDR_USB = 0x05,
62 AB5500_ADDR_IT = 0x0E,
63 AB5500_ADDR_VIBRA = 0x02,
64 AB5500_ADDR_AUDIO_HEADSETUSB = 0x0D,
65};
66
67/*
68 * Interrupt register offsets
69 * Bank : 0x0E
70 */
71#define AB5500_IT_SOURCE0_REG 0x20
72#define AB5500_IT_SOURCE1_REG 0x21
73#define AB5500_IT_SOURCE2_REG 0x22
74#define AB5500_IT_SOURCE3_REG 0x23
75#define AB5500_IT_SOURCE4_REG 0x24
76#define AB5500_IT_SOURCE5_REG 0x25
77#define AB5500_IT_SOURCE6_REG 0x26
78#define AB5500_IT_SOURCE7_REG 0x27
79#define AB5500_IT_SOURCE8_REG 0x28
80#define AB5500_IT_SOURCE9_REG 0x29
81#define AB5500_IT_SOURCE10_REG 0x2A
82#define AB5500_IT_SOURCE11_REG 0x2B
83#define AB5500_IT_SOURCE12_REG 0x2C
84#define AB5500_IT_SOURCE13_REG 0x2D
85#define AB5500_IT_SOURCE14_REG 0x2E
86#define AB5500_IT_SOURCE15_REG 0x2F
87#define AB5500_IT_SOURCE16_REG 0x30
88#define AB5500_IT_SOURCE17_REG 0x31
89#define AB5500_IT_SOURCE18_REG 0x32
90#define AB5500_IT_SOURCE19_REG 0x33
91#define AB5500_IT_SOURCE20_REG 0x34
92#define AB5500_IT_SOURCE21_REG 0x35
93#define AB5500_IT_SOURCE22_REG 0x36
94#define AB5500_IT_SOURCE23_REG 0x37
95
96#define AB5500_NUM_IRQ_REGS 23
97
98/**
99 * struct ab5500
100 * @access_mutex: lock out concurrent accesses to the AB registers
101 * @dev: a pointer to the device struct for this chip driver
102 * @ab5500_irq: the analog baseband irq
103 * @irq_base: the platform configuration irq base for subdevices
104 * @chip_name: name of this chip variant
105 * @chip_id: 8 bit chip ID for this chip variant
106 * @irq_lock: a lock to protect the mask
107 * @abb_events: a local bit mask of the prcmu wakeup events
108 * @event_mask: a local copy of the mask event registers
109 * @last_event_mask: a copy of the last event_mask written to hardware
110 * @startup_events: a copy of the first reading of the event registers
111 * @startup_events_read: whether the first events have been read
112 */
113struct ab5500 {
114 struct mutex access_mutex;
115 struct device *dev;
116 unsigned int ab5500_irq;
117 unsigned int irq_base;
118 char chip_name[32];
119 u8 chip_id;
120 struct mutex irq_lock;
121 u32 abb_events;
122 u8 mask[AB5500_NUM_IRQ_REGS];
123 u8 oldmask[AB5500_NUM_IRQ_REGS];
124 u8 startup_events[AB5500_NUM_IRQ_REGS];
125 bool startup_events_read;
126#ifdef CONFIG_DEBUG_FS
127 unsigned int debug_bank;
128 unsigned int debug_address;
129#endif
130};
131
132struct ab5500_platform_data {
133 struct {unsigned int base; unsigned int count; } irq;
134 void *dev_data[AB5500_NUM_DEVICES];
135 struct abx500_init_settings *init_settings;
136 unsigned int init_settings_sz;
137 bool pm_power_off;
138};
139
140#endif /* MFD_AB5500_H */
diff --git a/include/linux/mfd/asic3.h b/include/linux/mfd/asic3.h
index ed793b77a1c5..ef6faa5cee46 100644
--- a/include/linux/mfd/asic3.h
+++ b/include/linux/mfd/asic3.h
@@ -138,6 +138,7 @@ struct asic3_platform_data {
138#define ASIC3_GPIOC13_nPWAIT ASIC3_CONFIG_GPIO(45, 1, 1, 0) 138#define ASIC3_GPIOC13_nPWAIT ASIC3_CONFIG_GPIO(45, 1, 1, 0)
139#define ASIC3_GPIOC14_nPIOIS16 ASIC3_CONFIG_GPIO(46, 1, 1, 0) 139#define ASIC3_GPIOC14_nPIOIS16 ASIC3_CONFIG_GPIO(46, 1, 1, 0)
140#define ASIC3_GPIOC15_nPIOR ASIC3_CONFIG_GPIO(47, 1, 0, 0) 140#define ASIC3_GPIOC15_nPIOR ASIC3_CONFIG_GPIO(47, 1, 0, 0)
141#define ASIC3_GPIOD4_CF_nCD ASIC3_CONFIG_GPIO(52, 1, 0, 0)
141#define ASIC3_GPIOD11_nCIOIS16 ASIC3_CONFIG_GPIO(59, 1, 0, 0) 142#define ASIC3_GPIOD11_nCIOIS16 ASIC3_CONFIG_GPIO(59, 1, 0, 0)
142#define ASIC3_GPIOD12_nCWAIT ASIC3_CONFIG_GPIO(60, 1, 0, 0) 143#define ASIC3_GPIOD12_nCWAIT ASIC3_CONFIG_GPIO(60, 1, 0, 0)
143#define ASIC3_GPIOD15_nPIOW ASIC3_CONFIG_GPIO(63, 1, 0, 0) 144#define ASIC3_GPIOD15_nPIOW ASIC3_CONFIG_GPIO(63, 1, 0, 0)
diff --git a/include/linux/mfd/da9052/da9052.h b/include/linux/mfd/da9052/da9052.h
index 7ffbd6e9e7fc..8313cd9658e3 100644
--- a/include/linux/mfd/da9052/da9052.h
+++ b/include/linux/mfd/da9052/da9052.h
@@ -80,6 +80,7 @@ struct da9052 {
80 struct regmap *regmap; 80 struct regmap *regmap;
81 81
82 int irq_base; 82 int irq_base;
83 struct regmap_irq_chip_data *irq_data;
83 u8 chip_id; 84 u8 chip_id;
84 85
85 int chip_irq; 86 int chip_irq;
diff --git a/include/linux/mfd/db5500-prcmu.h b/include/linux/mfd/db5500-prcmu.h
deleted file mode 100644
index 5a049dfaf153..000000000000
--- a/include/linux/mfd/db5500-prcmu.h
+++ /dev/null
@@ -1,105 +0,0 @@
1/*
2 * Copyright (C) ST-Ericsson SA 2010
3 *
4 * License Terms: GNU General Public License v2
5 *
6 * U5500 PRCMU API.
7 */
8#ifndef __MFD_DB5500_PRCMU_H
9#define __MFD_DB5500_PRCMU_H
10
11static inline int prcmu_resetout(u8 resoutn, u8 state)
12{
13 return 0;
14}
15
16static inline int db5500_prcmu_set_epod(u16 epod_id, u8 epod_state)
17{
18 return 0;
19}
20
21static inline int db5500_prcmu_request_clock(u8 clock, bool enable)
22{
23 return 0;
24}
25
26static inline int db5500_prcmu_set_power_state(u8 state, bool keep_ulp_clk,
27 bool keep_ap_pll)
28{
29 return 0;
30}
31
32static inline int db5500_prcmu_config_esram0_deep_sleep(u8 state)
33{
34 return 0;
35}
36
37static inline u16 db5500_prcmu_get_reset_code(void)
38{
39 return 0;
40}
41
42static inline bool db5500_prcmu_is_ac_wake_requested(void)
43{
44 return 0;
45}
46
47static inline int db5500_prcmu_set_arm_opp(u8 opp)
48{
49 return 0;
50}
51
52static inline int db5500_prcmu_get_arm_opp(void)
53{
54 return 0;
55}
56
57static inline void db5500_prcmu_config_abb_event_readout(u32 abb_events) {}
58
59static inline void db5500_prcmu_get_abb_event_buffer(void __iomem **buf) {}
60
61static inline void db5500_prcmu_system_reset(u16 reset_code) {}
62
63static inline void db5500_prcmu_enable_wakeups(u32 wakeups) {}
64
65#ifdef CONFIG_MFD_DB5500_PRCMU
66
67void db5500_prcmu_early_init(void);
68int db5500_prcmu_set_display_clocks(void);
69int db5500_prcmu_disable_dsipll(void);
70int db5500_prcmu_enable_dsipll(void);
71int db5500_prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size);
72int db5500_prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size);
73
74#else /* !CONFIG_UX500_SOC_DB5500 */
75
76static inline void db5500_prcmu_early_init(void) {}
77
78static inline int db5500_prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size)
79{
80 return -ENOSYS;
81}
82
83static inline int db5500_prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size)
84{
85 return -ENOSYS;
86}
87
88static inline int db5500_prcmu_set_display_clocks(void)
89{
90 return 0;
91}
92
93static inline int db5500_prcmu_disable_dsipll(void)
94{
95 return 0;
96}
97
98static inline int db5500_prcmu_enable_dsipll(void)
99{
100 return 0;
101}
102
103#endif /* CONFIG_MFD_DB5500_PRCMU */
104
105#endif /* __MFD_DB5500_PRCMU_H */
diff --git a/include/linux/mfd/dbx500-prcmu.h b/include/linux/mfd/dbx500-prcmu.h
index d7674eb7305f..5a13f93d8f1c 100644
--- a/include/linux/mfd/dbx500-prcmu.h
+++ b/include/linux/mfd/dbx500-prcmu.h
@@ -55,17 +55,6 @@ enum prcmu_wakeup_index {
55#define NUM_EPOD_ID 8 55#define NUM_EPOD_ID 8
56 56
57/* 57/*
58 * DB5500 EPODs
59 */
60#define DB5500_EPOD_ID_BASE 0x0100
61#define DB5500_EPOD_ID_SGA (DB5500_EPOD_ID_BASE + 0)
62#define DB5500_EPOD_ID_HVA (DB5500_EPOD_ID_BASE + 1)
63#define DB5500_EPOD_ID_SIA (DB5500_EPOD_ID_BASE + 2)
64#define DB5500_EPOD_ID_DISP (DB5500_EPOD_ID_BASE + 3)
65#define DB5500_EPOD_ID_ESRAM12 (DB5500_EPOD_ID_BASE + 6)
66#define DB5500_NUM_EPOD_ID 7
67
68/*
69 * state definition for EPOD (power domain) 58 * state definition for EPOD (power domain)
70 * - EPOD_STATE_NO_CHANGE: The EPOD should remain unchanged 59 * - EPOD_STATE_NO_CHANGE: The EPOD should remain unchanged
71 * - EPOD_STATE_OFF: The EPOD is switched off 60 * - EPOD_STATE_OFF: The EPOD is switched off
@@ -80,29 +69,6 @@ enum prcmu_wakeup_index {
80#define EPOD_STATE_ON_CLK_OFF 0x03 69#define EPOD_STATE_ON_CLK_OFF 0x03
81#define EPOD_STATE_ON 0x04 70#define EPOD_STATE_ON 0x04
82 71
83/* DB5500 CLKOUT IDs */
84enum {
85 DB5500_CLKOUT0 = 0,
86 DB5500_CLKOUT1,
87};
88
89/* DB5500 CLKOUTx sources */
90enum {
91 DB5500_CLKOUT_REF_CLK_SEL0,
92 DB5500_CLKOUT_RTC_CLK0_SEL0,
93 DB5500_CLKOUT_ULP_CLK_SEL0,
94 DB5500_CLKOUT_STATIC0,
95 DB5500_CLKOUT_REFCLK,
96 DB5500_CLKOUT_ULPCLK,
97 DB5500_CLKOUT_ARMCLK,
98 DB5500_CLKOUT_SYSACC0CLK,
99 DB5500_CLKOUT_SOC0PLLCLK,
100 DB5500_CLKOUT_SOC1PLLCLK,
101 DB5500_CLKOUT_DDRPLLCLK,
102 DB5500_CLKOUT_TVCLK,
103 DB5500_CLKOUT_IRDACLK,
104};
105
106/* 72/*
107 * CLKOUT sources 73 * CLKOUT sources
108 */ 74 */
@@ -248,101 +214,66 @@ enum ddr_pwrst {
248}; 214};
249 215
250#include <linux/mfd/db8500-prcmu.h> 216#include <linux/mfd/db8500-prcmu.h>
251#include <linux/mfd/db5500-prcmu.h>
252 217
253#if defined(CONFIG_UX500_SOC_DB8500) || defined(CONFIG_UX500_SOC_DB5500) 218#if defined(CONFIG_UX500_SOC_DB8500)
254 219
255#include <mach/id.h> 220#include <mach/id.h>
256 221
257static inline void __init prcmu_early_init(void) 222static inline void __init prcmu_early_init(void)
258{ 223{
259 if (cpu_is_u5500()) 224 return db8500_prcmu_early_init();
260 return db5500_prcmu_early_init();
261 else
262 return db8500_prcmu_early_init();
263} 225}
264 226
265static inline int prcmu_set_power_state(u8 state, bool keep_ulp_clk, 227static inline int prcmu_set_power_state(u8 state, bool keep_ulp_clk,
266 bool keep_ap_pll) 228 bool keep_ap_pll)
267{ 229{
268 if (cpu_is_u5500()) 230 return db8500_prcmu_set_power_state(state, keep_ulp_clk,
269 return db5500_prcmu_set_power_state(state, keep_ulp_clk, 231 keep_ap_pll);
270 keep_ap_pll);
271 else
272 return db8500_prcmu_set_power_state(state, keep_ulp_clk,
273 keep_ap_pll);
274} 232}
275 233
276static inline u8 prcmu_get_power_state_result(void) 234static inline u8 prcmu_get_power_state_result(void)
277{ 235{
278 if (cpu_is_u5500()) 236 return db8500_prcmu_get_power_state_result();
279 return -EINVAL;
280 else
281 return db8500_prcmu_get_power_state_result();
282} 237}
283 238
284static inline int prcmu_gic_decouple(void) 239static inline int prcmu_gic_decouple(void)
285{ 240{
286 if (cpu_is_u5500()) 241 return db8500_prcmu_gic_decouple();
287 return -EINVAL;
288 else
289 return db8500_prcmu_gic_decouple();
290} 242}
291 243
292static inline int prcmu_gic_recouple(void) 244static inline int prcmu_gic_recouple(void)
293{ 245{
294 if (cpu_is_u5500()) 246 return db8500_prcmu_gic_recouple();
295 return -EINVAL;
296 else
297 return db8500_prcmu_gic_recouple();
298} 247}
299 248
300static inline bool prcmu_gic_pending_irq(void) 249static inline bool prcmu_gic_pending_irq(void)
301{ 250{
302 if (cpu_is_u5500()) 251 return db8500_prcmu_gic_pending_irq();
303 return -EINVAL;
304 else
305 return db8500_prcmu_gic_pending_irq();
306} 252}
307 253
308static inline bool prcmu_is_cpu_in_wfi(int cpu) 254static inline bool prcmu_is_cpu_in_wfi(int cpu)
309{ 255{
310 if (cpu_is_u5500()) 256 return db8500_prcmu_is_cpu_in_wfi(cpu);
311 return -EINVAL;
312 else
313 return db8500_prcmu_is_cpu_in_wfi(cpu);
314} 257}
315 258
316static inline int prcmu_copy_gic_settings(void) 259static inline int prcmu_copy_gic_settings(void)
317{ 260{
318 if (cpu_is_u5500()) 261 return db8500_prcmu_copy_gic_settings();
319 return -EINVAL;
320 else
321 return db8500_prcmu_copy_gic_settings();
322} 262}
323 263
324static inline bool prcmu_pending_irq(void) 264static inline bool prcmu_pending_irq(void)
325{ 265{
326 if (cpu_is_u5500()) 266 return db8500_prcmu_pending_irq();
327 return -EINVAL;
328 else
329 return db8500_prcmu_pending_irq();
330} 267}
331 268
332static inline int prcmu_set_epod(u16 epod_id, u8 epod_state) 269static inline int prcmu_set_epod(u16 epod_id, u8 epod_state)
333{ 270{
334 if (cpu_is_u5500()) 271 return db8500_prcmu_set_epod(epod_id, epod_state);
335 return -EINVAL;
336 else
337 return db8500_prcmu_set_epod(epod_id, epod_state);
338} 272}
339 273
340static inline void prcmu_enable_wakeups(u32 wakeups) 274static inline void prcmu_enable_wakeups(u32 wakeups)
341{ 275{
342 if (cpu_is_u5500()) 276 db8500_prcmu_enable_wakeups(wakeups);
343 db5500_prcmu_enable_wakeups(wakeups);
344 else
345 db8500_prcmu_enable_wakeups(wakeups);
346} 277}
347 278
348static inline void prcmu_disable_wakeups(void) 279static inline void prcmu_disable_wakeups(void)
@@ -352,18 +283,12 @@ static inline void prcmu_disable_wakeups(void)
352 283
353static inline void prcmu_config_abb_event_readout(u32 abb_events) 284static inline void prcmu_config_abb_event_readout(u32 abb_events)
354{ 285{
355 if (cpu_is_u5500()) 286 db8500_prcmu_config_abb_event_readout(abb_events);
356 db5500_prcmu_config_abb_event_readout(abb_events);
357 else
358 db8500_prcmu_config_abb_event_readout(abb_events);
359} 287}
360 288
361static inline void prcmu_get_abb_event_buffer(void __iomem **buf) 289static inline void prcmu_get_abb_event_buffer(void __iomem **buf)
362{ 290{
363 if (cpu_is_u5500()) 291 db8500_prcmu_get_abb_event_buffer(buf);
364 db5500_prcmu_get_abb_event_buffer(buf);
365 else
366 db8500_prcmu_get_abb_event_buffer(buf);
367} 292}
368 293
369int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size); 294int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size);
@@ -374,10 +299,7 @@ int prcmu_config_clkout(u8 clkout, u8 source, u8 div);
374 299
375static inline int prcmu_request_clock(u8 clock, bool enable) 300static inline int prcmu_request_clock(u8 clock, bool enable)
376{ 301{
377 if (cpu_is_u5500()) 302 return db8500_prcmu_request_clock(clock, enable);
378 return db5500_prcmu_request_clock(clock, enable);
379 else
380 return db8500_prcmu_request_clock(clock, enable);
381} 303}
382 304
383unsigned long prcmu_clock_rate(u8 clock); 305unsigned long prcmu_clock_rate(u8 clock);
@@ -386,211 +308,133 @@ int prcmu_set_clock_rate(u8 clock, unsigned long rate);
386 308
387static inline int prcmu_set_ddr_opp(u8 opp) 309static inline int prcmu_set_ddr_opp(u8 opp)
388{ 310{
389 if (cpu_is_u5500()) 311 return db8500_prcmu_set_ddr_opp(opp);
390 return -EINVAL;
391 else
392 return db8500_prcmu_set_ddr_opp(opp);
393} 312}
394static inline int prcmu_get_ddr_opp(void) 313static inline int prcmu_get_ddr_opp(void)
395{ 314{
396 if (cpu_is_u5500()) 315 return db8500_prcmu_get_ddr_opp();
397 return -EINVAL;
398 else
399 return db8500_prcmu_get_ddr_opp();
400} 316}
401 317
402static inline int prcmu_set_arm_opp(u8 opp) 318static inline int prcmu_set_arm_opp(u8 opp)
403{ 319{
404 if (cpu_is_u5500()) 320 return db8500_prcmu_set_arm_opp(opp);
405 return -EINVAL;
406 else
407 return db8500_prcmu_set_arm_opp(opp);
408} 321}
409 322
410static inline int prcmu_get_arm_opp(void) 323static inline int prcmu_get_arm_opp(void)
411{ 324{
412 if (cpu_is_u5500()) 325 return db8500_prcmu_get_arm_opp();
413 return -EINVAL;
414 else
415 return db8500_prcmu_get_arm_opp();
416} 326}
417 327
418static inline int prcmu_set_ape_opp(u8 opp) 328static inline int prcmu_set_ape_opp(u8 opp)
419{ 329{
420 if (cpu_is_u5500()) 330 return db8500_prcmu_set_ape_opp(opp);
421 return -EINVAL;
422 else
423 return db8500_prcmu_set_ape_opp(opp);
424} 331}
425 332
426static inline int prcmu_get_ape_opp(void) 333static inline int prcmu_get_ape_opp(void)
427{ 334{
428 if (cpu_is_u5500()) 335 return db8500_prcmu_get_ape_opp();
429 return -EINVAL;
430 else
431 return db8500_prcmu_get_ape_opp();
432} 336}
433 337
434static inline void prcmu_system_reset(u16 reset_code) 338static inline void prcmu_system_reset(u16 reset_code)
435{ 339{
436 if (cpu_is_u5500()) 340 return db8500_prcmu_system_reset(reset_code);
437 return db5500_prcmu_system_reset(reset_code);
438 else
439 return db8500_prcmu_system_reset(reset_code);
440} 341}
441 342
442static inline u16 prcmu_get_reset_code(void) 343static inline u16 prcmu_get_reset_code(void)
443{ 344{
444 if (cpu_is_u5500()) 345 return db8500_prcmu_get_reset_code();
445 return db5500_prcmu_get_reset_code();
446 else
447 return db8500_prcmu_get_reset_code();
448} 346}
449 347
450void prcmu_ac_wake_req(void); 348void prcmu_ac_wake_req(void);
451void prcmu_ac_sleep_req(void); 349void prcmu_ac_sleep_req(void);
452static inline void prcmu_modem_reset(void) 350static inline void prcmu_modem_reset(void)
453{ 351{
454 if (cpu_is_u5500()) 352 return db8500_prcmu_modem_reset();
455 return;
456 else
457 return db8500_prcmu_modem_reset();
458} 353}
459 354
460static inline bool prcmu_is_ac_wake_requested(void) 355static inline bool prcmu_is_ac_wake_requested(void)
461{ 356{
462 if (cpu_is_u5500()) 357 return db8500_prcmu_is_ac_wake_requested();
463 return db5500_prcmu_is_ac_wake_requested();
464 else
465 return db8500_prcmu_is_ac_wake_requested();
466} 358}
467 359
468static inline int prcmu_set_display_clocks(void) 360static inline int prcmu_set_display_clocks(void)
469{ 361{
470 if (cpu_is_u5500()) 362 return db8500_prcmu_set_display_clocks();
471 return db5500_prcmu_set_display_clocks();
472 else
473 return db8500_prcmu_set_display_clocks();
474} 363}
475 364
476static inline int prcmu_disable_dsipll(void) 365static inline int prcmu_disable_dsipll(void)
477{ 366{
478 if (cpu_is_u5500()) 367 return db8500_prcmu_disable_dsipll();
479 return db5500_prcmu_disable_dsipll();
480 else
481 return db8500_prcmu_disable_dsipll();
482} 368}
483 369
484static inline int prcmu_enable_dsipll(void) 370static inline int prcmu_enable_dsipll(void)
485{ 371{
486 if (cpu_is_u5500()) 372 return db8500_prcmu_enable_dsipll();
487 return db5500_prcmu_enable_dsipll();
488 else
489 return db8500_prcmu_enable_dsipll();
490} 373}
491 374
492static inline int prcmu_config_esram0_deep_sleep(u8 state) 375static inline int prcmu_config_esram0_deep_sleep(u8 state)
493{ 376{
494 if (cpu_is_u5500()) 377 return db8500_prcmu_config_esram0_deep_sleep(state);
495 return -EINVAL;
496 else
497 return db8500_prcmu_config_esram0_deep_sleep(state);
498} 378}
499 379
500static inline int prcmu_config_hotdog(u8 threshold) 380static inline int prcmu_config_hotdog(u8 threshold)
501{ 381{
502 if (cpu_is_u5500()) 382 return db8500_prcmu_config_hotdog(threshold);
503 return -EINVAL;
504 else
505 return db8500_prcmu_config_hotdog(threshold);
506} 383}
507 384
508static inline int prcmu_config_hotmon(u8 low, u8 high) 385static inline int prcmu_config_hotmon(u8 low, u8 high)
509{ 386{
510 if (cpu_is_u5500()) 387 return db8500_prcmu_config_hotmon(low, high);
511 return -EINVAL;
512 else
513 return db8500_prcmu_config_hotmon(low, high);
514} 388}
515 389
516static inline int prcmu_start_temp_sense(u16 cycles32k) 390static inline int prcmu_start_temp_sense(u16 cycles32k)
517{ 391{
518 if (cpu_is_u5500()) 392 return db8500_prcmu_start_temp_sense(cycles32k);
519 return -EINVAL;
520 else
521 return db8500_prcmu_start_temp_sense(cycles32k);
522} 393}
523 394
524static inline int prcmu_stop_temp_sense(void) 395static inline int prcmu_stop_temp_sense(void)
525{ 396{
526 if (cpu_is_u5500()) 397 return db8500_prcmu_stop_temp_sense();
527 return -EINVAL;
528 else
529 return db8500_prcmu_stop_temp_sense();
530} 398}
531 399
532static inline u32 prcmu_read(unsigned int reg) 400static inline u32 prcmu_read(unsigned int reg)
533{ 401{
534 if (cpu_is_u5500()) 402 return db8500_prcmu_read(reg);
535 return -EINVAL;
536 else
537 return db8500_prcmu_read(reg);
538} 403}
539 404
540static inline void prcmu_write(unsigned int reg, u32 value) 405static inline void prcmu_write(unsigned int reg, u32 value)
541{ 406{
542 if (cpu_is_u5500()) 407 db8500_prcmu_write(reg, value);
543 return;
544 else
545 db8500_prcmu_write(reg, value);
546} 408}
547 409
548static inline void prcmu_write_masked(unsigned int reg, u32 mask, u32 value) 410static inline void prcmu_write_masked(unsigned int reg, u32 mask, u32 value)
549{ 411{
550 if (cpu_is_u5500()) 412 db8500_prcmu_write_masked(reg, mask, value);
551 return;
552 else
553 db8500_prcmu_write_masked(reg, mask, value);
554} 413}
555 414
556static inline int prcmu_enable_a9wdog(u8 id) 415static inline int prcmu_enable_a9wdog(u8 id)
557{ 416{
558 if (cpu_is_u5500()) 417 return db8500_prcmu_enable_a9wdog(id);
559 return -EINVAL;
560 else
561 return db8500_prcmu_enable_a9wdog(id);
562} 418}
563 419
564static inline int prcmu_disable_a9wdog(u8 id) 420static inline int prcmu_disable_a9wdog(u8 id)
565{ 421{
566 if (cpu_is_u5500()) 422 return db8500_prcmu_disable_a9wdog(id);
567 return -EINVAL;
568 else
569 return db8500_prcmu_disable_a9wdog(id);
570} 423}
571 424
572static inline int prcmu_kick_a9wdog(u8 id) 425static inline int prcmu_kick_a9wdog(u8 id)
573{ 426{
574 if (cpu_is_u5500()) 427 return db8500_prcmu_kick_a9wdog(id);
575 return -EINVAL;
576 else
577 return db8500_prcmu_kick_a9wdog(id);
578} 428}
579 429
580static inline int prcmu_load_a9wdog(u8 id, u32 timeout) 430static inline int prcmu_load_a9wdog(u8 id, u32 timeout)
581{ 431{
582 if (cpu_is_u5500()) 432 return db8500_prcmu_load_a9wdog(id, timeout);
583 return -EINVAL;
584 else
585 return db8500_prcmu_load_a9wdog(id, timeout);
586} 433}
587 434
588static inline int prcmu_config_a9wdog(u8 num, bool sleep_auto_off) 435static inline int prcmu_config_a9wdog(u8 num, bool sleep_auto_off)
589{ 436{
590 if (cpu_is_u5500()) 437 return db8500_prcmu_config_a9wdog(num, sleep_auto_off);
591 return -EINVAL;
592 else
593 return db8500_prcmu_config_a9wdog(num, sleep_auto_off);
594} 438}
595#else 439#else
596 440
@@ -768,7 +612,7 @@ static inline void prcmu_clear(unsigned int reg, u32 bits)
768 prcmu_write_masked(reg, bits, 0); 612 prcmu_write_masked(reg, bits, 0);
769} 613}
770 614
771#if defined(CONFIG_UX500_SOC_DB8500) || defined(CONFIG_UX500_SOC_DB5500) 615#if defined(CONFIG_UX500_SOC_DB8500)
772 616
773/** 617/**
774 * prcmu_enable_spi2 - Enables pin muxing for SPI2 on OtherAlternateC1. 618 * prcmu_enable_spi2 - Enables pin muxing for SPI2 on OtherAlternateC1.
diff --git a/include/linux/mfd/max8997.h b/include/linux/mfd/max8997.h
index 28726dd540f2..b40c08cd30bc 100644
--- a/include/linux/mfd/max8997.h
+++ b/include/linux/mfd/max8997.h
@@ -99,34 +99,11 @@ struct max8997_muic_reg_data {
99 99
100/** 100/**
101 * struct max8997_muic_platform_data 101 * struct max8997_muic_platform_data
102 * @usb_callback: callback function for USB
103 * inform callee of USB type (HOST or DEVICE)
104 * and attached state(true or false)
105 * @charger_callback: callback function for charger
106 * inform callee of charger_type
107 * and attached state(true or false)
108 * @deskdock_callback: callback function for desk dock
109 * inform callee of attached state(true or false)
110 * @cardock_callback: callback function for car dock
111 * inform callee of attached state(true or false)
112 * @mhl_callback: callback function for MHL (Mobile High-definition Link)
113 * inform callee of attached state(true or false)
114 * @uart_callback: callback function for JIG UART
115 * inform callee of attached state(true or false)
116 * @init_data: array of max8997_muic_reg_data 102 * @init_data: array of max8997_muic_reg_data
117 * used for initializing registers of MAX8997 MUIC device 103 * used for initializing registers of MAX8997 MUIC device
118 * @num_init_data: array size of init_data 104 * @num_init_data: array size of init_data
119 */ 105 */
120struct max8997_muic_platform_data { 106struct max8997_muic_platform_data {
121 void (*usb_callback)(enum max8997_muic_usb_type usb_type,
122 bool attached);
123 void (*charger_callback)(bool attached,
124 enum max8997_muic_charger_type charger_type);
125 void (*deskdock_callback) (bool attached);
126 void (*cardock_callback) (bool attached);
127 void (*mhl_callback) (bool attached);
128 void (*uart_callback) (bool attached);
129
130 struct max8997_muic_reg_data *init_data; 107 struct max8997_muic_reg_data *init_data;
131 int num_init_data; 108 int num_init_data;
132}; 109};
diff --git a/include/linux/mfd/mc13xxx.h b/include/linux/mfd/mc13xxx.h
index 10e038bac8dd..bf070755982e 100644
--- a/include/linux/mfd/mc13xxx.h
+++ b/include/linux/mfd/mc13xxx.h
@@ -170,6 +170,16 @@ struct mc13xxx_ts_platform_data {
170 bool atox; 170 bool atox;
171}; 171};
172 172
173enum mc13783_ssi_port {
174 MC13783_SSI1_PORT,
175 MC13783_SSI2_PORT,
176};
177
178struct mc13xxx_codec_platform_data {
179 enum mc13783_ssi_port adc_ssi_port;
180 enum mc13783_ssi_port dac_ssi_port;
181};
182
173struct mc13xxx_platform_data { 183struct mc13xxx_platform_data {
174#define MC13XXX_USE_TOUCHSCREEN (1 << 0) 184#define MC13XXX_USE_TOUCHSCREEN (1 << 0)
175#define MC13XXX_USE_CODEC (1 << 1) 185#define MC13XXX_USE_CODEC (1 << 1)
@@ -181,6 +191,7 @@ struct mc13xxx_platform_data {
181 struct mc13xxx_leds_platform_data *leds; 191 struct mc13xxx_leds_platform_data *leds;
182 struct mc13xxx_buttons_platform_data *buttons; 192 struct mc13xxx_buttons_platform_data *buttons;
183 struct mc13xxx_ts_platform_data touch; 193 struct mc13xxx_ts_platform_data touch;
194 struct mc13xxx_codec_platform_data *codec;
184}; 195};
185 196
186#define MC13XXX_ADC_MODE_TS 1 197#define MC13XXX_ADC_MODE_TS 1
diff --git a/include/linux/mfd/palmas.h b/include/linux/mfd/palmas.h
new file mode 100644
index 000000000000..9cbc642d40ad
--- /dev/null
+++ b/include/linux/mfd/palmas.h
@@ -0,0 +1,2620 @@
1/*
2 * TI Palmas
3 *
4 * Copyright 2011 Texas Instruments Inc.
5 *
6 * Author: Graeme Gregory <gg@slimlogic.co.uk>
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 *
13 */
14
15#ifndef __LINUX_MFD_PALMAS_H
16#define __LINUX_MFD_PALMAS_H
17
18#include <linux/usb/otg.h>
19#include <linux/leds.h>
20#include <linux/regmap.h>
21#include <linux/regulator/driver.h>
22
23#define PALMAS_NUM_CLIENTS 3
24
25struct palmas_pmic;
26
27struct palmas {
28 struct device *dev;
29
30 struct i2c_client *i2c_clients[PALMAS_NUM_CLIENTS];
31 struct regmap *regmap[PALMAS_NUM_CLIENTS];
32
33 /* Stored chip id */
34 int id;
35
36 /* IRQ Data */
37 int irq;
38 u32 irq_mask;
39 struct mutex irq_lock;
40 struct regmap_irq_chip_data *irq_data;
41
42 /* Child Devices */
43 struct palmas_pmic *pmic;
44
45 /* GPIO MUXing */
46 u8 gpio_muxed;
47 u8 led_muxed;
48 u8 pwm_muxed;
49};
50
51struct palmas_reg_init {
52 /* warm_rest controls the voltage levels after a warm reset
53 *
54 * 0: reload default values from OTP on warm reset
55 * 1: maintain voltage from VSEL on warm reset
56 */
57 int warm_reset;
58
59 /* roof_floor controls whether the regulator uses the i2c style
60 * of DVS or uses the method where a GPIO or other control method is
61 * attached to the NSLEEP/ENABLE1/ENABLE2 pins
62 *
63 * For SMPS
64 *
65 * 0: i2c selection of voltage
66 * 1: pin selection of voltage.
67 *
68 * For LDO unused
69 */
70 int roof_floor;
71
72 /* sleep_mode is the mode loaded to MODE_SLEEP bits as defined in
73 * the data sheet.
74 *
75 * For SMPS
76 *
77 * 0: Off
78 * 1: AUTO
79 * 2: ECO
80 * 3: Forced PWM
81 *
82 * For LDO
83 *
84 * 0: Off
85 * 1: On
86 */
87 int mode_sleep;
88
89 /* tstep is the timestep loaded to the TSTEP register
90 *
91 * For SMPS
92 *
93 * 0: Jump (no slope control)
94 * 1: 10mV/us
95 * 2: 5mV/us
96 * 3: 2.5mV/us
97 *
98 * For LDO unused
99 */
100 int tstep;
101
102 /* voltage_sel is the bitfield loaded onto the SMPSX_VOLTAGE
103 * register. Set this is the default voltage set in OTP needs
104 * to be overridden.
105 */
106 u8 vsel;
107
108};
109
110struct palmas_pmic_platform_data {
111 /* An array of pointers to regulator init data indexed by regulator
112 * ID
113 */
114 struct regulator_init_data **reg_data;
115
116 /* An array of pointers to structures containing sleep mode and DVS
117 * configuration for regulators indexed by ID
118 */
119 struct palmas_reg_init **reg_init;
120
121 /* use LDO6 for vibrator control */
122 int ldo6_vibrator;
123
124
125};
126
127struct palmas_platform_data {
128 int gpio_base;
129
130 /* bit value to be loaded to the POWER_CTRL register */
131 u8 power_ctrl;
132
133 /*
134 * boolean to select if we want to configure muxing here
135 * then the two value to load into the registers if true
136 */
137 int mux_from_pdata;
138 u8 pad1, pad2;
139
140 struct palmas_pmic_platform_data *pmic_pdata;
141};
142
143/* Define the palmas IRQ numbers */
144enum palmas_irqs {
145 /* INT1 registers */
146 PALMAS_CHARG_DET_N_VBUS_OVV_IRQ,
147 PALMAS_PWRON_IRQ,
148 PALMAS_LONG_PRESS_KEY_IRQ,
149 PALMAS_RPWRON_IRQ,
150 PALMAS_PWRDOWN_IRQ,
151 PALMAS_HOTDIE_IRQ,
152 PALMAS_VSYS_MON_IRQ,
153 PALMAS_VBAT_MON_IRQ,
154 /* INT2 registers */
155 PALMAS_RTC_ALARM_IRQ,
156 PALMAS_RTC_TIMER_IRQ,
157 PALMAS_WDT_IRQ,
158 PALMAS_BATREMOVAL_IRQ,
159 PALMAS_RESET_IN_IRQ,
160 PALMAS_FBI_BB_IRQ,
161 PALMAS_SHORT_IRQ,
162 PALMAS_VAC_ACOK_IRQ,
163 /* INT3 registers */
164 PALMAS_GPADC_AUTO_0_IRQ,
165 PALMAS_GPADC_AUTO_1_IRQ,
166 PALMAS_GPADC_EOC_SW_IRQ,
167 PALMAS_GPADC_EOC_RT_IRQ,
168 PALMAS_ID_OTG_IRQ,
169 PALMAS_ID_IRQ,
170 PALMAS_VBUS_OTG_IRQ,
171 PALMAS_VBUS_IRQ,
172 /* INT4 registers */
173 PALMAS_GPIO_0_IRQ,
174 PALMAS_GPIO_1_IRQ,
175 PALMAS_GPIO_2_IRQ,
176 PALMAS_GPIO_3_IRQ,
177 PALMAS_GPIO_4_IRQ,
178 PALMAS_GPIO_5_IRQ,
179 PALMAS_GPIO_6_IRQ,
180 PALMAS_GPIO_7_IRQ,
181 /* Total Number IRQs */
182 PALMAS_NUM_IRQ,
183};
184
185enum palmas_regulators {
186 /* SMPS regulators */
187 PALMAS_REG_SMPS12,
188 PALMAS_REG_SMPS123,
189 PALMAS_REG_SMPS3,
190 PALMAS_REG_SMPS45,
191 PALMAS_REG_SMPS457,
192 PALMAS_REG_SMPS6,
193 PALMAS_REG_SMPS7,
194 PALMAS_REG_SMPS8,
195 PALMAS_REG_SMPS9,
196 PALMAS_REG_SMPS10,
197 /* LDO regulators */
198 PALMAS_REG_LDO1,
199 PALMAS_REG_LDO2,
200 PALMAS_REG_LDO3,
201 PALMAS_REG_LDO4,
202 PALMAS_REG_LDO5,
203 PALMAS_REG_LDO6,
204 PALMAS_REG_LDO7,
205 PALMAS_REG_LDO8,
206 PALMAS_REG_LDO9,
207 PALMAS_REG_LDOLN,
208 PALMAS_REG_LDOUSB,
209 /* Total number of regulators */
210 PALMAS_NUM_REGS,
211};
212
213struct palmas_pmic {
214 struct palmas *palmas;
215 struct device *dev;
216 struct regulator_desc desc[PALMAS_NUM_REGS];
217 struct regulator_dev *rdev[PALMAS_NUM_REGS];
218 struct mutex mutex;
219
220 int smps123;
221 int smps457;
222
223 int range[PALMAS_REG_SMPS10];
224};
225
226/* defines so we can store the mux settings */
227#define PALMAS_GPIO_0_MUXED (1 << 0)
228#define PALMAS_GPIO_1_MUXED (1 << 1)
229#define PALMAS_GPIO_2_MUXED (1 << 2)
230#define PALMAS_GPIO_3_MUXED (1 << 3)
231#define PALMAS_GPIO_4_MUXED (1 << 4)
232#define PALMAS_GPIO_5_MUXED (1 << 5)
233#define PALMAS_GPIO_6_MUXED (1 << 6)
234#define PALMAS_GPIO_7_MUXED (1 << 7)
235
236#define PALMAS_LED1_MUXED (1 << 0)
237#define PALMAS_LED2_MUXED (1 << 1)
238
239#define PALMAS_PWM1_MUXED (1 << 0)
240#define PALMAS_PWM2_MUXED (1 << 1)
241
242/* helper macro to get correct slave number */
243#define PALMAS_BASE_TO_SLAVE(x) ((x >> 8) - 1)
244#define PALMAS_BASE_TO_REG(x, y) ((x & 0xff) + y)
245
246/* Base addresses of IP blocks in Palmas */
247#define PALMAS_SMPS_DVS_BASE 0x20
248#define PALMAS_RTC_BASE 0x100
249#define PALMAS_VALIDITY_BASE 0x118
250#define PALMAS_SMPS_BASE 0x120
251#define PALMAS_LDO_BASE 0x150
252#define PALMAS_DVFS_BASE 0x180
253#define PALMAS_PMU_CONTROL_BASE 0x1A0
254#define PALMAS_RESOURCE_BASE 0x1D4
255#define PALMAS_PU_PD_OD_BASE 0x1F4
256#define PALMAS_LED_BASE 0x200
257#define PALMAS_INTERRUPT_BASE 0x210
258#define PALMAS_USB_OTG_BASE 0x250
259#define PALMAS_VIBRATOR_BASE 0x270
260#define PALMAS_GPIO_BASE 0x280
261#define PALMAS_USB_BASE 0x290
262#define PALMAS_GPADC_BASE 0x2C0
263#define PALMAS_TRIM_GPADC_BASE 0x3CD
264
265/* Registers for function RTC */
266#define PALMAS_SECONDS_REG 0x0
267#define PALMAS_MINUTES_REG 0x1
268#define PALMAS_HOURS_REG 0x2
269#define PALMAS_DAYS_REG 0x3
270#define PALMAS_MONTHS_REG 0x4
271#define PALMAS_YEARS_REG 0x5
272#define PALMAS_WEEKS_REG 0x6
273#define PALMAS_ALARM_SECONDS_REG 0x8
274#define PALMAS_ALARM_MINUTES_REG 0x9
275#define PALMAS_ALARM_HOURS_REG 0xA
276#define PALMAS_ALARM_DAYS_REG 0xB
277#define PALMAS_ALARM_MONTHS_REG 0xC
278#define PALMAS_ALARM_YEARS_REG 0xD
279#define PALMAS_RTC_CTRL_REG 0x10
280#define PALMAS_RTC_STATUS_REG 0x11
281#define PALMAS_RTC_INTERRUPTS_REG 0x12
282#define PALMAS_RTC_COMP_LSB_REG 0x13
283#define PALMAS_RTC_COMP_MSB_REG 0x14
284#define PALMAS_RTC_RES_PROG_REG 0x15
285#define PALMAS_RTC_RESET_STATUS_REG 0x16
286
287/* Bit definitions for SECONDS_REG */
288#define PALMAS_SECONDS_REG_SEC1_MASK 0x70
289#define PALMAS_SECONDS_REG_SEC1_SHIFT 4
290#define PALMAS_SECONDS_REG_SEC0_MASK 0x0f
291#define PALMAS_SECONDS_REG_SEC0_SHIFT 0
292
293/* Bit definitions for MINUTES_REG */
294#define PALMAS_MINUTES_REG_MIN1_MASK 0x70
295#define PALMAS_MINUTES_REG_MIN1_SHIFT 4
296#define PALMAS_MINUTES_REG_MIN0_MASK 0x0f
297#define PALMAS_MINUTES_REG_MIN0_SHIFT 0
298
299/* Bit definitions for HOURS_REG */
300#define PALMAS_HOURS_REG_PM_NAM 0x80
301#define PALMAS_HOURS_REG_PM_NAM_SHIFT 7
302#define PALMAS_HOURS_REG_HOUR1_MASK 0x30
303#define PALMAS_HOURS_REG_HOUR1_SHIFT 4
304#define PALMAS_HOURS_REG_HOUR0_MASK 0x0f
305#define PALMAS_HOURS_REG_HOUR0_SHIFT 0
306
307/* Bit definitions for DAYS_REG */
308#define PALMAS_DAYS_REG_DAY1_MASK 0x30
309#define PALMAS_DAYS_REG_DAY1_SHIFT 4
310#define PALMAS_DAYS_REG_DAY0_MASK 0x0f
311#define PALMAS_DAYS_REG_DAY0_SHIFT 0
312
313/* Bit definitions for MONTHS_REG */
314#define PALMAS_MONTHS_REG_MONTH1 0x10
315#define PALMAS_MONTHS_REG_MONTH1_SHIFT 4
316#define PALMAS_MONTHS_REG_MONTH0_MASK 0x0f
317#define PALMAS_MONTHS_REG_MONTH0_SHIFT 0
318
319/* Bit definitions for YEARS_REG */
320#define PALMAS_YEARS_REG_YEAR1_MASK 0xf0
321#define PALMAS_YEARS_REG_YEAR1_SHIFT 4
322#define PALMAS_YEARS_REG_YEAR0_MASK 0x0f
323#define PALMAS_YEARS_REG_YEAR0_SHIFT 0
324
325/* Bit definitions for WEEKS_REG */
326#define PALMAS_WEEKS_REG_WEEK_MASK 0x07
327#define PALMAS_WEEKS_REG_WEEK_SHIFT 0
328
329/* Bit definitions for ALARM_SECONDS_REG */
330#define PALMAS_ALARM_SECONDS_REG_ALARM_SEC1_MASK 0x70
331#define PALMAS_ALARM_SECONDS_REG_ALARM_SEC1_SHIFT 4
332#define PALMAS_ALARM_SECONDS_REG_ALARM_SEC0_MASK 0x0f
333#define PALMAS_ALARM_SECONDS_REG_ALARM_SEC0_SHIFT 0
334
335/* Bit definitions for ALARM_MINUTES_REG */
336#define PALMAS_ALARM_MINUTES_REG_ALARM_MIN1_MASK 0x70
337#define PALMAS_ALARM_MINUTES_REG_ALARM_MIN1_SHIFT 4
338#define PALMAS_ALARM_MINUTES_REG_ALARM_MIN0_MASK 0x0f
339#define PALMAS_ALARM_MINUTES_REG_ALARM_MIN0_SHIFT 0
340
341/* Bit definitions for ALARM_HOURS_REG */
342#define PALMAS_ALARM_HOURS_REG_ALARM_PM_NAM 0x80
343#define PALMAS_ALARM_HOURS_REG_ALARM_PM_NAM_SHIFT 7
344#define PALMAS_ALARM_HOURS_REG_ALARM_HOUR1_MASK 0x30
345#define PALMAS_ALARM_HOURS_REG_ALARM_HOUR1_SHIFT 4
346#define PALMAS_ALARM_HOURS_REG_ALARM_HOUR0_MASK 0x0f
347#define PALMAS_ALARM_HOURS_REG_ALARM_HOUR0_SHIFT 0
348
349/* Bit definitions for ALARM_DAYS_REG */
350#define PALMAS_ALARM_DAYS_REG_ALARM_DAY1_MASK 0x30
351#define PALMAS_ALARM_DAYS_REG_ALARM_DAY1_SHIFT 4
352#define PALMAS_ALARM_DAYS_REG_ALARM_DAY0_MASK 0x0f
353#define PALMAS_ALARM_DAYS_REG_ALARM_DAY0_SHIFT 0
354
355/* Bit definitions for ALARM_MONTHS_REG */
356#define PALMAS_ALARM_MONTHS_REG_ALARM_MONTH1 0x10
357#define PALMAS_ALARM_MONTHS_REG_ALARM_MONTH1_SHIFT 4
358#define PALMAS_ALARM_MONTHS_REG_ALARM_MONTH0_MASK 0x0f
359#define PALMAS_ALARM_MONTHS_REG_ALARM_MONTH0_SHIFT 0
360
361/* Bit definitions for ALARM_YEARS_REG */
362#define PALMAS_ALARM_YEARS_REG_ALARM_YEAR1_MASK 0xf0
363#define PALMAS_ALARM_YEARS_REG_ALARM_YEAR1_SHIFT 4
364#define PALMAS_ALARM_YEARS_REG_ALARM_YEAR0_MASK 0x0f
365#define PALMAS_ALARM_YEARS_REG_ALARM_YEAR0_SHIFT 0
366
367/* Bit definitions for RTC_CTRL_REG */
368#define PALMAS_RTC_CTRL_REG_RTC_V_OPT 0x80
369#define PALMAS_RTC_CTRL_REG_RTC_V_OPT_SHIFT 7
370#define PALMAS_RTC_CTRL_REG_GET_TIME 0x40
371#define PALMAS_RTC_CTRL_REG_GET_TIME_SHIFT 6
372#define PALMAS_RTC_CTRL_REG_SET_32_COUNTER 0x20
373#define PALMAS_RTC_CTRL_REG_SET_32_COUNTER_SHIFT 5
374#define PALMAS_RTC_CTRL_REG_TEST_MODE 0x10
375#define PALMAS_RTC_CTRL_REG_TEST_MODE_SHIFT 4
376#define PALMAS_RTC_CTRL_REG_MODE_12_24 0x08
377#define PALMAS_RTC_CTRL_REG_MODE_12_24_SHIFT 3
378#define PALMAS_RTC_CTRL_REG_AUTO_COMP 0x04
379#define PALMAS_RTC_CTRL_REG_AUTO_COMP_SHIFT 2
380#define PALMAS_RTC_CTRL_REG_ROUND_30S 0x02
381#define PALMAS_RTC_CTRL_REG_ROUND_30S_SHIFT 1
382#define PALMAS_RTC_CTRL_REG_STOP_RTC 0x01
383#define PALMAS_RTC_CTRL_REG_STOP_RTC_SHIFT 0
384
385/* Bit definitions for RTC_STATUS_REG */
386#define PALMAS_RTC_STATUS_REG_POWER_UP 0x80
387#define PALMAS_RTC_STATUS_REG_POWER_UP_SHIFT 7
388#define PALMAS_RTC_STATUS_REG_ALARM 0x40
389#define PALMAS_RTC_STATUS_REG_ALARM_SHIFT 6
390#define PALMAS_RTC_STATUS_REG_EVENT_1D 0x20
391#define PALMAS_RTC_STATUS_REG_EVENT_1D_SHIFT 5
392#define PALMAS_RTC_STATUS_REG_EVENT_1H 0x10
393#define PALMAS_RTC_STATUS_REG_EVENT_1H_SHIFT 4
394#define PALMAS_RTC_STATUS_REG_EVENT_1M 0x08
395#define PALMAS_RTC_STATUS_REG_EVENT_1M_SHIFT 3
396#define PALMAS_RTC_STATUS_REG_EVENT_1S 0x04
397#define PALMAS_RTC_STATUS_REG_EVENT_1S_SHIFT 2
398#define PALMAS_RTC_STATUS_REG_RUN 0x02
399#define PALMAS_RTC_STATUS_REG_RUN_SHIFT 1
400
401/* Bit definitions for RTC_INTERRUPTS_REG */
402#define PALMAS_RTC_INTERRUPTS_REG_IT_SLEEP_MASK_EN 0x10
403#define PALMAS_RTC_INTERRUPTS_REG_IT_SLEEP_MASK_EN_SHIFT 4
404#define PALMAS_RTC_INTERRUPTS_REG_IT_ALARM 0x08
405#define PALMAS_RTC_INTERRUPTS_REG_IT_ALARM_SHIFT 3
406#define PALMAS_RTC_INTERRUPTS_REG_IT_TIMER 0x04
407#define PALMAS_RTC_INTERRUPTS_REG_IT_TIMER_SHIFT 2
408#define PALMAS_RTC_INTERRUPTS_REG_EVERY_MASK 0x03
409#define PALMAS_RTC_INTERRUPTS_REG_EVERY_SHIFT 0
410
411/* Bit definitions for RTC_COMP_LSB_REG */
412#define PALMAS_RTC_COMP_LSB_REG_RTC_COMP_LSB_MASK 0xff
413#define PALMAS_RTC_COMP_LSB_REG_RTC_COMP_LSB_SHIFT 0
414
415/* Bit definitions for RTC_COMP_MSB_REG */
416#define PALMAS_RTC_COMP_MSB_REG_RTC_COMP_MSB_MASK 0xff
417#define PALMAS_RTC_COMP_MSB_REG_RTC_COMP_MSB_SHIFT 0
418
419/* Bit definitions for RTC_RES_PROG_REG */
420#define PALMAS_RTC_RES_PROG_REG_SW_RES_PROG_MASK 0x3f
421#define PALMAS_RTC_RES_PROG_REG_SW_RES_PROG_SHIFT 0
422
423/* Bit definitions for RTC_RESET_STATUS_REG */
424#define PALMAS_RTC_RESET_STATUS_REG_RESET_STATUS 0x01
425#define PALMAS_RTC_RESET_STATUS_REG_RESET_STATUS_SHIFT 0
426
427/* Registers for function BACKUP */
428#define PALMAS_BACKUP0 0x0
429#define PALMAS_BACKUP1 0x1
430#define PALMAS_BACKUP2 0x2
431#define PALMAS_BACKUP3 0x3
432#define PALMAS_BACKUP4 0x4
433#define PALMAS_BACKUP5 0x5
434#define PALMAS_BACKUP6 0x6
435#define PALMAS_BACKUP7 0x7
436
437/* Bit definitions for BACKUP0 */
438#define PALMAS_BACKUP0_BACKUP_MASK 0xff
439#define PALMAS_BACKUP0_BACKUP_SHIFT 0
440
441/* Bit definitions for BACKUP1 */
442#define PALMAS_BACKUP1_BACKUP_MASK 0xff
443#define PALMAS_BACKUP1_BACKUP_SHIFT 0
444
445/* Bit definitions for BACKUP2 */
446#define PALMAS_BACKUP2_BACKUP_MASK 0xff
447#define PALMAS_BACKUP2_BACKUP_SHIFT 0
448
449/* Bit definitions for BACKUP3 */
450#define PALMAS_BACKUP3_BACKUP_MASK 0xff
451#define PALMAS_BACKUP3_BACKUP_SHIFT 0
452
453/* Bit definitions for BACKUP4 */
454#define PALMAS_BACKUP4_BACKUP_MASK 0xff
455#define PALMAS_BACKUP4_BACKUP_SHIFT 0
456
457/* Bit definitions for BACKUP5 */
458#define PALMAS_BACKUP5_BACKUP_MASK 0xff
459#define PALMAS_BACKUP5_BACKUP_SHIFT 0
460
461/* Bit definitions for BACKUP6 */
462#define PALMAS_BACKUP6_BACKUP_MASK 0xff
463#define PALMAS_BACKUP6_BACKUP_SHIFT 0
464
465/* Bit definitions for BACKUP7 */
466#define PALMAS_BACKUP7_BACKUP_MASK 0xff
467#define PALMAS_BACKUP7_BACKUP_SHIFT 0
468
469/* Registers for function SMPS */
470#define PALMAS_SMPS12_CTRL 0x0
471#define PALMAS_SMPS12_TSTEP 0x1
472#define PALMAS_SMPS12_FORCE 0x2
473#define PALMAS_SMPS12_VOLTAGE 0x3
474#define PALMAS_SMPS3_CTRL 0x4
475#define PALMAS_SMPS3_VOLTAGE 0x7
476#define PALMAS_SMPS45_CTRL 0x8
477#define PALMAS_SMPS45_TSTEP 0x9
478#define PALMAS_SMPS45_FORCE 0xA
479#define PALMAS_SMPS45_VOLTAGE 0xB
480#define PALMAS_SMPS6_CTRL 0xC
481#define PALMAS_SMPS6_TSTEP 0xD
482#define PALMAS_SMPS6_FORCE 0xE
483#define PALMAS_SMPS6_VOLTAGE 0xF
484#define PALMAS_SMPS7_CTRL 0x10
485#define PALMAS_SMPS7_VOLTAGE 0x13
486#define PALMAS_SMPS8_CTRL 0x14
487#define PALMAS_SMPS8_TSTEP 0x15
488#define PALMAS_SMPS8_FORCE 0x16
489#define PALMAS_SMPS8_VOLTAGE 0x17
490#define PALMAS_SMPS9_CTRL 0x18
491#define PALMAS_SMPS9_VOLTAGE 0x1B
492#define PALMAS_SMPS10_CTRL 0x1C
493#define PALMAS_SMPS10_STATUS 0x1F
494#define PALMAS_SMPS_CTRL 0x24
495#define PALMAS_SMPS_PD_CTRL 0x25
496#define PALMAS_SMPS_DITHER_EN 0x26
497#define PALMAS_SMPS_THERMAL_EN 0x27
498#define PALMAS_SMPS_THERMAL_STATUS 0x28
499#define PALMAS_SMPS_SHORT_STATUS 0x29
500#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN 0x2A
501#define PALMAS_SMPS_POWERGOOD_MASK1 0x2B
502#define PALMAS_SMPS_POWERGOOD_MASK2 0x2C
503
504/* Bit definitions for SMPS12_CTRL */
505#define PALMAS_SMPS12_CTRL_WR_S 0x80
506#define PALMAS_SMPS12_CTRL_WR_S_SHIFT 7
507#define PALMAS_SMPS12_CTRL_ROOF_FLOOR_EN 0x40
508#define PALMAS_SMPS12_CTRL_ROOF_FLOOR_EN_SHIFT 6
509#define PALMAS_SMPS12_CTRL_STATUS_MASK 0x30
510#define PALMAS_SMPS12_CTRL_STATUS_SHIFT 4
511#define PALMAS_SMPS12_CTRL_MODE_SLEEP_MASK 0x0c
512#define PALMAS_SMPS12_CTRL_MODE_SLEEP_SHIFT 2
513#define PALMAS_SMPS12_CTRL_MODE_ACTIVE_MASK 0x03
514#define PALMAS_SMPS12_CTRL_MODE_ACTIVE_SHIFT 0
515
516/* Bit definitions for SMPS12_TSTEP */
517#define PALMAS_SMPS12_TSTEP_TSTEP_MASK 0x03
518#define PALMAS_SMPS12_TSTEP_TSTEP_SHIFT 0
519
520/* Bit definitions for SMPS12_FORCE */
521#define PALMAS_SMPS12_FORCE_CMD 0x80
522#define PALMAS_SMPS12_FORCE_CMD_SHIFT 7
523#define PALMAS_SMPS12_FORCE_VSEL_MASK 0x7f
524#define PALMAS_SMPS12_FORCE_VSEL_SHIFT 0
525
526/* Bit definitions for SMPS12_VOLTAGE */
527#define PALMAS_SMPS12_VOLTAGE_RANGE 0x80
528#define PALMAS_SMPS12_VOLTAGE_RANGE_SHIFT 7
529#define PALMAS_SMPS12_VOLTAGE_VSEL_MASK 0x7f
530#define PALMAS_SMPS12_VOLTAGE_VSEL_SHIFT 0
531
532/* Bit definitions for SMPS3_CTRL */
533#define PALMAS_SMPS3_CTRL_WR_S 0x80
534#define PALMAS_SMPS3_CTRL_WR_S_SHIFT 7
535#define PALMAS_SMPS3_CTRL_STATUS_MASK 0x30
536#define PALMAS_SMPS3_CTRL_STATUS_SHIFT 4
537#define PALMAS_SMPS3_CTRL_MODE_SLEEP_MASK 0x0c
538#define PALMAS_SMPS3_CTRL_MODE_SLEEP_SHIFT 2
539#define PALMAS_SMPS3_CTRL_MODE_ACTIVE_MASK 0x03
540#define PALMAS_SMPS3_CTRL_MODE_ACTIVE_SHIFT 0
541
542/* Bit definitions for SMPS3_VOLTAGE */
543#define PALMAS_SMPS3_VOLTAGE_RANGE 0x80
544#define PALMAS_SMPS3_VOLTAGE_RANGE_SHIFT 7
545#define PALMAS_SMPS3_VOLTAGE_VSEL_MASK 0x7f
546#define PALMAS_SMPS3_VOLTAGE_VSEL_SHIFT 0
547
548/* Bit definitions for SMPS45_CTRL */
549#define PALMAS_SMPS45_CTRL_WR_S 0x80
550#define PALMAS_SMPS45_CTRL_WR_S_SHIFT 7
551#define PALMAS_SMPS45_CTRL_ROOF_FLOOR_EN 0x40
552#define PALMAS_SMPS45_CTRL_ROOF_FLOOR_EN_SHIFT 6
553#define PALMAS_SMPS45_CTRL_STATUS_MASK 0x30
554#define PALMAS_SMPS45_CTRL_STATUS_SHIFT 4
555#define PALMAS_SMPS45_CTRL_MODE_SLEEP_MASK 0x0c
556#define PALMAS_SMPS45_CTRL_MODE_SLEEP_SHIFT 2
557#define PALMAS_SMPS45_CTRL_MODE_ACTIVE_MASK 0x03
558#define PALMAS_SMPS45_CTRL_MODE_ACTIVE_SHIFT 0
559
560/* Bit definitions for SMPS45_TSTEP */
561#define PALMAS_SMPS45_TSTEP_TSTEP_MASK 0x03
562#define PALMAS_SMPS45_TSTEP_TSTEP_SHIFT 0
563
564/* Bit definitions for SMPS45_FORCE */
565#define PALMAS_SMPS45_FORCE_CMD 0x80
566#define PALMAS_SMPS45_FORCE_CMD_SHIFT 7
567#define PALMAS_SMPS45_FORCE_VSEL_MASK 0x7f
568#define PALMAS_SMPS45_FORCE_VSEL_SHIFT 0
569
570/* Bit definitions for SMPS45_VOLTAGE */
571#define PALMAS_SMPS45_VOLTAGE_RANGE 0x80
572#define PALMAS_SMPS45_VOLTAGE_RANGE_SHIFT 7
573#define PALMAS_SMPS45_VOLTAGE_VSEL_MASK 0x7f
574#define PALMAS_SMPS45_VOLTAGE_VSEL_SHIFT 0
575
576/* Bit definitions for SMPS6_CTRL */
577#define PALMAS_SMPS6_CTRL_WR_S 0x80
578#define PALMAS_SMPS6_CTRL_WR_S_SHIFT 7
579#define PALMAS_SMPS6_CTRL_ROOF_FLOOR_EN 0x40
580#define PALMAS_SMPS6_CTRL_ROOF_FLOOR_EN_SHIFT 6
581#define PALMAS_SMPS6_CTRL_STATUS_MASK 0x30
582#define PALMAS_SMPS6_CTRL_STATUS_SHIFT 4
583#define PALMAS_SMPS6_CTRL_MODE_SLEEP_MASK 0x0c
584#define PALMAS_SMPS6_CTRL_MODE_SLEEP_SHIFT 2
585#define PALMAS_SMPS6_CTRL_MODE_ACTIVE_MASK 0x03
586#define PALMAS_SMPS6_CTRL_MODE_ACTIVE_SHIFT 0
587
588/* Bit definitions for SMPS6_TSTEP */
589#define PALMAS_SMPS6_TSTEP_TSTEP_MASK 0x03
590#define PALMAS_SMPS6_TSTEP_TSTEP_SHIFT 0
591
592/* Bit definitions for SMPS6_FORCE */
593#define PALMAS_SMPS6_FORCE_CMD 0x80
594#define PALMAS_SMPS6_FORCE_CMD_SHIFT 7
595#define PALMAS_SMPS6_FORCE_VSEL_MASK 0x7f
596#define PALMAS_SMPS6_FORCE_VSEL_SHIFT 0
597
598/* Bit definitions for SMPS6_VOLTAGE */
599#define PALMAS_SMPS6_VOLTAGE_RANGE 0x80
600#define PALMAS_SMPS6_VOLTAGE_RANGE_SHIFT 7
601#define PALMAS_SMPS6_VOLTAGE_VSEL_MASK 0x7f
602#define PALMAS_SMPS6_VOLTAGE_VSEL_SHIFT 0
603
604/* Bit definitions for SMPS7_CTRL */
605#define PALMAS_SMPS7_CTRL_WR_S 0x80
606#define PALMAS_SMPS7_CTRL_WR_S_SHIFT 7
607#define PALMAS_SMPS7_CTRL_STATUS_MASK 0x30
608#define PALMAS_SMPS7_CTRL_STATUS_SHIFT 4
609#define PALMAS_SMPS7_CTRL_MODE_SLEEP_MASK 0x0c
610#define PALMAS_SMPS7_CTRL_MODE_SLEEP_SHIFT 2
611#define PALMAS_SMPS7_CTRL_MODE_ACTIVE_MASK 0x03
612#define PALMAS_SMPS7_CTRL_MODE_ACTIVE_SHIFT 0
613
614/* Bit definitions for SMPS7_VOLTAGE */
615#define PALMAS_SMPS7_VOLTAGE_RANGE 0x80
616#define PALMAS_SMPS7_VOLTAGE_RANGE_SHIFT 7
617#define PALMAS_SMPS7_VOLTAGE_VSEL_MASK 0x7f
618#define PALMAS_SMPS7_VOLTAGE_VSEL_SHIFT 0
619
620/* Bit definitions for SMPS8_CTRL */
621#define PALMAS_SMPS8_CTRL_WR_S 0x80
622#define PALMAS_SMPS8_CTRL_WR_S_SHIFT 7
623#define PALMAS_SMPS8_CTRL_ROOF_FLOOR_EN 0x40
624#define PALMAS_SMPS8_CTRL_ROOF_FLOOR_EN_SHIFT 6
625#define PALMAS_SMPS8_CTRL_STATUS_MASK 0x30
626#define PALMAS_SMPS8_CTRL_STATUS_SHIFT 4
627#define PALMAS_SMPS8_CTRL_MODE_SLEEP_MASK 0x0c
628#define PALMAS_SMPS8_CTRL_MODE_SLEEP_SHIFT 2
629#define PALMAS_SMPS8_CTRL_MODE_ACTIVE_MASK 0x03
630#define PALMAS_SMPS8_CTRL_MODE_ACTIVE_SHIFT 0
631
632/* Bit definitions for SMPS8_TSTEP */
633#define PALMAS_SMPS8_TSTEP_TSTEP_MASK 0x03
634#define PALMAS_SMPS8_TSTEP_TSTEP_SHIFT 0
635
636/* Bit definitions for SMPS8_FORCE */
637#define PALMAS_SMPS8_FORCE_CMD 0x80
638#define PALMAS_SMPS8_FORCE_CMD_SHIFT 7
639#define PALMAS_SMPS8_FORCE_VSEL_MASK 0x7f
640#define PALMAS_SMPS8_FORCE_VSEL_SHIFT 0
641
642/* Bit definitions for SMPS8_VOLTAGE */
643#define PALMAS_SMPS8_VOLTAGE_RANGE 0x80
644#define PALMAS_SMPS8_VOLTAGE_RANGE_SHIFT 7
645#define PALMAS_SMPS8_VOLTAGE_VSEL_MASK 0x7f
646#define PALMAS_SMPS8_VOLTAGE_VSEL_SHIFT 0
647
648/* Bit definitions for SMPS9_CTRL */
649#define PALMAS_SMPS9_CTRL_WR_S 0x80
650#define PALMAS_SMPS9_CTRL_WR_S_SHIFT 7
651#define PALMAS_SMPS9_CTRL_STATUS_MASK 0x30
652#define PALMAS_SMPS9_CTRL_STATUS_SHIFT 4
653#define PALMAS_SMPS9_CTRL_MODE_SLEEP_MASK 0x0c
654#define PALMAS_SMPS9_CTRL_MODE_SLEEP_SHIFT 2
655#define PALMAS_SMPS9_CTRL_MODE_ACTIVE_MASK 0x03
656#define PALMAS_SMPS9_CTRL_MODE_ACTIVE_SHIFT 0
657
658/* Bit definitions for SMPS9_VOLTAGE */
659#define PALMAS_SMPS9_VOLTAGE_RANGE 0x80
660#define PALMAS_SMPS9_VOLTAGE_RANGE_SHIFT 7
661#define PALMAS_SMPS9_VOLTAGE_VSEL_MASK 0x7f
662#define PALMAS_SMPS9_VOLTAGE_VSEL_SHIFT 0
663
664/* Bit definitions for SMPS10_CTRL */
665#define PALMAS_SMPS10_CTRL_MODE_SLEEP_MASK 0xf0
666#define PALMAS_SMPS10_CTRL_MODE_SLEEP_SHIFT 4
667#define PALMAS_SMPS10_CTRL_MODE_ACTIVE_MASK 0x0f
668#define PALMAS_SMPS10_CTRL_MODE_ACTIVE_SHIFT 0
669
670/* Bit definitions for SMPS10_STATUS */
671#define PALMAS_SMPS10_STATUS_STATUS_MASK 0x0f
672#define PALMAS_SMPS10_STATUS_STATUS_SHIFT 0
673
674/* Bit definitions for SMPS_CTRL */
675#define PALMAS_SMPS_CTRL_SMPS45_SMPS457_EN 0x20
676#define PALMAS_SMPS_CTRL_SMPS45_SMPS457_EN_SHIFT 5
677#define PALMAS_SMPS_CTRL_SMPS12_SMPS123_EN 0x10
678#define PALMAS_SMPS_CTRL_SMPS12_SMPS123_EN_SHIFT 4
679#define PALMAS_SMPS_CTRL_SMPS45_PHASE_CTRL_MASK 0x0c
680#define PALMAS_SMPS_CTRL_SMPS45_PHASE_CTRL_SHIFT 2
681#define PALMAS_SMPS_CTRL_SMPS123_PHASE_CTRL_MASK 0x03
682#define PALMAS_SMPS_CTRL_SMPS123_PHASE_CTRL_SHIFT 0
683
684/* Bit definitions for SMPS_PD_CTRL */
685#define PALMAS_SMPS_PD_CTRL_SMPS9 0x40
686#define PALMAS_SMPS_PD_CTRL_SMPS9_SHIFT 6
687#define PALMAS_SMPS_PD_CTRL_SMPS8 0x20
688#define PALMAS_SMPS_PD_CTRL_SMPS8_SHIFT 5
689#define PALMAS_SMPS_PD_CTRL_SMPS7 0x10
690#define PALMAS_SMPS_PD_CTRL_SMPS7_SHIFT 4
691#define PALMAS_SMPS_PD_CTRL_SMPS6 0x08
692#define PALMAS_SMPS_PD_CTRL_SMPS6_SHIFT 3
693#define PALMAS_SMPS_PD_CTRL_SMPS45 0x04
694#define PALMAS_SMPS_PD_CTRL_SMPS45_SHIFT 2
695#define PALMAS_SMPS_PD_CTRL_SMPS3 0x02
696#define PALMAS_SMPS_PD_CTRL_SMPS3_SHIFT 1
697#define PALMAS_SMPS_PD_CTRL_SMPS12 0x01
698#define PALMAS_SMPS_PD_CTRL_SMPS12_SHIFT 0
699
700/* Bit definitions for SMPS_THERMAL_EN */
701#define PALMAS_SMPS_THERMAL_EN_SMPS9 0x40
702#define PALMAS_SMPS_THERMAL_EN_SMPS9_SHIFT 6
703#define PALMAS_SMPS_THERMAL_EN_SMPS8 0x20
704#define PALMAS_SMPS_THERMAL_EN_SMPS8_SHIFT 5
705#define PALMAS_SMPS_THERMAL_EN_SMPS6 0x08
706#define PALMAS_SMPS_THERMAL_EN_SMPS6_SHIFT 3
707#define PALMAS_SMPS_THERMAL_EN_SMPS457 0x04
708#define PALMAS_SMPS_THERMAL_EN_SMPS457_SHIFT 2
709#define PALMAS_SMPS_THERMAL_EN_SMPS123 0x01
710#define PALMAS_SMPS_THERMAL_EN_SMPS123_SHIFT 0
711
712/* Bit definitions for SMPS_THERMAL_STATUS */
713#define PALMAS_SMPS_THERMAL_STATUS_SMPS9 0x40
714#define PALMAS_SMPS_THERMAL_STATUS_SMPS9_SHIFT 6
715#define PALMAS_SMPS_THERMAL_STATUS_SMPS8 0x20
716#define PALMAS_SMPS_THERMAL_STATUS_SMPS8_SHIFT 5
717#define PALMAS_SMPS_THERMAL_STATUS_SMPS6 0x08
718#define PALMAS_SMPS_THERMAL_STATUS_SMPS6_SHIFT 3
719#define PALMAS_SMPS_THERMAL_STATUS_SMPS457 0x04
720#define PALMAS_SMPS_THERMAL_STATUS_SMPS457_SHIFT 2
721#define PALMAS_SMPS_THERMAL_STATUS_SMPS123 0x01
722#define PALMAS_SMPS_THERMAL_STATUS_SMPS123_SHIFT 0
723
724/* Bit definitions for SMPS_SHORT_STATUS */
725#define PALMAS_SMPS_SHORT_STATUS_SMPS10 0x80
726#define PALMAS_SMPS_SHORT_STATUS_SMPS10_SHIFT 7
727#define PALMAS_SMPS_SHORT_STATUS_SMPS9 0x40
728#define PALMAS_SMPS_SHORT_STATUS_SMPS9_SHIFT 6
729#define PALMAS_SMPS_SHORT_STATUS_SMPS8 0x20
730#define PALMAS_SMPS_SHORT_STATUS_SMPS8_SHIFT 5
731#define PALMAS_SMPS_SHORT_STATUS_SMPS7 0x10
732#define PALMAS_SMPS_SHORT_STATUS_SMPS7_SHIFT 4
733#define PALMAS_SMPS_SHORT_STATUS_SMPS6 0x08
734#define PALMAS_SMPS_SHORT_STATUS_SMPS6_SHIFT 3
735#define PALMAS_SMPS_SHORT_STATUS_SMPS45 0x04
736#define PALMAS_SMPS_SHORT_STATUS_SMPS45_SHIFT 2
737#define PALMAS_SMPS_SHORT_STATUS_SMPS3 0x02
738#define PALMAS_SMPS_SHORT_STATUS_SMPS3_SHIFT 1
739#define PALMAS_SMPS_SHORT_STATUS_SMPS12 0x01
740#define PALMAS_SMPS_SHORT_STATUS_SMPS12_SHIFT 0
741
742/* Bit definitions for SMPS_NEGATIVE_CURRENT_LIMIT_EN */
743#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS9 0x40
744#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS9_SHIFT 6
745#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS8 0x20
746#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS8_SHIFT 5
747#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS7 0x10
748#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS7_SHIFT 4
749#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS6 0x08
750#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS6_SHIFT 3
751#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS45 0x04
752#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS45_SHIFT 2
753#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS3 0x02
754#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS3_SHIFT 1
755#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS12 0x01
756#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS12_SHIFT 0
757
758/* Bit definitions for SMPS_POWERGOOD_MASK1 */
759#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS10 0x80
760#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS10_SHIFT 7
761#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS9 0x40
762#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS9_SHIFT 6
763#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS8 0x20
764#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS8_SHIFT 5
765#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS7 0x10
766#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS7_SHIFT 4
767#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS6 0x08
768#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS6_SHIFT 3
769#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS45 0x04
770#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS45_SHIFT 2
771#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS3 0x02
772#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS3_SHIFT 1
773#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS12 0x01
774#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS12_SHIFT 0
775
776/* Bit definitions for SMPS_POWERGOOD_MASK2 */
777#define PALMAS_SMPS_POWERGOOD_MASK2_POWERGOOD_TYPE_SELECT 0x80
778#define PALMAS_SMPS_POWERGOOD_MASK2_POWERGOOD_TYPE_SELECT_SHIFT 7
779#define PALMAS_SMPS_POWERGOOD_MASK2_GPIO_7 0x04
780#define PALMAS_SMPS_POWERGOOD_MASK2_GPIO_7_SHIFT 2
781#define PALMAS_SMPS_POWERGOOD_MASK2_VBUS 0x02
782#define PALMAS_SMPS_POWERGOOD_MASK2_VBUS_SHIFT 1
783#define PALMAS_SMPS_POWERGOOD_MASK2_ACOK 0x01
784#define PALMAS_SMPS_POWERGOOD_MASK2_ACOK_SHIFT 0
785
786/* Registers for function LDO */
787#define PALMAS_LDO1_CTRL 0x0
788#define PALMAS_LDO1_VOLTAGE 0x1
789#define PALMAS_LDO2_CTRL 0x2
790#define PALMAS_LDO2_VOLTAGE 0x3
791#define PALMAS_LDO3_CTRL 0x4
792#define PALMAS_LDO3_VOLTAGE 0x5
793#define PALMAS_LDO4_CTRL 0x6
794#define PALMAS_LDO4_VOLTAGE 0x7
795#define PALMAS_LDO5_CTRL 0x8
796#define PALMAS_LDO5_VOLTAGE 0x9
797#define PALMAS_LDO6_CTRL 0xA
798#define PALMAS_LDO6_VOLTAGE 0xB
799#define PALMAS_LDO7_CTRL 0xC
800#define PALMAS_LDO7_VOLTAGE 0xD
801#define PALMAS_LDO8_CTRL 0xE
802#define PALMAS_LDO8_VOLTAGE 0xF
803#define PALMAS_LDO9_CTRL 0x10
804#define PALMAS_LDO9_VOLTAGE 0x11
805#define PALMAS_LDOLN_CTRL 0x12
806#define PALMAS_LDOLN_VOLTAGE 0x13
807#define PALMAS_LDOUSB_CTRL 0x14
808#define PALMAS_LDOUSB_VOLTAGE 0x15
809#define PALMAS_LDO_CTRL 0x1A
810#define PALMAS_LDO_PD_CTRL1 0x1B
811#define PALMAS_LDO_PD_CTRL2 0x1C
812#define PALMAS_LDO_SHORT_STATUS1 0x1D
813#define PALMAS_LDO_SHORT_STATUS2 0x1E
814
815/* Bit definitions for LDO1_CTRL */
816#define PALMAS_LDO1_CTRL_WR_S 0x80
817#define PALMAS_LDO1_CTRL_WR_S_SHIFT 7
818#define PALMAS_LDO1_CTRL_STATUS 0x10
819#define PALMAS_LDO1_CTRL_STATUS_SHIFT 4
820#define PALMAS_LDO1_CTRL_MODE_SLEEP 0x04
821#define PALMAS_LDO1_CTRL_MODE_SLEEP_SHIFT 2
822#define PALMAS_LDO1_CTRL_MODE_ACTIVE 0x01
823#define PALMAS_LDO1_CTRL_MODE_ACTIVE_SHIFT 0
824
825/* Bit definitions for LDO1_VOLTAGE */
826#define PALMAS_LDO1_VOLTAGE_VSEL_MASK 0x3f
827#define PALMAS_LDO1_VOLTAGE_VSEL_SHIFT 0
828
829/* Bit definitions for LDO2_CTRL */
830#define PALMAS_LDO2_CTRL_WR_S 0x80
831#define PALMAS_LDO2_CTRL_WR_S_SHIFT 7
832#define PALMAS_LDO2_CTRL_STATUS 0x10
833#define PALMAS_LDO2_CTRL_STATUS_SHIFT 4
834#define PALMAS_LDO2_CTRL_MODE_SLEEP 0x04
835#define PALMAS_LDO2_CTRL_MODE_SLEEP_SHIFT 2
836#define PALMAS_LDO2_CTRL_MODE_ACTIVE 0x01
837#define PALMAS_LDO2_CTRL_MODE_ACTIVE_SHIFT 0
838
839/* Bit definitions for LDO2_VOLTAGE */
840#define PALMAS_LDO2_VOLTAGE_VSEL_MASK 0x3f
841#define PALMAS_LDO2_VOLTAGE_VSEL_SHIFT 0
842
843/* Bit definitions for LDO3_CTRL */
844#define PALMAS_LDO3_CTRL_WR_S 0x80
845#define PALMAS_LDO3_CTRL_WR_S_SHIFT 7
846#define PALMAS_LDO3_CTRL_STATUS 0x10
847#define PALMAS_LDO3_CTRL_STATUS_SHIFT 4
848#define PALMAS_LDO3_CTRL_MODE_SLEEP 0x04
849#define PALMAS_LDO3_CTRL_MODE_SLEEP_SHIFT 2
850#define PALMAS_LDO3_CTRL_MODE_ACTIVE 0x01
851#define PALMAS_LDO3_CTRL_MODE_ACTIVE_SHIFT 0
852
853/* Bit definitions for LDO3_VOLTAGE */
854#define PALMAS_LDO3_VOLTAGE_VSEL_MASK 0x3f
855#define PALMAS_LDO3_VOLTAGE_VSEL_SHIFT 0
856
857/* Bit definitions for LDO4_CTRL */
858#define PALMAS_LDO4_CTRL_WR_S 0x80
859#define PALMAS_LDO4_CTRL_WR_S_SHIFT 7
860#define PALMAS_LDO4_CTRL_STATUS 0x10
861#define PALMAS_LDO4_CTRL_STATUS_SHIFT 4
862#define PALMAS_LDO4_CTRL_MODE_SLEEP 0x04
863#define PALMAS_LDO4_CTRL_MODE_SLEEP_SHIFT 2
864#define PALMAS_LDO4_CTRL_MODE_ACTIVE 0x01
865#define PALMAS_LDO4_CTRL_MODE_ACTIVE_SHIFT 0
866
867/* Bit definitions for LDO4_VOLTAGE */
868#define PALMAS_LDO4_VOLTAGE_VSEL_MASK 0x3f
869#define PALMAS_LDO4_VOLTAGE_VSEL_SHIFT 0
870
871/* Bit definitions for LDO5_CTRL */
872#define PALMAS_LDO5_CTRL_WR_S 0x80
873#define PALMAS_LDO5_CTRL_WR_S_SHIFT 7
874#define PALMAS_LDO5_CTRL_STATUS 0x10
875#define PALMAS_LDO5_CTRL_STATUS_SHIFT 4
876#define PALMAS_LDO5_CTRL_MODE_SLEEP 0x04
877#define PALMAS_LDO5_CTRL_MODE_SLEEP_SHIFT 2
878#define PALMAS_LDO5_CTRL_MODE_ACTIVE 0x01
879#define PALMAS_LDO5_CTRL_MODE_ACTIVE_SHIFT 0
880
881/* Bit definitions for LDO5_VOLTAGE */
882#define PALMAS_LDO5_VOLTAGE_VSEL_MASK 0x3f
883#define PALMAS_LDO5_VOLTAGE_VSEL_SHIFT 0
884
885/* Bit definitions for LDO6_CTRL */
886#define PALMAS_LDO6_CTRL_WR_S 0x80
887#define PALMAS_LDO6_CTRL_WR_S_SHIFT 7
888#define PALMAS_LDO6_CTRL_LDO_VIB_EN 0x40
889#define PALMAS_LDO6_CTRL_LDO_VIB_EN_SHIFT 6
890#define PALMAS_LDO6_CTRL_STATUS 0x10
891#define PALMAS_LDO6_CTRL_STATUS_SHIFT 4
892#define PALMAS_LDO6_CTRL_MODE_SLEEP 0x04
893#define PALMAS_LDO6_CTRL_MODE_SLEEP_SHIFT 2
894#define PALMAS_LDO6_CTRL_MODE_ACTIVE 0x01
895#define PALMAS_LDO6_CTRL_MODE_ACTIVE_SHIFT 0
896
897/* Bit definitions for LDO6_VOLTAGE */
898#define PALMAS_LDO6_VOLTAGE_VSEL_MASK 0x3f
899#define PALMAS_LDO6_VOLTAGE_VSEL_SHIFT 0
900
901/* Bit definitions for LDO7_CTRL */
902#define PALMAS_LDO7_CTRL_WR_S 0x80
903#define PALMAS_LDO7_CTRL_WR_S_SHIFT 7
904#define PALMAS_LDO7_CTRL_STATUS 0x10
905#define PALMAS_LDO7_CTRL_STATUS_SHIFT 4
906#define PALMAS_LDO7_CTRL_MODE_SLEEP 0x04
907#define PALMAS_LDO7_CTRL_MODE_SLEEP_SHIFT 2
908#define PALMAS_LDO7_CTRL_MODE_ACTIVE 0x01
909#define PALMAS_LDO7_CTRL_MODE_ACTIVE_SHIFT 0
910
911/* Bit definitions for LDO7_VOLTAGE */
912#define PALMAS_LDO7_VOLTAGE_VSEL_MASK 0x3f
913#define PALMAS_LDO7_VOLTAGE_VSEL_SHIFT 0
914
915/* Bit definitions for LDO8_CTRL */
916#define PALMAS_LDO8_CTRL_WR_S 0x80
917#define PALMAS_LDO8_CTRL_WR_S_SHIFT 7
918#define PALMAS_LDO8_CTRL_LDO_TRACKING_EN 0x40
919#define PALMAS_LDO8_CTRL_LDO_TRACKING_EN_SHIFT 6
920#define PALMAS_LDO8_CTRL_STATUS 0x10
921#define PALMAS_LDO8_CTRL_STATUS_SHIFT 4
922#define PALMAS_LDO8_CTRL_MODE_SLEEP 0x04
923#define PALMAS_LDO8_CTRL_MODE_SLEEP_SHIFT 2
924#define PALMAS_LDO8_CTRL_MODE_ACTIVE 0x01
925#define PALMAS_LDO8_CTRL_MODE_ACTIVE_SHIFT 0
926
927/* Bit definitions for LDO8_VOLTAGE */
928#define PALMAS_LDO8_VOLTAGE_VSEL_MASK 0x3f
929#define PALMAS_LDO8_VOLTAGE_VSEL_SHIFT 0
930
931/* Bit definitions for LDO9_CTRL */
932#define PALMAS_LDO9_CTRL_WR_S 0x80
933#define PALMAS_LDO9_CTRL_WR_S_SHIFT 7
934#define PALMAS_LDO9_CTRL_LDO_BYPASS_EN 0x40
935#define PALMAS_LDO9_CTRL_LDO_BYPASS_EN_SHIFT 6
936#define PALMAS_LDO9_CTRL_STATUS 0x10
937#define PALMAS_LDO9_CTRL_STATUS_SHIFT 4
938#define PALMAS_LDO9_CTRL_MODE_SLEEP 0x04
939#define PALMAS_LDO9_CTRL_MODE_SLEEP_SHIFT 2
940#define PALMAS_LDO9_CTRL_MODE_ACTIVE 0x01
941#define PALMAS_LDO9_CTRL_MODE_ACTIVE_SHIFT 0
942
943/* Bit definitions for LDO9_VOLTAGE */
944#define PALMAS_LDO9_VOLTAGE_VSEL_MASK 0x3f
945#define PALMAS_LDO9_VOLTAGE_VSEL_SHIFT 0
946
947/* Bit definitions for LDOLN_CTRL */
948#define PALMAS_LDOLN_CTRL_WR_S 0x80
949#define PALMAS_LDOLN_CTRL_WR_S_SHIFT 7
950#define PALMAS_LDOLN_CTRL_STATUS 0x10
951#define PALMAS_LDOLN_CTRL_STATUS_SHIFT 4
952#define PALMAS_LDOLN_CTRL_MODE_SLEEP 0x04
953#define PALMAS_LDOLN_CTRL_MODE_SLEEP_SHIFT 2
954#define PALMAS_LDOLN_CTRL_MODE_ACTIVE 0x01
955#define PALMAS_LDOLN_CTRL_MODE_ACTIVE_SHIFT 0
956
957/* Bit definitions for LDOLN_VOLTAGE */
958#define PALMAS_LDOLN_VOLTAGE_VSEL_MASK 0x3f
959#define PALMAS_LDOLN_VOLTAGE_VSEL_SHIFT 0
960
961/* Bit definitions for LDOUSB_CTRL */
962#define PALMAS_LDOUSB_CTRL_WR_S 0x80
963#define PALMAS_LDOUSB_CTRL_WR_S_SHIFT 7
964#define PALMAS_LDOUSB_CTRL_STATUS 0x10
965#define PALMAS_LDOUSB_CTRL_STATUS_SHIFT 4
966#define PALMAS_LDOUSB_CTRL_MODE_SLEEP 0x04
967#define PALMAS_LDOUSB_CTRL_MODE_SLEEP_SHIFT 2
968#define PALMAS_LDOUSB_CTRL_MODE_ACTIVE 0x01
969#define PALMAS_LDOUSB_CTRL_MODE_ACTIVE_SHIFT 0
970
971/* Bit definitions for LDOUSB_VOLTAGE */
972#define PALMAS_LDOUSB_VOLTAGE_VSEL_MASK 0x3f
973#define PALMAS_LDOUSB_VOLTAGE_VSEL_SHIFT 0
974
975/* Bit definitions for LDO_CTRL */
976#define PALMAS_LDO_CTRL_LDOUSB_ON_VBUS_VSYS 0x01
977#define PALMAS_LDO_CTRL_LDOUSB_ON_VBUS_VSYS_SHIFT 0
978
979/* Bit definitions for LDO_PD_CTRL1 */
980#define PALMAS_LDO_PD_CTRL1_LDO8 0x80
981#define PALMAS_LDO_PD_CTRL1_LDO8_SHIFT 7
982#define PALMAS_LDO_PD_CTRL1_LDO7 0x40
983#define PALMAS_LDO_PD_CTRL1_LDO7_SHIFT 6
984#define PALMAS_LDO_PD_CTRL1_LDO6 0x20
985#define PALMAS_LDO_PD_CTRL1_LDO6_SHIFT 5
986#define PALMAS_LDO_PD_CTRL1_LDO5 0x10
987#define PALMAS_LDO_PD_CTRL1_LDO5_SHIFT 4
988#define PALMAS_LDO_PD_CTRL1_LDO4 0x08
989#define PALMAS_LDO_PD_CTRL1_LDO4_SHIFT 3
990#define PALMAS_LDO_PD_CTRL1_LDO3 0x04
991#define PALMAS_LDO_PD_CTRL1_LDO3_SHIFT 2
992#define PALMAS_LDO_PD_CTRL1_LDO2 0x02
993#define PALMAS_LDO_PD_CTRL1_LDO2_SHIFT 1
994#define PALMAS_LDO_PD_CTRL1_LDO1 0x01
995#define PALMAS_LDO_PD_CTRL1_LDO1_SHIFT 0
996
997/* Bit definitions for LDO_PD_CTRL2 */
998#define PALMAS_LDO_PD_CTRL2_LDOUSB 0x04
999#define PALMAS_LDO_PD_CTRL2_LDOUSB_SHIFT 2
1000#define PALMAS_LDO_PD_CTRL2_LDOLN 0x02
1001#define PALMAS_LDO_PD_CTRL2_LDOLN_SHIFT 1
1002#define PALMAS_LDO_PD_CTRL2_LDO9 0x01
1003#define PALMAS_LDO_PD_CTRL2_LDO9_SHIFT 0
1004
1005/* Bit definitions for LDO_SHORT_STATUS1 */
1006#define PALMAS_LDO_SHORT_STATUS1_LDO8 0x80
1007#define PALMAS_LDO_SHORT_STATUS1_LDO8_SHIFT 7
1008#define PALMAS_LDO_SHORT_STATUS1_LDO7 0x40
1009#define PALMAS_LDO_SHORT_STATUS1_LDO7_SHIFT 6
1010#define PALMAS_LDO_SHORT_STATUS1_LDO6 0x20
1011#define PALMAS_LDO_SHORT_STATUS1_LDO6_SHIFT 5
1012#define PALMAS_LDO_SHORT_STATUS1_LDO5 0x10
1013#define PALMAS_LDO_SHORT_STATUS1_LDO5_SHIFT 4
1014#define PALMAS_LDO_SHORT_STATUS1_LDO4 0x08
1015#define PALMAS_LDO_SHORT_STATUS1_LDO4_SHIFT 3
1016#define PALMAS_LDO_SHORT_STATUS1_LDO3 0x04
1017#define PALMAS_LDO_SHORT_STATUS1_LDO3_SHIFT 2
1018#define PALMAS_LDO_SHORT_STATUS1_LDO2 0x02
1019#define PALMAS_LDO_SHORT_STATUS1_LDO2_SHIFT 1
1020#define PALMAS_LDO_SHORT_STATUS1_LDO1 0x01
1021#define PALMAS_LDO_SHORT_STATUS1_LDO1_SHIFT 0
1022
1023/* Bit definitions for LDO_SHORT_STATUS2 */
1024#define PALMAS_LDO_SHORT_STATUS2_LDOVANA 0x08
1025#define PALMAS_LDO_SHORT_STATUS2_LDOVANA_SHIFT 3
1026#define PALMAS_LDO_SHORT_STATUS2_LDOUSB 0x04
1027#define PALMAS_LDO_SHORT_STATUS2_LDOUSB_SHIFT 2
1028#define PALMAS_LDO_SHORT_STATUS2_LDOLN 0x02
1029#define PALMAS_LDO_SHORT_STATUS2_LDOLN_SHIFT 1
1030#define PALMAS_LDO_SHORT_STATUS2_LDO9 0x01
1031#define PALMAS_LDO_SHORT_STATUS2_LDO9_SHIFT 0
1032
1033/* Registers for function PMU_CONTROL */
1034#define PALMAS_DEV_CTRL 0x0
1035#define PALMAS_POWER_CTRL 0x1
1036#define PALMAS_VSYS_LO 0x2
1037#define PALMAS_VSYS_MON 0x3
1038#define PALMAS_VBAT_MON 0x4
1039#define PALMAS_WATCHDOG 0x5
1040#define PALMAS_BOOT_STATUS 0x6
1041#define PALMAS_BATTERY_BOUNCE 0x7
1042#define PALMAS_BACKUP_BATTERY_CTRL 0x8
1043#define PALMAS_LONG_PRESS_KEY 0x9
1044#define PALMAS_OSC_THERM_CTRL 0xA
1045#define PALMAS_BATDEBOUNCING 0xB
1046#define PALMAS_SWOFF_HWRST 0xF
1047#define PALMAS_SWOFF_COLDRST 0x10
1048#define PALMAS_SWOFF_STATUS 0x11
1049#define PALMAS_PMU_CONFIG 0x12
1050#define PALMAS_SPARE 0x14
1051#define PALMAS_PMU_SECONDARY_INT 0x15
1052#define PALMAS_SW_REVISION 0x17
1053#define PALMAS_EXT_CHRG_CTRL 0x18
1054#define PALMAS_PMU_SECONDARY_INT2 0x19
1055
1056/* Bit definitions for DEV_CTRL */
1057#define PALMAS_DEV_CTRL_DEV_STATUS_MASK 0x0c
1058#define PALMAS_DEV_CTRL_DEV_STATUS_SHIFT 2
1059#define PALMAS_DEV_CTRL_SW_RST 0x02
1060#define PALMAS_DEV_CTRL_SW_RST_SHIFT 1
1061#define PALMAS_DEV_CTRL_DEV_ON 0x01
1062#define PALMAS_DEV_CTRL_DEV_ON_SHIFT 0
1063
1064/* Bit definitions for POWER_CTRL */
1065#define PALMAS_POWER_CTRL_ENABLE2_MASK 0x04
1066#define PALMAS_POWER_CTRL_ENABLE2_MASK_SHIFT 2
1067#define PALMAS_POWER_CTRL_ENABLE1_MASK 0x02
1068#define PALMAS_POWER_CTRL_ENABLE1_MASK_SHIFT 1
1069#define PALMAS_POWER_CTRL_NSLEEP_MASK 0x01
1070#define PALMAS_POWER_CTRL_NSLEEP_MASK_SHIFT 0
1071
1072/* Bit definitions for VSYS_LO */
1073#define PALMAS_VSYS_LO_THRESHOLD_MASK 0x1f
1074#define PALMAS_VSYS_LO_THRESHOLD_SHIFT 0
1075
1076/* Bit definitions for VSYS_MON */
1077#define PALMAS_VSYS_MON_ENABLE 0x80
1078#define PALMAS_VSYS_MON_ENABLE_SHIFT 7
1079#define PALMAS_VSYS_MON_THRESHOLD_MASK 0x3f
1080#define PALMAS_VSYS_MON_THRESHOLD_SHIFT 0
1081
1082/* Bit definitions for VBAT_MON */
1083#define PALMAS_VBAT_MON_ENABLE 0x80
1084#define PALMAS_VBAT_MON_ENABLE_SHIFT 7
1085#define PALMAS_VBAT_MON_THRESHOLD_MASK 0x3f
1086#define PALMAS_VBAT_MON_THRESHOLD_SHIFT 0
1087
1088/* Bit definitions for WATCHDOG */
1089#define PALMAS_WATCHDOG_LOCK 0x20
1090#define PALMAS_WATCHDOG_LOCK_SHIFT 5
1091#define PALMAS_WATCHDOG_ENABLE 0x10
1092#define PALMAS_WATCHDOG_ENABLE_SHIFT 4
1093#define PALMAS_WATCHDOG_MODE 0x08
1094#define PALMAS_WATCHDOG_MODE_SHIFT 3
1095#define PALMAS_WATCHDOG_TIMER_MASK 0x07
1096#define PALMAS_WATCHDOG_TIMER_SHIFT 0
1097
1098/* Bit definitions for BOOT_STATUS */
1099#define PALMAS_BOOT_STATUS_BOOT1 0x02
1100#define PALMAS_BOOT_STATUS_BOOT1_SHIFT 1
1101#define PALMAS_BOOT_STATUS_BOOT0 0x01
1102#define PALMAS_BOOT_STATUS_BOOT0_SHIFT 0
1103
1104/* Bit definitions for BATTERY_BOUNCE */
1105#define PALMAS_BATTERY_BOUNCE_BB_DELAY_MASK 0x3f
1106#define PALMAS_BATTERY_BOUNCE_BB_DELAY_SHIFT 0
1107
1108/* Bit definitions for BACKUP_BATTERY_CTRL */
1109#define PALMAS_BACKUP_BATTERY_CTRL_VRTC_18_15 0x80
1110#define PALMAS_BACKUP_BATTERY_CTRL_VRTC_18_15_SHIFT 7
1111#define PALMAS_BACKUP_BATTERY_CTRL_VRTC_EN_SLP 0x40
1112#define PALMAS_BACKUP_BATTERY_CTRL_VRTC_EN_SLP_SHIFT 6
1113#define PALMAS_BACKUP_BATTERY_CTRL_VRTC_EN_OFF 0x20
1114#define PALMAS_BACKUP_BATTERY_CTRL_VRTC_EN_OFF_SHIFT 5
1115#define PALMAS_BACKUP_BATTERY_CTRL_VRTC_PWEN 0x10
1116#define PALMAS_BACKUP_BATTERY_CTRL_VRTC_PWEN_SHIFT 4
1117#define PALMAS_BACKUP_BATTERY_CTRL_BBS_BBC_LOW_ICHRG 0x08
1118#define PALMAS_BACKUP_BATTERY_CTRL_BBS_BBC_LOW_ICHRG_SHIFT 3
1119#define PALMAS_BACKUP_BATTERY_CTRL_BB_SEL_MASK 0x06
1120#define PALMAS_BACKUP_BATTERY_CTRL_BB_SEL_SHIFT 1
1121#define PALMAS_BACKUP_BATTERY_CTRL_BB_CHG_EN 0x01
1122#define PALMAS_BACKUP_BATTERY_CTRL_BB_CHG_EN_SHIFT 0
1123
1124/* Bit definitions for LONG_PRESS_KEY */
1125#define PALMAS_LONG_PRESS_KEY_LPK_LOCK 0x80
1126#define PALMAS_LONG_PRESS_KEY_LPK_LOCK_SHIFT 7
1127#define PALMAS_LONG_PRESS_KEY_LPK_INT_CLR 0x10
1128#define PALMAS_LONG_PRESS_KEY_LPK_INT_CLR_SHIFT 4
1129#define PALMAS_LONG_PRESS_KEY_LPK_TIME_MASK 0x0c
1130#define PALMAS_LONG_PRESS_KEY_LPK_TIME_SHIFT 2
1131#define PALMAS_LONG_PRESS_KEY_PWRON_DEBOUNCE_MASK 0x03
1132#define PALMAS_LONG_PRESS_KEY_PWRON_DEBOUNCE_SHIFT 0
1133
1134/* Bit definitions for OSC_THERM_CTRL */
1135#define PALMAS_OSC_THERM_CTRL_VANA_ON_IN_SLEEP 0x80
1136#define PALMAS_OSC_THERM_CTRL_VANA_ON_IN_SLEEP_SHIFT 7
1137#define PALMAS_OSC_THERM_CTRL_INT_MASK_IN_SLEEP 0x40
1138#define PALMAS_OSC_THERM_CTRL_INT_MASK_IN_SLEEP_SHIFT 6
1139#define PALMAS_OSC_THERM_CTRL_RC15MHZ_ON_IN_SLEEP 0x20
1140#define PALMAS_OSC_THERM_CTRL_RC15MHZ_ON_IN_SLEEP_SHIFT 5
1141#define PALMAS_OSC_THERM_CTRL_THERM_OFF_IN_SLEEP 0x10
1142#define PALMAS_OSC_THERM_CTRL_THERM_OFF_IN_SLEEP_SHIFT 4
1143#define PALMAS_OSC_THERM_CTRL_THERM_HD_SEL_MASK 0x0c
1144#define PALMAS_OSC_THERM_CTRL_THERM_HD_SEL_SHIFT 2
1145#define PALMAS_OSC_THERM_CTRL_OSC_BYPASS 0x02
1146#define PALMAS_OSC_THERM_CTRL_OSC_BYPASS_SHIFT 1
1147#define PALMAS_OSC_THERM_CTRL_OSC_HPMODE 0x01
1148#define PALMAS_OSC_THERM_CTRL_OSC_HPMODE_SHIFT 0
1149
1150/* Bit definitions for BATDEBOUNCING */
1151#define PALMAS_BATDEBOUNCING_BAT_DEB_BYPASS 0x80
1152#define PALMAS_BATDEBOUNCING_BAT_DEB_BYPASS_SHIFT 7
1153#define PALMAS_BATDEBOUNCING_BINS_DEB_MASK 0x78
1154#define PALMAS_BATDEBOUNCING_BINS_DEB_SHIFT 3
1155#define PALMAS_BATDEBOUNCING_BEXT_DEB_MASK 0x07
1156#define PALMAS_BATDEBOUNCING_BEXT_DEB_SHIFT 0
1157
1158/* Bit definitions for SWOFF_HWRST */
1159#define PALMAS_SWOFF_HWRST_PWRON_LPK 0x80
1160#define PALMAS_SWOFF_HWRST_PWRON_LPK_SHIFT 7
1161#define PALMAS_SWOFF_HWRST_PWRDOWN 0x40
1162#define PALMAS_SWOFF_HWRST_PWRDOWN_SHIFT 6
1163#define PALMAS_SWOFF_HWRST_WTD 0x20
1164#define PALMAS_SWOFF_HWRST_WTD_SHIFT 5
1165#define PALMAS_SWOFF_HWRST_TSHUT 0x10
1166#define PALMAS_SWOFF_HWRST_TSHUT_SHIFT 4
1167#define PALMAS_SWOFF_HWRST_RESET_IN 0x08
1168#define PALMAS_SWOFF_HWRST_RESET_IN_SHIFT 3
1169#define PALMAS_SWOFF_HWRST_SW_RST 0x04
1170#define PALMAS_SWOFF_HWRST_SW_RST_SHIFT 2
1171#define PALMAS_SWOFF_HWRST_VSYS_LO 0x02
1172#define PALMAS_SWOFF_HWRST_VSYS_LO_SHIFT 1
1173#define PALMAS_SWOFF_HWRST_GPADC_SHUTDOWN 0x01
1174#define PALMAS_SWOFF_HWRST_GPADC_SHUTDOWN_SHIFT 0
1175
1176/* Bit definitions for SWOFF_COLDRST */
1177#define PALMAS_SWOFF_COLDRST_PWRON_LPK 0x80
1178#define PALMAS_SWOFF_COLDRST_PWRON_LPK_SHIFT 7
1179#define PALMAS_SWOFF_COLDRST_PWRDOWN 0x40
1180#define PALMAS_SWOFF_COLDRST_PWRDOWN_SHIFT 6
1181#define PALMAS_SWOFF_COLDRST_WTD 0x20
1182#define PALMAS_SWOFF_COLDRST_WTD_SHIFT 5
1183#define PALMAS_SWOFF_COLDRST_TSHUT 0x10
1184#define PALMAS_SWOFF_COLDRST_TSHUT_SHIFT 4
1185#define PALMAS_SWOFF_COLDRST_RESET_IN 0x08
1186#define PALMAS_SWOFF_COLDRST_RESET_IN_SHIFT 3
1187#define PALMAS_SWOFF_COLDRST_SW_RST 0x04
1188#define PALMAS_SWOFF_COLDRST_SW_RST_SHIFT 2
1189#define PALMAS_SWOFF_COLDRST_VSYS_LO 0x02
1190#define PALMAS_SWOFF_COLDRST_VSYS_LO_SHIFT 1
1191#define PALMAS_SWOFF_COLDRST_GPADC_SHUTDOWN 0x01
1192#define PALMAS_SWOFF_COLDRST_GPADC_SHUTDOWN_SHIFT 0
1193
1194/* Bit definitions for SWOFF_STATUS */
1195#define PALMAS_SWOFF_STATUS_PWRON_LPK 0x80
1196#define PALMAS_SWOFF_STATUS_PWRON_LPK_SHIFT 7
1197#define PALMAS_SWOFF_STATUS_PWRDOWN 0x40
1198#define PALMAS_SWOFF_STATUS_PWRDOWN_SHIFT 6
1199#define PALMAS_SWOFF_STATUS_WTD 0x20
1200#define PALMAS_SWOFF_STATUS_WTD_SHIFT 5
1201#define PALMAS_SWOFF_STATUS_TSHUT 0x10
1202#define PALMAS_SWOFF_STATUS_TSHUT_SHIFT 4
1203#define PALMAS_SWOFF_STATUS_RESET_IN 0x08
1204#define PALMAS_SWOFF_STATUS_RESET_IN_SHIFT 3
1205#define PALMAS_SWOFF_STATUS_SW_RST 0x04
1206#define PALMAS_SWOFF_STATUS_SW_RST_SHIFT 2
1207#define PALMAS_SWOFF_STATUS_VSYS_LO 0x02
1208#define PALMAS_SWOFF_STATUS_VSYS_LO_SHIFT 1
1209#define PALMAS_SWOFF_STATUS_GPADC_SHUTDOWN 0x01
1210#define PALMAS_SWOFF_STATUS_GPADC_SHUTDOWN_SHIFT 0
1211
1212/* Bit definitions for PMU_CONFIG */
1213#define PALMAS_PMU_CONFIG_MULTI_CELL_EN 0x40
1214#define PALMAS_PMU_CONFIG_MULTI_CELL_EN_SHIFT 6
1215#define PALMAS_PMU_CONFIG_SPARE_MASK 0x30
1216#define PALMAS_PMU_CONFIG_SPARE_SHIFT 4
1217#define PALMAS_PMU_CONFIG_SWOFF_DLY_MASK 0x0c
1218#define PALMAS_PMU_CONFIG_SWOFF_DLY_SHIFT 2
1219#define PALMAS_PMU_CONFIG_GATE_RESET_OUT 0x02
1220#define PALMAS_PMU_CONFIG_GATE_RESET_OUT_SHIFT 1
1221#define PALMAS_PMU_CONFIG_AUTODEVON 0x01
1222#define PALMAS_PMU_CONFIG_AUTODEVON_SHIFT 0
1223
1224/* Bit definitions for SPARE */
1225#define PALMAS_SPARE_SPARE_MASK 0xf8
1226#define PALMAS_SPARE_SPARE_SHIFT 3
1227#define PALMAS_SPARE_REGEN3_OD 0x04
1228#define PALMAS_SPARE_REGEN3_OD_SHIFT 2
1229#define PALMAS_SPARE_REGEN2_OD 0x02
1230#define PALMAS_SPARE_REGEN2_OD_SHIFT 1
1231#define PALMAS_SPARE_REGEN1_OD 0x01
1232#define PALMAS_SPARE_REGEN1_OD_SHIFT 0
1233
1234/* Bit definitions for PMU_SECONDARY_INT */
1235#define PALMAS_PMU_SECONDARY_INT_VBUS_OVV_INT_SRC 0x80
1236#define PALMAS_PMU_SECONDARY_INT_VBUS_OVV_INT_SRC_SHIFT 7
1237#define PALMAS_PMU_SECONDARY_INT_CHARG_DET_N_INT_SRC 0x40
1238#define PALMAS_PMU_SECONDARY_INT_CHARG_DET_N_INT_SRC_SHIFT 6
1239#define PALMAS_PMU_SECONDARY_INT_BB_INT_SRC 0x20
1240#define PALMAS_PMU_SECONDARY_INT_BB_INT_SRC_SHIFT 5
1241#define PALMAS_PMU_SECONDARY_INT_FBI_INT_SRC 0x10
1242#define PALMAS_PMU_SECONDARY_INT_FBI_INT_SRC_SHIFT 4
1243#define PALMAS_PMU_SECONDARY_INT_VBUS_OVV_MASK 0x08
1244#define PALMAS_PMU_SECONDARY_INT_VBUS_OVV_MASK_SHIFT 3
1245#define PALMAS_PMU_SECONDARY_INT_CHARG_DET_N_MASK 0x04
1246#define PALMAS_PMU_SECONDARY_INT_CHARG_DET_N_MASK_SHIFT 2
1247#define PALMAS_PMU_SECONDARY_INT_BB_MASK 0x02
1248#define PALMAS_PMU_SECONDARY_INT_BB_MASK_SHIFT 1
1249#define PALMAS_PMU_SECONDARY_INT_FBI_MASK 0x01
1250#define PALMAS_PMU_SECONDARY_INT_FBI_MASK_SHIFT 0
1251
1252/* Bit definitions for SW_REVISION */
1253#define PALMAS_SW_REVISION_SW_REVISION_MASK 0xff
1254#define PALMAS_SW_REVISION_SW_REVISION_SHIFT 0
1255
1256/* Bit definitions for EXT_CHRG_CTRL */
1257#define PALMAS_EXT_CHRG_CTRL_VBUS_OVV_STATUS 0x80
1258#define PALMAS_EXT_CHRG_CTRL_VBUS_OVV_STATUS_SHIFT 7
1259#define PALMAS_EXT_CHRG_CTRL_CHARG_DET_N_STATUS 0x40
1260#define PALMAS_EXT_CHRG_CTRL_CHARG_DET_N_STATUS_SHIFT 6
1261#define PALMAS_EXT_CHRG_CTRL_VSYS_DEBOUNCE_DELAY 0x08
1262#define PALMAS_EXT_CHRG_CTRL_VSYS_DEBOUNCE_DELAY_SHIFT 3
1263#define PALMAS_EXT_CHRG_CTRL_CHRG_DET_N 0x04
1264#define PALMAS_EXT_CHRG_CTRL_CHRG_DET_N_SHIFT 2
1265#define PALMAS_EXT_CHRG_CTRL_AUTO_ACA_EN 0x02
1266#define PALMAS_EXT_CHRG_CTRL_AUTO_ACA_EN_SHIFT 1
1267#define PALMAS_EXT_CHRG_CTRL_AUTO_LDOUSB_EN 0x01
1268#define PALMAS_EXT_CHRG_CTRL_AUTO_LDOUSB_EN_SHIFT 0
1269
1270/* Bit definitions for PMU_SECONDARY_INT2 */
1271#define PALMAS_PMU_SECONDARY_INT2_DVFS2_INT_SRC 0x20
1272#define PALMAS_PMU_SECONDARY_INT2_DVFS2_INT_SRC_SHIFT 5
1273#define PALMAS_PMU_SECONDARY_INT2_DVFS1_INT_SRC 0x10
1274#define PALMAS_PMU_SECONDARY_INT2_DVFS1_INT_SRC_SHIFT 4
1275#define PALMAS_PMU_SECONDARY_INT2_DVFS2_MASK 0x02
1276#define PALMAS_PMU_SECONDARY_INT2_DVFS2_MASK_SHIFT 1
1277#define PALMAS_PMU_SECONDARY_INT2_DVFS1_MASK 0x01
1278#define PALMAS_PMU_SECONDARY_INT2_DVFS1_MASK_SHIFT 0
1279
1280/* Registers for function RESOURCE */
1281#define PALMAS_CLK32KG_CTRL 0x0
1282#define PALMAS_CLK32KGAUDIO_CTRL 0x1
1283#define PALMAS_REGEN1_CTRL 0x2
1284#define PALMAS_REGEN2_CTRL 0x3
1285#define PALMAS_SYSEN1_CTRL 0x4
1286#define PALMAS_SYSEN2_CTRL 0x5
1287#define PALMAS_NSLEEP_RES_ASSIGN 0x6
1288#define PALMAS_NSLEEP_SMPS_ASSIGN 0x7
1289#define PALMAS_NSLEEP_LDO_ASSIGN1 0x8
1290#define PALMAS_NSLEEP_LDO_ASSIGN2 0x9
1291#define PALMAS_ENABLE1_RES_ASSIGN 0xA
1292#define PALMAS_ENABLE1_SMPS_ASSIGN 0xB
1293#define PALMAS_ENABLE1_LDO_ASSIGN1 0xC
1294#define PALMAS_ENABLE1_LDO_ASSIGN2 0xD
1295#define PALMAS_ENABLE2_RES_ASSIGN 0xE
1296#define PALMAS_ENABLE2_SMPS_ASSIGN 0xF
1297#define PALMAS_ENABLE2_LDO_ASSIGN1 0x10
1298#define PALMAS_ENABLE2_LDO_ASSIGN2 0x11
1299#define PALMAS_REGEN3_CTRL 0x12
1300
1301/* Bit definitions for CLK32KG_CTRL */
1302#define PALMAS_CLK32KG_CTRL_STATUS 0x10
1303#define PALMAS_CLK32KG_CTRL_STATUS_SHIFT 4
1304#define PALMAS_CLK32KG_CTRL_MODE_SLEEP 0x04
1305#define PALMAS_CLK32KG_CTRL_MODE_SLEEP_SHIFT 2
1306#define PALMAS_CLK32KG_CTRL_MODE_ACTIVE 0x01
1307#define PALMAS_CLK32KG_CTRL_MODE_ACTIVE_SHIFT 0
1308
1309/* Bit definitions for CLK32KGAUDIO_CTRL */
1310#define PALMAS_CLK32KGAUDIO_CTRL_STATUS 0x10
1311#define PALMAS_CLK32KGAUDIO_CTRL_STATUS_SHIFT 4
1312#define PALMAS_CLK32KGAUDIO_CTRL_RESERVED3 0x08
1313#define PALMAS_CLK32KGAUDIO_CTRL_RESERVED3_SHIFT 3
1314#define PALMAS_CLK32KGAUDIO_CTRL_MODE_SLEEP 0x04
1315#define PALMAS_CLK32KGAUDIO_CTRL_MODE_SLEEP_SHIFT 2
1316#define PALMAS_CLK32KGAUDIO_CTRL_MODE_ACTIVE 0x01
1317#define PALMAS_CLK32KGAUDIO_CTRL_MODE_ACTIVE_SHIFT 0
1318
1319/* Bit definitions for REGEN1_CTRL */
1320#define PALMAS_REGEN1_CTRL_STATUS 0x10
1321#define PALMAS_REGEN1_CTRL_STATUS_SHIFT 4
1322#define PALMAS_REGEN1_CTRL_MODE_SLEEP 0x04
1323#define PALMAS_REGEN1_CTRL_MODE_SLEEP_SHIFT 2
1324#define PALMAS_REGEN1_CTRL_MODE_ACTIVE 0x01
1325#define PALMAS_REGEN1_CTRL_MODE_ACTIVE_SHIFT 0
1326
1327/* Bit definitions for REGEN2_CTRL */
1328#define PALMAS_REGEN2_CTRL_STATUS 0x10
1329#define PALMAS_REGEN2_CTRL_STATUS_SHIFT 4
1330#define PALMAS_REGEN2_CTRL_MODE_SLEEP 0x04
1331#define PALMAS_REGEN2_CTRL_MODE_SLEEP_SHIFT 2
1332#define PALMAS_REGEN2_CTRL_MODE_ACTIVE 0x01
1333#define PALMAS_REGEN2_CTRL_MODE_ACTIVE_SHIFT 0
1334
1335/* Bit definitions for SYSEN1_CTRL */
1336#define PALMAS_SYSEN1_CTRL_STATUS 0x10
1337#define PALMAS_SYSEN1_CTRL_STATUS_SHIFT 4
1338#define PALMAS_SYSEN1_CTRL_MODE_SLEEP 0x04
1339#define PALMAS_SYSEN1_CTRL_MODE_SLEEP_SHIFT 2
1340#define PALMAS_SYSEN1_CTRL_MODE_ACTIVE 0x01
1341#define PALMAS_SYSEN1_CTRL_MODE_ACTIVE_SHIFT 0
1342
1343/* Bit definitions for SYSEN2_CTRL */
1344#define PALMAS_SYSEN2_CTRL_STATUS 0x10
1345#define PALMAS_SYSEN2_CTRL_STATUS_SHIFT 4
1346#define PALMAS_SYSEN2_CTRL_MODE_SLEEP 0x04
1347#define PALMAS_SYSEN2_CTRL_MODE_SLEEP_SHIFT 2
1348#define PALMAS_SYSEN2_CTRL_MODE_ACTIVE 0x01
1349#define PALMAS_SYSEN2_CTRL_MODE_ACTIVE_SHIFT 0
1350
1351/* Bit definitions for NSLEEP_RES_ASSIGN */
1352#define PALMAS_NSLEEP_RES_ASSIGN_REGEN3 0x40
1353#define PALMAS_NSLEEP_RES_ASSIGN_REGEN3_SHIFT 6
1354#define PALMAS_NSLEEP_RES_ASSIGN_CLK32KGAUDIO 0x20
1355#define PALMAS_NSLEEP_RES_ASSIGN_CLK32KGAUDIO_SHIFT 5
1356#define PALMAS_NSLEEP_RES_ASSIGN_CLK32KG 0x10
1357#define PALMAS_NSLEEP_RES_ASSIGN_CLK32KG_SHIFT 4
1358#define PALMAS_NSLEEP_RES_ASSIGN_SYSEN2 0x08
1359#define PALMAS_NSLEEP_RES_ASSIGN_SYSEN2_SHIFT 3
1360#define PALMAS_NSLEEP_RES_ASSIGN_SYSEN1 0x04
1361#define PALMAS_NSLEEP_RES_ASSIGN_SYSEN1_SHIFT 2
1362#define PALMAS_NSLEEP_RES_ASSIGN_REGEN2 0x02
1363#define PALMAS_NSLEEP_RES_ASSIGN_REGEN2_SHIFT 1
1364#define PALMAS_NSLEEP_RES_ASSIGN_REGEN1 0x01
1365#define PALMAS_NSLEEP_RES_ASSIGN_REGEN1_SHIFT 0
1366
1367/* Bit definitions for NSLEEP_SMPS_ASSIGN */
1368#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS10 0x80
1369#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS10_SHIFT 7
1370#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS9 0x40
1371#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS9_SHIFT 6
1372#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS8 0x20
1373#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS8_SHIFT 5
1374#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS7 0x10
1375#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS7_SHIFT 4
1376#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS6 0x08
1377#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS6_SHIFT 3
1378#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS45 0x04
1379#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS45_SHIFT 2
1380#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS3 0x02
1381#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS3_SHIFT 1
1382#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS12 0x01
1383#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS12_SHIFT 0
1384
1385/* Bit definitions for NSLEEP_LDO_ASSIGN1 */
1386#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO8 0x80
1387#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO8_SHIFT 7
1388#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO7 0x40
1389#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO7_SHIFT 6
1390#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO6 0x20
1391#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO6_SHIFT 5
1392#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO5 0x10
1393#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO5_SHIFT 4
1394#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO4 0x08
1395#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO4_SHIFT 3
1396#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO3 0x04
1397#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO3_SHIFT 2
1398#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO2 0x02
1399#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO2_SHIFT 1
1400#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO1 0x01
1401#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO1_SHIFT 0
1402
1403/* Bit definitions for NSLEEP_LDO_ASSIGN2 */
1404#define PALMAS_NSLEEP_LDO_ASSIGN2_LDOUSB 0x04
1405#define PALMAS_NSLEEP_LDO_ASSIGN2_LDOUSB_SHIFT 2
1406#define PALMAS_NSLEEP_LDO_ASSIGN2_LDOLN 0x02
1407#define PALMAS_NSLEEP_LDO_ASSIGN2_LDOLN_SHIFT 1
1408#define PALMAS_NSLEEP_LDO_ASSIGN2_LDO9 0x01
1409#define PALMAS_NSLEEP_LDO_ASSIGN2_LDO9_SHIFT 0
1410
1411/* Bit definitions for ENABLE1_RES_ASSIGN */
1412#define PALMAS_ENABLE1_RES_ASSIGN_REGEN3 0x40
1413#define PALMAS_ENABLE1_RES_ASSIGN_REGEN3_SHIFT 6
1414#define PALMAS_ENABLE1_RES_ASSIGN_CLK32KGAUDIO 0x20
1415#define PALMAS_ENABLE1_RES_ASSIGN_CLK32KGAUDIO_SHIFT 5
1416#define PALMAS_ENABLE1_RES_ASSIGN_CLK32KG 0x10
1417#define PALMAS_ENABLE1_RES_ASSIGN_CLK32KG_SHIFT 4
1418#define PALMAS_ENABLE1_RES_ASSIGN_SYSEN2 0x08
1419#define PALMAS_ENABLE1_RES_ASSIGN_SYSEN2_SHIFT 3
1420#define PALMAS_ENABLE1_RES_ASSIGN_SYSEN1 0x04
1421#define PALMAS_ENABLE1_RES_ASSIGN_SYSEN1_SHIFT 2
1422#define PALMAS_ENABLE1_RES_ASSIGN_REGEN2 0x02
1423#define PALMAS_ENABLE1_RES_ASSIGN_REGEN2_SHIFT 1
1424#define PALMAS_ENABLE1_RES_ASSIGN_REGEN1 0x01
1425#define PALMAS_ENABLE1_RES_ASSIGN_REGEN1_SHIFT 0
1426
1427/* Bit definitions for ENABLE1_SMPS_ASSIGN */
1428#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS10 0x80
1429#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS10_SHIFT 7
1430#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS9 0x40
1431#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS9_SHIFT 6
1432#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS8 0x20
1433#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS8_SHIFT 5
1434#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS7 0x10
1435#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS7_SHIFT 4
1436#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS6 0x08
1437#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS6_SHIFT 3
1438#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS45 0x04
1439#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS45_SHIFT 2
1440#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS3 0x02
1441#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS3_SHIFT 1
1442#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS12 0x01
1443#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS12_SHIFT 0
1444
1445/* Bit definitions for ENABLE1_LDO_ASSIGN1 */
1446#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO8 0x80
1447#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO8_SHIFT 7
1448#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO7 0x40
1449#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO7_SHIFT 6
1450#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO6 0x20
1451#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO6_SHIFT 5
1452#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO5 0x10
1453#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO5_SHIFT 4
1454#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO4 0x08
1455#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO4_SHIFT 3
1456#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO3 0x04
1457#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO3_SHIFT 2
1458#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO2 0x02
1459#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO2_SHIFT 1
1460#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO1 0x01
1461#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO1_SHIFT 0
1462
1463/* Bit definitions for ENABLE1_LDO_ASSIGN2 */
1464#define PALMAS_ENABLE1_LDO_ASSIGN2_LDOUSB 0x04
1465#define PALMAS_ENABLE1_LDO_ASSIGN2_LDOUSB_SHIFT 2
1466#define PALMAS_ENABLE1_LDO_ASSIGN2_LDOLN 0x02
1467#define PALMAS_ENABLE1_LDO_ASSIGN2_LDOLN_SHIFT 1
1468#define PALMAS_ENABLE1_LDO_ASSIGN2_LDO9 0x01
1469#define PALMAS_ENABLE1_LDO_ASSIGN2_LDO9_SHIFT 0
1470
1471/* Bit definitions for ENABLE2_RES_ASSIGN */
1472#define PALMAS_ENABLE2_RES_ASSIGN_REGEN3 0x40
1473#define PALMAS_ENABLE2_RES_ASSIGN_REGEN3_SHIFT 6
1474#define PALMAS_ENABLE2_RES_ASSIGN_CLK32KGAUDIO 0x20
1475#define PALMAS_ENABLE2_RES_ASSIGN_CLK32KGAUDIO_SHIFT 5
1476#define PALMAS_ENABLE2_RES_ASSIGN_CLK32KG 0x10
1477#define PALMAS_ENABLE2_RES_ASSIGN_CLK32KG_SHIFT 4
1478#define PALMAS_ENABLE2_RES_ASSIGN_SYSEN2 0x08
1479#define PALMAS_ENABLE2_RES_ASSIGN_SYSEN2_SHIFT 3
1480#define PALMAS_ENABLE2_RES_ASSIGN_SYSEN1 0x04
1481#define PALMAS_ENABLE2_RES_ASSIGN_SYSEN1_SHIFT 2
1482#define PALMAS_ENABLE2_RES_ASSIGN_REGEN2 0x02
1483#define PALMAS_ENABLE2_RES_ASSIGN_REGEN2_SHIFT 1
1484#define PALMAS_ENABLE2_RES_ASSIGN_REGEN1 0x01
1485#define PALMAS_ENABLE2_RES_ASSIGN_REGEN1_SHIFT 0
1486
1487/* Bit definitions for ENABLE2_SMPS_ASSIGN */
1488#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS10 0x80
1489#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS10_SHIFT 7
1490#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS9 0x40
1491#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS9_SHIFT 6
1492#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS8 0x20
1493#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS8_SHIFT 5
1494#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS7 0x10
1495#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS7_SHIFT 4
1496#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS6 0x08
1497#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS6_SHIFT 3
1498#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS45 0x04
1499#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS45_SHIFT 2
1500#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS3 0x02
1501#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS3_SHIFT 1
1502#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS12 0x01
1503#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS12_SHIFT 0
1504
1505/* Bit definitions for ENABLE2_LDO_ASSIGN1 */
1506#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO8 0x80
1507#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO8_SHIFT 7
1508#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO7 0x40
1509#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO7_SHIFT 6
1510#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO6 0x20
1511#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO6_SHIFT 5
1512#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO5 0x10
1513#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO5_SHIFT 4
1514#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO4 0x08
1515#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO4_SHIFT 3
1516#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO3 0x04
1517#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO3_SHIFT 2
1518#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO2 0x02
1519#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO2_SHIFT 1
1520#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO1 0x01
1521#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO1_SHIFT 0
1522
1523/* Bit definitions for ENABLE2_LDO_ASSIGN2 */
1524#define PALMAS_ENABLE2_LDO_ASSIGN2_LDOUSB 0x04
1525#define PALMAS_ENABLE2_LDO_ASSIGN2_LDOUSB_SHIFT 2
1526#define PALMAS_ENABLE2_LDO_ASSIGN2_LDOLN 0x02
1527#define PALMAS_ENABLE2_LDO_ASSIGN2_LDOLN_SHIFT 1
1528#define PALMAS_ENABLE2_LDO_ASSIGN2_LDO9 0x01
1529#define PALMAS_ENABLE2_LDO_ASSIGN2_LDO9_SHIFT 0
1530
1531/* Bit definitions for REGEN3_CTRL */
1532#define PALMAS_REGEN3_CTRL_STATUS 0x10
1533#define PALMAS_REGEN3_CTRL_STATUS_SHIFT 4
1534#define PALMAS_REGEN3_CTRL_MODE_SLEEP 0x04
1535#define PALMAS_REGEN3_CTRL_MODE_SLEEP_SHIFT 2
1536#define PALMAS_REGEN3_CTRL_MODE_ACTIVE 0x01
1537#define PALMAS_REGEN3_CTRL_MODE_ACTIVE_SHIFT 0
1538
1539/* Registers for function PAD_CONTROL */
1540#define PALMAS_PU_PD_INPUT_CTRL1 0x0
1541#define PALMAS_PU_PD_INPUT_CTRL2 0x1
1542#define PALMAS_PU_PD_INPUT_CTRL3 0x2
1543#define PALMAS_OD_OUTPUT_CTRL 0x4
1544#define PALMAS_POLARITY_CTRL 0x5
1545#define PALMAS_PRIMARY_SECONDARY_PAD1 0x6
1546#define PALMAS_PRIMARY_SECONDARY_PAD2 0x7
1547#define PALMAS_I2C_SPI 0x8
1548#define PALMAS_PU_PD_INPUT_CTRL4 0x9
1549#define PALMAS_PRIMARY_SECONDARY_PAD3 0xA
1550
1551/* Bit definitions for PU_PD_INPUT_CTRL1 */
1552#define PALMAS_PU_PD_INPUT_CTRL1_RESET_IN_PD 0x40
1553#define PALMAS_PU_PD_INPUT_CTRL1_RESET_IN_PD_SHIFT 6
1554#define PALMAS_PU_PD_INPUT_CTRL1_GPADC_START_PU 0x20
1555#define PALMAS_PU_PD_INPUT_CTRL1_GPADC_START_PU_SHIFT 5
1556#define PALMAS_PU_PD_INPUT_CTRL1_GPADC_START_PD 0x10
1557#define PALMAS_PU_PD_INPUT_CTRL1_GPADC_START_PD_SHIFT 4
1558#define PALMAS_PU_PD_INPUT_CTRL1_PWRDOWN_PD 0x04
1559#define PALMAS_PU_PD_INPUT_CTRL1_PWRDOWN_PD_SHIFT 2
1560#define PALMAS_PU_PD_INPUT_CTRL1_NRESWARM_PU 0x02
1561#define PALMAS_PU_PD_INPUT_CTRL1_NRESWARM_PU_SHIFT 1
1562
1563/* Bit definitions for PU_PD_INPUT_CTRL2 */
1564#define PALMAS_PU_PD_INPUT_CTRL2_ENABLE2_PU 0x20
1565#define PALMAS_PU_PD_INPUT_CTRL2_ENABLE2_PU_SHIFT 5
1566#define PALMAS_PU_PD_INPUT_CTRL2_ENABLE2_PD 0x10
1567#define PALMAS_PU_PD_INPUT_CTRL2_ENABLE2_PD_SHIFT 4
1568#define PALMAS_PU_PD_INPUT_CTRL2_ENABLE1_PU 0x08
1569#define PALMAS_PU_PD_INPUT_CTRL2_ENABLE1_PU_SHIFT 3
1570#define PALMAS_PU_PD_INPUT_CTRL2_ENABLE1_PD 0x04
1571#define PALMAS_PU_PD_INPUT_CTRL2_ENABLE1_PD_SHIFT 2
1572#define PALMAS_PU_PD_INPUT_CTRL2_NSLEEP_PU 0x02
1573#define PALMAS_PU_PD_INPUT_CTRL2_NSLEEP_PU_SHIFT 1
1574#define PALMAS_PU_PD_INPUT_CTRL2_NSLEEP_PD 0x01
1575#define PALMAS_PU_PD_INPUT_CTRL2_NSLEEP_PD_SHIFT 0
1576
1577/* Bit definitions for PU_PD_INPUT_CTRL3 */
1578#define PALMAS_PU_PD_INPUT_CTRL3_ACOK_PD 0x40
1579#define PALMAS_PU_PD_INPUT_CTRL3_ACOK_PD_SHIFT 6
1580#define PALMAS_PU_PD_INPUT_CTRL3_CHRG_DET_N_PD 0x10
1581#define PALMAS_PU_PD_INPUT_CTRL3_CHRG_DET_N_PD_SHIFT 4
1582#define PALMAS_PU_PD_INPUT_CTRL3_POWERHOLD_PD 0x04
1583#define PALMAS_PU_PD_INPUT_CTRL3_POWERHOLD_PD_SHIFT 2
1584#define PALMAS_PU_PD_INPUT_CTRL3_MSECURE_PD 0x01
1585#define PALMAS_PU_PD_INPUT_CTRL3_MSECURE_PD_SHIFT 0
1586
1587/* Bit definitions for OD_OUTPUT_CTRL */
1588#define PALMAS_OD_OUTPUT_CTRL_PWM_2_OD 0x80
1589#define PALMAS_OD_OUTPUT_CTRL_PWM_2_OD_SHIFT 7
1590#define PALMAS_OD_OUTPUT_CTRL_VBUSDET_OD 0x40
1591#define PALMAS_OD_OUTPUT_CTRL_VBUSDET_OD_SHIFT 6
1592#define PALMAS_OD_OUTPUT_CTRL_PWM_1_OD 0x20
1593#define PALMAS_OD_OUTPUT_CTRL_PWM_1_OD_SHIFT 5
1594#define PALMAS_OD_OUTPUT_CTRL_INT_OD 0x08
1595#define PALMAS_OD_OUTPUT_CTRL_INT_OD_SHIFT 3
1596
1597/* Bit definitions for POLARITY_CTRL */
1598#define PALMAS_POLARITY_CTRL_INT_POLARITY 0x80
1599#define PALMAS_POLARITY_CTRL_INT_POLARITY_SHIFT 7
1600#define PALMAS_POLARITY_CTRL_ENABLE2_POLARITY 0x40
1601#define PALMAS_POLARITY_CTRL_ENABLE2_POLARITY_SHIFT 6
1602#define PALMAS_POLARITY_CTRL_ENABLE1_POLARITY 0x20
1603#define PALMAS_POLARITY_CTRL_ENABLE1_POLARITY_SHIFT 5
1604#define PALMAS_POLARITY_CTRL_NSLEEP_POLARITY 0x10
1605#define PALMAS_POLARITY_CTRL_NSLEEP_POLARITY_SHIFT 4
1606#define PALMAS_POLARITY_CTRL_RESET_IN_POLARITY 0x08
1607#define PALMAS_POLARITY_CTRL_RESET_IN_POLARITY_SHIFT 3
1608#define PALMAS_POLARITY_CTRL_GPIO_3_CHRG_DET_N_POLARITY 0x04
1609#define PALMAS_POLARITY_CTRL_GPIO_3_CHRG_DET_N_POLARITY_SHIFT 2
1610#define PALMAS_POLARITY_CTRL_POWERGOOD_USB_PSEL_POLARITY 0x02
1611#define PALMAS_POLARITY_CTRL_POWERGOOD_USB_PSEL_POLARITY_SHIFT 1
1612#define PALMAS_POLARITY_CTRL_PWRDOWN_POLARITY 0x01
1613#define PALMAS_POLARITY_CTRL_PWRDOWN_POLARITY_SHIFT 0
1614
1615/* Bit definitions for PRIMARY_SECONDARY_PAD1 */
1616#define PALMAS_PRIMARY_SECONDARY_PAD1_GPIO_3 0x80
1617#define PALMAS_PRIMARY_SECONDARY_PAD1_GPIO_3_SHIFT 7
1618#define PALMAS_PRIMARY_SECONDARY_PAD1_GPIO_2_MASK 0x60
1619#define PALMAS_PRIMARY_SECONDARY_PAD1_GPIO_2_SHIFT 5
1620#define PALMAS_PRIMARY_SECONDARY_PAD1_GPIO_1_MASK 0x18
1621#define PALMAS_PRIMARY_SECONDARY_PAD1_GPIO_1_SHIFT 3
1622#define PALMAS_PRIMARY_SECONDARY_PAD1_GPIO_0 0x04
1623#define PALMAS_PRIMARY_SECONDARY_PAD1_GPIO_0_SHIFT 2
1624#define PALMAS_PRIMARY_SECONDARY_PAD1_VAC 0x02
1625#define PALMAS_PRIMARY_SECONDARY_PAD1_VAC_SHIFT 1
1626#define PALMAS_PRIMARY_SECONDARY_PAD1_POWERGOOD 0x01
1627#define PALMAS_PRIMARY_SECONDARY_PAD1_POWERGOOD_SHIFT 0
1628
1629/* Bit definitions for PRIMARY_SECONDARY_PAD2 */
1630#define PALMAS_PRIMARY_SECONDARY_PAD2_GPIO_7_MASK 0x30
1631#define PALMAS_PRIMARY_SECONDARY_PAD2_GPIO_7_SHIFT 4
1632#define PALMAS_PRIMARY_SECONDARY_PAD2_GPIO_6 0x08
1633#define PALMAS_PRIMARY_SECONDARY_PAD2_GPIO_6_SHIFT 3
1634#define PALMAS_PRIMARY_SECONDARY_PAD2_GPIO_5_MASK 0x06
1635#define PALMAS_PRIMARY_SECONDARY_PAD2_GPIO_5_SHIFT 1
1636#define PALMAS_PRIMARY_SECONDARY_PAD2_GPIO_4 0x01
1637#define PALMAS_PRIMARY_SECONDARY_PAD2_GPIO_4_SHIFT 0
1638
1639/* Bit definitions for I2C_SPI */
1640#define PALMAS_I2C_SPI_I2C2OTP_EN 0x80
1641#define PALMAS_I2C_SPI_I2C2OTP_EN_SHIFT 7
1642#define PALMAS_I2C_SPI_I2C2OTP_PAGESEL 0x40
1643#define PALMAS_I2C_SPI_I2C2OTP_PAGESEL_SHIFT 6
1644#define PALMAS_I2C_SPI_ID_I2C2 0x20
1645#define PALMAS_I2C_SPI_ID_I2C2_SHIFT 5
1646#define PALMAS_I2C_SPI_I2C_SPI 0x10
1647#define PALMAS_I2C_SPI_I2C_SPI_SHIFT 4
1648#define PALMAS_I2C_SPI_ID_I2C1_MASK 0x0f
1649#define PALMAS_I2C_SPI_ID_I2C1_SHIFT 0
1650
1651/* Bit definitions for PU_PD_INPUT_CTRL4 */
1652#define PALMAS_PU_PD_INPUT_CTRL4_DVFS2_DAT_PD 0x40
1653#define PALMAS_PU_PD_INPUT_CTRL4_DVFS2_DAT_PD_SHIFT 6
1654#define PALMAS_PU_PD_INPUT_CTRL4_DVFS2_CLK_PD 0x10
1655#define PALMAS_PU_PD_INPUT_CTRL4_DVFS2_CLK_PD_SHIFT 4
1656#define PALMAS_PU_PD_INPUT_CTRL4_DVFS1_DAT_PD 0x04
1657#define PALMAS_PU_PD_INPUT_CTRL4_DVFS1_DAT_PD_SHIFT 2
1658#define PALMAS_PU_PD_INPUT_CTRL4_DVFS1_CLK_PD 0x01
1659#define PALMAS_PU_PD_INPUT_CTRL4_DVFS1_CLK_PD_SHIFT 0
1660
1661/* Bit definitions for PRIMARY_SECONDARY_PAD3 */
1662#define PALMAS_PRIMARY_SECONDARY_PAD3_DVFS2 0x02
1663#define PALMAS_PRIMARY_SECONDARY_PAD3_DVFS2_SHIFT 1
1664#define PALMAS_PRIMARY_SECONDARY_PAD3_DVFS1 0x01
1665#define PALMAS_PRIMARY_SECONDARY_PAD3_DVFS1_SHIFT 0
1666
1667/* Registers for function LED_PWM */
1668#define PALMAS_LED_PERIOD_CTRL 0x0
1669#define PALMAS_LED_CTRL 0x1
1670#define PALMAS_PWM_CTRL1 0x2
1671#define PALMAS_PWM_CTRL2 0x3
1672
1673/* Bit definitions for LED_PERIOD_CTRL */
1674#define PALMAS_LED_PERIOD_CTRL_LED_2_PERIOD_MASK 0x38
1675#define PALMAS_LED_PERIOD_CTRL_LED_2_PERIOD_SHIFT 3
1676#define PALMAS_LED_PERIOD_CTRL_LED_1_PERIOD_MASK 0x07
1677#define PALMAS_LED_PERIOD_CTRL_LED_1_PERIOD_SHIFT 0
1678
1679/* Bit definitions for LED_CTRL */
1680#define PALMAS_LED_CTRL_LED_2_SEQ 0x20
1681#define PALMAS_LED_CTRL_LED_2_SEQ_SHIFT 5
1682#define PALMAS_LED_CTRL_LED_1_SEQ 0x10
1683#define PALMAS_LED_CTRL_LED_1_SEQ_SHIFT 4
1684#define PALMAS_LED_CTRL_LED_2_ON_TIME_MASK 0x0c
1685#define PALMAS_LED_CTRL_LED_2_ON_TIME_SHIFT 2
1686#define PALMAS_LED_CTRL_LED_1_ON_TIME_MASK 0x03
1687#define PALMAS_LED_CTRL_LED_1_ON_TIME_SHIFT 0
1688
1689/* Bit definitions for PWM_CTRL1 */
1690#define PALMAS_PWM_CTRL1_PWM_FREQ_EN 0x02
1691#define PALMAS_PWM_CTRL1_PWM_FREQ_EN_SHIFT 1
1692#define PALMAS_PWM_CTRL1_PWM_FREQ_SEL 0x01
1693#define PALMAS_PWM_CTRL1_PWM_FREQ_SEL_SHIFT 0
1694
1695/* Bit definitions for PWM_CTRL2 */
1696#define PALMAS_PWM_CTRL2_PWM_DUTY_SEL_MASK 0xff
1697#define PALMAS_PWM_CTRL2_PWM_DUTY_SEL_SHIFT 0
1698
1699/* Registers for function INTERRUPT */
1700#define PALMAS_INT1_STATUS 0x0
1701#define PALMAS_INT1_MASK 0x1
1702#define PALMAS_INT1_LINE_STATE 0x2
1703#define PALMAS_INT1_EDGE_DETECT1_RESERVED 0x3
1704#define PALMAS_INT1_EDGE_DETECT2_RESERVED 0x4
1705#define PALMAS_INT2_STATUS 0x5
1706#define PALMAS_INT2_MASK 0x6
1707#define PALMAS_INT2_LINE_STATE 0x7
1708#define PALMAS_INT2_EDGE_DETECT1_RESERVED 0x8
1709#define PALMAS_INT2_EDGE_DETECT2_RESERVED 0x9
1710#define PALMAS_INT3_STATUS 0xA
1711#define PALMAS_INT3_MASK 0xB
1712#define PALMAS_INT3_LINE_STATE 0xC
1713#define PALMAS_INT3_EDGE_DETECT1_RESERVED 0xD
1714#define PALMAS_INT3_EDGE_DETECT2_RESERVED 0xE
1715#define PALMAS_INT4_STATUS 0xF
1716#define PALMAS_INT4_MASK 0x10
1717#define PALMAS_INT4_LINE_STATE 0x11
1718#define PALMAS_INT4_EDGE_DETECT1 0x12
1719#define PALMAS_INT4_EDGE_DETECT2 0x13
1720#define PALMAS_INT_CTRL 0x14
1721
1722/* Bit definitions for INT1_STATUS */
1723#define PALMAS_INT1_STATUS_VBAT_MON 0x80
1724#define PALMAS_INT1_STATUS_VBAT_MON_SHIFT 7
1725#define PALMAS_INT1_STATUS_VSYS_MON 0x40
1726#define PALMAS_INT1_STATUS_VSYS_MON_SHIFT 6
1727#define PALMAS_INT1_STATUS_HOTDIE 0x20
1728#define PALMAS_INT1_STATUS_HOTDIE_SHIFT 5
1729#define PALMAS_INT1_STATUS_PWRDOWN 0x10
1730#define PALMAS_INT1_STATUS_PWRDOWN_SHIFT 4
1731#define PALMAS_INT1_STATUS_RPWRON 0x08
1732#define PALMAS_INT1_STATUS_RPWRON_SHIFT 3
1733#define PALMAS_INT1_STATUS_LONG_PRESS_KEY 0x04
1734#define PALMAS_INT1_STATUS_LONG_PRESS_KEY_SHIFT 2
1735#define PALMAS_INT1_STATUS_PWRON 0x02
1736#define PALMAS_INT1_STATUS_PWRON_SHIFT 1
1737#define PALMAS_INT1_STATUS_CHARG_DET_N_VBUS_OVV 0x01
1738#define PALMAS_INT1_STATUS_CHARG_DET_N_VBUS_OVV_SHIFT 0
1739
1740/* Bit definitions for INT1_MASK */
1741#define PALMAS_INT1_MASK_VBAT_MON 0x80
1742#define PALMAS_INT1_MASK_VBAT_MON_SHIFT 7
1743#define PALMAS_INT1_MASK_VSYS_MON 0x40
1744#define PALMAS_INT1_MASK_VSYS_MON_SHIFT 6
1745#define PALMAS_INT1_MASK_HOTDIE 0x20
1746#define PALMAS_INT1_MASK_HOTDIE_SHIFT 5
1747#define PALMAS_INT1_MASK_PWRDOWN 0x10
1748#define PALMAS_INT1_MASK_PWRDOWN_SHIFT 4
1749#define PALMAS_INT1_MASK_RPWRON 0x08
1750#define PALMAS_INT1_MASK_RPWRON_SHIFT 3
1751#define PALMAS_INT1_MASK_LONG_PRESS_KEY 0x04
1752#define PALMAS_INT1_MASK_LONG_PRESS_KEY_SHIFT 2
1753#define PALMAS_INT1_MASK_PWRON 0x02
1754#define PALMAS_INT1_MASK_PWRON_SHIFT 1
1755#define PALMAS_INT1_MASK_CHARG_DET_N_VBUS_OVV 0x01
1756#define PALMAS_INT1_MASK_CHARG_DET_N_VBUS_OVV_SHIFT 0
1757
1758/* Bit definitions for INT1_LINE_STATE */
1759#define PALMAS_INT1_LINE_STATE_VBAT_MON 0x80
1760#define PALMAS_INT1_LINE_STATE_VBAT_MON_SHIFT 7
1761#define PALMAS_INT1_LINE_STATE_VSYS_MON 0x40
1762#define PALMAS_INT1_LINE_STATE_VSYS_MON_SHIFT 6
1763#define PALMAS_INT1_LINE_STATE_HOTDIE 0x20
1764#define PALMAS_INT1_LINE_STATE_HOTDIE_SHIFT 5
1765#define PALMAS_INT1_LINE_STATE_PWRDOWN 0x10
1766#define PALMAS_INT1_LINE_STATE_PWRDOWN_SHIFT 4
1767#define PALMAS_INT1_LINE_STATE_RPWRON 0x08
1768#define PALMAS_INT1_LINE_STATE_RPWRON_SHIFT 3
1769#define PALMAS_INT1_LINE_STATE_LONG_PRESS_KEY 0x04
1770#define PALMAS_INT1_LINE_STATE_LONG_PRESS_KEY_SHIFT 2
1771#define PALMAS_INT1_LINE_STATE_PWRON 0x02
1772#define PALMAS_INT1_LINE_STATE_PWRON_SHIFT 1
1773#define PALMAS_INT1_LINE_STATE_CHARG_DET_N_VBUS_OVV 0x01
1774#define PALMAS_INT1_LINE_STATE_CHARG_DET_N_VBUS_OVV_SHIFT 0
1775
1776/* Bit definitions for INT2_STATUS */
1777#define PALMAS_INT2_STATUS_VAC_ACOK 0x80
1778#define PALMAS_INT2_STATUS_VAC_ACOK_SHIFT 7
1779#define PALMAS_INT2_STATUS_SHORT 0x40
1780#define PALMAS_INT2_STATUS_SHORT_SHIFT 6
1781#define PALMAS_INT2_STATUS_FBI_BB 0x20
1782#define PALMAS_INT2_STATUS_FBI_BB_SHIFT 5
1783#define PALMAS_INT2_STATUS_RESET_IN 0x10
1784#define PALMAS_INT2_STATUS_RESET_IN_SHIFT 4
1785#define PALMAS_INT2_STATUS_BATREMOVAL 0x08
1786#define PALMAS_INT2_STATUS_BATREMOVAL_SHIFT 3
1787#define PALMAS_INT2_STATUS_WDT 0x04
1788#define PALMAS_INT2_STATUS_WDT_SHIFT 2
1789#define PALMAS_INT2_STATUS_RTC_TIMER 0x02
1790#define PALMAS_INT2_STATUS_RTC_TIMER_SHIFT 1
1791#define PALMAS_INT2_STATUS_RTC_ALARM 0x01
1792#define PALMAS_INT2_STATUS_RTC_ALARM_SHIFT 0
1793
1794/* Bit definitions for INT2_MASK */
1795#define PALMAS_INT2_MASK_VAC_ACOK 0x80
1796#define PALMAS_INT2_MASK_VAC_ACOK_SHIFT 7
1797#define PALMAS_INT2_MASK_SHORT 0x40
1798#define PALMAS_INT2_MASK_SHORT_SHIFT 6
1799#define PALMAS_INT2_MASK_FBI_BB 0x20
1800#define PALMAS_INT2_MASK_FBI_BB_SHIFT 5
1801#define PALMAS_INT2_MASK_RESET_IN 0x10
1802#define PALMAS_INT2_MASK_RESET_IN_SHIFT 4
1803#define PALMAS_INT2_MASK_BATREMOVAL 0x08
1804#define PALMAS_INT2_MASK_BATREMOVAL_SHIFT 3
1805#define PALMAS_INT2_MASK_WDT 0x04
1806#define PALMAS_INT2_MASK_WDT_SHIFT 2
1807#define PALMAS_INT2_MASK_RTC_TIMER 0x02
1808#define PALMAS_INT2_MASK_RTC_TIMER_SHIFT 1
1809#define PALMAS_INT2_MASK_RTC_ALARM 0x01
1810#define PALMAS_INT2_MASK_RTC_ALARM_SHIFT 0
1811
1812/* Bit definitions for INT2_LINE_STATE */
1813#define PALMAS_INT2_LINE_STATE_VAC_ACOK 0x80
1814#define PALMAS_INT2_LINE_STATE_VAC_ACOK_SHIFT 7
1815#define PALMAS_INT2_LINE_STATE_SHORT 0x40
1816#define PALMAS_INT2_LINE_STATE_SHORT_SHIFT 6
1817#define PALMAS_INT2_LINE_STATE_FBI_BB 0x20
1818#define PALMAS_INT2_LINE_STATE_FBI_BB_SHIFT 5
1819#define PALMAS_INT2_LINE_STATE_RESET_IN 0x10
1820#define PALMAS_INT2_LINE_STATE_RESET_IN_SHIFT 4
1821#define PALMAS_INT2_LINE_STATE_BATREMOVAL 0x08
1822#define PALMAS_INT2_LINE_STATE_BATREMOVAL_SHIFT 3
1823#define PALMAS_INT2_LINE_STATE_WDT 0x04
1824#define PALMAS_INT2_LINE_STATE_WDT_SHIFT 2
1825#define PALMAS_INT2_LINE_STATE_RTC_TIMER 0x02
1826#define PALMAS_INT2_LINE_STATE_RTC_TIMER_SHIFT 1
1827#define PALMAS_INT2_LINE_STATE_RTC_ALARM 0x01
1828#define PALMAS_INT2_LINE_STATE_RTC_ALARM_SHIFT 0
1829
1830/* Bit definitions for INT3_STATUS */
1831#define PALMAS_INT3_STATUS_VBUS 0x80
1832#define PALMAS_INT3_STATUS_VBUS_SHIFT 7
1833#define PALMAS_INT3_STATUS_VBUS_OTG 0x40
1834#define PALMAS_INT3_STATUS_VBUS_OTG_SHIFT 6
1835#define PALMAS_INT3_STATUS_ID 0x20
1836#define PALMAS_INT3_STATUS_ID_SHIFT 5
1837#define PALMAS_INT3_STATUS_ID_OTG 0x10
1838#define PALMAS_INT3_STATUS_ID_OTG_SHIFT 4
1839#define PALMAS_INT3_STATUS_GPADC_EOC_RT 0x08
1840#define PALMAS_INT3_STATUS_GPADC_EOC_RT_SHIFT 3
1841#define PALMAS_INT3_STATUS_GPADC_EOC_SW 0x04
1842#define PALMAS_INT3_STATUS_GPADC_EOC_SW_SHIFT 2
1843#define PALMAS_INT3_STATUS_GPADC_AUTO_1 0x02
1844#define PALMAS_INT3_STATUS_GPADC_AUTO_1_SHIFT 1
1845#define PALMAS_INT3_STATUS_GPADC_AUTO_0 0x01
1846#define PALMAS_INT3_STATUS_GPADC_AUTO_0_SHIFT 0
1847
1848/* Bit definitions for INT3_MASK */
1849#define PALMAS_INT3_MASK_VBUS 0x80
1850#define PALMAS_INT3_MASK_VBUS_SHIFT 7
1851#define PALMAS_INT3_MASK_VBUS_OTG 0x40
1852#define PALMAS_INT3_MASK_VBUS_OTG_SHIFT 6
1853#define PALMAS_INT3_MASK_ID 0x20
1854#define PALMAS_INT3_MASK_ID_SHIFT 5
1855#define PALMAS_INT3_MASK_ID_OTG 0x10
1856#define PALMAS_INT3_MASK_ID_OTG_SHIFT 4
1857#define PALMAS_INT3_MASK_GPADC_EOC_RT 0x08
1858#define PALMAS_INT3_MASK_GPADC_EOC_RT_SHIFT 3
1859#define PALMAS_INT3_MASK_GPADC_EOC_SW 0x04
1860#define PALMAS_INT3_MASK_GPADC_EOC_SW_SHIFT 2
1861#define PALMAS_INT3_MASK_GPADC_AUTO_1 0x02
1862#define PALMAS_INT3_MASK_GPADC_AUTO_1_SHIFT 1
1863#define PALMAS_INT3_MASK_GPADC_AUTO_0 0x01
1864#define PALMAS_INT3_MASK_GPADC_AUTO_0_SHIFT 0
1865
1866/* Bit definitions for INT3_LINE_STATE */
1867#define PALMAS_INT3_LINE_STATE_VBUS 0x80
1868#define PALMAS_INT3_LINE_STATE_VBUS_SHIFT 7
1869#define PALMAS_INT3_LINE_STATE_VBUS_OTG 0x40
1870#define PALMAS_INT3_LINE_STATE_VBUS_OTG_SHIFT 6
1871#define PALMAS_INT3_LINE_STATE_ID 0x20
1872#define PALMAS_INT3_LINE_STATE_ID_SHIFT 5
1873#define PALMAS_INT3_LINE_STATE_ID_OTG 0x10
1874#define PALMAS_INT3_LINE_STATE_ID_OTG_SHIFT 4
1875#define PALMAS_INT3_LINE_STATE_GPADC_EOC_RT 0x08
1876#define PALMAS_INT3_LINE_STATE_GPADC_EOC_RT_SHIFT 3
1877#define PALMAS_INT3_LINE_STATE_GPADC_EOC_SW 0x04
1878#define PALMAS_INT3_LINE_STATE_GPADC_EOC_SW_SHIFT 2
1879#define PALMAS_INT3_LINE_STATE_GPADC_AUTO_1 0x02
1880#define PALMAS_INT3_LINE_STATE_GPADC_AUTO_1_SHIFT 1
1881#define PALMAS_INT3_LINE_STATE_GPADC_AUTO_0 0x01
1882#define PALMAS_INT3_LINE_STATE_GPADC_AUTO_0_SHIFT 0
1883
1884/* Bit definitions for INT4_STATUS */
1885#define PALMAS_INT4_STATUS_GPIO_7 0x80
1886#define PALMAS_INT4_STATUS_GPIO_7_SHIFT 7
1887#define PALMAS_INT4_STATUS_GPIO_6 0x40
1888#define PALMAS_INT4_STATUS_GPIO_6_SHIFT 6
1889#define PALMAS_INT4_STATUS_GPIO_5 0x20
1890#define PALMAS_INT4_STATUS_GPIO_5_SHIFT 5
1891#define PALMAS_INT4_STATUS_GPIO_4 0x10
1892#define PALMAS_INT4_STATUS_GPIO_4_SHIFT 4
1893#define PALMAS_INT4_STATUS_GPIO_3 0x08
1894#define PALMAS_INT4_STATUS_GPIO_3_SHIFT 3
1895#define PALMAS_INT4_STATUS_GPIO_2 0x04
1896#define PALMAS_INT4_STATUS_GPIO_2_SHIFT 2
1897#define PALMAS_INT4_STATUS_GPIO_1 0x02
1898#define PALMAS_INT4_STATUS_GPIO_1_SHIFT 1
1899#define PALMAS_INT4_STATUS_GPIO_0 0x01
1900#define PALMAS_INT4_STATUS_GPIO_0_SHIFT 0
1901
1902/* Bit definitions for INT4_MASK */
1903#define PALMAS_INT4_MASK_GPIO_7 0x80
1904#define PALMAS_INT4_MASK_GPIO_7_SHIFT 7
1905#define PALMAS_INT4_MASK_GPIO_6 0x40
1906#define PALMAS_INT4_MASK_GPIO_6_SHIFT 6
1907#define PALMAS_INT4_MASK_GPIO_5 0x20
1908#define PALMAS_INT4_MASK_GPIO_5_SHIFT 5
1909#define PALMAS_INT4_MASK_GPIO_4 0x10
1910#define PALMAS_INT4_MASK_GPIO_4_SHIFT 4
1911#define PALMAS_INT4_MASK_GPIO_3 0x08
1912#define PALMAS_INT4_MASK_GPIO_3_SHIFT 3
1913#define PALMAS_INT4_MASK_GPIO_2 0x04
1914#define PALMAS_INT4_MASK_GPIO_2_SHIFT 2
1915#define PALMAS_INT4_MASK_GPIO_1 0x02
1916#define PALMAS_INT4_MASK_GPIO_1_SHIFT 1
1917#define PALMAS_INT4_MASK_GPIO_0 0x01
1918#define PALMAS_INT4_MASK_GPIO_0_SHIFT 0
1919
1920/* Bit definitions for INT4_LINE_STATE */
1921#define PALMAS_INT4_LINE_STATE_GPIO_7 0x80
1922#define PALMAS_INT4_LINE_STATE_GPIO_7_SHIFT 7
1923#define PALMAS_INT4_LINE_STATE_GPIO_6 0x40
1924#define PALMAS_INT4_LINE_STATE_GPIO_6_SHIFT 6
1925#define PALMAS_INT4_LINE_STATE_GPIO_5 0x20
1926#define PALMAS_INT4_LINE_STATE_GPIO_5_SHIFT 5
1927#define PALMAS_INT4_LINE_STATE_GPIO_4 0x10
1928#define PALMAS_INT4_LINE_STATE_GPIO_4_SHIFT 4
1929#define PALMAS_INT4_LINE_STATE_GPIO_3 0x08
1930#define PALMAS_INT4_LINE_STATE_GPIO_3_SHIFT 3
1931#define PALMAS_INT4_LINE_STATE_GPIO_2 0x04
1932#define PALMAS_INT4_LINE_STATE_GPIO_2_SHIFT 2
1933#define PALMAS_INT4_LINE_STATE_GPIO_1 0x02
1934#define PALMAS_INT4_LINE_STATE_GPIO_1_SHIFT 1
1935#define PALMAS_INT4_LINE_STATE_GPIO_0 0x01
1936#define PALMAS_INT4_LINE_STATE_GPIO_0_SHIFT 0
1937
1938/* Bit definitions for INT4_EDGE_DETECT1 */
1939#define PALMAS_INT4_EDGE_DETECT1_GPIO_3_RISING 0x80
1940#define PALMAS_INT4_EDGE_DETECT1_GPIO_3_RISING_SHIFT 7
1941#define PALMAS_INT4_EDGE_DETECT1_GPIO_3_FALLING 0x40
1942#define PALMAS_INT4_EDGE_DETECT1_GPIO_3_FALLING_SHIFT 6
1943#define PALMAS_INT4_EDGE_DETECT1_GPIO_2_RISING 0x20
1944#define PALMAS_INT4_EDGE_DETECT1_GPIO_2_RISING_SHIFT 5
1945#define PALMAS_INT4_EDGE_DETECT1_GPIO_2_FALLING 0x10
1946#define PALMAS_INT4_EDGE_DETECT1_GPIO_2_FALLING_SHIFT 4
1947#define PALMAS_INT4_EDGE_DETECT1_GPIO_1_RISING 0x08
1948#define PALMAS_INT4_EDGE_DETECT1_GPIO_1_RISING_SHIFT 3
1949#define PALMAS_INT4_EDGE_DETECT1_GPIO_1_FALLING 0x04
1950#define PALMAS_INT4_EDGE_DETECT1_GPIO_1_FALLING_SHIFT 2
1951#define PALMAS_INT4_EDGE_DETECT1_GPIO_0_RISING 0x02
1952#define PALMAS_INT4_EDGE_DETECT1_GPIO_0_RISING_SHIFT 1
1953#define PALMAS_INT4_EDGE_DETECT1_GPIO_0_FALLING 0x01
1954#define PALMAS_INT4_EDGE_DETECT1_GPIO_0_FALLING_SHIFT 0
1955
1956/* Bit definitions for INT4_EDGE_DETECT2 */
1957#define PALMAS_INT4_EDGE_DETECT2_GPIO_7_RISING 0x80
1958#define PALMAS_INT4_EDGE_DETECT2_GPIO_7_RISING_SHIFT 7
1959#define PALMAS_INT4_EDGE_DETECT2_GPIO_7_FALLING 0x40
1960#define PALMAS_INT4_EDGE_DETECT2_GPIO_7_FALLING_SHIFT 6
1961#define PALMAS_INT4_EDGE_DETECT2_GPIO_6_RISING 0x20
1962#define PALMAS_INT4_EDGE_DETECT2_GPIO_6_RISING_SHIFT 5
1963#define PALMAS_INT4_EDGE_DETECT2_GPIO_6_FALLING 0x10
1964#define PALMAS_INT4_EDGE_DETECT2_GPIO_6_FALLING_SHIFT 4
1965#define PALMAS_INT4_EDGE_DETECT2_GPIO_5_RISING 0x08
1966#define PALMAS_INT4_EDGE_DETECT2_GPIO_5_RISING_SHIFT 3
1967#define PALMAS_INT4_EDGE_DETECT2_GPIO_5_FALLING 0x04
1968#define PALMAS_INT4_EDGE_DETECT2_GPIO_5_FALLING_SHIFT 2
1969#define PALMAS_INT4_EDGE_DETECT2_GPIO_4_RISING 0x02
1970#define PALMAS_INT4_EDGE_DETECT2_GPIO_4_RISING_SHIFT 1
1971#define PALMAS_INT4_EDGE_DETECT2_GPIO_4_FALLING 0x01
1972#define PALMAS_INT4_EDGE_DETECT2_GPIO_4_FALLING_SHIFT 0
1973
1974/* Bit definitions for INT_CTRL */
1975#define PALMAS_INT_CTRL_INT_PENDING 0x04
1976#define PALMAS_INT_CTRL_INT_PENDING_SHIFT 2
1977#define PALMAS_INT_CTRL_INT_CLEAR 0x01
1978#define PALMAS_INT_CTRL_INT_CLEAR_SHIFT 0
1979
1980/* Registers for function USB_OTG */
1981#define PALMAS_USB_WAKEUP 0x3
1982#define PALMAS_USB_VBUS_CTRL_SET 0x4
1983#define PALMAS_USB_VBUS_CTRL_CLR 0x5
1984#define PALMAS_USB_ID_CTRL_SET 0x6
1985#define PALMAS_USB_ID_CTRL_CLEAR 0x7
1986#define PALMAS_USB_VBUS_INT_SRC 0x8
1987#define PALMAS_USB_VBUS_INT_LATCH_SET 0x9
1988#define PALMAS_USB_VBUS_INT_LATCH_CLR 0xA
1989#define PALMAS_USB_VBUS_INT_EN_LO_SET 0xB
1990#define PALMAS_USB_VBUS_INT_EN_LO_CLR 0xC
1991#define PALMAS_USB_VBUS_INT_EN_HI_SET 0xD
1992#define PALMAS_USB_VBUS_INT_EN_HI_CLR 0xE
1993#define PALMAS_USB_ID_INT_SRC 0xF
1994#define PALMAS_USB_ID_INT_LATCH_SET 0x10
1995#define PALMAS_USB_ID_INT_LATCH_CLR 0x11
1996#define PALMAS_USB_ID_INT_EN_LO_SET 0x12
1997#define PALMAS_USB_ID_INT_EN_LO_CLR 0x13
1998#define PALMAS_USB_ID_INT_EN_HI_SET 0x14
1999#define PALMAS_USB_ID_INT_EN_HI_CLR 0x15
2000#define PALMAS_USB_OTG_ADP_CTRL 0x16
2001#define PALMAS_USB_OTG_ADP_HIGH 0x17
2002#define PALMAS_USB_OTG_ADP_LOW 0x18
2003#define PALMAS_USB_OTG_ADP_RISE 0x19
2004#define PALMAS_USB_OTG_REVISION 0x1A
2005
2006/* Bit definitions for USB_WAKEUP */
2007#define PALMAS_USB_WAKEUP_ID_WK_UP_COMP 0x01
2008#define PALMAS_USB_WAKEUP_ID_WK_UP_COMP_SHIFT 0
2009
2010/* Bit definitions for USB_VBUS_CTRL_SET */
2011#define PALMAS_USB_VBUS_CTRL_SET_VBUS_CHRG_VSYS 0x80
2012#define PALMAS_USB_VBUS_CTRL_SET_VBUS_CHRG_VSYS_SHIFT 7
2013#define PALMAS_USB_VBUS_CTRL_SET_VBUS_DISCHRG 0x20
2014#define PALMAS_USB_VBUS_CTRL_SET_VBUS_DISCHRG_SHIFT 5
2015#define PALMAS_USB_VBUS_CTRL_SET_VBUS_IADP_SRC 0x10
2016#define PALMAS_USB_VBUS_CTRL_SET_VBUS_IADP_SRC_SHIFT 4
2017#define PALMAS_USB_VBUS_CTRL_SET_VBUS_IADP_SINK 0x08
2018#define PALMAS_USB_VBUS_CTRL_SET_VBUS_IADP_SINK_SHIFT 3
2019#define PALMAS_USB_VBUS_CTRL_SET_VBUS_ACT_COMP 0x04
2020#define PALMAS_USB_VBUS_CTRL_SET_VBUS_ACT_COMP_SHIFT 2
2021
2022/* Bit definitions for USB_VBUS_CTRL_CLR */
2023#define PALMAS_USB_VBUS_CTRL_CLR_VBUS_CHRG_VSYS 0x80
2024#define PALMAS_USB_VBUS_CTRL_CLR_VBUS_CHRG_VSYS_SHIFT 7
2025#define PALMAS_USB_VBUS_CTRL_CLR_VBUS_DISCHRG 0x20
2026#define PALMAS_USB_VBUS_CTRL_CLR_VBUS_DISCHRG_SHIFT 5
2027#define PALMAS_USB_VBUS_CTRL_CLR_VBUS_IADP_SRC 0x10
2028#define PALMAS_USB_VBUS_CTRL_CLR_VBUS_IADP_SRC_SHIFT 4
2029#define PALMAS_USB_VBUS_CTRL_CLR_VBUS_IADP_SINK 0x08
2030#define PALMAS_USB_VBUS_CTRL_CLR_VBUS_IADP_SINK_SHIFT 3
2031#define PALMAS_USB_VBUS_CTRL_CLR_VBUS_ACT_COMP 0x04
2032#define PALMAS_USB_VBUS_CTRL_CLR_VBUS_ACT_COMP_SHIFT 2
2033
2034/* Bit definitions for USB_ID_CTRL_SET */
2035#define PALMAS_USB_ID_CTRL_SET_ID_PU_220K 0x80
2036#define PALMAS_USB_ID_CTRL_SET_ID_PU_220K_SHIFT 7
2037#define PALMAS_USB_ID_CTRL_SET_ID_PU_100K 0x40
2038#define PALMAS_USB_ID_CTRL_SET_ID_PU_100K_SHIFT 6
2039#define PALMAS_USB_ID_CTRL_SET_ID_GND_DRV 0x20
2040#define PALMAS_USB_ID_CTRL_SET_ID_GND_DRV_SHIFT 5
2041#define PALMAS_USB_ID_CTRL_SET_ID_SRC_16U 0x10
2042#define PALMAS_USB_ID_CTRL_SET_ID_SRC_16U_SHIFT 4
2043#define PALMAS_USB_ID_CTRL_SET_ID_SRC_5U 0x08
2044#define PALMAS_USB_ID_CTRL_SET_ID_SRC_5U_SHIFT 3
2045#define PALMAS_USB_ID_CTRL_SET_ID_ACT_COMP 0x04
2046#define PALMAS_USB_ID_CTRL_SET_ID_ACT_COMP_SHIFT 2
2047
2048/* Bit definitions for USB_ID_CTRL_CLEAR */
2049#define PALMAS_USB_ID_CTRL_CLEAR_ID_PU_220K 0x80
2050#define PALMAS_USB_ID_CTRL_CLEAR_ID_PU_220K_SHIFT 7
2051#define PALMAS_USB_ID_CTRL_CLEAR_ID_PU_100K 0x40
2052#define PALMAS_USB_ID_CTRL_CLEAR_ID_PU_100K_SHIFT 6
2053#define PALMAS_USB_ID_CTRL_CLEAR_ID_GND_DRV 0x20
2054#define PALMAS_USB_ID_CTRL_CLEAR_ID_GND_DRV_SHIFT 5
2055#define PALMAS_USB_ID_CTRL_CLEAR_ID_SRC_16U 0x10
2056#define PALMAS_USB_ID_CTRL_CLEAR_ID_SRC_16U_SHIFT 4
2057#define PALMAS_USB_ID_CTRL_CLEAR_ID_SRC_5U 0x08
2058#define PALMAS_USB_ID_CTRL_CLEAR_ID_SRC_5U_SHIFT 3
2059#define PALMAS_USB_ID_CTRL_CLEAR_ID_ACT_COMP 0x04
2060#define PALMAS_USB_ID_CTRL_CLEAR_ID_ACT_COMP_SHIFT 2
2061
2062/* Bit definitions for USB_VBUS_INT_SRC */
2063#define PALMAS_USB_VBUS_INT_SRC_VOTG_SESS_VLD 0x80
2064#define PALMAS_USB_VBUS_INT_SRC_VOTG_SESS_VLD_SHIFT 7
2065#define PALMAS_USB_VBUS_INT_SRC_VADP_PRB 0x40
2066#define PALMAS_USB_VBUS_INT_SRC_VADP_PRB_SHIFT 6
2067#define PALMAS_USB_VBUS_INT_SRC_VADP_SNS 0x20
2068#define PALMAS_USB_VBUS_INT_SRC_VADP_SNS_SHIFT 5
2069#define PALMAS_USB_VBUS_INT_SRC_VA_VBUS_VLD 0x08
2070#define PALMAS_USB_VBUS_INT_SRC_VA_VBUS_VLD_SHIFT 3
2071#define PALMAS_USB_VBUS_INT_SRC_VA_SESS_VLD 0x04
2072#define PALMAS_USB_VBUS_INT_SRC_VA_SESS_VLD_SHIFT 2
2073#define PALMAS_USB_VBUS_INT_SRC_VB_SESS_VLD 0x02
2074#define PALMAS_USB_VBUS_INT_SRC_VB_SESS_VLD_SHIFT 1
2075#define PALMAS_USB_VBUS_INT_SRC_VB_SESS_END 0x01
2076#define PALMAS_USB_VBUS_INT_SRC_VB_SESS_END_SHIFT 0
2077
2078/* Bit definitions for USB_VBUS_INT_LATCH_SET */
2079#define PALMAS_USB_VBUS_INT_LATCH_SET_VOTG_SESS_VLD 0x80
2080#define PALMAS_USB_VBUS_INT_LATCH_SET_VOTG_SESS_VLD_SHIFT 7
2081#define PALMAS_USB_VBUS_INT_LATCH_SET_VADP_PRB 0x40
2082#define PALMAS_USB_VBUS_INT_LATCH_SET_VADP_PRB_SHIFT 6
2083#define PALMAS_USB_VBUS_INT_LATCH_SET_VADP_SNS 0x20
2084#define PALMAS_USB_VBUS_INT_LATCH_SET_VADP_SNS_SHIFT 5
2085#define PALMAS_USB_VBUS_INT_LATCH_SET_ADP 0x10
2086#define PALMAS_USB_VBUS_INT_LATCH_SET_ADP_SHIFT 4
2087#define PALMAS_USB_VBUS_INT_LATCH_SET_VA_VBUS_VLD 0x08
2088#define PALMAS_USB_VBUS_INT_LATCH_SET_VA_VBUS_VLD_SHIFT 3
2089#define PALMAS_USB_VBUS_INT_LATCH_SET_VA_SESS_VLD 0x04
2090#define PALMAS_USB_VBUS_INT_LATCH_SET_VA_SESS_VLD_SHIFT 2
2091#define PALMAS_USB_VBUS_INT_LATCH_SET_VB_SESS_VLD 0x02
2092#define PALMAS_USB_VBUS_INT_LATCH_SET_VB_SESS_VLD_SHIFT 1
2093#define PALMAS_USB_VBUS_INT_LATCH_SET_VB_SESS_END 0x01
2094#define PALMAS_USB_VBUS_INT_LATCH_SET_VB_SESS_END_SHIFT 0
2095
2096/* Bit definitions for USB_VBUS_INT_LATCH_CLR */
2097#define PALMAS_USB_VBUS_INT_LATCH_CLR_VOTG_SESS_VLD 0x80
2098#define PALMAS_USB_VBUS_INT_LATCH_CLR_VOTG_SESS_VLD_SHIFT 7
2099#define PALMAS_USB_VBUS_INT_LATCH_CLR_VADP_PRB 0x40
2100#define PALMAS_USB_VBUS_INT_LATCH_CLR_VADP_PRB_SHIFT 6
2101#define PALMAS_USB_VBUS_INT_LATCH_CLR_VADP_SNS 0x20
2102#define PALMAS_USB_VBUS_INT_LATCH_CLR_VADP_SNS_SHIFT 5
2103#define PALMAS_USB_VBUS_INT_LATCH_CLR_ADP 0x10
2104#define PALMAS_USB_VBUS_INT_LATCH_CLR_ADP_SHIFT 4
2105#define PALMAS_USB_VBUS_INT_LATCH_CLR_VA_VBUS_VLD 0x08
2106#define PALMAS_USB_VBUS_INT_LATCH_CLR_VA_VBUS_VLD_SHIFT 3
2107#define PALMAS_USB_VBUS_INT_LATCH_CLR_VA_SESS_VLD 0x04
2108#define PALMAS_USB_VBUS_INT_LATCH_CLR_VA_SESS_VLD_SHIFT 2
2109#define PALMAS_USB_VBUS_INT_LATCH_CLR_VB_SESS_VLD 0x02
2110#define PALMAS_USB_VBUS_INT_LATCH_CLR_VB_SESS_VLD_SHIFT 1
2111#define PALMAS_USB_VBUS_INT_LATCH_CLR_VB_SESS_END 0x01
2112#define PALMAS_USB_VBUS_INT_LATCH_CLR_VB_SESS_END_SHIFT 0
2113
2114/* Bit definitions for USB_VBUS_INT_EN_LO_SET */
2115#define PALMAS_USB_VBUS_INT_EN_LO_SET_VOTG_SESS_VLD 0x80
2116#define PALMAS_USB_VBUS_INT_EN_LO_SET_VOTG_SESS_VLD_SHIFT 7
2117#define PALMAS_USB_VBUS_INT_EN_LO_SET_VADP_PRB 0x40
2118#define PALMAS_USB_VBUS_INT_EN_LO_SET_VADP_PRB_SHIFT 6
2119#define PALMAS_USB_VBUS_INT_EN_LO_SET_VADP_SNS 0x20
2120#define PALMAS_USB_VBUS_INT_EN_LO_SET_VADP_SNS_SHIFT 5
2121#define PALMAS_USB_VBUS_INT_EN_LO_SET_VA_VBUS_VLD 0x08
2122#define PALMAS_USB_VBUS_INT_EN_LO_SET_VA_VBUS_VLD_SHIFT 3
2123#define PALMAS_USB_VBUS_INT_EN_LO_SET_VA_SESS_VLD 0x04
2124#define PALMAS_USB_VBUS_INT_EN_LO_SET_VA_SESS_VLD_SHIFT 2
2125#define PALMAS_USB_VBUS_INT_EN_LO_SET_VB_SESS_VLD 0x02
2126#define PALMAS_USB_VBUS_INT_EN_LO_SET_VB_SESS_VLD_SHIFT 1
2127#define PALMAS_USB_VBUS_INT_EN_LO_SET_VB_SESS_END 0x01
2128#define PALMAS_USB_VBUS_INT_EN_LO_SET_VB_SESS_END_SHIFT 0
2129
2130/* Bit definitions for USB_VBUS_INT_EN_LO_CLR */
2131#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VOTG_SESS_VLD 0x80
2132#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VOTG_SESS_VLD_SHIFT 7
2133#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VADP_PRB 0x40
2134#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VADP_PRB_SHIFT 6
2135#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VADP_SNS 0x20
2136#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VADP_SNS_SHIFT 5
2137#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VA_VBUS_VLD 0x08
2138#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VA_VBUS_VLD_SHIFT 3
2139#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VA_SESS_VLD 0x04
2140#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VA_SESS_VLD_SHIFT 2
2141#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VB_SESS_VLD 0x02
2142#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VB_SESS_VLD_SHIFT 1
2143#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VB_SESS_END 0x01
2144#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VB_SESS_END_SHIFT 0
2145
2146/* Bit definitions for USB_VBUS_INT_EN_HI_SET */
2147#define PALMAS_USB_VBUS_INT_EN_HI_SET_VOTG_SESS_VLD 0x80
2148#define PALMAS_USB_VBUS_INT_EN_HI_SET_VOTG_SESS_VLD_SHIFT 7
2149#define PALMAS_USB_VBUS_INT_EN_HI_SET_VADP_PRB 0x40
2150#define PALMAS_USB_VBUS_INT_EN_HI_SET_VADP_PRB_SHIFT 6
2151#define PALMAS_USB_VBUS_INT_EN_HI_SET_VADP_SNS 0x20
2152#define PALMAS_USB_VBUS_INT_EN_HI_SET_VADP_SNS_SHIFT 5
2153#define PALMAS_USB_VBUS_INT_EN_HI_SET_ADP 0x10
2154#define PALMAS_USB_VBUS_INT_EN_HI_SET_ADP_SHIFT 4
2155#define PALMAS_USB_VBUS_INT_EN_HI_SET_VA_VBUS_VLD 0x08
2156#define PALMAS_USB_VBUS_INT_EN_HI_SET_VA_VBUS_VLD_SHIFT 3
2157#define PALMAS_USB_VBUS_INT_EN_HI_SET_VA_SESS_VLD 0x04
2158#define PALMAS_USB_VBUS_INT_EN_HI_SET_VA_SESS_VLD_SHIFT 2
2159#define PALMAS_USB_VBUS_INT_EN_HI_SET_VB_SESS_VLD 0x02
2160#define PALMAS_USB_VBUS_INT_EN_HI_SET_VB_SESS_VLD_SHIFT 1
2161#define PALMAS_USB_VBUS_INT_EN_HI_SET_VB_SESS_END 0x01
2162#define PALMAS_USB_VBUS_INT_EN_HI_SET_VB_SESS_END_SHIFT 0
2163
2164/* Bit definitions for USB_VBUS_INT_EN_HI_CLR */
2165#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VOTG_SESS_VLD 0x80
2166#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VOTG_SESS_VLD_SHIFT 7
2167#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VADP_PRB 0x40
2168#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VADP_PRB_SHIFT 6
2169#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VADP_SNS 0x20
2170#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VADP_SNS_SHIFT 5
2171#define PALMAS_USB_VBUS_INT_EN_HI_CLR_ADP 0x10
2172#define PALMAS_USB_VBUS_INT_EN_HI_CLR_ADP_SHIFT 4
2173#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VA_VBUS_VLD 0x08
2174#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VA_VBUS_VLD_SHIFT 3
2175#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VA_SESS_VLD 0x04
2176#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VA_SESS_VLD_SHIFT 2
2177#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VB_SESS_VLD 0x02
2178#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VB_SESS_VLD_SHIFT 1
2179#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VB_SESS_END 0x01
2180#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VB_SESS_END_SHIFT 0
2181
2182/* Bit definitions for USB_ID_INT_SRC */
2183#define PALMAS_USB_ID_INT_SRC_ID_FLOAT 0x10
2184#define PALMAS_USB_ID_INT_SRC_ID_FLOAT_SHIFT 4
2185#define PALMAS_USB_ID_INT_SRC_ID_A 0x08
2186#define PALMAS_USB_ID_INT_SRC_ID_A_SHIFT 3
2187#define PALMAS_USB_ID_INT_SRC_ID_B 0x04
2188#define PALMAS_USB_ID_INT_SRC_ID_B_SHIFT 2
2189#define PALMAS_USB_ID_INT_SRC_ID_C 0x02
2190#define PALMAS_USB_ID_INT_SRC_ID_C_SHIFT 1
2191#define PALMAS_USB_ID_INT_SRC_ID_GND 0x01
2192#define PALMAS_USB_ID_INT_SRC_ID_GND_SHIFT 0
2193
2194/* Bit definitions for USB_ID_INT_LATCH_SET */
2195#define PALMAS_USB_ID_INT_LATCH_SET_ID_FLOAT 0x10
2196#define PALMAS_USB_ID_INT_LATCH_SET_ID_FLOAT_SHIFT 4
2197#define PALMAS_USB_ID_INT_LATCH_SET_ID_A 0x08
2198#define PALMAS_USB_ID_INT_LATCH_SET_ID_A_SHIFT 3
2199#define PALMAS_USB_ID_INT_LATCH_SET_ID_B 0x04
2200#define PALMAS_USB_ID_INT_LATCH_SET_ID_B_SHIFT 2
2201#define PALMAS_USB_ID_INT_LATCH_SET_ID_C 0x02
2202#define PALMAS_USB_ID_INT_LATCH_SET_ID_C_SHIFT 1
2203#define PALMAS_USB_ID_INT_LATCH_SET_ID_GND 0x01
2204#define PALMAS_USB_ID_INT_LATCH_SET_ID_GND_SHIFT 0
2205
2206/* Bit definitions for USB_ID_INT_LATCH_CLR */
2207#define PALMAS_USB_ID_INT_LATCH_CLR_ID_FLOAT 0x10
2208#define PALMAS_USB_ID_INT_LATCH_CLR_ID_FLOAT_SHIFT 4
2209#define PALMAS_USB_ID_INT_LATCH_CLR_ID_A 0x08
2210#define PALMAS_USB_ID_INT_LATCH_CLR_ID_A_SHIFT 3
2211#define PALMAS_USB_ID_INT_LATCH_CLR_ID_B 0x04
2212#define PALMAS_USB_ID_INT_LATCH_CLR_ID_B_SHIFT 2
2213#define PALMAS_USB_ID_INT_LATCH_CLR_ID_C 0x02
2214#define PALMAS_USB_ID_INT_LATCH_CLR_ID_C_SHIFT 1
2215#define PALMAS_USB_ID_INT_LATCH_CLR_ID_GND 0x01
2216#define PALMAS_USB_ID_INT_LATCH_CLR_ID_GND_SHIFT 0
2217
2218/* Bit definitions for USB_ID_INT_EN_LO_SET */
2219#define PALMAS_USB_ID_INT_EN_LO_SET_ID_FLOAT 0x10
2220#define PALMAS_USB_ID_INT_EN_LO_SET_ID_FLOAT_SHIFT 4
2221#define PALMAS_USB_ID_INT_EN_LO_SET_ID_A 0x08
2222#define PALMAS_USB_ID_INT_EN_LO_SET_ID_A_SHIFT 3
2223#define PALMAS_USB_ID_INT_EN_LO_SET_ID_B 0x04
2224#define PALMAS_USB_ID_INT_EN_LO_SET_ID_B_SHIFT 2
2225#define PALMAS_USB_ID_INT_EN_LO_SET_ID_C 0x02
2226#define PALMAS_USB_ID_INT_EN_LO_SET_ID_C_SHIFT 1
2227#define PALMAS_USB_ID_INT_EN_LO_SET_ID_GND 0x01
2228#define PALMAS_USB_ID_INT_EN_LO_SET_ID_GND_SHIFT 0
2229
2230/* Bit definitions for USB_ID_INT_EN_LO_CLR */
2231#define PALMAS_USB_ID_INT_EN_LO_CLR_ID_FLOAT 0x10
2232#define PALMAS_USB_ID_INT_EN_LO_CLR_ID_FLOAT_SHIFT 4
2233#define PALMAS_USB_ID_INT_EN_LO_CLR_ID_A 0x08
2234#define PALMAS_USB_ID_INT_EN_LO_CLR_ID_A_SHIFT 3
2235#define PALMAS_USB_ID_INT_EN_LO_CLR_ID_B 0x04
2236#define PALMAS_USB_ID_INT_EN_LO_CLR_ID_B_SHIFT 2
2237#define PALMAS_USB_ID_INT_EN_LO_CLR_ID_C 0x02
2238#define PALMAS_USB_ID_INT_EN_LO_CLR_ID_C_SHIFT 1
2239#define PALMAS_USB_ID_INT_EN_LO_CLR_ID_GND 0x01
2240#define PALMAS_USB_ID_INT_EN_LO_CLR_ID_GND_SHIFT 0
2241
2242/* Bit definitions for USB_ID_INT_EN_HI_SET */
2243#define PALMAS_USB_ID_INT_EN_HI_SET_ID_FLOAT 0x10
2244#define PALMAS_USB_ID_INT_EN_HI_SET_ID_FLOAT_SHIFT 4
2245#define PALMAS_USB_ID_INT_EN_HI_SET_ID_A 0x08
2246#define PALMAS_USB_ID_INT_EN_HI_SET_ID_A_SHIFT 3
2247#define PALMAS_USB_ID_INT_EN_HI_SET_ID_B 0x04
2248#define PALMAS_USB_ID_INT_EN_HI_SET_ID_B_SHIFT 2
2249#define PALMAS_USB_ID_INT_EN_HI_SET_ID_C 0x02
2250#define PALMAS_USB_ID_INT_EN_HI_SET_ID_C_SHIFT 1
2251#define PALMAS_USB_ID_INT_EN_HI_SET_ID_GND 0x01
2252#define PALMAS_USB_ID_INT_EN_HI_SET_ID_GND_SHIFT 0
2253
2254/* Bit definitions for USB_ID_INT_EN_HI_CLR */
2255#define PALMAS_USB_ID_INT_EN_HI_CLR_ID_FLOAT 0x10
2256#define PALMAS_USB_ID_INT_EN_HI_CLR_ID_FLOAT_SHIFT 4
2257#define PALMAS_USB_ID_INT_EN_HI_CLR_ID_A 0x08
2258#define PALMAS_USB_ID_INT_EN_HI_CLR_ID_A_SHIFT 3
2259#define PALMAS_USB_ID_INT_EN_HI_CLR_ID_B 0x04
2260#define PALMAS_USB_ID_INT_EN_HI_CLR_ID_B_SHIFT 2
2261#define PALMAS_USB_ID_INT_EN_HI_CLR_ID_C 0x02
2262#define PALMAS_USB_ID_INT_EN_HI_CLR_ID_C_SHIFT 1
2263#define PALMAS_USB_ID_INT_EN_HI_CLR_ID_GND 0x01
2264#define PALMAS_USB_ID_INT_EN_HI_CLR_ID_GND_SHIFT 0
2265
2266/* Bit definitions for USB_OTG_ADP_CTRL */
2267#define PALMAS_USB_OTG_ADP_CTRL_ADP_EN 0x04
2268#define PALMAS_USB_OTG_ADP_CTRL_ADP_EN_SHIFT 2
2269#define PALMAS_USB_OTG_ADP_CTRL_ADP_MODE_MASK 0x03
2270#define PALMAS_USB_OTG_ADP_CTRL_ADP_MODE_SHIFT 0
2271
2272/* Bit definitions for USB_OTG_ADP_HIGH */
2273#define PALMAS_USB_OTG_ADP_HIGH_T_ADP_HIGH_MASK 0xff
2274#define PALMAS_USB_OTG_ADP_HIGH_T_ADP_HIGH_SHIFT 0
2275
2276/* Bit definitions for USB_OTG_ADP_LOW */
2277#define PALMAS_USB_OTG_ADP_LOW_T_ADP_LOW_MASK 0xff
2278#define PALMAS_USB_OTG_ADP_LOW_T_ADP_LOW_SHIFT 0
2279
2280/* Bit definitions for USB_OTG_ADP_RISE */
2281#define PALMAS_USB_OTG_ADP_RISE_T_ADP_RISE_MASK 0xff
2282#define PALMAS_USB_OTG_ADP_RISE_T_ADP_RISE_SHIFT 0
2283
2284/* Bit definitions for USB_OTG_REVISION */
2285#define PALMAS_USB_OTG_REVISION_OTG_REV 0x01
2286#define PALMAS_USB_OTG_REVISION_OTG_REV_SHIFT 0
2287
2288/* Registers for function VIBRATOR */
2289#define PALMAS_VIBRA_CTRL 0x0
2290
2291/* Bit definitions for VIBRA_CTRL */
2292#define PALMAS_VIBRA_CTRL_PWM_DUTY_SEL_MASK 0x06
2293#define PALMAS_VIBRA_CTRL_PWM_DUTY_SEL_SHIFT 1
2294#define PALMAS_VIBRA_CTRL_PWM_FREQ_SEL 0x01
2295#define PALMAS_VIBRA_CTRL_PWM_FREQ_SEL_SHIFT 0
2296
2297/* Registers for function GPIO */
2298#define PALMAS_GPIO_DATA_IN 0x0
2299#define PALMAS_GPIO_DATA_DIR 0x1
2300#define PALMAS_GPIO_DATA_OUT 0x2
2301#define PALMAS_GPIO_DEBOUNCE_EN 0x3
2302#define PALMAS_GPIO_CLEAR_DATA_OUT 0x4
2303#define PALMAS_GPIO_SET_DATA_OUT 0x5
2304#define PALMAS_PU_PD_GPIO_CTRL1 0x6
2305#define PALMAS_PU_PD_GPIO_CTRL2 0x7
2306#define PALMAS_OD_OUTPUT_GPIO_CTRL 0x8
2307
2308/* Bit definitions for GPIO_DATA_IN */
2309#define PALMAS_GPIO_DATA_IN_GPIO_7_IN 0x80
2310#define PALMAS_GPIO_DATA_IN_GPIO_7_IN_SHIFT 7
2311#define PALMAS_GPIO_DATA_IN_GPIO_6_IN 0x40
2312#define PALMAS_GPIO_DATA_IN_GPIO_6_IN_SHIFT 6
2313#define PALMAS_GPIO_DATA_IN_GPIO_5_IN 0x20
2314#define PALMAS_GPIO_DATA_IN_GPIO_5_IN_SHIFT 5
2315#define PALMAS_GPIO_DATA_IN_GPIO_4_IN 0x10
2316#define PALMAS_GPIO_DATA_IN_GPIO_4_IN_SHIFT 4
2317#define PALMAS_GPIO_DATA_IN_GPIO_3_IN 0x08
2318#define PALMAS_GPIO_DATA_IN_GPIO_3_IN_SHIFT 3
2319#define PALMAS_GPIO_DATA_IN_GPIO_2_IN 0x04
2320#define PALMAS_GPIO_DATA_IN_GPIO_2_IN_SHIFT 2
2321#define PALMAS_GPIO_DATA_IN_GPIO_1_IN 0x02
2322#define PALMAS_GPIO_DATA_IN_GPIO_1_IN_SHIFT 1
2323#define PALMAS_GPIO_DATA_IN_GPIO_0_IN 0x01
2324#define PALMAS_GPIO_DATA_IN_GPIO_0_IN_SHIFT 0
2325
2326/* Bit definitions for GPIO_DATA_DIR */
2327#define PALMAS_GPIO_DATA_DIR_GPIO_7_DIR 0x80
2328#define PALMAS_GPIO_DATA_DIR_GPIO_7_DIR_SHIFT 7
2329#define PALMAS_GPIO_DATA_DIR_GPIO_6_DIR 0x40
2330#define PALMAS_GPIO_DATA_DIR_GPIO_6_DIR_SHIFT 6
2331#define PALMAS_GPIO_DATA_DIR_GPIO_5_DIR 0x20
2332#define PALMAS_GPIO_DATA_DIR_GPIO_5_DIR_SHIFT 5
2333#define PALMAS_GPIO_DATA_DIR_GPIO_4_DIR 0x10
2334#define PALMAS_GPIO_DATA_DIR_GPIO_4_DIR_SHIFT 4
2335#define PALMAS_GPIO_DATA_DIR_GPIO_3_DIR 0x08
2336#define PALMAS_GPIO_DATA_DIR_GPIO_3_DIR_SHIFT 3
2337#define PALMAS_GPIO_DATA_DIR_GPIO_2_DIR 0x04
2338#define PALMAS_GPIO_DATA_DIR_GPIO_2_DIR_SHIFT 2
2339#define PALMAS_GPIO_DATA_DIR_GPIO_1_DIR 0x02
2340#define PALMAS_GPIO_DATA_DIR_GPIO_1_DIR_SHIFT 1
2341#define PALMAS_GPIO_DATA_DIR_GPIO_0_DIR 0x01
2342#define PALMAS_GPIO_DATA_DIR_GPIO_0_DIR_SHIFT 0
2343
2344/* Bit definitions for GPIO_DATA_OUT */
2345#define PALMAS_GPIO_DATA_OUT_GPIO_7_OUT 0x80
2346#define PALMAS_GPIO_DATA_OUT_GPIO_7_OUT_SHIFT 7
2347#define PALMAS_GPIO_DATA_OUT_GPIO_6_OUT 0x40
2348#define PALMAS_GPIO_DATA_OUT_GPIO_6_OUT_SHIFT 6
2349#define PALMAS_GPIO_DATA_OUT_GPIO_5_OUT 0x20
2350#define PALMAS_GPIO_DATA_OUT_GPIO_5_OUT_SHIFT 5
2351#define PALMAS_GPIO_DATA_OUT_GPIO_4_OUT 0x10
2352#define PALMAS_GPIO_DATA_OUT_GPIO_4_OUT_SHIFT 4
2353#define PALMAS_GPIO_DATA_OUT_GPIO_3_OUT 0x08
2354#define PALMAS_GPIO_DATA_OUT_GPIO_3_OUT_SHIFT 3
2355#define PALMAS_GPIO_DATA_OUT_GPIO_2_OUT 0x04
2356#define PALMAS_GPIO_DATA_OUT_GPIO_2_OUT_SHIFT 2
2357#define PALMAS_GPIO_DATA_OUT_GPIO_1_OUT 0x02
2358#define PALMAS_GPIO_DATA_OUT_GPIO_1_OUT_SHIFT 1
2359#define PALMAS_GPIO_DATA_OUT_GPIO_0_OUT 0x01
2360#define PALMAS_GPIO_DATA_OUT_GPIO_0_OUT_SHIFT 0
2361
2362/* Bit definitions for GPIO_DEBOUNCE_EN */
2363#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_7_DEBOUNCE_EN 0x80
2364#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_7_DEBOUNCE_EN_SHIFT 7
2365#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_6_DEBOUNCE_EN 0x40
2366#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_6_DEBOUNCE_EN_SHIFT 6
2367#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_5_DEBOUNCE_EN 0x20
2368#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_5_DEBOUNCE_EN_SHIFT 5
2369#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_4_DEBOUNCE_EN 0x10
2370#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_4_DEBOUNCE_EN_SHIFT 4
2371#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_3_DEBOUNCE_EN 0x08
2372#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_3_DEBOUNCE_EN_SHIFT 3
2373#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_2_DEBOUNCE_EN 0x04
2374#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_2_DEBOUNCE_EN_SHIFT 2
2375#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_1_DEBOUNCE_EN 0x02
2376#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_1_DEBOUNCE_EN_SHIFT 1
2377#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_0_DEBOUNCE_EN 0x01
2378#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_0_DEBOUNCE_EN_SHIFT 0
2379
2380/* Bit definitions for GPIO_CLEAR_DATA_OUT */
2381#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_7_CLEAR_DATA_OUT 0x80
2382#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_7_CLEAR_DATA_OUT_SHIFT 7
2383#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_6_CLEAR_DATA_OUT 0x40
2384#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_6_CLEAR_DATA_OUT_SHIFT 6
2385#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_5_CLEAR_DATA_OUT 0x20
2386#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_5_CLEAR_DATA_OUT_SHIFT 5
2387#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_4_CLEAR_DATA_OUT 0x10
2388#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_4_CLEAR_DATA_OUT_SHIFT 4
2389#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_3_CLEAR_DATA_OUT 0x08
2390#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_3_CLEAR_DATA_OUT_SHIFT 3
2391#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_2_CLEAR_DATA_OUT 0x04
2392#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_2_CLEAR_DATA_OUT_SHIFT 2
2393#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_1_CLEAR_DATA_OUT 0x02
2394#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_1_CLEAR_DATA_OUT_SHIFT 1
2395#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_0_CLEAR_DATA_OUT 0x01
2396#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_0_CLEAR_DATA_OUT_SHIFT 0
2397
2398/* Bit definitions for GPIO_SET_DATA_OUT */
2399#define PALMAS_GPIO_SET_DATA_OUT_GPIO_7_SET_DATA_OUT 0x80
2400#define PALMAS_GPIO_SET_DATA_OUT_GPIO_7_SET_DATA_OUT_SHIFT 7
2401#define PALMAS_GPIO_SET_DATA_OUT_GPIO_6_SET_DATA_OUT 0x40
2402#define PALMAS_GPIO_SET_DATA_OUT_GPIO_6_SET_DATA_OUT_SHIFT 6
2403#define PALMAS_GPIO_SET_DATA_OUT_GPIO_5_SET_DATA_OUT 0x20
2404#define PALMAS_GPIO_SET_DATA_OUT_GPIO_5_SET_DATA_OUT_SHIFT 5
2405#define PALMAS_GPIO_SET_DATA_OUT_GPIO_4_SET_DATA_OUT 0x10
2406#define PALMAS_GPIO_SET_DATA_OUT_GPIO_4_SET_DATA_OUT_SHIFT 4
2407#define PALMAS_GPIO_SET_DATA_OUT_GPIO_3_SET_DATA_OUT 0x08
2408#define PALMAS_GPIO_SET_DATA_OUT_GPIO_3_SET_DATA_OUT_SHIFT 3
2409#define PALMAS_GPIO_SET_DATA_OUT_GPIO_2_SET_DATA_OUT 0x04
2410#define PALMAS_GPIO_SET_DATA_OUT_GPIO_2_SET_DATA_OUT_SHIFT 2
2411#define PALMAS_GPIO_SET_DATA_OUT_GPIO_1_SET_DATA_OUT 0x02
2412#define PALMAS_GPIO_SET_DATA_OUT_GPIO_1_SET_DATA_OUT_SHIFT 1
2413#define PALMAS_GPIO_SET_DATA_OUT_GPIO_0_SET_DATA_OUT 0x01
2414#define PALMAS_GPIO_SET_DATA_OUT_GPIO_0_SET_DATA_OUT_SHIFT 0
2415
2416/* Bit definitions for PU_PD_GPIO_CTRL1 */
2417#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_3_PD 0x40
2418#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_3_PD_SHIFT 6
2419#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_2_PU 0x20
2420#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_2_PU_SHIFT 5
2421#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_2_PD 0x10
2422#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_2_PD_SHIFT 4
2423#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_1_PU 0x08
2424#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_1_PU_SHIFT 3
2425#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_1_PD 0x04
2426#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_1_PD_SHIFT 2
2427#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_0_PD 0x01
2428#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_0_PD_SHIFT 0
2429
2430/* Bit definitions for PU_PD_GPIO_CTRL2 */
2431#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_7_PD 0x40
2432#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_7_PD_SHIFT 6
2433#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_6_PU 0x20
2434#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_6_PU_SHIFT 5
2435#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_6_PD 0x10
2436#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_6_PD_SHIFT 4
2437#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_5_PU 0x08
2438#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_5_PU_SHIFT 3
2439#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_5_PD 0x04
2440#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_5_PD_SHIFT 2
2441#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_4_PU 0x02
2442#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_4_PU_SHIFT 1
2443#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_4_PD 0x01
2444#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_4_PD_SHIFT 0
2445
2446/* Bit definitions for OD_OUTPUT_GPIO_CTRL */
2447#define PALMAS_OD_OUTPUT_GPIO_CTRL_GPIO_5_OD 0x20
2448#define PALMAS_OD_OUTPUT_GPIO_CTRL_GPIO_5_OD_SHIFT 5
2449#define PALMAS_OD_OUTPUT_GPIO_CTRL_GPIO_2_OD 0x04
2450#define PALMAS_OD_OUTPUT_GPIO_CTRL_GPIO_2_OD_SHIFT 2
2451#define PALMAS_OD_OUTPUT_GPIO_CTRL_GPIO_1_OD 0x02
2452#define PALMAS_OD_OUTPUT_GPIO_CTRL_GPIO_1_OD_SHIFT 1
2453
2454/* Registers for function GPADC */
2455#define PALMAS_GPADC_CTRL1 0x0
2456#define PALMAS_GPADC_CTRL2 0x1
2457#define PALMAS_GPADC_RT_CTRL 0x2
2458#define PALMAS_GPADC_AUTO_CTRL 0x3
2459#define PALMAS_GPADC_STATUS 0x4
2460#define PALMAS_GPADC_RT_SELECT 0x5
2461#define PALMAS_GPADC_RT_CONV0_LSB 0x6
2462#define PALMAS_GPADC_RT_CONV0_MSB 0x7
2463#define PALMAS_GPADC_AUTO_SELECT 0x8
2464#define PALMAS_GPADC_AUTO_CONV0_LSB 0x9
2465#define PALMAS_GPADC_AUTO_CONV0_MSB 0xA
2466#define PALMAS_GPADC_AUTO_CONV1_LSB 0xB
2467#define PALMAS_GPADC_AUTO_CONV1_MSB 0xC
2468#define PALMAS_GPADC_SW_SELECT 0xD
2469#define PALMAS_GPADC_SW_CONV0_LSB 0xE
2470#define PALMAS_GPADC_SW_CONV0_MSB 0xF
2471#define PALMAS_GPADC_THRES_CONV0_LSB 0x10
2472#define PALMAS_GPADC_THRES_CONV0_MSB 0x11
2473#define PALMAS_GPADC_THRES_CONV1_LSB 0x12
2474#define PALMAS_GPADC_THRES_CONV1_MSB 0x13
2475#define PALMAS_GPADC_SMPS_ILMONITOR_EN 0x14
2476#define PALMAS_GPADC_SMPS_VSEL_MONITORING 0x15
2477
2478/* Bit definitions for GPADC_CTRL1 */
2479#define PALMAS_GPADC_CTRL1_RESERVED_MASK 0xc0
2480#define PALMAS_GPADC_CTRL1_RESERVED_SHIFT 6
2481#define PALMAS_GPADC_CTRL1_CURRENT_SRC_CH3_MASK 0x30
2482#define PALMAS_GPADC_CTRL1_CURRENT_SRC_CH3_SHIFT 4
2483#define PALMAS_GPADC_CTRL1_CURRENT_SRC_CH0_MASK 0x0c
2484#define PALMAS_GPADC_CTRL1_CURRENT_SRC_CH0_SHIFT 2
2485#define PALMAS_GPADC_CTRL1_BAT_REMOVAL_DET 0x02
2486#define PALMAS_GPADC_CTRL1_BAT_REMOVAL_DET_SHIFT 1
2487#define PALMAS_GPADC_CTRL1_GPADC_FORCE 0x01
2488#define PALMAS_GPADC_CTRL1_GPADC_FORCE_SHIFT 0
2489
2490/* Bit definitions for GPADC_CTRL2 */
2491#define PALMAS_GPADC_CTRL2_RESERVED_MASK 0x06
2492#define PALMAS_GPADC_CTRL2_RESERVED_SHIFT 1
2493
2494/* Bit definitions for GPADC_RT_CTRL */
2495#define PALMAS_GPADC_RT_CTRL_EXTEND_DELAY 0x02
2496#define PALMAS_GPADC_RT_CTRL_EXTEND_DELAY_SHIFT 1
2497#define PALMAS_GPADC_RT_CTRL_START_POLARITY 0x01
2498#define PALMAS_GPADC_RT_CTRL_START_POLARITY_SHIFT 0
2499
2500/* Bit definitions for GPADC_AUTO_CTRL */
2501#define PALMAS_GPADC_AUTO_CTRL_SHUTDOWN_CONV1 0x80
2502#define PALMAS_GPADC_AUTO_CTRL_SHUTDOWN_CONV1_SHIFT 7
2503#define PALMAS_GPADC_AUTO_CTRL_SHUTDOWN_CONV0 0x40
2504#define PALMAS_GPADC_AUTO_CTRL_SHUTDOWN_CONV0_SHIFT 6
2505#define PALMAS_GPADC_AUTO_CTRL_AUTO_CONV1_EN 0x20
2506#define PALMAS_GPADC_AUTO_CTRL_AUTO_CONV1_EN_SHIFT 5
2507#define PALMAS_GPADC_AUTO_CTRL_AUTO_CONV0_EN 0x10
2508#define PALMAS_GPADC_AUTO_CTRL_AUTO_CONV0_EN_SHIFT 4
2509#define PALMAS_GPADC_AUTO_CTRL_COUNTER_CONV_MASK 0x0f
2510#define PALMAS_GPADC_AUTO_CTRL_COUNTER_CONV_SHIFT 0
2511
2512/* Bit definitions for GPADC_STATUS */
2513#define PALMAS_GPADC_STATUS_GPADC_AVAILABLE 0x10
2514#define PALMAS_GPADC_STATUS_GPADC_AVAILABLE_SHIFT 4
2515
2516/* Bit definitions for GPADC_RT_SELECT */
2517#define PALMAS_GPADC_RT_SELECT_RT_CONV_EN 0x80
2518#define PALMAS_GPADC_RT_SELECT_RT_CONV_EN_SHIFT 7
2519#define PALMAS_GPADC_RT_SELECT_RT_CONV0_SEL_MASK 0x0f
2520#define PALMAS_GPADC_RT_SELECT_RT_CONV0_SEL_SHIFT 0
2521
2522/* Bit definitions for GPADC_RT_CONV0_LSB */
2523#define PALMAS_GPADC_RT_CONV0_LSB_RT_CONV0_LSB_MASK 0xff
2524#define PALMAS_GPADC_RT_CONV0_LSB_RT_CONV0_LSB_SHIFT 0
2525
2526/* Bit definitions for GPADC_RT_CONV0_MSB */
2527#define PALMAS_GPADC_RT_CONV0_MSB_RT_CONV0_MSB_MASK 0x0f
2528#define PALMAS_GPADC_RT_CONV0_MSB_RT_CONV0_MSB_SHIFT 0
2529
2530/* Bit definitions for GPADC_AUTO_SELECT */
2531#define PALMAS_GPADC_AUTO_SELECT_AUTO_CONV1_SEL_MASK 0xf0
2532#define PALMAS_GPADC_AUTO_SELECT_AUTO_CONV1_SEL_SHIFT 4
2533#define PALMAS_GPADC_AUTO_SELECT_AUTO_CONV0_SEL_MASK 0x0f
2534#define PALMAS_GPADC_AUTO_SELECT_AUTO_CONV0_SEL_SHIFT 0
2535
2536/* Bit definitions for GPADC_AUTO_CONV0_LSB */
2537#define PALMAS_GPADC_AUTO_CONV0_LSB_AUTO_CONV0_LSB_MASK 0xff
2538#define PALMAS_GPADC_AUTO_CONV0_LSB_AUTO_CONV0_LSB_SHIFT 0
2539
2540/* Bit definitions for GPADC_AUTO_CONV0_MSB */
2541#define PALMAS_GPADC_AUTO_CONV0_MSB_AUTO_CONV0_MSB_MASK 0x0f
2542#define PALMAS_GPADC_AUTO_CONV0_MSB_AUTO_CONV0_MSB_SHIFT 0
2543
2544/* Bit definitions for GPADC_AUTO_CONV1_LSB */
2545#define PALMAS_GPADC_AUTO_CONV1_LSB_AUTO_CONV1_LSB_MASK 0xff
2546#define PALMAS_GPADC_AUTO_CONV1_LSB_AUTO_CONV1_LSB_SHIFT 0
2547
2548/* Bit definitions for GPADC_AUTO_CONV1_MSB */
2549#define PALMAS_GPADC_AUTO_CONV1_MSB_AUTO_CONV1_MSB_MASK 0x0f
2550#define PALMAS_GPADC_AUTO_CONV1_MSB_AUTO_CONV1_MSB_SHIFT 0
2551
2552/* Bit definitions for GPADC_SW_SELECT */
2553#define PALMAS_GPADC_SW_SELECT_SW_CONV_EN 0x80
2554#define PALMAS_GPADC_SW_SELECT_SW_CONV_EN_SHIFT 7
2555#define PALMAS_GPADC_SW_SELECT_SW_START_CONV0 0x10
2556#define PALMAS_GPADC_SW_SELECT_SW_START_CONV0_SHIFT 4
2557#define PALMAS_GPADC_SW_SELECT_SW_CONV0_SEL_MASK 0x0f
2558#define PALMAS_GPADC_SW_SELECT_SW_CONV0_SEL_SHIFT 0
2559
2560/* Bit definitions for GPADC_SW_CONV0_LSB */
2561#define PALMAS_GPADC_SW_CONV0_LSB_SW_CONV0_LSB_MASK 0xff
2562#define PALMAS_GPADC_SW_CONV0_LSB_SW_CONV0_LSB_SHIFT 0
2563
2564/* Bit definitions for GPADC_SW_CONV0_MSB */
2565#define PALMAS_GPADC_SW_CONV0_MSB_SW_CONV0_MSB_MASK 0x0f
2566#define PALMAS_GPADC_SW_CONV0_MSB_SW_CONV0_MSB_SHIFT 0
2567
2568/* Bit definitions for GPADC_THRES_CONV0_LSB */
2569#define PALMAS_GPADC_THRES_CONV0_LSB_THRES_CONV0_LSB_MASK 0xff
2570#define PALMAS_GPADC_THRES_CONV0_LSB_THRES_CONV0_LSB_SHIFT 0
2571
2572/* Bit definitions for GPADC_THRES_CONV0_MSB */
2573#define PALMAS_GPADC_THRES_CONV0_MSB_THRES_CONV0_POL 0x80
2574#define PALMAS_GPADC_THRES_CONV0_MSB_THRES_CONV0_POL_SHIFT 7
2575#define PALMAS_GPADC_THRES_CONV0_MSB_THRES_CONV0_MSB_MASK 0x0f
2576#define PALMAS_GPADC_THRES_CONV0_MSB_THRES_CONV0_MSB_SHIFT 0
2577
2578/* Bit definitions for GPADC_THRES_CONV1_LSB */
2579#define PALMAS_GPADC_THRES_CONV1_LSB_THRES_CONV1_LSB_MASK 0xff
2580#define PALMAS_GPADC_THRES_CONV1_LSB_THRES_CONV1_LSB_SHIFT 0
2581
2582/* Bit definitions for GPADC_THRES_CONV1_MSB */
2583#define PALMAS_GPADC_THRES_CONV1_MSB_THRES_CONV1_POL 0x80
2584#define PALMAS_GPADC_THRES_CONV1_MSB_THRES_CONV1_POL_SHIFT 7
2585#define PALMAS_GPADC_THRES_CONV1_MSB_THRES_CONV1_MSB_MASK 0x0f
2586#define PALMAS_GPADC_THRES_CONV1_MSB_THRES_CONV1_MSB_SHIFT 0
2587
2588/* Bit definitions for GPADC_SMPS_ILMONITOR_EN */
2589#define PALMAS_GPADC_SMPS_ILMONITOR_EN_SMPS_ILMON_EN 0x20
2590#define PALMAS_GPADC_SMPS_ILMONITOR_EN_SMPS_ILMON_EN_SHIFT 5
2591#define PALMAS_GPADC_SMPS_ILMONITOR_EN_SMPS_ILMON_REXT 0x10
2592#define PALMAS_GPADC_SMPS_ILMONITOR_EN_SMPS_ILMON_REXT_SHIFT 4
2593#define PALMAS_GPADC_SMPS_ILMONITOR_EN_SMPS_ILMON_SEL_MASK 0x0f
2594#define PALMAS_GPADC_SMPS_ILMONITOR_EN_SMPS_ILMON_SEL_SHIFT 0
2595
2596/* Bit definitions for GPADC_SMPS_VSEL_MONITORING */
2597#define PALMAS_GPADC_SMPS_VSEL_MONITORING_ACTIVE_PHASE 0x80
2598#define PALMAS_GPADC_SMPS_VSEL_MONITORING_ACTIVE_PHASE_SHIFT 7
2599#define PALMAS_GPADC_SMPS_VSEL_MONITORING_SMPS_VSEL_MONITORING_MASK 0x7f
2600#define PALMAS_GPADC_SMPS_VSEL_MONITORING_SMPS_VSEL_MONITORING_SHIFT 0
2601
2602/* Registers for function GPADC */
2603#define PALMAS_GPADC_TRIM1 0x0
2604#define PALMAS_GPADC_TRIM2 0x1
2605#define PALMAS_GPADC_TRIM3 0x2
2606#define PALMAS_GPADC_TRIM4 0x3
2607#define PALMAS_GPADC_TRIM5 0x4
2608#define PALMAS_GPADC_TRIM6 0x5
2609#define PALMAS_GPADC_TRIM7 0x6
2610#define PALMAS_GPADC_TRIM8 0x7
2611#define PALMAS_GPADC_TRIM9 0x8
2612#define PALMAS_GPADC_TRIM10 0x9
2613#define PALMAS_GPADC_TRIM11 0xA
2614#define PALMAS_GPADC_TRIM12 0xB
2615#define PALMAS_GPADC_TRIM13 0xC
2616#define PALMAS_GPADC_TRIM14 0xD
2617#define PALMAS_GPADC_TRIM15 0xE
2618#define PALMAS_GPADC_TRIM16 0xF
2619
2620#endif /* __LINUX_MFD_PALMAS_H */
diff --git a/include/linux/mfd/rc5t583.h b/include/linux/mfd/rc5t583.h
index 0b64b19d81ab..c42fe92a727d 100644
--- a/include/linux/mfd/rc5t583.h
+++ b/include/linux/mfd/rc5t583.h
@@ -250,6 +250,26 @@ enum {
250 RC5T583_EXT_PWRREQ2_CONTROL = 0x2, 250 RC5T583_EXT_PWRREQ2_CONTROL = 0x2,
251}; 251};
252 252
253enum {
254 RC5T583_REGULATOR_DC0,
255 RC5T583_REGULATOR_DC1,
256 RC5T583_REGULATOR_DC2,
257 RC5T583_REGULATOR_DC3,
258 RC5T583_REGULATOR_LDO0,
259 RC5T583_REGULATOR_LDO1,
260 RC5T583_REGULATOR_LDO2,
261 RC5T583_REGULATOR_LDO3,
262 RC5T583_REGULATOR_LDO4,
263 RC5T583_REGULATOR_LDO5,
264 RC5T583_REGULATOR_LDO6,
265 RC5T583_REGULATOR_LDO7,
266 RC5T583_REGULATOR_LDO8,
267 RC5T583_REGULATOR_LDO9,
268
269 /* Should be last entry */
270 RC5T583_REGULATOR_MAX,
271};
272
253struct rc5t583 { 273struct rc5t583 {
254 struct device *dev; 274 struct device *dev;
255 struct regmap *regmap; 275 struct regmap *regmap;
@@ -273,11 +293,20 @@ struct rc5t583 {
273 * The board specific data is provided through this structure. 293 * The board specific data is provided through this structure.
274 * @irq_base: Irq base number on which this device registers their interrupts. 294 * @irq_base: Irq base number on which this device registers their interrupts.
275 * @enable_shutdown: Enable shutdown through the input pin "shutdown". 295 * @enable_shutdown: Enable shutdown through the input pin "shutdown".
296 * @regulator_deepsleep_slot: The slot number on which device goes to sleep
297 * in device sleep mode.
298 * @regulator_ext_pwr_control: External power request regulator control. The
299 * regulator output enable/disable is controlled by the external
300 * power request input state.
301 * @reg_init_data: Regulator init data.
276 */ 302 */
277 303
278struct rc5t583_platform_data { 304struct rc5t583_platform_data {
279 int irq_base; 305 int irq_base;
280 bool enable_shutdown; 306 bool enable_shutdown;
307 int regulator_deepsleep_slot[RC5T583_REGULATOR_MAX];
308 unsigned long regulator_ext_pwr_control[RC5T583_REGULATOR_MAX];
309 struct regulator_init_data *reg_init_data[RC5T583_REGULATOR_MAX];
281}; 310};
282 311
283static inline int rc5t583_write(struct device *dev, uint8_t reg, uint8_t val) 312static inline int rc5t583_write(struct device *dev, uint8_t reg, uint8_t val)
diff --git a/include/linux/mfd/s5m87xx/s5m-core.h b/include/linux/mfd/s5m87xx/s5m-core.h
index a7480b57f92d..21603b42f22f 100644
--- a/include/linux/mfd/s5m87xx/s5m-core.h
+++ b/include/linux/mfd/s5m87xx/s5m-core.h
@@ -335,6 +335,7 @@ extern int s5m_reg_update(struct s5m87xx_dev *s5m87xx, u8 reg, u8 val, u8 mask);
335 335
336struct s5m_platform_data { 336struct s5m_platform_data {
337 struct s5m_regulator_data *regulators; 337 struct s5m_regulator_data *regulators;
338 struct s5m_opmode_data *opmode;
338 int device_type; 339 int device_type;
339 int num_regulators; 340 int num_regulators;
340 341
diff --git a/include/linux/mfd/s5m87xx/s5m-pmic.h b/include/linux/mfd/s5m87xx/s5m-pmic.h
index a72a5d27e62e..7c719f20f58a 100644
--- a/include/linux/mfd/s5m87xx/s5m-pmic.h
+++ b/include/linux/mfd/s5m87xx/s5m-pmic.h
@@ -58,6 +58,8 @@ enum s5m8767_regulators {
58 S5M8767_REG_MAX, 58 S5M8767_REG_MAX,
59}; 59};
60 60
61#define S5M8767_ENCTRL_SHIFT 6
62
61/* S5M8763 regulator ids */ 63/* S5M8763 regulator ids */
62enum s5m8763_regulators { 64enum s5m8763_regulators {
63 S5M8763_LDO1, 65 S5M8763_LDO1,
@@ -97,4 +99,31 @@ struct s5m_regulator_data {
97 struct regulator_init_data *initdata; 99 struct regulator_init_data *initdata;
98}; 100};
99 101
102/*
103 * s5m_opmode_data - regulator operation mode data
104 * @id: regulator id
105 * @mode: regulator operation mode
106 */
107struct s5m_opmode_data {
108 int id;
109 int mode;
110};
111
112/*
113 * s5m regulator operation mode
114 * S5M_OPMODE_OFF Regulator always OFF
115 * S5M_OPMODE_ON Regulator always ON
116 * S5M_OPMODE_LOWPOWER Regulator is on in low-power mode
117 * S5M_OPMODE_SUSPEND Regulator is changed by PWREN pin
118 * If PWREN is high, regulator is on
119 * If PWREN is low, regulator is off
120 */
121
122enum s5m_opmode {
123 S5M_OPMODE_OFF,
124 S5M_OPMODE_ON,
125 S5M_OPMODE_LOWPOWER,
126 S5M_OPMODE_SUSPEND,
127};
128
100#endif /* __LINUX_MFD_S5M_PMIC_H */ 129#endif /* __LINUX_MFD_S5M_PMIC_H */
diff --git a/include/linux/mfd/tps65090.h b/include/linux/mfd/tps65090.h
index 38e31c55adbb..6bc31d854626 100644
--- a/include/linux/mfd/tps65090.h
+++ b/include/linux/mfd/tps65090.h
@@ -22,6 +22,19 @@
22#ifndef __LINUX_MFD_TPS65090_H 22#ifndef __LINUX_MFD_TPS65090_H
23#define __LINUX_MFD_TPS65090_H 23#define __LINUX_MFD_TPS65090_H
24 24
25#include <linux/irq.h>
26
27struct tps65090 {
28 struct mutex lock;
29 struct device *dev;
30 struct i2c_client *client;
31 struct regmap *rmap;
32 struct irq_chip irq_chip;
33 struct mutex irq_lock;
34 int irq_base;
35 unsigned int id;
36};
37
25struct tps65090_subdev_info { 38struct tps65090_subdev_info {
26 int id; 39 int id;
27 const char *name; 40 const char *name;
diff --git a/include/linux/mfd/tps6586x.h b/include/linux/mfd/tps6586x.h
index b19176eab44d..f350fd0ba1df 100644
--- a/include/linux/mfd/tps6586x.h
+++ b/include/linux/mfd/tps6586x.h
@@ -68,6 +68,7 @@ struct tps6586x_subdev_info {
68 int id; 68 int id;
69 const char *name; 69 const char *name;
70 void *platform_data; 70 void *platform_data;
71 struct device_node *of_node;
71}; 72};
72 73
73struct tps6586x_platform_data { 74struct tps6586x_platform_data {
diff --git a/include/linux/mfd/wm831x/pdata.h b/include/linux/mfd/wm831x/pdata.h
index 1d7a3f7b3b5d..dcc9631b3052 100644
--- a/include/linux/mfd/wm831x/pdata.h
+++ b/include/linux/mfd/wm831x/pdata.h
@@ -26,7 +26,7 @@ struct wm831x_backlight_pdata {
26struct wm831x_backup_pdata { 26struct wm831x_backup_pdata {
27 int charger_enable; 27 int charger_enable;
28 int no_constant_voltage; /** Disable constant voltage charging */ 28 int no_constant_voltage; /** Disable constant voltage charging */
29 int vlim; /** Voltage limit in milivolts */ 29 int vlim; /** Voltage limit in millivolts */
30 int ilim; /** Current limit in microamps */ 30 int ilim; /** Current limit in microamps */
31}; 31};
32 32
diff --git a/include/linux/mfd/wm8994/core.h b/include/linux/mfd/wm8994/core.h
index 9eff2a351ec5..6695c3ec4518 100644
--- a/include/linux/mfd/wm8994/core.h
+++ b/include/linux/mfd/wm8994/core.h
@@ -17,6 +17,7 @@
17 17
18#include <linux/mutex.h> 18#include <linux/mutex.h>
19#include <linux/interrupt.h> 19#include <linux/interrupt.h>
20#include <linux/regmap.h>
20 21
21enum wm8994_type { 22enum wm8994_type {
22 WM8994 = 0, 23 WM8994 = 0,
@@ -26,7 +27,6 @@ enum wm8994_type {
26 27
27struct regulator_dev; 28struct regulator_dev;
28struct regulator_bulk_data; 29struct regulator_bulk_data;
29struct regmap;
30 30
31#define WM8994_NUM_GPIO_REGS 11 31#define WM8994_NUM_GPIO_REGS 11
32#define WM8994_NUM_LDO_REGS 2 32#define WM8994_NUM_LDO_REGS 2
@@ -94,17 +94,17 @@ static inline int wm8994_request_irq(struct wm8994 *wm8994, int irq,
94 irq_handler_t handler, const char *name, 94 irq_handler_t handler, const char *name,
95 void *data) 95 void *data)
96{ 96{
97 if (!wm8994->irq_base) 97 if (!wm8994->irq_data)
98 return -EINVAL; 98 return -EINVAL;
99 return request_threaded_irq(wm8994->irq_base + irq, NULL, handler, 99 return request_threaded_irq(regmap_irq_get_virq(wm8994->irq_data, irq),
100 IRQF_TRIGGER_RISING, name, 100 NULL, handler, IRQF_TRIGGER_RISING, name,
101 data); 101 data);
102} 102}
103static inline void wm8994_free_irq(struct wm8994 *wm8994, int irq, void *data) 103static inline void wm8994_free_irq(struct wm8994 *wm8994, int irq, void *data)
104{ 104{
105 if (!wm8994->irq_base) 105 if (!wm8994->irq_data)
106 return; 106 return;
107 free_irq(wm8994->irq_base + irq, data); 107 free_irq(regmap_irq_get_virq(wm8994->irq_data, irq), data);
108} 108}
109 109
110int wm8994_irq_init(struct wm8994 *wm8994); 110int wm8994_irq_init(struct wm8994 *wm8994);
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index 6d028247f79d..6e27fa99e8b9 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -98,6 +98,12 @@ enum {
98 MLX4_DEV_CAP_FLAG_SENSE_SUPPORT = 1LL << 55 98 MLX4_DEV_CAP_FLAG_SENSE_SUPPORT = 1LL << 55
99}; 99};
100 100
101enum {
102 MLX4_DEV_CAP_FLAG2_RSS = 1LL << 0,
103 MLX4_DEV_CAP_FLAG2_RSS_TOP = 1LL << 1,
104 MLX4_DEV_CAP_FLAG2_RSS_XOR = 1LL << 2
105};
106
101#define MLX4_ATTR_EXTENDED_PORT_INFO cpu_to_be16(0xff90) 107#define MLX4_ATTR_EXTENDED_PORT_INFO cpu_to_be16(0xff90)
102 108
103enum { 109enum {
@@ -292,11 +298,13 @@ struct mlx4_caps {
292 u32 max_msg_sz; 298 u32 max_msg_sz;
293 u32 page_size_cap; 299 u32 page_size_cap;
294 u64 flags; 300 u64 flags;
301 u64 flags2;
295 u32 bmme_flags; 302 u32 bmme_flags;
296 u32 reserved_lkey; 303 u32 reserved_lkey;
297 u16 stat_rate_support; 304 u16 stat_rate_support;
298 u8 port_width_cap[MLX4_MAX_PORTS + 1]; 305 u8 port_width_cap[MLX4_MAX_PORTS + 1];
299 int max_gso_sz; 306 int max_gso_sz;
307 int max_rss_tbl_sz;
300 int reserved_qps_cnt[MLX4_NUM_QP_REGION]; 308 int reserved_qps_cnt[MLX4_NUM_QP_REGION];
301 int reserved_qps; 309 int reserved_qps;
302 int reserved_qps_base[MLX4_NUM_QP_REGION]; 310 int reserved_qps_base[MLX4_NUM_QP_REGION];
diff --git a/include/linux/mlx4/qp.h b/include/linux/mlx4/qp.h
index 96005d75893c..338388ba260a 100644
--- a/include/linux/mlx4/qp.h
+++ b/include/linux/mlx4/qp.h
@@ -234,7 +234,8 @@ struct mlx4_wqe_mlx_seg {
234 u8 owner; 234 u8 owner;
235 u8 reserved1[2]; 235 u8 reserved1[2];
236 u8 opcode; 236 u8 opcode;
237 u8 reserved2[3]; 237 __be16 sched_prio;
238 u8 reserved2;
238 u8 size; 239 u8 size;
239 /* 240 /*
240 * [17] VL15 241 * [17] VL15
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 74aa71bea1e4..7d5c37f24c63 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -896,10 +896,8 @@ int zap_vma_ptes(struct vm_area_struct *vma, unsigned long address,
896 unsigned long size); 896 unsigned long size);
897void zap_page_range(struct vm_area_struct *vma, unsigned long address, 897void zap_page_range(struct vm_area_struct *vma, unsigned long address,
898 unsigned long size, struct zap_details *); 898 unsigned long size, struct zap_details *);
899void unmap_vmas(struct mmu_gather *tlb, 899void unmap_vmas(struct mmu_gather *tlb, struct vm_area_struct *start_vma,
900 struct vm_area_struct *start_vma, unsigned long start_addr, 900 unsigned long start, unsigned long end);
901 unsigned long end_addr, unsigned long *nr_accounted,
902 struct zap_details *);
903 901
904/** 902/**
905 * mm_walk - callbacks for walk_page_range 903 * mm_walk - callbacks for walk_page_range
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index dff711509661..41aa49b74821 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -30,7 +30,7 @@
30/* 30/*
31 * PAGE_ALLOC_COSTLY_ORDER is the order at which allocations are deemed 31 * PAGE_ALLOC_COSTLY_ORDER is the order at which allocations are deemed
32 * costly to service. That is between allocation orders which should 32 * costly to service. That is between allocation orders which should
33 * coelesce naturally under reasonable reclaim pressure and those which 33 * coalesce naturally under reasonable reclaim pressure and those which
34 * will not. 34 * will not.
35 */ 35 */
36#define PAGE_ALLOC_COSTLY_ORDER 3 36#define PAGE_ALLOC_COSTLY_ORDER 3
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index 501da4cb8a6d..5db93821f9c7 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -132,10 +132,12 @@ struct usb_device_id {
132#define USB_DEVICE_ID_MATCH_INT_PROTOCOL 0x0200 132#define USB_DEVICE_ID_MATCH_INT_PROTOCOL 0x0200
133 133
134#define HID_ANY_ID (~0) 134#define HID_ANY_ID (~0)
135#define HID_BUS_ANY 0xffff
136#define HID_GROUP_ANY 0x0000
135 137
136struct hid_device_id { 138struct hid_device_id {
137 __u16 bus; 139 __u16 bus;
138 __u16 pad1; 140 __u16 group;
139 __u32 vendor; 141 __u32 vendor;
140 __u32 product; 142 __u32 product;
141 kernel_ulong_t driver_data 143 kernel_ulong_t driver_data
diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h
index ea36486378d8..1b14d25162cb 100644
--- a/include/linux/moduleparam.h
+++ b/include/linux/moduleparam.h
@@ -320,7 +320,8 @@ extern int parse_args(const char *name,
320 unsigned num, 320 unsigned num,
321 s16 level_min, 321 s16 level_min,
322 s16 level_max, 322 s16 level_max,
323 int (*unknown)(char *param, char *val)); 323 int (*unknown)(char *param, char *val,
324 const char *doing));
324 325
325/* Called by module remove. */ 326/* Called by module remove. */
326#ifdef CONFIG_SYSFS 327#ifdef CONFIG_SYSFS
diff --git a/include/linux/mtd/ubi.h b/include/linux/mtd/ubi.h
index db4836bed514..c3918a0684fe 100644
--- a/include/linux/mtd/ubi.h
+++ b/include/linux/mtd/ubi.h
@@ -25,6 +25,9 @@
25#include <linux/types.h> 25#include <linux/types.h>
26#include <mtd/ubi-user.h> 26#include <mtd/ubi-user.h>
27 27
28/* All voumes/LEBs */
29#define UBI_ALL -1
30
28/* 31/*
29 * enum ubi_open_mode - UBI volume open mode constants. 32 * enum ubi_open_mode - UBI volume open mode constants.
30 * 33 *
@@ -208,14 +211,15 @@ void ubi_close_volume(struct ubi_volume_desc *desc);
208int ubi_leb_read(struct ubi_volume_desc *desc, int lnum, char *buf, int offset, 211int ubi_leb_read(struct ubi_volume_desc *desc, int lnum, char *buf, int offset,
209 int len, int check); 212 int len, int check);
210int ubi_leb_write(struct ubi_volume_desc *desc, int lnum, const void *buf, 213int ubi_leb_write(struct ubi_volume_desc *desc, int lnum, const void *buf,
211 int offset, int len, int dtype); 214 int offset, int len);
212int ubi_leb_change(struct ubi_volume_desc *desc, int lnum, const void *buf, 215int ubi_leb_change(struct ubi_volume_desc *desc, int lnum, const void *buf,
213 int len, int dtype); 216 int len);
214int ubi_leb_erase(struct ubi_volume_desc *desc, int lnum); 217int ubi_leb_erase(struct ubi_volume_desc *desc, int lnum);
215int ubi_leb_unmap(struct ubi_volume_desc *desc, int lnum); 218int ubi_leb_unmap(struct ubi_volume_desc *desc, int lnum);
216int ubi_leb_map(struct ubi_volume_desc *desc, int lnum, int dtype); 219int ubi_leb_map(struct ubi_volume_desc *desc, int lnum);
217int ubi_is_mapped(struct ubi_volume_desc *desc, int lnum); 220int ubi_is_mapped(struct ubi_volume_desc *desc, int lnum);
218int ubi_sync(int ubi_num); 221int ubi_sync(int ubi_num);
222int ubi_flush(int ubi_num, int vol_id, int lnum);
219 223
220/* 224/*
221 * This function is the same as the 'ubi_leb_read()' function, but it does not 225 * This function is the same as the 'ubi_leb_read()' function, but it does not
@@ -226,25 +230,4 @@ static inline int ubi_read(struct ubi_volume_desc *desc, int lnum, char *buf,
226{ 230{
227 return ubi_leb_read(desc, lnum, buf, offset, len, 0); 231 return ubi_leb_read(desc, lnum, buf, offset, len, 0);
228} 232}
229
230/*
231 * This function is the same as the 'ubi_leb_write()' functions, but it does
232 * not have the data type argument.
233 */
234static inline int ubi_write(struct ubi_volume_desc *desc, int lnum,
235 const void *buf, int offset, int len)
236{
237 return ubi_leb_write(desc, lnum, buf, offset, len, UBI_UNKNOWN);
238}
239
240/*
241 * This function is the same as the 'ubi_leb_change()' functions, but it does
242 * not have the data type argument.
243 */
244static inline int ubi_change(struct ubi_volume_desc *desc, int lnum,
245 const void *buf, int len)
246{
247 return ubi_leb_change(desc, lnum, buf, len, UBI_UNKNOWN);
248}
249
250#endif /* !__LINUX_UBI_H__ */ 233#endif /* !__LINUX_UBI_H__ */
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index b0f6f22723c3..e7fd468f7126 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1155,7 +1155,6 @@ struct net_device {
1155 struct in_device __rcu *ip_ptr; /* IPv4 specific data */ 1155 struct in_device __rcu *ip_ptr; /* IPv4 specific data */
1156 struct dn_dev __rcu *dn_ptr; /* DECnet specific data */ 1156 struct dn_dev __rcu *dn_ptr; /* DECnet specific data */
1157 struct inet6_dev __rcu *ip6_ptr; /* IPv6 specific data */ 1157 struct inet6_dev __rcu *ip6_ptr; /* IPv6 specific data */
1158 void *ec_ptr; /* Econet specific data */
1159 void *ax25_ptr; /* AX.25 specific data */ 1158 void *ax25_ptr; /* AX.25 specific data */
1160 struct wireless_dev *ieee80211_ptr; /* IEEE 802.11 specific data, 1159 struct wireless_dev *ieee80211_ptr; /* IEEE 802.11 specific data,
1161 assign before registering */ 1160 assign before registering */
@@ -2143,7 +2142,6 @@ extern struct sk_buff * napi_get_frags(struct napi_struct *napi);
2143extern gro_result_t napi_frags_finish(struct napi_struct *napi, 2142extern gro_result_t napi_frags_finish(struct napi_struct *napi,
2144 struct sk_buff *skb, 2143 struct sk_buff *skb,
2145 gro_result_t ret); 2144 gro_result_t ret);
2146extern struct sk_buff * napi_frags_skb(struct napi_struct *napi);
2147extern gro_result_t napi_gro_frags(struct napi_struct *napi); 2145extern gro_result_t napi_gro_frags(struct napi_struct *napi);
2148 2146
2149static inline void napi_free_frags(struct napi_struct *napi) 2147static inline void napi_free_frags(struct napi_struct *napi)
diff --git a/include/linux/of.h b/include/linux/of.h
index fa7fb1d97458..2ec1083af7ff 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -193,6 +193,17 @@ extern struct device_node *of_get_next_child(const struct device_node *node,
193 for (child = of_get_next_child(parent, NULL); child != NULL; \ 193 for (child = of_get_next_child(parent, NULL); child != NULL; \
194 child = of_get_next_child(parent, child)) 194 child = of_get_next_child(parent, child))
195 195
196static inline int of_get_child_count(const struct device_node *np)
197{
198 struct device_node *child;
199 int num = 0;
200
201 for_each_child_of_node(np, child)
202 num++;
203
204 return num;
205}
206
196extern struct device_node *of_find_node_with_property( 207extern struct device_node *of_find_node_with_property(
197 struct device_node *from, const char *prop_name); 208 struct device_node *from, const char *prop_name);
198#define for_each_node_with_property(dn, prop_name) \ 209#define for_each_node_with_property(dn, prop_name) \
@@ -259,6 +270,37 @@ extern void of_detach_node(struct device_node *);
259#endif 270#endif
260 271
261#define of_match_ptr(_ptr) (_ptr) 272#define of_match_ptr(_ptr) (_ptr)
273
274/*
275 * struct property *prop;
276 * const __be32 *p;
277 * u32 u;
278 *
279 * of_property_for_each_u32(np, "propname", prop, p, u)
280 * printk("U32 value: %x\n", u);
281 */
282const __be32 *of_prop_next_u32(struct property *prop, const __be32 *cur,
283 u32 *pu);
284#define of_property_for_each_u32(np, propname, prop, p, u) \
285 for (prop = of_find_property(np, propname, NULL), \
286 p = of_prop_next_u32(prop, NULL, &u); \
287 p; \
288 p = of_prop_next_u32(prop, p, &u))
289
290/*
291 * struct property *prop;
292 * const char *s;
293 *
294 * of_property_for_each_string(np, "propname", prop, s)
295 * printk("String value: %s\n", s);
296 */
297const char *of_prop_next_string(struct property *prop, const char *cur);
298#define of_property_for_each_string(np, propname, prop, s) \
299 for (prop = of_find_property(np, propname, NULL), \
300 s = of_prop_next_string(prop, NULL); \
301 s; \
302 s = of_prop_next_string(prop, s))
303
262#else /* CONFIG_OF */ 304#else /* CONFIG_OF */
263 305
264static inline bool of_have_populated_dt(void) 306static inline bool of_have_populated_dt(void)
@@ -269,6 +311,11 @@ static inline bool of_have_populated_dt(void)
269#define for_each_child_of_node(parent, child) \ 311#define for_each_child_of_node(parent, child) \
270 while (0) 312 while (0)
271 313
314static inline int of_get_child_count(const struct device_node *np)
315{
316 return 0;
317}
318
272static inline int of_device_is_compatible(const struct device_node *device, 319static inline int of_device_is_compatible(const struct device_node *device,
273 const char *name) 320 const char *name)
274{ 321{
@@ -349,6 +396,10 @@ static inline int of_machine_is_compatible(const char *compat)
349 396
350#define of_match_ptr(_ptr) NULL 397#define of_match_ptr(_ptr) NULL
351#define of_match_node(_matches, _node) NULL 398#define of_match_node(_matches, _node) NULL
399#define of_property_for_each_u32(np, propname, prop, p, u) \
400 while (0)
401#define of_property_for_each_string(np, propname, prop, s) \
402 while (0)
352#endif /* CONFIG_OF */ 403#endif /* CONFIG_OF */
353 404
354/** 405/**
diff --git a/include/linux/of_serial.h b/include/linux/of_serial.h
new file mode 100644
index 000000000000..4a73ed80b4c0
--- /dev/null
+++ b/include/linux/of_serial.h
@@ -0,0 +1,17 @@
1#ifndef __LINUX_OF_SERIAL_H
2#define __LINUX_OF_SERIAL_H
3
4/*
5 * FIXME remove this file when tegra finishes conversion to open firmware,
6 * expectation is that all quirks will then be self-contained in
7 * drivers/tty/serial/of_serial.c.
8 */
9#ifdef CONFIG_ARCH_TEGRA
10extern void tegra_serial_handle_break(struct uart_port *port);
11#else
12static inline void tegra_serial_handle_break(struct uart_port *port)
13{
14}
15#endif
16
17#endif /* __LINUX_OF_SERIAL */
diff --git a/include/linux/pci.h b/include/linux/pci.h
index e444f5b49118..17b7b5b01b4a 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -375,11 +375,18 @@ struct pci_host_bridge_window {
375}; 375};
376 376
377struct pci_host_bridge { 377struct pci_host_bridge {
378 struct list_head list; 378 struct device dev;
379 struct pci_bus *bus; /* root bus */ 379 struct pci_bus *bus; /* root bus */
380 struct list_head windows; /* pci_host_bridge_windows */ 380 struct list_head windows; /* pci_host_bridge_windows */
381 void (*release_fn)(struct pci_host_bridge *);
382 void *release_data;
381}; 383};
382 384
385#define to_pci_host_bridge(n) container_of(n, struct pci_host_bridge, dev)
386void pci_set_host_bridge_release(struct pci_host_bridge *bridge,
387 void (*release_fn)(struct pci_host_bridge *),
388 void *release_data);
389
383/* 390/*
384 * The first PCI_BRIDGE_RESOURCE_NUM PCI bus resources (those that correspond 391 * The first PCI_BRIDGE_RESOURCE_NUM PCI bus resources (those that correspond
385 * to P2P or CardBus bridge windows) go in a table. Additional ones (for 392 * to P2P or CardBus bridge windows) go in a table. Additional ones (for
diff --git a/include/linux/percpu.h b/include/linux/percpu.h
index 21638ae14e07..2b9f82c037c9 100644
--- a/include/linux/percpu.h
+++ b/include/linux/percpu.h
@@ -166,60 +166,6 @@ extern phys_addr_t per_cpu_ptr_to_phys(void *addr);
166 (typeof(type) __percpu *)__alloc_percpu(sizeof(type), __alignof__(type)) 166 (typeof(type) __percpu *)__alloc_percpu(sizeof(type), __alignof__(type))
167 167
168/* 168/*
169 * Optional methods for optimized non-lvalue per-cpu variable access.
170 *
171 * @var can be a percpu variable or a field of it and its size should
172 * equal char, int or long. percpu_read() evaluates to a lvalue and
173 * all others to void.
174 *
175 * These operations are guaranteed to be atomic.
176 * The generic versions disable interrupts. Archs are
177 * encouraged to implement single-instruction alternatives which don't
178 * require protection.
179 */
180#ifndef percpu_read
181# define percpu_read(var) \
182 ({ \
183 typeof(var) *pr_ptr__ = &(var); \
184 typeof(var) pr_ret__; \
185 pr_ret__ = get_cpu_var(*pr_ptr__); \
186 put_cpu_var(*pr_ptr__); \
187 pr_ret__; \
188 })
189#endif
190
191#define __percpu_generic_to_op(var, val, op) \
192do { \
193 typeof(var) *pgto_ptr__ = &(var); \
194 get_cpu_var(*pgto_ptr__) op val; \
195 put_cpu_var(*pgto_ptr__); \
196} while (0)
197
198#ifndef percpu_write
199# define percpu_write(var, val) __percpu_generic_to_op(var, (val), =)
200#endif
201
202#ifndef percpu_add
203# define percpu_add(var, val) __percpu_generic_to_op(var, (val), +=)
204#endif
205
206#ifndef percpu_sub
207# define percpu_sub(var, val) __percpu_generic_to_op(var, (val), -=)
208#endif
209
210#ifndef percpu_and
211# define percpu_and(var, val) __percpu_generic_to_op(var, (val), &=)
212#endif
213
214#ifndef percpu_or
215# define percpu_or(var, val) __percpu_generic_to_op(var, (val), |=)
216#endif
217
218#ifndef percpu_xor
219# define percpu_xor(var, val) __percpu_generic_to_op(var, (val), ^=)
220#endif
221
222/*
223 * Branching function to split up a function into a set of functions that 169 * Branching function to split up a function into a set of functions that
224 * are called for different scalar sizes of the objects handled. 170 * are called for different scalar sizes of the objects handled.
225 */ 171 */
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index ddbb6a901f65..f32578634d9d 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -1132,11 +1132,14 @@ struct perf_sample_data {
1132 struct perf_branch_stack *br_stack; 1132 struct perf_branch_stack *br_stack;
1133}; 1133};
1134 1134
1135static inline void perf_sample_data_init(struct perf_sample_data *data, u64 addr) 1135static inline void perf_sample_data_init(struct perf_sample_data *data,
1136 u64 addr, u64 period)
1136{ 1137{
1138 /* remaining struct members initialized in perf_prepare_sample() */
1137 data->addr = addr; 1139 data->addr = addr;
1138 data->raw = NULL; 1140 data->raw = NULL;
1139 data->br_stack = NULL; 1141 data->br_stack = NULL;
1142 data->period = period;
1140} 1143}
1141 1144
1142extern void perf_output_sample(struct perf_output_handle *handle, 1145extern void perf_output_sample(struct perf_output_handle *handle,
diff --git a/include/linux/pinctrl/consumer.h b/include/linux/pinctrl/consumer.h
index 191e72688481..6dd96fb45482 100644
--- a/include/linux/pinctrl/consumer.h
+++ b/include/linux/pinctrl/consumer.h
@@ -36,6 +36,9 @@ extern struct pinctrl_state * __must_check pinctrl_lookup_state(
36 const char *name); 36 const char *name);
37extern int pinctrl_select_state(struct pinctrl *p, struct pinctrl_state *s); 37extern int pinctrl_select_state(struct pinctrl *p, struct pinctrl_state *s);
38 38
39extern struct pinctrl * __must_check devm_pinctrl_get(struct device *dev);
40extern void devm_pinctrl_put(struct pinctrl *p);
41
39#else /* !CONFIG_PINCTRL */ 42#else /* !CONFIG_PINCTRL */
40 43
41static inline int pinctrl_request_gpio(unsigned gpio) 44static inline int pinctrl_request_gpio(unsigned gpio)
@@ -79,6 +82,15 @@ static inline int pinctrl_select_state(struct pinctrl *p,
79 return 0; 82 return 0;
80} 83}
81 84
85static inline struct pinctrl * __must_check devm_pinctrl_get(struct device *dev)
86{
87 return NULL;
88}
89
90static inline void devm_pinctrl_put(struct pinctrl *p)
91{
92}
93
82#endif /* CONFIG_PINCTRL */ 94#endif /* CONFIG_PINCTRL */
83 95
84static inline struct pinctrl * __must_check pinctrl_get_select( 96static inline struct pinctrl * __must_check pinctrl_get_select(
@@ -113,6 +125,38 @@ static inline struct pinctrl * __must_check pinctrl_get_select_default(
113 return pinctrl_get_select(dev, PINCTRL_STATE_DEFAULT); 125 return pinctrl_get_select(dev, PINCTRL_STATE_DEFAULT);
114} 126}
115 127
128static inline struct pinctrl * __must_check devm_pinctrl_get_select(
129 struct device *dev, const char *name)
130{
131 struct pinctrl *p;
132 struct pinctrl_state *s;
133 int ret;
134
135 p = devm_pinctrl_get(dev);
136 if (IS_ERR(p))
137 return p;
138
139 s = pinctrl_lookup_state(p, name);
140 if (IS_ERR(s)) {
141 devm_pinctrl_put(p);
142 return ERR_PTR(PTR_ERR(s));
143 }
144
145 ret = pinctrl_select_state(p, s);
146 if (ret < 0) {
147 devm_pinctrl_put(p);
148 return ERR_PTR(ret);
149 }
150
151 return p;
152}
153
154static inline struct pinctrl * __must_check devm_pinctrl_get_select_default(
155 struct device *dev)
156{
157 return devm_pinctrl_get_select(dev, PINCTRL_STATE_DEFAULT);
158}
159
116#ifdef CONFIG_PINCONF 160#ifdef CONFIG_PINCONF
117 161
118extern int pin_config_get(const char *dev_name, const char *name, 162extern int pin_config_get(const char *dev_name, const char *name,
diff --git a/include/linux/pinctrl/machine.h b/include/linux/pinctrl/machine.h
index e4d1de742502..7d22ab00343f 100644
--- a/include/linux/pinctrl/machine.h
+++ b/include/linux/pinctrl/machine.h
@@ -154,7 +154,7 @@ struct pinctrl_map {
154 154
155extern int pinctrl_register_mappings(struct pinctrl_map const *map, 155extern int pinctrl_register_mappings(struct pinctrl_map const *map,
156 unsigned num_maps); 156 unsigned num_maps);
157 157extern void pinctrl_provide_dummies(void);
158#else 158#else
159 159
160static inline int pinctrl_register_mappings(struct pinctrl_map const *map, 160static inline int pinctrl_register_mappings(struct pinctrl_map const *map,
@@ -163,5 +163,8 @@ static inline int pinctrl_register_mappings(struct pinctrl_map const *map,
163 return 0; 163 return 0;
164} 164}
165 165
166#endif /* !CONFIG_PINMUX */ 166static inline void pinctrl_provide_dummies(void)
167{
168}
169#endif /* !CONFIG_PINCTRL */
167#endif 170#endif
diff --git a/include/linux/pinctrl/pinconf.h b/include/linux/pinctrl/pinconf.h
index ec431f03362d..e7a720104a47 100644
--- a/include/linux/pinctrl/pinconf.h
+++ b/include/linux/pinctrl/pinconf.h
@@ -25,7 +25,6 @@ struct seq_file;
25 * @pin_config_get: get the config of a certain pin, if the requested config 25 * @pin_config_get: get the config of a certain pin, if the requested config
26 * is not available on this controller this should return -ENOTSUPP 26 * is not available on this controller this should return -ENOTSUPP
27 * and if it is available but disabled it should return -EINVAL 27 * and if it is available but disabled it should return -EINVAL
28 * @pin_config_get: get the config of a certain pin
29 * @pin_config_set: configure an individual pin 28 * @pin_config_set: configure an individual pin
30 * @pin_config_group_get: get configurations for an entire pin group 29 * @pin_config_group_get: get configurations for an entire pin group
31 * @pin_config_group_set: configure all pins in a group 30 * @pin_config_group_set: configure all pins in a group
@@ -33,6 +32,8 @@ struct seq_file;
33 * per-device info for a certain pin in debugfs 32 * per-device info for a certain pin in debugfs
34 * @pin_config_group_dbg_show: optional debugfs display hook that will provide 33 * @pin_config_group_dbg_show: optional debugfs display hook that will provide
35 * per-device info for a certain group in debugfs 34 * per-device info for a certain group in debugfs
35 * @pin_config_config_dbg_show: optional debugfs display hook that will decode
36 * and display a driver's pin configuration parameter
36 */ 37 */
37struct pinconf_ops { 38struct pinconf_ops {
38#ifdef CONFIG_GENERIC_PINCONF 39#ifdef CONFIG_GENERIC_PINCONF
@@ -56,6 +57,9 @@ struct pinconf_ops {
56 void (*pin_config_group_dbg_show) (struct pinctrl_dev *pctldev, 57 void (*pin_config_group_dbg_show) (struct pinctrl_dev *pctldev,
57 struct seq_file *s, 58 struct seq_file *s,
58 unsigned selector); 59 unsigned selector);
60 void (*pin_config_config_dbg_show) (struct pinctrl_dev *pctldev,
61 struct seq_file *s,
62 unsigned long config);
59}; 63};
60 64
61#endif 65#endif
diff --git a/include/linux/pinctrl/pinctrl-state.h b/include/linux/pinctrl/pinctrl-state.h
index 3920e28b4da7..634608dc6c89 100644
--- a/include/linux/pinctrl/pinctrl-state.h
+++ b/include/linux/pinctrl/pinctrl-state.h
@@ -2,5 +2,18 @@
2 * Standard pin control state definitions 2 * Standard pin control state definitions
3 */ 3 */
4 4
5/**
6 * @PINCTRL_STATE_DEFAULT: the state the pinctrl handle shall be put
7 * into as default, usually this means the pins are up and ready to
8 * be used by the device driver. This state is commonly used by
9 * hogs to configure muxing and pins at boot.
10 * @PINCTRL_STATE_IDLE: the state the pinctrl handle shall be put into
11 * when the pins are idle. Could typically be set from a
12 * pm_runtime_suspend() operation.
13 * @PINCTRL_STATE_SLEEP: the state the pinctrl handle shall be put into
14 * when the pins are sleeping. Could typically be set from a
15 * common suspend() function.
16 */
5#define PINCTRL_STATE_DEFAULT "default" 17#define PINCTRL_STATE_DEFAULT "default"
6#define PINCTRL_STATE_IDLE "idle" 18#define PINCTRL_STATE_IDLE "idle"
19#define PINCTRL_STATE_SLEEP "sleep"
diff --git a/include/linux/pinctrl/pinctrl.h b/include/linux/pinctrl/pinctrl.h
index 4e9f0788c221..3b894a668d32 100644
--- a/include/linux/pinctrl/pinctrl.h
+++ b/include/linux/pinctrl/pinctrl.h
@@ -21,9 +21,11 @@
21 21
22struct device; 22struct device;
23struct pinctrl_dev; 23struct pinctrl_dev;
24struct pinctrl_map;
24struct pinmux_ops; 25struct pinmux_ops;
25struct pinconf_ops; 26struct pinconf_ops;
26struct gpio_chip; 27struct gpio_chip;
28struct device_node;
27 29
28/** 30/**
29 * struct pinctrl_pin_desc - boards/machines provide information on their 31 * struct pinctrl_pin_desc - boards/machines provide information on their
@@ -64,17 +66,24 @@ struct pinctrl_gpio_range {
64/** 66/**
65 * struct pinctrl_ops - global pin control operations, to be implemented by 67 * struct pinctrl_ops - global pin control operations, to be implemented by
66 * pin controller drivers. 68 * pin controller drivers.
67 * @list_groups: list the number of selectable named groups available 69 * @get_groups_count: Returns the count of total number of groups registered.
68 * in this pinmux driver, the core will begin on 0 and call this
69 * repeatedly as long as it returns >= 0 to enumerate the groups
70 * @get_group_name: return the group name of the pin group 70 * @get_group_name: return the group name of the pin group
71 * @get_group_pins: return an array of pins corresponding to a certain 71 * @get_group_pins: return an array of pins corresponding to a certain
72 * group selector @pins, and the size of the array in @num_pins 72 * group selector @pins, and the size of the array in @num_pins
73 * @pin_dbg_show: optional debugfs display hook that will provide per-device 73 * @pin_dbg_show: optional debugfs display hook that will provide per-device
74 * info for a certain pin in debugfs 74 * info for a certain pin in debugfs
75 * @dt_node_to_map: parse a device tree "pin configuration node", and create
76 * mapping table entries for it. These are returned through the @map and
77 * @num_maps output parameters. This function is optional, and may be
78 * omitted for pinctrl drivers that do not support device tree.
79 * @dt_free_map: free mapping table entries created via @dt_node_to_map. The
80 * top-level @map pointer must be freed, along with any dynamically
81 * allocated members of the mapping table entries themselves. This
82 * function is optional, and may be omitted for pinctrl drivers that do
83 * not support device tree.
75 */ 84 */
76struct pinctrl_ops { 85struct pinctrl_ops {
77 int (*list_groups) (struct pinctrl_dev *pctldev, unsigned selector); 86 int (*get_groups_count) (struct pinctrl_dev *pctldev);
78 const char *(*get_group_name) (struct pinctrl_dev *pctldev, 87 const char *(*get_group_name) (struct pinctrl_dev *pctldev,
79 unsigned selector); 88 unsigned selector);
80 int (*get_group_pins) (struct pinctrl_dev *pctldev, 89 int (*get_group_pins) (struct pinctrl_dev *pctldev,
@@ -83,6 +92,11 @@ struct pinctrl_ops {
83 unsigned *num_pins); 92 unsigned *num_pins);
84 void (*pin_dbg_show) (struct pinctrl_dev *pctldev, struct seq_file *s, 93 void (*pin_dbg_show) (struct pinctrl_dev *pctldev, struct seq_file *s,
85 unsigned offset); 94 unsigned offset);
95 int (*dt_node_to_map) (struct pinctrl_dev *pctldev,
96 struct device_node *np_config,
97 struct pinctrl_map **map, unsigned *num_maps);
98 void (*dt_free_map) (struct pinctrl_dev *pctldev,
99 struct pinctrl_map *map, unsigned num_maps);
86}; 100};
87 101
88/** 102/**
diff --git a/include/linux/pinctrl/pinmux.h b/include/linux/pinctrl/pinmux.h
index 47e9237edd47..1818dcbdd9ab 100644
--- a/include/linux/pinctrl/pinmux.h
+++ b/include/linux/pinctrl/pinmux.h
@@ -23,15 +23,14 @@ struct pinctrl_dev;
23/** 23/**
24 * struct pinmux_ops - pinmux operations, to be implemented by pin controller 24 * struct pinmux_ops - pinmux operations, to be implemented by pin controller
25 * drivers that support pinmuxing 25 * drivers that support pinmuxing
26 * @request: called by the core to see if a certain pin can be made available 26 * @request: called by the core to see if a certain pin can be made
27 * available for muxing. This is called by the core to acquire the pins 27 * available for muxing. This is called by the core to acquire the pins
28 * before selecting any actual mux setting across a function. The driver 28 * before selecting any actual mux setting across a function. The driver
29 * is allowed to answer "no" by returning a negative error code 29 * is allowed to answer "no" by returning a negative error code
30 * @free: the reverse function of the request() callback, frees a pin after 30 * @free: the reverse function of the request() callback, frees a pin after
31 * being requested 31 * being requested
32 * @list_functions: list the number of selectable named functions available 32 * @get_functions_count: returns number of selectable named functions available
33 * in this pinmux driver, the core will begin on 0 and call this 33 * in this pinmux driver
34 * repeatedly as long as it returns >= 0 to enumerate mux settings
35 * @get_function_name: return the function name of the muxing selector, 34 * @get_function_name: return the function name of the muxing selector,
36 * called by the core to figure out which mux setting it shall map a 35 * called by the core to figure out which mux setting it shall map a
37 * certain device to 36 * certain device to
@@ -62,7 +61,7 @@ struct pinctrl_dev;
62struct pinmux_ops { 61struct pinmux_ops {
63 int (*request) (struct pinctrl_dev *pctldev, unsigned offset); 62 int (*request) (struct pinctrl_dev *pctldev, unsigned offset);
64 int (*free) (struct pinctrl_dev *pctldev, unsigned offset); 63 int (*free) (struct pinctrl_dev *pctldev, unsigned offset);
65 int (*list_functions) (struct pinctrl_dev *pctldev, unsigned selector); 64 int (*get_functions_count) (struct pinctrl_dev *pctldev);
66 const char *(*get_function_name) (struct pinctrl_dev *pctldev, 65 const char *(*get_function_name) (struct pinctrl_dev *pctldev,
67 unsigned selector); 66 unsigned selector);
68 int (*get_function_groups) (struct pinctrl_dev *pctldev, 67 int (*get_function_groups) (struct pinctrl_dev *pctldev,
diff --git a/include/linux/platform_data/at91_adc.h b/include/linux/platform_data/at91_adc.h
new file mode 100644
index 000000000000..e15745b4f3a5
--- /dev/null
+++ b/include/linux/platform_data/at91_adc.h
@@ -0,0 +1,61 @@
1/*
2 * Copyright (C) 2011 Free Electrons
3 *
4 * Licensed under the GPLv2 or later.
5 */
6
7#ifndef _AT91_ADC_H_
8#define _AT91_ADC_H_
9
10/**
11 * struct at91_adc_reg_desc - Various informations relative to registers
12 * @channel_base: Base offset for the channel data registers
13 * @drdy_mask: Mask of the DRDY field in the relevant registers
14 (Interruptions registers mostly)
15 * @status_register: Offset of the Interrupt Status Register
16 * @trigger_register: Offset of the Trigger setup register
17 */
18struct at91_adc_reg_desc {
19 u8 channel_base;
20 u32 drdy_mask;
21 u8 status_register;
22 u8 trigger_register;
23};
24
25/**
26 * struct at91_adc_trigger - description of triggers
27 * @name: name of the trigger advertised to the user
28 * @value: value to set in the ADC's trigger setup register
29 to enable the trigger
30 * @is_external: Does the trigger rely on an external pin?
31 */
32struct at91_adc_trigger {
33 const char *name;
34 u8 value;
35 bool is_external;
36};
37
38/**
39 * struct at91_adc_data - platform data for ADC driver
40 * @channels_used: channels in use on the board as a bitmask
41 * @num_channels: global number of channels available on the board
42 * @registers: Registers definition on the board
43 * @startup_time: startup time of the ADC in microseconds
44 * @trigger_list: Triggers available in the ADC
45 * @trigger_number: Number of triggers available in the ADC
46 * @use_external_triggers: does the board has external triggers availables
47 * @vref: Reference voltage for the ADC in millivolts
48 */
49struct at91_adc_data {
50 unsigned long channels_used;
51 u8 num_channels;
52 struct at91_adc_reg_desc *registers;
53 u8 startup_time;
54 struct at91_adc_trigger *trigger_list;
55 u8 trigger_number;
56 bool use_external_triggers;
57 u16 vref;
58};
59
60extern void __init at91_add_device_adc(struct at91_adc_data *data);
61#endif
diff --git a/include/linux/platform_data/ehci-sh.h b/include/linux/platform_data/ehci-sh.h
new file mode 100644
index 000000000000..5c15a738e116
--- /dev/null
+++ b/include/linux/platform_data/ehci-sh.h
@@ -0,0 +1,28 @@
1/*
2 * EHCI SuperH driver platform data
3 *
4 * Copyright (C) 2012 Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
5 * Copyright (C) 2012 Renesas Solutions Corp.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21#ifndef __USB_EHCI_SH_H
22#define __USB_EHCI_SH_H
23
24struct ehci_sh_platdata {
25 void (*phy_init)(void); /* Phy init function */
26};
27
28#endif /* __USB_EHCI_SH_H */
diff --git a/include/linux/platform_data/emif_plat.h b/include/linux/platform_data/emif_plat.h
new file mode 100644
index 000000000000..03378ca84061
--- /dev/null
+++ b/include/linux/platform_data/emif_plat.h
@@ -0,0 +1,128 @@
1/*
2 * Definitions for TI EMIF device platform data
3 *
4 * Copyright (C) 2012 Texas Instruments, Inc.
5 *
6 * Aneesh V <aneesh@ti.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12#ifndef __EMIF_PLAT_H
13#define __EMIF_PLAT_H
14
15/* Low power modes - EMIF_PWR_MGMT_CTRL */
16#define EMIF_LP_MODE_DISABLE 0
17#define EMIF_LP_MODE_CLOCK_STOP 1
18#define EMIF_LP_MODE_SELF_REFRESH 2
19#define EMIF_LP_MODE_PWR_DN 4
20
21/* Hardware capabilities */
22#define EMIF_HW_CAPS_LL_INTERFACE 0x00000001
23
24/*
25 * EMIF IP Revisions
26 * EMIF4D - Used in OMAP4
27 * EMIF4D5 - Used in OMAP5
28 */
29#define EMIF_4D 1
30#define EMIF_4D5 2
31
32/*
33 * PHY types
34 * ATTILAPHY - Used in OMAP4
35 * INTELLIPHY - Used in OMAP5
36 */
37#define EMIF_PHY_TYPE_ATTILAPHY 1
38#define EMIF_PHY_TYPE_INTELLIPHY 2
39
40/* Custom config requests */
41#define EMIF_CUSTOM_CONFIG_LPMODE 0x00000001
42#define EMIF_CUSTOM_CONFIG_TEMP_ALERT_POLL_INTERVAL 0x00000002
43
44#ifndef __ASSEMBLY__
45/**
46 * struct ddr_device_info - All information about the DDR device except AC
47 * timing parameters
48 * @type: Device type (LPDDR2-S4, LPDDR2-S2 etc)
49 * @density: Device density
50 * @io_width: Bus width
51 * @cs1_used: Whether there is a DDR device attached to the second
52 * chip-select(CS1) of this EMIF instance
53 * @cal_resistors_per_cs: Whether there is one calibration resistor per
54 * chip-select or whether it's a single one for both
55 * @manufacturer: Manufacturer name string
56 */
57struct ddr_device_info {
58 u32 type;
59 u32 density;
60 u32 io_width;
61 u32 cs1_used;
62 u32 cal_resistors_per_cs;
63 char manufacturer[10];
64};
65
66/**
67 * struct emif_custom_configs - Custom configuration parameters/policies
68 * passed from the platform layer
69 * @mask: Mask to indicate which configs are requested
70 * @lpmode: LPMODE to be used in PWR_MGMT_CTRL register
71 * @lpmode_timeout_performance: Timeout before LPMODE entry when higher
72 * performance is desired at the cost of power (typically
73 * at higher OPPs)
74 * @lpmode_timeout_power: Timeout before LPMODE entry when better power
75 * savings is desired and performance is not important
76 * (typically at lower loads indicated by lower OPPs)
77 * @lpmode_freq_threshold: The DDR frequency threshold to identify between
78 * the above two cases:
79 * timeout = (freq >= lpmode_freq_threshold) ?
80 * lpmode_timeout_performance :
81 * lpmode_timeout_power;
82 * @temp_alert_poll_interval_ms: LPDDR2 MR4 polling interval at nominal
83 * temperature(in milliseconds). When temperature is high
84 * polling is done 4 times as frequently.
85 */
86struct emif_custom_configs {
87 u32 mask;
88 u32 lpmode;
89 u32 lpmode_timeout_performance;
90 u32 lpmode_timeout_power;
91 u32 lpmode_freq_threshold;
92 u32 temp_alert_poll_interval_ms;
93};
94
95/**
96 * struct emif_platform_data - Platform data passed on EMIF platform
97 * device creation. Used by the driver.
98 * @hw_caps: Hw capabilities of the EMIF IP in the respective SoC
99 * @device_info: Device info structure containing information such
100 * as type, bus width, density etc
101 * @timings: Timings information from device datasheet passed
102 * as an array of 'struct lpddr2_timings'. Can be NULL
103 * if if default timings are ok
104 * @timings_arr_size: Size of the timings array. Depends on the number
105 * of different frequencies for which timings data
106 * is provided
107 * @min_tck: Minimum value of some timing parameters in terms
108 * of number of cycles. Can be NULL if default values
109 * are ok
110 * @custom_configs: Custom configurations requested by SoC or board
111 * code and the data for them. Can be NULL if default
112 * configurations done by the driver are ok. See
113 * documentation for 'struct emif_custom_configs' for
114 * more details
115 */
116struct emif_platform_data {
117 u32 hw_caps;
118 struct ddr_device_info *device_info;
119 const struct lpddr2_timings *timings;
120 u32 timings_arr_size;
121 const struct lpddr2_min_tck *min_tck;
122 struct emif_custom_configs *custom_configs;
123 u32 ip_rev;
124 u32 phy_type;
125};
126#endif /* __ASSEMBLY__ */
127
128#endif /* __LINUX_EMIF_H */
diff --git a/include/linux/platform_data/gpio-em.h b/include/linux/platform_data/gpio-em.h
new file mode 100644
index 000000000000..573edfb046c4
--- /dev/null
+++ b/include/linux/platform_data/gpio-em.h
@@ -0,0 +1,10 @@
1#ifndef __GPIO_EM_H__
2#define __GPIO_EM_H__
3
4struct gpio_em_config {
5 unsigned int gpio_base;
6 unsigned int irq_base;
7 unsigned int number_of_pins;
8};
9
10#endif /* __GPIO_EM_H__ */
diff --git a/include/linux/platform_data/ina2xx.h b/include/linux/platform_data/ina2xx.h
new file mode 100644
index 000000000000..9abc0ca7259b
--- /dev/null
+++ b/include/linux/platform_data/ina2xx.h
@@ -0,0 +1,19 @@
1/*
2 * Driver for Texas Instruments INA219, INA226 power monitor chips
3 *
4 * Copyright (C) 2012 Lothar Felten <l-felten@ti.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * For further information, see the Documentation/hwmon/ina2xx file.
11 */
12
13/**
14 * struct ina2xx_platform_data - ina2xx info
15 * @shunt_uohms shunt resistance in microohms
16 */
17struct ina2xx_platform_data {
18 long shunt_uohms;
19};
diff --git a/include/linux/platform_data/s3c-hsotg.h b/include/linux/platform_data/s3c-hsotg.h
new file mode 100644
index 000000000000..97ec12c2ded4
--- /dev/null
+++ b/include/linux/platform_data/s3c-hsotg.h
@@ -0,0 +1,35 @@
1/* include/linux/platform_data/s3c-hsotg.h
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
6 * http://armlinux.simtec.co.uk/
7 *
8 * S3C USB2.0 High-speed / OtG platform information
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13*/
14
15enum s3c_hsotg_dmamode {
16 S3C_HSOTG_DMA_NONE, /* do not use DMA at-all */
17 S3C_HSOTG_DMA_ONLY, /* always use DMA */
18 S3C_HSOTG_DMA_DRV, /* DMA is chosen by driver */
19};
20
21/**
22 * struct s3c_hsotg_plat - platform data for high-speed otg/udc
23 * @dma: Whether to use DMA or not.
24 * @is_osc: The clock source is an oscillator, not a crystal
25 */
26struct s3c_hsotg_plat {
27 enum s3c_hsotg_dmamode dma;
28 unsigned int is_osc:1;
29 int phy_type;
30
31 int (*phy_init)(struct platform_device *pdev, int type);
32 int (*phy_exit)(struct platform_device *pdev, int type);
33};
34
35extern void s3c_hsotg_set_platdata(struct s3c_hsotg_plat *pd);
diff --git a/include/linux/platform_data/tegra_usb.h b/include/linux/platform_data/tegra_usb.h
index 6bca5b569acb..66c673fef408 100644
--- a/include/linux/platform_data/tegra_usb.h
+++ b/include/linux/platform_data/tegra_usb.h
@@ -26,6 +26,7 @@ struct tegra_ehci_platform_data {
26 /* power down the phy on bus suspend */ 26 /* power down the phy on bus suspend */
27 int power_down_on_bus_suspend; 27 int power_down_on_bus_suspend;
28 void *phy_config; 28 void *phy_config;
29 int vbus_gpio;
29}; 30};
30 31
31#endif /* _TEGRA_USB_H_ */ 32#endif /* _TEGRA_USB_H_ */
diff --git a/include/linux/pm.h b/include/linux/pm.h
index 715305e05123..f067e60a3832 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -544,8 +544,6 @@ struct dev_pm_info {
544 unsigned long active_jiffies; 544 unsigned long active_jiffies;
545 unsigned long suspended_jiffies; 545 unsigned long suspended_jiffies;
546 unsigned long accounting_timestamp; 546 unsigned long accounting_timestamp;
547 ktime_t suspend_time;
548 s64 max_time_suspended_ns;
549 struct dev_pm_qos_request *pq_req; 547 struct dev_pm_qos_request *pq_req;
550#endif 548#endif
551 struct pm_subsys_data *subsys_data; /* Owned by the subsystem. */ 549 struct pm_subsys_data *subsys_data; /* Owned by the subsystem. */
diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
index 91f8286106ea..30f794eb3826 100644
--- a/include/linux/pm_domain.h
+++ b/include/linux/pm_domain.h
@@ -14,6 +14,7 @@
14#include <linux/pm.h> 14#include <linux/pm.h>
15#include <linux/err.h> 15#include <linux/err.h>
16#include <linux/of.h> 16#include <linux/of.h>
17#include <linux/notifier.h>
17 18
18enum gpd_status { 19enum gpd_status {
19 GPD_STATE_ACTIVE = 0, /* PM domain is active */ 20 GPD_STATE_ACTIVE = 0, /* PM domain is active */
@@ -70,9 +71,9 @@ struct generic_pm_domain {
70 int (*power_on)(struct generic_pm_domain *domain); 71 int (*power_on)(struct generic_pm_domain *domain);
71 s64 power_on_latency_ns; 72 s64 power_on_latency_ns;
72 struct gpd_dev_ops dev_ops; 73 struct gpd_dev_ops dev_ops;
73 s64 break_even_ns; /* Power break even for the entire domain. */
74 s64 max_off_time_ns; /* Maximum allowed "suspended" time. */ 74 s64 max_off_time_ns; /* Maximum allowed "suspended" time. */
75 ktime_t power_off_time; 75 bool max_off_time_changed;
76 bool cached_power_down_ok;
76 struct device_node *of_node; /* Node in device tree */ 77 struct device_node *of_node; /* Node in device tree */
77}; 78};
78 79
@@ -93,13 +94,17 @@ struct gpd_timing_data {
93 s64 start_latency_ns; 94 s64 start_latency_ns;
94 s64 save_state_latency_ns; 95 s64 save_state_latency_ns;
95 s64 restore_state_latency_ns; 96 s64 restore_state_latency_ns;
96 s64 break_even_ns; 97 s64 effective_constraint_ns;
98 bool constraint_changed;
99 bool cached_stop_ok;
97}; 100};
98 101
99struct generic_pm_domain_data { 102struct generic_pm_domain_data {
100 struct pm_domain_data base; 103 struct pm_domain_data base;
101 struct gpd_dev_ops ops; 104 struct gpd_dev_ops ops;
102 struct gpd_timing_data td; 105 struct gpd_timing_data td;
106 struct notifier_block nb;
107 struct mutex lock;
103 bool need_restore; 108 bool need_restore;
104 bool always_on; 109 bool always_on;
105}; 110};
@@ -141,6 +146,7 @@ static inline int pm_genpd_of_add_device(struct device_node *genpd_node,
141extern int pm_genpd_remove_device(struct generic_pm_domain *genpd, 146extern int pm_genpd_remove_device(struct generic_pm_domain *genpd,
142 struct device *dev); 147 struct device *dev);
143extern void pm_genpd_dev_always_on(struct device *dev, bool val); 148extern void pm_genpd_dev_always_on(struct device *dev, bool val);
149extern void pm_genpd_dev_need_restore(struct device *dev, bool val);
144extern int pm_genpd_add_subdomain(struct generic_pm_domain *genpd, 150extern int pm_genpd_add_subdomain(struct generic_pm_domain *genpd,
145 struct generic_pm_domain *new_subdomain); 151 struct generic_pm_domain *new_subdomain);
146extern int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd, 152extern int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd,
@@ -184,6 +190,7 @@ static inline int pm_genpd_remove_device(struct generic_pm_domain *genpd,
184 return -ENOSYS; 190 return -ENOSYS;
185} 191}
186static inline void pm_genpd_dev_always_on(struct device *dev, bool val) {} 192static inline void pm_genpd_dev_always_on(struct device *dev, bool val) {}
193static inline void pm_genpd_dev_need_restore(struct device *dev, bool val) {}
187static inline int pm_genpd_add_subdomain(struct generic_pm_domain *genpd, 194static inline int pm_genpd_add_subdomain(struct generic_pm_domain *genpd,
188 struct generic_pm_domain *new_sd) 195 struct generic_pm_domain *new_sd)
189{ 196{
diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h
index 609daae7a014..f271860c78d5 100644
--- a/include/linux/pm_runtime.h
+++ b/include/linux/pm_runtime.h
@@ -150,9 +150,6 @@ static inline void pm_runtime_set_autosuspend_delay(struct device *dev,
150static inline unsigned long pm_runtime_autosuspend_expiration( 150static inline unsigned long pm_runtime_autosuspend_expiration(
151 struct device *dev) { return 0; } 151 struct device *dev) { return 0; }
152 152
153static inline void pm_runtime_update_max_time_suspended(struct device *dev,
154 s64 delta_ns) {}
155
156#endif /* !CONFIG_PM_RUNTIME */ 153#endif /* !CONFIG_PM_RUNTIME */
157 154
158static inline int pm_runtime_idle(struct device *dev) 155static inline int pm_runtime_idle(struct device *dev)
diff --git a/include/linux/pm_wakeup.h b/include/linux/pm_wakeup.h
index d9f05113e5fb..569781faa504 100644
--- a/include/linux/pm_wakeup.h
+++ b/include/linux/pm_wakeup.h
@@ -33,12 +33,15 @@
33 * 33 *
34 * @total_time: Total time this wakeup source has been active. 34 * @total_time: Total time this wakeup source has been active.
35 * @max_time: Maximum time this wakeup source has been continuously active. 35 * @max_time: Maximum time this wakeup source has been continuously active.
36 * @last_time: Monotonic clock when the wakeup source's was activated last time. 36 * @last_time: Monotonic clock when the wakeup source's was touched last time.
37 * @prevent_sleep_time: Total time this source has been preventing autosleep.
37 * @event_count: Number of signaled wakeup events. 38 * @event_count: Number of signaled wakeup events.
38 * @active_count: Number of times the wakeup sorce was activated. 39 * @active_count: Number of times the wakeup sorce was activated.
39 * @relax_count: Number of times the wakeup sorce was deactivated. 40 * @relax_count: Number of times the wakeup sorce was deactivated.
40 * @hit_count: Number of times the wakeup sorce might abort system suspend. 41 * @expire_count: Number of times the wakeup source's timeout has expired.
42 * @wakeup_count: Number of times the wakeup source might abort suspend.
41 * @active: Status of the wakeup source. 43 * @active: Status of the wakeup source.
44 * @has_timeout: The wakeup source has been activated with a timeout.
42 */ 45 */
43struct wakeup_source { 46struct wakeup_source {
44 const char *name; 47 const char *name;
@@ -49,11 +52,15 @@ struct wakeup_source {
49 ktime_t total_time; 52 ktime_t total_time;
50 ktime_t max_time; 53 ktime_t max_time;
51 ktime_t last_time; 54 ktime_t last_time;
55 ktime_t start_prevent_time;
56 ktime_t prevent_sleep_time;
52 unsigned long event_count; 57 unsigned long event_count;
53 unsigned long active_count; 58 unsigned long active_count;
54 unsigned long relax_count; 59 unsigned long relax_count;
55 unsigned long hit_count; 60 unsigned long expire_count;
56 unsigned int active:1; 61 unsigned long wakeup_count;
62 bool active:1;
63 bool autosleep_enabled:1;
57}; 64};
58 65
59#ifdef CONFIG_PM_SLEEP 66#ifdef CONFIG_PM_SLEEP
diff --git a/include/linux/prctl.h b/include/linux/prctl.h
index e0cfec2490aa..78b76e24cc7e 100644
--- a/include/linux/prctl.h
+++ b/include/linux/prctl.h
@@ -124,4 +124,19 @@
124#define PR_SET_CHILD_SUBREAPER 36 124#define PR_SET_CHILD_SUBREAPER 36
125#define PR_GET_CHILD_SUBREAPER 37 125#define PR_GET_CHILD_SUBREAPER 37
126 126
127/*
128 * If no_new_privs is set, then operations that grant new privileges (i.e.
129 * execve) will either fail or not grant them. This affects suid/sgid,
130 * file capabilities, and LSMs.
131 *
132 * Operations that merely manipulate or drop existing privileges (setresuid,
133 * capset, etc.) will still work. Drop those privileges if you want them gone.
134 *
135 * Changing LSM security domain is considered a new privilege. So, for example,
136 * asking selinux for a specific new context (e.g. with runcon) will result
137 * in execve returning -EPERM.
138 */
139#define PR_SET_NO_NEW_PRIVS 38
140#define PR_GET_NO_NEW_PRIVS 39
141
127#endif /* _LINUX_PRCTL_H */ 142#endif /* _LINUX_PRCTL_H */
diff --git a/include/linux/printk.h b/include/linux/printk.h
index 0525927f203f..1bec2f7a2d42 100644
--- a/include/linux/printk.h
+++ b/include/linux/printk.h
@@ -95,8 +95,19 @@ extern int printk_needs_cpu(int cpu);
95extern void printk_tick(void); 95extern void printk_tick(void);
96 96
97#ifdef CONFIG_PRINTK 97#ifdef CONFIG_PRINTK
98asmlinkage __printf(5, 0)
99int vprintk_emit(int facility, int level,
100 const char *dict, size_t dictlen,
101 const char *fmt, va_list args);
102
98asmlinkage __printf(1, 0) 103asmlinkage __printf(1, 0)
99int vprintk(const char *fmt, va_list args); 104int vprintk(const char *fmt, va_list args);
105
106asmlinkage __printf(5, 6) __cold
107asmlinkage int printk_emit(int facility, int level,
108 const char *dict, size_t dictlen,
109 const char *fmt, ...);
110
100asmlinkage __printf(1, 2) __cold 111asmlinkage __printf(1, 2) __cold
101int printk(const char *fmt, ...); 112int printk(const char *fmt, ...);
102 113
@@ -289,6 +300,8 @@ extern void dump_stack(void) __cold;
289 no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) 300 no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
290#endif 301#endif
291 302
303extern const struct file_operations kmsg_fops;
304
292enum { 305enum {
293 DUMP_PREFIX_NONE, 306 DUMP_PREFIX_NONE,
294 DUMP_PREFIX_ADDRESS, 307 DUMP_PREFIX_ADDRESS,
diff --git a/include/linux/pstore_ram.h b/include/linux/pstore_ram.h
new file mode 100644
index 000000000000..7ed7fd4dba49
--- /dev/null
+++ b/include/linux/pstore_ram.h
@@ -0,0 +1,98 @@
1/*
2 * Copyright (C) 2010 Marco Stornelli <marco.stornelli@gmail.com>
3 * Copyright (C) 2011 Kees Cook <keescook@chromium.org>
4 * Copyright (C) 2011 Google, Inc.
5 *
6 * This software is licensed under the terms of the GNU General Public
7 * License version 2, as published by the Free Software Foundation, and
8 * may be copied, distributed, and modified under those terms.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 */
16
17#ifndef __LINUX_PSTORE_RAM_H__
18#define __LINUX_PSTORE_RAM_H__
19
20#include <linux/device.h>
21#include <linux/kernel.h>
22#include <linux/list.h>
23#include <linux/types.h>
24#include <linux/init.h>
25
26struct persistent_ram_buffer;
27
28struct persistent_ram_descriptor {
29 const char *name;
30 phys_addr_t size;
31};
32
33struct persistent_ram {
34 phys_addr_t start;
35 phys_addr_t size;
36
37 int num_descs;
38 struct persistent_ram_descriptor *descs;
39
40 struct list_head node;
41};
42
43struct persistent_ram_zone {
44 phys_addr_t paddr;
45 size_t size;
46 void *vaddr;
47 struct persistent_ram_buffer *buffer;
48 size_t buffer_size;
49
50 /* ECC correction */
51 bool ecc;
52 char *par_buffer;
53 char *par_header;
54 struct rs_control *rs_decoder;
55 int corrected_bytes;
56 int bad_blocks;
57 int ecc_block_size;
58 int ecc_size;
59 int ecc_symsize;
60 int ecc_poly;
61
62 char *old_log;
63 size_t old_log_size;
64};
65
66int persistent_ram_early_init(struct persistent_ram *ram);
67
68struct persistent_ram_zone * __init persistent_ram_new(phys_addr_t start,
69 size_t size,
70 bool ecc);
71void persistent_ram_free(struct persistent_ram_zone *prz);
72struct persistent_ram_zone *persistent_ram_init_ringbuffer(struct device *dev,
73 bool ecc);
74
75int persistent_ram_write(struct persistent_ram_zone *prz, const void *s,
76 unsigned int count);
77
78size_t persistent_ram_old_size(struct persistent_ram_zone *prz);
79void *persistent_ram_old(struct persistent_ram_zone *prz);
80void persistent_ram_free_old(struct persistent_ram_zone *prz);
81ssize_t persistent_ram_ecc_string(struct persistent_ram_zone *prz,
82 char *str, size_t len);
83
84/*
85 * Ramoops platform data
86 * @mem_size memory size for ramoops
87 * @mem_address physical memory address to contain ramoops
88 */
89
90struct ramoops_platform_data {
91 unsigned long mem_size;
92 unsigned long mem_address;
93 unsigned long record_size;
94 int dump_oops;
95 bool ecc;
96};
97
98#endif
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h
index 5c719627c2aa..597e4fdb97fe 100644
--- a/include/linux/ptrace.h
+++ b/include/linux/ptrace.h
@@ -58,6 +58,7 @@
58#define PTRACE_EVENT_EXEC 4 58#define PTRACE_EVENT_EXEC 4
59#define PTRACE_EVENT_VFORK_DONE 5 59#define PTRACE_EVENT_VFORK_DONE 5
60#define PTRACE_EVENT_EXIT 6 60#define PTRACE_EVENT_EXIT 6
61#define PTRACE_EVENT_SECCOMP 7
61/* Extended result codes which enabled by means other than options. */ 62/* Extended result codes which enabled by means other than options. */
62#define PTRACE_EVENT_STOP 128 63#define PTRACE_EVENT_STOP 128
63 64
@@ -69,8 +70,9 @@
69#define PTRACE_O_TRACEEXEC (1 << PTRACE_EVENT_EXEC) 70#define PTRACE_O_TRACEEXEC (1 << PTRACE_EVENT_EXEC)
70#define PTRACE_O_TRACEVFORKDONE (1 << PTRACE_EVENT_VFORK_DONE) 71#define PTRACE_O_TRACEVFORKDONE (1 << PTRACE_EVENT_VFORK_DONE)
71#define PTRACE_O_TRACEEXIT (1 << PTRACE_EVENT_EXIT) 72#define PTRACE_O_TRACEEXIT (1 << PTRACE_EVENT_EXIT)
73#define PTRACE_O_TRACESECCOMP (1 << PTRACE_EVENT_SECCOMP)
72 74
73#define PTRACE_O_MASK 0x0000007f 75#define PTRACE_O_MASK 0x000000ff
74 76
75#include <asm/ptrace.h> 77#include <asm/ptrace.h>
76 78
@@ -98,6 +100,7 @@
98#define PT_TRACE_EXEC PT_EVENT_FLAG(PTRACE_EVENT_EXEC) 100#define PT_TRACE_EXEC PT_EVENT_FLAG(PTRACE_EVENT_EXEC)
99#define PT_TRACE_VFORK_DONE PT_EVENT_FLAG(PTRACE_EVENT_VFORK_DONE) 101#define PT_TRACE_VFORK_DONE PT_EVENT_FLAG(PTRACE_EVENT_VFORK_DONE)
100#define PT_TRACE_EXIT PT_EVENT_FLAG(PTRACE_EVENT_EXIT) 102#define PT_TRACE_EXIT PT_EVENT_FLAG(PTRACE_EVENT_EXIT)
103#define PT_TRACE_SECCOMP PT_EVENT_FLAG(PTRACE_EVENT_SECCOMP)
101 104
102/* single stepping state bits (used on ARM and PA-RISC) */ 105/* single stepping state bits (used on ARM and PA-RISC) */
103#define PT_SINGLESTEP_BIT 31 106#define PT_SINGLESTEP_BIT 31
diff --git a/include/linux/raid/md_p.h b/include/linux/raid/md_p.h
index 8c0a3adc5df5..ee753536ab70 100644
--- a/include/linux/raid/md_p.h
+++ b/include/linux/raid/md_p.h
@@ -233,7 +233,10 @@ struct mdp_superblock_1 {
233 __le32 delta_disks; /* change in number of raid_disks */ 233 __le32 delta_disks; /* change in number of raid_disks */
234 __le32 new_layout; /* new layout */ 234 __le32 new_layout; /* new layout */
235 __le32 new_chunk; /* new chunk size (512byte sectors) */ 235 __le32 new_chunk; /* new chunk size (512byte sectors) */
236 __u8 pad1[128-124]; /* set to 0 when written */ 236 __le32 new_offset; /* signed number to add to data_offset in new
237 * layout. 0 == no-change. This can be
238 * different on each device in the array.
239 */
237 240
238 /* constant this-device information - 64 bytes */ 241 /* constant this-device information - 64 bytes */
239 __le64 data_offset; /* sector start of data, often 0 */ 242 __le64 data_offset; /* sector start of data, often 0 */
@@ -281,10 +284,18 @@ struct mdp_superblock_1 {
281 * active device with same 'role'. 284 * active device with same 'role'.
282 * 'recovery_offset' is also set. 285 * 'recovery_offset' is also set.
283 */ 286 */
287#define MD_FEATURE_RESHAPE_BACKWARDS 32 /* Reshape doesn't change number
288 * of devices, but is going
289 * backwards anyway.
290 */
291#define MD_FEATURE_NEW_OFFSET 64 /* new_offset must be honoured */
284#define MD_FEATURE_ALL (MD_FEATURE_BITMAP_OFFSET \ 292#define MD_FEATURE_ALL (MD_FEATURE_BITMAP_OFFSET \
285 |MD_FEATURE_RECOVERY_OFFSET \ 293 |MD_FEATURE_RECOVERY_OFFSET \
286 |MD_FEATURE_RESHAPE_ACTIVE \ 294 |MD_FEATURE_RESHAPE_ACTIVE \
287 |MD_FEATURE_BAD_BLOCKS \ 295 |MD_FEATURE_BAD_BLOCKS \
288 |MD_FEATURE_REPLACEMENT) 296 |MD_FEATURE_REPLACEMENT \
297 |MD_FEATURE_RESHAPE_BACKWARDS \
298 |MD_FEATURE_NEW_OFFSET \
299 )
289 300
290#endif 301#endif
diff --git a/include/linux/raid/pq.h b/include/linux/raid/pq.h
index 53272e9860a7..640c69ceec96 100644
--- a/include/linux/raid/pq.h
+++ b/include/linux/raid/pq.h
@@ -99,8 +99,20 @@ extern const struct raid6_calls raid6_altivec2;
99extern const struct raid6_calls raid6_altivec4; 99extern const struct raid6_calls raid6_altivec4;
100extern const struct raid6_calls raid6_altivec8; 100extern const struct raid6_calls raid6_altivec8;
101 101
102struct raid6_recov_calls {
103 void (*data2)(int, size_t, int, int, void **);
104 void (*datap)(int, size_t, int, void **);
105 int (*valid)(void);
106 const char *name;
107 int priority;
108};
109
110extern const struct raid6_recov_calls raid6_recov_intx1;
111extern const struct raid6_recov_calls raid6_recov_ssse3;
112
102/* Algorithm list */ 113/* Algorithm list */
103extern const struct raid6_calls * const raid6_algos[]; 114extern const struct raid6_calls * const raid6_algos[];
115extern const struct raid6_recov_calls *const raid6_recov_algos[];
104int raid6_select_algo(void); 116int raid6_select_algo(void);
105 117
106/* Return values from chk_syndrome */ 118/* Return values from chk_syndrome */
@@ -111,14 +123,16 @@ int raid6_select_algo(void);
111 123
112/* Galois field tables */ 124/* Galois field tables */
113extern const u8 raid6_gfmul[256][256] __attribute__((aligned(256))); 125extern const u8 raid6_gfmul[256][256] __attribute__((aligned(256)));
126extern const u8 raid6_vgfmul[256][32] __attribute__((aligned(256)));
114extern const u8 raid6_gfexp[256] __attribute__((aligned(256))); 127extern const u8 raid6_gfexp[256] __attribute__((aligned(256)));
115extern const u8 raid6_gfinv[256] __attribute__((aligned(256))); 128extern const u8 raid6_gfinv[256] __attribute__((aligned(256)));
116extern const u8 raid6_gfexi[256] __attribute__((aligned(256))); 129extern const u8 raid6_gfexi[256] __attribute__((aligned(256)));
117 130
118/* Recovery routines */ 131/* Recovery routines */
119void raid6_2data_recov(int disks, size_t bytes, int faila, int failb, 132extern void (*raid6_2data_recov)(int disks, size_t bytes, int faila, int failb,
120 void **ptrs); 133 void **ptrs);
121void raid6_datap_recov(int disks, size_t bytes, int faila, void **ptrs); 134extern void (*raid6_datap_recov)(int disks, size_t bytes, int faila,
135 void **ptrs);
122void raid6_dual_recov(int disks, size_t bytes, int faila, int failb, 136void raid6_dual_recov(int disks, size_t bytes, int faila, int failb,
123 void **ptrs); 137 void **ptrs);
124 138
diff --git a/include/linux/ramoops.h b/include/linux/ramoops.h
deleted file mode 100644
index 484fef81cd3a..000000000000
--- a/include/linux/ramoops.h
+++ /dev/null
@@ -1,17 +0,0 @@
1#ifndef __RAMOOPS_H
2#define __RAMOOPS_H
3
4/*
5 * Ramoops platform data
6 * @mem_size memory size for ramoops
7 * @mem_address physical memory address to contain ramoops
8 */
9
10struct ramoops_platform_data {
11 unsigned long mem_size;
12 unsigned long mem_address;
13 unsigned long record_size;
14 int dump_oops;
15};
16
17#endif
diff --git a/include/linux/rational.h b/include/linux/rational.h
index 4f532fcd9eea..bfa6a2bcfb32 100644
--- a/include/linux/rational.h
+++ b/include/linux/rational.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * rational fractions 2 * rational fractions
3 * 3 *
4 * Copyright (C) 2009 emlix GmbH, Oskar Schirmer <os@emlix.com> 4 * Copyright (C) 2009 emlix GmbH, Oskar Schirmer <oskar@scara.com>
5 * 5 *
6 * helper functions when coping with rational numbers, 6 * helper functions when coping with rational numbers,
7 * e.g. when calculating optimum numerator/denominator pairs for 7 * e.g. when calculating optimum numerator/denominator pairs for
diff --git a/include/linux/rculist.h b/include/linux/rculist.h
index d079290843a9..e0f0fab20415 100644
--- a/include/linux/rculist.h
+++ b/include/linux/rculist.h
@@ -30,6 +30,7 @@
30 * This is only for internal list manipulation where we know 30 * This is only for internal list manipulation where we know
31 * the prev/next entries already! 31 * the prev/next entries already!
32 */ 32 */
33#ifndef CONFIG_DEBUG_LIST
33static inline void __list_add_rcu(struct list_head *new, 34static inline void __list_add_rcu(struct list_head *new,
34 struct list_head *prev, struct list_head *next) 35 struct list_head *prev, struct list_head *next)
35{ 36{
@@ -38,6 +39,10 @@ static inline void __list_add_rcu(struct list_head *new,
38 rcu_assign_pointer(list_next_rcu(prev), new); 39 rcu_assign_pointer(list_next_rcu(prev), new);
39 next->prev = new; 40 next->prev = new;
40} 41}
42#else
43extern void __list_add_rcu(struct list_head *new,
44 struct list_head *prev, struct list_head *next);
45#endif
41 46
42/** 47/**
43 * list_add_rcu - add a new entry to rcu-protected list 48 * list_add_rcu - add a new entry to rcu-protected list
@@ -108,7 +113,7 @@ static inline void list_add_tail_rcu(struct list_head *new,
108 */ 113 */
109static inline void list_del_rcu(struct list_head *entry) 114static inline void list_del_rcu(struct list_head *entry)
110{ 115{
111 __list_del(entry->prev, entry->next); 116 __list_del_entry(entry);
112 entry->prev = LIST_POISON2; 117 entry->prev = LIST_POISON2;
113} 118}
114 119
@@ -228,18 +233,43 @@ static inline void list_splice_init_rcu(struct list_head *list,
228 }) 233 })
229 234
230/** 235/**
231 * list_first_entry_rcu - get the first element from a list 236 * Where are list_empty_rcu() and list_first_entry_rcu()?
237 *
238 * Implementing those functions following their counterparts list_empty() and
239 * list_first_entry() is not advisable because they lead to subtle race
240 * conditions as the following snippet shows:
241 *
242 * if (!list_empty_rcu(mylist)) {
243 * struct foo *bar = list_first_entry_rcu(mylist, struct foo, list_member);
244 * do_something(bar);
245 * }
246 *
247 * The list may not be empty when list_empty_rcu checks it, but it may be when
248 * list_first_entry_rcu rereads the ->next pointer.
249 *
250 * Rereading the ->next pointer is not a problem for list_empty() and
251 * list_first_entry() because they would be protected by a lock that blocks
252 * writers.
253 *
254 * See list_first_or_null_rcu for an alternative.
255 */
256
257/**
258 * list_first_or_null_rcu - get the first element from a list
232 * @ptr: the list head to take the element from. 259 * @ptr: the list head to take the element from.
233 * @type: the type of the struct this is embedded in. 260 * @type: the type of the struct this is embedded in.
234 * @member: the name of the list_struct within the struct. 261 * @member: the name of the list_struct within the struct.
235 * 262 *
236 * Note, that list is expected to be not empty. 263 * Note that if the list is empty, it returns NULL.
237 * 264 *
238 * This primitive may safely run concurrently with the _rcu list-mutation 265 * This primitive may safely run concurrently with the _rcu list-mutation
239 * primitives such as list_add_rcu() as long as it's guarded by rcu_read_lock(). 266 * primitives such as list_add_rcu() as long as it's guarded by rcu_read_lock().
240 */ 267 */
241#define list_first_entry_rcu(ptr, type, member) \ 268#define list_first_or_null_rcu(ptr, type, member) \
242 list_entry_rcu((ptr)->next, type, member) 269 ({struct list_head *__ptr = (ptr); \
270 struct list_head __rcu *__next = list_next_rcu(__ptr); \
271 likely(__ptr != __next) ? container_of(__next, type, member) : NULL; \
272 })
243 273
244/** 274/**
245 * list_for_each_entry_rcu - iterate over rcu list of given type 275 * list_for_each_entry_rcu - iterate over rcu list of given type
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 20fb776a1d4a..26d1a47591f1 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -184,12 +184,14 @@ static inline int rcu_preempt_depth(void)
184/* Internal to kernel */ 184/* Internal to kernel */
185extern void rcu_sched_qs(int cpu); 185extern void rcu_sched_qs(int cpu);
186extern void rcu_bh_qs(int cpu); 186extern void rcu_bh_qs(int cpu);
187extern void rcu_preempt_note_context_switch(void);
187extern void rcu_check_callbacks(int cpu, int user); 188extern void rcu_check_callbacks(int cpu, int user);
188struct notifier_block; 189struct notifier_block;
189extern void rcu_idle_enter(void); 190extern void rcu_idle_enter(void);
190extern void rcu_idle_exit(void); 191extern void rcu_idle_exit(void);
191extern void rcu_irq_enter(void); 192extern void rcu_irq_enter(void);
192extern void rcu_irq_exit(void); 193extern void rcu_irq_exit(void);
194extern void exit_rcu(void);
193 195
194/** 196/**
195 * RCU_NONIDLE - Indicate idle-loop code that needs RCU readers 197 * RCU_NONIDLE - Indicate idle-loop code that needs RCU readers
@@ -922,6 +924,21 @@ void __kfree_rcu(struct rcu_head *head, unsigned long offset)
922 kfree_call_rcu(head, (rcu_callback)offset); 924 kfree_call_rcu(head, (rcu_callback)offset);
923} 925}
924 926
927/*
928 * Does the specified offset indicate that the corresponding rcu_head
929 * structure can be handled by kfree_rcu()?
930 */
931#define __is_kfree_rcu_offset(offset) ((offset) < 4096)
932
933/*
934 * Helper macro for kfree_rcu() to prevent argument-expansion eyestrain.
935 */
936#define __kfree_rcu(head, offset) \
937 do { \
938 BUILD_BUG_ON(!__is_kfree_rcu_offset(offset)); \
939 call_rcu(head, (void (*)(struct rcu_head *))(unsigned long)(offset)); \
940 } while (0)
941
925/** 942/**
926 * kfree_rcu() - kfree an object after a grace period. 943 * kfree_rcu() - kfree an object after a grace period.
927 * @ptr: pointer to kfree 944 * @ptr: pointer to kfree
@@ -944,6 +961,9 @@ void __kfree_rcu(struct rcu_head *head, unsigned long offset)
944 * 961 *
945 * Note that the allowable offset might decrease in the future, for example, 962 * Note that the allowable offset might decrease in the future, for example,
946 * to allow something like kmem_cache_free_rcu(). 963 * to allow something like kmem_cache_free_rcu().
964 *
965 * The BUILD_BUG_ON check must not involve any function calls, hence the
966 * checks are done in macros here.
947 */ 967 */
948#define kfree_rcu(ptr, rcu_head) \ 968#define kfree_rcu(ptr, rcu_head) \
949 __kfree_rcu(&((ptr)->rcu_head), offsetof(typeof(*(ptr)), rcu_head)) 969 __kfree_rcu(&((ptr)->rcu_head), offsetof(typeof(*(ptr)), rcu_head))
diff --git a/include/linux/rcutiny.h b/include/linux/rcutiny.h
index e93df77176d1..adb5e5a38cae 100644
--- a/include/linux/rcutiny.h
+++ b/include/linux/rcutiny.h
@@ -87,14 +87,6 @@ static inline void kfree_call_rcu(struct rcu_head *head,
87 87
88#ifdef CONFIG_TINY_RCU 88#ifdef CONFIG_TINY_RCU
89 89
90static inline void rcu_preempt_note_context_switch(void)
91{
92}
93
94static inline void exit_rcu(void)
95{
96}
97
98static inline int rcu_needs_cpu(int cpu) 90static inline int rcu_needs_cpu(int cpu)
99{ 91{
100 return 0; 92 return 0;
@@ -102,8 +94,6 @@ static inline int rcu_needs_cpu(int cpu)
102 94
103#else /* #ifdef CONFIG_TINY_RCU */ 95#else /* #ifdef CONFIG_TINY_RCU */
104 96
105void rcu_preempt_note_context_switch(void);
106extern void exit_rcu(void);
107int rcu_preempt_needs_cpu(void); 97int rcu_preempt_needs_cpu(void);
108 98
109static inline int rcu_needs_cpu(int cpu) 99static inline int rcu_needs_cpu(int cpu)
@@ -116,7 +106,6 @@ static inline int rcu_needs_cpu(int cpu)
116static inline void rcu_note_context_switch(int cpu) 106static inline void rcu_note_context_switch(int cpu)
117{ 107{
118 rcu_sched_qs(cpu); 108 rcu_sched_qs(cpu);
119 rcu_preempt_note_context_switch();
120} 109}
121 110
122/* 111/*
diff --git a/include/linux/rcutree.h b/include/linux/rcutree.h
index e8ee5dd0854c..3c6083cde4fc 100644
--- a/include/linux/rcutree.h
+++ b/include/linux/rcutree.h
@@ -45,18 +45,6 @@ static inline void rcu_virt_note_context_switch(int cpu)
45 rcu_note_context_switch(cpu); 45 rcu_note_context_switch(cpu);
46} 46}
47 47
48#ifdef CONFIG_TREE_PREEMPT_RCU
49
50extern void exit_rcu(void);
51
52#else /* #ifdef CONFIG_TREE_PREEMPT_RCU */
53
54static inline void exit_rcu(void)
55{
56}
57
58#endif /* #else #ifdef CONFIG_TREE_PREEMPT_RCU */
59
60extern void synchronize_rcu_bh(void); 48extern void synchronize_rcu_bh(void);
61extern void synchronize_sched_expedited(void); 49extern void synchronize_sched_expedited(void);
62extern void synchronize_rcu_expedited(void); 50extern void synchronize_rcu_expedited(void);
@@ -98,13 +86,6 @@ extern void rcu_force_quiescent_state(void);
98extern void rcu_bh_force_quiescent_state(void); 86extern void rcu_bh_force_quiescent_state(void);
99extern void rcu_sched_force_quiescent_state(void); 87extern void rcu_sched_force_quiescent_state(void);
100 88
101/* A context switch is a grace period for RCU-sched and RCU-bh. */
102static inline int rcu_blocking_is_gp(void)
103{
104 might_sleep(); /* Check for RCU read-side critical section. */
105 return num_online_cpus() == 1;
106}
107
108extern void rcu_scheduler_starting(void); 89extern void rcu_scheduler_starting(void);
109extern int rcu_scheduler_active __read_mostly; 90extern int rcu_scheduler_active __read_mostly;
110 91
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index a90abb6bfa64..56af22ec9aba 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -46,7 +46,13 @@ struct reg_default {
46/** 46/**
47 * Configuration for the register map of a device. 47 * Configuration for the register map of a device.
48 * 48 *
49 * @name: Optional name of the regmap. Useful when a device has multiple
50 * register regions.
51 *
49 * @reg_bits: Number of bits in a register address, mandatory. 52 * @reg_bits: Number of bits in a register address, mandatory.
53 * @reg_stride: The register address stride. Valid register addresses are a
54 * multiple of this value. If set to 0, a value of 1 will be
55 * used.
50 * @pad_bits: Number of bits of padding between register and value. 56 * @pad_bits: Number of bits of padding between register and value.
51 * @val_bits: Number of bits in a register value, mandatory. 57 * @val_bits: Number of bits in a register value, mandatory.
52 * 58 *
@@ -70,6 +76,9 @@ struct reg_default {
70 * @write_flag_mask: Mask to be set in the top byte of the register when doing 76 * @write_flag_mask: Mask to be set in the top byte of the register when doing
71 * a write. If both read_flag_mask and write_flag_mask are 77 * a write. If both read_flag_mask and write_flag_mask are
72 * empty the regmap_bus default masks are used. 78 * empty the regmap_bus default masks are used.
79 * @use_single_rw: If set, converts the bulk read and write operations into
80 * a series of single read and write operations. This is useful
81 * for device that does not support bulk read and write.
73 * 82 *
74 * @cache_type: The actual cache type. 83 * @cache_type: The actual cache type.
75 * @reg_defaults_raw: Power on reset values for registers (for use with 84 * @reg_defaults_raw: Power on reset values for registers (for use with
@@ -77,7 +86,10 @@ struct reg_default {
77 * @num_reg_defaults_raw: Number of elements in reg_defaults_raw. 86 * @num_reg_defaults_raw: Number of elements in reg_defaults_raw.
78 */ 87 */
79struct regmap_config { 88struct regmap_config {
89 const char *name;
90
80 int reg_bits; 91 int reg_bits;
92 int reg_stride;
81 int pad_bits; 93 int pad_bits;
82 int val_bits; 94 int val_bits;
83 95
@@ -95,20 +107,25 @@ struct regmap_config {
95 107
96 u8 read_flag_mask; 108 u8 read_flag_mask;
97 u8 write_flag_mask; 109 u8 write_flag_mask;
110
111 bool use_single_rw;
98}; 112};
99 113
100typedef int (*regmap_hw_write)(struct device *dev, const void *data, 114typedef int (*regmap_hw_write)(void *context, const void *data,
101 size_t count); 115 size_t count);
102typedef int (*regmap_hw_gather_write)(struct device *dev, 116typedef int (*regmap_hw_gather_write)(void *context,
103 const void *reg, size_t reg_len, 117 const void *reg, size_t reg_len,
104 const void *val, size_t val_len); 118 const void *val, size_t val_len);
105typedef int (*regmap_hw_read)(struct device *dev, 119typedef int (*regmap_hw_read)(void *context,
106 const void *reg_buf, size_t reg_size, 120 const void *reg_buf, size_t reg_size,
107 void *val_buf, size_t val_size); 121 void *val_buf, size_t val_size);
122typedef void (*regmap_hw_free_context)(void *context);
108 123
109/** 124/**
110 * Description of a hardware bus for the register map infrastructure. 125 * Description of a hardware bus for the register map infrastructure.
111 * 126 *
127 * @fast_io: Register IO is fast. Use a spinlock instead of a mutex
128 * to perform locking.
112 * @write: Write operation. 129 * @write: Write operation.
113 * @gather_write: Write operation with split register/value, return -ENOTSUPP 130 * @gather_write: Write operation with split register/value, return -ENOTSUPP
114 * if not implemented on a given device. 131 * if not implemented on a given device.
@@ -118,31 +135,42 @@ typedef int (*regmap_hw_read)(struct device *dev,
118 * a read. 135 * a read.
119 */ 136 */
120struct regmap_bus { 137struct regmap_bus {
138 bool fast_io;
121 regmap_hw_write write; 139 regmap_hw_write write;
122 regmap_hw_gather_write gather_write; 140 regmap_hw_gather_write gather_write;
123 regmap_hw_read read; 141 regmap_hw_read read;
142 regmap_hw_free_context free_context;
124 u8 read_flag_mask; 143 u8 read_flag_mask;
125}; 144};
126 145
127struct regmap *regmap_init(struct device *dev, 146struct regmap *regmap_init(struct device *dev,
128 const struct regmap_bus *bus, 147 const struct regmap_bus *bus,
148 void *bus_context,
129 const struct regmap_config *config); 149 const struct regmap_config *config);
130struct regmap *regmap_init_i2c(struct i2c_client *i2c, 150struct regmap *regmap_init_i2c(struct i2c_client *i2c,
131 const struct regmap_config *config); 151 const struct regmap_config *config);
132struct regmap *regmap_init_spi(struct spi_device *dev, 152struct regmap *regmap_init_spi(struct spi_device *dev,
133 const struct regmap_config *config); 153 const struct regmap_config *config);
154struct regmap *regmap_init_mmio(struct device *dev,
155 void __iomem *regs,
156 const struct regmap_config *config);
134 157
135struct regmap *devm_regmap_init(struct device *dev, 158struct regmap *devm_regmap_init(struct device *dev,
136 const struct regmap_bus *bus, 159 const struct regmap_bus *bus,
160 void *bus_context,
137 const struct regmap_config *config); 161 const struct regmap_config *config);
138struct regmap *devm_regmap_init_i2c(struct i2c_client *i2c, 162struct regmap *devm_regmap_init_i2c(struct i2c_client *i2c,
139 const struct regmap_config *config); 163 const struct regmap_config *config);
140struct regmap *devm_regmap_init_spi(struct spi_device *dev, 164struct regmap *devm_regmap_init_spi(struct spi_device *dev,
141 const struct regmap_config *config); 165 const struct regmap_config *config);
166struct regmap *devm_regmap_init_mmio(struct device *dev,
167 void __iomem *regs,
168 const struct regmap_config *config);
142 169
143void regmap_exit(struct regmap *map); 170void regmap_exit(struct regmap *map);
144int regmap_reinit_cache(struct regmap *map, 171int regmap_reinit_cache(struct regmap *map,
145 const struct regmap_config *config); 172 const struct regmap_config *config);
173struct regmap *dev_get_regmap(struct device *dev, const char *name);
146int regmap_write(struct regmap *map, unsigned int reg, unsigned int val); 174int regmap_write(struct regmap *map, unsigned int reg, unsigned int val);
147int regmap_raw_write(struct regmap *map, unsigned int reg, 175int regmap_raw_write(struct regmap *map, unsigned int reg,
148 const void *val, size_t val_len); 176 const void *val, size_t val_len);
@@ -191,6 +219,7 @@ struct regmap_irq {
191 * @status_base: Base status register address. 219 * @status_base: Base status register address.
192 * @mask_base: Base mask register address. 220 * @mask_base: Base mask register address.
193 * @ack_base: Base ack address. If zero then the chip is clear on read. 221 * @ack_base: Base ack address. If zero then the chip is clear on read.
222 * @irq_reg_stride: Stride to use for chips where registers are not contiguous.
194 * 223 *
195 * @num_regs: Number of registers in each control bank. 224 * @num_regs: Number of registers in each control bank.
196 * @irqs: Descriptors for individual IRQs. Interrupt numbers are 225 * @irqs: Descriptors for individual IRQs. Interrupt numbers are
@@ -203,6 +232,7 @@ struct regmap_irq_chip {
203 unsigned int status_base; 232 unsigned int status_base;
204 unsigned int mask_base; 233 unsigned int mask_base;
205 unsigned int ack_base; 234 unsigned int ack_base;
235 unsigned int irq_reg_stride;
206 236
207 int num_regs; 237 int num_regs;
208 238
@@ -217,6 +247,7 @@ int regmap_add_irq_chip(struct regmap *map, int irq, int irq_flags,
217 struct regmap_irq_chip_data **data); 247 struct regmap_irq_chip_data **data);
218void regmap_del_irq_chip(int irq, struct regmap_irq_chip_data *data); 248void regmap_del_irq_chip(int irq, struct regmap_irq_chip_data *data);
219int regmap_irq_chip_get_base(struct regmap_irq_chip_data *data); 249int regmap_irq_chip_get_base(struct regmap_irq_chip_data *data);
250int regmap_irq_get_virq(struct regmap_irq_chip_data *data, int irq);
220 251
221#else 252#else
222 253
@@ -327,6 +358,13 @@ static inline int regmap_register_patch(struct regmap *map,
327 return -EINVAL; 358 return -EINVAL;
328} 359}
329 360
361static inline struct regmap *dev_get_regmap(struct device *dev,
362 const char *name)
363{
364 WARN_ONCE(1, "regmap API is disabled");
365 return NULL;
366}
367
330#endif 368#endif
331 369
332#endif 370#endif
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
index fa8b55b8191c..b0432cc2b169 100644
--- a/include/linux/regulator/driver.h
+++ b/include/linux/regulator/driver.h
@@ -19,6 +19,7 @@
19#include <linux/notifier.h> 19#include <linux/notifier.h>
20#include <linux/regulator/consumer.h> 20#include <linux/regulator/consumer.h>
21 21
22struct regmap;
22struct regulator_dev; 23struct regulator_dev;
23struct regulator_init_data; 24struct regulator_init_data;
24 25
@@ -45,6 +46,7 @@ enum regulator_status {
45 * The driver should select the voltage closest to min_uV. 46 * The driver should select the voltage closest to min_uV.
46 * @set_voltage_sel: Set the voltage for the regulator using the specified 47 * @set_voltage_sel: Set the voltage for the regulator using the specified
47 * selector. 48 * selector.
49 * @map_voltage: Convert a voltage into a selector
48 * @get_voltage: Return the currently configured voltage for the regulator. 50 * @get_voltage: Return the currently configured voltage for the regulator.
49 * @get_voltage_sel: Return the currently configured voltage selector for the 51 * @get_voltage_sel: Return the currently configured voltage selector for the
50 * regulator. 52 * regulator.
@@ -90,6 +92,7 @@ struct regulator_ops {
90 /* get/set regulator voltage */ 92 /* get/set regulator voltage */
91 int (*set_voltage) (struct regulator_dev *, int min_uV, int max_uV, 93 int (*set_voltage) (struct regulator_dev *, int min_uV, int max_uV,
92 unsigned *selector); 94 unsigned *selector);
95 int (*map_voltage)(struct regulator_dev *, int min_uV, int max_uV);
93 int (*set_voltage_sel) (struct regulator_dev *, unsigned selector); 96 int (*set_voltage_sel) (struct regulator_dev *, unsigned selector);
94 int (*get_voltage) (struct regulator_dev *); 97 int (*get_voltage) (struct regulator_dev *);
95 int (*get_voltage_sel) (struct regulator_dev *); 98 int (*get_voltage_sel) (struct regulator_dev *);
@@ -148,19 +151,30 @@ enum regulator_type {
148}; 151};
149 152
150/** 153/**
151 * struct regulator_desc - Regulator descriptor 154 * struct regulator_desc - Static regulator descriptor
152 * 155 *
153 * Each regulator registered with the core is described with a structure of 156 * Each regulator registered with the core is described with a
154 * this type. 157 * structure of this type and a struct regulator_config. This
158 * structure contains the non-varying parts of the regulator
159 * description.
155 * 160 *
156 * @name: Identifying name for the regulator. 161 * @name: Identifying name for the regulator.
157 * @supply_name: Identifying the regulator supply 162 * @supply_name: Identifying the regulator supply
158 * @id: Numerical identifier for the regulator. 163 * @id: Numerical identifier for the regulator.
159 * @n_voltages: Number of selectors available for ops.list_voltage().
160 * @ops: Regulator operations table. 164 * @ops: Regulator operations table.
161 * @irq: Interrupt number for the regulator. 165 * @irq: Interrupt number for the regulator.
162 * @type: Indicates if the regulator is a voltage or current regulator. 166 * @type: Indicates if the regulator is a voltage or current regulator.
163 * @owner: Module providing the regulator, used for refcounting. 167 * @owner: Module providing the regulator, used for refcounting.
168 *
169 * @n_voltages: Number of selectors available for ops.list_voltage().
170 *
171 * @min_uV: Voltage given by the lowest selector (if linear mapping)
172 * @uV_step: Voltage increase with each selector (if linear mapping)
173 *
174 * @vsel_reg: Register for selector when using regulator_regmap_X_voltage_
175 * @vsel_mask: Mask for register bitfield used for selector
176 * @enable_reg: Register for control when using regmap enable/disable ops
177 * @enable_mask: Mask for control when using regmap enable/disable ops
164 */ 178 */
165struct regulator_desc { 179struct regulator_desc {
166 const char *name; 180 const char *name;
@@ -171,6 +185,36 @@ struct regulator_desc {
171 int irq; 185 int irq;
172 enum regulator_type type; 186 enum regulator_type type;
173 struct module *owner; 187 struct module *owner;
188
189 unsigned int min_uV;
190 unsigned int uV_step;
191
192 unsigned int vsel_reg;
193 unsigned int vsel_mask;
194 unsigned int enable_reg;
195 unsigned int enable_mask;
196};
197
198/**
199 * struct regulator_config - Dynamic regulator descriptor
200 *
201 * Each regulator registered with the core is described with a
202 * structure of this type and a struct regulator_desc. This structure
203 * contains the runtime variable parts of the regulator description.
204 *
205 * @dev: struct device for the regulator
206 * @init_data: platform provided init data, passed through by driver
207 * @driver_data: private regulator data
208 * @of_node: OpenFirmware node to parse for device tree bindings (may be
209 * NULL).
210 * @regmap: regmap to use for core regmap helpers
211 */
212struct regulator_config {
213 struct device *dev;
214 const struct regulator_init_data *init_data;
215 void *driver_data;
216 struct device_node *of_node;
217 struct regmap *regmap;
174}; 218};
175 219
176/* 220/*
@@ -184,7 +228,7 @@ struct regulator_desc {
184 * no other direct access). 228 * no other direct access).
185 */ 229 */
186struct regulator_dev { 230struct regulator_dev {
187 struct regulator_desc *desc; 231 const struct regulator_desc *desc;
188 int exclusive; 232 int exclusive;
189 u32 use_count; 233 u32 use_count;
190 u32 open_count; 234 u32 open_count;
@@ -201,6 +245,7 @@ struct regulator_dev {
201 struct device dev; 245 struct device dev;
202 struct regulation_constraints *constraints; 246 struct regulation_constraints *constraints;
203 struct regulator *supply; /* for tree */ 247 struct regulator *supply; /* for tree */
248 struct regmap *regmap;
204 249
205 struct delayed_work disable_work; 250 struct delayed_work disable_work;
206 int deferred_disables; 251 int deferred_disables;
@@ -210,9 +255,9 @@ struct regulator_dev {
210 struct dentry *debugfs; 255 struct dentry *debugfs;
211}; 256};
212 257
213struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc, 258struct regulator_dev *
214 struct device *dev, const struct regulator_init_data *init_data, 259regulator_register(const struct regulator_desc *regulator_desc,
215 void *driver_data, struct device_node *of_node); 260 const struct regulator_config *config);
216void regulator_unregister(struct regulator_dev *rdev); 261void regulator_unregister(struct regulator_dev *rdev);
217 262
218int regulator_notifier_call_chain(struct regulator_dev *rdev, 263int regulator_notifier_call_chain(struct regulator_dev *rdev,
@@ -224,6 +269,18 @@ int rdev_get_id(struct regulator_dev *rdev);
224 269
225int regulator_mode_to_status(unsigned int); 270int regulator_mode_to_status(unsigned int);
226 271
272int regulator_list_voltage_linear(struct regulator_dev *rdev,
273 unsigned int selector);
274int regulator_map_voltage_linear(struct regulator_dev *rdev,
275 int min_uV, int max_uV);
276int regulator_map_voltage_iterate(struct regulator_dev *rdev,
277 int min_uV, int max_uV);
278int regulator_get_voltage_sel_regmap(struct regulator_dev *rdev);
279int regulator_set_voltage_sel_regmap(struct regulator_dev *rdev, unsigned sel);
280int regulator_is_enabled_regmap(struct regulator_dev *rdev);
281int regulator_enable_regmap(struct regulator_dev *rdev);
282int regulator_disable_regmap(struct regulator_dev *rdev);
283
227void *regulator_get_init_drvdata(struct regulator_init_data *reg_init_data); 284void *regulator_get_init_drvdata(struct regulator_init_data *reg_init_data);
228 285
229#endif 286#endif
diff --git a/include/linux/regulator/fixed.h b/include/linux/regulator/fixed.h
index 936a7d8c11a9..f83f7440b488 100644
--- a/include/linux/regulator/fixed.h
+++ b/include/linux/regulator/fixed.h
@@ -26,6 +26,12 @@ struct regulator_init_data;
26 * @gpio: GPIO to use for enable control 26 * @gpio: GPIO to use for enable control
27 * set to -EINVAL if not used 27 * set to -EINVAL if not used
28 * @startup_delay: Start-up time in microseconds 28 * @startup_delay: Start-up time in microseconds
29 * @gpio_is_open_drain: Gpio pin is open drain or normal type.
30 * If it is open drain type then HIGH will be set
31 * through PULL-UP with setting gpio as input
32 * and low will be set as gpio-output with driven
33 * to low. For non-open-drain case, the gpio will
34 * will be in output and drive to low/high accordingly.
29 * @enable_high: Polarity of enable GPIO 35 * @enable_high: Polarity of enable GPIO
30 * 1 = Active high, 0 = Active low 36 * 1 = Active high, 0 = Active low
31 * @enabled_at_boot: Whether regulator has been enabled at 37 * @enabled_at_boot: Whether regulator has been enabled at
@@ -43,6 +49,7 @@ struct fixed_voltage_config {
43 int microvolts; 49 int microvolts;
44 int gpio; 50 int gpio;
45 unsigned startup_delay; 51 unsigned startup_delay;
52 unsigned gpio_is_open_drain:1;
46 unsigned enable_high:1; 53 unsigned enable_high:1;
47 unsigned enabled_at_boot:1; 54 unsigned enabled_at_boot:1;
48 struct regulator_init_data *init_data; 55 struct regulator_init_data *init_data;
diff --git a/include/linux/regulator/of_regulator.h b/include/linux/regulator/of_regulator.h
index 769704f296e5..f9217965aaa3 100644
--- a/include/linux/regulator/of_regulator.h
+++ b/include/linux/regulator/of_regulator.h
@@ -6,10 +6,20 @@
6#ifndef __LINUX_OF_REG_H 6#ifndef __LINUX_OF_REG_H
7#define __LINUX_OF_REG_H 7#define __LINUX_OF_REG_H
8 8
9struct of_regulator_match {
10 const char *name;
11 void *driver_data;
12 struct regulator_init_data *init_data;
13 struct device_node *of_node;
14};
15
9#if defined(CONFIG_OF) 16#if defined(CONFIG_OF)
10extern struct regulator_init_data 17extern struct regulator_init_data
11 *of_get_regulator_init_data(struct device *dev, 18 *of_get_regulator_init_data(struct device *dev,
12 struct device_node *node); 19 struct device_node *node);
20extern int of_regulator_match(struct device *dev, struct device_node *node,
21 struct of_regulator_match *matches,
22 unsigned int num_matches);
13#else 23#else
14static inline struct regulator_init_data 24static inline struct regulator_init_data
15 *of_get_regulator_init_data(struct device *dev, 25 *of_get_regulator_init_data(struct device *dev,
@@ -17,6 +27,14 @@ static inline struct regulator_init_data
17{ 27{
18 return NULL; 28 return NULL;
19} 29}
30
31static inline int of_regulator_match(struct device *dev,
32 struct device_node *node,
33 struct of_regulator_match *matches,
34 unsigned int num_matches)
35{
36 return 0;
37}
20#endif /* CONFIG_OF */ 38#endif /* CONFIG_OF */
21 39
22#endif /* __LINUX_OF_REG_H */ 40#endif /* __LINUX_OF_REG_H */
diff --git a/include/linux/regulator/tps62360.h b/include/linux/regulator/tps62360.h
index 6a5c1b2c751e..a4c49394c497 100644
--- a/include/linux/regulator/tps62360.h
+++ b/include/linux/regulator/tps62360.h
@@ -26,13 +26,10 @@
26#ifndef __LINUX_REGULATOR_TPS62360_H 26#ifndef __LINUX_REGULATOR_TPS62360_H
27#define __LINUX_REGULATOR_TPS62360_H 27#define __LINUX_REGULATOR_TPS62360_H
28 28
29#include <linux/regulator/machine.h>
30
31/* 29/*
32 * struct tps62360_regulator_platform_data - tps62360 regulator platform data. 30 * struct tps62360_regulator_platform_data - tps62360 regulator platform data.
33 * 31 *
34 * @reg_init_data: The regulator init data. 32 * @reg_init_data: The regulator init data.
35 * @en_force_pwm: Enable force pwm or not.
36 * @en_discharge: Enable discharge the output capacitor via internal 33 * @en_discharge: Enable discharge the output capacitor via internal
37 * register. 34 * register.
38 * @en_internal_pulldn: internal pull down enable or not. 35 * @en_internal_pulldn: internal pull down enable or not.
@@ -44,8 +41,7 @@
44 * @vsel1_def_state: Default state of vsel1. 1 if it is high else 0. 41 * @vsel1_def_state: Default state of vsel1. 1 if it is high else 0.
45 */ 42 */
46struct tps62360_regulator_platform_data { 43struct tps62360_regulator_platform_data {
47 struct regulator_init_data reg_init_data; 44 struct regulator_init_data *reg_init_data;
48 bool en_force_pwm;
49 bool en_discharge; 45 bool en_discharge;
50 bool en_internal_pulldn; 46 bool en_internal_pulldn;
51 int vsel0_gpio; 47 int vsel0_gpio;
diff --git a/include/linux/regulator/tps65090-regulator.h b/include/linux/regulator/tps65090-regulator.h
new file mode 100644
index 000000000000..0fa04b64db3e
--- /dev/null
+++ b/include/linux/regulator/tps65090-regulator.h
@@ -0,0 +1,50 @@
1/*
2 * Regulator driver interface for TI TPS65090 PMIC family
3 *
4 * Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved.
5
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License,
8 * version 2, as published by the Free Software Foundation.
9
10 * This program is distributed in the hope it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#ifndef __REGULATOR_TPS65090_H
20#define __REGULATOR_TPS65090_H
21
22#include <linux/regulator/machine.h>
23
24#define tps65090_rails(_name) "tps65090_"#_name
25
26enum {
27 TPS65090_ID_DCDC1,
28 TPS65090_ID_DCDC2,
29 TPS65090_ID_DCDC3,
30 TPS65090_ID_FET1,
31 TPS65090_ID_FET2,
32 TPS65090_ID_FET3,
33 TPS65090_ID_FET4,
34 TPS65090_ID_FET5,
35 TPS65090_ID_FET6,
36 TPS65090_ID_FET7,
37};
38
39/*
40 * struct tps65090_regulator_platform_data
41 *
42 * @regulator: The regulator init data.
43 * @slew_rate_uV_per_us: Slew rate microvolt per microsec.
44 */
45
46struct tps65090_regulator_platform_data {
47 struct regulator_init_data regulator;
48};
49
50#endif /* __REGULATOR_TPS65090_H */
diff --git a/include/linux/res_counter.h b/include/linux/res_counter.h
index da81af086eaf..fb201896a8b0 100644
--- a/include/linux/res_counter.h
+++ b/include/linux/res_counter.h
@@ -116,7 +116,7 @@ void res_counter_init(struct res_counter *counter, struct res_counter *parent);
116 */ 116 */
117 117
118int __must_check res_counter_charge_locked(struct res_counter *counter, 118int __must_check res_counter_charge_locked(struct res_counter *counter,
119 unsigned long val); 119 unsigned long val, bool force);
120int __must_check res_counter_charge(struct res_counter *counter, 120int __must_check res_counter_charge(struct res_counter *counter,
121 unsigned long val, struct res_counter **limit_fail_at); 121 unsigned long val, struct res_counter **limit_fail_at);
122int __must_check res_counter_charge_nofail(struct res_counter *counter, 122int __must_check res_counter_charge_nofail(struct res_counter *counter,
diff --git a/include/linux/ring_buffer.h b/include/linux/ring_buffer.h
index 7be2e88f23fd..6c8835f74f79 100644
--- a/include/linux/ring_buffer.h
+++ b/include/linux/ring_buffer.h
@@ -96,9 +96,11 @@ __ring_buffer_alloc(unsigned long size, unsigned flags, struct lock_class_key *k
96 __ring_buffer_alloc((size), (flags), &__key); \ 96 __ring_buffer_alloc((size), (flags), &__key); \
97}) 97})
98 98
99#define RING_BUFFER_ALL_CPUS -1
100
99void ring_buffer_free(struct ring_buffer *buffer); 101void ring_buffer_free(struct ring_buffer *buffer);
100 102
101int ring_buffer_resize(struct ring_buffer *buffer, unsigned long size); 103int ring_buffer_resize(struct ring_buffer *buffer, unsigned long size, int cpu);
102 104
103void ring_buffer_change_overwrite(struct ring_buffer *buffer, int val); 105void ring_buffer_change_overwrite(struct ring_buffer *buffer, int val);
104 106
@@ -129,7 +131,7 @@ ring_buffer_read(struct ring_buffer_iter *iter, u64 *ts);
129void ring_buffer_iter_reset(struct ring_buffer_iter *iter); 131void ring_buffer_iter_reset(struct ring_buffer_iter *iter);
130int ring_buffer_iter_empty(struct ring_buffer_iter *iter); 132int ring_buffer_iter_empty(struct ring_buffer_iter *iter);
131 133
132unsigned long ring_buffer_size(struct ring_buffer *buffer); 134unsigned long ring_buffer_size(struct ring_buffer *buffer, int cpu);
133 135
134void ring_buffer_reset_cpu(struct ring_buffer *buffer, int cpu); 136void ring_buffer_reset_cpu(struct ring_buffer *buffer, int cpu);
135void ring_buffer_reset(struct ring_buffer *buffer); 137void ring_buffer_reset(struct ring_buffer *buffer);
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 81a173c0897d..28fa9d02fd59 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -855,61 +855,14 @@ enum cpu_idle_type {
855#define SD_WAKE_AFFINE 0x0020 /* Wake task to waking CPU */ 855#define SD_WAKE_AFFINE 0x0020 /* Wake task to waking CPU */
856#define SD_PREFER_LOCAL 0x0040 /* Prefer to keep tasks local to this domain */ 856#define SD_PREFER_LOCAL 0x0040 /* Prefer to keep tasks local to this domain */
857#define SD_SHARE_CPUPOWER 0x0080 /* Domain members share cpu power */ 857#define SD_SHARE_CPUPOWER 0x0080 /* Domain members share cpu power */
858#define SD_POWERSAVINGS_BALANCE 0x0100 /* Balance for power savings */
859#define SD_SHARE_PKG_RESOURCES 0x0200 /* Domain members share cpu pkg resources */ 858#define SD_SHARE_PKG_RESOURCES 0x0200 /* Domain members share cpu pkg resources */
860#define SD_SERIALIZE 0x0400 /* Only a single load balancing instance */ 859#define SD_SERIALIZE 0x0400 /* Only a single load balancing instance */
861#define SD_ASYM_PACKING 0x0800 /* Place busy groups earlier in the domain */ 860#define SD_ASYM_PACKING 0x0800 /* Place busy groups earlier in the domain */
862#define SD_PREFER_SIBLING 0x1000 /* Prefer to place tasks in a sibling domain */ 861#define SD_PREFER_SIBLING 0x1000 /* Prefer to place tasks in a sibling domain */
863#define SD_OVERLAP 0x2000 /* sched_domains of this level overlap */ 862#define SD_OVERLAP 0x2000 /* sched_domains of this level overlap */
864 863
865enum powersavings_balance_level {
866 POWERSAVINGS_BALANCE_NONE = 0, /* No power saving load balance */
867 POWERSAVINGS_BALANCE_BASIC, /* Fill one thread/core/package
868 * first for long running threads
869 */
870 POWERSAVINGS_BALANCE_WAKEUP, /* Also bias task wakeups to semi-idle
871 * cpu package for power savings
872 */
873 MAX_POWERSAVINGS_BALANCE_LEVELS
874};
875
876extern int sched_mc_power_savings, sched_smt_power_savings;
877
878static inline int sd_balance_for_mc_power(void)
879{
880 if (sched_smt_power_savings)
881 return SD_POWERSAVINGS_BALANCE;
882
883 if (!sched_mc_power_savings)
884 return SD_PREFER_SIBLING;
885
886 return 0;
887}
888
889static inline int sd_balance_for_package_power(void)
890{
891 if (sched_mc_power_savings | sched_smt_power_savings)
892 return SD_POWERSAVINGS_BALANCE;
893
894 return SD_PREFER_SIBLING;
895}
896
897extern int __weak arch_sd_sibiling_asym_packing(void); 864extern int __weak arch_sd_sibiling_asym_packing(void);
898 865
899/*
900 * Optimise SD flags for power savings:
901 * SD_BALANCE_NEWIDLE helps aggressive task consolidation and power savings.
902 * Keep default SD flags if sched_{smt,mc}_power_saving=0
903 */
904
905static inline int sd_power_saving_flags(void)
906{
907 if (sched_mc_power_savings | sched_smt_power_savings)
908 return SD_BALANCE_NEWIDLE;
909
910 return 0;
911}
912
913struct sched_group_power { 866struct sched_group_power {
914 atomic_t ref; 867 atomic_t ref;
915 /* 868 /*
@@ -1341,6 +1294,8 @@ struct task_struct {
1341 * execve */ 1294 * execve */
1342 unsigned in_iowait:1; 1295 unsigned in_iowait:1;
1343 1296
1297 /* task may not gain privileges */
1298 unsigned no_new_privs:1;
1344 1299
1345 /* Revert to default priority/policy when forking */ 1300 /* Revert to default priority/policy when forking */
1346 unsigned sched_reset_on_fork:1; 1301 unsigned sched_reset_on_fork:1;
@@ -1450,7 +1405,7 @@ struct task_struct {
1450 uid_t loginuid; 1405 uid_t loginuid;
1451 unsigned int sessionid; 1406 unsigned int sessionid;
1452#endif 1407#endif
1453 seccomp_t seccomp; 1408 struct seccomp seccomp;
1454 1409
1455/* Thread group tracking */ 1410/* Thread group tracking */
1456 u32 parent_exec_id; 1411 u32 parent_exec_id;
@@ -1905,12 +1860,22 @@ static inline void rcu_copy_process(struct task_struct *p)
1905 INIT_LIST_HEAD(&p->rcu_node_entry); 1860 INIT_LIST_HEAD(&p->rcu_node_entry);
1906} 1861}
1907 1862
1863static inline void rcu_switch_from(struct task_struct *prev)
1864{
1865 if (prev->rcu_read_lock_nesting != 0)
1866 rcu_preempt_note_context_switch();
1867}
1868
1908#else 1869#else
1909 1870
1910static inline void rcu_copy_process(struct task_struct *p) 1871static inline void rcu_copy_process(struct task_struct *p)
1911{ 1872{
1912} 1873}
1913 1874
1875static inline void rcu_switch_from(struct task_struct *prev)
1876{
1877}
1878
1914#endif 1879#endif
1915 1880
1916#ifdef CONFIG_SMP 1881#ifdef CONFIG_SMP
@@ -1950,7 +1915,7 @@ static inline int set_cpus_allowed(struct task_struct *p, cpumask_t new_mask)
1950 */ 1915 */
1951extern unsigned long long notrace sched_clock(void); 1916extern unsigned long long notrace sched_clock(void);
1952/* 1917/*
1953 * See the comment in kernel/sched_clock.c 1918 * See the comment in kernel/sched/clock.c
1954 */ 1919 */
1955extern u64 cpu_clock(int cpu); 1920extern u64 cpu_clock(int cpu);
1956extern u64 local_clock(void); 1921extern u64 local_clock(void);
diff --git a/include/linux/seccomp.h b/include/linux/seccomp.h
index cc7a4e9cc7ad..84f6320da50f 100644
--- a/include/linux/seccomp.h
+++ b/include/linux/seccomp.h
@@ -1,25 +1,90 @@
1#ifndef _LINUX_SECCOMP_H 1#ifndef _LINUX_SECCOMP_H
2#define _LINUX_SECCOMP_H 2#define _LINUX_SECCOMP_H
3 3
4 4#include <linux/compiler.h>
5#include <linux/types.h>
6
7
8/* Valid values for seccomp.mode and prctl(PR_SET_SECCOMP, <mode>) */
9#define SECCOMP_MODE_DISABLED 0 /* seccomp is not in use. */
10#define SECCOMP_MODE_STRICT 1 /* uses hard-coded filter. */
11#define SECCOMP_MODE_FILTER 2 /* uses user-supplied filter. */
12
13/*
14 * All BPF programs must return a 32-bit value.
15 * The bottom 16-bits are for optional return data.
16 * The upper 16-bits are ordered from least permissive values to most.
17 *
18 * The ordering ensures that a min_t() over composed return values always
19 * selects the least permissive choice.
20 */
21#define SECCOMP_RET_KILL 0x00000000U /* kill the task immediately */
22#define SECCOMP_RET_TRAP 0x00030000U /* disallow and force a SIGSYS */
23#define SECCOMP_RET_ERRNO 0x00050000U /* returns an errno */
24#define SECCOMP_RET_TRACE 0x7ff00000U /* pass to a tracer or disallow */
25#define SECCOMP_RET_ALLOW 0x7fff0000U /* allow */
26
27/* Masks for the return value sections. */
28#define SECCOMP_RET_ACTION 0x7fff0000U
29#define SECCOMP_RET_DATA 0x0000ffffU
30
31/**
32 * struct seccomp_data - the format the BPF program executes over.
33 * @nr: the system call number
34 * @arch: indicates system call convention as an AUDIT_ARCH_* value
35 * as defined in <linux/audit.h>.
36 * @instruction_pointer: at the time of the system call.
37 * @args: up to 6 system call arguments always stored as 64-bit values
38 * regardless of the architecture.
39 */
40struct seccomp_data {
41 int nr;
42 __u32 arch;
43 __u64 instruction_pointer;
44 __u64 args[6];
45};
46
47#ifdef __KERNEL__
5#ifdef CONFIG_SECCOMP 48#ifdef CONFIG_SECCOMP
6 49
7#include <linux/thread_info.h> 50#include <linux/thread_info.h>
8#include <asm/seccomp.h> 51#include <asm/seccomp.h>
9 52
10typedef struct { int mode; } seccomp_t; 53struct seccomp_filter;
11 54/**
12extern void __secure_computing(int); 55 * struct seccomp - the state of a seccomp'ed process
13static inline void secure_computing(int this_syscall) 56 *
57 * @mode: indicates one of the valid values above for controlled
58 * system calls available to a process.
59 * @filter: The metadata and ruleset for determining what system calls
60 * are allowed for a task.
61 *
62 * @filter must only be accessed from the context of current as there
63 * is no locking.
64 */
65struct seccomp {
66 int mode;
67 struct seccomp_filter *filter;
68};
69
70extern int __secure_computing(int);
71static inline int secure_computing(int this_syscall)
14{ 72{
15 if (unlikely(test_thread_flag(TIF_SECCOMP))) 73 if (unlikely(test_thread_flag(TIF_SECCOMP)))
16 __secure_computing(this_syscall); 74 return __secure_computing(this_syscall);
75 return 0;
76}
77
78/* A wrapper for architectures supporting only SECCOMP_MODE_STRICT. */
79static inline void secure_computing_strict(int this_syscall)
80{
81 BUG_ON(secure_computing(this_syscall) != 0);
17} 82}
18 83
19extern long prctl_get_seccomp(void); 84extern long prctl_get_seccomp(void);
20extern long prctl_set_seccomp(unsigned long); 85extern long prctl_set_seccomp(unsigned long, char __user *);
21 86
22static inline int seccomp_mode(seccomp_t *s) 87static inline int seccomp_mode(struct seccomp *s)
23{ 88{
24 return s->mode; 89 return s->mode;
25} 90}
@@ -28,25 +93,41 @@ static inline int seccomp_mode(seccomp_t *s)
28 93
29#include <linux/errno.h> 94#include <linux/errno.h>
30 95
31typedef struct { } seccomp_t; 96struct seccomp { };
97struct seccomp_filter { };
32 98
33#define secure_computing(x) do { } while (0) 99static inline int secure_computing(int this_syscall) { return 0; }
100static inline void secure_computing_strict(int this_syscall) { return; }
34 101
35static inline long prctl_get_seccomp(void) 102static inline long prctl_get_seccomp(void)
36{ 103{
37 return -EINVAL; 104 return -EINVAL;
38} 105}
39 106
40static inline long prctl_set_seccomp(unsigned long arg2) 107static inline long prctl_set_seccomp(unsigned long arg2, char __user *arg3)
41{ 108{
42 return -EINVAL; 109 return -EINVAL;
43} 110}
44 111
45static inline int seccomp_mode(seccomp_t *s) 112static inline int seccomp_mode(struct seccomp *s)
46{ 113{
47 return 0; 114 return 0;
48} 115}
49
50#endif /* CONFIG_SECCOMP */ 116#endif /* CONFIG_SECCOMP */
51 117
118#ifdef CONFIG_SECCOMP_FILTER
119extern void put_seccomp_filter(struct task_struct *tsk);
120extern void get_seccomp_filter(struct task_struct *tsk);
121extern u32 seccomp_bpf_load(int off);
122#else /* CONFIG_SECCOMP_FILTER */
123static inline void put_seccomp_filter(struct task_struct *tsk)
124{
125 return;
126}
127static inline void get_seccomp_filter(struct task_struct *tsk)
128{
129 return;
130}
131#endif /* CONFIG_SECCOMP_FILTER */
132#endif /* __KERNEL__ */
52#endif /* _LINUX_SECCOMP_H */ 133#endif /* _LINUX_SECCOMP_H */
diff --git a/include/linux/security.h b/include/linux/security.h
index 673afbb8238a..ab0e091ce5fa 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -144,6 +144,7 @@ struct request_sock;
144#define LSM_UNSAFE_SHARE 1 144#define LSM_UNSAFE_SHARE 1
145#define LSM_UNSAFE_PTRACE 2 145#define LSM_UNSAFE_PTRACE 2
146#define LSM_UNSAFE_PTRACE_CAP 4 146#define LSM_UNSAFE_PTRACE_CAP 4
147#define LSM_UNSAFE_NO_NEW_PRIVS 8
147 148
148#ifdef CONFIG_MMU 149#ifdef CONFIG_MMU
149extern int mmap_min_addr_handler(struct ctl_table *table, int write, 150extern int mmap_min_addr_handler(struct ctl_table *table, int write,
@@ -639,10 +640,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
639 * to receive an open file descriptor via socket IPC. 640 * to receive an open file descriptor via socket IPC.
640 * @file contains the file structure being received. 641 * @file contains the file structure being received.
641 * Return 0 if permission is granted. 642 * Return 0 if permission is granted.
642 * 643 * @file_open
643 * Security hook for dentry
644 *
645 * @dentry_open
646 * Save open-time permission checking state for later use upon 644 * Save open-time permission checking state for later use upon
647 * file_permission, and recheck access if anything has changed 645 * file_permission, and recheck access if anything has changed
648 * since inode_permission. 646 * since inode_permission.
@@ -1497,7 +1495,7 @@ struct security_operations {
1497 int (*file_send_sigiotask) (struct task_struct *tsk, 1495 int (*file_send_sigiotask) (struct task_struct *tsk,
1498 struct fown_struct *fown, int sig); 1496 struct fown_struct *fown, int sig);
1499 int (*file_receive) (struct file *file); 1497 int (*file_receive) (struct file *file);
1500 int (*dentry_open) (struct file *file, const struct cred *cred); 1498 int (*file_open) (struct file *file, const struct cred *cred);
1501 1499
1502 int (*task_create) (unsigned long clone_flags); 1500 int (*task_create) (unsigned long clone_flags);
1503 void (*task_free) (struct task_struct *task); 1501 void (*task_free) (struct task_struct *task);
@@ -1756,7 +1754,7 @@ int security_file_set_fowner(struct file *file);
1756int security_file_send_sigiotask(struct task_struct *tsk, 1754int security_file_send_sigiotask(struct task_struct *tsk,
1757 struct fown_struct *fown, int sig); 1755 struct fown_struct *fown, int sig);
1758int security_file_receive(struct file *file); 1756int security_file_receive(struct file *file);
1759int security_dentry_open(struct file *file, const struct cred *cred); 1757int security_file_open(struct file *file, const struct cred *cred);
1760int security_task_create(unsigned long clone_flags); 1758int security_task_create(unsigned long clone_flags);
1761void security_task_free(struct task_struct *task); 1759void security_task_free(struct task_struct *task);
1762int security_cred_alloc_blank(struct cred *cred, gfp_t gfp); 1760int security_cred_alloc_blank(struct cred *cred, gfp_t gfp);
@@ -2227,8 +2225,8 @@ static inline int security_file_receive(struct file *file)
2227 return 0; 2225 return 0;
2228} 2226}
2229 2227
2230static inline int security_dentry_open(struct file *file, 2228static inline int security_file_open(struct file *file,
2231 const struct cred *cred) 2229 const struct cred *cred)
2232{ 2230{
2233 return 0; 2231 return 0;
2234} 2232}
diff --git a/include/linux/serial_8250.h b/include/linux/serial_8250.h
index 6c5047dbfea3..a416e92012ef 100644
--- a/include/linux/serial_8250.h
+++ b/include/linux/serial_8250.h
@@ -38,6 +38,7 @@ struct plat_serial8250_port {
38 int (*handle_irq)(struct uart_port *); 38 int (*handle_irq)(struct uart_port *);
39 void (*pm)(struct uart_port *, unsigned int state, 39 void (*pm)(struct uart_port *, unsigned int state,
40 unsigned old); 40 unsigned old);
41 void (*handle_break)(struct uart_port *);
41}; 42};
42 43
43/* 44/*
@@ -67,6 +68,7 @@ enum {
67struct uart_port; 68struct uart_port;
68struct uart_8250_port; 69struct uart_8250_port;
69 70
71int serial8250_register_8250_port(struct uart_8250_port *);
70int serial8250_register_port(struct uart_port *); 72int serial8250_register_port(struct uart_port *);
71void serial8250_unregister_port(int line); 73void serial8250_unregister_port(int line);
72void serial8250_suspend_port(int line); 74void serial8250_suspend_port(int line);
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index 2db407a40051..65db9928e15f 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -310,6 +310,7 @@ struct uart_port {
310 int (*handle_irq)(struct uart_port *); 310 int (*handle_irq)(struct uart_port *);
311 void (*pm)(struct uart_port *, unsigned int state, 311 void (*pm)(struct uart_port *, unsigned int state,
312 unsigned int old); 312 unsigned int old);
313 void (*handle_break)(struct uart_port *);
313 unsigned int irq; /* irq number */ 314 unsigned int irq; /* irq number */
314 unsigned long irqflags; /* irq flags */ 315 unsigned long irqflags; /* irq flags */
315 unsigned int uartclk; /* base uart clock */ 316 unsigned int uartclk; /* base uart clock */
@@ -533,6 +534,10 @@ uart_handle_sysrq_char(struct uart_port *port, unsigned int ch)
533static inline int uart_handle_break(struct uart_port *port) 534static inline int uart_handle_break(struct uart_port *port)
534{ 535{
535 struct uart_state *state = port->state; 536 struct uart_state *state = port->state;
537
538 if (port->handle_break)
539 port->handle_break(port);
540
536#ifdef SUPPORT_SYSRQ 541#ifdef SUPPORT_SYSRQ
537 if (port->cons && port->cons->index == port->line) { 542 if (port->cons && port->cons->index == port->line) {
538 if (!port->sysrq) { 543 if (!port->sysrq) {
diff --git a/include/linux/serial_sci.h b/include/linux/serial_sci.h
index 78779074f6e8..eb763adf9815 100644
--- a/include/linux/serial_sci.h
+++ b/include/linux/serial_sci.h
@@ -52,6 +52,8 @@ enum {
52/* SCSPTR, optional */ 52/* SCSPTR, optional */
53#define SCSPTR_RTSIO (1 << 7) 53#define SCSPTR_RTSIO (1 << 7)
54#define SCSPTR_CTSIO (1 << 5) 54#define SCSPTR_CTSIO (1 << 5)
55#define SCSPTR_SPB2IO (1 << 1)
56#define SCSPTR_SPB2DT (1 << 0)
55 57
56/* Offsets into the sci_port->irqs array */ 58/* Offsets into the sci_port->irqs array */
57enum { 59enum {
diff --git a/include/linux/sh_clk.h b/include/linux/sh_clk.h
index 0a9d8f2ac519..c513b73cd7cb 100644
--- a/include/linux/sh_clk.h
+++ b/include/linux/sh_clk.h
@@ -59,7 +59,15 @@ struct clk {
59 unsigned int nr_freqs; 59 unsigned int nr_freqs;
60}; 60};
61 61
62#define CLK_ENABLE_ON_INIT (1 << 0) 62#define CLK_ENABLE_ON_INIT BIT(0)
63
64#define CLK_ENABLE_REG_32BIT BIT(1) /* default access size */
65#define CLK_ENABLE_REG_16BIT BIT(2)
66#define CLK_ENABLE_REG_8BIT BIT(3)
67
68#define CLK_ENABLE_REG_MASK (CLK_ENABLE_REG_32BIT | \
69 CLK_ENABLE_REG_16BIT | \
70 CLK_ENABLE_REG_8BIT)
63 71
64/* drivers/sh/clk.c */ 72/* drivers/sh/clk.c */
65unsigned long followparent_recalc(struct clk *); 73unsigned long followparent_recalc(struct clk *);
@@ -102,7 +110,7 @@ long clk_round_parent(struct clk *clk, unsigned long target,
102 unsigned long *best_freq, unsigned long *parent_freq, 110 unsigned long *best_freq, unsigned long *parent_freq,
103 unsigned int div_min, unsigned int div_max); 111 unsigned int div_min, unsigned int div_max);
104 112
105#define SH_CLK_MSTP32(_parent, _enable_reg, _enable_bit, _flags) \ 113#define SH_CLK_MSTP(_parent, _enable_reg, _enable_bit, _flags) \
106{ \ 114{ \
107 .parent = _parent, \ 115 .parent = _parent, \
108 .enable_reg = (void __iomem *)_enable_reg, \ 116 .enable_reg = (void __iomem *)_enable_reg, \
@@ -110,7 +118,27 @@ long clk_round_parent(struct clk *clk, unsigned long target,
110 .flags = _flags, \ 118 .flags = _flags, \
111} 119}
112 120
113int sh_clk_mstp32_register(struct clk *clks, int nr); 121#define SH_CLK_MSTP32(_p, _r, _b, _f) \
122 SH_CLK_MSTP(_p, _r, _b, _f | CLK_ENABLE_REG_32BIT)
123
124#define SH_CLK_MSTP16(_p, _r, _b, _f) \
125 SH_CLK_MSTP(_p, _r, _b, _f | CLK_ENABLE_REG_16BIT)
126
127#define SH_CLK_MSTP8(_p, _r, _b, _f) \
128 SH_CLK_MSTP(_p, _r, _b, _f | CLK_ENABLE_REG_8BIT)
129
130int sh_clk_mstp_register(struct clk *clks, int nr);
131
132/*
133 * MSTP registration never really cared about access size, despite the
134 * original enable/disable pairs assuming a 32-bit access. Clocks are
135 * responsible for defining their access sizes either directly or via the
136 * clock definition wrappers.
137 */
138static inline int __deprecated sh_clk_mstp32_register(struct clk *clks, int nr)
139{
140 return sh_clk_mstp_register(clks, nr);
141}
114 142
115#define SH_CLK_DIV4(_parent, _reg, _shift, _div_bitmap, _flags) \ 143#define SH_CLK_DIV4(_parent, _reg, _shift, _div_bitmap, _flags) \
116{ \ 144{ \
diff --git a/include/linux/sh_intc.h b/include/linux/sh_intc.h
index 6aed0805927f..32383285da68 100644
--- a/include/linux/sh_intc.h
+++ b/include/linux/sh_intc.h
@@ -133,7 +133,6 @@ struct intc_desc symbol __initdata = { \
133} 133}
134 134
135int register_intc_controller(struct intc_desc *desc); 135int register_intc_controller(struct intc_desc *desc);
136void reserve_intc_vectors(struct intc_vect *vectors, unsigned int nr_vecs);
137int intc_set_priority(unsigned int irq, unsigned int prio); 136int intc_set_priority(unsigned int irq, unsigned int prio);
138int intc_irq_lookup(const char *chipname, intc_enum enum_id); 137int intc_irq_lookup(const char *chipname, intc_enum enum_id);
139void intc_finalize(void); 138void intc_finalize(void);
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index bb47314c7179..0e501714d47f 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -562,6 +562,11 @@ extern void kfree_skb(struct sk_buff *skb);
562extern void consume_skb(struct sk_buff *skb); 562extern void consume_skb(struct sk_buff *skb);
563extern void __kfree_skb(struct sk_buff *skb); 563extern void __kfree_skb(struct sk_buff *skb);
564extern struct kmem_cache *skbuff_head_cache; 564extern struct kmem_cache *skbuff_head_cache;
565
566extern void kfree_skb_partial(struct sk_buff *skb, bool head_stolen);
567extern bool skb_try_coalesce(struct sk_buff *to, struct sk_buff *from,
568 bool *fragstolen, int *delta_truesize);
569
565extern struct sk_buff *__alloc_skb(unsigned int size, 570extern struct sk_buff *__alloc_skb(unsigned int size,
566 gfp_t priority, int fclone, int node); 571 gfp_t priority, int fclone, int node);
567extern struct sk_buff *build_skb(void *data, unsigned int frag_size); 572extern struct sk_buff *build_skb(void *data, unsigned int frag_size);
@@ -1680,31 +1685,11 @@ static inline void __skb_queue_purge(struct sk_buff_head *list)
1680 kfree_skb(skb); 1685 kfree_skb(skb);
1681} 1686}
1682 1687
1683/** 1688extern void *netdev_alloc_frag(unsigned int fragsz);
1684 * __dev_alloc_skb - allocate an skbuff for receiving
1685 * @length: length to allocate
1686 * @gfp_mask: get_free_pages mask, passed to alloc_skb
1687 *
1688 * Allocate a new &sk_buff and assign it a usage count of one. The
1689 * buffer has unspecified headroom built in. Users should allocate
1690 * the headroom they think they need without accounting for the
1691 * built in space. The built in space is used for optimisations.
1692 *
1693 * %NULL is returned if there is no free memory.
1694 */
1695static inline struct sk_buff *__dev_alloc_skb(unsigned int length,
1696 gfp_t gfp_mask)
1697{
1698 struct sk_buff *skb = alloc_skb(length + NET_SKB_PAD, gfp_mask);
1699 if (likely(skb))
1700 skb_reserve(skb, NET_SKB_PAD);
1701 return skb;
1702}
1703
1704extern struct sk_buff *dev_alloc_skb(unsigned int length);
1705 1689
1706extern struct sk_buff *__netdev_alloc_skb(struct net_device *dev, 1690extern struct sk_buff *__netdev_alloc_skb(struct net_device *dev,
1707 unsigned int length, gfp_t gfp_mask); 1691 unsigned int length,
1692 gfp_t gfp_mask);
1708 1693
1709/** 1694/**
1710 * netdev_alloc_skb - allocate an skbuff for rx on a specific device 1695 * netdev_alloc_skb - allocate an skbuff for rx on a specific device
@@ -1720,11 +1705,25 @@ extern struct sk_buff *__netdev_alloc_skb(struct net_device *dev,
1720 * allocates memory it can be called from an interrupt. 1705 * allocates memory it can be called from an interrupt.
1721 */ 1706 */
1722static inline struct sk_buff *netdev_alloc_skb(struct net_device *dev, 1707static inline struct sk_buff *netdev_alloc_skb(struct net_device *dev,
1723 unsigned int length) 1708 unsigned int length)
1724{ 1709{
1725 return __netdev_alloc_skb(dev, length, GFP_ATOMIC); 1710 return __netdev_alloc_skb(dev, length, GFP_ATOMIC);
1726} 1711}
1727 1712
1713/* legacy helper around __netdev_alloc_skb() */
1714static inline struct sk_buff *__dev_alloc_skb(unsigned int length,
1715 gfp_t gfp_mask)
1716{
1717 return __netdev_alloc_skb(NULL, length, gfp_mask);
1718}
1719
1720/* legacy helper around netdev_alloc_skb() */
1721static inline struct sk_buff *dev_alloc_skb(unsigned int length)
1722{
1723 return netdev_alloc_skb(NULL, length);
1724}
1725
1726
1728static inline struct sk_buff *__netdev_alloc_skb_ip_align(struct net_device *dev, 1727static inline struct sk_buff *__netdev_alloc_skb_ip_align(struct net_device *dev,
1729 unsigned int length, gfp_t gfp) 1728 unsigned int length, gfp_t gfp)
1730{ 1729{
diff --git a/include/linux/smp.h b/include/linux/smp.h
index 10530d92c04b..717fb746c9a8 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -61,7 +61,7 @@ extern void smp_prepare_cpus(unsigned int max_cpus);
61/* 61/*
62 * Bring a CPU up 62 * Bring a CPU up
63 */ 63 */
64extern int __cpu_up(unsigned int cpunum); 64extern int __cpu_up(unsigned int cpunum, struct task_struct *tidle);
65 65
66/* 66/*
67 * Final polishing of CPUs 67 * Final polishing of CPUs
@@ -81,6 +81,8 @@ void __smp_call_function_single(int cpuid, struct call_single_data *data,
81int smp_call_function_any(const struct cpumask *mask, 81int smp_call_function_any(const struct cpumask *mask,
82 smp_call_func_t func, void *info, int wait); 82 smp_call_func_t func, void *info, int wait);
83 83
84void kick_all_cpus_sync(void);
85
84/* 86/*
85 * Generic and arch helpers 87 * Generic and arch helpers
86 */ 88 */
@@ -192,6 +194,8 @@ smp_call_function_any(const struct cpumask *mask, smp_call_func_t func,
192 return smp_call_function_single(0, func, info, wait); 194 return smp_call_function_single(0, func, info, wait);
193} 195}
194 196
197static inline void kick_all_cpus_sync(void) { }
198
195#endif /* !SMP */ 199#endif /* !SMP */
196 200
197/* 201/*
diff --git a/include/linux/spi/eeprom.h b/include/linux/spi/eeprom.h
index 306e7b1c69ed..403e007aef68 100644
--- a/include/linux/spi/eeprom.h
+++ b/include/linux/spi/eeprom.h
@@ -20,6 +20,16 @@ struct spi_eeprom {
20#define EE_ADDR3 0x0004 /* 24 bit addrs */ 20#define EE_ADDR3 0x0004 /* 24 bit addrs */
21#define EE_READONLY 0x0008 /* disallow writes */ 21#define EE_READONLY 0x0008 /* disallow writes */
22 22
23 /*
24 * Certain EEPROMS have a size that is larger than the number of address
25 * bytes would allow (e.g. like M95040 from ST that has 512 Byte size
26 * but uses only one address byte (A0 to A7) for addressing.) For
27 * the extra address bit (A8, A16 or A24) bit 3 of the instruction byte
28 * is used. This instruction bit is normally defined as don't care for
29 * other AT25 like chips.
30 */
31#define EE_INSTR_BIT3_IS_ADDR 0x0010
32
23 /* for exporting this chip's data to other kernel code */ 33 /* for exporting this chip's data to other kernel code */
24 void (*setup)(struct memory_accessor *mem, void *context); 34 void (*setup)(struct memory_accessor *mem, void *context);
25 void *context; 35 void *context;
diff --git a/include/linux/srcu.h b/include/linux/srcu.h
index d3d5fa54f25e..55a5c52cbb25 100644
--- a/include/linux/srcu.h
+++ b/include/linux/srcu.h
@@ -29,26 +29,35 @@
29 29
30#include <linux/mutex.h> 30#include <linux/mutex.h>
31#include <linux/rcupdate.h> 31#include <linux/rcupdate.h>
32#include <linux/workqueue.h>
32 33
33struct srcu_struct_array { 34struct srcu_struct_array {
34 int c[2]; 35 unsigned long c[2];
36 unsigned long seq[2];
37};
38
39struct rcu_batch {
40 struct rcu_head *head, **tail;
35}; 41};
36 42
37struct srcu_struct { 43struct srcu_struct {
38 int completed; 44 unsigned completed;
39 struct srcu_struct_array __percpu *per_cpu_ref; 45 struct srcu_struct_array __percpu *per_cpu_ref;
40 struct mutex mutex; 46 spinlock_t queue_lock; /* protect ->batch_queue, ->running */
47 bool running;
48 /* callbacks just queued */
49 struct rcu_batch batch_queue;
50 /* callbacks try to do the first check_zero */
51 struct rcu_batch batch_check0;
52 /* callbacks done with the first check_zero and the flip */
53 struct rcu_batch batch_check1;
54 struct rcu_batch batch_done;
55 struct delayed_work work;
41#ifdef CONFIG_DEBUG_LOCK_ALLOC 56#ifdef CONFIG_DEBUG_LOCK_ALLOC
42 struct lockdep_map dep_map; 57 struct lockdep_map dep_map;
43#endif /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */ 58#endif /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */
44}; 59};
45 60
46#ifndef CONFIG_PREEMPT
47#define srcu_barrier() barrier()
48#else /* #ifndef CONFIG_PREEMPT */
49#define srcu_barrier()
50#endif /* #else #ifndef CONFIG_PREEMPT */
51
52#ifdef CONFIG_DEBUG_LOCK_ALLOC 61#ifdef CONFIG_DEBUG_LOCK_ALLOC
53 62
54int __init_srcu_struct(struct srcu_struct *sp, const char *name, 63int __init_srcu_struct(struct srcu_struct *sp, const char *name,
@@ -67,12 +76,33 @@ int init_srcu_struct(struct srcu_struct *sp);
67 76
68#endif /* #else #ifdef CONFIG_DEBUG_LOCK_ALLOC */ 77#endif /* #else #ifdef CONFIG_DEBUG_LOCK_ALLOC */
69 78
79/**
80 * call_srcu() - Queue a callback for invocation after an SRCU grace period
81 * @sp: srcu_struct in queue the callback
82 * @head: structure to be used for queueing the SRCU callback.
83 * @func: function to be invoked after the SRCU grace period
84 *
85 * The callback function will be invoked some time after a full SRCU
86 * grace period elapses, in other words after all pre-existing SRCU
87 * read-side critical sections have completed. However, the callback
88 * function might well execute concurrently with other SRCU read-side
89 * critical sections that started after call_srcu() was invoked. SRCU
90 * read-side critical sections are delimited by srcu_read_lock() and
91 * srcu_read_unlock(), and may be nested.
92 *
93 * The callback will be invoked from process context, but must nevertheless
94 * be fast and must not block.
95 */
96void call_srcu(struct srcu_struct *sp, struct rcu_head *head,
97 void (*func)(struct rcu_head *head));
98
70void cleanup_srcu_struct(struct srcu_struct *sp); 99void cleanup_srcu_struct(struct srcu_struct *sp);
71int __srcu_read_lock(struct srcu_struct *sp) __acquires(sp); 100int __srcu_read_lock(struct srcu_struct *sp) __acquires(sp);
72void __srcu_read_unlock(struct srcu_struct *sp, int idx) __releases(sp); 101void __srcu_read_unlock(struct srcu_struct *sp, int idx) __releases(sp);
73void synchronize_srcu(struct srcu_struct *sp); 102void synchronize_srcu(struct srcu_struct *sp);
74void synchronize_srcu_expedited(struct srcu_struct *sp); 103void synchronize_srcu_expedited(struct srcu_struct *sp);
75long srcu_batches_completed(struct srcu_struct *sp); 104long srcu_batches_completed(struct srcu_struct *sp);
105void srcu_barrier(struct srcu_struct *sp);
76 106
77#ifdef CONFIG_DEBUG_LOCK_ALLOC 107#ifdef CONFIG_DEBUG_LOCK_ALLOC
78 108
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index ac1c114c499d..cd83059fb592 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -356,8 +356,9 @@ extern int unregister_pm_notifier(struct notifier_block *nb);
356extern bool events_check_enabled; 356extern bool events_check_enabled;
357 357
358extern bool pm_wakeup_pending(void); 358extern bool pm_wakeup_pending(void);
359extern bool pm_get_wakeup_count(unsigned int *count); 359extern bool pm_get_wakeup_count(unsigned int *count, bool block);
360extern bool pm_save_wakeup_count(unsigned int count); 360extern bool pm_save_wakeup_count(unsigned int count);
361extern void pm_wakep_autosleep_enabled(bool set);
361 362
362static inline void lock_system_sleep(void) 363static inline void lock_system_sleep(void)
363{ 364{
@@ -407,6 +408,17 @@ static inline void unlock_system_sleep(void) {}
407 408
408#endif /* !CONFIG_PM_SLEEP */ 409#endif /* !CONFIG_PM_SLEEP */
409 410
411#ifdef CONFIG_PM_AUTOSLEEP
412
413/* kernel/power/autosleep.c */
414void queue_up_suspend_work(void);
415
416#else /* !CONFIG_PM_AUTOSLEEP */
417
418static inline void queue_up_suspend_work(void) {}
419
420#endif /* !CONFIG_PM_AUTOSLEEP */
421
410#ifdef CONFIG_ARCH_SAVE_PAGE_KEYS 422#ifdef CONFIG_ARCH_SAVE_PAGE_KEYS
411/* 423/*
412 * The ARCH_SAVE_PAGE_KEYS functions can be used by an architecture 424 * The ARCH_SAVE_PAGE_KEYS functions can be used by an architecture
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index 0010009b2f00..381f06db2fe5 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -27,6 +27,7 @@ struct attribute {
27 const char *name; 27 const char *name;
28 umode_t mode; 28 umode_t mode;
29#ifdef CONFIG_DEBUG_LOCK_ALLOC 29#ifdef CONFIG_DEBUG_LOCK_ALLOC
30 bool ignore_lockdep:1;
30 struct lock_class_key *key; 31 struct lock_class_key *key;
31 struct lock_class_key skey; 32 struct lock_class_key skey;
32#endif 33#endif
@@ -80,6 +81,17 @@ struct attribute_group {
80 81
81#define __ATTR_NULL { .attr = { .name = NULL } } 82#define __ATTR_NULL { .attr = { .name = NULL } }
82 83
84#ifdef CONFIG_DEBUG_LOCK_ALLOC
85#define __ATTR_IGNORE_LOCKDEP(_name, _mode, _show, _store) { \
86 .attr = {.name = __stringify(_name), .mode = _mode, \
87 .ignore_lockdep = true }, \
88 .show = _show, \
89 .store = _store, \
90}
91#else
92#define __ATTR_IGNORE_LOCKDEP __ATTR
93#endif
94
83#define attr_name(_attr) (_attr).attr.name 95#define attr_name(_attr) (_attr).attr.name
84 96
85struct file; 97struct file;
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index d9b42c5be088..4c5b63283377 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -426,7 +426,7 @@ struct tcp_sock {
426 426
427 struct sk_buff_head out_of_order_queue; /* Out of order segments go here */ 427 struct sk_buff_head out_of_order_queue; /* Out of order segments go here */
428 428
429 /* SACKs data, these 2 need to be together (see tcp_build_and_update_options) */ 429 /* SACKs data, these 2 need to be together (see tcp_options_write) */
430 struct tcp_sack_block duplicate_sack[1]; /* D-SACK block */ 430 struct tcp_sack_block duplicate_sack[1]; /* D-SACK block */
431 struct tcp_sack_block selective_acks[4]; /* The SACKS themselves*/ 431 struct tcp_sack_block selective_acks[4]; /* The SACKS themselves*/
432 432
diff --git a/include/linux/thread_info.h b/include/linux/thread_info.h
index 8d03f079688c..db78775eff3b 100644
--- a/include/linux/thread_info.h
+++ b/include/linux/thread_info.h
@@ -54,6 +54,12 @@ extern long do_no_restart_syscall(struct restart_block *parm);
54 54
55#ifdef __KERNEL__ 55#ifdef __KERNEL__
56 56
57#ifdef CONFIG_DEBUG_STACK_USAGE
58# define THREADINFO_GFP (GFP_KERNEL | __GFP_NOTRACK | __GFP_ZERO)
59#else
60# define THREADINFO_GFP (GFP_KERNEL | __GFP_NOTRACK)
61#endif
62
57/* 63/*
58 * flag set/clear/test wrappers 64 * flag set/clear/test wrappers
59 * - pass TIF_xxxx constants to these functions 65 * - pass TIF_xxxx constants to these functions
diff --git a/include/linux/ti_wilink_st.h b/include/linux/ti_wilink_st.h
index 2ef4385da6bf..3ca0269dd0b5 100644
--- a/include/linux/ti_wilink_st.h
+++ b/include/linux/ti_wilink_st.h
@@ -25,6 +25,8 @@
25#ifndef TI_WILINK_ST_H 25#ifndef TI_WILINK_ST_H
26#define TI_WILINK_ST_H 26#define TI_WILINK_ST_H
27 27
28#include <linux/skbuff.h>
29
28/** 30/**
29 * enum proto-type - The protocol on WiLink chips which share a 31 * enum proto-type - The protocol on WiLink chips which share a
30 * common physical interface like UART. 32 * common physical interface like UART.
diff --git a/include/linux/topology.h b/include/linux/topology.h
index e26db031303b..e91cd43394df 100644
--- a/include/linux/topology.h
+++ b/include/linux/topology.h
@@ -70,7 +70,6 @@ int arch_update_cpu_topology(void);
70 * Below are the 3 major initializers used in building sched_domains: 70 * Below are the 3 major initializers used in building sched_domains:
71 * SD_SIBLING_INIT, for SMT domains 71 * SD_SIBLING_INIT, for SMT domains
72 * SD_CPU_INIT, for SMP domains 72 * SD_CPU_INIT, for SMP domains
73 * SD_NODE_INIT, for NUMA domains
74 * 73 *
75 * Any architecture that cares to do any tuning to these values should do so 74 * Any architecture that cares to do any tuning to these values should do so
76 * by defining their own arch-specific initializer in include/asm/topology.h. 75 * by defining their own arch-specific initializer in include/asm/topology.h.
@@ -99,7 +98,6 @@ int arch_update_cpu_topology(void);
99 | 0*SD_BALANCE_WAKE \ 98 | 0*SD_BALANCE_WAKE \
100 | 1*SD_WAKE_AFFINE \ 99 | 1*SD_WAKE_AFFINE \
101 | 1*SD_SHARE_CPUPOWER \ 100 | 1*SD_SHARE_CPUPOWER \
102 | 0*SD_POWERSAVINGS_BALANCE \
103 | 1*SD_SHARE_PKG_RESOURCES \ 101 | 1*SD_SHARE_PKG_RESOURCES \
104 | 0*SD_SERIALIZE \ 102 | 0*SD_SERIALIZE \
105 | 0*SD_PREFER_SIBLING \ 103 | 0*SD_PREFER_SIBLING \
@@ -135,8 +133,6 @@ int arch_update_cpu_topology(void);
135 | 0*SD_SHARE_CPUPOWER \ 133 | 0*SD_SHARE_CPUPOWER \
136 | 1*SD_SHARE_PKG_RESOURCES \ 134 | 1*SD_SHARE_PKG_RESOURCES \
137 | 0*SD_SERIALIZE \ 135 | 0*SD_SERIALIZE \
138 | sd_balance_for_mc_power() \
139 | sd_power_saving_flags() \
140 , \ 136 , \
141 .last_balance = jiffies, \ 137 .last_balance = jiffies, \
142 .balance_interval = 1, \ 138 .balance_interval = 1, \
@@ -168,56 +164,18 @@ int arch_update_cpu_topology(void);
168 | 0*SD_SHARE_CPUPOWER \ 164 | 0*SD_SHARE_CPUPOWER \
169 | 0*SD_SHARE_PKG_RESOURCES \ 165 | 0*SD_SHARE_PKG_RESOURCES \
170 | 0*SD_SERIALIZE \ 166 | 0*SD_SERIALIZE \
171 | sd_balance_for_package_power() \
172 | sd_power_saving_flags() \
173 , \ 167 , \
174 .last_balance = jiffies, \ 168 .last_balance = jiffies, \
175 .balance_interval = 1, \ 169 .balance_interval = 1, \
176} 170}
177#endif 171#endif
178 172
179/* sched_domains SD_ALLNODES_INIT for NUMA machines */
180#define SD_ALLNODES_INIT (struct sched_domain) { \
181 .min_interval = 64, \
182 .max_interval = 64*num_online_cpus(), \
183 .busy_factor = 128, \
184 .imbalance_pct = 133, \
185 .cache_nice_tries = 1, \
186 .busy_idx = 3, \
187 .idle_idx = 3, \
188 .flags = 1*SD_LOAD_BALANCE \
189 | 1*SD_BALANCE_NEWIDLE \
190 | 0*SD_BALANCE_EXEC \
191 | 0*SD_BALANCE_FORK \
192 | 0*SD_BALANCE_WAKE \
193 | 0*SD_WAKE_AFFINE \
194 | 0*SD_SHARE_CPUPOWER \
195 | 0*SD_POWERSAVINGS_BALANCE \
196 | 0*SD_SHARE_PKG_RESOURCES \
197 | 1*SD_SERIALIZE \
198 | 0*SD_PREFER_SIBLING \
199 , \
200 .last_balance = jiffies, \
201 .balance_interval = 64, \
202}
203
204#ifndef SD_NODES_PER_DOMAIN
205#define SD_NODES_PER_DOMAIN 16
206#endif
207
208#ifdef CONFIG_SCHED_BOOK 173#ifdef CONFIG_SCHED_BOOK
209#ifndef SD_BOOK_INIT 174#ifndef SD_BOOK_INIT
210#error Please define an appropriate SD_BOOK_INIT in include/asm/topology.h!!! 175#error Please define an appropriate SD_BOOK_INIT in include/asm/topology.h!!!
211#endif 176#endif
212#endif /* CONFIG_SCHED_BOOK */ 177#endif /* CONFIG_SCHED_BOOK */
213 178
214#ifdef CONFIG_NUMA
215#ifndef SD_NODE_INIT
216#error Please define an appropriate SD_NODE_INIT in include/asm/topology.h!!!
217#endif
218
219#endif /* CONFIG_NUMA */
220
221#ifdef CONFIG_USE_PERCPU_NUMA_NODE_ID 179#ifdef CONFIG_USE_PERCPU_NUMA_NODE_ID
222DECLARE_PER_CPU(int, numa_node); 180DECLARE_PER_CPU(int, numa_node);
223 181
@@ -239,7 +197,7 @@ static inline int cpu_to_node(int cpu)
239#ifndef set_numa_node 197#ifndef set_numa_node
240static inline void set_numa_node(int node) 198static inline void set_numa_node(int node)
241{ 199{
242 percpu_write(numa_node, node); 200 this_cpu_write(numa_node, node);
243} 201}
244#endif 202#endif
245 203
@@ -274,7 +232,7 @@ DECLARE_PER_CPU(int, _numa_mem_);
274#ifndef set_numa_mem 232#ifndef set_numa_mem
275static inline void set_numa_mem(int node) 233static inline void set_numa_mem(int node)
276{ 234{
277 percpu_write(_numa_mem_, node); 235 this_cpu_write(_numa_mem_, node);
278} 236}
279#endif 237#endif
280 238
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 9f47ab540f65..4990ef2b1fb7 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -268,6 +268,7 @@ struct tty_struct {
268 struct mutex ldisc_mutex; 268 struct mutex ldisc_mutex;
269 struct tty_ldisc *ldisc; 269 struct tty_ldisc *ldisc;
270 270
271 struct mutex legacy_mutex;
271 struct mutex termios_mutex; 272 struct mutex termios_mutex;
272 spinlock_t ctrl_lock; 273 spinlock_t ctrl_lock;
273 /* Termios values are protected by the termios mutex */ 274 /* Termios values are protected by the termios mutex */
@@ -605,8 +606,12 @@ extern long vt_compat_ioctl(struct tty_struct *tty,
605 606
606/* tty_mutex.c */ 607/* tty_mutex.c */
607/* functions for preparation of BKL removal */ 608/* functions for preparation of BKL removal */
608extern void __lockfunc tty_lock(void) __acquires(tty_lock); 609extern void __lockfunc tty_lock(struct tty_struct *tty);
609extern void __lockfunc tty_unlock(void) __releases(tty_lock); 610extern void __lockfunc tty_unlock(struct tty_struct *tty);
611extern void __lockfunc tty_lock_pair(struct tty_struct *tty,
612 struct tty_struct *tty2);
613extern void __lockfunc tty_unlock_pair(struct tty_struct *tty,
614 struct tty_struct *tty2);
610 615
611/* 616/*
612 * this shall be called only from where BTM is held (like close) 617 * this shall be called only from where BTM is held (like close)
@@ -621,9 +626,9 @@ extern void __lockfunc tty_unlock(void) __releases(tty_lock);
621static inline void tty_wait_until_sent_from_close(struct tty_struct *tty, 626static inline void tty_wait_until_sent_from_close(struct tty_struct *tty,
622 long timeout) 627 long timeout)
623{ 628{
624 tty_unlock(); /* tty->ops->close holds the BTM, drop it while waiting */ 629 tty_unlock(tty); /* tty->ops->close holds the BTM, drop it while waiting */
625 tty_wait_until_sent(tty, timeout); 630 tty_wait_until_sent(tty, timeout);
626 tty_lock(); 631 tty_lock(tty);
627} 632}
628 633
629/* 634/*
@@ -638,16 +643,16 @@ static inline void tty_wait_until_sent_from_close(struct tty_struct *tty,
638 * 643 *
639 * Do not use in new code. 644 * Do not use in new code.
640 */ 645 */
641#define wait_event_interruptible_tty(wq, condition) \ 646#define wait_event_interruptible_tty(tty, wq, condition) \
642({ \ 647({ \
643 int __ret = 0; \ 648 int __ret = 0; \
644 if (!(condition)) { \ 649 if (!(condition)) { \
645 __wait_event_interruptible_tty(wq, condition, __ret); \ 650 __wait_event_interruptible_tty(tty, wq, condition, __ret); \
646 } \ 651 } \
647 __ret; \ 652 __ret; \
648}) 653})
649 654
650#define __wait_event_interruptible_tty(wq, condition, ret) \ 655#define __wait_event_interruptible_tty(tty, wq, condition, ret) \
651do { \ 656do { \
652 DEFINE_WAIT(__wait); \ 657 DEFINE_WAIT(__wait); \
653 \ 658 \
@@ -656,9 +661,9 @@ do { \
656 if (condition) \ 661 if (condition) \
657 break; \ 662 break; \
658 if (!signal_pending(current)) { \ 663 if (!signal_pending(current)) { \
659 tty_unlock(); \ 664 tty_unlock(tty); \
660 schedule(); \ 665 schedule(); \
661 tty_lock(); \ 666 tty_lock(tty); \
662 continue; \ 667 continue; \
663 } \ 668 } \
664 ret = -ERESTARTSYS; \ 669 ret = -ERESTARTSYS; \
diff --git a/include/linux/tty_ldisc.h b/include/linux/tty_ldisc.h
index ff7dc08696a8..fb79dd8d1537 100644
--- a/include/linux/tty_ldisc.h
+++ b/include/linux/tty_ldisc.h
@@ -110,6 +110,7 @@
110#include <linux/fs.h> 110#include <linux/fs.h>
111#include <linux/wait.h> 111#include <linux/wait.h>
112#include <linux/pps_kernel.h> 112#include <linux/pps_kernel.h>
113#include <linux/wait.h>
113 114
114struct tty_ldisc_ops { 115struct tty_ldisc_ops {
115 int magic; 116 int magic;
@@ -154,6 +155,7 @@ struct tty_ldisc_ops {
154struct tty_ldisc { 155struct tty_ldisc {
155 struct tty_ldisc_ops *ops; 156 struct tty_ldisc_ops *ops;
156 atomic_t users; 157 atomic_t users;
158 wait_queue_head_t wq_idle;
157}; 159};
158 160
159#define TTY_LDISC_MAGIC 0x5403 161#define TTY_LDISC_MAGIC 0x5403
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 73b68d1f2cb0..dea39dc551d4 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -351,10 +351,6 @@ struct usb_bus {
351 int bandwidth_int_reqs; /* number of Interrupt requests */ 351 int bandwidth_int_reqs; /* number of Interrupt requests */
352 int bandwidth_isoc_reqs; /* number of Isoc. requests */ 352 int bandwidth_isoc_reqs; /* number of Isoc. requests */
353 353
354#ifdef CONFIG_USB_DEVICEFS
355 struct dentry *usbfs_dentry; /* usbfs dentry entry for the bus */
356#endif
357
358#if defined(CONFIG_USB_MON) || defined(CONFIG_USB_MON_MODULE) 354#if defined(CONFIG_USB_MON) || defined(CONFIG_USB_MON_MODULE)
359 struct mon_bus *mon_bus; /* non-null when associated */ 355 struct mon_bus *mon_bus; /* non-null when associated */
360 int monitored; /* non-zero when monitored */ 356 int monitored; /* non-zero when monitored */
@@ -382,6 +378,45 @@ enum usb_device_removable {
382 USB_DEVICE_FIXED, 378 USB_DEVICE_FIXED,
383}; 379};
384 380
381/*
382 * USB 3.0 Link Power Management (LPM) parameters.
383 *
384 * PEL and SEL are USB 3.0 Link PM latencies for device-initiated LPM exit.
385 * MEL is the USB 3.0 Link PM latency for host-initiated LPM exit.
386 * All three are stored in nanoseconds.
387 */
388struct usb3_lpm_parameters {
389 /*
390 * Maximum exit latency (MEL) for the host to send a packet to the
391 * device (either a Ping for isoc endpoints, or a data packet for
392 * interrupt endpoints), the hubs to decode the packet, and for all hubs
393 * in the path to transition the links to U0.
394 */
395 unsigned int mel;
396 /*
397 * Maximum exit latency for a device-initiated LPM transition to bring
398 * all links into U0. Abbreviated as "PEL" in section 9.4.12 of the USB
399 * 3.0 spec, with no explanation of what "P" stands for. "Path"?
400 */
401 unsigned int pel;
402
403 /*
404 * The System Exit Latency (SEL) includes PEL, and three other
405 * latencies. After a device initiates a U0 transition, it will take
406 * some time from when the device sends the ERDY to when it will finally
407 * receive the data packet. Basically, SEL should be the worse-case
408 * latency from when a device starts initiating a U0 transition to when
409 * it will get data.
410 */
411 unsigned int sel;
412 /*
413 * The idle timeout value that is currently programmed into the parent
414 * hub for this device. When the timer counts to zero, the parent hub
415 * will initiate an LPM transition to either U1 or U2.
416 */
417 int timeout;
418};
419
385/** 420/**
386 * struct usb_device - kernel's representation of a USB device 421 * struct usb_device - kernel's representation of a USB device
387 * @devnum: device number; address on a USB bus 422 * @devnum: device number; address on a USB bus
@@ -439,6 +474,12 @@ enum usb_device_removable {
439 * specific data for the device. 474 * specific data for the device.
440 * @slot_id: Slot ID assigned by xHCI 475 * @slot_id: Slot ID assigned by xHCI
441 * @removable: Device can be physically removed from this port 476 * @removable: Device can be physically removed from this port
477 * @u1_params: exit latencies for USB3 U1 LPM state, and hub-initiated timeout.
478 * @u2_params: exit latencies for USB3 U2 LPM state, and hub-initiated timeout.
479 * @lpm_disable_count: Ref count used by usb_disable_lpm() and usb_enable_lpm()
480 * to keep track of the number of functions that require USB 3.0 Link Power
481 * Management to be disabled for this usb_device. This count should only
482 * be manipulated by those functions, with the bandwidth_mutex is held.
442 * 483 *
443 * Notes: 484 * Notes:
444 * Usbcore drivers should not set usbdev->state directly. Instead use 485 * Usbcore drivers should not set usbdev->state directly. Instead use
@@ -485,6 +526,7 @@ struct usb_device {
485 unsigned lpm_capable:1; 526 unsigned lpm_capable:1;
486 unsigned usb2_hw_lpm_capable:1; 527 unsigned usb2_hw_lpm_capable:1;
487 unsigned usb2_hw_lpm_enabled:1; 528 unsigned usb2_hw_lpm_enabled:1;
529 unsigned usb3_lpm_enabled:1;
488 int string_langid; 530 int string_langid;
489 531
490 /* static strings from the device */ 532 /* static strings from the device */
@@ -493,12 +535,6 @@ struct usb_device {
493 char *serial; 535 char *serial;
494 536
495 struct list_head filelist; 537 struct list_head filelist;
496#ifdef CONFIG_USB_DEVICE_CLASS
497 struct device *usb_classdev;
498#endif
499#ifdef CONFIG_USB_DEVICEFS
500 struct dentry *usbfs_dentry;
501#endif
502 538
503 int maxchild; 539 int maxchild;
504 struct usb_device **children; 540 struct usb_device **children;
@@ -517,6 +553,10 @@ struct usb_device {
517 struct wusb_dev *wusb_dev; 553 struct wusb_dev *wusb_dev;
518 int slot_id; 554 int slot_id;
519 enum usb_device_removable removable; 555 enum usb_device_removable removable;
556 struct usb3_lpm_parameters u1_params;
557 struct usb3_lpm_parameters u2_params;
558 unsigned lpm_disable_count;
559 unsigned hub_initiated_lpm_disable_count;
520}; 560};
521#define to_usb_device(d) container_of(d, struct usb_device, dev) 561#define to_usb_device(d) container_of(d, struct usb_device, dev)
522 562
@@ -583,6 +623,12 @@ static inline void usb_mark_last_busy(struct usb_device *udev)
583{ } 623{ }
584#endif 624#endif
585 625
626extern int usb_disable_lpm(struct usb_device *udev);
627extern void usb_enable_lpm(struct usb_device *udev);
628/* Same as above, but these functions lock/unlock the bandwidth_mutex. */
629extern int usb_unlocked_disable_lpm(struct usb_device *udev);
630extern void usb_unlocked_enable_lpm(struct usb_device *udev);
631
586/*-------------------------------------------------------------------------*/ 632/*-------------------------------------------------------------------------*/
587 633
588/* for drivers using iso endpoints */ 634/* for drivers using iso endpoints */
@@ -800,6 +846,8 @@ extern ssize_t usb_store_new_id(struct usb_dynids *dynids,
800 struct device_driver *driver, 846 struct device_driver *driver,
801 const char *buf, size_t count); 847 const char *buf, size_t count);
802 848
849extern ssize_t usb_show_dynids(struct usb_dynids *dynids, char *buf);
850
803/** 851/**
804 * struct usbdrv_wrap - wrapper for driver-model structure 852 * struct usbdrv_wrap - wrapper for driver-model structure
805 * @driver: The driver-model core driver structure. 853 * @driver: The driver-model core driver structure.
@@ -850,6 +898,9 @@ struct usbdrv_wrap {
850 * for interfaces bound to this driver. 898 * for interfaces bound to this driver.
851 * @soft_unbind: if set to 1, the USB core will not kill URBs and disable 899 * @soft_unbind: if set to 1, the USB core will not kill URBs and disable
852 * endpoints before calling the driver's disconnect method. 900 * endpoints before calling the driver's disconnect method.
901 * @disable_hub_initiated_lpm: if set to 0, the USB core will not allow hubs
902 * to initiate lower power link state transitions when an idle timeout
903 * occurs. Device-initiated USB 3.0 link PM will still be allowed.
853 * 904 *
854 * USB interface drivers must provide a name, probe() and disconnect() 905 * USB interface drivers must provide a name, probe() and disconnect()
855 * methods, and an id_table. Other driver fields are optional. 906 * methods, and an id_table. Other driver fields are optional.
@@ -890,6 +941,7 @@ struct usb_driver {
890 struct usbdrv_wrap drvwrap; 941 struct usbdrv_wrap drvwrap;
891 unsigned int no_dynamic_id:1; 942 unsigned int no_dynamic_id:1;
892 unsigned int supports_autosuspend:1; 943 unsigned int supports_autosuspend:1;
944 unsigned int disable_hub_initiated_lpm:1;
893 unsigned int soft_unbind:1; 945 unsigned int soft_unbind:1;
894}; 946};
895#define to_usb_driver(d) container_of(d, struct usb_driver, drvwrap.driver) 947#define to_usb_driver(d) container_of(d, struct usb_driver, drvwrap.driver)
@@ -1379,6 +1431,7 @@ extern int usb_unlink_urb(struct urb *urb);
1379extern void usb_kill_urb(struct urb *urb); 1431extern void usb_kill_urb(struct urb *urb);
1380extern void usb_poison_urb(struct urb *urb); 1432extern void usb_poison_urb(struct urb *urb);
1381extern void usb_unpoison_urb(struct urb *urb); 1433extern void usb_unpoison_urb(struct urb *urb);
1434extern void usb_block_urb(struct urb *urb);
1382extern void usb_kill_anchored_urbs(struct usb_anchor *anchor); 1435extern void usb_kill_anchored_urbs(struct usb_anchor *anchor);
1383extern void usb_poison_anchored_urbs(struct usb_anchor *anchor); 1436extern void usb_poison_anchored_urbs(struct usb_anchor *anchor);
1384extern void usb_unpoison_anchored_urbs(struct usb_anchor *anchor); 1437extern void usb_unpoison_anchored_urbs(struct usb_anchor *anchor);
@@ -1391,6 +1444,8 @@ extern struct urb *usb_get_from_anchor(struct usb_anchor *anchor);
1391extern void usb_scuttle_anchored_urbs(struct usb_anchor *anchor); 1444extern void usb_scuttle_anchored_urbs(struct usb_anchor *anchor);
1392extern int usb_anchor_empty(struct usb_anchor *anchor); 1445extern int usb_anchor_empty(struct usb_anchor *anchor);
1393 1446
1447#define usb_unblock_urb usb_unpoison_urb
1448
1394/** 1449/**
1395 * usb_urb_dir_in - check if an URB describes an IN transfer 1450 * usb_urb_dir_in - check if an URB describes an IN transfer
1396 * @urb: URB to be checked 1451 * @urb: URB to be checked
@@ -1627,6 +1682,7 @@ static inline int usb_translate_errors(int error_code)
1627 case 0: 1682 case 0:
1628 case -ENOMEM: 1683 case -ENOMEM:
1629 case -ENODEV: 1684 case -ENODEV:
1685 case -EOPNOTSUPP:
1630 return error_code; 1686 return error_code;
1631 default: 1687 default:
1632 return -EIO; 1688 return -EIO;
@@ -1652,9 +1708,6 @@ do { \
1652} while (0) 1708} while (0)
1653#endif 1709#endif
1654 1710
1655#define err(format, arg...) \
1656 printk(KERN_ERR KBUILD_MODNAME ": " format "\n", ##arg)
1657
1658/* debugfs stuff */ 1711/* debugfs stuff */
1659extern struct dentry *usb_debug_root; 1712extern struct dentry *usb_debug_root;
1660 1713
diff --git a/include/linux/usb/ch11.h b/include/linux/usb/ch11.h
index f1d26b6067f1..b6c2863b2c94 100644
--- a/include/linux/usb/ch11.h
+++ b/include/linux/usb/ch11.h
@@ -76,6 +76,8 @@
76#define USB_PORT_FEAT_C_BH_PORT_RESET 29 76#define USB_PORT_FEAT_C_BH_PORT_RESET 29
77#define USB_PORT_FEAT_FORCE_LINKPM_ACCEPT 30 77#define USB_PORT_FEAT_FORCE_LINKPM_ACCEPT 30
78 78
79#define USB_PORT_LPM_TIMEOUT(p) (((p) & 0xff) << 8)
80
79/* USB 3.0 hub remote wake mask bits, see table 10-14 */ 81/* USB 3.0 hub remote wake mask bits, see table 10-14 */
80#define USB_PORT_FEAT_REMOTE_WAKE_CONNECT (1 << 8) 82#define USB_PORT_FEAT_REMOTE_WAKE_CONNECT (1 << 8)
81#define USB_PORT_FEAT_REMOTE_WAKE_DISCONNECT (1 << 9) 83#define USB_PORT_FEAT_REMOTE_WAKE_DISCONNECT (1 << 9)
diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h
index af21f3115919..d1d732c2838d 100644
--- a/include/linux/usb/ch9.h
+++ b/include/linux/usb/ch9.h
@@ -88,6 +88,8 @@
88#define USB_REQ_GET_INTERFACE 0x0A 88#define USB_REQ_GET_INTERFACE 0x0A
89#define USB_REQ_SET_INTERFACE 0x0B 89#define USB_REQ_SET_INTERFACE 0x0B
90#define USB_REQ_SYNCH_FRAME 0x0C 90#define USB_REQ_SYNCH_FRAME 0x0C
91#define USB_REQ_SET_SEL 0x30
92#define USB_REQ_SET_ISOCH_DELAY 0x31
91 93
92#define USB_REQ_SET_ENCRYPTION 0x0D /* Wireless USB */ 94#define USB_REQ_SET_ENCRYPTION 0x0D /* Wireless USB */
93#define USB_REQ_GET_ENCRYPTION 0x0E 95#define USB_REQ_GET_ENCRYPTION 0x0E
@@ -390,6 +392,11 @@ struct usb_endpoint_descriptor {
390#define USB_ENDPOINT_XFER_INT 3 392#define USB_ENDPOINT_XFER_INT 3
391#define USB_ENDPOINT_MAX_ADJUSTABLE 0x80 393#define USB_ENDPOINT_MAX_ADJUSTABLE 0x80
392 394
395/* The USB 3.0 spec redefines bits 5:4 of bmAttributes as interrupt ep type. */
396#define USB_ENDPOINT_INTRTYPE 0x30
397#define USB_ENDPOINT_INTR_PERIODIC (0 << 4)
398#define USB_ENDPOINT_INTR_NOTIFICATION (1 << 4)
399
393#define USB_ENDPOINT_SYNCTYPE 0x0c 400#define USB_ENDPOINT_SYNCTYPE 0x0c
394#define USB_ENDPOINT_SYNC_NONE (0 << 2) 401#define USB_ENDPOINT_SYNC_NONE (0 << 2)
395#define USB_ENDPOINT_SYNC_ASYNC (1 << 2) 402#define USB_ENDPOINT_SYNC_ASYNC (1 << 2)
@@ -592,6 +599,12 @@ static inline int usb_endpoint_maxp(const struct usb_endpoint_descriptor *epd)
592 return __le16_to_cpu(epd->wMaxPacketSize); 599 return __le16_to_cpu(epd->wMaxPacketSize);
593} 600}
594 601
602static inline int usb_endpoint_interrupt_type(
603 const struct usb_endpoint_descriptor *epd)
604{
605 return epd->bmAttributes & USB_ENDPOINT_INTRTYPE;
606}
607
595/*-------------------------------------------------------------------------*/ 608/*-------------------------------------------------------------------------*/
596 609
597/* USB_DT_SS_ENDPOINT_COMP: SuperSpeed Endpoint Companion descriptor */ 610/* USB_DT_SS_ENDPOINT_COMP: SuperSpeed Endpoint Companion descriptor */
@@ -933,6 +946,51 @@ enum usb_device_state {
933 */ 946 */
934}; 947};
935 948
949enum usb3_link_state {
950 USB3_LPM_U0 = 0,
951 USB3_LPM_U1,
952 USB3_LPM_U2,
953 USB3_LPM_U3
954};
955
956/*
957 * A U1 timeout of 0x0 means the parent hub will reject any transitions to U1.
958 * 0xff means the parent hub will accept transitions to U1, but will not
959 * initiate a transition.
960 *
961 * A U1 timeout of 0x1 to 0x7F also causes the hub to initiate a transition to
962 * U1 after that many microseconds. Timeouts of 0x80 to 0xFE are reserved
963 * values.
964 *
965 * A U2 timeout of 0x0 means the parent hub will reject any transitions to U2.
966 * 0xff means the parent hub will accept transitions to U2, but will not
967 * initiate a transition.
968 *
969 * A U2 timeout of 0x1 to 0xFE also causes the hub to initiate a transition to
970 * U2 after N*256 microseconds. Therefore a U2 timeout value of 0x1 means a U2
971 * idle timer of 256 microseconds, 0x2 means 512 microseconds, 0xFE means
972 * 65.024ms.
973 */
974#define USB3_LPM_DISABLED 0x0
975#define USB3_LPM_U1_MAX_TIMEOUT 0x7F
976#define USB3_LPM_U2_MAX_TIMEOUT 0xFE
977#define USB3_LPM_DEVICE_INITIATED 0xFF
978
979struct usb_set_sel_req {
980 __u8 u1_sel;
981 __u8 u1_pel;
982 __le16 u2_sel;
983 __le16 u2_pel;
984} __attribute__ ((packed));
985
986/*
987 * The Set System Exit Latency control transfer provides one byte each for
988 * U1 SEL and U1 PEL, so the max exit latency is 0xFF. U2 SEL and U2 PEL each
989 * are two bytes long.
990 */
991#define USB3_LPM_MAX_U1_SEL_PEL 0xFF
992#define USB3_LPM_MAX_U2_SEL_PEL 0xFFFF
993
936/*-------------------------------------------------------------------------*/ 994/*-------------------------------------------------------------------------*/
937 995
938/* 996/*
diff --git a/include/linux/usb/chipidea.h b/include/linux/usb/chipidea.h
new file mode 100644
index 000000000000..edb90d6cfd12
--- /dev/null
+++ b/include/linux/usb/chipidea.h
@@ -0,0 +1,28 @@
1/*
2 * Platform data for the chipidea USB dual role controller
3 */
4
5#ifndef __LINUX_USB_CHIPIDEA_H
6#define __LINUX_USB_CHIPIDEA_H
7
8struct ci13xxx;
9struct ci13xxx_udc_driver {
10 const char *name;
11 /* offset of the capability registers */
12 uintptr_t capoffset;
13 unsigned power_budget;
14 unsigned long flags;
15#define CI13XXX_REGS_SHARED BIT(0)
16#define CI13XXX_REQUIRE_TRANSCEIVER BIT(1)
17#define CI13XXX_PULLUP_ON_VBUS BIT(2)
18#define CI13XXX_DISABLE_STREAMING BIT(3)
19
20#define CI13XXX_CONTROLLER_RESET_EVENT 0
21#define CI13XXX_CONTROLLER_STOPPED_EVENT 1
22 void (*notify_event) (struct ci13xxx *udc, unsigned event);
23};
24
25/* Default offset of capability registers */
26#define DEF_CAPOFFSET 0x100
27
28#endif
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h
index a316fba73518..9d8c3b634493 100644
--- a/include/linux/usb/composite.h
+++ b/include/linux/usb/composite.h
@@ -242,6 +242,9 @@ int usb_add_config(struct usb_composite_dev *,
242 struct usb_configuration *, 242 struct usb_configuration *,
243 int (*)(struct usb_configuration *)); 243 int (*)(struct usb_configuration *));
244 244
245void usb_remove_config(struct usb_composite_dev *,
246 struct usb_configuration *);
247
245/** 248/**
246 * struct usb_composite_driver - groups configurations into a gadget 249 * struct usb_composite_driver - groups configurations into a gadget
247 * @name: For diagnostics, identifies the driver. 250 * @name: For diagnostics, identifies the driver.
@@ -250,6 +253,8 @@ int usb_add_config(struct usb_composite_dev *,
250 * @iManufacturer: Used as iManufacturer override if @dev->iManufacturer is 253 * @iManufacturer: Used as iManufacturer override if @dev->iManufacturer is
251 * not set. If NULL a default "<system> <release> with <udc>" value 254 * not set. If NULL a default "<system> <release> with <udc>" value
252 * will be used. 255 * will be used.
256 * @iSerialNumber: Used as iSerialNumber override if @dev->iSerialNumber is
257 * not set.
253 * @dev: Template descriptor for the device, including default device 258 * @dev: Template descriptor for the device, including default device
254 * identifiers. 259 * identifiers.
255 * @strings: tables of strings, keyed by identifiers assigned during bind() 260 * @strings: tables of strings, keyed by identifiers assigned during bind()
@@ -280,6 +285,7 @@ struct usb_composite_driver {
280 const char *name; 285 const char *name;
281 const char *iProduct; 286 const char *iProduct;
282 const char *iManufacturer; 287 const char *iManufacturer;
288 const char *iSerialNumber;
283 const struct usb_device_descriptor *dev; 289 const struct usb_device_descriptor *dev;
284 struct usb_gadget_strings **strings; 290 struct usb_gadget_strings **strings;
285 enum usb_device_speed max_speed; 291 enum usb_device_speed max_speed;
diff --git a/include/linux/usb/functionfs.h b/include/linux/usb/functionfs.h
index 7587ef934ba8..a843d0851364 100644
--- a/include/linux/usb/functionfs.h
+++ b/include/linux/usb/functionfs.h
@@ -190,8 +190,10 @@ static int functionfs_ready_callback(struct ffs_data *ffs)
190 __attribute__((warn_unused_result, nonnull)); 190 __attribute__((warn_unused_result, nonnull));
191static void functionfs_closed_callback(struct ffs_data *ffs) 191static void functionfs_closed_callback(struct ffs_data *ffs)
192 __attribute__((nonnull)); 192 __attribute__((nonnull));
193static int functionfs_check_dev_callback(const char *dev_name) 193static void *functionfs_acquire_dev_callback(const char *dev_name)
194 __attribute__((warn_unused_result, nonnull)); 194 __attribute__((warn_unused_result, nonnull));
195static void functionfs_release_dev_callback(struct ffs_data *ffs_data)
196 __attribute__((nonnull));
195 197
196 198
197#endif 199#endif
diff --git a/include/linux/usb/gpio_vbus.h b/include/linux/usb/gpio_vbus.h
index d9f03ccc2d60..837bba604a0b 100644
--- a/include/linux/usb/gpio_vbus.h
+++ b/include/linux/usb/gpio_vbus.h
@@ -17,6 +17,7 @@
17 * @gpio_pullup: optional D+ or D- pullup GPIO (else negative/invalid) 17 * @gpio_pullup: optional D+ or D- pullup GPIO (else negative/invalid)
18 * @gpio_vbus_inverted: true if gpio_vbus is active low 18 * @gpio_vbus_inverted: true if gpio_vbus is active low
19 * @gpio_pullup_inverted: true if gpio_pullup is active low 19 * @gpio_pullup_inverted: true if gpio_pullup is active low
20 * @wakeup: configure gpio_vbus as a wake-up source
20 * 21 *
21 * The VBUS sensing GPIO should have a pulldown, which will normally be 22 * The VBUS sensing GPIO should have a pulldown, which will normally be
22 * part of a resistor ladder turning a 4.0V-5.25V level on VBUS into a 23 * part of a resistor ladder turning a 4.0V-5.25V level on VBUS into a
@@ -27,4 +28,5 @@ struct gpio_vbus_mach_info {
27 int gpio_pullup; 28 int gpio_pullup;
28 bool gpio_vbus_inverted; 29 bool gpio_vbus_inverted;
29 bool gpio_pullup_inverted; 30 bool gpio_pullup_inverted;
31 bool wakeup;
30}; 32};
diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h
index d28cc78a38e4..7f855d50cdf5 100644
--- a/include/linux/usb/hcd.h
+++ b/include/linux/usb/hcd.h
@@ -344,6 +344,15 @@ struct hc_driver {
344 */ 344 */
345 int (*update_device)(struct usb_hcd *, struct usb_device *); 345 int (*update_device)(struct usb_hcd *, struct usb_device *);
346 int (*set_usb2_hw_lpm)(struct usb_hcd *, struct usb_device *, int); 346 int (*set_usb2_hw_lpm)(struct usb_hcd *, struct usb_device *, int);
347 /* USB 3.0 Link Power Management */
348 /* Returns the USB3 hub-encoded value for the U1/U2 timeout. */
349 int (*enable_usb3_lpm_timeout)(struct usb_hcd *,
350 struct usb_device *, enum usb3_link_state state);
351 /* The xHCI host controller can still fail the command to
352 * disable the LPM timeouts, so this can return an error code.
353 */
354 int (*disable_usb3_lpm_timeout)(struct usb_hcd *,
355 struct usb_device *, enum usb3_link_state state);
347}; 356};
348 357
349extern int usb_hcd_link_urb_to_ep(struct usb_hcd *hcd, struct urb *urb); 358extern int usb_hcd_link_urb_to_ep(struct usb_hcd *hcd, struct urb *urb);
@@ -584,29 +593,6 @@ static inline void usb_hcd_resume_root_hub(struct usb_hcd *hcd)
584} 593}
585#endif /* CONFIG_USB_SUSPEND */ 594#endif /* CONFIG_USB_SUSPEND */
586 595
587
588/*
589 * USB device fs stuff
590 */
591
592#ifdef CONFIG_USB_DEVICEFS
593
594/*
595 * these are expected to be called from the USB core/hub thread
596 * with the kernel lock held
597 */
598extern void usbfs_update_special(void);
599extern int usbfs_init(void);
600extern void usbfs_cleanup(void);
601
602#else /* CONFIG_USB_DEVICEFS */
603
604static inline void usbfs_update_special(void) {}
605static inline int usbfs_init(void) { return 0; }
606static inline void usbfs_cleanup(void) { }
607
608#endif /* CONFIG_USB_DEVICEFS */
609
610/*-------------------------------------------------------------------------*/ 596/*-------------------------------------------------------------------------*/
611 597
612#if defined(CONFIG_USB_MON) || defined(CONFIG_USB_MON_MODULE) 598#if defined(CONFIG_USB_MON) || defined(CONFIG_USB_MON_MODULE)
diff --git a/include/linux/usb/isp1301.h b/include/linux/usb/isp1301.h
new file mode 100644
index 000000000000..d3a851c28b6a
--- /dev/null
+++ b/include/linux/usb/isp1301.h
@@ -0,0 +1,80 @@
1/*
2 * NXP ISP1301 USB transceiver driver
3 *
4 * Copyright (C) 2012 Roland Stigge <stigge@antcom.de>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 */
16
17#ifndef __LINUX_USB_ISP1301_H
18#define __LINUX_USB_ISP1301_H
19
20#include <linux/of.h>
21
22/* I2C Register definitions: */
23
24#define ISP1301_I2C_MODE_CONTROL_1 0x04 /* u8 read, set, +1 clear */
25
26#define MC1_SPEED_REG (1 << 0)
27#define MC1_SUSPEND_REG (1 << 1)
28#define MC1_DAT_SE0 (1 << 2)
29#define MC1_TRANSPARENT (1 << 3)
30#define MC1_BDIS_ACON_EN (1 << 4)
31#define MC1_OE_INT_EN (1 << 5)
32#define MC1_UART_EN (1 << 6)
33#define MC1_MASK 0x7f
34
35#define ISP1301_I2C_MODE_CONTROL_2 0x12 /* u8 read, set, +1 clear */
36
37#define MC2_GLOBAL_PWR_DN (1 << 0)
38#define MC2_SPD_SUSP_CTRL (1 << 1)
39#define MC2_BI_DI (1 << 2)
40#define MC2_TRANSP_BDIR0 (1 << 3)
41#define MC2_TRANSP_BDIR1 (1 << 4)
42#define MC2_AUDIO_EN (1 << 5)
43#define MC2_PSW_EN (1 << 6)
44#define MC2_EN2V7 (1 << 7)
45
46#define ISP1301_I2C_OTG_CONTROL_1 0x06 /* u8 read, set, +1 clear */
47
48#define OTG1_DP_PULLUP (1 << 0)
49#define OTG1_DM_PULLUP (1 << 1)
50#define OTG1_DP_PULLDOWN (1 << 2)
51#define OTG1_DM_PULLDOWN (1 << 3)
52#define OTG1_ID_PULLDOWN (1 << 4)
53#define OTG1_VBUS_DRV (1 << 5)
54#define OTG1_VBUS_DISCHRG (1 << 6)
55#define OTG1_VBUS_CHRG (1 << 7)
56
57#define ISP1301_I2C_OTG_CONTROL_2 0x10 /* u8 readonly */
58
59#define OTG_B_SESS_END (1 << 6)
60#define OTG_B_SESS_VLD (1 << 7)
61
62#define ISP1301_I2C_INTERRUPT_SOURCE 0x8
63#define ISP1301_I2C_INTERRUPT_LATCH 0xA
64#define ISP1301_I2C_INTERRUPT_FALLING 0xC
65#define ISP1301_I2C_INTERRUPT_RISING 0xE
66
67#define INT_VBUS_VLD (1 << 0)
68#define INT_SESS_VLD (1 << 1)
69#define INT_DP_HI (1 << 2)
70#define INT_ID_GND (1 << 3)
71#define INT_DM_HI (1 << 4)
72#define INT_ID_FLOAT (1 << 5)
73#define INT_BDIS_ACON (1 << 6)
74#define INT_CR_INT (1 << 7)
75
76#define ISP1301_I2C_REG_CLEAR_ADDR 1 /* Register Address Modifier */
77
78struct i2c_client *isp1301_get_client(struct device_node *node);
79
80#endif /* __LINUX_USB_ISP1301_H */
diff --git a/include/linux/usb/langwell_udc.h b/include/linux/usb/langwell_udc.h
deleted file mode 100644
index 2d2d1bbad9d2..000000000000
--- a/include/linux/usb/langwell_udc.h
+++ /dev/null
@@ -1,310 +0,0 @@
1/*
2 * Intel Langwell USB Device Controller driver
3 * Copyright (C) 2008-2009, Intel Corporation.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
17 *
18 */
19
20#ifndef __LANGWELL_UDC_H
21#define __LANGWELL_UDC_H
22
23
24/* MACRO defines */
25#define CAP_REG_OFFSET 0x0
26#define OP_REG_OFFSET 0x28
27
28#define DMA_ADDR_INVALID (~(dma_addr_t)0)
29
30#define DQH_ALIGNMENT 2048
31#define DTD_ALIGNMENT 64
32#define DMA_BOUNDARY 4096
33
34#define EP0_MAX_PKT_SIZE 64
35#define EP_DIR_IN 1
36#define EP_DIR_OUT 0
37
38#define FLUSH_TIMEOUT 1000
39#define RESET_TIMEOUT 1000
40#define SETUPSTAT_TIMEOUT 100
41#define PRIME_TIMEOUT 100
42
43
44/* device memory space registers */
45
46/* Capability Registers, BAR0 + CAP_REG_OFFSET */
47struct langwell_cap_regs {
48 /* offset: 0x0 */
49 u8 caplength; /* offset of Operational Register */
50 u8 _reserved3;
51 u16 hciversion; /* H: BCD encoding of host version */
52 u32 hcsparams; /* H: host port steering logic capability */
53 u32 hccparams; /* H: host multiple mode control capability */
54#define HCC_LEN BIT(17) /* Link power management (LPM) capability */
55 u8 _reserved4[0x20-0xc];
56 /* offset: 0x20 */
57 u16 dciversion; /* BCD encoding of device version */
58 u8 _reserved5[0x24-0x22];
59 u32 dccparams; /* overall device controller capability */
60#define HOSTCAP BIT(8) /* host capable */
61#define DEVCAP BIT(7) /* device capable */
62#define DEN(d) \
63 (((d)>>0)&0x1f) /* bits 4:0, device endpoint number */
64} __attribute__ ((packed));
65
66
67/* Operational Registers, BAR0 + OP_REG_OFFSET */
68struct langwell_op_regs {
69 /* offset: 0x28 */
70 u32 extsts;
71#define EXTS_TI1 BIT(4) /* general purpose timer interrupt 1 */
72#define EXTS_TI1TI0 BIT(3) /* general purpose timer interrupt 0 */
73#define EXTS_TI1UPI BIT(2) /* USB host periodic interrupt */
74#define EXTS_TI1UAI BIT(1) /* USB host asynchronous interrupt */
75#define EXTS_TI1NAKI BIT(0) /* NAK interrupt */
76 u32 extintr;
77#define EXTI_TIE1 BIT(4) /* general purpose timer interrupt enable 1 */
78#define EXTI_TIE0 BIT(3) /* general purpose timer interrupt enable 0 */
79#define EXTI_UPIE BIT(2) /* USB host periodic interrupt enable */
80#define EXTI_UAIE BIT(1) /* USB host asynchronous interrupt enable */
81#define EXTI_NAKE BIT(0) /* NAK interrupt enable */
82 /* offset: 0x30 */
83 u32 usbcmd;
84#define CMD_HIRD(u) \
85 (((u)>>24)&0xf) /* bits 27:24, host init resume duration */
86#define CMD_ITC(u) \
87 (((u)>>16)&0xff) /* bits 23:16, interrupt threshold control */
88#define CMD_PPE BIT(15) /* per-port change events enable */
89#define CMD_ATDTW BIT(14) /* add dTD tripwire */
90#define CMD_SUTW BIT(13) /* setup tripwire */
91#define CMD_ASPE BIT(11) /* asynchronous schedule park mode enable */
92#define CMD_FS2 BIT(10) /* frame list size */
93#define CMD_ASP1 BIT(9) /* asynchronous schedule park mode count */
94#define CMD_ASP0 BIT(8)
95#define CMD_LR BIT(7) /* light host/device controller reset */
96#define CMD_IAA BIT(6) /* interrupt on async advance doorbell */
97#define CMD_ASE BIT(5) /* asynchronous schedule enable */
98#define CMD_PSE BIT(4) /* periodic schedule enable */
99#define CMD_FS1 BIT(3)
100#define CMD_FS0 BIT(2)
101#define CMD_RST BIT(1) /* controller reset */
102#define CMD_RUNSTOP BIT(0) /* run/stop */
103 u32 usbsts;
104#define STS_PPCI(u) \
105 (((u)>>16)&0xffff) /* bits 31:16, port-n change detect */
106#define STS_AS BIT(15) /* asynchronous schedule status */
107#define STS_PS BIT(14) /* periodic schedule status */
108#define STS_RCL BIT(13) /* reclamation */
109#define STS_HCH BIT(12) /* HC halted */
110#define STS_ULPII BIT(10) /* ULPI interrupt */
111#define STS_SLI BIT(8) /* DC suspend */
112#define STS_SRI BIT(7) /* SOF received */
113#define STS_URI BIT(6) /* USB reset received */
114#define STS_AAI BIT(5) /* interrupt on async advance */
115#define STS_SEI BIT(4) /* system error */
116#define STS_FRI BIT(3) /* frame list rollover */
117#define STS_PCI BIT(2) /* port change detect */
118#define STS_UEI BIT(1) /* USB error interrupt */
119#define STS_UI BIT(0) /* USB interrupt */
120 u32 usbintr;
121/* bits 31:16, per-port interrupt enable */
122#define INTR_PPCE(u) (((u)>>16)&0xffff)
123#define INTR_ULPIE BIT(10) /* ULPI enable */
124#define INTR_SLE BIT(8) /* DC sleep/suspend enable */
125#define INTR_SRE BIT(7) /* SOF received enable */
126#define INTR_URE BIT(6) /* USB reset enable */
127#define INTR_AAE BIT(5) /* interrupt on async advance enable */
128#define INTR_SEE BIT(4) /* system error enable */
129#define INTR_FRE BIT(3) /* frame list rollover enable */
130#define INTR_PCE BIT(2) /* port change detect enable */
131#define INTR_UEE BIT(1) /* USB error interrupt enable */
132#define INTR_UE BIT(0) /* USB interrupt enable */
133 u32 frindex; /* frame index */
134#define FRINDEX_MASK (0x3fff << 0)
135 u32 ctrldssegment; /* not used */
136 u32 deviceaddr;
137#define USBADR_SHIFT 25
138#define USBADR(d) \
139 (((d)>>25)&0x7f) /* bits 31:25, device address */
140#define USBADR_MASK (0x7f << 25)
141#define USBADRA BIT(24) /* device address advance */
142 u32 endpointlistaddr;/* endpoint list top memory address */
143/* bits 31:11, endpoint list pointer */
144#define EPBASE(d) (((d)>>11)&0x1fffff)
145#define ENDPOINTLISTADDR_MASK (0x1fffff << 11)
146 u32 ttctrl; /* H: TT operatin, not used */
147 /* offset: 0x50 */
148 u32 burstsize; /* burst size of data movement */
149#define TXPBURST(b) \
150 (((b)>>8)&0xff) /* bits 15:8, TX burst length */
151#define RXPBURST(b) \
152 (((b)>>0)&0xff) /* bits 7:0, RX burst length */
153 u32 txfilltuning; /* TX tuning */
154 u32 txttfilltuning; /* H: TX TT tuning */
155 u32 ic_usb; /* control the IC_USB FS/LS transceiver */
156 /* offset: 0x60 */
157 u32 ulpi_viewport; /* indirect access to ULPI PHY */
158#define ULPIWU BIT(31) /* ULPI wakeup */
159#define ULPIRUN BIT(30) /* ULPI read/write run */
160#define ULPIRW BIT(29) /* ULPI read/write control */
161#define ULPISS BIT(27) /* ULPI sync state */
162#define ULPIPORT(u) \
163 (((u)>>24)&7) /* bits 26:24, ULPI port number */
164#define ULPIADDR(u) \
165 (((u)>>16)&0xff) /* bits 23:16, ULPI data address */
166#define ULPIDATRD(u) \
167 (((u)>>8)&0xff) /* bits 15:8, ULPI data read */
168#define ULPIDATWR(u) \
169 (((u)>>0)&0xff) /* bits 7:0, ULPI date write */
170 u8 _reserved6[0x70-0x64];
171 /* offset: 0x70 */
172 u32 configflag; /* H: not used */
173 u32 portsc1; /* port status */
174#define DA(p) \
175 (((p)>>25)&0x7f) /* bits 31:25, device address */
176#define PORTS_SSTS (BIT(24) | BIT(23)) /* suspend status */
177#define PORTS_WKOC BIT(22) /* wake on over-current enable */
178#define PORTS_WKDS BIT(21) /* wake on disconnect enable */
179#define PORTS_WKCN BIT(20) /* wake on connect enable */
180#define PORTS_PTC(p) (((p)>>16)&0xf) /* bits 19:16, port test control */
181#define PORTS_PIC (BIT(15) | BIT(14)) /* port indicator control */
182#define PORTS_PO BIT(13) /* port owner */
183#define PORTS_PP BIT(12) /* port power */
184#define PORTS_LS (BIT(11) | BIT(10)) /* line status */
185#define PORTS_SLP BIT(9) /* suspend using L1 */
186#define PORTS_PR BIT(8) /* port reset */
187#define PORTS_SUSP BIT(7) /* suspend */
188#define PORTS_FPR BIT(6) /* force port resume */
189#define PORTS_OCC BIT(5) /* over-current change */
190#define PORTS_OCA BIT(4) /* over-current active */
191#define PORTS_PEC BIT(3) /* port enable/disable change */
192#define PORTS_PE BIT(2) /* port enable/disable */
193#define PORTS_CSC BIT(1) /* connect status change */
194#define PORTS_CCS BIT(0) /* current connect status */
195 u8 _reserved7[0xb4-0x78];
196 /* offset: 0xb4 */
197 u32 devlc; /* control LPM and each USB port behavior */
198/* bits 31:29, parallel transceiver select */
199#define LPM_PTS(d) (((d)>>29)&7)
200#define LPM_STS BIT(28) /* serial transceiver select */
201#define LPM_PTW BIT(27) /* parallel transceiver width */
202#define LPM_PSPD(d) (((d)>>25)&3) /* bits 26:25, port speed */
203#define LPM_PSPD_MASK (BIT(26) | BIT(25))
204#define LPM_SPEED_FULL 0
205#define LPM_SPEED_LOW 1
206#define LPM_SPEED_HIGH 2
207#define LPM_SRT BIT(24) /* shorten reset time */
208#define LPM_PFSC BIT(23) /* port force full speed connect */
209#define LPM_PHCD BIT(22) /* PHY low power suspend clock disable */
210#define LPM_STL BIT(16) /* STALL reply to LPM token */
211#define LPM_BA(d) \
212 (((d)>>1)&0x7ff) /* bits 11:1, BmAttributes */
213#define LPM_NYT_ACK BIT(0) /* NYET/ACK reply to LPM token */
214 u8 _reserved8[0xf4-0xb8];
215 /* offset: 0xf4 */
216 u32 otgsc; /* On-The-Go status and control */
217#define OTGSC_DPIE BIT(30) /* data pulse interrupt enable */
218#define OTGSC_MSE BIT(29) /* 1 ms timer interrupt enable */
219#define OTGSC_BSEIE BIT(28) /* B session end interrupt enable */
220#define OTGSC_BSVIE BIT(27) /* B session valid interrupt enable */
221#define OTGSC_ASVIE BIT(26) /* A session valid interrupt enable */
222#define OTGSC_AVVIE BIT(25) /* A VBUS valid interrupt enable */
223#define OTGSC_IDIE BIT(24) /* USB ID interrupt enable */
224#define OTGSC_DPIS BIT(22) /* data pulse interrupt status */
225#define OTGSC_MSS BIT(21) /* 1 ms timer interrupt status */
226#define OTGSC_BSEIS BIT(20) /* B session end interrupt status */
227#define OTGSC_BSVIS BIT(19) /* B session valid interrupt status */
228#define OTGSC_ASVIS BIT(18) /* A session valid interrupt status */
229#define OTGSC_AVVIS BIT(17) /* A VBUS valid interrupt status */
230#define OTGSC_IDIS BIT(16) /* USB ID interrupt status */
231#define OTGSC_DPS BIT(14) /* data bus pulsing status */
232#define OTGSC_MST BIT(13) /* 1 ms timer toggle */
233#define OTGSC_BSE BIT(12) /* B session end */
234#define OTGSC_BSV BIT(11) /* B session valid */
235#define OTGSC_ASV BIT(10) /* A session valid */
236#define OTGSC_AVV BIT(9) /* A VBUS valid */
237#define OTGSC_USBID BIT(8) /* USB ID */
238#define OTGSC_HABA BIT(7) /* hw assist B-disconnect to A-connect */
239#define OTGSC_HADP BIT(6) /* hw assist data pulse */
240#define OTGSC_IDPU BIT(5) /* ID pullup */
241#define OTGSC_DP BIT(4) /* data pulsing */
242#define OTGSC_OT BIT(3) /* OTG termination */
243#define OTGSC_HAAR BIT(2) /* hw assist auto reset */
244#define OTGSC_VC BIT(1) /* VBUS charge */
245#define OTGSC_VD BIT(0) /* VBUS discharge */
246 u32 usbmode;
247#define MODE_VBPS BIT(5) /* R/W VBUS power select */
248#define MODE_SDIS BIT(4) /* R/W stream disable mode */
249#define MODE_SLOM BIT(3) /* R/W setup lockout mode */
250#define MODE_ENSE BIT(2) /* endian select */
251#define MODE_CM(u) (((u)>>0)&3) /* bits 1:0, controller mode */
252#define MODE_IDLE 0
253#define MODE_DEVICE 2
254#define MODE_HOST 3
255 u8 _reserved9[0x100-0xfc];
256 /* offset: 0x100 */
257 u32 endptnak;
258#define EPTN(e) \
259 (((e)>>16)&0xffff) /* bits 31:16, TX endpoint NAK */
260#define EPRN(e) \
261 (((e)>>0)&0xffff) /* bits 15:0, RX endpoint NAK */
262 u32 endptnaken;
263#define EPTNE(e) \
264 (((e)>>16)&0xffff) /* bits 31:16, TX endpoint NAK enable */
265#define EPRNE(e) \
266 (((e)>>0)&0xffff) /* bits 15:0, RX endpoint NAK enable */
267 u32 endptsetupstat;
268#define SETUPSTAT_MASK (0xffff << 0) /* bits 15:0 */
269#define EP0SETUPSTAT_MASK 1
270 u32 endptprime;
271/* bits 31:16, prime endpoint transmit buffer */
272#define PETB(e) (((e)>>16)&0xffff)
273/* bits 15:0, prime endpoint receive buffer */
274#define PERB(e) (((e)>>0)&0xffff)
275 /* offset: 0x110 */
276 u32 endptflush;
277/* bits 31:16, flush endpoint transmit buffer */
278#define FETB(e) (((e)>>16)&0xffff)
279/* bits 15:0, flush endpoint receive buffer */
280#define FERB(e) (((e)>>0)&0xffff)
281 u32 endptstat;
282/* bits 31:16, endpoint transmit buffer ready */
283#define ETBR(e) (((e)>>16)&0xffff)
284/* bits 15:0, endpoint receive buffer ready */
285#define ERBR(e) (((e)>>0)&0xffff)
286 u32 endptcomplete;
287/* bits 31:16, endpoint transmit complete event */
288#define ETCE(e) (((e)>>16)&0xffff)
289/* bits 15:0, endpoint receive complete event */
290#define ERCE(e) (((e)>>0)&0xffff)
291 /* offset: 0x11c */
292 u32 endptctrl[16];
293#define EPCTRL_TXE BIT(23) /* TX endpoint enable */
294#define EPCTRL_TXR BIT(22) /* TX data toggle reset */
295#define EPCTRL_TXI BIT(21) /* TX data toggle inhibit */
296#define EPCTRL_TXT(e) (((e)>>18)&3) /* bits 19:18, TX endpoint type */
297#define EPCTRL_TXT_SHIFT 18
298#define EPCTRL_TXD BIT(17) /* TX endpoint data source */
299#define EPCTRL_TXS BIT(16) /* TX endpoint STALL */
300#define EPCTRL_RXE BIT(7) /* RX endpoint enable */
301#define EPCTRL_RXR BIT(6) /* RX data toggle reset */
302#define EPCTRL_RXI BIT(5) /* RX data toggle inhibit */
303#define EPCTRL_RXT(e) (((e)>>2)&3) /* bits 3:2, RX endpoint type */
304#define EPCTRL_RXT_SHIFT 2 /* bits 19:18, TX endpoint type */
305#define EPCTRL_RXD BIT(1) /* RX endpoint data sink */
306#define EPCTRL_RXS BIT(0) /* RX endpoint STALL */
307} __attribute__ ((packed));
308
309#endif /* __LANGWELL_UDC_H */
310
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h
index 474283888233..86c0b451745d 100644
--- a/include/linux/usb/serial.h
+++ b/include/linux/usb/serial.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * USB Serial Converter stuff 2 * USB Serial Converter stuff
3 * 3 *
4 * Copyright (C) 1999 - 2005 4 * Copyright (C) 1999 - 2012
5 * Greg Kroah-Hartman (greg@kroah.com) 5 * Greg Kroah-Hartman (greg@kroah.com)
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
@@ -249,6 +249,7 @@ struct usb_serial_driver {
249 249
250 int (*suspend)(struct usb_serial *serial, pm_message_t message); 250 int (*suspend)(struct usb_serial *serial, pm_message_t message);
251 int (*resume)(struct usb_serial *serial); 251 int (*resume)(struct usb_serial *serial);
252 int (*reset_resume)(struct usb_serial *serial);
252 253
253 /* serial function calls */ 254 /* serial function calls */
254 /* Called by console and by the tty layer */ 255 /* Called by console and by the tty layer */
@@ -292,16 +293,11 @@ struct usb_serial_driver {
292#define to_usb_serial_driver(d) \ 293#define to_usb_serial_driver(d) \
293 container_of(d, struct usb_serial_driver, driver) 294 container_of(d, struct usb_serial_driver, driver)
294 295
295extern int usb_serial_register_drivers(struct usb_driver *udriver, 296extern int usb_serial_register_drivers(struct usb_serial_driver *const serial_drivers[],
296 struct usb_serial_driver * const serial_drivers[]); 297 const char *name, const struct usb_device_id *id_table);
297extern void usb_serial_deregister_drivers(struct usb_driver *udriver, 298extern void usb_serial_deregister_drivers(struct usb_serial_driver *const serial_drivers[]);
298 struct usb_serial_driver * const serial_drivers[]);
299extern void usb_serial_port_softint(struct usb_serial_port *port); 299extern void usb_serial_port_softint(struct usb_serial_port *port);
300 300
301extern int usb_serial_probe(struct usb_interface *iface,
302 const struct usb_device_id *id);
303extern void usb_serial_disconnect(struct usb_interface *iface);
304
305extern int usb_serial_suspend(struct usb_interface *intf, pm_message_t message); 301extern int usb_serial_suspend(struct usb_interface *intf, pm_message_t message);
306extern int usb_serial_resume(struct usb_interface *intf); 302extern int usb_serial_resume(struct usb_interface *intf);
307 303
@@ -400,8 +396,8 @@ do { \
400 396
401/* 397/*
402 * module_usb_serial_driver() - Helper macro for registering a USB Serial driver 398 * module_usb_serial_driver() - Helper macro for registering a USB Serial driver
403 * @__usb_driver: usb_driver struct to register
404 * @__serial_drivers: list of usb_serial drivers to register 399 * @__serial_drivers: list of usb_serial drivers to register
400 * @__ids: all device ids that @__serial_drivers bind to
405 * 401 *
406 * Helper macro for USB serial drivers which do not do anything special 402 * Helper macro for USB serial drivers which do not do anything special
407 * in module init/exit. This eliminates a lot of boilerplate. Each 403 * in module init/exit. This eliminates a lot of boilerplate. Each
@@ -409,9 +405,21 @@ do { \
409 * module_init() and module_exit() 405 * module_init() and module_exit()
410 * 406 *
411 */ 407 */
412#define module_usb_serial_driver(__usb_driver, __serial_drivers) \ 408#define usb_serial_module_driver(__name, __serial_drivers, __ids) \
413 module_driver(__usb_driver, usb_serial_register_drivers, \ 409static int __init usb_serial_module_init(void) \
414 usb_serial_deregister_drivers, __serial_drivers) 410{ \
411 return usb_serial_register_drivers(__serial_drivers, \
412 __name, __ids); \
413} \
414module_init(usb_serial_module_init); \
415static void __exit usb_serial_module_exit(void) \
416{ \
417 usb_serial_deregister_drivers(__serial_drivers); \
418} \
419module_exit(usb_serial_module_exit);
420
421#define module_usb_serial_driver(__serial_drivers, __ids) \
422 usb_serial_module_driver(KBUILD_MODNAME, __serial_drivers, __ids)
415 423
416#endif /* __LINUX_USB_SERIAL_H */ 424#endif /* __LINUX_USB_SERIAL_H */
417 425
diff --git a/include/linux/uuid.h b/include/linux/uuid.h
index 5b7efbfcee4e..f86c37bfd4a0 100644
--- a/include/linux/uuid.h
+++ b/include/linux/uuid.h
@@ -54,6 +54,8 @@ typedef struct {
54 UUID_BE(0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, \ 54 UUID_BE(0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, \
55 0x00, 0x00, 0x00, 0x00) 55 0x00, 0x00, 0x00, 0x00)
56 56
57#ifdef __KERNEL__
58
57static inline int uuid_le_cmp(const uuid_le u1, const uuid_le u2) 59static inline int uuid_le_cmp(const uuid_le u1, const uuid_le u2)
58{ 60{
59 return memcmp(&u1, &u2, sizeof(uuid_le)); 61 return memcmp(&u1, &u2, sizeof(uuid_le));
@@ -67,4 +69,6 @@ static inline int uuid_be_cmp(const uuid_be u1, const uuid_be u2)
67extern void uuid_le_gen(uuid_le *u); 69extern void uuid_le_gen(uuid_le *u);
68extern void uuid_be_gen(uuid_be *u); 70extern void uuid_be_gen(uuid_be *u);
69 71
72#endif /* __KERNEL__ */
73
70#endif 74#endif
diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h
index 7323a3390206..fc457f452f64 100644
--- a/include/linux/virtio_config.h
+++ b/include/linux/virtio_config.h
@@ -74,15 +74,6 @@
74 * @set_status: write the status byte 74 * @set_status: write the status byte
75 * vdev: the virtio_device 75 * vdev: the virtio_device
76 * status: the new status byte 76 * status: the new status byte
77 * @request_vqs: request the specified number of virtqueues
78 * vdev: the virtio_device
79 * max_vqs: the max number of virtqueues we want
80 * If supplied, must call before any virtqueues are instantiated.
81 * To modify the max number of virtqueues after request_vqs has been
82 * called, call free_vqs and then request_vqs with a new value.
83 * @free_vqs: cleanup resources allocated by request_vqs
84 * vdev: the virtio_device
85 * If supplied, must call after all virtqueues have been deleted.
86 * @reset: reset the device 77 * @reset: reset the device
87 * vdev: the virtio device 78 * vdev: the virtio device
88 * After this, status and feature negotiation must be done again 79 * After this, status and feature negotiation must be done again
@@ -156,7 +147,7 @@ static inline bool virtio_has_feature(const struct virtio_device *vdev,
156 * @vdev: the virtio device 147 * @vdev: the virtio device
157 * @fbit: the feature bit 148 * @fbit: the feature bit
158 * @offset: the type to search for. 149 * @offset: the type to search for.
159 * @val: a pointer to the value to fill in. 150 * @v: a pointer to the value to fill in.
160 * 151 *
161 * The return value is -ENOENT if the feature doesn't exist. Otherwise 152 * The return value is -ENOENT if the feature doesn't exist. Otherwise
162 * the config value is copied into whatever is pointed to by v. */ 153 * the config value is copied into whatever is pointed to by v. */
diff --git a/include/linux/vme.h b/include/linux/vme.h
new file mode 100644
index 000000000000..c9d65bf14cec
--- /dev/null
+++ b/include/linux/vme.h
@@ -0,0 +1,174 @@
1#ifndef _VME_H_
2#define _VME_H_
3
4/* Resource Type */
5enum vme_resource_type {
6 VME_MASTER,
7 VME_SLAVE,
8 VME_DMA,
9 VME_LM
10};
11
12/* VME Address Spaces */
13#define VME_A16 0x1
14#define VME_A24 0x2
15#define VME_A32 0x4
16#define VME_A64 0x8
17#define VME_CRCSR 0x10
18#define VME_USER1 0x20
19#define VME_USER2 0x40
20#define VME_USER3 0x80
21#define VME_USER4 0x100
22
23#define VME_A16_MAX 0x10000ULL
24#define VME_A24_MAX 0x1000000ULL
25#define VME_A32_MAX 0x100000000ULL
26#define VME_A64_MAX 0x10000000000000000ULL
27#define VME_CRCSR_MAX 0x1000000ULL
28
29
30/* VME Cycle Types */
31#define VME_SCT 0x1
32#define VME_BLT 0x2
33#define VME_MBLT 0x4
34#define VME_2eVME 0x8
35#define VME_2eSST 0x10
36#define VME_2eSSTB 0x20
37
38#define VME_2eSST160 0x100
39#define VME_2eSST267 0x200
40#define VME_2eSST320 0x400
41
42#define VME_SUPER 0x1000
43#define VME_USER 0x2000
44#define VME_PROG 0x4000
45#define VME_DATA 0x8000
46
47/* VME Data Widths */
48#define VME_D8 0x1
49#define VME_D16 0x2
50#define VME_D32 0x4
51#define VME_D64 0x8
52
53/* Arbitration Scheduling Modes */
54#define VME_R_ROBIN_MODE 0x1
55#define VME_PRIORITY_MODE 0x2
56
57#define VME_DMA_PATTERN (1<<0)
58#define VME_DMA_PCI (1<<1)
59#define VME_DMA_VME (1<<2)
60
61#define VME_DMA_PATTERN_BYTE (1<<0)
62#define VME_DMA_PATTERN_WORD (1<<1)
63#define VME_DMA_PATTERN_INCREMENT (1<<2)
64
65#define VME_DMA_VME_TO_MEM (1<<0)
66#define VME_DMA_MEM_TO_VME (1<<1)
67#define VME_DMA_VME_TO_VME (1<<2)
68#define VME_DMA_MEM_TO_MEM (1<<3)
69#define VME_DMA_PATTERN_TO_VME (1<<4)
70#define VME_DMA_PATTERN_TO_MEM (1<<5)
71
72struct vme_dma_attr {
73 u32 type;
74 void *private;
75};
76
77struct vme_resource {
78 enum vme_resource_type type;
79 struct list_head *entry;
80};
81
82extern struct bus_type vme_bus_type;
83
84/* VME_MAX_BRIDGES comes from the type of vme_bus_numbers */
85#define VME_MAX_BRIDGES (sizeof(unsigned int)*8)
86#define VME_MAX_SLOTS 32
87
88#define VME_SLOT_CURRENT -1
89#define VME_SLOT_ALL -2
90
91/**
92 * Structure representing a VME device
93 * @num: The device number
94 * @bridge: Pointer to the bridge device this device is on
95 * @dev: Internal device structure
96 * @drv_list: List of devices (per driver)
97 * @bridge_list: List of devices (per bridge)
98 */
99struct vme_dev {
100 int num;
101 struct vme_bridge *bridge;
102 struct device dev;
103 struct list_head drv_list;
104 struct list_head bridge_list;
105};
106
107struct vme_driver {
108 struct list_head node;
109 const char *name;
110 int (*match)(struct vme_dev *);
111 int (*probe)(struct vme_dev *);
112 int (*remove)(struct vme_dev *);
113 void (*shutdown)(void);
114 struct device_driver driver;
115 struct list_head devices;
116};
117
118void *vme_alloc_consistent(struct vme_resource *, size_t, dma_addr_t *);
119void vme_free_consistent(struct vme_resource *, size_t, void *,
120 dma_addr_t);
121
122size_t vme_get_size(struct vme_resource *);
123
124struct vme_resource *vme_slave_request(struct vme_dev *, u32, u32);
125int vme_slave_set(struct vme_resource *, int, unsigned long long,
126 unsigned long long, dma_addr_t, u32, u32);
127int vme_slave_get(struct vme_resource *, int *, unsigned long long *,
128 unsigned long long *, dma_addr_t *, u32 *, u32 *);
129void vme_slave_free(struct vme_resource *);
130
131struct vme_resource *vme_master_request(struct vme_dev *, u32, u32, u32);
132int vme_master_set(struct vme_resource *, int, unsigned long long,
133 unsigned long long, u32, u32, u32);
134int vme_master_get(struct vme_resource *, int *, unsigned long long *,
135 unsigned long long *, u32 *, u32 *, u32 *);
136ssize_t vme_master_read(struct vme_resource *, void *, size_t, loff_t);
137ssize_t vme_master_write(struct vme_resource *, void *, size_t, loff_t);
138unsigned int vme_master_rmw(struct vme_resource *, unsigned int, unsigned int,
139 unsigned int, loff_t);
140void vme_master_free(struct vme_resource *);
141
142struct vme_resource *vme_dma_request(struct vme_dev *, u32);
143struct vme_dma_list *vme_new_dma_list(struct vme_resource *);
144struct vme_dma_attr *vme_dma_pattern_attribute(u32, u32);
145struct vme_dma_attr *vme_dma_pci_attribute(dma_addr_t);
146struct vme_dma_attr *vme_dma_vme_attribute(unsigned long long, u32, u32, u32);
147void vme_dma_free_attribute(struct vme_dma_attr *);
148int vme_dma_list_add(struct vme_dma_list *, struct vme_dma_attr *,
149 struct vme_dma_attr *, size_t);
150int vme_dma_list_exec(struct vme_dma_list *);
151int vme_dma_list_free(struct vme_dma_list *);
152int vme_dma_free(struct vme_resource *);
153
154int vme_irq_request(struct vme_dev *, int, int,
155 void (*callback)(int, int, void *), void *);
156void vme_irq_free(struct vme_dev *, int, int);
157int vme_irq_generate(struct vme_dev *, int, int);
158
159struct vme_resource *vme_lm_request(struct vme_dev *);
160int vme_lm_count(struct vme_resource *);
161int vme_lm_set(struct vme_resource *, unsigned long long, u32, u32);
162int vme_lm_get(struct vme_resource *, unsigned long long *, u32 *, u32 *);
163int vme_lm_attach(struct vme_resource *, int, void (*callback)(int));
164int vme_lm_detach(struct vme_resource *, int);
165void vme_lm_free(struct vme_resource *);
166
167int vme_slot_get(struct vme_dev *);
168
169int vme_register_driver(struct vme_driver *, unsigned int);
170void vme_unregister_driver(struct vme_driver *);
171
172
173#endif /* _VME_H_ */
174
diff --git a/include/linux/vt_kern.h b/include/linux/vt_kern.h
index e33d77f15bda..50ae7d0c279e 100644
--- a/include/linux/vt_kern.h
+++ b/include/linux/vt_kern.h
@@ -70,7 +70,6 @@ int con_set_unimap(struct vc_data *vc, ushort ct, struct unipair __user *list);
70int con_get_unimap(struct vc_data *vc, ushort ct, ushort __user *uct, struct unipair __user *list); 70int con_get_unimap(struct vc_data *vc, ushort ct, ushort __user *uct, struct unipair __user *list);
71int con_set_default_unimap(struct vc_data *vc); 71int con_set_default_unimap(struct vc_data *vc);
72void con_free_unimap(struct vc_data *vc); 72void con_free_unimap(struct vc_data *vc);
73void con_protect_unimap(struct vc_data *vc, int rdonly);
74int con_copy_unimap(struct vc_data *dst_vc, struct vc_data *src_vc); 73int con_copy_unimap(struct vc_data *dst_vc, struct vc_data *src_vc);
75 74
76#define vc_translate(vc, c) ((vc)->vc_translate[(c) | \ 75#define vc_translate(vc, c) ((vc)->vc_translate[(c) | \
diff --git a/include/memory/jedec_ddr.h b/include/memory/jedec_ddr.h
new file mode 100644
index 000000000000..ddad0f870e5d
--- /dev/null
+++ b/include/memory/jedec_ddr.h
@@ -0,0 +1,175 @@
1/*
2 * Definitions for DDR memories based on JEDEC specs
3 *
4 * Copyright (C) 2012 Texas Instruments, Inc.
5 *
6 * Aneesh V <aneesh@ti.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12#ifndef __LINUX_JEDEC_DDR_H
13#define __LINUX_JEDEC_DDR_H
14
15#include <linux/types.h>
16
17/* DDR Densities */
18#define DDR_DENSITY_64Mb 1
19#define DDR_DENSITY_128Mb 2
20#define DDR_DENSITY_256Mb 3
21#define DDR_DENSITY_512Mb 4
22#define DDR_DENSITY_1Gb 5
23#define DDR_DENSITY_2Gb 6
24#define DDR_DENSITY_4Gb 7
25#define DDR_DENSITY_8Gb 8
26#define DDR_DENSITY_16Gb 9
27#define DDR_DENSITY_32Gb 10
28
29/* DDR type */
30#define DDR_TYPE_DDR2 1
31#define DDR_TYPE_DDR3 2
32#define DDR_TYPE_LPDDR2_S4 3
33#define DDR_TYPE_LPDDR2_S2 4
34#define DDR_TYPE_LPDDR2_NVM 5
35
36/* DDR IO width */
37#define DDR_IO_WIDTH_4 1
38#define DDR_IO_WIDTH_8 2
39#define DDR_IO_WIDTH_16 3
40#define DDR_IO_WIDTH_32 4
41
42/* Number of Row bits */
43#define R9 9
44#define R10 10
45#define R11 11
46#define R12 12
47#define R13 13
48#define R14 14
49#define R15 15
50#define R16 16
51
52/* Number of Column bits */
53#define C7 7
54#define C8 8
55#define C9 9
56#define C10 10
57#define C11 11
58#define C12 12
59
60/* Number of Banks */
61#define B1 0
62#define B2 1
63#define B4 2
64#define B8 3
65
66/* Refresh rate in nano-seconds */
67#define T_REFI_15_6 15600
68#define T_REFI_7_8 7800
69#define T_REFI_3_9 3900
70
71/* tRFC values */
72#define T_RFC_90 90000
73#define T_RFC_110 110000
74#define T_RFC_130 130000
75#define T_RFC_160 160000
76#define T_RFC_210 210000
77#define T_RFC_300 300000
78#define T_RFC_350 350000
79
80/* Mode register numbers */
81#define DDR_MR0 0
82#define DDR_MR1 1
83#define DDR_MR2 2
84#define DDR_MR3 3
85#define DDR_MR4 4
86#define DDR_MR5 5
87#define DDR_MR6 6
88#define DDR_MR7 7
89#define DDR_MR8 8
90#define DDR_MR9 9
91#define DDR_MR10 10
92#define DDR_MR11 11
93#define DDR_MR16 16
94#define DDR_MR17 17
95#define DDR_MR18 18
96
97/*
98 * LPDDR2 related defines
99 */
100
101/* MR4 register fields */
102#define MR4_SDRAM_REF_RATE_SHIFT 0
103#define MR4_SDRAM_REF_RATE_MASK 7
104#define MR4_TUF_SHIFT 7
105#define MR4_TUF_MASK (1 << 7)
106
107/* MR4 SDRAM Refresh Rate field values */
108#define SDRAM_TEMP_NOMINAL 0x3
109#define SDRAM_TEMP_RESERVED_4 0x4
110#define SDRAM_TEMP_HIGH_DERATE_REFRESH 0x5
111#define SDRAM_TEMP_HIGH_DERATE_REFRESH_AND_TIMINGS 0x6
112#define SDRAM_TEMP_VERY_HIGH_SHUTDOWN 0x7
113
114#define NUM_DDR_ADDR_TABLE_ENTRIES 11
115#define NUM_DDR_TIMING_TABLE_ENTRIES 4
116
117/* Structure for DDR addressing info from the JEDEC spec */
118struct lpddr2_addressing {
119 u32 num_banks;
120 u32 tREFI_ns;
121 u32 tRFCab_ps;
122};
123
124/*
125 * Structure for timings from the LPDDR2 datasheet
126 * All parameters are in pico seconds(ps) unless explicitly indicated
127 * with a suffix like tRAS_max_ns below
128 */
129struct lpddr2_timings {
130 u32 max_freq;
131 u32 min_freq;
132 u32 tRPab;
133 u32 tRCD;
134 u32 tWR;
135 u32 tRAS_min;
136 u32 tRRD;
137 u32 tWTR;
138 u32 tXP;
139 u32 tRTP;
140 u32 tCKESR;
141 u32 tDQSCK_max;
142 u32 tDQSCK_max_derated;
143 u32 tFAW;
144 u32 tZQCS;
145 u32 tZQCL;
146 u32 tZQinit;
147 u32 tRAS_max_ns;
148};
149
150/*
151 * Min value for some parameters in terms of number of tCK cycles(nCK)
152 * Please set to zero parameters that are not valid for a given memory
153 * type
154 */
155struct lpddr2_min_tck {
156 u32 tRPab;
157 u32 tRCD;
158 u32 tWR;
159 u32 tRASmin;
160 u32 tRRD;
161 u32 tWTR;
162 u32 tXP;
163 u32 tRTP;
164 u32 tCKE;
165 u32 tCKESR;
166 u32 tFAW;
167};
168
169extern const struct lpddr2_addressing
170 lpddr2_jedec_addressing_table[NUM_DDR_ADDR_TABLE_ENTRIES];
171extern const struct lpddr2_timings
172 lpddr2_jedec_timings[NUM_DDR_TIMING_TABLE_ENTRIES];
173extern const struct lpddr2_min_tck lpddr2_jedec_min_tck;
174
175#endif /* __LINUX_JEDEC_DDR_H */
diff --git a/include/mtd/ubi-user.h b/include/mtd/ubi-user.h
index 3c4109777aff..8787349fbafe 100644
--- a/include/mtd/ubi-user.h
+++ b/include/mtd/ubi-user.h
@@ -196,23 +196,6 @@
196#define UBI_MAX_RNVOL 32 196#define UBI_MAX_RNVOL 32
197 197
198/* 198/*
199 * UBI data type hint constants.
200 *
201 * UBI_LONGTERM: long-term data
202 * UBI_SHORTTERM: short-term data
203 * UBI_UNKNOWN: data persistence is unknown
204 *
205 * These constants are used when data is written to UBI volumes in order to
206 * help the UBI wear-leveling unit to find more appropriate physical
207 * eraseblocks.
208 */
209enum {
210 UBI_LONGTERM = 1,
211 UBI_SHORTTERM = 2,
212 UBI_UNKNOWN = 3,
213};
214
215/*
216 * UBI volume type constants. 199 * UBI volume type constants.
217 * 200 *
218 * @UBI_DYNAMIC_VOLUME: dynamic volume 201 * @UBI_DYNAMIC_VOLUME: dynamic volume
@@ -375,25 +358,34 @@ struct ubi_rnvol_req {
375 * requests. 358 * requests.
376 * @lnum: logical eraseblock number to change 359 * @lnum: logical eraseblock number to change
377 * @bytes: how many bytes will be written to the logical eraseblock 360 * @bytes: how many bytes will be written to the logical eraseblock
378 * @dtype: data type (%UBI_LONGTERM, %UBI_SHORTTERM, %UBI_UNKNOWN) 361 * @dtype: pass "3" for better compatibility with old kernels
379 * @padding: reserved for future, not used, has to be zeroed 362 * @padding: reserved for future, not used, has to be zeroed
363 *
364 * The @dtype field used to inform UBI about what kind of data will be written
365 * to the LEB: long term (value 1), short term (value 2), unknown (value 3).
366 * UBI tried to pick a PEB with lower erase counter for short term data and a
367 * PEB with higher erase counter for long term data. But this was not really
368 * used because users usually do not know this and could easily mislead UBI. We
369 * removed this feature in May 2012. UBI currently just ignores the @dtype
370 * field. But for better compatibility with older kernels it is recommended to
371 * set @dtype to 3 (unknown).
380 */ 372 */
381struct ubi_leb_change_req { 373struct ubi_leb_change_req {
382 __s32 lnum; 374 __s32 lnum;
383 __s32 bytes; 375 __s32 bytes;
384 __s8 dtype; 376 __s8 dtype; /* obsolete, do not use! */
385 __s8 padding[7]; 377 __s8 padding[7];
386} __packed; 378} __packed;
387 379
388/** 380/**
389 * struct ubi_map_req - a data structure used in map LEB requests. 381 * struct ubi_map_req - a data structure used in map LEB requests.
382 * @dtype: pass "3" for better compatibility with old kernels
390 * @lnum: logical eraseblock number to unmap 383 * @lnum: logical eraseblock number to unmap
391 * @dtype: data type (%UBI_LONGTERM, %UBI_SHORTTERM, %UBI_UNKNOWN)
392 * @padding: reserved for future, not used, has to be zeroed 384 * @padding: reserved for future, not used, has to be zeroed
393 */ 385 */
394struct ubi_map_req { 386struct ubi_map_req {
395 __s32 lnum; 387 __s32 lnum;
396 __s8 dtype; 388 __s8 dtype; /* obsolete, do not use! */
397 __s8 padding[3]; 389 __s8 padding[3];
398} __packed; 390} __packed;
399 391
diff --git a/include/net/addrconf.h b/include/net/addrconf.h
index 27f450ba9514..f2b801c4b555 100644
--- a/include/net/addrconf.h
+++ b/include/net/addrconf.h
@@ -131,9 +131,9 @@ extern int ipv6_sock_mc_join(struct sock *sk, int ifindex,
131extern int ipv6_sock_mc_drop(struct sock *sk, int ifindex, 131extern int ipv6_sock_mc_drop(struct sock *sk, int ifindex,
132 const struct in6_addr *addr); 132 const struct in6_addr *addr);
133extern void ipv6_sock_mc_close(struct sock *sk); 133extern void ipv6_sock_mc_close(struct sock *sk);
134extern int inet6_mc_check(struct sock *sk, 134extern bool inet6_mc_check(struct sock *sk,
135 const struct in6_addr *mc_addr, 135 const struct in6_addr *mc_addr,
136 const struct in6_addr *src_addr); 136 const struct in6_addr *src_addr);
137 137
138extern int ipv6_dev_mc_inc(struct net_device *dev, const struct in6_addr *addr); 138extern int ipv6_dev_mc_inc(struct net_device *dev, const struct in6_addr *addr);
139extern int __ipv6_dev_mc_dec(struct inet6_dev *idev, const struct in6_addr *addr); 139extern int __ipv6_dev_mc_dec(struct inet6_dev *idev, const struct in6_addr *addr);
@@ -146,10 +146,10 @@ extern void ipv6_mc_init_dev(struct inet6_dev *idev);
146extern void ipv6_mc_destroy_dev(struct inet6_dev *idev); 146extern void ipv6_mc_destroy_dev(struct inet6_dev *idev);
147extern void addrconf_dad_failure(struct inet6_ifaddr *ifp); 147extern void addrconf_dad_failure(struct inet6_ifaddr *ifp);
148 148
149extern int ipv6_chk_mcast_addr(struct net_device *dev, 149extern bool ipv6_chk_mcast_addr(struct net_device *dev,
150 const struct in6_addr *group, 150 const struct in6_addr *group,
151 const struct in6_addr *src_addr); 151 const struct in6_addr *src_addr);
152extern int ipv6_is_mld(struct sk_buff *skb, int nexthdr); 152extern bool ipv6_is_mld(struct sk_buff *skb, int nexthdr);
153 153
154extern void addrconf_prefix_rcv(struct net_device *dev, 154extern void addrconf_prefix_rcv(struct net_device *dev,
155 u8 *opt, int len, bool sllao); 155 u8 *opt, int len, bool sllao);
@@ -163,8 +163,8 @@ extern void ipv6_sock_ac_close(struct sock *sk);
163 163
164extern int ipv6_dev_ac_inc(struct net_device *dev, const struct in6_addr *addr); 164extern int ipv6_dev_ac_inc(struct net_device *dev, const struct in6_addr *addr);
165extern int __ipv6_dev_ac_dec(struct inet6_dev *idev, const struct in6_addr *addr); 165extern int __ipv6_dev_ac_dec(struct inet6_dev *idev, const struct in6_addr *addr);
166extern int ipv6_chk_acast_addr(struct net *net, struct net_device *dev, 166extern bool ipv6_chk_acast_addr(struct net *net, struct net_device *dev,
167 const struct in6_addr *addr); 167 const struct in6_addr *addr);
168 168
169 169
170/* Device notifier */ 170/* Device notifier */
diff --git a/include/net/inet_frag.h b/include/net/inet_frag.h
index 16ff29a7bb30..2431cf83aeca 100644
--- a/include/net/inet_frag.h
+++ b/include/net/inet_frag.h
@@ -46,8 +46,7 @@ struct inet_frags {
46 void *arg); 46 void *arg);
47 void (*destructor)(struct inet_frag_queue *); 47 void (*destructor)(struct inet_frag_queue *);
48 void (*skb_free)(struct sk_buff *); 48 void (*skb_free)(struct sk_buff *);
49 int (*match)(struct inet_frag_queue *q, 49 bool (*match)(struct inet_frag_queue *q, void *arg);
50 void *arg);
51 void (*frag_expire)(unsigned long data); 50 void (*frag_expire)(unsigned long data);
52}; 51};
53 52
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
index c062b6773cc7..37c1a1ed82c1 100644
--- a/include/net/ip6_route.h
+++ b/include/net/ip6_route.h
@@ -175,7 +175,7 @@ static inline void ip6_dst_store(struct sock *sk, struct dst_entry *dst,
175 spin_unlock(&sk->sk_dst_lock); 175 spin_unlock(&sk->sk_dst_lock);
176} 176}
177 177
178static inline int ipv6_unicast_destination(struct sk_buff *skb) 178static inline bool ipv6_unicast_destination(const struct sk_buff *skb)
179{ 179{
180 struct rt6_info *rt = (struct rt6_info *) skb_dst(skb); 180 struct rt6_info *rt = (struct rt6_info *) skb_dst(skb);
181 181
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 4332e9aad853..aecf88436abf 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -263,7 +263,7 @@ extern struct ipv6_txoptions * ipv6_renew_options(struct sock *sk, struct ipv6_t
263struct ipv6_txoptions *ipv6_fixup_options(struct ipv6_txoptions *opt_space, 263struct ipv6_txoptions *ipv6_fixup_options(struct ipv6_txoptions *opt_space,
264 struct ipv6_txoptions *opt); 264 struct ipv6_txoptions *opt);
265 265
266extern int ipv6_opt_accepted(struct sock *sk, struct sk_buff *skb); 266extern bool ipv6_opt_accepted(const struct sock *sk, const struct sk_buff *skb);
267 267
268int ip6_frag_nqueues(struct net *net); 268int ip6_frag_nqueues(struct net *net);
269int ip6_frag_mem(struct net *net); 269int ip6_frag_mem(struct net *net);
@@ -332,8 +332,8 @@ static inline void ipv6_addr_set(struct in6_addr *addr,
332 addr->s6_addr32[3] = w4; 332 addr->s6_addr32[3] = w4;
333} 333}
334 334
335static inline int ipv6_addr_equal(const struct in6_addr *a1, 335static inline bool ipv6_addr_equal(const struct in6_addr *a1,
336 const struct in6_addr *a2) 336 const struct in6_addr *a2)
337{ 337{
338 return ((a1->s6_addr32[0] ^ a2->s6_addr32[0]) | 338 return ((a1->s6_addr32[0] ^ a2->s6_addr32[0]) |
339 (a1->s6_addr32[1] ^ a2->s6_addr32[1]) | 339 (a1->s6_addr32[1] ^ a2->s6_addr32[1]) |
@@ -341,27 +341,27 @@ static inline int ipv6_addr_equal(const struct in6_addr *a1,
341 (a1->s6_addr32[3] ^ a2->s6_addr32[3])) == 0; 341 (a1->s6_addr32[3] ^ a2->s6_addr32[3])) == 0;
342} 342}
343 343
344static inline int __ipv6_prefix_equal(const __be32 *a1, const __be32 *a2, 344static inline bool __ipv6_prefix_equal(const __be32 *a1, const __be32 *a2,
345 unsigned int prefixlen) 345 unsigned int prefixlen)
346{ 346{
347 unsigned int pdw, pbi; 347 unsigned int pdw, pbi;
348 348
349 /* check complete u32 in prefix */ 349 /* check complete u32 in prefix */
350 pdw = prefixlen >> 5; 350 pdw = prefixlen >> 5;
351 if (pdw && memcmp(a1, a2, pdw << 2)) 351 if (pdw && memcmp(a1, a2, pdw << 2))
352 return 0; 352 return false;
353 353
354 /* check incomplete u32 in prefix */ 354 /* check incomplete u32 in prefix */
355 pbi = prefixlen & 0x1f; 355 pbi = prefixlen & 0x1f;
356 if (pbi && ((a1[pdw] ^ a2[pdw]) & htonl((0xffffffff) << (32 - pbi)))) 356 if (pbi && ((a1[pdw] ^ a2[pdw]) & htonl((0xffffffff) << (32 - pbi))))
357 return 0; 357 return false;
358 358
359 return 1; 359 return true;
360} 360}
361 361
362static inline int ipv6_prefix_equal(const struct in6_addr *a1, 362static inline bool ipv6_prefix_equal(const struct in6_addr *a1,
363 const struct in6_addr *a2, 363 const struct in6_addr *a2,
364 unsigned int prefixlen) 364 unsigned int prefixlen)
365{ 365{
366 return __ipv6_prefix_equal(a1->s6_addr32, a2->s6_addr32, 366 return __ipv6_prefix_equal(a1->s6_addr32, a2->s6_addr32,
367 prefixlen); 367 prefixlen);
@@ -387,21 +387,21 @@ struct ip6_create_arg {
387}; 387};
388 388
389void ip6_frag_init(struct inet_frag_queue *q, void *a); 389void ip6_frag_init(struct inet_frag_queue *q, void *a);
390int ip6_frag_match(struct inet_frag_queue *q, void *a); 390bool ip6_frag_match(struct inet_frag_queue *q, void *a);
391 391
392static inline int ipv6_addr_any(const struct in6_addr *a) 392static inline bool ipv6_addr_any(const struct in6_addr *a)
393{ 393{
394 return (a->s6_addr32[0] | a->s6_addr32[1] | 394 return (a->s6_addr32[0] | a->s6_addr32[1] |
395 a->s6_addr32[2] | a->s6_addr32[3]) == 0; 395 a->s6_addr32[2] | a->s6_addr32[3]) == 0;
396} 396}
397 397
398static inline int ipv6_addr_loopback(const struct in6_addr *a) 398static inline bool ipv6_addr_loopback(const struct in6_addr *a)
399{ 399{
400 return (a->s6_addr32[0] | a->s6_addr32[1] | 400 return (a->s6_addr32[0] | a->s6_addr32[1] |
401 a->s6_addr32[2] | (a->s6_addr32[3] ^ htonl(1))) == 0; 401 a->s6_addr32[2] | (a->s6_addr32[3] ^ htonl(1))) == 0;
402} 402}
403 403
404static inline int ipv6_addr_v4mapped(const struct in6_addr *a) 404static inline bool ipv6_addr_v4mapped(const struct in6_addr *a)
405{ 405{
406 return (a->s6_addr32[0] | a->s6_addr32[1] | 406 return (a->s6_addr32[0] | a->s6_addr32[1] |
407 (a->s6_addr32[2] ^ htonl(0x0000ffff))) == 0; 407 (a->s6_addr32[2] ^ htonl(0x0000ffff))) == 0;
@@ -411,7 +411,7 @@ static inline int ipv6_addr_v4mapped(const struct in6_addr *a)
411 * Check for a RFC 4843 ORCHID address 411 * Check for a RFC 4843 ORCHID address
412 * (Overlay Routable Cryptographic Hash Identifiers) 412 * (Overlay Routable Cryptographic Hash Identifiers)
413 */ 413 */
414static inline int ipv6_addr_orchid(const struct in6_addr *a) 414static inline bool ipv6_addr_orchid(const struct in6_addr *a)
415{ 415{
416 return (a->s6_addr32[0] & htonl(0xfffffff0)) == htonl(0x20010010); 416 return (a->s6_addr32[0] & htonl(0xfffffff0)) == htonl(0x20010010);
417} 417}
@@ -559,7 +559,7 @@ extern void ipv6_push_frag_opts(struct sk_buff *skb,
559extern int ipv6_skip_exthdr(const struct sk_buff *, int start, 559extern int ipv6_skip_exthdr(const struct sk_buff *, int start,
560 u8 *nexthdrp, __be16 *frag_offp); 560 u8 *nexthdrp, __be16 *frag_offp);
561 561
562extern int ipv6_ext_hdr(u8 nexthdr); 562extern bool ipv6_ext_hdr(u8 nexthdr);
563 563
564extern int ipv6_find_tlv(struct sk_buff *skb, int offset, int type); 564extern int ipv6_find_tlv(struct sk_buff *skb, int offset, int type);
565 565
diff --git a/include/net/lapb.h b/include/net/lapb.h
index fd2bf572ee1d..df892a94f2c6 100644
--- a/include/net/lapb.h
+++ b/include/net/lapb.h
@@ -149,4 +149,10 @@ extern int lapb_t1timer_running(struct lapb_cb *lapb);
149 */ 149 */
150#define LAPB_DEBUG 0 150#define LAPB_DEBUG 0
151 151
152#define lapb_dbg(level, fmt, ...) \
153do { \
154 if (level < LAPB_DEBUG) \
155 pr_debug(fmt, ##__VA_ARGS__); \
156} while (0)
157
152#endif 158#endif
diff --git a/include/net/rawv6.h b/include/net/rawv6.h
index cf7577234457..e7ea660e4db6 100644
--- a/include/net/rawv6.h
+++ b/include/net/rawv6.h
@@ -5,7 +5,7 @@
5 5
6void raw6_icmp_error(struct sk_buff *, int nexthdr, 6void raw6_icmp_error(struct sk_buff *, int nexthdr,
7 u8 type, u8 code, int inner_offset, __be32); 7 u8 type, u8 code, int inner_offset, __be32);
8int raw6_local_deliver(struct sk_buff *, int); 8bool raw6_local_deliver(struct sk_buff *, int);
9 9
10extern int rawv6_rcv(struct sock *sk, 10extern int rawv6_rcv(struct sock *sk,
11 struct sk_buff *skb); 11 struct sk_buff *skb);
diff --git a/include/net/sock.h b/include/net/sock.h
index da931555e000..d89f0582b6b6 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -70,16 +70,16 @@
70struct cgroup; 70struct cgroup;
71struct cgroup_subsys; 71struct cgroup_subsys;
72#ifdef CONFIG_NET 72#ifdef CONFIG_NET
73int mem_cgroup_sockets_init(struct cgroup *cgrp, struct cgroup_subsys *ss); 73int mem_cgroup_sockets_init(struct mem_cgroup *memcg, struct cgroup_subsys *ss);
74void mem_cgroup_sockets_destroy(struct cgroup *cgrp); 74void mem_cgroup_sockets_destroy(struct mem_cgroup *memcg);
75#else 75#else
76static inline 76static inline
77int mem_cgroup_sockets_init(struct cgroup *cgrp, struct cgroup_subsys *ss) 77int mem_cgroup_sockets_init(struct mem_cgroup *memcg, struct cgroup_subsys *ss)
78{ 78{
79 return 0; 79 return 0;
80} 80}
81static inline 81static inline
82void mem_cgroup_sockets_destroy(struct cgroup *cgrp) 82void mem_cgroup_sockets_destroy(struct mem_cgroup *memcg)
83{ 83{
84} 84}
85#endif 85#endif
@@ -914,9 +914,9 @@ struct proto {
914 * This function has to setup any files the protocol want to 914 * This function has to setup any files the protocol want to
915 * appear in the kmem cgroup filesystem. 915 * appear in the kmem cgroup filesystem.
916 */ 916 */
917 int (*init_cgroup)(struct cgroup *cgrp, 917 int (*init_cgroup)(struct mem_cgroup *memcg,
918 struct cgroup_subsys *ss); 918 struct cgroup_subsys *ss);
919 void (*destroy_cgroup)(struct cgroup *cgrp); 919 void (*destroy_cgroup)(struct mem_cgroup *memcg);
920 struct cg_proto *(*proto_cgroup)(struct mem_cgroup *memcg); 920 struct cg_proto *(*proto_cgroup)(struct mem_cgroup *memcg);
921#endif 921#endif
922}; 922};
diff --git a/include/net/tcp_memcontrol.h b/include/net/tcp_memcontrol.h
index 48410ff25c9e..7df18bc43a97 100644
--- a/include/net/tcp_memcontrol.h
+++ b/include/net/tcp_memcontrol.h
@@ -12,8 +12,8 @@ struct tcp_memcontrol {
12}; 12};
13 13
14struct cg_proto *tcp_proto_cgroup(struct mem_cgroup *memcg); 14struct cg_proto *tcp_proto_cgroup(struct mem_cgroup *memcg);
15int tcp_init_cgroup(struct cgroup *cgrp, struct cgroup_subsys *ss); 15int tcp_init_cgroup(struct mem_cgroup *memcg, struct cgroup_subsys *ss);
16void tcp_destroy_cgroup(struct cgroup *cgrp); 16void tcp_destroy_cgroup(struct mem_cgroup *memcg);
17unsigned long long tcp_max_memory(const struct mem_cgroup *memcg); 17unsigned long long tcp_max_memory(const struct mem_cgroup *memcg);
18void tcp_prot_mem(struct mem_cgroup *memcg, long val, int idx); 18void tcp_prot_mem(struct mem_cgroup *memcg, long val, int idx);
19#endif /* _TCP_MEMCG_H */ 19#endif /* _TCP_MEMCG_H */
diff --git a/include/rdma/ib_mad.h b/include/rdma/ib_mad.h
index b513f57e1725..3d81b90cc315 100644
--- a/include/rdma/ib_mad.h
+++ b/include/rdma/ib_mad.h
@@ -160,7 +160,7 @@ struct ib_rmpp_hdr {
160 160
161typedef u64 __bitwise ib_sa_comp_mask; 161typedef u64 __bitwise ib_sa_comp_mask;
162 162
163#define IB_SA_COMP_MASK(n) ((__force ib_sa_comp_mask) cpu_to_be64(1ull << n)) 163#define IB_SA_COMP_MASK(n) ((__force ib_sa_comp_mask) cpu_to_be64(1ull << (n)))
164 164
165/* 165/*
166 * ib_sa_hdr and ib_sa_mad structures must be packed because they have 166 * ib_sa_hdr and ib_sa_mad structures must be packed because they have
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index c3cca5a4dacd..07996af8265a 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -605,7 +605,7 @@ enum ib_qp_type {
605 IB_QPT_UD, 605 IB_QPT_UD,
606 IB_QPT_RAW_IPV6, 606 IB_QPT_RAW_IPV6,
607 IB_QPT_RAW_ETHERTYPE, 607 IB_QPT_RAW_ETHERTYPE,
608 /* Save 8 for RAW_PACKET */ 608 IB_QPT_RAW_PACKET = 8,
609 IB_QPT_XRC_INI = 9, 609 IB_QPT_XRC_INI = 9,
610 IB_QPT_XRC_TGT, 610 IB_QPT_XRC_TGT,
611 IB_QPT_MAX 611 IB_QPT_MAX
@@ -964,7 +964,7 @@ struct ib_qp {
964 struct ib_srq *srq; 964 struct ib_srq *srq;
965 struct ib_xrcd *xrcd; /* XRC TGT QPs only */ 965 struct ib_xrcd *xrcd; /* XRC TGT QPs only */
966 struct list_head xrcd_list; 966 struct list_head xrcd_list;
967 atomic_t usecnt; /* count times opened */ 967 atomic_t usecnt; /* count times opened, mcast attaches */
968 struct list_head open_list; 968 struct list_head open_list;
969 struct ib_qp *real_qp; 969 struct ib_qp *real_qp;
970 struct ib_uobject *uobject; 970 struct ib_uobject *uobject;
diff --git a/include/scsi/iscsi_proto.h b/include/scsi/iscsi_proto.h
index 988ba06b3ad6..c1260d80ef30 100644
--- a/include/scsi/iscsi_proto.h
+++ b/include/scsi/iscsi_proto.h
@@ -661,6 +661,8 @@ struct iscsi_reject {
661 661
662#define ISCSI_DEF_TIME2WAIT 2 662#define ISCSI_DEF_TIME2WAIT 2
663 663
664#define ISCSI_NAME_LEN 224
665
664/************************* RFC 3720 End *****************************/ 666/************************* RFC 3720 End *****************************/
665 667
666#endif /* ISCSI_PROTO_H */ 668#endif /* ISCSI_PROTO_H */
diff --git a/include/scsi/sas.h b/include/scsi/sas.h
index a577a833603d..be3eb0bf1ac0 100644
--- a/include/scsi/sas.h
+++ b/include/scsi/sas.h
@@ -103,6 +103,7 @@ enum sas_dev_type {
103}; 103};
104 104
105enum sas_protocol { 105enum sas_protocol {
106 SAS_PROTOCOL_NONE = 0,
106 SAS_PROTOCOL_SATA = 0x01, 107 SAS_PROTOCOL_SATA = 0x01,
107 SAS_PROTOCOL_SMP = 0x02, 108 SAS_PROTOCOL_SMP = 0x02,
108 SAS_PROTOCOL_STP = 0x04, 109 SAS_PROTOCOL_STP = 0x04,
diff --git a/include/sound/asound.h b/include/sound/asound.h
index a2e4ff5ba9e9..0876a1e76aef 100644
--- a/include/sound/asound.h
+++ b/include/sound/asound.h
@@ -70,6 +70,20 @@ struct snd_aes_iec958 {
70 70
71/**************************************************************************** 71/****************************************************************************
72 * * 72 * *
73 * CEA-861 Audio InfoFrame. Used in HDMI and DisplayPort *
74 * *
75 ****************************************************************************/
76
77struct snd_cea_861_aud_if {
78 unsigned char db1_ct_cc; /* coding type and channel count */
79 unsigned char db2_sf_ss; /* sample frequency and size */
80 unsigned char db3; /* not used, all zeros */
81 unsigned char db4_ca; /* channel allocation code */
82 unsigned char db5_dminh_lsv; /* downmix inhibit & level-shit values */
83};
84
85/****************************************************************************
86 * *
73 * Section for driver hardware dependent interface - /dev/snd/hw? * 87 * Section for driver hardware dependent interface - /dev/snd/hw? *
74 * * 88 * *
75 ****************************************************************************/ 89 ****************************************************************************/
diff --git a/include/sound/asoundef.h b/include/sound/asoundef.h
index 20ebf3298eba..bb05c02f89b0 100644
--- a/include/sound/asoundef.h
+++ b/include/sound/asoundef.h
@@ -170,6 +170,47 @@
170#define IEC958_AES5_CON_CGMSA_COPYNOMORE (2<<0) /* condition not be used */ 170#define IEC958_AES5_CON_CGMSA_COPYNOMORE (2<<0) /* condition not be used */
171#define IEC958_AES5_CON_CGMSA_COPYNEVER (3<<0) /* no copying is permitted */ 171#define IEC958_AES5_CON_CGMSA_COPYNEVER (3<<0) /* no copying is permitted */
172 172
173/****************************************************************************
174 * *
175 * CEA-861 Audio InfoFrame. Used in HDMI and DisplayPort *
176 * *
177 ****************************************************************************/
178#define CEA861_AUDIO_INFOFRAME_DB1CC (7<<0) /* mask - channel count */
179#define CEA861_AUDIO_INFOFRAME_DB1CT (0xf<<4) /* mask - coding type */
180#define CEA861_AUDIO_INFOFRAME_DB1CT_FROM_STREAM (0<<4) /* refer to stream */
181#define CEA861_AUDIO_INFOFRAME_DB1CT_IEC60958 (1<<4) /* IEC-60958 L-PCM */
182#define CEA861_AUDIO_INFOFRAME_DB1CT_AC3 (2<<4) /* AC-3 */
183#define CEA861_AUDIO_INFOFRAME_DB1CT_MPEG1 (3<<4) /* MPEG1 Layers 1 & 2 */
184#define CEA861_AUDIO_INFOFRAME_DB1CT_MP3 (4<<4) /* MPEG1 Layer 3 */
185#define CEA861_AUDIO_INFOFRAME_DB1CT_MPEG2_MULTICH (5<<4) /* MPEG2 Multichannel */
186#define CEA861_AUDIO_INFOFRAME_DB1CT_AAC (6<<4) /* AAC */
187#define CEA861_AUDIO_INFOFRAME_DB1CT_DTS (7<<4) /* DTS */
188#define CEA861_AUDIO_INFOFRAME_DB1CT_ATRAC (8<<4) /* ATRAC */
189#define CEA861_AUDIO_INFOFRAME_DB1CT_ONEBIT (9<<4) /* One Bit Audio */
190#define CEA861_AUDIO_INFOFRAME_DB1CT_DOLBY_DIG_PLUS (10<<4) /* Dolby Digital + */
191#define CEA861_AUDIO_INFOFRAME_DB1CT_DTS_HD (11<<4) /* DTS-HD */
192#define CEA861_AUDIO_INFOFRAME_DB1CT_MAT (12<<4) /* MAT (MLP) */
193#define CEA861_AUDIO_INFOFRAME_DB1CT_DST (13<<4) /* DST */
194#define CEA861_AUDIO_INFOFRAME_DB1CT_WMA_PRO (14<<4) /* WMA Pro */
195#define CEA861_AUDIO_INFOFRAME_DB2SF (7<<2) /* mask - sample frequency */
196#define CEA861_AUDIO_INFOFRAME_DB2SF_FROM_STREAM (0<<2) /* refer to stream */
197#define CEA861_AUDIO_INFOFRAME_DB2SF_32000 (1<<2) /* 32kHz */
198#define CEA861_AUDIO_INFOFRAME_DB2SF_44100 (2<<2) /* 44.1kHz */
199#define CEA861_AUDIO_INFOFRAME_DB2SF_48000 (3<<2) /* 48kHz */
200#define CEA861_AUDIO_INFOFRAME_DB2SF_88200 (4<<2) /* 88.2kHz */
201#define CEA861_AUDIO_INFOFRAME_DB2SF_96000 (5<<2) /* 96kHz */
202#define CEA861_AUDIO_INFOFRAME_DB2SF_176400 (6<<2) /* 176.4kHz */
203#define CEA861_AUDIO_INFOFRAME_DB2SF_192000 (7<<2) /* 192kHz */
204#define CEA861_AUDIO_INFOFRAME_DB2SS (3<<0) /* mask - sample size */
205#define CEA861_AUDIO_INFOFRAME_DB2SS_FROM_STREAM (0<<0) /* refer to stream */
206#define CEA861_AUDIO_INFOFRAME_DB2SS_16BIT (1<<0) /* 16 bits */
207#define CEA861_AUDIO_INFOFRAME_DB2SS_20BIT (2<<0) /* 20 bits */
208#define CEA861_AUDIO_INFOFRAME_DB2SS_24BIT (3<<0) /* 24 bits */
209#define CEA861_AUDIO_INFOFRAME_DB5_DM_INH (1<<7) /* mask - inhibit downmixing */
210#define CEA861_AUDIO_INFOFRAME_DB5_DM_INH_PERMITTED (0<<7) /* stereo downmix permitted */
211#define CEA861_AUDIO_INFOFRAME_DB5_DM_INH_PROHIBITED (1<<7) /* stereo downmis prohibited */
212#define CEA861_AUDIO_INFOFRAME_DB5_LSV (0xf<<3) /* mask - level-shift values */
213
173/***************************************************************************** 214/*****************************************************************************
174 * * 215 * *
175 * MIDI v1.0 interface * 216 * MIDI v1.0 interface *
diff --git a/include/sound/cs42l52.h b/include/sound/cs42l52.h
new file mode 100644
index 000000000000..4c68955f7330
--- /dev/null
+++ b/include/sound/cs42l52.h
@@ -0,0 +1,36 @@
1/*
2 * linux/sound/cs42l52.h -- Platform data for CS42L52
3 *
4 * Copyright (c) 2012 Cirrus Logic Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifndef __CS42L52_H
12#define __CS42L52_H
13
14struct cs42l52_platform_data {
15
16 /* MICBIAS Level. Check datasheet Pg48 */
17 unsigned int micbias_lvl;
18
19 /* MICA mode selection 0=Single 1=Differential */
20 unsigned int mica_cfg;
21
22 /* MICB mode selection 0=Single 1=Differential */
23 unsigned int micb_cfg;
24
25 /* MICA Select 0=MIC1A 1=MIC2A */
26 unsigned int mica_sel;
27
28 /* MICB Select 0=MIC2A 1=MIC2B */
29 unsigned int micb_sel;
30
31 /* Charge Pump Freq. Check datasheet Pg73 */
32 unsigned int chgfreq;
33
34};
35
36#endif /* __CS42L52_H */
diff --git a/include/sound/max98095.h b/include/sound/max98095.h
index 7513a42dd4aa..e87ae67b0a55 100644
--- a/include/sound/max98095.h
+++ b/include/sound/max98095.h
@@ -49,6 +49,18 @@ struct max98095_pdata {
49 */ 49 */
50 unsigned int digmic_left_mode:1; 50 unsigned int digmic_left_mode:1;
51 unsigned int digmic_right_mode:1; 51 unsigned int digmic_right_mode:1;
52
53 /* Pin5 is the mechanical method of sensing jack insertion
54 * but it is something that might not be supported.
55 * 0 = PIN5 not supported
56 * 1 = PIN5 supported
57 */
58 unsigned int jack_detect_pin5en:1;
59
60 /* Slew amount for jack detection. Calculated as 4 * (delay + 1).
61 * Default delay is 24 to get a time of 100ms.
62 */
63 unsigned int jack_detect_delay;
52}; 64};
53 65
54#endif 66#endif
diff --git a/include/sound/sh_fsi.h b/include/sound/sh_fsi.h
index b457e87fbd08..906010344dd7 100644
--- a/include/sound/sh_fsi.h
+++ b/include/sound/sh_fsi.h
@@ -21,10 +21,11 @@
21/* 21/*
22 * flags format 22 * flags format
23 * 23 *
24 * 0x000000BA 24 * 0x00000CBA
25 * 25 *
26 * A: inversion 26 * A: inversion
27 * B: format mode 27 * B: format mode
28 * C: chip specific
28 */ 29 */
29 30
30/* A: clock inversion */ 31/* A: clock inversion */
@@ -39,6 +40,9 @@
39#define SH_FSI_FMT_DAI (0 << 4) 40#define SH_FSI_FMT_DAI (0 << 4)
40#define SH_FSI_FMT_SPDIF (1 << 4) 41#define SH_FSI_FMT_SPDIF (1 << 4)
41 42
43/* C: chip specific */
44#define SH_FSI_OPTION_MASK 0x00000F00
45#define SH_FSI_ENABLE_STREAM_MODE (1 << 8) /* for 16bit data */
42 46
43/* 47/*
44 * set_rate return value 48 * set_rate return value
@@ -84,16 +88,4 @@ struct sh_fsi_platform_info {
84 struct sh_fsi_port_info port_b; 88 struct sh_fsi_port_info port_b;
85}; 89};
86 90
87/*
88 * for fsi-ak4642
89 */
90struct fsi_ak4642_info {
91 const char *name;
92 const char *card;
93 const char *cpu_dai;
94 const char *codec;
95 const char *platform;
96 int id;
97};
98
99#endif /* __SOUND_FSI_H */ 91#endif /* __SOUND_FSI_H */
diff --git a/include/sound/simple_card.h b/include/sound/simple_card.h
new file mode 100644
index 000000000000..4b62b8dc6a4f
--- /dev/null
+++ b/include/sound/simple_card.h
@@ -0,0 +1,38 @@
1/*
2 * ASoC simple sound card support
3 *
4 * Copyright (C) 2012 Renesas Solutions Corp.
5 * Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef __SIMPLE_CARD_H
13#define __SIMPLE_CARD_H
14
15#include <sound/soc.h>
16
17struct asoc_simple_dai_init_info {
18 unsigned int fmt;
19 unsigned int cpu_daifmt;
20 unsigned int codec_daifmt;
21 unsigned int sysclk;
22};
23
24struct asoc_simple_card_info {
25 const char *name;
26 const char *card;
27 const char *cpu_dai;
28 const char *codec;
29 const char *platform;
30 const char *codec_dai;
31 struct asoc_simple_dai_init_info *init; /* for snd_link.init */
32
33 /* used in simple-card.c */
34 struct snd_soc_dai_link snd_link;
35 struct snd_soc_card snd_card;
36};
37
38#endif /* __SIMPLE_CARD_H */
diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h
index c429f248cf4e..1f69e0af2941 100644
--- a/include/sound/soc-dai.h
+++ b/include/sound/soc-dai.h
@@ -173,6 +173,8 @@ struct snd_soc_dai_ops {
173 struct snd_soc_dai *); 173 struct snd_soc_dai *);
174 int (*trigger)(struct snd_pcm_substream *, int, 174 int (*trigger)(struct snd_pcm_substream *, int,
175 struct snd_soc_dai *); 175 struct snd_soc_dai *);
176 int (*bespoke_trigger)(struct snd_pcm_substream *, int,
177 struct snd_soc_dai *);
176 /* 178 /*
177 * For hardware based FIFO caused delay reporting. 179 * For hardware based FIFO caused delay reporting.
178 * Optional. 180 * Optional.
@@ -196,6 +198,7 @@ struct snd_soc_dai_driver {
196 const char *name; 198 const char *name;
197 unsigned int id; 199 unsigned int id;
198 int ac97_control; 200 int ac97_control;
201 unsigned int base;
199 202
200 /* DAI driver callbacks */ 203 /* DAI driver callbacks */
201 int (*probe)(struct snd_soc_dai *dai); 204 int (*probe)(struct snd_soc_dai *dai);
@@ -241,6 +244,7 @@ struct snd_soc_dai {
241 244
242 struct snd_soc_dapm_widget *playback_widget; 245 struct snd_soc_dapm_widget *playback_widget;
243 struct snd_soc_dapm_widget *capture_widget; 246 struct snd_soc_dapm_widget *capture_widget;
247 struct snd_soc_dapm_context dapm;
244 248
245 /* DAI DMA data */ 249 /* DAI DMA data */
246 void *playback_dma_data; 250 void *playback_dma_data;
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index 8da3c2409060..e3833d9f1914 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -141,10 +141,6 @@ struct device;
141{ .id = snd_soc_dapm_mixer, .name = wname, .reg = wreg, .shift = wshift, \ 141{ .id = snd_soc_dapm_mixer, .name = wname, .reg = wreg, .shift = wshift, \
142 .invert = winvert, .kcontrol_news = wcontrols, \ 142 .invert = winvert, .kcontrol_news = wcontrols, \
143 .num_kcontrols = wncontrols, .event = wevent, .event_flags = wflags} 143 .num_kcontrols = wncontrols, .event = wevent, .event_flags = wflags}
144#define SND_SOC_DAPM_MICBIAS_E(wname, wreg, wshift, winvert, wevent, wflags) \
145{ .id = snd_soc_dapm_micbias, .name = wname, .reg = wreg, .shift = wshift, \
146 .invert = winvert, .kcontrol_news = NULL, .num_kcontrols = 0, \
147 .event = wevent, .event_flags = wflags}
148#define SND_SOC_DAPM_SWITCH_E(wname, wreg, wshift, winvert, wcontrols, \ 144#define SND_SOC_DAPM_SWITCH_E(wname, wreg, wshift, winvert, wcontrols, \
149 wevent, wflags) \ 145 wevent, wflags) \
150{ .id = snd_soc_dapm_switch, .name = wname, .reg = wreg, .shift = wshift, \ 146{ .id = snd_soc_dapm_switch, .name = wname, .reg = wreg, .shift = wshift, \
@@ -324,6 +320,8 @@ struct snd_soc_dapm_path;
324struct snd_soc_dapm_pin; 320struct snd_soc_dapm_pin;
325struct snd_soc_dapm_route; 321struct snd_soc_dapm_route;
326struct snd_soc_dapm_context; 322struct snd_soc_dapm_context;
323struct regulator;
324struct snd_soc_dapm_widget_list;
327 325
328int dapm_reg_event(struct snd_soc_dapm_widget *w, 326int dapm_reg_event(struct snd_soc_dapm_widget *w,
329 struct snd_kcontrol *kcontrol, int event); 327 struct snd_kcontrol *kcontrol, int event);
@@ -359,6 +357,10 @@ int snd_soc_dapm_new_controls(struct snd_soc_dapm_context *dapm,
359int snd_soc_dapm_new_dai_widgets(struct snd_soc_dapm_context *dapm, 357int snd_soc_dapm_new_dai_widgets(struct snd_soc_dapm_context *dapm,
360 struct snd_soc_dai *dai); 358 struct snd_soc_dai *dai);
361int snd_soc_dapm_link_dai_widgets(struct snd_soc_card *card); 359int snd_soc_dapm_link_dai_widgets(struct snd_soc_card *card);
360int snd_soc_dapm_new_pcm(struct snd_soc_card *card,
361 const struct snd_soc_pcm_stream *params,
362 struct snd_soc_dapm_widget *source,
363 struct snd_soc_dapm_widget *sink);
362 364
363/* dapm path setup */ 365/* dapm path setup */
364int snd_soc_dapm_new_widgets(struct snd_soc_dapm_context *dapm); 366int snd_soc_dapm_new_widgets(struct snd_soc_dapm_context *dapm);
@@ -369,8 +371,8 @@ int snd_soc_dapm_weak_routes(struct snd_soc_dapm_context *dapm,
369 const struct snd_soc_dapm_route *route, int num); 371 const struct snd_soc_dapm_route *route, int num);
370 372
371/* dapm events */ 373/* dapm events */
372int snd_soc_dapm_stream_event(struct snd_soc_pcm_runtime *rtd, int stream, 374void snd_soc_dapm_stream_event(struct snd_soc_pcm_runtime *rtd, int stream,
373 struct snd_soc_dai *dai, int event); 375 int event);
374void snd_soc_dapm_shutdown(struct snd_soc_card *card); 376void snd_soc_dapm_shutdown(struct snd_soc_card *card);
375 377
376/* external DAPM widget events */ 378/* external DAPM widget events */
@@ -402,6 +404,10 @@ void snd_soc_dapm_auto_nc_codec_pins(struct snd_soc_codec *codec);
402/* Mostly internal - should not normally be used */ 404/* Mostly internal - should not normally be used */
403void dapm_mark_dirty(struct snd_soc_dapm_widget *w, const char *reason); 405void dapm_mark_dirty(struct snd_soc_dapm_widget *w, const char *reason);
404 406
407/* dapm path query */
408int snd_soc_dapm_dai_get_connected_widgets(struct snd_soc_dai *dai, int stream,
409 struct snd_soc_dapm_widget_list **list);
410
405/* dapm widget types */ 411/* dapm widget types */
406enum snd_soc_dapm_type { 412enum snd_soc_dapm_type {
407 snd_soc_dapm_input = 0, /* input pin */ 413 snd_soc_dapm_input = 0, /* input pin */
@@ -430,6 +436,12 @@ enum snd_soc_dapm_type {
430 snd_soc_dapm_aif_out, /* audio interface output */ 436 snd_soc_dapm_aif_out, /* audio interface output */
431 snd_soc_dapm_siggen, /* signal generator */ 437 snd_soc_dapm_siggen, /* signal generator */
432 snd_soc_dapm_dai, /* link to DAI structure */ 438 snd_soc_dapm_dai, /* link to DAI structure */
439 snd_soc_dapm_dai_link, /* link between two DAI structures */
440};
441
442enum snd_soc_dapm_subclass {
443 SND_SOC_DAPM_CLASS_INIT = 0,
444 SND_SOC_DAPM_CLASS_RUNTIME = 1,
433}; 445};
434 446
435/* 447/*
@@ -482,9 +494,11 @@ struct snd_soc_dapm_widget {
482 struct snd_soc_dapm_context *dapm; 494 struct snd_soc_dapm_context *dapm;
483 495
484 void *priv; /* widget specific data */ 496 void *priv; /* widget specific data */
497 struct regulator *regulator; /* attached regulator */
498 const struct snd_soc_pcm_stream *params; /* params for dai links */
485 499
486 /* dapm control */ 500 /* dapm control */
487 short reg; /* negative reg = no direct dapm */ 501 int reg; /* negative reg = no direct dapm */
488 unsigned char shift; /* bits to shift */ 502 unsigned char shift; /* bits to shift */
489 unsigned int saved_value; /* widget saved value */ 503 unsigned int saved_value; /* widget saved value */
490 unsigned int value; /* widget current value */ 504 unsigned int value; /* widget current value */
diff --git a/include/sound/soc-dpcm.h b/include/sound/soc-dpcm.h
new file mode 100644
index 000000000000..04598f1efd77
--- /dev/null
+++ b/include/sound/soc-dpcm.h
@@ -0,0 +1,138 @@
1/*
2 * linux/sound/soc-dpcm.h -- ALSA SoC Dynamic PCM Support
3 *
4 * Author: Liam Girdwood <lrg@ti.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifndef __LINUX_SND_SOC_DPCM_H
12#define __LINUX_SND_SOC_DPCM_H
13
14#include <linux/list.h>
15#include <sound/pcm.h>
16
17struct snd_soc_pcm_runtime;
18
19/*
20 * Types of runtime_update to perform. e.g. originated from FE PCM ops
21 * or audio route changes triggered by muxes/mixers.
22 */
23enum snd_soc_dpcm_update {
24 SND_SOC_DPCM_UPDATE_NO = 0,
25 SND_SOC_DPCM_UPDATE_BE,
26 SND_SOC_DPCM_UPDATE_FE,
27};
28
29/*
30 * Dynamic PCM Frontend -> Backend link management states.
31 */
32enum snd_soc_dpcm_link_state {
33 SND_SOC_DPCM_LINK_STATE_NEW = 0, /* newly created link */
34 SND_SOC_DPCM_LINK_STATE_FREE, /* link to be dismantled */
35};
36
37/*
38 * Dynamic PCM Frontend -> Backend link PCM states.
39 */
40enum snd_soc_dpcm_state {
41 SND_SOC_DPCM_STATE_NEW = 0,
42 SND_SOC_DPCM_STATE_OPEN,
43 SND_SOC_DPCM_STATE_HW_PARAMS,
44 SND_SOC_DPCM_STATE_PREPARE,
45 SND_SOC_DPCM_STATE_START,
46 SND_SOC_DPCM_STATE_STOP,
47 SND_SOC_DPCM_STATE_PAUSED,
48 SND_SOC_DPCM_STATE_SUSPEND,
49 SND_SOC_DPCM_STATE_HW_FREE,
50 SND_SOC_DPCM_STATE_CLOSE,
51};
52
53/*
54 * Dynamic PCM trigger ordering. Triggering flexibility is required as some
55 * DSPs require triggering before/after their CPU platform and DAIs.
56 *
57 * i.e. some clients may want to manually order this call in their PCM
58 * trigger() whilst others will just use the regular core ordering.
59 */
60enum snd_soc_dpcm_trigger {
61 SND_SOC_DPCM_TRIGGER_PRE = 0,
62 SND_SOC_DPCM_TRIGGER_POST,
63 SND_SOC_DPCM_TRIGGER_BESPOKE,
64};
65
66/*
67 * Dynamic PCM link
68 * This links together a FE and BE DAI at runtime and stores the link
69 * state information and the hw_params configuration.
70 */
71struct snd_soc_dpcm {
72 /* FE and BE DAIs*/
73 struct snd_soc_pcm_runtime *be;
74 struct snd_soc_pcm_runtime *fe;
75
76 /* link state */
77 enum snd_soc_dpcm_link_state state;
78
79 /* list of BE and FE for this DPCM link */
80 struct list_head list_be;
81 struct list_head list_fe;
82
83 /* hw params for this link - may be different for each link */
84 struct snd_pcm_hw_params hw_params;
85#ifdef CONFIG_DEBUG_FS
86 struct dentry *debugfs_state;
87#endif
88};
89
90/*
91 * Dynamic PCM runtime data.
92 */
93struct snd_soc_dpcm_runtime {
94 struct list_head be_clients;
95 struct list_head fe_clients;
96
97 int users;
98 struct snd_pcm_runtime *runtime;
99 struct snd_pcm_hw_params hw_params;
100
101 /* state and update */
102 enum snd_soc_dpcm_update runtime_update;
103 enum snd_soc_dpcm_state state;
104};
105
106/* can this BE stop and free */
107int snd_soc_dpcm_can_be_free_stop(struct snd_soc_pcm_runtime *fe,
108 struct snd_soc_pcm_runtime *be, int stream);
109
110/* can this BE perform a hw_params() */
111int snd_soc_dpcm_can_be_params(struct snd_soc_pcm_runtime *fe,
112 struct snd_soc_pcm_runtime *be, int stream);
113
114/* is the current PCM operation for this FE ? */
115int snd_soc_dpcm_fe_can_update(struct snd_soc_pcm_runtime *fe, int stream);
116
117/* is the current PCM operation for this BE ? */
118int snd_soc_dpcm_be_can_update(struct snd_soc_pcm_runtime *fe,
119 struct snd_soc_pcm_runtime *be, int stream);
120
121/* get the substream for this BE */
122struct snd_pcm_substream *
123 snd_soc_dpcm_get_substream(struct snd_soc_pcm_runtime *be, int stream);
124
125/* get the BE runtime state */
126enum snd_soc_dpcm_state
127 snd_soc_dpcm_be_get_state(struct snd_soc_pcm_runtime *be, int stream);
128
129/* set the BE runtime state */
130void snd_soc_dpcm_be_set_state(struct snd_soc_pcm_runtime *be, int stream,
131 enum snd_soc_dpcm_state state);
132
133/* internal use only */
134int soc_dpcm_be_digital_mute(struct snd_soc_pcm_runtime *fe, int mute);
135int soc_dpcm_debugfs_add(struct snd_soc_pcm_runtime *rtd);
136int soc_dpcm_runtime_update(struct snd_soc_dapm_widget *);
137
138#endif
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 2ebf7877c148..c703871f5f65 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -55,6 +55,18 @@
55 .info = snd_soc_info_volsw, .get = snd_soc_get_volsw,\ 55 .info = snd_soc_info_volsw, .get = snd_soc_get_volsw,\
56 .put = snd_soc_put_volsw, \ 56 .put = snd_soc_put_volsw, \
57 .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert) } 57 .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert) }
58#define SOC_SINGLE_SX_TLV(xname, xreg, xshift, xmin, xmax, tlv_array) \
59{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
60 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
61 SNDRV_CTL_ELEM_ACCESS_READWRITE, \
62 .tlv.p = (tlv_array),\
63 .info = snd_soc_info_volsw, \
64 .get = snd_soc_get_volsw_sx,\
65 .put = snd_soc_put_volsw_sx, \
66 .private_value = (unsigned long)&(struct soc_mixer_control) \
67 {.reg = xreg, .rreg = xreg, \
68 .shift = xshift, .rshift = xshift, \
69 .max = xmax, .min = xmin} }
58#define SOC_DOUBLE(xname, reg, shift_left, shift_right, max, invert) \ 70#define SOC_DOUBLE(xname, reg, shift_left, shift_right, max, invert) \
59{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\ 71{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
60 .info = snd_soc_info_volsw, .get = snd_soc_get_volsw, \ 72 .info = snd_soc_info_volsw, .get = snd_soc_get_volsw, \
@@ -85,6 +97,18 @@
85 .get = snd_soc_get_volsw, .put = snd_soc_put_volsw, \ 97 .get = snd_soc_get_volsw, .put = snd_soc_put_volsw, \
86 .private_value = SOC_DOUBLE_R_VALUE(reg_left, reg_right, xshift, \ 98 .private_value = SOC_DOUBLE_R_VALUE(reg_left, reg_right, xshift, \
87 xmax, xinvert) } 99 xmax, xinvert) }
100#define SOC_DOUBLE_R_SX_TLV(xname, xreg, xrreg, xshift, xmin, xmax, tlv_array) \
101{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
102 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
103 SNDRV_CTL_ELEM_ACCESS_READWRITE, \
104 .tlv.p = (tlv_array), \
105 .info = snd_soc_info_volsw, \
106 .get = snd_soc_get_volsw_sx, \
107 .put = snd_soc_put_volsw_sx, \
108 .private_value = (unsigned long)&(struct soc_mixer_control) \
109 {.reg = xreg, .rreg = xrreg, \
110 .shift = xshift, .rshift = xshift, \
111 .max = xmax, .min = xmin} }
88#define SOC_DOUBLE_S8_TLV(xname, xreg, xmin, xmax, tlv_array) \ 112#define SOC_DOUBLE_S8_TLV(xname, xreg, xmin, xmax, tlv_array) \
89{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \ 113{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
90 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ 114 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
@@ -171,20 +195,6 @@
171 .get = xhandler_get, .put = xhandler_put, \ 195 .get = xhandler_get, .put = xhandler_put, \
172 .private_value = (unsigned long)&xenum } 196 .private_value = (unsigned long)&xenum }
173 197
174#define SOC_DOUBLE_R_SX_TLV(xname, xreg_left, xreg_right, xshift,\
175 xmin, xmax, tlv_array) \
176{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
177 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
178 SNDRV_CTL_ELEM_ACCESS_READWRITE, \
179 .tlv.p = (tlv_array), \
180 .info = snd_soc_info_volsw_2r_sx, \
181 .get = snd_soc_get_volsw_2r_sx, \
182 .put = snd_soc_put_volsw_2r_sx, \
183 .private_value = (unsigned long)&(struct soc_mixer_control) \
184 {.reg = xreg_left, \
185 .rreg = xreg_right, .shift = xshift, \
186 .min = xmin, .max = xmax} }
187
188#define SND_SOC_BYTES(xname, xbase, xregs) \ 198#define SND_SOC_BYTES(xname, xbase, xregs) \
189{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ 199{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
190 .info = snd_soc_bytes_info, .get = snd_soc_bytes_get, \ 200 .info = snd_soc_bytes_info, .get = snd_soc_bytes_get, \
@@ -200,6 +210,19 @@
200 {.base = xbase, .num_regs = xregs, \ 210 {.base = xbase, .num_regs = xregs, \
201 .mask = xmask }) } 211 .mask = xmask }) }
202 212
213#define SOC_SINGLE_XR_SX(xname, xregbase, xregcount, xnbits, \
214 xmin, xmax, xinvert) \
215{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
216 .info = snd_soc_info_xr_sx, .get = snd_soc_get_xr_sx, \
217 .put = snd_soc_put_xr_sx, \
218 .private_value = (unsigned long)&(struct soc_mreg_control) \
219 {.regbase = xregbase, .regcount = xregcount, .nbits = xnbits, \
220 .invert = xinvert, .min = xmin, .max = xmax} }
221
222#define SOC_SINGLE_STROBE(xname, xreg, xshift, xinvert) \
223 SOC_SINGLE_EXT(xname, xreg, xshift, 1, xinvert, \
224 snd_soc_get_strobe, snd_soc_put_strobe)
225
203/* 226/*
204 * Simplified versions of above macros, declaring a struct and calculating 227 * Simplified versions of above macros, declaring a struct and calculating
205 * ARRAY_SIZE internally 228 * ARRAY_SIZE internally
@@ -264,6 +287,7 @@ struct snd_soc_jack_zone;
264struct snd_soc_jack_pin; 287struct snd_soc_jack_pin;
265struct snd_soc_cache_ops; 288struct snd_soc_cache_ops;
266#include <sound/soc-dapm.h> 289#include <sound/soc-dapm.h>
290#include <sound/soc-dpcm.h>
267 291
268#ifdef CONFIG_GPIOLIB 292#ifdef CONFIG_GPIOLIB
269struct snd_soc_jack_gpio; 293struct snd_soc_jack_gpio;
@@ -288,6 +312,11 @@ enum snd_soc_pcm_subclass {
288 SND_SOC_PCM_CLASS_BE = 1, 312 SND_SOC_PCM_CLASS_BE = 1,
289}; 313};
290 314
315enum snd_soc_card_subclass {
316 SND_SOC_CARD_CLASS_INIT = 0,
317 SND_SOC_CARD_CLASS_RUNTIME = 1,
318};
319
291int snd_soc_codec_set_sysclk(struct snd_soc_codec *codec, int clk_id, 320int snd_soc_codec_set_sysclk(struct snd_soc_codec *codec, int clk_id,
292 int source, unsigned int freq, int dir); 321 int source, unsigned int freq, int dir);
293int snd_soc_codec_set_pll(struct snd_soc_codec *codec, int pll_id, int source, 322int snd_soc_codec_set_pll(struct snd_soc_codec *codec, int pll_id, int source,
@@ -333,6 +362,11 @@ int snd_soc_platform_write(struct snd_soc_platform *platform,
333 unsigned int reg, unsigned int val); 362 unsigned int reg, unsigned int val);
334int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num); 363int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num);
335 364
365struct snd_pcm_substream *snd_soc_get_dai_substream(struct snd_soc_card *card,
366 const char *dai_link, int stream);
367struct snd_soc_pcm_runtime *snd_soc_get_pcm_runtime(struct snd_soc_card *card,
368 const char *dai_link);
369
336/* Utility functions to get clock rates from various things */ 370/* Utility functions to get clock rates from various things */
337int snd_soc_calc_frame_size(int sample_size, int channels, int tdm_slots); 371int snd_soc_calc_frame_size(int sample_size, int channels, int tdm_slots);
338int snd_soc_params_to_frame_size(struct snd_pcm_hw_params *params); 372int snd_soc_params_to_frame_size(struct snd_pcm_hw_params *params);
@@ -343,6 +377,9 @@ int snd_soc_params_to_bclk(struct snd_pcm_hw_params *parms);
343int snd_soc_set_runtime_hwparams(struct snd_pcm_substream *substream, 377int snd_soc_set_runtime_hwparams(struct snd_pcm_substream *substream,
344 const struct snd_pcm_hardware *hw); 378 const struct snd_pcm_hardware *hw);
345 379
380int snd_soc_platform_trigger(struct snd_pcm_substream *substream,
381 int cmd, struct snd_soc_platform *platform);
382
346/* Jack reporting */ 383/* Jack reporting */
347int snd_soc_jack_new(struct snd_soc_codec *codec, const char *id, int type, 384int snd_soc_jack_new(struct snd_soc_codec *codec, const char *id, int type,
348 struct snd_soc_jack *jack); 385 struct snd_soc_jack *jack);
@@ -413,6 +450,10 @@ int snd_soc_put_volsw(struct snd_kcontrol *kcontrol,
413 struct snd_ctl_elem_value *ucontrol); 450 struct snd_ctl_elem_value *ucontrol);
414#define snd_soc_get_volsw_2r snd_soc_get_volsw 451#define snd_soc_get_volsw_2r snd_soc_get_volsw
415#define snd_soc_put_volsw_2r snd_soc_put_volsw 452#define snd_soc_put_volsw_2r snd_soc_put_volsw
453int snd_soc_get_volsw_sx(struct snd_kcontrol *kcontrol,
454 struct snd_ctl_elem_value *ucontrol);
455int snd_soc_put_volsw_sx(struct snd_kcontrol *kcontrol,
456 struct snd_ctl_elem_value *ucontrol);
416int snd_soc_info_volsw_s8(struct snd_kcontrol *kcontrol, 457int snd_soc_info_volsw_s8(struct snd_kcontrol *kcontrol,
417 struct snd_ctl_elem_info *uinfo); 458 struct snd_ctl_elem_info *uinfo);
418int snd_soc_get_volsw_s8(struct snd_kcontrol *kcontrol, 459int snd_soc_get_volsw_s8(struct snd_kcontrol *kcontrol,
@@ -421,19 +462,22 @@ int snd_soc_put_volsw_s8(struct snd_kcontrol *kcontrol,
421 struct snd_ctl_elem_value *ucontrol); 462 struct snd_ctl_elem_value *ucontrol);
422int snd_soc_limit_volume(struct snd_soc_codec *codec, 463int snd_soc_limit_volume(struct snd_soc_codec *codec,
423 const char *name, int max); 464 const char *name, int max);
424int snd_soc_info_volsw_2r_sx(struct snd_kcontrol *kcontrol,
425 struct snd_ctl_elem_info *uinfo);
426int snd_soc_get_volsw_2r_sx(struct snd_kcontrol *kcontrol,
427 struct snd_ctl_elem_value *ucontrol);
428int snd_soc_put_volsw_2r_sx(struct snd_kcontrol *kcontrol,
429 struct snd_ctl_elem_value *ucontrol);
430int snd_soc_bytes_info(struct snd_kcontrol *kcontrol, 465int snd_soc_bytes_info(struct snd_kcontrol *kcontrol,
431 struct snd_ctl_elem_info *uinfo); 466 struct snd_ctl_elem_info *uinfo);
432int snd_soc_bytes_get(struct snd_kcontrol *kcontrol, 467int snd_soc_bytes_get(struct snd_kcontrol *kcontrol,
433 struct snd_ctl_elem_value *ucontrol); 468 struct snd_ctl_elem_value *ucontrol);
434int snd_soc_bytes_put(struct snd_kcontrol *kcontrol, 469int snd_soc_bytes_put(struct snd_kcontrol *kcontrol,
435 struct snd_ctl_elem_value *ucontrol); 470 struct snd_ctl_elem_value *ucontrol);
436 471int snd_soc_info_xr_sx(struct snd_kcontrol *kcontrol,
472 struct snd_ctl_elem_info *uinfo);
473int snd_soc_get_xr_sx(struct snd_kcontrol *kcontrol,
474 struct snd_ctl_elem_value *ucontrol);
475int snd_soc_put_xr_sx(struct snd_kcontrol *kcontrol,
476 struct snd_ctl_elem_value *ucontrol);
477int snd_soc_get_strobe(struct snd_kcontrol *kcontrol,
478 struct snd_ctl_elem_value *ucontrol);
479int snd_soc_put_strobe(struct snd_kcontrol *kcontrol,
480 struct snd_ctl_elem_value *ucontrol);
437 481
438/** 482/**
439 * struct snd_soc_reg_access - Describes whether a given register is 483 * struct snd_soc_reg_access - Describes whether a given register is
@@ -513,6 +557,7 @@ struct snd_soc_jack_gpio {
513#endif 557#endif
514 558
515struct snd_soc_jack { 559struct snd_soc_jack {
560 struct mutex mutex;
516 struct snd_jack *jack; 561 struct snd_jack *jack;
517 struct snd_soc_codec *codec; 562 struct snd_soc_codec *codec;
518 struct list_head pins; 563 struct list_head pins;
@@ -711,6 +756,7 @@ struct snd_soc_platform_driver {
711 /* platform IO - used for platform DAPM */ 756 /* platform IO - used for platform DAPM */
712 unsigned int (*read)(struct snd_soc_platform *, unsigned int); 757 unsigned int (*read)(struct snd_soc_platform *, unsigned int);
713 int (*write)(struct snd_soc_platform *, unsigned int, unsigned int); 758 int (*write)(struct snd_soc_platform *, unsigned int, unsigned int);
759 int (*bespoke_trigger)(struct snd_pcm_substream *, int);
714}; 760};
715 761
716struct snd_soc_platform { 762struct snd_soc_platform {
@@ -746,21 +792,36 @@ struct snd_soc_dai_link {
746 const char *cpu_dai_name; 792 const char *cpu_dai_name;
747 const struct device_node *cpu_dai_of_node; 793 const struct device_node *cpu_dai_of_node;
748 const char *codec_dai_name; 794 const char *codec_dai_name;
795 int be_id; /* optional ID for machine driver BE identification */
796
797 const struct snd_soc_pcm_stream *params;
749 798
750 unsigned int dai_fmt; /* format to set on init */ 799 unsigned int dai_fmt; /* format to set on init */
751 800
801 enum snd_soc_dpcm_trigger trigger[2]; /* trigger type for DPCM */
802
752 /* Keep DAI active over suspend */ 803 /* Keep DAI active over suspend */
753 unsigned int ignore_suspend:1; 804 unsigned int ignore_suspend:1;
754 805
755 /* Symmetry requirements */ 806 /* Symmetry requirements */
756 unsigned int symmetric_rates:1; 807 unsigned int symmetric_rates:1;
757 808
809 /* Do not create a PCM for this DAI link (Backend link) */
810 unsigned int no_pcm:1;
811
812 /* This DAI link can route to other DAI links at runtime (Frontend)*/
813 unsigned int dynamic:1;
814
758 /* pmdown_time is ignored at stop */ 815 /* pmdown_time is ignored at stop */
759 unsigned int ignore_pmdown_time:1; 816 unsigned int ignore_pmdown_time:1;
760 817
761 /* codec/machine specific init - e.g. add machine controls */ 818 /* codec/machine specific init - e.g. add machine controls */
762 int (*init)(struct snd_soc_pcm_runtime *rtd); 819 int (*init)(struct snd_soc_pcm_runtime *rtd);
763 820
821 /* optional hw_params re-writing for BE and FE sync */
822 int (*be_hw_params_fixup)(struct snd_soc_pcm_runtime *rtd,
823 struct snd_pcm_hw_params *params);
824
764 /* machine stream operations */ 825 /* machine stream operations */
765 struct snd_soc_ops *ops; 826 struct snd_soc_ops *ops;
766}; 827};
@@ -800,6 +861,7 @@ struct snd_soc_card {
800 861
801 struct list_head list; 862 struct list_head list;
802 struct mutex mutex; 863 struct mutex mutex;
864 struct mutex dapm_mutex;
803 865
804 bool instantiated; 866 bool instantiated;
805 867
@@ -889,9 +951,11 @@ struct snd_soc_pcm_runtime {
889 enum snd_soc_pcm_subclass pcm_subclass; 951 enum snd_soc_pcm_subclass pcm_subclass;
890 struct snd_pcm_ops ops; 952 struct snd_pcm_ops ops;
891 953
892 unsigned int complete:1;
893 unsigned int dev_registered:1; 954 unsigned int dev_registered:1;
894 955
956 /* Dynamic PCM BE runtime data */
957 struct snd_soc_dpcm_runtime dpcm[2];
958
895 long pmdown_time; 959 long pmdown_time;
896 960
897 /* runtime devices */ 961 /* runtime devices */
@@ -902,6 +966,10 @@ struct snd_soc_pcm_runtime {
902 struct snd_soc_dai *cpu_dai; 966 struct snd_soc_dai *cpu_dai;
903 967
904 struct delayed_work delayed_work; 968 struct delayed_work delayed_work;
969#ifdef CONFIG_DEBUG_FS
970 struct dentry *debugfs_dpcm_root;
971 struct dentry *debugfs_dpcm_state;
972#endif
905}; 973};
906 974
907/* mixer control */ 975/* mixer control */
@@ -916,6 +984,12 @@ struct soc_bytes {
916 u32 mask; 984 u32 mask;
917}; 985};
918 986
987/* multi register control */
988struct soc_mreg_control {
989 long min, max;
990 unsigned int regbase, regcount, nbits, invert;
991};
992
919/* enumerated kcontrol */ 993/* enumerated kcontrol */
920struct soc_enum { 994struct soc_enum {
921 unsigned short reg; 995 unsigned short reg;
diff --git a/include/target/target_core_backend.h b/include/target/target_core_backend.h
index 8c9ff1b14396..2d7db85e93ae 100644
--- a/include/target/target_core_backend.h
+++ b/include/target/target_core_backend.h
@@ -23,12 +23,11 @@ struct se_subsystem_api {
23 struct se_device *(*create_virtdevice)(struct se_hba *, 23 struct se_device *(*create_virtdevice)(struct se_hba *,
24 struct se_subsystem_dev *, void *); 24 struct se_subsystem_dev *, void *);
25 void (*free_device)(void *); 25 void (*free_device)(void *);
26 int (*transport_complete)(struct se_task *task); 26 int (*transport_complete)(struct se_cmd *cmd, struct scatterlist *);
27 struct se_task *(*alloc_task)(unsigned char *cdb); 27 int (*execute_cmd)(struct se_cmd *, struct scatterlist *, u32,
28 int (*do_task)(struct se_task *); 28 enum dma_data_direction);
29 int (*do_discard)(struct se_device *, sector_t, u32); 29 int (*do_discard)(struct se_device *, sector_t, u32);
30 void (*do_sync_cache)(struct se_task *); 30 void (*do_sync_cache)(struct se_cmd *);
31 void (*free_task)(struct se_task *);
32 ssize_t (*check_configfs_dev_params)(struct se_hba *, 31 ssize_t (*check_configfs_dev_params)(struct se_hba *,
33 struct se_subsystem_dev *); 32 struct se_subsystem_dev *);
34 ssize_t (*set_configfs_dev_params)(struct se_hba *, 33 ssize_t (*set_configfs_dev_params)(struct se_hba *,
@@ -38,7 +37,7 @@ struct se_subsystem_api {
38 u32 (*get_device_rev)(struct se_device *); 37 u32 (*get_device_rev)(struct se_device *);
39 u32 (*get_device_type)(struct se_device *); 38 u32 (*get_device_type)(struct se_device *);
40 sector_t (*get_blocks)(struct se_device *); 39 sector_t (*get_blocks)(struct se_device *);
41 unsigned char *(*get_sense_buffer)(struct se_task *); 40 unsigned char *(*get_sense_buffer)(struct se_cmd *);
42}; 41};
43 42
44int transport_subsystem_register(struct se_subsystem_api *); 43int transport_subsystem_register(struct se_subsystem_api *);
@@ -48,10 +47,7 @@ struct se_device *transport_add_device_to_core_hba(struct se_hba *,
48 struct se_subsystem_api *, struct se_subsystem_dev *, u32, 47 struct se_subsystem_api *, struct se_subsystem_dev *, u32,
49 void *, struct se_dev_limits *, const char *, const char *); 48 void *, struct se_dev_limits *, const char *, const char *);
50 49
51void transport_complete_sync_cache(struct se_cmd *, int); 50void target_complete_cmd(struct se_cmd *, u8);
52void transport_complete_task(struct se_task *, int);
53
54void target_get_task_cdb(struct se_task *, unsigned char *);
55 51
56void transport_set_vpd_proto_id(struct t10_vpd *, unsigned char *); 52void transport_set_vpd_proto_id(struct t10_vpd *, unsigned char *);
57int transport_set_vpd_assoc(struct t10_vpd *, unsigned char *); 53int transport_set_vpd_assoc(struct t10_vpd *, unsigned char *);
diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h
index aaccc5f5fc9f..dc35d8660aa6 100644
--- a/include/target/target_core_base.h
+++ b/include/target/target_core_base.h
@@ -73,9 +73,8 @@
73/* 73/*
74 * struct se_device->dev_flags 74 * struct se_device->dev_flags
75 */ 75 */
76#define DF_READ_ONLY 0x00000001 76#define DF_SPC2_RESERVATIONS 0x00000001
77#define DF_SPC2_RESERVATIONS 0x00000002 77#define DF_SPC2_RESERVATIONS_WITH_ISID 0x00000002
78#define DF_SPC2_RESERVATIONS_WITH_ISID 0x00000004
79 78
80/* struct se_dev_attrib sanity values */ 79/* struct se_dev_attrib sanity values */
81/* Default max_unmap_lba_count */ 80/* Default max_unmap_lba_count */
@@ -141,14 +140,6 @@ enum transport_tpg_type_table {
141 TRANSPORT_TPG_TYPE_DISCOVERY = 1, 140 TRANSPORT_TPG_TYPE_DISCOVERY = 1,
142}; 141};
143 142
144/* struct se_task->task_flags */
145enum se_task_flags {
146 TF_ACTIVE = (1 << 0),
147 TF_SENT = (1 << 1),
148 TF_REQUEST_STOP = (1 << 2),
149 TF_HAS_SENSE = (1 << 3),
150};
151
152/* Special transport agnostic struct se_cmd->t_states */ 143/* Special transport agnostic struct se_cmd->t_states */
153enum transport_state_table { 144enum transport_state_table {
154 TRANSPORT_NO_STATE = 0, 145 TRANSPORT_NO_STATE = 0,
@@ -234,6 +225,7 @@ enum tcm_sense_reason_table {
234enum target_sc_flags_table { 225enum target_sc_flags_table {
235 TARGET_SCF_BIDI_OP = 0x01, 226 TARGET_SCF_BIDI_OP = 0x01,
236 TARGET_SCF_ACK_KREF = 0x02, 227 TARGET_SCF_ACK_KREF = 0x02,
228 TARGET_SCF_UNKNOWN_SIZE = 0x04,
237}; 229};
238 230
239/* fabric independent task management function values */ 231/* fabric independent task management function values */
@@ -338,6 +330,7 @@ struct t10_alua_tg_pt_gp {
338 int tg_pt_gp_alua_access_type; 330 int tg_pt_gp_alua_access_type;
339 int tg_pt_gp_nonop_delay_msecs; 331 int tg_pt_gp_nonop_delay_msecs;
340 int tg_pt_gp_trans_delay_msecs; 332 int tg_pt_gp_trans_delay_msecs;
333 int tg_pt_gp_implict_trans_secs;
341 int tg_pt_gp_pref; 334 int tg_pt_gp_pref;
342 int tg_pt_gp_write_metadata; 335 int tg_pt_gp_write_metadata;
343 /* Used by struct t10_alua_tg_pt_gp->tg_pt_gp_md_buf_len */ 336 /* Used by struct t10_alua_tg_pt_gp->tg_pt_gp_md_buf_len */
@@ -485,23 +478,6 @@ struct se_queue_obj {
485 wait_queue_head_t thread_wq; 478 wait_queue_head_t thread_wq;
486}; 479};
487 480
488struct se_task {
489 unsigned long long task_lba;
490 u32 task_sectors;
491 u32 task_size;
492 struct se_cmd *task_se_cmd;
493 struct scatterlist *task_sg;
494 u32 task_sg_nents;
495 u16 task_flags;
496 u8 task_scsi_status;
497 enum dma_data_direction task_data_direction;
498 struct list_head t_list;
499 struct list_head t_execute_list;
500 struct list_head t_state_list;
501 bool t_state_active;
502 struct completion task_stop_comp;
503};
504
505struct se_tmr_req { 481struct se_tmr_req {
506 /* Task Management function to be performed */ 482 /* Task Management function to be performed */
507 u8 function; 483 u8 function;
@@ -538,6 +514,7 @@ struct se_cmd {
538 /* Used to signal cmd->se_tfo->check_release_cmd() usage per cmd */ 514 /* Used to signal cmd->se_tfo->check_release_cmd() usage per cmd */
539 unsigned check_release:1; 515 unsigned check_release:1;
540 unsigned cmd_wait_set:1; 516 unsigned cmd_wait_set:1;
517 unsigned unknown_data_length:1;
541 /* See se_cmd_flags_table */ 518 /* See se_cmd_flags_table */
542 u32 se_cmd_flags; 519 u32 se_cmd_flags;
543 u32 se_ordered_id; 520 u32 se_ordered_id;
@@ -565,18 +542,13 @@ struct se_cmd {
565 struct completion cmd_wait_comp; 542 struct completion cmd_wait_comp;
566 struct kref cmd_kref; 543 struct kref cmd_kref;
567 struct target_core_fabric_ops *se_tfo; 544 struct target_core_fabric_ops *se_tfo;
568 int (*execute_task)(struct se_task *); 545 int (*execute_cmd)(struct se_cmd *);
569 void (*transport_complete_callback)(struct se_cmd *); 546 void (*transport_complete_callback)(struct se_cmd *);
570 547
571 unsigned char *t_task_cdb; 548 unsigned char *t_task_cdb;
572 unsigned char __t_task_cdb[TCM_MAX_COMMAND_SIZE]; 549 unsigned char __t_task_cdb[TCM_MAX_COMMAND_SIZE];
573 unsigned long long t_task_lba; 550 unsigned long long t_task_lba;
574 u32 t_tasks_sg_chained_no;
575 atomic_t t_fe_count; 551 atomic_t t_fe_count;
576 atomic_t t_se_count;
577 atomic_t t_task_cdbs_left;
578 atomic_t t_task_cdbs_ex_left;
579 atomic_t t_task_cdbs_sent;
580 unsigned int transport_state; 552 unsigned int transport_state;
581#define CMD_T_ABORTED (1 << 0) 553#define CMD_T_ABORTED (1 << 0)
582#define CMD_T_ACTIVE (1 << 1) 554#define CMD_T_ACTIVE (1 << 1)
@@ -588,11 +560,12 @@ struct se_cmd {
588#define CMD_T_LUN_STOP (1 << 7) 560#define CMD_T_LUN_STOP (1 << 7)
589#define CMD_T_LUN_FE_STOP (1 << 8) 561#define CMD_T_LUN_FE_STOP (1 << 8)
590#define CMD_T_DEV_ACTIVE (1 << 9) 562#define CMD_T_DEV_ACTIVE (1 << 9)
563#define CMD_T_REQUEST_STOP (1 << 10)
564#define CMD_T_BUSY (1 << 11)
591 spinlock_t t_state_lock; 565 spinlock_t t_state_lock;
592 struct completion t_transport_stop_comp; 566 struct completion t_transport_stop_comp;
593 struct completion transport_lun_fe_stop_comp; 567 struct completion transport_lun_fe_stop_comp;
594 struct completion transport_lun_stop_comp; 568 struct completion transport_lun_stop_comp;
595 struct scatterlist *t_tasks_sg_chained;
596 569
597 struct work_struct work; 570 struct work_struct work;
598 571
@@ -602,10 +575,15 @@ struct se_cmd {
602 struct scatterlist *t_bidi_data_sg; 575 struct scatterlist *t_bidi_data_sg;
603 unsigned int t_bidi_data_nents; 576 unsigned int t_bidi_data_nents;
604 577
605 /* Used for BIDI READ */ 578 struct list_head execute_list;
606 struct list_head t_task_list; 579 struct list_head state_list;
607 u32 t_task_list_num; 580 bool state_active;
581
582 /* old task stop completion, consider merging with some of the above */
583 struct completion task_stop_comp;
608 584
585 /* backend private data */
586 void *priv;
609}; 587};
610 588
611struct se_ua { 589struct se_ua {
@@ -731,7 +709,6 @@ struct se_dev_attrib {
731 u32 hw_block_size; 709 u32 hw_block_size;
732 u32 block_size; 710 u32 block_size;
733 u32 hw_max_sectors; 711 u32 hw_max_sectors;
734 u32 max_sectors;
735 u32 fabric_max_sectors; 712 u32 fabric_max_sectors;
736 u32 optimal_sectors; 713 u32 optimal_sectors;
737 u32 hw_queue_depth; 714 u32 hw_queue_depth;
@@ -829,8 +806,8 @@ struct se_device {
829 struct task_struct *process_thread; 806 struct task_struct *process_thread;
830 struct work_struct qf_work_queue; 807 struct work_struct qf_work_queue;
831 struct list_head delayed_cmd_list; 808 struct list_head delayed_cmd_list;
832 struct list_head execute_task_list; 809 struct list_head execute_list;
833 struct list_head state_task_list; 810 struct list_head state_list;
834 struct list_head qf_cmd_list; 811 struct list_head qf_cmd_list;
835 /* Pointer to associated SE HBA */ 812 /* Pointer to associated SE HBA */
836 struct se_hba *se_hba; 813 struct se_hba *se_hba;
diff --git a/include/target/target_core_fabric.h b/include/target/target_core_fabric.h
index 10c690809601..116959933f46 100644
--- a/include/target/target_core_fabric.h
+++ b/include/target/target_core_fabric.h
@@ -3,12 +3,6 @@
3 3
4struct target_core_fabric_ops { 4struct target_core_fabric_ops {
5 struct configfs_subsystem *tf_subsys; 5 struct configfs_subsystem *tf_subsys;
6 /*
7 * Optional to signal struct se_task->task_sg[] padding entries
8 * for scatterlist chaining using transport_do_task_sg_link(),
9 * disabled by default
10 */
11 bool task_sg_chaining;
12 char *(*get_fabric_name)(void); 6 char *(*get_fabric_name)(void);
13 u8 (*get_fabric_proto_ident)(struct se_portal_group *); 7 u8 (*get_fabric_proto_ident)(struct se_portal_group *);
14 char *(*tpg_get_wwn)(struct se_portal_group *); 8 char *(*tpg_get_wwn)(struct se_portal_group *);
@@ -102,7 +96,7 @@ void __transport_register_session(struct se_portal_group *,
102void transport_register_session(struct se_portal_group *, 96void transport_register_session(struct se_portal_group *,
103 struct se_node_acl *, struct se_session *, void *); 97 struct se_node_acl *, struct se_session *, void *);
104void target_get_session(struct se_session *); 98void target_get_session(struct se_session *);
105int target_put_session(struct se_session *); 99void target_put_session(struct se_session *);
106void transport_free_session(struct se_session *); 100void transport_free_session(struct se_session *);
107void target_put_nacl(struct se_node_acl *); 101void target_put_nacl(struct se_node_acl *);
108void transport_deregister_session_configfs(struct se_session *); 102void transport_deregister_session_configfs(struct se_session *);
@@ -112,7 +106,7 @@ void transport_deregister_session(struct se_session *);
112void transport_init_se_cmd(struct se_cmd *, struct target_core_fabric_ops *, 106void transport_init_se_cmd(struct se_cmd *, struct target_core_fabric_ops *,
113 struct se_session *, u32, int, int, unsigned char *); 107 struct se_session *, u32, int, int, unsigned char *);
114int transport_lookup_cmd_lun(struct se_cmd *, u32); 108int transport_lookup_cmd_lun(struct se_cmd *, u32);
115int transport_generic_allocate_tasks(struct se_cmd *, unsigned char *); 109int target_setup_cmd_from_cdb(struct se_cmd *, unsigned char *);
116void target_submit_cmd(struct se_cmd *, struct se_session *, unsigned char *, 110void target_submit_cmd(struct se_cmd *, struct se_session *, unsigned char *,
117 unsigned char *, u32, u32, int, int, int); 111 unsigned char *, u32, u32, int, int, int);
118int target_submit_tmr(struct se_cmd *se_cmd, struct se_session *se_sess, 112int target_submit_tmr(struct se_cmd *se_cmd, struct se_session *se_sess,
@@ -124,7 +118,6 @@ int transport_generic_handle_cdb_map(struct se_cmd *);
124int transport_generic_handle_data(struct se_cmd *); 118int transport_generic_handle_data(struct se_cmd *);
125int transport_generic_map_mem_to_cmd(struct se_cmd *cmd, 119int transport_generic_map_mem_to_cmd(struct se_cmd *cmd,
126 struct scatterlist *, u32, struct scatterlist *, u32); 120 struct scatterlist *, u32, struct scatterlist *, u32);
127void transport_do_task_sg_chain(struct se_cmd *);
128int transport_generic_new_cmd(struct se_cmd *); 121int transport_generic_new_cmd(struct se_cmd *);
129 122
130void transport_generic_process_write(struct se_cmd *); 123void transport_generic_process_write(struct se_cmd *);
diff --git a/include/trace/events/asoc.h b/include/trace/events/asoc.h
index ab26f8aa3c78..5fc2dcdd21cd 100644
--- a/include/trace/events/asoc.h
+++ b/include/trace/events/asoc.h
@@ -7,6 +7,8 @@
7#include <linux/ktime.h> 7#include <linux/ktime.h>
8#include <linux/tracepoint.h> 8#include <linux/tracepoint.h>
9 9
10#define DAPM_DIRECT "(direct)"
11
10struct snd_soc_jack; 12struct snd_soc_jack;
11struct snd_soc_codec; 13struct snd_soc_codec;
12struct snd_soc_platform; 14struct snd_soc_platform;
@@ -241,6 +243,84 @@ TRACE_EVENT(snd_soc_dapm_walk_done,
241 (int)__entry->path_checks, (int)__entry->neighbour_checks) 243 (int)__entry->path_checks, (int)__entry->neighbour_checks)
242); 244);
243 245
246TRACE_EVENT(snd_soc_dapm_output_path,
247
248 TP_PROTO(struct snd_soc_dapm_widget *widget,
249 struct snd_soc_dapm_path *path),
250
251 TP_ARGS(widget, path),
252
253 TP_STRUCT__entry(
254 __string( wname, widget->name )
255 __string( pname, path->name ? path->name : DAPM_DIRECT)
256 __string( psname, path->sink->name )
257 __field( int, path_sink )
258 __field( int, path_connect )
259 ),
260
261 TP_fast_assign(
262 __assign_str(wname, widget->name);
263 __assign_str(pname, path->name ? path->name : DAPM_DIRECT);
264 __assign_str(psname, path->sink->name);
265 __entry->path_connect = path->connect;
266 __entry->path_sink = (long)path->sink;
267 ),
268
269 TP_printk("%c%s -> %s -> %s\n",
270 (int) __entry->path_sink &&
271 (int) __entry->path_connect ? '*' : ' ',
272 __get_str(wname), __get_str(pname), __get_str(psname))
273);
274
275TRACE_EVENT(snd_soc_dapm_input_path,
276
277 TP_PROTO(struct snd_soc_dapm_widget *widget,
278 struct snd_soc_dapm_path *path),
279
280 TP_ARGS(widget, path),
281
282 TP_STRUCT__entry(
283 __string( wname, widget->name )
284 __string( pname, path->name ? path->name : DAPM_DIRECT)
285 __string( psname, path->source->name )
286 __field( int, path_source )
287 __field( int, path_connect )
288 ),
289
290 TP_fast_assign(
291 __assign_str(wname, widget->name);
292 __assign_str(pname, path->name ? path->name : DAPM_DIRECT);
293 __assign_str(psname, path->source->name);
294 __entry->path_connect = path->connect;
295 __entry->path_source = (long)path->source;
296 ),
297
298 TP_printk("%c%s <- %s <- %s\n",
299 (int) __entry->path_source &&
300 (int) __entry->path_connect ? '*' : ' ',
301 __get_str(wname), __get_str(pname), __get_str(psname))
302);
303
304TRACE_EVENT(snd_soc_dapm_connected,
305
306 TP_PROTO(int paths, int stream),
307
308 TP_ARGS(paths, stream),
309
310 TP_STRUCT__entry(
311 __field( int, paths )
312 __field( int, stream )
313 ),
314
315 TP_fast_assign(
316 __entry->paths = paths;
317 __entry->stream = stream;
318 ),
319
320 TP_printk("%s: found %d paths\n",
321 __entry->stream ? "capture" : "playback", __entry->paths)
322);
323
244TRACE_EVENT(snd_soc_jack_irq, 324TRACE_EVENT(snd_soc_jack_irq,
245 325
246 TP_PROTO(const char *name), 326 TP_PROTO(const char *name),
diff --git a/include/trace/events/power.h b/include/trace/events/power.h
index cae9a94f025d..0c9783841a30 100644
--- a/include/trace/events/power.h
+++ b/include/trace/events/power.h
@@ -65,6 +65,40 @@ TRACE_EVENT(machine_suspend,
65 TP_printk("state=%lu", (unsigned long)__entry->state) 65 TP_printk("state=%lu", (unsigned long)__entry->state)
66); 66);
67 67
68DECLARE_EVENT_CLASS(wakeup_source,
69
70 TP_PROTO(const char *name, unsigned int state),
71
72 TP_ARGS(name, state),
73
74 TP_STRUCT__entry(
75 __string( name, name )
76 __field( u64, state )
77 ),
78
79 TP_fast_assign(
80 __assign_str(name, name);
81 __entry->state = state;
82 ),
83
84 TP_printk("%s state=0x%lx", __get_str(name),
85 (unsigned long)__entry->state)
86);
87
88DEFINE_EVENT(wakeup_source, wakeup_source_activate,
89
90 TP_PROTO(const char *name, unsigned int state),
91
92 TP_ARGS(name, state)
93);
94
95DEFINE_EVENT(wakeup_source, wakeup_source_deactivate,
96
97 TP_PROTO(const char *name, unsigned int state),
98
99 TP_ARGS(name, state)
100);
101
68#ifdef CONFIG_EVENT_POWER_TRACING_DEPRECATED 102#ifdef CONFIG_EVENT_POWER_TRACING_DEPRECATED
69 103
70/* 104/*
diff --git a/include/trace/events/rcu.h b/include/trace/events/rcu.h
index 337099783f37..1480900c511c 100644
--- a/include/trace/events/rcu.h
+++ b/include/trace/events/rcu.h
@@ -292,6 +292,8 @@ TRACE_EVENT(rcu_dyntick,
292 * "More callbacks": Still more callbacks, try again to clear them out. 292 * "More callbacks": Still more callbacks, try again to clear them out.
293 * "Callbacks drained": All callbacks processed, off to dyntick idle! 293 * "Callbacks drained": All callbacks processed, off to dyntick idle!
294 * "Timer": Timer fired to cause CPU to continue processing callbacks. 294 * "Timer": Timer fired to cause CPU to continue processing callbacks.
295 * "Demigrate": Timer fired on wrong CPU, woke up correct CPU.
296 * "Cleanup after idle": Idle exited, timer canceled.
295 */ 297 */
296TRACE_EVENT(rcu_prep_idle, 298TRACE_EVENT(rcu_prep_idle,
297 299
diff --git a/include/trace/events/workqueue.h b/include/trace/events/workqueue.h
index 7d497291c85d..4018f5058f27 100644
--- a/include/trace/events/workqueue.h
+++ b/include/trace/events/workqueue.h
@@ -103,7 +103,7 @@ TRACE_EVENT(workqueue_execute_start,
103); 103);
104 104
105/** 105/**
106 * workqueue_execute_end - called immediately before the workqueue callback 106 * workqueue_execute_end - called immediately after the workqueue callback
107 * @work: pointer to struct work_struct 107 * @work: pointer to struct work_struct
108 * 108 *
109 * Allows to track workqueue execution. 109 * Allows to track workqueue execution.
diff --git a/include/video/omap-panel-nokia-dsi.h b/include/video/omap-panel-nokia-dsi.h
index 7dc71f9c13e6..04219a295539 100644
--- a/include/video/omap-panel-nokia-dsi.h
+++ b/include/video/omap-panel-nokia-dsi.h
@@ -11,6 +11,7 @@ struct omap_dss_device;
11 * @esd_interval: interval of ESD checks, 0 = disabled (ms) 11 * @esd_interval: interval of ESD checks, 0 = disabled (ms)
12 * @ulps_timeout: time to wait before entering ULPS, 0 = disabled (ms) 12 * @ulps_timeout: time to wait before entering ULPS, 0 = disabled (ms)
13 * @use_dsi_backlight: true if panel uses DSI command to control backlight 13 * @use_dsi_backlight: true if panel uses DSI command to control backlight
14 * @pin_config: DSI pin configuration
14 */ 15 */
15struct nokia_dsi_panel_data { 16struct nokia_dsi_panel_data {
16 const char *name; 17 const char *name;
@@ -24,6 +25,8 @@ struct nokia_dsi_panel_data {
24 unsigned ulps_timeout; 25 unsigned ulps_timeout;
25 26
26 bool use_dsi_backlight; 27 bool use_dsi_backlight;
28
29 struct omap_dsi_pin_config pin_config;
27}; 30};
28 31
29#endif /* __OMAP_NOKIA_DSI_PANEL_H */ 32#endif /* __OMAP_NOKIA_DSI_PANEL_H */
diff --git a/include/video/omap-panel-dvi.h b/include/video/omap-panel-tfp410.h
index 87ad567b4229..68c31d79c571 100644
--- a/include/video/omap-panel-dvi.h
+++ b/include/video/omap-panel-tfp410.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Header for DVI output driver 2 * Header for TFP410 chip driver
3 * 3 *
4 * Copyright (C) 2011 Texas Instruments Inc 4 * Copyright (C) 2011 Texas Instruments Inc
5 * Author: Tomi Valkeinen <tomi.valkeinen@ti.com> 5 * Author: Tomi Valkeinen <tomi.valkeinen@ti.com>
@@ -17,21 +17,19 @@
17 * this program. If not, see <http://www.gnu.org/licenses/>. 17 * this program. If not, see <http://www.gnu.org/licenses/>.
18 */ 18 */
19 19
20#ifndef __OMAP_PANEL_DVI_H 20#ifndef __OMAP_PANEL_TFP410_H
21#define __OMAP_PANEL_DVI_H 21#define __OMAP_PANEL_TFP410_H
22 22
23struct omap_dss_device; 23struct omap_dss_device;
24 24
25/** 25/**
26 * struct panel_dvi_platform_data - panel driver configuration data 26 * struct tfp410_platform_data - panel driver configuration data
27 * @platform_enable: platform specific panel enable function
28 * @platform_disable: platform specific panel disable function
29 * @i2c_bus_num: i2c bus id for the panel 27 * @i2c_bus_num: i2c bus id for the panel
28 * @power_down_gpio: gpio number for PD pin (or -1 if not available)
30 */ 29 */
31struct panel_dvi_platform_data { 30struct tfp410_platform_data {
32 int (*platform_enable)(struct omap_dss_device *dssdev);
33 void (*platform_disable)(struct omap_dss_device *dssdev);
34 u16 i2c_bus_num; 31 u16 i2c_bus_num;
32 int power_down_gpio;
35}; 33};
36 34
37#endif /* __OMAP_PANEL_DVI_H */ 35#endif /* __OMAP_PANEL_TFP410_H */
diff --git a/include/video/omapdss.h b/include/video/omapdss.h
index 483f67caa7ad..1c46a14341dd 100644
--- a/include/video/omapdss.h
+++ b/include/video/omapdss.h
@@ -468,6 +468,21 @@ struct omap_overlay_manager {
468 int (*wait_for_vsync)(struct omap_overlay_manager *mgr); 468 int (*wait_for_vsync)(struct omap_overlay_manager *mgr);
469}; 469};
470 470
471/* 22 pins means 1 clk lane and 10 data lanes */
472#define OMAP_DSS_MAX_DSI_PINS 22
473
474struct omap_dsi_pin_config {
475 int num_pins;
476 /*
477 * pin numbers in the following order:
478 * clk+, clk-
479 * data1+, data1-
480 * data2+, data2-
481 * ...
482 */
483 int pins[OMAP_DSS_MAX_DSI_PINS];
484};
485
471struct omap_dss_device { 486struct omap_dss_device {
472 struct device dev; 487 struct device dev;
473 488
@@ -490,17 +505,6 @@ struct omap_dss_device {
490 } sdi; 505 } sdi;
491 506
492 struct { 507 struct {
493 u8 clk_lane;
494 u8 clk_pol;
495 u8 data1_lane;
496 u8 data1_pol;
497 u8 data2_lane;
498 u8 data2_pol;
499 u8 data3_lane;
500 u8 data3_pol;
501 u8 data4_lane;
502 u8 data4_pol;
503
504 int module; 508 int module;
505 509
506 bool ext_te; 510 bool ext_te;
@@ -687,6 +691,8 @@ int omap_dsi_update(struct omap_dss_device *dssdev, int channel,
687int omap_dsi_request_vc(struct omap_dss_device *dssdev, int *channel); 691int omap_dsi_request_vc(struct omap_dss_device *dssdev, int *channel);
688int omap_dsi_set_vc_id(struct omap_dss_device *dssdev, int channel, int vc_id); 692int omap_dsi_set_vc_id(struct omap_dss_device *dssdev, int channel, int vc_id);
689void omap_dsi_release_vc(struct omap_dss_device *dssdev, int channel); 693void omap_dsi_release_vc(struct omap_dss_device *dssdev, int channel);
694int omapdss_dsi_configure_pins(struct omap_dss_device *dssdev,
695 const struct omap_dsi_pin_config *pin_cfg);
690 696
691int omapdss_dsi_display_enable(struct omap_dss_device *dssdev); 697int omapdss_dsi_display_enable(struct omap_dss_device *dssdev);
692void omapdss_dsi_display_disable(struct omap_dss_device *dssdev, 698void omapdss_dsi_display_disable(struct omap_dss_device *dssdev,
diff --git a/include/video/vga.h b/include/video/vga.h
index 2b8691f7d256..cac567f22e62 100644
--- a/include/video/vga.h
+++ b/include/video/vga.h
@@ -19,29 +19,7 @@
19 19
20#include <linux/types.h> 20#include <linux/types.h>
21#include <asm/io.h> 21#include <asm/io.h>
22#ifndef CONFIG_AMIGA
23#include <asm/vga.h> 22#include <asm/vga.h>
24#else
25/*
26 * FIXME
27 * Ugh, we don't have PCI space, so map readb() and friends to use Zorro space
28 * for MMIO accesses. This should make cirrusfb work again on Amiga
29 */
30#undef inb_p
31#undef inw_p
32#undef outb_p
33#undef outw
34#undef readb
35#undef writeb
36#undef writew
37#define inb_p(port) 0
38#define inw_p(port) 0
39#define outb_p(port, val) do { } while (0)
40#define outw(port, val) do { } while (0)
41#define readb z_readb
42#define writeb z_writeb
43#define writew z_writew
44#endif
45#include <asm/byteorder.h> 23#include <asm/byteorder.h>
46 24
47 25