aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/Kbuild7
-rw-r--r--include/linux/alarmtimer.h3
-rw-r--r--include/linux/amba/bus.h8
-rw-r--r--include/linux/atmlec.h7
-rw-r--r--include/linux/audit.h8
-rw-r--r--include/linux/bcma/bcma.h8
-rw-r--r--include/linux/bcma/bcma_driver_pci.h11
-rw-r--r--include/linux/blkdev.h3
-rw-r--r--include/linux/bootmem.h3
-rw-r--r--include/linux/capability.h7
-rw-r--r--include/linux/cgroup.h81
-rw-r--r--include/linux/clk.h32
-rw-r--r--include/linux/clkdev.h3
-rw-r--r--include/linux/cpu.h2
-rw-r--r--include/linux/cred.h33
-rw-r--r--include/linux/cs5535.h1
-rw-r--r--include/linux/dcache.h21
-rw-r--r--include/linux/dcbnl.h12
-rw-r--r--include/linux/dccp.h2
-rw-r--r--include/linux/device.h34
-rw-r--r--include/linux/dlm.h1
-rw-r--r--include/linux/dmar.h85
-rw-r--r--include/linux/dvb/frontend.h51
-rw-r--r--include/linux/dvb/version.h2
-rw-r--r--include/linux/dynamic_debug.h22
-rw-r--r--include/linux/etherdevice.h65
-rw-r--r--include/linux/ethtool.h69
-rw-r--r--include/linux/eventpoll.h12
-rw-r--r--include/linux/extcon.h324
-rw-r--r--include/linux/extcon/extcon_gpio.h52
-rw-r--r--include/linux/filter.h19
-rw-r--r--include/linux/firewire.h17
-rw-r--r--include/linux/fixp-arith.h87
-rw-r--r--include/linux/fs.h43
-rw-r--r--include/linux/fsl_devices.h9
-rw-r--r--include/linux/ftrace.h19
-rw-r--r--include/linux/ftrace_event.h2
-rw-r--r--include/linux/gameport.h13
-rw-r--r--include/linux/generic_serial.h64
-rw-r--r--include/linux/genhd.h6
-rw-r--r--include/linux/hid.h36
-rw-r--r--include/linux/hidraw.h4
-rw-r--r--include/linux/hyperv.h31
-rw-r--r--include/linux/i2c-pnx.h10
-rw-r--r--include/linux/i2c/adp5588.h1
-rw-r--r--include/linux/i2c/twl.h13
-rw-r--r--include/linux/i2o-dev.h2
-rw-r--r--include/linux/ibmtr.h373
-rw-r--r--include/linux/ieee80211.h36
-rw-r--r--include/linux/if_arp.h1
-rw-r--r--include/linux/if_ec.h68
-rw-r--r--include/linux/if_link.h5
-rw-r--r--include/linux/if_macvlan.h1
-rw-r--r--include/linux/if_pppol2tp.h28
-rw-r--r--include/linux/if_pppox.h20
-rw-r--r--include/linux/if_team.h67
-rw-r--r--include/linux/if_tr.h103
-rw-r--r--include/linux/iio/buffer.h191
-rw-r--r--include/linux/iio/consumer.h96
-rw-r--r--include/linux/iio/driver.h34
-rw-r--r--include/linux/iio/events.h105
-rw-r--r--include/linux/iio/iio.h492
-rw-r--r--include/linux/iio/kfifo_buf.h8
-rw-r--r--include/linux/iio/machine.h24
-rw-r--r--include/linux/iio/sysfs.h117
-rw-r--r--include/linux/iio/trigger.h119
-rw-r--r--include/linux/iio/trigger_consumer.h52
-rw-r--r--include/linux/iio/types.h55
-rw-r--r--include/linux/in6.h2
-rw-r--r--include/linux/input/lm8333.h24
-rw-r--r--include/linux/input/matrix_keypad.h54
-rw-r--r--include/linux/input/navpoint.h12
-rw-r--r--include/linux/interrupt.h8
-rw-r--r--include/linux/ioport.h7
-rw-r--r--include/linux/ip_vs.h17
-rw-r--r--include/linux/irq.h5
-rw-r--r--include/linux/irqdomain.h3
-rw-r--r--include/linux/isdn.h26
-rw-r--r--include/linux/kernel.h13
-rw-r--r--include/linux/key.h11
-rw-r--r--include/linux/keyctl.h1
-rw-r--r--include/linux/l2tp.h19
-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/mISDNhw.h25
-rw-r--r--include/linux/mISDNif.h16
-rw-r--r--include/linux/mca-legacy.h66
-rw-r--r--include/linux/mca.h148
-rw-r--r--include/linux/mdio-mux.h21
-rw-r--r--include/linux/mei.h110
-rw-r--r--include/linux/mfd/abx500.h5
-rw-r--r--include/linux/mfd/abx500/ab5500.h140
-rw-r--r--include/linux/mfd/asic3.h1
-rw-r--r--include/linux/mfd/da9052/da9052.h1
-rw-r--r--include/linux/mfd/db5500-prcmu.h105
-rw-r--r--include/linux/mfd/dbx500-prcmu.h242
-rw-r--r--include/linux/mfd/max8997.h23
-rw-r--r--include/linux/mfd/mc13xxx.h11
-rw-r--r--include/linux/mfd/palmas.h2620
-rw-r--r--include/linux/mfd/rc5t583.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/micrel_phy.h2
-rw-r--r--include/linux/mlx4/cmd.h4
-rw-r--r--include/linux/mlx4/device.h11
-rw-r--r--include/linux/mlx4/qp.h6
-rw-r--r--include/linux/mm.h6
-rw-r--r--include/linux/mm_types.h2
-rw-r--r--include/linux/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/neighbour.h3
-rw-r--r--include/linux/net.h23
-rw-r--r--include/linux/netdevice.h52
-rw-r--r--include/linux/netfilter.h6
-rw-r--r--include/linux/netfilter/ipset/ip_set.h54
-rw-r--r--include/linux/netfilter/ipset/ip_set_ahash.h37
-rw-r--r--include/linux/netfilter/ipset/ip_set_timeout.h4
-rw-r--r--include/linux/netfilter/nf_conntrack_common.h4
-rw-r--r--include/linux/netfilter/nf_conntrack_h323_types.h12
-rw-r--r--include/linux/netfilter/nfnetlink.h2
-rw-r--r--include/linux/netfilter/xt_HMARK.h45
-rw-r--r--include/linux/netfilter/xt_hashlimit.h12
-rw-r--r--include/linux/netfilter_ipv4/Kbuild1
-rw-r--r--include/linux/netfilter_ipv4/ip_queue.h72
-rw-r--r--include/linux/netfilter_ipv6/ip6_tables.h7
-rw-r--r--include/linux/netlink.h2
-rw-r--r--include/linux/nfc.h1
-rw-r--r--include/linux/nfc/pn544.h7
-rw-r--r--include/linux/nl80211.h52
-rw-r--r--include/linux/nl802154.h20
-rw-r--r--include/linux/of.h51
-rw-r--r--include/linux/of_irq.h12
-rw-r--r--include/linux/of_mdio.h2
-rw-r--r--include/linux/of_serial.h17
-rw-r--r--include/linux/of_spi.h23
-rw-r--r--include/linux/pagemap.h64
-rw-r--r--include/linux/pci.h9
-rw-r--r--include/linux/percpu.h54
-rw-r--r--include/linux/perf_event.h5
-rw-r--r--include/linux/phy.h4
-rw-r--r--include/linux/pid_namespace.h2
-rw-r--r--include/linux/pinctrl/consumer.h44
-rw-r--r--include/linux/pinctrl/machine.h7
-rw-r--r--include/linux/pinctrl/pinconf.h6
-rw-r--r--include/linux/pinctrl/pinctrl-state.h13
-rw-r--r--include/linux/pinctrl/pinctrl.h22
-rw-r--r--include/linux/pinctrl/pinmux.h9
-rw-r--r--include/linux/pkt_sched.h81
-rw-r--r--include/linux/platform_data/at91_adc.h61
-rw-r--r--include/linux/platform_data/ehci-sh.h28
-rw-r--r--include/linux/platform_data/emif_plat.h128
-rw-r--r--include/linux/platform_data/gpio-em.h10
-rw-r--r--include/linux/platform_data/ina2xx.h19
-rw-r--r--include/linux/platform_data/s3c-hsotg.h35
-rw-r--r--include/linux/platform_data/tegra_usb.h1
-rw-r--r--include/linux/platform_data/wiznet.h24
-rw-r--r--include/linux/pm.h2
-rw-r--r--include/linux/pm_domain.h13
-rw-r--r--include/linux/pm_runtime.h3
-rw-r--r--include/linux/pm_wakeup.h15
-rw-r--r--include/linux/prctl.h15
-rw-r--r--include/linux/printk.h13
-rw-r--r--include/linux/proc_fs.h4
-rw-r--r--include/linux/pstore_ram.h98
-rw-r--r--include/linux/ptp_clock_kernel.h8
-rw-r--r--include/linux/ptrace.h5
-rw-r--r--include/linux/quotaops.h4
-rw-r--r--include/linux/raid/md_p.h15
-rw-r--r--include/linux/raid/pq.h18
-rw-r--r--include/linux/ramoops.h17
-rw-r--r--include/linux/rational.h2
-rw-r--r--include/linux/rculist.h40
-rw-r--r--include/linux/rcupdate.h20
-rw-r--r--include/linux/rcutiny.h11
-rw-r--r--include/linux/rcutree.h19
-rw-r--r--include/linux/regmap.h44
-rw-r--r--include/linux/regulator/driver.h73
-rw-r--r--include/linux/regulator/fixed.h7
-rw-r--r--include/linux/regulator/of_regulator.h18
-rw-r--r--include/linux/regulator/tps62360.h6
-rw-r--r--include/linux/regulator/tps65090-regulator.h50
-rw-r--r--include/linux/res_counter.h2
-rw-r--r--include/linux/ring_buffer.h6
-rw-r--r--include/linux/rndis.h390
-rw-r--r--include/linux/rtnetlink.h4
-rw-r--r--include/linux/sched.h76
-rw-r--r--include/linux/seccomp.h107
-rw-r--r--include/linux/security.h14
-rw-r--r--include/linux/serial.h2
-rw-r--r--include/linux/serial_8250.h3
-rw-r--r--include/linux/serial_core.h5
-rw-r--r--include/linux/serial_sci.h2
-rw-r--r--include/linux/serio.h13
-rw-r--r--include/linux/sh_clk.h34
-rw-r--r--include/linux/sh_intc.h1
-rw-r--r--include/linux/shmem_fs.h4
-rw-r--r--include/linux/signal.h1
-rw-r--r--include/linux/skbuff.h115
-rw-r--r--include/linux/smp.h6
-rw-r--r--include/linux/sock_diag.h4
-rw-r--r--include/linux/socket.h4
-rw-r--r--include/linux/spi/eeprom.h10
-rw-r--r--include/linux/spi/rspi.h31
-rw-r--r--include/linux/srcu.h48
-rw-r--r--include/linux/ssb/ssb.h1
-rw-r--r--include/linux/ssb/ssb_regs.h61
-rw-r--r--include/linux/stat.h5
-rw-r--r--include/linux/stmmac.h57
-rw-r--r--include/linux/suspend.h14
-rw-r--r--include/linux/sysfs.h12
-rw-r--r--include/linux/tcp.h24
-rw-r--r--include/linux/thread_info.h6
-rw-r--r--include/linux/ti_wilink_st.h2
-rw-r--r--include/linux/time.h1
-rw-r--r--include/linux/topology.h46
-rw-r--r--include/linux/trdevice.h37
-rw-r--r--include/linux/tty.h23
-rw-r--r--include/linux/tty_ldisc.h2
-rw-r--r--include/linux/uidgid.h200
-rw-r--r--include/linux/uprobes.h165
-rw-r--r--include/linux/usb.h79
-rw-r--r--include/linux/usb/ch11.h2
-rw-r--r--include/linux/usb/ch9.h58
-rw-r--r--include/linux/usb/chipidea.h28
-rw-r--r--include/linux/usb/composite.h6
-rw-r--r--include/linux/usb/functionfs.h4
-rw-r--r--include/linux/usb/gpio_vbus.h2
-rw-r--r--include/linux/usb/hcd.h32
-rw-r--r--include/linux/usb/isp1301.h80
-rw-r--r--include/linux/usb/langwell_udc.h310
-rw-r--r--include/linux/usb/rndis_host.h66
-rw-r--r--include/linux/usb/serial.h34
-rw-r--r--include/linux/usb/usbnet.h3
-rw-r--r--include/linux/user_namespace.h39
-rw-r--r--include/linux/uuid.h4
-rw-r--r--include/linux/v4l2-dv-timings.h816
-rw-r--r--include/linux/v4l2-subdev.h41
-rw-r--r--include/linux/vga_switcheroo.h19
-rw-r--r--include/linux/vgaarb.h7
-rw-r--r--include/linux/videodev2.h372
-rw-r--r--include/linux/virtio_config.h11
-rw-r--r--include/linux/virtio_net.h14
-rw-r--r--include/linux/vme.h174
-rw-r--r--include/linux/vt_kern.h1
251 files changed, 9837 insertions, 2829 deletions
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index 3c9b616c834a..4cd59b95858f 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -167,7 +167,6 @@ header-y += if_arp.h
167header-y += if_bonding.h 167header-y += if_bonding.h
168header-y += if_bridge.h 168header-y += if_bridge.h
169header-y += if_cablemodem.h 169header-y += if_cablemodem.h
170header-y += if_ec.h
171header-y += if_eql.h 170header-y += if_eql.h
172header-y += if_ether.h 171header-y += if_ether.h
173header-y += if_fc.h 172header-y += if_fc.h
@@ -186,7 +185,6 @@ header-y += if_pppox.h
186header-y += if_slip.h 185header-y += if_slip.h
187header-y += if_strip.h 186header-y += if_strip.h
188header-y += if_team.h 187header-y += if_team.h
189header-y += if_tr.h
190header-y += if_tun.h 188header-y += if_tun.h
191header-y += if_tunnel.h 189header-y += if_tunnel.h
192header-y += if_vlan.h 190header-y += if_vlan.h
@@ -240,6 +238,7 @@ header-y += map_to_7segment.h
240header-y += matroxfb.h 238header-y += matroxfb.h
241header-y += mdio.h 239header-y += mdio.h
242header-y += media.h 240header-y += media.h
241header-y += mei.h
243header-y += mempolicy.h 242header-y += mempolicy.h
244header-y += meye.h 243header-y += meye.h
245header-y += mii.h 244header-y += mii.h
@@ -271,6 +270,7 @@ header-y += netfilter_ipv4.h
271header-y += netfilter_ipv6.h 270header-y += netfilter_ipv6.h
272header-y += netlink.h 271header-y += netlink.h
273header-y += netrom.h 272header-y += netrom.h
273header-y += nfc.h
274header-y += nfs.h 274header-y += nfs.h
275header-y += nfs2.h 275header-y += nfs2.h
276header-y += nfs3.h 276header-y += nfs3.h
@@ -332,6 +332,7 @@ header-y += scc.h
332header-y += sched.h 332header-y += sched.h
333header-y += screen_info.h 333header-y += screen_info.h
334header-y += sdla.h 334header-y += sdla.h
335header-y += seccomp.h
335header-y += securebits.h 336header-y += securebits.h
336header-y += selinux_netlink.h 337header-y += selinux_netlink.h
337header-y += sem.h 338header-y += sem.h
@@ -381,7 +382,9 @@ header-y += unistd.h
381header-y += usbdevice_fs.h 382header-y += usbdevice_fs.h
382header-y += utime.h 383header-y += utime.h
383header-y += utsname.h 384header-y += utsname.h
385header-y += uuid.h
384header-y += uvcvideo.h 386header-y += uvcvideo.h
387header-y += v4l2-dv-timings.h
385header-y += v4l2-mediabus.h 388header-y += v4l2-mediabus.h
386header-y += v4l2-subdev.h 389header-y += v4l2-subdev.h
387header-y += veth.h 390header-y += veth.h
diff --git a/include/linux/alarmtimer.h b/include/linux/alarmtimer.h
index 975009e1cbe6..96c5c249b086 100644
--- a/include/linux/alarmtimer.h
+++ b/include/linux/alarmtimer.h
@@ -76,4 +76,7 @@ static inline int alarmtimer_callback_running(struct alarm *timer)
76} 76}
77 77
78 78
79/* Provide way to access the rtc device being used by alarmtimers */
80struct rtc_device *alarmtimer_get_rtcdev(void);
81
79#endif 82#endif
diff --git a/include/linux/amba/bus.h b/include/linux/amba/bus.h
index 8d54f79457ba..d36417158d8f 100644
--- a/include/linux/amba/bus.h
+++ b/include/linux/amba/bus.h
@@ -63,6 +63,14 @@ struct amba_device *amba_device_alloc(const char *, resource_size_t, size_t);
63void amba_device_put(struct amba_device *); 63void amba_device_put(struct amba_device *);
64int amba_device_add(struct amba_device *, struct resource *); 64int amba_device_add(struct amba_device *, struct resource *);
65int amba_device_register(struct amba_device *, struct resource *); 65int amba_device_register(struct amba_device *, struct resource *);
66struct amba_device *amba_apb_device_add(struct device *parent, const char *name,
67 resource_size_t base, size_t size,
68 int irq1, int irq2, void *pdata,
69 unsigned int periphid);
70struct amba_device *amba_ahb_device_add(struct device *parent, const char *name,
71 resource_size_t base, size_t size,
72 int irq1, int irq2, void *pdata,
73 unsigned int periphid);
66void amba_device_unregister(struct amba_device *); 74void amba_device_unregister(struct amba_device *);
67struct amba_device *amba_find_device(const char *, struct device *, unsigned int, unsigned int); 75struct amba_device *amba_find_device(const char *, struct device *, unsigned int, unsigned int);
68int amba_request_regions(struct amba_device *, const char *); 76int amba_request_regions(struct amba_device *, const char *);
diff --git a/include/linux/atmlec.h b/include/linux/atmlec.h
index 39c917fd1b96..302791e3ab2b 100644
--- a/include/linux/atmlec.h
+++ b/include/linux/atmlec.h
@@ -21,13 +21,6 @@
21/* Maximum number of LEC interfaces (tweakable) */ 21/* Maximum number of LEC interfaces (tweakable) */
22#define MAX_LEC_ITF 48 22#define MAX_LEC_ITF 48
23 23
24/*
25 * From the total of MAX_LEC_ITF, last NUM_TR_DEVS are reserved for Token Ring.
26 * E.g. if MAX_LEC_ITF = 48 and NUM_TR_DEVS = 8, then lec0-lec39 are for
27 * Ethernet ELANs and lec40-lec47 are for Token Ring ELANS.
28 */
29#define NUM_TR_DEVS 8
30
31typedef enum { 24typedef enum {
32 l_set_mac_addr, 25 l_set_mac_addr,
33 l_del_mac_addr, 26 l_del_mac_addr,
diff --git a/include/linux/audit.h b/include/linux/audit.h
index ed3ef1972496..22f292a917a3 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -463,7 +463,7 @@ extern void audit_putname(const char *name);
463extern void __audit_inode(const char *name, const struct dentry *dentry); 463extern void __audit_inode(const char *name, const struct dentry *dentry);
464extern void __audit_inode_child(const struct dentry *dentry, 464extern void __audit_inode_child(const struct dentry *dentry,
465 const struct inode *parent); 465 const struct inode *parent);
466extern void __audit_seccomp(unsigned long syscall); 466extern void __audit_seccomp(unsigned long syscall, long signr, int code);
467extern void __audit_ptrace(struct task_struct *t); 467extern void __audit_ptrace(struct task_struct *t);
468 468
469static inline int audit_dummy_context(void) 469static inline int audit_dummy_context(void)
@@ -508,10 +508,10 @@ static inline void audit_inode_child(const struct dentry *dentry,
508} 508}
509void audit_core_dumps(long signr); 509void audit_core_dumps(long signr);
510 510
511static inline void audit_seccomp(unsigned long syscall) 511static inline void audit_seccomp(unsigned long syscall, long signr, int code)
512{ 512{
513 if (unlikely(!audit_dummy_context())) 513 if (unlikely(!audit_dummy_context()))
514 __audit_seccomp(syscall); 514 __audit_seccomp(syscall, signr, code);
515} 515}
516 516
517static inline void audit_ptrace(struct task_struct *t) 517static inline void audit_ptrace(struct task_struct *t)
@@ -634,7 +634,7 @@ extern int audit_signals;
634#define audit_inode(n,d) do { (void)(d); } while (0) 634#define audit_inode(n,d) do { (void)(d); } while (0)
635#define audit_inode_child(i,p) do { ; } while (0) 635#define audit_inode_child(i,p) do { ; } while (0)
636#define audit_core_dumps(i) do { ; } while (0) 636#define audit_core_dumps(i) do { ; } while (0)
637#define audit_seccomp(i) do { ; } while (0) 637#define audit_seccomp(i,s,c) do { ; } while (0)
638#define auditsc_get_stamp(c,t,s) (0) 638#define auditsc_get_stamp(c,t,s) (0)
639#define audit_get_loginuid(t) (-1) 639#define audit_get_loginuid(t) (-1)
640#define audit_get_sessionid(t) (-1) 640#define audit_get_sessionid(t) (-1)
diff --git a/include/linux/bcma/bcma.h b/include/linux/bcma/bcma.h
index 5af9a075498f..8deaf6d050c3 100644
--- a/include/linux/bcma/bcma.h
+++ b/include/linux/bcma/bcma.h
@@ -26,6 +26,11 @@ struct bcma_chipinfo {
26 u8 pkg; 26 u8 pkg;
27}; 27};
28 28
29struct bcma_boardinfo {
30 u16 vendor;
31 u16 type;
32};
33
29enum bcma_clkmode { 34enum bcma_clkmode {
30 BCMA_CLKMODE_FAST, 35 BCMA_CLKMODE_FAST,
31 BCMA_CLKMODE_DYNAMIC, 36 BCMA_CLKMODE_DYNAMIC,
@@ -139,6 +144,7 @@ struct bcma_device {
139 u8 core_unit; 144 u8 core_unit;
140 145
141 u32 addr; 146 u32 addr;
147 u32 addr1;
142 u32 wrap; 148 u32 wrap;
143 149
144 void __iomem *io_addr; 150 void __iomem *io_addr;
@@ -198,6 +204,8 @@ struct bcma_bus {
198 204
199 struct bcma_chipinfo chipinfo; 205 struct bcma_chipinfo chipinfo;
200 206
207 struct bcma_boardinfo boardinfo;
208
201 struct bcma_device *mapped_core; 209 struct bcma_device *mapped_core;
202 struct list_head cores; 210 struct list_head cores;
203 u8 nr_cores; 211 u8 nr_cores;
diff --git a/include/linux/bcma/bcma_driver_pci.h b/include/linux/bcma/bcma_driver_pci.h
index 46c71e27d31f..41da581e1612 100644
--- a/include/linux/bcma/bcma_driver_pci.h
+++ b/include/linux/bcma/bcma_driver_pci.h
@@ -87,6 +87,13 @@ struct pci_dev;
87#define BCMA_CORE_PCI_PCICFG2 0x0600 /* PCI config space 2 (rev >= 8) */ 87#define BCMA_CORE_PCI_PCICFG2 0x0600 /* PCI config space 2 (rev >= 8) */
88#define BCMA_CORE_PCI_PCICFG3 0x0700 /* PCI config space 3 (rev >= 8) */ 88#define BCMA_CORE_PCI_PCICFG3 0x0700 /* PCI config space 3 (rev >= 8) */
89#define BCMA_CORE_PCI_SPROM(wordoffset) (0x0800 + ((wordoffset) * 2)) /* SPROM shadow area (72 bytes) */ 89#define BCMA_CORE_PCI_SPROM(wordoffset) (0x0800 + ((wordoffset) * 2)) /* SPROM shadow area (72 bytes) */
90#define BCMA_CORE_PCI_SPROM_PI_OFFSET 0 /* first word */
91#define BCMA_CORE_PCI_SPROM_PI_MASK 0xf000 /* bit 15:12 */
92#define BCMA_CORE_PCI_SPROM_PI_SHIFT 12 /* bit 15:12 */
93#define BCMA_CORE_PCI_SPROM_MISC_CONFIG 5 /* word 5 */
94#define BCMA_CORE_PCI_SPROM_L23READY_EXIT_NOPERST 0x8000 /* bit 15 */
95#define BCMA_CORE_PCI_SPROM_CLKREQ_OFFSET_REV5 20 /* word 20 for srom rev <= 5 */
96#define BCMA_CORE_PCI_SPROM_CLKREQ_ENB 0x0800 /* bit 11 */
90 97
91/* SBtoPCIx */ 98/* SBtoPCIx */
92#define BCMA_CORE_PCI_SBTOPCI_MEM 0x00000000 99#define BCMA_CORE_PCI_SBTOPCI_MEM 0x00000000
@@ -133,6 +140,7 @@ struct pci_dev;
133#define BCMA_CORE_PCI_DLLP_LRREG 0x120 /* Link Replay */ 140#define BCMA_CORE_PCI_DLLP_LRREG 0x120 /* Link Replay */
134#define BCMA_CORE_PCI_DLLP_LACKTOREG 0x124 /* Link Ack Timeout */ 141#define BCMA_CORE_PCI_DLLP_LACKTOREG 0x124 /* Link Ack Timeout */
135#define BCMA_CORE_PCI_DLLP_PMTHRESHREG 0x128 /* Power Management Threshold */ 142#define BCMA_CORE_PCI_DLLP_PMTHRESHREG 0x128 /* Power Management Threshold */
143#define BCMA_CORE_PCI_ASPMTIMER_EXTEND 0x01000000 /* > rev7: enable extend ASPM timer */
136#define BCMA_CORE_PCI_DLLP_RTRYWPREG 0x12C /* Retry buffer write ptr */ 144#define BCMA_CORE_PCI_DLLP_RTRYWPREG 0x12C /* Retry buffer write ptr */
137#define BCMA_CORE_PCI_DLLP_RTRYRPREG 0x130 /* Retry buffer Read ptr */ 145#define BCMA_CORE_PCI_DLLP_RTRYRPREG 0x130 /* Retry buffer Read ptr */
138#define BCMA_CORE_PCI_DLLP_RTRYPPREG 0x134 /* Retry buffer Purged ptr */ 146#define BCMA_CORE_PCI_DLLP_RTRYPPREG 0x134 /* Retry buffer Purged ptr */
@@ -201,12 +209,15 @@ struct bcma_drv_pci {
201}; 209};
202 210
203/* Register access */ 211/* Register access */
212#define pcicore_read16(pc, offset) bcma_read16((pc)->core, offset)
204#define pcicore_read32(pc, offset) bcma_read32((pc)->core, offset) 213#define pcicore_read32(pc, offset) bcma_read32((pc)->core, offset)
214#define pcicore_write16(pc, offset, val) bcma_write16((pc)->core, offset, val)
205#define pcicore_write32(pc, offset, val) bcma_write32((pc)->core, offset, val) 215#define pcicore_write32(pc, offset, val) bcma_write32((pc)->core, offset, val)
206 216
207extern void __devinit bcma_core_pci_init(struct bcma_drv_pci *pc); 217extern void __devinit bcma_core_pci_init(struct bcma_drv_pci *pc);
208extern int bcma_core_pci_irq_ctl(struct bcma_drv_pci *pc, 218extern int bcma_core_pci_irq_ctl(struct bcma_drv_pci *pc,
209 struct bcma_device *core, bool enable); 219 struct bcma_device *core, bool enable);
220extern void bcma_core_pci_extend_L1timer(struct bcma_drv_pci *pc, bool extend);
210 221
211extern int bcma_core_pci_pcibios_map_irq(const struct pci_dev *dev); 222extern int bcma_core_pci_pcibios_map_irq(const struct pci_dev *dev);
212extern int bcma_core_pci_plat_dev_init(struct pci_dev *dev); 223extern int bcma_core_pci_plat_dev_init(struct pci_dev *dev);
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 2aa24664a5b5..4d4ac24a263e 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -1,9 +1,10 @@
1#ifndef _LINUX_BLKDEV_H 1#ifndef _LINUX_BLKDEV_H
2#define _LINUX_BLKDEV_H 2#define _LINUX_BLKDEV_H
3 3
4#include <linux/sched.h>
5
4#ifdef CONFIG_BLOCK 6#ifdef CONFIG_BLOCK
5 7
6#include <linux/sched.h>
7#include <linux/major.h> 8#include <linux/major.h>
8#include <linux/genhd.h> 9#include <linux/genhd.h>
9#include <linux/list.h> 10#include <linux/list.h>
diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h
index 66d3e954eb6c..1a0cd270bb7a 100644
--- a/include/linux/bootmem.h
+++ b/include/linux/bootmem.h
@@ -154,7 +154,8 @@ extern void *alloc_large_system_hash(const char *tablename,
154 int flags, 154 int flags,
155 unsigned int *_hash_shift, 155 unsigned int *_hash_shift,
156 unsigned int *_hash_mask, 156 unsigned int *_hash_mask,
157 unsigned long limit); 157 unsigned long low_limit,
158 unsigned long high_limit);
158 159
159#define HASH_EARLY 0x00000001 /* Allocating during early boot? */ 160#define HASH_EARLY 0x00000001 /* Allocating during early boot? */
160#define HASH_SMALL 0x00000002 /* sub-page allocation allowed, min 161#define HASH_SMALL 0x00000002 /* sub-page allocation allowed, min
diff --git a/include/linux/capability.h b/include/linux/capability.h
index 12d52dedb229..68d56effc328 100644
--- a/include/linux/capability.h
+++ b/include/linux/capability.h
@@ -360,8 +360,11 @@ struct cpu_vfs_cap_data {
360 360
361#define CAP_WAKE_ALARM 35 361#define CAP_WAKE_ALARM 35
362 362
363/* Allow preventing system suspends while epoll events are pending */
363 364
364#define CAP_LAST_CAP CAP_WAKE_ALARM 365#define CAP_EPOLLWAKEUP 36
366
367#define CAP_LAST_CAP CAP_EPOLLWAKEUP
365 368
366#define cap_valid(x) ((x) >= 0 && (x) <= CAP_LAST_CAP) 369#define cap_valid(x) ((x) >= 0 && (x) <= CAP_LAST_CAP)
367 370
@@ -374,6 +377,7 @@ struct cpu_vfs_cap_data {
374 377
375#ifdef __KERNEL__ 378#ifdef __KERNEL__
376 379
380struct inode;
377struct dentry; 381struct dentry;
378struct user_namespace; 382struct user_namespace;
379 383
@@ -548,6 +552,7 @@ extern bool has_ns_capability_noaudit(struct task_struct *t,
548extern bool capable(int cap); 552extern bool capable(int cap);
549extern bool ns_capable(struct user_namespace *ns, int cap); 553extern bool ns_capable(struct user_namespace *ns, int cap);
550extern bool nsown_capable(int cap); 554extern bool nsown_capable(int cap);
555extern bool inode_capable(const struct inode *inode, int cap);
551 556
552/* audit system wants to get cap info from files as well */ 557/* audit system wants to get cap info from files as well */
553extern int get_vfs_caps_from_disk(const struct dentry *dentry, struct cpu_vfs_cap_data *cpu_caps); 558extern int get_vfs_caps_from_disk(const struct dentry *dentry, struct cpu_vfs_cap_data *cpu_caps);
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index 5a85b3415c1b..d3f5fba2c159 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -16,6 +16,7 @@
16#include <linux/prio_heap.h> 16#include <linux/prio_heap.h>
17#include <linux/rwsem.h> 17#include <linux/rwsem.h>
18#include <linux/idr.h> 18#include <linux/idr.h>
19#include <linux/workqueue.h>
19 20
20#ifdef CONFIG_CGROUPS 21#ifdef CONFIG_CGROUPS
21 22
@@ -76,12 +77,16 @@ struct cgroup_subsys_state {
76 unsigned long flags; 77 unsigned long flags;
77 /* ID for this css, if possible */ 78 /* ID for this css, if possible */
78 struct css_id __rcu *id; 79 struct css_id __rcu *id;
80
81 /* Used to put @cgroup->dentry on the last css_put() */
82 struct work_struct dput_work;
79}; 83};
80 84
81/* bits in struct cgroup_subsys_state flags field */ 85/* bits in struct cgroup_subsys_state flags field */
82enum { 86enum {
83 CSS_ROOT, /* This CSS is the root of the subsystem */ 87 CSS_ROOT, /* This CSS is the root of the subsystem */
84 CSS_REMOVED, /* This CSS is dead */ 88 CSS_REMOVED, /* This CSS is dead */
89 CSS_CLEAR_CSS_REFS, /* @ss->__DEPRECATED_clear_css_refs */
85}; 90};
86 91
87/* Caller must verify that the css is not for root cgroup */ 92/* Caller must verify that the css is not for root cgroup */
@@ -115,16 +120,12 @@ static inline bool css_is_removed(struct cgroup_subsys_state *css)
115 * the css has been destroyed. 120 * the css has been destroyed.
116 */ 121 */
117 122
123extern bool __css_tryget(struct cgroup_subsys_state *css);
118static inline bool css_tryget(struct cgroup_subsys_state *css) 124static inline bool css_tryget(struct cgroup_subsys_state *css)
119{ 125{
120 if (test_bit(CSS_ROOT, &css->flags)) 126 if (test_bit(CSS_ROOT, &css->flags))
121 return true; 127 return true;
122 while (!atomic_inc_not_zero(&css->refcnt)) { 128 return __css_tryget(css);
123 if (test_bit(CSS_REMOVED, &css->flags))
124 return false;
125 cpu_relax();
126 }
127 return true;
128} 129}
129 130
130/* 131/*
@@ -132,11 +133,11 @@ static inline bool css_tryget(struct cgroup_subsys_state *css)
132 * css_get() or css_tryget() 133 * css_get() or css_tryget()
133 */ 134 */
134 135
135extern void __css_put(struct cgroup_subsys_state *css, int count); 136extern void __css_put(struct cgroup_subsys_state *css);
136static inline void css_put(struct cgroup_subsys_state *css) 137static inline void css_put(struct cgroup_subsys_state *css)
137{ 138{
138 if (!test_bit(CSS_ROOT, &css->flags)) 139 if (!test_bit(CSS_ROOT, &css->flags))
139 __css_put(css, 1); 140 __css_put(css);
140} 141}
141 142
142/* bits in struct cgroup flags field */ 143/* bits in struct cgroup flags field */
@@ -175,6 +176,7 @@ struct cgroup {
175 */ 176 */
176 struct list_head sibling; /* my parent's children */ 177 struct list_head sibling; /* my parent's children */
177 struct list_head children; /* my children */ 178 struct list_head children; /* my children */
179 struct list_head files; /* my files */
178 180
179 struct cgroup *parent; /* my parent */ 181 struct cgroup *parent; /* my parent */
180 struct dentry __rcu *dentry; /* cgroup fs entry, RCU protected */ 182 struct dentry __rcu *dentry; /* cgroup fs entry, RCU protected */
@@ -191,6 +193,9 @@ struct cgroup {
191 */ 193 */
192 struct list_head css_sets; 194 struct list_head css_sets;
193 195
196 struct list_head allcg_node; /* cgroupfs_root->allcg_list */
197 struct list_head cft_q_node; /* used during cftype add/rm */
198
194 /* 199 /*
195 * Linked list running through all cgroups that can 200 * Linked list running through all cgroups that can
196 * potentially be reaped by the release agent. Protected by 201 * potentially be reaped by the release agent. Protected by
@@ -275,11 +280,17 @@ struct cgroup_map_cb {
275 * - the 'cftype' of the file is file->f_dentry->d_fsdata 280 * - the 'cftype' of the file is file->f_dentry->d_fsdata
276 */ 281 */
277 282
278#define MAX_CFTYPE_NAME 64 283/* cftype->flags */
284#define CFTYPE_ONLY_ON_ROOT (1U << 0) /* only create on root cg */
285#define CFTYPE_NOT_ON_ROOT (1U << 1) /* don't create onp root cg */
286
287#define MAX_CFTYPE_NAME 64
288
279struct cftype { 289struct cftype {
280 /* 290 /*
281 * By convention, the name should begin with the name of the 291 * By convention, the name should begin with the name of the
282 * subsystem, followed by a period 292 * subsystem, followed by a period. Zero length string indicates
293 * end of cftype array.
283 */ 294 */
284 char name[MAX_CFTYPE_NAME]; 295 char name[MAX_CFTYPE_NAME];
285 int private; 296 int private;
@@ -295,6 +306,9 @@ struct cftype {
295 */ 306 */
296 size_t max_write_len; 307 size_t max_write_len;
297 308
309 /* CFTYPE_* flags */
310 unsigned int flags;
311
298 int (*open)(struct inode *inode, struct file *file); 312 int (*open)(struct inode *inode, struct file *file);
299 ssize_t (*read)(struct cgroup *cgrp, struct cftype *cft, 313 ssize_t (*read)(struct cgroup *cgrp, struct cftype *cft,
300 struct file *file, 314 struct file *file,
@@ -373,6 +387,16 @@ struct cftype {
373 struct eventfd_ctx *eventfd); 387 struct eventfd_ctx *eventfd);
374}; 388};
375 389
390/*
391 * cftype_sets describe cftypes belonging to a subsystem and are chained at
392 * cgroup_subsys->cftsets. Each cftset points to an array of cftypes
393 * terminated by zero length name.
394 */
395struct cftype_set {
396 struct list_head node; /* chained at subsys->cftsets */
397 const struct cftype *cfts;
398};
399
376struct cgroup_scanner { 400struct cgroup_scanner {
377 struct cgroup *cg; 401 struct cgroup *cg;
378 int (*test_task)(struct task_struct *p, struct cgroup_scanner *scan); 402 int (*test_task)(struct task_struct *p, struct cgroup_scanner *scan);
@@ -382,21 +406,8 @@ struct cgroup_scanner {
382 void *data; 406 void *data;
383}; 407};
384 408
385/* 409int cgroup_add_cftypes(struct cgroup_subsys *ss, const struct cftype *cfts);
386 * Add a new file to the given cgroup directory. Should only be 410int cgroup_rm_cftypes(struct cgroup_subsys *ss, const struct cftype *cfts);
387 * called by subsystems from within a populate() method
388 */
389int cgroup_add_file(struct cgroup *cgrp, struct cgroup_subsys *subsys,
390 const struct cftype *cft);
391
392/*
393 * Add a set of new files to the given cgroup directory. Should
394 * only be called by subsystems from within a populate() method
395 */
396int cgroup_add_files(struct cgroup *cgrp,
397 struct cgroup_subsys *subsys,
398 const struct cftype cft[],
399 int count);
400 411
401int cgroup_is_removed(const struct cgroup *cgrp); 412int cgroup_is_removed(const struct cgroup *cgrp);
402 413
@@ -461,7 +472,6 @@ struct cgroup_subsys {
461 void (*fork)(struct task_struct *task); 472 void (*fork)(struct task_struct *task);
462 void (*exit)(struct cgroup *cgrp, struct cgroup *old_cgrp, 473 void (*exit)(struct cgroup *cgrp, struct cgroup *old_cgrp,
463 struct task_struct *task); 474 struct task_struct *task);
464 int (*populate)(struct cgroup_subsys *ss, struct cgroup *cgrp);
465 void (*post_clone)(struct cgroup *cgrp); 475 void (*post_clone)(struct cgroup *cgrp);
466 void (*bind)(struct cgroup *root); 476 void (*bind)(struct cgroup *root);
467 477
@@ -474,6 +484,18 @@ struct cgroup_subsys {
474 * (not available in early_init time.) 484 * (not available in early_init time.)
475 */ 485 */
476 bool use_id; 486 bool use_id;
487
488 /*
489 * If %true, cgroup removal will try to clear css refs by retrying
490 * ss->pre_destroy() until there's no css ref left. This behavior
491 * is strictly for backward compatibility and will be removed as
492 * soon as the current user (memcg) is updated.
493 *
494 * If %false, ss->pre_destroy() can't fail and cgroup removal won't
495 * wait for css refs to drop to zero before proceeding.
496 */
497 bool __DEPRECATED_clear_css_refs;
498
477#define MAX_CGROUP_TYPE_NAMELEN 32 499#define MAX_CGROUP_TYPE_NAMELEN 32
478 const char *name; 500 const char *name;
479 501
@@ -500,6 +522,13 @@ struct cgroup_subsys {
500 struct idr idr; 522 struct idr idr;
501 spinlock_t id_lock; 523 spinlock_t id_lock;
502 524
525 /* list of cftype_sets */
526 struct list_head cftsets;
527
528 /* base cftypes, automatically [de]registered with subsys itself */
529 struct cftype *base_cftypes;
530 struct cftype_set base_cftset;
531
503 /* should be defined only by modular subsystems */ 532 /* should be defined only by modular subsystems */
504 struct module *module; 533 struct module *module;
505}; 534};
diff --git a/include/linux/clk.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/cred.h b/include/linux/cred.h
index adadf71a7327..917dc5aeb1d4 100644
--- a/include/linux/cred.h
+++ b/include/linux/cred.h
@@ -17,6 +17,7 @@
17#include <linux/key.h> 17#include <linux/key.h>
18#include <linux/selinux.h> 18#include <linux/selinux.h>
19#include <linux/atomic.h> 19#include <linux/atomic.h>
20#include <linux/uidgid.h>
20 21
21struct user_struct; 22struct user_struct;
22struct cred; 23struct cred;
@@ -26,14 +27,14 @@ struct inode;
26 * COW Supplementary groups list 27 * COW Supplementary groups list
27 */ 28 */
28#define NGROUPS_SMALL 32 29#define NGROUPS_SMALL 32
29#define NGROUPS_PER_BLOCK ((unsigned int)(PAGE_SIZE / sizeof(gid_t))) 30#define NGROUPS_PER_BLOCK ((unsigned int)(PAGE_SIZE / sizeof(kgid_t)))
30 31
31struct group_info { 32struct group_info {
32 atomic_t usage; 33 atomic_t usage;
33 int ngroups; 34 int ngroups;
34 int nblocks; 35 int nblocks;
35 gid_t small_block[NGROUPS_SMALL]; 36 kgid_t small_block[NGROUPS_SMALL];
36 gid_t *blocks[0]; 37 kgid_t *blocks[0];
37}; 38};
38 39
39/** 40/**
@@ -66,14 +67,14 @@ extern struct group_info init_groups;
66extern void groups_free(struct group_info *); 67extern void groups_free(struct group_info *);
67extern int set_current_groups(struct group_info *); 68extern int set_current_groups(struct group_info *);
68extern int set_groups(struct cred *, struct group_info *); 69extern int set_groups(struct cred *, struct group_info *);
69extern int groups_search(const struct group_info *, gid_t); 70extern int groups_search(const struct group_info *, kgid_t);
70 71
71/* access the groups "array" with this macro */ 72/* access the groups "array" with this macro */
72#define GROUP_AT(gi, i) \ 73#define GROUP_AT(gi, i) \
73 ((gi)->blocks[(i) / NGROUPS_PER_BLOCK][(i) % NGROUPS_PER_BLOCK]) 74 ((gi)->blocks[(i) / NGROUPS_PER_BLOCK][(i) % NGROUPS_PER_BLOCK])
74 75
75extern int in_group_p(gid_t); 76extern int in_group_p(kgid_t);
76extern int in_egroup_p(gid_t); 77extern int in_egroup_p(kgid_t);
77 78
78/* 79/*
79 * The common credentials for a thread group 80 * The common credentials for a thread group
@@ -122,14 +123,14 @@ struct cred {
122#define CRED_MAGIC 0x43736564 123#define CRED_MAGIC 0x43736564
123#define CRED_MAGIC_DEAD 0x44656144 124#define CRED_MAGIC_DEAD 0x44656144
124#endif 125#endif
125 uid_t uid; /* real UID of the task */ 126 kuid_t uid; /* real UID of the task */
126 gid_t gid; /* real GID of the task */ 127 kgid_t gid; /* real GID of the task */
127 uid_t suid; /* saved UID of the task */ 128 kuid_t suid; /* saved UID of the task */
128 gid_t sgid; /* saved GID of the task */ 129 kgid_t sgid; /* saved GID of the task */
129 uid_t euid; /* effective UID of the task */ 130 kuid_t euid; /* effective UID of the task */
130 gid_t egid; /* effective GID of the task */ 131 kgid_t egid; /* effective GID of the task */
131 uid_t fsuid; /* UID for VFS ops */ 132 kuid_t fsuid; /* UID for VFS ops */
132 gid_t fsgid; /* GID for VFS ops */ 133 kgid_t fsgid; /* GID for VFS ops */
133 unsigned securebits; /* SUID-less security management */ 134 unsigned securebits; /* SUID-less security management */
134 kernel_cap_t cap_inheritable; /* caps our children can inherit */ 135 kernel_cap_t cap_inheritable; /* caps our children can inherit */
135 kernel_cap_t cap_permitted; /* caps we're permitted */ 136 kernel_cap_t cap_permitted; /* caps we're permitted */
@@ -146,7 +147,7 @@ struct cred {
146 void *security; /* subjective LSM security */ 147 void *security; /* subjective LSM security */
147#endif 148#endif
148 struct user_struct *user; /* real user ID subscription */ 149 struct user_struct *user; /* real user ID subscription */
149 struct user_namespace *user_ns; /* cached user->user_ns */ 150 struct user_namespace *user_ns; /* user_ns the caps and keyrings are relative to. */
150 struct group_info *group_info; /* supplementary groups for euid/fsgid */ 151 struct group_info *group_info; /* supplementary groups for euid/fsgid */
151 struct rcu_head rcu; /* RCU deletion hook */ 152 struct rcu_head rcu; /* RCU deletion hook */
152}; 153};
@@ -357,11 +358,11 @@ static inline void put_cred(const struct cred *_cred)
357#define current_user() (current_cred_xxx(user)) 358#define current_user() (current_cred_xxx(user))
358#define current_security() (current_cred_xxx(security)) 359#define current_security() (current_cred_xxx(security))
359 360
361extern struct user_namespace init_user_ns;
360#ifdef CONFIG_USER_NS 362#ifdef CONFIG_USER_NS
361#define current_user_ns() (current_cred_xxx(user_ns)) 363#define current_user_ns() (current_cred_xxx(user_ns))
362#define task_user_ns(task) (task_cred_xxx((task), user_ns)) 364#define task_user_ns(task) (task_cred_xxx((task), user_ns))
363#else 365#else
364extern struct user_namespace init_user_ns;
365#define current_user_ns() (&init_user_ns) 366#define current_user_ns() (&init_user_ns)
366#define task_user_ns(task) (&init_user_ns) 367#define task_user_ns(task) (&init_user_ns)
367#endif 368#endif
diff --git a/include/linux/cs5535.h b/include/linux/cs5535.h
index c077aec3a6ff..cfe83239d7f0 100644
--- a/include/linux/cs5535.h
+++ b/include/linux/cs5535.h
@@ -95,6 +95,7 @@ static inline int cs5535_pic_unreqz_select_high(unsigned int group,
95 95
96/* CS5536_PM1_STS bits */ 96/* CS5536_PM1_STS bits */
97#define CS5536_WAK_FLAG (1 << 15) 97#define CS5536_WAK_FLAG (1 << 15)
98#define CS5536_RTC_FLAG (1 << 10)
98#define CS5536_PWRBTN_FLAG (1 << 8) 99#define CS5536_PWRBTN_FLAG (1 << 8)
99 100
100/* CS5536_PM1_EN bits */ 101/* CS5536_PM1_EN bits */
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index 7e11f1418203..094789ff3e9f 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -25,6 +25,13 @@ struct vfsmount;
25 25
26#define IS_ROOT(x) ((x) == (x)->d_parent) 26#define IS_ROOT(x) ((x) == (x)->d_parent)
27 27
28/* The hash is always the low bits of hash_len */
29#ifdef __LITTLE_ENDIAN
30 #define HASH_LEN_DECLARE u32 hash; u32 len;
31#else
32 #define HASH_LEN_DECLARE u32 len; u32 hash;
33#endif
34
28/* 35/*
29 * "quick string" -- eases parameter passing, but more importantly 36 * "quick string" -- eases parameter passing, but more importantly
30 * saves "metadata" about the string (ie length and the hash). 37 * saves "metadata" about the string (ie length and the hash).
@@ -33,11 +40,19 @@ struct vfsmount;
33 * dentry. 40 * dentry.
34 */ 41 */
35struct qstr { 42struct qstr {
36 unsigned int hash; 43 union {
37 unsigned int len; 44 struct {
45 HASH_LEN_DECLARE;
46 };
47 u64 hash_len;
48 };
38 const unsigned char *name; 49 const unsigned char *name;
39}; 50};
40 51
52#define QSTR_INIT(n,l) { { { .len = l } }, .name = n }
53#define hashlen_hash(hashlen) ((u32) (hashlen))
54#define hashlen_len(hashlen) ((u32)((hashlen) >> 32))
55
41struct dentry_stat_t { 56struct dentry_stat_t {
42 int nr_dentry; 57 int nr_dentry;
43 int nr_unused; 58 int nr_unused;
@@ -282,7 +297,7 @@ extern struct dentry *d_hash_and_lookup(struct dentry *, struct qstr *);
282extern struct dentry *__d_lookup(struct dentry *, struct qstr *); 297extern struct dentry *__d_lookup(struct dentry *, struct qstr *);
283extern struct dentry *__d_lookup_rcu(const struct dentry *parent, 298extern struct dentry *__d_lookup_rcu(const struct dentry *parent,
284 const struct qstr *name, 299 const struct qstr *name,
285 unsigned *seq, struct inode **inode); 300 unsigned *seq, struct inode *inode);
286 301
287/** 302/**
288 * __d_rcu_to_refcount - take a refcount on dentry if sequence check is ok 303 * __d_rcu_to_refcount - take a refcount on dentry if sequence check is ok
diff --git a/include/linux/dcbnl.h b/include/linux/dcbnl.h
index 65a2562f66b4..6bb43382f3f3 100644
--- a/include/linux/dcbnl.h
+++ b/include/linux/dcbnl.h
@@ -67,6 +67,17 @@ struct ieee_ets {
67 __u8 reco_prio_tc[IEEE_8021QAZ_MAX_TCS]; 67 __u8 reco_prio_tc[IEEE_8021QAZ_MAX_TCS];
68}; 68};
69 69
70/* This structure contains rate limit extension to the IEEE 802.1Qaz ETS
71 * managed object.
72 * Values are 64 bits long and specified in Kbps to enable usage over both
73 * slow and very fast networks.
74 *
75 * @tc_maxrate: maximal tc tx bandwidth indexed by traffic class
76 */
77struct ieee_maxrate {
78 __u64 tc_maxrate[IEEE_8021QAZ_MAX_TCS];
79};
80
70/* This structure contains the IEEE 802.1Qaz PFC managed object 81/* This structure contains the IEEE 802.1Qaz PFC managed object
71 * 82 *
72 * @pfc_cap: Indicates the number of traffic classes on the local device 83 * @pfc_cap: Indicates the number of traffic classes on the local device
@@ -321,6 +332,7 @@ enum ieee_attrs {
321 DCB_ATTR_IEEE_PEER_ETS, 332 DCB_ATTR_IEEE_PEER_ETS,
322 DCB_ATTR_IEEE_PEER_PFC, 333 DCB_ATTR_IEEE_PEER_PFC,
323 DCB_ATTR_IEEE_PEER_APP, 334 DCB_ATTR_IEEE_PEER_APP,
335 DCB_ATTR_IEEE_MAXRATE,
324 __DCB_ATTR_IEEE_MAX 336 __DCB_ATTR_IEEE_MAX
325}; 337};
326#define DCB_ATTR_IEEE_MAX (__DCB_ATTR_IEEE_MAX - 1) 338#define DCB_ATTR_IEEE_MAX (__DCB_ATTR_IEEE_MAX - 1)
diff --git a/include/linux/dccp.h b/include/linux/dccp.h
index eaf95a023af4..d16294e2a118 100644
--- a/include/linux/dccp.h
+++ b/include/linux/dccp.h
@@ -549,6 +549,8 @@ static inline const char *dccp_role(const struct sock *sk)
549 return NULL; 549 return NULL;
550} 550}
551 551
552extern void dccp_syn_ack_timeout(struct sock *sk, struct request_sock *req);
553
552#endif /* __KERNEL__ */ 554#endif /* __KERNEL__ */
553 555
554#endif /* _LINUX_DCCP_H */ 556#endif /* _LINUX_DCCP_H */
diff --git a/include/linux/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/dvb/frontend.h b/include/linux/dvb/frontend.h
index cb4428ab81ed..f50d4058c5fb 100644
--- a/include/linux/dvb/frontend.h
+++ b/include/linux/dvb/frontend.h
@@ -320,7 +320,24 @@ struct dvb_frontend_event {
320 320
321#define DTV_ENUM_DELSYS 44 321#define DTV_ENUM_DELSYS 44
322 322
323#define DTV_MAX_COMMAND DTV_ENUM_DELSYS 323/* ATSC-MH */
324#define DTV_ATSCMH_FIC_VER 45
325#define DTV_ATSCMH_PARADE_ID 46
326#define DTV_ATSCMH_NOG 47
327#define DTV_ATSCMH_TNOG 48
328#define DTV_ATSCMH_SGN 49
329#define DTV_ATSCMH_PRC 50
330#define DTV_ATSCMH_RS_FRAME_MODE 51
331#define DTV_ATSCMH_RS_FRAME_ENSEMBLE 52
332#define DTV_ATSCMH_RS_CODE_MODE_PRI 53
333#define DTV_ATSCMH_RS_CODE_MODE_SEC 54
334#define DTV_ATSCMH_SCCC_BLOCK_MODE 55
335#define DTV_ATSCMH_SCCC_CODE_MODE_A 56
336#define DTV_ATSCMH_SCCC_CODE_MODE_B 57
337#define DTV_ATSCMH_SCCC_CODE_MODE_C 58
338#define DTV_ATSCMH_SCCC_CODE_MODE_D 59
339
340#define DTV_MAX_COMMAND DTV_ATSCMH_SCCC_CODE_MODE_D
324 341
325typedef enum fe_pilot { 342typedef enum fe_pilot {
326 PILOT_ON, 343 PILOT_ON,
@@ -360,6 +377,38 @@ typedef enum fe_delivery_system {
360 377
361#define SYS_DVBC_ANNEX_AC SYS_DVBC_ANNEX_A 378#define SYS_DVBC_ANNEX_AC SYS_DVBC_ANNEX_A
362 379
380/* ATSC-MH */
381
382enum atscmh_sccc_block_mode {
383 ATSCMH_SCCC_BLK_SEP = 0,
384 ATSCMH_SCCC_BLK_COMB = 1,
385 ATSCMH_SCCC_BLK_RES = 2,
386};
387
388enum atscmh_sccc_code_mode {
389 ATSCMH_SCCC_CODE_HLF = 0,
390 ATSCMH_SCCC_CODE_QTR = 1,
391 ATSCMH_SCCC_CODE_RES = 2,
392};
393
394enum atscmh_rs_frame_ensemble {
395 ATSCMH_RSFRAME_ENS_PRI = 0,
396 ATSCMH_RSFRAME_ENS_SEC = 1,
397};
398
399enum atscmh_rs_frame_mode {
400 ATSCMH_RSFRAME_PRI_ONLY = 0,
401 ATSCMH_RSFRAME_PRI_SEC = 1,
402 ATSCMH_RSFRAME_RES = 2,
403};
404
405enum atscmh_rs_code_mode {
406 ATSCMH_RSCODE_211_187 = 0,
407 ATSCMH_RSCODE_223_187 = 1,
408 ATSCMH_RSCODE_235_187 = 2,
409 ATSCMH_RSCODE_RES = 3,
410};
411
363 412
364struct dtv_cmds_h { 413struct dtv_cmds_h {
365 char *name; /* A display name for debugging purposes */ 414 char *name; /* A display name for debugging purposes */
diff --git a/include/linux/dvb/version.h b/include/linux/dvb/version.h
index 0559e2bd38f9..43d9e8d462d4 100644
--- a/include/linux/dvb/version.h
+++ b/include/linux/dvb/version.h
@@ -24,6 +24,6 @@
24#define _DVBVERSION_H_ 24#define _DVBVERSION_H_
25 25
26#define DVB_API_VERSION 5 26#define DVB_API_VERSION 5
27#define DVB_API_VERSION_MINOR 5 27#define DVB_API_VERSION_MINOR 6
28 28
29#endif /*_DVBVERSION_H_*/ 29#endif /*_DVBVERSION_H_*/
diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h
index 7e3c53a900d8..c18257b0fa72 100644
--- a/include/linux/dynamic_debug.h
+++ b/include/linux/dynamic_debug.h
@@ -17,8 +17,8 @@ struct _ddebug {
17 const char *format; 17 const char *format;
18 unsigned int lineno:18; 18 unsigned int lineno:18;
19 /* 19 /*
20 * The flags field controls the behaviour at the callsite. 20 * The flags field controls the behaviour at the callsite.
21 * The bits here are changed dynamically when the user 21 * The bits here are changed dynamically when the user
22 * writes commands to <debugfs>/dynamic_debug/control 22 * writes commands to <debugfs>/dynamic_debug/control
23 */ 23 */
24#define _DPRINTK_FLAGS_NONE 0 24#define _DPRINTK_FLAGS_NONE 0
@@ -44,6 +44,9 @@ extern int ddebug_remove_module(const char *mod_name);
44extern __printf(2, 3) 44extern __printf(2, 3)
45int __dynamic_pr_debug(struct _ddebug *descriptor, const char *fmt, ...); 45int __dynamic_pr_debug(struct _ddebug *descriptor, const char *fmt, ...);
46 46
47extern int ddebug_dyndbg_module_param_cb(char *param, char *val,
48 const char *modname);
49
47struct device; 50struct device;
48 51
49extern __printf(3, 4) 52extern __printf(3, 4)
@@ -94,11 +97,26 @@ do { \
94 97
95#else 98#else
96 99
100#include <linux/string.h>
101#include <linux/errno.h>
102
97static inline int ddebug_remove_module(const char *mod) 103static inline int ddebug_remove_module(const char *mod)
98{ 104{
99 return 0; 105 return 0;
100} 106}
101 107
108static inline int ddebug_dyndbg_module_param_cb(char *param, char *val,
109 const char *modname)
110{
111 if (strstr(param, "dyndbg")) {
112 /* avoid pr_warn(), which wants pr_fmt() fully defined */
113 printk(KERN_WARNING "dyndbg param is supported only in "
114 "CONFIG_DYNAMIC_DEBUG builds\n");
115 return 0; /* allow and ignore */
116 }
117 return -EINVAL;
118}
119
102#define dynamic_pr_debug(fmt, ...) \ 120#define dynamic_pr_debug(fmt, ...) \
103 do { if (0) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); } while (0) 121 do { if (0) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); } while (0)
104#define dynamic_dev_dbg(dev, fmt, ...) \ 122#define dynamic_dev_dbg(dev, fmt, ...) \
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h
index 8a1835855faa..3d406e0ede6d 100644
--- a/include/linux/etherdevice.h
+++ b/include/linux/etherdevice.h
@@ -18,8 +18,6 @@
18 * as published by the Free Software Foundation; either version 18 * as published by the Free Software Foundation; either version
19 * 2 of the License, or (at your option) any later version. 19 * 2 of the License, or (at your option) any later version.
20 * 20 *
21 * WARNING: This move may well be temporary. This file will get merged with others RSN.
22 *
23 */ 21 */
24#ifndef _LINUX_ETHERDEVICE_H 22#ifndef _LINUX_ETHERDEVICE_H
25#define _LINUX_ETHERDEVICE_H 23#define _LINUX_ETHERDEVICE_H
@@ -59,7 +57,7 @@ extern struct net_device *alloc_etherdev_mqs(int sizeof_priv, unsigned int txqs,
59 * 57 *
60 * Return true if the address is all zeroes. 58 * Return true if the address is all zeroes.
61 */ 59 */
62static inline int is_zero_ether_addr(const u8 *addr) 60static inline bool is_zero_ether_addr(const u8 *addr)
63{ 61{
64 return !(addr[0] | addr[1] | addr[2] | addr[3] | addr[4] | addr[5]); 62 return !(addr[0] | addr[1] | addr[2] | addr[3] | addr[4] | addr[5]);
65} 63}
@@ -71,7 +69,7 @@ static inline int is_zero_ether_addr(const u8 *addr)
71 * Return true if the address is a multicast address. 69 * Return true if the address is a multicast address.
72 * By definition the broadcast address is also a multicast address. 70 * By definition the broadcast address is also a multicast address.
73 */ 71 */
74static inline int is_multicast_ether_addr(const u8 *addr) 72static inline bool is_multicast_ether_addr(const u8 *addr)
75{ 73{
76 return 0x01 & addr[0]; 74 return 0x01 & addr[0];
77} 75}
@@ -82,7 +80,7 @@ static inline int is_multicast_ether_addr(const u8 *addr)
82 * 80 *
83 * Return true if the address is a local address. 81 * Return true if the address is a local address.
84 */ 82 */
85static inline int is_local_ether_addr(const u8 *addr) 83static inline bool is_local_ether_addr(const u8 *addr)
86{ 84{
87 return 0x02 & addr[0]; 85 return 0x02 & addr[0];
88} 86}
@@ -93,7 +91,7 @@ static inline int is_local_ether_addr(const u8 *addr)
93 * 91 *
94 * Return true if the address is the broadcast address. 92 * Return true if the address is the broadcast address.
95 */ 93 */
96static inline int is_broadcast_ether_addr(const u8 *addr) 94static inline bool is_broadcast_ether_addr(const u8 *addr)
97{ 95{
98 return (addr[0] & addr[1] & addr[2] & addr[3] & addr[4] & addr[5]) == 0xff; 96 return (addr[0] & addr[1] & addr[2] & addr[3] & addr[4] & addr[5]) == 0xff;
99} 97}
@@ -104,7 +102,7 @@ static inline int is_broadcast_ether_addr(const u8 *addr)
104 * 102 *
105 * Return true if the address is a unicast address. 103 * Return true if the address is a unicast address.
106 */ 104 */
107static inline int is_unicast_ether_addr(const u8 *addr) 105static inline bool is_unicast_ether_addr(const u8 *addr)
108{ 106{
109 return !is_multicast_ether_addr(addr); 107 return !is_multicast_ether_addr(addr);
110} 108}
@@ -118,7 +116,7 @@ static inline int is_unicast_ether_addr(const u8 *addr)
118 * 116 *
119 * Return true if the address is valid. 117 * Return true if the address is valid.
120 */ 118 */
121static inline int is_valid_ether_addr(const u8 *addr) 119static inline bool is_valid_ether_addr(const u8 *addr)
122{ 120{
123 /* FF:FF:FF:FF:FF:FF is a multicast address so we don't need to 121 /* FF:FF:FF:FF:FF:FF is a multicast address so we don't need to
124 * explicitly check for it here. */ 122 * explicitly check for it here. */
@@ -159,7 +157,8 @@ static inline void eth_hw_addr_random(struct net_device *dev)
159 * @addr1: Pointer to a six-byte array containing the Ethernet address 157 * @addr1: Pointer to a six-byte array containing the Ethernet address
160 * @addr2: Pointer other six-byte array containing the Ethernet address 158 * @addr2: Pointer other six-byte array containing the Ethernet address
161 * 159 *
162 * Compare two ethernet addresses, returns 0 if equal 160 * Compare two Ethernet addresses, returns 0 if equal, non-zero otherwise.
161 * Unlike memcmp(), it doesn't return a value suitable for sorting.
163 */ 162 */
164static inline unsigned compare_ether_addr(const u8 *addr1, const u8 *addr2) 163static inline unsigned compare_ether_addr(const u8 *addr1, const u8 *addr2)
165{ 164{
@@ -170,6 +169,18 @@ static inline unsigned compare_ether_addr(const u8 *addr1, const u8 *addr2)
170 return ((a[0] ^ b[0]) | (a[1] ^ b[1]) | (a[2] ^ b[2])) != 0; 169 return ((a[0] ^ b[0]) | (a[1] ^ b[1]) | (a[2] ^ b[2])) != 0;
171} 170}
172 171
172/**
173 * ether_addr_equal - Compare two Ethernet addresses
174 * @addr1: Pointer to a six-byte array containing the Ethernet address
175 * @addr2: Pointer other six-byte array containing the Ethernet address
176 *
177 * Compare two Ethernet addresses, returns true if equal
178 */
179static inline bool ether_addr_equal(const u8 *addr1, const u8 *addr2)
180{
181 return !compare_ether_addr(addr1, addr2);
182}
183
173static inline unsigned long zap_last_2bytes(unsigned long value) 184static inline unsigned long zap_last_2bytes(unsigned long value)
174{ 185{
175#ifdef __BIG_ENDIAN 186#ifdef __BIG_ENDIAN
@@ -180,34 +191,34 @@ static inline unsigned long zap_last_2bytes(unsigned long value)
180} 191}
181 192
182/** 193/**
183 * compare_ether_addr_64bits - Compare two Ethernet addresses 194 * ether_addr_equal_64bits - Compare two Ethernet addresses
184 * @addr1: Pointer to an array of 8 bytes 195 * @addr1: Pointer to an array of 8 bytes
185 * @addr2: Pointer to an other array of 8 bytes 196 * @addr2: Pointer to an other array of 8 bytes
186 * 197 *
187 * Compare two ethernet addresses, returns 0 if equal. 198 * Compare two Ethernet addresses, returns true if equal, false otherwise.
188 * Same result than "memcmp(addr1, addr2, ETH_ALEN)" but without conditional 199 *
189 * branches, and possibly long word memory accesses on CPU allowing cheap 200 * The function doesn't need any conditional branches and possibly uses
190 * unaligned memory reads. 201 * word memory accesses on CPU allowing cheap unaligned memory reads.
191 * arrays = { byte1, byte2, byte3, byte4, byte6, byte7, pad1, pad2} 202 * arrays = { byte1, byte2, byte3, byte4, byte5, byte6, pad1, pad2 }
192 * 203 *
193 * Please note that alignment of addr1 & addr2 is only guaranted to be 16 bits. 204 * Please note that alignment of addr1 & addr2 are only guaranteed to be 16 bits.
194 */ 205 */
195 206
196static inline unsigned compare_ether_addr_64bits(const u8 addr1[6+2], 207static inline bool ether_addr_equal_64bits(const u8 addr1[6+2],
197 const u8 addr2[6+2]) 208 const u8 addr2[6+2])
198{ 209{
199#ifdef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS 210#ifdef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
200 unsigned long fold = ((*(unsigned long *)addr1) ^ 211 unsigned long fold = ((*(unsigned long *)addr1) ^
201 (*(unsigned long *)addr2)); 212 (*(unsigned long *)addr2));
202 213
203 if (sizeof(fold) == 8) 214 if (sizeof(fold) == 8)
204 return zap_last_2bytes(fold) != 0; 215 return zap_last_2bytes(fold) == 0;
205 216
206 fold |= zap_last_2bytes((*(unsigned long *)(addr1 + 4)) ^ 217 fold |= zap_last_2bytes((*(unsigned long *)(addr1 + 4)) ^
207 (*(unsigned long *)(addr2 + 4))); 218 (*(unsigned long *)(addr2 + 4)));
208 return fold != 0; 219 return fold == 0;
209#else 220#else
210 return compare_ether_addr(addr1, addr2); 221 return ether_addr_equal(addr1, addr2);
211#endif 222#endif
212} 223}
213 224
@@ -219,23 +230,23 @@ static inline unsigned compare_ether_addr_64bits(const u8 addr1[6+2],
219 * Compare passed address with all addresses of the device. Return true if the 230 * Compare passed address with all addresses of the device. Return true if the
220 * address if one of the device addresses. 231 * address if one of the device addresses.
221 * 232 *
222 * Note that this function calls compare_ether_addr_64bits() so take care of 233 * Note that this function calls ether_addr_equal_64bits() so take care of
223 * the right padding. 234 * the right padding.
224 */ 235 */
225static inline bool is_etherdev_addr(const struct net_device *dev, 236static inline bool is_etherdev_addr(const struct net_device *dev,
226 const u8 addr[6 + 2]) 237 const u8 addr[6 + 2])
227{ 238{
228 struct netdev_hw_addr *ha; 239 struct netdev_hw_addr *ha;
229 int res = 1; 240 bool res = false;
230 241
231 rcu_read_lock(); 242 rcu_read_lock();
232 for_each_dev_addr(dev, ha) { 243 for_each_dev_addr(dev, ha) {
233 res = compare_ether_addr_64bits(addr, ha->addr); 244 res = ether_addr_equal_64bits(addr, ha->addr);
234 if (!res) 245 if (res)
235 break; 246 break;
236 } 247 }
237 rcu_read_unlock(); 248 rcu_read_unlock();
238 return !res; 249 return res;
239} 250}
240#endif /* __KERNEL__ */ 251#endif /* __KERNEL__ */
241 252
@@ -244,7 +255,7 @@ static inline bool is_etherdev_addr(const struct net_device *dev,
244 * @a: Pointer to Ethernet header 255 * @a: Pointer to Ethernet header
245 * @b: Pointer to Ethernet header 256 * @b: Pointer to Ethernet header
246 * 257 *
247 * Compare two ethernet headers, returns 0 if equal. 258 * Compare two Ethernet headers, returns 0 if equal.
248 * This assumes that the network header (i.e., IP header) is 4-byte 259 * This assumes that the network header (i.e., IP header) is 4-byte
249 * aligned OR the platform can handle unaligned access. This is the 260 * aligned OR the platform can handle unaligned access. This is the
250 * case for all packets coming into netif_receive_skb or similar 261 * case for all packets coming into netif_receive_skb or similar
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index f5647b59a90e..e17fa7140588 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -137,6 +137,23 @@ struct ethtool_eeprom {
137}; 137};
138 138
139/** 139/**
140 * struct ethtool_modinfo - plugin module eeprom information
141 * @cmd: %ETHTOOL_GMODULEINFO
142 * @type: Standard the module information conforms to %ETH_MODULE_SFF_xxxx
143 * @eeprom_len: Length of the eeprom
144 *
145 * This structure is used to return the information to
146 * properly size memory for a subsequent call to %ETHTOOL_GMODULEEEPROM.
147 * The type code indicates the eeprom data format
148 */
149struct ethtool_modinfo {
150 __u32 cmd;
151 __u32 type;
152 __u32 eeprom_len;
153 __u32 reserved[8];
154};
155
156/**
140 * struct ethtool_coalesce - coalescing parameters for IRQs and stats updates 157 * struct ethtool_coalesce - coalescing parameters for IRQs and stats updates
141 * @cmd: ETHTOOL_{G,S}COALESCE 158 * @cmd: ETHTOOL_{G,S}COALESCE
142 * @rx_coalesce_usecs: How many usecs to delay an RX interrupt after 159 * @rx_coalesce_usecs: How many usecs to delay an RX interrupt after
@@ -661,12 +678,17 @@ struct ethtool_flash {
661 * %ETHTOOL_SET_DUMP 678 * %ETHTOOL_SET_DUMP
662 * @version: FW version of the dump, filled in by driver 679 * @version: FW version of the dump, filled in by driver
663 * @flag: driver dependent flag for dump setting, filled in by driver during 680 * @flag: driver dependent flag for dump setting, filled in by driver during
664 * get and filled in by ethtool for set operation 681 * get and filled in by ethtool for set operation.
682 * flag must be initialized by macro ETH_FW_DUMP_DISABLE value when
683 * firmware dump is disabled.
665 * @len: length of dump data, used as the length of the user buffer on entry to 684 * @len: length of dump data, used as the length of the user buffer on entry to
666 * %ETHTOOL_GET_DUMP_DATA and this is returned as dump length by driver 685 * %ETHTOOL_GET_DUMP_DATA and this is returned as dump length by driver
667 * for %ETHTOOL_GET_DUMP_FLAG command 686 * for %ETHTOOL_GET_DUMP_FLAG command
668 * @data: data collected for get dump data operation 687 * @data: data collected for get dump data operation
669 */ 688 */
689
690#define ETH_FW_DUMP_DISABLE 0
691
670struct ethtool_dump { 692struct ethtool_dump {
671 __u32 cmd; 693 __u32 cmd;
672 __u32 version; 694 __u32 version;
@@ -726,6 +748,29 @@ struct ethtool_sfeatures {
726 struct ethtool_set_features_block features[0]; 748 struct ethtool_set_features_block features[0];
727}; 749};
728 750
751/**
752 * struct ethtool_ts_info - holds a device's timestamping and PHC association
753 * @cmd: command number = %ETHTOOL_GET_TS_INFO
754 * @so_timestamping: bit mask of the sum of the supported SO_TIMESTAMPING flags
755 * @phc_index: device index of the associated PHC, or -1 if there is none
756 * @tx_types: bit mask of the supported hwtstamp_tx_types enumeration values
757 * @rx_filters: bit mask of the supported hwtstamp_rx_filters enumeration values
758 *
759 * The bits in the 'tx_types' and 'rx_filters' fields correspond to
760 * the 'hwtstamp_tx_types' and 'hwtstamp_rx_filters' enumeration values,
761 * respectively. For example, if the device supports HWTSTAMP_TX_ON,
762 * then (1 << HWTSTAMP_TX_ON) in 'tx_types' will be set.
763 */
764struct ethtool_ts_info {
765 __u32 cmd;
766 __u32 so_timestamping;
767 __s32 phc_index;
768 __u32 tx_types;
769 __u32 tx_reserved[3];
770 __u32 rx_filters;
771 __u32 rx_reserved[3];
772};
773
729/* 774/*
730 * %ETHTOOL_SFEATURES changes features present in features[].valid to the 775 * %ETHTOOL_SFEATURES changes features present in features[].valid to the
731 * values of corresponding bits in features[].requested. Bits in .requested 776 * values of corresponding bits in features[].requested. Bits in .requested
@@ -788,6 +833,7 @@ struct net_device;
788 833
789/* Some generic methods drivers may use in their ethtool_ops */ 834/* Some generic methods drivers may use in their ethtool_ops */
790u32 ethtool_op_get_link(struct net_device *dev); 835u32 ethtool_op_get_link(struct net_device *dev);
836int ethtool_op_get_ts_info(struct net_device *dev, struct ethtool_ts_info *eti);
791 837
792/** 838/**
793 * ethtool_rxfh_indir_default - get default value for RX flow hash indirection 839 * ethtool_rxfh_indir_default - get default value for RX flow hash indirection
@@ -893,6 +939,12 @@ static inline u32 ethtool_rxfh_indir_default(u32 index, u32 n_rx_rings)
893 * and flag of the device. 939 * and flag of the device.
894 * @get_dump_data: Get dump data. 940 * @get_dump_data: Get dump data.
895 * @set_dump: Set dump specific flags to the device. 941 * @set_dump: Set dump specific flags to the device.
942 * @get_ts_info: Get the time stamping and PTP hardware clock capabilities.
943 * Drivers supporting transmit time stamps in software should set this to
944 * ethtool_op_get_ts_info().
945 * @get_module_info: Get the size and type of the eeprom contained within
946 * a plug-in module.
947 * @get_module_eeprom: Get the eeprom information from the plug-in module
896 * 948 *
897 * All operations are optional (i.e. the function pointer may be set 949 * All operations are optional (i.e. the function pointer may be set
898 * to %NULL) and callers must take this into account. Callers must 950 * to %NULL) and callers must take this into account. Callers must
@@ -954,6 +1006,12 @@ struct ethtool_ops {
954 int (*get_dump_data)(struct net_device *, 1006 int (*get_dump_data)(struct net_device *,
955 struct ethtool_dump *, void *); 1007 struct ethtool_dump *, void *);
956 int (*set_dump)(struct net_device *, struct ethtool_dump *); 1008 int (*set_dump)(struct net_device *, struct ethtool_dump *);
1009 int (*get_ts_info)(struct net_device *, struct ethtool_ts_info *);
1010 int (*get_module_info)(struct net_device *,
1011 struct ethtool_modinfo *);
1012 int (*get_module_eeprom)(struct net_device *,
1013 struct ethtool_eeprom *, u8 *);
1014
957 1015
958}; 1016};
959#endif /* __KERNEL__ */ 1017#endif /* __KERNEL__ */
@@ -1028,6 +1086,9 @@ struct ethtool_ops {
1028#define ETHTOOL_SET_DUMP 0x0000003e /* Set dump settings */ 1086#define ETHTOOL_SET_DUMP 0x0000003e /* Set dump settings */
1029#define ETHTOOL_GET_DUMP_FLAG 0x0000003f /* Get dump settings */ 1087#define ETHTOOL_GET_DUMP_FLAG 0x0000003f /* Get dump settings */
1030#define ETHTOOL_GET_DUMP_DATA 0x00000040 /* Get dump data */ 1088#define ETHTOOL_GET_DUMP_DATA 0x00000040 /* Get dump data */
1089#define ETHTOOL_GET_TS_INFO 0x00000041 /* Get time stamping and PHC info */
1090#define ETHTOOL_GMODULEINFO 0x00000042 /* Get plug-in module information */
1091#define ETHTOOL_GMODULEEEPROM 0x00000043 /* Get plug-in module eeprom */
1031 1092
1032/* compatibility with older code */ 1093/* compatibility with older code */
1033#define SPARC_ETH_GSET ETHTOOL_GSET 1094#define SPARC_ETH_GSET ETHTOOL_GSET
@@ -1177,6 +1238,12 @@ struct ethtool_ops {
1177#define RX_CLS_LOC_FIRST 0xfffffffe 1238#define RX_CLS_LOC_FIRST 0xfffffffe
1178#define RX_CLS_LOC_LAST 0xfffffffd 1239#define RX_CLS_LOC_LAST 0xfffffffd
1179 1240
1241/* EEPROM Standards for plug in modules */
1242#define ETH_MODULE_SFF_8079 0x1
1243#define ETH_MODULE_SFF_8079_LEN 256
1244#define ETH_MODULE_SFF_8472 0x2
1245#define ETH_MODULE_SFF_8472_LEN 512
1246
1180/* Reset flags */ 1247/* Reset flags */
1181/* The reset() operation must clear the flags for the components which 1248/* The reset() operation must clear the flags for the components which
1182 * were actually reset. On successful return, the flags indicate the 1249 * were actually reset. On successful return, the flags indicate the
diff --git a/include/linux/eventpoll.h b/include/linux/eventpoll.h
index 657ab55beda0..6f8be328770a 100644
--- a/include/linux/eventpoll.h
+++ b/include/linux/eventpoll.h
@@ -26,6 +26,18 @@
26#define EPOLL_CTL_DEL 2 26#define EPOLL_CTL_DEL 2
27#define EPOLL_CTL_MOD 3 27#define EPOLL_CTL_MOD 3
28 28
29/*
30 * Request the handling of system wakeup events so as to prevent system suspends
31 * from happening while those events are being processed.
32 *
33 * Assuming neither EPOLLET nor EPOLLONESHOT is set, system suspends will not be
34 * re-allowed until epoll_wait is called again after consuming the wakeup
35 * event(s).
36 *
37 * Requires CAP_EPOLLWAKEUP
38 */
39#define EPOLLWAKEUP (1 << 29)
40
29/* Set the One Shot behaviour for the target file descriptor */ 41/* Set the One Shot behaviour for the target file descriptor */
30#define EPOLLONESHOT (1 << 30) 42#define EPOLLONESHOT (1 << 30)
31 43
diff --git a/include/linux/extcon.h b/include/linux/extcon.h
new file mode 100644
index 000000000000..cdd401477656
--- /dev/null
+++ b/include/linux/extcon.h
@@ -0,0 +1,324 @@
1/*
2 * External connector (extcon) class driver
3 *
4 * Copyright (C) 2012 Samsung Electronics
5 * Author: Donggeun Kim <dg77.kim@samsung.com>
6 * Author: MyungJoo Ham <myungjoo.ham@samsung.com>
7 *
8 * based on switch class driver
9 * Copyright (C) 2008 Google, Inc.
10 * Author: Mike Lockwood <lockwood@android.com>
11 *
12 * This software is licensed under the terms of the GNU General Public
13 * License version 2, as published by the Free Software Foundation, and
14 * may be copied, distributed, and modified under those terms.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21*/
22
23#ifndef __LINUX_EXTCON_H__
24#define __LINUX_EXTCON_H__
25
26#include <linux/notifier.h>
27
28#define SUPPORTED_CABLE_MAX 32
29#define CABLE_NAME_MAX 30
30
31/*
32 * The standard cable name is to help support general notifier
33 * and notifee device drivers to share the common names.
34 * Please use standard cable names unless your notifier device has
35 * a very unique and abnormal cable or
36 * the cable type is supposed to be used with only one unique
37 * pair of notifier/notifee devices.
38 *
39 * Please add any other "standard" cables used with extcon dev.
40 *
41 * You may add a dot and number to specify version or specification
42 * of the specific cable if it is required. (e.g., "Fast-charger.18"
43 * and "Fast-charger.10" for 1.8A and 1.0A chargers)
44 * However, the notifee and notifier should be able to handle such
45 * string and if the notifee can negotiate the protocol or idenify,
46 * you don't need such convention. This convention is helpful when
47 * notifier can distinguish but notifiee cannot.
48 */
49enum extcon_cable_name {
50 EXTCON_USB = 0,
51 EXTCON_USB_HOST,
52 EXTCON_TA, /* Travel Adaptor */
53 EXTCON_FAST_CHARGER,
54 EXTCON_SLOW_CHARGER,
55 EXTCON_CHARGE_DOWNSTREAM, /* Charging an external device */
56 EXTCON_HDMI,
57 EXTCON_MHL,
58 EXTCON_DVI,
59 EXTCON_VGA,
60 EXTCON_DOCK,
61 EXTCON_LINE_IN,
62 EXTCON_LINE_OUT,
63 EXTCON_MIC_IN,
64 EXTCON_HEADPHONE_OUT,
65 EXTCON_SPDIF_IN,
66 EXTCON_SPDIF_OUT,
67 EXTCON_VIDEO_IN,
68 EXTCON_VIDEO_OUT,
69 EXTCON_MECHANICAL,
70};
71extern const char *extcon_cable_name[];
72
73struct extcon_cable;
74
75/**
76 * struct extcon_dev - An extcon device represents one external connector.
77 * @name The name of this extcon device. Parent device name is used
78 * if NULL.
79 * @supported_cable Array of supported cable name ending with NULL.
80 * If supported_cable is NULL, cable name related APIs
81 * are disabled.
82 * @mutually_exclusive Array of mutually exclusive set of cables that cannot
83 * be attached simultaneously. The array should be
84 * ending with NULL or be NULL (no mutually exclusive
85 * cables). For example, if it is { 0x7, 0x30, 0}, then,
86 * {0, 1}, {0, 1, 2}, {0, 2}, {1, 2}, or {4, 5} cannot
87 * be attached simulataneously. {0x7, 0} is equivalent to
88 * {0x3, 0x6, 0x5, 0}. If it is {0xFFFFFFFF, 0}, there
89 * can be no simultaneous connections.
90 * @print_name An optional callback to override the method to print the
91 * name of the extcon device.
92 * @print_state An optional callback to override the method to print the
93 * status of the extcon device.
94 * @dev Device of this extcon. Do not provide at register-time.
95 * @state Attach/detach state of this extcon. Do not provide at
96 * register-time
97 * @nh Notifier for the state change events from this extcon
98 * @entry To support list of extcon devices so that uses can search
99 * for extcon devices based on the extcon name.
100 * @lock
101 * @max_supported Internal value to store the number of cables.
102 * @extcon_dev_type Device_type struct to provide attribute_groups
103 * customized for each extcon device.
104 * @cables Sysfs subdirectories. Each represents one cable.
105 *
106 * In most cases, users only need to provide "User initializing data" of
107 * this struct when registering an extcon. In some exceptional cases,
108 * optional callbacks may be needed. However, the values in "internal data"
109 * are overwritten by register function.
110 */
111struct extcon_dev {
112 /* --- Optional user initializing data --- */
113 const char *name;
114 const char **supported_cable;
115 const u32 *mutually_exclusive;
116
117 /* --- Optional callbacks to override class functions --- */
118 ssize_t (*print_name)(struct extcon_dev *edev, char *buf);
119 ssize_t (*print_state)(struct extcon_dev *edev, char *buf);
120
121 /* --- Internal data. Please do not set. --- */
122 struct device *dev;
123 u32 state;
124 struct raw_notifier_head nh;
125 struct list_head entry;
126 spinlock_t lock; /* could be called by irq handler */
127 int max_supported;
128
129 /* /sys/class/extcon/.../cable.n/... */
130 struct device_type extcon_dev_type;
131 struct extcon_cable *cables;
132 /* /sys/class/extcon/.../mutually_exclusive/... */
133 struct attribute_group attr_g_muex;
134 struct attribute **attrs_muex;
135 struct device_attribute *d_attrs_muex;
136};
137
138/**
139 * struct extcon_cable - An internal data for each cable of extcon device.
140 * @edev The extcon device
141 * @cable_index Index of this cable in the edev
142 * @attr_g Attribute group for the cable
143 * @attr_name "name" sysfs entry
144 * @attr_state "state" sysfs entry
145 * @attrs Array pointing to attr_name and attr_state for attr_g
146 */
147struct extcon_cable {
148 struct extcon_dev *edev;
149 int cable_index;
150
151 struct attribute_group attr_g;
152 struct device_attribute attr_name;
153 struct device_attribute attr_state;
154
155 struct attribute *attrs[3]; /* to be fed to attr_g.attrs */
156};
157
158/**
159 * struct extcon_specific_cable_nb - An internal data for
160 * extcon_register_interest().
161 * @internal_nb a notifier block bridging extcon notifier and cable notifier.
162 * @user_nb user provided notifier block for events from a specific cable.
163 * @cable_index the target cable.
164 * @edev the target extcon device.
165 * @previous_value the saved previous event value.
166 */
167struct extcon_specific_cable_nb {
168 struct notifier_block internal_nb;
169 struct notifier_block *user_nb;
170 int cable_index;
171 struct extcon_dev *edev;
172 unsigned long previous_value;
173};
174
175#if IS_ENABLED(CONFIG_EXTCON)
176
177/*
178 * Following APIs are for notifiers or configurations.
179 * Notifiers are the external port and connection devices.
180 */
181extern int extcon_dev_register(struct extcon_dev *edev, struct device *dev);
182extern void extcon_dev_unregister(struct extcon_dev *edev);
183extern struct extcon_dev *extcon_get_extcon_dev(const char *extcon_name);
184
185/*
186 * get/set/update_state access the 32b encoded state value, which represents
187 * states of all possible cables of the multistate port. For example, if one
188 * calls extcon_set_state(edev, 0x7), it may mean that all the three cables
189 * are attached to the port.
190 */
191static inline u32 extcon_get_state(struct extcon_dev *edev)
192{
193 return edev->state;
194}
195
196extern int extcon_set_state(struct extcon_dev *edev, u32 state);
197extern int extcon_update_state(struct extcon_dev *edev, u32 mask, u32 state);
198
199/*
200 * get/set_cable_state access each bit of the 32b encoded state value.
201 * They are used to access the status of each cable based on the cable_name
202 * or cable_index, which is retrived by extcon_find_cable_index
203 */
204extern int extcon_find_cable_index(struct extcon_dev *sdev,
205 const char *cable_name);
206extern int extcon_get_cable_state_(struct extcon_dev *edev, int cable_index);
207extern int extcon_set_cable_state_(struct extcon_dev *edev, int cable_index,
208 bool cable_state);
209
210extern int extcon_get_cable_state(struct extcon_dev *edev,
211 const char *cable_name);
212extern int extcon_set_cable_state(struct extcon_dev *edev,
213 const char *cable_name, bool cable_state);
214
215/*
216 * Following APIs are for notifiees (those who want to be notified)
217 * to register a callback for events from a specific cable of the extcon.
218 * Notifiees are the connected device drivers wanting to get notified by
219 * a specific external port of a connection device.
220 */
221extern int extcon_register_interest(struct extcon_specific_cable_nb *obj,
222 const char *extcon_name,
223 const char *cable_name,
224 struct notifier_block *nb);
225extern int extcon_unregister_interest(struct extcon_specific_cable_nb *nb);
226
227/*
228 * Following APIs are to monitor every action of a notifier.
229 * Registerer gets notified for every external port of a connection device.
230 * Probably this could be used to debug an action of notifier; however,
231 * we do not recommend to use this at normal 'notifiee' device drivers who
232 * want to be notified by a specific external port of the notifier.
233 */
234extern int extcon_register_notifier(struct extcon_dev *edev,
235 struct notifier_block *nb);
236extern int extcon_unregister_notifier(struct extcon_dev *edev,
237 struct notifier_block *nb);
238#else /* CONFIG_EXTCON */
239static inline int extcon_dev_register(struct extcon_dev *edev,
240 struct device *dev)
241{
242 return 0;
243}
244
245static inline void extcon_dev_unregister(struct extcon_dev *edev) { }
246
247static inline u32 extcon_get_state(struct extcon_dev *edev)
248{
249 return 0;
250}
251
252static inline int extcon_set_state(struct extcon_dev *edev, u32 state)
253{
254 return 0;
255}
256
257static inline int extcon_update_state(struct extcon_dev *edev, u32 mask,
258 u32 state)
259{
260 return 0;
261}
262
263static inline int extcon_find_cable_index(struct extcon_dev *edev,
264 const char *cable_name)
265{
266 return 0;
267}
268
269static inline int extcon_get_cable_state_(struct extcon_dev *edev,
270 int cable_index)
271{
272 return 0;
273}
274
275static inline int extcon_set_cable_state_(struct extcon_dev *edev,
276 int cable_index, bool cable_state)
277{
278 return 0;
279}
280
281static inline int extcon_get_cable_state(struct extcon_dev *edev,
282 const char *cable_name)
283{
284 return 0;
285}
286
287static inline int extcon_set_cable_state(struct extcon_dev *edev,
288 const char *cable_name, int state)
289{
290 return 0;
291}
292
293static inline struct extcon_dev *extcon_get_extcon_dev(const char *extcon_name)
294{
295 return NULL;
296}
297
298static inline int extcon_register_notifier(struct extcon_dev *edev,
299 struct notifier_block *nb)
300{
301 return 0;
302}
303
304static inline int extcon_unregister_notifier(struct extcon_dev *edev,
305 struct notifier_block *nb)
306{
307 return 0;
308}
309
310static inline int extcon_register_interest(struct extcon_specific_cable_nb *obj,
311 const char *extcon_name,
312 const char *cable_name,
313 struct notifier_block *nb)
314{
315 return 0;
316}
317
318static inline int extcon_unregister_interest(struct extcon_specific_cable_nb
319 *obj)
320{
321 return 0;
322}
323#endif /* CONFIG_EXTCON */
324#endif /* __LINUX_EXTCON_H__ */
diff --git a/include/linux/extcon/extcon_gpio.h b/include/linux/extcon/extcon_gpio.h
new file mode 100644
index 000000000000..a2129b73dcb1
--- /dev/null
+++ b/include/linux/extcon/extcon_gpio.h
@@ -0,0 +1,52 @@
1/*
2 * External connector (extcon) class generic GPIO driver
3 *
4 * Copyright (C) 2012 Samsung Electronics
5 * Author: MyungJoo Ham <myungjoo.ham@samsung.com>
6 *
7 * based on switch class driver
8 * Copyright (C) 2008 Google, Inc.
9 * Author: Mike Lockwood <lockwood@android.com>
10 *
11 * This software is licensed under the terms of the GNU General Public
12 * License version 2, as published by the Free Software Foundation, and
13 * may be copied, distributed, and modified under those terms.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20*/
21#ifndef __EXTCON_GPIO_H__
22#define __EXTCON_GPIO_H__ __FILE__
23
24#include <linux/extcon.h>
25
26/**
27 * struct gpio_extcon_platform_data - A simple GPIO-controlled extcon device.
28 * @name The name of this GPIO extcon device.
29 * @gpio Corresponding GPIO.
30 * @debounce Debounce time for GPIO IRQ in ms.
31 * @irq_flags IRQ Flags (e.g., IRQF_TRIGGER_LOW).
32 * @state_on print_state is overriden with state_on if attached. If Null,
33 * default method of extcon class is used.
34 * @state_off print_state is overriden with state_on if dettached. If Null,
35 * default method of extcon class is used.
36 *
37 * Note that in order for state_on or state_off to be valid, both state_on
38 * and state_off should be not NULL. If at least one of them is NULL,
39 * the print_state is not overriden.
40 */
41struct gpio_extcon_platform_data {
42 const char *name;
43 unsigned gpio;
44 unsigned long debounce;
45 unsigned long irq_flags;
46
47 /* if NULL, "0" or "1" will be printed */
48 const char *state_on;
49 const char *state_off;
50};
51
52#endif /* __EXTCON_GPIO_H__ */
diff --git a/include/linux/filter.h b/include/linux/filter.h
index 8eeb205f298b..82b01357af8b 100644
--- a/include/linux/filter.h
+++ b/include/linux/filter.h
@@ -10,6 +10,7 @@
10 10
11#ifdef __KERNEL__ 11#ifdef __KERNEL__
12#include <linux/atomic.h> 12#include <linux/atomic.h>
13#include <linux/compat.h>
13#endif 14#endif
14 15
15/* 16/*
@@ -126,12 +127,23 @@ struct sock_fprog { /* Required for SO_ATTACH_FILTER. */
126#define SKF_AD_HATYPE 28 127#define SKF_AD_HATYPE 28
127#define SKF_AD_RXHASH 32 128#define SKF_AD_RXHASH 32
128#define SKF_AD_CPU 36 129#define SKF_AD_CPU 36
129#define SKF_AD_MAX 40 130#define SKF_AD_ALU_XOR_X 40
131#define SKF_AD_MAX 44
130#define SKF_NET_OFF (-0x100000) 132#define SKF_NET_OFF (-0x100000)
131#define SKF_LL_OFF (-0x200000) 133#define SKF_LL_OFF (-0x200000)
132 134
133#ifdef __KERNEL__ 135#ifdef __KERNEL__
134 136
137#ifdef CONFIG_COMPAT
138/*
139 * A struct sock_filter is architecture independent.
140 */
141struct compat_sock_fprog {
142 u16 len;
143 compat_uptr_t filter; /* struct sock_filter * */
144};
145#endif
146
135struct sk_buff; 147struct sk_buff;
136struct sock; 148struct sock;
137 149
@@ -153,6 +165,9 @@ static inline unsigned int sk_filter_len(const struct sk_filter *fp)
153extern int sk_filter(struct sock *sk, struct sk_buff *skb); 165extern int sk_filter(struct sock *sk, struct sk_buff *skb);
154extern unsigned int sk_run_filter(const struct sk_buff *skb, 166extern unsigned int sk_run_filter(const struct sk_buff *skb,
155 const struct sock_filter *filter); 167 const struct sock_filter *filter);
168extern int sk_unattached_filter_create(struct sk_filter **pfp,
169 struct sock_fprog *fprog);
170extern void sk_unattached_filter_destroy(struct sk_filter *fp);
156extern int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk); 171extern int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk);
157extern int sk_detach_filter(struct sock *sk); 172extern int sk_detach_filter(struct sock *sk);
158extern int sk_chk_filter(struct sock_filter *filter, unsigned int flen); 173extern int sk_chk_filter(struct sock_filter *filter, unsigned int flen);
@@ -228,6 +243,8 @@ enum {
228 BPF_S_ANC_HATYPE, 243 BPF_S_ANC_HATYPE,
229 BPF_S_ANC_RXHASH, 244 BPF_S_ANC_RXHASH,
230 BPF_S_ANC_CPU, 245 BPF_S_ANC_CPU,
246 BPF_S_ANC_ALU_XOR_X,
247 BPF_S_ANC_SECCOMP_LD_W,
231}; 248};
232 249
233#endif /* __KERNEL__ */ 250#endif /* __KERNEL__ */
diff --git a/include/linux/firewire.h b/include/linux/firewire.h
index cdc9b719e9c7..7edcf1031718 100644
--- a/include/linux/firewire.h
+++ b/include/linux/firewire.h
@@ -135,6 +135,20 @@ struct fw_card {
135 __be32 maint_utility_register; 135 __be32 maint_utility_register;
136}; 136};
137 137
138static inline struct fw_card *fw_card_get(struct fw_card *card)
139{
140 kref_get(&card->kref);
141
142 return card;
143}
144
145void fw_card_release(struct kref *kref);
146
147static inline void fw_card_put(struct fw_card *card)
148{
149 kref_put(&card->kref, fw_card_release);
150}
151
138struct fw_attribute_group { 152struct fw_attribute_group {
139 struct attribute_group *groups[2]; 153 struct attribute_group *groups[2];
140 struct attribute_group group; 154 struct attribute_group group;
@@ -325,6 +339,7 @@ int fw_core_add_address_handler(struct fw_address_handler *handler,
325void fw_core_remove_address_handler(struct fw_address_handler *handler); 339void fw_core_remove_address_handler(struct fw_address_handler *handler);
326void fw_send_response(struct fw_card *card, 340void fw_send_response(struct fw_card *card,
327 struct fw_request *request, int rcode); 341 struct fw_request *request, int rcode);
342int fw_get_request_speed(struct fw_request *request);
328void fw_send_request(struct fw_card *card, struct fw_transaction *t, 343void fw_send_request(struct fw_card *card, struct fw_transaction *t,
329 int tcode, int destination_id, int generation, int speed, 344 int tcode, int destination_id, int generation, int speed,
330 unsigned long long offset, void *payload, size_t length, 345 unsigned long long offset, void *payload, size_t length,
@@ -334,6 +349,7 @@ int fw_cancel_transaction(struct fw_card *card,
334int fw_run_transaction(struct fw_card *card, int tcode, int destination_id, 349int fw_run_transaction(struct fw_card *card, int tcode, int destination_id,
335 int generation, int speed, unsigned long long offset, 350 int generation, int speed, unsigned long long offset,
336 void *payload, size_t length); 351 void *payload, size_t length);
352const char *fw_rcode_string(int rcode);
337 353
338static inline int fw_stream_packet_destination_id(int tag, int channel, int sy) 354static inline int fw_stream_packet_destination_id(int tag, int channel, int sy)
339{ 355{
@@ -391,6 +407,7 @@ struct fw_iso_buffer {
391 enum dma_data_direction direction; 407 enum dma_data_direction direction;
392 struct page **pages; 408 struct page **pages;
393 int page_count; 409 int page_count;
410 int page_count_mapped;
394}; 411};
395 412
396int fw_iso_buffer_init(struct fw_iso_buffer *buffer, struct fw_card *card, 413int fw_iso_buffer_init(struct fw_iso_buffer *buffer, struct fw_card *card,
diff --git a/include/linux/fixp-arith.h b/include/linux/fixp-arith.h
new file mode 100644
index 000000000000..3089d7382325
--- /dev/null
+++ b/include/linux/fixp-arith.h
@@ -0,0 +1,87 @@
1#ifndef _FIXP_ARITH_H
2#define _FIXP_ARITH_H
3
4/*
5 * Simplistic fixed-point arithmetics.
6 * Hmm, I'm probably duplicating some code :(
7 *
8 * Copyright (c) 2002 Johann Deneux
9 */
10
11/*
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 *
26 * Should you need to contact me, the author, you can do so by
27 * e-mail - mail your message to <johann.deneux@gmail.com>
28 */
29
30#include <linux/types.h>
31
32/* The type representing fixed-point values */
33typedef s16 fixp_t;
34
35#define FRAC_N 8
36#define FRAC_MASK ((1<<FRAC_N)-1)
37
38/* Not to be used directly. Use fixp_{cos,sin} */
39static const fixp_t cos_table[46] = {
40 0x0100, 0x00FF, 0x00FF, 0x00FE, 0x00FD, 0x00FC, 0x00FA, 0x00F8,
41 0x00F6, 0x00F3, 0x00F0, 0x00ED, 0x00E9, 0x00E6, 0x00E2, 0x00DD,
42 0x00D9, 0x00D4, 0x00CF, 0x00C9, 0x00C4, 0x00BE, 0x00B8, 0x00B1,
43 0x00AB, 0x00A4, 0x009D, 0x0096, 0x008F, 0x0087, 0x0080, 0x0078,
44 0x0070, 0x0068, 0x005F, 0x0057, 0x004F, 0x0046, 0x003D, 0x0035,
45 0x002C, 0x0023, 0x001A, 0x0011, 0x0008, 0x0000
46};
47
48
49/* a: 123 -> 123.0 */
50static inline fixp_t fixp_new(s16 a)
51{
52 return a<<FRAC_N;
53}
54
55/* a: 0xFFFF -> -1.0
56 0x8000 -> 1.0
57 0x0000 -> 0.0
58*/
59static inline fixp_t fixp_new16(s16 a)
60{
61 return ((s32)a)>>(16-FRAC_N);
62}
63
64static inline fixp_t fixp_cos(unsigned int degrees)
65{
66 int quadrant = (degrees / 90) & 3;
67 unsigned int i = degrees % 90;
68
69 if (quadrant == 1 || quadrant == 3)
70 i = 90 - i;
71
72 i >>= 1;
73
74 return (quadrant == 1 || quadrant == 2)? -cos_table[i] : cos_table[i];
75}
76
77static inline fixp_t fixp_sin(unsigned int degrees)
78{
79 return -fixp_cos(degrees + 90);
80}
81
82static inline fixp_t fixp_mult(fixp_t a, fixp_t b)
83{
84 return ((s32)(a*b))>>FRAC_N;
85}
86
87#endif
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 8de675523e46..c0e53372b082 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -402,6 +402,7 @@ struct inodes_stat_t {
402#include <linux/atomic.h> 402#include <linux/atomic.h>
403#include <linux/shrinker.h> 403#include <linux/shrinker.h>
404#include <linux/migrate_mode.h> 404#include <linux/migrate_mode.h>
405#include <linux/uidgid.h>
405 406
406#include <asm/byteorder.h> 407#include <asm/byteorder.h>
407 408
@@ -469,8 +470,8 @@ typedef void (dio_iodone_t)(struct kiocb *iocb, loff_t offset,
469struct iattr { 470struct iattr {
470 unsigned int ia_valid; 471 unsigned int ia_valid;
471 umode_t ia_mode; 472 umode_t ia_mode;
472 uid_t ia_uid; 473 kuid_t ia_uid;
473 gid_t ia_gid; 474 kgid_t ia_gid;
474 loff_t ia_size; 475 loff_t ia_size;
475 struct timespec ia_atime; 476 struct timespec ia_atime;
476 struct timespec ia_mtime; 477 struct timespec ia_mtime;
@@ -761,8 +762,8 @@ struct posix_acl;
761struct inode { 762struct inode {
762 umode_t i_mode; 763 umode_t i_mode;
763 unsigned short i_opflags; 764 unsigned short i_opflags;
764 uid_t i_uid; 765 kuid_t i_uid;
765 gid_t i_gid; 766 kgid_t i_gid;
766 unsigned int i_flags; 767 unsigned int i_flags;
767 768
768#ifdef CONFIG_FS_POSIX_ACL 769#ifdef CONFIG_FS_POSIX_ACL
@@ -927,6 +928,31 @@ static inline void i_size_write(struct inode *inode, loff_t i_size)
927#endif 928#endif
928} 929}
929 930
931/* Helper functions so that in most cases filesystems will
932 * not need to deal directly with kuid_t and kgid_t and can
933 * instead deal with the raw numeric values that are stored
934 * in the filesystem.
935 */
936static inline uid_t i_uid_read(const struct inode *inode)
937{
938 return from_kuid(&init_user_ns, inode->i_uid);
939}
940
941static inline gid_t i_gid_read(const struct inode *inode)
942{
943 return from_kgid(&init_user_ns, inode->i_gid);
944}
945
946static inline void i_uid_write(struct inode *inode, uid_t uid)
947{
948 inode->i_uid = make_kuid(&init_user_ns, uid);
949}
950
951static inline void i_gid_write(struct inode *inode, gid_t gid)
952{
953 inode->i_gid = make_kgid(&init_user_ns, gid);
954}
955
930static inline unsigned iminor(const struct inode *inode) 956static inline unsigned iminor(const struct inode *inode)
931{ 957{
932 return MINOR(inode->i_rdev); 958 return MINOR(inode->i_rdev);
@@ -943,7 +969,7 @@ struct fown_struct {
943 rwlock_t lock; /* protects pid, uid, euid fields */ 969 rwlock_t lock; /* protects pid, uid, euid fields */
944 struct pid *pid; /* pid or -pgrp where SIGIO should be sent */ 970 struct pid *pid; /* pid or -pgrp where SIGIO should be sent */
945 enum pid_type pid_type; /* Kind of process group SIGIO should be sent to */ 971 enum pid_type pid_type; /* Kind of process group SIGIO should be sent to */
946 uid_t uid, euid; /* uid/euid of process setting the owner */ 972 kuid_t uid, euid; /* uid/euid of process setting the owner */
947 int signum; /* posix.1b rt signal to be delivered on IO */ 973 int signum; /* posix.1b rt signal to be delivered on IO */
948}; 974};
949 975
@@ -1527,12 +1553,6 @@ enum {
1527#define vfs_check_frozen(sb, level) \ 1553#define vfs_check_frozen(sb, level) \
1528 wait_event((sb)->s_wait_unfrozen, ((sb)->s_frozen < (level))) 1554 wait_event((sb)->s_wait_unfrozen, ((sb)->s_frozen < (level)))
1529 1555
1530/*
1531 * until VFS tracks user namespaces for inodes, just make all files
1532 * belong to init_user_ns
1533 */
1534extern struct user_namespace init_user_ns;
1535#define inode_userns(inode) (&init_user_ns)
1536extern bool inode_owner_or_capable(const struct inode *inode); 1556extern bool inode_owner_or_capable(const struct inode *inode);
1537 1557
1538/* not quite ready to be deprecated, but... */ 1558/* not quite ready to be deprecated, but... */
@@ -2051,6 +2071,7 @@ extern void unregister_blkdev(unsigned int, const char *);
2051extern struct block_device *bdget(dev_t); 2071extern struct block_device *bdget(dev_t);
2052extern struct block_device *bdgrab(struct block_device *bdev); 2072extern struct block_device *bdgrab(struct block_device *bdev);
2053extern void bd_set_size(struct block_device *, loff_t size); 2073extern void bd_set_size(struct block_device *, loff_t size);
2074extern sector_t blkdev_max_block(struct block_device *bdev);
2054extern void bd_forget(struct inode *inode); 2075extern void bd_forget(struct inode *inode);
2055extern void bdput(struct block_device *); 2076extern void bdput(struct block_device *);
2056extern void invalidate_bdev(struct block_device *); 2077extern 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/gameport.h b/include/linux/gameport.h
index b456b08d70ed..b986be513406 100644
--- a/include/linux/gameport.h
+++ b/include/linux/gameport.h
@@ -153,6 +153,19 @@ int __must_check __gameport_register_driver(struct gameport_driver *drv,
153 153
154void gameport_unregister_driver(struct gameport_driver *drv); 154void gameport_unregister_driver(struct gameport_driver *drv);
155 155
156/**
157 * module_gameport_driver() - Helper macro for registering a gameport driver
158 * @__gameport_driver: gameport_driver struct
159 *
160 * Helper macro for gameport drivers which do not do anything special in
161 * module init/exit. This eliminates a lot of boilerplate. Each module may
162 * only use this macro once, and calling it replaces module_init() and
163 * module_exit().
164 */
165#define module_gameport_driver(__gameport_driver) \
166 module_driver(__gameport_driver, gameport_register_driver, \
167 gameport_unregister_driver)
168
156#endif /* __KERNEL__ */ 169#endif /* __KERNEL__ */
157 170
158#define GAMEPORT_MODE_DISABLED 0 171#define GAMEPORT_MODE_DISABLED 0
diff --git a/include/linux/generic_serial.h b/include/linux/generic_serial.h
index fadff28505bb..79b3eb37243a 100644
--- a/include/linux/generic_serial.h
+++ b/include/linux/generic_serial.h
@@ -4,7 +4,6 @@
4 * Copyright (C) 1998 R.E.Wolff@BitWizard.nl 4 * Copyright (C) 1998 R.E.Wolff@BitWizard.nl
5 * 5 *
6 * written for the SX serial driver. 6 * written for the SX serial driver.
7 * Contains the code that should be shared over all the serial drivers.
8 * 7 *
9 * Version 0.1 -- December, 1998. 8 * Version 0.1 -- December, 1998.
10 */ 9 */
@@ -12,45 +11,8 @@
12#ifndef GENERIC_SERIAL_H 11#ifndef GENERIC_SERIAL_H
13#define GENERIC_SERIAL_H 12#define GENERIC_SERIAL_H
14 13
15#ifdef __KERNEL__ 14#warning Use of this header is deprecated.
16#include <linux/mutex.h> 15#warning Since nobody sets the constants defined here for you, you should not, in any case, use them. Including the header is thus pointless.
17#include <linux/tty.h>
18
19struct real_driver {
20 void (*disable_tx_interrupts) (void *);
21 void (*enable_tx_interrupts) (void *);
22 void (*disable_rx_interrupts) (void *);
23 void (*enable_rx_interrupts) (void *);
24 void (*shutdown_port) (void*);
25 int (*set_real_termios) (void*);
26 int (*chars_in_buffer) (void*);
27 void (*close) (void*);
28 void (*hungup) (void*);
29 void (*getserial) (void*, struct serial_struct *sp);
30};
31
32
33
34struct gs_port {
35 int magic;
36 struct tty_port port;
37 unsigned char *xmit_buf;
38 int xmit_head;
39 int xmit_tail;
40 int xmit_cnt;
41 struct mutex port_write_mutex;
42 unsigned long event;
43 unsigned short closing_wait;
44 int close_delay;
45 struct real_driver *rd;
46 int wakeup_chars;
47 int baud_base;
48 int baud;
49 int custom_divisor;
50 spinlock_t driver_lock;
51};
52
53#endif /* __KERNEL__ */
54 16
55/* Flags */ 17/* Flags */
56/* Warning: serial.h defines some ASYNC_ flags, they say they are "only" 18/* Warning: serial.h defines some ASYNC_ flags, they say they are "only"
@@ -60,8 +22,6 @@ struct gs_port {
60#define GS_RX_INTEN 0x00400000 22#define GS_RX_INTEN 0x00400000
61#define GS_ACTIVE 0x00200000 23#define GS_ACTIVE 0x00200000
62 24
63
64
65#define GS_TYPE_NORMAL 1 25#define GS_TYPE_NORMAL 1
66 26
67#define GS_DEBUG_FLUSH 0x00000001 27#define GS_DEBUG_FLUSH 0x00000001
@@ -72,24 +32,4 @@ struct gs_port {
72#define GS_DEBUG_FLOW 0x00000020 32#define GS_DEBUG_FLOW 0x00000020
73#define GS_DEBUG_WRITE 0x00000040 33#define GS_DEBUG_WRITE 0x00000040
74 34
75#ifdef __KERNEL__
76int gs_put_char(struct tty_struct *tty, unsigned char ch);
77int gs_write(struct tty_struct *tty,
78 const unsigned char *buf, int count);
79int gs_write_room(struct tty_struct *tty);
80int gs_chars_in_buffer(struct tty_struct *tty);
81void gs_flush_buffer(struct tty_struct *tty);
82void gs_flush_chars(struct tty_struct *tty);
83void gs_stop(struct tty_struct *tty);
84void gs_start(struct tty_struct *tty);
85void gs_hangup(struct tty_struct *tty);
86int gs_block_til_ready(void *port, struct file *filp);
87void gs_close(struct tty_struct *tty, struct file *filp);
88void gs_set_termios (struct tty_struct * tty,
89 struct ktermios * old_termios);
90int gs_init_port(struct gs_port *port);
91int gs_setserial(struct gs_port *port, struct serial_struct __user *sp);
92int gs_getserial(struct gs_port *port, struct serial_struct __user *sp);
93void gs_got_break(struct gs_port *port);
94#endif /* __KERNEL__ */
95#endif 35#endif
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index e61d3192448e..017a7fb5a1fc 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -222,12 +222,6 @@ static inline void part_pack_uuid(const u8 *uuid_str, u8 *to)
222 } 222 }
223} 223}
224 224
225static inline char *part_unpack_uuid(const u8 *uuid, char *out)
226{
227 sprintf(out, "%pU", uuid);
228 return out;
229}
230
231static inline int disk_max_parts(struct gendisk *disk) 225static inline int disk_max_parts(struct gendisk *disk)
232{ 226{
233 if (disk->flags & GENHD_FL_EXT_DEVT) 227 if (disk->flags & GENHD_FL_EXT_DEVT)
diff --git a/include/linux/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 5852545e6bba..68ed7f7e1fc9 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -274,6 +274,33 @@ struct hv_ring_buffer_debug_info {
274 u32 bytes_avail_towrite; 274 u32 bytes_avail_towrite;
275}; 275};
276 276
277
278/*
279 *
280 * hv_get_ringbuffer_availbytes()
281 *
282 * Get number of bytes available to read and to write to
283 * for the specified ring buffer
284 */
285static inline void
286hv_get_ringbuffer_availbytes(struct hv_ring_buffer_info *rbi,
287 u32 *read, u32 *write)
288{
289 u32 read_loc, write_loc, dsize;
290
291 smp_read_barrier_depends();
292
293 /* Capture the read/write indices before they changed */
294 read_loc = rbi->ring_buffer->read_index;
295 write_loc = rbi->ring_buffer->write_index;
296 dsize = rbi->ring_datasize;
297
298 *write = write_loc >= read_loc ? dsize - (write_loc - read_loc) :
299 read_loc - write_loc;
300 *read = dsize - *write;
301}
302
303
277/* 304/*
278 * We use the same version numbering for all Hyper-V modules. 305 * We use the same version numbering for all Hyper-V modules.
279 * 306 *
@@ -1035,8 +1062,10 @@ struct hyperv_service_callback {
1035 void (*callback) (void *context); 1062 void (*callback) (void *context);
1036}; 1063};
1037 1064
1065#define MAX_SRV_VER 0x7ffffff
1038extern void vmbus_prep_negotiate_resp(struct icmsg_hdr *, 1066extern void vmbus_prep_negotiate_resp(struct icmsg_hdr *,
1039 struct icmsg_negotiate *, u8 *); 1067 struct icmsg_negotiate *, u8 *, int,
1068 int);
1040 1069
1041int hv_kvp_init(struct hv_util_service *); 1070int hv_kvp_init(struct hv_util_service *);
1042void hv_kvp_deinit(void); 1071void hv_kvp_deinit(void);
diff --git a/include/linux/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/adp5588.h b/include/linux/i2c/adp5588.h
index cec17cf6cac2..d8341cb47b60 100644
--- a/include/linux/i2c/adp5588.h
+++ b/include/linux/i2c/adp5588.h
@@ -157,6 +157,7 @@ struct i2c_client; /* forward declaration */
157 157
158struct adp5588_gpio_platform_data { 158struct adp5588_gpio_platform_data {
159 int gpio_start; /* GPIO Chip base # */ 159 int gpio_start; /* GPIO Chip base # */
160 const char *const *names;
160 unsigned irq_base; /* interrupt base # */ 161 unsigned irq_base; /* interrupt base # */
161 unsigned pullup_dis_mask; /* Pull-Up Disable Mask */ 162 unsigned pullup_dis_mask; /* Pull-Up Disable Mask */
162 int (*setup)(struct i2c_client *client, 163 int (*setup)(struct i2c_client *client,
diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h
index 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/i2o-dev.h b/include/linux/i2o-dev.h
index a0b23dd45239..a8093bfec3a6 100644
--- a/include/linux/i2o-dev.h
+++ b/include/linux/i2o-dev.h
@@ -124,7 +124,7 @@ typedef struct i2o_sg_io_hdr {
124#define I2O_BUS_LOCAL 0 124#define I2O_BUS_LOCAL 0
125#define I2O_BUS_ISA 1 125#define I2O_BUS_ISA 1
126#define I2O_BUS_EISA 2 126#define I2O_BUS_EISA 2
127#define I2O_BUS_MCA 3 127/* was I2O_BUS_MCA 3 */
128#define I2O_BUS_PCI 4 128#define I2O_BUS_PCI 4
129#define I2O_BUS_PCMCIA 5 129#define I2O_BUS_PCMCIA 5
130#define I2O_BUS_NUBUS 6 130#define I2O_BUS_NUBUS 6
diff --git a/include/linux/ibmtr.h b/include/linux/ibmtr.h
deleted file mode 100644
index 06695b74d405..000000000000
--- a/include/linux/ibmtr.h
+++ /dev/null
@@ -1,373 +0,0 @@
1#ifndef __LINUX_IBMTR_H__
2#define __LINUX_IBMTR_H__
3
4/* Definitions for an IBM Token Ring card. */
5/* This file is distributed under the GNU GPL */
6
7/* ported to the Alpha architecture 02/20/96 (just used the HZ macro) */
8
9#define TR_RETRY_INTERVAL (30*HZ) /* 500 on PC = 5 s */
10#define TR_RST_TIME (msecs_to_jiffies(50)) /* 5 on PC = 50 ms */
11#define TR_BUSY_INTERVAL (msecs_to_jiffies(200)) /* 5 on PC = 200 ms */
12#define TR_SPIN_INTERVAL (3*HZ) /* 3 seconds before init timeout */
13
14#define TR_ISA 1
15#define TR_MCA 2
16#define TR_ISAPNP 3
17#define NOTOK 0
18
19#define IBMTR_SHARED_RAM_SIZE 0x10000
20#define IBMTR_IO_EXTENT 4
21#define IBMTR_MAX_ADAPTERS 4
22
23#define CHANNEL_ID 0X1F30
24#define AIP 0X1F00
25#define AIPADAPTYPE 0X1FA0
26#define AIPDATARATE 0X1FA2
27#define AIPEARLYTOKEN 0X1FA4
28#define AIPAVAILSHRAM 0X1FA6
29#define AIPSHRAMPAGE 0X1FA8
30#define AIP4MBDHB 0X1FAA
31#define AIP16MBDHB 0X1FAC
32#define AIPFID 0X1FBA
33
34#define ADAPTRESET 0x1 /* Control Adapter reset (add to base) */
35#define ADAPTRESETREL 0x2 /* Release Adapter from reset ( """) */
36#define ADAPTINTREL 0x3 /* Adapter interrupt release */
37
38#define GLOBAL_INT_ENABLE 0x02f0
39
40/* MMIO bits 0-4 select register */
41#define RRR_EVEN 0x00 /* Shared RAM relocation registers - even and odd */
42/* Used to set the starting address of shared RAM */
43/* Bits 1 through 7 of this register map to bits 13 through 19 of the shared
44 RAM address.*/
45/* ie: 0x02 sets RAM address to ...ato! issy su wazzoo !! GODZILLA!!! */
46#define RRR_ODD 0x01
47/* Bits 2 and 3 of this register can be read to determine shared RAM size */
48/* 00 for 8k, 01 for 16k, 10 for 32k, 11 for 64k */
49#define WRBR_EVEN 0x02 /* Write region base registers - even and odd */
50#define WRBR_ODD 0x03
51#define WWOR_EVEN 0x04 /* Write window open registers - even and odd */
52#define WWOR_ODD 0x05
53#define WWCR_EVEN 0x06 /* Write window close registers - even and odd */
54#define WWCR_ODD 0x07
55
56/* Interrupt status registers - PC system - even and odd */
57#define ISRP_EVEN 0x08
58
59#define TCR_INT 0x10 /* Bit 4 - Timer interrupt. The TVR_EVEN timer has
60 expired. */
61#define ERR_INT 0x08 /* Bit 3 - Error interrupt. The adapter has had an
62 internal error. */
63#define ACCESS_INT 0x04 /* Bit 2 - Access interrupt. You have attempted to
64 write to an invalid area of shared RAM
65 or an invalid register within the MMIO. */
66/* In addition, the following bits within ISRP_EVEN can be turned on or off */
67/* by you to control the interrupt processing: */
68#define INT_ENABLE 0x40 /* Bit 6 - Interrupt enable. If 0, no interrupts will
69 occur. If 1, interrupts will occur normally.
70 Normally set to 1. */
71/* Bit 0 - Primary or alternate adapter. Set to zero if this adapter is the
72 primary adapter, 1 if this adapter is the alternate adapter. */
73
74
75#define ISRP_ODD 0x09
76
77#define ADAP_CHK_INT 0x40 /* Bit 6 - Adapter check. the adapter has
78 encountered a serious problem and has closed
79 itself. Whoa. */
80#define SRB_RESP_INT 0x20 /* Bit 5 - SRB response. The adapter has accepted
81 an SRB request and set the return code within
82 the SRB. */
83#define ASB_FREE_INT 0x10 /* Bit 4 - ASB free. The adapter has read the ASB
84 and this area can be safely reused. This interrupt
85 is only used if your application has set the ASB
86 free request bit in ISRA_ODD or if an error was
87 detected in your response. */
88#define ARB_CMD_INT 0x08 /* Bit 3 - ARB command. The adapter has given you a
89 command for action. The command is located in the
90 ARB area of shared memory. */
91#define SSB_RESP_INT 0x04 /* Bit 2 - SSB response. The adapter has posted a
92 response to your SRB (the response is located in
93 the SSB area of shared memory). */
94/* Bit 1 - Bridge frame forward complete. */
95
96
97
98#define ISRA_EVEN 0x0A /*Interrupt status registers - adapter - even and odd */
99/* Bit 7 - Internal parity error (on adapter's internal bus) */
100/* Bit 6 - Timer interrupt pending */
101/* Bit 5 - Access interrupt (attempt by adapter to access illegal address) */
102/* Bit 4 - Adapter microcode problem (microcode dead-man timer expired) */
103/* Bit 3 - Adapter processor check status */
104/* Bit 2 - Reserved */
105/* Bit 1 - Adapter hardware interrupt mask (prevents internal interrupts) */
106/* Bit 0 - Adapter software interrupt mask (prevents internal software ints) */
107
108#define ISRA_ODD 0x0B
109#define CMD_IN_SRB 0x20 /* Bit 5 - Indicates that you have placed a new
110 command in the SRB and are ready for the adapter to
111 process the command. */
112#define RESP_IN_ASB 0x10 /* Bit 4 - Indicates that you have placed a response
113 (an ASB) in the shared RAM which is available for
114 the adapter's use. */
115/* Bit 3 - Indicates that you are ready to put an SRB in the shared RAM, but
116 that a previous command is still pending. The adapter will then
117 interrupt you when the previous command is completed */
118/* Bit 2 - Indicates that you are ready to put an ASB in the shared RAM, but
119 that a previous ASB is still pending. The adapter will then interrupt
120 you when the previous ASB is copied. */
121#define ARB_FREE 0x2
122#define SSB_FREE 0x1
123
124#define TCR_EVEN 0x0C /* Timer control registers - even and odd */
125#define TCR_ODD 0x0D
126#define TVR_EVEN 0x0E /* Timer value registers - even and odd */
127#define TVR_ODD 0x0F
128#define SRPR_EVEN 0x18 /* Shared RAM paging registers - even and odd */
129#define SRPR_ENABLE_PAGING 0xc0
130#define SRPR_ODD 0x19 /* Not used. */
131#define TOKREAD 0x60
132#define TOKOR 0x40
133#define TOKAND 0x20
134#define TOKWRITE 0x00
135
136/* MMIO bits 5-6 select operation */
137/* 00 is used to write to a register */
138/* 01 is used to bitwise AND a byte with a register */
139/* 10 is used to bitwise OR a byte with a register */
140/* 11 is used to read from a register */
141
142/* MMIO bits 7-8 select area of interest.. see below */
143/* 00 selects attachment control area. */
144/* 01 is reserved. */
145/* 10 selects adapter identification area A containing the adapter encoded
146 address. */
147/* 11 selects the adapter identification area B containing test patterns. */
148
149#define PCCHANNELID 5049434F3631313039393020
150#define MCCHANNELID 4D4152533633583435313820
151
152#define ACA_OFFSET 0x1e00
153#define ACA_SET 0x40
154#define ACA_RESET 0x20
155#define ACA_RW 0x00
156
157#ifdef ENABLE_PAGING
158#define SET_PAGE(x) (writeb((x), ti->mmio + ACA_OFFSET+ ACA_RW + SRPR_EVEN))
159#else
160#define SET_PAGE(x)
161#endif
162
163/* do_tok_int possible values */
164#define FIRST_INT 1
165#define NOT_FIRST 2
166
167typedef enum { CLOSED, OPEN } open_state;
168//staic const char *printstate[] = { "CLOSED","OPEN"};
169
170struct tok_info {
171 unsigned char irq;
172 void __iomem *mmio;
173 unsigned char hw_address[32];
174 unsigned char adapter_type;
175 unsigned char data_rate;
176 unsigned char token_release;
177 unsigned char avail_shared_ram;
178 unsigned char shared_ram_paging;
179 unsigned char turbo;
180 unsigned short dhb_size4mb;
181 unsigned short rbuf_len4;
182 unsigned short rbuf_cnt4;
183 unsigned short maxmtu4;
184 unsigned short dhb_size16mb;
185 unsigned short rbuf_len16;
186 unsigned short rbuf_cnt16;
187 unsigned short maxmtu16;
188 /* Additions by David Morris */
189 unsigned char do_tok_int;
190 wait_queue_head_t wait_for_reset;
191 unsigned char sram_base;
192 /* Additions by Peter De Schrijver */
193 unsigned char page_mask; /* mask to select RAM page to Map*/
194 unsigned char mapped_ram_size; /* size of RAM page */
195 __u32 sram_phys; /* Shared memory base address */
196 void __iomem *sram_virt; /* Shared memory base address */
197 void __iomem *init_srb; /* Initial System Request Block address */
198 void __iomem *srb; /* System Request Block address */
199 void __iomem *ssb; /* System Status Block address */
200 void __iomem *arb; /* Adapter Request Block address */
201 void __iomem *asb; /* Adapter Status Block address */
202 __u8 init_srb_page;
203 __u8 srb_page;
204 __u8 ssb_page;
205 __u8 arb_page;
206 __u8 asb_page;
207 unsigned short exsap_station_id;
208 unsigned short global_int_enable;
209 struct sk_buff *current_skb;
210
211 unsigned char auto_speedsave;
212 open_state open_status, sap_status;
213 enum {MANUAL, AUTOMATIC} open_mode;
214 enum {FAIL, RESTART, REOPEN} open_action;
215 enum {NO, YES} open_failure;
216 unsigned char readlog_pending;
217 unsigned short adapter_int_enable; /* Adapter-specific int enable */
218 struct timer_list tr_timer;
219 unsigned char ring_speed;
220 spinlock_t lock; /* SMP protection */
221};
222
223/* token ring adapter commands */
224#define DIR_INTERRUPT 0x00 /* struct srb_interrupt */
225#define DIR_MOD_OPEN_PARAMS 0x01
226#define DIR_OPEN_ADAPTER 0x03 /* struct dir_open_adapter */
227#define DIR_CLOSE_ADAPTER 0x04
228#define DIR_SET_GRP_ADDR 0x06
229#define DIR_SET_FUNC_ADDR 0x07 /* struct srb_set_funct_addr */
230#define DIR_READ_LOG 0x08 /* struct srb_read_log */
231#define DLC_OPEN_SAP 0x15 /* struct dlc_open_sap */
232#define DLC_CLOSE_SAP 0x16
233#define DATA_LOST 0x20 /* struct asb_rec */
234#define REC_DATA 0x81 /* struct arb_rec_req */
235#define XMIT_DATA_REQ 0x82 /* struct arb_xmit_req */
236#define DLC_STATUS 0x83 /* struct arb_dlc_status */
237#define RING_STAT_CHANGE 0x84 /* struct dlc_open_sap ??? */
238
239/* DIR_OPEN_ADAPTER options */
240#define OPEN_PASS_BCON_MAC 0x0100
241#define NUM_RCV_BUF 2
242#define RCV_BUF_LEN 1024
243#define DHB_LENGTH 2048
244#define NUM_DHB 2
245#define DLC_MAX_SAP 2
246#define DLC_MAX_STA 1
247
248/* DLC_OPEN_SAP options */
249#define MAX_I_FIELD 0x0088
250#define SAP_OPEN_IND_SAP 0x04
251#define SAP_OPEN_PRIORITY 0x20
252#define SAP_OPEN_STATION_CNT 0x1
253#define XMIT_DIR_FRAME 0x0A
254#define XMIT_UI_FRAME 0x0d
255#define XMIT_XID_CMD 0x0e
256#define XMIT_TEST_CMD 0x11
257
258/* srb close return code */
259#define SIGNAL_LOSS 0x8000
260#define HARD_ERROR 0x4000
261#define XMIT_BEACON 0x1000
262#define LOBE_FAULT 0x0800
263#define AUTO_REMOVAL 0x0400
264#define REMOVE_RECV 0x0100
265#define LOG_OVERFLOW 0x0080
266#define RING_RECOVER 0x0020
267
268struct srb_init_response {
269 unsigned char command;
270 unsigned char init_status;
271 unsigned char init_status_2;
272 unsigned char reserved[3];
273 __u16 bring_up_code;
274 __u16 encoded_address;
275 __u16 level_address;
276 __u16 adapter_address;
277 __u16 parms_address;
278 __u16 mac_address;
279};
280
281struct dir_open_adapter {
282 unsigned char command;
283 char reserved[7];
284 __u16 open_options;
285 unsigned char node_address[6];
286 unsigned char group_address[4];
287 unsigned char funct_address[4];
288 __u16 num_rcv_buf;
289 __u16 rcv_buf_len;
290 __u16 dhb_length;
291 unsigned char num_dhb;
292 char reserved2;
293 unsigned char dlc_max_sap;
294 unsigned char dlc_max_sta;
295 unsigned char dlc_max_gsap;
296 unsigned char dlc_max_gmem;
297 unsigned char dlc_t1_tick_1;
298 unsigned char dlc_t2_tick_1;
299 unsigned char dlc_ti_tick_1;
300 unsigned char dlc_t1_tick_2;
301 unsigned char dlc_t2_tick_2;
302 unsigned char dlc_ti_tick_2;
303 unsigned char product_id[18];
304};
305
306struct dlc_open_sap {
307 unsigned char command;
308 unsigned char reserved1;
309 unsigned char ret_code;
310 unsigned char reserved2;
311 __u16 station_id;
312 unsigned char timer_t1;
313 unsigned char timer_t2;
314 unsigned char timer_ti;
315 unsigned char maxout;
316 unsigned char maxin;
317 unsigned char maxout_incr;
318 unsigned char max_retry_count;
319 unsigned char gsap_max_mem;
320 __u16 max_i_field;
321 unsigned char sap_value;
322 unsigned char sap_options;
323 unsigned char station_count;
324 unsigned char sap_gsap_mem;
325 unsigned char gsap[0];
326};
327
328struct srb_xmit {
329 unsigned char command;
330 unsigned char cmd_corr;
331 unsigned char ret_code;
332 unsigned char reserved1;
333 __u16 station_id;
334};
335
336struct arb_rec_req {
337 unsigned char command;
338 unsigned char reserved1[3];
339 __u16 station_id;
340 __u16 rec_buf_addr;
341 unsigned char lan_hdr_len;
342 unsigned char dlc_hdr_len;
343 __u16 frame_len;
344 unsigned char msg_type;
345};
346
347struct asb_rec {
348 unsigned char command;
349 unsigned char reserved1;
350 unsigned char ret_code;
351 unsigned char reserved2;
352 __u16 station_id;
353 __u16 rec_buf_addr;
354};
355
356struct rec_buf {
357 unsigned char reserved1[2];
358 __u16 buf_ptr;
359 unsigned char reserved2;
360 unsigned char receive_fs;
361 __u16 buf_len;
362 unsigned char data[0];
363};
364
365struct srb_set_funct_addr {
366 unsigned char command;
367 unsigned char reserved1;
368 unsigned char ret_code;
369 unsigned char reserved2[3];
370 unsigned char funct_address[4];
371};
372
373#endif
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index 210e2c325534..ce9af8918514 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -640,9 +640,9 @@ struct ieee80211_rann_ie {
640 u8 rann_hopcount; 640 u8 rann_hopcount;
641 u8 rann_ttl; 641 u8 rann_ttl;
642 u8 rann_addr[6]; 642 u8 rann_addr[6];
643 u32 rann_seq; 643 __le32 rann_seq;
644 u32 rann_interval; 644 __le32 rann_interval;
645 u32 rann_metric; 645 __le32 rann_metric;
646} __attribute__ ((packed)); 646} __attribute__ ((packed));
647 647
648enum ieee80211_rann_flags { 648enum ieee80211_rann_flags {
@@ -1007,13 +1007,13 @@ enum ieee80211_min_mpdu_spacing {
1007}; 1007};
1008 1008
1009/** 1009/**
1010 * struct ieee80211_ht_info - HT information 1010 * struct ieee80211_ht_operation - HT operation IE
1011 * 1011 *
1012 * This structure is the "HT information element" as 1012 * This structure is the "HT operation element" as
1013 * described in 802.11n D5.0 7.3.2.58 1013 * described in 802.11n-2009 7.3.2.57
1014 */ 1014 */
1015struct ieee80211_ht_info { 1015struct ieee80211_ht_operation {
1016 u8 control_chan; 1016 u8 primary_chan;
1017 u8 ht_param; 1017 u8 ht_param;
1018 __le16 operation_mode; 1018 __le16 operation_mode;
1019 __le16 stbc_param; 1019 __le16 stbc_param;
@@ -1027,8 +1027,6 @@ struct ieee80211_ht_info {
1027#define IEEE80211_HT_PARAM_CHA_SEC_BELOW 0x03 1027#define IEEE80211_HT_PARAM_CHA_SEC_BELOW 0x03
1028#define IEEE80211_HT_PARAM_CHAN_WIDTH_ANY 0x04 1028#define IEEE80211_HT_PARAM_CHAN_WIDTH_ANY 0x04
1029#define IEEE80211_HT_PARAM_RIFS_MODE 0x08 1029#define IEEE80211_HT_PARAM_RIFS_MODE 0x08
1030#define IEEE80211_HT_PARAM_SPSMP_SUPPORT 0x10
1031#define IEEE80211_HT_PARAM_SERV_INTERVAL_GRAN 0xE0
1032 1030
1033/* for operation_mode */ 1031/* for operation_mode */
1034#define IEEE80211_HT_OP_MODE_PROTECTION 0x0003 1032#define IEEE80211_HT_OP_MODE_PROTECTION 0x0003
@@ -1301,7 +1299,7 @@ enum ieee80211_eid {
1301 WLAN_EID_EXT_SUPP_RATES = 50, 1299 WLAN_EID_EXT_SUPP_RATES = 50,
1302 1300
1303 WLAN_EID_HT_CAPABILITY = 45, 1301 WLAN_EID_HT_CAPABILITY = 45,
1304 WLAN_EID_HT_INFORMATION = 61, 1302 WLAN_EID_HT_OPERATION = 61,
1305 1303
1306 WLAN_EID_RSN = 48, 1304 WLAN_EID_RSN = 48,
1307 WLAN_EID_MMIE = 76, 1305 WLAN_EID_MMIE = 76,
@@ -1441,6 +1439,18 @@ enum ieee80211_tdls_actioncode {
1441#define WLAN_TDLS_SNAP_RFTYPE 0x2 1439#define WLAN_TDLS_SNAP_RFTYPE 0x2
1442 1440
1443/** 1441/**
1442 * enum - mesh synchronization method identifier
1443 *
1444 * @IEEE80211_SYNC_METHOD_NEIGHBOR_OFFSET: the default synchronization method
1445 * @IEEE80211_SYNC_METHOD_VENDOR: a vendor specific synchronization method
1446 * that will be specified in a vendor specific information element
1447 */
1448enum {
1449 IEEE80211_SYNC_METHOD_NEIGHBOR_OFFSET = 1,
1450 IEEE80211_SYNC_METHOD_VENDOR = 255,
1451};
1452
1453/**
1444 * enum - mesh path selection protocol identifier 1454 * enum - mesh path selection protocol identifier
1445 * 1455 *
1446 * @IEEE80211_PATH_PROTOCOL_HWMP: the default path selection protocol 1456 * @IEEE80211_PATH_PROTOCOL_HWMP: the default path selection protocol
@@ -1448,7 +1458,7 @@ enum ieee80211_tdls_actioncode {
1448 * be specified in a vendor specific information element 1458 * be specified in a vendor specific information element
1449 */ 1459 */
1450enum { 1460enum {
1451 IEEE80211_PATH_PROTOCOL_HWMP = 0, 1461 IEEE80211_PATH_PROTOCOL_HWMP = 1,
1452 IEEE80211_PATH_PROTOCOL_VENDOR = 255, 1462 IEEE80211_PATH_PROTOCOL_VENDOR = 255,
1453}; 1463};
1454 1464
@@ -1460,7 +1470,7 @@ enum {
1460 * specified in a vendor specific information element 1470 * specified in a vendor specific information element
1461 */ 1471 */
1462enum { 1472enum {
1463 IEEE80211_PATH_METRIC_AIRTIME = 0, 1473 IEEE80211_PATH_METRIC_AIRTIME = 1,
1464 IEEE80211_PATH_METRIC_VENDOR = 255, 1474 IEEE80211_PATH_METRIC_VENDOR = 255,
1465}; 1475};
1466 1476
diff --git a/include/linux/if_arp.h b/include/linux/if_arp.h
index 6d722f41ee7c..f0e69c6e8208 100644
--- a/include/linux/if_arp.h
+++ b/include/linux/if_arp.h
@@ -87,6 +87,7 @@
87#define ARPHRD_IEEE80211_PRISM 802 /* IEEE 802.11 + Prism2 header */ 87#define ARPHRD_IEEE80211_PRISM 802 /* IEEE 802.11 + Prism2 header */
88#define ARPHRD_IEEE80211_RADIOTAP 803 /* IEEE 802.11 + radiotap header */ 88#define ARPHRD_IEEE80211_RADIOTAP 803 /* IEEE 802.11 + radiotap header */
89#define ARPHRD_IEEE802154 804 89#define ARPHRD_IEEE802154 804
90#define ARPHRD_IEEE802154_MONITOR 805 /* IEEE 802.15.4 network monitor */
90 91
91#define ARPHRD_PHONET 820 /* PhoNet media type */ 92#define ARPHRD_PHONET 820 /* PhoNet media type */
92#define ARPHRD_PHONET_PIPE 821 /* PhoNet pipe header */ 93#define ARPHRD_PHONET_PIPE 821 /* PhoNet pipe header */
diff --git a/include/linux/if_ec.h b/include/linux/if_ec.h
deleted file mode 100644
index d85f9f48129f..000000000000
--- a/include/linux/if_ec.h
+++ /dev/null
@@ -1,68 +0,0 @@
1/* Definitions for Econet sockets. */
2
3#ifndef __LINUX_IF_EC
4#define __LINUX_IF_EC
5
6/* User visible stuff. Glibc provides its own but libc5 folk will use these */
7
8struct ec_addr {
9 unsigned char station; /* Station number. */
10 unsigned char net; /* Network number. */
11};
12
13struct sockaddr_ec {
14 unsigned short sec_family;
15 unsigned char port; /* Port number. */
16 unsigned char cb; /* Control/flag byte. */
17 unsigned char type; /* Type of message. */
18 struct ec_addr addr;
19 unsigned long cookie;
20};
21
22#define ECTYPE_PACKET_RECEIVED 0 /* Packet received */
23#define ECTYPE_TRANSMIT_STATUS 0x10 /* Transmit completed,
24 low nibble holds status */
25
26#define ECTYPE_TRANSMIT_OK 1
27#define ECTYPE_TRANSMIT_NOT_LISTENING 2
28#define ECTYPE_TRANSMIT_NET_ERROR 3
29#define ECTYPE_TRANSMIT_NO_CLOCK 4
30#define ECTYPE_TRANSMIT_LINE_JAMMED 5
31#define ECTYPE_TRANSMIT_NOT_PRESENT 6
32
33#ifdef __KERNEL__
34
35#define EC_HLEN 6
36
37/* This is what an Econet frame looks like on the wire. */
38struct ec_framehdr {
39 unsigned char dst_stn;
40 unsigned char dst_net;
41 unsigned char src_stn;
42 unsigned char src_net;
43 unsigned char cb;
44 unsigned char port;
45};
46
47struct econet_sock {
48 /* struct sock has to be the first member of econet_sock */
49 struct sock sk;
50 unsigned char cb;
51 unsigned char port;
52 unsigned char station;
53 unsigned char net;
54 unsigned short num;
55};
56
57static inline struct econet_sock *ec_sk(const struct sock *sk)
58{
59 return (struct econet_sock *)sk;
60}
61
62struct ec_device {
63 unsigned char station, net; /* Econet protocol address */
64};
65
66#endif
67
68#endif
diff --git a/include/linux/if_link.h b/include/linux/if_link.h
index 4b24ff453aee..f715750d0b87 100644
--- a/include/linux/if_link.h
+++ b/include/linux/if_link.h
@@ -138,6 +138,8 @@ enum {
138 IFLA_GROUP, /* Group the device belongs to */ 138 IFLA_GROUP, /* Group the device belongs to */
139 IFLA_NET_NS_FD, 139 IFLA_NET_NS_FD,
140 IFLA_EXT_MASK, /* Extended info mask, VFs, etc */ 140 IFLA_EXT_MASK, /* Extended info mask, VFs, etc */
141 IFLA_PROMISCUITY, /* Promiscuity count: > 0 means acts PROMISC */
142#define IFLA_PROMISCUITY IFLA_PROMISCUITY
141 __IFLA_MAX 143 __IFLA_MAX
142}; 144};
143 145
@@ -253,6 +255,7 @@ struct ifla_vlan_qos_mapping {
253enum { 255enum {
254 IFLA_MACVLAN_UNSPEC, 256 IFLA_MACVLAN_UNSPEC,
255 IFLA_MACVLAN_MODE, 257 IFLA_MACVLAN_MODE,
258 IFLA_MACVLAN_FLAGS,
256 __IFLA_MACVLAN_MAX, 259 __IFLA_MACVLAN_MAX,
257}; 260};
258 261
@@ -265,6 +268,8 @@ enum macvlan_mode {
265 MACVLAN_MODE_PASSTHRU = 8,/* take over the underlying device */ 268 MACVLAN_MODE_PASSTHRU = 8,/* take over the underlying device */
266}; 269};
267 270
271#define MACVLAN_FLAG_NOPROMISC 1
272
268/* SR-IOV virtual function management section */ 273/* SR-IOV virtual function management section */
269 274
270enum { 275enum {
diff --git a/include/linux/if_macvlan.h b/include/linux/if_macvlan.h
index d103dca5c563..f65e8d250f7e 100644
--- a/include/linux/if_macvlan.h
+++ b/include/linux/if_macvlan.h
@@ -60,6 +60,7 @@ struct macvlan_dev {
60 struct net_device *lowerdev; 60 struct net_device *lowerdev;
61 struct macvlan_pcpu_stats __percpu *pcpu_stats; 61 struct macvlan_pcpu_stats __percpu *pcpu_stats;
62 enum macvlan_mode mode; 62 enum macvlan_mode mode;
63 u16 flags;
63 int (*receive)(struct sk_buff *skb); 64 int (*receive)(struct sk_buff *skb);
64 int (*forward)(struct net_device *dev, struct sk_buff *skb); 65 int (*forward)(struct net_device *dev, struct sk_buff *skb);
65 struct macvtap_queue *taps[MAX_MACVTAP_QUEUES]; 66 struct macvtap_queue *taps[MAX_MACVTAP_QUEUES];
diff --git a/include/linux/if_pppol2tp.h b/include/linux/if_pppol2tp.h
index 23cefa1111bf..b4775418d525 100644
--- a/include/linux/if_pppol2tp.h
+++ b/include/linux/if_pppol2tp.h
@@ -19,10 +19,11 @@
19 19
20#ifdef __KERNEL__ 20#ifdef __KERNEL__
21#include <linux/in.h> 21#include <linux/in.h>
22#include <linux/in6.h>
22#endif 23#endif
23 24
24/* Structure used to connect() the socket to a particular tunnel UDP 25/* Structure used to connect() the socket to a particular tunnel UDP
25 * socket. 26 * socket over IPv4.
26 */ 27 */
27struct pppol2tp_addr { 28struct pppol2tp_addr {
28 __kernel_pid_t pid; /* pid that owns the fd. 29 __kernel_pid_t pid; /* pid that owns the fd.
@@ -35,6 +36,20 @@ struct pppol2tp_addr {
35 __u16 d_tunnel, d_session; /* For sending outgoing packets */ 36 __u16 d_tunnel, d_session; /* For sending outgoing packets */
36}; 37};
37 38
39/* Structure used to connect() the socket to a particular tunnel UDP
40 * socket over IPv6.
41 */
42struct pppol2tpin6_addr {
43 __kernel_pid_t pid; /* pid that owns the fd.
44 * 0 => current */
45 int fd; /* FD of UDP socket to use */
46
47 __u16 s_tunnel, s_session; /* For matching incoming packets */
48 __u16 d_tunnel, d_session; /* For sending outgoing packets */
49
50 struct sockaddr_in6 addr; /* IP address and port to send to */
51};
52
38/* The L2TPv3 protocol changes tunnel and session ids from 16 to 32 53/* The L2TPv3 protocol changes tunnel and session ids from 16 to 32
39 * bits. So we need a different sockaddr structure. 54 * bits. So we need a different sockaddr structure.
40 */ 55 */
@@ -49,6 +64,17 @@ struct pppol2tpv3_addr {
49 __u32 d_tunnel, d_session; /* For sending outgoing packets */ 64 __u32 d_tunnel, d_session; /* For sending outgoing packets */
50}; 65};
51 66
67struct pppol2tpv3in6_addr {
68 __kernel_pid_t pid; /* pid that owns the fd.
69 * 0 => current */
70 int fd; /* FD of UDP or IP socket to use */
71
72 __u32 s_tunnel, s_session; /* For matching incoming packets */
73 __u32 d_tunnel, d_session; /* For sending outgoing packets */
74
75 struct sockaddr_in6 addr; /* IP address and port to send to */
76};
77
52/* Socket options: 78/* Socket options:
53 * DEBUG - bitmask of debug message categories 79 * DEBUG - bitmask of debug message categories
54 * SENDSEQ - 0 => don't send packets with sequence numbers 80 * SENDSEQ - 0 => don't send packets with sequence numbers
diff --git a/include/linux/if_pppox.h b/include/linux/if_pppox.h
index b5f927f59f26..09c474c480cd 100644
--- a/include/linux/if_pppox.h
+++ b/include/linux/if_pppox.h
@@ -70,7 +70,7 @@ struct sockaddr_pppox {
70 struct pppoe_addr pppoe; 70 struct pppoe_addr pppoe;
71 struct pptp_addr pptp; 71 struct pptp_addr pptp;
72 } sa_addr; 72 } sa_addr;
73} __attribute__((packed)); 73} __packed;
74 74
75/* The use of the above union isn't viable because the size of this 75/* The use of the above union isn't viable because the size of this
76 * struct must stay fixed over time -- applications use sizeof(struct 76 * struct must stay fixed over time -- applications use sizeof(struct
@@ -81,7 +81,13 @@ struct sockaddr_pppol2tp {
81 __kernel_sa_family_t sa_family; /* address family, AF_PPPOX */ 81 __kernel_sa_family_t sa_family; /* address family, AF_PPPOX */
82 unsigned int sa_protocol; /* protocol identifier */ 82 unsigned int sa_protocol; /* protocol identifier */
83 struct pppol2tp_addr pppol2tp; 83 struct pppol2tp_addr pppol2tp;
84} __attribute__((packed)); 84} __packed;
85
86struct sockaddr_pppol2tpin6 {
87 __kernel_sa_family_t sa_family; /* address family, AF_PPPOX */
88 unsigned int sa_protocol; /* protocol identifier */
89 struct pppol2tpin6_addr pppol2tp;
90} __packed;
85 91
86/* The L2TPv3 protocol changes tunnel and session ids from 16 to 32 92/* The L2TPv3 protocol changes tunnel and session ids from 16 to 32
87 * bits. So we need a different sockaddr structure. 93 * bits. So we need a different sockaddr structure.
@@ -90,7 +96,13 @@ struct sockaddr_pppol2tpv3 {
90 __kernel_sa_family_t sa_family; /* address family, AF_PPPOX */ 96 __kernel_sa_family_t sa_family; /* address family, AF_PPPOX */
91 unsigned int sa_protocol; /* protocol identifier */ 97 unsigned int sa_protocol; /* protocol identifier */
92 struct pppol2tpv3_addr pppol2tp; 98 struct pppol2tpv3_addr pppol2tp;
93} __attribute__((packed)); 99} __packed;
100
101struct sockaddr_pppol2tpv3in6 {
102 __kernel_sa_family_t sa_family; /* address family, AF_PPPOX */
103 unsigned int sa_protocol; /* protocol identifier */
104 struct pppol2tpv3in6_addr pppol2tp;
105} __packed;
94 106
95/********************************************************************* 107/*********************************************************************
96 * 108 *
@@ -140,7 +152,7 @@ struct pppoe_hdr {
140 __be16 sid; 152 __be16 sid;
141 __be16 length; 153 __be16 length;
142 struct pppoe_tag tag[0]; 154 struct pppoe_tag tag[0];
143} __attribute__((packed)); 155} __packed;
144 156
145/* Length of entire PPPoE + PPP header */ 157/* Length of entire PPPoE + PPP header */
146#define PPPOE_SES_HLEN 8 158#define PPPOE_SES_HLEN 8
diff --git a/include/linux/if_team.h b/include/linux/if_team.h
index 58404b0c5010..8185f57a9c7f 100644
--- a/include/linux/if_team.h
+++ b/include/linux/if_team.h
@@ -28,10 +28,28 @@ struct team;
28 28
29struct team_port { 29struct team_port {
30 struct net_device *dev; 30 struct net_device *dev;
31 struct hlist_node hlist; /* node in hash list */ 31 struct hlist_node hlist; /* node in enabled ports hash list */
32 struct list_head list; /* node in ordinary list */ 32 struct list_head list; /* node in ordinary list */
33 struct team *team; 33 struct team *team;
34 int index; 34 int index; /* index of enabled port. If disabled, it's set to -1 */
35
36 bool linkup; /* either state.linkup or user.linkup */
37
38 struct {
39 bool linkup;
40 u32 speed;
41 u8 duplex;
42 } state;
43
44 /* Values set by userspace */
45 struct {
46 bool linkup;
47 bool linkup_enabled;
48 } user;
49
50 /* Custom gennetlink interface related flags */
51 bool changed;
52 bool removed;
35 53
36 /* 54 /*
37 * A place for storing original values of the device before it 55 * A place for storing original values of the device before it
@@ -42,14 +60,6 @@ struct team_port {
42 unsigned int mtu; 60 unsigned int mtu;
43 } orig; 61 } orig;
44 62
45 bool linkup;
46 u32 speed;
47 u8 duplex;
48
49 /* Custom gennetlink interface related flags */
50 bool changed;
51 bool removed;
52
53 struct rcu_head rcu; 63 struct rcu_head rcu;
54}; 64};
55 65
@@ -68,18 +78,30 @@ struct team_mode_ops {
68enum team_option_type { 78enum team_option_type {
69 TEAM_OPTION_TYPE_U32, 79 TEAM_OPTION_TYPE_U32,
70 TEAM_OPTION_TYPE_STRING, 80 TEAM_OPTION_TYPE_STRING,
81 TEAM_OPTION_TYPE_BINARY,
82 TEAM_OPTION_TYPE_BOOL,
83};
84
85struct team_gsetter_ctx {
86 union {
87 u32 u32_val;
88 const char *str_val;
89 struct {
90 const void *ptr;
91 u32 len;
92 } bin_val;
93 bool bool_val;
94 } data;
95 struct team_port *port;
71}; 96};
72 97
73struct team_option { 98struct team_option {
74 struct list_head list; 99 struct list_head list;
75 const char *name; 100 const char *name;
101 bool per_port;
76 enum team_option_type type; 102 enum team_option_type type;
77 int (*getter)(struct team *team, void *arg); 103 int (*getter)(struct team *team, struct team_gsetter_ctx *ctx);
78 int (*setter)(struct team *team, void *arg); 104 int (*setter)(struct team *team, struct team_gsetter_ctx *ctx);
79
80 /* Custom gennetlink interface related flags */
81 bool changed;
82 bool removed;
83}; 105};
84 106
85struct team_mode { 107struct team_mode {
@@ -103,13 +125,15 @@ struct team {
103 struct mutex lock; /* used for overall locking, e.g. port lists write */ 125 struct mutex lock; /* used for overall locking, e.g. port lists write */
104 126
105 /* 127 /*
106 * port lists with port count 128 * List of enabled ports and their count
107 */ 129 */
108 int port_count; 130 int en_port_count;
109 struct hlist_head port_hlist[TEAM_PORT_HASHENTRIES]; 131 struct hlist_head en_port_hlist[TEAM_PORT_HASHENTRIES];
110 struct list_head port_list; 132
133 struct list_head port_list; /* list of all ports */
111 134
112 struct list_head option_list; 135 struct list_head option_list;
136 struct list_head option_inst_list; /* list of option instances */
113 137
114 const struct team_mode *mode; 138 const struct team_mode *mode;
115 struct team_mode_ops ops; 139 struct team_mode_ops ops;
@@ -119,7 +143,7 @@ struct team {
119static inline struct hlist_head *team_port_index_hash(struct team *team, 143static inline struct hlist_head *team_port_index_hash(struct team *team,
120 int port_index) 144 int port_index)
121{ 145{
122 return &team->port_hlist[port_index & (TEAM_PORT_HASHENTRIES - 1)]; 146 return &team->en_port_hlist[port_index & (TEAM_PORT_HASHENTRIES - 1)];
123} 147}
124 148
125static inline struct team_port *team_get_port_by_index(struct team *team, 149static inline struct team_port *team_get_port_by_index(struct team *team,
@@ -216,6 +240,7 @@ enum {
216 TEAM_ATTR_OPTION_TYPE, /* u8 */ 240 TEAM_ATTR_OPTION_TYPE, /* u8 */
217 TEAM_ATTR_OPTION_DATA, /* dynamic */ 241 TEAM_ATTR_OPTION_DATA, /* dynamic */
218 TEAM_ATTR_OPTION_REMOVED, /* flag */ 242 TEAM_ATTR_OPTION_REMOVED, /* flag */
243 TEAM_ATTR_OPTION_PORT_IFINDEX, /* u32 */ /* for per-port options */
219 244
220 __TEAM_ATTR_OPTION_MAX, 245 __TEAM_ATTR_OPTION_MAX,
221 TEAM_ATTR_OPTION_MAX = __TEAM_ATTR_OPTION_MAX - 1, 246 TEAM_ATTR_OPTION_MAX = __TEAM_ATTR_OPTION_MAX - 1,
diff --git a/include/linux/if_tr.h b/include/linux/if_tr.h
deleted file mode 100644
index fc23aeb0f201..000000000000
--- a/include/linux/if_tr.h
+++ /dev/null
@@ -1,103 +0,0 @@
1/*
2 * INET An implementation of the TCP/IP protocol suite for the LINUX
3 * operating system. INET is implemented using the BSD Socket
4 * interface as the means of communication with the user level.
5 *
6 * Global definitions for the Token-Ring IEEE 802.5 interface.
7 *
8 * Version: @(#)if_tr.h 0.0 07/11/94
9 *
10 * Author: Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
11 * Donald Becker, <becker@super.org>
12 * Peter De Schrijver, <stud11@cc4.kuleuven.ac.be>
13 *
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License
16 * as published by the Free Software Foundation; either version
17 * 2 of the License, or (at your option) any later version.
18 */
19#ifndef _LINUX_IF_TR_H
20#define _LINUX_IF_TR_H
21
22#include <linux/types.h>
23#include <asm/byteorder.h> /* For __be16 */
24
25/* IEEE 802.5 Token-Ring magic constants. The frame sizes omit the preamble
26 and FCS/CRC (frame check sequence). */
27#define TR_ALEN 6 /* Octets in one token-ring addr */
28#define TR_HLEN (sizeof(struct trh_hdr)+sizeof(struct trllc))
29#define AC 0x10
30#define LLC_FRAME 0x40
31
32/* LLC and SNAP constants */
33#define EXTENDED_SAP 0xAA
34#define UI_CMD 0x03
35
36/* This is an Token-Ring frame header. */
37struct trh_hdr {
38 __u8 ac; /* access control field */
39 __u8 fc; /* frame control field */
40 __u8 daddr[TR_ALEN]; /* destination address */
41 __u8 saddr[TR_ALEN]; /* source address */
42 __be16 rcf; /* route control field */
43 __be16 rseg[8]; /* routing registers */
44};
45
46#ifdef __KERNEL__
47#include <linux/skbuff.h>
48
49static inline struct trh_hdr *tr_hdr(const struct sk_buff *skb)
50{
51 return (struct trh_hdr *)skb_mac_header(skb);
52}
53#endif
54
55/* This is an Token-Ring LLC structure */
56struct trllc {
57 __u8 dsap; /* destination SAP */
58 __u8 ssap; /* source SAP */
59 __u8 llc; /* LLC control field */
60 __u8 protid[3]; /* protocol id */
61 __be16 ethertype; /* ether type field */
62};
63
64/* Token-Ring statistics collection data. */
65struct tr_statistics {
66 unsigned long rx_packets; /* total packets received */
67 unsigned long tx_packets; /* total packets transmitted */
68 unsigned long rx_bytes; /* total bytes received */
69 unsigned long tx_bytes; /* total bytes transmitted */
70 unsigned long rx_errors; /* bad packets received */
71 unsigned long tx_errors; /* packet transmit problems */
72 unsigned long rx_dropped; /* no space in linux buffers */
73 unsigned long tx_dropped; /* no space available in linux */
74 unsigned long multicast; /* multicast packets received */
75 unsigned long transmit_collision;
76
77 /* detailed Token-Ring errors. See IBM Token-Ring Network
78 Architecture for more info */
79
80 unsigned long line_errors;
81 unsigned long internal_errors;
82 unsigned long burst_errors;
83 unsigned long A_C_errors;
84 unsigned long abort_delimiters;
85 unsigned long lost_frames;
86 unsigned long recv_congest_count;
87 unsigned long frame_copied_errors;
88 unsigned long frequency_errors;
89 unsigned long token_errors;
90 unsigned long dummy1;
91};
92
93/* source routing stuff */
94#define TR_RII 0x80
95#define TR_RCF_DIR_BIT 0x80
96#define TR_RCF_LEN_MASK 0x1f00
97#define TR_RCF_BROADCAST 0x8000 /* all-routes broadcast */
98#define TR_RCF_LIMITED_BROADCAST 0xC000 /* single-route broadcast */
99#define TR_RCF_FRAME2K 0x20
100#define TR_RCF_BROADCAST_MASK 0xC000
101#define TR_MAXRIFLEN 18
102
103#endif /* _LINUX_IF_TR_H */
diff --git a/include/linux/iio/buffer.h b/include/linux/iio/buffer.h
new file mode 100644
index 000000000000..fb0fe46fd659
--- /dev/null
+++ b/include/linux/iio/buffer.h
@@ -0,0 +1,191 @@
1/* The industrial I/O core - generic buffer interfaces.
2 *
3 * Copyright (c) 2008 Jonathan Cameron
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 as published by
7 * the Free Software Foundation.
8 */
9
10#ifndef _IIO_BUFFER_GENERIC_H_
11#define _IIO_BUFFER_GENERIC_H_
12#include <linux/sysfs.h>
13#include <linux/iio/iio.h>
14
15#ifdef CONFIG_IIO_BUFFER
16
17struct iio_buffer;
18
19/**
20 * struct iio_buffer_access_funcs - access functions for buffers.
21 * @store_to: actually store stuff to the buffer
22 * @read_first_n: try to get a specified number of bytes (must exist)
23 * @request_update: if a parameter change has been marked, update underlying
24 * storage.
25 * @get_bytes_per_datum:get current bytes per datum
26 * @set_bytes_per_datum:set number of bytes per datum
27 * @get_length: get number of datums in buffer
28 * @set_length: set number of datums in buffer
29 *
30 * The purpose of this structure is to make the buffer element
31 * modular as event for a given driver, different usecases may require
32 * different buffer designs (space efficiency vs speed for example).
33 *
34 * It is worth noting that a given buffer implementation may only support a
35 * small proportion of these functions. The core code 'should' cope fine with
36 * any of them not existing.
37 **/
38struct iio_buffer_access_funcs {
39 int (*store_to)(struct iio_buffer *buffer, u8 *data, s64 timestamp);
40 int (*read_first_n)(struct iio_buffer *buffer,
41 size_t n,
42 char __user *buf);
43
44 int (*request_update)(struct iio_buffer *buffer);
45
46 int (*get_bytes_per_datum)(struct iio_buffer *buffer);
47 int (*set_bytes_per_datum)(struct iio_buffer *buffer, size_t bpd);
48 int (*get_length)(struct iio_buffer *buffer);
49 int (*set_length)(struct iio_buffer *buffer, int length);
50};
51
52/**
53 * struct iio_buffer - general buffer structure
54 * @length: [DEVICE] number of datums in buffer
55 * @bytes_per_datum: [DEVICE] size of individual datum including timestamp
56 * @scan_el_attrs: [DRIVER] control of scan elements if that scan mode
57 * control method is used
58 * @scan_mask: [INTERN] bitmask used in masking scan mode elements
59 * @scan_timestamp: [INTERN] does the scan mode include a timestamp
60 * @access: [DRIVER] buffer access functions associated with the
61 * implementation.
62 * @scan_el_dev_attr_list:[INTERN] list of scan element related attributes.
63 * @scan_el_group: [DRIVER] attribute group for those attributes not
64 * created from the iio_chan_info array.
65 * @pollq: [INTERN] wait queue to allow for polling on the buffer.
66 * @stufftoread: [INTERN] flag to indicate new data.
67 * @demux_list: [INTERN] list of operations required to demux the scan.
68 * @demux_bounce: [INTERN] buffer for doing gather from incoming scan.
69 **/
70struct iio_buffer {
71 int length;
72 int bytes_per_datum;
73 struct attribute_group *scan_el_attrs;
74 long *scan_mask;
75 bool scan_timestamp;
76 const struct iio_buffer_access_funcs *access;
77 struct list_head scan_el_dev_attr_list;
78 struct attribute_group scan_el_group;
79 wait_queue_head_t pollq;
80 bool stufftoread;
81 const struct attribute_group *attrs;
82 struct list_head demux_list;
83 unsigned char *demux_bounce;
84};
85
86/**
87 * iio_buffer_init() - Initialize the buffer structure
88 * @buffer: buffer to be initialized
89 **/
90void iio_buffer_init(struct iio_buffer *buffer);
91
92/**
93 * __iio_update_buffer() - update common elements of buffers
94 * @buffer: buffer that is the event source
95 * @bytes_per_datum: size of individual datum including timestamp
96 * @length: number of datums in buffer
97 **/
98static inline void __iio_update_buffer(struct iio_buffer *buffer,
99 int bytes_per_datum, int length)
100{
101 buffer->bytes_per_datum = bytes_per_datum;
102 buffer->length = length;
103}
104
105int iio_scan_mask_query(struct iio_dev *indio_dev,
106 struct iio_buffer *buffer, int bit);
107
108/**
109 * iio_scan_mask_set() - set particular bit in the scan mask
110 * @buffer: the buffer whose scan mask we are interested in
111 * @bit: the bit to be set.
112 **/
113int iio_scan_mask_set(struct iio_dev *indio_dev,
114 struct iio_buffer *buffer, int bit);
115
116/**
117 * iio_push_to_buffer() - push to a registered buffer.
118 * @buffer: IIO buffer structure for device
119 * @scan: Full scan.
120 * @timestamp:
121 */
122int iio_push_to_buffer(struct iio_buffer *buffer, unsigned char *data,
123 s64 timestamp);
124
125int iio_update_demux(struct iio_dev *indio_dev);
126
127/**
128 * iio_buffer_register() - register the buffer with IIO core
129 * @indio_dev: device with the buffer to be registered
130 **/
131int iio_buffer_register(struct iio_dev *indio_dev,
132 const struct iio_chan_spec *channels,
133 int num_channels);
134
135/**
136 * iio_buffer_unregister() - unregister the buffer from IIO core
137 * @indio_dev: the device with the buffer to be unregistered
138 **/
139void iio_buffer_unregister(struct iio_dev *indio_dev);
140
141/**
142 * iio_buffer_read_length() - attr func to get number of datums in the buffer
143 **/
144ssize_t iio_buffer_read_length(struct device *dev,
145 struct device_attribute *attr,
146 char *buf);
147/**
148 * iio_buffer_write_length() - attr func to set number of datums in the buffer
149 **/
150ssize_t iio_buffer_write_length(struct device *dev,
151 struct device_attribute *attr,
152 const char *buf,
153 size_t len);
154/**
155 * iio_buffer_store_enable() - attr to turn the buffer on
156 **/
157ssize_t iio_buffer_store_enable(struct device *dev,
158 struct device_attribute *attr,
159 const char *buf,
160 size_t len);
161/**
162 * iio_buffer_show_enable() - attr to see if the buffer is on
163 **/
164ssize_t iio_buffer_show_enable(struct device *dev,
165 struct device_attribute *attr,
166 char *buf);
167#define IIO_BUFFER_LENGTH_ATTR DEVICE_ATTR(length, S_IRUGO | S_IWUSR, \
168 iio_buffer_read_length, \
169 iio_buffer_write_length)
170
171#define IIO_BUFFER_ENABLE_ATTR DEVICE_ATTR(enable, S_IRUGO | S_IWUSR, \
172 iio_buffer_show_enable, \
173 iio_buffer_store_enable)
174
175int iio_sw_buffer_preenable(struct iio_dev *indio_dev);
176
177#else /* CONFIG_IIO_BUFFER */
178
179static inline int iio_buffer_register(struct iio_dev *indio_dev,
180 struct iio_chan_spec *channels,
181 int num_channels)
182{
183 return 0;
184}
185
186static inline void iio_buffer_unregister(struct iio_dev *indio_dev)
187{};
188
189#endif /* CONFIG_IIO_BUFFER */
190
191#endif /* _IIO_BUFFER_GENERIC_H_ */
diff --git a/include/linux/iio/consumer.h b/include/linux/iio/consumer.h
new file mode 100644
index 000000000000..1a15e560a5a1
--- /dev/null
+++ b/include/linux/iio/consumer.h
@@ -0,0 +1,96 @@
1/*
2 * Industrial I/O in kernel consumer interface
3 *
4 * Copyright (c) 2011 Jonathan Cameron
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published by
8 * the Free Software Foundation.
9 */
10#ifndef _IIO_INKERN_CONSUMER_H_
11#define _IIO_INKERN_CONSUMER_H
12#include <linux/iio/types.h>
13
14struct iio_dev;
15struct iio_chan_spec;
16
17/**
18 * struct iio_channel - everything needed for a consumer to use a channel
19 * @indio_dev: Device on which the channel exists.
20 * @channel: Full description of the channel.
21 */
22struct iio_channel {
23 struct iio_dev *indio_dev;
24 const struct iio_chan_spec *channel;
25};
26
27/**
28 * iio_channel_get() - get description of all that is needed to access channel.
29 * @name: Unique name of the device as provided in the iio_map
30 * with which the desired provider to consumer mapping
31 * was registered.
32 * @consumer_channel: Unique name to identify the channel on the consumer
33 * side. This typically describes the channels use within
34 * the consumer. E.g. 'battery_voltage'
35 */
36struct iio_channel *iio_st_channel_get(const char *name,
37 const char *consumer_channel);
38
39/**
40 * iio_st_channel_release() - release channels obtained via iio_st_channel_get
41 * @chan: The channel to be released.
42 */
43void iio_st_channel_release(struct iio_channel *chan);
44
45/**
46 * iio_st_channel_get_all() - get all channels associated with a client
47 * @name: name of consumer device.
48 *
49 * Returns an array of iio_channel structures terminated with one with
50 * null iio_dev pointer.
51 * This function is used by fairly generic consumers to get all the
52 * channels registered as having this consumer.
53 */
54struct iio_channel *iio_st_channel_get_all(const char *name);
55
56/**
57 * iio_st_channel_release_all() - reverse iio_st_get_all
58 * @chan: Array of channels to be released.
59 */
60void iio_st_channel_release_all(struct iio_channel *chan);
61
62/**
63 * iio_st_read_channel_raw() - read from a given channel
64 * @channel: The channel being queried.
65 * @val: Value read back.
66 *
67 * Note raw reads from iio channels are in adc counts and hence
68 * scale will need to be applied if standard units required.
69 */
70int iio_st_read_channel_raw(struct iio_channel *chan,
71 int *val);
72
73/**
74 * iio_st_get_channel_type() - get the type of a channel
75 * @channel: The channel being queried.
76 * @type: The type of the channel.
77 *
78 * returns the enum iio_chan_type of the channel
79 */
80int iio_st_get_channel_type(struct iio_channel *channel,
81 enum iio_chan_type *type);
82
83/**
84 * iio_st_read_channel_scale() - read the scale value for a channel
85 * @channel: The channel being queried.
86 * @val: First part of value read back.
87 * @val2: Second part of value read back.
88 *
89 * Note returns a description of what is in val and val2, such
90 * as IIO_VAL_INT_PLUS_MICRO telling us we have a value of val
91 * + val2/1e6
92 */
93int iio_st_read_channel_scale(struct iio_channel *chan, int *val,
94 int *val2);
95
96#endif
diff --git a/include/linux/iio/driver.h b/include/linux/iio/driver.h
new file mode 100644
index 000000000000..a4f8b2e05af5
--- /dev/null
+++ b/include/linux/iio/driver.h
@@ -0,0 +1,34 @@
1/*
2 * Industrial I/O in kernel access map interface.
3 *
4 * Copyright (c) 2011 Jonathan Cameron
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published by
8 * the Free Software Foundation.
9 */
10
11#ifndef _IIO_INKERN_H_
12#define _IIO_INKERN_H_
13
14struct iio_map;
15
16/**
17 * iio_map_array_register() - tell the core about inkernel consumers
18 * @indio_dev: provider device
19 * @map: array of mappings specifying association of channel with client
20 */
21int iio_map_array_register(struct iio_dev *indio_dev,
22 struct iio_map *map);
23
24/**
25 * iio_map_array_unregister() - tell the core to remove consumer mappings
26 * @indio_dev: provider device
27 * @map: array of mappings to remove. Note these must have same memory
28 * addresses as those originally added not just equal parameter
29 * values.
30 */
31int iio_map_array_unregister(struct iio_dev *indio_dev,
32 struct iio_map *map);
33
34#endif
diff --git a/include/linux/iio/events.h b/include/linux/iio/events.h
new file mode 100644
index 000000000000..b5acbf93c5da
--- /dev/null
+++ b/include/linux/iio/events.h
@@ -0,0 +1,105 @@
1/* The industrial I/O - event passing to userspace
2 *
3 * Copyright (c) 2008-2011 Jonathan Cameron
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 as published by
7 * the Free Software Foundation.
8 */
9#ifndef _IIO_EVENTS_H_
10#define _IIO_EVENTS_H_
11
12#include <linux/ioctl.h>
13#include <linux/types.h>
14#include <linux/iio/types.h>
15
16/**
17 * struct iio_event_data - The actual event being pushed to userspace
18 * @id: event identifier
19 * @timestamp: best estimate of time of event occurrence (often from
20 * the interrupt handler)
21 */
22struct iio_event_data {
23 __u64 id;
24 __s64 timestamp;
25};
26
27#define IIO_GET_EVENT_FD_IOCTL _IOR('i', 0x90, int)
28
29enum iio_event_type {
30 IIO_EV_TYPE_THRESH,
31 IIO_EV_TYPE_MAG,
32 IIO_EV_TYPE_ROC,
33 IIO_EV_TYPE_THRESH_ADAPTIVE,
34 IIO_EV_TYPE_MAG_ADAPTIVE,
35};
36
37enum iio_event_direction {
38 IIO_EV_DIR_EITHER,
39 IIO_EV_DIR_RISING,
40 IIO_EV_DIR_FALLING,
41};
42
43/**
44 * IIO_EVENT_CODE() - create event identifier
45 * @chan_type: Type of the channel. Should be one of enum iio_chan_type.
46 * @diff: Whether the event is for an differential channel or not.
47 * @modifier: Modifier for the channel. Should be one of enum iio_modifier.
48 * @direction: Direction of the event. One of enum iio_event_direction.
49 * @type: Type of the event. Should be one enum iio_event_type.
50 * @chan: Channel number for non-differential channels.
51 * @chan1: First channel number for differential channels.
52 * @chan2: Second channel number for differential channels.
53 */
54
55#define IIO_EVENT_CODE(chan_type, diff, modifier, direction, \
56 type, chan, chan1, chan2) \
57 (((u64)type << 56) | ((u64)diff << 55) | \
58 ((u64)direction << 48) | ((u64)modifier << 40) | \
59 ((u64)chan_type << 32) | (((u16)chan2) << 16) | ((u16)chan1) | \
60 ((u16)chan))
61
62
63#define IIO_EV_DIR_MAX 4
64#define IIO_EV_BIT(type, direction) \
65 (1 << (type*IIO_EV_DIR_MAX + direction))
66
67/**
68 * IIO_MOD_EVENT_CODE() - create event identifier for modified channels
69 * @chan_type: Type of the channel. Should be one of enum iio_chan_type.
70 * @number: Channel number.
71 * @modifier: Modifier for the channel. Should be one of enum iio_modifier.
72 * @type: Type of the event. Should be one enum iio_event_type.
73 * @direction: Direction of the event. One of enum iio_event_direction.
74 */
75
76#define IIO_MOD_EVENT_CODE(chan_type, number, modifier, \
77 type, direction) \
78 IIO_EVENT_CODE(chan_type, 0, modifier, direction, type, number, 0, 0)
79
80/**
81 * IIO_UNMOD_EVENT_CODE() - create event identifier for unmodified channels
82 * @chan_type: Type of the channel. Should be one of enum iio_chan_type.
83 * @number: Channel number.
84 * @type: Type of the event. Should be one enum iio_event_type.
85 * @direction: Direction of the event. One of enum iio_event_direction.
86 */
87
88#define IIO_UNMOD_EVENT_CODE(chan_type, number, type, direction) \
89 IIO_EVENT_CODE(chan_type, 0, 0, direction, type, number, 0, 0)
90
91#define IIO_EVENT_CODE_EXTRACT_TYPE(mask) ((mask >> 56) & 0xFF)
92
93#define IIO_EVENT_CODE_EXTRACT_DIR(mask) ((mask >> 48) & 0xCF)
94
95#define IIO_EVENT_CODE_EXTRACT_CHAN_TYPE(mask) ((mask >> 32) & 0xFF)
96
97/* Event code number extraction depends on which type of event we have.
98 * Perhaps review this function in the future*/
99#define IIO_EVENT_CODE_EXTRACT_CHAN(mask) ((__s16)(mask & 0xFFFF))
100#define IIO_EVENT_CODE_EXTRACT_CHAN2(mask) ((__s16)(((mask) >> 16) & 0xFFFF))
101
102#define IIO_EVENT_CODE_EXTRACT_MODIFIER(mask) ((mask >> 40) & 0xFF)
103#define IIO_EVENT_CODE_EXTRACT_DIFF(mask) (((mask) >> 55) & 0x1)
104
105#endif
diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h
new file mode 100644
index 000000000000..3a4f6a3ab80d
--- /dev/null
+++ b/include/linux/iio/iio.h
@@ -0,0 +1,492 @@
1
2/* The industrial I/O core
3 *
4 * Copyright (c) 2008 Jonathan Cameron
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published by
8 * the Free Software Foundation.
9 */
10#ifndef _INDUSTRIAL_IO_H_
11#define _INDUSTRIAL_IO_H_
12
13#include <linux/device.h>
14#include <linux/cdev.h>
15#include <linux/iio/types.h>
16/* IIO TODO LIST */
17/*
18 * Provide means of adjusting timer accuracy.
19 * Currently assumes nano seconds.
20 */
21
22enum iio_chan_info_enum {
23 IIO_CHAN_INFO_RAW = 0,
24 IIO_CHAN_INFO_PROCESSED,
25 IIO_CHAN_INFO_SCALE,
26 IIO_CHAN_INFO_OFFSET,
27 IIO_CHAN_INFO_CALIBSCALE,
28 IIO_CHAN_INFO_CALIBBIAS,
29 IIO_CHAN_INFO_PEAK,
30 IIO_CHAN_INFO_PEAK_SCALE,
31 IIO_CHAN_INFO_QUADRATURE_CORRECTION_RAW,
32 IIO_CHAN_INFO_AVERAGE_RAW,
33 IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY,
34 IIO_CHAN_INFO_SAMP_FREQ,
35 IIO_CHAN_INFO_FREQUENCY,
36 IIO_CHAN_INFO_PHASE,
37 IIO_CHAN_INFO_HARDWAREGAIN,
38};
39
40#define IIO_CHAN_INFO_SHARED_BIT(type) BIT(type*2)
41#define IIO_CHAN_INFO_SEPARATE_BIT(type) BIT(type*2 + 1)
42
43#define IIO_CHAN_INFO_RAW_SEPARATE_BIT \
44 IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_RAW)
45#define IIO_CHAN_INFO_PROCESSED_SEPARATE_BIT \
46 IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_PROCESSED)
47#define IIO_CHAN_INFO_SCALE_SEPARATE_BIT \
48 IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_SCALE)
49#define IIO_CHAN_INFO_SCALE_SHARED_BIT \
50 IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_SCALE)
51#define IIO_CHAN_INFO_OFFSET_SEPARATE_BIT \
52 IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_OFFSET)
53#define IIO_CHAN_INFO_OFFSET_SHARED_BIT \
54 IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_OFFSET)
55#define IIO_CHAN_INFO_CALIBSCALE_SEPARATE_BIT \
56 IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_CALIBSCALE)
57#define IIO_CHAN_INFO_CALIBSCALE_SHARED_BIT \
58 IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_CALIBSCALE)
59#define IIO_CHAN_INFO_CALIBBIAS_SEPARATE_BIT \
60 IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_CALIBBIAS)
61#define IIO_CHAN_INFO_CALIBBIAS_SHARED_BIT \
62 IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_CALIBBIAS)
63#define IIO_CHAN_INFO_PEAK_SEPARATE_BIT \
64 IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_PEAK)
65#define IIO_CHAN_INFO_PEAK_SHARED_BIT \
66 IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_PEAK)
67#define IIO_CHAN_INFO_PEAKSCALE_SEPARATE_BIT \
68 IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_PEAKSCALE)
69#define IIO_CHAN_INFO_PEAKSCALE_SHARED_BIT \
70 IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_PEAKSCALE)
71#define IIO_CHAN_INFO_QUADRATURE_CORRECTION_RAW_SEPARATE_BIT \
72 IIO_CHAN_INFO_SEPARATE_BIT( \
73 IIO_CHAN_INFO_QUADRATURE_CORRECTION_RAW)
74#define IIO_CHAN_INFO_QUADRATURE_CORRECTION_RAW_SHARED_BIT \
75 IIO_CHAN_INFO_SHARED_BIT( \
76 IIO_CHAN_INFO_QUADRATURE_CORRECTION_RAW)
77#define IIO_CHAN_INFO_AVERAGE_RAW_SEPARATE_BIT \
78 IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_AVERAGE_RAW)
79#define IIO_CHAN_INFO_AVERAGE_RAW_SHARED_BIT \
80 IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_AVERAGE_RAW)
81#define IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY_SHARED_BIT \
82 IIO_CHAN_INFO_SHARED_BIT( \
83 IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY)
84#define IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY_SEPARATE_BIT \
85 IIO_CHAN_INFO_SEPARATE_BIT( \
86 IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY)
87#define IIO_CHAN_INFO_SAMP_FREQ_SEPARATE_BIT \
88 IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_SAMP_FREQ)
89#define IIO_CHAN_INFO_SAMP_FREQ_SHARED_BIT \
90 IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_SAMP_FREQ)
91#define IIO_CHAN_INFO_FREQUENCY_SEPARATE_BIT \
92 IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_FREQUENCY)
93#define IIO_CHAN_INFO_FREQUENCY_SHARED_BIT \
94 IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_FREQUENCY)
95#define IIO_CHAN_INFO_PHASE_SEPARATE_BIT \
96 IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_PHASE)
97#define IIO_CHAN_INFO_PHASE_SHARED_BIT \
98 IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_PHASE)
99#define IIO_CHAN_INFO_HARDWAREGAIN_SEPARATE_BIT \
100 IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_HARDWAREGAIN)
101#define IIO_CHAN_INFO_HARDWAREGAIN_SHARED_BIT \
102 IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_HARDWAREGAIN)
103
104enum iio_endian {
105 IIO_CPU,
106 IIO_BE,
107 IIO_LE,
108};
109
110struct iio_chan_spec;
111struct iio_dev;
112
113/**
114 * struct iio_chan_spec_ext_info - Extended channel info attribute
115 * @name: Info attribute name
116 * @shared: Whether this attribute is shared between all channels.
117 * @read: Read callback for this info attribute, may be NULL.
118 * @write: Write callback for this info attribute, may be NULL.
119 * @private: Data private to the driver.
120 */
121struct iio_chan_spec_ext_info {
122 const char *name;
123 bool shared;
124 ssize_t (*read)(struct iio_dev *, uintptr_t private,
125 struct iio_chan_spec const *, char *buf);
126 ssize_t (*write)(struct iio_dev *, uintptr_t private,
127 struct iio_chan_spec const *, const char *buf,
128 size_t len);
129 uintptr_t private;
130};
131
132/**
133 * struct iio_chan_spec - specification of a single channel
134 * @type: What type of measurement is the channel making.
135 * @channel: What number or name do we wish to assign the channel.
136 * @channel2: If there is a second number for a differential
137 * channel then this is it. If modified is set then the
138 * value here specifies the modifier.
139 * @address: Driver specific identifier.
140 * @scan_index: Monotonic index to give ordering in scans when read
141 * from a buffer.
142 * @scan_type: Sign: 's' or 'u' to specify signed or unsigned
143 * realbits: Number of valid bits of data
144 * storage_bits: Realbits + padding
145 * shift: Shift right by this before masking out
146 * realbits.
147 * endianness: little or big endian
148 * @info_mask: What information is to be exported about this channel.
149 * This includes calibbias, scale etc.
150 * @event_mask: What events can this channel produce.
151 * @ext_info: Array of extended info attributes for this channel.
152 * The array is NULL terminated, the last element should
153 * have it's name field set to NULL.
154 * @extend_name: Allows labeling of channel attributes with an
155 * informative name. Note this has no effect codes etc,
156 * unlike modifiers.
157 * @datasheet_name: A name used in in kernel mapping of channels. It should
158 * correspond to the first name that the channel is referred
159 * to by in the datasheet (e.g. IND), or the nearest
160 * possible compound name (e.g. IND-INC).
161 * @modified: Does a modifier apply to this channel. What these are
162 * depends on the channel type. Modifier is set in
163 * channel2. Examples are IIO_MOD_X for axial sensors about
164 * the 'x' axis.
165 * @indexed: Specify the channel has a numerical index. If not,
166 * the value in channel will be suppressed for attribute
167 * but not for event codes. Typically set it to 0 when
168 * the index is false.
169 * @differential: Channel is differential.
170 */
171struct iio_chan_spec {
172 enum iio_chan_type type;
173 int channel;
174 int channel2;
175 unsigned long address;
176 int scan_index;
177 struct {
178 char sign;
179 u8 realbits;
180 u8 storagebits;
181 u8 shift;
182 enum iio_endian endianness;
183 } scan_type;
184 long info_mask;
185 long event_mask;
186 const struct iio_chan_spec_ext_info *ext_info;
187 const char *extend_name;
188 const char *datasheet_name;
189 unsigned modified:1;
190 unsigned indexed:1;
191 unsigned output:1;
192 unsigned differential:1;
193};
194
195#define IIO_ST(si, rb, sb, sh) \
196 { .sign = si, .realbits = rb, .storagebits = sb, .shift = sh }
197
198#define IIO_CHAN_SOFT_TIMESTAMP(_si) \
199 { .type = IIO_TIMESTAMP, .channel = -1, \
200 .scan_index = _si, .scan_type = IIO_ST('s', 64, 64, 0) }
201
202/**
203 * iio_get_time_ns() - utility function to get a time stamp for events etc
204 **/
205static inline s64 iio_get_time_ns(void)
206{
207 struct timespec ts;
208 /*
209 * calls getnstimeofday.
210 * If hrtimers then up to ns accurate, if not microsecond.
211 */
212 ktime_get_real_ts(&ts);
213
214 return timespec_to_ns(&ts);
215}
216
217/* Device operating modes */
218#define INDIO_DIRECT_MODE 0x01
219#define INDIO_BUFFER_TRIGGERED 0x02
220#define INDIO_BUFFER_HARDWARE 0x08
221
222#define INDIO_ALL_BUFFER_MODES \
223 (INDIO_BUFFER_TRIGGERED | INDIO_BUFFER_HARDWARE)
224
225struct iio_trigger; /* forward declaration */
226struct iio_dev;
227
228/**
229 * struct iio_info - constant information about device
230 * @driver_module: module structure used to ensure correct
231 * ownership of chrdevs etc
232 * @event_attrs: event control attributes
233 * @attrs: general purpose device attributes
234 * @read_raw: function to request a value from the device.
235 * mask specifies which value. Note 0 means a reading of
236 * the channel in question. Return value will specify the
237 * type of value returned by the device. val and val2 will
238 * contain the elements making up the returned value.
239 * @write_raw: function to write a value to the device.
240 * Parameters are the same as for read_raw.
241 * @write_raw_get_fmt: callback function to query the expected
242 * format/precision. If not set by the driver, write_raw
243 * returns IIO_VAL_INT_PLUS_MICRO.
244 * @read_event_config: find out if the event is enabled.
245 * @write_event_config: set if the event is enabled.
246 * @read_event_value: read a value associated with the event. Meaning
247 * is event dependant. event_code specifies which event.
248 * @write_event_value: write the value associated with the event.
249 * Meaning is event dependent.
250 * @validate_trigger: function to validate the trigger when the
251 * current trigger gets changed.
252 **/
253struct iio_info {
254 struct module *driver_module;
255 struct attribute_group *event_attrs;
256 const struct attribute_group *attrs;
257
258 int (*read_raw)(struct iio_dev *indio_dev,
259 struct iio_chan_spec const *chan,
260 int *val,
261 int *val2,
262 long mask);
263
264 int (*write_raw)(struct iio_dev *indio_dev,
265 struct iio_chan_spec const *chan,
266 int val,
267 int val2,
268 long mask);
269
270 int (*write_raw_get_fmt)(struct iio_dev *indio_dev,
271 struct iio_chan_spec const *chan,
272 long mask);
273
274 int (*read_event_config)(struct iio_dev *indio_dev,
275 u64 event_code);
276
277 int (*write_event_config)(struct iio_dev *indio_dev,
278 u64 event_code,
279 int state);
280
281 int (*read_event_value)(struct iio_dev *indio_dev,
282 u64 event_code,
283 int *val);
284 int (*write_event_value)(struct iio_dev *indio_dev,
285 u64 event_code,
286 int val);
287 int (*validate_trigger)(struct iio_dev *indio_dev,
288 struct iio_trigger *trig);
289 int (*update_scan_mode)(struct iio_dev *indio_dev,
290 const unsigned long *scan_mask);
291 int (*debugfs_reg_access)(struct iio_dev *indio_dev,
292 unsigned reg, unsigned writeval,
293 unsigned *readval);
294};
295
296/**
297 * struct iio_buffer_setup_ops - buffer setup related callbacks
298 * @preenable: [DRIVER] function to run prior to marking buffer enabled
299 * @postenable: [DRIVER] function to run after marking buffer enabled
300 * @predisable: [DRIVER] function to run prior to marking buffer
301 * disabled
302 * @postdisable: [DRIVER] function to run after marking buffer disabled
303 */
304struct iio_buffer_setup_ops {
305 int (*preenable)(struct iio_dev *);
306 int (*postenable)(struct iio_dev *);
307 int (*predisable)(struct iio_dev *);
308 int (*postdisable)(struct iio_dev *);
309};
310
311/**
312 * struct iio_dev - industrial I/O device
313 * @id: [INTERN] used to identify device internally
314 * @modes: [DRIVER] operating modes supported by device
315 * @currentmode: [DRIVER] current operating mode
316 * @dev: [DRIVER] device structure, should be assigned a parent
317 * and owner
318 * @event_interface: [INTERN] event chrdevs associated with interrupt lines
319 * @buffer: [DRIVER] any buffer present
320 * @scan_bytes: [INTERN] num bytes captured to be fed to buffer demux
321 * @mlock: [INTERN] lock used to prevent simultaneous device state
322 * changes
323 * @available_scan_masks: [DRIVER] optional array of allowed bitmasks
324 * @masklength: [INTERN] the length of the mask established from
325 * channels
326 * @active_scan_mask: [INTERN] union of all scan masks requested by buffers
327 * @scan_timestamp: [INTERN] set if any buffers have requested timestamp
328 * @scan_index_timestamp:[INTERN] cache of the index to the timestamp
329 * @trig: [INTERN] current device trigger (buffer modes)
330 * @pollfunc: [DRIVER] function run on trigger being received
331 * @channels: [DRIVER] channel specification structure table
332 * @num_channels: [DRIVER] number of chanels specified in @channels.
333 * @channel_attr_list: [INTERN] keep track of automatically created channel
334 * attributes
335 * @chan_attr_group: [INTERN] group for all attrs in base directory
336 * @name: [DRIVER] name of the device.
337 * @info: [DRIVER] callbacks and constant info from driver
338 * @info_exist_lock: [INTERN] lock to prevent use during removal
339 * @setup_ops: [DRIVER] callbacks to call before and after buffer
340 * enable/disable
341 * @chrdev: [INTERN] associated character device
342 * @groups: [INTERN] attribute groups
343 * @groupcounter: [INTERN] index of next attribute group
344 * @flags: [INTERN] file ops related flags including busy flag.
345 * @debugfs_dentry: [INTERN] device specific debugfs dentry.
346 * @cached_reg_addr: [INTERN] cached register address for debugfs reads.
347 */
348struct iio_dev {
349 int id;
350
351 int modes;
352 int currentmode;
353 struct device dev;
354
355 struct iio_event_interface *event_interface;
356
357 struct iio_buffer *buffer;
358 int scan_bytes;
359 struct mutex mlock;
360
361 const unsigned long *available_scan_masks;
362 unsigned masklength;
363 const unsigned long *active_scan_mask;
364 bool scan_timestamp;
365 unsigned scan_index_timestamp;
366 struct iio_trigger *trig;
367 struct iio_poll_func *pollfunc;
368
369 struct iio_chan_spec const *channels;
370 int num_channels;
371
372 struct list_head channel_attr_list;
373 struct attribute_group chan_attr_group;
374 const char *name;
375 const struct iio_info *info;
376 struct mutex info_exist_lock;
377 const struct iio_buffer_setup_ops *setup_ops;
378 struct cdev chrdev;
379#define IIO_MAX_GROUPS 6
380 const struct attribute_group *groups[IIO_MAX_GROUPS + 1];
381 int groupcounter;
382
383 unsigned long flags;
384#if defined(CONFIG_DEBUG_FS)
385 struct dentry *debugfs_dentry;
386 unsigned cached_reg_addr;
387#endif
388};
389
390/**
391 * iio_find_channel_from_si() - get channel from its scan index
392 * @indio_dev: device
393 * @si: scan index to match
394 */
395const struct iio_chan_spec
396*iio_find_channel_from_si(struct iio_dev *indio_dev, int si);
397
398/**
399 * iio_device_register() - register a device with the IIO subsystem
400 * @indio_dev: Device structure filled by the device driver
401 **/
402int iio_device_register(struct iio_dev *indio_dev);
403
404/**
405 * iio_device_unregister() - unregister a device from the IIO subsystem
406 * @indio_dev: Device structure representing the device.
407 **/
408void iio_device_unregister(struct iio_dev *indio_dev);
409
410/**
411 * iio_push_event() - try to add event to the list for userspace reading
412 * @indio_dev: IIO device structure
413 * @ev_code: What event
414 * @timestamp: When the event occurred
415 **/
416int iio_push_event(struct iio_dev *indio_dev, u64 ev_code, s64 timestamp);
417
418extern struct bus_type iio_bus_type;
419
420/**
421 * iio_device_put() - reference counted deallocation of struct device
422 * @dev: the iio_device containing the device
423 **/
424static inline void iio_device_put(struct iio_dev *indio_dev)
425{
426 if (indio_dev)
427 put_device(&indio_dev->dev);
428};
429
430/**
431 * dev_to_iio_dev() - Get IIO device struct from a device struct
432 * @dev: The device embedded in the IIO device
433 *
434 * Note: The device must be a IIO device, otherwise the result is undefined.
435 */
436static inline struct iio_dev *dev_to_iio_dev(struct device *dev)
437{
438 return container_of(dev, struct iio_dev, dev);
439}
440
441/* Can we make this smaller? */
442#define IIO_ALIGN L1_CACHE_BYTES
443/**
444 * iio_device_alloc() - allocate an iio_dev from a driver
445 * @sizeof_priv: Space to allocate for private structure.
446 **/
447struct iio_dev *iio_device_alloc(int sizeof_priv);
448
449static inline void *iio_priv(const struct iio_dev *indio_dev)
450{
451 return (char *)indio_dev + ALIGN(sizeof(struct iio_dev), IIO_ALIGN);
452}
453
454static inline struct iio_dev *iio_priv_to_dev(void *priv)
455{
456 return (struct iio_dev *)((char *)priv -
457 ALIGN(sizeof(struct iio_dev), IIO_ALIGN));
458}
459
460/**
461 * iio_device_free() - free an iio_dev from a driver
462 * @dev: the iio_dev associated with the device
463 **/
464void iio_device_free(struct iio_dev *indio_dev);
465
466/**
467 * iio_buffer_enabled() - helper function to test if the buffer is enabled
468 * @indio_dev: IIO device info structure for device
469 **/
470static inline bool iio_buffer_enabled(struct iio_dev *indio_dev)
471{
472 return indio_dev->currentmode
473 & (INDIO_BUFFER_TRIGGERED | INDIO_BUFFER_HARDWARE);
474};
475
476/**
477 * iio_get_debugfs_dentry() - helper function to get the debugfs_dentry
478 * @indio_dev: IIO device info structure for device
479 **/
480#if defined(CONFIG_DEBUG_FS)
481static inline struct dentry *iio_get_debugfs_dentry(struct iio_dev *indio_dev)
482{
483 return indio_dev->debugfs_dentry;
484};
485#else
486static inline struct dentry *iio_get_debugfs_dentry(struct iio_dev *indio_dev)
487{
488 return NULL;
489};
490#endif
491
492#endif /* _INDUSTRIAL_IO_H_ */
diff --git a/include/linux/iio/kfifo_buf.h b/include/linux/iio/kfifo_buf.h
new file mode 100644
index 000000000000..014d5a13b32b
--- /dev/null
+++ b/include/linux/iio/kfifo_buf.h
@@ -0,0 +1,8 @@
1
2#include <linux/kfifo.h>
3#include <linux/iio/iio.h>
4#include <linux/iio/buffer.h>
5
6struct iio_buffer *iio_kfifo_allocate(struct iio_dev *indio_dev);
7void iio_kfifo_free(struct iio_buffer *r);
8
diff --git a/include/linux/iio/machine.h b/include/linux/iio/machine.h
new file mode 100644
index 000000000000..0b1f19bfdc44
--- /dev/null
+++ b/include/linux/iio/machine.h
@@ -0,0 +1,24 @@
1/*
2 * Industrial I/O in kernel access map definitions for board files.
3 *
4 * Copyright (c) 2011 Jonathan Cameron
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published by
8 * the Free Software Foundation.
9 */
10
11/**
12 * struct iio_map - description of link between consumer and device channels
13 * @adc_channel_label: Label used to identify the channel on the provider.
14 * This is matched against the datasheet_name element
15 * of struct iio_chan_spec.
16 * @consumer_dev_name: Name to uniquely identify the consumer device.
17 * @consumer_channel: Unique name used to idenitify the channel on the
18 * consumer side.
19 */
20struct iio_map {
21 const char *adc_channel_label;
22 const char *consumer_dev_name;
23 const char *consumer_channel;
24};
diff --git a/include/linux/iio/sysfs.h b/include/linux/iio/sysfs.h
new file mode 100644
index 000000000000..bfedb73b850e
--- /dev/null
+++ b/include/linux/iio/sysfs.h
@@ -0,0 +1,117 @@
1/* The industrial I/O core
2 *
3 *Copyright (c) 2008 Jonathan Cameron
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 as published by
7 * the Free Software Foundation.
8 *
9 * General attributes
10 */
11
12#ifndef _INDUSTRIAL_IO_SYSFS_H_
13#define _INDUSTRIAL_IO_SYSFS_H_
14
15struct iio_chan_spec;
16
17/**
18 * struct iio_dev_attr - iio specific device attribute
19 * @dev_attr: underlying device attribute
20 * @address: associated register address
21 * @l: list head for maintaining list of dynamically created attrs.
22 */
23struct iio_dev_attr {
24 struct device_attribute dev_attr;
25 u64 address;
26 struct list_head l;
27 struct iio_chan_spec const *c;
28};
29
30#define to_iio_dev_attr(_dev_attr) \
31 container_of(_dev_attr, struct iio_dev_attr, dev_attr)
32
33ssize_t iio_read_const_attr(struct device *dev,
34 struct device_attribute *attr,
35 char *len);
36
37/**
38 * struct iio_const_attr - constant device specific attribute
39 * often used for things like available modes
40 * @string: attribute string
41 * @dev_attr: underlying device attribute
42 */
43struct iio_const_attr {
44 const char *string;
45 struct device_attribute dev_attr;
46};
47
48#define to_iio_const_attr(_dev_attr) \
49 container_of(_dev_attr, struct iio_const_attr, dev_attr)
50
51/* Some attributes will be hard coded (device dependent) and not require an
52 address, in these cases pass a negative */
53#define IIO_ATTR(_name, _mode, _show, _store, _addr) \
54 { .dev_attr = __ATTR(_name, _mode, _show, _store), \
55 .address = _addr }
56
57#define IIO_DEVICE_ATTR(_name, _mode, _show, _store, _addr) \
58 struct iio_dev_attr iio_dev_attr_##_name \
59 = IIO_ATTR(_name, _mode, _show, _store, _addr)
60
61#define IIO_DEVICE_ATTR_NAMED(_vname, _name, _mode, _show, _store, _addr) \
62 struct iio_dev_attr iio_dev_attr_##_vname \
63 = IIO_ATTR(_name, _mode, _show, _store, _addr)
64
65#define IIO_CONST_ATTR(_name, _string) \
66 struct iio_const_attr iio_const_attr_##_name \
67 = { .string = _string, \
68 .dev_attr = __ATTR(_name, S_IRUGO, iio_read_const_attr, NULL)}
69
70#define IIO_CONST_ATTR_NAMED(_vname, _name, _string) \
71 struct iio_const_attr iio_const_attr_##_vname \
72 = { .string = _string, \
73 .dev_attr = __ATTR(_name, S_IRUGO, iio_read_const_attr, NULL)}
74
75/* Generic attributes of onetype or another */
76/**
77 * IIO_DEV_ATTR_RESET: resets the device
78 **/
79#define IIO_DEV_ATTR_RESET(_store) \
80 IIO_DEVICE_ATTR(reset, S_IWUSR, NULL, _store, 0)
81
82/**
83 * IIO_DEV_ATTR_SAMP_FREQ - sets any internal clock frequency
84 * @_mode: sysfs file mode/permissions
85 * @_show: output method for the attribute
86 * @_store: input method for the attribute
87 **/
88#define IIO_DEV_ATTR_SAMP_FREQ(_mode, _show, _store) \
89 IIO_DEVICE_ATTR(sampling_frequency, _mode, _show, _store, 0)
90
91/**
92 * IIO_DEV_ATTR_SAMP_FREQ_AVAIL - list available sampling frequencies
93 * @_show: output method for the attribute
94 *
95 * May be mode dependent on some devices
96 **/
97#define IIO_DEV_ATTR_SAMP_FREQ_AVAIL(_show) \
98 IIO_DEVICE_ATTR(sampling_frequency_available, S_IRUGO, _show, NULL, 0)
99/**
100 * IIO_CONST_ATTR_AVAIL_SAMP_FREQ - list available sampling frequencies
101 * @_string: frequency string for the attribute
102 *
103 * Constant version
104 **/
105#define IIO_CONST_ATTR_SAMP_FREQ_AVAIL(_string) \
106 IIO_CONST_ATTR(sampling_frequency_available, _string)
107
108#define IIO_DEV_ATTR_TEMP_RAW(_show) \
109 IIO_DEVICE_ATTR(in_temp_raw, S_IRUGO, _show, NULL, 0)
110
111#define IIO_CONST_ATTR_TEMP_OFFSET(_string) \
112 IIO_CONST_ATTR(in_temp_offset, _string)
113
114#define IIO_CONST_ATTR_TEMP_SCALE(_string) \
115 IIO_CONST_ATTR(in_temp_scale, _string)
116
117#endif /* _INDUSTRIAL_IO_SYSFS_H_ */
diff --git a/include/linux/iio/trigger.h b/include/linux/iio/trigger.h
new file mode 100644
index 000000000000..a9819940a84c
--- /dev/null
+++ b/include/linux/iio/trigger.h
@@ -0,0 +1,119 @@
1/* The industrial I/O core, trigger handling functions
2 *
3 * Copyright (c) 2008 Jonathan Cameron
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 as published by
7 * the Free Software Foundation.
8 */
9#include <linux/irq.h>
10#include <linux/module.h>
11
12#ifndef _IIO_TRIGGER_H_
13#define _IIO_TRIGGER_H_
14
15struct iio_subirq {
16 bool enabled;
17};
18
19/**
20 * struct iio_trigger_ops - operations structure for an iio_trigger.
21 * @owner: used to monitor usage count of the trigger.
22 * @set_trigger_state: switch on/off the trigger on demand
23 * @try_reenable: function to reenable the trigger when the
24 * use count is zero (may be NULL)
25 * @validate_device: function to validate the device when the
26 * current trigger gets changed.
27 *
28 * This is typically static const within a driver and shared by
29 * instances of a given device.
30 **/
31struct iio_trigger_ops {
32 struct module *owner;
33 int (*set_trigger_state)(struct iio_trigger *trig, bool state);
34 int (*try_reenable)(struct iio_trigger *trig);
35 int (*validate_device)(struct iio_trigger *trig,
36 struct iio_dev *indio_dev);
37};
38
39
40/**
41 * struct iio_trigger - industrial I/O trigger device
42 *
43 * @id: [INTERN] unique id number
44 * @name: [DRIVER] unique name
45 * @dev: [DRIVER] associated device (if relevant)
46 * @private_data: [DRIVER] device specific data
47 * @list: [INTERN] used in maintenance of global trigger list
48 * @alloc_list: [DRIVER] used for driver specific trigger list
49 * @use_count: use count for the trigger
50 * @subirq_chip: [INTERN] associate 'virtual' irq chip.
51 * @subirq_base: [INTERN] base number for irqs provided by trigger.
52 * @subirqs: [INTERN] information about the 'child' irqs.
53 * @pool: [INTERN] bitmap of irqs currently in use.
54 * @pool_lock: [INTERN] protection of the irq pool.
55 **/
56struct iio_trigger {
57 const struct iio_trigger_ops *ops;
58 int id;
59 const char *name;
60 struct device dev;
61
62 void *private_data;
63 struct list_head list;
64 struct list_head alloc_list;
65 int use_count;
66
67 struct irq_chip subirq_chip;
68 int subirq_base;
69
70 struct iio_subirq subirqs[CONFIG_IIO_CONSUMERS_PER_TRIGGER];
71 unsigned long pool[BITS_TO_LONGS(CONFIG_IIO_CONSUMERS_PER_TRIGGER)];
72 struct mutex pool_lock;
73};
74
75
76static inline struct iio_trigger *to_iio_trigger(struct device *d)
77{
78 return container_of(d, struct iio_trigger, dev);
79};
80
81static inline void iio_trigger_put(struct iio_trigger *trig)
82{
83 module_put(trig->ops->owner);
84 put_device(&trig->dev);
85};
86
87static inline void iio_trigger_get(struct iio_trigger *trig)
88{
89 get_device(&trig->dev);
90 __module_get(trig->ops->owner);
91};
92
93/**
94 * iio_trigger_register() - register a trigger with the IIO core
95 * @trig_info: trigger to be registered
96 **/
97int iio_trigger_register(struct iio_trigger *trig_info);
98
99/**
100 * iio_trigger_unregister() - unregister a trigger from the core
101 * @trig_info: trigger to be unregistered
102 **/
103void iio_trigger_unregister(struct iio_trigger *trig_info);
104
105/**
106 * iio_trigger_poll() - called on a trigger occurring
107 * @trig: trigger which occurred
108 *
109 * Typically called in relevant hardware interrupt handler.
110 **/
111void iio_trigger_poll(struct iio_trigger *trig, s64 time);
112void iio_trigger_poll_chained(struct iio_trigger *trig, s64 time);
113
114irqreturn_t iio_trigger_generic_data_rdy_poll(int irq, void *private);
115
116__printf(1, 2) struct iio_trigger *iio_trigger_alloc(const char *fmt, ...);
117void iio_trigger_free(struct iio_trigger *trig);
118
119#endif /* _IIO_TRIGGER_H_ */
diff --git a/include/linux/iio/trigger_consumer.h b/include/linux/iio/trigger_consumer.h
new file mode 100644
index 000000000000..60d64b356945
--- /dev/null
+++ b/include/linux/iio/trigger_consumer.h
@@ -0,0 +1,52 @@
1/* The industrial I/O core, trigger consumer functions
2 *
3 * Copyright (c) 2008-2011 Jonathan Cameron
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 as published by
7 * the Free Software Foundation.
8 */
9
10/**
11 * struct iio_poll_func - poll function pair
12 *
13 * @indio_dev: data specific to device (passed into poll func)
14 * @h: the function that is actually run on trigger
15 * @thread: threaded interrupt part
16 * @type: the type of interrupt (basically if oneshot)
17 * @name: name used to identify the trigger consumer.
18 * @irq: the corresponding irq as allocated from the
19 * trigger pool
20 * @timestamp: some devices need a timestamp grabbed as soon
21 * as possible after the trigger - hence handler
22 * passes it via here.
23 **/
24struct iio_poll_func {
25 struct iio_dev *indio_dev;
26 irqreturn_t (*h)(int irq, void *p);
27 irqreturn_t (*thread)(int irq, void *p);
28 int type;
29 char *name;
30 int irq;
31 s64 timestamp;
32};
33
34
35struct iio_poll_func
36*iio_alloc_pollfunc(irqreturn_t (*h)(int irq, void *p),
37 irqreturn_t (*thread)(int irq, void *p),
38 int type,
39 struct iio_dev *indio_dev,
40 const char *fmt,
41 ...);
42void iio_dealloc_pollfunc(struct iio_poll_func *pf);
43irqreturn_t iio_pollfunc_store_time(int irq, void *p);
44
45void iio_trigger_notify_done(struct iio_trigger *trig);
46
47/*
48 * Two functions for common case where all that happens is a pollfunc
49 * is attached and detached from a trigger
50 */
51int iio_triggered_buffer_postenable(struct iio_dev *indio_dev);
52int iio_triggered_buffer_predisable(struct iio_dev *indio_dev);
diff --git a/include/linux/iio/types.h b/include/linux/iio/types.h
new file mode 100644
index 000000000000..1b073b1cc7c2
--- /dev/null
+++ b/include/linux/iio/types.h
@@ -0,0 +1,55 @@
1/* industrial I/O data types needed both in and out of kernel
2 *
3 * Copyright (c) 2008 Jonathan Cameron
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 as published by
7 * the Free Software Foundation.
8 */
9
10#ifndef _IIO_TYPES_H_
11#define _IIO_TYPES_H_
12
13enum iio_chan_type {
14 /* real channel types */
15 IIO_VOLTAGE,
16 IIO_CURRENT,
17 IIO_POWER,
18 IIO_ACCEL,
19 IIO_ANGL_VEL,
20 IIO_MAGN,
21 IIO_LIGHT,
22 IIO_INTENSITY,
23 IIO_PROXIMITY,
24 IIO_TEMP,
25 IIO_INCLI,
26 IIO_ROT,
27 IIO_ANGL,
28 IIO_TIMESTAMP,
29 IIO_CAPACITANCE,
30 IIO_ALTVOLTAGE,
31};
32
33enum iio_modifier {
34 IIO_NO_MOD,
35 IIO_MOD_X,
36 IIO_MOD_Y,
37 IIO_MOD_Z,
38 IIO_MOD_X_AND_Y,
39 IIO_MOD_X_AND_Z,
40 IIO_MOD_Y_AND_Z,
41 IIO_MOD_X_AND_Y_AND_Z,
42 IIO_MOD_X_OR_Y,
43 IIO_MOD_X_OR_Z,
44 IIO_MOD_Y_OR_Z,
45 IIO_MOD_X_OR_Y_OR_Z,
46 IIO_MOD_LIGHT_BOTH,
47 IIO_MOD_LIGHT_IR,
48};
49
50#define IIO_VAL_INT 1
51#define IIO_VAL_INT_PLUS_MICRO 2
52#define IIO_VAL_INT_PLUS_NANO 3
53#define IIO_VAL_INT_PLUS_MICRO_DB 4
54
55#endif /* _IIO_TYPES_H_ */
diff --git a/include/linux/in6.h b/include/linux/in6.h
index 5c83d9e3eb8f..cba469ba11a4 100644
--- a/include/linux/in6.h
+++ b/include/linux/in6.h
@@ -142,7 +142,7 @@ struct in6_flowlabel_req {
142/* 142/*
143 * IPv6 TLV options. 143 * IPv6 TLV options.
144 */ 144 */
145#define IPV6_TLV_PAD0 0 145#define IPV6_TLV_PAD1 0
146#define IPV6_TLV_PADN 1 146#define IPV6_TLV_PADN 1
147#define IPV6_TLV_ROUTERALERT 5 147#define IPV6_TLV_ROUTERALERT 5
148#define IPV6_TLV_JUMBO 194 148#define IPV6_TLV_JUMBO 194
diff --git a/include/linux/input/lm8333.h b/include/linux/input/lm8333.h
new file mode 100644
index 000000000000..79f918c6e8c5
--- /dev/null
+++ b/include/linux/input/lm8333.h
@@ -0,0 +1,24 @@
1/*
2 * public include for LM8333 keypad driver - same license as driver
3 * Copyright (C) 2012 Wolfram Sang, Pengutronix <w.sang@pengutronix.de>
4 */
5
6#ifndef _LM8333_H
7#define _LM8333_H
8
9struct lm8333;
10
11struct lm8333_platform_data {
12 /* Keymap data */
13 const struct matrix_keymap_data *matrix_data;
14 /* Active timeout before enter HALT mode in microseconds */
15 unsigned active_time;
16 /* Debounce interval in microseconds */
17 unsigned debounce_time;
18};
19
20extern int lm8333_read8(struct lm8333 *lm8333, u8 cmd);
21extern int lm8333_write8(struct lm8333 *lm8333, u8 cmd, u8 val);
22extern int lm8333_read_block(struct lm8333 *lm8333, u8 cmd, u8 len, u8 *buf);
23
24#endif /* _LM8333_H */
diff --git a/include/linux/input/matrix_keypad.h b/include/linux/input/matrix_keypad.h
index 6c07ced0af81..5f3aa6b11bfa 100644
--- a/include/linux/input/matrix_keypad.h
+++ b/include/linux/input/matrix_keypad.h
@@ -75,54 +75,10 @@ struct matrix_keypad_platform_data {
75 bool no_autorepeat; 75 bool no_autorepeat;
76}; 76};
77 77
78/** 78int matrix_keypad_build_keymap(const struct matrix_keymap_data *keymap_data,
79 * matrix_keypad_build_keymap - convert platform keymap into matrix keymap 79 const char *keymap_name,
80 * @keymap_data: keymap supplied by the platform code 80 unsigned int rows, unsigned int cols,
81 * @row_shift: number of bits to shift row value by to advance to the next 81 unsigned short *keymap,
82 * line in the keymap 82 struct input_dev *input_dev);
83 * @keymap: expanded version of keymap that is suitable for use by
84 * matrix keyboad driver
85 * @keybit: pointer to bitmap of keys supported by input device
86 *
87 * This function converts platform keymap (encoded with KEY() macro) into
88 * an array of keycodes that is suitable for using in a standard matrix
89 * keyboard driver that uses row and col as indices.
90 */
91static inline void
92matrix_keypad_build_keymap(const struct matrix_keymap_data *keymap_data,
93 unsigned int row_shift,
94 unsigned short *keymap, unsigned long *keybit)
95{
96 int i;
97
98 for (i = 0; i < keymap_data->keymap_size; i++) {
99 unsigned int key = keymap_data->keymap[i];
100 unsigned int row = KEY_ROW(key);
101 unsigned int col = KEY_COL(key);
102 unsigned short code = KEY_VAL(key);
103
104 keymap[MATRIX_SCAN_CODE(row, col, row_shift)] = code;
105 __set_bit(code, keybit);
106 }
107 __clear_bit(KEY_RESERVED, keybit);
108}
109
110#ifdef CONFIG_INPUT_OF_MATRIX_KEYMAP
111struct matrix_keymap_data *
112matrix_keyboard_of_fill_keymap(struct device_node *np, const char *propname);
113
114void matrix_keyboard_of_free_keymap(const struct matrix_keymap_data *kd);
115#else
116static inline struct matrix_keymap_data *
117matrix_keyboard_of_fill_keymap(struct device_node *np, const char *propname)
118{
119 return NULL;
120}
121
122static inline void
123matrix_keyboard_of_free_keymap(const struct matrix_keymap_data *kd)
124{
125}
126#endif
127 83
128#endif /* _MATRIX_KEYPAD_H */ 84#endif /* _MATRIX_KEYPAD_H */
diff --git a/include/linux/input/navpoint.h b/include/linux/input/navpoint.h
new file mode 100644
index 000000000000..45050eb34de3
--- /dev/null
+++ b/include/linux/input/navpoint.h
@@ -0,0 +1,12 @@
1/*
2 * Copyright (C) 2012 Paul Parsons <lost.distance@yahoo.com>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9struct navpoint_platform_data {
10 int port; /* PXA SSP port for pxa_ssp_request() */
11 int gpio; /* GPIO for power on/off */
12};
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 2aea5d22db07..c91171599cb6 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -93,27 +93,27 @@ typedef irqreturn_t (*irq_handler_t)(int, void *);
93/** 93/**
94 * struct irqaction - per interrupt action descriptor 94 * struct irqaction - per interrupt action descriptor
95 * @handler: interrupt handler function 95 * @handler: interrupt handler function
96 * @flags: flags (see IRQF_* above)
97 * @name: name of the device 96 * @name: name of the device
98 * @dev_id: cookie to identify the device 97 * @dev_id: cookie to identify the device
99 * @percpu_dev_id: cookie to identify the device 98 * @percpu_dev_id: cookie to identify the device
100 * @next: pointer to the next irqaction for shared interrupts 99 * @next: pointer to the next irqaction for shared interrupts
101 * @irq: interrupt number 100 * @irq: interrupt number
102 * @dir: pointer to the proc/irq/NN/name entry 101 * @flags: flags (see IRQF_* above)
103 * @thread_fn: interrupt handler function for threaded interrupts 102 * @thread_fn: interrupt handler function for threaded interrupts
104 * @thread: thread pointer for threaded interrupts 103 * @thread: thread pointer for threaded interrupts
105 * @thread_flags: flags related to @thread 104 * @thread_flags: flags related to @thread
106 * @thread_mask: bitmask for keeping track of @thread activity 105 * @thread_mask: bitmask for keeping track of @thread activity
106 * @dir: pointer to the proc/irq/NN/name entry
107 */ 107 */
108struct irqaction { 108struct irqaction {
109 irq_handler_t handler; 109 irq_handler_t handler;
110 unsigned long flags;
111 void *dev_id; 110 void *dev_id;
112 void __percpu *percpu_dev_id; 111 void __percpu *percpu_dev_id;
113 struct irqaction *next; 112 struct irqaction *next;
114 int irq;
115 irq_handler_t thread_fn; 113 irq_handler_t thread_fn;
116 struct task_struct *thread; 114 struct task_struct *thread;
115 unsigned int irq;
116 unsigned int flags;
117 unsigned long thread_flags; 117 unsigned long thread_flags;
118 unsigned long thread_mask; 118 unsigned long thread_mask;
119 const char *name; 119 const char *name;
diff --git a/include/linux/ioport.h b/include/linux/ioport.h
index e885ba23de70..589e0e75efae 100644
--- a/include/linux/ioport.h
+++ b/include/linux/ioport.h
@@ -223,5 +223,12 @@ extern int
223walk_system_ram_range(unsigned long start_pfn, unsigned long nr_pages, 223walk_system_ram_range(unsigned long start_pfn, unsigned long nr_pages,
224 void *arg, int (*func)(unsigned long, unsigned long, void *)); 224 void *arg, int (*func)(unsigned long, unsigned long, void *));
225 225
226/* True if any part of r1 overlaps r2 */
227static inline bool resource_overlaps(struct resource *r1, struct resource *r2)
228{
229 return (r1->start <= r2->end && r1->end >= r2->start);
230}
231
232
226#endif /* __ASSEMBLY__ */ 233#endif /* __ASSEMBLY__ */
227#endif /* _LINUX_IOPORT_H */ 234#endif /* _LINUX_IOPORT_H */
diff --git a/include/linux/ip_vs.h b/include/linux/ip_vs.h
index 4deb3834d62c..8a2d438dc499 100644
--- a/include/linux/ip_vs.h
+++ b/include/linux/ip_vs.h
@@ -89,6 +89,7 @@
89#define IP_VS_CONN_F_TEMPLATE 0x1000 /* template, not connection */ 89#define IP_VS_CONN_F_TEMPLATE 0x1000 /* template, not connection */
90#define IP_VS_CONN_F_ONE_PACKET 0x2000 /* forward only one packet */ 90#define IP_VS_CONN_F_ONE_PACKET 0x2000 /* forward only one packet */
91 91
92/* Initial bits allowed in backup server */
92#define IP_VS_CONN_F_BACKUP_MASK (IP_VS_CONN_F_FWD_MASK | \ 93#define IP_VS_CONN_F_BACKUP_MASK (IP_VS_CONN_F_FWD_MASK | \
93 IP_VS_CONN_F_NOOUTPUT | \ 94 IP_VS_CONN_F_NOOUTPUT | \
94 IP_VS_CONN_F_INACTIVE | \ 95 IP_VS_CONN_F_INACTIVE | \
@@ -97,6 +98,10 @@
97 IP_VS_CONN_F_TEMPLATE \ 98 IP_VS_CONN_F_TEMPLATE \
98 ) 99 )
99 100
101/* Bits allowed to update in backup server */
102#define IP_VS_CONN_F_BACKUP_UPD_MASK (IP_VS_CONN_F_INACTIVE | \
103 IP_VS_CONN_F_SEQ_MASK)
104
100/* Flags that are not sent to backup server start from bit 16 */ 105/* Flags that are not sent to backup server start from bit 16 */
101#define IP_VS_CONN_F_NFCT (1 << 16) /* use netfilter conntrack */ 106#define IP_VS_CONN_F_NFCT (1 << 16) /* use netfilter conntrack */
102 107
@@ -125,8 +130,8 @@ struct ip_vs_service_user {
125 130
126 /* virtual service options */ 131 /* virtual service options */
127 char sched_name[IP_VS_SCHEDNAME_MAXLEN]; 132 char sched_name[IP_VS_SCHEDNAME_MAXLEN];
128 unsigned flags; /* virtual service flags */ 133 unsigned int flags; /* virtual service flags */
129 unsigned timeout; /* persistent timeout in sec */ 134 unsigned int timeout; /* persistent timeout in sec */
130 __be32 netmask; /* persistent netmask */ 135 __be32 netmask; /* persistent netmask */
131}; 136};
132 137
@@ -137,7 +142,7 @@ struct ip_vs_dest_user {
137 __be16 port; 142 __be16 port;
138 143
139 /* real server options */ 144 /* real server options */
140 unsigned conn_flags; /* connection flags */ 145 unsigned int conn_flags; /* connection flags */
141 int weight; /* destination weight */ 146 int weight; /* destination weight */
142 147
143 /* thresholds for active connections */ 148 /* thresholds for active connections */
@@ -187,8 +192,8 @@ struct ip_vs_service_entry {
187 192
188 /* service options */ 193 /* service options */
189 char sched_name[IP_VS_SCHEDNAME_MAXLEN]; 194 char sched_name[IP_VS_SCHEDNAME_MAXLEN];
190 unsigned flags; /* virtual service flags */ 195 unsigned int flags; /* virtual service flags */
191 unsigned timeout; /* persistent timeout */ 196 unsigned int timeout; /* persistent timeout */
192 __be32 netmask; /* persistent netmask */ 197 __be32 netmask; /* persistent netmask */
193 198
194 /* number of real servers */ 199 /* number of real servers */
@@ -202,7 +207,7 @@ struct ip_vs_service_entry {
202struct ip_vs_dest_entry { 207struct ip_vs_dest_entry {
203 __be32 addr; /* destination address */ 208 __be32 addr; /* destination address */
204 __be16 port; 209 __be16 port;
205 unsigned conn_flags; /* connection flags */ 210 unsigned int conn_flags; /* connection flags */
206 int weight; /* destination weight */ 211 int weight; /* destination weight */
207 212
208 __u32 u_threshold; /* upper threshold */ 213 __u32 u_threshold; /* upper threshold */
diff --git a/include/linux/irq.h b/include/linux/irq.h
index b27cfcfd3a59..61f5cec031e0 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -335,11 +335,6 @@ struct irq_chip {
335 void (*irq_print_chip)(struct irq_data *data, struct seq_file *p); 335 void (*irq_print_chip)(struct irq_data *data, struct seq_file *p);
336 336
337 unsigned long flags; 337 unsigned long flags;
338
339 /* Currently used only by UML, might disappear one day.*/
340#ifdef CONFIG_IRQ_RELEASE_METHOD
341 void (*release)(unsigned int irq, void *dev_id);
342#endif
343}; 338};
344 339
345/* 340/*
diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h
index c65740d76e66..5abb533eb8eb 100644
--- a/include/linux/irqdomain.h
+++ b/include/linux/irqdomain.h
@@ -141,9 +141,8 @@ static inline struct irq_domain *irq_domain_add_legacy_isa(
141 return irq_domain_add_legacy(of_node, NUM_ISA_INTERRUPTS, 0, 0, ops, 141 return irq_domain_add_legacy(of_node, NUM_ISA_INTERRUPTS, 0, 0, ops,
142 host_data); 142 host_data);
143} 143}
144extern struct irq_domain *irq_find_host(struct device_node *node);
145extern void irq_set_default_host(struct irq_domain *host);
146 144
145extern void irq_domain_remove(struct irq_domain *host);
147 146
148extern unsigned int irq_create_mapping(struct irq_domain *host, 147extern unsigned int irq_create_mapping(struct irq_domain *host,
149 irq_hw_number_t hwirq); 148 irq_hw_number_t hwirq);
diff --git a/include/linux/isdn.h b/include/linux/isdn.h
index 292f27a793d4..215c41602af8 100644
--- a/include/linux/isdn.h
+++ b/include/linux/isdn.h
@@ -15,6 +15,7 @@
15#define __ISDN_H__ 15#define __ISDN_H__
16 16
17#include <linux/ioctl.h> 17#include <linux/ioctl.h>
18#include <linux/tty.h>
18 19
19#define ISDN_MAX_DRIVERS 32 20#define ISDN_MAX_DRIVERS 32
20#define ISDN_MAX_CHANNELS 64 21#define ISDN_MAX_CHANNELS 64
@@ -392,21 +393,8 @@ typedef struct isdn_net_dev_s {
392/*======================= Start of ISDN-tty stuff ===========================*/ 393/*======================= Start of ISDN-tty stuff ===========================*/
393 394
394#define ISDN_ASYNC_MAGIC 0x49344C01 /* for paranoia-checking */ 395#define ISDN_ASYNC_MAGIC 0x49344C01 /* for paranoia-checking */
395#define ISDN_ASYNC_INITIALIZED 0x80000000 /* port was initialized */
396#define ISDN_ASYNC_CALLOUT_ACTIVE 0x40000000 /* Call out device active */
397#define ISDN_ASYNC_NORMAL_ACTIVE 0x20000000 /* Normal device active */
398#define ISDN_ASYNC_CLOSING 0x08000000 /* Serial port is closing */
399#define ISDN_ASYNC_CTS_FLOW 0x04000000 /* Do CTS flow control */
400#define ISDN_ASYNC_CHECK_CD 0x02000000 /* i.e., CLOCAL */
401#define ISDN_ASYNC_HUP_NOTIFY 0x0001 /* Notify tty on hangups/closes */
402#define ISDN_ASYNC_SESSION_LOCKOUT 0x0100 /* Lock cua opens on session */
403#define ISDN_ASYNC_PGRP_LOCKOUT 0x0200 /* Lock cua opens on pgrp */
404#define ISDN_ASYNC_CALLOUT_NOHUP 0x0400 /* No hangup for cui */
405#define ISDN_ASYNC_SPLIT_TERMIOS 0x0008 /* Sep. termios for dialin/out */
406#define ISDN_SERIAL_XMIT_SIZE 1024 /* Default bufsize for write */ 396#define ISDN_SERIAL_XMIT_SIZE 1024 /* Default bufsize for write */
407#define ISDN_SERIAL_XMIT_MAX 4000 /* Maximum bufsize for write */ 397#define ISDN_SERIAL_XMIT_MAX 4000 /* Maximum bufsize for write */
408#define ISDN_SERIAL_TYPE_NORMAL 1
409#define ISDN_SERIAL_TYPE_CALLOUT 2
410 398
411#ifdef CONFIG_ISDN_AUDIO 399#ifdef CONFIG_ISDN_AUDIO
412/* For using sk_buffs with audio we need some private variables 400/* For using sk_buffs with audio we need some private variables
@@ -448,17 +436,12 @@ typedef struct atemu {
448/* Private data (similar to async_struct in <linux/serial.h>) */ 436/* Private data (similar to async_struct in <linux/serial.h>) */
449typedef struct modem_info { 437typedef struct modem_info {
450 int magic; 438 int magic;
451 struct module *owner; 439 struct tty_port port;
452 int flags; /* defined in tty.h */
453 int x_char; /* xon/xoff character */ 440 int x_char; /* xon/xoff character */
454 int mcr; /* Modem control register */ 441 int mcr; /* Modem control register */
455 int msr; /* Modem status register */ 442 int msr; /* Modem status register */
456 int lsr; /* Line status register */ 443 int lsr; /* Line status register */
457 int line; 444 int line;
458 int count; /* # of fd on device */
459 int blocked_open; /* # of blocked opens */
460 long session; /* Session of opening process */
461 long pgrp; /* pgrp of opening process */
462 int online; /* 1 = B-Channel is up, drop data */ 445 int online; /* 1 = B-Channel is up, drop data */
463 /* 2 = B-Channel is up, deliver d.*/ 446 /* 2 = B-Channel is up, deliver d.*/
464 int dialing; /* Dial in progress or ATA */ 447 int dialing; /* Dial in progress or ATA */
@@ -478,7 +461,6 @@ typedef struct modem_info {
478 int send_outstanding;/* # of outstanding send-requests */ 461 int send_outstanding;/* # of outstanding send-requests */
479 int xmit_size; /* max. # of chars in xmit_buf */ 462 int xmit_size; /* max. # of chars in xmit_buf */
480 int xmit_count; /* # of chars in xmit_buf */ 463 int xmit_count; /* # of chars in xmit_buf */
481 unsigned char *xmit_buf; /* transmit buffer */
482 struct sk_buff_head xmit_queue; /* transmit queue */ 464 struct sk_buff_head xmit_queue; /* transmit queue */
483 atomic_t xmit_lock; /* Semaphore for isdn_tty_write */ 465 atomic_t xmit_lock; /* Semaphore for isdn_tty_write */
484#ifdef CONFIG_ISDN_AUDIO 466#ifdef CONFIG_ISDN_AUDIO
@@ -496,11 +478,7 @@ typedef struct modem_info {
496 struct T30_s *fax; /* T30 Fax Group 3 data/interface */ 478 struct T30_s *fax; /* T30 Fax Group 3 data/interface */
497 int faxonline; /* Fax-channel status */ 479 int faxonline; /* Fax-channel status */
498#endif 480#endif
499 struct tty_struct *tty; /* Pointer to corresponding tty */
500 atemu emu; /* AT-emulator data */ 481 atemu emu; /* AT-emulator data */
501 struct ktermios normal_termios; /* For saving termios structs */
502 struct ktermios callout_termios;
503 wait_queue_head_t open_wait, close_wait;
504 spinlock_t readlock; 482 spinlock_t readlock;
505} modem_info; 483} modem_info;
506 484
diff --git a/include/linux/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/l2tp.h b/include/linux/l2tp.h
index e77d7f9bb246..7eab668f60f3 100644
--- a/include/linux/l2tp.h
+++ b/include/linux/l2tp.h
@@ -11,6 +11,7 @@
11#include <linux/socket.h> 11#include <linux/socket.h>
12#ifdef __KERNEL__ 12#ifdef __KERNEL__
13#include <linux/in.h> 13#include <linux/in.h>
14#include <linux/in6.h>
14#else 15#else
15#include <netinet/in.h> 16#include <netinet/in.h>
16#endif 17#endif
@@ -39,6 +40,22 @@ struct sockaddr_l2tpip {
39 sizeof(__u32)]; 40 sizeof(__u32)];
40}; 41};
41 42
43/**
44 * struct sockaddr_l2tpip6 - the sockaddr structure for L2TP-over-IPv6 sockets
45 * @l2tp_family: address family number AF_L2TPIP.
46 * @l2tp_addr: protocol specific address information
47 * @l2tp_conn_id: connection id of tunnel
48 */
49struct sockaddr_l2tpip6 {
50 /* The first fields must match struct sockaddr_in6 */
51 __kernel_sa_family_t l2tp_family; /* AF_INET6 */
52 __be16 l2tp_unused; /* INET port number (unused) */
53 __be32 l2tp_flowinfo; /* IPv6 flow information */
54 struct in6_addr l2tp_addr; /* IPv6 address */
55 __u32 l2tp_scope_id; /* scope id (new in RFC2553) */
56 __u32 l2tp_conn_id; /* Connection ID of tunnel */
57};
58
42/***************************************************************************** 59/*****************************************************************************
43 * NETLINK_GENERIC netlink family. 60 * NETLINK_GENERIC netlink family.
44 *****************************************************************************/ 61 *****************************************************************************/
@@ -108,6 +125,8 @@ enum {
108 L2TP_ATTR_MTU, /* u16 */ 125 L2TP_ATTR_MTU, /* u16 */
109 L2TP_ATTR_MRU, /* u16 */ 126 L2TP_ATTR_MRU, /* u16 */
110 L2TP_ATTR_STATS, /* nested */ 127 L2TP_ATTR_STATS, /* nested */
128 L2TP_ATTR_IP6_SADDR, /* struct in6_addr */
129 L2TP_ATTR_IP6_DADDR, /* struct in6_addr */
111 __L2TP_ATTR_MAX, 130 __L2TP_ATTR_MAX,
112}; 131};
113 132
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 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/mISDNhw.h b/include/linux/mISDNhw.h
index 4af841408fb5..d0752eca9b44 100644
--- a/include/linux/mISDNhw.h
+++ b/include/linux/mISDNhw.h
@@ -72,7 +72,9 @@
72#define FLG_LL_OK 24 72#define FLG_LL_OK 24
73#define FLG_LL_CONN 25 73#define FLG_LL_CONN 25
74#define FLG_DTMFSEND 26 74#define FLG_DTMFSEND 26
75 75#define FLG_TX_EMPTY 27
76/* stop sending received data upstream */
77#define FLG_RX_OFF 28
76/* workq events */ 78/* workq events */
77#define FLG_RECVQUEUE 30 79#define FLG_RECVQUEUE 30
78#define FLG_PHCHANGE 31 80#define FLG_PHCHANGE 31
@@ -135,10 +137,14 @@ extern int create_l1(struct dchannel *, dchannel_l1callback *);
135#define HW_TESTRX_RAW 0x9602 137#define HW_TESTRX_RAW 0x9602
136#define HW_TESTRX_HDLC 0x9702 138#define HW_TESTRX_HDLC 0x9702
137#define HW_TESTRX_OFF 0x9802 139#define HW_TESTRX_OFF 0x9802
140#define HW_TIMER3_IND 0x9902
141#define HW_TIMER3_VALUE 0x9a00
142#define HW_TIMER3_VMASK 0x00FF
138 143
139struct layer1; 144struct layer1;
140extern int l1_event(struct layer1 *, u_int); 145extern int l1_event(struct layer1 *, u_int);
141 146
147#define MISDN_BCH_FILL_SIZE 4
142 148
143struct bchannel { 149struct bchannel {
144 struct mISDNchannel ch; 150 struct mISDNchannel ch;
@@ -150,8 +156,14 @@ struct bchannel {
150 int slot; /* multiport card channel slot */ 156 int slot; /* multiport card channel slot */
151 struct timer_list timer; 157 struct timer_list timer;
152 /* receive data */ 158 /* receive data */
159 u8 fill[MISDN_BCH_FILL_SIZE];
153 struct sk_buff *rx_skb; 160 struct sk_buff *rx_skb;
154 int maxlen; 161 unsigned short maxlen;
162 unsigned short init_maxlen; /* initial value */
163 unsigned short next_maxlen; /* pending value */
164 unsigned short minlen; /* for transparent data */
165 unsigned short init_minlen; /* initial value */
166 unsigned short next_minlen; /* pending value */
155 /* send data */ 167 /* send data */
156 struct sk_buff *next_skb; 168 struct sk_buff *next_skb;
157 struct sk_buff *tx_skb; 169 struct sk_buff *tx_skb;
@@ -163,23 +175,26 @@ struct bchannel {
163 int err_crc; 175 int err_crc;
164 int err_tx; 176 int err_tx;
165 int err_rx; 177 int err_rx;
178 int dropcnt;
166}; 179};
167 180
168extern int mISDN_initdchannel(struct dchannel *, int, void *); 181extern int mISDN_initdchannel(struct dchannel *, int, void *);
169extern int mISDN_initbchannel(struct bchannel *, int); 182extern int mISDN_initbchannel(struct bchannel *, unsigned short,
183 unsigned short);
170extern int mISDN_freedchannel(struct dchannel *); 184extern int mISDN_freedchannel(struct dchannel *);
171extern void mISDN_clear_bchannel(struct bchannel *); 185extern void mISDN_clear_bchannel(struct bchannel *);
172extern int mISDN_freebchannel(struct bchannel *); 186extern int mISDN_freebchannel(struct bchannel *);
187extern int mISDN_ctrl_bchannel(struct bchannel *, struct mISDN_ctrl_req *);
173extern void queue_ch_frame(struct mISDNchannel *, u_int, 188extern void queue_ch_frame(struct mISDNchannel *, u_int,
174 int, struct sk_buff *); 189 int, struct sk_buff *);
175extern int dchannel_senddata(struct dchannel *, struct sk_buff *); 190extern int dchannel_senddata(struct dchannel *, struct sk_buff *);
176extern int bchannel_senddata(struct bchannel *, struct sk_buff *); 191extern int bchannel_senddata(struct bchannel *, struct sk_buff *);
192extern int bchannel_get_rxbuf(struct bchannel *, int);
177extern void recv_Dchannel(struct dchannel *); 193extern void recv_Dchannel(struct dchannel *);
178extern void recv_Echannel(struct dchannel *, struct dchannel *); 194extern void recv_Echannel(struct dchannel *, struct dchannel *);
179extern void recv_Bchannel(struct bchannel *, unsigned int id); 195extern void recv_Bchannel(struct bchannel *, unsigned int, bool);
180extern void recv_Dchannel_skb(struct dchannel *, struct sk_buff *); 196extern void recv_Dchannel_skb(struct dchannel *, struct sk_buff *);
181extern void recv_Bchannel_skb(struct bchannel *, struct sk_buff *); 197extern void recv_Bchannel_skb(struct bchannel *, struct sk_buff *);
182extern void confirm_Bsend(struct bchannel *bch);
183extern int get_next_bframe(struct bchannel *); 198extern int get_next_bframe(struct bchannel *);
184extern int get_next_dframe(struct dchannel *); 199extern int get_next_dframe(struct dchannel *);
185 200
diff --git a/include/linux/mISDNif.h b/include/linux/mISDNif.h
index b5e7f2202484..246a3529ecf6 100644
--- a/include/linux/mISDNif.h
+++ b/include/linux/mISDNif.h
@@ -37,7 +37,7 @@
37 */ 37 */
38#define MISDN_MAJOR_VERSION 1 38#define MISDN_MAJOR_VERSION 1
39#define MISDN_MINOR_VERSION 1 39#define MISDN_MINOR_VERSION 1
40#define MISDN_RELEASE 21 40#define MISDN_RELEASE 29
41 41
42/* primitives for information exchange 42/* primitives for information exchange
43 * generell format 43 * generell format
@@ -115,6 +115,11 @@
115#define MDL_ERROR_IND 0x1F04 115#define MDL_ERROR_IND 0x1F04
116#define MDL_ERROR_RSP 0x5F04 116#define MDL_ERROR_RSP 0x5F04
117 117
118/* intern layer 2 */
119#define DL_TIMER200_IND 0x7004
120#define DL_TIMER203_IND 0x7304
121#define DL_INTERN_MSG 0x7804
122
118/* DL_INFORMATION_IND types */ 123/* DL_INFORMATION_IND types */
119#define DL_INFO_L2_CONNECT 0x0001 124#define DL_INFO_L2_CONNECT 0x0001
120#define DL_INFO_L2_REMOVED 0x0002 125#define DL_INFO_L2_REMOVED 0x0002
@@ -360,6 +365,7 @@ clear_channelmap(u_int nr, u_char *map)
360#define MISDN_CTRL_LOOP 0x0001 365#define MISDN_CTRL_LOOP 0x0001
361#define MISDN_CTRL_CONNECT 0x0002 366#define MISDN_CTRL_CONNECT 0x0002
362#define MISDN_CTRL_DISCONNECT 0x0004 367#define MISDN_CTRL_DISCONNECT 0x0004
368#define MISDN_CTRL_RX_BUFFER 0x0008
363#define MISDN_CTRL_PCMCONNECT 0x0010 369#define MISDN_CTRL_PCMCONNECT 0x0010
364#define MISDN_CTRL_PCMDISCONNECT 0x0020 370#define MISDN_CTRL_PCMDISCONNECT 0x0020
365#define MISDN_CTRL_SETPEER 0x0040 371#define MISDN_CTRL_SETPEER 0x0040
@@ -367,6 +373,7 @@ clear_channelmap(u_int nr, u_char *map)
367#define MISDN_CTRL_RX_OFF 0x0100 373#define MISDN_CTRL_RX_OFF 0x0100
368#define MISDN_CTRL_FILL_EMPTY 0x0200 374#define MISDN_CTRL_FILL_EMPTY 0x0200
369#define MISDN_CTRL_GETPEER 0x0400 375#define MISDN_CTRL_GETPEER 0x0400
376#define MISDN_CTRL_L1_TIMER3 0x0800
370#define MISDN_CTRL_HW_FEATURES_OP 0x2000 377#define MISDN_CTRL_HW_FEATURES_OP 0x2000
371#define MISDN_CTRL_HW_FEATURES 0x2001 378#define MISDN_CTRL_HW_FEATURES 0x2001
372#define MISDN_CTRL_HFC_OP 0x4000 379#define MISDN_CTRL_HFC_OP 0x4000
@@ -381,6 +388,12 @@ clear_channelmap(u_int nr, u_char *map)
381#define MISDN_CTRL_HFC_WD_INIT 0x4009 388#define MISDN_CTRL_HFC_WD_INIT 0x4009
382#define MISDN_CTRL_HFC_WD_RESET 0x400A 389#define MISDN_CTRL_HFC_WD_RESET 0x400A
383 390
391/* special RX buffer value for MISDN_CTRL_RX_BUFFER request.p1 is the minimum
392 * buffer size request.p2 the maximum. Using MISDN_CTRL_RX_SIZE_IGNORE will
393 * not change the value, but still read back the actual stetting.
394 */
395#define MISDN_CTRL_RX_SIZE_IGNORE -1
396
384/* socket options */ 397/* socket options */
385#define MISDN_TIME_STAMP 0x0001 398#define MISDN_TIME_STAMP 0x0001
386 399
@@ -585,6 +598,7 @@ static inline struct mISDNdevice *dev_to_mISDN(struct device *dev)
585extern void set_channel_address(struct mISDNchannel *, u_int, u_int); 598extern void set_channel_address(struct mISDNchannel *, u_int, u_int);
586extern void mISDN_clock_update(struct mISDNclock *, int, struct timeval *); 599extern void mISDN_clock_update(struct mISDNclock *, int, struct timeval *);
587extern unsigned short mISDN_clock_get(void); 600extern unsigned short mISDN_clock_get(void);
601extern const char *mISDNDevName4ch(struct mISDNchannel *);
588 602
589#endif /* __KERNEL__ */ 603#endif /* __KERNEL__ */
590#endif /* mISDNIF_H */ 604#endif /* mISDNIF_H */
diff --git a/include/linux/mca-legacy.h b/include/linux/mca-legacy.h
deleted file mode 100644
index 7a3aea845902..000000000000
--- a/include/linux/mca-legacy.h
+++ /dev/null
@@ -1,66 +0,0 @@
1/* -*- mode: c; c-basic-offset: 8 -*- */
2
3/* This is the function prototypes for the old legacy MCA interface
4 *
5 * Please move your driver to the new sysfs based one instead */
6
7#ifndef _LINUX_MCA_LEGACY_H
8#define _LINUX_MCA_LEGACY_H
9
10#include <linux/mca.h>
11
12#warning "MCA legacy - please move your driver to the new sysfs api"
13
14/* MCA_NOTFOUND is an error condition. The other two indicate
15 * motherboard POS registers contain the adapter. They might be
16 * returned by the mca_find_adapter() function, and can be used as
17 * arguments to mca_read_stored_pos(). I'm not going to allow direct
18 * access to the motherboard registers until we run across an adapter
19 * that requires it. We don't know enough about them to know if it's
20 * safe.
21 *
22 * See Documentation/mca.txt or one of the existing drivers for
23 * more information.
24 */
25#define MCA_NOTFOUND (-1)
26
27
28
29/* Returns the slot of the first enabled adapter matching id. User can
30 * specify a starting slot beyond zero, to deal with detecting multiple
31 * devices. Returns MCA_NOTFOUND if id not found. Also checks the
32 * integrated adapters.
33 */
34extern int mca_find_adapter(int id, int start);
35extern int mca_find_unused_adapter(int id, int start);
36
37extern int mca_mark_as_used(int slot);
38extern void mca_mark_as_unused(int slot);
39
40/* gets a byte out of POS register (stored in memory) */
41extern unsigned char mca_read_stored_pos(int slot, int reg);
42
43/* This can be expanded later. Right now, it gives us a way of
44 * getting meaningful information into the MCA_info structure,
45 * so we can have a more interesting /proc/mca.
46 */
47extern void mca_set_adapter_name(int slot, char* name);
48
49/* These routines actually mess with the hardware POS registers. They
50 * temporarily disable the device (and interrupts), so make sure you know
51 * what you're doing if you use them. Furthermore, writing to a POS may
52 * result in two devices trying to share a resource, which in turn can
53 * result in multiple devices sharing memory spaces, IRQs, or even trashing
54 * hardware. YOU HAVE BEEN WARNED.
55 *
56 * You can only access slots with this. Motherboard registers are off
57 * limits.
58 */
59
60/* read a byte from the specified POS register. */
61extern unsigned char mca_read_pos(int slot, int reg);
62
63/* write a byte to the specified POS register. */
64extern void mca_write_pos(int slot, int reg, unsigned char byte);
65
66#endif
diff --git a/include/linux/mca.h b/include/linux/mca.h
deleted file mode 100644
index 37972704617f..000000000000
--- a/include/linux/mca.h
+++ /dev/null
@@ -1,148 +0,0 @@
1/*
2 * Header for Microchannel Architecture Bus
3 * Written by Martin Kolinek, February 1996
4 */
5
6#ifndef _LINUX_MCA_H
7#define _LINUX_MCA_H
8
9#include <linux/device.h>
10
11#ifdef CONFIG_MCA
12#include <asm/mca.h>
13
14extern int MCA_bus;
15#else
16#define MCA_bus 0
17#endif
18
19/* This sets up an information callback for /proc/mca/slot?. The
20 * function is called with the buffer, slot, and device pointer (or
21 * some equally informative context information, or nothing, if you
22 * prefer), and is expected to put useful information into the
23 * buffer. The adapter name, id, and POS registers get printed
24 * before this is called though, so don't do it again.
25 *
26 * This should be called with a NULL procfn when a module
27 * unregisters, thus preventing kernel crashes and other such
28 * nastiness.
29 */
30typedef int (*MCA_ProcFn)(char* buf, int slot, void* dev);
31
32/* Should only be called by the NMI interrupt handler, this will do some
33 * fancy stuff to figure out what might have generated a NMI.
34 */
35extern void mca_handle_nmi(void);
36
37enum MCA_AdapterStatus {
38 MCA_ADAPTER_NORMAL = 0,
39 MCA_ADAPTER_NONE = 1,
40 MCA_ADAPTER_DISABLED = 2,
41 MCA_ADAPTER_ERROR = 3
42};
43
44struct mca_device {
45 u64 dma_mask;
46 int pos_id;
47 int slot;
48
49 /* index into id_table, set by the bus match routine */
50 int index;
51
52 /* is there a driver installed? 0 - No, 1 - Yes */
53 int driver_loaded;
54 /* POS registers */
55 unsigned char pos[8];
56 /* if a pseudo adapter of the motherboard, this is the motherboard
57 * register value to use for setup cycles */
58 short pos_register;
59
60 enum MCA_AdapterStatus status;
61#ifdef CONFIG_MCA_PROC_FS
62 /* name of the proc/mca file */
63 char procname[8];
64 /* /proc info callback */
65 MCA_ProcFn procfn;
66 /* device/context info for proc callback */
67 void *proc_dev;
68#endif
69 struct device dev;
70 char name[32];
71};
72#define to_mca_device(mdev) container_of(mdev, struct mca_device, dev)
73
74struct mca_bus_accessor_functions {
75 unsigned char (*mca_read_pos)(struct mca_device *, int reg);
76 void (*mca_write_pos)(struct mca_device *, int reg,
77 unsigned char byte);
78 int (*mca_transform_irq)(struct mca_device *, int irq);
79 int (*mca_transform_ioport)(struct mca_device *,
80 int region);
81 void * (*mca_transform_memory)(struct mca_device *,
82 void *memory);
83};
84
85struct mca_bus {
86 u64 default_dma_mask;
87 int number;
88 struct mca_bus_accessor_functions f;
89 struct device dev;
90 char name[32];
91};
92#define to_mca_bus(mdev) container_of(mdev, struct mca_bus, dev)
93
94struct mca_driver {
95 const short *id_table;
96 void *driver_data;
97 int integrated_id;
98 struct device_driver driver;
99};
100#define to_mca_driver(mdriver) container_of(mdriver, struct mca_driver, driver)
101
102/* Ongoing supported API functions */
103extern struct mca_device *mca_find_device_by_slot(int slot);
104extern int mca_system_init(void);
105extern struct mca_bus *mca_attach_bus(int);
106
107extern unsigned char mca_device_read_stored_pos(struct mca_device *mca_dev,
108 int reg);
109extern unsigned char mca_device_read_pos(struct mca_device *mca_dev, int reg);
110extern void mca_device_write_pos(struct mca_device *mca_dev, int reg,
111 unsigned char byte);
112extern int mca_device_transform_irq(struct mca_device *mca_dev, int irq);
113extern int mca_device_transform_ioport(struct mca_device *mca_dev, int port);
114extern void *mca_device_transform_memory(struct mca_device *mca_dev,
115 void *mem);
116extern int mca_device_claimed(struct mca_device *mca_dev);
117extern void mca_device_set_claim(struct mca_device *mca_dev, int val);
118extern void mca_device_set_name(struct mca_device *mca_dev, const char *name);
119static inline char *mca_device_get_name(struct mca_device *mca_dev)
120{
121 return mca_dev ? mca_dev->name : NULL;
122}
123
124extern enum MCA_AdapterStatus mca_device_status(struct mca_device *mca_dev);
125
126extern struct bus_type mca_bus_type;
127
128extern int mca_register_driver(struct mca_driver *drv);
129extern int mca_register_driver_integrated(struct mca_driver *, int);
130extern void mca_unregister_driver(struct mca_driver *drv);
131
132/* WARNING: only called by the boot time device setup */
133extern int mca_register_device(int bus, struct mca_device *mca_dev);
134
135#ifdef CONFIG_MCA_PROC_FS
136extern void mca_do_proc_init(void);
137extern void mca_set_adapter_procfn(int slot, MCA_ProcFn, void* dev);
138#else
139static inline void mca_do_proc_init(void)
140{
141}
142
143static inline void mca_set_adapter_procfn(int slot, MCA_ProcFn fn, void* dev)
144{
145}
146#endif
147
148#endif /* _LINUX_MCA_H */
diff --git a/include/linux/mdio-mux.h b/include/linux/mdio-mux.h
new file mode 100644
index 000000000000..a243dbba8659
--- /dev/null
+++ b/include/linux/mdio-mux.h
@@ -0,0 +1,21 @@
1/*
2 * MDIO bus multiplexer framwork.
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2011, 2012 Cavium, Inc.
9 */
10#ifndef __LINUX_MDIO_MUX_H
11#define __LINUX_MDIO_MUX_H
12#include <linux/device.h>
13
14int mdio_mux_init(struct device *dev,
15 int (*switch_fn) (int cur, int desired, void *data),
16 void **mux_handle,
17 void *data);
18
19void mdio_mux_uninit(void *mux_handle);
20
21#endif /* __LINUX_MDIO_MUX_H */
diff --git a/include/linux/mei.h b/include/linux/mei.h
new file mode 100644
index 000000000000..bc0d8b69c49e
--- /dev/null
+++ b/include/linux/mei.h
@@ -0,0 +1,110 @@
1/******************************************************************************
2 * Intel Management Engine Interface (Intel MEI) Linux driver
3 * Intel MEI Interface Header
4 *
5 * This file is provided under a dual BSD/GPLv2 license. When using or
6 * redistributing this file, you may do so under either license.
7 *
8 * GPL LICENSE SUMMARY
9 *
10 * Copyright(c) 2003 - 2012 Intel Corporation. All rights reserved.
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of version 2 of the GNU General Public License as
14 * published by the Free Software Foundation.
15 *
16 * This program is distributed in the hope that it will be useful, but
17 * WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
24 * USA
25 *
26 * The full GNU General Public License is included in this distribution
27 * in the file called LICENSE.GPL.
28 *
29 * Contact Information:
30 * Intel Corporation.
31 * linux-mei@linux.intel.com
32 * http://www.intel.com
33 *
34 * BSD LICENSE
35 *
36 * Copyright(c) 2003 - 2012 Intel Corporation. All rights reserved.
37 * All rights reserved.
38 *
39 * Redistribution and use in source and binary forms, with or without
40 * modification, are permitted provided that the following conditions
41 * are met:
42 *
43 * * Redistributions of source code must retain the above copyright
44 * notice, this list of conditions and the following disclaimer.
45 * * Redistributions in binary form must reproduce the above copyright
46 * notice, this list of conditions and the following disclaimer in
47 * the documentation and/or other materials provided with the
48 * distribution.
49 * * Neither the name Intel Corporation nor the names of its
50 * contributors may be used to endorse or promote products derived
51 * from this software without specific prior written permission.
52 *
53 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
54 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
55 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
56 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
57 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
58 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
59 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
60 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
61 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
62 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
63 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
64 *
65 *****************************************************************************/
66
67#ifndef _LINUX_MEI_H
68#define _LINUX_MEI_H
69
70#include <linux/uuid.h>
71
72/*
73 * This IOCTL is used to associate the current file descriptor with a
74 * FW Client (given by UUID). This opens a communication channel
75 * between a host client and a FW client. From this point every read and write
76 * will communicate with the associated FW client.
77 * Only in close() (file_operation release()) the communication between
78 * the clients is disconnected
79 *
80 * The IOCTL argument is a struct with a union that contains
81 * the input parameter and the output parameter for this IOCTL.
82 *
83 * The input parameter is UUID of the FW Client.
84 * The output parameter is the properties of the FW client
85 * (FW protocol version and max message size).
86 *
87 */
88#define IOCTL_MEI_CONNECT_CLIENT \
89 _IOWR('H' , 0x01, struct mei_connect_client_data)
90
91/*
92 * Intel MEI client information struct
93 */
94struct mei_client {
95 __u32 max_msg_length;
96 __u8 protocol_version;
97 __u8 reserved[3];
98};
99
100/*
101 * IOCTL Connect Client Data structure
102 */
103struct mei_connect_client_data {
104 union {
105 uuid_le in_client_uuid;
106 struct mei_client out_client_properties;
107 };
108};
109
110#endif /* _LINUX_MEI_H */
diff --git a/include/linux/mfd/abx500.h b/include/linux/mfd/abx500.h
index ee96cd51d8b2..1318ca622633 100644
--- a/include/linux/mfd/abx500.h
+++ b/include/linux/mfd/abx500.h
@@ -6,7 +6,7 @@
6 * 6 *
7 * ABX500 core access functions. 7 * ABX500 core access functions.
8 * The abx500 interface is used for the Analog Baseband chip 8 * The abx500 interface is used for the Analog Baseband chip
9 * ab3100, ab5500, and ab8500. 9 * ab3100 and ab8500.
10 * 10 *
11 * Author: Mattias Wallin <mattias.wallin@stericsson.com> 11 * Author: Mattias Wallin <mattias.wallin@stericsson.com>
12 * Author: Mattias Nilsson <mattias.i.nilsson@stericsson.com> 12 * Author: Mattias Nilsson <mattias.i.nilsson@stericsson.com>
@@ -30,9 +30,6 @@ struct device;
30#define AB3100_P1G 0xc6 30#define AB3100_P1G 0xc6
31#define AB3100_R2A 0xc7 31#define AB3100_R2A 0xc7
32#define AB3100_R2B 0xc8 32#define AB3100_R2B 0xc8
33#define AB5500_1_0 0x20
34#define AB5500_1_1 0x21
35#define AB5500_2_0 0x24
36 33
37/* 34/*
38 * AB3100, EVENTA1, A2 and A3 event register flags 35 * AB3100, EVENTA1, A2 and A3 event register flags
diff --git a/include/linux/mfd/abx500/ab5500.h b/include/linux/mfd/abx500/ab5500.h
deleted file mode 100644
index 54f820ed73bb..000000000000
--- a/include/linux/mfd/abx500/ab5500.h
+++ /dev/null
@@ -1,140 +0,0 @@
1/*
2 * Copyright (C) ST-Ericsson 2011
3 *
4 * License Terms: GNU General Public License v2
5 */
6#ifndef MFD_AB5500_H
7#define MFD_AB5500_H
8
9struct device;
10
11enum ab5500_devid {
12 AB5500_DEVID_ADC,
13 AB5500_DEVID_LEDS,
14 AB5500_DEVID_POWER,
15 AB5500_DEVID_REGULATORS,
16 AB5500_DEVID_SIM,
17 AB5500_DEVID_RTC,
18 AB5500_DEVID_CHARGER,
19 AB5500_DEVID_FUELGAUGE,
20 AB5500_DEVID_VIBRATOR,
21 AB5500_DEVID_CODEC,
22 AB5500_DEVID_USB,
23 AB5500_DEVID_OTP,
24 AB5500_DEVID_VIDEO,
25 AB5500_DEVID_DBIECI,
26 AB5500_DEVID_ONSWA,
27 AB5500_NUM_DEVICES,
28};
29
30enum ab5500_banks {
31 AB5500_BANK_VIT_IO_I2C_CLK_TST_OTP = 0,
32 AB5500_BANK_VDDDIG_IO_I2C_CLK_TST = 1,
33 AB5500_BANK_VDENC = 2,
34 AB5500_BANK_SIM_USBSIM = 3,
35 AB5500_BANK_LED = 4,
36 AB5500_BANK_ADC = 5,
37 AB5500_BANK_RTC = 6,
38 AB5500_BANK_STARTUP = 7,
39 AB5500_BANK_DBI_ECI = 8,
40 AB5500_BANK_CHG = 9,
41 AB5500_BANK_FG_BATTCOM_ACC = 10,
42 AB5500_BANK_USB = 11,
43 AB5500_BANK_IT = 12,
44 AB5500_BANK_VIBRA = 13,
45 AB5500_BANK_AUDIO_HEADSETUSB = 14,
46 AB5500_NUM_BANKS = 15,
47};
48
49enum ab5500_banks_addr {
50 AB5500_ADDR_VIT_IO_I2C_CLK_TST_OTP = 0x4A,
51 AB5500_ADDR_VDDDIG_IO_I2C_CLK_TST = 0x4B,
52 AB5500_ADDR_VDENC = 0x06,
53 AB5500_ADDR_SIM_USBSIM = 0x04,
54 AB5500_ADDR_LED = 0x10,
55 AB5500_ADDR_ADC = 0x0A,
56 AB5500_ADDR_RTC = 0x0F,
57 AB5500_ADDR_STARTUP = 0x03,
58 AB5500_ADDR_DBI_ECI = 0x07,
59 AB5500_ADDR_CHG = 0x0B,
60 AB5500_ADDR_FG_BATTCOM_ACC = 0x0C,
61 AB5500_ADDR_USB = 0x05,
62 AB5500_ADDR_IT = 0x0E,
63 AB5500_ADDR_VIBRA = 0x02,
64 AB5500_ADDR_AUDIO_HEADSETUSB = 0x0D,
65};
66
67/*
68 * Interrupt register offsets
69 * Bank : 0x0E
70 */
71#define AB5500_IT_SOURCE0_REG 0x20
72#define AB5500_IT_SOURCE1_REG 0x21
73#define AB5500_IT_SOURCE2_REG 0x22
74#define AB5500_IT_SOURCE3_REG 0x23
75#define AB5500_IT_SOURCE4_REG 0x24
76#define AB5500_IT_SOURCE5_REG 0x25
77#define AB5500_IT_SOURCE6_REG 0x26
78#define AB5500_IT_SOURCE7_REG 0x27
79#define AB5500_IT_SOURCE8_REG 0x28
80#define AB5500_IT_SOURCE9_REG 0x29
81#define AB5500_IT_SOURCE10_REG 0x2A
82#define AB5500_IT_SOURCE11_REG 0x2B
83#define AB5500_IT_SOURCE12_REG 0x2C
84#define AB5500_IT_SOURCE13_REG 0x2D
85#define AB5500_IT_SOURCE14_REG 0x2E
86#define AB5500_IT_SOURCE15_REG 0x2F
87#define AB5500_IT_SOURCE16_REG 0x30
88#define AB5500_IT_SOURCE17_REG 0x31
89#define AB5500_IT_SOURCE18_REG 0x32
90#define AB5500_IT_SOURCE19_REG 0x33
91#define AB5500_IT_SOURCE20_REG 0x34
92#define AB5500_IT_SOURCE21_REG 0x35
93#define AB5500_IT_SOURCE22_REG 0x36
94#define AB5500_IT_SOURCE23_REG 0x37
95
96#define AB5500_NUM_IRQ_REGS 23
97
98/**
99 * struct ab5500
100 * @access_mutex: lock out concurrent accesses to the AB registers
101 * @dev: a pointer to the device struct for this chip driver
102 * @ab5500_irq: the analog baseband irq
103 * @irq_base: the platform configuration irq base for subdevices
104 * @chip_name: name of this chip variant
105 * @chip_id: 8 bit chip ID for this chip variant
106 * @irq_lock: a lock to protect the mask
107 * @abb_events: a local bit mask of the prcmu wakeup events
108 * @event_mask: a local copy of the mask event registers
109 * @last_event_mask: a copy of the last event_mask written to hardware
110 * @startup_events: a copy of the first reading of the event registers
111 * @startup_events_read: whether the first events have been read
112 */
113struct ab5500 {
114 struct mutex access_mutex;
115 struct device *dev;
116 unsigned int ab5500_irq;
117 unsigned int irq_base;
118 char chip_name[32];
119 u8 chip_id;
120 struct mutex irq_lock;
121 u32 abb_events;
122 u8 mask[AB5500_NUM_IRQ_REGS];
123 u8 oldmask[AB5500_NUM_IRQ_REGS];
124 u8 startup_events[AB5500_NUM_IRQ_REGS];
125 bool startup_events_read;
126#ifdef CONFIG_DEBUG_FS
127 unsigned int debug_bank;
128 unsigned int debug_address;
129#endif
130};
131
132struct ab5500_platform_data {
133 struct {unsigned int base; unsigned int count; } irq;
134 void *dev_data[AB5500_NUM_DEVICES];
135 struct abx500_init_settings *init_settings;
136 unsigned int init_settings_sz;
137 bool pm_power_off;
138};
139
140#endif /* MFD_AB5500_H */
diff --git a/include/linux/mfd/asic3.h b/include/linux/mfd/asic3.h
index 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 7875370f7bca..3661c59aa1e9 100644
--- a/include/linux/mfd/rc5t583.h
+++ b/include/linux/mfd/rc5t583.h
@@ -250,6 +250,26 @@ enum {
250 RC5T583_EXT_PWRREQ2_CONTROL = 0x2, 250 RC5T583_EXT_PWRREQ2_CONTROL = 0x2,
251}; 251};
252 252
253enum {
254 RC5T583_REGULATOR_DC0,
255 RC5T583_REGULATOR_DC1,
256 RC5T583_REGULATOR_DC2,
257 RC5T583_REGULATOR_DC3,
258 RC5T583_REGULATOR_LDO0,
259 RC5T583_REGULATOR_LDO1,
260 RC5T583_REGULATOR_LDO2,
261 RC5T583_REGULATOR_LDO3,
262 RC5T583_REGULATOR_LDO4,
263 RC5T583_REGULATOR_LDO5,
264 RC5T583_REGULATOR_LDO6,
265 RC5T583_REGULATOR_LDO7,
266 RC5T583_REGULATOR_LDO8,
267 RC5T583_REGULATOR_LDO9,
268
269 /* Should be last entry */
270 RC5T583_REGULATOR_MAX,
271};
272
253struct rc5t583 { 273struct rc5t583 {
254 struct device *dev; 274 struct device *dev;
255 struct regmap *regmap; 275 struct regmap *regmap;
@@ -274,12 +294,21 @@ struct rc5t583 {
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 * @gpio_base: GPIO base from which gpio of this device will start. 295 * @gpio_base: GPIO base from which gpio of this device will start.
276 * @enable_shutdown: Enable shutdown through the input pin "shutdown". 296 * @enable_shutdown: Enable shutdown through the input pin "shutdown".
297 * @regulator_deepsleep_slot: The slot number on which device goes to sleep
298 * in device sleep mode.
299 * @regulator_ext_pwr_control: External power request regulator control. The
300 * regulator output enable/disable is controlled by the external
301 * power request input state.
302 * @reg_init_data: Regulator init data.
277 */ 303 */
278 304
279struct rc5t583_platform_data { 305struct rc5t583_platform_data {
280 int irq_base; 306 int irq_base;
281 int gpio_base; 307 int gpio_base;
282 bool enable_shutdown; 308 bool enable_shutdown;
309 int regulator_deepsleep_slot[RC5T583_REGULATOR_MAX];
310 unsigned long regulator_ext_pwr_control[RC5T583_REGULATOR_MAX];
311 struct regulator_init_data *reg_init_data[RC5T583_REGULATOR_MAX];
283}; 312};
284 313
285static inline int rc5t583_write(struct device *dev, uint8_t reg, uint8_t val) 314static inline int rc5t583_write(struct device *dev, uint8_t reg, uint8_t val)
diff --git a/include/linux/mfd/s5m87xx/s5m-core.h b/include/linux/mfd/s5m87xx/s5m-core.h
index a7480b57f92d..21603b42f22f 100644
--- a/include/linux/mfd/s5m87xx/s5m-core.h
+++ b/include/linux/mfd/s5m87xx/s5m-core.h
@@ -335,6 +335,7 @@ extern int s5m_reg_update(struct s5m87xx_dev *s5m87xx, u8 reg, u8 val, u8 mask);
335 335
336struct s5m_platform_data { 336struct s5m_platform_data {
337 struct s5m_regulator_data *regulators; 337 struct s5m_regulator_data *regulators;
338 struct s5m_opmode_data *opmode;
338 int device_type; 339 int device_type;
339 int num_regulators; 340 int num_regulators;
340 341
diff --git a/include/linux/mfd/s5m87xx/s5m-pmic.h b/include/linux/mfd/s5m87xx/s5m-pmic.h
index a72a5d27e62e..7c719f20f58a 100644
--- a/include/linux/mfd/s5m87xx/s5m-pmic.h
+++ b/include/linux/mfd/s5m87xx/s5m-pmic.h
@@ -58,6 +58,8 @@ enum s5m8767_regulators {
58 S5M8767_REG_MAX, 58 S5M8767_REG_MAX,
59}; 59};
60 60
61#define S5M8767_ENCTRL_SHIFT 6
62
61/* S5M8763 regulator ids */ 63/* S5M8763 regulator ids */
62enum s5m8763_regulators { 64enum s5m8763_regulators {
63 S5M8763_LDO1, 65 S5M8763_LDO1,
@@ -97,4 +99,31 @@ struct s5m_regulator_data {
97 struct regulator_init_data *initdata; 99 struct regulator_init_data *initdata;
98}; 100};
99 101
102/*
103 * s5m_opmode_data - regulator operation mode data
104 * @id: regulator id
105 * @mode: regulator operation mode
106 */
107struct s5m_opmode_data {
108 int id;
109 int mode;
110};
111
112/*
113 * s5m regulator operation mode
114 * S5M_OPMODE_OFF Regulator always OFF
115 * S5M_OPMODE_ON Regulator always ON
116 * S5M_OPMODE_LOWPOWER Regulator is on in low-power mode
117 * S5M_OPMODE_SUSPEND Regulator is changed by PWREN pin
118 * If PWREN is high, regulator is on
119 * If PWREN is low, regulator is off
120 */
121
122enum s5m_opmode {
123 S5M_OPMODE_OFF,
124 S5M_OPMODE_ON,
125 S5M_OPMODE_LOWPOWER,
126 S5M_OPMODE_SUSPEND,
127};
128
100#endif /* __LINUX_MFD_S5M_PMIC_H */ 129#endif /* __LINUX_MFD_S5M_PMIC_H */
diff --git a/include/linux/mfd/tps65090.h b/include/linux/mfd/tps65090.h
index 38e31c55adbb..6bc31d854626 100644
--- a/include/linux/mfd/tps65090.h
+++ b/include/linux/mfd/tps65090.h
@@ -22,6 +22,19 @@
22#ifndef __LINUX_MFD_TPS65090_H 22#ifndef __LINUX_MFD_TPS65090_H
23#define __LINUX_MFD_TPS65090_H 23#define __LINUX_MFD_TPS65090_H
24 24
25#include <linux/irq.h>
26
27struct tps65090 {
28 struct mutex lock;
29 struct device *dev;
30 struct i2c_client *client;
31 struct regmap *rmap;
32 struct irq_chip irq_chip;
33 struct mutex irq_lock;
34 int irq_base;
35 unsigned int id;
36};
37
25struct tps65090_subdev_info { 38struct tps65090_subdev_info {
26 int id; 39 int id;
27 const char *name; 40 const char *name;
diff --git a/include/linux/mfd/tps6586x.h b/include/linux/mfd/tps6586x.h
index b19176eab44d..f350fd0ba1df 100644
--- a/include/linux/mfd/tps6586x.h
+++ b/include/linux/mfd/tps6586x.h
@@ -68,6 +68,7 @@ struct tps6586x_subdev_info {
68 int id; 68 int id;
69 const char *name; 69 const char *name;
70 void *platform_data; 70 void *platform_data;
71 struct device_node *of_node;
71}; 72};
72 73
73struct tps6586x_platform_data { 74struct tps6586x_platform_data {
diff --git a/include/linux/mfd/wm831x/pdata.h b/include/linux/mfd/wm831x/pdata.h
index 1d7a3f7b3b5d..dcc9631b3052 100644
--- a/include/linux/mfd/wm831x/pdata.h
+++ b/include/linux/mfd/wm831x/pdata.h
@@ -26,7 +26,7 @@ struct wm831x_backlight_pdata {
26struct wm831x_backup_pdata { 26struct wm831x_backup_pdata {
27 int charger_enable; 27 int charger_enable;
28 int no_constant_voltage; /** Disable constant voltage charging */ 28 int no_constant_voltage; /** Disable constant voltage charging */
29 int vlim; /** Voltage limit in milivolts */ 29 int vlim; /** Voltage limit in millivolts */
30 int ilim; /** Current limit in microamps */ 30 int ilim; /** Current limit in microamps */
31}; 31};
32 32
diff --git a/include/linux/mfd/wm8994/core.h b/include/linux/mfd/wm8994/core.h
index 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/micrel_phy.h b/include/linux/micrel_phy.h
index dd8da342a991..61f0905bdc48 100644
--- a/include/linux/micrel_phy.h
+++ b/include/linux/micrel_phy.h
@@ -3,7 +3,7 @@
3 3
4#define MICREL_PHY_ID_MASK 0x00fffff0 4#define MICREL_PHY_ID_MASK 0x00fffff0
5 5
6#define PHY_ID_KSZ9021 0x00221611 6#define PHY_ID_KSZ9021 0x00221610
7#define PHY_ID_KS8737 0x00221720 7#define PHY_ID_KS8737 0x00221720
8#define PHY_ID_KS8041 0x00221510 8#define PHY_ID_KS8041 0x00221510
9#define PHY_ID_KS8051 0x00221550 9#define PHY_ID_KS8051 0x00221550
diff --git a/include/linux/mlx4/cmd.h b/include/linux/mlx4/cmd.h
index 9958ff2cad3c..1f3860a8a109 100644
--- a/include/linux/mlx4/cmd.h
+++ b/include/linux/mlx4/cmd.h
@@ -150,6 +150,10 @@ enum {
150 /* statistics commands */ 150 /* statistics commands */
151 MLX4_CMD_QUERY_IF_STAT = 0X54, 151 MLX4_CMD_QUERY_IF_STAT = 0X54,
152 MLX4_CMD_SET_IF_STAT = 0X55, 152 MLX4_CMD_SET_IF_STAT = 0X55,
153
154 /* set port opcode modifiers */
155 MLX4_SET_PORT_PRIO2TC = 0x8,
156 MLX4_SET_PORT_SCHEDULER = 0x9,
153}; 157};
154 158
155enum { 159enum {
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index 834c96c5d879..6e27fa99e8b9 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -98,6 +98,12 @@ enum {
98 MLX4_DEV_CAP_FLAG_SENSE_SUPPORT = 1LL << 55 98 MLX4_DEV_CAP_FLAG_SENSE_SUPPORT = 1LL << 55
99}; 99};
100 100
101enum {
102 MLX4_DEV_CAP_FLAG2_RSS = 1LL << 0,
103 MLX4_DEV_CAP_FLAG2_RSS_TOP = 1LL << 1,
104 MLX4_DEV_CAP_FLAG2_RSS_XOR = 1LL << 2
105};
106
101#define MLX4_ATTR_EXTENDED_PORT_INFO cpu_to_be16(0xff90) 107#define MLX4_ATTR_EXTENDED_PORT_INFO cpu_to_be16(0xff90)
102 108
103enum { 109enum {
@@ -292,11 +298,13 @@ struct mlx4_caps {
292 u32 max_msg_sz; 298 u32 max_msg_sz;
293 u32 page_size_cap; 299 u32 page_size_cap;
294 u64 flags; 300 u64 flags;
301 u64 flags2;
295 u32 bmme_flags; 302 u32 bmme_flags;
296 u32 reserved_lkey; 303 u32 reserved_lkey;
297 u16 stat_rate_support; 304 u16 stat_rate_support;
298 u8 port_width_cap[MLX4_MAX_PORTS + 1]; 305 u8 port_width_cap[MLX4_MAX_PORTS + 1];
299 int max_gso_sz; 306 int max_gso_sz;
307 int max_rss_tbl_sz;
300 int reserved_qps_cnt[MLX4_NUM_QP_REGION]; 308 int reserved_qps_cnt[MLX4_NUM_QP_REGION];
301 int reserved_qps; 309 int reserved_qps;
302 int reserved_qps_base[MLX4_NUM_QP_REGION]; 310 int reserved_qps_base[MLX4_NUM_QP_REGION];
@@ -628,6 +636,9 @@ int mlx4_SET_PORT_general(struct mlx4_dev *dev, u8 port, int mtu,
628 u8 pptx, u8 pfctx, u8 pprx, u8 pfcrx); 636 u8 pptx, u8 pfctx, u8 pprx, u8 pfcrx);
629int mlx4_SET_PORT_qpn_calc(struct mlx4_dev *dev, u8 port, u32 base_qpn, 637int mlx4_SET_PORT_qpn_calc(struct mlx4_dev *dev, u8 port, u32 base_qpn,
630 u8 promisc); 638 u8 promisc);
639int mlx4_SET_PORT_PRIO2TC(struct mlx4_dev *dev, u8 port, u8 *prio2tc);
640int mlx4_SET_PORT_SCHEDULER(struct mlx4_dev *dev, u8 port, u8 *tc_tx_bw,
641 u8 *pg, u16 *ratelimit);
631int mlx4_find_cached_vlan(struct mlx4_dev *dev, u8 port, u16 vid, int *idx); 642int mlx4_find_cached_vlan(struct mlx4_dev *dev, u8 port, u16 vid, int *idx);
632int mlx4_register_vlan(struct mlx4_dev *dev, u8 port, u16 vlan, int *index); 643int mlx4_register_vlan(struct mlx4_dev *dev, u8 port, u16 vlan, int *index);
633void mlx4_unregister_vlan(struct mlx4_dev *dev, u8 port, int index); 644void mlx4_unregister_vlan(struct mlx4_dev *dev, u8 port, int index);
diff --git a/include/linux/mlx4/qp.h b/include/linux/mlx4/qp.h
index 091f9e7dc8b9..338388ba260a 100644
--- a/include/linux/mlx4/qp.h
+++ b/include/linux/mlx4/qp.h
@@ -139,7 +139,8 @@ struct mlx4_qp_path {
139 u8 rgid[16]; 139 u8 rgid[16];
140 u8 sched_queue; 140 u8 sched_queue;
141 u8 vlan_index; 141 u8 vlan_index;
142 u8 reserved3[2]; 142 u8 feup;
143 u8 reserved3;
143 u8 reserved4[2]; 144 u8 reserved4[2];
144 u8 dmac[6]; 145 u8 dmac[6];
145}; 146};
@@ -233,7 +234,8 @@ struct mlx4_wqe_mlx_seg {
233 u8 owner; 234 u8 owner;
234 u8 reserved1[2]; 235 u8 reserved1[2];
235 u8 opcode; 236 u8 opcode;
236 u8 reserved2[3]; 237 __be16 sched_prio;
238 u8 reserved2;
237 u8 size; 239 u8 size;
238 /* 240 /*
239 * [17] VL15 241 * [17] VL15
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 74aa71bea1e4..7d5c37f24c63 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -896,10 +896,8 @@ int zap_vma_ptes(struct vm_area_struct *vma, unsigned long address,
896 unsigned long size); 896 unsigned long size);
897void zap_page_range(struct vm_area_struct *vma, unsigned long address, 897void zap_page_range(struct vm_area_struct *vma, unsigned long address,
898 unsigned long size, struct zap_details *); 898 unsigned long size, struct zap_details *);
899void unmap_vmas(struct mmu_gather *tlb, 899void unmap_vmas(struct mmu_gather *tlb, struct vm_area_struct *start_vma,
900 struct vm_area_struct *start_vma, unsigned long start_addr, 900 unsigned long start, unsigned long end);
901 unsigned long end_addr, unsigned long *nr_accounted,
902 struct zap_details *);
903 901
904/** 902/**
905 * mm_walk - callbacks for walk_page_range 903 * mm_walk - callbacks for walk_page_range
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index 3cc3062b3767..26574c726121 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -12,6 +12,7 @@
12#include <linux/completion.h> 12#include <linux/completion.h>
13#include <linux/cpumask.h> 13#include <linux/cpumask.h>
14#include <linux/page-debug-flags.h> 14#include <linux/page-debug-flags.h>
15#include <linux/uprobes.h>
15#include <asm/page.h> 16#include <asm/page.h>
16#include <asm/mmu.h> 17#include <asm/mmu.h>
17 18
@@ -388,6 +389,7 @@ struct mm_struct {
388#ifdef CONFIG_CPUMASK_OFFSTACK 389#ifdef CONFIG_CPUMASK_OFFSTACK
389 struct cpumask cpumask_allocation; 390 struct cpumask cpumask_allocation;
390#endif 391#endif
392 struct uprobes_state uprobes_state;
391}; 393};
392 394
393static inline void mm_init_cpumask(struct mm_struct *mm) 395static inline void mm_init_cpumask(struct mm_struct *mm)
diff --git a/include/linux/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/neighbour.h b/include/linux/neighbour.h
index b188f68a08c9..275e5d65dcb2 100644
--- a/include/linux/neighbour.h
+++ b/include/linux/neighbour.h
@@ -33,6 +33,9 @@ enum {
33#define NTF_PROXY 0x08 /* == ATF_PUBL */ 33#define NTF_PROXY 0x08 /* == ATF_PUBL */
34#define NTF_ROUTER 0x80 34#define NTF_ROUTER 0x80
35 35
36#define NTF_SELF 0x02
37#define NTF_MASTER 0x04
38
36/* 39/*
37 * Neighbor Cache Entry States. 40 * Neighbor Cache Entry States.
38 */ 41 */
diff --git a/include/linux/net.h b/include/linux/net.h
index be60c7f5e145..2d7510f38934 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -250,6 +250,29 @@ extern struct socket *sockfd_lookup(int fd, int *err);
250#define sockfd_put(sock) fput(sock->file) 250#define sockfd_put(sock) fput(sock->file)
251extern int net_ratelimit(void); 251extern int net_ratelimit(void);
252 252
253#define net_ratelimited_function(function, ...) \
254do { \
255 if (net_ratelimit()) \
256 function(__VA_ARGS__); \
257} while (0)
258
259#define net_emerg_ratelimited(fmt, ...) \
260 net_ratelimited_function(pr_emerg, fmt, ##__VA_ARGS__)
261#define net_alert_ratelimited(fmt, ...) \
262 net_ratelimited_function(pr_alert, fmt, ##__VA_ARGS__)
263#define net_crit_ratelimited(fmt, ...) \
264 net_ratelimited_function(pr_crit, fmt, ##__VA_ARGS__)
265#define net_err_ratelimited(fmt, ...) \
266 net_ratelimited_function(pr_err, fmt, ##__VA_ARGS__)
267#define net_notice_ratelimited(fmt, ...) \
268 net_ratelimited_function(pr_notice, fmt, ##__VA_ARGS__)
269#define net_warn_ratelimited(fmt, ...) \
270 net_ratelimited_function(pr_warn, fmt, ##__VA_ARGS__)
271#define net_info_ratelimited(fmt, ...) \
272 net_ratelimited_function(pr_info, fmt, ##__VA_ARGS__)
273#define net_dbg_ratelimited(fmt, ...) \
274 net_ratelimited_function(pr_debug, fmt, ##__VA_ARGS__)
275
253#define net_random() random32() 276#define net_random() random32()
254#define net_srandom(seed) srandom32((__force u32)seed) 277#define net_srandom(seed) srandom32((__force u32)seed)
255 278
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 5cbaa20f1659..e7fd468f7126 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -54,6 +54,7 @@
54#include <net/netprio_cgroup.h> 54#include <net/netprio_cgroup.h>
55 55
56#include <linux/netdev_features.h> 56#include <linux/netdev_features.h>
57#include <linux/neighbour.h>
57 58
58struct netpoll_info; 59struct netpoll_info;
59struct device; 60struct device;
@@ -288,7 +289,7 @@ struct hh_cache {
288struct header_ops { 289struct header_ops {
289 int (*create) (struct sk_buff *skb, struct net_device *dev, 290 int (*create) (struct sk_buff *skb, struct net_device *dev,
290 unsigned short type, const void *daddr, 291 unsigned short type, const void *daddr,
291 const void *saddr, unsigned len); 292 const void *saddr, unsigned int len);
292 int (*parse)(const struct sk_buff *skb, unsigned char *haddr); 293 int (*parse)(const struct sk_buff *skb, unsigned char *haddr);
293 int (*rebuild)(struct sk_buff *skb); 294 int (*rebuild)(struct sk_buff *skb);
294 int (*cache)(const struct neighbour *neigh, struct hh_cache *hh, __be16 type); 295 int (*cache)(const struct neighbour *neigh, struct hh_cache *hh, __be16 type);
@@ -905,6 +906,16 @@ struct netdev_fcoe_hbainfo {
905 * feature set might be less than what was returned by ndo_fix_features()). 906 * feature set might be less than what was returned by ndo_fix_features()).
906 * Must return >0 or -errno if it changed dev->features itself. 907 * Must return >0 or -errno if it changed dev->features itself.
907 * 908 *
909 * int (*ndo_fdb_add)(struct ndmsg *ndm, struct net_device *dev,
910 * unsigned char *addr, u16 flags)
911 * Adds an FDB entry to dev for addr.
912 * int (*ndo_fdb_del)(struct ndmsg *ndm, struct net_device *dev,
913 * unsigned char *addr)
914 * Deletes the FDB entry from dev coresponding to addr.
915 * int (*ndo_fdb_dump)(struct sk_buff *skb, struct netlink_callback *cb,
916 * struct net_device *dev, int idx)
917 * Used to add FDB entries to dump requests. Implementers should add
918 * entries to skb and update idx with the number of entries.
908 */ 919 */
909struct net_device_ops { 920struct net_device_ops {
910 int (*ndo_init)(struct net_device *dev); 921 int (*ndo_init)(struct net_device *dev);
@@ -1002,6 +1013,18 @@ struct net_device_ops {
1002 netdev_features_t features); 1013 netdev_features_t features);
1003 int (*ndo_neigh_construct)(struct neighbour *n); 1014 int (*ndo_neigh_construct)(struct neighbour *n);
1004 void (*ndo_neigh_destroy)(struct neighbour *n); 1015 void (*ndo_neigh_destroy)(struct neighbour *n);
1016
1017 int (*ndo_fdb_add)(struct ndmsg *ndm,
1018 struct net_device *dev,
1019 unsigned char *addr,
1020 u16 flags);
1021 int (*ndo_fdb_del)(struct ndmsg *ndm,
1022 struct net_device *dev,
1023 unsigned char *addr);
1024 int (*ndo_fdb_dump)(struct sk_buff *skb,
1025 struct netlink_callback *cb,
1026 struct net_device *dev,
1027 int idx);
1005}; 1028};
1006 1029
1007/* 1030/*
@@ -1132,7 +1155,6 @@ struct net_device {
1132 struct in_device __rcu *ip_ptr; /* IPv4 specific data */ 1155 struct in_device __rcu *ip_ptr; /* IPv4 specific data */
1133 struct dn_dev __rcu *dn_ptr; /* DECnet specific data */ 1156 struct dn_dev __rcu *dn_ptr; /* DECnet specific data */
1134 struct inet6_dev __rcu *ip6_ptr; /* IPv6 specific data */ 1157 struct inet6_dev __rcu *ip6_ptr; /* IPv6 specific data */
1135 void *ec_ptr; /* Econet specific data */
1136 void *ax25_ptr; /* AX.25 specific data */ 1158 void *ax25_ptr; /* AX.25 specific data */
1137 struct wireless_dev *ieee80211_ptr; /* IEEE 802.11 specific data, 1159 struct wireless_dev *ieee80211_ptr; /* IEEE 802.11 specific data,
1138 assign before registering */ 1160 assign before registering */
@@ -1403,15 +1425,6 @@ static inline bool netdev_uses_dsa_tags(struct net_device *dev)
1403 return 0; 1425 return 0;
1404} 1426}
1405 1427
1406#ifndef CONFIG_NET_NS
1407static inline void skb_set_dev(struct sk_buff *skb, struct net_device *dev)
1408{
1409 skb->dev = dev;
1410}
1411#else /* CONFIG_NET_NS */
1412void skb_set_dev(struct sk_buff *skb, struct net_device *dev);
1413#endif
1414
1415static inline bool netdev_uses_trailer_tags(struct net_device *dev) 1428static inline bool netdev_uses_trailer_tags(struct net_device *dev)
1416{ 1429{
1417#ifdef CONFIG_NET_DSA_TAG_TRAILER 1430#ifdef CONFIG_NET_DSA_TAG_TRAILER
@@ -1486,6 +1499,8 @@ struct napi_gro_cb {
1486 1499
1487 /* Free the skb? */ 1500 /* Free the skb? */
1488 int free; 1501 int free;
1502#define NAPI_GRO_FREE 1
1503#define NAPI_GRO_FREE_STOLEN_HEAD 2
1489}; 1504};
1490 1505
1491#define NAPI_GRO_CB(skb) ((struct napi_gro_cb *)(skb)->cb) 1506#define NAPI_GRO_CB(skb) ((struct napi_gro_cb *)(skb)->cb)
@@ -1689,7 +1704,7 @@ static inline void *skb_gro_network_header(struct sk_buff *skb)
1689static inline int dev_hard_header(struct sk_buff *skb, struct net_device *dev, 1704static inline int dev_hard_header(struct sk_buff *skb, struct net_device *dev,
1690 unsigned short type, 1705 unsigned short type,
1691 const void *daddr, const void *saddr, 1706 const void *daddr, const void *saddr,
1692 unsigned len) 1707 unsigned int len)
1693{ 1708{
1694 if (!dev->header_ops || !dev->header_ops->create) 1709 if (!dev->header_ops || !dev->header_ops->create)
1695 return 0; 1710 return 0;
@@ -1740,7 +1755,7 @@ struct softnet_data {
1740 unsigned int input_queue_head; 1755 unsigned int input_queue_head;
1741 unsigned int input_queue_tail; 1756 unsigned int input_queue_tail;
1742#endif 1757#endif
1743 unsigned dropped; 1758 unsigned int dropped;
1744 struct sk_buff_head input_pkt_queue; 1759 struct sk_buff_head input_pkt_queue;
1745 struct napi_struct backlog; 1760 struct napi_struct backlog;
1746}; 1761};
@@ -1925,7 +1940,7 @@ static inline void netdev_sent_queue(struct net_device *dev, unsigned int bytes)
1925} 1940}
1926 1941
1927static inline void netdev_tx_completed_queue(struct netdev_queue *dev_queue, 1942static inline void netdev_tx_completed_queue(struct netdev_queue *dev_queue,
1928 unsigned pkts, unsigned bytes) 1943 unsigned int pkts, unsigned int bytes)
1929{ 1944{
1930#ifdef CONFIG_BQL 1945#ifdef CONFIG_BQL
1931 if (unlikely(!bytes)) 1946 if (unlikely(!bytes))
@@ -1949,7 +1964,7 @@ static inline void netdev_tx_completed_queue(struct netdev_queue *dev_queue,
1949} 1964}
1950 1965
1951static inline void netdev_completed_queue(struct net_device *dev, 1966static inline void netdev_completed_queue(struct net_device *dev,
1952 unsigned pkts, unsigned bytes) 1967 unsigned int pkts, unsigned int bytes)
1953{ 1968{
1954 netdev_tx_completed_queue(netdev_get_tx_queue(dev, 0), pkts, bytes); 1969 netdev_tx_completed_queue(netdev_get_tx_queue(dev, 0), pkts, bytes);
1955} 1970}
@@ -2127,7 +2142,6 @@ extern struct sk_buff * napi_get_frags(struct napi_struct *napi);
2127extern gro_result_t napi_frags_finish(struct napi_struct *napi, 2142extern gro_result_t napi_frags_finish(struct napi_struct *napi,
2128 struct sk_buff *skb, 2143 struct sk_buff *skb,
2129 gro_result_t ret); 2144 gro_result_t ret);
2130extern struct sk_buff * napi_frags_skb(struct napi_struct *napi);
2131extern gro_result_t napi_gro_frags(struct napi_struct *napi); 2145extern gro_result_t napi_gro_frags(struct napi_struct *napi);
2132 2146
2133static inline void napi_free_frags(struct napi_struct *napi) 2147static inline void napi_free_frags(struct napi_struct *napi)
@@ -2144,9 +2158,9 @@ extern void netdev_rx_handler_unregister(struct net_device *dev);
2144extern bool dev_valid_name(const char *name); 2158extern bool dev_valid_name(const char *name);
2145extern int dev_ioctl(struct net *net, unsigned int cmd, void __user *); 2159extern int dev_ioctl(struct net *net, unsigned int cmd, void __user *);
2146extern int dev_ethtool(struct net *net, struct ifreq *); 2160extern int dev_ethtool(struct net *net, struct ifreq *);
2147extern unsigned dev_get_flags(const struct net_device *); 2161extern unsigned int dev_get_flags(const struct net_device *);
2148extern int __dev_change_flags(struct net_device *, unsigned int flags); 2162extern int __dev_change_flags(struct net_device *, unsigned int flags);
2149extern int dev_change_flags(struct net_device *, unsigned); 2163extern int dev_change_flags(struct net_device *, unsigned int);
2150extern void __dev_notify_flags(struct net_device *, unsigned int old_flags); 2164extern void __dev_notify_flags(struct net_device *, unsigned int old_flags);
2151extern int dev_change_name(struct net_device *, const char *); 2165extern int dev_change_name(struct net_device *, const char *);
2152extern int dev_set_alias(struct net_device *, const char *, size_t); 2166extern int dev_set_alias(struct net_device *, const char *, size_t);
@@ -2546,6 +2560,7 @@ extern int dev_addr_init(struct net_device *dev);
2546 2560
2547/* Functions used for unicast addresses handling */ 2561/* Functions used for unicast addresses handling */
2548extern int dev_uc_add(struct net_device *dev, unsigned char *addr); 2562extern int dev_uc_add(struct net_device *dev, unsigned char *addr);
2563extern int dev_uc_add_excl(struct net_device *dev, unsigned char *addr);
2549extern int dev_uc_del(struct net_device *dev, unsigned char *addr); 2564extern int dev_uc_del(struct net_device *dev, unsigned char *addr);
2550extern int dev_uc_sync(struct net_device *to, struct net_device *from); 2565extern int dev_uc_sync(struct net_device *to, struct net_device *from);
2551extern void dev_uc_unsync(struct net_device *to, struct net_device *from); 2566extern void dev_uc_unsync(struct net_device *to, struct net_device *from);
@@ -2555,6 +2570,7 @@ extern void dev_uc_init(struct net_device *dev);
2555/* Functions used for multicast addresses handling */ 2570/* Functions used for multicast addresses handling */
2556extern int dev_mc_add(struct net_device *dev, unsigned char *addr); 2571extern int dev_mc_add(struct net_device *dev, unsigned char *addr);
2557extern int dev_mc_add_global(struct net_device *dev, unsigned char *addr); 2572extern int dev_mc_add_global(struct net_device *dev, unsigned char *addr);
2573extern int dev_mc_add_excl(struct net_device *dev, unsigned char *addr);
2558extern int dev_mc_del(struct net_device *dev, unsigned char *addr); 2574extern int dev_mc_del(struct net_device *dev, unsigned char *addr);
2559extern int dev_mc_del_global(struct net_device *dev, unsigned char *addr); 2575extern int dev_mc_del_global(struct net_device *dev, unsigned char *addr);
2560extern int dev_mc_sync(struct net_device *to, struct net_device *from); 2576extern int dev_mc_sync(struct net_device *to, struct net_device *from);
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index 29734be334c1..ff9c84c29b28 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -154,12 +154,6 @@ void nf_unregister_hooks(struct nf_hook_ops *reg, unsigned int n);
154int nf_register_sockopt(struct nf_sockopt_ops *reg); 154int nf_register_sockopt(struct nf_sockopt_ops *reg);
155void nf_unregister_sockopt(struct nf_sockopt_ops *reg); 155void nf_unregister_sockopt(struct nf_sockopt_ops *reg);
156 156
157#ifdef CONFIG_SYSCTL
158/* Sysctl registration */
159extern struct ctl_path nf_net_netfilter_sysctl_path[];
160extern struct ctl_path nf_net_ipv4_netfilter_sysctl_path[];
161#endif /* CONFIG_SYSCTL */
162
163extern struct list_head nf_hooks[NFPROTO_NUMPROTO][NF_MAX_HOOKS]; 157extern struct list_head nf_hooks[NFPROTO_NUMPROTO][NF_MAX_HOOKS];
164 158
165#if defined(CONFIG_JUMP_LABEL) 159#if defined(CONFIG_JUMP_LABEL)
diff --git a/include/linux/netfilter/ipset/ip_set.h b/include/linux/netfilter/ipset/ip_set.h
index 2f8e18a23227..2edc64cab739 100644
--- a/include/linux/netfilter/ipset/ip_set.h
+++ b/include/linux/netfilter/ipset/ip_set.h
@@ -411,26 +411,32 @@ ip_set_get_h16(const struct nlattr *attr)
411#define ipset_nest_start(skb, attr) nla_nest_start(skb, attr | NLA_F_NESTED) 411#define ipset_nest_start(skb, attr) nla_nest_start(skb, attr | NLA_F_NESTED)
412#define ipset_nest_end(skb, start) nla_nest_end(skb, start) 412#define ipset_nest_end(skb, start) nla_nest_end(skb, start)
413 413
414#define NLA_PUT_IPADDR4(skb, type, ipaddr) \ 414static inline int nla_put_ipaddr4(struct sk_buff *skb, int type, __be32 ipaddr)
415do { \ 415{
416 struct nlattr *__nested = ipset_nest_start(skb, type); \ 416 struct nlattr *__nested = ipset_nest_start(skb, type);
417 \ 417 int ret;
418 if (!__nested) \ 418
419 goto nla_put_failure; \ 419 if (!__nested)
420 NLA_PUT_NET32(skb, IPSET_ATTR_IPADDR_IPV4, ipaddr); \ 420 return -EMSGSIZE;
421 ipset_nest_end(skb, __nested); \ 421 ret = nla_put_net32(skb, IPSET_ATTR_IPADDR_IPV4, ipaddr);
422} while (0) 422 if (!ret)
423 423 ipset_nest_end(skb, __nested);
424#define NLA_PUT_IPADDR6(skb, type, ipaddrptr) \ 424 return ret;
425do { \ 425}
426 struct nlattr *__nested = ipset_nest_start(skb, type); \ 426
427 \ 427static inline int nla_put_ipaddr6(struct sk_buff *skb, int type, const struct in6_addr *ipaddrptr)
428 if (!__nested) \ 428{
429 goto nla_put_failure; \ 429 struct nlattr *__nested = ipset_nest_start(skb, type);
430 NLA_PUT(skb, IPSET_ATTR_IPADDR_IPV6, \ 430 int ret;
431 sizeof(struct in6_addr), ipaddrptr); \ 431
432 ipset_nest_end(skb, __nested); \ 432 if (!__nested)
433} while (0) 433 return -EMSGSIZE;
434 ret = nla_put(skb, IPSET_ATTR_IPADDR_IPV6,
435 sizeof(struct in6_addr), ipaddrptr);
436 if (!ret)
437 ipset_nest_end(skb, __nested);
438 return ret;
439}
434 440
435/* Get address from skbuff */ 441/* Get address from skbuff */
436static inline __be32 442static inline __be32
@@ -472,8 +478,8 @@ union ip_set_name_index {
472 478
473#define IP_SET_OP_GET_BYNAME 0x00000006 /* Get set index by name */ 479#define IP_SET_OP_GET_BYNAME 0x00000006 /* Get set index by name */
474struct ip_set_req_get_set { 480struct ip_set_req_get_set {
475 unsigned op; 481 unsigned int op;
476 unsigned version; 482 unsigned int version;
477 union ip_set_name_index set; 483 union ip_set_name_index set;
478}; 484};
479 485
@@ -482,8 +488,8 @@ struct ip_set_req_get_set {
482 488
483#define IP_SET_OP_VERSION 0x00000100 /* Ask kernel version */ 489#define IP_SET_OP_VERSION 0x00000100 /* Ask kernel version */
484struct ip_set_req_version { 490struct ip_set_req_version {
485 unsigned op; 491 unsigned int op;
486 unsigned version; 492 unsigned int version;
487}; 493};
488 494
489#endif /*_IP_SET_H */ 495#endif /*_IP_SET_H */
diff --git a/include/linux/netfilter/ipset/ip_set_ahash.h b/include/linux/netfilter/ipset/ip_set_ahash.h
index 05a5d72680be..b114d35aea5e 100644
--- a/include/linux/netfilter/ipset/ip_set_ahash.h
+++ b/include/linux/netfilter/ipset/ip_set_ahash.h
@@ -99,6 +99,22 @@ struct ip_set_hash {
99#endif 99#endif
100}; 100};
101 101
102static size_t
103htable_size(u8 hbits)
104{
105 size_t hsize;
106
107 /* We must fit both into u32 in jhash and size_t */
108 if (hbits > 31)
109 return 0;
110 hsize = jhash_size(hbits);
111 if ((((size_t)-1) - sizeof(struct htable))/sizeof(struct hbucket)
112 < hsize)
113 return 0;
114
115 return hsize * sizeof(struct hbucket) + sizeof(struct htable);
116}
117
102/* Compute htable_bits from the user input parameter hashsize */ 118/* Compute htable_bits from the user input parameter hashsize */
103static u8 119static u8
104htable_bits(u32 hashsize) 120htable_bits(u32 hashsize)
@@ -594,17 +610,20 @@ type_pf_head(struct ip_set *set, struct sk_buff *skb)
594 nested = ipset_nest_start(skb, IPSET_ATTR_DATA); 610 nested = ipset_nest_start(skb, IPSET_ATTR_DATA);
595 if (!nested) 611 if (!nested)
596 goto nla_put_failure; 612 goto nla_put_failure;
597 NLA_PUT_NET32(skb, IPSET_ATTR_HASHSIZE, 613 if (nla_put_net32(skb, IPSET_ATTR_HASHSIZE,
598 htonl(jhash_size(h->table->htable_bits))); 614 htonl(jhash_size(h->table->htable_bits))) ||
599 NLA_PUT_NET32(skb, IPSET_ATTR_MAXELEM, htonl(h->maxelem)); 615 nla_put_net32(skb, IPSET_ATTR_MAXELEM, htonl(h->maxelem)))
616 goto nla_put_failure;
600#ifdef IP_SET_HASH_WITH_NETMASK 617#ifdef IP_SET_HASH_WITH_NETMASK
601 if (h->netmask != HOST_MASK) 618 if (h->netmask != HOST_MASK &&
602 NLA_PUT_U8(skb, IPSET_ATTR_NETMASK, h->netmask); 619 nla_put_u8(skb, IPSET_ATTR_NETMASK, h->netmask))
620 goto nla_put_failure;
603#endif 621#endif
604 NLA_PUT_NET32(skb, IPSET_ATTR_REFERENCES, htonl(set->ref - 1)); 622 if (nla_put_net32(skb, IPSET_ATTR_REFERENCES, htonl(set->ref - 1)) ||
605 NLA_PUT_NET32(skb, IPSET_ATTR_MEMSIZE, htonl(memsize)); 623 nla_put_net32(skb, IPSET_ATTR_MEMSIZE, htonl(memsize)) ||
606 if (with_timeout(h->timeout)) 624 (with_timeout(h->timeout) &&
607 NLA_PUT_NET32(skb, IPSET_ATTR_TIMEOUT, htonl(h->timeout)); 625 nla_put_net32(skb, IPSET_ATTR_TIMEOUT, htonl(h->timeout))))
626 goto nla_put_failure;
608 ipset_nest_end(skb, nested); 627 ipset_nest_end(skb, nested);
609 628
610 return 0; 629 return 0;
diff --git a/include/linux/netfilter/ipset/ip_set_timeout.h b/include/linux/netfilter/ipset/ip_set_timeout.h
index 47923205a4ad..41d9cfa08167 100644
--- a/include/linux/netfilter/ipset/ip_set_timeout.h
+++ b/include/linux/netfilter/ipset/ip_set_timeout.h
@@ -30,6 +30,10 @@ ip_set_timeout_uget(struct nlattr *tb)
30{ 30{
31 unsigned int timeout = ip_set_get_h32(tb); 31 unsigned int timeout = ip_set_get_h32(tb);
32 32
33 /* Normalize to fit into jiffies */
34 if (timeout > UINT_MAX/MSEC_PER_SEC)
35 timeout = UINT_MAX/MSEC_PER_SEC;
36
33 /* Userspace supplied TIMEOUT parameter: adjust crazy size */ 37 /* Userspace supplied TIMEOUT parameter: adjust crazy size */
34 return timeout == IPSET_NO_TIMEOUT ? IPSET_NO_TIMEOUT - 1 : timeout; 38 return timeout == IPSET_NO_TIMEOUT ? IPSET_NO_TIMEOUT - 1 : timeout;
35} 39}
diff --git a/include/linux/netfilter/nf_conntrack_common.h b/include/linux/netfilter/nf_conntrack_common.h
index 0d3dd66322ec..d146872a0b91 100644
--- a/include/linux/netfilter/nf_conntrack_common.h
+++ b/include/linux/netfilter/nf_conntrack_common.h
@@ -83,6 +83,10 @@ enum ip_conntrack_status {
83 /* Conntrack is a fake untracked entry */ 83 /* Conntrack is a fake untracked entry */
84 IPS_UNTRACKED_BIT = 12, 84 IPS_UNTRACKED_BIT = 12,
85 IPS_UNTRACKED = (1 << IPS_UNTRACKED_BIT), 85 IPS_UNTRACKED = (1 << IPS_UNTRACKED_BIT),
86
87 /* Conntrack got a helper explicitly attached via CT target. */
88 IPS_HELPER_BIT = 13,
89 IPS_HELPER = (1 << IPS_HELPER_BIT),
86}; 90};
87 91
88/* Connection tracking event types */ 92/* Connection tracking event types */
diff --git a/include/linux/netfilter/nf_conntrack_h323_types.h b/include/linux/netfilter/nf_conntrack_h323_types.h
index f35b6b4801e7..b0821f45fbe4 100644
--- a/include/linux/netfilter/nf_conntrack_h323_types.h
+++ b/include/linux/netfilter/nf_conntrack_h323_types.h
@@ -7,12 +7,12 @@
7 7
8typedef struct TransportAddress_ipAddress { /* SEQUENCE */ 8typedef struct TransportAddress_ipAddress { /* SEQUENCE */
9 int options; /* No use */ 9 int options; /* No use */
10 unsigned ip; 10 unsigned int ip;
11} TransportAddress_ipAddress; 11} TransportAddress_ipAddress;
12 12
13typedef struct TransportAddress_ip6Address { /* SEQUENCE */ 13typedef struct TransportAddress_ip6Address { /* SEQUENCE */
14 int options; /* No use */ 14 int options; /* No use */
15 unsigned ip; 15 unsigned int ip;
16} TransportAddress_ip6Address; 16} TransportAddress_ip6Address;
17 17
18typedef struct TransportAddress { /* CHOICE */ 18typedef struct TransportAddress { /* CHOICE */
@@ -96,12 +96,12 @@ typedef struct DataType { /* CHOICE */
96 96
97typedef struct UnicastAddress_iPAddress { /* SEQUENCE */ 97typedef struct UnicastAddress_iPAddress { /* SEQUENCE */
98 int options; /* No use */ 98 int options; /* No use */
99 unsigned network; 99 unsigned int network;
100} UnicastAddress_iPAddress; 100} UnicastAddress_iPAddress;
101 101
102typedef struct UnicastAddress_iP6Address { /* SEQUENCE */ 102typedef struct UnicastAddress_iP6Address { /* SEQUENCE */
103 int options; /* No use */ 103 int options; /* No use */
104 unsigned network; 104 unsigned int network;
105} UnicastAddress_iP6Address; 105} UnicastAddress_iP6Address;
106 106
107typedef struct UnicastAddress { /* CHOICE */ 107typedef struct UnicastAddress { /* CHOICE */
@@ -698,7 +698,7 @@ typedef struct RegistrationRequest { /* SEQUENCE */
698 } options; 698 } options;
699 RegistrationRequest_callSignalAddress callSignalAddress; 699 RegistrationRequest_callSignalAddress callSignalAddress;
700 RegistrationRequest_rasAddress rasAddress; 700 RegistrationRequest_rasAddress rasAddress;
701 unsigned timeToLive; 701 unsigned int timeToLive;
702} RegistrationRequest; 702} RegistrationRequest;
703 703
704typedef struct RegistrationConfirm_callSignalAddress { /* SEQUENCE OF */ 704typedef struct RegistrationConfirm_callSignalAddress { /* SEQUENCE OF */
@@ -730,7 +730,7 @@ typedef struct RegistrationConfirm { /* SEQUENCE */
730 eRegistrationConfirm_genericData = (1 << 12), 730 eRegistrationConfirm_genericData = (1 << 12),
731 } options; 731 } options;
732 RegistrationConfirm_callSignalAddress callSignalAddress; 732 RegistrationConfirm_callSignalAddress callSignalAddress;
733 unsigned timeToLive; 733 unsigned int timeToLive;
734} RegistrationConfirm; 734} RegistrationConfirm;
735 735
736typedef struct UnregistrationRequest_callSignalAddress { /* SEQUENCE OF */ 736typedef struct UnregistrationRequest_callSignalAddress { /* SEQUENCE OF */
diff --git a/include/linux/netfilter/nfnetlink.h b/include/linux/netfilter/nfnetlink.h
index 6fd1f0d07e64..a1048c1587d1 100644
--- a/include/linux/netfilter/nfnetlink.h
+++ b/include/linux/netfilter/nfnetlink.h
@@ -80,7 +80,7 @@ extern int nfnetlink_subsys_register(const struct nfnetlink_subsystem *n);
80extern int nfnetlink_subsys_unregister(const struct nfnetlink_subsystem *n); 80extern int nfnetlink_subsys_unregister(const struct nfnetlink_subsystem *n);
81 81
82extern int nfnetlink_has_listeners(struct net *net, unsigned int group); 82extern int nfnetlink_has_listeners(struct net *net, unsigned int group);
83extern int nfnetlink_send(struct sk_buff *skb, struct net *net, u32 pid, unsigned group, 83extern int nfnetlink_send(struct sk_buff *skb, struct net *net, u32 pid, unsigned int group,
84 int echo, gfp_t flags); 84 int echo, gfp_t flags);
85extern int nfnetlink_set_err(struct net *net, u32 pid, u32 group, int error); 85extern int nfnetlink_set_err(struct net *net, u32 pid, u32 group, int error);
86extern int nfnetlink_unicast(struct sk_buff *skb, struct net *net, u_int32_t pid, int flags); 86extern int nfnetlink_unicast(struct sk_buff *skb, struct net *net, u_int32_t pid, int flags);
diff --git a/include/linux/netfilter/xt_HMARK.h b/include/linux/netfilter/xt_HMARK.h
new file mode 100644
index 000000000000..abb1650940d2
--- /dev/null
+++ b/include/linux/netfilter/xt_HMARK.h
@@ -0,0 +1,45 @@
1#ifndef XT_HMARK_H_
2#define XT_HMARK_H_
3
4#include <linux/types.h>
5
6enum {
7 XT_HMARK_SADDR_MASK,
8 XT_HMARK_DADDR_MASK,
9 XT_HMARK_SPI,
10 XT_HMARK_SPI_MASK,
11 XT_HMARK_SPORT,
12 XT_HMARK_DPORT,
13 XT_HMARK_SPORT_MASK,
14 XT_HMARK_DPORT_MASK,
15 XT_HMARK_PROTO_MASK,
16 XT_HMARK_RND,
17 XT_HMARK_MODULUS,
18 XT_HMARK_OFFSET,
19 XT_HMARK_CT,
20 XT_HMARK_METHOD_L3,
21 XT_HMARK_METHOD_L3_4,
22};
23#define XT_HMARK_FLAG(flag) (1 << flag)
24
25union hmark_ports {
26 struct {
27 __u16 src;
28 __u16 dst;
29 } p16;
30 __u32 v32;
31};
32
33struct xt_hmark_info {
34 union nf_inet_addr src_mask;
35 union nf_inet_addr dst_mask;
36 union hmark_ports port_mask;
37 union hmark_ports port_set;
38 __u32 flags;
39 __u16 proto_mask;
40 __u32 hashrnd;
41 __u32 hmodulus;
42 __u32 hoffset; /* Mark offset to start from */
43};
44
45#endif /* XT_HMARK_H_ */
diff --git a/include/linux/netfilter/xt_hashlimit.h b/include/linux/netfilter/xt_hashlimit.h
index b1925b5925e9..c42e52f39f8f 100644
--- a/include/linux/netfilter/xt_hashlimit.h
+++ b/include/linux/netfilter/xt_hashlimit.h
@@ -6,7 +6,11 @@
6/* timings are in milliseconds. */ 6/* timings are in milliseconds. */
7#define XT_HASHLIMIT_SCALE 10000 7#define XT_HASHLIMIT_SCALE 10000
8/* 1/10,000 sec period => max of 10,000/sec. Min rate is then 429490 8/* 1/10,000 sec period => max of 10,000/sec. Min rate is then 429490
9 seconds, or one every 59 hours. */ 9 * seconds, or one packet every 59 hours.
10 */
11
12/* packet length accounting is done in 16-byte steps */
13#define XT_HASHLIMIT_BYTE_SHIFT 4
10 14
11/* details of this structure hidden by the implementation */ 15/* details of this structure hidden by the implementation */
12struct xt_hashlimit_htable; 16struct xt_hashlimit_htable;
@@ -17,7 +21,13 @@ enum {
17 XT_HASHLIMIT_HASH_SIP = 1 << 2, 21 XT_HASHLIMIT_HASH_SIP = 1 << 2,
18 XT_HASHLIMIT_HASH_SPT = 1 << 3, 22 XT_HASHLIMIT_HASH_SPT = 1 << 3,
19 XT_HASHLIMIT_INVERT = 1 << 4, 23 XT_HASHLIMIT_INVERT = 1 << 4,
24 XT_HASHLIMIT_BYTES = 1 << 5,
20}; 25};
26#ifdef __KERNEL__
27#define XT_HASHLIMIT_ALL (XT_HASHLIMIT_HASH_DIP | XT_HASHLIMIT_HASH_DPT | \
28 XT_HASHLIMIT_HASH_SIP | XT_HASHLIMIT_HASH_SPT | \
29 XT_HASHLIMIT_INVERT | XT_HASHLIMIT_BYTES)
30#endif
21 31
22struct hashlimit_cfg { 32struct hashlimit_cfg {
23 __u32 mode; /* bitmask of XT_HASHLIMIT_HASH_* */ 33 __u32 mode; /* bitmask of XT_HASHLIMIT_HASH_* */
diff --git a/include/linux/netfilter_ipv4/Kbuild b/include/linux/netfilter_ipv4/Kbuild
index 31f8bec95650..c61b8fb1a9ef 100644
--- a/include/linux/netfilter_ipv4/Kbuild
+++ b/include/linux/netfilter_ipv4/Kbuild
@@ -1,4 +1,3 @@
1header-y += ip_queue.h
2header-y += ip_tables.h 1header-y += ip_tables.h
3header-y += ipt_CLUSTERIP.h 2header-y += ipt_CLUSTERIP.h
4header-y += ipt_ECN.h 3header-y += ipt_ECN.h
diff --git a/include/linux/netfilter_ipv4/ip_queue.h b/include/linux/netfilter_ipv4/ip_queue.h
deleted file mode 100644
index a03507f465f8..000000000000
--- a/include/linux/netfilter_ipv4/ip_queue.h
+++ /dev/null
@@ -1,72 +0,0 @@
1/*
2 * This is a module which is used for queueing IPv4 packets and
3 * communicating with userspace via netlink.
4 *
5 * (C) 2000 James Morris, this code is GPL.
6 */
7#ifndef _IP_QUEUE_H
8#define _IP_QUEUE_H
9
10#ifdef __KERNEL__
11#ifdef DEBUG_IPQ
12#define QDEBUG(x...) printk(KERN_DEBUG ## x)
13#else
14#define QDEBUG(x...)
15#endif /* DEBUG_IPQ */
16#else
17#include <net/if.h>
18#endif /* ! __KERNEL__ */
19
20/* Messages sent from kernel */
21typedef struct ipq_packet_msg {
22 unsigned long packet_id; /* ID of queued packet */
23 unsigned long mark; /* Netfilter mark value */
24 long timestamp_sec; /* Packet arrival time (seconds) */
25 long timestamp_usec; /* Packet arrvial time (+useconds) */
26 unsigned int hook; /* Netfilter hook we rode in on */
27 char indev_name[IFNAMSIZ]; /* Name of incoming interface */
28 char outdev_name[IFNAMSIZ]; /* Name of outgoing interface */
29 __be16 hw_protocol; /* Hardware protocol (network order) */
30 unsigned short hw_type; /* Hardware type */
31 unsigned char hw_addrlen; /* Hardware address length */
32 unsigned char hw_addr[8]; /* Hardware address */
33 size_t data_len; /* Length of packet data */
34 unsigned char payload[0]; /* Optional packet data */
35} ipq_packet_msg_t;
36
37/* Messages sent from userspace */
38typedef struct ipq_mode_msg {
39 unsigned char value; /* Requested mode */
40 size_t range; /* Optional range of packet requested */
41} ipq_mode_msg_t;
42
43typedef struct ipq_verdict_msg {
44 unsigned int value; /* Verdict to hand to netfilter */
45 unsigned long id; /* Packet ID for this verdict */
46 size_t data_len; /* Length of replacement data */
47 unsigned char payload[0]; /* Optional replacement packet */
48} ipq_verdict_msg_t;
49
50typedef struct ipq_peer_msg {
51 union {
52 ipq_verdict_msg_t verdict;
53 ipq_mode_msg_t mode;
54 } msg;
55} ipq_peer_msg_t;
56
57/* Packet delivery modes */
58enum {
59 IPQ_COPY_NONE, /* Initial mode, packets are dropped */
60 IPQ_COPY_META, /* Copy metadata */
61 IPQ_COPY_PACKET /* Copy metadata + packet (range) */
62};
63#define IPQ_COPY_MAX IPQ_COPY_PACKET
64
65/* Types of messages */
66#define IPQM_BASE 0x10 /* standard netlink messages below this */
67#define IPQM_MODE (IPQM_BASE + 1) /* Mode request from peer */
68#define IPQM_VERDICT (IPQM_BASE + 2) /* Verdict from peer */
69#define IPQM_PACKET (IPQM_BASE + 3) /* Packet from kernel */
70#define IPQM_MAX (IPQM_BASE + 4)
71
72#endif /*_IP_QUEUE_H*/
diff --git a/include/linux/netfilter_ipv6/ip6_tables.h b/include/linux/netfilter_ipv6/ip6_tables.h
index 1bc898b14a80..08c2cbbaa32b 100644
--- a/include/linux/netfilter_ipv6/ip6_tables.h
+++ b/include/linux/netfilter_ipv6/ip6_tables.h
@@ -298,9 +298,14 @@ ip6t_ext_hdr(u8 nexthdr)
298 (nexthdr == IPPROTO_DSTOPTS); 298 (nexthdr == IPPROTO_DSTOPTS);
299} 299}
300 300
301enum {
302 IP6T_FH_F_FRAG = (1 << 0),
303 IP6T_FH_F_AUTH = (1 << 1),
304};
305
301/* find specified header and get offset to it */ 306/* find specified header and get offset to it */
302extern int ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset, 307extern int ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset,
303 int target, unsigned short *fragoff); 308 int target, unsigned short *fragoff, int *fragflg);
304 309
305#ifdef CONFIG_COMPAT 310#ifdef CONFIG_COMPAT
306#include <net/compat.h> 311#include <net/compat.h>
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index a2092f582a78..0f628ffa420c 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -7,7 +7,7 @@
7#define NETLINK_ROUTE 0 /* Routing/device hook */ 7#define NETLINK_ROUTE 0 /* Routing/device hook */
8#define NETLINK_UNUSED 1 /* Unused number */ 8#define NETLINK_UNUSED 1 /* Unused number */
9#define NETLINK_USERSOCK 2 /* Reserved for user mode socket protocols */ 9#define NETLINK_USERSOCK 2 /* Reserved for user mode socket protocols */
10#define NETLINK_FIREWALL 3 /* Firewalling hook */ 10#define NETLINK_FIREWALL 3 /* Unused number, formerly ip_queue */
11#define NETLINK_SOCK_DIAG 4 /* socket monitoring */ 11#define NETLINK_SOCK_DIAG 4 /* socket monitoring */
12#define NETLINK_NFLOG 5 /* netfilter/iptables ULOG */ 12#define NETLINK_NFLOG 5 /* netfilter/iptables ULOG */
13#define NETLINK_XFRM 6 /* ipsec */ 13#define NETLINK_XFRM 6 /* ipsec */
diff --git a/include/linux/nfc.h b/include/linux/nfc.h
index 39c1fcf089c0..0ae9b5857c83 100644
--- a/include/linux/nfc.h
+++ b/include/linux/nfc.h
@@ -70,6 +70,7 @@ enum nfc_commands {
70 NFC_EVENT_TARGETS_FOUND, 70 NFC_EVENT_TARGETS_FOUND,
71 NFC_EVENT_DEVICE_ADDED, 71 NFC_EVENT_DEVICE_ADDED,
72 NFC_EVENT_DEVICE_REMOVED, 72 NFC_EVENT_DEVICE_REMOVED,
73 NFC_EVENT_TARGET_LOST,
73/* private: internal use only */ 74/* private: internal use only */
74 __NFC_CMD_AFTER_LAST 75 __NFC_CMD_AFTER_LAST
75}; 76};
diff --git a/include/linux/nfc/pn544.h b/include/linux/nfc/pn544.h
index 7ab8521f2347..9890bbaf4328 100644
--- a/include/linux/nfc/pn544.h
+++ b/include/linux/nfc/pn544.h
@@ -84,6 +84,12 @@ struct pn544_fw_packet {
84}; 84};
85 85
86#ifdef __KERNEL__ 86#ifdef __KERNEL__
87enum {
88 NFC_GPIO_ENABLE,
89 NFC_GPIO_FW_RESET,
90 NFC_GPIO_IRQ
91};
92
87/* board config */ 93/* board config */
88struct pn544_nfc_platform_data { 94struct pn544_nfc_platform_data {
89 int (*request_resources) (struct i2c_client *client); 95 int (*request_resources) (struct i2c_client *client);
@@ -91,6 +97,7 @@ struct pn544_nfc_platform_data {
91 void (*enable) (int fw); 97 void (*enable) (int fw);
92 int (*test) (void); 98 int (*test) (void);
93 void (*disable) (void); 99 void (*disable) (void);
100 int (*get_gpio)(int type);
94}; 101};
95#endif /* __KERNEL__ */ 102#endif /* __KERNEL__ */
96 103
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index e474f6e780cc..a6959f72745e 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -548,6 +548,11 @@
548 * @NL80211_CMD_SET_NOACK_MAP: sets a bitmap for the individual TIDs whether 548 * @NL80211_CMD_SET_NOACK_MAP: sets a bitmap for the individual TIDs whether
549 * No Acknowledgement Policy should be applied. 549 * No Acknowledgement Policy should be applied.
550 * 550 *
551 * @NL80211_CMD_CH_SWITCH_NOTIFY: An AP or GO may decide to switch channels
552 * independently of the userspace SME, send this event indicating
553 * %NL80211_ATTR_IFINDEX is now on %NL80211_ATTR_WIPHY_FREQ with
554 * %NL80211_ATTR_WIPHY_CHANNEL_TYPE.
555 *
551 * @NL80211_CMD_MAX: highest used command number 556 * @NL80211_CMD_MAX: highest used command number
552 * @__NL80211_CMD_AFTER_LAST: internal use 557 * @__NL80211_CMD_AFTER_LAST: internal use
553 */ 558 */
@@ -689,6 +694,8 @@ enum nl80211_commands {
689 694
690 NL80211_CMD_SET_NOACK_MAP, 695 NL80211_CMD_SET_NOACK_MAP,
691 696
697 NL80211_CMD_CH_SWITCH_NOTIFY,
698
692 /* add new commands above here */ 699 /* add new commands above here */
693 700
694 /* used to define NL80211_CMD_MAX below */ 701 /* used to define NL80211_CMD_MAX below */
@@ -1587,6 +1594,8 @@ enum nl80211_sta_flags {
1587 NL80211_STA_FLAG_MAX = __NL80211_STA_FLAG_AFTER_LAST - 1 1594 NL80211_STA_FLAG_MAX = __NL80211_STA_FLAG_AFTER_LAST - 1
1588}; 1595};
1589 1596
1597#define NL80211_STA_FLAG_MAX_OLD_API NL80211_STA_FLAG_TDLS_PEER
1598
1590/** 1599/**
1591 * struct nl80211_sta_flag_update - station flags mask/set 1600 * struct nl80211_sta_flag_update - station flags mask/set
1592 * @mask: mask of station flags to set 1601 * @mask: mask of station flags to set
@@ -1685,6 +1694,7 @@ enum nl80211_sta_bss_param {
1685 * @NL80211_STA_INFO_CONNECTED_TIME: time since the station is last connected 1694 * @NL80211_STA_INFO_CONNECTED_TIME: time since the station is last connected
1686 * @NL80211_STA_INFO_STA_FLAGS: Contains a struct nl80211_sta_flag_update. 1695 * @NL80211_STA_INFO_STA_FLAGS: Contains a struct nl80211_sta_flag_update.
1687 * @NL80211_STA_INFO_BEACON_LOSS: count of times beacon loss was detected (u32) 1696 * @NL80211_STA_INFO_BEACON_LOSS: count of times beacon loss was detected (u32)
1697 * @NL80211_STA_INFO_T_OFFSET: timing offset with respect to this STA (s64)
1688 * @__NL80211_STA_INFO_AFTER_LAST: internal 1698 * @__NL80211_STA_INFO_AFTER_LAST: internal
1689 * @NL80211_STA_INFO_MAX: highest possible station info attribute 1699 * @NL80211_STA_INFO_MAX: highest possible station info attribute
1690 */ 1700 */
@@ -1708,6 +1718,7 @@ enum nl80211_sta_info {
1708 NL80211_STA_INFO_CONNECTED_TIME, 1718 NL80211_STA_INFO_CONNECTED_TIME,
1709 NL80211_STA_INFO_STA_FLAGS, 1719 NL80211_STA_INFO_STA_FLAGS,
1710 NL80211_STA_INFO_BEACON_LOSS, 1720 NL80211_STA_INFO_BEACON_LOSS,
1721 NL80211_STA_INFO_T_OFFSET,
1711 1722
1712 /* keep last */ 1723 /* keep last */
1713 __NL80211_STA_INFO_AFTER_LAST, 1724 __NL80211_STA_INFO_AFTER_LAST,
@@ -1985,9 +1996,9 @@ enum nl80211_reg_rule_flags {
1985 * enum nl80211_dfs_regions - regulatory DFS regions 1996 * enum nl80211_dfs_regions - regulatory DFS regions
1986 * 1997 *
1987 * @NL80211_DFS_UNSET: Country has no DFS master region specified 1998 * @NL80211_DFS_UNSET: Country has no DFS master region specified
1988 * @NL80211_DFS_FCC_: Country follows DFS master rules from FCC 1999 * @NL80211_DFS_FCC: Country follows DFS master rules from FCC
1989 * @NL80211_DFS_FCC_: Country follows DFS master rules from ETSI 2000 * @NL80211_DFS_ETSI: Country follows DFS master rules from ETSI
1990 * @NL80211_DFS_JP_: Country follows DFS master rules from JP/MKK/Telec 2001 * @NL80211_DFS_JP: Country follows DFS master rules from JP/MKK/Telec
1991 */ 2002 */
1992enum nl80211_dfs_regions { 2003enum nl80211_dfs_regions {
1993 NL80211_DFS_UNSET = 0, 2004 NL80211_DFS_UNSET = 0,
@@ -2142,6 +2153,11 @@ enum nl80211_mntr_flags {
2142 * 2153 *
2143 * @NL80211_MESHCONF_ATTR_MAX: highest possible mesh configuration attribute 2154 * @NL80211_MESHCONF_ATTR_MAX: highest possible mesh configuration attribute
2144 * 2155 *
2156 * @NL80211_MESHCONF_SYNC_OFFSET_MAX_NEIGHBOR: maximum number of neighbors
2157 * to synchronize to for 11s default synchronization method (see 11C.12.2.2)
2158 *
2159 * @NL80211_MESHCONF_HT_OPMODE: set mesh HT protection mode.
2160 *
2145 * @__NL80211_MESHCONF_ATTR_AFTER_LAST: internal use 2161 * @__NL80211_MESHCONF_ATTR_AFTER_LAST: internal use
2146 */ 2162 */
2147enum nl80211_meshconf_params { 2163enum nl80211_meshconf_params {
@@ -2166,6 +2182,8 @@ enum nl80211_meshconf_params {
2166 NL80211_MESHCONF_HWMP_PERR_MIN_INTERVAL, 2182 NL80211_MESHCONF_HWMP_PERR_MIN_INTERVAL,
2167 NL80211_MESHCONF_FORWARDING, 2183 NL80211_MESHCONF_FORWARDING,
2168 NL80211_MESHCONF_RSSI_THRESHOLD, 2184 NL80211_MESHCONF_RSSI_THRESHOLD,
2185 NL80211_MESHCONF_SYNC_OFFSET_MAX_NEIGHBOR,
2186 NL80211_MESHCONF_HT_OPMODE,
2169 2187
2170 /* keep last */ 2188 /* keep last */
2171 __NL80211_MESHCONF_ATTR_AFTER_LAST, 2189 __NL80211_MESHCONF_ATTR_AFTER_LAST,
@@ -2205,6 +2223,11 @@ enum nl80211_meshconf_params {
2205 * complete (unsecured) mesh peering without the need of a userspace daemon. 2223 * complete (unsecured) mesh peering without the need of a userspace daemon.
2206 * 2224 *
2207 * @NL80211_MESH_SETUP_ATTR_MAX: highest possible mesh setup attribute number 2225 * @NL80211_MESH_SETUP_ATTR_MAX: highest possible mesh setup attribute number
2226 *
2227 * @NL80211_MESH_SETUP_ENABLE_VENDOR_SYNC: Enable this option to use a
2228 * vendor specific synchronization method or disable it to use the default
2229 * neighbor offset synchronization
2230 *
2208 * @__NL80211_MESH_SETUP_ATTR_AFTER_LAST: Internal use 2231 * @__NL80211_MESH_SETUP_ATTR_AFTER_LAST: Internal use
2209 */ 2232 */
2210enum nl80211_mesh_setup_params { 2233enum nl80211_mesh_setup_params {
@@ -2214,6 +2237,7 @@ enum nl80211_mesh_setup_params {
2214 NL80211_MESH_SETUP_IE, 2237 NL80211_MESH_SETUP_IE,
2215 NL80211_MESH_SETUP_USERSPACE_AUTH, 2238 NL80211_MESH_SETUP_USERSPACE_AUTH,
2216 NL80211_MESH_SETUP_USERSPACE_AMPE, 2239 NL80211_MESH_SETUP_USERSPACE_AMPE,
2240 NL80211_MESH_SETUP_ENABLE_VENDOR_SYNC,
2217 2241
2218 /* keep last */ 2242 /* keep last */
2219 __NL80211_MESH_SETUP_ATTR_AFTER_LAST, 2243 __NL80211_MESH_SETUP_ATTR_AFTER_LAST,
@@ -2223,7 +2247,7 @@ enum nl80211_mesh_setup_params {
2223/** 2247/**
2224 * enum nl80211_txq_attr - TX queue parameter attributes 2248 * enum nl80211_txq_attr - TX queue parameter attributes
2225 * @__NL80211_TXQ_ATTR_INVALID: Attribute number 0 is reserved 2249 * @__NL80211_TXQ_ATTR_INVALID: Attribute number 0 is reserved
2226 * @NL80211_TXQ_ATTR_QUEUE: TX queue identifier (NL80211_TXQ_Q_*) 2250 * @NL80211_TXQ_ATTR_AC: AC identifier (NL80211_AC_*)
2227 * @NL80211_TXQ_ATTR_TXOP: Maximum burst time in units of 32 usecs, 0 meaning 2251 * @NL80211_TXQ_ATTR_TXOP: Maximum burst time in units of 32 usecs, 0 meaning
2228 * disabled 2252 * disabled
2229 * @NL80211_TXQ_ATTR_CWMIN: Minimum contention window [a value of the form 2253 * @NL80211_TXQ_ATTR_CWMIN: Minimum contention window [a value of the form
@@ -2236,7 +2260,7 @@ enum nl80211_mesh_setup_params {
2236 */ 2260 */
2237enum nl80211_txq_attr { 2261enum nl80211_txq_attr {
2238 __NL80211_TXQ_ATTR_INVALID, 2262 __NL80211_TXQ_ATTR_INVALID,
2239 NL80211_TXQ_ATTR_QUEUE, 2263 NL80211_TXQ_ATTR_AC,
2240 NL80211_TXQ_ATTR_TXOP, 2264 NL80211_TXQ_ATTR_TXOP,
2241 NL80211_TXQ_ATTR_CWMIN, 2265 NL80211_TXQ_ATTR_CWMIN,
2242 NL80211_TXQ_ATTR_CWMAX, 2266 NL80211_TXQ_ATTR_CWMAX,
@@ -2247,13 +2271,21 @@ enum nl80211_txq_attr {
2247 NL80211_TXQ_ATTR_MAX = __NL80211_TXQ_ATTR_AFTER_LAST - 1 2271 NL80211_TXQ_ATTR_MAX = __NL80211_TXQ_ATTR_AFTER_LAST - 1
2248}; 2272};
2249 2273
2250enum nl80211_txq_q { 2274enum nl80211_ac {
2251 NL80211_TXQ_Q_VO, 2275 NL80211_AC_VO,
2252 NL80211_TXQ_Q_VI, 2276 NL80211_AC_VI,
2253 NL80211_TXQ_Q_BE, 2277 NL80211_AC_BE,
2254 NL80211_TXQ_Q_BK 2278 NL80211_AC_BK,
2279 NL80211_NUM_ACS
2255}; 2280};
2256 2281
2282/* backward compat */
2283#define NL80211_TXQ_ATTR_QUEUE NL80211_TXQ_ATTR_AC
2284#define NL80211_TXQ_Q_VO NL80211_AC_VO
2285#define NL80211_TXQ_Q_VI NL80211_AC_VI
2286#define NL80211_TXQ_Q_BE NL80211_AC_BE
2287#define NL80211_TXQ_Q_BK NL80211_AC_BK
2288
2257enum nl80211_channel_type { 2289enum nl80211_channel_type {
2258 NL80211_CHAN_NO_HT, 2290 NL80211_CHAN_NO_HT,
2259 NL80211_CHAN_HT20, 2291 NL80211_CHAN_HT20,
diff --git a/include/linux/nl802154.h b/include/linux/nl802154.h
index 33d9f5175109..5a3db3aa5f17 100644
--- a/include/linux/nl802154.h
+++ b/include/linux/nl802154.h
@@ -68,6 +68,7 @@ enum {
68 IEEE802154_ATTR_CHANNEL_PAGE_LIST, 68 IEEE802154_ATTR_CHANNEL_PAGE_LIST,
69 69
70 IEEE802154_ATTR_PHY_NAME, 70 IEEE802154_ATTR_PHY_NAME,
71 IEEE802154_ATTR_DEV_TYPE,
71 72
72 __IEEE802154_ATTR_MAX, 73 __IEEE802154_ATTR_MAX,
73}; 74};
@@ -126,4 +127,23 @@ enum {
126 127
127#define IEEE802154_CMD_MAX (__IEEE802154_CMD_MAX - 1) 128#define IEEE802154_CMD_MAX (__IEEE802154_CMD_MAX - 1)
128 129
130enum {
131 __IEEE802154_DEV_INVALID = -1,
132
133 /* TODO:
134 * Nowadays three device types supported by this stack at linux-zigbee
135 * project: WPAN = 0, MONITOR = 1 and SMAC = 2.
136 *
137 * Since this stack implementation exists many years, it's definitely
138 * bad idea to change the assigned values due to they are already used
139 * by third-party userspace software like: iz-tools, wireshark...
140 *
141 * Currently only monitor device is added and initialized by '1' for
142 * compatibility.
143 */
144 IEEE802154_DEV_MONITOR = 1,
145
146 __IEEE802154_DEV_MAX,
147};
148
129#endif 149#endif
diff --git a/include/linux/of.h b/include/linux/of.h
index fa7fb1d97458..2ec1083af7ff 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -193,6 +193,17 @@ extern struct device_node *of_get_next_child(const struct device_node *node,
193 for (child = of_get_next_child(parent, NULL); child != NULL; \ 193 for (child = of_get_next_child(parent, NULL); child != NULL; \
194 child = of_get_next_child(parent, child)) 194 child = of_get_next_child(parent, child))
195 195
196static inline int of_get_child_count(const struct device_node *np)
197{
198 struct device_node *child;
199 int num = 0;
200
201 for_each_child_of_node(np, child)
202 num++;
203
204 return num;
205}
206
196extern struct device_node *of_find_node_with_property( 207extern struct device_node *of_find_node_with_property(
197 struct device_node *from, const char *prop_name); 208 struct device_node *from, const char *prop_name);
198#define for_each_node_with_property(dn, prop_name) \ 209#define for_each_node_with_property(dn, prop_name) \
@@ -259,6 +270,37 @@ extern void of_detach_node(struct device_node *);
259#endif 270#endif
260 271
261#define of_match_ptr(_ptr) (_ptr) 272#define of_match_ptr(_ptr) (_ptr)
273
274/*
275 * struct property *prop;
276 * const __be32 *p;
277 * u32 u;
278 *
279 * of_property_for_each_u32(np, "propname", prop, p, u)
280 * printk("U32 value: %x\n", u);
281 */
282const __be32 *of_prop_next_u32(struct property *prop, const __be32 *cur,
283 u32 *pu);
284#define of_property_for_each_u32(np, propname, prop, p, u) \
285 for (prop = of_find_property(np, propname, NULL), \
286 p = of_prop_next_u32(prop, NULL, &u); \
287 p; \
288 p = of_prop_next_u32(prop, p, &u))
289
290/*
291 * struct property *prop;
292 * const char *s;
293 *
294 * of_property_for_each_string(np, "propname", prop, s)
295 * printk("String value: %s\n", s);
296 */
297const char *of_prop_next_string(struct property *prop, const char *cur);
298#define of_property_for_each_string(np, propname, prop, s) \
299 for (prop = of_find_property(np, propname, NULL), \
300 s = of_prop_next_string(prop, NULL); \
301 s; \
302 s = of_prop_next_string(prop, s))
303
262#else /* CONFIG_OF */ 304#else /* CONFIG_OF */
263 305
264static inline bool of_have_populated_dt(void) 306static inline bool of_have_populated_dt(void)
@@ -269,6 +311,11 @@ static inline bool of_have_populated_dt(void)
269#define for_each_child_of_node(parent, child) \ 311#define for_each_child_of_node(parent, child) \
270 while (0) 312 while (0)
271 313
314static inline int of_get_child_count(const struct device_node *np)
315{
316 return 0;
317}
318
272static inline int of_device_is_compatible(const struct device_node *device, 319static inline int of_device_is_compatible(const struct device_node *device,
273 const char *name) 320 const char *name)
274{ 321{
@@ -349,6 +396,10 @@ static inline int of_machine_is_compatible(const char *compat)
349 396
350#define of_match_ptr(_ptr) NULL 397#define of_match_ptr(_ptr) NULL
351#define of_match_node(_matches, _node) NULL 398#define of_match_node(_matches, _node) NULL
399#define of_property_for_each_u32(np, propname, prop, p, u) \
400 while (0)
401#define of_property_for_each_string(np, propname, prop, s) \
402 while (0)
352#endif /* CONFIG_OF */ 403#endif /* CONFIG_OF */
353 404
354/** 405/**
diff --git a/include/linux/of_irq.h b/include/linux/of_irq.h
index d229ad3edee0..1717cd935e1c 100644
--- a/include/linux/of_irq.h
+++ b/include/linux/of_irq.h
@@ -11,7 +11,7 @@ struct of_irq;
11#include <linux/of.h> 11#include <linux/of.h>
12 12
13/* 13/*
14 * irq_of_parse_and_map() is used ba all OF enabled platforms; but SPARC 14 * irq_of_parse_and_map() is used by all OF enabled platforms; but SPARC
15 * implements it differently. However, the prototype is the same for all, 15 * implements it differently. However, the prototype is the same for all,
16 * so declare it here regardless of the CONFIG_OF_IRQ setting. 16 * so declare it here regardless of the CONFIG_OF_IRQ setting.
17 */ 17 */
@@ -76,5 +76,13 @@ extern struct device_node *of_irq_find_parent(struct device_node *child);
76extern void of_irq_init(const struct of_device_id *matches); 76extern void of_irq_init(const struct of_device_id *matches);
77 77
78#endif /* CONFIG_OF_IRQ */ 78#endif /* CONFIG_OF_IRQ */
79#endif /* CONFIG_OF */ 79
80#else /* !CONFIG_OF */
81static inline unsigned int irq_of_parse_and_map(struct device_node *dev,
82 int index)
83{
84 return 0;
85}
86#endif /* !CONFIG_OF */
87
80#endif /* __OF_IRQ_H */ 88#endif /* __OF_IRQ_H */
diff --git a/include/linux/of_mdio.h b/include/linux/of_mdio.h
index 53b94e025c7c..912c27a0f7ee 100644
--- a/include/linux/of_mdio.h
+++ b/include/linux/of_mdio.h
@@ -22,4 +22,6 @@ extern struct phy_device *of_phy_connect_fixed_link(struct net_device *dev,
22 void (*hndlr)(struct net_device *), 22 void (*hndlr)(struct net_device *),
23 phy_interface_t iface); 23 phy_interface_t iface);
24 24
25extern struct mii_bus *of_mdio_find_bus(struct device_node *mdio_np);
26
25#endif /* __LINUX_OF_MDIO_H */ 27#endif /* __LINUX_OF_MDIO_H */
diff --git a/include/linux/of_serial.h b/include/linux/of_serial.h
new file mode 100644
index 000000000000..4a73ed80b4c0
--- /dev/null
+++ b/include/linux/of_serial.h
@@ -0,0 +1,17 @@
1#ifndef __LINUX_OF_SERIAL_H
2#define __LINUX_OF_SERIAL_H
3
4/*
5 * FIXME remove this file when tegra finishes conversion to open firmware,
6 * expectation is that all quirks will then be self-contained in
7 * drivers/tty/serial/of_serial.c.
8 */
9#ifdef CONFIG_ARCH_TEGRA
10extern void tegra_serial_handle_break(struct uart_port *port);
11#else
12static inline void tegra_serial_handle_break(struct uart_port *port)
13{
14}
15#endif
16
17#endif /* __LINUX_OF_SERIAL */
diff --git a/include/linux/of_spi.h b/include/linux/of_spi.h
deleted file mode 100644
index 9e3e70f78ae6..000000000000
--- a/include/linux/of_spi.h
+++ /dev/null
@@ -1,23 +0,0 @@
1/*
2 * OpenFirmware SPI support routines
3 * Copyright (C) 2008 Secret Lab Technologies Ltd.
4 *
5 * Support routines for deriving SPI device attachments from the device
6 * tree.
7 */
8
9#ifndef __LINUX_OF_SPI_H
10#define __LINUX_OF_SPI_H
11
12#include <linux/spi/spi.h>
13
14#if defined(CONFIG_OF_SPI) || defined(CONFIG_OF_SPI_MODULE)
15extern void of_register_spi_devices(struct spi_master *master);
16#else
17static inline void of_register_spi_devices(struct spi_master *master)
18{
19 return;
20}
21#endif /* CONFIG_OF_SPI */
22
23#endif /* __LINUX_OF_SPI */
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index cfaaa6949b8b..efa26b4da8d2 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -426,7 +426,7 @@ static inline int fault_in_pages_writeable(char __user *uaddr, int size)
426 */ 426 */
427 if (((unsigned long)uaddr & PAGE_MASK) != 427 if (((unsigned long)uaddr & PAGE_MASK) !=
428 ((unsigned long)end & PAGE_MASK)) 428 ((unsigned long)end & PAGE_MASK))
429 ret = __put_user(0, end); 429 ret = __put_user(0, end);
430 } 430 }
431 return ret; 431 return ret;
432} 432}
@@ -445,13 +445,73 @@ static inline int fault_in_pages_readable(const char __user *uaddr, int size)
445 445
446 if (((unsigned long)uaddr & PAGE_MASK) != 446 if (((unsigned long)uaddr & PAGE_MASK) !=
447 ((unsigned long)end & PAGE_MASK)) { 447 ((unsigned long)end & PAGE_MASK)) {
448 ret = __get_user(c, end); 448 ret = __get_user(c, end);
449 (void)c; 449 (void)c;
450 } 450 }
451 } 451 }
452 return ret; 452 return ret;
453} 453}
454 454
455/*
456 * Multipage variants of the above prefault helpers, useful if more than
457 * PAGE_SIZE of data needs to be prefaulted. These are separate from the above
458 * functions (which only handle up to PAGE_SIZE) to avoid clobbering the
459 * filemap.c hotpaths.
460 */
461static inline int fault_in_multipages_writeable(char __user *uaddr, int size)
462{
463 int ret;
464 char __user *end = uaddr + size - 1;
465
466 if (unlikely(size == 0))
467 return 0;
468
469 /*
470 * Writing zeroes into userspace here is OK, because we know that if
471 * the zero gets there, we'll be overwriting it.
472 */
473 while (uaddr <= end) {
474 ret = __put_user(0, uaddr);
475 if (ret != 0)
476 return ret;
477 uaddr += PAGE_SIZE;
478 }
479
480 /* Check whether the range spilled into the next page. */
481 if (((unsigned long)uaddr & PAGE_MASK) ==
482 ((unsigned long)end & PAGE_MASK))
483 ret = __put_user(0, end);
484
485 return ret;
486}
487
488static inline int fault_in_multipages_readable(const char __user *uaddr,
489 int size)
490{
491 volatile char c;
492 int ret;
493 const char __user *end = uaddr + size - 1;
494
495 if (unlikely(size == 0))
496 return 0;
497
498 while (uaddr <= end) {
499 ret = __get_user(c, uaddr);
500 if (ret != 0)
501 return ret;
502 uaddr += PAGE_SIZE;
503 }
504
505 /* Check whether the range spilled into the next page. */
506 if (((unsigned long)uaddr & PAGE_MASK) ==
507 ((unsigned long)end & PAGE_MASK)) {
508 ret = __get_user(c, end);
509 (void)c;
510 }
511
512 return ret;
513}
514
455int add_to_page_cache_locked(struct page *page, struct address_space *mapping, 515int add_to_page_cache_locked(struct page *page, struct address_space *mapping,
456 pgoff_t index, gfp_t gfp_mask); 516 pgoff_t index, gfp_t gfp_mask);
457int add_to_page_cache_lru(struct page *page, struct address_space *mapping, 517int add_to_page_cache_lru(struct page *page, struct address_space *mapping,
diff --git a/include/linux/pci.h b/include/linux/pci.h
index e444f5b49118..17b7b5b01b4a 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -375,11 +375,18 @@ struct pci_host_bridge_window {
375}; 375};
376 376
377struct pci_host_bridge { 377struct pci_host_bridge {
378 struct list_head list; 378 struct device dev;
379 struct pci_bus *bus; /* root bus */ 379 struct pci_bus *bus; /* root bus */
380 struct list_head windows; /* pci_host_bridge_windows */ 380 struct list_head windows; /* pci_host_bridge_windows */
381 void (*release_fn)(struct pci_host_bridge *);
382 void *release_data;
381}; 383};
382 384
385#define to_pci_host_bridge(n) container_of(n, struct pci_host_bridge, dev)
386void pci_set_host_bridge_release(struct pci_host_bridge *bridge,
387 void (*release_fn)(struct pci_host_bridge *),
388 void *release_data);
389
383/* 390/*
384 * The first PCI_BRIDGE_RESOURCE_NUM PCI bus resources (those that correspond 391 * The first PCI_BRIDGE_RESOURCE_NUM PCI bus resources (those that correspond
385 * to P2P or CardBus bridge windows) go in a table. Additional ones (for 392 * to P2P or CardBus bridge windows) go in a table. Additional ones (for
diff --git a/include/linux/percpu.h b/include/linux/percpu.h
index 21638ae14e07..2b9f82c037c9 100644
--- a/include/linux/percpu.h
+++ b/include/linux/percpu.h
@@ -166,60 +166,6 @@ extern phys_addr_t per_cpu_ptr_to_phys(void *addr);
166 (typeof(type) __percpu *)__alloc_percpu(sizeof(type), __alignof__(type)) 166 (typeof(type) __percpu *)__alloc_percpu(sizeof(type), __alignof__(type))
167 167
168/* 168/*
169 * Optional methods for optimized non-lvalue per-cpu variable access.
170 *
171 * @var can be a percpu variable or a field of it and its size should
172 * equal char, int or long. percpu_read() evaluates to a lvalue and
173 * all others to void.
174 *
175 * These operations are guaranteed to be atomic.
176 * The generic versions disable interrupts. Archs are
177 * encouraged to implement single-instruction alternatives which don't
178 * require protection.
179 */
180#ifndef percpu_read
181# define percpu_read(var) \
182 ({ \
183 typeof(var) *pr_ptr__ = &(var); \
184 typeof(var) pr_ret__; \
185 pr_ret__ = get_cpu_var(*pr_ptr__); \
186 put_cpu_var(*pr_ptr__); \
187 pr_ret__; \
188 })
189#endif
190
191#define __percpu_generic_to_op(var, val, op) \
192do { \
193 typeof(var) *pgto_ptr__ = &(var); \
194 get_cpu_var(*pgto_ptr__) op val; \
195 put_cpu_var(*pgto_ptr__); \
196} while (0)
197
198#ifndef percpu_write
199# define percpu_write(var, val) __percpu_generic_to_op(var, (val), =)
200#endif
201
202#ifndef percpu_add
203# define percpu_add(var, val) __percpu_generic_to_op(var, (val), +=)
204#endif
205
206#ifndef percpu_sub
207# define percpu_sub(var, val) __percpu_generic_to_op(var, (val), -=)
208#endif
209
210#ifndef percpu_and
211# define percpu_and(var, val) __percpu_generic_to_op(var, (val), &=)
212#endif
213
214#ifndef percpu_or
215# define percpu_or(var, val) __percpu_generic_to_op(var, (val), |=)
216#endif
217
218#ifndef percpu_xor
219# define percpu_xor(var, val) __percpu_generic_to_op(var, (val), ^=)
220#endif
221
222/*
223 * Branching function to split up a function into a set of functions that 169 * Branching function to split up a function into a set of functions that
224 * are called for different scalar sizes of the objects handled. 170 * are called for different scalar sizes of the objects handled.
225 */ 171 */
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index ddbb6a901f65..f32578634d9d 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -1132,11 +1132,14 @@ struct perf_sample_data {
1132 struct perf_branch_stack *br_stack; 1132 struct perf_branch_stack *br_stack;
1133}; 1133};
1134 1134
1135static inline void perf_sample_data_init(struct perf_sample_data *data, u64 addr) 1135static inline void perf_sample_data_init(struct perf_sample_data *data,
1136 u64 addr, u64 period)
1136{ 1137{
1138 /* remaining struct members initialized in perf_prepare_sample() */
1137 data->addr = addr; 1139 data->addr = addr;
1138 data->raw = NULL; 1140 data->raw = NULL;
1139 data->br_stack = NULL; 1141 data->br_stack = NULL;
1142 data->period = period;
1140} 1143}
1141 1144
1142extern void perf_output_sample(struct perf_output_handle *handle, 1145extern void perf_output_sample(struct perf_output_handle *handle,
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 6fe0a37d4abf..c291cae8ce32 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -412,6 +412,9 @@ struct phy_driver {
412 /* Clears up any memory if needed */ 412 /* Clears up any memory if needed */
413 void (*remove)(struct phy_device *phydev); 413 void (*remove)(struct phy_device *phydev);
414 414
415 /* Handles ethtool queries for hardware time stamping. */
416 int (*ts_info)(struct phy_device *phydev, struct ethtool_ts_info *ti);
417
415 /* Handles SIOCSHWTSTAMP ioctl for hardware time stamping. */ 418 /* Handles SIOCSHWTSTAMP ioctl for hardware time stamping. */
416 int (*hwtstamp)(struct phy_device *phydev, struct ifreq *ifr); 419 int (*hwtstamp)(struct phy_device *phydev, struct ifreq *ifr);
417 420
@@ -477,7 +480,6 @@ static inline int phy_write(struct phy_device *phydev, u32 regnum, u16 val)
477 return mdiobus_write(phydev->bus, phydev->addr, regnum, val); 480 return mdiobus_write(phydev->bus, phydev->addr, regnum, val);
478} 481}
479 482
480int get_phy_id(struct mii_bus *bus, int addr, u32 *phy_id);
481struct phy_device* get_phy_device(struct mii_bus *bus, int addr); 483struct phy_device* get_phy_device(struct mii_bus *bus, int addr);
482int phy_device_register(struct phy_device *phy); 484int phy_device_register(struct phy_device *phy);
483int phy_init_hw(struct phy_device *phydev); 485int phy_init_hw(struct phy_device *phydev);
diff --git a/include/linux/pid_namespace.h b/include/linux/pid_namespace.h
index b067bd8c49d0..00474b047145 100644
--- a/include/linux/pid_namespace.h
+++ b/include/linux/pid_namespace.h
@@ -31,7 +31,7 @@ struct pid_namespace {
31#ifdef CONFIG_BSD_PROCESS_ACCT 31#ifdef CONFIG_BSD_PROCESS_ACCT
32 struct bsd_acct_struct *bacct; 32 struct bsd_acct_struct *bacct;
33#endif 33#endif
34 gid_t pid_gid; 34 kgid_t pid_gid;
35 int hide_pid; 35 int hide_pid;
36 int reboot; /* group exit code if this pidns was rebooted */ 36 int reboot; /* group exit code if this pidns was rebooted */
37}; 37};
diff --git a/include/linux/pinctrl/consumer.h b/include/linux/pinctrl/consumer.h
index 191e72688481..6dd96fb45482 100644
--- a/include/linux/pinctrl/consumer.h
+++ b/include/linux/pinctrl/consumer.h
@@ -36,6 +36,9 @@ extern struct pinctrl_state * __must_check pinctrl_lookup_state(
36 const char *name); 36 const char *name);
37extern int pinctrl_select_state(struct pinctrl *p, struct pinctrl_state *s); 37extern int pinctrl_select_state(struct pinctrl *p, struct pinctrl_state *s);
38 38
39extern struct pinctrl * __must_check devm_pinctrl_get(struct device *dev);
40extern void devm_pinctrl_put(struct pinctrl *p);
41
39#else /* !CONFIG_PINCTRL */ 42#else /* !CONFIG_PINCTRL */
40 43
41static inline int pinctrl_request_gpio(unsigned gpio) 44static inline int pinctrl_request_gpio(unsigned gpio)
@@ -79,6 +82,15 @@ static inline int pinctrl_select_state(struct pinctrl *p,
79 return 0; 82 return 0;
80} 83}
81 84
85static inline struct pinctrl * __must_check devm_pinctrl_get(struct device *dev)
86{
87 return NULL;
88}
89
90static inline void devm_pinctrl_put(struct pinctrl *p)
91{
92}
93
82#endif /* CONFIG_PINCTRL */ 94#endif /* CONFIG_PINCTRL */
83 95
84static inline struct pinctrl * __must_check pinctrl_get_select( 96static inline struct pinctrl * __must_check pinctrl_get_select(
@@ -113,6 +125,38 @@ static inline struct pinctrl * __must_check pinctrl_get_select_default(
113 return pinctrl_get_select(dev, PINCTRL_STATE_DEFAULT); 125 return pinctrl_get_select(dev, PINCTRL_STATE_DEFAULT);
114} 126}
115 127
128static inline struct pinctrl * __must_check devm_pinctrl_get_select(
129 struct device *dev, const char *name)
130{
131 struct pinctrl *p;
132 struct pinctrl_state *s;
133 int ret;
134
135 p = devm_pinctrl_get(dev);
136 if (IS_ERR(p))
137 return p;
138
139 s = pinctrl_lookup_state(p, name);
140 if (IS_ERR(s)) {
141 devm_pinctrl_put(p);
142 return ERR_PTR(PTR_ERR(s));
143 }
144
145 ret = pinctrl_select_state(p, s);
146 if (ret < 0) {
147 devm_pinctrl_put(p);
148 return ERR_PTR(ret);
149 }
150
151 return p;
152}
153
154static inline struct pinctrl * __must_check devm_pinctrl_get_select_default(
155 struct device *dev)
156{
157 return devm_pinctrl_get_select(dev, PINCTRL_STATE_DEFAULT);
158}
159
116#ifdef CONFIG_PINCONF 160#ifdef CONFIG_PINCONF
117 161
118extern int pin_config_get(const char *dev_name, const char *name, 162extern int pin_config_get(const char *dev_name, const char *name,
diff --git a/include/linux/pinctrl/machine.h b/include/linux/pinctrl/machine.h
index e4d1de742502..7d22ab00343f 100644
--- a/include/linux/pinctrl/machine.h
+++ b/include/linux/pinctrl/machine.h
@@ -154,7 +154,7 @@ struct pinctrl_map {
154 154
155extern int pinctrl_register_mappings(struct pinctrl_map const *map, 155extern int pinctrl_register_mappings(struct pinctrl_map const *map,
156 unsigned num_maps); 156 unsigned num_maps);
157 157extern void pinctrl_provide_dummies(void);
158#else 158#else
159 159
160static inline int pinctrl_register_mappings(struct pinctrl_map const *map, 160static inline int pinctrl_register_mappings(struct pinctrl_map const *map,
@@ -163,5 +163,8 @@ static inline int pinctrl_register_mappings(struct pinctrl_map const *map,
163 return 0; 163 return 0;
164} 164}
165 165
166#endif /* !CONFIG_PINMUX */ 166static inline void pinctrl_provide_dummies(void)
167{
168}
169#endif /* !CONFIG_PINCTRL */
167#endif 170#endif
diff --git a/include/linux/pinctrl/pinconf.h b/include/linux/pinctrl/pinconf.h
index ec431f03362d..e7a720104a47 100644
--- a/include/linux/pinctrl/pinconf.h
+++ b/include/linux/pinctrl/pinconf.h
@@ -25,7 +25,6 @@ struct seq_file;
25 * @pin_config_get: get the config of a certain pin, if the requested config 25 * @pin_config_get: get the config of a certain pin, if the requested config
26 * is not available on this controller this should return -ENOTSUPP 26 * is not available on this controller this should return -ENOTSUPP
27 * and if it is available but disabled it should return -EINVAL 27 * and if it is available but disabled it should return -EINVAL
28 * @pin_config_get: get the config of a certain pin
29 * @pin_config_set: configure an individual pin 28 * @pin_config_set: configure an individual pin
30 * @pin_config_group_get: get configurations for an entire pin group 29 * @pin_config_group_get: get configurations for an entire pin group
31 * @pin_config_group_set: configure all pins in a group 30 * @pin_config_group_set: configure all pins in a group
@@ -33,6 +32,8 @@ struct seq_file;
33 * per-device info for a certain pin in debugfs 32 * per-device info for a certain pin in debugfs
34 * @pin_config_group_dbg_show: optional debugfs display hook that will provide 33 * @pin_config_group_dbg_show: optional debugfs display hook that will provide
35 * per-device info for a certain group in debugfs 34 * per-device info for a certain group in debugfs
35 * @pin_config_config_dbg_show: optional debugfs display hook that will decode
36 * and display a driver's pin configuration parameter
36 */ 37 */
37struct pinconf_ops { 38struct pinconf_ops {
38#ifdef CONFIG_GENERIC_PINCONF 39#ifdef CONFIG_GENERIC_PINCONF
@@ -56,6 +57,9 @@ struct pinconf_ops {
56 void (*pin_config_group_dbg_show) (struct pinctrl_dev *pctldev, 57 void (*pin_config_group_dbg_show) (struct pinctrl_dev *pctldev,
57 struct seq_file *s, 58 struct seq_file *s,
58 unsigned selector); 59 unsigned selector);
60 void (*pin_config_config_dbg_show) (struct pinctrl_dev *pctldev,
61 struct seq_file *s,
62 unsigned long config);
59}; 63};
60 64
61#endif 65#endif
diff --git a/include/linux/pinctrl/pinctrl-state.h b/include/linux/pinctrl/pinctrl-state.h
index 3920e28b4da7..634608dc6c89 100644
--- a/include/linux/pinctrl/pinctrl-state.h
+++ b/include/linux/pinctrl/pinctrl-state.h
@@ -2,5 +2,18 @@
2 * Standard pin control state definitions 2 * Standard pin control state definitions
3 */ 3 */
4 4
5/**
6 * @PINCTRL_STATE_DEFAULT: the state the pinctrl handle shall be put
7 * into as default, usually this means the pins are up and ready to
8 * be used by the device driver. This state is commonly used by
9 * hogs to configure muxing and pins at boot.
10 * @PINCTRL_STATE_IDLE: the state the pinctrl handle shall be put into
11 * when the pins are idle. Could typically be set from a
12 * pm_runtime_suspend() operation.
13 * @PINCTRL_STATE_SLEEP: the state the pinctrl handle shall be put into
14 * when the pins are sleeping. Could typically be set from a
15 * common suspend() function.
16 */
5#define PINCTRL_STATE_DEFAULT "default" 17#define PINCTRL_STATE_DEFAULT "default"
6#define PINCTRL_STATE_IDLE "idle" 18#define PINCTRL_STATE_IDLE "idle"
19#define PINCTRL_STATE_SLEEP "sleep"
diff --git a/include/linux/pinctrl/pinctrl.h b/include/linux/pinctrl/pinctrl.h
index 4e9f0788c221..3b894a668d32 100644
--- a/include/linux/pinctrl/pinctrl.h
+++ b/include/linux/pinctrl/pinctrl.h
@@ -21,9 +21,11 @@
21 21
22struct device; 22struct device;
23struct pinctrl_dev; 23struct pinctrl_dev;
24struct pinctrl_map;
24struct pinmux_ops; 25struct pinmux_ops;
25struct pinconf_ops; 26struct pinconf_ops;
26struct gpio_chip; 27struct gpio_chip;
28struct device_node;
27 29
28/** 30/**
29 * struct pinctrl_pin_desc - boards/machines provide information on their 31 * struct pinctrl_pin_desc - boards/machines provide information on their
@@ -64,17 +66,24 @@ struct pinctrl_gpio_range {
64/** 66/**
65 * struct pinctrl_ops - global pin control operations, to be implemented by 67 * struct pinctrl_ops - global pin control operations, to be implemented by
66 * pin controller drivers. 68 * pin controller drivers.
67 * @list_groups: list the number of selectable named groups available 69 * @get_groups_count: Returns the count of total number of groups registered.
68 * in this pinmux driver, the core will begin on 0 and call this
69 * repeatedly as long as it returns >= 0 to enumerate the groups
70 * @get_group_name: return the group name of the pin group 70 * @get_group_name: return the group name of the pin group
71 * @get_group_pins: return an array of pins corresponding to a certain 71 * @get_group_pins: return an array of pins corresponding to a certain
72 * group selector @pins, and the size of the array in @num_pins 72 * group selector @pins, and the size of the array in @num_pins
73 * @pin_dbg_show: optional debugfs display hook that will provide per-device 73 * @pin_dbg_show: optional debugfs display hook that will provide per-device
74 * info for a certain pin in debugfs 74 * info for a certain pin in debugfs
75 * @dt_node_to_map: parse a device tree "pin configuration node", and create
76 * mapping table entries for it. These are returned through the @map and
77 * @num_maps output parameters. This function is optional, and may be
78 * omitted for pinctrl drivers that do not support device tree.
79 * @dt_free_map: free mapping table entries created via @dt_node_to_map. The
80 * top-level @map pointer must be freed, along with any dynamically
81 * allocated members of the mapping table entries themselves. This
82 * function is optional, and may be omitted for pinctrl drivers that do
83 * not support device tree.
75 */ 84 */
76struct pinctrl_ops { 85struct pinctrl_ops {
77 int (*list_groups) (struct pinctrl_dev *pctldev, unsigned selector); 86 int (*get_groups_count) (struct pinctrl_dev *pctldev);
78 const char *(*get_group_name) (struct pinctrl_dev *pctldev, 87 const char *(*get_group_name) (struct pinctrl_dev *pctldev,
79 unsigned selector); 88 unsigned selector);
80 int (*get_group_pins) (struct pinctrl_dev *pctldev, 89 int (*get_group_pins) (struct pinctrl_dev *pctldev,
@@ -83,6 +92,11 @@ struct pinctrl_ops {
83 unsigned *num_pins); 92 unsigned *num_pins);
84 void (*pin_dbg_show) (struct pinctrl_dev *pctldev, struct seq_file *s, 93 void (*pin_dbg_show) (struct pinctrl_dev *pctldev, struct seq_file *s,
85 unsigned offset); 94 unsigned offset);
95 int (*dt_node_to_map) (struct pinctrl_dev *pctldev,
96 struct device_node *np_config,
97 struct pinctrl_map **map, unsigned *num_maps);
98 void (*dt_free_map) (struct pinctrl_dev *pctldev,
99 struct pinctrl_map *map, unsigned num_maps);
86}; 100};
87 101
88/** 102/**
diff --git a/include/linux/pinctrl/pinmux.h b/include/linux/pinctrl/pinmux.h
index 47e9237edd47..1818dcbdd9ab 100644
--- a/include/linux/pinctrl/pinmux.h
+++ b/include/linux/pinctrl/pinmux.h
@@ -23,15 +23,14 @@ struct pinctrl_dev;
23/** 23/**
24 * struct pinmux_ops - pinmux operations, to be implemented by pin controller 24 * struct pinmux_ops - pinmux operations, to be implemented by pin controller
25 * drivers that support pinmuxing 25 * drivers that support pinmuxing
26 * @request: called by the core to see if a certain pin can be made available 26 * @request: called by the core to see if a certain pin can be made
27 * available for muxing. This is called by the core to acquire the pins 27 * available for muxing. This is called by the core to acquire the pins
28 * before selecting any actual mux setting across a function. The driver 28 * before selecting any actual mux setting across a function. The driver
29 * is allowed to answer "no" by returning a negative error code 29 * is allowed to answer "no" by returning a negative error code
30 * @free: the reverse function of the request() callback, frees a pin after 30 * @free: the reverse function of the request() callback, frees a pin after
31 * being requested 31 * being requested
32 * @list_functions: list the number of selectable named functions available 32 * @get_functions_count: returns number of selectable named functions available
33 * in this pinmux driver, the core will begin on 0 and call this 33 * in this pinmux driver
34 * repeatedly as long as it returns >= 0 to enumerate mux settings
35 * @get_function_name: return the function name of the muxing selector, 34 * @get_function_name: return the function name of the muxing selector,
36 * called by the core to figure out which mux setting it shall map a 35 * called by the core to figure out which mux setting it shall map a
37 * certain device to 36 * certain device to
@@ -62,7 +61,7 @@ struct pinctrl_dev;
62struct pinmux_ops { 61struct pinmux_ops {
63 int (*request) (struct pinctrl_dev *pctldev, unsigned offset); 62 int (*request) (struct pinctrl_dev *pctldev, unsigned offset);
64 int (*free) (struct pinctrl_dev *pctldev, unsigned offset); 63 int (*free) (struct pinctrl_dev *pctldev, unsigned offset);
65 int (*list_functions) (struct pinctrl_dev *pctldev, unsigned selector); 64 int (*get_functions_count) (struct pinctrl_dev *pctldev);
66 const char *(*get_function_name) (struct pinctrl_dev *pctldev, 65 const char *(*get_function_name) (struct pinctrl_dev *pctldev,
67 unsigned selector); 66 unsigned selector);
68 int (*get_function_groups) (struct pinctrl_dev *pctldev, 67 int (*get_function_groups) (struct pinctrl_dev *pctldev,
diff --git a/include/linux/pkt_sched.h b/include/linux/pkt_sched.h
index 410b33d014d2..32aef0a439ef 100644
--- a/include/linux/pkt_sched.h
+++ b/include/linux/pkt_sched.h
@@ -509,6 +509,7 @@ enum {
509 TCA_NETEM_CORRUPT, 509 TCA_NETEM_CORRUPT,
510 TCA_NETEM_LOSS, 510 TCA_NETEM_LOSS,
511 TCA_NETEM_RATE, 511 TCA_NETEM_RATE,
512 TCA_NETEM_ECN,
512 __TCA_NETEM_MAX, 513 __TCA_NETEM_MAX,
513}; 514};
514 515
@@ -654,4 +655,84 @@ struct tc_qfq_stats {
654 __u32 lmax; 655 __u32 lmax;
655}; 656};
656 657
658/* CODEL */
659
660enum {
661 TCA_CODEL_UNSPEC,
662 TCA_CODEL_TARGET,
663 TCA_CODEL_LIMIT,
664 TCA_CODEL_INTERVAL,
665 TCA_CODEL_ECN,
666 __TCA_CODEL_MAX
667};
668
669#define TCA_CODEL_MAX (__TCA_CODEL_MAX - 1)
670
671struct tc_codel_xstats {
672 __u32 maxpacket; /* largest packet we've seen so far */
673 __u32 count; /* how many drops we've done since the last time we
674 * entered dropping state
675 */
676 __u32 lastcount; /* count at entry to dropping state */
677 __u32 ldelay; /* in-queue delay seen by most recently dequeued packet */
678 __s32 drop_next; /* time to drop next packet */
679 __u32 drop_overlimit; /* number of time max qdisc packet limit was hit */
680 __u32 ecn_mark; /* number of packets we ECN marked instead of dropped */
681 __u32 dropping; /* are we in dropping state ? */
682};
683
684/* FQ_CODEL */
685
686enum {
687 TCA_FQ_CODEL_UNSPEC,
688 TCA_FQ_CODEL_TARGET,
689 TCA_FQ_CODEL_LIMIT,
690 TCA_FQ_CODEL_INTERVAL,
691 TCA_FQ_CODEL_ECN,
692 TCA_FQ_CODEL_FLOWS,
693 TCA_FQ_CODEL_QUANTUM,
694 __TCA_FQ_CODEL_MAX
695};
696
697#define TCA_FQ_CODEL_MAX (__TCA_FQ_CODEL_MAX - 1)
698
699enum {
700 TCA_FQ_CODEL_XSTATS_QDISC,
701 TCA_FQ_CODEL_XSTATS_CLASS,
702};
703
704struct tc_fq_codel_qd_stats {
705 __u32 maxpacket; /* largest packet we've seen so far */
706 __u32 drop_overlimit; /* number of time max qdisc
707 * packet limit was hit
708 */
709 __u32 ecn_mark; /* number of packets we ECN marked
710 * instead of being dropped
711 */
712 __u32 new_flow_count; /* number of time packets
713 * created a 'new flow'
714 */
715 __u32 new_flows_len; /* count of flows in new list */
716 __u32 old_flows_len; /* count of flows in old list */
717};
718
719struct tc_fq_codel_cl_stats {
720 __s32 deficit;
721 __u32 ldelay; /* in-queue delay seen by most recently
722 * dequeued packet
723 */
724 __u32 count;
725 __u32 lastcount;
726 __u32 dropping;
727 __s32 drop_next;
728};
729
730struct tc_fq_codel_xstats {
731 __u32 type;
732 union {
733 struct tc_fq_codel_qd_stats qdisc_stats;
734 struct tc_fq_codel_cl_stats class_stats;
735 };
736};
737
657#endif 738#endif
diff --git a/include/linux/platform_data/at91_adc.h b/include/linux/platform_data/at91_adc.h
new file mode 100644
index 000000000000..e15745b4f3a5
--- /dev/null
+++ b/include/linux/platform_data/at91_adc.h
@@ -0,0 +1,61 @@
1/*
2 * Copyright (C) 2011 Free Electrons
3 *
4 * Licensed under the GPLv2 or later.
5 */
6
7#ifndef _AT91_ADC_H_
8#define _AT91_ADC_H_
9
10/**
11 * struct at91_adc_reg_desc - Various informations relative to registers
12 * @channel_base: Base offset for the channel data registers
13 * @drdy_mask: Mask of the DRDY field in the relevant registers
14 (Interruptions registers mostly)
15 * @status_register: Offset of the Interrupt Status Register
16 * @trigger_register: Offset of the Trigger setup register
17 */
18struct at91_adc_reg_desc {
19 u8 channel_base;
20 u32 drdy_mask;
21 u8 status_register;
22 u8 trigger_register;
23};
24
25/**
26 * struct at91_adc_trigger - description of triggers
27 * @name: name of the trigger advertised to the user
28 * @value: value to set in the ADC's trigger setup register
29 to enable the trigger
30 * @is_external: Does the trigger rely on an external pin?
31 */
32struct at91_adc_trigger {
33 const char *name;
34 u8 value;
35 bool is_external;
36};
37
38/**
39 * struct at91_adc_data - platform data for ADC driver
40 * @channels_used: channels in use on the board as a bitmask
41 * @num_channels: global number of channels available on the board
42 * @registers: Registers definition on the board
43 * @startup_time: startup time of the ADC in microseconds
44 * @trigger_list: Triggers available in the ADC
45 * @trigger_number: Number of triggers available in the ADC
46 * @use_external_triggers: does the board has external triggers availables
47 * @vref: Reference voltage for the ADC in millivolts
48 */
49struct at91_adc_data {
50 unsigned long channels_used;
51 u8 num_channels;
52 struct at91_adc_reg_desc *registers;
53 u8 startup_time;
54 struct at91_adc_trigger *trigger_list;
55 u8 trigger_number;
56 bool use_external_triggers;
57 u16 vref;
58};
59
60extern void __init at91_add_device_adc(struct at91_adc_data *data);
61#endif
diff --git a/include/linux/platform_data/ehci-sh.h b/include/linux/platform_data/ehci-sh.h
new file mode 100644
index 000000000000..5c15a738e116
--- /dev/null
+++ b/include/linux/platform_data/ehci-sh.h
@@ -0,0 +1,28 @@
1/*
2 * EHCI SuperH driver platform data
3 *
4 * Copyright (C) 2012 Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
5 * Copyright (C) 2012 Renesas Solutions Corp.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21#ifndef __USB_EHCI_SH_H
22#define __USB_EHCI_SH_H
23
24struct ehci_sh_platdata {
25 void (*phy_init)(void); /* Phy init function */
26};
27
28#endif /* __USB_EHCI_SH_H */
diff --git a/include/linux/platform_data/emif_plat.h b/include/linux/platform_data/emif_plat.h
new file mode 100644
index 000000000000..03378ca84061
--- /dev/null
+++ b/include/linux/platform_data/emif_plat.h
@@ -0,0 +1,128 @@
1/*
2 * Definitions for TI EMIF device platform data
3 *
4 * Copyright (C) 2012 Texas Instruments, Inc.
5 *
6 * Aneesh V <aneesh@ti.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12#ifndef __EMIF_PLAT_H
13#define __EMIF_PLAT_H
14
15/* Low power modes - EMIF_PWR_MGMT_CTRL */
16#define EMIF_LP_MODE_DISABLE 0
17#define EMIF_LP_MODE_CLOCK_STOP 1
18#define EMIF_LP_MODE_SELF_REFRESH 2
19#define EMIF_LP_MODE_PWR_DN 4
20
21/* Hardware capabilities */
22#define EMIF_HW_CAPS_LL_INTERFACE 0x00000001
23
24/*
25 * EMIF IP Revisions
26 * EMIF4D - Used in OMAP4
27 * EMIF4D5 - Used in OMAP5
28 */
29#define EMIF_4D 1
30#define EMIF_4D5 2
31
32/*
33 * PHY types
34 * ATTILAPHY - Used in OMAP4
35 * INTELLIPHY - Used in OMAP5
36 */
37#define EMIF_PHY_TYPE_ATTILAPHY 1
38#define EMIF_PHY_TYPE_INTELLIPHY 2
39
40/* Custom config requests */
41#define EMIF_CUSTOM_CONFIG_LPMODE 0x00000001
42#define EMIF_CUSTOM_CONFIG_TEMP_ALERT_POLL_INTERVAL 0x00000002
43
44#ifndef __ASSEMBLY__
45/**
46 * struct ddr_device_info - All information about the DDR device except AC
47 * timing parameters
48 * @type: Device type (LPDDR2-S4, LPDDR2-S2 etc)
49 * @density: Device density
50 * @io_width: Bus width
51 * @cs1_used: Whether there is a DDR device attached to the second
52 * chip-select(CS1) of this EMIF instance
53 * @cal_resistors_per_cs: Whether there is one calibration resistor per
54 * chip-select or whether it's a single one for both
55 * @manufacturer: Manufacturer name string
56 */
57struct ddr_device_info {
58 u32 type;
59 u32 density;
60 u32 io_width;
61 u32 cs1_used;
62 u32 cal_resistors_per_cs;
63 char manufacturer[10];
64};
65
66/**
67 * struct emif_custom_configs - Custom configuration parameters/policies
68 * passed from the platform layer
69 * @mask: Mask to indicate which configs are requested
70 * @lpmode: LPMODE to be used in PWR_MGMT_CTRL register
71 * @lpmode_timeout_performance: Timeout before LPMODE entry when higher
72 * performance is desired at the cost of power (typically
73 * at higher OPPs)
74 * @lpmode_timeout_power: Timeout before LPMODE entry when better power
75 * savings is desired and performance is not important
76 * (typically at lower loads indicated by lower OPPs)
77 * @lpmode_freq_threshold: The DDR frequency threshold to identify between
78 * the above two cases:
79 * timeout = (freq >= lpmode_freq_threshold) ?
80 * lpmode_timeout_performance :
81 * lpmode_timeout_power;
82 * @temp_alert_poll_interval_ms: LPDDR2 MR4 polling interval at nominal
83 * temperature(in milliseconds). When temperature is high
84 * polling is done 4 times as frequently.
85 */
86struct emif_custom_configs {
87 u32 mask;
88 u32 lpmode;
89 u32 lpmode_timeout_performance;
90 u32 lpmode_timeout_power;
91 u32 lpmode_freq_threshold;
92 u32 temp_alert_poll_interval_ms;
93};
94
95/**
96 * struct emif_platform_data - Platform data passed on EMIF platform
97 * device creation. Used by the driver.
98 * @hw_caps: Hw capabilities of the EMIF IP in the respective SoC
99 * @device_info: Device info structure containing information such
100 * as type, bus width, density etc
101 * @timings: Timings information from device datasheet passed
102 * as an array of 'struct lpddr2_timings'. Can be NULL
103 * if if default timings are ok
104 * @timings_arr_size: Size of the timings array. Depends on the number
105 * of different frequencies for which timings data
106 * is provided
107 * @min_tck: Minimum value of some timing parameters in terms
108 * of number of cycles. Can be NULL if default values
109 * are ok
110 * @custom_configs: Custom configurations requested by SoC or board
111 * code and the data for them. Can be NULL if default
112 * configurations done by the driver are ok. See
113 * documentation for 'struct emif_custom_configs' for
114 * more details
115 */
116struct emif_platform_data {
117 u32 hw_caps;
118 struct ddr_device_info *device_info;
119 const struct lpddr2_timings *timings;
120 u32 timings_arr_size;
121 const struct lpddr2_min_tck *min_tck;
122 struct emif_custom_configs *custom_configs;
123 u32 ip_rev;
124 u32 phy_type;
125};
126#endif /* __ASSEMBLY__ */
127
128#endif /* __LINUX_EMIF_H */
diff --git a/include/linux/platform_data/gpio-em.h b/include/linux/platform_data/gpio-em.h
new file mode 100644
index 000000000000..573edfb046c4
--- /dev/null
+++ b/include/linux/platform_data/gpio-em.h
@@ -0,0 +1,10 @@
1#ifndef __GPIO_EM_H__
2#define __GPIO_EM_H__
3
4struct gpio_em_config {
5 unsigned int gpio_base;
6 unsigned int irq_base;
7 unsigned int number_of_pins;
8};
9
10#endif /* __GPIO_EM_H__ */
diff --git a/include/linux/platform_data/ina2xx.h b/include/linux/platform_data/ina2xx.h
new file mode 100644
index 000000000000..9abc0ca7259b
--- /dev/null
+++ b/include/linux/platform_data/ina2xx.h
@@ -0,0 +1,19 @@
1/*
2 * Driver for Texas Instruments INA219, INA226 power monitor chips
3 *
4 * Copyright (C) 2012 Lothar Felten <l-felten@ti.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * For further information, see the Documentation/hwmon/ina2xx file.
11 */
12
13/**
14 * struct ina2xx_platform_data - ina2xx info
15 * @shunt_uohms shunt resistance in microohms
16 */
17struct ina2xx_platform_data {
18 long shunt_uohms;
19};
diff --git a/include/linux/platform_data/s3c-hsotg.h b/include/linux/platform_data/s3c-hsotg.h
new file mode 100644
index 000000000000..97ec12c2ded4
--- /dev/null
+++ b/include/linux/platform_data/s3c-hsotg.h
@@ -0,0 +1,35 @@
1/* include/linux/platform_data/s3c-hsotg.h
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
6 * http://armlinux.simtec.co.uk/
7 *
8 * S3C USB2.0 High-speed / OtG platform information
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13*/
14
15enum s3c_hsotg_dmamode {
16 S3C_HSOTG_DMA_NONE, /* do not use DMA at-all */
17 S3C_HSOTG_DMA_ONLY, /* always use DMA */
18 S3C_HSOTG_DMA_DRV, /* DMA is chosen by driver */
19};
20
21/**
22 * struct s3c_hsotg_plat - platform data for high-speed otg/udc
23 * @dma: Whether to use DMA or not.
24 * @is_osc: The clock source is an oscillator, not a crystal
25 */
26struct s3c_hsotg_plat {
27 enum s3c_hsotg_dmamode dma;
28 unsigned int is_osc:1;
29 int phy_type;
30
31 int (*phy_init)(struct platform_device *pdev, int type);
32 int (*phy_exit)(struct platform_device *pdev, int type);
33};
34
35extern void s3c_hsotg_set_platdata(struct s3c_hsotg_plat *pd);
diff --git a/include/linux/platform_data/tegra_usb.h b/include/linux/platform_data/tegra_usb.h
index 6bca5b569acb..66c673fef408 100644
--- a/include/linux/platform_data/tegra_usb.h
+++ b/include/linux/platform_data/tegra_usb.h
@@ -26,6 +26,7 @@ struct tegra_ehci_platform_data {
26 /* power down the phy on bus suspend */ 26 /* power down the phy on bus suspend */
27 int power_down_on_bus_suspend; 27 int power_down_on_bus_suspend;
28 void *phy_config; 28 void *phy_config;
29 int vbus_gpio;
29}; 30};
30 31
31#endif /* _TEGRA_USB_H_ */ 32#endif /* _TEGRA_USB_H_ */
diff --git a/include/linux/platform_data/wiznet.h b/include/linux/platform_data/wiznet.h
new file mode 100644
index 000000000000..b5d8c192d84d
--- /dev/null
+++ b/include/linux/platform_data/wiznet.h
@@ -0,0 +1,24 @@
1/*
2 * Ethernet driver for the WIZnet W5x00 chip.
3 *
4 * Licensed under the GPL-2 or later.
5 */
6
7#ifndef PLATFORM_DATA_WIZNET_H
8#define PLATFORM_DATA_WIZNET_H
9
10#include <linux/if_ether.h>
11
12struct wiznet_platform_data {
13 int link_gpio;
14 u8 mac_addr[ETH_ALEN];
15};
16
17#ifndef CONFIG_WIZNET_BUS_SHIFT
18#define CONFIG_WIZNET_BUS_SHIFT 0
19#endif
20
21#define W5100_BUS_DIRECT_SIZE (0x8000 << CONFIG_WIZNET_BUS_SHIFT)
22#define W5300_BUS_DIRECT_SIZE (0x0400 << CONFIG_WIZNET_BUS_SHIFT)
23
24#endif /* PLATFORM_DATA_WIZNET_H */
diff --git a/include/linux/pm.h b/include/linux/pm.h
index 715305e05123..f067e60a3832 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -544,8 +544,6 @@ struct dev_pm_info {
544 unsigned long active_jiffies; 544 unsigned long active_jiffies;
545 unsigned long suspended_jiffies; 545 unsigned long suspended_jiffies;
546 unsigned long accounting_timestamp; 546 unsigned long accounting_timestamp;
547 ktime_t suspend_time;
548 s64 max_time_suspended_ns;
549 struct dev_pm_qos_request *pq_req; 547 struct dev_pm_qos_request *pq_req;
550#endif 548#endif
551 struct pm_subsys_data *subsys_data; /* Owned by the subsystem. */ 549 struct pm_subsys_data *subsys_data; /* Owned by the subsystem. */
diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
index 91f8286106ea..30f794eb3826 100644
--- a/include/linux/pm_domain.h
+++ b/include/linux/pm_domain.h
@@ -14,6 +14,7 @@
14#include <linux/pm.h> 14#include <linux/pm.h>
15#include <linux/err.h> 15#include <linux/err.h>
16#include <linux/of.h> 16#include <linux/of.h>
17#include <linux/notifier.h>
17 18
18enum gpd_status { 19enum gpd_status {
19 GPD_STATE_ACTIVE = 0, /* PM domain is active */ 20 GPD_STATE_ACTIVE = 0, /* PM domain is active */
@@ -70,9 +71,9 @@ struct generic_pm_domain {
70 int (*power_on)(struct generic_pm_domain *domain); 71 int (*power_on)(struct generic_pm_domain *domain);
71 s64 power_on_latency_ns; 72 s64 power_on_latency_ns;
72 struct gpd_dev_ops dev_ops; 73 struct gpd_dev_ops dev_ops;
73 s64 break_even_ns; /* Power break even for the entire domain. */
74 s64 max_off_time_ns; /* Maximum allowed "suspended" time. */ 74 s64 max_off_time_ns; /* Maximum allowed "suspended" time. */
75 ktime_t power_off_time; 75 bool max_off_time_changed;
76 bool cached_power_down_ok;
76 struct device_node *of_node; /* Node in device tree */ 77 struct device_node *of_node; /* Node in device tree */
77}; 78};
78 79
@@ -93,13 +94,17 @@ struct gpd_timing_data {
93 s64 start_latency_ns; 94 s64 start_latency_ns;
94 s64 save_state_latency_ns; 95 s64 save_state_latency_ns;
95 s64 restore_state_latency_ns; 96 s64 restore_state_latency_ns;
96 s64 break_even_ns; 97 s64 effective_constraint_ns;
98 bool constraint_changed;
99 bool cached_stop_ok;
97}; 100};
98 101
99struct generic_pm_domain_data { 102struct generic_pm_domain_data {
100 struct pm_domain_data base; 103 struct pm_domain_data base;
101 struct gpd_dev_ops ops; 104 struct gpd_dev_ops ops;
102 struct gpd_timing_data td; 105 struct gpd_timing_data td;
106 struct notifier_block nb;
107 struct mutex lock;
103 bool need_restore; 108 bool need_restore;
104 bool always_on; 109 bool always_on;
105}; 110};
@@ -141,6 +146,7 @@ static inline int pm_genpd_of_add_device(struct device_node *genpd_node,
141extern int pm_genpd_remove_device(struct generic_pm_domain *genpd, 146extern int pm_genpd_remove_device(struct generic_pm_domain *genpd,
142 struct device *dev); 147 struct device *dev);
143extern void pm_genpd_dev_always_on(struct device *dev, bool val); 148extern void pm_genpd_dev_always_on(struct device *dev, bool val);
149extern void pm_genpd_dev_need_restore(struct device *dev, bool val);
144extern int pm_genpd_add_subdomain(struct generic_pm_domain *genpd, 150extern int pm_genpd_add_subdomain(struct generic_pm_domain *genpd,
145 struct generic_pm_domain *new_subdomain); 151 struct generic_pm_domain *new_subdomain);
146extern int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd, 152extern int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd,
@@ -184,6 +190,7 @@ static inline int pm_genpd_remove_device(struct generic_pm_domain *genpd,
184 return -ENOSYS; 190 return -ENOSYS;
185} 191}
186static inline void pm_genpd_dev_always_on(struct device *dev, bool val) {} 192static inline void pm_genpd_dev_always_on(struct device *dev, bool val) {}
193static inline void pm_genpd_dev_need_restore(struct device *dev, bool val) {}
187static inline int pm_genpd_add_subdomain(struct generic_pm_domain *genpd, 194static inline int pm_genpd_add_subdomain(struct generic_pm_domain *genpd,
188 struct generic_pm_domain *new_sd) 195 struct generic_pm_domain *new_sd)
189{ 196{
diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h
index 609daae7a014..f271860c78d5 100644
--- a/include/linux/pm_runtime.h
+++ b/include/linux/pm_runtime.h
@@ -150,9 +150,6 @@ static inline void pm_runtime_set_autosuspend_delay(struct device *dev,
150static inline unsigned long pm_runtime_autosuspend_expiration( 150static inline unsigned long pm_runtime_autosuspend_expiration(
151 struct device *dev) { return 0; } 151 struct device *dev) { return 0; }
152 152
153static inline void pm_runtime_update_max_time_suspended(struct device *dev,
154 s64 delta_ns) {}
155
156#endif /* !CONFIG_PM_RUNTIME */ 153#endif /* !CONFIG_PM_RUNTIME */
157 154
158static inline int pm_runtime_idle(struct device *dev) 155static inline int pm_runtime_idle(struct device *dev)
diff --git a/include/linux/pm_wakeup.h b/include/linux/pm_wakeup.h
index d9f05113e5fb..569781faa504 100644
--- a/include/linux/pm_wakeup.h
+++ b/include/linux/pm_wakeup.h
@@ -33,12 +33,15 @@
33 * 33 *
34 * @total_time: Total time this wakeup source has been active. 34 * @total_time: Total time this wakeup source has been active.
35 * @max_time: Maximum time this wakeup source has been continuously active. 35 * @max_time: Maximum time this wakeup source has been continuously active.
36 * @last_time: Monotonic clock when the wakeup source's was activated last time. 36 * @last_time: Monotonic clock when the wakeup source's was touched last time.
37 * @prevent_sleep_time: Total time this source has been preventing autosleep.
37 * @event_count: Number of signaled wakeup events. 38 * @event_count: Number of signaled wakeup events.
38 * @active_count: Number of times the wakeup sorce was activated. 39 * @active_count: Number of times the wakeup sorce was activated.
39 * @relax_count: Number of times the wakeup sorce was deactivated. 40 * @relax_count: Number of times the wakeup sorce was deactivated.
40 * @hit_count: Number of times the wakeup sorce might abort system suspend. 41 * @expire_count: Number of times the wakeup source's timeout has expired.
42 * @wakeup_count: Number of times the wakeup source might abort suspend.
41 * @active: Status of the wakeup source. 43 * @active: Status of the wakeup source.
44 * @has_timeout: The wakeup source has been activated with a timeout.
42 */ 45 */
43struct wakeup_source { 46struct wakeup_source {
44 const char *name; 47 const char *name;
@@ -49,11 +52,15 @@ struct wakeup_source {
49 ktime_t total_time; 52 ktime_t total_time;
50 ktime_t max_time; 53 ktime_t max_time;
51 ktime_t last_time; 54 ktime_t last_time;
55 ktime_t start_prevent_time;
56 ktime_t prevent_sleep_time;
52 unsigned long event_count; 57 unsigned long event_count;
53 unsigned long active_count; 58 unsigned long active_count;
54 unsigned long relax_count; 59 unsigned long relax_count;
55 unsigned long hit_count; 60 unsigned long expire_count;
56 unsigned int active:1; 61 unsigned long wakeup_count;
62 bool active:1;
63 bool autosleep_enabled:1;
57}; 64};
58 65
59#ifdef CONFIG_PM_SLEEP 66#ifdef CONFIG_PM_SLEEP
diff --git a/include/linux/prctl.h b/include/linux/prctl.h
index e0cfec2490aa..78b76e24cc7e 100644
--- a/include/linux/prctl.h
+++ b/include/linux/prctl.h
@@ -124,4 +124,19 @@
124#define PR_SET_CHILD_SUBREAPER 36 124#define PR_SET_CHILD_SUBREAPER 36
125#define PR_GET_CHILD_SUBREAPER 37 125#define PR_GET_CHILD_SUBREAPER 37
126 126
127/*
128 * If no_new_privs is set, then operations that grant new privileges (i.e.
129 * execve) will either fail or not grant them. This affects suid/sgid,
130 * file capabilities, and LSMs.
131 *
132 * Operations that merely manipulate or drop existing privileges (setresuid,
133 * capset, etc.) will still work. Drop those privileges if you want them gone.
134 *
135 * Changing LSM security domain is considered a new privilege. So, for example,
136 * asking selinux for a specific new context (e.g. with runcon) will result
137 * in execve returning -EPERM.
138 */
139#define PR_SET_NO_NEW_PRIVS 38
140#define PR_GET_NO_NEW_PRIVS 39
141
127#endif /* _LINUX_PRCTL_H */ 142#endif /* _LINUX_PRCTL_H */
diff --git a/include/linux/printk.h b/include/linux/printk.h
index 0525927f203f..1bec2f7a2d42 100644
--- a/include/linux/printk.h
+++ b/include/linux/printk.h
@@ -95,8 +95,19 @@ extern int printk_needs_cpu(int cpu);
95extern void printk_tick(void); 95extern void printk_tick(void);
96 96
97#ifdef CONFIG_PRINTK 97#ifdef CONFIG_PRINTK
98asmlinkage __printf(5, 0)
99int vprintk_emit(int facility, int level,
100 const char *dict, size_t dictlen,
101 const char *fmt, va_list args);
102
98asmlinkage __printf(1, 0) 103asmlinkage __printf(1, 0)
99int vprintk(const char *fmt, va_list args); 104int vprintk(const char *fmt, va_list args);
105
106asmlinkage __printf(5, 6) __cold
107asmlinkage int printk_emit(int facility, int level,
108 const char *dict, size_t dictlen,
109 const char *fmt, ...);
110
100asmlinkage __printf(1, 2) __cold 111asmlinkage __printf(1, 2) __cold
101int printk(const char *fmt, ...); 112int printk(const char *fmt, ...);
102 113
@@ -289,6 +300,8 @@ extern void dump_stack(void) __cold;
289 no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) 300 no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
290#endif 301#endif
291 302
303extern const struct file_operations kmsg_fops;
304
292enum { 305enum {
293 DUMP_PREFIX_NONE, 306 DUMP_PREFIX_NONE,
294 DUMP_PREFIX_ADDRESS, 307 DUMP_PREFIX_ADDRESS,
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index 85c507306239..3fd2e871ff1b 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -52,8 +52,8 @@ struct proc_dir_entry {
52 unsigned int low_ino; 52 unsigned int low_ino;
53 umode_t mode; 53 umode_t mode;
54 nlink_t nlink; 54 nlink_t nlink;
55 uid_t uid; 55 kuid_t uid;
56 gid_t gid; 56 kgid_t gid;
57 loff_t size; 57 loff_t size;
58 const struct inode_operations *proc_iops; 58 const struct inode_operations *proc_iops;
59 /* 59 /*
diff --git a/include/linux/pstore_ram.h b/include/linux/pstore_ram.h
new file mode 100644
index 000000000000..7ed7fd4dba49
--- /dev/null
+++ b/include/linux/pstore_ram.h
@@ -0,0 +1,98 @@
1/*
2 * Copyright (C) 2010 Marco Stornelli <marco.stornelli@gmail.com>
3 * Copyright (C) 2011 Kees Cook <keescook@chromium.org>
4 * Copyright (C) 2011 Google, Inc.
5 *
6 * This software is licensed under the terms of the GNU General Public
7 * License version 2, as published by the Free Software Foundation, and
8 * may be copied, distributed, and modified under those terms.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 */
16
17#ifndef __LINUX_PSTORE_RAM_H__
18#define __LINUX_PSTORE_RAM_H__
19
20#include <linux/device.h>
21#include <linux/kernel.h>
22#include <linux/list.h>
23#include <linux/types.h>
24#include <linux/init.h>
25
26struct persistent_ram_buffer;
27
28struct persistent_ram_descriptor {
29 const char *name;
30 phys_addr_t size;
31};
32
33struct persistent_ram {
34 phys_addr_t start;
35 phys_addr_t size;
36
37 int num_descs;
38 struct persistent_ram_descriptor *descs;
39
40 struct list_head node;
41};
42
43struct persistent_ram_zone {
44 phys_addr_t paddr;
45 size_t size;
46 void *vaddr;
47 struct persistent_ram_buffer *buffer;
48 size_t buffer_size;
49
50 /* ECC correction */
51 bool ecc;
52 char *par_buffer;
53 char *par_header;
54 struct rs_control *rs_decoder;
55 int corrected_bytes;
56 int bad_blocks;
57 int ecc_block_size;
58 int ecc_size;
59 int ecc_symsize;
60 int ecc_poly;
61
62 char *old_log;
63 size_t old_log_size;
64};
65
66int persistent_ram_early_init(struct persistent_ram *ram);
67
68struct persistent_ram_zone * __init persistent_ram_new(phys_addr_t start,
69 size_t size,
70 bool ecc);
71void persistent_ram_free(struct persistent_ram_zone *prz);
72struct persistent_ram_zone *persistent_ram_init_ringbuffer(struct device *dev,
73 bool ecc);
74
75int persistent_ram_write(struct persistent_ram_zone *prz, const void *s,
76 unsigned int count);
77
78size_t persistent_ram_old_size(struct persistent_ram_zone *prz);
79void *persistent_ram_old(struct persistent_ram_zone *prz);
80void persistent_ram_free_old(struct persistent_ram_zone *prz);
81ssize_t persistent_ram_ecc_string(struct persistent_ram_zone *prz,
82 char *str, size_t len);
83
84/*
85 * Ramoops platform data
86 * @mem_size memory size for ramoops
87 * @mem_address physical memory address to contain ramoops
88 */
89
90struct ramoops_platform_data {
91 unsigned long mem_size;
92 unsigned long mem_address;
93 unsigned long record_size;
94 int dump_oops;
95 bool ecc;
96};
97
98#endif
diff --git a/include/linux/ptp_clock_kernel.h b/include/linux/ptp_clock_kernel.h
index dd2e44fba63e..945704c2ed65 100644
--- a/include/linux/ptp_clock_kernel.h
+++ b/include/linux/ptp_clock_kernel.h
@@ -136,4 +136,12 @@ struct ptp_clock_event {
136extern void ptp_clock_event(struct ptp_clock *ptp, 136extern void ptp_clock_event(struct ptp_clock *ptp,
137 struct ptp_clock_event *event); 137 struct ptp_clock_event *event);
138 138
139/**
140 * ptp_clock_index() - obtain the device index of a PTP clock
141 *
142 * @ptp: The clock obtained from ptp_clock_register().
143 */
144
145extern int ptp_clock_index(struct ptp_clock *ptp);
146
139#endif 147#endif
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h
index 5c719627c2aa..597e4fdb97fe 100644
--- a/include/linux/ptrace.h
+++ b/include/linux/ptrace.h
@@ -58,6 +58,7 @@
58#define PTRACE_EVENT_EXEC 4 58#define PTRACE_EVENT_EXEC 4
59#define PTRACE_EVENT_VFORK_DONE 5 59#define PTRACE_EVENT_VFORK_DONE 5
60#define PTRACE_EVENT_EXIT 6 60#define PTRACE_EVENT_EXIT 6
61#define PTRACE_EVENT_SECCOMP 7
61/* Extended result codes which enabled by means other than options. */ 62/* Extended result codes which enabled by means other than options. */
62#define PTRACE_EVENT_STOP 128 63#define PTRACE_EVENT_STOP 128
63 64
@@ -69,8 +70,9 @@
69#define PTRACE_O_TRACEEXEC (1 << PTRACE_EVENT_EXEC) 70#define PTRACE_O_TRACEEXEC (1 << PTRACE_EVENT_EXEC)
70#define PTRACE_O_TRACEVFORKDONE (1 << PTRACE_EVENT_VFORK_DONE) 71#define PTRACE_O_TRACEVFORKDONE (1 << PTRACE_EVENT_VFORK_DONE)
71#define PTRACE_O_TRACEEXIT (1 << PTRACE_EVENT_EXIT) 72#define PTRACE_O_TRACEEXIT (1 << PTRACE_EVENT_EXIT)
73#define PTRACE_O_TRACESECCOMP (1 << PTRACE_EVENT_SECCOMP)
72 74
73#define PTRACE_O_MASK 0x0000007f 75#define PTRACE_O_MASK 0x000000ff
74 76
75#include <asm/ptrace.h> 77#include <asm/ptrace.h>
76 78
@@ -98,6 +100,7 @@
98#define PT_TRACE_EXEC PT_EVENT_FLAG(PTRACE_EVENT_EXEC) 100#define PT_TRACE_EXEC PT_EVENT_FLAG(PTRACE_EVENT_EXEC)
99#define PT_TRACE_VFORK_DONE PT_EVENT_FLAG(PTRACE_EVENT_VFORK_DONE) 101#define PT_TRACE_VFORK_DONE PT_EVENT_FLAG(PTRACE_EVENT_VFORK_DONE)
100#define PT_TRACE_EXIT PT_EVENT_FLAG(PTRACE_EVENT_EXIT) 102#define PT_TRACE_EXIT PT_EVENT_FLAG(PTRACE_EVENT_EXIT)
103#define PT_TRACE_SECCOMP PT_EVENT_FLAG(PTRACE_EVENT_SECCOMP)
101 104
102/* single stepping state bits (used on ARM and PA-RISC) */ 105/* single stepping state bits (used on ARM and PA-RISC) */
103#define PT_SINGLESTEP_BIT 31 106#define PT_SINGLESTEP_BIT 31
diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h
index d93f95e6177c..17b977304a09 100644
--- a/include/linux/quotaops.h
+++ b/include/linux/quotaops.h
@@ -22,8 +22,8 @@ static inline struct quota_info *sb_dqopt(struct super_block *sb)
22static inline bool is_quota_modification(struct inode *inode, struct iattr *ia) 22static inline bool is_quota_modification(struct inode *inode, struct iattr *ia)
23{ 23{
24 return (ia->ia_valid & ATTR_SIZE && ia->ia_size != inode->i_size) || 24 return (ia->ia_valid & ATTR_SIZE && ia->ia_size != inode->i_size) ||
25 (ia->ia_valid & ATTR_UID && ia->ia_uid != inode->i_uid) || 25 (ia->ia_valid & ATTR_UID && !uid_eq(ia->ia_uid, inode->i_uid)) ||
26 (ia->ia_valid & ATTR_GID && ia->ia_gid != inode->i_gid); 26 (ia->ia_valid & ATTR_GID && !gid_eq(ia->ia_gid, inode->i_gid));
27} 27}
28 28
29#if defined(CONFIG_QUOTA) 29#if defined(CONFIG_QUOTA)
diff --git a/include/linux/raid/md_p.h b/include/linux/raid/md_p.h
index 8c0a3adc5df5..ee753536ab70 100644
--- a/include/linux/raid/md_p.h
+++ b/include/linux/raid/md_p.h
@@ -233,7 +233,10 @@ struct mdp_superblock_1 {
233 __le32 delta_disks; /* change in number of raid_disks */ 233 __le32 delta_disks; /* change in number of raid_disks */
234 __le32 new_layout; /* new layout */ 234 __le32 new_layout; /* new layout */
235 __le32 new_chunk; /* new chunk size (512byte sectors) */ 235 __le32 new_chunk; /* new chunk size (512byte sectors) */
236 __u8 pad1[128-124]; /* set to 0 when written */ 236 __le32 new_offset; /* signed number to add to data_offset in new
237 * layout. 0 == no-change. This can be
238 * different on each device in the array.
239 */
237 240
238 /* constant this-device information - 64 bytes */ 241 /* constant this-device information - 64 bytes */
239 __le64 data_offset; /* sector start of data, often 0 */ 242 __le64 data_offset; /* sector start of data, often 0 */
@@ -281,10 +284,18 @@ struct mdp_superblock_1 {
281 * active device with same 'role'. 284 * active device with same 'role'.
282 * 'recovery_offset' is also set. 285 * 'recovery_offset' is also set.
283 */ 286 */
287#define MD_FEATURE_RESHAPE_BACKWARDS 32 /* Reshape doesn't change number
288 * of devices, but is going
289 * backwards anyway.
290 */
291#define MD_FEATURE_NEW_OFFSET 64 /* new_offset must be honoured */
284#define MD_FEATURE_ALL (MD_FEATURE_BITMAP_OFFSET \ 292#define MD_FEATURE_ALL (MD_FEATURE_BITMAP_OFFSET \
285 |MD_FEATURE_RECOVERY_OFFSET \ 293 |MD_FEATURE_RECOVERY_OFFSET \
286 |MD_FEATURE_RESHAPE_ACTIVE \ 294 |MD_FEATURE_RESHAPE_ACTIVE \
287 |MD_FEATURE_BAD_BLOCKS \ 295 |MD_FEATURE_BAD_BLOCKS \
288 |MD_FEATURE_REPLACEMENT) 296 |MD_FEATURE_REPLACEMENT \
297 |MD_FEATURE_RESHAPE_BACKWARDS \
298 |MD_FEATURE_NEW_OFFSET \
299 )
289 300
290#endif 301#endif
diff --git a/include/linux/raid/pq.h b/include/linux/raid/pq.h
index 53272e9860a7..640c69ceec96 100644
--- a/include/linux/raid/pq.h
+++ b/include/linux/raid/pq.h
@@ -99,8 +99,20 @@ extern const struct raid6_calls raid6_altivec2;
99extern const struct raid6_calls raid6_altivec4; 99extern const struct raid6_calls raid6_altivec4;
100extern const struct raid6_calls raid6_altivec8; 100extern const struct raid6_calls raid6_altivec8;
101 101
102struct raid6_recov_calls {
103 void (*data2)(int, size_t, int, int, void **);
104 void (*datap)(int, size_t, int, void **);
105 int (*valid)(void);
106 const char *name;
107 int priority;
108};
109
110extern const struct raid6_recov_calls raid6_recov_intx1;
111extern const struct raid6_recov_calls raid6_recov_ssse3;
112
102/* Algorithm list */ 113/* Algorithm list */
103extern const struct raid6_calls * const raid6_algos[]; 114extern const struct raid6_calls * const raid6_algos[];
115extern const struct raid6_recov_calls *const raid6_recov_algos[];
104int raid6_select_algo(void); 116int raid6_select_algo(void);
105 117
106/* Return values from chk_syndrome */ 118/* Return values from chk_syndrome */
@@ -111,14 +123,16 @@ int raid6_select_algo(void);
111 123
112/* Galois field tables */ 124/* Galois field tables */
113extern const u8 raid6_gfmul[256][256] __attribute__((aligned(256))); 125extern const u8 raid6_gfmul[256][256] __attribute__((aligned(256)));
126extern const u8 raid6_vgfmul[256][32] __attribute__((aligned(256)));
114extern const u8 raid6_gfexp[256] __attribute__((aligned(256))); 127extern const u8 raid6_gfexp[256] __attribute__((aligned(256)));
115extern const u8 raid6_gfinv[256] __attribute__((aligned(256))); 128extern const u8 raid6_gfinv[256] __attribute__((aligned(256)));
116extern const u8 raid6_gfexi[256] __attribute__((aligned(256))); 129extern const u8 raid6_gfexi[256] __attribute__((aligned(256)));
117 130
118/* Recovery routines */ 131/* Recovery routines */
119void raid6_2data_recov(int disks, size_t bytes, int faila, int failb, 132extern void (*raid6_2data_recov)(int disks, size_t bytes, int faila, int failb,
120 void **ptrs); 133 void **ptrs);
121void raid6_datap_recov(int disks, size_t bytes, int faila, void **ptrs); 134extern void (*raid6_datap_recov)(int disks, size_t bytes, int faila,
135 void **ptrs);
122void raid6_dual_recov(int disks, size_t bytes, int faila, int failb, 136void raid6_dual_recov(int disks, size_t bytes, int faila, int failb,
123 void **ptrs); 137 void **ptrs);
124 138
diff --git a/include/linux/ramoops.h b/include/linux/ramoops.h
deleted file mode 100644
index 484fef81cd3a..000000000000
--- a/include/linux/ramoops.h
+++ /dev/null
@@ -1,17 +0,0 @@
1#ifndef __RAMOOPS_H
2#define __RAMOOPS_H
3
4/*
5 * Ramoops platform data
6 * @mem_size memory size for ramoops
7 * @mem_address physical memory address to contain ramoops
8 */
9
10struct ramoops_platform_data {
11 unsigned long mem_size;
12 unsigned long mem_address;
13 unsigned long record_size;
14 int dump_oops;
15};
16
17#endif
diff --git a/include/linux/rational.h b/include/linux/rational.h
index 4f532fcd9eea..bfa6a2bcfb32 100644
--- a/include/linux/rational.h
+++ b/include/linux/rational.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * rational fractions 2 * rational fractions
3 * 3 *
4 * Copyright (C) 2009 emlix GmbH, Oskar Schirmer <os@emlix.com> 4 * Copyright (C) 2009 emlix GmbH, Oskar Schirmer <oskar@scara.com>
5 * 5 *
6 * helper functions when coping with rational numbers, 6 * helper functions when coping with rational numbers,
7 * e.g. when calculating optimum numerator/denominator pairs for 7 * e.g. when calculating optimum numerator/denominator pairs for
diff --git a/include/linux/rculist.h b/include/linux/rculist.h
index d079290843a9..e0f0fab20415 100644
--- a/include/linux/rculist.h
+++ b/include/linux/rculist.h
@@ -30,6 +30,7 @@
30 * This is only for internal list manipulation where we know 30 * This is only for internal list manipulation where we know
31 * the prev/next entries already! 31 * the prev/next entries already!
32 */ 32 */
33#ifndef CONFIG_DEBUG_LIST
33static inline void __list_add_rcu(struct list_head *new, 34static inline void __list_add_rcu(struct list_head *new,
34 struct list_head *prev, struct list_head *next) 35 struct list_head *prev, struct list_head *next)
35{ 36{
@@ -38,6 +39,10 @@ static inline void __list_add_rcu(struct list_head *new,
38 rcu_assign_pointer(list_next_rcu(prev), new); 39 rcu_assign_pointer(list_next_rcu(prev), new);
39 next->prev = new; 40 next->prev = new;
40} 41}
42#else
43extern void __list_add_rcu(struct list_head *new,
44 struct list_head *prev, struct list_head *next);
45#endif
41 46
42/** 47/**
43 * list_add_rcu - add a new entry to rcu-protected list 48 * list_add_rcu - add a new entry to rcu-protected list
@@ -108,7 +113,7 @@ static inline void list_add_tail_rcu(struct list_head *new,
108 */ 113 */
109static inline void list_del_rcu(struct list_head *entry) 114static inline void list_del_rcu(struct list_head *entry)
110{ 115{
111 __list_del(entry->prev, entry->next); 116 __list_del_entry(entry);
112 entry->prev = LIST_POISON2; 117 entry->prev = LIST_POISON2;
113} 118}
114 119
@@ -228,18 +233,43 @@ static inline void list_splice_init_rcu(struct list_head *list,
228 }) 233 })
229 234
230/** 235/**
231 * list_first_entry_rcu - get the first element from a list 236 * Where are list_empty_rcu() and list_first_entry_rcu()?
237 *
238 * Implementing those functions following their counterparts list_empty() and
239 * list_first_entry() is not advisable because they lead to subtle race
240 * conditions as the following snippet shows:
241 *
242 * if (!list_empty_rcu(mylist)) {
243 * struct foo *bar = list_first_entry_rcu(mylist, struct foo, list_member);
244 * do_something(bar);
245 * }
246 *
247 * The list may not be empty when list_empty_rcu checks it, but it may be when
248 * list_first_entry_rcu rereads the ->next pointer.
249 *
250 * Rereading the ->next pointer is not a problem for list_empty() and
251 * list_first_entry() because they would be protected by a lock that blocks
252 * writers.
253 *
254 * See list_first_or_null_rcu for an alternative.
255 */
256
257/**
258 * list_first_or_null_rcu - get the first element from a list
232 * @ptr: the list head to take the element from. 259 * @ptr: the list head to take the element from.
233 * @type: the type of the struct this is embedded in. 260 * @type: the type of the struct this is embedded in.
234 * @member: the name of the list_struct within the struct. 261 * @member: the name of the list_struct within the struct.
235 * 262 *
236 * Note, that list is expected to be not empty. 263 * Note that if the list is empty, it returns NULL.
237 * 264 *
238 * This primitive may safely run concurrently with the _rcu list-mutation 265 * This primitive may safely run concurrently with the _rcu list-mutation
239 * primitives such as list_add_rcu() as long as it's guarded by rcu_read_lock(). 266 * primitives such as list_add_rcu() as long as it's guarded by rcu_read_lock().
240 */ 267 */
241#define list_first_entry_rcu(ptr, type, member) \ 268#define list_first_or_null_rcu(ptr, type, member) \
242 list_entry_rcu((ptr)->next, type, member) 269 ({struct list_head *__ptr = (ptr); \
270 struct list_head __rcu *__next = list_next_rcu(__ptr); \
271 likely(__ptr != __next) ? container_of(__next, type, member) : NULL; \
272 })
243 273
244/** 274/**
245 * list_for_each_entry_rcu - iterate over rcu list of given type 275 * list_for_each_entry_rcu - iterate over rcu list of given type
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 20fb776a1d4a..26d1a47591f1 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -184,12 +184,14 @@ static inline int rcu_preempt_depth(void)
184/* Internal to kernel */ 184/* Internal to kernel */
185extern void rcu_sched_qs(int cpu); 185extern void rcu_sched_qs(int cpu);
186extern void rcu_bh_qs(int cpu); 186extern void rcu_bh_qs(int cpu);
187extern void rcu_preempt_note_context_switch(void);
187extern void rcu_check_callbacks(int cpu, int user); 188extern void rcu_check_callbacks(int cpu, int user);
188struct notifier_block; 189struct notifier_block;
189extern void rcu_idle_enter(void); 190extern void rcu_idle_enter(void);
190extern void rcu_idle_exit(void); 191extern void rcu_idle_exit(void);
191extern void rcu_irq_enter(void); 192extern void rcu_irq_enter(void);
192extern void rcu_irq_exit(void); 193extern void rcu_irq_exit(void);
194extern void exit_rcu(void);
193 195
194/** 196/**
195 * RCU_NONIDLE - Indicate idle-loop code that needs RCU readers 197 * RCU_NONIDLE - Indicate idle-loop code that needs RCU readers
@@ -922,6 +924,21 @@ void __kfree_rcu(struct rcu_head *head, unsigned long offset)
922 kfree_call_rcu(head, (rcu_callback)offset); 924 kfree_call_rcu(head, (rcu_callback)offset);
923} 925}
924 926
927/*
928 * Does the specified offset indicate that the corresponding rcu_head
929 * structure can be handled by kfree_rcu()?
930 */
931#define __is_kfree_rcu_offset(offset) ((offset) < 4096)
932
933/*
934 * Helper macro for kfree_rcu() to prevent argument-expansion eyestrain.
935 */
936#define __kfree_rcu(head, offset) \
937 do { \
938 BUILD_BUG_ON(!__is_kfree_rcu_offset(offset)); \
939 call_rcu(head, (void (*)(struct rcu_head *))(unsigned long)(offset)); \
940 } while (0)
941
925/** 942/**
926 * kfree_rcu() - kfree an object after a grace period. 943 * kfree_rcu() - kfree an object after a grace period.
927 * @ptr: pointer to kfree 944 * @ptr: pointer to kfree
@@ -944,6 +961,9 @@ void __kfree_rcu(struct rcu_head *head, unsigned long offset)
944 * 961 *
945 * Note that the allowable offset might decrease in the future, for example, 962 * Note that the allowable offset might decrease in the future, for example,
946 * to allow something like kmem_cache_free_rcu(). 963 * to allow something like kmem_cache_free_rcu().
964 *
965 * The BUILD_BUG_ON check must not involve any function calls, hence the
966 * checks are done in macros here.
947 */ 967 */
948#define kfree_rcu(ptr, rcu_head) \ 968#define kfree_rcu(ptr, rcu_head) \
949 __kfree_rcu(&((ptr)->rcu_head), offsetof(typeof(*(ptr)), rcu_head)) 969 __kfree_rcu(&((ptr)->rcu_head), offsetof(typeof(*(ptr)), rcu_head))
diff --git a/include/linux/rcutiny.h b/include/linux/rcutiny.h
index e93df77176d1..adb5e5a38cae 100644
--- a/include/linux/rcutiny.h
+++ b/include/linux/rcutiny.h
@@ -87,14 +87,6 @@ static inline void kfree_call_rcu(struct rcu_head *head,
87 87
88#ifdef CONFIG_TINY_RCU 88#ifdef CONFIG_TINY_RCU
89 89
90static inline void rcu_preempt_note_context_switch(void)
91{
92}
93
94static inline void exit_rcu(void)
95{
96}
97
98static inline int rcu_needs_cpu(int cpu) 90static inline int rcu_needs_cpu(int cpu)
99{ 91{
100 return 0; 92 return 0;
@@ -102,8 +94,6 @@ static inline int rcu_needs_cpu(int cpu)
102 94
103#else /* #ifdef CONFIG_TINY_RCU */ 95#else /* #ifdef CONFIG_TINY_RCU */
104 96
105void rcu_preempt_note_context_switch(void);
106extern void exit_rcu(void);
107int rcu_preempt_needs_cpu(void); 97int rcu_preempt_needs_cpu(void);
108 98
109static inline int rcu_needs_cpu(int cpu) 99static inline int rcu_needs_cpu(int cpu)
@@ -116,7 +106,6 @@ static inline int rcu_needs_cpu(int cpu)
116static inline void rcu_note_context_switch(int cpu) 106static inline void rcu_note_context_switch(int cpu)
117{ 107{
118 rcu_sched_qs(cpu); 108 rcu_sched_qs(cpu);
119 rcu_preempt_note_context_switch();
120} 109}
121 110
122/* 111/*
diff --git a/include/linux/rcutree.h b/include/linux/rcutree.h
index e8ee5dd0854c..3c6083cde4fc 100644
--- a/include/linux/rcutree.h
+++ b/include/linux/rcutree.h
@@ -45,18 +45,6 @@ static inline void rcu_virt_note_context_switch(int cpu)
45 rcu_note_context_switch(cpu); 45 rcu_note_context_switch(cpu);
46} 46}
47 47
48#ifdef CONFIG_TREE_PREEMPT_RCU
49
50extern void exit_rcu(void);
51
52#else /* #ifdef CONFIG_TREE_PREEMPT_RCU */
53
54static inline void exit_rcu(void)
55{
56}
57
58#endif /* #else #ifdef CONFIG_TREE_PREEMPT_RCU */
59
60extern void synchronize_rcu_bh(void); 48extern void synchronize_rcu_bh(void);
61extern void synchronize_sched_expedited(void); 49extern void synchronize_sched_expedited(void);
62extern void synchronize_rcu_expedited(void); 50extern void synchronize_rcu_expedited(void);
@@ -98,13 +86,6 @@ extern void rcu_force_quiescent_state(void);
98extern void rcu_bh_force_quiescent_state(void); 86extern void rcu_bh_force_quiescent_state(void);
99extern void rcu_sched_force_quiescent_state(void); 87extern void rcu_sched_force_quiescent_state(void);
100 88
101/* A context switch is a grace period for RCU-sched and RCU-bh. */
102static inline int rcu_blocking_is_gp(void)
103{
104 might_sleep(); /* Check for RCU read-side critical section. */
105 return num_online_cpus() == 1;
106}
107
108extern void rcu_scheduler_starting(void); 89extern void rcu_scheduler_starting(void);
109extern int rcu_scheduler_active __read_mostly; 90extern int rcu_scheduler_active __read_mostly;
110 91
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index a90abb6bfa64..56af22ec9aba 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -46,7 +46,13 @@ struct reg_default {
46/** 46/**
47 * Configuration for the register map of a device. 47 * Configuration for the register map of a device.
48 * 48 *
49 * @name: Optional name of the regmap. Useful when a device has multiple
50 * register regions.
51 *
49 * @reg_bits: Number of bits in a register address, mandatory. 52 * @reg_bits: Number of bits in a register address, mandatory.
53 * @reg_stride: The register address stride. Valid register addresses are a
54 * multiple of this value. If set to 0, a value of 1 will be
55 * used.
50 * @pad_bits: Number of bits of padding between register and value. 56 * @pad_bits: Number of bits of padding between register and value.
51 * @val_bits: Number of bits in a register value, mandatory. 57 * @val_bits: Number of bits in a register value, mandatory.
52 * 58 *
@@ -70,6 +76,9 @@ struct reg_default {
70 * @write_flag_mask: Mask to be set in the top byte of the register when doing 76 * @write_flag_mask: Mask to be set in the top byte of the register when doing
71 * a write. If both read_flag_mask and write_flag_mask are 77 * a write. If both read_flag_mask and write_flag_mask are
72 * empty the regmap_bus default masks are used. 78 * empty the regmap_bus default masks are used.
79 * @use_single_rw: If set, converts the bulk read and write operations into
80 * a series of single read and write operations. This is useful
81 * for device that does not support bulk read and write.
73 * 82 *
74 * @cache_type: The actual cache type. 83 * @cache_type: The actual cache type.
75 * @reg_defaults_raw: Power on reset values for registers (for use with 84 * @reg_defaults_raw: Power on reset values for registers (for use with
@@ -77,7 +86,10 @@ struct reg_default {
77 * @num_reg_defaults_raw: Number of elements in reg_defaults_raw. 86 * @num_reg_defaults_raw: Number of elements in reg_defaults_raw.
78 */ 87 */
79struct regmap_config { 88struct regmap_config {
89 const char *name;
90
80 int reg_bits; 91 int reg_bits;
92 int reg_stride;
81 int pad_bits; 93 int pad_bits;
82 int val_bits; 94 int val_bits;
83 95
@@ -95,20 +107,25 @@ struct regmap_config {
95 107
96 u8 read_flag_mask; 108 u8 read_flag_mask;
97 u8 write_flag_mask; 109 u8 write_flag_mask;
110
111 bool use_single_rw;
98}; 112};
99 113
100typedef int (*regmap_hw_write)(struct device *dev, const void *data, 114typedef int (*regmap_hw_write)(void *context, const void *data,
101 size_t count); 115 size_t count);
102typedef int (*regmap_hw_gather_write)(struct device *dev, 116typedef int (*regmap_hw_gather_write)(void *context,
103 const void *reg, size_t reg_len, 117 const void *reg, size_t reg_len,
104 const void *val, size_t val_len); 118 const void *val, size_t val_len);
105typedef int (*regmap_hw_read)(struct device *dev, 119typedef int (*regmap_hw_read)(void *context,
106 const void *reg_buf, size_t reg_size, 120 const void *reg_buf, size_t reg_size,
107 void *val_buf, size_t val_size); 121 void *val_buf, size_t val_size);
122typedef void (*regmap_hw_free_context)(void *context);
108 123
109/** 124/**
110 * Description of a hardware bus for the register map infrastructure. 125 * Description of a hardware bus for the register map infrastructure.
111 * 126 *
127 * @fast_io: Register IO is fast. Use a spinlock instead of a mutex
128 * to perform locking.
112 * @write: Write operation. 129 * @write: Write operation.
113 * @gather_write: Write operation with split register/value, return -ENOTSUPP 130 * @gather_write: Write operation with split register/value, return -ENOTSUPP
114 * if not implemented on a given device. 131 * if not implemented on a given device.
@@ -118,31 +135,42 @@ typedef int (*regmap_hw_read)(struct device *dev,
118 * a read. 135 * a read.
119 */ 136 */
120struct regmap_bus { 137struct regmap_bus {
138 bool fast_io;
121 regmap_hw_write write; 139 regmap_hw_write write;
122 regmap_hw_gather_write gather_write; 140 regmap_hw_gather_write gather_write;
123 regmap_hw_read read; 141 regmap_hw_read read;
142 regmap_hw_free_context free_context;
124 u8 read_flag_mask; 143 u8 read_flag_mask;
125}; 144};
126 145
127struct regmap *regmap_init(struct device *dev, 146struct regmap *regmap_init(struct device *dev,
128 const struct regmap_bus *bus, 147 const struct regmap_bus *bus,
148 void *bus_context,
129 const struct regmap_config *config); 149 const struct regmap_config *config);
130struct regmap *regmap_init_i2c(struct i2c_client *i2c, 150struct regmap *regmap_init_i2c(struct i2c_client *i2c,
131 const struct regmap_config *config); 151 const struct regmap_config *config);
132struct regmap *regmap_init_spi(struct spi_device *dev, 152struct regmap *regmap_init_spi(struct spi_device *dev,
133 const struct regmap_config *config); 153 const struct regmap_config *config);
154struct regmap *regmap_init_mmio(struct device *dev,
155 void __iomem *regs,
156 const struct regmap_config *config);
134 157
135struct regmap *devm_regmap_init(struct device *dev, 158struct regmap *devm_regmap_init(struct device *dev,
136 const struct regmap_bus *bus, 159 const struct regmap_bus *bus,
160 void *bus_context,
137 const struct regmap_config *config); 161 const struct regmap_config *config);
138struct regmap *devm_regmap_init_i2c(struct i2c_client *i2c, 162struct regmap *devm_regmap_init_i2c(struct i2c_client *i2c,
139 const struct regmap_config *config); 163 const struct regmap_config *config);
140struct regmap *devm_regmap_init_spi(struct spi_device *dev, 164struct regmap *devm_regmap_init_spi(struct spi_device *dev,
141 const struct regmap_config *config); 165 const struct regmap_config *config);
166struct regmap *devm_regmap_init_mmio(struct device *dev,
167 void __iomem *regs,
168 const struct regmap_config *config);
142 169
143void regmap_exit(struct regmap *map); 170void regmap_exit(struct regmap *map);
144int regmap_reinit_cache(struct regmap *map, 171int regmap_reinit_cache(struct regmap *map,
145 const struct regmap_config *config); 172 const struct regmap_config *config);
173struct regmap *dev_get_regmap(struct device *dev, const char *name);
146int regmap_write(struct regmap *map, unsigned int reg, unsigned int val); 174int regmap_write(struct regmap *map, unsigned int reg, unsigned int val);
147int regmap_raw_write(struct regmap *map, unsigned int reg, 175int regmap_raw_write(struct regmap *map, unsigned int reg,
148 const void *val, size_t val_len); 176 const void *val, size_t val_len);
@@ -191,6 +219,7 @@ struct regmap_irq {
191 * @status_base: Base status register address. 219 * @status_base: Base status register address.
192 * @mask_base: Base mask register address. 220 * @mask_base: Base mask register address.
193 * @ack_base: Base ack address. If zero then the chip is clear on read. 221 * @ack_base: Base ack address. If zero then the chip is clear on read.
222 * @irq_reg_stride: Stride to use for chips where registers are not contiguous.
194 * 223 *
195 * @num_regs: Number of registers in each control bank. 224 * @num_regs: Number of registers in each control bank.
196 * @irqs: Descriptors for individual IRQs. Interrupt numbers are 225 * @irqs: Descriptors for individual IRQs. Interrupt numbers are
@@ -203,6 +232,7 @@ struct regmap_irq_chip {
203 unsigned int status_base; 232 unsigned int status_base;
204 unsigned int mask_base; 233 unsigned int mask_base;
205 unsigned int ack_base; 234 unsigned int ack_base;
235 unsigned int irq_reg_stride;
206 236
207 int num_regs; 237 int num_regs;
208 238
@@ -217,6 +247,7 @@ int regmap_add_irq_chip(struct regmap *map, int irq, int irq_flags,
217 struct regmap_irq_chip_data **data); 247 struct regmap_irq_chip_data **data);
218void regmap_del_irq_chip(int irq, struct regmap_irq_chip_data *data); 248void regmap_del_irq_chip(int irq, struct regmap_irq_chip_data *data);
219int regmap_irq_chip_get_base(struct regmap_irq_chip_data *data); 249int regmap_irq_chip_get_base(struct regmap_irq_chip_data *data);
250int regmap_irq_get_virq(struct regmap_irq_chip_data *data, int irq);
220 251
221#else 252#else
222 253
@@ -327,6 +358,13 @@ static inline int regmap_register_patch(struct regmap *map,
327 return -EINVAL; 358 return -EINVAL;
328} 359}
329 360
361static inline struct regmap *dev_get_regmap(struct device *dev,
362 const char *name)
363{
364 WARN_ONCE(1, "regmap API is disabled");
365 return NULL;
366}
367
330#endif 368#endif
331 369
332#endif 370#endif
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
index fa8b55b8191c..b0432cc2b169 100644
--- a/include/linux/regulator/driver.h
+++ b/include/linux/regulator/driver.h
@@ -19,6 +19,7 @@
19#include <linux/notifier.h> 19#include <linux/notifier.h>
20#include <linux/regulator/consumer.h> 20#include <linux/regulator/consumer.h>
21 21
22struct regmap;
22struct regulator_dev; 23struct regulator_dev;
23struct regulator_init_data; 24struct regulator_init_data;
24 25
@@ -45,6 +46,7 @@ enum regulator_status {
45 * The driver should select the voltage closest to min_uV. 46 * The driver should select the voltage closest to min_uV.
46 * @set_voltage_sel: Set the voltage for the regulator using the specified 47 * @set_voltage_sel: Set the voltage for the regulator using the specified
47 * selector. 48 * selector.
49 * @map_voltage: Convert a voltage into a selector
48 * @get_voltage: Return the currently configured voltage for the regulator. 50 * @get_voltage: Return the currently configured voltage for the regulator.
49 * @get_voltage_sel: Return the currently configured voltage selector for the 51 * @get_voltage_sel: Return the currently configured voltage selector for the
50 * regulator. 52 * regulator.
@@ -90,6 +92,7 @@ struct regulator_ops {
90 /* get/set regulator voltage */ 92 /* get/set regulator voltage */
91 int (*set_voltage) (struct regulator_dev *, int min_uV, int max_uV, 93 int (*set_voltage) (struct regulator_dev *, int min_uV, int max_uV,
92 unsigned *selector); 94 unsigned *selector);
95 int (*map_voltage)(struct regulator_dev *, int min_uV, int max_uV);
93 int (*set_voltage_sel) (struct regulator_dev *, unsigned selector); 96 int (*set_voltage_sel) (struct regulator_dev *, unsigned selector);
94 int (*get_voltage) (struct regulator_dev *); 97 int (*get_voltage) (struct regulator_dev *);
95 int (*get_voltage_sel) (struct regulator_dev *); 98 int (*get_voltage_sel) (struct regulator_dev *);
@@ -148,19 +151,30 @@ enum regulator_type {
148}; 151};
149 152
150/** 153/**
151 * struct regulator_desc - Regulator descriptor 154 * struct regulator_desc - Static regulator descriptor
152 * 155 *
153 * Each regulator registered with the core is described with a structure of 156 * Each regulator registered with the core is described with a
154 * this type. 157 * structure of this type and a struct regulator_config. This
158 * structure contains the non-varying parts of the regulator
159 * description.
155 * 160 *
156 * @name: Identifying name for the regulator. 161 * @name: Identifying name for the regulator.
157 * @supply_name: Identifying the regulator supply 162 * @supply_name: Identifying the regulator supply
158 * @id: Numerical identifier for the regulator. 163 * @id: Numerical identifier for the regulator.
159 * @n_voltages: Number of selectors available for ops.list_voltage().
160 * @ops: Regulator operations table. 164 * @ops: Regulator operations table.
161 * @irq: Interrupt number for the regulator. 165 * @irq: Interrupt number for the regulator.
162 * @type: Indicates if the regulator is a voltage or current regulator. 166 * @type: Indicates if the regulator is a voltage or current regulator.
163 * @owner: Module providing the regulator, used for refcounting. 167 * @owner: Module providing the regulator, used for refcounting.
168 *
169 * @n_voltages: Number of selectors available for ops.list_voltage().
170 *
171 * @min_uV: Voltage given by the lowest selector (if linear mapping)
172 * @uV_step: Voltage increase with each selector (if linear mapping)
173 *
174 * @vsel_reg: Register for selector when using regulator_regmap_X_voltage_
175 * @vsel_mask: Mask for register bitfield used for selector
176 * @enable_reg: Register for control when using regmap enable/disable ops
177 * @enable_mask: Mask for control when using regmap enable/disable ops
164 */ 178 */
165struct regulator_desc { 179struct regulator_desc {
166 const char *name; 180 const char *name;
@@ -171,6 +185,36 @@ struct regulator_desc {
171 int irq; 185 int irq;
172 enum regulator_type type; 186 enum regulator_type type;
173 struct module *owner; 187 struct module *owner;
188
189 unsigned int min_uV;
190 unsigned int uV_step;
191
192 unsigned int vsel_reg;
193 unsigned int vsel_mask;
194 unsigned int enable_reg;
195 unsigned int enable_mask;
196};
197
198/**
199 * struct regulator_config - Dynamic regulator descriptor
200 *
201 * Each regulator registered with the core is described with a
202 * structure of this type and a struct regulator_desc. This structure
203 * contains the runtime variable parts of the regulator description.
204 *
205 * @dev: struct device for the regulator
206 * @init_data: platform provided init data, passed through by driver
207 * @driver_data: private regulator data
208 * @of_node: OpenFirmware node to parse for device tree bindings (may be
209 * NULL).
210 * @regmap: regmap to use for core regmap helpers
211 */
212struct regulator_config {
213 struct device *dev;
214 const struct regulator_init_data *init_data;
215 void *driver_data;
216 struct device_node *of_node;
217 struct regmap *regmap;
174}; 218};
175 219
176/* 220/*
@@ -184,7 +228,7 @@ struct regulator_desc {
184 * no other direct access). 228 * no other direct access).
185 */ 229 */
186struct regulator_dev { 230struct regulator_dev {
187 struct regulator_desc *desc; 231 const struct regulator_desc *desc;
188 int exclusive; 232 int exclusive;
189 u32 use_count; 233 u32 use_count;
190 u32 open_count; 234 u32 open_count;
@@ -201,6 +245,7 @@ struct regulator_dev {
201 struct device dev; 245 struct device dev;
202 struct regulation_constraints *constraints; 246 struct regulation_constraints *constraints;
203 struct regulator *supply; /* for tree */ 247 struct regulator *supply; /* for tree */
248 struct regmap *regmap;
204 249
205 struct delayed_work disable_work; 250 struct delayed_work disable_work;
206 int deferred_disables; 251 int deferred_disables;
@@ -210,9 +255,9 @@ struct regulator_dev {
210 struct dentry *debugfs; 255 struct dentry *debugfs;
211}; 256};
212 257
213struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc, 258struct regulator_dev *
214 struct device *dev, const struct regulator_init_data *init_data, 259regulator_register(const struct regulator_desc *regulator_desc,
215 void *driver_data, struct device_node *of_node); 260 const struct regulator_config *config);
216void regulator_unregister(struct regulator_dev *rdev); 261void regulator_unregister(struct regulator_dev *rdev);
217 262
218int regulator_notifier_call_chain(struct regulator_dev *rdev, 263int regulator_notifier_call_chain(struct regulator_dev *rdev,
@@ -224,6 +269,18 @@ int rdev_get_id(struct regulator_dev *rdev);
224 269
225int regulator_mode_to_status(unsigned int); 270int regulator_mode_to_status(unsigned int);
226 271
272int regulator_list_voltage_linear(struct regulator_dev *rdev,
273 unsigned int selector);
274int regulator_map_voltage_linear(struct regulator_dev *rdev,
275 int min_uV, int max_uV);
276int regulator_map_voltage_iterate(struct regulator_dev *rdev,
277 int min_uV, int max_uV);
278int regulator_get_voltage_sel_regmap(struct regulator_dev *rdev);
279int regulator_set_voltage_sel_regmap(struct regulator_dev *rdev, unsigned sel);
280int regulator_is_enabled_regmap(struct regulator_dev *rdev);
281int regulator_enable_regmap(struct regulator_dev *rdev);
282int regulator_disable_regmap(struct regulator_dev *rdev);
283
227void *regulator_get_init_drvdata(struct regulator_init_data *reg_init_data); 284void *regulator_get_init_drvdata(struct regulator_init_data *reg_init_data);
228 285
229#endif 286#endif
diff --git a/include/linux/regulator/fixed.h b/include/linux/regulator/fixed.h
index 936a7d8c11a9..f83f7440b488 100644
--- a/include/linux/regulator/fixed.h
+++ b/include/linux/regulator/fixed.h
@@ -26,6 +26,12 @@ struct regulator_init_data;
26 * @gpio: GPIO to use for enable control 26 * @gpio: GPIO to use for enable control
27 * set to -EINVAL if not used 27 * set to -EINVAL if not used
28 * @startup_delay: Start-up time in microseconds 28 * @startup_delay: Start-up time in microseconds
29 * @gpio_is_open_drain: Gpio pin is open drain or normal type.
30 * If it is open drain type then HIGH will be set
31 * through PULL-UP with setting gpio as input
32 * and low will be set as gpio-output with driven
33 * to low. For non-open-drain case, the gpio will
34 * will be in output and drive to low/high accordingly.
29 * @enable_high: Polarity of enable GPIO 35 * @enable_high: Polarity of enable GPIO
30 * 1 = Active high, 0 = Active low 36 * 1 = Active high, 0 = Active low
31 * @enabled_at_boot: Whether regulator has been enabled at 37 * @enabled_at_boot: Whether regulator has been enabled at
@@ -43,6 +49,7 @@ struct fixed_voltage_config {
43 int microvolts; 49 int microvolts;
44 int gpio; 50 int gpio;
45 unsigned startup_delay; 51 unsigned startup_delay;
52 unsigned gpio_is_open_drain:1;
46 unsigned enable_high:1; 53 unsigned enable_high:1;
47 unsigned enabled_at_boot:1; 54 unsigned enabled_at_boot:1;
48 struct regulator_init_data *init_data; 55 struct regulator_init_data *init_data;
diff --git a/include/linux/regulator/of_regulator.h b/include/linux/regulator/of_regulator.h
index 769704f296e5..f9217965aaa3 100644
--- a/include/linux/regulator/of_regulator.h
+++ b/include/linux/regulator/of_regulator.h
@@ -6,10 +6,20 @@
6#ifndef __LINUX_OF_REG_H 6#ifndef __LINUX_OF_REG_H
7#define __LINUX_OF_REG_H 7#define __LINUX_OF_REG_H
8 8
9struct of_regulator_match {
10 const char *name;
11 void *driver_data;
12 struct regulator_init_data *init_data;
13 struct device_node *of_node;
14};
15
9#if defined(CONFIG_OF) 16#if defined(CONFIG_OF)
10extern struct regulator_init_data 17extern struct regulator_init_data
11 *of_get_regulator_init_data(struct device *dev, 18 *of_get_regulator_init_data(struct device *dev,
12 struct device_node *node); 19 struct device_node *node);
20extern int of_regulator_match(struct device *dev, struct device_node *node,
21 struct of_regulator_match *matches,
22 unsigned int num_matches);
13#else 23#else
14static inline struct regulator_init_data 24static inline struct regulator_init_data
15 *of_get_regulator_init_data(struct device *dev, 25 *of_get_regulator_init_data(struct device *dev,
@@ -17,6 +27,14 @@ static inline struct regulator_init_data
17{ 27{
18 return NULL; 28 return NULL;
19} 29}
30
31static inline int of_regulator_match(struct device *dev,
32 struct device_node *node,
33 struct of_regulator_match *matches,
34 unsigned int num_matches)
35{
36 return 0;
37}
20#endif /* CONFIG_OF */ 38#endif /* CONFIG_OF */
21 39
22#endif /* __LINUX_OF_REG_H */ 40#endif /* __LINUX_OF_REG_H */
diff --git a/include/linux/regulator/tps62360.h b/include/linux/regulator/tps62360.h
index 6a5c1b2c751e..a4c49394c497 100644
--- a/include/linux/regulator/tps62360.h
+++ b/include/linux/regulator/tps62360.h
@@ -26,13 +26,10 @@
26#ifndef __LINUX_REGULATOR_TPS62360_H 26#ifndef __LINUX_REGULATOR_TPS62360_H
27#define __LINUX_REGULATOR_TPS62360_H 27#define __LINUX_REGULATOR_TPS62360_H
28 28
29#include <linux/regulator/machine.h>
30
31/* 29/*
32 * struct tps62360_regulator_platform_data - tps62360 regulator platform data. 30 * struct tps62360_regulator_platform_data - tps62360 regulator platform data.
33 * 31 *
34 * @reg_init_data: The regulator init data. 32 * @reg_init_data: The regulator init data.
35 * @en_force_pwm: Enable force pwm or not.
36 * @en_discharge: Enable discharge the output capacitor via internal 33 * @en_discharge: Enable discharge the output capacitor via internal
37 * register. 34 * register.
38 * @en_internal_pulldn: internal pull down enable or not. 35 * @en_internal_pulldn: internal pull down enable or not.
@@ -44,8 +41,7 @@
44 * @vsel1_def_state: Default state of vsel1. 1 if it is high else 0. 41 * @vsel1_def_state: Default state of vsel1. 1 if it is high else 0.
45 */ 42 */
46struct tps62360_regulator_platform_data { 43struct tps62360_regulator_platform_data {
47 struct regulator_init_data reg_init_data; 44 struct regulator_init_data *reg_init_data;
48 bool en_force_pwm;
49 bool en_discharge; 45 bool en_discharge;
50 bool en_internal_pulldn; 46 bool en_internal_pulldn;
51 int vsel0_gpio; 47 int vsel0_gpio;
diff --git a/include/linux/regulator/tps65090-regulator.h b/include/linux/regulator/tps65090-regulator.h
new file mode 100644
index 000000000000..0fa04b64db3e
--- /dev/null
+++ b/include/linux/regulator/tps65090-regulator.h
@@ -0,0 +1,50 @@
1/*
2 * Regulator driver interface for TI TPS65090 PMIC family
3 *
4 * Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved.
5
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License,
8 * version 2, as published by the Free Software Foundation.
9
10 * This program is distributed in the hope it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#ifndef __REGULATOR_TPS65090_H
20#define __REGULATOR_TPS65090_H
21
22#include <linux/regulator/machine.h>
23
24#define tps65090_rails(_name) "tps65090_"#_name
25
26enum {
27 TPS65090_ID_DCDC1,
28 TPS65090_ID_DCDC2,
29 TPS65090_ID_DCDC3,
30 TPS65090_ID_FET1,
31 TPS65090_ID_FET2,
32 TPS65090_ID_FET3,
33 TPS65090_ID_FET4,
34 TPS65090_ID_FET5,
35 TPS65090_ID_FET6,
36 TPS65090_ID_FET7,
37};
38
39/*
40 * struct tps65090_regulator_platform_data
41 *
42 * @regulator: The regulator init data.
43 * @slew_rate_uV_per_us: Slew rate microvolt per microsec.
44 */
45
46struct tps65090_regulator_platform_data {
47 struct regulator_init_data regulator;
48};
49
50#endif /* __REGULATOR_TPS65090_H */
diff --git a/include/linux/res_counter.h b/include/linux/res_counter.h
index da81af086eaf..fb201896a8b0 100644
--- a/include/linux/res_counter.h
+++ b/include/linux/res_counter.h
@@ -116,7 +116,7 @@ void res_counter_init(struct res_counter *counter, struct res_counter *parent);
116 */ 116 */
117 117
118int __must_check res_counter_charge_locked(struct res_counter *counter, 118int __must_check res_counter_charge_locked(struct res_counter *counter,
119 unsigned long val); 119 unsigned long val, bool force);
120int __must_check res_counter_charge(struct res_counter *counter, 120int __must_check res_counter_charge(struct res_counter *counter,
121 unsigned long val, struct res_counter **limit_fail_at); 121 unsigned long val, struct res_counter **limit_fail_at);
122int __must_check res_counter_charge_nofail(struct res_counter *counter, 122int __must_check res_counter_charge_nofail(struct res_counter *counter,
diff --git a/include/linux/ring_buffer.h b/include/linux/ring_buffer.h
index 7be2e88f23fd..6c8835f74f79 100644
--- a/include/linux/ring_buffer.h
+++ b/include/linux/ring_buffer.h
@@ -96,9 +96,11 @@ __ring_buffer_alloc(unsigned long size, unsigned flags, struct lock_class_key *k
96 __ring_buffer_alloc((size), (flags), &__key); \ 96 __ring_buffer_alloc((size), (flags), &__key); \
97}) 97})
98 98
99#define RING_BUFFER_ALL_CPUS -1
100
99void ring_buffer_free(struct ring_buffer *buffer); 101void ring_buffer_free(struct ring_buffer *buffer);
100 102
101int ring_buffer_resize(struct ring_buffer *buffer, unsigned long size); 103int ring_buffer_resize(struct ring_buffer *buffer, unsigned long size, int cpu);
102 104
103void ring_buffer_change_overwrite(struct ring_buffer *buffer, int val); 105void ring_buffer_change_overwrite(struct ring_buffer *buffer, int val);
104 106
@@ -129,7 +131,7 @@ ring_buffer_read(struct ring_buffer_iter *iter, u64 *ts);
129void ring_buffer_iter_reset(struct ring_buffer_iter *iter); 131void ring_buffer_iter_reset(struct ring_buffer_iter *iter);
130int ring_buffer_iter_empty(struct ring_buffer_iter *iter); 132int ring_buffer_iter_empty(struct ring_buffer_iter *iter);
131 133
132unsigned long ring_buffer_size(struct ring_buffer *buffer); 134unsigned long ring_buffer_size(struct ring_buffer *buffer, int cpu);
133 135
134void ring_buffer_reset_cpu(struct ring_buffer *buffer, int cpu); 136void ring_buffer_reset_cpu(struct ring_buffer *buffer, int cpu);
135void ring_buffer_reset(struct ring_buffer *buffer); 137void ring_buffer_reset(struct ring_buffer *buffer);
diff --git a/include/linux/rndis.h b/include/linux/rndis.h
new file mode 100644
index 000000000000..0c8dc7195cdb
--- /dev/null
+++ b/include/linux/rndis.h
@@ -0,0 +1,390 @@
1/*
2 * Remote Network Driver Interface Specification (RNDIS)
3 * definitions of the magic numbers used by this protocol
4 */
5
6/* Remote NDIS Versions */
7#define RNDIS_MAJOR_VERSION 0x00000001
8#define RNDIS_MINOR_VERSION 0x00000000
9
10/* Device Flags */
11#define RNDIS_DF_CONNECTIONLESS 0x00000001U
12#define RNDIS_DF_CONNECTION_ORIENTED 0x00000002U
13#define RNDIS_DF_RAW_DATA 0x00000004U
14
15/*
16 * Codes for "msg_type" field of rndis messages;
17 * only the data channel uses packet messages (maybe batched);
18 * everything else goes on the control channel.
19 */
20#define RNDIS_MSG_COMPLETION 0x80000000
21#define RNDIS_MSG_PACKET 0x00000001 /* 1-N packets */
22#define RNDIS_MSG_INIT 0x00000002
23#define RNDIS_MSG_INIT_C (RNDIS_MSG_INIT|RNDIS_MSG_COMPLETION)
24#define RNDIS_MSG_HALT 0x00000003
25#define RNDIS_MSG_QUERY 0x00000004
26#define RNDIS_MSG_QUERY_C (RNDIS_MSG_QUERY|RNDIS_MSG_COMPLETION)
27#define RNDIS_MSG_SET 0x00000005
28#define RNDIS_MSG_SET_C (RNDIS_MSG_SET|RNDIS_MSG_COMPLETION)
29#define RNDIS_MSG_RESET 0x00000006
30#define RNDIS_MSG_RESET_C (RNDIS_MSG_RESET|RNDIS_MSG_COMPLETION)
31#define RNDIS_MSG_INDICATE 0x00000007
32#define RNDIS_MSG_KEEPALIVE 0x00000008
33#define RNDIS_MSG_KEEPALIVE_C (RNDIS_MSG_KEEPALIVE|RNDIS_MSG_COMPLETION)
34/*
35 * Reserved message type for private communication between lower-layer host
36 * driver and remote device, if necessary.
37 */
38#define RNDIS_MSG_BUS 0xff000001
39
40/* codes for "status" field of completion messages */
41#define RNDIS_STATUS_SUCCESS 0x00000000
42#define RNDIS_STATUS_PENDING 0x00000103
43
44/* Status codes */
45#define RNDIS_STATUS_NOT_RECOGNIZED 0x00010001
46#define RNDIS_STATUS_NOT_COPIED 0x00010002
47#define RNDIS_STATUS_NOT_ACCEPTED 0x00010003
48#define RNDIS_STATUS_CALL_ACTIVE 0x00010007
49
50#define RNDIS_STATUS_ONLINE 0x40010003
51#define RNDIS_STATUS_RESET_START 0x40010004
52#define RNDIS_STATUS_RESET_END 0x40010005
53#define RNDIS_STATUS_RING_STATUS 0x40010006
54#define RNDIS_STATUS_CLOSED 0x40010007
55#define RNDIS_STATUS_WAN_LINE_UP 0x40010008
56#define RNDIS_STATUS_WAN_LINE_DOWN 0x40010009
57#define RNDIS_STATUS_WAN_FRAGMENT 0x4001000A
58#define RNDIS_STATUS_MEDIA_CONNECT 0x4001000B
59#define RNDIS_STATUS_MEDIA_DISCONNECT 0x4001000C
60#define RNDIS_STATUS_HARDWARE_LINE_UP 0x4001000D
61#define RNDIS_STATUS_HARDWARE_LINE_DOWN 0x4001000E
62#define RNDIS_STATUS_INTERFACE_UP 0x4001000F
63#define RNDIS_STATUS_INTERFACE_DOWN 0x40010010
64#define RNDIS_STATUS_MEDIA_BUSY 0x40010011
65#define RNDIS_STATUS_MEDIA_SPECIFIC_INDICATION 0x40010012
66#define RNDIS_STATUS_WW_INDICATION RDIA_SPECIFIC_INDICATION
67#define RNDIS_STATUS_LINK_SPEED_CHANGE 0x40010013L
68
69#define RNDIS_STATUS_NOT_RESETTABLE 0x80010001
70#define RNDIS_STATUS_SOFT_ERRORS 0x80010003
71#define RNDIS_STATUS_HARD_ERRORS 0x80010004
72#define RNDIS_STATUS_BUFFER_OVERFLOW 0x80000005
73
74#define RNDIS_STATUS_FAILURE 0xC0000001
75#define RNDIS_STATUS_RESOURCES 0xC000009A
76#define RNDIS_STATUS_NOT_SUPPORTED 0xc00000BB
77#define RNDIS_STATUS_CLOSING 0xC0010002
78#define RNDIS_STATUS_BAD_VERSION 0xC0010004
79#define RNDIS_STATUS_BAD_CHARACTERISTICS 0xC0010005
80#define RNDIS_STATUS_ADAPTER_NOT_FOUND 0xC0010006
81#define RNDIS_STATUS_OPEN_FAILED 0xC0010007
82#define RNDIS_STATUS_DEVICE_FAILED 0xC0010008
83#define RNDIS_STATUS_MULTICAST_FULL 0xC0010009
84#define RNDIS_STATUS_MULTICAST_EXISTS 0xC001000A
85#define RNDIS_STATUS_MULTICAST_NOT_FOUND 0xC001000B
86#define RNDIS_STATUS_REQUEST_ABORTED 0xC001000C
87#define RNDIS_STATUS_RESET_IN_PROGRESS 0xC001000D
88#define RNDIS_STATUS_CLOSING_INDICATING 0xC001000E
89#define RNDIS_STATUS_INVALID_PACKET 0xC001000F
90#define RNDIS_STATUS_OPEN_LIST_FULL 0xC0010010
91#define RNDIS_STATUS_ADAPTER_NOT_READY 0xC0010011
92#define RNDIS_STATUS_ADAPTER_NOT_OPEN 0xC0010012
93#define RNDIS_STATUS_NOT_INDICATING 0xC0010013
94#define RNDIS_STATUS_INVALID_LENGTH 0xC0010014
95#define RNDIS_STATUS_INVALID_DATA 0xC0010015
96#define RNDIS_STATUS_BUFFER_TOO_SHORT 0xC0010016
97#define RNDIS_STATUS_INVALID_OID 0xC0010017
98#define RNDIS_STATUS_ADAPTER_REMOVED 0xC0010018
99#define RNDIS_STATUS_UNSUPPORTED_MEDIA 0xC0010019
100#define RNDIS_STATUS_GROUP_ADDRESS_IN_USE 0xC001001A
101#define RNDIS_STATUS_FILE_NOT_FOUND 0xC001001B
102#define RNDIS_STATUS_ERROR_READING_FILE 0xC001001C
103#define RNDIS_STATUS_ALREADY_MAPPED 0xC001001D
104#define RNDIS_STATUS_RESOURCE_CONFLICT 0xC001001E
105#define RNDIS_STATUS_NO_CABLE 0xC001001F
106
107#define RNDIS_STATUS_INVALID_SAP 0xC0010020
108#define RNDIS_STATUS_SAP_IN_USE 0xC0010021
109#define RNDIS_STATUS_INVALID_ADDRESS 0xC0010022
110#define RNDIS_STATUS_VC_NOT_ACTIVATED 0xC0010023
111#define RNDIS_STATUS_DEST_OUT_OF_ORDER 0xC0010024
112#define RNDIS_STATUS_VC_NOT_AVAILABLE 0xC0010025
113#define RNDIS_STATUS_CELLRATE_NOT_AVAILABLE 0xC0010026
114#define RNDIS_STATUS_INCOMPATABLE_QOS 0xC0010027
115#define RNDIS_STATUS_AAL_PARAMS_UNSUPPORTED 0xC0010028
116#define RNDIS_STATUS_NO_ROUTE_TO_DESTINATION 0xC0010029
117
118#define RNDIS_STATUS_TOKEN_RING_OPEN_ERROR 0xC0011000
119
120/* codes for RNDIS_OID_GEN_PHYSICAL_MEDIUM */
121#define RNDIS_PHYSICAL_MEDIUM_UNSPECIFIED 0x00000000
122#define RNDIS_PHYSICAL_MEDIUM_WIRELESS_LAN 0x00000001
123#define RNDIS_PHYSICAL_MEDIUM_CABLE_MODEM 0x00000002
124#define RNDIS_PHYSICAL_MEDIUM_PHONE_LINE 0x00000003
125#define RNDIS_PHYSICAL_MEDIUM_POWER_LINE 0x00000004
126#define RNDIS_PHYSICAL_MEDIUM_DSL 0x00000005
127#define RNDIS_PHYSICAL_MEDIUM_FIBRE_CHANNEL 0x00000006
128#define RNDIS_PHYSICAL_MEDIUM_1394 0x00000007
129#define RNDIS_PHYSICAL_MEDIUM_WIRELESS_WAN 0x00000008
130#define RNDIS_PHYSICAL_MEDIUM_MAX 0x00000009
131
132/* Remote NDIS medium types. */
133#define RNDIS_MEDIUM_UNSPECIFIED 0x00000000
134#define RNDIS_MEDIUM_802_3 0x00000000
135#define RNDIS_MEDIUM_802_5 0x00000001
136#define RNDIS_MEDIUM_FDDI 0x00000002
137#define RNDIS_MEDIUM_WAN 0x00000003
138#define RNDIS_MEDIUM_LOCAL_TALK 0x00000004
139#define RNDIS_MEDIUM_ARCNET_RAW 0x00000006
140#define RNDIS_MEDIUM_ARCNET_878_2 0x00000007
141#define RNDIS_MEDIUM_ATM 0x00000008
142#define RNDIS_MEDIUM_WIRELESS_LAN 0x00000009
143#define RNDIS_MEDIUM_IRDA 0x0000000A
144#define RNDIS_MEDIUM_BPC 0x0000000B
145#define RNDIS_MEDIUM_CO_WAN 0x0000000C
146#define RNDIS_MEDIUM_1394 0x0000000D
147/* Not a real medium, defined as an upper-bound */
148#define RNDIS_MEDIUM_MAX 0x0000000E
149
150/* Remote NDIS medium connection states. */
151#define RNDIS_MEDIA_STATE_CONNECTED 0x00000000
152#define RNDIS_MEDIA_STATE_DISCONNECTED 0x00000001
153
154/* packet filter bits used by RNDIS_OID_GEN_CURRENT_PACKET_FILTER */
155#define RNDIS_PACKET_TYPE_DIRECTED 0x00000001
156#define RNDIS_PACKET_TYPE_MULTICAST 0x00000002
157#define RNDIS_PACKET_TYPE_ALL_MULTICAST 0x00000004
158#define RNDIS_PACKET_TYPE_BROADCAST 0x00000008
159#define RNDIS_PACKET_TYPE_SOURCE_ROUTING 0x00000010
160#define RNDIS_PACKET_TYPE_PROMISCUOUS 0x00000020
161#define RNDIS_PACKET_TYPE_SMT 0x00000040
162#define RNDIS_PACKET_TYPE_ALL_LOCAL 0x00000080
163#define RNDIS_PACKET_TYPE_GROUP 0x00001000
164#define RNDIS_PACKET_TYPE_ALL_FUNCTIONAL 0x00002000
165#define RNDIS_PACKET_TYPE_FUNCTIONAL 0x00004000
166#define RNDIS_PACKET_TYPE_MAC_FRAME 0x00008000
167
168/* RNDIS_OID_GEN_MINIPORT_INFO constants */
169#define RNDIS_MINIPORT_BUS_MASTER 0x00000001
170#define RNDIS_MINIPORT_WDM_DRIVER 0x00000002
171#define RNDIS_MINIPORT_SG_LIST 0x00000004
172#define RNDIS_MINIPORT_SUPPORTS_MEDIA_QUERY 0x00000008
173#define RNDIS_MINIPORT_INDICATES_PACKETS 0x00000010
174#define RNDIS_MINIPORT_IGNORE_PACKET_QUEUE 0x00000020
175#define RNDIS_MINIPORT_IGNORE_REQUEST_QUEUE 0x00000040
176#define RNDIS_MINIPORT_IGNORE_TOKEN_RING_ERRORS 0x00000080
177#define RNDIS_MINIPORT_INTERMEDIATE_DRIVER 0x00000100
178#define RNDIS_MINIPORT_IS_NDIS_5 0x00000200
179#define RNDIS_MINIPORT_IS_CO 0x00000400
180#define RNDIS_MINIPORT_DESERIALIZE 0x00000800
181#define RNDIS_MINIPORT_REQUIRES_MEDIA_POLLING 0x00001000
182#define RNDIS_MINIPORT_SUPPORTS_MEDIA_SENSE 0x00002000
183#define RNDIS_MINIPORT_NETBOOT_CARD 0x00004000
184#define RNDIS_MINIPORT_PM_SUPPORTED 0x00008000
185#define RNDIS_MINIPORT_SUPPORTS_MAC_ADDRESS_OVERWRITE 0x00010000
186#define RNDIS_MINIPORT_USES_SAFE_BUFFER_APIS 0x00020000
187#define RNDIS_MINIPORT_HIDDEN 0x00040000
188#define RNDIS_MINIPORT_SWENUM 0x00080000
189#define RNDIS_MINIPORT_SURPRISE_REMOVE_OK 0x00100000
190#define RNDIS_MINIPORT_NO_HALT_ON_SUSPEND 0x00200000
191#define RNDIS_MINIPORT_HARDWARE_DEVICE 0x00400000
192#define RNDIS_MINIPORT_SUPPORTS_CANCEL_SEND_PACKETS 0x00800000
193#define RNDIS_MINIPORT_64BITS_DMA 0x01000000
194
195#define RNDIS_MAC_OPTION_COPY_LOOKAHEAD_DATA 0x00000001
196#define RNDIS_MAC_OPTION_RECEIVE_SERIALIZED 0x00000002
197#define RNDIS_MAC_OPTION_TRANSFERS_NOT_PEND 0x00000004
198#define RNDIS_MAC_OPTION_NO_LOOPBACK 0x00000008
199#define RNDIS_MAC_OPTION_FULL_DUPLEX 0x00000010
200#define RNDIS_MAC_OPTION_EOTX_INDICATION 0x00000020
201#define RNDIS_MAC_OPTION_8021P_PRIORITY 0x00000040
202#define RNDIS_MAC_OPTION_RESERVED 0x80000000
203
204/* Object Identifiers used by NdisRequest Query/Set Information */
205/* General (Required) Objects */
206#define RNDIS_OID_GEN_SUPPORTED_LIST 0x00010101
207#define RNDIS_OID_GEN_HARDWARE_STATUS 0x00010102
208#define RNDIS_OID_GEN_MEDIA_SUPPORTED 0x00010103
209#define RNDIS_OID_GEN_MEDIA_IN_USE 0x00010104
210#define RNDIS_OID_GEN_MAXIMUM_LOOKAHEAD 0x00010105
211#define RNDIS_OID_GEN_MAXIMUM_FRAME_SIZE 0x00010106
212#define RNDIS_OID_GEN_LINK_SPEED 0x00010107
213#define RNDIS_OID_GEN_TRANSMIT_BUFFER_SPACE 0x00010108
214#define RNDIS_OID_GEN_RECEIVE_BUFFER_SPACE 0x00010109
215#define RNDIS_OID_GEN_TRANSMIT_BLOCK_SIZE 0x0001010A
216#define RNDIS_OID_GEN_RECEIVE_BLOCK_SIZE 0x0001010B
217#define RNDIS_OID_GEN_VENDOR_ID 0x0001010C
218#define RNDIS_OID_GEN_VENDOR_DESCRIPTION 0x0001010D
219#define RNDIS_OID_GEN_CURRENT_PACKET_FILTER 0x0001010E
220#define RNDIS_OID_GEN_CURRENT_LOOKAHEAD 0x0001010F
221#define RNDIS_OID_GEN_DRIVER_VERSION 0x00010110
222#define RNDIS_OID_GEN_MAXIMUM_TOTAL_SIZE 0x00010111
223#define RNDIS_OID_GEN_PROTOCOL_OPTIONS 0x00010112
224#define RNDIS_OID_GEN_MAC_OPTIONS 0x00010113
225#define RNDIS_OID_GEN_MEDIA_CONNECT_STATUS 0x00010114
226#define RNDIS_OID_GEN_MAXIMUM_SEND_PACKETS 0x00010115
227#define RNDIS_OID_GEN_VENDOR_DRIVER_VERSION 0x00010116
228#define RNDIS_OID_GEN_SUPPORTED_GUIDS 0x00010117
229#define RNDIS_OID_GEN_NETWORK_LAYER_ADDRESSES 0x00010118
230#define RNDIS_OID_GEN_TRANSPORT_HEADER_OFFSET 0x00010119
231#define RNDIS_OID_GEN_PHYSICAL_MEDIUM 0x00010202
232#define RNDIS_OID_GEN_MACHINE_NAME 0x0001021A
233#define RNDIS_OID_GEN_RNDIS_CONFIG_PARAMETER 0x0001021B
234#define RNDIS_OID_GEN_VLAN_ID 0x0001021C
235
236/* Optional OIDs */
237#define RNDIS_OID_GEN_MEDIA_CAPABILITIES 0x00010201
238
239/* Required statistics OIDs */
240#define RNDIS_OID_GEN_XMIT_OK 0x00020101
241#define RNDIS_OID_GEN_RCV_OK 0x00020102
242#define RNDIS_OID_GEN_XMIT_ERROR 0x00020103
243#define RNDIS_OID_GEN_RCV_ERROR 0x00020104
244#define RNDIS_OID_GEN_RCV_NO_BUFFER 0x00020105
245
246/* Optional statistics OIDs */
247#define RNDIS_OID_GEN_DIRECTED_BYTES_XMIT 0x00020201
248#define RNDIS_OID_GEN_DIRECTED_FRAMES_XMIT 0x00020202
249#define RNDIS_OID_GEN_MULTICAST_BYTES_XMIT 0x00020203
250#define RNDIS_OID_GEN_MULTICAST_FRAMES_XMIT 0x00020204
251#define RNDIS_OID_GEN_BROADCAST_BYTES_XMIT 0x00020205
252#define RNDIS_OID_GEN_BROADCAST_FRAMES_XMIT 0x00020206
253#define RNDIS_OID_GEN_DIRECTED_BYTES_RCV 0x00020207
254#define RNDIS_OID_GEN_DIRECTED_FRAMES_RCV 0x00020208
255#define RNDIS_OID_GEN_MULTICAST_BYTES_RCV 0x00020209
256#define RNDIS_OID_GEN_MULTICAST_FRAMES_RCV 0x0002020A
257#define RNDIS_OID_GEN_BROADCAST_BYTES_RCV 0x0002020B
258#define RNDIS_OID_GEN_BROADCAST_FRAMES_RCV 0x0002020C
259
260#define RNDIS_OID_GEN_RCV_CRC_ERROR 0x0002020D
261#define RNDIS_OID_GEN_TRANSMIT_QUEUE_LENGTH 0x0002020E
262
263#define RNDIS_OID_GEN_GET_TIME_CAPS 0x0002020F
264#define RNDIS_OID_GEN_GET_NETCARD_TIME 0x00020210
265
266#define RNDIS_OID_GEN_NETCARD_LOAD 0x00020211
267#define RNDIS_OID_GEN_DEVICE_PROFILE 0x00020212
268#define RNDIS_OID_GEN_INIT_TIME_MS 0x00020213
269#define RNDIS_OID_GEN_RESET_COUNTS 0x00020214
270#define RNDIS_OID_GEN_MEDIA_SENSE_COUNTS 0x00020215
271#define RNDIS_OID_GEN_FRIENDLY_NAME 0x00020216
272#define RNDIS_OID_GEN_MINIPORT_INFO 0x00020217
273#define RNDIS_OID_GEN_RESET_VERIFY_PARAMETERS 0x00020218
274
275/* These are connection-oriented general OIDs. */
276/* These replace the above OIDs for connection-oriented media. */
277#define RNDIS_OID_GEN_CO_SUPPORTED_LIST 0x00010101
278#define RNDIS_OID_GEN_CO_HARDWARE_STATUS 0x00010102
279#define RNDIS_OID_GEN_CO_MEDIA_SUPPORTED 0x00010103
280#define RNDIS_OID_GEN_CO_MEDIA_IN_USE 0x00010104
281#define RNDIS_OID_GEN_CO_LINK_SPEED 0x00010105
282#define RNDIS_OID_GEN_CO_VENDOR_ID 0x00010106
283#define RNDIS_OID_GEN_CO_VENDOR_DESCRIPTION 0x00010107
284#define RNDIS_OID_GEN_CO_DRIVER_VERSION 0x00010108
285#define RNDIS_OID_GEN_CO_PROTOCOL_OPTIONS 0x00010109
286#define RNDIS_OID_GEN_CO_MAC_OPTIONS 0x0001010A
287#define RNDIS_OID_GEN_CO_MEDIA_CONNECT_STATUS 0x0001010B
288#define RNDIS_OID_GEN_CO_VENDOR_DRIVER_VERSION 0x0001010C
289#define RNDIS_OID_GEN_CO_MINIMUM_LINK_SPEED 0x0001010D
290
291#define RNDIS_OID_GEN_CO_GET_TIME_CAPS 0x00010201
292#define RNDIS_OID_GEN_CO_GET_NETCARD_TIME 0x00010202
293
294/* These are connection-oriented statistics OIDs. */
295#define RNDIS_OID_GEN_CO_XMIT_PDUS_OK 0x00020101
296#define RNDIS_OID_GEN_CO_RCV_PDUS_OK 0x00020102
297#define RNDIS_OID_GEN_CO_XMIT_PDUS_ERROR 0x00020103
298#define RNDIS_OID_GEN_CO_RCV_PDUS_ERROR 0x00020104
299#define RNDIS_OID_GEN_CO_RCV_PDUS_NO_BUFFER 0x00020105
300
301
302#define RNDIS_OID_GEN_CO_RCV_CRC_ERROR 0x00020201
303#define RNDIS_OID_GEN_CO_TRANSMIT_QUEUE_LENGTH 0x00020202
304#define RNDIS_OID_GEN_CO_BYTES_XMIT 0x00020203
305#define RNDIS_OID_GEN_CO_BYTES_RCV 0x00020204
306#define RNDIS_OID_GEN_CO_BYTES_XMIT_OUTSTANDING 0x00020205
307#define RNDIS_OID_GEN_CO_NETCARD_LOAD 0x00020206
308
309/* These are objects for Connection-oriented media call-managers. */
310#define RNDIS_OID_CO_ADD_PVC 0xFF000001
311#define RNDIS_OID_CO_DELETE_PVC 0xFF000002
312#define RNDIS_OID_CO_GET_CALL_INFORMATION 0xFF000003
313#define RNDIS_OID_CO_ADD_ADDRESS 0xFF000004
314#define RNDIS_OID_CO_DELETE_ADDRESS 0xFF000005
315#define RNDIS_OID_CO_GET_ADDRESSES 0xFF000006
316#define RNDIS_OID_CO_ADDRESS_CHANGE 0xFF000007
317#define RNDIS_OID_CO_SIGNALING_ENABLED 0xFF000008
318#define RNDIS_OID_CO_SIGNALING_DISABLED 0xFF000009
319
320/* 802.3 Objects (Ethernet) */
321#define RNDIS_OID_802_3_PERMANENT_ADDRESS 0x01010101
322#define RNDIS_OID_802_3_CURRENT_ADDRESS 0x01010102
323#define RNDIS_OID_802_3_MULTICAST_LIST 0x01010103
324#define RNDIS_OID_802_3_MAXIMUM_LIST_SIZE 0x01010104
325#define RNDIS_OID_802_3_MAC_OPTIONS 0x01010105
326
327#define RNDIS_802_3_MAC_OPTION_PRIORITY 0x00000001
328
329#define RNDIS_OID_802_3_RCV_ERROR_ALIGNMENT 0x01020101
330#define RNDIS_OID_802_3_XMIT_ONE_COLLISION 0x01020102
331#define RNDIS_OID_802_3_XMIT_MORE_COLLISIONS 0x01020103
332
333#define RNDIS_OID_802_3_XMIT_DEFERRED 0x01020201
334#define RNDIS_OID_802_3_XMIT_MAX_COLLISIONS 0x01020202
335#define RNDIS_OID_802_3_RCV_OVERRUN 0x01020203
336#define RNDIS_OID_802_3_XMIT_UNDERRUN 0x01020204
337#define RNDIS_OID_802_3_XMIT_HEARTBEAT_FAILURE 0x01020205
338#define RNDIS_OID_802_3_XMIT_TIMES_CRS_LOST 0x01020206
339#define RNDIS_OID_802_3_XMIT_LATE_COLLISIONS 0x01020207
340
341#define RNDIS_OID_802_11_BSSID 0x0d010101
342#define RNDIS_OID_802_11_SSID 0x0d010102
343#define RNDIS_OID_802_11_INFRASTRUCTURE_MODE 0x0d010108
344#define RNDIS_OID_802_11_ADD_WEP 0x0d010113
345#define RNDIS_OID_802_11_REMOVE_WEP 0x0d010114
346#define RNDIS_OID_802_11_DISASSOCIATE 0x0d010115
347#define RNDIS_OID_802_11_AUTHENTICATION_MODE 0x0d010118
348#define RNDIS_OID_802_11_PRIVACY_FILTER 0x0d010119
349#define RNDIS_OID_802_11_BSSID_LIST_SCAN 0x0d01011a
350#define RNDIS_OID_802_11_ENCRYPTION_STATUS 0x0d01011b
351#define RNDIS_OID_802_11_ADD_KEY 0x0d01011d
352#define RNDIS_OID_802_11_REMOVE_KEY 0x0d01011e
353#define RNDIS_OID_802_11_ASSOCIATION_INFORMATION 0x0d01011f
354#define RNDIS_OID_802_11_CAPABILITY 0x0d010122
355#define RNDIS_OID_802_11_PMKID 0x0d010123
356#define RNDIS_OID_802_11_NETWORK_TYPES_SUPPORTED 0x0d010203
357#define RNDIS_OID_802_11_NETWORK_TYPE_IN_USE 0x0d010204
358#define RNDIS_OID_802_11_TX_POWER_LEVEL 0x0d010205
359#define RNDIS_OID_802_11_RSSI 0x0d010206
360#define RNDIS_OID_802_11_RSSI_TRIGGER 0x0d010207
361#define RNDIS_OID_802_11_FRAGMENTATION_THRESHOLD 0x0d010209
362#define RNDIS_OID_802_11_RTS_THRESHOLD 0x0d01020a
363#define RNDIS_OID_802_11_SUPPORTED_RATES 0x0d01020e
364#define RNDIS_OID_802_11_CONFIGURATION 0x0d010211
365#define RNDIS_OID_802_11_POWER_MODE 0x0d010216
366#define RNDIS_OID_802_11_BSSID_LIST 0x0d010217
367
368/* Plug and Play capabilities */
369#define RNDIS_OID_PNP_CAPABILITIES 0xFD010100
370#define RNDIS_OID_PNP_SET_POWER 0xFD010101
371#define RNDIS_OID_PNP_QUERY_POWER 0xFD010102
372#define RNDIS_OID_PNP_ADD_WAKE_UP_PATTERN 0xFD010103
373#define RNDIS_OID_PNP_REMOVE_WAKE_UP_PATTERN 0xFD010104
374#define RNDIS_OID_PNP_ENABLE_WAKE_UP 0xFD010106
375
376/* RNDIS_PNP_CAPABILITIES.Flags constants */
377#define RNDIS_DEVICE_WAKE_UP_ENABLE 0x00000001
378#define RNDIS_DEVICE_WAKE_ON_PATTERN_MATCH_ENABLE 0x00000002
379#define RNDIS_DEVICE_WAKE_ON_MAGIC_PACKET_ENABLE 0x00000004
380
381#define REMOTE_CONDIS_MP_CREATE_VC_MSG 0x00008001
382#define REMOTE_CONDIS_MP_DELETE_VC_MSG 0x00008002
383#define REMOTE_CONDIS_MP_ACTIVATE_VC_MSG 0x00008005
384#define REMOTE_CONDIS_MP_DEACTIVATE_VC_MSG 0x00008006
385#define REMOTE_CONDIS_INDICATE_STATUS_MSG 0x00008007
386
387#define REMOTE_CONDIS_MP_CREATE_VC_CMPLT 0x80008001
388#define REMOTE_CONDIS_MP_DELETE_VC_CMPLT 0x80008002
389#define REMOTE_CONDIS_MP_ACTIVATE_VC_CMPLT 0x80008005
390#define REMOTE_CONDIS_MP_DEACTIVATE_VC_CMPLT 0x80008006
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index 577592ea0ea0..2c1de8982c85 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -801,6 +801,10 @@ rtattr_failure:
801 return table; 801 return table;
802} 802}
803 803
804extern int ndo_dflt_fdb_dump(struct sk_buff *skb,
805 struct netlink_callback *cb,
806 struct net_device *dev,
807 int idx);
804#endif /* __KERNEL__ */ 808#endif /* __KERNEL__ */
805 809
806 810
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 81a173c0897d..f45c0b280b5d 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -90,6 +90,7 @@ struct sched_param {
90#include <linux/latencytop.h> 90#include <linux/latencytop.h>
91#include <linux/cred.h> 91#include <linux/cred.h>
92#include <linux/llist.h> 92#include <linux/llist.h>
93#include <linux/uidgid.h>
93 94
94#include <asm/processor.h> 95#include <asm/processor.h>
95 96
@@ -728,8 +729,7 @@ struct user_struct {
728 729
729 /* Hash table maintenance information */ 730 /* Hash table maintenance information */
730 struct hlist_node uidhash_node; 731 struct hlist_node uidhash_node;
731 uid_t uid; 732 kuid_t uid;
732 struct user_namespace *user_ns;
733 733
734#ifdef CONFIG_PERF_EVENTS 734#ifdef CONFIG_PERF_EVENTS
735 atomic_long_t locked_vm; 735 atomic_long_t locked_vm;
@@ -738,7 +738,7 @@ struct user_struct {
738 738
739extern int uids_sysfs_init(void); 739extern int uids_sysfs_init(void);
740 740
741extern struct user_struct *find_user(uid_t); 741extern struct user_struct *find_user(kuid_t);
742 742
743extern struct user_struct root_user; 743extern struct user_struct root_user;
744#define INIT_USER (&root_user) 744#define INIT_USER (&root_user)
@@ -855,61 +855,14 @@ enum cpu_idle_type {
855#define SD_WAKE_AFFINE 0x0020 /* Wake task to waking CPU */ 855#define SD_WAKE_AFFINE 0x0020 /* Wake task to waking CPU */
856#define SD_PREFER_LOCAL 0x0040 /* Prefer to keep tasks local to this domain */ 856#define SD_PREFER_LOCAL 0x0040 /* Prefer to keep tasks local to this domain */
857#define SD_SHARE_CPUPOWER 0x0080 /* Domain members share cpu power */ 857#define SD_SHARE_CPUPOWER 0x0080 /* Domain members share cpu power */
858#define SD_POWERSAVINGS_BALANCE 0x0100 /* Balance for power savings */
859#define SD_SHARE_PKG_RESOURCES 0x0200 /* Domain members share cpu pkg resources */ 858#define SD_SHARE_PKG_RESOURCES 0x0200 /* Domain members share cpu pkg resources */
860#define SD_SERIALIZE 0x0400 /* Only a single load balancing instance */ 859#define SD_SERIALIZE 0x0400 /* Only a single load balancing instance */
861#define SD_ASYM_PACKING 0x0800 /* Place busy groups earlier in the domain */ 860#define SD_ASYM_PACKING 0x0800 /* Place busy groups earlier in the domain */
862#define SD_PREFER_SIBLING 0x1000 /* Prefer to place tasks in a sibling domain */ 861#define SD_PREFER_SIBLING 0x1000 /* Prefer to place tasks in a sibling domain */
863#define SD_OVERLAP 0x2000 /* sched_domains of this level overlap */ 862#define SD_OVERLAP 0x2000 /* sched_domains of this level overlap */
864 863
865enum powersavings_balance_level {
866 POWERSAVINGS_BALANCE_NONE = 0, /* No power saving load balance */
867 POWERSAVINGS_BALANCE_BASIC, /* Fill one thread/core/package
868 * first for long running threads
869 */
870 POWERSAVINGS_BALANCE_WAKEUP, /* Also bias task wakeups to semi-idle
871 * cpu package for power savings
872 */
873 MAX_POWERSAVINGS_BALANCE_LEVELS
874};
875
876extern int sched_mc_power_savings, sched_smt_power_savings;
877
878static inline int sd_balance_for_mc_power(void)
879{
880 if (sched_smt_power_savings)
881 return SD_POWERSAVINGS_BALANCE;
882
883 if (!sched_mc_power_savings)
884 return SD_PREFER_SIBLING;
885
886 return 0;
887}
888
889static inline int sd_balance_for_package_power(void)
890{
891 if (sched_mc_power_savings | sched_smt_power_savings)
892 return SD_POWERSAVINGS_BALANCE;
893
894 return SD_PREFER_SIBLING;
895}
896
897extern int __weak arch_sd_sibiling_asym_packing(void); 864extern int __weak arch_sd_sibiling_asym_packing(void);
898 865
899/*
900 * Optimise SD flags for power savings:
901 * SD_BALANCE_NEWIDLE helps aggressive task consolidation and power savings.
902 * Keep default SD flags if sched_{smt,mc}_power_saving=0
903 */
904
905static inline int sd_power_saving_flags(void)
906{
907 if (sched_mc_power_savings | sched_smt_power_savings)
908 return SD_BALANCE_NEWIDLE;
909
910 return 0;
911}
912
913struct sched_group_power { 866struct sched_group_power {
914 atomic_t ref; 867 atomic_t ref;
915 /* 868 /*
@@ -1341,6 +1294,8 @@ struct task_struct {
1341 * execve */ 1294 * execve */
1342 unsigned in_iowait:1; 1295 unsigned in_iowait:1;
1343 1296
1297 /* task may not gain privileges */
1298 unsigned no_new_privs:1;
1344 1299
1345 /* Revert to default priority/policy when forking */ 1300 /* Revert to default priority/policy when forking */
1346 unsigned sched_reset_on_fork:1; 1301 unsigned sched_reset_on_fork:1;
@@ -1450,7 +1405,7 @@ struct task_struct {
1450 uid_t loginuid; 1405 uid_t loginuid;
1451 unsigned int sessionid; 1406 unsigned int sessionid;
1452#endif 1407#endif
1453 seccomp_t seccomp; 1408 struct seccomp seccomp;
1454 1409
1455/* Thread group tracking */ 1410/* Thread group tracking */
1456 u32 parent_exec_id; 1411 u32 parent_exec_id;
@@ -1617,6 +1572,10 @@ struct task_struct {
1617#ifdef CONFIG_HAVE_HW_BREAKPOINT 1572#ifdef CONFIG_HAVE_HW_BREAKPOINT
1618 atomic_t ptrace_bp_refcnt; 1573 atomic_t ptrace_bp_refcnt;
1619#endif 1574#endif
1575#ifdef CONFIG_UPROBES
1576 struct uprobe_task *utask;
1577 int uprobe_srcu_id;
1578#endif
1620}; 1579};
1621 1580
1622/* Future-safe accessor for struct task_struct's cpus_allowed. */ 1581/* Future-safe accessor for struct task_struct's cpus_allowed. */
@@ -1905,12 +1864,22 @@ static inline void rcu_copy_process(struct task_struct *p)
1905 INIT_LIST_HEAD(&p->rcu_node_entry); 1864 INIT_LIST_HEAD(&p->rcu_node_entry);
1906} 1865}
1907 1866
1867static inline void rcu_switch_from(struct task_struct *prev)
1868{
1869 if (prev->rcu_read_lock_nesting != 0)
1870 rcu_preempt_note_context_switch();
1871}
1872
1908#else 1873#else
1909 1874
1910static inline void rcu_copy_process(struct task_struct *p) 1875static inline void rcu_copy_process(struct task_struct *p)
1911{ 1876{
1912} 1877}
1913 1878
1879static inline void rcu_switch_from(struct task_struct *prev)
1880{
1881}
1882
1914#endif 1883#endif
1915 1884
1916#ifdef CONFIG_SMP 1885#ifdef CONFIG_SMP
@@ -1950,7 +1919,7 @@ static inline int set_cpus_allowed(struct task_struct *p, cpumask_t new_mask)
1950 */ 1919 */
1951extern unsigned long long notrace sched_clock(void); 1920extern unsigned long long notrace sched_clock(void);
1952/* 1921/*
1953 * See the comment in kernel/sched_clock.c 1922 * See the comment in kernel/sched/clock.c
1954 */ 1923 */
1955extern u64 cpu_clock(int cpu); 1924extern u64 cpu_clock(int cpu);
1956extern u64 local_clock(void); 1925extern u64 local_clock(void);
@@ -2177,14 +2146,13 @@ extern struct task_struct *find_task_by_pid_ns(pid_t nr,
2177extern void __set_special_pids(struct pid *pid); 2146extern void __set_special_pids(struct pid *pid);
2178 2147
2179/* per-UID process charging. */ 2148/* per-UID process charging. */
2180extern struct user_struct * alloc_uid(struct user_namespace *, uid_t); 2149extern struct user_struct * alloc_uid(kuid_t);
2181static inline struct user_struct *get_uid(struct user_struct *u) 2150static inline struct user_struct *get_uid(struct user_struct *u)
2182{ 2151{
2183 atomic_inc(&u->__count); 2152 atomic_inc(&u->__count);
2184 return u; 2153 return u;
2185} 2154}
2186extern void free_uid(struct user_struct *); 2155extern void free_uid(struct user_struct *);
2187extern void release_uids(struct user_namespace *ns);
2188 2156
2189#include <asm/current.h> 2157#include <asm/current.h>
2190 2158
diff --git a/include/linux/seccomp.h b/include/linux/seccomp.h
index cc7a4e9cc7ad..84f6320da50f 100644
--- a/include/linux/seccomp.h
+++ b/include/linux/seccomp.h
@@ -1,25 +1,90 @@
1#ifndef _LINUX_SECCOMP_H 1#ifndef _LINUX_SECCOMP_H
2#define _LINUX_SECCOMP_H 2#define _LINUX_SECCOMP_H
3 3
4 4#include <linux/compiler.h>
5#include <linux/types.h>
6
7
8/* Valid values for seccomp.mode and prctl(PR_SET_SECCOMP, <mode>) */
9#define SECCOMP_MODE_DISABLED 0 /* seccomp is not in use. */
10#define SECCOMP_MODE_STRICT 1 /* uses hard-coded filter. */
11#define SECCOMP_MODE_FILTER 2 /* uses user-supplied filter. */
12
13/*
14 * All BPF programs must return a 32-bit value.
15 * The bottom 16-bits are for optional return data.
16 * The upper 16-bits are ordered from least permissive values to most.
17 *
18 * The ordering ensures that a min_t() over composed return values always
19 * selects the least permissive choice.
20 */
21#define SECCOMP_RET_KILL 0x00000000U /* kill the task immediately */
22#define SECCOMP_RET_TRAP 0x00030000U /* disallow and force a SIGSYS */
23#define SECCOMP_RET_ERRNO 0x00050000U /* returns an errno */
24#define SECCOMP_RET_TRACE 0x7ff00000U /* pass to a tracer or disallow */
25#define SECCOMP_RET_ALLOW 0x7fff0000U /* allow */
26
27/* Masks for the return value sections. */
28#define SECCOMP_RET_ACTION 0x7fff0000U
29#define SECCOMP_RET_DATA 0x0000ffffU
30
31/**
32 * struct seccomp_data - the format the BPF program executes over.
33 * @nr: the system call number
34 * @arch: indicates system call convention as an AUDIT_ARCH_* value
35 * as defined in <linux/audit.h>.
36 * @instruction_pointer: at the time of the system call.
37 * @args: up to 6 system call arguments always stored as 64-bit values
38 * regardless of the architecture.
39 */
40struct seccomp_data {
41 int nr;
42 __u32 arch;
43 __u64 instruction_pointer;
44 __u64 args[6];
45};
46
47#ifdef __KERNEL__
5#ifdef CONFIG_SECCOMP 48#ifdef CONFIG_SECCOMP
6 49
7#include <linux/thread_info.h> 50#include <linux/thread_info.h>
8#include <asm/seccomp.h> 51#include <asm/seccomp.h>
9 52
10typedef struct { int mode; } seccomp_t; 53struct seccomp_filter;
11 54/**
12extern void __secure_computing(int); 55 * struct seccomp - the state of a seccomp'ed process
13static inline void secure_computing(int this_syscall) 56 *
57 * @mode: indicates one of the valid values above for controlled
58 * system calls available to a process.
59 * @filter: The metadata and ruleset for determining what system calls
60 * are allowed for a task.
61 *
62 * @filter must only be accessed from the context of current as there
63 * is no locking.
64 */
65struct seccomp {
66 int mode;
67 struct seccomp_filter *filter;
68};
69
70extern int __secure_computing(int);
71static inline int secure_computing(int this_syscall)
14{ 72{
15 if (unlikely(test_thread_flag(TIF_SECCOMP))) 73 if (unlikely(test_thread_flag(TIF_SECCOMP)))
16 __secure_computing(this_syscall); 74 return __secure_computing(this_syscall);
75 return 0;
76}
77
78/* A wrapper for architectures supporting only SECCOMP_MODE_STRICT. */
79static inline void secure_computing_strict(int this_syscall)
80{
81 BUG_ON(secure_computing(this_syscall) != 0);
17} 82}
18 83
19extern long prctl_get_seccomp(void); 84extern long prctl_get_seccomp(void);
20extern long prctl_set_seccomp(unsigned long); 85extern long prctl_set_seccomp(unsigned long, char __user *);
21 86
22static inline int seccomp_mode(seccomp_t *s) 87static inline int seccomp_mode(struct seccomp *s)
23{ 88{
24 return s->mode; 89 return s->mode;
25} 90}
@@ -28,25 +93,41 @@ static inline int seccomp_mode(seccomp_t *s)
28 93
29#include <linux/errno.h> 94#include <linux/errno.h>
30 95
31typedef struct { } seccomp_t; 96struct seccomp { };
97struct seccomp_filter { };
32 98
33#define secure_computing(x) do { } while (0) 99static inline int secure_computing(int this_syscall) { return 0; }
100static inline void secure_computing_strict(int this_syscall) { return; }
34 101
35static inline long prctl_get_seccomp(void) 102static inline long prctl_get_seccomp(void)
36{ 103{
37 return -EINVAL; 104 return -EINVAL;
38} 105}
39 106
40static inline long prctl_set_seccomp(unsigned long arg2) 107static inline long prctl_set_seccomp(unsigned long arg2, char __user *arg3)
41{ 108{
42 return -EINVAL; 109 return -EINVAL;
43} 110}
44 111
45static inline int seccomp_mode(seccomp_t *s) 112static inline int seccomp_mode(struct seccomp *s)
46{ 113{
47 return 0; 114 return 0;
48} 115}
49
50#endif /* CONFIG_SECCOMP */ 116#endif /* CONFIG_SECCOMP */
51 117
118#ifdef CONFIG_SECCOMP_FILTER
119extern void put_seccomp_filter(struct task_struct *tsk);
120extern void get_seccomp_filter(struct task_struct *tsk);
121extern u32 seccomp_bpf_load(int off);
122#else /* CONFIG_SECCOMP_FILTER */
123static inline void put_seccomp_filter(struct task_struct *tsk)
124{
125 return;
126}
127static inline void get_seccomp_filter(struct task_struct *tsk)
128{
129 return;
130}
131#endif /* CONFIG_SECCOMP_FILTER */
132#endif /* __KERNEL__ */
52#endif /* _LINUX_SECCOMP_H */ 133#endif /* _LINUX_SECCOMP_H */
diff --git a/include/linux/security.h b/include/linux/security.h
index 673afbb8238a..ab0e091ce5fa 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -144,6 +144,7 @@ struct request_sock;
144#define LSM_UNSAFE_SHARE 1 144#define LSM_UNSAFE_SHARE 1
145#define LSM_UNSAFE_PTRACE 2 145#define LSM_UNSAFE_PTRACE 2
146#define LSM_UNSAFE_PTRACE_CAP 4 146#define LSM_UNSAFE_PTRACE_CAP 4
147#define LSM_UNSAFE_NO_NEW_PRIVS 8
147 148
148#ifdef CONFIG_MMU 149#ifdef CONFIG_MMU
149extern int mmap_min_addr_handler(struct ctl_table *table, int write, 150extern int mmap_min_addr_handler(struct ctl_table *table, int write,
@@ -639,10 +640,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
639 * to receive an open file descriptor via socket IPC. 640 * to receive an open file descriptor via socket IPC.
640 * @file contains the file structure being received. 641 * @file contains the file structure being received.
641 * Return 0 if permission is granted. 642 * Return 0 if permission is granted.
642 * 643 * @file_open
643 * Security hook for dentry
644 *
645 * @dentry_open
646 * Save open-time permission checking state for later use upon 644 * Save open-time permission checking state for later use upon
647 * file_permission, and recheck access if anything has changed 645 * file_permission, and recheck access if anything has changed
648 * since inode_permission. 646 * since inode_permission.
@@ -1497,7 +1495,7 @@ struct security_operations {
1497 int (*file_send_sigiotask) (struct task_struct *tsk, 1495 int (*file_send_sigiotask) (struct task_struct *tsk,
1498 struct fown_struct *fown, int sig); 1496 struct fown_struct *fown, int sig);
1499 int (*file_receive) (struct file *file); 1497 int (*file_receive) (struct file *file);
1500 int (*dentry_open) (struct file *file, const struct cred *cred); 1498 int (*file_open) (struct file *file, const struct cred *cred);
1501 1499
1502 int (*task_create) (unsigned long clone_flags); 1500 int (*task_create) (unsigned long clone_flags);
1503 void (*task_free) (struct task_struct *task); 1501 void (*task_free) (struct task_struct *task);
@@ -1756,7 +1754,7 @@ int security_file_set_fowner(struct file *file);
1756int security_file_send_sigiotask(struct task_struct *tsk, 1754int security_file_send_sigiotask(struct task_struct *tsk,
1757 struct fown_struct *fown, int sig); 1755 struct fown_struct *fown, int sig);
1758int security_file_receive(struct file *file); 1756int security_file_receive(struct file *file);
1759int security_dentry_open(struct file *file, const struct cred *cred); 1757int security_file_open(struct file *file, const struct cred *cred);
1760int security_task_create(unsigned long clone_flags); 1758int security_task_create(unsigned long clone_flags);
1761void security_task_free(struct task_struct *task); 1759void security_task_free(struct task_struct *task);
1762int security_cred_alloc_blank(struct cred *cred, gfp_t gfp); 1760int security_cred_alloc_blank(struct cred *cred, gfp_t gfp);
@@ -2227,8 +2225,8 @@ static inline int security_file_receive(struct file *file)
2227 return 0; 2225 return 0;
2228} 2226}
2229 2227
2230static inline int security_dentry_open(struct file *file, 2228static inline int security_file_open(struct file *file,
2231 const struct cred *cred) 2229 const struct cred *cred)
2232{ 2230{
2233 return 0; 2231 return 0;
2234} 2232}
diff --git a/include/linux/serial.h b/include/linux/serial.h
index 441980ecc4e5..90e9f981358a 100644
--- a/include/linux/serial.h
+++ b/include/linux/serial.h
@@ -130,7 +130,6 @@ struct serial_uart_config {
130#define ASYNCB_CHECK_CD 25 /* i.e., CLOCAL */ 130#define ASYNCB_CHECK_CD 25 /* i.e., CLOCAL */
131#define ASYNCB_SHARE_IRQ 24 /* for multifunction cards, no longer used */ 131#define ASYNCB_SHARE_IRQ 24 /* for multifunction cards, no longer used */
132#define ASYNCB_CONS_FLOW 23 /* flow control for console */ 132#define ASYNCB_CONS_FLOW 23 /* flow control for console */
133#define ASYNCB_BOOT_ONLYMCA 22 /* Probe only if MCA bus */
134#define ASYNCB_FIRST_KERNEL 22 133#define ASYNCB_FIRST_KERNEL 22
135 134
136#define ASYNC_HUP_NOTIFY (1U << ASYNCB_HUP_NOTIFY) 135#define ASYNC_HUP_NOTIFY (1U << ASYNCB_HUP_NOTIFY)
@@ -166,7 +165,6 @@ struct serial_uart_config {
166#define ASYNC_CHECK_CD (1U << ASYNCB_CHECK_CD) 165#define ASYNC_CHECK_CD (1U << ASYNCB_CHECK_CD)
167#define ASYNC_SHARE_IRQ (1U << ASYNCB_SHARE_IRQ) 166#define ASYNC_SHARE_IRQ (1U << ASYNCB_SHARE_IRQ)
168#define ASYNC_CONS_FLOW (1U << ASYNCB_CONS_FLOW) 167#define ASYNC_CONS_FLOW (1U << ASYNCB_CONS_FLOW)
169#define ASYNC_BOOT_ONLYMCA (1U << ASYNCB_BOOT_ONLYMCA)
170#define ASYNC_INTERNAL_FLAGS (~((1U << ASYNCB_FIRST_KERNEL) - 1)) 168#define ASYNC_INTERNAL_FLAGS (~((1U << ASYNCB_FIRST_KERNEL) - 1))
171 169
172/* 170/*
diff --git a/include/linux/serial_8250.h b/include/linux/serial_8250.h
index 8f012f8ac8e9..a416e92012ef 100644
--- a/include/linux/serial_8250.h
+++ b/include/linux/serial_8250.h
@@ -38,6 +38,7 @@ struct plat_serial8250_port {
38 int (*handle_irq)(struct uart_port *); 38 int (*handle_irq)(struct uart_port *);
39 void (*pm)(struct uart_port *, unsigned int state, 39 void (*pm)(struct uart_port *, unsigned int state,
40 unsigned old); 40 unsigned old);
41 void (*handle_break)(struct uart_port *);
41}; 42};
42 43
43/* 44/*
@@ -54,7 +55,6 @@ enum {
54 PLAT8250_DEV_BOCA, 55 PLAT8250_DEV_BOCA,
55 PLAT8250_DEV_EXAR_ST16C554, 56 PLAT8250_DEV_EXAR_ST16C554,
56 PLAT8250_DEV_HUB6, 57 PLAT8250_DEV_HUB6,
57 PLAT8250_DEV_MCA,
58 PLAT8250_DEV_AU1X00, 58 PLAT8250_DEV_AU1X00,
59 PLAT8250_DEV_SM501, 59 PLAT8250_DEV_SM501,
60}; 60};
@@ -68,6 +68,7 @@ enum {
68struct uart_port; 68struct uart_port;
69struct uart_8250_port; 69struct uart_8250_port;
70 70
71int serial8250_register_8250_port(struct uart_8250_port *);
71int serial8250_register_port(struct uart_port *); 72int serial8250_register_port(struct uart_port *);
72void serial8250_unregister_port(int line); 73void serial8250_unregister_port(int line);
73void serial8250_suspend_port(int line); 74void serial8250_suspend_port(int line);
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index 2db407a40051..65db9928e15f 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -310,6 +310,7 @@ struct uart_port {
310 int (*handle_irq)(struct uart_port *); 310 int (*handle_irq)(struct uart_port *);
311 void (*pm)(struct uart_port *, unsigned int state, 311 void (*pm)(struct uart_port *, unsigned int state,
312 unsigned int old); 312 unsigned int old);
313 void (*handle_break)(struct uart_port *);
313 unsigned int irq; /* irq number */ 314 unsigned int irq; /* irq number */
314 unsigned long irqflags; /* irq flags */ 315 unsigned long irqflags; /* irq flags */
315 unsigned int uartclk; /* base uart clock */ 316 unsigned int uartclk; /* base uart clock */
@@ -533,6 +534,10 @@ uart_handle_sysrq_char(struct uart_port *port, unsigned int ch)
533static inline int uart_handle_break(struct uart_port *port) 534static inline int uart_handle_break(struct uart_port *port)
534{ 535{
535 struct uart_state *state = port->state; 536 struct uart_state *state = port->state;
537
538 if (port->handle_break)
539 port->handle_break(port);
540
536#ifdef SUPPORT_SYSRQ 541#ifdef SUPPORT_SYSRQ
537 if (port->cons && port->cons->index == port->line) { 542 if (port->cons && port->cons->index == port->line) {
538 if (!port->sysrq) { 543 if (!port->sysrq) {
diff --git a/include/linux/serial_sci.h b/include/linux/serial_sci.h
index 78779074f6e8..eb763adf9815 100644
--- a/include/linux/serial_sci.h
+++ b/include/linux/serial_sci.h
@@ -52,6 +52,8 @@ enum {
52/* SCSPTR, optional */ 52/* SCSPTR, optional */
53#define SCSPTR_RTSIO (1 << 7) 53#define SCSPTR_RTSIO (1 << 7)
54#define SCSPTR_CTSIO (1 << 5) 54#define SCSPTR_CTSIO (1 << 5)
55#define SCSPTR_SPB2IO (1 << 1)
56#define SCSPTR_SPB2DT (1 << 0)
55 57
56/* Offsets into the sci_port->irqs array */ 58/* Offsets into the sci_port->irqs array */
57enum { 59enum {
diff --git a/include/linux/serio.h b/include/linux/serio.h
index ca82861b0e46..6d6cfd3e94a3 100644
--- a/include/linux/serio.h
+++ b/include/linux/serio.h
@@ -96,6 +96,19 @@ int __must_check __serio_register_driver(struct serio_driver *drv,
96 96
97void serio_unregister_driver(struct serio_driver *drv); 97void serio_unregister_driver(struct serio_driver *drv);
98 98
99/**
100 * module_serio_driver() - Helper macro for registering a serio driver
101 * @__serio_driver: serio_driver struct
102 *
103 * Helper macro for serio drivers which do not do anything special in
104 * module init/exit. This eliminates a lot of boilerplate. Each module
105 * may only use this macro once, and calling it replaces module_init()
106 * and module_exit().
107 */
108#define module_serio_driver(__serio_driver) \
109 module_driver(__serio_driver, serio_register_driver, \
110 serio_unregister_driver)
111
99static inline int serio_write(struct serio *serio, unsigned char data) 112static inline int serio_write(struct serio *serio, unsigned char data)
100{ 113{
101 if (serio->write) 114 if (serio->write)
diff --git a/include/linux/sh_clk.h b/include/linux/sh_clk.h
index 0a9d8f2ac519..c513b73cd7cb 100644
--- a/include/linux/sh_clk.h
+++ b/include/linux/sh_clk.h
@@ -59,7 +59,15 @@ struct clk {
59 unsigned int nr_freqs; 59 unsigned int nr_freqs;
60}; 60};
61 61
62#define CLK_ENABLE_ON_INIT (1 << 0) 62#define CLK_ENABLE_ON_INIT BIT(0)
63
64#define CLK_ENABLE_REG_32BIT BIT(1) /* default access size */
65#define CLK_ENABLE_REG_16BIT BIT(2)
66#define CLK_ENABLE_REG_8BIT BIT(3)
67
68#define CLK_ENABLE_REG_MASK (CLK_ENABLE_REG_32BIT | \
69 CLK_ENABLE_REG_16BIT | \
70 CLK_ENABLE_REG_8BIT)
63 71
64/* drivers/sh/clk.c */ 72/* drivers/sh/clk.c */
65unsigned long followparent_recalc(struct clk *); 73unsigned long followparent_recalc(struct clk *);
@@ -102,7 +110,7 @@ long clk_round_parent(struct clk *clk, unsigned long target,
102 unsigned long *best_freq, unsigned long *parent_freq, 110 unsigned long *best_freq, unsigned long *parent_freq,
103 unsigned int div_min, unsigned int div_max); 111 unsigned int div_min, unsigned int div_max);
104 112
105#define SH_CLK_MSTP32(_parent, _enable_reg, _enable_bit, _flags) \ 113#define SH_CLK_MSTP(_parent, _enable_reg, _enable_bit, _flags) \
106{ \ 114{ \
107 .parent = _parent, \ 115 .parent = _parent, \
108 .enable_reg = (void __iomem *)_enable_reg, \ 116 .enable_reg = (void __iomem *)_enable_reg, \
@@ -110,7 +118,27 @@ long clk_round_parent(struct clk *clk, unsigned long target,
110 .flags = _flags, \ 118 .flags = _flags, \
111} 119}
112 120
113int sh_clk_mstp32_register(struct clk *clks, int nr); 121#define SH_CLK_MSTP32(_p, _r, _b, _f) \
122 SH_CLK_MSTP(_p, _r, _b, _f | CLK_ENABLE_REG_32BIT)
123
124#define SH_CLK_MSTP16(_p, _r, _b, _f) \
125 SH_CLK_MSTP(_p, _r, _b, _f | CLK_ENABLE_REG_16BIT)
126
127#define SH_CLK_MSTP8(_p, _r, _b, _f) \
128 SH_CLK_MSTP(_p, _r, _b, _f | CLK_ENABLE_REG_8BIT)
129
130int sh_clk_mstp_register(struct clk *clks, int nr);
131
132/*
133 * MSTP registration never really cared about access size, despite the
134 * original enable/disable pairs assuming a 32-bit access. Clocks are
135 * responsible for defining their access sizes either directly or via the
136 * clock definition wrappers.
137 */
138static inline int __deprecated sh_clk_mstp32_register(struct clk *clks, int nr)
139{
140 return sh_clk_mstp_register(clks, nr);
141}
114 142
115#define SH_CLK_DIV4(_parent, _reg, _shift, _div_bitmap, _flags) \ 143#define SH_CLK_DIV4(_parent, _reg, _shift, _div_bitmap, _flags) \
116{ \ 144{ \
diff --git a/include/linux/sh_intc.h b/include/linux/sh_intc.h
index 6aed0805927f..32383285da68 100644
--- a/include/linux/sh_intc.h
+++ b/include/linux/sh_intc.h
@@ -133,7 +133,6 @@ struct intc_desc symbol __initdata = { \
133} 133}
134 134
135int register_intc_controller(struct intc_desc *desc); 135int register_intc_controller(struct intc_desc *desc);
136void reserve_intc_vectors(struct intc_vect *vectors, unsigned int nr_vecs);
137int intc_set_priority(unsigned int irq, unsigned int prio); 136int intc_set_priority(unsigned int irq, unsigned int prio);
138int intc_irq_lookup(const char *chipname, intc_enum enum_id); 137int intc_irq_lookup(const char *chipname, intc_enum enum_id);
139void intc_finalize(void); 138void intc_finalize(void);
diff --git a/include/linux/shmem_fs.h b/include/linux/shmem_fs.h
index 79ab2555b3b0..bef2cf00b3be 100644
--- a/include/linux/shmem_fs.h
+++ b/include/linux/shmem_fs.h
@@ -28,8 +28,8 @@ struct shmem_sb_info {
28 unsigned long max_inodes; /* How many inodes are allowed */ 28 unsigned long max_inodes; /* How many inodes are allowed */
29 unsigned long free_inodes; /* How many are left for allocation */ 29 unsigned long free_inodes; /* How many are left for allocation */
30 spinlock_t stat_lock; /* Serialize shmem_sb_info changes */ 30 spinlock_t stat_lock; /* Serialize shmem_sb_info changes */
31 uid_t uid; /* Mount uid for root directory */ 31 kuid_t uid; /* Mount uid for root directory */
32 gid_t gid; /* Mount gid for root directory */ 32 kgid_t gid; /* Mount gid for root directory */
33 umode_t mode; /* Mount mode for root directory */ 33 umode_t mode; /* Mount mode for root directory */
34 struct mempolicy *mpol; /* default memory policy for mappings */ 34 struct mempolicy *mpol; /* default memory policy for mappings */
35}; 35};
diff --git a/include/linux/signal.h b/include/linux/signal.h
index 7987ce74874b..17046cc484bc 100644
--- a/include/linux/signal.h
+++ b/include/linux/signal.h
@@ -252,6 +252,7 @@ extern int do_sigtimedwait(const sigset_t *, siginfo_t *,
252extern int sigprocmask(int, sigset_t *, sigset_t *); 252extern int sigprocmask(int, sigset_t *, sigset_t *);
253extern void set_current_blocked(const sigset_t *); 253extern void set_current_blocked(const sigset_t *);
254extern int show_unhandled_signals; 254extern int show_unhandled_signals;
255extern int sigsuspend(sigset_t *);
255 256
256extern int get_signal_to_deliver(siginfo_t *info, struct k_sigaction *return_ka, struct pt_regs *regs, void *cookie); 257extern int get_signal_to_deliver(siginfo_t *info, struct k_sigaction *return_ka, struct pt_regs *regs, void *cookie);
257extern void block_sigmask(struct k_sigaction *ka, int signr); 258extern void block_sigmask(struct k_sigaction *ka, int signr);
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 111f26b6e28b..0e501714d47f 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -117,11 +117,11 @@ struct nf_conntrack {
117 117
118#ifdef CONFIG_BRIDGE_NETFILTER 118#ifdef CONFIG_BRIDGE_NETFILTER
119struct nf_bridge_info { 119struct nf_bridge_info {
120 atomic_t use; 120 atomic_t use;
121 struct net_device *physindev; 121 unsigned int mask;
122 struct net_device *physoutdev; 122 struct net_device *physindev;
123 unsigned int mask; 123 struct net_device *physoutdev;
124 unsigned long data[32 / sizeof(unsigned long)]; 124 unsigned long data[32 / sizeof(unsigned long)];
125}; 125};
126#endif 126#endif
127 127
@@ -470,7 +470,8 @@ struct sk_buff {
470 __u8 wifi_acked_valid:1; 470 __u8 wifi_acked_valid:1;
471 __u8 wifi_acked:1; 471 __u8 wifi_acked:1;
472 __u8 no_fcs:1; 472 __u8 no_fcs:1;
473 /* 9/11 bit hole (depending on ndisc_nodetype presence) */ 473 __u8 head_frag:1;
474 /* 8/10 bit hole (depending on ndisc_nodetype presence) */
474 kmemcheck_bitfield_end(flags2); 475 kmemcheck_bitfield_end(flags2);
475 476
476#ifdef CONFIG_NET_DMA 477#ifdef CONFIG_NET_DMA
@@ -560,9 +561,15 @@ static inline struct rtable *skb_rtable(const struct sk_buff *skb)
560extern void kfree_skb(struct sk_buff *skb); 561extern void kfree_skb(struct sk_buff *skb);
561extern void consume_skb(struct sk_buff *skb); 562extern void consume_skb(struct sk_buff *skb);
562extern void __kfree_skb(struct sk_buff *skb); 563extern void __kfree_skb(struct sk_buff *skb);
564extern struct kmem_cache *skbuff_head_cache;
565
566extern void kfree_skb_partial(struct sk_buff *skb, bool head_stolen);
567extern bool skb_try_coalesce(struct sk_buff *to, struct sk_buff *from,
568 bool *fragstolen, int *delta_truesize);
569
563extern struct sk_buff *__alloc_skb(unsigned int size, 570extern struct sk_buff *__alloc_skb(unsigned int size,
564 gfp_t priority, int fclone, int node); 571 gfp_t priority, int fclone, int node);
565extern struct sk_buff *build_skb(void *data); 572extern struct sk_buff *build_skb(void *data, unsigned int frag_size);
566static inline struct sk_buff *alloc_skb(unsigned int size, 573static inline struct sk_buff *alloc_skb(unsigned int size,
567 gfp_t priority) 574 gfp_t priority)
568{ 575{
@@ -643,11 +650,21 @@ static inline unsigned char *skb_end_pointer(const struct sk_buff *skb)
643{ 650{
644 return skb->head + skb->end; 651 return skb->head + skb->end;
645} 652}
653
654static inline unsigned int skb_end_offset(const struct sk_buff *skb)
655{
656 return skb->end;
657}
646#else 658#else
647static inline unsigned char *skb_end_pointer(const struct sk_buff *skb) 659static inline unsigned char *skb_end_pointer(const struct sk_buff *skb)
648{ 660{
649 return skb->end; 661 return skb->end;
650} 662}
663
664static inline unsigned int skb_end_offset(const struct sk_buff *skb)
665{
666 return skb->end - skb->head;
667}
651#endif 668#endif
652 669
653/* Internal */ 670/* Internal */
@@ -881,10 +898,11 @@ static inline struct sk_buff *skb_unshare(struct sk_buff *skb,
881 */ 898 */
882static inline struct sk_buff *skb_peek(const struct sk_buff_head *list_) 899static inline struct sk_buff *skb_peek(const struct sk_buff_head *list_)
883{ 900{
884 struct sk_buff *list = ((const struct sk_buff *)list_)->next; 901 struct sk_buff *skb = list_->next;
885 if (list == (struct sk_buff *)list_) 902
886 list = NULL; 903 if (skb == (struct sk_buff *)list_)
887 return list; 904 skb = NULL;
905 return skb;
888} 906}
889 907
890/** 908/**
@@ -900,6 +918,7 @@ static inline struct sk_buff *skb_peek_next(struct sk_buff *skb,
900 const struct sk_buff_head *list_) 918 const struct sk_buff_head *list_)
901{ 919{
902 struct sk_buff *next = skb->next; 920 struct sk_buff *next = skb->next;
921
903 if (next == (struct sk_buff *)list_) 922 if (next == (struct sk_buff *)list_)
904 next = NULL; 923 next = NULL;
905 return next; 924 return next;
@@ -920,10 +939,12 @@ static inline struct sk_buff *skb_peek_next(struct sk_buff *skb,
920 */ 939 */
921static inline struct sk_buff *skb_peek_tail(const struct sk_buff_head *list_) 940static inline struct sk_buff *skb_peek_tail(const struct sk_buff_head *list_)
922{ 941{
923 struct sk_buff *list = ((const struct sk_buff *)list_)->prev; 942 struct sk_buff *skb = list_->prev;
924 if (list == (struct sk_buff *)list_) 943
925 list = NULL; 944 if (skb == (struct sk_buff *)list_)
926 return list; 945 skb = NULL;
946 return skb;
947
927} 948}
928 949
929/** 950/**
@@ -1664,31 +1685,11 @@ static inline void __skb_queue_purge(struct sk_buff_head *list)
1664 kfree_skb(skb); 1685 kfree_skb(skb);
1665} 1686}
1666 1687
1667/** 1688extern void *netdev_alloc_frag(unsigned int fragsz);
1668 * __dev_alloc_skb - allocate an skbuff for receiving
1669 * @length: length to allocate
1670 * @gfp_mask: get_free_pages mask, passed to alloc_skb
1671 *
1672 * Allocate a new &sk_buff and assign it a usage count of one. The
1673 * buffer has unspecified headroom built in. Users should allocate
1674 * the headroom they think they need without accounting for the
1675 * built in space. The built in space is used for optimisations.
1676 *
1677 * %NULL is returned if there is no free memory.
1678 */
1679static inline struct sk_buff *__dev_alloc_skb(unsigned int length,
1680 gfp_t gfp_mask)
1681{
1682 struct sk_buff *skb = alloc_skb(length + NET_SKB_PAD, gfp_mask);
1683 if (likely(skb))
1684 skb_reserve(skb, NET_SKB_PAD);
1685 return skb;
1686}
1687
1688extern struct sk_buff *dev_alloc_skb(unsigned int length);
1689 1689
1690extern struct sk_buff *__netdev_alloc_skb(struct net_device *dev, 1690extern struct sk_buff *__netdev_alloc_skb(struct net_device *dev,
1691 unsigned int length, gfp_t gfp_mask); 1691 unsigned int length,
1692 gfp_t gfp_mask);
1692 1693
1693/** 1694/**
1694 * netdev_alloc_skb - allocate an skbuff for rx on a specific device 1695 * netdev_alloc_skb - allocate an skbuff for rx on a specific device
@@ -1704,11 +1705,25 @@ extern struct sk_buff *__netdev_alloc_skb(struct net_device *dev,
1704 * allocates memory it can be called from an interrupt. 1705 * allocates memory it can be called from an interrupt.
1705 */ 1706 */
1706static inline struct sk_buff *netdev_alloc_skb(struct net_device *dev, 1707static inline struct sk_buff *netdev_alloc_skb(struct net_device *dev,
1707 unsigned int length) 1708 unsigned int length)
1708{ 1709{
1709 return __netdev_alloc_skb(dev, length, GFP_ATOMIC); 1710 return __netdev_alloc_skb(dev, length, GFP_ATOMIC);
1710} 1711}
1711 1712
1713/* legacy helper around __netdev_alloc_skb() */
1714static inline struct sk_buff *__dev_alloc_skb(unsigned int length,
1715 gfp_t gfp_mask)
1716{
1717 return __netdev_alloc_skb(NULL, length, gfp_mask);
1718}
1719
1720/* legacy helper around netdev_alloc_skb() */
1721static inline struct sk_buff *dev_alloc_skb(unsigned int length)
1722{
1723 return netdev_alloc_skb(NULL, length);
1724}
1725
1726
1712static inline struct sk_buff *__netdev_alloc_skb_ip_align(struct net_device *dev, 1727static inline struct sk_buff *__netdev_alloc_skb_ip_align(struct net_device *dev,
1713 unsigned int length, gfp_t gfp) 1728 unsigned int length, gfp_t gfp)
1714{ 1729{
@@ -1963,8 +1978,8 @@ static inline int skb_add_data(struct sk_buff *skb,
1963 return -EFAULT; 1978 return -EFAULT;
1964} 1979}
1965 1980
1966static inline int skb_can_coalesce(struct sk_buff *skb, int i, 1981static inline bool skb_can_coalesce(struct sk_buff *skb, int i,
1967 const struct page *page, int off) 1982 const struct page *page, int off)
1968{ 1983{
1969 if (i) { 1984 if (i) {
1970 const struct skb_frag_struct *frag = &skb_shinfo(skb)->frags[i - 1]; 1985 const struct skb_frag_struct *frag = &skb_shinfo(skb)->frags[i - 1];
@@ -1972,7 +1987,7 @@ static inline int skb_can_coalesce(struct sk_buff *skb, int i,
1972 return page == skb_frag_page(frag) && 1987 return page == skb_frag_page(frag) &&
1973 off == frag->page_offset + skb_frag_size(frag); 1988 off == frag->page_offset + skb_frag_size(frag);
1974 } 1989 }
1975 return 0; 1990 return false;
1976} 1991}
1977 1992
1978static inline int __skb_linearize(struct sk_buff *skb) 1993static inline int __skb_linearize(struct sk_buff *skb)
@@ -2552,7 +2567,7 @@ static inline bool skb_is_recycleable(const struct sk_buff *skb, int skb_size)
2552 return false; 2567 return false;
2553 2568
2554 skb_size = SKB_DATA_ALIGN(skb_size + NET_SKB_PAD); 2569 skb_size = SKB_DATA_ALIGN(skb_size + NET_SKB_PAD);
2555 if (skb_end_pointer(skb) - skb->head < skb_size) 2570 if (skb_end_offset(skb) < skb_size)
2556 return false; 2571 return false;
2557 2572
2558 if (skb_shared(skb) || skb_cloned(skb)) 2573 if (skb_shared(skb) || skb_cloned(skb))
@@ -2560,5 +2575,19 @@ static inline bool skb_is_recycleable(const struct sk_buff *skb, int skb_size)
2560 2575
2561 return true; 2576 return true;
2562} 2577}
2578
2579/**
2580 * skb_head_is_locked - Determine if the skb->head is locked down
2581 * @skb: skb to check
2582 *
2583 * The head on skbs build around a head frag can be removed if they are
2584 * not cloned. This function returns true if the skb head is locked down
2585 * due to either being allocated via kmalloc, or by being a clone with
2586 * multiple references to the head.
2587 */
2588static inline bool skb_head_is_locked(const struct sk_buff *skb)
2589{
2590 return !skb->head_frag || skb_cloned(skb);
2591}
2563#endif /* __KERNEL__ */ 2592#endif /* __KERNEL__ */
2564#endif /* _LINUX_SKBUFF_H */ 2593#endif /* _LINUX_SKBUFF_H */
diff --git a/include/linux/smp.h b/include/linux/smp.h
index 10530d92c04b..717fb746c9a8 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -61,7 +61,7 @@ extern void smp_prepare_cpus(unsigned int max_cpus);
61/* 61/*
62 * Bring a CPU up 62 * Bring a CPU up
63 */ 63 */
64extern int __cpu_up(unsigned int cpunum); 64extern int __cpu_up(unsigned int cpunum, struct task_struct *tidle);
65 65
66/* 66/*
67 * Final polishing of CPUs 67 * Final polishing of CPUs
@@ -81,6 +81,8 @@ void __smp_call_function_single(int cpuid, struct call_single_data *data,
81int smp_call_function_any(const struct cpumask *mask, 81int smp_call_function_any(const struct cpumask *mask,
82 smp_call_func_t func, void *info, int wait); 82 smp_call_func_t func, void *info, int wait);
83 83
84void kick_all_cpus_sync(void);
85
84/* 86/*
85 * Generic and arch helpers 87 * Generic and arch helpers
86 */ 88 */
@@ -192,6 +194,8 @@ smp_call_function_any(const struct cpumask *mask, smp_call_func_t func,
192 return smp_call_function_single(0, func, info, wait); 194 return smp_call_function_single(0, func, info, wait);
193} 195}
194 196
197static inline void kick_all_cpus_sync(void) { }
198
195#endif /* !SMP */ 199#endif /* !SMP */
196 200
197/* 201/*
diff --git a/include/linux/sock_diag.h b/include/linux/sock_diag.h
index 251729a47880..db4bae78bda9 100644
--- a/include/linux/sock_diag.h
+++ b/include/linux/sock_diag.h
@@ -32,8 +32,8 @@ struct sock_diag_handler {
32 int (*dump)(struct sk_buff *skb, struct nlmsghdr *nlh); 32 int (*dump)(struct sk_buff *skb, struct nlmsghdr *nlh);
33}; 33};
34 34
35int sock_diag_register(struct sock_diag_handler *h); 35int sock_diag_register(const struct sock_diag_handler *h);
36void sock_diag_unregister(struct sock_diag_handler *h); 36void sock_diag_unregister(const struct sock_diag_handler *h);
37 37
38void sock_diag_register_inet_compat(int (*fn)(struct sk_buff *skb, struct nlmsghdr *nlh)); 38void sock_diag_register_inet_compat(int (*fn)(struct sk_buff *skb, struct nlmsghdr *nlh));
39void sock_diag_unregister_inet_compat(int (*fn)(struct sk_buff *skb, struct nlmsghdr *nlh)); 39void sock_diag_unregister_inet_compat(int (*fn)(struct sk_buff *skb, struct nlmsghdr *nlh));
diff --git a/include/linux/socket.h b/include/linux/socket.h
index b84bbd48b874..25d6322fb635 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -68,13 +68,13 @@ struct msghdr {
68 __kernel_size_t msg_iovlen; /* Number of blocks */ 68 __kernel_size_t msg_iovlen; /* Number of blocks */
69 void * msg_control; /* Per protocol magic (eg BSD file descriptor passing) */ 69 void * msg_control; /* Per protocol magic (eg BSD file descriptor passing) */
70 __kernel_size_t msg_controllen; /* Length of cmsg list */ 70 __kernel_size_t msg_controllen; /* Length of cmsg list */
71 unsigned msg_flags; 71 unsigned int msg_flags;
72}; 72};
73 73
74/* For recvmmsg/sendmmsg */ 74/* For recvmmsg/sendmmsg */
75struct mmsghdr { 75struct mmsghdr {
76 struct msghdr msg_hdr; 76 struct msghdr msg_hdr;
77 unsigned msg_len; 77 unsigned int msg_len;
78}; 78};
79 79
80/* 80/*
diff --git a/include/linux/spi/eeprom.h b/include/linux/spi/eeprom.h
index 306e7b1c69ed..403e007aef68 100644
--- a/include/linux/spi/eeprom.h
+++ b/include/linux/spi/eeprom.h
@@ -20,6 +20,16 @@ struct spi_eeprom {
20#define EE_ADDR3 0x0004 /* 24 bit addrs */ 20#define EE_ADDR3 0x0004 /* 24 bit addrs */
21#define EE_READONLY 0x0008 /* disallow writes */ 21#define EE_READONLY 0x0008 /* disallow writes */
22 22
23 /*
24 * Certain EEPROMS have a size that is larger than the number of address
25 * bytes would allow (e.g. like M95040 from ST that has 512 Byte size
26 * but uses only one address byte (A0 to A7) for addressing.) For
27 * the extra address bit (A8, A16 or A24) bit 3 of the instruction byte
28 * is used. This instruction bit is normally defined as don't care for
29 * other AT25 like chips.
30 */
31#define EE_INSTR_BIT3_IS_ADDR 0x0010
32
23 /* for exporting this chip's data to other kernel code */ 33 /* for exporting this chip's data to other kernel code */
24 void (*setup)(struct memory_accessor *mem, void *context); 34 void (*setup)(struct memory_accessor *mem, void *context);
25 void *context; 35 void *context;
diff --git a/include/linux/spi/rspi.h b/include/linux/spi/rspi.h
new file mode 100644
index 000000000000..900f0e328235
--- /dev/null
+++ b/include/linux/spi/rspi.h
@@ -0,0 +1,31 @@
1/*
2 * Renesas SPI driver
3 *
4 * Copyright (C) 2012 Renesas Solutions Corp.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 *
19 */
20
21#ifndef __LINUX_SPI_RENESAS_SPI_H__
22#define __LINUX_SPI_RENESAS_SPI_H__
23
24struct rspi_plat_data {
25 unsigned int dma_tx_id;
26 unsigned int dma_rx_id;
27
28 unsigned dma_width_16bit:1; /* DMAC read/write width = 16-bit */
29};
30
31#endif
diff --git a/include/linux/srcu.h b/include/linux/srcu.h
index d3d5fa54f25e..55a5c52cbb25 100644
--- a/include/linux/srcu.h
+++ b/include/linux/srcu.h
@@ -29,26 +29,35 @@
29 29
30#include <linux/mutex.h> 30#include <linux/mutex.h>
31#include <linux/rcupdate.h> 31#include <linux/rcupdate.h>
32#include <linux/workqueue.h>
32 33
33struct srcu_struct_array { 34struct srcu_struct_array {
34 int c[2]; 35 unsigned long c[2];
36 unsigned long seq[2];
37};
38
39struct rcu_batch {
40 struct rcu_head *head, **tail;
35}; 41};
36 42
37struct srcu_struct { 43struct srcu_struct {
38 int completed; 44 unsigned completed;
39 struct srcu_struct_array __percpu *per_cpu_ref; 45 struct srcu_struct_array __percpu *per_cpu_ref;
40 struct mutex mutex; 46 spinlock_t queue_lock; /* protect ->batch_queue, ->running */
47 bool running;
48 /* callbacks just queued */
49 struct rcu_batch batch_queue;
50 /* callbacks try to do the first check_zero */
51 struct rcu_batch batch_check0;
52 /* callbacks done with the first check_zero and the flip */
53 struct rcu_batch batch_check1;
54 struct rcu_batch batch_done;
55 struct delayed_work work;
41#ifdef CONFIG_DEBUG_LOCK_ALLOC 56#ifdef CONFIG_DEBUG_LOCK_ALLOC
42 struct lockdep_map dep_map; 57 struct lockdep_map dep_map;
43#endif /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */ 58#endif /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */
44}; 59};
45 60
46#ifndef CONFIG_PREEMPT
47#define srcu_barrier() barrier()
48#else /* #ifndef CONFIG_PREEMPT */
49#define srcu_barrier()
50#endif /* #else #ifndef CONFIG_PREEMPT */
51
52#ifdef CONFIG_DEBUG_LOCK_ALLOC 61#ifdef CONFIG_DEBUG_LOCK_ALLOC
53 62
54int __init_srcu_struct(struct srcu_struct *sp, const char *name, 63int __init_srcu_struct(struct srcu_struct *sp, const char *name,
@@ -67,12 +76,33 @@ int init_srcu_struct(struct srcu_struct *sp);
67 76
68#endif /* #else #ifdef CONFIG_DEBUG_LOCK_ALLOC */ 77#endif /* #else #ifdef CONFIG_DEBUG_LOCK_ALLOC */
69 78
79/**
80 * call_srcu() - Queue a callback for invocation after an SRCU grace period
81 * @sp: srcu_struct in queue the callback
82 * @head: structure to be used for queueing the SRCU callback.
83 * @func: function to be invoked after the SRCU grace period
84 *
85 * The callback function will be invoked some time after a full SRCU
86 * grace period elapses, in other words after all pre-existing SRCU
87 * read-side critical sections have completed. However, the callback
88 * function might well execute concurrently with other SRCU read-side
89 * critical sections that started after call_srcu() was invoked. SRCU
90 * read-side critical sections are delimited by srcu_read_lock() and
91 * srcu_read_unlock(), and may be nested.
92 *
93 * The callback will be invoked from process context, but must nevertheless
94 * be fast and must not block.
95 */
96void call_srcu(struct srcu_struct *sp, struct rcu_head *head,
97 void (*func)(struct rcu_head *head));
98
70void cleanup_srcu_struct(struct srcu_struct *sp); 99void cleanup_srcu_struct(struct srcu_struct *sp);
71int __srcu_read_lock(struct srcu_struct *sp) __acquires(sp); 100int __srcu_read_lock(struct srcu_struct *sp) __acquires(sp);
72void __srcu_read_unlock(struct srcu_struct *sp, int idx) __releases(sp); 101void __srcu_read_unlock(struct srcu_struct *sp, int idx) __releases(sp);
73void synchronize_srcu(struct srcu_struct *sp); 102void synchronize_srcu(struct srcu_struct *sp);
74void synchronize_srcu_expedited(struct srcu_struct *sp); 103void synchronize_srcu_expedited(struct srcu_struct *sp);
75long srcu_batches_completed(struct srcu_struct *sp); 104long srcu_batches_completed(struct srcu_struct *sp);
105void srcu_barrier(struct srcu_struct *sp);
76 106
77#ifdef CONFIG_DEBUG_LOCK_ALLOC 107#ifdef CONFIG_DEBUG_LOCK_ALLOC
78 108
diff --git a/include/linux/ssb/ssb.h b/include/linux/ssb/ssb.h
index d27683180025..bc14bd738ade 100644
--- a/include/linux/ssb/ssb.h
+++ b/include/linux/ssb/ssb.h
@@ -188,7 +188,6 @@ struct ssb_sprom {
188struct ssb_boardinfo { 188struct ssb_boardinfo {
189 u16 vendor; 189 u16 vendor;
190 u16 type; 190 u16 type;
191 u8 rev;
192}; 191};
193 192
194 193
diff --git a/include/linux/ssb/ssb_regs.h b/include/linux/ssb/ssb_regs.h
index 40b1ef8595ee..a0525019e1d1 100644
--- a/include/linux/ssb/ssb_regs.h
+++ b/include/linux/ssb/ssb_regs.h
@@ -228,6 +228,7 @@
228#define SSB_SPROM1_AGAIN_BG_SHIFT 0 228#define SSB_SPROM1_AGAIN_BG_SHIFT 0
229#define SSB_SPROM1_AGAIN_A 0xFF00 /* A-PHY */ 229#define SSB_SPROM1_AGAIN_A 0xFF00 /* A-PHY */
230#define SSB_SPROM1_AGAIN_A_SHIFT 8 230#define SSB_SPROM1_AGAIN_A_SHIFT 8
231#define SSB_SPROM1_CCODE 0x0076
231 232
232/* SPROM Revision 2 (inherits from rev 1) */ 233/* SPROM Revision 2 (inherits from rev 1) */
233#define SSB_SPROM2_BFLHI 0x0038 /* Boardflags (high 16 bits) */ 234#define SSB_SPROM2_BFLHI 0x0038 /* Boardflags (high 16 bits) */
@@ -267,6 +268,7 @@
267#define SSB_SPROM3_OFDMGPO 0x107A /* G-PHY OFDM Power Offset (4 bytes, BigEndian) */ 268#define SSB_SPROM3_OFDMGPO 0x107A /* G-PHY OFDM Power Offset (4 bytes, BigEndian) */
268 269
269/* SPROM Revision 4 */ 270/* SPROM Revision 4 */
271#define SSB_SPROM4_BOARDREV 0x0042 /* Board revision */
270#define SSB_SPROM4_BFLLO 0x0044 /* Boardflags (low 16 bits) */ 272#define SSB_SPROM4_BFLLO 0x0044 /* Boardflags (low 16 bits) */
271#define SSB_SPROM4_BFLHI 0x0046 /* Board Flags Hi */ 273#define SSB_SPROM4_BFLHI 0x0046 /* Board Flags Hi */
272#define SSB_SPROM4_BFL2LO 0x0048 /* Board flags 2 (low 16 bits) */ 274#define SSB_SPROM4_BFL2LO 0x0048 /* Board flags 2 (low 16 bits) */
@@ -389,6 +391,11 @@
389#define SSB_SPROM8_GPIOB_P2 0x00FF /* Pin 2 */ 391#define SSB_SPROM8_GPIOB_P2 0x00FF /* Pin 2 */
390#define SSB_SPROM8_GPIOB_P3 0xFF00 /* Pin 3 */ 392#define SSB_SPROM8_GPIOB_P3 0xFF00 /* Pin 3 */
391#define SSB_SPROM8_GPIOB_P3_SHIFT 8 393#define SSB_SPROM8_GPIOB_P3_SHIFT 8
394#define SSB_SPROM8_LEDDC 0x009A
395#define SSB_SPROM8_LEDDC_ON 0xFF00 /* oncount */
396#define SSB_SPROM8_LEDDC_ON_SHIFT 8
397#define SSB_SPROM8_LEDDC_OFF 0x00FF /* offcount */
398#define SSB_SPROM8_LEDDC_OFF_SHIFT 0
392#define SSB_SPROM8_ANTAVAIL 0x009C /* Antenna available bitfields*/ 399#define SSB_SPROM8_ANTAVAIL 0x009C /* Antenna available bitfields*/
393#define SSB_SPROM8_ANTAVAIL_A 0xFF00 /* A-PHY bitfield */ 400#define SSB_SPROM8_ANTAVAIL_A 0xFF00 /* A-PHY bitfield */
394#define SSB_SPROM8_ANTAVAIL_A_SHIFT 8 401#define SSB_SPROM8_ANTAVAIL_A_SHIFT 8
@@ -404,6 +411,13 @@
404#define SSB_SPROM8_AGAIN2_SHIFT 0 411#define SSB_SPROM8_AGAIN2_SHIFT 0
405#define SSB_SPROM8_AGAIN3 0xFF00 /* Antenna 3 */ 412#define SSB_SPROM8_AGAIN3 0xFF00 /* Antenna 3 */
406#define SSB_SPROM8_AGAIN3_SHIFT 8 413#define SSB_SPROM8_AGAIN3_SHIFT 8
414#define SSB_SPROM8_TXRXC 0x00A2
415#define SSB_SPROM8_TXRXC_TXCHAIN 0x000f
416#define SSB_SPROM8_TXRXC_TXCHAIN_SHIFT 0
417#define SSB_SPROM8_TXRXC_RXCHAIN 0x00f0
418#define SSB_SPROM8_TXRXC_RXCHAIN_SHIFT 4
419#define SSB_SPROM8_TXRXC_SWITCH 0xff00
420#define SSB_SPROM8_TXRXC_SWITCH_SHIFT 8
407#define SSB_SPROM8_RSSIPARM2G 0x00A4 /* RSSI params for 2GHz */ 421#define SSB_SPROM8_RSSIPARM2G 0x00A4 /* RSSI params for 2GHz */
408#define SSB_SPROM8_RSSISMF2G 0x000F 422#define SSB_SPROM8_RSSISMF2G 0x000F
409#define SSB_SPROM8_RSSISMC2G 0x00F0 423#define SSB_SPROM8_RSSISMC2G 0x00F0
@@ -430,6 +444,7 @@
430#define SSB_SPROM8_TRI5GH_SHIFT 8 444#define SSB_SPROM8_TRI5GH_SHIFT 8
431#define SSB_SPROM8_RXPO 0x00AC /* RX power offsets */ 445#define SSB_SPROM8_RXPO 0x00AC /* RX power offsets */
432#define SSB_SPROM8_RXPO2G 0x00FF /* 2GHz RX power offset */ 446#define SSB_SPROM8_RXPO2G 0x00FF /* 2GHz RX power offset */
447#define SSB_SPROM8_RXPO2G_SHIFT 0
433#define SSB_SPROM8_RXPO5G 0xFF00 /* 5GHz RX power offset */ 448#define SSB_SPROM8_RXPO5G 0xFF00 /* 5GHz RX power offset */
434#define SSB_SPROM8_RXPO5G_SHIFT 8 449#define SSB_SPROM8_RXPO5G_SHIFT 8
435#define SSB_SPROM8_FEM2G 0x00AE 450#define SSB_SPROM8_FEM2G 0x00AE
@@ -445,10 +460,38 @@
445#define SSB_SROM8_FEM_ANTSWLUT 0xF800 460#define SSB_SROM8_FEM_ANTSWLUT 0xF800
446#define SSB_SROM8_FEM_ANTSWLUT_SHIFT 11 461#define SSB_SROM8_FEM_ANTSWLUT_SHIFT 11
447#define SSB_SPROM8_THERMAL 0x00B2 462#define SSB_SPROM8_THERMAL 0x00B2
448#define SSB_SPROM8_MPWR_RAWTS 0x00B4 463#define SSB_SPROM8_THERMAL_OFFSET 0x00ff
449#define SSB_SPROM8_TS_SLP_OPT_CORRX 0x00B6 464#define SSB_SPROM8_THERMAL_OFFSET_SHIFT 0
450#define SSB_SPROM8_FOC_HWIQ_IQSWP 0x00B8 465#define SSB_SPROM8_THERMAL_TRESH 0xff00
451#define SSB_SPROM8_PHYCAL_TEMPDELTA 0x00BA 466#define SSB_SPROM8_THERMAL_TRESH_SHIFT 8
467/* Temp sense related entries */
468#define SSB_SPROM8_RAWTS 0x00B4
469#define SSB_SPROM8_RAWTS_RAWTEMP 0x01ff
470#define SSB_SPROM8_RAWTS_RAWTEMP_SHIFT 0
471#define SSB_SPROM8_RAWTS_MEASPOWER 0xfe00
472#define SSB_SPROM8_RAWTS_MEASPOWER_SHIFT 9
473#define SSB_SPROM8_OPT_CORRX 0x00B6
474#define SSB_SPROM8_OPT_CORRX_TEMP_SLOPE 0x00ff
475#define SSB_SPROM8_OPT_CORRX_TEMP_SLOPE_SHIFT 0
476#define SSB_SPROM8_OPT_CORRX_TEMPCORRX 0xfc00
477#define SSB_SPROM8_OPT_CORRX_TEMPCORRX_SHIFT 10
478#define SSB_SPROM8_OPT_CORRX_TEMP_OPTION 0x0300
479#define SSB_SPROM8_OPT_CORRX_TEMP_OPTION_SHIFT 8
480/* FOC: freiquency offset correction, HWIQ: H/W IOCAL enable, IQSWP: IQ CAL swap disable */
481#define SSB_SPROM8_HWIQ_IQSWP 0x00B8
482#define SSB_SPROM8_HWIQ_IQSWP_FREQ_CORR 0x000f
483#define SSB_SPROM8_HWIQ_IQSWP_FREQ_CORR_SHIFT 0
484#define SSB_SPROM8_HWIQ_IQSWP_IQCAL_SWP 0x0010
485#define SSB_SPROM8_HWIQ_IQSWP_IQCAL_SWP_SHIFT 4
486#define SSB_SPROM8_HWIQ_IQSWP_HW_IQCAL 0x0020
487#define SSB_SPROM8_HWIQ_IQSWP_HW_IQCAL_SHIFT 5
488#define SSB_SPROM8_TEMPDELTA 0x00BA
489#define SSB_SPROM8_TEMPDELTA_PHYCAL 0x00ff
490#define SSB_SPROM8_TEMPDELTA_PHYCAL_SHIFT 0
491#define SSB_SPROM8_TEMPDELTA_PERIOD 0x0f00
492#define SSB_SPROM8_TEMPDELTA_PERIOD_SHIFT 8
493#define SSB_SPROM8_TEMPDELTA_HYSTERESIS 0xf000
494#define SSB_SPROM8_TEMPDELTA_HYSTERESIS_SHIFT 12
452 495
453/* There are 4 blocks with power info sharing the same layout */ 496/* There are 4 blocks with power info sharing the same layout */
454#define SSB_SROM8_PWR_INFO_CORE0 0x00C0 497#define SSB_SROM8_PWR_INFO_CORE0 0x00C0
@@ -513,6 +556,16 @@
513#define SSB_SPROM8_OFDM5GLPO 0x014A /* 5.2GHz OFDM power offset */ 556#define SSB_SPROM8_OFDM5GLPO 0x014A /* 5.2GHz OFDM power offset */
514#define SSB_SPROM8_OFDM5GHPO 0x014E /* 5.8GHz OFDM power offset */ 557#define SSB_SPROM8_OFDM5GHPO 0x014E /* 5.8GHz OFDM power offset */
515 558
559#define SSB_SPROM8_2G_MCSPO 0x0152
560#define SSB_SPROM8_5G_MCSPO 0x0162
561#define SSB_SPROM8_5GL_MCSPO 0x0172
562#define SSB_SPROM8_5GH_MCSPO 0x0182
563
564#define SSB_SPROM8_CDDPO 0x0192
565#define SSB_SPROM8_STBCPO 0x0194
566#define SSB_SPROM8_BW40PO 0x0196
567#define SSB_SPROM8_BWDUPPO 0x0198
568
516/* Values for boardflags_lo read from SPROM */ 569/* Values for boardflags_lo read from SPROM */
517#define SSB_BFL_BTCOEXIST 0x0001 /* implements Bluetooth coexistance */ 570#define SSB_BFL_BTCOEXIST 0x0001 /* implements Bluetooth coexistance */
518#define SSB_BFL_PACTRL 0x0002 /* GPIO 9 controlling the PA */ 571#define SSB_BFL_PACTRL 0x0002 /* GPIO 9 controlling the PA */
diff --git a/include/linux/stat.h b/include/linux/stat.h
index 611c398dab72..46132409a3f7 100644
--- a/include/linux/stat.h
+++ b/include/linux/stat.h
@@ -58,14 +58,15 @@
58 58
59#include <linux/types.h> 59#include <linux/types.h>
60#include <linux/time.h> 60#include <linux/time.h>
61#include <linux/uidgid.h>
61 62
62struct kstat { 63struct kstat {
63 u64 ino; 64 u64 ino;
64 dev_t dev; 65 dev_t dev;
65 umode_t mode; 66 umode_t mode;
66 unsigned int nlink; 67 unsigned int nlink;
67 uid_t uid; 68 kuid_t uid;
68 gid_t gid; 69 kgid_t gid;
69 dev_t rdev; 70 dev_t rdev;
70 loff_t size; 71 loff_t size;
71 struct timespec atime; 72 struct timespec atime;
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
index 0dddc9e42b6b..b69bdb1e08b6 100644
--- a/include/linux/stmmac.h
+++ b/include/linux/stmmac.h
@@ -28,6 +28,51 @@
28 28
29#include <linux/platform_device.h> 29#include <linux/platform_device.h>
30 30
31#define STMMAC_RX_COE_NONE 0
32#define STMMAC_RX_COE_TYPE1 1
33#define STMMAC_RX_COE_TYPE2 2
34
35/* Define the macros for CSR clock range parameters to be passed by
36 * platform code.
37 * This could also be configured at run time using CPU freq framework. */
38
39/* MDC Clock Selection define*/
40#define STMMAC_CSR_60_100M 0x0 /* MDC = clk_scr_i/42 */
41#define STMMAC_CSR_100_150M 0x1 /* MDC = clk_scr_i/62 */
42#define STMMAC_CSR_20_35M 0x2 /* MDC = clk_scr_i/16 */
43#define STMMAC_CSR_35_60M 0x3 /* MDC = clk_scr_i/26 */
44#define STMMAC_CSR_150_250M 0x4 /* MDC = clk_scr_i/102 */
45#define STMMAC_CSR_250_300M 0x5 /* MDC = clk_scr_i/122 */
46
47/* The MDC clock could be set higher than the IEEE 802.3
48 * specified frequency limit 0f 2.5 MHz, by programming a clock divider
49 * of value different than the above defined values. The resultant MDIO
50 * clock frequency of 12.5 MHz is applicable for the interfacing chips
51 * supporting higher MDC clocks.
52 * The MDC clock selection macros need to be defined for MDC clock rate
53 * of 12.5 MHz, corresponding to the following selection.
54 */
55#define STMMAC_CSR_I_4 0x8 /* clk_csr_i/4 */
56#define STMMAC_CSR_I_6 0x9 /* clk_csr_i/6 */
57#define STMMAC_CSR_I_8 0xA /* clk_csr_i/8 */
58#define STMMAC_CSR_I_10 0xB /* clk_csr_i/10 */
59#define STMMAC_CSR_I_12 0xC /* clk_csr_i/12 */
60#define STMMAC_CSR_I_14 0xD /* clk_csr_i/14 */
61#define STMMAC_CSR_I_16 0xE /* clk_csr_i/16 */
62#define STMMAC_CSR_I_18 0xF /* clk_csr_i/18 */
63
64/* AXI DMA Burst length suported */
65#define DMA_AXI_BLEN_4 (1 << 1)
66#define DMA_AXI_BLEN_8 (1 << 2)
67#define DMA_AXI_BLEN_16 (1 << 3)
68#define DMA_AXI_BLEN_32 (1 << 4)
69#define DMA_AXI_BLEN_64 (1 << 5)
70#define DMA_AXI_BLEN_128 (1 << 6)
71#define DMA_AXI_BLEN_256 (1 << 7)
72#define DMA_AXI_BLEN_ALL (DMA_AXI_BLEN_4 | DMA_AXI_BLEN_8 | DMA_AXI_BLEN_16 \
73 | DMA_AXI_BLEN_32 | DMA_AXI_BLEN_64 \
74 | DMA_AXI_BLEN_128 | DMA_AXI_BLEN_256)
75
31/* Platfrom data for platform device structure's platform_data field */ 76/* Platfrom data for platform device structure's platform_data field */
32 77
33struct stmmac_mdio_bus_data { 78struct stmmac_mdio_bus_data {
@@ -38,16 +83,25 @@ struct stmmac_mdio_bus_data {
38 int probed_phy_irq; 83 int probed_phy_irq;
39}; 84};
40 85
86struct stmmac_dma_cfg {
87 int pbl;
88 int fixed_burst;
89 int mixed_burst;
90 int burst_len;
91};
92
41struct plat_stmmacenet_data { 93struct plat_stmmacenet_data {
94 char *phy_bus_name;
42 int bus_id; 95 int bus_id;
43 int phy_addr; 96 int phy_addr;
44 int interface; 97 int interface;
45 struct stmmac_mdio_bus_data *mdio_bus_data; 98 struct stmmac_mdio_bus_data *mdio_bus_data;
46 int pbl; 99 struct stmmac_dma_cfg *dma_cfg;
47 int clk_csr; 100 int clk_csr;
48 int has_gmac; 101 int has_gmac;
49 int enh_desc; 102 int enh_desc;
50 int tx_coe; 103 int tx_coe;
104 int rx_coe;
51 int bugged_jumbo; 105 int bugged_jumbo;
52 int pmt; 106 int pmt;
53 int force_sf_dma_mode; 107 int force_sf_dma_mode;
@@ -56,6 +110,7 @@ struct plat_stmmacenet_data {
56 int (*init)(struct platform_device *pdev); 110 int (*init)(struct platform_device *pdev);
57 void (*exit)(struct platform_device *pdev); 111 void (*exit)(struct platform_device *pdev);
58 void *custom_cfg; 112 void *custom_cfg;
113 void *custom_data;
59 void *bsp_priv; 114 void *bsp_priv;
60}; 115};
61#endif 116#endif
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index ac1c114c499d..cd83059fb592 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -356,8 +356,9 @@ extern int unregister_pm_notifier(struct notifier_block *nb);
356extern bool events_check_enabled; 356extern bool events_check_enabled;
357 357
358extern bool pm_wakeup_pending(void); 358extern bool pm_wakeup_pending(void);
359extern bool pm_get_wakeup_count(unsigned int *count); 359extern bool pm_get_wakeup_count(unsigned int *count, bool block);
360extern bool pm_save_wakeup_count(unsigned int count); 360extern bool pm_save_wakeup_count(unsigned int count);
361extern void pm_wakep_autosleep_enabled(bool set);
361 362
362static inline void lock_system_sleep(void) 363static inline void lock_system_sleep(void)
363{ 364{
@@ -407,6 +408,17 @@ static inline void unlock_system_sleep(void) {}
407 408
408#endif /* !CONFIG_PM_SLEEP */ 409#endif /* !CONFIG_PM_SLEEP */
409 410
411#ifdef CONFIG_PM_AUTOSLEEP
412
413/* kernel/power/autosleep.c */
414void queue_up_suspend_work(void);
415
416#else /* !CONFIG_PM_AUTOSLEEP */
417
418static inline void queue_up_suspend_work(void) {}
419
420#endif /* !CONFIG_PM_AUTOSLEEP */
421
410#ifdef CONFIG_ARCH_SAVE_PAGE_KEYS 422#ifdef CONFIG_ARCH_SAVE_PAGE_KEYS
411/* 423/*
412 * The ARCH_SAVE_PAGE_KEYS functions can be used by an architecture 424 * The ARCH_SAVE_PAGE_KEYS functions can be used by an architecture
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index 0010009b2f00..381f06db2fe5 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -27,6 +27,7 @@ struct attribute {
27 const char *name; 27 const char *name;
28 umode_t mode; 28 umode_t mode;
29#ifdef CONFIG_DEBUG_LOCK_ALLOC 29#ifdef CONFIG_DEBUG_LOCK_ALLOC
30 bool ignore_lockdep:1;
30 struct lock_class_key *key; 31 struct lock_class_key *key;
31 struct lock_class_key skey; 32 struct lock_class_key skey;
32#endif 33#endif
@@ -80,6 +81,17 @@ struct attribute_group {
80 81
81#define __ATTR_NULL { .attr = { .name = NULL } } 82#define __ATTR_NULL { .attr = { .name = NULL } }
82 83
84#ifdef CONFIG_DEBUG_LOCK_ALLOC
85#define __ATTR_IGNORE_LOCKDEP(_name, _mode, _show, _store) { \
86 .attr = {.name = __stringify(_name), .mode = _mode, \
87 .ignore_lockdep = true }, \
88 .show = _show, \
89 .store = _store, \
90}
91#else
92#define __ATTR_IGNORE_LOCKDEP __ATTR
93#endif
94
83#define attr_name(_attr) (_attr).attr.name 95#define attr_name(_attr) (_attr).attr.name
84 96
85struct file; 97struct file;
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index b6c62d294380..4c5b63283377 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -106,6 +106,22 @@ enum {
106#define TCP_THIN_LINEAR_TIMEOUTS 16 /* Use linear timeouts for thin streams*/ 106#define TCP_THIN_LINEAR_TIMEOUTS 16 /* Use linear timeouts for thin streams*/
107#define TCP_THIN_DUPACK 17 /* Fast retrans. after 1 dupack */ 107#define TCP_THIN_DUPACK 17 /* Fast retrans. after 1 dupack */
108#define TCP_USER_TIMEOUT 18 /* How long for loss retry before timeout */ 108#define TCP_USER_TIMEOUT 18 /* How long for loss retry before timeout */
109#define TCP_REPAIR 19 /* TCP sock is under repair right now */
110#define TCP_REPAIR_QUEUE 20
111#define TCP_QUEUE_SEQ 21
112#define TCP_REPAIR_OPTIONS 22
113
114struct tcp_repair_opt {
115 __u32 opt_code;
116 __u32 opt_val;
117};
118
119enum {
120 TCP_NO_QUEUE,
121 TCP_RECV_QUEUE,
122 TCP_SEND_QUEUE,
123 TCP_QUEUES_NR,
124};
109 125
110/* for TCP_INFO socket option */ 126/* for TCP_INFO socket option */
111#define TCPI_OPT_TIMESTAMPS 1 127#define TCPI_OPT_TIMESTAMPS 1
@@ -353,7 +369,11 @@ struct tcp_sock {
353 u8 nonagle : 4,/* Disable Nagle algorithm? */ 369 u8 nonagle : 4,/* Disable Nagle algorithm? */
354 thin_lto : 1,/* Use linear timeouts for thin streams */ 370 thin_lto : 1,/* Use linear timeouts for thin streams */
355 thin_dupack : 1,/* Fast retransmit on first dupack */ 371 thin_dupack : 1,/* Fast retransmit on first dupack */
356 unused : 2; 372 repair : 1,
373 unused : 1;
374 u8 repair_queue;
375 u8 do_early_retrans:1,/* Enable RFC5827 early-retransmit */
376 early_retrans_delayed:1; /* Delayed ER timer installed */
357 377
358/* RTT measurement */ 378/* RTT measurement */
359 u32 srtt; /* smoothed round trip time << 3 */ 379 u32 srtt; /* smoothed round trip time << 3 */
@@ -406,7 +426,7 @@ struct tcp_sock {
406 426
407 struct sk_buff_head out_of_order_queue; /* Out of order segments go here */ 427 struct sk_buff_head out_of_order_queue; /* Out of order segments go here */
408 428
409 /* SACKs data, these 2 need to be together (see tcp_build_and_update_options) */ 429 /* SACKs data, these 2 need to be together (see tcp_options_write) */
410 struct tcp_sack_block duplicate_sack[1]; /* D-SACK block */ 430 struct tcp_sack_block duplicate_sack[1]; /* D-SACK block */
411 struct tcp_sack_block selective_acks[4]; /* The SACKS themselves*/ 431 struct tcp_sack_block selective_acks[4]; /* The SACKS themselves*/
412 432
diff --git a/include/linux/thread_info.h b/include/linux/thread_info.h
index 8d03f079688c..db78775eff3b 100644
--- a/include/linux/thread_info.h
+++ b/include/linux/thread_info.h
@@ -54,6 +54,12 @@ extern long do_no_restart_syscall(struct restart_block *parm);
54 54
55#ifdef __KERNEL__ 55#ifdef __KERNEL__
56 56
57#ifdef CONFIG_DEBUG_STACK_USAGE
58# define THREADINFO_GFP (GFP_KERNEL | __GFP_NOTRACK | __GFP_ZERO)
59#else
60# define THREADINFO_GFP (GFP_KERNEL | __GFP_NOTRACK)
61#endif
62
57/* 63/*
58 * flag set/clear/test wrappers 64 * flag set/clear/test wrappers
59 * - pass TIF_xxxx constants to these functions 65 * - pass TIF_xxxx constants to these functions
diff --git a/include/linux/ti_wilink_st.h b/include/linux/ti_wilink_st.h
index 2ef4385da6bf..3ca0269dd0b5 100644
--- a/include/linux/ti_wilink_st.h
+++ b/include/linux/ti_wilink_st.h
@@ -25,6 +25,8 @@
25#ifndef TI_WILINK_ST_H 25#ifndef TI_WILINK_ST_H
26#define TI_WILINK_ST_H 26#define TI_WILINK_ST_H
27 27
28#include <linux/skbuff.h>
29
28/** 30/**
29 * enum proto-type - The protocol on WiLink chips which share a 31 * enum proto-type - The protocol on WiLink chips which share a
30 * common physical interface like UART. 32 * common physical interface like UART.
diff --git a/include/linux/time.h b/include/linux/time.h
index 33a92ead4d88..179f4d6755fc 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -167,7 +167,6 @@ extern void get_monotonic_boottime(struct timespec *ts);
167extern struct timespec timespec_trunc(struct timespec t, unsigned gran); 167extern struct timespec timespec_trunc(struct timespec t, unsigned gran);
168extern int timekeeping_valid_for_hres(void); 168extern int timekeeping_valid_for_hres(void);
169extern u64 timekeeping_max_deferment(void); 169extern u64 timekeeping_max_deferment(void);
170extern void timekeeping_leap_insert(int leapsecond);
171extern int timekeeping_inject_offset(struct timespec *ts); 170extern int timekeeping_inject_offset(struct timespec *ts);
172 171
173struct tms; 172struct tms;
diff --git a/include/linux/topology.h b/include/linux/topology.h
index e26db031303b..e91cd43394df 100644
--- a/include/linux/topology.h
+++ b/include/linux/topology.h
@@ -70,7 +70,6 @@ int arch_update_cpu_topology(void);
70 * Below are the 3 major initializers used in building sched_domains: 70 * Below are the 3 major initializers used in building sched_domains:
71 * SD_SIBLING_INIT, for SMT domains 71 * SD_SIBLING_INIT, for SMT domains
72 * SD_CPU_INIT, for SMP domains 72 * SD_CPU_INIT, for SMP domains
73 * SD_NODE_INIT, for NUMA domains
74 * 73 *
75 * Any architecture that cares to do any tuning to these values should do so 74 * Any architecture that cares to do any tuning to these values should do so
76 * by defining their own arch-specific initializer in include/asm/topology.h. 75 * by defining their own arch-specific initializer in include/asm/topology.h.
@@ -99,7 +98,6 @@ int arch_update_cpu_topology(void);
99 | 0*SD_BALANCE_WAKE \ 98 | 0*SD_BALANCE_WAKE \
100 | 1*SD_WAKE_AFFINE \ 99 | 1*SD_WAKE_AFFINE \
101 | 1*SD_SHARE_CPUPOWER \ 100 | 1*SD_SHARE_CPUPOWER \
102 | 0*SD_POWERSAVINGS_BALANCE \
103 | 1*SD_SHARE_PKG_RESOURCES \ 101 | 1*SD_SHARE_PKG_RESOURCES \
104 | 0*SD_SERIALIZE \ 102 | 0*SD_SERIALIZE \
105 | 0*SD_PREFER_SIBLING \ 103 | 0*SD_PREFER_SIBLING \
@@ -135,8 +133,6 @@ int arch_update_cpu_topology(void);
135 | 0*SD_SHARE_CPUPOWER \ 133 | 0*SD_SHARE_CPUPOWER \
136 | 1*SD_SHARE_PKG_RESOURCES \ 134 | 1*SD_SHARE_PKG_RESOURCES \
137 | 0*SD_SERIALIZE \ 135 | 0*SD_SERIALIZE \
138 | sd_balance_for_mc_power() \
139 | sd_power_saving_flags() \
140 , \ 136 , \
141 .last_balance = jiffies, \ 137 .last_balance = jiffies, \
142 .balance_interval = 1, \ 138 .balance_interval = 1, \
@@ -168,56 +164,18 @@ int arch_update_cpu_topology(void);
168 | 0*SD_SHARE_CPUPOWER \ 164 | 0*SD_SHARE_CPUPOWER \
169 | 0*SD_SHARE_PKG_RESOURCES \ 165 | 0*SD_SHARE_PKG_RESOURCES \
170 | 0*SD_SERIALIZE \ 166 | 0*SD_SERIALIZE \
171 | sd_balance_for_package_power() \
172 | sd_power_saving_flags() \
173 , \ 167 , \
174 .last_balance = jiffies, \ 168 .last_balance = jiffies, \
175 .balance_interval = 1, \ 169 .balance_interval = 1, \
176} 170}
177#endif 171#endif
178 172
179/* sched_domains SD_ALLNODES_INIT for NUMA machines */
180#define SD_ALLNODES_INIT (struct sched_domain) { \
181 .min_interval = 64, \
182 .max_interval = 64*num_online_cpus(), \
183 .busy_factor = 128, \
184 .imbalance_pct = 133, \
185 .cache_nice_tries = 1, \
186 .busy_idx = 3, \
187 .idle_idx = 3, \
188 .flags = 1*SD_LOAD_BALANCE \
189 | 1*SD_BALANCE_NEWIDLE \
190 | 0*SD_BALANCE_EXEC \
191 | 0*SD_BALANCE_FORK \
192 | 0*SD_BALANCE_WAKE \
193 | 0*SD_WAKE_AFFINE \
194 | 0*SD_SHARE_CPUPOWER \
195 | 0*SD_POWERSAVINGS_BALANCE \
196 | 0*SD_SHARE_PKG_RESOURCES \
197 | 1*SD_SERIALIZE \
198 | 0*SD_PREFER_SIBLING \
199 , \
200 .last_balance = jiffies, \
201 .balance_interval = 64, \
202}
203
204#ifndef SD_NODES_PER_DOMAIN
205#define SD_NODES_PER_DOMAIN 16
206#endif
207
208#ifdef CONFIG_SCHED_BOOK 173#ifdef CONFIG_SCHED_BOOK
209#ifndef SD_BOOK_INIT 174#ifndef SD_BOOK_INIT
210#error Please define an appropriate SD_BOOK_INIT in include/asm/topology.h!!! 175#error Please define an appropriate SD_BOOK_INIT in include/asm/topology.h!!!
211#endif 176#endif
212#endif /* CONFIG_SCHED_BOOK */ 177#endif /* CONFIG_SCHED_BOOK */
213 178
214#ifdef CONFIG_NUMA
215#ifndef SD_NODE_INIT
216#error Please define an appropriate SD_NODE_INIT in include/asm/topology.h!!!
217#endif
218
219#endif /* CONFIG_NUMA */
220
221#ifdef CONFIG_USE_PERCPU_NUMA_NODE_ID 179#ifdef CONFIG_USE_PERCPU_NUMA_NODE_ID
222DECLARE_PER_CPU(int, numa_node); 180DECLARE_PER_CPU(int, numa_node);
223 181
@@ -239,7 +197,7 @@ static inline int cpu_to_node(int cpu)
239#ifndef set_numa_node 197#ifndef set_numa_node
240static inline void set_numa_node(int node) 198static inline void set_numa_node(int node)
241{ 199{
242 percpu_write(numa_node, node); 200 this_cpu_write(numa_node, node);
243} 201}
244#endif 202#endif
245 203
@@ -274,7 +232,7 @@ DECLARE_PER_CPU(int, _numa_mem_);
274#ifndef set_numa_mem 232#ifndef set_numa_mem
275static inline void set_numa_mem(int node) 233static inline void set_numa_mem(int node)
276{ 234{
277 percpu_write(_numa_mem_, node); 235 this_cpu_write(_numa_mem_, node);
278} 236}
279#endif 237#endif
280 238
diff --git a/include/linux/trdevice.h b/include/linux/trdevice.h
deleted file mode 100644
index bfc84a7aecc5..000000000000
--- a/include/linux/trdevice.h
+++ /dev/null
@@ -1,37 +0,0 @@
1/*
2 * INET An implementation of the TCP/IP protocol suite for the LINUX
3 * operating system. NET is implemented using the BSD Socket
4 * interface as the means of communication with the user level.
5 *
6 * Definitions for the Token-ring handlers.
7 *
8 * Version: @(#)eth.h 1.0.4 05/13/93
9 *
10 * Authors: Ross Biro
11 * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
12 *
13 * Relocated to include/linux where it belongs by Alan Cox
14 * <gw4pts@gw4pts.ampr.org>
15 *
16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License
18 * as published by the Free Software Foundation; either version
19 * 2 of the License, or (at your option) any later version.
20 *
21 * WARNING: This move may well be temporary. This file will get merged with others RSN.
22 *
23 */
24#ifndef _LINUX_TRDEVICE_H
25#define _LINUX_TRDEVICE_H
26
27
28#include <linux/if_tr.h>
29
30#ifdef __KERNEL__
31extern __be16 tr_type_trans(struct sk_buff *skb, struct net_device *dev);
32extern void tr_source_route(struct sk_buff *skb, struct trh_hdr *trh, struct net_device *dev);
33extern struct net_device *alloc_trdev(int sizeof_priv);
34
35#endif
36
37#endif /* _LINUX_TRDEVICE_H */
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 9f47ab540f65..4990ef2b1fb7 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -268,6 +268,7 @@ struct tty_struct {
268 struct mutex ldisc_mutex; 268 struct mutex ldisc_mutex;
269 struct tty_ldisc *ldisc; 269 struct tty_ldisc *ldisc;
270 270
271 struct mutex legacy_mutex;
271 struct mutex termios_mutex; 272 struct mutex termios_mutex;
272 spinlock_t ctrl_lock; 273 spinlock_t ctrl_lock;
273 /* Termios values are protected by the termios mutex */ 274 /* Termios values are protected by the termios mutex */
@@ -605,8 +606,12 @@ extern long vt_compat_ioctl(struct tty_struct *tty,
605 606
606/* tty_mutex.c */ 607/* tty_mutex.c */
607/* functions for preparation of BKL removal */ 608/* functions for preparation of BKL removal */
608extern void __lockfunc tty_lock(void) __acquires(tty_lock); 609extern void __lockfunc tty_lock(struct tty_struct *tty);
609extern void __lockfunc tty_unlock(void) __releases(tty_lock); 610extern void __lockfunc tty_unlock(struct tty_struct *tty);
611extern void __lockfunc tty_lock_pair(struct tty_struct *tty,
612 struct tty_struct *tty2);
613extern void __lockfunc tty_unlock_pair(struct tty_struct *tty,
614 struct tty_struct *tty2);
610 615
611/* 616/*
612 * this shall be called only from where BTM is held (like close) 617 * this shall be called only from where BTM is held (like close)
@@ -621,9 +626,9 @@ extern void __lockfunc tty_unlock(void) __releases(tty_lock);
621static inline void tty_wait_until_sent_from_close(struct tty_struct *tty, 626static inline void tty_wait_until_sent_from_close(struct tty_struct *tty,
622 long timeout) 627 long timeout)
623{ 628{
624 tty_unlock(); /* tty->ops->close holds the BTM, drop it while waiting */ 629 tty_unlock(tty); /* tty->ops->close holds the BTM, drop it while waiting */
625 tty_wait_until_sent(tty, timeout); 630 tty_wait_until_sent(tty, timeout);
626 tty_lock(); 631 tty_lock(tty);
627} 632}
628 633
629/* 634/*
@@ -638,16 +643,16 @@ static inline void tty_wait_until_sent_from_close(struct tty_struct *tty,
638 * 643 *
639 * Do not use in new code. 644 * Do not use in new code.
640 */ 645 */
641#define wait_event_interruptible_tty(wq, condition) \ 646#define wait_event_interruptible_tty(tty, wq, condition) \
642({ \ 647({ \
643 int __ret = 0; \ 648 int __ret = 0; \
644 if (!(condition)) { \ 649 if (!(condition)) { \
645 __wait_event_interruptible_tty(wq, condition, __ret); \ 650 __wait_event_interruptible_tty(tty, wq, condition, __ret); \
646 } \ 651 } \
647 __ret; \ 652 __ret; \
648}) 653})
649 654
650#define __wait_event_interruptible_tty(wq, condition, ret) \ 655#define __wait_event_interruptible_tty(tty, wq, condition, ret) \
651do { \ 656do { \
652 DEFINE_WAIT(__wait); \ 657 DEFINE_WAIT(__wait); \
653 \ 658 \
@@ -656,9 +661,9 @@ do { \
656 if (condition) \ 661 if (condition) \
657 break; \ 662 break; \
658 if (!signal_pending(current)) { \ 663 if (!signal_pending(current)) { \
659 tty_unlock(); \ 664 tty_unlock(tty); \
660 schedule(); \ 665 schedule(); \
661 tty_lock(); \ 666 tty_lock(tty); \
662 continue; \ 667 continue; \
663 } \ 668 } \
664 ret = -ERESTARTSYS; \ 669 ret = -ERESTARTSYS; \
diff --git a/include/linux/tty_ldisc.h b/include/linux/tty_ldisc.h
index ff7dc08696a8..fb79dd8d1537 100644
--- a/include/linux/tty_ldisc.h
+++ b/include/linux/tty_ldisc.h
@@ -110,6 +110,7 @@
110#include <linux/fs.h> 110#include <linux/fs.h>
111#include <linux/wait.h> 111#include <linux/wait.h>
112#include <linux/pps_kernel.h> 112#include <linux/pps_kernel.h>
113#include <linux/wait.h>
113 114
114struct tty_ldisc_ops { 115struct tty_ldisc_ops {
115 int magic; 116 int magic;
@@ -154,6 +155,7 @@ struct tty_ldisc_ops {
154struct tty_ldisc { 155struct tty_ldisc {
155 struct tty_ldisc_ops *ops; 156 struct tty_ldisc_ops *ops;
156 atomic_t users; 157 atomic_t users;
158 wait_queue_head_t wq_idle;
157}; 159};
158 160
159#define TTY_LDISC_MAGIC 0x5403 161#define TTY_LDISC_MAGIC 0x5403
diff --git a/include/linux/uidgid.h b/include/linux/uidgid.h
new file mode 100644
index 000000000000..8e522cbcef29
--- /dev/null
+++ b/include/linux/uidgid.h
@@ -0,0 +1,200 @@
1#ifndef _LINUX_UIDGID_H
2#define _LINUX_UIDGID_H
3
4/*
5 * A set of types for the internal kernel types representing uids and gids.
6 *
7 * The types defined in this header allow distinguishing which uids and gids in
8 * the kernel are values used by userspace and which uid and gid values are
9 * the internal kernel values. With the addition of user namespaces the values
10 * can be different. Using the type system makes it possible for the compiler
11 * to detect when we overlook these differences.
12 *
13 */
14#include <linux/types.h>
15#include <linux/highuid.h>
16
17struct user_namespace;
18extern struct user_namespace init_user_ns;
19
20#ifdef CONFIG_UIDGID_STRICT_TYPE_CHECKS
21
22typedef struct {
23 uid_t val;
24} kuid_t;
25
26
27typedef struct {
28 gid_t val;
29} kgid_t;
30
31#define KUIDT_INIT(value) (kuid_t){ value }
32#define KGIDT_INIT(value) (kgid_t){ value }
33
34static inline uid_t __kuid_val(kuid_t uid)
35{
36 return uid.val;
37}
38
39static inline gid_t __kgid_val(kgid_t gid)
40{
41 return gid.val;
42}
43
44#else
45
46typedef uid_t kuid_t;
47typedef gid_t kgid_t;
48
49static inline uid_t __kuid_val(kuid_t uid)
50{
51 return uid;
52}
53
54static inline gid_t __kgid_val(kgid_t gid)
55{
56 return gid;
57}
58
59#define KUIDT_INIT(value) ((kuid_t) value )
60#define KGIDT_INIT(value) ((kgid_t) value )
61
62#endif
63
64#define GLOBAL_ROOT_UID KUIDT_INIT(0)
65#define GLOBAL_ROOT_GID KGIDT_INIT(0)
66
67#define INVALID_UID KUIDT_INIT(-1)
68#define INVALID_GID KGIDT_INIT(-1)
69
70static inline bool uid_eq(kuid_t left, kuid_t right)
71{
72 return __kuid_val(left) == __kuid_val(right);
73}
74
75static inline bool gid_eq(kgid_t left, kgid_t right)
76{
77 return __kgid_val(left) == __kgid_val(right);
78}
79
80static inline bool uid_gt(kuid_t left, kuid_t right)
81{
82 return __kuid_val(left) > __kuid_val(right);
83}
84
85static inline bool gid_gt(kgid_t left, kgid_t right)
86{
87 return __kgid_val(left) > __kgid_val(right);
88}
89
90static inline bool uid_gte(kuid_t left, kuid_t right)
91{
92 return __kuid_val(left) >= __kuid_val(right);
93}
94
95static inline bool gid_gte(kgid_t left, kgid_t right)
96{
97 return __kgid_val(left) >= __kgid_val(right);
98}
99
100static inline bool uid_lt(kuid_t left, kuid_t right)
101{
102 return __kuid_val(left) < __kuid_val(right);
103}
104
105static inline bool gid_lt(kgid_t left, kgid_t right)
106{
107 return __kgid_val(left) < __kgid_val(right);
108}
109
110static inline bool uid_lte(kuid_t left, kuid_t right)
111{
112 return __kuid_val(left) <= __kuid_val(right);
113}
114
115static inline bool gid_lte(kgid_t left, kgid_t right)
116{
117 return __kgid_val(left) <= __kgid_val(right);
118}
119
120static inline bool uid_valid(kuid_t uid)
121{
122 return !uid_eq(uid, INVALID_UID);
123}
124
125static inline bool gid_valid(kgid_t gid)
126{
127 return !gid_eq(gid, INVALID_GID);
128}
129
130#ifdef CONFIG_USER_NS
131
132extern kuid_t make_kuid(struct user_namespace *from, uid_t uid);
133extern kgid_t make_kgid(struct user_namespace *from, gid_t gid);
134
135extern uid_t from_kuid(struct user_namespace *to, kuid_t uid);
136extern gid_t from_kgid(struct user_namespace *to, kgid_t gid);
137extern uid_t from_kuid_munged(struct user_namespace *to, kuid_t uid);
138extern gid_t from_kgid_munged(struct user_namespace *to, kgid_t gid);
139
140static inline bool kuid_has_mapping(struct user_namespace *ns, kuid_t uid)
141{
142 return from_kuid(ns, uid) != (uid_t) -1;
143}
144
145static inline bool kgid_has_mapping(struct user_namespace *ns, kgid_t gid)
146{
147 return from_kgid(ns, gid) != (gid_t) -1;
148}
149
150#else
151
152static inline kuid_t make_kuid(struct user_namespace *from, uid_t uid)
153{
154 return KUIDT_INIT(uid);
155}
156
157static inline kgid_t make_kgid(struct user_namespace *from, gid_t gid)
158{
159 return KGIDT_INIT(gid);
160}
161
162static inline uid_t from_kuid(struct user_namespace *to, kuid_t kuid)
163{
164 return __kuid_val(kuid);
165}
166
167static inline gid_t from_kgid(struct user_namespace *to, kgid_t kgid)
168{
169 return __kgid_val(kgid);
170}
171
172static inline uid_t from_kuid_munged(struct user_namespace *to, kuid_t kuid)
173{
174 uid_t uid = from_kuid(to, kuid);
175 if (uid == (uid_t)-1)
176 uid = overflowuid;
177 return uid;
178}
179
180static inline gid_t from_kgid_munged(struct user_namespace *to, kgid_t kgid)
181{
182 gid_t gid = from_kgid(to, kgid);
183 if (gid == (gid_t)-1)
184 gid = overflowgid;
185 return gid;
186}
187
188static inline bool kuid_has_mapping(struct user_namespace *ns, kuid_t uid)
189{
190 return true;
191}
192
193static inline bool kgid_has_mapping(struct user_namespace *ns, kgid_t gid)
194{
195 return true;
196}
197
198#endif /* CONFIG_USER_NS */
199
200#endif /* _LINUX_UIDGID_H */
diff --git a/include/linux/uprobes.h b/include/linux/uprobes.h
new file mode 100644
index 000000000000..efe4b3308c74
--- /dev/null
+++ b/include/linux/uprobes.h
@@ -0,0 +1,165 @@
1#ifndef _LINUX_UPROBES_H
2#define _LINUX_UPROBES_H
3/*
4 * User-space Probes (UProbes)
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 *
20 * Copyright (C) IBM Corporation, 2008-2012
21 * Authors:
22 * Srikar Dronamraju
23 * Jim Keniston
24 * Copyright (C) 2011-2012 Red Hat, Inc., Peter Zijlstra <pzijlstr@redhat.com>
25 */
26
27#include <linux/errno.h>
28#include <linux/rbtree.h>
29
30struct vm_area_struct;
31struct mm_struct;
32struct inode;
33
34#ifdef CONFIG_ARCH_SUPPORTS_UPROBES
35# include <asm/uprobes.h>
36#endif
37
38/* flags that denote/change uprobes behaviour */
39
40/* Have a copy of original instruction */
41#define UPROBE_COPY_INSN 0x1
42
43/* Dont run handlers when first register/ last unregister in progress*/
44#define UPROBE_RUN_HANDLER 0x2
45/* Can skip singlestep */
46#define UPROBE_SKIP_SSTEP 0x4
47
48struct uprobe_consumer {
49 int (*handler)(struct uprobe_consumer *self, struct pt_regs *regs);
50 /*
51 * filter is optional; If a filter exists, handler is run
52 * if and only if filter returns true.
53 */
54 bool (*filter)(struct uprobe_consumer *self, struct task_struct *task);
55
56 struct uprobe_consumer *next;
57};
58
59#ifdef CONFIG_UPROBES
60enum uprobe_task_state {
61 UTASK_RUNNING,
62 UTASK_BP_HIT,
63 UTASK_SSTEP,
64 UTASK_SSTEP_ACK,
65 UTASK_SSTEP_TRAPPED,
66};
67
68/*
69 * uprobe_task: Metadata of a task while it singlesteps.
70 */
71struct uprobe_task {
72 enum uprobe_task_state state;
73 struct arch_uprobe_task autask;
74
75 struct uprobe *active_uprobe;
76
77 unsigned long xol_vaddr;
78 unsigned long vaddr;
79};
80
81/*
82 * On a breakpoint hit, thread contests for a slot. It frees the
83 * slot after singlestep. Currently a fixed number of slots are
84 * allocated.
85 */
86struct xol_area {
87 wait_queue_head_t wq; /* if all slots are busy */
88 atomic_t slot_count; /* number of in-use slots */
89 unsigned long *bitmap; /* 0 = free slot */
90 struct page *page;
91
92 /*
93 * We keep the vma's vm_start rather than a pointer to the vma
94 * itself. The probed process or a naughty kernel module could make
95 * the vma go away, and we must handle that reasonably gracefully.
96 */
97 unsigned long vaddr; /* Page(s) of instruction slots */
98};
99
100struct uprobes_state {
101 struct xol_area *xol_area;
102 atomic_t count;
103};
104extern int __weak set_swbp(struct arch_uprobe *aup, struct mm_struct *mm, unsigned long vaddr);
105extern int __weak set_orig_insn(struct arch_uprobe *aup, struct mm_struct *mm, unsigned long vaddr, bool verify);
106extern bool __weak is_swbp_insn(uprobe_opcode_t *insn);
107extern int uprobe_register(struct inode *inode, loff_t offset, struct uprobe_consumer *uc);
108extern void uprobe_unregister(struct inode *inode, loff_t offset, struct uprobe_consumer *uc);
109extern int uprobe_mmap(struct vm_area_struct *vma);
110extern void uprobe_munmap(struct vm_area_struct *vma, unsigned long start, unsigned long end);
111extern void uprobe_free_utask(struct task_struct *t);
112extern void uprobe_copy_process(struct task_struct *t);
113extern unsigned long __weak uprobe_get_swbp_addr(struct pt_regs *regs);
114extern int uprobe_post_sstep_notifier(struct pt_regs *regs);
115extern int uprobe_pre_sstep_notifier(struct pt_regs *regs);
116extern void uprobe_notify_resume(struct pt_regs *regs);
117extern bool uprobe_deny_signal(void);
118extern bool __weak arch_uprobe_skip_sstep(struct arch_uprobe *aup, struct pt_regs *regs);
119extern void uprobe_clear_state(struct mm_struct *mm);
120extern void uprobe_reset_state(struct mm_struct *mm);
121#else /* !CONFIG_UPROBES */
122struct uprobes_state {
123};
124static inline int
125uprobe_register(struct inode *inode, loff_t offset, struct uprobe_consumer *uc)
126{
127 return -ENOSYS;
128}
129static inline void
130uprobe_unregister(struct inode *inode, loff_t offset, struct uprobe_consumer *uc)
131{
132}
133static inline int uprobe_mmap(struct vm_area_struct *vma)
134{
135 return 0;
136}
137static inline void
138uprobe_munmap(struct vm_area_struct *vma, unsigned long start, unsigned long end)
139{
140}
141static inline void uprobe_notify_resume(struct pt_regs *regs)
142{
143}
144static inline bool uprobe_deny_signal(void)
145{
146 return false;
147}
148static inline unsigned long uprobe_get_swbp_addr(struct pt_regs *regs)
149{
150 return 0;
151}
152static inline void uprobe_free_utask(struct task_struct *t)
153{
154}
155static inline void uprobe_copy_process(struct task_struct *t)
156{
157}
158static inline void uprobe_clear_state(struct mm_struct *mm)
159{
160}
161static inline void uprobe_reset_state(struct mm_struct *mm)
162{
163}
164#endif /* !CONFIG_UPROBES */
165#endif /* _LINUX_UPROBES_H */
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 73b68d1f2cb0..dea39dc551d4 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -351,10 +351,6 @@ struct usb_bus {
351 int bandwidth_int_reqs; /* number of Interrupt requests */ 351 int bandwidth_int_reqs; /* number of Interrupt requests */
352 int bandwidth_isoc_reqs; /* number of Isoc. requests */ 352 int bandwidth_isoc_reqs; /* number of Isoc. requests */
353 353
354#ifdef CONFIG_USB_DEVICEFS
355 struct dentry *usbfs_dentry; /* usbfs dentry entry for the bus */
356#endif
357
358#if defined(CONFIG_USB_MON) || defined(CONFIG_USB_MON_MODULE) 354#if defined(CONFIG_USB_MON) || defined(CONFIG_USB_MON_MODULE)
359 struct mon_bus *mon_bus; /* non-null when associated */ 355 struct mon_bus *mon_bus; /* non-null when associated */
360 int monitored; /* non-zero when monitored */ 356 int monitored; /* non-zero when monitored */
@@ -382,6 +378,45 @@ enum usb_device_removable {
382 USB_DEVICE_FIXED, 378 USB_DEVICE_FIXED,
383}; 379};
384 380
381/*
382 * USB 3.0 Link Power Management (LPM) parameters.
383 *
384 * PEL and SEL are USB 3.0 Link PM latencies for device-initiated LPM exit.
385 * MEL is the USB 3.0 Link PM latency for host-initiated LPM exit.
386 * All three are stored in nanoseconds.
387 */
388struct usb3_lpm_parameters {
389 /*
390 * Maximum exit latency (MEL) for the host to send a packet to the
391 * device (either a Ping for isoc endpoints, or a data packet for
392 * interrupt endpoints), the hubs to decode the packet, and for all hubs
393 * in the path to transition the links to U0.
394 */
395 unsigned int mel;
396 /*
397 * Maximum exit latency for a device-initiated LPM transition to bring
398 * all links into U0. Abbreviated as "PEL" in section 9.4.12 of the USB
399 * 3.0 spec, with no explanation of what "P" stands for. "Path"?
400 */
401 unsigned int pel;
402
403 /*
404 * The System Exit Latency (SEL) includes PEL, and three other
405 * latencies. After a device initiates a U0 transition, it will take
406 * some time from when the device sends the ERDY to when it will finally
407 * receive the data packet. Basically, SEL should be the worse-case
408 * latency from when a device starts initiating a U0 transition to when
409 * it will get data.
410 */
411 unsigned int sel;
412 /*
413 * The idle timeout value that is currently programmed into the parent
414 * hub for this device. When the timer counts to zero, the parent hub
415 * will initiate an LPM transition to either U1 or U2.
416 */
417 int timeout;
418};
419
385/** 420/**
386 * struct usb_device - kernel's representation of a USB device 421 * struct usb_device - kernel's representation of a USB device
387 * @devnum: device number; address on a USB bus 422 * @devnum: device number; address on a USB bus
@@ -439,6 +474,12 @@ enum usb_device_removable {
439 * specific data for the device. 474 * specific data for the device.
440 * @slot_id: Slot ID assigned by xHCI 475 * @slot_id: Slot ID assigned by xHCI
441 * @removable: Device can be physically removed from this port 476 * @removable: Device can be physically removed from this port
477 * @u1_params: exit latencies for USB3 U1 LPM state, and hub-initiated timeout.
478 * @u2_params: exit latencies for USB3 U2 LPM state, and hub-initiated timeout.
479 * @lpm_disable_count: Ref count used by usb_disable_lpm() and usb_enable_lpm()
480 * to keep track of the number of functions that require USB 3.0 Link Power
481 * Management to be disabled for this usb_device. This count should only
482 * be manipulated by those functions, with the bandwidth_mutex is held.
442 * 483 *
443 * Notes: 484 * Notes:
444 * Usbcore drivers should not set usbdev->state directly. Instead use 485 * Usbcore drivers should not set usbdev->state directly. Instead use
@@ -485,6 +526,7 @@ struct usb_device {
485 unsigned lpm_capable:1; 526 unsigned lpm_capable:1;
486 unsigned usb2_hw_lpm_capable:1; 527 unsigned usb2_hw_lpm_capable:1;
487 unsigned usb2_hw_lpm_enabled:1; 528 unsigned usb2_hw_lpm_enabled:1;
529 unsigned usb3_lpm_enabled:1;
488 int string_langid; 530 int string_langid;
489 531
490 /* static strings from the device */ 532 /* static strings from the device */
@@ -493,12 +535,6 @@ struct usb_device {
493 char *serial; 535 char *serial;
494 536
495 struct list_head filelist; 537 struct list_head filelist;
496#ifdef CONFIG_USB_DEVICE_CLASS
497 struct device *usb_classdev;
498#endif
499#ifdef CONFIG_USB_DEVICEFS
500 struct dentry *usbfs_dentry;
501#endif
502 538
503 int maxchild; 539 int maxchild;
504 struct usb_device **children; 540 struct usb_device **children;
@@ -517,6 +553,10 @@ struct usb_device {
517 struct wusb_dev *wusb_dev; 553 struct wusb_dev *wusb_dev;
518 int slot_id; 554 int slot_id;
519 enum usb_device_removable removable; 555 enum usb_device_removable removable;
556 struct usb3_lpm_parameters u1_params;
557 struct usb3_lpm_parameters u2_params;
558 unsigned lpm_disable_count;
559 unsigned hub_initiated_lpm_disable_count;
520}; 560};
521#define to_usb_device(d) container_of(d, struct usb_device, dev) 561#define to_usb_device(d) container_of(d, struct usb_device, dev)
522 562
@@ -583,6 +623,12 @@ static inline void usb_mark_last_busy(struct usb_device *udev)
583{ } 623{ }
584#endif 624#endif
585 625
626extern int usb_disable_lpm(struct usb_device *udev);
627extern void usb_enable_lpm(struct usb_device *udev);
628/* Same as above, but these functions lock/unlock the bandwidth_mutex. */
629extern int usb_unlocked_disable_lpm(struct usb_device *udev);
630extern void usb_unlocked_enable_lpm(struct usb_device *udev);
631
586/*-------------------------------------------------------------------------*/ 632/*-------------------------------------------------------------------------*/
587 633
588/* for drivers using iso endpoints */ 634/* for drivers using iso endpoints */
@@ -800,6 +846,8 @@ extern ssize_t usb_store_new_id(struct usb_dynids *dynids,
800 struct device_driver *driver, 846 struct device_driver *driver,
801 const char *buf, size_t count); 847 const char *buf, size_t count);
802 848
849extern ssize_t usb_show_dynids(struct usb_dynids *dynids, char *buf);
850
803/** 851/**
804 * struct usbdrv_wrap - wrapper for driver-model structure 852 * struct usbdrv_wrap - wrapper for driver-model structure
805 * @driver: The driver-model core driver structure. 853 * @driver: The driver-model core driver structure.
@@ -850,6 +898,9 @@ struct usbdrv_wrap {
850 * for interfaces bound to this driver. 898 * for interfaces bound to this driver.
851 * @soft_unbind: if set to 1, the USB core will not kill URBs and disable 899 * @soft_unbind: if set to 1, the USB core will not kill URBs and disable
852 * endpoints before calling the driver's disconnect method. 900 * endpoints before calling the driver's disconnect method.
901 * @disable_hub_initiated_lpm: if set to 0, the USB core will not allow hubs
902 * to initiate lower power link state transitions when an idle timeout
903 * occurs. Device-initiated USB 3.0 link PM will still be allowed.
853 * 904 *
854 * USB interface drivers must provide a name, probe() and disconnect() 905 * USB interface drivers must provide a name, probe() and disconnect()
855 * methods, and an id_table. Other driver fields are optional. 906 * methods, and an id_table. Other driver fields are optional.
@@ -890,6 +941,7 @@ struct usb_driver {
890 struct usbdrv_wrap drvwrap; 941 struct usbdrv_wrap drvwrap;
891 unsigned int no_dynamic_id:1; 942 unsigned int no_dynamic_id:1;
892 unsigned int supports_autosuspend:1; 943 unsigned int supports_autosuspend:1;
944 unsigned int disable_hub_initiated_lpm:1;
893 unsigned int soft_unbind:1; 945 unsigned int soft_unbind:1;
894}; 946};
895#define to_usb_driver(d) container_of(d, struct usb_driver, drvwrap.driver) 947#define to_usb_driver(d) container_of(d, struct usb_driver, drvwrap.driver)
@@ -1379,6 +1431,7 @@ extern int usb_unlink_urb(struct urb *urb);
1379extern void usb_kill_urb(struct urb *urb); 1431extern void usb_kill_urb(struct urb *urb);
1380extern void usb_poison_urb(struct urb *urb); 1432extern void usb_poison_urb(struct urb *urb);
1381extern void usb_unpoison_urb(struct urb *urb); 1433extern void usb_unpoison_urb(struct urb *urb);
1434extern void usb_block_urb(struct urb *urb);
1382extern void usb_kill_anchored_urbs(struct usb_anchor *anchor); 1435extern void usb_kill_anchored_urbs(struct usb_anchor *anchor);
1383extern void usb_poison_anchored_urbs(struct usb_anchor *anchor); 1436extern void usb_poison_anchored_urbs(struct usb_anchor *anchor);
1384extern void usb_unpoison_anchored_urbs(struct usb_anchor *anchor); 1437extern void usb_unpoison_anchored_urbs(struct usb_anchor *anchor);
@@ -1391,6 +1444,8 @@ extern struct urb *usb_get_from_anchor(struct usb_anchor *anchor);
1391extern void usb_scuttle_anchored_urbs(struct usb_anchor *anchor); 1444extern void usb_scuttle_anchored_urbs(struct usb_anchor *anchor);
1392extern int usb_anchor_empty(struct usb_anchor *anchor); 1445extern int usb_anchor_empty(struct usb_anchor *anchor);
1393 1446
1447#define usb_unblock_urb usb_unpoison_urb
1448
1394/** 1449/**
1395 * usb_urb_dir_in - check if an URB describes an IN transfer 1450 * usb_urb_dir_in - check if an URB describes an IN transfer
1396 * @urb: URB to be checked 1451 * @urb: URB to be checked
@@ -1627,6 +1682,7 @@ static inline int usb_translate_errors(int error_code)
1627 case 0: 1682 case 0:
1628 case -ENOMEM: 1683 case -ENOMEM:
1629 case -ENODEV: 1684 case -ENODEV:
1685 case -EOPNOTSUPP:
1630 return error_code; 1686 return error_code;
1631 default: 1687 default:
1632 return -EIO; 1688 return -EIO;
@@ -1652,9 +1708,6 @@ do { \
1652} while (0) 1708} while (0)
1653#endif 1709#endif
1654 1710
1655#define err(format, arg...) \
1656 printk(KERN_ERR KBUILD_MODNAME ": " format "\n", ##arg)
1657
1658/* debugfs stuff */ 1711/* debugfs stuff */
1659extern struct dentry *usb_debug_root; 1712extern struct dentry *usb_debug_root;
1660 1713
diff --git a/include/linux/usb/ch11.h b/include/linux/usb/ch11.h
index f1d26b6067f1..b6c2863b2c94 100644
--- a/include/linux/usb/ch11.h
+++ b/include/linux/usb/ch11.h
@@ -76,6 +76,8 @@
76#define USB_PORT_FEAT_C_BH_PORT_RESET 29 76#define USB_PORT_FEAT_C_BH_PORT_RESET 29
77#define USB_PORT_FEAT_FORCE_LINKPM_ACCEPT 30 77#define USB_PORT_FEAT_FORCE_LINKPM_ACCEPT 30
78 78
79#define USB_PORT_LPM_TIMEOUT(p) (((p) & 0xff) << 8)
80
79/* USB 3.0 hub remote wake mask bits, see table 10-14 */ 81/* USB 3.0 hub remote wake mask bits, see table 10-14 */
80#define USB_PORT_FEAT_REMOTE_WAKE_CONNECT (1 << 8) 82#define USB_PORT_FEAT_REMOTE_WAKE_CONNECT (1 << 8)
81#define USB_PORT_FEAT_REMOTE_WAKE_DISCONNECT (1 << 9) 83#define USB_PORT_FEAT_REMOTE_WAKE_DISCONNECT (1 << 9)
diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h
index af21f3115919..d1d732c2838d 100644
--- a/include/linux/usb/ch9.h
+++ b/include/linux/usb/ch9.h
@@ -88,6 +88,8 @@
88#define USB_REQ_GET_INTERFACE 0x0A 88#define USB_REQ_GET_INTERFACE 0x0A
89#define USB_REQ_SET_INTERFACE 0x0B 89#define USB_REQ_SET_INTERFACE 0x0B
90#define USB_REQ_SYNCH_FRAME 0x0C 90#define USB_REQ_SYNCH_FRAME 0x0C
91#define USB_REQ_SET_SEL 0x30
92#define USB_REQ_SET_ISOCH_DELAY 0x31
91 93
92#define USB_REQ_SET_ENCRYPTION 0x0D /* Wireless USB */ 94#define USB_REQ_SET_ENCRYPTION 0x0D /* Wireless USB */
93#define USB_REQ_GET_ENCRYPTION 0x0E 95#define USB_REQ_GET_ENCRYPTION 0x0E
@@ -390,6 +392,11 @@ struct usb_endpoint_descriptor {
390#define USB_ENDPOINT_XFER_INT 3 392#define USB_ENDPOINT_XFER_INT 3
391#define USB_ENDPOINT_MAX_ADJUSTABLE 0x80 393#define USB_ENDPOINT_MAX_ADJUSTABLE 0x80
392 394
395/* The USB 3.0 spec redefines bits 5:4 of bmAttributes as interrupt ep type. */
396#define USB_ENDPOINT_INTRTYPE 0x30
397#define USB_ENDPOINT_INTR_PERIODIC (0 << 4)
398#define USB_ENDPOINT_INTR_NOTIFICATION (1 << 4)
399
393#define USB_ENDPOINT_SYNCTYPE 0x0c 400#define USB_ENDPOINT_SYNCTYPE 0x0c
394#define USB_ENDPOINT_SYNC_NONE (0 << 2) 401#define USB_ENDPOINT_SYNC_NONE (0 << 2)
395#define USB_ENDPOINT_SYNC_ASYNC (1 << 2) 402#define USB_ENDPOINT_SYNC_ASYNC (1 << 2)
@@ -592,6 +599,12 @@ static inline int usb_endpoint_maxp(const struct usb_endpoint_descriptor *epd)
592 return __le16_to_cpu(epd->wMaxPacketSize); 599 return __le16_to_cpu(epd->wMaxPacketSize);
593} 600}
594 601
602static inline int usb_endpoint_interrupt_type(
603 const struct usb_endpoint_descriptor *epd)
604{
605 return epd->bmAttributes & USB_ENDPOINT_INTRTYPE;
606}
607
595/*-------------------------------------------------------------------------*/ 608/*-------------------------------------------------------------------------*/
596 609
597/* USB_DT_SS_ENDPOINT_COMP: SuperSpeed Endpoint Companion descriptor */ 610/* USB_DT_SS_ENDPOINT_COMP: SuperSpeed Endpoint Companion descriptor */
@@ -933,6 +946,51 @@ enum usb_device_state {
933 */ 946 */
934}; 947};
935 948
949enum usb3_link_state {
950 USB3_LPM_U0 = 0,
951 USB3_LPM_U1,
952 USB3_LPM_U2,
953 USB3_LPM_U3
954};
955
956/*
957 * A U1 timeout of 0x0 means the parent hub will reject any transitions to U1.
958 * 0xff means the parent hub will accept transitions to U1, but will not
959 * initiate a transition.
960 *
961 * A U1 timeout of 0x1 to 0x7F also causes the hub to initiate a transition to
962 * U1 after that many microseconds. Timeouts of 0x80 to 0xFE are reserved
963 * values.
964 *
965 * A U2 timeout of 0x0 means the parent hub will reject any transitions to U2.
966 * 0xff means the parent hub will accept transitions to U2, but will not
967 * initiate a transition.
968 *
969 * A U2 timeout of 0x1 to 0xFE also causes the hub to initiate a transition to
970 * U2 after N*256 microseconds. Therefore a U2 timeout value of 0x1 means a U2
971 * idle timer of 256 microseconds, 0x2 means 512 microseconds, 0xFE means
972 * 65.024ms.
973 */
974#define USB3_LPM_DISABLED 0x0
975#define USB3_LPM_U1_MAX_TIMEOUT 0x7F
976#define USB3_LPM_U2_MAX_TIMEOUT 0xFE
977#define USB3_LPM_DEVICE_INITIATED 0xFF
978
979struct usb_set_sel_req {
980 __u8 u1_sel;
981 __u8 u1_pel;
982 __le16 u2_sel;
983 __le16 u2_pel;
984} __attribute__ ((packed));
985
986/*
987 * The Set System Exit Latency control transfer provides one byte each for
988 * U1 SEL and U1 PEL, so the max exit latency is 0xFF. U2 SEL and U2 PEL each
989 * are two bytes long.
990 */
991#define USB3_LPM_MAX_U1_SEL_PEL 0xFF
992#define USB3_LPM_MAX_U2_SEL_PEL 0xFFFF
993
936/*-------------------------------------------------------------------------*/ 994/*-------------------------------------------------------------------------*/
937 995
938/* 996/*
diff --git a/include/linux/usb/chipidea.h b/include/linux/usb/chipidea.h
new file mode 100644
index 000000000000..edb90d6cfd12
--- /dev/null
+++ b/include/linux/usb/chipidea.h
@@ -0,0 +1,28 @@
1/*
2 * Platform data for the chipidea USB dual role controller
3 */
4
5#ifndef __LINUX_USB_CHIPIDEA_H
6#define __LINUX_USB_CHIPIDEA_H
7
8struct ci13xxx;
9struct ci13xxx_udc_driver {
10 const char *name;
11 /* offset of the capability registers */
12 uintptr_t capoffset;
13 unsigned power_budget;
14 unsigned long flags;
15#define CI13XXX_REGS_SHARED BIT(0)
16#define CI13XXX_REQUIRE_TRANSCEIVER BIT(1)
17#define CI13XXX_PULLUP_ON_VBUS BIT(2)
18#define CI13XXX_DISABLE_STREAMING BIT(3)
19
20#define CI13XXX_CONTROLLER_RESET_EVENT 0
21#define CI13XXX_CONTROLLER_STOPPED_EVENT 1
22 void (*notify_event) (struct ci13xxx *udc, unsigned event);
23};
24
25/* Default offset of capability registers */
26#define DEF_CAPOFFSET 0x100
27
28#endif
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h
index a316fba73518..9d8c3b634493 100644
--- a/include/linux/usb/composite.h
+++ b/include/linux/usb/composite.h
@@ -242,6 +242,9 @@ int usb_add_config(struct usb_composite_dev *,
242 struct usb_configuration *, 242 struct usb_configuration *,
243 int (*)(struct usb_configuration *)); 243 int (*)(struct usb_configuration *));
244 244
245void usb_remove_config(struct usb_composite_dev *,
246 struct usb_configuration *);
247
245/** 248/**
246 * struct usb_composite_driver - groups configurations into a gadget 249 * struct usb_composite_driver - groups configurations into a gadget
247 * @name: For diagnostics, identifies the driver. 250 * @name: For diagnostics, identifies the driver.
@@ -250,6 +253,8 @@ int usb_add_config(struct usb_composite_dev *,
250 * @iManufacturer: Used as iManufacturer override if @dev->iManufacturer is 253 * @iManufacturer: Used as iManufacturer override if @dev->iManufacturer is
251 * not set. If NULL a default "<system> <release> with <udc>" value 254 * not set. If NULL a default "<system> <release> with <udc>" value
252 * will be used. 255 * will be used.
256 * @iSerialNumber: Used as iSerialNumber override if @dev->iSerialNumber is
257 * not set.
253 * @dev: Template descriptor for the device, including default device 258 * @dev: Template descriptor for the device, including default device
254 * identifiers. 259 * identifiers.
255 * @strings: tables of strings, keyed by identifiers assigned during bind() 260 * @strings: tables of strings, keyed by identifiers assigned during bind()
@@ -280,6 +285,7 @@ struct usb_composite_driver {
280 const char *name; 285 const char *name;
281 const char *iProduct; 286 const char *iProduct;
282 const char *iManufacturer; 287 const char *iManufacturer;
288 const char *iSerialNumber;
283 const struct usb_device_descriptor *dev; 289 const struct usb_device_descriptor *dev;
284 struct usb_gadget_strings **strings; 290 struct usb_gadget_strings **strings;
285 enum usb_device_speed max_speed; 291 enum usb_device_speed max_speed;
diff --git a/include/linux/usb/functionfs.h b/include/linux/usb/functionfs.h
index 7587ef934ba8..a843d0851364 100644
--- a/include/linux/usb/functionfs.h
+++ b/include/linux/usb/functionfs.h
@@ -190,8 +190,10 @@ static int functionfs_ready_callback(struct ffs_data *ffs)
190 __attribute__((warn_unused_result, nonnull)); 190 __attribute__((warn_unused_result, nonnull));
191static void functionfs_closed_callback(struct ffs_data *ffs) 191static void functionfs_closed_callback(struct ffs_data *ffs)
192 __attribute__((nonnull)); 192 __attribute__((nonnull));
193static int functionfs_check_dev_callback(const char *dev_name) 193static void *functionfs_acquire_dev_callback(const char *dev_name)
194 __attribute__((warn_unused_result, nonnull)); 194 __attribute__((warn_unused_result, nonnull));
195static void functionfs_release_dev_callback(struct ffs_data *ffs_data)
196 __attribute__((nonnull));
195 197
196 198
197#endif 199#endif
diff --git a/include/linux/usb/gpio_vbus.h b/include/linux/usb/gpio_vbus.h
index d9f03ccc2d60..837bba604a0b 100644
--- a/include/linux/usb/gpio_vbus.h
+++ b/include/linux/usb/gpio_vbus.h
@@ -17,6 +17,7 @@
17 * @gpio_pullup: optional D+ or D- pullup GPIO (else negative/invalid) 17 * @gpio_pullup: optional D+ or D- pullup GPIO (else negative/invalid)
18 * @gpio_vbus_inverted: true if gpio_vbus is active low 18 * @gpio_vbus_inverted: true if gpio_vbus is active low
19 * @gpio_pullup_inverted: true if gpio_pullup is active low 19 * @gpio_pullup_inverted: true if gpio_pullup is active low
20 * @wakeup: configure gpio_vbus as a wake-up source
20 * 21 *
21 * The VBUS sensing GPIO should have a pulldown, which will normally be 22 * The VBUS sensing GPIO should have a pulldown, which will normally be
22 * part of a resistor ladder turning a 4.0V-5.25V level on VBUS into a 23 * part of a resistor ladder turning a 4.0V-5.25V level on VBUS into a
@@ -27,4 +28,5 @@ struct gpio_vbus_mach_info {
27 int gpio_pullup; 28 int gpio_pullup;
28 bool gpio_vbus_inverted; 29 bool gpio_vbus_inverted;
29 bool gpio_pullup_inverted; 30 bool gpio_pullup_inverted;
31 bool wakeup;
30}; 32};
diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h
index d28cc78a38e4..7f855d50cdf5 100644
--- a/include/linux/usb/hcd.h
+++ b/include/linux/usb/hcd.h
@@ -344,6 +344,15 @@ struct hc_driver {
344 */ 344 */
345 int (*update_device)(struct usb_hcd *, struct usb_device *); 345 int (*update_device)(struct usb_hcd *, struct usb_device *);
346 int (*set_usb2_hw_lpm)(struct usb_hcd *, struct usb_device *, int); 346 int (*set_usb2_hw_lpm)(struct usb_hcd *, struct usb_device *, int);
347 /* USB 3.0 Link Power Management */
348 /* Returns the USB3 hub-encoded value for the U1/U2 timeout. */
349 int (*enable_usb3_lpm_timeout)(struct usb_hcd *,
350 struct usb_device *, enum usb3_link_state state);
351 /* The xHCI host controller can still fail the command to
352 * disable the LPM timeouts, so this can return an error code.
353 */
354 int (*disable_usb3_lpm_timeout)(struct usb_hcd *,
355 struct usb_device *, enum usb3_link_state state);
347}; 356};
348 357
349extern int usb_hcd_link_urb_to_ep(struct usb_hcd *hcd, struct urb *urb); 358extern int usb_hcd_link_urb_to_ep(struct usb_hcd *hcd, struct urb *urb);
@@ -584,29 +593,6 @@ static inline void usb_hcd_resume_root_hub(struct usb_hcd *hcd)
584} 593}
585#endif /* CONFIG_USB_SUSPEND */ 594#endif /* CONFIG_USB_SUSPEND */
586 595
587
588/*
589 * USB device fs stuff
590 */
591
592#ifdef CONFIG_USB_DEVICEFS
593
594/*
595 * these are expected to be called from the USB core/hub thread
596 * with the kernel lock held
597 */
598extern void usbfs_update_special(void);
599extern int usbfs_init(void);
600extern void usbfs_cleanup(void);
601
602#else /* CONFIG_USB_DEVICEFS */
603
604static inline void usbfs_update_special(void) {}
605static inline int usbfs_init(void) { return 0; }
606static inline void usbfs_cleanup(void) { }
607
608#endif /* CONFIG_USB_DEVICEFS */
609
610/*-------------------------------------------------------------------------*/ 596/*-------------------------------------------------------------------------*/
611 597
612#if defined(CONFIG_USB_MON) || defined(CONFIG_USB_MON_MODULE) 598#if defined(CONFIG_USB_MON) || defined(CONFIG_USB_MON_MODULE)
diff --git a/include/linux/usb/isp1301.h b/include/linux/usb/isp1301.h
new file mode 100644
index 000000000000..d3a851c28b6a
--- /dev/null
+++ b/include/linux/usb/isp1301.h
@@ -0,0 +1,80 @@
1/*
2 * NXP ISP1301 USB transceiver driver
3 *
4 * Copyright (C) 2012 Roland Stigge <stigge@antcom.de>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 */
16
17#ifndef __LINUX_USB_ISP1301_H
18#define __LINUX_USB_ISP1301_H
19
20#include <linux/of.h>
21
22/* I2C Register definitions: */
23
24#define ISP1301_I2C_MODE_CONTROL_1 0x04 /* u8 read, set, +1 clear */
25
26#define MC1_SPEED_REG (1 << 0)
27#define MC1_SUSPEND_REG (1 << 1)
28#define MC1_DAT_SE0 (1 << 2)
29#define MC1_TRANSPARENT (1 << 3)
30#define MC1_BDIS_ACON_EN (1 << 4)
31#define MC1_OE_INT_EN (1 << 5)
32#define MC1_UART_EN (1 << 6)
33#define MC1_MASK 0x7f
34
35#define ISP1301_I2C_MODE_CONTROL_2 0x12 /* u8 read, set, +1 clear */
36
37#define MC2_GLOBAL_PWR_DN (1 << 0)
38#define MC2_SPD_SUSP_CTRL (1 << 1)
39#define MC2_BI_DI (1 << 2)
40#define MC2_TRANSP_BDIR0 (1 << 3)
41#define MC2_TRANSP_BDIR1 (1 << 4)
42#define MC2_AUDIO_EN (1 << 5)
43#define MC2_PSW_EN (1 << 6)
44#define MC2_EN2V7 (1 << 7)
45
46#define ISP1301_I2C_OTG_CONTROL_1 0x06 /* u8 read, set, +1 clear */
47
48#define OTG1_DP_PULLUP (1 << 0)
49#define OTG1_DM_PULLUP (1 << 1)
50#define OTG1_DP_PULLDOWN (1 << 2)
51#define OTG1_DM_PULLDOWN (1 << 3)
52#define OTG1_ID_PULLDOWN (1 << 4)
53#define OTG1_VBUS_DRV (1 << 5)
54#define OTG1_VBUS_DISCHRG (1 << 6)
55#define OTG1_VBUS_CHRG (1 << 7)
56
57#define ISP1301_I2C_OTG_CONTROL_2 0x10 /* u8 readonly */
58
59#define OTG_B_SESS_END (1 << 6)
60#define OTG_B_SESS_VLD (1 << 7)
61
62#define ISP1301_I2C_INTERRUPT_SOURCE 0x8
63#define ISP1301_I2C_INTERRUPT_LATCH 0xA
64#define ISP1301_I2C_INTERRUPT_FALLING 0xC
65#define ISP1301_I2C_INTERRUPT_RISING 0xE
66
67#define INT_VBUS_VLD (1 << 0)
68#define INT_SESS_VLD (1 << 1)
69#define INT_DP_HI (1 << 2)
70#define INT_ID_GND (1 << 3)
71#define INT_DM_HI (1 << 4)
72#define INT_ID_FLOAT (1 << 5)
73#define INT_BDIS_ACON (1 << 6)
74#define INT_CR_INT (1 << 7)
75
76#define ISP1301_I2C_REG_CLEAR_ADDR 1 /* Register Address Modifier */
77
78struct i2c_client *isp1301_get_client(struct device_node *node);
79
80#endif /* __LINUX_USB_ISP1301_H */
diff --git a/include/linux/usb/langwell_udc.h b/include/linux/usb/langwell_udc.h
deleted file mode 100644
index 2d2d1bbad9d2..000000000000
--- a/include/linux/usb/langwell_udc.h
+++ /dev/null
@@ -1,310 +0,0 @@
1/*
2 * Intel Langwell USB Device Controller driver
3 * Copyright (C) 2008-2009, Intel Corporation.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
17 *
18 */
19
20#ifndef __LANGWELL_UDC_H
21#define __LANGWELL_UDC_H
22
23
24/* MACRO defines */
25#define CAP_REG_OFFSET 0x0
26#define OP_REG_OFFSET 0x28
27
28#define DMA_ADDR_INVALID (~(dma_addr_t)0)
29
30#define DQH_ALIGNMENT 2048
31#define DTD_ALIGNMENT 64
32#define DMA_BOUNDARY 4096
33
34#define EP0_MAX_PKT_SIZE 64
35#define EP_DIR_IN 1
36#define EP_DIR_OUT 0
37
38#define FLUSH_TIMEOUT 1000
39#define RESET_TIMEOUT 1000
40#define SETUPSTAT_TIMEOUT 100
41#define PRIME_TIMEOUT 100
42
43
44/* device memory space registers */
45
46/* Capability Registers, BAR0 + CAP_REG_OFFSET */
47struct langwell_cap_regs {
48 /* offset: 0x0 */
49 u8 caplength; /* offset of Operational Register */
50 u8 _reserved3;
51 u16 hciversion; /* H: BCD encoding of host version */
52 u32 hcsparams; /* H: host port steering logic capability */
53 u32 hccparams; /* H: host multiple mode control capability */
54#define HCC_LEN BIT(17) /* Link power management (LPM) capability */
55 u8 _reserved4[0x20-0xc];
56 /* offset: 0x20 */
57 u16 dciversion; /* BCD encoding of device version */
58 u8 _reserved5[0x24-0x22];
59 u32 dccparams; /* overall device controller capability */
60#define HOSTCAP BIT(8) /* host capable */
61#define DEVCAP BIT(7) /* device capable */
62#define DEN(d) \
63 (((d)>>0)&0x1f) /* bits 4:0, device endpoint number */
64} __attribute__ ((packed));
65
66
67/* Operational Registers, BAR0 + OP_REG_OFFSET */
68struct langwell_op_regs {
69 /* offset: 0x28 */
70 u32 extsts;
71#define EXTS_TI1 BIT(4) /* general purpose timer interrupt 1 */
72#define EXTS_TI1TI0 BIT(3) /* general purpose timer interrupt 0 */
73#define EXTS_TI1UPI BIT(2) /* USB host periodic interrupt */
74#define EXTS_TI1UAI BIT(1) /* USB host asynchronous interrupt */
75#define EXTS_TI1NAKI BIT(0) /* NAK interrupt */
76 u32 extintr;
77#define EXTI_TIE1 BIT(4) /* general purpose timer interrupt enable 1 */
78#define EXTI_TIE0 BIT(3) /* general purpose timer interrupt enable 0 */
79#define EXTI_UPIE BIT(2) /* USB host periodic interrupt enable */
80#define EXTI_UAIE BIT(1) /* USB host asynchronous interrupt enable */
81#define EXTI_NAKE BIT(0) /* NAK interrupt enable */
82 /* offset: 0x30 */
83 u32 usbcmd;
84#define CMD_HIRD(u) \
85 (((u)>>24)&0xf) /* bits 27:24, host init resume duration */
86#define CMD_ITC(u) \
87 (((u)>>16)&0xff) /* bits 23:16, interrupt threshold control */
88#define CMD_PPE BIT(15) /* per-port change events enable */
89#define CMD_ATDTW BIT(14) /* add dTD tripwire */
90#define CMD_SUTW BIT(13) /* setup tripwire */
91#define CMD_ASPE BIT(11) /* asynchronous schedule park mode enable */
92#define CMD_FS2 BIT(10) /* frame list size */
93#define CMD_ASP1 BIT(9) /* asynchronous schedule park mode count */
94#define CMD_ASP0 BIT(8)
95#define CMD_LR BIT(7) /* light host/device controller reset */
96#define CMD_IAA BIT(6) /* interrupt on async advance doorbell */
97#define CMD_ASE BIT(5) /* asynchronous schedule enable */
98#define CMD_PSE BIT(4) /* periodic schedule enable */
99#define CMD_FS1 BIT(3)
100#define CMD_FS0 BIT(2)
101#define CMD_RST BIT(1) /* controller reset */
102#define CMD_RUNSTOP BIT(0) /* run/stop */
103 u32 usbsts;
104#define STS_PPCI(u) \
105 (((u)>>16)&0xffff) /* bits 31:16, port-n change detect */
106#define STS_AS BIT(15) /* asynchronous schedule status */
107#define STS_PS BIT(14) /* periodic schedule status */
108#define STS_RCL BIT(13) /* reclamation */
109#define STS_HCH BIT(12) /* HC halted */
110#define STS_ULPII BIT(10) /* ULPI interrupt */
111#define STS_SLI BIT(8) /* DC suspend */
112#define STS_SRI BIT(7) /* SOF received */
113#define STS_URI BIT(6) /* USB reset received */
114#define STS_AAI BIT(5) /* interrupt on async advance */
115#define STS_SEI BIT(4) /* system error */
116#define STS_FRI BIT(3) /* frame list rollover */
117#define STS_PCI BIT(2) /* port change detect */
118#define STS_UEI BIT(1) /* USB error interrupt */
119#define STS_UI BIT(0) /* USB interrupt */
120 u32 usbintr;
121/* bits 31:16, per-port interrupt enable */
122#define INTR_PPCE(u) (((u)>>16)&0xffff)
123#define INTR_ULPIE BIT(10) /* ULPI enable */
124#define INTR_SLE BIT(8) /* DC sleep/suspend enable */
125#define INTR_SRE BIT(7) /* SOF received enable */
126#define INTR_URE BIT(6) /* USB reset enable */
127#define INTR_AAE BIT(5) /* interrupt on async advance enable */
128#define INTR_SEE BIT(4) /* system error enable */
129#define INTR_FRE BIT(3) /* frame list rollover enable */
130#define INTR_PCE BIT(2) /* port change detect enable */
131#define INTR_UEE BIT(1) /* USB error interrupt enable */
132#define INTR_UE BIT(0) /* USB interrupt enable */
133 u32 frindex; /* frame index */
134#define FRINDEX_MASK (0x3fff << 0)
135 u32 ctrldssegment; /* not used */
136 u32 deviceaddr;
137#define USBADR_SHIFT 25
138#define USBADR(d) \
139 (((d)>>25)&0x7f) /* bits 31:25, device address */
140#define USBADR_MASK (0x7f << 25)
141#define USBADRA BIT(24) /* device address advance */
142 u32 endpointlistaddr;/* endpoint list top memory address */
143/* bits 31:11, endpoint list pointer */
144#define EPBASE(d) (((d)>>11)&0x1fffff)
145#define ENDPOINTLISTADDR_MASK (0x1fffff << 11)
146 u32 ttctrl; /* H: TT operatin, not used */
147 /* offset: 0x50 */
148 u32 burstsize; /* burst size of data movement */
149#define TXPBURST(b) \
150 (((b)>>8)&0xff) /* bits 15:8, TX burst length */
151#define RXPBURST(b) \
152 (((b)>>0)&0xff) /* bits 7:0, RX burst length */
153 u32 txfilltuning; /* TX tuning */
154 u32 txttfilltuning; /* H: TX TT tuning */
155 u32 ic_usb; /* control the IC_USB FS/LS transceiver */
156 /* offset: 0x60 */
157 u32 ulpi_viewport; /* indirect access to ULPI PHY */
158#define ULPIWU BIT(31) /* ULPI wakeup */
159#define ULPIRUN BIT(30) /* ULPI read/write run */
160#define ULPIRW BIT(29) /* ULPI read/write control */
161#define ULPISS BIT(27) /* ULPI sync state */
162#define ULPIPORT(u) \
163 (((u)>>24)&7) /* bits 26:24, ULPI port number */
164#define ULPIADDR(u) \
165 (((u)>>16)&0xff) /* bits 23:16, ULPI data address */
166#define ULPIDATRD(u) \
167 (((u)>>8)&0xff) /* bits 15:8, ULPI data read */
168#define ULPIDATWR(u) \
169 (((u)>>0)&0xff) /* bits 7:0, ULPI date write */
170 u8 _reserved6[0x70-0x64];
171 /* offset: 0x70 */
172 u32 configflag; /* H: not used */
173 u32 portsc1; /* port status */
174#define DA(p) \
175 (((p)>>25)&0x7f) /* bits 31:25, device address */
176#define PORTS_SSTS (BIT(24) | BIT(23)) /* suspend status */
177#define PORTS_WKOC BIT(22) /* wake on over-current enable */
178#define PORTS_WKDS BIT(21) /* wake on disconnect enable */
179#define PORTS_WKCN BIT(20) /* wake on connect enable */
180#define PORTS_PTC(p) (((p)>>16)&0xf) /* bits 19:16, port test control */
181#define PORTS_PIC (BIT(15) | BIT(14)) /* port indicator control */
182#define PORTS_PO BIT(13) /* port owner */
183#define PORTS_PP BIT(12) /* port power */
184#define PORTS_LS (BIT(11) | BIT(10)) /* line status */
185#define PORTS_SLP BIT(9) /* suspend using L1 */
186#define PORTS_PR BIT(8) /* port reset */
187#define PORTS_SUSP BIT(7) /* suspend */
188#define PORTS_FPR BIT(6) /* force port resume */
189#define PORTS_OCC BIT(5) /* over-current change */
190#define PORTS_OCA BIT(4) /* over-current active */
191#define PORTS_PEC BIT(3) /* port enable/disable change */
192#define PORTS_PE BIT(2) /* port enable/disable */
193#define PORTS_CSC BIT(1) /* connect status change */
194#define PORTS_CCS BIT(0) /* current connect status */
195 u8 _reserved7[0xb4-0x78];
196 /* offset: 0xb4 */
197 u32 devlc; /* control LPM and each USB port behavior */
198/* bits 31:29, parallel transceiver select */
199#define LPM_PTS(d) (((d)>>29)&7)
200#define LPM_STS BIT(28) /* serial transceiver select */
201#define LPM_PTW BIT(27) /* parallel transceiver width */
202#define LPM_PSPD(d) (((d)>>25)&3) /* bits 26:25, port speed */
203#define LPM_PSPD_MASK (BIT(26) | BIT(25))
204#define LPM_SPEED_FULL 0
205#define LPM_SPEED_LOW 1
206#define LPM_SPEED_HIGH 2
207#define LPM_SRT BIT(24) /* shorten reset time */
208#define LPM_PFSC BIT(23) /* port force full speed connect */
209#define LPM_PHCD BIT(22) /* PHY low power suspend clock disable */
210#define LPM_STL BIT(16) /* STALL reply to LPM token */
211#define LPM_BA(d) \
212 (((d)>>1)&0x7ff) /* bits 11:1, BmAttributes */
213#define LPM_NYT_ACK BIT(0) /* NYET/ACK reply to LPM token */
214 u8 _reserved8[0xf4-0xb8];
215 /* offset: 0xf4 */
216 u32 otgsc; /* On-The-Go status and control */
217#define OTGSC_DPIE BIT(30) /* data pulse interrupt enable */
218#define OTGSC_MSE BIT(29) /* 1 ms timer interrupt enable */
219#define OTGSC_BSEIE BIT(28) /* B session end interrupt enable */
220#define OTGSC_BSVIE BIT(27) /* B session valid interrupt enable */
221#define OTGSC_ASVIE BIT(26) /* A session valid interrupt enable */
222#define OTGSC_AVVIE BIT(25) /* A VBUS valid interrupt enable */
223#define OTGSC_IDIE BIT(24) /* USB ID interrupt enable */
224#define OTGSC_DPIS BIT(22) /* data pulse interrupt status */
225#define OTGSC_MSS BIT(21) /* 1 ms timer interrupt status */
226#define OTGSC_BSEIS BIT(20) /* B session end interrupt status */
227#define OTGSC_BSVIS BIT(19) /* B session valid interrupt status */
228#define OTGSC_ASVIS BIT(18) /* A session valid interrupt status */
229#define OTGSC_AVVIS BIT(17) /* A VBUS valid interrupt status */
230#define OTGSC_IDIS BIT(16) /* USB ID interrupt status */
231#define OTGSC_DPS BIT(14) /* data bus pulsing status */
232#define OTGSC_MST BIT(13) /* 1 ms timer toggle */
233#define OTGSC_BSE BIT(12) /* B session end */
234#define OTGSC_BSV BIT(11) /* B session valid */
235#define OTGSC_ASV BIT(10) /* A session valid */
236#define OTGSC_AVV BIT(9) /* A VBUS valid */
237#define OTGSC_USBID BIT(8) /* USB ID */
238#define OTGSC_HABA BIT(7) /* hw assist B-disconnect to A-connect */
239#define OTGSC_HADP BIT(6) /* hw assist data pulse */
240#define OTGSC_IDPU BIT(5) /* ID pullup */
241#define OTGSC_DP BIT(4) /* data pulsing */
242#define OTGSC_OT BIT(3) /* OTG termination */
243#define OTGSC_HAAR BIT(2) /* hw assist auto reset */
244#define OTGSC_VC BIT(1) /* VBUS charge */
245#define OTGSC_VD BIT(0) /* VBUS discharge */
246 u32 usbmode;
247#define MODE_VBPS BIT(5) /* R/W VBUS power select */
248#define MODE_SDIS BIT(4) /* R/W stream disable mode */
249#define MODE_SLOM BIT(3) /* R/W setup lockout mode */
250#define MODE_ENSE BIT(2) /* endian select */
251#define MODE_CM(u) (((u)>>0)&3) /* bits 1:0, controller mode */
252#define MODE_IDLE 0
253#define MODE_DEVICE 2
254#define MODE_HOST 3
255 u8 _reserved9[0x100-0xfc];
256 /* offset: 0x100 */
257 u32 endptnak;
258#define EPTN(e) \
259 (((e)>>16)&0xffff) /* bits 31:16, TX endpoint NAK */
260#define EPRN(e) \
261 (((e)>>0)&0xffff) /* bits 15:0, RX endpoint NAK */
262 u32 endptnaken;
263#define EPTNE(e) \
264 (((e)>>16)&0xffff) /* bits 31:16, TX endpoint NAK enable */
265#define EPRNE(e) \
266 (((e)>>0)&0xffff) /* bits 15:0, RX endpoint NAK enable */
267 u32 endptsetupstat;
268#define SETUPSTAT_MASK (0xffff << 0) /* bits 15:0 */
269#define EP0SETUPSTAT_MASK 1
270 u32 endptprime;
271/* bits 31:16, prime endpoint transmit buffer */
272#define PETB(e) (((e)>>16)&0xffff)
273/* bits 15:0, prime endpoint receive buffer */
274#define PERB(e) (((e)>>0)&0xffff)
275 /* offset: 0x110 */
276 u32 endptflush;
277/* bits 31:16, flush endpoint transmit buffer */
278#define FETB(e) (((e)>>16)&0xffff)
279/* bits 15:0, flush endpoint receive buffer */
280#define FERB(e) (((e)>>0)&0xffff)
281 u32 endptstat;
282/* bits 31:16, endpoint transmit buffer ready */
283#define ETBR(e) (((e)>>16)&0xffff)
284/* bits 15:0, endpoint receive buffer ready */
285#define ERBR(e) (((e)>>0)&0xffff)
286 u32 endptcomplete;
287/* bits 31:16, endpoint transmit complete event */
288#define ETCE(e) (((e)>>16)&0xffff)
289/* bits 15:0, endpoint receive complete event */
290#define ERCE(e) (((e)>>0)&0xffff)
291 /* offset: 0x11c */
292 u32 endptctrl[16];
293#define EPCTRL_TXE BIT(23) /* TX endpoint enable */
294#define EPCTRL_TXR BIT(22) /* TX data toggle reset */
295#define EPCTRL_TXI BIT(21) /* TX data toggle inhibit */
296#define EPCTRL_TXT(e) (((e)>>18)&3) /* bits 19:18, TX endpoint type */
297#define EPCTRL_TXT_SHIFT 18
298#define EPCTRL_TXD BIT(17) /* TX endpoint data source */
299#define EPCTRL_TXS BIT(16) /* TX endpoint STALL */
300#define EPCTRL_RXE BIT(7) /* RX endpoint enable */
301#define EPCTRL_RXR BIT(6) /* RX data toggle reset */
302#define EPCTRL_RXI BIT(5) /* RX data toggle inhibit */
303#define EPCTRL_RXT(e) (((e)>>2)&3) /* bits 3:2, RX endpoint type */
304#define EPCTRL_RXT_SHIFT 2 /* bits 19:18, TX endpoint type */
305#define EPCTRL_RXD BIT(1) /* RX endpoint data sink */
306#define EPCTRL_RXS BIT(0) /* RX endpoint STALL */
307} __attribute__ ((packed));
308
309#endif /* __LANGWELL_UDC_H */
310
diff --git a/include/linux/usb/rndis_host.h b/include/linux/usb/rndis_host.h
index 88fceb718c77..d44ef85db177 100644
--- a/include/linux/usb/rndis_host.h
+++ b/include/linux/usb/rndis_host.h
@@ -20,6 +20,8 @@
20#ifndef __LINUX_USB_RNDIS_HOST_H 20#ifndef __LINUX_USB_RNDIS_HOST_H
21#define __LINUX_USB_RNDIS_HOST_H 21#define __LINUX_USB_RNDIS_HOST_H
22 22
23#include <linux/rndis.h>
24
23/* 25/*
24 * CONTROL uses CDC "encapsulated commands" with funky notifications. 26 * CONTROL uses CDC "encapsulated commands" with funky notifications.
25 * - control-out: SEND_ENCAPSULATED 27 * - control-out: SEND_ENCAPSULATED
@@ -49,47 +51,6 @@ struct rndis_msg_hdr {
49 */ 51 */
50#define RNDIS_CONTROL_TIMEOUT_MS (5 * 1000) 52#define RNDIS_CONTROL_TIMEOUT_MS (5 * 1000)
51 53
52#define RNDIS_MSG_COMPLETION cpu_to_le32(0x80000000)
53
54/* codes for "msg_type" field of rndis messages;
55 * only the data channel uses packet messages (maybe batched);
56 * everything else goes on the control channel.
57 */
58#define RNDIS_MSG_PACKET cpu_to_le32(0x00000001) /* 1-N packets */
59#define RNDIS_MSG_INIT cpu_to_le32(0x00000002)
60#define RNDIS_MSG_INIT_C (RNDIS_MSG_INIT|RNDIS_MSG_COMPLETION)
61#define RNDIS_MSG_HALT cpu_to_le32(0x00000003)
62#define RNDIS_MSG_QUERY cpu_to_le32(0x00000004)
63#define RNDIS_MSG_QUERY_C (RNDIS_MSG_QUERY|RNDIS_MSG_COMPLETION)
64#define RNDIS_MSG_SET cpu_to_le32(0x00000005)
65#define RNDIS_MSG_SET_C (RNDIS_MSG_SET|RNDIS_MSG_COMPLETION)
66#define RNDIS_MSG_RESET cpu_to_le32(0x00000006)
67#define RNDIS_MSG_RESET_C (RNDIS_MSG_RESET|RNDIS_MSG_COMPLETION)
68#define RNDIS_MSG_INDICATE cpu_to_le32(0x00000007)
69#define RNDIS_MSG_KEEPALIVE cpu_to_le32(0x00000008)
70#define RNDIS_MSG_KEEPALIVE_C (RNDIS_MSG_KEEPALIVE|RNDIS_MSG_COMPLETION)
71
72/* codes for "status" field of completion messages */
73#define RNDIS_STATUS_SUCCESS cpu_to_le32(0x00000000)
74#define RNDIS_STATUS_FAILURE cpu_to_le32(0xc0000001)
75#define RNDIS_STATUS_INVALID_DATA cpu_to_le32(0xc0010015)
76#define RNDIS_STATUS_NOT_SUPPORTED cpu_to_le32(0xc00000bb)
77#define RNDIS_STATUS_MEDIA_CONNECT cpu_to_le32(0x4001000b)
78#define RNDIS_STATUS_MEDIA_DISCONNECT cpu_to_le32(0x4001000c)
79#define RNDIS_STATUS_MEDIA_SPECIFIC_INDICATION cpu_to_le32(0x40010012)
80
81/* codes for OID_GEN_PHYSICAL_MEDIUM */
82#define RNDIS_PHYSICAL_MEDIUM_UNSPECIFIED cpu_to_le32(0x00000000)
83#define RNDIS_PHYSICAL_MEDIUM_WIRELESS_LAN cpu_to_le32(0x00000001)
84#define RNDIS_PHYSICAL_MEDIUM_CABLE_MODEM cpu_to_le32(0x00000002)
85#define RNDIS_PHYSICAL_MEDIUM_PHONE_LINE cpu_to_le32(0x00000003)
86#define RNDIS_PHYSICAL_MEDIUM_POWER_LINE cpu_to_le32(0x00000004)
87#define RNDIS_PHYSICAL_MEDIUM_DSL cpu_to_le32(0x00000005)
88#define RNDIS_PHYSICAL_MEDIUM_FIBRE_CHANNEL cpu_to_le32(0x00000006)
89#define RNDIS_PHYSICAL_MEDIUM_1394 cpu_to_le32(0x00000007)
90#define RNDIS_PHYSICAL_MEDIUM_WIRELESS_WAN cpu_to_le32(0x00000008)
91#define RNDIS_PHYSICAL_MEDIUM_MAX cpu_to_le32(0x00000009)
92
93struct rndis_data_hdr { 54struct rndis_data_hdr {
94 __le32 msg_type; /* RNDIS_MSG_PACKET */ 55 __le32 msg_type; /* RNDIS_MSG_PACKET */
95 __le32 msg_len; /* rndis_data_hdr + data_len + pad */ 56 __le32 msg_len; /* rndis_data_hdr + data_len + pad */
@@ -222,29 +183,6 @@ struct rndis_keepalive_c { /* IN (optionally OUT) */
222 __le32 status; 183 __le32 status;
223} __attribute__ ((packed)); 184} __attribute__ ((packed));
224 185
225/* NOTE: about 30 OIDs are "mandatory" for peripherals to support ... and
226 * there are gobs more that may optionally be supported. We'll avoid as much
227 * of that mess as possible.
228 */
229#define OID_802_3_PERMANENT_ADDRESS cpu_to_le32(0x01010101)
230#define OID_GEN_MAXIMUM_FRAME_SIZE cpu_to_le32(0x00010106)
231#define OID_GEN_CURRENT_PACKET_FILTER cpu_to_le32(0x0001010e)
232#define OID_GEN_PHYSICAL_MEDIUM cpu_to_le32(0x00010202)
233
234/* packet filter bits used by OID_GEN_CURRENT_PACKET_FILTER */
235#define RNDIS_PACKET_TYPE_DIRECTED cpu_to_le32(0x00000001)
236#define RNDIS_PACKET_TYPE_MULTICAST cpu_to_le32(0x00000002)
237#define RNDIS_PACKET_TYPE_ALL_MULTICAST cpu_to_le32(0x00000004)
238#define RNDIS_PACKET_TYPE_BROADCAST cpu_to_le32(0x00000008)
239#define RNDIS_PACKET_TYPE_SOURCE_ROUTING cpu_to_le32(0x00000010)
240#define RNDIS_PACKET_TYPE_PROMISCUOUS cpu_to_le32(0x00000020)
241#define RNDIS_PACKET_TYPE_SMT cpu_to_le32(0x00000040)
242#define RNDIS_PACKET_TYPE_ALL_LOCAL cpu_to_le32(0x00000080)
243#define RNDIS_PACKET_TYPE_GROUP cpu_to_le32(0x00001000)
244#define RNDIS_PACKET_TYPE_ALL_FUNCTIONAL cpu_to_le32(0x00002000)
245#define RNDIS_PACKET_TYPE_FUNCTIONAL cpu_to_le32(0x00004000)
246#define RNDIS_PACKET_TYPE_MAC_FRAME cpu_to_le32(0x00008000)
247
248/* default filter used with RNDIS devices */ 186/* default filter used with RNDIS devices */
249#define RNDIS_DEFAULT_FILTER ( \ 187#define RNDIS_DEFAULT_FILTER ( \
250 RNDIS_PACKET_TYPE_DIRECTED | \ 188 RNDIS_PACKET_TYPE_DIRECTED | \
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h
index 474283888233..86c0b451745d 100644
--- a/include/linux/usb/serial.h
+++ b/include/linux/usb/serial.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * USB Serial Converter stuff 2 * USB Serial Converter stuff
3 * 3 *
4 * Copyright (C) 1999 - 2005 4 * Copyright (C) 1999 - 2012
5 * Greg Kroah-Hartman (greg@kroah.com) 5 * Greg Kroah-Hartman (greg@kroah.com)
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
@@ -249,6 +249,7 @@ struct usb_serial_driver {
249 249
250 int (*suspend)(struct usb_serial *serial, pm_message_t message); 250 int (*suspend)(struct usb_serial *serial, pm_message_t message);
251 int (*resume)(struct usb_serial *serial); 251 int (*resume)(struct usb_serial *serial);
252 int (*reset_resume)(struct usb_serial *serial);
252 253
253 /* serial function calls */ 254 /* serial function calls */
254 /* Called by console and by the tty layer */ 255 /* Called by console and by the tty layer */
@@ -292,16 +293,11 @@ struct usb_serial_driver {
292#define to_usb_serial_driver(d) \ 293#define to_usb_serial_driver(d) \
293 container_of(d, struct usb_serial_driver, driver) 294 container_of(d, struct usb_serial_driver, driver)
294 295
295extern int usb_serial_register_drivers(struct usb_driver *udriver, 296extern int usb_serial_register_drivers(struct usb_serial_driver *const serial_drivers[],
296 struct usb_serial_driver * const serial_drivers[]); 297 const char *name, const struct usb_device_id *id_table);
297extern void usb_serial_deregister_drivers(struct usb_driver *udriver, 298extern void usb_serial_deregister_drivers(struct usb_serial_driver *const serial_drivers[]);
298 struct usb_serial_driver * const serial_drivers[]);
299extern void usb_serial_port_softint(struct usb_serial_port *port); 299extern void usb_serial_port_softint(struct usb_serial_port *port);
300 300
301extern int usb_serial_probe(struct usb_interface *iface,
302 const struct usb_device_id *id);
303extern void usb_serial_disconnect(struct usb_interface *iface);
304
305extern int usb_serial_suspend(struct usb_interface *intf, pm_message_t message); 301extern int usb_serial_suspend(struct usb_interface *intf, pm_message_t message);
306extern int usb_serial_resume(struct usb_interface *intf); 302extern int usb_serial_resume(struct usb_interface *intf);
307 303
@@ -400,8 +396,8 @@ do { \
400 396
401/* 397/*
402 * module_usb_serial_driver() - Helper macro for registering a USB Serial driver 398 * module_usb_serial_driver() - Helper macro for registering a USB Serial driver
403 * @__usb_driver: usb_driver struct to register
404 * @__serial_drivers: list of usb_serial drivers to register 399 * @__serial_drivers: list of usb_serial drivers to register
400 * @__ids: all device ids that @__serial_drivers bind to
405 * 401 *
406 * Helper macro for USB serial drivers which do not do anything special 402 * Helper macro for USB serial drivers which do not do anything special
407 * in module init/exit. This eliminates a lot of boilerplate. Each 403 * in module init/exit. This eliminates a lot of boilerplate. Each
@@ -409,9 +405,21 @@ do { \
409 * module_init() and module_exit() 405 * module_init() and module_exit()
410 * 406 *
411 */ 407 */
412#define module_usb_serial_driver(__usb_driver, __serial_drivers) \ 408#define usb_serial_module_driver(__name, __serial_drivers, __ids) \
413 module_driver(__usb_driver, usb_serial_register_drivers, \ 409static int __init usb_serial_module_init(void) \
414 usb_serial_deregister_drivers, __serial_drivers) 410{ \
411 return usb_serial_register_drivers(__serial_drivers, \
412 __name, __ids); \
413} \
414module_init(usb_serial_module_init); \
415static void __exit usb_serial_module_exit(void) \
416{ \
417 usb_serial_deregister_drivers(__serial_drivers); \
418} \
419module_exit(usb_serial_module_exit);
420
421#define module_usb_serial_driver(__serial_drivers, __ids) \
422 usb_serial_module_driver(KBUILD_MODNAME, __serial_drivers, __ids)
415 423
416#endif /* __LINUX_USB_SERIAL_H */ 424#endif /* __LINUX_USB_SERIAL_H */
417 425
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
index 605b0aa8d852..76f439647c4b 100644
--- a/include/linux/usb/usbnet.h
+++ b/include/linux/usb/usbnet.h
@@ -191,7 +191,8 @@ extern void usbnet_cdc_status(struct usbnet *, struct urb *);
191enum skb_state { 191enum skb_state {
192 illegal = 0, 192 illegal = 0,
193 tx_start, tx_done, 193 tx_start, tx_done,
194 rx_start, rx_done, rx_cleanup 194 rx_start, rx_done, rx_cleanup,
195 unlink_start
195}; 196};
196 197
197struct skb_data { /* skb->cb is one of these */ 198struct skb_data { /* skb->cb is one of these */
diff --git a/include/linux/user_namespace.h b/include/linux/user_namespace.h
index faf467944baf..4e72922e5a75 100644
--- a/include/linux/user_namespace.h
+++ b/include/linux/user_namespace.h
@@ -6,14 +6,24 @@
6#include <linux/sched.h> 6#include <linux/sched.h>
7#include <linux/err.h> 7#include <linux/err.h>
8 8
9#define UIDHASH_BITS (CONFIG_BASE_SMALL ? 3 : 7) 9#define UID_GID_MAP_MAX_EXTENTS 5
10#define UIDHASH_SZ (1 << UIDHASH_BITS) 10
11struct uid_gid_map { /* 64 bytes -- 1 cache line */
12 u32 nr_extents;
13 struct uid_gid_extent {
14 u32 first;
15 u32 lower_first;
16 u32 count;
17 } extent[UID_GID_MAP_MAX_EXTENTS];
18};
11 19
12struct user_namespace { 20struct user_namespace {
21 struct uid_gid_map uid_map;
22 struct uid_gid_map gid_map;
13 struct kref kref; 23 struct kref kref;
14 struct hlist_head uidhash_table[UIDHASH_SZ]; 24 struct user_namespace *parent;
15 struct user_struct *creator; 25 kuid_t owner;
16 struct work_struct destroyer; 26 kgid_t group;
17}; 27};
18 28
19extern struct user_namespace init_user_ns; 29extern struct user_namespace init_user_ns;
@@ -36,9 +46,11 @@ static inline void put_user_ns(struct user_namespace *ns)
36 kref_put(&ns->kref, free_user_ns); 46 kref_put(&ns->kref, free_user_ns);
37} 47}
38 48
39uid_t user_ns_map_uid(struct user_namespace *to, const struct cred *cred, uid_t uid); 49struct seq_operations;
40gid_t user_ns_map_gid(struct user_namespace *to, const struct cred *cred, gid_t gid); 50extern struct seq_operations proc_uid_seq_operations;
41 51extern struct seq_operations proc_gid_seq_operations;
52extern ssize_t proc_uid_map_write(struct file *, const char __user *, size_t, loff_t *);
53extern ssize_t proc_gid_map_write(struct file *, const char __user *, size_t, loff_t *);
42#else 54#else
43 55
44static inline struct user_namespace *get_user_ns(struct user_namespace *ns) 56static inline struct user_namespace *get_user_ns(struct user_namespace *ns)
@@ -55,17 +67,6 @@ static inline void put_user_ns(struct user_namespace *ns)
55{ 67{
56} 68}
57 69
58static inline uid_t user_ns_map_uid(struct user_namespace *to,
59 const struct cred *cred, uid_t uid)
60{
61 return uid;
62}
63static inline gid_t user_ns_map_gid(struct user_namespace *to,
64 const struct cred *cred, gid_t gid)
65{
66 return gid;
67}
68
69#endif 70#endif
70 71
71#endif /* _LINUX_USER_H */ 72#endif /* _LINUX_USER_H */
diff --git a/include/linux/uuid.h b/include/linux/uuid.h
index 5b7efbfcee4e..f86c37bfd4a0 100644
--- a/include/linux/uuid.h
+++ b/include/linux/uuid.h
@@ -54,6 +54,8 @@ typedef struct {
54 UUID_BE(0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, \ 54 UUID_BE(0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, \
55 0x00, 0x00, 0x00, 0x00) 55 0x00, 0x00, 0x00, 0x00)
56 56
57#ifdef __KERNEL__
58
57static inline int uuid_le_cmp(const uuid_le u1, const uuid_le u2) 59static inline int uuid_le_cmp(const uuid_le u1, const uuid_le u2)
58{ 60{
59 return memcmp(&u1, &u2, sizeof(uuid_le)); 61 return memcmp(&u1, &u2, sizeof(uuid_le));
@@ -67,4 +69,6 @@ static inline int uuid_be_cmp(const uuid_be u1, const uuid_be u2)
67extern void uuid_le_gen(uuid_le *u); 69extern void uuid_le_gen(uuid_le *u);
68extern void uuid_be_gen(uuid_be *u); 70extern void uuid_be_gen(uuid_be *u);
69 71
72#endif /* __KERNEL__ */
73
70#endif 74#endif
diff --git a/include/linux/v4l2-dv-timings.h b/include/linux/v4l2-dv-timings.h
new file mode 100644
index 000000000000..9ef8172e5ed0
--- /dev/null
+++ b/include/linux/v4l2-dv-timings.h
@@ -0,0 +1,816 @@
1/*
2 * V4L2 DV timings header.
3 *
4 * Copyright (C) 2012 Hans Verkuil <hans.verkuil@cisco.com>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * version 2 as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18 * 02110-1301 USA
19 */
20
21#ifndef _V4L2_DV_TIMINGS_H
22#define _V4L2_DV_TIMINGS_H
23
24#if __GNUC__ < 4 || (__GNUC__ == 4 && (__GNUC_MINOR__ < 6))
25/* Sadly gcc versions older than 4.6 have a bug in how they initialize
26 anonymous unions where they require additional curly brackets.
27 This violates the C1x standard. This workaround adds the curly brackets
28 if needed. */
29#define V4L2_INIT_BT_TIMINGS(_width, args...) \
30 { .bt = { _width , ## args } }
31#else
32#define V4L2_INIT_BT_TIMINGS(_width, args...) \
33 .bt = { _width , ## args }
34#endif
35
36/* CEA-861-E timings (i.e. standard HDTV timings) */
37
38#define V4L2_DV_BT_CEA_640X480P59_94 { \
39 .type = V4L2_DV_BT_656_1120, \
40 V4L2_INIT_BT_TIMINGS(640, 480, 0, 0, \
41 25175000, 16, 96, 48, 10, 2, 33, 0, 0, 0, \
42 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CEA861, 0) \
43}
44
45#define V4L2_DV_BT_CEA_720X480P59_94 { \
46 .type = V4L2_DV_BT_656_1120, \
47 V4L2_INIT_BT_TIMINGS(720, 480, 0, 0, \
48 27000000, 16, 62, 60, 9, 6, 30, 0, 0, 0, \
49 V4L2_DV_BT_STD_CEA861, 0) \
50}
51
52#define V4L2_DV_BT_CEA_720X576P50 { \
53 .type = V4L2_DV_BT_656_1120, \
54 V4L2_INIT_BT_TIMINGS(720, 576, 0, 0, \
55 27000000, 12, 64, 68, 5, 5, 39, 0, 0, 0, \
56 V4L2_DV_BT_STD_CEA861, 0) \
57}
58
59#define V4L2_DV_BT_CEA_1280X720P24 { \
60 .type = V4L2_DV_BT_656_1120, \
61 V4L2_INIT_BT_TIMINGS(1280, 720, 0, \
62 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
63 59400000, 1760, 40, 220, 5, 5, 20, 0, 0, 0, \
64 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CEA861, \
65 V4L2_DV_FL_CAN_REDUCE_FPS) \
66}
67
68#define V4L2_DV_BT_CEA_1280X720P25 { \
69 .type = V4L2_DV_BT_656_1120, \
70 V4L2_INIT_BT_TIMINGS(1280, 720, 0, \
71 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
72 74250000, 2420, 40, 220, 5, 5, 20, 0, 0, 0, \
73 V4L2_DV_BT_STD_CEA861, 0) \
74}
75
76#define V4L2_DV_BT_CEA_1280X720P30 { \
77 .type = V4L2_DV_BT_656_1120, \
78 V4L2_INIT_BT_TIMINGS(1280, 720, 0, \
79 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
80 74250000, 1760, 40, 220, 5, 5, 20, 0, 0, 0, \
81 V4L2_DV_BT_STD_CEA861, V4L2_DV_FL_CAN_REDUCE_FPS) \
82}
83
84#define V4L2_DV_BT_CEA_1280X720P50 { \
85 .type = V4L2_DV_BT_656_1120, \
86 V4L2_INIT_BT_TIMINGS(1280, 720, 0, \
87 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
88 74250000, 440, 40, 220, 5, 5, 20, 0, 0, 0, \
89 V4L2_DV_BT_STD_CEA861, 0) \
90}
91
92#define V4L2_DV_BT_CEA_1280X720P60 { \
93 .type = V4L2_DV_BT_656_1120, \
94 V4L2_INIT_BT_TIMINGS(1280, 720, 0, \
95 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
96 74250000, 110, 40, 220, 5, 5, 20, 0, 0, 0, \
97 V4L2_DV_BT_STD_CEA861, V4L2_DV_FL_CAN_REDUCE_FPS) \
98}
99
100#define V4L2_DV_BT_CEA_1920X1080P24 { \
101 .type = V4L2_DV_BT_656_1120, \
102 V4L2_INIT_BT_TIMINGS(1920, 1080, 0, \
103 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
104 74250000, 638, 44, 148, 4, 5, 36, 0, 0, 0, \
105 V4L2_DV_BT_STD_CEA861, V4L2_DV_FL_CAN_REDUCE_FPS) \
106}
107
108#define V4L2_DV_BT_CEA_1920X1080P25 { \
109 .type = V4L2_DV_BT_656_1120, \
110 V4L2_INIT_BT_TIMINGS(1920, 1080, 0, \
111 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
112 74250000, 528, 44, 148, 4, 5, 36, 0, 0, 0, \
113 V4L2_DV_BT_STD_CEA861, 0) \
114}
115
116#define V4L2_DV_BT_CEA_1920X1080P30 { \
117 .type = V4L2_DV_BT_656_1120, \
118 V4L2_INIT_BT_TIMINGS(1920, 1080, 0, \
119 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
120 74250000, 88, 44, 148, 4, 5, 36, 0, 0, 0, \
121 V4L2_DV_BT_STD_CEA861, V4L2_DV_FL_CAN_REDUCE_FPS) \
122}
123
124#define V4L2_DV_BT_CEA_1920X1080I50 { \
125 .type = V4L2_DV_BT_656_1120, \
126 V4L2_INIT_BT_TIMINGS(1920, 1080, 1, \
127 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
128 74250000, 528, 44, 148, 2, 5, 15, 2, 5, 16, \
129 V4L2_DV_BT_STD_CEA861, V4L2_DV_FL_HALF_LINE) \
130}
131
132#define V4L2_DV_BT_CEA_1920X1080P50 { \
133 .type = V4L2_DV_BT_656_1120, \
134 V4L2_INIT_BT_TIMINGS(1920, 1080, 0, \
135 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
136 148500000, 528, 44, 148, 4, 5, 36, 0, 0, 0, \
137 V4L2_DV_BT_STD_CEA861, 0) \
138}
139
140#define V4L2_DV_BT_CEA_1920X1080I60 { \
141 .type = V4L2_DV_BT_656_1120, \
142 V4L2_INIT_BT_TIMINGS(1920, 1080, 1, \
143 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
144 74250000, 88, 44, 148, 2, 5, 15, 2, 5, 16, \
145 V4L2_DV_BT_STD_CEA861, \
146 V4L2_DV_FL_CAN_REDUCE_FPS | V4L2_DV_FL_HALF_LINE) \
147}
148
149#define V4L2_DV_BT_CEA_1920X1080P60 { \
150 .type = V4L2_DV_BT_656_1120, \
151 V4L2_INIT_BT_TIMINGS(1920, 1080, 0, \
152 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
153 148500000, 88, 44, 148, 4, 5, 36, 0, 0, 0, \
154 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CEA861, \
155 V4L2_DV_FL_CAN_REDUCE_FPS) \
156}
157
158
159/* VESA Discrete Monitor Timings as per version 1.0, revision 12 */
160
161#define V4L2_DV_BT_DMT_640X350P85 { \
162 .type = V4L2_DV_BT_656_1120, \
163 V4L2_INIT_BT_TIMINGS(640, 350, 0, V4L2_DV_HSYNC_POS_POL, \
164 31500000, 32, 64, 96, 32, 3, 60, 0, 0, 0, \
165 V4L2_DV_BT_STD_DMT, 0) \
166}
167
168#define V4L2_DV_BT_DMT_640X400P85 { \
169 .type = V4L2_DV_BT_656_1120, \
170 V4L2_INIT_BT_TIMINGS(640, 400, 0, V4L2_DV_VSYNC_POS_POL, \
171 31500000, 32, 64, 96, 1, 3, 41, 0, 0, 0, \
172 V4L2_DV_BT_STD_DMT, 0) \
173}
174
175#define V4L2_DV_BT_DMT_720X400P85 { \
176 .type = V4L2_DV_BT_656_1120, \
177 V4L2_INIT_BT_TIMINGS(720, 400, 0, V4L2_DV_VSYNC_POS_POL, \
178 35500000, 36, 72, 108, 1, 3, 42, 0, 0, 0, \
179 V4L2_DV_BT_STD_DMT, 0) \
180}
181
182/* VGA resolutions */
183#define V4L2_DV_BT_DMT_640X480P60 V4L2_DV_BT_CEA_640X480P59_94
184
185#define V4L2_DV_BT_DMT_640X480P72 { \
186 .type = V4L2_DV_BT_656_1120, \
187 V4L2_INIT_BT_TIMINGS(640, 480, 0, 0, \
188 31500000, 24, 40, 128, 9, 3, 28, 0, 0, 0, \
189 V4L2_DV_BT_STD_DMT, 0) \
190}
191
192#define V4L2_DV_BT_DMT_640X480P75 { \
193 .type = V4L2_DV_BT_656_1120, \
194 V4L2_INIT_BT_TIMINGS(640, 480, 0, 0, \
195 31500000, 16, 64, 120, 1, 3, 16, 0, 0, 0, \
196 V4L2_DV_BT_STD_DMT, 0) \
197}
198
199#define V4L2_DV_BT_DMT_640X480P85 { \
200 .type = V4L2_DV_BT_656_1120, \
201 V4L2_INIT_BT_TIMINGS(640, 480, 0, 0, \
202 36000000, 56, 56, 80, 1, 3, 25, 0, 0, 0, \
203 V4L2_DV_BT_STD_DMT, 0) \
204}
205
206/* SVGA resolutions */
207#define V4L2_DV_BT_DMT_800X600P56 { \
208 .type = V4L2_DV_BT_656_1120, \
209 V4L2_INIT_BT_TIMINGS(800, 600, 0, \
210 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
211 36000000, 24, 72, 128, 1, 2, 22, 0, 0, 0, \
212 V4L2_DV_BT_STD_DMT, 0) \
213}
214
215#define V4L2_DV_BT_DMT_800X600P60 { \
216 .type = V4L2_DV_BT_656_1120, \
217 V4L2_INIT_BT_TIMINGS(800, 600, 0, \
218 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
219 40000000, 40, 128, 88, 1, 4, 23, 0, 0, 0, \
220 V4L2_DV_BT_STD_DMT, 0) \
221}
222
223#define V4L2_DV_BT_DMT_800X600P72 { \
224 .type = V4L2_DV_BT_656_1120, \
225 V4L2_INIT_BT_TIMINGS(800, 600, 0, \
226 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
227 50000000, 56, 120, 64, 37, 6, 23, 0, 0, 0, \
228 V4L2_DV_BT_STD_DMT, 0) \
229}
230
231#define V4L2_DV_BT_DMT_800X600P75 { \
232 .type = V4L2_DV_BT_656_1120, \
233 V4L2_INIT_BT_TIMINGS(800, 600, 0, \
234 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
235 49500000, 16, 80, 160, 1, 3, 21, 0, 0, 0, \
236 V4L2_DV_BT_STD_DMT, 0) \
237}
238
239#define V4L2_DV_BT_DMT_800X600P85 { \
240 .type = V4L2_DV_BT_656_1120, \
241 V4L2_INIT_BT_TIMINGS(800, 600, 0, \
242 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
243 56250000, 32, 64, 152, 1, 3, 27, 0, 0, 0, \
244 V4L2_DV_BT_STD_DMT, 0) \
245}
246
247#define V4L2_DV_BT_DMT_800X600P120_RB { \
248 .type = V4L2_DV_BT_656_1120, \
249 V4L2_INIT_BT_TIMINGS(800, 600, 0, V4L2_DV_HSYNC_POS_POL, \
250 73250000, 48, 32, 80, 3, 4, 29, 0, 0, 0, \
251 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \
252 V4L2_DV_FL_REDUCED_BLANKING) \
253}
254
255#define V4L2_DV_BT_DMT_848X480P60 { \
256 .type = V4L2_DV_BT_656_1120, \
257 V4L2_INIT_BT_TIMINGS(848, 480, 0, \
258 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
259 33750000, 16, 112, 112, 6, 8, 23, 0, 0, 0, \
260 V4L2_DV_BT_STD_DMT, 0) \
261}
262
263#define V4L2_DV_BT_DMT_1024X768I43 { \
264 .type = V4L2_DV_BT_656_1120, \
265 V4L2_INIT_BT_TIMINGS(1024, 768, 1, \
266 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
267 44900000, 8, 176, 56, 0, 4, 20, 0, 4, 21, \
268 V4L2_DV_BT_STD_DMT, 0) \
269}
270
271/* XGA resolutions */
272#define V4L2_DV_BT_DMT_1024X768P60 { \
273 .type = V4L2_DV_BT_656_1120, \
274 V4L2_INIT_BT_TIMINGS(1024, 768, 0, 0, \
275 65000000, 24, 136, 160, 3, 6, 29, 0, 0, 0, \
276 V4L2_DV_BT_STD_DMT, 0) \
277}
278
279#define V4L2_DV_BT_DMT_1024X768P70 { \
280 .type = V4L2_DV_BT_656_1120, \
281 V4L2_INIT_BT_TIMINGS(1024, 768, 0, 0, \
282 75000000, 24, 136, 144, 3, 6, 29, 0, 0, 0, \
283 V4L2_DV_BT_STD_DMT, 0) \
284}
285
286#define V4L2_DV_BT_DMT_1024X768P75 { \
287 .type = V4L2_DV_BT_656_1120, \
288 V4L2_INIT_BT_TIMINGS(1024, 768, 0, \
289 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
290 78750000, 16, 96, 176, 1, 3, 28, 0, 0, 0, \
291 V4L2_DV_BT_STD_DMT, 0) \
292}
293
294#define V4L2_DV_BT_DMT_1024X768P85 { \
295 .type = V4L2_DV_BT_656_1120, \
296 V4L2_INIT_BT_TIMINGS(1024, 768, 0, \
297 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
298 94500000, 48, 96, 208, 1, 3, 36, 0, 0, 0, \
299 V4L2_DV_BT_STD_DMT, 0) \
300}
301
302#define V4L2_DV_BT_DMT_1024X768P120_RB { \
303 .type = V4L2_DV_BT_656_1120, \
304 V4L2_INIT_BT_TIMINGS(1024, 768, 0, V4L2_DV_HSYNC_POS_POL, \
305 115500000, 48, 32, 80, 3, 4, 38, 0, 0, 0, \
306 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \
307 V4L2_DV_FL_REDUCED_BLANKING) \
308}
309
310/* XGA+ resolution */
311#define V4L2_DV_BT_DMT_1152X864P75 { \
312 .type = V4L2_DV_BT_656_1120, \
313 V4L2_INIT_BT_TIMINGS(1152, 864, 0, \
314 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
315 108000000, 64, 128, 256, 1, 3, 32, 0, 0, 0, \
316 V4L2_DV_BT_STD_DMT, 0) \
317}
318
319#define V4L2_DV_BT_DMT_1280X720P60 V4L2_DV_BT_CEA_1280X720P60
320
321/* WXGA resolutions */
322#define V4L2_DV_BT_DMT_1280X768P60_RB { \
323 .type = V4L2_DV_BT_656_1120, \
324 V4L2_INIT_BT_TIMINGS(1280, 768, 0, V4L2_DV_HSYNC_POS_POL, \
325 68250000, 48, 32, 80, 3, 7, 12, 0, 0, 0, \
326 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \
327 V4L2_DV_FL_REDUCED_BLANKING) \
328}
329
330#define V4L2_DV_BT_DMT_1280X768P60 { \
331 .type = V4L2_DV_BT_656_1120, \
332 V4L2_INIT_BT_TIMINGS(1280, 768, 0, V4L2_DV_VSYNC_POS_POL, \
333 79500000, 64, 128, 192, 3, 7, 20, 0, 0, 0, \
334 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \
335}
336
337#define V4L2_DV_BT_DMT_1280X768P75 { \
338 .type = V4L2_DV_BT_656_1120, \
339 V4L2_INIT_BT_TIMINGS(1280, 768, 0, V4L2_DV_VSYNC_POS_POL, \
340 102250000, 80, 128, 208, 3, 7, 27, 0, 0, 0, \
341 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \
342}
343
344#define V4L2_DV_BT_DMT_1280X768P85 { \
345 .type = V4L2_DV_BT_656_1120, \
346 V4L2_INIT_BT_TIMINGS(1280, 768, 0, V4L2_DV_VSYNC_POS_POL, \
347 117500000, 80, 136, 216, 3, 7, 31, 0, 0, 0, \
348 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \
349}
350
351#define V4L2_DV_BT_DMT_1280X768P120_RB { \
352 .type = V4L2_DV_BT_656_1120, \
353 V4L2_INIT_BT_TIMINGS(1280, 768, 0, V4L2_DV_HSYNC_POS_POL, \
354 140250000, 48, 32, 80, 3, 7, 35, 0, 0, 0, \
355 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \
356 V4L2_DV_FL_REDUCED_BLANKING) \
357}
358
359#define V4L2_DV_BT_DMT_1280X800P60_RB { \
360 .type = V4L2_DV_BT_656_1120, \
361 V4L2_INIT_BT_TIMINGS(1280, 800, 0, V4L2_DV_HSYNC_POS_POL, \
362 71000000, 48, 32, 80, 3, 6, 14, 0, 0, 0, \
363 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \
364 V4L2_DV_FL_REDUCED_BLANKING) \
365}
366
367#define V4L2_DV_BT_DMT_1280X800P60 { \
368 .type = V4L2_DV_BT_656_1120, \
369 V4L2_INIT_BT_TIMINGS(1280, 800, 0, V4L2_DV_VSYNC_POS_POL, \
370 83500000, 72, 128, 200, 3, 6, 22, 0, 0, 0, \
371 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \
372}
373
374#define V4L2_DV_BT_DMT_1280X800P75 { \
375 .type = V4L2_DV_BT_656_1120, \
376 V4L2_INIT_BT_TIMINGS(1280, 800, 0, V4L2_DV_VSYNC_POS_POL, \
377 106500000, 80, 128, 208, 3, 6, 29, 0, 0, 0, \
378 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \
379}
380
381#define V4L2_DV_BT_DMT_1280X800P85 { \
382 .type = V4L2_DV_BT_656_1120, \
383 V4L2_INIT_BT_TIMINGS(1280, 800, 0, V4L2_DV_VSYNC_POS_POL, \
384 122500000, 80, 136, 216, 3, 6, 34, 0, 0, 0, \
385 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \
386}
387
388#define V4L2_DV_BT_DMT_1280X800P120_RB { \
389 .type = V4L2_DV_BT_656_1120, \
390 V4L2_INIT_BT_TIMINGS(1280, 800, 0, V4L2_DV_HSYNC_POS_POL, \
391 146250000, 48, 32, 80, 3, 6, 38, 0, 0, 0, \
392 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \
393 V4L2_DV_FL_REDUCED_BLANKING) \
394}
395
396#define V4L2_DV_BT_DMT_1280X960P60 { \
397 .type = V4L2_DV_BT_656_1120, \
398 V4L2_INIT_BT_TIMINGS(1280, 960, 0, \
399 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
400 108000000, 96, 112, 312, 1, 3, 36, 0, 0, 0, \
401 V4L2_DV_BT_STD_DMT, 0) \
402}
403
404#define V4L2_DV_BT_DMT_1280X960P85 { \
405 .type = V4L2_DV_BT_656_1120, \
406 V4L2_INIT_BT_TIMINGS(1280, 960, 0, \
407 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
408 148500000, 64, 160, 224, 1, 3, 47, 0, 0, 0, \
409 V4L2_DV_BT_STD_DMT, 0) \
410}
411
412#define V4L2_DV_BT_DMT_1280X960P120_RB { \
413 .type = V4L2_DV_BT_656_1120, \
414 V4L2_INIT_BT_TIMINGS(1280, 960, 0, V4L2_DV_HSYNC_POS_POL, \
415 175500000, 48, 32, 80, 3, 4, 50, 0, 0, 0, \
416 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \
417 V4L2_DV_FL_REDUCED_BLANKING) \
418}
419
420/* SXGA resolutions */
421#define V4L2_DV_BT_DMT_1280X1024P60 { \
422 .type = V4L2_DV_BT_656_1120, \
423 V4L2_INIT_BT_TIMINGS(1280, 1024, 0, \
424 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
425 108000000, 48, 112, 248, 1, 3, 38, 0, 0, 0, \
426 V4L2_DV_BT_STD_DMT, 0) \
427}
428
429#define V4L2_DV_BT_DMT_1280X1024P75 { \
430 .type = V4L2_DV_BT_656_1120, \
431 V4L2_INIT_BT_TIMINGS(1280, 1024, 0, \
432 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
433 135000000, 16, 144, 248, 1, 3, 38, 0, 0, 0, \
434 V4L2_DV_BT_STD_DMT, 0) \
435}
436
437#define V4L2_DV_BT_DMT_1280X1024P85 { \
438 .type = V4L2_DV_BT_656_1120, \
439 V4L2_INIT_BT_TIMINGS(1280, 1024, 0, \
440 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
441 157500000, 64, 160, 224, 1, 3, 44, 0, 0, 0, \
442 V4L2_DV_BT_STD_DMT, 0) \
443}
444
445#define V4L2_DV_BT_DMT_1280X1024P120_RB { \
446 .type = V4L2_DV_BT_656_1120, \
447 V4L2_INIT_BT_TIMINGS(1280, 1024, 0, V4L2_DV_HSYNC_POS_POL, \
448 187250000, 48, 32, 80, 3, 7, 50, 0, 0, 0, \
449 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \
450 V4L2_DV_FL_REDUCED_BLANKING) \
451}
452
453#define V4L2_DV_BT_DMT_1360X768P60 { \
454 .type = V4L2_DV_BT_656_1120, \
455 V4L2_INIT_BT_TIMINGS(1360, 768, 0, \
456 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
457 85500000, 64, 112, 256, 3, 6, 18, 0, 0, 0, \
458 V4L2_DV_BT_STD_DMT, 0) \
459}
460
461#define V4L2_DV_BT_DMT_1360X768P120_RB { \
462 .type = V4L2_DV_BT_656_1120, \
463 V4L2_INIT_BT_TIMINGS(1360, 768, 0, V4L2_DV_HSYNC_POS_POL, \
464 148250000, 48, 32, 80, 3, 5, 37, 0, 0, 0, \
465 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \
466 V4L2_DV_FL_REDUCED_BLANKING) \
467}
468
469#define V4L2_DV_BT_DMT_1366X768P60 { \
470 .type = V4L2_DV_BT_656_1120, \
471 V4L2_INIT_BT_TIMINGS(1366, 768, 0, \
472 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
473 85500000, 70, 143, 213, 3, 3, 24, 0, 0, 0, \
474 V4L2_DV_BT_STD_DMT, 0) \
475}
476
477#define V4L2_DV_BT_DMT_1366X768P60_RB { \
478 .type = V4L2_DV_BT_656_1120, \
479 V4L2_INIT_BT_TIMINGS(1366, 768, 0, \
480 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
481 72000000, 14, 56, 64, 1, 3, 28, 0, 0, 0, \
482 V4L2_DV_BT_STD_DMT, V4L2_DV_FL_REDUCED_BLANKING) \
483}
484
485/* SXGA+ resolutions */
486#define V4L2_DV_BT_DMT_1400X1050P60_RB { \
487 .type = V4L2_DV_BT_656_1120, \
488 V4L2_INIT_BT_TIMINGS(1400, 1050, 0, V4L2_DV_HSYNC_POS_POL, \
489 101000000, 48, 32, 80, 3, 4, 23, 0, 0, 0, \
490 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \
491 V4L2_DV_FL_REDUCED_BLANKING) \
492}
493
494#define V4L2_DV_BT_DMT_1400X1050P60 { \
495 .type = V4L2_DV_BT_656_1120, \
496 V4L2_INIT_BT_TIMINGS(1400, 1050, 0, V4L2_DV_VSYNC_POS_POL, \
497 121750000, 88, 144, 232, 3, 4, 32, 0, 0, 0, \
498 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \
499}
500
501#define V4L2_DV_BT_DMT_1400X1050P75 { \
502 .type = V4L2_DV_BT_656_1120, \
503 V4L2_INIT_BT_TIMINGS(1400, 1050, 0, V4L2_DV_VSYNC_POS_POL, \
504 156000000, 104, 144, 248, 3, 4, 42, 0, 0, 0, \
505 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \
506}
507
508#define V4L2_DV_BT_DMT_1400X1050P85 { \
509 .type = V4L2_DV_BT_656_1120, \
510 V4L2_INIT_BT_TIMINGS(1400, 1050, 0, V4L2_DV_VSYNC_POS_POL, \
511 179500000, 104, 152, 256, 3, 4, 48, 0, 0, 0, \
512 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \
513}
514
515#define V4L2_DV_BT_DMT_1400X1050P120_RB { \
516 .type = V4L2_DV_BT_656_1120, \
517 V4L2_INIT_BT_TIMINGS(1400, 1050, 0, V4L2_DV_HSYNC_POS_POL, \
518 208000000, 48, 32, 80, 3, 4, 55, 0, 0, 0, \
519 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \
520 V4L2_DV_FL_REDUCED_BLANKING) \
521}
522
523/* WXGA+ resolutions */
524#define V4L2_DV_BT_DMT_1440X900P60_RB { \
525 .type = V4L2_DV_BT_656_1120, \
526 V4L2_INIT_BT_TIMINGS(1440, 900, 0, V4L2_DV_HSYNC_POS_POL, \
527 88750000, 48, 32, 80, 3, 6, 17, 0, 0, 0, \
528 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \
529 V4L2_DV_FL_REDUCED_BLANKING) \
530}
531
532#define V4L2_DV_BT_DMT_1440X900P60 { \
533 .type = V4L2_DV_BT_656_1120, \
534 V4L2_INIT_BT_TIMINGS(1440, 900, 0, V4L2_DV_VSYNC_POS_POL, \
535 106500000, 80, 152, 232, 3, 6, 25, 0, 0, 0, \
536 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \
537}
538
539#define V4L2_DV_BT_DMT_1440X900P75 { \
540 .type = V4L2_DV_BT_656_1120, \
541 V4L2_INIT_BT_TIMINGS(1440, 900, 0, V4L2_DV_VSYNC_POS_POL, \
542 136750000, 96, 152, 248, 3, 6, 33, 0, 0, 0, \
543 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \
544}
545
546#define V4L2_DV_BT_DMT_1440X900P85 { \
547 .type = V4L2_DV_BT_656_1120, \
548 V4L2_INIT_BT_TIMINGS(1440, 900, 0, V4L2_DV_VSYNC_POS_POL, \
549 157000000, 104, 152, 256, 3, 6, 39, 0, 0, 0, \
550 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \
551}
552
553#define V4L2_DV_BT_DMT_1440X900P120_RB { \
554 .type = V4L2_DV_BT_656_1120, \
555 V4L2_INIT_BT_TIMINGS(1440, 900, 0, V4L2_DV_HSYNC_POS_POL, \
556 182750000, 48, 32, 80, 3, 6, 44, 0, 0, 0, \
557 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \
558 V4L2_DV_FL_REDUCED_BLANKING) \
559}
560
561#define V4L2_DV_BT_DMT_1600X900P60_RB { \
562 .type = V4L2_DV_BT_656_1120, \
563 V4L2_INIT_BT_TIMINGS(1600, 900, 0, \
564 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
565 108000000, 24, 80, 96, 1, 3, 96, 0, 0, 0, \
566 V4L2_DV_BT_STD_DMT, V4L2_DV_FL_REDUCED_BLANKING) \
567}
568
569/* UXGA resolutions */
570#define V4L2_DV_BT_DMT_1600X1200P60 { \
571 .type = V4L2_DV_BT_656_1120, \
572 V4L2_INIT_BT_TIMINGS(1600, 1200, 0, \
573 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
574 162000000, 64, 192, 304, 1, 3, 46, 0, 0, 0, \
575 V4L2_DV_BT_STD_DMT, 0) \
576}
577
578#define V4L2_DV_BT_DMT_1600X1200P65 { \
579 .type = V4L2_DV_BT_656_1120, \
580 V4L2_INIT_BT_TIMINGS(1600, 1200, 0, \
581 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
582 175500000, 64, 192, 304, 1, 3, 46, 0, 0, 0, \
583 V4L2_DV_BT_STD_DMT, 0) \
584}
585
586#define V4L2_DV_BT_DMT_1600X1200P70 { \
587 .type = V4L2_DV_BT_656_1120, \
588 V4L2_INIT_BT_TIMINGS(1600, 1200, 0, \
589 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
590 189000000, 64, 192, 304, 1, 3, 46, 0, 0, 0, \
591 V4L2_DV_BT_STD_DMT, 0) \
592}
593
594#define V4L2_DV_BT_DMT_1600X1200P75 { \
595 .type = V4L2_DV_BT_656_1120, \
596 V4L2_INIT_BT_TIMINGS(1600, 1200, 0, \
597 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
598 202500000, 64, 192, 304, 1, 3, 46, 0, 0, 0, \
599 V4L2_DV_BT_STD_DMT, 0) \
600}
601
602#define V4L2_DV_BT_DMT_1600X1200P85 { \
603 .type = V4L2_DV_BT_656_1120, \
604 V4L2_INIT_BT_TIMINGS(1600, 1200, 0, \
605 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
606 229500000, 64, 192, 304, 1, 3, 46, 0, 0, 0, \
607 V4L2_DV_BT_STD_DMT, 0) \
608}
609
610#define V4L2_DV_BT_DMT_1600X1200P120_RB { \
611 .type = V4L2_DV_BT_656_1120, \
612 V4L2_INIT_BT_TIMINGS(1600, 1200, 0, V4L2_DV_HSYNC_POS_POL, \
613 268250000, 48, 32, 80, 3, 4, 64, 0, 0, 0, \
614 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \
615 V4L2_DV_FL_REDUCED_BLANKING) \
616}
617
618/* WSXGA+ resolutions */
619#define V4L2_DV_BT_DMT_1680X1050P60_RB { \
620 .type = V4L2_DV_BT_656_1120, \
621 V4L2_INIT_BT_TIMINGS(1680, 1050, 0, V4L2_DV_HSYNC_POS_POL, \
622 119000000, 48, 32, 80, 3, 6, 21, 0, 0, 0, \
623 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \
624 V4L2_DV_FL_REDUCED_BLANKING) \
625}
626
627#define V4L2_DV_BT_DMT_1680X1050P60 { \
628 .type = V4L2_DV_BT_656_1120, \
629 V4L2_INIT_BT_TIMINGS(1680, 1050, 0, V4L2_DV_VSYNC_POS_POL, \
630 146250000, 104, 176, 280, 3, 6, 30, 0, 0, 0, \
631 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \
632}
633
634#define V4L2_DV_BT_DMT_1680X1050P75 { \
635 .type = V4L2_DV_BT_656_1120, \
636 V4L2_INIT_BT_TIMINGS(1680, 1050, 0, V4L2_DV_VSYNC_POS_POL, \
637 187000000, 120, 176, 296, 3, 6, 40, 0, 0, 0, \
638 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \
639}
640
641#define V4L2_DV_BT_DMT_1680X1050P85 { \
642 .type = V4L2_DV_BT_656_1120, \
643 V4L2_INIT_BT_TIMINGS(1680, 1050, 0, V4L2_DV_VSYNC_POS_POL, \
644 214750000, 128, 176, 304, 3, 6, 46, 0, 0, 0, \
645 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \
646}
647
648#define V4L2_DV_BT_DMT_1680X1050P120_RB { \
649 .type = V4L2_DV_BT_656_1120, \
650 V4L2_INIT_BT_TIMINGS(1680, 1050, 0, V4L2_DV_HSYNC_POS_POL, \
651 245500000, 48, 32, 80, 3, 6, 53, 0, 0, 0, \
652 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \
653 V4L2_DV_FL_REDUCED_BLANKING) \
654}
655
656#define V4L2_DV_BT_DMT_1792X1344P60 { \
657 .type = V4L2_DV_BT_656_1120, \
658 V4L2_INIT_BT_TIMINGS(1792, 1344, 0, V4L2_DV_VSYNC_POS_POL, \
659 204750000, 128, 200, 328, 1, 3, 46, 0, 0, 0, \
660 V4L2_DV_BT_STD_DMT, 0) \
661}
662
663#define V4L2_DV_BT_DMT_1792X1344P75 { \
664 .type = V4L2_DV_BT_656_1120, \
665 V4L2_INIT_BT_TIMINGS(1792, 1344, 0, V4L2_DV_VSYNC_POS_POL, \
666 261000000, 96, 216, 352, 1, 3, 69, 0, 0, 0, \
667 V4L2_DV_BT_STD_DMT, 0) \
668}
669
670#define V4L2_DV_BT_DMT_1792X1344P120_RB { \
671 .type = V4L2_DV_BT_656_1120, \
672 V4L2_INIT_BT_TIMINGS(1792, 1344, 0, V4L2_DV_HSYNC_POS_POL, \
673 333250000, 48, 32, 80, 3, 4, 72, 0, 0, 0, \
674 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \
675 V4L2_DV_FL_REDUCED_BLANKING) \
676}
677
678#define V4L2_DV_BT_DMT_1856X1392P60 { \
679 .type = V4L2_DV_BT_656_1120, \
680 V4L2_INIT_BT_TIMINGS(1856, 1392, 0, V4L2_DV_VSYNC_POS_POL, \
681 218250000, 96, 224, 352, 1, 3, 43, 0, 0, 0, \
682 V4L2_DV_BT_STD_DMT, 0) \
683}
684
685#define V4L2_DV_BT_DMT_1856X1392P75 { \
686 .type = V4L2_DV_BT_656_1120, \
687 V4L2_INIT_BT_TIMINGS(1856, 1392, 0, V4L2_DV_VSYNC_POS_POL, \
688 288000000, 128, 224, 352, 1, 3, 104, 0, 0, 0, \
689 V4L2_DV_BT_STD_DMT, 0) \
690}
691
692#define V4L2_DV_BT_DMT_1856X1392P120_RB { \
693 .type = V4L2_DV_BT_656_1120, \
694 V4L2_INIT_BT_TIMINGS(1856, 1392, 0, V4L2_DV_HSYNC_POS_POL, \
695 356500000, 48, 32, 80, 3, 4, 75, 0, 0, 0, \
696 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \
697 V4L2_DV_FL_REDUCED_BLANKING) \
698}
699
700#define V4L2_DV_BT_DMT_1920X1080P60 V4L2_DV_BT_CEA_1920X1080P60
701
702/* WUXGA resolutions */
703#define V4L2_DV_BT_DMT_1920X1200P60_RB { \
704 .type = V4L2_DV_BT_656_1120, \
705 V4L2_INIT_BT_TIMINGS(1920, 1200, 0, V4L2_DV_HSYNC_POS_POL, \
706 154000000, 48, 32, 80, 3, 6, 26, 0, 0, 0, \
707 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \
708 V4L2_DV_FL_REDUCED_BLANKING) \
709}
710
711#define V4L2_DV_BT_DMT_1920X1200P60 { \
712 .type = V4L2_DV_BT_656_1120, \
713 V4L2_INIT_BT_TIMINGS(1920, 1200, 0, V4L2_DV_VSYNC_POS_POL, \
714 193250000, 136, 200, 336, 3, 6, 36, 0, 0, 0, \
715 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \
716}
717
718#define V4L2_DV_BT_DMT_1920X1200P75 { \
719 .type = V4L2_DV_BT_656_1120, \
720 V4L2_INIT_BT_TIMINGS(1920, 1200, 0, V4L2_DV_VSYNC_POS_POL, \
721 245250000, 136, 208, 344, 3, 6, 46, 0, 0, 0, \
722 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \
723}
724
725#define V4L2_DV_BT_DMT_1920X1200P85 { \
726 .type = V4L2_DV_BT_656_1120, \
727 V4L2_INIT_BT_TIMINGS(1920, 1200, 0, V4L2_DV_VSYNC_POS_POL, \
728 281250000, 144, 208, 352, 3, 6, 53, 0, 0, 0, \
729 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \
730}
731
732#define V4L2_DV_BT_DMT_1920X1200P120_RB { \
733 .type = V4L2_DV_BT_656_1120, \
734 V4L2_INIT_BT_TIMINGS(1920, 1200, 0, V4L2_DV_HSYNC_POS_POL, \
735 317000000, 48, 32, 80, 3, 6, 62, 0, 0, 0, \
736 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \
737 V4L2_DV_FL_REDUCED_BLANKING) \
738}
739
740#define V4L2_DV_BT_DMT_1920X1440P60 { \
741 .type = V4L2_DV_BT_656_1120, \
742 V4L2_INIT_BT_TIMINGS(1920, 1440, 0, V4L2_DV_VSYNC_POS_POL, \
743 234000000, 128, 208, 344, 1, 3, 56, 0, 0, 0, \
744 V4L2_DV_BT_STD_DMT, 0) \
745}
746
747#define V4L2_DV_BT_DMT_1920X1440P75 { \
748 .type = V4L2_DV_BT_656_1120, \
749 V4L2_INIT_BT_TIMINGS(1920, 1440, 0, V4L2_DV_VSYNC_POS_POL, \
750 297000000, 144, 224, 352, 1, 3, 56, 0, 0, 0, \
751 V4L2_DV_BT_STD_DMT, 0) \
752}
753
754#define V4L2_DV_BT_DMT_1920X1440P120_RB { \
755 .type = V4L2_DV_BT_656_1120, \
756 V4L2_INIT_BT_TIMINGS(1920, 1440, 0, V4L2_DV_HSYNC_POS_POL, \
757 380500000, 48, 32, 80, 3, 4, 78, 0, 0, 0, \
758 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \
759 V4L2_DV_FL_REDUCED_BLANKING) \
760}
761
762#define V4L2_DV_BT_DMT_2048X1152P60_RB { \
763 .type = V4L2_DV_BT_656_1120, \
764 V4L2_INIT_BT_TIMINGS(2048, 1152, 0, \
765 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
766 162000000, 26, 80, 96, 1, 3, 44, 0, 0, 0, \
767 V4L2_DV_BT_STD_DMT, V4L2_DV_FL_REDUCED_BLANKING) \
768}
769
770/* WQXGA resolutions */
771#define V4L2_DV_BT_DMT_2560X1600P60_RB { \
772 .type = V4L2_DV_BT_656_1120, \
773 V4L2_INIT_BT_TIMINGS(2560, 1600, 0, V4L2_DV_HSYNC_POS_POL, \
774 268500000, 48, 32, 80, 3, 6, 37, 0, 0, 0, \
775 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \
776 V4L2_DV_FL_REDUCED_BLANKING) \
777}
778
779#define V4L2_DV_BT_DMT_2560X1600P60 { \
780 .type = V4L2_DV_BT_656_1120, \
781 V4L2_INIT_BT_TIMINGS(2560, 1600, 0, V4L2_DV_VSYNC_POS_POL, \
782 348500000, 192, 280, 472, 3, 6, 49, 0, 0, 0, \
783 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \
784}
785
786#define V4L2_DV_BT_DMT_2560X1600P75 { \
787 .type = V4L2_DV_BT_656_1120, \
788 V4L2_INIT_BT_TIMINGS(2560, 1600, 0, V4L2_DV_VSYNC_POS_POL, \
789 443250000, 208, 280, 488, 3, 6, 63, 0, 0, 0, \
790 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \
791}
792
793#define V4L2_DV_BT_DMT_2560X1600P85 { \
794 .type = V4L2_DV_BT_656_1120, \
795 V4L2_INIT_BT_TIMINGS(2560, 1600, 0, V4L2_DV_VSYNC_POS_POL, \
796 505250000, 208, 280, 488, 3, 6, 73, 0, 0, 0, \
797 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, 0) \
798}
799
800#define V4L2_DV_BT_DMT_2560X1600P120_RB { \
801 .type = V4L2_DV_BT_656_1120, \
802 V4L2_INIT_BT_TIMINGS(2560, 1600, 0, V4L2_DV_HSYNC_POS_POL, \
803 552750000, 48, 32, 80, 3, 6, 85, 0, 0, 0, \
804 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \
805 V4L2_DV_FL_REDUCED_BLANKING) \
806}
807
808#define V4L2_DV_BT_DMT_1366X768P60 { \
809 .type = V4L2_DV_BT_656_1120, \
810 V4L2_INIT_BT_TIMINGS(1366, 768, 0, \
811 V4L2_DV_HSYNC_POS_POL | V4L2_DV_VSYNC_POS_POL, \
812 85500000, 70, 143, 213, 3, 3, 24, 0, 0, 0, \
813 V4L2_DV_BT_STD_DMT, 0) \
814}
815
816#endif
diff --git a/include/linux/v4l2-subdev.h b/include/linux/v4l2-subdev.h
index ed29cbbebfef..812019ee1e06 100644
--- a/include/linux/v4l2-subdev.h
+++ b/include/linux/v4l2-subdev.h
@@ -123,6 +123,43 @@ struct v4l2_subdev_frame_interval_enum {
123 __u32 reserved[9]; 123 __u32 reserved[9];
124}; 124};
125 125
126#define V4L2_SUBDEV_SEL_FLAG_SIZE_GE (1 << 0)
127#define V4L2_SUBDEV_SEL_FLAG_SIZE_LE (1 << 1)
128#define V4L2_SUBDEV_SEL_FLAG_KEEP_CONFIG (1 << 2)
129
130/* active cropping area */
131#define V4L2_SUBDEV_SEL_TGT_CROP_ACTUAL 0x0000
132/* cropping bounds */
133#define V4L2_SUBDEV_SEL_TGT_CROP_BOUNDS 0x0002
134/* current composing area */
135#define V4L2_SUBDEV_SEL_TGT_COMPOSE_ACTUAL 0x0100
136/* composing bounds */
137#define V4L2_SUBDEV_SEL_TGT_COMPOSE_BOUNDS 0x0102
138
139
140/**
141 * struct v4l2_subdev_selection - selection info
142 *
143 * @which: either V4L2_SUBDEV_FORMAT_ACTIVE or V4L2_SUBDEV_FORMAT_TRY
144 * @pad: pad number, as reported by the media API
145 * @target: selection target, used to choose one of possible rectangles
146 * @flags: constraint flags
147 * @r: coordinates of the selection window
148 * @reserved: for future use, set to zero for now
149 *
150 * Hardware may use multiple helper windows to process a video stream.
151 * The structure is used to exchange this selection areas between
152 * an application and a driver.
153 */
154struct v4l2_subdev_selection {
155 __u32 which;
156 __u32 pad;
157 __u32 target;
158 __u32 flags;
159 struct v4l2_rect r;
160 __u32 reserved[8];
161};
162
126#define VIDIOC_SUBDEV_G_FMT _IOWR('V', 4, struct v4l2_subdev_format) 163#define VIDIOC_SUBDEV_G_FMT _IOWR('V', 4, struct v4l2_subdev_format)
127#define VIDIOC_SUBDEV_S_FMT _IOWR('V', 5, struct v4l2_subdev_format) 164#define VIDIOC_SUBDEV_S_FMT _IOWR('V', 5, struct v4l2_subdev_format)
128#define VIDIOC_SUBDEV_G_FRAME_INTERVAL \ 165#define VIDIOC_SUBDEV_G_FRAME_INTERVAL \
@@ -137,5 +174,9 @@ struct v4l2_subdev_frame_interval_enum {
137 _IOWR('V', 75, struct v4l2_subdev_frame_interval_enum) 174 _IOWR('V', 75, struct v4l2_subdev_frame_interval_enum)
138#define VIDIOC_SUBDEV_G_CROP _IOWR('V', 59, struct v4l2_subdev_crop) 175#define VIDIOC_SUBDEV_G_CROP _IOWR('V', 59, struct v4l2_subdev_crop)
139#define VIDIOC_SUBDEV_S_CROP _IOWR('V', 60, struct v4l2_subdev_crop) 176#define VIDIOC_SUBDEV_S_CROP _IOWR('V', 60, struct v4l2_subdev_crop)
177#define VIDIOC_SUBDEV_G_SELECTION \
178 _IOWR('V', 61, struct v4l2_subdev_selection)
179#define VIDIOC_SUBDEV_S_SELECTION \
180 _IOWR('V', 62, struct v4l2_subdev_selection)
140 181
141#endif 182#endif
diff --git a/include/linux/vga_switcheroo.h b/include/linux/vga_switcheroo.h
index 4b9a7f596f92..b455c7c212eb 100644
--- a/include/linux/vga_switcheroo.h
+++ b/include/linux/vga_switcheroo.h
@@ -28,13 +28,19 @@ struct vga_switcheroo_handler {
28 int (*get_client_id)(struct pci_dev *pdev); 28 int (*get_client_id)(struct pci_dev *pdev);
29}; 29};
30 30
31struct vga_switcheroo_client_ops {
32 void (*set_gpu_state)(struct pci_dev *dev, enum vga_switcheroo_state);
33 void (*reprobe)(struct pci_dev *dev);
34 bool (*can_switch)(struct pci_dev *dev);
35};
31 36
32#if defined(CONFIG_VGA_SWITCHEROO) 37#if defined(CONFIG_VGA_SWITCHEROO)
33void vga_switcheroo_unregister_client(struct pci_dev *dev); 38void vga_switcheroo_unregister_client(struct pci_dev *dev);
34int vga_switcheroo_register_client(struct pci_dev *dev, 39int vga_switcheroo_register_client(struct pci_dev *dev,
35 void (*set_gpu_state)(struct pci_dev *dev, enum vga_switcheroo_state), 40 const struct vga_switcheroo_client_ops *ops);
36 void (*reprobe)(struct pci_dev *dev), 41int vga_switcheroo_register_audio_client(struct pci_dev *pdev,
37 bool (*can_switch)(struct pci_dev *dev)); 42 const struct vga_switcheroo_client_ops *ops,
43 int id, bool active);
38 44
39void vga_switcheroo_client_fb_set(struct pci_dev *dev, 45void vga_switcheroo_client_fb_set(struct pci_dev *dev,
40 struct fb_info *info); 46 struct fb_info *info);
@@ -48,11 +54,12 @@ int vga_switcheroo_process_delayed_switch(void);
48 54
49static inline void vga_switcheroo_unregister_client(struct pci_dev *dev) {} 55static inline void vga_switcheroo_unregister_client(struct pci_dev *dev) {}
50static inline int vga_switcheroo_register_client(struct pci_dev *dev, 56static inline int vga_switcheroo_register_client(struct pci_dev *dev,
51 void (*set_gpu_state)(struct pci_dev *dev, enum vga_switcheroo_state), 57 const struct vga_switcheroo_client_ops *ops) { return 0; }
52 void (*reprobe)(struct pci_dev *dev),
53 bool (*can_switch)(struct pci_dev *dev)) { return 0; }
54static inline void vga_switcheroo_client_fb_set(struct pci_dev *dev, struct fb_info *info) {} 58static inline void vga_switcheroo_client_fb_set(struct pci_dev *dev, struct fb_info *info) {}
55static inline int vga_switcheroo_register_handler(struct vga_switcheroo_handler *handler) { return 0; } 59static inline int vga_switcheroo_register_handler(struct vga_switcheroo_handler *handler) { return 0; }
60static inline int vga_switcheroo_register_audio_client(struct pci_dev *pdev,
61 const struct vga_switcheroo_client_ops *ops,
62 int id, bool active) { return 0; }
56static inline void vga_switcheroo_unregister_handler(void) {} 63static inline void vga_switcheroo_unregister_handler(void) {}
57static inline int vga_switcheroo_process_delayed_switch(void) { return 0; } 64static inline int vga_switcheroo_process_delayed_switch(void) { return 0; }
58 65
diff --git a/include/linux/vgaarb.h b/include/linux/vgaarb.h
index b572f80bdfd5..0ee42d9acdc0 100644
--- a/include/linux/vgaarb.h
+++ b/include/linux/vgaarb.h
@@ -31,6 +31,7 @@
31#ifndef LINUX_VGA_H 31#ifndef LINUX_VGA_H
32#define LINUX_VGA_H 32#define LINUX_VGA_H
33 33
34#include <video/vga.h>
34 35
35/* Legacy VGA regions */ 36/* Legacy VGA regions */
36#define VGA_RSRC_NONE 0x00 37#define VGA_RSRC_NONE 0x00
@@ -182,7 +183,13 @@ extern void vga_put(struct pci_dev *pdev, unsigned int rsrc);
182 */ 183 */
183 184
184#ifndef __ARCH_HAS_VGA_DEFAULT_DEVICE 185#ifndef __ARCH_HAS_VGA_DEFAULT_DEVICE
186#ifdef CONFIG_VGA_ARB
185extern struct pci_dev *vga_default_device(void); 187extern struct pci_dev *vga_default_device(void);
188extern void vga_set_default_device(struct pci_dev *pdev);
189#else
190static inline struct pci_dev *vga_default_device(void) { return NULL; };
191static inline void vga_set_default_device(struct pci_dev *pdev) { };
192#endif
186#endif 193#endif
187 194
188/** 195/**
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index c9c9a4680cc5..370d11106c11 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -292,10 +292,10 @@ struct v4l2_pix_format {
292 __u32 width; 292 __u32 width;
293 __u32 height; 293 __u32 height;
294 __u32 pixelformat; 294 __u32 pixelformat;
295 enum v4l2_field field; 295 __u32 field; /* enum v4l2_field */
296 __u32 bytesperline; /* for padding, zero if unused */ 296 __u32 bytesperline; /* for padding, zero if unused */
297 __u32 sizeimage; 297 __u32 sizeimage;
298 enum v4l2_colorspace colorspace; 298 __u32 colorspace; /* enum v4l2_colorspace */
299 __u32 priv; /* private data, depends on pixelformat */ 299 __u32 priv; /* private data, depends on pixelformat */
300}; 300};
301 301
@@ -378,7 +378,10 @@ struct v4l2_pix_format {
378#define V4L2_PIX_FMT_SGRBG12 v4l2_fourcc('B', 'A', '1', '2') /* 12 GRGR.. BGBG.. */ 378#define V4L2_PIX_FMT_SGRBG12 v4l2_fourcc('B', 'A', '1', '2') /* 12 GRGR.. BGBG.. */
379#define V4L2_PIX_FMT_SRGGB12 v4l2_fourcc('R', 'G', '1', '2') /* 12 RGRG.. GBGB.. */ 379#define V4L2_PIX_FMT_SRGGB12 v4l2_fourcc('R', 'G', '1', '2') /* 12 RGRG.. GBGB.. */
380 /* 10bit raw bayer DPCM compressed to 8 bits */ 380 /* 10bit raw bayer DPCM compressed to 8 bits */
381#define V4L2_PIX_FMT_SBGGR10DPCM8 v4l2_fourcc('b', 'B', 'A', '8')
382#define V4L2_PIX_FMT_SGBRG10DPCM8 v4l2_fourcc('b', 'G', 'A', '8')
381#define V4L2_PIX_FMT_SGRBG10DPCM8 v4l2_fourcc('B', 'D', '1', '0') 383#define V4L2_PIX_FMT_SGRBG10DPCM8 v4l2_fourcc('B', 'D', '1', '0')
384#define V4L2_PIX_FMT_SRGGB10DPCM8 v4l2_fourcc('b', 'R', 'A', '8')
382 /* 385 /*
383 * 10bit raw bayer, expanded to 16 bits 386 * 10bit raw bayer, expanded to 16 bits
384 * xxxxrrrrrrrrrrxxxxgggggggggg xxxxggggggggggxxxxbbbbbbbbbb... 387 * xxxxrrrrrrrrrrxxxxgggggggggg xxxxggggggggggxxxxbbbbbbbbbb...
@@ -432,7 +435,7 @@ struct v4l2_pix_format {
432 */ 435 */
433struct v4l2_fmtdesc { 436struct v4l2_fmtdesc {
434 __u32 index; /* Format number */ 437 __u32 index; /* Format number */
435 enum v4l2_buf_type type; /* buffer type */ 438 __u32 type; /* enum v4l2_buf_type */
436 __u32 flags; 439 __u32 flags;
437 __u8 description[32]; /* Description string */ 440 __u8 description[32]; /* Description string */
438 __u32 pixelformat; /* Format fourcc */ 441 __u32 pixelformat; /* Format fourcc */
@@ -573,8 +576,8 @@ struct v4l2_jpegcompression {
573 */ 576 */
574struct v4l2_requestbuffers { 577struct v4l2_requestbuffers {
575 __u32 count; 578 __u32 count;
576 enum v4l2_buf_type type; 579 __u32 type; /* enum v4l2_buf_type */
577 enum v4l2_memory memory; 580 __u32 memory; /* enum v4l2_memory */
578 __u32 reserved[2]; 581 __u32 reserved[2];
579}; 582};
580 583
@@ -610,15 +613,17 @@ struct v4l2_plane {
610/** 613/**
611 * struct v4l2_buffer - video buffer info 614 * struct v4l2_buffer - video buffer info
612 * @index: id number of the buffer 615 * @index: id number of the buffer
613 * @type: buffer type (type == *_MPLANE for multiplanar buffers) 616 * @type: enum v4l2_buf_type; buffer type (type == *_MPLANE for
617 * multiplanar buffers);
614 * @bytesused: number of bytes occupied by data in the buffer (payload); 618 * @bytesused: number of bytes occupied by data in the buffer (payload);
615 * unused (set to 0) for multiplanar buffers 619 * unused (set to 0) for multiplanar buffers
616 * @flags: buffer informational flags 620 * @flags: buffer informational flags
617 * @field: field order of the image in the buffer 621 * @field: enum v4l2_field; field order of the image in the buffer
618 * @timestamp: frame timestamp 622 * @timestamp: frame timestamp
619 * @timecode: frame timecode 623 * @timecode: frame timecode
620 * @sequence: sequence count of this frame 624 * @sequence: sequence count of this frame
621 * @memory: the method, in which the actual video data is passed 625 * @memory: enum v4l2_memory; the method, in which the actual video data is
626 * passed
622 * @offset: for non-multiplanar buffers with memory == V4L2_MEMORY_MMAP; 627 * @offset: for non-multiplanar buffers with memory == V4L2_MEMORY_MMAP;
623 * offset from the start of the device memory for this plane, 628 * offset from the start of the device memory for this plane,
624 * (or a "cookie" that should be passed to mmap() as offset) 629 * (or a "cookie" that should be passed to mmap() as offset)
@@ -636,16 +641,16 @@ struct v4l2_plane {
636 */ 641 */
637struct v4l2_buffer { 642struct v4l2_buffer {
638 __u32 index; 643 __u32 index;
639 enum v4l2_buf_type type; 644 __u32 type;
640 __u32 bytesused; 645 __u32 bytesused;
641 __u32 flags; 646 __u32 flags;
642 enum v4l2_field field; 647 __u32 field;
643 struct timeval timestamp; 648 struct timeval timestamp;
644 struct v4l2_timecode timecode; 649 struct v4l2_timecode timecode;
645 __u32 sequence; 650 __u32 sequence;
646 651
647 /* memory location */ 652 /* memory location */
648 enum v4l2_memory memory; 653 __u32 memory;
649 union { 654 union {
650 __u32 offset; 655 __u32 offset;
651 unsigned long userptr; 656 unsigned long userptr;
@@ -708,7 +713,7 @@ struct v4l2_clip {
708 713
709struct v4l2_window { 714struct v4l2_window {
710 struct v4l2_rect w; 715 struct v4l2_rect w;
711 enum v4l2_field field; 716 __u32 field; /* enum v4l2_field */
712 __u32 chromakey; 717 __u32 chromakey;
713 struct v4l2_clip __user *clips; 718 struct v4l2_clip __user *clips;
714 __u32 clipcount; 719 __u32 clipcount;
@@ -745,14 +750,14 @@ struct v4l2_outputparm {
745 * I N P U T I M A G E C R O P P I N G 750 * I N P U T I M A G E C R O P P I N G
746 */ 751 */
747struct v4l2_cropcap { 752struct v4l2_cropcap {
748 enum v4l2_buf_type type; 753 __u32 type; /* enum v4l2_buf_type */
749 struct v4l2_rect bounds; 754 struct v4l2_rect bounds;
750 struct v4l2_rect defrect; 755 struct v4l2_rect defrect;
751 struct v4l2_fract pixelaspect; 756 struct v4l2_fract pixelaspect;
752}; 757};
753 758
754struct v4l2_crop { 759struct v4l2_crop {
755 enum v4l2_buf_type type; 760 __u32 type; /* enum v4l2_buf_type */
756 struct v4l2_rect c; 761 struct v4l2_rect c;
757}; 762};
758 763
@@ -939,6 +944,9 @@ struct v4l2_standard {
939 __u32 reserved[4]; 944 __u32 reserved[4];
940}; 945};
941 946
947/* The DV Preset API is deprecated in favor of the DV Timings API.
948 New drivers shouldn't use this anymore! */
949
942/* 950/*
943 * V I D E O T I M I N G S D V P R E S E T 951 * V I D E O T I M I N G S D V P R E S E T
944 */ 952 */
@@ -986,29 +994,56 @@ struct v4l2_dv_enum_preset {
986 * D V B T T I M I N G S 994 * D V B T T I M I N G S
987 */ 995 */
988 996
989/* BT.656/BT.1120 timing data */ 997/** struct v4l2_bt_timings - BT.656/BT.1120 timing data
998 * @width: total width of the active video in pixels
999 * @height: total height of the active video in lines
1000 * @interlaced: Interlaced or progressive
1001 * @polarities: Positive or negative polarities
1002 * @pixelclock: Pixel clock in HZ. Ex. 74.25MHz->74250000
1003 * @hfrontporch:Horizontal front porch in pixels
1004 * @hsync: Horizontal Sync length in pixels
1005 * @hbackporch: Horizontal back porch in pixels
1006 * @vfrontporch:Vertical front porch in lines
1007 * @vsync: Vertical Sync length in lines
1008 * @vbackporch: Vertical back porch in lines
1009 * @il_vfrontporch:Vertical front porch for the even field
1010 * (aka field 2) of interlaced field formats
1011 * @il_vsync: Vertical Sync length for the even field
1012 * (aka field 2) of interlaced field formats
1013 * @il_vbackporch:Vertical back porch for the even field
1014 * (aka field 2) of interlaced field formats
1015 * @standards: Standards the timing belongs to
1016 * @flags: Flags
1017 * @reserved: Reserved fields, must be zeroed.
1018 *
1019 * A note regarding vertical interlaced timings: height refers to the total
1020 * height of the active video frame (= two fields). The blanking timings refer
1021 * to the blanking of each field. So the height of the total frame is
1022 * calculated as follows:
1023 *
1024 * tot_height = height + vfrontporch + vsync + vbackporch +
1025 * il_vfrontporch + il_vsync + il_vbackporch
1026 *
1027 * The active height of each field is height / 2.
1028 */
990struct v4l2_bt_timings { 1029struct v4l2_bt_timings {
991 __u32 width; /* width in pixels */ 1030 __u32 width;
992 __u32 height; /* height in lines */ 1031 __u32 height;
993 __u32 interlaced; /* Interlaced or progressive */ 1032 __u32 interlaced;
994 __u32 polarities; /* Positive or negative polarity */ 1033 __u32 polarities;
995 __u64 pixelclock; /* Pixel clock in HZ. Ex. 74.25MHz->74250000 */ 1034 __u64 pixelclock;
996 __u32 hfrontporch; /* Horizpontal front porch in pixels */ 1035 __u32 hfrontporch;
997 __u32 hsync; /* Horizontal Sync length in pixels */ 1036 __u32 hsync;
998 __u32 hbackporch; /* Horizontal back porch in pixels */ 1037 __u32 hbackporch;
999 __u32 vfrontporch; /* Vertical front porch in pixels */ 1038 __u32 vfrontporch;
1000 __u32 vsync; /* Vertical Sync length in lines */ 1039 __u32 vsync;
1001 __u32 vbackporch; /* Vertical back porch in lines */ 1040 __u32 vbackporch;
1002 __u32 il_vfrontporch; /* Vertical front porch for bottom field of 1041 __u32 il_vfrontporch;
1003 * interlaced field formats 1042 __u32 il_vsync;
1004 */ 1043 __u32 il_vbackporch;
1005 __u32 il_vsync; /* Vertical sync length for bottom field of 1044 __u32 standards;
1006 * interlaced field formats 1045 __u32 flags;
1007 */ 1046 __u32 reserved[14];
1008 __u32 il_vbackporch; /* Vertical back porch for bottom field of
1009 * interlaced field formats
1010 */
1011 __u32 reserved[16];
1012} __attribute__ ((packed)); 1047} __attribute__ ((packed));
1013 1048
1014/* Interlaced or progressive format */ 1049/* Interlaced or progressive format */
@@ -1019,8 +1054,42 @@ struct v4l2_bt_timings {
1019#define V4L2_DV_VSYNC_POS_POL 0x00000001 1054#define V4L2_DV_VSYNC_POS_POL 0x00000001
1020#define V4L2_DV_HSYNC_POS_POL 0x00000002 1055#define V4L2_DV_HSYNC_POS_POL 0x00000002
1021 1056
1022 1057/* Timings standards */
1023/* DV timings */ 1058#define V4L2_DV_BT_STD_CEA861 (1 << 0) /* CEA-861 Digital TV Profile */
1059#define V4L2_DV_BT_STD_DMT (1 << 1) /* VESA Discrete Monitor Timings */
1060#define V4L2_DV_BT_STD_CVT (1 << 2) /* VESA Coordinated Video Timings */
1061#define V4L2_DV_BT_STD_GTF (1 << 3) /* VESA Generalized Timings Formula */
1062
1063/* Flags */
1064
1065/* CVT/GTF specific: timing uses reduced blanking (CVT) or the 'Secondary
1066 GTF' curve (GTF). In both cases the horizontal and/or vertical blanking
1067 intervals are reduced, allowing a higher resolution over the same
1068 bandwidth. This is a read-only flag. */
1069#define V4L2_DV_FL_REDUCED_BLANKING (1 << 0)
1070/* CEA-861 specific: set for CEA-861 formats with a framerate of a multiple
1071 of six. These formats can be optionally played at 1 / 1.001 speed.
1072 This is a read-only flag. */
1073#define V4L2_DV_FL_CAN_REDUCE_FPS (1 << 1)
1074/* CEA-861 specific: only valid for video transmitters, the flag is cleared
1075 by receivers.
1076 If the framerate of the format is a multiple of six, then the pixelclock
1077 used to set up the transmitter is divided by 1.001 to make it compatible
1078 with 60 Hz based standards such as NTSC and PAL-M that use a framerate of
1079 29.97 Hz. Otherwise this flag is cleared. If the transmitter can't generate
1080 such frequencies, then the flag will also be cleared. */
1081#define V4L2_DV_FL_REDUCED_FPS (1 << 2)
1082/* Specific to interlaced formats: if set, then field 1 is really one half-line
1083 longer and field 2 is really one half-line shorter, so each field has
1084 exactly the same number of half-lines. Whether half-lines can be detected
1085 or used depends on the hardware. */
1086#define V4L2_DV_FL_HALF_LINE (1 << 0)
1087
1088
1089/** struct v4l2_dv_timings - DV timings
1090 * @type: the type of the timings
1091 * @bt: BT656/1120 timings
1092 */
1024struct v4l2_dv_timings { 1093struct v4l2_dv_timings {
1025 __u32 type; 1094 __u32 type;
1026 union { 1095 union {
@@ -1032,6 +1101,64 @@ struct v4l2_dv_timings {
1032/* Values for the type field */ 1101/* Values for the type field */
1033#define V4L2_DV_BT_656_1120 0 /* BT.656/1120 timing type */ 1102#define V4L2_DV_BT_656_1120 0 /* BT.656/1120 timing type */
1034 1103
1104
1105/** struct v4l2_enum_dv_timings - DV timings enumeration
1106 * @index: enumeration index
1107 * @reserved: must be zeroed
1108 * @timings: the timings for the given index
1109 */
1110struct v4l2_enum_dv_timings {
1111 __u32 index;
1112 __u32 reserved[3];
1113 struct v4l2_dv_timings timings;
1114};
1115
1116/** struct v4l2_bt_timings_cap - BT.656/BT.1120 timing capabilities
1117 * @min_width: width in pixels
1118 * @max_width: width in pixels
1119 * @min_height: height in lines
1120 * @max_height: height in lines
1121 * @min_pixelclock: Pixel clock in HZ. Ex. 74.25MHz->74250000
1122 * @max_pixelclock: Pixel clock in HZ. Ex. 74.25MHz->74250000
1123 * @standards: Supported standards
1124 * @capabilities: Supported capabilities
1125 * @reserved: Must be zeroed
1126 */
1127struct v4l2_bt_timings_cap {
1128 __u32 min_width;
1129 __u32 max_width;
1130 __u32 min_height;
1131 __u32 max_height;
1132 __u64 min_pixelclock;
1133 __u64 max_pixelclock;
1134 __u32 standards;
1135 __u32 capabilities;
1136 __u32 reserved[16];
1137} __attribute__ ((packed));
1138
1139/* Supports interlaced formats */
1140#define V4L2_DV_BT_CAP_INTERLACED (1 << 0)
1141/* Supports progressive formats */
1142#define V4L2_DV_BT_CAP_PROGRESSIVE (1 << 1)
1143/* Supports CVT/GTF reduced blanking */
1144#define V4L2_DV_BT_CAP_REDUCED_BLANKING (1 << 2)
1145/* Supports custom formats */
1146#define V4L2_DV_BT_CAP_CUSTOM (1 << 3)
1147
1148/** struct v4l2_dv_timings_cap - DV timings capabilities
1149 * @type: the type of the timings (same as in struct v4l2_dv_timings)
1150 * @bt: the BT656/1120 timings capabilities
1151 */
1152struct v4l2_dv_timings_cap {
1153 __u32 type;
1154 __u32 reserved[3];
1155 union {
1156 struct v4l2_bt_timings_cap bt;
1157 __u32 raw_data[32];
1158 };
1159};
1160
1161
1035/* 1162/*
1036 * V I D E O I N P U T S 1163 * V I D E O I N P U T S
1037 */ 1164 */
@@ -1040,7 +1167,7 @@ struct v4l2_input {
1040 __u8 name[32]; /* Label */ 1167 __u8 name[32]; /* Label */
1041 __u32 type; /* Type of input */ 1168 __u32 type; /* Type of input */
1042 __u32 audioset; /* Associated audios (bitfield) */ 1169 __u32 audioset; /* Associated audios (bitfield) */
1043 __u32 tuner; /* Associated tuner */ 1170 __u32 tuner; /* enum v4l2_tuner_type */
1044 v4l2_std_id std; 1171 v4l2_std_id std;
1045 __u32 status; 1172 __u32 status;
1046 __u32 capabilities; 1173 __u32 capabilities;
@@ -1137,6 +1264,8 @@ struct v4l2_ext_controls {
1137#define V4L2_CTRL_CLASS_FM_TX 0x009b0000 /* FM Modulator control class */ 1264#define V4L2_CTRL_CLASS_FM_TX 0x009b0000 /* FM Modulator control class */
1138#define V4L2_CTRL_CLASS_FLASH 0x009c0000 /* Camera flash controls */ 1265#define V4L2_CTRL_CLASS_FLASH 0x009c0000 /* Camera flash controls */
1139#define V4L2_CTRL_CLASS_JPEG 0x009d0000 /* JPEG-compression controls */ 1266#define V4L2_CTRL_CLASS_JPEG 0x009d0000 /* JPEG-compression controls */
1267#define V4L2_CTRL_CLASS_IMAGE_SOURCE 0x009e0000 /* Image source controls */
1268#define V4L2_CTRL_CLASS_IMAGE_PROC 0x009f0000 /* Image processing controls */
1140 1269
1141#define V4L2_CTRL_ID_MASK (0x0fffffff) 1270#define V4L2_CTRL_ID_MASK (0x0fffffff)
1142#define V4L2_CTRL_ID2CLASS(id) ((id) & 0x0fff0000UL) 1271#define V4L2_CTRL_ID2CLASS(id) ((id) & 0x0fff0000UL)
@@ -1151,12 +1280,13 @@ enum v4l2_ctrl_type {
1151 V4L2_CTRL_TYPE_CTRL_CLASS = 6, 1280 V4L2_CTRL_TYPE_CTRL_CLASS = 6,
1152 V4L2_CTRL_TYPE_STRING = 7, 1281 V4L2_CTRL_TYPE_STRING = 7,
1153 V4L2_CTRL_TYPE_BITMASK = 8, 1282 V4L2_CTRL_TYPE_BITMASK = 8,
1283 V4L2_CTRL_TYPE_INTEGER_MENU = 9,
1154}; 1284};
1155 1285
1156/* Used in the VIDIOC_QUERYCTRL ioctl for querying controls */ 1286/* Used in the VIDIOC_QUERYCTRL ioctl for querying controls */
1157struct v4l2_queryctrl { 1287struct v4l2_queryctrl {
1158 __u32 id; 1288 __u32 id;
1159 enum v4l2_ctrl_type type; 1289 __u32 type; /* enum v4l2_ctrl_type */
1160 __u8 name[32]; /* Whatever */ 1290 __u8 name[32]; /* Whatever */
1161 __s32 minimum; /* Note signedness */ 1291 __s32 minimum; /* Note signedness */
1162 __s32 maximum; 1292 __s32 maximum;
@@ -1170,9 +1300,12 @@ struct v4l2_queryctrl {
1170struct v4l2_querymenu { 1300struct v4l2_querymenu {
1171 __u32 id; 1301 __u32 id;
1172 __u32 index; 1302 __u32 index;
1173 __u8 name[32]; /* Whatever */ 1303 union {
1304 __u8 name[32]; /* Whatever */
1305 __s64 value;
1306 };
1174 __u32 reserved; 1307 __u32 reserved;
1175}; 1308} __attribute__ ((packed));
1176 1309
1177/* Control flags */ 1310/* Control flags */
1178#define V4L2_CTRL_FLAG_DISABLED 0x0001 1311#define V4L2_CTRL_FLAG_DISABLED 0x0001
@@ -1237,16 +1370,22 @@ enum v4l2_power_line_frequency {
1237#define V4L2_CID_COLOR_KILLER (V4L2_CID_BASE+30) 1370#define V4L2_CID_COLOR_KILLER (V4L2_CID_BASE+30)
1238#define V4L2_CID_COLORFX (V4L2_CID_BASE+31) 1371#define V4L2_CID_COLORFX (V4L2_CID_BASE+31)
1239enum v4l2_colorfx { 1372enum v4l2_colorfx {
1240 V4L2_COLORFX_NONE = 0, 1373 V4L2_COLORFX_NONE = 0,
1241 V4L2_COLORFX_BW = 1, 1374 V4L2_COLORFX_BW = 1,
1242 V4L2_COLORFX_SEPIA = 2, 1375 V4L2_COLORFX_SEPIA = 2,
1243 V4L2_COLORFX_NEGATIVE = 3, 1376 V4L2_COLORFX_NEGATIVE = 3,
1244 V4L2_COLORFX_EMBOSS = 4, 1377 V4L2_COLORFX_EMBOSS = 4,
1245 V4L2_COLORFX_SKETCH = 5, 1378 V4L2_COLORFX_SKETCH = 5,
1246 V4L2_COLORFX_SKY_BLUE = 6, 1379 V4L2_COLORFX_SKY_BLUE = 6,
1247 V4L2_COLORFX_GRASS_GREEN = 7, 1380 V4L2_COLORFX_GRASS_GREEN = 7,
1248 V4L2_COLORFX_SKIN_WHITEN = 8, 1381 V4L2_COLORFX_SKIN_WHITEN = 8,
1249 V4L2_COLORFX_VIVID = 9, 1382 V4L2_COLORFX_VIVID = 9,
1383 V4L2_COLORFX_AQUA = 10,
1384 V4L2_COLORFX_ART_FREEZE = 11,
1385 V4L2_COLORFX_SILHOUETTE = 12,
1386 V4L2_COLORFX_SOLARIZATION = 13,
1387 V4L2_COLORFX_ANTIQUE = 14,
1388 V4L2_COLORFX_SET_CBCR = 15,
1250}; 1389};
1251#define V4L2_CID_AUTOBRIGHTNESS (V4L2_CID_BASE+32) 1390#define V4L2_CID_AUTOBRIGHTNESS (V4L2_CID_BASE+32)
1252#define V4L2_CID_BAND_STOP_FILTER (V4L2_CID_BASE+33) 1391#define V4L2_CID_BAND_STOP_FILTER (V4L2_CID_BASE+33)
@@ -1263,9 +1402,10 @@ enum v4l2_colorfx {
1263#define V4L2_CID_MIN_BUFFERS_FOR_OUTPUT (V4L2_CID_BASE+40) 1402#define V4L2_CID_MIN_BUFFERS_FOR_OUTPUT (V4L2_CID_BASE+40)
1264 1403
1265#define V4L2_CID_ALPHA_COMPONENT (V4L2_CID_BASE+41) 1404#define V4L2_CID_ALPHA_COMPONENT (V4L2_CID_BASE+41)
1405#define V4L2_CID_COLORFX_CBCR (V4L2_CID_BASE+42)
1266 1406
1267/* last CID + 1 */ 1407/* last CID + 1 */
1268#define V4L2_CID_LASTP1 (V4L2_CID_BASE+42) 1408#define V4L2_CID_LASTP1 (V4L2_CID_BASE+43)
1269 1409
1270/* MPEG-class control IDs defined by V4L2 */ 1410/* MPEG-class control IDs defined by V4L2 */
1271#define V4L2_CID_MPEG_BASE (V4L2_CTRL_CLASS_MPEG | 0x900) 1411#define V4L2_CID_MPEG_BASE (V4L2_CTRL_CLASS_MPEG | 0x900)
@@ -1689,6 +1829,78 @@ enum v4l2_exposure_auto_type {
1689#define V4L2_CID_IRIS_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+17) 1829#define V4L2_CID_IRIS_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+17)
1690#define V4L2_CID_IRIS_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+18) 1830#define V4L2_CID_IRIS_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+18)
1691 1831
1832#define V4L2_CID_AUTO_EXPOSURE_BIAS (V4L2_CID_CAMERA_CLASS_BASE+19)
1833
1834#define V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE (V4L2_CID_CAMERA_CLASS_BASE+20)
1835enum v4l2_auto_n_preset_white_balance {
1836 V4L2_WHITE_BALANCE_MANUAL = 0,
1837 V4L2_WHITE_BALANCE_AUTO = 1,
1838 V4L2_WHITE_BALANCE_INCANDESCENT = 2,
1839 V4L2_WHITE_BALANCE_FLUORESCENT = 3,
1840 V4L2_WHITE_BALANCE_FLUORESCENT_H = 4,
1841 V4L2_WHITE_BALANCE_HORIZON = 5,
1842 V4L2_WHITE_BALANCE_DAYLIGHT = 6,
1843 V4L2_WHITE_BALANCE_FLASH = 7,
1844 V4L2_WHITE_BALANCE_CLOUDY = 8,
1845 V4L2_WHITE_BALANCE_SHADE = 9,
1846};
1847
1848#define V4L2_CID_WIDE_DYNAMIC_RANGE (V4L2_CID_CAMERA_CLASS_BASE+21)
1849#define V4L2_CID_IMAGE_STABILIZATION (V4L2_CID_CAMERA_CLASS_BASE+22)
1850
1851#define V4L2_CID_ISO_SENSITIVITY (V4L2_CID_CAMERA_CLASS_BASE+23)
1852#define V4L2_CID_ISO_SENSITIVITY_AUTO (V4L2_CID_CAMERA_CLASS_BASE+24)
1853enum v4l2_iso_sensitivity_auto_type {
1854 V4L2_ISO_SENSITIVITY_MANUAL = 0,
1855 V4L2_ISO_SENSITIVITY_AUTO = 1,
1856};
1857
1858#define V4L2_CID_EXPOSURE_METERING (V4L2_CID_CAMERA_CLASS_BASE+25)
1859enum v4l2_exposure_metering {
1860 V4L2_EXPOSURE_METERING_AVERAGE = 0,
1861 V4L2_EXPOSURE_METERING_CENTER_WEIGHTED = 1,
1862 V4L2_EXPOSURE_METERING_SPOT = 2,
1863};
1864
1865#define V4L2_CID_SCENE_MODE (V4L2_CID_CAMERA_CLASS_BASE+26)
1866enum v4l2_scene_mode {
1867 V4L2_SCENE_MODE_NONE = 0,
1868 V4L2_SCENE_MODE_BACKLIGHT = 1,
1869 V4L2_SCENE_MODE_BEACH_SNOW = 2,
1870 V4L2_SCENE_MODE_CANDLE_LIGHT = 3,
1871 V4L2_SCENE_MODE_DAWN_DUSK = 4,
1872 V4L2_SCENE_MODE_FALL_COLORS = 5,
1873 V4L2_SCENE_MODE_FIREWORKS = 6,
1874 V4L2_SCENE_MODE_LANDSCAPE = 7,
1875 V4L2_SCENE_MODE_NIGHT = 8,
1876 V4L2_SCENE_MODE_PARTY_INDOOR = 9,
1877 V4L2_SCENE_MODE_PORTRAIT = 10,
1878 V4L2_SCENE_MODE_SPORTS = 11,
1879 V4L2_SCENE_MODE_SUNSET = 12,
1880 V4L2_SCENE_MODE_TEXT = 13,
1881};
1882
1883#define V4L2_CID_3A_LOCK (V4L2_CID_CAMERA_CLASS_BASE+27)
1884#define V4L2_LOCK_EXPOSURE (1 << 0)
1885#define V4L2_LOCK_WHITE_BALANCE (1 << 1)
1886#define V4L2_LOCK_FOCUS (1 << 2)
1887
1888#define V4L2_CID_AUTO_FOCUS_START (V4L2_CID_CAMERA_CLASS_BASE+28)
1889#define V4L2_CID_AUTO_FOCUS_STOP (V4L2_CID_CAMERA_CLASS_BASE+29)
1890#define V4L2_CID_AUTO_FOCUS_STATUS (V4L2_CID_CAMERA_CLASS_BASE+30)
1891#define V4L2_AUTO_FOCUS_STATUS_IDLE (0 << 0)
1892#define V4L2_AUTO_FOCUS_STATUS_BUSY (1 << 0)
1893#define V4L2_AUTO_FOCUS_STATUS_REACHED (1 << 1)
1894#define V4L2_AUTO_FOCUS_STATUS_FAILED (1 << 2)
1895
1896#define V4L2_CID_AUTO_FOCUS_RANGE (V4L2_CID_CAMERA_CLASS_BASE+31)
1897enum v4l2_auto_focus_range {
1898 V4L2_AUTO_FOCUS_RANGE_AUTO = 0,
1899 V4L2_AUTO_FOCUS_RANGE_NORMAL = 1,
1900 V4L2_AUTO_FOCUS_RANGE_MACRO = 2,
1901 V4L2_AUTO_FOCUS_RANGE_INFINITY = 3,
1902};
1903
1692/* FM Modulator class control IDs */ 1904/* FM Modulator class control IDs */
1693#define V4L2_CID_FM_TX_CLASS_BASE (V4L2_CTRL_CLASS_FM_TX | 0x900) 1905#define V4L2_CID_FM_TX_CLASS_BASE (V4L2_CTRL_CLASS_FM_TX | 0x900)
1694#define V4L2_CID_FM_TX_CLASS (V4L2_CTRL_CLASS_FM_TX | 1) 1906#define V4L2_CID_FM_TX_CLASS (V4L2_CTRL_CLASS_FM_TX | 1)
@@ -1782,13 +1994,28 @@ enum v4l2_jpeg_chroma_subsampling {
1782#define V4L2_JPEG_ACTIVE_MARKER_DQT (1 << 17) 1994#define V4L2_JPEG_ACTIVE_MARKER_DQT (1 << 17)
1783#define V4L2_JPEG_ACTIVE_MARKER_DHT (1 << 18) 1995#define V4L2_JPEG_ACTIVE_MARKER_DHT (1 << 18)
1784 1996
1997/* Image source controls */
1998#define V4L2_CID_IMAGE_SOURCE_CLASS_BASE (V4L2_CTRL_CLASS_IMAGE_SOURCE | 0x900)
1999#define V4L2_CID_IMAGE_SOURCE_CLASS (V4L2_CTRL_CLASS_IMAGE_SOURCE | 1)
2000
2001#define V4L2_CID_VBLANK (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 1)
2002#define V4L2_CID_HBLANK (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 2)
2003#define V4L2_CID_ANALOGUE_GAIN (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 3)
2004
2005/* Image processing controls */
2006#define V4L2_CID_IMAGE_PROC_CLASS_BASE (V4L2_CTRL_CLASS_IMAGE_PROC | 0x900)
2007#define V4L2_CID_IMAGE_PROC_CLASS (V4L2_CTRL_CLASS_IMAGE_PROC | 1)
2008
2009#define V4L2_CID_LINK_FREQ (V4L2_CID_IMAGE_PROC_CLASS_BASE + 1)
2010#define V4L2_CID_PIXEL_RATE (V4L2_CID_IMAGE_PROC_CLASS_BASE + 2)
2011
1785/* 2012/*
1786 * T U N I N G 2013 * T U N I N G
1787 */ 2014 */
1788struct v4l2_tuner { 2015struct v4l2_tuner {
1789 __u32 index; 2016 __u32 index;
1790 __u8 name[32]; 2017 __u8 name[32];
1791 enum v4l2_tuner_type type; 2018 __u32 type; /* enum v4l2_tuner_type */
1792 __u32 capability; 2019 __u32 capability;
1793 __u32 rangelow; 2020 __u32 rangelow;
1794 __u32 rangehigh; 2021 __u32 rangehigh;
@@ -1838,14 +2065,14 @@ struct v4l2_modulator {
1838 2065
1839struct v4l2_frequency { 2066struct v4l2_frequency {
1840 __u32 tuner; 2067 __u32 tuner;
1841 enum v4l2_tuner_type type; 2068 __u32 type; /* enum v4l2_tuner_type */
1842 __u32 frequency; 2069 __u32 frequency;
1843 __u32 reserved[8]; 2070 __u32 reserved[8];
1844}; 2071};
1845 2072
1846struct v4l2_hw_freq_seek { 2073struct v4l2_hw_freq_seek {
1847 __u32 tuner; 2074 __u32 tuner;
1848 enum v4l2_tuner_type type; 2075 __u32 type; /* enum v4l2_tuner_type */
1849 __u32 seek_upward; 2076 __u32 seek_upward;
1850 __u32 wrap_around; 2077 __u32 wrap_around;
1851 __u32 spacing; 2078 __u32 spacing;
@@ -2056,7 +2283,7 @@ struct v4l2_sliced_vbi_cap {
2056 (equals frame lines 313-336 for 625 line video 2283 (equals frame lines 313-336 for 625 line video
2057 standards, 263-286 for 525 line standards) */ 2284 standards, 263-286 for 525 line standards) */
2058 __u16 service_lines[2][24]; 2285 __u16 service_lines[2][24];
2059 enum v4l2_buf_type type; 2286 __u32 type; /* enum v4l2_buf_type */
2060 __u32 reserved[3]; /* must be 0 */ 2287 __u32 reserved[3]; /* must be 0 */
2061}; 2288};
2062 2289
@@ -2137,8 +2364,8 @@ struct v4l2_plane_pix_format {
2137 * @width: image width in pixels 2364 * @width: image width in pixels
2138 * @height: image height in pixels 2365 * @height: image height in pixels
2139 * @pixelformat: little endian four character code (fourcc) 2366 * @pixelformat: little endian four character code (fourcc)
2140 * @field: field order (for interlaced video) 2367 * @field: enum v4l2_field; field order (for interlaced video)
2141 * @colorspace: supplemental to pixelformat 2368 * @colorspace: enum v4l2_colorspace; supplemental to pixelformat
2142 * @plane_fmt: per-plane information 2369 * @plane_fmt: per-plane information
2143 * @num_planes: number of planes for this format 2370 * @num_planes: number of planes for this format
2144 */ 2371 */
@@ -2146,8 +2373,8 @@ struct v4l2_pix_format_mplane {
2146 __u32 width; 2373 __u32 width;
2147 __u32 height; 2374 __u32 height;
2148 __u32 pixelformat; 2375 __u32 pixelformat;
2149 enum v4l2_field field; 2376 __u32 field;
2150 enum v4l2_colorspace colorspace; 2377 __u32 colorspace;
2151 2378
2152 struct v4l2_plane_pix_format plane_fmt[VIDEO_MAX_PLANES]; 2379 struct v4l2_plane_pix_format plane_fmt[VIDEO_MAX_PLANES];
2153 __u8 num_planes; 2380 __u8 num_planes;
@@ -2156,7 +2383,7 @@ struct v4l2_pix_format_mplane {
2156 2383
2157/** 2384/**
2158 * struct v4l2_format - stream data format 2385 * struct v4l2_format - stream data format
2159 * @type: type of the data stream 2386 * @type: enum v4l2_buf_type; type of the data stream
2160 * @pix: definition of an image format 2387 * @pix: definition of an image format
2161 * @pix_mp: definition of a multiplanar image format 2388 * @pix_mp: definition of a multiplanar image format
2162 * @win: definition of an overlaid image 2389 * @win: definition of an overlaid image
@@ -2165,7 +2392,7 @@ struct v4l2_pix_format_mplane {
2165 * @raw_data: placeholder for future extensions and custom formats 2392 * @raw_data: placeholder for future extensions and custom formats
2166 */ 2393 */
2167struct v4l2_format { 2394struct v4l2_format {
2168 enum v4l2_buf_type type; 2395 __u32 type;
2169 union { 2396 union {
2170 struct v4l2_pix_format pix; /* V4L2_BUF_TYPE_VIDEO_CAPTURE */ 2397 struct v4l2_pix_format pix; /* V4L2_BUF_TYPE_VIDEO_CAPTURE */
2171 struct v4l2_pix_format_mplane pix_mp; /* V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE */ 2398 struct v4l2_pix_format_mplane pix_mp; /* V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE */
@@ -2179,7 +2406,7 @@ struct v4l2_format {
2179/* Stream type-dependent parameters 2406/* Stream type-dependent parameters
2180 */ 2407 */
2181struct v4l2_streamparm { 2408struct v4l2_streamparm {
2182 enum v4l2_buf_type type; 2409 __u32 type; /* enum v4l2_buf_type */
2183 union { 2410 union {
2184 struct v4l2_captureparm capture; 2411 struct v4l2_captureparm capture;
2185 struct v4l2_outputparm output; 2412 struct v4l2_outputparm output;
@@ -2292,14 +2519,14 @@ struct v4l2_dbg_chip_ident {
2292 * @index: on return, index of the first created buffer 2519 * @index: on return, index of the first created buffer
2293 * @count: entry: number of requested buffers, 2520 * @count: entry: number of requested buffers,
2294 * return: number of created buffers 2521 * return: number of created buffers
2295 * @memory: buffer memory type 2522 * @memory: enum v4l2_memory; buffer memory type
2296 * @format: frame format, for which buffers are requested 2523 * @format: frame format, for which buffers are requested
2297 * @reserved: future extensions 2524 * @reserved: future extensions
2298 */ 2525 */
2299struct v4l2_create_buffers { 2526struct v4l2_create_buffers {
2300 __u32 index; 2527 __u32 index;
2301 __u32 count; 2528 __u32 count;
2302 enum v4l2_memory memory; 2529 __u32 memory;
2303 struct v4l2_format format; 2530 struct v4l2_format format;
2304 __u32 reserved[8]; 2531 __u32 reserved[8];
2305}; 2532};
@@ -2356,8 +2583,8 @@ struct v4l2_create_buffers {
2356#define VIDIOC_TRY_FMT _IOWR('V', 64, struct v4l2_format) 2583#define VIDIOC_TRY_FMT _IOWR('V', 64, struct v4l2_format)
2357#define VIDIOC_ENUMAUDIO _IOWR('V', 65, struct v4l2_audio) 2584#define VIDIOC_ENUMAUDIO _IOWR('V', 65, struct v4l2_audio)
2358#define VIDIOC_ENUMAUDOUT _IOWR('V', 66, struct v4l2_audioout) 2585#define VIDIOC_ENUMAUDOUT _IOWR('V', 66, struct v4l2_audioout)
2359#define VIDIOC_G_PRIORITY _IOR('V', 67, enum v4l2_priority) 2586#define VIDIOC_G_PRIORITY _IOR('V', 67, __u32) /* enum v4l2_priority */
2360#define VIDIOC_S_PRIORITY _IOW('V', 68, enum v4l2_priority) 2587#define VIDIOC_S_PRIORITY _IOW('V', 68, __u32) /* enum v4l2_priority */
2361#define VIDIOC_G_SLICED_VBI_CAP _IOWR('V', 69, struct v4l2_sliced_vbi_cap) 2588#define VIDIOC_G_SLICED_VBI_CAP _IOWR('V', 69, struct v4l2_sliced_vbi_cap)
2362#define VIDIOC_LOG_STATUS _IO('V', 70) 2589#define VIDIOC_LOG_STATUS _IO('V', 70)
2363#define VIDIOC_G_EXT_CTRLS _IOWR('V', 71, struct v4l2_ext_controls) 2590#define VIDIOC_G_EXT_CTRLS _IOWR('V', 71, struct v4l2_ext_controls)
@@ -2384,6 +2611,9 @@ struct v4l2_create_buffers {
2384#endif 2611#endif
2385 2612
2386#define VIDIOC_S_HW_FREQ_SEEK _IOW('V', 82, struct v4l2_hw_freq_seek) 2613#define VIDIOC_S_HW_FREQ_SEEK _IOW('V', 82, struct v4l2_hw_freq_seek)
2614
2615/* These four DV Preset ioctls are deprecated in favor of the DV Timings
2616 ioctls. */
2387#define VIDIOC_ENUM_DV_PRESETS _IOWR('V', 83, struct v4l2_dv_enum_preset) 2617#define VIDIOC_ENUM_DV_PRESETS _IOWR('V', 83, struct v4l2_dv_enum_preset)
2388#define VIDIOC_S_DV_PRESET _IOWR('V', 84, struct v4l2_dv_preset) 2618#define VIDIOC_S_DV_PRESET _IOWR('V', 84, struct v4l2_dv_preset)
2389#define VIDIOC_G_DV_PRESET _IOWR('V', 85, struct v4l2_dv_preset) 2619#define VIDIOC_G_DV_PRESET _IOWR('V', 85, struct v4l2_dv_preset)
@@ -2408,6 +2638,12 @@ struct v4l2_create_buffers {
2408#define VIDIOC_DECODER_CMD _IOWR('V', 96, struct v4l2_decoder_cmd) 2638#define VIDIOC_DECODER_CMD _IOWR('V', 96, struct v4l2_decoder_cmd)
2409#define VIDIOC_TRY_DECODER_CMD _IOWR('V', 97, struct v4l2_decoder_cmd) 2639#define VIDIOC_TRY_DECODER_CMD _IOWR('V', 97, struct v4l2_decoder_cmd)
2410 2640
2641/* Experimental, these three ioctls may change over the next couple of kernel
2642 versions. */
2643#define VIDIOC_ENUM_DV_TIMINGS _IOWR('V', 96, struct v4l2_enum_dv_timings)
2644#define VIDIOC_QUERY_DV_TIMINGS _IOR('V', 97, struct v4l2_dv_timings)
2645#define VIDIOC_DV_TIMINGS_CAP _IOWR('V', 98, struct v4l2_dv_timings_cap)
2646
2411/* Reminder: when adding new ioctls please add support for them to 2647/* Reminder: when adding new ioctls please add support for them to
2412 drivers/media/video/v4l2-compat-ioctl32.c as well! */ 2648 drivers/media/video/v4l2-compat-ioctl32.c as well! */
2413 2649
diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h
index 7323a3390206..fc457f452f64 100644
--- a/include/linux/virtio_config.h
+++ b/include/linux/virtio_config.h
@@ -74,15 +74,6 @@
74 * @set_status: write the status byte 74 * @set_status: write the status byte
75 * vdev: the virtio_device 75 * vdev: the virtio_device
76 * status: the new status byte 76 * status: the new status byte
77 * @request_vqs: request the specified number of virtqueues
78 * vdev: the virtio_device
79 * max_vqs: the max number of virtqueues we want
80 * If supplied, must call before any virtqueues are instantiated.
81 * To modify the max number of virtqueues after request_vqs has been
82 * called, call free_vqs and then request_vqs with a new value.
83 * @free_vqs: cleanup resources allocated by request_vqs
84 * vdev: the virtio_device
85 * If supplied, must call after all virtqueues have been deleted.
86 * @reset: reset the device 77 * @reset: reset the device
87 * vdev: the virtio device 78 * vdev: the virtio device
88 * After this, status and feature negotiation must be done again 79 * After this, status and feature negotiation must be done again
@@ -156,7 +147,7 @@ static inline bool virtio_has_feature(const struct virtio_device *vdev,
156 * @vdev: the virtio device 147 * @vdev: the virtio device
157 * @fbit: the feature bit 148 * @fbit: the feature bit
158 * @offset: the type to search for. 149 * @offset: the type to search for.
159 * @val: a pointer to the value to fill in. 150 * @v: a pointer to the value to fill in.
160 * 151 *
161 * The return value is -ENOENT if the feature doesn't exist. Otherwise 152 * The return value is -ENOENT if the feature doesn't exist. Otherwise
162 * the config value is copied into whatever is pointed to by v. */ 153 * the config value is copied into whatever is pointed to by v. */
diff --git a/include/linux/virtio_net.h b/include/linux/virtio_net.h
index 970d5a2a9047..2470f541af50 100644
--- a/include/linux/virtio_net.h
+++ b/include/linux/virtio_net.h
@@ -49,8 +49,11 @@
49#define VIRTIO_NET_F_CTRL_RX 18 /* Control channel RX mode support */ 49#define VIRTIO_NET_F_CTRL_RX 18 /* Control channel RX mode support */
50#define VIRTIO_NET_F_CTRL_VLAN 19 /* Control channel VLAN filtering */ 50#define VIRTIO_NET_F_CTRL_VLAN 19 /* Control channel VLAN filtering */
51#define VIRTIO_NET_F_CTRL_RX_EXTRA 20 /* Extra RX mode control support */ 51#define VIRTIO_NET_F_CTRL_RX_EXTRA 20 /* Extra RX mode control support */
52#define VIRTIO_NET_F_GUEST_ANNOUNCE 21 /* Guest can announce device on the
53 * network */
52 54
53#define VIRTIO_NET_S_LINK_UP 1 /* Link is up */ 55#define VIRTIO_NET_S_LINK_UP 1 /* Link is up */
56#define VIRTIO_NET_S_ANNOUNCE 2 /* Announcement is needed */
54 57
55struct virtio_net_config { 58struct virtio_net_config {
56 /* The config defining mac address (if VIRTIO_NET_F_MAC) */ 59 /* The config defining mac address (if VIRTIO_NET_F_MAC) */
@@ -152,4 +155,15 @@ struct virtio_net_ctrl_mac {
152 #define VIRTIO_NET_CTRL_VLAN_ADD 0 155 #define VIRTIO_NET_CTRL_VLAN_ADD 0
153 #define VIRTIO_NET_CTRL_VLAN_DEL 1 156 #define VIRTIO_NET_CTRL_VLAN_DEL 1
154 157
158/*
159 * Control link announce acknowledgement
160 *
161 * The command VIRTIO_NET_CTRL_ANNOUNCE_ACK is used to indicate that
162 * driver has recevied the notification; device would clear the
163 * VIRTIO_NET_S_ANNOUNCE bit in the status field after it receives
164 * this command.
165 */
166#define VIRTIO_NET_CTRL_ANNOUNCE 3
167 #define VIRTIO_NET_CTRL_ANNOUNCE_ACK 0
168
155#endif /* _LINUX_VIRTIO_NET_H */ 169#endif /* _LINUX_VIRTIO_NET_H */
diff --git a/include/linux/vme.h b/include/linux/vme.h
new file mode 100644
index 000000000000..c9d65bf14cec
--- /dev/null
+++ b/include/linux/vme.h
@@ -0,0 +1,174 @@
1#ifndef _VME_H_
2#define _VME_H_
3
4/* Resource Type */
5enum vme_resource_type {
6 VME_MASTER,
7 VME_SLAVE,
8 VME_DMA,
9 VME_LM
10};
11
12/* VME Address Spaces */
13#define VME_A16 0x1
14#define VME_A24 0x2
15#define VME_A32 0x4
16#define VME_A64 0x8
17#define VME_CRCSR 0x10
18#define VME_USER1 0x20
19#define VME_USER2 0x40
20#define VME_USER3 0x80
21#define VME_USER4 0x100
22
23#define VME_A16_MAX 0x10000ULL
24#define VME_A24_MAX 0x1000000ULL
25#define VME_A32_MAX 0x100000000ULL
26#define VME_A64_MAX 0x10000000000000000ULL
27#define VME_CRCSR_MAX 0x1000000ULL
28
29
30/* VME Cycle Types */
31#define VME_SCT 0x1
32#define VME_BLT 0x2
33#define VME_MBLT 0x4
34#define VME_2eVME 0x8
35#define VME_2eSST 0x10
36#define VME_2eSSTB 0x20
37
38#define VME_2eSST160 0x100
39#define VME_2eSST267 0x200
40#define VME_2eSST320 0x400
41
42#define VME_SUPER 0x1000
43#define VME_USER 0x2000
44#define VME_PROG 0x4000
45#define VME_DATA 0x8000
46
47/* VME Data Widths */
48#define VME_D8 0x1
49#define VME_D16 0x2
50#define VME_D32 0x4
51#define VME_D64 0x8
52
53/* Arbitration Scheduling Modes */
54#define VME_R_ROBIN_MODE 0x1
55#define VME_PRIORITY_MODE 0x2
56
57#define VME_DMA_PATTERN (1<<0)
58#define VME_DMA_PCI (1<<1)
59#define VME_DMA_VME (1<<2)
60
61#define VME_DMA_PATTERN_BYTE (1<<0)
62#define VME_DMA_PATTERN_WORD (1<<1)
63#define VME_DMA_PATTERN_INCREMENT (1<<2)
64
65#define VME_DMA_VME_TO_MEM (1<<0)
66#define VME_DMA_MEM_TO_VME (1<<1)
67#define VME_DMA_VME_TO_VME (1<<2)
68#define VME_DMA_MEM_TO_MEM (1<<3)
69#define VME_DMA_PATTERN_TO_VME (1<<4)
70#define VME_DMA_PATTERN_TO_MEM (1<<5)
71
72struct vme_dma_attr {
73 u32 type;
74 void *private;
75};
76
77struct vme_resource {
78 enum vme_resource_type type;
79 struct list_head *entry;
80};
81
82extern struct bus_type vme_bus_type;
83
84/* VME_MAX_BRIDGES comes from the type of vme_bus_numbers */
85#define VME_MAX_BRIDGES (sizeof(unsigned int)*8)
86#define VME_MAX_SLOTS 32
87
88#define VME_SLOT_CURRENT -1
89#define VME_SLOT_ALL -2
90
91/**
92 * Structure representing a VME device
93 * @num: The device number
94 * @bridge: Pointer to the bridge device this device is on
95 * @dev: Internal device structure
96 * @drv_list: List of devices (per driver)
97 * @bridge_list: List of devices (per bridge)
98 */
99struct vme_dev {
100 int num;
101 struct vme_bridge *bridge;
102 struct device dev;
103 struct list_head drv_list;
104 struct list_head bridge_list;
105};
106
107struct vme_driver {
108 struct list_head node;
109 const char *name;
110 int (*match)(struct vme_dev *);
111 int (*probe)(struct vme_dev *);
112 int (*remove)(struct vme_dev *);
113 void (*shutdown)(void);
114 struct device_driver driver;
115 struct list_head devices;
116};
117
118void *vme_alloc_consistent(struct vme_resource *, size_t, dma_addr_t *);
119void vme_free_consistent(struct vme_resource *, size_t, void *,
120 dma_addr_t);
121
122size_t vme_get_size(struct vme_resource *);
123
124struct vme_resource *vme_slave_request(struct vme_dev *, u32, u32);
125int vme_slave_set(struct vme_resource *, int, unsigned long long,
126 unsigned long long, dma_addr_t, u32, u32);
127int vme_slave_get(struct vme_resource *, int *, unsigned long long *,
128 unsigned long long *, dma_addr_t *, u32 *, u32 *);
129void vme_slave_free(struct vme_resource *);
130
131struct vme_resource *vme_master_request(struct vme_dev *, u32, u32, u32);
132int vme_master_set(struct vme_resource *, int, unsigned long long,
133 unsigned long long, u32, u32, u32);
134int vme_master_get(struct vme_resource *, int *, unsigned long long *,
135 unsigned long long *, u32 *, u32 *, u32 *);
136ssize_t vme_master_read(struct vme_resource *, void *, size_t, loff_t);
137ssize_t vme_master_write(struct vme_resource *, void *, size_t, loff_t);
138unsigned int vme_master_rmw(struct vme_resource *, unsigned int, unsigned int,
139 unsigned int, loff_t);
140void vme_master_free(struct vme_resource *);
141
142struct vme_resource *vme_dma_request(struct vme_dev *, u32);
143struct vme_dma_list *vme_new_dma_list(struct vme_resource *);
144struct vme_dma_attr *vme_dma_pattern_attribute(u32, u32);
145struct vme_dma_attr *vme_dma_pci_attribute(dma_addr_t);
146struct vme_dma_attr *vme_dma_vme_attribute(unsigned long long, u32, u32, u32);
147void vme_dma_free_attribute(struct vme_dma_attr *);
148int vme_dma_list_add(struct vme_dma_list *, struct vme_dma_attr *,
149 struct vme_dma_attr *, size_t);
150int vme_dma_list_exec(struct vme_dma_list *);
151int vme_dma_list_free(struct vme_dma_list *);
152int vme_dma_free(struct vme_resource *);
153
154int vme_irq_request(struct vme_dev *, int, int,
155 void (*callback)(int, int, void *), void *);
156void vme_irq_free(struct vme_dev *, int, int);
157int vme_irq_generate(struct vme_dev *, int, int);
158
159struct vme_resource *vme_lm_request(struct vme_dev *);
160int vme_lm_count(struct vme_resource *);
161int vme_lm_set(struct vme_resource *, unsigned long long, u32, u32);
162int vme_lm_get(struct vme_resource *, unsigned long long *, u32 *, u32 *);
163int vme_lm_attach(struct vme_resource *, int, void (*callback)(int));
164int vme_lm_detach(struct vme_resource *, int);
165void vme_lm_free(struct vme_resource *);
166
167int vme_slot_get(struct vme_dev *);
168
169int vme_register_driver(struct vme_driver *, unsigned int);
170void vme_unregister_driver(struct vme_driver *);
171
172
173#endif /* _VME_H_ */
174
diff --git a/include/linux/vt_kern.h b/include/linux/vt_kern.h
index e33d77f15bda..50ae7d0c279e 100644
--- a/include/linux/vt_kern.h
+++ b/include/linux/vt_kern.h
@@ -70,7 +70,6 @@ int con_set_unimap(struct vc_data *vc, ushort ct, struct unipair __user *list);
70int con_get_unimap(struct vc_data *vc, ushort ct, ushort __user *uct, struct unipair __user *list); 70int con_get_unimap(struct vc_data *vc, ushort ct, ushort __user *uct, struct unipair __user *list);
71int con_set_default_unimap(struct vc_data *vc); 71int con_set_default_unimap(struct vc_data *vc);
72void con_free_unimap(struct vc_data *vc); 72void con_free_unimap(struct vc_data *vc);
73void con_protect_unimap(struct vc_data *vc, int rdonly);
74int con_copy_unimap(struct vc_data *dst_vc, struct vc_data *src_vc); 73int con_copy_unimap(struct vc_data *dst_vc, struct vc_data *src_vc);
75 74
76#define vc_translate(vc, c) ((vc)->vc_translate[(c) | \ 75#define vc_translate(vc, c) ((vc)->vc_translate[(c) | \