diff options
138 files changed, 3137 insertions, 1824 deletions
diff --git a/Documentation/cgroups/memory.txt b/Documentation/cgroups/memory.txt index bac328c232f5..7781857dc940 100644 --- a/Documentation/cgroups/memory.txt +++ b/Documentation/cgroups/memory.txt | |||
@@ -385,10 +385,6 @@ mapped_file - # of bytes of mapped file (includes tmpfs/shmem) | |||
385 | pgpgin - # of pages paged in (equivalent to # of charging events). | 385 | pgpgin - # of pages paged in (equivalent to # of charging events). |
386 | pgpgout - # of pages paged out (equivalent to # of uncharging events). | 386 | pgpgout - # of pages paged out (equivalent to # of uncharging events). |
387 | swap - # of bytes of swap usage | 387 | swap - # of bytes of swap usage |
388 | dirty - # of bytes that are waiting to get written back to the disk. | ||
389 | writeback - # of bytes that are actively being written back to the disk. | ||
390 | nfs_unstable - # of bytes sent to the NFS server, but not yet committed to | ||
391 | the actual storage. | ||
392 | inactive_anon - # of bytes of anonymous memory and swap cache memory on | 388 | inactive_anon - # of bytes of anonymous memory and swap cache memory on |
393 | LRU list. | 389 | LRU list. |
394 | active_anon - # of bytes of anonymous and swap cache memory on active | 390 | active_anon - # of bytes of anonymous and swap cache memory on active |
@@ -410,9 +406,6 @@ total_mapped_file - sum of all children's "cache" | |||
410 | total_pgpgin - sum of all children's "pgpgin" | 406 | total_pgpgin - sum of all children's "pgpgin" |
411 | total_pgpgout - sum of all children's "pgpgout" | 407 | total_pgpgout - sum of all children's "pgpgout" |
412 | total_swap - sum of all children's "swap" | 408 | total_swap - sum of all children's "swap" |
413 | total_dirty - sum of all children's "dirty" | ||
414 | total_writeback - sum of all children's "writeback" | ||
415 | total_nfs_unstable - sum of all children's "nfs_unstable" | ||
416 | total_inactive_anon - sum of all children's "inactive_anon" | 409 | total_inactive_anon - sum of all children's "inactive_anon" |
417 | total_active_anon - sum of all children's "active_anon" | 410 | total_active_anon - sum of all children's "active_anon" |
418 | total_inactive_file - sum of all children's "inactive_file" | 411 | total_inactive_file - sum of all children's "inactive_file" |
@@ -460,73 +453,6 @@ memory under it will be reclaimed. | |||
460 | You can reset failcnt by writing 0 to failcnt file. | 453 | You can reset failcnt by writing 0 to failcnt file. |
461 | # echo 0 > .../memory.failcnt | 454 | # echo 0 > .../memory.failcnt |
462 | 455 | ||
463 | 5.5 dirty memory | ||
464 | |||
465 | Control the maximum amount of dirty pages a cgroup can have at any given time. | ||
466 | |||
467 | Limiting dirty memory is like fixing the max amount of dirty (hard to reclaim) | ||
468 | page cache used by a cgroup. So, in case of multiple cgroup writers, they will | ||
469 | not be able to consume more than their designated share of dirty pages and will | ||
470 | be forced to perform write-out if they cross that limit. | ||
471 | |||
472 | The interface is equivalent to the procfs interface: /proc/sys/vm/dirty_*. It | ||
473 | is possible to configure a limit to trigger both a direct writeback or a | ||
474 | background writeback performed by per-bdi flusher threads. The root cgroup | ||
475 | memory.dirty_* control files are read-only and match the contents of | ||
476 | the /proc/sys/vm/dirty_* files. | ||
477 | |||
478 | Per-cgroup dirty limits can be set using the following files in the cgroupfs: | ||
479 | |||
480 | - memory.dirty_ratio: the amount of dirty memory (expressed as a percentage of | ||
481 | cgroup memory) at which a process generating dirty pages will itself start | ||
482 | writing out dirty data. | ||
483 | |||
484 | - memory.dirty_limit_in_bytes: the amount of dirty memory (expressed in bytes) | ||
485 | in the cgroup at which a process generating dirty pages will start itself | ||
486 | writing out dirty data. Suffix (k, K, m, M, g, or G) can be used to indicate | ||
487 | that value is kilo, mega or gigabytes. | ||
488 | |||
489 | Note: memory.dirty_limit_in_bytes is the counterpart of memory.dirty_ratio. | ||
490 | Only one of them may be specified at a time. When one is written it is | ||
491 | immediately taken into account to evaluate the dirty memory limits and the | ||
492 | other appears as 0 when read. | ||
493 | |||
494 | - memory.dirty_background_ratio: the amount of dirty memory of the cgroup | ||
495 | (expressed as a percentage of cgroup memory) at which background writeback | ||
496 | kernel threads will start writing out dirty data. | ||
497 | |||
498 | - memory.dirty_background_limit_in_bytes: the amount of dirty memory (expressed | ||
499 | in bytes) in the cgroup at which background writeback kernel threads will | ||
500 | start writing out dirty data. Suffix (k, K, m, M, g, or G) can be used to | ||
501 | indicate that value is kilo, mega or gigabytes. | ||
502 | |||
503 | Note: memory.dirty_background_limit_in_bytes is the counterpart of | ||
504 | memory.dirty_background_ratio. Only one of them may be specified at a time. | ||
505 | When one is written it is immediately taken into account to evaluate the dirty | ||
506 | memory limits and the other appears as 0 when read. | ||
507 | |||
508 | A cgroup may contain more dirty memory than its dirty limit. This is possible | ||
509 | because of the principle that the first cgroup to touch a page is charged for | ||
510 | it. Subsequent page counting events (dirty, writeback, nfs_unstable) are also | ||
511 | counted to the originally charged cgroup. | ||
512 | |||
513 | Example: If page is allocated by a cgroup A task, then the page is charged to | ||
514 | cgroup A. If the page is later dirtied by a task in cgroup B, then the cgroup A | ||
515 | dirty count will be incremented. If cgroup A is over its dirty limit but cgroup | ||
516 | B is not, then dirtying a cgroup A page from a cgroup B task may push cgroup A | ||
517 | over its dirty limit without throttling the dirtying cgroup B task. | ||
518 | |||
519 | When use_hierarchy=0, each cgroup has dirty memory usage and limits. | ||
520 | System-wide dirty limits are also consulted. Dirty memory consumption is | ||
521 | checked against both system-wide and per-cgroup dirty limits. | ||
522 | |||
523 | The current implementation does not enforce per-cgroup dirty limits when | ||
524 | use_hierarchy=1. System-wide dirty limits are used for processes in such | ||
525 | cgroups. Attempts to read memory.dirty_* files return the system-wide | ||
526 | values. Writes to the memory.dirty_* files return error. An enhanced | ||
527 | implementation is needed to check the chain of parents to ensure that no | ||
528 | dirty limit is exceeded. | ||
529 | |||
530 | 6. Hierarchy support | 456 | 6. Hierarchy support |
531 | 457 | ||
532 | The memory controller supports a deep hierarchy and hierarchical accounting. | 458 | The memory controller supports a deep hierarchy and hierarchical accounting. |
diff --git a/MAINTAINERS b/MAINTAINERS index af656ded404e..89e4d4b145bb 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -5272,8 +5272,7 @@ S: Supported | |||
5272 | F: drivers/s390/net/ | 5272 | F: drivers/s390/net/ |
5273 | 5273 | ||
5274 | S390 ZCRYPT DRIVER | 5274 | S390 ZCRYPT DRIVER |
5275 | M: Felix Beck <felix.beck@de.ibm.com> | 5275 | M: Holger Dengler <hd@linux.vnet.ibm.com> |
5276 | M: Ralph Wuerthner <ralph.wuerthner@de.ibm.com> | ||
5277 | M: linux390@de.ibm.com | 5276 | M: linux390@de.ibm.com |
5278 | L: linux-s390@vger.kernel.org | 5277 | L: linux-s390@vger.kernel.org |
5279 | W: http://www.ibm.com/developerworks/linux/linux390/ | 5278 | W: http://www.ibm.com/developerworks/linux/linux390/ |
diff --git a/arch/s390/defconfig b/arch/s390/defconfig index d79697157ac0..29c82c640a88 100644 --- a/arch/s390/defconfig +++ b/arch/s390/defconfig | |||
@@ -5,10 +5,21 @@ CONFIG_AUDIT=y | |||
5 | CONFIG_RCU_TRACE=y | 5 | CONFIG_RCU_TRACE=y |
6 | CONFIG_IKCONFIG=y | 6 | CONFIG_IKCONFIG=y |
7 | CONFIG_IKCONFIG_PROC=y | 7 | CONFIG_IKCONFIG_PROC=y |
8 | CONFIG_CGROUPS=y | ||
9 | CONFIG_CPUSETS=y | ||
10 | CONFIG_CGROUP_CPUACCT=y | ||
11 | CONFIG_RESOURCE_COUNTERS=y | ||
12 | CONFIG_CGROUP_MEM_RES_CTLR=y | ||
13 | CONFIG_CGROUP_MEM_RES_CTLR_SWAP=y | ||
14 | CONFIG_CGROUP_SCHED=y | ||
15 | CONFIG_RT_GROUP_SCHED=y | ||
16 | CONFIG_BLK_CGROUP=y | ||
8 | CONFIG_BLK_DEV_INITRD=y | 17 | CONFIG_BLK_DEV_INITRD=y |
9 | # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set | 18 | # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set |
10 | CONFIG_PERF_EVENTS=y | 19 | # CONFIG_COMPAT_BRK is not set |
11 | CONFIG_SLAB=y | 20 | CONFIG_SLAB=y |
21 | CONFIG_PROFILING=y | ||
22 | CONFIG_OPROFILE=y | ||
12 | CONFIG_KPROBES=y | 23 | CONFIG_KPROBES=y |
13 | CONFIG_MODULES=y | 24 | CONFIG_MODULES=y |
14 | CONFIG_MODULE_UNLOAD=y | 25 | CONFIG_MODULE_UNLOAD=y |
@@ -19,7 +30,9 @@ CONFIG_HIGH_RES_TIMERS=y | |||
19 | CONFIG_PREEMPT=y | 30 | CONFIG_PREEMPT=y |
20 | CONFIG_MEMORY_HOTPLUG=y | 31 | CONFIG_MEMORY_HOTPLUG=y |
21 | CONFIG_MEMORY_HOTREMOVE=y | 32 | CONFIG_MEMORY_HOTREMOVE=y |
33 | CONFIG_KSM=y | ||
22 | CONFIG_BINFMT_MISC=m | 34 | CONFIG_BINFMT_MISC=m |
35 | CONFIG_CMM=m | ||
23 | CONFIG_HZ_100=y | 36 | CONFIG_HZ_100=y |
24 | CONFIG_KEXEC=y | 37 | CONFIG_KEXEC=y |
25 | CONFIG_PM=y | 38 | CONFIG_PM=y |
@@ -105,6 +118,7 @@ CONFIG_DEBUG_LIST=y | |||
105 | CONFIG_DEBUG_NOTIFIERS=y | 118 | CONFIG_DEBUG_NOTIFIERS=y |
106 | # CONFIG_RCU_CPU_STALL_DETECTOR is not set | 119 | # CONFIG_RCU_CPU_STALL_DETECTOR is not set |
107 | CONFIG_KPROBES_SANITY_TEST=y | 120 | CONFIG_KPROBES_SANITY_TEST=y |
121 | CONFIG_DEBUG_FORCE_WEAK_PER_CPU=y | ||
108 | CONFIG_CPU_NOTIFIER_ERROR_INJECT=m | 122 | CONFIG_CPU_NOTIFIER_ERROR_INJECT=m |
109 | CONFIG_LATENCYTOP=y | 123 | CONFIG_LATENCYTOP=y |
110 | CONFIG_SYSCTL_SYSCALL_CHECK=y | 124 | CONFIG_SYSCTL_SYSCALL_CHECK=y |
diff --git a/arch/s390/include/asm/compat.h b/arch/s390/include/asm/compat.h index a875c2f542e1..da359ca6fe55 100644 --- a/arch/s390/include/asm/compat.h +++ b/arch/s390/include/asm/compat.h | |||
@@ -169,7 +169,7 @@ static inline compat_uptr_t ptr_to_compat(void __user *uptr) | |||
169 | 169 | ||
170 | static inline int is_compat_task(void) | 170 | static inline int is_compat_task(void) |
171 | { | 171 | { |
172 | return test_thread_flag(TIF_31BIT); | 172 | return is_32bit_task(); |
173 | } | 173 | } |
174 | 174 | ||
175 | #else | 175 | #else |
diff --git a/arch/s390/include/asm/elf.h b/arch/s390/include/asm/elf.h index 354d42616c7e..10c029cfcc7d 100644 --- a/arch/s390/include/asm/elf.h +++ b/arch/s390/include/asm/elf.h | |||
@@ -161,7 +161,9 @@ extern unsigned int vdso_enabled; | |||
161 | use of this is to invoke "./ld.so someprog" to test out a new version of | 161 | use of this is to invoke "./ld.so someprog" to test out a new version of |
162 | the loader. We need to make sure that it is out of the way of the program | 162 | the loader. We need to make sure that it is out of the way of the program |
163 | that it will "exec", and that there is sufficient room for the brk. */ | 163 | that it will "exec", and that there is sufficient room for the brk. */ |
164 | #define ELF_ET_DYN_BASE (STACK_TOP / 3 * 2) | 164 | |
165 | extern unsigned long randomize_et_dyn(unsigned long base); | ||
166 | #define ELF_ET_DYN_BASE (randomize_et_dyn(STACK_TOP / 3 * 2)) | ||
165 | 167 | ||
166 | /* This yields a mask that user programs can use to figure out what | 168 | /* This yields a mask that user programs can use to figure out what |
167 | instruction set this CPU supports. */ | 169 | instruction set this CPU supports. */ |
@@ -206,6 +208,8 @@ do { \ | |||
206 | current->mm->context.noexec == 0; \ | 208 | current->mm->context.noexec == 0; \ |
207 | }) | 209 | }) |
208 | 210 | ||
211 | #define STACK_RND_MASK 0x7ffUL | ||
212 | |||
209 | #define ARCH_DLINFO \ | 213 | #define ARCH_DLINFO \ |
210 | do { \ | 214 | do { \ |
211 | if (vdso_enabled) \ | 215 | if (vdso_enabled) \ |
@@ -218,4 +222,7 @@ struct linux_binprm; | |||
218 | #define ARCH_HAS_SETUP_ADDITIONAL_PAGES 1 | 222 | #define ARCH_HAS_SETUP_ADDITIONAL_PAGES 1 |
219 | int arch_setup_additional_pages(struct linux_binprm *, int); | 223 | int arch_setup_additional_pages(struct linux_binprm *, int); |
220 | 224 | ||
225 | extern unsigned long arch_randomize_brk(struct mm_struct *mm); | ||
226 | #define arch_randomize_brk arch_randomize_brk | ||
227 | |||
221 | #endif | 228 | #endif |
diff --git a/arch/s390/include/asm/system.h b/arch/s390/include/asm/system.h index 6710b0eac165..8f8d759f6a7b 100644 --- a/arch/s390/include/asm/system.h +++ b/arch/s390/include/asm/system.h | |||
@@ -449,7 +449,7 @@ extern void (*_machine_restart)(char *command); | |||
449 | extern void (*_machine_halt)(void); | 449 | extern void (*_machine_halt)(void); |
450 | extern void (*_machine_power_off)(void); | 450 | extern void (*_machine_power_off)(void); |
451 | 451 | ||
452 | #define arch_align_stack(x) (x) | 452 | extern unsigned long arch_align_stack(unsigned long sp); |
453 | 453 | ||
454 | static inline int tprot(unsigned long addr) | 454 | static inline int tprot(unsigned long addr) |
455 | { | 455 | { |
diff --git a/arch/s390/include/asm/thread_info.h b/arch/s390/include/asm/thread_info.h index ebc77091466f..ad1382f7932e 100644 --- a/arch/s390/include/asm/thread_info.h +++ b/arch/s390/include/asm/thread_info.h | |||
@@ -118,6 +118,12 @@ static inline struct thread_info *current_thread_info(void) | |||
118 | #define _TIF_SINGLE_STEP (1<<TIF_FREEZE) | 118 | #define _TIF_SINGLE_STEP (1<<TIF_FREEZE) |
119 | #define _TIF_FREEZE (1<<TIF_FREEZE) | 119 | #define _TIF_FREEZE (1<<TIF_FREEZE) |
120 | 120 | ||
121 | #ifdef CONFIG_64BIT | ||
122 | #define is_32bit_task() (test_thread_flag(TIF_31BIT)) | ||
123 | #else | ||
124 | #define is_32bit_task() (1) | ||
125 | #endif | ||
126 | |||
121 | #endif /* __KERNEL__ */ | 127 | #endif /* __KERNEL__ */ |
122 | 128 | ||
123 | #define PREEMPT_ACTIVE 0x4000000 | 129 | #define PREEMPT_ACTIVE 0x4000000 |
diff --git a/arch/s390/kernel/process.c b/arch/s390/kernel/process.c index 6ba42222b542..a895e69379f7 100644 --- a/arch/s390/kernel/process.c +++ b/arch/s390/kernel/process.c | |||
@@ -30,9 +30,11 @@ | |||
30 | #include <linux/tick.h> | 30 | #include <linux/tick.h> |
31 | #include <linux/elfcore.h> | 31 | #include <linux/elfcore.h> |
32 | #include <linux/kernel_stat.h> | 32 | #include <linux/kernel_stat.h> |
33 | #include <linux/personality.h> | ||
33 | #include <linux/syscalls.h> | 34 | #include <linux/syscalls.h> |
34 | #include <linux/compat.h> | 35 | #include <linux/compat.h> |
35 | #include <linux/kprobes.h> | 36 | #include <linux/kprobes.h> |
37 | #include <linux/random.h> | ||
36 | #include <asm/compat.h> | 38 | #include <asm/compat.h> |
37 | #include <asm/uaccess.h> | 39 | #include <asm/uaccess.h> |
38 | #include <asm/pgtable.h> | 40 | #include <asm/pgtable.h> |
@@ -332,3 +334,39 @@ unsigned long get_wchan(struct task_struct *p) | |||
332 | } | 334 | } |
333 | return 0; | 335 | return 0; |
334 | } | 336 | } |
337 | |||
338 | unsigned long arch_align_stack(unsigned long sp) | ||
339 | { | ||
340 | if (!(current->personality & ADDR_NO_RANDOMIZE) && randomize_va_space) | ||
341 | sp -= get_random_int() & ~PAGE_MASK; | ||
342 | return sp & ~0xf; | ||
343 | } | ||
344 | |||
345 | static inline unsigned long brk_rnd(void) | ||
346 | { | ||
347 | /* 8MB for 32bit, 1GB for 64bit */ | ||
348 | if (is_32bit_task()) | ||
349 | return (get_random_int() & 0x7ffUL) << PAGE_SHIFT; | ||
350 | else | ||
351 | return (get_random_int() & 0x3ffffUL) << PAGE_SHIFT; | ||
352 | } | ||
353 | |||
354 | unsigned long arch_randomize_brk(struct mm_struct *mm) | ||
355 | { | ||
356 | unsigned long ret = PAGE_ALIGN(mm->brk + brk_rnd()); | ||
357 | |||
358 | if (ret < mm->brk) | ||
359 | return mm->brk; | ||
360 | return ret; | ||
361 | } | ||
362 | |||
363 | unsigned long randomize_et_dyn(unsigned long base) | ||
364 | { | ||
365 | unsigned long ret = PAGE_ALIGN(base + brk_rnd()); | ||
366 | |||
367 | if (!(current->flags & PF_RANDOMIZE)) | ||
368 | return base; | ||
369 | if (ret < base) | ||
370 | return base; | ||
371 | return ret; | ||
372 | } | ||
diff --git a/arch/s390/kernel/vdso.c b/arch/s390/kernel/vdso.c index e3150dd2fe74..f438d74dedbd 100644 --- a/arch/s390/kernel/vdso.c +++ b/arch/s390/kernel/vdso.c | |||
@@ -203,7 +203,6 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp) | |||
203 | if (!uses_interp) | 203 | if (!uses_interp) |
204 | return 0; | 204 | return 0; |
205 | 205 | ||
206 | vdso_base = mm->mmap_base; | ||
207 | #ifdef CONFIG_64BIT | 206 | #ifdef CONFIG_64BIT |
208 | vdso_pagelist = vdso64_pagelist; | 207 | vdso_pagelist = vdso64_pagelist; |
209 | vdso_pages = vdso64_pages; | 208 | vdso_pages = vdso64_pages; |
@@ -233,8 +232,7 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp) | |||
233 | * fail and end up putting it elsewhere. | 232 | * fail and end up putting it elsewhere. |
234 | */ | 233 | */ |
235 | down_write(&mm->mmap_sem); | 234 | down_write(&mm->mmap_sem); |
236 | vdso_base = get_unmapped_area(NULL, vdso_base, | 235 | vdso_base = get_unmapped_area(NULL, 0, vdso_pages << PAGE_SHIFT, 0, 0); |
237 | vdso_pages << PAGE_SHIFT, 0, 0); | ||
238 | if (IS_ERR_VALUE(vdso_base)) { | 236 | if (IS_ERR_VALUE(vdso_base)) { |
239 | rc = vdso_base; | 237 | rc = vdso_base; |
240 | goto out_up; | 238 | goto out_up; |
diff --git a/arch/s390/mm/mmap.c b/arch/s390/mm/mmap.c index 869efbaed3ea..c9a9f7f18188 100644 --- a/arch/s390/mm/mmap.c +++ b/arch/s390/mm/mmap.c | |||
@@ -27,17 +27,44 @@ | |||
27 | #include <linux/personality.h> | 27 | #include <linux/personality.h> |
28 | #include <linux/mm.h> | 28 | #include <linux/mm.h> |
29 | #include <linux/module.h> | 29 | #include <linux/module.h> |
30 | #include <linux/random.h> | ||
30 | #include <asm/pgalloc.h> | 31 | #include <asm/pgalloc.h> |
31 | #include <asm/compat.h> | 32 | #include <asm/compat.h> |
32 | 33 | ||
34 | static unsigned long stack_maxrandom_size(void) | ||
35 | { | ||
36 | if (!(current->flags & PF_RANDOMIZE)) | ||
37 | return 0; | ||
38 | if (current->personality & ADDR_NO_RANDOMIZE) | ||
39 | return 0; | ||
40 | return STACK_RND_MASK << PAGE_SHIFT; | ||
41 | } | ||
42 | |||
33 | /* | 43 | /* |
34 | * Top of mmap area (just below the process stack). | 44 | * Top of mmap area (just below the process stack). |
35 | * | 45 | * |
36 | * Leave an at least ~128 MB hole. | 46 | * Leave at least a ~32 MB hole. |
37 | */ | 47 | */ |
38 | #define MIN_GAP (128*1024*1024) | 48 | #define MIN_GAP (32*1024*1024) |
39 | #define MAX_GAP (STACK_TOP/6*5) | 49 | #define MAX_GAP (STACK_TOP/6*5) |
40 | 50 | ||
51 | static inline int mmap_is_legacy(void) | ||
52 | { | ||
53 | if (current->personality & ADDR_COMPAT_LAYOUT) | ||
54 | return 1; | ||
55 | if (rlimit(RLIMIT_STACK) == RLIM_INFINITY) | ||
56 | return 1; | ||
57 | return sysctl_legacy_va_layout; | ||
58 | } | ||
59 | |||
60 | static unsigned long mmap_rnd(void) | ||
61 | { | ||
62 | if (!(current->flags & PF_RANDOMIZE)) | ||
63 | return 0; | ||
64 | /* 8MB randomization for mmap_base */ | ||
65 | return (get_random_int() & 0x7ffUL) << PAGE_SHIFT; | ||
66 | } | ||
67 | |||
41 | static inline unsigned long mmap_base(void) | 68 | static inline unsigned long mmap_base(void) |
42 | { | 69 | { |
43 | unsigned long gap = rlimit(RLIMIT_STACK); | 70 | unsigned long gap = rlimit(RLIMIT_STACK); |
@@ -46,22 +73,8 @@ static inline unsigned long mmap_base(void) | |||
46 | gap = MIN_GAP; | 73 | gap = MIN_GAP; |
47 | else if (gap > MAX_GAP) | 74 | else if (gap > MAX_GAP) |
48 | gap = MAX_GAP; | 75 | gap = MAX_GAP; |
49 | 76 | gap &= PAGE_MASK; | |
50 | return STACK_TOP - (gap & PAGE_MASK); | 77 | return STACK_TOP - stack_maxrandom_size() - mmap_rnd() - gap; |
51 | } | ||
52 | |||
53 | static inline int mmap_is_legacy(void) | ||
54 | { | ||
55 | #ifdef CONFIG_64BIT | ||
56 | /* | ||
57 | * Force standard allocation for 64 bit programs. | ||
58 | */ | ||
59 | if (!is_compat_task()) | ||
60 | return 1; | ||
61 | #endif | ||
62 | return sysctl_legacy_va_layout || | ||
63 | (current->personality & ADDR_COMPAT_LAYOUT) || | ||
64 | rlimit(RLIMIT_STACK) == RLIM_INFINITY; | ||
65 | } | 78 | } |
66 | 79 | ||
67 | #ifndef CONFIG_64BIT | 80 | #ifndef CONFIG_64BIT |
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 36ed2e2c896b..47ae4a751a59 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig | |||
@@ -1934,13 +1934,19 @@ config PCI_MMCONFIG | |||
1934 | depends on X86_64 && PCI && ACPI | 1934 | depends on X86_64 && PCI && ACPI |
1935 | 1935 | ||
1936 | config PCI_CNB20LE_QUIRK | 1936 | config PCI_CNB20LE_QUIRK |
1937 | bool "Read CNB20LE Host Bridge Windows" | 1937 | bool "Read CNB20LE Host Bridge Windows" if EMBEDDED |
1938 | depends on PCI | 1938 | default n |
1939 | depends on PCI && EXPERIMENTAL | ||
1939 | help | 1940 | help |
1940 | Read the PCI windows out of the CNB20LE host bridge. This allows | 1941 | Read the PCI windows out of the CNB20LE host bridge. This allows |
1941 | PCI hotplug to work on systems with the CNB20LE chipset which do | 1942 | PCI hotplug to work on systems with the CNB20LE chipset which do |
1942 | not have ACPI. | 1943 | not have ACPI. |
1943 | 1944 | ||
1945 | There's no public spec for this chipset, and this functionality | ||
1946 | is known to be incomplete. | ||
1947 | |||
1948 | You should say N unless you know you need this. | ||
1949 | |||
1944 | config DMAR | 1950 | config DMAR |
1945 | bool "Support for DMA Remapping Devices (EXPERIMENTAL)" | 1951 | bool "Support for DMA Remapping Devices (EXPERIMENTAL)" |
1946 | depends on PCI_MSI && ACPI && EXPERIMENTAL | 1952 | depends on PCI_MSI && ACPI && EXPERIMENTAL |
@@ -2068,7 +2074,7 @@ config OLPC | |||
2068 | 2074 | ||
2069 | config OLPC_XO1 | 2075 | config OLPC_XO1 |
2070 | tristate "OLPC XO-1 support" | 2076 | tristate "OLPC XO-1 support" |
2071 | depends on OLPC && PCI | 2077 | depends on OLPC && MFD_CS5535 |
2072 | ---help--- | 2078 | ---help--- |
2073 | Add support for non-essential features of the OLPC XO-1 laptop. | 2079 | Add support for non-essential features of the OLPC XO-1 laptop. |
2074 | 2080 | ||
diff --git a/arch/x86/pci/broadcom_bus.c b/arch/x86/pci/broadcom_bus.c index 0846a5bbbfbd..ab8269b0da29 100644 --- a/arch/x86/pci/broadcom_bus.c +++ b/arch/x86/pci/broadcom_bus.c | |||
@@ -9,6 +9,7 @@ | |||
9 | * option) any later version. | 9 | * option) any later version. |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <linux/acpi.h> | ||
12 | #include <linux/delay.h> | 13 | #include <linux/delay.h> |
13 | #include <linux/dmi.h> | 14 | #include <linux/dmi.h> |
14 | #include <linux/pci.h> | 15 | #include <linux/pci.h> |
@@ -25,12 +26,14 @@ static void __devinit cnb20le_res(struct pci_dev *dev) | |||
25 | u8 fbus, lbus; | 26 | u8 fbus, lbus; |
26 | int i; | 27 | int i; |
27 | 28 | ||
29 | #ifdef CONFIG_ACPI | ||
28 | /* | 30 | /* |
29 | * The x86_pci_root_bus_res_quirks() function already refuses to use | 31 | * We should get host bridge information from ACPI unless the BIOS |
30 | * this information if ACPI _CRS was used. Therefore, we don't bother | 32 | * doesn't support it. |
31 | * checking if ACPI is enabled, and just generate the information | ||
32 | * for both the ACPI _CRS and no ACPI cases. | ||
33 | */ | 33 | */ |
34 | if (acpi_os_get_root_pointer()) | ||
35 | return; | ||
36 | #endif | ||
34 | 37 | ||
35 | info = &pci_root_info[pci_root_num]; | 38 | info = &pci_root_info[pci_root_num]; |
36 | pci_root_num++; | 39 | pci_root_num++; |
diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c index f7c8a399978c..5fe75026ecc2 100644 --- a/arch/x86/pci/common.c +++ b/arch/x86/pci/common.c | |||
@@ -22,6 +22,7 @@ unsigned int pci_probe = PCI_PROBE_BIOS | PCI_PROBE_CONF1 | PCI_PROBE_CONF2 | | |||
22 | 22 | ||
23 | unsigned int pci_early_dump_regs; | 23 | unsigned int pci_early_dump_regs; |
24 | static int pci_bf_sort; | 24 | static int pci_bf_sort; |
25 | static int smbios_type_b1_flag; | ||
25 | int pci_routeirq; | 26 | int pci_routeirq; |
26 | int noioapicquirk; | 27 | int noioapicquirk; |
27 | #ifdef CONFIG_X86_REROUTE_FOR_BROKEN_BOOT_IRQS | 28 | #ifdef CONFIG_X86_REROUTE_FOR_BROKEN_BOOT_IRQS |
@@ -185,6 +186,39 @@ static int __devinit set_bf_sort(const struct dmi_system_id *d) | |||
185 | return 0; | 186 | return 0; |
186 | } | 187 | } |
187 | 188 | ||
189 | static void __devinit read_dmi_type_b1(const struct dmi_header *dm, | ||
190 | void *private_data) | ||
191 | { | ||
192 | u8 *d = (u8 *)dm + 4; | ||
193 | |||
194 | if (dm->type != 0xB1) | ||
195 | return; | ||
196 | switch (((*(u32 *)d) >> 9) & 0x03) { | ||
197 | case 0x00: | ||
198 | printk(KERN_INFO "dmi type 0xB1 record - unknown flag\n"); | ||
199 | break; | ||
200 | case 0x01: /* set pci=bfsort */ | ||
201 | smbios_type_b1_flag = 1; | ||
202 | break; | ||
203 | case 0x02: /* do not set pci=bfsort */ | ||
204 | smbios_type_b1_flag = 2; | ||
205 | break; | ||
206 | default: | ||
207 | break; | ||
208 | } | ||
209 | } | ||
210 | |||
211 | static int __devinit find_sort_method(const struct dmi_system_id *d) | ||
212 | { | ||
213 | dmi_walk(read_dmi_type_b1, NULL); | ||
214 | |||
215 | if (smbios_type_b1_flag == 1) { | ||
216 | set_bf_sort(d); | ||
217 | return 0; | ||
218 | } | ||
219 | return -1; | ||
220 | } | ||
221 | |||
188 | /* | 222 | /* |
189 | * Enable renumbering of PCI bus# ranges to reach all PCI busses (Cardbus) | 223 | * Enable renumbering of PCI bus# ranges to reach all PCI busses (Cardbus) |
190 | */ | 224 | */ |
@@ -213,6 +247,13 @@ static const struct dmi_system_id __devinitconst pciprobe_dmi_table[] = { | |||
213 | }, | 247 | }, |
214 | #endif /* __i386__ */ | 248 | #endif /* __i386__ */ |
215 | { | 249 | { |
250 | .callback = find_sort_method, | ||
251 | .ident = "Dell System", | ||
252 | .matches = { | ||
253 | DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc"), | ||
254 | }, | ||
255 | }, | ||
256 | { | ||
216 | .callback = set_bf_sort, | 257 | .callback = set_bf_sort, |
217 | .ident = "Dell PowerEdge 1950", | 258 | .ident = "Dell PowerEdge 1950", |
218 | .matches = { | 259 | .matches = { |
diff --git a/arch/x86/pci/irq.c b/arch/x86/pci/irq.c index 9f9bfb705cf9..87e6c8323117 100644 --- a/arch/x86/pci/irq.c +++ b/arch/x86/pci/irq.c | |||
@@ -589,7 +589,8 @@ static __init int intel_router_probe(struct irq_router *r, struct pci_dev *route | |||
589 | case PCI_DEVICE_ID_INTEL_ICH10_1: | 589 | case PCI_DEVICE_ID_INTEL_ICH10_1: |
590 | case PCI_DEVICE_ID_INTEL_ICH10_2: | 590 | case PCI_DEVICE_ID_INTEL_ICH10_2: |
591 | case PCI_DEVICE_ID_INTEL_ICH10_3: | 591 | case PCI_DEVICE_ID_INTEL_ICH10_3: |
592 | case PCI_DEVICE_ID_INTEL_PATSBURG_LPC: | 592 | case PCI_DEVICE_ID_INTEL_PATSBURG_LPC_0: |
593 | case PCI_DEVICE_ID_INTEL_PATSBURG_LPC_1: | ||
593 | r->name = "PIIX/ICH"; | 594 | r->name = "PIIX/ICH"; |
594 | r->get = pirq_piix_get; | 595 | r->get = pirq_piix_get; |
595 | r->set = pirq_piix_set; | 596 | r->set = pirq_piix_set; |
diff --git a/arch/x86/platform/olpc/olpc-xo1.c b/arch/x86/platform/olpc/olpc-xo1.c index f5442c03abc3..127775696d6c 100644 --- a/arch/x86/platform/olpc/olpc-xo1.c +++ b/arch/x86/platform/olpc/olpc-xo1.c | |||
@@ -1,6 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Support for features of the OLPC XO-1 laptop | 2 | * Support for features of the OLPC XO-1 laptop |
3 | * | 3 | * |
4 | * Copyright (C) 2010 Andres Salomon <dilinger@queued.net> | ||
4 | * Copyright (C) 2010 One Laptop per Child | 5 | * Copyright (C) 2010 One Laptop per Child |
5 | * Copyright (C) 2006 Red Hat, Inc. | 6 | * Copyright (C) 2006 Red Hat, Inc. |
6 | * Copyright (C) 2006 Advanced Micro Devices, Inc. | 7 | * Copyright (C) 2006 Advanced Micro Devices, Inc. |
@@ -12,8 +13,6 @@ | |||
12 | */ | 13 | */ |
13 | 14 | ||
14 | #include <linux/module.h> | 15 | #include <linux/module.h> |
15 | #include <linux/pci.h> | ||
16 | #include <linux/pci_ids.h> | ||
17 | #include <linux/platform_device.h> | 16 | #include <linux/platform_device.h> |
18 | #include <linux/pm.h> | 17 | #include <linux/pm.h> |
19 | 18 | ||
@@ -22,9 +21,6 @@ | |||
22 | 21 | ||
23 | #define DRV_NAME "olpc-xo1" | 22 | #define DRV_NAME "olpc-xo1" |
24 | 23 | ||
25 | #define PMS_BAR 4 | ||
26 | #define ACPI_BAR 5 | ||
27 | |||
28 | /* PMC registers (PMS block) */ | 24 | /* PMC registers (PMS block) */ |
29 | #define PM_SCLK 0x10 | 25 | #define PM_SCLK 0x10 |
30 | #define PM_IN_SLPCTL 0x20 | 26 | #define PM_IN_SLPCTL 0x20 |
@@ -57,65 +53,67 @@ static void xo1_power_off(void) | |||
57 | outl(0x00002000, acpi_base + PM1_CNT); | 53 | outl(0x00002000, acpi_base + PM1_CNT); |
58 | } | 54 | } |
59 | 55 | ||
60 | /* Read the base addresses from the PCI BAR info */ | 56 | static int __devinit olpc_xo1_probe(struct platform_device *pdev) |
61 | static int __devinit setup_bases(struct pci_dev *pdev) | ||
62 | { | 57 | { |
63 | int r; | 58 | struct resource *res; |
64 | 59 | ||
65 | r = pci_enable_device_io(pdev); | 60 | /* don't run on non-XOs */ |
66 | if (r) { | 61 | if (!machine_is_olpc()) |
67 | dev_err(&pdev->dev, "can't enable device IO\n"); | 62 | return -ENODEV; |
68 | return r; | ||
69 | } | ||
70 | 63 | ||
71 | r = pci_request_region(pdev, ACPI_BAR, DRV_NAME); | 64 | res = platform_get_resource(pdev, IORESOURCE_IO, 0); |
72 | if (r) { | 65 | if (!res) { |
73 | dev_err(&pdev->dev, "can't alloc PCI BAR #%d\n", ACPI_BAR); | 66 | dev_err(&pdev->dev, "can't fetch device resource info\n"); |
74 | return r; | 67 | return -EIO; |
75 | } | 68 | } |
76 | 69 | ||
77 | r = pci_request_region(pdev, PMS_BAR, DRV_NAME); | 70 | if (!request_region(res->start, resource_size(res), DRV_NAME)) { |
78 | if (r) { | 71 | dev_err(&pdev->dev, "can't request region\n"); |
79 | dev_err(&pdev->dev, "can't alloc PCI BAR #%d\n", PMS_BAR); | 72 | return -EIO; |
80 | pci_release_region(pdev, ACPI_BAR); | ||
81 | return r; | ||
82 | } | 73 | } |
83 | 74 | ||
84 | acpi_base = pci_resource_start(pdev, ACPI_BAR); | 75 | if (strcmp(pdev->name, "cs5535-pms") == 0) |
85 | pms_base = pci_resource_start(pdev, PMS_BAR); | 76 | pms_base = res->start; |
77 | else if (strcmp(pdev->name, "cs5535-acpi") == 0) | ||
78 | acpi_base = res->start; | ||
79 | |||
80 | /* If we have both addresses, we can override the poweroff hook */ | ||
81 | if (pms_base && acpi_base) { | ||
82 | pm_power_off = xo1_power_off; | ||
83 | printk(KERN_INFO "OLPC XO-1 support registered\n"); | ||
84 | } | ||
86 | 85 | ||
87 | return 0; | 86 | return 0; |
88 | } | 87 | } |
89 | 88 | ||
90 | static int __devinit olpc_xo1_probe(struct platform_device *pdev) | 89 | static int __devexit olpc_xo1_remove(struct platform_device *pdev) |
91 | { | 90 | { |
92 | struct pci_dev *pcidev; | 91 | struct resource *r; |
93 | int r; | ||
94 | |||
95 | pcidev = pci_get_device(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_CS5536_ISA, | ||
96 | NULL); | ||
97 | if (!pdev) | ||
98 | return -ENODEV; | ||
99 | |||
100 | r = setup_bases(pcidev); | ||
101 | if (r) | ||
102 | return r; | ||
103 | 92 | ||
104 | pm_power_off = xo1_power_off; | 93 | r = platform_get_resource(pdev, IORESOURCE_IO, 0); |
94 | release_region(r->start, resource_size(r)); | ||
105 | 95 | ||
106 | printk(KERN_INFO "OLPC XO-1 support registered\n"); | 96 | if (strcmp(pdev->name, "cs5535-pms") == 0) |
107 | return 0; | 97 | pms_base = 0; |
108 | } | 98 | else if (strcmp(pdev->name, "cs5535-acpi") == 0) |
99 | acpi_base = 0; | ||
109 | 100 | ||
110 | static int __devexit olpc_xo1_remove(struct platform_device *pdev) | ||
111 | { | ||
112 | pm_power_off = NULL; | 101 | pm_power_off = NULL; |
113 | return 0; | 102 | return 0; |
114 | } | 103 | } |
115 | 104 | ||
116 | static struct platform_driver olpc_xo1_driver = { | 105 | static struct platform_driver cs5535_pms_drv = { |
106 | .driver = { | ||
107 | .name = "cs5535-pms", | ||
108 | .owner = THIS_MODULE, | ||
109 | }, | ||
110 | .probe = olpc_xo1_probe, | ||
111 | .remove = __devexit_p(olpc_xo1_remove), | ||
112 | }; | ||
113 | |||
114 | static struct platform_driver cs5535_acpi_drv = { | ||
117 | .driver = { | 115 | .driver = { |
118 | .name = DRV_NAME, | 116 | .name = "cs5535-acpi", |
119 | .owner = THIS_MODULE, | 117 | .owner = THIS_MODULE, |
120 | }, | 118 | }, |
121 | .probe = olpc_xo1_probe, | 119 | .probe = olpc_xo1_probe, |
@@ -124,12 +122,23 @@ static struct platform_driver olpc_xo1_driver = { | |||
124 | 122 | ||
125 | static int __init olpc_xo1_init(void) | 123 | static int __init olpc_xo1_init(void) |
126 | { | 124 | { |
127 | return platform_driver_register(&olpc_xo1_driver); | 125 | int r; |
126 | |||
127 | r = platform_driver_register(&cs5535_pms_drv); | ||
128 | if (r) | ||
129 | return r; | ||
130 | |||
131 | r = platform_driver_register(&cs5535_acpi_drv); | ||
132 | if (r) | ||
133 | platform_driver_unregister(&cs5535_pms_drv); | ||
134 | |||
135 | return r; | ||
128 | } | 136 | } |
129 | 137 | ||
130 | static void __exit olpc_xo1_exit(void) | 138 | static void __exit olpc_xo1_exit(void) |
131 | { | 139 | { |
132 | platform_driver_unregister(&olpc_xo1_driver); | 140 | platform_driver_unregister(&cs5535_acpi_drv); |
141 | platform_driver_unregister(&cs5535_pms_drv); | ||
133 | } | 142 | } |
134 | 143 | ||
135 | MODULE_AUTHOR("Daniel Drake <dsd@laptop.org>"); | 144 | MODULE_AUTHOR("Daniel Drake <dsd@laptop.org>"); |
diff --git a/drivers/acpi/apei/hest.c b/drivers/acpi/apei/hest.c index daa7bc63f1d4..4ee58e72b730 100644 --- a/drivers/acpi/apei/hest.c +++ b/drivers/acpi/apei/hest.c | |||
@@ -195,24 +195,24 @@ static int __init setup_hest_disable(char *str) | |||
195 | 195 | ||
196 | __setup("hest_disable", setup_hest_disable); | 196 | __setup("hest_disable", setup_hest_disable); |
197 | 197 | ||
198 | static int __init hest_init(void) | 198 | void __init acpi_hest_init(void) |
199 | { | 199 | { |
200 | acpi_status status; | 200 | acpi_status status; |
201 | int rc = -ENODEV; | 201 | int rc = -ENODEV; |
202 | unsigned int ghes_count = 0; | 202 | unsigned int ghes_count = 0; |
203 | 203 | ||
204 | if (acpi_disabled) | 204 | if (acpi_disabled) |
205 | goto err; | 205 | return; |
206 | 206 | ||
207 | if (hest_disable) { | 207 | if (hest_disable) { |
208 | pr_info(HEST_PFX "HEST tabling parsing is disabled.\n"); | 208 | pr_info(HEST_PFX "Table parsing disabled.\n"); |
209 | goto err; | 209 | return; |
210 | } | 210 | } |
211 | 211 | ||
212 | status = acpi_get_table(ACPI_SIG_HEST, 0, | 212 | status = acpi_get_table(ACPI_SIG_HEST, 0, |
213 | (struct acpi_table_header **)&hest_tab); | 213 | (struct acpi_table_header **)&hest_tab); |
214 | if (status == AE_NOT_FOUND) { | 214 | if (status == AE_NOT_FOUND) { |
215 | pr_info(HEST_PFX "Table is not found!\n"); | 215 | pr_info(HEST_PFX "Table not found.\n"); |
216 | goto err; | 216 | goto err; |
217 | } else if (ACPI_FAILURE(status)) { | 217 | } else if (ACPI_FAILURE(status)) { |
218 | const char *msg = acpi_format_exception(status); | 218 | const char *msg = acpi_format_exception(status); |
@@ -226,15 +226,11 @@ static int __init hest_init(void) | |||
226 | goto err; | 226 | goto err; |
227 | 227 | ||
228 | rc = hest_ghes_dev_register(ghes_count); | 228 | rc = hest_ghes_dev_register(ghes_count); |
229 | if (rc) | 229 | if (!rc) { |
230 | goto err; | 230 | pr_info(HEST_PFX "Table parsing has been initialized.\n"); |
231 | 231 | return; | |
232 | pr_info(HEST_PFX "HEST table parsing is initialized.\n"); | 232 | } |
233 | 233 | ||
234 | return 0; | ||
235 | err: | 234 | err: |
236 | hest_disable = 1; | 235 | hest_disable = 1; |
237 | return rc; | ||
238 | } | 236 | } |
239 | |||
240 | subsys_initcall(hest_init); | ||
diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c index 96668ad09622..d9766797cd98 100644 --- a/drivers/acpi/pci_root.c +++ b/drivers/acpi/pci_root.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/slab.h> | 36 | #include <linux/slab.h> |
37 | #include <acpi/acpi_bus.h> | 37 | #include <acpi/acpi_bus.h> |
38 | #include <acpi/acpi_drivers.h> | 38 | #include <acpi/acpi_drivers.h> |
39 | #include <acpi/apei.h> | ||
39 | 40 | ||
40 | #define PREFIX "ACPI: " | 41 | #define PREFIX "ACPI: " |
41 | 42 | ||
@@ -47,6 +48,11 @@ static int acpi_pci_root_add(struct acpi_device *device); | |||
47 | static int acpi_pci_root_remove(struct acpi_device *device, int type); | 48 | static int acpi_pci_root_remove(struct acpi_device *device, int type); |
48 | static int acpi_pci_root_start(struct acpi_device *device); | 49 | static int acpi_pci_root_start(struct acpi_device *device); |
49 | 50 | ||
51 | #define ACPI_PCIE_REQ_SUPPORT (OSC_EXT_PCI_CONFIG_SUPPORT \ | ||
52 | | OSC_ACTIVE_STATE_PWR_SUPPORT \ | ||
53 | | OSC_CLOCK_PWR_CAPABILITY_SUPPORT \ | ||
54 | | OSC_MSI_SUPPORT) | ||
55 | |||
50 | static const struct acpi_device_id root_device_ids[] = { | 56 | static const struct acpi_device_id root_device_ids[] = { |
51 | {"PNP0A03", 0}, | 57 | {"PNP0A03", 0}, |
52 | {"", 0}, | 58 | {"", 0}, |
@@ -566,6 +572,33 @@ static int __devinit acpi_pci_root_add(struct acpi_device *device) | |||
566 | if (flags != base_flags) | 572 | if (flags != base_flags) |
567 | acpi_pci_osc_support(root, flags); | 573 | acpi_pci_osc_support(root, flags); |
568 | 574 | ||
575 | if (!pcie_ports_disabled | ||
576 | && (flags & ACPI_PCIE_REQ_SUPPORT) == ACPI_PCIE_REQ_SUPPORT) { | ||
577 | flags = OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL | ||
578 | | OSC_PCI_EXPRESS_NATIVE_HP_CONTROL | ||
579 | | OSC_PCI_EXPRESS_PME_CONTROL; | ||
580 | |||
581 | if (pci_aer_available()) { | ||
582 | if (aer_acpi_firmware_first()) | ||
583 | dev_dbg(root->bus->bridge, | ||
584 | "PCIe errors handled by BIOS.\n"); | ||
585 | else | ||
586 | flags |= OSC_PCI_EXPRESS_AER_CONTROL; | ||
587 | } | ||
588 | |||
589 | dev_info(root->bus->bridge, | ||
590 | "Requesting ACPI _OSC control (0x%02x)\n", flags); | ||
591 | |||
592 | status = acpi_pci_osc_control_set(device->handle, &flags, | ||
593 | OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL); | ||
594 | if (ACPI_SUCCESS(status)) | ||
595 | dev_info(root->bus->bridge, | ||
596 | "ACPI _OSC control (0x%02x) granted\n", flags); | ||
597 | else | ||
598 | dev_dbg(root->bus->bridge, | ||
599 | "ACPI _OSC request failed (code %d)\n", status); | ||
600 | } | ||
601 | |||
569 | pci_acpi_add_bus_pm_notifier(device, root->bus); | 602 | pci_acpi_add_bus_pm_notifier(device, root->bus); |
570 | if (device->wakeup.flags.run_wake) | 603 | if (device->wakeup.flags.run_wake) |
571 | device_set_run_wake(root->bus->bridge, true); | 604 | device_set_run_wake(root->bus->bridge, true); |
@@ -603,6 +636,8 @@ static int __init acpi_pci_root_init(void) | |||
603 | if (acpi_pci_disabled) | 636 | if (acpi_pci_disabled) |
604 | return 0; | 637 | return 0; |
605 | 638 | ||
639 | acpi_hest_init(); | ||
640 | |||
606 | pci_acpi_crs_quirks(); | 641 | pci_acpi_crs_quirks(); |
607 | if (acpi_bus_register_driver(&acpi_pci_root_driver) < 0) | 642 | if (acpi_bus_register_driver(&acpi_pci_root_driver) < 0) |
608 | return -ENODEV; | 643 | return -ENODEV; |
diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c index 07e9796fead7..857df10c0428 100644 --- a/drivers/char/agp/intel-agp.c +++ b/drivers/char/agp/intel-agp.c | |||
@@ -717,8 +717,8 @@ static const struct intel_agp_driver_description { | |||
717 | { PCI_DEVICE_ID_INTEL_82820_UP_HB, "i820", &intel_820_driver }, | 717 | { PCI_DEVICE_ID_INTEL_82820_UP_HB, "i820", &intel_820_driver }, |
718 | { PCI_DEVICE_ID_INTEL_82830_HB, "830M", &intel_830mp_driver }, | 718 | { PCI_DEVICE_ID_INTEL_82830_HB, "830M", &intel_830mp_driver }, |
719 | { PCI_DEVICE_ID_INTEL_82840_HB, "i840", &intel_840_driver }, | 719 | { PCI_DEVICE_ID_INTEL_82840_HB, "i840", &intel_840_driver }, |
720 | { PCI_DEVICE_ID_INTEL_82845_HB, "845G", &intel_845_driver }, | 720 | { PCI_DEVICE_ID_INTEL_82845_HB, "i845", &intel_845_driver }, |
721 | { PCI_DEVICE_ID_INTEL_82845G_HB, "830M", &intel_845_driver }, | 721 | { PCI_DEVICE_ID_INTEL_82845G_HB, "845G", &intel_845_driver }, |
722 | { PCI_DEVICE_ID_INTEL_82850_HB, "i850", &intel_850_driver }, | 722 | { PCI_DEVICE_ID_INTEL_82850_HB, "i850", &intel_850_driver }, |
723 | { PCI_DEVICE_ID_INTEL_82854_HB, "854", &intel_845_driver }, | 723 | { PCI_DEVICE_ID_INTEL_82854_HB, "854", &intel_845_driver }, |
724 | { PCI_DEVICE_ID_INTEL_82855PM_HB, "855PM", &intel_845_driver }, | 724 | { PCI_DEVICE_ID_INTEL_82855PM_HB, "855PM", &intel_845_driver }, |
diff --git a/drivers/char/agp/intel-gtt.c b/drivers/char/agp/intel-gtt.c index e921b693412b..826ab0939a12 100644 --- a/drivers/char/agp/intel-gtt.c +++ b/drivers/char/agp/intel-gtt.c | |||
@@ -1361,7 +1361,7 @@ static const struct intel_gtt_driver_description { | |||
1361 | &i81x_gtt_driver}, | 1361 | &i81x_gtt_driver}, |
1362 | { PCI_DEVICE_ID_INTEL_82830_CGC, "830M", | 1362 | { PCI_DEVICE_ID_INTEL_82830_CGC, "830M", |
1363 | &i8xx_gtt_driver}, | 1363 | &i8xx_gtt_driver}, |
1364 | { PCI_DEVICE_ID_INTEL_82845G_IG, "830M", | 1364 | { PCI_DEVICE_ID_INTEL_82845G_IG, "845G", |
1365 | &i8xx_gtt_driver}, | 1365 | &i8xx_gtt_driver}, |
1366 | { PCI_DEVICE_ID_INTEL_82854_IG, "854", | 1366 | { PCI_DEVICE_ID_INTEL_82854_IG, "854", |
1367 | &i8xx_gtt_driver}, | 1367 | &i8xx_gtt_driver}, |
diff --git a/drivers/gpio/cs5535-gpio.c b/drivers/gpio/cs5535-gpio.c index 815d98b2c1ba..0d05ea7d499b 100644 --- a/drivers/gpio/cs5535-gpio.c +++ b/drivers/gpio/cs5535-gpio.c | |||
@@ -11,14 +11,13 @@ | |||
11 | #include <linux/kernel.h> | 11 | #include <linux/kernel.h> |
12 | #include <linux/spinlock.h> | 12 | #include <linux/spinlock.h> |
13 | #include <linux/module.h> | 13 | #include <linux/module.h> |
14 | #include <linux/pci.h> | 14 | #include <linux/platform_device.h> |
15 | #include <linux/gpio.h> | 15 | #include <linux/gpio.h> |
16 | #include <linux/io.h> | 16 | #include <linux/io.h> |
17 | #include <linux/cs5535.h> | 17 | #include <linux/cs5535.h> |
18 | #include <asm/msr.h> | 18 | #include <asm/msr.h> |
19 | 19 | ||
20 | #define DRV_NAME "cs5535-gpio" | 20 | #define DRV_NAME "cs5535-gpio" |
21 | #define GPIO_BAR 1 | ||
22 | 21 | ||
23 | /* | 22 | /* |
24 | * Some GPIO pins | 23 | * Some GPIO pins |
@@ -47,7 +46,7 @@ static struct cs5535_gpio_chip { | |||
47 | struct gpio_chip chip; | 46 | struct gpio_chip chip; |
48 | resource_size_t base; | 47 | resource_size_t base; |
49 | 48 | ||
50 | struct pci_dev *pdev; | 49 | struct platform_device *pdev; |
51 | spinlock_t lock; | 50 | spinlock_t lock; |
52 | } cs5535_gpio_chip; | 51 | } cs5535_gpio_chip; |
53 | 52 | ||
@@ -301,10 +300,10 @@ static struct cs5535_gpio_chip cs5535_gpio_chip = { | |||
301 | }, | 300 | }, |
302 | }; | 301 | }; |
303 | 302 | ||
304 | static int __init cs5535_gpio_probe(struct pci_dev *pdev, | 303 | static int __devinit cs5535_gpio_probe(struct platform_device *pdev) |
305 | const struct pci_device_id *pci_id) | ||
306 | { | 304 | { |
307 | int err; | 305 | struct resource *res; |
306 | int err = -EIO; | ||
308 | ulong mask_orig = mask; | 307 | ulong mask_orig = mask; |
309 | 308 | ||
310 | /* There are two ways to get the GPIO base address; one is by | 309 | /* There are two ways to get the GPIO base address; one is by |
@@ -314,25 +313,23 @@ static int __init cs5535_gpio_probe(struct pci_dev *pdev, | |||
314 | * it turns out to be unreliable in the face of crappy BIOSes, we | 313 | * it turns out to be unreliable in the face of crappy BIOSes, we |
315 | * can always go back to using MSRs.. */ | 314 | * can always go back to using MSRs.. */ |
316 | 315 | ||
317 | err = pci_enable_device_io(pdev); | 316 | res = platform_get_resource(pdev, IORESOURCE_IO, 0); |
318 | if (err) { | 317 | if (!res) { |
319 | dev_err(&pdev->dev, "can't enable device IO\n"); | 318 | dev_err(&pdev->dev, "can't fetch device resource info\n"); |
320 | goto done; | 319 | goto done; |
321 | } | 320 | } |
322 | 321 | ||
323 | err = pci_request_region(pdev, GPIO_BAR, DRV_NAME); | 322 | if (!request_region(res->start, resource_size(res), pdev->name)) { |
324 | if (err) { | 323 | dev_err(&pdev->dev, "can't request region\n"); |
325 | dev_err(&pdev->dev, "can't alloc PCI BAR #%d\n", GPIO_BAR); | ||
326 | goto done; | 324 | goto done; |
327 | } | 325 | } |
328 | 326 | ||
329 | /* set up the driver-specific struct */ | 327 | /* set up the driver-specific struct */ |
330 | cs5535_gpio_chip.base = pci_resource_start(pdev, GPIO_BAR); | 328 | cs5535_gpio_chip.base = res->start; |
331 | cs5535_gpio_chip.pdev = pdev; | 329 | cs5535_gpio_chip.pdev = pdev; |
332 | spin_lock_init(&cs5535_gpio_chip.lock); | 330 | spin_lock_init(&cs5535_gpio_chip.lock); |
333 | 331 | ||
334 | dev_info(&pdev->dev, "allocated PCI BAR #%d: base 0x%llx\n", GPIO_BAR, | 332 | dev_info(&pdev->dev, "reserved resource region %pR\n", res); |
335 | (unsigned long long) cs5535_gpio_chip.base); | ||
336 | 333 | ||
337 | /* mask out reserved pins */ | 334 | /* mask out reserved pins */ |
338 | mask &= 0x1F7FFFFF; | 335 | mask &= 0x1F7FFFFF; |
@@ -350,78 +347,49 @@ static int __init cs5535_gpio_probe(struct pci_dev *pdev, | |||
350 | if (err) | 347 | if (err) |
351 | goto release_region; | 348 | goto release_region; |
352 | 349 | ||
353 | dev_info(&pdev->dev, DRV_NAME ": GPIO support successfully loaded.\n"); | 350 | dev_info(&pdev->dev, "GPIO support successfully loaded.\n"); |
354 | return 0; | 351 | return 0; |
355 | 352 | ||
356 | release_region: | 353 | release_region: |
357 | pci_release_region(pdev, GPIO_BAR); | 354 | release_region(res->start, resource_size(res)); |
358 | done: | 355 | done: |
359 | return err; | 356 | return err; |
360 | } | 357 | } |
361 | 358 | ||
362 | static void __exit cs5535_gpio_remove(struct pci_dev *pdev) | 359 | static int __devexit cs5535_gpio_remove(struct platform_device *pdev) |
363 | { | 360 | { |
361 | struct resource *r; | ||
364 | int err; | 362 | int err; |
365 | 363 | ||
366 | err = gpiochip_remove(&cs5535_gpio_chip.chip); | 364 | err = gpiochip_remove(&cs5535_gpio_chip.chip); |
367 | if (err) { | 365 | if (err) { |
368 | /* uhh? */ | 366 | /* uhh? */ |
369 | dev_err(&pdev->dev, "unable to remove gpio_chip?\n"); | 367 | dev_err(&pdev->dev, "unable to remove gpio_chip?\n"); |
368 | return err; | ||
370 | } | 369 | } |
371 | pci_release_region(pdev, GPIO_BAR); | ||
372 | } | ||
373 | |||
374 | static struct pci_device_id cs5535_gpio_pci_tbl[] = { | ||
375 | { PCI_DEVICE(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_CS5535_ISA) }, | ||
376 | { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_CS5536_ISA) }, | ||
377 | { 0, }, | ||
378 | }; | ||
379 | MODULE_DEVICE_TABLE(pci, cs5535_gpio_pci_tbl); | ||
380 | 370 | ||
381 | /* | 371 | r = platform_get_resource(pdev, IORESOURCE_IO, 0); |
382 | * We can't use the standard PCI driver registration stuff here, since | 372 | release_region(r->start, resource_size(r)); |
383 | * that allows only one driver to bind to each PCI device (and we want | 373 | return 0; |
384 | * multiple drivers to be able to bind to the device). Instead, manually | ||
385 | * scan for the PCI device, request a single region, and keep track of the | ||
386 | * devices that we're using. | ||
387 | */ | ||
388 | |||
389 | static int __init cs5535_gpio_scan_pci(void) | ||
390 | { | ||
391 | struct pci_dev *pdev; | ||
392 | int err = -ENODEV; | ||
393 | int i; | ||
394 | |||
395 | for (i = 0; i < ARRAY_SIZE(cs5535_gpio_pci_tbl); i++) { | ||
396 | pdev = pci_get_device(cs5535_gpio_pci_tbl[i].vendor, | ||
397 | cs5535_gpio_pci_tbl[i].device, NULL); | ||
398 | if (pdev) { | ||
399 | err = cs5535_gpio_probe(pdev, &cs5535_gpio_pci_tbl[i]); | ||
400 | if (err) | ||
401 | pci_dev_put(pdev); | ||
402 | |||
403 | /* we only support a single CS5535/6 southbridge */ | ||
404 | break; | ||
405 | } | ||
406 | } | ||
407 | |||
408 | return err; | ||
409 | } | 374 | } |
410 | 375 | ||
411 | static void __exit cs5535_gpio_free_pci(void) | 376 | static struct platform_driver cs5535_gpio_drv = { |
412 | { | 377 | .driver = { |
413 | cs5535_gpio_remove(cs5535_gpio_chip.pdev); | 378 | .name = DRV_NAME, |
414 | pci_dev_put(cs5535_gpio_chip.pdev); | 379 | .owner = THIS_MODULE, |
415 | } | 380 | }, |
381 | .probe = cs5535_gpio_probe, | ||
382 | .remove = __devexit_p(cs5535_gpio_remove), | ||
383 | }; | ||
416 | 384 | ||
417 | static int __init cs5535_gpio_init(void) | 385 | static int __init cs5535_gpio_init(void) |
418 | { | 386 | { |
419 | return cs5535_gpio_scan_pci(); | 387 | return platform_driver_register(&cs5535_gpio_drv); |
420 | } | 388 | } |
421 | 389 | ||
422 | static void __exit cs5535_gpio_exit(void) | 390 | static void __exit cs5535_gpio_exit(void) |
423 | { | 391 | { |
424 | cs5535_gpio_free_pci(); | 392 | platform_driver_unregister(&cs5535_gpio_drv); |
425 | } | 393 | } |
426 | 394 | ||
427 | module_init(cs5535_gpio_init); | 395 | module_init(cs5535_gpio_init); |
@@ -430,3 +398,4 @@ module_exit(cs5535_gpio_exit); | |||
430 | MODULE_AUTHOR("Andres Salomon <dilinger@queued.net>"); | 398 | MODULE_AUTHOR("Andres Salomon <dilinger@queued.net>"); |
431 | MODULE_DESCRIPTION("AMD CS5535/CS5536 GPIO driver"); | 399 | MODULE_DESCRIPTION("AMD CS5535/CS5536 GPIO driver"); |
432 | MODULE_LICENSE("GPL"); | 400 | MODULE_LICENSE("GPL"); |
401 | MODULE_ALIAS("platform:" DRV_NAME); | ||
diff --git a/drivers/gpio/timbgpio.c b/drivers/gpio/timbgpio.c index 349131eb1ce0..58c8f30352dd 100644 --- a/drivers/gpio/timbgpio.c +++ b/drivers/gpio/timbgpio.c | |||
@@ -193,13 +193,13 @@ out: | |||
193 | return ret; | 193 | return ret; |
194 | } | 194 | } |
195 | 195 | ||
196 | static void timbgpio_irq(struct irq_data *d, struct irq_desc *desc) | 196 | static void timbgpio_irq(unsigned int irq, struct irq_desc *desc) |
197 | { | 197 | { |
198 | struct timbgpio *tgpio = irq_data_get_irq_data(d); | 198 | struct timbgpio *tgpio = get_irq_data(irq); |
199 | unsigned long ipr; | 199 | unsigned long ipr; |
200 | int offset; | 200 | int offset; |
201 | 201 | ||
202 | desc->irq_data.chip->ack(irq_get_irq_data(d)); | 202 | desc->irq_data.chip->irq_ack(irq_get_irq_data(irq)); |
203 | ipr = ioread32(tgpio->membase + TGPIO_IPR); | 203 | ipr = ioread32(tgpio->membase + TGPIO_IPR); |
204 | iowrite32(ipr, tgpio->membase + TGPIO_ICR); | 204 | iowrite32(ipr, tgpio->membase + TGPIO_ICR); |
205 | 205 | ||
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index 19a3d58044dd..3601466c5502 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c | |||
@@ -703,7 +703,7 @@ static void print_error_buffers(struct seq_file *m, | |||
703 | seq_printf(m, "%s [%d]:\n", name, count); | 703 | seq_printf(m, "%s [%d]:\n", name, count); |
704 | 704 | ||
705 | while (count--) { | 705 | while (count--) { |
706 | seq_printf(m, " %08x %8zd %04x %04x %08x%s%s%s%s%s%s", | 706 | seq_printf(m, " %08x %8u %04x %04x %08x%s%s%s%s%s%s", |
707 | err->gtt_offset, | 707 | err->gtt_offset, |
708 | err->size, | 708 | err->size, |
709 | err->read_domains, | 709 | err->read_domains, |
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index 0de75a23f8e7..72fea2bcfc4f 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c | |||
@@ -49,6 +49,9 @@ module_param_named(powersave, i915_powersave, int, 0600); | |||
49 | unsigned int i915_lvds_downclock = 0; | 49 | unsigned int i915_lvds_downclock = 0; |
50 | module_param_named(lvds_downclock, i915_lvds_downclock, int, 0400); | 50 | module_param_named(lvds_downclock, i915_lvds_downclock, int, 0400); |
51 | 51 | ||
52 | unsigned int i915_panel_use_ssc = 1; | ||
53 | module_param_named(lvds_use_ssc, i915_panel_use_ssc, int, 0600); | ||
54 | |||
52 | bool i915_try_reset = true; | 55 | bool i915_try_reset = true; |
53 | module_param_named(reset, i915_try_reset, bool, 0600); | 56 | module_param_named(reset, i915_try_reset, bool, 0600); |
54 | 57 | ||
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 385fc7ec39d3..5969f46ac2d6 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h | |||
@@ -954,6 +954,7 @@ extern int i915_max_ioctl; | |||
954 | extern unsigned int i915_fbpercrtc; | 954 | extern unsigned int i915_fbpercrtc; |
955 | extern unsigned int i915_powersave; | 955 | extern unsigned int i915_powersave; |
956 | extern unsigned int i915_lvds_downclock; | 956 | extern unsigned int i915_lvds_downclock; |
957 | extern unsigned int i915_panel_use_ssc; | ||
957 | 958 | ||
958 | extern int i915_suspend(struct drm_device *dev, pm_message_t state); | 959 | extern int i915_suspend(struct drm_device *dev, pm_message_t state); |
959 | extern int i915_resume(struct drm_device *dev); | 960 | extern int i915_resume(struct drm_device *dev); |
diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c index e69834341ef0..dcfdf4151b6d 100644 --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c | |||
@@ -464,8 +464,6 @@ i915_gem_execbuffer_relocate(struct drm_device *dev, | |||
464 | int ret; | 464 | int ret; |
465 | 465 | ||
466 | list_for_each_entry(obj, objects, exec_list) { | 466 | list_for_each_entry(obj, objects, exec_list) { |
467 | obj->base.pending_read_domains = 0; | ||
468 | obj->base.pending_write_domain = 0; | ||
469 | ret = i915_gem_execbuffer_relocate_object(obj, eb); | 467 | ret = i915_gem_execbuffer_relocate_object(obj, eb); |
470 | if (ret) | 468 | if (ret) |
471 | return ret; | 469 | return ret; |
@@ -505,6 +503,9 @@ i915_gem_execbuffer_reserve(struct intel_ring_buffer *ring, | |||
505 | list_move(&obj->exec_list, &ordered_objects); | 503 | list_move(&obj->exec_list, &ordered_objects); |
506 | else | 504 | else |
507 | list_move_tail(&obj->exec_list, &ordered_objects); | 505 | list_move_tail(&obj->exec_list, &ordered_objects); |
506 | |||
507 | obj->base.pending_read_domains = 0; | ||
508 | obj->base.pending_write_domain = 0; | ||
508 | } | 509 | } |
509 | list_splice(&ordered_objects, objects); | 510 | list_splice(&ordered_objects, objects); |
510 | 511 | ||
@@ -636,6 +637,7 @@ i915_gem_execbuffer_relocate_slow(struct drm_device *dev, | |||
636 | { | 637 | { |
637 | struct drm_i915_gem_relocation_entry *reloc; | 638 | struct drm_i915_gem_relocation_entry *reloc; |
638 | struct drm_i915_gem_object *obj; | 639 | struct drm_i915_gem_object *obj; |
640 | int *reloc_offset; | ||
639 | int i, total, ret; | 641 | int i, total, ret; |
640 | 642 | ||
641 | /* We may process another execbuffer during the unlock... */ | 643 | /* We may process another execbuffer during the unlock... */ |
@@ -653,8 +655,11 @@ i915_gem_execbuffer_relocate_slow(struct drm_device *dev, | |||
653 | for (i = 0; i < count; i++) | 655 | for (i = 0; i < count; i++) |
654 | total += exec[i].relocation_count; | 656 | total += exec[i].relocation_count; |
655 | 657 | ||
658 | reloc_offset = drm_malloc_ab(count, sizeof(*reloc_offset)); | ||
656 | reloc = drm_malloc_ab(total, sizeof(*reloc)); | 659 | reloc = drm_malloc_ab(total, sizeof(*reloc)); |
657 | if (reloc == NULL) { | 660 | if (reloc == NULL || reloc_offset == NULL) { |
661 | drm_free_large(reloc); | ||
662 | drm_free_large(reloc_offset); | ||
658 | mutex_lock(&dev->struct_mutex); | 663 | mutex_lock(&dev->struct_mutex); |
659 | return -ENOMEM; | 664 | return -ENOMEM; |
660 | } | 665 | } |
@@ -672,6 +677,7 @@ i915_gem_execbuffer_relocate_slow(struct drm_device *dev, | |||
672 | goto err; | 677 | goto err; |
673 | } | 678 | } |
674 | 679 | ||
680 | reloc_offset[i] = total; | ||
675 | total += exec[i].relocation_count; | 681 | total += exec[i].relocation_count; |
676 | } | 682 | } |
677 | 683 | ||
@@ -705,17 +711,12 @@ i915_gem_execbuffer_relocate_slow(struct drm_device *dev, | |||
705 | if (ret) | 711 | if (ret) |
706 | goto err; | 712 | goto err; |
707 | 713 | ||
708 | total = 0; | ||
709 | list_for_each_entry(obj, objects, exec_list) { | 714 | list_for_each_entry(obj, objects, exec_list) { |
710 | obj->base.pending_read_domains = 0; | 715 | int offset = obj->exec_entry - exec; |
711 | obj->base.pending_write_domain = 0; | ||
712 | ret = i915_gem_execbuffer_relocate_object_slow(obj, eb, | 716 | ret = i915_gem_execbuffer_relocate_object_slow(obj, eb, |
713 | reloc + total); | 717 | reloc + reloc_offset[offset]); |
714 | if (ret) | 718 | if (ret) |
715 | goto err; | 719 | goto err; |
716 | |||
717 | total += exec->relocation_count; | ||
718 | exec++; | ||
719 | } | 720 | } |
720 | 721 | ||
721 | /* Leave the user relocations as are, this is the painfully slow path, | 722 | /* Leave the user relocations as are, this is the painfully slow path, |
@@ -726,6 +727,7 @@ i915_gem_execbuffer_relocate_slow(struct drm_device *dev, | |||
726 | 727 | ||
727 | err: | 728 | err: |
728 | drm_free_large(reloc); | 729 | drm_free_large(reloc); |
730 | drm_free_large(reloc_offset); | ||
729 | return ret; | 731 | return ret; |
730 | } | 732 | } |
731 | 733 | ||
@@ -770,7 +772,8 @@ i915_gem_execbuffer_sync_rings(struct drm_i915_gem_object *obj, | |||
770 | if (from == NULL || to == from) | 772 | if (from == NULL || to == from) |
771 | return 0; | 773 | return 0; |
772 | 774 | ||
773 | if (INTEL_INFO(obj->base.dev)->gen < 6) | 775 | /* XXX gpu semaphores are currently causing hard hangs on SNB mobile */ |
776 | if (INTEL_INFO(obj->base.dev)->gen < 6 || IS_MOBILE(obj->base.dev)) | ||
774 | return i915_gem_object_wait_rendering(obj, true); | 777 | return i915_gem_object_wait_rendering(obj, true); |
775 | 778 | ||
776 | idx = intel_ring_sync_index(from, to); | 779 | idx = intel_ring_sync_index(from, to); |
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c index e418e8bb61e6..b8e509ae065e 100644 --- a/drivers/gpu/drm/i915/i915_irq.c +++ b/drivers/gpu/drm/i915/i915_irq.c | |||
@@ -720,7 +720,7 @@ i915_error_first_batchbuffer(struct drm_i915_private *dev_priv, | |||
720 | if (obj->ring != ring) | 720 | if (obj->ring != ring) |
721 | continue; | 721 | continue; |
722 | 722 | ||
723 | if (!i915_seqno_passed(obj->last_rendering_seqno, seqno)) | 723 | if (i915_seqno_passed(seqno, obj->last_rendering_seqno)) |
724 | continue; | 724 | continue; |
725 | 725 | ||
726 | if ((obj->base.read_domains & I915_GEM_DOMAIN_COMMAND) == 0) | 726 | if ((obj->base.read_domains & I915_GEM_DOMAIN_COMMAND) == 0) |
diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c index b0b1200ed650..0b44956c336b 100644 --- a/drivers/gpu/drm/i915/intel_bios.c +++ b/drivers/gpu/drm/i915/intel_bios.c | |||
@@ -264,17 +264,12 @@ parse_general_features(struct drm_i915_private *dev_priv, | |||
264 | dev_priv->int_crt_support = general->int_crt_support; | 264 | dev_priv->int_crt_support = general->int_crt_support; |
265 | dev_priv->lvds_use_ssc = general->enable_ssc; | 265 | dev_priv->lvds_use_ssc = general->enable_ssc; |
266 | 266 | ||
267 | if (dev_priv->lvds_use_ssc) { | 267 | if (IS_I85X(dev)) |
268 | if (IS_I85X(dev)) | 268 | dev_priv->lvds_ssc_freq = general->ssc_freq ? 66 : 48; |
269 | dev_priv->lvds_ssc_freq = | 269 | else if (IS_GEN5(dev) || IS_GEN6(dev)) |
270 | general->ssc_freq ? 66 : 48; | 270 | dev_priv->lvds_ssc_freq = general->ssc_freq ? 100 : 120; |
271 | else if (IS_GEN5(dev) || IS_GEN6(dev)) | 271 | else |
272 | dev_priv->lvds_ssc_freq = | 272 | dev_priv->lvds_ssc_freq = general->ssc_freq ? 100 : 96; |
273 | general->ssc_freq ? 100 : 120; | ||
274 | else | ||
275 | dev_priv->lvds_ssc_freq = | ||
276 | general->ssc_freq ? 100 : 96; | ||
277 | } | ||
278 | } | 273 | } |
279 | } | 274 | } |
280 | 275 | ||
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 25d96889d7d2..98967f3b7724 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -3822,6 +3822,11 @@ static void intel_update_watermarks(struct drm_device *dev) | |||
3822 | sr_hdisplay, sr_htotal, pixel_size); | 3822 | sr_hdisplay, sr_htotal, pixel_size); |
3823 | } | 3823 | } |
3824 | 3824 | ||
3825 | static inline bool intel_panel_use_ssc(struct drm_i915_private *dev_priv) | ||
3826 | { | ||
3827 | return dev_priv->lvds_use_ssc && i915_panel_use_ssc; | ||
3828 | } | ||
3829 | |||
3825 | static int intel_crtc_mode_set(struct drm_crtc *crtc, | 3830 | static int intel_crtc_mode_set(struct drm_crtc *crtc, |
3826 | struct drm_display_mode *mode, | 3831 | struct drm_display_mode *mode, |
3827 | struct drm_display_mode *adjusted_mode, | 3832 | struct drm_display_mode *adjusted_mode, |
@@ -3884,7 +3889,7 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc, | |||
3884 | num_connectors++; | 3889 | num_connectors++; |
3885 | } | 3890 | } |
3886 | 3891 | ||
3887 | if (is_lvds && dev_priv->lvds_use_ssc && num_connectors < 2) { | 3892 | if (is_lvds && intel_panel_use_ssc(dev_priv) && num_connectors < 2) { |
3888 | refclk = dev_priv->lvds_ssc_freq * 1000; | 3893 | refclk = dev_priv->lvds_ssc_freq * 1000; |
3889 | DRM_DEBUG_KMS("using SSC reference clock of %d MHz\n", | 3894 | DRM_DEBUG_KMS("using SSC reference clock of %d MHz\n", |
3890 | refclk / 1000); | 3895 | refclk / 1000); |
@@ -4059,7 +4064,7 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc, | |||
4059 | udelay(200); | 4064 | udelay(200); |
4060 | 4065 | ||
4061 | if (has_edp_encoder) { | 4066 | if (has_edp_encoder) { |
4062 | if (dev_priv->lvds_use_ssc) { | 4067 | if (intel_panel_use_ssc(dev_priv)) { |
4063 | temp |= DREF_SSC1_ENABLE; | 4068 | temp |= DREF_SSC1_ENABLE; |
4064 | I915_WRITE(PCH_DREF_CONTROL, temp); | 4069 | I915_WRITE(PCH_DREF_CONTROL, temp); |
4065 | 4070 | ||
@@ -4070,13 +4075,13 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc, | |||
4070 | 4075 | ||
4071 | /* Enable CPU source on CPU attached eDP */ | 4076 | /* Enable CPU source on CPU attached eDP */ |
4072 | if (!intel_encoder_is_pch_edp(&has_edp_encoder->base)) { | 4077 | if (!intel_encoder_is_pch_edp(&has_edp_encoder->base)) { |
4073 | if (dev_priv->lvds_use_ssc) | 4078 | if (intel_panel_use_ssc(dev_priv)) |
4074 | temp |= DREF_CPU_SOURCE_OUTPUT_DOWNSPREAD; | 4079 | temp |= DREF_CPU_SOURCE_OUTPUT_DOWNSPREAD; |
4075 | else | 4080 | else |
4076 | temp |= DREF_CPU_SOURCE_OUTPUT_NONSPREAD; | 4081 | temp |= DREF_CPU_SOURCE_OUTPUT_NONSPREAD; |
4077 | } else { | 4082 | } else { |
4078 | /* Enable SSC on PCH eDP if needed */ | 4083 | /* Enable SSC on PCH eDP if needed */ |
4079 | if (dev_priv->lvds_use_ssc) { | 4084 | if (intel_panel_use_ssc(dev_priv)) { |
4080 | DRM_ERROR("enabling SSC on PCH\n"); | 4085 | DRM_ERROR("enabling SSC on PCH\n"); |
4081 | temp |= DREF_SUPERSPREAD_SOURCE_ENABLE; | 4086 | temp |= DREF_SUPERSPREAD_SOURCE_ENABLE; |
4082 | } | 4087 | } |
@@ -4104,7 +4109,7 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc, | |||
4104 | int factor = 21; | 4109 | int factor = 21; |
4105 | 4110 | ||
4106 | if (is_lvds) { | 4111 | if (is_lvds) { |
4107 | if ((dev_priv->lvds_use_ssc && | 4112 | if ((intel_panel_use_ssc(dev_priv) && |
4108 | dev_priv->lvds_ssc_freq == 100) || | 4113 | dev_priv->lvds_ssc_freq == 100) || |
4109 | (I915_READ(PCH_LVDS) & LVDS_CLKB_POWER_MASK) == LVDS_CLKB_POWER_UP) | 4114 | (I915_READ(PCH_LVDS) & LVDS_CLKB_POWER_MASK) == LVDS_CLKB_POWER_UP) |
4110 | factor = 25; | 4115 | factor = 25; |
@@ -4183,7 +4188,7 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc, | |||
4183 | /* XXX: just matching BIOS for now */ | 4188 | /* XXX: just matching BIOS for now */ |
4184 | /* dpll |= PLL_REF_INPUT_TVCLKINBC; */ | 4189 | /* dpll |= PLL_REF_INPUT_TVCLKINBC; */ |
4185 | dpll |= 3; | 4190 | dpll |= 3; |
4186 | else if (is_lvds && dev_priv->lvds_use_ssc && num_connectors < 2) | 4191 | else if (is_lvds && intel_panel_use_ssc(dev_priv) && num_connectors < 2) |
4187 | dpll |= PLLB_REF_INPUT_SPREADSPECTRUMIN; | 4192 | dpll |= PLLB_REF_INPUT_SPREADSPECTRUMIN; |
4188 | else | 4193 | else |
4189 | dpll |= PLL_REF_INPUT_DREFCLK; | 4194 | dpll |= PLL_REF_INPUT_DREFCLK; |
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c index 8f4f6bd33ee9..ace8d5d30dd2 100644 --- a/drivers/gpu/drm/i915/intel_lvds.c +++ b/drivers/gpu/drm/i915/intel_lvds.c | |||
@@ -704,6 +704,14 @@ static const struct dmi_system_id intel_no_lvds[] = { | |||
704 | }, | 704 | }, |
705 | { | 705 | { |
706 | .callback = intel_no_lvds_dmi_callback, | 706 | .callback = intel_no_lvds_dmi_callback, |
707 | .ident = "AOpen i915GMm-HFS", | ||
708 | .matches = { | ||
709 | DMI_MATCH(DMI_BOARD_VENDOR, "AOpen"), | ||
710 | DMI_MATCH(DMI_BOARD_NAME, "i915GMm-HFS"), | ||
711 | }, | ||
712 | }, | ||
713 | { | ||
714 | .callback = intel_no_lvds_dmi_callback, | ||
707 | .ident = "Aopen i945GTt-VFA", | 715 | .ident = "Aopen i945GTt-VFA", |
708 | .matches = { | 716 | .matches = { |
709 | DMI_MATCH(DMI_PRODUCT_VERSION, "AO00001JW"), | 717 | DMI_MATCH(DMI_PRODUCT_VERSION, "AO00001JW"), |
diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c index e00d200df3db..c65992df458d 100644 --- a/drivers/gpu/drm/i915/intel_panel.c +++ b/drivers/gpu/drm/i915/intel_panel.c | |||
@@ -278,6 +278,6 @@ void intel_panel_setup_backlight(struct drm_device *dev) | |||
278 | { | 278 | { |
279 | struct drm_i915_private *dev_priv = dev->dev_private; | 279 | struct drm_i915_private *dev_priv = dev->dev_private; |
280 | 280 | ||
281 | dev_priv->backlight_level = intel_panel_get_max_backlight(dev); | 281 | dev_priv->backlight_level = intel_panel_get_backlight(dev); |
282 | dev_priv->backlight_enabled = dev_priv->backlight_level != 0; | 282 | dev_priv->backlight_enabled = dev_priv->backlight_level != 0; |
283 | } | 283 | } |
diff --git a/drivers/i2c/busses/scx200_acb.c b/drivers/i2c/busses/scx200_acb.c index 53fab518b3da..986e5f62debe 100644 --- a/drivers/i2c/busses/scx200_acb.c +++ b/drivers/i2c/busses/scx200_acb.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/init.h> | 29 | #include <linux/init.h> |
30 | #include <linux/i2c.h> | 30 | #include <linux/i2c.h> |
31 | #include <linux/pci.h> | 31 | #include <linux/pci.h> |
32 | #include <linux/platform_device.h> | ||
32 | #include <linux/delay.h> | 33 | #include <linux/delay.h> |
33 | #include <linux/mutex.h> | 34 | #include <linux/mutex.h> |
34 | #include <linux/slab.h> | 35 | #include <linux/slab.h> |
@@ -40,6 +41,7 @@ | |||
40 | 41 | ||
41 | MODULE_AUTHOR("Christer Weinigel <wingel@nano-system.com>"); | 42 | MODULE_AUTHOR("Christer Weinigel <wingel@nano-system.com>"); |
42 | MODULE_DESCRIPTION("NatSemi SCx200 ACCESS.bus Driver"); | 43 | MODULE_DESCRIPTION("NatSemi SCx200 ACCESS.bus Driver"); |
44 | MODULE_ALIAS("platform:cs5535-smb"); | ||
43 | MODULE_LICENSE("GPL"); | 45 | MODULE_LICENSE("GPL"); |
44 | 46 | ||
45 | #define MAX_DEVICES 4 | 47 | #define MAX_DEVICES 4 |
@@ -84,10 +86,6 @@ struct scx200_acb_iface { | |||
84 | u8 *ptr; | 86 | u8 *ptr; |
85 | char needs_reset; | 87 | char needs_reset; |
86 | unsigned len; | 88 | unsigned len; |
87 | |||
88 | /* PCI device info */ | ||
89 | struct pci_dev *pdev; | ||
90 | int bar; | ||
91 | }; | 89 | }; |
92 | 90 | ||
93 | /* Register Definitions */ | 91 | /* Register Definitions */ |
@@ -391,7 +389,7 @@ static const struct i2c_algorithm scx200_acb_algorithm = { | |||
391 | static struct scx200_acb_iface *scx200_acb_list; | 389 | static struct scx200_acb_iface *scx200_acb_list; |
392 | static DEFINE_MUTEX(scx200_acb_list_mutex); | 390 | static DEFINE_MUTEX(scx200_acb_list_mutex); |
393 | 391 | ||
394 | static __init int scx200_acb_probe(struct scx200_acb_iface *iface) | 392 | static __devinit int scx200_acb_probe(struct scx200_acb_iface *iface) |
395 | { | 393 | { |
396 | u8 val; | 394 | u8 val; |
397 | 395 | ||
@@ -427,7 +425,7 @@ static __init int scx200_acb_probe(struct scx200_acb_iface *iface) | |||
427 | return 0; | 425 | return 0; |
428 | } | 426 | } |
429 | 427 | ||
430 | static __init struct scx200_acb_iface *scx200_create_iface(const char *text, | 428 | static __devinit struct scx200_acb_iface *scx200_create_iface(const char *text, |
431 | struct device *dev, int index) | 429 | struct device *dev, int index) |
432 | { | 430 | { |
433 | struct scx200_acb_iface *iface; | 431 | struct scx200_acb_iface *iface; |
@@ -452,7 +450,7 @@ static __init struct scx200_acb_iface *scx200_create_iface(const char *text, | |||
452 | return iface; | 450 | return iface; |
453 | } | 451 | } |
454 | 452 | ||
455 | static int __init scx200_acb_create(struct scx200_acb_iface *iface) | 453 | static int __devinit scx200_acb_create(struct scx200_acb_iface *iface) |
456 | { | 454 | { |
457 | struct i2c_adapter *adapter; | 455 | struct i2c_adapter *adapter; |
458 | int rc; | 456 | int rc; |
@@ -472,183 +470,145 @@ static int __init scx200_acb_create(struct scx200_acb_iface *iface) | |||
472 | return -ENODEV; | 470 | return -ENODEV; |
473 | } | 471 | } |
474 | 472 | ||
475 | mutex_lock(&scx200_acb_list_mutex); | 473 | if (!adapter->dev.parent) { |
476 | iface->next = scx200_acb_list; | 474 | /* If there's no dev, we're tracking (ISA) ifaces manually */ |
477 | scx200_acb_list = iface; | 475 | mutex_lock(&scx200_acb_list_mutex); |
478 | mutex_unlock(&scx200_acb_list_mutex); | 476 | iface->next = scx200_acb_list; |
477 | scx200_acb_list = iface; | ||
478 | mutex_unlock(&scx200_acb_list_mutex); | ||
479 | } | ||
479 | 480 | ||
480 | return 0; | 481 | return 0; |
481 | } | 482 | } |
482 | 483 | ||
483 | static __init int scx200_create_pci(const char *text, struct pci_dev *pdev, | 484 | static struct scx200_acb_iface * __devinit scx200_create_dev(const char *text, |
484 | int bar) | 485 | unsigned long base, int index, struct device *dev) |
485 | { | 486 | { |
486 | struct scx200_acb_iface *iface; | 487 | struct scx200_acb_iface *iface; |
487 | int rc; | 488 | int rc; |
488 | 489 | ||
489 | iface = scx200_create_iface(text, &pdev->dev, 0); | 490 | iface = scx200_create_iface(text, dev, index); |
490 | 491 | ||
491 | if (iface == NULL) | 492 | if (iface == NULL) |
492 | return -ENOMEM; | 493 | return NULL; |
493 | |||
494 | iface->pdev = pdev; | ||
495 | iface->bar = bar; | ||
496 | |||
497 | rc = pci_enable_device_io(iface->pdev); | ||
498 | if (rc) | ||
499 | goto errout_free; | ||
500 | 494 | ||
501 | rc = pci_request_region(iface->pdev, iface->bar, iface->adapter.name); | 495 | if (!request_region(base, 8, iface->adapter.name)) { |
502 | if (rc) { | 496 | printk(KERN_ERR NAME ": can't allocate io 0x%lx-0x%lx\n", |
503 | printk(KERN_ERR NAME ": can't allocate PCI BAR %d\n", | 497 | base, base + 8 - 1); |
504 | iface->bar); | ||
505 | goto errout_free; | 498 | goto errout_free; |
506 | } | 499 | } |
507 | 500 | ||
508 | iface->base = pci_resource_start(iface->pdev, iface->bar); | 501 | iface->base = base; |
509 | rc = scx200_acb_create(iface); | 502 | rc = scx200_acb_create(iface); |
510 | 503 | ||
511 | if (rc == 0) | 504 | if (rc == 0) |
512 | return 0; | 505 | return iface; |
513 | 506 | ||
514 | pci_release_region(iface->pdev, iface->bar); | 507 | release_region(base, 8); |
515 | pci_dev_put(iface->pdev); | ||
516 | errout_free: | 508 | errout_free: |
517 | kfree(iface); | 509 | kfree(iface); |
518 | return rc; | 510 | return NULL; |
519 | } | 511 | } |
520 | 512 | ||
521 | static int __init scx200_create_isa(const char *text, unsigned long base, | 513 | static int __devinit scx200_probe(struct platform_device *pdev) |
522 | int index) | ||
523 | { | 514 | { |
524 | struct scx200_acb_iface *iface; | 515 | struct scx200_acb_iface *iface; |
525 | int rc; | 516 | struct resource *res; |
526 | |||
527 | iface = scx200_create_iface(text, NULL, index); | ||
528 | |||
529 | if (iface == NULL) | ||
530 | return -ENOMEM; | ||
531 | 517 | ||
532 | if (!request_region(base, 8, iface->adapter.name)) { | 518 | res = platform_get_resource(pdev, IORESOURCE_IO, 0); |
533 | printk(KERN_ERR NAME ": can't allocate io 0x%lx-0x%lx\n", | 519 | if (!res) { |
534 | base, base + 8 - 1); | 520 | dev_err(&pdev->dev, "can't fetch device resource info\n"); |
535 | rc = -EBUSY; | 521 | return -ENODEV; |
536 | goto errout_free; | ||
537 | } | 522 | } |
538 | 523 | ||
539 | iface->base = base; | 524 | iface = scx200_create_dev("CS5535", res->start, 0, &pdev->dev); |
540 | rc = scx200_acb_create(iface); | 525 | if (!iface) |
526 | return -EIO; | ||
541 | 527 | ||
542 | if (rc == 0) | 528 | dev_info(&pdev->dev, "SCx200 device '%s' registered\n", |
543 | return 0; | 529 | iface->adapter.name); |
530 | platform_set_drvdata(pdev, iface); | ||
544 | 531 | ||
545 | release_region(base, 8); | 532 | return 0; |
546 | errout_free: | ||
547 | kfree(iface); | ||
548 | return rc; | ||
549 | } | 533 | } |
550 | 534 | ||
551 | /* Driver data is an index into the scx200_data array that indicates | 535 | static void __devexit scx200_cleanup_iface(struct scx200_acb_iface *iface) |
552 | * the name and the BAR where the I/O address resource is located. ISA | 536 | { |
553 | * devices are flagged with a bar value of -1 */ | 537 | i2c_del_adapter(&iface->adapter); |
554 | 538 | release_region(iface->base, 8); | |
555 | static const struct pci_device_id scx200_pci[] __initconst = { | 539 | kfree(iface); |
556 | { PCI_DEVICE(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_SCx200_BRIDGE), | 540 | } |
557 | .driver_data = 0 }, | ||
558 | { PCI_DEVICE(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_SC1100_BRIDGE), | ||
559 | .driver_data = 0 }, | ||
560 | { PCI_DEVICE(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_CS5535_ISA), | ||
561 | .driver_data = 1 }, | ||
562 | { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_CS5536_ISA), | ||
563 | .driver_data = 2 }, | ||
564 | { 0, } | ||
565 | }; | ||
566 | |||
567 | static struct { | ||
568 | const char *name; | ||
569 | int bar; | ||
570 | } scx200_data[] = { | ||
571 | { "SCx200", -1 }, | ||
572 | { "CS5535", 0 }, | ||
573 | { "CS5536", 0 } | ||
574 | }; | ||
575 | 541 | ||
576 | static __init int scx200_scan_pci(void) | 542 | static int __devexit scx200_remove(struct platform_device *pdev) |
577 | { | 543 | { |
578 | int data, dev; | 544 | struct scx200_acb_iface *iface; |
579 | int rc = -ENODEV; | ||
580 | struct pci_dev *pdev; | ||
581 | 545 | ||
582 | for(dev = 0; dev < ARRAY_SIZE(scx200_pci); dev++) { | 546 | iface = platform_get_drvdata(pdev); |
583 | pdev = pci_get_device(scx200_pci[dev].vendor, | 547 | platform_set_drvdata(pdev, NULL); |
584 | scx200_pci[dev].device, NULL); | 548 | scx200_cleanup_iface(iface); |
585 | 549 | ||
586 | if (pdev == NULL) | 550 | return 0; |
587 | continue; | 551 | } |
588 | 552 | ||
589 | data = scx200_pci[dev].driver_data; | 553 | static struct platform_driver scx200_pci_drv = { |
554 | .driver = { | ||
555 | .name = "cs5535-smb", | ||
556 | .owner = THIS_MODULE, | ||
557 | }, | ||
558 | .probe = scx200_probe, | ||
559 | .remove = __devexit_p(scx200_remove), | ||
560 | }; | ||
590 | 561 | ||
591 | /* if .bar is greater or equal to zero, this is a | 562 | static const struct pci_device_id scx200_isa[] __initconst = { |
592 | * PCI device - otherwise, we assume | 563 | { PCI_DEVICE(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_SCx200_BRIDGE) }, |
593 | that the ports are ISA based | 564 | { PCI_DEVICE(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_SC1100_BRIDGE) }, |
594 | */ | 565 | { 0, } |
566 | }; | ||
595 | 567 | ||
596 | if (scx200_data[data].bar >= 0) | 568 | static __init void scx200_scan_isa(void) |
597 | rc = scx200_create_pci(scx200_data[data].name, pdev, | 569 | { |
598 | scx200_data[data].bar); | 570 | int i; |
599 | else { | ||
600 | int i; | ||
601 | 571 | ||
602 | pci_dev_put(pdev); | 572 | if (!pci_dev_present(scx200_isa)) |
603 | for (i = 0; i < MAX_DEVICES; ++i) { | 573 | return; |
604 | if (base[i] == 0) | ||
605 | continue; | ||
606 | 574 | ||
607 | rc = scx200_create_isa(scx200_data[data].name, | 575 | for (i = 0; i < MAX_DEVICES; ++i) { |
608 | base[i], | 576 | if (base[i] == 0) |
609 | i); | 577 | continue; |
610 | } | ||
611 | } | ||
612 | 578 | ||
613 | break; | 579 | /* XXX: should we care about failures? */ |
580 | scx200_create_dev("SCx200", base[i], i, NULL); | ||
614 | } | 581 | } |
615 | |||
616 | return rc; | ||
617 | } | 582 | } |
618 | 583 | ||
619 | static int __init scx200_acb_init(void) | 584 | static int __init scx200_acb_init(void) |
620 | { | 585 | { |
621 | int rc; | ||
622 | |||
623 | pr_debug(NAME ": NatSemi SCx200 ACCESS.bus Driver\n"); | 586 | pr_debug(NAME ": NatSemi SCx200 ACCESS.bus Driver\n"); |
624 | 587 | ||
625 | rc = scx200_scan_pci(); | 588 | /* First scan for ISA-based devices */ |
589 | scx200_scan_isa(); /* XXX: should we care about errors? */ | ||
626 | 590 | ||
627 | /* If at least one bus was created, init must succeed */ | 591 | /* If at least one bus was created, init must succeed */ |
628 | if (scx200_acb_list) | 592 | if (scx200_acb_list) |
629 | return 0; | 593 | return 0; |
630 | return rc; | 594 | |
595 | /* No ISA devices; register the platform driver for PCI-based devices */ | ||
596 | return platform_driver_register(&scx200_pci_drv); | ||
631 | } | 597 | } |
632 | 598 | ||
633 | static void __exit scx200_acb_cleanup(void) | 599 | static void __exit scx200_acb_cleanup(void) |
634 | { | 600 | { |
635 | struct scx200_acb_iface *iface; | 601 | struct scx200_acb_iface *iface; |
636 | 602 | ||
603 | platform_driver_unregister(&scx200_pci_drv); | ||
604 | |||
637 | mutex_lock(&scx200_acb_list_mutex); | 605 | mutex_lock(&scx200_acb_list_mutex); |
638 | while ((iface = scx200_acb_list) != NULL) { | 606 | while ((iface = scx200_acb_list) != NULL) { |
639 | scx200_acb_list = iface->next; | 607 | scx200_acb_list = iface->next; |
640 | mutex_unlock(&scx200_acb_list_mutex); | 608 | mutex_unlock(&scx200_acb_list_mutex); |
641 | 609 | ||
642 | i2c_del_adapter(&iface->adapter); | 610 | scx200_cleanup_iface(iface); |
643 | |||
644 | if (iface->pdev) { | ||
645 | pci_release_region(iface->pdev, iface->bar); | ||
646 | pci_dev_put(iface->pdev); | ||
647 | } | ||
648 | else | ||
649 | release_region(iface->base, 8); | ||
650 | 611 | ||
651 | kfree(iface); | ||
652 | mutex_lock(&scx200_acb_list_mutex); | 612 | mutex_lock(&scx200_acb_list_mutex); |
653 | } | 613 | } |
654 | mutex_unlock(&scx200_acb_list_mutex); | 614 | mutex_unlock(&scx200_acb_list_mutex); |
diff --git a/drivers/media/video/cafe_ccic.c b/drivers/media/video/cafe_ccic.c index 789087cd6a9c..49f1b8f1418e 100644 --- a/drivers/media/video/cafe_ccic.c +++ b/drivers/media/video/cafe_ccic.c | |||
@@ -2184,9 +2184,7 @@ static int cafe_pci_resume(struct pci_dev *pdev) | |||
2184 | struct cafe_camera *cam = to_cam(v4l2_dev); | 2184 | struct cafe_camera *cam = to_cam(v4l2_dev); |
2185 | int ret = 0; | 2185 | int ret = 0; |
2186 | 2186 | ||
2187 | ret = pci_restore_state(pdev); | 2187 | pci_restore_state(pdev); |
2188 | if (ret) | ||
2189 | return ret; | ||
2190 | ret = pci_enable_device(pdev); | 2188 | ret = pci_enable_device(pdev); |
2191 | 2189 | ||
2192 | if (ret) { | 2190 | if (ret) { |
diff --git a/drivers/mfd/88pm860x-core.c b/drivers/mfd/88pm860x-core.c index 20895e7a99c9..793300c554b4 100644 --- a/drivers/mfd/88pm860x-core.c +++ b/drivers/mfd/88pm860x-core.c | |||
@@ -361,12 +361,6 @@ static struct pm860x_irq_data pm860x_irqs[] = { | |||
361 | }, | 361 | }, |
362 | }; | 362 | }; |
363 | 363 | ||
364 | static inline struct pm860x_irq_data *irq_to_pm860x(struct pm860x_chip *chip, | ||
365 | int irq) | ||
366 | { | ||
367 | return &pm860x_irqs[irq - chip->irq_base]; | ||
368 | } | ||
369 | |||
370 | static irqreturn_t pm860x_irq(int irq, void *data) | 364 | static irqreturn_t pm860x_irq(int irq, void *data) |
371 | { | 365 | { |
372 | struct pm860x_chip *chip = data; | 366 | struct pm860x_chip *chip = data; |
@@ -388,16 +382,16 @@ static irqreturn_t pm860x_irq(int irq, void *data) | |||
388 | return IRQ_HANDLED; | 382 | return IRQ_HANDLED; |
389 | } | 383 | } |
390 | 384 | ||
391 | static void pm860x_irq_lock(unsigned int irq) | 385 | static void pm860x_irq_lock(struct irq_data *data) |
392 | { | 386 | { |
393 | struct pm860x_chip *chip = get_irq_chip_data(irq); | 387 | struct pm860x_chip *chip = irq_data_get_irq_chip_data(data); |
394 | 388 | ||
395 | mutex_lock(&chip->irq_lock); | 389 | mutex_lock(&chip->irq_lock); |
396 | } | 390 | } |
397 | 391 | ||
398 | static void pm860x_irq_sync_unlock(unsigned int irq) | 392 | static void pm860x_irq_sync_unlock(struct irq_data *data) |
399 | { | 393 | { |
400 | struct pm860x_chip *chip = get_irq_chip_data(irq); | 394 | struct pm860x_chip *chip = irq_data_get_irq_chip_data(data); |
401 | struct pm860x_irq_data *irq_data; | 395 | struct pm860x_irq_data *irq_data; |
402 | struct i2c_client *i2c; | 396 | struct i2c_client *i2c; |
403 | static unsigned char cached[3] = {0x0, 0x0, 0x0}; | 397 | static unsigned char cached[3] = {0x0, 0x0, 0x0}; |
@@ -439,25 +433,25 @@ static void pm860x_irq_sync_unlock(unsigned int irq) | |||
439 | mutex_unlock(&chip->irq_lock); | 433 | mutex_unlock(&chip->irq_lock); |
440 | } | 434 | } |
441 | 435 | ||
442 | static void pm860x_irq_enable(unsigned int irq) | 436 | static void pm860x_irq_enable(struct irq_data *data) |
443 | { | 437 | { |
444 | struct pm860x_chip *chip = get_irq_chip_data(irq); | 438 | struct pm860x_chip *chip = irq_data_get_irq_chip_data(data); |
445 | pm860x_irqs[irq - chip->irq_base].enable | 439 | pm860x_irqs[data->irq - chip->irq_base].enable |
446 | = pm860x_irqs[irq - chip->irq_base].offs; | 440 | = pm860x_irqs[data->irq - chip->irq_base].offs; |
447 | } | 441 | } |
448 | 442 | ||
449 | static void pm860x_irq_disable(unsigned int irq) | 443 | static void pm860x_irq_disable(struct irq_data *data) |
450 | { | 444 | { |
451 | struct pm860x_chip *chip = get_irq_chip_data(irq); | 445 | struct pm860x_chip *chip = irq_data_get_irq_chip_data(data); |
452 | pm860x_irqs[irq - chip->irq_base].enable = 0; | 446 | pm860x_irqs[data->irq - chip->irq_base].enable = 0; |
453 | } | 447 | } |
454 | 448 | ||
455 | static struct irq_chip pm860x_irq_chip = { | 449 | static struct irq_chip pm860x_irq_chip = { |
456 | .name = "88pm860x", | 450 | .name = "88pm860x", |
457 | .bus_lock = pm860x_irq_lock, | 451 | .irq_bus_lock = pm860x_irq_lock, |
458 | .bus_sync_unlock = pm860x_irq_sync_unlock, | 452 | .irq_bus_sync_unlock = pm860x_irq_sync_unlock, |
459 | .enable = pm860x_irq_enable, | 453 | .irq_enable = pm860x_irq_enable, |
460 | .disable = pm860x_irq_disable, | 454 | .irq_disable = pm860x_irq_disable, |
461 | }; | 455 | }; |
462 | 456 | ||
463 | static int __devinit device_gpadc_init(struct pm860x_chip *chip, | 457 | static int __devinit device_gpadc_init(struct pm860x_chip *chip, |
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index da9d2971102e..fd018366d670 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig | |||
@@ -496,13 +496,13 @@ config EZX_PCAP | |||
496 | 496 | ||
497 | config AB8500_CORE | 497 | config AB8500_CORE |
498 | bool "ST-Ericsson AB8500 Mixed Signal Power Management chip" | 498 | bool "ST-Ericsson AB8500 Mixed Signal Power Management chip" |
499 | depends on GENERIC_HARDIRQS && ABX500_CORE && SPI_MASTER && ARCH_U8500 | 499 | depends on GENERIC_HARDIRQS && ABX500_CORE |
500 | select MFD_CORE | 500 | select MFD_CORE |
501 | help | 501 | help |
502 | Select this option to enable access to AB8500 power management | 502 | Select this option to enable access to AB8500 power management |
503 | chip. This connects to U8500 either on the SSP/SPI bus | 503 | chip. This connects to U8500 either on the SSP/SPI bus (deprecated |
504 | or the I2C bus via PRCMU. It also adds the irq_chip | 504 | since hardware version v1.0) or the I2C bus via PRCMU. It also adds |
505 | parts for handling the Mixed Signal chip events. | 505 | the irq_chip parts for handling the Mixed Signal chip events. |
506 | This chip embeds various other multimedia funtionalities as well. | 506 | This chip embeds various other multimedia funtionalities as well. |
507 | 507 | ||
508 | config AB8500_I2C_CORE | 508 | config AB8500_I2C_CORE |
@@ -537,6 +537,14 @@ config AB3550_CORE | |||
537 | LEDs, vibrator, system power and temperature, power management | 537 | LEDs, vibrator, system power and temperature, power management |
538 | and ALSA sound. | 538 | and ALSA sound. |
539 | 539 | ||
540 | config MFD_CS5535 | ||
541 | tristate "Support for CS5535 and CS5536 southbridge core functions" | ||
542 | select MFD_CORE | ||
543 | depends on PCI | ||
544 | ---help--- | ||
545 | This is the core driver for CS5535/CS5536 MFD functions. This is | ||
546 | necessary for using the board's GPIO and MFGPT functionality. | ||
547 | |||
540 | config MFD_TIMBERDALE | 548 | config MFD_TIMBERDALE |
541 | tristate "Support for the Timberdale FPGA" | 549 | tristate "Support for the Timberdale FPGA" |
542 | select MFD_CORE | 550 | select MFD_CORE |
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile index 848e7eac75aa..a54e2c7c6a1c 100644 --- a/drivers/mfd/Makefile +++ b/drivers/mfd/Makefile | |||
@@ -70,7 +70,7 @@ obj-$(CONFIG_ABX500_CORE) += abx500-core.o | |||
70 | obj-$(CONFIG_AB3100_CORE) += ab3100-core.o | 70 | obj-$(CONFIG_AB3100_CORE) += ab3100-core.o |
71 | obj-$(CONFIG_AB3100_OTP) += ab3100-otp.o | 71 | obj-$(CONFIG_AB3100_OTP) += ab3100-otp.o |
72 | obj-$(CONFIG_AB3550_CORE) += ab3550-core.o | 72 | obj-$(CONFIG_AB3550_CORE) += ab3550-core.o |
73 | obj-$(CONFIG_AB8500_CORE) += ab8500-core.o ab8500-spi.o | 73 | obj-$(CONFIG_AB8500_CORE) += ab8500-core.o |
74 | obj-$(CONFIG_AB8500_I2C_CORE) += ab8500-i2c.o | 74 | obj-$(CONFIG_AB8500_I2C_CORE) += ab8500-i2c.o |
75 | obj-$(CONFIG_AB8500_DEBUG) += ab8500-debugfs.o | 75 | obj-$(CONFIG_AB8500_DEBUG) += ab8500-debugfs.o |
76 | obj-$(CONFIG_MFD_TIMBERDALE) += timberdale.o | 76 | obj-$(CONFIG_MFD_TIMBERDALE) += timberdale.o |
@@ -82,3 +82,4 @@ obj-$(CONFIG_MFD_JZ4740_ADC) += jz4740-adc.o | |||
82 | obj-$(CONFIG_MFD_TPS6586X) += tps6586x.o | 82 | obj-$(CONFIG_MFD_TPS6586X) += tps6586x.o |
83 | obj-$(CONFIG_MFD_VX855) += vx855.o | 83 | obj-$(CONFIG_MFD_VX855) += vx855.o |
84 | obj-$(CONFIG_MFD_WL1273_CORE) += wl1273-core.o | 84 | obj-$(CONFIG_MFD_WL1273_CORE) += wl1273-core.o |
85 | obj-$(CONFIG_MFD_CS5535) += cs5535-mfd.o | ||
diff --git a/drivers/mfd/ab3550-core.c b/drivers/mfd/ab3550-core.c index 8a98739e6d9c..5fbca346b998 100644 --- a/drivers/mfd/ab3550-core.c +++ b/drivers/mfd/ab3550-core.c | |||
@@ -1159,15 +1159,16 @@ static void ab3550_mask_work(struct work_struct *work) | |||
1159 | } | 1159 | } |
1160 | } | 1160 | } |
1161 | 1161 | ||
1162 | static void ab3550_mask(unsigned int irq) | 1162 | static void ab3550_mask(struct irq_data *data) |
1163 | { | 1163 | { |
1164 | unsigned long flags; | 1164 | unsigned long flags; |
1165 | struct ab3550 *ab; | 1165 | struct ab3550 *ab; |
1166 | struct ab3550_platform_data *plf_data; | 1166 | struct ab3550_platform_data *plf_data; |
1167 | int irq; | ||
1167 | 1168 | ||
1168 | ab = get_irq_chip_data(irq); | 1169 | ab = irq_data_get_irq_chip_data(data); |
1169 | plf_data = ab->i2c_client[0]->dev.platform_data; | 1170 | plf_data = ab->i2c_client[0]->dev.platform_data; |
1170 | irq -= plf_data->irq.base; | 1171 | irq = data->irq - plf_data->irq.base; |
1171 | 1172 | ||
1172 | spin_lock_irqsave(&ab->event_lock, flags); | 1173 | spin_lock_irqsave(&ab->event_lock, flags); |
1173 | ab->event_mask[irq / 8] |= BIT(irq % 8); | 1174 | ab->event_mask[irq / 8] |= BIT(irq % 8); |
@@ -1176,15 +1177,16 @@ static void ab3550_mask(unsigned int irq) | |||
1176 | schedule_work(&ab->mask_work); | 1177 | schedule_work(&ab->mask_work); |
1177 | } | 1178 | } |
1178 | 1179 | ||
1179 | static void ab3550_unmask(unsigned int irq) | 1180 | static void ab3550_unmask(struct irq_data *data) |
1180 | { | 1181 | { |
1181 | unsigned long flags; | 1182 | unsigned long flags; |
1182 | struct ab3550 *ab; | 1183 | struct ab3550 *ab; |
1183 | struct ab3550_platform_data *plf_data; | 1184 | struct ab3550_platform_data *plf_data; |
1185 | int irq; | ||
1184 | 1186 | ||
1185 | ab = get_irq_chip_data(irq); | 1187 | ab = irq_data_get_irq_chip_data(data); |
1186 | plf_data = ab->i2c_client[0]->dev.platform_data; | 1188 | plf_data = ab->i2c_client[0]->dev.platform_data; |
1187 | irq -= plf_data->irq.base; | 1189 | irq = data->irq - plf_data->irq.base; |
1188 | 1190 | ||
1189 | spin_lock_irqsave(&ab->event_lock, flags); | 1191 | spin_lock_irqsave(&ab->event_lock, flags); |
1190 | ab->event_mask[irq / 8] &= ~BIT(irq % 8); | 1192 | ab->event_mask[irq / 8] &= ~BIT(irq % 8); |
@@ -1193,20 +1195,16 @@ static void ab3550_unmask(unsigned int irq) | |||
1193 | schedule_work(&ab->mask_work); | 1195 | schedule_work(&ab->mask_work); |
1194 | } | 1196 | } |
1195 | 1197 | ||
1196 | static void noop(unsigned int irq) | 1198 | static void noop(struct irq_data *data) |
1197 | { | 1199 | { |
1198 | } | 1200 | } |
1199 | 1201 | ||
1200 | static struct irq_chip ab3550_irq_chip = { | 1202 | static struct irq_chip ab3550_irq_chip = { |
1201 | .name = "ab3550-core", /* Keep the same name as the request */ | 1203 | .name = "ab3550-core", /* Keep the same name as the request */ |
1202 | .startup = NULL, /* defaults to enable */ | 1204 | .irq_disable = ab3550_mask, /* No default to mask in chip.c */ |
1203 | .shutdown = NULL, /* defaults to disable */ | 1205 | .irq_ack = noop, |
1204 | .enable = NULL, /* defaults to unmask */ | 1206 | .irq_mask = ab3550_mask, |
1205 | .disable = ab3550_mask, /* No default to mask in chip.c */ | 1207 | .irq_unmask = ab3550_unmask, |
1206 | .ack = noop, | ||
1207 | .mask = ab3550_mask, | ||
1208 | .unmask = ab3550_unmask, | ||
1209 | .end = NULL, | ||
1210 | }; | 1208 | }; |
1211 | 1209 | ||
1212 | struct ab_family_id { | 1210 | struct ab_family_id { |
diff --git a/drivers/mfd/ab8500-core.c b/drivers/mfd/ab8500-core.c index d9640a623ff4..b6887014d687 100644 --- a/drivers/mfd/ab8500-core.c +++ b/drivers/mfd/ab8500-core.c | |||
@@ -52,6 +52,7 @@ | |||
52 | #define AB8500_IT_LATCH8_REG 0x27 | 52 | #define AB8500_IT_LATCH8_REG 0x27 |
53 | #define AB8500_IT_LATCH9_REG 0x28 | 53 | #define AB8500_IT_LATCH9_REG 0x28 |
54 | #define AB8500_IT_LATCH10_REG 0x29 | 54 | #define AB8500_IT_LATCH10_REG 0x29 |
55 | #define AB8500_IT_LATCH12_REG 0x2B | ||
55 | #define AB8500_IT_LATCH19_REG 0x32 | 56 | #define AB8500_IT_LATCH19_REG 0x32 |
56 | #define AB8500_IT_LATCH20_REG 0x33 | 57 | #define AB8500_IT_LATCH20_REG 0x33 |
57 | #define AB8500_IT_LATCH21_REG 0x34 | 58 | #define AB8500_IT_LATCH21_REG 0x34 |
@@ -98,13 +99,17 @@ | |||
98 | * offset 0. | 99 | * offset 0. |
99 | */ | 100 | */ |
100 | static const int ab8500_irq_regoffset[AB8500_NUM_IRQ_REGS] = { | 101 | static const int ab8500_irq_regoffset[AB8500_NUM_IRQ_REGS] = { |
101 | 0, 1, 2, 3, 4, 6, 7, 8, 9, 18, 19, 20, 21, | 102 | 0, 1, 2, 3, 4, 6, 7, 8, 9, 11, 18, 19, 20, 21, |
102 | }; | 103 | }; |
103 | 104 | ||
104 | static int ab8500_get_chip_id(struct device *dev) | 105 | static int ab8500_get_chip_id(struct device *dev) |
105 | { | 106 | { |
106 | struct ab8500 *ab8500 = dev_get_drvdata(dev->parent); | 107 | struct ab8500 *ab8500; |
107 | return (int)ab8500->chip_id; | 108 | |
109 | if (!dev) | ||
110 | return -EINVAL; | ||
111 | ab8500 = dev_get_drvdata(dev->parent); | ||
112 | return ab8500 ? (int)ab8500->chip_id : -EINVAL; | ||
108 | } | 113 | } |
109 | 114 | ||
110 | static int set_register_interruptible(struct ab8500 *ab8500, u8 bank, | 115 | static int set_register_interruptible(struct ab8500 *ab8500, u8 bank, |
@@ -228,16 +233,16 @@ static struct abx500_ops ab8500_ops = { | |||
228 | .startup_irq_enabled = NULL, | 233 | .startup_irq_enabled = NULL, |
229 | }; | 234 | }; |
230 | 235 | ||
231 | static void ab8500_irq_lock(unsigned int irq) | 236 | static void ab8500_irq_lock(struct irq_data *data) |
232 | { | 237 | { |
233 | struct ab8500 *ab8500 = get_irq_chip_data(irq); | 238 | struct ab8500 *ab8500 = irq_data_get_irq_chip_data(data); |
234 | 239 | ||
235 | mutex_lock(&ab8500->irq_lock); | 240 | mutex_lock(&ab8500->irq_lock); |
236 | } | 241 | } |
237 | 242 | ||
238 | static void ab8500_irq_sync_unlock(unsigned int irq) | 243 | static void ab8500_irq_sync_unlock(struct irq_data *data) |
239 | { | 244 | { |
240 | struct ab8500 *ab8500 = get_irq_chip_data(irq); | 245 | struct ab8500 *ab8500 = irq_data_get_irq_chip_data(data); |
241 | int i; | 246 | int i; |
242 | 247 | ||
243 | for (i = 0; i < AB8500_NUM_IRQ_REGS; i++) { | 248 | for (i = 0; i < AB8500_NUM_IRQ_REGS; i++) { |
@@ -248,6 +253,10 @@ static void ab8500_irq_sync_unlock(unsigned int irq) | |||
248 | if (new == old) | 253 | if (new == old) |
249 | continue; | 254 | continue; |
250 | 255 | ||
256 | /* Interrupt register 12 does'nt exist prior to version 0x20 */ | ||
257 | if (ab8500_irq_regoffset[i] == 11 && ab8500->chip_id < 0x20) | ||
258 | continue; | ||
259 | |||
251 | ab8500->oldmask[i] = new; | 260 | ab8500->oldmask[i] = new; |
252 | 261 | ||
253 | reg = AB8500_IT_MASK1_REG + ab8500_irq_regoffset[i]; | 262 | reg = AB8500_IT_MASK1_REG + ab8500_irq_regoffset[i]; |
@@ -257,20 +266,20 @@ static void ab8500_irq_sync_unlock(unsigned int irq) | |||
257 | mutex_unlock(&ab8500->irq_lock); | 266 | mutex_unlock(&ab8500->irq_lock); |
258 | } | 267 | } |
259 | 268 | ||
260 | static void ab8500_irq_mask(unsigned int irq) | 269 | static void ab8500_irq_mask(struct irq_data *data) |
261 | { | 270 | { |
262 | struct ab8500 *ab8500 = get_irq_chip_data(irq); | 271 | struct ab8500 *ab8500 = irq_data_get_irq_chip_data(data); |
263 | int offset = irq - ab8500->irq_base; | 272 | int offset = data->irq - ab8500->irq_base; |
264 | int index = offset / 8; | 273 | int index = offset / 8; |
265 | int mask = 1 << (offset % 8); | 274 | int mask = 1 << (offset % 8); |
266 | 275 | ||
267 | ab8500->mask[index] |= mask; | 276 | ab8500->mask[index] |= mask; |
268 | } | 277 | } |
269 | 278 | ||
270 | static void ab8500_irq_unmask(unsigned int irq) | 279 | static void ab8500_irq_unmask(struct irq_data *data) |
271 | { | 280 | { |
272 | struct ab8500 *ab8500 = get_irq_chip_data(irq); | 281 | struct ab8500 *ab8500 = irq_data_get_irq_chip_data(data); |
273 | int offset = irq - ab8500->irq_base; | 282 | int offset = data->irq - ab8500->irq_base; |
274 | int index = offset / 8; | 283 | int index = offset / 8; |
275 | int mask = 1 << (offset % 8); | 284 | int mask = 1 << (offset % 8); |
276 | 285 | ||
@@ -279,10 +288,10 @@ static void ab8500_irq_unmask(unsigned int irq) | |||
279 | 288 | ||
280 | static struct irq_chip ab8500_irq_chip = { | 289 | static struct irq_chip ab8500_irq_chip = { |
281 | .name = "ab8500", | 290 | .name = "ab8500", |
282 | .bus_lock = ab8500_irq_lock, | 291 | .irq_bus_lock = ab8500_irq_lock, |
283 | .bus_sync_unlock = ab8500_irq_sync_unlock, | 292 | .irq_bus_sync_unlock = ab8500_irq_sync_unlock, |
284 | .mask = ab8500_irq_mask, | 293 | .irq_mask = ab8500_irq_mask, |
285 | .unmask = ab8500_irq_unmask, | 294 | .irq_unmask = ab8500_irq_unmask, |
286 | }; | 295 | }; |
287 | 296 | ||
288 | static irqreturn_t ab8500_irq(int irq, void *dev) | 297 | static irqreturn_t ab8500_irq(int irq, void *dev) |
@@ -297,6 +306,10 @@ static irqreturn_t ab8500_irq(int irq, void *dev) | |||
297 | int status; | 306 | int status; |
298 | u8 value; | 307 | u8 value; |
299 | 308 | ||
309 | /* Interrupt register 12 does'nt exist prior to version 0x20 */ | ||
310 | if (regoffset == 11 && ab8500->chip_id < 0x20) | ||
311 | continue; | ||
312 | |||
300 | status = get_register_interruptible(ab8500, AB8500_INTERRUPT, | 313 | status = get_register_interruptible(ab8500, AB8500_INTERRUPT, |
301 | AB8500_IT_LATCH1_REG + regoffset, &value); | 314 | AB8500_IT_LATCH1_REG + regoffset, &value); |
302 | if (status < 0 || value == 0) | 315 | if (status < 0 || value == 0) |
@@ -393,13 +406,195 @@ static struct resource ab8500_poweronkey_db_resources[] = { | |||
393 | }, | 406 | }, |
394 | }; | 407 | }; |
395 | 408 | ||
409 | static struct resource ab8500_bm_resources[] = { | ||
410 | { | ||
411 | .name = "MAIN_EXT_CH_NOT_OK", | ||
412 | .start = AB8500_INT_MAIN_EXT_CH_NOT_OK, | ||
413 | .end = AB8500_INT_MAIN_EXT_CH_NOT_OK, | ||
414 | .flags = IORESOURCE_IRQ, | ||
415 | }, | ||
416 | { | ||
417 | .name = "BATT_OVV", | ||
418 | .start = AB8500_INT_BATT_OVV, | ||
419 | .end = AB8500_INT_BATT_OVV, | ||
420 | .flags = IORESOURCE_IRQ, | ||
421 | }, | ||
422 | { | ||
423 | .name = "MAIN_CH_UNPLUG_DET", | ||
424 | .start = AB8500_INT_MAIN_CH_UNPLUG_DET, | ||
425 | .end = AB8500_INT_MAIN_CH_UNPLUG_DET, | ||
426 | .flags = IORESOURCE_IRQ, | ||
427 | }, | ||
428 | { | ||
429 | .name = "MAIN_CHARGE_PLUG_DET", | ||
430 | .start = AB8500_INT_MAIN_CH_PLUG_DET, | ||
431 | .end = AB8500_INT_MAIN_CH_PLUG_DET, | ||
432 | .flags = IORESOURCE_IRQ, | ||
433 | }, | ||
434 | { | ||
435 | .name = "VBUS_DET_F", | ||
436 | .start = AB8500_INT_VBUS_DET_F, | ||
437 | .end = AB8500_INT_VBUS_DET_F, | ||
438 | .flags = IORESOURCE_IRQ, | ||
439 | }, | ||
440 | { | ||
441 | .name = "VBUS_DET_R", | ||
442 | .start = AB8500_INT_VBUS_DET_R, | ||
443 | .end = AB8500_INT_VBUS_DET_R, | ||
444 | .flags = IORESOURCE_IRQ, | ||
445 | }, | ||
446 | { | ||
447 | .name = "BAT_CTRL_INDB", | ||
448 | .start = AB8500_INT_BAT_CTRL_INDB, | ||
449 | .end = AB8500_INT_BAT_CTRL_INDB, | ||
450 | .flags = IORESOURCE_IRQ, | ||
451 | }, | ||
452 | { | ||
453 | .name = "CH_WD_EXP", | ||
454 | .start = AB8500_INT_CH_WD_EXP, | ||
455 | .end = AB8500_INT_CH_WD_EXP, | ||
456 | .flags = IORESOURCE_IRQ, | ||
457 | }, | ||
458 | { | ||
459 | .name = "VBUS_OVV", | ||
460 | .start = AB8500_INT_VBUS_OVV, | ||
461 | .end = AB8500_INT_VBUS_OVV, | ||
462 | .flags = IORESOURCE_IRQ, | ||
463 | }, | ||
464 | { | ||
465 | .name = "NCONV_ACCU", | ||
466 | .start = AB8500_INT_CCN_CONV_ACC, | ||
467 | .end = AB8500_INT_CCN_CONV_ACC, | ||
468 | .flags = IORESOURCE_IRQ, | ||
469 | }, | ||
470 | { | ||
471 | .name = "LOW_BAT_F", | ||
472 | .start = AB8500_INT_LOW_BAT_F, | ||
473 | .end = AB8500_INT_LOW_BAT_F, | ||
474 | .flags = IORESOURCE_IRQ, | ||
475 | }, | ||
476 | { | ||
477 | .name = "LOW_BAT_R", | ||
478 | .start = AB8500_INT_LOW_BAT_R, | ||
479 | .end = AB8500_INT_LOW_BAT_R, | ||
480 | .flags = IORESOURCE_IRQ, | ||
481 | }, | ||
482 | { | ||
483 | .name = "BTEMP_LOW", | ||
484 | .start = AB8500_INT_BTEMP_LOW, | ||
485 | .end = AB8500_INT_BTEMP_LOW, | ||
486 | .flags = IORESOURCE_IRQ, | ||
487 | }, | ||
488 | { | ||
489 | .name = "BTEMP_HIGH", | ||
490 | .start = AB8500_INT_BTEMP_HIGH, | ||
491 | .end = AB8500_INT_BTEMP_HIGH, | ||
492 | .flags = IORESOURCE_IRQ, | ||
493 | }, | ||
494 | { | ||
495 | .name = "USB_CHARGER_NOT_OKR", | ||
496 | .start = AB8500_INT_USB_CHARGER_NOT_OK, | ||
497 | .end = AB8500_INT_USB_CHARGER_NOT_OK, | ||
498 | .flags = IORESOURCE_IRQ, | ||
499 | }, | ||
500 | { | ||
501 | .name = "USB_CHARGE_DET_DONE", | ||
502 | .start = AB8500_INT_USB_CHG_DET_DONE, | ||
503 | .end = AB8500_INT_USB_CHG_DET_DONE, | ||
504 | .flags = IORESOURCE_IRQ, | ||
505 | }, | ||
506 | { | ||
507 | .name = "USB_CH_TH_PROT_R", | ||
508 | .start = AB8500_INT_USB_CH_TH_PROT_R, | ||
509 | .end = AB8500_INT_USB_CH_TH_PROT_R, | ||
510 | .flags = IORESOURCE_IRQ, | ||
511 | }, | ||
512 | { | ||
513 | .name = "MAIN_CH_TH_PROT_R", | ||
514 | .start = AB8500_INT_MAIN_CH_TH_PROT_R, | ||
515 | .end = AB8500_INT_MAIN_CH_TH_PROT_R, | ||
516 | .flags = IORESOURCE_IRQ, | ||
517 | }, | ||
518 | { | ||
519 | .name = "USB_CHARGER_NOT_OKF", | ||
520 | .start = AB8500_INT_USB_CHARGER_NOT_OKF, | ||
521 | .end = AB8500_INT_USB_CHARGER_NOT_OKF, | ||
522 | .flags = IORESOURCE_IRQ, | ||
523 | }, | ||
524 | }; | ||
525 | |||
526 | static struct resource ab8500_debug_resources[] = { | ||
527 | { | ||
528 | .name = "IRQ_FIRST", | ||
529 | .start = AB8500_INT_MAIN_EXT_CH_NOT_OK, | ||
530 | .end = AB8500_INT_MAIN_EXT_CH_NOT_OK, | ||
531 | .flags = IORESOURCE_IRQ, | ||
532 | }, | ||
533 | { | ||
534 | .name = "IRQ_LAST", | ||
535 | .start = AB8500_INT_USB_CHARGER_NOT_OKF, | ||
536 | .end = AB8500_INT_USB_CHARGER_NOT_OKF, | ||
537 | .flags = IORESOURCE_IRQ, | ||
538 | }, | ||
539 | }; | ||
540 | |||
541 | static struct resource ab8500_usb_resources[] = { | ||
542 | { | ||
543 | .name = "ID_WAKEUP_R", | ||
544 | .start = AB8500_INT_ID_WAKEUP_R, | ||
545 | .end = AB8500_INT_ID_WAKEUP_R, | ||
546 | .flags = IORESOURCE_IRQ, | ||
547 | }, | ||
548 | { | ||
549 | .name = "ID_WAKEUP_F", | ||
550 | .start = AB8500_INT_ID_WAKEUP_F, | ||
551 | .end = AB8500_INT_ID_WAKEUP_F, | ||
552 | .flags = IORESOURCE_IRQ, | ||
553 | }, | ||
554 | { | ||
555 | .name = "VBUS_DET_F", | ||
556 | .start = AB8500_INT_VBUS_DET_F, | ||
557 | .end = AB8500_INT_VBUS_DET_F, | ||
558 | .flags = IORESOURCE_IRQ, | ||
559 | }, | ||
560 | { | ||
561 | .name = "VBUS_DET_R", | ||
562 | .start = AB8500_INT_VBUS_DET_R, | ||
563 | .end = AB8500_INT_VBUS_DET_R, | ||
564 | .flags = IORESOURCE_IRQ, | ||
565 | }, | ||
566 | { | ||
567 | .name = "USB_LINK_STATUS", | ||
568 | .start = AB8500_INT_USB_LINK_STATUS, | ||
569 | .end = AB8500_INT_USB_LINK_STATUS, | ||
570 | .flags = IORESOURCE_IRQ, | ||
571 | }, | ||
572 | }; | ||
573 | |||
574 | static struct resource ab8500_temp_resources[] = { | ||
575 | { | ||
576 | .name = "AB8500_TEMP_WARM", | ||
577 | .start = AB8500_INT_TEMP_WARM, | ||
578 | .end = AB8500_INT_TEMP_WARM, | ||
579 | .flags = IORESOURCE_IRQ, | ||
580 | }, | ||
581 | }; | ||
582 | |||
396 | static struct mfd_cell ab8500_devs[] = { | 583 | static struct mfd_cell ab8500_devs[] = { |
397 | #ifdef CONFIG_DEBUG_FS | 584 | #ifdef CONFIG_DEBUG_FS |
398 | { | 585 | { |
399 | .name = "ab8500-debug", | 586 | .name = "ab8500-debug", |
587 | .num_resources = ARRAY_SIZE(ab8500_debug_resources), | ||
588 | .resources = ab8500_debug_resources, | ||
400 | }, | 589 | }, |
401 | #endif | 590 | #endif |
402 | { | 591 | { |
592 | .name = "ab8500-sysctrl", | ||
593 | }, | ||
594 | { | ||
595 | .name = "ab8500-regulator", | ||
596 | }, | ||
597 | { | ||
403 | .name = "ab8500-gpadc", | 598 | .name = "ab8500-gpadc", |
404 | .num_resources = ARRAY_SIZE(ab8500_gpadc_resources), | 599 | .num_resources = ARRAY_SIZE(ab8500_gpadc_resources), |
405 | .resources = ab8500_gpadc_resources, | 600 | .resources = ab8500_gpadc_resources, |
@@ -410,6 +605,22 @@ static struct mfd_cell ab8500_devs[] = { | |||
410 | .resources = ab8500_rtc_resources, | 605 | .resources = ab8500_rtc_resources, |
411 | }, | 606 | }, |
412 | { | 607 | { |
608 | .name = "ab8500-bm", | ||
609 | .num_resources = ARRAY_SIZE(ab8500_bm_resources), | ||
610 | .resources = ab8500_bm_resources, | ||
611 | }, | ||
612 | { .name = "ab8500-codec", }, | ||
613 | { | ||
614 | .name = "ab8500-usb", | ||
615 | .num_resources = ARRAY_SIZE(ab8500_usb_resources), | ||
616 | .resources = ab8500_usb_resources, | ||
617 | }, | ||
618 | { | ||
619 | .name = "ab8500-poweron-key", | ||
620 | .num_resources = ARRAY_SIZE(ab8500_poweronkey_db_resources), | ||
621 | .resources = ab8500_poweronkey_db_resources, | ||
622 | }, | ||
623 | { | ||
413 | .name = "ab8500-pwm", | 624 | .name = "ab8500-pwm", |
414 | .id = 1, | 625 | .id = 1, |
415 | }, | 626 | }, |
@@ -421,17 +632,37 @@ static struct mfd_cell ab8500_devs[] = { | |||
421 | .name = "ab8500-pwm", | 632 | .name = "ab8500-pwm", |
422 | .id = 3, | 633 | .id = 3, |
423 | }, | 634 | }, |
424 | { .name = "ab8500-charger", }, | 635 | { .name = "ab8500-leds", }, |
425 | { .name = "ab8500-audio", }, | ||
426 | { .name = "ab8500-usb", }, | ||
427 | { .name = "ab8500-regulator", }, | ||
428 | { | 636 | { |
429 | .name = "ab8500-poweron-key", | 637 | .name = "ab8500-denc", |
430 | .num_resources = ARRAY_SIZE(ab8500_poweronkey_db_resources), | 638 | }, |
431 | .resources = ab8500_poweronkey_db_resources, | 639 | { |
640 | .name = "ab8500-temp", | ||
641 | .num_resources = ARRAY_SIZE(ab8500_temp_resources), | ||
642 | .resources = ab8500_temp_resources, | ||
432 | }, | 643 | }, |
433 | }; | 644 | }; |
434 | 645 | ||
646 | static ssize_t show_chip_id(struct device *dev, | ||
647 | struct device_attribute *attr, char *buf) | ||
648 | { | ||
649 | struct ab8500 *ab8500; | ||
650 | |||
651 | ab8500 = dev_get_drvdata(dev); | ||
652 | return sprintf(buf, "%#x\n", ab8500 ? ab8500->chip_id : -EINVAL); | ||
653 | } | ||
654 | |||
655 | static DEVICE_ATTR(chip_id, S_IRUGO, show_chip_id, NULL); | ||
656 | |||
657 | static struct attribute *ab8500_sysfs_entries[] = { | ||
658 | &dev_attr_chip_id.attr, | ||
659 | NULL, | ||
660 | }; | ||
661 | |||
662 | static struct attribute_group ab8500_attr_group = { | ||
663 | .attrs = ab8500_sysfs_entries, | ||
664 | }; | ||
665 | |||
435 | int __devinit ab8500_init(struct ab8500 *ab8500) | 666 | int __devinit ab8500_init(struct ab8500 *ab8500) |
436 | { | 667 | { |
437 | struct ab8500_platform_data *plat = dev_get_platdata(ab8500->dev); | 668 | struct ab8500_platform_data *plat = dev_get_platdata(ab8500->dev); |
@@ -454,8 +685,9 @@ int __devinit ab8500_init(struct ab8500 *ab8500) | |||
454 | * 0x0 - Early Drop | 685 | * 0x0 - Early Drop |
455 | * 0x10 - Cut 1.0 | 686 | * 0x10 - Cut 1.0 |
456 | * 0x11 - Cut 1.1 | 687 | * 0x11 - Cut 1.1 |
688 | * 0x20 - Cut 2.0 | ||
457 | */ | 689 | */ |
458 | if (value == 0x0 || value == 0x10 || value == 0x11) { | 690 | if (value == 0x0 || value == 0x10 || value == 0x11 || value == 0x20) { |
459 | ab8500->revision = value; | 691 | ab8500->revision = value; |
460 | dev_info(ab8500->dev, "detected chip, revision: %#x\n", value); | 692 | dev_info(ab8500->dev, "detected chip, revision: %#x\n", value); |
461 | } else { | 693 | } else { |
@@ -468,18 +700,16 @@ int __devinit ab8500_init(struct ab8500 *ab8500) | |||
468 | plat->init(ab8500); | 700 | plat->init(ab8500); |
469 | 701 | ||
470 | /* Clear and mask all interrupts */ | 702 | /* Clear and mask all interrupts */ |
471 | for (i = 0; i < 10; i++) { | 703 | for (i = 0; i < AB8500_NUM_IRQ_REGS; i++) { |
472 | get_register_interruptible(ab8500, AB8500_INTERRUPT, | 704 | /* Interrupt register 12 does'nt exist prior to version 0x20 */ |
473 | AB8500_IT_LATCH1_REG + i, &value); | 705 | if (ab8500_irq_regoffset[i] == 11 && ab8500->chip_id < 0x20) |
474 | set_register_interruptible(ab8500, AB8500_INTERRUPT, | 706 | continue; |
475 | AB8500_IT_MASK1_REG + i, 0xff); | ||
476 | } | ||
477 | 707 | ||
478 | for (i = 18; i < 24; i++) { | ||
479 | get_register_interruptible(ab8500, AB8500_INTERRUPT, | 708 | get_register_interruptible(ab8500, AB8500_INTERRUPT, |
480 | AB8500_IT_LATCH1_REG + i, &value); | 709 | AB8500_IT_LATCH1_REG + ab8500_irq_regoffset[i], |
710 | &value); | ||
481 | set_register_interruptible(ab8500, AB8500_INTERRUPT, | 711 | set_register_interruptible(ab8500, AB8500_INTERRUPT, |
482 | AB8500_IT_MASK1_REG + i, 0xff); | 712 | AB8500_IT_MASK1_REG + ab8500_irq_regoffset[i], 0xff); |
483 | } | 713 | } |
484 | 714 | ||
485 | ret = abx500_register_ops(ab8500->dev, &ab8500_ops); | 715 | ret = abx500_register_ops(ab8500->dev, &ab8500_ops); |
@@ -495,7 +725,8 @@ int __devinit ab8500_init(struct ab8500 *ab8500) | |||
495 | return ret; | 725 | return ret; |
496 | 726 | ||
497 | ret = request_threaded_irq(ab8500->irq, NULL, ab8500_irq, | 727 | ret = request_threaded_irq(ab8500->irq, NULL, ab8500_irq, |
498 | IRQF_ONESHOT, "ab8500", ab8500); | 728 | IRQF_ONESHOT | IRQF_NO_SUSPEND, |
729 | "ab8500", ab8500); | ||
499 | if (ret) | 730 | if (ret) |
500 | goto out_removeirq; | 731 | goto out_removeirq; |
501 | } | 732 | } |
@@ -506,6 +737,10 @@ int __devinit ab8500_init(struct ab8500 *ab8500) | |||
506 | if (ret) | 737 | if (ret) |
507 | goto out_freeirq; | 738 | goto out_freeirq; |
508 | 739 | ||
740 | ret = sysfs_create_group(&ab8500->dev->kobj, &ab8500_attr_group); | ||
741 | if (ret) | ||
742 | dev_err(ab8500->dev, "error creating sysfs entries\n"); | ||
743 | |||
509 | return ret; | 744 | return ret; |
510 | 745 | ||
511 | out_freeirq: | 746 | out_freeirq: |
@@ -519,6 +754,7 @@ out_removeirq: | |||
519 | 754 | ||
520 | int __devexit ab8500_exit(struct ab8500 *ab8500) | 755 | int __devexit ab8500_exit(struct ab8500 *ab8500) |
521 | { | 756 | { |
757 | sysfs_remove_group(&ab8500->dev->kobj, &ab8500_attr_group); | ||
522 | mfd_remove_devices(ab8500->dev); | 758 | mfd_remove_devices(ab8500->dev); |
523 | if (ab8500->irq_base) { | 759 | if (ab8500->irq_base) { |
524 | free_irq(ab8500->irq, ab8500); | 760 | free_irq(ab8500->irq, ab8500); |
diff --git a/drivers/mfd/ab8500-debugfs.c b/drivers/mfd/ab8500-debugfs.c index 8d1e05a39815..3c1541ae7223 100644 --- a/drivers/mfd/ab8500-debugfs.c +++ b/drivers/mfd/ab8500-debugfs.c | |||
@@ -24,9 +24,9 @@ static u32 debug_address; | |||
24 | * @perm: access permissions for the range | 24 | * @perm: access permissions for the range |
25 | */ | 25 | */ |
26 | struct ab8500_reg_range { | 26 | struct ab8500_reg_range { |
27 | u8 first; | 27 | u8 first; |
28 | u8 last; | 28 | u8 last; |
29 | u8 perm; | 29 | u8 perm; |
30 | }; | 30 | }; |
31 | 31 | ||
32 | /** | 32 | /** |
@@ -36,9 +36,9 @@ struct ab8500_reg_range { | |||
36 | * @range: the list of register ranges | 36 | * @range: the list of register ranges |
37 | */ | 37 | */ |
38 | struct ab8500_i2c_ranges { | 38 | struct ab8500_i2c_ranges { |
39 | u8 num_ranges; | 39 | u8 num_ranges; |
40 | u8 bankid; | 40 | u8 bankid; |
41 | const struct ab8500_reg_range *range; | 41 | const struct ab8500_reg_range *range; |
42 | }; | 42 | }; |
43 | 43 | ||
44 | #define AB8500_NAME_STRING "ab8500" | 44 | #define AB8500_NAME_STRING "ab8500" |
@@ -47,521 +47,521 @@ struct ab8500_i2c_ranges { | |||
47 | #define AB8500_REV_REG 0x80 | 47 | #define AB8500_REV_REG 0x80 |
48 | 48 | ||
49 | static struct ab8500_i2c_ranges debug_ranges[AB8500_NUM_BANKS] = { | 49 | static struct ab8500_i2c_ranges debug_ranges[AB8500_NUM_BANKS] = { |
50 | [0x0] = { | 50 | [0x0] = { |
51 | .num_ranges = 0, | 51 | .num_ranges = 0, |
52 | .range = 0, | 52 | .range = 0, |
53 | }, | 53 | }, |
54 | [AB8500_SYS_CTRL1_BLOCK] = { | 54 | [AB8500_SYS_CTRL1_BLOCK] = { |
55 | .num_ranges = 3, | 55 | .num_ranges = 3, |
56 | .range = (struct ab8500_reg_range[]) { | 56 | .range = (struct ab8500_reg_range[]) { |
57 | { | 57 | { |
58 | .first = 0x00, | 58 | .first = 0x00, |
59 | .last = 0x02, | 59 | .last = 0x02, |
60 | }, | 60 | }, |
61 | { | 61 | { |
62 | .first = 0x42, | 62 | .first = 0x42, |
63 | .last = 0x42, | 63 | .last = 0x42, |
64 | }, | 64 | }, |
65 | { | 65 | { |
66 | .first = 0x80, | 66 | .first = 0x80, |
67 | .last = 0x81, | 67 | .last = 0x81, |
68 | }, | 68 | }, |
69 | }, | 69 | }, |
70 | }, | 70 | }, |
71 | [AB8500_SYS_CTRL2_BLOCK] = { | 71 | [AB8500_SYS_CTRL2_BLOCK] = { |
72 | .num_ranges = 4, | 72 | .num_ranges = 4, |
73 | .range = (struct ab8500_reg_range[]) { | 73 | .range = (struct ab8500_reg_range[]) { |
74 | { | 74 | { |
75 | .first = 0x00, | 75 | .first = 0x00, |
76 | .last = 0x0D, | 76 | .last = 0x0D, |
77 | }, | 77 | }, |
78 | { | 78 | { |
79 | .first = 0x0F, | 79 | .first = 0x0F, |
80 | .last = 0x17, | 80 | .last = 0x17, |
81 | }, | 81 | }, |
82 | { | 82 | { |
83 | .first = 0x30, | 83 | .first = 0x30, |
84 | .last = 0x30, | 84 | .last = 0x30, |
85 | }, | 85 | }, |
86 | { | 86 | { |
87 | .first = 0x32, | 87 | .first = 0x32, |
88 | .last = 0x33, | 88 | .last = 0x33, |
89 | }, | 89 | }, |
90 | }, | 90 | }, |
91 | }, | 91 | }, |
92 | [AB8500_REGU_CTRL1] = { | 92 | [AB8500_REGU_CTRL1] = { |
93 | .num_ranges = 3, | 93 | .num_ranges = 3, |
94 | .range = (struct ab8500_reg_range[]) { | 94 | .range = (struct ab8500_reg_range[]) { |
95 | { | 95 | { |
96 | .first = 0x00, | 96 | .first = 0x00, |
97 | .last = 0x00, | 97 | .last = 0x00, |
98 | }, | 98 | }, |
99 | { | 99 | { |
100 | .first = 0x03, | 100 | .first = 0x03, |
101 | .last = 0x10, | 101 | .last = 0x10, |
102 | }, | 102 | }, |
103 | { | 103 | { |
104 | .first = 0x80, | 104 | .first = 0x80, |
105 | .last = 0x84, | 105 | .last = 0x84, |
106 | }, | 106 | }, |
107 | }, | 107 | }, |
108 | }, | 108 | }, |
109 | [AB8500_REGU_CTRL2] = { | 109 | [AB8500_REGU_CTRL2] = { |
110 | .num_ranges = 5, | 110 | .num_ranges = 5, |
111 | .range = (struct ab8500_reg_range[]) { | 111 | .range = (struct ab8500_reg_range[]) { |
112 | { | 112 | { |
113 | .first = 0x00, | 113 | .first = 0x00, |
114 | .last = 0x15, | 114 | .last = 0x15, |
115 | }, | 115 | }, |
116 | { | 116 | { |
117 | .first = 0x17, | 117 | .first = 0x17, |
118 | .last = 0x19, | 118 | .last = 0x19, |
119 | }, | 119 | }, |
120 | { | 120 | { |
121 | .first = 0x1B, | 121 | .first = 0x1B, |
122 | .last = 0x1D, | 122 | .last = 0x1D, |
123 | }, | 123 | }, |
124 | { | 124 | { |
125 | .first = 0x1F, | 125 | .first = 0x1F, |
126 | .last = 0x22, | 126 | .last = 0x22, |
127 | }, | 127 | }, |
128 | { | 128 | { |
129 | .first = 0x40, | 129 | .first = 0x40, |
130 | .last = 0x44, | 130 | .last = 0x44, |
131 | }, | 131 | }, |
132 | /* 0x80-0x8B is SIM registers and should | 132 | /* 0x80-0x8B is SIM registers and should |
133 | * not be accessed from here */ | 133 | * not be accessed from here */ |
134 | }, | 134 | }, |
135 | }, | 135 | }, |
136 | [AB8500_USB] = { | 136 | [AB8500_USB] = { |
137 | .num_ranges = 2, | 137 | .num_ranges = 2, |
138 | .range = (struct ab8500_reg_range[]) { | 138 | .range = (struct ab8500_reg_range[]) { |
139 | { | 139 | { |
140 | .first = 0x80, | 140 | .first = 0x80, |
141 | .last = 0x83, | 141 | .last = 0x83, |
142 | }, | 142 | }, |
143 | { | 143 | { |
144 | .first = 0x87, | 144 | .first = 0x87, |
145 | .last = 0x8A, | 145 | .last = 0x8A, |
146 | }, | 146 | }, |
147 | }, | 147 | }, |
148 | }, | 148 | }, |
149 | [AB8500_TVOUT] = { | 149 | [AB8500_TVOUT] = { |
150 | .num_ranges = 9, | 150 | .num_ranges = 9, |
151 | .range = (struct ab8500_reg_range[]) { | 151 | .range = (struct ab8500_reg_range[]) { |
152 | { | 152 | { |
153 | .first = 0x00, | 153 | .first = 0x00, |
154 | .last = 0x12, | 154 | .last = 0x12, |
155 | }, | 155 | }, |
156 | { | 156 | { |
157 | .first = 0x15, | 157 | .first = 0x15, |
158 | .last = 0x17, | 158 | .last = 0x17, |
159 | }, | 159 | }, |
160 | { | 160 | { |
161 | .first = 0x19, | 161 | .first = 0x19, |
162 | .last = 0x21, | 162 | .last = 0x21, |
163 | }, | 163 | }, |
164 | { | 164 | { |
165 | .first = 0x27, | 165 | .first = 0x27, |
166 | .last = 0x2C, | 166 | .last = 0x2C, |
167 | }, | 167 | }, |
168 | { | 168 | { |
169 | .first = 0x41, | 169 | .first = 0x41, |
170 | .last = 0x41, | 170 | .last = 0x41, |
171 | }, | 171 | }, |
172 | { | 172 | { |
173 | .first = 0x45, | 173 | .first = 0x45, |
174 | .last = 0x5B, | 174 | .last = 0x5B, |
175 | }, | 175 | }, |
176 | { | 176 | { |
177 | .first = 0x5D, | 177 | .first = 0x5D, |
178 | .last = 0x5D, | 178 | .last = 0x5D, |
179 | }, | 179 | }, |
180 | { | 180 | { |
181 | .first = 0x69, | 181 | .first = 0x69, |
182 | .last = 0x69, | 182 | .last = 0x69, |
183 | }, | 183 | }, |
184 | { | 184 | { |
185 | .first = 0x80, | 185 | .first = 0x80, |
186 | .last = 0x81, | 186 | .last = 0x81, |
187 | }, | 187 | }, |
188 | }, | 188 | }, |
189 | }, | 189 | }, |
190 | [AB8500_DBI] = { | 190 | [AB8500_DBI] = { |
191 | .num_ranges = 0, | 191 | .num_ranges = 0, |
192 | .range = 0, | 192 | .range = NULL, |
193 | }, | 193 | }, |
194 | [AB8500_ECI_AV_ACC] = { | 194 | [AB8500_ECI_AV_ACC] = { |
195 | .num_ranges = 1, | 195 | .num_ranges = 1, |
196 | .range = (struct ab8500_reg_range[]) { | 196 | .range = (struct ab8500_reg_range[]) { |
197 | { | 197 | { |
198 | .first = 0x80, | 198 | .first = 0x80, |
199 | .last = 0x82, | 199 | .last = 0x82, |
200 | }, | 200 | }, |
201 | }, | 201 | }, |
202 | }, | 202 | }, |
203 | [0x9] = { | 203 | [0x9] = { |
204 | .num_ranges = 0, | 204 | .num_ranges = 0, |
205 | .range = 0, | 205 | .range = NULL, |
206 | }, | 206 | }, |
207 | [AB8500_GPADC] = { | 207 | [AB8500_GPADC] = { |
208 | .num_ranges = 1, | 208 | .num_ranges = 1, |
209 | .range = (struct ab8500_reg_range[]) { | 209 | .range = (struct ab8500_reg_range[]) { |
210 | { | 210 | { |
211 | .first = 0x00, | 211 | .first = 0x00, |
212 | .last = 0x08, | 212 | .last = 0x08, |
213 | }, | 213 | }, |
214 | }, | 214 | }, |
215 | }, | 215 | }, |
216 | [AB8500_CHARGER] = { | 216 | [AB8500_CHARGER] = { |
217 | .num_ranges = 8, | 217 | .num_ranges = 8, |
218 | .range = (struct ab8500_reg_range[]) { | 218 | .range = (struct ab8500_reg_range[]) { |
219 | { | 219 | { |
220 | .first = 0x00, | 220 | .first = 0x00, |
221 | .last = 0x03, | 221 | .last = 0x03, |
222 | }, | 222 | }, |
223 | { | 223 | { |
224 | .first = 0x05, | 224 | .first = 0x05, |
225 | .last = 0x05, | 225 | .last = 0x05, |
226 | }, | 226 | }, |
227 | { | 227 | { |
228 | .first = 0x40, | 228 | .first = 0x40, |
229 | .last = 0x40, | 229 | .last = 0x40, |
230 | }, | 230 | }, |
231 | { | 231 | { |
232 | .first = 0x42, | 232 | .first = 0x42, |
233 | .last = 0x42, | 233 | .last = 0x42, |
234 | }, | 234 | }, |
235 | { | 235 | { |
236 | .first = 0x44, | 236 | .first = 0x44, |
237 | .last = 0x44, | 237 | .last = 0x44, |
238 | }, | 238 | }, |
239 | { | 239 | { |
240 | .first = 0x50, | 240 | .first = 0x50, |
241 | .last = 0x55, | 241 | .last = 0x55, |
242 | }, | 242 | }, |
243 | { | 243 | { |
244 | .first = 0x80, | 244 | .first = 0x80, |
245 | .last = 0x82, | 245 | .last = 0x82, |
246 | }, | 246 | }, |
247 | { | 247 | { |
248 | .first = 0xC0, | 248 | .first = 0xC0, |
249 | .last = 0xC2, | 249 | .last = 0xC2, |
250 | }, | 250 | }, |
251 | }, | 251 | }, |
252 | }, | 252 | }, |
253 | [AB8500_GAS_GAUGE] = { | 253 | [AB8500_GAS_GAUGE] = { |
254 | .num_ranges = 3, | 254 | .num_ranges = 3, |
255 | .range = (struct ab8500_reg_range[]) { | 255 | .range = (struct ab8500_reg_range[]) { |
256 | { | 256 | { |
257 | .first = 0x00, | 257 | .first = 0x00, |
258 | .last = 0x00, | 258 | .last = 0x00, |
259 | }, | 259 | }, |
260 | { | 260 | { |
261 | .first = 0x07, | 261 | .first = 0x07, |
262 | .last = 0x0A, | 262 | .last = 0x0A, |
263 | }, | 263 | }, |
264 | { | 264 | { |
265 | .first = 0x10, | 265 | .first = 0x10, |
266 | .last = 0x14, | 266 | .last = 0x14, |
267 | }, | 267 | }, |
268 | }, | 268 | }, |
269 | }, | 269 | }, |
270 | [AB8500_AUDIO] = { | 270 | [AB8500_AUDIO] = { |
271 | .num_ranges = 1, | 271 | .num_ranges = 1, |
272 | .range = (struct ab8500_reg_range[]) { | 272 | .range = (struct ab8500_reg_range[]) { |
273 | { | 273 | { |
274 | .first = 0x00, | 274 | .first = 0x00, |
275 | .last = 0x6F, | 275 | .last = 0x6F, |
276 | }, | 276 | }, |
277 | }, | 277 | }, |
278 | }, | 278 | }, |
279 | [AB8500_INTERRUPT] = { | 279 | [AB8500_INTERRUPT] = { |
280 | .num_ranges = 0, | 280 | .num_ranges = 0, |
281 | .range = 0, | 281 | .range = NULL, |
282 | }, | 282 | }, |
283 | [AB8500_RTC] = { | 283 | [AB8500_RTC] = { |
284 | .num_ranges = 1, | 284 | .num_ranges = 1, |
285 | .range = (struct ab8500_reg_range[]) { | 285 | .range = (struct ab8500_reg_range[]) { |
286 | { | 286 | { |
287 | .first = 0x00, | 287 | .first = 0x00, |
288 | .last = 0x0F, | 288 | .last = 0x0F, |
289 | }, | 289 | }, |
290 | }, | 290 | }, |
291 | }, | 291 | }, |
292 | [AB8500_MISC] = { | 292 | [AB8500_MISC] = { |
293 | .num_ranges = 8, | 293 | .num_ranges = 8, |
294 | .range = (struct ab8500_reg_range[]) { | 294 | .range = (struct ab8500_reg_range[]) { |
295 | { | 295 | { |
296 | .first = 0x00, | 296 | .first = 0x00, |
297 | .last = 0x05, | 297 | .last = 0x05, |
298 | }, | 298 | }, |
299 | { | 299 | { |
300 | .first = 0x10, | 300 | .first = 0x10, |
301 | .last = 0x15, | 301 | .last = 0x15, |
302 | }, | 302 | }, |
303 | { | 303 | { |
304 | .first = 0x20, | 304 | .first = 0x20, |
305 | .last = 0x25, | 305 | .last = 0x25, |
306 | }, | 306 | }, |
307 | { | 307 | { |
308 | .first = 0x30, | 308 | .first = 0x30, |
309 | .last = 0x35, | 309 | .last = 0x35, |
310 | }, | 310 | }, |
311 | { | 311 | { |
312 | .first = 0x40, | 312 | .first = 0x40, |
313 | .last = 0x45, | 313 | .last = 0x45, |
314 | }, | 314 | }, |
315 | { | 315 | { |
316 | .first = 0x50, | 316 | .first = 0x50, |
317 | .last = 0x50, | 317 | .last = 0x50, |
318 | }, | 318 | }, |
319 | { | 319 | { |
320 | .first = 0x60, | 320 | .first = 0x60, |
321 | .last = 0x67, | 321 | .last = 0x67, |
322 | }, | 322 | }, |
323 | { | 323 | { |
324 | .first = 0x80, | 324 | .first = 0x80, |
325 | .last = 0x80, | 325 | .last = 0x80, |
326 | }, | 326 | }, |
327 | }, | 327 | }, |
328 | }, | 328 | }, |
329 | [0x11] = { | 329 | [0x11] = { |
330 | .num_ranges = 0, | 330 | .num_ranges = 0, |
331 | .range = 0, | 331 | .range = NULL, |
332 | }, | 332 | }, |
333 | [0x12] = { | 333 | [0x12] = { |
334 | .num_ranges = 0, | 334 | .num_ranges = 0, |
335 | .range = 0, | 335 | .range = NULL, |
336 | }, | 336 | }, |
337 | [0x13] = { | 337 | [0x13] = { |
338 | .num_ranges = 0, | 338 | .num_ranges = 0, |
339 | .range = 0, | 339 | .range = NULL, |
340 | }, | 340 | }, |
341 | [0x14] = { | 341 | [0x14] = { |
342 | .num_ranges = 0, | 342 | .num_ranges = 0, |
343 | .range = 0, | 343 | .range = NULL, |
344 | }, | 344 | }, |
345 | [AB8500_OTP_EMUL] = { | 345 | [AB8500_OTP_EMUL] = { |
346 | .num_ranges = 1, | 346 | .num_ranges = 1, |
347 | .range = (struct ab8500_reg_range[]) { | 347 | .range = (struct ab8500_reg_range[]) { |
348 | { | 348 | { |
349 | .first = 0x01, | 349 | .first = 0x01, |
350 | .last = 0x0F, | 350 | .last = 0x0F, |
351 | }, | 351 | }, |
352 | }, | 352 | }, |
353 | }, | 353 | }, |
354 | }; | 354 | }; |
355 | 355 | ||
356 | static int ab8500_registers_print(struct seq_file *s, void *p) | 356 | static int ab8500_registers_print(struct seq_file *s, void *p) |
357 | { | 357 | { |
358 | struct device *dev = s->private; | 358 | struct device *dev = s->private; |
359 | unsigned int i; | 359 | unsigned int i; |
360 | u32 bank = debug_bank; | 360 | u32 bank = debug_bank; |
361 | 361 | ||
362 | seq_printf(s, AB8500_NAME_STRING " register values:\n"); | 362 | seq_printf(s, AB8500_NAME_STRING " register values:\n"); |
363 | 363 | ||
364 | seq_printf(s, " bank %u:\n", bank); | 364 | seq_printf(s, " bank %u:\n", bank); |
365 | for (i = 0; i < debug_ranges[bank].num_ranges; i++) { | 365 | for (i = 0; i < debug_ranges[bank].num_ranges; i++) { |
366 | u32 reg; | 366 | u32 reg; |
367 | 367 | ||
368 | for (reg = debug_ranges[bank].range[i].first; | 368 | for (reg = debug_ranges[bank].range[i].first; |
369 | reg <= debug_ranges[bank].range[i].last; | 369 | reg <= debug_ranges[bank].range[i].last; |
370 | reg++) { | 370 | reg++) { |
371 | u8 value; | 371 | u8 value; |
372 | int err; | 372 | int err; |
373 | 373 | ||
374 | err = abx500_get_register_interruptible(dev, | 374 | err = abx500_get_register_interruptible(dev, |
375 | (u8)bank, (u8)reg, &value); | 375 | (u8)bank, (u8)reg, &value); |
376 | if (err < 0) { | 376 | if (err < 0) { |
377 | dev_err(dev, "ab->read fail %d\n", err); | 377 | dev_err(dev, "ab->read fail %d\n", err); |
378 | return err; | 378 | return err; |
379 | } | 379 | } |
380 | 380 | ||
381 | err = seq_printf(s, " [%u/0x%02X]: 0x%02X\n", bank, | 381 | err = seq_printf(s, " [%u/0x%02X]: 0x%02X\n", bank, |
382 | reg, value); | 382 | reg, value); |
383 | if (err < 0) { | 383 | if (err < 0) { |
384 | dev_err(dev, "seq_printf overflow\n"); | 384 | dev_err(dev, "seq_printf overflow\n"); |
385 | /* Error is not returned here since | 385 | /* Error is not returned here since |
386 | * the output is wanted in any case */ | 386 | * the output is wanted in any case */ |
387 | return 0; | 387 | return 0; |
388 | } | 388 | } |
389 | } | 389 | } |
390 | } | 390 | } |
391 | return 0; | 391 | return 0; |
392 | } | 392 | } |
393 | 393 | ||
394 | static int ab8500_registers_open(struct inode *inode, struct file *file) | 394 | static int ab8500_registers_open(struct inode *inode, struct file *file) |
395 | { | 395 | { |
396 | return single_open(file, ab8500_registers_print, inode->i_private); | 396 | return single_open(file, ab8500_registers_print, inode->i_private); |
397 | } | 397 | } |
398 | 398 | ||
399 | static const struct file_operations ab8500_registers_fops = { | 399 | static const struct file_operations ab8500_registers_fops = { |
400 | .open = ab8500_registers_open, | 400 | .open = ab8500_registers_open, |
401 | .read = seq_read, | 401 | .read = seq_read, |
402 | .llseek = seq_lseek, | 402 | .llseek = seq_lseek, |
403 | .release = single_release, | 403 | .release = single_release, |
404 | .owner = THIS_MODULE, | 404 | .owner = THIS_MODULE, |
405 | }; | 405 | }; |
406 | 406 | ||
407 | static int ab8500_bank_print(struct seq_file *s, void *p) | 407 | static int ab8500_bank_print(struct seq_file *s, void *p) |
408 | { | 408 | { |
409 | return seq_printf(s, "%d\n", debug_bank); | 409 | return seq_printf(s, "%d\n", debug_bank); |
410 | } | 410 | } |
411 | 411 | ||
412 | static int ab8500_bank_open(struct inode *inode, struct file *file) | 412 | static int ab8500_bank_open(struct inode *inode, struct file *file) |
413 | { | 413 | { |
414 | return single_open(file, ab8500_bank_print, inode->i_private); | 414 | return single_open(file, ab8500_bank_print, inode->i_private); |
415 | } | 415 | } |
416 | 416 | ||
417 | static ssize_t ab8500_bank_write(struct file *file, | 417 | static ssize_t ab8500_bank_write(struct file *file, |
418 | const char __user *user_buf, | 418 | const char __user *user_buf, |
419 | size_t count, loff_t *ppos) | 419 | size_t count, loff_t *ppos) |
420 | { | 420 | { |
421 | struct device *dev = ((struct seq_file *)(file->private_data))->private; | 421 | struct device *dev = ((struct seq_file *)(file->private_data))->private; |
422 | char buf[32]; | 422 | char buf[32]; |
423 | int buf_size; | 423 | int buf_size; |
424 | unsigned long user_bank; | 424 | unsigned long user_bank; |
425 | int err; | 425 | int err; |
426 | 426 | ||
427 | /* Get userspace string and assure termination */ | 427 | /* Get userspace string and assure termination */ |
428 | buf_size = min(count, (sizeof(buf) - 1)); | 428 | buf_size = min(count, (sizeof(buf) - 1)); |
429 | if (copy_from_user(buf, user_buf, buf_size)) | 429 | if (copy_from_user(buf, user_buf, buf_size)) |
430 | return -EFAULT; | 430 | return -EFAULT; |
431 | buf[buf_size] = 0; | 431 | buf[buf_size] = 0; |
432 | 432 | ||
433 | err = strict_strtoul(buf, 0, &user_bank); | 433 | err = strict_strtoul(buf, 0, &user_bank); |
434 | if (err) | 434 | if (err) |
435 | return -EINVAL; | 435 | return -EINVAL; |
436 | 436 | ||
437 | if (user_bank >= AB8500_NUM_BANKS) { | 437 | if (user_bank >= AB8500_NUM_BANKS) { |
438 | dev_err(dev, "debugfs error input > number of banks\n"); | 438 | dev_err(dev, "debugfs error input > number of banks\n"); |
439 | return -EINVAL; | 439 | return -EINVAL; |
440 | } | 440 | } |
441 | 441 | ||
442 | debug_bank = user_bank; | 442 | debug_bank = user_bank; |
443 | 443 | ||
444 | return buf_size; | 444 | return buf_size; |
445 | } | 445 | } |
446 | 446 | ||
447 | static int ab8500_address_print(struct seq_file *s, void *p) | 447 | static int ab8500_address_print(struct seq_file *s, void *p) |
448 | { | 448 | { |
449 | return seq_printf(s, "0x%02X\n", debug_address); | 449 | return seq_printf(s, "0x%02X\n", debug_address); |
450 | } | 450 | } |
451 | 451 | ||
452 | static int ab8500_address_open(struct inode *inode, struct file *file) | 452 | static int ab8500_address_open(struct inode *inode, struct file *file) |
453 | { | 453 | { |
454 | return single_open(file, ab8500_address_print, inode->i_private); | 454 | return single_open(file, ab8500_address_print, inode->i_private); |
455 | } | 455 | } |
456 | 456 | ||
457 | static ssize_t ab8500_address_write(struct file *file, | 457 | static ssize_t ab8500_address_write(struct file *file, |
458 | const char __user *user_buf, | 458 | const char __user *user_buf, |
459 | size_t count, loff_t *ppos) | 459 | size_t count, loff_t *ppos) |
460 | { | 460 | { |
461 | struct device *dev = ((struct seq_file *)(file->private_data))->private; | 461 | struct device *dev = ((struct seq_file *)(file->private_data))->private; |
462 | char buf[32]; | 462 | char buf[32]; |
463 | int buf_size; | 463 | int buf_size; |
464 | unsigned long user_address; | 464 | unsigned long user_address; |
465 | int err; | 465 | int err; |
466 | 466 | ||
467 | /* Get userspace string and assure termination */ | 467 | /* Get userspace string and assure termination */ |
468 | buf_size = min(count, (sizeof(buf) - 1)); | 468 | buf_size = min(count, (sizeof(buf) - 1)); |
469 | if (copy_from_user(buf, user_buf, buf_size)) | 469 | if (copy_from_user(buf, user_buf, buf_size)) |
470 | return -EFAULT; | 470 | return -EFAULT; |
471 | buf[buf_size] = 0; | 471 | buf[buf_size] = 0; |
472 | 472 | ||
473 | err = strict_strtoul(buf, 0, &user_address); | 473 | err = strict_strtoul(buf, 0, &user_address); |
474 | if (err) | 474 | if (err) |
475 | return -EINVAL; | 475 | return -EINVAL; |
476 | if (user_address > 0xff) { | 476 | if (user_address > 0xff) { |
477 | dev_err(dev, "debugfs error input > 0xff\n"); | 477 | dev_err(dev, "debugfs error input > 0xff\n"); |
478 | return -EINVAL; | 478 | return -EINVAL; |
479 | } | 479 | } |
480 | debug_address = user_address; | 480 | debug_address = user_address; |
481 | return buf_size; | 481 | return buf_size; |
482 | } | 482 | } |
483 | 483 | ||
484 | static int ab8500_val_print(struct seq_file *s, void *p) | 484 | static int ab8500_val_print(struct seq_file *s, void *p) |
485 | { | 485 | { |
486 | struct device *dev = s->private; | 486 | struct device *dev = s->private; |
487 | int ret; | 487 | int ret; |
488 | u8 regvalue; | 488 | u8 regvalue; |
489 | 489 | ||
490 | ret = abx500_get_register_interruptible(dev, | 490 | ret = abx500_get_register_interruptible(dev, |
491 | (u8)debug_bank, (u8)debug_address, ®value); | 491 | (u8)debug_bank, (u8)debug_address, ®value); |
492 | if (ret < 0) { | 492 | if (ret < 0) { |
493 | dev_err(dev, "abx500_get_reg fail %d, %d\n", | 493 | dev_err(dev, "abx500_get_reg fail %d, %d\n", |
494 | ret, __LINE__); | 494 | ret, __LINE__); |
495 | return -EINVAL; | 495 | return -EINVAL; |
496 | } | 496 | } |
497 | seq_printf(s, "0x%02X\n", regvalue); | 497 | seq_printf(s, "0x%02X\n", regvalue); |
498 | 498 | ||
499 | return 0; | 499 | return 0; |
500 | } | 500 | } |
501 | 501 | ||
502 | static int ab8500_val_open(struct inode *inode, struct file *file) | 502 | static int ab8500_val_open(struct inode *inode, struct file *file) |
503 | { | 503 | { |
504 | return single_open(file, ab8500_val_print, inode->i_private); | 504 | return single_open(file, ab8500_val_print, inode->i_private); |
505 | } | 505 | } |
506 | 506 | ||
507 | static ssize_t ab8500_val_write(struct file *file, | 507 | static ssize_t ab8500_val_write(struct file *file, |
508 | const char __user *user_buf, | 508 | const char __user *user_buf, |
509 | size_t count, loff_t *ppos) | 509 | size_t count, loff_t *ppos) |
510 | { | 510 | { |
511 | struct device *dev = ((struct seq_file *)(file->private_data))->private; | 511 | struct device *dev = ((struct seq_file *)(file->private_data))->private; |
512 | char buf[32]; | 512 | char buf[32]; |
513 | int buf_size; | 513 | int buf_size; |
514 | unsigned long user_val; | 514 | unsigned long user_val; |
515 | int err; | 515 | int err; |
516 | 516 | ||
517 | /* Get userspace string and assure termination */ | 517 | /* Get userspace string and assure termination */ |
518 | buf_size = min(count, (sizeof(buf)-1)); | 518 | buf_size = min(count, (sizeof(buf)-1)); |
519 | if (copy_from_user(buf, user_buf, buf_size)) | 519 | if (copy_from_user(buf, user_buf, buf_size)) |
520 | return -EFAULT; | 520 | return -EFAULT; |
521 | buf[buf_size] = 0; | 521 | buf[buf_size] = 0; |
522 | 522 | ||
523 | err = strict_strtoul(buf, 0, &user_val); | 523 | err = strict_strtoul(buf, 0, &user_val); |
524 | if (err) | 524 | if (err) |
525 | return -EINVAL; | 525 | return -EINVAL; |
526 | if (user_val > 0xff) { | 526 | if (user_val > 0xff) { |
527 | dev_err(dev, "debugfs error input > 0xff\n"); | 527 | dev_err(dev, "debugfs error input > 0xff\n"); |
528 | return -EINVAL; | 528 | return -EINVAL; |
529 | } | 529 | } |
530 | err = abx500_set_register_interruptible(dev, | 530 | err = abx500_set_register_interruptible(dev, |
531 | (u8)debug_bank, debug_address, (u8)user_val); | 531 | (u8)debug_bank, debug_address, (u8)user_val); |
532 | if (err < 0) { | 532 | if (err < 0) { |
533 | printk(KERN_ERR "abx500_set_reg failed %d, %d", err, __LINE__); | 533 | printk(KERN_ERR "abx500_set_reg failed %d, %d", err, __LINE__); |
534 | return -EINVAL; | 534 | return -EINVAL; |
535 | } | 535 | } |
536 | 536 | ||
537 | return buf_size; | 537 | return buf_size; |
538 | } | 538 | } |
539 | 539 | ||
540 | static const struct file_operations ab8500_bank_fops = { | 540 | static const struct file_operations ab8500_bank_fops = { |
541 | .open = ab8500_bank_open, | 541 | .open = ab8500_bank_open, |
542 | .write = ab8500_bank_write, | 542 | .write = ab8500_bank_write, |
543 | .read = seq_read, | 543 | .read = seq_read, |
544 | .llseek = seq_lseek, | 544 | .llseek = seq_lseek, |
545 | .release = single_release, | 545 | .release = single_release, |
546 | .owner = THIS_MODULE, | 546 | .owner = THIS_MODULE, |
547 | }; | 547 | }; |
548 | 548 | ||
549 | static const struct file_operations ab8500_address_fops = { | 549 | static const struct file_operations ab8500_address_fops = { |
550 | .open = ab8500_address_open, | 550 | .open = ab8500_address_open, |
551 | .write = ab8500_address_write, | 551 | .write = ab8500_address_write, |
552 | .read = seq_read, | 552 | .read = seq_read, |
553 | .llseek = seq_lseek, | 553 | .llseek = seq_lseek, |
554 | .release = single_release, | 554 | .release = single_release, |
555 | .owner = THIS_MODULE, | 555 | .owner = THIS_MODULE, |
556 | }; | 556 | }; |
557 | 557 | ||
558 | static const struct file_operations ab8500_val_fops = { | 558 | static const struct file_operations ab8500_val_fops = { |
559 | .open = ab8500_val_open, | 559 | .open = ab8500_val_open, |
560 | .write = ab8500_val_write, | 560 | .write = ab8500_val_write, |
561 | .read = seq_read, | 561 | .read = seq_read, |
562 | .llseek = seq_lseek, | 562 | .llseek = seq_lseek, |
563 | .release = single_release, | 563 | .release = single_release, |
564 | .owner = THIS_MODULE, | 564 | .owner = THIS_MODULE, |
565 | }; | 565 | }; |
566 | 566 | ||
567 | static struct dentry *ab8500_dir; | 567 | static struct dentry *ab8500_dir; |
@@ -572,77 +572,77 @@ static struct dentry *ab8500_val_file; | |||
572 | 572 | ||
573 | static int __devinit ab8500_debug_probe(struct platform_device *plf) | 573 | static int __devinit ab8500_debug_probe(struct platform_device *plf) |
574 | { | 574 | { |
575 | debug_bank = AB8500_MISC; | 575 | debug_bank = AB8500_MISC; |
576 | debug_address = AB8500_REV_REG & 0x00FF; | 576 | debug_address = AB8500_REV_REG & 0x00FF; |
577 | 577 | ||
578 | ab8500_dir = debugfs_create_dir(AB8500_NAME_STRING, NULL); | 578 | ab8500_dir = debugfs_create_dir(AB8500_NAME_STRING, NULL); |
579 | if (!ab8500_dir) | 579 | if (!ab8500_dir) |
580 | goto exit_no_debugfs; | 580 | goto exit_no_debugfs; |
581 | 581 | ||
582 | ab8500_reg_file = debugfs_create_file("all-bank-registers", | 582 | ab8500_reg_file = debugfs_create_file("all-bank-registers", |
583 | S_IRUGO, ab8500_dir, &plf->dev, &ab8500_registers_fops); | 583 | S_IRUGO, ab8500_dir, &plf->dev, &ab8500_registers_fops); |
584 | if (!ab8500_reg_file) | 584 | if (!ab8500_reg_file) |
585 | goto exit_destroy_dir; | 585 | goto exit_destroy_dir; |
586 | 586 | ||
587 | ab8500_bank_file = debugfs_create_file("register-bank", | 587 | ab8500_bank_file = debugfs_create_file("register-bank", |
588 | (S_IRUGO | S_IWUGO), ab8500_dir, &plf->dev, &ab8500_bank_fops); | 588 | (S_IRUGO | S_IWUGO), ab8500_dir, &plf->dev, &ab8500_bank_fops); |
589 | if (!ab8500_bank_file) | 589 | if (!ab8500_bank_file) |
590 | goto exit_destroy_reg; | 590 | goto exit_destroy_reg; |
591 | 591 | ||
592 | ab8500_address_file = debugfs_create_file("register-address", | 592 | ab8500_address_file = debugfs_create_file("register-address", |
593 | (S_IRUGO | S_IWUGO), ab8500_dir, &plf->dev, | 593 | (S_IRUGO | S_IWUGO), ab8500_dir, &plf->dev, |
594 | &ab8500_address_fops); | 594 | &ab8500_address_fops); |
595 | if (!ab8500_address_file) | 595 | if (!ab8500_address_file) |
596 | goto exit_destroy_bank; | 596 | goto exit_destroy_bank; |
597 | 597 | ||
598 | ab8500_val_file = debugfs_create_file("register-value", | 598 | ab8500_val_file = debugfs_create_file("register-value", |
599 | (S_IRUGO | S_IWUGO), ab8500_dir, &plf->dev, &ab8500_val_fops); | 599 | (S_IRUGO | S_IWUGO), ab8500_dir, &plf->dev, &ab8500_val_fops); |
600 | if (!ab8500_val_file) | 600 | if (!ab8500_val_file) |
601 | goto exit_destroy_address; | 601 | goto exit_destroy_address; |
602 | 602 | ||
603 | return 0; | 603 | return 0; |
604 | 604 | ||
605 | exit_destroy_address: | 605 | exit_destroy_address: |
606 | debugfs_remove(ab8500_address_file); | 606 | debugfs_remove(ab8500_address_file); |
607 | exit_destroy_bank: | 607 | exit_destroy_bank: |
608 | debugfs_remove(ab8500_bank_file); | 608 | debugfs_remove(ab8500_bank_file); |
609 | exit_destroy_reg: | 609 | exit_destroy_reg: |
610 | debugfs_remove(ab8500_reg_file); | 610 | debugfs_remove(ab8500_reg_file); |
611 | exit_destroy_dir: | 611 | exit_destroy_dir: |
612 | debugfs_remove(ab8500_dir); | 612 | debugfs_remove(ab8500_dir); |
613 | exit_no_debugfs: | 613 | exit_no_debugfs: |
614 | dev_err(&plf->dev, "failed to create debugfs entries.\n"); | 614 | dev_err(&plf->dev, "failed to create debugfs entries.\n"); |
615 | return -ENOMEM; | 615 | return -ENOMEM; |
616 | } | 616 | } |
617 | 617 | ||
618 | static int __devexit ab8500_debug_remove(struct platform_device *plf) | 618 | static int __devexit ab8500_debug_remove(struct platform_device *plf) |
619 | { | 619 | { |
620 | debugfs_remove(ab8500_val_file); | 620 | debugfs_remove(ab8500_val_file); |
621 | debugfs_remove(ab8500_address_file); | 621 | debugfs_remove(ab8500_address_file); |
622 | debugfs_remove(ab8500_bank_file); | 622 | debugfs_remove(ab8500_bank_file); |
623 | debugfs_remove(ab8500_reg_file); | 623 | debugfs_remove(ab8500_reg_file); |
624 | debugfs_remove(ab8500_dir); | 624 | debugfs_remove(ab8500_dir); |
625 | 625 | ||
626 | return 0; | 626 | return 0; |
627 | } | 627 | } |
628 | 628 | ||
629 | static struct platform_driver ab8500_debug_driver = { | 629 | static struct platform_driver ab8500_debug_driver = { |
630 | .driver = { | 630 | .driver = { |
631 | .name = "ab8500-debug", | 631 | .name = "ab8500-debug", |
632 | .owner = THIS_MODULE, | 632 | .owner = THIS_MODULE, |
633 | }, | 633 | }, |
634 | .probe = ab8500_debug_probe, | 634 | .probe = ab8500_debug_probe, |
635 | .remove = __devexit_p(ab8500_debug_remove) | 635 | .remove = __devexit_p(ab8500_debug_remove) |
636 | }; | 636 | }; |
637 | 637 | ||
638 | static int __init ab8500_debug_init(void) | 638 | static int __init ab8500_debug_init(void) |
639 | { | 639 | { |
640 | return platform_driver_register(&ab8500_debug_driver); | 640 | return platform_driver_register(&ab8500_debug_driver); |
641 | } | 641 | } |
642 | 642 | ||
643 | static void __exit ab8500_debug_exit(void) | 643 | static void __exit ab8500_debug_exit(void) |
644 | { | 644 | { |
645 | platform_driver_unregister(&ab8500_debug_driver); | 645 | platform_driver_unregister(&ab8500_debug_driver); |
646 | } | 646 | } |
647 | subsys_initcall(ab8500_debug_init); | 647 | subsys_initcall(ab8500_debug_init); |
648 | module_exit(ab8500_debug_exit); | 648 | module_exit(ab8500_debug_exit); |
diff --git a/drivers/mfd/ab8500-spi.c b/drivers/mfd/ab8500-spi.c deleted file mode 100644 index b1653421edb5..000000000000 --- a/drivers/mfd/ab8500-spi.c +++ /dev/null | |||
@@ -1,143 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) ST-Ericsson SA 2010 | ||
3 | * | ||
4 | * License Terms: GNU General Public License v2 | ||
5 | * Author: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com> | ||
6 | */ | ||
7 | |||
8 | #include <linux/kernel.h> | ||
9 | #include <linux/slab.h> | ||
10 | #include <linux/init.h> | ||
11 | #include <linux/module.h> | ||
12 | #include <linux/platform_device.h> | ||
13 | #include <linux/spi/spi.h> | ||
14 | #include <linux/mfd/ab8500.h> | ||
15 | |||
16 | /* | ||
17 | * This funtion writes to any AB8500 registers using | ||
18 | * SPI protocol & before it writes it packs the data | ||
19 | * in the below 24 bit frame format | ||
20 | * | ||
21 | * *|------------------------------------| | ||
22 | * *| 23|22...18|17.......10|9|8|7......0| | ||
23 | * *| r/w bank adr data | | ||
24 | * * ------------------------------------ | ||
25 | * | ||
26 | * This function shouldn't be called from interrupt | ||
27 | * context | ||
28 | */ | ||
29 | static int ab8500_spi_write(struct ab8500 *ab8500, u16 addr, u8 data) | ||
30 | { | ||
31 | struct spi_device *spi = container_of(ab8500->dev, struct spi_device, | ||
32 | dev); | ||
33 | unsigned long spi_data = addr << 10 | data; | ||
34 | struct spi_transfer xfer; | ||
35 | struct spi_message msg; | ||
36 | |||
37 | ab8500->tx_buf[0] = spi_data; | ||
38 | ab8500->rx_buf[0] = 0; | ||
39 | |||
40 | xfer.tx_buf = ab8500->tx_buf; | ||
41 | xfer.rx_buf = NULL; | ||
42 | xfer.len = sizeof(unsigned long); | ||
43 | |||
44 | spi_message_init(&msg); | ||
45 | spi_message_add_tail(&xfer, &msg); | ||
46 | |||
47 | return spi_sync(spi, &msg); | ||
48 | } | ||
49 | |||
50 | static int ab8500_spi_read(struct ab8500 *ab8500, u16 addr) | ||
51 | { | ||
52 | struct spi_device *spi = container_of(ab8500->dev, struct spi_device, | ||
53 | dev); | ||
54 | unsigned long spi_data = 1 << 23 | addr << 10; | ||
55 | struct spi_transfer xfer; | ||
56 | struct spi_message msg; | ||
57 | int ret; | ||
58 | |||
59 | ab8500->tx_buf[0] = spi_data; | ||
60 | ab8500->rx_buf[0] = 0; | ||
61 | |||
62 | xfer.tx_buf = ab8500->tx_buf; | ||
63 | xfer.rx_buf = ab8500->rx_buf; | ||
64 | xfer.len = sizeof(unsigned long); | ||
65 | |||
66 | spi_message_init(&msg); | ||
67 | spi_message_add_tail(&xfer, &msg); | ||
68 | |||
69 | ret = spi_sync(spi, &msg); | ||
70 | if (!ret) | ||
71 | /* | ||
72 | * Only the 8 lowermost bytes are | ||
73 | * defined with value, the rest may | ||
74 | * vary depending on chip/board noise. | ||
75 | */ | ||
76 | ret = ab8500->rx_buf[0] & 0xFFU; | ||
77 | |||
78 | return ret; | ||
79 | } | ||
80 | |||
81 | static int __devinit ab8500_spi_probe(struct spi_device *spi) | ||
82 | { | ||
83 | struct ab8500 *ab8500; | ||
84 | int ret; | ||
85 | |||
86 | spi->bits_per_word = 24; | ||
87 | ret = spi_setup(spi); | ||
88 | if (ret < 0) | ||
89 | return ret; | ||
90 | |||
91 | ab8500 = kzalloc(sizeof *ab8500, GFP_KERNEL); | ||
92 | if (!ab8500) | ||
93 | return -ENOMEM; | ||
94 | |||
95 | ab8500->dev = &spi->dev; | ||
96 | ab8500->irq = spi->irq; | ||
97 | |||
98 | ab8500->read = ab8500_spi_read; | ||
99 | ab8500->write = ab8500_spi_write; | ||
100 | |||
101 | spi_set_drvdata(spi, ab8500); | ||
102 | |||
103 | ret = ab8500_init(ab8500); | ||
104 | if (ret) | ||
105 | kfree(ab8500); | ||
106 | |||
107 | return ret; | ||
108 | } | ||
109 | |||
110 | static int __devexit ab8500_spi_remove(struct spi_device *spi) | ||
111 | { | ||
112 | struct ab8500 *ab8500 = spi_get_drvdata(spi); | ||
113 | |||
114 | ab8500_exit(ab8500); | ||
115 | kfree(ab8500); | ||
116 | |||
117 | return 0; | ||
118 | } | ||
119 | |||
120 | static struct spi_driver ab8500_spi_driver = { | ||
121 | .driver = { | ||
122 | .name = "ab8500-spi", | ||
123 | .owner = THIS_MODULE, | ||
124 | }, | ||
125 | .probe = ab8500_spi_probe, | ||
126 | .remove = __devexit_p(ab8500_spi_remove) | ||
127 | }; | ||
128 | |||
129 | static int __init ab8500_spi_init(void) | ||
130 | { | ||
131 | return spi_register_driver(&ab8500_spi_driver); | ||
132 | } | ||
133 | subsys_initcall(ab8500_spi_init); | ||
134 | |||
135 | static void __exit ab8500_spi_exit(void) | ||
136 | { | ||
137 | spi_unregister_driver(&ab8500_spi_driver); | ||
138 | } | ||
139 | module_exit(ab8500_spi_exit); | ||
140 | |||
141 | MODULE_AUTHOR("Srinidhi KASAGAR <srinidhi.kasagar@stericsson.com"); | ||
142 | MODULE_DESCRIPTION("AB8500 SPI"); | ||
143 | MODULE_LICENSE("GPL v2"); | ||
diff --git a/drivers/mfd/asic3.c b/drivers/mfd/asic3.c index 7de708d15d72..6a1f94042612 100644 --- a/drivers/mfd/asic3.c +++ b/drivers/mfd/asic3.c | |||
@@ -57,7 +57,7 @@ struct asic3_clk { | |||
57 | .rate = _rate, \ | 57 | .rate = _rate, \ |
58 | } | 58 | } |
59 | 59 | ||
60 | struct asic3_clk asic3_clk_init[] __initdata = { | 60 | static struct asic3_clk asic3_clk_init[] __initdata = { |
61 | INIT_CDEX(SPI, 0), | 61 | INIT_CDEX(SPI, 0), |
62 | INIT_CDEX(OWM, 5000000), | 62 | INIT_CDEX(OWM, 5000000), |
63 | INIT_CDEX(PWM0, 0), | 63 | INIT_CDEX(PWM0, 0), |
@@ -102,7 +102,7 @@ static inline u32 asic3_read_register(struct asic3 *asic, | |||
102 | (reg >> asic->bus_shift)); | 102 | (reg >> asic->bus_shift)); |
103 | } | 103 | } |
104 | 104 | ||
105 | void asic3_set_register(struct asic3 *asic, u32 reg, u32 bits, bool set) | 105 | static void asic3_set_register(struct asic3 *asic, u32 reg, u32 bits, bool set) |
106 | { | 106 | { |
107 | unsigned long flags; | 107 | unsigned long flags; |
108 | u32 val; | 108 | u32 val; |
@@ -226,14 +226,14 @@ static inline int asic3_irq_to_index(struct asic3 *asic, int irq) | |||
226 | return (irq - asic->irq_base) & 0xf; | 226 | return (irq - asic->irq_base) & 0xf; |
227 | } | 227 | } |
228 | 228 | ||
229 | static void asic3_mask_gpio_irq(unsigned int irq) | 229 | static void asic3_mask_gpio_irq(struct irq_data *data) |
230 | { | 230 | { |
231 | struct asic3 *asic = get_irq_chip_data(irq); | 231 | struct asic3 *asic = irq_data_get_irq_chip_data(data); |
232 | u32 val, bank, index; | 232 | u32 val, bank, index; |
233 | unsigned long flags; | 233 | unsigned long flags; |
234 | 234 | ||
235 | bank = asic3_irq_to_bank(asic, irq); | 235 | bank = asic3_irq_to_bank(asic, data->irq); |
236 | index = asic3_irq_to_index(asic, irq); | 236 | index = asic3_irq_to_index(asic, data->irq); |
237 | 237 | ||
238 | spin_lock_irqsave(&asic->lock, flags); | 238 | spin_lock_irqsave(&asic->lock, flags); |
239 | val = asic3_read_register(asic, bank + ASIC3_GPIO_MASK); | 239 | val = asic3_read_register(asic, bank + ASIC3_GPIO_MASK); |
@@ -242,9 +242,9 @@ static void asic3_mask_gpio_irq(unsigned int irq) | |||
242 | spin_unlock_irqrestore(&asic->lock, flags); | 242 | spin_unlock_irqrestore(&asic->lock, flags); |
243 | } | 243 | } |
244 | 244 | ||
245 | static void asic3_mask_irq(unsigned int irq) | 245 | static void asic3_mask_irq(struct irq_data *data) |
246 | { | 246 | { |
247 | struct asic3 *asic = get_irq_chip_data(irq); | 247 | struct asic3 *asic = irq_data_get_irq_chip_data(data); |
248 | int regval; | 248 | int regval; |
249 | unsigned long flags; | 249 | unsigned long flags; |
250 | 250 | ||
@@ -254,7 +254,7 @@ static void asic3_mask_irq(unsigned int irq) | |||
254 | ASIC3_INTR_INT_MASK); | 254 | ASIC3_INTR_INT_MASK); |
255 | 255 | ||
256 | regval &= ~(ASIC3_INTMASK_MASK0 << | 256 | regval &= ~(ASIC3_INTMASK_MASK0 << |
257 | (irq - (asic->irq_base + ASIC3_NUM_GPIOS))); | 257 | (data->irq - (asic->irq_base + ASIC3_NUM_GPIOS))); |
258 | 258 | ||
259 | asic3_write_register(asic, | 259 | asic3_write_register(asic, |
260 | ASIC3_INTR_BASE + | 260 | ASIC3_INTR_BASE + |
@@ -263,14 +263,14 @@ static void asic3_mask_irq(unsigned int irq) | |||
263 | spin_unlock_irqrestore(&asic->lock, flags); | 263 | spin_unlock_irqrestore(&asic->lock, flags); |
264 | } | 264 | } |
265 | 265 | ||
266 | static void asic3_unmask_gpio_irq(unsigned int irq) | 266 | static void asic3_unmask_gpio_irq(struct irq_data *data) |
267 | { | 267 | { |
268 | struct asic3 *asic = get_irq_chip_data(irq); | 268 | struct asic3 *asic = irq_data_get_irq_chip_data(data); |
269 | u32 val, bank, index; | 269 | u32 val, bank, index; |
270 | unsigned long flags; | 270 | unsigned long flags; |
271 | 271 | ||
272 | bank = asic3_irq_to_bank(asic, irq); | 272 | bank = asic3_irq_to_bank(asic, data->irq); |
273 | index = asic3_irq_to_index(asic, irq); | 273 | index = asic3_irq_to_index(asic, data->irq); |
274 | 274 | ||
275 | spin_lock_irqsave(&asic->lock, flags); | 275 | spin_lock_irqsave(&asic->lock, flags); |
276 | val = asic3_read_register(asic, bank + ASIC3_GPIO_MASK); | 276 | val = asic3_read_register(asic, bank + ASIC3_GPIO_MASK); |
@@ -279,9 +279,9 @@ static void asic3_unmask_gpio_irq(unsigned int irq) | |||
279 | spin_unlock_irqrestore(&asic->lock, flags); | 279 | spin_unlock_irqrestore(&asic->lock, flags); |
280 | } | 280 | } |
281 | 281 | ||
282 | static void asic3_unmask_irq(unsigned int irq) | 282 | static void asic3_unmask_irq(struct irq_data *data) |
283 | { | 283 | { |
284 | struct asic3 *asic = get_irq_chip_data(irq); | 284 | struct asic3 *asic = irq_data_get_irq_chip_data(data); |
285 | int regval; | 285 | int regval; |
286 | unsigned long flags; | 286 | unsigned long flags; |
287 | 287 | ||
@@ -291,7 +291,7 @@ static void asic3_unmask_irq(unsigned int irq) | |||
291 | ASIC3_INTR_INT_MASK); | 291 | ASIC3_INTR_INT_MASK); |
292 | 292 | ||
293 | regval |= (ASIC3_INTMASK_MASK0 << | 293 | regval |= (ASIC3_INTMASK_MASK0 << |
294 | (irq - (asic->irq_base + ASIC3_NUM_GPIOS))); | 294 | (data->irq - (asic->irq_base + ASIC3_NUM_GPIOS))); |
295 | 295 | ||
296 | asic3_write_register(asic, | 296 | asic3_write_register(asic, |
297 | ASIC3_INTR_BASE + | 297 | ASIC3_INTR_BASE + |
@@ -300,15 +300,15 @@ static void asic3_unmask_irq(unsigned int irq) | |||
300 | spin_unlock_irqrestore(&asic->lock, flags); | 300 | spin_unlock_irqrestore(&asic->lock, flags); |
301 | } | 301 | } |
302 | 302 | ||
303 | static int asic3_gpio_irq_type(unsigned int irq, unsigned int type) | 303 | static int asic3_gpio_irq_type(struct irq_data *data, unsigned int type) |
304 | { | 304 | { |
305 | struct asic3 *asic = get_irq_chip_data(irq); | 305 | struct asic3 *asic = irq_data_get_irq_chip_data(data); |
306 | u32 bank, index; | 306 | u32 bank, index; |
307 | u16 trigger, level, edge, bit; | 307 | u16 trigger, level, edge, bit; |
308 | unsigned long flags; | 308 | unsigned long flags; |
309 | 309 | ||
310 | bank = asic3_irq_to_bank(asic, irq); | 310 | bank = asic3_irq_to_bank(asic, data->irq); |
311 | index = asic3_irq_to_index(asic, irq); | 311 | index = asic3_irq_to_index(asic, data->irq); |
312 | bit = 1<<index; | 312 | bit = 1<<index; |
313 | 313 | ||
314 | spin_lock_irqsave(&asic->lock, flags); | 314 | spin_lock_irqsave(&asic->lock, flags); |
@@ -318,7 +318,7 @@ static int asic3_gpio_irq_type(unsigned int irq, unsigned int type) | |||
318 | bank + ASIC3_GPIO_EDGE_TRIGGER); | 318 | bank + ASIC3_GPIO_EDGE_TRIGGER); |
319 | trigger = asic3_read_register(asic, | 319 | trigger = asic3_read_register(asic, |
320 | bank + ASIC3_GPIO_TRIGGER_TYPE); | 320 | bank + ASIC3_GPIO_TRIGGER_TYPE); |
321 | asic->irq_bothedge[(irq - asic->irq_base) >> 4] &= ~bit; | 321 | asic->irq_bothedge[(data->irq - asic->irq_base) >> 4] &= ~bit; |
322 | 322 | ||
323 | if (type == IRQ_TYPE_EDGE_RISING) { | 323 | if (type == IRQ_TYPE_EDGE_RISING) { |
324 | trigger |= bit; | 324 | trigger |= bit; |
@@ -328,11 +328,11 @@ static int asic3_gpio_irq_type(unsigned int irq, unsigned int type) | |||
328 | edge &= ~bit; | 328 | edge &= ~bit; |
329 | } else if (type == IRQ_TYPE_EDGE_BOTH) { | 329 | } else if (type == IRQ_TYPE_EDGE_BOTH) { |
330 | trigger |= bit; | 330 | trigger |= bit; |
331 | if (asic3_gpio_get(&asic->gpio, irq - asic->irq_base)) | 331 | if (asic3_gpio_get(&asic->gpio, data->irq - asic->irq_base)) |
332 | edge &= ~bit; | 332 | edge &= ~bit; |
333 | else | 333 | else |
334 | edge |= bit; | 334 | edge |= bit; |
335 | asic->irq_bothedge[(irq - asic->irq_base) >> 4] |= bit; | 335 | asic->irq_bothedge[(data->irq - asic->irq_base) >> 4] |= bit; |
336 | } else if (type == IRQ_TYPE_LEVEL_LOW) { | 336 | } else if (type == IRQ_TYPE_LEVEL_LOW) { |
337 | trigger &= ~bit; | 337 | trigger &= ~bit; |
338 | level &= ~bit; | 338 | level &= ~bit; |
@@ -359,17 +359,17 @@ static int asic3_gpio_irq_type(unsigned int irq, unsigned int type) | |||
359 | 359 | ||
360 | static struct irq_chip asic3_gpio_irq_chip = { | 360 | static struct irq_chip asic3_gpio_irq_chip = { |
361 | .name = "ASIC3-GPIO", | 361 | .name = "ASIC3-GPIO", |
362 | .ack = asic3_mask_gpio_irq, | 362 | .irq_ack = asic3_mask_gpio_irq, |
363 | .mask = asic3_mask_gpio_irq, | 363 | .irq_mask = asic3_mask_gpio_irq, |
364 | .unmask = asic3_unmask_gpio_irq, | 364 | .irq_unmask = asic3_unmask_gpio_irq, |
365 | .set_type = asic3_gpio_irq_type, | 365 | .irq_set_type = asic3_gpio_irq_type, |
366 | }; | 366 | }; |
367 | 367 | ||
368 | static struct irq_chip asic3_irq_chip = { | 368 | static struct irq_chip asic3_irq_chip = { |
369 | .name = "ASIC3", | 369 | .name = "ASIC3", |
370 | .ack = asic3_mask_irq, | 370 | .irq_ack = asic3_mask_irq, |
371 | .mask = asic3_mask_irq, | 371 | .irq_mask = asic3_mask_irq, |
372 | .unmask = asic3_unmask_irq, | 372 | .irq_unmask = asic3_unmask_irq, |
373 | }; | 373 | }; |
374 | 374 | ||
375 | static int __init asic3_irq_probe(struct platform_device *pdev) | 375 | static int __init asic3_irq_probe(struct platform_device *pdev) |
@@ -635,7 +635,7 @@ static struct resource ds1wm_resources[] = { | |||
635 | }, | 635 | }, |
636 | { | 636 | { |
637 | .start = ASIC3_IRQ_OWM, | 637 | .start = ASIC3_IRQ_OWM, |
638 | .start = ASIC3_IRQ_OWM, | 638 | .end = ASIC3_IRQ_OWM, |
639 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE, | 639 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE, |
640 | }, | 640 | }, |
641 | }; | 641 | }; |
diff --git a/drivers/mfd/cs5535-mfd.c b/drivers/mfd/cs5535-mfd.c new file mode 100644 index 000000000000..59ca6f151e78 --- /dev/null +++ b/drivers/mfd/cs5535-mfd.c | |||
@@ -0,0 +1,151 @@ | |||
1 | /* | ||
2 | * cs5535-mfd.c - core MFD driver for CS5535/CS5536 southbridges | ||
3 | * | ||
4 | * The CS5535 and CS5536 has an ISA bridge on the PCI bus that is | ||
5 | * used for accessing GPIOs, MFGPTs, ACPI, etc. Each subdevice has | ||
6 | * an IO range that's specified in a single BAR. The BAR order is | ||
7 | * hardcoded in the CS553x specifications. | ||
8 | * | ||
9 | * Copyright (c) 2010 Andres Salomon <dilinger@queued.net> | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or modify | ||
12 | * it under the terms of the GNU General Public License version 2 as | ||
13 | * published by the Free Software Foundation. | ||
14 | * | ||
15 | * This program is distributed in the hope that it will be useful, | ||
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
18 | * GNU General Public License for more details. | ||
19 | * | ||
20 | * You should have received a copy of the GNU General Public License | ||
21 | * along with this program; if not, write to the Free Software | ||
22 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
23 | */ | ||
24 | |||
25 | #include <linux/kernel.h> | ||
26 | #include <linux/init.h> | ||
27 | #include <linux/mfd/core.h> | ||
28 | #include <linux/module.h> | ||
29 | #include <linux/pci.h> | ||
30 | |||
31 | #define DRV_NAME "cs5535-mfd" | ||
32 | |||
33 | enum cs5535_mfd_bars { | ||
34 | SMB_BAR = 0, | ||
35 | GPIO_BAR = 1, | ||
36 | MFGPT_BAR = 2, | ||
37 | PMS_BAR = 4, | ||
38 | ACPI_BAR = 5, | ||
39 | NR_BARS, | ||
40 | }; | ||
41 | |||
42 | static __devinitdata struct resource cs5535_mfd_resources[NR_BARS]; | ||
43 | |||
44 | static __devinitdata struct mfd_cell cs5535_mfd_cells[] = { | ||
45 | { | ||
46 | .id = SMB_BAR, | ||
47 | .name = "cs5535-smb", | ||
48 | .num_resources = 1, | ||
49 | .resources = &cs5535_mfd_resources[SMB_BAR], | ||
50 | }, | ||
51 | { | ||
52 | .id = GPIO_BAR, | ||
53 | .name = "cs5535-gpio", | ||
54 | .num_resources = 1, | ||
55 | .resources = &cs5535_mfd_resources[GPIO_BAR], | ||
56 | }, | ||
57 | { | ||
58 | .id = MFGPT_BAR, | ||
59 | .name = "cs5535-mfgpt", | ||
60 | .num_resources = 1, | ||
61 | .resources = &cs5535_mfd_resources[MFGPT_BAR], | ||
62 | }, | ||
63 | { | ||
64 | .id = PMS_BAR, | ||
65 | .name = "cs5535-pms", | ||
66 | .num_resources = 1, | ||
67 | .resources = &cs5535_mfd_resources[PMS_BAR], | ||
68 | }, | ||
69 | { | ||
70 | .id = ACPI_BAR, | ||
71 | .name = "cs5535-acpi", | ||
72 | .num_resources = 1, | ||
73 | .resources = &cs5535_mfd_resources[ACPI_BAR], | ||
74 | }, | ||
75 | }; | ||
76 | |||
77 | static int __devinit cs5535_mfd_probe(struct pci_dev *pdev, | ||
78 | const struct pci_device_id *id) | ||
79 | { | ||
80 | int err, i; | ||
81 | |||
82 | err = pci_enable_device(pdev); | ||
83 | if (err) | ||
84 | return err; | ||
85 | |||
86 | /* fill in IO range for each cell; subdrivers handle the region */ | ||
87 | for (i = 0; i < ARRAY_SIZE(cs5535_mfd_cells); i++) { | ||
88 | int bar = cs5535_mfd_cells[i].id; | ||
89 | struct resource *r = &cs5535_mfd_resources[bar]; | ||
90 | |||
91 | r->flags = IORESOURCE_IO; | ||
92 | r->start = pci_resource_start(pdev, bar); | ||
93 | r->end = pci_resource_end(pdev, bar); | ||
94 | |||
95 | /* id is used for temporarily storing BAR; unset it now */ | ||
96 | cs5535_mfd_cells[i].id = 0; | ||
97 | } | ||
98 | |||
99 | err = mfd_add_devices(&pdev->dev, -1, cs5535_mfd_cells, | ||
100 | ARRAY_SIZE(cs5535_mfd_cells), NULL, 0); | ||
101 | if (err) { | ||
102 | dev_err(&pdev->dev, "MFD add devices failed: %d\n", err); | ||
103 | goto err_disable; | ||
104 | } | ||
105 | |||
106 | dev_info(&pdev->dev, "%zu devices registered.\n", | ||
107 | ARRAY_SIZE(cs5535_mfd_cells)); | ||
108 | |||
109 | return 0; | ||
110 | |||
111 | err_disable: | ||
112 | pci_disable_device(pdev); | ||
113 | return err; | ||
114 | } | ||
115 | |||
116 | static void __devexit cs5535_mfd_remove(struct pci_dev *pdev) | ||
117 | { | ||
118 | mfd_remove_devices(&pdev->dev); | ||
119 | pci_disable_device(pdev); | ||
120 | } | ||
121 | |||
122 | static struct pci_device_id cs5535_mfd_pci_tbl[] = { | ||
123 | { PCI_DEVICE(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_CS5535_ISA) }, | ||
124 | { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_CS5536_ISA) }, | ||
125 | { 0, } | ||
126 | }; | ||
127 | MODULE_DEVICE_TABLE(pci, cs5535_mfd_pci_tbl); | ||
128 | |||
129 | static struct pci_driver cs5535_mfd_drv = { | ||
130 | .name = DRV_NAME, | ||
131 | .id_table = cs5535_mfd_pci_tbl, | ||
132 | .probe = cs5535_mfd_probe, | ||
133 | .remove = __devexit_p(cs5535_mfd_remove), | ||
134 | }; | ||
135 | |||
136 | static int __init cs5535_mfd_init(void) | ||
137 | { | ||
138 | return pci_register_driver(&cs5535_mfd_drv); | ||
139 | } | ||
140 | |||
141 | static void __exit cs5535_mfd_exit(void) | ||
142 | { | ||
143 | pci_unregister_driver(&cs5535_mfd_drv); | ||
144 | } | ||
145 | |||
146 | module_init(cs5535_mfd_init); | ||
147 | module_exit(cs5535_mfd_exit); | ||
148 | |||
149 | MODULE_AUTHOR("Andres Salomon <dilinger@queued.net>"); | ||
150 | MODULE_DESCRIPTION("MFD driver for CS5535/CS5536 southbridge's ISA PCI device"); | ||
151 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/mfd/ezx-pcap.c b/drivers/mfd/ezx-pcap.c index c2b698d69a93..9e2d8dd5f9e5 100644 --- a/drivers/mfd/ezx-pcap.c +++ b/drivers/mfd/ezx-pcap.c | |||
@@ -144,26 +144,26 @@ int pcap_to_irq(struct pcap_chip *pcap, int irq) | |||
144 | } | 144 | } |
145 | EXPORT_SYMBOL_GPL(pcap_to_irq); | 145 | EXPORT_SYMBOL_GPL(pcap_to_irq); |
146 | 146 | ||
147 | static void pcap_mask_irq(unsigned int irq) | 147 | static void pcap_mask_irq(struct irq_data *d) |
148 | { | 148 | { |
149 | struct pcap_chip *pcap = get_irq_chip_data(irq); | 149 | struct pcap_chip *pcap = irq_data_get_irq_chip_data(d); |
150 | 150 | ||
151 | pcap->msr |= 1 << irq_to_pcap(pcap, irq); | 151 | pcap->msr |= 1 << irq_to_pcap(pcap, d->irq); |
152 | queue_work(pcap->workqueue, &pcap->msr_work); | 152 | queue_work(pcap->workqueue, &pcap->msr_work); |
153 | } | 153 | } |
154 | 154 | ||
155 | static void pcap_unmask_irq(unsigned int irq) | 155 | static void pcap_unmask_irq(struct irq_data *d) |
156 | { | 156 | { |
157 | struct pcap_chip *pcap = get_irq_chip_data(irq); | 157 | struct pcap_chip *pcap = irq_data_get_irq_chip_data(d); |
158 | 158 | ||
159 | pcap->msr &= ~(1 << irq_to_pcap(pcap, irq)); | 159 | pcap->msr &= ~(1 << irq_to_pcap(pcap, d->irq)); |
160 | queue_work(pcap->workqueue, &pcap->msr_work); | 160 | queue_work(pcap->workqueue, &pcap->msr_work); |
161 | } | 161 | } |
162 | 162 | ||
163 | static struct irq_chip pcap_irq_chip = { | 163 | static struct irq_chip pcap_irq_chip = { |
164 | .name = "pcap", | 164 | .name = "pcap", |
165 | .mask = pcap_mask_irq, | 165 | .irq_mask = pcap_mask_irq, |
166 | .unmask = pcap_unmask_irq, | 166 | .irq_unmask = pcap_unmask_irq, |
167 | }; | 167 | }; |
168 | 168 | ||
169 | static void pcap_msr_work(struct work_struct *work) | 169 | static void pcap_msr_work(struct work_struct *work) |
@@ -199,8 +199,7 @@ static void pcap_isr_work(struct work_struct *work) | |||
199 | if (service & 1) { | 199 | if (service & 1) { |
200 | struct irq_desc *desc = irq_to_desc(irq); | 200 | struct irq_desc *desc = irq_to_desc(irq); |
201 | 201 | ||
202 | if (WARN(!desc, KERN_WARNING | 202 | if (WARN(!desc, "Invalid PCAP IRQ %d\n", irq)) |
203 | "Invalid PCAP IRQ %d\n", irq)) | ||
204 | break; | 203 | break; |
205 | 204 | ||
206 | if (desc->status & IRQ_DISABLED) | 205 | if (desc->status & IRQ_DISABLED) |
@@ -218,7 +217,7 @@ static void pcap_irq_handler(unsigned int irq, struct irq_desc *desc) | |||
218 | { | 217 | { |
219 | struct pcap_chip *pcap = get_irq_data(irq); | 218 | struct pcap_chip *pcap = get_irq_data(irq); |
220 | 219 | ||
221 | desc->chip->ack(irq); | 220 | desc->irq_data.chip->irq_ack(&desc->irq_data); |
222 | queue_work(pcap->workqueue, &pcap->isr_work); | 221 | queue_work(pcap->workqueue, &pcap->isr_work); |
223 | return; | 222 | return; |
224 | } | 223 | } |
@@ -282,7 +281,7 @@ static irqreturn_t pcap_adc_irq(int irq, void *_pcap) | |||
282 | mutex_lock(&pcap->adc_mutex); | 281 | mutex_lock(&pcap->adc_mutex); |
283 | req = pcap->adc_queue[pcap->adc_head]; | 282 | req = pcap->adc_queue[pcap->adc_head]; |
284 | 283 | ||
285 | if (WARN(!req, KERN_WARNING "adc irq without pending request\n")) { | 284 | if (WARN(!req, "adc irq without pending request\n")) { |
286 | mutex_unlock(&pcap->adc_mutex); | 285 | mutex_unlock(&pcap->adc_mutex); |
287 | return IRQ_HANDLED; | 286 | return IRQ_HANDLED; |
288 | } | 287 | } |
diff --git a/drivers/mfd/htc-egpio.c b/drivers/mfd/htc-egpio.c index d3e74f8585e0..d00b6d1a69e5 100644 --- a/drivers/mfd/htc-egpio.c +++ b/drivers/mfd/htc-egpio.c | |||
@@ -70,31 +70,32 @@ static inline void ack_irqs(struct egpio_info *ei) | |||
70 | ei->ack_write, ei->ack_register << ei->bus_shift); | 70 | ei->ack_write, ei->ack_register << ei->bus_shift); |
71 | } | 71 | } |
72 | 72 | ||
73 | static void egpio_ack(unsigned int irq) | 73 | static void egpio_ack(struct irq_data *data) |
74 | { | 74 | { |
75 | } | 75 | } |
76 | 76 | ||
77 | /* There does not appear to be a way to proactively mask interrupts | 77 | /* There does not appear to be a way to proactively mask interrupts |
78 | * on the egpio chip itself. So, we simply ignore interrupts that | 78 | * on the egpio chip itself. So, we simply ignore interrupts that |
79 | * aren't desired. */ | 79 | * aren't desired. */ |
80 | static void egpio_mask(unsigned int irq) | 80 | static void egpio_mask(struct irq_data *data) |
81 | { | 81 | { |
82 | struct egpio_info *ei = get_irq_chip_data(irq); | 82 | struct egpio_info *ei = irq_data_get_irq_chip_data(data); |
83 | ei->irqs_enabled &= ~(1 << (irq - ei->irq_start)); | 83 | ei->irqs_enabled &= ~(1 << (data->irq - ei->irq_start)); |
84 | pr_debug("EGPIO mask %d %04x\n", irq, ei->irqs_enabled); | 84 | pr_debug("EGPIO mask %d %04x\n", data->irq, ei->irqs_enabled); |
85 | } | 85 | } |
86 | static void egpio_unmask(unsigned int irq) | 86 | |
87 | static void egpio_unmask(struct irq_data *data) | ||
87 | { | 88 | { |
88 | struct egpio_info *ei = get_irq_chip_data(irq); | 89 | struct egpio_info *ei = irq_data_get_irq_chip_data(data); |
89 | ei->irqs_enabled |= 1 << (irq - ei->irq_start); | 90 | ei->irqs_enabled |= 1 << (data->irq - ei->irq_start); |
90 | pr_debug("EGPIO unmask %d %04x\n", irq, ei->irqs_enabled); | 91 | pr_debug("EGPIO unmask %d %04x\n", data->irq, ei->irqs_enabled); |
91 | } | 92 | } |
92 | 93 | ||
93 | static struct irq_chip egpio_muxed_chip = { | 94 | static struct irq_chip egpio_muxed_chip = { |
94 | .name = "htc-egpio", | 95 | .name = "htc-egpio", |
95 | .ack = egpio_ack, | 96 | .irq_ack = egpio_ack, |
96 | .mask = egpio_mask, | 97 | .irq_mask = egpio_mask, |
97 | .unmask = egpio_unmask, | 98 | .irq_unmask = egpio_unmask, |
98 | }; | 99 | }; |
99 | 100 | ||
100 | static void egpio_handler(unsigned int irq, struct irq_desc *desc) | 101 | static void egpio_handler(unsigned int irq, struct irq_desc *desc) |
diff --git a/drivers/mfd/htc-i2cpld.c b/drivers/mfd/htc-i2cpld.c index 594c9a8e25e1..296ad1562f69 100644 --- a/drivers/mfd/htc-i2cpld.c +++ b/drivers/mfd/htc-i2cpld.c | |||
@@ -82,25 +82,25 @@ struct htcpld_data { | |||
82 | /* There does not appear to be a way to proactively mask interrupts | 82 | /* There does not appear to be a way to proactively mask interrupts |
83 | * on the htcpld chip itself. So, we simply ignore interrupts that | 83 | * on the htcpld chip itself. So, we simply ignore interrupts that |
84 | * aren't desired. */ | 84 | * aren't desired. */ |
85 | static void htcpld_mask(unsigned int irq) | 85 | static void htcpld_mask(struct irq_data *data) |
86 | { | 86 | { |
87 | struct htcpld_chip *chip = get_irq_chip_data(irq); | 87 | struct htcpld_chip *chip = irq_data_get_irq_chip_data(data); |
88 | chip->irqs_enabled &= ~(1 << (irq - chip->irq_start)); | 88 | chip->irqs_enabled &= ~(1 << (data->irq - chip->irq_start)); |
89 | pr_debug("HTCPLD mask %d %04x\n", irq, chip->irqs_enabled); | 89 | pr_debug("HTCPLD mask %d %04x\n", data->irq, chip->irqs_enabled); |
90 | } | 90 | } |
91 | static void htcpld_unmask(unsigned int irq) | 91 | static void htcpld_unmask(struct irq_data *data) |
92 | { | 92 | { |
93 | struct htcpld_chip *chip = get_irq_chip_data(irq); | 93 | struct htcpld_chip *chip = irq_data_get_irq_chip_data(data); |
94 | chip->irqs_enabled |= 1 << (irq - chip->irq_start); | 94 | chip->irqs_enabled |= 1 << (data->irq - chip->irq_start); |
95 | pr_debug("HTCPLD unmask %d %04x\n", irq, chip->irqs_enabled); | 95 | pr_debug("HTCPLD unmask %d %04x\n", data->irq, chip->irqs_enabled); |
96 | } | 96 | } |
97 | 97 | ||
98 | static int htcpld_set_type(unsigned int irq, unsigned int flags) | 98 | static int htcpld_set_type(struct irq_data *data, unsigned int flags) |
99 | { | 99 | { |
100 | struct irq_desc *d = irq_to_desc(irq); | 100 | struct irq_desc *d = irq_to_desc(data->irq); |
101 | 101 | ||
102 | if (!d) { | 102 | if (!d) { |
103 | pr_err("HTCPLD invalid IRQ: %d\n", irq); | 103 | pr_err("HTCPLD invalid IRQ: %d\n", data->irq); |
104 | return -EINVAL; | 104 | return -EINVAL; |
105 | } | 105 | } |
106 | 106 | ||
@@ -118,10 +118,10 @@ static int htcpld_set_type(unsigned int irq, unsigned int flags) | |||
118 | } | 118 | } |
119 | 119 | ||
120 | static struct irq_chip htcpld_muxed_chip = { | 120 | static struct irq_chip htcpld_muxed_chip = { |
121 | .name = "htcpld", | 121 | .name = "htcpld", |
122 | .mask = htcpld_mask, | 122 | .irq_mask = htcpld_mask, |
123 | .unmask = htcpld_unmask, | 123 | .irq_unmask = htcpld_unmask, |
124 | .set_type = htcpld_set_type, | 124 | .irq_set_type = htcpld_set_type, |
125 | }; | 125 | }; |
126 | 126 | ||
127 | /* To properly dispatch IRQ events, we need to read from the | 127 | /* To properly dispatch IRQ events, we need to read from the |
@@ -235,7 +235,7 @@ static irqreturn_t htcpld_handler(int irq, void *dev) | |||
235 | * and that work is scheduled in the set routine. The kernel can then run | 235 | * and that work is scheduled in the set routine. The kernel can then run |
236 | * the I2C functions, which will sleep, in process context. | 236 | * the I2C functions, which will sleep, in process context. |
237 | */ | 237 | */ |
238 | void htcpld_chip_set(struct gpio_chip *chip, unsigned offset, int val) | 238 | static void htcpld_chip_set(struct gpio_chip *chip, unsigned offset, int val) |
239 | { | 239 | { |
240 | struct i2c_client *client; | 240 | struct i2c_client *client; |
241 | struct htcpld_chip *chip_data; | 241 | struct htcpld_chip *chip_data; |
@@ -259,7 +259,7 @@ void htcpld_chip_set(struct gpio_chip *chip, unsigned offset, int val) | |||
259 | schedule_work(&(chip_data->set_val_work)); | 259 | schedule_work(&(chip_data->set_val_work)); |
260 | } | 260 | } |
261 | 261 | ||
262 | void htcpld_chip_set_ni(struct work_struct *work) | 262 | static void htcpld_chip_set_ni(struct work_struct *work) |
263 | { | 263 | { |
264 | struct htcpld_chip *chip_data; | 264 | struct htcpld_chip *chip_data; |
265 | struct i2c_client *client; | 265 | struct i2c_client *client; |
@@ -269,7 +269,7 @@ void htcpld_chip_set_ni(struct work_struct *work) | |||
269 | i2c_smbus_read_byte_data(client, chip_data->cache_out); | 269 | i2c_smbus_read_byte_data(client, chip_data->cache_out); |
270 | } | 270 | } |
271 | 271 | ||
272 | int htcpld_chip_get(struct gpio_chip *chip, unsigned offset) | 272 | static int htcpld_chip_get(struct gpio_chip *chip, unsigned offset) |
273 | { | 273 | { |
274 | struct htcpld_chip *chip_data; | 274 | struct htcpld_chip *chip_data; |
275 | int val = 0; | 275 | int val = 0; |
@@ -316,7 +316,7 @@ static int htcpld_direction_input(struct gpio_chip *chip, | |||
316 | return (offset < chip->ngpio) ? 0 : -EINVAL; | 316 | return (offset < chip->ngpio) ? 0 : -EINVAL; |
317 | } | 317 | } |
318 | 318 | ||
319 | int htcpld_chip_to_irq(struct gpio_chip *chip, unsigned offset) | 319 | static int htcpld_chip_to_irq(struct gpio_chip *chip, unsigned offset) |
320 | { | 320 | { |
321 | struct htcpld_chip *chip_data; | 321 | struct htcpld_chip *chip_data; |
322 | 322 | ||
@@ -328,7 +328,7 @@ int htcpld_chip_to_irq(struct gpio_chip *chip, unsigned offset) | |||
328 | return -EINVAL; | 328 | return -EINVAL; |
329 | } | 329 | } |
330 | 330 | ||
331 | void htcpld_chip_reset(struct i2c_client *client) | 331 | static void htcpld_chip_reset(struct i2c_client *client) |
332 | { | 332 | { |
333 | struct htcpld_chip *chip_data = i2c_get_clientdata(client); | 333 | struct htcpld_chip *chip_data = i2c_get_clientdata(client); |
334 | if (!chip_data) | 334 | if (!chip_data) |
diff --git a/drivers/mfd/jz4740-adc.c b/drivers/mfd/jz4740-adc.c index 9dd1b33f2275..0cc59795f600 100644 --- a/drivers/mfd/jz4740-adc.c +++ b/drivers/mfd/jz4740-adc.c | |||
@@ -84,31 +84,30 @@ static inline void jz4740_adc_irq_set_masked(struct jz4740_adc *adc, int irq, | |||
84 | spin_unlock_irqrestore(&adc->lock, flags); | 84 | spin_unlock_irqrestore(&adc->lock, flags); |
85 | } | 85 | } |
86 | 86 | ||
87 | static void jz4740_adc_irq_mask(unsigned int irq) | 87 | static void jz4740_adc_irq_mask(struct irq_data *data) |
88 | { | 88 | { |
89 | struct jz4740_adc *adc = get_irq_chip_data(irq); | 89 | struct jz4740_adc *adc = irq_data_get_irq_chip_data(data); |
90 | jz4740_adc_irq_set_masked(adc, irq, true); | 90 | jz4740_adc_irq_set_masked(adc, data->irq, true); |
91 | } | 91 | } |
92 | 92 | ||
93 | static void jz4740_adc_irq_unmask(unsigned int irq) | 93 | static void jz4740_adc_irq_unmask(struct irq_data *data) |
94 | { | 94 | { |
95 | struct jz4740_adc *adc = get_irq_chip_data(irq); | 95 | struct jz4740_adc *adc = irq_data_get_irq_chip_data(data); |
96 | jz4740_adc_irq_set_masked(adc, irq, false); | 96 | jz4740_adc_irq_set_masked(adc, data->irq, false); |
97 | } | 97 | } |
98 | 98 | ||
99 | static void jz4740_adc_irq_ack(unsigned int irq) | 99 | static void jz4740_adc_irq_ack(struct irq_data *data) |
100 | { | 100 | { |
101 | struct jz4740_adc *adc = get_irq_chip_data(irq); | 101 | struct jz4740_adc *adc = irq_data_get_irq_chip_data(data); |
102 | 102 | unsigned int irq = data->irq - adc->irq_base; | |
103 | irq -= adc->irq_base; | ||
104 | writeb(BIT(irq), adc->base + JZ_REG_ADC_STATUS); | 103 | writeb(BIT(irq), adc->base + JZ_REG_ADC_STATUS); |
105 | } | 104 | } |
106 | 105 | ||
107 | static struct irq_chip jz4740_adc_irq_chip = { | 106 | static struct irq_chip jz4740_adc_irq_chip = { |
108 | .name = "jz4740-adc", | 107 | .name = "jz4740-adc", |
109 | .mask = jz4740_adc_irq_mask, | 108 | .irq_mask = jz4740_adc_irq_mask, |
110 | .unmask = jz4740_adc_irq_unmask, | 109 | .irq_unmask = jz4740_adc_irq_unmask, |
111 | .ack = jz4740_adc_irq_ack, | 110 | .irq_ack = jz4740_adc_irq_ack, |
112 | }; | 111 | }; |
113 | 112 | ||
114 | static void jz4740_adc_irq_demux(unsigned int irq, struct irq_desc *desc) | 113 | static void jz4740_adc_irq_demux(unsigned int irq, struct irq_desc *desc) |
diff --git a/drivers/mfd/max8925-core.c b/drivers/mfd/max8925-core.c index 44695f5a1800..0e998dc4e7d8 100644 --- a/drivers/mfd/max8925-core.c +++ b/drivers/mfd/max8925-core.c | |||
@@ -407,16 +407,16 @@ static irqreturn_t max8925_tsc_irq(int irq, void *data) | |||
407 | return IRQ_HANDLED; | 407 | return IRQ_HANDLED; |
408 | } | 408 | } |
409 | 409 | ||
410 | static void max8925_irq_lock(unsigned int irq) | 410 | static void max8925_irq_lock(struct irq_data *data) |
411 | { | 411 | { |
412 | struct max8925_chip *chip = get_irq_chip_data(irq); | 412 | struct max8925_chip *chip = irq_data_get_irq_chip_data(data); |
413 | 413 | ||
414 | mutex_lock(&chip->irq_lock); | 414 | mutex_lock(&chip->irq_lock); |
415 | } | 415 | } |
416 | 416 | ||
417 | static void max8925_irq_sync_unlock(unsigned int irq) | 417 | static void max8925_irq_sync_unlock(struct irq_data *data) |
418 | { | 418 | { |
419 | struct max8925_chip *chip = get_irq_chip_data(irq); | 419 | struct max8925_chip *chip = irq_data_get_irq_chip_data(data); |
420 | struct max8925_irq_data *irq_data; | 420 | struct max8925_irq_data *irq_data; |
421 | static unsigned char cache_chg[2] = {0xff, 0xff}; | 421 | static unsigned char cache_chg[2] = {0xff, 0xff}; |
422 | static unsigned char cache_on[2] = {0xff, 0xff}; | 422 | static unsigned char cache_on[2] = {0xff, 0xff}; |
@@ -492,25 +492,25 @@ static void max8925_irq_sync_unlock(unsigned int irq) | |||
492 | mutex_unlock(&chip->irq_lock); | 492 | mutex_unlock(&chip->irq_lock); |
493 | } | 493 | } |
494 | 494 | ||
495 | static void max8925_irq_enable(unsigned int irq) | 495 | static void max8925_irq_enable(struct irq_data *data) |
496 | { | 496 | { |
497 | struct max8925_chip *chip = get_irq_chip_data(irq); | 497 | struct max8925_chip *chip = irq_data_get_irq_chip_data(data); |
498 | max8925_irqs[irq - chip->irq_base].enable | 498 | max8925_irqs[data->irq - chip->irq_base].enable |
499 | = max8925_irqs[irq - chip->irq_base].offs; | 499 | = max8925_irqs[data->irq - chip->irq_base].offs; |
500 | } | 500 | } |
501 | 501 | ||
502 | static void max8925_irq_disable(unsigned int irq) | 502 | static void max8925_irq_disable(struct irq_data *data) |
503 | { | 503 | { |
504 | struct max8925_chip *chip = get_irq_chip_data(irq); | 504 | struct max8925_chip *chip = irq_data_get_irq_chip_data(data); |
505 | max8925_irqs[irq - chip->irq_base].enable = 0; | 505 | max8925_irqs[data->irq - chip->irq_base].enable = 0; |
506 | } | 506 | } |
507 | 507 | ||
508 | static struct irq_chip max8925_irq_chip = { | 508 | static struct irq_chip max8925_irq_chip = { |
509 | .name = "max8925", | 509 | .name = "max8925", |
510 | .bus_lock = max8925_irq_lock, | 510 | .irq_bus_lock = max8925_irq_lock, |
511 | .bus_sync_unlock = max8925_irq_sync_unlock, | 511 | .irq_bus_sync_unlock = max8925_irq_sync_unlock, |
512 | .enable = max8925_irq_enable, | 512 | .irq_enable = max8925_irq_enable, |
513 | .disable = max8925_irq_disable, | 513 | .irq_disable = max8925_irq_disable, |
514 | }; | 514 | }; |
515 | 515 | ||
516 | static int max8925_irq_init(struct max8925_chip *chip, int irq, | 516 | static int max8925_irq_init(struct max8925_chip *chip, int irq, |
diff --git a/drivers/mfd/max8998-irq.c b/drivers/mfd/max8998-irq.c index 45bfe77b639b..3903e1fbb334 100644 --- a/drivers/mfd/max8998-irq.c +++ b/drivers/mfd/max8998-irq.c | |||
@@ -102,16 +102,16 @@ irq_to_max8998_irq(struct max8998_dev *max8998, int irq) | |||
102 | return &max8998_irqs[irq - max8998->irq_base]; | 102 | return &max8998_irqs[irq - max8998->irq_base]; |
103 | } | 103 | } |
104 | 104 | ||
105 | static void max8998_irq_lock(unsigned int irq) | 105 | static void max8998_irq_lock(struct irq_data *data) |
106 | { | 106 | { |
107 | struct max8998_dev *max8998 = get_irq_chip_data(irq); | 107 | struct max8998_dev *max8998 = irq_data_get_irq_chip_data(data); |
108 | 108 | ||
109 | mutex_lock(&max8998->irqlock); | 109 | mutex_lock(&max8998->irqlock); |
110 | } | 110 | } |
111 | 111 | ||
112 | static void max8998_irq_sync_unlock(unsigned int irq) | 112 | static void max8998_irq_sync_unlock(struct irq_data *data) |
113 | { | 113 | { |
114 | struct max8998_dev *max8998 = get_irq_chip_data(irq); | 114 | struct max8998_dev *max8998 = irq_data_get_irq_chip_data(data); |
115 | int i; | 115 | int i; |
116 | 116 | ||
117 | for (i = 0; i < ARRAY_SIZE(max8998->irq_masks_cur); i++) { | 117 | for (i = 0; i < ARRAY_SIZE(max8998->irq_masks_cur); i++) { |
@@ -129,28 +129,30 @@ static void max8998_irq_sync_unlock(unsigned int irq) | |||
129 | mutex_unlock(&max8998->irqlock); | 129 | mutex_unlock(&max8998->irqlock); |
130 | } | 130 | } |
131 | 131 | ||
132 | static void max8998_irq_unmask(unsigned int irq) | 132 | static void max8998_irq_unmask(struct irq_data *data) |
133 | { | 133 | { |
134 | struct max8998_dev *max8998 = get_irq_chip_data(irq); | 134 | struct max8998_dev *max8998 = irq_data_get_irq_chip_data(data); |
135 | struct max8998_irq_data *irq_data = irq_to_max8998_irq(max8998, irq); | 135 | struct max8998_irq_data *irq_data = irq_to_max8998_irq(max8998, |
136 | data->irq); | ||
136 | 137 | ||
137 | max8998->irq_masks_cur[irq_data->reg - 1] &= ~irq_data->mask; | 138 | max8998->irq_masks_cur[irq_data->reg - 1] &= ~irq_data->mask; |
138 | } | 139 | } |
139 | 140 | ||
140 | static void max8998_irq_mask(unsigned int irq) | 141 | static void max8998_irq_mask(struct irq_data *data) |
141 | { | 142 | { |
142 | struct max8998_dev *max8998 = get_irq_chip_data(irq); | 143 | struct max8998_dev *max8998 = irq_data_get_irq_chip_data(data); |
143 | struct max8998_irq_data *irq_data = irq_to_max8998_irq(max8998, irq); | 144 | struct max8998_irq_data *irq_data = irq_to_max8998_irq(max8998, |
145 | data->irq); | ||
144 | 146 | ||
145 | max8998->irq_masks_cur[irq_data->reg - 1] |= irq_data->mask; | 147 | max8998->irq_masks_cur[irq_data->reg - 1] |= irq_data->mask; |
146 | } | 148 | } |
147 | 149 | ||
148 | static struct irq_chip max8998_irq_chip = { | 150 | static struct irq_chip max8998_irq_chip = { |
149 | .name = "max8998", | 151 | .name = "max8998", |
150 | .bus_lock = max8998_irq_lock, | 152 | .irq_bus_lock = max8998_irq_lock, |
151 | .bus_sync_unlock = max8998_irq_sync_unlock, | 153 | .irq_bus_sync_unlock = max8998_irq_sync_unlock, |
152 | .mask = max8998_irq_mask, | 154 | .irq_mask = max8998_irq_mask, |
153 | .unmask = max8998_irq_unmask, | 155 | .irq_unmask = max8998_irq_unmask, |
154 | }; | 156 | }; |
155 | 157 | ||
156 | static irqreturn_t max8998_irq_thread(int irq, void *data) | 158 | static irqreturn_t max8998_irq_thread(int irq, void *data) |
@@ -181,6 +183,13 @@ static irqreturn_t max8998_irq_thread(int irq, void *data) | |||
181 | return IRQ_HANDLED; | 183 | return IRQ_HANDLED; |
182 | } | 184 | } |
183 | 185 | ||
186 | int max8998_irq_resume(struct max8998_dev *max8998) | ||
187 | { | ||
188 | if (max8998->irq && max8998->irq_base) | ||
189 | max8998_irq_thread(max8998->irq_base, max8998); | ||
190 | return 0; | ||
191 | } | ||
192 | |||
184 | int max8998_irq_init(struct max8998_dev *max8998) | 193 | int max8998_irq_init(struct max8998_dev *max8998) |
185 | { | 194 | { |
186 | int i; | 195 | int i; |
diff --git a/drivers/mfd/max8998.c b/drivers/mfd/max8998.c index bb9977bebe78..bbfe86732602 100644 --- a/drivers/mfd/max8998.c +++ b/drivers/mfd/max8998.c | |||
@@ -25,6 +25,8 @@ | |||
25 | #include <linux/init.h> | 25 | #include <linux/init.h> |
26 | #include <linux/slab.h> | 26 | #include <linux/slab.h> |
27 | #include <linux/i2c.h> | 27 | #include <linux/i2c.h> |
28 | #include <linux/interrupt.h> | ||
29 | #include <linux/pm_runtime.h> | ||
28 | #include <linux/mutex.h> | 30 | #include <linux/mutex.h> |
29 | #include <linux/mfd/core.h> | 31 | #include <linux/mfd/core.h> |
30 | #include <linux/mfd/max8998.h> | 32 | #include <linux/mfd/max8998.h> |
@@ -40,6 +42,14 @@ static struct mfd_cell max8998_devs[] = { | |||
40 | }, | 42 | }, |
41 | }; | 43 | }; |
42 | 44 | ||
45 | static struct mfd_cell lp3974_devs[] = { | ||
46 | { | ||
47 | .name = "lp3974-pmic", | ||
48 | }, { | ||
49 | .name = "lp3974-rtc", | ||
50 | }, | ||
51 | }; | ||
52 | |||
43 | int max8998_read_reg(struct i2c_client *i2c, u8 reg, u8 *dest) | 53 | int max8998_read_reg(struct i2c_client *i2c, u8 reg, u8 *dest) |
44 | { | 54 | { |
45 | struct max8998_dev *max8998 = i2c_get_clientdata(i2c); | 55 | struct max8998_dev *max8998 = i2c_get_clientdata(i2c); |
@@ -135,6 +145,7 @@ static int max8998_i2c_probe(struct i2c_client *i2c, | |||
135 | if (pdata) { | 145 | if (pdata) { |
136 | max8998->ono = pdata->ono; | 146 | max8998->ono = pdata->ono; |
137 | max8998->irq_base = pdata->irq_base; | 147 | max8998->irq_base = pdata->irq_base; |
148 | max8998->wakeup = pdata->wakeup; | ||
138 | } | 149 | } |
139 | mutex_init(&max8998->iolock); | 150 | mutex_init(&max8998->iolock); |
140 | 151 | ||
@@ -143,9 +154,23 @@ static int max8998_i2c_probe(struct i2c_client *i2c, | |||
143 | 154 | ||
144 | max8998_irq_init(max8998); | 155 | max8998_irq_init(max8998); |
145 | 156 | ||
146 | ret = mfd_add_devices(max8998->dev, -1, | 157 | pm_runtime_set_active(max8998->dev); |
147 | max8998_devs, ARRAY_SIZE(max8998_devs), | 158 | |
148 | NULL, 0); | 159 | switch (id->driver_data) { |
160 | case TYPE_LP3974: | ||
161 | ret = mfd_add_devices(max8998->dev, -1, | ||
162 | lp3974_devs, ARRAY_SIZE(lp3974_devs), | ||
163 | NULL, 0); | ||
164 | break; | ||
165 | case TYPE_MAX8998: | ||
166 | ret = mfd_add_devices(max8998->dev, -1, | ||
167 | max8998_devs, ARRAY_SIZE(max8998_devs), | ||
168 | NULL, 0); | ||
169 | break; | ||
170 | default: | ||
171 | ret = -EINVAL; | ||
172 | } | ||
173 | |||
149 | if (ret < 0) | 174 | if (ret < 0) |
150 | goto err; | 175 | goto err; |
151 | 176 | ||
@@ -178,10 +203,113 @@ static const struct i2c_device_id max8998_i2c_id[] = { | |||
178 | }; | 203 | }; |
179 | MODULE_DEVICE_TABLE(i2c, max8998_i2c_id); | 204 | MODULE_DEVICE_TABLE(i2c, max8998_i2c_id); |
180 | 205 | ||
206 | static int max8998_suspend(struct device *dev) | ||
207 | { | ||
208 | struct i2c_client *i2c = container_of(dev, struct i2c_client, dev); | ||
209 | struct max8998_dev *max8998 = i2c_get_clientdata(i2c); | ||
210 | |||
211 | if (max8998->wakeup) | ||
212 | set_irq_wake(max8998->irq, 1); | ||
213 | return 0; | ||
214 | } | ||
215 | |||
216 | static int max8998_resume(struct device *dev) | ||
217 | { | ||
218 | struct i2c_client *i2c = container_of(dev, struct i2c_client, dev); | ||
219 | struct max8998_dev *max8998 = i2c_get_clientdata(i2c); | ||
220 | |||
221 | if (max8998->wakeup) | ||
222 | set_irq_wake(max8998->irq, 0); | ||
223 | /* | ||
224 | * In LP3974, if IRQ registers are not "read & clear" | ||
225 | * when it's set during sleep, the interrupt becomes | ||
226 | * disabled. | ||
227 | */ | ||
228 | return max8998_irq_resume(i2c_get_clientdata(i2c)); | ||
229 | } | ||
230 | |||
231 | struct max8998_reg_dump { | ||
232 | u8 addr; | ||
233 | u8 val; | ||
234 | }; | ||
235 | #define SAVE_ITEM(x) { .addr = (x), .val = 0x0, } | ||
236 | struct max8998_reg_dump max8998_dump[] = { | ||
237 | SAVE_ITEM(MAX8998_REG_IRQM1), | ||
238 | SAVE_ITEM(MAX8998_REG_IRQM2), | ||
239 | SAVE_ITEM(MAX8998_REG_IRQM3), | ||
240 | SAVE_ITEM(MAX8998_REG_IRQM4), | ||
241 | SAVE_ITEM(MAX8998_REG_STATUSM1), | ||
242 | SAVE_ITEM(MAX8998_REG_STATUSM2), | ||
243 | SAVE_ITEM(MAX8998_REG_CHGR1), | ||
244 | SAVE_ITEM(MAX8998_REG_CHGR2), | ||
245 | SAVE_ITEM(MAX8998_REG_LDO_ACTIVE_DISCHARGE1), | ||
246 | SAVE_ITEM(MAX8998_REG_LDO_ACTIVE_DISCHARGE1), | ||
247 | SAVE_ITEM(MAX8998_REG_BUCK_ACTIVE_DISCHARGE3), | ||
248 | SAVE_ITEM(MAX8998_REG_ONOFF1), | ||
249 | SAVE_ITEM(MAX8998_REG_ONOFF2), | ||
250 | SAVE_ITEM(MAX8998_REG_ONOFF3), | ||
251 | SAVE_ITEM(MAX8998_REG_ONOFF4), | ||
252 | SAVE_ITEM(MAX8998_REG_BUCK1_VOLTAGE1), | ||
253 | SAVE_ITEM(MAX8998_REG_BUCK1_VOLTAGE2), | ||
254 | SAVE_ITEM(MAX8998_REG_BUCK1_VOLTAGE3), | ||
255 | SAVE_ITEM(MAX8998_REG_BUCK1_VOLTAGE4), | ||
256 | SAVE_ITEM(MAX8998_REG_BUCK2_VOLTAGE1), | ||
257 | SAVE_ITEM(MAX8998_REG_BUCK2_VOLTAGE2), | ||
258 | SAVE_ITEM(MAX8998_REG_LDO2_LDO3), | ||
259 | SAVE_ITEM(MAX8998_REG_LDO4), | ||
260 | SAVE_ITEM(MAX8998_REG_LDO5), | ||
261 | SAVE_ITEM(MAX8998_REG_LDO6), | ||
262 | SAVE_ITEM(MAX8998_REG_LDO7), | ||
263 | SAVE_ITEM(MAX8998_REG_LDO8_LDO9), | ||
264 | SAVE_ITEM(MAX8998_REG_LDO10_LDO11), | ||
265 | SAVE_ITEM(MAX8998_REG_LDO12), | ||
266 | SAVE_ITEM(MAX8998_REG_LDO13), | ||
267 | SAVE_ITEM(MAX8998_REG_LDO14), | ||
268 | SAVE_ITEM(MAX8998_REG_LDO15), | ||
269 | SAVE_ITEM(MAX8998_REG_LDO16), | ||
270 | SAVE_ITEM(MAX8998_REG_LDO17), | ||
271 | SAVE_ITEM(MAX8998_REG_BKCHR), | ||
272 | SAVE_ITEM(MAX8998_REG_LBCNFG1), | ||
273 | SAVE_ITEM(MAX8998_REG_LBCNFG2), | ||
274 | }; | ||
275 | /* Save registers before hibernation */ | ||
276 | static int max8998_freeze(struct device *dev) | ||
277 | { | ||
278 | struct i2c_client *i2c = container_of(dev, struct i2c_client, dev); | ||
279 | int i; | ||
280 | |||
281 | for (i = 0; i < ARRAY_SIZE(max8998_dump); i++) | ||
282 | max8998_read_reg(i2c, max8998_dump[i].addr, | ||
283 | &max8998_dump[i].val); | ||
284 | |||
285 | return 0; | ||
286 | } | ||
287 | |||
288 | /* Restore registers after hibernation */ | ||
289 | static int max8998_restore(struct device *dev) | ||
290 | { | ||
291 | struct i2c_client *i2c = container_of(dev, struct i2c_client, dev); | ||
292 | int i; | ||
293 | |||
294 | for (i = 0; i < ARRAY_SIZE(max8998_dump); i++) | ||
295 | max8998_write_reg(i2c, max8998_dump[i].addr, | ||
296 | max8998_dump[i].val); | ||
297 | |||
298 | return 0; | ||
299 | } | ||
300 | |||
301 | const struct dev_pm_ops max8998_pm = { | ||
302 | .suspend = max8998_suspend, | ||
303 | .resume = max8998_resume, | ||
304 | .freeze = max8998_freeze, | ||
305 | .restore = max8998_restore, | ||
306 | }; | ||
307 | |||
181 | static struct i2c_driver max8998_i2c_driver = { | 308 | static struct i2c_driver max8998_i2c_driver = { |
182 | .driver = { | 309 | .driver = { |
183 | .name = "max8998", | 310 | .name = "max8998", |
184 | .owner = THIS_MODULE, | 311 | .owner = THIS_MODULE, |
312 | .pm = &max8998_pm, | ||
185 | }, | 313 | }, |
186 | .probe = max8998_i2c_probe, | 314 | .probe = max8998_i2c_probe, |
187 | .remove = max8998_i2c_remove, | 315 | .remove = max8998_i2c_remove, |
diff --git a/drivers/mfd/mc13xxx-core.c b/drivers/mfd/mc13xxx-core.c index a2ac2ed6d64c..b9fcaf0004da 100644 --- a/drivers/mfd/mc13xxx-core.c +++ b/drivers/mfd/mc13xxx-core.c | |||
@@ -749,7 +749,7 @@ static int mc13xxx_probe(struct spi_device *spi) | |||
749 | if (ret) { | 749 | if (ret) { |
750 | err_mask: | 750 | err_mask: |
751 | err_revision: | 751 | err_revision: |
752 | mutex_unlock(&mc13xxx->lock); | 752 | mc13xxx_unlock(mc13xxx); |
753 | dev_set_drvdata(&spi->dev, NULL); | 753 | dev_set_drvdata(&spi->dev, NULL); |
754 | kfree(mc13xxx); | 754 | kfree(mc13xxx); |
755 | return ret; | 755 | return ret; |
diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c index ec99f681e773..d83ad0f141af 100644 --- a/drivers/mfd/mfd-core.c +++ b/drivers/mfd/mfd-core.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/platform_device.h> | 15 | #include <linux/platform_device.h> |
16 | #include <linux/acpi.h> | 16 | #include <linux/acpi.h> |
17 | #include <linux/mfd/core.h> | 17 | #include <linux/mfd/core.h> |
18 | #include <linux/pm_runtime.h> | ||
18 | #include <linux/slab.h> | 19 | #include <linux/slab.h> |
19 | 20 | ||
20 | static int mfd_add_device(struct device *parent, int id, | 21 | static int mfd_add_device(struct device *parent, int id, |
@@ -82,6 +83,9 @@ static int mfd_add_device(struct device *parent, int id, | |||
82 | if (ret) | 83 | if (ret) |
83 | goto fail_res; | 84 | goto fail_res; |
84 | 85 | ||
86 | if (cell->pm_runtime_no_callbacks) | ||
87 | pm_runtime_no_callbacks(&pdev->dev); | ||
88 | |||
85 | kfree(res); | 89 | kfree(res); |
86 | 90 | ||
87 | return 0; | 91 | return 0; |
diff --git a/drivers/mfd/sm501.c b/drivers/mfd/sm501.c index bc9275c12133..5de3a760ea1e 100644 --- a/drivers/mfd/sm501.c +++ b/drivers/mfd/sm501.c | |||
@@ -26,7 +26,7 @@ | |||
26 | #include <linux/sm501-regs.h> | 26 | #include <linux/sm501-regs.h> |
27 | #include <linux/serial_8250.h> | 27 | #include <linux/serial_8250.h> |
28 | 28 | ||
29 | #include <asm/io.h> | 29 | #include <linux/io.h> |
30 | 30 | ||
31 | struct sm501_device { | 31 | struct sm501_device { |
32 | struct list_head list; | 32 | struct list_head list; |
@@ -745,11 +745,8 @@ static int sm501_register_device(struct sm501_devdata *sm, | |||
745 | int ret; | 745 | int ret; |
746 | 746 | ||
747 | for (ptr = 0; ptr < pdev->num_resources; ptr++) { | 747 | for (ptr = 0; ptr < pdev->num_resources; ptr++) { |
748 | printk(KERN_DEBUG "%s[%d] flags %08lx: %08llx..%08llx\n", | 748 | printk(KERN_DEBUG "%s[%d] %pR\n", |
749 | pdev->name, ptr, | 749 | pdev->name, ptr, &pdev->resource[ptr]); |
750 | pdev->resource[ptr].flags, | ||
751 | (unsigned long long)pdev->resource[ptr].start, | ||
752 | (unsigned long long)pdev->resource[ptr].end); | ||
753 | } | 750 | } |
754 | 751 | ||
755 | ret = platform_device_register(pdev); | 752 | ret = platform_device_register(pdev); |
diff --git a/drivers/mfd/stmpe.c b/drivers/mfd/stmpe.c index b11487f1e1cb..3e5732b58c49 100644 --- a/drivers/mfd/stmpe.c +++ b/drivers/mfd/stmpe.c | |||
@@ -699,16 +699,16 @@ static irqreturn_t stmpe_irq(int irq, void *data) | |||
699 | return IRQ_HANDLED; | 699 | return IRQ_HANDLED; |
700 | } | 700 | } |
701 | 701 | ||
702 | static void stmpe_irq_lock(unsigned int irq) | 702 | static void stmpe_irq_lock(struct irq_data *data) |
703 | { | 703 | { |
704 | struct stmpe *stmpe = get_irq_chip_data(irq); | 704 | struct stmpe *stmpe = irq_data_get_irq_chip_data(data); |
705 | 705 | ||
706 | mutex_lock(&stmpe->irq_lock); | 706 | mutex_lock(&stmpe->irq_lock); |
707 | } | 707 | } |
708 | 708 | ||
709 | static void stmpe_irq_sync_unlock(unsigned int irq) | 709 | static void stmpe_irq_sync_unlock(struct irq_data *data) |
710 | { | 710 | { |
711 | struct stmpe *stmpe = get_irq_chip_data(irq); | 711 | struct stmpe *stmpe = irq_data_get_irq_chip_data(data); |
712 | struct stmpe_variant_info *variant = stmpe->variant; | 712 | struct stmpe_variant_info *variant = stmpe->variant; |
713 | int num = DIV_ROUND_UP(variant->num_irqs, 8); | 713 | int num = DIV_ROUND_UP(variant->num_irqs, 8); |
714 | int i; | 714 | int i; |
@@ -727,20 +727,20 @@ static void stmpe_irq_sync_unlock(unsigned int irq) | |||
727 | mutex_unlock(&stmpe->irq_lock); | 727 | mutex_unlock(&stmpe->irq_lock); |
728 | } | 728 | } |
729 | 729 | ||
730 | static void stmpe_irq_mask(unsigned int irq) | 730 | static void stmpe_irq_mask(struct irq_data *data) |
731 | { | 731 | { |
732 | struct stmpe *stmpe = get_irq_chip_data(irq); | 732 | struct stmpe *stmpe = irq_data_get_irq_chip_data(data); |
733 | int offset = irq - stmpe->irq_base; | 733 | int offset = data->irq - stmpe->irq_base; |
734 | int regoffset = offset / 8; | 734 | int regoffset = offset / 8; |
735 | int mask = 1 << (offset % 8); | 735 | int mask = 1 << (offset % 8); |
736 | 736 | ||
737 | stmpe->ier[regoffset] &= ~mask; | 737 | stmpe->ier[regoffset] &= ~mask; |
738 | } | 738 | } |
739 | 739 | ||
740 | static void stmpe_irq_unmask(unsigned int irq) | 740 | static void stmpe_irq_unmask(struct irq_data *data) |
741 | { | 741 | { |
742 | struct stmpe *stmpe = get_irq_chip_data(irq); | 742 | struct stmpe *stmpe = irq_data_get_irq_chip_data(data); |
743 | int offset = irq - stmpe->irq_base; | 743 | int offset = data->irq - stmpe->irq_base; |
744 | int regoffset = offset / 8; | 744 | int regoffset = offset / 8; |
745 | int mask = 1 << (offset % 8); | 745 | int mask = 1 << (offset % 8); |
746 | 746 | ||
@@ -749,10 +749,10 @@ static void stmpe_irq_unmask(unsigned int irq) | |||
749 | 749 | ||
750 | static struct irq_chip stmpe_irq_chip = { | 750 | static struct irq_chip stmpe_irq_chip = { |
751 | .name = "stmpe", | 751 | .name = "stmpe", |
752 | .bus_lock = stmpe_irq_lock, | 752 | .irq_bus_lock = stmpe_irq_lock, |
753 | .bus_sync_unlock = stmpe_irq_sync_unlock, | 753 | .irq_bus_sync_unlock = stmpe_irq_sync_unlock, |
754 | .mask = stmpe_irq_mask, | 754 | .irq_mask = stmpe_irq_mask, |
755 | .unmask = stmpe_irq_unmask, | 755 | .irq_unmask = stmpe_irq_unmask, |
756 | }; | 756 | }; |
757 | 757 | ||
758 | static int __devinit stmpe_irq_init(struct stmpe *stmpe) | 758 | static int __devinit stmpe_irq_init(struct stmpe *stmpe) |
diff --git a/drivers/mfd/t7l66xb.c b/drivers/mfd/t7l66xb.c index 006c121f3f0d..9caeb4ac6ea6 100644 --- a/drivers/mfd/t7l66xb.c +++ b/drivers/mfd/t7l66xb.c | |||
@@ -199,37 +199,37 @@ static void t7l66xb_irq(unsigned int irq, struct irq_desc *desc) | |||
199 | generic_handle_irq(irq_base + i); | 199 | generic_handle_irq(irq_base + i); |
200 | } | 200 | } |
201 | 201 | ||
202 | static void t7l66xb_irq_mask(unsigned int irq) | 202 | static void t7l66xb_irq_mask(struct irq_data *data) |
203 | { | 203 | { |
204 | struct t7l66xb *t7l66xb = get_irq_chip_data(irq); | 204 | struct t7l66xb *t7l66xb = irq_data_get_irq_chip_data(data); |
205 | unsigned long flags; | 205 | unsigned long flags; |
206 | u8 imr; | 206 | u8 imr; |
207 | 207 | ||
208 | spin_lock_irqsave(&t7l66xb->lock, flags); | 208 | spin_lock_irqsave(&t7l66xb->lock, flags); |
209 | imr = tmio_ioread8(t7l66xb->scr + SCR_IMR); | 209 | imr = tmio_ioread8(t7l66xb->scr + SCR_IMR); |
210 | imr |= 1 << (irq - t7l66xb->irq_base); | 210 | imr |= 1 << (data->irq - t7l66xb->irq_base); |
211 | tmio_iowrite8(imr, t7l66xb->scr + SCR_IMR); | 211 | tmio_iowrite8(imr, t7l66xb->scr + SCR_IMR); |
212 | spin_unlock_irqrestore(&t7l66xb->lock, flags); | 212 | spin_unlock_irqrestore(&t7l66xb->lock, flags); |
213 | } | 213 | } |
214 | 214 | ||
215 | static void t7l66xb_irq_unmask(unsigned int irq) | 215 | static void t7l66xb_irq_unmask(struct irq_data *data) |
216 | { | 216 | { |
217 | struct t7l66xb *t7l66xb = get_irq_chip_data(irq); | 217 | struct t7l66xb *t7l66xb = irq_data_get_irq_chip_data(data); |
218 | unsigned long flags; | 218 | unsigned long flags; |
219 | u8 imr; | 219 | u8 imr; |
220 | 220 | ||
221 | spin_lock_irqsave(&t7l66xb->lock, flags); | 221 | spin_lock_irqsave(&t7l66xb->lock, flags); |
222 | imr = tmio_ioread8(t7l66xb->scr + SCR_IMR); | 222 | imr = tmio_ioread8(t7l66xb->scr + SCR_IMR); |
223 | imr &= ~(1 << (irq - t7l66xb->irq_base)); | 223 | imr &= ~(1 << (data->irq - t7l66xb->irq_base)); |
224 | tmio_iowrite8(imr, t7l66xb->scr + SCR_IMR); | 224 | tmio_iowrite8(imr, t7l66xb->scr + SCR_IMR); |
225 | spin_unlock_irqrestore(&t7l66xb->lock, flags); | 225 | spin_unlock_irqrestore(&t7l66xb->lock, flags); |
226 | } | 226 | } |
227 | 227 | ||
228 | static struct irq_chip t7l66xb_chip = { | 228 | static struct irq_chip t7l66xb_chip = { |
229 | .name = "t7l66xb", | 229 | .name = "t7l66xb", |
230 | .ack = t7l66xb_irq_mask, | 230 | .irq_ack = t7l66xb_irq_mask, |
231 | .mask = t7l66xb_irq_mask, | 231 | .irq_mask = t7l66xb_irq_mask, |
232 | .unmask = t7l66xb_irq_unmask, | 232 | .irq_unmask = t7l66xb_irq_unmask, |
233 | }; | 233 | }; |
234 | 234 | ||
235 | /*--------------------------------------------------------------------------*/ | 235 | /*--------------------------------------------------------------------------*/ |
diff --git a/drivers/mfd/tc6393xb.c b/drivers/mfd/tc6393xb.c index 1ea80d8ad915..9a238633a54d 100644 --- a/drivers/mfd/tc6393xb.c +++ b/drivers/mfd/tc6393xb.c | |||
@@ -527,41 +527,41 @@ tc6393xb_irq(unsigned int irq, struct irq_desc *desc) | |||
527 | } | 527 | } |
528 | } | 528 | } |
529 | 529 | ||
530 | static void tc6393xb_irq_ack(unsigned int irq) | 530 | static void tc6393xb_irq_ack(struct irq_data *data) |
531 | { | 531 | { |
532 | } | 532 | } |
533 | 533 | ||
534 | static void tc6393xb_irq_mask(unsigned int irq) | 534 | static void tc6393xb_irq_mask(struct irq_data *data) |
535 | { | 535 | { |
536 | struct tc6393xb *tc6393xb = get_irq_chip_data(irq); | 536 | struct tc6393xb *tc6393xb = irq_data_get_irq_chip_data(data); |
537 | unsigned long flags; | 537 | unsigned long flags; |
538 | u8 imr; | 538 | u8 imr; |
539 | 539 | ||
540 | spin_lock_irqsave(&tc6393xb->lock, flags); | 540 | spin_lock_irqsave(&tc6393xb->lock, flags); |
541 | imr = tmio_ioread8(tc6393xb->scr + SCR_IMR); | 541 | imr = tmio_ioread8(tc6393xb->scr + SCR_IMR); |
542 | imr |= 1 << (irq - tc6393xb->irq_base); | 542 | imr |= 1 << (data->irq - tc6393xb->irq_base); |
543 | tmio_iowrite8(imr, tc6393xb->scr + SCR_IMR); | 543 | tmio_iowrite8(imr, tc6393xb->scr + SCR_IMR); |
544 | spin_unlock_irqrestore(&tc6393xb->lock, flags); | 544 | spin_unlock_irqrestore(&tc6393xb->lock, flags); |
545 | } | 545 | } |
546 | 546 | ||
547 | static void tc6393xb_irq_unmask(unsigned int irq) | 547 | static void tc6393xb_irq_unmask(struct irq_data *data) |
548 | { | 548 | { |
549 | struct tc6393xb *tc6393xb = get_irq_chip_data(irq); | 549 | struct tc6393xb *tc6393xb = irq_data_get_irq_chip_data(data); |
550 | unsigned long flags; | 550 | unsigned long flags; |
551 | u8 imr; | 551 | u8 imr; |
552 | 552 | ||
553 | spin_lock_irqsave(&tc6393xb->lock, flags); | 553 | spin_lock_irqsave(&tc6393xb->lock, flags); |
554 | imr = tmio_ioread8(tc6393xb->scr + SCR_IMR); | 554 | imr = tmio_ioread8(tc6393xb->scr + SCR_IMR); |
555 | imr &= ~(1 << (irq - tc6393xb->irq_base)); | 555 | imr &= ~(1 << (data->irq - tc6393xb->irq_base)); |
556 | tmio_iowrite8(imr, tc6393xb->scr + SCR_IMR); | 556 | tmio_iowrite8(imr, tc6393xb->scr + SCR_IMR); |
557 | spin_unlock_irqrestore(&tc6393xb->lock, flags); | 557 | spin_unlock_irqrestore(&tc6393xb->lock, flags); |
558 | } | 558 | } |
559 | 559 | ||
560 | static struct irq_chip tc6393xb_chip = { | 560 | static struct irq_chip tc6393xb_chip = { |
561 | .name = "tc6393xb", | 561 | .name = "tc6393xb", |
562 | .ack = tc6393xb_irq_ack, | 562 | .irq_ack = tc6393xb_irq_ack, |
563 | .mask = tc6393xb_irq_mask, | 563 | .irq_mask = tc6393xb_irq_mask, |
564 | .unmask = tc6393xb_irq_unmask, | 564 | .irq_unmask = tc6393xb_irq_unmask, |
565 | }; | 565 | }; |
566 | 566 | ||
567 | static void tc6393xb_attach_irq(struct platform_device *dev) | 567 | static void tc6393xb_attach_irq(struct platform_device *dev) |
diff --git a/drivers/mfd/tps65010.c b/drivers/mfd/tps65010.c index 90187fe33e04..93d5fdf020c7 100644 --- a/drivers/mfd/tps65010.c +++ b/drivers/mfd/tps65010.c | |||
@@ -34,7 +34,7 @@ | |||
34 | 34 | ||
35 | #include <linux/i2c/tps65010.h> | 35 | #include <linux/i2c/tps65010.h> |
36 | 36 | ||
37 | #include <asm/gpio.h> | 37 | #include <linux/gpio.h> |
38 | 38 | ||
39 | 39 | ||
40 | /*-------------------------------------------------------------------------*/ | 40 | /*-------------------------------------------------------------------------*/ |
diff --git a/drivers/mfd/tps6586x.c b/drivers/mfd/tps6586x.c index b4931ab34929..627cf577b16d 100644 --- a/drivers/mfd/tps6586x.c +++ b/drivers/mfd/tps6586x.c | |||
@@ -46,8 +46,6 @@ | |||
46 | 46 | ||
47 | /* device id */ | 47 | /* device id */ |
48 | #define TPS6586X_VERSIONCRC 0xcd | 48 | #define TPS6586X_VERSIONCRC 0xcd |
49 | #define TPS658621A_VERSIONCRC 0x15 | ||
50 | #define TPS658621C_VERSIONCRC 0x2c | ||
51 | 49 | ||
52 | struct tps6586x_irq_data { | 50 | struct tps6586x_irq_data { |
53 | u8 mask_reg; | 51 | u8 mask_reg; |
@@ -325,37 +323,37 @@ static int tps6586x_remove_subdevs(struct tps6586x *tps6586x) | |||
325 | return device_for_each_child(tps6586x->dev, NULL, __remove_subdev); | 323 | return device_for_each_child(tps6586x->dev, NULL, __remove_subdev); |
326 | } | 324 | } |
327 | 325 | ||
328 | static void tps6586x_irq_lock(unsigned int irq) | 326 | static void tps6586x_irq_lock(struct irq_data *data) |
329 | { | 327 | { |
330 | struct tps6586x *tps6586x = get_irq_chip_data(irq); | 328 | struct tps6586x *tps6586x = irq_data_get_irq_chip_data(data); |
331 | 329 | ||
332 | mutex_lock(&tps6586x->irq_lock); | 330 | mutex_lock(&tps6586x->irq_lock); |
333 | } | 331 | } |
334 | 332 | ||
335 | static void tps6586x_irq_enable(unsigned int irq) | 333 | static void tps6586x_irq_enable(struct irq_data *irq_data) |
336 | { | 334 | { |
337 | struct tps6586x *tps6586x = get_irq_chip_data(irq); | 335 | struct tps6586x *tps6586x = irq_data_get_irq_chip_data(irq_data); |
338 | unsigned int __irq = irq - tps6586x->irq_base; | 336 | unsigned int __irq = irq_data->irq - tps6586x->irq_base; |
339 | const struct tps6586x_irq_data *data = &tps6586x_irqs[__irq]; | 337 | const struct tps6586x_irq_data *data = &tps6586x_irqs[__irq]; |
340 | 338 | ||
341 | tps6586x->mask_reg[data->mask_reg] &= ~data->mask_mask; | 339 | tps6586x->mask_reg[data->mask_reg] &= ~data->mask_mask; |
342 | tps6586x->irq_en |= (1 << __irq); | 340 | tps6586x->irq_en |= (1 << __irq); |
343 | } | 341 | } |
344 | 342 | ||
345 | static void tps6586x_irq_disable(unsigned int irq) | 343 | static void tps6586x_irq_disable(struct irq_data *irq_data) |
346 | { | 344 | { |
347 | struct tps6586x *tps6586x = get_irq_chip_data(irq); | 345 | struct tps6586x *tps6586x = irq_data_get_irq_chip_data(irq_data); |
348 | 346 | ||
349 | unsigned int __irq = irq - tps6586x->irq_base; | 347 | unsigned int __irq = irq_data->irq - tps6586x->irq_base; |
350 | const struct tps6586x_irq_data *data = &tps6586x_irqs[__irq]; | 348 | const struct tps6586x_irq_data *data = &tps6586x_irqs[__irq]; |
351 | 349 | ||
352 | tps6586x->mask_reg[data->mask_reg] |= data->mask_mask; | 350 | tps6586x->mask_reg[data->mask_reg] |= data->mask_mask; |
353 | tps6586x->irq_en &= ~(1 << __irq); | 351 | tps6586x->irq_en &= ~(1 << __irq); |
354 | } | 352 | } |
355 | 353 | ||
356 | static void tps6586x_irq_sync_unlock(unsigned int irq) | 354 | static void tps6586x_irq_sync_unlock(struct irq_data *data) |
357 | { | 355 | { |
358 | struct tps6586x *tps6586x = get_irq_chip_data(irq); | 356 | struct tps6586x *tps6586x = irq_data_get_irq_chip_data(data); |
359 | int i; | 357 | int i; |
360 | 358 | ||
361 | for (i = 0; i < ARRAY_SIZE(tps6586x->mask_reg); i++) { | 359 | for (i = 0; i < ARRAY_SIZE(tps6586x->mask_reg); i++) { |
@@ -421,10 +419,10 @@ static int __devinit tps6586x_irq_init(struct tps6586x *tps6586x, int irq, | |||
421 | tps6586x->irq_base = irq_base; | 419 | tps6586x->irq_base = irq_base; |
422 | 420 | ||
423 | tps6586x->irq_chip.name = "tps6586x"; | 421 | tps6586x->irq_chip.name = "tps6586x"; |
424 | tps6586x->irq_chip.enable = tps6586x_irq_enable; | 422 | tps6586x->irq_chip.irq_enable = tps6586x_irq_enable; |
425 | tps6586x->irq_chip.disable = tps6586x_irq_disable; | 423 | tps6586x->irq_chip.irq_disable = tps6586x_irq_disable; |
426 | tps6586x->irq_chip.bus_lock = tps6586x_irq_lock; | 424 | tps6586x->irq_chip.irq_bus_lock = tps6586x_irq_lock; |
427 | tps6586x->irq_chip.bus_sync_unlock = tps6586x_irq_sync_unlock; | 425 | tps6586x->irq_chip.irq_bus_sync_unlock = tps6586x_irq_sync_unlock; |
428 | 426 | ||
429 | for (i = 0; i < ARRAY_SIZE(tps6586x_irqs); i++) { | 427 | for (i = 0; i < ARRAY_SIZE(tps6586x_irqs); i++) { |
430 | int __irq = i + tps6586x->irq_base; | 428 | int __irq = i + tps6586x->irq_base; |
@@ -498,11 +496,7 @@ static int __devinit tps6586x_i2c_probe(struct i2c_client *client, | |||
498 | return -EIO; | 496 | return -EIO; |
499 | } | 497 | } |
500 | 498 | ||
501 | if ((ret != TPS658621A_VERSIONCRC) && | 499 | dev_info(&client->dev, "VERSIONCRC is %02x\n", ret); |
502 | (ret != TPS658621C_VERSIONCRC)) { | ||
503 | dev_err(&client->dev, "Unsupported chip ID: %x\n", ret); | ||
504 | return -ENODEV; | ||
505 | } | ||
506 | 500 | ||
507 | tps6586x = kzalloc(sizeof(struct tps6586x), GFP_KERNEL); | 501 | tps6586x = kzalloc(sizeof(struct tps6586x), GFP_KERNEL); |
508 | if (tps6586x == NULL) | 502 | if (tps6586x == NULL) |
diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c index 12abd5b924b3..a35fa7dcbf53 100644 --- a/drivers/mfd/twl-core.c +++ b/drivers/mfd/twl-core.c | |||
@@ -1003,7 +1003,7 @@ static int twl_remove(struct i2c_client *client) | |||
1003 | } | 1003 | } |
1004 | 1004 | ||
1005 | /* NOTE: this driver only handles a single twl4030/tps659x0 chip */ | 1005 | /* NOTE: this driver only handles a single twl4030/tps659x0 chip */ |
1006 | static int __init | 1006 | static int __devinit |
1007 | twl_probe(struct i2c_client *client, const struct i2c_device_id *id) | 1007 | twl_probe(struct i2c_client *client, const struct i2c_device_id *id) |
1008 | { | 1008 | { |
1009 | int status; | 1009 | int status; |
diff --git a/drivers/mfd/twl4030-irq.c b/drivers/mfd/twl4030-irq.c index 5d3a1478004b..63a30e88908f 100644 --- a/drivers/mfd/twl4030-irq.c +++ b/drivers/mfd/twl4030-irq.c | |||
@@ -599,38 +599,38 @@ static void twl4030_sih_do_edge(struct work_struct *work) | |||
599 | * completion, potentially including some re-ordering, of these requests. | 599 | * completion, potentially including some re-ordering, of these requests. |
600 | */ | 600 | */ |
601 | 601 | ||
602 | static void twl4030_sih_mask(unsigned irq) | 602 | static void twl4030_sih_mask(struct irq_data *data) |
603 | { | 603 | { |
604 | struct sih_agent *sih = get_irq_chip_data(irq); | 604 | struct sih_agent *sih = irq_data_get_irq_chip_data(data); |
605 | unsigned long flags; | 605 | unsigned long flags; |
606 | 606 | ||
607 | spin_lock_irqsave(&sih_agent_lock, flags); | 607 | spin_lock_irqsave(&sih_agent_lock, flags); |
608 | sih->imr |= BIT(irq - sih->irq_base); | 608 | sih->imr |= BIT(data->irq - sih->irq_base); |
609 | sih->imr_change_pending = true; | 609 | sih->imr_change_pending = true; |
610 | queue_work(wq, &sih->mask_work); | 610 | queue_work(wq, &sih->mask_work); |
611 | spin_unlock_irqrestore(&sih_agent_lock, flags); | 611 | spin_unlock_irqrestore(&sih_agent_lock, flags); |
612 | } | 612 | } |
613 | 613 | ||
614 | static void twl4030_sih_unmask(unsigned irq) | 614 | static void twl4030_sih_unmask(struct irq_data *data) |
615 | { | 615 | { |
616 | struct sih_agent *sih = get_irq_chip_data(irq); | 616 | struct sih_agent *sih = irq_data_get_irq_chip_data(data); |
617 | unsigned long flags; | 617 | unsigned long flags; |
618 | 618 | ||
619 | spin_lock_irqsave(&sih_agent_lock, flags); | 619 | spin_lock_irqsave(&sih_agent_lock, flags); |
620 | sih->imr &= ~BIT(irq - sih->irq_base); | 620 | sih->imr &= ~BIT(data->irq - sih->irq_base); |
621 | sih->imr_change_pending = true; | 621 | sih->imr_change_pending = true; |
622 | queue_work(wq, &sih->mask_work); | 622 | queue_work(wq, &sih->mask_work); |
623 | spin_unlock_irqrestore(&sih_agent_lock, flags); | 623 | spin_unlock_irqrestore(&sih_agent_lock, flags); |
624 | } | 624 | } |
625 | 625 | ||
626 | static int twl4030_sih_set_type(unsigned irq, unsigned trigger) | 626 | static int twl4030_sih_set_type(struct irq_data *data, unsigned trigger) |
627 | { | 627 | { |
628 | struct sih_agent *sih = get_irq_chip_data(irq); | 628 | struct sih_agent *sih = irq_data_get_irq_chip_data(data); |
629 | struct irq_desc *desc = irq_to_desc(irq); | 629 | struct irq_desc *desc = irq_to_desc(data->irq); |
630 | unsigned long flags; | 630 | unsigned long flags; |
631 | 631 | ||
632 | if (!desc) { | 632 | if (!desc) { |
633 | pr_err("twl4030: Invalid IRQ: %d\n", irq); | 633 | pr_err("twl4030: Invalid IRQ: %d\n", data->irq); |
634 | return -EINVAL; | 634 | return -EINVAL; |
635 | } | 635 | } |
636 | 636 | ||
@@ -641,7 +641,7 @@ static int twl4030_sih_set_type(unsigned irq, unsigned trigger) | |||
641 | if ((desc->status & IRQ_TYPE_SENSE_MASK) != trigger) { | 641 | if ((desc->status & IRQ_TYPE_SENSE_MASK) != trigger) { |
642 | desc->status &= ~IRQ_TYPE_SENSE_MASK; | 642 | desc->status &= ~IRQ_TYPE_SENSE_MASK; |
643 | desc->status |= trigger; | 643 | desc->status |= trigger; |
644 | sih->edge_change |= BIT(irq - sih->irq_base); | 644 | sih->edge_change |= BIT(data->irq - sih->irq_base); |
645 | queue_work(wq, &sih->edge_work); | 645 | queue_work(wq, &sih->edge_work); |
646 | } | 646 | } |
647 | spin_unlock_irqrestore(&sih_agent_lock, flags); | 647 | spin_unlock_irqrestore(&sih_agent_lock, flags); |
@@ -650,9 +650,9 @@ static int twl4030_sih_set_type(unsigned irq, unsigned trigger) | |||
650 | 650 | ||
651 | static struct irq_chip twl4030_sih_irq_chip = { | 651 | static struct irq_chip twl4030_sih_irq_chip = { |
652 | .name = "twl4030", | 652 | .name = "twl4030", |
653 | .mask = twl4030_sih_mask, | 653 | .irq_mask = twl4030_sih_mask, |
654 | .unmask = twl4030_sih_unmask, | 654 | .irq_unmask = twl4030_sih_unmask, |
655 | .set_type = twl4030_sih_set_type, | 655 | .irq_set_type = twl4030_sih_set_type, |
656 | }; | 656 | }; |
657 | 657 | ||
658 | /*----------------------------------------------------------------------*/ | 658 | /*----------------------------------------------------------------------*/ |
diff --git a/drivers/mfd/twl6030-irq.c b/drivers/mfd/twl6030-irq.c index 06c8955907e9..4082ed73613f 100644 --- a/drivers/mfd/twl6030-irq.c +++ b/drivers/mfd/twl6030-irq.c | |||
@@ -332,7 +332,7 @@ int twl6030_init_irq(int irq_num, unsigned irq_base, unsigned irq_end) | |||
332 | */ | 332 | */ |
333 | twl6030_irq_chip = dummy_irq_chip; | 333 | twl6030_irq_chip = dummy_irq_chip; |
334 | twl6030_irq_chip.name = "twl6030"; | 334 | twl6030_irq_chip.name = "twl6030"; |
335 | twl6030_irq_chip.set_type = NULL; | 335 | twl6030_irq_chip.irq_set_type = NULL; |
336 | 336 | ||
337 | for (i = irq_base; i < irq_end; i++) { | 337 | for (i = irq_base; i < irq_end; i++) { |
338 | set_irq_chip_and_handler(i, &twl6030_irq_chip, | 338 | set_irq_chip_and_handler(i, &twl6030_irq_chip, |
diff --git a/drivers/mfd/vx855.c b/drivers/mfd/vx855.c index ebb059765edd..348052aa5dbf 100644 --- a/drivers/mfd/vx855.c +++ b/drivers/mfd/vx855.c | |||
@@ -112,7 +112,7 @@ out: | |||
112 | return ret; | 112 | return ret; |
113 | } | 113 | } |
114 | 114 | ||
115 | static void vx855_remove(struct pci_dev *pdev) | 115 | static void __devexit vx855_remove(struct pci_dev *pdev) |
116 | { | 116 | { |
117 | mfd_remove_devices(&pdev->dev); | 117 | mfd_remove_devices(&pdev->dev); |
118 | pci_disable_device(pdev); | 118 | pci_disable_device(pdev); |
diff --git a/drivers/mfd/wm831x-core.c b/drivers/mfd/wm831x-core.c index 76cadcf3b1fe..3fe9a58fe6c7 100644 --- a/drivers/mfd/wm831x-core.c +++ b/drivers/mfd/wm831x-core.c | |||
@@ -1541,6 +1541,12 @@ int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq) | |||
1541 | dev_info(wm831x->dev, "WM8325 revision %c\n", 'A' + rev); | 1541 | dev_info(wm831x->dev, "WM8325 revision %c\n", 'A' + rev); |
1542 | break; | 1542 | break; |
1543 | 1543 | ||
1544 | case WM8326: | ||
1545 | parent = WM8326; | ||
1546 | wm831x->num_gpio = 12; | ||
1547 | dev_info(wm831x->dev, "WM8326 revision %c\n", 'A' + rev); | ||
1548 | break; | ||
1549 | |||
1544 | default: | 1550 | default: |
1545 | dev_err(wm831x->dev, "Unknown WM831x device %04x\n", ret); | 1551 | dev_err(wm831x->dev, "Unknown WM831x device %04x\n", ret); |
1546 | ret = -EINVAL; | 1552 | ret = -EINVAL; |
@@ -1610,18 +1616,9 @@ int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq) | |||
1610 | break; | 1616 | break; |
1611 | 1617 | ||
1612 | case WM8320: | 1618 | case WM8320: |
1613 | ret = mfd_add_devices(wm831x->dev, -1, | ||
1614 | wm8320_devs, ARRAY_SIZE(wm8320_devs), | ||
1615 | NULL, 0); | ||
1616 | break; | ||
1617 | |||
1618 | case WM8321: | 1619 | case WM8321: |
1619 | ret = mfd_add_devices(wm831x->dev, -1, | ||
1620 | wm8320_devs, ARRAY_SIZE(wm8320_devs), | ||
1621 | NULL, 0); | ||
1622 | break; | ||
1623 | |||
1624 | case WM8325: | 1620 | case WM8325: |
1621 | case WM8326: | ||
1625 | ret = mfd_add_devices(wm831x->dev, -1, | 1622 | ret = mfd_add_devices(wm831x->dev, -1, |
1626 | wm8320_devs, ARRAY_SIZE(wm8320_devs), | 1623 | wm8320_devs, ARRAY_SIZE(wm8320_devs), |
1627 | NULL, wm831x->irq_base); | 1624 | NULL, wm831x->irq_base); |
diff --git a/drivers/mfd/wm831x-i2c.c b/drivers/mfd/wm831x-i2c.c index 156b19859e81..3853fa8e7cc2 100644 --- a/drivers/mfd/wm831x-i2c.c +++ b/drivers/mfd/wm831x-i2c.c | |||
@@ -94,9 +94,9 @@ static int wm831x_i2c_remove(struct i2c_client *i2c) | |||
94 | return 0; | 94 | return 0; |
95 | } | 95 | } |
96 | 96 | ||
97 | static int wm831x_i2c_suspend(struct i2c_client *i2c, pm_message_t mesg) | 97 | static int wm831x_i2c_suspend(struct device *dev) |
98 | { | 98 | { |
99 | struct wm831x *wm831x = i2c_get_clientdata(i2c); | 99 | struct wm831x *wm831x = dev_get_drvdata(dev); |
100 | 100 | ||
101 | return wm831x_device_suspend(wm831x); | 101 | return wm831x_device_suspend(wm831x); |
102 | } | 102 | } |
@@ -108,19 +108,23 @@ static const struct i2c_device_id wm831x_i2c_id[] = { | |||
108 | { "wm8320", WM8320 }, | 108 | { "wm8320", WM8320 }, |
109 | { "wm8321", WM8321 }, | 109 | { "wm8321", WM8321 }, |
110 | { "wm8325", WM8325 }, | 110 | { "wm8325", WM8325 }, |
111 | { "wm8326", WM8326 }, | ||
111 | { } | 112 | { } |
112 | }; | 113 | }; |
113 | MODULE_DEVICE_TABLE(i2c, wm831x_i2c_id); | 114 | MODULE_DEVICE_TABLE(i2c, wm831x_i2c_id); |
114 | 115 | ||
116 | static const struct dev_pm_ops wm831x_pm_ops = { | ||
117 | .suspend = wm831x_i2c_suspend, | ||
118 | }; | ||
115 | 119 | ||
116 | static struct i2c_driver wm831x_i2c_driver = { | 120 | static struct i2c_driver wm831x_i2c_driver = { |
117 | .driver = { | 121 | .driver = { |
118 | .name = "wm831x", | 122 | .name = "wm831x", |
119 | .owner = THIS_MODULE, | 123 | .owner = THIS_MODULE, |
124 | .pm = &wm831x_pm_ops, | ||
120 | }, | 125 | }, |
121 | .probe = wm831x_i2c_probe, | 126 | .probe = wm831x_i2c_probe, |
122 | .remove = wm831x_i2c_remove, | 127 | .remove = wm831x_i2c_remove, |
123 | .suspend = wm831x_i2c_suspend, | ||
124 | .id_table = wm831x_i2c_id, | 128 | .id_table = wm831x_i2c_id, |
125 | }; | 129 | }; |
126 | 130 | ||
diff --git a/drivers/mfd/wm831x-irq.c b/drivers/mfd/wm831x-irq.c index 294183b6260b..f7192d438aab 100644 --- a/drivers/mfd/wm831x-irq.c +++ b/drivers/mfd/wm831x-irq.c | |||
@@ -345,16 +345,16 @@ static inline struct wm831x_irq_data *irq_to_wm831x_irq(struct wm831x *wm831x, | |||
345 | return &wm831x_irqs[irq - wm831x->irq_base]; | 345 | return &wm831x_irqs[irq - wm831x->irq_base]; |
346 | } | 346 | } |
347 | 347 | ||
348 | static void wm831x_irq_lock(unsigned int irq) | 348 | static void wm831x_irq_lock(struct irq_data *data) |
349 | { | 349 | { |
350 | struct wm831x *wm831x = get_irq_chip_data(irq); | 350 | struct wm831x *wm831x = irq_data_get_irq_chip_data(data); |
351 | 351 | ||
352 | mutex_lock(&wm831x->irq_lock); | 352 | mutex_lock(&wm831x->irq_lock); |
353 | } | 353 | } |
354 | 354 | ||
355 | static void wm831x_irq_sync_unlock(unsigned int irq) | 355 | static void wm831x_irq_sync_unlock(struct irq_data *data) |
356 | { | 356 | { |
357 | struct wm831x *wm831x = get_irq_chip_data(irq); | 357 | struct wm831x *wm831x = irq_data_get_irq_chip_data(data); |
358 | int i; | 358 | int i; |
359 | 359 | ||
360 | for (i = 0; i < ARRAY_SIZE(wm831x->irq_masks_cur); i++) { | 360 | for (i = 0; i < ARRAY_SIZE(wm831x->irq_masks_cur); i++) { |
@@ -371,28 +371,30 @@ static void wm831x_irq_sync_unlock(unsigned int irq) | |||
371 | mutex_unlock(&wm831x->irq_lock); | 371 | mutex_unlock(&wm831x->irq_lock); |
372 | } | 372 | } |
373 | 373 | ||
374 | static void wm831x_irq_unmask(unsigned int irq) | 374 | static void wm831x_irq_unmask(struct irq_data *data) |
375 | { | 375 | { |
376 | struct wm831x *wm831x = get_irq_chip_data(irq); | 376 | struct wm831x *wm831x = irq_data_get_irq_chip_data(data); |
377 | struct wm831x_irq_data *irq_data = irq_to_wm831x_irq(wm831x, irq); | 377 | struct wm831x_irq_data *irq_data = irq_to_wm831x_irq(wm831x, |
378 | data->irq); | ||
378 | 379 | ||
379 | wm831x->irq_masks_cur[irq_data->reg - 1] &= ~irq_data->mask; | 380 | wm831x->irq_masks_cur[irq_data->reg - 1] &= ~irq_data->mask; |
380 | } | 381 | } |
381 | 382 | ||
382 | static void wm831x_irq_mask(unsigned int irq) | 383 | static void wm831x_irq_mask(struct irq_data *data) |
383 | { | 384 | { |
384 | struct wm831x *wm831x = get_irq_chip_data(irq); | 385 | struct wm831x *wm831x = irq_data_get_irq_chip_data(data); |
385 | struct wm831x_irq_data *irq_data = irq_to_wm831x_irq(wm831x, irq); | 386 | struct wm831x_irq_data *irq_data = irq_to_wm831x_irq(wm831x, |
387 | data->irq); | ||
386 | 388 | ||
387 | wm831x->irq_masks_cur[irq_data->reg - 1] |= irq_data->mask; | 389 | wm831x->irq_masks_cur[irq_data->reg - 1] |= irq_data->mask; |
388 | } | 390 | } |
389 | 391 | ||
390 | static int wm831x_irq_set_type(unsigned int irq, unsigned int type) | 392 | static int wm831x_irq_set_type(struct irq_data *data, unsigned int type) |
391 | { | 393 | { |
392 | struct wm831x *wm831x = get_irq_chip_data(irq); | 394 | struct wm831x *wm831x = irq_data_get_irq_chip_data(data); |
393 | int val; | 395 | int val, irq; |
394 | 396 | ||
395 | irq = irq - wm831x->irq_base; | 397 | irq = data->irq - wm831x->irq_base; |
396 | 398 | ||
397 | if (irq < WM831X_IRQ_GPIO_1 || irq > WM831X_IRQ_GPIO_11) { | 399 | if (irq < WM831X_IRQ_GPIO_1 || irq > WM831X_IRQ_GPIO_11) { |
398 | /* Ignore internal-only IRQs */ | 400 | /* Ignore internal-only IRQs */ |
@@ -421,12 +423,12 @@ static int wm831x_irq_set_type(unsigned int irq, unsigned int type) | |||
421 | } | 423 | } |
422 | 424 | ||
423 | static struct irq_chip wm831x_irq_chip = { | 425 | static struct irq_chip wm831x_irq_chip = { |
424 | .name = "wm831x", | 426 | .name = "wm831x", |
425 | .bus_lock = wm831x_irq_lock, | 427 | .irq_bus_lock = wm831x_irq_lock, |
426 | .bus_sync_unlock = wm831x_irq_sync_unlock, | 428 | .irq_bus_sync_unlock = wm831x_irq_sync_unlock, |
427 | .mask = wm831x_irq_mask, | 429 | .irq_mask = wm831x_irq_mask, |
428 | .unmask = wm831x_irq_unmask, | 430 | .irq_unmask = wm831x_irq_unmask, |
429 | .set_type = wm831x_irq_set_type, | 431 | .irq_set_type = wm831x_irq_set_type, |
430 | }; | 432 | }; |
431 | 433 | ||
432 | /* The processing of the primary interrupt occurs in a thread so that | 434 | /* The processing of the primary interrupt occurs in a thread so that |
@@ -515,6 +517,17 @@ int wm831x_irq_init(struct wm831x *wm831x, int irq) | |||
515 | return 0; | 517 | return 0; |
516 | } | 518 | } |
517 | 519 | ||
520 | /* Try to flag /IRQ as a wake source; there are a number of | ||
521 | * unconditional wake sources in the PMIC so this isn't | ||
522 | * conditional but we don't actually care *too* much if it | ||
523 | * fails. | ||
524 | */ | ||
525 | ret = enable_irq_wake(irq); | ||
526 | if (ret != 0) { | ||
527 | dev_warn(wm831x->dev, "Can't enable IRQ as wake source: %d\n", | ||
528 | ret); | ||
529 | } | ||
530 | |||
518 | wm831x->irq = irq; | 531 | wm831x->irq = irq; |
519 | wm831x->irq_base = pdata->irq_base; | 532 | wm831x->irq_base = pdata->irq_base; |
520 | 533 | ||
diff --git a/drivers/mfd/wm831x-spi.c b/drivers/mfd/wm831x-spi.c index 2789b151b0f9..0a8f772be88c 100644 --- a/drivers/mfd/wm831x-spi.c +++ b/drivers/mfd/wm831x-spi.c | |||
@@ -81,6 +81,8 @@ static int __devinit wm831x_spi_probe(struct spi_device *spi) | |||
81 | type = WM8321; | 81 | type = WM8321; |
82 | else if (strcmp(spi->modalias, "wm8325") == 0) | 82 | else if (strcmp(spi->modalias, "wm8325") == 0) |
83 | type = WM8325; | 83 | type = WM8325; |
84 | else if (strcmp(spi->modalias, "wm8326") == 0) | ||
85 | type = WM8326; | ||
84 | else { | 86 | else { |
85 | dev_err(&spi->dev, "Unknown device type\n"); | 87 | dev_err(&spi->dev, "Unknown device type\n"); |
86 | return -EINVAL; | 88 | return -EINVAL; |
@@ -184,6 +186,17 @@ static struct spi_driver wm8325_spi_driver = { | |||
184 | .suspend = wm831x_spi_suspend, | 186 | .suspend = wm831x_spi_suspend, |
185 | }; | 187 | }; |
186 | 188 | ||
189 | static struct spi_driver wm8326_spi_driver = { | ||
190 | .driver = { | ||
191 | .name = "wm8326", | ||
192 | .bus = &spi_bus_type, | ||
193 | .owner = THIS_MODULE, | ||
194 | }, | ||
195 | .probe = wm831x_spi_probe, | ||
196 | .remove = __devexit_p(wm831x_spi_remove), | ||
197 | .suspend = wm831x_spi_suspend, | ||
198 | }; | ||
199 | |||
187 | static int __init wm831x_spi_init(void) | 200 | static int __init wm831x_spi_init(void) |
188 | { | 201 | { |
189 | int ret; | 202 | int ret; |
@@ -212,12 +225,17 @@ static int __init wm831x_spi_init(void) | |||
212 | if (ret != 0) | 225 | if (ret != 0) |
213 | pr_err("Failed to register WM8325 SPI driver: %d\n", ret); | 226 | pr_err("Failed to register WM8325 SPI driver: %d\n", ret); |
214 | 227 | ||
228 | ret = spi_register_driver(&wm8326_spi_driver); | ||
229 | if (ret != 0) | ||
230 | pr_err("Failed to register WM8326 SPI driver: %d\n", ret); | ||
231 | |||
215 | return 0; | 232 | return 0; |
216 | } | 233 | } |
217 | subsys_initcall(wm831x_spi_init); | 234 | subsys_initcall(wm831x_spi_init); |
218 | 235 | ||
219 | static void __exit wm831x_spi_exit(void) | 236 | static void __exit wm831x_spi_exit(void) |
220 | { | 237 | { |
238 | spi_unregister_driver(&wm8326_spi_driver); | ||
221 | spi_unregister_driver(&wm8325_spi_driver); | 239 | spi_unregister_driver(&wm8325_spi_driver); |
222 | spi_unregister_driver(&wm8321_spi_driver); | 240 | spi_unregister_driver(&wm8321_spi_driver); |
223 | spi_unregister_driver(&wm8320_spi_driver); | 241 | spi_unregister_driver(&wm8320_spi_driver); |
diff --git a/drivers/mfd/wm8350-irq.c b/drivers/mfd/wm8350-irq.c index f56c9adf9493..5839966ebd85 100644 --- a/drivers/mfd/wm8350-irq.c +++ b/drivers/mfd/wm8350-irq.c | |||
@@ -417,16 +417,16 @@ static irqreturn_t wm8350_irq(int irq, void *irq_data) | |||
417 | return IRQ_HANDLED; | 417 | return IRQ_HANDLED; |
418 | } | 418 | } |
419 | 419 | ||
420 | static void wm8350_irq_lock(unsigned int irq) | 420 | static void wm8350_irq_lock(struct irq_data *data) |
421 | { | 421 | { |
422 | struct wm8350 *wm8350 = get_irq_chip_data(irq); | 422 | struct wm8350 *wm8350 = irq_data_get_irq_chip_data(data); |
423 | 423 | ||
424 | mutex_lock(&wm8350->irq_lock); | 424 | mutex_lock(&wm8350->irq_lock); |
425 | } | 425 | } |
426 | 426 | ||
427 | static void wm8350_irq_sync_unlock(unsigned int irq) | 427 | static void wm8350_irq_sync_unlock(struct irq_data *data) |
428 | { | 428 | { |
429 | struct wm8350 *wm8350 = get_irq_chip_data(irq); | 429 | struct wm8350 *wm8350 = irq_data_get_irq_chip_data(data); |
430 | int i; | 430 | int i; |
431 | 431 | ||
432 | for (i = 0; i < ARRAY_SIZE(wm8350->irq_masks); i++) { | 432 | for (i = 0; i < ARRAY_SIZE(wm8350->irq_masks); i++) { |
@@ -442,28 +442,30 @@ static void wm8350_irq_sync_unlock(unsigned int irq) | |||
442 | mutex_unlock(&wm8350->irq_lock); | 442 | mutex_unlock(&wm8350->irq_lock); |
443 | } | 443 | } |
444 | 444 | ||
445 | static void wm8350_irq_enable(unsigned int irq) | 445 | static void wm8350_irq_enable(struct irq_data *data) |
446 | { | 446 | { |
447 | struct wm8350 *wm8350 = get_irq_chip_data(irq); | 447 | struct wm8350 *wm8350 = irq_data_get_irq_chip_data(data); |
448 | struct wm8350_irq_data *irq_data = irq_to_wm8350_irq(wm8350, irq); | 448 | struct wm8350_irq_data *irq_data = irq_to_wm8350_irq(wm8350, |
449 | data->irq); | ||
449 | 450 | ||
450 | wm8350->irq_masks[irq_data->reg] &= ~irq_data->mask; | 451 | wm8350->irq_masks[irq_data->reg] &= ~irq_data->mask; |
451 | } | 452 | } |
452 | 453 | ||
453 | static void wm8350_irq_disable(unsigned int irq) | 454 | static void wm8350_irq_disable(struct irq_data *data) |
454 | { | 455 | { |
455 | struct wm8350 *wm8350 = get_irq_chip_data(irq); | 456 | struct wm8350 *wm8350 = irq_data_get_irq_chip_data(data); |
456 | struct wm8350_irq_data *irq_data = irq_to_wm8350_irq(wm8350, irq); | 457 | struct wm8350_irq_data *irq_data = irq_to_wm8350_irq(wm8350, |
458 | data->irq); | ||
457 | 459 | ||
458 | wm8350->irq_masks[irq_data->reg] |= irq_data->mask; | 460 | wm8350->irq_masks[irq_data->reg] |= irq_data->mask; |
459 | } | 461 | } |
460 | 462 | ||
461 | static struct irq_chip wm8350_irq_chip = { | 463 | static struct irq_chip wm8350_irq_chip = { |
462 | .name = "wm8350", | 464 | .name = "wm8350", |
463 | .bus_lock = wm8350_irq_lock, | 465 | .irq_bus_lock = wm8350_irq_lock, |
464 | .bus_sync_unlock = wm8350_irq_sync_unlock, | 466 | .irq_bus_sync_unlock = wm8350_irq_sync_unlock, |
465 | .disable = wm8350_irq_disable, | 467 | .irq_disable = wm8350_irq_disable, |
466 | .enable = wm8350_irq_enable, | 468 | .irq_enable = wm8350_irq_enable, |
467 | }; | 469 | }; |
468 | 470 | ||
469 | int wm8350_irq_init(struct wm8350 *wm8350, int irq, | 471 | int wm8350_irq_init(struct wm8350 *wm8350, int irq, |
diff --git a/drivers/mfd/wm8994-core.c b/drivers/mfd/wm8994-core.c index 8d221ba5e38d..41233c7fa581 100644 --- a/drivers/mfd/wm8994-core.c +++ b/drivers/mfd/wm8994-core.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/i2c.h> | 18 | #include <linux/i2c.h> |
19 | #include <linux/delay.h> | 19 | #include <linux/delay.h> |
20 | #include <linux/mfd/core.h> | 20 | #include <linux/mfd/core.h> |
21 | #include <linux/pm_runtime.h> | ||
21 | #include <linux/regulator/consumer.h> | 22 | #include <linux/regulator/consumer.h> |
22 | #include <linux/regulator/machine.h> | 23 | #include <linux/regulator/machine.h> |
23 | 24 | ||
@@ -169,8 +170,16 @@ out: | |||
169 | EXPORT_SYMBOL_GPL(wm8994_set_bits); | 170 | EXPORT_SYMBOL_GPL(wm8994_set_bits); |
170 | 171 | ||
171 | static struct mfd_cell wm8994_regulator_devs[] = { | 172 | static struct mfd_cell wm8994_regulator_devs[] = { |
172 | { .name = "wm8994-ldo", .id = 1 }, | 173 | { |
173 | { .name = "wm8994-ldo", .id = 2 }, | 174 | .name = "wm8994-ldo", |
175 | .id = 1, | ||
176 | .pm_runtime_no_callbacks = true, | ||
177 | }, | ||
178 | { | ||
179 | .name = "wm8994-ldo", | ||
180 | .id = 2, | ||
181 | .pm_runtime_no_callbacks = true, | ||
182 | }, | ||
174 | }; | 183 | }; |
175 | 184 | ||
176 | static struct resource wm8994_codec_resources[] = { | 185 | static struct resource wm8994_codec_resources[] = { |
@@ -200,6 +209,7 @@ static struct mfd_cell wm8994_devs[] = { | |||
200 | .name = "wm8994-gpio", | 209 | .name = "wm8994-gpio", |
201 | .num_resources = ARRAY_SIZE(wm8994_gpio_resources), | 210 | .num_resources = ARRAY_SIZE(wm8994_gpio_resources), |
202 | .resources = wm8994_gpio_resources, | 211 | .resources = wm8994_gpio_resources, |
212 | .pm_runtime_no_callbacks = true, | ||
203 | }, | 213 | }, |
204 | }; | 214 | }; |
205 | 215 | ||
@@ -231,7 +241,7 @@ static const char *wm8958_main_supplies[] = { | |||
231 | }; | 241 | }; |
232 | 242 | ||
233 | #ifdef CONFIG_PM | 243 | #ifdef CONFIG_PM |
234 | static int wm8994_device_suspend(struct device *dev) | 244 | static int wm8994_suspend(struct device *dev) |
235 | { | 245 | { |
236 | struct wm8994 *wm8994 = dev_get_drvdata(dev); | 246 | struct wm8994 *wm8994 = dev_get_drvdata(dev); |
237 | int ret; | 247 | int ret; |
@@ -261,7 +271,7 @@ static int wm8994_device_suspend(struct device *dev) | |||
261 | return 0; | 271 | return 0; |
262 | } | 272 | } |
263 | 273 | ||
264 | static int wm8994_device_resume(struct device *dev) | 274 | static int wm8994_resume(struct device *dev) |
265 | { | 275 | { |
266 | struct wm8994 *wm8994 = dev_get_drvdata(dev); | 276 | struct wm8994 *wm8994 = dev_get_drvdata(dev); |
267 | int ret; | 277 | int ret; |
@@ -471,6 +481,9 @@ static int wm8994_device_init(struct wm8994 *wm8994, int irq) | |||
471 | goto err_irq; | 481 | goto err_irq; |
472 | } | 482 | } |
473 | 483 | ||
484 | pm_runtime_enable(wm8994->dev); | ||
485 | pm_runtime_resume(wm8994->dev); | ||
486 | |||
474 | return 0; | 487 | return 0; |
475 | 488 | ||
476 | err_irq: | 489 | err_irq: |
@@ -490,6 +503,7 @@ err: | |||
490 | 503 | ||
491 | static void wm8994_device_exit(struct wm8994 *wm8994) | 504 | static void wm8994_device_exit(struct wm8994 *wm8994) |
492 | { | 505 | { |
506 | pm_runtime_disable(wm8994->dev); | ||
493 | mfd_remove_devices(wm8994->dev); | 507 | mfd_remove_devices(wm8994->dev); |
494 | wm8994_irq_exit(wm8994); | 508 | wm8994_irq_exit(wm8994); |
495 | regulator_bulk_disable(wm8994->num_supplies, | 509 | regulator_bulk_disable(wm8994->num_supplies, |
@@ -573,21 +587,6 @@ static int wm8994_i2c_remove(struct i2c_client *i2c) | |||
573 | return 0; | 587 | return 0; |
574 | } | 588 | } |
575 | 589 | ||
576 | #ifdef CONFIG_PM | ||
577 | static int wm8994_i2c_suspend(struct i2c_client *i2c, pm_message_t state) | ||
578 | { | ||
579 | return wm8994_device_suspend(&i2c->dev); | ||
580 | } | ||
581 | |||
582 | static int wm8994_i2c_resume(struct i2c_client *i2c) | ||
583 | { | ||
584 | return wm8994_device_resume(&i2c->dev); | ||
585 | } | ||
586 | #else | ||
587 | #define wm8994_i2c_suspend NULL | ||
588 | #define wm8994_i2c_resume NULL | ||
589 | #endif | ||
590 | |||
591 | static const struct i2c_device_id wm8994_i2c_id[] = { | 590 | static const struct i2c_device_id wm8994_i2c_id[] = { |
592 | { "wm8994", WM8994 }, | 591 | { "wm8994", WM8994 }, |
593 | { "wm8958", WM8958 }, | 592 | { "wm8958", WM8958 }, |
@@ -595,15 +594,16 @@ static const struct i2c_device_id wm8994_i2c_id[] = { | |||
595 | }; | 594 | }; |
596 | MODULE_DEVICE_TABLE(i2c, wm8994_i2c_id); | 595 | MODULE_DEVICE_TABLE(i2c, wm8994_i2c_id); |
597 | 596 | ||
597 | UNIVERSAL_DEV_PM_OPS(wm8994_pm_ops, wm8994_suspend, wm8994_resume, NULL); | ||
598 | |||
598 | static struct i2c_driver wm8994_i2c_driver = { | 599 | static struct i2c_driver wm8994_i2c_driver = { |
599 | .driver = { | 600 | .driver = { |
600 | .name = "wm8994", | 601 | .name = "wm8994", |
601 | .owner = THIS_MODULE, | 602 | .owner = THIS_MODULE, |
603 | .pm = &wm8994_pm_ops, | ||
602 | }, | 604 | }, |
603 | .probe = wm8994_i2c_probe, | 605 | .probe = wm8994_i2c_probe, |
604 | .remove = wm8994_i2c_remove, | 606 | .remove = wm8994_i2c_remove, |
605 | .suspend = wm8994_i2c_suspend, | ||
606 | .resume = wm8994_i2c_resume, | ||
607 | .id_table = wm8994_i2c_id, | 607 | .id_table = wm8994_i2c_id, |
608 | }; | 608 | }; |
609 | 609 | ||
diff --git a/drivers/mfd/wm8994-irq.c b/drivers/mfd/wm8994-irq.c index 8400eb1ee5db..29e8faf9c01c 100644 --- a/drivers/mfd/wm8994-irq.c +++ b/drivers/mfd/wm8994-irq.c | |||
@@ -156,16 +156,16 @@ static inline struct wm8994_irq_data *irq_to_wm8994_irq(struct wm8994 *wm8994, | |||
156 | return &wm8994_irqs[irq - wm8994->irq_base]; | 156 | return &wm8994_irqs[irq - wm8994->irq_base]; |
157 | } | 157 | } |
158 | 158 | ||
159 | static void wm8994_irq_lock(unsigned int irq) | 159 | static void wm8994_irq_lock(struct irq_data *data) |
160 | { | 160 | { |
161 | struct wm8994 *wm8994 = get_irq_chip_data(irq); | 161 | struct wm8994 *wm8994 = irq_data_get_irq_chip_data(data); |
162 | 162 | ||
163 | mutex_lock(&wm8994->irq_lock); | 163 | mutex_lock(&wm8994->irq_lock); |
164 | } | 164 | } |
165 | 165 | ||
166 | static void wm8994_irq_sync_unlock(unsigned int irq) | 166 | static void wm8994_irq_sync_unlock(struct irq_data *data) |
167 | { | 167 | { |
168 | struct wm8994 *wm8994 = get_irq_chip_data(irq); | 168 | struct wm8994 *wm8994 = irq_data_get_irq_chip_data(data); |
169 | int i; | 169 | int i; |
170 | 170 | ||
171 | for (i = 0; i < ARRAY_SIZE(wm8994->irq_masks_cur); i++) { | 171 | for (i = 0; i < ARRAY_SIZE(wm8994->irq_masks_cur); i++) { |
@@ -182,28 +182,30 @@ static void wm8994_irq_sync_unlock(unsigned int irq) | |||
182 | mutex_unlock(&wm8994->irq_lock); | 182 | mutex_unlock(&wm8994->irq_lock); |
183 | } | 183 | } |
184 | 184 | ||
185 | static void wm8994_irq_unmask(unsigned int irq) | 185 | static void wm8994_irq_unmask(struct irq_data *data) |
186 | { | 186 | { |
187 | struct wm8994 *wm8994 = get_irq_chip_data(irq); | 187 | struct wm8994 *wm8994 = irq_data_get_irq_chip_data(data); |
188 | struct wm8994_irq_data *irq_data = irq_to_wm8994_irq(wm8994, irq); | 188 | struct wm8994_irq_data *irq_data = irq_to_wm8994_irq(wm8994, |
189 | data->irq); | ||
189 | 190 | ||
190 | wm8994->irq_masks_cur[irq_data->reg - 1] &= ~irq_data->mask; | 191 | wm8994->irq_masks_cur[irq_data->reg - 1] &= ~irq_data->mask; |
191 | } | 192 | } |
192 | 193 | ||
193 | static void wm8994_irq_mask(unsigned int irq) | 194 | static void wm8994_irq_mask(struct irq_data *data) |
194 | { | 195 | { |
195 | struct wm8994 *wm8994 = get_irq_chip_data(irq); | 196 | struct wm8994 *wm8994 = irq_data_get_irq_chip_data(data); |
196 | struct wm8994_irq_data *irq_data = irq_to_wm8994_irq(wm8994, irq); | 197 | struct wm8994_irq_data *irq_data = irq_to_wm8994_irq(wm8994, |
198 | data->irq); | ||
197 | 199 | ||
198 | wm8994->irq_masks_cur[irq_data->reg - 1] |= irq_data->mask; | 200 | wm8994->irq_masks_cur[irq_data->reg - 1] |= irq_data->mask; |
199 | } | 201 | } |
200 | 202 | ||
201 | static struct irq_chip wm8994_irq_chip = { | 203 | static struct irq_chip wm8994_irq_chip = { |
202 | .name = "wm8994", | 204 | .name = "wm8994", |
203 | .bus_lock = wm8994_irq_lock, | 205 | .irq_bus_lock = wm8994_irq_lock, |
204 | .bus_sync_unlock = wm8994_irq_sync_unlock, | 206 | .irq_bus_sync_unlock = wm8994_irq_sync_unlock, |
205 | .mask = wm8994_irq_mask, | 207 | .irq_mask = wm8994_irq_mask, |
206 | .unmask = wm8994_irq_unmask, | 208 | .irq_unmask = wm8994_irq_unmask, |
207 | }; | 209 | }; |
208 | 210 | ||
209 | /* The processing of the primary interrupt occurs in a thread so that | 211 | /* The processing of the primary interrupt occurs in a thread so that |
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig index 1e1a4be8eb6c..cc8e49db45fe 100644 --- a/drivers/misc/Kconfig +++ b/drivers/misc/Kconfig | |||
@@ -64,7 +64,7 @@ config ATMEL_PWM | |||
64 | 64 | ||
65 | config AB8500_PWM | 65 | config AB8500_PWM |
66 | bool "AB8500 PWM support" | 66 | bool "AB8500 PWM support" |
67 | depends on AB8500_CORE | 67 | depends on AB8500_CORE && ARCH_U8500 |
68 | select HAVE_PWM | 68 | select HAVE_PWM |
69 | help | 69 | help |
70 | This driver exports functions to enable/disble/config/free Pulse | 70 | This driver exports functions to enable/disble/config/free Pulse |
diff --git a/drivers/misc/cs5535-mfgpt.c b/drivers/misc/cs5535-mfgpt.c index 6f6218061b0d..d02d302ee6d5 100644 --- a/drivers/misc/cs5535-mfgpt.c +++ b/drivers/misc/cs5535-mfgpt.c | |||
@@ -16,12 +16,11 @@ | |||
16 | #include <linux/spinlock.h> | 16 | #include <linux/spinlock.h> |
17 | #include <linux/interrupt.h> | 17 | #include <linux/interrupt.h> |
18 | #include <linux/module.h> | 18 | #include <linux/module.h> |
19 | #include <linux/pci.h> | 19 | #include <linux/platform_device.h> |
20 | #include <linux/cs5535.h> | 20 | #include <linux/cs5535.h> |
21 | #include <linux/slab.h> | 21 | #include <linux/slab.h> |
22 | 22 | ||
23 | #define DRV_NAME "cs5535-mfgpt" | 23 | #define DRV_NAME "cs5535-mfgpt" |
24 | #define MFGPT_BAR 2 | ||
25 | 24 | ||
26 | static int mfgpt_reset_timers; | 25 | static int mfgpt_reset_timers; |
27 | module_param_named(mfgptfix, mfgpt_reset_timers, int, 0644); | 26 | module_param_named(mfgptfix, mfgpt_reset_timers, int, 0644); |
@@ -37,7 +36,7 @@ static struct cs5535_mfgpt_chip { | |||
37 | DECLARE_BITMAP(avail, MFGPT_MAX_TIMERS); | 36 | DECLARE_BITMAP(avail, MFGPT_MAX_TIMERS); |
38 | resource_size_t base; | 37 | resource_size_t base; |
39 | 38 | ||
40 | struct pci_dev *pdev; | 39 | struct platform_device *pdev; |
41 | spinlock_t lock; | 40 | spinlock_t lock; |
42 | int initialized; | 41 | int initialized; |
43 | } cs5535_mfgpt_chip; | 42 | } cs5535_mfgpt_chip; |
@@ -290,10 +289,10 @@ static int __init scan_timers(struct cs5535_mfgpt_chip *mfgpt) | |||
290 | return timers; | 289 | return timers; |
291 | } | 290 | } |
292 | 291 | ||
293 | static int __init cs5535_mfgpt_probe(struct pci_dev *pdev, | 292 | static int __devinit cs5535_mfgpt_probe(struct platform_device *pdev) |
294 | const struct pci_device_id *pci_id) | ||
295 | { | 293 | { |
296 | int err, t; | 294 | struct resource *res; |
295 | int err = -EIO, t; | ||
297 | 296 | ||
298 | /* There are two ways to get the MFGPT base address; one is by | 297 | /* There are two ways to get the MFGPT base address; one is by |
299 | * fetching it from MSR_LBAR_MFGPT, the other is by reading the | 298 | * fetching it from MSR_LBAR_MFGPT, the other is by reading the |
@@ -302,29 +301,27 @@ static int __init cs5535_mfgpt_probe(struct pci_dev *pdev, | |||
302 | * it turns out to be unreliable in the face of crappy BIOSes, we | 301 | * it turns out to be unreliable in the face of crappy BIOSes, we |
303 | * can always go back to using MSRs.. */ | 302 | * can always go back to using MSRs.. */ |
304 | 303 | ||
305 | err = pci_enable_device_io(pdev); | 304 | res = platform_get_resource(pdev, IORESOURCE_IO, 0); |
306 | if (err) { | 305 | if (!res) { |
307 | dev_err(&pdev->dev, "can't enable device IO\n"); | 306 | dev_err(&pdev->dev, "can't fetch device resource info\n"); |
308 | goto done; | 307 | goto done; |
309 | } | 308 | } |
310 | 309 | ||
311 | err = pci_request_region(pdev, MFGPT_BAR, DRV_NAME); | 310 | if (!request_region(res->start, resource_size(res), pdev->name)) { |
312 | if (err) { | 311 | dev_err(&pdev->dev, "can't request region\n"); |
313 | dev_err(&pdev->dev, "can't alloc PCI BAR #%d\n", MFGPT_BAR); | ||
314 | goto done; | 312 | goto done; |
315 | } | 313 | } |
316 | 314 | ||
317 | /* set up the driver-specific struct */ | 315 | /* set up the driver-specific struct */ |
318 | cs5535_mfgpt_chip.base = pci_resource_start(pdev, MFGPT_BAR); | 316 | cs5535_mfgpt_chip.base = res->start; |
319 | cs5535_mfgpt_chip.pdev = pdev; | 317 | cs5535_mfgpt_chip.pdev = pdev; |
320 | spin_lock_init(&cs5535_mfgpt_chip.lock); | 318 | spin_lock_init(&cs5535_mfgpt_chip.lock); |
321 | 319 | ||
322 | dev_info(&pdev->dev, "allocated PCI BAR #%d: base 0x%llx\n", MFGPT_BAR, | 320 | dev_info(&pdev->dev, "reserved resource region %pR\n", res); |
323 | (unsigned long long) cs5535_mfgpt_chip.base); | ||
324 | 321 | ||
325 | /* detect the available timers */ | 322 | /* detect the available timers */ |
326 | t = scan_timers(&cs5535_mfgpt_chip); | 323 | t = scan_timers(&cs5535_mfgpt_chip); |
327 | dev_info(&pdev->dev, DRV_NAME ": %d MFGPT timers available\n", t); | 324 | dev_info(&pdev->dev, "%d MFGPT timers available\n", t); |
328 | cs5535_mfgpt_chip.initialized = 1; | 325 | cs5535_mfgpt_chip.initialized = 1; |
329 | return 0; | 326 | return 0; |
330 | 327 | ||
@@ -332,47 +329,18 @@ done: | |||
332 | return err; | 329 | return err; |
333 | } | 330 | } |
334 | 331 | ||
335 | static struct pci_device_id cs5535_mfgpt_pci_tbl[] = { | 332 | static struct platform_driver cs5535_mfgpt_drv = { |
336 | { PCI_DEVICE(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_CS5535_ISA) }, | 333 | .driver = { |
337 | { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_CS5536_ISA) }, | 334 | .name = DRV_NAME, |
338 | { 0, }, | 335 | .owner = THIS_MODULE, |
336 | }, | ||
337 | .probe = cs5535_mfgpt_probe, | ||
339 | }; | 338 | }; |
340 | MODULE_DEVICE_TABLE(pci, cs5535_mfgpt_pci_tbl); | ||
341 | 339 | ||
342 | /* | ||
343 | * Just like with the cs5535-gpio driver, we can't use the standard PCI driver | ||
344 | * registration stuff. It only allows only one driver to bind to each PCI | ||
345 | * device, and we want the GPIO and MFGPT drivers to be able to share a PCI | ||
346 | * device. Instead, we manually scan for the PCI device, request a single | ||
347 | * region, and keep track of the devices that we're using. | ||
348 | */ | ||
349 | |||
350 | static int __init cs5535_mfgpt_scan_pci(void) | ||
351 | { | ||
352 | struct pci_dev *pdev; | ||
353 | int err = -ENODEV; | ||
354 | int i; | ||
355 | |||
356 | for (i = 0; i < ARRAY_SIZE(cs5535_mfgpt_pci_tbl); i++) { | ||
357 | pdev = pci_get_device(cs5535_mfgpt_pci_tbl[i].vendor, | ||
358 | cs5535_mfgpt_pci_tbl[i].device, NULL); | ||
359 | if (pdev) { | ||
360 | err = cs5535_mfgpt_probe(pdev, | ||
361 | &cs5535_mfgpt_pci_tbl[i]); | ||
362 | if (err) | ||
363 | pci_dev_put(pdev); | ||
364 | |||
365 | /* we only support a single CS5535/6 southbridge */ | ||
366 | break; | ||
367 | } | ||
368 | } | ||
369 | |||
370 | return err; | ||
371 | } | ||
372 | 340 | ||
373 | static int __init cs5535_mfgpt_init(void) | 341 | static int __init cs5535_mfgpt_init(void) |
374 | { | 342 | { |
375 | return cs5535_mfgpt_scan_pci(); | 343 | return platform_driver_register(&cs5535_mfgpt_drv); |
376 | } | 344 | } |
377 | 345 | ||
378 | module_init(cs5535_mfgpt_init); | 346 | module_init(cs5535_mfgpt_init); |
@@ -380,3 +348,4 @@ module_init(cs5535_mfgpt_init); | |||
380 | MODULE_AUTHOR("Andres Salomon <dilinger@queued.net>"); | 348 | MODULE_AUTHOR("Andres Salomon <dilinger@queued.net>"); |
381 | MODULE_DESCRIPTION("CS5535/CS5536 MFGPT timer driver"); | 349 | MODULE_DESCRIPTION("CS5535/CS5536 MFGPT timer driver"); |
382 | MODULE_LICENSE("GPL"); | 350 | MODULE_LICENSE("GPL"); |
351 | MODULE_ALIAS("platform:" DRV_NAME); | ||
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c index a37fcf11ab36..ea5cfe2c3a04 100644 --- a/drivers/net/myri10ge/myri10ge.c +++ b/drivers/net/myri10ge/myri10ge.c | |||
@@ -3403,9 +3403,7 @@ static int myri10ge_resume(struct pci_dev *pdev) | |||
3403 | return -EIO; | 3403 | return -EIO; |
3404 | } | 3404 | } |
3405 | 3405 | ||
3406 | status = pci_restore_state(pdev); | 3406 | pci_restore_state(pdev); |
3407 | if (status) | ||
3408 | return status; | ||
3409 | 3407 | ||
3410 | status = pci_enable_device(pdev); | 3408 | status = pci_enable_device(pdev); |
3411 | if (status) { | 3409 | if (status) { |
diff --git a/drivers/net/sfc/falcon.c b/drivers/net/sfc/falcon.c index 70e4f7dcce81..61ddd2c6e750 100644 --- a/drivers/net/sfc/falcon.c +++ b/drivers/net/sfc/falcon.c | |||
@@ -1107,22 +1107,9 @@ static int __falcon_reset_hw(struct efx_nic *efx, enum reset_type method) | |||
1107 | 1107 | ||
1108 | /* Restore PCI configuration if needed */ | 1108 | /* Restore PCI configuration if needed */ |
1109 | if (method == RESET_TYPE_WORLD) { | 1109 | if (method == RESET_TYPE_WORLD) { |
1110 | if (efx_nic_is_dual_func(efx)) { | 1110 | if (efx_nic_is_dual_func(efx)) |
1111 | rc = pci_restore_state(nic_data->pci_dev2); | 1111 | pci_restore_state(nic_data->pci_dev2); |
1112 | if (rc) { | 1112 | pci_restore_state(efx->pci_dev); |
1113 | netif_err(efx, drv, efx->net_dev, | ||
1114 | "failed to restore PCI config for " | ||
1115 | "the secondary function\n"); | ||
1116 | goto fail3; | ||
1117 | } | ||
1118 | } | ||
1119 | rc = pci_restore_state(efx->pci_dev); | ||
1120 | if (rc) { | ||
1121 | netif_err(efx, drv, efx->net_dev, | ||
1122 | "failed to restore PCI config for the " | ||
1123 | "primary function\n"); | ||
1124 | goto fail4; | ||
1125 | } | ||
1126 | netif_dbg(efx, drv, efx->net_dev, | 1113 | netif_dbg(efx, drv, efx->net_dev, |
1127 | "successfully restored PCI config\n"); | 1114 | "successfully restored PCI config\n"); |
1128 | } | 1115 | } |
@@ -1133,7 +1120,7 @@ static int __falcon_reset_hw(struct efx_nic *efx, enum reset_type method) | |||
1133 | rc = -ETIMEDOUT; | 1120 | rc = -ETIMEDOUT; |
1134 | netif_err(efx, hw, efx->net_dev, | 1121 | netif_err(efx, hw, efx->net_dev, |
1135 | "timed out waiting for hardware reset\n"); | 1122 | "timed out waiting for hardware reset\n"); |
1136 | goto fail5; | 1123 | goto fail3; |
1137 | } | 1124 | } |
1138 | netif_dbg(efx, hw, efx->net_dev, "hardware reset complete\n"); | 1125 | netif_dbg(efx, hw, efx->net_dev, "hardware reset complete\n"); |
1139 | 1126 | ||
@@ -1141,11 +1128,9 @@ static int __falcon_reset_hw(struct efx_nic *efx, enum reset_type method) | |||
1141 | 1128 | ||
1142 | /* pci_save_state() and pci_restore_state() MUST be called in pairs */ | 1129 | /* pci_save_state() and pci_restore_state() MUST be called in pairs */ |
1143 | fail2: | 1130 | fail2: |
1144 | fail3: | ||
1145 | pci_restore_state(efx->pci_dev); | 1131 | pci_restore_state(efx->pci_dev); |
1146 | fail1: | 1132 | fail1: |
1147 | fail4: | 1133 | fail3: |
1148 | fail5: | ||
1149 | return rc; | 1134 | return rc; |
1150 | } | 1135 | } |
1151 | 1136 | ||
diff --git a/drivers/net/wireless/rt2x00/rt2x00pci.c b/drivers/net/wireless/rt2x00/rt2x00pci.c index 73631c6fbb30..ace0b668c04e 100644 --- a/drivers/net/wireless/rt2x00/rt2x00pci.c +++ b/drivers/net/wireless/rt2x00/rt2x00pci.c | |||
@@ -363,12 +363,12 @@ int rt2x00pci_resume(struct pci_dev *pci_dev) | |||
363 | struct rt2x00_dev *rt2x00dev = hw->priv; | 363 | struct rt2x00_dev *rt2x00dev = hw->priv; |
364 | 364 | ||
365 | if (pci_set_power_state(pci_dev, PCI_D0) || | 365 | if (pci_set_power_state(pci_dev, PCI_D0) || |
366 | pci_enable_device(pci_dev) || | 366 | pci_enable_device(pci_dev)) { |
367 | pci_restore_state(pci_dev)) { | ||
368 | ERROR(rt2x00dev, "Failed to resume device.\n"); | 367 | ERROR(rt2x00dev, "Failed to resume device.\n"); |
369 | return -EIO; | 368 | return -EIO; |
370 | } | 369 | } |
371 | 370 | ||
371 | pci_restore_state(pci_dev); | ||
372 | return rt2x00lib_resume(rt2x00dev); | 372 | return rt2x00lib_resume(rt2x00dev); |
373 | } | 373 | } |
374 | EXPORT_SYMBOL_GPL(rt2x00pci_resume); | 374 | EXPORT_SYMBOL_GPL(rt2x00pci_resume); |
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c index 7c24dcef2989..44b0aeee83e5 100644 --- a/drivers/pci/msi.c +++ b/drivers/pci/msi.c | |||
@@ -168,8 +168,9 @@ static u32 __msix_mask_irq(struct msi_desc *desc, u32 flag) | |||
168 | u32 mask_bits = desc->masked; | 168 | u32 mask_bits = desc->masked; |
169 | unsigned offset = desc->msi_attrib.entry_nr * PCI_MSIX_ENTRY_SIZE + | 169 | unsigned offset = desc->msi_attrib.entry_nr * PCI_MSIX_ENTRY_SIZE + |
170 | PCI_MSIX_ENTRY_VECTOR_CTRL; | 170 | PCI_MSIX_ENTRY_VECTOR_CTRL; |
171 | mask_bits &= ~1; | 171 | mask_bits &= ~PCI_MSIX_ENTRY_CTRL_MASKBIT; |
172 | mask_bits |= flag; | 172 | if (flag) |
173 | mask_bits |= PCI_MSIX_ENTRY_CTRL_MASKBIT; | ||
173 | writel(mask_bits, desc->mask_base + offset); | 174 | writel(mask_bits, desc->mask_base + offset); |
174 | 175 | ||
175 | return mask_bits; | 176 | return mask_bits; |
diff --git a/drivers/pci/msi.h b/drivers/pci/msi.h index feff3bee6fe5..65c42f80f23e 100644 --- a/drivers/pci/msi.h +++ b/drivers/pci/msi.h | |||
@@ -6,12 +6,6 @@ | |||
6 | #ifndef MSI_H | 6 | #ifndef MSI_H |
7 | #define MSI_H | 7 | #define MSI_H |
8 | 8 | ||
9 | #define PCI_MSIX_ENTRY_SIZE 16 | ||
10 | #define PCI_MSIX_ENTRY_LOWER_ADDR 0 | ||
11 | #define PCI_MSIX_ENTRY_UPPER_ADDR 4 | ||
12 | #define PCI_MSIX_ENTRY_DATA 8 | ||
13 | #define PCI_MSIX_ENTRY_VECTOR_CTRL 12 | ||
14 | |||
15 | #define msi_control_reg(base) (base + PCI_MSI_FLAGS) | 9 | #define msi_control_reg(base) (base + PCI_MSI_FLAGS) |
16 | #define msi_lower_address_reg(base) (base + PCI_MSI_ADDRESS_LO) | 10 | #define msi_lower_address_reg(base) (base + PCI_MSI_ADDRESS_LO) |
17 | #define msi_upper_address_reg(base) (base + PCI_MSI_ADDRESS_HI) | 11 | #define msi_upper_address_reg(base) (base + PCI_MSI_ADDRESS_HI) |
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c index 24e19c594e57..6fe0772e0e7d 100644 --- a/drivers/pci/pci-acpi.c +++ b/drivers/pci/pci-acpi.c | |||
@@ -46,9 +46,9 @@ static void pci_acpi_wake_dev(acpi_handle handle, u32 event, void *context) | |||
46 | struct pci_dev *pci_dev = context; | 46 | struct pci_dev *pci_dev = context; |
47 | 47 | ||
48 | if (event == ACPI_NOTIFY_DEVICE_WAKE && pci_dev) { | 48 | if (event == ACPI_NOTIFY_DEVICE_WAKE && pci_dev) { |
49 | pci_wakeup_event(pci_dev); | ||
49 | pci_check_pme_status(pci_dev); | 50 | pci_check_pme_status(pci_dev); |
50 | pm_runtime_resume(&pci_dev->dev); | 51 | pm_runtime_resume(&pci_dev->dev); |
51 | pci_wakeup_event(pci_dev); | ||
52 | if (pci_dev->subordinate) | 52 | if (pci_dev->subordinate) |
53 | pci_pme_wakeup_bus(pci_dev->subordinate); | 53 | pci_pme_wakeup_bus(pci_dev->subordinate); |
54 | } | 54 | } |
@@ -399,6 +399,7 @@ static int __init acpi_pci_init(void) | |||
399 | 399 | ||
400 | if (acpi_gbl_FADT.boot_flags & ACPI_FADT_NO_ASPM) { | 400 | if (acpi_gbl_FADT.boot_flags & ACPI_FADT_NO_ASPM) { |
401 | printk(KERN_INFO"ACPI FADT declares the system doesn't support PCIe ASPM, so disable it\n"); | 401 | printk(KERN_INFO"ACPI FADT declares the system doesn't support PCIe ASPM, so disable it\n"); |
402 | pcie_clear_aspm(); | ||
402 | pcie_no_aspm(); | 403 | pcie_no_aspm(); |
403 | } | 404 | } |
404 | 405 | ||
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c index 8a6f797de8e5..88246dd46452 100644 --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c | |||
@@ -338,7 +338,7 @@ static int pci_call_probe(struct pci_driver *drv, struct pci_dev *dev, | |||
338 | } | 338 | } |
339 | 339 | ||
340 | /** | 340 | /** |
341 | * __pci_device_probe() | 341 | * __pci_device_probe - check if a driver wants to claim a specific PCI device |
342 | * @drv: driver to call to check if it wants the PCI device | 342 | * @drv: driver to call to check if it wants the PCI device |
343 | * @pci_dev: PCI device being probed | 343 | * @pci_dev: PCI device being probed |
344 | * | 344 | * |
@@ -449,7 +449,8 @@ static int pci_restore_standard_config(struct pci_dev *pci_dev) | |||
449 | return error; | 449 | return error; |
450 | } | 450 | } |
451 | 451 | ||
452 | return pci_restore_state(pci_dev); | 452 | pci_restore_state(pci_dev); |
453 | return 0; | ||
453 | } | 454 | } |
454 | 455 | ||
455 | static void pci_pm_default_resume_early(struct pci_dev *pci_dev) | 456 | static void pci_pm_default_resume_early(struct pci_dev *pci_dev) |
diff --git a/drivers/pci/pci-stub.c b/drivers/pci/pci-stub.c index f7b68ca6cc98..775e933c2225 100644 --- a/drivers/pci/pci-stub.c +++ b/drivers/pci/pci-stub.c | |||
@@ -47,6 +47,10 @@ static int __init pci_stub_init(void) | |||
47 | if (rc) | 47 | if (rc) |
48 | return rc; | 48 | return rc; |
49 | 49 | ||
50 | /* no ids passed actually */ | ||
51 | if (ids[0] == '\0') | ||
52 | return 0; | ||
53 | |||
50 | /* add ids specified in the module parameter */ | 54 | /* add ids specified in the module parameter */ |
51 | p = ids; | 55 | p = ids; |
52 | while ((id = strsep(&p, ","))) { | 56 | while ((id = strsep(&p, ","))) { |
@@ -54,6 +58,9 @@ static int __init pci_stub_init(void) | |||
54 | subdevice = PCI_ANY_ID, class=0, class_mask=0; | 58 | subdevice = PCI_ANY_ID, class=0, class_mask=0; |
55 | int fields; | 59 | int fields; |
56 | 60 | ||
61 | if (!strlen(id)) | ||
62 | continue; | ||
63 | |||
57 | fields = sscanf(id, "%x:%x:%x:%x:%x:%x", | 64 | fields = sscanf(id, "%x:%x:%x:%x:%x:%x", |
58 | &vendor, &device, &subvendor, &subdevice, | 65 | &vendor, &device, &subvendor, &subdevice, |
59 | &class, &class_mask); | 66 | &class, &class_mask); |
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c index 63d5042f2079..8ecaac983923 100644 --- a/drivers/pci/pci-sysfs.c +++ b/drivers/pci/pci-sysfs.c | |||
@@ -1149,7 +1149,7 @@ int __must_check pci_create_sysfs_dev_files (struct pci_dev *pdev) | |||
1149 | sysfs_bin_attr_init(attr); | 1149 | sysfs_bin_attr_init(attr); |
1150 | attr->size = rom_size; | 1150 | attr->size = rom_size; |
1151 | attr->attr.name = "rom"; | 1151 | attr->attr.name = "rom"; |
1152 | attr->attr.mode = S_IRUSR; | 1152 | attr->attr.mode = S_IRUSR | S_IWUSR; |
1153 | attr->read = pci_read_rom; | 1153 | attr->read = pci_read_rom; |
1154 | attr->write = pci_write_rom; | 1154 | attr->write = pci_write_rom; |
1155 | retval = sysfs_create_bin_file(&pdev->dev.kobj, attr); | 1155 | retval = sysfs_create_bin_file(&pdev->dev.kobj, attr); |
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 710c8a29be0d..b714d787bddd 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
@@ -937,14 +937,13 @@ pci_save_state(struct pci_dev *dev) | |||
937 | * pci_restore_state - Restore the saved state of a PCI device | 937 | * pci_restore_state - Restore the saved state of a PCI device |
938 | * @dev: - PCI device that we're dealing with | 938 | * @dev: - PCI device that we're dealing with |
939 | */ | 939 | */ |
940 | int | 940 | void pci_restore_state(struct pci_dev *dev) |
941 | pci_restore_state(struct pci_dev *dev) | ||
942 | { | 941 | { |
943 | int i; | 942 | int i; |
944 | u32 val; | 943 | u32 val; |
945 | 944 | ||
946 | if (!dev->state_saved) | 945 | if (!dev->state_saved) |
947 | return 0; | 946 | return; |
948 | 947 | ||
949 | /* PCI Express register must be restored first */ | 948 | /* PCI Express register must be restored first */ |
950 | pci_restore_pcie_state(dev); | 949 | pci_restore_pcie_state(dev); |
@@ -968,8 +967,6 @@ pci_restore_state(struct pci_dev *dev) | |||
968 | pci_restore_iov_state(dev); | 967 | pci_restore_iov_state(dev); |
969 | 968 | ||
970 | dev->state_saved = false; | 969 | dev->state_saved = false; |
971 | |||
972 | return 0; | ||
973 | } | 970 | } |
974 | 971 | ||
975 | static int do_pci_enable_device(struct pci_dev *dev, int bars) | 972 | static int do_pci_enable_device(struct pci_dev *dev, int bars) |
@@ -1300,22 +1297,6 @@ bool pci_check_pme_status(struct pci_dev *dev) | |||
1300 | return ret; | 1297 | return ret; |
1301 | } | 1298 | } |
1302 | 1299 | ||
1303 | /* | ||
1304 | * Time to wait before the system can be put into a sleep state after reporting | ||
1305 | * a wakeup event signaled by a PCI device. | ||
1306 | */ | ||
1307 | #define PCI_WAKEUP_COOLDOWN 100 | ||
1308 | |||
1309 | /** | ||
1310 | * pci_wakeup_event - Report a wakeup event related to a given PCI device. | ||
1311 | * @dev: Device to report the wakeup event for. | ||
1312 | */ | ||
1313 | void pci_wakeup_event(struct pci_dev *dev) | ||
1314 | { | ||
1315 | if (device_may_wakeup(&dev->dev)) | ||
1316 | pm_wakeup_event(&dev->dev, PCI_WAKEUP_COOLDOWN); | ||
1317 | } | ||
1318 | |||
1319 | /** | 1300 | /** |
1320 | * pci_pme_wakeup - Wake up a PCI device if its PME Status bit is set. | 1301 | * pci_pme_wakeup - Wake up a PCI device if its PME Status bit is set. |
1321 | * @dev: Device to handle. | 1302 | * @dev: Device to handle. |
@@ -1327,8 +1308,8 @@ void pci_wakeup_event(struct pci_dev *dev) | |||
1327 | static int pci_pme_wakeup(struct pci_dev *dev, void *ign) | 1308 | static int pci_pme_wakeup(struct pci_dev *dev, void *ign) |
1328 | { | 1309 | { |
1329 | if (pci_check_pme_status(dev)) { | 1310 | if (pci_check_pme_status(dev)) { |
1330 | pm_request_resume(&dev->dev); | ||
1331 | pci_wakeup_event(dev); | 1311 | pci_wakeup_event(dev); |
1312 | pm_request_resume(&dev->dev); | ||
1332 | } | 1313 | } |
1333 | return 0; | 1314 | return 0; |
1334 | } | 1315 | } |
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h index 7d33f6673868..f69d6e0fda75 100644 --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h | |||
@@ -74,6 +74,12 @@ extern void pci_pm_init(struct pci_dev *dev); | |||
74 | extern void platform_pci_wakeup_init(struct pci_dev *dev); | 74 | extern void platform_pci_wakeup_init(struct pci_dev *dev); |
75 | extern void pci_allocate_cap_save_buffers(struct pci_dev *dev); | 75 | extern void pci_allocate_cap_save_buffers(struct pci_dev *dev); |
76 | 76 | ||
77 | static inline void pci_wakeup_event(struct pci_dev *dev) | ||
78 | { | ||
79 | /* Wait 100 ms before the system can be put into a sleep state. */ | ||
80 | pm_wakeup_event(&dev->dev, 100); | ||
81 | } | ||
82 | |||
77 | static inline bool pci_is_bridge(struct pci_dev *pci_dev) | 83 | static inline bool pci_is_bridge(struct pci_dev *pci_dev) |
78 | { | 84 | { |
79 | return !!(pci_dev->subordinate); | 85 | return !!(pci_dev->subordinate); |
@@ -140,14 +146,6 @@ static inline void pci_no_msi(void) { } | |||
140 | static inline void pci_msi_init_pci_dev(struct pci_dev *dev) { } | 146 | static inline void pci_msi_init_pci_dev(struct pci_dev *dev) { } |
141 | #endif | 147 | #endif |
142 | 148 | ||
143 | #ifdef CONFIG_PCIEAER | ||
144 | void pci_no_aer(void); | ||
145 | bool pci_aer_available(void); | ||
146 | #else | ||
147 | static inline void pci_no_aer(void) { } | ||
148 | static inline bool pci_aer_available(void) { return false; } | ||
149 | #endif | ||
150 | |||
151 | static inline int pci_no_d1d2(struct pci_dev *dev) | 149 | static inline int pci_no_d1d2(struct pci_dev *dev) |
152 | { | 150 | { |
153 | unsigned int parent_dstates = 0; | 151 | unsigned int parent_dstates = 0; |
diff --git a/drivers/pci/pcie/aer/aerdrv.c b/drivers/pci/pcie/aer/aerdrv.c index 2b2b6508efde..58ad7917553c 100644 --- a/drivers/pci/pcie/aer/aerdrv.c +++ b/drivers/pci/pcie/aer/aerdrv.c | |||
@@ -17,6 +17,7 @@ | |||
17 | 17 | ||
18 | #include <linux/module.h> | 18 | #include <linux/module.h> |
19 | #include <linux/pci.h> | 19 | #include <linux/pci.h> |
20 | #include <linux/pci-acpi.h> | ||
20 | #include <linux/sched.h> | 21 | #include <linux/sched.h> |
21 | #include <linux/kernel.h> | 22 | #include <linux/kernel.h> |
22 | #include <linux/errno.h> | 23 | #include <linux/errno.h> |
diff --git a/drivers/pci/pcie/aer/aerdrv.h b/drivers/pci/pcie/aer/aerdrv.h index 9656e3060412..80c11d131499 100644 --- a/drivers/pci/pcie/aer/aerdrv.h +++ b/drivers/pci/pcie/aer/aerdrv.h | |||
@@ -132,7 +132,6 @@ static inline int aer_osc_setup(struct pcie_device *pciedev) | |||
132 | 132 | ||
133 | #ifdef CONFIG_ACPI_APEI | 133 | #ifdef CONFIG_ACPI_APEI |
134 | extern int pcie_aer_get_firmware_first(struct pci_dev *pci_dev); | 134 | extern int pcie_aer_get_firmware_first(struct pci_dev *pci_dev); |
135 | extern bool aer_acpi_firmware_first(void); | ||
136 | #else | 135 | #else |
137 | static inline int pcie_aer_get_firmware_first(struct pci_dev *pci_dev) | 136 | static inline int pcie_aer_get_firmware_first(struct pci_dev *pci_dev) |
138 | { | 137 | { |
@@ -140,8 +139,6 @@ static inline int pcie_aer_get_firmware_first(struct pci_dev *pci_dev) | |||
140 | return pci_dev->__aer_firmware_first; | 139 | return pci_dev->__aer_firmware_first; |
141 | return 0; | 140 | return 0; |
142 | } | 141 | } |
143 | |||
144 | static inline bool aer_acpi_firmware_first(void) { return false; } | ||
145 | #endif | 142 | #endif |
146 | 143 | ||
147 | static inline void pcie_aer_force_firmware_first(struct pci_dev *pci_dev, | 144 | static inline void pcie_aer_force_firmware_first(struct pci_dev *pci_dev, |
diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c index 71222814c1ec..3188cd96b338 100644 --- a/drivers/pci/pcie/aspm.c +++ b/drivers/pci/pcie/aspm.c | |||
@@ -68,7 +68,7 @@ struct pcie_link_state { | |||
68 | struct aspm_latency acceptable[8]; | 68 | struct aspm_latency acceptable[8]; |
69 | }; | 69 | }; |
70 | 70 | ||
71 | static int aspm_disabled, aspm_force; | 71 | static int aspm_disabled, aspm_force, aspm_clear_state; |
72 | static DEFINE_MUTEX(aspm_lock); | 72 | static DEFINE_MUTEX(aspm_lock); |
73 | static LIST_HEAD(link_list); | 73 | static LIST_HEAD(link_list); |
74 | 74 | ||
@@ -139,7 +139,7 @@ static void pcie_set_clkpm(struct pcie_link_state *link, int enable) | |||
139 | { | 139 | { |
140 | /* Don't enable Clock PM if the link is not Clock PM capable */ | 140 | /* Don't enable Clock PM if the link is not Clock PM capable */ |
141 | if (!link->clkpm_capable && enable) | 141 | if (!link->clkpm_capable && enable) |
142 | return; | 142 | enable = 0; |
143 | /* Need nothing if the specified equals to current state */ | 143 | /* Need nothing if the specified equals to current state */ |
144 | if (link->clkpm_enabled == enable) | 144 | if (link->clkpm_enabled == enable) |
145 | return; | 145 | return; |
@@ -498,6 +498,10 @@ static int pcie_aspm_sanity_check(struct pci_dev *pdev) | |||
498 | struct pci_dev *child; | 498 | struct pci_dev *child; |
499 | int pos; | 499 | int pos; |
500 | u32 reg32; | 500 | u32 reg32; |
501 | |||
502 | if (aspm_clear_state) | ||
503 | return -EINVAL; | ||
504 | |||
501 | /* | 505 | /* |
502 | * Some functions in a slot might not all be PCIe functions, | 506 | * Some functions in a slot might not all be PCIe functions, |
503 | * very strange. Disable ASPM for the whole slot | 507 | * very strange. Disable ASPM for the whole slot |
@@ -563,12 +567,15 @@ void pcie_aspm_init_link_state(struct pci_dev *pdev) | |||
563 | struct pcie_link_state *link; | 567 | struct pcie_link_state *link; |
564 | int blacklist = !!pcie_aspm_sanity_check(pdev); | 568 | int blacklist = !!pcie_aspm_sanity_check(pdev); |
565 | 569 | ||
566 | if (aspm_disabled || !pci_is_pcie(pdev) || pdev->link_state) | 570 | if (!pci_is_pcie(pdev) || pdev->link_state) |
567 | return; | 571 | return; |
568 | if (pdev->pcie_type != PCI_EXP_TYPE_ROOT_PORT && | 572 | if (pdev->pcie_type != PCI_EXP_TYPE_ROOT_PORT && |
569 | pdev->pcie_type != PCI_EXP_TYPE_DOWNSTREAM) | 573 | pdev->pcie_type != PCI_EXP_TYPE_DOWNSTREAM) |
570 | return; | 574 | return; |
571 | 575 | ||
576 | if (aspm_disabled && !aspm_clear_state) | ||
577 | return; | ||
578 | |||
572 | /* VIA has a strange chipset, root port is under a bridge */ | 579 | /* VIA has a strange chipset, root port is under a bridge */ |
573 | if (pdev->pcie_type == PCI_EXP_TYPE_ROOT_PORT && | 580 | if (pdev->pcie_type == PCI_EXP_TYPE_ROOT_PORT && |
574 | pdev->bus->self) | 581 | pdev->bus->self) |
@@ -641,7 +648,7 @@ void pcie_aspm_exit_link_state(struct pci_dev *pdev) | |||
641 | struct pci_dev *parent = pdev->bus->self; | 648 | struct pci_dev *parent = pdev->bus->self; |
642 | struct pcie_link_state *link, *root, *parent_link; | 649 | struct pcie_link_state *link, *root, *parent_link; |
643 | 650 | ||
644 | if (aspm_disabled || !pci_is_pcie(pdev) || | 651 | if ((aspm_disabled && !aspm_clear_state) || !pci_is_pcie(pdev) || |
645 | !parent || !parent->link_state) | 652 | !parent || !parent->link_state) |
646 | return; | 653 | return; |
647 | if ((parent->pcie_type != PCI_EXP_TYPE_ROOT_PORT) && | 654 | if ((parent->pcie_type != PCI_EXP_TYPE_ROOT_PORT) && |
@@ -899,6 +906,12 @@ static int __init pcie_aspm_disable(char *str) | |||
899 | 906 | ||
900 | __setup("pcie_aspm=", pcie_aspm_disable); | 907 | __setup("pcie_aspm=", pcie_aspm_disable); |
901 | 908 | ||
909 | void pcie_clear_aspm(void) | ||
910 | { | ||
911 | if (!aspm_force) | ||
912 | aspm_clear_state = 1; | ||
913 | } | ||
914 | |||
902 | void pcie_no_aspm(void) | 915 | void pcie_no_aspm(void) |
903 | { | 916 | { |
904 | if (!aspm_force) | 917 | if (!aspm_force) |
diff --git a/drivers/pci/pcie/pme.c b/drivers/pci/pcie/pme.c index 2f3c90407227..0057344a3fcb 100644 --- a/drivers/pci/pcie/pme.c +++ b/drivers/pci/pcie/pme.c | |||
@@ -26,9 +26,6 @@ | |||
26 | #include "../pci.h" | 26 | #include "../pci.h" |
27 | #include "portdrv.h" | 27 | #include "portdrv.h" |
28 | 28 | ||
29 | #define PCI_EXP_RTSTA_PME 0x10000 /* PME status */ | ||
30 | #define PCI_EXP_RTSTA_PENDING 0x20000 /* PME pending */ | ||
31 | |||
32 | /* | 29 | /* |
33 | * If this switch is set, MSI will not be used for PCIe PME signaling. This | 30 | * If this switch is set, MSI will not be used for PCIe PME signaling. This |
34 | * causes the PCIe port driver to use INTx interrupts only, but it turns out | 31 | * causes the PCIe port driver to use INTx interrupts only, but it turns out |
@@ -74,22 +71,6 @@ void pcie_pme_interrupt_enable(struct pci_dev *dev, bool enable) | |||
74 | } | 71 | } |
75 | 72 | ||
76 | /** | 73 | /** |
77 | * pcie_pme_clear_status - Clear root port PME interrupt status. | ||
78 | * @dev: PCIe root port or event collector. | ||
79 | */ | ||
80 | static void pcie_pme_clear_status(struct pci_dev *dev) | ||
81 | { | ||
82 | int rtsta_pos; | ||
83 | u32 rtsta; | ||
84 | |||
85 | rtsta_pos = pci_pcie_cap(dev) + PCI_EXP_RTSTA; | ||
86 | |||
87 | pci_read_config_dword(dev, rtsta_pos, &rtsta); | ||
88 | rtsta |= PCI_EXP_RTSTA_PME; | ||
89 | pci_write_config_dword(dev, rtsta_pos, rtsta); | ||
90 | } | ||
91 | |||
92 | /** | ||
93 | * pcie_pme_walk_bus - Scan a PCI bus for devices asserting PME#. | 74 | * pcie_pme_walk_bus - Scan a PCI bus for devices asserting PME#. |
94 | * @bus: PCI bus to scan. | 75 | * @bus: PCI bus to scan. |
95 | * | 76 | * |
@@ -103,8 +84,8 @@ static bool pcie_pme_walk_bus(struct pci_bus *bus) | |||
103 | list_for_each_entry(dev, &bus->devices, bus_list) { | 84 | list_for_each_entry(dev, &bus->devices, bus_list) { |
104 | /* Skip PCIe devices in case we started from a root port. */ | 85 | /* Skip PCIe devices in case we started from a root port. */ |
105 | if (!pci_is_pcie(dev) && pci_check_pme_status(dev)) { | 86 | if (!pci_is_pcie(dev) && pci_check_pme_status(dev)) { |
106 | pm_request_resume(&dev->dev); | ||
107 | pci_wakeup_event(dev); | 87 | pci_wakeup_event(dev); |
88 | pm_request_resume(&dev->dev); | ||
108 | ret = true; | 89 | ret = true; |
109 | } | 90 | } |
110 | 91 | ||
@@ -206,8 +187,8 @@ static void pcie_pme_handle_request(struct pci_dev *port, u16 req_id) | |||
206 | /* The device is there, but we have to check its PME status. */ | 187 | /* The device is there, but we have to check its PME status. */ |
207 | found = pci_check_pme_status(dev); | 188 | found = pci_check_pme_status(dev); |
208 | if (found) { | 189 | if (found) { |
209 | pm_request_resume(&dev->dev); | ||
210 | pci_wakeup_event(dev); | 190 | pci_wakeup_event(dev); |
191 | pm_request_resume(&dev->dev); | ||
211 | } | 192 | } |
212 | pci_dev_put(dev); | 193 | pci_dev_put(dev); |
213 | } else if (devfn) { | 194 | } else if (devfn) { |
@@ -253,7 +234,7 @@ static void pcie_pme_work_fn(struct work_struct *work) | |||
253 | * Clear PME status of the port. If there are other | 234 | * Clear PME status of the port. If there are other |
254 | * pending PMEs, the status will be set again. | 235 | * pending PMEs, the status will be set again. |
255 | */ | 236 | */ |
256 | pcie_pme_clear_status(port); | 237 | pcie_clear_root_pme_status(port); |
257 | 238 | ||
258 | spin_unlock_irq(&data->lock); | 239 | spin_unlock_irq(&data->lock); |
259 | pcie_pme_handle_request(port, rtsta & 0xffff); | 240 | pcie_pme_handle_request(port, rtsta & 0xffff); |
@@ -378,7 +359,7 @@ static int pcie_pme_probe(struct pcie_device *srv) | |||
378 | 359 | ||
379 | port = srv->port; | 360 | port = srv->port; |
380 | pcie_pme_interrupt_enable(port, false); | 361 | pcie_pme_interrupt_enable(port, false); |
381 | pcie_pme_clear_status(port); | 362 | pcie_clear_root_pme_status(port); |
382 | 363 | ||
383 | ret = request_irq(srv->irq, pcie_pme_irq, IRQF_SHARED, "PCIe PME", srv); | 364 | ret = request_irq(srv->irq, pcie_pme_irq, IRQF_SHARED, "PCIe PME", srv); |
384 | if (ret) { | 365 | if (ret) { |
@@ -402,7 +383,7 @@ static int pcie_pme_suspend(struct pcie_device *srv) | |||
402 | 383 | ||
403 | spin_lock_irq(&data->lock); | 384 | spin_lock_irq(&data->lock); |
404 | pcie_pme_interrupt_enable(port, false); | 385 | pcie_pme_interrupt_enable(port, false); |
405 | pcie_pme_clear_status(port); | 386 | pcie_clear_root_pme_status(port); |
406 | data->noirq = true; | 387 | data->noirq = true; |
407 | spin_unlock_irq(&data->lock); | 388 | spin_unlock_irq(&data->lock); |
408 | 389 | ||
@@ -422,7 +403,7 @@ static int pcie_pme_resume(struct pcie_device *srv) | |||
422 | 403 | ||
423 | spin_lock_irq(&data->lock); | 404 | spin_lock_irq(&data->lock); |
424 | data->noirq = false; | 405 | data->noirq = false; |
425 | pcie_pme_clear_status(port); | 406 | pcie_clear_root_pme_status(port); |
426 | pcie_pme_interrupt_enable(port, true); | 407 | pcie_pme_interrupt_enable(port, true); |
427 | spin_unlock_irq(&data->lock); | 408 | spin_unlock_irq(&data->lock); |
428 | 409 | ||
diff --git a/drivers/pci/pcie/portdrv.h b/drivers/pci/pcie/portdrv.h index 7b5aba0a3291..bd00a01aef14 100644 --- a/drivers/pci/pcie/portdrv.h +++ b/drivers/pci/pcie/portdrv.h | |||
@@ -20,9 +20,6 @@ | |||
20 | 20 | ||
21 | #define get_descriptor_id(type, service) (((type - 4) << 4) | service) | 21 | #define get_descriptor_id(type, service) (((type - 4) << 4) | service) |
22 | 22 | ||
23 | extern bool pcie_ports_disabled; | ||
24 | extern bool pcie_ports_auto; | ||
25 | |||
26 | extern struct bus_type pcie_port_bus_type; | 23 | extern struct bus_type pcie_port_bus_type; |
27 | extern int pcie_port_device_register(struct pci_dev *dev); | 24 | extern int pcie_port_device_register(struct pci_dev *dev); |
28 | #ifdef CONFIG_PM | 25 | #ifdef CONFIG_PM |
@@ -35,6 +32,8 @@ extern void pcie_port_bus_unregister(void); | |||
35 | 32 | ||
36 | struct pci_dev; | 33 | struct pci_dev; |
37 | 34 | ||
35 | extern void pcie_clear_root_pme_status(struct pci_dev *dev); | ||
36 | |||
38 | #ifdef CONFIG_PCIE_PME | 37 | #ifdef CONFIG_PCIE_PME |
39 | extern bool pcie_pme_msi_disabled; | 38 | extern bool pcie_pme_msi_disabled; |
40 | 39 | ||
diff --git a/drivers/pci/pcie/portdrv_acpi.c b/drivers/pci/pcie/portdrv_acpi.c index 5982b6a63b89..a86b56e5f2f2 100644 --- a/drivers/pci/pcie/portdrv_acpi.c +++ b/drivers/pci/pcie/portdrv_acpi.c | |||
@@ -33,7 +33,7 @@ | |||
33 | */ | 33 | */ |
34 | int pcie_port_acpi_setup(struct pci_dev *port, int *srv_mask) | 34 | int pcie_port_acpi_setup(struct pci_dev *port, int *srv_mask) |
35 | { | 35 | { |
36 | acpi_status status; | 36 | struct acpi_pci_root *root; |
37 | acpi_handle handle; | 37 | acpi_handle handle; |
38 | u32 flags; | 38 | u32 flags; |
39 | 39 | ||
@@ -44,26 +44,11 @@ int pcie_port_acpi_setup(struct pci_dev *port, int *srv_mask) | |||
44 | if (!handle) | 44 | if (!handle) |
45 | return -EINVAL; | 45 | return -EINVAL; |
46 | 46 | ||
47 | flags = OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL | 47 | root = acpi_pci_find_root(handle); |
48 | | OSC_PCI_EXPRESS_NATIVE_HP_CONTROL | 48 | if (!root) |
49 | | OSC_PCI_EXPRESS_PME_CONTROL; | ||
50 | |||
51 | if (pci_aer_available()) { | ||
52 | if (aer_acpi_firmware_first()) | ||
53 | dev_dbg(&port->dev, "PCIe errors handled by BIOS.\n"); | ||
54 | else | ||
55 | flags |= OSC_PCI_EXPRESS_AER_CONTROL; | ||
56 | } | ||
57 | |||
58 | status = acpi_pci_osc_control_set(handle, &flags, | ||
59 | OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL); | ||
60 | if (ACPI_FAILURE(status)) { | ||
61 | dev_dbg(&port->dev, "ACPI _OSC request failed (code %d)\n", | ||
62 | status); | ||
63 | return -ENODEV; | 49 | return -ENODEV; |
64 | } | ||
65 | 50 | ||
66 | dev_info(&port->dev, "ACPI _OSC control granted for 0x%02x\n", flags); | 51 | flags = root->osc_control_set; |
67 | 52 | ||
68 | *srv_mask = PCIE_PORT_SERVICE_VC; | 53 | *srv_mask = PCIE_PORT_SERVICE_VC; |
69 | if (flags & OSC_PCI_EXPRESS_NATIVE_HP_CONTROL) | 54 | if (flags & OSC_PCI_EXPRESS_NATIVE_HP_CONTROL) |
diff --git a/drivers/pci/pcie/portdrv_core.c b/drivers/pci/pcie/portdrv_core.c index a9c222d79ebc..5130d0d22390 100644 --- a/drivers/pci/pcie/portdrv_core.c +++ b/drivers/pci/pcie/portdrv_core.c | |||
@@ -241,17 +241,17 @@ static int get_port_device_capability(struct pci_dev *dev) | |||
241 | int cap_mask; | 241 | int cap_mask; |
242 | int err; | 242 | int err; |
243 | 243 | ||
244 | if (pcie_ports_disabled) | ||
245 | return 0; | ||
246 | |||
244 | err = pcie_port_platform_notify(dev, &cap_mask); | 247 | err = pcie_port_platform_notify(dev, &cap_mask); |
245 | if (pcie_ports_auto) { | 248 | if (!pcie_ports_auto) { |
246 | if (err) { | ||
247 | pcie_no_aspm(); | ||
248 | return 0; | ||
249 | } | ||
250 | } else { | ||
251 | cap_mask = PCIE_PORT_SERVICE_PME | PCIE_PORT_SERVICE_HP | 249 | cap_mask = PCIE_PORT_SERVICE_PME | PCIE_PORT_SERVICE_HP |
252 | | PCIE_PORT_SERVICE_VC; | 250 | | PCIE_PORT_SERVICE_VC; |
253 | if (pci_aer_available()) | 251 | if (pci_aer_available()) |
254 | cap_mask |= PCIE_PORT_SERVICE_AER; | 252 | cap_mask |= PCIE_PORT_SERVICE_AER; |
253 | } else if (err) { | ||
254 | return 0; | ||
255 | } | 255 | } |
256 | 256 | ||
257 | pos = pci_pcie_cap(dev); | 257 | pos = pci_pcie_cap(dev); |
@@ -349,15 +349,18 @@ int pcie_port_device_register(struct pci_dev *dev) | |||
349 | int status, capabilities, i, nr_service; | 349 | int status, capabilities, i, nr_service; |
350 | int irqs[PCIE_PORT_DEVICE_MAXSERVICES]; | 350 | int irqs[PCIE_PORT_DEVICE_MAXSERVICES]; |
351 | 351 | ||
352 | /* Get and check PCI Express port services */ | ||
353 | capabilities = get_port_device_capability(dev); | ||
354 | if (!capabilities) | ||
355 | return -ENODEV; | ||
356 | |||
357 | /* Enable PCI Express port device */ | 352 | /* Enable PCI Express port device */ |
358 | status = pci_enable_device(dev); | 353 | status = pci_enable_device(dev); |
359 | if (status) | 354 | if (status) |
360 | return status; | 355 | return status; |
356 | |||
357 | /* Get and check PCI Express port services */ | ||
358 | capabilities = get_port_device_capability(dev); | ||
359 | if (!capabilities) { | ||
360 | pcie_no_aspm(); | ||
361 | return 0; | ||
362 | } | ||
363 | |||
361 | pci_set_master(dev); | 364 | pci_set_master(dev); |
362 | /* | 365 | /* |
363 | * Initialize service irqs. Don't use service devices that | 366 | * Initialize service irqs. Don't use service devices that |
diff --git a/drivers/pci/pcie/portdrv_pci.c b/drivers/pci/pcie/portdrv_pci.c index f9033e190fb6..e0610bda1dea 100644 --- a/drivers/pci/pcie/portdrv_pci.c +++ b/drivers/pci/pcie/portdrv_pci.c | |||
@@ -57,6 +57,22 @@ __setup("pcie_ports=", pcie_port_setup); | |||
57 | 57 | ||
58 | /* global data */ | 58 | /* global data */ |
59 | 59 | ||
60 | /** | ||
61 | * pcie_clear_root_pme_status - Clear root port PME interrupt status. | ||
62 | * @dev: PCIe root port or event collector. | ||
63 | */ | ||
64 | void pcie_clear_root_pme_status(struct pci_dev *dev) | ||
65 | { | ||
66 | int rtsta_pos; | ||
67 | u32 rtsta; | ||
68 | |||
69 | rtsta_pos = pci_pcie_cap(dev) + PCI_EXP_RTSTA; | ||
70 | |||
71 | pci_read_config_dword(dev, rtsta_pos, &rtsta); | ||
72 | rtsta |= PCI_EXP_RTSTA_PME; | ||
73 | pci_write_config_dword(dev, rtsta_pos, rtsta); | ||
74 | } | ||
75 | |||
60 | static int pcie_portdrv_restore_config(struct pci_dev *dev) | 76 | static int pcie_portdrv_restore_config(struct pci_dev *dev) |
61 | { | 77 | { |
62 | int retval; | 78 | int retval; |
@@ -69,6 +85,20 @@ static int pcie_portdrv_restore_config(struct pci_dev *dev) | |||
69 | } | 85 | } |
70 | 86 | ||
71 | #ifdef CONFIG_PM | 87 | #ifdef CONFIG_PM |
88 | static int pcie_port_resume_noirq(struct device *dev) | ||
89 | { | ||
90 | struct pci_dev *pdev = to_pci_dev(dev); | ||
91 | |||
92 | /* | ||
93 | * Some BIOSes forget to clear Root PME Status bits after system wakeup | ||
94 | * which breaks ACPI-based runtime wakeup on PCI Express, so clear those | ||
95 | * bits now just in case (shouldn't hurt). | ||
96 | */ | ||
97 | if(pdev->pcie_type == PCI_EXP_TYPE_ROOT_PORT) | ||
98 | pcie_clear_root_pme_status(pdev); | ||
99 | return 0; | ||
100 | } | ||
101 | |||
72 | static const struct dev_pm_ops pcie_portdrv_pm_ops = { | 102 | static const struct dev_pm_ops pcie_portdrv_pm_ops = { |
73 | .suspend = pcie_port_device_suspend, | 103 | .suspend = pcie_port_device_suspend, |
74 | .resume = pcie_port_device_resume, | 104 | .resume = pcie_port_device_resume, |
@@ -76,6 +106,7 @@ static const struct dev_pm_ops pcie_portdrv_pm_ops = { | |||
76 | .thaw = pcie_port_device_resume, | 106 | .thaw = pcie_port_device_resume, |
77 | .poweroff = pcie_port_device_suspend, | 107 | .poweroff = pcie_port_device_suspend, |
78 | .restore = pcie_port_device_resume, | 108 | .restore = pcie_port_device_resume, |
109 | .resume_noirq = pcie_port_resume_noirq, | ||
79 | }; | 110 | }; |
80 | 111 | ||
81 | #define PCIE_PORTDRV_PM_OPS (&pcie_portdrv_pm_ops) | 112 | #define PCIE_PORTDRV_PM_OPS (&pcie_portdrv_pm_ops) |
@@ -327,10 +358,8 @@ static int __init pcie_portdrv_init(void) | |||
327 | { | 358 | { |
328 | int retval; | 359 | int retval; |
329 | 360 | ||
330 | if (pcie_ports_disabled) { | 361 | if (pcie_ports_disabled) |
331 | pcie_no_aspm(); | 362 | return pci_register_driver(&pcie_portdriver); |
332 | return -EACCES; | ||
333 | } | ||
334 | 363 | ||
335 | dmi_check_system(pcie_portdrv_dmi_table); | 364 | dmi_check_system(pcie_portdrv_dmi_table); |
336 | 365 | ||
diff --git a/drivers/power/Kconfig b/drivers/power/Kconfig index 60d83d983a36..61bf5d724139 100644 --- a/drivers/power/Kconfig +++ b/drivers/power/Kconfig | |||
@@ -136,6 +136,16 @@ config BATTERY_MAX17040 | |||
136 | in handheld and portable equipment. The MAX17040 is configured | 136 | in handheld and portable equipment. The MAX17040 is configured |
137 | to operate with a single lithium cell | 137 | to operate with a single lithium cell |
138 | 138 | ||
139 | config BATTERY_MAX17042 | ||
140 | tristate "Maxim MAX17042/8997/8966 Fuel Gauge" | ||
141 | depends on I2C | ||
142 | help | ||
143 | MAX17042 is fuel-gauge systems for lithium-ion (Li+) batteries | ||
144 | in handheld and portable equipment. The MAX17042 is configured | ||
145 | to operate with a single lithium cell. MAX8997 and MAX8966 are | ||
146 | multi-function devices that include fuel gauages that are compatible | ||
147 | with MAX17042. | ||
148 | |||
139 | config BATTERY_Z2 | 149 | config BATTERY_Z2 |
140 | tristate "Z2 battery driver" | 150 | tristate "Z2 battery driver" |
141 | depends on I2C && MACH_ZIPIT2 | 151 | depends on I2C && MACH_ZIPIT2 |
@@ -185,4 +195,14 @@ config CHARGER_TWL4030 | |||
185 | help | 195 | help |
186 | Say Y here to enable support for TWL4030 Battery Charge Interface. | 196 | Say Y here to enable support for TWL4030 Battery Charge Interface. |
187 | 197 | ||
198 | config CHARGER_GPIO | ||
199 | tristate "GPIO charger" | ||
200 | depends on GPIOLIB | ||
201 | help | ||
202 | Say Y to include support for chargers which report their online status | ||
203 | through a GPIO pin. | ||
204 | |||
205 | This driver can be build as a module. If so, the module will be | ||
206 | called gpio-charger. | ||
207 | |||
188 | endif # POWER_SUPPLY | 208 | endif # POWER_SUPPLY |
diff --git a/drivers/power/Makefile b/drivers/power/Makefile index c75772eb157c..8385bfae8728 100644 --- a/drivers/power/Makefile +++ b/drivers/power/Makefile | |||
@@ -25,6 +25,7 @@ obj-$(CONFIG_BATTERY_BQ20Z75) += bq20z75.o | |||
25 | obj-$(CONFIG_BATTERY_BQ27x00) += bq27x00_battery.o | 25 | obj-$(CONFIG_BATTERY_BQ27x00) += bq27x00_battery.o |
26 | obj-$(CONFIG_BATTERY_DA9030) += da9030_battery.o | 26 | obj-$(CONFIG_BATTERY_DA9030) += da9030_battery.o |
27 | obj-$(CONFIG_BATTERY_MAX17040) += max17040_battery.o | 27 | obj-$(CONFIG_BATTERY_MAX17040) += max17040_battery.o |
28 | obj-$(CONFIG_BATTERY_MAX17042) += max17042_battery.o | ||
28 | obj-$(CONFIG_BATTERY_Z2) += z2_battery.o | 29 | obj-$(CONFIG_BATTERY_Z2) += z2_battery.o |
29 | obj-$(CONFIG_BATTERY_S3C_ADC) += s3c_adc_battery.o | 30 | obj-$(CONFIG_BATTERY_S3C_ADC) += s3c_adc_battery.o |
30 | obj-$(CONFIG_CHARGER_PCF50633) += pcf50633-charger.o | 31 | obj-$(CONFIG_CHARGER_PCF50633) += pcf50633-charger.o |
@@ -32,3 +33,4 @@ obj-$(CONFIG_BATTERY_JZ4740) += jz4740-battery.o | |||
32 | obj-$(CONFIG_BATTERY_INTEL_MID) += intel_mid_battery.o | 33 | obj-$(CONFIG_BATTERY_INTEL_MID) += intel_mid_battery.o |
33 | obj-$(CONFIG_CHARGER_ISP1704) += isp1704_charger.o | 34 | obj-$(CONFIG_CHARGER_ISP1704) += isp1704_charger.o |
34 | obj-$(CONFIG_CHARGER_TWL4030) += twl4030_charger.o | 35 | obj-$(CONFIG_CHARGER_TWL4030) += twl4030_charger.o |
36 | obj-$(CONFIG_CHARGER_GPIO) += gpio-charger.o | ||
diff --git a/drivers/power/collie_battery.c b/drivers/power/collie_battery.c index 039f41ae217d..548d263b1ad0 100644 --- a/drivers/power/collie_battery.c +++ b/drivers/power/collie_battery.c | |||
@@ -295,7 +295,7 @@ static struct { | |||
295 | static int collie_bat_suspend(struct ucb1x00_dev *dev, pm_message_t state) | 295 | static int collie_bat_suspend(struct ucb1x00_dev *dev, pm_message_t state) |
296 | { | 296 | { |
297 | /* flush all pending status updates */ | 297 | /* flush all pending status updates */ |
298 | flush_scheduled_work(); | 298 | flush_work_sync(&bat_work); |
299 | return 0; | 299 | return 0; |
300 | } | 300 | } |
301 | 301 | ||
@@ -362,7 +362,7 @@ err_psy_reg_bu: | |||
362 | err_psy_reg_main: | 362 | err_psy_reg_main: |
363 | 363 | ||
364 | /* see comment in collie_bat_remove */ | 364 | /* see comment in collie_bat_remove */ |
365 | flush_scheduled_work(); | 365 | cancel_work_sync(&bat_work); |
366 | 366 | ||
367 | i--; | 367 | i--; |
368 | err_gpio: | 368 | err_gpio: |
@@ -382,12 +382,11 @@ static void __devexit collie_bat_remove(struct ucb1x00_dev *dev) | |||
382 | power_supply_unregister(&collie_bat_main.psy); | 382 | power_supply_unregister(&collie_bat_main.psy); |
383 | 383 | ||
384 | /* | 384 | /* |
385 | * now flush all pending work. | 385 | * Now cancel the bat_work. We won't get any more schedules, |
386 | * we won't get any more schedules, since all | 386 | * since all sources (isr and external_power_changed) are |
387 | * sources (isr and external_power_changed) | 387 | * unregistered now. |
388 | * are unregistered now. | ||
389 | */ | 388 | */ |
390 | flush_scheduled_work(); | 389 | cancel_work_sync(&bat_work); |
391 | 390 | ||
392 | for (i = ARRAY_SIZE(gpios) - 1; i >= 0; i--) | 391 | for (i = ARRAY_SIZE(gpios) - 1; i >= 0; i--) |
393 | gpio_free(gpios[i].gpio); | 392 | gpio_free(gpios[i].gpio); |
diff --git a/drivers/power/ds2760_battery.c b/drivers/power/ds2760_battery.c index e7f89785beef..e534290f3256 100644 --- a/drivers/power/ds2760_battery.c +++ b/drivers/power/ds2760_battery.c | |||
@@ -212,7 +212,7 @@ static int ds2760_battery_read_status(struct ds2760_device_info *di) | |||
212 | if (di->rem_capacity > 100) | 212 | if (di->rem_capacity > 100) |
213 | di->rem_capacity = 100; | 213 | di->rem_capacity = 100; |
214 | 214 | ||
215 | if (di->current_uA >= 100L) | 215 | if (di->current_uA < -100L) |
216 | di->life_sec = -((di->accum_current_uAh - di->empty_uAh) * 36L) | 216 | di->life_sec = -((di->accum_current_uAh - di->empty_uAh) * 36L) |
217 | / (di->current_uA / 100L); | 217 | / (di->current_uA / 100L); |
218 | else | 218 | else |
diff --git a/drivers/power/gpio-charger.c b/drivers/power/gpio-charger.c new file mode 100644 index 000000000000..25b88ac1d44c --- /dev/null +++ b/drivers/power/gpio-charger.c | |||
@@ -0,0 +1,188 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2010, Lars-Peter Clausen <lars@metafoo.de> | ||
3 | * Driver for chargers which report their online status through a GPIO pin | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify it | ||
6 | * under the terms of the GNU General Public License as published by the | ||
7 | * Free Software Foundation; either version 2 of the License, or (at your | ||
8 | * option) any later version. | ||
9 | * | ||
10 | * You should have received a copy of the GNU General Public License along | ||
11 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
12 | * 675 Mass Ave, Cambridge, MA 02139, USA. | ||
13 | * | ||
14 | */ | ||
15 | |||
16 | #include <linux/device.h> | ||
17 | #include <linux/gpio.h> | ||
18 | #include <linux/init.h> | ||
19 | #include <linux/interrupt.h> | ||
20 | #include <linux/kernel.h> | ||
21 | #include <linux/module.h> | ||
22 | #include <linux/platform_device.h> | ||
23 | #include <linux/power_supply.h> | ||
24 | #include <linux/slab.h> | ||
25 | |||
26 | #include <linux/power/gpio-charger.h> | ||
27 | |||
28 | struct gpio_charger { | ||
29 | const struct gpio_charger_platform_data *pdata; | ||
30 | unsigned int irq; | ||
31 | |||
32 | struct power_supply charger; | ||
33 | }; | ||
34 | |||
35 | static irqreturn_t gpio_charger_irq(int irq, void *devid) | ||
36 | { | ||
37 | struct power_supply *charger = devid; | ||
38 | |||
39 | power_supply_changed(charger); | ||
40 | |||
41 | return IRQ_HANDLED; | ||
42 | } | ||
43 | |||
44 | static inline struct gpio_charger *psy_to_gpio_charger(struct power_supply *psy) | ||
45 | { | ||
46 | return container_of(psy, struct gpio_charger, charger); | ||
47 | } | ||
48 | |||
49 | static int gpio_charger_get_property(struct power_supply *psy, | ||
50 | enum power_supply_property psp, union power_supply_propval *val) | ||
51 | { | ||
52 | struct gpio_charger *gpio_charger = psy_to_gpio_charger(psy); | ||
53 | const struct gpio_charger_platform_data *pdata = gpio_charger->pdata; | ||
54 | |||
55 | switch (psp) { | ||
56 | case POWER_SUPPLY_PROP_ONLINE: | ||
57 | val->intval = gpio_get_value(pdata->gpio); | ||
58 | val->intval ^= pdata->gpio_active_low; | ||
59 | break; | ||
60 | default: | ||
61 | return -EINVAL; | ||
62 | } | ||
63 | |||
64 | return 0; | ||
65 | } | ||
66 | |||
67 | static enum power_supply_property gpio_charger_properties[] = { | ||
68 | POWER_SUPPLY_PROP_ONLINE, | ||
69 | }; | ||
70 | |||
71 | static int __devinit gpio_charger_probe(struct platform_device *pdev) | ||
72 | { | ||
73 | const struct gpio_charger_platform_data *pdata = pdev->dev.platform_data; | ||
74 | struct gpio_charger *gpio_charger; | ||
75 | struct power_supply *charger; | ||
76 | int ret; | ||
77 | int irq; | ||
78 | |||
79 | if (!pdata) { | ||
80 | dev_err(&pdev->dev, "No platform data\n"); | ||
81 | return -EINVAL; | ||
82 | } | ||
83 | |||
84 | if (!gpio_is_valid(pdata->gpio)) { | ||
85 | dev_err(&pdev->dev, "Invalid gpio pin\n"); | ||
86 | return -EINVAL; | ||
87 | } | ||
88 | |||
89 | gpio_charger = kzalloc(sizeof(*gpio_charger), GFP_KERNEL); | ||
90 | if (!gpio_charger) { | ||
91 | dev_err(&pdev->dev, "Failed to alloc driver structure\n"); | ||
92 | return -ENOMEM; | ||
93 | } | ||
94 | |||
95 | charger = &gpio_charger->charger; | ||
96 | |||
97 | charger->name = pdata->name ? pdata->name : "gpio-charger"; | ||
98 | charger->type = pdata->type; | ||
99 | charger->properties = gpio_charger_properties; | ||
100 | charger->num_properties = ARRAY_SIZE(gpio_charger_properties); | ||
101 | charger->get_property = gpio_charger_get_property; | ||
102 | charger->supplied_to = pdata->supplied_to; | ||
103 | charger->num_supplicants = pdata->num_supplicants; | ||
104 | |||
105 | ret = gpio_request(pdata->gpio, dev_name(&pdev->dev)); | ||
106 | if (ret) { | ||
107 | dev_err(&pdev->dev, "Failed to request gpio pin: %d\n", ret); | ||
108 | goto err_free; | ||
109 | } | ||
110 | ret = gpio_direction_input(pdata->gpio); | ||
111 | if (ret) { | ||
112 | dev_err(&pdev->dev, "Failed to set gpio to input: %d\n", ret); | ||
113 | goto err_gpio_free; | ||
114 | } | ||
115 | |||
116 | gpio_charger->pdata = pdata; | ||
117 | |||
118 | ret = power_supply_register(&pdev->dev, charger); | ||
119 | if (ret < 0) { | ||
120 | dev_err(&pdev->dev, "Failed to register power supply: %d\n", | ||
121 | ret); | ||
122 | goto err_gpio_free; | ||
123 | } | ||
124 | |||
125 | irq = gpio_to_irq(pdata->gpio); | ||
126 | if (irq > 0) { | ||
127 | ret = request_any_context_irq(irq, gpio_charger_irq, | ||
128 | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, | ||
129 | dev_name(&pdev->dev), charger); | ||
130 | if (ret) | ||
131 | dev_warn(&pdev->dev, "Failed to request irq: %d\n", ret); | ||
132 | else | ||
133 | gpio_charger->irq = irq; | ||
134 | } | ||
135 | |||
136 | platform_set_drvdata(pdev, gpio_charger); | ||
137 | |||
138 | return 0; | ||
139 | |||
140 | err_gpio_free: | ||
141 | gpio_free(pdata->gpio); | ||
142 | err_free: | ||
143 | kfree(gpio_charger); | ||
144 | return ret; | ||
145 | } | ||
146 | |||
147 | static int __devexit gpio_charger_remove(struct platform_device *pdev) | ||
148 | { | ||
149 | struct gpio_charger *gpio_charger = platform_get_drvdata(pdev); | ||
150 | |||
151 | if (gpio_charger->irq) | ||
152 | free_irq(gpio_charger->irq, &gpio_charger->charger); | ||
153 | |||
154 | power_supply_unregister(&gpio_charger->charger); | ||
155 | |||
156 | gpio_free(gpio_charger->pdata->gpio); | ||
157 | |||
158 | platform_set_drvdata(pdev, NULL); | ||
159 | kfree(gpio_charger); | ||
160 | |||
161 | return 0; | ||
162 | } | ||
163 | |||
164 | static struct platform_driver gpio_charger_driver = { | ||
165 | .probe = gpio_charger_probe, | ||
166 | .remove = __devexit_p(gpio_charger_remove), | ||
167 | .driver = { | ||
168 | .name = "gpio-charger", | ||
169 | .owner = THIS_MODULE, | ||
170 | }, | ||
171 | }; | ||
172 | |||
173 | static int __init gpio_charger_init(void) | ||
174 | { | ||
175 | return platform_driver_register(&gpio_charger_driver); | ||
176 | } | ||
177 | module_init(gpio_charger_init); | ||
178 | |||
179 | static void __exit gpio_charger_exit(void) | ||
180 | { | ||
181 | platform_driver_unregister(&gpio_charger_driver); | ||
182 | } | ||
183 | module_exit(gpio_charger_exit); | ||
184 | |||
185 | MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>"); | ||
186 | MODULE_DESCRIPTION("Driver for chargers which report their online status through a GPIO"); | ||
187 | MODULE_LICENSE("GPL"); | ||
188 | MODULE_ALIAS("platform:gpio-charger"); | ||
diff --git a/drivers/power/intel_mid_battery.c b/drivers/power/intel_mid_battery.c index 36cf402c0677..bce3a01da2f0 100644 --- a/drivers/power/intel_mid_battery.c +++ b/drivers/power/intel_mid_battery.c | |||
@@ -765,7 +765,7 @@ static int __devexit platform_pmic_battery_remove(struct platform_device *pdev) | |||
765 | power_supply_unregister(&pbi->usb); | 765 | power_supply_unregister(&pbi->usb); |
766 | power_supply_unregister(&pbi->batt); | 766 | power_supply_unregister(&pbi->batt); |
767 | 767 | ||
768 | flush_scheduled_work(); | 768 | cancel_work_sync(&pbi->handler); |
769 | kfree(pbi); | 769 | kfree(pbi); |
770 | return 0; | 770 | return 0; |
771 | } | 771 | } |
diff --git a/drivers/power/isp1704_charger.c b/drivers/power/isp1704_charger.c index 72512185f3e2..2ad9b14a5ce3 100644 --- a/drivers/power/isp1704_charger.c +++ b/drivers/power/isp1704_charger.c | |||
@@ -59,11 +59,61 @@ struct isp1704_charger { | |||
59 | struct notifier_block nb; | 59 | struct notifier_block nb; |
60 | struct work_struct work; | 60 | struct work_struct work; |
61 | 61 | ||
62 | char model[7]; | 62 | /* properties */ |
63 | char model[8]; | ||
63 | unsigned present:1; | 64 | unsigned present:1; |
65 | unsigned online:1; | ||
66 | unsigned current_max; | ||
67 | |||
68 | /* temp storage variables */ | ||
69 | unsigned long event; | ||
70 | unsigned max_power; | ||
64 | }; | 71 | }; |
65 | 72 | ||
66 | /* | 73 | /* |
74 | * Determine is the charging port DCP (dedicated charger) or CDP (Host/HUB | ||
75 | * chargers). | ||
76 | * | ||
77 | * REVISIT: The method is defined in Battery Charging Specification and is | ||
78 | * applicable to any ULPI transceiver. Nothing isp170x specific here. | ||
79 | */ | ||
80 | static inline int isp1704_charger_type(struct isp1704_charger *isp) | ||
81 | { | ||
82 | u8 reg; | ||
83 | u8 func_ctrl; | ||
84 | u8 otg_ctrl; | ||
85 | int type = POWER_SUPPLY_TYPE_USB_DCP; | ||
86 | |||
87 | func_ctrl = otg_io_read(isp->otg, ULPI_FUNC_CTRL); | ||
88 | otg_ctrl = otg_io_read(isp->otg, ULPI_OTG_CTRL); | ||
89 | |||
90 | /* disable pulldowns */ | ||
91 | reg = ULPI_OTG_CTRL_DM_PULLDOWN | ULPI_OTG_CTRL_DP_PULLDOWN; | ||
92 | otg_io_write(isp->otg, ULPI_CLR(ULPI_OTG_CTRL), reg); | ||
93 | |||
94 | /* full speed */ | ||
95 | otg_io_write(isp->otg, ULPI_CLR(ULPI_FUNC_CTRL), | ||
96 | ULPI_FUNC_CTRL_XCVRSEL_MASK); | ||
97 | otg_io_write(isp->otg, ULPI_SET(ULPI_FUNC_CTRL), | ||
98 | ULPI_FUNC_CTRL_FULL_SPEED); | ||
99 | |||
100 | /* Enable strong pull-up on DP (1.5K) and reset */ | ||
101 | reg = ULPI_FUNC_CTRL_TERMSELECT | ULPI_FUNC_CTRL_RESET; | ||
102 | otg_io_write(isp->otg, ULPI_SET(ULPI_FUNC_CTRL), reg); | ||
103 | usleep_range(1000, 2000); | ||
104 | |||
105 | reg = otg_io_read(isp->otg, ULPI_DEBUG); | ||
106 | if ((reg & 3) != 3) | ||
107 | type = POWER_SUPPLY_TYPE_USB_CDP; | ||
108 | |||
109 | /* recover original state */ | ||
110 | otg_io_write(isp->otg, ULPI_FUNC_CTRL, func_ctrl); | ||
111 | otg_io_write(isp->otg, ULPI_OTG_CTRL, otg_ctrl); | ||
112 | |||
113 | return type; | ||
114 | } | ||
115 | |||
116 | /* | ||
67 | * ISP1704 detects PS/2 adapters as charger. To make sure the detected charger | 117 | * ISP1704 detects PS/2 adapters as charger. To make sure the detected charger |
68 | * is actually a dedicated charger, the following steps need to be taken. | 118 | * is actually a dedicated charger, the following steps need to be taken. |
69 | */ | 119 | */ |
@@ -127,16 +177,19 @@ static inline int isp1704_charger_verify(struct isp1704_charger *isp) | |||
127 | static inline int isp1704_charger_detect(struct isp1704_charger *isp) | 177 | static inline int isp1704_charger_detect(struct isp1704_charger *isp) |
128 | { | 178 | { |
129 | unsigned long timeout; | 179 | unsigned long timeout; |
130 | u8 r; | 180 | u8 pwr_ctrl; |
131 | int ret = 0; | 181 | int ret = 0; |
132 | 182 | ||
183 | pwr_ctrl = otg_io_read(isp->otg, ISP1704_PWR_CTRL); | ||
184 | |||
133 | /* set SW control bit in PWR_CTRL register */ | 185 | /* set SW control bit in PWR_CTRL register */ |
134 | otg_io_write(isp->otg, ISP1704_PWR_CTRL, | 186 | otg_io_write(isp->otg, ISP1704_PWR_CTRL, |
135 | ISP1704_PWR_CTRL_SWCTRL); | 187 | ISP1704_PWR_CTRL_SWCTRL); |
136 | 188 | ||
137 | /* enable manual charger detection */ | 189 | /* enable manual charger detection */ |
138 | r = (ISP1704_PWR_CTRL_SWCTRL | ISP1704_PWR_CTRL_DPVSRC_EN); | 190 | otg_io_write(isp->otg, ULPI_SET(ISP1704_PWR_CTRL), |
139 | otg_io_write(isp->otg, ULPI_SET(ISP1704_PWR_CTRL), r); | 191 | ISP1704_PWR_CTRL_SWCTRL |
192 | | ISP1704_PWR_CTRL_DPVSRC_EN); | ||
140 | usleep_range(1000, 2000); | 193 | usleep_range(1000, 2000); |
141 | 194 | ||
142 | timeout = jiffies + msecs_to_jiffies(300); | 195 | timeout = jiffies + msecs_to_jiffies(300); |
@@ -147,7 +200,10 @@ static inline int isp1704_charger_detect(struct isp1704_charger *isp) | |||
147 | ret = isp1704_charger_verify(isp); | 200 | ret = isp1704_charger_verify(isp); |
148 | break; | 201 | break; |
149 | } | 202 | } |
150 | } while (!time_after(jiffies, timeout)); | 203 | } while (!time_after(jiffies, timeout) && isp->online); |
204 | |||
205 | /* recover original state */ | ||
206 | otg_io_write(isp->otg, ISP1704_PWR_CTRL, pwr_ctrl); | ||
151 | 207 | ||
152 | return ret; | 208 | return ret; |
153 | } | 209 | } |
@@ -155,52 +211,92 @@ static inline int isp1704_charger_detect(struct isp1704_charger *isp) | |||
155 | static void isp1704_charger_work(struct work_struct *data) | 211 | static void isp1704_charger_work(struct work_struct *data) |
156 | { | 212 | { |
157 | int detect; | 213 | int detect; |
214 | unsigned long event; | ||
215 | unsigned power; | ||
158 | struct isp1704_charger *isp = | 216 | struct isp1704_charger *isp = |
159 | container_of(data, struct isp1704_charger, work); | 217 | container_of(data, struct isp1704_charger, work); |
218 | static DEFINE_MUTEX(lock); | ||
160 | 219 | ||
161 | /* | 220 | event = isp->event; |
162 | * FIXME Only supporting dedicated chargers even though isp1704 can | 221 | power = isp->max_power; |
163 | * detect HUB and HOST chargers. If the device has already been | ||
164 | * enumerated, the detection will break the connection. | ||
165 | */ | ||
166 | if (isp->otg->state != OTG_STATE_B_IDLE) | ||
167 | return; | ||
168 | 222 | ||
169 | /* disable data pullups */ | 223 | mutex_lock(&lock); |
170 | if (isp->otg->gadget) | 224 | |
171 | usb_gadget_disconnect(isp->otg->gadget); | 225 | switch (event) { |
226 | case USB_EVENT_VBUS: | ||
227 | isp->online = true; | ||
228 | |||
229 | /* detect charger */ | ||
230 | detect = isp1704_charger_detect(isp); | ||
231 | |||
232 | if (detect) { | ||
233 | isp->present = detect; | ||
234 | isp->psy.type = isp1704_charger_type(isp); | ||
235 | } | ||
172 | 236 | ||
173 | /* detect charger */ | 237 | switch (isp->psy.type) { |
174 | detect = isp1704_charger_detect(isp); | 238 | case POWER_SUPPLY_TYPE_USB_DCP: |
175 | if (detect) { | 239 | isp->current_max = 1800; |
176 | isp->present = detect; | 240 | break; |
177 | power_supply_changed(&isp->psy); | 241 | case POWER_SUPPLY_TYPE_USB_CDP: |
242 | /* | ||
243 | * Only 500mA here or high speed chirp | ||
244 | * handshaking may break | ||
245 | */ | ||
246 | isp->current_max = 500; | ||
247 | /* FALLTHROUGH */ | ||
248 | case POWER_SUPPLY_TYPE_USB: | ||
249 | default: | ||
250 | /* enable data pullups */ | ||
251 | if (isp->otg->gadget) | ||
252 | usb_gadget_connect(isp->otg->gadget); | ||
253 | } | ||
254 | break; | ||
255 | case USB_EVENT_NONE: | ||
256 | isp->online = false; | ||
257 | isp->current_max = 0; | ||
258 | isp->present = 0; | ||
259 | isp->current_max = 0; | ||
260 | isp->psy.type = POWER_SUPPLY_TYPE_USB; | ||
261 | |||
262 | /* | ||
263 | * Disable data pullups. We need to prevent the controller from | ||
264 | * enumerating. | ||
265 | * | ||
266 | * FIXME: This is here to allow charger detection with Host/HUB | ||
267 | * chargers. The pullups may be enabled elsewhere, so this can | ||
268 | * not be the final solution. | ||
269 | */ | ||
270 | if (isp->otg->gadget) | ||
271 | usb_gadget_disconnect(isp->otg->gadget); | ||
272 | break; | ||
273 | case USB_EVENT_ENUMERATED: | ||
274 | if (isp->present) | ||
275 | isp->current_max = 1800; | ||
276 | else | ||
277 | isp->current_max = power; | ||
278 | break; | ||
279 | default: | ||
280 | goto out; | ||
178 | } | 281 | } |
179 | 282 | ||
180 | /* enable data pullups */ | 283 | power_supply_changed(&isp->psy); |
181 | if (isp->otg->gadget) | 284 | out: |
182 | usb_gadget_connect(isp->otg->gadget); | 285 | mutex_unlock(&lock); |
183 | } | 286 | } |
184 | 287 | ||
185 | static int isp1704_notifier_call(struct notifier_block *nb, | 288 | static int isp1704_notifier_call(struct notifier_block *nb, |
186 | unsigned long event, void *unused) | 289 | unsigned long event, void *power) |
187 | { | 290 | { |
188 | struct isp1704_charger *isp = | 291 | struct isp1704_charger *isp = |
189 | container_of(nb, struct isp1704_charger, nb); | 292 | container_of(nb, struct isp1704_charger, nb); |
190 | 293 | ||
191 | switch (event) { | 294 | isp->event = event; |
192 | case USB_EVENT_VBUS: | 295 | |
193 | schedule_work(&isp->work); | 296 | if (power) |
194 | break; | 297 | isp->max_power = *((unsigned *)power); |
195 | case USB_EVENT_NONE: | 298 | |
196 | if (isp->present) { | 299 | schedule_work(&isp->work); |
197 | isp->present = 0; | ||
198 | power_supply_changed(&isp->psy); | ||
199 | } | ||
200 | break; | ||
201 | default: | ||
202 | return NOTIFY_DONE; | ||
203 | } | ||
204 | 300 | ||
205 | return NOTIFY_OK; | 301 | return NOTIFY_OK; |
206 | } | 302 | } |
@@ -216,6 +312,12 @@ static int isp1704_charger_get_property(struct power_supply *psy, | |||
216 | case POWER_SUPPLY_PROP_PRESENT: | 312 | case POWER_SUPPLY_PROP_PRESENT: |
217 | val->intval = isp->present; | 313 | val->intval = isp->present; |
218 | break; | 314 | break; |
315 | case POWER_SUPPLY_PROP_ONLINE: | ||
316 | val->intval = isp->online; | ||
317 | break; | ||
318 | case POWER_SUPPLY_PROP_CURRENT_MAX: | ||
319 | val->intval = isp->current_max; | ||
320 | break; | ||
219 | case POWER_SUPPLY_PROP_MODEL_NAME: | 321 | case POWER_SUPPLY_PROP_MODEL_NAME: |
220 | val->strval = isp->model; | 322 | val->strval = isp->model; |
221 | break; | 323 | break; |
@@ -230,6 +332,8 @@ static int isp1704_charger_get_property(struct power_supply *psy, | |||
230 | 332 | ||
231 | static enum power_supply_property power_props[] = { | 333 | static enum power_supply_property power_props[] = { |
232 | POWER_SUPPLY_PROP_PRESENT, | 334 | POWER_SUPPLY_PROP_PRESENT, |
335 | POWER_SUPPLY_PROP_ONLINE, | ||
336 | POWER_SUPPLY_PROP_CURRENT_MAX, | ||
233 | POWER_SUPPLY_PROP_MODEL_NAME, | 337 | POWER_SUPPLY_PROP_MODEL_NAME, |
234 | POWER_SUPPLY_PROP_MANUFACTURER, | 338 | POWER_SUPPLY_PROP_MANUFACTURER, |
235 | }; | 339 | }; |
@@ -287,13 +391,13 @@ static int __devinit isp1704_charger_probe(struct platform_device *pdev) | |||
287 | if (!isp->otg) | 391 | if (!isp->otg) |
288 | goto fail0; | 392 | goto fail0; |
289 | 393 | ||
394 | isp->dev = &pdev->dev; | ||
395 | platform_set_drvdata(pdev, isp); | ||
396 | |||
290 | ret = isp1704_test_ulpi(isp); | 397 | ret = isp1704_test_ulpi(isp); |
291 | if (ret < 0) | 398 | if (ret < 0) |
292 | goto fail1; | 399 | goto fail1; |
293 | 400 | ||
294 | isp->dev = &pdev->dev; | ||
295 | platform_set_drvdata(pdev, isp); | ||
296 | |||
297 | isp->psy.name = "isp1704"; | 401 | isp->psy.name = "isp1704"; |
298 | isp->psy.type = POWER_SUPPLY_TYPE_USB; | 402 | isp->psy.type = POWER_SUPPLY_TYPE_USB; |
299 | isp->psy.properties = power_props; | 403 | isp->psy.properties = power_props; |
@@ -318,6 +422,23 @@ static int __devinit isp1704_charger_probe(struct platform_device *pdev) | |||
318 | 422 | ||
319 | dev_info(isp->dev, "registered with product id %s\n", isp->model); | 423 | dev_info(isp->dev, "registered with product id %s\n", isp->model); |
320 | 424 | ||
425 | /* | ||
426 | * Taking over the D+ pullup. | ||
427 | * | ||
428 | * FIXME: The device will be disconnected if it was already | ||
429 | * enumerated. The charger driver should be always loaded before any | ||
430 | * gadget is loaded. | ||
431 | */ | ||
432 | if (isp->otg->gadget) | ||
433 | usb_gadget_disconnect(isp->otg->gadget); | ||
434 | |||
435 | /* Detect charger if VBUS is valid (the cable was already plugged). */ | ||
436 | ret = otg_io_read(isp->otg, ULPI_USB_INT_STS); | ||
437 | if ((ret & ULPI_INT_VBUS_VALID) && !isp->otg->default_a) { | ||
438 | isp->event = USB_EVENT_VBUS; | ||
439 | schedule_work(&isp->work); | ||
440 | } | ||
441 | |||
321 | return 0; | 442 | return 0; |
322 | fail2: | 443 | fail2: |
323 | power_supply_unregister(&isp->psy); | 444 | power_supply_unregister(&isp->psy); |
diff --git a/drivers/power/jz4740-battery.c b/drivers/power/jz4740-battery.c index a8108a73593e..02414db6a94c 100644 --- a/drivers/power/jz4740-battery.c +++ b/drivers/power/jz4740-battery.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/module.h> | 19 | #include <linux/module.h> |
20 | #include <linux/platform_device.h> | 20 | #include <linux/platform_device.h> |
21 | #include <linux/slab.h> | 21 | #include <linux/slab.h> |
22 | #include <linux/io.h> | ||
22 | 23 | ||
23 | #include <linux/delay.h> | 24 | #include <linux/delay.h> |
24 | #include <linux/gpio.h> | 25 | #include <linux/gpio.h> |
@@ -47,6 +48,8 @@ struct jz_battery { | |||
47 | 48 | ||
48 | struct power_supply battery; | 49 | struct power_supply battery; |
49 | struct delayed_work work; | 50 | struct delayed_work work; |
51 | |||
52 | struct mutex lock; | ||
50 | }; | 53 | }; |
51 | 54 | ||
52 | static inline struct jz_battery *psy_to_jz_battery(struct power_supply *psy) | 55 | static inline struct jz_battery *psy_to_jz_battery(struct power_supply *psy) |
@@ -68,6 +71,8 @@ static long jz_battery_read_voltage(struct jz_battery *battery) | |||
68 | unsigned long val; | 71 | unsigned long val; |
69 | long voltage; | 72 | long voltage; |
70 | 73 | ||
74 | mutex_lock(&battery->lock); | ||
75 | |||
71 | INIT_COMPLETION(battery->read_completion); | 76 | INIT_COMPLETION(battery->read_completion); |
72 | 77 | ||
73 | enable_irq(battery->irq); | 78 | enable_irq(battery->irq); |
@@ -91,6 +96,8 @@ static long jz_battery_read_voltage(struct jz_battery *battery) | |||
91 | battery->cell->disable(battery->pdev); | 96 | battery->cell->disable(battery->pdev); |
92 | disable_irq(battery->irq); | 97 | disable_irq(battery->irq); |
93 | 98 | ||
99 | mutex_unlock(&battery->lock); | ||
100 | |||
94 | return voltage; | 101 | return voltage; |
95 | } | 102 | } |
96 | 103 | ||
@@ -240,6 +247,11 @@ static int __devinit jz_battery_probe(struct platform_device *pdev) | |||
240 | struct jz_battery *jz_battery; | 247 | struct jz_battery *jz_battery; |
241 | struct power_supply *battery; | 248 | struct power_supply *battery; |
242 | 249 | ||
250 | if (!pdata) { | ||
251 | dev_err(&pdev->dev, "No platform_data supplied\n"); | ||
252 | return -ENXIO; | ||
253 | } | ||
254 | |||
243 | jz_battery = kzalloc(sizeof(*jz_battery), GFP_KERNEL); | 255 | jz_battery = kzalloc(sizeof(*jz_battery), GFP_KERNEL); |
244 | if (!jz_battery) { | 256 | if (!jz_battery) { |
245 | dev_err(&pdev->dev, "Failed to allocate driver structure\n"); | 257 | dev_err(&pdev->dev, "Failed to allocate driver structure\n"); |
@@ -291,6 +303,7 @@ static int __devinit jz_battery_probe(struct platform_device *pdev) | |||
291 | jz_battery->pdev = pdev; | 303 | jz_battery->pdev = pdev; |
292 | 304 | ||
293 | init_completion(&jz_battery->read_completion); | 305 | init_completion(&jz_battery->read_completion); |
306 | mutex_init(&jz_battery->lock); | ||
294 | 307 | ||
295 | INIT_DELAYED_WORK(&jz_battery->work, jz_battery_work); | 308 | INIT_DELAYED_WORK(&jz_battery->work, jz_battery_work); |
296 | 309 | ||
diff --git a/drivers/power/max17042_battery.c b/drivers/power/max17042_battery.c new file mode 100644 index 000000000000..c5c8805156cb --- /dev/null +++ b/drivers/power/max17042_battery.c | |||
@@ -0,0 +1,239 @@ | |||
1 | /* | ||
2 | * Fuel gauge driver for Maxim 17042 / 8966 / 8997 | ||
3 | * Note that Maxim 8966 and 8997 are mfd and this is its subdevice. | ||
4 | * | ||
5 | * Copyright (C) 2011 Samsung Electronics | ||
6 | * MyungJoo Ham <myungjoo.ham@samsung.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; either version 2 of the License, or | ||
11 | * (at your option) any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | * GNU General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License | ||
19 | * along with this program; if not, write to the Free Software | ||
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
21 | * | ||
22 | * This driver is based on max17040_battery.c | ||
23 | */ | ||
24 | |||
25 | #include <linux/init.h> | ||
26 | #include <linux/slab.h> | ||
27 | #include <linux/i2c.h> | ||
28 | #include <linux/mod_devicetable.h> | ||
29 | #include <linux/power_supply.h> | ||
30 | #include <linux/power/max17042_battery.h> | ||
31 | |||
32 | enum max17042_register { | ||
33 | MAX17042_STATUS = 0x00, | ||
34 | MAX17042_VALRT_Th = 0x01, | ||
35 | MAX17042_TALRT_Th = 0x02, | ||
36 | MAX17042_SALRT_Th = 0x03, | ||
37 | MAX17042_AtRate = 0x04, | ||
38 | MAX17042_RepCap = 0x05, | ||
39 | MAX17042_RepSOC = 0x06, | ||
40 | MAX17042_Age = 0x07, | ||
41 | MAX17042_TEMP = 0x08, | ||
42 | MAX17042_VCELL = 0x09, | ||
43 | MAX17042_Current = 0x0A, | ||
44 | MAX17042_AvgCurrent = 0x0B, | ||
45 | MAX17042_Qresidual = 0x0C, | ||
46 | MAX17042_SOC = 0x0D, | ||
47 | MAX17042_AvSOC = 0x0E, | ||
48 | MAX17042_RemCap = 0x0F, | ||
49 | MAX17402_FullCAP = 0x10, | ||
50 | MAX17042_TTE = 0x11, | ||
51 | MAX17042_V_empty = 0x12, | ||
52 | |||
53 | MAX17042_RSLOW = 0x14, | ||
54 | |||
55 | MAX17042_AvgTA = 0x16, | ||
56 | MAX17042_Cycles = 0x17, | ||
57 | MAX17042_DesignCap = 0x18, | ||
58 | MAX17042_AvgVCELL = 0x19, | ||
59 | MAX17042_MinMaxTemp = 0x1A, | ||
60 | MAX17042_MinMaxVolt = 0x1B, | ||
61 | MAX17042_MinMaxCurr = 0x1C, | ||
62 | MAX17042_CONFIG = 0x1D, | ||
63 | MAX17042_ICHGTerm = 0x1E, | ||
64 | MAX17042_AvCap = 0x1F, | ||
65 | MAX17042_ManName = 0x20, | ||
66 | MAX17042_DevName = 0x21, | ||
67 | MAX17042_DevChem = 0x22, | ||
68 | |||
69 | MAX17042_TempNom = 0x24, | ||
70 | MAX17042_TempCold = 0x25, | ||
71 | MAX17042_TempHot = 0x26, | ||
72 | MAX17042_AIN = 0x27, | ||
73 | MAX17042_LearnCFG = 0x28, | ||
74 | MAX17042_SHFTCFG = 0x29, | ||
75 | MAX17042_RelaxCFG = 0x2A, | ||
76 | MAX17042_MiscCFG = 0x2B, | ||
77 | MAX17042_TGAIN = 0x2C, | ||
78 | MAx17042_TOFF = 0x2D, | ||
79 | MAX17042_CGAIN = 0x2E, | ||
80 | MAX17042_COFF = 0x2F, | ||
81 | |||
82 | MAX17042_Q_empty = 0x33, | ||
83 | MAX17042_T_empty = 0x34, | ||
84 | |||
85 | MAX17042_RCOMP0 = 0x38, | ||
86 | MAX17042_TempCo = 0x39, | ||
87 | MAX17042_Rx = 0x3A, | ||
88 | MAX17042_T_empty0 = 0x3B, | ||
89 | MAX17042_TaskPeriod = 0x3C, | ||
90 | MAX17042_FSTAT = 0x3D, | ||
91 | |||
92 | MAX17042_SHDNTIMER = 0x3F, | ||
93 | |||
94 | MAX17042_VFRemCap = 0x4A, | ||
95 | |||
96 | MAX17042_QH = 0x4D, | ||
97 | MAX17042_QL = 0x4E, | ||
98 | }; | ||
99 | |||
100 | struct max17042_chip { | ||
101 | struct i2c_client *client; | ||
102 | struct power_supply battery; | ||
103 | struct max17042_platform_data *pdata; | ||
104 | }; | ||
105 | |||
106 | static int max17042_write_reg(struct i2c_client *client, u8 reg, u16 value) | ||
107 | { | ||
108 | int ret = i2c_smbus_write_word_data(client, reg, value); | ||
109 | |||
110 | if (ret < 0) | ||
111 | dev_err(&client->dev, "%s: err %d\n", __func__, ret); | ||
112 | |||
113 | return ret; | ||
114 | } | ||
115 | |||
116 | static int max17042_read_reg(struct i2c_client *client, u8 reg) | ||
117 | { | ||
118 | int ret = i2c_smbus_read_word_data(client, reg); | ||
119 | |||
120 | if (ret < 0) | ||
121 | dev_err(&client->dev, "%s: err %d\n", __func__, ret); | ||
122 | |||
123 | return ret; | ||
124 | } | ||
125 | |||
126 | static enum power_supply_property max17042_battery_props[] = { | ||
127 | POWER_SUPPLY_PROP_VOLTAGE_NOW, | ||
128 | POWER_SUPPLY_PROP_VOLTAGE_AVG, | ||
129 | POWER_SUPPLY_PROP_CAPACITY, | ||
130 | }; | ||
131 | |||
132 | static int max17042_get_property(struct power_supply *psy, | ||
133 | enum power_supply_property psp, | ||
134 | union power_supply_propval *val) | ||
135 | { | ||
136 | struct max17042_chip *chip = container_of(psy, | ||
137 | struct max17042_chip, battery); | ||
138 | |||
139 | switch (psp) { | ||
140 | case POWER_SUPPLY_PROP_VOLTAGE_NOW: | ||
141 | val->intval = max17042_read_reg(chip->client, | ||
142 | MAX17042_VCELL) * 83; /* 1000 / 12 = 83 */ | ||
143 | break; | ||
144 | case POWER_SUPPLY_PROP_VOLTAGE_AVG: | ||
145 | val->intval = max17042_read_reg(chip->client, | ||
146 | MAX17042_AvgVCELL) * 83; | ||
147 | break; | ||
148 | case POWER_SUPPLY_PROP_CAPACITY: | ||
149 | val->intval = max17042_read_reg(chip->client, | ||
150 | MAX17042_SOC) / 256; | ||
151 | break; | ||
152 | default: | ||
153 | return -EINVAL; | ||
154 | } | ||
155 | return 0; | ||
156 | } | ||
157 | |||
158 | static int __devinit max17042_probe(struct i2c_client *client, | ||
159 | const struct i2c_device_id *id) | ||
160 | { | ||
161 | struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent); | ||
162 | struct max17042_chip *chip; | ||
163 | int ret; | ||
164 | |||
165 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_WORD_DATA)) | ||
166 | return -EIO; | ||
167 | |||
168 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); | ||
169 | if (!chip) | ||
170 | return -ENOMEM; | ||
171 | |||
172 | chip->client = client; | ||
173 | chip->pdata = client->dev.platform_data; | ||
174 | |||
175 | i2c_set_clientdata(client, chip); | ||
176 | |||
177 | chip->battery.name = "max17042_battery"; | ||
178 | chip->battery.type = POWER_SUPPLY_TYPE_BATTERY; | ||
179 | chip->battery.get_property = max17042_get_property; | ||
180 | chip->battery.properties = max17042_battery_props; | ||
181 | chip->battery.num_properties = ARRAY_SIZE(max17042_battery_props); | ||
182 | |||
183 | ret = power_supply_register(&client->dev, &chip->battery); | ||
184 | if (ret) { | ||
185 | dev_err(&client->dev, "failed: power supply register\n"); | ||
186 | i2c_set_clientdata(client, NULL); | ||
187 | kfree(chip); | ||
188 | return ret; | ||
189 | } | ||
190 | |||
191 | if (!chip->pdata->enable_current_sense) { | ||
192 | max17042_write_reg(client, MAX17042_CGAIN, 0x0000); | ||
193 | max17042_write_reg(client, MAX17042_MiscCFG, 0x0003); | ||
194 | max17042_write_reg(client, MAX17042_LearnCFG, 0x0007); | ||
195 | } | ||
196 | |||
197 | return 0; | ||
198 | } | ||
199 | |||
200 | static int __devexit max17042_remove(struct i2c_client *client) | ||
201 | { | ||
202 | struct max17042_chip *chip = i2c_get_clientdata(client); | ||
203 | |||
204 | power_supply_unregister(&chip->battery); | ||
205 | i2c_set_clientdata(client, NULL); | ||
206 | kfree(chip); | ||
207 | return 0; | ||
208 | } | ||
209 | |||
210 | static const struct i2c_device_id max17042_id[] = { | ||
211 | { "max17042", 0 }, | ||
212 | { } | ||
213 | }; | ||
214 | MODULE_DEVICE_TABLE(i2c, max17042_id); | ||
215 | |||
216 | static struct i2c_driver max17042_i2c_driver = { | ||
217 | .driver = { | ||
218 | .name = "max17042", | ||
219 | }, | ||
220 | .probe = max17042_probe, | ||
221 | .remove = __devexit_p(max17042_remove), | ||
222 | .id_table = max17042_id, | ||
223 | }; | ||
224 | |||
225 | static int __init max17042_init(void) | ||
226 | { | ||
227 | return i2c_add_driver(&max17042_i2c_driver); | ||
228 | } | ||
229 | module_init(max17042_init); | ||
230 | |||
231 | static void __exit max17042_exit(void) | ||
232 | { | ||
233 | i2c_del_driver(&max17042_i2c_driver); | ||
234 | } | ||
235 | module_exit(max17042_exit); | ||
236 | |||
237 | MODULE_AUTHOR("MyungJoo Ham <myungjoo.ham@samsung.com>"); | ||
238 | MODULE_DESCRIPTION("MAX17042 Fuel Gauge"); | ||
239 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/power/olpc_battery.c b/drivers/power/olpc_battery.c index 5bc1dcf7785e..0b0ff3a936a6 100644 --- a/drivers/power/olpc_battery.c +++ b/drivers/power/olpc_battery.c | |||
@@ -201,6 +201,72 @@ static int olpc_bat_get_tech(union power_supply_propval *val) | |||
201 | return ret; | 201 | return ret; |
202 | } | 202 | } |
203 | 203 | ||
204 | static int olpc_bat_get_charge_full_design(union power_supply_propval *val) | ||
205 | { | ||
206 | uint8_t ec_byte; | ||
207 | union power_supply_propval tech; | ||
208 | int ret, mfr; | ||
209 | |||
210 | ret = olpc_bat_get_tech(&tech); | ||
211 | if (ret) | ||
212 | return ret; | ||
213 | |||
214 | ec_byte = BAT_ADDR_MFR_TYPE; | ||
215 | ret = olpc_ec_cmd(EC_BAT_EEPROM, &ec_byte, 1, &ec_byte, 1); | ||
216 | if (ret) | ||
217 | return ret; | ||
218 | |||
219 | mfr = ec_byte >> 4; | ||
220 | |||
221 | switch (tech.intval) { | ||
222 | case POWER_SUPPLY_TECHNOLOGY_NiMH: | ||
223 | switch (mfr) { | ||
224 | case 1: /* Gold Peak */ | ||
225 | val->intval = 3000000*.8; | ||
226 | break; | ||
227 | default: | ||
228 | return -EIO; | ||
229 | } | ||
230 | break; | ||
231 | |||
232 | case POWER_SUPPLY_TECHNOLOGY_LiFe: | ||
233 | switch (mfr) { | ||
234 | case 1: /* Gold Peak */ | ||
235 | val->intval = 2800000; | ||
236 | break; | ||
237 | case 2: /* BYD */ | ||
238 | val->intval = 3100000; | ||
239 | break; | ||
240 | default: | ||
241 | return -EIO; | ||
242 | } | ||
243 | break; | ||
244 | |||
245 | default: | ||
246 | return -EIO; | ||
247 | } | ||
248 | |||
249 | return ret; | ||
250 | } | ||
251 | |||
252 | static int olpc_bat_get_charge_now(union power_supply_propval *val) | ||
253 | { | ||
254 | uint8_t soc; | ||
255 | union power_supply_propval full; | ||
256 | int ret; | ||
257 | |||
258 | ret = olpc_ec_cmd(EC_BAT_SOC, NULL, 0, &soc, 1); | ||
259 | if (ret) | ||
260 | return ret; | ||
261 | |||
262 | ret = olpc_bat_get_charge_full_design(&full); | ||
263 | if (ret) | ||
264 | return ret; | ||
265 | |||
266 | val->intval = soc * (full.intval / 100); | ||
267 | return 0; | ||
268 | } | ||
269 | |||
204 | /********************************************************************* | 270 | /********************************************************************* |
205 | * Battery properties | 271 | * Battery properties |
206 | *********************************************************************/ | 272 | *********************************************************************/ |
@@ -267,6 +333,7 @@ static int olpc_bat_get_property(struct power_supply *psy, | |||
267 | return ret; | 333 | return ret; |
268 | break; | 334 | break; |
269 | case POWER_SUPPLY_PROP_VOLTAGE_AVG: | 335 | case POWER_SUPPLY_PROP_VOLTAGE_AVG: |
336 | case POWER_SUPPLY_PROP_VOLTAGE_NOW: | ||
270 | ret = olpc_ec_cmd(EC_BAT_VOLTAGE, NULL, 0, (void *)&ec_word, 2); | 337 | ret = olpc_ec_cmd(EC_BAT_VOLTAGE, NULL, 0, (void *)&ec_word, 2); |
271 | if (ret) | 338 | if (ret) |
272 | return ret; | 339 | return ret; |
@@ -274,6 +341,7 @@ static int olpc_bat_get_property(struct power_supply *psy, | |||
274 | val->intval = (s16)be16_to_cpu(ec_word) * 9760L / 32; | 341 | val->intval = (s16)be16_to_cpu(ec_word) * 9760L / 32; |
275 | break; | 342 | break; |
276 | case POWER_SUPPLY_PROP_CURRENT_AVG: | 343 | case POWER_SUPPLY_PROP_CURRENT_AVG: |
344 | case POWER_SUPPLY_PROP_CURRENT_NOW: | ||
277 | ret = olpc_ec_cmd(EC_BAT_CURRENT, NULL, 0, (void *)&ec_word, 2); | 345 | ret = olpc_ec_cmd(EC_BAT_CURRENT, NULL, 0, (void *)&ec_word, 2); |
278 | if (ret) | 346 | if (ret) |
279 | return ret; | 347 | return ret; |
@@ -294,6 +362,16 @@ static int olpc_bat_get_property(struct power_supply *psy, | |||
294 | else | 362 | else |
295 | val->intval = POWER_SUPPLY_CAPACITY_LEVEL_NORMAL; | 363 | val->intval = POWER_SUPPLY_CAPACITY_LEVEL_NORMAL; |
296 | break; | 364 | break; |
365 | case POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN: | ||
366 | ret = olpc_bat_get_charge_full_design(val); | ||
367 | if (ret) | ||
368 | return ret; | ||
369 | break; | ||
370 | case POWER_SUPPLY_PROP_CHARGE_NOW: | ||
371 | ret = olpc_bat_get_charge_now(val); | ||
372 | if (ret) | ||
373 | return ret; | ||
374 | break; | ||
297 | case POWER_SUPPLY_PROP_TEMP: | 375 | case POWER_SUPPLY_PROP_TEMP: |
298 | ret = olpc_ec_cmd(EC_BAT_TEMP, NULL, 0, (void *)&ec_word, 2); | 376 | ret = olpc_ec_cmd(EC_BAT_TEMP, NULL, 0, (void *)&ec_word, 2); |
299 | if (ret) | 377 | if (ret) |
@@ -331,16 +409,20 @@ static int olpc_bat_get_property(struct power_supply *psy, | |||
331 | return ret; | 409 | return ret; |
332 | } | 410 | } |
333 | 411 | ||
334 | static enum power_supply_property olpc_bat_props[] = { | 412 | static enum power_supply_property olpc_xo1_bat_props[] = { |
335 | POWER_SUPPLY_PROP_STATUS, | 413 | POWER_SUPPLY_PROP_STATUS, |
336 | POWER_SUPPLY_PROP_CHARGE_TYPE, | 414 | POWER_SUPPLY_PROP_CHARGE_TYPE, |
337 | POWER_SUPPLY_PROP_PRESENT, | 415 | POWER_SUPPLY_PROP_PRESENT, |
338 | POWER_SUPPLY_PROP_HEALTH, | 416 | POWER_SUPPLY_PROP_HEALTH, |
339 | POWER_SUPPLY_PROP_TECHNOLOGY, | 417 | POWER_SUPPLY_PROP_TECHNOLOGY, |
340 | POWER_SUPPLY_PROP_VOLTAGE_AVG, | 418 | POWER_SUPPLY_PROP_VOLTAGE_AVG, |
419 | POWER_SUPPLY_PROP_VOLTAGE_NOW, | ||
341 | POWER_SUPPLY_PROP_CURRENT_AVG, | 420 | POWER_SUPPLY_PROP_CURRENT_AVG, |
421 | POWER_SUPPLY_PROP_CURRENT_NOW, | ||
342 | POWER_SUPPLY_PROP_CAPACITY, | 422 | POWER_SUPPLY_PROP_CAPACITY, |
343 | POWER_SUPPLY_PROP_CAPACITY_LEVEL, | 423 | POWER_SUPPLY_PROP_CAPACITY_LEVEL, |
424 | POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN, | ||
425 | POWER_SUPPLY_PROP_CHARGE_NOW, | ||
344 | POWER_SUPPLY_PROP_TEMP, | 426 | POWER_SUPPLY_PROP_TEMP, |
345 | POWER_SUPPLY_PROP_TEMP_AMBIENT, | 427 | POWER_SUPPLY_PROP_TEMP_AMBIENT, |
346 | POWER_SUPPLY_PROP_MANUFACTURER, | 428 | POWER_SUPPLY_PROP_MANUFACTURER, |
@@ -348,6 +430,27 @@ static enum power_supply_property olpc_bat_props[] = { | |||
348 | POWER_SUPPLY_PROP_CHARGE_COUNTER, | 430 | POWER_SUPPLY_PROP_CHARGE_COUNTER, |
349 | }; | 431 | }; |
350 | 432 | ||
433 | /* XO-1.5 does not have ambient temperature property */ | ||
434 | static enum power_supply_property olpc_xo15_bat_props[] = { | ||
435 | POWER_SUPPLY_PROP_STATUS, | ||
436 | POWER_SUPPLY_PROP_CHARGE_TYPE, | ||
437 | POWER_SUPPLY_PROP_PRESENT, | ||
438 | POWER_SUPPLY_PROP_HEALTH, | ||
439 | POWER_SUPPLY_PROP_TECHNOLOGY, | ||
440 | POWER_SUPPLY_PROP_VOLTAGE_AVG, | ||
441 | POWER_SUPPLY_PROP_VOLTAGE_NOW, | ||
442 | POWER_SUPPLY_PROP_CURRENT_AVG, | ||
443 | POWER_SUPPLY_PROP_CURRENT_NOW, | ||
444 | POWER_SUPPLY_PROP_CAPACITY, | ||
445 | POWER_SUPPLY_PROP_CAPACITY_LEVEL, | ||
446 | POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN, | ||
447 | POWER_SUPPLY_PROP_CHARGE_NOW, | ||
448 | POWER_SUPPLY_PROP_TEMP, | ||
449 | POWER_SUPPLY_PROP_MANUFACTURER, | ||
450 | POWER_SUPPLY_PROP_SERIAL_NUMBER, | ||
451 | POWER_SUPPLY_PROP_CHARGE_COUNTER, | ||
452 | }; | ||
453 | |||
351 | /* EEPROM reading goes completely around the power_supply API, sadly */ | 454 | /* EEPROM reading goes completely around the power_supply API, sadly */ |
352 | 455 | ||
353 | #define EEPROM_START 0x20 | 456 | #define EEPROM_START 0x20 |
@@ -419,8 +522,6 @@ static struct device_attribute olpc_bat_error = { | |||
419 | static struct platform_device *bat_pdev; | 522 | static struct platform_device *bat_pdev; |
420 | 523 | ||
421 | static struct power_supply olpc_bat = { | 524 | static struct power_supply olpc_bat = { |
422 | .properties = olpc_bat_props, | ||
423 | .num_properties = ARRAY_SIZE(olpc_bat_props), | ||
424 | .get_property = olpc_bat_get_property, | 525 | .get_property = olpc_bat_get_property, |
425 | .use_for_apm = 1, | 526 | .use_for_apm = 1, |
426 | }; | 527 | }; |
@@ -466,6 +567,13 @@ static int __init olpc_bat_init(void) | |||
466 | goto ac_failed; | 567 | goto ac_failed; |
467 | 568 | ||
468 | olpc_bat.name = bat_pdev->name; | 569 | olpc_bat.name = bat_pdev->name; |
570 | if (olpc_board_at_least(olpc_board_pre(0xd0))) { /* XO-1.5 */ | ||
571 | olpc_bat.properties = olpc_xo15_bat_props; | ||
572 | olpc_bat.num_properties = ARRAY_SIZE(olpc_xo15_bat_props); | ||
573 | } else { /* XO-1 */ | ||
574 | olpc_bat.properties = olpc_xo1_bat_props; | ||
575 | olpc_bat.num_properties = ARRAY_SIZE(olpc_xo1_bat_props); | ||
576 | } | ||
469 | 577 | ||
470 | ret = power_supply_register(&bat_pdev->dev, &olpc_bat); | 578 | ret = power_supply_register(&bat_pdev->dev, &olpc_bat); |
471 | if (ret) | 579 | if (ret) |
diff --git a/drivers/power/power_supply_core.c b/drivers/power/power_supply_core.c index 91606bb55318..970f7335d3a7 100644 --- a/drivers/power/power_supply_core.c +++ b/drivers/power/power_supply_core.c | |||
@@ -190,10 +190,10 @@ int power_supply_register(struct device *parent, struct power_supply *psy) | |||
190 | goto success; | 190 | goto success; |
191 | 191 | ||
192 | create_triggers_failed: | 192 | create_triggers_failed: |
193 | device_unregister(psy->dev); | 193 | device_del(dev); |
194 | kobject_set_name_failed: | 194 | kobject_set_name_failed: |
195 | device_add_failed: | 195 | device_add_failed: |
196 | kfree(dev); | 196 | put_device(dev); |
197 | success: | 197 | success: |
198 | return rc; | 198 | return rc; |
199 | } | 199 | } |
@@ -201,7 +201,7 @@ EXPORT_SYMBOL_GPL(power_supply_register); | |||
201 | 201 | ||
202 | void power_supply_unregister(struct power_supply *psy) | 202 | void power_supply_unregister(struct power_supply *psy) |
203 | { | 203 | { |
204 | flush_scheduled_work(); | 204 | cancel_work_sync(&psy->changed_work); |
205 | power_supply_remove_triggers(psy); | 205 | power_supply_remove_triggers(psy); |
206 | device_unregister(psy->dev); | 206 | device_unregister(psy->dev); |
207 | } | 207 | } |
diff --git a/drivers/power/s3c_adc_battery.c b/drivers/power/s3c_adc_battery.c index 4a8ae3935b3b..4255f2358b13 100644 --- a/drivers/power/s3c_adc_battery.c +++ b/drivers/power/s3c_adc_battery.c | |||
@@ -112,6 +112,13 @@ static int calc_full_volt(int volt_val, int cur_val, int impedance) | |||
112 | return volt_val + cur_val * impedance / 1000; | 112 | return volt_val + cur_val * impedance / 1000; |
113 | } | 113 | } |
114 | 114 | ||
115 | static int charge_finished(struct s3c_adc_bat *bat) | ||
116 | { | ||
117 | return bat->pdata->gpio_inverted ? | ||
118 | !gpio_get_value(bat->pdata->gpio_charge_finished) : | ||
119 | gpio_get_value(bat->pdata->gpio_charge_finished); | ||
120 | } | ||
121 | |||
115 | static int s3c_adc_bat_get_property(struct power_supply *psy, | 122 | static int s3c_adc_bat_get_property(struct power_supply *psy, |
116 | enum power_supply_property psp, | 123 | enum power_supply_property psp, |
117 | union power_supply_propval *val) | 124 | union power_supply_propval *val) |
@@ -140,7 +147,7 @@ static int s3c_adc_bat_get_property(struct power_supply *psy, | |||
140 | 147 | ||
141 | if (bat->cable_plugged && | 148 | if (bat->cable_plugged && |
142 | ((bat->pdata->gpio_charge_finished < 0) || | 149 | ((bat->pdata->gpio_charge_finished < 0) || |
143 | !gpio_get_value(bat->pdata->gpio_charge_finished))) { | 150 | !charge_finished(bat))) { |
144 | lut = bat->pdata->lut_acin; | 151 | lut = bat->pdata->lut_acin; |
145 | lut_size = bat->pdata->lut_acin_cnt; | 152 | lut_size = bat->pdata->lut_acin_cnt; |
146 | } | 153 | } |
@@ -236,8 +243,7 @@ static void s3c_adc_bat_work(struct work_struct *work) | |||
236 | } | 243 | } |
237 | } else { | 244 | } else { |
238 | if ((bat->pdata->gpio_charge_finished >= 0) && is_plugged) { | 245 | if ((bat->pdata->gpio_charge_finished >= 0) && is_plugged) { |
239 | is_charged = gpio_get_value( | 246 | is_charged = charge_finished(&main_bat); |
240 | main_bat.pdata->gpio_charge_finished); | ||
241 | if (is_charged) { | 247 | if (is_charged) { |
242 | if (bat->pdata->disable_charger) | 248 | if (bat->pdata->disable_charger) |
243 | bat->pdata->disable_charger(); | 249 | bat->pdata->disable_charger(); |
diff --git a/drivers/power/tosa_battery.c b/drivers/power/tosa_battery.c index ee04936b2db5..53f0d3524fcd 100644 --- a/drivers/power/tosa_battery.c +++ b/drivers/power/tosa_battery.c | |||
@@ -332,7 +332,7 @@ static struct { | |||
332 | static int tosa_bat_suspend(struct platform_device *dev, pm_message_t state) | 332 | static int tosa_bat_suspend(struct platform_device *dev, pm_message_t state) |
333 | { | 333 | { |
334 | /* flush all pending status updates */ | 334 | /* flush all pending status updates */ |
335 | flush_scheduled_work(); | 335 | flush_work_sync(&bat_work); |
336 | return 0; | 336 | return 0; |
337 | } | 337 | } |
338 | 338 | ||
@@ -422,7 +422,7 @@ err_psy_reg_jacket: | |||
422 | err_psy_reg_main: | 422 | err_psy_reg_main: |
423 | 423 | ||
424 | /* see comment in tosa_bat_remove */ | 424 | /* see comment in tosa_bat_remove */ |
425 | flush_scheduled_work(); | 425 | cancel_work_sync(&bat_work); |
426 | 426 | ||
427 | i--; | 427 | i--; |
428 | err_gpio: | 428 | err_gpio: |
@@ -445,12 +445,11 @@ static int __devexit tosa_bat_remove(struct platform_device *dev) | |||
445 | power_supply_unregister(&tosa_bat_main.psy); | 445 | power_supply_unregister(&tosa_bat_main.psy); |
446 | 446 | ||
447 | /* | 447 | /* |
448 | * now flush all pending work. | 448 | * Now cancel the bat_work. We won't get any more schedules, |
449 | * we won't get any more schedules, since all | 449 | * since all sources (isr and external_power_changed) are |
450 | * sources (isr and external_power_changed) | 450 | * unregistered now. |
451 | * are unregistered now. | ||
452 | */ | 451 | */ |
453 | flush_scheduled_work(); | 452 | cancel_work_sync(&bat_work); |
454 | 453 | ||
455 | for (i = ARRAY_SIZE(gpios) - 1; i >= 0; i--) | 454 | for (i = ARRAY_SIZE(gpios) - 1; i >= 0; i--) |
456 | gpio_free(gpios[i].gpio); | 455 | gpio_free(gpios[i].gpio); |
diff --git a/drivers/power/wm97xx_battery.c b/drivers/power/wm97xx_battery.c index 5071d85ec12d..156559e56fa5 100644 --- a/drivers/power/wm97xx_battery.c +++ b/drivers/power/wm97xx_battery.c | |||
@@ -147,7 +147,7 @@ static irqreturn_t wm97xx_chrg_irq(int irq, void *data) | |||
147 | #ifdef CONFIG_PM | 147 | #ifdef CONFIG_PM |
148 | static int wm97xx_bat_suspend(struct device *dev) | 148 | static int wm97xx_bat_suspend(struct device *dev) |
149 | { | 149 | { |
150 | flush_scheduled_work(); | 150 | flush_work_sync(&bat_work); |
151 | return 0; | 151 | return 0; |
152 | } | 152 | } |
153 | 153 | ||
@@ -273,7 +273,7 @@ static int __devexit wm97xx_bat_remove(struct platform_device *dev) | |||
273 | free_irq(gpio_to_irq(pdata->charge_gpio), dev); | 273 | free_irq(gpio_to_irq(pdata->charge_gpio), dev); |
274 | gpio_free(pdata->charge_gpio); | 274 | gpio_free(pdata->charge_gpio); |
275 | } | 275 | } |
276 | flush_scheduled_work(); | 276 | cancel_work_sync(&bat_work); |
277 | power_supply_unregister(&bat_ps); | 277 | power_supply_unregister(&bat_ps); |
278 | kfree(prop); | 278 | kfree(prop); |
279 | return 0; | 279 | return 0; |
diff --git a/drivers/power/z2_battery.c b/drivers/power/z2_battery.c index 85064a9f649e..e5ed52d71937 100644 --- a/drivers/power/z2_battery.c +++ b/drivers/power/z2_battery.c | |||
@@ -254,7 +254,7 @@ static int __devexit z2_batt_remove(struct i2c_client *client) | |||
254 | struct z2_charger *charger = i2c_get_clientdata(client); | 254 | struct z2_charger *charger = i2c_get_clientdata(client); |
255 | struct z2_battery_info *info = charger->info; | 255 | struct z2_battery_info *info = charger->info; |
256 | 256 | ||
257 | flush_scheduled_work(); | 257 | cancel_work_sync(&charger->bat_work); |
258 | power_supply_unregister(&charger->batt_ps); | 258 | power_supply_unregister(&charger->batt_ps); |
259 | 259 | ||
260 | kfree(charger->batt_ps.properties); | 260 | kfree(charger->batt_ps.properties); |
@@ -271,7 +271,9 @@ static int __devexit z2_batt_remove(struct i2c_client *client) | |||
271 | #ifdef CONFIG_PM | 271 | #ifdef CONFIG_PM |
272 | static int z2_batt_suspend(struct i2c_client *client, pm_message_t state) | 272 | static int z2_batt_suspend(struct i2c_client *client, pm_message_t state) |
273 | { | 273 | { |
274 | flush_scheduled_work(); | 274 | struct z2_charger *charger = i2c_get_clientdata(client); |
275 | |||
276 | flush_work_sync(&charger->bat_work); | ||
275 | return 0; | 277 | return 0; |
276 | } | 278 | } |
277 | 279 | ||
diff --git a/drivers/regulator/max8998.c b/drivers/regulator/max8998.c index 7568df6122ab..0ec49ca527a8 100644 --- a/drivers/regulator/max8998.c +++ b/drivers/regulator/max8998.c | |||
@@ -424,6 +424,9 @@ static int max8998_set_voltage_buck(struct regulator_dev *rdev, | |||
424 | } | 424 | } |
425 | } | 425 | } |
426 | 426 | ||
427 | if (pdata->buck_voltage_lock) | ||
428 | return -EINVAL; | ||
429 | |||
427 | /* no predefine regulator found */ | 430 | /* no predefine regulator found */ |
428 | max8998->buck1_idx = (buck1_last_val % 2) + 2; | 431 | max8998->buck1_idx = (buck1_last_val % 2) + 2; |
429 | dev_dbg(max8998->dev, "max8998->buck1_idx:%d\n", | 432 | dev_dbg(max8998->dev, "max8998->buck1_idx:%d\n", |
@@ -451,18 +454,26 @@ buck1_exit: | |||
451 | "BUCK2, i:%d buck2_vol1:%d, buck2_vol2:%d\n" | 454 | "BUCK2, i:%d buck2_vol1:%d, buck2_vol2:%d\n" |
452 | , i, max8998->buck2_vol[0], max8998->buck2_vol[1]); | 455 | , i, max8998->buck2_vol[0], max8998->buck2_vol[1]); |
453 | if (gpio_is_valid(pdata->buck2_set3)) { | 456 | if (gpio_is_valid(pdata->buck2_set3)) { |
454 | if (max8998->buck2_vol[0] == i) { | 457 | |
455 | max8998->buck1_idx = 0; | 458 | /* check if requested voltage */ |
456 | buck2_gpio_set(pdata->buck2_set3, 0); | 459 | /* value is already defined */ |
457 | } else { | 460 | for (j = 0; j < ARRAY_SIZE(max8998->buck2_vol); j++) { |
458 | max8998->buck1_idx = 1; | 461 | if (max8998->buck2_vol[j] == i) { |
459 | ret = max8998_get_voltage_register(rdev, ®, | 462 | max8998->buck2_idx = j; |
460 | &shift, | 463 | buck2_gpio_set(pdata->buck2_set3, j); |
461 | &mask); | 464 | goto buck2_exit; |
462 | ret = max8998_write_reg(i2c, reg, i); | 465 | } |
463 | max8998->buck2_vol[1] = i; | ||
464 | buck2_gpio_set(pdata->buck2_set3, 1); | ||
465 | } | 466 | } |
467 | |||
468 | if (pdata->buck_voltage_lock) | ||
469 | return -EINVAL; | ||
470 | |||
471 | max8998_get_voltage_register(rdev, | ||
472 | ®, &shift, &mask); | ||
473 | ret = max8998_write_reg(i2c, reg, i); | ||
474 | max8998->buck2_vol[max8998->buck2_idx] = i; | ||
475 | buck2_gpio_set(pdata->buck2_set3, max8998->buck2_idx); | ||
476 | buck2_exit: | ||
466 | dev_dbg(max8998->dev, "%s: SET3:%d\n", i2c->name, | 477 | dev_dbg(max8998->dev, "%s: SET3:%d\n", i2c->name, |
467 | gpio_get_value(pdata->buck2_set3)); | 478 | gpio_get_value(pdata->buck2_set3)); |
468 | } else { | 479 | } else { |
@@ -707,6 +718,9 @@ static __devinit int max8998_pmic_probe(struct platform_device *pdev) | |||
707 | platform_set_drvdata(pdev, max8998); | 718 | platform_set_drvdata(pdev, max8998); |
708 | i2c = max8998->iodev->i2c; | 719 | i2c = max8998->iodev->i2c; |
709 | 720 | ||
721 | max8998->buck1_idx = pdata->buck1_default_idx; | ||
722 | max8998->buck2_idx = pdata->buck2_default_idx; | ||
723 | |||
710 | /* NOTE: */ | 724 | /* NOTE: */ |
711 | /* For unused GPIO NOT marked as -1 (thereof equal to 0) WARN_ON */ | 725 | /* For unused GPIO NOT marked as -1 (thereof equal to 0) WARN_ON */ |
712 | /* will be displayed */ | 726 | /* will be displayed */ |
@@ -739,23 +753,46 @@ static __devinit int max8998_pmic_probe(struct platform_device *pdev) | |||
739 | i = 0; | 753 | i = 0; |
740 | while (buck12_voltage_map_desc.min + | 754 | while (buck12_voltage_map_desc.min + |
741 | buck12_voltage_map_desc.step*i | 755 | buck12_voltage_map_desc.step*i |
742 | != (pdata->buck1_max_voltage1 / 1000)) | 756 | < (pdata->buck1_voltage1 / 1000)) |
743 | i++; | 757 | i++; |
744 | printk(KERN_ERR "i:%d, buck1_idx:%d\n", i, max8998->buck1_idx); | ||
745 | max8998->buck1_vol[0] = i; | 758 | max8998->buck1_vol[0] = i; |
746 | ret = max8998_write_reg(i2c, MAX8998_REG_BUCK1_VOLTAGE1, i); | 759 | ret = max8998_write_reg(i2c, MAX8998_REG_BUCK1_VOLTAGE1, i); |
760 | if (ret) | ||
761 | return ret; | ||
747 | 762 | ||
748 | /* Set predefined value for BUCK1 register 2 */ | 763 | /* Set predefined value for BUCK1 register 2 */ |
749 | i = 0; | 764 | i = 0; |
750 | while (buck12_voltage_map_desc.min + | 765 | while (buck12_voltage_map_desc.min + |
751 | buck12_voltage_map_desc.step*i | 766 | buck12_voltage_map_desc.step*i |
752 | != (pdata->buck1_max_voltage2 / 1000)) | 767 | < (pdata->buck1_voltage2 / 1000)) |
753 | i++; | 768 | i++; |
754 | 769 | ||
755 | max8998->buck1_vol[1] = i; | 770 | max8998->buck1_vol[1] = i; |
756 | printk(KERN_ERR "i:%d, buck1_idx:%d\n", i, max8998->buck1_idx); | 771 | ret = max8998_write_reg(i2c, MAX8998_REG_BUCK1_VOLTAGE2, i); |
757 | ret = max8998_write_reg(i2c, MAX8998_REG_BUCK1_VOLTAGE2, i) | 772 | if (ret) |
758 | + ret; | 773 | return ret; |
774 | |||
775 | /* Set predefined value for BUCK1 register 3 */ | ||
776 | i = 0; | ||
777 | while (buck12_voltage_map_desc.min + | ||
778 | buck12_voltage_map_desc.step*i | ||
779 | < (pdata->buck1_voltage3 / 1000)) | ||
780 | i++; | ||
781 | |||
782 | max8998->buck1_vol[2] = i; | ||
783 | ret = max8998_write_reg(i2c, MAX8998_REG_BUCK1_VOLTAGE3, i); | ||
784 | if (ret) | ||
785 | return ret; | ||
786 | |||
787 | /* Set predefined value for BUCK1 register 4 */ | ||
788 | i = 0; | ||
789 | while (buck12_voltage_map_desc.min + | ||
790 | buck12_voltage_map_desc.step*i | ||
791 | < (pdata->buck1_voltage4 / 1000)) | ||
792 | i++; | ||
793 | |||
794 | max8998->buck1_vol[3] = i; | ||
795 | ret = max8998_write_reg(i2c, MAX8998_REG_BUCK1_VOLTAGE4, i); | ||
759 | if (ret) | 796 | if (ret) |
760 | return ret; | 797 | return ret; |
761 | 798 | ||
@@ -772,18 +809,28 @@ static __devinit int max8998_pmic_probe(struct platform_device *pdev) | |||
772 | gpio_direction_output(pdata->buck2_set3, | 809 | gpio_direction_output(pdata->buck2_set3, |
773 | max8998->buck2_idx & 0x1); | 810 | max8998->buck2_idx & 0x1); |
774 | 811 | ||
775 | /* BUCK2 - set preset default voltage value to buck2_vol[0] */ | 812 | /* BUCK2 register 1 */ |
776 | i = 0; | 813 | i = 0; |
777 | while (buck12_voltage_map_desc.min + | 814 | while (buck12_voltage_map_desc.min + |
778 | buck12_voltage_map_desc.step*i | 815 | buck12_voltage_map_desc.step*i |
779 | != (pdata->buck2_max_voltage / 1000)) | 816 | < (pdata->buck2_voltage1 / 1000)) |
780 | i++; | 817 | i++; |
781 | printk(KERN_ERR "i:%d, buck2_idx:%d\n", i, max8998->buck2_idx); | ||
782 | max8998->buck2_vol[0] = i; | 818 | max8998->buck2_vol[0] = i; |
783 | ret = max8998_write_reg(i2c, MAX8998_REG_BUCK2_VOLTAGE1, i); | 819 | ret = max8998_write_reg(i2c, MAX8998_REG_BUCK2_VOLTAGE1, i); |
784 | if (ret) | 820 | if (ret) |
785 | return ret; | 821 | return ret; |
786 | 822 | ||
823 | /* BUCK2 register 2 */ | ||
824 | i = 0; | ||
825 | while (buck12_voltage_map_desc.min + | ||
826 | buck12_voltage_map_desc.step*i | ||
827 | < (pdata->buck2_voltage2 / 1000)) | ||
828 | i++; | ||
829 | printk(KERN_ERR "i2:%d, buck2_idx:%d\n", i, max8998->buck2_idx); | ||
830 | max8998->buck2_vol[1] = i; | ||
831 | ret = max8998_write_reg(i2c, MAX8998_REG_BUCK2_VOLTAGE2, i); | ||
832 | if (ret) | ||
833 | return ret; | ||
787 | } | 834 | } |
788 | 835 | ||
789 | for (i = 0; i < pdata->num_regulators; i++) { | 836 | for (i = 0; i < pdata->num_regulators; i++) { |
@@ -835,6 +882,12 @@ static int __devexit max8998_pmic_remove(struct platform_device *pdev) | |||
835 | return 0; | 882 | return 0; |
836 | } | 883 | } |
837 | 884 | ||
885 | static const struct platform_device_id max8998_pmic_id[] = { | ||
886 | { "max8998-pmic", TYPE_MAX8998 }, | ||
887 | { "lp3974-pmic", TYPE_LP3974 }, | ||
888 | { } | ||
889 | }; | ||
890 | |||
838 | static struct platform_driver max8998_pmic_driver = { | 891 | static struct platform_driver max8998_pmic_driver = { |
839 | .driver = { | 892 | .driver = { |
840 | .name = "max8998-pmic", | 893 | .name = "max8998-pmic", |
@@ -842,6 +895,7 @@ static struct platform_driver max8998_pmic_driver = { | |||
842 | }, | 895 | }, |
843 | .probe = max8998_pmic_probe, | 896 | .probe = max8998_pmic_probe, |
844 | .remove = __devexit_p(max8998_pmic_remove), | 897 | .remove = __devexit_p(max8998_pmic_remove), |
898 | .id_table = max8998_pmic_id, | ||
845 | }; | 899 | }; |
846 | 900 | ||
847 | static int __init max8998_pmic_init(void) | 901 | static int __init max8998_pmic_init(void) |
diff --git a/drivers/rtc/rtc-max8998.c b/drivers/rtc/rtc-max8998.c index f22dee35f330..3f7bc6b9fefa 100644 --- a/drivers/rtc/rtc-max8998.c +++ b/drivers/rtc/rtc-max8998.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/platform_device.h> | 20 | #include <linux/platform_device.h> |
21 | #include <linux/mfd/max8998.h> | 21 | #include <linux/mfd/max8998.h> |
22 | #include <linux/mfd/max8998-private.h> | 22 | #include <linux/mfd/max8998-private.h> |
23 | #include <linux/delay.h> | ||
23 | 24 | ||
24 | #define MAX8998_RTC_SEC 0x00 | 25 | #define MAX8998_RTC_SEC 0x00 |
25 | #define MAX8998_RTC_MIN 0x01 | 26 | #define MAX8998_RTC_MIN 0x01 |
@@ -73,6 +74,7 @@ struct max8998_rtc_info { | |||
73 | struct i2c_client *rtc; | 74 | struct i2c_client *rtc; |
74 | struct rtc_device *rtc_dev; | 75 | struct rtc_device *rtc_dev; |
75 | int irq; | 76 | int irq; |
77 | bool lp3974_bug_workaround; | ||
76 | }; | 78 | }; |
77 | 79 | ||
78 | static void max8998_data_to_tm(u8 *data, struct rtc_time *tm) | 80 | static void max8998_data_to_tm(u8 *data, struct rtc_time *tm) |
@@ -124,10 +126,16 @@ static int max8998_rtc_set_time(struct device *dev, struct rtc_time *tm) | |||
124 | { | 126 | { |
125 | struct max8998_rtc_info *info = dev_get_drvdata(dev); | 127 | struct max8998_rtc_info *info = dev_get_drvdata(dev); |
126 | u8 data[8]; | 128 | u8 data[8]; |
129 | int ret; | ||
127 | 130 | ||
128 | max8998_tm_to_data(tm, data); | 131 | max8998_tm_to_data(tm, data); |
129 | 132 | ||
130 | return max8998_bulk_write(info->rtc, MAX8998_RTC_SEC, 8, data); | 133 | ret = max8998_bulk_write(info->rtc, MAX8998_RTC_SEC, 8, data); |
134 | |||
135 | if (info->lp3974_bug_workaround) | ||
136 | msleep(2000); | ||
137 | |||
138 | return ret; | ||
131 | } | 139 | } |
132 | 140 | ||
133 | static int max8998_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm) | 141 | static int max8998_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm) |
@@ -163,12 +171,29 @@ static int max8998_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm) | |||
163 | 171 | ||
164 | static int max8998_rtc_stop_alarm(struct max8998_rtc_info *info) | 172 | static int max8998_rtc_stop_alarm(struct max8998_rtc_info *info) |
165 | { | 173 | { |
166 | return max8998_write_reg(info->rtc, MAX8998_ALARM0_CONF, 0); | 174 | int ret = max8998_write_reg(info->rtc, MAX8998_ALARM0_CONF, 0); |
175 | |||
176 | if (info->lp3974_bug_workaround) | ||
177 | msleep(2000); | ||
178 | |||
179 | return ret; | ||
167 | } | 180 | } |
168 | 181 | ||
169 | static int max8998_rtc_start_alarm(struct max8998_rtc_info *info) | 182 | static int max8998_rtc_start_alarm(struct max8998_rtc_info *info) |
170 | { | 183 | { |
171 | return max8998_write_reg(info->rtc, MAX8998_ALARM0_CONF, 0x77); | 184 | int ret; |
185 | u8 alarm0_conf = 0x77; | ||
186 | |||
187 | /* LP3974 with delay bug chips has rtc alarm bugs with "MONTH" field */ | ||
188 | if (info->lp3974_bug_workaround) | ||
189 | alarm0_conf = 0x57; | ||
190 | |||
191 | ret = max8998_write_reg(info->rtc, MAX8998_ALARM0_CONF, alarm0_conf); | ||
192 | |||
193 | if (info->lp3974_bug_workaround) | ||
194 | msleep(2000); | ||
195 | |||
196 | return ret; | ||
172 | } | 197 | } |
173 | 198 | ||
174 | static int max8998_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm) | 199 | static int max8998_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm) |
@@ -187,10 +212,13 @@ static int max8998_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm) | |||
187 | if (ret < 0) | 212 | if (ret < 0) |
188 | return ret; | 213 | return ret; |
189 | 214 | ||
215 | if (info->lp3974_bug_workaround) | ||
216 | msleep(2000); | ||
217 | |||
190 | if (alrm->enabled) | 218 | if (alrm->enabled) |
191 | return max8998_rtc_start_alarm(info); | 219 | ret = max8998_rtc_start_alarm(info); |
192 | 220 | ||
193 | return 0; | 221 | return ret; |
194 | } | 222 | } |
195 | 223 | ||
196 | static int max8998_rtc_alarm_irq_enable(struct device *dev, | 224 | static int max8998_rtc_alarm_irq_enable(struct device *dev, |
@@ -224,6 +252,7 @@ static const struct rtc_class_ops max8998_rtc_ops = { | |||
224 | static int __devinit max8998_rtc_probe(struct platform_device *pdev) | 252 | static int __devinit max8998_rtc_probe(struct platform_device *pdev) |
225 | { | 253 | { |
226 | struct max8998_dev *max8998 = dev_get_drvdata(pdev->dev.parent); | 254 | struct max8998_dev *max8998 = dev_get_drvdata(pdev->dev.parent); |
255 | struct max8998_platform_data *pdata = dev_get_platdata(max8998->dev); | ||
227 | struct max8998_rtc_info *info; | 256 | struct max8998_rtc_info *info; |
228 | int ret; | 257 | int ret; |
229 | 258 | ||
@@ -249,10 +278,18 @@ static int __devinit max8998_rtc_probe(struct platform_device *pdev) | |||
249 | 278 | ||
250 | ret = request_threaded_irq(info->irq, NULL, max8998_rtc_alarm_irq, 0, | 279 | ret = request_threaded_irq(info->irq, NULL, max8998_rtc_alarm_irq, 0, |
251 | "rtc-alarm0", info); | 280 | "rtc-alarm0", info); |
281 | |||
252 | if (ret < 0) | 282 | if (ret < 0) |
253 | dev_err(&pdev->dev, "Failed to request alarm IRQ: %d: %d\n", | 283 | dev_err(&pdev->dev, "Failed to request alarm IRQ: %d: %d\n", |
254 | info->irq, ret); | 284 | info->irq, ret); |
255 | 285 | ||
286 | dev_info(&pdev->dev, "RTC CHIP NAME: %s\n", pdev->id_entry->name); | ||
287 | if (pdata->rtc_delay) { | ||
288 | info->lp3974_bug_workaround = true; | ||
289 | dev_warn(&pdev->dev, "LP3974 with RTC REGERR option." | ||
290 | " RTC updates will be extremely slow.\n"); | ||
291 | } | ||
292 | |||
256 | return 0; | 293 | return 0; |
257 | 294 | ||
258 | out_rtc: | 295 | out_rtc: |
@@ -273,6 +310,12 @@ static int __devexit max8998_rtc_remove(struct platform_device *pdev) | |||
273 | return 0; | 310 | return 0; |
274 | } | 311 | } |
275 | 312 | ||
313 | static const struct platform_device_id max8998_rtc_id[] = { | ||
314 | { "max8998-rtc", TYPE_MAX8998 }, | ||
315 | { "lp3974-rtc", TYPE_LP3974 }, | ||
316 | { } | ||
317 | }; | ||
318 | |||
276 | static struct platform_driver max8998_rtc_driver = { | 319 | static struct platform_driver max8998_rtc_driver = { |
277 | .driver = { | 320 | .driver = { |
278 | .name = "max8998-rtc", | 321 | .name = "max8998-rtc", |
@@ -280,6 +323,7 @@ static struct platform_driver max8998_rtc_driver = { | |||
280 | }, | 323 | }, |
281 | .probe = max8998_rtc_probe, | 324 | .probe = max8998_rtc_probe, |
282 | .remove = __devexit_p(max8998_rtc_remove), | 325 | .remove = __devexit_p(max8998_rtc_remove), |
326 | .id_table = max8998_rtc_id, | ||
283 | }; | 327 | }; |
284 | 328 | ||
285 | static int __init max8998_rtc_init(void) | 329 | static int __init max8998_rtc_init(void) |
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c index e8391b89eff4..b7eaff9ca19e 100644 --- a/drivers/s390/cio/device.c +++ b/drivers/s390/cio/device.c | |||
@@ -1835,6 +1835,7 @@ static void __ccw_device_pm_restore(struct ccw_device *cdev) | |||
1835 | * available again. Kick re-detection. | 1835 | * available again. Kick re-detection. |
1836 | */ | 1836 | */ |
1837 | cdev->private->flags.resuming = 1; | 1837 | cdev->private->flags.resuming = 1; |
1838 | cdev->private->path_new_mask = LPM_ANYPATH; | ||
1838 | css_schedule_eval(sch->schid); | 1839 | css_schedule_eval(sch->schid); |
1839 | spin_unlock_irq(sch->lock); | 1840 | spin_unlock_irq(sch->lock); |
1840 | css_complete_work(); | 1841 | css_complete_work(); |
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c index d3c5905b22ec..9c5c8be72231 100644 --- a/drivers/scsi/ipr.c +++ b/drivers/scsi/ipr.c | |||
@@ -7515,16 +7515,10 @@ static int ipr_reset_restore_cfg_space(struct ipr_cmnd *ipr_cmd) | |||
7515 | { | 7515 | { |
7516 | struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; | 7516 | struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; |
7517 | volatile u32 int_reg; | 7517 | volatile u32 int_reg; |
7518 | int rc; | ||
7519 | 7518 | ||
7520 | ENTER; | 7519 | ENTER; |
7521 | ioa_cfg->pdev->state_saved = true; | 7520 | ioa_cfg->pdev->state_saved = true; |
7522 | rc = pci_restore_state(ioa_cfg->pdev); | 7521 | pci_restore_state(ioa_cfg->pdev); |
7523 | |||
7524 | if (rc != PCIBIOS_SUCCESSFUL) { | ||
7525 | ipr_cmd->s.ioasa.hdr.ioasc = cpu_to_be32(IPR_IOASC_PCI_ACCESS_ERROR); | ||
7526 | return IPR_RC_JOB_CONTINUE; | ||
7527 | } | ||
7528 | 7522 | ||
7529 | if (ipr_set_pcix_cmd_reg(ioa_cfg)) { | 7523 | if (ipr_set_pcix_cmd_reg(ioa_cfg)) { |
7530 | ipr_cmd->s.ioasa.hdr.ioasc = cpu_to_be32(IPR_IOASC_PCI_ACCESS_ERROR); | 7524 | ipr_cmd->s.ioasa.hdr.ioasc = cpu_to_be32(IPR_IOASC_PCI_ACCESS_ERROR); |
diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c index 300d59f389da..321cf3ae8630 100644 --- a/drivers/scsi/pmcraid.c +++ b/drivers/scsi/pmcraid.c | |||
@@ -2228,12 +2228,7 @@ static void pmcraid_ioa_reset(struct pmcraid_cmd *cmd) | |||
2228 | /* Once either bist or pci reset is done, restore PCI config | 2228 | /* Once either bist or pci reset is done, restore PCI config |
2229 | * space. If this fails, proceed with hard reset again | 2229 | * space. If this fails, proceed with hard reset again |
2230 | */ | 2230 | */ |
2231 | if (pci_restore_state(pinstance->pdev)) { | 2231 | pci_restore_state(pinstance->pdev); |
2232 | pmcraid_info("config-space error resetting again\n"); | ||
2233 | pinstance->ioa_state = IOA_STATE_IN_RESET_ALERT; | ||
2234 | pmcraid_reset_alert(cmd); | ||
2235 | break; | ||
2236 | } | ||
2237 | 2232 | ||
2238 | /* fail all pending commands */ | 2233 | /* fail all pending commands */ |
2239 | pmcraid_fail_outstanding_cmds(pinstance); | 2234 | pmcraid_fail_outstanding_cmds(pinstance); |
diff --git a/drivers/staging/sm7xx/smtcfb.c b/drivers/staging/sm7xx/smtcfb.c index f4b163f7338a..0bc113c44d39 100644 --- a/drivers/staging/sm7xx/smtcfb.c +++ b/drivers/staging/sm7xx/smtcfb.c | |||
@@ -1071,7 +1071,7 @@ static int __maybe_unused smtcfb_resume(struct pci_dev *pdev) | |||
1071 | /* when resuming, restore pci data and fb cursor */ | 1071 | /* when resuming, restore pci data and fb cursor */ |
1072 | if (pdev->dev.power.power_state.event != PM_EVENT_FREEZE) { | 1072 | if (pdev->dev.power.power_state.event != PM_EVENT_FREEZE) { |
1073 | retv = pci_set_power_state(pdev, PCI_D0); | 1073 | retv = pci_set_power_state(pdev, PCI_D0); |
1074 | retv = pci_restore_state(pdev); | 1074 | pci_restore_state(pdev); |
1075 | if (pci_enable_device(pdev)) | 1075 | if (pci_enable_device(pdev)) |
1076 | return -1; | 1076 | return -1; |
1077 | pci_set_master(pdev); | 1077 | pci_set_master(pdev); |
diff --git a/fs/afs/cmservice.c b/fs/afs/cmservice.c index a3bcec75c54a..1c8c6cc6de30 100644 --- a/fs/afs/cmservice.c +++ b/fs/afs/cmservice.c | |||
@@ -289,7 +289,7 @@ static int afs_deliver_cb_callback(struct afs_call *call, struct sk_buff *skb, | |||
289 | call->server = server; | 289 | call->server = server; |
290 | 290 | ||
291 | INIT_WORK(&call->work, SRXAFSCB_CallBack); | 291 | INIT_WORK(&call->work, SRXAFSCB_CallBack); |
292 | schedule_work(&call->work); | 292 | queue_work(afs_wq, &call->work); |
293 | return 0; | 293 | return 0; |
294 | } | 294 | } |
295 | 295 | ||
@@ -336,7 +336,7 @@ static int afs_deliver_cb_init_call_back_state(struct afs_call *call, | |||
336 | call->server = server; | 336 | call->server = server; |
337 | 337 | ||
338 | INIT_WORK(&call->work, SRXAFSCB_InitCallBackState); | 338 | INIT_WORK(&call->work, SRXAFSCB_InitCallBackState); |
339 | schedule_work(&call->work); | 339 | queue_work(afs_wq, &call->work); |
340 | return 0; | 340 | return 0; |
341 | } | 341 | } |
342 | 342 | ||
@@ -367,7 +367,7 @@ static int afs_deliver_cb_init_call_back_state3(struct afs_call *call, | |||
367 | call->server = server; | 367 | call->server = server; |
368 | 368 | ||
369 | INIT_WORK(&call->work, SRXAFSCB_InitCallBackState); | 369 | INIT_WORK(&call->work, SRXAFSCB_InitCallBackState); |
370 | schedule_work(&call->work); | 370 | queue_work(afs_wq, &call->work); |
371 | return 0; | 371 | return 0; |
372 | } | 372 | } |
373 | 373 | ||
@@ -400,7 +400,7 @@ static int afs_deliver_cb_probe(struct afs_call *call, struct sk_buff *skb, | |||
400 | call->state = AFS_CALL_REPLYING; | 400 | call->state = AFS_CALL_REPLYING; |
401 | 401 | ||
402 | INIT_WORK(&call->work, SRXAFSCB_Probe); | 402 | INIT_WORK(&call->work, SRXAFSCB_Probe); |
403 | schedule_work(&call->work); | 403 | queue_work(afs_wq, &call->work); |
404 | return 0; | 404 | return 0; |
405 | } | 405 | } |
406 | 406 | ||
@@ -496,7 +496,7 @@ static int afs_deliver_cb_probe_uuid(struct afs_call *call, struct sk_buff *skb, | |||
496 | call->state = AFS_CALL_REPLYING; | 496 | call->state = AFS_CALL_REPLYING; |
497 | 497 | ||
498 | INIT_WORK(&call->work, SRXAFSCB_ProbeUuid); | 498 | INIT_WORK(&call->work, SRXAFSCB_ProbeUuid); |
499 | schedule_work(&call->work); | 499 | queue_work(afs_wq, &call->work); |
500 | return 0; | 500 | return 0; |
501 | } | 501 | } |
502 | 502 | ||
@@ -580,6 +580,6 @@ static int afs_deliver_cb_tell_me_about_yourself(struct afs_call *call, | |||
580 | call->state = AFS_CALL_REPLYING; | 580 | call->state = AFS_CALL_REPLYING; |
581 | 581 | ||
582 | INIT_WORK(&call->work, SRXAFSCB_TellMeAboutYourself); | 582 | INIT_WORK(&call->work, SRXAFSCB_TellMeAboutYourself); |
583 | schedule_work(&call->work); | 583 | queue_work(afs_wq, &call->work); |
584 | return 0; | 584 | return 0; |
585 | } | 585 | } |
diff --git a/fs/afs/internal.h b/fs/afs/internal.h index ab6db5abaf53..58c633b80246 100644 --- a/fs/afs/internal.h +++ b/fs/afs/internal.h | |||
@@ -577,6 +577,7 @@ extern int afs_drop_inode(struct inode *); | |||
577 | /* | 577 | /* |
578 | * main.c | 578 | * main.c |
579 | */ | 579 | */ |
580 | extern struct workqueue_struct *afs_wq; | ||
580 | extern struct afs_uuid afs_uuid; | 581 | extern struct afs_uuid afs_uuid; |
581 | 582 | ||
582 | /* | 583 | /* |
diff --git a/fs/afs/main.c b/fs/afs/main.c index cfd1cbe25b22..42dd2e499ed8 100644 --- a/fs/afs/main.c +++ b/fs/afs/main.c | |||
@@ -30,6 +30,7 @@ module_param(rootcell, charp, 0); | |||
30 | MODULE_PARM_DESC(rootcell, "root AFS cell name and VL server IP addr list"); | 30 | MODULE_PARM_DESC(rootcell, "root AFS cell name and VL server IP addr list"); |
31 | 31 | ||
32 | struct afs_uuid afs_uuid; | 32 | struct afs_uuid afs_uuid; |
33 | struct workqueue_struct *afs_wq; | ||
33 | 34 | ||
34 | /* | 35 | /* |
35 | * get a client UUID | 36 | * get a client UUID |
@@ -87,10 +88,16 @@ static int __init afs_init(void) | |||
87 | if (ret < 0) | 88 | if (ret < 0) |
88 | return ret; | 89 | return ret; |
89 | 90 | ||
91 | /* create workqueue */ | ||
92 | ret = -ENOMEM; | ||
93 | afs_wq = alloc_workqueue("afs", 0, 0); | ||
94 | if (!afs_wq) | ||
95 | return ret; | ||
96 | |||
90 | /* register the /proc stuff */ | 97 | /* register the /proc stuff */ |
91 | ret = afs_proc_init(); | 98 | ret = afs_proc_init(); |
92 | if (ret < 0) | 99 | if (ret < 0) |
93 | return ret; | 100 | goto error_proc; |
94 | 101 | ||
95 | #ifdef CONFIG_AFS_FSCACHE | 102 | #ifdef CONFIG_AFS_FSCACHE |
96 | /* we want to be able to cache */ | 103 | /* we want to be able to cache */ |
@@ -140,6 +147,8 @@ error_cell_init: | |||
140 | error_cache: | 147 | error_cache: |
141 | #endif | 148 | #endif |
142 | afs_proc_cleanup(); | 149 | afs_proc_cleanup(); |
150 | error_proc: | ||
151 | destroy_workqueue(afs_wq); | ||
143 | rcu_barrier(); | 152 | rcu_barrier(); |
144 | printk(KERN_ERR "kAFS: failed to register: %d\n", ret); | 153 | printk(KERN_ERR "kAFS: failed to register: %d\n", ret); |
145 | return ret; | 154 | return ret; |
@@ -163,7 +172,7 @@ static void __exit afs_exit(void) | |||
163 | afs_purge_servers(); | 172 | afs_purge_servers(); |
164 | afs_callback_update_kill(); | 173 | afs_callback_update_kill(); |
165 | afs_vlocation_purge(); | 174 | afs_vlocation_purge(); |
166 | flush_scheduled_work(); | 175 | destroy_workqueue(afs_wq); |
167 | afs_cell_purge(); | 176 | afs_cell_purge(); |
168 | #ifdef CONFIG_AFS_FSCACHE | 177 | #ifdef CONFIG_AFS_FSCACHE |
169 | fscache_unregister_netfs(&afs_cache_netfs); | 178 | fscache_unregister_netfs(&afs_cache_netfs); |
diff --git a/fs/afs/mntpt.c b/fs/afs/mntpt.c index 6153417caf57..e83c0336e7b5 100644 --- a/fs/afs/mntpt.c +++ b/fs/afs/mntpt.c | |||
@@ -268,8 +268,8 @@ static void *afs_mntpt_follow_link(struct dentry *dentry, struct nameidata *nd) | |||
268 | path_put(&nd->path); | 268 | path_put(&nd->path); |
269 | nd->path.mnt = newmnt; | 269 | nd->path.mnt = newmnt; |
270 | nd->path.dentry = dget(newmnt->mnt_root); | 270 | nd->path.dentry = dget(newmnt->mnt_root); |
271 | schedule_delayed_work(&afs_mntpt_expiry_timer, | 271 | queue_delayed_work(afs_wq, &afs_mntpt_expiry_timer, |
272 | afs_mntpt_expiry_timeout * HZ); | 272 | afs_mntpt_expiry_timeout * HZ); |
273 | break; | 273 | break; |
274 | case -EBUSY: | 274 | case -EBUSY: |
275 | /* someone else made a mount here whilst we were busy */ | 275 | /* someone else made a mount here whilst we were busy */ |
@@ -295,8 +295,8 @@ static void afs_mntpt_expiry_timed_out(struct work_struct *work) | |||
295 | 295 | ||
296 | if (!list_empty(&afs_vfsmounts)) { | 296 | if (!list_empty(&afs_vfsmounts)) { |
297 | mark_mounts_for_expiry(&afs_vfsmounts); | 297 | mark_mounts_for_expiry(&afs_vfsmounts); |
298 | schedule_delayed_work(&afs_mntpt_expiry_timer, | 298 | queue_delayed_work(afs_wq, &afs_mntpt_expiry_timer, |
299 | afs_mntpt_expiry_timeout * HZ); | 299 | afs_mntpt_expiry_timeout * HZ); |
300 | } | 300 | } |
301 | 301 | ||
302 | _leave(""); | 302 | _leave(""); |
@@ -310,6 +310,5 @@ void afs_mntpt_kill_timer(void) | |||
310 | _enter(""); | 310 | _enter(""); |
311 | 311 | ||
312 | ASSERT(list_empty(&afs_vfsmounts)); | 312 | ASSERT(list_empty(&afs_vfsmounts)); |
313 | cancel_delayed_work(&afs_mntpt_expiry_timer); | 313 | cancel_delayed_work_sync(&afs_mntpt_expiry_timer); |
314 | flush_scheduled_work(); | ||
315 | } | 314 | } |
diff --git a/fs/afs/rxrpc.c b/fs/afs/rxrpc.c index 654d8fdbf01f..e45a323aebb4 100644 --- a/fs/afs/rxrpc.c +++ b/fs/afs/rxrpc.c | |||
@@ -410,7 +410,7 @@ static void afs_rx_interceptor(struct sock *sk, unsigned long user_call_ID, | |||
410 | if (!call) { | 410 | if (!call) { |
411 | /* its an incoming call for our callback service */ | 411 | /* its an incoming call for our callback service */ |
412 | skb_queue_tail(&afs_incoming_calls, skb); | 412 | skb_queue_tail(&afs_incoming_calls, skb); |
413 | schedule_work(&afs_collect_incoming_call_work); | 413 | queue_work(afs_wq, &afs_collect_incoming_call_work); |
414 | } else { | 414 | } else { |
415 | /* route the messages directly to the appropriate call */ | 415 | /* route the messages directly to the appropriate call */ |
416 | skb_queue_tail(&call->rx_queue, skb); | 416 | skb_queue_tail(&call->rx_queue, skb); |
diff --git a/fs/afs/server.c b/fs/afs/server.c index 9fdc7fe3a7bc..d59b7516e943 100644 --- a/fs/afs/server.c +++ b/fs/afs/server.c | |||
@@ -238,8 +238,8 @@ void afs_put_server(struct afs_server *server) | |||
238 | if (atomic_read(&server->usage) == 0) { | 238 | if (atomic_read(&server->usage) == 0) { |
239 | list_move_tail(&server->grave, &afs_server_graveyard); | 239 | list_move_tail(&server->grave, &afs_server_graveyard); |
240 | server->time_of_death = get_seconds(); | 240 | server->time_of_death = get_seconds(); |
241 | schedule_delayed_work(&afs_server_reaper, | 241 | queue_delayed_work(afs_wq, &afs_server_reaper, |
242 | afs_server_timeout * HZ); | 242 | afs_server_timeout * HZ); |
243 | } | 243 | } |
244 | spin_unlock(&afs_server_graveyard_lock); | 244 | spin_unlock(&afs_server_graveyard_lock); |
245 | _leave(" [dead]"); | 245 | _leave(" [dead]"); |
@@ -285,10 +285,11 @@ static void afs_reap_server(struct work_struct *work) | |||
285 | expiry = server->time_of_death + afs_server_timeout; | 285 | expiry = server->time_of_death + afs_server_timeout; |
286 | if (expiry > now) { | 286 | if (expiry > now) { |
287 | delay = (expiry - now) * HZ; | 287 | delay = (expiry - now) * HZ; |
288 | if (!schedule_delayed_work(&afs_server_reaper, delay)) { | 288 | if (!queue_delayed_work(afs_wq, &afs_server_reaper, |
289 | delay)) { | ||
289 | cancel_delayed_work(&afs_server_reaper); | 290 | cancel_delayed_work(&afs_server_reaper); |
290 | schedule_delayed_work(&afs_server_reaper, | 291 | queue_delayed_work(afs_wq, &afs_server_reaper, |
291 | delay); | 292 | delay); |
292 | } | 293 | } |
293 | break; | 294 | break; |
294 | } | 295 | } |
@@ -323,5 +324,5 @@ void __exit afs_purge_servers(void) | |||
323 | { | 324 | { |
324 | afs_server_timeout = 0; | 325 | afs_server_timeout = 0; |
325 | cancel_delayed_work(&afs_server_reaper); | 326 | cancel_delayed_work(&afs_server_reaper); |
326 | schedule_delayed_work(&afs_server_reaper, 0); | 327 | queue_delayed_work(afs_wq, &afs_server_reaper, 0); |
327 | } | 328 | } |
diff --git a/fs/afs/vlocation.c b/fs/afs/vlocation.c index 9ac260d1361d..431984d2e372 100644 --- a/fs/afs/vlocation.c +++ b/fs/afs/vlocation.c | |||
@@ -507,8 +507,8 @@ void afs_put_vlocation(struct afs_vlocation *vl) | |||
507 | _debug("buried"); | 507 | _debug("buried"); |
508 | list_move_tail(&vl->grave, &afs_vlocation_graveyard); | 508 | list_move_tail(&vl->grave, &afs_vlocation_graveyard); |
509 | vl->time_of_death = get_seconds(); | 509 | vl->time_of_death = get_seconds(); |
510 | schedule_delayed_work(&afs_vlocation_reap, | 510 | queue_delayed_work(afs_wq, &afs_vlocation_reap, |
511 | afs_vlocation_timeout * HZ); | 511 | afs_vlocation_timeout * HZ); |
512 | 512 | ||
513 | /* suspend updates on this record */ | 513 | /* suspend updates on this record */ |
514 | if (!list_empty(&vl->update)) { | 514 | if (!list_empty(&vl->update)) { |
@@ -561,11 +561,11 @@ static void afs_vlocation_reaper(struct work_struct *work) | |||
561 | if (expiry > now) { | 561 | if (expiry > now) { |
562 | delay = (expiry - now) * HZ; | 562 | delay = (expiry - now) * HZ; |
563 | _debug("delay %lu", delay); | 563 | _debug("delay %lu", delay); |
564 | if (!schedule_delayed_work(&afs_vlocation_reap, | 564 | if (!queue_delayed_work(afs_wq, &afs_vlocation_reap, |
565 | delay)) { | 565 | delay)) { |
566 | cancel_delayed_work(&afs_vlocation_reap); | 566 | cancel_delayed_work(&afs_vlocation_reap); |
567 | schedule_delayed_work(&afs_vlocation_reap, | 567 | queue_delayed_work(afs_wq, &afs_vlocation_reap, |
568 | delay); | 568 | delay); |
569 | } | 569 | } |
570 | break; | 570 | break; |
571 | } | 571 | } |
@@ -620,7 +620,7 @@ void afs_vlocation_purge(void) | |||
620 | destroy_workqueue(afs_vlocation_update_worker); | 620 | destroy_workqueue(afs_vlocation_update_worker); |
621 | 621 | ||
622 | cancel_delayed_work(&afs_vlocation_reap); | 622 | cancel_delayed_work(&afs_vlocation_reap); |
623 | schedule_delayed_work(&afs_vlocation_reap, 0); | 623 | queue_delayed_work(afs_wq, &afs_vlocation_reap, 0); |
624 | } | 624 | } |
625 | 625 | ||
626 | /* | 626 | /* |
diff --git a/fs/fscache/operation.c b/fs/fscache/operation.c index b9f34eaede09..48a18f184d50 100644 --- a/fs/fscache/operation.c +++ b/fs/fscache/operation.c | |||
@@ -101,7 +101,7 @@ int fscache_submit_exclusive_op(struct fscache_object *object, | |||
101 | object->n_ops++; | 101 | object->n_ops++; |
102 | object->n_exclusive++; /* reads and writes must wait */ | 102 | object->n_exclusive++; /* reads and writes must wait */ |
103 | 103 | ||
104 | if (object->n_ops > 0) { | 104 | if (object->n_ops > 1) { |
105 | atomic_inc(&op->usage); | 105 | atomic_inc(&op->usage); |
106 | list_add_tail(&op->pend_link, &object->pending_ops); | 106 | list_add_tail(&op->pend_link, &object->pending_ops); |
107 | fscache_stat(&fscache_n_op_pend); | 107 | fscache_stat(&fscache_n_op_pend); |
diff --git a/fs/namei.c b/fs/namei.c index 86643302079e..8df7a78ace58 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -779,7 +779,8 @@ static void path_put_conditional(struct path *path, struct nameidata *nd) | |||
779 | mntput(path->mnt); | 779 | mntput(path->mnt); |
780 | } | 780 | } |
781 | 781 | ||
782 | static inline void path_to_nameidata(struct path *path, struct nameidata *nd) | 782 | static inline void path_to_nameidata(const struct path *path, |
783 | struct nameidata *nd) | ||
783 | { | 784 | { |
784 | if (!(nd->flags & LOOKUP_RCU)) { | 785 | if (!(nd->flags & LOOKUP_RCU)) { |
785 | dput(nd->path.dentry); | 786 | dput(nd->path.dentry); |
@@ -791,20 +792,20 @@ static inline void path_to_nameidata(struct path *path, struct nameidata *nd) | |||
791 | } | 792 | } |
792 | 793 | ||
793 | static __always_inline int | 794 | static __always_inline int |
794 | __do_follow_link(struct path *path, struct nameidata *nd, void **p) | 795 | __do_follow_link(const struct path *link, struct nameidata *nd, void **p) |
795 | { | 796 | { |
796 | int error; | 797 | int error; |
797 | struct dentry *dentry = path->dentry; | 798 | struct dentry *dentry = link->dentry; |
798 | 799 | ||
799 | touch_atime(path->mnt, dentry); | 800 | touch_atime(link->mnt, dentry); |
800 | nd_set_link(nd, NULL); | 801 | nd_set_link(nd, NULL); |
801 | 802 | ||
802 | if (path->mnt != nd->path.mnt) { | 803 | if (link->mnt != nd->path.mnt) { |
803 | path_to_nameidata(path, nd); | 804 | path_to_nameidata(link, nd); |
804 | nd->inode = nd->path.dentry->d_inode; | 805 | nd->inode = nd->path.dentry->d_inode; |
805 | dget(dentry); | 806 | dget(dentry); |
806 | } | 807 | } |
807 | mntget(path->mnt); | 808 | mntget(link->mnt); |
808 | 809 | ||
809 | nd->last_type = LAST_BIND; | 810 | nd->last_type = LAST_BIND; |
810 | *p = dentry->d_inode->i_op->follow_link(dentry, nd); | 811 | *p = dentry->d_inode->i_op->follow_link(dentry, nd); |
@@ -2348,11 +2349,12 @@ reval: | |||
2348 | nd.flags = flags; | 2349 | nd.flags = flags; |
2349 | filp = do_last(&nd, &path, open_flag, acc_mode, mode, pathname); | 2350 | filp = do_last(&nd, &path, open_flag, acc_mode, mode, pathname); |
2350 | while (unlikely(!filp)) { /* trailing symlink */ | 2351 | while (unlikely(!filp)) { /* trailing symlink */ |
2351 | struct path holder; | 2352 | struct path link = path; |
2353 | struct inode *linki = link.dentry->d_inode; | ||
2352 | void *cookie; | 2354 | void *cookie; |
2353 | error = -ELOOP; | 2355 | error = -ELOOP; |
2354 | /* S_ISDIR part is a temporary automount kludge */ | 2356 | /* S_ISDIR part is a temporary automount kludge */ |
2355 | if (!(nd.flags & LOOKUP_FOLLOW) && !S_ISDIR(nd.inode->i_mode)) | 2357 | if (!(nd.flags & LOOKUP_FOLLOW) && !S_ISDIR(linki->i_mode)) |
2356 | goto exit_dput; | 2358 | goto exit_dput; |
2357 | if (count++ == 32) | 2359 | if (count++ == 32) |
2358 | goto exit_dput; | 2360 | goto exit_dput; |
@@ -2368,23 +2370,22 @@ reval: | |||
2368 | * just set LAST_BIND. | 2370 | * just set LAST_BIND. |
2369 | */ | 2371 | */ |
2370 | nd.flags |= LOOKUP_PARENT; | 2372 | nd.flags |= LOOKUP_PARENT; |
2371 | error = security_inode_follow_link(path.dentry, &nd); | 2373 | error = security_inode_follow_link(link.dentry, &nd); |
2372 | if (error) | 2374 | if (error) |
2373 | goto exit_dput; | 2375 | goto exit_dput; |
2374 | error = __do_follow_link(&path, &nd, &cookie); | 2376 | error = __do_follow_link(&link, &nd, &cookie); |
2375 | if (unlikely(error)) { | 2377 | if (unlikely(error)) { |
2376 | if (!IS_ERR(cookie) && nd.inode->i_op->put_link) | 2378 | if (!IS_ERR(cookie) && linki->i_op->put_link) |
2377 | nd.inode->i_op->put_link(path.dentry, &nd, cookie); | 2379 | linki->i_op->put_link(link.dentry, &nd, cookie); |
2378 | /* nd.path had been dropped */ | 2380 | /* nd.path had been dropped */ |
2379 | nd.path = path; | 2381 | nd.path = link; |
2380 | goto out_path; | 2382 | goto out_path; |
2381 | } | 2383 | } |
2382 | holder = path; | ||
2383 | nd.flags &= ~LOOKUP_PARENT; | 2384 | nd.flags &= ~LOOKUP_PARENT; |
2384 | filp = do_last(&nd, &path, open_flag, acc_mode, mode, pathname); | 2385 | filp = do_last(&nd, &path, open_flag, acc_mode, mode, pathname); |
2385 | if (nd.inode->i_op->put_link) | 2386 | if (linki->i_op->put_link) |
2386 | nd.inode->i_op->put_link(holder.dentry, &nd, cookie); | 2387 | linki->i_op->put_link(link.dentry, &nd, cookie); |
2387 | path_put(&holder); | 2388 | path_put(&link); |
2388 | } | 2389 | } |
2389 | out: | 2390 | out: |
2390 | if (nd.root.mnt) | 2391 | if (nd.root.mnt) |
diff --git a/include/acpi/apei.h b/include/acpi/apei.h index b3365025ff8d..c4dbb132d902 100644 --- a/include/acpi/apei.h +++ b/include/acpi/apei.h | |||
@@ -19,6 +19,12 @@ | |||
19 | extern int hest_disable; | 19 | extern int hest_disable; |
20 | extern int erst_disable; | 20 | extern int erst_disable; |
21 | 21 | ||
22 | #ifdef CONFIG_ACPI_APEI | ||
23 | void __init acpi_hest_init(void); | ||
24 | #else | ||
25 | static inline void acpi_hest_init(void) { return; } | ||
26 | #endif | ||
27 | |||
22 | typedef int (*apei_hest_func_t)(struct acpi_hest_header *hest_hdr, void *data); | 28 | typedef int (*apei_hest_func_t)(struct acpi_hest_header *hest_hdr, void *data); |
23 | int apei_hest_parse(apei_hest_func_t func, void *data); | 29 | int apei_hest_parse(apei_hest_func_t func, void *data); |
24 | 30 | ||
diff --git a/include/linux/gpio.h b/include/linux/gpio.h index 4b47ed96f131..32720baf70f1 100644 --- a/include/linux/gpio.h +++ b/include/linux/gpio.h | |||
@@ -35,13 +35,13 @@ static inline int gpio_request(unsigned gpio, const char *label) | |||
35 | return -ENOSYS; | 35 | return -ENOSYS; |
36 | } | 36 | } |
37 | 37 | ||
38 | static inline int __must_check gpio_request_one(unsigned gpio, | 38 | static inline int gpio_request_one(unsigned gpio, |
39 | unsigned long flags, const char *label) | 39 | unsigned long flags, const char *label) |
40 | { | 40 | { |
41 | return -ENOSYS; | 41 | return -ENOSYS; |
42 | } | 42 | } |
43 | 43 | ||
44 | static inline int __must_check gpio_request_array(struct gpio *array, size_t num) | 44 | static inline int gpio_request_array(struct gpio *array, size_t num) |
45 | { | 45 | { |
46 | return -ENOSYS; | 46 | return -ENOSYS; |
47 | } | 47 | } |
diff --git a/include/linux/list_bl.h b/include/linux/list_bl.h index b2adbb4b2f73..5bad17d1acde 100644 --- a/include/linux/list_bl.h +++ b/include/linux/list_bl.h | |||
@@ -16,7 +16,7 @@ | |||
16 | * some fast and compact auxiliary data. | 16 | * some fast and compact auxiliary data. |
17 | */ | 17 | */ |
18 | 18 | ||
19 | #if defined(CONFIG_SMP) | 19 | #if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) |
20 | #define LIST_BL_LOCKMASK 1UL | 20 | #define LIST_BL_LOCKMASK 1UL |
21 | #else | 21 | #else |
22 | #define LIST_BL_LOCKMASK 0UL | 22 | #define LIST_BL_LOCKMASK 0UL |
diff --git a/include/linux/mfd/ab8500.h b/include/linux/mfd/ab8500.h index 85cf2c28fac6..37f56b7c4c15 100644 --- a/include/linux/mfd/ab8500.h +++ b/include/linux/mfd/ab8500.h | |||
@@ -74,30 +74,37 @@ | |||
74 | #define AB8500_INT_ACC_DETECT_21DB_F 37 | 74 | #define AB8500_INT_ACC_DETECT_21DB_F 37 |
75 | #define AB8500_INT_ACC_DETECT_21DB_R 38 | 75 | #define AB8500_INT_ACC_DETECT_21DB_R 38 |
76 | #define AB8500_INT_GP_SW_ADC_CONV_END 39 | 76 | #define AB8500_INT_GP_SW_ADC_CONV_END 39 |
77 | #define AB8500_INT_BTEMP_LOW 72 | 77 | #define AB8500_INT_ADP_SOURCE_ERROR 72 |
78 | #define AB8500_INT_BTEMP_LOW_MEDIUM 73 | 78 | #define AB8500_INT_ADP_SINK_ERROR 73 |
79 | #define AB8500_INT_BTEMP_MEDIUM_HIGH 74 | 79 | #define AB8500_INT_ADP_PROBE_PLUG 74 |
80 | #define AB8500_INT_BTEMP_HIGH 75 | 80 | #define AB8500_INT_ADP_PROBE_UNPLUG 75 |
81 | #define AB8500_INT_USB_CHARGER_NOT_OK 81 | 81 | #define AB8500_INT_ADP_SENSE_OFF 76 |
82 | #define AB8500_INT_ID_WAKEUP_R 82 | 82 | #define AB8500_INT_USB_PHY_POWER_ERR 78 |
83 | #define AB8500_INT_ID_DET_R1R 84 | 83 | #define AB8500_INT_USB_LINK_STATUS 79 |
84 | #define AB8500_INT_ID_DET_R2R 85 | 84 | #define AB8500_INT_BTEMP_LOW 80 |
85 | #define AB8500_INT_ID_DET_R3R 86 | 85 | #define AB8500_INT_BTEMP_LOW_MEDIUM 81 |
86 | #define AB8500_INT_ID_DET_R4R 87 | 86 | #define AB8500_INT_BTEMP_MEDIUM_HIGH 82 |
87 | #define AB8500_INT_ID_WAKEUP_F 88 | 87 | #define AB8500_INT_BTEMP_HIGH 83 |
88 | #define AB8500_INT_ID_DET_R1F 90 | 88 | #define AB8500_INT_USB_CHARGER_NOT_OK 89 |
89 | #define AB8500_INT_ID_DET_R2F 91 | 89 | #define AB8500_INT_ID_WAKEUP_R 90 |
90 | #define AB8500_INT_ID_DET_R3F 92 | 90 | #define AB8500_INT_ID_DET_R1R 92 |
91 | #define AB8500_INT_ID_DET_R4F 93 | 91 | #define AB8500_INT_ID_DET_R2R 93 |
92 | #define AB8500_INT_USB_CHG_DET_DONE 94 | 92 | #define AB8500_INT_ID_DET_R3R 94 |
93 | #define AB8500_INT_USB_CH_TH_PROT_F 96 | 93 | #define AB8500_INT_ID_DET_R4R 95 |
94 | #define AB8500_INT_USB_CH_TH_PROP_R 97 | 94 | #define AB8500_INT_ID_WAKEUP_F 96 |
95 | #define AB8500_INT_MAIN_CH_TH_PROP_F 98 | 95 | #define AB8500_INT_ID_DET_R1F 98 |
96 | #define AB8500_INT_MAIN_CH_TH_PROT_R 99 | 96 | #define AB8500_INT_ID_DET_R2F 99 |
97 | #define AB8500_INT_USB_CHARGER_NOT_OKF 103 | 97 | #define AB8500_INT_ID_DET_R3F 100 |
98 | #define AB8500_INT_ID_DET_R4F 101 | ||
99 | #define AB8500_INT_USB_CHG_DET_DONE 102 | ||
100 | #define AB8500_INT_USB_CH_TH_PROT_F 104 | ||
101 | #define AB8500_INT_USB_CH_TH_PROT_R 105 | ||
102 | #define AB8500_INT_MAIN_CH_TH_PROT_F 106 | ||
103 | #define AB8500_INT_MAIN_CH_TH_PROT_R 107 | ||
104 | #define AB8500_INT_USB_CHARGER_NOT_OKF 111 | ||
98 | 105 | ||
99 | #define AB8500_NR_IRQS 104 | 106 | #define AB8500_NR_IRQS 112 |
100 | #define AB8500_NUM_IRQ_REGS 13 | 107 | #define AB8500_NUM_IRQ_REGS 14 |
101 | 108 | ||
102 | /** | 109 | /** |
103 | * struct ab8500 - ab8500 internal structure | 110 | * struct ab8500 - ab8500 internal structure |
diff --git a/include/linux/mfd/core.h b/include/linux/mfd/core.h index 5582ab3d3e48..835996e167e1 100644 --- a/include/linux/mfd/core.h +++ b/include/linux/mfd/core.h | |||
@@ -47,6 +47,12 @@ struct mfd_cell { | |||
47 | 47 | ||
48 | /* don't check for resource conflicts */ | 48 | /* don't check for resource conflicts */ |
49 | bool ignore_resource_conflicts; | 49 | bool ignore_resource_conflicts; |
50 | |||
51 | /* | ||
52 | * Disable runtime PM callbacks for this subdevice - see | ||
53 | * pm_runtime_no_callbacks(). | ||
54 | */ | ||
55 | bool pm_runtime_no_callbacks; | ||
50 | }; | 56 | }; |
51 | 57 | ||
52 | extern int mfd_add_devices(struct device *parent, int id, | 58 | extern int mfd_add_devices(struct device *parent, int id, |
diff --git a/include/linux/mfd/max8998-private.h b/include/linux/mfd/max8998-private.h index 7363dea6bbcd..effa5d3b96ae 100644 --- a/include/linux/mfd/max8998-private.h +++ b/include/linux/mfd/max8998-private.h | |||
@@ -159,10 +159,12 @@ struct max8998_dev { | |||
159 | u8 irq_masks_cur[MAX8998_NUM_IRQ_REGS]; | 159 | u8 irq_masks_cur[MAX8998_NUM_IRQ_REGS]; |
160 | u8 irq_masks_cache[MAX8998_NUM_IRQ_REGS]; | 160 | u8 irq_masks_cache[MAX8998_NUM_IRQ_REGS]; |
161 | int type; | 161 | int type; |
162 | bool wakeup; | ||
162 | }; | 163 | }; |
163 | 164 | ||
164 | int max8998_irq_init(struct max8998_dev *max8998); | 165 | int max8998_irq_init(struct max8998_dev *max8998); |
165 | void max8998_irq_exit(struct max8998_dev *max8998); | 166 | void max8998_irq_exit(struct max8998_dev *max8998); |
167 | int max8998_irq_resume(struct max8998_dev *max8998); | ||
166 | 168 | ||
167 | extern int max8998_read_reg(struct i2c_client *i2c, u8 reg, u8 *dest); | 169 | extern int max8998_read_reg(struct i2c_client *i2c, u8 reg, u8 *dest); |
168 | extern int max8998_bulk_read(struct i2c_client *i2c, u8 reg, int count, | 170 | extern int max8998_bulk_read(struct i2c_client *i2c, u8 reg, int count, |
diff --git a/include/linux/mfd/max8998.h b/include/linux/mfd/max8998.h index f8c9f884aff2..61daa167b576 100644 --- a/include/linux/mfd/max8998.h +++ b/include/linux/mfd/max8998.h | |||
@@ -70,24 +70,43 @@ struct max8998_regulator_data { | |||
70 | * @num_regulators: number of regultors used | 70 | * @num_regulators: number of regultors used |
71 | * @irq_base: base IRQ number for max8998, required for IRQs | 71 | * @irq_base: base IRQ number for max8998, required for IRQs |
72 | * @ono: power onoff IRQ number for max8998 | 72 | * @ono: power onoff IRQ number for max8998 |
73 | * @buck1_max_voltage1: BUCK1 maximum alowed voltage register 1 | 73 | * @buck_voltage_lock: Do NOT change the values of the following six |
74 | * @buck1_max_voltage2: BUCK1 maximum alowed voltage register 2 | 74 | * registers set by buck?_voltage?. The voltage of BUCK1/2 cannot |
75 | * @buck2_max_voltage: BUCK2 maximum alowed voltage | 75 | * be other than the preset values. |
76 | * @buck1_voltage1: BUCK1 DVS mode 1 voltage register | ||
77 | * @buck1_voltage2: BUCK1 DVS mode 2 voltage register | ||
78 | * @buck1_voltage3: BUCK1 DVS mode 3 voltage register | ||
79 | * @buck1_voltage4: BUCK1 DVS mode 4 voltage register | ||
80 | * @buck2_voltage1: BUCK2 DVS mode 1 voltage register | ||
81 | * @buck2_voltage2: BUCK2 DVS mode 2 voltage register | ||
76 | * @buck1_set1: BUCK1 gpio pin 1 to set output voltage | 82 | * @buck1_set1: BUCK1 gpio pin 1 to set output voltage |
77 | * @buck1_set2: BUCK1 gpio pin 2 to set output voltage | 83 | * @buck1_set2: BUCK1 gpio pin 2 to set output voltage |
84 | * @buck1_default_idx: Default for BUCK1 gpio pin 1, 2 | ||
78 | * @buck2_set3: BUCK2 gpio pin to set output voltage | 85 | * @buck2_set3: BUCK2 gpio pin to set output voltage |
86 | * @buck2_default_idx: Default for BUCK2 gpio pin. | ||
87 | * @wakeup: Allow to wake up from suspend | ||
88 | * @rtc_delay: LP3974 RTC chip bug that requires delay after a register | ||
89 | * write before reading it. | ||
79 | */ | 90 | */ |
80 | struct max8998_platform_data { | 91 | struct max8998_platform_data { |
81 | struct max8998_regulator_data *regulators; | 92 | struct max8998_regulator_data *regulators; |
82 | int num_regulators; | 93 | int num_regulators; |
83 | int irq_base; | 94 | int irq_base; |
84 | int ono; | 95 | int ono; |
85 | int buck1_max_voltage1; | 96 | bool buck_voltage_lock; |
86 | int buck1_max_voltage2; | 97 | int buck1_voltage1; |
87 | int buck2_max_voltage; | 98 | int buck1_voltage2; |
99 | int buck1_voltage3; | ||
100 | int buck1_voltage4; | ||
101 | int buck2_voltage1; | ||
102 | int buck2_voltage2; | ||
88 | int buck1_set1; | 103 | int buck1_set1; |
89 | int buck1_set2; | 104 | int buck1_set2; |
105 | int buck1_default_idx; | ||
90 | int buck2_set3; | 106 | int buck2_set3; |
107 | int buck2_default_idx; | ||
108 | bool wakeup; | ||
109 | bool rtc_delay; | ||
91 | }; | 110 | }; |
92 | 111 | ||
93 | #endif /* __LINUX_MFD_MAX8998_H */ | 112 | #endif /* __LINUX_MFD_MAX8998_H */ |
diff --git a/include/linux/mfd/wm831x/core.h b/include/linux/mfd/wm831x/core.h index a1239c48b41a..903280d21866 100644 --- a/include/linux/mfd/wm831x/core.h +++ b/include/linux/mfd/wm831x/core.h | |||
@@ -245,6 +245,7 @@ enum wm831x_parent { | |||
245 | WM8320 = 0x8320, | 245 | WM8320 = 0x8320, |
246 | WM8321 = 0x8321, | 246 | WM8321 = 0x8321, |
247 | WM8325 = 0x8325, | 247 | WM8325 = 0x8325, |
248 | WM8326 = 0x8326, | ||
248 | }; | 249 | }; |
249 | 250 | ||
250 | struct wm831x { | 251 | struct wm831x { |
diff --git a/include/linux/page_cgroup.h b/include/linux/page_cgroup.h index 5b0c971d7cae..6d6cb7a57bb3 100644 --- a/include/linux/page_cgroup.h +++ b/include/linux/page_cgroup.h | |||
@@ -42,9 +42,6 @@ enum { | |||
42 | /* flags for mem_cgroup and file and I/O status */ | 42 | /* flags for mem_cgroup and file and I/O status */ |
43 | PCG_MOVE_LOCK, /* For race between move_account v.s. following bits */ | 43 | PCG_MOVE_LOCK, /* For race between move_account v.s. following bits */ |
44 | PCG_FILE_MAPPED, /* page is accounted as "mapped" */ | 44 | PCG_FILE_MAPPED, /* page is accounted as "mapped" */ |
45 | PCG_FILE_DIRTY, /* page is dirty */ | ||
46 | PCG_FILE_WRITEBACK, /* page is under writeback */ | ||
47 | PCG_FILE_UNSTABLE_NFS, /* page is NFS unstable */ | ||
48 | /* No lock in page_cgroup */ | 45 | /* No lock in page_cgroup */ |
49 | PCG_ACCT_LRU, /* page has been accounted for (under lru_lock) */ | 46 | PCG_ACCT_LRU, /* page has been accounted for (under lru_lock) */ |
50 | }; | 47 | }; |
@@ -65,10 +62,6 @@ static inline void ClearPageCgroup##uname(struct page_cgroup *pc) \ | |||
65 | static inline int TestClearPageCgroup##uname(struct page_cgroup *pc) \ | 62 | static inline int TestClearPageCgroup##uname(struct page_cgroup *pc) \ |
66 | { return test_and_clear_bit(PCG_##lname, &pc->flags); } | 63 | { return test_and_clear_bit(PCG_##lname, &pc->flags); } |
67 | 64 | ||
68 | #define TESTSETPCGFLAG(uname, lname) \ | ||
69 | static inline int TestSetPageCgroup##uname(struct page_cgroup *pc) \ | ||
70 | { return test_and_set_bit(PCG_##lname, &pc->flags); } | ||
71 | |||
72 | /* Cache flag is set only once (at allocation) */ | 65 | /* Cache flag is set only once (at allocation) */ |
73 | TESTPCGFLAG(Cache, CACHE) | 66 | TESTPCGFLAG(Cache, CACHE) |
74 | CLEARPCGFLAG(Cache, CACHE) | 67 | CLEARPCGFLAG(Cache, CACHE) |
@@ -88,22 +81,6 @@ SETPCGFLAG(FileMapped, FILE_MAPPED) | |||
88 | CLEARPCGFLAG(FileMapped, FILE_MAPPED) | 81 | CLEARPCGFLAG(FileMapped, FILE_MAPPED) |
89 | TESTPCGFLAG(FileMapped, FILE_MAPPED) | 82 | TESTPCGFLAG(FileMapped, FILE_MAPPED) |
90 | 83 | ||
91 | SETPCGFLAG(FileDirty, FILE_DIRTY) | ||
92 | CLEARPCGFLAG(FileDirty, FILE_DIRTY) | ||
93 | TESTPCGFLAG(FileDirty, FILE_DIRTY) | ||
94 | TESTCLEARPCGFLAG(FileDirty, FILE_DIRTY) | ||
95 | TESTSETPCGFLAG(FileDirty, FILE_DIRTY) | ||
96 | |||
97 | SETPCGFLAG(FileWriteback, FILE_WRITEBACK) | ||
98 | CLEARPCGFLAG(FileWriteback, FILE_WRITEBACK) | ||
99 | TESTPCGFLAG(FileWriteback, FILE_WRITEBACK) | ||
100 | |||
101 | SETPCGFLAG(FileUnstableNFS, FILE_UNSTABLE_NFS) | ||
102 | CLEARPCGFLAG(FileUnstableNFS, FILE_UNSTABLE_NFS) | ||
103 | TESTPCGFLAG(FileUnstableNFS, FILE_UNSTABLE_NFS) | ||
104 | TESTCLEARPCGFLAG(FileUnstableNFS, FILE_UNSTABLE_NFS) | ||
105 | TESTSETPCGFLAG(FileUnstableNFS, FILE_UNSTABLE_NFS) | ||
106 | |||
107 | SETPCGFLAG(Migration, MIGRATION) | 84 | SETPCGFLAG(Migration, MIGRATION) |
108 | CLEARPCGFLAG(Migration, MIGRATION) | 85 | CLEARPCGFLAG(Migration, MIGRATION) |
109 | TESTPCGFLAG(Migration, MIGRATION) | 86 | TESTPCGFLAG(Migration, MIGRATION) |
diff --git a/include/linux/pci-acpi.h b/include/linux/pci-acpi.h index c8b6473c5f42..479d9bb88e11 100644 --- a/include/linux/pci-acpi.h +++ b/include/linux/pci-acpi.h | |||
@@ -40,4 +40,10 @@ static inline acpi_handle acpi_find_root_bridge_handle(struct pci_dev *pdev) | |||
40 | { return NULL; } | 40 | { return NULL; } |
41 | #endif | 41 | #endif |
42 | 42 | ||
43 | #ifdef CONFIG_ACPI_APEI | ||
44 | extern bool aer_acpi_firmware_first(void); | ||
45 | #else | ||
46 | static inline bool aer_acpi_firmware_first(void) { return false; } | ||
47 | #endif | ||
48 | |||
43 | #endif /* _PCI_ACPI_H_ */ | 49 | #endif /* _PCI_ACPI_H_ */ |
diff --git a/include/linux/pci-aspm.h b/include/linux/pci-aspm.h index 91ba0b338b47..ce6810512c66 100644 --- a/include/linux/pci-aspm.h +++ b/include/linux/pci-aspm.h | |||
@@ -27,6 +27,7 @@ extern void pcie_aspm_init_link_state(struct pci_dev *pdev); | |||
27 | extern void pcie_aspm_exit_link_state(struct pci_dev *pdev); | 27 | extern void pcie_aspm_exit_link_state(struct pci_dev *pdev); |
28 | extern void pcie_aspm_pm_state_change(struct pci_dev *pdev); | 28 | extern void pcie_aspm_pm_state_change(struct pci_dev *pdev); |
29 | extern void pci_disable_link_state(struct pci_dev *pdev, int state); | 29 | extern void pci_disable_link_state(struct pci_dev *pdev, int state); |
30 | extern void pcie_clear_aspm(void); | ||
30 | extern void pcie_no_aspm(void); | 31 | extern void pcie_no_aspm(void); |
31 | #else | 32 | #else |
32 | static inline void pcie_aspm_init_link_state(struct pci_dev *pdev) | 33 | static inline void pcie_aspm_init_link_state(struct pci_dev *pdev) |
@@ -41,7 +42,9 @@ static inline void pcie_aspm_pm_state_change(struct pci_dev *pdev) | |||
41 | static inline void pci_disable_link_state(struct pci_dev *pdev, int state) | 42 | static inline void pci_disable_link_state(struct pci_dev *pdev, int state) |
42 | { | 43 | { |
43 | } | 44 | } |
44 | 45 | static inline void pcie_clear_aspm(void) | |
46 | { | ||
47 | } | ||
45 | static inline void pcie_no_aspm(void) | 48 | static inline void pcie_no_aspm(void) |
46 | { | 49 | { |
47 | } | 50 | } |
diff --git a/include/linux/pci.h b/include/linux/pci.h index 7454408c41b6..9e67dcd054c4 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
@@ -806,7 +806,7 @@ size_t pci_get_rom_size(struct pci_dev *pdev, void __iomem *rom, size_t size); | |||
806 | 806 | ||
807 | /* Power management related routines */ | 807 | /* Power management related routines */ |
808 | int pci_save_state(struct pci_dev *dev); | 808 | int pci_save_state(struct pci_dev *dev); |
809 | int pci_restore_state(struct pci_dev *dev); | 809 | void pci_restore_state(struct pci_dev *dev); |
810 | int __pci_complete_power_transition(struct pci_dev *dev, pci_power_t state); | 810 | int __pci_complete_power_transition(struct pci_dev *dev, pci_power_t state); |
811 | int pci_set_power_state(struct pci_dev *dev, pci_power_t state); | 811 | int pci_set_power_state(struct pci_dev *dev, pci_power_t state); |
812 | pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state); | 812 | pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state); |
@@ -820,7 +820,6 @@ int pci_prepare_to_sleep(struct pci_dev *dev); | |||
820 | int pci_back_from_sleep(struct pci_dev *dev); | 820 | int pci_back_from_sleep(struct pci_dev *dev); |
821 | bool pci_dev_run_wake(struct pci_dev *dev); | 821 | bool pci_dev_run_wake(struct pci_dev *dev); |
822 | bool pci_check_pme_status(struct pci_dev *dev); | 822 | bool pci_check_pme_status(struct pci_dev *dev); |
823 | void pci_wakeup_event(struct pci_dev *dev); | ||
824 | void pci_pme_wakeup_bus(struct pci_bus *bus); | 823 | void pci_pme_wakeup_bus(struct pci_bus *bus); |
825 | 824 | ||
826 | static inline int pci_enable_wake(struct pci_dev *dev, pci_power_t state, | 825 | static inline int pci_enable_wake(struct pci_dev *dev, pci_power_t state, |
@@ -994,6 +993,9 @@ extern void pci_restore_msi_state(struct pci_dev *dev); | |||
994 | extern int pci_msi_enabled(void); | 993 | extern int pci_msi_enabled(void); |
995 | #endif | 994 | #endif |
996 | 995 | ||
996 | extern bool pcie_ports_disabled; | ||
997 | extern bool pcie_ports_auto; | ||
998 | |||
997 | #ifndef CONFIG_PCIEASPM | 999 | #ifndef CONFIG_PCIEASPM |
998 | static inline int pcie_aspm_enabled(void) | 1000 | static inline int pcie_aspm_enabled(void) |
999 | { | 1001 | { |
@@ -1003,6 +1005,14 @@ static inline int pcie_aspm_enabled(void) | |||
1003 | extern int pcie_aspm_enabled(void); | 1005 | extern int pcie_aspm_enabled(void); |
1004 | #endif | 1006 | #endif |
1005 | 1007 | ||
1008 | #ifdef CONFIG_PCIEAER | ||
1009 | void pci_no_aer(void); | ||
1010 | bool pci_aer_available(void); | ||
1011 | #else | ||
1012 | static inline void pci_no_aer(void) { } | ||
1013 | static inline bool pci_aer_available(void) { return false; } | ||
1014 | #endif | ||
1015 | |||
1006 | #ifndef CONFIG_PCIE_ECRC | 1016 | #ifndef CONFIG_PCIE_ECRC |
1007 | static inline void pcie_set_ecrc_checking(struct pci_dev *dev) | 1017 | static inline void pcie_set_ecrc_checking(struct pci_dev *dev) |
1008 | { | 1018 | { |
@@ -1168,10 +1178,8 @@ static inline int pci_save_state(struct pci_dev *dev) | |||
1168 | return 0; | 1178 | return 0; |
1169 | } | 1179 | } |
1170 | 1180 | ||
1171 | static inline int pci_restore_state(struct pci_dev *dev) | 1181 | static inline void pci_restore_state(struct pci_dev *dev) |
1172 | { | 1182 | { } |
1173 | return 0; | ||
1174 | } | ||
1175 | 1183 | ||
1176 | static inline int pci_set_power_state(struct pci_dev *dev, pci_power_t state) | 1184 | static inline int pci_set_power_state(struct pci_dev *dev, pci_power_t state) |
1177 | { | 1185 | { |
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index ae0dc453e3e2..3adb06ebf841 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h | |||
@@ -2478,7 +2478,8 @@ | |||
2478 | #define PCI_DEVICE_ID_INTEL_COUGARPOINT_LPC_MIN 0x1c41 | 2478 | #define PCI_DEVICE_ID_INTEL_COUGARPOINT_LPC_MIN 0x1c41 |
2479 | #define PCI_DEVICE_ID_INTEL_COUGARPOINT_LPC_MAX 0x1c5f | 2479 | #define PCI_DEVICE_ID_INTEL_COUGARPOINT_LPC_MAX 0x1c5f |
2480 | #define PCI_DEVICE_ID_INTEL_PATSBURG_SMBUS 0x1d22 | 2480 | #define PCI_DEVICE_ID_INTEL_PATSBURG_SMBUS 0x1d22 |
2481 | #define PCI_DEVICE_ID_INTEL_PATSBURG_LPC 0x1d40 | 2481 | #define PCI_DEVICE_ID_INTEL_PATSBURG_LPC_0 0x1d40 |
2482 | #define PCI_DEVICE_ID_INTEL_PATSBURG_LPC_1 0x1d41 | ||
2482 | #define PCI_DEVICE_ID_INTEL_82801AA_0 0x2410 | 2483 | #define PCI_DEVICE_ID_INTEL_82801AA_0 0x2410 |
2483 | #define PCI_DEVICE_ID_INTEL_82801AA_1 0x2411 | 2484 | #define PCI_DEVICE_ID_INTEL_82801AA_1 0x2411 |
2484 | #define PCI_DEVICE_ID_INTEL_82801AA_3 0x2413 | 2485 | #define PCI_DEVICE_ID_INTEL_82801AA_3 0x2413 |
diff --git a/include/linux/pci_regs.h b/include/linux/pci_regs.h index af83076c31a6..5b7e6b1ba54f 100644 --- a/include/linux/pci_regs.h +++ b/include/linux/pci_regs.h | |||
@@ -309,6 +309,14 @@ | |||
309 | #define PCI_MSIX_PBA 8 | 309 | #define PCI_MSIX_PBA 8 |
310 | #define PCI_MSIX_FLAGS_BIRMASK (7 << 0) | 310 | #define PCI_MSIX_FLAGS_BIRMASK (7 << 0) |
311 | 311 | ||
312 | /* MSI-X entry's format */ | ||
313 | #define PCI_MSIX_ENTRY_SIZE 16 | ||
314 | #define PCI_MSIX_ENTRY_LOWER_ADDR 0 | ||
315 | #define PCI_MSIX_ENTRY_UPPER_ADDR 4 | ||
316 | #define PCI_MSIX_ENTRY_DATA 8 | ||
317 | #define PCI_MSIX_ENTRY_VECTOR_CTRL 12 | ||
318 | #define PCI_MSIX_ENTRY_CTRL_MASKBIT 1 | ||
319 | |||
312 | /* CompactPCI Hotswap Register */ | 320 | /* CompactPCI Hotswap Register */ |
313 | 321 | ||
314 | #define PCI_CHSWP_CSR 2 /* Control and Status Register */ | 322 | #define PCI_CHSWP_CSR 2 /* Control and Status Register */ |
@@ -496,6 +504,8 @@ | |||
496 | #define PCI_EXP_RTCTL_CRSSVE 0x10 /* CRS Software Visibility Enable */ | 504 | #define PCI_EXP_RTCTL_CRSSVE 0x10 /* CRS Software Visibility Enable */ |
497 | #define PCI_EXP_RTCAP 30 /* Root Capabilities */ | 505 | #define PCI_EXP_RTCAP 30 /* Root Capabilities */ |
498 | #define PCI_EXP_RTSTA 32 /* Root Status */ | 506 | #define PCI_EXP_RTSTA 32 /* Root Status */ |
507 | #define PCI_EXP_RTSTA_PME 0x10000 /* PME status */ | ||
508 | #define PCI_EXP_RTSTA_PENDING 0x20000 /* PME pending */ | ||
499 | #define PCI_EXP_DEVCAP2 36 /* Device Capabilities 2 */ | 509 | #define PCI_EXP_DEVCAP2 36 /* Device Capabilities 2 */ |
500 | #define PCI_EXP_DEVCAP2_ARI 0x20 /* Alternative Routing-ID */ | 510 | #define PCI_EXP_DEVCAP2_ARI 0x20 /* Alternative Routing-ID */ |
501 | #define PCI_EXP_DEVCTL2 40 /* Device Control 2 */ | 511 | #define PCI_EXP_DEVCTL2 40 /* Device Control 2 */ |
diff --git a/include/linux/power/gpio-charger.h b/include/linux/power/gpio-charger.h new file mode 100644 index 000000000000..de1dfe09a03d --- /dev/null +++ b/include/linux/power/gpio-charger.h | |||
@@ -0,0 +1,41 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2010, Lars-Peter Clausen <lars@metafoo.de> | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it | ||
5 | * under the terms of the GNU General Public License as published by the | ||
6 | * Free Software Foundation; either version 2 of the License, or (at your | ||
7 | * option) any later version. | ||
8 | * | ||
9 | * You should have received a copy of the GNU General Public License along | ||
10 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
11 | * 675 Mass Ave, Cambridge, MA 02139, USA. | ||
12 | * | ||
13 | */ | ||
14 | |||
15 | #ifndef __LINUX_POWER_GPIO_CHARGER_H__ | ||
16 | #define __LINUX_POWER_GPIO_CHARGER_H__ | ||
17 | |||
18 | #include <linux/power_supply.h> | ||
19 | #include <linux/types.h> | ||
20 | |||
21 | /** | ||
22 | * struct gpio_charger_platform_data - platform_data for gpio_charger devices | ||
23 | * @name: Name for the chargers power_supply device | ||
24 | * @type: Type of the charger | ||
25 | * @gpio: GPIO which is used to indicate the chargers status | ||
26 | * @gpio_active_low: Should be set to 1 if the GPIO is active low otherwise 0 | ||
27 | * @supplied_to: Array of battery names to which this chargers supplies power | ||
28 | * @num_supplicants: Number of entries in the supplied_to array | ||
29 | */ | ||
30 | struct gpio_charger_platform_data { | ||
31 | const char *name; | ||
32 | enum power_supply_type type; | ||
33 | |||
34 | int gpio; | ||
35 | int gpio_active_low; | ||
36 | |||
37 | char **supplied_to; | ||
38 | size_t num_supplicants; | ||
39 | }; | ||
40 | |||
41 | #endif | ||
diff --git a/include/linux/power/max17042_battery.h b/include/linux/power/max17042_battery.h new file mode 100644 index 000000000000..7995deb8bfc1 --- /dev/null +++ b/include/linux/power/max17042_battery.h | |||
@@ -0,0 +1,30 @@ | |||
1 | /* | ||
2 | * Fuel gauge driver for Maxim 17042 / 8966 / 8997 | ||
3 | * Note that Maxim 8966 and 8997 are mfd and this is its subdevice. | ||
4 | * | ||
5 | * Copyright (C) 2011 Samsung Electronics | ||
6 | * MyungJoo Ham <myungjoo.ham@samsung.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; either version 2 of the License, or | ||
11 | * (at your option) any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | * GNU General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License | ||
19 | * along with this program; if not, write to the Free Software | ||
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
21 | */ | ||
22 | |||
23 | #ifndef __MAX17042_BATTERY_H_ | ||
24 | #define __MAX17042_BATTERY_H_ | ||
25 | |||
26 | struct max17042_platform_data { | ||
27 | bool enable_current_sense; | ||
28 | }; | ||
29 | |||
30 | #endif /* __MAX17042_BATTERY_H_ */ | ||
diff --git a/include/linux/s3c_adc_battery.h b/include/linux/s3c_adc_battery.h index dbce22faa660..fbe58b7e63eb 100644 --- a/include/linux/s3c_adc_battery.h +++ b/include/linux/s3c_adc_battery.h | |||
@@ -14,6 +14,7 @@ struct s3c_adc_bat_pdata { | |||
14 | void (*disable_charger)(void); | 14 | void (*disable_charger)(void); |
15 | 15 | ||
16 | int gpio_charge_finished; | 16 | int gpio_charge_finished; |
17 | int gpio_inverted; | ||
17 | 18 | ||
18 | const struct s3c_adc_bat_thresh *lut_noac; | 19 | const struct s3c_adc_bat_thresh *lut_noac; |
19 | unsigned int lut_noac_cnt; | 20 | unsigned int lut_noac_cnt; |
diff --git a/kernel/cgroup.c b/kernel/cgroup.c index 5c5f4cc2e99a..b24d7027b83c 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c | |||
@@ -764,6 +764,7 @@ EXPORT_SYMBOL_GPL(cgroup_unlock); | |||
764 | */ | 764 | */ |
765 | 765 | ||
766 | static int cgroup_mkdir(struct inode *dir, struct dentry *dentry, int mode); | 766 | static int cgroup_mkdir(struct inode *dir, struct dentry *dentry, int mode); |
767 | static struct dentry *cgroup_lookup(struct inode *, struct dentry *, struct nameidata *); | ||
767 | static int cgroup_rmdir(struct inode *unused_dir, struct dentry *dentry); | 768 | static int cgroup_rmdir(struct inode *unused_dir, struct dentry *dentry); |
768 | static int cgroup_populate_dir(struct cgroup *cgrp); | 769 | static int cgroup_populate_dir(struct cgroup *cgrp); |
769 | static const struct inode_operations cgroup_dir_inode_operations; | 770 | static const struct inode_operations cgroup_dir_inode_operations; |
@@ -860,6 +861,11 @@ static void cgroup_diput(struct dentry *dentry, struct inode *inode) | |||
860 | iput(inode); | 861 | iput(inode); |
861 | } | 862 | } |
862 | 863 | ||
864 | static int cgroup_delete(const struct dentry *d) | ||
865 | { | ||
866 | return 1; | ||
867 | } | ||
868 | |||
863 | static void remove_dir(struct dentry *d) | 869 | static void remove_dir(struct dentry *d) |
864 | { | 870 | { |
865 | struct dentry *parent = dget(d->d_parent); | 871 | struct dentry *parent = dget(d->d_parent); |
@@ -910,7 +916,7 @@ static void cgroup_d_remove_dir(struct dentry *dentry) | |||
910 | 916 | ||
911 | parent = dentry->d_parent; | 917 | parent = dentry->d_parent; |
912 | spin_lock(&parent->d_lock); | 918 | spin_lock(&parent->d_lock); |
913 | spin_lock(&dentry->d_lock); | 919 | spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED); |
914 | list_del_init(&dentry->d_u.d_child); | 920 | list_del_init(&dentry->d_u.d_child); |
915 | spin_unlock(&dentry->d_lock); | 921 | spin_unlock(&dentry->d_lock); |
916 | spin_unlock(&parent->d_lock); | 922 | spin_unlock(&parent->d_lock); |
@@ -1451,6 +1457,7 @@ static int cgroup_get_rootdir(struct super_block *sb) | |||
1451 | { | 1457 | { |
1452 | static const struct dentry_operations cgroup_dops = { | 1458 | static const struct dentry_operations cgroup_dops = { |
1453 | .d_iput = cgroup_diput, | 1459 | .d_iput = cgroup_diput, |
1460 | .d_delete = cgroup_delete, | ||
1454 | }; | 1461 | }; |
1455 | 1462 | ||
1456 | struct inode *inode = | 1463 | struct inode *inode = |
@@ -2195,12 +2202,20 @@ static const struct file_operations cgroup_file_operations = { | |||
2195 | }; | 2202 | }; |
2196 | 2203 | ||
2197 | static const struct inode_operations cgroup_dir_inode_operations = { | 2204 | static const struct inode_operations cgroup_dir_inode_operations = { |
2198 | .lookup = simple_lookup, | 2205 | .lookup = cgroup_lookup, |
2199 | .mkdir = cgroup_mkdir, | 2206 | .mkdir = cgroup_mkdir, |
2200 | .rmdir = cgroup_rmdir, | 2207 | .rmdir = cgroup_rmdir, |
2201 | .rename = cgroup_rename, | 2208 | .rename = cgroup_rename, |
2202 | }; | 2209 | }; |
2203 | 2210 | ||
2211 | static struct dentry *cgroup_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd) | ||
2212 | { | ||
2213 | if (dentry->d_name.len > NAME_MAX) | ||
2214 | return ERR_PTR(-ENAMETOOLONG); | ||
2215 | d_add(dentry, NULL); | ||
2216 | return NULL; | ||
2217 | } | ||
2218 | |||
2204 | /* | 2219 | /* |
2205 | * Check if a file is a control file | 2220 | * Check if a file is a control file |
2206 | */ | 2221 | */ |
diff --git a/net/rxrpc/af_rxrpc.c b/net/rxrpc/af_rxrpc.c index 0b9bb2085ce4..74c064c0dfdd 100644 --- a/net/rxrpc/af_rxrpc.c +++ b/net/rxrpc/af_rxrpc.c | |||
@@ -808,7 +808,7 @@ static int __init af_rxrpc_init(void) | |||
808 | goto error_call_jar; | 808 | goto error_call_jar; |
809 | } | 809 | } |
810 | 810 | ||
811 | rxrpc_workqueue = create_workqueue("krxrpcd"); | 811 | rxrpc_workqueue = alloc_workqueue("krxrpcd", 0, 1); |
812 | if (!rxrpc_workqueue) { | 812 | if (!rxrpc_workqueue) { |
813 | printk(KERN_NOTICE "RxRPC: Failed to allocate work queue\n"); | 813 | printk(KERN_NOTICE "RxRPC: Failed to allocate work queue\n"); |
814 | goto error_work_queue; | 814 | goto error_work_queue; |
diff --git a/sound/pci/cs5535audio/cs5535audio_pm.c b/sound/pci/cs5535audio/cs5535audio_pm.c index a3301cc4ab82..185b00088320 100644 --- a/sound/pci/cs5535audio/cs5535audio_pm.c +++ b/sound/pci/cs5535audio/cs5535audio_pm.c | |||
@@ -90,12 +90,7 @@ int snd_cs5535audio_resume(struct pci_dev *pci) | |||
90 | int i; | 90 | int i; |
91 | 91 | ||
92 | pci_set_power_state(pci, PCI_D0); | 92 | pci_set_power_state(pci, PCI_D0); |
93 | if (pci_restore_state(pci) < 0) { | 93 | pci_restore_state(pci); |
94 | printk(KERN_ERR "cs5535audio: pci_restore_state failed, " | ||
95 | "disabling device\n"); | ||
96 | snd_card_disconnect(card); | ||
97 | return -EIO; | ||
98 | } | ||
99 | if (pci_enable_device(pci) < 0) { | 94 | if (pci_enable_device(pci) < 0) { |
100 | printk(KERN_ERR "cs5535audio: pci_enable_device failed, " | 95 | printk(KERN_ERR "cs5535audio: pci_enable_device failed, " |
101 | "disabling device\n"); | 96 | "disabling device\n"); |