aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-06-08 14:31:16 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-06-08 14:31:16 -0400
commit3f17ea6dea8ba5668873afa54628a91aaa3fb1c0 (patch)
treeafbeb2accd4c2199ddd705ae943995b143a0af02 /include/linux
parent1860e379875dfe7271c649058aeddffe5afd9d0d (diff)
parent1a5700bc2d10cd379a795fd2bb377a190af5acd4 (diff)
Merge branch 'next' (accumulated 3.16 merge window patches) into master
Now that 3.15 is released, this merges the 'next' branch into 'master', bringing us to the normal situation where my 'master' branch is the merge window. * accumulated work in next: (6809 commits) ufs: sb mutex merge + mutex_destroy powerpc: update comments for generic idle conversion cris: update comments for generic idle conversion idle: remove cpu_idle() forward declarations nbd: zero from and len fields in NBD_CMD_DISCONNECT. mm: convert some level-less printks to pr_* MAINTAINERS: adi-buildroot-devel is moderated MAINTAINERS: add linux-api for review of API/ABI changes mm/kmemleak-test.c: use pr_fmt for logging fs/dlm/debug_fs.c: replace seq_printf by seq_puts fs/dlm/lockspace.c: convert simple_str to kstr fs/dlm/config.c: convert simple_str to kstr mm: mark remap_file_pages() syscall as deprecated mm: memcontrol: remove unnecessary memcg argument from soft limit functions mm: memcontrol: clean up memcg zoneinfo lookup mm/memblock.c: call kmemleak directly from memblock_(alloc|free) mm/mempool.c: update the kmemleak stack trace for mempool allocations lib/radix-tree.c: update the kmemleak stack trace for radix tree allocations mm: introduce kmemleak_update_trace() mm/kmemleak.c: use %u to print ->checksum ...
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/acpi.h30
-rw-r--r--include/linux/amba/mmci.h42
-rw-r--r--include/linux/atomic.h36
-rw-r--r--include/linux/backlight.h7
-rw-r--r--include/linux/bio.h2
-rw-r--r--include/linux/bitops.h20
-rw-r--r--include/linux/blk-mq.h101
-rw-r--r--include/linux/blk_types.h2
-rw-r--r--include/linux/blkdev.h51
-rw-r--r--include/linux/bootmem.h6
-rw-r--r--include/linux/buffer_head.h4
-rw-r--r--include/linux/clk-provider.h163
-rw-r--r--include/linux/clk/at91_pmc.h1
-rw-r--r--include/linux/clk/shmobile.h3
-rw-r--r--include/linux/clk/sunxi.h22
-rw-r--r--include/linux/clocksource.h16
-rw-r--r--include/linux/compaction.h4
-rw-r--r--include/linux/compiler-intel.h3
-rw-r--r--include/linux/compiler.h13
-rw-r--r--include/linux/connector.h1
-rw-r--r--include/linux/console_struct.h5
-rw-r--r--include/linux/cpu.h1
-rw-r--r--include/linux/cpufreq.h50
-rw-r--r--include/linux/cpuidle.h7
-rw-r--r--include/linux/cpuset.h29
-rw-r--r--include/linux/devfreq.h35
-rw-r--r--include/linux/device.h23
-rw-r--r--include/linux/dma-contiguous.h9
-rw-r--r--include/linux/dma-mapping.h20
-rw-r--r--include/linux/efi.h24
-rw-r--r--include/linux/extcon.h37
-rw-r--r--include/linux/fb.h3
-rw-r--r--include/linux/firewire.h3
-rw-r--r--include/linux/fs.h1
-rw-r--r--include/linux/ftrace.h34
-rw-r--r--include/linux/genhd.h2
-rw-r--r--include/linux/gfp.h15
-rw-r--r--include/linux/goldfish.h15
-rw-r--r--include/linux/gpio/consumer.h41
-rw-r--r--include/linux/gpio/driver.h5
-rw-r--r--include/linux/hid-sensor-hub.h8
-rw-r--r--include/linux/hid-sensor-ids.h1
-rw-r--r--include/linux/hid.h17
-rw-r--r--include/linux/hsi/hsi.h39
-rw-r--r--include/linux/hsi/ssi_protocol.h42
-rw-r--r--include/linux/hugetlb.h22
-rw-r--r--include/linux/hyperv.h7
-rw-r--r--include/linux/idr.h13
-rw-r--r--include/linux/iio/common/st_sensors.h4
-rw-r--r--include/linux/iio/consumer.h13
-rw-r--r--include/linux/iio/iio.h24
-rw-r--r--include/linux/iio/types.h4
-rw-r--r--include/linux/init.h14
-rw-r--r--include/linux/interrupt.h54
-rw-r--r--include/linux/irq.h38
-rw-r--r--include/linux/irqchip/arm-gic.h2
-rw-r--r--include/linux/irqdesc.h4
-rw-r--r--include/linux/jump_label.h20
-rw-r--r--include/linux/kernfs.h4
-rw-r--r--include/linux/key.h2
-rw-r--r--include/linux/kmemleak.h4
-rw-r--r--include/linux/kobject.h2
-rw-r--r--include/linux/kvm_host.h15
-rw-r--r--include/linux/mbus.h2
-rw-r--r--include/linux/mc146818rtc.h4
-rw-r--r--include/linux/mcb.h6
-rw-r--r--include/linux/memblock.h81
-rw-r--r--include/linux/memcontrol.h32
-rw-r--r--include/linux/memory_hotplug.h14
-rw-r--r--include/linux/mempolicy.h6
-rw-r--r--include/linux/mfd/abx500.h1
-rw-r--r--include/linux/mfd/arizona/core.h3
-rw-r--r--include/linux/mfd/arizona/registers.h14
-rw-r--r--include/linux/mfd/axp20x.h180
-rw-r--r--include/linux/mfd/bcm590xx.h9
-rw-r--r--include/linux/mfd/core.h2
-rw-r--r--include/linux/mfd/cros_ec.h4
-rw-r--r--include/linux/mfd/cros_ec_commands.h1128
-rw-r--r--include/linux/mfd/ipaq-micro.h148
-rw-r--r--include/linux/mfd/kempld.h4
-rw-r--r--include/linux/mfd/max14577-private.h222
-rw-r--r--include/linux/mfd/max14577.h19
-rw-r--r--include/linux/mfd/mc13xxx.h22
-rw-r--r--include/linux/mfd/palmas.h2168
-rw-r--r--include/linux/mfd/pm8xxx/core.h81
-rw-r--r--include/linux/mfd/rdc321x.h2
-rw-r--r--include/linux/mfd/samsung/core.h35
-rw-r--r--include/linux/mfd/samsung/s2mps14.h2
-rw-r--r--include/linux/mfd/stmpe.h19
-rw-r--r--include/linux/mfd/syscon.h2
-rw-r--r--include/linux/mfd/syscon/exynos5-pmu.h44
-rw-r--r--include/linux/mfd/tc3589x.h1
-rw-r--r--include/linux/mfd/tps65090.h19
-rw-r--r--include/linux/mfd/tps65217.h1
-rw-r--r--include/linux/mfd/tps65218.h1
-rw-r--r--include/linux/mfd/tps6586x.h2
-rw-r--r--include/linux/mfd/twl6040.h3
-rw-r--r--include/linux/migrate.h11
-rw-r--r--include/linux/miscdevice.h2
-rw-r--r--include/linux/mm.h39
-rw-r--r--include/linux/mm_types.h8
-rw-r--r--include/linux/mmdebug.h15
-rw-r--r--include/linux/mmzone.h35
-rw-r--r--include/linux/netdevice.h2
-rw-r--r--include/linux/of.h29
-rw-r--r--include/linux/of_address.h15
-rw-r--r--include/linux/of_fdt.h64
-rw-r--r--include/linux/of_gpio.h35
-rw-r--r--include/linux/of_irq.h5
-rw-r--r--include/linux/of_pci.h36
-rw-r--r--include/linux/of_platform.h7
-rw-r--r--include/linux/of_reserved_mem.h22
-rw-r--r--include/linux/omap-dma.h2
-rw-r--r--include/linux/page-flags.h2
-rw-r--r--include/linux/pageblock-flags.h30
-rw-r--r--include/linux/pagemap.h111
-rw-r--r--include/linux/pci.h40
-rw-r--r--include/linux/pci_ids.h3
-rw-r--r--include/linux/percpu.h2
-rw-r--r--include/linux/perf_event.h1
-rw-r--r--include/linux/platform_data/adau17x1.h109
-rw-r--r--include/linux/platform_data/at91_adc.h27
-rw-r--r--include/linux/platform_data/atmel.h8
-rw-r--r--include/linux/platform_data/edma.h28
-rw-r--r--include/linux/platform_data/ipmmu-vmsa.h24
-rw-r--r--include/linux/platform_data/max3421-hcd.h24
-rw-r--r--include/linux/platform_data/mipi-csis.h28
-rw-r--r--include/linux/platform_data/syscon.h8
-rw-r--r--include/linux/plist.h45
-rw-r--r--include/linux/pm.h36
-rw-r--r--include/linux/pm_opp.h20
-rw-r--r--include/linux/pm_runtime.h6
-rw-r--r--include/linux/power_supply.h2
-rw-r--r--include/linux/printk.h38
-rw-r--r--include/linux/proc_fs.h4
-rw-r--r--include/linux/ptrace.h32
-rw-r--r--include/linux/rcupdate.h72
-rw-r--r--include/linux/rcutiny.h4
-rw-r--r--include/linux/rcutree.h1
-rw-r--r--include/linux/regmap.h6
-rw-r--r--include/linux/regulator/consumer.h42
-rw-r--r--include/linux/reset.h10
-rw-r--r--include/linux/rmap.h11
-rw-r--r--include/linux/sched.h124
-rw-r--r--include/linux/sched/prio.h16
-rw-r--r--include/linux/sched/sysctl.h4
-rw-r--r--include/linux/sched_clock.h1
-rw-r--r--include/linux/serial_core.h22
-rw-r--r--include/linux/sh_timer.h1
-rw-r--r--include/linux/shm.h3
-rw-r--r--include/linux/signal.h21
-rw-r--r--include/linux/slab.h20
-rw-r--r--include/linux/smp.h2
-rw-r--r--include/linux/spi/adi_spi3.h254
-rw-r--r--include/linux/spi/rspi.h2
-rw-r--r--include/linux/string.h3
-rw-r--r--include/linux/sunrpc/sched.h8
-rw-r--r--include/linux/sunrpc/xprt.h8
-rw-r--r--include/linux/suspend.h9
-rw-r--r--include/linux/swap.h38
-rw-r--r--include/linux/swapfile.h2
-rw-r--r--include/linux/swapops.h2
-rw-r--r--include/linux/swiotlb.h2
-rw-r--r--include/linux/syscalls.h4
-rw-r--r--include/linux/sysfs.h2
-rw-r--r--include/linux/thread_info.h16
-rw-r--r--include/linux/topology.h131
-rw-r--r--include/linux/torture.h8
-rw-r--r--include/linux/tracehook.h2
-rw-r--r--include/linux/tty_ldisc.h5
-rw-r--r--include/linux/types.h1
-rw-r--r--include/linux/uprobes.h3
-rw-r--r--include/linux/usb.h2
-rw-r--r--include/linux/usb/composite.h79
-rw-r--r--include/linux/usb/msm_hsusb.h39
-rw-r--r--include/linux/usb/msm_hsusb_hw.h14
-rw-r--r--include/linux/usb/usb_phy_generic.h (renamed from include/linux/usb/usb_phy_gen_xceiv.h)13
-rw-r--r--include/linux/vexpress.h94
-rw-r--r--include/linux/vfio.h5
-rw-r--r--include/linux/vm_event_item.h4
-rw-r--r--include/linux/vmstat.h6
-rw-r--r--include/linux/zbud.h2
182 files changed, 5189 insertions, 2404 deletions
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 7a8f2cd66c8b..358c01b971db 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -37,6 +37,7 @@
37 37
38#include <linux/list.h> 38#include <linux/list.h>
39#include <linux/mod_devicetable.h> 39#include <linux/mod_devicetable.h>
40#include <linux/dynamic_debug.h>
40 41
41#include <acpi/acpi.h> 42#include <acpi/acpi.h>
42#include <acpi/acpi_bus.h> 43#include <acpi/acpi_bus.h>
@@ -184,6 +185,8 @@ extern int ec_transaction(u8 command,
184 u8 *rdata, unsigned rdata_len); 185 u8 *rdata, unsigned rdata_len);
185extern acpi_handle ec_get_handle(void); 186extern acpi_handle ec_get_handle(void);
186 187
188extern bool acpi_is_pnp_device(struct acpi_device *);
189
187#if defined(CONFIG_ACPI_WMI) || defined(CONFIG_ACPI_WMI_MODULE) 190#if defined(CONFIG_ACPI_WMI) || defined(CONFIG_ACPI_WMI_MODULE)
188 191
189typedef void (*wmi_notify_handler) (u32 value, void *context); 192typedef void (*wmi_notify_handler) (u32 value, void *context);
@@ -554,14 +557,20 @@ static inline int acpi_subsys_runtime_resume(struct device *dev) { return 0; }
554int acpi_dev_suspend_late(struct device *dev); 557int acpi_dev_suspend_late(struct device *dev);
555int acpi_dev_resume_early(struct device *dev); 558int acpi_dev_resume_early(struct device *dev);
556int acpi_subsys_prepare(struct device *dev); 559int acpi_subsys_prepare(struct device *dev);
560void acpi_subsys_complete(struct device *dev);
557int acpi_subsys_suspend_late(struct device *dev); 561int acpi_subsys_suspend_late(struct device *dev);
558int acpi_subsys_resume_early(struct device *dev); 562int acpi_subsys_resume_early(struct device *dev);
563int acpi_subsys_suspend(struct device *dev);
564int acpi_subsys_freeze(struct device *dev);
559#else 565#else
560static inline int acpi_dev_suspend_late(struct device *dev) { return 0; } 566static inline int acpi_dev_suspend_late(struct device *dev) { return 0; }
561static inline int acpi_dev_resume_early(struct device *dev) { return 0; } 567static inline int acpi_dev_resume_early(struct device *dev) { return 0; }
562static inline int acpi_subsys_prepare(struct device *dev) { return 0; } 568static inline int acpi_subsys_prepare(struct device *dev) { return 0; }
569static inline void acpi_subsys_complete(struct device *dev) {}
563static inline int acpi_subsys_suspend_late(struct device *dev) { return 0; } 570static inline int acpi_subsys_suspend_late(struct device *dev) { return 0; }
564static inline int acpi_subsys_resume_early(struct device *dev) { return 0; } 571static inline int acpi_subsys_resume_early(struct device *dev) { return 0; }
572static inline int acpi_subsys_suspend(struct device *dev) { return 0; }
573static inline int acpi_subsys_freeze(struct device *dev) { return 0; }
565#endif 574#endif
566 575
567#if defined(CONFIG_ACPI) && defined(CONFIG_PM) 576#if defined(CONFIG_ACPI) && defined(CONFIG_PM)
@@ -589,6 +598,14 @@ static inline __printf(3, 4) void
589acpi_handle_printk(const char *level, void *handle, const char *fmt, ...) {} 598acpi_handle_printk(const char *level, void *handle, const char *fmt, ...) {}
590#endif /* !CONFIG_ACPI */ 599#endif /* !CONFIG_ACPI */
591 600
601#if defined(CONFIG_ACPI) && defined(CONFIG_DYNAMIC_DEBUG)
602__printf(3, 4)
603void __acpi_handle_debug(struct _ddebug *descriptor, acpi_handle handle, const char *fmt, ...);
604#else
605#define __acpi_handle_debug(descriptor, handle, fmt, ...) \
606 acpi_handle_printk(KERN_DEBUG, handle, fmt, ##__VA_ARGS__);
607#endif
608
592/* 609/*
593 * acpi_handle_<level>: Print message with ACPI prefix and object path 610 * acpi_handle_<level>: Print message with ACPI prefix and object path
594 * 611 *
@@ -610,11 +627,19 @@ acpi_handle_printk(const char *level, void *handle, const char *fmt, ...) {}
610#define acpi_handle_info(handle, fmt, ...) \ 627#define acpi_handle_info(handle, fmt, ...) \
611 acpi_handle_printk(KERN_INFO, handle, fmt, ##__VA_ARGS__) 628 acpi_handle_printk(KERN_INFO, handle, fmt, ##__VA_ARGS__)
612 629
613/* REVISIT: Support CONFIG_DYNAMIC_DEBUG when necessary */ 630#if defined(DEBUG)
614#if defined(DEBUG) || defined(CONFIG_DYNAMIC_DEBUG)
615#define acpi_handle_debug(handle, fmt, ...) \ 631#define acpi_handle_debug(handle, fmt, ...) \
616 acpi_handle_printk(KERN_DEBUG, handle, fmt, ##__VA_ARGS__) 632 acpi_handle_printk(KERN_DEBUG, handle, fmt, ##__VA_ARGS__)
617#else 633#else
634#if defined(CONFIG_DYNAMIC_DEBUG)
635#define acpi_handle_debug(handle, fmt, ...) \
636do { \
637 DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \
638 if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT)) \
639 __acpi_handle_debug(&descriptor, handle, pr_fmt(fmt), \
640 ##__VA_ARGS__); \
641} while (0)
642#else
618#define acpi_handle_debug(handle, fmt, ...) \ 643#define acpi_handle_debug(handle, fmt, ...) \
619({ \ 644({ \
620 if (0) \ 645 if (0) \
@@ -622,5 +647,6 @@ acpi_handle_printk(const char *level, void *handle, const char *fmt, ...) {}
622 0; \ 647 0; \
623}) 648})
624#endif 649#endif
650#endif
625 651
626#endif /*_LINUX_ACPI_H*/ 652#endif /*_LINUX_ACPI_H*/
diff --git a/include/linux/amba/mmci.h b/include/linux/amba/mmci.h
index 32a89cf5ec45..8c98113069ce 100644
--- a/include/linux/amba/mmci.h
+++ b/include/linux/amba/mmci.h
@@ -6,28 +6,9 @@
6 6
7#include <linux/mmc/host.h> 7#include <linux/mmc/host.h>
8 8
9
10/*
11 * These defines is places here due to access is needed from machine
12 * configuration files. The ST Micro version does not have ROD and
13 * reuse the voltage registers for direction settings.
14 */
15#define MCI_ST_DATA2DIREN (1 << 2)
16#define MCI_ST_CMDDIREN (1 << 3)
17#define MCI_ST_DATA0DIREN (1 << 4)
18#define MCI_ST_DATA31DIREN (1 << 5)
19#define MCI_ST_FBCLKEN (1 << 7)
20#define MCI_ST_DATA74DIREN (1 << 8)
21
22/* Just some dummy forwarding */
23struct dma_chan;
24
25/** 9/**
26 * struct mmci_platform_data - platform configuration for the MMCI 10 * struct mmci_platform_data - platform configuration for the MMCI
27 * (also known as PL180) block. 11 * (also known as PL180) block.
28 * @f_max: the maximum operational frequency for this host in this
29 * platform configuration. When this is specified it takes precedence
30 * over the module parameter for the same frequency.
31 * @ocr_mask: available voltages on the 4 pins from the block, this 12 * @ocr_mask: available voltages on the 4 pins from the block, this
32 * is ignored if a regulator is used, see the MMC_VDD_* masks in 13 * is ignored if a regulator is used, see the MMC_VDD_* masks in
33 * mmc/host.h 14 * mmc/host.h
@@ -42,37 +23,14 @@ struct dma_chan;
42 * @gpio_wp: read this GPIO pin to see if the card is write protected 23 * @gpio_wp: read this GPIO pin to see if the card is write protected
43 * @gpio_cd: read this GPIO pin to detect card insertion 24 * @gpio_cd: read this GPIO pin to detect card insertion
44 * @cd_invert: true if the gpio_cd pin value is active low 25 * @cd_invert: true if the gpio_cd pin value is active low
45 * @capabilities: the capabilities of the block as implemented in
46 * this platform, signify anything MMC_CAP_* from mmc/host.h
47 * @capabilities2: more capabilities, MMC_CAP2_* from mmc/host.h
48 * @sigdir: a bit field indicating for what bits in the MMC bus the host
49 * should enable signal direction indication.
50 * @dma_filter: function used to select an appropriate RX and TX
51 * DMA channel to be used for DMA, if and only if you're deploying the
52 * generic DMA engine
53 * @dma_rx_param: parameter passed to the DMA allocation
54 * filter in order to select an appropriate RX channel. If
55 * there is a bidirectional RX+TX channel, then just specify
56 * this and leave dma_tx_param set to NULL
57 * @dma_tx_param: parameter passed to the DMA allocation
58 * filter in order to select an appropriate TX channel. If this
59 * is NULL the driver will attempt to use the RX channel as a
60 * bidirectional channel
61 */ 26 */
62struct mmci_platform_data { 27struct mmci_platform_data {
63 unsigned int f_max;
64 unsigned int ocr_mask; 28 unsigned int ocr_mask;
65 int (*ios_handler)(struct device *, struct mmc_ios *); 29 int (*ios_handler)(struct device *, struct mmc_ios *);
66 unsigned int (*status)(struct device *); 30 unsigned int (*status)(struct device *);
67 int gpio_wp; 31 int gpio_wp;
68 int gpio_cd; 32 int gpio_cd;
69 bool cd_invert; 33 bool cd_invert;
70 unsigned long capabilities;
71 unsigned long capabilities2;
72 u32 sigdir;
73 bool (*dma_filter)(struct dma_chan *chan, void *filter_param);
74 void *dma_rx_param;
75 void *dma_tx_param;
76}; 34};
77 35
78#endif 36#endif
diff --git a/include/linux/atomic.h b/include/linux/atomic.h
index 5b08a8540ecf..fef3a809e7cf 100644
--- a/include/linux/atomic.h
+++ b/include/linux/atomic.h
@@ -3,6 +3,42 @@
3#define _LINUX_ATOMIC_H 3#define _LINUX_ATOMIC_H
4#include <asm/atomic.h> 4#include <asm/atomic.h>
5 5
6/*
7 * Provide __deprecated wrappers for the new interface, avoid flag day changes.
8 * We need the ugly external functions to break header recursion hell.
9 */
10#ifndef smp_mb__before_atomic_inc
11static inline void __deprecated smp_mb__before_atomic_inc(void)
12{
13 extern void __smp_mb__before_atomic(void);
14 __smp_mb__before_atomic();
15}
16#endif
17
18#ifndef smp_mb__after_atomic_inc
19static inline void __deprecated smp_mb__after_atomic_inc(void)
20{
21 extern void __smp_mb__after_atomic(void);
22 __smp_mb__after_atomic();
23}
24#endif
25
26#ifndef smp_mb__before_atomic_dec
27static inline void __deprecated smp_mb__before_atomic_dec(void)
28{
29 extern void __smp_mb__before_atomic(void);
30 __smp_mb__before_atomic();
31}
32#endif
33
34#ifndef smp_mb__after_atomic_dec
35static inline void __deprecated smp_mb__after_atomic_dec(void)
36{
37 extern void __smp_mb__after_atomic(void);
38 __smp_mb__after_atomic();
39}
40#endif
41
6/** 42/**
7 * atomic_add_unless - add unless the number is already a given value 43 * atomic_add_unless - add unless the number is already a given value
8 * @v: pointer of type atomic_t 44 * @v: pointer of type atomic_t
diff --git a/include/linux/backlight.h b/include/linux/backlight.h
index 72647429adf6..adb14a8616df 100644
--- a/include/linux/backlight.h
+++ b/include/linux/backlight.h
@@ -40,6 +40,11 @@ enum backlight_type {
40 BACKLIGHT_TYPE_MAX, 40 BACKLIGHT_TYPE_MAX,
41}; 41};
42 42
43enum backlight_notification {
44 BACKLIGHT_REGISTERED,
45 BACKLIGHT_UNREGISTERED,
46};
47
43struct backlight_device; 48struct backlight_device;
44struct fb_info; 49struct fb_info;
45 50
@@ -133,6 +138,8 @@ extern void devm_backlight_device_unregister(struct device *dev,
133extern void backlight_force_update(struct backlight_device *bd, 138extern void backlight_force_update(struct backlight_device *bd,
134 enum backlight_update_reason reason); 139 enum backlight_update_reason reason);
135extern bool backlight_device_registered(enum backlight_type type); 140extern bool backlight_device_registered(enum backlight_type type);
141extern int backlight_register_notifier(struct notifier_block *nb);
142extern int backlight_unregister_notifier(struct notifier_block *nb);
136 143
137#define to_backlight_device(obj) container_of(obj, struct backlight_device, dev) 144#define to_backlight_device(obj) container_of(obj, struct backlight_device, dev)
138 145
diff --git a/include/linux/bio.h b/include/linux/bio.h
index bba550826921..5a645769f020 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -333,7 +333,7 @@ static inline struct bio *bio_next_split(struct bio *bio, int sectors,
333 333
334extern struct bio_set *bioset_create(unsigned int, unsigned int); 334extern struct bio_set *bioset_create(unsigned int, unsigned int);
335extern void bioset_free(struct bio_set *); 335extern void bioset_free(struct bio_set *);
336extern mempool_t *biovec_create_pool(struct bio_set *bs, int pool_entries); 336extern mempool_t *biovec_create_pool(int pool_entries);
337 337
338extern struct bio *bio_alloc_bioset(gfp_t, int, struct bio_set *); 338extern struct bio *bio_alloc_bioset(gfp_t, int, struct bio_set *);
339extern void bio_put(struct bio *); 339extern void bio_put(struct bio *);
diff --git a/include/linux/bitops.h b/include/linux/bitops.h
index be5fd38bd5a0..cbc5833fb221 100644
--- a/include/linux/bitops.h
+++ b/include/linux/bitops.h
@@ -32,6 +32,26 @@ extern unsigned long __sw_hweight64(__u64 w);
32 */ 32 */
33#include <asm/bitops.h> 33#include <asm/bitops.h>
34 34
35/*
36 * Provide __deprecated wrappers for the new interface, avoid flag day changes.
37 * We need the ugly external functions to break header recursion hell.
38 */
39#ifndef smp_mb__before_clear_bit
40static inline void __deprecated smp_mb__before_clear_bit(void)
41{
42 extern void __smp_mb__before_atomic(void);
43 __smp_mb__before_atomic();
44}
45#endif
46
47#ifndef smp_mb__after_clear_bit
48static inline void __deprecated smp_mb__after_clear_bit(void)
49{
50 extern void __smp_mb__after_atomic(void);
51 __smp_mb__after_atomic();
52}
53#endif
54
35#define for_each_set_bit(bit, addr, size) \ 55#define for_each_set_bit(bit, addr, size) \
36 for ((bit) = find_first_bit((addr), (size)); \ 56 for ((bit) = find_first_bit((addr), (size)); \
37 (bit) < (size); \ 57 (bit) < (size); \
diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
index 0120451545d8..0feedebfde48 100644
--- a/include/linux/blk-mq.h
+++ b/include/linux/blk-mq.h
@@ -8,7 +8,13 @@ struct blk_mq_tags;
8struct blk_mq_cpu_notifier { 8struct blk_mq_cpu_notifier {
9 struct list_head list; 9 struct list_head list;
10 void *data; 10 void *data;
11 void (*notify)(void *data, unsigned long action, unsigned int cpu); 11 int (*notify)(void *data, unsigned long action, unsigned int cpu);
12};
13
14struct blk_mq_ctxmap {
15 unsigned int map_size;
16 unsigned int bits_per_word;
17 struct blk_align_bitmap *map;
12}; 18};
13 19
14struct blk_mq_hw_ctx { 20struct blk_mq_hw_ctx {
@@ -18,7 +24,11 @@ struct blk_mq_hw_ctx {
18 } ____cacheline_aligned_in_smp; 24 } ____cacheline_aligned_in_smp;
19 25
20 unsigned long state; /* BLK_MQ_S_* flags */ 26 unsigned long state; /* BLK_MQ_S_* flags */
21 struct delayed_work delayed_work; 27 struct delayed_work run_work;
28 struct delayed_work delay_work;
29 cpumask_var_t cpumask;
30 int next_cpu;
31 int next_cpu_batch;
22 32
23 unsigned long flags; /* BLK_MQ_F_* flags */ 33 unsigned long flags; /* BLK_MQ_F_* flags */
24 34
@@ -27,13 +37,13 @@ struct blk_mq_hw_ctx {
27 37
28 void *driver_data; 38 void *driver_data;
29 39
40 struct blk_mq_ctxmap ctx_map;
41
30 unsigned int nr_ctx; 42 unsigned int nr_ctx;
31 struct blk_mq_ctx **ctxs; 43 struct blk_mq_ctx **ctxs;
32 unsigned int nr_ctx_map;
33 unsigned long *ctx_map;
34 44
35 struct request **rqs; 45 unsigned int wait_index;
36 struct list_head page_list; 46
37 struct blk_mq_tags *tags; 47 struct blk_mq_tags *tags;
38 48
39 unsigned long queued; 49 unsigned long queued;
@@ -41,31 +51,40 @@ struct blk_mq_hw_ctx {
41#define BLK_MQ_MAX_DISPATCH_ORDER 10 51#define BLK_MQ_MAX_DISPATCH_ORDER 10
42 unsigned long dispatched[BLK_MQ_MAX_DISPATCH_ORDER]; 52 unsigned long dispatched[BLK_MQ_MAX_DISPATCH_ORDER];
43 53
44 unsigned int queue_depth;
45 unsigned int numa_node; 54 unsigned int numa_node;
46 unsigned int cmd_size; /* per-request extra data */ 55 unsigned int cmd_size; /* per-request extra data */
47 56
57 atomic_t nr_active;
58
48 struct blk_mq_cpu_notifier cpu_notifier; 59 struct blk_mq_cpu_notifier cpu_notifier;
49 struct kobject kobj; 60 struct kobject kobj;
50}; 61};
51 62
52struct blk_mq_reg { 63struct blk_mq_tag_set {
53 struct blk_mq_ops *ops; 64 struct blk_mq_ops *ops;
54 unsigned int nr_hw_queues; 65 unsigned int nr_hw_queues;
55 unsigned int queue_depth; 66 unsigned int queue_depth; /* max hw supported */
56 unsigned int reserved_tags; 67 unsigned int reserved_tags;
57 unsigned int cmd_size; /* per-request extra data */ 68 unsigned int cmd_size; /* per-request extra data */
58 int numa_node; 69 int numa_node;
59 unsigned int timeout; 70 unsigned int timeout;
60 unsigned int flags; /* BLK_MQ_F_* */ 71 unsigned int flags; /* BLK_MQ_F_* */
72 void *driver_data;
73
74 struct blk_mq_tags **tags;
75
76 struct mutex tag_list_lock;
77 struct list_head tag_list;
61}; 78};
62 79
63typedef int (queue_rq_fn)(struct blk_mq_hw_ctx *, struct request *); 80typedef int (queue_rq_fn)(struct blk_mq_hw_ctx *, struct request *);
64typedef struct blk_mq_hw_ctx *(map_queue_fn)(struct request_queue *, const int); 81typedef struct blk_mq_hw_ctx *(map_queue_fn)(struct request_queue *, const int);
65typedef struct blk_mq_hw_ctx *(alloc_hctx_fn)(struct blk_mq_reg *,unsigned int);
66typedef void (free_hctx_fn)(struct blk_mq_hw_ctx *, unsigned int);
67typedef int (init_hctx_fn)(struct blk_mq_hw_ctx *, void *, unsigned int); 82typedef int (init_hctx_fn)(struct blk_mq_hw_ctx *, void *, unsigned int);
68typedef void (exit_hctx_fn)(struct blk_mq_hw_ctx *, unsigned int); 83typedef void (exit_hctx_fn)(struct blk_mq_hw_ctx *, unsigned int);
84typedef int (init_request_fn)(void *, struct request *, unsigned int,
85 unsigned int, unsigned int);
86typedef void (exit_request_fn)(void *, struct request *, unsigned int,
87 unsigned int);
69 88
70struct blk_mq_ops { 89struct blk_mq_ops {
71 /* 90 /*
@@ -86,18 +105,20 @@ struct blk_mq_ops {
86 softirq_done_fn *complete; 105 softirq_done_fn *complete;
87 106
88 /* 107 /*
89 * Override for hctx allocations (should probably go)
90 */
91 alloc_hctx_fn *alloc_hctx;
92 free_hctx_fn *free_hctx;
93
94 /*
95 * Called when the block layer side of a hardware queue has been 108 * Called when the block layer side of a hardware queue has been
96 * set up, allowing the driver to allocate/init matching structures. 109 * set up, allowing the driver to allocate/init matching structures.
97 * Ditto for exit/teardown. 110 * Ditto for exit/teardown.
98 */ 111 */
99 init_hctx_fn *init_hctx; 112 init_hctx_fn *init_hctx;
100 exit_hctx_fn *exit_hctx; 113 exit_hctx_fn *exit_hctx;
114
115 /*
116 * Called for every command allocated by the block layer to allow
117 * the driver to set up driver specific data.
118 * Ditto for exit/teardown.
119 */
120 init_request_fn *init_request;
121 exit_request_fn *exit_request;
101}; 122};
102 123
103enum { 124enum {
@@ -107,18 +128,24 @@ enum {
107 128
108 BLK_MQ_F_SHOULD_MERGE = 1 << 0, 129 BLK_MQ_F_SHOULD_MERGE = 1 << 0,
109 BLK_MQ_F_SHOULD_SORT = 1 << 1, 130 BLK_MQ_F_SHOULD_SORT = 1 << 1,
110 BLK_MQ_F_SHOULD_IPI = 1 << 2, 131 BLK_MQ_F_TAG_SHARED = 1 << 2,
132 BLK_MQ_F_SG_MERGE = 1 << 3,
133 BLK_MQ_F_SYSFS_UP = 1 << 4,
111 134
112 BLK_MQ_S_STOPPED = 0, 135 BLK_MQ_S_STOPPED = 0,
136 BLK_MQ_S_TAG_ACTIVE = 1,
113 137
114 BLK_MQ_MAX_DEPTH = 2048, 138 BLK_MQ_MAX_DEPTH = 2048,
139
140 BLK_MQ_CPU_WORK_BATCH = 8,
115}; 141};
116 142
117struct request_queue *blk_mq_init_queue(struct blk_mq_reg *, void *); 143struct request_queue *blk_mq_init_queue(struct blk_mq_tag_set *);
118int blk_mq_register_disk(struct gendisk *); 144int blk_mq_register_disk(struct gendisk *);
119void blk_mq_unregister_disk(struct gendisk *); 145void blk_mq_unregister_disk(struct gendisk *);
120int blk_mq_init_commands(struct request_queue *, int (*init)(void *data, struct blk_mq_hw_ctx *, struct request *, unsigned int), void *data); 146
121void blk_mq_free_commands(struct request_queue *, void (*free)(void *data, struct blk_mq_hw_ctx *, struct request *, unsigned int), void *data); 147int blk_mq_alloc_tag_set(struct blk_mq_tag_set *set);
148void blk_mq_free_tag_set(struct blk_mq_tag_set *set);
122 149
123void blk_mq_flush_plug_list(struct blk_plug *plug, bool from_schedule); 150void blk_mq_flush_plug_list(struct blk_plug *plug, bool from_schedule);
124 151
@@ -126,28 +153,28 @@ void blk_mq_insert_request(struct request *, bool, bool, bool);
126void blk_mq_run_queues(struct request_queue *q, bool async); 153void blk_mq_run_queues(struct request_queue *q, bool async);
127void blk_mq_free_request(struct request *rq); 154void blk_mq_free_request(struct request *rq);
128bool blk_mq_can_queue(struct blk_mq_hw_ctx *); 155bool blk_mq_can_queue(struct blk_mq_hw_ctx *);
129struct request *blk_mq_alloc_request(struct request_queue *q, int rw, gfp_t gfp); 156struct request *blk_mq_alloc_request(struct request_queue *q, int rw,
130struct request *blk_mq_alloc_reserved_request(struct request_queue *q, int rw, gfp_t gfp); 157 gfp_t gfp, bool reserved);
131struct request *blk_mq_rq_from_tag(struct request_queue *q, unsigned int tag); 158struct request *blk_mq_tag_to_rq(struct blk_mq_tags *tags, unsigned int tag);
132 159
133struct blk_mq_hw_ctx *blk_mq_map_queue(struct request_queue *, const int ctx_index); 160struct blk_mq_hw_ctx *blk_mq_map_queue(struct request_queue *, const int ctx_index);
134struct blk_mq_hw_ctx *blk_mq_alloc_single_hw_queue(struct blk_mq_reg *, unsigned int); 161struct blk_mq_hw_ctx *blk_mq_alloc_single_hw_queue(struct blk_mq_tag_set *, unsigned int, int);
135void blk_mq_free_single_hw_queue(struct blk_mq_hw_ctx *, unsigned int);
136 162
137bool blk_mq_end_io_partial(struct request *rq, int error, 163void blk_mq_end_io(struct request *rq, int error);
138 unsigned int nr_bytes); 164void __blk_mq_end_io(struct request *rq, int error);
139static inline void blk_mq_end_io(struct request *rq, int error)
140{
141 bool done = !blk_mq_end_io_partial(rq, error, blk_rq_bytes(rq));
142 BUG_ON(!done);
143}
144 165
166void blk_mq_requeue_request(struct request *rq);
167void blk_mq_add_to_requeue_list(struct request *rq, bool at_head);
168void blk_mq_kick_requeue_list(struct request_queue *q);
145void blk_mq_complete_request(struct request *rq); 169void blk_mq_complete_request(struct request *rq);
146 170
147void blk_mq_stop_hw_queue(struct blk_mq_hw_ctx *hctx); 171void blk_mq_stop_hw_queue(struct blk_mq_hw_ctx *hctx);
148void blk_mq_start_hw_queue(struct blk_mq_hw_ctx *hctx); 172void blk_mq_start_hw_queue(struct blk_mq_hw_ctx *hctx);
149void blk_mq_stop_hw_queues(struct request_queue *q); 173void blk_mq_stop_hw_queues(struct request_queue *q);
150void blk_mq_start_stopped_hw_queues(struct request_queue *q); 174void blk_mq_start_hw_queues(struct request_queue *q);
175void blk_mq_start_stopped_hw_queues(struct request_queue *q, bool async);
176void blk_mq_delay_queue(struct blk_mq_hw_ctx *hctx, unsigned long msecs);
177void blk_mq_tag_busy_iter(struct blk_mq_tags *tags, void (*fn)(void *data, unsigned long *), void *data);
151 178
152/* 179/*
153 * Driver command data is immediately after the request. So subtract request 180 * Driver command data is immediately after the request. So subtract request
@@ -162,12 +189,6 @@ static inline void *blk_mq_rq_to_pdu(struct request *rq)
162 return (void *) rq + sizeof(*rq); 189 return (void *) rq + sizeof(*rq);
163} 190}
164 191
165static inline struct request *blk_mq_tag_to_rq(struct blk_mq_hw_ctx *hctx,
166 unsigned int tag)
167{
168 return hctx->rqs[tag];
169}
170
171#define queue_for_each_hw_ctx(q, hctx, i) \ 192#define queue_for_each_hw_ctx(q, hctx, i) \
172 for ((i) = 0; (i) < (q)->nr_hw_queues && \ 193 for ((i) = 0; (i) < (q)->nr_hw_queues && \
173 ({ hctx = (q)->queue_hw_ctx[i]; 1; }); (i)++) 194 ({ hctx = (q)->queue_hw_ctx[i]; 1; }); (i)++)
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
index aa0eaa2d0bd8..d8e4cea23a25 100644
--- a/include/linux/blk_types.h
+++ b/include/linux/blk_types.h
@@ -190,6 +190,7 @@ enum rq_flag_bits {
190 __REQ_PM, /* runtime pm request */ 190 __REQ_PM, /* runtime pm request */
191 __REQ_END, /* last of chain of requests */ 191 __REQ_END, /* last of chain of requests */
192 __REQ_HASHED, /* on IO scheduler merge hash */ 192 __REQ_HASHED, /* on IO scheduler merge hash */
193 __REQ_MQ_INFLIGHT, /* track inflight for MQ */
193 __REQ_NR_BITS, /* stops here */ 194 __REQ_NR_BITS, /* stops here */
194}; 195};
195 196
@@ -243,5 +244,6 @@ enum rq_flag_bits {
243#define REQ_PM (1ULL << __REQ_PM) 244#define REQ_PM (1ULL << __REQ_PM)
244#define REQ_END (1ULL << __REQ_END) 245#define REQ_END (1ULL << __REQ_END)
245#define REQ_HASHED (1ULL << __REQ_HASHED) 246#define REQ_HASHED (1ULL << __REQ_HASHED)
247#define REQ_MQ_INFLIGHT (1ULL << __REQ_MQ_INFLIGHT)
246 248
247#endif /* __LINUX_BLK_TYPES_H */ 249#endif /* __LINUX_BLK_TYPES_H */
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 0d84981ee03f..3cd426e971db 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -90,15 +90,15 @@ enum rq_cmd_type_bits {
90#define BLK_MAX_CDB 16 90#define BLK_MAX_CDB 16
91 91
92/* 92/*
93 * try to put the fields that are referenced together in the same cacheline. 93 * Try to put the fields that are referenced together in the same cacheline.
94 * if you modify this structure, be sure to check block/blk-core.c:blk_rq_init() 94 *
95 * as well! 95 * If you modify this structure, make sure to update blk_rq_init() and
96 * especially blk_mq_rq_ctx_init() to take care of the added fields.
96 */ 97 */
97struct request { 98struct request {
98 struct list_head queuelist; 99 struct list_head queuelist;
99 union { 100 union {
100 struct call_single_data csd; 101 struct call_single_data csd;
101 struct work_struct mq_flush_work;
102 unsigned long fifo_time; 102 unsigned long fifo_time;
103 }; 103 };
104 104
@@ -178,7 +178,6 @@ struct request {
178 unsigned short ioprio; 178 unsigned short ioprio;
179 179
180 void *special; /* opaque pointer available for LLD use */ 180 void *special; /* opaque pointer available for LLD use */
181 char *buffer; /* kaddr of the current segment if available */
182 181
183 int tag; 182 int tag;
184 int errors; 183 int errors;
@@ -336,7 +335,7 @@ struct request_queue {
336 unsigned int *mq_map; 335 unsigned int *mq_map;
337 336
338 /* sw queues */ 337 /* sw queues */
339 struct blk_mq_ctx *queue_ctx; 338 struct blk_mq_ctx __percpu *queue_ctx;
340 unsigned int nr_queues; 339 unsigned int nr_queues;
341 340
342 /* hw dispatch queues */ 341 /* hw dispatch queues */
@@ -463,6 +462,10 @@ struct request_queue {
463 struct request *flush_rq; 462 struct request *flush_rq;
464 spinlock_t mq_flush_lock; 463 spinlock_t mq_flush_lock;
465 464
465 struct list_head requeue_list;
466 spinlock_t requeue_lock;
467 struct work_struct requeue_work;
468
466 struct mutex sysfs_lock; 469 struct mutex sysfs_lock;
467 470
468 int bypass_depth; 471 int bypass_depth;
@@ -481,6 +484,9 @@ struct request_queue {
481 wait_queue_head_t mq_freeze_wq; 484 wait_queue_head_t mq_freeze_wq;
482 struct percpu_counter mq_usage_counter; 485 struct percpu_counter mq_usage_counter;
483 struct list_head all_q_node; 486 struct list_head all_q_node;
487
488 struct blk_mq_tag_set *tag_set;
489 struct list_head tag_set_list;
484}; 490};
485 491
486#define QUEUE_FLAG_QUEUED 1 /* uses generic tag queueing */ 492#define QUEUE_FLAG_QUEUED 1 /* uses generic tag queueing */
@@ -504,6 +510,7 @@ struct request_queue {
504#define QUEUE_FLAG_SAME_FORCE 18 /* force complete on same CPU */ 510#define QUEUE_FLAG_SAME_FORCE 18 /* force complete on same CPU */
505#define QUEUE_FLAG_DEAD 19 /* queue tear-down finished */ 511#define QUEUE_FLAG_DEAD 19 /* queue tear-down finished */
506#define QUEUE_FLAG_INIT_DONE 20 /* queue is initialized */ 512#define QUEUE_FLAG_INIT_DONE 20 /* queue is initialized */
513#define QUEUE_FLAG_NO_SG_MERGE 21 /* don't attempt to merge SG segments*/
507 514
508#define QUEUE_FLAG_DEFAULT ((1 << QUEUE_FLAG_IO_STAT) | \ 515#define QUEUE_FLAG_DEFAULT ((1 << QUEUE_FLAG_IO_STAT) | \
509 (1 << QUEUE_FLAG_STACKABLE) | \ 516 (1 << QUEUE_FLAG_STACKABLE) | \
@@ -613,6 +620,15 @@ static inline void queue_flag_clear(unsigned int flag, struct request_queue *q)
613 620
614#define rq_data_dir(rq) (((rq)->cmd_flags & 1) != 0) 621#define rq_data_dir(rq) (((rq)->cmd_flags & 1) != 0)
615 622
623/*
624 * Driver can handle struct request, if it either has an old style
625 * request_fn defined, or is blk-mq based.
626 */
627static inline bool queue_is_rq_based(struct request_queue *q)
628{
629 return q->request_fn || q->mq_ops;
630}
631
616static inline unsigned int blk_queue_cluster(struct request_queue *q) 632static inline unsigned int blk_queue_cluster(struct request_queue *q)
617{ 633{
618 return q->limits.cluster; 634 return q->limits.cluster;
@@ -937,6 +953,7 @@ extern struct request *blk_fetch_request(struct request_queue *q);
937 */ 953 */
938extern bool blk_update_request(struct request *rq, int error, 954extern bool blk_update_request(struct request *rq, int error,
939 unsigned int nr_bytes); 955 unsigned int nr_bytes);
956extern void blk_finish_request(struct request *rq, int error);
940extern bool blk_end_request(struct request *rq, int error, 957extern bool blk_end_request(struct request *rq, int error,
941 unsigned int nr_bytes); 958 unsigned int nr_bytes);
942extern void blk_end_request_all(struct request *rq, int error); 959extern void blk_end_request_all(struct request *rq, int error);
@@ -1053,7 +1070,6 @@ static inline void blk_post_runtime_resume(struct request_queue *q, int err) {}
1053 * schedule() where blk_schedule_flush_plug() is called. 1070 * schedule() where blk_schedule_flush_plug() is called.
1054 */ 1071 */
1055struct blk_plug { 1072struct blk_plug {
1056 unsigned long magic; /* detect uninitialized use-cases */
1057 struct list_head list; /* requests */ 1073 struct list_head list; /* requests */
1058 struct list_head mq_list; /* blk-mq requests */ 1074 struct list_head mq_list; /* blk-mq requests */
1059 struct list_head cb_list; /* md requires an unplug callback */ 1075 struct list_head cb_list; /* md requires an unplug callback */
@@ -1102,7 +1118,8 @@ static inline bool blk_needs_flush_plug(struct task_struct *tsk)
1102/* 1118/*
1103 * tag stuff 1119 * tag stuff
1104 */ 1120 */
1105#define blk_rq_tagged(rq) ((rq)->cmd_flags & REQ_QUEUED) 1121#define blk_rq_tagged(rq) \
1122 ((rq)->mq_ctx || ((rq)->cmd_flags & REQ_QUEUED))
1106extern int blk_queue_start_tag(struct request_queue *, struct request *); 1123extern int blk_queue_start_tag(struct request_queue *, struct request *);
1107extern struct request *blk_queue_find_tag(struct request_queue *, int); 1124extern struct request *blk_queue_find_tag(struct request_queue *, int);
1108extern void blk_queue_end_tag(struct request_queue *, struct request *); 1125extern void blk_queue_end_tag(struct request_queue *, struct request *);
@@ -1370,8 +1387,9 @@ static inline void put_dev_sector(Sector p)
1370} 1387}
1371 1388
1372struct work_struct; 1389struct work_struct;
1373int kblockd_schedule_work(struct request_queue *q, struct work_struct *work); 1390int kblockd_schedule_work(struct work_struct *work);
1374int kblockd_schedule_delayed_work(struct request_queue *q, struct delayed_work *dwork, unsigned long delay); 1391int kblockd_schedule_delayed_work(struct delayed_work *dwork, unsigned long delay);
1392int kblockd_schedule_delayed_work_on(int cpu, struct delayed_work *dwork, unsigned long delay);
1375 1393
1376#ifdef CONFIG_BLK_CGROUP 1394#ifdef CONFIG_BLK_CGROUP
1377/* 1395/*
@@ -1570,6 +1588,7 @@ static inline bool blk_integrity_is_initialized(struct gendisk *g)
1570struct block_device_operations { 1588struct block_device_operations {
1571 int (*open) (struct block_device *, fmode_t); 1589 int (*open) (struct block_device *, fmode_t);
1572 void (*release) (struct gendisk *, fmode_t); 1590 void (*release) (struct gendisk *, fmode_t);
1591 int (*rw_page)(struct block_device *, sector_t, struct page *, int rw);
1573 int (*ioctl) (struct block_device *, fmode_t, unsigned, unsigned long); 1592 int (*ioctl) (struct block_device *, fmode_t, unsigned, unsigned long);
1574 int (*compat_ioctl) (struct block_device *, fmode_t, unsigned, unsigned long); 1593 int (*compat_ioctl) (struct block_device *, fmode_t, unsigned, unsigned long);
1575 int (*direct_access) (struct block_device *, sector_t, 1594 int (*direct_access) (struct block_device *, sector_t,
@@ -1588,7 +1607,13 @@ struct block_device_operations {
1588 1607
1589extern int __blkdev_driver_ioctl(struct block_device *, fmode_t, unsigned int, 1608extern int __blkdev_driver_ioctl(struct block_device *, fmode_t, unsigned int,
1590 unsigned long); 1609 unsigned long);
1610extern int bdev_read_page(struct block_device *, sector_t, struct page *);
1611extern int bdev_write_page(struct block_device *, sector_t, struct page *,
1612 struct writeback_control *);
1591#else /* CONFIG_BLOCK */ 1613#else /* CONFIG_BLOCK */
1614
1615struct block_device;
1616
1592/* 1617/*
1593 * stubs for when the block layer is configured out 1618 * stubs for when the block layer is configured out
1594 */ 1619 */
@@ -1624,6 +1649,12 @@ static inline bool blk_needs_flush_plug(struct task_struct *tsk)
1624 return false; 1649 return false;
1625} 1650}
1626 1651
1652static inline int blkdev_issue_flush(struct block_device *bdev, gfp_t gfp_mask,
1653 sector_t *error_sector)
1654{
1655 return 0;
1656}
1657
1627#endif /* CONFIG_BLOCK */ 1658#endif /* CONFIG_BLOCK */
1628 1659
1629#endif 1660#endif
diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h
index db51fe4fe317..4e2bd4c95b66 100644
--- a/include/linux/bootmem.h
+++ b/include/linux/bootmem.h
@@ -58,9 +58,9 @@ extern void free_bootmem_late(unsigned long physaddr, unsigned long size);
58 * Flags for reserve_bootmem (also if CONFIG_HAVE_ARCH_BOOTMEM_NODE, 58 * Flags for reserve_bootmem (also if CONFIG_HAVE_ARCH_BOOTMEM_NODE,
59 * the architecture-specific code should honor this). 59 * the architecture-specific code should honor this).
60 * 60 *
61 * If flags is 0, then the return value is always 0 (success). If 61 * If flags is BOOTMEM_DEFAULT, then the return value is always 0 (success).
62 * flags contains BOOTMEM_EXCLUSIVE, then -EBUSY is returned if the 62 * If flags contains BOOTMEM_EXCLUSIVE, then -EBUSY is returned if the memory
63 * memory already was reserved. 63 * already was reserved.
64 */ 64 */
65#define BOOTMEM_DEFAULT 0 65#define BOOTMEM_DEFAULT 0
66#define BOOTMEM_EXCLUSIVE (1<<0) 66#define BOOTMEM_EXCLUSIVE (1<<0)
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index c40302f909ce..324329ceea1e 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -207,8 +207,6 @@ void block_invalidatepage(struct page *page, unsigned int offset,
207 unsigned int length); 207 unsigned int length);
208int block_write_full_page(struct page *page, get_block_t *get_block, 208int block_write_full_page(struct page *page, get_block_t *get_block,
209 struct writeback_control *wbc); 209 struct writeback_control *wbc);
210int block_write_full_page_endio(struct page *page, get_block_t *get_block,
211 struct writeback_control *wbc, bh_end_io_t *handler);
212int block_read_full_page(struct page*, get_block_t*); 210int block_read_full_page(struct page*, get_block_t*);
213int block_is_partially_uptodate(struct page *page, unsigned long from, 211int block_is_partially_uptodate(struct page *page, unsigned long from,
214 unsigned long count); 212 unsigned long count);
@@ -278,7 +276,7 @@ static inline void get_bh(struct buffer_head *bh)
278 276
279static inline void put_bh(struct buffer_head *bh) 277static inline void put_bh(struct buffer_head *bh)
280{ 278{
281 smp_mb__before_atomic_dec(); 279 smp_mb__before_atomic();
282 atomic_dec(&bh->b_count); 280 atomic_dec(&bh->b_count);
283} 281}
284 282
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
index 511917416fb0..0c287dbbb144 100644
--- a/include/linux/clk-provider.h
+++ b/include/linux/clk-provider.h
@@ -40,14 +40,14 @@ struct dentry;
40 * through the clk_* api. 40 * through the clk_* api.
41 * 41 *
42 * @prepare: Prepare the clock for enabling. This must not return until 42 * @prepare: Prepare the clock for enabling. This must not return until
43 * the clock is fully prepared, and it's safe to call clk_enable. 43 * the clock is fully prepared, and it's safe to call clk_enable.
44 * This callback is intended to allow clock implementations to 44 * This callback is intended to allow clock implementations to
45 * do any initialisation that may sleep. Called with 45 * do any initialisation that may sleep. Called with
46 * prepare_lock held. 46 * prepare_lock held.
47 * 47 *
48 * @unprepare: Release the clock from its prepared state. This will typically 48 * @unprepare: Release the clock from its prepared state. This will typically
49 * undo any work done in the @prepare callback. Called with 49 * undo any work done in the @prepare callback. Called with
50 * prepare_lock held. 50 * prepare_lock held.
51 * 51 *
52 * @is_prepared: Queries the hardware to determine if the clock is prepared. 52 * @is_prepared: Queries the hardware to determine if the clock is prepared.
53 * This function is allowed to sleep. Optional, if this op is not 53 * This function is allowed to sleep. Optional, if this op is not
@@ -58,16 +58,16 @@ struct dentry;
58 * Called with prepare mutex held. This function may sleep. 58 * Called with prepare mutex held. This function may sleep.
59 * 59 *
60 * @enable: Enable the clock atomically. This must not return until the 60 * @enable: Enable the clock atomically. This must not return until the
61 * clock is generating a valid clock signal, usable by consumer 61 * clock is generating a valid clock signal, usable by consumer
62 * devices. Called with enable_lock held. This function must not 62 * devices. Called with enable_lock held. This function must not
63 * sleep. 63 * sleep.
64 * 64 *
65 * @disable: Disable the clock atomically. Called with enable_lock held. 65 * @disable: Disable the clock atomically. Called with enable_lock held.
66 * This function must not sleep. 66 * This function must not sleep.
67 * 67 *
68 * @is_enabled: Queries the hardware to determine if the clock is enabled. 68 * @is_enabled: Queries the hardware to determine if the clock is enabled.
69 * This function must not sleep. Optional, if this op is not 69 * This function must not sleep. Optional, if this op is not
70 * set then the enable count will be used. 70 * set then the enable count will be used.
71 * 71 *
72 * @disable_unused: Disable the clock atomically. Only called from 72 * @disable_unused: Disable the clock atomically. Only called from
73 * clk_disable_unused for gate clocks with special needs. 73 * clk_disable_unused for gate clocks with special needs.
@@ -75,34 +75,35 @@ struct dentry;
75 * sleep. 75 * sleep.
76 * 76 *
77 * @recalc_rate Recalculate the rate of this clock, by querying hardware. The 77 * @recalc_rate Recalculate the rate of this clock, by querying hardware. The
78 * parent rate is an input parameter. It is up to the caller to 78 * parent rate is an input parameter. It is up to the caller to
79 * ensure that the prepare_mutex is held across this call. 79 * ensure that the prepare_mutex is held across this call.
80 * Returns the calculated rate. Optional, but recommended - if 80 * Returns the calculated rate. Optional, but recommended - if
81 * this op is not set then clock rate will be initialized to 0. 81 * this op is not set then clock rate will be initialized to 0.
82 * 82 *
83 * @round_rate: Given a target rate as input, returns the closest rate actually 83 * @round_rate: Given a target rate as input, returns the closest rate actually
84 * supported by the clock. 84 * supported by the clock. The parent rate is an input/output
85 * parameter.
85 * 86 *
86 * @determine_rate: Given a target rate as input, returns the closest rate 87 * @determine_rate: Given a target rate as input, returns the closest rate
87 * actually supported by the clock, and optionally the parent clock 88 * actually supported by the clock, and optionally the parent clock
88 * that should be used to provide the clock rate. 89 * that should be used to provide the clock rate.
89 * 90 *
90 * @get_parent: Queries the hardware to determine the parent of a clock. The
91 * return value is a u8 which specifies the index corresponding to
92 * the parent clock. This index can be applied to either the
93 * .parent_names or .parents arrays. In short, this function
94 * translates the parent value read from hardware into an array
95 * index. Currently only called when the clock is initialized by
96 * __clk_init. This callback is mandatory for clocks with
97 * multiple parents. It is optional (and unnecessary) for clocks
98 * with 0 or 1 parents.
99 *
100 * @set_parent: Change the input source of this clock; for clocks with multiple 91 * @set_parent: Change the input source of this clock; for clocks with multiple
101 * possible parents specify a new parent by passing in the index 92 * possible parents specify a new parent by passing in the index
102 * as a u8 corresponding to the parent in either the .parent_names 93 * as a u8 corresponding to the parent in either the .parent_names
103 * or .parents arrays. This function in affect translates an 94 * or .parents arrays. This function in affect translates an
104 * array index into the value programmed into the hardware. 95 * array index into the value programmed into the hardware.
105 * Returns 0 on success, -EERROR otherwise. 96 * Returns 0 on success, -EERROR otherwise.
97 *
98 * @get_parent: Queries the hardware to determine the parent of a clock. The
99 * return value is a u8 which specifies the index corresponding to
100 * the parent clock. This index can be applied to either the
101 * .parent_names or .parents arrays. In short, this function
102 * translates the parent value read from hardware into an array
103 * index. Currently only called when the clock is initialized by
104 * __clk_init. This callback is mandatory for clocks with
105 * multiple parents. It is optional (and unnecessary) for clocks
106 * with 0 or 1 parents.
106 * 107 *
107 * @set_rate: Change the rate of this clock. The requested rate is specified 108 * @set_rate: Change the rate of this clock. The requested rate is specified
108 * by the second argument, which should typically be the return 109 * by the second argument, which should typically be the return
@@ -110,13 +111,6 @@ struct dentry;
110 * which is likely helpful for most .set_rate implementation. 111 * which is likely helpful for most .set_rate implementation.
111 * Returns 0 on success, -EERROR otherwise. 112 * Returns 0 on success, -EERROR otherwise.
112 * 113 *
113 * @recalc_accuracy: Recalculate the accuracy of this clock. The clock accuracy
114 * is expressed in ppb (parts per billion). The parent accuracy is
115 * an input parameter.
116 * Returns the calculated accuracy. Optional - if this op is not
117 * set then clock accuracy will be initialized to parent accuracy
118 * or 0 (perfect clock) if clock has no parent.
119 *
120 * @set_rate_and_parent: Change the rate and the parent of this clock. The 114 * @set_rate_and_parent: Change the rate and the parent of this clock. The
121 * requested rate is specified by the second argument, which 115 * requested rate is specified by the second argument, which
122 * should typically be the return of .round_rate call. The 116 * should typically be the return of .round_rate call. The
@@ -128,6 +122,18 @@ struct dentry;
128 * separately via calls to .set_parent and .set_rate. 122 * separately via calls to .set_parent and .set_rate.
129 * Returns 0 on success, -EERROR otherwise. 123 * Returns 0 on success, -EERROR otherwise.
130 * 124 *
125 * @recalc_accuracy: Recalculate the accuracy of this clock. The clock accuracy
126 * is expressed in ppb (parts per billion). The parent accuracy is
127 * an input parameter.
128 * Returns the calculated accuracy. Optional - if this op is not
129 * set then clock accuracy will be initialized to parent accuracy
130 * or 0 (perfect clock) if clock has no parent.
131 *
132 * @init: Perform platform-specific initialization magic.
133 * This is not not used by any of the basic clock types.
134 * Please consider other ways of solving initialization problems
135 * before using this callback, as its use is discouraged.
136 *
131 * @debug_init: Set up type-specific debugfs entries for this clock. This 137 * @debug_init: Set up type-specific debugfs entries for this clock. This
132 * is called once, after the debugfs directory entry for this 138 * is called once, after the debugfs directory entry for this
133 * clock has been created. The dentry pointer representing that 139 * clock has been created. The dentry pointer representing that
@@ -157,15 +163,15 @@ struct clk_ops {
157 void (*disable_unused)(struct clk_hw *hw); 163 void (*disable_unused)(struct clk_hw *hw);
158 unsigned long (*recalc_rate)(struct clk_hw *hw, 164 unsigned long (*recalc_rate)(struct clk_hw *hw,
159 unsigned long parent_rate); 165 unsigned long parent_rate);
160 long (*round_rate)(struct clk_hw *hw, unsigned long, 166 long (*round_rate)(struct clk_hw *hw, unsigned long rate,
161 unsigned long *); 167 unsigned long *parent_rate);
162 long (*determine_rate)(struct clk_hw *hw, unsigned long rate, 168 long (*determine_rate)(struct clk_hw *hw, unsigned long rate,
163 unsigned long *best_parent_rate, 169 unsigned long *best_parent_rate,
164 struct clk **best_parent_clk); 170 struct clk **best_parent_clk);
165 int (*set_parent)(struct clk_hw *hw, u8 index); 171 int (*set_parent)(struct clk_hw *hw, u8 index);
166 u8 (*get_parent)(struct clk_hw *hw); 172 u8 (*get_parent)(struct clk_hw *hw);
167 int (*set_rate)(struct clk_hw *hw, unsigned long, 173 int (*set_rate)(struct clk_hw *hw, unsigned long rate,
168 unsigned long); 174 unsigned long parent_rate);
169 int (*set_rate_and_parent)(struct clk_hw *hw, 175 int (*set_rate_and_parent)(struct clk_hw *hw,
170 unsigned long rate, 176 unsigned long rate,
171 unsigned long parent_rate, u8 index); 177 unsigned long parent_rate, u8 index);
@@ -254,12 +260,12 @@ void of_fixed_clk_setup(struct device_node *np);
254 * 260 *
255 * Flags: 261 * Flags:
256 * CLK_GATE_SET_TO_DISABLE - by default this clock sets the bit at bit_idx to 262 * CLK_GATE_SET_TO_DISABLE - by default this clock sets the bit at bit_idx to
257 * enable the clock. Setting this flag does the opposite: setting the bit 263 * enable the clock. Setting this flag does the opposite: setting the bit
258 * disable the clock and clearing it enables the clock 264 * disable the clock and clearing it enables the clock
259 * CLK_GATE_HIWORD_MASK - The gate settings are only in lower 16-bit 265 * CLK_GATE_HIWORD_MASK - The gate settings are only in lower 16-bit
260 * of this register, and mask of gate bits are in higher 16-bit of this 266 * of this register, and mask of gate bits are in higher 16-bit of this
261 * register. While setting the gate bits, higher 16-bit should also be 267 * register. While setting the gate bits, higher 16-bit should also be
262 * updated to indicate changing gate bits. 268 * updated to indicate changing gate bits.
263 */ 269 */
264struct clk_gate { 270struct clk_gate {
265 struct clk_hw hw; 271 struct clk_hw hw;
@@ -298,20 +304,24 @@ struct clk_div_table {
298 * 304 *
299 * Flags: 305 * Flags:
300 * CLK_DIVIDER_ONE_BASED - by default the divisor is the value read from the 306 * CLK_DIVIDER_ONE_BASED - by default the divisor is the value read from the
301 * register plus one. If CLK_DIVIDER_ONE_BASED is set then the divider is 307 * register plus one. If CLK_DIVIDER_ONE_BASED is set then the divider is
302 * the raw value read from the register, with the value of zero considered 308 * the raw value read from the register, with the value of zero considered
303 * invalid, unless CLK_DIVIDER_ALLOW_ZERO is set. 309 * invalid, unless CLK_DIVIDER_ALLOW_ZERO is set.
304 * CLK_DIVIDER_POWER_OF_TWO - clock divisor is 2 raised to the value read from 310 * CLK_DIVIDER_POWER_OF_TWO - clock divisor is 2 raised to the value read from
305 * the hardware register 311 * the hardware register
306 * CLK_DIVIDER_ALLOW_ZERO - Allow zero divisors. For dividers which have 312 * CLK_DIVIDER_ALLOW_ZERO - Allow zero divisors. For dividers which have
307 * CLK_DIVIDER_ONE_BASED set, it is possible to end up with a zero divisor. 313 * CLK_DIVIDER_ONE_BASED set, it is possible to end up with a zero divisor.
308 * Some hardware implementations gracefully handle this case and allow a 314 * Some hardware implementations gracefully handle this case and allow a
309 * zero divisor by not modifying their input clock 315 * zero divisor by not modifying their input clock
310 * (divide by one / bypass). 316 * (divide by one / bypass).
311 * CLK_DIVIDER_HIWORD_MASK - The divider settings are only in lower 16-bit 317 * CLK_DIVIDER_HIWORD_MASK - The divider settings are only in lower 16-bit
312 * of this register, and mask of divider bits are in higher 16-bit of this 318 * of this register, and mask of divider bits are in higher 16-bit of this
313 * register. While setting the divider bits, higher 16-bit should also be 319 * register. While setting the divider bits, higher 16-bit should also be
314 * updated to indicate changing divider bits. 320 * updated to indicate changing divider bits.
321 * CLK_DIVIDER_ROUND_CLOSEST - Makes the best calculated divider to be rounded
322 * to the closest integer instead of the up one.
323 * CLK_DIVIDER_READ_ONLY - The divider settings are preconfigured and should
324 * not be changed by the clock framework.
315 */ 325 */
316struct clk_divider { 326struct clk_divider {
317 struct clk_hw hw; 327 struct clk_hw hw;
@@ -327,8 +337,11 @@ struct clk_divider {
327#define CLK_DIVIDER_POWER_OF_TWO BIT(1) 337#define CLK_DIVIDER_POWER_OF_TWO BIT(1)
328#define CLK_DIVIDER_ALLOW_ZERO BIT(2) 338#define CLK_DIVIDER_ALLOW_ZERO BIT(2)
329#define CLK_DIVIDER_HIWORD_MASK BIT(3) 339#define CLK_DIVIDER_HIWORD_MASK BIT(3)
340#define CLK_DIVIDER_ROUND_CLOSEST BIT(4)
341#define CLK_DIVIDER_READ_ONLY BIT(5)
330 342
331extern const struct clk_ops clk_divider_ops; 343extern const struct clk_ops clk_divider_ops;
344extern const struct clk_ops clk_divider_ro_ops;
332struct clk *clk_register_divider(struct device *dev, const char *name, 345struct clk *clk_register_divider(struct device *dev, const char *name,
333 const char *parent_name, unsigned long flags, 346 const char *parent_name, unsigned long flags,
334 void __iomem *reg, u8 shift, u8 width, 347 void __iomem *reg, u8 shift, u8 width,
@@ -356,9 +369,9 @@ struct clk *clk_register_divider_table(struct device *dev, const char *name,
356 * CLK_MUX_INDEX_ONE - register index starts at 1, not 0 369 * CLK_MUX_INDEX_ONE - register index starts at 1, not 0
357 * CLK_MUX_INDEX_BIT - register index is a single bit (power of two) 370 * CLK_MUX_INDEX_BIT - register index is a single bit (power of two)
358 * CLK_MUX_HIWORD_MASK - The mux settings are only in lower 16-bit of this 371 * CLK_MUX_HIWORD_MASK - The mux settings are only in lower 16-bit of this
359 * register, and mask of mux bits are in higher 16-bit of this register. 372 * register, and mask of mux bits are in higher 16-bit of this register.
360 * While setting the mux bits, higher 16-bit should also be updated to 373 * While setting the mux bits, higher 16-bit should also be updated to
361 * indicate changing mux bits. 374 * indicate changing mux bits.
362 */ 375 */
363struct clk_mux { 376struct clk_mux {
364 struct clk_hw hw; 377 struct clk_hw hw;
@@ -413,6 +426,37 @@ struct clk *clk_register_fixed_factor(struct device *dev, const char *name,
413 const char *parent_name, unsigned long flags, 426 const char *parent_name, unsigned long flags,
414 unsigned int mult, unsigned int div); 427 unsigned int mult, unsigned int div);
415 428
429/**
430 * struct clk_fractional_divider - adjustable fractional divider clock
431 *
432 * @hw: handle between common and hardware-specific interfaces
433 * @reg: register containing the divider
434 * @mshift: shift to the numerator bit field
435 * @mwidth: width of the numerator bit field
436 * @nshift: shift to the denominator bit field
437 * @nwidth: width of the denominator bit field
438 * @lock: register lock
439 *
440 * Clock with adjustable fractional divider affecting its output frequency.
441 */
442
443struct clk_fractional_divider {
444 struct clk_hw hw;
445 void __iomem *reg;
446 u8 mshift;
447 u32 mmask;
448 u8 nshift;
449 u32 nmask;
450 u8 flags;
451 spinlock_t *lock;
452};
453
454extern const struct clk_ops clk_fractional_divider_ops;
455struct clk *clk_register_fractional_divider(struct device *dev,
456 const char *name, const char *parent_name, unsigned long flags,
457 void __iomem *reg, u8 mshift, u8 mwidth, u8 nshift, u8 nwidth,
458 u8 clk_divider_flags, spinlock_t *lock);
459
416/*** 460/***
417 * struct clk_composite - aggregate clock of mux, divider and gate clocks 461 * struct clk_composite - aggregate clock of mux, divider and gate clocks
418 * 462 *
@@ -498,10 +542,7 @@ struct clk_onecell_data {
498 542
499extern struct of_device_id __clk_of_table; 543extern struct of_device_id __clk_of_table;
500 544
501#define CLK_OF_DECLARE(name, compat, fn) \ 545#define CLK_OF_DECLARE(name, compat, fn) OF_DECLARE_1(clk, name, compat, fn)
502 static const struct of_device_id __clk_of_table_##name \
503 __used __section(__clk_of_table) \
504 = { .compatible = compat, .data = fn };
505 546
506#ifdef CONFIG_OF 547#ifdef CONFIG_OF
507int of_clk_add_provider(struct device_node *np, 548int of_clk_add_provider(struct device_node *np,
diff --git a/include/linux/clk/at91_pmc.h b/include/linux/clk/at91_pmc.h
index a6911ebbd02a..de4268d4987a 100644
--- a/include/linux/clk/at91_pmc.h
+++ b/include/linux/clk/at91_pmc.h
@@ -155,6 +155,7 @@ extern void __iomem *at91_pmc_base;
155#define AT91_PMC_LOCKB (1 << 2) /* PLLB Lock */ 155#define AT91_PMC_LOCKB (1 << 2) /* PLLB Lock */
156#define AT91_PMC_MCKRDY (1 << 3) /* Master Clock */ 156#define AT91_PMC_MCKRDY (1 << 3) /* Master Clock */
157#define AT91_PMC_LOCKU (1 << 6) /* UPLL Lock [some SAM9] */ 157#define AT91_PMC_LOCKU (1 << 6) /* UPLL Lock [some SAM9] */
158#define AT91_PMC_OSCSEL (1 << 7) /* Slow Oscillator Selection [some SAM9] */
158#define AT91_PMC_PCK0RDY (1 << 8) /* Programmable Clock 0 */ 159#define AT91_PMC_PCK0RDY (1 << 8) /* Programmable Clock 0 */
159#define AT91_PMC_PCK1RDY (1 << 9) /* Programmable Clock 1 */ 160#define AT91_PMC_PCK1RDY (1 << 9) /* Programmable Clock 1 */
160#define AT91_PMC_PCK2RDY (1 << 10) /* Programmable Clock 2 */ 161#define AT91_PMC_PCK2RDY (1 << 10) /* Programmable Clock 2 */
diff --git a/include/linux/clk/shmobile.h b/include/linux/clk/shmobile.h
index f9bf080a1123..9f8a14041dd5 100644
--- a/include/linux/clk/shmobile.h
+++ b/include/linux/clk/shmobile.h
@@ -1,7 +1,9 @@
1/* 1/*
2 * Copyright 2013 Ideas On Board SPRL 2 * Copyright 2013 Ideas On Board SPRL
3 * Copyright 2013, 2014 Horms Solutions Ltd.
3 * 4 *
4 * Contact: Laurent Pinchart <laurent.pinchart@ideasonboard.com> 5 * Contact: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
6 * Contact: Simon Horman <horms@verge.net.au>
5 * 7 *
6 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by 9 * it under the terms of the GNU General Public License as published by
@@ -14,6 +16,7 @@
14 16
15#include <linux/types.h> 17#include <linux/types.h>
16 18
19void r8a7779_clocks_init(u32 mode);
17void rcar_gen2_clocks_init(u32 mode); 20void rcar_gen2_clocks_init(u32 mode);
18 21
19#endif 22#endif
diff --git a/include/linux/clk/sunxi.h b/include/linux/clk/sunxi.h
new file mode 100644
index 000000000000..aed28c4451d9
--- /dev/null
+++ b/include/linux/clk/sunxi.h
@@ -0,0 +1,22 @@
1/*
2 * Copyright 2013 - Hans de Goede <hdegoede@redhat.com>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14
15#ifndef __LINUX_CLK_SUNXI_H_
16#define __LINUX_CLK_SUNXI_H_
17
18#include <linux/clk.h>
19
20void clk_sunxi_mmc_phase_control(struct clk *clk, u8 sample, u8 output);
21
22#endif
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index 67301a405712..a16b497d5159 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -339,23 +339,13 @@ extern int clocksource_mmio_init(void __iomem *, const char *,
339 339
340extern int clocksource_i8253_init(void); 340extern int clocksource_i8253_init(void);
341 341
342struct device_node; 342#define CLOCKSOURCE_OF_DECLARE(name, compat, fn) \
343typedef void(*clocksource_of_init_fn)(struct device_node *); 343 OF_DECLARE_1(clksrc, name, compat, fn)
344
344#ifdef CONFIG_CLKSRC_OF 345#ifdef CONFIG_CLKSRC_OF
345extern void clocksource_of_init(void); 346extern void clocksource_of_init(void);
346
347#define CLOCKSOURCE_OF_DECLARE(name, compat, fn) \
348 static const struct of_device_id __clksrc_of_table_##name \
349 __used __section(__clksrc_of_table) \
350 = { .compatible = compat, \
351 .data = (fn == (clocksource_of_init_fn)NULL) ? fn : fn }
352#else 347#else
353static inline void clocksource_of_init(void) {} 348static inline void clocksource_of_init(void) {}
354#define CLOCKSOURCE_OF_DECLARE(name, compat, fn) \
355 static const struct of_device_id __clksrc_of_table_##name \
356 __attribute__((unused)) \
357 = { .compatible = compat, \
358 .data = (fn == (clocksource_of_init_fn)NULL) ? fn : fn }
359#endif 349#endif
360 350
361#endif /* _LINUX_CLOCKSOURCE_H */ 351#endif /* _LINUX_CLOCKSOURCE_H */
diff --git a/include/linux/compaction.h b/include/linux/compaction.h
index 7e1c76e3cd68..01e3132820da 100644
--- a/include/linux/compaction.h
+++ b/include/linux/compaction.h
@@ -22,7 +22,7 @@ extern int sysctl_extfrag_handler(struct ctl_table *table, int write,
22extern int fragmentation_index(struct zone *zone, unsigned int order); 22extern int fragmentation_index(struct zone *zone, unsigned int order);
23extern unsigned long try_to_compact_pages(struct zonelist *zonelist, 23extern unsigned long try_to_compact_pages(struct zonelist *zonelist,
24 int order, gfp_t gfp_mask, nodemask_t *mask, 24 int order, gfp_t gfp_mask, nodemask_t *mask,
25 bool sync, bool *contended); 25 enum migrate_mode mode, bool *contended);
26extern void compact_pgdat(pg_data_t *pgdat, int order); 26extern void compact_pgdat(pg_data_t *pgdat, int order);
27extern void reset_isolation_suitable(pg_data_t *pgdat); 27extern void reset_isolation_suitable(pg_data_t *pgdat);
28extern unsigned long compaction_suitable(struct zone *zone, int order); 28extern unsigned long compaction_suitable(struct zone *zone, int order);
@@ -91,7 +91,7 @@ static inline bool compaction_restarting(struct zone *zone, int order)
91#else 91#else
92static inline unsigned long try_to_compact_pages(struct zonelist *zonelist, 92static inline unsigned long try_to_compact_pages(struct zonelist *zonelist,
93 int order, gfp_t gfp_mask, nodemask_t *nodemask, 93 int order, gfp_t gfp_mask, nodemask_t *nodemask,
94 bool sync, bool *contended) 94 enum migrate_mode mode, bool *contended)
95{ 95{
96 return COMPACT_CONTINUE; 96 return COMPACT_CONTINUE;
97} 97}
diff --git a/include/linux/compiler-intel.h b/include/linux/compiler-intel.h
index 5529c5239421..ba147a1727e6 100644
--- a/include/linux/compiler-intel.h
+++ b/include/linux/compiler-intel.h
@@ -13,12 +13,9 @@
13/* Intel ECC compiler doesn't support gcc specific asm stmts. 13/* Intel ECC compiler doesn't support gcc specific asm stmts.
14 * It uses intrinsics to do the equivalent things. 14 * It uses intrinsics to do the equivalent things.
15 */ 15 */
16#undef barrier
17#undef RELOC_HIDE 16#undef RELOC_HIDE
18#undef OPTIMIZER_HIDE_VAR 17#undef OPTIMIZER_HIDE_VAR
19 18
20#define barrier() __memory_barrier()
21
22#define RELOC_HIDE(ptr, off) \ 19#define RELOC_HIDE(ptr, off) \
23 ({ unsigned long __ptr; \ 20 ({ unsigned long __ptr; \
24 __ptr = (unsigned long) (ptr); \ 21 __ptr = (unsigned long) (ptr); \
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index ee7239ea1583..64fdfe1cfcf0 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -323,9 +323,18 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect);
323#endif 323#endif
324#ifndef __compiletime_error 324#ifndef __compiletime_error
325# define __compiletime_error(message) 325# define __compiletime_error(message)
326# define __compiletime_error_fallback(condition) \ 326/*
327 * Sparse complains of variable sized arrays due to the temporary variable in
328 * __compiletime_assert. Unfortunately we can't just expand it out to make
329 * sparse see a constant array size without breaking compiletime_assert on old
330 * versions of GCC (e.g. 4.2.4), so hide the array from sparse altogether.
331 */
332# ifndef __CHECKER__
333# define __compiletime_error_fallback(condition) \
327 do { ((void)sizeof(char[1 - 2 * condition])); } while (0) 334 do { ((void)sizeof(char[1 - 2 * condition])); } while (0)
328#else 335# endif
336#endif
337#ifndef __compiletime_error_fallback
329# define __compiletime_error_fallback(condition) do { } while (0) 338# define __compiletime_error_fallback(condition) do { } while (0)
330#endif 339#endif
331 340
diff --git a/include/linux/connector.h b/include/linux/connector.h
index be9c4747d511..f8fe8637d771 100644
--- a/include/linux/connector.h
+++ b/include/linux/connector.h
@@ -71,6 +71,7 @@ struct cn_dev {
71int cn_add_callback(struct cb_id *id, const char *name, 71int cn_add_callback(struct cb_id *id, const char *name,
72 void (*callback)(struct cn_msg *, struct netlink_skb_parms *)); 72 void (*callback)(struct cn_msg *, struct netlink_skb_parms *));
73void cn_del_callback(struct cb_id *); 73void cn_del_callback(struct cb_id *);
74int cn_netlink_send_mult(struct cn_msg *msg, u16 len, u32 portid, u32 group, gfp_t gfp_mask);
74int cn_netlink_send(struct cn_msg *msg, u32 portid, u32 group, gfp_t gfp_mask); 75int cn_netlink_send(struct cn_msg *msg, u32 portid, u32 group, gfp_t gfp_mask);
75 76
76int cn_queue_add_callback(struct cn_queue_dev *dev, const char *name, 77int cn_queue_add_callback(struct cn_queue_dev *dev, const char *name,
diff --git a/include/linux/console_struct.h b/include/linux/console_struct.h
index 7f0c32908568..e859c98d1767 100644
--- a/include/linux/console_struct.h
+++ b/include/linux/console_struct.h
@@ -17,6 +17,7 @@
17#include <linux/workqueue.h> 17#include <linux/workqueue.h>
18 18
19struct vt_struct; 19struct vt_struct;
20struct uni_pagedir;
20 21
21#define NPAR 16 22#define NPAR 16
22 23
@@ -104,8 +105,8 @@ struct vc_data {
104 unsigned int vc_bell_pitch; /* Console bell pitch */ 105 unsigned int vc_bell_pitch; /* Console bell pitch */
105 unsigned int vc_bell_duration; /* Console bell duration */ 106 unsigned int vc_bell_duration; /* Console bell duration */
106 struct vc_data **vc_display_fg; /* [!] Ptr to var holding fg console for this display */ 107 struct vc_data **vc_display_fg; /* [!] Ptr to var holding fg console for this display */
107 unsigned long vc_uni_pagedir; 108 struct uni_pagedir *vc_uni_pagedir;
108 unsigned long *vc_uni_pagedir_loc; /* [!] Location of uni_pagedir variable for this console */ 109 struct uni_pagedir **vc_uni_pagedir_loc; /* [!] Location of uni_pagedir variable for this console */
109 bool vc_panic_force_write; /* when oops/panic this VC can accept forced output/blanking */ 110 bool vc_panic_force_write; /* when oops/panic this VC can accept forced output/blanking */
110 /* additional information is in vt_kern.h */ 111 /* additional information is in vt_kern.h */
111}; 112};
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index 81887120395c..95978ad7fcdd 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -256,7 +256,6 @@ enum cpuhp_state {
256}; 256};
257 257
258void cpu_startup_entry(enum cpuhp_state state); 258void cpu_startup_entry(enum cpuhp_state state);
259void cpu_idle(void);
260 259
261void cpu_idle_poll_ctrl(bool enable); 260void cpu_idle_poll_ctrl(bool enable);
262 261
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index 5ae5100c1f24..3f458896d45c 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -110,6 +110,7 @@ struct cpufreq_policy {
110 bool transition_ongoing; /* Tracks transition status */ 110 bool transition_ongoing; /* Tracks transition status */
111 spinlock_t transition_lock; 111 spinlock_t transition_lock;
112 wait_queue_head_t transition_wait; 112 wait_queue_head_t transition_wait;
113 struct task_struct *transition_task; /* Task which is doing the transition */
113}; 114};
114 115
115/* Only for ACPI */ 116/* Only for ACPI */
@@ -468,6 +469,55 @@ struct cpufreq_frequency_table {
468 * order */ 469 * order */
469}; 470};
470 471
472#if defined(CONFIG_CPU_FREQ) && defined(CONFIG_PM_OPP)
473int dev_pm_opp_init_cpufreq_table(struct device *dev,
474 struct cpufreq_frequency_table **table);
475void dev_pm_opp_free_cpufreq_table(struct device *dev,
476 struct cpufreq_frequency_table **table);
477#else
478static inline int dev_pm_opp_init_cpufreq_table(struct device *dev,
479 struct cpufreq_frequency_table
480 **table)
481{
482 return -EINVAL;
483}
484
485static inline void dev_pm_opp_free_cpufreq_table(struct device *dev,
486 struct cpufreq_frequency_table
487 **table)
488{
489}
490#endif
491
492static inline bool cpufreq_next_valid(struct cpufreq_frequency_table **pos)
493{
494 while ((*pos)->frequency != CPUFREQ_TABLE_END)
495 if ((*pos)->frequency != CPUFREQ_ENTRY_INVALID)
496 return true;
497 else
498 (*pos)++;
499 return false;
500}
501
502/*
503 * cpufreq_for_each_entry - iterate over a cpufreq_frequency_table
504 * @pos: the cpufreq_frequency_table * to use as a loop cursor.
505 * @table: the cpufreq_frequency_table * to iterate over.
506 */
507
508#define cpufreq_for_each_entry(pos, table) \
509 for (pos = table; pos->frequency != CPUFREQ_TABLE_END; pos++)
510
511/*
512 * cpufreq_for_each_valid_entry - iterate over a cpufreq_frequency_table
513 * excluding CPUFREQ_ENTRY_INVALID frequencies.
514 * @pos: the cpufreq_frequency_table * to use as a loop cursor.
515 * @table: the cpufreq_frequency_table * to iterate over.
516 */
517
518#define cpufreq_for_each_valid_entry(pos, table) \
519 for (pos = table; cpufreq_next_valid(&pos); pos++)
520
471int cpufreq_frequency_table_cpuinfo(struct cpufreq_policy *policy, 521int cpufreq_frequency_table_cpuinfo(struct cpufreq_policy *policy,
472 struct cpufreq_frequency_table *table); 522 struct cpufreq_frequency_table *table);
473 523
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
index b0238cba440b..c51a436135c4 100644
--- a/include/linux/cpuidle.h
+++ b/include/linux/cpuidle.h
@@ -120,8 +120,6 @@ struct cpuidle_driver {
120#ifdef CONFIG_CPU_IDLE 120#ifdef CONFIG_CPU_IDLE
121extern void disable_cpuidle(void); 121extern void disable_cpuidle(void);
122 122
123extern int cpuidle_enabled(struct cpuidle_driver *drv,
124 struct cpuidle_device *dev);
125extern int cpuidle_select(struct cpuidle_driver *drv, 123extern int cpuidle_select(struct cpuidle_driver *drv,
126 struct cpuidle_device *dev); 124 struct cpuidle_device *dev);
127extern int cpuidle_enter(struct cpuidle_driver *drv, 125extern int cpuidle_enter(struct cpuidle_driver *drv,
@@ -145,13 +143,11 @@ extern void cpuidle_resume(void);
145extern int cpuidle_enable_device(struct cpuidle_device *dev); 143extern int cpuidle_enable_device(struct cpuidle_device *dev);
146extern void cpuidle_disable_device(struct cpuidle_device *dev); 144extern void cpuidle_disable_device(struct cpuidle_device *dev);
147extern int cpuidle_play_dead(void); 145extern int cpuidle_play_dead(void);
146extern void cpuidle_use_deepest_state(bool enable);
148 147
149extern struct cpuidle_driver *cpuidle_get_cpu_driver(struct cpuidle_device *dev); 148extern struct cpuidle_driver *cpuidle_get_cpu_driver(struct cpuidle_device *dev);
150#else 149#else
151static inline void disable_cpuidle(void) { } 150static inline void disable_cpuidle(void) { }
152static inline int cpuidle_enabled(struct cpuidle_driver *drv,
153 struct cpuidle_device *dev)
154{return -ENODEV; }
155static inline int cpuidle_select(struct cpuidle_driver *drv, 151static inline int cpuidle_select(struct cpuidle_driver *drv,
156 struct cpuidle_device *dev) 152 struct cpuidle_device *dev)
157{return -ENODEV; } 153{return -ENODEV; }
@@ -180,6 +176,7 @@ static inline int cpuidle_enable_device(struct cpuidle_device *dev)
180{return -ENODEV; } 176{return -ENODEV; }
181static inline void cpuidle_disable_device(struct cpuidle_device *dev) { } 177static inline void cpuidle_disable_device(struct cpuidle_device *dev) { }
182static inline int cpuidle_play_dead(void) {return -ENODEV; } 178static inline int cpuidle_play_dead(void) {return -ENODEV; }
179static inline void cpuidle_use_deepest_state(bool enable) {}
183static inline struct cpuidle_driver *cpuidle_get_cpu_driver( 180static inline struct cpuidle_driver *cpuidle_get_cpu_driver(
184 struct cpuidle_device *dev) {return NULL; } 181 struct cpuidle_device *dev) {return NULL; }
185#endif 182#endif
diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h
index b19d3dc2e651..ade2390ffe92 100644
--- a/include/linux/cpuset.h
+++ b/include/linux/cpuset.h
@@ -12,10 +12,31 @@
12#include <linux/cpumask.h> 12#include <linux/cpumask.h>
13#include <linux/nodemask.h> 13#include <linux/nodemask.h>
14#include <linux/mm.h> 14#include <linux/mm.h>
15#include <linux/jump_label.h>
15 16
16#ifdef CONFIG_CPUSETS 17#ifdef CONFIG_CPUSETS
17 18
18extern int number_of_cpusets; /* How many cpusets are defined in system? */ 19extern struct static_key cpusets_enabled_key;
20static inline bool cpusets_enabled(void)
21{
22 return static_key_false(&cpusets_enabled_key);
23}
24
25static inline int nr_cpusets(void)
26{
27 /* jump label reference count + the top-level cpuset */
28 return static_key_count(&cpusets_enabled_key) + 1;
29}
30
31static inline void cpuset_inc(void)
32{
33 static_key_slow_inc(&cpusets_enabled_key);
34}
35
36static inline void cpuset_dec(void)
37{
38 static_key_slow_dec(&cpusets_enabled_key);
39}
19 40
20extern int cpuset_init(void); 41extern int cpuset_init(void);
21extern void cpuset_init_smp(void); 42extern void cpuset_init_smp(void);
@@ -32,13 +53,13 @@ extern int __cpuset_node_allowed_hardwall(int node, gfp_t gfp_mask);
32 53
33static inline int cpuset_node_allowed_softwall(int node, gfp_t gfp_mask) 54static inline int cpuset_node_allowed_softwall(int node, gfp_t gfp_mask)
34{ 55{
35 return number_of_cpusets <= 1 || 56 return nr_cpusets() <= 1 ||
36 __cpuset_node_allowed_softwall(node, gfp_mask); 57 __cpuset_node_allowed_softwall(node, gfp_mask);
37} 58}
38 59
39static inline int cpuset_node_allowed_hardwall(int node, gfp_t gfp_mask) 60static inline int cpuset_node_allowed_hardwall(int node, gfp_t gfp_mask)
40{ 61{
41 return number_of_cpusets <= 1 || 62 return nr_cpusets() <= 1 ||
42 __cpuset_node_allowed_hardwall(node, gfp_mask); 63 __cpuset_node_allowed_hardwall(node, gfp_mask);
43} 64}
44 65
@@ -124,6 +145,8 @@ static inline void set_mems_allowed(nodemask_t nodemask)
124 145
125#else /* !CONFIG_CPUSETS */ 146#else /* !CONFIG_CPUSETS */
126 147
148static inline bool cpusets_enabled(void) { return false; }
149
127static inline int cpuset_init(void) { return 0; } 150static inline int cpuset_init(void) { return 0; }
128static inline void cpuset_init_smp(void) {} 151static inline void cpuset_init_smp(void) {}
129 152
diff --git a/include/linux/devfreq.h b/include/linux/devfreq.h
index d48dc00232a4..f1863dcd83ea 100644
--- a/include/linux/devfreq.h
+++ b/include/linux/devfreq.h
@@ -181,6 +181,12 @@ extern struct devfreq *devfreq_add_device(struct device *dev,
181 const char *governor_name, 181 const char *governor_name,
182 void *data); 182 void *data);
183extern int devfreq_remove_device(struct devfreq *devfreq); 183extern int devfreq_remove_device(struct devfreq *devfreq);
184extern struct devfreq *devm_devfreq_add_device(struct device *dev,
185 struct devfreq_dev_profile *profile,
186 const char *governor_name,
187 void *data);
188extern void devm_devfreq_remove_device(struct device *dev,
189 struct devfreq *devfreq);
184 190
185/* Supposed to be called by PM_SLEEP/PM_RUNTIME callbacks */ 191/* Supposed to be called by PM_SLEEP/PM_RUNTIME callbacks */
186extern int devfreq_suspend_device(struct devfreq *devfreq); 192extern int devfreq_suspend_device(struct devfreq *devfreq);
@@ -193,6 +199,10 @@ extern int devfreq_register_opp_notifier(struct device *dev,
193 struct devfreq *devfreq); 199 struct devfreq *devfreq);
194extern int devfreq_unregister_opp_notifier(struct device *dev, 200extern int devfreq_unregister_opp_notifier(struct device *dev,
195 struct devfreq *devfreq); 201 struct devfreq *devfreq);
202extern int devm_devfreq_register_opp_notifier(struct device *dev,
203 struct devfreq *devfreq);
204extern void devm_devfreq_unregister_opp_notifier(struct device *dev,
205 struct devfreq *devfreq);
196 206
197#if IS_ENABLED(CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND) 207#if IS_ENABLED(CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND)
198/** 208/**
@@ -220,7 +230,7 @@ static inline struct devfreq *devfreq_add_device(struct device *dev,
220 const char *governor_name, 230 const char *governor_name,
221 void *data) 231 void *data)
222{ 232{
223 return NULL; 233 return ERR_PTR(-ENOSYS);
224} 234}
225 235
226static inline int devfreq_remove_device(struct devfreq *devfreq) 236static inline int devfreq_remove_device(struct devfreq *devfreq)
@@ -228,6 +238,19 @@ static inline int devfreq_remove_device(struct devfreq *devfreq)
228 return 0; 238 return 0;
229} 239}
230 240
241static inline struct devfreq *devm_devfreq_add_device(struct device *dev,
242 struct devfreq_dev_profile *profile,
243 const char *governor_name,
244 void *data)
245{
246 return ERR_PTR(-ENOSYS);
247}
248
249static inline void devm_devfreq_remove_device(struct device *dev,
250 struct devfreq *devfreq)
251{
252}
253
231static inline int devfreq_suspend_device(struct devfreq *devfreq) 254static inline int devfreq_suspend_device(struct devfreq *devfreq)
232{ 255{
233 return 0; 256 return 0;
@@ -256,6 +279,16 @@ static inline int devfreq_unregister_opp_notifier(struct device *dev,
256 return -EINVAL; 279 return -EINVAL;
257} 280}
258 281
282static inline int devm_devfreq_register_opp_notifier(struct device *dev,
283 struct devfreq *devfreq)
284{
285 return -EINVAL;
286}
287
288static inline void devm_devfreq_unregister_opp_notifier(struct device *dev,
289 struct devfreq *devfreq)
290{
291}
259#endif /* CONFIG_PM_DEVFREQ */ 292#endif /* CONFIG_PM_DEVFREQ */
260 293
261#endif /* __LINUX_DEVFREQ_H__ */ 294#endif /* __LINUX_DEVFREQ_H__ */
diff --git a/include/linux/device.h b/include/linux/device.h
index d1d1c055b48e..af424acd393d 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -623,6 +623,12 @@ static inline void *devm_kcalloc(struct device *dev,
623} 623}
624extern void devm_kfree(struct device *dev, void *p); 624extern void devm_kfree(struct device *dev, void *p);
625extern char *devm_kstrdup(struct device *dev, const char *s, gfp_t gfp); 625extern char *devm_kstrdup(struct device *dev, const char *s, gfp_t gfp);
626extern void *devm_kmemdup(struct device *dev, const void *src, size_t len,
627 gfp_t gfp);
628
629extern unsigned long devm_get_free_pages(struct device *dev,
630 gfp_t gfp_mask, unsigned int order);
631extern void devm_free_pages(struct device *dev, unsigned long addr);
626 632
627void __iomem *devm_ioremap_resource(struct device *dev, struct resource *res); 633void __iomem *devm_ioremap_resource(struct device *dev, struct resource *res);
628void __iomem *devm_request_and_ioremap(struct device *dev, 634void __iomem *devm_request_and_ioremap(struct device *dev,
@@ -673,6 +679,7 @@ struct acpi_dev_node {
673 * variants, which GPIO pins act in what additional roles, and so 679 * variants, which GPIO pins act in what additional roles, and so
674 * on. This shrinks the "Board Support Packages" (BSPs) and 680 * on. This shrinks the "Board Support Packages" (BSPs) and
675 * minimizes board-specific #ifdefs in drivers. 681 * minimizes board-specific #ifdefs in drivers.
682 * @driver_data: Private pointer for driver specific info.
676 * @power: For device power management. 683 * @power: For device power management.
677 * See Documentation/power/devices.txt for details. 684 * See Documentation/power/devices.txt for details.
678 * @pm_domain: Provide callbacks that are executed during system suspend, 685 * @pm_domain: Provide callbacks that are executed during system suspend,
@@ -685,6 +692,7 @@ struct acpi_dev_node {
685 * @coherent_dma_mask: Like dma_mask, but for alloc_coherent mapping as not all 692 * @coherent_dma_mask: Like dma_mask, but for alloc_coherent mapping as not all
686 * hardware supports 64-bit addresses for consistent allocations 693 * hardware supports 64-bit addresses for consistent allocations
687 * such descriptors. 694 * such descriptors.
695 * @dma_pfn_offset: offset of DMA memory range relatively of RAM
688 * @dma_parms: A low level driver may set these to teach IOMMU code about 696 * @dma_parms: A low level driver may set these to teach IOMMU code about
689 * segment limitations. 697 * segment limitations.
690 * @dma_pools: Dma pools (if dma'ble device). 698 * @dma_pools: Dma pools (if dma'ble device).
@@ -734,6 +742,8 @@ struct device {
734 device */ 742 device */
735 void *platform_data; /* Platform specific data, device 743 void *platform_data; /* Platform specific data, device
736 core doesn't touch it */ 744 core doesn't touch it */
745 void *driver_data; /* Driver data, set and get with
746 dev_set/get_drvdata */
737 struct dev_pm_info power; 747 struct dev_pm_info power;
738 struct dev_pm_domain *pm_domain; 748 struct dev_pm_domain *pm_domain;
739 749
@@ -750,6 +760,7 @@ struct device {
750 not all hardware supports 760 not all hardware supports
751 64 bit addresses for consistent 761 64 bit addresses for consistent
752 allocations such descriptors. */ 762 allocations such descriptors. */
763 unsigned long dma_pfn_offset;
753 764
754 struct device_dma_parameters *dma_parms; 765 struct device_dma_parameters *dma_parms;
755 766
@@ -823,6 +834,16 @@ static inline void set_dev_node(struct device *dev, int node)
823} 834}
824#endif 835#endif
825 836
837static inline void *dev_get_drvdata(const struct device *dev)
838{
839 return dev->driver_data;
840}
841
842static inline void dev_set_drvdata(struct device *dev, void *data)
843{
844 dev->driver_data = data;
845}
846
826static inline struct pm_subsys_data *dev_to_psd(struct device *dev) 847static inline struct pm_subsys_data *dev_to_psd(struct device *dev)
827{ 848{
828 return dev ? dev->power.subsys_data : NULL; 849 return dev ? dev->power.subsys_data : NULL;
@@ -907,8 +928,6 @@ extern int device_move(struct device *dev, struct device *new_parent,
907extern const char *device_get_devnode(struct device *dev, 928extern const char *device_get_devnode(struct device *dev,
908 umode_t *mode, kuid_t *uid, kgid_t *gid, 929 umode_t *mode, kuid_t *uid, kgid_t *gid,
909 const char **tmp); 930 const char **tmp);
910extern void *dev_get_drvdata(const struct device *dev);
911extern int dev_set_drvdata(struct device *dev, void *data);
912 931
913static inline bool device_supports_offline(struct device *dev) 932static inline bool device_supports_offline(struct device *dev)
914{ 933{
diff --git a/include/linux/dma-contiguous.h b/include/linux/dma-contiguous.h
index 3b28f937d959..772eab5d524a 100644
--- a/include/linux/dma-contiguous.h
+++ b/include/linux/dma-contiguous.h
@@ -88,7 +88,8 @@ static inline void dma_contiguous_set_default(struct cma *cma)
88void dma_contiguous_reserve(phys_addr_t addr_limit); 88void dma_contiguous_reserve(phys_addr_t addr_limit);
89 89
90int __init dma_contiguous_reserve_area(phys_addr_t size, phys_addr_t base, 90int __init dma_contiguous_reserve_area(phys_addr_t size, phys_addr_t base,
91 phys_addr_t limit, struct cma **res_cma); 91 phys_addr_t limit, struct cma **res_cma,
92 bool fixed);
92 93
93/** 94/**
94 * dma_declare_contiguous() - reserve area for contiguous memory handling 95 * dma_declare_contiguous() - reserve area for contiguous memory handling
@@ -108,7 +109,7 @@ static inline int dma_declare_contiguous(struct device *dev, phys_addr_t size,
108{ 109{
109 struct cma *cma; 110 struct cma *cma;
110 int ret; 111 int ret;
111 ret = dma_contiguous_reserve_area(size, base, limit, &cma); 112 ret = dma_contiguous_reserve_area(size, base, limit, &cma, true);
112 if (ret == 0) 113 if (ret == 0)
113 dev_set_cma_area(dev, cma); 114 dev_set_cma_area(dev, cma);
114 115
@@ -136,7 +137,9 @@ static inline void dma_contiguous_set_default(struct cma *cma) { }
136static inline void dma_contiguous_reserve(phys_addr_t limit) { } 137static inline void dma_contiguous_reserve(phys_addr_t limit) { }
137 138
138static inline int dma_contiguous_reserve_area(phys_addr_t size, phys_addr_t base, 139static inline int dma_contiguous_reserve_area(phys_addr_t size, phys_addr_t base,
139 phys_addr_t limit, struct cma **res_cma) { 140 phys_addr_t limit, struct cma **res_cma,
141 bool fixed)
142{
140 return -ENOSYS; 143 return -ENOSYS;
141} 144}
142 145
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index fd4aee29ad10..931b70986272 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -8,6 +8,12 @@
8#include <linux/dma-direction.h> 8#include <linux/dma-direction.h>
9#include <linux/scatterlist.h> 9#include <linux/scatterlist.h>
10 10
11/*
12 * A dma_addr_t can hold any valid DMA or bus address for the platform.
13 * It can be given to a device to use as a DMA source or target. A CPU cannot
14 * reference a dma_addr_t directly because there may be translation between
15 * its physical address space and the bus address space.
16 */
11struct dma_map_ops { 17struct dma_map_ops {
12 void* (*alloc)(struct device *dev, size_t size, 18 void* (*alloc)(struct device *dev, size_t size,
13 dma_addr_t *dma_handle, gfp_t gfp, 19 dma_addr_t *dma_handle, gfp_t gfp,
@@ -123,6 +129,13 @@ static inline int dma_coerce_mask_and_coherent(struct device *dev, u64 mask)
123 129
124extern u64 dma_get_required_mask(struct device *dev); 130extern u64 dma_get_required_mask(struct device *dev);
125 131
132#ifndef set_arch_dma_coherent_ops
133static inline int set_arch_dma_coherent_ops(struct device *dev)
134{
135 return 0;
136}
137#endif
138
126static inline unsigned int dma_get_max_seg_size(struct device *dev) 139static inline unsigned int dma_get_max_seg_size(struct device *dev)
127{ 140{
128 return dev->dma_parms ? dev->dma_parms->max_segment_size : 65536; 141 return dev->dma_parms ? dev->dma_parms->max_segment_size : 65536;
@@ -186,7 +199,7 @@ static inline int dma_get_cache_alignment(void)
186 199
187#ifndef ARCH_HAS_DMA_DECLARE_COHERENT_MEMORY 200#ifndef ARCH_HAS_DMA_DECLARE_COHERENT_MEMORY
188static inline int 201static inline int
189dma_declare_coherent_memory(struct device *dev, dma_addr_t bus_addr, 202dma_declare_coherent_memory(struct device *dev, phys_addr_t phys_addr,
190 dma_addr_t device_addr, size_t size, int flags) 203 dma_addr_t device_addr, size_t size, int flags)
191{ 204{
192 return 0; 205 return 0;
@@ -217,13 +230,14 @@ extern void *dmam_alloc_noncoherent(struct device *dev, size_t size,
217extern void dmam_free_noncoherent(struct device *dev, size_t size, void *vaddr, 230extern void dmam_free_noncoherent(struct device *dev, size_t size, void *vaddr,
218 dma_addr_t dma_handle); 231 dma_addr_t dma_handle);
219#ifdef ARCH_HAS_DMA_DECLARE_COHERENT_MEMORY 232#ifdef ARCH_HAS_DMA_DECLARE_COHERENT_MEMORY
220extern int dmam_declare_coherent_memory(struct device *dev, dma_addr_t bus_addr, 233extern int dmam_declare_coherent_memory(struct device *dev,
234 phys_addr_t phys_addr,
221 dma_addr_t device_addr, size_t size, 235 dma_addr_t device_addr, size_t size,
222 int flags); 236 int flags);
223extern void dmam_release_declared_memory(struct device *dev); 237extern void dmam_release_declared_memory(struct device *dev);
224#else /* ARCH_HAS_DMA_DECLARE_COHERENT_MEMORY */ 238#else /* ARCH_HAS_DMA_DECLARE_COHERENT_MEMORY */
225static inline int dmam_declare_coherent_memory(struct device *dev, 239static inline int dmam_declare_coherent_memory(struct device *dev,
226 dma_addr_t bus_addr, dma_addr_t device_addr, 240 phys_addr_t phys_addr, dma_addr_t device_addr,
227 size_t size, gfp_t gfp) 241 size_t size, gfp_t gfp)
228{ 242{
229 return 0; 243 return 0;
diff --git a/include/linux/efi.h b/include/linux/efi.h
index 6c100ff0cae4..41bbf8ba4ba8 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -575,6 +575,9 @@ typedef efi_status_t efi_query_variable_store_t(u32 attributes, unsigned long si
575#define EFI_FILE_SYSTEM_GUID \ 575#define EFI_FILE_SYSTEM_GUID \
576 EFI_GUID( 0x964e5b22, 0x6459, 0x11d2, 0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b ) 576 EFI_GUID( 0x964e5b22, 0x6459, 0x11d2, 0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b )
577 577
578#define DEVICE_TREE_GUID \
579 EFI_GUID( 0xb1b621d5, 0xf19c, 0x41a5, 0x83, 0x0b, 0xd9, 0x15, 0x2c, 0x69, 0xaa, 0xe0 )
580
578typedef struct { 581typedef struct {
579 efi_guid_t guid; 582 efi_guid_t guid;
580 u64 table; 583 u64 table;
@@ -664,6 +667,14 @@ struct efi_memory_map {
664 unsigned long desc_size; 667 unsigned long desc_size;
665}; 668};
666 669
670struct efi_fdt_params {
671 u64 system_table;
672 u64 mmap;
673 u32 mmap_size;
674 u32 desc_size;
675 u32 desc_ver;
676};
677
667typedef struct { 678typedef struct {
668 u32 revision; 679 u32 revision;
669 u32 parent_handle; 680 u32 parent_handle;
@@ -861,8 +872,15 @@ extern void efi_initialize_iomem_resources(struct resource *code_resource,
861extern void efi_get_time(struct timespec *now); 872extern void efi_get_time(struct timespec *now);
862extern int efi_set_rtc_mmss(const struct timespec *now); 873extern int efi_set_rtc_mmss(const struct timespec *now);
863extern void efi_reserve_boot_services(void); 874extern void efi_reserve_boot_services(void);
875extern int efi_get_fdt_params(struct efi_fdt_params *params, int verbose);
864extern struct efi_memory_map memmap; 876extern struct efi_memory_map memmap;
865 877
878/* Iterate through an efi_memory_map */
879#define for_each_efi_memory_desc(m, md) \
880 for ((md) = (m)->map; \
881 (md) <= (efi_memory_desc_t *)((m)->map_end - (m)->desc_size); \
882 (md) = (void *)(md) + (m)->desc_size)
883
866/** 884/**
867 * efi_range_is_wc - check the WC bit on an address range 885 * efi_range_is_wc - check the WC bit on an address range
868 * @start: starting kvirt address 886 * @start: starting kvirt address
@@ -1033,8 +1051,10 @@ struct efivars {
1033 * and we use a page for reading/writing. 1051 * and we use a page for reading/writing.
1034 */ 1052 */
1035 1053
1054#define EFI_VAR_NAME_LEN 1024
1055
1036struct efi_variable { 1056struct efi_variable {
1037 efi_char16_t VariableName[1024/sizeof(efi_char16_t)]; 1057 efi_char16_t VariableName[EFI_VAR_NAME_LEN/sizeof(efi_char16_t)];
1038 efi_guid_t VendorGuid; 1058 efi_guid_t VendorGuid;
1039 unsigned long DataSize; 1059 unsigned long DataSize;
1040 __u8 Data[1024]; 1060 __u8 Data[1024];
@@ -1116,7 +1136,7 @@ int efivar_entry_iter(int (*func)(struct efivar_entry *, void *),
1116struct efivar_entry *efivar_entry_find(efi_char16_t *name, efi_guid_t guid, 1136struct efivar_entry *efivar_entry_find(efi_char16_t *name, efi_guid_t guid,
1117 struct list_head *head, bool remove); 1137 struct list_head *head, bool remove);
1118 1138
1119bool efivar_validate(struct efi_variable *var, u8 *data, unsigned long len); 1139bool efivar_validate(efi_char16_t *var_name, u8 *data, unsigned long len);
1120 1140
1121extern struct work_struct efivar_work; 1141extern struct work_struct efivar_work;
1122void efivar_run_worker(void); 1142void efivar_run_worker(void);
diff --git a/include/linux/extcon.h b/include/linux/extcon.h
index f488145bb2d4..36f49c405dfb 100644
--- a/include/linux/extcon.h
+++ b/include/linux/extcon.h
@@ -185,9 +185,22 @@ struct extcon_specific_cable_nb {
185 */ 185 */
186extern int extcon_dev_register(struct extcon_dev *edev); 186extern int extcon_dev_register(struct extcon_dev *edev);
187extern void extcon_dev_unregister(struct extcon_dev *edev); 187extern void extcon_dev_unregister(struct extcon_dev *edev);
188extern int devm_extcon_dev_register(struct device *dev,
189 struct extcon_dev *edev);
190extern void devm_extcon_dev_unregister(struct device *dev,
191 struct extcon_dev *edev);
188extern struct extcon_dev *extcon_get_extcon_dev(const char *extcon_name); 192extern struct extcon_dev *extcon_get_extcon_dev(const char *extcon_name);
189 193
190/* 194/*
195 * Following APIs control the memory of extcon device.
196 */
197extern struct extcon_dev *extcon_dev_allocate(const char **cables);
198extern void extcon_dev_free(struct extcon_dev *edev);
199extern struct extcon_dev *devm_extcon_dev_allocate(struct device *dev,
200 const char **cables);
201extern void devm_extcon_dev_free(struct device *dev, struct extcon_dev *edev);
202
203/*
191 * get/set/update_state access the 32b encoded state value, which represents 204 * get/set/update_state access the 32b encoded state value, which represents
192 * states of all possible cables of the multistate port. For example, if one 205 * states of all possible cables of the multistate port. For example, if one
193 * calls extcon_set_state(edev, 0x7), it may mean that all the three cables 206 * calls extcon_set_state(edev, 0x7), it may mean that all the three cables
@@ -254,6 +267,30 @@ static inline int extcon_dev_register(struct extcon_dev *edev)
254 267
255static inline void extcon_dev_unregister(struct extcon_dev *edev) { } 268static inline void extcon_dev_unregister(struct extcon_dev *edev) { }
256 269
270static inline int devm_extcon_dev_register(struct device *dev,
271 struct extcon_dev *edev)
272{
273 return -EINVAL;
274}
275
276static inline void devm_extcon_dev_unregister(struct device *dev,
277 struct extcon_dev *edev) { }
278
279static inline struct extcon_dev *extcon_dev_allocate(const char **cables)
280{
281 return ERR_PTR(-ENOSYS);
282}
283
284static inline void extcon_dev_free(struct extcon_dev *edev) { }
285
286static inline struct extcon_dev *devm_extcon_dev_allocate(struct device *dev,
287 const char **cables)
288{
289 return ERR_PTR(-ENOSYS);
290}
291
292static inline void devm_extcon_dev_free(struct extcon_dev *edev) { }
293
257static inline u32 extcon_get_state(struct extcon_dev *edev) 294static inline u32 extcon_get_state(struct extcon_dev *edev)
258{ 295{
259 return 0; 296 return 0;
diff --git a/include/linux/fb.h b/include/linux/fb.h
index fe6ac956550e..b6bfda99add3 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -47,6 +47,7 @@ struct device_node;
47 47
48#define FB_MISC_PRIM_COLOR 1 48#define FB_MISC_PRIM_COLOR 1
49#define FB_MISC_1ST_DETAIL 2 /* First Detailed Timing is preferred */ 49#define FB_MISC_1ST_DETAIL 2 /* First Detailed Timing is preferred */
50#define FB_MISC_HDMI 4
50struct fb_chroma { 51struct fb_chroma {
51 __u32 redx; /* in fraction of 1024 */ 52 __u32 redx; /* in fraction of 1024 */
52 __u32 greenx; 53 __u32 greenx;
@@ -641,7 +642,7 @@ static inline void unlock_fb_info(struct fb_info *info)
641static inline void __fb_pad_aligned_buffer(u8 *dst, u32 d_pitch, 642static inline void __fb_pad_aligned_buffer(u8 *dst, u32 d_pitch,
642 u8 *src, u32 s_pitch, u32 height) 643 u8 *src, u32 s_pitch, u32 height)
643{ 644{
644 int i, j; 645 u32 i, j;
645 646
646 d_pitch -= s_pitch; 647 d_pitch -= s_pitch;
647 648
diff --git a/include/linux/firewire.h b/include/linux/firewire.h
index c3683bdf28fe..d4b7683c722d 100644
--- a/include/linux/firewire.h
+++ b/include/linux/firewire.h
@@ -367,6 +367,9 @@ static inline int fw_stream_packet_destination_id(int tag, int channel, int sy)
367 return tag << 14 | channel << 8 | sy; 367 return tag << 14 | channel << 8 | sy;
368} 368}
369 369
370void fw_schedule_bus_reset(struct fw_card *card, bool delayed,
371 bool short_reset);
372
370struct fw_descriptor { 373struct fw_descriptor {
371 struct list_head link; 374 struct list_head link;
372 size_t length; 375 size_t length;
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 878031227c57..c3f46e499dd0 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -2590,6 +2590,7 @@ extern ssize_t simple_read_from_buffer(void __user *to, size_t count,
2590extern ssize_t simple_write_to_buffer(void *to, size_t available, loff_t *ppos, 2590extern ssize_t simple_write_to_buffer(void *to, size_t available, loff_t *ppos,
2591 const void __user *from, size_t count); 2591 const void __user *from, size_t count);
2592 2592
2593extern int __generic_file_fsync(struct file *, loff_t, loff_t, int);
2593extern int generic_file_fsync(struct file *, loff_t, loff_t, int); 2594extern int generic_file_fsync(struct file *, loff_t, loff_t, int);
2594 2595
2595extern int generic_check_addressable(unsigned, u64); 2596extern int generic_check_addressable(unsigned, u64);
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index ae9504b4b67d..2018751cad9e 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -616,25 +616,27 @@ static inline void __ftrace_enabled_restore(int enabled)
616#endif 616#endif
617} 617}
618 618
619#ifndef HAVE_ARCH_CALLER_ADDR 619/* All archs should have this, but we define it for consistency */
620#ifndef ftrace_return_address0
621# define ftrace_return_address0 __builtin_return_address(0)
622#endif
623
624/* Archs may use other ways for ADDR1 and beyond */
625#ifndef ftrace_return_address
620# ifdef CONFIG_FRAME_POINTER 626# ifdef CONFIG_FRAME_POINTER
621# define CALLER_ADDR0 ((unsigned long)__builtin_return_address(0)) 627# define ftrace_return_address(n) __builtin_return_address(n)
622# define CALLER_ADDR1 ((unsigned long)__builtin_return_address(1))
623# define CALLER_ADDR2 ((unsigned long)__builtin_return_address(2))
624# define CALLER_ADDR3 ((unsigned long)__builtin_return_address(3))
625# define CALLER_ADDR4 ((unsigned long)__builtin_return_address(4))
626# define CALLER_ADDR5 ((unsigned long)__builtin_return_address(5))
627# define CALLER_ADDR6 ((unsigned long)__builtin_return_address(6))
628# else 628# else
629# define CALLER_ADDR0 ((unsigned long)__builtin_return_address(0)) 629# define ftrace_return_address(n) 0UL
630# define CALLER_ADDR1 0UL
631# define CALLER_ADDR2 0UL
632# define CALLER_ADDR3 0UL
633# define CALLER_ADDR4 0UL
634# define CALLER_ADDR5 0UL
635# define CALLER_ADDR6 0UL
636# endif 630# endif
637#endif /* ifndef HAVE_ARCH_CALLER_ADDR */ 631#endif
632
633#define CALLER_ADDR0 ((unsigned long)ftrace_return_address0)
634#define CALLER_ADDR1 ((unsigned long)ftrace_return_address(1))
635#define CALLER_ADDR2 ((unsigned long)ftrace_return_address(2))
636#define CALLER_ADDR3 ((unsigned long)ftrace_return_address(3))
637#define CALLER_ADDR4 ((unsigned long)ftrace_return_address(4))
638#define CALLER_ADDR5 ((unsigned long)ftrace_return_address(5))
639#define CALLER_ADDR6 ((unsigned long)ftrace_return_address(6))
638 640
639#ifdef CONFIG_IRQSOFF_TRACER 641#ifdef CONFIG_IRQSOFF_TRACER
640 extern void time_hardirqs_on(unsigned long a0, unsigned long a1); 642 extern void time_hardirqs_on(unsigned long a0, unsigned long a1);
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 9f3c275e053e..ec274e0f4ed2 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -649,7 +649,7 @@ static inline void hd_ref_init(struct hd_struct *part)
649static inline void hd_struct_get(struct hd_struct *part) 649static inline void hd_struct_get(struct hd_struct *part)
650{ 650{
651 atomic_inc(&part->ref); 651 atomic_inc(&part->ref);
652 smp_mb__after_atomic_inc(); 652 smp_mb__after_atomic();
653} 653}
654 654
655static inline int hd_struct_try_get(struct hd_struct *part) 655static inline int hd_struct_try_get(struct hd_struct *part)
diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index 39b81dc7d01a..6eb1fb37de9a 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -6,7 +6,6 @@
6#include <linux/stddef.h> 6#include <linux/stddef.h>
7#include <linux/linkage.h> 7#include <linux/linkage.h>
8#include <linux/topology.h> 8#include <linux/topology.h>
9#include <linux/mmdebug.h>
10 9
11struct vm_area_struct; 10struct vm_area_struct;
12 11
@@ -31,7 +30,6 @@ struct vm_area_struct;
31#define ___GFP_HARDWALL 0x20000u 30#define ___GFP_HARDWALL 0x20000u
32#define ___GFP_THISNODE 0x40000u 31#define ___GFP_THISNODE 0x40000u
33#define ___GFP_RECLAIMABLE 0x80000u 32#define ___GFP_RECLAIMABLE 0x80000u
34#define ___GFP_KMEMCG 0x100000u
35#define ___GFP_NOTRACK 0x200000u 33#define ___GFP_NOTRACK 0x200000u
36#define ___GFP_NO_KSWAPD 0x400000u 34#define ___GFP_NO_KSWAPD 0x400000u
37#define ___GFP_OTHER_NODE 0x800000u 35#define ___GFP_OTHER_NODE 0x800000u
@@ -91,7 +89,6 @@ struct vm_area_struct;
91 89
92#define __GFP_NO_KSWAPD ((__force gfp_t)___GFP_NO_KSWAPD) 90#define __GFP_NO_KSWAPD ((__force gfp_t)___GFP_NO_KSWAPD)
93#define __GFP_OTHER_NODE ((__force gfp_t)___GFP_OTHER_NODE) /* On behalf of other node */ 91#define __GFP_OTHER_NODE ((__force gfp_t)___GFP_OTHER_NODE) /* On behalf of other node */
94#define __GFP_KMEMCG ((__force gfp_t)___GFP_KMEMCG) /* Allocation comes from a memcg-accounted resource */
95#define __GFP_WRITE ((__force gfp_t)___GFP_WRITE) /* Allocator intends to dirty page */ 92#define __GFP_WRITE ((__force gfp_t)___GFP_WRITE) /* Allocator intends to dirty page */
96 93
97/* 94/*
@@ -353,6 +350,10 @@ extern struct page *alloc_pages_vma(gfp_t gfp_mask, int order,
353#define alloc_page_vma_node(gfp_mask, vma, addr, node) \ 350#define alloc_page_vma_node(gfp_mask, vma, addr, node) \
354 alloc_pages_vma(gfp_mask, 0, vma, addr, node) 351 alloc_pages_vma(gfp_mask, 0, vma, addr, node)
355 352
353extern struct page *alloc_kmem_pages(gfp_t gfp_mask, unsigned int order);
354extern struct page *alloc_kmem_pages_node(int nid, gfp_t gfp_mask,
355 unsigned int order);
356
356extern unsigned long __get_free_pages(gfp_t gfp_mask, unsigned int order); 357extern unsigned long __get_free_pages(gfp_t gfp_mask, unsigned int order);
357extern unsigned long get_zeroed_page(gfp_t gfp_mask); 358extern unsigned long get_zeroed_page(gfp_t gfp_mask);
358 359
@@ -369,11 +370,11 @@ void *alloc_pages_exact_nid(int nid, size_t size, gfp_t gfp_mask);
369 370
370extern void __free_pages(struct page *page, unsigned int order); 371extern void __free_pages(struct page *page, unsigned int order);
371extern void free_pages(unsigned long addr, unsigned int order); 372extern void free_pages(unsigned long addr, unsigned int order);
372extern void free_hot_cold_page(struct page *page, int cold); 373extern void free_hot_cold_page(struct page *page, bool cold);
373extern void free_hot_cold_page_list(struct list_head *list, int cold); 374extern void free_hot_cold_page_list(struct list_head *list, bool cold);
374 375
375extern void __free_memcg_kmem_pages(struct page *page, unsigned int order); 376extern void __free_kmem_pages(struct page *page, unsigned int order);
376extern void free_memcg_kmem_pages(unsigned long addr, unsigned int order); 377extern void free_kmem_pages(unsigned long addr, unsigned int order);
377 378
378#define __free_page(page) __free_pages((page), 0) 379#define __free_page(page) __free_pages((page), 0)
379#define free_page(addr) free_pages((addr), 0) 380#define free_page(addr) free_pages((addr), 0)
diff --git a/include/linux/goldfish.h b/include/linux/goldfish.h
new file mode 100644
index 000000000000..569236e6b2bc
--- /dev/null
+++ b/include/linux/goldfish.h
@@ -0,0 +1,15 @@
1#ifndef __LINUX_GOLDFISH_H
2#define __LINUX_GOLDFISH_H
3
4/* Helpers for Goldfish virtual platform */
5
6static inline void gf_write64(unsigned long data,
7 void __iomem *portl, void __iomem *porth)
8{
9 writel((u32)data, portl);
10#ifdef CONFIG_64BIT
11 writel(data>>32, porth);
12#endif
13}
14
15#endif /* __LINUX_GOLDFISH_H */
diff --git a/include/linux/gpio/consumer.h b/include/linux/gpio/consumer.h
index bed128e8f4b1..05e53ccb708b 100644
--- a/include/linux/gpio/consumer.h
+++ b/include/linux/gpio/consumer.h
@@ -1,6 +1,7 @@
1#ifndef __LINUX_GPIO_CONSUMER_H 1#ifndef __LINUX_GPIO_CONSUMER_H
2#define __LINUX_GPIO_CONSUMER_H 2#define __LINUX_GPIO_CONSUMER_H
3 3
4#include <linux/bug.h>
4#include <linux/err.h> 5#include <linux/err.h>
5#include <linux/kernel.h> 6#include <linux/kernel.h>
6 7
@@ -23,6 +24,12 @@ struct gpio_desc *__must_check gpiod_get(struct device *dev,
23struct gpio_desc *__must_check gpiod_get_index(struct device *dev, 24struct gpio_desc *__must_check gpiod_get_index(struct device *dev,
24 const char *con_id, 25 const char *con_id,
25 unsigned int idx); 26 unsigned int idx);
27struct gpio_desc *__must_check gpiod_get_optional(struct device *dev,
28 const char *con_id);
29struct gpio_desc *__must_check gpiod_get_index_optional(struct device *dev,
30 const char *con_id,
31 unsigned int index);
32
26void gpiod_put(struct gpio_desc *desc); 33void gpiod_put(struct gpio_desc *desc);
27 34
28struct gpio_desc *__must_check devm_gpiod_get(struct device *dev, 35struct gpio_desc *__must_check devm_gpiod_get(struct device *dev,
@@ -30,6 +37,12 @@ struct gpio_desc *__must_check devm_gpiod_get(struct device *dev,
30struct gpio_desc *__must_check devm_gpiod_get_index(struct device *dev, 37struct gpio_desc *__must_check devm_gpiod_get_index(struct device *dev,
31 const char *con_id, 38 const char *con_id,
32 unsigned int idx); 39 unsigned int idx);
40struct gpio_desc *__must_check devm_gpiod_get_optional(struct device *dev,
41 const char *con_id);
42struct gpio_desc *__must_check
43devm_gpiod_get_index_optional(struct device *dev, const char *con_id,
44 unsigned int index);
45
33void devm_gpiod_put(struct device *dev, struct gpio_desc *desc); 46void devm_gpiod_put(struct device *dev, struct gpio_desc *desc);
34 47
35int gpiod_get_direction(const struct gpio_desc *desc); 48int gpiod_get_direction(const struct gpio_desc *desc);
@@ -73,6 +86,20 @@ static inline struct gpio_desc *__must_check gpiod_get_index(struct device *dev,
73{ 86{
74 return ERR_PTR(-ENOSYS); 87 return ERR_PTR(-ENOSYS);
75} 88}
89
90static inline struct gpio_desc *__must_check
91gpiod_get_optional(struct device *dev, const char *con_id)
92{
93 return ERR_PTR(-ENOSYS);
94}
95
96static inline struct gpio_desc *__must_check
97gpiod_get_index_optional(struct device *dev, const char *con_id,
98 unsigned int index)
99{
100 return ERR_PTR(-ENOSYS);
101}
102
76static inline void gpiod_put(struct gpio_desc *desc) 103static inline void gpiod_put(struct gpio_desc *desc)
77{ 104{
78 might_sleep(); 105 might_sleep();
@@ -93,6 +120,20 @@ struct gpio_desc *__must_check devm_gpiod_get_index(struct device *dev,
93{ 120{
94 return ERR_PTR(-ENOSYS); 121 return ERR_PTR(-ENOSYS);
95} 122}
123
124static inline struct gpio_desc *__must_check
125devm_gpiod_get_optional(struct device *dev, const char *con_id)
126{
127 return ERR_PTR(-ENOSYS);
128}
129
130static inline struct gpio_desc *__must_check
131devm_gpiod_get_index_optional(struct device *dev, const char *con_id,
132 unsigned int index)
133{
134 return ERR_PTR(-ENOSYS);
135}
136
96static inline void devm_gpiod_put(struct device *dev, struct gpio_desc *desc) 137static inline void devm_gpiod_put(struct device *dev, struct gpio_desc *desc)
97{ 138{
98 might_sleep(); 139 might_sleep();
diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h
index 1827b43966d9..573e4f3243d0 100644
--- a/include/linux/gpio/driver.h
+++ b/include/linux/gpio/driver.h
@@ -51,7 +51,10 @@ struct seq_file;
51 * format specifier for an unsigned int. It is substituted by the actual 51 * format specifier for an unsigned int. It is substituted by the actual
52 * number of the gpio. 52 * number of the gpio.
53 * @can_sleep: flag must be set iff get()/set() methods sleep, as they 53 * @can_sleep: flag must be set iff get()/set() methods sleep, as they
54 * must while accessing GPIO expander chips over I2C or SPI 54 * must while accessing GPIO expander chips over I2C or SPI. This
55 * implies that if the chip supports IRQs, these IRQs need to be threaded
56 * as the chip access may sleep when e.g. reading out the IRQ status
57 * registers.
55 * @exported: flags if the gpiochip is exported for use from sysfs. Private. 58 * @exported: flags if the gpiochip is exported for use from sysfs. Private.
56 * 59 *
57 * A gpio_chip can help platforms abstract various sources of GPIOs so 60 * A gpio_chip can help platforms abstract various sources of GPIOs so
diff --git a/include/linux/hid-sensor-hub.h b/include/linux/hid-sensor-hub.h
index b70cfd7ff29c..51f7ccadf923 100644
--- a/include/linux/hid-sensor-hub.h
+++ b/include/linux/hid-sensor-hub.h
@@ -189,7 +189,7 @@ struct hid_sensor_common {
189 struct hid_sensor_hub_device *hsdev; 189 struct hid_sensor_hub_device *hsdev;
190 struct platform_device *pdev; 190 struct platform_device *pdev;
191 unsigned usage_id; 191 unsigned usage_id;
192 bool data_ready; 192 atomic_t data_ready;
193 struct iio_trigger *trigger; 193 struct iio_trigger *trigger;
194 struct hid_sensor_hub_attribute_info poll; 194 struct hid_sensor_hub_attribute_info poll;
195 struct hid_sensor_hub_attribute_info report_state; 195 struct hid_sensor_hub_attribute_info report_state;
@@ -223,4 +223,10 @@ int hid_sensor_read_samp_freq_value(struct hid_sensor_common *st,
223int hid_sensor_get_usage_index(struct hid_sensor_hub_device *hsdev, 223int hid_sensor_get_usage_index(struct hid_sensor_hub_device *hsdev,
224 u32 report_id, int field_index, u32 usage_id); 224 u32 report_id, int field_index, u32 usage_id);
225 225
226int hid_sensor_format_scale(u32 usage_id,
227 struct hid_sensor_hub_attribute_info *attr_info,
228 int *val0, int *val1);
229
230s32 hid_sensor_read_poll_value(struct hid_sensor_common *st);
231
226#endif 232#endif
diff --git a/include/linux/hid-sensor-ids.h b/include/linux/hid-sensor-ids.h
index 14ead9e8eda8..109f0e633e01 100644
--- a/include/linux/hid-sensor-ids.h
+++ b/include/linux/hid-sensor-ids.h
@@ -76,6 +76,7 @@
76#define HID_USAGE_SENSOR_ORIENT_TILT_Y 0x200480 76#define HID_USAGE_SENSOR_ORIENT_TILT_Y 0x200480
77#define HID_USAGE_SENSOR_ORIENT_TILT_Z 0x200481 77#define HID_USAGE_SENSOR_ORIENT_TILT_Z 0x200481
78 78
79#define HID_USAGE_SENSOR_DEVICE_ORIENTATION 0x20008A
79#define HID_USAGE_SENSOR_ORIENT_ROTATION_MATRIX 0x200482 80#define HID_USAGE_SENSOR_ORIENT_ROTATION_MATRIX 0x200482
80#define HID_USAGE_SENSOR_ORIENT_QUATERNION 0x200483 81#define HID_USAGE_SENSOR_ORIENT_QUATERNION 0x200483
81#define HID_USAGE_SENSOR_ORIENT_MAGN_FLUX 0x200484 82#define HID_USAGE_SENSOR_ORIENT_MAGN_FLUX 0x200484
diff --git a/include/linux/hid.h b/include/linux/hid.h
index 720e3a10608c..77632cf159c0 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -233,11 +233,6 @@ struct hid_item {
233#define HID_DG_BARRELSWITCH 0x000d0044 233#define HID_DG_BARRELSWITCH 0x000d0044
234#define HID_DG_ERASER 0x000d0045 234#define HID_DG_ERASER 0x000d0045
235#define HID_DG_TABLETPICK 0x000d0046 235#define HID_DG_TABLETPICK 0x000d0046
236/*
237 * as of May 20, 2009 the usages below are not yet in the official USB spec
238 * but are being pushed by Microsft as described in their paper "Digitizer
239 * Drivers for Windows Touch and Pen-Based Computers"
240 */
241#define HID_DG_CONFIDENCE 0x000d0047 236#define HID_DG_CONFIDENCE 0x000d0047
242#define HID_DG_WIDTH 0x000d0048 237#define HID_DG_WIDTH 0x000d0048
243#define HID_DG_HEIGHT 0x000d0049 238#define HID_DG_HEIGHT 0x000d0049
@@ -246,6 +241,8 @@ struct hid_item {
246#define HID_DG_DEVICEINDEX 0x000d0053 241#define HID_DG_DEVICEINDEX 0x000d0053
247#define HID_DG_CONTACTCOUNT 0x000d0054 242#define HID_DG_CONTACTCOUNT 0x000d0054
248#define HID_DG_CONTACTMAX 0x000d0055 243#define HID_DG_CONTACTMAX 0x000d0055
244#define HID_DG_BARRELSWITCH2 0x000d005a
245#define HID_DG_TOOLSERIALNUMBER 0x000d005b
249 246
250/* 247/*
251 * HID report types --- Ouch! HID spec says 1 2 3! 248 * HID report types --- Ouch! HID spec says 1 2 3!
@@ -299,6 +296,9 @@ struct hid_item {
299 296
300/* 297/*
301 * HID device groups 298 * HID device groups
299 *
300 * Note: HID_GROUP_ANY is declared in linux/mod_devicetable.h
301 * and has a value of 0x0000
302 */ 302 */
303#define HID_GROUP_GENERIC 0x0001 303#define HID_GROUP_GENERIC 0x0001
304#define HID_GROUP_MULTITOUCH 0x0002 304#define HID_GROUP_MULTITOUCH 0x0002
@@ -306,6 +306,11 @@ struct hid_item {
306#define HID_GROUP_MULTITOUCH_WIN_8 0x0004 306#define HID_GROUP_MULTITOUCH_WIN_8 0x0004
307 307
308/* 308/*
309 * Vendor specific HID device groups
310 */
311#define HID_GROUP_RMI 0x0100
312
313/*
309 * This is the global environment of the parser. This information is 314 * This is the global environment of the parser. This information is
310 * persistent for main-items. The global environment can be saved and 315 * persistent for main-items. The global environment can be saved and
311 * restored with PUSH/POP statements. 316 * restored with PUSH/POP statements.
@@ -570,6 +575,8 @@ struct hid_descriptor {
570 .bus = BUS_USB, .vendor = (ven), .product = (prod) 575 .bus = BUS_USB, .vendor = (ven), .product = (prod)
571#define HID_BLUETOOTH_DEVICE(ven, prod) \ 576#define HID_BLUETOOTH_DEVICE(ven, prod) \
572 .bus = BUS_BLUETOOTH, .vendor = (ven), .product = (prod) 577 .bus = BUS_BLUETOOTH, .vendor = (ven), .product = (prod)
578#define HID_I2C_DEVICE(ven, prod) \
579 .bus = BUS_I2C, .vendor = (ven), .product = (prod)
573 580
574#define HID_REPORT_ID(rep) \ 581#define HID_REPORT_ID(rep) \
575 .report_type = (rep) 582 .report_type = (rep)
diff --git a/include/linux/hsi/hsi.h b/include/linux/hsi/hsi.h
index 39bfd5b89077..3ec06300d535 100644
--- a/include/linux/hsi/hsi.h
+++ b/include/linux/hsi/hsi.h
@@ -68,17 +68,31 @@ enum {
68}; 68};
69 69
70/** 70/**
71 * struct hsi_channel - channel resource used by the hsi clients
72 * @id: Channel number
73 * @name: Channel name
74 */
75struct hsi_channel {
76 unsigned int id;
77 const char *name;
78};
79
80/**
71 * struct hsi_config - Configuration for RX/TX HSI modules 81 * struct hsi_config - Configuration for RX/TX HSI modules
72 * @mode: Bit transmission mode (STREAM or FRAME) 82 * @mode: Bit transmission mode (STREAM or FRAME)
73 * @channels: Number of channels to use [1..16] 83 * @channels: Channel resources used by the client
84 * @num_channels: Number of channel resources
85 * @num_hw_channels: Number of channels the transceiver is configured for [1..16]
74 * @speed: Max bit transmission speed (Kbit/s) 86 * @speed: Max bit transmission speed (Kbit/s)
75 * @flow: RX flow type (SYNCHRONIZED or PIPELINE) 87 * @flow: RX flow type (SYNCHRONIZED or PIPELINE)
76 * @arb_mode: Arbitration mode for TX frame (Round robin, priority) 88 * @arb_mode: Arbitration mode for TX frame (Round robin, priority)
77 */ 89 */
78struct hsi_config { 90struct hsi_config {
79 unsigned int mode; 91 unsigned int mode;
80 unsigned int channels; 92 struct hsi_channel *channels;
81 unsigned int speed; 93 unsigned int num_channels;
94 unsigned int num_hw_channels;
95 unsigned int speed;
82 union { 96 union {
83 unsigned int flow; /* RX only */ 97 unsigned int flow; /* RX only */
84 unsigned int arb_mode; /* TX only */ 98 unsigned int arb_mode; /* TX only */
@@ -282,6 +296,21 @@ struct hsi_controller *hsi_alloc_controller(unsigned int n_ports, gfp_t flags);
282void hsi_put_controller(struct hsi_controller *hsi); 296void hsi_put_controller(struct hsi_controller *hsi);
283int hsi_register_controller(struct hsi_controller *hsi); 297int hsi_register_controller(struct hsi_controller *hsi);
284void hsi_unregister_controller(struct hsi_controller *hsi); 298void hsi_unregister_controller(struct hsi_controller *hsi);
299struct hsi_client *hsi_new_client(struct hsi_port *port,
300 struct hsi_board_info *info);
301int hsi_remove_client(struct device *dev, void *data);
302void hsi_port_unregister_clients(struct hsi_port *port);
303
304#ifdef CONFIG_OF
305void hsi_add_clients_from_dt(struct hsi_port *port,
306 struct device_node *clients);
307#else
308static inline void hsi_add_clients_from_dt(struct hsi_port *port,
309 struct device_node *clients)
310{
311 return;
312}
313#endif
285 314
286static inline void hsi_controller_set_drvdata(struct hsi_controller *hsi, 315static inline void hsi_controller_set_drvdata(struct hsi_controller *hsi,
287 void *data) 316 void *data)
@@ -305,6 +334,8 @@ static inline struct hsi_port *hsi_find_port_num(struct hsi_controller *hsi,
305 */ 334 */
306int hsi_async(struct hsi_client *cl, struct hsi_msg *msg); 335int hsi_async(struct hsi_client *cl, struct hsi_msg *msg);
307 336
337int hsi_get_channel_id_by_name(struct hsi_client *cl, char *name);
338
308/** 339/**
309 * hsi_id - Get HSI controller ID associated to a client 340 * hsi_id - Get HSI controller ID associated to a client
310 * @cl: Pointer to a HSI client 341 * @cl: Pointer to a HSI client
diff --git a/include/linux/hsi/ssi_protocol.h b/include/linux/hsi/ssi_protocol.h
new file mode 100644
index 000000000000..1433651be0dc
--- /dev/null
+++ b/include/linux/hsi/ssi_protocol.h
@@ -0,0 +1,42 @@
1/*
2 * ssip_slave.h
3 *
4 * SSIP slave support header file
5 *
6 * Copyright (C) 2010 Nokia Corporation. All rights reserved.
7 *
8 * Contact: Carlos Chinea <carlos.chinea@nokia.com>
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * version 2 as published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
22 * 02110-1301 USA
23 */
24
25#ifndef __LINUX_SSIP_SLAVE_H__
26#define __LINUX_SSIP_SLAVE_H__
27
28#include <linux/hsi/hsi.h>
29
30static inline void ssip_slave_put_master(struct hsi_client *master)
31{
32}
33
34struct hsi_client *ssip_slave_get_master(struct hsi_client *slave);
35int ssip_slave_start_tx(struct hsi_client *master);
36int ssip_slave_stop_tx(struct hsi_client *master);
37void ssip_reset_event(struct hsi_client *master);
38
39int ssip_slave_running(struct hsi_client *master);
40
41#endif /* __LINUX_SSIP_SLAVE_H__ */
42
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index b65166de1d9d..255cd5cc0754 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -343,6 +343,11 @@ static inline unsigned huge_page_shift(struct hstate *h)
343 return h->order + PAGE_SHIFT; 343 return h->order + PAGE_SHIFT;
344} 344}
345 345
346static inline bool hstate_is_gigantic(struct hstate *h)
347{
348 return huge_page_order(h) >= MAX_ORDER;
349}
350
346static inline unsigned int pages_per_huge_page(struct hstate *h) 351static inline unsigned int pages_per_huge_page(struct hstate *h)
347{ 352{
348 return 1 << h->order; 353 return 1 << h->order;
@@ -392,15 +397,13 @@ static inline pgoff_t basepage_index(struct page *page)
392 397
393extern void dissolve_free_huge_pages(unsigned long start_pfn, 398extern void dissolve_free_huge_pages(unsigned long start_pfn,
394 unsigned long end_pfn); 399 unsigned long end_pfn);
395int pmd_huge_support(void); 400static inline int hugepage_migration_supported(struct hstate *h)
396/*
397 * Currently hugepage migration is enabled only for pmd-based hugepage.
398 * This function will be updated when hugepage migration is more widely
399 * supported.
400 */
401static inline int hugepage_migration_support(struct hstate *h)
402{ 401{
403 return pmd_huge_support() && (huge_page_shift(h) == PMD_SHIFT); 402#ifdef CONFIG_ARCH_ENABLE_HUGEPAGE_MIGRATION
403 return huge_page_shift(h) == PMD_SHIFT;
404#else
405 return 0;
406#endif
404} 407}
405 408
406static inline spinlock_t *huge_pte_lockptr(struct hstate *h, 409static inline spinlock_t *huge_pte_lockptr(struct hstate *h,
@@ -450,8 +453,7 @@ static inline pgoff_t basepage_index(struct page *page)
450 return page->index; 453 return page->index;
451} 454}
452#define dissolve_free_huge_pages(s, e) do {} while (0) 455#define dissolve_free_huge_pages(s, e) do {} while (0)
453#define pmd_huge_support() 0 456#define hugepage_migration_supported(h) 0
454#define hugepage_migration_support(h) 0
455 457
456static inline spinlock_t *huge_pte_lockptr(struct hstate *h, 458static inline spinlock_t *huge_pte_lockptr(struct hstate *h,
457 struct mm_struct *mm, pte_t *pte) 459 struct mm_struct *mm, pte_t *pte)
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index 2d7b4f139c32..08cfaff8a072 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -696,6 +696,8 @@ struct vmbus_channel {
696 * preserve the earlier behavior. 696 * preserve the earlier behavior.
697 */ 697 */
698 u32 target_vp; 698 u32 target_vp;
699 /* The corresponding CPUID in the guest */
700 u32 target_cpu;
699 /* 701 /*
700 * Support for sub-channels. For high performance devices, 702 * Support for sub-channels. For high performance devices,
701 * it will be useful to have multiple sub-channels to support 703 * it will be useful to have multiple sub-channels to support
@@ -732,6 +734,11 @@ struct vmbus_channel {
732 * Support per-channel state for use by vmbus drivers. 734 * Support per-channel state for use by vmbus drivers.
733 */ 735 */
734 void *per_channel_state; 736 void *per_channel_state;
737 /*
738 * To support per-cpu lookup mapping of relid to channel,
739 * link up channels based on their CPU affinity.
740 */
741 struct list_head percpu_list;
735}; 742};
736 743
737static inline void set_channel_read_state(struct vmbus_channel *c, bool state) 744static inline void set_channel_read_state(struct vmbus_channel *c, bool state)
diff --git a/include/linux/idr.h b/include/linux/idr.h
index 6af3400b9b2f..013fd9bc4cb6 100644
--- a/include/linux/idr.h
+++ b/include/linux/idr.h
@@ -29,21 +29,24 @@
29 29
30struct idr_layer { 30struct idr_layer {
31 int prefix; /* the ID prefix of this idr_layer */ 31 int prefix; /* the ID prefix of this idr_layer */
32 DECLARE_BITMAP(bitmap, IDR_SIZE); /* A zero bit means "space here" */ 32 int layer; /* distance from leaf */
33 struct idr_layer __rcu *ary[1<<IDR_BITS]; 33 struct idr_layer __rcu *ary[1<<IDR_BITS];
34 int count; /* When zero, we can release it */ 34 int count; /* When zero, we can release it */
35 int layer; /* distance from leaf */ 35 union {
36 struct rcu_head rcu_head; 36 /* A zero bit means "space here" */
37 DECLARE_BITMAP(bitmap, IDR_SIZE);
38 struct rcu_head rcu_head;
39 };
37}; 40};
38 41
39struct idr { 42struct idr {
40 struct idr_layer __rcu *hint; /* the last layer allocated from */ 43 struct idr_layer __rcu *hint; /* the last layer allocated from */
41 struct idr_layer __rcu *top; 44 struct idr_layer __rcu *top;
42 struct idr_layer *id_free;
43 int layers; /* only valid w/o concurrent changes */ 45 int layers; /* only valid w/o concurrent changes */
44 int id_free_cnt;
45 int cur; /* current pos for cyclic allocation */ 46 int cur; /* current pos for cyclic allocation */
46 spinlock_t lock; 47 spinlock_t lock;
48 int id_free_cnt;
49 struct idr_layer *id_free;
47}; 50};
48 51
49#define IDR_INIT(name) \ 52#define IDR_INIT(name) \
diff --git a/include/linux/iio/common/st_sensors.h b/include/linux/iio/common/st_sensors.h
index 3c005eb3a0a4..96f51f0e0096 100644
--- a/include/linux/iio/common/st_sensors.h
+++ b/include/linux/iio/common/st_sensors.h
@@ -269,6 +269,10 @@ int st_sensors_set_enable(struct iio_dev *indio_dev, bool enable);
269 269
270int st_sensors_set_axis_enable(struct iio_dev *indio_dev, u8 axis_enable); 270int st_sensors_set_axis_enable(struct iio_dev *indio_dev, u8 axis_enable);
271 271
272void st_sensors_power_enable(struct iio_dev *indio_dev);
273
274void st_sensors_power_disable(struct iio_dev *indio_dev);
275
272int st_sensors_set_odr(struct iio_dev *indio_dev, unsigned int odr); 276int st_sensors_set_odr(struct iio_dev *indio_dev, unsigned int odr);
273 277
274int st_sensors_set_dataready_irq(struct iio_dev *indio_dev, bool enable); 278int st_sensors_set_dataready_irq(struct iio_dev *indio_dev, bool enable);
diff --git a/include/linux/iio/consumer.h b/include/linux/iio/consumer.h
index 2752b1fd12be..651f9a0e2765 100644
--- a/include/linux/iio/consumer.h
+++ b/include/linux/iio/consumer.h
@@ -123,6 +123,19 @@ int iio_read_channel_raw(struct iio_channel *chan,
123 int *val); 123 int *val);
124 124
125/** 125/**
126 * iio_read_channel_average_raw() - read from a given channel
127 * @chan: The channel being queried.
128 * @val: Value read back.
129 *
130 * Note raw reads from iio channels are in adc counts and hence
131 * scale will need to be applied if standard units required.
132 *
133 * In opposit to the normal iio_read_channel_raw this function
134 * returns the average of multiple reads.
135 */
136int iio_read_channel_average_raw(struct iio_channel *chan, int *val);
137
138/**
126 * iio_read_channel_processed() - read processed value from a given channel 139 * iio_read_channel_processed() - read processed value from a given channel
127 * @chan: The channel being queried. 140 * @chan: The channel being queried.
128 * @val: Value read back. 141 * @val: Value read back.
diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h
index 5f2d00e7e488..ccde91725f98 100644
--- a/include/linux/iio/iio.h
+++ b/include/linux/iio/iio.h
@@ -177,6 +177,12 @@ struct iio_event_spec {
177 * shift: Shift right by this before masking out 177 * shift: Shift right by this before masking out
178 * realbits. 178 * realbits.
179 * endianness: little or big endian 179 * endianness: little or big endian
180 * repeat: Number of times real/storage bits
181 * repeats. When the repeat element is
182 * more than 1, then the type element in
183 * sysfs will show a repeat value.
184 * Otherwise, the number of repetitions is
185 * omitted.
180 * @info_mask_separate: What information is to be exported that is specific to 186 * @info_mask_separate: What information is to be exported that is specific to
181 * this channel. 187 * this channel.
182 * @info_mask_shared_by_type: What information is to be exported that is shared 188 * @info_mask_shared_by_type: What information is to be exported that is shared
@@ -219,6 +225,7 @@ struct iio_chan_spec {
219 u8 realbits; 225 u8 realbits;
220 u8 storagebits; 226 u8 storagebits;
221 u8 shift; 227 u8 shift;
228 u8 repeat;
222 enum iio_endian endianness; 229 enum iio_endian endianness;
223 } scan_type; 230 } scan_type;
224 long info_mask_separate; 231 long info_mask_separate;
@@ -288,6 +295,8 @@ static inline s64 iio_get_time_ns(void)
288#define INDIO_ALL_BUFFER_MODES \ 295#define INDIO_ALL_BUFFER_MODES \
289 (INDIO_BUFFER_TRIGGERED | INDIO_BUFFER_HARDWARE) 296 (INDIO_BUFFER_TRIGGERED | INDIO_BUFFER_HARDWARE)
290 297
298#define INDIO_MAX_RAW_ELEMENTS 4
299
291struct iio_trigger; /* forward declaration */ 300struct iio_trigger; /* forward declaration */
292struct iio_dev; 301struct iio_dev;
293 302
@@ -302,6 +311,14 @@ struct iio_dev;
302 * the channel in question. Return value will specify the 311 * the channel in question. Return value will specify the
303 * type of value returned by the device. val and val2 will 312 * type of value returned by the device. val and val2 will
304 * contain the elements making up the returned value. 313 * contain the elements making up the returned value.
314 * @read_raw_multi: function to return values from the device.
315 * mask specifies which value. Note 0 means a reading of
316 * the channel in question. Return value will specify the
317 * type of value returned by the device. vals pointer
318 * contain the elements making up the returned value.
319 * max_len specifies maximum number of elements
320 * vals pointer can contain. val_len is used to return
321 * length of valid elements in vals.
305 * @write_raw: function to write a value to the device. 322 * @write_raw: function to write a value to the device.
306 * Parameters are the same as for read_raw. 323 * Parameters are the same as for read_raw.
307 * @write_raw_get_fmt: callback function to query the expected 324 * @write_raw_get_fmt: callback function to query the expected
@@ -328,6 +345,13 @@ struct iio_info {
328 int *val2, 345 int *val2,
329 long mask); 346 long mask);
330 347
348 int (*read_raw_multi)(struct iio_dev *indio_dev,
349 struct iio_chan_spec const *chan,
350 int max_len,
351 int *vals,
352 int *val_len,
353 long mask);
354
331 int (*write_raw)(struct iio_dev *indio_dev, 355 int (*write_raw)(struct iio_dev *indio_dev,
332 struct iio_chan_spec const *chan, 356 struct iio_chan_spec const *chan,
333 int val, 357 int val,
diff --git a/include/linux/iio/types.h b/include/linux/iio/types.h
index 084d882fe01b..d480631eabc2 100644
--- a/include/linux/iio/types.h
+++ b/include/linux/iio/types.h
@@ -53,6 +53,9 @@ enum iio_modifier {
53 IIO_MOD_LIGHT_RED, 53 IIO_MOD_LIGHT_RED,
54 IIO_MOD_LIGHT_GREEN, 54 IIO_MOD_LIGHT_GREEN,
55 IIO_MOD_LIGHT_BLUE, 55 IIO_MOD_LIGHT_BLUE,
56 IIO_MOD_QUATERNION,
57 IIO_MOD_TEMP_AMBIENT,
58 IIO_MOD_TEMP_OBJECT,
56}; 59};
57 60
58enum iio_event_type { 61enum iio_event_type {
@@ -79,6 +82,7 @@ enum iio_event_direction {
79#define IIO_VAL_INT_PLUS_MICRO 2 82#define IIO_VAL_INT_PLUS_MICRO 2
80#define IIO_VAL_INT_PLUS_NANO 3 83#define IIO_VAL_INT_PLUS_NANO 3
81#define IIO_VAL_INT_PLUS_MICRO_DB 4 84#define IIO_VAL_INT_PLUS_MICRO_DB 4
85#define IIO_VAL_INT_MULTIPLE 5
82#define IIO_VAL_FRACTIONAL 10 86#define IIO_VAL_FRACTIONAL 10
83#define IIO_VAL_FRACTIONAL_LOG2 11 87#define IIO_VAL_FRACTIONAL_LOG2 11
84 88
diff --git a/include/linux/init.h b/include/linux/init.h
index a3ba27076342..2df8e8dd10a4 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -297,16 +297,28 @@ void __init parse_early_options(char *cmdline);
297 297
298#else /* MODULE */ 298#else /* MODULE */
299 299
300/* Don't use these in loadable modules, but some people do... */ 300/*
301 * In most cases loadable modules do not need custom
302 * initcall levels. There are still some valid cases where
303 * a driver may be needed early if built in, and does not
304 * matter when built as a loadable module. Like bus
305 * snooping debug drivers.
306 */
301#define early_initcall(fn) module_init(fn) 307#define early_initcall(fn) module_init(fn)
302#define core_initcall(fn) module_init(fn) 308#define core_initcall(fn) module_init(fn)
309#define core_initcall_sync(fn) module_init(fn)
303#define postcore_initcall(fn) module_init(fn) 310#define postcore_initcall(fn) module_init(fn)
311#define postcore_initcall_sync(fn) module_init(fn)
304#define arch_initcall(fn) module_init(fn) 312#define arch_initcall(fn) module_init(fn)
305#define subsys_initcall(fn) module_init(fn) 313#define subsys_initcall(fn) module_init(fn)
314#define subsys_initcall_sync(fn) module_init(fn)
306#define fs_initcall(fn) module_init(fn) 315#define fs_initcall(fn) module_init(fn)
316#define fs_initcall_sync(fn) module_init(fn)
307#define rootfs_initcall(fn) module_init(fn) 317#define rootfs_initcall(fn) module_init(fn)
308#define device_initcall(fn) module_init(fn) 318#define device_initcall(fn) module_init(fn)
319#define device_initcall_sync(fn) module_init(fn)
309#define late_initcall(fn) module_init(fn) 320#define late_initcall(fn) module_init(fn)
321#define late_initcall_sync(fn) module_init(fn)
310 322
311#define console_initcall(fn) module_init(fn) 323#define console_initcall(fn) module_init(fn)
312#define security_initcall(fn) module_init(fn) 324#define security_initcall(fn) module_init(fn)
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 051c85032f48..698ad053d064 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -199,6 +199,26 @@ extern int check_wakeup_irqs(void);
199static inline int check_wakeup_irqs(void) { return 0; } 199static inline int check_wakeup_irqs(void) { return 0; }
200#endif 200#endif
201 201
202/**
203 * struct irq_affinity_notify - context for notification of IRQ affinity changes
204 * @irq: Interrupt to which notification applies
205 * @kref: Reference count, for internal use
206 * @work: Work item, for internal use
207 * @notify: Function to be called on change. This will be
208 * called in process context.
209 * @release: Function to be called on release. This will be
210 * called in process context. Once registered, the
211 * structure must only be freed when this function is
212 * called or later.
213 */
214struct irq_affinity_notify {
215 unsigned int irq;
216 struct kref kref;
217 struct work_struct work;
218 void (*notify)(struct irq_affinity_notify *, const cpumask_t *mask);
219 void (*release)(struct kref *ref);
220};
221
202#if defined(CONFIG_SMP) 222#if defined(CONFIG_SMP)
203 223
204extern cpumask_var_t irq_default_affinity; 224extern cpumask_var_t irq_default_affinity;
@@ -242,26 +262,6 @@ extern int irq_select_affinity(unsigned int irq);
242 262
243extern int irq_set_affinity_hint(unsigned int irq, const struct cpumask *m); 263extern int irq_set_affinity_hint(unsigned int irq, const struct cpumask *m);
244 264
245/**
246 * struct irq_affinity_notify - context for notification of IRQ affinity changes
247 * @irq: Interrupt to which notification applies
248 * @kref: Reference count, for internal use
249 * @work: Work item, for internal use
250 * @notify: Function to be called on change. This will be
251 * called in process context.
252 * @release: Function to be called on release. This will be
253 * called in process context. Once registered, the
254 * structure must only be freed when this function is
255 * called or later.
256 */
257struct irq_affinity_notify {
258 unsigned int irq;
259 struct kref kref;
260 struct work_struct work;
261 void (*notify)(struct irq_affinity_notify *, const cpumask_t *mask);
262 void (*release)(struct kref *ref);
263};
264
265extern int 265extern int
266irq_set_affinity_notifier(unsigned int irq, struct irq_affinity_notify *notify); 266irq_set_affinity_notifier(unsigned int irq, struct irq_affinity_notify *notify);
267 267
@@ -289,6 +289,12 @@ static inline int irq_set_affinity_hint(unsigned int irq,
289{ 289{
290 return -EINVAL; 290 return -EINVAL;
291} 291}
292
293static inline int
294irq_set_affinity_notifier(unsigned int irq, struct irq_affinity_notify *notify)
295{
296 return 0;
297}
292#endif /* CONFIG_SMP */ 298#endif /* CONFIG_SMP */
293 299
294/* 300/*
@@ -491,7 +497,7 @@ static inline int tasklet_trylock(struct tasklet_struct *t)
491 497
492static inline void tasklet_unlock(struct tasklet_struct *t) 498static inline void tasklet_unlock(struct tasklet_struct *t)
493{ 499{
494 smp_mb__before_clear_bit(); 500 smp_mb__before_atomic();
495 clear_bit(TASKLET_STATE_RUN, &(t)->state); 501 clear_bit(TASKLET_STATE_RUN, &(t)->state);
496} 502}
497 503
@@ -539,7 +545,7 @@ static inline void tasklet_hi_schedule_first(struct tasklet_struct *t)
539static inline void tasklet_disable_nosync(struct tasklet_struct *t) 545static inline void tasklet_disable_nosync(struct tasklet_struct *t)
540{ 546{
541 atomic_inc(&t->count); 547 atomic_inc(&t->count);
542 smp_mb__after_atomic_inc(); 548 smp_mb__after_atomic();
543} 549}
544 550
545static inline void tasklet_disable(struct tasklet_struct *t) 551static inline void tasklet_disable(struct tasklet_struct *t)
@@ -551,13 +557,13 @@ static inline void tasklet_disable(struct tasklet_struct *t)
551 557
552static inline void tasklet_enable(struct tasklet_struct *t) 558static inline void tasklet_enable(struct tasklet_struct *t)
553{ 559{
554 smp_mb__before_atomic_dec(); 560 smp_mb__before_atomic();
555 atomic_dec(&t->count); 561 atomic_dec(&t->count);
556} 562}
557 563
558static inline void tasklet_hi_enable(struct tasklet_struct *t) 564static inline void tasklet_hi_enable(struct tasklet_struct *t)
559{ 565{
560 smp_mb__before_atomic_dec(); 566 smp_mb__before_atomic();
561 atomic_dec(&t->count); 567 atomic_dec(&t->count);
562} 568}
563 569
diff --git a/include/linux/irq.h b/include/linux/irq.h
index 5c57efb863d0..0d998d8b01d8 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -525,24 +525,6 @@ static inline void irq_set_percpu_devid_flags(unsigned int irq)
525 IRQ_NOPROBE | IRQ_PER_CPU_DEVID); 525 IRQ_NOPROBE | IRQ_PER_CPU_DEVID);
526} 526}
527 527
528/* Handle dynamic irq creation and destruction */
529extern unsigned int create_irq_nr(unsigned int irq_want, int node);
530extern unsigned int __create_irqs(unsigned int from, unsigned int count,
531 int node);
532extern int create_irq(void);
533extern void destroy_irq(unsigned int irq);
534extern void destroy_irqs(unsigned int irq, unsigned int count);
535
536/*
537 * Dynamic irq helper functions. Obsolete. Use irq_alloc_desc* and
538 * irq_free_desc instead.
539 */
540extern void dynamic_irq_cleanup(unsigned int irq);
541static inline void dynamic_irq_init(unsigned int irq)
542{
543 dynamic_irq_cleanup(irq);
544}
545
546/* Set/get chip/data for an IRQ: */ 528/* Set/get chip/data for an IRQ: */
547extern int irq_set_chip(unsigned int irq, struct irq_chip *chip); 529extern int irq_set_chip(unsigned int irq, struct irq_chip *chip);
548extern int irq_set_handler_data(unsigned int irq, void *data); 530extern int irq_set_handler_data(unsigned int irq, void *data);
@@ -625,17 +607,29 @@ int __irq_alloc_descs(int irq, unsigned int from, unsigned int cnt, int node,
625 irq_alloc_descs(-1, from, cnt, node) 607 irq_alloc_descs(-1, from, cnt, node)
626 608
627void irq_free_descs(unsigned int irq, unsigned int cnt); 609void irq_free_descs(unsigned int irq, unsigned int cnt);
628int irq_reserve_irqs(unsigned int from, unsigned int cnt);
629
630static inline void irq_free_desc(unsigned int irq) 610static inline void irq_free_desc(unsigned int irq)
631{ 611{
632 irq_free_descs(irq, 1); 612 irq_free_descs(irq, 1);
633} 613}
634 614
635static inline int irq_reserve_irq(unsigned int irq) 615#ifdef CONFIG_GENERIC_IRQ_LEGACY_ALLOC_HWIRQ
616unsigned int irq_alloc_hwirqs(int cnt, int node);
617static inline unsigned int irq_alloc_hwirq(int node)
618{
619 return irq_alloc_hwirqs(1, node);
620}
621void irq_free_hwirqs(unsigned int from, int cnt);
622static inline void irq_free_hwirq(unsigned int irq)
636{ 623{
637 return irq_reserve_irqs(irq, 1); 624 return irq_free_hwirqs(irq, 1);
638} 625}
626int arch_setup_hwirq(unsigned int irq, int node);
627void arch_teardown_hwirq(unsigned int irq);
628#endif
629
630#ifdef CONFIG_GENERIC_IRQ_LEGACY
631void irq_init_desc(unsigned int irq);
632#endif
639 633
640#ifndef irq_reg_writel 634#ifndef irq_reg_writel
641# define irq_reg_writel(val, addr) writel(val, addr) 635# define irq_reg_writel(val, addr) writel(val, addr)
diff --git a/include/linux/irqchip/arm-gic.h b/include/linux/irqchip/arm-gic.h
index 7ed92d0560d5..45e2d8c15bd2 100644
--- a/include/linux/irqchip/arm-gic.h
+++ b/include/linux/irqchip/arm-gic.h
@@ -21,6 +21,8 @@
21#define GIC_CPU_ACTIVEPRIO 0xd0 21#define GIC_CPU_ACTIVEPRIO 0xd0
22#define GIC_CPU_IDENT 0xfc 22#define GIC_CPU_IDENT 0xfc
23 23
24#define GICC_IAR_INT_ID_MASK 0x3ff
25
24#define GIC_DIST_CTRL 0x000 26#define GIC_DIST_CTRL 0x000
25#define GIC_DIST_CTR 0x004 27#define GIC_DIST_CTR 0x004
26#define GIC_DIST_IGROUP 0x080 28#define GIC_DIST_IGROUP 0x080
diff --git a/include/linux/irqdesc.h b/include/linux/irqdesc.h
index 26e2661d3935..472c021a2d4f 100644
--- a/include/linux/irqdesc.h
+++ b/include/linux/irqdesc.h
@@ -27,6 +27,8 @@ struct irq_desc;
27 * @irq_count: stats field to detect stalled irqs 27 * @irq_count: stats field to detect stalled irqs
28 * @last_unhandled: aging timer for unhandled count 28 * @last_unhandled: aging timer for unhandled count
29 * @irqs_unhandled: stats field for spurious unhandled interrupts 29 * @irqs_unhandled: stats field for spurious unhandled interrupts
30 * @threads_handled: stats field for deferred spurious detection of threaded handlers
31 * @threads_handled_last: comparator field for deferred spurious detection of theraded handlers
30 * @lock: locking for SMP 32 * @lock: locking for SMP
31 * @affinity_hint: hint to user space for preferred irq affinity 33 * @affinity_hint: hint to user space for preferred irq affinity
32 * @affinity_notify: context for notification of affinity changes 34 * @affinity_notify: context for notification of affinity changes
@@ -52,6 +54,8 @@ struct irq_desc {
52 unsigned int irq_count; /* For detecting broken IRQs */ 54 unsigned int irq_count; /* For detecting broken IRQs */
53 unsigned long last_unhandled; /* Aging timer for unhandled count */ 55 unsigned long last_unhandled; /* Aging timer for unhandled count */
54 unsigned int irqs_unhandled; 56 unsigned int irqs_unhandled;
57 atomic_t threads_handled;
58 int threads_handled_last;
55 raw_spinlock_t lock; 59 raw_spinlock_t lock;
56 struct cpumask *percpu_enabled; 60 struct cpumask *percpu_enabled;
57#ifdef CONFIG_SMP 61#ifdef CONFIG_SMP
diff --git a/include/linux/jump_label.h b/include/linux/jump_label.h
index 5c1dfb2a9e73..784304b222b3 100644
--- a/include/linux/jump_label.h
+++ b/include/linux/jump_label.h
@@ -69,6 +69,10 @@ struct static_key {
69 69
70# include <asm/jump_label.h> 70# include <asm/jump_label.h>
71# define HAVE_JUMP_LABEL 71# define HAVE_JUMP_LABEL
72#else
73struct static_key {
74 atomic_t enabled;
75};
72#endif /* CC_HAVE_ASM_GOTO && CONFIG_JUMP_LABEL */ 76#endif /* CC_HAVE_ASM_GOTO && CONFIG_JUMP_LABEL */
73 77
74enum jump_label_type { 78enum jump_label_type {
@@ -79,6 +83,12 @@ enum jump_label_type {
79struct module; 83struct module;
80 84
81#include <linux/atomic.h> 85#include <linux/atomic.h>
86
87static inline int static_key_count(struct static_key *key)
88{
89 return atomic_read(&key->enabled);
90}
91
82#ifdef HAVE_JUMP_LABEL 92#ifdef HAVE_JUMP_LABEL
83 93
84#define JUMP_LABEL_TYPE_FALSE_BRANCH 0UL 94#define JUMP_LABEL_TYPE_FALSE_BRANCH 0UL
@@ -134,10 +144,6 @@ extern void jump_label_apply_nops(struct module *mod);
134 144
135#else /* !HAVE_JUMP_LABEL */ 145#else /* !HAVE_JUMP_LABEL */
136 146
137struct static_key {
138 atomic_t enabled;
139};
140
141static __always_inline void jump_label_init(void) 147static __always_inline void jump_label_init(void)
142{ 148{
143 static_key_initialized = true; 149 static_key_initialized = true;
@@ -145,14 +151,14 @@ static __always_inline void jump_label_init(void)
145 151
146static __always_inline bool static_key_false(struct static_key *key) 152static __always_inline bool static_key_false(struct static_key *key)
147{ 153{
148 if (unlikely(atomic_read(&key->enabled) > 0)) 154 if (unlikely(static_key_count(key) > 0))
149 return true; 155 return true;
150 return false; 156 return false;
151} 157}
152 158
153static __always_inline bool static_key_true(struct static_key *key) 159static __always_inline bool static_key_true(struct static_key *key)
154{ 160{
155 if (likely(atomic_read(&key->enabled) > 0)) 161 if (likely(static_key_count(key) > 0))
156 return true; 162 return true;
157 return false; 163 return false;
158} 164}
@@ -194,7 +200,7 @@ static inline int jump_label_apply_nops(struct module *mod)
194 200
195static inline bool static_key_enabled(struct static_key *key) 201static inline bool static_key_enabled(struct static_key *key)
196{ 202{
197 return (atomic_read(&key->enabled) > 0); 203 return static_key_count(key) > 0;
198} 204}
199 205
200#endif /* _LINUX_JUMP_LABEL_H */ 206#endif /* _LINUX_JUMP_LABEL_H */
diff --git a/include/linux/kernfs.h b/include/linux/kernfs.h
index 52bf5677db0b..17aa1cce6f8e 100644
--- a/include/linux/kernfs.h
+++ b/include/linux/kernfs.h
@@ -161,6 +161,10 @@ struct kernfs_root {
161 /* private fields, do not use outside kernfs proper */ 161 /* private fields, do not use outside kernfs proper */
162 struct ida ino_ida; 162 struct ida ino_ida;
163 struct kernfs_syscall_ops *syscall_ops; 163 struct kernfs_syscall_ops *syscall_ops;
164
165 /* list of kernfs_super_info of this root, protected by kernfs_mutex */
166 struct list_head supers;
167
164 wait_queue_head_t deactivate_waitq; 168 wait_queue_head_t deactivate_waitq;
165}; 169};
166 170
diff --git a/include/linux/key.h b/include/linux/key.h
index 80d677483e31..3ae45f09589b 100644
--- a/include/linux/key.h
+++ b/include/linux/key.h
@@ -332,7 +332,7 @@ do { \
332} while (0) 332} while (0)
333 333
334#ifdef CONFIG_SYSCTL 334#ifdef CONFIG_SYSCTL
335extern ctl_table key_sysctls[]; 335extern struct ctl_table key_sysctls[];
336#endif 336#endif
337/* 337/*
338 * the userspace interface 338 * the userspace interface
diff --git a/include/linux/kmemleak.h b/include/linux/kmemleak.h
index 5bb424659c04..057e95971014 100644
--- a/include/linux/kmemleak.h
+++ b/include/linux/kmemleak.h
@@ -30,6 +30,7 @@ extern void kmemleak_alloc_percpu(const void __percpu *ptr, size_t size) __ref;
30extern void kmemleak_free(const void *ptr) __ref; 30extern void kmemleak_free(const void *ptr) __ref;
31extern void kmemleak_free_part(const void *ptr, size_t size) __ref; 31extern void kmemleak_free_part(const void *ptr, size_t size) __ref;
32extern void kmemleak_free_percpu(const void __percpu *ptr) __ref; 32extern void kmemleak_free_percpu(const void __percpu *ptr) __ref;
33extern void kmemleak_update_trace(const void *ptr) __ref;
33extern void kmemleak_not_leak(const void *ptr) __ref; 34extern void kmemleak_not_leak(const void *ptr) __ref;
34extern void kmemleak_ignore(const void *ptr) __ref; 35extern void kmemleak_ignore(const void *ptr) __ref;
35extern void kmemleak_scan_area(const void *ptr, size_t size, gfp_t gfp) __ref; 36extern void kmemleak_scan_area(const void *ptr, size_t size, gfp_t gfp) __ref;
@@ -83,6 +84,9 @@ static inline void kmemleak_free_recursive(const void *ptr, unsigned long flags)
83static inline void kmemleak_free_percpu(const void __percpu *ptr) 84static inline void kmemleak_free_percpu(const void __percpu *ptr)
84{ 85{
85} 86}
87static inline void kmemleak_update_trace(const void *ptr)
88{
89}
86static inline void kmemleak_not_leak(const void *ptr) 90static inline void kmemleak_not_leak(const void *ptr)
87{ 91{
88} 92}
diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index f896a33e8341..2d61b909f414 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -32,8 +32,10 @@
32#define UEVENT_NUM_ENVP 32 /* number of env pointers */ 32#define UEVENT_NUM_ENVP 32 /* number of env pointers */
33#define UEVENT_BUFFER_SIZE 2048 /* buffer for the variables */ 33#define UEVENT_BUFFER_SIZE 2048 /* buffer for the variables */
34 34
35#ifdef CONFIG_UEVENT_HELPER
35/* path to the userspace helper executed on an event */ 36/* path to the userspace helper executed on an event */
36extern char uevent_helper[]; 37extern char uevent_helper[];
38#endif
37 39
38/* counter to tag the uevent, read only except for the kobject core */ 40/* counter to tag the uevent, read only except for the kobject core */
39extern u64 uevent_seqnum; 41extern u64 uevent_seqnum;
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index 7d21cf9f4380..970c68197c69 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -134,6 +134,8 @@ static inline bool is_error_page(struct page *page)
134#define KVM_REQ_EPR_EXIT 20 134#define KVM_REQ_EPR_EXIT 20
135#define KVM_REQ_SCAN_IOAPIC 21 135#define KVM_REQ_SCAN_IOAPIC 21
136#define KVM_REQ_GLOBAL_CLOCK_UPDATE 22 136#define KVM_REQ_GLOBAL_CLOCK_UPDATE 22
137#define KVM_REQ_ENABLE_IBS 23
138#define KVM_REQ_DISABLE_IBS 24
137 139
138#define KVM_USERSPACE_IRQ_SOURCE_ID 0 140#define KVM_USERSPACE_IRQ_SOURCE_ID 0
139#define KVM_IRQFD_RESAMPLE_IRQ_SOURCE_ID 1 141#define KVM_IRQFD_RESAMPLE_IRQ_SOURCE_ID 1
@@ -163,6 +165,7 @@ enum kvm_bus {
163 KVM_MMIO_BUS, 165 KVM_MMIO_BUS,
164 KVM_PIO_BUS, 166 KVM_PIO_BUS,
165 KVM_VIRTIO_CCW_NOTIFY_BUS, 167 KVM_VIRTIO_CCW_NOTIFY_BUS,
168 KVM_FAST_MMIO_BUS,
166 KVM_NR_BUSES 169 KVM_NR_BUSES
167}; 170};
168 171
@@ -367,6 +370,7 @@ struct kvm {
367 struct mm_struct *mm; /* userspace tied to this vm */ 370 struct mm_struct *mm; /* userspace tied to this vm */
368 struct kvm_memslots *memslots; 371 struct kvm_memslots *memslots;
369 struct srcu_struct srcu; 372 struct srcu_struct srcu;
373 struct srcu_struct irq_srcu;
370#ifdef CONFIG_KVM_APIC_ARCHITECTURE 374#ifdef CONFIG_KVM_APIC_ARCHITECTURE
371 u32 bsp_vcpu_id; 375 u32 bsp_vcpu_id;
372#endif 376#endif
@@ -410,9 +414,7 @@ struct kvm {
410 unsigned long mmu_notifier_seq; 414 unsigned long mmu_notifier_seq;
411 long mmu_notifier_count; 415 long mmu_notifier_count;
412#endif 416#endif
413 /* Protected by mmu_lock */ 417 long tlbs_dirty;
414 bool tlbs_dirty;
415
416 struct list_head devices; 418 struct list_head devices;
417}; 419};
418 420
@@ -879,6 +881,13 @@ static inline hpa_t pfn_to_hpa(pfn_t pfn)
879 return (hpa_t)pfn << PAGE_SHIFT; 881 return (hpa_t)pfn << PAGE_SHIFT;
880} 882}
881 883
884static inline bool kvm_is_error_gpa(struct kvm *kvm, gpa_t gpa)
885{
886 unsigned long hva = gfn_to_hva(kvm, gpa_to_gfn(gpa));
887
888 return kvm_is_error_hva(hva);
889}
890
882static inline void kvm_migrate_timers(struct kvm_vcpu *vcpu) 891static inline void kvm_migrate_timers(struct kvm_vcpu *vcpu)
883{ 892{
884 set_bit(KVM_REQ_MIGRATE_TIMER, &vcpu->requests); 893 set_bit(KVM_REQ_MIGRATE_TIMER, &vcpu->requests);
diff --git a/include/linux/mbus.h b/include/linux/mbus.h
index 345b8c53b897..550c88fb0267 100644
--- a/include/linux/mbus.h
+++ b/include/linux/mbus.h
@@ -73,6 +73,6 @@ int mvebu_mbus_del_window(phys_addr_t base, size_t size);
73int mvebu_mbus_init(const char *soc, phys_addr_t mbus_phys_base, 73int mvebu_mbus_init(const char *soc, phys_addr_t mbus_phys_base,
74 size_t mbus_size, phys_addr_t sdram_phys_base, 74 size_t mbus_size, phys_addr_t sdram_phys_base,
75 size_t sdram_size); 75 size_t sdram_size);
76int mvebu_mbus_dt_init(void); 76int mvebu_mbus_dt_init(bool is_coherent);
77 77
78#endif /* __LINUX_MBUS_H */ 78#endif /* __LINUX_MBUS_H */
diff --git a/include/linux/mc146818rtc.h b/include/linux/mc146818rtc.h
index 2f4e957af656..433e0c74d643 100644
--- a/include/linux/mc146818rtc.h
+++ b/include/linux/mc146818rtc.h
@@ -31,6 +31,10 @@ struct cmos_rtc_board_info {
31 void (*wake_on)(struct device *dev); 31 void (*wake_on)(struct device *dev);
32 void (*wake_off)(struct device *dev); 32 void (*wake_off)(struct device *dev);
33 33
34 u32 flags;
35#define CMOS_RTC_FLAGS_NOFREQ (1 << 0)
36 int address_space;
37
34 u8 rtc_day_alarm; /* zero, or register index */ 38 u8 rtc_day_alarm; /* zero, or register index */
35 u8 rtc_mon_alarm; /* zero, or register index */ 39 u8 rtc_mon_alarm; /* zero, or register index */
36 u8 rtc_century; /* zero, or register index */ 40 u8 rtc_century; /* zero, or register index */
diff --git a/include/linux/mcb.h b/include/linux/mcb.h
index 2db284d14064..ed06e15a36aa 100644
--- a/include/linux/mcb.h
+++ b/include/linux/mcb.h
@@ -16,6 +16,7 @@
16#include <linux/irqreturn.h> 16#include <linux/irqreturn.h>
17 17
18struct mcb_driver; 18struct mcb_driver;
19struct mcb_device;
19 20
20/** 21/**
21 * struct mcb_bus - MEN Chameleon Bus 22 * struct mcb_bus - MEN Chameleon Bus
@@ -23,11 +24,14 @@ struct mcb_driver;
23 * @dev: pointer to carrier device 24 * @dev: pointer to carrier device
24 * @children: the child busses 25 * @children: the child busses
25 * @bus_nr: mcb bus number 26 * @bus_nr: mcb bus number
27 * @get_irq: callback to get IRQ number
26 */ 28 */
27struct mcb_bus { 29struct mcb_bus {
28 struct list_head children; 30 struct list_head children;
29 struct device dev; 31 struct device dev;
32 struct device *carrier;
30 int bus_nr; 33 int bus_nr;
34 int (*get_irq)(struct mcb_device *dev);
31}; 35};
32#define to_mcb_bus(b) container_of((b), struct mcb_bus, dev) 36#define to_mcb_bus(b) container_of((b), struct mcb_bus, dev)
33 37
@@ -105,7 +109,7 @@ extern void mcb_unregister_driver(struct mcb_driver *driver);
105 module_driver(__mcb_driver, mcb_register_driver, mcb_unregister_driver); 109 module_driver(__mcb_driver, mcb_register_driver, mcb_unregister_driver);
106extern void mcb_bus_add_devices(const struct mcb_bus *bus); 110extern void mcb_bus_add_devices(const struct mcb_bus *bus);
107extern int mcb_device_register(struct mcb_bus *bus, struct mcb_device *dev); 111extern int mcb_device_register(struct mcb_bus *bus, struct mcb_device *dev);
108extern struct mcb_bus *mcb_alloc_bus(void); 112extern struct mcb_bus *mcb_alloc_bus(struct device *carrier);
109extern struct mcb_bus *mcb_bus_get(struct mcb_bus *bus); 113extern struct mcb_bus *mcb_bus_get(struct mcb_bus *bus);
110extern void mcb_bus_put(struct mcb_bus *bus); 114extern void mcb_bus_put(struct mcb_bus *bus);
111extern struct mcb_device *mcb_alloc_dev(struct mcb_bus *bus); 115extern struct mcb_device *mcb_alloc_dev(struct mcb_bus *bus);
diff --git a/include/linux/memblock.h b/include/linux/memblock.h
index 8a20a51ed42d..b660e05b63d4 100644
--- a/include/linux/memblock.h
+++ b/include/linux/memblock.h
@@ -18,6 +18,7 @@
18#include <linux/mm.h> 18#include <linux/mm.h>
19 19
20#define INIT_MEMBLOCK_REGIONS 128 20#define INIT_MEMBLOCK_REGIONS 128
21#define INIT_PHYSMEM_REGIONS 4
21 22
22/* Definition of memblock flags. */ 23/* Definition of memblock flags. */
23#define MEMBLOCK_HOTPLUG 0x1 /* hotpluggable region */ 24#define MEMBLOCK_HOTPLUG 0x1 /* hotpluggable region */
@@ -43,6 +44,9 @@ struct memblock {
43 phys_addr_t current_limit; 44 phys_addr_t current_limit;
44 struct memblock_type memory; 45 struct memblock_type memory;
45 struct memblock_type reserved; 46 struct memblock_type reserved;
47#ifdef CONFIG_HAVE_MEMBLOCK_PHYS_MAP
48 struct memblock_type physmem;
49#endif
46}; 50};
47 51
48extern struct memblock memblock; 52extern struct memblock memblock;
@@ -71,6 +75,63 @@ int memblock_reserve(phys_addr_t base, phys_addr_t size);
71void memblock_trim_memory(phys_addr_t align); 75void memblock_trim_memory(phys_addr_t align);
72int memblock_mark_hotplug(phys_addr_t base, phys_addr_t size); 76int memblock_mark_hotplug(phys_addr_t base, phys_addr_t size);
73int memblock_clear_hotplug(phys_addr_t base, phys_addr_t size); 77int memblock_clear_hotplug(phys_addr_t base, phys_addr_t size);
78
79/* Low level functions */
80int memblock_add_range(struct memblock_type *type,
81 phys_addr_t base, phys_addr_t size,
82 int nid, unsigned long flags);
83
84int memblock_remove_range(struct memblock_type *type,
85 phys_addr_t base,
86 phys_addr_t size);
87
88void __next_mem_range(u64 *idx, int nid, struct memblock_type *type_a,
89 struct memblock_type *type_b, phys_addr_t *out_start,
90 phys_addr_t *out_end, int *out_nid);
91
92void __next_mem_range_rev(u64 *idx, int nid, struct memblock_type *type_a,
93 struct memblock_type *type_b, phys_addr_t *out_start,
94 phys_addr_t *out_end, int *out_nid);
95
96/**
97 * for_each_mem_range - iterate through memblock areas from type_a and not
98 * included in type_b. Or just type_a if type_b is NULL.
99 * @i: u64 used as loop variable
100 * @type_a: ptr to memblock_type to iterate
101 * @type_b: ptr to memblock_type which excludes from the iteration
102 * @nid: node selector, %NUMA_NO_NODE for all nodes
103 * @p_start: ptr to phys_addr_t for start address of the range, can be %NULL
104 * @p_end: ptr to phys_addr_t for end address of the range, can be %NULL
105 * @p_nid: ptr to int for nid of the range, can be %NULL
106 */
107#define for_each_mem_range(i, type_a, type_b, nid, \
108 p_start, p_end, p_nid) \
109 for (i = 0, __next_mem_range(&i, nid, type_a, type_b, \
110 p_start, p_end, p_nid); \
111 i != (u64)ULLONG_MAX; \
112 __next_mem_range(&i, nid, type_a, type_b, \
113 p_start, p_end, p_nid))
114
115/**
116 * for_each_mem_range_rev - reverse iterate through memblock areas from
117 * type_a and not included in type_b. Or just type_a if type_b is NULL.
118 * @i: u64 used as loop variable
119 * @type_a: ptr to memblock_type to iterate
120 * @type_b: ptr to memblock_type which excludes from the iteration
121 * @nid: node selector, %NUMA_NO_NODE for all nodes
122 * @p_start: ptr to phys_addr_t for start address of the range, can be %NULL
123 * @p_end: ptr to phys_addr_t for end address of the range, can be %NULL
124 * @p_nid: ptr to int for nid of the range, can be %NULL
125 */
126#define for_each_mem_range_rev(i, type_a, type_b, nid, \
127 p_start, p_end, p_nid) \
128 for (i = (u64)ULLONG_MAX, \
129 __next_mem_range_rev(&i, nid, type_a, type_b, \
130 p_start, p_end, p_nid); \
131 i != (u64)ULLONG_MAX; \
132 __next_mem_range_rev(&i, nid, type_a, type_b, \
133 p_start, p_end, p_nid))
134
74#ifdef CONFIG_MOVABLE_NODE 135#ifdef CONFIG_MOVABLE_NODE
75static inline bool memblock_is_hotpluggable(struct memblock_region *m) 136static inline bool memblock_is_hotpluggable(struct memblock_region *m)
76{ 137{
@@ -113,9 +174,6 @@ void __next_mem_pfn_range(int *idx, int nid, unsigned long *out_start_pfn,
113 i >= 0; __next_mem_pfn_range(&i, nid, p_start, p_end, p_nid)) 174 i >= 0; __next_mem_pfn_range(&i, nid, p_start, p_end, p_nid))
114#endif /* CONFIG_HAVE_MEMBLOCK_NODE_MAP */ 175#endif /* CONFIG_HAVE_MEMBLOCK_NODE_MAP */
115 176
116void __next_free_mem_range(u64 *idx, int nid, phys_addr_t *out_start,
117 phys_addr_t *out_end, int *out_nid);
118
119/** 177/**
120 * for_each_free_mem_range - iterate through free memblock areas 178 * for_each_free_mem_range - iterate through free memblock areas
121 * @i: u64 used as loop variable 179 * @i: u64 used as loop variable
@@ -128,13 +186,8 @@ void __next_free_mem_range(u64 *idx, int nid, phys_addr_t *out_start,
128 * soon as memblock is initialized. 186 * soon as memblock is initialized.
129 */ 187 */
130#define for_each_free_mem_range(i, nid, p_start, p_end, p_nid) \ 188#define for_each_free_mem_range(i, nid, p_start, p_end, p_nid) \
131 for (i = 0, \ 189 for_each_mem_range(i, &memblock.memory, &memblock.reserved, \
132 __next_free_mem_range(&i, nid, p_start, p_end, p_nid); \ 190 nid, p_start, p_end, p_nid)
133 i != (u64)ULLONG_MAX; \
134 __next_free_mem_range(&i, nid, p_start, p_end, p_nid))
135
136void __next_free_mem_range_rev(u64 *idx, int nid, phys_addr_t *out_start,
137 phys_addr_t *out_end, int *out_nid);
138 191
139/** 192/**
140 * for_each_free_mem_range_reverse - rev-iterate through free memblock areas 193 * for_each_free_mem_range_reverse - rev-iterate through free memblock areas
@@ -148,10 +201,8 @@ void __next_free_mem_range_rev(u64 *idx, int nid, phys_addr_t *out_start,
148 * order. Available as soon as memblock is initialized. 201 * order. Available as soon as memblock is initialized.
149 */ 202 */
150#define for_each_free_mem_range_reverse(i, nid, p_start, p_end, p_nid) \ 203#define for_each_free_mem_range_reverse(i, nid, p_start, p_end, p_nid) \
151 for (i = (u64)ULLONG_MAX, \ 204 for_each_mem_range_rev(i, &memblock.memory, &memblock.reserved, \
152 __next_free_mem_range_rev(&i, nid, p_start, p_end, p_nid); \ 205 nid, p_start, p_end, p_nid)
153 i != (u64)ULLONG_MAX; \
154 __next_free_mem_range_rev(&i, nid, p_start, p_end, p_nid))
155 206
156static inline void memblock_set_region_flags(struct memblock_region *r, 207static inline void memblock_set_region_flags(struct memblock_region *r,
157 unsigned long flags) 208 unsigned long flags)
@@ -221,6 +272,8 @@ static inline bool memblock_bottom_up(void) { return false; }
221#define MEMBLOCK_ALLOC_ANYWHERE (~(phys_addr_t)0) 272#define MEMBLOCK_ALLOC_ANYWHERE (~(phys_addr_t)0)
222#define MEMBLOCK_ALLOC_ACCESSIBLE 0 273#define MEMBLOCK_ALLOC_ACCESSIBLE 0
223 274
275phys_addr_t __init memblock_alloc_range(phys_addr_t size, phys_addr_t align,
276 phys_addr_t start, phys_addr_t end);
224phys_addr_t memblock_alloc_base(phys_addr_t size, phys_addr_t align, 277phys_addr_t memblock_alloc_base(phys_addr_t size, phys_addr_t align,
225 phys_addr_t max_addr); 278 phys_addr_t max_addr);
226phys_addr_t __memblock_alloc_base(phys_addr_t size, phys_addr_t align, 279phys_addr_t __memblock_alloc_base(phys_addr_t size, phys_addr_t align,
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index b569b8be5c5a..eb65d29516ca 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -492,13 +492,9 @@ void __memcg_kmem_uncharge_pages(struct page *page, int order);
492 492
493int memcg_cache_id(struct mem_cgroup *memcg); 493int memcg_cache_id(struct mem_cgroup *memcg);
494 494
495char *memcg_create_cache_name(struct mem_cgroup *memcg,
496 struct kmem_cache *root_cache);
497int memcg_alloc_cache_params(struct mem_cgroup *memcg, struct kmem_cache *s, 495int memcg_alloc_cache_params(struct mem_cgroup *memcg, struct kmem_cache *s,
498 struct kmem_cache *root_cache); 496 struct kmem_cache *root_cache);
499void memcg_free_cache_params(struct kmem_cache *s); 497void memcg_free_cache_params(struct kmem_cache *s);
500void memcg_register_cache(struct kmem_cache *s);
501void memcg_unregister_cache(struct kmem_cache *s);
502 498
503int memcg_update_cache_size(struct kmem_cache *s, int num_groups); 499int memcg_update_cache_size(struct kmem_cache *s, int num_groups);
504void memcg_update_array_size(int num_groups); 500void memcg_update_array_size(int num_groups);
@@ -506,8 +502,10 @@ void memcg_update_array_size(int num_groups);
506struct kmem_cache * 502struct kmem_cache *
507__memcg_kmem_get_cache(struct kmem_cache *cachep, gfp_t gfp); 503__memcg_kmem_get_cache(struct kmem_cache *cachep, gfp_t gfp);
508 504
509void mem_cgroup_destroy_cache(struct kmem_cache *cachep); 505int __memcg_charge_slab(struct kmem_cache *cachep, gfp_t gfp, int order);
510int __kmem_cache_destroy_memcg_children(struct kmem_cache *s); 506void __memcg_uncharge_slab(struct kmem_cache *cachep, int order);
507
508int __memcg_cleanup_cache_params(struct kmem_cache *s);
511 509
512/** 510/**
513 * memcg_kmem_newpage_charge: verify if a new kmem allocation is allowed. 511 * memcg_kmem_newpage_charge: verify if a new kmem allocation is allowed.
@@ -534,7 +532,7 @@ memcg_kmem_newpage_charge(gfp_t gfp, struct mem_cgroup **memcg, int order)
534 * res_counter_charge_nofail, but we hope those allocations are rare, 532 * res_counter_charge_nofail, but we hope those allocations are rare,
535 * and won't be worth the trouble. 533 * and won't be worth the trouble.
536 */ 534 */
537 if (!(gfp & __GFP_KMEMCG) || (gfp & __GFP_NOFAIL)) 535 if (gfp & __GFP_NOFAIL)
538 return true; 536 return true;
539 if (in_interrupt() || (!current->mm) || (current->flags & PF_KTHREAD)) 537 if (in_interrupt() || (!current->mm) || (current->flags & PF_KTHREAD))
540 return true; 538 return true;
@@ -583,17 +581,7 @@ memcg_kmem_commit_charge(struct page *page, struct mem_cgroup *memcg, int order)
583 * @cachep: the original global kmem cache 581 * @cachep: the original global kmem cache
584 * @gfp: allocation flags. 582 * @gfp: allocation flags.
585 * 583 *
586 * This function assumes that the task allocating, which determines the memcg 584 * All memory allocated from a per-memcg cache is charged to the owner memcg.
587 * in the page allocator, belongs to the same cgroup throughout the whole
588 * process. Misacounting can happen if the task calls memcg_kmem_get_cache()
589 * while belonging to a cgroup, and later on changes. This is considered
590 * acceptable, and should only happen upon task migration.
591 *
592 * Before the cache is created by the memcg core, there is also a possible
593 * imbalance: the task belongs to a memcg, but the cache being allocated from
594 * is the global cache, since the child cache is not yet guaranteed to be
595 * ready. This case is also fine, since in this case the GFP_KMEMCG will not be
596 * passed and the page allocator will not attempt any cgroup accounting.
597 */ 585 */
598static __always_inline struct kmem_cache * 586static __always_inline struct kmem_cache *
599memcg_kmem_get_cache(struct kmem_cache *cachep, gfp_t gfp) 587memcg_kmem_get_cache(struct kmem_cache *cachep, gfp_t gfp)
@@ -648,14 +636,6 @@ static inline void memcg_free_cache_params(struct kmem_cache *s)
648{ 636{
649} 637}
650 638
651static inline void memcg_register_cache(struct kmem_cache *s)
652{
653}
654
655static inline void memcg_unregister_cache(struct kmem_cache *s)
656{
657}
658
659static inline struct kmem_cache * 639static inline struct kmem_cache *
660memcg_kmem_get_cache(struct kmem_cache *cachep, gfp_t gfp) 640memcg_kmem_get_cache(struct kmem_cache *cachep, gfp_t gfp)
661{ 641{
diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h
index 4ca3d951fe91..010d125bffbf 100644
--- a/include/linux/memory_hotplug.h
+++ b/include/linux/memory_hotplug.h
@@ -187,14 +187,8 @@ extern void put_page_bootmem(struct page *page);
187extern void get_page_bootmem(unsigned long ingo, struct page *page, 187extern void get_page_bootmem(unsigned long ingo, struct page *page,
188 unsigned long type); 188 unsigned long type);
189 189
190/* 190void get_online_mems(void);
191 * Lock for memory hotplug guarantees 1) all callbacks for memory hotplug 191void put_online_mems(void);
192 * notifier will be called under this. 2) offline/online/add/remove memory
193 * will not run simultaneously.
194 */
195
196void lock_memory_hotplug(void);
197void unlock_memory_hotplug(void);
198 192
199#else /* ! CONFIG_MEMORY_HOTPLUG */ 193#else /* ! CONFIG_MEMORY_HOTPLUG */
200/* 194/*
@@ -232,8 +226,8 @@ static inline int try_online_node(int nid)
232 return 0; 226 return 0;
233} 227}
234 228
235static inline void lock_memory_hotplug(void) {} 229static inline void get_online_mems(void) {}
236static inline void unlock_memory_hotplug(void) {} 230static inline void put_online_mems(void) {}
237 231
238#endif /* ! CONFIG_MEMORY_HOTPLUG */ 232#endif /* ! CONFIG_MEMORY_HOTPLUG */
239 233
diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h
index 3c1b968da0ca..f230a978e6ba 100644
--- a/include/linux/mempolicy.h
+++ b/include/linux/mempolicy.h
@@ -175,6 +175,12 @@ static inline int vma_migratable(struct vm_area_struct *vma)
175{ 175{
176 if (vma->vm_flags & (VM_IO | VM_PFNMAP)) 176 if (vma->vm_flags & (VM_IO | VM_PFNMAP))
177 return 0; 177 return 0;
178
179#ifndef CONFIG_ARCH_ENABLE_HUGEPAGE_MIGRATION
180 if (vma->vm_flags & VM_HUGETLB)
181 return 0;
182#endif
183
178 /* 184 /*
179 * Migration allocates pages in the highest zone. If we cannot 185 * Migration allocates pages in the highest zone. If we cannot
180 * do so then migration (at least from node to node) is not 186 * do so then migration (at least from node to node) is not
diff --git a/include/linux/mfd/abx500.h b/include/linux/mfd/abx500.h
index 3301b2031c8d..552cc1d61cc7 100644
--- a/include/linux/mfd/abx500.h
+++ b/include/linux/mfd/abx500.h
@@ -330,7 +330,6 @@ int abx500_mask_and_set_register_interruptible(struct device *dev, u8 bank,
330int abx500_get_chip_id(struct device *dev); 330int abx500_get_chip_id(struct device *dev);
331int abx500_event_registers_startup_state_get(struct device *dev, u8 *event); 331int abx500_event_registers_startup_state_get(struct device *dev, u8 *event);
332int abx500_startup_irq_enabled(struct device *dev, unsigned int irq); 332int abx500_startup_irq_enabled(struct device *dev, unsigned int irq);
333void abx500_dump_all_banks(void);
334 333
335struct abx500_ops { 334struct abx500_ops {
336 int (*get_chip_id) (struct device *); 335 int (*get_chip_id) (struct device *);
diff --git a/include/linux/mfd/arizona/core.h b/include/linux/mfd/arizona/core.h
index 5cf8b91ce996..6d9371f88875 100644
--- a/include/linux/mfd/arizona/core.h
+++ b/include/linux/mfd/arizona/core.h
@@ -124,4 +124,7 @@ int wm5102_patch(struct arizona *arizona);
124int wm5110_patch(struct arizona *arizona); 124int wm5110_patch(struct arizona *arizona);
125int wm8997_patch(struct arizona *arizona); 125int wm8997_patch(struct arizona *arizona);
126 126
127extern int arizona_of_get_named_gpio(struct arizona *arizona, const char *prop,
128 bool mandatory);
129
127#endif 130#endif
diff --git a/include/linux/mfd/arizona/registers.h b/include/linux/mfd/arizona/registers.h
index 7b35c21170d5..7204d8138b24 100644
--- a/include/linux/mfd/arizona/registers.h
+++ b/include/linux/mfd/arizona/registers.h
@@ -42,12 +42,14 @@
42#define ARIZONA_SAMPLE_RATE_SEQUENCE_SELECT_2 0x62 42#define ARIZONA_SAMPLE_RATE_SEQUENCE_SELECT_2 0x62
43#define ARIZONA_SAMPLE_RATE_SEQUENCE_SELECT_3 0x63 43#define ARIZONA_SAMPLE_RATE_SEQUENCE_SELECT_3 0x63
44#define ARIZONA_SAMPLE_RATE_SEQUENCE_SELECT_4 0x64 44#define ARIZONA_SAMPLE_RATE_SEQUENCE_SELECT_4 0x64
45#define ARIZONA_ALWAYS_ON_TRIGGERS_SEQUENCE_SELECT_1 0x68 45#define ARIZONA_ALWAYS_ON_TRIGGERS_SEQUENCE_SELECT_1 0x66
46#define ARIZONA_ALWAYS_ON_TRIGGERS_SEQUENCE_SELECT_2 0x69 46#define ARIZONA_ALWAYS_ON_TRIGGERS_SEQUENCE_SELECT_2 0x67
47#define ARIZONA_ALWAYS_ON_TRIGGERS_SEQUENCE_SELECT_3 0x6A 47#define ARIZONA_ALWAYS_ON_TRIGGERS_SEQUENCE_SELECT_3 0x68
48#define ARIZONA_ALWAYS_ON_TRIGGERS_SEQUENCE_SELECT_4 0x6B 48#define ARIZONA_ALWAYS_ON_TRIGGERS_SEQUENCE_SELECT_4 0x69
49#define ARIZONA_ALWAYS_ON_TRIGGERS_SEQUENCE_SELECT_5 0x6C 49#define ARIZONA_ALWAYS_ON_TRIGGERS_SEQUENCE_SELECT_5 0x6A
50#define ARIZONA_ALWAYS_ON_TRIGGERS_SEQUENCE_SELECT_6 0x6D 50#define ARIZONA_ALWAYS_ON_TRIGGERS_SEQUENCE_SELECT_6 0x6B
51#define ARIZONA_ALWAYS_ON_TRIGGERS_SEQUENCE_SELECT_7 0x6C
52#define ARIZONA_ALWAYS_ON_TRIGGERS_SEQUENCE_SELECT_8 0x6D
51#define ARIZONA_COMFORT_NOISE_GENERATOR 0x70 53#define ARIZONA_COMFORT_NOISE_GENERATOR 0x70
52#define ARIZONA_HAPTICS_CONTROL_1 0x90 54#define ARIZONA_HAPTICS_CONTROL_1 0x90
53#define ARIZONA_HAPTICS_CONTROL_2 0x91 55#define ARIZONA_HAPTICS_CONTROL_2 0x91
diff --git a/include/linux/mfd/axp20x.h b/include/linux/mfd/axp20x.h
new file mode 100644
index 000000000000..d0e31a2287ac
--- /dev/null
+++ b/include/linux/mfd/axp20x.h
@@ -0,0 +1,180 @@
1/*
2 * Functions and registers to access AXP20X power management chip.
3 *
4 * Copyright (C) 2013, Carlo Caione <carlo@caione.org>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifndef __LINUX_MFD_AXP20X_H
12#define __LINUX_MFD_AXP20X_H
13
14enum {
15 AXP202_ID = 0,
16 AXP209_ID,
17};
18
19#define AXP20X_DATACACHE(m) (0x04 + (m))
20
21/* Power supply */
22#define AXP20X_PWR_INPUT_STATUS 0x00
23#define AXP20X_PWR_OP_MODE 0x01
24#define AXP20X_USB_OTG_STATUS 0x02
25#define AXP20X_PWR_OUT_CTRL 0x12
26#define AXP20X_DCDC2_V_OUT 0x23
27#define AXP20X_DCDC2_LDO3_V_SCAL 0x25
28#define AXP20X_DCDC3_V_OUT 0x27
29#define AXP20X_LDO24_V_OUT 0x28
30#define AXP20X_LDO3_V_OUT 0x29
31#define AXP20X_VBUS_IPSOUT_MGMT 0x30
32#define AXP20X_V_OFF 0x31
33#define AXP20X_OFF_CTRL 0x32
34#define AXP20X_CHRG_CTRL1 0x33
35#define AXP20X_CHRG_CTRL2 0x34
36#define AXP20X_CHRG_BAK_CTRL 0x35
37#define AXP20X_PEK_KEY 0x36
38#define AXP20X_DCDC_FREQ 0x37
39#define AXP20X_V_LTF_CHRG 0x38
40#define AXP20X_V_HTF_CHRG 0x39
41#define AXP20X_APS_WARN_L1 0x3a
42#define AXP20X_APS_WARN_L2 0x3b
43#define AXP20X_V_LTF_DISCHRG 0x3c
44#define AXP20X_V_HTF_DISCHRG 0x3d
45
46/* Interrupt */
47#define AXP20X_IRQ1_EN 0x40
48#define AXP20X_IRQ2_EN 0x41
49#define AXP20X_IRQ3_EN 0x42
50#define AXP20X_IRQ4_EN 0x43
51#define AXP20X_IRQ5_EN 0x44
52#define AXP20X_IRQ1_STATE 0x48
53#define AXP20X_IRQ2_STATE 0x49
54#define AXP20X_IRQ3_STATE 0x4a
55#define AXP20X_IRQ4_STATE 0x4b
56#define AXP20X_IRQ5_STATE 0x4c
57
58/* ADC */
59#define AXP20X_ACIN_V_ADC_H 0x56
60#define AXP20X_ACIN_V_ADC_L 0x57
61#define AXP20X_ACIN_I_ADC_H 0x58
62#define AXP20X_ACIN_I_ADC_L 0x59
63#define AXP20X_VBUS_V_ADC_H 0x5a
64#define AXP20X_VBUS_V_ADC_L 0x5b
65#define AXP20X_VBUS_I_ADC_H 0x5c
66#define AXP20X_VBUS_I_ADC_L 0x5d
67#define AXP20X_TEMP_ADC_H 0x5e
68#define AXP20X_TEMP_ADC_L 0x5f
69#define AXP20X_TS_IN_H 0x62
70#define AXP20X_TS_IN_L 0x63
71#define AXP20X_GPIO0_V_ADC_H 0x64
72#define AXP20X_GPIO0_V_ADC_L 0x65
73#define AXP20X_GPIO1_V_ADC_H 0x66
74#define AXP20X_GPIO1_V_ADC_L 0x67
75#define AXP20X_PWR_BATT_H 0x70
76#define AXP20X_PWR_BATT_M 0x71
77#define AXP20X_PWR_BATT_L 0x72
78#define AXP20X_BATT_V_H 0x78
79#define AXP20X_BATT_V_L 0x79
80#define AXP20X_BATT_CHRG_I_H 0x7a
81#define AXP20X_BATT_CHRG_I_L 0x7b
82#define AXP20X_BATT_DISCHRG_I_H 0x7c
83#define AXP20X_BATT_DISCHRG_I_L 0x7d
84#define AXP20X_IPSOUT_V_HIGH_H 0x7e
85#define AXP20X_IPSOUT_V_HIGH_L 0x7f
86
87/* Power supply */
88#define AXP20X_DCDC_MODE 0x80
89#define AXP20X_ADC_EN1 0x82
90#define AXP20X_ADC_EN2 0x83
91#define AXP20X_ADC_RATE 0x84
92#define AXP20X_GPIO10_IN_RANGE 0x85
93#define AXP20X_GPIO1_ADC_IRQ_RIS 0x86
94#define AXP20X_GPIO1_ADC_IRQ_FAL 0x87
95#define AXP20X_TIMER_CTRL 0x8a
96#define AXP20X_VBUS_MON 0x8b
97#define AXP20X_OVER_TMP 0x8f
98
99/* GPIO */
100#define AXP20X_GPIO0_CTRL 0x90
101#define AXP20X_LDO5_V_OUT 0x91
102#define AXP20X_GPIO1_CTRL 0x92
103#define AXP20X_GPIO2_CTRL 0x93
104#define AXP20X_GPIO20_SS 0x94
105#define AXP20X_GPIO3_CTRL 0x95
106
107/* Battery */
108#define AXP20X_CHRG_CC_31_24 0xb0
109#define AXP20X_CHRG_CC_23_16 0xb1
110#define AXP20X_CHRG_CC_15_8 0xb2
111#define AXP20X_CHRG_CC_7_0 0xb3
112#define AXP20X_DISCHRG_CC_31_24 0xb4
113#define AXP20X_DISCHRG_CC_23_16 0xb5
114#define AXP20X_DISCHRG_CC_15_8 0xb6
115#define AXP20X_DISCHRG_CC_7_0 0xb7
116#define AXP20X_CC_CTRL 0xb8
117#define AXP20X_FG_RES 0xb9
118
119/* Regulators IDs */
120enum {
121 AXP20X_LDO1 = 0,
122 AXP20X_LDO2,
123 AXP20X_LDO3,
124 AXP20X_LDO4,
125 AXP20X_LDO5,
126 AXP20X_DCDC2,
127 AXP20X_DCDC3,
128 AXP20X_REG_ID_MAX,
129};
130
131/* IRQs */
132enum {
133 AXP20X_IRQ_ACIN_OVER_V = 1,
134 AXP20X_IRQ_ACIN_PLUGIN,
135 AXP20X_IRQ_ACIN_REMOVAL,
136 AXP20X_IRQ_VBUS_OVER_V,
137 AXP20X_IRQ_VBUS_PLUGIN,
138 AXP20X_IRQ_VBUS_REMOVAL,
139 AXP20X_IRQ_VBUS_V_LOW,
140 AXP20X_IRQ_BATT_PLUGIN,
141 AXP20X_IRQ_BATT_REMOVAL,
142 AXP20X_IRQ_BATT_ENT_ACT_MODE,
143 AXP20X_IRQ_BATT_EXIT_ACT_MODE,
144 AXP20X_IRQ_CHARG,
145 AXP20X_IRQ_CHARG_DONE,
146 AXP20X_IRQ_BATT_TEMP_HIGH,
147 AXP20X_IRQ_BATT_TEMP_LOW,
148 AXP20X_IRQ_DIE_TEMP_HIGH,
149 AXP20X_IRQ_CHARG_I_LOW,
150 AXP20X_IRQ_DCDC1_V_LONG,
151 AXP20X_IRQ_DCDC2_V_LONG,
152 AXP20X_IRQ_DCDC3_V_LONG,
153 AXP20X_IRQ_PEK_SHORT = 22,
154 AXP20X_IRQ_PEK_LONG,
155 AXP20X_IRQ_N_OE_PWR_ON,
156 AXP20X_IRQ_N_OE_PWR_OFF,
157 AXP20X_IRQ_VBUS_VALID,
158 AXP20X_IRQ_VBUS_NOT_VALID,
159 AXP20X_IRQ_VBUS_SESS_VALID,
160 AXP20X_IRQ_VBUS_SESS_END,
161 AXP20X_IRQ_LOW_PWR_LVL1,
162 AXP20X_IRQ_LOW_PWR_LVL2,
163 AXP20X_IRQ_TIMER,
164 AXP20X_IRQ_PEK_RIS_EDGE,
165 AXP20X_IRQ_PEK_FAL_EDGE,
166 AXP20X_IRQ_GPIO3_INPUT,
167 AXP20X_IRQ_GPIO2_INPUT,
168 AXP20X_IRQ_GPIO1_INPUT,
169 AXP20X_IRQ_GPIO0_INPUT,
170};
171
172struct axp20x_dev {
173 struct device *dev;
174 struct i2c_client *i2c_client;
175 struct regmap *regmap;
176 struct regmap_irq_chip_data *regmap_irqc;
177 long variant;
178};
179
180#endif /* __LINUX_MFD_AXP20X_H */
diff --git a/include/linux/mfd/bcm590xx.h b/include/linux/mfd/bcm590xx.h
index 434df2d4e587..267aedee1c7a 100644
--- a/include/linux/mfd/bcm590xx.h
+++ b/include/linux/mfd/bcm590xx.h
@@ -19,12 +19,15 @@
19#include <linux/regmap.h> 19#include <linux/regmap.h>
20 20
21/* max register address */ 21/* max register address */
22#define BCM590XX_MAX_REGISTER 0xe7 22#define BCM590XX_MAX_REGISTER_PRI 0xe7
23#define BCM590XX_MAX_REGISTER_SEC 0xf0
23 24
24struct bcm590xx { 25struct bcm590xx {
25 struct device *dev; 26 struct device *dev;
26 struct i2c_client *i2c_client; 27 struct i2c_client *i2c_pri;
27 struct regmap *regmap; 28 struct i2c_client *i2c_sec;
29 struct regmap *regmap_pri;
30 struct regmap *regmap_sec;
28 unsigned int id; 31 unsigned int id;
29}; 32};
30 33
diff --git a/include/linux/mfd/core.h b/include/linux/mfd/core.h
index bdba8c61207b..f543de91ce19 100644
--- a/include/linux/mfd/core.h
+++ b/include/linux/mfd/core.h
@@ -63,7 +63,7 @@ struct mfd_cell {
63 /* A list of regulator supplies that should be mapped to the MFD 63 /* A list of regulator supplies that should be mapped to the MFD
64 * device rather than the child device when requested 64 * device rather than the child device when requested
65 */ 65 */
66 const char **parent_supplies; 66 const char * const *parent_supplies;
67 int num_parent_supplies; 67 int num_parent_supplies;
68}; 68};
69 69
diff --git a/include/linux/mfd/cros_ec.h b/include/linux/mfd/cros_ec.h
index 032af7fc5b2e..887ef4f7bef7 100644
--- a/include/linux/mfd/cros_ec.h
+++ b/include/linux/mfd/cros_ec.h
@@ -29,8 +29,8 @@ enum {
29 EC_MSG_RX_PROTO_BYTES = 3, 29 EC_MSG_RX_PROTO_BYTES = 3,
30 30
31 /* Max length of messages */ 31 /* Max length of messages */
32 EC_MSG_BYTES = EC_HOST_PARAM_SIZE + EC_MSG_TX_PROTO_BYTES, 32 EC_MSG_BYTES = EC_PROTO2_MAX_PARAM_SIZE +
33 33 EC_MSG_TX_PROTO_BYTES,
34}; 34};
35 35
36/** 36/**
diff --git a/include/linux/mfd/cros_ec_commands.h b/include/linux/mfd/cros_ec_commands.h
index 86fd06953bcd..7853a6410d14 100644
--- a/include/linux/mfd/cros_ec_commands.h
+++ b/include/linux/mfd/cros_ec_commands.h
@@ -24,25 +24,12 @@
24#define __CROS_EC_COMMANDS_H 24#define __CROS_EC_COMMANDS_H
25 25
26/* 26/*
27 * Protocol overview 27 * Current version of this protocol
28 * 28 *
29 * request: CMD [ P0 P1 P2 ... Pn S ] 29 * TODO(crosbug.com/p/11223): This is effectively useless; protocol is
30 * response: ERR [ P0 P1 P2 ... Pn S ] 30 * determined in other ways. Remove this once the kernel code no longer
31 * 31 * depends on it.
32 * where the bytes are defined as follow :
33 * - CMD is the command code. (defined by EC_CMD_ constants)
34 * - ERR is the error code. (defined by EC_RES_ constants)
35 * - Px is the optional payload.
36 * it is not sent if the error code is not success.
37 * (defined by ec_params_ and ec_response_ structures)
38 * - S is the checksum which is the sum of all payload bytes.
39 *
40 * On LPC, CMD and ERR are sent/received at EC_LPC_ADDR_KERNEL|USER_CMD
41 * and the payloads are sent/received at EC_LPC_ADDR_KERNEL|USER_PARAM.
42 * On I2C, all bytes are sent serially in the same message.
43 */ 32 */
44
45/* Current version of this protocol */
46#define EC_PROTO_VERSION 0x00000002 33#define EC_PROTO_VERSION 0x00000002
47 34
48/* Command version mask */ 35/* Command version mask */
@@ -57,13 +44,19 @@
57#define EC_LPC_ADDR_HOST_CMD 0x204 44#define EC_LPC_ADDR_HOST_CMD 0x204
58 45
59/* I/O addresses for host command args and params */ 46/* I/O addresses for host command args and params */
60#define EC_LPC_ADDR_HOST_ARGS 0x800 47/* Protocol version 2 */
61#define EC_LPC_ADDR_HOST_PARAM 0x804 48#define EC_LPC_ADDR_HOST_ARGS 0x800 /* And 0x801, 0x802, 0x803 */
62#define EC_HOST_PARAM_SIZE 0x0fc /* Size of param area in bytes */ 49#define EC_LPC_ADDR_HOST_PARAM 0x804 /* For version 2 params; size is
63 50 * EC_PROTO2_MAX_PARAM_SIZE */
64/* I/O addresses for host command params, old interface */ 51/* Protocol version 3 */
65#define EC_LPC_ADDR_OLD_PARAM 0x880 52#define EC_LPC_ADDR_HOST_PACKET 0x800 /* Offset of version 3 packet */
66#define EC_OLD_PARAM_SIZE 0x080 /* Size of param area in bytes */ 53#define EC_LPC_HOST_PACKET_SIZE 0x100 /* Max size of version 3 packet */
54
55/* The actual block is 0x800-0x8ff, but some BIOSes think it's 0x880-0x8ff
56 * and they tell the kernel that so we have to think of it as two parts. */
57#define EC_HOST_CMD_REGION0 0x800
58#define EC_HOST_CMD_REGION1 0x880
59#define EC_HOST_CMD_REGION_SIZE 0x80
67 60
68/* EC command register bit functions */ 61/* EC command register bit functions */
69#define EC_LPC_CMDR_DATA (1 << 0) /* Data ready for host to read */ 62#define EC_LPC_CMDR_DATA (1 << 0) /* Data ready for host to read */
@@ -79,18 +72,22 @@
79#define EC_MEMMAP_TEXT_MAX 8 /* Size of a string in the memory map */ 72#define EC_MEMMAP_TEXT_MAX 8 /* Size of a string in the memory map */
80 73
81/* The offset address of each type of data in mapped memory. */ 74/* The offset address of each type of data in mapped memory. */
82#define EC_MEMMAP_TEMP_SENSOR 0x00 /* Temp sensors */ 75#define EC_MEMMAP_TEMP_SENSOR 0x00 /* Temp sensors 0x00 - 0x0f */
83#define EC_MEMMAP_FAN 0x10 /* Fan speeds */ 76#define EC_MEMMAP_FAN 0x10 /* Fan speeds 0x10 - 0x17 */
84#define EC_MEMMAP_TEMP_SENSOR_B 0x18 /* Temp sensors (second set) */ 77#define EC_MEMMAP_TEMP_SENSOR_B 0x18 /* More temp sensors 0x18 - 0x1f */
85#define EC_MEMMAP_ID 0x20 /* 'E' 'C' */ 78#define EC_MEMMAP_ID 0x20 /* 0x20 == 'E', 0x21 == 'C' */
86#define EC_MEMMAP_ID_VERSION 0x22 /* Version of data in 0x20 - 0x2f */ 79#define EC_MEMMAP_ID_VERSION 0x22 /* Version of data in 0x20 - 0x2f */
87#define EC_MEMMAP_THERMAL_VERSION 0x23 /* Version of data in 0x00 - 0x1f */ 80#define EC_MEMMAP_THERMAL_VERSION 0x23 /* Version of data in 0x00 - 0x1f */
88#define EC_MEMMAP_BATTERY_VERSION 0x24 /* Version of data in 0x40 - 0x7f */ 81#define EC_MEMMAP_BATTERY_VERSION 0x24 /* Version of data in 0x40 - 0x7f */
89#define EC_MEMMAP_SWITCHES_VERSION 0x25 /* Version of data in 0x30 - 0x33 */ 82#define EC_MEMMAP_SWITCHES_VERSION 0x25 /* Version of data in 0x30 - 0x33 */
90#define EC_MEMMAP_EVENTS_VERSION 0x26 /* Version of data in 0x34 - 0x3f */ 83#define EC_MEMMAP_EVENTS_VERSION 0x26 /* Version of data in 0x34 - 0x3f */
91#define EC_MEMMAP_HOST_CMD_FLAGS 0x27 /* Host command interface flags */ 84#define EC_MEMMAP_HOST_CMD_FLAGS 0x27 /* Host cmd interface flags (8 bits) */
92#define EC_MEMMAP_SWITCHES 0x30 85/* Unused 0x28 - 0x2f */
93#define EC_MEMMAP_HOST_EVENTS 0x34 86#define EC_MEMMAP_SWITCHES 0x30 /* 8 bits */
87/* Unused 0x31 - 0x33 */
88#define EC_MEMMAP_HOST_EVENTS 0x34 /* 32 bits */
89/* Reserve 0x38 - 0x3f for additional host event-related stuff */
90/* Battery values are all 32 bits */
94#define EC_MEMMAP_BATT_VOLT 0x40 /* Battery Present Voltage */ 91#define EC_MEMMAP_BATT_VOLT 0x40 /* Battery Present Voltage */
95#define EC_MEMMAP_BATT_RATE 0x44 /* Battery Present Rate */ 92#define EC_MEMMAP_BATT_RATE 0x44 /* Battery Present Rate */
96#define EC_MEMMAP_BATT_CAP 0x48 /* Battery Remaining Capacity */ 93#define EC_MEMMAP_BATT_CAP 0x48 /* Battery Remaining Capacity */
@@ -99,10 +96,24 @@
99#define EC_MEMMAP_BATT_DVLT 0x54 /* Battery Design Voltage */ 96#define EC_MEMMAP_BATT_DVLT 0x54 /* Battery Design Voltage */
100#define EC_MEMMAP_BATT_LFCC 0x58 /* Battery Last Full Charge Capacity */ 97#define EC_MEMMAP_BATT_LFCC 0x58 /* Battery Last Full Charge Capacity */
101#define EC_MEMMAP_BATT_CCNT 0x5c /* Battery Cycle Count */ 98#define EC_MEMMAP_BATT_CCNT 0x5c /* Battery Cycle Count */
99/* Strings are all 8 bytes (EC_MEMMAP_TEXT_MAX) */
102#define EC_MEMMAP_BATT_MFGR 0x60 /* Battery Manufacturer String */ 100#define EC_MEMMAP_BATT_MFGR 0x60 /* Battery Manufacturer String */
103#define EC_MEMMAP_BATT_MODEL 0x68 /* Battery Model Number String */ 101#define EC_MEMMAP_BATT_MODEL 0x68 /* Battery Model Number String */
104#define EC_MEMMAP_BATT_SERIAL 0x70 /* Battery Serial Number String */ 102#define EC_MEMMAP_BATT_SERIAL 0x70 /* Battery Serial Number String */
105#define EC_MEMMAP_BATT_TYPE 0x78 /* Battery Type String */ 103#define EC_MEMMAP_BATT_TYPE 0x78 /* Battery Type String */
104#define EC_MEMMAP_ALS 0x80 /* ALS readings in lux (2 X 16 bits) */
105/* Unused 0x84 - 0x8f */
106#define EC_MEMMAP_ACC_STATUS 0x90 /* Accelerometer status (8 bits )*/
107/* Unused 0x91 */
108#define EC_MEMMAP_ACC_DATA 0x92 /* Accelerometer data 0x92 - 0x9f */
109#define EC_MEMMAP_GYRO_DATA 0xa0 /* Gyroscope data 0xa0 - 0xa5 */
110/* Unused 0xa6 - 0xfe (remember, 0xff is NOT part of the memmap region) */
111
112
113/* Define the format of the accelerometer mapped memory status byte. */
114#define EC_MEMMAP_ACC_STATUS_SAMPLE_ID_MASK 0x0f
115#define EC_MEMMAP_ACC_STATUS_BUSY_BIT (1 << 4)
116#define EC_MEMMAP_ACC_STATUS_PRESENCE_BIT (1 << 7)
106 117
107/* Number of temp sensors at EC_MEMMAP_TEMP_SENSOR */ 118/* Number of temp sensors at EC_MEMMAP_TEMP_SENSOR */
108#define EC_TEMP_SENSOR_ENTRIES 16 119#define EC_TEMP_SENSOR_ENTRIES 16
@@ -112,6 +123,8 @@
112 * Valid only if EC_MEMMAP_THERMAL_VERSION returns >= 2. 123 * Valid only if EC_MEMMAP_THERMAL_VERSION returns >= 2.
113 */ 124 */
114#define EC_TEMP_SENSOR_B_ENTRIES 8 125#define EC_TEMP_SENSOR_B_ENTRIES 8
126
127/* Special values for mapped temperature sensors */
115#define EC_TEMP_SENSOR_NOT_PRESENT 0xff 128#define EC_TEMP_SENSOR_NOT_PRESENT 0xff
116#define EC_TEMP_SENSOR_ERROR 0xfe 129#define EC_TEMP_SENSOR_ERROR 0xfe
117#define EC_TEMP_SENSOR_NOT_POWERED 0xfd 130#define EC_TEMP_SENSOR_NOT_POWERED 0xfd
@@ -122,6 +135,18 @@
122 */ 135 */
123#define EC_TEMP_SENSOR_OFFSET 200 136#define EC_TEMP_SENSOR_OFFSET 200
124 137
138/*
139 * Number of ALS readings at EC_MEMMAP_ALS
140 */
141#define EC_ALS_ENTRIES 2
142
143/*
144 * The default value a temperature sensor will return when it is present but
145 * has not been read this boot. This is a reasonable number to avoid
146 * triggering alarms on the host.
147 */
148#define EC_TEMP_SENSOR_DEFAULT (296 - EC_TEMP_SENSOR_OFFSET)
149
125#define EC_FAN_SPEED_ENTRIES 4 /* Number of fans at EC_MEMMAP_FAN */ 150#define EC_FAN_SPEED_ENTRIES 4 /* Number of fans at EC_MEMMAP_FAN */
126#define EC_FAN_SPEED_NOT_PRESENT 0xffff /* Entry not present */ 151#define EC_FAN_SPEED_NOT_PRESENT 0xffff /* Entry not present */
127#define EC_FAN_SPEED_STALLED 0xfffe /* Fan stalled */ 152#define EC_FAN_SPEED_STALLED 0xfffe /* Fan stalled */
@@ -137,8 +162,8 @@
137#define EC_SWITCH_LID_OPEN 0x01 162#define EC_SWITCH_LID_OPEN 0x01
138#define EC_SWITCH_POWER_BUTTON_PRESSED 0x02 163#define EC_SWITCH_POWER_BUTTON_PRESSED 0x02
139#define EC_SWITCH_WRITE_PROTECT_DISABLED 0x04 164#define EC_SWITCH_WRITE_PROTECT_DISABLED 0x04
140/* Recovery requested via keyboard */ 165/* Was recovery requested via keyboard; now unused. */
141#define EC_SWITCH_KEYBOARD_RECOVERY 0x08 166#define EC_SWITCH_IGNORE1 0x08
142/* Recovery requested via dedicated signal (from servo board) */ 167/* Recovery requested via dedicated signal (from servo board) */
143#define EC_SWITCH_DEDICATED_RECOVERY 0x10 168#define EC_SWITCH_DEDICATED_RECOVERY 0x10
144/* Was fake developer mode switch; now unused. Remove in next refactor. */ 169/* Was fake developer mode switch; now unused. Remove in next refactor. */
@@ -147,10 +172,15 @@
147/* Host command interface flags */ 172/* Host command interface flags */
148/* Host command interface supports LPC args (LPC interface only) */ 173/* Host command interface supports LPC args (LPC interface only) */
149#define EC_HOST_CMD_FLAG_LPC_ARGS_SUPPORTED 0x01 174#define EC_HOST_CMD_FLAG_LPC_ARGS_SUPPORTED 0x01
175/* Host command interface supports version 3 protocol */
176#define EC_HOST_CMD_FLAG_VERSION_3 0x02
150 177
151/* Wireless switch flags */ 178/* Wireless switch flags */
152#define EC_WIRELESS_SWITCH_WLAN 0x01 179#define EC_WIRELESS_SWITCH_ALL ~0x00 /* All flags */
153#define EC_WIRELESS_SWITCH_BLUETOOTH 0x02 180#define EC_WIRELESS_SWITCH_WLAN 0x01 /* WLAN radio */
181#define EC_WIRELESS_SWITCH_BLUETOOTH 0x02 /* Bluetooth radio */
182#define EC_WIRELESS_SWITCH_WWAN 0x04 /* WWAN power */
183#define EC_WIRELESS_SWITCH_WLAN_POWER 0x08 /* WLAN power */
154 184
155/* 185/*
156 * This header file is used in coreboot both in C and ACPI code. The ACPI code 186 * This header file is used in coreboot both in C and ACPI code. The ACPI code
@@ -159,6 +189,14 @@
159 */ 189 */
160#ifndef __ACPI__ 190#ifndef __ACPI__
161 191
192/*
193 * Define __packed if someone hasn't beat us to it. Linux kernel style
194 * checking prefers __packed over __attribute__((packed)).
195 */
196#ifndef __packed
197#define __packed __attribute__((packed))
198#endif
199
162/* LPC command status byte masks */ 200/* LPC command status byte masks */
163/* EC has written a byte in the data register and host hasn't read it yet */ 201/* EC has written a byte in the data register and host hasn't read it yet */
164#define EC_LPC_STATUS_TO_HOST 0x01 202#define EC_LPC_STATUS_TO_HOST 0x01
@@ -198,6 +236,9 @@ enum ec_status {
198 EC_RES_UNAVAILABLE = 9, /* No response available */ 236 EC_RES_UNAVAILABLE = 9, /* No response available */
199 EC_RES_TIMEOUT = 10, /* We got a timeout */ 237 EC_RES_TIMEOUT = 10, /* We got a timeout */
200 EC_RES_OVERFLOW = 11, /* Table / data overflow */ 238 EC_RES_OVERFLOW = 11, /* Table / data overflow */
239 EC_RES_INVALID_HEADER = 12, /* Header contains invalid data */
240 EC_RES_REQUEST_TRUNCATED = 13, /* Didn't get the entire request */
241 EC_RES_RESPONSE_TOO_BIG = 14 /* Response was too big to handle */
201}; 242};
202 243
203/* 244/*
@@ -235,6 +276,16 @@ enum host_event_code {
235 /* Shutdown due to battery level too low */ 276 /* Shutdown due to battery level too low */
236 EC_HOST_EVENT_BATTERY_SHUTDOWN = 17, 277 EC_HOST_EVENT_BATTERY_SHUTDOWN = 17,
237 278
279 /* Suggest that the AP throttle itself */
280 EC_HOST_EVENT_THROTTLE_START = 18,
281 /* Suggest that the AP resume normal speed */
282 EC_HOST_EVENT_THROTTLE_STOP = 19,
283
284 /* Hang detect logic detected a hang and host event timeout expired */
285 EC_HOST_EVENT_HANG_DETECT = 20,
286 /* Hang detect logic detected a hang and warm rebooted the AP */
287 EC_HOST_EVENT_HANG_REBOOT = 21,
288
238 /* 289 /*
239 * The high bit of the event mask is not used as a host event code. If 290 * The high bit of the event mask is not used as a host event code. If
240 * it reads back as set, then the entire event mask should be 291 * it reads back as set, then the entire event mask should be
@@ -279,6 +330,188 @@ struct ec_lpc_host_args {
279 */ 330 */
280#define EC_HOST_ARGS_FLAG_TO_HOST 0x02 331#define EC_HOST_ARGS_FLAG_TO_HOST 0x02
281 332
333/*****************************************************************************/
334/*
335 * Byte codes returned by EC over SPI interface.
336 *
337 * These can be used by the AP to debug the EC interface, and to determine
338 * when the EC is not in a state where it will ever get around to responding
339 * to the AP.
340 *
341 * Example of sequence of bytes read from EC for a current good transfer:
342 * 1. - - AP asserts chip select (CS#)
343 * 2. EC_SPI_OLD_READY - AP sends first byte(s) of request
344 * 3. - - EC starts handling CS# interrupt
345 * 4. EC_SPI_RECEIVING - AP sends remaining byte(s) of request
346 * 5. EC_SPI_PROCESSING - EC starts processing request; AP is clocking in
347 * bytes looking for EC_SPI_FRAME_START
348 * 6. - - EC finishes processing and sets up response
349 * 7. EC_SPI_FRAME_START - AP reads frame byte
350 * 8. (response packet) - AP reads response packet
351 * 9. EC_SPI_PAST_END - Any additional bytes read by AP
352 * 10 - - AP deasserts chip select
353 * 11 - - EC processes CS# interrupt and sets up DMA for
354 * next request
355 *
356 * If the AP is waiting for EC_SPI_FRAME_START and sees any value other than
357 * the following byte values:
358 * EC_SPI_OLD_READY
359 * EC_SPI_RX_READY
360 * EC_SPI_RECEIVING
361 * EC_SPI_PROCESSING
362 *
363 * Then the EC found an error in the request, or was not ready for the request
364 * and lost data. The AP should give up waiting for EC_SPI_FRAME_START,
365 * because the EC is unable to tell when the AP is done sending its request.
366 */
367
368/*
369 * Framing byte which precedes a response packet from the EC. After sending a
370 * request, the AP will clock in bytes until it sees the framing byte, then
371 * clock in the response packet.
372 */
373#define EC_SPI_FRAME_START 0xec
374
375/*
376 * Padding bytes which are clocked out after the end of a response packet.
377 */
378#define EC_SPI_PAST_END 0xed
379
380/*
381 * EC is ready to receive, and has ignored the byte sent by the AP. EC expects
382 * that the AP will send a valid packet header (starting with
383 * EC_COMMAND_PROTOCOL_3) in the next 32 bytes.
384 */
385#define EC_SPI_RX_READY 0xf8
386
387/*
388 * EC has started receiving the request from the AP, but hasn't started
389 * processing it yet.
390 */
391#define EC_SPI_RECEIVING 0xf9
392
393/* EC has received the entire request from the AP and is processing it. */
394#define EC_SPI_PROCESSING 0xfa
395
396/*
397 * EC received bad data from the AP, such as a packet header with an invalid
398 * length. EC will ignore all data until chip select deasserts.
399 */
400#define EC_SPI_RX_BAD_DATA 0xfb
401
402/*
403 * EC received data from the AP before it was ready. That is, the AP asserted
404 * chip select and started clocking data before the EC was ready to receive it.
405 * EC will ignore all data until chip select deasserts.
406 */
407#define EC_SPI_NOT_READY 0xfc
408
409/*
410 * EC was ready to receive a request from the AP. EC has treated the byte sent
411 * by the AP as part of a request packet, or (for old-style ECs) is processing
412 * a fully received packet but is not ready to respond yet.
413 */
414#define EC_SPI_OLD_READY 0xfd
415
416/*****************************************************************************/
417
418/*
419 * Protocol version 2 for I2C and SPI send a request this way:
420 *
421 * 0 EC_CMD_VERSION0 + (command version)
422 * 1 Command number
423 * 2 Length of params = N
424 * 3..N+2 Params, if any
425 * N+3 8-bit checksum of bytes 0..N+2
426 *
427 * The corresponding response is:
428 *
429 * 0 Result code (EC_RES_*)
430 * 1 Length of params = M
431 * 2..M+1 Params, if any
432 * M+2 8-bit checksum of bytes 0..M+1
433 */
434#define EC_PROTO2_REQUEST_HEADER_BYTES 3
435#define EC_PROTO2_REQUEST_TRAILER_BYTES 1
436#define EC_PROTO2_REQUEST_OVERHEAD (EC_PROTO2_REQUEST_HEADER_BYTES + \
437 EC_PROTO2_REQUEST_TRAILER_BYTES)
438
439#define EC_PROTO2_RESPONSE_HEADER_BYTES 2
440#define EC_PROTO2_RESPONSE_TRAILER_BYTES 1
441#define EC_PROTO2_RESPONSE_OVERHEAD (EC_PROTO2_RESPONSE_HEADER_BYTES + \
442 EC_PROTO2_RESPONSE_TRAILER_BYTES)
443
444/* Parameter length was limited by the LPC interface */
445#define EC_PROTO2_MAX_PARAM_SIZE 0xfc
446
447/* Maximum request and response packet sizes for protocol version 2 */
448#define EC_PROTO2_MAX_REQUEST_SIZE (EC_PROTO2_REQUEST_OVERHEAD + \
449 EC_PROTO2_MAX_PARAM_SIZE)
450#define EC_PROTO2_MAX_RESPONSE_SIZE (EC_PROTO2_RESPONSE_OVERHEAD + \
451 EC_PROTO2_MAX_PARAM_SIZE)
452
453/*****************************************************************************/
454
455/*
456 * Value written to legacy command port / prefix byte to indicate protocol
457 * 3+ structs are being used. Usage is bus-dependent.
458 */
459#define EC_COMMAND_PROTOCOL_3 0xda
460
461#define EC_HOST_REQUEST_VERSION 3
462
463/* Version 3 request from host */
464struct ec_host_request {
465 /* Struct version (=3)
466 *
467 * EC will return EC_RES_INVALID_HEADER if it receives a header with a
468 * version it doesn't know how to parse.
469 */
470 uint8_t struct_version;
471
472 /*
473 * Checksum of request and data; sum of all bytes including checksum
474 * should total to 0.
475 */
476 uint8_t checksum;
477
478 /* Command code */
479 uint16_t command;
480
481 /* Command version */
482 uint8_t command_version;
483
484 /* Unused byte in current protocol version; set to 0 */
485 uint8_t reserved;
486
487 /* Length of data which follows this header */
488 uint16_t data_len;
489} __packed;
490
491#define EC_HOST_RESPONSE_VERSION 3
492
493/* Version 3 response from EC */
494struct ec_host_response {
495 /* Struct version (=3) */
496 uint8_t struct_version;
497
498 /*
499 * Checksum of response and data; sum of all bytes including checksum
500 * should total to 0.
501 */
502 uint8_t checksum;
503
504 /* Result code (EC_RES_*) */
505 uint16_t result;
506
507 /* Length of data which follows this header */
508 uint16_t data_len;
509
510 /* Unused bytes in current protocol version; set to 0 */
511 uint16_t reserved;
512} __packed;
513
514/*****************************************************************************/
282/* 515/*
283 * Notes on commands: 516 * Notes on commands:
284 * 517 *
@@ -418,6 +651,68 @@ struct ec_response_get_comms_status {
418 uint32_t flags; /* Mask of enum ec_comms_status */ 651 uint32_t flags; /* Mask of enum ec_comms_status */
419} __packed; 652} __packed;
420 653
654/* Fake a variety of responses, purely for testing purposes. */
655#define EC_CMD_TEST_PROTOCOL 0x0a
656
657/* Tell the EC what to send back to us. */
658struct ec_params_test_protocol {
659 uint32_t ec_result;
660 uint32_t ret_len;
661 uint8_t buf[32];
662} __packed;
663
664/* Here it comes... */
665struct ec_response_test_protocol {
666 uint8_t buf[32];
667} __packed;
668
669/* Get prococol information */
670#define EC_CMD_GET_PROTOCOL_INFO 0x0b
671
672/* Flags for ec_response_get_protocol_info.flags */
673/* EC_RES_IN_PROGRESS may be returned if a command is slow */
674#define EC_PROTOCOL_INFO_IN_PROGRESS_SUPPORTED (1 << 0)
675
676struct ec_response_get_protocol_info {
677 /* Fields which exist if at least protocol version 3 supported */
678
679 /* Bitmask of protocol versions supported (1 << n means version n)*/
680 uint32_t protocol_versions;
681
682 /* Maximum request packet size, in bytes */
683 uint16_t max_request_packet_size;
684
685 /* Maximum response packet size, in bytes */
686 uint16_t max_response_packet_size;
687
688 /* Flags; see EC_PROTOCOL_INFO_* */
689 uint32_t flags;
690} __packed;
691
692
693/*****************************************************************************/
694/* Get/Set miscellaneous values */
695
696/* The upper byte of .flags tells what to do (nothing means "get") */
697#define EC_GSV_SET 0x80000000
698
699/* The lower three bytes of .flags identifies the parameter, if that has
700 meaning for an individual command. */
701#define EC_GSV_PARAM_MASK 0x00ffffff
702
703struct ec_params_get_set_value {
704 uint32_t flags;
705 uint32_t value;
706} __packed;
707
708struct ec_response_get_set_value {
709 uint32_t flags;
710 uint32_t value;
711} __packed;
712
713/* More than one command can use these structs to get/set paramters. */
714#define EC_CMD_GSV_PAUSE_IN_S5 0x0c
715
421 716
422/*****************************************************************************/ 717/*****************************************************************************/
423/* Flash commands */ 718/* Flash commands */
@@ -425,6 +720,7 @@ struct ec_response_get_comms_status {
425/* Get flash info */ 720/* Get flash info */
426#define EC_CMD_FLASH_INFO 0x10 721#define EC_CMD_FLASH_INFO 0x10
427 722
723/* Version 0 returns these fields */
428struct ec_response_flash_info { 724struct ec_response_flash_info {
429 /* Usable flash size, in bytes */ 725 /* Usable flash size, in bytes */
430 uint32_t flash_size; 726 uint32_t flash_size;
@@ -445,6 +741,37 @@ struct ec_response_flash_info {
445 uint32_t protect_block_size; 741 uint32_t protect_block_size;
446} __packed; 742} __packed;
447 743
744/* Flags for version 1+ flash info command */
745/* EC flash erases bits to 0 instead of 1 */
746#define EC_FLASH_INFO_ERASE_TO_0 (1 << 0)
747
748/*
749 * Version 1 returns the same initial fields as version 0, with additional
750 * fields following.
751 *
752 * gcc anonymous structs don't seem to get along with the __packed directive;
753 * if they did we'd define the version 0 struct as a sub-struct of this one.
754 */
755struct ec_response_flash_info_1 {
756 /* Version 0 fields; see above for description */
757 uint32_t flash_size;
758 uint32_t write_block_size;
759 uint32_t erase_block_size;
760 uint32_t protect_block_size;
761
762 /* Version 1 adds these fields: */
763 /*
764 * Ideal write size in bytes. Writes will be fastest if size is
765 * exactly this and offset is a multiple of this. For example, an EC
766 * may have a write buffer which can do half-page operations if data is
767 * aligned, and a slower word-at-a-time write mode.
768 */
769 uint32_t write_ideal_size;
770
771 /* Flags; see EC_FLASH_INFO_* */
772 uint32_t flags;
773} __packed;
774
448/* 775/*
449 * Read flash 776 * Read flash
450 * 777 *
@@ -459,15 +786,15 @@ struct ec_params_flash_read {
459 786
460/* Write flash */ 787/* Write flash */
461#define EC_CMD_FLASH_WRITE 0x12 788#define EC_CMD_FLASH_WRITE 0x12
789#define EC_VER_FLASH_WRITE 1
790
791/* Version 0 of the flash command supported only 64 bytes of data */
792#define EC_FLASH_WRITE_VER0_SIZE 64
462 793
463struct ec_params_flash_write { 794struct ec_params_flash_write {
464 uint32_t offset; /* Byte offset to write */ 795 uint32_t offset; /* Byte offset to write */
465 uint32_t size; /* Size to write in bytes */ 796 uint32_t size; /* Size to write in bytes */
466 /* 797 /* Followed by data to write */
467 * Data to write. Could really use EC_PARAM_SIZE - 8, but tidiest to
468 * use a power of 2 so writes stay aligned.
469 */
470 uint8_t data[64];
471} __packed; 798} __packed;
472 799
473/* Erase flash */ 800/* Erase flash */
@@ -543,7 +870,7 @@ struct ec_response_flash_protect {
543 870
544enum ec_flash_region { 871enum ec_flash_region {
545 /* Region which holds read-only EC image */ 872 /* Region which holds read-only EC image */
546 EC_FLASH_REGION_RO, 873 EC_FLASH_REGION_RO = 0,
547 /* Region which holds rewritable EC image */ 874 /* Region which holds rewritable EC image */
548 EC_FLASH_REGION_RW, 875 EC_FLASH_REGION_RW,
549 /* 876 /*
@@ -551,6 +878,8 @@ enum ec_flash_region {
551 * EC_FLASH_REGION_RO) 878 * EC_FLASH_REGION_RO)
552 */ 879 */
553 EC_FLASH_REGION_WP_RO, 880 EC_FLASH_REGION_WP_RO,
881 /* Number of regions */
882 EC_FLASH_REGION_COUNT,
554}; 883};
555 884
556struct ec_params_flash_region_info { 885struct ec_params_flash_region_info {
@@ -639,15 +968,15 @@ struct rgb_s {
639 */ 968 */
640struct lightbar_params { 969struct lightbar_params {
641 /* Timing */ 970 /* Timing */
642 int google_ramp_up; 971 int32_t google_ramp_up;
643 int google_ramp_down; 972 int32_t google_ramp_down;
644 int s3s0_ramp_up; 973 int32_t s3s0_ramp_up;
645 int s0_tick_delay[2]; /* AC=0/1 */ 974 int32_t s0_tick_delay[2]; /* AC=0/1 */
646 int s0a_tick_delay[2]; /* AC=0/1 */ 975 int32_t s0a_tick_delay[2]; /* AC=0/1 */
647 int s0s3_ramp_down; 976 int32_t s0s3_ramp_down;
648 int s3_sleep_for; 977 int32_t s3_sleep_for;
649 int s3_ramp_up; 978 int32_t s3_ramp_up;
650 int s3_ramp_down; 979 int32_t s3_ramp_down;
651 980
652 /* Oscillation */ 981 /* Oscillation */
653 uint8_t new_s0; 982 uint8_t new_s0;
@@ -676,7 +1005,7 @@ struct ec_params_lightbar {
676 union { 1005 union {
677 struct { 1006 struct {
678 /* no args */ 1007 /* no args */
679 } dump, off, on, init, get_seq, get_params; 1008 } dump, off, on, init, get_seq, get_params, version;
680 1009
681 struct num { 1010 struct num {
682 uint8_t num; 1011 uint8_t num;
@@ -710,6 +1039,11 @@ struct ec_response_lightbar {
710 1039
711 struct lightbar_params get_params; 1040 struct lightbar_params get_params;
712 1041
1042 struct version {
1043 uint32_t num;
1044 uint32_t flags;
1045 } version;
1046
713 struct { 1047 struct {
714 /* no return params */ 1048 /* no return params */
715 } off, on, init, brightness, seq, reg, rgb, demo, set_params; 1049 } off, on, init, brightness, seq, reg, rgb, demo, set_params;
@@ -730,10 +1064,62 @@ enum lightbar_command {
730 LIGHTBAR_CMD_DEMO = 9, 1064 LIGHTBAR_CMD_DEMO = 9,
731 LIGHTBAR_CMD_GET_PARAMS = 10, 1065 LIGHTBAR_CMD_GET_PARAMS = 10,
732 LIGHTBAR_CMD_SET_PARAMS = 11, 1066 LIGHTBAR_CMD_SET_PARAMS = 11,
1067 LIGHTBAR_CMD_VERSION = 12,
733 LIGHTBAR_NUM_CMDS 1068 LIGHTBAR_NUM_CMDS
734}; 1069};
735 1070
736/*****************************************************************************/ 1071/*****************************************************************************/
1072/* LED control commands */
1073
1074#define EC_CMD_LED_CONTROL 0x29
1075
1076enum ec_led_id {
1077 /* LED to indicate battery state of charge */
1078 EC_LED_ID_BATTERY_LED = 0,
1079 /*
1080 * LED to indicate system power state (on or in suspend).
1081 * May be on power button or on C-panel.
1082 */
1083 EC_LED_ID_POWER_LED,
1084 /* LED on power adapter or its plug */
1085 EC_LED_ID_ADAPTER_LED,
1086
1087 EC_LED_ID_COUNT
1088};
1089
1090/* LED control flags */
1091#define EC_LED_FLAGS_QUERY (1 << 0) /* Query LED capability only */
1092#define EC_LED_FLAGS_AUTO (1 << 1) /* Switch LED back to automatic control */
1093
1094enum ec_led_colors {
1095 EC_LED_COLOR_RED = 0,
1096 EC_LED_COLOR_GREEN,
1097 EC_LED_COLOR_BLUE,
1098 EC_LED_COLOR_YELLOW,
1099 EC_LED_COLOR_WHITE,
1100
1101 EC_LED_COLOR_COUNT
1102};
1103
1104struct ec_params_led_control {
1105 uint8_t led_id; /* Which LED to control */
1106 uint8_t flags; /* Control flags */
1107
1108 uint8_t brightness[EC_LED_COLOR_COUNT];
1109} __packed;
1110
1111struct ec_response_led_control {
1112 /*
1113 * Available brightness value range.
1114 *
1115 * Range 0 means color channel not present.
1116 * Range 1 means on/off control.
1117 * Other values means the LED is control by PWM.
1118 */
1119 uint8_t brightness_range[EC_LED_COLOR_COUNT];
1120} __packed;
1121
1122/*****************************************************************************/
737/* Verified boot commands */ 1123/* Verified boot commands */
738 1124
739/* 1125/*
@@ -790,6 +1176,181 @@ enum ec_vboot_hash_status {
790#define EC_VBOOT_HASH_OFFSET_RW 0xfffffffd 1176#define EC_VBOOT_HASH_OFFSET_RW 0xfffffffd
791 1177
792/*****************************************************************************/ 1178/*****************************************************************************/
1179/*
1180 * Motion sense commands. We'll make separate structs for sub-commands with
1181 * different input args, so that we know how much to expect.
1182 */
1183#define EC_CMD_MOTION_SENSE_CMD 0x2B
1184
1185/* Motion sense commands */
1186enum motionsense_command {
1187 /*
1188 * Dump command returns all motion sensor data including motion sense
1189 * module flags and individual sensor flags.
1190 */
1191 MOTIONSENSE_CMD_DUMP = 0,
1192
1193 /*
1194 * Info command returns data describing the details of a given sensor,
1195 * including enum motionsensor_type, enum motionsensor_location, and
1196 * enum motionsensor_chip.
1197 */
1198 MOTIONSENSE_CMD_INFO = 1,
1199
1200 /*
1201 * EC Rate command is a setter/getter command for the EC sampling rate
1202 * of all motion sensors in milliseconds.
1203 */
1204 MOTIONSENSE_CMD_EC_RATE = 2,
1205
1206 /*
1207 * Sensor ODR command is a setter/getter command for the output data
1208 * rate of a specific motion sensor in millihertz.
1209 */
1210 MOTIONSENSE_CMD_SENSOR_ODR = 3,
1211
1212 /*
1213 * Sensor range command is a setter/getter command for the range of
1214 * a specified motion sensor in +/-G's or +/- deg/s.
1215 */
1216 MOTIONSENSE_CMD_SENSOR_RANGE = 4,
1217
1218 /*
1219 * Setter/getter command for the keyboard wake angle. When the lid
1220 * angle is greater than this value, keyboard wake is disabled in S3,
1221 * and when the lid angle goes less than this value, keyboard wake is
1222 * enabled. Note, the lid angle measurement is an approximate,
1223 * un-calibrated value, hence the wake angle isn't exact.
1224 */
1225 MOTIONSENSE_CMD_KB_WAKE_ANGLE = 5,
1226
1227 /* Number of motionsense sub-commands. */
1228 MOTIONSENSE_NUM_CMDS
1229};
1230
1231enum motionsensor_id {
1232 EC_MOTION_SENSOR_ACCEL_BASE = 0,
1233 EC_MOTION_SENSOR_ACCEL_LID = 1,
1234 EC_MOTION_SENSOR_GYRO = 2,
1235
1236 /*
1237 * Note, if more sensors are added and this count changes, the padding
1238 * in ec_response_motion_sense dump command must be modified.
1239 */
1240 EC_MOTION_SENSOR_COUNT = 3
1241};
1242
1243/* List of motion sensor types. */
1244enum motionsensor_type {
1245 MOTIONSENSE_TYPE_ACCEL = 0,
1246 MOTIONSENSE_TYPE_GYRO = 1,
1247};
1248
1249/* List of motion sensor locations. */
1250enum motionsensor_location {
1251 MOTIONSENSE_LOC_BASE = 0,
1252 MOTIONSENSE_LOC_LID = 1,
1253};
1254
1255/* List of motion sensor chips. */
1256enum motionsensor_chip {
1257 MOTIONSENSE_CHIP_KXCJ9 = 0,
1258};
1259
1260/* Module flag masks used for the dump sub-command. */
1261#define MOTIONSENSE_MODULE_FLAG_ACTIVE (1<<0)
1262
1263/* Sensor flag masks used for the dump sub-command. */
1264#define MOTIONSENSE_SENSOR_FLAG_PRESENT (1<<0)
1265
1266/*
1267 * Send this value for the data element to only perform a read. If you
1268 * send any other value, the EC will interpret it as data to set and will
1269 * return the actual value set.
1270 */
1271#define EC_MOTION_SENSE_NO_VALUE -1
1272
1273struct ec_params_motion_sense {
1274 uint8_t cmd;
1275 union {
1276 /* Used for MOTIONSENSE_CMD_DUMP. */
1277 struct {
1278 /* no args */
1279 } dump;
1280
1281 /*
1282 * Used for MOTIONSENSE_CMD_EC_RATE and
1283 * MOTIONSENSE_CMD_KB_WAKE_ANGLE.
1284 */
1285 struct {
1286 /* Data to set or EC_MOTION_SENSE_NO_VALUE to read. */
1287 int16_t data;
1288 } ec_rate, kb_wake_angle;
1289
1290 /* Used for MOTIONSENSE_CMD_INFO. */
1291 struct {
1292 /* Should be element of enum motionsensor_id. */
1293 uint8_t sensor_num;
1294 } info;
1295
1296 /*
1297 * Used for MOTIONSENSE_CMD_SENSOR_ODR and
1298 * MOTIONSENSE_CMD_SENSOR_RANGE.
1299 */
1300 struct {
1301 /* Should be element of enum motionsensor_id. */
1302 uint8_t sensor_num;
1303
1304 /* Rounding flag, true for round-up, false for down. */
1305 uint8_t roundup;
1306
1307 uint16_t reserved;
1308
1309 /* Data to set or EC_MOTION_SENSE_NO_VALUE to read. */
1310 int32_t data;
1311 } sensor_odr, sensor_range;
1312 };
1313} __packed;
1314
1315struct ec_response_motion_sense {
1316 union {
1317 /* Used for MOTIONSENSE_CMD_DUMP. */
1318 struct {
1319 /* Flags representing the motion sensor module. */
1320 uint8_t module_flags;
1321
1322 /* Flags for each sensor in enum motionsensor_id. */
1323 uint8_t sensor_flags[EC_MOTION_SENSOR_COUNT];
1324
1325 /* Array of all sensor data. Each sensor is 3-axis. */
1326 int16_t data[3*EC_MOTION_SENSOR_COUNT];
1327 } dump;
1328
1329 /* Used for MOTIONSENSE_CMD_INFO. */
1330 struct {
1331 /* Should be element of enum motionsensor_type. */
1332 uint8_t type;
1333
1334 /* Should be element of enum motionsensor_location. */
1335 uint8_t location;
1336
1337 /* Should be element of enum motionsensor_chip. */
1338 uint8_t chip;
1339 } info;
1340
1341 /*
1342 * Used for MOTIONSENSE_CMD_EC_RATE, MOTIONSENSE_CMD_SENSOR_ODR,
1343 * MOTIONSENSE_CMD_SENSOR_RANGE, and
1344 * MOTIONSENSE_CMD_KB_WAKE_ANGLE.
1345 */
1346 struct {
1347 /* Current value of the parameter queried. */
1348 int32_t ret;
1349 } ec_rate, sensor_odr, sensor_range, kb_wake_angle;
1350 };
1351} __packed;
1352
1353/*****************************************************************************/
793/* USB charging control commands */ 1354/* USB charging control commands */
794 1355
795/* Set USB port charging mode */ 1356/* Set USB port charging mode */
@@ -868,20 +1429,27 @@ struct ec_response_port80_last_boot {
868} __packed; 1429} __packed;
869 1430
870/*****************************************************************************/ 1431/*****************************************************************************/
871/* Thermal engine commands */ 1432/* Thermal engine commands. Note that there are two implementations. We'll
1433 * reuse the command number, but the data and behavior is incompatible.
1434 * Version 0 is what originally shipped on Link.
1435 * Version 1 separates the CPU thermal limits from the fan control.
1436 */
872 1437
873/* Set thershold value */
874#define EC_CMD_THERMAL_SET_THRESHOLD 0x50 1438#define EC_CMD_THERMAL_SET_THRESHOLD 0x50
1439#define EC_CMD_THERMAL_GET_THRESHOLD 0x51
1440
1441/* The version 0 structs are opaque. You have to know what they are for
1442 * the get/set commands to make any sense.
1443 */
875 1444
1445/* Version 0 - set */
876struct ec_params_thermal_set_threshold { 1446struct ec_params_thermal_set_threshold {
877 uint8_t sensor_type; 1447 uint8_t sensor_type;
878 uint8_t threshold_id; 1448 uint8_t threshold_id;
879 uint16_t value; 1449 uint16_t value;
880} __packed; 1450} __packed;
881 1451
882/* Get threshold value */ 1452/* Version 0 - get */
883#define EC_CMD_THERMAL_GET_THRESHOLD 0x51
884
885struct ec_params_thermal_get_threshold { 1453struct ec_params_thermal_get_threshold {
886 uint8_t sensor_type; 1454 uint8_t sensor_type;
887 uint8_t threshold_id; 1455 uint8_t threshold_id;
@@ -891,6 +1459,41 @@ struct ec_response_thermal_get_threshold {
891 uint16_t value; 1459 uint16_t value;
892} __packed; 1460} __packed;
893 1461
1462
1463/* The version 1 structs are visible. */
1464enum ec_temp_thresholds {
1465 EC_TEMP_THRESH_WARN = 0,
1466 EC_TEMP_THRESH_HIGH,
1467 EC_TEMP_THRESH_HALT,
1468
1469 EC_TEMP_THRESH_COUNT
1470};
1471
1472/* Thermal configuration for one temperature sensor. Temps are in degrees K.
1473 * Zero values will be silently ignored by the thermal task.
1474 */
1475struct ec_thermal_config {
1476 uint32_t temp_host[EC_TEMP_THRESH_COUNT]; /* levels of hotness */
1477 uint32_t temp_fan_off; /* no active cooling needed */
1478 uint32_t temp_fan_max; /* max active cooling needed */
1479} __packed;
1480
1481/* Version 1 - get config for one sensor. */
1482struct ec_params_thermal_get_threshold_v1 {
1483 uint32_t sensor_num;
1484} __packed;
1485/* This returns a struct ec_thermal_config */
1486
1487/* Version 1 - set config for one sensor.
1488 * Use read-modify-write for best results! */
1489struct ec_params_thermal_set_threshold_v1 {
1490 uint32_t sensor_num;
1491 struct ec_thermal_config cfg;
1492} __packed;
1493/* This returns no data */
1494
1495/****************************************************************************/
1496
894/* Toggle automatic fan control */ 1497/* Toggle automatic fan control */
895#define EC_CMD_THERMAL_AUTO_FAN_CTRL 0x52 1498#define EC_CMD_THERMAL_AUTO_FAN_CTRL 0x52
896 1499
@@ -920,6 +1523,18 @@ struct ec_params_tmp006_set_calibration {
920 float b2; 1523 float b2;
921} __packed; 1524} __packed;
922 1525
1526/* Read raw TMP006 data */
1527#define EC_CMD_TMP006_GET_RAW 0x55
1528
1529struct ec_params_tmp006_get_raw {
1530 uint8_t index;
1531} __packed;
1532
1533struct ec_response_tmp006_get_raw {
1534 int32_t t; /* In 1/100 K */
1535 int32_t v; /* In nV */
1536};
1537
923/*****************************************************************************/ 1538/*****************************************************************************/
924/* MKBP - Matrix KeyBoard Protocol */ 1539/* MKBP - Matrix KeyBoard Protocol */
925 1540
@@ -1118,11 +1733,41 @@ struct ec_params_switch_enable_backlight {
1118 1733
1119/* Enable/disable WLAN/Bluetooth */ 1734/* Enable/disable WLAN/Bluetooth */
1120#define EC_CMD_SWITCH_ENABLE_WIRELESS 0x91 1735#define EC_CMD_SWITCH_ENABLE_WIRELESS 0x91
1736#define EC_VER_SWITCH_ENABLE_WIRELESS 1
1121 1737
1122struct ec_params_switch_enable_wireless { 1738/* Version 0 params; no response */
1739struct ec_params_switch_enable_wireless_v0 {
1123 uint8_t enabled; 1740 uint8_t enabled;
1124} __packed; 1741} __packed;
1125 1742
1743/* Version 1 params */
1744struct ec_params_switch_enable_wireless_v1 {
1745 /* Flags to enable now */
1746 uint8_t now_flags;
1747
1748 /* Which flags to copy from now_flags */
1749 uint8_t now_mask;
1750
1751 /*
1752 * Flags to leave enabled in S3, if they're on at the S0->S3
1753 * transition. (Other flags will be disabled by the S0->S3
1754 * transition.)
1755 */
1756 uint8_t suspend_flags;
1757
1758 /* Which flags to copy from suspend_flags */
1759 uint8_t suspend_mask;
1760} __packed;
1761
1762/* Version 1 response */
1763struct ec_response_switch_enable_wireless_v1 {
1764 /* Flags to enable now */
1765 uint8_t now_flags;
1766
1767 /* Flags to leave enabled in S3 */
1768 uint8_t suspend_flags;
1769} __packed;
1770
1126/*****************************************************************************/ 1771/*****************************************************************************/
1127/* GPIO commands. Only available on EC if write protect has been disabled. */ 1772/* GPIO commands. Only available on EC if write protect has been disabled. */
1128 1773
@@ -1147,11 +1792,16 @@ struct ec_response_gpio_get {
1147/*****************************************************************************/ 1792/*****************************************************************************/
1148/* I2C commands. Only available when flash write protect is unlocked. */ 1793/* I2C commands. Only available when flash write protect is unlocked. */
1149 1794
1795/*
1796 * TODO(crosbug.com/p/23570): These commands are deprecated, and will be
1797 * removed soon. Use EC_CMD_I2C_XFER instead.
1798 */
1799
1150/* Read I2C bus */ 1800/* Read I2C bus */
1151#define EC_CMD_I2C_READ 0x94 1801#define EC_CMD_I2C_READ 0x94
1152 1802
1153struct ec_params_i2c_read { 1803struct ec_params_i2c_read {
1154 uint16_t addr; 1804 uint16_t addr; /* 8-bit address (7-bit shifted << 1) */
1155 uint8_t read_size; /* Either 8 or 16. */ 1805 uint8_t read_size; /* Either 8 or 16. */
1156 uint8_t port; 1806 uint8_t port;
1157 uint8_t offset; 1807 uint8_t offset;
@@ -1165,7 +1815,7 @@ struct ec_response_i2c_read {
1165 1815
1166struct ec_params_i2c_write { 1816struct ec_params_i2c_write {
1167 uint16_t data; 1817 uint16_t data;
1168 uint16_t addr; 1818 uint16_t addr; /* 8-bit address (7-bit shifted << 1) */
1169 uint8_t write_size; /* Either 8 or 16. */ 1819 uint8_t write_size; /* Either 8 or 16. */
1170 uint8_t port; 1820 uint8_t port;
1171 uint8_t offset; 1821 uint8_t offset;
@@ -1174,11 +1824,20 @@ struct ec_params_i2c_write {
1174/*****************************************************************************/ 1824/*****************************************************************************/
1175/* Charge state commands. Only available when flash write protect unlocked. */ 1825/* Charge state commands. Only available when flash write protect unlocked. */
1176 1826
1177/* Force charge state machine to stop in idle mode */ 1827/* Force charge state machine to stop charging the battery or force it to
1178#define EC_CMD_CHARGE_FORCE_IDLE 0x96 1828 * discharge the battery.
1829 */
1830#define EC_CMD_CHARGE_CONTROL 0x96
1831#define EC_VER_CHARGE_CONTROL 1
1179 1832
1180struct ec_params_force_idle { 1833enum ec_charge_control_mode {
1181 uint8_t enabled; 1834 CHARGE_CONTROL_NORMAL = 0,
1835 CHARGE_CONTROL_IDLE,
1836 CHARGE_CONTROL_DISCHARGE,
1837};
1838
1839struct ec_params_charge_control {
1840 uint32_t mode; /* enum charge_control_mode */
1182} __packed; 1841} __packed;
1183 1842
1184/*****************************************************************************/ 1843/*****************************************************************************/
@@ -1206,14 +1865,231 @@ struct ec_params_force_idle {
1206#define EC_CMD_BATTERY_CUT_OFF 0x99 1865#define EC_CMD_BATTERY_CUT_OFF 0x99
1207 1866
1208/*****************************************************************************/ 1867/*****************************************************************************/
1209/* Temporary debug commands. TODO: remove this crosbug.com/p/13849 */ 1868/* USB port mux control. */
1210 1869
1211/* 1870/*
1212 * Dump charge state machine context. 1871 * Switch USB mux or return to automatic switching.
1213 * 1872 */
1214 * Response is a binary dump of charge state machine context. 1873#define EC_CMD_USB_MUX 0x9a
1874
1875struct ec_params_usb_mux {
1876 uint8_t mux;
1877} __packed;
1878
1879/*****************************************************************************/
1880/* LDOs / FETs control. */
1881
1882enum ec_ldo_state {
1883 EC_LDO_STATE_OFF = 0, /* the LDO / FET is shut down */
1884 EC_LDO_STATE_ON = 1, /* the LDO / FET is ON / providing power */
1885};
1886
1887/*
1888 * Switch on/off a LDO.
1889 */
1890#define EC_CMD_LDO_SET 0x9b
1891
1892struct ec_params_ldo_set {
1893 uint8_t index;
1894 uint8_t state;
1895} __packed;
1896
1897/*
1898 * Get LDO state.
1899 */
1900#define EC_CMD_LDO_GET 0x9c
1901
1902struct ec_params_ldo_get {
1903 uint8_t index;
1904} __packed;
1905
1906struct ec_response_ldo_get {
1907 uint8_t state;
1908} __packed;
1909
1910/*****************************************************************************/
1911/* Power info. */
1912
1913/*
1914 * Get power info.
1915 */
1916#define EC_CMD_POWER_INFO 0x9d
1917
1918struct ec_response_power_info {
1919 uint32_t usb_dev_type;
1920 uint16_t voltage_ac;
1921 uint16_t voltage_system;
1922 uint16_t current_system;
1923 uint16_t usb_current_limit;
1924} __packed;
1925
1926/*****************************************************************************/
1927/* I2C passthru command */
1928
1929#define EC_CMD_I2C_PASSTHRU 0x9e
1930
1931/* Slave address is 10 (not 7) bit */
1932#define EC_I2C_FLAG_10BIT (1 << 16)
1933
1934/* Read data; if not present, message is a write */
1935#define EC_I2C_FLAG_READ (1 << 15)
1936
1937/* Mask for address */
1938#define EC_I2C_ADDR_MASK 0x3ff
1939
1940#define EC_I2C_STATUS_NAK (1 << 0) /* Transfer was not acknowledged */
1941#define EC_I2C_STATUS_TIMEOUT (1 << 1) /* Timeout during transfer */
1942
1943/* Any error */
1944#define EC_I2C_STATUS_ERROR (EC_I2C_STATUS_NAK | EC_I2C_STATUS_TIMEOUT)
1945
1946struct ec_params_i2c_passthru_msg {
1947 uint16_t addr_flags; /* I2C slave address (7 or 10 bits) and flags */
1948 uint16_t len; /* Number of bytes to read or write */
1949} __packed;
1950
1951struct ec_params_i2c_passthru {
1952 uint8_t port; /* I2C port number */
1953 uint8_t num_msgs; /* Number of messages */
1954 struct ec_params_i2c_passthru_msg msg[];
1955 /* Data to write for all messages is concatenated here */
1956} __packed;
1957
1958struct ec_response_i2c_passthru {
1959 uint8_t i2c_status; /* Status flags (EC_I2C_STATUS_...) */
1960 uint8_t num_msgs; /* Number of messages processed */
1961 uint8_t data[]; /* Data read by messages concatenated here */
1962} __packed;
1963
1964/*****************************************************************************/
1965/* Power button hang detect */
1966
1967#define EC_CMD_HANG_DETECT 0x9f
1968
1969/* Reasons to start hang detection timer */
1970/* Power button pressed */
1971#define EC_HANG_START_ON_POWER_PRESS (1 << 0)
1972
1973/* Lid closed */
1974#define EC_HANG_START_ON_LID_CLOSE (1 << 1)
1975
1976 /* Lid opened */
1977#define EC_HANG_START_ON_LID_OPEN (1 << 2)
1978
1979/* Start of AP S3->S0 transition (booting or resuming from suspend) */
1980#define EC_HANG_START_ON_RESUME (1 << 3)
1981
1982/* Reasons to cancel hang detection */
1983
1984/* Power button released */
1985#define EC_HANG_STOP_ON_POWER_RELEASE (1 << 8)
1986
1987/* Any host command from AP received */
1988#define EC_HANG_STOP_ON_HOST_COMMAND (1 << 9)
1989
1990/* Stop on end of AP S0->S3 transition (suspending or shutting down) */
1991#define EC_HANG_STOP_ON_SUSPEND (1 << 10)
1992
1993/*
1994 * If this flag is set, all the other fields are ignored, and the hang detect
1995 * timer is started. This provides the AP a way to start the hang timer
1996 * without reconfiguring any of the other hang detect settings. Note that
1997 * you must previously have configured the timeouts.
1998 */
1999#define EC_HANG_START_NOW (1 << 30)
2000
2001/*
2002 * If this flag is set, all the other fields are ignored (including
2003 * EC_HANG_START_NOW). This provides the AP a way to stop the hang timer
2004 * without reconfiguring any of the other hang detect settings.
1215 */ 2005 */
1216#define EC_CMD_CHARGE_DUMP 0xa0 2006#define EC_HANG_STOP_NOW (1 << 31)
2007
2008struct ec_params_hang_detect {
2009 /* Flags; see EC_HANG_* */
2010 uint32_t flags;
2011
2012 /* Timeout in msec before generating host event, if enabled */
2013 uint16_t host_event_timeout_msec;
2014
2015 /* Timeout in msec before generating warm reboot, if enabled */
2016 uint16_t warm_reboot_timeout_msec;
2017} __packed;
2018
2019/*****************************************************************************/
2020/* Commands for battery charging */
2021
2022/*
2023 * This is the single catch-all host command to exchange data regarding the
2024 * charge state machine (v2 and up).
2025 */
2026#define EC_CMD_CHARGE_STATE 0xa0
2027
2028/* Subcommands for this host command */
2029enum charge_state_command {
2030 CHARGE_STATE_CMD_GET_STATE,
2031 CHARGE_STATE_CMD_GET_PARAM,
2032 CHARGE_STATE_CMD_SET_PARAM,
2033 CHARGE_STATE_NUM_CMDS
2034};
2035
2036/*
2037 * Known param numbers are defined here. Ranges are reserved for board-specific
2038 * params, which are handled by the particular implementations.
2039 */
2040enum charge_state_params {
2041 CS_PARAM_CHG_VOLTAGE, /* charger voltage limit */
2042 CS_PARAM_CHG_CURRENT, /* charger current limit */
2043 CS_PARAM_CHG_INPUT_CURRENT, /* charger input current limit */
2044 CS_PARAM_CHG_STATUS, /* charger-specific status */
2045 CS_PARAM_CHG_OPTION, /* charger-specific options */
2046 /* How many so far? */
2047 CS_NUM_BASE_PARAMS,
2048
2049 /* Range for CONFIG_CHARGER_PROFILE_OVERRIDE params */
2050 CS_PARAM_CUSTOM_PROFILE_MIN = 0x10000,
2051 CS_PARAM_CUSTOM_PROFILE_MAX = 0x1ffff,
2052
2053 /* Other custom param ranges go here... */
2054};
2055
2056struct ec_params_charge_state {
2057 uint8_t cmd; /* enum charge_state_command */
2058 union {
2059 struct {
2060 /* no args */
2061 } get_state;
2062
2063 struct {
2064 uint32_t param; /* enum charge_state_param */
2065 } get_param;
2066
2067 struct {
2068 uint32_t param; /* param to set */
2069 uint32_t value; /* value to set */
2070 } set_param;
2071 };
2072} __packed;
2073
2074struct ec_response_charge_state {
2075 union {
2076 struct {
2077 int ac;
2078 int chg_voltage;
2079 int chg_current;
2080 int chg_input_current;
2081 int batt_state_of_charge;
2082 } get_state;
2083
2084 struct {
2085 uint32_t value;
2086 } get_param;
2087 struct {
2088 /* no return values */
2089 } set_param;
2090 };
2091} __packed;
2092
1217 2093
1218/* 2094/*
1219 * Set maximum battery charging current. 2095 * Set maximum battery charging current.
@@ -1221,15 +2097,59 @@ struct ec_params_force_idle {
1221#define EC_CMD_CHARGE_CURRENT_LIMIT 0xa1 2097#define EC_CMD_CHARGE_CURRENT_LIMIT 0xa1
1222 2098
1223struct ec_params_current_limit { 2099struct ec_params_current_limit {
1224 uint32_t limit; 2100 uint32_t limit; /* in mA */
2101} __packed;
2102
2103/*
2104 * Set maximum external power current.
2105 */
2106#define EC_CMD_EXT_POWER_CURRENT_LIMIT 0xa2
2107
2108struct ec_params_ext_power_current_limit {
2109 uint32_t limit; /* in mA */
2110} __packed;
2111
2112/*****************************************************************************/
2113/* Smart battery pass-through */
2114
2115/* Get / Set 16-bit smart battery registers */
2116#define EC_CMD_SB_READ_WORD 0xb0
2117#define EC_CMD_SB_WRITE_WORD 0xb1
2118
2119/* Get / Set string smart battery parameters
2120 * formatted as SMBUS "block".
2121 */
2122#define EC_CMD_SB_READ_BLOCK 0xb2
2123#define EC_CMD_SB_WRITE_BLOCK 0xb3
2124
2125struct ec_params_sb_rd {
2126 uint8_t reg;
2127} __packed;
2128
2129struct ec_response_sb_rd_word {
2130 uint16_t value;
2131} __packed;
2132
2133struct ec_params_sb_wr_word {
2134 uint8_t reg;
2135 uint16_t value;
2136} __packed;
2137
2138struct ec_response_sb_rd_block {
2139 uint8_t data[32];
2140} __packed;
2141
2142struct ec_params_sb_wr_block {
2143 uint8_t reg;
2144 uint16_t data[32];
1225} __packed; 2145} __packed;
1226 2146
1227/*****************************************************************************/ 2147/*****************************************************************************/
1228/* System commands */ 2148/* System commands */
1229 2149
1230/* 2150/*
1231 * TODO: this is a confusing name, since it doesn't necessarily reboot the EC. 2151 * TODO(crosbug.com/p/23747): This is a confusing name, since it doesn't
1232 * Rename to "set image" or something similar. 2152 * necessarily reboot the EC. Rename to "image" or something similar?
1233 */ 2153 */
1234#define EC_CMD_REBOOT_EC 0xd2 2154#define EC_CMD_REBOOT_EC 0xd2
1235 2155
@@ -1308,6 +2228,7 @@ struct ec_params_reboot_ec {
1308#define EC_CMD_ACPI_QUERY_EVENT 0x84 2228#define EC_CMD_ACPI_QUERY_EVENT 0x84
1309 2229
1310/* Valid addresses in ACPI memory space, for read/write commands */ 2230/* Valid addresses in ACPI memory space, for read/write commands */
2231
1311/* Memory space version; set to EC_ACPI_MEM_VERSION_CURRENT */ 2232/* Memory space version; set to EC_ACPI_MEM_VERSION_CURRENT */
1312#define EC_ACPI_MEM_VERSION 0x00 2233#define EC_ACPI_MEM_VERSION 0x00
1313/* 2234/*
@@ -1317,8 +2238,60 @@ struct ec_params_reboot_ec {
1317#define EC_ACPI_MEM_TEST 0x01 2238#define EC_ACPI_MEM_TEST 0x01
1318/* Test compliment; writes here are ignored. */ 2239/* Test compliment; writes here are ignored. */
1319#define EC_ACPI_MEM_TEST_COMPLIMENT 0x02 2240#define EC_ACPI_MEM_TEST_COMPLIMENT 0x02
2241
1320/* Keyboard backlight brightness percent (0 - 100) */ 2242/* Keyboard backlight brightness percent (0 - 100) */
1321#define EC_ACPI_MEM_KEYBOARD_BACKLIGHT 0x03 2243#define EC_ACPI_MEM_KEYBOARD_BACKLIGHT 0x03
2244/* DPTF Target Fan Duty (0-100, 0xff for auto/none) */
2245#define EC_ACPI_MEM_FAN_DUTY 0x04
2246
2247/*
2248 * DPTF temp thresholds. Any of the EC's temp sensors can have up to two
2249 * independent thresholds attached to them. The current value of the ID
2250 * register determines which sensor is affected by the THRESHOLD and COMMIT
2251 * registers. The THRESHOLD register uses the same EC_TEMP_SENSOR_OFFSET scheme
2252 * as the memory-mapped sensors. The COMMIT register applies those settings.
2253 *
2254 * The spec does not mandate any way to read back the threshold settings
2255 * themselves, but when a threshold is crossed the AP needs a way to determine
2256 * which sensor(s) are responsible. Each reading of the ID register clears and
2257 * returns one sensor ID that has crossed one of its threshold (in either
2258 * direction) since the last read. A value of 0xFF means "no new thresholds
2259 * have tripped". Setting or enabling the thresholds for a sensor will clear
2260 * the unread event count for that sensor.
2261 */
2262#define EC_ACPI_MEM_TEMP_ID 0x05
2263#define EC_ACPI_MEM_TEMP_THRESHOLD 0x06
2264#define EC_ACPI_MEM_TEMP_COMMIT 0x07
2265/*
2266 * Here are the bits for the COMMIT register:
2267 * bit 0 selects the threshold index for the chosen sensor (0/1)
2268 * bit 1 enables/disables the selected threshold (0 = off, 1 = on)
2269 * Each write to the commit register affects one threshold.
2270 */
2271#define EC_ACPI_MEM_TEMP_COMMIT_SELECT_MASK (1 << 0)
2272#define EC_ACPI_MEM_TEMP_COMMIT_ENABLE_MASK (1 << 1)
2273/*
2274 * Example:
2275 *
2276 * Set the thresholds for sensor 2 to 50 C and 60 C:
2277 * write 2 to [0x05] -- select temp sensor 2
2278 * write 0x7b to [0x06] -- C_TO_K(50) - EC_TEMP_SENSOR_OFFSET
2279 * write 0x2 to [0x07] -- enable threshold 0 with this value
2280 * write 0x85 to [0x06] -- C_TO_K(60) - EC_TEMP_SENSOR_OFFSET
2281 * write 0x3 to [0x07] -- enable threshold 1 with this value
2282 *
2283 * Disable the 60 C threshold, leaving the 50 C threshold unchanged:
2284 * write 2 to [0x05] -- select temp sensor 2
2285 * write 0x1 to [0x07] -- disable threshold 1
2286 */
2287
2288/* DPTF battery charging current limit */
2289#define EC_ACPI_MEM_CHARGING_LIMIT 0x08
2290
2291/* Charging limit is specified in 64 mA steps */
2292#define EC_ACPI_MEM_CHARGING_LIMIT_STEP_MA 64
2293/* Value to disable DPTF battery charging limit */
2294#define EC_ACPI_MEM_CHARGING_LIMIT_DISABLED 0xff
1322 2295
1323/* Current version of ACPI memory address space */ 2296/* Current version of ACPI memory address space */
1324#define EC_ACPI_MEM_VERSION_CURRENT 1 2297#define EC_ACPI_MEM_VERSION_CURRENT 1
@@ -1360,10 +2333,21 @@ struct ec_params_reboot_ec {
1360 * Header bytes greater than this indicate a later version. For example, 2333 * Header bytes greater than this indicate a later version. For example,
1361 * EC_CMD_VERSION0 + 1 means we are using version 1. 2334 * EC_CMD_VERSION0 + 1 means we are using version 1.
1362 * 2335 *
1363 * The old EC interface must not use commands 0dc or higher. 2336 * The old EC interface must not use commands 0xdc or higher.
1364 */ 2337 */
1365#define EC_CMD_VERSION0 0xdc 2338#define EC_CMD_VERSION0 0xdc
1366 2339
1367#endif /* !__ACPI__ */ 2340#endif /* !__ACPI__ */
1368 2341
2342/*****************************************************************************/
2343/*
2344 * Deprecated constants. These constants have been renamed for clarity. The
2345 * meaning and size has not changed. Programs that use the old names should
2346 * switch to the new names soon, as the old names may not be carried forward
2347 * forever.
2348 */
2349#define EC_HOST_PARAM_SIZE EC_PROTO2_MAX_PARAM_SIZE
2350#define EC_LPC_ADDR_OLD_PARAM EC_HOST_CMD_REGION1
2351#define EC_OLD_PARAM_SIZE EC_HOST_CMD_REGION_SIZE
2352
1369#endif /* __CROS_EC_COMMANDS_H */ 2353#endif /* __CROS_EC_COMMANDS_H */
diff --git a/include/linux/mfd/ipaq-micro.h b/include/linux/mfd/ipaq-micro.h
new file mode 100644
index 000000000000..5c4d29f6674f
--- /dev/null
+++ b/include/linux/mfd/ipaq-micro.h
@@ -0,0 +1,148 @@
1/*
2 * Header file for the compaq Micro MFD
3 */
4
5#ifndef _MFD_IPAQ_MICRO_H_
6#define _MFD_IPAQ_MICRO_H_
7
8#include <linux/spinlock.h>
9#include <linux/completion.h>
10#include <linux/list.h>
11
12#define TX_BUF_SIZE 32
13#define RX_BUF_SIZE 16
14#define CHAR_SOF 0x02
15
16/*
17 * These are the different messages that can be sent to the microcontroller
18 * to control various aspects.
19 */
20#define MSG_VERSION 0x0
21#define MSG_KEYBOARD 0x2
22#define MSG_TOUCHSCREEN 0x3
23#define MSG_EEPROM_READ 0x4
24#define MSG_EEPROM_WRITE 0x5
25#define MSG_THERMAL_SENSOR 0x6
26#define MSG_NOTIFY_LED 0x8
27#define MSG_BATTERY 0x9
28#define MSG_SPI_READ 0xb
29#define MSG_SPI_WRITE 0xc
30#define MSG_BACKLIGHT 0xd /* H3600 only */
31#define MSG_CODEC_CTRL 0xe /* H3100 only */
32#define MSG_DISPLAY_CTRL 0xf /* H3100 only */
33
34/* state of receiver parser */
35enum rx_state {
36 STATE_SOF = 0, /* Next byte should be start of frame */
37 STATE_ID, /* Next byte is ID & message length */
38 STATE_DATA, /* Next byte is a data byte */
39 STATE_CHKSUM /* Next byte should be checksum */
40};
41
42/**
43 * struct ipaq_micro_txdev - TX state
44 * @len: length of message in TX buffer
45 * @index: current index into TX buffer
46 * @buf: TX buffer
47 */
48struct ipaq_micro_txdev {
49 u8 len;
50 u8 index;
51 u8 buf[TX_BUF_SIZE];
52};
53
54/**
55 * struct ipaq_micro_rxdev - RX state
56 * @state: context of RX state machine
57 * @chksum: calculated checksum
58 * @id: message ID from packet
59 * @len: RX buffer length
60 * @index: RX buffer index
61 * @buf: RX buffer
62 */
63struct ipaq_micro_rxdev {
64 enum rx_state state;
65 unsigned char chksum;
66 u8 id;
67 unsigned int len;
68 unsigned int index;
69 u8 buf[RX_BUF_SIZE];
70};
71
72/**
73 * struct ipaq_micro_msg - message to the iPAQ microcontroller
74 * @id: 4-bit ID of the message
75 * @tx_len: length of TX data
76 * @tx_data: TX data to send
77 * @rx_len: length of receieved RX data
78 * @rx_data: RX data to recieve
79 * @ack: a completion that will be completed when RX is complete
80 * @node: list node if message gets queued
81 */
82struct ipaq_micro_msg {
83 u8 id;
84 u8 tx_len;
85 u8 tx_data[TX_BUF_SIZE];
86 u8 rx_len;
87 u8 rx_data[RX_BUF_SIZE];
88 struct completion ack;
89 struct list_head node;
90};
91
92/**
93 * struct ipaq_micro - iPAQ microcontroller state
94 * @dev: corresponding platform device
95 * @base: virtual memory base for underlying serial device
96 * @sdlc: virtual memory base for Synchronous Data Link Controller
97 * @version: version string
98 * @tx: TX state
99 * @rx: RX state
100 * @lock: lock for this state container
101 * @msg: current message
102 * @queue: message queue
103 * @key: callback for asynchronous key events
104 * @key_data: data to pass along with key events
105 * @ts: callback for asynchronous touchscreen events
106 * @ts_data: data to pass along with key events
107 */
108struct ipaq_micro {
109 struct device *dev;
110 void __iomem *base;
111 void __iomem *sdlc;
112 char version[5];
113 struct ipaq_micro_txdev tx; /* transmit ISR state */
114 struct ipaq_micro_rxdev rx; /* receive ISR state */
115 spinlock_t lock;
116 struct ipaq_micro_msg *msg;
117 struct list_head queue;
118 void (*key) (void *data, int len, unsigned char *rxdata);
119 void *key_data;
120 void (*ts) (void *data, int len, unsigned char *rxdata);
121 void *ts_data;
122};
123
124extern int
125ipaq_micro_tx_msg(struct ipaq_micro *micro, struct ipaq_micro_msg *msg);
126
127static inline int
128ipaq_micro_tx_msg_sync(struct ipaq_micro *micro,
129 struct ipaq_micro_msg *msg)
130{
131 int ret;
132
133 init_completion(&msg->ack);
134 ret = ipaq_micro_tx_msg(micro, msg);
135 wait_for_completion(&msg->ack);
136
137 return ret;
138}
139
140static inline int
141ipaq_micro_tx_msg_async(struct ipaq_micro *micro,
142 struct ipaq_micro_msg *msg)
143{
144 init_completion(&msg->ack);
145 return ipaq_micro_tx_msg(micro, msg);
146}
147
148#endif /* _MFD_IPAQ_MICRO_H_ */
diff --git a/include/linux/mfd/kempld.h b/include/linux/mfd/kempld.h
index b911ef3add03..26e0b469e567 100644
--- a/include/linux/mfd/kempld.h
+++ b/include/linux/mfd/kempld.h
@@ -51,6 +51,8 @@
51#define KEMPLD_TYPE_DEBUG 0x1 51#define KEMPLD_TYPE_DEBUG 0x1
52#define KEMPLD_TYPE_CUSTOM 0x2 52#define KEMPLD_TYPE_CUSTOM 0x2
53 53
54#define KEMPLD_VERSION_LEN 10
55
54/** 56/**
55 * struct kempld_info - PLD device information structure 57 * struct kempld_info - PLD device information structure
56 * @major: PLD major revision 58 * @major: PLD major revision
@@ -60,6 +62,7 @@
60 * @type: PLD type 62 * @type: PLD type
61 * @spec_major: PLD FW specification major revision 63 * @spec_major: PLD FW specification major revision
62 * @spec_minor: PLD FW specification minor revision 64 * @spec_minor: PLD FW specification minor revision
65 * @version: PLD version string
63 */ 66 */
64struct kempld_info { 67struct kempld_info {
65 unsigned int major; 68 unsigned int major;
@@ -69,6 +72,7 @@ struct kempld_info {
69 unsigned int type; 72 unsigned int type;
70 unsigned int spec_major; 73 unsigned int spec_major;
71 unsigned int spec_minor; 74 unsigned int spec_minor;
75 char version[KEMPLD_VERSION_LEN];
72}; 76};
73 77
74/** 78/**
diff --git a/include/linux/mfd/max14577-private.h b/include/linux/mfd/max14577-private.h
index c9b332fb0d5d..499253604026 100644
--- a/include/linux/mfd/max14577-private.h
+++ b/include/linux/mfd/max14577-private.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * max14577-private.h - Common API for the Maxim 14577 internal sub chip 2 * max14577-private.h - Common API for the Maxim 14577/77836 internal sub chip
3 * 3 *
4 * Copyright (C) 2013 Samsung Electrnoics 4 * Copyright (C) 2014 Samsung Electrnoics
5 * Chanwoo Choi <cw00.choi@samsung.com> 5 * Chanwoo Choi <cw00.choi@samsung.com>
6 * Krzysztof Kozlowski <k.kozlowski@samsung.com> 6 * Krzysztof Kozlowski <k.kozlowski@samsung.com>
7 * 7 *
@@ -22,9 +22,19 @@
22#include <linux/i2c.h> 22#include <linux/i2c.h>
23#include <linux/regmap.h> 23#include <linux/regmap.h>
24 24
25#define MAX14577_REG_INVALID (0xff) 25#define I2C_ADDR_PMIC (0x46 >> 1)
26#define I2C_ADDR_MUIC (0x4A >> 1)
27#define I2C_ADDR_FG (0x6C >> 1)
26 28
27/* Slave addr = 0x4A: Interrupt */ 29enum maxim_device_type {
30 MAXIM_DEVICE_TYPE_UNKNOWN = 0,
31 MAXIM_DEVICE_TYPE_MAX14577,
32 MAXIM_DEVICE_TYPE_MAX77836,
33
34 MAXIM_DEVICE_TYPE_NUM,
35};
36
37/* Slave addr = 0x4A: MUIC and Charger */
28enum max14577_reg { 38enum max14577_reg {
29 MAX14577_REG_DEVICEID = 0x00, 39 MAX14577_REG_DEVICEID = 0x00,
30 MAX14577_REG_INT1 = 0x01, 40 MAX14577_REG_INT1 = 0x01,
@@ -74,20 +84,22 @@ enum max14577_muic_charger_type {
74}; 84};
75 85
76/* MAX14577 interrupts */ 86/* MAX14577 interrupts */
77#define INT1_ADC_MASK (0x1 << 0) 87#define MAX14577_INT1_ADC_MASK BIT(0)
78#define INT1_ADCLOW_MASK (0x1 << 1) 88#define MAX14577_INT1_ADCLOW_MASK BIT(1)
79#define INT1_ADCERR_MASK (0x1 << 2) 89#define MAX14577_INT1_ADCERR_MASK BIT(2)
80 90#define MAX77836_INT1_ADC1K_MASK BIT(3)
81#define INT2_CHGTYP_MASK (0x1 << 0) 91
82#define INT2_CHGDETRUN_MASK (0x1 << 1) 92#define MAX14577_INT2_CHGTYP_MASK BIT(0)
83#define INT2_DCDTMR_MASK (0x1 << 2) 93#define MAX14577_INT2_CHGDETRUN_MASK BIT(1)
84#define INT2_DBCHG_MASK (0x1 << 3) 94#define MAX14577_INT2_DCDTMR_MASK BIT(2)
85#define INT2_VBVOLT_MASK (0x1 << 4) 95#define MAX14577_INT2_DBCHG_MASK BIT(3)
86 96#define MAX14577_INT2_VBVOLT_MASK BIT(4)
87#define INT3_EOC_MASK (0x1 << 0) 97#define MAX77836_INT2_VIDRM_MASK BIT(5)
88#define INT3_CGMBC_MASK (0x1 << 1) 98
89#define INT3_OVP_MASK (0x1 << 2) 99#define MAX14577_INT3_EOC_MASK BIT(0)
90#define INT3_MBCCHGERR_MASK (0x1 << 3) 100#define MAX14577_INT3_CGMBC_MASK BIT(1)
101#define MAX14577_INT3_OVP_MASK BIT(2)
102#define MAX14577_INT3_MBCCHGERR_MASK BIT(3)
91 103
92/* MAX14577 DEVICE ID register */ 104/* MAX14577 DEVICE ID register */
93#define DEVID_VENDORID_SHIFT 0 105#define DEVID_VENDORID_SHIFT 0
@@ -99,9 +111,11 @@ enum max14577_muic_charger_type {
99#define STATUS1_ADC_SHIFT 0 111#define STATUS1_ADC_SHIFT 0
100#define STATUS1_ADCLOW_SHIFT 5 112#define STATUS1_ADCLOW_SHIFT 5
101#define STATUS1_ADCERR_SHIFT 6 113#define STATUS1_ADCERR_SHIFT 6
114#define MAX77836_STATUS1_ADC1K_SHIFT 7
102#define STATUS1_ADC_MASK (0x1f << STATUS1_ADC_SHIFT) 115#define STATUS1_ADC_MASK (0x1f << STATUS1_ADC_SHIFT)
103#define STATUS1_ADCLOW_MASK (0x1 << STATUS1_ADCLOW_SHIFT) 116#define STATUS1_ADCLOW_MASK BIT(STATUS1_ADCLOW_SHIFT)
104#define STATUS1_ADCERR_MASK (0x1 << STATUS1_ADCERR_SHIFT) 117#define STATUS1_ADCERR_MASK BIT(STATUS1_ADCERR_SHIFT)
118#define MAX77836_STATUS1_ADC1K_MASK BIT(MAX77836_STATUS1_ADC1K_SHIFT)
105 119
106/* MAX14577 STATUS2 register */ 120/* MAX14577 STATUS2 register */
107#define STATUS2_CHGTYP_SHIFT 0 121#define STATUS2_CHGTYP_SHIFT 0
@@ -109,11 +123,13 @@ enum max14577_muic_charger_type {
109#define STATUS2_DCDTMR_SHIFT 4 123#define STATUS2_DCDTMR_SHIFT 4
110#define STATUS2_DBCHG_SHIFT 5 124#define STATUS2_DBCHG_SHIFT 5
111#define STATUS2_VBVOLT_SHIFT 6 125#define STATUS2_VBVOLT_SHIFT 6
126#define MAX77836_STATUS2_VIDRM_SHIFT 7
112#define STATUS2_CHGTYP_MASK (0x7 << STATUS2_CHGTYP_SHIFT) 127#define STATUS2_CHGTYP_MASK (0x7 << STATUS2_CHGTYP_SHIFT)
113#define STATUS2_CHGDETRUN_MASK (0x1 << STATUS2_CHGDETRUN_SHIFT) 128#define STATUS2_CHGDETRUN_MASK BIT(STATUS2_CHGDETRUN_SHIFT)
114#define STATUS2_DCDTMR_MASK (0x1 << STATUS2_DCDTMR_SHIFT) 129#define STATUS2_DCDTMR_MASK BIT(STATUS2_DCDTMR_SHIFT)
115#define STATUS2_DBCHG_MASK (0x1 << STATUS2_DBCHG_SHIFT) 130#define STATUS2_DBCHG_MASK BIT(STATUS2_DBCHG_SHIFT)
116#define STATUS2_VBVOLT_MASK (0x1 << STATUS2_VBVOLT_SHIFT) 131#define STATUS2_VBVOLT_MASK BIT(STATUS2_VBVOLT_SHIFT)
132#define MAX77836_STATUS2_VIDRM_MASK BIT(MAX77836_STATUS2_VIDRM_SHIFT)
117 133
118/* MAX14577 CONTROL1 register */ 134/* MAX14577 CONTROL1 register */
119#define COMN1SW_SHIFT 0 135#define COMN1SW_SHIFT 0
@@ -122,8 +138,8 @@ enum max14577_muic_charger_type {
122#define IDBEN_SHIFT 7 138#define IDBEN_SHIFT 7
123#define COMN1SW_MASK (0x7 << COMN1SW_SHIFT) 139#define COMN1SW_MASK (0x7 << COMN1SW_SHIFT)
124#define COMP2SW_MASK (0x7 << COMP2SW_SHIFT) 140#define COMP2SW_MASK (0x7 << COMP2SW_SHIFT)
125#define MICEN_MASK (0x1 << MICEN_SHIFT) 141#define MICEN_MASK BIT(MICEN_SHIFT)
126#define IDBEN_MASK (0x1 << IDBEN_SHIFT) 142#define IDBEN_MASK BIT(IDBEN_SHIFT)
127#define CLEAR_IDBEN_MICEN_MASK (COMN1SW_MASK | COMP2SW_MASK) 143#define CLEAR_IDBEN_MICEN_MASK (COMN1SW_MASK | COMP2SW_MASK)
128#define CTRL1_SW_USB ((1 << COMP2SW_SHIFT) \ 144#define CTRL1_SW_USB ((1 << COMP2SW_SHIFT) \
129 | (1 << COMN1SW_SHIFT)) 145 | (1 << COMN1SW_SHIFT))
@@ -143,14 +159,14 @@ enum max14577_muic_charger_type {
143#define CTRL2_ACCDET_SHIFT (5) 159#define CTRL2_ACCDET_SHIFT (5)
144#define CTRL2_USBCPINT_SHIFT (6) 160#define CTRL2_USBCPINT_SHIFT (6)
145#define CTRL2_RCPS_SHIFT (7) 161#define CTRL2_RCPS_SHIFT (7)
146#define CTRL2_LOWPWR_MASK (0x1 << CTRL2_LOWPWR_SHIFT) 162#define CTRL2_LOWPWR_MASK BIT(CTRL2_LOWPWR_SHIFT)
147#define CTRL2_ADCEN_MASK (0x1 << CTRL2_ADCEN_SHIFT) 163#define CTRL2_ADCEN_MASK BIT(CTRL2_ADCEN_SHIFT)
148#define CTRL2_CPEN_MASK (0x1 << CTRL2_CPEN_SHIFT) 164#define CTRL2_CPEN_MASK BIT(CTRL2_CPEN_SHIFT)
149#define CTRL2_SFOUTASRT_MASK (0x1 << CTRL2_SFOUTASRT_SHIFT) 165#define CTRL2_SFOUTASRT_MASK BIT(CTRL2_SFOUTASRT_SHIFT)
150#define CTRL2_SFOUTORD_MASK (0x1 << CTRL2_SFOUTORD_SHIFT) 166#define CTRL2_SFOUTORD_MASK BIT(CTRL2_SFOUTORD_SHIFT)
151#define CTRL2_ACCDET_MASK (0x1 << CTRL2_ACCDET_SHIFT) 167#define CTRL2_ACCDET_MASK BIT(CTRL2_ACCDET_SHIFT)
152#define CTRL2_USBCPINT_MASK (0x1 << CTRL2_USBCPINT_SHIFT) 168#define CTRL2_USBCPINT_MASK BIT(CTRL2_USBCPINT_SHIFT)
153#define CTRL2_RCPS_MASK (0x1 << CTR2_RCPS_SHIFT) 169#define CTRL2_RCPS_MASK BIT(CTRL2_RCPS_SHIFT)
154 170
155#define CTRL2_CPEN1_LOWPWR0 ((1 << CTRL2_CPEN_SHIFT) | \ 171#define CTRL2_CPEN1_LOWPWR0 ((1 << CTRL2_CPEN_SHIFT) | \
156 (0 << CTRL2_LOWPWR_SHIFT)) 172 (0 << CTRL2_LOWPWR_SHIFT))
@@ -198,14 +214,14 @@ enum max14577_charger_reg {
198#define CDETCTRL1_DBEXIT_SHIFT 5 214#define CDETCTRL1_DBEXIT_SHIFT 5
199#define CDETCTRL1_DBIDLE_SHIFT 6 215#define CDETCTRL1_DBIDLE_SHIFT 6
200#define CDETCTRL1_CDPDET_SHIFT 7 216#define CDETCTRL1_CDPDET_SHIFT 7
201#define CDETCTRL1_CHGDETEN_MASK (0x1 << CDETCTRL1_CHGDETEN_SHIFT) 217#define CDETCTRL1_CHGDETEN_MASK BIT(CDETCTRL1_CHGDETEN_SHIFT)
202#define CDETCTRL1_CHGTYPMAN_MASK (0x1 << CDETCTRL1_CHGTYPMAN_SHIFT) 218#define CDETCTRL1_CHGTYPMAN_MASK BIT(CDETCTRL1_CHGTYPMAN_SHIFT)
203#define CDETCTRL1_DCDEN_MASK (0x1 << CDETCTRL1_DCDEN_SHIFT) 219#define CDETCTRL1_DCDEN_MASK BIT(CDETCTRL1_DCDEN_SHIFT)
204#define CDETCTRL1_DCD2SCT_MASK (0x1 << CDETCTRL1_DCD2SCT_SHIFT) 220#define CDETCTRL1_DCD2SCT_MASK BIT(CDETCTRL1_DCD2SCT_SHIFT)
205#define CDETCTRL1_DCHKTM_MASK (0x1 << CDETCTRL1_DCHKTM_SHIFT) 221#define CDETCTRL1_DCHKTM_MASK BIT(CDETCTRL1_DCHKTM_SHIFT)
206#define CDETCTRL1_DBEXIT_MASK (0x1 << CDETCTRL1_DBEXIT_SHIFT) 222#define CDETCTRL1_DBEXIT_MASK BIT(CDETCTRL1_DBEXIT_SHIFT)
207#define CDETCTRL1_DBIDLE_MASK (0x1 << CDETCTRL1_DBIDLE_SHIFT) 223#define CDETCTRL1_DBIDLE_MASK BIT(CDETCTRL1_DBIDLE_SHIFT)
208#define CDETCTRL1_CDPDET_MASK (0x1 << CDETCTRL1_CDPDET_SHIFT) 224#define CDETCTRL1_CDPDET_MASK BIT(CDETCTRL1_CDPDET_SHIFT)
209 225
210/* MAX14577 CHGCTRL1 register */ 226/* MAX14577 CHGCTRL1 register */
211#define CHGCTRL1_TCHW_SHIFT 4 227#define CHGCTRL1_TCHW_SHIFT 4
@@ -213,9 +229,9 @@ enum max14577_charger_reg {
213 229
214/* MAX14577 CHGCTRL2 register */ 230/* MAX14577 CHGCTRL2 register */
215#define CHGCTRL2_MBCHOSTEN_SHIFT 6 231#define CHGCTRL2_MBCHOSTEN_SHIFT 6
216#define CHGCTRL2_MBCHOSTEN_MASK (0x1 << CHGCTRL2_MBCHOSTEN_SHIFT) 232#define CHGCTRL2_MBCHOSTEN_MASK BIT(CHGCTRL2_MBCHOSTEN_SHIFT)
217#define CHGCTRL2_VCHGR_RC_SHIFT 7 233#define CHGCTRL2_VCHGR_RC_SHIFT 7
218#define CHGCTRL2_VCHGR_RC_MASK (0x1 << CHGCTRL2_VCHGR_RC_SHIFT) 234#define CHGCTRL2_VCHGR_RC_MASK BIT(CHGCTRL2_VCHGR_RC_SHIFT)
219 235
220/* MAX14577 CHGCTRL3 register */ 236/* MAX14577 CHGCTRL3 register */
221#define CHGCTRL3_MBCCVWRC_SHIFT 0 237#define CHGCTRL3_MBCCVWRC_SHIFT 0
@@ -225,7 +241,7 @@ enum max14577_charger_reg {
225#define CHGCTRL4_MBCICHWRCH_SHIFT 0 241#define CHGCTRL4_MBCICHWRCH_SHIFT 0
226#define CHGCTRL4_MBCICHWRCH_MASK (0xf << CHGCTRL4_MBCICHWRCH_SHIFT) 242#define CHGCTRL4_MBCICHWRCH_MASK (0xf << CHGCTRL4_MBCICHWRCH_SHIFT)
227#define CHGCTRL4_MBCICHWRCL_SHIFT 4 243#define CHGCTRL4_MBCICHWRCL_SHIFT 4
228#define CHGCTRL4_MBCICHWRCL_MASK (0x1 << CHGCTRL4_MBCICHWRCL_SHIFT) 244#define CHGCTRL4_MBCICHWRCL_MASK BIT(CHGCTRL4_MBCICHWRCL_SHIFT)
229 245
230/* MAX14577 CHGCTRL5 register */ 246/* MAX14577 CHGCTRL5 register */
231#define CHGCTRL5_EOCS_SHIFT 0 247#define CHGCTRL5_EOCS_SHIFT 0
@@ -233,7 +249,7 @@ enum max14577_charger_reg {
233 249
234/* MAX14577 CHGCTRL6 register */ 250/* MAX14577 CHGCTRL6 register */
235#define CHGCTRL6_AUTOSTOP_SHIFT 5 251#define CHGCTRL6_AUTOSTOP_SHIFT 5
236#define CHGCTRL6_AUTOSTOP_MASK (0x1 << CHGCTRL6_AUTOSTOP_SHIFT) 252#define CHGCTRL6_AUTOSTOP_MASK BIT(CHGCTRL6_AUTOSTOP_SHIFT)
237 253
238/* MAX14577 CHGCTRL7 register */ 254/* MAX14577 CHGCTRL7 register */
239#define CHGCTRL7_OTPCGHCVS_SHIFT 0 255#define CHGCTRL7_OTPCGHCVS_SHIFT 0
@@ -245,14 +261,111 @@ enum max14577_charger_reg {
245#define MAX14577_REGULATOR_CURRENT_LIMIT_HIGH_STEP 50000 261#define MAX14577_REGULATOR_CURRENT_LIMIT_HIGH_STEP 50000
246#define MAX14577_REGULATOR_CURRENT_LIMIT_MAX 950000 262#define MAX14577_REGULATOR_CURRENT_LIMIT_MAX 950000
247 263
264/* MAX77836 regulator current limits (as in CHGCTRL4 register), uA */
265#define MAX77836_REGULATOR_CURRENT_LIMIT_MIN 45000
266#define MAX77836_REGULATOR_CURRENT_LIMIT_HIGH_START 100000
267#define MAX77836_REGULATOR_CURRENT_LIMIT_HIGH_STEP 25000
268#define MAX77836_REGULATOR_CURRENT_LIMIT_MAX 475000
269
248/* MAX14577 regulator SFOUT LDO voltage, fixed, uV */ 270/* MAX14577 regulator SFOUT LDO voltage, fixed, uV */
249#define MAX14577_REGULATOR_SAFEOUT_VOLTAGE 4900000 271#define MAX14577_REGULATOR_SAFEOUT_VOLTAGE 4900000
250 272
273/* MAX77836 regulator LDOx voltage, uV */
274#define MAX77836_REGULATOR_LDO_VOLTAGE_MIN 800000
275#define MAX77836_REGULATOR_LDO_VOLTAGE_MAX 3950000
276#define MAX77836_REGULATOR_LDO_VOLTAGE_STEP 50000
277#define MAX77836_REGULATOR_LDO_VOLTAGE_STEPS_NUM 64
278
279/* Slave addr = 0x46: PMIC */
280enum max77836_pmic_reg {
281 MAX77836_PMIC_REG_PMIC_ID = 0x20,
282 MAX77836_PMIC_REG_PMIC_REV = 0x21,
283 MAX77836_PMIC_REG_INTSRC = 0x22,
284 MAX77836_PMIC_REG_INTSRC_MASK = 0x23,
285 MAX77836_PMIC_REG_TOPSYS_INT = 0x24,
286 MAX77836_PMIC_REG_TOPSYS_INT_MASK = 0x26,
287 MAX77836_PMIC_REG_TOPSYS_STAT = 0x28,
288 MAX77836_PMIC_REG_MRSTB_CNTL = 0x2A,
289 MAX77836_PMIC_REG_LSCNFG = 0x2B,
290
291 MAX77836_LDO_REG_CNFG1_LDO1 = 0x51,
292 MAX77836_LDO_REG_CNFG2_LDO1 = 0x52,
293 MAX77836_LDO_REG_CNFG1_LDO2 = 0x53,
294 MAX77836_LDO_REG_CNFG2_LDO2 = 0x54,
295 MAX77836_LDO_REG_CNFG_LDO_BIAS = 0x55,
296
297 MAX77836_COMP_REG_COMP1 = 0x60,
298
299 MAX77836_PMIC_REG_END,
300};
301
302#define MAX77836_INTSRC_MASK_TOP_INT_SHIFT 1
303#define MAX77836_INTSRC_MASK_MUIC_CHG_INT_SHIFT 3
304#define MAX77836_INTSRC_MASK_TOP_INT_MASK BIT(MAX77836_INTSRC_MASK_TOP_INT_SHIFT)
305#define MAX77836_INTSRC_MASK_MUIC_CHG_INT_MASK BIT(MAX77836_INTSRC_MASK_MUIC_CHG_INT_SHIFT)
306
307/* MAX77836 PMIC interrupts */
308#define MAX77836_TOPSYS_INT_T120C_SHIFT 0
309#define MAX77836_TOPSYS_INT_T140C_SHIFT 1
310#define MAX77836_TOPSYS_INT_T120C_MASK BIT(MAX77836_TOPSYS_INT_T120C_SHIFT)
311#define MAX77836_TOPSYS_INT_T140C_MASK BIT(MAX77836_TOPSYS_INT_T140C_SHIFT)
312
313/* LDO1/LDO2 CONFIG1 register */
314#define MAX77836_CNFG1_LDO_PWRMD_SHIFT 6
315#define MAX77836_CNFG1_LDO_TV_SHIFT 0
316#define MAX77836_CNFG1_LDO_PWRMD_MASK (0x3 << MAX77836_CNFG1_LDO_PWRMD_SHIFT)
317#define MAX77836_CNFG1_LDO_TV_MASK (0x3f << MAX77836_CNFG1_LDO_TV_SHIFT)
318
319/* LDO1/LDO2 CONFIG2 register */
320#define MAX77836_CNFG2_LDO_OVCLMPEN_SHIFT 7
321#define MAX77836_CNFG2_LDO_ALPMEN_SHIFT 6
322#define MAX77836_CNFG2_LDO_COMP_SHIFT 4
323#define MAX77836_CNFG2_LDO_POK_SHIFT 3
324#define MAX77836_CNFG2_LDO_ADE_SHIFT 1
325#define MAX77836_CNFG2_LDO_SS_SHIFT 0
326#define MAX77836_CNFG2_LDO_OVCLMPEN_MASK BIT(MAX77836_CNFG2_LDO_OVCLMPEN_SHIFT)
327#define MAX77836_CNFG2_LDO_ALPMEN_MASK BIT(MAX77836_CNFG2_LDO_ALPMEN_SHIFT)
328#define MAX77836_CNFG2_LDO_COMP_MASK (0x3 << MAX77836_CNFG2_LDO_COMP_SHIFT)
329#define MAX77836_CNFG2_LDO_POK_MASK BIT(MAX77836_CNFG2_LDO_POK_SHIFT)
330#define MAX77836_CNFG2_LDO_ADE_MASK BIT(MAX77836_CNFG2_LDO_ADE_SHIFT)
331#define MAX77836_CNFG2_LDO_SS_MASK BIT(MAX77836_CNFG2_LDO_SS_SHIFT)
332
333/* Slave addr = 0x6C: Fuel-Gauge/Battery */
334enum max77836_fg_reg {
335 MAX77836_FG_REG_VCELL_MSB = 0x02,
336 MAX77836_FG_REG_VCELL_LSB = 0x03,
337 MAX77836_FG_REG_SOC_MSB = 0x04,
338 MAX77836_FG_REG_SOC_LSB = 0x05,
339 MAX77836_FG_REG_MODE_H = 0x06,
340 MAX77836_FG_REG_MODE_L = 0x07,
341 MAX77836_FG_REG_VERSION_MSB = 0x08,
342 MAX77836_FG_REG_VERSION_LSB = 0x09,
343 MAX77836_FG_REG_HIBRT_H = 0x0A,
344 MAX77836_FG_REG_HIBRT_L = 0x0B,
345 MAX77836_FG_REG_CONFIG_H = 0x0C,
346 MAX77836_FG_REG_CONFIG_L = 0x0D,
347 MAX77836_FG_REG_VALRT_MIN = 0x14,
348 MAX77836_FG_REG_VALRT_MAX = 0x15,
349 MAX77836_FG_REG_CRATE_MSB = 0x16,
350 MAX77836_FG_REG_CRATE_LSB = 0x17,
351 MAX77836_FG_REG_VRESET = 0x18,
352 MAX77836_FG_REG_FGID = 0x19,
353 MAX77836_FG_REG_STATUS_H = 0x1A,
354 MAX77836_FG_REG_STATUS_L = 0x1B,
355 /*
356 * TODO: TABLE registers
357 * TODO: CMD register
358 */
359
360 MAX77836_FG_REG_END,
361};
362
251enum max14577_irq { 363enum max14577_irq {
252 /* INT1 */ 364 /* INT1 */
253 MAX14577_IRQ_INT1_ADC, 365 MAX14577_IRQ_INT1_ADC,
254 MAX14577_IRQ_INT1_ADCLOW, 366 MAX14577_IRQ_INT1_ADCLOW,
255 MAX14577_IRQ_INT1_ADCERR, 367 MAX14577_IRQ_INT1_ADCERR,
368 MAX77836_IRQ_INT1_ADC1K,
256 369
257 /* INT2 */ 370 /* INT2 */
258 MAX14577_IRQ_INT2_CHGTYP, 371 MAX14577_IRQ_INT2_CHGTYP,
@@ -260,6 +373,7 @@ enum max14577_irq {
260 MAX14577_IRQ_INT2_DCDTMR, 373 MAX14577_IRQ_INT2_DCDTMR,
261 MAX14577_IRQ_INT2_DBCHG, 374 MAX14577_IRQ_INT2_DBCHG,
262 MAX14577_IRQ_INT2_VBVOLT, 375 MAX14577_IRQ_INT2_VBVOLT,
376 MAX77836_IRQ_INT2_VIDRM,
263 377
264 /* INT3 */ 378 /* INT3 */
265 MAX14577_IRQ_INT3_EOC, 379 MAX14577_IRQ_INT3_EOC,
@@ -267,21 +381,25 @@ enum max14577_irq {
267 MAX14577_IRQ_INT3_OVP, 381 MAX14577_IRQ_INT3_OVP,
268 MAX14577_IRQ_INT3_MBCCHGERR, 382 MAX14577_IRQ_INT3_MBCCHGERR,
269 383
384 /* TOPSYS_INT, only MAX77836 */
385 MAX77836_IRQ_TOPSYS_T140C,
386 MAX77836_IRQ_TOPSYS_T120C,
387
270 MAX14577_IRQ_NUM, 388 MAX14577_IRQ_NUM,
271}; 389};
272 390
273struct max14577 { 391struct max14577 {
274 struct device *dev; 392 struct device *dev;
275 struct i2c_client *i2c; /* Slave addr = 0x4A */ 393 struct i2c_client *i2c; /* Slave addr = 0x4A */
394 struct i2c_client *i2c_pmic; /* Slave addr = 0x46 */
395 enum maxim_device_type dev_type;
276 396
277 struct regmap *regmap; 397 struct regmap *regmap; /* For MUIC and Charger */
398 struct regmap *regmap_pmic;
278 399
279 struct regmap_irq_chip_data *irq_data; 400 struct regmap_irq_chip_data *irq_data; /* For MUIC and Charger */
401 struct regmap_irq_chip_data *irq_data_pmic;
280 int irq; 402 int irq;
281
282 /* Device ID */
283 u8 vendor_id; /* Vendor Identification */
284 u8 device_id; /* Chip Version */
285}; 403};
286 404
287/* MAX14577 shared regmap API function */ 405/* MAX14577 shared regmap API function */
diff --git a/include/linux/mfd/max14577.h b/include/linux/mfd/max14577.h
index 736d39c3ec0d..c83fbed1c7b6 100644
--- a/include/linux/mfd/max14577.h
+++ b/include/linux/mfd/max14577.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * max14577.h - Driver for the Maxim 14577 2 * max14577.h - Driver for the Maxim 14577/77836
3 * 3 *
4 * Copyright (C) 2013 Samsung Electrnoics 4 * Copyright (C) 2014 Samsung Electrnoics
5 * Chanwoo Choi <cw00.choi@samsung.com> 5 * Chanwoo Choi <cw00.choi@samsung.com>
6 * Krzysztof Kozlowski <k.kozlowski@samsung.com> 6 * Krzysztof Kozlowski <k.kozlowski@samsung.com>
7 * 7 *
@@ -20,6 +20,9 @@
20 * MAX14577 has MUIC, Charger devices. 20 * MAX14577 has MUIC, Charger devices.
21 * The devices share the same I2C bus and interrupt line 21 * The devices share the same I2C bus and interrupt line
22 * included in this mfd driver. 22 * included in this mfd driver.
23 *
24 * MAX77836 has additional PMIC and Fuel-Gauge on different I2C slave
25 * addresses.
23 */ 26 */
24 27
25#ifndef __MAX14577_H__ 28#ifndef __MAX14577_H__
@@ -32,7 +35,17 @@ enum max14577_regulators {
32 MAX14577_SAFEOUT = 0, 35 MAX14577_SAFEOUT = 0,
33 MAX14577_CHARGER, 36 MAX14577_CHARGER,
34 37
35 MAX14577_REG_MAX, 38 MAX14577_REGULATOR_NUM,
39};
40
41/* MAX77836 regulator IDs */
42enum max77836_regulators {
43 MAX77836_SAFEOUT = 0,
44 MAX77836_CHARGER,
45 MAX77836_LDO1,
46 MAX77836_LDO2,
47
48 MAX77836_REGULATOR_NUM,
36}; 49};
37 50
38struct max14577_regulator_platform_data { 51struct max14577_regulator_platform_data {
diff --git a/include/linux/mfd/mc13xxx.h b/include/linux/mfd/mc13xxx.h
index a326c850f046..d63b1d309106 100644
--- a/include/linux/mfd/mc13xxx.h
+++ b/include/linux/mfd/mc13xxx.h
@@ -117,10 +117,6 @@ struct mc13xxx_led_platform_data {
117 117
118#define MAX_LED_CONTROL_REGS 6 118#define MAX_LED_CONTROL_REGS 6
119 119
120struct mc13xxx_leds_platform_data {
121 struct mc13xxx_led_platform_data *led;
122 int num_leds;
123
124/* MC13783 LED Control 0 */ 120/* MC13783 LED Control 0 */
125#define MC13783_LED_C0_ENABLE (1 << 0) 121#define MC13783_LED_C0_ENABLE (1 << 0)
126#define MC13783_LED_C0_TRIODE_MD (1 << 7) 122#define MC13783_LED_C0_TRIODE_MD (1 << 7)
@@ -169,10 +165,13 @@ struct mc13xxx_leds_platform_data {
169/* MC34708 LED Control 0 */ 165/* MC34708 LED Control 0 */
170#define MC34708_LED_C0_CURRENT_R(x) (((x) & 0x3) << 9) 166#define MC34708_LED_C0_CURRENT_R(x) (((x) & 0x3) << 9)
171#define MC34708_LED_C0_CURRENT_G(x) (((x) & 0x3) << 21) 167#define MC34708_LED_C0_CURRENT_G(x) (((x) & 0x3) << 21)
168
169struct mc13xxx_leds_platform_data {
170 struct mc13xxx_led_platform_data *led;
171 int num_leds;
172 u32 led_control[MAX_LED_CONTROL_REGS]; 172 u32 led_control[MAX_LED_CONTROL_REGS];
173}; 173};
174 174
175struct mc13xxx_buttons_platform_data {
176#define MC13783_BUTTON_DBNC_0MS 0 175#define MC13783_BUTTON_DBNC_0MS 0
177#define MC13783_BUTTON_DBNC_30MS 1 176#define MC13783_BUTTON_DBNC_30MS 1
178#define MC13783_BUTTON_DBNC_150MS 2 177#define MC13783_BUTTON_DBNC_150MS 2
@@ -180,6 +179,8 @@ struct mc13xxx_buttons_platform_data {
180#define MC13783_BUTTON_ENABLE (1 << 2) 179#define MC13783_BUTTON_ENABLE (1 << 2)
181#define MC13783_BUTTON_POL_INVERT (1 << 3) 180#define MC13783_BUTTON_POL_INVERT (1 << 3)
182#define MC13783_BUTTON_RESET_EN (1 << 4) 181#define MC13783_BUTTON_RESET_EN (1 << 4)
182
183struct mc13xxx_buttons_platform_data {
183 int b1on_flags; 184 int b1on_flags;
184 unsigned short b1on_key; 185 unsigned short b1on_key;
185 int b2on_flags; 186 int b2on_flags;
@@ -188,14 +189,14 @@ struct mc13xxx_buttons_platform_data {
188 unsigned short b3on_key; 189 unsigned short b3on_key;
189}; 190};
190 191
192#define MC13783_TS_ATO_FIRST false
193#define MC13783_TS_ATO_EACH true
194
191struct mc13xxx_ts_platform_data { 195struct mc13xxx_ts_platform_data {
192 /* Delay between Touchscreen polarization and ADC Conversion. 196 /* Delay between Touchscreen polarization and ADC Conversion.
193 * Given in clock ticks of a 32 kHz clock which gives a granularity of 197 * Given in clock ticks of a 32 kHz clock which gives a granularity of
194 * about 30.5ms */ 198 * about 30.5ms */
195 u8 ato; 199 u8 ato;
196
197#define MC13783_TS_ATO_FIRST false
198#define MC13783_TS_ATO_EACH true
199 /* Use the ATO delay only for the first conversion or for each one */ 200 /* Use the ATO delay only for the first conversion or for each one */
200 bool atox; 201 bool atox;
201}; 202};
@@ -210,11 +211,12 @@ struct mc13xxx_codec_platform_data {
210 enum mc13783_ssi_port dac_ssi_port; 211 enum mc13783_ssi_port dac_ssi_port;
211}; 212};
212 213
213struct mc13xxx_platform_data { 214#define MC13XXX_USE_TOUCHSCREEN (1 << 0)
214#define MC13XXX_USE_TOUCHSCREEN (1 << 0)
215#define MC13XXX_USE_CODEC (1 << 1) 215#define MC13XXX_USE_CODEC (1 << 1)
216#define MC13XXX_USE_ADC (1 << 2) 216#define MC13XXX_USE_ADC (1 << 2)
217#define MC13XXX_USE_RTC (1 << 3) 217#define MC13XXX_USE_RTC (1 << 3)
218
219struct mc13xxx_platform_data {
218 unsigned int flags; 220 unsigned int flags;
219 221
220 struct mc13xxx_regulator_platform_data regulators; 222 struct mc13xxx_regulator_platform_data regulators;
diff --git a/include/linux/mfd/palmas.h b/include/linux/mfd/palmas.h
index 9974e387e483..3420e09e2e20 100644
--- a/include/linux/mfd/palmas.h
+++ b/include/linux/mfd/palmas.h
@@ -415,7 +415,7 @@ struct palmas_usb {
415 struct palmas *palmas; 415 struct palmas *palmas;
416 struct device *dev; 416 struct device *dev;
417 417
418 struct extcon_dev edev; 418 struct extcon_dev *edev;
419 419
420 int id_otg_irq; 420 int id_otg_irq;
421 int id_irq; 421 int id_irq;
@@ -482,10 +482,10 @@ enum usb_irq_events {
482 482
483/* helper macro to get correct slave number */ 483/* helper macro to get correct slave number */
484#define PALMAS_BASE_TO_SLAVE(x) ((x >> 8) - 1) 484#define PALMAS_BASE_TO_SLAVE(x) ((x >> 8) - 1)
485#define PALMAS_BASE_TO_REG(x, y) ((x & 0xff) + y) 485#define PALMAS_BASE_TO_REG(x, y) ((x & 0xFF) + y)
486 486
487/* Base addresses of IP blocks in Palmas */ 487/* Base addresses of IP blocks in Palmas */
488#define PALMAS_SMPS_DVS_BASE 0x20 488#define PALMAS_SMPS_DVS_BASE 0x020
489#define PALMAS_RTC_BASE 0x100 489#define PALMAS_RTC_BASE 0x100
490#define PALMAS_VALIDITY_BASE 0x118 490#define PALMAS_VALIDITY_BASE 0x118
491#define PALMAS_SMPS_BASE 0x120 491#define PALMAS_SMPS_BASE 0x120
@@ -504,19 +504,19 @@ enum usb_irq_events {
504#define PALMAS_TRIM_GPADC_BASE 0x3CD 504#define PALMAS_TRIM_GPADC_BASE 0x3CD
505 505
506/* Registers for function RTC */ 506/* Registers for function RTC */
507#define PALMAS_SECONDS_REG 0x0 507#define PALMAS_SECONDS_REG 0x00
508#define PALMAS_MINUTES_REG 0x1 508#define PALMAS_MINUTES_REG 0x01
509#define PALMAS_HOURS_REG 0x2 509#define PALMAS_HOURS_REG 0x02
510#define PALMAS_DAYS_REG 0x3 510#define PALMAS_DAYS_REG 0x03
511#define PALMAS_MONTHS_REG 0x4 511#define PALMAS_MONTHS_REG 0x04
512#define PALMAS_YEARS_REG 0x5 512#define PALMAS_YEARS_REG 0x05
513#define PALMAS_WEEKS_REG 0x6 513#define PALMAS_WEEKS_REG 0x06
514#define PALMAS_ALARM_SECONDS_REG 0x8 514#define PALMAS_ALARM_SECONDS_REG 0x08
515#define PALMAS_ALARM_MINUTES_REG 0x9 515#define PALMAS_ALARM_MINUTES_REG 0x09
516#define PALMAS_ALARM_HOURS_REG 0xA 516#define PALMAS_ALARM_HOURS_REG 0x0A
517#define PALMAS_ALARM_DAYS_REG 0xB 517#define PALMAS_ALARM_DAYS_REG 0x0B
518#define PALMAS_ALARM_MONTHS_REG 0xC 518#define PALMAS_ALARM_MONTHS_REG 0x0C
519#define PALMAS_ALARM_YEARS_REG 0xD 519#define PALMAS_ALARM_YEARS_REG 0x0D
520#define PALMAS_RTC_CTRL_REG 0x10 520#define PALMAS_RTC_CTRL_REG 0x10
521#define PALMAS_RTC_STATUS_REG 0x11 521#define PALMAS_RTC_STATUS_REG 0x11
522#define PALMAS_RTC_INTERRUPTS_REG 0x12 522#define PALMAS_RTC_INTERRUPTS_REG 0x12
@@ -527,201 +527,201 @@ enum usb_irq_events {
527 527
528/* Bit definitions for SECONDS_REG */ 528/* Bit definitions for SECONDS_REG */
529#define PALMAS_SECONDS_REG_SEC1_MASK 0x70 529#define PALMAS_SECONDS_REG_SEC1_MASK 0x70
530#define PALMAS_SECONDS_REG_SEC1_SHIFT 4 530#define PALMAS_SECONDS_REG_SEC1_SHIFT 0x04
531#define PALMAS_SECONDS_REG_SEC0_MASK 0x0f 531#define PALMAS_SECONDS_REG_SEC0_MASK 0x0F
532#define PALMAS_SECONDS_REG_SEC0_SHIFT 0 532#define PALMAS_SECONDS_REG_SEC0_SHIFT 0x00
533 533
534/* Bit definitions for MINUTES_REG */ 534/* Bit definitions for MINUTES_REG */
535#define PALMAS_MINUTES_REG_MIN1_MASK 0x70 535#define PALMAS_MINUTES_REG_MIN1_MASK 0x70
536#define PALMAS_MINUTES_REG_MIN1_SHIFT 4 536#define PALMAS_MINUTES_REG_MIN1_SHIFT 0x04
537#define PALMAS_MINUTES_REG_MIN0_MASK 0x0f 537#define PALMAS_MINUTES_REG_MIN0_MASK 0x0F
538#define PALMAS_MINUTES_REG_MIN0_SHIFT 0 538#define PALMAS_MINUTES_REG_MIN0_SHIFT 0x00
539 539
540/* Bit definitions for HOURS_REG */ 540/* Bit definitions for HOURS_REG */
541#define PALMAS_HOURS_REG_PM_NAM 0x80 541#define PALMAS_HOURS_REG_PM_NAM 0x80
542#define PALMAS_HOURS_REG_PM_NAM_SHIFT 7 542#define PALMAS_HOURS_REG_PM_NAM_SHIFT 0x07
543#define PALMAS_HOURS_REG_HOUR1_MASK 0x30 543#define PALMAS_HOURS_REG_HOUR1_MASK 0x30
544#define PALMAS_HOURS_REG_HOUR1_SHIFT 4 544#define PALMAS_HOURS_REG_HOUR1_SHIFT 0x04
545#define PALMAS_HOURS_REG_HOUR0_MASK 0x0f 545#define PALMAS_HOURS_REG_HOUR0_MASK 0x0F
546#define PALMAS_HOURS_REG_HOUR0_SHIFT 0 546#define PALMAS_HOURS_REG_HOUR0_SHIFT 0x00
547 547
548/* Bit definitions for DAYS_REG */ 548/* Bit definitions for DAYS_REG */
549#define PALMAS_DAYS_REG_DAY1_MASK 0x30 549#define PALMAS_DAYS_REG_DAY1_MASK 0x30
550#define PALMAS_DAYS_REG_DAY1_SHIFT 4 550#define PALMAS_DAYS_REG_DAY1_SHIFT 0x04
551#define PALMAS_DAYS_REG_DAY0_MASK 0x0f 551#define PALMAS_DAYS_REG_DAY0_MASK 0x0F
552#define PALMAS_DAYS_REG_DAY0_SHIFT 0 552#define PALMAS_DAYS_REG_DAY0_SHIFT 0x00
553 553
554/* Bit definitions for MONTHS_REG */ 554/* Bit definitions for MONTHS_REG */
555#define PALMAS_MONTHS_REG_MONTH1 0x10 555#define PALMAS_MONTHS_REG_MONTH1 0x10
556#define PALMAS_MONTHS_REG_MONTH1_SHIFT 4 556#define PALMAS_MONTHS_REG_MONTH1_SHIFT 0x04
557#define PALMAS_MONTHS_REG_MONTH0_MASK 0x0f 557#define PALMAS_MONTHS_REG_MONTH0_MASK 0x0F
558#define PALMAS_MONTHS_REG_MONTH0_SHIFT 0 558#define PALMAS_MONTHS_REG_MONTH0_SHIFT 0x00
559 559
560/* Bit definitions for YEARS_REG */ 560/* Bit definitions for YEARS_REG */
561#define PALMAS_YEARS_REG_YEAR1_MASK 0xf0 561#define PALMAS_YEARS_REG_YEAR1_MASK 0xf0
562#define PALMAS_YEARS_REG_YEAR1_SHIFT 4 562#define PALMAS_YEARS_REG_YEAR1_SHIFT 0x04
563#define PALMAS_YEARS_REG_YEAR0_MASK 0x0f 563#define PALMAS_YEARS_REG_YEAR0_MASK 0x0F
564#define PALMAS_YEARS_REG_YEAR0_SHIFT 0 564#define PALMAS_YEARS_REG_YEAR0_SHIFT 0x00
565 565
566/* Bit definitions for WEEKS_REG */ 566/* Bit definitions for WEEKS_REG */
567#define PALMAS_WEEKS_REG_WEEK_MASK 0x07 567#define PALMAS_WEEKS_REG_WEEK_MASK 0x07
568#define PALMAS_WEEKS_REG_WEEK_SHIFT 0 568#define PALMAS_WEEKS_REG_WEEK_SHIFT 0x00
569 569
570/* Bit definitions for ALARM_SECONDS_REG */ 570/* Bit definitions for ALARM_SECONDS_REG */
571#define PALMAS_ALARM_SECONDS_REG_ALARM_SEC1_MASK 0x70 571#define PALMAS_ALARM_SECONDS_REG_ALARM_SEC1_MASK 0x70
572#define PALMAS_ALARM_SECONDS_REG_ALARM_SEC1_SHIFT 4 572#define PALMAS_ALARM_SECONDS_REG_ALARM_SEC1_SHIFT 0x04
573#define PALMAS_ALARM_SECONDS_REG_ALARM_SEC0_MASK 0x0f 573#define PALMAS_ALARM_SECONDS_REG_ALARM_SEC0_MASK 0x0F
574#define PALMAS_ALARM_SECONDS_REG_ALARM_SEC0_SHIFT 0 574#define PALMAS_ALARM_SECONDS_REG_ALARM_SEC0_SHIFT 0x00
575 575
576/* Bit definitions for ALARM_MINUTES_REG */ 576/* Bit definitions for ALARM_MINUTES_REG */
577#define PALMAS_ALARM_MINUTES_REG_ALARM_MIN1_MASK 0x70 577#define PALMAS_ALARM_MINUTES_REG_ALARM_MIN1_MASK 0x70
578#define PALMAS_ALARM_MINUTES_REG_ALARM_MIN1_SHIFT 4 578#define PALMAS_ALARM_MINUTES_REG_ALARM_MIN1_SHIFT 0x04
579#define PALMAS_ALARM_MINUTES_REG_ALARM_MIN0_MASK 0x0f 579#define PALMAS_ALARM_MINUTES_REG_ALARM_MIN0_MASK 0x0F
580#define PALMAS_ALARM_MINUTES_REG_ALARM_MIN0_SHIFT 0 580#define PALMAS_ALARM_MINUTES_REG_ALARM_MIN0_SHIFT 0x00
581 581
582/* Bit definitions for ALARM_HOURS_REG */ 582/* Bit definitions for ALARM_HOURS_REG */
583#define PALMAS_ALARM_HOURS_REG_ALARM_PM_NAM 0x80 583#define PALMAS_ALARM_HOURS_REG_ALARM_PM_NAM 0x80
584#define PALMAS_ALARM_HOURS_REG_ALARM_PM_NAM_SHIFT 7 584#define PALMAS_ALARM_HOURS_REG_ALARM_PM_NAM_SHIFT 0x07
585#define PALMAS_ALARM_HOURS_REG_ALARM_HOUR1_MASK 0x30 585#define PALMAS_ALARM_HOURS_REG_ALARM_HOUR1_MASK 0x30
586#define PALMAS_ALARM_HOURS_REG_ALARM_HOUR1_SHIFT 4 586#define PALMAS_ALARM_HOURS_REG_ALARM_HOUR1_SHIFT 0x04
587#define PALMAS_ALARM_HOURS_REG_ALARM_HOUR0_MASK 0x0f 587#define PALMAS_ALARM_HOURS_REG_ALARM_HOUR0_MASK 0x0F
588#define PALMAS_ALARM_HOURS_REG_ALARM_HOUR0_SHIFT 0 588#define PALMAS_ALARM_HOURS_REG_ALARM_HOUR0_SHIFT 0x00
589 589
590/* Bit definitions for ALARM_DAYS_REG */ 590/* Bit definitions for ALARM_DAYS_REG */
591#define PALMAS_ALARM_DAYS_REG_ALARM_DAY1_MASK 0x30 591#define PALMAS_ALARM_DAYS_REG_ALARM_DAY1_MASK 0x30
592#define PALMAS_ALARM_DAYS_REG_ALARM_DAY1_SHIFT 4 592#define PALMAS_ALARM_DAYS_REG_ALARM_DAY1_SHIFT 0x04
593#define PALMAS_ALARM_DAYS_REG_ALARM_DAY0_MASK 0x0f 593#define PALMAS_ALARM_DAYS_REG_ALARM_DAY0_MASK 0x0F
594#define PALMAS_ALARM_DAYS_REG_ALARM_DAY0_SHIFT 0 594#define PALMAS_ALARM_DAYS_REG_ALARM_DAY0_SHIFT 0x00
595 595
596/* Bit definitions for ALARM_MONTHS_REG */ 596/* Bit definitions for ALARM_MONTHS_REG */
597#define PALMAS_ALARM_MONTHS_REG_ALARM_MONTH1 0x10 597#define PALMAS_ALARM_MONTHS_REG_ALARM_MONTH1 0x10
598#define PALMAS_ALARM_MONTHS_REG_ALARM_MONTH1_SHIFT 4 598#define PALMAS_ALARM_MONTHS_REG_ALARM_MONTH1_SHIFT 0x04
599#define PALMAS_ALARM_MONTHS_REG_ALARM_MONTH0_MASK 0x0f 599#define PALMAS_ALARM_MONTHS_REG_ALARM_MONTH0_MASK 0x0F
600#define PALMAS_ALARM_MONTHS_REG_ALARM_MONTH0_SHIFT 0 600#define PALMAS_ALARM_MONTHS_REG_ALARM_MONTH0_SHIFT 0x00
601 601
602/* Bit definitions for ALARM_YEARS_REG */ 602/* Bit definitions for ALARM_YEARS_REG */
603#define PALMAS_ALARM_YEARS_REG_ALARM_YEAR1_MASK 0xf0 603#define PALMAS_ALARM_YEARS_REG_ALARM_YEAR1_MASK 0xf0
604#define PALMAS_ALARM_YEARS_REG_ALARM_YEAR1_SHIFT 4 604#define PALMAS_ALARM_YEARS_REG_ALARM_YEAR1_SHIFT 0x04
605#define PALMAS_ALARM_YEARS_REG_ALARM_YEAR0_MASK 0x0f 605#define PALMAS_ALARM_YEARS_REG_ALARM_YEAR0_MASK 0x0F
606#define PALMAS_ALARM_YEARS_REG_ALARM_YEAR0_SHIFT 0 606#define PALMAS_ALARM_YEARS_REG_ALARM_YEAR0_SHIFT 0x00
607 607
608/* Bit definitions for RTC_CTRL_REG */ 608/* Bit definitions for RTC_CTRL_REG */
609#define PALMAS_RTC_CTRL_REG_RTC_V_OPT 0x80 609#define PALMAS_RTC_CTRL_REG_RTC_V_OPT 0x80
610#define PALMAS_RTC_CTRL_REG_RTC_V_OPT_SHIFT 7 610#define PALMAS_RTC_CTRL_REG_RTC_V_OPT_SHIFT 0x07
611#define PALMAS_RTC_CTRL_REG_GET_TIME 0x40 611#define PALMAS_RTC_CTRL_REG_GET_TIME 0x40
612#define PALMAS_RTC_CTRL_REG_GET_TIME_SHIFT 6 612#define PALMAS_RTC_CTRL_REG_GET_TIME_SHIFT 0x06
613#define PALMAS_RTC_CTRL_REG_SET_32_COUNTER 0x20 613#define PALMAS_RTC_CTRL_REG_SET_32_COUNTER 0x20
614#define PALMAS_RTC_CTRL_REG_SET_32_COUNTER_SHIFT 5 614#define PALMAS_RTC_CTRL_REG_SET_32_COUNTER_SHIFT 0x05
615#define PALMAS_RTC_CTRL_REG_TEST_MODE 0x10 615#define PALMAS_RTC_CTRL_REG_TEST_MODE 0x10
616#define PALMAS_RTC_CTRL_REG_TEST_MODE_SHIFT 4 616#define PALMAS_RTC_CTRL_REG_TEST_MODE_SHIFT 0x04
617#define PALMAS_RTC_CTRL_REG_MODE_12_24 0x08 617#define PALMAS_RTC_CTRL_REG_MODE_12_24 0x08
618#define PALMAS_RTC_CTRL_REG_MODE_12_24_SHIFT 3 618#define PALMAS_RTC_CTRL_REG_MODE_12_24_SHIFT 0x03
619#define PALMAS_RTC_CTRL_REG_AUTO_COMP 0x04 619#define PALMAS_RTC_CTRL_REG_AUTO_COMP 0x04
620#define PALMAS_RTC_CTRL_REG_AUTO_COMP_SHIFT 2 620#define PALMAS_RTC_CTRL_REG_AUTO_COMP_SHIFT 0x02
621#define PALMAS_RTC_CTRL_REG_ROUND_30S 0x02 621#define PALMAS_RTC_CTRL_REG_ROUND_30S 0x02
622#define PALMAS_RTC_CTRL_REG_ROUND_30S_SHIFT 1 622#define PALMAS_RTC_CTRL_REG_ROUND_30S_SHIFT 0x01
623#define PALMAS_RTC_CTRL_REG_STOP_RTC 0x01 623#define PALMAS_RTC_CTRL_REG_STOP_RTC 0x01
624#define PALMAS_RTC_CTRL_REG_STOP_RTC_SHIFT 0 624#define PALMAS_RTC_CTRL_REG_STOP_RTC_SHIFT 0x00
625 625
626/* Bit definitions for RTC_STATUS_REG */ 626/* Bit definitions for RTC_STATUS_REG */
627#define PALMAS_RTC_STATUS_REG_POWER_UP 0x80 627#define PALMAS_RTC_STATUS_REG_POWER_UP 0x80
628#define PALMAS_RTC_STATUS_REG_POWER_UP_SHIFT 7 628#define PALMAS_RTC_STATUS_REG_POWER_UP_SHIFT 0x07
629#define PALMAS_RTC_STATUS_REG_ALARM 0x40 629#define PALMAS_RTC_STATUS_REG_ALARM 0x40
630#define PALMAS_RTC_STATUS_REG_ALARM_SHIFT 6 630#define PALMAS_RTC_STATUS_REG_ALARM_SHIFT 0x06
631#define PALMAS_RTC_STATUS_REG_EVENT_1D 0x20 631#define PALMAS_RTC_STATUS_REG_EVENT_1D 0x20
632#define PALMAS_RTC_STATUS_REG_EVENT_1D_SHIFT 5 632#define PALMAS_RTC_STATUS_REG_EVENT_1D_SHIFT 0x05
633#define PALMAS_RTC_STATUS_REG_EVENT_1H 0x10 633#define PALMAS_RTC_STATUS_REG_EVENT_1H 0x10
634#define PALMAS_RTC_STATUS_REG_EVENT_1H_SHIFT 4 634#define PALMAS_RTC_STATUS_REG_EVENT_1H_SHIFT 0x04
635#define PALMAS_RTC_STATUS_REG_EVENT_1M 0x08 635#define PALMAS_RTC_STATUS_REG_EVENT_1M 0x08
636#define PALMAS_RTC_STATUS_REG_EVENT_1M_SHIFT 3 636#define PALMAS_RTC_STATUS_REG_EVENT_1M_SHIFT 0x03
637#define PALMAS_RTC_STATUS_REG_EVENT_1S 0x04 637#define PALMAS_RTC_STATUS_REG_EVENT_1S 0x04
638#define PALMAS_RTC_STATUS_REG_EVENT_1S_SHIFT 2 638#define PALMAS_RTC_STATUS_REG_EVENT_1S_SHIFT 0x02
639#define PALMAS_RTC_STATUS_REG_RUN 0x02 639#define PALMAS_RTC_STATUS_REG_RUN 0x02
640#define PALMAS_RTC_STATUS_REG_RUN_SHIFT 1 640#define PALMAS_RTC_STATUS_REG_RUN_SHIFT 0x01
641 641
642/* Bit definitions for RTC_INTERRUPTS_REG */ 642/* Bit definitions for RTC_INTERRUPTS_REG */
643#define PALMAS_RTC_INTERRUPTS_REG_IT_SLEEP_MASK_EN 0x10 643#define PALMAS_RTC_INTERRUPTS_REG_IT_SLEEP_MASK_EN 0x10
644#define PALMAS_RTC_INTERRUPTS_REG_IT_SLEEP_MASK_EN_SHIFT 4 644#define PALMAS_RTC_INTERRUPTS_REG_IT_SLEEP_MASK_EN_SHIFT 0x04
645#define PALMAS_RTC_INTERRUPTS_REG_IT_ALARM 0x08 645#define PALMAS_RTC_INTERRUPTS_REG_IT_ALARM 0x08
646#define PALMAS_RTC_INTERRUPTS_REG_IT_ALARM_SHIFT 3 646#define PALMAS_RTC_INTERRUPTS_REG_IT_ALARM_SHIFT 0x03
647#define PALMAS_RTC_INTERRUPTS_REG_IT_TIMER 0x04 647#define PALMAS_RTC_INTERRUPTS_REG_IT_TIMER 0x04
648#define PALMAS_RTC_INTERRUPTS_REG_IT_TIMER_SHIFT 2 648#define PALMAS_RTC_INTERRUPTS_REG_IT_TIMER_SHIFT 0x02
649#define PALMAS_RTC_INTERRUPTS_REG_EVERY_MASK 0x03 649#define PALMAS_RTC_INTERRUPTS_REG_EVERY_MASK 0x03
650#define PALMAS_RTC_INTERRUPTS_REG_EVERY_SHIFT 0 650#define PALMAS_RTC_INTERRUPTS_REG_EVERY_SHIFT 0x00
651 651
652/* Bit definitions for RTC_COMP_LSB_REG */ 652/* Bit definitions for RTC_COMP_LSB_REG */
653#define PALMAS_RTC_COMP_LSB_REG_RTC_COMP_LSB_MASK 0xff 653#define PALMAS_RTC_COMP_LSB_REG_RTC_COMP_LSB_MASK 0xFF
654#define PALMAS_RTC_COMP_LSB_REG_RTC_COMP_LSB_SHIFT 0 654#define PALMAS_RTC_COMP_LSB_REG_RTC_COMP_LSB_SHIFT 0x00
655 655
656/* Bit definitions for RTC_COMP_MSB_REG */ 656/* Bit definitions for RTC_COMP_MSB_REG */
657#define PALMAS_RTC_COMP_MSB_REG_RTC_COMP_MSB_MASK 0xff 657#define PALMAS_RTC_COMP_MSB_REG_RTC_COMP_MSB_MASK 0xFF
658#define PALMAS_RTC_COMP_MSB_REG_RTC_COMP_MSB_SHIFT 0 658#define PALMAS_RTC_COMP_MSB_REG_RTC_COMP_MSB_SHIFT 0x00
659 659
660/* Bit definitions for RTC_RES_PROG_REG */ 660/* Bit definitions for RTC_RES_PROG_REG */
661#define PALMAS_RTC_RES_PROG_REG_SW_RES_PROG_MASK 0x3f 661#define PALMAS_RTC_RES_PROG_REG_SW_RES_PROG_MASK 0x3F
662#define PALMAS_RTC_RES_PROG_REG_SW_RES_PROG_SHIFT 0 662#define PALMAS_RTC_RES_PROG_REG_SW_RES_PROG_SHIFT 0x00
663 663
664/* Bit definitions for RTC_RESET_STATUS_REG */ 664/* Bit definitions for RTC_RESET_STATUS_REG */
665#define PALMAS_RTC_RESET_STATUS_REG_RESET_STATUS 0x01 665#define PALMAS_RTC_RESET_STATUS_REG_RESET_STATUS 0x01
666#define PALMAS_RTC_RESET_STATUS_REG_RESET_STATUS_SHIFT 0 666#define PALMAS_RTC_RESET_STATUS_REG_RESET_STATUS_SHIFT 0x00
667 667
668/* Registers for function BACKUP */ 668/* Registers for function BACKUP */
669#define PALMAS_BACKUP0 0x0 669#define PALMAS_BACKUP0 0x00
670#define PALMAS_BACKUP1 0x1 670#define PALMAS_BACKUP1 0x01
671#define PALMAS_BACKUP2 0x2 671#define PALMAS_BACKUP2 0x02
672#define PALMAS_BACKUP3 0x3 672#define PALMAS_BACKUP3 0x03
673#define PALMAS_BACKUP4 0x4 673#define PALMAS_BACKUP4 0x04
674#define PALMAS_BACKUP5 0x5 674#define PALMAS_BACKUP5 0x05
675#define PALMAS_BACKUP6 0x6 675#define PALMAS_BACKUP6 0x06
676#define PALMAS_BACKUP7 0x7 676#define PALMAS_BACKUP7 0x07
677 677
678/* Bit definitions for BACKUP0 */ 678/* Bit definitions for BACKUP0 */
679#define PALMAS_BACKUP0_BACKUP_MASK 0xff 679#define PALMAS_BACKUP0_BACKUP_MASK 0xFF
680#define PALMAS_BACKUP0_BACKUP_SHIFT 0 680#define PALMAS_BACKUP0_BACKUP_SHIFT 0x00
681 681
682/* Bit definitions for BACKUP1 */ 682/* Bit definitions for BACKUP1 */
683#define PALMAS_BACKUP1_BACKUP_MASK 0xff 683#define PALMAS_BACKUP1_BACKUP_MASK 0xFF
684#define PALMAS_BACKUP1_BACKUP_SHIFT 0 684#define PALMAS_BACKUP1_BACKUP_SHIFT 0x00
685 685
686/* Bit definitions for BACKUP2 */ 686/* Bit definitions for BACKUP2 */
687#define PALMAS_BACKUP2_BACKUP_MASK 0xff 687#define PALMAS_BACKUP2_BACKUP_MASK 0xFF
688#define PALMAS_BACKUP2_BACKUP_SHIFT 0 688#define PALMAS_BACKUP2_BACKUP_SHIFT 0x00
689 689
690/* Bit definitions for BACKUP3 */ 690/* Bit definitions for BACKUP3 */
691#define PALMAS_BACKUP3_BACKUP_MASK 0xff 691#define PALMAS_BACKUP3_BACKUP_MASK 0xFF
692#define PALMAS_BACKUP3_BACKUP_SHIFT 0 692#define PALMAS_BACKUP3_BACKUP_SHIFT 0x00
693 693
694/* Bit definitions for BACKUP4 */ 694/* Bit definitions for BACKUP4 */
695#define PALMAS_BACKUP4_BACKUP_MASK 0xff 695#define PALMAS_BACKUP4_BACKUP_MASK 0xFF
696#define PALMAS_BACKUP4_BACKUP_SHIFT 0 696#define PALMAS_BACKUP4_BACKUP_SHIFT 0x00
697 697
698/* Bit definitions for BACKUP5 */ 698/* Bit definitions for BACKUP5 */
699#define PALMAS_BACKUP5_BACKUP_MASK 0xff 699#define PALMAS_BACKUP5_BACKUP_MASK 0xFF
700#define PALMAS_BACKUP5_BACKUP_SHIFT 0 700#define PALMAS_BACKUP5_BACKUP_SHIFT 0x00
701 701
702/* Bit definitions for BACKUP6 */ 702/* Bit definitions for BACKUP6 */
703#define PALMAS_BACKUP6_BACKUP_MASK 0xff 703#define PALMAS_BACKUP6_BACKUP_MASK 0xFF
704#define PALMAS_BACKUP6_BACKUP_SHIFT 0 704#define PALMAS_BACKUP6_BACKUP_SHIFT 0x00
705 705
706/* Bit definitions for BACKUP7 */ 706/* Bit definitions for BACKUP7 */
707#define PALMAS_BACKUP7_BACKUP_MASK 0xff 707#define PALMAS_BACKUP7_BACKUP_MASK 0xFF
708#define PALMAS_BACKUP7_BACKUP_SHIFT 0 708#define PALMAS_BACKUP7_BACKUP_SHIFT 0x00
709 709
710/* Registers for function SMPS */ 710/* Registers for function SMPS */
711#define PALMAS_SMPS12_CTRL 0x0 711#define PALMAS_SMPS12_CTRL 0x00
712#define PALMAS_SMPS12_TSTEP 0x1 712#define PALMAS_SMPS12_TSTEP 0x01
713#define PALMAS_SMPS12_FORCE 0x2 713#define PALMAS_SMPS12_FORCE 0x02
714#define PALMAS_SMPS12_VOLTAGE 0x3 714#define PALMAS_SMPS12_VOLTAGE 0x03
715#define PALMAS_SMPS3_CTRL 0x4 715#define PALMAS_SMPS3_CTRL 0x04
716#define PALMAS_SMPS3_VOLTAGE 0x7 716#define PALMAS_SMPS3_VOLTAGE 0x07
717#define PALMAS_SMPS45_CTRL 0x8 717#define PALMAS_SMPS45_CTRL 0x08
718#define PALMAS_SMPS45_TSTEP 0x9 718#define PALMAS_SMPS45_TSTEP 0x09
719#define PALMAS_SMPS45_FORCE 0xA 719#define PALMAS_SMPS45_FORCE 0x0A
720#define PALMAS_SMPS45_VOLTAGE 0xB 720#define PALMAS_SMPS45_VOLTAGE 0x0B
721#define PALMAS_SMPS6_CTRL 0xC 721#define PALMAS_SMPS6_CTRL 0x0C
722#define PALMAS_SMPS6_TSTEP 0xD 722#define PALMAS_SMPS6_TSTEP 0x0D
723#define PALMAS_SMPS6_FORCE 0xE 723#define PALMAS_SMPS6_FORCE 0x0E
724#define PALMAS_SMPS6_VOLTAGE 0xF 724#define PALMAS_SMPS6_VOLTAGE 0x0F
725#define PALMAS_SMPS7_CTRL 0x10 725#define PALMAS_SMPS7_CTRL 0x10
726#define PALMAS_SMPS7_VOLTAGE 0x13 726#define PALMAS_SMPS7_VOLTAGE 0x13
727#define PALMAS_SMPS8_CTRL 0x14 727#define PALMAS_SMPS8_CTRL 0x14
@@ -744,303 +744,303 @@ enum usb_irq_events {
744 744
745/* Bit definitions for SMPS12_CTRL */ 745/* Bit definitions for SMPS12_CTRL */
746#define PALMAS_SMPS12_CTRL_WR_S 0x80 746#define PALMAS_SMPS12_CTRL_WR_S 0x80
747#define PALMAS_SMPS12_CTRL_WR_S_SHIFT 7 747#define PALMAS_SMPS12_CTRL_WR_S_SHIFT 0x07
748#define PALMAS_SMPS12_CTRL_ROOF_FLOOR_EN 0x40 748#define PALMAS_SMPS12_CTRL_ROOF_FLOOR_EN 0x40
749#define PALMAS_SMPS12_CTRL_ROOF_FLOOR_EN_SHIFT 6 749#define PALMAS_SMPS12_CTRL_ROOF_FLOOR_EN_SHIFT 0x06
750#define PALMAS_SMPS12_CTRL_STATUS_MASK 0x30 750#define PALMAS_SMPS12_CTRL_STATUS_MASK 0x30
751#define PALMAS_SMPS12_CTRL_STATUS_SHIFT 4 751#define PALMAS_SMPS12_CTRL_STATUS_SHIFT 0x04
752#define PALMAS_SMPS12_CTRL_MODE_SLEEP_MASK 0x0c 752#define PALMAS_SMPS12_CTRL_MODE_SLEEP_MASK 0x0c
753#define PALMAS_SMPS12_CTRL_MODE_SLEEP_SHIFT 2 753#define PALMAS_SMPS12_CTRL_MODE_SLEEP_SHIFT 0x02
754#define PALMAS_SMPS12_CTRL_MODE_ACTIVE_MASK 0x03 754#define PALMAS_SMPS12_CTRL_MODE_ACTIVE_MASK 0x03
755#define PALMAS_SMPS12_CTRL_MODE_ACTIVE_SHIFT 0 755#define PALMAS_SMPS12_CTRL_MODE_ACTIVE_SHIFT 0x00
756 756
757/* Bit definitions for SMPS12_TSTEP */ 757/* Bit definitions for SMPS12_TSTEP */
758#define PALMAS_SMPS12_TSTEP_TSTEP_MASK 0x03 758#define PALMAS_SMPS12_TSTEP_TSTEP_MASK 0x03
759#define PALMAS_SMPS12_TSTEP_TSTEP_SHIFT 0 759#define PALMAS_SMPS12_TSTEP_TSTEP_SHIFT 0x00
760 760
761/* Bit definitions for SMPS12_FORCE */ 761/* Bit definitions for SMPS12_FORCE */
762#define PALMAS_SMPS12_FORCE_CMD 0x80 762#define PALMAS_SMPS12_FORCE_CMD 0x80
763#define PALMAS_SMPS12_FORCE_CMD_SHIFT 7 763#define PALMAS_SMPS12_FORCE_CMD_SHIFT 0x07
764#define PALMAS_SMPS12_FORCE_VSEL_MASK 0x7f 764#define PALMAS_SMPS12_FORCE_VSEL_MASK 0x7F
765#define PALMAS_SMPS12_FORCE_VSEL_SHIFT 0 765#define PALMAS_SMPS12_FORCE_VSEL_SHIFT 0x00
766 766
767/* Bit definitions for SMPS12_VOLTAGE */ 767/* Bit definitions for SMPS12_VOLTAGE */
768#define PALMAS_SMPS12_VOLTAGE_RANGE 0x80 768#define PALMAS_SMPS12_VOLTAGE_RANGE 0x80
769#define PALMAS_SMPS12_VOLTAGE_RANGE_SHIFT 7 769#define PALMAS_SMPS12_VOLTAGE_RANGE_SHIFT 0x07
770#define PALMAS_SMPS12_VOLTAGE_VSEL_MASK 0x7f 770#define PALMAS_SMPS12_VOLTAGE_VSEL_MASK 0x7F
771#define PALMAS_SMPS12_VOLTAGE_VSEL_SHIFT 0 771#define PALMAS_SMPS12_VOLTAGE_VSEL_SHIFT 0x00
772 772
773/* Bit definitions for SMPS3_CTRL */ 773/* Bit definitions for SMPS3_CTRL */
774#define PALMAS_SMPS3_CTRL_WR_S 0x80 774#define PALMAS_SMPS3_CTRL_WR_S 0x80
775#define PALMAS_SMPS3_CTRL_WR_S_SHIFT 7 775#define PALMAS_SMPS3_CTRL_WR_S_SHIFT 0x07
776#define PALMAS_SMPS3_CTRL_STATUS_MASK 0x30 776#define PALMAS_SMPS3_CTRL_STATUS_MASK 0x30
777#define PALMAS_SMPS3_CTRL_STATUS_SHIFT 4 777#define PALMAS_SMPS3_CTRL_STATUS_SHIFT 0x04
778#define PALMAS_SMPS3_CTRL_MODE_SLEEP_MASK 0x0c 778#define PALMAS_SMPS3_CTRL_MODE_SLEEP_MASK 0x0c
779#define PALMAS_SMPS3_CTRL_MODE_SLEEP_SHIFT 2 779#define PALMAS_SMPS3_CTRL_MODE_SLEEP_SHIFT 0x02
780#define PALMAS_SMPS3_CTRL_MODE_ACTIVE_MASK 0x03 780#define PALMAS_SMPS3_CTRL_MODE_ACTIVE_MASK 0x03
781#define PALMAS_SMPS3_CTRL_MODE_ACTIVE_SHIFT 0 781#define PALMAS_SMPS3_CTRL_MODE_ACTIVE_SHIFT 0x00
782 782
783/* Bit definitions for SMPS3_VOLTAGE */ 783/* Bit definitions for SMPS3_VOLTAGE */
784#define PALMAS_SMPS3_VOLTAGE_RANGE 0x80 784#define PALMAS_SMPS3_VOLTAGE_RANGE 0x80
785#define PALMAS_SMPS3_VOLTAGE_RANGE_SHIFT 7 785#define PALMAS_SMPS3_VOLTAGE_RANGE_SHIFT 0x07
786#define PALMAS_SMPS3_VOLTAGE_VSEL_MASK 0x7f 786#define PALMAS_SMPS3_VOLTAGE_VSEL_MASK 0x7F
787#define PALMAS_SMPS3_VOLTAGE_VSEL_SHIFT 0 787#define PALMAS_SMPS3_VOLTAGE_VSEL_SHIFT 0x00
788 788
789/* Bit definitions for SMPS45_CTRL */ 789/* Bit definitions for SMPS45_CTRL */
790#define PALMAS_SMPS45_CTRL_WR_S 0x80 790#define PALMAS_SMPS45_CTRL_WR_S 0x80
791#define PALMAS_SMPS45_CTRL_WR_S_SHIFT 7 791#define PALMAS_SMPS45_CTRL_WR_S_SHIFT 0x07
792#define PALMAS_SMPS45_CTRL_ROOF_FLOOR_EN 0x40 792#define PALMAS_SMPS45_CTRL_ROOF_FLOOR_EN 0x40
793#define PALMAS_SMPS45_CTRL_ROOF_FLOOR_EN_SHIFT 6 793#define PALMAS_SMPS45_CTRL_ROOF_FLOOR_EN_SHIFT 0x06
794#define PALMAS_SMPS45_CTRL_STATUS_MASK 0x30 794#define PALMAS_SMPS45_CTRL_STATUS_MASK 0x30
795#define PALMAS_SMPS45_CTRL_STATUS_SHIFT 4 795#define PALMAS_SMPS45_CTRL_STATUS_SHIFT 0x04
796#define PALMAS_SMPS45_CTRL_MODE_SLEEP_MASK 0x0c 796#define PALMAS_SMPS45_CTRL_MODE_SLEEP_MASK 0x0c
797#define PALMAS_SMPS45_CTRL_MODE_SLEEP_SHIFT 2 797#define PALMAS_SMPS45_CTRL_MODE_SLEEP_SHIFT 0x02
798#define PALMAS_SMPS45_CTRL_MODE_ACTIVE_MASK 0x03 798#define PALMAS_SMPS45_CTRL_MODE_ACTIVE_MASK 0x03
799#define PALMAS_SMPS45_CTRL_MODE_ACTIVE_SHIFT 0 799#define PALMAS_SMPS45_CTRL_MODE_ACTIVE_SHIFT 0x00
800 800
801/* Bit definitions for SMPS45_TSTEP */ 801/* Bit definitions for SMPS45_TSTEP */
802#define PALMAS_SMPS45_TSTEP_TSTEP_MASK 0x03 802#define PALMAS_SMPS45_TSTEP_TSTEP_MASK 0x03
803#define PALMAS_SMPS45_TSTEP_TSTEP_SHIFT 0 803#define PALMAS_SMPS45_TSTEP_TSTEP_SHIFT 0x00
804 804
805/* Bit definitions for SMPS45_FORCE */ 805/* Bit definitions for SMPS45_FORCE */
806#define PALMAS_SMPS45_FORCE_CMD 0x80 806#define PALMAS_SMPS45_FORCE_CMD 0x80
807#define PALMAS_SMPS45_FORCE_CMD_SHIFT 7 807#define PALMAS_SMPS45_FORCE_CMD_SHIFT 0x07
808#define PALMAS_SMPS45_FORCE_VSEL_MASK 0x7f 808#define PALMAS_SMPS45_FORCE_VSEL_MASK 0x7F
809#define PALMAS_SMPS45_FORCE_VSEL_SHIFT 0 809#define PALMAS_SMPS45_FORCE_VSEL_SHIFT 0x00
810 810
811/* Bit definitions for SMPS45_VOLTAGE */ 811/* Bit definitions for SMPS45_VOLTAGE */
812#define PALMAS_SMPS45_VOLTAGE_RANGE 0x80 812#define PALMAS_SMPS45_VOLTAGE_RANGE 0x80
813#define PALMAS_SMPS45_VOLTAGE_RANGE_SHIFT 7 813#define PALMAS_SMPS45_VOLTAGE_RANGE_SHIFT 0x07
814#define PALMAS_SMPS45_VOLTAGE_VSEL_MASK 0x7f 814#define PALMAS_SMPS45_VOLTAGE_VSEL_MASK 0x7F
815#define PALMAS_SMPS45_VOLTAGE_VSEL_SHIFT 0 815#define PALMAS_SMPS45_VOLTAGE_VSEL_SHIFT 0x00
816 816
817/* Bit definitions for SMPS6_CTRL */ 817/* Bit definitions for SMPS6_CTRL */
818#define PALMAS_SMPS6_CTRL_WR_S 0x80 818#define PALMAS_SMPS6_CTRL_WR_S 0x80
819#define PALMAS_SMPS6_CTRL_WR_S_SHIFT 7 819#define PALMAS_SMPS6_CTRL_WR_S_SHIFT 0x07
820#define PALMAS_SMPS6_CTRL_ROOF_FLOOR_EN 0x40 820#define PALMAS_SMPS6_CTRL_ROOF_FLOOR_EN 0x40
821#define PALMAS_SMPS6_CTRL_ROOF_FLOOR_EN_SHIFT 6 821#define PALMAS_SMPS6_CTRL_ROOF_FLOOR_EN_SHIFT 0x06
822#define PALMAS_SMPS6_CTRL_STATUS_MASK 0x30 822#define PALMAS_SMPS6_CTRL_STATUS_MASK 0x30
823#define PALMAS_SMPS6_CTRL_STATUS_SHIFT 4 823#define PALMAS_SMPS6_CTRL_STATUS_SHIFT 0x04
824#define PALMAS_SMPS6_CTRL_MODE_SLEEP_MASK 0x0c 824#define PALMAS_SMPS6_CTRL_MODE_SLEEP_MASK 0x0c
825#define PALMAS_SMPS6_CTRL_MODE_SLEEP_SHIFT 2 825#define PALMAS_SMPS6_CTRL_MODE_SLEEP_SHIFT 0x02
826#define PALMAS_SMPS6_CTRL_MODE_ACTIVE_MASK 0x03 826#define PALMAS_SMPS6_CTRL_MODE_ACTIVE_MASK 0x03
827#define PALMAS_SMPS6_CTRL_MODE_ACTIVE_SHIFT 0 827#define PALMAS_SMPS6_CTRL_MODE_ACTIVE_SHIFT 0x00
828 828
829/* Bit definitions for SMPS6_TSTEP */ 829/* Bit definitions for SMPS6_TSTEP */
830#define PALMAS_SMPS6_TSTEP_TSTEP_MASK 0x03 830#define PALMAS_SMPS6_TSTEP_TSTEP_MASK 0x03
831#define PALMAS_SMPS6_TSTEP_TSTEP_SHIFT 0 831#define PALMAS_SMPS6_TSTEP_TSTEP_SHIFT 0x00
832 832
833/* Bit definitions for SMPS6_FORCE */ 833/* Bit definitions for SMPS6_FORCE */
834#define PALMAS_SMPS6_FORCE_CMD 0x80 834#define PALMAS_SMPS6_FORCE_CMD 0x80
835#define PALMAS_SMPS6_FORCE_CMD_SHIFT 7 835#define PALMAS_SMPS6_FORCE_CMD_SHIFT 0x07
836#define PALMAS_SMPS6_FORCE_VSEL_MASK 0x7f 836#define PALMAS_SMPS6_FORCE_VSEL_MASK 0x7F
837#define PALMAS_SMPS6_FORCE_VSEL_SHIFT 0 837#define PALMAS_SMPS6_FORCE_VSEL_SHIFT 0x00
838 838
839/* Bit definitions for SMPS6_VOLTAGE */ 839/* Bit definitions for SMPS6_VOLTAGE */
840#define PALMAS_SMPS6_VOLTAGE_RANGE 0x80 840#define PALMAS_SMPS6_VOLTAGE_RANGE 0x80
841#define PALMAS_SMPS6_VOLTAGE_RANGE_SHIFT 7 841#define PALMAS_SMPS6_VOLTAGE_RANGE_SHIFT 0x07
842#define PALMAS_SMPS6_VOLTAGE_VSEL_MASK 0x7f 842#define PALMAS_SMPS6_VOLTAGE_VSEL_MASK 0x7F
843#define PALMAS_SMPS6_VOLTAGE_VSEL_SHIFT 0 843#define PALMAS_SMPS6_VOLTAGE_VSEL_SHIFT 0x00
844 844
845/* Bit definitions for SMPS7_CTRL */ 845/* Bit definitions for SMPS7_CTRL */
846#define PALMAS_SMPS7_CTRL_WR_S 0x80 846#define PALMAS_SMPS7_CTRL_WR_S 0x80
847#define PALMAS_SMPS7_CTRL_WR_S_SHIFT 7 847#define PALMAS_SMPS7_CTRL_WR_S_SHIFT 0x07
848#define PALMAS_SMPS7_CTRL_STATUS_MASK 0x30 848#define PALMAS_SMPS7_CTRL_STATUS_MASK 0x30
849#define PALMAS_SMPS7_CTRL_STATUS_SHIFT 4 849#define PALMAS_SMPS7_CTRL_STATUS_SHIFT 0x04
850#define PALMAS_SMPS7_CTRL_MODE_SLEEP_MASK 0x0c 850#define PALMAS_SMPS7_CTRL_MODE_SLEEP_MASK 0x0c
851#define PALMAS_SMPS7_CTRL_MODE_SLEEP_SHIFT 2 851#define PALMAS_SMPS7_CTRL_MODE_SLEEP_SHIFT 0x02
852#define PALMAS_SMPS7_CTRL_MODE_ACTIVE_MASK 0x03 852#define PALMAS_SMPS7_CTRL_MODE_ACTIVE_MASK 0x03
853#define PALMAS_SMPS7_CTRL_MODE_ACTIVE_SHIFT 0 853#define PALMAS_SMPS7_CTRL_MODE_ACTIVE_SHIFT 0x00
854 854
855/* Bit definitions for SMPS7_VOLTAGE */ 855/* Bit definitions for SMPS7_VOLTAGE */
856#define PALMAS_SMPS7_VOLTAGE_RANGE 0x80 856#define PALMAS_SMPS7_VOLTAGE_RANGE 0x80
857#define PALMAS_SMPS7_VOLTAGE_RANGE_SHIFT 7 857#define PALMAS_SMPS7_VOLTAGE_RANGE_SHIFT 0x07
858#define PALMAS_SMPS7_VOLTAGE_VSEL_MASK 0x7f 858#define PALMAS_SMPS7_VOLTAGE_VSEL_MASK 0x7F
859#define PALMAS_SMPS7_VOLTAGE_VSEL_SHIFT 0 859#define PALMAS_SMPS7_VOLTAGE_VSEL_SHIFT 0x00
860 860
861/* Bit definitions for SMPS8_CTRL */ 861/* Bit definitions for SMPS8_CTRL */
862#define PALMAS_SMPS8_CTRL_WR_S 0x80 862#define PALMAS_SMPS8_CTRL_WR_S 0x80
863#define PALMAS_SMPS8_CTRL_WR_S_SHIFT 7 863#define PALMAS_SMPS8_CTRL_WR_S_SHIFT 0x07
864#define PALMAS_SMPS8_CTRL_ROOF_FLOOR_EN 0x40 864#define PALMAS_SMPS8_CTRL_ROOF_FLOOR_EN 0x40
865#define PALMAS_SMPS8_CTRL_ROOF_FLOOR_EN_SHIFT 6 865#define PALMAS_SMPS8_CTRL_ROOF_FLOOR_EN_SHIFT 0x06
866#define PALMAS_SMPS8_CTRL_STATUS_MASK 0x30 866#define PALMAS_SMPS8_CTRL_STATUS_MASK 0x30
867#define PALMAS_SMPS8_CTRL_STATUS_SHIFT 4 867#define PALMAS_SMPS8_CTRL_STATUS_SHIFT 0x04
868#define PALMAS_SMPS8_CTRL_MODE_SLEEP_MASK 0x0c 868#define PALMAS_SMPS8_CTRL_MODE_SLEEP_MASK 0x0c
869#define PALMAS_SMPS8_CTRL_MODE_SLEEP_SHIFT 2 869#define PALMAS_SMPS8_CTRL_MODE_SLEEP_SHIFT 0x02
870#define PALMAS_SMPS8_CTRL_MODE_ACTIVE_MASK 0x03 870#define PALMAS_SMPS8_CTRL_MODE_ACTIVE_MASK 0x03
871#define PALMAS_SMPS8_CTRL_MODE_ACTIVE_SHIFT 0 871#define PALMAS_SMPS8_CTRL_MODE_ACTIVE_SHIFT 0x00
872 872
873/* Bit definitions for SMPS8_TSTEP */ 873/* Bit definitions for SMPS8_TSTEP */
874#define PALMAS_SMPS8_TSTEP_TSTEP_MASK 0x03 874#define PALMAS_SMPS8_TSTEP_TSTEP_MASK 0x03
875#define PALMAS_SMPS8_TSTEP_TSTEP_SHIFT 0 875#define PALMAS_SMPS8_TSTEP_TSTEP_SHIFT 0x00
876 876
877/* Bit definitions for SMPS8_FORCE */ 877/* Bit definitions for SMPS8_FORCE */
878#define PALMAS_SMPS8_FORCE_CMD 0x80 878#define PALMAS_SMPS8_FORCE_CMD 0x80
879#define PALMAS_SMPS8_FORCE_CMD_SHIFT 7 879#define PALMAS_SMPS8_FORCE_CMD_SHIFT 0x07
880#define PALMAS_SMPS8_FORCE_VSEL_MASK 0x7f 880#define PALMAS_SMPS8_FORCE_VSEL_MASK 0x7F
881#define PALMAS_SMPS8_FORCE_VSEL_SHIFT 0 881#define PALMAS_SMPS8_FORCE_VSEL_SHIFT 0x00
882 882
883/* Bit definitions for SMPS8_VOLTAGE */ 883/* Bit definitions for SMPS8_VOLTAGE */
884#define PALMAS_SMPS8_VOLTAGE_RANGE 0x80 884#define PALMAS_SMPS8_VOLTAGE_RANGE 0x80
885#define PALMAS_SMPS8_VOLTAGE_RANGE_SHIFT 7 885#define PALMAS_SMPS8_VOLTAGE_RANGE_SHIFT 0x07
886#define PALMAS_SMPS8_VOLTAGE_VSEL_MASK 0x7f 886#define PALMAS_SMPS8_VOLTAGE_VSEL_MASK 0x7F
887#define PALMAS_SMPS8_VOLTAGE_VSEL_SHIFT 0 887#define PALMAS_SMPS8_VOLTAGE_VSEL_SHIFT 0x00
888 888
889/* Bit definitions for SMPS9_CTRL */ 889/* Bit definitions for SMPS9_CTRL */
890#define PALMAS_SMPS9_CTRL_WR_S 0x80 890#define PALMAS_SMPS9_CTRL_WR_S 0x80
891#define PALMAS_SMPS9_CTRL_WR_S_SHIFT 7 891#define PALMAS_SMPS9_CTRL_WR_S_SHIFT 0x07
892#define PALMAS_SMPS9_CTRL_STATUS_MASK 0x30 892#define PALMAS_SMPS9_CTRL_STATUS_MASK 0x30
893#define PALMAS_SMPS9_CTRL_STATUS_SHIFT 4 893#define PALMAS_SMPS9_CTRL_STATUS_SHIFT 0x04
894#define PALMAS_SMPS9_CTRL_MODE_SLEEP_MASK 0x0c 894#define PALMAS_SMPS9_CTRL_MODE_SLEEP_MASK 0x0c
895#define PALMAS_SMPS9_CTRL_MODE_SLEEP_SHIFT 2 895#define PALMAS_SMPS9_CTRL_MODE_SLEEP_SHIFT 0x02
896#define PALMAS_SMPS9_CTRL_MODE_ACTIVE_MASK 0x03 896#define PALMAS_SMPS9_CTRL_MODE_ACTIVE_MASK 0x03
897#define PALMAS_SMPS9_CTRL_MODE_ACTIVE_SHIFT 0 897#define PALMAS_SMPS9_CTRL_MODE_ACTIVE_SHIFT 0x00
898 898
899/* Bit definitions for SMPS9_VOLTAGE */ 899/* Bit definitions for SMPS9_VOLTAGE */
900#define PALMAS_SMPS9_VOLTAGE_RANGE 0x80 900#define PALMAS_SMPS9_VOLTAGE_RANGE 0x80
901#define PALMAS_SMPS9_VOLTAGE_RANGE_SHIFT 7 901#define PALMAS_SMPS9_VOLTAGE_RANGE_SHIFT 0x07
902#define PALMAS_SMPS9_VOLTAGE_VSEL_MASK 0x7f 902#define PALMAS_SMPS9_VOLTAGE_VSEL_MASK 0x7F
903#define PALMAS_SMPS9_VOLTAGE_VSEL_SHIFT 0 903#define PALMAS_SMPS9_VOLTAGE_VSEL_SHIFT 0x00
904 904
905/* Bit definitions for SMPS10_CTRL */ 905/* Bit definitions for SMPS10_CTRL */
906#define PALMAS_SMPS10_CTRL_MODE_SLEEP_MASK 0xf0 906#define PALMAS_SMPS10_CTRL_MODE_SLEEP_MASK 0xf0
907#define PALMAS_SMPS10_CTRL_MODE_SLEEP_SHIFT 4 907#define PALMAS_SMPS10_CTRL_MODE_SLEEP_SHIFT 0x04
908#define PALMAS_SMPS10_CTRL_MODE_ACTIVE_MASK 0x0f 908#define PALMAS_SMPS10_CTRL_MODE_ACTIVE_MASK 0x0F
909#define PALMAS_SMPS10_CTRL_MODE_ACTIVE_SHIFT 0 909#define PALMAS_SMPS10_CTRL_MODE_ACTIVE_SHIFT 0x00
910 910
911/* Bit definitions for SMPS10_STATUS */ 911/* Bit definitions for SMPS10_STATUS */
912#define PALMAS_SMPS10_STATUS_STATUS_MASK 0x0f 912#define PALMAS_SMPS10_STATUS_STATUS_MASK 0x0F
913#define PALMAS_SMPS10_STATUS_STATUS_SHIFT 0 913#define PALMAS_SMPS10_STATUS_STATUS_SHIFT 0x00
914 914
915/* Bit definitions for SMPS_CTRL */ 915/* Bit definitions for SMPS_CTRL */
916#define PALMAS_SMPS_CTRL_SMPS45_SMPS457_EN 0x20 916#define PALMAS_SMPS_CTRL_SMPS45_SMPS457_EN 0x20
917#define PALMAS_SMPS_CTRL_SMPS45_SMPS457_EN_SHIFT 5 917#define PALMAS_SMPS_CTRL_SMPS45_SMPS457_EN_SHIFT 0x05
918#define PALMAS_SMPS_CTRL_SMPS12_SMPS123_EN 0x10 918#define PALMAS_SMPS_CTRL_SMPS12_SMPS123_EN 0x10
919#define PALMAS_SMPS_CTRL_SMPS12_SMPS123_EN_SHIFT 4 919#define PALMAS_SMPS_CTRL_SMPS12_SMPS123_EN_SHIFT 0x04
920#define PALMAS_SMPS_CTRL_SMPS45_PHASE_CTRL_MASK 0x0c 920#define PALMAS_SMPS_CTRL_SMPS45_PHASE_CTRL_MASK 0x0c
921#define PALMAS_SMPS_CTRL_SMPS45_PHASE_CTRL_SHIFT 2 921#define PALMAS_SMPS_CTRL_SMPS45_PHASE_CTRL_SHIFT 0x02
922#define PALMAS_SMPS_CTRL_SMPS123_PHASE_CTRL_MASK 0x03 922#define PALMAS_SMPS_CTRL_SMPS123_PHASE_CTRL_MASK 0x03
923#define PALMAS_SMPS_CTRL_SMPS123_PHASE_CTRL_SHIFT 0 923#define PALMAS_SMPS_CTRL_SMPS123_PHASE_CTRL_SHIFT 0x00
924 924
925/* Bit definitions for SMPS_PD_CTRL */ 925/* Bit definitions for SMPS_PD_CTRL */
926#define PALMAS_SMPS_PD_CTRL_SMPS9 0x40 926#define PALMAS_SMPS_PD_CTRL_SMPS9 0x40
927#define PALMAS_SMPS_PD_CTRL_SMPS9_SHIFT 6 927#define PALMAS_SMPS_PD_CTRL_SMPS9_SHIFT 0x06
928#define PALMAS_SMPS_PD_CTRL_SMPS8 0x20 928#define PALMAS_SMPS_PD_CTRL_SMPS8 0x20
929#define PALMAS_SMPS_PD_CTRL_SMPS8_SHIFT 5 929#define PALMAS_SMPS_PD_CTRL_SMPS8_SHIFT 0x05
930#define PALMAS_SMPS_PD_CTRL_SMPS7 0x10 930#define PALMAS_SMPS_PD_CTRL_SMPS7 0x10
931#define PALMAS_SMPS_PD_CTRL_SMPS7_SHIFT 4 931#define PALMAS_SMPS_PD_CTRL_SMPS7_SHIFT 0x04
932#define PALMAS_SMPS_PD_CTRL_SMPS6 0x08 932#define PALMAS_SMPS_PD_CTRL_SMPS6 0x08
933#define PALMAS_SMPS_PD_CTRL_SMPS6_SHIFT 3 933#define PALMAS_SMPS_PD_CTRL_SMPS6_SHIFT 0x03
934#define PALMAS_SMPS_PD_CTRL_SMPS45 0x04 934#define PALMAS_SMPS_PD_CTRL_SMPS45 0x04
935#define PALMAS_SMPS_PD_CTRL_SMPS45_SHIFT 2 935#define PALMAS_SMPS_PD_CTRL_SMPS45_SHIFT 0x02
936#define PALMAS_SMPS_PD_CTRL_SMPS3 0x02 936#define PALMAS_SMPS_PD_CTRL_SMPS3 0x02
937#define PALMAS_SMPS_PD_CTRL_SMPS3_SHIFT 1 937#define PALMAS_SMPS_PD_CTRL_SMPS3_SHIFT 0x01
938#define PALMAS_SMPS_PD_CTRL_SMPS12 0x01 938#define PALMAS_SMPS_PD_CTRL_SMPS12 0x01
939#define PALMAS_SMPS_PD_CTRL_SMPS12_SHIFT 0 939#define PALMAS_SMPS_PD_CTRL_SMPS12_SHIFT 0x00
940 940
941/* Bit definitions for SMPS_THERMAL_EN */ 941/* Bit definitions for SMPS_THERMAL_EN */
942#define PALMAS_SMPS_THERMAL_EN_SMPS9 0x40 942#define PALMAS_SMPS_THERMAL_EN_SMPS9 0x40
943#define PALMAS_SMPS_THERMAL_EN_SMPS9_SHIFT 6 943#define PALMAS_SMPS_THERMAL_EN_SMPS9_SHIFT 0x06
944#define PALMAS_SMPS_THERMAL_EN_SMPS8 0x20 944#define PALMAS_SMPS_THERMAL_EN_SMPS8 0x20
945#define PALMAS_SMPS_THERMAL_EN_SMPS8_SHIFT 5 945#define PALMAS_SMPS_THERMAL_EN_SMPS8_SHIFT 0x05
946#define PALMAS_SMPS_THERMAL_EN_SMPS6 0x08 946#define PALMAS_SMPS_THERMAL_EN_SMPS6 0x08
947#define PALMAS_SMPS_THERMAL_EN_SMPS6_SHIFT 3 947#define PALMAS_SMPS_THERMAL_EN_SMPS6_SHIFT 0x03
948#define PALMAS_SMPS_THERMAL_EN_SMPS457 0x04 948#define PALMAS_SMPS_THERMAL_EN_SMPS457 0x04
949#define PALMAS_SMPS_THERMAL_EN_SMPS457_SHIFT 2 949#define PALMAS_SMPS_THERMAL_EN_SMPS457_SHIFT 0x02
950#define PALMAS_SMPS_THERMAL_EN_SMPS123 0x01 950#define PALMAS_SMPS_THERMAL_EN_SMPS123 0x01
951#define PALMAS_SMPS_THERMAL_EN_SMPS123_SHIFT 0 951#define PALMAS_SMPS_THERMAL_EN_SMPS123_SHIFT 0x00
952 952
953/* Bit definitions for SMPS_THERMAL_STATUS */ 953/* Bit definitions for SMPS_THERMAL_STATUS */
954#define PALMAS_SMPS_THERMAL_STATUS_SMPS9 0x40 954#define PALMAS_SMPS_THERMAL_STATUS_SMPS9 0x40
955#define PALMAS_SMPS_THERMAL_STATUS_SMPS9_SHIFT 6 955#define PALMAS_SMPS_THERMAL_STATUS_SMPS9_SHIFT 0x06
956#define PALMAS_SMPS_THERMAL_STATUS_SMPS8 0x20 956#define PALMAS_SMPS_THERMAL_STATUS_SMPS8 0x20
957#define PALMAS_SMPS_THERMAL_STATUS_SMPS8_SHIFT 5 957#define PALMAS_SMPS_THERMAL_STATUS_SMPS8_SHIFT 0x05
958#define PALMAS_SMPS_THERMAL_STATUS_SMPS6 0x08 958#define PALMAS_SMPS_THERMAL_STATUS_SMPS6 0x08
959#define PALMAS_SMPS_THERMAL_STATUS_SMPS6_SHIFT 3 959#define PALMAS_SMPS_THERMAL_STATUS_SMPS6_SHIFT 0x03
960#define PALMAS_SMPS_THERMAL_STATUS_SMPS457 0x04 960#define PALMAS_SMPS_THERMAL_STATUS_SMPS457 0x04
961#define PALMAS_SMPS_THERMAL_STATUS_SMPS457_SHIFT 2 961#define PALMAS_SMPS_THERMAL_STATUS_SMPS457_SHIFT 0x02
962#define PALMAS_SMPS_THERMAL_STATUS_SMPS123 0x01 962#define PALMAS_SMPS_THERMAL_STATUS_SMPS123 0x01
963#define PALMAS_SMPS_THERMAL_STATUS_SMPS123_SHIFT 0 963#define PALMAS_SMPS_THERMAL_STATUS_SMPS123_SHIFT 0x00
964 964
965/* Bit definitions for SMPS_SHORT_STATUS */ 965/* Bit definitions for SMPS_SHORT_STATUS */
966#define PALMAS_SMPS_SHORT_STATUS_SMPS10 0x80 966#define PALMAS_SMPS_SHORT_STATUS_SMPS10 0x80
967#define PALMAS_SMPS_SHORT_STATUS_SMPS10_SHIFT 7 967#define PALMAS_SMPS_SHORT_STATUS_SMPS10_SHIFT 0x07
968#define PALMAS_SMPS_SHORT_STATUS_SMPS9 0x40 968#define PALMAS_SMPS_SHORT_STATUS_SMPS9 0x40
969#define PALMAS_SMPS_SHORT_STATUS_SMPS9_SHIFT 6 969#define PALMAS_SMPS_SHORT_STATUS_SMPS9_SHIFT 0x06
970#define PALMAS_SMPS_SHORT_STATUS_SMPS8 0x20 970#define PALMAS_SMPS_SHORT_STATUS_SMPS8 0x20
971#define PALMAS_SMPS_SHORT_STATUS_SMPS8_SHIFT 5 971#define PALMAS_SMPS_SHORT_STATUS_SMPS8_SHIFT 0x05
972#define PALMAS_SMPS_SHORT_STATUS_SMPS7 0x10 972#define PALMAS_SMPS_SHORT_STATUS_SMPS7 0x10
973#define PALMAS_SMPS_SHORT_STATUS_SMPS7_SHIFT 4 973#define PALMAS_SMPS_SHORT_STATUS_SMPS7_SHIFT 0x04
974#define PALMAS_SMPS_SHORT_STATUS_SMPS6 0x08 974#define PALMAS_SMPS_SHORT_STATUS_SMPS6 0x08
975#define PALMAS_SMPS_SHORT_STATUS_SMPS6_SHIFT 3 975#define PALMAS_SMPS_SHORT_STATUS_SMPS6_SHIFT 0x03
976#define PALMAS_SMPS_SHORT_STATUS_SMPS45 0x04 976#define PALMAS_SMPS_SHORT_STATUS_SMPS45 0x04
977#define PALMAS_SMPS_SHORT_STATUS_SMPS45_SHIFT 2 977#define PALMAS_SMPS_SHORT_STATUS_SMPS45_SHIFT 0x02
978#define PALMAS_SMPS_SHORT_STATUS_SMPS3 0x02 978#define PALMAS_SMPS_SHORT_STATUS_SMPS3 0x02
979#define PALMAS_SMPS_SHORT_STATUS_SMPS3_SHIFT 1 979#define PALMAS_SMPS_SHORT_STATUS_SMPS3_SHIFT 0x01
980#define PALMAS_SMPS_SHORT_STATUS_SMPS12 0x01 980#define PALMAS_SMPS_SHORT_STATUS_SMPS12 0x01
981#define PALMAS_SMPS_SHORT_STATUS_SMPS12_SHIFT 0 981#define PALMAS_SMPS_SHORT_STATUS_SMPS12_SHIFT 0x00
982 982
983/* Bit definitions for SMPS_NEGATIVE_CURRENT_LIMIT_EN */ 983/* Bit definitions for SMPS_NEGATIVE_CURRENT_LIMIT_EN */
984#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS9 0x40 984#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS9 0x40
985#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS9_SHIFT 6 985#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS9_SHIFT 0x06
986#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS8 0x20 986#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS8 0x20
987#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS8_SHIFT 5 987#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS8_SHIFT 0x05
988#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS7 0x10 988#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS7 0x10
989#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS7_SHIFT 4 989#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS7_SHIFT 0x04
990#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS6 0x08 990#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS6 0x08
991#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS6_SHIFT 3 991#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS6_SHIFT 0x03
992#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS45 0x04 992#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS45 0x04
993#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS45_SHIFT 2 993#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS45_SHIFT 0x02
994#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS3 0x02 994#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS3 0x02
995#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS3_SHIFT 1 995#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS3_SHIFT 0x01
996#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS12 0x01 996#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS12 0x01
997#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS12_SHIFT 0 997#define PALMAS_SMPS_NEGATIVE_CURRENT_LIMIT_EN_SMPS12_SHIFT 0x00
998 998
999/* Bit definitions for SMPS_POWERGOOD_MASK1 */ 999/* Bit definitions for SMPS_POWERGOOD_MASK1 */
1000#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS10 0x80 1000#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS10 0x80
1001#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS10_SHIFT 7 1001#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS10_SHIFT 0x07
1002#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS9 0x40 1002#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS9 0x40
1003#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS9_SHIFT 6 1003#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS9_SHIFT 0x06
1004#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS8 0x20 1004#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS8 0x20
1005#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS8_SHIFT 5 1005#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS8_SHIFT 0x05
1006#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS7 0x10 1006#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS7 0x10
1007#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS7_SHIFT 4 1007#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS7_SHIFT 0x04
1008#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS6 0x08 1008#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS6 0x08
1009#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS6_SHIFT 3 1009#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS6_SHIFT 0x03
1010#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS45 0x04 1010#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS45 0x04
1011#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS45_SHIFT 2 1011#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS45_SHIFT 0x02
1012#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS3 0x02 1012#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS3 0x02
1013#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS3_SHIFT 1 1013#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS3_SHIFT 0x01
1014#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS12 0x01 1014#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS12 0x01
1015#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS12_SHIFT 0 1015#define PALMAS_SMPS_POWERGOOD_MASK1_SMPS12_SHIFT 0x00
1016 1016
1017/* Bit definitions for SMPS_POWERGOOD_MASK2 */ 1017/* Bit definitions for SMPS_POWERGOOD_MASK2 */
1018#define PALMAS_SMPS_POWERGOOD_MASK2_POWERGOOD_TYPE_SELECT 0x80 1018#define PALMAS_SMPS_POWERGOOD_MASK2_POWERGOOD_TYPE_SELECT 0x80
1019#define PALMAS_SMPS_POWERGOOD_MASK2_POWERGOOD_TYPE_SELECT_SHIFT 7 1019#define PALMAS_SMPS_POWERGOOD_MASK2_POWERGOOD_TYPE_SELECT_SHIFT 0x07
1020#define PALMAS_SMPS_POWERGOOD_MASK2_GPIO_7 0x04 1020#define PALMAS_SMPS_POWERGOOD_MASK2_GPIO_7 0x04
1021#define PALMAS_SMPS_POWERGOOD_MASK2_GPIO_7_SHIFT 2 1021#define PALMAS_SMPS_POWERGOOD_MASK2_GPIO_7_SHIFT 0x02
1022#define PALMAS_SMPS_POWERGOOD_MASK2_VBUS 0x02 1022#define PALMAS_SMPS_POWERGOOD_MASK2_VBUS 0x02
1023#define PALMAS_SMPS_POWERGOOD_MASK2_VBUS_SHIFT 1 1023#define PALMAS_SMPS_POWERGOOD_MASK2_VBUS_SHIFT 0x01
1024#define PALMAS_SMPS_POWERGOOD_MASK2_ACOK 0x01 1024#define PALMAS_SMPS_POWERGOOD_MASK2_ACOK 0x01
1025#define PALMAS_SMPS_POWERGOOD_MASK2_ACOK_SHIFT 0 1025#define PALMAS_SMPS_POWERGOOD_MASK2_ACOK_SHIFT 0x00
1026 1026
1027/* Registers for function LDO */ 1027/* Registers for function LDO */
1028#define PALMAS_LDO1_CTRL 0x0 1028#define PALMAS_LDO1_CTRL 0x00
1029#define PALMAS_LDO1_VOLTAGE 0x1 1029#define PALMAS_LDO1_VOLTAGE 0x01
1030#define PALMAS_LDO2_CTRL 0x2 1030#define PALMAS_LDO2_CTRL 0x02
1031#define PALMAS_LDO2_VOLTAGE 0x3 1031#define PALMAS_LDO2_VOLTAGE 0x03
1032#define PALMAS_LDO3_CTRL 0x4 1032#define PALMAS_LDO3_CTRL 0x04
1033#define PALMAS_LDO3_VOLTAGE 0x5 1033#define PALMAS_LDO3_VOLTAGE 0x05
1034#define PALMAS_LDO4_CTRL 0x6 1034#define PALMAS_LDO4_CTRL 0x06
1035#define PALMAS_LDO4_VOLTAGE 0x7 1035#define PALMAS_LDO4_VOLTAGE 0x07
1036#define PALMAS_LDO5_CTRL 0x8 1036#define PALMAS_LDO5_CTRL 0x08
1037#define PALMAS_LDO5_VOLTAGE 0x9 1037#define PALMAS_LDO5_VOLTAGE 0x09
1038#define PALMAS_LDO6_CTRL 0xA 1038#define PALMAS_LDO6_CTRL 0x0A
1039#define PALMAS_LDO6_VOLTAGE 0xB 1039#define PALMAS_LDO6_VOLTAGE 0x0B
1040#define PALMAS_LDO7_CTRL 0xC 1040#define PALMAS_LDO7_CTRL 0x0C
1041#define PALMAS_LDO7_VOLTAGE 0xD 1041#define PALMAS_LDO7_VOLTAGE 0x0D
1042#define PALMAS_LDO8_CTRL 0xE 1042#define PALMAS_LDO8_CTRL 0x0E
1043#define PALMAS_LDO8_VOLTAGE 0xF 1043#define PALMAS_LDO8_VOLTAGE 0x0F
1044#define PALMAS_LDO9_CTRL 0x10 1044#define PALMAS_LDO9_CTRL 0x10
1045#define PALMAS_LDO9_VOLTAGE 0x11 1045#define PALMAS_LDO9_VOLTAGE 0x11
1046#define PALMAS_LDOLN_CTRL 0x12 1046#define PALMAS_LDOLN_CTRL 0x12
@@ -1055,236 +1055,236 @@ enum usb_irq_events {
1055 1055
1056/* Bit definitions for LDO1_CTRL */ 1056/* Bit definitions for LDO1_CTRL */
1057#define PALMAS_LDO1_CTRL_WR_S 0x80 1057#define PALMAS_LDO1_CTRL_WR_S 0x80
1058#define PALMAS_LDO1_CTRL_WR_S_SHIFT 7 1058#define PALMAS_LDO1_CTRL_WR_S_SHIFT 0x07
1059#define PALMAS_LDO1_CTRL_STATUS 0x10 1059#define PALMAS_LDO1_CTRL_STATUS 0x10
1060#define PALMAS_LDO1_CTRL_STATUS_SHIFT 4 1060#define PALMAS_LDO1_CTRL_STATUS_SHIFT 0x04
1061#define PALMAS_LDO1_CTRL_MODE_SLEEP 0x04 1061#define PALMAS_LDO1_CTRL_MODE_SLEEP 0x04
1062#define PALMAS_LDO1_CTRL_MODE_SLEEP_SHIFT 2 1062#define PALMAS_LDO1_CTRL_MODE_SLEEP_SHIFT 0x02
1063#define PALMAS_LDO1_CTRL_MODE_ACTIVE 0x01 1063#define PALMAS_LDO1_CTRL_MODE_ACTIVE 0x01
1064#define PALMAS_LDO1_CTRL_MODE_ACTIVE_SHIFT 0 1064#define PALMAS_LDO1_CTRL_MODE_ACTIVE_SHIFT 0x00
1065 1065
1066/* Bit definitions for LDO1_VOLTAGE */ 1066/* Bit definitions for LDO1_VOLTAGE */
1067#define PALMAS_LDO1_VOLTAGE_VSEL_MASK 0x3f 1067#define PALMAS_LDO1_VOLTAGE_VSEL_MASK 0x3F
1068#define PALMAS_LDO1_VOLTAGE_VSEL_SHIFT 0 1068#define PALMAS_LDO1_VOLTAGE_VSEL_SHIFT 0x00
1069 1069
1070/* Bit definitions for LDO2_CTRL */ 1070/* Bit definitions for LDO2_CTRL */
1071#define PALMAS_LDO2_CTRL_WR_S 0x80 1071#define PALMAS_LDO2_CTRL_WR_S 0x80
1072#define PALMAS_LDO2_CTRL_WR_S_SHIFT 7 1072#define PALMAS_LDO2_CTRL_WR_S_SHIFT 0x07
1073#define PALMAS_LDO2_CTRL_STATUS 0x10 1073#define PALMAS_LDO2_CTRL_STATUS 0x10
1074#define PALMAS_LDO2_CTRL_STATUS_SHIFT 4 1074#define PALMAS_LDO2_CTRL_STATUS_SHIFT 0x04
1075#define PALMAS_LDO2_CTRL_MODE_SLEEP 0x04 1075#define PALMAS_LDO2_CTRL_MODE_SLEEP 0x04
1076#define PALMAS_LDO2_CTRL_MODE_SLEEP_SHIFT 2 1076#define PALMAS_LDO2_CTRL_MODE_SLEEP_SHIFT 0x02
1077#define PALMAS_LDO2_CTRL_MODE_ACTIVE 0x01 1077#define PALMAS_LDO2_CTRL_MODE_ACTIVE 0x01
1078#define PALMAS_LDO2_CTRL_MODE_ACTIVE_SHIFT 0 1078#define PALMAS_LDO2_CTRL_MODE_ACTIVE_SHIFT 0x00
1079 1079
1080/* Bit definitions for LDO2_VOLTAGE */ 1080/* Bit definitions for LDO2_VOLTAGE */
1081#define PALMAS_LDO2_VOLTAGE_VSEL_MASK 0x3f 1081#define PALMAS_LDO2_VOLTAGE_VSEL_MASK 0x3F
1082#define PALMAS_LDO2_VOLTAGE_VSEL_SHIFT 0 1082#define PALMAS_LDO2_VOLTAGE_VSEL_SHIFT 0x00
1083 1083
1084/* Bit definitions for LDO3_CTRL */ 1084/* Bit definitions for LDO3_CTRL */
1085#define PALMAS_LDO3_CTRL_WR_S 0x80 1085#define PALMAS_LDO3_CTRL_WR_S 0x80
1086#define PALMAS_LDO3_CTRL_WR_S_SHIFT 7 1086#define PALMAS_LDO3_CTRL_WR_S_SHIFT 0x07
1087#define PALMAS_LDO3_CTRL_STATUS 0x10 1087#define PALMAS_LDO3_CTRL_STATUS 0x10
1088#define PALMAS_LDO3_CTRL_STATUS_SHIFT 4 1088#define PALMAS_LDO3_CTRL_STATUS_SHIFT 0x04
1089#define PALMAS_LDO3_CTRL_MODE_SLEEP 0x04 1089#define PALMAS_LDO3_CTRL_MODE_SLEEP 0x04
1090#define PALMAS_LDO3_CTRL_MODE_SLEEP_SHIFT 2 1090#define PALMAS_LDO3_CTRL_MODE_SLEEP_SHIFT 0x02
1091#define PALMAS_LDO3_CTRL_MODE_ACTIVE 0x01 1091#define PALMAS_LDO3_CTRL_MODE_ACTIVE 0x01
1092#define PALMAS_LDO3_CTRL_MODE_ACTIVE_SHIFT 0 1092#define PALMAS_LDO3_CTRL_MODE_ACTIVE_SHIFT 0x00
1093 1093
1094/* Bit definitions for LDO3_VOLTAGE */ 1094/* Bit definitions for LDO3_VOLTAGE */
1095#define PALMAS_LDO3_VOLTAGE_VSEL_MASK 0x3f 1095#define PALMAS_LDO3_VOLTAGE_VSEL_MASK 0x3F
1096#define PALMAS_LDO3_VOLTAGE_VSEL_SHIFT 0 1096#define PALMAS_LDO3_VOLTAGE_VSEL_SHIFT 0x00
1097 1097
1098/* Bit definitions for LDO4_CTRL */ 1098/* Bit definitions for LDO4_CTRL */
1099#define PALMAS_LDO4_CTRL_WR_S 0x80 1099#define PALMAS_LDO4_CTRL_WR_S 0x80
1100#define PALMAS_LDO4_CTRL_WR_S_SHIFT 7 1100#define PALMAS_LDO4_CTRL_WR_S_SHIFT 0x07
1101#define PALMAS_LDO4_CTRL_STATUS 0x10 1101#define PALMAS_LDO4_CTRL_STATUS 0x10
1102#define PALMAS_LDO4_CTRL_STATUS_SHIFT 4 1102#define PALMAS_LDO4_CTRL_STATUS_SHIFT 0x04
1103#define PALMAS_LDO4_CTRL_MODE_SLEEP 0x04 1103#define PALMAS_LDO4_CTRL_MODE_SLEEP 0x04
1104#define PALMAS_LDO4_CTRL_MODE_SLEEP_SHIFT 2 1104#define PALMAS_LDO4_CTRL_MODE_SLEEP_SHIFT 0x02
1105#define PALMAS_LDO4_CTRL_MODE_ACTIVE 0x01 1105#define PALMAS_LDO4_CTRL_MODE_ACTIVE 0x01
1106#define PALMAS_LDO4_CTRL_MODE_ACTIVE_SHIFT 0 1106#define PALMAS_LDO4_CTRL_MODE_ACTIVE_SHIFT 0x00
1107 1107
1108/* Bit definitions for LDO4_VOLTAGE */ 1108/* Bit definitions for LDO4_VOLTAGE */
1109#define PALMAS_LDO4_VOLTAGE_VSEL_MASK 0x3f 1109#define PALMAS_LDO4_VOLTAGE_VSEL_MASK 0x3F
1110#define PALMAS_LDO4_VOLTAGE_VSEL_SHIFT 0 1110#define PALMAS_LDO4_VOLTAGE_VSEL_SHIFT 0x00
1111 1111
1112/* Bit definitions for LDO5_CTRL */ 1112/* Bit definitions for LDO5_CTRL */
1113#define PALMAS_LDO5_CTRL_WR_S 0x80 1113#define PALMAS_LDO5_CTRL_WR_S 0x80
1114#define PALMAS_LDO5_CTRL_WR_S_SHIFT 7 1114#define PALMAS_LDO5_CTRL_WR_S_SHIFT 0x07
1115#define PALMAS_LDO5_CTRL_STATUS 0x10 1115#define PALMAS_LDO5_CTRL_STATUS 0x10
1116#define PALMAS_LDO5_CTRL_STATUS_SHIFT 4 1116#define PALMAS_LDO5_CTRL_STATUS_SHIFT 0x04
1117#define PALMAS_LDO5_CTRL_MODE_SLEEP 0x04 1117#define PALMAS_LDO5_CTRL_MODE_SLEEP 0x04
1118#define PALMAS_LDO5_CTRL_MODE_SLEEP_SHIFT 2 1118#define PALMAS_LDO5_CTRL_MODE_SLEEP_SHIFT 0x02
1119#define PALMAS_LDO5_CTRL_MODE_ACTIVE 0x01 1119#define PALMAS_LDO5_CTRL_MODE_ACTIVE 0x01
1120#define PALMAS_LDO5_CTRL_MODE_ACTIVE_SHIFT 0 1120#define PALMAS_LDO5_CTRL_MODE_ACTIVE_SHIFT 0x00
1121 1121
1122/* Bit definitions for LDO5_VOLTAGE */ 1122/* Bit definitions for LDO5_VOLTAGE */
1123#define PALMAS_LDO5_VOLTAGE_VSEL_MASK 0x3f 1123#define PALMAS_LDO5_VOLTAGE_VSEL_MASK 0x3F
1124#define PALMAS_LDO5_VOLTAGE_VSEL_SHIFT 0 1124#define PALMAS_LDO5_VOLTAGE_VSEL_SHIFT 0x00
1125 1125
1126/* Bit definitions for LDO6_CTRL */ 1126/* Bit definitions for LDO6_CTRL */
1127#define PALMAS_LDO6_CTRL_WR_S 0x80 1127#define PALMAS_LDO6_CTRL_WR_S 0x80
1128#define PALMAS_LDO6_CTRL_WR_S_SHIFT 7 1128#define PALMAS_LDO6_CTRL_WR_S_SHIFT 0x07
1129#define PALMAS_LDO6_CTRL_LDO_VIB_EN 0x40 1129#define PALMAS_LDO6_CTRL_LDO_VIB_EN 0x40
1130#define PALMAS_LDO6_CTRL_LDO_VIB_EN_SHIFT 6 1130#define PALMAS_LDO6_CTRL_LDO_VIB_EN_SHIFT 0x06
1131#define PALMAS_LDO6_CTRL_STATUS 0x10 1131#define PALMAS_LDO6_CTRL_STATUS 0x10
1132#define PALMAS_LDO6_CTRL_STATUS_SHIFT 4 1132#define PALMAS_LDO6_CTRL_STATUS_SHIFT 0x04
1133#define PALMAS_LDO6_CTRL_MODE_SLEEP 0x04 1133#define PALMAS_LDO6_CTRL_MODE_SLEEP 0x04
1134#define PALMAS_LDO6_CTRL_MODE_SLEEP_SHIFT 2 1134#define PALMAS_LDO6_CTRL_MODE_SLEEP_SHIFT 0x02
1135#define PALMAS_LDO6_CTRL_MODE_ACTIVE 0x01 1135#define PALMAS_LDO6_CTRL_MODE_ACTIVE 0x01
1136#define PALMAS_LDO6_CTRL_MODE_ACTIVE_SHIFT 0 1136#define PALMAS_LDO6_CTRL_MODE_ACTIVE_SHIFT 0x00
1137 1137
1138/* Bit definitions for LDO6_VOLTAGE */ 1138/* Bit definitions for LDO6_VOLTAGE */
1139#define PALMAS_LDO6_VOLTAGE_VSEL_MASK 0x3f 1139#define PALMAS_LDO6_VOLTAGE_VSEL_MASK 0x3F
1140#define PALMAS_LDO6_VOLTAGE_VSEL_SHIFT 0 1140#define PALMAS_LDO6_VOLTAGE_VSEL_SHIFT 0x00
1141 1141
1142/* Bit definitions for LDO7_CTRL */ 1142/* Bit definitions for LDO7_CTRL */
1143#define PALMAS_LDO7_CTRL_WR_S 0x80 1143#define PALMAS_LDO7_CTRL_WR_S 0x80
1144#define PALMAS_LDO7_CTRL_WR_S_SHIFT 7 1144#define PALMAS_LDO7_CTRL_WR_S_SHIFT 0x07
1145#define PALMAS_LDO7_CTRL_STATUS 0x10 1145#define PALMAS_LDO7_CTRL_STATUS 0x10
1146#define PALMAS_LDO7_CTRL_STATUS_SHIFT 4 1146#define PALMAS_LDO7_CTRL_STATUS_SHIFT 0x04
1147#define PALMAS_LDO7_CTRL_MODE_SLEEP 0x04 1147#define PALMAS_LDO7_CTRL_MODE_SLEEP 0x04
1148#define PALMAS_LDO7_CTRL_MODE_SLEEP_SHIFT 2 1148#define PALMAS_LDO7_CTRL_MODE_SLEEP_SHIFT 0x02
1149#define PALMAS_LDO7_CTRL_MODE_ACTIVE 0x01 1149#define PALMAS_LDO7_CTRL_MODE_ACTIVE 0x01
1150#define PALMAS_LDO7_CTRL_MODE_ACTIVE_SHIFT 0 1150#define PALMAS_LDO7_CTRL_MODE_ACTIVE_SHIFT 0x00
1151 1151
1152/* Bit definitions for LDO7_VOLTAGE */ 1152/* Bit definitions for LDO7_VOLTAGE */
1153#define PALMAS_LDO7_VOLTAGE_VSEL_MASK 0x3f 1153#define PALMAS_LDO7_VOLTAGE_VSEL_MASK 0x3F
1154#define PALMAS_LDO7_VOLTAGE_VSEL_SHIFT 0 1154#define PALMAS_LDO7_VOLTAGE_VSEL_SHIFT 0x00
1155 1155
1156/* Bit definitions for LDO8_CTRL */ 1156/* Bit definitions for LDO8_CTRL */
1157#define PALMAS_LDO8_CTRL_WR_S 0x80 1157#define PALMAS_LDO8_CTRL_WR_S 0x80
1158#define PALMAS_LDO8_CTRL_WR_S_SHIFT 7 1158#define PALMAS_LDO8_CTRL_WR_S_SHIFT 0x07
1159#define PALMAS_LDO8_CTRL_LDO_TRACKING_EN 0x40 1159#define PALMAS_LDO8_CTRL_LDO_TRACKING_EN 0x40
1160#define PALMAS_LDO8_CTRL_LDO_TRACKING_EN_SHIFT 6 1160#define PALMAS_LDO8_CTRL_LDO_TRACKING_EN_SHIFT 0x06
1161#define PALMAS_LDO8_CTRL_STATUS 0x10 1161#define PALMAS_LDO8_CTRL_STATUS 0x10
1162#define PALMAS_LDO8_CTRL_STATUS_SHIFT 4 1162#define PALMAS_LDO8_CTRL_STATUS_SHIFT 0x04
1163#define PALMAS_LDO8_CTRL_MODE_SLEEP 0x04 1163#define PALMAS_LDO8_CTRL_MODE_SLEEP 0x04
1164#define PALMAS_LDO8_CTRL_MODE_SLEEP_SHIFT 2 1164#define PALMAS_LDO8_CTRL_MODE_SLEEP_SHIFT 0x02
1165#define PALMAS_LDO8_CTRL_MODE_ACTIVE 0x01 1165#define PALMAS_LDO8_CTRL_MODE_ACTIVE 0x01
1166#define PALMAS_LDO8_CTRL_MODE_ACTIVE_SHIFT 0 1166#define PALMAS_LDO8_CTRL_MODE_ACTIVE_SHIFT 0x00
1167 1167
1168/* Bit definitions for LDO8_VOLTAGE */ 1168/* Bit definitions for LDO8_VOLTAGE */
1169#define PALMAS_LDO8_VOLTAGE_VSEL_MASK 0x3f 1169#define PALMAS_LDO8_VOLTAGE_VSEL_MASK 0x3F
1170#define PALMAS_LDO8_VOLTAGE_VSEL_SHIFT 0 1170#define PALMAS_LDO8_VOLTAGE_VSEL_SHIFT 0x00
1171 1171
1172/* Bit definitions for LDO9_CTRL */ 1172/* Bit definitions for LDO9_CTRL */
1173#define PALMAS_LDO9_CTRL_WR_S 0x80 1173#define PALMAS_LDO9_CTRL_WR_S 0x80
1174#define PALMAS_LDO9_CTRL_WR_S_SHIFT 7 1174#define PALMAS_LDO9_CTRL_WR_S_SHIFT 0x07
1175#define PALMAS_LDO9_CTRL_LDO_BYPASS_EN 0x40 1175#define PALMAS_LDO9_CTRL_LDO_BYPASS_EN 0x40
1176#define PALMAS_LDO9_CTRL_LDO_BYPASS_EN_SHIFT 6 1176#define PALMAS_LDO9_CTRL_LDO_BYPASS_EN_SHIFT 0x06
1177#define PALMAS_LDO9_CTRL_STATUS 0x10 1177#define PALMAS_LDO9_CTRL_STATUS 0x10
1178#define PALMAS_LDO9_CTRL_STATUS_SHIFT 4 1178#define PALMAS_LDO9_CTRL_STATUS_SHIFT 0x04
1179#define PALMAS_LDO9_CTRL_MODE_SLEEP 0x04 1179#define PALMAS_LDO9_CTRL_MODE_SLEEP 0x04
1180#define PALMAS_LDO9_CTRL_MODE_SLEEP_SHIFT 2 1180#define PALMAS_LDO9_CTRL_MODE_SLEEP_SHIFT 0x02
1181#define PALMAS_LDO9_CTRL_MODE_ACTIVE 0x01 1181#define PALMAS_LDO9_CTRL_MODE_ACTIVE 0x01
1182#define PALMAS_LDO9_CTRL_MODE_ACTIVE_SHIFT 0 1182#define PALMAS_LDO9_CTRL_MODE_ACTIVE_SHIFT 0x00
1183 1183
1184/* Bit definitions for LDO9_VOLTAGE */ 1184/* Bit definitions for LDO9_VOLTAGE */
1185#define PALMAS_LDO9_VOLTAGE_VSEL_MASK 0x3f 1185#define PALMAS_LDO9_VOLTAGE_VSEL_MASK 0x3F
1186#define PALMAS_LDO9_VOLTAGE_VSEL_SHIFT 0 1186#define PALMAS_LDO9_VOLTAGE_VSEL_SHIFT 0x00
1187 1187
1188/* Bit definitions for LDOLN_CTRL */ 1188/* Bit definitions for LDOLN_CTRL */
1189#define PALMAS_LDOLN_CTRL_WR_S 0x80 1189#define PALMAS_LDOLN_CTRL_WR_S 0x80
1190#define PALMAS_LDOLN_CTRL_WR_S_SHIFT 7 1190#define PALMAS_LDOLN_CTRL_WR_S_SHIFT 0x07
1191#define PALMAS_LDOLN_CTRL_STATUS 0x10 1191#define PALMAS_LDOLN_CTRL_STATUS 0x10
1192#define PALMAS_LDOLN_CTRL_STATUS_SHIFT 4 1192#define PALMAS_LDOLN_CTRL_STATUS_SHIFT 0x04
1193#define PALMAS_LDOLN_CTRL_MODE_SLEEP 0x04 1193#define PALMAS_LDOLN_CTRL_MODE_SLEEP 0x04
1194#define PALMAS_LDOLN_CTRL_MODE_SLEEP_SHIFT 2 1194#define PALMAS_LDOLN_CTRL_MODE_SLEEP_SHIFT 0x02
1195#define PALMAS_LDOLN_CTRL_MODE_ACTIVE 0x01 1195#define PALMAS_LDOLN_CTRL_MODE_ACTIVE 0x01
1196#define PALMAS_LDOLN_CTRL_MODE_ACTIVE_SHIFT 0 1196#define PALMAS_LDOLN_CTRL_MODE_ACTIVE_SHIFT 0x00
1197 1197
1198/* Bit definitions for LDOLN_VOLTAGE */ 1198/* Bit definitions for LDOLN_VOLTAGE */
1199#define PALMAS_LDOLN_VOLTAGE_VSEL_MASK 0x3f 1199#define PALMAS_LDOLN_VOLTAGE_VSEL_MASK 0x3F
1200#define PALMAS_LDOLN_VOLTAGE_VSEL_SHIFT 0 1200#define PALMAS_LDOLN_VOLTAGE_VSEL_SHIFT 0x00
1201 1201
1202/* Bit definitions for LDOUSB_CTRL */ 1202/* Bit definitions for LDOUSB_CTRL */
1203#define PALMAS_LDOUSB_CTRL_WR_S 0x80 1203#define PALMAS_LDOUSB_CTRL_WR_S 0x80
1204#define PALMAS_LDOUSB_CTRL_WR_S_SHIFT 7 1204#define PALMAS_LDOUSB_CTRL_WR_S_SHIFT 0x07
1205#define PALMAS_LDOUSB_CTRL_STATUS 0x10 1205#define PALMAS_LDOUSB_CTRL_STATUS 0x10
1206#define PALMAS_LDOUSB_CTRL_STATUS_SHIFT 4 1206#define PALMAS_LDOUSB_CTRL_STATUS_SHIFT 0x04
1207#define PALMAS_LDOUSB_CTRL_MODE_SLEEP 0x04 1207#define PALMAS_LDOUSB_CTRL_MODE_SLEEP 0x04
1208#define PALMAS_LDOUSB_CTRL_MODE_SLEEP_SHIFT 2 1208#define PALMAS_LDOUSB_CTRL_MODE_SLEEP_SHIFT 0x02
1209#define PALMAS_LDOUSB_CTRL_MODE_ACTIVE 0x01 1209#define PALMAS_LDOUSB_CTRL_MODE_ACTIVE 0x01
1210#define PALMAS_LDOUSB_CTRL_MODE_ACTIVE_SHIFT 0 1210#define PALMAS_LDOUSB_CTRL_MODE_ACTIVE_SHIFT 0x00
1211 1211
1212/* Bit definitions for LDOUSB_VOLTAGE */ 1212/* Bit definitions for LDOUSB_VOLTAGE */
1213#define PALMAS_LDOUSB_VOLTAGE_VSEL_MASK 0x3f 1213#define PALMAS_LDOUSB_VOLTAGE_VSEL_MASK 0x3F
1214#define PALMAS_LDOUSB_VOLTAGE_VSEL_SHIFT 0 1214#define PALMAS_LDOUSB_VOLTAGE_VSEL_SHIFT 0x00
1215 1215
1216/* Bit definitions for LDO_CTRL */ 1216/* Bit definitions for LDO_CTRL */
1217#define PALMAS_LDO_CTRL_LDOUSB_ON_VBUS_VSYS 0x01 1217#define PALMAS_LDO_CTRL_LDOUSB_ON_VBUS_VSYS 0x01
1218#define PALMAS_LDO_CTRL_LDOUSB_ON_VBUS_VSYS_SHIFT 0 1218#define PALMAS_LDO_CTRL_LDOUSB_ON_VBUS_VSYS_SHIFT 0x00
1219 1219
1220/* Bit definitions for LDO_PD_CTRL1 */ 1220/* Bit definitions for LDO_PD_CTRL1 */
1221#define PALMAS_LDO_PD_CTRL1_LDO8 0x80 1221#define PALMAS_LDO_PD_CTRL1_LDO8 0x80
1222#define PALMAS_LDO_PD_CTRL1_LDO8_SHIFT 7 1222#define PALMAS_LDO_PD_CTRL1_LDO8_SHIFT 0x07
1223#define PALMAS_LDO_PD_CTRL1_LDO7 0x40 1223#define PALMAS_LDO_PD_CTRL1_LDO7 0x40
1224#define PALMAS_LDO_PD_CTRL1_LDO7_SHIFT 6 1224#define PALMAS_LDO_PD_CTRL1_LDO7_SHIFT 0x06
1225#define PALMAS_LDO_PD_CTRL1_LDO6 0x20 1225#define PALMAS_LDO_PD_CTRL1_LDO6 0x20
1226#define PALMAS_LDO_PD_CTRL1_LDO6_SHIFT 5 1226#define PALMAS_LDO_PD_CTRL1_LDO6_SHIFT 0x05
1227#define PALMAS_LDO_PD_CTRL1_LDO5 0x10 1227#define PALMAS_LDO_PD_CTRL1_LDO5 0x10
1228#define PALMAS_LDO_PD_CTRL1_LDO5_SHIFT 4 1228#define PALMAS_LDO_PD_CTRL1_LDO5_SHIFT 0x04
1229#define PALMAS_LDO_PD_CTRL1_LDO4 0x08 1229#define PALMAS_LDO_PD_CTRL1_LDO4 0x08
1230#define PALMAS_LDO_PD_CTRL1_LDO4_SHIFT 3 1230#define PALMAS_LDO_PD_CTRL1_LDO4_SHIFT 0x03
1231#define PALMAS_LDO_PD_CTRL1_LDO3 0x04 1231#define PALMAS_LDO_PD_CTRL1_LDO3 0x04
1232#define PALMAS_LDO_PD_CTRL1_LDO3_SHIFT 2 1232#define PALMAS_LDO_PD_CTRL1_LDO3_SHIFT 0x02
1233#define PALMAS_LDO_PD_CTRL1_LDO2 0x02 1233#define PALMAS_LDO_PD_CTRL1_LDO2 0x02
1234#define PALMAS_LDO_PD_CTRL1_LDO2_SHIFT 1 1234#define PALMAS_LDO_PD_CTRL1_LDO2_SHIFT 0x01
1235#define PALMAS_LDO_PD_CTRL1_LDO1 0x01 1235#define PALMAS_LDO_PD_CTRL1_LDO1 0x01
1236#define PALMAS_LDO_PD_CTRL1_LDO1_SHIFT 0 1236#define PALMAS_LDO_PD_CTRL1_LDO1_SHIFT 0x00
1237 1237
1238/* Bit definitions for LDO_PD_CTRL2 */ 1238/* Bit definitions for LDO_PD_CTRL2 */
1239#define PALMAS_LDO_PD_CTRL2_LDOUSB 0x04 1239#define PALMAS_LDO_PD_CTRL2_LDOUSB 0x04
1240#define PALMAS_LDO_PD_CTRL2_LDOUSB_SHIFT 2 1240#define PALMAS_LDO_PD_CTRL2_LDOUSB_SHIFT 0x02
1241#define PALMAS_LDO_PD_CTRL2_LDOLN 0x02 1241#define PALMAS_LDO_PD_CTRL2_LDOLN 0x02
1242#define PALMAS_LDO_PD_CTRL2_LDOLN_SHIFT 1 1242#define PALMAS_LDO_PD_CTRL2_LDOLN_SHIFT 0x01
1243#define PALMAS_LDO_PD_CTRL2_LDO9 0x01 1243#define PALMAS_LDO_PD_CTRL2_LDO9 0x01
1244#define PALMAS_LDO_PD_CTRL2_LDO9_SHIFT 0 1244#define PALMAS_LDO_PD_CTRL2_LDO9_SHIFT 0x00
1245 1245
1246/* Bit definitions for LDO_SHORT_STATUS1 */ 1246/* Bit definitions for LDO_SHORT_STATUS1 */
1247#define PALMAS_LDO_SHORT_STATUS1_LDO8 0x80 1247#define PALMAS_LDO_SHORT_STATUS1_LDO8 0x80
1248#define PALMAS_LDO_SHORT_STATUS1_LDO8_SHIFT 7 1248#define PALMAS_LDO_SHORT_STATUS1_LDO8_SHIFT 0x07
1249#define PALMAS_LDO_SHORT_STATUS1_LDO7 0x40 1249#define PALMAS_LDO_SHORT_STATUS1_LDO7 0x40
1250#define PALMAS_LDO_SHORT_STATUS1_LDO7_SHIFT 6 1250#define PALMAS_LDO_SHORT_STATUS1_LDO7_SHIFT 0x06
1251#define PALMAS_LDO_SHORT_STATUS1_LDO6 0x20 1251#define PALMAS_LDO_SHORT_STATUS1_LDO6 0x20
1252#define PALMAS_LDO_SHORT_STATUS1_LDO6_SHIFT 5 1252#define PALMAS_LDO_SHORT_STATUS1_LDO6_SHIFT 0x05
1253#define PALMAS_LDO_SHORT_STATUS1_LDO5 0x10 1253#define PALMAS_LDO_SHORT_STATUS1_LDO5 0x10
1254#define PALMAS_LDO_SHORT_STATUS1_LDO5_SHIFT 4 1254#define PALMAS_LDO_SHORT_STATUS1_LDO5_SHIFT 0x04
1255#define PALMAS_LDO_SHORT_STATUS1_LDO4 0x08 1255#define PALMAS_LDO_SHORT_STATUS1_LDO4 0x08
1256#define PALMAS_LDO_SHORT_STATUS1_LDO4_SHIFT 3 1256#define PALMAS_LDO_SHORT_STATUS1_LDO4_SHIFT 0x03
1257#define PALMAS_LDO_SHORT_STATUS1_LDO3 0x04 1257#define PALMAS_LDO_SHORT_STATUS1_LDO3 0x04
1258#define PALMAS_LDO_SHORT_STATUS1_LDO3_SHIFT 2 1258#define PALMAS_LDO_SHORT_STATUS1_LDO3_SHIFT 0x02
1259#define PALMAS_LDO_SHORT_STATUS1_LDO2 0x02 1259#define PALMAS_LDO_SHORT_STATUS1_LDO2 0x02
1260#define PALMAS_LDO_SHORT_STATUS1_LDO2_SHIFT 1 1260#define PALMAS_LDO_SHORT_STATUS1_LDO2_SHIFT 0x01
1261#define PALMAS_LDO_SHORT_STATUS1_LDO1 0x01 1261#define PALMAS_LDO_SHORT_STATUS1_LDO1 0x01
1262#define PALMAS_LDO_SHORT_STATUS1_LDO1_SHIFT 0 1262#define PALMAS_LDO_SHORT_STATUS1_LDO1_SHIFT 0x00
1263 1263
1264/* Bit definitions for LDO_SHORT_STATUS2 */ 1264/* Bit definitions for LDO_SHORT_STATUS2 */
1265#define PALMAS_LDO_SHORT_STATUS2_LDOVANA 0x08 1265#define PALMAS_LDO_SHORT_STATUS2_LDOVANA 0x08
1266#define PALMAS_LDO_SHORT_STATUS2_LDOVANA_SHIFT 3 1266#define PALMAS_LDO_SHORT_STATUS2_LDOVANA_SHIFT 0x03
1267#define PALMAS_LDO_SHORT_STATUS2_LDOUSB 0x04 1267#define PALMAS_LDO_SHORT_STATUS2_LDOUSB 0x04
1268#define PALMAS_LDO_SHORT_STATUS2_LDOUSB_SHIFT 2 1268#define PALMAS_LDO_SHORT_STATUS2_LDOUSB_SHIFT 0x02
1269#define PALMAS_LDO_SHORT_STATUS2_LDOLN 0x02 1269#define PALMAS_LDO_SHORT_STATUS2_LDOLN 0x02
1270#define PALMAS_LDO_SHORT_STATUS2_LDOLN_SHIFT 1 1270#define PALMAS_LDO_SHORT_STATUS2_LDOLN_SHIFT 0x01
1271#define PALMAS_LDO_SHORT_STATUS2_LDO9 0x01 1271#define PALMAS_LDO_SHORT_STATUS2_LDO9 0x01
1272#define PALMAS_LDO_SHORT_STATUS2_LDO9_SHIFT 0 1272#define PALMAS_LDO_SHORT_STATUS2_LDO9_SHIFT 0x00
1273 1273
1274/* Registers for function PMU_CONTROL */ 1274/* Registers for function PMU_CONTROL */
1275#define PALMAS_DEV_CTRL 0x0 1275#define PALMAS_DEV_CTRL 0x00
1276#define PALMAS_POWER_CTRL 0x1 1276#define PALMAS_POWER_CTRL 0x01
1277#define PALMAS_VSYS_LO 0x2 1277#define PALMAS_VSYS_LO 0x02
1278#define PALMAS_VSYS_MON 0x3 1278#define PALMAS_VSYS_MON 0x03
1279#define PALMAS_VBAT_MON 0x4 1279#define PALMAS_VBAT_MON 0x04
1280#define PALMAS_WATCHDOG 0x5 1280#define PALMAS_WATCHDOG 0x05
1281#define PALMAS_BOOT_STATUS 0x6 1281#define PALMAS_BOOT_STATUS 0x06
1282#define PALMAS_BATTERY_BOUNCE 0x7 1282#define PALMAS_BATTERY_BOUNCE 0x07
1283#define PALMAS_BACKUP_BATTERY_CTRL 0x8 1283#define PALMAS_BACKUP_BATTERY_CTRL 0x08
1284#define PALMAS_LONG_PRESS_KEY 0x9 1284#define PALMAS_LONG_PRESS_KEY 0x09
1285#define PALMAS_OSC_THERM_CTRL 0xA 1285#define PALMAS_OSC_THERM_CTRL 0x0A
1286#define PALMAS_BATDEBOUNCING 0xB 1286#define PALMAS_BATDEBOUNCING 0x0B
1287#define PALMAS_SWOFF_HWRST 0xF 1287#define PALMAS_SWOFF_HWRST 0x0F
1288#define PALMAS_SWOFF_COLDRST 0x10 1288#define PALMAS_SWOFF_COLDRST 0x10
1289#define PALMAS_SWOFF_STATUS 0x11 1289#define PALMAS_SWOFF_STATUS 0x11
1290#define PALMAS_PMU_CONFIG 0x12 1290#define PALMAS_PMU_CONFIG 0x12
@@ -1296,668 +1296,668 @@ enum usb_irq_events {
1296 1296
1297/* Bit definitions for DEV_CTRL */ 1297/* Bit definitions for DEV_CTRL */
1298#define PALMAS_DEV_CTRL_DEV_STATUS_MASK 0x0c 1298#define PALMAS_DEV_CTRL_DEV_STATUS_MASK 0x0c
1299#define PALMAS_DEV_CTRL_DEV_STATUS_SHIFT 2 1299#define PALMAS_DEV_CTRL_DEV_STATUS_SHIFT 0x02
1300#define PALMAS_DEV_CTRL_SW_RST 0x02 1300#define PALMAS_DEV_CTRL_SW_RST 0x02
1301#define PALMAS_DEV_CTRL_SW_RST_SHIFT 1 1301#define PALMAS_DEV_CTRL_SW_RST_SHIFT 0x01
1302#define PALMAS_DEV_CTRL_DEV_ON 0x01 1302#define PALMAS_DEV_CTRL_DEV_ON 0x01
1303#define PALMAS_DEV_CTRL_DEV_ON_SHIFT 0 1303#define PALMAS_DEV_CTRL_DEV_ON_SHIFT 0x00
1304 1304
1305/* Bit definitions for POWER_CTRL */ 1305/* Bit definitions for POWER_CTRL */
1306#define PALMAS_POWER_CTRL_ENABLE2_MASK 0x04 1306#define PALMAS_POWER_CTRL_ENABLE2_MASK 0x04
1307#define PALMAS_POWER_CTRL_ENABLE2_MASK_SHIFT 2 1307#define PALMAS_POWER_CTRL_ENABLE2_MASK_SHIFT 0x02
1308#define PALMAS_POWER_CTRL_ENABLE1_MASK 0x02 1308#define PALMAS_POWER_CTRL_ENABLE1_MASK 0x02
1309#define PALMAS_POWER_CTRL_ENABLE1_MASK_SHIFT 1 1309#define PALMAS_POWER_CTRL_ENABLE1_MASK_SHIFT 0x01
1310#define PALMAS_POWER_CTRL_NSLEEP_MASK 0x01 1310#define PALMAS_POWER_CTRL_NSLEEP_MASK 0x01
1311#define PALMAS_POWER_CTRL_NSLEEP_MASK_SHIFT 0 1311#define PALMAS_POWER_CTRL_NSLEEP_MASK_SHIFT 0x00
1312 1312
1313/* Bit definitions for VSYS_LO */ 1313/* Bit definitions for VSYS_LO */
1314#define PALMAS_VSYS_LO_THRESHOLD_MASK 0x1f 1314#define PALMAS_VSYS_LO_THRESHOLD_MASK 0x1F
1315#define PALMAS_VSYS_LO_THRESHOLD_SHIFT 0 1315#define PALMAS_VSYS_LO_THRESHOLD_SHIFT 0x00
1316 1316
1317/* Bit definitions for VSYS_MON */ 1317/* Bit definitions for VSYS_MON */
1318#define PALMAS_VSYS_MON_ENABLE 0x80 1318#define PALMAS_VSYS_MON_ENABLE 0x80
1319#define PALMAS_VSYS_MON_ENABLE_SHIFT 7 1319#define PALMAS_VSYS_MON_ENABLE_SHIFT 0x07
1320#define PALMAS_VSYS_MON_THRESHOLD_MASK 0x3f 1320#define PALMAS_VSYS_MON_THRESHOLD_MASK 0x3F
1321#define PALMAS_VSYS_MON_THRESHOLD_SHIFT 0 1321#define PALMAS_VSYS_MON_THRESHOLD_SHIFT 0x00
1322 1322
1323/* Bit definitions for VBAT_MON */ 1323/* Bit definitions for VBAT_MON */
1324#define PALMAS_VBAT_MON_ENABLE 0x80 1324#define PALMAS_VBAT_MON_ENABLE 0x80
1325#define PALMAS_VBAT_MON_ENABLE_SHIFT 7 1325#define PALMAS_VBAT_MON_ENABLE_SHIFT 0x07
1326#define PALMAS_VBAT_MON_THRESHOLD_MASK 0x3f 1326#define PALMAS_VBAT_MON_THRESHOLD_MASK 0x3F
1327#define PALMAS_VBAT_MON_THRESHOLD_SHIFT 0 1327#define PALMAS_VBAT_MON_THRESHOLD_SHIFT 0x00
1328 1328
1329/* Bit definitions for WATCHDOG */ 1329/* Bit definitions for WATCHDOG */
1330#define PALMAS_WATCHDOG_LOCK 0x20 1330#define PALMAS_WATCHDOG_LOCK 0x20
1331#define PALMAS_WATCHDOG_LOCK_SHIFT 5 1331#define PALMAS_WATCHDOG_LOCK_SHIFT 0x05
1332#define PALMAS_WATCHDOG_ENABLE 0x10 1332#define PALMAS_WATCHDOG_ENABLE 0x10
1333#define PALMAS_WATCHDOG_ENABLE_SHIFT 4 1333#define PALMAS_WATCHDOG_ENABLE_SHIFT 0x04
1334#define PALMAS_WATCHDOG_MODE 0x08 1334#define PALMAS_WATCHDOG_MODE 0x08
1335#define PALMAS_WATCHDOG_MODE_SHIFT 3 1335#define PALMAS_WATCHDOG_MODE_SHIFT 0x03
1336#define PALMAS_WATCHDOG_TIMER_MASK 0x07 1336#define PALMAS_WATCHDOG_TIMER_MASK 0x07
1337#define PALMAS_WATCHDOG_TIMER_SHIFT 0 1337#define PALMAS_WATCHDOG_TIMER_SHIFT 0x00
1338 1338
1339/* Bit definitions for BOOT_STATUS */ 1339/* Bit definitions for BOOT_STATUS */
1340#define PALMAS_BOOT_STATUS_BOOT1 0x02 1340#define PALMAS_BOOT_STATUS_BOOT1 0x02
1341#define PALMAS_BOOT_STATUS_BOOT1_SHIFT 1 1341#define PALMAS_BOOT_STATUS_BOOT1_SHIFT 0x01
1342#define PALMAS_BOOT_STATUS_BOOT0 0x01 1342#define PALMAS_BOOT_STATUS_BOOT0 0x01
1343#define PALMAS_BOOT_STATUS_BOOT0_SHIFT 0 1343#define PALMAS_BOOT_STATUS_BOOT0_SHIFT 0x00
1344 1344
1345/* Bit definitions for BATTERY_BOUNCE */ 1345/* Bit definitions for BATTERY_BOUNCE */
1346#define PALMAS_BATTERY_BOUNCE_BB_DELAY_MASK 0x3f 1346#define PALMAS_BATTERY_BOUNCE_BB_DELAY_MASK 0x3F
1347#define PALMAS_BATTERY_BOUNCE_BB_DELAY_SHIFT 0 1347#define PALMAS_BATTERY_BOUNCE_BB_DELAY_SHIFT 0x00
1348 1348
1349/* Bit definitions for BACKUP_BATTERY_CTRL */ 1349/* Bit definitions for BACKUP_BATTERY_CTRL */
1350#define PALMAS_BACKUP_BATTERY_CTRL_VRTC_18_15 0x80 1350#define PALMAS_BACKUP_BATTERY_CTRL_VRTC_18_15 0x80
1351#define PALMAS_BACKUP_BATTERY_CTRL_VRTC_18_15_SHIFT 7 1351#define PALMAS_BACKUP_BATTERY_CTRL_VRTC_18_15_SHIFT 0x07
1352#define PALMAS_BACKUP_BATTERY_CTRL_VRTC_EN_SLP 0x40 1352#define PALMAS_BACKUP_BATTERY_CTRL_VRTC_EN_SLP 0x40
1353#define PALMAS_BACKUP_BATTERY_CTRL_VRTC_EN_SLP_SHIFT 6 1353#define PALMAS_BACKUP_BATTERY_CTRL_VRTC_EN_SLP_SHIFT 0x06
1354#define PALMAS_BACKUP_BATTERY_CTRL_VRTC_EN_OFF 0x20 1354#define PALMAS_BACKUP_BATTERY_CTRL_VRTC_EN_OFF 0x20
1355#define PALMAS_BACKUP_BATTERY_CTRL_VRTC_EN_OFF_SHIFT 5 1355#define PALMAS_BACKUP_BATTERY_CTRL_VRTC_EN_OFF_SHIFT 0x05
1356#define PALMAS_BACKUP_BATTERY_CTRL_VRTC_PWEN 0x10 1356#define PALMAS_BACKUP_BATTERY_CTRL_VRTC_PWEN 0x10
1357#define PALMAS_BACKUP_BATTERY_CTRL_VRTC_PWEN_SHIFT 4 1357#define PALMAS_BACKUP_BATTERY_CTRL_VRTC_PWEN_SHIFT 0x04
1358#define PALMAS_BACKUP_BATTERY_CTRL_BBS_BBC_LOW_ICHRG 0x08 1358#define PALMAS_BACKUP_BATTERY_CTRL_BBS_BBC_LOW_ICHRG 0x08
1359#define PALMAS_BACKUP_BATTERY_CTRL_BBS_BBC_LOW_ICHRG_SHIFT 3 1359#define PALMAS_BACKUP_BATTERY_CTRL_BBS_BBC_LOW_ICHRG_SHIFT 0x03
1360#define PALMAS_BACKUP_BATTERY_CTRL_BB_SEL_MASK 0x06 1360#define PALMAS_BACKUP_BATTERY_CTRL_BB_SEL_MASK 0x06
1361#define PALMAS_BACKUP_BATTERY_CTRL_BB_SEL_SHIFT 1 1361#define PALMAS_BACKUP_BATTERY_CTRL_BB_SEL_SHIFT 0x01
1362#define PALMAS_BACKUP_BATTERY_CTRL_BB_CHG_EN 0x01 1362#define PALMAS_BACKUP_BATTERY_CTRL_BB_CHG_EN 0x01
1363#define PALMAS_BACKUP_BATTERY_CTRL_BB_CHG_EN_SHIFT 0 1363#define PALMAS_BACKUP_BATTERY_CTRL_BB_CHG_EN_SHIFT 0x00
1364 1364
1365/* Bit definitions for LONG_PRESS_KEY */ 1365/* Bit definitions for LONG_PRESS_KEY */
1366#define PALMAS_LONG_PRESS_KEY_LPK_LOCK 0x80 1366#define PALMAS_LONG_PRESS_KEY_LPK_LOCK 0x80
1367#define PALMAS_LONG_PRESS_KEY_LPK_LOCK_SHIFT 7 1367#define PALMAS_LONG_PRESS_KEY_LPK_LOCK_SHIFT 0x07
1368#define PALMAS_LONG_PRESS_KEY_LPK_INT_CLR 0x10 1368#define PALMAS_LONG_PRESS_KEY_LPK_INT_CLR 0x10
1369#define PALMAS_LONG_PRESS_KEY_LPK_INT_CLR_SHIFT 4 1369#define PALMAS_LONG_PRESS_KEY_LPK_INT_CLR_SHIFT 0x04
1370#define PALMAS_LONG_PRESS_KEY_LPK_TIME_MASK 0x0c 1370#define PALMAS_LONG_PRESS_KEY_LPK_TIME_MASK 0x0c
1371#define PALMAS_LONG_PRESS_KEY_LPK_TIME_SHIFT 2 1371#define PALMAS_LONG_PRESS_KEY_LPK_TIME_SHIFT 0x02
1372#define PALMAS_LONG_PRESS_KEY_PWRON_DEBOUNCE_MASK 0x03 1372#define PALMAS_LONG_PRESS_KEY_PWRON_DEBOUNCE_MASK 0x03
1373#define PALMAS_LONG_PRESS_KEY_PWRON_DEBOUNCE_SHIFT 0 1373#define PALMAS_LONG_PRESS_KEY_PWRON_DEBOUNCE_SHIFT 0x00
1374 1374
1375/* Bit definitions for OSC_THERM_CTRL */ 1375/* Bit definitions for OSC_THERM_CTRL */
1376#define PALMAS_OSC_THERM_CTRL_VANA_ON_IN_SLEEP 0x80 1376#define PALMAS_OSC_THERM_CTRL_VANA_ON_IN_SLEEP 0x80
1377#define PALMAS_OSC_THERM_CTRL_VANA_ON_IN_SLEEP_SHIFT 7 1377#define PALMAS_OSC_THERM_CTRL_VANA_ON_IN_SLEEP_SHIFT 0x07
1378#define PALMAS_OSC_THERM_CTRL_INT_MASK_IN_SLEEP 0x40 1378#define PALMAS_OSC_THERM_CTRL_INT_MASK_IN_SLEEP 0x40
1379#define PALMAS_OSC_THERM_CTRL_INT_MASK_IN_SLEEP_SHIFT 6 1379#define PALMAS_OSC_THERM_CTRL_INT_MASK_IN_SLEEP_SHIFT 0x06
1380#define PALMAS_OSC_THERM_CTRL_RC15MHZ_ON_IN_SLEEP 0x20 1380#define PALMAS_OSC_THERM_CTRL_RC15MHZ_ON_IN_SLEEP 0x20
1381#define PALMAS_OSC_THERM_CTRL_RC15MHZ_ON_IN_SLEEP_SHIFT 5 1381#define PALMAS_OSC_THERM_CTRL_RC15MHZ_ON_IN_SLEEP_SHIFT 0x05
1382#define PALMAS_OSC_THERM_CTRL_THERM_OFF_IN_SLEEP 0x10 1382#define PALMAS_OSC_THERM_CTRL_THERM_OFF_IN_SLEEP 0x10
1383#define PALMAS_OSC_THERM_CTRL_THERM_OFF_IN_SLEEP_SHIFT 4 1383#define PALMAS_OSC_THERM_CTRL_THERM_OFF_IN_SLEEP_SHIFT 0x04
1384#define PALMAS_OSC_THERM_CTRL_THERM_HD_SEL_MASK 0x0c 1384#define PALMAS_OSC_THERM_CTRL_THERM_HD_SEL_MASK 0x0c
1385#define PALMAS_OSC_THERM_CTRL_THERM_HD_SEL_SHIFT 2 1385#define PALMAS_OSC_THERM_CTRL_THERM_HD_SEL_SHIFT 0x02
1386#define PALMAS_OSC_THERM_CTRL_OSC_BYPASS 0x02 1386#define PALMAS_OSC_THERM_CTRL_OSC_BYPASS 0x02
1387#define PALMAS_OSC_THERM_CTRL_OSC_BYPASS_SHIFT 1 1387#define PALMAS_OSC_THERM_CTRL_OSC_BYPASS_SHIFT 0x01
1388#define PALMAS_OSC_THERM_CTRL_OSC_HPMODE 0x01 1388#define PALMAS_OSC_THERM_CTRL_OSC_HPMODE 0x01
1389#define PALMAS_OSC_THERM_CTRL_OSC_HPMODE_SHIFT 0 1389#define PALMAS_OSC_THERM_CTRL_OSC_HPMODE_SHIFT 0x00
1390 1390
1391/* Bit definitions for BATDEBOUNCING */ 1391/* Bit definitions for BATDEBOUNCING */
1392#define PALMAS_BATDEBOUNCING_BAT_DEB_BYPASS 0x80 1392#define PALMAS_BATDEBOUNCING_BAT_DEB_BYPASS 0x80
1393#define PALMAS_BATDEBOUNCING_BAT_DEB_BYPASS_SHIFT 7 1393#define PALMAS_BATDEBOUNCING_BAT_DEB_BYPASS_SHIFT 0x07
1394#define PALMAS_BATDEBOUNCING_BINS_DEB_MASK 0x78 1394#define PALMAS_BATDEBOUNCING_BINS_DEB_MASK 0x78
1395#define PALMAS_BATDEBOUNCING_BINS_DEB_SHIFT 3 1395#define PALMAS_BATDEBOUNCING_BINS_DEB_SHIFT 0x03
1396#define PALMAS_BATDEBOUNCING_BEXT_DEB_MASK 0x07 1396#define PALMAS_BATDEBOUNCING_BEXT_DEB_MASK 0x07
1397#define PALMAS_BATDEBOUNCING_BEXT_DEB_SHIFT 0 1397#define PALMAS_BATDEBOUNCING_BEXT_DEB_SHIFT 0x00
1398 1398
1399/* Bit definitions for SWOFF_HWRST */ 1399/* Bit definitions for SWOFF_HWRST */
1400#define PALMAS_SWOFF_HWRST_PWRON_LPK 0x80 1400#define PALMAS_SWOFF_HWRST_PWRON_LPK 0x80
1401#define PALMAS_SWOFF_HWRST_PWRON_LPK_SHIFT 7 1401#define PALMAS_SWOFF_HWRST_PWRON_LPK_SHIFT 0x07
1402#define PALMAS_SWOFF_HWRST_PWRDOWN 0x40 1402#define PALMAS_SWOFF_HWRST_PWRDOWN 0x40
1403#define PALMAS_SWOFF_HWRST_PWRDOWN_SHIFT 6 1403#define PALMAS_SWOFF_HWRST_PWRDOWN_SHIFT 0x06
1404#define PALMAS_SWOFF_HWRST_WTD 0x20 1404#define PALMAS_SWOFF_HWRST_WTD 0x20
1405#define PALMAS_SWOFF_HWRST_WTD_SHIFT 5 1405#define PALMAS_SWOFF_HWRST_WTD_SHIFT 0x05
1406#define PALMAS_SWOFF_HWRST_TSHUT 0x10 1406#define PALMAS_SWOFF_HWRST_TSHUT 0x10
1407#define PALMAS_SWOFF_HWRST_TSHUT_SHIFT 4 1407#define PALMAS_SWOFF_HWRST_TSHUT_SHIFT 0x04
1408#define PALMAS_SWOFF_HWRST_RESET_IN 0x08 1408#define PALMAS_SWOFF_HWRST_RESET_IN 0x08
1409#define PALMAS_SWOFF_HWRST_RESET_IN_SHIFT 3 1409#define PALMAS_SWOFF_HWRST_RESET_IN_SHIFT 0x03
1410#define PALMAS_SWOFF_HWRST_SW_RST 0x04 1410#define PALMAS_SWOFF_HWRST_SW_RST 0x04
1411#define PALMAS_SWOFF_HWRST_SW_RST_SHIFT 2 1411#define PALMAS_SWOFF_HWRST_SW_RST_SHIFT 0x02
1412#define PALMAS_SWOFF_HWRST_VSYS_LO 0x02 1412#define PALMAS_SWOFF_HWRST_VSYS_LO 0x02
1413#define PALMAS_SWOFF_HWRST_VSYS_LO_SHIFT 1 1413#define PALMAS_SWOFF_HWRST_VSYS_LO_SHIFT 0x01
1414#define PALMAS_SWOFF_HWRST_GPADC_SHUTDOWN 0x01 1414#define PALMAS_SWOFF_HWRST_GPADC_SHUTDOWN 0x01
1415#define PALMAS_SWOFF_HWRST_GPADC_SHUTDOWN_SHIFT 0 1415#define PALMAS_SWOFF_HWRST_GPADC_SHUTDOWN_SHIFT 0x00
1416 1416
1417/* Bit definitions for SWOFF_COLDRST */ 1417/* Bit definitions for SWOFF_COLDRST */
1418#define PALMAS_SWOFF_COLDRST_PWRON_LPK 0x80 1418#define PALMAS_SWOFF_COLDRST_PWRON_LPK 0x80
1419#define PALMAS_SWOFF_COLDRST_PWRON_LPK_SHIFT 7 1419#define PALMAS_SWOFF_COLDRST_PWRON_LPK_SHIFT 0x07
1420#define PALMAS_SWOFF_COLDRST_PWRDOWN 0x40 1420#define PALMAS_SWOFF_COLDRST_PWRDOWN 0x40
1421#define PALMAS_SWOFF_COLDRST_PWRDOWN_SHIFT 6 1421#define PALMAS_SWOFF_COLDRST_PWRDOWN_SHIFT 0x06
1422#define PALMAS_SWOFF_COLDRST_WTD 0x20 1422#define PALMAS_SWOFF_COLDRST_WTD 0x20
1423#define PALMAS_SWOFF_COLDRST_WTD_SHIFT 5 1423#define PALMAS_SWOFF_COLDRST_WTD_SHIFT 0x05
1424#define PALMAS_SWOFF_COLDRST_TSHUT 0x10 1424#define PALMAS_SWOFF_COLDRST_TSHUT 0x10
1425#define PALMAS_SWOFF_COLDRST_TSHUT_SHIFT 4 1425#define PALMAS_SWOFF_COLDRST_TSHUT_SHIFT 0x04
1426#define PALMAS_SWOFF_COLDRST_RESET_IN 0x08 1426#define PALMAS_SWOFF_COLDRST_RESET_IN 0x08
1427#define PALMAS_SWOFF_COLDRST_RESET_IN_SHIFT 3 1427#define PALMAS_SWOFF_COLDRST_RESET_IN_SHIFT 0x03
1428#define PALMAS_SWOFF_COLDRST_SW_RST 0x04 1428#define PALMAS_SWOFF_COLDRST_SW_RST 0x04
1429#define PALMAS_SWOFF_COLDRST_SW_RST_SHIFT 2 1429#define PALMAS_SWOFF_COLDRST_SW_RST_SHIFT 0x02
1430#define PALMAS_SWOFF_COLDRST_VSYS_LO 0x02 1430#define PALMAS_SWOFF_COLDRST_VSYS_LO 0x02
1431#define PALMAS_SWOFF_COLDRST_VSYS_LO_SHIFT 1 1431#define PALMAS_SWOFF_COLDRST_VSYS_LO_SHIFT 0x01
1432#define PALMAS_SWOFF_COLDRST_GPADC_SHUTDOWN 0x01 1432#define PALMAS_SWOFF_COLDRST_GPADC_SHUTDOWN 0x01
1433#define PALMAS_SWOFF_COLDRST_GPADC_SHUTDOWN_SHIFT 0 1433#define PALMAS_SWOFF_COLDRST_GPADC_SHUTDOWN_SHIFT 0x00
1434 1434
1435/* Bit definitions for SWOFF_STATUS */ 1435/* Bit definitions for SWOFF_STATUS */
1436#define PALMAS_SWOFF_STATUS_PWRON_LPK 0x80 1436#define PALMAS_SWOFF_STATUS_PWRON_LPK 0x80
1437#define PALMAS_SWOFF_STATUS_PWRON_LPK_SHIFT 7 1437#define PALMAS_SWOFF_STATUS_PWRON_LPK_SHIFT 0x07
1438#define PALMAS_SWOFF_STATUS_PWRDOWN 0x40 1438#define PALMAS_SWOFF_STATUS_PWRDOWN 0x40
1439#define PALMAS_SWOFF_STATUS_PWRDOWN_SHIFT 6 1439#define PALMAS_SWOFF_STATUS_PWRDOWN_SHIFT 0x06
1440#define PALMAS_SWOFF_STATUS_WTD 0x20 1440#define PALMAS_SWOFF_STATUS_WTD 0x20
1441#define PALMAS_SWOFF_STATUS_WTD_SHIFT 5 1441#define PALMAS_SWOFF_STATUS_WTD_SHIFT 0x05
1442#define PALMAS_SWOFF_STATUS_TSHUT 0x10 1442#define PALMAS_SWOFF_STATUS_TSHUT 0x10
1443#define PALMAS_SWOFF_STATUS_TSHUT_SHIFT 4 1443#define PALMAS_SWOFF_STATUS_TSHUT_SHIFT 0x04
1444#define PALMAS_SWOFF_STATUS_RESET_IN 0x08 1444#define PALMAS_SWOFF_STATUS_RESET_IN 0x08
1445#define PALMAS_SWOFF_STATUS_RESET_IN_SHIFT 3 1445#define PALMAS_SWOFF_STATUS_RESET_IN_SHIFT 0x03
1446#define PALMAS_SWOFF_STATUS_SW_RST 0x04 1446#define PALMAS_SWOFF_STATUS_SW_RST 0x04
1447#define PALMAS_SWOFF_STATUS_SW_RST_SHIFT 2 1447#define PALMAS_SWOFF_STATUS_SW_RST_SHIFT 0x02
1448#define PALMAS_SWOFF_STATUS_VSYS_LO 0x02 1448#define PALMAS_SWOFF_STATUS_VSYS_LO 0x02
1449#define PALMAS_SWOFF_STATUS_VSYS_LO_SHIFT 1 1449#define PALMAS_SWOFF_STATUS_VSYS_LO_SHIFT 0x01
1450#define PALMAS_SWOFF_STATUS_GPADC_SHUTDOWN 0x01 1450#define PALMAS_SWOFF_STATUS_GPADC_SHUTDOWN 0x01
1451#define PALMAS_SWOFF_STATUS_GPADC_SHUTDOWN_SHIFT 0 1451#define PALMAS_SWOFF_STATUS_GPADC_SHUTDOWN_SHIFT 0x00
1452 1452
1453/* Bit definitions for PMU_CONFIG */ 1453/* Bit definitions for PMU_CONFIG */
1454#define PALMAS_PMU_CONFIG_MULTI_CELL_EN 0x40 1454#define PALMAS_PMU_CONFIG_MULTI_CELL_EN 0x40
1455#define PALMAS_PMU_CONFIG_MULTI_CELL_EN_SHIFT 6 1455#define PALMAS_PMU_CONFIG_MULTI_CELL_EN_SHIFT 0x06
1456#define PALMAS_PMU_CONFIG_SPARE_MASK 0x30 1456#define PALMAS_PMU_CONFIG_SPARE_MASK 0x30
1457#define PALMAS_PMU_CONFIG_SPARE_SHIFT 4 1457#define PALMAS_PMU_CONFIG_SPARE_SHIFT 0x04
1458#define PALMAS_PMU_CONFIG_SWOFF_DLY_MASK 0x0c 1458#define PALMAS_PMU_CONFIG_SWOFF_DLY_MASK 0x0c
1459#define PALMAS_PMU_CONFIG_SWOFF_DLY_SHIFT 2 1459#define PALMAS_PMU_CONFIG_SWOFF_DLY_SHIFT 0x02
1460#define PALMAS_PMU_CONFIG_GATE_RESET_OUT 0x02 1460#define PALMAS_PMU_CONFIG_GATE_RESET_OUT 0x02
1461#define PALMAS_PMU_CONFIG_GATE_RESET_OUT_SHIFT 1 1461#define PALMAS_PMU_CONFIG_GATE_RESET_OUT_SHIFT 0x01
1462#define PALMAS_PMU_CONFIG_AUTODEVON 0x01 1462#define PALMAS_PMU_CONFIG_AUTODEVON 0x01
1463#define PALMAS_PMU_CONFIG_AUTODEVON_SHIFT 0 1463#define PALMAS_PMU_CONFIG_AUTODEVON_SHIFT 0x00
1464 1464
1465/* Bit definitions for SPARE */ 1465/* Bit definitions for SPARE */
1466#define PALMAS_SPARE_SPARE_MASK 0xf8 1466#define PALMAS_SPARE_SPARE_MASK 0xf8
1467#define PALMAS_SPARE_SPARE_SHIFT 3 1467#define PALMAS_SPARE_SPARE_SHIFT 0x03
1468#define PALMAS_SPARE_REGEN3_OD 0x04 1468#define PALMAS_SPARE_REGEN3_OD 0x04
1469#define PALMAS_SPARE_REGEN3_OD_SHIFT 2 1469#define PALMAS_SPARE_REGEN3_OD_SHIFT 0x02
1470#define PALMAS_SPARE_REGEN2_OD 0x02 1470#define PALMAS_SPARE_REGEN2_OD 0x02
1471#define PALMAS_SPARE_REGEN2_OD_SHIFT 1 1471#define PALMAS_SPARE_REGEN2_OD_SHIFT 0x01
1472#define PALMAS_SPARE_REGEN1_OD 0x01 1472#define PALMAS_SPARE_REGEN1_OD 0x01
1473#define PALMAS_SPARE_REGEN1_OD_SHIFT 0 1473#define PALMAS_SPARE_REGEN1_OD_SHIFT 0x00
1474 1474
1475/* Bit definitions for PMU_SECONDARY_INT */ 1475/* Bit definitions for PMU_SECONDARY_INT */
1476#define PALMAS_PMU_SECONDARY_INT_VBUS_OVV_INT_SRC 0x80 1476#define PALMAS_PMU_SECONDARY_INT_VBUS_OVV_INT_SRC 0x80
1477#define PALMAS_PMU_SECONDARY_INT_VBUS_OVV_INT_SRC_SHIFT 7 1477#define PALMAS_PMU_SECONDARY_INT_VBUS_OVV_INT_SRC_SHIFT 0x07
1478#define PALMAS_PMU_SECONDARY_INT_CHARG_DET_N_INT_SRC 0x40 1478#define PALMAS_PMU_SECONDARY_INT_CHARG_DET_N_INT_SRC 0x40
1479#define PALMAS_PMU_SECONDARY_INT_CHARG_DET_N_INT_SRC_SHIFT 6 1479#define PALMAS_PMU_SECONDARY_INT_CHARG_DET_N_INT_SRC_SHIFT 0x06
1480#define PALMAS_PMU_SECONDARY_INT_BB_INT_SRC 0x20 1480#define PALMAS_PMU_SECONDARY_INT_BB_INT_SRC 0x20
1481#define PALMAS_PMU_SECONDARY_INT_BB_INT_SRC_SHIFT 5 1481#define PALMAS_PMU_SECONDARY_INT_BB_INT_SRC_SHIFT 0x05
1482#define PALMAS_PMU_SECONDARY_INT_FBI_INT_SRC 0x10 1482#define PALMAS_PMU_SECONDARY_INT_FBI_INT_SRC 0x10
1483#define PALMAS_PMU_SECONDARY_INT_FBI_INT_SRC_SHIFT 4 1483#define PALMAS_PMU_SECONDARY_INT_FBI_INT_SRC_SHIFT 0x04
1484#define PALMAS_PMU_SECONDARY_INT_VBUS_OVV_MASK 0x08 1484#define PALMAS_PMU_SECONDARY_INT_VBUS_OVV_MASK 0x08
1485#define PALMAS_PMU_SECONDARY_INT_VBUS_OVV_MASK_SHIFT 3 1485#define PALMAS_PMU_SECONDARY_INT_VBUS_OVV_MASK_SHIFT 0x03
1486#define PALMAS_PMU_SECONDARY_INT_CHARG_DET_N_MASK 0x04 1486#define PALMAS_PMU_SECONDARY_INT_CHARG_DET_N_MASK 0x04
1487#define PALMAS_PMU_SECONDARY_INT_CHARG_DET_N_MASK_SHIFT 2 1487#define PALMAS_PMU_SECONDARY_INT_CHARG_DET_N_MASK_SHIFT 0x02
1488#define PALMAS_PMU_SECONDARY_INT_BB_MASK 0x02 1488#define PALMAS_PMU_SECONDARY_INT_BB_MASK 0x02
1489#define PALMAS_PMU_SECONDARY_INT_BB_MASK_SHIFT 1 1489#define PALMAS_PMU_SECONDARY_INT_BB_MASK_SHIFT 0x01
1490#define PALMAS_PMU_SECONDARY_INT_FBI_MASK 0x01 1490#define PALMAS_PMU_SECONDARY_INT_FBI_MASK 0x01
1491#define PALMAS_PMU_SECONDARY_INT_FBI_MASK_SHIFT 0 1491#define PALMAS_PMU_SECONDARY_INT_FBI_MASK_SHIFT 0x00
1492 1492
1493/* Bit definitions for SW_REVISION */ 1493/* Bit definitions for SW_REVISION */
1494#define PALMAS_SW_REVISION_SW_REVISION_MASK 0xff 1494#define PALMAS_SW_REVISION_SW_REVISION_MASK 0xFF
1495#define PALMAS_SW_REVISION_SW_REVISION_SHIFT 0 1495#define PALMAS_SW_REVISION_SW_REVISION_SHIFT 0x00
1496 1496
1497/* Bit definitions for EXT_CHRG_CTRL */ 1497/* Bit definitions for EXT_CHRG_CTRL */
1498#define PALMAS_EXT_CHRG_CTRL_VBUS_OVV_STATUS 0x80 1498#define PALMAS_EXT_CHRG_CTRL_VBUS_OVV_STATUS 0x80
1499#define PALMAS_EXT_CHRG_CTRL_VBUS_OVV_STATUS_SHIFT 7 1499#define PALMAS_EXT_CHRG_CTRL_VBUS_OVV_STATUS_SHIFT 0x07
1500#define PALMAS_EXT_CHRG_CTRL_CHARG_DET_N_STATUS 0x40 1500#define PALMAS_EXT_CHRG_CTRL_CHARG_DET_N_STATUS 0x40
1501#define PALMAS_EXT_CHRG_CTRL_CHARG_DET_N_STATUS_SHIFT 6 1501#define PALMAS_EXT_CHRG_CTRL_CHARG_DET_N_STATUS_SHIFT 0x06
1502#define PALMAS_EXT_CHRG_CTRL_VSYS_DEBOUNCE_DELAY 0x08 1502#define PALMAS_EXT_CHRG_CTRL_VSYS_DEBOUNCE_DELAY 0x08
1503#define PALMAS_EXT_CHRG_CTRL_VSYS_DEBOUNCE_DELAY_SHIFT 3 1503#define PALMAS_EXT_CHRG_CTRL_VSYS_DEBOUNCE_DELAY_SHIFT 0x03
1504#define PALMAS_EXT_CHRG_CTRL_CHRG_DET_N 0x04 1504#define PALMAS_EXT_CHRG_CTRL_CHRG_DET_N 0x04
1505#define PALMAS_EXT_CHRG_CTRL_CHRG_DET_N_SHIFT 2 1505#define PALMAS_EXT_CHRG_CTRL_CHRG_DET_N_SHIFT 0x02
1506#define PALMAS_EXT_CHRG_CTRL_AUTO_ACA_EN 0x02 1506#define PALMAS_EXT_CHRG_CTRL_AUTO_ACA_EN 0x02
1507#define PALMAS_EXT_CHRG_CTRL_AUTO_ACA_EN_SHIFT 1 1507#define PALMAS_EXT_CHRG_CTRL_AUTO_ACA_EN_SHIFT 0x01
1508#define PALMAS_EXT_CHRG_CTRL_AUTO_LDOUSB_EN 0x01 1508#define PALMAS_EXT_CHRG_CTRL_AUTO_LDOUSB_EN 0x01
1509#define PALMAS_EXT_CHRG_CTRL_AUTO_LDOUSB_EN_SHIFT 0 1509#define PALMAS_EXT_CHRG_CTRL_AUTO_LDOUSB_EN_SHIFT 0x00
1510 1510
1511/* Bit definitions for PMU_SECONDARY_INT2 */ 1511/* Bit definitions for PMU_SECONDARY_INT2 */
1512#define PALMAS_PMU_SECONDARY_INT2_DVFS2_INT_SRC 0x20 1512#define PALMAS_PMU_SECONDARY_INT2_DVFS2_INT_SRC 0x20
1513#define PALMAS_PMU_SECONDARY_INT2_DVFS2_INT_SRC_SHIFT 5 1513#define PALMAS_PMU_SECONDARY_INT2_DVFS2_INT_SRC_SHIFT 0x05
1514#define PALMAS_PMU_SECONDARY_INT2_DVFS1_INT_SRC 0x10 1514#define PALMAS_PMU_SECONDARY_INT2_DVFS1_INT_SRC 0x10
1515#define PALMAS_PMU_SECONDARY_INT2_DVFS1_INT_SRC_SHIFT 4 1515#define PALMAS_PMU_SECONDARY_INT2_DVFS1_INT_SRC_SHIFT 0x04
1516#define PALMAS_PMU_SECONDARY_INT2_DVFS2_MASK 0x02 1516#define PALMAS_PMU_SECONDARY_INT2_DVFS2_MASK 0x02
1517#define PALMAS_PMU_SECONDARY_INT2_DVFS2_MASK_SHIFT 1 1517#define PALMAS_PMU_SECONDARY_INT2_DVFS2_MASK_SHIFT 0x01
1518#define PALMAS_PMU_SECONDARY_INT2_DVFS1_MASK 0x01 1518#define PALMAS_PMU_SECONDARY_INT2_DVFS1_MASK 0x01
1519#define PALMAS_PMU_SECONDARY_INT2_DVFS1_MASK_SHIFT 0 1519#define PALMAS_PMU_SECONDARY_INT2_DVFS1_MASK_SHIFT 0x00
1520 1520
1521/* Registers for function RESOURCE */ 1521/* Registers for function RESOURCE */
1522#define PALMAS_CLK32KG_CTRL 0x0 1522#define PALMAS_CLK32KG_CTRL 0x00
1523#define PALMAS_CLK32KGAUDIO_CTRL 0x1 1523#define PALMAS_CLK32KGAUDIO_CTRL 0x01
1524#define PALMAS_REGEN1_CTRL 0x2 1524#define PALMAS_REGEN1_CTRL 0x02
1525#define PALMAS_REGEN2_CTRL 0x3 1525#define PALMAS_REGEN2_CTRL 0x03
1526#define PALMAS_SYSEN1_CTRL 0x4 1526#define PALMAS_SYSEN1_CTRL 0x04
1527#define PALMAS_SYSEN2_CTRL 0x5 1527#define PALMAS_SYSEN2_CTRL 0x05
1528#define PALMAS_NSLEEP_RES_ASSIGN 0x6 1528#define PALMAS_NSLEEP_RES_ASSIGN 0x06
1529#define PALMAS_NSLEEP_SMPS_ASSIGN 0x7 1529#define PALMAS_NSLEEP_SMPS_ASSIGN 0x07
1530#define PALMAS_NSLEEP_LDO_ASSIGN1 0x8 1530#define PALMAS_NSLEEP_LDO_ASSIGN1 0x08
1531#define PALMAS_NSLEEP_LDO_ASSIGN2 0x9 1531#define PALMAS_NSLEEP_LDO_ASSIGN2 0x09
1532#define PALMAS_ENABLE1_RES_ASSIGN 0xA 1532#define PALMAS_ENABLE1_RES_ASSIGN 0x0A
1533#define PALMAS_ENABLE1_SMPS_ASSIGN 0xB 1533#define PALMAS_ENABLE1_SMPS_ASSIGN 0x0B
1534#define PALMAS_ENABLE1_LDO_ASSIGN1 0xC 1534#define PALMAS_ENABLE1_LDO_ASSIGN1 0x0C
1535#define PALMAS_ENABLE1_LDO_ASSIGN2 0xD 1535#define PALMAS_ENABLE1_LDO_ASSIGN2 0x0D
1536#define PALMAS_ENABLE2_RES_ASSIGN 0xE 1536#define PALMAS_ENABLE2_RES_ASSIGN 0x0E
1537#define PALMAS_ENABLE2_SMPS_ASSIGN 0xF 1537#define PALMAS_ENABLE2_SMPS_ASSIGN 0x0F
1538#define PALMAS_ENABLE2_LDO_ASSIGN1 0x10 1538#define PALMAS_ENABLE2_LDO_ASSIGN1 0x10
1539#define PALMAS_ENABLE2_LDO_ASSIGN2 0x11 1539#define PALMAS_ENABLE2_LDO_ASSIGN2 0x11
1540#define PALMAS_REGEN3_CTRL 0x12 1540#define PALMAS_REGEN3_CTRL 0x12
1541 1541
1542/* Bit definitions for CLK32KG_CTRL */ 1542/* Bit definitions for CLK32KG_CTRL */
1543#define PALMAS_CLK32KG_CTRL_STATUS 0x10 1543#define PALMAS_CLK32KG_CTRL_STATUS 0x10
1544#define PALMAS_CLK32KG_CTRL_STATUS_SHIFT 4 1544#define PALMAS_CLK32KG_CTRL_STATUS_SHIFT 0x04
1545#define PALMAS_CLK32KG_CTRL_MODE_SLEEP 0x04 1545#define PALMAS_CLK32KG_CTRL_MODE_SLEEP 0x04
1546#define PALMAS_CLK32KG_CTRL_MODE_SLEEP_SHIFT 2 1546#define PALMAS_CLK32KG_CTRL_MODE_SLEEP_SHIFT 0x02
1547#define PALMAS_CLK32KG_CTRL_MODE_ACTIVE 0x01 1547#define PALMAS_CLK32KG_CTRL_MODE_ACTIVE 0x01
1548#define PALMAS_CLK32KG_CTRL_MODE_ACTIVE_SHIFT 0 1548#define PALMAS_CLK32KG_CTRL_MODE_ACTIVE_SHIFT 0x00
1549 1549
1550/* Bit definitions for CLK32KGAUDIO_CTRL */ 1550/* Bit definitions for CLK32KGAUDIO_CTRL */
1551#define PALMAS_CLK32KGAUDIO_CTRL_STATUS 0x10 1551#define PALMAS_CLK32KGAUDIO_CTRL_STATUS 0x10
1552#define PALMAS_CLK32KGAUDIO_CTRL_STATUS_SHIFT 4 1552#define PALMAS_CLK32KGAUDIO_CTRL_STATUS_SHIFT 0x04
1553#define PALMAS_CLK32KGAUDIO_CTRL_RESERVED3 0x08 1553#define PALMAS_CLK32KGAUDIO_CTRL_RESERVED3 0x08
1554#define PALMAS_CLK32KGAUDIO_CTRL_RESERVED3_SHIFT 3 1554#define PALMAS_CLK32KGAUDIO_CTRL_RESERVED3_SHIFT 0x03
1555#define PALMAS_CLK32KGAUDIO_CTRL_MODE_SLEEP 0x04 1555#define PALMAS_CLK32KGAUDIO_CTRL_MODE_SLEEP 0x04
1556#define PALMAS_CLK32KGAUDIO_CTRL_MODE_SLEEP_SHIFT 2 1556#define PALMAS_CLK32KGAUDIO_CTRL_MODE_SLEEP_SHIFT 0x02
1557#define PALMAS_CLK32KGAUDIO_CTRL_MODE_ACTIVE 0x01 1557#define PALMAS_CLK32KGAUDIO_CTRL_MODE_ACTIVE 0x01
1558#define PALMAS_CLK32KGAUDIO_CTRL_MODE_ACTIVE_SHIFT 0 1558#define PALMAS_CLK32KGAUDIO_CTRL_MODE_ACTIVE_SHIFT 0x00
1559 1559
1560/* Bit definitions for REGEN1_CTRL */ 1560/* Bit definitions for REGEN1_CTRL */
1561#define PALMAS_REGEN1_CTRL_STATUS 0x10 1561#define PALMAS_REGEN1_CTRL_STATUS 0x10
1562#define PALMAS_REGEN1_CTRL_STATUS_SHIFT 4 1562#define PALMAS_REGEN1_CTRL_STATUS_SHIFT 0x04
1563#define PALMAS_REGEN1_CTRL_MODE_SLEEP 0x04 1563#define PALMAS_REGEN1_CTRL_MODE_SLEEP 0x04
1564#define PALMAS_REGEN1_CTRL_MODE_SLEEP_SHIFT 2 1564#define PALMAS_REGEN1_CTRL_MODE_SLEEP_SHIFT 0x02
1565#define PALMAS_REGEN1_CTRL_MODE_ACTIVE 0x01 1565#define PALMAS_REGEN1_CTRL_MODE_ACTIVE 0x01
1566#define PALMAS_REGEN1_CTRL_MODE_ACTIVE_SHIFT 0 1566#define PALMAS_REGEN1_CTRL_MODE_ACTIVE_SHIFT 0x00
1567 1567
1568/* Bit definitions for REGEN2_CTRL */ 1568/* Bit definitions for REGEN2_CTRL */
1569#define PALMAS_REGEN2_CTRL_STATUS 0x10 1569#define PALMAS_REGEN2_CTRL_STATUS 0x10
1570#define PALMAS_REGEN2_CTRL_STATUS_SHIFT 4 1570#define PALMAS_REGEN2_CTRL_STATUS_SHIFT 0x04
1571#define PALMAS_REGEN2_CTRL_MODE_SLEEP 0x04 1571#define PALMAS_REGEN2_CTRL_MODE_SLEEP 0x04
1572#define PALMAS_REGEN2_CTRL_MODE_SLEEP_SHIFT 2 1572#define PALMAS_REGEN2_CTRL_MODE_SLEEP_SHIFT 0x02
1573#define PALMAS_REGEN2_CTRL_MODE_ACTIVE 0x01 1573#define PALMAS_REGEN2_CTRL_MODE_ACTIVE 0x01
1574#define PALMAS_REGEN2_CTRL_MODE_ACTIVE_SHIFT 0 1574#define PALMAS_REGEN2_CTRL_MODE_ACTIVE_SHIFT 0x00
1575 1575
1576/* Bit definitions for SYSEN1_CTRL */ 1576/* Bit definitions for SYSEN1_CTRL */
1577#define PALMAS_SYSEN1_CTRL_STATUS 0x10 1577#define PALMAS_SYSEN1_CTRL_STATUS 0x10
1578#define PALMAS_SYSEN1_CTRL_STATUS_SHIFT 4 1578#define PALMAS_SYSEN1_CTRL_STATUS_SHIFT 0x04
1579#define PALMAS_SYSEN1_CTRL_MODE_SLEEP 0x04 1579#define PALMAS_SYSEN1_CTRL_MODE_SLEEP 0x04
1580#define PALMAS_SYSEN1_CTRL_MODE_SLEEP_SHIFT 2 1580#define PALMAS_SYSEN1_CTRL_MODE_SLEEP_SHIFT 0x02
1581#define PALMAS_SYSEN1_CTRL_MODE_ACTIVE 0x01 1581#define PALMAS_SYSEN1_CTRL_MODE_ACTIVE 0x01
1582#define PALMAS_SYSEN1_CTRL_MODE_ACTIVE_SHIFT 0 1582#define PALMAS_SYSEN1_CTRL_MODE_ACTIVE_SHIFT 0x00
1583 1583
1584/* Bit definitions for SYSEN2_CTRL */ 1584/* Bit definitions for SYSEN2_CTRL */
1585#define PALMAS_SYSEN2_CTRL_STATUS 0x10 1585#define PALMAS_SYSEN2_CTRL_STATUS 0x10
1586#define PALMAS_SYSEN2_CTRL_STATUS_SHIFT 4 1586#define PALMAS_SYSEN2_CTRL_STATUS_SHIFT 0x04
1587#define PALMAS_SYSEN2_CTRL_MODE_SLEEP 0x04 1587#define PALMAS_SYSEN2_CTRL_MODE_SLEEP 0x04
1588#define PALMAS_SYSEN2_CTRL_MODE_SLEEP_SHIFT 2 1588#define PALMAS_SYSEN2_CTRL_MODE_SLEEP_SHIFT 0x02
1589#define PALMAS_SYSEN2_CTRL_MODE_ACTIVE 0x01 1589#define PALMAS_SYSEN2_CTRL_MODE_ACTIVE 0x01
1590#define PALMAS_SYSEN2_CTRL_MODE_ACTIVE_SHIFT 0 1590#define PALMAS_SYSEN2_CTRL_MODE_ACTIVE_SHIFT 0x00
1591 1591
1592/* Bit definitions for NSLEEP_RES_ASSIGN */ 1592/* Bit definitions for NSLEEP_RES_ASSIGN */
1593#define PALMAS_NSLEEP_RES_ASSIGN_REGEN3 0x40 1593#define PALMAS_NSLEEP_RES_ASSIGN_REGEN3 0x40
1594#define PALMAS_NSLEEP_RES_ASSIGN_REGEN3_SHIFT 6 1594#define PALMAS_NSLEEP_RES_ASSIGN_REGEN3_SHIFT 0x06
1595#define PALMAS_NSLEEP_RES_ASSIGN_CLK32KGAUDIO 0x20 1595#define PALMAS_NSLEEP_RES_ASSIGN_CLK32KGAUDIO 0x20
1596#define PALMAS_NSLEEP_RES_ASSIGN_CLK32KGAUDIO_SHIFT 5 1596#define PALMAS_NSLEEP_RES_ASSIGN_CLK32KGAUDIO_SHIFT 0x05
1597#define PALMAS_NSLEEP_RES_ASSIGN_CLK32KG 0x10 1597#define PALMAS_NSLEEP_RES_ASSIGN_CLK32KG 0x10
1598#define PALMAS_NSLEEP_RES_ASSIGN_CLK32KG_SHIFT 4 1598#define PALMAS_NSLEEP_RES_ASSIGN_CLK32KG_SHIFT 0x04
1599#define PALMAS_NSLEEP_RES_ASSIGN_SYSEN2 0x08 1599#define PALMAS_NSLEEP_RES_ASSIGN_SYSEN2 0x08
1600#define PALMAS_NSLEEP_RES_ASSIGN_SYSEN2_SHIFT 3 1600#define PALMAS_NSLEEP_RES_ASSIGN_SYSEN2_SHIFT 0x03
1601#define PALMAS_NSLEEP_RES_ASSIGN_SYSEN1 0x04 1601#define PALMAS_NSLEEP_RES_ASSIGN_SYSEN1 0x04
1602#define PALMAS_NSLEEP_RES_ASSIGN_SYSEN1_SHIFT 2 1602#define PALMAS_NSLEEP_RES_ASSIGN_SYSEN1_SHIFT 0x02
1603#define PALMAS_NSLEEP_RES_ASSIGN_REGEN2 0x02 1603#define PALMAS_NSLEEP_RES_ASSIGN_REGEN2 0x02
1604#define PALMAS_NSLEEP_RES_ASSIGN_REGEN2_SHIFT 1 1604#define PALMAS_NSLEEP_RES_ASSIGN_REGEN2_SHIFT 0x01
1605#define PALMAS_NSLEEP_RES_ASSIGN_REGEN1 0x01 1605#define PALMAS_NSLEEP_RES_ASSIGN_REGEN1 0x01
1606#define PALMAS_NSLEEP_RES_ASSIGN_REGEN1_SHIFT 0 1606#define PALMAS_NSLEEP_RES_ASSIGN_REGEN1_SHIFT 0x00
1607 1607
1608/* Bit definitions for NSLEEP_SMPS_ASSIGN */ 1608/* Bit definitions for NSLEEP_SMPS_ASSIGN */
1609#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS10 0x80 1609#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS10 0x80
1610#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS10_SHIFT 7 1610#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS10_SHIFT 0x07
1611#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS9 0x40 1611#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS9 0x40
1612#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS9_SHIFT 6 1612#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS9_SHIFT 0x06
1613#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS8 0x20 1613#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS8 0x20
1614#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS8_SHIFT 5 1614#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS8_SHIFT 0x05
1615#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS7 0x10 1615#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS7 0x10
1616#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS7_SHIFT 4 1616#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS7_SHIFT 0x04
1617#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS6 0x08 1617#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS6 0x08
1618#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS6_SHIFT 3 1618#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS6_SHIFT 0x03
1619#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS45 0x04 1619#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS45 0x04
1620#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS45_SHIFT 2 1620#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS45_SHIFT 0x02
1621#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS3 0x02 1621#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS3 0x02
1622#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS3_SHIFT 1 1622#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS3_SHIFT 0x01
1623#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS12 0x01 1623#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS12 0x01
1624#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS12_SHIFT 0 1624#define PALMAS_NSLEEP_SMPS_ASSIGN_SMPS12_SHIFT 0x00
1625 1625
1626/* Bit definitions for NSLEEP_LDO_ASSIGN1 */ 1626/* Bit definitions for NSLEEP_LDO_ASSIGN1 */
1627#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO8 0x80 1627#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO8 0x80
1628#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO8_SHIFT 7 1628#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO8_SHIFT 0x07
1629#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO7 0x40 1629#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO7 0x40
1630#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO7_SHIFT 6 1630#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO7_SHIFT 0x06
1631#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO6 0x20 1631#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO6 0x20
1632#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO6_SHIFT 5 1632#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO6_SHIFT 0x05
1633#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO5 0x10 1633#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO5 0x10
1634#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO5_SHIFT 4 1634#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO5_SHIFT 0x04
1635#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO4 0x08 1635#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO4 0x08
1636#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO4_SHIFT 3 1636#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO4_SHIFT 0x03
1637#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO3 0x04 1637#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO3 0x04
1638#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO3_SHIFT 2 1638#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO3_SHIFT 0x02
1639#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO2 0x02 1639#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO2 0x02
1640#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO2_SHIFT 1 1640#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO2_SHIFT 0x01
1641#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO1 0x01 1641#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO1 0x01
1642#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO1_SHIFT 0 1642#define PALMAS_NSLEEP_LDO_ASSIGN1_LDO1_SHIFT 0x00
1643 1643
1644/* Bit definitions for NSLEEP_LDO_ASSIGN2 */ 1644/* Bit definitions for NSLEEP_LDO_ASSIGN2 */
1645#define PALMAS_NSLEEP_LDO_ASSIGN2_LDOUSB 0x04 1645#define PALMAS_NSLEEP_LDO_ASSIGN2_LDOUSB 0x04
1646#define PALMAS_NSLEEP_LDO_ASSIGN2_LDOUSB_SHIFT 2 1646#define PALMAS_NSLEEP_LDO_ASSIGN2_LDOUSB_SHIFT 0x02
1647#define PALMAS_NSLEEP_LDO_ASSIGN2_LDOLN 0x02 1647#define PALMAS_NSLEEP_LDO_ASSIGN2_LDOLN 0x02
1648#define PALMAS_NSLEEP_LDO_ASSIGN2_LDOLN_SHIFT 1 1648#define PALMAS_NSLEEP_LDO_ASSIGN2_LDOLN_SHIFT 0x01
1649#define PALMAS_NSLEEP_LDO_ASSIGN2_LDO9 0x01 1649#define PALMAS_NSLEEP_LDO_ASSIGN2_LDO9 0x01
1650#define PALMAS_NSLEEP_LDO_ASSIGN2_LDO9_SHIFT 0 1650#define PALMAS_NSLEEP_LDO_ASSIGN2_LDO9_SHIFT 0x00
1651 1651
1652/* Bit definitions for ENABLE1_RES_ASSIGN */ 1652/* Bit definitions for ENABLE1_RES_ASSIGN */
1653#define PALMAS_ENABLE1_RES_ASSIGN_REGEN3 0x40 1653#define PALMAS_ENABLE1_RES_ASSIGN_REGEN3 0x40
1654#define PALMAS_ENABLE1_RES_ASSIGN_REGEN3_SHIFT 6 1654#define PALMAS_ENABLE1_RES_ASSIGN_REGEN3_SHIFT 0x06
1655#define PALMAS_ENABLE1_RES_ASSIGN_CLK32KGAUDIO 0x20 1655#define PALMAS_ENABLE1_RES_ASSIGN_CLK32KGAUDIO 0x20
1656#define PALMAS_ENABLE1_RES_ASSIGN_CLK32KGAUDIO_SHIFT 5 1656#define PALMAS_ENABLE1_RES_ASSIGN_CLK32KGAUDIO_SHIFT 0x05
1657#define PALMAS_ENABLE1_RES_ASSIGN_CLK32KG 0x10 1657#define PALMAS_ENABLE1_RES_ASSIGN_CLK32KG 0x10
1658#define PALMAS_ENABLE1_RES_ASSIGN_CLK32KG_SHIFT 4 1658#define PALMAS_ENABLE1_RES_ASSIGN_CLK32KG_SHIFT 0x04
1659#define PALMAS_ENABLE1_RES_ASSIGN_SYSEN2 0x08 1659#define PALMAS_ENABLE1_RES_ASSIGN_SYSEN2 0x08
1660#define PALMAS_ENABLE1_RES_ASSIGN_SYSEN2_SHIFT 3 1660#define PALMAS_ENABLE1_RES_ASSIGN_SYSEN2_SHIFT 0x03
1661#define PALMAS_ENABLE1_RES_ASSIGN_SYSEN1 0x04 1661#define PALMAS_ENABLE1_RES_ASSIGN_SYSEN1 0x04
1662#define PALMAS_ENABLE1_RES_ASSIGN_SYSEN1_SHIFT 2 1662#define PALMAS_ENABLE1_RES_ASSIGN_SYSEN1_SHIFT 0x02
1663#define PALMAS_ENABLE1_RES_ASSIGN_REGEN2 0x02 1663#define PALMAS_ENABLE1_RES_ASSIGN_REGEN2 0x02
1664#define PALMAS_ENABLE1_RES_ASSIGN_REGEN2_SHIFT 1 1664#define PALMAS_ENABLE1_RES_ASSIGN_REGEN2_SHIFT 0x01
1665#define PALMAS_ENABLE1_RES_ASSIGN_REGEN1 0x01 1665#define PALMAS_ENABLE1_RES_ASSIGN_REGEN1 0x01
1666#define PALMAS_ENABLE1_RES_ASSIGN_REGEN1_SHIFT 0 1666#define PALMAS_ENABLE1_RES_ASSIGN_REGEN1_SHIFT 0x00
1667 1667
1668/* Bit definitions for ENABLE1_SMPS_ASSIGN */ 1668/* Bit definitions for ENABLE1_SMPS_ASSIGN */
1669#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS10 0x80 1669#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS10 0x80
1670#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS10_SHIFT 7 1670#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS10_SHIFT 0x07
1671#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS9 0x40 1671#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS9 0x40
1672#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS9_SHIFT 6 1672#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS9_SHIFT 0x06
1673#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS8 0x20 1673#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS8 0x20
1674#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS8_SHIFT 5 1674#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS8_SHIFT 0x05
1675#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS7 0x10 1675#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS7 0x10
1676#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS7_SHIFT 4 1676#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS7_SHIFT 0x04
1677#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS6 0x08 1677#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS6 0x08
1678#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS6_SHIFT 3 1678#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS6_SHIFT 0x03
1679#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS45 0x04 1679#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS45 0x04
1680#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS45_SHIFT 2 1680#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS45_SHIFT 0x02
1681#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS3 0x02 1681#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS3 0x02
1682#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS3_SHIFT 1 1682#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS3_SHIFT 0x01
1683#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS12 0x01 1683#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS12 0x01
1684#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS12_SHIFT 0 1684#define PALMAS_ENABLE1_SMPS_ASSIGN_SMPS12_SHIFT 0x00
1685 1685
1686/* Bit definitions for ENABLE1_LDO_ASSIGN1 */ 1686/* Bit definitions for ENABLE1_LDO_ASSIGN1 */
1687#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO8 0x80 1687#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO8 0x80
1688#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO8_SHIFT 7 1688#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO8_SHIFT 0x07
1689#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO7 0x40 1689#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO7 0x40
1690#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO7_SHIFT 6 1690#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO7_SHIFT 0x06
1691#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO6 0x20 1691#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO6 0x20
1692#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO6_SHIFT 5 1692#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO6_SHIFT 0x05
1693#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO5 0x10 1693#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO5 0x10
1694#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO5_SHIFT 4 1694#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO5_SHIFT 0x04
1695#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO4 0x08 1695#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO4 0x08
1696#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO4_SHIFT 3 1696#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO4_SHIFT 0x03
1697#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO3 0x04 1697#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO3 0x04
1698#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO3_SHIFT 2 1698#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO3_SHIFT 0x02
1699#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO2 0x02 1699#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO2 0x02
1700#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO2_SHIFT 1 1700#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO2_SHIFT 0x01
1701#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO1 0x01 1701#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO1 0x01
1702#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO1_SHIFT 0 1702#define PALMAS_ENABLE1_LDO_ASSIGN1_LDO1_SHIFT 0x00
1703 1703
1704/* Bit definitions for ENABLE1_LDO_ASSIGN2 */ 1704/* Bit definitions for ENABLE1_LDO_ASSIGN2 */
1705#define PALMAS_ENABLE1_LDO_ASSIGN2_LDOUSB 0x04 1705#define PALMAS_ENABLE1_LDO_ASSIGN2_LDOUSB 0x04
1706#define PALMAS_ENABLE1_LDO_ASSIGN2_LDOUSB_SHIFT 2 1706#define PALMAS_ENABLE1_LDO_ASSIGN2_LDOUSB_SHIFT 0x02
1707#define PALMAS_ENABLE1_LDO_ASSIGN2_LDOLN 0x02 1707#define PALMAS_ENABLE1_LDO_ASSIGN2_LDOLN 0x02
1708#define PALMAS_ENABLE1_LDO_ASSIGN2_LDOLN_SHIFT 1 1708#define PALMAS_ENABLE1_LDO_ASSIGN2_LDOLN_SHIFT 0x01
1709#define PALMAS_ENABLE1_LDO_ASSIGN2_LDO9 0x01 1709#define PALMAS_ENABLE1_LDO_ASSIGN2_LDO9 0x01
1710#define PALMAS_ENABLE1_LDO_ASSIGN2_LDO9_SHIFT 0 1710#define PALMAS_ENABLE1_LDO_ASSIGN2_LDO9_SHIFT 0x00
1711 1711
1712/* Bit definitions for ENABLE2_RES_ASSIGN */ 1712/* Bit definitions for ENABLE2_RES_ASSIGN */
1713#define PALMAS_ENABLE2_RES_ASSIGN_REGEN3 0x40 1713#define PALMAS_ENABLE2_RES_ASSIGN_REGEN3 0x40
1714#define PALMAS_ENABLE2_RES_ASSIGN_REGEN3_SHIFT 6 1714#define PALMAS_ENABLE2_RES_ASSIGN_REGEN3_SHIFT 0x06
1715#define PALMAS_ENABLE2_RES_ASSIGN_CLK32KGAUDIO 0x20 1715#define PALMAS_ENABLE2_RES_ASSIGN_CLK32KGAUDIO 0x20
1716#define PALMAS_ENABLE2_RES_ASSIGN_CLK32KGAUDIO_SHIFT 5 1716#define PALMAS_ENABLE2_RES_ASSIGN_CLK32KGAUDIO_SHIFT 0x05
1717#define PALMAS_ENABLE2_RES_ASSIGN_CLK32KG 0x10 1717#define PALMAS_ENABLE2_RES_ASSIGN_CLK32KG 0x10
1718#define PALMAS_ENABLE2_RES_ASSIGN_CLK32KG_SHIFT 4 1718#define PALMAS_ENABLE2_RES_ASSIGN_CLK32KG_SHIFT 0x04
1719#define PALMAS_ENABLE2_RES_ASSIGN_SYSEN2 0x08 1719#define PALMAS_ENABLE2_RES_ASSIGN_SYSEN2 0x08
1720#define PALMAS_ENABLE2_RES_ASSIGN_SYSEN2_SHIFT 3 1720#define PALMAS_ENABLE2_RES_ASSIGN_SYSEN2_SHIFT 0x03
1721#define PALMAS_ENABLE2_RES_ASSIGN_SYSEN1 0x04 1721#define PALMAS_ENABLE2_RES_ASSIGN_SYSEN1 0x04
1722#define PALMAS_ENABLE2_RES_ASSIGN_SYSEN1_SHIFT 2 1722#define PALMAS_ENABLE2_RES_ASSIGN_SYSEN1_SHIFT 0x02
1723#define PALMAS_ENABLE2_RES_ASSIGN_REGEN2 0x02 1723#define PALMAS_ENABLE2_RES_ASSIGN_REGEN2 0x02
1724#define PALMAS_ENABLE2_RES_ASSIGN_REGEN2_SHIFT 1 1724#define PALMAS_ENABLE2_RES_ASSIGN_REGEN2_SHIFT 0x01
1725#define PALMAS_ENABLE2_RES_ASSIGN_REGEN1 0x01 1725#define PALMAS_ENABLE2_RES_ASSIGN_REGEN1 0x01
1726#define PALMAS_ENABLE2_RES_ASSIGN_REGEN1_SHIFT 0 1726#define PALMAS_ENABLE2_RES_ASSIGN_REGEN1_SHIFT 0x00
1727 1727
1728/* Bit definitions for ENABLE2_SMPS_ASSIGN */ 1728/* Bit definitions for ENABLE2_SMPS_ASSIGN */
1729#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS10 0x80 1729#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS10 0x80
1730#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS10_SHIFT 7 1730#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS10_SHIFT 0x07
1731#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS9 0x40 1731#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS9 0x40
1732#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS9_SHIFT 6 1732#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS9_SHIFT 0x06
1733#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS8 0x20 1733#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS8 0x20
1734#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS8_SHIFT 5 1734#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS8_SHIFT 0x05
1735#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS7 0x10 1735#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS7 0x10
1736#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS7_SHIFT 4 1736#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS7_SHIFT 0x04
1737#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS6 0x08 1737#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS6 0x08
1738#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS6_SHIFT 3 1738#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS6_SHIFT 0x03
1739#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS45 0x04 1739#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS45 0x04
1740#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS45_SHIFT 2 1740#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS45_SHIFT 0x02
1741#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS3 0x02 1741#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS3 0x02
1742#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS3_SHIFT 1 1742#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS3_SHIFT 0x01
1743#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS12 0x01 1743#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS12 0x01
1744#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS12_SHIFT 0 1744#define PALMAS_ENABLE2_SMPS_ASSIGN_SMPS12_SHIFT 0x00
1745 1745
1746/* Bit definitions for ENABLE2_LDO_ASSIGN1 */ 1746/* Bit definitions for ENABLE2_LDO_ASSIGN1 */
1747#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO8 0x80 1747#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO8 0x80
1748#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO8_SHIFT 7 1748#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO8_SHIFT 0x07
1749#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO7 0x40 1749#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO7 0x40
1750#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO7_SHIFT 6 1750#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO7_SHIFT 0x06
1751#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO6 0x20 1751#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO6 0x20
1752#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO6_SHIFT 5 1752#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO6_SHIFT 0x05
1753#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO5 0x10 1753#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO5 0x10
1754#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO5_SHIFT 4 1754#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO5_SHIFT 0x04
1755#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO4 0x08 1755#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO4 0x08
1756#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO4_SHIFT 3 1756#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO4_SHIFT 0x03
1757#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO3 0x04 1757#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO3 0x04
1758#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO3_SHIFT 2 1758#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO3_SHIFT 0x02
1759#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO2 0x02 1759#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO2 0x02
1760#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO2_SHIFT 1 1760#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO2_SHIFT 0x01
1761#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO1 0x01 1761#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO1 0x01
1762#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO1_SHIFT 0 1762#define PALMAS_ENABLE2_LDO_ASSIGN1_LDO1_SHIFT 0x00
1763 1763
1764/* Bit definitions for ENABLE2_LDO_ASSIGN2 */ 1764/* Bit definitions for ENABLE2_LDO_ASSIGN2 */
1765#define PALMAS_ENABLE2_LDO_ASSIGN2_LDOUSB 0x04 1765#define PALMAS_ENABLE2_LDO_ASSIGN2_LDOUSB 0x04
1766#define PALMAS_ENABLE2_LDO_ASSIGN2_LDOUSB_SHIFT 2 1766#define PALMAS_ENABLE2_LDO_ASSIGN2_LDOUSB_SHIFT 0x02
1767#define PALMAS_ENABLE2_LDO_ASSIGN2_LDOLN 0x02 1767#define PALMAS_ENABLE2_LDO_ASSIGN2_LDOLN 0x02
1768#define PALMAS_ENABLE2_LDO_ASSIGN2_LDOLN_SHIFT 1 1768#define PALMAS_ENABLE2_LDO_ASSIGN2_LDOLN_SHIFT 0x01
1769#define PALMAS_ENABLE2_LDO_ASSIGN2_LDO9 0x01 1769#define PALMAS_ENABLE2_LDO_ASSIGN2_LDO9 0x01
1770#define PALMAS_ENABLE2_LDO_ASSIGN2_LDO9_SHIFT 0 1770#define PALMAS_ENABLE2_LDO_ASSIGN2_LDO9_SHIFT 0x00
1771 1771
1772/* Bit definitions for REGEN3_CTRL */ 1772/* Bit definitions for REGEN3_CTRL */
1773#define PALMAS_REGEN3_CTRL_STATUS 0x10 1773#define PALMAS_REGEN3_CTRL_STATUS 0x10
1774#define PALMAS_REGEN3_CTRL_STATUS_SHIFT 4 1774#define PALMAS_REGEN3_CTRL_STATUS_SHIFT 0x04
1775#define PALMAS_REGEN3_CTRL_MODE_SLEEP 0x04 1775#define PALMAS_REGEN3_CTRL_MODE_SLEEP 0x04
1776#define PALMAS_REGEN3_CTRL_MODE_SLEEP_SHIFT 2 1776#define PALMAS_REGEN3_CTRL_MODE_SLEEP_SHIFT 0x02
1777#define PALMAS_REGEN3_CTRL_MODE_ACTIVE 0x01 1777#define PALMAS_REGEN3_CTRL_MODE_ACTIVE 0x01
1778#define PALMAS_REGEN3_CTRL_MODE_ACTIVE_SHIFT 0 1778#define PALMAS_REGEN3_CTRL_MODE_ACTIVE_SHIFT 0x00
1779 1779
1780/* Registers for function PAD_CONTROL */ 1780/* Registers for function PAD_CONTROL */
1781#define PALMAS_OD_OUTPUT_CTRL2 0x2 1781#define PALMAS_OD_OUTPUT_CTRL2 0x02
1782#define PALMAS_POLARITY_CTRL2 0x3 1782#define PALMAS_POLARITY_CTRL2 0x03
1783#define PALMAS_PU_PD_INPUT_CTRL1 0x4 1783#define PALMAS_PU_PD_INPUT_CTRL1 0x04
1784#define PALMAS_PU_PD_INPUT_CTRL2 0x5 1784#define PALMAS_PU_PD_INPUT_CTRL2 0x05
1785#define PALMAS_PU_PD_INPUT_CTRL3 0x6 1785#define PALMAS_PU_PD_INPUT_CTRL3 0x06
1786#define PALMAS_PU_PD_INPUT_CTRL5 0x7 1786#define PALMAS_PU_PD_INPUT_CTRL5 0x07
1787#define PALMAS_OD_OUTPUT_CTRL 0x8 1787#define PALMAS_OD_OUTPUT_CTRL 0x08
1788#define PALMAS_POLARITY_CTRL 0x9 1788#define PALMAS_POLARITY_CTRL 0x09
1789#define PALMAS_PRIMARY_SECONDARY_PAD1 0xA 1789#define PALMAS_PRIMARY_SECONDARY_PAD1 0x0A
1790#define PALMAS_PRIMARY_SECONDARY_PAD2 0xB 1790#define PALMAS_PRIMARY_SECONDARY_PAD2 0x0B
1791#define PALMAS_I2C_SPI 0xC 1791#define PALMAS_I2C_SPI 0x0C
1792#define PALMAS_PU_PD_INPUT_CTRL4 0xD 1792#define PALMAS_PU_PD_INPUT_CTRL4 0x0D
1793#define PALMAS_PRIMARY_SECONDARY_PAD3 0xE 1793#define PALMAS_PRIMARY_SECONDARY_PAD3 0x0E
1794#define PALMAS_PRIMARY_SECONDARY_PAD4 0xF 1794#define PALMAS_PRIMARY_SECONDARY_PAD4 0x0F
1795 1795
1796/* Bit definitions for PU_PD_INPUT_CTRL1 */ 1796/* Bit definitions for PU_PD_INPUT_CTRL1 */
1797#define PALMAS_PU_PD_INPUT_CTRL1_RESET_IN_PD 0x40 1797#define PALMAS_PU_PD_INPUT_CTRL1_RESET_IN_PD 0x40
1798#define PALMAS_PU_PD_INPUT_CTRL1_RESET_IN_PD_SHIFT 6 1798#define PALMAS_PU_PD_INPUT_CTRL1_RESET_IN_PD_SHIFT 0x06
1799#define PALMAS_PU_PD_INPUT_CTRL1_GPADC_START_PU 0x20 1799#define PALMAS_PU_PD_INPUT_CTRL1_GPADC_START_PU 0x20
1800#define PALMAS_PU_PD_INPUT_CTRL1_GPADC_START_PU_SHIFT 5 1800#define PALMAS_PU_PD_INPUT_CTRL1_GPADC_START_PU_SHIFT 0x05
1801#define PALMAS_PU_PD_INPUT_CTRL1_GPADC_START_PD 0x10 1801#define PALMAS_PU_PD_INPUT_CTRL1_GPADC_START_PD 0x10
1802#define PALMAS_PU_PD_INPUT_CTRL1_GPADC_START_PD_SHIFT 4 1802#define PALMAS_PU_PD_INPUT_CTRL1_GPADC_START_PD_SHIFT 0x04
1803#define PALMAS_PU_PD_INPUT_CTRL1_PWRDOWN_PD 0x04 1803#define PALMAS_PU_PD_INPUT_CTRL1_PWRDOWN_PD 0x04
1804#define PALMAS_PU_PD_INPUT_CTRL1_PWRDOWN_PD_SHIFT 2 1804#define PALMAS_PU_PD_INPUT_CTRL1_PWRDOWN_PD_SHIFT 0x02
1805#define PALMAS_PU_PD_INPUT_CTRL1_NRESWARM_PU 0x02 1805#define PALMAS_PU_PD_INPUT_CTRL1_NRESWARM_PU 0x02
1806#define PALMAS_PU_PD_INPUT_CTRL1_NRESWARM_PU_SHIFT 1 1806#define PALMAS_PU_PD_INPUT_CTRL1_NRESWARM_PU_SHIFT 0x01
1807 1807
1808/* Bit definitions for PU_PD_INPUT_CTRL2 */ 1808/* Bit definitions for PU_PD_INPUT_CTRL2 */
1809#define PALMAS_PU_PD_INPUT_CTRL2_ENABLE2_PU 0x20 1809#define PALMAS_PU_PD_INPUT_CTRL2_ENABLE2_PU 0x20
1810#define PALMAS_PU_PD_INPUT_CTRL2_ENABLE2_PU_SHIFT 5 1810#define PALMAS_PU_PD_INPUT_CTRL2_ENABLE2_PU_SHIFT 0x05
1811#define PALMAS_PU_PD_INPUT_CTRL2_ENABLE2_PD 0x10 1811#define PALMAS_PU_PD_INPUT_CTRL2_ENABLE2_PD 0x10
1812#define PALMAS_PU_PD_INPUT_CTRL2_ENABLE2_PD_SHIFT 4 1812#define PALMAS_PU_PD_INPUT_CTRL2_ENABLE2_PD_SHIFT 0x04
1813#define PALMAS_PU_PD_INPUT_CTRL2_ENABLE1_PU 0x08 1813#define PALMAS_PU_PD_INPUT_CTRL2_ENABLE1_PU 0x08
1814#define PALMAS_PU_PD_INPUT_CTRL2_ENABLE1_PU_SHIFT 3 1814#define PALMAS_PU_PD_INPUT_CTRL2_ENABLE1_PU_SHIFT 0x03
1815#define PALMAS_PU_PD_INPUT_CTRL2_ENABLE1_PD 0x04 1815#define PALMAS_PU_PD_INPUT_CTRL2_ENABLE1_PD 0x04
1816#define PALMAS_PU_PD_INPUT_CTRL2_ENABLE1_PD_SHIFT 2 1816#define PALMAS_PU_PD_INPUT_CTRL2_ENABLE1_PD_SHIFT 0x02
1817#define PALMAS_PU_PD_INPUT_CTRL2_NSLEEP_PU 0x02 1817#define PALMAS_PU_PD_INPUT_CTRL2_NSLEEP_PU 0x02
1818#define PALMAS_PU_PD_INPUT_CTRL2_NSLEEP_PU_SHIFT 1 1818#define PALMAS_PU_PD_INPUT_CTRL2_NSLEEP_PU_SHIFT 0x01
1819#define PALMAS_PU_PD_INPUT_CTRL2_NSLEEP_PD 0x01 1819#define PALMAS_PU_PD_INPUT_CTRL2_NSLEEP_PD 0x01
1820#define PALMAS_PU_PD_INPUT_CTRL2_NSLEEP_PD_SHIFT 0 1820#define PALMAS_PU_PD_INPUT_CTRL2_NSLEEP_PD_SHIFT 0x00
1821 1821
1822/* Bit definitions for PU_PD_INPUT_CTRL3 */ 1822/* Bit definitions for PU_PD_INPUT_CTRL3 */
1823#define PALMAS_PU_PD_INPUT_CTRL3_ACOK_PD 0x40 1823#define PALMAS_PU_PD_INPUT_CTRL3_ACOK_PD 0x40
1824#define PALMAS_PU_PD_INPUT_CTRL3_ACOK_PD_SHIFT 6 1824#define PALMAS_PU_PD_INPUT_CTRL3_ACOK_PD_SHIFT 0x06
1825#define PALMAS_PU_PD_INPUT_CTRL3_CHRG_DET_N_PD 0x10 1825#define PALMAS_PU_PD_INPUT_CTRL3_CHRG_DET_N_PD 0x10
1826#define PALMAS_PU_PD_INPUT_CTRL3_CHRG_DET_N_PD_SHIFT 4 1826#define PALMAS_PU_PD_INPUT_CTRL3_CHRG_DET_N_PD_SHIFT 0x04
1827#define PALMAS_PU_PD_INPUT_CTRL3_POWERHOLD_PD 0x04 1827#define PALMAS_PU_PD_INPUT_CTRL3_POWERHOLD_PD 0x04
1828#define PALMAS_PU_PD_INPUT_CTRL3_POWERHOLD_PD_SHIFT 2 1828#define PALMAS_PU_PD_INPUT_CTRL3_POWERHOLD_PD_SHIFT 0x02
1829#define PALMAS_PU_PD_INPUT_CTRL3_MSECURE_PD 0x01 1829#define PALMAS_PU_PD_INPUT_CTRL3_MSECURE_PD 0x01
1830#define PALMAS_PU_PD_INPUT_CTRL3_MSECURE_PD_SHIFT 0 1830#define PALMAS_PU_PD_INPUT_CTRL3_MSECURE_PD_SHIFT 0x00
1831 1831
1832/* Bit definitions for OD_OUTPUT_CTRL */ 1832/* Bit definitions for OD_OUTPUT_CTRL */
1833#define PALMAS_OD_OUTPUT_CTRL_PWM_2_OD 0x80 1833#define PALMAS_OD_OUTPUT_CTRL_PWM_2_OD 0x80
1834#define PALMAS_OD_OUTPUT_CTRL_PWM_2_OD_SHIFT 7 1834#define PALMAS_OD_OUTPUT_CTRL_PWM_2_OD_SHIFT 0x07
1835#define PALMAS_OD_OUTPUT_CTRL_VBUSDET_OD 0x40 1835#define PALMAS_OD_OUTPUT_CTRL_VBUSDET_OD 0x40
1836#define PALMAS_OD_OUTPUT_CTRL_VBUSDET_OD_SHIFT 6 1836#define PALMAS_OD_OUTPUT_CTRL_VBUSDET_OD_SHIFT 0x06
1837#define PALMAS_OD_OUTPUT_CTRL_PWM_1_OD 0x20 1837#define PALMAS_OD_OUTPUT_CTRL_PWM_1_OD 0x20
1838#define PALMAS_OD_OUTPUT_CTRL_PWM_1_OD_SHIFT 5 1838#define PALMAS_OD_OUTPUT_CTRL_PWM_1_OD_SHIFT 0x05
1839#define PALMAS_OD_OUTPUT_CTRL_INT_OD 0x08 1839#define PALMAS_OD_OUTPUT_CTRL_INT_OD 0x08
1840#define PALMAS_OD_OUTPUT_CTRL_INT_OD_SHIFT 3 1840#define PALMAS_OD_OUTPUT_CTRL_INT_OD_SHIFT 0x03
1841 1841
1842/* Bit definitions for POLARITY_CTRL */ 1842/* Bit definitions for POLARITY_CTRL */
1843#define PALMAS_POLARITY_CTRL_INT_POLARITY 0x80 1843#define PALMAS_POLARITY_CTRL_INT_POLARITY 0x80
1844#define PALMAS_POLARITY_CTRL_INT_POLARITY_SHIFT 7 1844#define PALMAS_POLARITY_CTRL_INT_POLARITY_SHIFT 0x07
1845#define PALMAS_POLARITY_CTRL_ENABLE2_POLARITY 0x40 1845#define PALMAS_POLARITY_CTRL_ENABLE2_POLARITY 0x40
1846#define PALMAS_POLARITY_CTRL_ENABLE2_POLARITY_SHIFT 6 1846#define PALMAS_POLARITY_CTRL_ENABLE2_POLARITY_SHIFT 0x06
1847#define PALMAS_POLARITY_CTRL_ENABLE1_POLARITY 0x20 1847#define PALMAS_POLARITY_CTRL_ENABLE1_POLARITY 0x20
1848#define PALMAS_POLARITY_CTRL_ENABLE1_POLARITY_SHIFT 5 1848#define PALMAS_POLARITY_CTRL_ENABLE1_POLARITY_SHIFT 0x05
1849#define PALMAS_POLARITY_CTRL_NSLEEP_POLARITY 0x10 1849#define PALMAS_POLARITY_CTRL_NSLEEP_POLARITY 0x10
1850#define PALMAS_POLARITY_CTRL_NSLEEP_POLARITY_SHIFT 4 1850#define PALMAS_POLARITY_CTRL_NSLEEP_POLARITY_SHIFT 0x04
1851#define PALMAS_POLARITY_CTRL_RESET_IN_POLARITY 0x08 1851#define PALMAS_POLARITY_CTRL_RESET_IN_POLARITY 0x08
1852#define PALMAS_POLARITY_CTRL_RESET_IN_POLARITY_SHIFT 3 1852#define PALMAS_POLARITY_CTRL_RESET_IN_POLARITY_SHIFT 0x03
1853#define PALMAS_POLARITY_CTRL_GPIO_3_CHRG_DET_N_POLARITY 0x04 1853#define PALMAS_POLARITY_CTRL_GPIO_3_CHRG_DET_N_POLARITY 0x04
1854#define PALMAS_POLARITY_CTRL_GPIO_3_CHRG_DET_N_POLARITY_SHIFT 2 1854#define PALMAS_POLARITY_CTRL_GPIO_3_CHRG_DET_N_POLARITY_SHIFT 0x02
1855#define PALMAS_POLARITY_CTRL_POWERGOOD_USB_PSEL_POLARITY 0x02 1855#define PALMAS_POLARITY_CTRL_POWERGOOD_USB_PSEL_POLARITY 0x02
1856#define PALMAS_POLARITY_CTRL_POWERGOOD_USB_PSEL_POLARITY_SHIFT 1 1856#define PALMAS_POLARITY_CTRL_POWERGOOD_USB_PSEL_POLARITY_SHIFT 0x01
1857#define PALMAS_POLARITY_CTRL_PWRDOWN_POLARITY 0x01 1857#define PALMAS_POLARITY_CTRL_PWRDOWN_POLARITY 0x01
1858#define PALMAS_POLARITY_CTRL_PWRDOWN_POLARITY_SHIFT 0 1858#define PALMAS_POLARITY_CTRL_PWRDOWN_POLARITY_SHIFT 0x00
1859 1859
1860/* Bit definitions for PRIMARY_SECONDARY_PAD1 */ 1860/* Bit definitions for PRIMARY_SECONDARY_PAD1 */
1861#define PALMAS_PRIMARY_SECONDARY_PAD1_GPIO_3 0x80 1861#define PALMAS_PRIMARY_SECONDARY_PAD1_GPIO_3 0x80
1862#define PALMAS_PRIMARY_SECONDARY_PAD1_GPIO_3_SHIFT 7 1862#define PALMAS_PRIMARY_SECONDARY_PAD1_GPIO_3_SHIFT 0x07
1863#define PALMAS_PRIMARY_SECONDARY_PAD1_GPIO_2_MASK 0x60 1863#define PALMAS_PRIMARY_SECONDARY_PAD1_GPIO_2_MASK 0x60
1864#define PALMAS_PRIMARY_SECONDARY_PAD1_GPIO_2_SHIFT 5 1864#define PALMAS_PRIMARY_SECONDARY_PAD1_GPIO_2_SHIFT 0x05
1865#define PALMAS_PRIMARY_SECONDARY_PAD1_GPIO_1_MASK 0x18 1865#define PALMAS_PRIMARY_SECONDARY_PAD1_GPIO_1_MASK 0x18
1866#define PALMAS_PRIMARY_SECONDARY_PAD1_GPIO_1_SHIFT 3 1866#define PALMAS_PRIMARY_SECONDARY_PAD1_GPIO_1_SHIFT 0x03
1867#define PALMAS_PRIMARY_SECONDARY_PAD1_GPIO_0 0x04 1867#define PALMAS_PRIMARY_SECONDARY_PAD1_GPIO_0 0x04
1868#define PALMAS_PRIMARY_SECONDARY_PAD1_GPIO_0_SHIFT 2 1868#define PALMAS_PRIMARY_SECONDARY_PAD1_GPIO_0_SHIFT 0x02
1869#define PALMAS_PRIMARY_SECONDARY_PAD1_VAC 0x02 1869#define PALMAS_PRIMARY_SECONDARY_PAD1_VAC 0x02
1870#define PALMAS_PRIMARY_SECONDARY_PAD1_VAC_SHIFT 1 1870#define PALMAS_PRIMARY_SECONDARY_PAD1_VAC_SHIFT 0x01
1871#define PALMAS_PRIMARY_SECONDARY_PAD1_POWERGOOD 0x01 1871#define PALMAS_PRIMARY_SECONDARY_PAD1_POWERGOOD 0x01
1872#define PALMAS_PRIMARY_SECONDARY_PAD1_POWERGOOD_SHIFT 0 1872#define PALMAS_PRIMARY_SECONDARY_PAD1_POWERGOOD_SHIFT 0x00
1873 1873
1874/* Bit definitions for PRIMARY_SECONDARY_PAD2 */ 1874/* Bit definitions for PRIMARY_SECONDARY_PAD2 */
1875#define PALMAS_PRIMARY_SECONDARY_PAD2_GPIO_7_MASK 0x30 1875#define PALMAS_PRIMARY_SECONDARY_PAD2_GPIO_7_MASK 0x30
1876#define PALMAS_PRIMARY_SECONDARY_PAD2_GPIO_7_SHIFT 4 1876#define PALMAS_PRIMARY_SECONDARY_PAD2_GPIO_7_SHIFT 0x04
1877#define PALMAS_PRIMARY_SECONDARY_PAD2_GPIO_6 0x08 1877#define PALMAS_PRIMARY_SECONDARY_PAD2_GPIO_6 0x08
1878#define PALMAS_PRIMARY_SECONDARY_PAD2_GPIO_6_SHIFT 3 1878#define PALMAS_PRIMARY_SECONDARY_PAD2_GPIO_6_SHIFT 0x03
1879#define PALMAS_PRIMARY_SECONDARY_PAD2_GPIO_5_MASK 0x06 1879#define PALMAS_PRIMARY_SECONDARY_PAD2_GPIO_5_MASK 0x06
1880#define PALMAS_PRIMARY_SECONDARY_PAD2_GPIO_5_SHIFT 1 1880#define PALMAS_PRIMARY_SECONDARY_PAD2_GPIO_5_SHIFT 0x01
1881#define PALMAS_PRIMARY_SECONDARY_PAD2_GPIO_4 0x01 1881#define PALMAS_PRIMARY_SECONDARY_PAD2_GPIO_4 0x01
1882#define PALMAS_PRIMARY_SECONDARY_PAD2_GPIO_4_SHIFT 0 1882#define PALMAS_PRIMARY_SECONDARY_PAD2_GPIO_4_SHIFT 0x00
1883 1883
1884/* Bit definitions for I2C_SPI */ 1884/* Bit definitions for I2C_SPI */
1885#define PALMAS_I2C_SPI_I2C2OTP_EN 0x80 1885#define PALMAS_I2C_SPI_I2C2OTP_EN 0x80
1886#define PALMAS_I2C_SPI_I2C2OTP_EN_SHIFT 7 1886#define PALMAS_I2C_SPI_I2C2OTP_EN_SHIFT 0x07
1887#define PALMAS_I2C_SPI_I2C2OTP_PAGESEL 0x40 1887#define PALMAS_I2C_SPI_I2C2OTP_PAGESEL 0x40
1888#define PALMAS_I2C_SPI_I2C2OTP_PAGESEL_SHIFT 6 1888#define PALMAS_I2C_SPI_I2C2OTP_PAGESEL_SHIFT 0x06
1889#define PALMAS_I2C_SPI_ID_I2C2 0x20 1889#define PALMAS_I2C_SPI_ID_I2C2 0x20
1890#define PALMAS_I2C_SPI_ID_I2C2_SHIFT 5 1890#define PALMAS_I2C_SPI_ID_I2C2_SHIFT 0x05
1891#define PALMAS_I2C_SPI_I2C_SPI 0x10 1891#define PALMAS_I2C_SPI_I2C_SPI 0x10
1892#define PALMAS_I2C_SPI_I2C_SPI_SHIFT 4 1892#define PALMAS_I2C_SPI_I2C_SPI_SHIFT 0x04
1893#define PALMAS_I2C_SPI_ID_I2C1_MASK 0x0f 1893#define PALMAS_I2C_SPI_ID_I2C1_MASK 0x0F
1894#define PALMAS_I2C_SPI_ID_I2C1_SHIFT 0 1894#define PALMAS_I2C_SPI_ID_I2C1_SHIFT 0x00
1895 1895
1896/* Bit definitions for PU_PD_INPUT_CTRL4 */ 1896/* Bit definitions for PU_PD_INPUT_CTRL4 */
1897#define PALMAS_PU_PD_INPUT_CTRL4_DVFS2_DAT_PD 0x40 1897#define PALMAS_PU_PD_INPUT_CTRL4_DVFS2_DAT_PD 0x40
1898#define PALMAS_PU_PD_INPUT_CTRL4_DVFS2_DAT_PD_SHIFT 6 1898#define PALMAS_PU_PD_INPUT_CTRL4_DVFS2_DAT_PD_SHIFT 0x06
1899#define PALMAS_PU_PD_INPUT_CTRL4_DVFS2_CLK_PD 0x10 1899#define PALMAS_PU_PD_INPUT_CTRL4_DVFS2_CLK_PD 0x10
1900#define PALMAS_PU_PD_INPUT_CTRL4_DVFS2_CLK_PD_SHIFT 4 1900#define PALMAS_PU_PD_INPUT_CTRL4_DVFS2_CLK_PD_SHIFT 0x04
1901#define PALMAS_PU_PD_INPUT_CTRL4_DVFS1_DAT_PD 0x04 1901#define PALMAS_PU_PD_INPUT_CTRL4_DVFS1_DAT_PD 0x04
1902#define PALMAS_PU_PD_INPUT_CTRL4_DVFS1_DAT_PD_SHIFT 2 1902#define PALMAS_PU_PD_INPUT_CTRL4_DVFS1_DAT_PD_SHIFT 0x02
1903#define PALMAS_PU_PD_INPUT_CTRL4_DVFS1_CLK_PD 0x01 1903#define PALMAS_PU_PD_INPUT_CTRL4_DVFS1_CLK_PD 0x01
1904#define PALMAS_PU_PD_INPUT_CTRL4_DVFS1_CLK_PD_SHIFT 0 1904#define PALMAS_PU_PD_INPUT_CTRL4_DVFS1_CLK_PD_SHIFT 0x00
1905 1905
1906/* Bit definitions for PRIMARY_SECONDARY_PAD3 */ 1906/* Bit definitions for PRIMARY_SECONDARY_PAD3 */
1907#define PALMAS_PRIMARY_SECONDARY_PAD3_DVFS2 0x02 1907#define PALMAS_PRIMARY_SECONDARY_PAD3_DVFS2 0x02
1908#define PALMAS_PRIMARY_SECONDARY_PAD3_DVFS2_SHIFT 1 1908#define PALMAS_PRIMARY_SECONDARY_PAD3_DVFS2_SHIFT 0x01
1909#define PALMAS_PRIMARY_SECONDARY_PAD3_DVFS1 0x01 1909#define PALMAS_PRIMARY_SECONDARY_PAD3_DVFS1 0x01
1910#define PALMAS_PRIMARY_SECONDARY_PAD3_DVFS1_SHIFT 0 1910#define PALMAS_PRIMARY_SECONDARY_PAD3_DVFS1_SHIFT 0x00
1911 1911
1912/* Registers for function LED_PWM */ 1912/* Registers for function LED_PWM */
1913#define PALMAS_LED_PERIOD_CTRL 0x0 1913#define PALMAS_LED_PERIOD_CTRL 0x00
1914#define PALMAS_LED_CTRL 0x1 1914#define PALMAS_LED_CTRL 0x01
1915#define PALMAS_PWM_CTRL1 0x2 1915#define PALMAS_PWM_CTRL1 0x02
1916#define PALMAS_PWM_CTRL2 0x3 1916#define PALMAS_PWM_CTRL2 0x03
1917 1917
1918/* Bit definitions for LED_PERIOD_CTRL */ 1918/* Bit definitions for LED_PERIOD_CTRL */
1919#define PALMAS_LED_PERIOD_CTRL_LED_2_PERIOD_MASK 0x38 1919#define PALMAS_LED_PERIOD_CTRL_LED_2_PERIOD_MASK 0x38
1920#define PALMAS_LED_PERIOD_CTRL_LED_2_PERIOD_SHIFT 3 1920#define PALMAS_LED_PERIOD_CTRL_LED_2_PERIOD_SHIFT 0x03
1921#define PALMAS_LED_PERIOD_CTRL_LED_1_PERIOD_MASK 0x07 1921#define PALMAS_LED_PERIOD_CTRL_LED_1_PERIOD_MASK 0x07
1922#define PALMAS_LED_PERIOD_CTRL_LED_1_PERIOD_SHIFT 0 1922#define PALMAS_LED_PERIOD_CTRL_LED_1_PERIOD_SHIFT 0x00
1923 1923
1924/* Bit definitions for LED_CTRL */ 1924/* Bit definitions for LED_CTRL */
1925#define PALMAS_LED_CTRL_LED_2_SEQ 0x20 1925#define PALMAS_LED_CTRL_LED_2_SEQ 0x20
1926#define PALMAS_LED_CTRL_LED_2_SEQ_SHIFT 5 1926#define PALMAS_LED_CTRL_LED_2_SEQ_SHIFT 0x05
1927#define PALMAS_LED_CTRL_LED_1_SEQ 0x10 1927#define PALMAS_LED_CTRL_LED_1_SEQ 0x10
1928#define PALMAS_LED_CTRL_LED_1_SEQ_SHIFT 4 1928#define PALMAS_LED_CTRL_LED_1_SEQ_SHIFT 0x04
1929#define PALMAS_LED_CTRL_LED_2_ON_TIME_MASK 0x0c 1929#define PALMAS_LED_CTRL_LED_2_ON_TIME_MASK 0x0c
1930#define PALMAS_LED_CTRL_LED_2_ON_TIME_SHIFT 2 1930#define PALMAS_LED_CTRL_LED_2_ON_TIME_SHIFT 0x02
1931#define PALMAS_LED_CTRL_LED_1_ON_TIME_MASK 0x03 1931#define PALMAS_LED_CTRL_LED_1_ON_TIME_MASK 0x03
1932#define PALMAS_LED_CTRL_LED_1_ON_TIME_SHIFT 0 1932#define PALMAS_LED_CTRL_LED_1_ON_TIME_SHIFT 0x00
1933 1933
1934/* Bit definitions for PWM_CTRL1 */ 1934/* Bit definitions for PWM_CTRL1 */
1935#define PALMAS_PWM_CTRL1_PWM_FREQ_EN 0x02 1935#define PALMAS_PWM_CTRL1_PWM_FREQ_EN 0x02
1936#define PALMAS_PWM_CTRL1_PWM_FREQ_EN_SHIFT 1 1936#define PALMAS_PWM_CTRL1_PWM_FREQ_EN_SHIFT 0x01
1937#define PALMAS_PWM_CTRL1_PWM_FREQ_SEL 0x01 1937#define PALMAS_PWM_CTRL1_PWM_FREQ_SEL 0x01
1938#define PALMAS_PWM_CTRL1_PWM_FREQ_SEL_SHIFT 0 1938#define PALMAS_PWM_CTRL1_PWM_FREQ_SEL_SHIFT 0x00
1939 1939
1940/* Bit definitions for PWM_CTRL2 */ 1940/* Bit definitions for PWM_CTRL2 */
1941#define PALMAS_PWM_CTRL2_PWM_DUTY_SEL_MASK 0xff 1941#define PALMAS_PWM_CTRL2_PWM_DUTY_SEL_MASK 0xFF
1942#define PALMAS_PWM_CTRL2_PWM_DUTY_SEL_SHIFT 0 1942#define PALMAS_PWM_CTRL2_PWM_DUTY_SEL_SHIFT 0x00
1943 1943
1944/* Registers for function INTERRUPT */ 1944/* Registers for function INTERRUPT */
1945#define PALMAS_INT1_STATUS 0x0 1945#define PALMAS_INT1_STATUS 0x00
1946#define PALMAS_INT1_MASK 0x1 1946#define PALMAS_INT1_MASK 0x01
1947#define PALMAS_INT1_LINE_STATE 0x2 1947#define PALMAS_INT1_LINE_STATE 0x02
1948#define PALMAS_INT1_EDGE_DETECT1_RESERVED 0x3 1948#define PALMAS_INT1_EDGE_DETECT1_RESERVED 0x03
1949#define PALMAS_INT1_EDGE_DETECT2_RESERVED 0x4 1949#define PALMAS_INT1_EDGE_DETECT2_RESERVED 0x04
1950#define PALMAS_INT2_STATUS 0x5 1950#define PALMAS_INT2_STATUS 0x05
1951#define PALMAS_INT2_MASK 0x6 1951#define PALMAS_INT2_MASK 0x06
1952#define PALMAS_INT2_LINE_STATE 0x7 1952#define PALMAS_INT2_LINE_STATE 0x07
1953#define PALMAS_INT2_EDGE_DETECT1_RESERVED 0x8 1953#define PALMAS_INT2_EDGE_DETECT1_RESERVED 0x08
1954#define PALMAS_INT2_EDGE_DETECT2_RESERVED 0x9 1954#define PALMAS_INT2_EDGE_DETECT2_RESERVED 0x09
1955#define PALMAS_INT3_STATUS 0xA 1955#define PALMAS_INT3_STATUS 0x0A
1956#define PALMAS_INT3_MASK 0xB 1956#define PALMAS_INT3_MASK 0x0B
1957#define PALMAS_INT3_LINE_STATE 0xC 1957#define PALMAS_INT3_LINE_STATE 0x0C
1958#define PALMAS_INT3_EDGE_DETECT1_RESERVED 0xD 1958#define PALMAS_INT3_EDGE_DETECT1_RESERVED 0x0D
1959#define PALMAS_INT3_EDGE_DETECT2_RESERVED 0xE 1959#define PALMAS_INT3_EDGE_DETECT2_RESERVED 0x0E
1960#define PALMAS_INT4_STATUS 0xF 1960#define PALMAS_INT4_STATUS 0x0F
1961#define PALMAS_INT4_MASK 0x10 1961#define PALMAS_INT4_MASK 0x10
1962#define PALMAS_INT4_LINE_STATE 0x11 1962#define PALMAS_INT4_LINE_STATE 0x11
1963#define PALMAS_INT4_EDGE_DETECT1 0x12 1963#define PALMAS_INT4_EDGE_DETECT1 0x12
@@ -1966,276 +1966,276 @@ enum usb_irq_events {
1966 1966
1967/* Bit definitions for INT1_STATUS */ 1967/* Bit definitions for INT1_STATUS */
1968#define PALMAS_INT1_STATUS_VBAT_MON 0x80 1968#define PALMAS_INT1_STATUS_VBAT_MON 0x80
1969#define PALMAS_INT1_STATUS_VBAT_MON_SHIFT 7 1969#define PALMAS_INT1_STATUS_VBAT_MON_SHIFT 0x07
1970#define PALMAS_INT1_STATUS_VSYS_MON 0x40 1970#define PALMAS_INT1_STATUS_VSYS_MON 0x40
1971#define PALMAS_INT1_STATUS_VSYS_MON_SHIFT 6 1971#define PALMAS_INT1_STATUS_VSYS_MON_SHIFT 0x06
1972#define PALMAS_INT1_STATUS_HOTDIE 0x20 1972#define PALMAS_INT1_STATUS_HOTDIE 0x20
1973#define PALMAS_INT1_STATUS_HOTDIE_SHIFT 5 1973#define PALMAS_INT1_STATUS_HOTDIE_SHIFT 0x05
1974#define PALMAS_INT1_STATUS_PWRDOWN 0x10 1974#define PALMAS_INT1_STATUS_PWRDOWN 0x10
1975#define PALMAS_INT1_STATUS_PWRDOWN_SHIFT 4 1975#define PALMAS_INT1_STATUS_PWRDOWN_SHIFT 0x04
1976#define PALMAS_INT1_STATUS_RPWRON 0x08 1976#define PALMAS_INT1_STATUS_RPWRON 0x08
1977#define PALMAS_INT1_STATUS_RPWRON_SHIFT 3 1977#define PALMAS_INT1_STATUS_RPWRON_SHIFT 0x03
1978#define PALMAS_INT1_STATUS_LONG_PRESS_KEY 0x04 1978#define PALMAS_INT1_STATUS_LONG_PRESS_KEY 0x04
1979#define PALMAS_INT1_STATUS_LONG_PRESS_KEY_SHIFT 2 1979#define PALMAS_INT1_STATUS_LONG_PRESS_KEY_SHIFT 0x02
1980#define PALMAS_INT1_STATUS_PWRON 0x02 1980#define PALMAS_INT1_STATUS_PWRON 0x02
1981#define PALMAS_INT1_STATUS_PWRON_SHIFT 1 1981#define PALMAS_INT1_STATUS_PWRON_SHIFT 0x01
1982#define PALMAS_INT1_STATUS_CHARG_DET_N_VBUS_OVV 0x01 1982#define PALMAS_INT1_STATUS_CHARG_DET_N_VBUS_OVV 0x01
1983#define PALMAS_INT1_STATUS_CHARG_DET_N_VBUS_OVV_SHIFT 0 1983#define PALMAS_INT1_STATUS_CHARG_DET_N_VBUS_OVV_SHIFT 0x00
1984 1984
1985/* Bit definitions for INT1_MASK */ 1985/* Bit definitions for INT1_MASK */
1986#define PALMAS_INT1_MASK_VBAT_MON 0x80 1986#define PALMAS_INT1_MASK_VBAT_MON 0x80
1987#define PALMAS_INT1_MASK_VBAT_MON_SHIFT 7 1987#define PALMAS_INT1_MASK_VBAT_MON_SHIFT 0x07
1988#define PALMAS_INT1_MASK_VSYS_MON 0x40 1988#define PALMAS_INT1_MASK_VSYS_MON 0x40
1989#define PALMAS_INT1_MASK_VSYS_MON_SHIFT 6 1989#define PALMAS_INT1_MASK_VSYS_MON_SHIFT 0x06
1990#define PALMAS_INT1_MASK_HOTDIE 0x20 1990#define PALMAS_INT1_MASK_HOTDIE 0x20
1991#define PALMAS_INT1_MASK_HOTDIE_SHIFT 5 1991#define PALMAS_INT1_MASK_HOTDIE_SHIFT 0x05
1992#define PALMAS_INT1_MASK_PWRDOWN 0x10 1992#define PALMAS_INT1_MASK_PWRDOWN 0x10
1993#define PALMAS_INT1_MASK_PWRDOWN_SHIFT 4 1993#define PALMAS_INT1_MASK_PWRDOWN_SHIFT 0x04
1994#define PALMAS_INT1_MASK_RPWRON 0x08 1994#define PALMAS_INT1_MASK_RPWRON 0x08
1995#define PALMAS_INT1_MASK_RPWRON_SHIFT 3 1995#define PALMAS_INT1_MASK_RPWRON_SHIFT 0x03
1996#define PALMAS_INT1_MASK_LONG_PRESS_KEY 0x04 1996#define PALMAS_INT1_MASK_LONG_PRESS_KEY 0x04
1997#define PALMAS_INT1_MASK_LONG_PRESS_KEY_SHIFT 2 1997#define PALMAS_INT1_MASK_LONG_PRESS_KEY_SHIFT 0x02
1998#define PALMAS_INT1_MASK_PWRON 0x02 1998#define PALMAS_INT1_MASK_PWRON 0x02
1999#define PALMAS_INT1_MASK_PWRON_SHIFT 1 1999#define PALMAS_INT1_MASK_PWRON_SHIFT 0x01
2000#define PALMAS_INT1_MASK_CHARG_DET_N_VBUS_OVV 0x01 2000#define PALMAS_INT1_MASK_CHARG_DET_N_VBUS_OVV 0x01
2001#define PALMAS_INT1_MASK_CHARG_DET_N_VBUS_OVV_SHIFT 0 2001#define PALMAS_INT1_MASK_CHARG_DET_N_VBUS_OVV_SHIFT 0x00
2002 2002
2003/* Bit definitions for INT1_LINE_STATE */ 2003/* Bit definitions for INT1_LINE_STATE */
2004#define PALMAS_INT1_LINE_STATE_VBAT_MON 0x80 2004#define PALMAS_INT1_LINE_STATE_VBAT_MON 0x80
2005#define PALMAS_INT1_LINE_STATE_VBAT_MON_SHIFT 7 2005#define PALMAS_INT1_LINE_STATE_VBAT_MON_SHIFT 0x07
2006#define PALMAS_INT1_LINE_STATE_VSYS_MON 0x40 2006#define PALMAS_INT1_LINE_STATE_VSYS_MON 0x40
2007#define PALMAS_INT1_LINE_STATE_VSYS_MON_SHIFT 6 2007#define PALMAS_INT1_LINE_STATE_VSYS_MON_SHIFT 0x06
2008#define PALMAS_INT1_LINE_STATE_HOTDIE 0x20 2008#define PALMAS_INT1_LINE_STATE_HOTDIE 0x20
2009#define PALMAS_INT1_LINE_STATE_HOTDIE_SHIFT 5 2009#define PALMAS_INT1_LINE_STATE_HOTDIE_SHIFT 0x05
2010#define PALMAS_INT1_LINE_STATE_PWRDOWN 0x10 2010#define PALMAS_INT1_LINE_STATE_PWRDOWN 0x10
2011#define PALMAS_INT1_LINE_STATE_PWRDOWN_SHIFT 4 2011#define PALMAS_INT1_LINE_STATE_PWRDOWN_SHIFT 0x04
2012#define PALMAS_INT1_LINE_STATE_RPWRON 0x08 2012#define PALMAS_INT1_LINE_STATE_RPWRON 0x08
2013#define PALMAS_INT1_LINE_STATE_RPWRON_SHIFT 3 2013#define PALMAS_INT1_LINE_STATE_RPWRON_SHIFT 0x03
2014#define PALMAS_INT1_LINE_STATE_LONG_PRESS_KEY 0x04 2014#define PALMAS_INT1_LINE_STATE_LONG_PRESS_KEY 0x04
2015#define PALMAS_INT1_LINE_STATE_LONG_PRESS_KEY_SHIFT 2 2015#define PALMAS_INT1_LINE_STATE_LONG_PRESS_KEY_SHIFT 0x02
2016#define PALMAS_INT1_LINE_STATE_PWRON 0x02 2016#define PALMAS_INT1_LINE_STATE_PWRON 0x02
2017#define PALMAS_INT1_LINE_STATE_PWRON_SHIFT 1 2017#define PALMAS_INT1_LINE_STATE_PWRON_SHIFT 0x01
2018#define PALMAS_INT1_LINE_STATE_CHARG_DET_N_VBUS_OVV 0x01 2018#define PALMAS_INT1_LINE_STATE_CHARG_DET_N_VBUS_OVV 0x01
2019#define PALMAS_INT1_LINE_STATE_CHARG_DET_N_VBUS_OVV_SHIFT 0 2019#define PALMAS_INT1_LINE_STATE_CHARG_DET_N_VBUS_OVV_SHIFT 0x00
2020 2020
2021/* Bit definitions for INT2_STATUS */ 2021/* Bit definitions for INT2_STATUS */
2022#define PALMAS_INT2_STATUS_VAC_ACOK 0x80 2022#define PALMAS_INT2_STATUS_VAC_ACOK 0x80
2023#define PALMAS_INT2_STATUS_VAC_ACOK_SHIFT 7 2023#define PALMAS_INT2_STATUS_VAC_ACOK_SHIFT 0x07
2024#define PALMAS_INT2_STATUS_SHORT 0x40 2024#define PALMAS_INT2_STATUS_SHORT 0x40
2025#define PALMAS_INT2_STATUS_SHORT_SHIFT 6 2025#define PALMAS_INT2_STATUS_SHORT_SHIFT 0x06
2026#define PALMAS_INT2_STATUS_FBI_BB 0x20 2026#define PALMAS_INT2_STATUS_FBI_BB 0x20
2027#define PALMAS_INT2_STATUS_FBI_BB_SHIFT 5 2027#define PALMAS_INT2_STATUS_FBI_BB_SHIFT 0x05
2028#define PALMAS_INT2_STATUS_RESET_IN 0x10 2028#define PALMAS_INT2_STATUS_RESET_IN 0x10
2029#define PALMAS_INT2_STATUS_RESET_IN_SHIFT 4 2029#define PALMAS_INT2_STATUS_RESET_IN_SHIFT 0x04
2030#define PALMAS_INT2_STATUS_BATREMOVAL 0x08 2030#define PALMAS_INT2_STATUS_BATREMOVAL 0x08
2031#define PALMAS_INT2_STATUS_BATREMOVAL_SHIFT 3 2031#define PALMAS_INT2_STATUS_BATREMOVAL_SHIFT 0x03
2032#define PALMAS_INT2_STATUS_WDT 0x04 2032#define PALMAS_INT2_STATUS_WDT 0x04
2033#define PALMAS_INT2_STATUS_WDT_SHIFT 2 2033#define PALMAS_INT2_STATUS_WDT_SHIFT 0x02
2034#define PALMAS_INT2_STATUS_RTC_TIMER 0x02 2034#define PALMAS_INT2_STATUS_RTC_TIMER 0x02
2035#define PALMAS_INT2_STATUS_RTC_TIMER_SHIFT 1 2035#define PALMAS_INT2_STATUS_RTC_TIMER_SHIFT 0x01
2036#define PALMAS_INT2_STATUS_RTC_ALARM 0x01 2036#define PALMAS_INT2_STATUS_RTC_ALARM 0x01
2037#define PALMAS_INT2_STATUS_RTC_ALARM_SHIFT 0 2037#define PALMAS_INT2_STATUS_RTC_ALARM_SHIFT 0x00
2038 2038
2039/* Bit definitions for INT2_MASK */ 2039/* Bit definitions for INT2_MASK */
2040#define PALMAS_INT2_MASK_VAC_ACOK 0x80 2040#define PALMAS_INT2_MASK_VAC_ACOK 0x80
2041#define PALMAS_INT2_MASK_VAC_ACOK_SHIFT 7 2041#define PALMAS_INT2_MASK_VAC_ACOK_SHIFT 0x07
2042#define PALMAS_INT2_MASK_SHORT 0x40 2042#define PALMAS_INT2_MASK_SHORT 0x40
2043#define PALMAS_INT2_MASK_SHORT_SHIFT 6 2043#define PALMAS_INT2_MASK_SHORT_SHIFT 0x06
2044#define PALMAS_INT2_MASK_FBI_BB 0x20 2044#define PALMAS_INT2_MASK_FBI_BB 0x20
2045#define PALMAS_INT2_MASK_FBI_BB_SHIFT 5 2045#define PALMAS_INT2_MASK_FBI_BB_SHIFT 0x05
2046#define PALMAS_INT2_MASK_RESET_IN 0x10 2046#define PALMAS_INT2_MASK_RESET_IN 0x10
2047#define PALMAS_INT2_MASK_RESET_IN_SHIFT 4 2047#define PALMAS_INT2_MASK_RESET_IN_SHIFT 0x04
2048#define PALMAS_INT2_MASK_BATREMOVAL 0x08 2048#define PALMAS_INT2_MASK_BATREMOVAL 0x08
2049#define PALMAS_INT2_MASK_BATREMOVAL_SHIFT 3 2049#define PALMAS_INT2_MASK_BATREMOVAL_SHIFT 0x03
2050#define PALMAS_INT2_MASK_WDT 0x04 2050#define PALMAS_INT2_MASK_WDT 0x04
2051#define PALMAS_INT2_MASK_WDT_SHIFT 2 2051#define PALMAS_INT2_MASK_WDT_SHIFT 0x02
2052#define PALMAS_INT2_MASK_RTC_TIMER 0x02 2052#define PALMAS_INT2_MASK_RTC_TIMER 0x02
2053#define PALMAS_INT2_MASK_RTC_TIMER_SHIFT 1 2053#define PALMAS_INT2_MASK_RTC_TIMER_SHIFT 0x01
2054#define PALMAS_INT2_MASK_RTC_ALARM 0x01 2054#define PALMAS_INT2_MASK_RTC_ALARM 0x01
2055#define PALMAS_INT2_MASK_RTC_ALARM_SHIFT 0 2055#define PALMAS_INT2_MASK_RTC_ALARM_SHIFT 0x00
2056 2056
2057/* Bit definitions for INT2_LINE_STATE */ 2057/* Bit definitions for INT2_LINE_STATE */
2058#define PALMAS_INT2_LINE_STATE_VAC_ACOK 0x80 2058#define PALMAS_INT2_LINE_STATE_VAC_ACOK 0x80
2059#define PALMAS_INT2_LINE_STATE_VAC_ACOK_SHIFT 7 2059#define PALMAS_INT2_LINE_STATE_VAC_ACOK_SHIFT 0x07
2060#define PALMAS_INT2_LINE_STATE_SHORT 0x40 2060#define PALMAS_INT2_LINE_STATE_SHORT 0x40
2061#define PALMAS_INT2_LINE_STATE_SHORT_SHIFT 6 2061#define PALMAS_INT2_LINE_STATE_SHORT_SHIFT 0x06
2062#define PALMAS_INT2_LINE_STATE_FBI_BB 0x20 2062#define PALMAS_INT2_LINE_STATE_FBI_BB 0x20
2063#define PALMAS_INT2_LINE_STATE_FBI_BB_SHIFT 5 2063#define PALMAS_INT2_LINE_STATE_FBI_BB_SHIFT 0x05
2064#define PALMAS_INT2_LINE_STATE_RESET_IN 0x10 2064#define PALMAS_INT2_LINE_STATE_RESET_IN 0x10
2065#define PALMAS_INT2_LINE_STATE_RESET_IN_SHIFT 4 2065#define PALMAS_INT2_LINE_STATE_RESET_IN_SHIFT 0x04
2066#define PALMAS_INT2_LINE_STATE_BATREMOVAL 0x08 2066#define PALMAS_INT2_LINE_STATE_BATREMOVAL 0x08
2067#define PALMAS_INT2_LINE_STATE_BATREMOVAL_SHIFT 3 2067#define PALMAS_INT2_LINE_STATE_BATREMOVAL_SHIFT 0x03
2068#define PALMAS_INT2_LINE_STATE_WDT 0x04 2068#define PALMAS_INT2_LINE_STATE_WDT 0x04
2069#define PALMAS_INT2_LINE_STATE_WDT_SHIFT 2 2069#define PALMAS_INT2_LINE_STATE_WDT_SHIFT 0x02
2070#define PALMAS_INT2_LINE_STATE_RTC_TIMER 0x02 2070#define PALMAS_INT2_LINE_STATE_RTC_TIMER 0x02
2071#define PALMAS_INT2_LINE_STATE_RTC_TIMER_SHIFT 1 2071#define PALMAS_INT2_LINE_STATE_RTC_TIMER_SHIFT 0x01
2072#define PALMAS_INT2_LINE_STATE_RTC_ALARM 0x01 2072#define PALMAS_INT2_LINE_STATE_RTC_ALARM 0x01
2073#define PALMAS_INT2_LINE_STATE_RTC_ALARM_SHIFT 0 2073#define PALMAS_INT2_LINE_STATE_RTC_ALARM_SHIFT 0x00
2074 2074
2075/* Bit definitions for INT3_STATUS */ 2075/* Bit definitions for INT3_STATUS */
2076#define PALMAS_INT3_STATUS_VBUS 0x80 2076#define PALMAS_INT3_STATUS_VBUS 0x80
2077#define PALMAS_INT3_STATUS_VBUS_SHIFT 7 2077#define PALMAS_INT3_STATUS_VBUS_SHIFT 0x07
2078#define PALMAS_INT3_STATUS_VBUS_OTG 0x40 2078#define PALMAS_INT3_STATUS_VBUS_OTG 0x40
2079#define PALMAS_INT3_STATUS_VBUS_OTG_SHIFT 6 2079#define PALMAS_INT3_STATUS_VBUS_OTG_SHIFT 0x06
2080#define PALMAS_INT3_STATUS_ID 0x20 2080#define PALMAS_INT3_STATUS_ID 0x20
2081#define PALMAS_INT3_STATUS_ID_SHIFT 5 2081#define PALMAS_INT3_STATUS_ID_SHIFT 0x05
2082#define PALMAS_INT3_STATUS_ID_OTG 0x10 2082#define PALMAS_INT3_STATUS_ID_OTG 0x10
2083#define PALMAS_INT3_STATUS_ID_OTG_SHIFT 4 2083#define PALMAS_INT3_STATUS_ID_OTG_SHIFT 0x04
2084#define PALMAS_INT3_STATUS_GPADC_EOC_RT 0x08 2084#define PALMAS_INT3_STATUS_GPADC_EOC_RT 0x08
2085#define PALMAS_INT3_STATUS_GPADC_EOC_RT_SHIFT 3 2085#define PALMAS_INT3_STATUS_GPADC_EOC_RT_SHIFT 0x03
2086#define PALMAS_INT3_STATUS_GPADC_EOC_SW 0x04 2086#define PALMAS_INT3_STATUS_GPADC_EOC_SW 0x04
2087#define PALMAS_INT3_STATUS_GPADC_EOC_SW_SHIFT 2 2087#define PALMAS_INT3_STATUS_GPADC_EOC_SW_SHIFT 0x02
2088#define PALMAS_INT3_STATUS_GPADC_AUTO_1 0x02 2088#define PALMAS_INT3_STATUS_GPADC_AUTO_1 0x02
2089#define PALMAS_INT3_STATUS_GPADC_AUTO_1_SHIFT 1 2089#define PALMAS_INT3_STATUS_GPADC_AUTO_1_SHIFT 0x01
2090#define PALMAS_INT3_STATUS_GPADC_AUTO_0 0x01 2090#define PALMAS_INT3_STATUS_GPADC_AUTO_0 0x01
2091#define PALMAS_INT3_STATUS_GPADC_AUTO_0_SHIFT 0 2091#define PALMAS_INT3_STATUS_GPADC_AUTO_0_SHIFT 0x00
2092 2092
2093/* Bit definitions for INT3_MASK */ 2093/* Bit definitions for INT3_MASK */
2094#define PALMAS_INT3_MASK_VBUS 0x80 2094#define PALMAS_INT3_MASK_VBUS 0x80
2095#define PALMAS_INT3_MASK_VBUS_SHIFT 7 2095#define PALMAS_INT3_MASK_VBUS_SHIFT 0x07
2096#define PALMAS_INT3_MASK_VBUS_OTG 0x40 2096#define PALMAS_INT3_MASK_VBUS_OTG 0x40
2097#define PALMAS_INT3_MASK_VBUS_OTG_SHIFT 6 2097#define PALMAS_INT3_MASK_VBUS_OTG_SHIFT 0x06
2098#define PALMAS_INT3_MASK_ID 0x20 2098#define PALMAS_INT3_MASK_ID 0x20
2099#define PALMAS_INT3_MASK_ID_SHIFT 5 2099#define PALMAS_INT3_MASK_ID_SHIFT 0x05
2100#define PALMAS_INT3_MASK_ID_OTG 0x10 2100#define PALMAS_INT3_MASK_ID_OTG 0x10
2101#define PALMAS_INT3_MASK_ID_OTG_SHIFT 4 2101#define PALMAS_INT3_MASK_ID_OTG_SHIFT 0x04
2102#define PALMAS_INT3_MASK_GPADC_EOC_RT 0x08 2102#define PALMAS_INT3_MASK_GPADC_EOC_RT 0x08
2103#define PALMAS_INT3_MASK_GPADC_EOC_RT_SHIFT 3 2103#define PALMAS_INT3_MASK_GPADC_EOC_RT_SHIFT 0x03
2104#define PALMAS_INT3_MASK_GPADC_EOC_SW 0x04 2104#define PALMAS_INT3_MASK_GPADC_EOC_SW 0x04
2105#define PALMAS_INT3_MASK_GPADC_EOC_SW_SHIFT 2 2105#define PALMAS_INT3_MASK_GPADC_EOC_SW_SHIFT 0x02
2106#define PALMAS_INT3_MASK_GPADC_AUTO_1 0x02 2106#define PALMAS_INT3_MASK_GPADC_AUTO_1 0x02
2107#define PALMAS_INT3_MASK_GPADC_AUTO_1_SHIFT 1 2107#define PALMAS_INT3_MASK_GPADC_AUTO_1_SHIFT 0x01
2108#define PALMAS_INT3_MASK_GPADC_AUTO_0 0x01 2108#define PALMAS_INT3_MASK_GPADC_AUTO_0 0x01
2109#define PALMAS_INT3_MASK_GPADC_AUTO_0_SHIFT 0 2109#define PALMAS_INT3_MASK_GPADC_AUTO_0_SHIFT 0x00
2110 2110
2111/* Bit definitions for INT3_LINE_STATE */ 2111/* Bit definitions for INT3_LINE_STATE */
2112#define PALMAS_INT3_LINE_STATE_VBUS 0x80 2112#define PALMAS_INT3_LINE_STATE_VBUS 0x80
2113#define PALMAS_INT3_LINE_STATE_VBUS_SHIFT 7 2113#define PALMAS_INT3_LINE_STATE_VBUS_SHIFT 0x07
2114#define PALMAS_INT3_LINE_STATE_VBUS_OTG 0x40 2114#define PALMAS_INT3_LINE_STATE_VBUS_OTG 0x40
2115#define PALMAS_INT3_LINE_STATE_VBUS_OTG_SHIFT 6 2115#define PALMAS_INT3_LINE_STATE_VBUS_OTG_SHIFT 0x06
2116#define PALMAS_INT3_LINE_STATE_ID 0x20 2116#define PALMAS_INT3_LINE_STATE_ID 0x20
2117#define PALMAS_INT3_LINE_STATE_ID_SHIFT 5 2117#define PALMAS_INT3_LINE_STATE_ID_SHIFT 0x05
2118#define PALMAS_INT3_LINE_STATE_ID_OTG 0x10 2118#define PALMAS_INT3_LINE_STATE_ID_OTG 0x10
2119#define PALMAS_INT3_LINE_STATE_ID_OTG_SHIFT 4 2119#define PALMAS_INT3_LINE_STATE_ID_OTG_SHIFT 0x04
2120#define PALMAS_INT3_LINE_STATE_GPADC_EOC_RT 0x08 2120#define PALMAS_INT3_LINE_STATE_GPADC_EOC_RT 0x08
2121#define PALMAS_INT3_LINE_STATE_GPADC_EOC_RT_SHIFT 3 2121#define PALMAS_INT3_LINE_STATE_GPADC_EOC_RT_SHIFT 0x03
2122#define PALMAS_INT3_LINE_STATE_GPADC_EOC_SW 0x04 2122#define PALMAS_INT3_LINE_STATE_GPADC_EOC_SW 0x04
2123#define PALMAS_INT3_LINE_STATE_GPADC_EOC_SW_SHIFT 2 2123#define PALMAS_INT3_LINE_STATE_GPADC_EOC_SW_SHIFT 0x02
2124#define PALMAS_INT3_LINE_STATE_GPADC_AUTO_1 0x02 2124#define PALMAS_INT3_LINE_STATE_GPADC_AUTO_1 0x02
2125#define PALMAS_INT3_LINE_STATE_GPADC_AUTO_1_SHIFT 1 2125#define PALMAS_INT3_LINE_STATE_GPADC_AUTO_1_SHIFT 0x01
2126#define PALMAS_INT3_LINE_STATE_GPADC_AUTO_0 0x01 2126#define PALMAS_INT3_LINE_STATE_GPADC_AUTO_0 0x01
2127#define PALMAS_INT3_LINE_STATE_GPADC_AUTO_0_SHIFT 0 2127#define PALMAS_INT3_LINE_STATE_GPADC_AUTO_0_SHIFT 0x00
2128 2128
2129/* Bit definitions for INT4_STATUS */ 2129/* Bit definitions for INT4_STATUS */
2130#define PALMAS_INT4_STATUS_GPIO_7 0x80 2130#define PALMAS_INT4_STATUS_GPIO_7 0x80
2131#define PALMAS_INT4_STATUS_GPIO_7_SHIFT 7 2131#define PALMAS_INT4_STATUS_GPIO_7_SHIFT 0x07
2132#define PALMAS_INT4_STATUS_GPIO_6 0x40 2132#define PALMAS_INT4_STATUS_GPIO_6 0x40
2133#define PALMAS_INT4_STATUS_GPIO_6_SHIFT 6 2133#define PALMAS_INT4_STATUS_GPIO_6_SHIFT 0x06
2134#define PALMAS_INT4_STATUS_GPIO_5 0x20 2134#define PALMAS_INT4_STATUS_GPIO_5 0x20
2135#define PALMAS_INT4_STATUS_GPIO_5_SHIFT 5 2135#define PALMAS_INT4_STATUS_GPIO_5_SHIFT 0x05
2136#define PALMAS_INT4_STATUS_GPIO_4 0x10 2136#define PALMAS_INT4_STATUS_GPIO_4 0x10
2137#define PALMAS_INT4_STATUS_GPIO_4_SHIFT 4 2137#define PALMAS_INT4_STATUS_GPIO_4_SHIFT 0x04
2138#define PALMAS_INT4_STATUS_GPIO_3 0x08 2138#define PALMAS_INT4_STATUS_GPIO_3 0x08
2139#define PALMAS_INT4_STATUS_GPIO_3_SHIFT 3 2139#define PALMAS_INT4_STATUS_GPIO_3_SHIFT 0x03
2140#define PALMAS_INT4_STATUS_GPIO_2 0x04 2140#define PALMAS_INT4_STATUS_GPIO_2 0x04
2141#define PALMAS_INT4_STATUS_GPIO_2_SHIFT 2 2141#define PALMAS_INT4_STATUS_GPIO_2_SHIFT 0x02
2142#define PALMAS_INT4_STATUS_GPIO_1 0x02 2142#define PALMAS_INT4_STATUS_GPIO_1 0x02
2143#define PALMAS_INT4_STATUS_GPIO_1_SHIFT 1 2143#define PALMAS_INT4_STATUS_GPIO_1_SHIFT 0x01
2144#define PALMAS_INT4_STATUS_GPIO_0 0x01 2144#define PALMAS_INT4_STATUS_GPIO_0 0x01
2145#define PALMAS_INT4_STATUS_GPIO_0_SHIFT 0 2145#define PALMAS_INT4_STATUS_GPIO_0_SHIFT 0x00
2146 2146
2147/* Bit definitions for INT4_MASK */ 2147/* Bit definitions for INT4_MASK */
2148#define PALMAS_INT4_MASK_GPIO_7 0x80 2148#define PALMAS_INT4_MASK_GPIO_7 0x80
2149#define PALMAS_INT4_MASK_GPIO_7_SHIFT 7 2149#define PALMAS_INT4_MASK_GPIO_7_SHIFT 0x07
2150#define PALMAS_INT4_MASK_GPIO_6 0x40 2150#define PALMAS_INT4_MASK_GPIO_6 0x40
2151#define PALMAS_INT4_MASK_GPIO_6_SHIFT 6 2151#define PALMAS_INT4_MASK_GPIO_6_SHIFT 0x06
2152#define PALMAS_INT4_MASK_GPIO_5 0x20 2152#define PALMAS_INT4_MASK_GPIO_5 0x20
2153#define PALMAS_INT4_MASK_GPIO_5_SHIFT 5 2153#define PALMAS_INT4_MASK_GPIO_5_SHIFT 0x05
2154#define PALMAS_INT4_MASK_GPIO_4 0x10 2154#define PALMAS_INT4_MASK_GPIO_4 0x10
2155#define PALMAS_INT4_MASK_GPIO_4_SHIFT 4 2155#define PALMAS_INT4_MASK_GPIO_4_SHIFT 0x04
2156#define PALMAS_INT4_MASK_GPIO_3 0x08 2156#define PALMAS_INT4_MASK_GPIO_3 0x08
2157#define PALMAS_INT4_MASK_GPIO_3_SHIFT 3 2157#define PALMAS_INT4_MASK_GPIO_3_SHIFT 0x03
2158#define PALMAS_INT4_MASK_GPIO_2 0x04 2158#define PALMAS_INT4_MASK_GPIO_2 0x04
2159#define PALMAS_INT4_MASK_GPIO_2_SHIFT 2 2159#define PALMAS_INT4_MASK_GPIO_2_SHIFT 0x02
2160#define PALMAS_INT4_MASK_GPIO_1 0x02 2160#define PALMAS_INT4_MASK_GPIO_1 0x02
2161#define PALMAS_INT4_MASK_GPIO_1_SHIFT 1 2161#define PALMAS_INT4_MASK_GPIO_1_SHIFT 0x01
2162#define PALMAS_INT4_MASK_GPIO_0 0x01 2162#define PALMAS_INT4_MASK_GPIO_0 0x01
2163#define PALMAS_INT4_MASK_GPIO_0_SHIFT 0 2163#define PALMAS_INT4_MASK_GPIO_0_SHIFT 0x00
2164 2164
2165/* Bit definitions for INT4_LINE_STATE */ 2165/* Bit definitions for INT4_LINE_STATE */
2166#define PALMAS_INT4_LINE_STATE_GPIO_7 0x80 2166#define PALMAS_INT4_LINE_STATE_GPIO_7 0x80
2167#define PALMAS_INT4_LINE_STATE_GPIO_7_SHIFT 7 2167#define PALMAS_INT4_LINE_STATE_GPIO_7_SHIFT 0x07
2168#define PALMAS_INT4_LINE_STATE_GPIO_6 0x40 2168#define PALMAS_INT4_LINE_STATE_GPIO_6 0x40
2169#define PALMAS_INT4_LINE_STATE_GPIO_6_SHIFT 6 2169#define PALMAS_INT4_LINE_STATE_GPIO_6_SHIFT 0x06
2170#define PALMAS_INT4_LINE_STATE_GPIO_5 0x20 2170#define PALMAS_INT4_LINE_STATE_GPIO_5 0x20
2171#define PALMAS_INT4_LINE_STATE_GPIO_5_SHIFT 5 2171#define PALMAS_INT4_LINE_STATE_GPIO_5_SHIFT 0x05
2172#define PALMAS_INT4_LINE_STATE_GPIO_4 0x10 2172#define PALMAS_INT4_LINE_STATE_GPIO_4 0x10
2173#define PALMAS_INT4_LINE_STATE_GPIO_4_SHIFT 4 2173#define PALMAS_INT4_LINE_STATE_GPIO_4_SHIFT 0x04
2174#define PALMAS_INT4_LINE_STATE_GPIO_3 0x08 2174#define PALMAS_INT4_LINE_STATE_GPIO_3 0x08
2175#define PALMAS_INT4_LINE_STATE_GPIO_3_SHIFT 3 2175#define PALMAS_INT4_LINE_STATE_GPIO_3_SHIFT 0x03
2176#define PALMAS_INT4_LINE_STATE_GPIO_2 0x04 2176#define PALMAS_INT4_LINE_STATE_GPIO_2 0x04
2177#define PALMAS_INT4_LINE_STATE_GPIO_2_SHIFT 2 2177#define PALMAS_INT4_LINE_STATE_GPIO_2_SHIFT 0x02
2178#define PALMAS_INT4_LINE_STATE_GPIO_1 0x02 2178#define PALMAS_INT4_LINE_STATE_GPIO_1 0x02
2179#define PALMAS_INT4_LINE_STATE_GPIO_1_SHIFT 1 2179#define PALMAS_INT4_LINE_STATE_GPIO_1_SHIFT 0x01
2180#define PALMAS_INT4_LINE_STATE_GPIO_0 0x01 2180#define PALMAS_INT4_LINE_STATE_GPIO_0 0x01
2181#define PALMAS_INT4_LINE_STATE_GPIO_0_SHIFT 0 2181#define PALMAS_INT4_LINE_STATE_GPIO_0_SHIFT 0x00
2182 2182
2183/* Bit definitions for INT4_EDGE_DETECT1 */ 2183/* Bit definitions for INT4_EDGE_DETECT1 */
2184#define PALMAS_INT4_EDGE_DETECT1_GPIO_3_RISING 0x80 2184#define PALMAS_INT4_EDGE_DETECT1_GPIO_3_RISING 0x80
2185#define PALMAS_INT4_EDGE_DETECT1_GPIO_3_RISING_SHIFT 7 2185#define PALMAS_INT4_EDGE_DETECT1_GPIO_3_RISING_SHIFT 0x07
2186#define PALMAS_INT4_EDGE_DETECT1_GPIO_3_FALLING 0x40 2186#define PALMAS_INT4_EDGE_DETECT1_GPIO_3_FALLING 0x40
2187#define PALMAS_INT4_EDGE_DETECT1_GPIO_3_FALLING_SHIFT 6 2187#define PALMAS_INT4_EDGE_DETECT1_GPIO_3_FALLING_SHIFT 0x06
2188#define PALMAS_INT4_EDGE_DETECT1_GPIO_2_RISING 0x20 2188#define PALMAS_INT4_EDGE_DETECT1_GPIO_2_RISING 0x20
2189#define PALMAS_INT4_EDGE_DETECT1_GPIO_2_RISING_SHIFT 5 2189#define PALMAS_INT4_EDGE_DETECT1_GPIO_2_RISING_SHIFT 0x05
2190#define PALMAS_INT4_EDGE_DETECT1_GPIO_2_FALLING 0x10 2190#define PALMAS_INT4_EDGE_DETECT1_GPIO_2_FALLING 0x10
2191#define PALMAS_INT4_EDGE_DETECT1_GPIO_2_FALLING_SHIFT 4 2191#define PALMAS_INT4_EDGE_DETECT1_GPIO_2_FALLING_SHIFT 0x04
2192#define PALMAS_INT4_EDGE_DETECT1_GPIO_1_RISING 0x08 2192#define PALMAS_INT4_EDGE_DETECT1_GPIO_1_RISING 0x08
2193#define PALMAS_INT4_EDGE_DETECT1_GPIO_1_RISING_SHIFT 3 2193#define PALMAS_INT4_EDGE_DETECT1_GPIO_1_RISING_SHIFT 0x03
2194#define PALMAS_INT4_EDGE_DETECT1_GPIO_1_FALLING 0x04 2194#define PALMAS_INT4_EDGE_DETECT1_GPIO_1_FALLING 0x04
2195#define PALMAS_INT4_EDGE_DETECT1_GPIO_1_FALLING_SHIFT 2 2195#define PALMAS_INT4_EDGE_DETECT1_GPIO_1_FALLING_SHIFT 0x02
2196#define PALMAS_INT4_EDGE_DETECT1_GPIO_0_RISING 0x02 2196#define PALMAS_INT4_EDGE_DETECT1_GPIO_0_RISING 0x02
2197#define PALMAS_INT4_EDGE_DETECT1_GPIO_0_RISING_SHIFT 1 2197#define PALMAS_INT4_EDGE_DETECT1_GPIO_0_RISING_SHIFT 0x01
2198#define PALMAS_INT4_EDGE_DETECT1_GPIO_0_FALLING 0x01 2198#define PALMAS_INT4_EDGE_DETECT1_GPIO_0_FALLING 0x01
2199#define PALMAS_INT4_EDGE_DETECT1_GPIO_0_FALLING_SHIFT 0 2199#define PALMAS_INT4_EDGE_DETECT1_GPIO_0_FALLING_SHIFT 0x00
2200 2200
2201/* Bit definitions for INT4_EDGE_DETECT2 */ 2201/* Bit definitions for INT4_EDGE_DETECT2 */
2202#define PALMAS_INT4_EDGE_DETECT2_GPIO_7_RISING 0x80 2202#define PALMAS_INT4_EDGE_DETECT2_GPIO_7_RISING 0x80
2203#define PALMAS_INT4_EDGE_DETECT2_GPIO_7_RISING_SHIFT 7 2203#define PALMAS_INT4_EDGE_DETECT2_GPIO_7_RISING_SHIFT 0x07
2204#define PALMAS_INT4_EDGE_DETECT2_GPIO_7_FALLING 0x40 2204#define PALMAS_INT4_EDGE_DETECT2_GPIO_7_FALLING 0x40
2205#define PALMAS_INT4_EDGE_DETECT2_GPIO_7_FALLING_SHIFT 6 2205#define PALMAS_INT4_EDGE_DETECT2_GPIO_7_FALLING_SHIFT 0x06
2206#define PALMAS_INT4_EDGE_DETECT2_GPIO_6_RISING 0x20 2206#define PALMAS_INT4_EDGE_DETECT2_GPIO_6_RISING 0x20
2207#define PALMAS_INT4_EDGE_DETECT2_GPIO_6_RISING_SHIFT 5 2207#define PALMAS_INT4_EDGE_DETECT2_GPIO_6_RISING_SHIFT 0x05
2208#define PALMAS_INT4_EDGE_DETECT2_GPIO_6_FALLING 0x10 2208#define PALMAS_INT4_EDGE_DETECT2_GPIO_6_FALLING 0x10
2209#define PALMAS_INT4_EDGE_DETECT2_GPIO_6_FALLING_SHIFT 4 2209#define PALMAS_INT4_EDGE_DETECT2_GPIO_6_FALLING_SHIFT 0x04
2210#define PALMAS_INT4_EDGE_DETECT2_GPIO_5_RISING 0x08 2210#define PALMAS_INT4_EDGE_DETECT2_GPIO_5_RISING 0x08
2211#define PALMAS_INT4_EDGE_DETECT2_GPIO_5_RISING_SHIFT 3 2211#define PALMAS_INT4_EDGE_DETECT2_GPIO_5_RISING_SHIFT 0x03
2212#define PALMAS_INT4_EDGE_DETECT2_GPIO_5_FALLING 0x04 2212#define PALMAS_INT4_EDGE_DETECT2_GPIO_5_FALLING 0x04
2213#define PALMAS_INT4_EDGE_DETECT2_GPIO_5_FALLING_SHIFT 2 2213#define PALMAS_INT4_EDGE_DETECT2_GPIO_5_FALLING_SHIFT 0x02
2214#define PALMAS_INT4_EDGE_DETECT2_GPIO_4_RISING 0x02 2214#define PALMAS_INT4_EDGE_DETECT2_GPIO_4_RISING 0x02
2215#define PALMAS_INT4_EDGE_DETECT2_GPIO_4_RISING_SHIFT 1 2215#define PALMAS_INT4_EDGE_DETECT2_GPIO_4_RISING_SHIFT 0x01
2216#define PALMAS_INT4_EDGE_DETECT2_GPIO_4_FALLING 0x01 2216#define PALMAS_INT4_EDGE_DETECT2_GPIO_4_FALLING 0x01
2217#define PALMAS_INT4_EDGE_DETECT2_GPIO_4_FALLING_SHIFT 0 2217#define PALMAS_INT4_EDGE_DETECT2_GPIO_4_FALLING_SHIFT 0x00
2218 2218
2219/* Bit definitions for INT_CTRL */ 2219/* Bit definitions for INT_CTRL */
2220#define PALMAS_INT_CTRL_INT_PENDING 0x04 2220#define PALMAS_INT_CTRL_INT_PENDING 0x04
2221#define PALMAS_INT_CTRL_INT_PENDING_SHIFT 2 2221#define PALMAS_INT_CTRL_INT_PENDING_SHIFT 0x02
2222#define PALMAS_INT_CTRL_INT_CLEAR 0x01 2222#define PALMAS_INT_CTRL_INT_CLEAR 0x01
2223#define PALMAS_INT_CTRL_INT_CLEAR_SHIFT 0 2223#define PALMAS_INT_CTRL_INT_CLEAR_SHIFT 0x00
2224 2224
2225/* Registers for function USB_OTG */ 2225/* Registers for function USB_OTG */
2226#define PALMAS_USB_WAKEUP 0x3 2226#define PALMAS_USB_WAKEUP 0x03
2227#define PALMAS_USB_VBUS_CTRL_SET 0x4 2227#define PALMAS_USB_VBUS_CTRL_SET 0x04
2228#define PALMAS_USB_VBUS_CTRL_CLR 0x5 2228#define PALMAS_USB_VBUS_CTRL_CLR 0x05
2229#define PALMAS_USB_ID_CTRL_SET 0x6 2229#define PALMAS_USB_ID_CTRL_SET 0x06
2230#define PALMAS_USB_ID_CTRL_CLEAR 0x7 2230#define PALMAS_USB_ID_CTRL_CLEAR 0x07
2231#define PALMAS_USB_VBUS_INT_SRC 0x8 2231#define PALMAS_USB_VBUS_INT_SRC 0x08
2232#define PALMAS_USB_VBUS_INT_LATCH_SET 0x9 2232#define PALMAS_USB_VBUS_INT_LATCH_SET 0x09
2233#define PALMAS_USB_VBUS_INT_LATCH_CLR 0xA 2233#define PALMAS_USB_VBUS_INT_LATCH_CLR 0x0A
2234#define PALMAS_USB_VBUS_INT_EN_LO_SET 0xB 2234#define PALMAS_USB_VBUS_INT_EN_LO_SET 0x0B
2235#define PALMAS_USB_VBUS_INT_EN_LO_CLR 0xC 2235#define PALMAS_USB_VBUS_INT_EN_LO_CLR 0x0C
2236#define PALMAS_USB_VBUS_INT_EN_HI_SET 0xD 2236#define PALMAS_USB_VBUS_INT_EN_HI_SET 0x0D
2237#define PALMAS_USB_VBUS_INT_EN_HI_CLR 0xE 2237#define PALMAS_USB_VBUS_INT_EN_HI_CLR 0x0E
2238#define PALMAS_USB_ID_INT_SRC 0xF 2238#define PALMAS_USB_ID_INT_SRC 0x0F
2239#define PALMAS_USB_ID_INT_LATCH_SET 0x10 2239#define PALMAS_USB_ID_INT_LATCH_SET 0x10
2240#define PALMAS_USB_ID_INT_LATCH_CLR 0x11 2240#define PALMAS_USB_ID_INT_LATCH_CLR 0x11
2241#define PALMAS_USB_ID_INT_EN_LO_SET 0x12 2241#define PALMAS_USB_ID_INT_EN_LO_SET 0x12
@@ -2250,306 +2250,306 @@ enum usb_irq_events {
2250 2250
2251/* Bit definitions for USB_WAKEUP */ 2251/* Bit definitions for USB_WAKEUP */
2252#define PALMAS_USB_WAKEUP_ID_WK_UP_COMP 0x01 2252#define PALMAS_USB_WAKEUP_ID_WK_UP_COMP 0x01
2253#define PALMAS_USB_WAKEUP_ID_WK_UP_COMP_SHIFT 0 2253#define PALMAS_USB_WAKEUP_ID_WK_UP_COMP_SHIFT 0x00
2254 2254
2255/* Bit definitions for USB_VBUS_CTRL_SET */ 2255/* Bit definitions for USB_VBUS_CTRL_SET */
2256#define PALMAS_USB_VBUS_CTRL_SET_VBUS_CHRG_VSYS 0x80 2256#define PALMAS_USB_VBUS_CTRL_SET_VBUS_CHRG_VSYS 0x80
2257#define PALMAS_USB_VBUS_CTRL_SET_VBUS_CHRG_VSYS_SHIFT 7 2257#define PALMAS_USB_VBUS_CTRL_SET_VBUS_CHRG_VSYS_SHIFT 0x07
2258#define PALMAS_USB_VBUS_CTRL_SET_VBUS_DISCHRG 0x20 2258#define PALMAS_USB_VBUS_CTRL_SET_VBUS_DISCHRG 0x20
2259#define PALMAS_USB_VBUS_CTRL_SET_VBUS_DISCHRG_SHIFT 5 2259#define PALMAS_USB_VBUS_CTRL_SET_VBUS_DISCHRG_SHIFT 0x05
2260#define PALMAS_USB_VBUS_CTRL_SET_VBUS_IADP_SRC 0x10 2260#define PALMAS_USB_VBUS_CTRL_SET_VBUS_IADP_SRC 0x10
2261#define PALMAS_USB_VBUS_CTRL_SET_VBUS_IADP_SRC_SHIFT 4 2261#define PALMAS_USB_VBUS_CTRL_SET_VBUS_IADP_SRC_SHIFT 0x04
2262#define PALMAS_USB_VBUS_CTRL_SET_VBUS_IADP_SINK 0x08 2262#define PALMAS_USB_VBUS_CTRL_SET_VBUS_IADP_SINK 0x08
2263#define PALMAS_USB_VBUS_CTRL_SET_VBUS_IADP_SINK_SHIFT 3 2263#define PALMAS_USB_VBUS_CTRL_SET_VBUS_IADP_SINK_SHIFT 0x03
2264#define PALMAS_USB_VBUS_CTRL_SET_VBUS_ACT_COMP 0x04 2264#define PALMAS_USB_VBUS_CTRL_SET_VBUS_ACT_COMP 0x04
2265#define PALMAS_USB_VBUS_CTRL_SET_VBUS_ACT_COMP_SHIFT 2 2265#define PALMAS_USB_VBUS_CTRL_SET_VBUS_ACT_COMP_SHIFT 0x02
2266 2266
2267/* Bit definitions for USB_VBUS_CTRL_CLR */ 2267/* Bit definitions for USB_VBUS_CTRL_CLR */
2268#define PALMAS_USB_VBUS_CTRL_CLR_VBUS_CHRG_VSYS 0x80 2268#define PALMAS_USB_VBUS_CTRL_CLR_VBUS_CHRG_VSYS 0x80
2269#define PALMAS_USB_VBUS_CTRL_CLR_VBUS_CHRG_VSYS_SHIFT 7 2269#define PALMAS_USB_VBUS_CTRL_CLR_VBUS_CHRG_VSYS_SHIFT 0x07
2270#define PALMAS_USB_VBUS_CTRL_CLR_VBUS_DISCHRG 0x20 2270#define PALMAS_USB_VBUS_CTRL_CLR_VBUS_DISCHRG 0x20
2271#define PALMAS_USB_VBUS_CTRL_CLR_VBUS_DISCHRG_SHIFT 5 2271#define PALMAS_USB_VBUS_CTRL_CLR_VBUS_DISCHRG_SHIFT 0x05
2272#define PALMAS_USB_VBUS_CTRL_CLR_VBUS_IADP_SRC 0x10 2272#define PALMAS_USB_VBUS_CTRL_CLR_VBUS_IADP_SRC 0x10
2273#define PALMAS_USB_VBUS_CTRL_CLR_VBUS_IADP_SRC_SHIFT 4 2273#define PALMAS_USB_VBUS_CTRL_CLR_VBUS_IADP_SRC_SHIFT 0x04
2274#define PALMAS_USB_VBUS_CTRL_CLR_VBUS_IADP_SINK 0x08 2274#define PALMAS_USB_VBUS_CTRL_CLR_VBUS_IADP_SINK 0x08
2275#define PALMAS_USB_VBUS_CTRL_CLR_VBUS_IADP_SINK_SHIFT 3 2275#define PALMAS_USB_VBUS_CTRL_CLR_VBUS_IADP_SINK_SHIFT 0x03
2276#define PALMAS_USB_VBUS_CTRL_CLR_VBUS_ACT_COMP 0x04 2276#define PALMAS_USB_VBUS_CTRL_CLR_VBUS_ACT_COMP 0x04
2277#define PALMAS_USB_VBUS_CTRL_CLR_VBUS_ACT_COMP_SHIFT 2 2277#define PALMAS_USB_VBUS_CTRL_CLR_VBUS_ACT_COMP_SHIFT 0x02
2278 2278
2279/* Bit definitions for USB_ID_CTRL_SET */ 2279/* Bit definitions for USB_ID_CTRL_SET */
2280#define PALMAS_USB_ID_CTRL_SET_ID_PU_220K 0x80 2280#define PALMAS_USB_ID_CTRL_SET_ID_PU_220K 0x80
2281#define PALMAS_USB_ID_CTRL_SET_ID_PU_220K_SHIFT 7 2281#define PALMAS_USB_ID_CTRL_SET_ID_PU_220K_SHIFT 0x07
2282#define PALMAS_USB_ID_CTRL_SET_ID_PU_100K 0x40 2282#define PALMAS_USB_ID_CTRL_SET_ID_PU_100K 0x40
2283#define PALMAS_USB_ID_CTRL_SET_ID_PU_100K_SHIFT 6 2283#define PALMAS_USB_ID_CTRL_SET_ID_PU_100K_SHIFT 0x06
2284#define PALMAS_USB_ID_CTRL_SET_ID_GND_DRV 0x20 2284#define PALMAS_USB_ID_CTRL_SET_ID_GND_DRV 0x20
2285#define PALMAS_USB_ID_CTRL_SET_ID_GND_DRV_SHIFT 5 2285#define PALMAS_USB_ID_CTRL_SET_ID_GND_DRV_SHIFT 0x05
2286#define PALMAS_USB_ID_CTRL_SET_ID_SRC_16U 0x10 2286#define PALMAS_USB_ID_CTRL_SET_ID_SRC_16U 0x10
2287#define PALMAS_USB_ID_CTRL_SET_ID_SRC_16U_SHIFT 4 2287#define PALMAS_USB_ID_CTRL_SET_ID_SRC_16U_SHIFT 0x04
2288#define PALMAS_USB_ID_CTRL_SET_ID_SRC_5U 0x08 2288#define PALMAS_USB_ID_CTRL_SET_ID_SRC_5U 0x08
2289#define PALMAS_USB_ID_CTRL_SET_ID_SRC_5U_SHIFT 3 2289#define PALMAS_USB_ID_CTRL_SET_ID_SRC_5U_SHIFT 0x03
2290#define PALMAS_USB_ID_CTRL_SET_ID_ACT_COMP 0x04 2290#define PALMAS_USB_ID_CTRL_SET_ID_ACT_COMP 0x04
2291#define PALMAS_USB_ID_CTRL_SET_ID_ACT_COMP_SHIFT 2 2291#define PALMAS_USB_ID_CTRL_SET_ID_ACT_COMP_SHIFT 0x02
2292 2292
2293/* Bit definitions for USB_ID_CTRL_CLEAR */ 2293/* Bit definitions for USB_ID_CTRL_CLEAR */
2294#define PALMAS_USB_ID_CTRL_CLEAR_ID_PU_220K 0x80 2294#define PALMAS_USB_ID_CTRL_CLEAR_ID_PU_220K 0x80
2295#define PALMAS_USB_ID_CTRL_CLEAR_ID_PU_220K_SHIFT 7 2295#define PALMAS_USB_ID_CTRL_CLEAR_ID_PU_220K_SHIFT 0x07
2296#define PALMAS_USB_ID_CTRL_CLEAR_ID_PU_100K 0x40 2296#define PALMAS_USB_ID_CTRL_CLEAR_ID_PU_100K 0x40
2297#define PALMAS_USB_ID_CTRL_CLEAR_ID_PU_100K_SHIFT 6 2297#define PALMAS_USB_ID_CTRL_CLEAR_ID_PU_100K_SHIFT 0x06
2298#define PALMAS_USB_ID_CTRL_CLEAR_ID_GND_DRV 0x20 2298#define PALMAS_USB_ID_CTRL_CLEAR_ID_GND_DRV 0x20
2299#define PALMAS_USB_ID_CTRL_CLEAR_ID_GND_DRV_SHIFT 5 2299#define PALMAS_USB_ID_CTRL_CLEAR_ID_GND_DRV_SHIFT 0x05
2300#define PALMAS_USB_ID_CTRL_CLEAR_ID_SRC_16U 0x10 2300#define PALMAS_USB_ID_CTRL_CLEAR_ID_SRC_16U 0x10
2301#define PALMAS_USB_ID_CTRL_CLEAR_ID_SRC_16U_SHIFT 4 2301#define PALMAS_USB_ID_CTRL_CLEAR_ID_SRC_16U_SHIFT 0x04
2302#define PALMAS_USB_ID_CTRL_CLEAR_ID_SRC_5U 0x08 2302#define PALMAS_USB_ID_CTRL_CLEAR_ID_SRC_5U 0x08
2303#define PALMAS_USB_ID_CTRL_CLEAR_ID_SRC_5U_SHIFT 3 2303#define PALMAS_USB_ID_CTRL_CLEAR_ID_SRC_5U_SHIFT 0x03
2304#define PALMAS_USB_ID_CTRL_CLEAR_ID_ACT_COMP 0x04 2304#define PALMAS_USB_ID_CTRL_CLEAR_ID_ACT_COMP 0x04
2305#define PALMAS_USB_ID_CTRL_CLEAR_ID_ACT_COMP_SHIFT 2 2305#define PALMAS_USB_ID_CTRL_CLEAR_ID_ACT_COMP_SHIFT 0x02
2306 2306
2307/* Bit definitions for USB_VBUS_INT_SRC */ 2307/* Bit definitions for USB_VBUS_INT_SRC */
2308#define PALMAS_USB_VBUS_INT_SRC_VOTG_SESS_VLD 0x80 2308#define PALMAS_USB_VBUS_INT_SRC_VOTG_SESS_VLD 0x80
2309#define PALMAS_USB_VBUS_INT_SRC_VOTG_SESS_VLD_SHIFT 7 2309#define PALMAS_USB_VBUS_INT_SRC_VOTG_SESS_VLD_SHIFT 0x07
2310#define PALMAS_USB_VBUS_INT_SRC_VADP_PRB 0x40 2310#define PALMAS_USB_VBUS_INT_SRC_VADP_PRB 0x40
2311#define PALMAS_USB_VBUS_INT_SRC_VADP_PRB_SHIFT 6 2311#define PALMAS_USB_VBUS_INT_SRC_VADP_PRB_SHIFT 0x06
2312#define PALMAS_USB_VBUS_INT_SRC_VADP_SNS 0x20 2312#define PALMAS_USB_VBUS_INT_SRC_VADP_SNS 0x20
2313#define PALMAS_USB_VBUS_INT_SRC_VADP_SNS_SHIFT 5 2313#define PALMAS_USB_VBUS_INT_SRC_VADP_SNS_SHIFT 0x05
2314#define PALMAS_USB_VBUS_INT_SRC_VA_VBUS_VLD 0x08 2314#define PALMAS_USB_VBUS_INT_SRC_VA_VBUS_VLD 0x08
2315#define PALMAS_USB_VBUS_INT_SRC_VA_VBUS_VLD_SHIFT 3 2315#define PALMAS_USB_VBUS_INT_SRC_VA_VBUS_VLD_SHIFT 0x03
2316#define PALMAS_USB_VBUS_INT_SRC_VA_SESS_VLD 0x04 2316#define PALMAS_USB_VBUS_INT_SRC_VA_SESS_VLD 0x04
2317#define PALMAS_USB_VBUS_INT_SRC_VA_SESS_VLD_SHIFT 2 2317#define PALMAS_USB_VBUS_INT_SRC_VA_SESS_VLD_SHIFT 0x02
2318#define PALMAS_USB_VBUS_INT_SRC_VB_SESS_VLD 0x02 2318#define PALMAS_USB_VBUS_INT_SRC_VB_SESS_VLD 0x02
2319#define PALMAS_USB_VBUS_INT_SRC_VB_SESS_VLD_SHIFT 1 2319#define PALMAS_USB_VBUS_INT_SRC_VB_SESS_VLD_SHIFT 0x01
2320#define PALMAS_USB_VBUS_INT_SRC_VB_SESS_END 0x01 2320#define PALMAS_USB_VBUS_INT_SRC_VB_SESS_END 0x01
2321#define PALMAS_USB_VBUS_INT_SRC_VB_SESS_END_SHIFT 0 2321#define PALMAS_USB_VBUS_INT_SRC_VB_SESS_END_SHIFT 0x00
2322 2322
2323/* Bit definitions for USB_VBUS_INT_LATCH_SET */ 2323/* Bit definitions for USB_VBUS_INT_LATCH_SET */
2324#define PALMAS_USB_VBUS_INT_LATCH_SET_VOTG_SESS_VLD 0x80 2324#define PALMAS_USB_VBUS_INT_LATCH_SET_VOTG_SESS_VLD 0x80
2325#define PALMAS_USB_VBUS_INT_LATCH_SET_VOTG_SESS_VLD_SHIFT 7 2325#define PALMAS_USB_VBUS_INT_LATCH_SET_VOTG_SESS_VLD_SHIFT 0x07
2326#define PALMAS_USB_VBUS_INT_LATCH_SET_VADP_PRB 0x40 2326#define PALMAS_USB_VBUS_INT_LATCH_SET_VADP_PRB 0x40
2327#define PALMAS_USB_VBUS_INT_LATCH_SET_VADP_PRB_SHIFT 6 2327#define PALMAS_USB_VBUS_INT_LATCH_SET_VADP_PRB_SHIFT 0x06
2328#define PALMAS_USB_VBUS_INT_LATCH_SET_VADP_SNS 0x20 2328#define PALMAS_USB_VBUS_INT_LATCH_SET_VADP_SNS 0x20
2329#define PALMAS_USB_VBUS_INT_LATCH_SET_VADP_SNS_SHIFT 5 2329#define PALMAS_USB_VBUS_INT_LATCH_SET_VADP_SNS_SHIFT 0x05
2330#define PALMAS_USB_VBUS_INT_LATCH_SET_ADP 0x10 2330#define PALMAS_USB_VBUS_INT_LATCH_SET_ADP 0x10
2331#define PALMAS_USB_VBUS_INT_LATCH_SET_ADP_SHIFT 4 2331#define PALMAS_USB_VBUS_INT_LATCH_SET_ADP_SHIFT 0x04
2332#define PALMAS_USB_VBUS_INT_LATCH_SET_VA_VBUS_VLD 0x08 2332#define PALMAS_USB_VBUS_INT_LATCH_SET_VA_VBUS_VLD 0x08
2333#define PALMAS_USB_VBUS_INT_LATCH_SET_VA_VBUS_VLD_SHIFT 3 2333#define PALMAS_USB_VBUS_INT_LATCH_SET_VA_VBUS_VLD_SHIFT 0x03
2334#define PALMAS_USB_VBUS_INT_LATCH_SET_VA_SESS_VLD 0x04 2334#define PALMAS_USB_VBUS_INT_LATCH_SET_VA_SESS_VLD 0x04
2335#define PALMAS_USB_VBUS_INT_LATCH_SET_VA_SESS_VLD_SHIFT 2 2335#define PALMAS_USB_VBUS_INT_LATCH_SET_VA_SESS_VLD_SHIFT 0x02
2336#define PALMAS_USB_VBUS_INT_LATCH_SET_VB_SESS_VLD 0x02 2336#define PALMAS_USB_VBUS_INT_LATCH_SET_VB_SESS_VLD 0x02
2337#define PALMAS_USB_VBUS_INT_LATCH_SET_VB_SESS_VLD_SHIFT 1 2337#define PALMAS_USB_VBUS_INT_LATCH_SET_VB_SESS_VLD_SHIFT 0x01
2338#define PALMAS_USB_VBUS_INT_LATCH_SET_VB_SESS_END 0x01 2338#define PALMAS_USB_VBUS_INT_LATCH_SET_VB_SESS_END 0x01
2339#define PALMAS_USB_VBUS_INT_LATCH_SET_VB_SESS_END_SHIFT 0 2339#define PALMAS_USB_VBUS_INT_LATCH_SET_VB_SESS_END_SHIFT 0x00
2340 2340
2341/* Bit definitions for USB_VBUS_INT_LATCH_CLR */ 2341/* Bit definitions for USB_VBUS_INT_LATCH_CLR */
2342#define PALMAS_USB_VBUS_INT_LATCH_CLR_VOTG_SESS_VLD 0x80 2342#define PALMAS_USB_VBUS_INT_LATCH_CLR_VOTG_SESS_VLD 0x80
2343#define PALMAS_USB_VBUS_INT_LATCH_CLR_VOTG_SESS_VLD_SHIFT 7 2343#define PALMAS_USB_VBUS_INT_LATCH_CLR_VOTG_SESS_VLD_SHIFT 0x07
2344#define PALMAS_USB_VBUS_INT_LATCH_CLR_VADP_PRB 0x40 2344#define PALMAS_USB_VBUS_INT_LATCH_CLR_VADP_PRB 0x40
2345#define PALMAS_USB_VBUS_INT_LATCH_CLR_VADP_PRB_SHIFT 6 2345#define PALMAS_USB_VBUS_INT_LATCH_CLR_VADP_PRB_SHIFT 0x06
2346#define PALMAS_USB_VBUS_INT_LATCH_CLR_VADP_SNS 0x20 2346#define PALMAS_USB_VBUS_INT_LATCH_CLR_VADP_SNS 0x20
2347#define PALMAS_USB_VBUS_INT_LATCH_CLR_VADP_SNS_SHIFT 5 2347#define PALMAS_USB_VBUS_INT_LATCH_CLR_VADP_SNS_SHIFT 0x05
2348#define PALMAS_USB_VBUS_INT_LATCH_CLR_ADP 0x10 2348#define PALMAS_USB_VBUS_INT_LATCH_CLR_ADP 0x10
2349#define PALMAS_USB_VBUS_INT_LATCH_CLR_ADP_SHIFT 4 2349#define PALMAS_USB_VBUS_INT_LATCH_CLR_ADP_SHIFT 0x04
2350#define PALMAS_USB_VBUS_INT_LATCH_CLR_VA_VBUS_VLD 0x08 2350#define PALMAS_USB_VBUS_INT_LATCH_CLR_VA_VBUS_VLD 0x08
2351#define PALMAS_USB_VBUS_INT_LATCH_CLR_VA_VBUS_VLD_SHIFT 3 2351#define PALMAS_USB_VBUS_INT_LATCH_CLR_VA_VBUS_VLD_SHIFT 0x03
2352#define PALMAS_USB_VBUS_INT_LATCH_CLR_VA_SESS_VLD 0x04 2352#define PALMAS_USB_VBUS_INT_LATCH_CLR_VA_SESS_VLD 0x04
2353#define PALMAS_USB_VBUS_INT_LATCH_CLR_VA_SESS_VLD_SHIFT 2 2353#define PALMAS_USB_VBUS_INT_LATCH_CLR_VA_SESS_VLD_SHIFT 0x02
2354#define PALMAS_USB_VBUS_INT_LATCH_CLR_VB_SESS_VLD 0x02 2354#define PALMAS_USB_VBUS_INT_LATCH_CLR_VB_SESS_VLD 0x02
2355#define PALMAS_USB_VBUS_INT_LATCH_CLR_VB_SESS_VLD_SHIFT 1 2355#define PALMAS_USB_VBUS_INT_LATCH_CLR_VB_SESS_VLD_SHIFT 0x01
2356#define PALMAS_USB_VBUS_INT_LATCH_CLR_VB_SESS_END 0x01 2356#define PALMAS_USB_VBUS_INT_LATCH_CLR_VB_SESS_END 0x01
2357#define PALMAS_USB_VBUS_INT_LATCH_CLR_VB_SESS_END_SHIFT 0 2357#define PALMAS_USB_VBUS_INT_LATCH_CLR_VB_SESS_END_SHIFT 0x00
2358 2358
2359/* Bit definitions for USB_VBUS_INT_EN_LO_SET */ 2359/* Bit definitions for USB_VBUS_INT_EN_LO_SET */
2360#define PALMAS_USB_VBUS_INT_EN_LO_SET_VOTG_SESS_VLD 0x80 2360#define PALMAS_USB_VBUS_INT_EN_LO_SET_VOTG_SESS_VLD 0x80
2361#define PALMAS_USB_VBUS_INT_EN_LO_SET_VOTG_SESS_VLD_SHIFT 7 2361#define PALMAS_USB_VBUS_INT_EN_LO_SET_VOTG_SESS_VLD_SHIFT 0x07
2362#define PALMAS_USB_VBUS_INT_EN_LO_SET_VADP_PRB 0x40 2362#define PALMAS_USB_VBUS_INT_EN_LO_SET_VADP_PRB 0x40
2363#define PALMAS_USB_VBUS_INT_EN_LO_SET_VADP_PRB_SHIFT 6 2363#define PALMAS_USB_VBUS_INT_EN_LO_SET_VADP_PRB_SHIFT 0x06
2364#define PALMAS_USB_VBUS_INT_EN_LO_SET_VADP_SNS 0x20 2364#define PALMAS_USB_VBUS_INT_EN_LO_SET_VADP_SNS 0x20
2365#define PALMAS_USB_VBUS_INT_EN_LO_SET_VADP_SNS_SHIFT 5 2365#define PALMAS_USB_VBUS_INT_EN_LO_SET_VADP_SNS_SHIFT 0x05
2366#define PALMAS_USB_VBUS_INT_EN_LO_SET_VA_VBUS_VLD 0x08 2366#define PALMAS_USB_VBUS_INT_EN_LO_SET_VA_VBUS_VLD 0x08
2367#define PALMAS_USB_VBUS_INT_EN_LO_SET_VA_VBUS_VLD_SHIFT 3 2367#define PALMAS_USB_VBUS_INT_EN_LO_SET_VA_VBUS_VLD_SHIFT 0x03
2368#define PALMAS_USB_VBUS_INT_EN_LO_SET_VA_SESS_VLD 0x04 2368#define PALMAS_USB_VBUS_INT_EN_LO_SET_VA_SESS_VLD 0x04
2369#define PALMAS_USB_VBUS_INT_EN_LO_SET_VA_SESS_VLD_SHIFT 2 2369#define PALMAS_USB_VBUS_INT_EN_LO_SET_VA_SESS_VLD_SHIFT 0x02
2370#define PALMAS_USB_VBUS_INT_EN_LO_SET_VB_SESS_VLD 0x02 2370#define PALMAS_USB_VBUS_INT_EN_LO_SET_VB_SESS_VLD 0x02
2371#define PALMAS_USB_VBUS_INT_EN_LO_SET_VB_SESS_VLD_SHIFT 1 2371#define PALMAS_USB_VBUS_INT_EN_LO_SET_VB_SESS_VLD_SHIFT 0x01
2372#define PALMAS_USB_VBUS_INT_EN_LO_SET_VB_SESS_END 0x01 2372#define PALMAS_USB_VBUS_INT_EN_LO_SET_VB_SESS_END 0x01
2373#define PALMAS_USB_VBUS_INT_EN_LO_SET_VB_SESS_END_SHIFT 0 2373#define PALMAS_USB_VBUS_INT_EN_LO_SET_VB_SESS_END_SHIFT 0x00
2374 2374
2375/* Bit definitions for USB_VBUS_INT_EN_LO_CLR */ 2375/* Bit definitions for USB_VBUS_INT_EN_LO_CLR */
2376#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VOTG_SESS_VLD 0x80 2376#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VOTG_SESS_VLD 0x80
2377#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VOTG_SESS_VLD_SHIFT 7 2377#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VOTG_SESS_VLD_SHIFT 0x07
2378#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VADP_PRB 0x40 2378#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VADP_PRB 0x40
2379#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VADP_PRB_SHIFT 6 2379#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VADP_PRB_SHIFT 0x06
2380#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VADP_SNS 0x20 2380#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VADP_SNS 0x20
2381#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VADP_SNS_SHIFT 5 2381#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VADP_SNS_SHIFT 0x05
2382#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VA_VBUS_VLD 0x08 2382#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VA_VBUS_VLD 0x08
2383#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VA_VBUS_VLD_SHIFT 3 2383#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VA_VBUS_VLD_SHIFT 0x03
2384#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VA_SESS_VLD 0x04 2384#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VA_SESS_VLD 0x04
2385#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VA_SESS_VLD_SHIFT 2 2385#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VA_SESS_VLD_SHIFT 0x02
2386#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VB_SESS_VLD 0x02 2386#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VB_SESS_VLD 0x02
2387#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VB_SESS_VLD_SHIFT 1 2387#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VB_SESS_VLD_SHIFT 0x01
2388#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VB_SESS_END 0x01 2388#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VB_SESS_END 0x01
2389#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VB_SESS_END_SHIFT 0 2389#define PALMAS_USB_VBUS_INT_EN_LO_CLR_VB_SESS_END_SHIFT 0x00
2390 2390
2391/* Bit definitions for USB_VBUS_INT_EN_HI_SET */ 2391/* Bit definitions for USB_VBUS_INT_EN_HI_SET */
2392#define PALMAS_USB_VBUS_INT_EN_HI_SET_VOTG_SESS_VLD 0x80 2392#define PALMAS_USB_VBUS_INT_EN_HI_SET_VOTG_SESS_VLD 0x80
2393#define PALMAS_USB_VBUS_INT_EN_HI_SET_VOTG_SESS_VLD_SHIFT 7 2393#define PALMAS_USB_VBUS_INT_EN_HI_SET_VOTG_SESS_VLD_SHIFT 0x07
2394#define PALMAS_USB_VBUS_INT_EN_HI_SET_VADP_PRB 0x40 2394#define PALMAS_USB_VBUS_INT_EN_HI_SET_VADP_PRB 0x40
2395#define PALMAS_USB_VBUS_INT_EN_HI_SET_VADP_PRB_SHIFT 6 2395#define PALMAS_USB_VBUS_INT_EN_HI_SET_VADP_PRB_SHIFT 0x06
2396#define PALMAS_USB_VBUS_INT_EN_HI_SET_VADP_SNS 0x20 2396#define PALMAS_USB_VBUS_INT_EN_HI_SET_VADP_SNS 0x20
2397#define PALMAS_USB_VBUS_INT_EN_HI_SET_VADP_SNS_SHIFT 5 2397#define PALMAS_USB_VBUS_INT_EN_HI_SET_VADP_SNS_SHIFT 0x05
2398#define PALMAS_USB_VBUS_INT_EN_HI_SET_ADP 0x10 2398#define PALMAS_USB_VBUS_INT_EN_HI_SET_ADP 0x10
2399#define PALMAS_USB_VBUS_INT_EN_HI_SET_ADP_SHIFT 4 2399#define PALMAS_USB_VBUS_INT_EN_HI_SET_ADP_SHIFT 0x04
2400#define PALMAS_USB_VBUS_INT_EN_HI_SET_VA_VBUS_VLD 0x08 2400#define PALMAS_USB_VBUS_INT_EN_HI_SET_VA_VBUS_VLD 0x08
2401#define PALMAS_USB_VBUS_INT_EN_HI_SET_VA_VBUS_VLD_SHIFT 3 2401#define PALMAS_USB_VBUS_INT_EN_HI_SET_VA_VBUS_VLD_SHIFT 0x03
2402#define PALMAS_USB_VBUS_INT_EN_HI_SET_VA_SESS_VLD 0x04 2402#define PALMAS_USB_VBUS_INT_EN_HI_SET_VA_SESS_VLD 0x04
2403#define PALMAS_USB_VBUS_INT_EN_HI_SET_VA_SESS_VLD_SHIFT 2 2403#define PALMAS_USB_VBUS_INT_EN_HI_SET_VA_SESS_VLD_SHIFT 0x02
2404#define PALMAS_USB_VBUS_INT_EN_HI_SET_VB_SESS_VLD 0x02 2404#define PALMAS_USB_VBUS_INT_EN_HI_SET_VB_SESS_VLD 0x02
2405#define PALMAS_USB_VBUS_INT_EN_HI_SET_VB_SESS_VLD_SHIFT 1 2405#define PALMAS_USB_VBUS_INT_EN_HI_SET_VB_SESS_VLD_SHIFT 0x01
2406#define PALMAS_USB_VBUS_INT_EN_HI_SET_VB_SESS_END 0x01 2406#define PALMAS_USB_VBUS_INT_EN_HI_SET_VB_SESS_END 0x01
2407#define PALMAS_USB_VBUS_INT_EN_HI_SET_VB_SESS_END_SHIFT 0 2407#define PALMAS_USB_VBUS_INT_EN_HI_SET_VB_SESS_END_SHIFT 0x00
2408 2408
2409/* Bit definitions for USB_VBUS_INT_EN_HI_CLR */ 2409/* Bit definitions for USB_VBUS_INT_EN_HI_CLR */
2410#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VOTG_SESS_VLD 0x80 2410#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VOTG_SESS_VLD 0x80
2411#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VOTG_SESS_VLD_SHIFT 7 2411#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VOTG_SESS_VLD_SHIFT 0x07
2412#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VADP_PRB 0x40 2412#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VADP_PRB 0x40
2413#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VADP_PRB_SHIFT 6 2413#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VADP_PRB_SHIFT 0x06
2414#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VADP_SNS 0x20 2414#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VADP_SNS 0x20
2415#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VADP_SNS_SHIFT 5 2415#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VADP_SNS_SHIFT 0x05
2416#define PALMAS_USB_VBUS_INT_EN_HI_CLR_ADP 0x10 2416#define PALMAS_USB_VBUS_INT_EN_HI_CLR_ADP 0x10
2417#define PALMAS_USB_VBUS_INT_EN_HI_CLR_ADP_SHIFT 4 2417#define PALMAS_USB_VBUS_INT_EN_HI_CLR_ADP_SHIFT 0x04
2418#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VA_VBUS_VLD 0x08 2418#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VA_VBUS_VLD 0x08
2419#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VA_VBUS_VLD_SHIFT 3 2419#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VA_VBUS_VLD_SHIFT 0x03
2420#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VA_SESS_VLD 0x04 2420#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VA_SESS_VLD 0x04
2421#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VA_SESS_VLD_SHIFT 2 2421#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VA_SESS_VLD_SHIFT 0x02
2422#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VB_SESS_VLD 0x02 2422#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VB_SESS_VLD 0x02
2423#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VB_SESS_VLD_SHIFT 1 2423#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VB_SESS_VLD_SHIFT 0x01
2424#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VB_SESS_END 0x01 2424#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VB_SESS_END 0x01
2425#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VB_SESS_END_SHIFT 0 2425#define PALMAS_USB_VBUS_INT_EN_HI_CLR_VB_SESS_END_SHIFT 0x00
2426 2426
2427/* Bit definitions for USB_ID_INT_SRC */ 2427/* Bit definitions for USB_ID_INT_SRC */
2428#define PALMAS_USB_ID_INT_SRC_ID_FLOAT 0x10 2428#define PALMAS_USB_ID_INT_SRC_ID_FLOAT 0x10
2429#define PALMAS_USB_ID_INT_SRC_ID_FLOAT_SHIFT 4 2429#define PALMAS_USB_ID_INT_SRC_ID_FLOAT_SHIFT 0x04
2430#define PALMAS_USB_ID_INT_SRC_ID_A 0x08 2430#define PALMAS_USB_ID_INT_SRC_ID_A 0x08
2431#define PALMAS_USB_ID_INT_SRC_ID_A_SHIFT 3 2431#define PALMAS_USB_ID_INT_SRC_ID_A_SHIFT 0x03
2432#define PALMAS_USB_ID_INT_SRC_ID_B 0x04 2432#define PALMAS_USB_ID_INT_SRC_ID_B 0x04
2433#define PALMAS_USB_ID_INT_SRC_ID_B_SHIFT 2 2433#define PALMAS_USB_ID_INT_SRC_ID_B_SHIFT 0x02
2434#define PALMAS_USB_ID_INT_SRC_ID_C 0x02 2434#define PALMAS_USB_ID_INT_SRC_ID_C 0x02
2435#define PALMAS_USB_ID_INT_SRC_ID_C_SHIFT 1 2435#define PALMAS_USB_ID_INT_SRC_ID_C_SHIFT 0x01
2436#define PALMAS_USB_ID_INT_SRC_ID_GND 0x01 2436#define PALMAS_USB_ID_INT_SRC_ID_GND 0x01
2437#define PALMAS_USB_ID_INT_SRC_ID_GND_SHIFT 0 2437#define PALMAS_USB_ID_INT_SRC_ID_GND_SHIFT 0x00
2438 2438
2439/* Bit definitions for USB_ID_INT_LATCH_SET */ 2439/* Bit definitions for USB_ID_INT_LATCH_SET */
2440#define PALMAS_USB_ID_INT_LATCH_SET_ID_FLOAT 0x10 2440#define PALMAS_USB_ID_INT_LATCH_SET_ID_FLOAT 0x10
2441#define PALMAS_USB_ID_INT_LATCH_SET_ID_FLOAT_SHIFT 4 2441#define PALMAS_USB_ID_INT_LATCH_SET_ID_FLOAT_SHIFT 0x04
2442#define PALMAS_USB_ID_INT_LATCH_SET_ID_A 0x08 2442#define PALMAS_USB_ID_INT_LATCH_SET_ID_A 0x08
2443#define PALMAS_USB_ID_INT_LATCH_SET_ID_A_SHIFT 3 2443#define PALMAS_USB_ID_INT_LATCH_SET_ID_A_SHIFT 0x03
2444#define PALMAS_USB_ID_INT_LATCH_SET_ID_B 0x04 2444#define PALMAS_USB_ID_INT_LATCH_SET_ID_B 0x04
2445#define PALMAS_USB_ID_INT_LATCH_SET_ID_B_SHIFT 2 2445#define PALMAS_USB_ID_INT_LATCH_SET_ID_B_SHIFT 0x02
2446#define PALMAS_USB_ID_INT_LATCH_SET_ID_C 0x02 2446#define PALMAS_USB_ID_INT_LATCH_SET_ID_C 0x02
2447#define PALMAS_USB_ID_INT_LATCH_SET_ID_C_SHIFT 1 2447#define PALMAS_USB_ID_INT_LATCH_SET_ID_C_SHIFT 0x01
2448#define PALMAS_USB_ID_INT_LATCH_SET_ID_GND 0x01 2448#define PALMAS_USB_ID_INT_LATCH_SET_ID_GND 0x01
2449#define PALMAS_USB_ID_INT_LATCH_SET_ID_GND_SHIFT 0 2449#define PALMAS_USB_ID_INT_LATCH_SET_ID_GND_SHIFT 0x00
2450 2450
2451/* Bit definitions for USB_ID_INT_LATCH_CLR */ 2451/* Bit definitions for USB_ID_INT_LATCH_CLR */
2452#define PALMAS_USB_ID_INT_LATCH_CLR_ID_FLOAT 0x10 2452#define PALMAS_USB_ID_INT_LATCH_CLR_ID_FLOAT 0x10
2453#define PALMAS_USB_ID_INT_LATCH_CLR_ID_FLOAT_SHIFT 4 2453#define PALMAS_USB_ID_INT_LATCH_CLR_ID_FLOAT_SHIFT 0x04
2454#define PALMAS_USB_ID_INT_LATCH_CLR_ID_A 0x08 2454#define PALMAS_USB_ID_INT_LATCH_CLR_ID_A 0x08
2455#define PALMAS_USB_ID_INT_LATCH_CLR_ID_A_SHIFT 3 2455#define PALMAS_USB_ID_INT_LATCH_CLR_ID_A_SHIFT 0x03
2456#define PALMAS_USB_ID_INT_LATCH_CLR_ID_B 0x04 2456#define PALMAS_USB_ID_INT_LATCH_CLR_ID_B 0x04
2457#define PALMAS_USB_ID_INT_LATCH_CLR_ID_B_SHIFT 2 2457#define PALMAS_USB_ID_INT_LATCH_CLR_ID_B_SHIFT 0x02
2458#define PALMAS_USB_ID_INT_LATCH_CLR_ID_C 0x02 2458#define PALMAS_USB_ID_INT_LATCH_CLR_ID_C 0x02
2459#define PALMAS_USB_ID_INT_LATCH_CLR_ID_C_SHIFT 1 2459#define PALMAS_USB_ID_INT_LATCH_CLR_ID_C_SHIFT 0x01
2460#define PALMAS_USB_ID_INT_LATCH_CLR_ID_GND 0x01 2460#define PALMAS_USB_ID_INT_LATCH_CLR_ID_GND 0x01
2461#define PALMAS_USB_ID_INT_LATCH_CLR_ID_GND_SHIFT 0 2461#define PALMAS_USB_ID_INT_LATCH_CLR_ID_GND_SHIFT 0x00
2462 2462
2463/* Bit definitions for USB_ID_INT_EN_LO_SET */ 2463/* Bit definitions for USB_ID_INT_EN_LO_SET */
2464#define PALMAS_USB_ID_INT_EN_LO_SET_ID_FLOAT 0x10 2464#define PALMAS_USB_ID_INT_EN_LO_SET_ID_FLOAT 0x10
2465#define PALMAS_USB_ID_INT_EN_LO_SET_ID_FLOAT_SHIFT 4 2465#define PALMAS_USB_ID_INT_EN_LO_SET_ID_FLOAT_SHIFT 0x04
2466#define PALMAS_USB_ID_INT_EN_LO_SET_ID_A 0x08 2466#define PALMAS_USB_ID_INT_EN_LO_SET_ID_A 0x08
2467#define PALMAS_USB_ID_INT_EN_LO_SET_ID_A_SHIFT 3 2467#define PALMAS_USB_ID_INT_EN_LO_SET_ID_A_SHIFT 0x03
2468#define PALMAS_USB_ID_INT_EN_LO_SET_ID_B 0x04 2468#define PALMAS_USB_ID_INT_EN_LO_SET_ID_B 0x04
2469#define PALMAS_USB_ID_INT_EN_LO_SET_ID_B_SHIFT 2 2469#define PALMAS_USB_ID_INT_EN_LO_SET_ID_B_SHIFT 0x02
2470#define PALMAS_USB_ID_INT_EN_LO_SET_ID_C 0x02 2470#define PALMAS_USB_ID_INT_EN_LO_SET_ID_C 0x02
2471#define PALMAS_USB_ID_INT_EN_LO_SET_ID_C_SHIFT 1 2471#define PALMAS_USB_ID_INT_EN_LO_SET_ID_C_SHIFT 0x01
2472#define PALMAS_USB_ID_INT_EN_LO_SET_ID_GND 0x01 2472#define PALMAS_USB_ID_INT_EN_LO_SET_ID_GND 0x01
2473#define PALMAS_USB_ID_INT_EN_LO_SET_ID_GND_SHIFT 0 2473#define PALMAS_USB_ID_INT_EN_LO_SET_ID_GND_SHIFT 0x00
2474 2474
2475/* Bit definitions for USB_ID_INT_EN_LO_CLR */ 2475/* Bit definitions for USB_ID_INT_EN_LO_CLR */
2476#define PALMAS_USB_ID_INT_EN_LO_CLR_ID_FLOAT 0x10 2476#define PALMAS_USB_ID_INT_EN_LO_CLR_ID_FLOAT 0x10
2477#define PALMAS_USB_ID_INT_EN_LO_CLR_ID_FLOAT_SHIFT 4 2477#define PALMAS_USB_ID_INT_EN_LO_CLR_ID_FLOAT_SHIFT 0x04
2478#define PALMAS_USB_ID_INT_EN_LO_CLR_ID_A 0x08 2478#define PALMAS_USB_ID_INT_EN_LO_CLR_ID_A 0x08
2479#define PALMAS_USB_ID_INT_EN_LO_CLR_ID_A_SHIFT 3 2479#define PALMAS_USB_ID_INT_EN_LO_CLR_ID_A_SHIFT 0x03
2480#define PALMAS_USB_ID_INT_EN_LO_CLR_ID_B 0x04 2480#define PALMAS_USB_ID_INT_EN_LO_CLR_ID_B 0x04
2481#define PALMAS_USB_ID_INT_EN_LO_CLR_ID_B_SHIFT 2 2481#define PALMAS_USB_ID_INT_EN_LO_CLR_ID_B_SHIFT 0x02
2482#define PALMAS_USB_ID_INT_EN_LO_CLR_ID_C 0x02 2482#define PALMAS_USB_ID_INT_EN_LO_CLR_ID_C 0x02
2483#define PALMAS_USB_ID_INT_EN_LO_CLR_ID_C_SHIFT 1 2483#define PALMAS_USB_ID_INT_EN_LO_CLR_ID_C_SHIFT 0x01
2484#define PALMAS_USB_ID_INT_EN_LO_CLR_ID_GND 0x01 2484#define PALMAS_USB_ID_INT_EN_LO_CLR_ID_GND 0x01
2485#define PALMAS_USB_ID_INT_EN_LO_CLR_ID_GND_SHIFT 0 2485#define PALMAS_USB_ID_INT_EN_LO_CLR_ID_GND_SHIFT 0x00
2486 2486
2487/* Bit definitions for USB_ID_INT_EN_HI_SET */ 2487/* Bit definitions for USB_ID_INT_EN_HI_SET */
2488#define PALMAS_USB_ID_INT_EN_HI_SET_ID_FLOAT 0x10 2488#define PALMAS_USB_ID_INT_EN_HI_SET_ID_FLOAT 0x10
2489#define PALMAS_USB_ID_INT_EN_HI_SET_ID_FLOAT_SHIFT 4 2489#define PALMAS_USB_ID_INT_EN_HI_SET_ID_FLOAT_SHIFT 0x04
2490#define PALMAS_USB_ID_INT_EN_HI_SET_ID_A 0x08 2490#define PALMAS_USB_ID_INT_EN_HI_SET_ID_A 0x08
2491#define PALMAS_USB_ID_INT_EN_HI_SET_ID_A_SHIFT 3 2491#define PALMAS_USB_ID_INT_EN_HI_SET_ID_A_SHIFT 0x03
2492#define PALMAS_USB_ID_INT_EN_HI_SET_ID_B 0x04 2492#define PALMAS_USB_ID_INT_EN_HI_SET_ID_B 0x04
2493#define PALMAS_USB_ID_INT_EN_HI_SET_ID_B_SHIFT 2 2493#define PALMAS_USB_ID_INT_EN_HI_SET_ID_B_SHIFT 0x02
2494#define PALMAS_USB_ID_INT_EN_HI_SET_ID_C 0x02 2494#define PALMAS_USB_ID_INT_EN_HI_SET_ID_C 0x02
2495#define PALMAS_USB_ID_INT_EN_HI_SET_ID_C_SHIFT 1 2495#define PALMAS_USB_ID_INT_EN_HI_SET_ID_C_SHIFT 0x01
2496#define PALMAS_USB_ID_INT_EN_HI_SET_ID_GND 0x01 2496#define PALMAS_USB_ID_INT_EN_HI_SET_ID_GND 0x01
2497#define PALMAS_USB_ID_INT_EN_HI_SET_ID_GND_SHIFT 0 2497#define PALMAS_USB_ID_INT_EN_HI_SET_ID_GND_SHIFT 0x00
2498 2498
2499/* Bit definitions for USB_ID_INT_EN_HI_CLR */ 2499/* Bit definitions for USB_ID_INT_EN_HI_CLR */
2500#define PALMAS_USB_ID_INT_EN_HI_CLR_ID_FLOAT 0x10 2500#define PALMAS_USB_ID_INT_EN_HI_CLR_ID_FLOAT 0x10
2501#define PALMAS_USB_ID_INT_EN_HI_CLR_ID_FLOAT_SHIFT 4 2501#define PALMAS_USB_ID_INT_EN_HI_CLR_ID_FLOAT_SHIFT 0x04
2502#define PALMAS_USB_ID_INT_EN_HI_CLR_ID_A 0x08 2502#define PALMAS_USB_ID_INT_EN_HI_CLR_ID_A 0x08
2503#define PALMAS_USB_ID_INT_EN_HI_CLR_ID_A_SHIFT 3 2503#define PALMAS_USB_ID_INT_EN_HI_CLR_ID_A_SHIFT 0x03
2504#define PALMAS_USB_ID_INT_EN_HI_CLR_ID_B 0x04 2504#define PALMAS_USB_ID_INT_EN_HI_CLR_ID_B 0x04
2505#define PALMAS_USB_ID_INT_EN_HI_CLR_ID_B_SHIFT 2 2505#define PALMAS_USB_ID_INT_EN_HI_CLR_ID_B_SHIFT 0x02
2506#define PALMAS_USB_ID_INT_EN_HI_CLR_ID_C 0x02 2506#define PALMAS_USB_ID_INT_EN_HI_CLR_ID_C 0x02
2507#define PALMAS_USB_ID_INT_EN_HI_CLR_ID_C_SHIFT 1 2507#define PALMAS_USB_ID_INT_EN_HI_CLR_ID_C_SHIFT 0x01
2508#define PALMAS_USB_ID_INT_EN_HI_CLR_ID_GND 0x01 2508#define PALMAS_USB_ID_INT_EN_HI_CLR_ID_GND 0x01
2509#define PALMAS_USB_ID_INT_EN_HI_CLR_ID_GND_SHIFT 0 2509#define PALMAS_USB_ID_INT_EN_HI_CLR_ID_GND_SHIFT 0x00
2510 2510
2511/* Bit definitions for USB_OTG_ADP_CTRL */ 2511/* Bit definitions for USB_OTG_ADP_CTRL */
2512#define PALMAS_USB_OTG_ADP_CTRL_ADP_EN 0x04 2512#define PALMAS_USB_OTG_ADP_CTRL_ADP_EN 0x04
2513#define PALMAS_USB_OTG_ADP_CTRL_ADP_EN_SHIFT 2 2513#define PALMAS_USB_OTG_ADP_CTRL_ADP_EN_SHIFT 0x02
2514#define PALMAS_USB_OTG_ADP_CTRL_ADP_MODE_MASK 0x03 2514#define PALMAS_USB_OTG_ADP_CTRL_ADP_MODE_MASK 0x03
2515#define PALMAS_USB_OTG_ADP_CTRL_ADP_MODE_SHIFT 0 2515#define PALMAS_USB_OTG_ADP_CTRL_ADP_MODE_SHIFT 0x00
2516 2516
2517/* Bit definitions for USB_OTG_ADP_HIGH */ 2517/* Bit definitions for USB_OTG_ADP_HIGH */
2518#define PALMAS_USB_OTG_ADP_HIGH_T_ADP_HIGH_MASK 0xff 2518#define PALMAS_USB_OTG_ADP_HIGH_T_ADP_HIGH_MASK 0xFF
2519#define PALMAS_USB_OTG_ADP_HIGH_T_ADP_HIGH_SHIFT 0 2519#define PALMAS_USB_OTG_ADP_HIGH_T_ADP_HIGH_SHIFT 0x00
2520 2520
2521/* Bit definitions for USB_OTG_ADP_LOW */ 2521/* Bit definitions for USB_OTG_ADP_LOW */
2522#define PALMAS_USB_OTG_ADP_LOW_T_ADP_LOW_MASK 0xff 2522#define PALMAS_USB_OTG_ADP_LOW_T_ADP_LOW_MASK 0xFF
2523#define PALMAS_USB_OTG_ADP_LOW_T_ADP_LOW_SHIFT 0 2523#define PALMAS_USB_OTG_ADP_LOW_T_ADP_LOW_SHIFT 0x00
2524 2524
2525/* Bit definitions for USB_OTG_ADP_RISE */ 2525/* Bit definitions for USB_OTG_ADP_RISE */
2526#define PALMAS_USB_OTG_ADP_RISE_T_ADP_RISE_MASK 0xff 2526#define PALMAS_USB_OTG_ADP_RISE_T_ADP_RISE_MASK 0xFF
2527#define PALMAS_USB_OTG_ADP_RISE_T_ADP_RISE_SHIFT 0 2527#define PALMAS_USB_OTG_ADP_RISE_T_ADP_RISE_SHIFT 0x00
2528 2528
2529/* Bit definitions for USB_OTG_REVISION */ 2529/* Bit definitions for USB_OTG_REVISION */
2530#define PALMAS_USB_OTG_REVISION_OTG_REV 0x01 2530#define PALMAS_USB_OTG_REVISION_OTG_REV 0x01
2531#define PALMAS_USB_OTG_REVISION_OTG_REV_SHIFT 0 2531#define PALMAS_USB_OTG_REVISION_OTG_REV_SHIFT 0x00
2532 2532
2533/* Registers for function VIBRATOR */ 2533/* Registers for function VIBRATOR */
2534#define PALMAS_VIBRA_CTRL 0x0 2534#define PALMAS_VIBRA_CTRL 0x00
2535 2535
2536/* Bit definitions for VIBRA_CTRL */ 2536/* Bit definitions for VIBRA_CTRL */
2537#define PALMAS_VIBRA_CTRL_PWM_DUTY_SEL_MASK 0x06 2537#define PALMAS_VIBRA_CTRL_PWM_DUTY_SEL_MASK 0x06
2538#define PALMAS_VIBRA_CTRL_PWM_DUTY_SEL_SHIFT 1 2538#define PALMAS_VIBRA_CTRL_PWM_DUTY_SEL_SHIFT 0x01
2539#define PALMAS_VIBRA_CTRL_PWM_FREQ_SEL 0x01 2539#define PALMAS_VIBRA_CTRL_PWM_FREQ_SEL 0x01
2540#define PALMAS_VIBRA_CTRL_PWM_FREQ_SEL_SHIFT 0 2540#define PALMAS_VIBRA_CTRL_PWM_FREQ_SEL_SHIFT 0x00
2541 2541
2542/* Registers for function GPIO */ 2542/* Registers for function GPIO */
2543#define PALMAS_GPIO_DATA_IN 0x0 2543#define PALMAS_GPIO_DATA_IN 0x00
2544#define PALMAS_GPIO_DATA_DIR 0x1 2544#define PALMAS_GPIO_DATA_DIR 0x01
2545#define PALMAS_GPIO_DATA_OUT 0x2 2545#define PALMAS_GPIO_DATA_OUT 0x02
2546#define PALMAS_GPIO_DEBOUNCE_EN 0x3 2546#define PALMAS_GPIO_DEBOUNCE_EN 0x03
2547#define PALMAS_GPIO_CLEAR_DATA_OUT 0x4 2547#define PALMAS_GPIO_CLEAR_DATA_OUT 0x04
2548#define PALMAS_GPIO_SET_DATA_OUT 0x5 2548#define PALMAS_GPIO_SET_DATA_OUT 0x05
2549#define PALMAS_PU_PD_GPIO_CTRL1 0x6 2549#define PALMAS_PU_PD_GPIO_CTRL1 0x06
2550#define PALMAS_PU_PD_GPIO_CTRL2 0x7 2550#define PALMAS_PU_PD_GPIO_CTRL2 0x07
2551#define PALMAS_OD_OUTPUT_GPIO_CTRL 0x8 2551#define PALMAS_OD_OUTPUT_GPIO_CTRL 0x08
2552#define PALMAS_GPIO_DATA_IN2 0x9 2552#define PALMAS_GPIO_DATA_IN2 0x09
2553#define PALMAS_GPIO_DATA_DIR2 0x0A 2553#define PALMAS_GPIO_DATA_DIR2 0x0A
2554#define PALMAS_GPIO_DATA_OUT2 0x0B 2554#define PALMAS_GPIO_DATA_OUT2 0x0B
2555#define PALMAS_GPIO_DEBOUNCE_EN2 0x0C 2555#define PALMAS_GPIO_DEBOUNCE_EN2 0x0C
@@ -2561,167 +2561,167 @@ enum usb_irq_events {
2561 2561
2562/* Bit definitions for GPIO_DATA_IN */ 2562/* Bit definitions for GPIO_DATA_IN */
2563#define PALMAS_GPIO_DATA_IN_GPIO_7_IN 0x80 2563#define PALMAS_GPIO_DATA_IN_GPIO_7_IN 0x80
2564#define PALMAS_GPIO_DATA_IN_GPIO_7_IN_SHIFT 7 2564#define PALMAS_GPIO_DATA_IN_GPIO_7_IN_SHIFT 0x07
2565#define PALMAS_GPIO_DATA_IN_GPIO_6_IN 0x40 2565#define PALMAS_GPIO_DATA_IN_GPIO_6_IN 0x40
2566#define PALMAS_GPIO_DATA_IN_GPIO_6_IN_SHIFT 6 2566#define PALMAS_GPIO_DATA_IN_GPIO_6_IN_SHIFT 0x06
2567#define PALMAS_GPIO_DATA_IN_GPIO_5_IN 0x20 2567#define PALMAS_GPIO_DATA_IN_GPIO_5_IN 0x20
2568#define PALMAS_GPIO_DATA_IN_GPIO_5_IN_SHIFT 5 2568#define PALMAS_GPIO_DATA_IN_GPIO_5_IN_SHIFT 0x05
2569#define PALMAS_GPIO_DATA_IN_GPIO_4_IN 0x10 2569#define PALMAS_GPIO_DATA_IN_GPIO_4_IN 0x10
2570#define PALMAS_GPIO_DATA_IN_GPIO_4_IN_SHIFT 4 2570#define PALMAS_GPIO_DATA_IN_GPIO_4_IN_SHIFT 0x04
2571#define PALMAS_GPIO_DATA_IN_GPIO_3_IN 0x08 2571#define PALMAS_GPIO_DATA_IN_GPIO_3_IN 0x08
2572#define PALMAS_GPIO_DATA_IN_GPIO_3_IN_SHIFT 3 2572#define PALMAS_GPIO_DATA_IN_GPIO_3_IN_SHIFT 0x03
2573#define PALMAS_GPIO_DATA_IN_GPIO_2_IN 0x04 2573#define PALMAS_GPIO_DATA_IN_GPIO_2_IN 0x04
2574#define PALMAS_GPIO_DATA_IN_GPIO_2_IN_SHIFT 2 2574#define PALMAS_GPIO_DATA_IN_GPIO_2_IN_SHIFT 0x02
2575#define PALMAS_GPIO_DATA_IN_GPIO_1_IN 0x02 2575#define PALMAS_GPIO_DATA_IN_GPIO_1_IN 0x02
2576#define PALMAS_GPIO_DATA_IN_GPIO_1_IN_SHIFT 1 2576#define PALMAS_GPIO_DATA_IN_GPIO_1_IN_SHIFT 0x01
2577#define PALMAS_GPIO_DATA_IN_GPIO_0_IN 0x01 2577#define PALMAS_GPIO_DATA_IN_GPIO_0_IN 0x01
2578#define PALMAS_GPIO_DATA_IN_GPIO_0_IN_SHIFT 0 2578#define PALMAS_GPIO_DATA_IN_GPIO_0_IN_SHIFT 0x00
2579 2579
2580/* Bit definitions for GPIO_DATA_DIR */ 2580/* Bit definitions for GPIO_DATA_DIR */
2581#define PALMAS_GPIO_DATA_DIR_GPIO_7_DIR 0x80 2581#define PALMAS_GPIO_DATA_DIR_GPIO_7_DIR 0x80
2582#define PALMAS_GPIO_DATA_DIR_GPIO_7_DIR_SHIFT 7 2582#define PALMAS_GPIO_DATA_DIR_GPIO_7_DIR_SHIFT 0x07
2583#define PALMAS_GPIO_DATA_DIR_GPIO_6_DIR 0x40 2583#define PALMAS_GPIO_DATA_DIR_GPIO_6_DIR 0x40
2584#define PALMAS_GPIO_DATA_DIR_GPIO_6_DIR_SHIFT 6 2584#define PALMAS_GPIO_DATA_DIR_GPIO_6_DIR_SHIFT 0x06
2585#define PALMAS_GPIO_DATA_DIR_GPIO_5_DIR 0x20 2585#define PALMAS_GPIO_DATA_DIR_GPIO_5_DIR 0x20
2586#define PALMAS_GPIO_DATA_DIR_GPIO_5_DIR_SHIFT 5 2586#define PALMAS_GPIO_DATA_DIR_GPIO_5_DIR_SHIFT 0x05
2587#define PALMAS_GPIO_DATA_DIR_GPIO_4_DIR 0x10 2587#define PALMAS_GPIO_DATA_DIR_GPIO_4_DIR 0x10
2588#define PALMAS_GPIO_DATA_DIR_GPIO_4_DIR_SHIFT 4 2588#define PALMAS_GPIO_DATA_DIR_GPIO_4_DIR_SHIFT 0x04
2589#define PALMAS_GPIO_DATA_DIR_GPIO_3_DIR 0x08 2589#define PALMAS_GPIO_DATA_DIR_GPIO_3_DIR 0x08
2590#define PALMAS_GPIO_DATA_DIR_GPIO_3_DIR_SHIFT 3 2590#define PALMAS_GPIO_DATA_DIR_GPIO_3_DIR_SHIFT 0x03
2591#define PALMAS_GPIO_DATA_DIR_GPIO_2_DIR 0x04 2591#define PALMAS_GPIO_DATA_DIR_GPIO_2_DIR 0x04
2592#define PALMAS_GPIO_DATA_DIR_GPIO_2_DIR_SHIFT 2 2592#define PALMAS_GPIO_DATA_DIR_GPIO_2_DIR_SHIFT 0x02
2593#define PALMAS_GPIO_DATA_DIR_GPIO_1_DIR 0x02 2593#define PALMAS_GPIO_DATA_DIR_GPIO_1_DIR 0x02
2594#define PALMAS_GPIO_DATA_DIR_GPIO_1_DIR_SHIFT 1 2594#define PALMAS_GPIO_DATA_DIR_GPIO_1_DIR_SHIFT 0x01
2595#define PALMAS_GPIO_DATA_DIR_GPIO_0_DIR 0x01 2595#define PALMAS_GPIO_DATA_DIR_GPIO_0_DIR 0x01
2596#define PALMAS_GPIO_DATA_DIR_GPIO_0_DIR_SHIFT 0 2596#define PALMAS_GPIO_DATA_DIR_GPIO_0_DIR_SHIFT 0x00
2597 2597
2598/* Bit definitions for GPIO_DATA_OUT */ 2598/* Bit definitions for GPIO_DATA_OUT */
2599#define PALMAS_GPIO_DATA_OUT_GPIO_7_OUT 0x80 2599#define PALMAS_GPIO_DATA_OUT_GPIO_7_OUT 0x80
2600#define PALMAS_GPIO_DATA_OUT_GPIO_7_OUT_SHIFT 7 2600#define PALMAS_GPIO_DATA_OUT_GPIO_7_OUT_SHIFT 0x07
2601#define PALMAS_GPIO_DATA_OUT_GPIO_6_OUT 0x40 2601#define PALMAS_GPIO_DATA_OUT_GPIO_6_OUT 0x40
2602#define PALMAS_GPIO_DATA_OUT_GPIO_6_OUT_SHIFT 6 2602#define PALMAS_GPIO_DATA_OUT_GPIO_6_OUT_SHIFT 0x06
2603#define PALMAS_GPIO_DATA_OUT_GPIO_5_OUT 0x20 2603#define PALMAS_GPIO_DATA_OUT_GPIO_5_OUT 0x20
2604#define PALMAS_GPIO_DATA_OUT_GPIO_5_OUT_SHIFT 5 2604#define PALMAS_GPIO_DATA_OUT_GPIO_5_OUT_SHIFT 0x05
2605#define PALMAS_GPIO_DATA_OUT_GPIO_4_OUT 0x10 2605#define PALMAS_GPIO_DATA_OUT_GPIO_4_OUT 0x10
2606#define PALMAS_GPIO_DATA_OUT_GPIO_4_OUT_SHIFT 4 2606#define PALMAS_GPIO_DATA_OUT_GPIO_4_OUT_SHIFT 0x04
2607#define PALMAS_GPIO_DATA_OUT_GPIO_3_OUT 0x08 2607#define PALMAS_GPIO_DATA_OUT_GPIO_3_OUT 0x08
2608#define PALMAS_GPIO_DATA_OUT_GPIO_3_OUT_SHIFT 3 2608#define PALMAS_GPIO_DATA_OUT_GPIO_3_OUT_SHIFT 0x03
2609#define PALMAS_GPIO_DATA_OUT_GPIO_2_OUT 0x04 2609#define PALMAS_GPIO_DATA_OUT_GPIO_2_OUT 0x04
2610#define PALMAS_GPIO_DATA_OUT_GPIO_2_OUT_SHIFT 2 2610#define PALMAS_GPIO_DATA_OUT_GPIO_2_OUT_SHIFT 0x02
2611#define PALMAS_GPIO_DATA_OUT_GPIO_1_OUT 0x02 2611#define PALMAS_GPIO_DATA_OUT_GPIO_1_OUT 0x02
2612#define PALMAS_GPIO_DATA_OUT_GPIO_1_OUT_SHIFT 1 2612#define PALMAS_GPIO_DATA_OUT_GPIO_1_OUT_SHIFT 0x01
2613#define PALMAS_GPIO_DATA_OUT_GPIO_0_OUT 0x01 2613#define PALMAS_GPIO_DATA_OUT_GPIO_0_OUT 0x01
2614#define PALMAS_GPIO_DATA_OUT_GPIO_0_OUT_SHIFT 0 2614#define PALMAS_GPIO_DATA_OUT_GPIO_0_OUT_SHIFT 0x00
2615 2615
2616/* Bit definitions for GPIO_DEBOUNCE_EN */ 2616/* Bit definitions for GPIO_DEBOUNCE_EN */
2617#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_7_DEBOUNCE_EN 0x80 2617#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_7_DEBOUNCE_EN 0x80
2618#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_7_DEBOUNCE_EN_SHIFT 7 2618#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_7_DEBOUNCE_EN_SHIFT 0x07
2619#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_6_DEBOUNCE_EN 0x40 2619#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_6_DEBOUNCE_EN 0x40
2620#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_6_DEBOUNCE_EN_SHIFT 6 2620#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_6_DEBOUNCE_EN_SHIFT 0x06
2621#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_5_DEBOUNCE_EN 0x20 2621#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_5_DEBOUNCE_EN 0x20
2622#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_5_DEBOUNCE_EN_SHIFT 5 2622#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_5_DEBOUNCE_EN_SHIFT 0x05
2623#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_4_DEBOUNCE_EN 0x10 2623#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_4_DEBOUNCE_EN 0x10
2624#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_4_DEBOUNCE_EN_SHIFT 4 2624#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_4_DEBOUNCE_EN_SHIFT 0x04
2625#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_3_DEBOUNCE_EN 0x08 2625#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_3_DEBOUNCE_EN 0x08
2626#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_3_DEBOUNCE_EN_SHIFT 3 2626#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_3_DEBOUNCE_EN_SHIFT 0x03
2627#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_2_DEBOUNCE_EN 0x04 2627#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_2_DEBOUNCE_EN 0x04
2628#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_2_DEBOUNCE_EN_SHIFT 2 2628#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_2_DEBOUNCE_EN_SHIFT 0x02
2629#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_1_DEBOUNCE_EN 0x02 2629#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_1_DEBOUNCE_EN 0x02
2630#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_1_DEBOUNCE_EN_SHIFT 1 2630#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_1_DEBOUNCE_EN_SHIFT 0x01
2631#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_0_DEBOUNCE_EN 0x01 2631#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_0_DEBOUNCE_EN 0x01
2632#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_0_DEBOUNCE_EN_SHIFT 0 2632#define PALMAS_GPIO_DEBOUNCE_EN_GPIO_0_DEBOUNCE_EN_SHIFT 0x00
2633 2633
2634/* Bit definitions for GPIO_CLEAR_DATA_OUT */ 2634/* Bit definitions for GPIO_CLEAR_DATA_OUT */
2635#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_7_CLEAR_DATA_OUT 0x80 2635#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_7_CLEAR_DATA_OUT 0x80
2636#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_7_CLEAR_DATA_OUT_SHIFT 7 2636#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_7_CLEAR_DATA_OUT_SHIFT 0x07
2637#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_6_CLEAR_DATA_OUT 0x40 2637#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_6_CLEAR_DATA_OUT 0x40
2638#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_6_CLEAR_DATA_OUT_SHIFT 6 2638#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_6_CLEAR_DATA_OUT_SHIFT 0x06
2639#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_5_CLEAR_DATA_OUT 0x20 2639#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_5_CLEAR_DATA_OUT 0x20
2640#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_5_CLEAR_DATA_OUT_SHIFT 5 2640#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_5_CLEAR_DATA_OUT_SHIFT 0x05
2641#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_4_CLEAR_DATA_OUT 0x10 2641#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_4_CLEAR_DATA_OUT 0x10
2642#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_4_CLEAR_DATA_OUT_SHIFT 4 2642#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_4_CLEAR_DATA_OUT_SHIFT 0x04
2643#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_3_CLEAR_DATA_OUT 0x08 2643#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_3_CLEAR_DATA_OUT 0x08
2644#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_3_CLEAR_DATA_OUT_SHIFT 3 2644#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_3_CLEAR_DATA_OUT_SHIFT 0x03
2645#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_2_CLEAR_DATA_OUT 0x04 2645#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_2_CLEAR_DATA_OUT 0x04
2646#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_2_CLEAR_DATA_OUT_SHIFT 2 2646#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_2_CLEAR_DATA_OUT_SHIFT 0x02
2647#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_1_CLEAR_DATA_OUT 0x02 2647#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_1_CLEAR_DATA_OUT 0x02
2648#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_1_CLEAR_DATA_OUT_SHIFT 1 2648#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_1_CLEAR_DATA_OUT_SHIFT 0x01
2649#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_0_CLEAR_DATA_OUT 0x01 2649#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_0_CLEAR_DATA_OUT 0x01
2650#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_0_CLEAR_DATA_OUT_SHIFT 0 2650#define PALMAS_GPIO_CLEAR_DATA_OUT_GPIO_0_CLEAR_DATA_OUT_SHIFT 0x00
2651 2651
2652/* Bit definitions for GPIO_SET_DATA_OUT */ 2652/* Bit definitions for GPIO_SET_DATA_OUT */
2653#define PALMAS_GPIO_SET_DATA_OUT_GPIO_7_SET_DATA_OUT 0x80 2653#define PALMAS_GPIO_SET_DATA_OUT_GPIO_7_SET_DATA_OUT 0x80
2654#define PALMAS_GPIO_SET_DATA_OUT_GPIO_7_SET_DATA_OUT_SHIFT 7 2654#define PALMAS_GPIO_SET_DATA_OUT_GPIO_7_SET_DATA_OUT_SHIFT 0x07
2655#define PALMAS_GPIO_SET_DATA_OUT_GPIO_6_SET_DATA_OUT 0x40 2655#define PALMAS_GPIO_SET_DATA_OUT_GPIO_6_SET_DATA_OUT 0x40
2656#define PALMAS_GPIO_SET_DATA_OUT_GPIO_6_SET_DATA_OUT_SHIFT 6 2656#define PALMAS_GPIO_SET_DATA_OUT_GPIO_6_SET_DATA_OUT_SHIFT 0x06
2657#define PALMAS_GPIO_SET_DATA_OUT_GPIO_5_SET_DATA_OUT 0x20 2657#define PALMAS_GPIO_SET_DATA_OUT_GPIO_5_SET_DATA_OUT 0x20
2658#define PALMAS_GPIO_SET_DATA_OUT_GPIO_5_SET_DATA_OUT_SHIFT 5 2658#define PALMAS_GPIO_SET_DATA_OUT_GPIO_5_SET_DATA_OUT_SHIFT 0x05
2659#define PALMAS_GPIO_SET_DATA_OUT_GPIO_4_SET_DATA_OUT 0x10 2659#define PALMAS_GPIO_SET_DATA_OUT_GPIO_4_SET_DATA_OUT 0x10
2660#define PALMAS_GPIO_SET_DATA_OUT_GPIO_4_SET_DATA_OUT_SHIFT 4 2660#define PALMAS_GPIO_SET_DATA_OUT_GPIO_4_SET_DATA_OUT_SHIFT 0x04
2661#define PALMAS_GPIO_SET_DATA_OUT_GPIO_3_SET_DATA_OUT 0x08 2661#define PALMAS_GPIO_SET_DATA_OUT_GPIO_3_SET_DATA_OUT 0x08
2662#define PALMAS_GPIO_SET_DATA_OUT_GPIO_3_SET_DATA_OUT_SHIFT 3 2662#define PALMAS_GPIO_SET_DATA_OUT_GPIO_3_SET_DATA_OUT_SHIFT 0x03
2663#define PALMAS_GPIO_SET_DATA_OUT_GPIO_2_SET_DATA_OUT 0x04 2663#define PALMAS_GPIO_SET_DATA_OUT_GPIO_2_SET_DATA_OUT 0x04
2664#define PALMAS_GPIO_SET_DATA_OUT_GPIO_2_SET_DATA_OUT_SHIFT 2 2664#define PALMAS_GPIO_SET_DATA_OUT_GPIO_2_SET_DATA_OUT_SHIFT 0x02
2665#define PALMAS_GPIO_SET_DATA_OUT_GPIO_1_SET_DATA_OUT 0x02 2665#define PALMAS_GPIO_SET_DATA_OUT_GPIO_1_SET_DATA_OUT 0x02
2666#define PALMAS_GPIO_SET_DATA_OUT_GPIO_1_SET_DATA_OUT_SHIFT 1 2666#define PALMAS_GPIO_SET_DATA_OUT_GPIO_1_SET_DATA_OUT_SHIFT 0x01
2667#define PALMAS_GPIO_SET_DATA_OUT_GPIO_0_SET_DATA_OUT 0x01 2667#define PALMAS_GPIO_SET_DATA_OUT_GPIO_0_SET_DATA_OUT 0x01
2668#define PALMAS_GPIO_SET_DATA_OUT_GPIO_0_SET_DATA_OUT_SHIFT 0 2668#define PALMAS_GPIO_SET_DATA_OUT_GPIO_0_SET_DATA_OUT_SHIFT 0x00
2669 2669
2670/* Bit definitions for PU_PD_GPIO_CTRL1 */ 2670/* Bit definitions for PU_PD_GPIO_CTRL1 */
2671#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_3_PD 0x40 2671#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_3_PD 0x40
2672#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_3_PD_SHIFT 6 2672#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_3_PD_SHIFT 0x06
2673#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_2_PU 0x20 2673#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_2_PU 0x20
2674#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_2_PU_SHIFT 5 2674#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_2_PU_SHIFT 0x05
2675#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_2_PD 0x10 2675#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_2_PD 0x10
2676#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_2_PD_SHIFT 4 2676#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_2_PD_SHIFT 0x04
2677#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_1_PU 0x08 2677#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_1_PU 0x08
2678#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_1_PU_SHIFT 3 2678#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_1_PU_SHIFT 0x03
2679#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_1_PD 0x04 2679#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_1_PD 0x04
2680#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_1_PD_SHIFT 2 2680#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_1_PD_SHIFT 0x02
2681#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_0_PD 0x01 2681#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_0_PD 0x01
2682#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_0_PD_SHIFT 0 2682#define PALMAS_PU_PD_GPIO_CTRL1_GPIO_0_PD_SHIFT 0x00
2683 2683
2684/* Bit definitions for PU_PD_GPIO_CTRL2 */ 2684/* Bit definitions for PU_PD_GPIO_CTRL2 */
2685#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_7_PD 0x40 2685#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_7_PD 0x40
2686#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_7_PD_SHIFT 6 2686#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_7_PD_SHIFT 0x06
2687#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_6_PU 0x20 2687#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_6_PU 0x20
2688#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_6_PU_SHIFT 5 2688#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_6_PU_SHIFT 0x05
2689#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_6_PD 0x10 2689#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_6_PD 0x10
2690#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_6_PD_SHIFT 4 2690#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_6_PD_SHIFT 0x04
2691#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_5_PU 0x08 2691#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_5_PU 0x08
2692#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_5_PU_SHIFT 3 2692#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_5_PU_SHIFT 0x03
2693#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_5_PD 0x04 2693#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_5_PD 0x04
2694#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_5_PD_SHIFT 2 2694#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_5_PD_SHIFT 0x02
2695#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_4_PU 0x02 2695#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_4_PU 0x02
2696#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_4_PU_SHIFT 1 2696#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_4_PU_SHIFT 0x01
2697#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_4_PD 0x01 2697#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_4_PD 0x01
2698#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_4_PD_SHIFT 0 2698#define PALMAS_PU_PD_GPIO_CTRL2_GPIO_4_PD_SHIFT 0x00
2699 2699
2700/* Bit definitions for OD_OUTPUT_GPIO_CTRL */ 2700/* Bit definitions for OD_OUTPUT_GPIO_CTRL */
2701#define PALMAS_OD_OUTPUT_GPIO_CTRL_GPIO_5_OD 0x20 2701#define PALMAS_OD_OUTPUT_GPIO_CTRL_GPIO_5_OD 0x20
2702#define PALMAS_OD_OUTPUT_GPIO_CTRL_GPIO_5_OD_SHIFT 5 2702#define PALMAS_OD_OUTPUT_GPIO_CTRL_GPIO_5_OD_SHIFT 0x05
2703#define PALMAS_OD_OUTPUT_GPIO_CTRL_GPIO_2_OD 0x04 2703#define PALMAS_OD_OUTPUT_GPIO_CTRL_GPIO_2_OD 0x04
2704#define PALMAS_OD_OUTPUT_GPIO_CTRL_GPIO_2_OD_SHIFT 2 2704#define PALMAS_OD_OUTPUT_GPIO_CTRL_GPIO_2_OD_SHIFT 0x02
2705#define PALMAS_OD_OUTPUT_GPIO_CTRL_GPIO_1_OD 0x02 2705#define PALMAS_OD_OUTPUT_GPIO_CTRL_GPIO_1_OD 0x02
2706#define PALMAS_OD_OUTPUT_GPIO_CTRL_GPIO_1_OD_SHIFT 1 2706#define PALMAS_OD_OUTPUT_GPIO_CTRL_GPIO_1_OD_SHIFT 0x01
2707 2707
2708/* Registers for function GPADC */ 2708/* Registers for function GPADC */
2709#define PALMAS_GPADC_CTRL1 0x0 2709#define PALMAS_GPADC_CTRL1 0x00
2710#define PALMAS_GPADC_CTRL2 0x1 2710#define PALMAS_GPADC_CTRL2 0x01
2711#define PALMAS_GPADC_RT_CTRL 0x2 2711#define PALMAS_GPADC_RT_CTRL 0x02
2712#define PALMAS_GPADC_AUTO_CTRL 0x3 2712#define PALMAS_GPADC_AUTO_CTRL 0x03
2713#define PALMAS_GPADC_STATUS 0x4 2713#define PALMAS_GPADC_STATUS 0x04
2714#define PALMAS_GPADC_RT_SELECT 0x5 2714#define PALMAS_GPADC_RT_SELECT 0x05
2715#define PALMAS_GPADC_RT_CONV0_LSB 0x6 2715#define PALMAS_GPADC_RT_CONV0_LSB 0x06
2716#define PALMAS_GPADC_RT_CONV0_MSB 0x7 2716#define PALMAS_GPADC_RT_CONV0_MSB 0x07
2717#define PALMAS_GPADC_AUTO_SELECT 0x8 2717#define PALMAS_GPADC_AUTO_SELECT 0x08
2718#define PALMAS_GPADC_AUTO_CONV0_LSB 0x9 2718#define PALMAS_GPADC_AUTO_CONV0_LSB 0x09
2719#define PALMAS_GPADC_AUTO_CONV0_MSB 0xA 2719#define PALMAS_GPADC_AUTO_CONV0_MSB 0x0A
2720#define PALMAS_GPADC_AUTO_CONV1_LSB 0xB 2720#define PALMAS_GPADC_AUTO_CONV1_LSB 0x0B
2721#define PALMAS_GPADC_AUTO_CONV1_MSB 0xC 2721#define PALMAS_GPADC_AUTO_CONV1_MSB 0x0C
2722#define PALMAS_GPADC_SW_SELECT 0xD 2722#define PALMAS_GPADC_SW_SELECT 0x0D
2723#define PALMAS_GPADC_SW_CONV0_LSB 0xE 2723#define PALMAS_GPADC_SW_CONV0_LSB 0x0E
2724#define PALMAS_GPADC_SW_CONV0_MSB 0xF 2724#define PALMAS_GPADC_SW_CONV0_MSB 0x0F
2725#define PALMAS_GPADC_THRES_CONV0_LSB 0x10 2725#define PALMAS_GPADC_THRES_CONV0_LSB 0x10
2726#define PALMAS_GPADC_THRES_CONV0_MSB 0x11 2726#define PALMAS_GPADC_THRES_CONV0_MSB 0x11
2727#define PALMAS_GPADC_THRES_CONV1_LSB 0x12 2727#define PALMAS_GPADC_THRES_CONV1_LSB 0x12
@@ -2731,150 +2731,150 @@ enum usb_irq_events {
2731 2731
2732/* Bit definitions for GPADC_CTRL1 */ 2732/* Bit definitions for GPADC_CTRL1 */
2733#define PALMAS_GPADC_CTRL1_RESERVED_MASK 0xc0 2733#define PALMAS_GPADC_CTRL1_RESERVED_MASK 0xc0
2734#define PALMAS_GPADC_CTRL1_RESERVED_SHIFT 6 2734#define PALMAS_GPADC_CTRL1_RESERVED_SHIFT 0x06
2735#define PALMAS_GPADC_CTRL1_CURRENT_SRC_CH3_MASK 0x30 2735#define PALMAS_GPADC_CTRL1_CURRENT_SRC_CH3_MASK 0x30
2736#define PALMAS_GPADC_CTRL1_CURRENT_SRC_CH3_SHIFT 4 2736#define PALMAS_GPADC_CTRL1_CURRENT_SRC_CH3_SHIFT 0x04
2737#define PALMAS_GPADC_CTRL1_CURRENT_SRC_CH0_MASK 0x0c 2737#define PALMAS_GPADC_CTRL1_CURRENT_SRC_CH0_MASK 0x0c
2738#define PALMAS_GPADC_CTRL1_CURRENT_SRC_CH0_SHIFT 2 2738#define PALMAS_GPADC_CTRL1_CURRENT_SRC_CH0_SHIFT 0x02
2739#define PALMAS_GPADC_CTRL1_BAT_REMOVAL_DET 0x02 2739#define PALMAS_GPADC_CTRL1_BAT_REMOVAL_DET 0x02
2740#define PALMAS_GPADC_CTRL1_BAT_REMOVAL_DET_SHIFT 1 2740#define PALMAS_GPADC_CTRL1_BAT_REMOVAL_DET_SHIFT 0x01
2741#define PALMAS_GPADC_CTRL1_GPADC_FORCE 0x01 2741#define PALMAS_GPADC_CTRL1_GPADC_FORCE 0x01
2742#define PALMAS_GPADC_CTRL1_GPADC_FORCE_SHIFT 0 2742#define PALMAS_GPADC_CTRL1_GPADC_FORCE_SHIFT 0x00
2743 2743
2744/* Bit definitions for GPADC_CTRL2 */ 2744/* Bit definitions for GPADC_CTRL2 */
2745#define PALMAS_GPADC_CTRL2_RESERVED_MASK 0x06 2745#define PALMAS_GPADC_CTRL2_RESERVED_MASK 0x06
2746#define PALMAS_GPADC_CTRL2_RESERVED_SHIFT 1 2746#define PALMAS_GPADC_CTRL2_RESERVED_SHIFT 0x01
2747 2747
2748/* Bit definitions for GPADC_RT_CTRL */ 2748/* Bit definitions for GPADC_RT_CTRL */
2749#define PALMAS_GPADC_RT_CTRL_EXTEND_DELAY 0x02 2749#define PALMAS_GPADC_RT_CTRL_EXTEND_DELAY 0x02
2750#define PALMAS_GPADC_RT_CTRL_EXTEND_DELAY_SHIFT 1 2750#define PALMAS_GPADC_RT_CTRL_EXTEND_DELAY_SHIFT 0x01
2751#define PALMAS_GPADC_RT_CTRL_START_POLARITY 0x01 2751#define PALMAS_GPADC_RT_CTRL_START_POLARITY 0x01
2752#define PALMAS_GPADC_RT_CTRL_START_POLARITY_SHIFT 0 2752#define PALMAS_GPADC_RT_CTRL_START_POLARITY_SHIFT 0x00
2753 2753
2754/* Bit definitions for GPADC_AUTO_CTRL */ 2754/* Bit definitions for GPADC_AUTO_CTRL */
2755#define PALMAS_GPADC_AUTO_CTRL_SHUTDOWN_CONV1 0x80 2755#define PALMAS_GPADC_AUTO_CTRL_SHUTDOWN_CONV1 0x80
2756#define PALMAS_GPADC_AUTO_CTRL_SHUTDOWN_CONV1_SHIFT 7 2756#define PALMAS_GPADC_AUTO_CTRL_SHUTDOWN_CONV1_SHIFT 0x07
2757#define PALMAS_GPADC_AUTO_CTRL_SHUTDOWN_CONV0 0x40 2757#define PALMAS_GPADC_AUTO_CTRL_SHUTDOWN_CONV0 0x40
2758#define PALMAS_GPADC_AUTO_CTRL_SHUTDOWN_CONV0_SHIFT 6 2758#define PALMAS_GPADC_AUTO_CTRL_SHUTDOWN_CONV0_SHIFT 0x06
2759#define PALMAS_GPADC_AUTO_CTRL_AUTO_CONV1_EN 0x20 2759#define PALMAS_GPADC_AUTO_CTRL_AUTO_CONV1_EN 0x20
2760#define PALMAS_GPADC_AUTO_CTRL_AUTO_CONV1_EN_SHIFT 5 2760#define PALMAS_GPADC_AUTO_CTRL_AUTO_CONV1_EN_SHIFT 0x05
2761#define PALMAS_GPADC_AUTO_CTRL_AUTO_CONV0_EN 0x10 2761#define PALMAS_GPADC_AUTO_CTRL_AUTO_CONV0_EN 0x10
2762#define PALMAS_GPADC_AUTO_CTRL_AUTO_CONV0_EN_SHIFT 4 2762#define PALMAS_GPADC_AUTO_CTRL_AUTO_CONV0_EN_SHIFT 0x04
2763#define PALMAS_GPADC_AUTO_CTRL_COUNTER_CONV_MASK 0x0f 2763#define PALMAS_GPADC_AUTO_CTRL_COUNTER_CONV_MASK 0x0F
2764#define PALMAS_GPADC_AUTO_CTRL_COUNTER_CONV_SHIFT 0 2764#define PALMAS_GPADC_AUTO_CTRL_COUNTER_CONV_SHIFT 0x00
2765 2765
2766/* Bit definitions for GPADC_STATUS */ 2766/* Bit definitions for GPADC_STATUS */
2767#define PALMAS_GPADC_STATUS_GPADC_AVAILABLE 0x10 2767#define PALMAS_GPADC_STATUS_GPADC_AVAILABLE 0x10
2768#define PALMAS_GPADC_STATUS_GPADC_AVAILABLE_SHIFT 4 2768#define PALMAS_GPADC_STATUS_GPADC_AVAILABLE_SHIFT 0x04
2769 2769
2770/* Bit definitions for GPADC_RT_SELECT */ 2770/* Bit definitions for GPADC_RT_SELECT */
2771#define PALMAS_GPADC_RT_SELECT_RT_CONV_EN 0x80 2771#define PALMAS_GPADC_RT_SELECT_RT_CONV_EN 0x80
2772#define PALMAS_GPADC_RT_SELECT_RT_CONV_EN_SHIFT 7 2772#define PALMAS_GPADC_RT_SELECT_RT_CONV_EN_SHIFT 0x07
2773#define PALMAS_GPADC_RT_SELECT_RT_CONV0_SEL_MASK 0x0f 2773#define PALMAS_GPADC_RT_SELECT_RT_CONV0_SEL_MASK 0x0F
2774#define PALMAS_GPADC_RT_SELECT_RT_CONV0_SEL_SHIFT 0 2774#define PALMAS_GPADC_RT_SELECT_RT_CONV0_SEL_SHIFT 0x00
2775 2775
2776/* Bit definitions for GPADC_RT_CONV0_LSB */ 2776/* Bit definitions for GPADC_RT_CONV0_LSB */
2777#define PALMAS_GPADC_RT_CONV0_LSB_RT_CONV0_LSB_MASK 0xff 2777#define PALMAS_GPADC_RT_CONV0_LSB_RT_CONV0_LSB_MASK 0xFF
2778#define PALMAS_GPADC_RT_CONV0_LSB_RT_CONV0_LSB_SHIFT 0 2778#define PALMAS_GPADC_RT_CONV0_LSB_RT_CONV0_LSB_SHIFT 0x00
2779 2779
2780/* Bit definitions for GPADC_RT_CONV0_MSB */ 2780/* Bit definitions for GPADC_RT_CONV0_MSB */
2781#define PALMAS_GPADC_RT_CONV0_MSB_RT_CONV0_MSB_MASK 0x0f 2781#define PALMAS_GPADC_RT_CONV0_MSB_RT_CONV0_MSB_MASK 0x0F
2782#define PALMAS_GPADC_RT_CONV0_MSB_RT_CONV0_MSB_SHIFT 0 2782#define PALMAS_GPADC_RT_CONV0_MSB_RT_CONV0_MSB_SHIFT 0x00
2783 2783
2784/* Bit definitions for GPADC_AUTO_SELECT */ 2784/* Bit definitions for GPADC_AUTO_SELECT */
2785#define PALMAS_GPADC_AUTO_SELECT_AUTO_CONV1_SEL_MASK 0xf0 2785#define PALMAS_GPADC_AUTO_SELECT_AUTO_CONV1_SEL_MASK 0xF0
2786#define PALMAS_GPADC_AUTO_SELECT_AUTO_CONV1_SEL_SHIFT 4 2786#define PALMAS_GPADC_AUTO_SELECT_AUTO_CONV1_SEL_SHIFT 0x04
2787#define PALMAS_GPADC_AUTO_SELECT_AUTO_CONV0_SEL_MASK 0x0f 2787#define PALMAS_GPADC_AUTO_SELECT_AUTO_CONV0_SEL_MASK 0x0F
2788#define PALMAS_GPADC_AUTO_SELECT_AUTO_CONV0_SEL_SHIFT 0 2788#define PALMAS_GPADC_AUTO_SELECT_AUTO_CONV0_SEL_SHIFT 0x00
2789 2789
2790/* Bit definitions for GPADC_AUTO_CONV0_LSB */ 2790/* Bit definitions for GPADC_AUTO_CONV0_LSB */
2791#define PALMAS_GPADC_AUTO_CONV0_LSB_AUTO_CONV0_LSB_MASK 0xff 2791#define PALMAS_GPADC_AUTO_CONV0_LSB_AUTO_CONV0_LSB_MASK 0xFF
2792#define PALMAS_GPADC_AUTO_CONV0_LSB_AUTO_CONV0_LSB_SHIFT 0 2792#define PALMAS_GPADC_AUTO_CONV0_LSB_AUTO_CONV0_LSB_SHIFT 0x00
2793 2793
2794/* Bit definitions for GPADC_AUTO_CONV0_MSB */ 2794/* Bit definitions for GPADC_AUTO_CONV0_MSB */
2795#define PALMAS_GPADC_AUTO_CONV0_MSB_AUTO_CONV0_MSB_MASK 0x0f 2795#define PALMAS_GPADC_AUTO_CONV0_MSB_AUTO_CONV0_MSB_MASK 0x0F
2796#define PALMAS_GPADC_AUTO_CONV0_MSB_AUTO_CONV0_MSB_SHIFT 0 2796#define PALMAS_GPADC_AUTO_CONV0_MSB_AUTO_CONV0_MSB_SHIFT 0x00
2797 2797
2798/* Bit definitions for GPADC_AUTO_CONV1_LSB */ 2798/* Bit definitions for GPADC_AUTO_CONV1_LSB */
2799#define PALMAS_GPADC_AUTO_CONV1_LSB_AUTO_CONV1_LSB_MASK 0xff 2799#define PALMAS_GPADC_AUTO_CONV1_LSB_AUTO_CONV1_LSB_MASK 0xFF
2800#define PALMAS_GPADC_AUTO_CONV1_LSB_AUTO_CONV1_LSB_SHIFT 0 2800#define PALMAS_GPADC_AUTO_CONV1_LSB_AUTO_CONV1_LSB_SHIFT 0x00
2801 2801
2802/* Bit definitions for GPADC_AUTO_CONV1_MSB */ 2802/* Bit definitions for GPADC_AUTO_CONV1_MSB */
2803#define PALMAS_GPADC_AUTO_CONV1_MSB_AUTO_CONV1_MSB_MASK 0x0f 2803#define PALMAS_GPADC_AUTO_CONV1_MSB_AUTO_CONV1_MSB_MASK 0x0F
2804#define PALMAS_GPADC_AUTO_CONV1_MSB_AUTO_CONV1_MSB_SHIFT 0 2804#define PALMAS_GPADC_AUTO_CONV1_MSB_AUTO_CONV1_MSB_SHIFT 0x00
2805 2805
2806/* Bit definitions for GPADC_SW_SELECT */ 2806/* Bit definitions for GPADC_SW_SELECT */
2807#define PALMAS_GPADC_SW_SELECT_SW_CONV_EN 0x80 2807#define PALMAS_GPADC_SW_SELECT_SW_CONV_EN 0x80
2808#define PALMAS_GPADC_SW_SELECT_SW_CONV_EN_SHIFT 7 2808#define PALMAS_GPADC_SW_SELECT_SW_CONV_EN_SHIFT 0x07
2809#define PALMAS_GPADC_SW_SELECT_SW_START_CONV0 0x10 2809#define PALMAS_GPADC_SW_SELECT_SW_START_CONV0 0x10
2810#define PALMAS_GPADC_SW_SELECT_SW_START_CONV0_SHIFT 4 2810#define PALMAS_GPADC_SW_SELECT_SW_START_CONV0_SHIFT 0x04
2811#define PALMAS_GPADC_SW_SELECT_SW_CONV0_SEL_MASK 0x0f 2811#define PALMAS_GPADC_SW_SELECT_SW_CONV0_SEL_MASK 0x0F
2812#define PALMAS_GPADC_SW_SELECT_SW_CONV0_SEL_SHIFT 0 2812#define PALMAS_GPADC_SW_SELECT_SW_CONV0_SEL_SHIFT 0x00
2813 2813
2814/* Bit definitions for GPADC_SW_CONV0_LSB */ 2814/* Bit definitions for GPADC_SW_CONV0_LSB */
2815#define PALMAS_GPADC_SW_CONV0_LSB_SW_CONV0_LSB_MASK 0xff 2815#define PALMAS_GPADC_SW_CONV0_LSB_SW_CONV0_LSB_MASK 0xFF
2816#define PALMAS_GPADC_SW_CONV0_LSB_SW_CONV0_LSB_SHIFT 0 2816#define PALMAS_GPADC_SW_CONV0_LSB_SW_CONV0_LSB_SHIFT 0x00
2817 2817
2818/* Bit definitions for GPADC_SW_CONV0_MSB */ 2818/* Bit definitions for GPADC_SW_CONV0_MSB */
2819#define PALMAS_GPADC_SW_CONV0_MSB_SW_CONV0_MSB_MASK 0x0f 2819#define PALMAS_GPADC_SW_CONV0_MSB_SW_CONV0_MSB_MASK 0x0F
2820#define PALMAS_GPADC_SW_CONV0_MSB_SW_CONV0_MSB_SHIFT 0 2820#define PALMAS_GPADC_SW_CONV0_MSB_SW_CONV0_MSB_SHIFT 0x00
2821 2821
2822/* Bit definitions for GPADC_THRES_CONV0_LSB */ 2822/* Bit definitions for GPADC_THRES_CONV0_LSB */
2823#define PALMAS_GPADC_THRES_CONV0_LSB_THRES_CONV0_LSB_MASK 0xff 2823#define PALMAS_GPADC_THRES_CONV0_LSB_THRES_CONV0_LSB_MASK 0xFF
2824#define PALMAS_GPADC_THRES_CONV0_LSB_THRES_CONV0_LSB_SHIFT 0 2824#define PALMAS_GPADC_THRES_CONV0_LSB_THRES_CONV0_LSB_SHIFT 0x00
2825 2825
2826/* Bit definitions for GPADC_THRES_CONV0_MSB */ 2826/* Bit definitions for GPADC_THRES_CONV0_MSB */
2827#define PALMAS_GPADC_THRES_CONV0_MSB_THRES_CONV0_POL 0x80 2827#define PALMAS_GPADC_THRES_CONV0_MSB_THRES_CONV0_POL 0x80
2828#define PALMAS_GPADC_THRES_CONV0_MSB_THRES_CONV0_POL_SHIFT 7 2828#define PALMAS_GPADC_THRES_CONV0_MSB_THRES_CONV0_POL_SHIFT 0x07
2829#define PALMAS_GPADC_THRES_CONV0_MSB_THRES_CONV0_MSB_MASK 0x0f 2829#define PALMAS_GPADC_THRES_CONV0_MSB_THRES_CONV0_MSB_MASK 0x0F
2830#define PALMAS_GPADC_THRES_CONV0_MSB_THRES_CONV0_MSB_SHIFT 0 2830#define PALMAS_GPADC_THRES_CONV0_MSB_THRES_CONV0_MSB_SHIFT 0x00
2831 2831
2832/* Bit definitions for GPADC_THRES_CONV1_LSB */ 2832/* Bit definitions for GPADC_THRES_CONV1_LSB */
2833#define PALMAS_GPADC_THRES_CONV1_LSB_THRES_CONV1_LSB_MASK 0xff 2833#define PALMAS_GPADC_THRES_CONV1_LSB_THRES_CONV1_LSB_MASK 0xFF
2834#define PALMAS_GPADC_THRES_CONV1_LSB_THRES_CONV1_LSB_SHIFT 0 2834#define PALMAS_GPADC_THRES_CONV1_LSB_THRES_CONV1_LSB_SHIFT 0x00
2835 2835
2836/* Bit definitions for GPADC_THRES_CONV1_MSB */ 2836/* Bit definitions for GPADC_THRES_CONV1_MSB */
2837#define PALMAS_GPADC_THRES_CONV1_MSB_THRES_CONV1_POL 0x80 2837#define PALMAS_GPADC_THRES_CONV1_MSB_THRES_CONV1_POL 0x80
2838#define PALMAS_GPADC_THRES_CONV1_MSB_THRES_CONV1_POL_SHIFT 7 2838#define PALMAS_GPADC_THRES_CONV1_MSB_THRES_CONV1_POL_SHIFT 0x07
2839#define PALMAS_GPADC_THRES_CONV1_MSB_THRES_CONV1_MSB_MASK 0x0f 2839#define PALMAS_GPADC_THRES_CONV1_MSB_THRES_CONV1_MSB_MASK 0x0F
2840#define PALMAS_GPADC_THRES_CONV1_MSB_THRES_CONV1_MSB_SHIFT 0 2840#define PALMAS_GPADC_THRES_CONV1_MSB_THRES_CONV1_MSB_SHIFT 0x00
2841 2841
2842/* Bit definitions for GPADC_SMPS_ILMONITOR_EN */ 2842/* Bit definitions for GPADC_SMPS_ILMONITOR_EN */
2843#define PALMAS_GPADC_SMPS_ILMONITOR_EN_SMPS_ILMON_EN 0x20 2843#define PALMAS_GPADC_SMPS_ILMONITOR_EN_SMPS_ILMON_EN 0x20
2844#define PALMAS_GPADC_SMPS_ILMONITOR_EN_SMPS_ILMON_EN_SHIFT 5 2844#define PALMAS_GPADC_SMPS_ILMONITOR_EN_SMPS_ILMON_EN_SHIFT 0x05
2845#define PALMAS_GPADC_SMPS_ILMONITOR_EN_SMPS_ILMON_REXT 0x10 2845#define PALMAS_GPADC_SMPS_ILMONITOR_EN_SMPS_ILMON_REXT 0x10
2846#define PALMAS_GPADC_SMPS_ILMONITOR_EN_SMPS_ILMON_REXT_SHIFT 4 2846#define PALMAS_GPADC_SMPS_ILMONITOR_EN_SMPS_ILMON_REXT_SHIFT 0x04
2847#define PALMAS_GPADC_SMPS_ILMONITOR_EN_SMPS_ILMON_SEL_MASK 0x0f 2847#define PALMAS_GPADC_SMPS_ILMONITOR_EN_SMPS_ILMON_SEL_MASK 0x0F
2848#define PALMAS_GPADC_SMPS_ILMONITOR_EN_SMPS_ILMON_SEL_SHIFT 0 2848#define PALMAS_GPADC_SMPS_ILMONITOR_EN_SMPS_ILMON_SEL_SHIFT 0x00
2849 2849
2850/* Bit definitions for GPADC_SMPS_VSEL_MONITORING */ 2850/* Bit definitions for GPADC_SMPS_VSEL_MONITORING */
2851#define PALMAS_GPADC_SMPS_VSEL_MONITORING_ACTIVE_PHASE 0x80 2851#define PALMAS_GPADC_SMPS_VSEL_MONITORING_ACTIVE_PHASE 0x80
2852#define PALMAS_GPADC_SMPS_VSEL_MONITORING_ACTIVE_PHASE_SHIFT 7 2852#define PALMAS_GPADC_SMPS_VSEL_MONITORING_ACTIVE_PHASE_SHIFT 0x07
2853#define PALMAS_GPADC_SMPS_VSEL_MONITORING_SMPS_VSEL_MONITORING_MASK 0x7f 2853#define PALMAS_GPADC_SMPS_VSEL_MONITORING_SMPS_VSEL_MONITORING_MASK 0x7F
2854#define PALMAS_GPADC_SMPS_VSEL_MONITORING_SMPS_VSEL_MONITORING_SHIFT 0 2854#define PALMAS_GPADC_SMPS_VSEL_MONITORING_SMPS_VSEL_MONITORING_SHIFT 0x00
2855 2855
2856/* Registers for function GPADC */ 2856/* Registers for function GPADC */
2857#define PALMAS_GPADC_TRIM1 0x0 2857#define PALMAS_GPADC_TRIM1 0x00
2858#define PALMAS_GPADC_TRIM2 0x1 2858#define PALMAS_GPADC_TRIM2 0x01
2859#define PALMAS_GPADC_TRIM3 0x2 2859#define PALMAS_GPADC_TRIM3 0x02
2860#define PALMAS_GPADC_TRIM4 0x3 2860#define PALMAS_GPADC_TRIM4 0x03
2861#define PALMAS_GPADC_TRIM5 0x4 2861#define PALMAS_GPADC_TRIM5 0x04
2862#define PALMAS_GPADC_TRIM6 0x5 2862#define PALMAS_GPADC_TRIM6 0x05
2863#define PALMAS_GPADC_TRIM7 0x6 2863#define PALMAS_GPADC_TRIM7 0x06
2864#define PALMAS_GPADC_TRIM8 0x7 2864#define PALMAS_GPADC_TRIM8 0x07
2865#define PALMAS_GPADC_TRIM9 0x8 2865#define PALMAS_GPADC_TRIM9 0x08
2866#define PALMAS_GPADC_TRIM10 0x9 2866#define PALMAS_GPADC_TRIM10 0x09
2867#define PALMAS_GPADC_TRIM11 0xA 2867#define PALMAS_GPADC_TRIM11 0x0A
2868#define PALMAS_GPADC_TRIM12 0xB 2868#define PALMAS_GPADC_TRIM12 0x0B
2869#define PALMAS_GPADC_TRIM13 0xC 2869#define PALMAS_GPADC_TRIM13 0x0C
2870#define PALMAS_GPADC_TRIM14 0xD 2870#define PALMAS_GPADC_TRIM14 0x0D
2871#define PALMAS_GPADC_TRIM15 0xE 2871#define PALMAS_GPADC_TRIM15 0x0E
2872#define PALMAS_GPADC_TRIM16 0xF 2872#define PALMAS_GPADC_TRIM16 0x0F
2873 2873
2874static inline int palmas_read(struct palmas *palmas, unsigned int base, 2874static inline int palmas_read(struct palmas *palmas, unsigned int base,
2875 unsigned int reg, unsigned int *val) 2875 unsigned int reg, unsigned int *val)
2876{ 2876{
2877 unsigned int addr = PALMAS_BASE_TO_REG(base, reg); 2877 unsigned int addr = PALMAS_BASE_TO_REG(base, reg);
2878 int slave_id = PALMAS_BASE_TO_SLAVE(base); 2878 int slave_id = PALMAS_BASE_TO_SLAVE(base);
2879 2879
2880 return regmap_read(palmas->regmap[slave_id], addr, val); 2880 return regmap_read(palmas->regmap[slave_id], addr, val);
diff --git a/include/linux/mfd/pm8xxx/core.h b/include/linux/mfd/pm8xxx/core.h
deleted file mode 100644
index bd2f4f64e931..000000000000
--- a/include/linux/mfd/pm8xxx/core.h
+++ /dev/null
@@ -1,81 +0,0 @@
1/*
2 * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 and
6 * only version 2 as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 */
13/*
14 * Qualcomm PMIC 8xxx driver header file
15 *
16 */
17
18#ifndef __MFD_PM8XXX_CORE_H
19#define __MFD_PM8XXX_CORE_H
20
21#include <linux/mfd/core.h>
22
23struct pm8xxx_drvdata {
24 int (*pmic_readb) (const struct device *dev, u16 addr, u8 *val);
25 int (*pmic_writeb) (const struct device *dev, u16 addr, u8 val);
26 int (*pmic_read_buf) (const struct device *dev, u16 addr, u8 *buf,
27 int n);
28 int (*pmic_write_buf) (const struct device *dev, u16 addr, u8 *buf,
29 int n);
30 int (*pmic_read_irq_stat) (const struct device *dev, int irq);
31 void *pm_chip_data;
32};
33
34static inline int pm8xxx_readb(const struct device *dev, u16 addr, u8 *val)
35{
36 struct pm8xxx_drvdata *dd = dev_get_drvdata(dev);
37
38 if (!dd)
39 return -EINVAL;
40 return dd->pmic_readb(dev, addr, val);
41}
42
43static inline int pm8xxx_writeb(const struct device *dev, u16 addr, u8 val)
44{
45 struct pm8xxx_drvdata *dd = dev_get_drvdata(dev);
46
47 if (!dd)
48 return -EINVAL;
49 return dd->pmic_writeb(dev, addr, val);
50}
51
52static inline int pm8xxx_read_buf(const struct device *dev, u16 addr, u8 *buf,
53 int n)
54{
55 struct pm8xxx_drvdata *dd = dev_get_drvdata(dev);
56
57 if (!dd)
58 return -EINVAL;
59 return dd->pmic_read_buf(dev, addr, buf, n);
60}
61
62static inline int pm8xxx_write_buf(const struct device *dev, u16 addr, u8 *buf,
63 int n)
64{
65 struct pm8xxx_drvdata *dd = dev_get_drvdata(dev);
66
67 if (!dd)
68 return -EINVAL;
69 return dd->pmic_write_buf(dev, addr, buf, n);
70}
71
72static inline int pm8xxx_read_irq_stat(const struct device *dev, int irq)
73{
74 struct pm8xxx_drvdata *dd = dev_get_drvdata(dev);
75
76 if (!dd)
77 return -EINVAL;
78 return dd->pmic_read_irq_stat(dev, irq);
79}
80
81#endif
diff --git a/include/linux/mfd/rdc321x.h b/include/linux/mfd/rdc321x.h
index 4bdf19c8eedf..442743a8f915 100644
--- a/include/linux/mfd/rdc321x.h
+++ b/include/linux/mfd/rdc321x.h
@@ -12,7 +12,7 @@
12#define RDC321X_GPIO_CTRL_REG2 0x84 12#define RDC321X_GPIO_CTRL_REG2 0x84
13#define RDC321X_GPIO_DATA_REG2 0x88 13#define RDC321X_GPIO_DATA_REG2 0x88
14 14
15#define RDC321X_MAX_GPIO 58 15#define RDC321X_NUM_GPIO 59
16 16
17struct rdc321x_gpio_pdata { 17struct rdc321x_gpio_pdata {
18 struct pci_dev *sb_pdev; 18 struct pci_dev *sb_pdev;
diff --git a/include/linux/mfd/samsung/core.h b/include/linux/mfd/samsung/core.h
index 157e32b6ca28..47d84242940b 100644
--- a/include/linux/mfd/samsung/core.h
+++ b/include/linux/mfd/samsung/core.h
@@ -24,35 +24,36 @@ enum sec_device_type {
24}; 24};
25 25
26/** 26/**
27 * struct sec_pmic_dev - s5m87xx master device for sub-drivers 27 * struct sec_pmic_dev - s2m/s5m master device for sub-drivers
28 * @dev: master device of the chip (can be used to access platform data) 28 * @dev: Master device of the chip
29 * @pdata: pointer to private data used to pass platform data to child 29 * @pdata: Platform data populated with data from DTS
30 * @i2c: i2c client private data for regulator 30 * or board files
31 * @rtc: i2c client private data for rtc 31 * @regmap_pmic: Regmap associated with PMIC's I2C address
32 * @iolock: mutex for serializing io access 32 * @i2c: I2C client of the main driver
33 * @irqlock: mutex for buslock 33 * @device_type: Type of device, matches enum sec_device_type
34 * @irq_base: base IRQ number for sec-pmic, required for IRQs 34 * @irq_base: Base IRQ number for device, required for IRQs
35 * @irq: generic IRQ number for s5m87xx 35 * @irq: Generic IRQ number for device
36 * @ono: power onoff IRQ number for s5m87xx 36 * @irq_data: Runtime data structure for IRQ controller
37 * @irq_masks_cur: currently active value 37 * @ono: Power onoff IRQ number for s5m87xx
38 * @irq_masks_cache: cached hardware value 38 * @wakeup: Whether or not this is a wakeup device
39 * @type: indicate which s5m87xx "variant" is used 39 * @wtsr_smpl: Whether or not to enable in RTC driver the Watchdog
40 * Timer Software Reset (registers set to default value
41 * after PWRHOLD falling) and Sudden Momentary Power Loss
42 * (PMIC will enter power on sequence after short drop in
43 * VBATT voltage).
40 */ 44 */
41struct sec_pmic_dev { 45struct sec_pmic_dev {
42 struct device *dev; 46 struct device *dev;
43 struct sec_platform_data *pdata; 47 struct sec_platform_data *pdata;
44 struct regmap *regmap_pmic; 48 struct regmap *regmap_pmic;
45 struct regmap *regmap_rtc;
46 struct i2c_client *i2c; 49 struct i2c_client *i2c;
47 struct i2c_client *rtc;
48 50
49 int device_type; 51 unsigned long device_type;
50 int irq_base; 52 int irq_base;
51 int irq; 53 int irq;
52 struct regmap_irq_chip_data *irq_data; 54 struct regmap_irq_chip_data *irq_data;
53 55
54 int ono; 56 int ono;
55 unsigned long type;
56 bool wakeup; 57 bool wakeup;
57 bool wtsr_smpl; 58 bool wtsr_smpl;
58}; 59};
diff --git a/include/linux/mfd/samsung/s2mps14.h b/include/linux/mfd/samsung/s2mps14.h
index 4b449b8ac548..900cd7a04314 100644
--- a/include/linux/mfd/samsung/s2mps14.h
+++ b/include/linux/mfd/samsung/s2mps14.h
@@ -148,6 +148,8 @@ enum s2mps14_regulators {
148#define S2MPS14_ENABLE_SHIFT 6 148#define S2MPS14_ENABLE_SHIFT 6
149/* On/Off controlled by PWREN */ 149/* On/Off controlled by PWREN */
150#define S2MPS14_ENABLE_SUSPEND (0x01 << S2MPS14_ENABLE_SHIFT) 150#define S2MPS14_ENABLE_SUSPEND (0x01 << S2MPS14_ENABLE_SHIFT)
151/* On/Off controlled by LDO10EN or EMMCEN */
152#define S2MPS14_ENABLE_EXT_CONTROL (0x00 << S2MPS14_ENABLE_SHIFT)
151#define S2MPS14_LDO_N_VOLTAGES (S2MPS14_LDO_VSEL_MASK + 1) 153#define S2MPS14_LDO_N_VOLTAGES (S2MPS14_LDO_VSEL_MASK + 1)
152#define S2MPS14_BUCK_N_VOLTAGES (S2MPS14_BUCK_VSEL_MASK + 1) 154#define S2MPS14_BUCK_N_VOLTAGES (S2MPS14_BUCK_VSEL_MASK + 1)
153 155
diff --git a/include/linux/mfd/stmpe.h b/include/linux/mfd/stmpe.h
index 48395a69a7e9..575a86c7fcbd 100644
--- a/include/linux/mfd/stmpe.h
+++ b/include/linux/mfd/stmpe.h
@@ -11,6 +11,7 @@
11#include <linux/mutex.h> 11#include <linux/mutex.h>
12 12
13struct device; 13struct device;
14struct regulator;
14 15
15enum stmpe_block { 16enum stmpe_block {
16 STMPE_BLOCK_GPIO = 1 << 0, 17 STMPE_BLOCK_GPIO = 1 << 0,
@@ -62,6 +63,8 @@ struct stmpe_client_info;
62 63
63/** 64/**
64 * struct stmpe - STMPE MFD structure 65 * struct stmpe - STMPE MFD structure
66 * @vcc: optional VCC regulator
67 * @vio: optional VIO regulator
65 * @lock: lock protecting I/O operations 68 * @lock: lock protecting I/O operations
66 * @irq_lock: IRQ bus lock 69 * @irq_lock: IRQ bus lock
67 * @dev: device, mostly for dev_dbg() 70 * @dev: device, mostly for dev_dbg()
@@ -73,13 +76,14 @@ struct stmpe_client_info;
73 * @regs: list of addresses of registers which are at different addresses on 76 * @regs: list of addresses of registers which are at different addresses on
74 * different variants. Indexed by one of STMPE_IDX_*. 77 * different variants. Indexed by one of STMPE_IDX_*.
75 * @irq: irq number for stmpe 78 * @irq: irq number for stmpe
76 * @irq_base: starting IRQ number for internal IRQs
77 * @num_gpios: number of gpios, differs for variants 79 * @num_gpios: number of gpios, differs for variants
78 * @ier: cache of IER registers for bus_lock 80 * @ier: cache of IER registers for bus_lock
79 * @oldier: cache of IER registers for bus_lock 81 * @oldier: cache of IER registers for bus_lock
80 * @pdata: platform data 82 * @pdata: platform data
81 */ 83 */
82struct stmpe { 84struct stmpe {
85 struct regulator *vcc;
86 struct regulator *vio;
83 struct mutex lock; 87 struct mutex lock;
84 struct mutex irq_lock; 88 struct mutex irq_lock;
85 struct device *dev; 89 struct device *dev;
@@ -91,7 +95,6 @@ struct stmpe {
91 const u8 *regs; 95 const u8 *regs;
92 96
93 int irq; 97 int irq;
94 int irq_base;
95 int num_gpios; 98 int num_gpios;
96 u8 ier[2]; 99 u8 ier[2];
97 u8 oldier[2]; 100 u8 oldier[2];
@@ -132,8 +135,6 @@ struct stmpe_keypad_platform_data {
132 135
133/** 136/**
134 * struct stmpe_gpio_platform_data - STMPE GPIO platform data 137 * struct stmpe_gpio_platform_data - STMPE GPIO platform data
135 * @gpio_base: first gpio number assigned. A maximum of
136 * %STMPE_NR_GPIOS GPIOs will be allocated.
137 * @norequest_mask: bitmask specifying which GPIOs should _not_ be 138 * @norequest_mask: bitmask specifying which GPIOs should _not_ be
138 * requestable due to different usage (e.g. touch, keypad) 139 * requestable due to different usage (e.g. touch, keypad)
139 * STMPE_GPIO_NOREQ_* macros can be used here. 140 * STMPE_GPIO_NOREQ_* macros can be used here.
@@ -141,7 +142,6 @@ struct stmpe_keypad_platform_data {
141 * @remove: board specific remove callback 142 * @remove: board specific remove callback
142 */ 143 */
143struct stmpe_gpio_platform_data { 144struct stmpe_gpio_platform_data {
144 int gpio_base;
145 unsigned norequest_mask; 145 unsigned norequest_mask;
146 void (*setup)(struct stmpe *stmpe, unsigned gpio_base); 146 void (*setup)(struct stmpe *stmpe, unsigned gpio_base);
147 void (*remove)(struct stmpe *stmpe, unsigned gpio_base); 147 void (*remove)(struct stmpe *stmpe, unsigned gpio_base);
@@ -195,8 +195,6 @@ struct stmpe_ts_platform_data {
195 * @irq_trigger: IRQ trigger to use for the interrupt to the host 195 * @irq_trigger: IRQ trigger to use for the interrupt to the host
196 * @autosleep: bool to enable/disable stmpe autosleep 196 * @autosleep: bool to enable/disable stmpe autosleep
197 * @autosleep_timeout: inactivity timeout in milliseconds for autosleep 197 * @autosleep_timeout: inactivity timeout in milliseconds for autosleep
198 * @irq_base: base IRQ number. %STMPE_NR_IRQS irqs will be used, or
199 * %STMPE_NR_INTERNAL_IRQS if the GPIO driver is not used.
200 * @irq_over_gpio: true if gpio is used to get irq 198 * @irq_over_gpio: true if gpio is used to get irq
201 * @irq_gpio: gpio number over which irq will be requested (significant only if 199 * @irq_gpio: gpio number over which irq will be requested (significant only if
202 * irq_over_gpio is true) 200 * irq_over_gpio is true)
@@ -207,7 +205,6 @@ struct stmpe_ts_platform_data {
207struct stmpe_platform_data { 205struct stmpe_platform_data {
208 int id; 206 int id;
209 unsigned int blocks; 207 unsigned int blocks;
210 int irq_base;
211 unsigned int irq_trigger; 208 unsigned int irq_trigger;
212 bool autosleep; 209 bool autosleep;
213 bool irq_over_gpio; 210 bool irq_over_gpio;
@@ -219,10 +216,4 @@ struct stmpe_platform_data {
219 struct stmpe_ts_platform_data *ts; 216 struct stmpe_ts_platform_data *ts;
220}; 217};
221 218
222#define STMPE_NR_INTERNAL_IRQS 9
223#define STMPE_INT_GPIO(x) (STMPE_NR_INTERNAL_IRQS + (x))
224
225#define STMPE_NR_GPIOS 24
226#define STMPE_NR_IRQS STMPE_INT_GPIO(STMPE_NR_GPIOS)
227
228#endif 219#endif
diff --git a/include/linux/mfd/syscon.h b/include/linux/mfd/syscon.h
index 8789fa3c7fd9..75e543b78f53 100644
--- a/include/linux/mfd/syscon.h
+++ b/include/linux/mfd/syscon.h
@@ -15,6 +15,8 @@
15#ifndef __LINUX_MFD_SYSCON_H__ 15#ifndef __LINUX_MFD_SYSCON_H__
16#define __LINUX_MFD_SYSCON_H__ 16#define __LINUX_MFD_SYSCON_H__
17 17
18#include <linux/err.h>
19
18struct device_node; 20struct device_node;
19 21
20#ifdef CONFIG_MFD_SYSCON 22#ifdef CONFIG_MFD_SYSCON
diff --git a/include/linux/mfd/syscon/exynos5-pmu.h b/include/linux/mfd/syscon/exynos5-pmu.h
new file mode 100644
index 000000000000..00ef24bf6ede
--- /dev/null
+++ b/include/linux/mfd/syscon/exynos5-pmu.h
@@ -0,0 +1,44 @@
1/*
2 * Exynos5 SoC series Power Management Unit (PMU) register offsets
3 * and bit definitions.
4 *
5 * Copyright (C) 2014 Samsung Electronics Co., Ltd.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef _LINUX_MFD_SYSCON_PMU_EXYNOS5_H_
13#define _LINUX_MFD_SYSCON_PMU_EXYNOS5_H_
14
15/* Exynos5 PMU register definitions */
16#define EXYNOS5_HDMI_PHY_CONTROL (0x700)
17#define EXYNOS5_USBDRD_PHY_CONTROL (0x704)
18
19/* Exynos5250 specific register definitions */
20#define EXYNOS5_USBHOST_PHY_CONTROL (0x708)
21#define EXYNOS5_EFNAND_PHY_CONTROL (0x70c)
22#define EXYNOS5_MIPI_PHY0_CONTROL (0x710)
23#define EXYNOS5_MIPI_PHY1_CONTROL (0x714)
24#define EXYNOS5_ADC_PHY_CONTROL (0x718)
25#define EXYNOS5_MTCADC_PHY_CONTROL (0x71c)
26#define EXYNOS5_DPTX_PHY_CONTROL (0x720)
27#define EXYNOS5_SATA_PHY_CONTROL (0x724)
28
29/* Exynos5420 specific register definitions */
30#define EXYNOS5420_USBDRD1_PHY_CONTROL (0x708)
31#define EXYNOS5420_USBHOST_PHY_CONTROL (0x70c)
32#define EXYNOS5420_MIPI_PHY0_CONTROL (0x714)
33#define EXYNOS5420_MIPI_PHY1_CONTROL (0x718)
34#define EXYNOS5420_MIPI_PHY2_CONTROL (0x71c)
35#define EXYNOS5420_ADC_PHY_CONTROL (0x720)
36#define EXYNOS5420_MTCADC_PHY_CONTROL (0x724)
37#define EXYNOS5420_DPTX_PHY_CONTROL (0x728)
38
39#define EXYNOS5_PHY_ENABLE BIT(0)
40
41#define EXYNOS5_MIPI_PHY_S_RESETN BIT(1)
42#define EXYNOS5_MIPI_PHY_M_RESETN BIT(2)
43
44#endif /* _LINUX_MFD_SYSCON_PMU_EXYNOS5_H_ */
diff --git a/include/linux/mfd/tc3589x.h b/include/linux/mfd/tc3589x.h
index 6b8e1ff4672b..e6088c2e2092 100644
--- a/include/linux/mfd/tc3589x.h
+++ b/include/linux/mfd/tc3589x.h
@@ -111,7 +111,6 @@ enum tx3589x_block {
111#define TC3589x_INT_PORIRQ 7 111#define TC3589x_INT_PORIRQ 7
112 112
113#define TC3589x_NR_INTERNAL_IRQS 8 113#define TC3589x_NR_INTERNAL_IRQS 8
114#define TC3589x_INT_GPIO(x) (TC3589x_NR_INTERNAL_IRQS + (x))
115 114
116struct tc3589x { 115struct tc3589x {
117 struct mutex lock; 116 struct mutex lock;
diff --git a/include/linux/mfd/tps65090.h b/include/linux/mfd/tps65090.h
index 3f43069413e7..0bf2708df150 100644
--- a/include/linux/mfd/tps65090.h
+++ b/include/linux/mfd/tps65090.h
@@ -64,6 +64,20 @@ enum {
64 TPS65090_REGULATOR_MAX, 64 TPS65090_REGULATOR_MAX,
65}; 65};
66 66
67/* Register addresses */
68#define TPS65090_REG_INTR_STS 0x00
69#define TPS65090_REG_INTR_STS2 0x01
70#define TPS65090_REG_INTR_MASK 0x02
71#define TPS65090_REG_INTR_MASK2 0x03
72#define TPS65090_REG_CG_CTRL0 0x04
73#define TPS65090_REG_CG_CTRL1 0x05
74#define TPS65090_REG_CG_CTRL2 0x06
75#define TPS65090_REG_CG_CTRL3 0x07
76#define TPS65090_REG_CG_CTRL4 0x08
77#define TPS65090_REG_CG_CTRL5 0x09
78#define TPS65090_REG_CG_STATUS1 0x0a
79#define TPS65090_REG_CG_STATUS2 0x0b
80
67struct tps65090 { 81struct tps65090 {
68 struct device *dev; 82 struct device *dev;
69 struct regmap *rmap; 83 struct regmap *rmap;
@@ -78,11 +92,16 @@ struct tps65090 {
78 * DCDC1, DCDC2 and DCDC3. 92 * DCDC1, DCDC2 and DCDC3.
79 * @gpio: Gpio number if external control is enabled and controlled through 93 * @gpio: Gpio number if external control is enabled and controlled through
80 * gpio. 94 * gpio.
95 * @overcurrent_wait_valid: True if the overcurrent_wait should be applied.
96 * @overcurrent_wait: Value to set as the overcurrent wait time. This is the
97 * actual bitfield value, not a time in ms (valid value are 0 - 3).
81 */ 98 */
82struct tps65090_regulator_plat_data { 99struct tps65090_regulator_plat_data {
83 struct regulator_init_data *reg_init_data; 100 struct regulator_init_data *reg_init_data;
84 bool enable_ext_control; 101 bool enable_ext_control;
85 int gpio; 102 int gpio;
103 bool overcurrent_wait_valid;
104 int overcurrent_wait;
86}; 105};
87 106
88struct tps65090_platform_data { 107struct tps65090_platform_data {
diff --git a/include/linux/mfd/tps65217.h b/include/linux/mfd/tps65217.h
index 54b5458ec084..95d6938737fd 100644
--- a/include/linux/mfd/tps65217.h
+++ b/include/linux/mfd/tps65217.h
@@ -254,7 +254,6 @@ struct tps65217 {
254 struct tps65217_board *pdata; 254 struct tps65217_board *pdata;
255 unsigned long id; 255 unsigned long id;
256 struct regulator_desc desc[TPS65217_NUM_REGULATOR]; 256 struct regulator_desc desc[TPS65217_NUM_REGULATOR];
257 struct regulator_dev *rdev[TPS65217_NUM_REGULATOR];
258 struct regmap *regmap; 257 struct regmap *regmap;
259}; 258};
260 259
diff --git a/include/linux/mfd/tps65218.h b/include/linux/mfd/tps65218.h
index d2e357df5a0e..2f9b593246ee 100644
--- a/include/linux/mfd/tps65218.h
+++ b/include/linux/mfd/tps65218.h
@@ -267,7 +267,6 @@ struct tps65218 {
267 u32 irq_mask; 267 u32 irq_mask;
268 struct regmap_irq_chip_data *irq_data; 268 struct regmap_irq_chip_data *irq_data;
269 struct regulator_desc desc[TPS65218_NUM_REGULATOR]; 269 struct regulator_desc desc[TPS65218_NUM_REGULATOR];
270 struct regulator_dev *rdev[TPS65218_NUM_REGULATOR];
271 struct tps_info *info[TPS65218_NUM_REGULATOR]; 270 struct tps_info *info[TPS65218_NUM_REGULATOR];
272 struct regmap *regmap; 271 struct regmap *regmap;
273}; 272};
diff --git a/include/linux/mfd/tps6586x.h b/include/linux/mfd/tps6586x.h
index cbecec2e353a..96187ed9f9bb 100644
--- a/include/linux/mfd/tps6586x.h
+++ b/include/linux/mfd/tps6586x.h
@@ -17,6 +17,8 @@
17#define TPS658621A 0x15 17#define TPS658621A 0x15
18#define TPS658621CD 0x2c 18#define TPS658621CD 0x2c
19#define TPS658623 0x1b 19#define TPS658623 0x1b
20#define TPS658640 0x01
21#define TPS658640v2 0x02
20#define TPS658643 0x03 22#define TPS658643 0x03
21 23
22enum { 24enum {
diff --git a/include/linux/mfd/twl6040.h b/include/linux/mfd/twl6040.h
index 81f639bc1ae6..8f9fc3d26e6d 100644
--- a/include/linux/mfd/twl6040.h
+++ b/include/linux/mfd/twl6040.h
@@ -28,6 +28,7 @@
28#include <linux/interrupt.h> 28#include <linux/interrupt.h>
29#include <linux/mfd/core.h> 29#include <linux/mfd/core.h>
30#include <linux/regulator/consumer.h> 30#include <linux/regulator/consumer.h>
31#include <linux/clk.h>
31 32
32#define TWL6040_REG_ASICID 0x01 33#define TWL6040_REG_ASICID 0x01
33#define TWL6040_REG_ASICREV 0x02 34#define TWL6040_REG_ASICREV 0x02
@@ -157,6 +158,7 @@
157#define TWL6040_I2CSEL 0x01 158#define TWL6040_I2CSEL 0x01
158#define TWL6040_RESETSPLIT 0x04 159#define TWL6040_RESETSPLIT 0x04
159#define TWL6040_INTCLRMODE 0x08 160#define TWL6040_INTCLRMODE 0x08
161#define TWL6040_I2CMODE(x) ((x & 0x3) << 4)
160 162
161/* STATUS (0x2E) fields */ 163/* STATUS (0x2E) fields */
162 164
@@ -222,6 +224,7 @@ struct twl6040 {
222 struct regmap *regmap; 224 struct regmap *regmap;
223 struct regmap_irq_chip_data *irq_data; 225 struct regmap_irq_chip_data *irq_data;
224 struct regulator_bulk_data supplies[2]; /* supplies for vio, v2v1 */ 226 struct regulator_bulk_data supplies[2]; /* supplies for vio, v2v1 */
227 struct clk *clk32k;
225 struct mutex mutex; 228 struct mutex mutex;
226 struct mutex irq_mutex; 229 struct mutex irq_mutex;
227 struct mfd_cell cells[TWL6040_CELLS]; 230 struct mfd_cell cells[TWL6040_CELLS];
diff --git a/include/linux/migrate.h b/include/linux/migrate.h
index 84a31ad0b791..a2901c414664 100644
--- a/include/linux/migrate.h
+++ b/include/linux/migrate.h
@@ -5,7 +5,9 @@
5#include <linux/mempolicy.h> 5#include <linux/mempolicy.h>
6#include <linux/migrate_mode.h> 6#include <linux/migrate_mode.h>
7 7
8typedef struct page *new_page_t(struct page *, unsigned long private, int **); 8typedef struct page *new_page_t(struct page *page, unsigned long private,
9 int **reason);
10typedef void free_page_t(struct page *page, unsigned long private);
9 11
10/* 12/*
11 * Return values from addresss_space_operations.migratepage(): 13 * Return values from addresss_space_operations.migratepage():
@@ -38,7 +40,7 @@ enum migrate_reason {
38extern void putback_movable_pages(struct list_head *l); 40extern void putback_movable_pages(struct list_head *l);
39extern int migrate_page(struct address_space *, 41extern int migrate_page(struct address_space *,
40 struct page *, struct page *, enum migrate_mode); 42 struct page *, struct page *, enum migrate_mode);
41extern int migrate_pages(struct list_head *l, new_page_t x, 43extern int migrate_pages(struct list_head *l, new_page_t new, free_page_t free,
42 unsigned long private, enum migrate_mode mode, int reason); 44 unsigned long private, enum migrate_mode mode, int reason);
43 45
44extern int migrate_prep(void); 46extern int migrate_prep(void);
@@ -56,8 +58,9 @@ extern int migrate_page_move_mapping(struct address_space *mapping,
56#else 58#else
57 59
58static inline void putback_movable_pages(struct list_head *l) {} 60static inline void putback_movable_pages(struct list_head *l) {}
59static inline int migrate_pages(struct list_head *l, new_page_t x, 61static inline int migrate_pages(struct list_head *l, new_page_t new,
60 unsigned long private, enum migrate_mode mode, int reason) 62 free_page_t free, unsigned long private, enum migrate_mode mode,
63 int reason)
61 { return -ENOSYS; } 64 { return -ENOSYS; }
62 65
63static inline int migrate_prep(void) { return -ENOSYS; } 66static inline int migrate_prep(void) { return -ENOSYS; }
diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h
index 51e26f3cd3b3..ee80dd7d9f60 100644
--- a/include/linux/miscdevice.h
+++ b/include/linux/miscdevice.h
@@ -64,7 +64,7 @@ struct miscdevice {
64 umode_t mode; 64 umode_t mode;
65}; 65};
66 66
67extern int misc_register(struct miscdevice * misc); 67extern int misc_register(struct miscdevice *misc);
68extern int misc_deregister(struct miscdevice *misc); 68extern int misc_deregister(struct miscdevice *misc);
69 69
70#define MODULE_ALIAS_MISCDEV(minor) \ 70#define MODULE_ALIAS_MISCDEV(minor) \
diff --git a/include/linux/mm.h b/include/linux/mm.h
index d6777060449f..e03dd29145a0 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -239,6 +239,12 @@ struct vm_operations_struct {
239 */ 239 */
240 int (*access)(struct vm_area_struct *vma, unsigned long addr, 240 int (*access)(struct vm_area_struct *vma, unsigned long addr,
241 void *buf, int len, int write); 241 void *buf, int len, int write);
242
243 /* Called by the /proc/PID/maps code to ask the vma whether it
244 * has a special name. Returning non-NULL will also cause this
245 * vma to be dumped unconditionally. */
246 const char *(*name)(struct vm_area_struct *vma);
247
242#ifdef CONFIG_NUMA 248#ifdef CONFIG_NUMA
243 /* 249 /*
244 * set_policy() op must add a reference to any non-NULL @new mempolicy 250 * set_policy() op must add a reference to any non-NULL @new mempolicy
@@ -407,20 +413,25 @@ static inline void compound_unlock_irqrestore(struct page *page,
407#endif 413#endif
408} 414}
409 415
416static inline struct page *compound_head_by_tail(struct page *tail)
417{
418 struct page *head = tail->first_page;
419
420 /*
421 * page->first_page may be a dangling pointer to an old
422 * compound page, so recheck that it is still a tail
423 * page before returning.
424 */
425 smp_rmb();
426 if (likely(PageTail(tail)))
427 return head;
428 return tail;
429}
430
410static inline struct page *compound_head(struct page *page) 431static inline struct page *compound_head(struct page *page)
411{ 432{
412 if (unlikely(PageTail(page))) { 433 if (unlikely(PageTail(page)))
413 struct page *head = page->first_page; 434 return compound_head_by_tail(page);
414
415 /*
416 * page->first_page may be a dangling pointer to an old
417 * compound page, so recheck that it is still a tail
418 * page before returning.
419 */
420 smp_rmb();
421 if (likely(PageTail(page)))
422 return head;
423 }
424 return page; 435 return page;
425} 436}
426 437
@@ -1778,7 +1789,9 @@ extern struct file *get_mm_exe_file(struct mm_struct *mm);
1778extern int may_expand_vm(struct mm_struct *mm, unsigned long npages); 1789extern int may_expand_vm(struct mm_struct *mm, unsigned long npages);
1779extern struct vm_area_struct *_install_special_mapping(struct mm_struct *mm, 1790extern struct vm_area_struct *_install_special_mapping(struct mm_struct *mm,
1780 unsigned long addr, unsigned long len, 1791 unsigned long addr, unsigned long len,
1781 unsigned long flags, struct page **pages); 1792 unsigned long flags,
1793 const struct vm_special_mapping *spec);
1794/* This is an obsolete alternative to _install_special_mapping. */
1782extern int install_special_mapping(struct mm_struct *mm, 1795extern int install_special_mapping(struct mm_struct *mm,
1783 unsigned long addr, unsigned long len, 1796 unsigned long addr, unsigned long len,
1784 unsigned long flags, struct page **pages); 1797 unsigned long flags, struct page **pages);
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index 8967e20cbe57..96c5750e3110 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -406,7 +406,7 @@ struct mm_struct {
406 spinlock_t ioctx_lock; 406 spinlock_t ioctx_lock;
407 struct kioctx_table __rcu *ioctx_table; 407 struct kioctx_table __rcu *ioctx_table;
408#endif 408#endif
409#ifdef CONFIG_MM_OWNER 409#ifdef CONFIG_MEMCG
410 /* 410 /*
411 * "owner" points to a task that is regarded as the canonical 411 * "owner" points to a task that is regarded as the canonical
412 * user/owner of this mm. All of the following must be true in 412 * user/owner of this mm. All of the following must be true in
@@ -510,4 +510,10 @@ static inline void clear_tlb_flush_pending(struct mm_struct *mm)
510} 510}
511#endif 511#endif
512 512
513struct vm_special_mapping
514{
515 const char *name;
516 struct page **pages;
517};
518
513#endif /* _LINUX_MM_TYPES_H */ 519#endif /* _LINUX_MM_TYPES_H */
diff --git a/include/linux/mmdebug.h b/include/linux/mmdebug.h
index 2d57efa64cc1..edd82a105220 100644
--- a/include/linux/mmdebug.h
+++ b/include/linux/mmdebug.h
@@ -1,6 +1,8 @@
1#ifndef LINUX_MM_DEBUG_H 1#ifndef LINUX_MM_DEBUG_H
2#define LINUX_MM_DEBUG_H 1 2#define LINUX_MM_DEBUG_H 1
3 3
4#include <linux/stringify.h>
5
4struct page; 6struct page;
5 7
6extern void dump_page(struct page *page, const char *reason); 8extern void dump_page(struct page *page, const char *reason);
@@ -9,11 +11,20 @@ extern void dump_page_badflags(struct page *page, const char *reason,
9 11
10#ifdef CONFIG_DEBUG_VM 12#ifdef CONFIG_DEBUG_VM
11#define VM_BUG_ON(cond) BUG_ON(cond) 13#define VM_BUG_ON(cond) BUG_ON(cond)
12#define VM_BUG_ON_PAGE(cond, page) \ 14#define VM_BUG_ON_PAGE(cond, page) \
13 do { if (unlikely(cond)) { dump_page(page, NULL); BUG(); } } while (0) 15 do { \
16 if (unlikely(cond)) { \
17 dump_page(page, "VM_BUG_ON_PAGE(" __stringify(cond)")");\
18 BUG(); \
19 } \
20 } while (0)
21#define VM_WARN_ON(cond) WARN_ON(cond)
22#define VM_WARN_ON_ONCE(cond) WARN_ON_ONCE(cond)
14#else 23#else
15#define VM_BUG_ON(cond) BUILD_BUG_ON_INVALID(cond) 24#define VM_BUG_ON(cond) BUILD_BUG_ON_INVALID(cond)
16#define VM_BUG_ON_PAGE(cond, page) VM_BUG_ON(cond) 25#define VM_BUG_ON_PAGE(cond, page) VM_BUG_ON(cond)
26#define VM_WARN_ON(cond) BUILD_BUG_ON_INVALID(cond)
27#define VM_WARN_ON_ONCE(cond) BUILD_BUG_ON_INVALID(cond)
17#endif 28#endif
18 29
19#ifdef CONFIG_DEBUG_VIRTUAL 30#ifdef CONFIG_DEBUG_VIRTUAL
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index fac5509c18f0..6cbd1b6c3d20 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -75,9 +75,18 @@ enum {
75 75
76extern int page_group_by_mobility_disabled; 76extern int page_group_by_mobility_disabled;
77 77
78static inline int get_pageblock_migratetype(struct page *page) 78#define NR_MIGRATETYPE_BITS (PB_migrate_end - PB_migrate + 1)
79#define MIGRATETYPE_MASK ((1UL << NR_MIGRATETYPE_BITS) - 1)
80
81#define get_pageblock_migratetype(page) \
82 get_pfnblock_flags_mask(page, page_to_pfn(page), \
83 PB_migrate_end, MIGRATETYPE_MASK)
84
85static inline int get_pfnblock_migratetype(struct page *page, unsigned long pfn)
79{ 86{
80 return get_pageblock_flags_group(page, PB_migrate, PB_migrate_end); 87 BUILD_BUG_ON(PB_migrate_end - PB_migrate != 2);
88 return get_pfnblock_flags_mask(page, pfn, PB_migrate_end,
89 MIGRATETYPE_MASK);
81} 90}
82 91
83struct free_area { 92struct free_area {
@@ -360,9 +369,10 @@ struct zone {
360 /* Set to true when the PG_migrate_skip bits should be cleared */ 369 /* Set to true when the PG_migrate_skip bits should be cleared */
361 bool compact_blockskip_flush; 370 bool compact_blockskip_flush;
362 371
363 /* pfns where compaction scanners should start */ 372 /* pfn where compaction free scanner should start */
364 unsigned long compact_cached_free_pfn; 373 unsigned long compact_cached_free_pfn;
365 unsigned long compact_cached_migrate_pfn; 374 /* pfn where async and sync compaction migration scanner should start */
375 unsigned long compact_cached_migrate_pfn[2];
366#endif 376#endif
367#ifdef CONFIG_MEMORY_HOTPLUG 377#ifdef CONFIG_MEMORY_HOTPLUG
368 /* see spanned/present_pages for more description */ 378 /* see spanned/present_pages for more description */
@@ -481,9 +491,8 @@ struct zone {
481 * give them a chance of being in the same cacheline. 491 * give them a chance of being in the same cacheline.
482 * 492 *
483 * Write access to present_pages at runtime should be protected by 493 * Write access to present_pages at runtime should be protected by
484 * lock_memory_hotplug()/unlock_memory_hotplug(). Any reader who can't 494 * mem_hotplug_begin/end(). Any reader who can't tolerant drift of
485 * tolerant drift of present_pages should hold memory hotplug lock to 495 * present_pages should get_online_mems() to get a stable value.
486 * get a stable value.
487 * 496 *
488 * Read access to managed_pages should be safe because it's unsigned 497 * Read access to managed_pages should be safe because it's unsigned
489 * long. Write access to zone->managed_pages and totalram_pages are 498 * long. Write access to zone->managed_pages and totalram_pages are
@@ -763,10 +772,10 @@ typedef struct pglist_data {
763 unsigned long node_spanned_pages; /* total size of physical page 772 unsigned long node_spanned_pages; /* total size of physical page
764 range, including holes */ 773 range, including holes */
765 int node_id; 774 int node_id;
766 nodemask_t reclaim_nodes; /* Nodes allowed to reclaim from */
767 wait_queue_head_t kswapd_wait; 775 wait_queue_head_t kswapd_wait;
768 wait_queue_head_t pfmemalloc_wait; 776 wait_queue_head_t pfmemalloc_wait;
769 struct task_struct *kswapd; /* Protected by lock_memory_hotplug() */ 777 struct task_struct *kswapd; /* Protected by
778 mem_hotplug_begin/end() */
770 int kswapd_max_order; 779 int kswapd_max_order;
771 enum zone_type classzone_idx; 780 enum zone_type classzone_idx;
772#ifdef CONFIG_NUMA_BALANCING 781#ifdef CONFIG_NUMA_BALANCING
@@ -808,10 +817,10 @@ static inline bool pgdat_is_empty(pg_data_t *pgdat)
808extern struct mutex zonelists_mutex; 817extern struct mutex zonelists_mutex;
809void build_all_zonelists(pg_data_t *pgdat, struct zone *zone); 818void build_all_zonelists(pg_data_t *pgdat, struct zone *zone);
810void wakeup_kswapd(struct zone *zone, int order, enum zone_type classzone_idx); 819void wakeup_kswapd(struct zone *zone, int order, enum zone_type classzone_idx);
811bool zone_watermark_ok(struct zone *z, int order, unsigned long mark, 820bool zone_watermark_ok(struct zone *z, unsigned int order,
812 int classzone_idx, int alloc_flags); 821 unsigned long mark, int classzone_idx, int alloc_flags);
813bool zone_watermark_ok_safe(struct zone *z, int order, unsigned long mark, 822bool zone_watermark_ok_safe(struct zone *z, unsigned int order,
814 int classzone_idx, int alloc_flags); 823 unsigned long mark, int classzone_idx, int alloc_flags);
815enum memmap_context { 824enum memmap_context {
816 MEMMAP_EARLY, 825 MEMMAP_EARLY,
817 MEMMAP_HOTPLUG, 826 MEMMAP_HOTPLUG,
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index b42d07b0390b..6c1ae9fd9505 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -493,7 +493,7 @@ static inline void napi_disable(struct napi_struct *n)
493static inline void napi_enable(struct napi_struct *n) 493static inline void napi_enable(struct napi_struct *n)
494{ 494{
495 BUG_ON(!test_bit(NAPI_STATE_SCHED, &n->state)); 495 BUG_ON(!test_bit(NAPI_STATE_SCHED, &n->state));
496 smp_mb__before_clear_bit(); 496 smp_mb__before_atomic();
497 clear_bit(NAPI_STATE_SCHED, &n->state); 497 clear_bit(NAPI_STATE_SCHED, &n->state);
498} 498}
499 499
diff --git a/include/linux/of.h b/include/linux/of.h
index e6f0988c1c68..196b34c1ef4e 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -130,6 +130,12 @@ static inline int of_node_check_flag(struct device_node *n, unsigned long flag)
130 return test_bit(flag, &n->_flags); 130 return test_bit(flag, &n->_flags);
131} 131}
132 132
133static inline int of_node_test_and_set_flag(struct device_node *n,
134 unsigned long flag)
135{
136 return test_and_set_bit(flag, &n->_flags);
137}
138
133static inline void of_node_set_flag(struct device_node *n, unsigned long flag) 139static inline void of_node_set_flag(struct device_node *n, unsigned long flag)
134{ 140{
135 set_bit(flag, &n->_flags); 141 set_bit(flag, &n->_flags);
@@ -197,6 +203,7 @@ static inline unsigned long of_read_ulong(const __be32 *cell, int size)
197/* flag descriptions */ 203/* flag descriptions */
198#define OF_DYNAMIC 1 /* node and properties were allocated via kmalloc */ 204#define OF_DYNAMIC 1 /* node and properties were allocated via kmalloc */
199#define OF_DETACHED 2 /* node has been detached from the device tree */ 205#define OF_DETACHED 2 /* node has been detached from the device tree */
206#define OF_POPULATED 3 /* device already created for the node */
200 207
201#define OF_IS_DYNAMIC(x) test_bit(OF_DYNAMIC, &x->_flags) 208#define OF_IS_DYNAMIC(x) test_bit(OF_DYNAMIC, &x->_flags)
202#define OF_MARK_DYNAMIC(x) set_bit(OF_DYNAMIC, &x->_flags) 209#define OF_MARK_DYNAMIC(x) set_bit(OF_DYNAMIC, &x->_flags)
@@ -757,4 +764,26 @@ static inline int of_get_available_child_count(const struct device_node *np)
757 return num; 764 return num;
758} 765}
759 766
767#ifdef CONFIG_OF
768#define _OF_DECLARE(table, name, compat, fn, fn_type) \
769 static const struct of_device_id __of_table_##name \
770 __used __section(__##table##_of_table) \
771 = { .compatible = compat, \
772 .data = (fn == (fn_type)NULL) ? fn : fn }
773#else
774#define _OF_DECLARE(table, name, compat, fn, fn_type) \
775 static const struct of_device_id __of_table_##name \
776 __attribute__((unused)) \
777 = { .compatible = compat, \
778 .data = (fn == (fn_type)NULL) ? fn : fn }
779#endif
780
781typedef int (*of_init_fn_2)(struct device_node *, struct device_node *);
782typedef void (*of_init_fn_1)(struct device_node *);
783
784#define OF_DECLARE_1(table, name, compat, fn) \
785 _OF_DECLARE(table, name, compat, fn, of_init_fn_1)
786#define OF_DECLARE_2(table, name, compat, fn) \
787 _OF_DECLARE(table, name, compat, fn, of_init_fn_2)
788
760#endif /* _LINUX_OF_H */ 789#endif /* _LINUX_OF_H */
diff --git a/include/linux/of_address.h b/include/linux/of_address.h
index 5f6ed6b182b8..c13b8782a4eb 100644
--- a/include/linux/of_address.h
+++ b/include/linux/of_address.h
@@ -40,7 +40,6 @@ extern u64 of_translate_dma_address(struct device_node *dev,
40 40
41#ifdef CONFIG_OF_ADDRESS 41#ifdef CONFIG_OF_ADDRESS
42extern u64 of_translate_address(struct device_node *np, const __be32 *addr); 42extern u64 of_translate_address(struct device_node *np, const __be32 *addr);
43extern bool of_can_translate_address(struct device_node *dev);
44extern int of_address_to_resource(struct device_node *dev, int index, 43extern int of_address_to_resource(struct device_node *dev, int index,
45 struct resource *r); 44 struct resource *r);
46extern struct device_node *of_find_matching_node_by_address( 45extern struct device_node *of_find_matching_node_by_address(
@@ -63,6 +62,9 @@ extern int of_pci_range_parser_init(struct of_pci_range_parser *parser,
63extern struct of_pci_range *of_pci_range_parser_one( 62extern struct of_pci_range *of_pci_range_parser_one(
64 struct of_pci_range_parser *parser, 63 struct of_pci_range_parser *parser,
65 struct of_pci_range *range); 64 struct of_pci_range *range);
65extern int of_dma_get_range(struct device_node *np, u64 *dma_addr,
66 u64 *paddr, u64 *size);
67extern bool of_dma_is_coherent(struct device_node *np);
66#else /* CONFIG_OF_ADDRESS */ 68#else /* CONFIG_OF_ADDRESS */
67static inline struct device_node *of_find_matching_node_by_address( 69static inline struct device_node *of_find_matching_node_by_address(
68 struct device_node *from, 70 struct device_node *from,
@@ -90,6 +92,17 @@ static inline struct of_pci_range *of_pci_range_parser_one(
90{ 92{
91 return NULL; 93 return NULL;
92} 94}
95
96static inline int of_dma_get_range(struct device_node *np, u64 *dma_addr,
97 u64 *paddr, u64 *size)
98{
99 return -ENODEV;
100}
101
102static inline bool of_dma_is_coherent(struct device_node *np)
103{
104 return false;
105}
93#endif /* CONFIG_OF_ADDRESS */ 106#endif /* CONFIG_OF_ADDRESS */
94 107
95#ifdef CONFIG_OF 108#ifdef CONFIG_OF
diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
index ddd7219af8ac..05117899fcb4 100644
--- a/include/linux/of_fdt.h
+++ b/include/linux/of_fdt.h
@@ -17,60 +17,23 @@
17 17
18/* Definitions used by the flattened device tree */ 18/* Definitions used by the flattened device tree */
19#define OF_DT_HEADER 0xd00dfeed /* marker */ 19#define OF_DT_HEADER 0xd00dfeed /* marker */
20#define OF_DT_BEGIN_NODE 0x1 /* Start of node, full name */
21#define OF_DT_END_NODE 0x2 /* End node */
22#define OF_DT_PROP 0x3 /* Property: name off, size,
23 * content */
24#define OF_DT_NOP 0x4 /* nop */
25#define OF_DT_END 0x9
26
27#define OF_DT_VERSION 0x10
28 20
29#ifndef __ASSEMBLY__ 21#ifndef __ASSEMBLY__
30/*
31 * This is what gets passed to the kernel by prom_init or kexec
32 *
33 * The dt struct contains the device tree structure, full pathes and
34 * property contents. The dt strings contain a separate block with just
35 * the strings for the property names, and is fully page aligned and
36 * self contained in a page, so that it can be kept around by the kernel,
37 * each property name appears only once in this page (cheap compression)
38 *
39 * the mem_rsvmap contains a map of reserved ranges of physical memory,
40 * passing it here instead of in the device-tree itself greatly simplifies
41 * the job of everybody. It's just a list of u64 pairs (base/size) that
42 * ends when size is 0
43 */
44struct boot_param_header {
45 __be32 magic; /* magic word OF_DT_HEADER */
46 __be32 totalsize; /* total size of DT block */
47 __be32 off_dt_struct; /* offset to structure */
48 __be32 off_dt_strings; /* offset to strings */
49 __be32 off_mem_rsvmap; /* offset to memory reserve map */
50 __be32 version; /* format version */
51 __be32 last_comp_version; /* last compatible version */
52 /* version 2 fields below */
53 __be32 boot_cpuid_phys; /* Physical CPU id we're booting on */
54 /* version 3 fields below */
55 __be32 dt_strings_size; /* size of the DT strings block */
56 /* version 17 fields below */
57 __be32 dt_struct_size; /* size of the DT structure block */
58};
59 22
60#if defined(CONFIG_OF_FLATTREE) 23#if defined(CONFIG_OF_FLATTREE)
61 24
62struct device_node; 25struct device_node;
63 26
64/* For scanning an arbitrary device-tree at any time */ 27/* For scanning an arbitrary device-tree at any time */
65extern char *of_fdt_get_string(struct boot_param_header *blob, u32 offset); 28extern char *of_fdt_get_string(const void *blob, u32 offset);
66extern void *of_fdt_get_property(struct boot_param_header *blob, 29extern void *of_fdt_get_property(const void *blob,
67 unsigned long node, 30 unsigned long node,
68 const char *name, 31 const char *name,
69 unsigned long *size); 32 int *size);
70extern int of_fdt_is_compatible(struct boot_param_header *blob, 33extern int of_fdt_is_compatible(const void *blob,
71 unsigned long node, 34 unsigned long node,
72 const char *compat); 35 const char *compat);
73extern int of_fdt_match(struct boot_param_header *blob, unsigned long node, 36extern int of_fdt_match(const void *blob, unsigned long node,
74 const char *const *compat); 37 const char *const *compat);
75extern void of_fdt_unflatten_tree(unsigned long *blob, 38extern void of_fdt_unflatten_tree(unsigned long *blob,
76 struct device_node **mynodes); 39 struct device_node **mynodes);
@@ -78,21 +41,21 @@ extern void of_fdt_unflatten_tree(unsigned long *blob,
78/* TBD: Temporary export of fdt globals - remove when code fully merged */ 41/* TBD: Temporary export of fdt globals - remove when code fully merged */
79extern int __initdata dt_root_addr_cells; 42extern int __initdata dt_root_addr_cells;
80extern int __initdata dt_root_size_cells; 43extern int __initdata dt_root_size_cells;
81extern struct boot_param_header *initial_boot_params; 44extern void *initial_boot_params;
45
46extern char __dtb_start[];
47extern char __dtb_end[];
82 48
83/* For scanning the flat device-tree at boot time */ 49/* For scanning the flat device-tree at boot time */
84extern char *find_flat_dt_string(u32 offset);
85extern int of_scan_flat_dt(int (*it)(unsigned long node, const char *uname, 50extern int of_scan_flat_dt(int (*it)(unsigned long node, const char *uname,
86 int depth, void *data), 51 int depth, void *data),
87 void *data); 52 void *data);
88extern void *of_get_flat_dt_prop(unsigned long node, const char *name, 53extern const void *of_get_flat_dt_prop(unsigned long node, const char *name,
89 unsigned long *size); 54 int *size);
90extern int of_flat_dt_is_compatible(unsigned long node, const char *name); 55extern int of_flat_dt_is_compatible(unsigned long node, const char *name);
91extern int of_flat_dt_match(unsigned long node, const char *const *matches); 56extern int of_flat_dt_match(unsigned long node, const char *const *matches);
92extern unsigned long of_get_flat_dt_root(void); 57extern unsigned long of_get_flat_dt_root(void);
93extern int of_scan_flat_dt_by_path(const char *path, 58extern int of_get_flat_dt_size(void);
94 int (*it)(unsigned long node, const char *name, int depth, void *data),
95 void *data);
96 59
97extern int early_init_dt_scan_chosen(unsigned long node, const char *uname, 60extern int early_init_dt_scan_chosen(unsigned long node, const char *uname,
98 int depth, void *data); 61 int depth, void *data);
@@ -103,7 +66,7 @@ extern void early_init_dt_add_memory_arch(u64 base, u64 size);
103extern int early_init_dt_reserve_memory_arch(phys_addr_t base, phys_addr_t size, 66extern int early_init_dt_reserve_memory_arch(phys_addr_t base, phys_addr_t size,
104 bool no_map); 67 bool no_map);
105extern void * early_init_dt_alloc_memory_arch(u64 size, u64 align); 68extern void * early_init_dt_alloc_memory_arch(u64 size, u64 align);
106extern u64 dt_mem_next_cell(int s, __be32 **cellp); 69extern u64 dt_mem_next_cell(int s, const __be32 **cellp);
107 70
108/* Early flat tree scan hooks */ 71/* Early flat tree scan hooks */
109extern int early_init_dt_scan_root(unsigned long node, const char *uname, 72extern int early_init_dt_scan_root(unsigned long node, const char *uname,
@@ -120,6 +83,7 @@ extern void unflatten_device_tree(void);
120extern void unflatten_and_copy_device_tree(void); 83extern void unflatten_and_copy_device_tree(void);
121extern void early_init_devtree(void *); 84extern void early_init_devtree(void *);
122extern void early_get_first_memblock_info(void *, phys_addr_t *); 85extern void early_get_first_memblock_info(void *, phys_addr_t *);
86extern u64 fdt_translate_address(const void *blob, int node_offset);
123#else /* CONFIG_OF_FLATTREE */ 87#else /* CONFIG_OF_FLATTREE */
124static inline void early_init_fdt_scan_reserved_mem(void) {} 88static inline void early_init_fdt_scan_reserved_mem(void) {}
125static inline const char *of_flat_dt_get_machine_name(void) { return NULL; } 89static inline const char *of_flat_dt_get_machine_name(void) { return NULL; }
diff --git a/include/linux/of_gpio.h b/include/linux/of_gpio.h
index f14123a5a9df..38fc05036015 100644
--- a/include/linux/of_gpio.h
+++ b/include/linux/of_gpio.h
@@ -19,7 +19,6 @@
19#include <linux/errno.h> 19#include <linux/errno.h>
20#include <linux/gpio.h> 20#include <linux/gpio.h>
21#include <linux/of.h> 21#include <linux/of.h>
22#include <linux/gpio/consumer.h>
23 22
24struct device_node; 23struct device_node;
25 24
@@ -48,7 +47,7 @@ static inline struct of_mm_gpio_chip *to_of_mm_gpio_chip(struct gpio_chip *gc)
48 return container_of(gc, struct of_mm_gpio_chip, gc); 47 return container_of(gc, struct of_mm_gpio_chip, gc);
49} 48}
50 49
51extern struct gpio_desc *of_get_named_gpiod_flags(struct device_node *np, 50extern int of_get_named_gpio_flags(struct device_node *np,
52 const char *list_name, int index, enum of_gpio_flags *flags); 51 const char *list_name, int index, enum of_gpio_flags *flags);
53 52
54extern int of_mm_gpiochip_add(struct device_node *np, 53extern int of_mm_gpiochip_add(struct device_node *np,
@@ -63,10 +62,10 @@ extern int of_gpio_simple_xlate(struct gpio_chip *gc,
63#else /* CONFIG_OF_GPIO */ 62#else /* CONFIG_OF_GPIO */
64 63
65/* Drivers may not strictly depend on the GPIO support, so let them link. */ 64/* Drivers may not strictly depend on the GPIO support, so let them link. */
66static inline struct gpio_desc *of_get_named_gpiod_flags(struct device_node *np, 65static inline int of_get_named_gpio_flags(struct device_node *np,
67 const char *list_name, int index, enum of_gpio_flags *flags) 66 const char *list_name, int index, enum of_gpio_flags *flags)
68{ 67{
69 return ERR_PTR(-ENOSYS); 68 return -ENOSYS;
70} 69}
71 70
72static inline int of_gpio_simple_xlate(struct gpio_chip *gc, 71static inline int of_gpio_simple_xlate(struct gpio_chip *gc,
@@ -81,18 +80,6 @@ static inline void of_gpiochip_remove(struct gpio_chip *gc) { }
81 80
82#endif /* CONFIG_OF_GPIO */ 81#endif /* CONFIG_OF_GPIO */
83 82
84static inline int of_get_named_gpio_flags(struct device_node *np,
85 const char *list_name, int index, enum of_gpio_flags *flags)
86{
87 struct gpio_desc *desc;
88 desc = of_get_named_gpiod_flags(np, list_name, index, flags);
89
90 if (IS_ERR(desc))
91 return PTR_ERR(desc);
92 else
93 return desc_to_gpio(desc);
94}
95
96/** 83/**
97 * of_gpio_named_count() - Count GPIOs for a device 84 * of_gpio_named_count() - Count GPIOs for a device
98 * @np: device node to count GPIOs for 85 * @np: device node to count GPIOs for
@@ -129,22 +116,6 @@ static inline int of_gpio_count(struct device_node *np)
129 return of_gpio_named_count(np, "gpios"); 116 return of_gpio_named_count(np, "gpios");
130} 117}
131 118
132/**
133 * of_get_gpiod_flags() - Get a GPIO descriptor and flags to use with GPIO API
134 * @np: device node to get GPIO from
135 * @index: index of the GPIO
136 * @flags: a flags pointer to fill in
137 *
138 * Returns GPIO descriptor to use with Linux generic GPIO API, or a errno
139 * value on the error condition. If @flags is not NULL the function also fills
140 * in flags for the GPIO.
141 */
142static inline struct gpio_desc *of_get_gpiod_flags(struct device_node *np,
143 int index, enum of_gpio_flags *flags)
144{
145 return of_get_named_gpiod_flags(np, "gpios", index, flags);
146}
147
148static inline int of_get_gpio_flags(struct device_node *np, int index, 119static inline int of_get_gpio_flags(struct device_node *np, int index,
149 enum of_gpio_flags *flags) 120 enum of_gpio_flags *flags)
150{ 121{
diff --git a/include/linux/of_irq.h b/include/linux/of_irq.h
index 6404253d810d..bfec136a6d1e 100644
--- a/include/linux/of_irq.h
+++ b/include/linux/of_irq.h
@@ -45,6 +45,7 @@ extern void of_irq_init(const struct of_device_id *matches);
45#ifdef CONFIG_OF_IRQ 45#ifdef CONFIG_OF_IRQ
46extern int of_irq_count(struct device_node *dev); 46extern int of_irq_count(struct device_node *dev);
47extern int of_irq_get(struct device_node *dev, int index); 47extern int of_irq_get(struct device_node *dev, int index);
48extern int of_irq_get_byname(struct device_node *dev, const char *name);
48#else 49#else
49static inline int of_irq_count(struct device_node *dev) 50static inline int of_irq_count(struct device_node *dev)
50{ 51{
@@ -54,6 +55,10 @@ static inline int of_irq_get(struct device_node *dev, int index)
54{ 55{
55 return 0; 56 return 0;
56} 57}
58static inline int of_irq_get_byname(struct device_node *dev, const char *name)
59{
60 return 0;
61}
57#endif 62#endif
58 63
59#if defined(CONFIG_OF) 64#if defined(CONFIG_OF)
diff --git a/include/linux/of_pci.h b/include/linux/of_pci.h
index 1a1f5ffd5288..dde3a4a0fa5d 100644
--- a/include/linux/of_pci.h
+++ b/include/linux/of_pci.h
@@ -6,14 +6,44 @@
6 6
7struct pci_dev; 7struct pci_dev;
8struct of_phandle_args; 8struct of_phandle_args;
9int of_irq_parse_pci(const struct pci_dev *pdev, struct of_phandle_args *out_irq);
10int of_irq_parse_and_map_pci(const struct pci_dev *dev, u8 slot, u8 pin);
11
12struct device_node; 9struct device_node;
10
11#ifdef CONFIG_OF
12int of_irq_parse_pci(const struct pci_dev *pdev, struct of_phandle_args *out_irq);
13struct device_node *of_pci_find_child_device(struct device_node *parent, 13struct device_node *of_pci_find_child_device(struct device_node *parent,
14 unsigned int devfn); 14 unsigned int devfn);
15int of_pci_get_devfn(struct device_node *np); 15int of_pci_get_devfn(struct device_node *np);
16int of_irq_parse_and_map_pci(const struct pci_dev *dev, u8 slot, u8 pin);
16int of_pci_parse_bus_range(struct device_node *node, struct resource *res); 17int of_pci_parse_bus_range(struct device_node *node, struct resource *res);
18#else
19static inline int of_irq_parse_pci(const struct pci_dev *pdev, struct of_phandle_args *out_irq)
20{
21 return 0;
22}
23
24static inline struct device_node *of_pci_find_child_device(struct device_node *parent,
25 unsigned int devfn)
26{
27 return NULL;
28}
29
30static inline int of_pci_get_devfn(struct device_node *np)
31{
32 return -EINVAL;
33}
34
35static inline int
36of_irq_parse_and_map_pci(const struct pci_dev *dev, u8 slot, u8 pin)
37{
38 return 0;
39}
40
41static inline int
42of_pci_parse_bus_range(struct device_node *node, struct resource *res)
43{
44 return -EINVAL;
45}
46#endif
17 47
18#if defined(CONFIG_OF) && defined(CONFIG_PCI_MSI) 48#if defined(CONFIG_OF) && defined(CONFIG_PCI_MSI)
19int of_pci_msi_chip_add(struct msi_chip *chip); 49int of_pci_msi_chip_add(struct msi_chip *chip);
diff --git a/include/linux/of_platform.h b/include/linux/of_platform.h
index 05cb4a928252..d96e1badbee0 100644
--- a/include/linux/of_platform.h
+++ b/include/linux/of_platform.h
@@ -37,7 +37,7 @@
37 * Note: Using an auxdata lookup table should be considered a last resort when 37 * Note: Using an auxdata lookup table should be considered a last resort when
38 * converting a platform to use the DT. Normally the automatically generated 38 * converting a platform to use the DT. Normally the automatically generated
39 * device name will not matter, and drivers should obtain data from the device 39 * device name will not matter, and drivers should obtain data from the device
40 * node instead of from an anonymouns platform_data pointer. 40 * node instead of from an anonymous platform_data pointer.
41 */ 41 */
42struct of_dev_auxdata { 42struct of_dev_auxdata {
43 char *compatible; 43 char *compatible;
@@ -72,6 +72,7 @@ extern int of_platform_populate(struct device_node *root,
72 const struct of_device_id *matches, 72 const struct of_device_id *matches,
73 const struct of_dev_auxdata *lookup, 73 const struct of_dev_auxdata *lookup,
74 struct device *parent); 74 struct device *parent);
75extern int of_platform_depopulate(struct device *parent);
75#else 76#else
76static inline int of_platform_populate(struct device_node *root, 77static inline int of_platform_populate(struct device_node *root,
77 const struct of_device_id *matches, 78 const struct of_device_id *matches,
@@ -80,6 +81,10 @@ static inline int of_platform_populate(struct device_node *root,
80{ 81{
81 return -ENODEV; 82 return -ENODEV;
82} 83}
84static inline int of_platform_depopulate(struct device *parent)
85{
86 return -ENODEV;
87}
83#endif 88#endif
84 89
85#endif /* _LINUX_OF_PLATFORM_H */ 90#endif /* _LINUX_OF_PLATFORM_H */
diff --git a/include/linux/of_reserved_mem.h b/include/linux/of_reserved_mem.h
index 9b1fbb7f29fc..4669ddfdd5af 100644
--- a/include/linux/of_reserved_mem.h
+++ b/include/linux/of_reserved_mem.h
@@ -21,33 +21,19 @@ struct reserved_mem_ops {
21 struct device *dev); 21 struct device *dev);
22}; 22};
23 23
24typedef int (*reservedmem_of_init_fn)(struct reserved_mem *rmem, 24typedef int (*reservedmem_of_init_fn)(struct reserved_mem *rmem);
25 unsigned long node, const char *uname); 25
26#define RESERVEDMEM_OF_DECLARE(name, compat, init) \
27 _OF_DECLARE(reservedmem, name, compat, init, reservedmem_of_init_fn)
26 28
27#ifdef CONFIG_OF_RESERVED_MEM 29#ifdef CONFIG_OF_RESERVED_MEM
28void fdt_init_reserved_mem(void); 30void fdt_init_reserved_mem(void);
29void fdt_reserved_mem_save_node(unsigned long node, const char *uname, 31void fdt_reserved_mem_save_node(unsigned long node, const char *uname,
30 phys_addr_t base, phys_addr_t size); 32 phys_addr_t base, phys_addr_t size);
31
32#define RESERVEDMEM_OF_DECLARE(name, compat, init) \
33 static const struct of_device_id __reservedmem_of_table_##name \
34 __used __section(__reservedmem_of_table) \
35 = { .compatible = compat, \
36 .data = (init == (reservedmem_of_init_fn)NULL) ? \
37 init : init }
38
39#else 33#else
40static inline void fdt_init_reserved_mem(void) { } 34static inline void fdt_init_reserved_mem(void) { }
41static inline void fdt_reserved_mem_save_node(unsigned long node, 35static inline void fdt_reserved_mem_save_node(unsigned long node,
42 const char *uname, phys_addr_t base, phys_addr_t size) { } 36 const char *uname, phys_addr_t base, phys_addr_t size) { }
43
44#define RESERVEDMEM_OF_DECLARE(name, compat, init) \
45 static const struct of_device_id __reservedmem_of_table_##name \
46 __attribute__((unused)) \
47 = { .compatible = compat, \
48 .data = (init == (reservedmem_of_init_fn)NULL) ? \
49 init : init }
50
51#endif 37#endif
52 38
53#endif /* __OF_RESERVED_MEM_H */ 39#endif /* __OF_RESERVED_MEM_H */
diff --git a/include/linux/omap-dma.h b/include/linux/omap-dma.h
index 7944cdc27bed..c29a6dee6bec 100644
--- a/include/linux/omap-dma.h
+++ b/include/linux/omap-dma.h
@@ -393,7 +393,7 @@ extern int omap_modify_dma_chain_params(int chain_id,
393extern int omap_dma_chain_status(int chain_id); 393extern int omap_dma_chain_status(int chain_id);
394#endif 394#endif
395 395
396#if defined(CONFIG_ARCH_OMAP1) && defined(CONFIG_FB_OMAP) 396#if defined(CONFIG_ARCH_OMAP1) && IS_ENABLED(CONFIG_FB_OMAP)
397#include <mach/lcd_dma.h> 397#include <mach/lcd_dma.h>
398#else 398#else
399static inline int omap_lcd_dma_running(void) 399static inline int omap_lcd_dma_running(void)
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index d1fe1a761047..2093eb72785e 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -198,6 +198,7 @@ struct page; /* forward declaration */
198TESTPAGEFLAG(Locked, locked) 198TESTPAGEFLAG(Locked, locked)
199PAGEFLAG(Error, error) TESTCLEARFLAG(Error, error) 199PAGEFLAG(Error, error) TESTCLEARFLAG(Error, error)
200PAGEFLAG(Referenced, referenced) TESTCLEARFLAG(Referenced, referenced) 200PAGEFLAG(Referenced, referenced) TESTCLEARFLAG(Referenced, referenced)
201 __SETPAGEFLAG(Referenced, referenced)
201PAGEFLAG(Dirty, dirty) TESTSCFLAG(Dirty, dirty) __CLEARPAGEFLAG(Dirty, dirty) 202PAGEFLAG(Dirty, dirty) TESTSCFLAG(Dirty, dirty) __CLEARPAGEFLAG(Dirty, dirty)
202PAGEFLAG(LRU, lru) __CLEARPAGEFLAG(LRU, lru) 203PAGEFLAG(LRU, lru) __CLEARPAGEFLAG(LRU, lru)
203PAGEFLAG(Active, active) __CLEARPAGEFLAG(Active, active) 204PAGEFLAG(Active, active) __CLEARPAGEFLAG(Active, active)
@@ -208,6 +209,7 @@ PAGEFLAG(Pinned, pinned) TESTSCFLAG(Pinned, pinned) /* Xen */
208PAGEFLAG(SavePinned, savepinned); /* Xen */ 209PAGEFLAG(SavePinned, savepinned); /* Xen */
209PAGEFLAG(Reserved, reserved) __CLEARPAGEFLAG(Reserved, reserved) 210PAGEFLAG(Reserved, reserved) __CLEARPAGEFLAG(Reserved, reserved)
210PAGEFLAG(SwapBacked, swapbacked) __CLEARPAGEFLAG(SwapBacked, swapbacked) 211PAGEFLAG(SwapBacked, swapbacked) __CLEARPAGEFLAG(SwapBacked, swapbacked)
212 __SETPAGEFLAG(SwapBacked, swapbacked)
211 213
212__PAGEFLAG(SlobFree, slob_free) 214__PAGEFLAG(SlobFree, slob_free)
213 215
diff --git a/include/linux/pageblock-flags.h b/include/linux/pageblock-flags.h
index 2ee8cd2466b5..2baeee12f48e 100644
--- a/include/linux/pageblock-flags.h
+++ b/include/linux/pageblock-flags.h
@@ -30,9 +30,12 @@ enum pageblock_bits {
30 PB_migrate, 30 PB_migrate,
31 PB_migrate_end = PB_migrate + 3 - 1, 31 PB_migrate_end = PB_migrate + 3 - 1,
32 /* 3 bits required for migrate types */ 32 /* 3 bits required for migrate types */
33#ifdef CONFIG_COMPACTION
34 PB_migrate_skip,/* If set the block is skipped by compaction */ 33 PB_migrate_skip,/* If set the block is skipped by compaction */
35#endif /* CONFIG_COMPACTION */ 34
35 /*
36 * Assume the bits will always align on a word. If this assumption
37 * changes then get/set pageblock needs updating.
38 */
36 NR_PAGEBLOCK_BITS 39 NR_PAGEBLOCK_BITS
37}; 40};
38 41
@@ -62,11 +65,26 @@ extern int pageblock_order;
62/* Forward declaration */ 65/* Forward declaration */
63struct page; 66struct page;
64 67
68unsigned long get_pfnblock_flags_mask(struct page *page,
69 unsigned long pfn,
70 unsigned long end_bitidx,
71 unsigned long mask);
72
73void set_pfnblock_flags_mask(struct page *page,
74 unsigned long flags,
75 unsigned long pfn,
76 unsigned long end_bitidx,
77 unsigned long mask);
78
65/* Declarations for getting and setting flags. See mm/page_alloc.c */ 79/* Declarations for getting and setting flags. See mm/page_alloc.c */
66unsigned long get_pageblock_flags_group(struct page *page, 80#define get_pageblock_flags_group(page, start_bitidx, end_bitidx) \
67 int start_bitidx, int end_bitidx); 81 get_pfnblock_flags_mask(page, page_to_pfn(page), \
68void set_pageblock_flags_group(struct page *page, unsigned long flags, 82 end_bitidx, \
69 int start_bitidx, int end_bitidx); 83 (1 << (end_bitidx - start_bitidx + 1)) - 1)
84#define set_pageblock_flags_group(page, flags, start_bitidx, end_bitidx) \
85 set_pfnblock_flags_mask(page, flags, page_to_pfn(page), \
86 end_bitidx, \
87 (1 << (end_bitidx - start_bitidx + 1)) - 1)
70 88
71#ifdef CONFIG_COMPACTION 89#ifdef CONFIG_COMPACTION
72#define get_pageblock_skip(page) \ 90#define get_pageblock_skip(page) \
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index 45598f1e9aa3..0a97b583ee8d 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -110,7 +110,7 @@ static inline void mapping_set_gfp_mask(struct address_space *m, gfp_t mask)
110 110
111#define page_cache_get(page) get_page(page) 111#define page_cache_get(page) get_page(page)
112#define page_cache_release(page) put_page(page) 112#define page_cache_release(page) put_page(page)
113void release_pages(struct page **pages, int nr, int cold); 113void release_pages(struct page **pages, int nr, bool cold);
114 114
115/* 115/*
116 * speculatively take a reference to a page. 116 * speculatively take a reference to a page.
@@ -259,12 +259,109 @@ pgoff_t page_cache_next_hole(struct address_space *mapping,
259pgoff_t page_cache_prev_hole(struct address_space *mapping, 259pgoff_t page_cache_prev_hole(struct address_space *mapping,
260 pgoff_t index, unsigned long max_scan); 260 pgoff_t index, unsigned long max_scan);
261 261
262#define FGP_ACCESSED 0x00000001
263#define FGP_LOCK 0x00000002
264#define FGP_CREAT 0x00000004
265#define FGP_WRITE 0x00000008
266#define FGP_NOFS 0x00000010
267#define FGP_NOWAIT 0x00000020
268
269struct page *pagecache_get_page(struct address_space *mapping, pgoff_t offset,
270 int fgp_flags, gfp_t cache_gfp_mask, gfp_t radix_gfp_mask);
271
272/**
273 * find_get_page - find and get a page reference
274 * @mapping: the address_space to search
275 * @offset: the page index
276 *
277 * Looks up the page cache slot at @mapping & @offset. If there is a
278 * page cache page, it is returned with an increased refcount.
279 *
280 * Otherwise, %NULL is returned.
281 */
282static inline struct page *find_get_page(struct address_space *mapping,
283 pgoff_t offset)
284{
285 return pagecache_get_page(mapping, offset, 0, 0, 0);
286}
287
288static inline struct page *find_get_page_flags(struct address_space *mapping,
289 pgoff_t offset, int fgp_flags)
290{
291 return pagecache_get_page(mapping, offset, fgp_flags, 0, 0);
292}
293
294/**
295 * find_lock_page - locate, pin and lock a pagecache page
296 * pagecache_get_page - find and get a page reference
297 * @mapping: the address_space to search
298 * @offset: the page index
299 *
300 * Looks up the page cache slot at @mapping & @offset. If there is a
301 * page cache page, it is returned locked and with an increased
302 * refcount.
303 *
304 * Otherwise, %NULL is returned.
305 *
306 * find_lock_page() may sleep.
307 */
308static inline struct page *find_lock_page(struct address_space *mapping,
309 pgoff_t offset)
310{
311 return pagecache_get_page(mapping, offset, FGP_LOCK, 0, 0);
312}
313
314/**
315 * find_or_create_page - locate or add a pagecache page
316 * @mapping: the page's address_space
317 * @index: the page's index into the mapping
318 * @gfp_mask: page allocation mode
319 *
320 * Looks up the page cache slot at @mapping & @offset. If there is a
321 * page cache page, it is returned locked and with an increased
322 * refcount.
323 *
324 * If the page is not present, a new page is allocated using @gfp_mask
325 * and added to the page cache and the VM's LRU list. The page is
326 * returned locked and with an increased refcount.
327 *
328 * On memory exhaustion, %NULL is returned.
329 *
330 * find_or_create_page() may sleep, even if @gfp_flags specifies an
331 * atomic allocation!
332 */
333static inline struct page *find_or_create_page(struct address_space *mapping,
334 pgoff_t offset, gfp_t gfp_mask)
335{
336 return pagecache_get_page(mapping, offset,
337 FGP_LOCK|FGP_ACCESSED|FGP_CREAT,
338 gfp_mask, gfp_mask & GFP_RECLAIM_MASK);
339}
340
341/**
342 * grab_cache_page_nowait - returns locked page at given index in given cache
343 * @mapping: target address_space
344 * @index: the page index
345 *
346 * Same as grab_cache_page(), but do not wait if the page is unavailable.
347 * This is intended for speculative data generators, where the data can
348 * be regenerated if the page couldn't be grabbed. This routine should
349 * be safe to call while holding the lock for another page.
350 *
351 * Clear __GFP_FS when allocating the page to avoid recursion into the fs
352 * and deadlock against the caller's locked page.
353 */
354static inline struct page *grab_cache_page_nowait(struct address_space *mapping,
355 pgoff_t index)
356{
357 return pagecache_get_page(mapping, index,
358 FGP_LOCK|FGP_CREAT|FGP_NOFS|FGP_NOWAIT,
359 mapping_gfp_mask(mapping),
360 GFP_NOFS);
361}
362
262struct page *find_get_entry(struct address_space *mapping, pgoff_t offset); 363struct page *find_get_entry(struct address_space *mapping, pgoff_t offset);
263struct page *find_get_page(struct address_space *mapping, pgoff_t offset);
264struct page *find_lock_entry(struct address_space *mapping, pgoff_t offset); 364struct page *find_lock_entry(struct address_space *mapping, pgoff_t offset);
265struct page *find_lock_page(struct address_space *mapping, pgoff_t offset);
266struct page *find_or_create_page(struct address_space *mapping, pgoff_t index,
267 gfp_t gfp_mask);
268unsigned find_get_entries(struct address_space *mapping, pgoff_t start, 365unsigned find_get_entries(struct address_space *mapping, pgoff_t start,
269 unsigned int nr_entries, struct page **entries, 366 unsigned int nr_entries, struct page **entries,
270 pgoff_t *indices); 367 pgoff_t *indices);
@@ -287,8 +384,6 @@ static inline struct page *grab_cache_page(struct address_space *mapping,
287 return find_or_create_page(mapping, index, mapping_gfp_mask(mapping)); 384 return find_or_create_page(mapping, index, mapping_gfp_mask(mapping));
288} 385}
289 386
290extern struct page * grab_cache_page_nowait(struct address_space *mapping,
291 pgoff_t index);
292extern struct page * read_cache_page(struct address_space *mapping, 387extern struct page * read_cache_page(struct address_space *mapping,
293 pgoff_t index, filler_t *filler, void *data); 388 pgoff_t index, filler_t *filler, void *data);
294extern struct page * read_cache_page_gfp(struct address_space *mapping, 389extern struct page * read_cache_page_gfp(struct address_space *mapping,
@@ -425,6 +520,8 @@ static inline void wait_on_page_writeback(struct page *page)
425extern void end_page_writeback(struct page *page); 520extern void end_page_writeback(struct page *page);
426void wait_for_stable_page(struct page *page); 521void wait_for_stable_page(struct page *page);
427 522
523void page_endio(struct page *page, int rw, int err);
524
428/* 525/*
429 * Add an arbitrary waiter to a page's wait queue 526 * Add an arbitrary waiter to a page's wait queue
430 */ 527 */
diff --git a/include/linux/pci.h b/include/linux/pci.h
index aab57b4abe7f..71d9673c1b2c 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -365,6 +365,7 @@ struct pci_dev {
365#endif 365#endif
366 phys_addr_t rom; /* Physical address of ROM if it's not from the BAR */ 366 phys_addr_t rom; /* Physical address of ROM if it's not from the BAR */
367 size_t romlen; /* Length of ROM if it's not from the BAR */ 367 size_t romlen; /* Length of ROM if it's not from the BAR */
368 char *driver_override; /* Driver name to force a match */
368}; 369};
369 370
370static inline struct pci_dev *pci_physfn(struct pci_dev *dev) 371static inline struct pci_dev *pci_physfn(struct pci_dev *dev)
@@ -477,6 +478,19 @@ static inline bool pci_is_root_bus(struct pci_bus *pbus)
477 return !(pbus->parent); 478 return !(pbus->parent);
478} 479}
479 480
481/**
482 * pci_is_bridge - check if the PCI device is a bridge
483 * @dev: PCI device
484 *
485 * Return true if the PCI device is bridge whether it has subordinate
486 * or not.
487 */
488static inline bool pci_is_bridge(struct pci_dev *dev)
489{
490 return dev->hdr_type == PCI_HEADER_TYPE_BRIDGE ||
491 dev->hdr_type == PCI_HEADER_TYPE_CARDBUS;
492}
493
480static inline struct pci_dev *pci_upstream_bridge(struct pci_dev *dev) 494static inline struct pci_dev *pci_upstream_bridge(struct pci_dev *dev)
481{ 495{
482 dev = pci_physfn(dev); 496 dev = pci_physfn(dev);
@@ -518,7 +532,7 @@ static inline int pcibios_err_to_errno(int err)
518 case PCIBIOS_FUNC_NOT_SUPPORTED: 532 case PCIBIOS_FUNC_NOT_SUPPORTED:
519 return -ENOENT; 533 return -ENOENT;
520 case PCIBIOS_BAD_VENDOR_ID: 534 case PCIBIOS_BAD_VENDOR_ID:
521 return -EINVAL; 535 return -ENOTTY;
522 case PCIBIOS_DEVICE_NOT_FOUND: 536 case PCIBIOS_DEVICE_NOT_FOUND:
523 return -ENODEV; 537 return -ENODEV;
524 case PCIBIOS_BAD_REGISTER_NUMBER: 538 case PCIBIOS_BAD_REGISTER_NUMBER:
@@ -529,7 +543,7 @@ static inline int pcibios_err_to_errno(int err)
529 return -ENOSPC; 543 return -ENOSPC;
530 } 544 }
531 545
532 return -ENOTTY; 546 return -ERANGE;
533} 547}
534 548
535/* Low-level architecture-dependent routines */ 549/* Low-level architecture-dependent routines */
@@ -603,6 +617,9 @@ struct pci_error_handlers {
603 /* PCI slot has been reset */ 617 /* PCI slot has been reset */
604 pci_ers_result_t (*slot_reset)(struct pci_dev *dev); 618 pci_ers_result_t (*slot_reset)(struct pci_dev *dev);
605 619
620 /* PCI function reset prepare or completed */
621 void (*reset_notify)(struct pci_dev *dev, bool prepare);
622
606 /* Device driver may resume normal operations */ 623 /* Device driver may resume normal operations */
607 void (*resume)(struct pci_dev *dev); 624 void (*resume)(struct pci_dev *dev);
608}; 625};
@@ -680,8 +697,8 @@ struct pci_driver {
680 697
681/** 698/**
682 * PCI_VDEVICE - macro used to describe a specific pci device in short form 699 * PCI_VDEVICE - macro used to describe a specific pci device in short form
683 * @vendor: the vendor name 700 * @vend: the vendor name
684 * @device: the 16 bit PCI Device ID 701 * @dev: the 16 bit PCI Device ID
685 * 702 *
686 * This macro is used to create a struct pci_device_id that matches a 703 * This macro is used to create a struct pci_device_id that matches a
687 * specific PCI device. The subvendor, and subdevice fields will be set 704 * specific PCI device. The subvendor, and subdevice fields will be set
@@ -689,9 +706,9 @@ struct pci_driver {
689 * private data. 706 * private data.
690 */ 707 */
691 708
692#define PCI_VDEVICE(vendor, device) \ 709#define PCI_VDEVICE(vend, dev) \
693 PCI_VENDOR_ID_##vendor, (device), \ 710 .vendor = PCI_VENDOR_ID_##vend, .device = (dev), \
694 PCI_ANY_ID, PCI_ANY_ID, 0, 0 711 .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID, 0, 0
695 712
696/* these external functions are only available when PCI support is enabled */ 713/* these external functions are only available when PCI support is enabled */
697#ifdef CONFIG_PCI 714#ifdef CONFIG_PCI
@@ -764,7 +781,7 @@ int pci_scan_slot(struct pci_bus *bus, int devfn);
764struct pci_dev *pci_scan_single_device(struct pci_bus *bus, int devfn); 781struct pci_dev *pci_scan_single_device(struct pci_bus *bus, int devfn);
765void pci_device_add(struct pci_dev *dev, struct pci_bus *bus); 782void pci_device_add(struct pci_dev *dev, struct pci_bus *bus);
766unsigned int pci_scan_child_bus(struct pci_bus *bus); 783unsigned int pci_scan_child_bus(struct pci_bus *bus);
767int __must_check pci_bus_add_device(struct pci_dev *dev); 784void pci_bus_add_device(struct pci_dev *dev);
768void pci_read_bridge_bases(struct pci_bus *child); 785void pci_read_bridge_bases(struct pci_bus *child);
769struct resource *pci_find_parent_resource(const struct pci_dev *dev, 786struct resource *pci_find_parent_resource(const struct pci_dev *dev,
770 struct resource *res); 787 struct resource *res);
@@ -1158,7 +1175,6 @@ struct msix_entry {
1158 1175
1159#ifdef CONFIG_PCI_MSI 1176#ifdef CONFIG_PCI_MSI
1160int pci_msi_vec_count(struct pci_dev *dev); 1177int pci_msi_vec_count(struct pci_dev *dev);
1161int pci_enable_msi_block(struct pci_dev *dev, int nvec);
1162void pci_msi_shutdown(struct pci_dev *dev); 1178void pci_msi_shutdown(struct pci_dev *dev);
1163void pci_disable_msi(struct pci_dev *dev); 1179void pci_disable_msi(struct pci_dev *dev);
1164int pci_msix_vec_count(struct pci_dev *dev); 1180int pci_msix_vec_count(struct pci_dev *dev);
@@ -1188,8 +1204,6 @@ static inline int pci_enable_msix_exact(struct pci_dev *dev,
1188} 1204}
1189#else 1205#else
1190static inline int pci_msi_vec_count(struct pci_dev *dev) { return -ENOSYS; } 1206static inline int pci_msi_vec_count(struct pci_dev *dev) { return -ENOSYS; }
1191static inline int pci_enable_msi_block(struct pci_dev *dev, int nvec)
1192{ return -ENOSYS; }
1193static inline void pci_msi_shutdown(struct pci_dev *dev) { } 1207static inline void pci_msi_shutdown(struct pci_dev *dev) { }
1194static inline void pci_disable_msi(struct pci_dev *dev) { } 1208static inline void pci_disable_msi(struct pci_dev *dev) { }
1195static inline int pci_msix_vec_count(struct pci_dev *dev) { return -ENOSYS; } 1209static inline int pci_msix_vec_count(struct pci_dev *dev) { return -ENOSYS; }
@@ -1244,7 +1258,7 @@ static inline void pcie_set_ecrc_checking(struct pci_dev *dev) { }
1244static inline void pcie_ecrc_get_policy(char *str) { } 1258static inline void pcie_ecrc_get_policy(char *str) { }
1245#endif 1259#endif
1246 1260
1247#define pci_enable_msi(pdev) pci_enable_msi_block(pdev, 1) 1261#define pci_enable_msi(pdev) pci_enable_msi_exact(pdev, 1)
1248 1262
1249#ifdef CONFIG_HT_IRQ 1263#ifdef CONFIG_HT_IRQ
1250/* The functions a driver should call */ 1264/* The functions a driver should call */
@@ -1572,13 +1586,13 @@ extern unsigned long pci_hotplug_io_size;
1572extern unsigned long pci_hotplug_mem_size; 1586extern unsigned long pci_hotplug_mem_size;
1573 1587
1574/* Architecture-specific versions may override these (weak) */ 1588/* Architecture-specific versions may override these (weak) */
1575int pcibios_add_platform_entries(struct pci_dev *dev);
1576void pcibios_disable_device(struct pci_dev *dev); 1589void pcibios_disable_device(struct pci_dev *dev);
1577void pcibios_set_master(struct pci_dev *dev); 1590void pcibios_set_master(struct pci_dev *dev);
1578int pcibios_set_pcie_reset_state(struct pci_dev *dev, 1591int pcibios_set_pcie_reset_state(struct pci_dev *dev,
1579 enum pcie_reset_state state); 1592 enum pcie_reset_state state);
1580int pcibios_add_device(struct pci_dev *dev); 1593int pcibios_add_device(struct pci_dev *dev);
1581void pcibios_release_device(struct pci_dev *dev); 1594void pcibios_release_device(struct pci_dev *dev);
1595void pcibios_penalize_isa_irq(int irq, int active);
1582 1596
1583#ifdef CONFIG_HIBERNATE_CALLBACKS 1597#ifdef CONFIG_HIBERNATE_CALLBACKS
1584extern struct dev_pm_ops pcibios_pm_ops; 1598extern struct dev_pm_ops pcibios_pm_ops;
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index d4de24b4d4c6..7fa31731c854 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -1631,8 +1631,6 @@
1631#define PCI_DEVICE_ID_ATT_VENUS_MODEM 0x480 1631#define PCI_DEVICE_ID_ATT_VENUS_MODEM 0x480
1632 1632
1633#define PCI_VENDOR_ID_SPECIALIX 0x11cb 1633#define PCI_VENDOR_ID_SPECIALIX 0x11cb
1634#define PCI_DEVICE_ID_SPECIALIX_IO8 0x2000
1635#define PCI_DEVICE_ID_SPECIALIX_RIO 0x8000
1636#define PCI_SUBDEVICE_ID_SPECIALIX_SPEED4 0xa004 1634#define PCI_SUBDEVICE_ID_SPECIALIX_SPEED4 0xa004
1637 1635
1638#define PCI_VENDOR_ID_ANALOG_DEVICES 0x11d4 1636#define PCI_VENDOR_ID_ANALOG_DEVICES 0x11d4
@@ -2874,7 +2872,6 @@
2874#define PCI_DEVICE_ID_SCALEMP_VSMP_CTL 0x1010 2872#define PCI_DEVICE_ID_SCALEMP_VSMP_CTL 0x1010
2875 2873
2876#define PCI_VENDOR_ID_COMPUTONE 0x8e0e 2874#define PCI_VENDOR_ID_COMPUTONE 0x8e0e
2877#define PCI_DEVICE_ID_COMPUTONE_IP2EX 0x0291
2878#define PCI_DEVICE_ID_COMPUTONE_PG 0x0302 2875#define PCI_DEVICE_ID_COMPUTONE_PG 0x0302
2879#define PCI_SUBVENDOR_ID_COMPUTONE 0x8e0e 2876#define PCI_SUBVENDOR_ID_COMPUTONE 0x8e0e
2880#define PCI_SUBDEVICE_ID_COMPUTONE_PG4 0x0001 2877#define PCI_SUBDEVICE_ID_COMPUTONE_PG4 0x0001
diff --git a/include/linux/percpu.h b/include/linux/percpu.h
index e7a0b95ed527..495c6543a8f2 100644
--- a/include/linux/percpu.h
+++ b/include/linux/percpu.h
@@ -639,7 +639,7 @@ do { \
639# define raw_cpu_add_return_8(pcp, val) raw_cpu_generic_add_return(pcp, val) 639# define raw_cpu_add_return_8(pcp, val) raw_cpu_generic_add_return(pcp, val)
640# endif 640# endif
641# define raw_cpu_add_return(pcp, val) \ 641# define raw_cpu_add_return(pcp, val) \
642 __pcpu_size_call_return2(raw_add_return_, pcp, val) 642 __pcpu_size_call_return2(raw_cpu_add_return_, pcp, val)
643#endif 643#endif
644 644
645#define raw_cpu_sub_return(pcp, val) raw_cpu_add_return(pcp, -(typeof(pcp))(val)) 645#define raw_cpu_sub_return(pcp, val) raw_cpu_add_return(pcp, -(typeof(pcp))(val))
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 3ef6ea12806a..a9209118d80f 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -172,6 +172,7 @@ struct perf_event;
172struct pmu { 172struct pmu {
173 struct list_head entry; 173 struct list_head entry;
174 174
175 struct module *module;
175 struct device *dev; 176 struct device *dev;
176 const struct attribute_group **attr_groups; 177 const struct attribute_group **attr_groups;
177 const char *name; 178 const char *name;
diff --git a/include/linux/platform_data/adau17x1.h b/include/linux/platform_data/adau17x1.h
new file mode 100644
index 000000000000..a81766cae230
--- /dev/null
+++ b/include/linux/platform_data/adau17x1.h
@@ -0,0 +1,109 @@
1/*
2 * Driver for ADAU1761/ADAU1461/ADAU1761/ADAU1961/ADAU1781/ADAU1781 codecs
3 *
4 * Copyright 2011-2014 Analog Devices Inc.
5 * Author: Lars-Peter Clausen <lars@metafoo.de>
6 *
7 * Licensed under the GPL-2 or later.
8 */
9
10#ifndef __LINUX_PLATFORM_DATA_ADAU17X1_H__
11#define __LINUX_PLATFORM_DATA_ADAU17X1_H__
12
13/**
14 * enum adau17x1_micbias_voltage - Microphone bias voltage
15 * @ADAU17X1_MICBIAS_0_90_AVDD: 0.9 * AVDD
16 * @ADAU17X1_MICBIAS_0_65_AVDD: 0.65 * AVDD
17 */
18enum adau17x1_micbias_voltage {
19 ADAU17X1_MICBIAS_0_90_AVDD = 0,
20 ADAU17X1_MICBIAS_0_65_AVDD = 1,
21};
22
23/**
24 * enum adau1761_digmic_jackdet_pin_mode - Configuration of the JACKDET/MICIN pin
25 * @ADAU1761_DIGMIC_JACKDET_PIN_MODE_NONE: Disable the pin
26 * @ADAU1761_DIGMIC_JACKDET_PIN_MODE_DIGMIC: Configure the pin for usage as
27 * digital microphone input.
28 * @ADAU1761_DIGMIC_JACKDET_PIN_MODE_JACKDETECT: Configure the pin for jack
29 * insertion detection.
30 */
31enum adau1761_digmic_jackdet_pin_mode {
32 ADAU1761_DIGMIC_JACKDET_PIN_MODE_NONE,
33 ADAU1761_DIGMIC_JACKDET_PIN_MODE_DIGMIC,
34 ADAU1761_DIGMIC_JACKDET_PIN_MODE_JACKDETECT,
35};
36
37/**
38 * adau1761_jackdetect_debounce_time - Jack insertion detection debounce time
39 * @ADAU1761_JACKDETECT_DEBOUNCE_5MS: 5 milliseconds
40 * @ADAU1761_JACKDETECT_DEBOUNCE_10MS: 10 milliseconds
41 * @ADAU1761_JACKDETECT_DEBOUNCE_20MS: 20 milliseconds
42 * @ADAU1761_JACKDETECT_DEBOUNCE_40MS: 40 milliseconds
43 */
44enum adau1761_jackdetect_debounce_time {
45 ADAU1761_JACKDETECT_DEBOUNCE_5MS = 0,
46 ADAU1761_JACKDETECT_DEBOUNCE_10MS = 1,
47 ADAU1761_JACKDETECT_DEBOUNCE_20MS = 2,
48 ADAU1761_JACKDETECT_DEBOUNCE_40MS = 3,
49};
50
51/**
52 * enum adau1761_output_mode - Output mode configuration
53 * @ADAU1761_OUTPUT_MODE_HEADPHONE: Headphone output
54 * @ADAU1761_OUTPUT_MODE_HEADPHONE_CAPLESS: Capless headphone output
55 * @ADAU1761_OUTPUT_MODE_LINE: Line output
56 */
57enum adau1761_output_mode {
58 ADAU1761_OUTPUT_MODE_HEADPHONE,
59 ADAU1761_OUTPUT_MODE_HEADPHONE_CAPLESS,
60 ADAU1761_OUTPUT_MODE_LINE,
61};
62
63/**
64 * struct adau1761_platform_data - ADAU1761 Codec driver platform data
65 * @input_differential: If true the input pins will be configured in
66 * differential mode.
67 * @lineout_mode: Output mode for the LOUT/ROUT pins
68 * @headphone_mode: Output mode for the LHP/RHP pins
69 * @digmic_jackdetect_pin_mode: JACKDET/MICIN pin configuration
70 * @jackdetect_debounce_time: Jack insertion detection debounce time.
71 * Note: This value will only be used, if the JACKDET/MICIN pin is configured
72 * for jack insertion detection.
73 * @jackdetect_active_low: If true the jack insertion detection is active low.
74 * Othwise it will be active high.
75 * @micbias_voltage: Microphone voltage bias
76 */
77struct adau1761_platform_data {
78 bool input_differential;
79 enum adau1761_output_mode lineout_mode;
80 enum adau1761_output_mode headphone_mode;
81
82 enum adau1761_digmic_jackdet_pin_mode digmic_jackdetect_pin_mode;
83
84 enum adau1761_jackdetect_debounce_time jackdetect_debounce_time;
85 bool jackdetect_active_low;
86
87 enum adau17x1_micbias_voltage micbias_voltage;
88};
89
90/**
91 * struct adau1781_platform_data - ADAU1781 Codec driver platform data
92 * @left_input_differential: If true configure the left input as
93 * differential input.
94 * @right_input_differential: If true configure the right input as differntial
95 * input.
96 * @use_dmic: If true configure the MIC pins as digital microphone pins instead
97 * of analog microphone pins.
98 * @micbias_voltage: Microphone voltage bias
99 */
100struct adau1781_platform_data {
101 bool left_input_differential;
102 bool right_input_differential;
103
104 bool use_dmic;
105
106 enum adau17x1_micbias_voltage micbias_voltage;
107};
108
109#endif
diff --git a/include/linux/platform_data/at91_adc.h b/include/linux/platform_data/at91_adc.h
index b3ca1e94e0c8..7819fc787731 100644
--- a/include/linux/platform_data/at91_adc.h
+++ b/include/linux/platform_data/at91_adc.h
@@ -7,23 +7,10 @@
7#ifndef _AT91_ADC_H_ 7#ifndef _AT91_ADC_H_
8#define _AT91_ADC_H_ 8#define _AT91_ADC_H_
9 9
10/** 10enum atmel_adc_ts_type {
11 * struct at91_adc_reg_desc - Various informations relative to registers 11 ATMEL_ADC_TOUCHSCREEN_NONE = 0,
12 * @channel_base: Base offset for the channel data registers 12 ATMEL_ADC_TOUCHSCREEN_4WIRE = 4,
13 * @drdy_mask: Mask of the DRDY field in the relevant registers 13 ATMEL_ADC_TOUCHSCREEN_5WIRE = 5,
14 (Interruptions registers mostly)
15 * @status_register: Offset of the Interrupt Status Register
16 * @trigger_register: Offset of the Trigger setup register
17 * @mr_prescal_mask: Mask of the PRESCAL field in the adc MR register
18 * @mr_startup_mask: Mask of the STARTUP field in the adc MR register
19 */
20struct at91_adc_reg_desc {
21 u8 channel_base;
22 u32 drdy_mask;
23 u8 status_register;
24 u8 trigger_register;
25 u32 mr_prescal_mask;
26 u32 mr_startup_mask;
27}; 14};
28 15
29/** 16/**
@@ -42,23 +29,21 @@ struct at91_adc_trigger {
42/** 29/**
43 * struct at91_adc_data - platform data for ADC driver 30 * struct at91_adc_data - platform data for ADC driver
44 * @channels_used: channels in use on the board as a bitmask 31 * @channels_used: channels in use on the board as a bitmask
45 * @num_channels: global number of channels available on the board
46 * @registers: Registers definition on the board
47 * @startup_time: startup time of the ADC in microseconds 32 * @startup_time: startup time of the ADC in microseconds
48 * @trigger_list: Triggers available in the ADC 33 * @trigger_list: Triggers available in the ADC
49 * @trigger_number: Number of triggers available in the ADC 34 * @trigger_number: Number of triggers available in the ADC
50 * @use_external_triggers: does the board has external triggers availables 35 * @use_external_triggers: does the board has external triggers availables
51 * @vref: Reference voltage for the ADC in millivolts 36 * @vref: Reference voltage for the ADC in millivolts
37 * @touchscreen_type: If a touchscreen is connected, its type (4 or 5 wires)
52 */ 38 */
53struct at91_adc_data { 39struct at91_adc_data {
54 unsigned long channels_used; 40 unsigned long channels_used;
55 u8 num_channels;
56 struct at91_adc_reg_desc *registers;
57 u8 startup_time; 41 u8 startup_time;
58 struct at91_adc_trigger *trigger_list; 42 struct at91_adc_trigger *trigger_list;
59 u8 trigger_number; 43 u8 trigger_number;
60 bool use_external_triggers; 44 bool use_external_triggers;
61 u16 vref; 45 u16 vref;
46 enum atmel_adc_ts_type touchscreen_type;
62}; 47};
63 48
64extern void __init at91_add_device_adc(struct at91_adc_data *data); 49extern void __init at91_add_device_adc(struct at91_adc_data *data);
diff --git a/include/linux/platform_data/atmel.h b/include/linux/platform_data/atmel.h
index e26b0c14edea..4b452c6a2f7b 100644
--- a/include/linux/platform_data/atmel.h
+++ b/include/linux/platform_data/atmel.h
@@ -84,14 +84,6 @@ struct atmel_uart_data {
84 short use_dma_rx; /* use receive DMA? */ 84 short use_dma_rx; /* use receive DMA? */
85 void __iomem *regs; /* virt. base address, if any */ 85 void __iomem *regs; /* virt. base address, if any */
86 struct serial_rs485 rs485; /* rs485 settings */ 86 struct serial_rs485 rs485; /* rs485 settings */
87 int rts_gpio; /* optional RTS GPIO */
88};
89
90 /* Touchscreen Controller */
91struct at91_tsadcc_data {
92 unsigned int adc_clock;
93 u8 pendet_debounce;
94 u8 ts_sample_hold_time;
95}; 87};
96 88
97/* CAN */ 89/* CAN */
diff --git a/include/linux/platform_data/edma.h b/include/linux/platform_data/edma.h
index f50821cb64be..eb8d5627d080 100644
--- a/include/linux/platform_data/edma.h
+++ b/include/linux/platform_data/edma.h
@@ -43,15 +43,15 @@
43 43
44/* PaRAM slots are laid out like this */ 44/* PaRAM slots are laid out like this */
45struct edmacc_param { 45struct edmacc_param {
46 unsigned int opt; 46 u32 opt;
47 unsigned int src; 47 u32 src;
48 unsigned int a_b_cnt; 48 u32 a_b_cnt;
49 unsigned int dst; 49 u32 dst;
50 unsigned int src_dst_bidx; 50 u32 src_dst_bidx;
51 unsigned int link_bcntrld; 51 u32 link_bcntrld;
52 unsigned int src_dst_cidx; 52 u32 src_dst_cidx;
53 unsigned int ccnt; 53 u32 ccnt;
54}; 54} __packed;
55 55
56/* fields in edmacc_param.opt */ 56/* fields in edmacc_param.opt */
57#define SAM BIT(0) 57#define SAM BIT(0)
@@ -130,7 +130,7 @@ void edma_set_src(unsigned slot, dma_addr_t src_port,
130 enum address_mode mode, enum fifo_width); 130 enum address_mode mode, enum fifo_width);
131void edma_set_dest(unsigned slot, dma_addr_t dest_port, 131void edma_set_dest(unsigned slot, dma_addr_t dest_port,
132 enum address_mode mode, enum fifo_width); 132 enum address_mode mode, enum fifo_width);
133void edma_get_position(unsigned slot, dma_addr_t *src, dma_addr_t *dst); 133dma_addr_t edma_get_position(unsigned slot, bool dst);
134void edma_set_src_index(unsigned slot, s16 src_bidx, s16 src_cidx); 134void edma_set_src_index(unsigned slot, s16 src_bidx, s16 src_cidx);
135void edma_set_dest_index(unsigned slot, s16 dest_bidx, s16 dest_cidx); 135void edma_set_dest_index(unsigned slot, s16 dest_bidx, s16 dest_cidx);
136void edma_set_transfer_params(unsigned slot, u16 acnt, u16 bcnt, u16 ccnt, 136void edma_set_transfer_params(unsigned slot, u16 acnt, u16 bcnt, u16 ccnt,
@@ -158,13 +158,6 @@ struct edma_rsv_info {
158 158
159/* platform_data for EDMA driver */ 159/* platform_data for EDMA driver */
160struct edma_soc_info { 160struct edma_soc_info {
161
162 /* how many dma resources of each type */
163 unsigned n_channel;
164 unsigned n_region;
165 unsigned n_slot;
166 unsigned n_tc;
167 unsigned n_cc;
168 /* 161 /*
169 * Default queue is expected to be a low-priority queue. 162 * Default queue is expected to be a low-priority queue.
170 * This way, long transfers on the default queue started 163 * This way, long transfers on the default queue started
@@ -175,7 +168,6 @@ struct edma_soc_info {
175 /* Resource reservation for other cores */ 168 /* Resource reservation for other cores */
176 struct edma_rsv_info *rsv; 169 struct edma_rsv_info *rsv;
177 170
178 s8 (*queue_tc_mapping)[2];
179 s8 (*queue_priority_mapping)[2]; 171 s8 (*queue_priority_mapping)[2];
180 const s16 (*xbar_chans)[2]; 172 const s16 (*xbar_chans)[2];
181}; 173};
diff --git a/include/linux/platform_data/ipmmu-vmsa.h b/include/linux/platform_data/ipmmu-vmsa.h
new file mode 100644
index 000000000000..5275b3ac6d37
--- /dev/null
+++ b/include/linux/platform_data/ipmmu-vmsa.h
@@ -0,0 +1,24 @@
1/*
2 * IPMMU VMSA Platform Data
3 *
4 * Copyright (C) 2014 Renesas Electronics Corporation
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 */
10
11#ifndef __IPMMU_VMSA_H__
12#define __IPMMU_VMSA_H__
13
14struct ipmmu_vmsa_master {
15 const char *name;
16 unsigned int utlb;
17};
18
19struct ipmmu_vmsa_platform_data {
20 const struct ipmmu_vmsa_master *masters;
21 unsigned int num_masters;
22};
23
24#endif /* __IPMMU_VMSA_H__ */
diff --git a/include/linux/platform_data/max3421-hcd.h b/include/linux/platform_data/max3421-hcd.h
new file mode 100644
index 000000000000..0303d1970084
--- /dev/null
+++ b/include/linux/platform_data/max3421-hcd.h
@@ -0,0 +1,24 @@
1/*
2 * Copyright (c) 2014 eGauge Systems LLC
3 * Contributed by David Mosberger-Tang <davidm@egauge.net>
4 *
5 * Platform-data structure for MAX3421 USB HCD driver.
6 *
7 */
8#ifndef MAX3421_HCD_PLAT_H_INCLUDED
9#define MAX3421_HCD_PLAT_H_INCLUDED
10
11/*
12 * This structure defines the mapping of certain auxiliary functions to the
13 * MAX3421E GPIO pins. The chip has eight GP inputs and eight GP outputs.
14 * A value of 0 indicates that the pin is not used/wired to anything.
15 *
16 * At this point, the only control the max3421-hcd driver cares about is
17 * to control Vbus (5V to the peripheral).
18 */
19struct max3421_hcd_platform_data {
20 u8 vbus_gpout; /* pin controlling Vbus */
21 u8 vbus_active_level; /* level that turns on power */
22};
23
24#endif /* MAX3421_HCD_PLAT_H_INCLUDED */
diff --git a/include/linux/platform_data/mipi-csis.h b/include/linux/platform_data/mipi-csis.h
deleted file mode 100644
index c2fd9024717c..000000000000
--- a/include/linux/platform_data/mipi-csis.h
+++ /dev/null
@@ -1,28 +0,0 @@
1/*
2 * Copyright (C) 2010 - 2012 Samsung Electronics Co., Ltd.
3 *
4 * Samsung S5P/Exynos SoC series MIPI CSIS device support
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifndef __PLAT_SAMSUNG_MIPI_CSIS_H_
12#define __PLAT_SAMSUNG_MIPI_CSIS_H_ __FILE__
13
14/**
15 * struct s5p_platform_mipi_csis - platform data for S5P MIPI-CSIS driver
16 * @clk_rate: bus clock frequency
17 * @wclk_source: CSI wrapper clock selection: 0 - bus clock, 1 - ext. SCLK_CAM
18 * @lanes: number of data lanes used
19 * @hs_settle: HS-RX settle time
20 */
21struct s5p_platform_mipi_csis {
22 unsigned long clk_rate;
23 u8 wclk_source;
24 u8 lanes;
25 u8 hs_settle;
26};
27
28#endif /* __PLAT_SAMSUNG_MIPI_CSIS_H_ */
diff --git a/include/linux/platform_data/syscon.h b/include/linux/platform_data/syscon.h
new file mode 100644
index 000000000000..2354c6fa3726
--- /dev/null
+++ b/include/linux/platform_data/syscon.h
@@ -0,0 +1,8 @@
1#ifndef PLATFORM_DATA_SYSCON_H
2#define PLATFORM_DATA_SYSCON_H
3
4struct syscon_platform_data {
5 const char *label;
6};
7
8#endif
diff --git a/include/linux/plist.h b/include/linux/plist.h
index aa0fb390bd29..8b6c970cff6c 100644
--- a/include/linux/plist.h
+++ b/include/linux/plist.h
@@ -98,6 +98,13 @@ struct plist_node {
98} 98}
99 99
100/** 100/**
101 * PLIST_HEAD - declare and init plist_head
102 * @head: name for struct plist_head variable
103 */
104#define PLIST_HEAD(head) \
105 struct plist_head head = PLIST_HEAD_INIT(head)
106
107/**
101 * PLIST_NODE_INIT - static struct plist_node initializer 108 * PLIST_NODE_INIT - static struct plist_node initializer
102 * @node: struct plist_node variable name 109 * @node: struct plist_node variable name
103 * @__prio: initial node priority 110 * @__prio: initial node priority
@@ -134,6 +141,8 @@ static inline void plist_node_init(struct plist_node *node, int prio)
134extern void plist_add(struct plist_node *node, struct plist_head *head); 141extern void plist_add(struct plist_node *node, struct plist_head *head);
135extern void plist_del(struct plist_node *node, struct plist_head *head); 142extern void plist_del(struct plist_node *node, struct plist_head *head);
136 143
144extern void plist_requeue(struct plist_node *node, struct plist_head *head);
145
137/** 146/**
138 * plist_for_each - iterate over the plist 147 * plist_for_each - iterate over the plist
139 * @pos: the type * to use as a loop counter 148 * @pos: the type * to use as a loop counter
@@ -143,6 +152,16 @@ extern void plist_del(struct plist_node *node, struct plist_head *head);
143 list_for_each_entry(pos, &(head)->node_list, node_list) 152 list_for_each_entry(pos, &(head)->node_list, node_list)
144 153
145/** 154/**
155 * plist_for_each_continue - continue iteration over the plist
156 * @pos: the type * to use as a loop cursor
157 * @head: the head for your list
158 *
159 * Continue to iterate over plist, continuing after the current position.
160 */
161#define plist_for_each_continue(pos, head) \
162 list_for_each_entry_continue(pos, &(head)->node_list, node_list)
163
164/**
146 * plist_for_each_safe - iterate safely over a plist of given type 165 * plist_for_each_safe - iterate safely over a plist of given type
147 * @pos: the type * to use as a loop counter 166 * @pos: the type * to use as a loop counter
148 * @n: another type * to use as temporary storage 167 * @n: another type * to use as temporary storage
@@ -163,6 +182,18 @@ extern void plist_del(struct plist_node *node, struct plist_head *head);
163 list_for_each_entry(pos, &(head)->node_list, mem.node_list) 182 list_for_each_entry(pos, &(head)->node_list, mem.node_list)
164 183
165/** 184/**
185 * plist_for_each_entry_continue - continue iteration over list of given type
186 * @pos: the type * to use as a loop cursor
187 * @head: the head for your list
188 * @m: the name of the list_struct within the struct
189 *
190 * Continue to iterate over list of given type, continuing after
191 * the current position.
192 */
193#define plist_for_each_entry_continue(pos, head, m) \
194 list_for_each_entry_continue(pos, &(head)->node_list, m.node_list)
195
196/**
166 * plist_for_each_entry_safe - iterate safely over list of given type 197 * plist_for_each_entry_safe - iterate safely over list of given type
167 * @pos: the type * to use as a loop counter 198 * @pos: the type * to use as a loop counter
168 * @n: another type * to use as temporary storage 199 * @n: another type * to use as temporary storage
@@ -229,6 +260,20 @@ static inline int plist_node_empty(const struct plist_node *node)
229#endif 260#endif
230 261
231/** 262/**
263 * plist_next - get the next entry in list
264 * @pos: the type * to cursor
265 */
266#define plist_next(pos) \
267 list_next_entry(pos, node_list)
268
269/**
270 * plist_prev - get the prev entry in list
271 * @pos: the type * to cursor
272 */
273#define plist_prev(pos) \
274 list_prev_entry(pos, node_list)
275
276/**
232 * plist_first - return the first node (and thus, highest priority) 277 * plist_first - return the first node (and thus, highest priority)
233 * @head: the &struct plist_head pointer 278 * @head: the &struct plist_head pointer
234 * 279 *
diff --git a/include/linux/pm.h b/include/linux/pm.h
index d915d0345fa1..72c0fe098a27 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -93,13 +93,23 @@ typedef struct pm_message {
93 * been registered) to recover from the race condition. 93 * been registered) to recover from the race condition.
94 * This method is executed for all kinds of suspend transitions and is 94 * This method is executed for all kinds of suspend transitions and is
95 * followed by one of the suspend callbacks: @suspend(), @freeze(), or 95 * followed by one of the suspend callbacks: @suspend(), @freeze(), or
96 * @poweroff(). The PM core executes subsystem-level @prepare() for all 96 * @poweroff(). If the transition is a suspend to memory or standby (that
97 * devices before starting to invoke suspend callbacks for any of them, so 97 * is, not related to hibernation), the return value of @prepare() may be
98 * generally devices may be assumed to be functional or to respond to 98 * used to indicate to the PM core to leave the device in runtime suspend
99 * runtime resume requests while @prepare() is being executed. However, 99 * if applicable. Namely, if @prepare() returns a positive number, the PM
100 * device drivers may NOT assume anything about the availability of user 100 * core will understand that as a declaration that the device appears to be
101 * space at that time and it is NOT valid to request firmware from within 101 * runtime-suspended and it may be left in that state during the entire
102 * @prepare() (it's too late to do that). It also is NOT valid to allocate 102 * transition and during the subsequent resume if all of its descendants
103 * are left in runtime suspend too. If that happens, @complete() will be
104 * executed directly after @prepare() and it must ensure the proper
105 * functioning of the device after the system resume.
106 * The PM core executes subsystem-level @prepare() for all devices before
107 * starting to invoke suspend callbacks for any of them, so generally
108 * devices may be assumed to be functional or to respond to runtime resume
109 * requests while @prepare() is being executed. However, device drivers
110 * may NOT assume anything about the availability of user space at that
111 * time and it is NOT valid to request firmware from within @prepare()
112 * (it's too late to do that). It also is NOT valid to allocate
103 * substantial amounts of memory from @prepare() in the GFP_KERNEL mode. 113 * substantial amounts of memory from @prepare() in the GFP_KERNEL mode.
104 * [To work around these limitations, drivers may register suspend and 114 * [To work around these limitations, drivers may register suspend and
105 * hibernation notifiers to be executed before the freezing of tasks.] 115 * hibernation notifiers to be executed before the freezing of tasks.]
@@ -112,7 +122,16 @@ typedef struct pm_message {
112 * of the other devices that the PM core has unsuccessfully attempted to 122 * of the other devices that the PM core has unsuccessfully attempted to
113 * suspend earlier). 123 * suspend earlier).
114 * The PM core executes subsystem-level @complete() after it has executed 124 * The PM core executes subsystem-level @complete() after it has executed
115 * the appropriate resume callbacks for all devices. 125 * the appropriate resume callbacks for all devices. If the corresponding
126 * @prepare() at the beginning of the suspend transition returned a
127 * positive number and the device was left in runtime suspend (without
128 * executing any suspend and resume callbacks for it), @complete() will be
129 * the only callback executed for the device during resume. In that case,
130 * @complete() must be prepared to do whatever is necessary to ensure the
131 * proper functioning of the device after the system resume. To this end,
132 * @complete() can check the power.direct_complete flag of the device to
133 * learn whether (unset) or not (set) the previous suspend and resume
134 * callbacks have been executed for it.
116 * 135 *
117 * @suspend: Executed before putting the system into a sleep state in which the 136 * @suspend: Executed before putting the system into a sleep state in which the
118 * contents of main memory are preserved. The exact action to perform 137 * contents of main memory are preserved. The exact action to perform
@@ -546,6 +565,7 @@ struct dev_pm_info {
546 bool is_late_suspended:1; 565 bool is_late_suspended:1;
547 bool ignore_children:1; 566 bool ignore_children:1;
548 bool early_init:1; /* Owned by the PM core */ 567 bool early_init:1; /* Owned by the PM core */
568 bool direct_complete:1; /* Owned by the PM core */
549 spinlock_t lock; 569 spinlock_t lock;
550#ifdef CONFIG_PM_SLEEP 570#ifdef CONFIG_PM_SLEEP
551 struct list_head entry; 571 struct list_head entry;
diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h
index 5151b0059585..0330217abfad 100644
--- a/include/linux/pm_opp.h
+++ b/include/linux/pm_opp.h
@@ -15,7 +15,6 @@
15#define __LINUX_OPP_H__ 15#define __LINUX_OPP_H__
16 16
17#include <linux/err.h> 17#include <linux/err.h>
18#include <linux/cpufreq.h>
19#include <linux/notifier.h> 18#include <linux/notifier.h>
20 19
21struct dev_pm_opp; 20struct dev_pm_opp;
@@ -117,23 +116,4 @@ static inline int of_init_opp_table(struct device *dev)
117} 116}
118#endif 117#endif
119 118
120#if defined(CONFIG_CPU_FREQ) && defined(CONFIG_PM_OPP)
121int dev_pm_opp_init_cpufreq_table(struct device *dev,
122 struct cpufreq_frequency_table **table);
123void dev_pm_opp_free_cpufreq_table(struct device *dev,
124 struct cpufreq_frequency_table **table);
125#else
126static inline int dev_pm_opp_init_cpufreq_table(struct device *dev,
127 struct cpufreq_frequency_table **table)
128{
129 return -EINVAL;
130}
131
132static inline
133void dev_pm_opp_free_cpufreq_table(struct device *dev,
134 struct cpufreq_frequency_table **table)
135{
136}
137#endif /* CONFIG_CPU_FREQ */
138
139#endif /* __LINUX_OPP_H__ */ 119#endif /* __LINUX_OPP_H__ */
diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h
index 2a5897a4afbc..43fd6716f662 100644
--- a/include/linux/pm_runtime.h
+++ b/include/linux/pm_runtime.h
@@ -101,6 +101,11 @@ static inline bool pm_runtime_status_suspended(struct device *dev)
101 return dev->power.runtime_status == RPM_SUSPENDED; 101 return dev->power.runtime_status == RPM_SUSPENDED;
102} 102}
103 103
104static inline bool pm_runtime_suspended_if_enabled(struct device *dev)
105{
106 return pm_runtime_status_suspended(dev) && dev->power.disable_depth == 1;
107}
108
104static inline bool pm_runtime_enabled(struct device *dev) 109static inline bool pm_runtime_enabled(struct device *dev)
105{ 110{
106 return !dev->power.disable_depth; 111 return !dev->power.disable_depth;
@@ -150,6 +155,7 @@ static inline void device_set_run_wake(struct device *dev, bool enable) {}
150static inline bool pm_runtime_suspended(struct device *dev) { return false; } 155static inline bool pm_runtime_suspended(struct device *dev) { return false; }
151static inline bool pm_runtime_active(struct device *dev) { return true; } 156static inline bool pm_runtime_active(struct device *dev) { return true; }
152static inline bool pm_runtime_status_suspended(struct device *dev) { return false; } 157static inline bool pm_runtime_status_suspended(struct device *dev) { return false; }
158static inline bool pm_runtime_suspended_if_enabled(struct device *dev) { return false; }
153static inline bool pm_runtime_enabled(struct device *dev) { return false; } 159static inline bool pm_runtime_enabled(struct device *dev) { return false; }
154 160
155static inline void pm_runtime_no_callbacks(struct device *dev) {} 161static inline void pm_runtime_no_callbacks(struct device *dev) {}
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index c9dc4e09854c..f2b76aeaf4e4 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -264,6 +264,8 @@ static inline int power_supply_is_system_supplied(void) { return -ENOSYS; }
264 264
265extern int power_supply_register(struct device *parent, 265extern int power_supply_register(struct device *parent,
266 struct power_supply *psy); 266 struct power_supply *psy);
267extern int power_supply_register_no_ws(struct device *parent,
268 struct power_supply *psy);
267extern void power_supply_unregister(struct power_supply *psy); 269extern void power_supply_unregister(struct power_supply *psy);
268extern int power_supply_powers(struct power_supply *psy, struct device *dev); 270extern int power_supply_powers(struct power_supply *psy, struct device *dev);
269 271
diff --git a/include/linux/printk.h b/include/linux/printk.h
index 8752f7595b27..319ff7e53efb 100644
--- a/include/linux/printk.h
+++ b/include/linux/printk.h
@@ -30,6 +30,17 @@ static inline const char *printk_skip_level(const char *buffer)
30 return buffer; 30 return buffer;
31} 31}
32 32
33/* printk's without a loglevel use this.. */
34#define DEFAULT_MESSAGE_LOGLEVEL CONFIG_DEFAULT_MESSAGE_LOGLEVEL
35
36/* We show everything that is MORE important than this.. */
37#define CONSOLE_LOGLEVEL_SILENT 0 /* Mum's the word */
38#define CONSOLE_LOGLEVEL_MIN 1 /* Minimum loglevel we let people use */
39#define CONSOLE_LOGLEVEL_QUIET 4 /* Shhh ..., when booted with "quiet" */
40#define CONSOLE_LOGLEVEL_DEFAULT 7 /* anything MORE serious than KERN_DEBUG */
41#define CONSOLE_LOGLEVEL_DEBUG 10 /* issue debug messages */
42#define CONSOLE_LOGLEVEL_MOTORMOUTH 15 /* You can't shut this one up */
43
33extern int console_printk[]; 44extern int console_printk[];
34 45
35#define console_loglevel (console_printk[0]) 46#define console_loglevel (console_printk[0])
@@ -39,13 +50,13 @@ extern int console_printk[];
39 50
40static inline void console_silent(void) 51static inline void console_silent(void)
41{ 52{
42 console_loglevel = 0; 53 console_loglevel = CONSOLE_LOGLEVEL_SILENT;
43} 54}
44 55
45static inline void console_verbose(void) 56static inline void console_verbose(void)
46{ 57{
47 if (console_loglevel) 58 if (console_loglevel)
48 console_loglevel = 15; 59 console_loglevel = CONSOLE_LOGLEVEL_MOTORMOUTH;
49} 60}
50 61
51struct va_format { 62struct va_format {
@@ -128,9 +139,9 @@ asmlinkage __printf(1, 2) __cold
128int printk(const char *fmt, ...); 139int printk(const char *fmt, ...);
129 140
130/* 141/*
131 * Special printk facility for scheduler use only, _DO_NOT_USE_ ! 142 * Special printk facility for scheduler/timekeeping use only, _DO_NOT_USE_ !
132 */ 143 */
133__printf(1, 2) __cold int printk_sched(const char *fmt, ...); 144__printf(1, 2) __cold int printk_deferred(const char *fmt, ...);
134 145
135/* 146/*
136 * Please don't use printk_ratelimit(), because it shares ratelimiting state 147 * Please don't use printk_ratelimit(), because it shares ratelimiting state
@@ -165,7 +176,7 @@ int printk(const char *s, ...)
165 return 0; 176 return 0;
166} 177}
167static inline __printf(1, 2) __cold 178static inline __printf(1, 2) __cold
168int printk_sched(const char *s, ...) 179int printk_deferred(const char *s, ...)
169{ 180{
170 return 0; 181 return 0;
171} 182}
@@ -210,6 +221,12 @@ extern asmlinkage void dump_stack(void) __cold;
210#define pr_fmt(fmt) fmt 221#define pr_fmt(fmt) fmt
211#endif 222#endif
212 223
224/*
225 * These can be used to print at the various log levels.
226 * All of these will print unconditionally, although note that pr_debug()
227 * and other debug macros are compiled out unless either DEBUG is defined
228 * or CONFIG_DYNAMIC_DEBUG is set.
229 */
213#define pr_emerg(fmt, ...) \ 230#define pr_emerg(fmt, ...) \
214 printk(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__) 231 printk(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__)
215#define pr_alert(fmt, ...) \ 232#define pr_alert(fmt, ...) \
@@ -266,9 +283,20 @@ extern asmlinkage void dump_stack(void) __cold;
266 printk(fmt, ##__VA_ARGS__); \ 283 printk(fmt, ##__VA_ARGS__); \
267 } \ 284 } \
268}) 285})
286#define printk_deferred_once(fmt, ...) \
287({ \
288 static bool __print_once __read_mostly; \
289 \
290 if (!__print_once) { \
291 __print_once = true; \
292 printk_deferred(fmt, ##__VA_ARGS__); \
293 } \
294})
269#else 295#else
270#define printk_once(fmt, ...) \ 296#define printk_once(fmt, ...) \
271 no_printk(fmt, ##__VA_ARGS__) 297 no_printk(fmt, ##__VA_ARGS__)
298#define printk_deferred_once(fmt, ...) \
299 no_printk(fmt, ##__VA_ARGS__)
272#endif 300#endif
273 301
274#define pr_emerg_once(fmt, ...) \ 302#define pr_emerg_once(fmt, ...) \
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index 608e60a74c3c..9d117f61d976 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -44,6 +44,10 @@ extern int remove_proc_subtree(const char *, struct proc_dir_entry *);
44 44
45#else /* CONFIG_PROC_FS */ 45#else /* CONFIG_PROC_FS */
46 46
47static inline void proc_root_init(void)
48{
49}
50
47static inline void proc_flush_task(struct task_struct *task) 51static inline void proc_flush_task(struct task_struct *task)
48{ 52{
49} 53}
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h
index 07d0df6bf768..077904c8b70d 100644
--- a/include/linux/ptrace.h
+++ b/include/linux/ptrace.h
@@ -5,6 +5,7 @@
5#include <linux/sched.h> /* For struct task_struct. */ 5#include <linux/sched.h> /* For struct task_struct. */
6#include <linux/err.h> /* for IS_ERR_VALUE */ 6#include <linux/err.h> /* for IS_ERR_VALUE */
7#include <linux/bug.h> /* For BUG_ON. */ 7#include <linux/bug.h> /* For BUG_ON. */
8#include <linux/pid_namespace.h> /* For task_active_pid_ns. */
8#include <uapi/linux/ptrace.h> 9#include <uapi/linux/ptrace.h>
9 10
10/* 11/*
@@ -129,6 +130,37 @@ static inline void ptrace_event(int event, unsigned long message)
129} 130}
130 131
131/** 132/**
133 * ptrace_event_pid - possibly stop for a ptrace event notification
134 * @event: %PTRACE_EVENT_* value to report
135 * @pid: process identifier for %PTRACE_GETEVENTMSG to return
136 *
137 * Check whether @event is enabled and, if so, report @event and @pid
138 * to the ptrace parent. @pid is reported as the pid_t seen from the
139 * the ptrace parent's pid namespace.
140 *
141 * Called without locks.
142 */
143static inline void ptrace_event_pid(int event, struct pid *pid)
144{
145 /*
146 * FIXME: There's a potential race if a ptracer in a different pid
147 * namespace than parent attaches between computing message below and
148 * when we acquire tasklist_lock in ptrace_stop(). If this happens,
149 * the ptracer will get a bogus pid from PTRACE_GETEVENTMSG.
150 */
151 unsigned long message = 0;
152 struct pid_namespace *ns;
153
154 rcu_read_lock();
155 ns = task_active_pid_ns(rcu_dereference(current->parent));
156 if (ns)
157 message = pid_nr_ns(pid, ns);
158 rcu_read_unlock();
159
160 ptrace_event(event, message);
161}
162
163/**
132 * ptrace_init_task - initialize ptrace state for a new child 164 * ptrace_init_task - initialize ptrace state for a new child
133 * @child: new child task 165 * @child: new child task
134 * @ptrace: true if child should be ptrace'd by parent's tracer 166 * @ptrace: true if child should be ptrace'd by parent's tracer
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 00a7fd61b3c6..5a75d19aa661 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -44,6 +44,7 @@
44#include <linux/debugobjects.h> 44#include <linux/debugobjects.h>
45#include <linux/bug.h> 45#include <linux/bug.h>
46#include <linux/compiler.h> 46#include <linux/compiler.h>
47#include <linux/percpu.h>
47#include <asm/barrier.h> 48#include <asm/barrier.h>
48 49
49extern int rcu_expedited; /* for sysctl */ 50extern int rcu_expedited; /* for sysctl */
@@ -51,7 +52,17 @@ extern int rcu_expedited; /* for sysctl */
51extern int rcutorture_runnable; /* for sysctl */ 52extern int rcutorture_runnable; /* for sysctl */
52#endif /* #ifdef CONFIG_RCU_TORTURE_TEST */ 53#endif /* #ifdef CONFIG_RCU_TORTURE_TEST */
53 54
55enum rcutorture_type {
56 RCU_FLAVOR,
57 RCU_BH_FLAVOR,
58 RCU_SCHED_FLAVOR,
59 SRCU_FLAVOR,
60 INVALID_RCU_FLAVOR
61};
62
54#if defined(CONFIG_TREE_RCU) || defined(CONFIG_TREE_PREEMPT_RCU) 63#if defined(CONFIG_TREE_RCU) || defined(CONFIG_TREE_PREEMPT_RCU)
64void rcutorture_get_gp_data(enum rcutorture_type test_type, int *flags,
65 unsigned long *gpnum, unsigned long *completed);
55void rcutorture_record_test_transition(void); 66void rcutorture_record_test_transition(void);
56void rcutorture_record_progress(unsigned long vernum); 67void rcutorture_record_progress(unsigned long vernum);
57void do_trace_rcu_torture_read(const char *rcutorturename, 68void do_trace_rcu_torture_read(const char *rcutorturename,
@@ -60,6 +71,15 @@ void do_trace_rcu_torture_read(const char *rcutorturename,
60 unsigned long c_old, 71 unsigned long c_old,
61 unsigned long c); 72 unsigned long c);
62#else 73#else
74static inline void rcutorture_get_gp_data(enum rcutorture_type test_type,
75 int *flags,
76 unsigned long *gpnum,
77 unsigned long *completed)
78{
79 *flags = 0;
80 *gpnum = 0;
81 *completed = 0;
82}
63static inline void rcutorture_record_test_transition(void) 83static inline void rcutorture_record_test_transition(void)
64{ 84{
65} 85}
@@ -228,6 +248,18 @@ void rcu_idle_exit(void);
228void rcu_irq_enter(void); 248void rcu_irq_enter(void);
229void rcu_irq_exit(void); 249void rcu_irq_exit(void);
230 250
251#ifdef CONFIG_RCU_STALL_COMMON
252void rcu_sysrq_start(void);
253void rcu_sysrq_end(void);
254#else /* #ifdef CONFIG_RCU_STALL_COMMON */
255static inline void rcu_sysrq_start(void)
256{
257}
258static inline void rcu_sysrq_end(void)
259{
260}
261#endif /* #else #ifdef CONFIG_RCU_STALL_COMMON */
262
231#ifdef CONFIG_RCU_USER_QS 263#ifdef CONFIG_RCU_USER_QS
232void rcu_user_enter(void); 264void rcu_user_enter(void);
233void rcu_user_exit(void); 265void rcu_user_exit(void);
@@ -268,6 +300,41 @@ bool __rcu_is_watching(void);
268#endif /* #if defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_RCU_TRACE) || defined(CONFIG_SMP) */ 300#endif /* #if defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_RCU_TRACE) || defined(CONFIG_SMP) */
269 301
270/* 302/*
303 * Hooks for cond_resched() and friends to avoid RCU CPU stall warnings.
304 */
305
306#define RCU_COND_RESCHED_LIM 256 /* ms vs. 100s of ms. */
307DECLARE_PER_CPU(int, rcu_cond_resched_count);
308void rcu_resched(void);
309
310/*
311 * Is it time to report RCU quiescent states?
312 *
313 * Note unsynchronized access to rcu_cond_resched_count. Yes, we might
314 * increment some random CPU's count, and possibly also load the result from
315 * yet another CPU's count. We might even clobber some other CPU's attempt
316 * to zero its counter. This is all OK because the goal is not precision,
317 * but rather reasonable amortization of rcu_note_context_switch() overhead
318 * and extremely high probability of avoiding RCU CPU stall warnings.
319 * Note that this function has to be preempted in just the wrong place,
320 * many thousands of times in a row, for anything bad to happen.
321 */
322static inline bool rcu_should_resched(void)
323{
324 return raw_cpu_inc_return(rcu_cond_resched_count) >=
325 RCU_COND_RESCHED_LIM;
326}
327
328/*
329 * Report quiscent states to RCU if it is time to do so.
330 */
331static inline void rcu_cond_resched(void)
332{
333 if (unlikely(rcu_should_resched()))
334 rcu_resched();
335}
336
337/*
271 * Infrastructure to implement the synchronize_() primitives in 338 * Infrastructure to implement the synchronize_() primitives in
272 * TREE_RCU and rcu_barrier_() primitives in TINY_RCU. 339 * TREE_RCU and rcu_barrier_() primitives in TINY_RCU.
273 */ 340 */
@@ -328,7 +395,7 @@ extern struct lockdep_map rcu_lock_map;
328extern struct lockdep_map rcu_bh_lock_map; 395extern struct lockdep_map rcu_bh_lock_map;
329extern struct lockdep_map rcu_sched_lock_map; 396extern struct lockdep_map rcu_sched_lock_map;
330extern struct lockdep_map rcu_callback_map; 397extern struct lockdep_map rcu_callback_map;
331extern int debug_lockdep_rcu_enabled(void); 398int debug_lockdep_rcu_enabled(void);
332 399
333/** 400/**
334 * rcu_read_lock_held() - might we be in RCU read-side critical section? 401 * rcu_read_lock_held() - might we be in RCU read-side critical section?
@@ -949,6 +1016,9 @@ static inline notrace void rcu_read_unlock_sched_notrace(void)
949 * pointers, but you must use rcu_assign_pointer() to initialize the 1016 * pointers, but you must use rcu_assign_pointer() to initialize the
950 * external-to-structure pointer -after- you have completely initialized 1017 * external-to-structure pointer -after- you have completely initialized
951 * the reader-accessible portions of the linked structure. 1018 * the reader-accessible portions of the linked structure.
1019 *
1020 * Note that unlike rcu_assign_pointer(), RCU_INIT_POINTER() provides no
1021 * ordering guarantees for either the CPU or the compiler.
952 */ 1022 */
953#define RCU_INIT_POINTER(p, v) \ 1023#define RCU_INIT_POINTER(p, v) \
954 do { \ 1024 do { \
diff --git a/include/linux/rcutiny.h b/include/linux/rcutiny.h
index 425c659d54e5..d40a6a451330 100644
--- a/include/linux/rcutiny.h
+++ b/include/linux/rcutiny.h
@@ -119,6 +119,10 @@ static inline void rcu_sched_force_quiescent_state(void)
119{ 119{
120} 120}
121 121
122static inline void show_rcu_gp_kthreads(void)
123{
124}
125
122static inline void rcu_cpu_stall_reset(void) 126static inline void rcu_cpu_stall_reset(void)
123{ 127{
124} 128}
diff --git a/include/linux/rcutree.h b/include/linux/rcutree.h
index a59ca05fd4e3..3e2f5d432743 100644
--- a/include/linux/rcutree.h
+++ b/include/linux/rcutree.h
@@ -84,6 +84,7 @@ extern unsigned long rcutorture_vernum;
84long rcu_batches_completed(void); 84long rcu_batches_completed(void);
85long rcu_batches_completed_bh(void); 85long rcu_batches_completed_bh(void);
86long rcu_batches_completed_sched(void); 86long rcu_batches_completed_sched(void);
87void show_rcu_gp_kthreads(void);
87 88
88void rcu_force_quiescent_state(void); 89void rcu_force_quiescent_state(void);
89void rcu_bh_force_quiescent_state(void); 90void rcu_bh_force_quiescent_state(void);
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index 85691b9b4fa7..7b0e4b425cdf 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -276,6 +276,10 @@ typedef int (*regmap_hw_async_write)(void *context,
276typedef int (*regmap_hw_read)(void *context, 276typedef int (*regmap_hw_read)(void *context,
277 const void *reg_buf, size_t reg_size, 277 const void *reg_buf, size_t reg_size,
278 void *val_buf, size_t val_size); 278 void *val_buf, size_t val_size);
279typedef int (*regmap_hw_reg_read)(void *context, unsigned int reg,
280 unsigned int *val);
281typedef int (*regmap_hw_reg_write)(void *context, unsigned int reg,
282 unsigned int val);
279typedef struct regmap_async *(*regmap_hw_async_alloc)(void); 283typedef struct regmap_async *(*regmap_hw_async_alloc)(void);
280typedef void (*regmap_hw_free_context)(void *context); 284typedef void (*regmap_hw_free_context)(void *context);
281 285
@@ -309,7 +313,9 @@ struct regmap_bus {
309 regmap_hw_write write; 313 regmap_hw_write write;
310 regmap_hw_gather_write gather_write; 314 regmap_hw_gather_write gather_write;
311 regmap_hw_async_write async_write; 315 regmap_hw_async_write async_write;
316 regmap_hw_reg_write reg_write;
312 regmap_hw_read read; 317 regmap_hw_read read;
318 regmap_hw_reg_read reg_read;
313 regmap_hw_free_context free_context; 319 regmap_hw_free_context free_context;
314 regmap_hw_async_alloc async_alloc; 320 regmap_hw_async_alloc async_alloc;
315 u8 read_flag_mask; 321 u8 read_flag_mask;
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
index 1a4a8c157b31..a2d9d81038d1 100644
--- a/include/linux/regulator/consumer.h
+++ b/include/linux/regulator/consumer.h
@@ -151,11 +151,13 @@ int regulator_register_supply_alias(struct device *dev, const char *id,
151 const char *alias_id); 151 const char *alias_id);
152void regulator_unregister_supply_alias(struct device *dev, const char *id); 152void regulator_unregister_supply_alias(struct device *dev, const char *id);
153 153
154int regulator_bulk_register_supply_alias(struct device *dev, const char **id, 154int regulator_bulk_register_supply_alias(struct device *dev,
155 const char *const *id,
155 struct device *alias_dev, 156 struct device *alias_dev,
156 const char **alias_id, int num_id); 157 const char *const *alias_id,
158 int num_id);
157void regulator_bulk_unregister_supply_alias(struct device *dev, 159void regulator_bulk_unregister_supply_alias(struct device *dev,
158 const char **id, int num_id); 160 const char * const *id, int num_id);
159 161
160int devm_regulator_register_supply_alias(struct device *dev, const char *id, 162int devm_regulator_register_supply_alias(struct device *dev, const char *id,
161 struct device *alias_dev, 163 struct device *alias_dev,
@@ -164,12 +166,12 @@ void devm_regulator_unregister_supply_alias(struct device *dev,
164 const char *id); 166 const char *id);
165 167
166int devm_regulator_bulk_register_supply_alias(struct device *dev, 168int devm_regulator_bulk_register_supply_alias(struct device *dev,
167 const char **id, 169 const char *const *id,
168 struct device *alias_dev, 170 struct device *alias_dev,
169 const char **alias_id, 171 const char *const *alias_id,
170 int num_id); 172 int num_id);
171void devm_regulator_bulk_unregister_supply_alias(struct device *dev, 173void devm_regulator_bulk_unregister_supply_alias(struct device *dev,
172 const char **id, 174 const char *const *id,
173 int num_id); 175 int num_id);
174 176
175/* regulator output control and status */ 177/* regulator output control and status */
@@ -290,17 +292,17 @@ static inline void regulator_unregister_supply_alias(struct device *dev,
290} 292}
291 293
292static inline int regulator_bulk_register_supply_alias(struct device *dev, 294static inline int regulator_bulk_register_supply_alias(struct device *dev,
293 const char **id, 295 const char *const *id,
294 struct device *alias_dev, 296 struct device *alias_dev,
295 const char **alias_id, 297 const char * const *alias_id,
296 int num_id) 298 int num_id)
297{ 299{
298 return 0; 300 return 0;
299} 301}
300 302
301static inline void regulator_bulk_unregister_supply_alias(struct device *dev, 303static inline void regulator_bulk_unregister_supply_alias(struct device *dev,
302 const char **id, 304 const char * const *id,
303 int num_id) 305 int num_id)
304{ 306{
305} 307}
306 308
@@ -317,15 +319,17 @@ static inline void devm_regulator_unregister_supply_alias(struct device *dev,
317{ 319{
318} 320}
319 321
320static inline int devm_regulator_bulk_register_supply_alias( 322static inline int devm_regulator_bulk_register_supply_alias(struct device *dev,
321 struct device *dev, const char **id, struct device *alias_dev, 323 const char *const *id,
322 const char **alias_id, int num_id) 324 struct device *alias_dev,
325 const char *const *alias_id,
326 int num_id)
323{ 327{
324 return 0; 328 return 0;
325} 329}
326 330
327static inline void devm_regulator_bulk_unregister_supply_alias( 331static inline void devm_regulator_bulk_unregister_supply_alias(
328 struct device *dev, const char **id, int num_id) 332 struct device *dev, const char *const *id, int num_id)
329{ 333{
330} 334}
331 335
@@ -397,6 +401,12 @@ static inline int regulator_set_voltage(struct regulator *regulator,
397 return 0; 401 return 0;
398} 402}
399 403
404static inline int regulator_set_voltage_time(struct regulator *regulator,
405 int old_uV, int new_uV)
406{
407 return 0;
408}
409
400static inline int regulator_get_voltage(struct regulator *regulator) 410static inline int regulator_get_voltage(struct regulator *regulator)
401{ 411{
402 return -EINVAL; 412 return -EINVAL;
diff --git a/include/linux/reset.h b/include/linux/reset.h
index c0eda5023d74..349f150ae12c 100644
--- a/include/linux/reset.h
+++ b/include/linux/reset.h
@@ -2,6 +2,7 @@
2#define _LINUX_RESET_H_ 2#define _LINUX_RESET_H_
3 3
4struct device; 4struct device;
5struct device_node;
5struct reset_control; 6struct reset_control;
6 7
7#ifdef CONFIG_RESET_CONTROLLER 8#ifdef CONFIG_RESET_CONTROLLER
@@ -33,6 +34,9 @@ static inline struct reset_control *devm_reset_control_get_optional(
33 return devm_reset_control_get(dev, id); 34 return devm_reset_control_get(dev, id);
34} 35}
35 36
37struct reset_control *of_reset_control_get(struct device_node *node,
38 const char *id);
39
36#else 40#else
37 41
38static inline int reset_control_reset(struct reset_control *rstc) 42static inline int reset_control_reset(struct reset_control *rstc)
@@ -75,6 +79,12 @@ static inline struct reset_control *devm_reset_control_get_optional(
75 return ERR_PTR(-ENOSYS); 79 return ERR_PTR(-ENOSYS);
76} 80}
77 81
82static inline struct reset_control *of_reset_control_get(
83 struct device_node *node, const char *id)
84{
85 return ERR_PTR(-ENOSYS);
86}
87
78#endif /* CONFIG_RESET_CONTROLLER */ 88#endif /* CONFIG_RESET_CONTROLLER */
79 89
80#endif 90#endif
diff --git a/include/linux/rmap.h b/include/linux/rmap.h
index b66c2110cb1f..be574506e6a9 100644
--- a/include/linux/rmap.h
+++ b/include/linux/rmap.h
@@ -72,10 +72,9 @@ struct anon_vma_chain {
72}; 72};
73 73
74enum ttu_flags { 74enum ttu_flags {
75 TTU_UNMAP = 0, /* unmap mode */ 75 TTU_UNMAP = 1, /* unmap mode */
76 TTU_MIGRATION = 1, /* migration mode */ 76 TTU_MIGRATION = 2, /* migration mode */
77 TTU_MUNLOCK = 2, /* munlock mode */ 77 TTU_MUNLOCK = 4, /* munlock mode */
78 TTU_ACTION_MASK = 0xff,
79 78
80 TTU_IGNORE_MLOCK = (1 << 8), /* ignore mlock */ 79 TTU_IGNORE_MLOCK = (1 << 8), /* ignore mlock */
81 TTU_IGNORE_ACCESS = (1 << 9), /* don't age */ 80 TTU_IGNORE_ACCESS = (1 << 9), /* don't age */
@@ -183,14 +182,10 @@ static inline void page_dup_rmap(struct page *page)
183 */ 182 */
184int page_referenced(struct page *, int is_locked, 183int page_referenced(struct page *, int is_locked,
185 struct mem_cgroup *memcg, unsigned long *vm_flags); 184 struct mem_cgroup *memcg, unsigned long *vm_flags);
186int page_referenced_one(struct page *, struct vm_area_struct *,
187 unsigned long address, void *arg);
188 185
189#define TTU_ACTION(x) ((x) & TTU_ACTION_MASK) 186#define TTU_ACTION(x) ((x) & TTU_ACTION_MASK)
190 187
191int try_to_unmap(struct page *, enum ttu_flags flags); 188int try_to_unmap(struct page *, enum ttu_flags flags);
192int try_to_unmap_one(struct page *, struct vm_area_struct *,
193 unsigned long address, void *arg);
194 189
195/* 190/*
196 * Called from mm/filemap_xip.c to unmap empty zero page 191 * Called from mm/filemap_xip.c to unmap empty zero page
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 221b2bde3723..ea74596014a2 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -137,12 +137,6 @@ struct filename;
137#define VMACACHE_MASK (VMACACHE_SIZE - 1) 137#define VMACACHE_MASK (VMACACHE_SIZE - 1)
138 138
139/* 139/*
140 * List of flags we want to share for kernel threads,
141 * if only because they are not used by them anyway.
142 */
143#define CLONE_KERNEL (CLONE_FS | CLONE_FILES | CLONE_SIGHAND)
144
145/*
146 * These are the constant used to fake the fixed-point load-average 140 * These are the constant used to fake the fixed-point load-average
147 * counting. Some notes: 141 * counting. Some notes:
148 * - 11 bit fractions expand to 22 bits by the multiplies: this gives 142 * - 11 bit fractions expand to 22 bits by the multiplies: this gives
@@ -745,7 +739,6 @@ static inline int signal_group_exit(const struct signal_struct *sig)
745struct user_struct { 739struct user_struct {
746 atomic_t __count; /* reference count */ 740 atomic_t __count; /* reference count */
747 atomic_t processes; /* How many processes does this user have? */ 741 atomic_t processes; /* How many processes does this user have? */
748 atomic_t files; /* How many open files does this user have? */
749 atomic_t sigpending; /* How many pending signals does this user have? */ 742 atomic_t sigpending; /* How many pending signals does this user have? */
750#ifdef CONFIG_INOTIFY_USER 743#ifdef CONFIG_INOTIFY_USER
751 atomic_t inotify_watches; /* How many inotify watches does this user have? */ 744 atomic_t inotify_watches; /* How many inotify watches does this user have? */
@@ -870,6 +863,7 @@ enum cpu_idle_type {
870#define SD_BALANCE_WAKE 0x0010 /* Balance on wakeup */ 863#define SD_BALANCE_WAKE 0x0010 /* Balance on wakeup */
871#define SD_WAKE_AFFINE 0x0020 /* Wake task to waking CPU */ 864#define SD_WAKE_AFFINE 0x0020 /* Wake task to waking CPU */
872#define SD_SHARE_CPUPOWER 0x0080 /* Domain members share cpu power */ 865#define SD_SHARE_CPUPOWER 0x0080 /* Domain members share cpu power */
866#define SD_SHARE_POWERDOMAIN 0x0100 /* Domain members share power domain */
873#define SD_SHARE_PKG_RESOURCES 0x0200 /* Domain members share cpu pkg resources */ 867#define SD_SHARE_PKG_RESOURCES 0x0200 /* Domain members share cpu pkg resources */
874#define SD_SERIALIZE 0x0400 /* Only a single load balancing instance */ 868#define SD_SERIALIZE 0x0400 /* Only a single load balancing instance */
875#define SD_ASYM_PACKING 0x0800 /* Place busy groups earlier in the domain */ 869#define SD_ASYM_PACKING 0x0800 /* Place busy groups earlier in the domain */
@@ -877,7 +871,26 @@ enum cpu_idle_type {
877#define SD_OVERLAP 0x2000 /* sched_domains of this level overlap */ 871#define SD_OVERLAP 0x2000 /* sched_domains of this level overlap */
878#define SD_NUMA 0x4000 /* cross-node balancing */ 872#define SD_NUMA 0x4000 /* cross-node balancing */
879 873
880extern int __weak arch_sd_sibiling_asym_packing(void); 874#ifdef CONFIG_SCHED_SMT
875static inline const int cpu_smt_flags(void)
876{
877 return SD_SHARE_CPUPOWER | SD_SHARE_PKG_RESOURCES;
878}
879#endif
880
881#ifdef CONFIG_SCHED_MC
882static inline const int cpu_core_flags(void)
883{
884 return SD_SHARE_PKG_RESOURCES;
885}
886#endif
887
888#ifdef CONFIG_NUMA
889static inline const int cpu_numa_flags(void)
890{
891 return SD_NUMA;
892}
893#endif
881 894
882struct sched_domain_attr { 895struct sched_domain_attr {
883 int relax_domain_level; 896 int relax_domain_level;
@@ -985,6 +998,38 @@ void free_sched_domains(cpumask_var_t doms[], unsigned int ndoms);
985 998
986bool cpus_share_cache(int this_cpu, int that_cpu); 999bool cpus_share_cache(int this_cpu, int that_cpu);
987 1000
1001typedef const struct cpumask *(*sched_domain_mask_f)(int cpu);
1002typedef const int (*sched_domain_flags_f)(void);
1003
1004#define SDTL_OVERLAP 0x01
1005
1006struct sd_data {
1007 struct sched_domain **__percpu sd;
1008 struct sched_group **__percpu sg;
1009 struct sched_group_power **__percpu sgp;
1010};
1011
1012struct sched_domain_topology_level {
1013 sched_domain_mask_f mask;
1014 sched_domain_flags_f sd_flags;
1015 int flags;
1016 int numa_level;
1017 struct sd_data data;
1018#ifdef CONFIG_SCHED_DEBUG
1019 char *name;
1020#endif
1021};
1022
1023extern struct sched_domain_topology_level *sched_domain_topology;
1024
1025extern void set_sched_topology(struct sched_domain_topology_level *tl);
1026
1027#ifdef CONFIG_SCHED_DEBUG
1028# define SD_INIT_NAME(type) .name = #type
1029#else
1030# define SD_INIT_NAME(type)
1031#endif
1032
988#else /* CONFIG_SMP */ 1033#else /* CONFIG_SMP */
989 1034
990struct sched_domain_attr; 1035struct sched_domain_attr;
@@ -1123,8 +1168,8 @@ struct sched_dl_entity {
1123 1168
1124 /* 1169 /*
1125 * Original scheduling parameters. Copied here from sched_attr 1170 * Original scheduling parameters. Copied here from sched_attr
1126 * during sched_setscheduler2(), they will remain the same until 1171 * during sched_setattr(), they will remain the same until
1127 * the next sched_setscheduler2(). 1172 * the next sched_setattr().
1128 */ 1173 */
1129 u64 dl_runtime; /* maximum runtime for each instance */ 1174 u64 dl_runtime; /* maximum runtime for each instance */
1130 u64 dl_deadline; /* relative deadline of each instance */ 1175 u64 dl_deadline; /* relative deadline of each instance */
@@ -2369,9 +2414,6 @@ extern void flush_itimer_signals(void);
2369 2414
2370extern void do_group_exit(int); 2415extern void do_group_exit(int);
2371 2416
2372extern int allow_signal(int);
2373extern int disallow_signal(int);
2374
2375extern int do_execve(struct filename *, 2417extern int do_execve(struct filename *,
2376 const char __user * const __user *, 2418 const char __user * const __user *,
2377 const char __user * const __user *); 2419 const char __user * const __user *);
@@ -2723,51 +2765,9 @@ static inline int spin_needbreak(spinlock_t *lock)
2723 2765
2724/* 2766/*
2725 * Idle thread specific functions to determine the need_resched 2767 * Idle thread specific functions to determine the need_resched
2726 * polling state. We have two versions, one based on TS_POLLING in 2768 * polling state.
2727 * thread_info.status and one based on TIF_POLLING_NRFLAG in
2728 * thread_info.flags
2729 */ 2769 */
2730#ifdef TS_POLLING 2770#ifdef TIF_POLLING_NRFLAG
2731static inline int tsk_is_polling(struct task_struct *p)
2732{
2733 return task_thread_info(p)->status & TS_POLLING;
2734}
2735static inline void __current_set_polling(void)
2736{
2737 current_thread_info()->status |= TS_POLLING;
2738}
2739
2740static inline bool __must_check current_set_polling_and_test(void)
2741{
2742 __current_set_polling();
2743
2744 /*
2745 * Polling state must be visible before we test NEED_RESCHED,
2746 * paired by resched_task()
2747 */
2748 smp_mb();
2749
2750 return unlikely(tif_need_resched());
2751}
2752
2753static inline void __current_clr_polling(void)
2754{
2755 current_thread_info()->status &= ~TS_POLLING;
2756}
2757
2758static inline bool __must_check current_clr_polling_and_test(void)
2759{
2760 __current_clr_polling();
2761
2762 /*
2763 * Polling state must be visible before we test NEED_RESCHED,
2764 * paired by resched_task()
2765 */
2766 smp_mb();
2767
2768 return unlikely(tif_need_resched());
2769}
2770#elif defined(TIF_POLLING_NRFLAG)
2771static inline int tsk_is_polling(struct task_struct *p) 2771static inline int tsk_is_polling(struct task_struct *p)
2772{ 2772{
2773 return test_tsk_thread_flag(p, TIF_POLLING_NRFLAG); 2773 return test_tsk_thread_flag(p, TIF_POLLING_NRFLAG);
@@ -2785,10 +2785,8 @@ static inline bool __must_check current_set_polling_and_test(void)
2785 /* 2785 /*
2786 * Polling state must be visible before we test NEED_RESCHED, 2786 * Polling state must be visible before we test NEED_RESCHED,
2787 * paired by resched_task() 2787 * paired by resched_task()
2788 *
2789 * XXX: assumes set/clear bit are identical barrier wise.
2790 */ 2788 */
2791 smp_mb__after_clear_bit(); 2789 smp_mb__after_atomic();
2792 2790
2793 return unlikely(tif_need_resched()); 2791 return unlikely(tif_need_resched());
2794} 2792}
@@ -2806,7 +2804,7 @@ static inline bool __must_check current_clr_polling_and_test(void)
2806 * Polling state must be visible before we test NEED_RESCHED, 2804 * Polling state must be visible before we test NEED_RESCHED,
2807 * paired by resched_task() 2805 * paired by resched_task()
2808 */ 2806 */
2809 smp_mb__after_clear_bit(); 2807 smp_mb__after_atomic();
2810 2808
2811 return unlikely(tif_need_resched()); 2809 return unlikely(tif_need_resched());
2812} 2810}
@@ -2959,7 +2957,7 @@ static inline void inc_syscw(struct task_struct *tsk)
2959#define TASK_SIZE_OF(tsk) TASK_SIZE 2957#define TASK_SIZE_OF(tsk) TASK_SIZE
2960#endif 2958#endif
2961 2959
2962#ifdef CONFIG_MM_OWNER 2960#ifdef CONFIG_MEMCG
2963extern void mm_update_next_owner(struct mm_struct *mm); 2961extern void mm_update_next_owner(struct mm_struct *mm);
2964extern void mm_init_owner(struct mm_struct *mm, struct task_struct *p); 2962extern void mm_init_owner(struct mm_struct *mm, struct task_struct *p);
2965#else 2963#else
@@ -2970,7 +2968,7 @@ static inline void mm_update_next_owner(struct mm_struct *mm)
2970static inline void mm_init_owner(struct mm_struct *mm, struct task_struct *p) 2968static inline void mm_init_owner(struct mm_struct *mm, struct task_struct *p)
2971{ 2969{
2972} 2970}
2973#endif /* CONFIG_MM_OWNER */ 2971#endif /* CONFIG_MEMCG */
2974 2972
2975static inline unsigned long task_rlimit(const struct task_struct *tsk, 2973static inline unsigned long task_rlimit(const struct task_struct *tsk,
2976 unsigned int limit) 2974 unsigned int limit)
diff --git a/include/linux/sched/prio.h b/include/linux/sched/prio.h
index ac322583c820..d9cf5a5762d9 100644
--- a/include/linux/sched/prio.h
+++ b/include/linux/sched/prio.h
@@ -41,4 +41,20 @@
41#define TASK_USER_PRIO(p) USER_PRIO((p)->static_prio) 41#define TASK_USER_PRIO(p) USER_PRIO((p)->static_prio)
42#define MAX_USER_PRIO (USER_PRIO(MAX_PRIO)) 42#define MAX_USER_PRIO (USER_PRIO(MAX_PRIO))
43 43
44/*
45 * Convert nice value [19,-20] to rlimit style value [1,40].
46 */
47static inline long nice_to_rlimit(long nice)
48{
49 return (MAX_NICE - nice + 1);
50}
51
52/*
53 * Convert rlimit style value [1,40] to nice value [-20, 19].
54 */
55static inline long rlimit_to_nice(long prio)
56{
57 return (MAX_NICE - prio + 1);
58}
59
44#endif /* _SCHED_PRIO_H */ 60#endif /* _SCHED_PRIO_H */
diff --git a/include/linux/sched/sysctl.h b/include/linux/sched/sysctl.h
index 8045a554cafb..596a0e007c62 100644
--- a/include/linux/sched/sysctl.h
+++ b/include/linux/sched/sysctl.h
@@ -25,6 +25,10 @@ enum { sysctl_hung_task_timeout_secs = 0 };
25 * Because the kernel adds some informative sections to a image of program at 25 * Because the kernel adds some informative sections to a image of program at
26 * generating coredump, we need some margin. The number of extra sections is 26 * generating coredump, we need some margin. The number of extra sections is
27 * 1-3 now and depends on arch. We use "5" as safe margin, here. 27 * 1-3 now and depends on arch. We use "5" as safe margin, here.
28 *
29 * ELF extended numbering allows more than 65535 sections, so 16-bit bound is
30 * not a hard limit any more. Although some userspace tools can be surprised by
31 * that.
28 */ 32 */
29#define MAPCOUNT_ELF_CORE_MARGIN (5) 33#define MAPCOUNT_ELF_CORE_MARGIN (5)
30#define DEFAULT_MAX_MAP_COUNT (USHRT_MAX - MAPCOUNT_ELF_CORE_MARGIN) 34#define DEFAULT_MAX_MAP_COUNT (USHRT_MAX - MAPCOUNT_ELF_CORE_MARGIN)
diff --git a/include/linux/sched_clock.h b/include/linux/sched_clock.h
index cddf0c2940b6..efa931c5cef1 100644
--- a/include/linux/sched_clock.h
+++ b/include/linux/sched_clock.h
@@ -14,7 +14,6 @@ extern void sched_clock_postinit(void);
14static inline void sched_clock_postinit(void) { } 14static inline void sched_clock_postinit(void) { }
15#endif 15#endif
16 16
17extern void setup_sched_clock(u32 (*read)(void), int bits, unsigned long rate);
18extern void sched_clock_register(u64 (*read)(void), int bits, 17extern void sched_clock_register(u64 (*read)(void), int bits,
19 unsigned long rate); 18 unsigned long rate);
20 19
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index f729be981da0..5bbb809ee197 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -285,6 +285,28 @@ static inline int uart_poll_timeout(struct uart_port *port)
285/* 285/*
286 * Console helpers. 286 * Console helpers.
287 */ 287 */
288struct earlycon_device {
289 struct console *con;
290 struct uart_port port;
291 char options[16]; /* e.g., 115200n8 */
292 unsigned int baud;
293};
294int setup_earlycon(char *buf, const char *match,
295 int (*setup)(struct earlycon_device *, const char *));
296
297extern int of_setup_earlycon(unsigned long addr,
298 int (*setup)(struct earlycon_device *, const char *));
299
300#define EARLYCON_DECLARE(name, func) \
301static int __init name ## _setup_earlycon(char *buf) \
302{ \
303 return setup_earlycon(buf, __stringify(name), func); \
304} \
305early_param("earlycon", name ## _setup_earlycon);
306
307#define OF_EARLYCON_DECLARE(name, compat, fn) \
308 _OF_DECLARE(earlycon, name, compat, fn, void *)
309
288struct uart_port *uart_get_console(struct uart_port *ports, int nr, 310struct uart_port *uart_get_console(struct uart_port *ports, int nr,
289 struct console *c); 311 struct console *c);
290void uart_parse_options(char *options, int *baud, int *parity, int *bits, 312void uart_parse_options(char *options, int *baud, int *parity, int *bits,
diff --git a/include/linux/sh_timer.h b/include/linux/sh_timer.h
index 4d9dcd138315..8e1e036d6d45 100644
--- a/include/linux/sh_timer.h
+++ b/include/linux/sh_timer.h
@@ -7,6 +7,7 @@ struct sh_timer_config {
7 int timer_bit; 7 int timer_bit;
8 unsigned long clockevent_rating; 8 unsigned long clockevent_rating;
9 unsigned long clocksource_rating; 9 unsigned long clocksource_rating;
10 unsigned int channels_mask;
10}; 11};
11 12
12#endif /* __SH_TIMER_H__ */ 13#endif /* __SH_TIMER_H__ */
diff --git a/include/linux/shm.h b/include/linux/shm.h
index 1e2cd2e6b540..57d77709fbe2 100644
--- a/include/linux/shm.h
+++ b/include/linux/shm.h
@@ -3,9 +3,8 @@
3 3
4#include <asm/page.h> 4#include <asm/page.h>
5#include <uapi/linux/shm.h> 5#include <uapi/linux/shm.h>
6
7#define SHMALL (SHMMAX/PAGE_SIZE*(SHMMNI/16)) /* max shm system wide (pages) */
8#include <asm/shmparam.h> 6#include <asm/shmparam.h>
7
9struct shmid_kernel /* private to the kernel */ 8struct shmid_kernel /* private to the kernel */
10{ 9{
11 struct kern_ipc_perm shm_perm; 10 struct kern_ipc_perm shm_perm;
diff --git a/include/linux/signal.h b/include/linux/signal.h
index 2ac423bdb676..c9e65360c49a 100644
--- a/include/linux/signal.h
+++ b/include/linux/signal.h
@@ -63,11 +63,6 @@ static inline int sigismember(sigset_t *set, int _sig)
63 return 1 & (set->sig[sig / _NSIG_BPW] >> (sig % _NSIG_BPW)); 63 return 1 & (set->sig[sig / _NSIG_BPW] >> (sig % _NSIG_BPW));
64} 64}
65 65
66static inline int sigfindinword(unsigned long word)
67{
68 return ffz(~word);
69}
70
71#endif /* __HAVE_ARCH_SIG_BITOPS */ 66#endif /* __HAVE_ARCH_SIG_BITOPS */
72 67
73static inline int sigisemptyset(sigset_t *set) 68static inline int sigisemptyset(sigset_t *set)
@@ -289,6 +284,22 @@ extern int get_signal_to_deliver(siginfo_t *info, struct k_sigaction *return_ka,
289extern void signal_setup_done(int failed, struct ksignal *ksig, int stepping); 284extern void signal_setup_done(int failed, struct ksignal *ksig, int stepping);
290extern void signal_delivered(int sig, siginfo_t *info, struct k_sigaction *ka, struct pt_regs *regs, int stepping); 285extern void signal_delivered(int sig, siginfo_t *info, struct k_sigaction *ka, struct pt_regs *regs, int stepping);
291extern void exit_signals(struct task_struct *tsk); 286extern void exit_signals(struct task_struct *tsk);
287extern void kernel_sigaction(int, __sighandler_t);
288
289static inline void allow_signal(int sig)
290{
291 /*
292 * Kernel threads handle their own signals. Let the signal code
293 * know it'll be handled, so that they don't get converted to
294 * SIGKILL or just silently dropped.
295 */
296 kernel_sigaction(sig, (__force __sighandler_t)2);
297}
298
299static inline void disallow_signal(int sig)
300{
301 kernel_sigaction(sig, SIG_IGN);
302}
292 303
293/* 304/*
294 * Eventually that'll replace get_signal_to_deliver(); macro for now, 305 * Eventually that'll replace get_signal_to_deliver(); macro for now,
diff --git a/include/linux/slab.h b/include/linux/slab.h
index 307bfbe62387..1d9abb7d22a0 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -116,7 +116,9 @@ struct kmem_cache *kmem_cache_create(const char *, size_t, size_t,
116 unsigned long, 116 unsigned long,
117 void (*)(void *)); 117 void (*)(void *));
118#ifdef CONFIG_MEMCG_KMEM 118#ifdef CONFIG_MEMCG_KMEM
119void kmem_cache_create_memcg(struct mem_cgroup *, struct kmem_cache *); 119struct kmem_cache *memcg_create_kmem_cache(struct mem_cgroup *,
120 struct kmem_cache *,
121 const char *);
120#endif 122#endif
121void kmem_cache_destroy(struct kmem_cache *); 123void kmem_cache_destroy(struct kmem_cache *);
122int kmem_cache_shrink(struct kmem_cache *); 124int kmem_cache_shrink(struct kmem_cache *);
@@ -369,16 +371,7 @@ kmem_cache_alloc_node_trace(struct kmem_cache *s,
369#include <linux/slub_def.h> 371#include <linux/slub_def.h>
370#endif 372#endif
371 373
372static __always_inline void * 374extern void *kmalloc_order(size_t size, gfp_t flags, unsigned int order);
373kmalloc_order(size_t size, gfp_t flags, unsigned int order)
374{
375 void *ret;
376
377 flags |= (__GFP_COMP | __GFP_KMEMCG);
378 ret = (void *) __get_free_pages(flags, order);
379 kmemleak_alloc(ret, size, 1, flags);
380 return ret;
381}
382 375
383#ifdef CONFIG_TRACING 376#ifdef CONFIG_TRACING
384extern void *kmalloc_order_trace(size_t size, gfp_t flags, unsigned int order); 377extern void *kmalloc_order_trace(size_t size, gfp_t flags, unsigned int order);
@@ -533,10 +526,7 @@ static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node)
533 * @memcg: pointer to the memcg this cache belongs to 526 * @memcg: pointer to the memcg this cache belongs to
534 * @list: list_head for the list of all caches in this memcg 527 * @list: list_head for the list of all caches in this memcg
535 * @root_cache: pointer to the global, root cache, this cache was derived from 528 * @root_cache: pointer to the global, root cache, this cache was derived from
536 * @dead: set to true after the memcg dies; the cache may still be around.
537 * @nr_pages: number of pages that belongs to this cache. 529 * @nr_pages: number of pages that belongs to this cache.
538 * @destroy: worker to be called whenever we are ready, or believe we may be
539 * ready, to destroy this cache.
540 */ 530 */
541struct memcg_cache_params { 531struct memcg_cache_params {
542 bool is_root_cache; 532 bool is_root_cache;
@@ -549,9 +539,7 @@ struct memcg_cache_params {
549 struct mem_cgroup *memcg; 539 struct mem_cgroup *memcg;
550 struct list_head list; 540 struct list_head list;
551 struct kmem_cache *root_cache; 541 struct kmem_cache *root_cache;
552 bool dead;
553 atomic_t nr_pages; 542 atomic_t nr_pages;
554 struct work_struct destroy;
555 }; 543 };
556 }; 544 };
557}; 545};
diff --git a/include/linux/smp.h b/include/linux/smp.h
index 633f5edd7470..34347f26be9b 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -13,8 +13,6 @@
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/llist.h> 14#include <linux/llist.h>
15 15
16extern void cpu_idle(void);
17
18typedef void (*smp_call_func_t)(void *info); 16typedef void (*smp_call_func_t)(void *info);
19struct call_single_data { 17struct call_single_data {
20 struct llist_node llist; 18 struct llist_node llist;
diff --git a/include/linux/spi/adi_spi3.h b/include/linux/spi/adi_spi3.h
new file mode 100644
index 000000000000..c84123aa1d06
--- /dev/null
+++ b/include/linux/spi/adi_spi3.h
@@ -0,0 +1,254 @@
1/*
2 * Analog Devices SPI3 controller driver
3 *
4 * Copyright (c) 2014 Analog Devices Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15
16#ifndef _ADI_SPI3_H_
17#define _ADI_SPI3_H_
18
19#include <linux/types.h>
20
21/* SPI_CONTROL */
22#define SPI_CTL_EN 0x00000001 /* Enable */
23#define SPI_CTL_MSTR 0x00000002 /* Master/Slave */
24#define SPI_CTL_PSSE 0x00000004 /* controls modf error in master mode */
25#define SPI_CTL_ODM 0x00000008 /* Open Drain Mode */
26#define SPI_CTL_CPHA 0x00000010 /* Clock Phase */
27#define SPI_CTL_CPOL 0x00000020 /* Clock Polarity */
28#define SPI_CTL_ASSEL 0x00000040 /* Slave Select Pin Control */
29#define SPI_CTL_SELST 0x00000080 /* Slave Select Polarity in-between transfers */
30#define SPI_CTL_EMISO 0x00000100 /* Enable MISO */
31#define SPI_CTL_SIZE 0x00000600 /* Word Transfer Size */
32#define SPI_CTL_SIZE08 0x00000000 /* SIZE: 8 bits */
33#define SPI_CTL_SIZE16 0x00000200 /* SIZE: 16 bits */
34#define SPI_CTL_SIZE32 0x00000400 /* SIZE: 32 bits */
35#define SPI_CTL_LSBF 0x00001000 /* LSB First */
36#define SPI_CTL_FCEN 0x00002000 /* Flow-Control Enable */
37#define SPI_CTL_FCCH 0x00004000 /* Flow-Control Channel Selection */
38#define SPI_CTL_FCPL 0x00008000 /* Flow-Control Polarity */
39#define SPI_CTL_FCWM 0x00030000 /* Flow-Control Water-Mark */
40#define SPI_CTL_FIFO0 0x00000000 /* FCWM: TFIFO empty or RFIFO Full */
41#define SPI_CTL_FIFO1 0x00010000 /* FCWM: TFIFO 75% or more empty or RFIFO 75% or more full */
42#define SPI_CTL_FIFO2 0x00020000 /* FCWM: TFIFO 50% or more empty or RFIFO 50% or more full */
43#define SPI_CTL_FMODE 0x00040000 /* Fast-mode Enable */
44#define SPI_CTL_MIOM 0x00300000 /* Multiple I/O Mode */
45#define SPI_CTL_MIO_DIS 0x00000000 /* MIOM: Disable */
46#define SPI_CTL_MIO_DUAL 0x00100000 /* MIOM: Enable DIOM (Dual I/O Mode) */
47#define SPI_CTL_MIO_QUAD 0x00200000 /* MIOM: Enable QUAD (Quad SPI Mode) */
48#define SPI_CTL_SOSI 0x00400000 /* Start on MOSI */
49/* SPI_RX_CONTROL */
50#define SPI_RXCTL_REN 0x00000001 /* Receive Channel Enable */
51#define SPI_RXCTL_RTI 0x00000004 /* Receive Transfer Initiate */
52#define SPI_RXCTL_RWCEN 0x00000008 /* Receive Word Counter Enable */
53#define SPI_RXCTL_RDR 0x00000070 /* Receive Data Request */
54#define SPI_RXCTL_RDR_DIS 0x00000000 /* RDR: Disabled */
55#define SPI_RXCTL_RDR_NE 0x00000010 /* RDR: RFIFO not empty */
56#define SPI_RXCTL_RDR_25 0x00000020 /* RDR: RFIFO 25% full */
57#define SPI_RXCTL_RDR_50 0x00000030 /* RDR: RFIFO 50% full */
58#define SPI_RXCTL_RDR_75 0x00000040 /* RDR: RFIFO 75% full */
59#define SPI_RXCTL_RDR_FULL 0x00000050 /* RDR: RFIFO full */
60#define SPI_RXCTL_RDO 0x00000100 /* Receive Data Over-Run */
61#define SPI_RXCTL_RRWM 0x00003000 /* FIFO Regular Water-Mark */
62#define SPI_RXCTL_RWM_0 0x00000000 /* RRWM: RFIFO Empty */
63#define SPI_RXCTL_RWM_25 0x00001000 /* RRWM: RFIFO 25% full */
64#define SPI_RXCTL_RWM_50 0x00002000 /* RRWM: RFIFO 50% full */
65#define SPI_RXCTL_RWM_75 0x00003000 /* RRWM: RFIFO 75% full */
66#define SPI_RXCTL_RUWM 0x00070000 /* FIFO Urgent Water-Mark */
67#define SPI_RXCTL_UWM_DIS 0x00000000 /* RUWM: Disabled */
68#define SPI_RXCTL_UWM_25 0x00010000 /* RUWM: RFIFO 25% full */
69#define SPI_RXCTL_UWM_50 0x00020000 /* RUWM: RFIFO 50% full */
70#define SPI_RXCTL_UWM_75 0x00030000 /* RUWM: RFIFO 75% full */
71#define SPI_RXCTL_UWM_FULL 0x00040000 /* RUWM: RFIFO full */
72/* SPI_TX_CONTROL */
73#define SPI_TXCTL_TEN 0x00000001 /* Transmit Channel Enable */
74#define SPI_TXCTL_TTI 0x00000004 /* Transmit Transfer Initiate */
75#define SPI_TXCTL_TWCEN 0x00000008 /* Transmit Word Counter Enable */
76#define SPI_TXCTL_TDR 0x00000070 /* Transmit Data Request */
77#define SPI_TXCTL_TDR_DIS 0x00000000 /* TDR: Disabled */
78#define SPI_TXCTL_TDR_NF 0x00000010 /* TDR: TFIFO not full */
79#define SPI_TXCTL_TDR_25 0x00000020 /* TDR: TFIFO 25% empty */
80#define SPI_TXCTL_TDR_50 0x00000030 /* TDR: TFIFO 50% empty */
81#define SPI_TXCTL_TDR_75 0x00000040 /* TDR: TFIFO 75% empty */
82#define SPI_TXCTL_TDR_EMPTY 0x00000050 /* TDR: TFIFO empty */
83#define SPI_TXCTL_TDU 0x00000100 /* Transmit Data Under-Run */
84#define SPI_TXCTL_TRWM 0x00003000 /* FIFO Regular Water-Mark */
85#define SPI_TXCTL_RWM_FULL 0x00000000 /* TRWM: TFIFO full */
86#define SPI_TXCTL_RWM_25 0x00001000 /* TRWM: TFIFO 25% empty */
87#define SPI_TXCTL_RWM_50 0x00002000 /* TRWM: TFIFO 50% empty */
88#define SPI_TXCTL_RWM_75 0x00003000 /* TRWM: TFIFO 75% empty */
89#define SPI_TXCTL_TUWM 0x00070000 /* FIFO Urgent Water-Mark */
90#define SPI_TXCTL_UWM_DIS 0x00000000 /* TUWM: Disabled */
91#define SPI_TXCTL_UWM_25 0x00010000 /* TUWM: TFIFO 25% empty */
92#define SPI_TXCTL_UWM_50 0x00020000 /* TUWM: TFIFO 50% empty */
93#define SPI_TXCTL_UWM_75 0x00030000 /* TUWM: TFIFO 75% empty */
94#define SPI_TXCTL_UWM_EMPTY 0x00040000 /* TUWM: TFIFO empty */
95/* SPI_CLOCK */
96#define SPI_CLK_BAUD 0x0000FFFF /* Baud Rate */
97/* SPI_DELAY */
98#define SPI_DLY_STOP 0x000000FF /* Transfer delay time in multiples of SCK period */
99#define SPI_DLY_LEADX 0x00000100 /* Extended (1 SCK) LEAD Control */
100#define SPI_DLY_LAGX 0x00000200 /* Extended (1 SCK) LAG control */
101/* SPI_SSEL */
102#define SPI_SLVSEL_SSE1 0x00000002 /* SPISSEL1 Enable */
103#define SPI_SLVSEL_SSE2 0x00000004 /* SPISSEL2 Enable */
104#define SPI_SLVSEL_SSE3 0x00000008 /* SPISSEL3 Enable */
105#define SPI_SLVSEL_SSE4 0x00000010 /* SPISSEL4 Enable */
106#define SPI_SLVSEL_SSE5 0x00000020 /* SPISSEL5 Enable */
107#define SPI_SLVSEL_SSE6 0x00000040 /* SPISSEL6 Enable */
108#define SPI_SLVSEL_SSE7 0x00000080 /* SPISSEL7 Enable */
109#define SPI_SLVSEL_SSEL1 0x00000200 /* SPISSEL1 Value */
110#define SPI_SLVSEL_SSEL2 0x00000400 /* SPISSEL2 Value */
111#define SPI_SLVSEL_SSEL3 0x00000800 /* SPISSEL3 Value */
112#define SPI_SLVSEL_SSEL4 0x00001000 /* SPISSEL4 Value */
113#define SPI_SLVSEL_SSEL5 0x00002000 /* SPISSEL5 Value */
114#define SPI_SLVSEL_SSEL6 0x00004000 /* SPISSEL6 Value */
115#define SPI_SLVSEL_SSEL7 0x00008000 /* SPISSEL7 Value */
116/* SPI_RWC */
117#define SPI_RWC_VALUE 0x0000FFFF /* Received Word-Count */
118/* SPI_RWCR */
119#define SPI_RWCR_VALUE 0x0000FFFF /* Received Word-Count Reload */
120/* SPI_TWC */
121#define SPI_TWC_VALUE 0x0000FFFF /* Transmitted Word-Count */
122/* SPI_TWCR */
123#define SPI_TWCR_VALUE 0x0000FFFF /* Transmitted Word-Count Reload */
124/* SPI_IMASK */
125#define SPI_IMSK_RUWM 0x00000002 /* Receive Urgent Water-Mark Interrupt Mask */
126#define SPI_IMSK_TUWM 0x00000004 /* Transmit Urgent Water-Mark Interrupt Mask */
127#define SPI_IMSK_ROM 0x00000010 /* Receive Over-Run Error Interrupt Mask */
128#define SPI_IMSK_TUM 0x00000020 /* Transmit Under-Run Error Interrupt Mask */
129#define SPI_IMSK_TCM 0x00000040 /* Transmit Collision Error Interrupt Mask */
130#define SPI_IMSK_MFM 0x00000080 /* Mode Fault Error Interrupt Mask */
131#define SPI_IMSK_RSM 0x00000100 /* Receive Start Interrupt Mask */
132#define SPI_IMSK_TSM 0x00000200 /* Transmit Start Interrupt Mask */
133#define SPI_IMSK_RFM 0x00000400 /* Receive Finish Interrupt Mask */
134#define SPI_IMSK_TFM 0x00000800 /* Transmit Finish Interrupt Mask */
135/* SPI_IMASKCL */
136#define SPI_IMSK_CLR_RUW 0x00000002 /* Receive Urgent Water-Mark Interrupt Mask */
137#define SPI_IMSK_CLR_TUWM 0x00000004 /* Transmit Urgent Water-Mark Interrupt Mask */
138#define SPI_IMSK_CLR_ROM 0x00000010 /* Receive Over-Run Error Interrupt Mask */
139#define SPI_IMSK_CLR_TUM 0x00000020 /* Transmit Under-Run Error Interrupt Mask */
140#define SPI_IMSK_CLR_TCM 0x00000040 /* Transmit Collision Error Interrupt Mask */
141#define SPI_IMSK_CLR_MFM 0x00000080 /* Mode Fault Error Interrupt Mask */
142#define SPI_IMSK_CLR_RSM 0x00000100 /* Receive Start Interrupt Mask */
143#define SPI_IMSK_CLR_TSM 0x00000200 /* Transmit Start Interrupt Mask */
144#define SPI_IMSK_CLR_RFM 0x00000400 /* Receive Finish Interrupt Mask */
145#define SPI_IMSK_CLR_TFM 0x00000800 /* Transmit Finish Interrupt Mask */
146/* SPI_IMASKST */
147#define SPI_IMSK_SET_RUWM 0x00000002 /* Receive Urgent Water-Mark Interrupt Mask */
148#define SPI_IMSK_SET_TUWM 0x00000004 /* Transmit Urgent Water-Mark Interrupt Mask */
149#define SPI_IMSK_SET_ROM 0x00000010 /* Receive Over-Run Error Interrupt Mask */
150#define SPI_IMSK_SET_TUM 0x00000020 /* Transmit Under-Run Error Interrupt Mask */
151#define SPI_IMSK_SET_TCM 0x00000040 /* Transmit Collision Error Interrupt Mask */
152#define SPI_IMSK_SET_MFM 0x00000080 /* Mode Fault Error Interrupt Mask */
153#define SPI_IMSK_SET_RSM 0x00000100 /* Receive Start Interrupt Mask */
154#define SPI_IMSK_SET_TSM 0x00000200 /* Transmit Start Interrupt Mask */
155#define SPI_IMSK_SET_RFM 0x00000400 /* Receive Finish Interrupt Mask */
156#define SPI_IMSK_SET_TFM 0x00000800 /* Transmit Finish Interrupt Mask */
157/* SPI_STATUS */
158#define SPI_STAT_SPIF 0x00000001 /* SPI Finished */
159#define SPI_STAT_RUWM 0x00000002 /* Receive Urgent Water-Mark Breached */
160#define SPI_STAT_TUWM 0x00000004 /* Transmit Urgent Water-Mark Breached */
161#define SPI_STAT_ROE 0x00000010 /* Receive Over-Run Error Indication */
162#define SPI_STAT_TUE 0x00000020 /* Transmit Under-Run Error Indication */
163#define SPI_STAT_TCE 0x00000040 /* Transmit Collision Error Indication */
164#define SPI_STAT_MODF 0x00000080 /* Mode Fault Error Indication */
165#define SPI_STAT_RS 0x00000100 /* Receive Start Indication */
166#define SPI_STAT_TS 0x00000200 /* Transmit Start Indication */
167#define SPI_STAT_RF 0x00000400 /* Receive Finish Indication */
168#define SPI_STAT_TF 0x00000800 /* Transmit Finish Indication */
169#define SPI_STAT_RFS 0x00007000 /* SPI_RFIFO status */
170#define SPI_STAT_RFIFO_EMPTY 0x00000000 /* RFS: RFIFO Empty */
171#define SPI_STAT_RFIFO_25 0x00001000 /* RFS: RFIFO 25% Full */
172#define SPI_STAT_RFIFO_50 0x00002000 /* RFS: RFIFO 50% Full */
173#define SPI_STAT_RFIFO_75 0x00003000 /* RFS: RFIFO 75% Full */
174#define SPI_STAT_RFIFO_FULL 0x00004000 /* RFS: RFIFO Full */
175#define SPI_STAT_TFS 0x00070000 /* SPI_TFIFO status */
176#define SPI_STAT_TFIFO_FULL 0x00000000 /* TFS: TFIFO full */
177#define SPI_STAT_TFIFO_25 0x00010000 /* TFS: TFIFO 25% empty */
178#define SPI_STAT_TFIFO_50 0x00020000 /* TFS: TFIFO 50% empty */
179#define SPI_STAT_TFIFO_75 0x00030000 /* TFS: TFIFO 75% empty */
180#define SPI_STAT_TFIFO_EMPTY 0x00040000 /* TFS: TFIFO empty */
181#define SPI_STAT_FCS 0x00100000 /* Flow-Control Stall Indication */
182#define SPI_STAT_RFE 0x00400000 /* SPI_RFIFO Empty */
183#define SPI_STAT_TFF 0x00800000 /* SPI_TFIFO Full */
184/* SPI_ILAT */
185#define SPI_ILAT_RUWMI 0x00000002 /* Receive Urgent Water Mark Interrupt */
186#define SPI_ILAT_TUWMI 0x00000004 /* Transmit Urgent Water Mark Interrupt */
187#define SPI_ILAT_ROI 0x00000010 /* Receive Over-Run Error Indication */
188#define SPI_ILAT_TUI 0x00000020 /* Transmit Under-Run Error Indication */
189#define SPI_ILAT_TCI 0x00000040 /* Transmit Collision Error Indication */
190#define SPI_ILAT_MFI 0x00000080 /* Mode Fault Error Indication */
191#define SPI_ILAT_RSI 0x00000100 /* Receive Start Indication */
192#define SPI_ILAT_TSI 0x00000200 /* Transmit Start Indication */
193#define SPI_ILAT_RFI 0x00000400 /* Receive Finish Indication */
194#define SPI_ILAT_TFI 0x00000800 /* Transmit Finish Indication */
195/* SPI_ILATCL */
196#define SPI_ILAT_CLR_RUWMI 0x00000002 /* Receive Urgent Water Mark Interrupt */
197#define SPI_ILAT_CLR_TUWMI 0x00000004 /* Transmit Urgent Water Mark Interrupt */
198#define SPI_ILAT_CLR_ROI 0x00000010 /* Receive Over-Run Error Indication */
199#define SPI_ILAT_CLR_TUI 0x00000020 /* Transmit Under-Run Error Indication */
200#define SPI_ILAT_CLR_TCI 0x00000040 /* Transmit Collision Error Indication */
201#define SPI_ILAT_CLR_MFI 0x00000080 /* Mode Fault Error Indication */
202#define SPI_ILAT_CLR_RSI 0x00000100 /* Receive Start Indication */
203#define SPI_ILAT_CLR_TSI 0x00000200 /* Transmit Start Indication */
204#define SPI_ILAT_CLR_RFI 0x00000400 /* Receive Finish Indication */
205#define SPI_ILAT_CLR_TFI 0x00000800 /* Transmit Finish Indication */
206
207/*
208 * adi spi3 registers layout
209 */
210struct adi_spi_regs {
211 u32 revid;
212 u32 control;
213 u32 rx_control;
214 u32 tx_control;
215 u32 clock;
216 u32 delay;
217 u32 ssel;
218 u32 rwc;
219 u32 rwcr;
220 u32 twc;
221 u32 twcr;
222 u32 reserved0;
223 u32 emask;
224 u32 emaskcl;
225 u32 emaskst;
226 u32 reserved1;
227 u32 status;
228 u32 elat;
229 u32 elatcl;
230 u32 reserved2;
231 u32 rfifo;
232 u32 reserved3;
233 u32 tfifo;
234};
235
236#define MAX_CTRL_CS 8 /* cs in spi controller */
237
238/* device.platform_data for SSP controller devices */
239struct adi_spi3_master {
240 u16 num_chipselect;
241 u16 pin_req[7];
242};
243
244/* spi_board_info.controller_data for SPI slave devices,
245 * copied to spi_device.platform_data ... mostly for dma tuning
246 */
247struct adi_spi3_chip {
248 u32 control;
249 u16 cs_chg_udelay; /* Some devices require 16-bit delays */
250 u32 tx_dummy_val; /* tx value for rx only transfer */
251 bool enable_dma;
252};
253
254#endif /* _ADI_SPI3_H_ */
diff --git a/include/linux/spi/rspi.h b/include/linux/spi/rspi.h
index a25bd6f65e7f..e546b2ceb623 100644
--- a/include/linux/spi/rspi.h
+++ b/include/linux/spi/rspi.h
@@ -25,8 +25,6 @@ struct rspi_plat_data {
25 unsigned int dma_tx_id; 25 unsigned int dma_tx_id;
26 unsigned int dma_rx_id; 26 unsigned int dma_rx_id;
27 27
28 unsigned dma_width_16bit:1; /* DMAC read/write width = 16-bit */
29
30 u16 num_chipselect; 28 u16 num_chipselect;
31}; 29};
32 30
diff --git a/include/linux/string.h b/include/linux/string.h
index ac889c5ea11b..d36977e029af 100644
--- a/include/linux/string.h
+++ b/include/linux/string.h
@@ -52,6 +52,9 @@ extern int strncasecmp(const char *s1, const char *s2, size_t n);
52#ifndef __HAVE_ARCH_STRCHR 52#ifndef __HAVE_ARCH_STRCHR
53extern char * strchr(const char *,int); 53extern char * strchr(const char *,int);
54#endif 54#endif
55#ifndef __HAVE_ARCH_STRCHRNUL
56extern char * strchrnul(const char *,int);
57#endif
55#ifndef __HAVE_ARCH_STRNCHR 58#ifndef __HAVE_ARCH_STRNCHR
56extern char * strnchr(const char *, size_t, int); 59extern char * strnchr(const char *, size_t, int);
57#endif 60#endif
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h
index 3a847de83fab..ad7dbe2cfecd 100644
--- a/include/linux/sunrpc/sched.h
+++ b/include/linux/sunrpc/sched.h
@@ -142,18 +142,18 @@ struct rpc_task_setup {
142 test_and_set_bit(RPC_TASK_RUNNING, &(t)->tk_runstate) 142 test_and_set_bit(RPC_TASK_RUNNING, &(t)->tk_runstate)
143#define rpc_clear_running(t) \ 143#define rpc_clear_running(t) \
144 do { \ 144 do { \
145 smp_mb__before_clear_bit(); \ 145 smp_mb__before_atomic(); \
146 clear_bit(RPC_TASK_RUNNING, &(t)->tk_runstate); \ 146 clear_bit(RPC_TASK_RUNNING, &(t)->tk_runstate); \
147 smp_mb__after_clear_bit(); \ 147 smp_mb__after_atomic(); \
148 } while (0) 148 } while (0)
149 149
150#define RPC_IS_QUEUED(t) test_bit(RPC_TASK_QUEUED, &(t)->tk_runstate) 150#define RPC_IS_QUEUED(t) test_bit(RPC_TASK_QUEUED, &(t)->tk_runstate)
151#define rpc_set_queued(t) set_bit(RPC_TASK_QUEUED, &(t)->tk_runstate) 151#define rpc_set_queued(t) set_bit(RPC_TASK_QUEUED, &(t)->tk_runstate)
152#define rpc_clear_queued(t) \ 152#define rpc_clear_queued(t) \
153 do { \ 153 do { \
154 smp_mb__before_clear_bit(); \ 154 smp_mb__before_atomic(); \
155 clear_bit(RPC_TASK_QUEUED, &(t)->tk_runstate); \ 155 clear_bit(RPC_TASK_QUEUED, &(t)->tk_runstate); \
156 smp_mb__after_clear_bit(); \ 156 smp_mb__after_atomic(); \
157 } while (0) 157 } while (0)
158 158
159#define RPC_IS_ACTIVATED(t) test_bit(RPC_TASK_ACTIVE, &(t)->tk_runstate) 159#define RPC_IS_ACTIVATED(t) test_bit(RPC_TASK_ACTIVE, &(t)->tk_runstate)
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h
index 3e5efb2b236e..3876f0f1dfd3 100644
--- a/include/linux/sunrpc/xprt.h
+++ b/include/linux/sunrpc/xprt.h
@@ -379,9 +379,9 @@ static inline int xprt_test_and_clear_connected(struct rpc_xprt *xprt)
379 379
380static inline void xprt_clear_connecting(struct rpc_xprt *xprt) 380static inline void xprt_clear_connecting(struct rpc_xprt *xprt)
381{ 381{
382 smp_mb__before_clear_bit(); 382 smp_mb__before_atomic();
383 clear_bit(XPRT_CONNECTING, &xprt->state); 383 clear_bit(XPRT_CONNECTING, &xprt->state);
384 smp_mb__after_clear_bit(); 384 smp_mb__after_atomic();
385} 385}
386 386
387static inline int xprt_connecting(struct rpc_xprt *xprt) 387static inline int xprt_connecting(struct rpc_xprt *xprt)
@@ -411,9 +411,9 @@ static inline void xprt_clear_bound(struct rpc_xprt *xprt)
411 411
412static inline void xprt_clear_binding(struct rpc_xprt *xprt) 412static inline void xprt_clear_binding(struct rpc_xprt *xprt)
413{ 413{
414 smp_mb__before_clear_bit(); 414 smp_mb__before_atomic();
415 clear_bit(XPRT_BINDING, &xprt->state); 415 clear_bit(XPRT_BINDING, &xprt->state);
416 smp_mb__after_clear_bit(); 416 smp_mb__after_atomic();
417} 417}
418 418
419static inline int xprt_test_and_set_binding(struct rpc_xprt *xprt) 419static inline int xprt_test_and_set_binding(struct rpc_xprt *xprt)
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index f73cabf59012..f76994b9396c 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -187,6 +187,11 @@ struct platform_suspend_ops {
187 void (*recover)(void); 187 void (*recover)(void);
188}; 188};
189 189
190struct platform_freeze_ops {
191 int (*begin)(void);
192 void (*end)(void);
193};
194
190#ifdef CONFIG_SUSPEND 195#ifdef CONFIG_SUSPEND
191/** 196/**
192 * suspend_set_ops - set platform dependent suspend operations 197 * suspend_set_ops - set platform dependent suspend operations
@@ -194,6 +199,7 @@ struct platform_suspend_ops {
194 */ 199 */
195extern void suspend_set_ops(const struct platform_suspend_ops *ops); 200extern void suspend_set_ops(const struct platform_suspend_ops *ops);
196extern int suspend_valid_only_mem(suspend_state_t state); 201extern int suspend_valid_only_mem(suspend_state_t state);
202extern void freeze_set_ops(const struct platform_freeze_ops *ops);
197extern void freeze_wake(void); 203extern void freeze_wake(void);
198 204
199/** 205/**
@@ -220,6 +226,7 @@ extern int pm_suspend(suspend_state_t state);
220 226
221static inline void suspend_set_ops(const struct platform_suspend_ops *ops) {} 227static inline void suspend_set_ops(const struct platform_suspend_ops *ops) {}
222static inline int pm_suspend(suspend_state_t state) { return -ENOSYS; } 228static inline int pm_suspend(suspend_state_t state) { return -ENOSYS; }
229static inline void freeze_set_ops(const struct platform_freeze_ops *ops) {}
223static inline void freeze_wake(void) {} 230static inline void freeze_wake(void) {}
224#endif /* !CONFIG_SUSPEND */ 231#endif /* !CONFIG_SUSPEND */
225 232
@@ -320,6 +327,8 @@ extern unsigned long get_safe_page(gfp_t gfp_mask);
320extern void hibernation_set_ops(const struct platform_hibernation_ops *ops); 327extern void hibernation_set_ops(const struct platform_hibernation_ops *ops);
321extern int hibernate(void); 328extern int hibernate(void);
322extern bool system_entering_hibernation(void); 329extern bool system_entering_hibernation(void);
330asmlinkage int swsusp_save(void);
331extern struct pbe *restore_pblist;
323#else /* CONFIG_HIBERNATION */ 332#else /* CONFIG_HIBERNATION */
324static inline void register_nosave_region(unsigned long b, unsigned long e) {} 333static inline void register_nosave_region(unsigned long b, unsigned long e) {}
325static inline void register_nosave_region_late(unsigned long b, unsigned long e) {} 334static inline void register_nosave_region_late(unsigned long b, unsigned long e) {}
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 350711560753..4bdbee80eede 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -166,10 +166,10 @@ enum {
166#define COMPACT_CLUSTER_MAX SWAP_CLUSTER_MAX 166#define COMPACT_CLUSTER_MAX SWAP_CLUSTER_MAX
167 167
168/* 168/*
169 * Ratio between the present memory in the zone and the "gap" that 169 * Ratio between zone->managed_pages and the "gap" that above the per-zone
170 * we're allowing kswapd to shrink in addition to the per-zone high 170 * "high_wmark". While balancing nodes, We allow kswapd to shrink zones that
171 * wmark, even for zones that already have the high wmark satisfied, 171 * do not meet the (high_wmark + gap) watermark, even which already met the
172 * in order to provide better per-zone lru behavior. We are ok to 172 * high_wmark, in order to provide better per-zone lru behavior. We are ok to
173 * spend not more than 1% of the memory for this zone balancing "gap". 173 * spend not more than 1% of the memory for this zone balancing "gap".
174 */ 174 */
175#define KSWAPD_ZONE_BALANCE_GAP_RATIO 100 175#define KSWAPD_ZONE_BALANCE_GAP_RATIO 100
@@ -214,8 +214,9 @@ struct percpu_cluster {
214struct swap_info_struct { 214struct swap_info_struct {
215 unsigned long flags; /* SWP_USED etc: see above */ 215 unsigned long flags; /* SWP_USED etc: see above */
216 signed short prio; /* swap priority of this type */ 216 signed short prio; /* swap priority of this type */
217 struct plist_node list; /* entry in swap_active_head */
218 struct plist_node avail_list; /* entry in swap_avail_head */
217 signed char type; /* strange name for an index */ 219 signed char type; /* strange name for an index */
218 signed char next; /* next type on the swap list */
219 unsigned int max; /* extent of the swap_map */ 220 unsigned int max; /* extent of the swap_map */
220 unsigned char *swap_map; /* vmalloc'ed array of usage counts */ 221 unsigned char *swap_map; /* vmalloc'ed array of usage counts */
221 struct swap_cluster_info *cluster_info; /* cluster info. Only for SSD */ 222 struct swap_cluster_info *cluster_info; /* cluster info. Only for SSD */
@@ -255,11 +256,6 @@ struct swap_info_struct {
255 struct swap_cluster_info discard_cluster_tail; /* list tail of discard clusters */ 256 struct swap_cluster_info discard_cluster_tail; /* list tail of discard clusters */
256}; 257};
257 258
258struct swap_list_t {
259 int head; /* head of priority-ordered swapfile list */
260 int next; /* swapfile to be used next */
261};
262
263/* linux/mm/workingset.c */ 259/* linux/mm/workingset.c */
264void *workingset_eviction(struct address_space *mapping, struct page *page); 260void *workingset_eviction(struct address_space *mapping, struct page *page);
265bool workingset_refault(void *shadow); 261bool workingset_refault(void *shadow);
@@ -308,12 +304,14 @@ extern unsigned long nr_free_pagecache_pages(void);
308 304
309 305
310/* linux/mm/swap.c */ 306/* linux/mm/swap.c */
311extern void __lru_cache_add(struct page *);
312extern void lru_cache_add(struct page *); 307extern void lru_cache_add(struct page *);
308extern void lru_cache_add_anon(struct page *page);
309extern void lru_cache_add_file(struct page *page);
313extern void lru_add_page_tail(struct page *page, struct page *page_tail, 310extern void lru_add_page_tail(struct page *page, struct page *page_tail,
314 struct lruvec *lruvec, struct list_head *head); 311 struct lruvec *lruvec, struct list_head *head);
315extern void activate_page(struct page *); 312extern void activate_page(struct page *);
316extern void mark_page_accessed(struct page *); 313extern void mark_page_accessed(struct page *);
314extern void init_page_accessed(struct page *page);
317extern void lru_add_drain(void); 315extern void lru_add_drain(void);
318extern void lru_add_drain_cpu(int cpu); 316extern void lru_add_drain_cpu(int cpu);
319extern void lru_add_drain_all(void); 317extern void lru_add_drain_all(void);
@@ -323,22 +321,6 @@ extern void swap_setup(void);
323 321
324extern void add_page_to_unevictable_list(struct page *page); 322extern void add_page_to_unevictable_list(struct page *page);
325 323
326/**
327 * lru_cache_add: add a page to the page lists
328 * @page: the page to add
329 */
330static inline void lru_cache_add_anon(struct page *page)
331{
332 ClearPageActive(page);
333 __lru_cache_add(page);
334}
335
336static inline void lru_cache_add_file(struct page *page)
337{
338 ClearPageActive(page);
339 __lru_cache_add(page);
340}
341
342/* linux/mm/vmscan.c */ 324/* linux/mm/vmscan.c */
343extern unsigned long try_to_free_pages(struct zonelist *zonelist, int order, 325extern unsigned long try_to_free_pages(struct zonelist *zonelist, int order,
344 gfp_t gfp_mask, nodemask_t *mask); 326 gfp_t gfp_mask, nodemask_t *mask);
@@ -496,7 +478,7 @@ mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent, bool swapout)
496#define free_page_and_swap_cache(page) \ 478#define free_page_and_swap_cache(page) \
497 page_cache_release(page) 479 page_cache_release(page)
498#define free_pages_and_swap_cache(pages, nr) \ 480#define free_pages_and_swap_cache(pages, nr) \
499 release_pages((pages), (nr), 0); 481 release_pages((pages), (nr), false);
500 482
501static inline void show_swap_cache_info(void) 483static inline void show_swap_cache_info(void)
502{ 484{
diff --git a/include/linux/swapfile.h b/include/linux/swapfile.h
index e282624e8c10..388293a91e8c 100644
--- a/include/linux/swapfile.h
+++ b/include/linux/swapfile.h
@@ -6,7 +6,7 @@
6 * want to expose them to the dozens of source files that include swap.h 6 * want to expose them to the dozens of source files that include swap.h
7 */ 7 */
8extern spinlock_t swap_lock; 8extern spinlock_t swap_lock;
9extern struct swap_list_t swap_list; 9extern struct plist_head swap_active_head;
10extern struct swap_info_struct *swap_info[]; 10extern struct swap_info_struct *swap_info[];
11extern int try_to_unuse(unsigned int, bool, unsigned long); 11extern int try_to_unuse(unsigned int, bool, unsigned long);
12 12
diff --git a/include/linux/swapops.h b/include/linux/swapops.h
index c0f75261a728..6adfb7bfbf44 100644
--- a/include/linux/swapops.h
+++ b/include/linux/swapops.h
@@ -54,7 +54,7 @@ static inline pgoff_t swp_offset(swp_entry_t entry)
54/* check whether a pte points to a swap entry */ 54/* check whether a pte points to a swap entry */
55static inline int is_swap_pte(pte_t pte) 55static inline int is_swap_pte(pte_t pte)
56{ 56{
57 return !pte_none(pte) && !pte_present(pte) && !pte_file(pte); 57 return !pte_none(pte) && !pte_present_nonuma(pte) && !pte_file(pte);
58} 58}
59#endif 59#endif
60 60
diff --git a/include/linux/swiotlb.h b/include/linux/swiotlb.h
index a5ffd32642fd..e7a018eaf3a2 100644
--- a/include/linux/swiotlb.h
+++ b/include/linux/swiotlb.h
@@ -116,4 +116,6 @@ static inline void swiotlb_free(void) { }
116#endif 116#endif
117 117
118extern void swiotlb_print_info(void); 118extern void swiotlb_print_info(void);
119extern int is_swiotlb_buffer(phys_addr_t paddr);
120
119#endif /* __LINUX_SWIOTLB_H */ 121#endif /* __LINUX_SWIOTLB_H */
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index a4a0588c5397..b0881a0ed322 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -711,7 +711,7 @@ asmlinkage long sys_keyctl(int cmd, unsigned long arg2, unsigned long arg3,
711 711
712asmlinkage long sys_ioprio_set(int which, int who, int ioprio); 712asmlinkage long sys_ioprio_set(int which, int who, int ioprio);
713asmlinkage long sys_ioprio_get(int which, int who); 713asmlinkage long sys_ioprio_get(int which, int who);
714asmlinkage long sys_set_mempolicy(int mode, unsigned long __user *nmask, 714asmlinkage long sys_set_mempolicy(int mode, const unsigned long __user *nmask,
715 unsigned long maxnode); 715 unsigned long maxnode);
716asmlinkage long sys_migrate_pages(pid_t pid, unsigned long maxnode, 716asmlinkage long sys_migrate_pages(pid_t pid, unsigned long maxnode,
717 const unsigned long __user *from, 717 const unsigned long __user *from,
@@ -723,7 +723,7 @@ asmlinkage long sys_move_pages(pid_t pid, unsigned long nr_pages,
723 int flags); 723 int flags);
724asmlinkage long sys_mbind(unsigned long start, unsigned long len, 724asmlinkage long sys_mbind(unsigned long start, unsigned long len,
725 unsigned long mode, 725 unsigned long mode,
726 unsigned long __user *nmask, 726 const unsigned long __user *nmask,
727 unsigned long maxnode, 727 unsigned long maxnode,
728 unsigned flags); 728 unsigned flags);
729asmlinkage long sys_get_mempolicy(int __user *policy, 729asmlinkage long sys_get_mempolicy(int __user *policy,
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index 5ffaa3443712..f97d0dbb59fa 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -437,7 +437,7 @@ static inline int __must_check sysfs_create_file(struct kobject *kobj,
437static inline void sysfs_remove_file(struct kobject *kobj, 437static inline void sysfs_remove_file(struct kobject *kobj,
438 const struct attribute *attr) 438 const struct attribute *attr)
439{ 439{
440 return sysfs_remove_file_ns(kobj, attr, NULL); 440 sysfs_remove_file_ns(kobj, attr, NULL);
441} 441}
442 442
443static inline int sysfs_rename_link(struct kobject *kobj, struct kobject *target, 443static inline int sysfs_rename_link(struct kobject *kobj, struct kobject *target,
diff --git a/include/linux/thread_info.h b/include/linux/thread_info.h
index fddbe2023a5d..ff307b548ed3 100644
--- a/include/linux/thread_info.h
+++ b/include/linux/thread_info.h
@@ -61,8 +61,6 @@ extern long do_no_restart_syscall(struct restart_block *parm);
61# define THREADINFO_GFP (GFP_KERNEL | __GFP_NOTRACK) 61# define THREADINFO_GFP (GFP_KERNEL | __GFP_NOTRACK)
62#endif 62#endif
63 63
64#define THREADINFO_GFP_ACCOUNTED (THREADINFO_GFP | __GFP_KMEMCG)
65
66/* 64/*
67 * flag set/clear/test wrappers 65 * flag set/clear/test wrappers
68 * - pass TIF_xxxx constants to these functions 66 * - pass TIF_xxxx constants to these functions
@@ -104,20 +102,6 @@ static inline int test_ti_thread_flag(struct thread_info *ti, int flag)
104#define test_thread_flag(flag) \ 102#define test_thread_flag(flag) \
105 test_ti_thread_flag(current_thread_info(), flag) 103 test_ti_thread_flag(current_thread_info(), flag)
106 104
107static inline __deprecated void set_need_resched(void)
108{
109 /*
110 * Use of this function in deprecated.
111 *
112 * As of this writing there are only a few users in the DRM tree left
113 * all of which are wrong and can be removed without causing too much
114 * grief.
115 *
116 * The DRM people are aware and are working on removing the last few
117 * instances.
118 */
119}
120
121#define tif_need_resched() test_thread_flag(TIF_NEED_RESCHED) 105#define tif_need_resched() test_thread_flag(TIF_NEED_RESCHED)
122 106
123#if defined TIF_RESTORE_SIGMASK && !defined HAVE_SET_RESTORE_SIGMASK 107#if defined TIF_RESTORE_SIGMASK && !defined HAVE_SET_RESTORE_SIGMASK
diff --git a/include/linux/topology.h b/include/linux/topology.h
index 7062330a1329..dda6ee521e74 100644
--- a/include/linux/topology.h
+++ b/include/linux/topology.h
@@ -58,7 +58,8 @@ int arch_update_cpu_topology(void);
58/* 58/*
59 * If the distance between nodes in a system is larger than RECLAIM_DISTANCE 59 * If the distance between nodes in a system is larger than RECLAIM_DISTANCE
60 * (in whatever arch specific measurement units returned by node_distance()) 60 * (in whatever arch specific measurement units returned by node_distance())
61 * then switch on zone reclaim on boot. 61 * and zone_reclaim_mode is enabled then the VM will only call zone_reclaim()
62 * on nodes within this distance.
62 */ 63 */
63#define RECLAIM_DISTANCE 30 64#define RECLAIM_DISTANCE 30
64#endif 65#endif
@@ -66,121 +67,6 @@ int arch_update_cpu_topology(void);
66#define PENALTY_FOR_NODE_WITH_CPUS (1) 67#define PENALTY_FOR_NODE_WITH_CPUS (1)
67#endif 68#endif
68 69
69/*
70 * Below are the 3 major initializers used in building sched_domains:
71 * SD_SIBLING_INIT, for SMT domains
72 * SD_CPU_INIT, for SMP domains
73 *
74 * Any architecture that cares to do any tuning to these values should do so
75 * by defining their own arch-specific initializer in include/asm/topology.h.
76 * A definition there will automagically override these default initializers
77 * and allow arch-specific performance tuning of sched_domains.
78 * (Only non-zero and non-null fields need be specified.)
79 */
80
81#ifdef CONFIG_SCHED_SMT
82/* MCD - Do we really need this? It is always on if CONFIG_SCHED_SMT is,
83 * so can't we drop this in favor of CONFIG_SCHED_SMT?
84 */
85#define ARCH_HAS_SCHED_WAKE_IDLE
86/* Common values for SMT siblings */
87#ifndef SD_SIBLING_INIT
88#define SD_SIBLING_INIT (struct sched_domain) { \
89 .min_interval = 1, \
90 .max_interval = 2, \
91 .busy_factor = 64, \
92 .imbalance_pct = 110, \
93 \
94 .flags = 1*SD_LOAD_BALANCE \
95 | 1*SD_BALANCE_NEWIDLE \
96 | 1*SD_BALANCE_EXEC \
97 | 1*SD_BALANCE_FORK \
98 | 0*SD_BALANCE_WAKE \
99 | 1*SD_WAKE_AFFINE \
100 | 1*SD_SHARE_CPUPOWER \
101 | 1*SD_SHARE_PKG_RESOURCES \
102 | 0*SD_SERIALIZE \
103 | 0*SD_PREFER_SIBLING \
104 | arch_sd_sibling_asym_packing() \
105 , \
106 .last_balance = jiffies, \
107 .balance_interval = 1, \
108 .smt_gain = 1178, /* 15% */ \
109 .max_newidle_lb_cost = 0, \
110 .next_decay_max_lb_cost = jiffies, \
111}
112#endif
113#endif /* CONFIG_SCHED_SMT */
114
115#ifdef CONFIG_SCHED_MC
116/* Common values for MC siblings. for now mostly derived from SD_CPU_INIT */
117#ifndef SD_MC_INIT
118#define SD_MC_INIT (struct sched_domain) { \
119 .min_interval = 1, \
120 .max_interval = 4, \
121 .busy_factor = 64, \
122 .imbalance_pct = 125, \
123 .cache_nice_tries = 1, \
124 .busy_idx = 2, \
125 .wake_idx = 0, \
126 .forkexec_idx = 0, \
127 \
128 .flags = 1*SD_LOAD_BALANCE \
129 | 1*SD_BALANCE_NEWIDLE \
130 | 1*SD_BALANCE_EXEC \
131 | 1*SD_BALANCE_FORK \
132 | 0*SD_BALANCE_WAKE \
133 | 1*SD_WAKE_AFFINE \
134 | 0*SD_SHARE_CPUPOWER \
135 | 1*SD_SHARE_PKG_RESOURCES \
136 | 0*SD_SERIALIZE \
137 , \
138 .last_balance = jiffies, \
139 .balance_interval = 1, \
140 .max_newidle_lb_cost = 0, \
141 .next_decay_max_lb_cost = jiffies, \
142}
143#endif
144#endif /* CONFIG_SCHED_MC */
145
146/* Common values for CPUs */
147#ifndef SD_CPU_INIT
148#define SD_CPU_INIT (struct sched_domain) { \
149 .min_interval = 1, \
150 .max_interval = 4, \
151 .busy_factor = 64, \
152 .imbalance_pct = 125, \
153 .cache_nice_tries = 1, \
154 .busy_idx = 2, \
155 .idle_idx = 1, \
156 .newidle_idx = 0, \
157 .wake_idx = 0, \
158 .forkexec_idx = 0, \
159 \
160 .flags = 1*SD_LOAD_BALANCE \
161 | 1*SD_BALANCE_NEWIDLE \
162 | 1*SD_BALANCE_EXEC \
163 | 1*SD_BALANCE_FORK \
164 | 0*SD_BALANCE_WAKE \
165 | 1*SD_WAKE_AFFINE \
166 | 0*SD_SHARE_CPUPOWER \
167 | 0*SD_SHARE_PKG_RESOURCES \
168 | 0*SD_SERIALIZE \
169 | 1*SD_PREFER_SIBLING \
170 , \
171 .last_balance = jiffies, \
172 .balance_interval = 1, \
173 .max_newidle_lb_cost = 0, \
174 .next_decay_max_lb_cost = jiffies, \
175}
176#endif
177
178#ifdef CONFIG_SCHED_BOOK
179#ifndef SD_BOOK_INIT
180#error Please define an appropriate SD_BOOK_INIT in include/asm/topology.h!!!
181#endif
182#endif /* CONFIG_SCHED_BOOK */
183
184#ifdef CONFIG_USE_PERCPU_NUMA_NODE_ID 70#ifdef CONFIG_USE_PERCPU_NUMA_NODE_ID
185DECLARE_PER_CPU(int, numa_node); 71DECLARE_PER_CPU(int, numa_node);
186 72
@@ -295,4 +181,17 @@ static inline int cpu_to_mem(int cpu)
295#define topology_core_cpumask(cpu) cpumask_of(cpu) 181#define topology_core_cpumask(cpu) cpumask_of(cpu)
296#endif 182#endif
297 183
184#ifdef CONFIG_SCHED_SMT
185static inline const struct cpumask *cpu_smt_mask(int cpu)
186{
187 return topology_thread_cpumask(cpu);
188}
189#endif
190
191static inline const struct cpumask *cpu_cpu_mask(int cpu)
192{
193 return cpumask_of_node(cpu_to_node(cpu));
194}
195
196
298#endif /* _LINUX_TOPOLOGY_H */ 197#endif /* _LINUX_TOPOLOGY_H */
diff --git a/include/linux/torture.h b/include/linux/torture.h
index b2e2b468e511..5ca58fcbaf1b 100644
--- a/include/linux/torture.h
+++ b/include/linux/torture.h
@@ -49,12 +49,6 @@
49#define VERBOSE_TOROUT_ERRSTRING(s) \ 49#define VERBOSE_TOROUT_ERRSTRING(s) \
50 do { if (verbose) pr_alert("%s" TORTURE_FLAG "!!! %s\n", torture_type, s); } while (0) 50 do { if (verbose) pr_alert("%s" TORTURE_FLAG "!!! %s\n", torture_type, s); } while (0)
51 51
52/* Definitions for a non-string torture-test module parameter. */
53#define torture_parm(type, name, init, msg) \
54 static type name = init; \
55 module_param(name, type, 0444); \
56 MODULE_PARM_DESC(name, msg);
57
58/* Definitions for online/offline exerciser. */ 52/* Definitions for online/offline exerciser. */
59int torture_onoff_init(long ooholdoff, long oointerval); 53int torture_onoff_init(long ooholdoff, long oointerval);
60char *torture_onoff_stats(char *page); 54char *torture_onoff_stats(char *page);
@@ -81,7 +75,7 @@ void stutter_wait(const char *title);
81int torture_stutter_init(int s); 75int torture_stutter_init(int s);
82 76
83/* Initialization and cleanup. */ 77/* Initialization and cleanup. */
84void torture_init_begin(char *ttype, bool v, int *runnable); 78bool torture_init_begin(char *ttype, bool v, int *runnable);
85void torture_init_end(void); 79void torture_init_end(void);
86bool torture_cleanup(void); 80bool torture_cleanup(void);
87bool torture_must_stop(void); 81bool torture_must_stop(void);
diff --git a/include/linux/tracehook.h b/include/linux/tracehook.h
index 1e98b5530425..6f8ab7da27c4 100644
--- a/include/linux/tracehook.h
+++ b/include/linux/tracehook.h
@@ -191,7 +191,7 @@ static inline void tracehook_notify_resume(struct pt_regs *regs)
191 * pairs with task_work_add()->set_notify_resume() after 191 * pairs with task_work_add()->set_notify_resume() after
192 * hlist_add_head(task->task_works); 192 * hlist_add_head(task->task_works);
193 */ 193 */
194 smp_mb__after_clear_bit(); 194 smp_mb__after_atomic();
195 if (unlikely(current->task_works)) 195 if (unlikely(current->task_works))
196 task_work_run(); 196 task_work_run();
197} 197}
diff --git a/include/linux/tty_ldisc.h b/include/linux/tty_ldisc.h
index add26da2faeb..00c9d688d7b7 100644
--- a/include/linux/tty_ldisc.h
+++ b/include/linux/tty_ldisc.h
@@ -92,7 +92,10 @@
92 * This function is called by the low-level tty driver to signal 92 * This function is called by the low-level tty driver to signal
93 * that line discpline should try to send more characters to the 93 * that line discpline should try to send more characters to the
94 * low-level driver for transmission. If the line discpline does 94 * low-level driver for transmission. If the line discpline does
95 * not have any more data to send, it can just return. 95 * not have any more data to send, it can just return. If the line
96 * discipline does have some data to send, please arise a tasklet
97 * or workqueue to do the real data transfer. Do not send data in
98 * this hook, it may leads to a deadlock.
96 * 99 *
97 * int (*hangup)(struct tty_struct *) 100 * int (*hangup)(struct tty_struct *)
98 * 101 *
diff --git a/include/linux/types.h b/include/linux/types.h
index 4d118ba11349..a0bb7048687f 100644
--- a/include/linux/types.h
+++ b/include/linux/types.h
@@ -142,6 +142,7 @@ typedef unsigned long blkcnt_t;
142#define pgoff_t unsigned long 142#define pgoff_t unsigned long
143#endif 143#endif
144 144
145/* A dma_addr_t can hold any valid DMA or bus address for the platform */
145#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT 146#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
146typedef u64 dma_addr_t; 147typedef u64 dma_addr_t;
147#else 148#else
diff --git a/include/linux/uprobes.h b/include/linux/uprobes.h
index edff2b97b864..c52f827ba6ce 100644
--- a/include/linux/uprobes.h
+++ b/include/linux/uprobes.h
@@ -32,6 +32,7 @@ struct vm_area_struct;
32struct mm_struct; 32struct mm_struct;
33struct inode; 33struct inode;
34struct notifier_block; 34struct notifier_block;
35struct page;
35 36
36#define UPROBE_HANDLER_REMOVE 1 37#define UPROBE_HANDLER_REMOVE 1
37#define UPROBE_HANDLER_MASK 1 38#define UPROBE_HANDLER_MASK 1
@@ -127,6 +128,8 @@ extern int arch_uprobe_exception_notify(struct notifier_block *self, unsigned l
127extern void arch_uprobe_abort_xol(struct arch_uprobe *aup, struct pt_regs *regs); 128extern void arch_uprobe_abort_xol(struct arch_uprobe *aup, struct pt_regs *regs);
128extern unsigned long arch_uretprobe_hijack_return_addr(unsigned long trampoline_vaddr, struct pt_regs *regs); 129extern unsigned long arch_uretprobe_hijack_return_addr(unsigned long trampoline_vaddr, struct pt_regs *regs);
129extern bool __weak arch_uprobe_ignore(struct arch_uprobe *aup, struct pt_regs *regs); 130extern bool __weak arch_uprobe_ignore(struct arch_uprobe *aup, struct pt_regs *regs);
131extern void __weak arch_uprobe_copy_ixol(struct page *page, unsigned long vaddr,
132 void *src, unsigned long len);
130#else /* !CONFIG_UPROBES */ 133#else /* !CONFIG_UPROBES */
131struct uprobes_state { 134struct uprobes_state {
132}; 135};
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 6b7ec376fb4d..d2465bc0e73c 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -352,6 +352,8 @@ struct usb_bus {
352 struct usb_bus *hs_companion; /* Companion EHCI bus, if any */ 352 struct usb_bus *hs_companion; /* Companion EHCI bus, if any */
353 struct list_head bus_list; /* list of busses */ 353 struct list_head bus_list; /* list of busses */
354 354
355 struct mutex usb_address0_mutex; /* unaddressed device mutex */
356
355 int bandwidth_allocated; /* on this bus: how much of the time 357 int bandwidth_allocated; /* on this bus: how much of the time
356 * reserved for periodic (intr/iso) 358 * reserved for periodic (intr/iso)
357 * requests is used, on average? 359 * requests is used, on average?
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h
index d3ca3b53837c..7373203140e7 100644
--- a/include/linux/usb/composite.h
+++ b/include/linux/usb/composite.h
@@ -57,6 +57,61 @@
57struct usb_configuration; 57struct usb_configuration;
58 58
59/** 59/**
60 * struct usb_os_desc_ext_prop - describes one "Extended Property"
61 * @entry: used to keep a list of extended properties
62 * @type: Extended Property type
63 * @name_len: Extended Property unicode name length, including terminating '\0'
64 * @name: Extended Property name
65 * @data_len: Length of Extended Property blob (for unicode store double len)
66 * @data: Extended Property blob
67 * @item: Represents this Extended Property in configfs
68 */
69struct usb_os_desc_ext_prop {
70 struct list_head entry;
71 u8 type;
72 int name_len;
73 char *name;
74 int data_len;
75 char *data;
76 struct config_item item;
77};
78
79/**
80 * struct usb_os_desc - describes OS descriptors associated with one interface
81 * @ext_compat_id: 16 bytes of "Compatible ID" and "Subcompatible ID"
82 * @ext_prop: Extended Properties list
83 * @ext_prop_len: Total length of Extended Properties blobs
84 * @ext_prop_count: Number of Extended Properties
85 * @opts_mutex: Optional mutex protecting config data of a usb_function_instance
86 * @group: Represents OS descriptors associated with an interface in configfs
87 * @owner: Module associated with this OS descriptor
88 */
89struct usb_os_desc {
90 char *ext_compat_id;
91 struct list_head ext_prop;
92 int ext_prop_len;
93 int ext_prop_count;
94 struct mutex *opts_mutex;
95 struct config_group group;
96 struct module *owner;
97};
98
99/**
100 * struct usb_os_desc_table - describes OS descriptors associated with one
101 * interface of a usb_function
102 * @if_id: Interface id
103 * @os_desc: "Extended Compatibility ID" and "Extended Properties" of the
104 * interface
105 *
106 * Each interface can have at most one "Extended Compatibility ID" and a
107 * number of "Extended Properties".
108 */
109struct usb_os_desc_table {
110 int if_id;
111 struct usb_os_desc *os_desc;
112};
113
114/**
60 * struct usb_function - describes one function of a configuration 115 * struct usb_function - describes one function of a configuration
61 * @name: For diagnostics, identifies the function. 116 * @name: For diagnostics, identifies the function.
62 * @strings: tables of strings, keyed by identifiers assigned during bind() 117 * @strings: tables of strings, keyed by identifiers assigned during bind()
@@ -73,6 +128,10 @@ struct usb_configuration;
73 * be available at super speed. 128 * be available at super speed.
74 * @config: assigned when @usb_add_function() is called; this is the 129 * @config: assigned when @usb_add_function() is called; this is the
75 * configuration with which this function is associated. 130 * configuration with which this function is associated.
131 * @os_desc_table: Table of (interface id, os descriptors) pairs. The function
132 * can expose more than one interface. If an interface is a member of
133 * an IAD, only the first interface of IAD has its entry in the table.
134 * @os_desc_n: Number of entries in os_desc_table
76 * @bind: Before the gadget can register, all of its functions bind() to the 135 * @bind: Before the gadget can register, all of its functions bind() to the
77 * available resources including string and interface identifiers used 136 * available resources including string and interface identifiers used
78 * in interface or class descriptors; endpoints; I/O buffers; and so on. 137 * in interface or class descriptors; endpoints; I/O buffers; and so on.
@@ -129,6 +188,9 @@ struct usb_function {
129 188
130 struct usb_configuration *config; 189 struct usb_configuration *config;
131 190
191 struct usb_os_desc_table *os_desc_table;
192 unsigned os_desc_n;
193
132 /* REVISIT: bind() functions can be marked __init, which 194 /* REVISIT: bind() functions can be marked __init, which
133 * makes trouble for section mismatch analysis. See if 195 * makes trouble for section mismatch analysis. See if
134 * we can't restructure things to avoid mismatching. 196 * we can't restructure things to avoid mismatching.
@@ -327,6 +389,8 @@ extern void usb_composite_unregister(struct usb_composite_driver *driver);
327extern void usb_composite_setup_continue(struct usb_composite_dev *cdev); 389extern void usb_composite_setup_continue(struct usb_composite_dev *cdev);
328extern int composite_dev_prepare(struct usb_composite_driver *composite, 390extern int composite_dev_prepare(struct usb_composite_driver *composite,
329 struct usb_composite_dev *cdev); 391 struct usb_composite_dev *cdev);
392extern int composite_os_desc_req_prepare(struct usb_composite_dev *cdev,
393 struct usb_ep *ep0);
330void composite_dev_cleanup(struct usb_composite_dev *cdev); 394void composite_dev_cleanup(struct usb_composite_dev *cdev);
331 395
332static inline struct usb_composite_driver *to_cdriver( 396static inline struct usb_composite_driver *to_cdriver(
@@ -335,11 +399,19 @@ static inline struct usb_composite_driver *to_cdriver(
335 return container_of(gdrv, struct usb_composite_driver, gadget_driver); 399 return container_of(gdrv, struct usb_composite_driver, gadget_driver);
336} 400}
337 401
402#define OS_STRING_QW_SIGN_LEN 14
403#define OS_STRING_IDX 0xEE
404
338/** 405/**
339 * struct usb_composite_device - represents one composite usb gadget 406 * struct usb_composite_device - represents one composite usb gadget
340 * @gadget: read-only, abstracts the gadget's usb peripheral controller 407 * @gadget: read-only, abstracts the gadget's usb peripheral controller
341 * @req: used for control responses; buffer is pre-allocated 408 * @req: used for control responses; buffer is pre-allocated
409 * @os_desc_req: used for OS descriptors responses; buffer is pre-allocated
342 * @config: the currently active configuration 410 * @config: the currently active configuration
411 * @qw_sign: qwSignature part of the OS string
412 * @b_vendor_code: bMS_VendorCode part of the OS string
413 * @use_os_string: false by default, interested gadgets set it
414 * @os_desc_config: the configuration to be used with OS descriptors
343 * 415 *
344 * One of these devices is allocated and initialized before the 416 * One of these devices is allocated and initialized before the
345 * associated device driver's bind() is called. 417 * associated device driver's bind() is called.
@@ -369,9 +441,16 @@ static inline struct usb_composite_driver *to_cdriver(
369struct usb_composite_dev { 441struct usb_composite_dev {
370 struct usb_gadget *gadget; 442 struct usb_gadget *gadget;
371 struct usb_request *req; 443 struct usb_request *req;
444 struct usb_request *os_desc_req;
372 445
373 struct usb_configuration *config; 446 struct usb_configuration *config;
374 447
448 /* OS String is a custom (yet popular) extension to the USB standard. */
449 u8 qw_sign[OS_STRING_QW_SIGN_LEN];
450 u8 b_vendor_code;
451 struct usb_configuration *os_desc_config;
452 unsigned int use_os_string:1;
453
375 /* private: */ 454 /* private: */
376 /* internals */ 455 /* internals */
377 unsigned int suspended:1; 456 unsigned int suspended:1;
diff --git a/include/linux/usb/msm_hsusb.h b/include/linux/usb/msm_hsusb.h
index 32754835a39b..b0a39243295a 100644
--- a/include/linux/usb/msm_hsusb.h
+++ b/include/linux/usb/msm_hsusb.h
@@ -23,21 +23,6 @@
23#include <linux/clk.h> 23#include <linux/clk.h>
24 24
25/** 25/**
26 * Supported USB modes
27 *
28 * USB_PERIPHERAL Only peripheral mode is supported.
29 * USB_HOST Only host mode is supported.
30 * USB_OTG OTG mode is supported.
31 *
32 */
33enum usb_mode_type {
34 USB_NONE = 0,
35 USB_PERIPHERAL,
36 USB_HOST,
37 USB_OTG,
38};
39
40/**
41 * OTG control 26 * OTG control
42 * 27 *
43 * OTG_NO_CONTROL Id/VBUS notifications not required. Useful in host 28 * OTG_NO_CONTROL Id/VBUS notifications not required. Useful in host
@@ -115,27 +100,23 @@ enum usb_chg_type {
115/** 100/**
116 * struct msm_otg_platform_data - platform device data 101 * struct msm_otg_platform_data - platform device data
117 * for msm_otg driver. 102 * for msm_otg driver.
118 * @phy_init_seq: PHY configuration sequence. val, reg pairs 103 * @phy_init_seq: PHY configuration sequence values. Value of -1 is reserved as
119 * terminated by -1. 104 * "do not overwrite default vaule at this address".
105 * @phy_init_sz: PHY configuration sequence size.
120 * @vbus_power: VBUS power on/off routine. 106 * @vbus_power: VBUS power on/off routine.
121 * @power_budget: VBUS power budget in mA (0 will be treated as 500mA). 107 * @power_budget: VBUS power budget in mA (0 will be treated as 500mA).
122 * @mode: Supported mode (OTG/peripheral/host). 108 * @mode: Supported mode (OTG/peripheral/host).
123 * @otg_control: OTG switch controlled by user/Id pin 109 * @otg_control: OTG switch controlled by user/Id pin
124 * @default_mode: Default operational mode. Applicable only if
125 * OTG switch is controller by user.
126 * @pclk_src_name: pclk is derived from ebi1_usb_clk in case of 7x27 and 8k
127 * dfab_usb_hs_clk in case of 8660 and 8960.
128 */ 110 */
129struct msm_otg_platform_data { 111struct msm_otg_platform_data {
130 int *phy_init_seq; 112 int *phy_init_seq;
113 int phy_init_sz;
131 void (*vbus_power)(bool on); 114 void (*vbus_power)(bool on);
132 unsigned power_budget; 115 unsigned power_budget;
133 enum usb_mode_type mode; 116 enum usb_dr_mode mode;
134 enum otg_control_type otg_control; 117 enum otg_control_type otg_control;
135 enum usb_mode_type default_mode;
136 enum msm_usb_phy_type phy_type; 118 enum msm_usb_phy_type phy_type;
137 void (*setup_gpio)(enum usb_otg_state state); 119 void (*setup_gpio)(enum usb_otg_state state);
138 char *pclk_src_name;
139 int (*link_clk_reset)(struct clk *link_clk, bool assert); 120 int (*link_clk_reset)(struct clk *link_clk, bool assert);
140 int (*phy_clk_reset)(struct clk *phy_clk); 121 int (*phy_clk_reset)(struct clk *phy_clk);
141}; 122};
@@ -147,7 +128,6 @@ struct msm_otg_platform_data {
147 * @irq: IRQ number assigned for HSUSB controller. 128 * @irq: IRQ number assigned for HSUSB controller.
148 * @clk: clock struct of usb_hs_clk. 129 * @clk: clock struct of usb_hs_clk.
149 * @pclk: clock struct of usb_hs_pclk. 130 * @pclk: clock struct of usb_hs_pclk.
150 * @pclk_src: pclk source for voting.
151 * @phy_reset_clk: clock struct of usb_phy_clk. 131 * @phy_reset_clk: clock struct of usb_phy_clk.
152 * @core_clk: clock struct of usb_hs_core_clk. 132 * @core_clk: clock struct of usb_hs_core_clk.
153 * @regs: ioremapped register base address. 133 * @regs: ioremapped register base address.
@@ -168,7 +148,6 @@ struct msm_otg {
168 int irq; 148 int irq;
169 struct clk *clk; 149 struct clk *clk;
170 struct clk *pclk; 150 struct clk *pclk;
171 struct clk *pclk_src;
172 struct clk *phy_reset_clk; 151 struct clk *phy_reset_clk;
173 struct clk *core_clk; 152 struct clk *core_clk;
174 void __iomem *regs; 153 void __iomem *regs;
@@ -179,10 +158,18 @@ struct msm_otg {
179 atomic_t in_lpm; 158 atomic_t in_lpm;
180 int async_int; 159 int async_int;
181 unsigned cur_power; 160 unsigned cur_power;
161 int phy_number;
182 struct delayed_work chg_work; 162 struct delayed_work chg_work;
183 enum usb_chg_state chg_state; 163 enum usb_chg_state chg_state;
184 enum usb_chg_type chg_type; 164 enum usb_chg_type chg_type;
185 u8 dcd_retries; 165 u8 dcd_retries;
166 struct regulator *v3p3;
167 struct regulator *v1p8;
168 struct regulator *vddcx;
169
170 struct reset_control *phy_rst;
171 struct reset_control *link_rst;
172 int vdd_levels[3];
186}; 173};
187 174
188#endif 175#endif
diff --git a/include/linux/usb/msm_hsusb_hw.h b/include/linux/usb/msm_hsusb_hw.h
index 6e97a2d3d39f..a29f6030afb1 100644
--- a/include/linux/usb/msm_hsusb_hw.h
+++ b/include/linux/usb/msm_hsusb_hw.h
@@ -16,6 +16,9 @@
16#ifndef __LINUX_USB_GADGET_MSM72K_UDC_H__ 16#ifndef __LINUX_USB_GADGET_MSM72K_UDC_H__
17#define __LINUX_USB_GADGET_MSM72K_UDC_H__ 17#define __LINUX_USB_GADGET_MSM72K_UDC_H__
18 18
19/* USB phy selector - in TCSR address range */
20#define USB2_PHY_SEL 0xfd4ab000
21
19#define USB_AHBBURST (MSM_USB_BASE + 0x0090) 22#define USB_AHBBURST (MSM_USB_BASE + 0x0090)
20#define USB_AHBMODE (MSM_USB_BASE + 0x0098) 23#define USB_AHBMODE (MSM_USB_BASE + 0x0098)
21#define USB_CAPLENGTH (MSM_USB_BASE + 0x0100) /* 8 bit */ 24#define USB_CAPLENGTH (MSM_USB_BASE + 0x0100) /* 8 bit */
@@ -25,13 +28,15 @@
25#define USB_OTGSC (MSM_USB_BASE + 0x01A4) 28#define USB_OTGSC (MSM_USB_BASE + 0x01A4)
26#define USB_USBMODE (MSM_USB_BASE + 0x01A8) 29#define USB_USBMODE (MSM_USB_BASE + 0x01A8)
27#define USB_PHY_CTRL (MSM_USB_BASE + 0x0240) 30#define USB_PHY_CTRL (MSM_USB_BASE + 0x0240)
31#define USB_PHY_CTRL2 (MSM_USB_BASE + 0x0278)
28 32
29#define USBCMD_RESET 2 33#define USBCMD_RESET 2
30#define USB_USBINTR (MSM_USB_BASE + 0x0148) 34#define USB_USBINTR (MSM_USB_BASE + 0x0148)
31 35
32#define PORTSC_PHCD (1 << 23) /* phy suspend mode */ 36#define PORTSC_PHCD (1 << 23) /* phy suspend mode */
33#define PORTSC_PTS_MASK (3 << 30) 37#define PORTSC_PTS_MASK (3 << 30)
34#define PORTSC_PTS_ULPI (3 << 30) 38#define PORTSC_PTS_ULPI (2 << 30)
39#define PORTSC_PTS_SERIAL (3 << 30)
35 40
36#define USB_ULPI_VIEWPORT (MSM_USB_BASE + 0x0170) 41#define USB_ULPI_VIEWPORT (MSM_USB_BASE + 0x0170)
37#define ULPI_RUN (1 << 30) 42#define ULPI_RUN (1 << 30)
@@ -41,9 +46,14 @@
41#define ULPI_DATA(n) ((n) & 255) 46#define ULPI_DATA(n) ((n) & 255)
42#define ULPI_DATA_READ(n) (((n) >> 8) & 255) 47#define ULPI_DATA_READ(n) (((n) >> 8) & 255)
43 48
49/* synopsys 28nm phy registers */
50#define ULPI_PWR_CLK_MNG_REG 0x88
51#define OTG_COMP_DISABLE BIT(0)
52
44#define ASYNC_INTR_CTRL (1 << 29) /* Enable async interrupt */ 53#define ASYNC_INTR_CTRL (1 << 29) /* Enable async interrupt */
45#define ULPI_STP_CTRL (1 << 30) /* Block communication with PHY */ 54#define ULPI_STP_CTRL (1 << 30) /* Block communication with PHY */
46#define PHY_RETEN (1 << 1) /* PHY retention enable/disable */ 55#define PHY_RETEN (1 << 1) /* PHY retention enable/disable */
56#define PHY_POR_ASSERT (1 << 0) /* USB2 28nm PHY POR ASSERT */
47 57
48/* OTG definitions */ 58/* OTG definitions */
49#define OTGSC_INTSTS_MASK (0x7f << 16) 59#define OTGSC_INTSTS_MASK (0x7f << 16)
diff --git a/include/linux/usb/usb_phy_gen_xceiv.h b/include/linux/usb/usb_phy_generic.h
index cc8d818a83be..68adae83affc 100644
--- a/include/linux/usb/usb_phy_gen_xceiv.h
+++ b/include/linux/usb/usb_phy_generic.h
@@ -3,7 +3,7 @@
3 3
4#include <linux/usb/otg.h> 4#include <linux/usb/otg.h>
5 5
6struct usb_phy_gen_xceiv_platform_data { 6struct usb_phy_generic_platform_data {
7 enum usb_phy_type type; 7 enum usb_phy_type type;
8 unsigned long clk_rate; 8 unsigned long clk_rate;
9 9
@@ -13,16 +13,17 @@ struct usb_phy_gen_xceiv_platform_data {
13 int gpio_reset; 13 int gpio_reset;
14}; 14};
15 15
16#if defined(CONFIG_NOP_USB_XCEIV) || (defined(CONFIG_NOP_USB_XCEIV_MODULE) && defined(MODULE)) 16#if IS_ENABLED(CONFIG_NOP_USB_XCEIV)
17/* sometimes transceivers are accessed only through e.g. ULPI */ 17/* sometimes transceivers are accessed only through e.g. ULPI */
18extern void usb_nop_xceiv_register(void); 18extern struct platform_device *usb_phy_generic_register(void);
19extern void usb_nop_xceiv_unregister(void); 19extern void usb_phy_generic_unregister(struct platform_device *);
20#else 20#else
21static inline void usb_nop_xceiv_register(void) 21static inline struct platform_device *usb_phy_generic_register(void)
22{ 22{
23 return NULL;
23} 24}
24 25
25static inline void usb_nop_xceiv_unregister(void) 26static inline void usb_phy_generic_unregister(struct platform_device *pdev)
26{ 27{
27} 28}
28#endif 29#endif
diff --git a/include/linux/vexpress.h b/include/linux/vexpress.h
index 617c01b8f74a..a4c9547aae64 100644
--- a/include/linux/vexpress.h
+++ b/include/linux/vexpress.h
@@ -15,28 +15,15 @@
15#define _LINUX_VEXPRESS_H 15#define _LINUX_VEXPRESS_H
16 16
17#include <linux/device.h> 17#include <linux/device.h>
18#include <linux/platform_device.h>
18#include <linux/reboot.h> 19#include <linux/reboot.h>
20#include <linux/regmap.h>
19 21
20#define VEXPRESS_SITE_MB 0 22#define VEXPRESS_SITE_MB 0
21#define VEXPRESS_SITE_DB1 1 23#define VEXPRESS_SITE_DB1 1
22#define VEXPRESS_SITE_DB2 2 24#define VEXPRESS_SITE_DB2 2
23#define VEXPRESS_SITE_MASTER 0xf 25#define VEXPRESS_SITE_MASTER 0xf
24 26
25#define VEXPRESS_CONFIG_STATUS_DONE 0
26#define VEXPRESS_CONFIG_STATUS_WAIT 1
27
28#define VEXPRESS_GPIO_MMC_CARDIN 0
29#define VEXPRESS_GPIO_MMC_WPROT 1
30#define VEXPRESS_GPIO_FLASH_WPn 2
31#define VEXPRESS_GPIO_LED0 3
32#define VEXPRESS_GPIO_LED1 4
33#define VEXPRESS_GPIO_LED2 5
34#define VEXPRESS_GPIO_LED3 6
35#define VEXPRESS_GPIO_LED4 7
36#define VEXPRESS_GPIO_LED5 8
37#define VEXPRESS_GPIO_LED6 9
38#define VEXPRESS_GPIO_LED7 10
39
40#define VEXPRESS_RES_FUNC(_site, _func) \ 27#define VEXPRESS_RES_FUNC(_site, _func) \
41{ \ 28{ \
42 .start = (_site), \ 29 .start = (_site), \
@@ -44,84 +31,43 @@
44 .flags = IORESOURCE_BUS, \ 31 .flags = IORESOURCE_BUS, \
45} 32}
46 33
47/* Config bridge API */ 34/* Config infrastructure */
48 35
49/** 36void vexpress_config_set_master(u32 site);
50 * struct vexpress_config_bridge_info - description of the platform 37u32 vexpress_config_get_master(void);
51 * configuration infrastructure bridge.
52 *
53 * @name: Bridge name
54 *
55 * @func_get: Obtains pointer to a configuration function for a given
56 * device or a Device Tree node, to be used with @func_put
57 * and @func_exec. The node pointer should take precedence
58 * over device pointer when both are passed.
59 *
60 * @func_put: Tells the bridge that the function will not be used any
61 * more, so all allocated resources can be released.
62 *
63 * @func_exec: Executes a configuration function read or write operation.
64 * The offset selects a 32 bit word of the value accessed.
65 * Must return VEXPRESS_CONFIG_STATUS_DONE when operation
66 * is finished immediately, VEXPRESS_CONFIG_STATUS_WAIT when
67 * will be completed in some time or negative value in case
68 * of error.
69 */
70struct vexpress_config_bridge_info {
71 const char *name;
72 void *(*func_get)(struct device *dev, struct device_node *node);
73 void (*func_put)(void *func);
74 int (*func_exec)(void *func, int offset, bool write, u32 *data);
75};
76 38
77struct vexpress_config_bridge; 39void vexpress_config_lock(void *arg);
40void vexpress_config_unlock(void *arg);
78 41
79struct vexpress_config_bridge *vexpress_config_bridge_register( 42int vexpress_config_get_topo(struct device_node *node, u32 *site,
80 struct device_node *node, 43 u32 *position, u32 *dcc);
81 struct vexpress_config_bridge_info *info);
82void vexpress_config_bridge_unregister(struct vexpress_config_bridge *bridge);
83 44
84void vexpress_config_complete(struct vexpress_config_bridge *bridge, 45/* Config bridge API */
85 int status);
86 46
87/* Config function API */ 47struct vexpress_config_bridge_ops {
48 struct regmap * (*regmap_init)(struct device *dev, void *context);
49 void (*regmap_exit)(struct regmap *regmap, void *context);
50};
88 51
89struct vexpress_config_func; 52struct device *vexpress_config_bridge_register(struct device *parent,
53 struct vexpress_config_bridge_ops *ops, void *context);
90 54
91struct vexpress_config_func *__vexpress_config_func_get(struct device *dev, 55/* Config regmap API */
92 struct device_node *node);
93#define vexpress_config_func_get_by_dev(dev) \
94 __vexpress_config_func_get(dev, NULL)
95#define vexpress_config_func_get_by_node(node) \
96 __vexpress_config_func_get(NULL, node)
97void vexpress_config_func_put(struct vexpress_config_func *func);
98 56
99/* Both may sleep! */ 57struct regmap *devm_regmap_init_vexpress_config(struct device *dev);
100int vexpress_config_read(struct vexpress_config_func *func, int offset,
101 u32 *data);
102int vexpress_config_write(struct vexpress_config_func *func, int offset,
103 u32 data);
104 58
105/* Platform control */ 59/* Platform control */
106 60
61unsigned int vexpress_get_mci_cardin(struct device *dev);
107u32 vexpress_get_procid(int site); 62u32 vexpress_get_procid(int site);
108u32 vexpress_get_hbi(int site);
109void *vexpress_get_24mhz_clock_base(void); 63void *vexpress_get_24mhz_clock_base(void);
110void vexpress_flags_set(u32 data); 64void vexpress_flags_set(u32 data);
111 65
112#define vexpress_get_site_by_node(node) __vexpress_get_site(NULL, node)
113#define vexpress_get_site_by_dev(dev) __vexpress_get_site(dev, NULL)
114unsigned __vexpress_get_site(struct device *dev, struct device_node *node);
115
116void vexpress_sysreg_early_init(void __iomem *base); 66void vexpress_sysreg_early_init(void __iomem *base);
117void vexpress_sysreg_of_early_init(void); 67int vexpress_syscfg_device_register(struct platform_device *pdev);
118 68
119/* Clocks */ 69/* Clocks */
120 70
121struct clk *vexpress_osc_setup(struct device *dev);
122void vexpress_osc_of_setup(struct device_node *node);
123
124void vexpress_clk_init(void __iomem *sp810_base); 71void vexpress_clk_init(void __iomem *sp810_base);
125void vexpress_clk_of_init(void);
126 72
127#endif 73#endif
diff --git a/include/linux/vfio.h b/include/linux/vfio.h
index 81022a52bc34..8ec980b5e3af 100644
--- a/include/linux/vfio.h
+++ b/include/linux/vfio.h
@@ -86,9 +86,8 @@ extern void vfio_unregister_iommu_driver(
86 * from user space. This allows us to easily determine if the provided 86 * from user space. This allows us to easily determine if the provided
87 * structure is sized to include various fields. 87 * structure is sized to include various fields.
88 */ 88 */
89#define offsetofend(TYPE, MEMBER) ({ \ 89#define offsetofend(TYPE, MEMBER) \
90 TYPE tmp; \ 90 (offsetof(TYPE, MEMBER) + sizeof(((TYPE *)0)->MEMBER))
91 offsetof(TYPE, MEMBER) + sizeof(tmp.MEMBER); }) \
92 91
93/* 92/*
94 * External user API 93 * External user API
diff --git a/include/linux/vm_event_item.h b/include/linux/vm_event_item.h
index 486c3972c0be..ced92345c963 100644
--- a/include/linux/vm_event_item.h
+++ b/include/linux/vm_event_item.h
@@ -80,6 +80,10 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
80 NR_TLB_LOCAL_FLUSH_ALL, 80 NR_TLB_LOCAL_FLUSH_ALL,
81 NR_TLB_LOCAL_FLUSH_ONE, 81 NR_TLB_LOCAL_FLUSH_ONE,
82#endif /* CONFIG_DEBUG_TLBFLUSH */ 82#endif /* CONFIG_DEBUG_TLBFLUSH */
83#ifdef CONFIG_DEBUG_VM_VMACACHE
84 VMACACHE_FIND_CALLS,
85 VMACACHE_FIND_HITS,
86#endif
83 NR_VM_EVENT_ITEMS 87 NR_VM_EVENT_ITEMS
84}; 88};
85 89
diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h
index 45c9cd1daf7a..82e7db7f7100 100644
--- a/include/linux/vmstat.h
+++ b/include/linux/vmstat.h
@@ -95,6 +95,12 @@ static inline void vm_events_fold_cpu(int cpu)
95#define count_vm_tlb_events(x, y) do { (void)(y); } while (0) 95#define count_vm_tlb_events(x, y) do { (void)(y); } while (0)
96#endif 96#endif
97 97
98#ifdef CONFIG_DEBUG_VM_VMACACHE
99#define count_vm_vmacache_event(x) count_vm_event(x)
100#else
101#define count_vm_vmacache_event(x) do {} while (0)
102#endif
103
98#define __count_zone_vm_events(item, zone, delta) \ 104#define __count_zone_vm_events(item, zone, delta) \
99 __count_vm_events(item##_NORMAL - ZONE_NORMAL + \ 105 __count_vm_events(item##_NORMAL - ZONE_NORMAL + \
100 zone_idx(zone), delta) 106 zone_idx(zone), delta)
diff --git a/include/linux/zbud.h b/include/linux/zbud.h
index 2571a5cfa5fc..13af0d450bf6 100644
--- a/include/linux/zbud.h
+++ b/include/linux/zbud.h
@@ -11,7 +11,7 @@ struct zbud_ops {
11 11
12struct zbud_pool *zbud_create_pool(gfp_t gfp, struct zbud_ops *ops); 12struct zbud_pool *zbud_create_pool(gfp_t gfp, struct zbud_ops *ops);
13void zbud_destroy_pool(struct zbud_pool *pool); 13void zbud_destroy_pool(struct zbud_pool *pool);
14int zbud_alloc(struct zbud_pool *pool, int size, gfp_t gfp, 14int zbud_alloc(struct zbud_pool *pool, unsigned int size, gfp_t gfp,
15 unsigned long *handle); 15 unsigned long *handle);
16void zbud_free(struct zbud_pool *pool, unsigned long handle); 16void zbud_free(struct zbud_pool *pool, unsigned long handle);
17int zbud_reclaim_page(struct zbud_pool *pool, unsigned int retries); 17int zbud_reclaim_page(struct zbud_pool *pool, unsigned int retries);