diff options
49 files changed, 562 insertions, 572 deletions
diff --git a/Documentation/filesystems/Locking b/Documentation/filesystems/Locking index b6426f15b4ae..7686e7684495 100644 --- a/Documentation/filesystems/Locking +++ b/Documentation/filesystems/Locking | |||
| @@ -18,7 +18,6 @@ prototypes: | |||
| 18 | char *(*d_dname)((struct dentry *dentry, char *buffer, int buflen); | 18 | char *(*d_dname)((struct dentry *dentry, char *buffer, int buflen); |
| 19 | 19 | ||
| 20 | locking rules: | 20 | locking rules: |
| 21 | none have BKL | ||
| 22 | dcache_lock rename_lock ->d_lock may block | 21 | dcache_lock rename_lock ->d_lock may block |
| 23 | d_revalidate: no no no yes | 22 | d_revalidate: no no no yes |
| 24 | d_hash no no no yes | 23 | d_hash no no no yes |
| @@ -42,18 +41,23 @@ ata *); | |||
| 42 | int (*rename) (struct inode *, struct dentry *, | 41 | int (*rename) (struct inode *, struct dentry *, |
| 43 | struct inode *, struct dentry *); | 42 | struct inode *, struct dentry *); |
| 44 | int (*readlink) (struct dentry *, char __user *,int); | 43 | int (*readlink) (struct dentry *, char __user *,int); |
| 45 | int (*follow_link) (struct dentry *, struct nameidata *); | 44 | void * (*follow_link) (struct dentry *, struct nameidata *); |
| 45 | void (*put_link) (struct dentry *, struct nameidata *, void *); | ||
| 46 | void (*truncate) (struct inode *); | 46 | void (*truncate) (struct inode *); |
| 47 | int (*permission) (struct inode *, int, struct nameidata *); | 47 | int (*permission) (struct inode *, int, struct nameidata *); |
| 48 | int (*check_acl)(struct inode *, int); | ||
| 48 | int (*setattr) (struct dentry *, struct iattr *); | 49 | int (*setattr) (struct dentry *, struct iattr *); |
| 49 | int (*getattr) (struct vfsmount *, struct dentry *, struct kstat *); | 50 | int (*getattr) (struct vfsmount *, struct dentry *, struct kstat *); |
| 50 | int (*setxattr) (struct dentry *, const char *,const void *,size_t,int); | 51 | int (*setxattr) (struct dentry *, const char *,const void *,size_t,int); |
| 51 | ssize_t (*getxattr) (struct dentry *, const char *, void *, size_t); | 52 | ssize_t (*getxattr) (struct dentry *, const char *, void *, size_t); |
| 52 | ssize_t (*listxattr) (struct dentry *, char *, size_t); | 53 | ssize_t (*listxattr) (struct dentry *, char *, size_t); |
| 53 | int (*removexattr) (struct dentry *, const char *); | 54 | int (*removexattr) (struct dentry *, const char *); |
| 55 | void (*truncate_range)(struct inode *, loff_t, loff_t); | ||
| 56 | long (*fallocate)(struct inode *inode, int mode, loff_t offset, loff_t len); | ||
| 57 | int (*fiemap)(struct inode *, struct fiemap_extent_info *, u64 start, u64 len); | ||
| 54 | 58 | ||
| 55 | locking rules: | 59 | locking rules: |
| 56 | all may block, none have BKL | 60 | all may block |
| 57 | i_mutex(inode) | 61 | i_mutex(inode) |
| 58 | lookup: yes | 62 | lookup: yes |
| 59 | create: yes | 63 | create: yes |
| @@ -66,19 +70,24 @@ rmdir: yes (both) (see below) | |||
| 66 | rename: yes (all) (see below) | 70 | rename: yes (all) (see below) |
| 67 | readlink: no | 71 | readlink: no |
| 68 | follow_link: no | 72 | follow_link: no |
| 73 | put_link: no | ||
| 69 | truncate: yes (see below) | 74 | truncate: yes (see below) |
| 70 | setattr: yes | 75 | setattr: yes |
| 71 | permission: no | 76 | permission: no |
| 77 | check_acl: no | ||
| 72 | getattr: no | 78 | getattr: no |
| 73 | setxattr: yes | 79 | setxattr: yes |
| 74 | getxattr: no | 80 | getxattr: no |
| 75 | listxattr: no | 81 | listxattr: no |
| 76 | removexattr: yes | 82 | removexattr: yes |
| 83 | truncate_range: yes | ||
| 84 | fallocate: no | ||
| 85 | fiemap: no | ||
| 77 | Additionally, ->rmdir(), ->unlink() and ->rename() have ->i_mutex on | 86 | Additionally, ->rmdir(), ->unlink() and ->rename() have ->i_mutex on |
| 78 | victim. | 87 | victim. |
| 79 | cross-directory ->rename() has (per-superblock) ->s_vfs_rename_sem. | 88 | cross-directory ->rename() has (per-superblock) ->s_vfs_rename_sem. |
| 80 | ->truncate() is never called directly - it's a callback, not a | 89 | ->truncate() is never called directly - it's a callback, not a |
| 81 | method. It's called by vmtruncate() - library function normally used by | 90 | method. It's called by vmtruncate() - deprecated library function used by |
| 82 | ->setattr(). Locking information above applies to that call (i.e. is | 91 | ->setattr(). Locking information above applies to that call (i.e. is |
| 83 | inherited from ->setattr() - vmtruncate() is used when ATTR_SIZE had been | 92 | inherited from ->setattr() - vmtruncate() is used when ATTR_SIZE had been |
| 84 | passed). | 93 | passed). |
| @@ -91,7 +100,7 @@ prototypes: | |||
| 91 | struct inode *(*alloc_inode)(struct super_block *sb); | 100 | struct inode *(*alloc_inode)(struct super_block *sb); |
| 92 | void (*destroy_inode)(struct inode *); | 101 | void (*destroy_inode)(struct inode *); |
| 93 | void (*dirty_inode) (struct inode *); | 102 | void (*dirty_inode) (struct inode *); |
| 94 | int (*write_inode) (struct inode *, int); | 103 | int (*write_inode) (struct inode *, struct writeback_control *wbc); |
| 95 | int (*drop_inode) (struct inode *); | 104 | int (*drop_inode) (struct inode *); |
| 96 | void (*evict_inode) (struct inode *); | 105 | void (*evict_inode) (struct inode *); |
| 97 | void (*put_super) (struct super_block *); | 106 | void (*put_super) (struct super_block *); |
| @@ -105,10 +114,11 @@ prototypes: | |||
| 105 | int (*show_options)(struct seq_file *, struct vfsmount *); | 114 | int (*show_options)(struct seq_file *, struct vfsmount *); |
| 106 | ssize_t (*quota_read)(struct super_block *, int, char *, size_t, loff_t); | 115 | ssize_t (*quota_read)(struct super_block *, int, char *, size_t, loff_t); |
| 107 | ssize_t (*quota_write)(struct super_block *, int, const char *, size_t, loff_t); | 116 | ssize_t (*quota_write)(struct super_block *, int, const char *, size_t, loff_t); |
| 117 | int (*bdev_try_to_free_page)(struct super_block*, struct page*, gfp_t); | ||
| 118 | int (*trim_fs) (struct super_block *, struct fstrim_range *); | ||
| 108 | 119 | ||
| 109 | locking rules: | 120 | locking rules: |
| 110 | All may block [not true, see below] | 121 | All may block [not true, see below] |
| 111 | None have BKL | ||
| 112 | s_umount | 122 | s_umount |
| 113 | alloc_inode: | 123 | alloc_inode: |
| 114 | destroy_inode: | 124 | destroy_inode: |
| @@ -127,6 +137,8 @@ umount_begin: no | |||
| 127 | show_options: no (namespace_sem) | 137 | show_options: no (namespace_sem) |
| 128 | quota_read: no (see below) | 138 | quota_read: no (see below) |
| 129 | quota_write: no (see below) | 139 | quota_write: no (see below) |
| 140 | bdev_try_to_free_page: no (see below) | ||
| 141 | trim_fs: no | ||
| 130 | 142 | ||
| 131 | ->statfs() has s_umount (shared) when called by ustat(2) (native or | 143 | ->statfs() has s_umount (shared) when called by ustat(2) (native or |
| 132 | compat), but that's an accident of bad API; s_umount is used to pin | 144 | compat), but that's an accident of bad API; s_umount is used to pin |
| @@ -139,19 +151,25 @@ be the only ones operating on the quota file by the quota code (via | |||
| 139 | dqio_sem) (unless an admin really wants to screw up something and | 151 | dqio_sem) (unless an admin really wants to screw up something and |
| 140 | writes to quota files with quotas on). For other details about locking | 152 | writes to quota files with quotas on). For other details about locking |
| 141 | see also dquot_operations section. | 153 | see also dquot_operations section. |
| 154 | ->bdev_try_to_free_page is called from the ->releasepage handler of | ||
| 155 | the block device inode. See there for more details. | ||
| 142 | 156 | ||
| 143 | --------------------------- file_system_type --------------------------- | 157 | --------------------------- file_system_type --------------------------- |
| 144 | prototypes: | 158 | prototypes: |
| 145 | int (*get_sb) (struct file_system_type *, int, | 159 | int (*get_sb) (struct file_system_type *, int, |
| 146 | const char *, void *, struct vfsmount *); | 160 | const char *, void *, struct vfsmount *); |
| 161 | struct dentry *(*mount) (struct file_system_type *, int, | ||
| 162 | const char *, void *); | ||
| 147 | void (*kill_sb) (struct super_block *); | 163 | void (*kill_sb) (struct super_block *); |
| 148 | locking rules: | 164 | locking rules: |
| 149 | may block BKL | 165 | may block |
| 150 | get_sb yes no | 166 | get_sb yes |
| 151 | kill_sb yes no | 167 | mount yes |
| 168 | kill_sb yes | ||
| 152 | 169 | ||
| 153 | ->get_sb() returns error or 0 with locked superblock attached to the vfsmount | 170 | ->get_sb() returns error or 0 with locked superblock attached to the vfsmount |
| 154 | (exclusive on ->s_umount). | 171 | (exclusive on ->s_umount). |
| 172 | ->mount() returns ERR_PTR or the root dentry. | ||
| 155 | ->kill_sb() takes a write-locked superblock, does all shutdown work on it, | 173 | ->kill_sb() takes a write-locked superblock, does all shutdown work on it, |
| 156 | unlocks and drops the reference. | 174 | unlocks and drops the reference. |
| 157 | 175 | ||
| @@ -176,27 +194,35 @@ prototypes: | |||
| 176 | void (*freepage)(struct page *); | 194 | void (*freepage)(struct page *); |
| 177 | int (*direct_IO)(int, struct kiocb *, const struct iovec *iov, | 195 | int (*direct_IO)(int, struct kiocb *, const struct iovec *iov, |
| 178 | loff_t offset, unsigned long nr_segs); | 196 | loff_t offset, unsigned long nr_segs); |
| 179 | int (*launder_page) (struct page *); | 197 | int (*get_xip_mem)(struct address_space *, pgoff_t, int, void **, |
| 198 | unsigned long *); | ||
| 199 | int (*migratepage)(struct address_space *, struct page *, struct page *); | ||
| 200 | int (*launder_page)(struct page *); | ||
| 201 | int (*is_partially_uptodate)(struct page *, read_descriptor_t *, unsigned long); | ||
| 202 | int (*error_remove_page)(struct address_space *, struct page *); | ||
| 180 | 203 | ||
| 181 | locking rules: | 204 | locking rules: |
| 182 | All except set_page_dirty and freepage may block | 205 | All except set_page_dirty and freepage may block |
| 183 | 206 | ||
| 184 | BKL PageLocked(page) i_mutex | 207 | PageLocked(page) i_mutex |
| 185 | writepage: no yes, unlocks (see below) | 208 | writepage: yes, unlocks (see below) |
| 186 | readpage: no yes, unlocks | 209 | readpage: yes, unlocks |
| 187 | sync_page: no maybe | 210 | sync_page: maybe |
| 188 | writepages: no | 211 | writepages: |
| 189 | set_page_dirty no no | 212 | set_page_dirty no |
| 190 | readpages: no | 213 | readpages: |
| 191 | write_begin: no locks the page yes | 214 | write_begin: locks the page yes |
| 192 | write_end: no yes, unlocks yes | 215 | write_end: yes, unlocks yes |
| 193 | perform_write: no n/a yes | 216 | bmap: |
| 194 | bmap: no | 217 | invalidatepage: yes |
| 195 | invalidatepage: no yes | 218 | releasepage: yes |
| 196 | releasepage: no yes | 219 | freepage: yes |
| 197 | freepage: no yes | 220 | direct_IO: |
| 198 | direct_IO: no | 221 | get_xip_mem: maybe |
| 199 | launder_page: no yes | 222 | migratepage: yes (both) |
| 223 | launder_page: yes | ||
| 224 | is_partially_uptodate: yes | ||
| 225 | error_remove_page: yes | ||
| 200 | 226 | ||
| 201 | ->write_begin(), ->write_end(), ->sync_page() and ->readpage() | 227 | ->write_begin(), ->write_end(), ->sync_page() and ->readpage() |
| 202 | may be called from the request handler (/dev/loop). | 228 | may be called from the request handler (/dev/loop). |
| @@ -276,9 +302,8 @@ under spinlock (it cannot block) and is sometimes called with the page | |||
| 276 | not locked. | 302 | not locked. |
| 277 | 303 | ||
| 278 | ->bmap() is currently used by legacy ioctl() (FIBMAP) provided by some | 304 | ->bmap() is currently used by legacy ioctl() (FIBMAP) provided by some |
| 279 | filesystems and by the swapper. The latter will eventually go away. All | 305 | filesystems and by the swapper. The latter will eventually go away. Please, |
| 280 | instances do not actually need the BKL. Please, keep it that way and don't | 306 | keep it that way and don't breed new callers. |
| 281 | breed new callers. | ||
| 282 | 307 | ||
| 283 | ->invalidatepage() is called when the filesystem must attempt to drop | 308 | ->invalidatepage() is called when the filesystem must attempt to drop |
| 284 | some or all of the buffers from the page when it is being truncated. It | 309 | some or all of the buffers from the page when it is being truncated. It |
| @@ -299,47 +324,37 @@ cleaned, or an error value if not. Note that in order to prevent the page | |||
| 299 | getting mapped back in and redirtied, it needs to be kept locked | 324 | getting mapped back in and redirtied, it needs to be kept locked |
| 300 | across the entire operation. | 325 | across the entire operation. |
| 301 | 326 | ||
| 302 | Note: currently almost all instances of address_space methods are | ||
| 303 | using BKL for internal serialization and that's one of the worst sources | ||
| 304 | of contention. Normally they are calling library functions (in fs/buffer.c) | ||
| 305 | and pass foo_get_block() as a callback (on local block-based filesystems, | ||
| 306 | indeed). BKL is not needed for library stuff and is usually taken by | ||
| 307 | foo_get_block(). It's an overkill, since block bitmaps can be protected by | ||
| 308 | internal fs locking and real critical areas are much smaller than the areas | ||
| 309 | filesystems protect now. | ||
| 310 | |||
| 311 | ----------------------- file_lock_operations ------------------------------ | 327 | ----------------------- file_lock_operations ------------------------------ |
| 312 | prototypes: | 328 | prototypes: |
| 313 | void (*fl_insert)(struct file_lock *); /* lock insertion callback */ | ||
| 314 | void (*fl_remove)(struct file_lock *); /* lock removal callback */ | ||
| 315 | void (*fl_copy_lock)(struct file_lock *, struct file_lock *); | 329 | void (*fl_copy_lock)(struct file_lock *, struct file_lock *); |
| 316 | void (*fl_release_private)(struct file_lock *); | 330 | void (*fl_release_private)(struct file_lock *); |
| 317 | 331 | ||
| 318 | 332 | ||
| 319 | locking rules: | 333 | locking rules: |
| 320 | BKL may block | 334 | file_lock_lock may block |
| 321 | fl_insert: yes no | 335 | fl_copy_lock: yes no |
| 322 | fl_remove: yes no | 336 | fl_release_private: maybe no |
| 323 | fl_copy_lock: yes no | ||
| 324 | fl_release_private: yes yes | ||
| 325 | 337 | ||
| 326 | ----------------------- lock_manager_operations --------------------------- | 338 | ----------------------- lock_manager_operations --------------------------- |
| 327 | prototypes: | 339 | prototypes: |
| 328 | int (*fl_compare_owner)(struct file_lock *, struct file_lock *); | 340 | int (*fl_compare_owner)(struct file_lock *, struct file_lock *); |
| 329 | void (*fl_notify)(struct file_lock *); /* unblock callback */ | 341 | void (*fl_notify)(struct file_lock *); /* unblock callback */ |
| 342 | int (*fl_grant)(struct file_lock *, struct file_lock *, int); | ||
| 330 | void (*fl_release_private)(struct file_lock *); | 343 | void (*fl_release_private)(struct file_lock *); |
| 331 | void (*fl_break)(struct file_lock *); /* break_lease callback */ | 344 | void (*fl_break)(struct file_lock *); /* break_lease callback */ |
| 345 | int (*fl_mylease)(struct file_lock *, struct file_lock *); | ||
| 346 | int (*fl_change)(struct file_lock **, int); | ||
| 332 | 347 | ||
| 333 | locking rules: | 348 | locking rules: |
| 334 | BKL may block | 349 | file_lock_lock may block |
| 335 | fl_compare_owner: yes no | 350 | fl_compare_owner: yes no |
| 336 | fl_notify: yes no | 351 | fl_notify: yes no |
| 337 | fl_release_private: yes yes | 352 | fl_grant: no no |
| 338 | fl_break: yes no | 353 | fl_release_private: maybe no |
| 339 | 354 | fl_break: yes no | |
| 340 | Currently only NFSD and NLM provide instances of this class. None of the | 355 | fl_mylease: yes no |
| 341 | them block. If you have out-of-tree instances - please, show up. Locking | 356 | fl_change yes no |
| 342 | in that area will change. | 357 | |
| 343 | --------------------------- buffer_head ----------------------------------- | 358 | --------------------------- buffer_head ----------------------------------- |
| 344 | prototypes: | 359 | prototypes: |
| 345 | void (*b_end_io)(struct buffer_head *bh, int uptodate); | 360 | void (*b_end_io)(struct buffer_head *bh, int uptodate); |
| @@ -364,17 +379,17 @@ prototypes: | |||
| 364 | void (*swap_slot_free_notify) (struct block_device *, unsigned long); | 379 | void (*swap_slot_free_notify) (struct block_device *, unsigned long); |
| 365 | 380 | ||
| 366 | locking rules: | 381 | locking rules: |
| 367 | BKL bd_mutex | 382 | bd_mutex |
| 368 | open: no yes | 383 | open: yes |
| 369 | release: no yes | 384 | release: yes |
| 370 | ioctl: no no | 385 | ioctl: no |
| 371 | compat_ioctl: no no | 386 | compat_ioctl: no |
| 372 | direct_access: no no | 387 | direct_access: no |
| 373 | media_changed: no no | 388 | media_changed: no |
| 374 | unlock_native_capacity: no no | 389 | unlock_native_capacity: no |
| 375 | revalidate_disk: no no | 390 | revalidate_disk: no |
| 376 | getgeo: no no | 391 | getgeo: no |
| 377 | swap_slot_free_notify: no no (see below) | 392 | swap_slot_free_notify: no (see below) |
| 378 | 393 | ||
| 379 | media_changed, unlock_native_capacity and revalidate_disk are called only from | 394 | media_changed, unlock_native_capacity and revalidate_disk are called only from |
| 380 | check_disk_change(). | 395 | check_disk_change(). |
| @@ -413,34 +428,21 @@ prototypes: | |||
| 413 | unsigned long (*get_unmapped_area)(struct file *, unsigned long, | 428 | unsigned long (*get_unmapped_area)(struct file *, unsigned long, |
| 414 | unsigned long, unsigned long, unsigned long); | 429 | unsigned long, unsigned long, unsigned long); |
| 415 | int (*check_flags)(int); | 430 | int (*check_flags)(int); |
| 431 | int (*flock) (struct file *, int, struct file_lock *); | ||
| 432 | ssize_t (*splice_write)(struct pipe_inode_info *, struct file *, loff_t *, | ||
| 433 | size_t, unsigned int); | ||
| 434 | ssize_t (*splice_read)(struct file *, loff_t *, struct pipe_inode_info *, | ||
| 435 | size_t, unsigned int); | ||
| 436 | int (*setlease)(struct file *, long, struct file_lock **); | ||
| 416 | }; | 437 | }; |
| 417 | 438 | ||
| 418 | locking rules: | 439 | locking rules: |
| 419 | All may block. | 440 | All may block except for ->setlease. |
| 420 | BKL | 441 | No VFS locks held on entry except for ->fsync and ->setlease. |
| 421 | llseek: no (see below) | 442 | |
| 422 | read: no | 443 | ->fsync() has i_mutex on inode. |
| 423 | aio_read: no | 444 | |
| 424 | write: no | 445 | ->setlease has the file_list_lock held and must not sleep. |
| 425 | aio_write: no | ||
| 426 | readdir: no | ||
| 427 | poll: no | ||
| 428 | unlocked_ioctl: no | ||
| 429 | compat_ioctl: no | ||
| 430 | mmap: no | ||
| 431 | open: no | ||
| 432 | flush: no | ||
| 433 | release: no | ||
| 434 | fsync: no (see below) | ||
| 435 | aio_fsync: no | ||
| 436 | fasync: no | ||
| 437 | lock: yes | ||
| 438 | readv: no | ||
| 439 | writev: no | ||
| 440 | sendfile: no | ||
| 441 | sendpage: no | ||
| 442 | get_unmapped_area: no | ||
| 443 | check_flags: no | ||
| 444 | 446 | ||
| 445 | ->llseek() locking has moved from llseek to the individual llseek | 447 | ->llseek() locking has moved from llseek to the individual llseek |
| 446 | implementations. If your fs is not using generic_file_llseek, you | 448 | implementations. If your fs is not using generic_file_llseek, you |
| @@ -450,17 +452,10 @@ mutex or just to use i_size_read() instead. | |||
| 450 | Note: this does not protect the file->f_pos against concurrent modifications | 452 | Note: this does not protect the file->f_pos against concurrent modifications |
| 451 | since this is something the userspace has to take care about. | 453 | since this is something the userspace has to take care about. |
| 452 | 454 | ||
| 453 | Note: ext2_release() was *the* source of contention on fs-intensive | 455 | ->fasync() is responsible for maintaining the FASYNC bit in filp->f_flags. |
| 454 | loads and dropping BKL on ->release() helps to get rid of that (we still | 456 | Most instances call fasync_helper(), which does that maintenance, so it's |
| 455 | grab BKL for cases when we close a file that had been opened r/w, but that | 457 | not normally something one needs to worry about. Return values > 0 will be |
| 456 | can and should be done using the internal locking with smaller critical areas). | 458 | mapped to zero in the VFS layer. |
| 457 | Current worst offender is ext2_get_block()... | ||
| 458 | |||
| 459 | ->fasync() is called without BKL protection, and is responsible for | ||
| 460 | maintaining the FASYNC bit in filp->f_flags. Most instances call | ||
| 461 | fasync_helper(), which does that maintenance, so it's not normally | ||
| 462 | something one needs to worry about. Return values > 0 will be mapped to | ||
| 463 | zero in the VFS layer. | ||
| 464 | 459 | ||
| 465 | ->readdir() and ->ioctl() on directories must be changed. Ideally we would | 460 | ->readdir() and ->ioctl() on directories must be changed. Ideally we would |
| 466 | move ->readdir() to inode_operations and use a separate method for directory | 461 | move ->readdir() to inode_operations and use a separate method for directory |
| @@ -471,8 +466,6 @@ components. And there are other reasons why the current interface is a mess... | |||
| 471 | ->read on directories probably must go away - we should just enforce -EISDIR | 466 | ->read on directories probably must go away - we should just enforce -EISDIR |
| 472 | in sys_read() and friends. | 467 | in sys_read() and friends. |
| 473 | 468 | ||
| 474 | ->fsync() has i_mutex on inode. | ||
| 475 | |||
| 476 | --------------------------- dquot_operations ------------------------------- | 469 | --------------------------- dquot_operations ------------------------------- |
| 477 | prototypes: | 470 | prototypes: |
| 478 | int (*write_dquot) (struct dquot *); | 471 | int (*write_dquot) (struct dquot *); |
| @@ -507,12 +500,12 @@ prototypes: | |||
| 507 | int (*access)(struct vm_area_struct *, unsigned long, void*, int, int); | 500 | int (*access)(struct vm_area_struct *, unsigned long, void*, int, int); |
| 508 | 501 | ||
| 509 | locking rules: | 502 | locking rules: |
| 510 | BKL mmap_sem PageLocked(page) | 503 | mmap_sem PageLocked(page) |
| 511 | open: no yes | 504 | open: yes |
| 512 | close: no yes | 505 | close: yes |
| 513 | fault: no yes can return with page locked | 506 | fault: yes can return with page locked |
| 514 | page_mkwrite: no yes can return with page locked | 507 | page_mkwrite: yes can return with page locked |
| 515 | access: no yes | 508 | access: yes |
| 516 | 509 | ||
| 517 | ->fault() is called when a previously not present pte is about | 510 | ->fault() is called when a previously not present pte is about |
| 518 | to be faulted in. The filesystem must find and return the page associated | 511 | to be faulted in. The filesystem must find and return the page associated |
| @@ -539,6 +532,3 @@ VM_IO | VM_PFNMAP VMAs. | |||
| 539 | 532 | ||
| 540 | (if you break something or notice that it is broken and do not fix it yourself | 533 | (if you break something or notice that it is broken and do not fix it yourself |
| 541 | - at least put it here) | 534 | - at least put it here) |
| 542 | |||
| 543 | ipc/shm.c::shm_delete() - may need BKL. | ||
| 544 | ->read() and ->write() in many drivers are (probably) missing BKL. | ||
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index 8b61c9360999..01ece1b9213e 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt | |||
| @@ -1759,7 +1759,7 @@ and is between 256 and 4096 characters. It is defined in the file | |||
| 1759 | 1759 | ||
| 1760 | nousb [USB] Disable the USB subsystem | 1760 | nousb [USB] Disable the USB subsystem |
| 1761 | 1761 | ||
| 1762 | nowatchdog [KNL] Disable the lockup detector. | 1762 | nowatchdog [KNL] Disable the lockup detector (NMI watchdog). |
| 1763 | 1763 | ||
| 1764 | nowb [ARM] | 1764 | nowb [ARM] |
| 1765 | 1765 | ||
diff --git a/arch/mn10300/kernel/irq.c b/arch/mn10300/kernel/irq.c index c2e44597c22b..ac11754ecec5 100644 --- a/arch/mn10300/kernel/irq.c +++ b/arch/mn10300/kernel/irq.c | |||
| @@ -459,7 +459,7 @@ void migrate_irqs(void) | |||
| 459 | tmp = CROSS_GxICR(irq, new); | 459 | tmp = CROSS_GxICR(irq, new); |
| 460 | 460 | ||
| 461 | x &= GxICR_LEVEL | GxICR_ENABLE; | 461 | x &= GxICR_LEVEL | GxICR_ENABLE; |
| 462 | if (GxICR(irq) & GxICR_REQUEST) { | 462 | if (GxICR(irq) & GxICR_REQUEST) |
| 463 | x |= GxICR_REQUEST | GxICR_DETECT; | 463 | x |= GxICR_REQUEST | GxICR_DETECT; |
| 464 | CROSS_GxICR(irq, new) = x; | 464 | CROSS_GxICR(irq, new) = x; |
| 465 | tmp = CROSS_GxICR(irq, new); | 465 | tmp = CROSS_GxICR(irq, new); |
diff --git a/arch/x86/kvm/i8259.c b/arch/x86/kvm/i8259.c index f628234fbeca..3cece05e4ac4 100644 --- a/arch/x86/kvm/i8259.c +++ b/arch/x86/kvm/i8259.c | |||
| @@ -575,6 +575,8 @@ struct kvm_pic *kvm_create_pic(struct kvm *kvm) | |||
| 575 | s->pics[1].elcr_mask = 0xde; | 575 | s->pics[1].elcr_mask = 0xde; |
| 576 | s->pics[0].pics_state = s; | 576 | s->pics[0].pics_state = s; |
| 577 | s->pics[1].pics_state = s; | 577 | s->pics[1].pics_state = s; |
| 578 | s->pics[0].isr_ack = 0xff; | ||
| 579 | s->pics[1].isr_ack = 0xff; | ||
| 578 | 580 | ||
| 579 | /* | 581 | /* |
| 580 | * Initialize PIO device | 582 | * Initialize PIO device |
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index fb8b376bf28c..fbb04aee8301 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c | |||
| @@ -2394,7 +2394,8 @@ static int mmu_alloc_direct_roots(struct kvm_vcpu *vcpu) | |||
| 2394 | ASSERT(!VALID_PAGE(root)); | 2394 | ASSERT(!VALID_PAGE(root)); |
| 2395 | spin_lock(&vcpu->kvm->mmu_lock); | 2395 | spin_lock(&vcpu->kvm->mmu_lock); |
| 2396 | kvm_mmu_free_some_pages(vcpu); | 2396 | kvm_mmu_free_some_pages(vcpu); |
| 2397 | sp = kvm_mmu_get_page(vcpu, i << 30, i << 30, | 2397 | sp = kvm_mmu_get_page(vcpu, i << (30 - PAGE_SHIFT), |
| 2398 | i << 30, | ||
| 2398 | PT32_ROOT_LEVEL, 1, ACC_ALL, | 2399 | PT32_ROOT_LEVEL, 1, ACC_ALL, |
| 2399 | NULL); | 2400 | NULL); |
| 2400 | root = __pa(sp->spt); | 2401 | root = __pa(sp->spt); |
diff --git a/arch/x86/oprofile/op_model_amd.c b/arch/x86/oprofile/op_model_amd.c index a011bcc0f943..7d90d47655ba 100644 --- a/arch/x86/oprofile/op_model_amd.c +++ b/arch/x86/oprofile/op_model_amd.c | |||
| @@ -630,21 +630,29 @@ static int __init_ibs_nmi(void) | |||
| 630 | return 0; | 630 | return 0; |
| 631 | } | 631 | } |
| 632 | 632 | ||
| 633 | /* initialize the APIC for the IBS interrupts if available */ | 633 | /* |
| 634 | * check and reserve APIC extended interrupt LVT offset for IBS if | ||
| 635 | * available | ||
| 636 | * | ||
| 637 | * init_ibs() preforms implicitly cpu-local operations, so pin this | ||
| 638 | * thread to its current CPU | ||
| 639 | */ | ||
| 640 | |||
| 634 | static void init_ibs(void) | 641 | static void init_ibs(void) |
| 635 | { | 642 | { |
| 636 | ibs_caps = get_ibs_caps(); | 643 | preempt_disable(); |
| 637 | 644 | ||
| 645 | ibs_caps = get_ibs_caps(); | ||
| 638 | if (!ibs_caps) | 646 | if (!ibs_caps) |
| 639 | return; | 647 | goto out; |
| 640 | 648 | ||
| 641 | if (__init_ibs_nmi()) { | 649 | if (__init_ibs_nmi() < 0) |
| 642 | ibs_caps = 0; | 650 | ibs_caps = 0; |
| 643 | return; | 651 | else |
| 644 | } | 652 | printk(KERN_INFO "oprofile: AMD IBS detected (0x%08x)\n", ibs_caps); |
| 645 | 653 | ||
| 646 | printk(KERN_INFO "oprofile: AMD IBS detected (0x%08x)\n", | 654 | out: |
| 647 | (unsigned)ibs_caps); | 655 | preempt_enable(); |
| 648 | } | 656 | } |
| 649 | 657 | ||
| 650 | static int (*create_arch_files)(struct super_block *sb, struct dentry *root); | 658 | static int (*create_arch_files)(struct super_block *sb, struct dentry *root); |
diff --git a/drivers/dma/mv_xor.c b/drivers/dma/mv_xor.c index 411d5bf50fc4..a25f5f61e0e0 100644 --- a/drivers/dma/mv_xor.c +++ b/drivers/dma/mv_xor.c | |||
| @@ -449,7 +449,7 @@ mv_xor_slot_cleanup(struct mv_xor_chan *mv_chan) | |||
| 449 | static void mv_xor_tasklet(unsigned long data) | 449 | static void mv_xor_tasklet(unsigned long data) |
| 450 | { | 450 | { |
| 451 | struct mv_xor_chan *chan = (struct mv_xor_chan *) data; | 451 | struct mv_xor_chan *chan = (struct mv_xor_chan *) data; |
| 452 | __mv_xor_slot_cleanup(chan); | 452 | mv_xor_slot_cleanup(chan); |
| 453 | } | 453 | } |
| 454 | 454 | ||
| 455 | static struct mv_xor_desc_slot * | 455 | static struct mv_xor_desc_slot * |
diff --git a/drivers/gpu/drm/i915/dvo_ch7017.c b/drivers/gpu/drm/i915/dvo_ch7017.c index af70337567ce..d3e8c540f778 100644 --- a/drivers/gpu/drm/i915/dvo_ch7017.c +++ b/drivers/gpu/drm/i915/dvo_ch7017.c | |||
| @@ -242,7 +242,7 @@ fail: | |||
| 242 | 242 | ||
| 243 | static enum drm_connector_status ch7017_detect(struct intel_dvo_device *dvo) | 243 | static enum drm_connector_status ch7017_detect(struct intel_dvo_device *dvo) |
| 244 | { | 244 | { |
| 245 | return connector_status_unknown; | 245 | return connector_status_connected; |
| 246 | } | 246 | } |
| 247 | 247 | ||
| 248 | static enum drm_mode_status ch7017_mode_valid(struct intel_dvo_device *dvo, | 248 | static enum drm_mode_status ch7017_mode_valid(struct intel_dvo_device *dvo, |
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index e6800819bca8..cb900dc83d95 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c | |||
| @@ -34,6 +34,7 @@ | |||
| 34 | #include "i915_drm.h" | 34 | #include "i915_drm.h" |
| 35 | #include "i915_drv.h" | 35 | #include "i915_drv.h" |
| 36 | #include "i915_trace.h" | 36 | #include "i915_trace.h" |
| 37 | #include "../../../platform/x86/intel_ips.h" | ||
| 37 | #include <linux/pci.h> | 38 | #include <linux/pci.h> |
| 38 | #include <linux/vgaarb.h> | 39 | #include <linux/vgaarb.h> |
| 39 | #include <linux/acpi.h> | 40 | #include <linux/acpi.h> |
| @@ -1871,6 +1872,26 @@ out_unlock: | |||
| 1871 | EXPORT_SYMBOL_GPL(i915_gpu_turbo_disable); | 1872 | EXPORT_SYMBOL_GPL(i915_gpu_turbo_disable); |
| 1872 | 1873 | ||
| 1873 | /** | 1874 | /** |
| 1875 | * Tells the intel_ips driver that the i915 driver is now loaded, if | ||
| 1876 | * IPS got loaded first. | ||
| 1877 | * | ||
| 1878 | * This awkward dance is so that neither module has to depend on the | ||
| 1879 | * other in order for IPS to do the appropriate communication of | ||
| 1880 | * GPU turbo limits to i915. | ||
| 1881 | */ | ||
| 1882 | static void | ||
| 1883 | ips_ping_for_i915_load(void) | ||
| 1884 | { | ||
| 1885 | void (*link)(void); | ||
| 1886 | |||
| 1887 | link = symbol_get(ips_link_to_i915_driver); | ||
| 1888 | if (link) { | ||
| 1889 | link(); | ||
| 1890 | symbol_put(ips_link_to_i915_driver); | ||
| 1891 | } | ||
| 1892 | } | ||
| 1893 | |||
| 1894 | /** | ||
| 1874 | * i915_driver_load - setup chip and create an initial config | 1895 | * i915_driver_load - setup chip and create an initial config |
| 1875 | * @dev: DRM device | 1896 | * @dev: DRM device |
| 1876 | * @flags: startup flags | 1897 | * @flags: startup flags |
| @@ -2075,6 +2096,8 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) | |||
| 2075 | dev_priv->mchdev_lock = &mchdev_lock; | 2096 | dev_priv->mchdev_lock = &mchdev_lock; |
| 2076 | spin_unlock(&mchdev_lock); | 2097 | spin_unlock(&mchdev_lock); |
| 2077 | 2098 | ||
| 2099 | ips_ping_for_i915_load(); | ||
| 2100 | |||
| 2078 | return 0; | 2101 | return 0; |
| 2079 | 2102 | ||
| 2080 | out_workqueue_free: | 2103 | out_workqueue_free: |
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index 878fc766a12c..cb8f43429279 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h | |||
| @@ -2471,6 +2471,9 @@ | |||
| 2471 | # define MARIUNIT_CLOCK_GATE_DISABLE (1 << 18) | 2471 | # define MARIUNIT_CLOCK_GATE_DISABLE (1 << 18) |
| 2472 | # define SVSMUNIT_CLOCK_GATE_DISABLE (1 << 1) | 2472 | # define SVSMUNIT_CLOCK_GATE_DISABLE (1 << 1) |
| 2473 | 2473 | ||
| 2474 | #define PCH_3DCGDIS1 0x46024 | ||
| 2475 | # define VFMUNIT_CLOCK_GATE_DISABLE (1 << 11) | ||
| 2476 | |||
| 2474 | #define FDI_PLL_FREQ_CTL 0x46030 | 2477 | #define FDI_PLL_FREQ_CTL 0x46030 |
| 2475 | #define FDI_PLL_FREQ_CHANGE_REQUEST (1<<24) | 2478 | #define FDI_PLL_FREQ_CHANGE_REQUEST (1<<24) |
| 2476 | #define FDI_PLL_FREQ_LOCK_LIMIT_MASK 0xfff00 | 2479 | #define FDI_PLL_FREQ_LOCK_LIMIT_MASK 0xfff00 |
| @@ -2588,6 +2591,13 @@ | |||
| 2588 | #define ILK_DISPLAY_CHICKEN2 0x42004 | 2591 | #define ILK_DISPLAY_CHICKEN2 0x42004 |
| 2589 | #define ILK_DPARB_GATE (1<<22) | 2592 | #define ILK_DPARB_GATE (1<<22) |
| 2590 | #define ILK_VSDPFD_FULL (1<<21) | 2593 | #define ILK_VSDPFD_FULL (1<<21) |
| 2594 | #define ILK_DISPLAY_CHICKEN_FUSES 0x42014 | ||
| 2595 | #define ILK_INTERNAL_GRAPHICS_DISABLE (1<<31) | ||
| 2596 | #define ILK_INTERNAL_DISPLAY_DISABLE (1<<30) | ||
| 2597 | #define ILK_DISPLAY_DEBUG_DISABLE (1<<29) | ||
| 2598 | #define ILK_HDCP_DISABLE (1<<25) | ||
| 2599 | #define ILK_eDP_A_DISABLE (1<<24) | ||
| 2600 | #define ILK_DESKTOP (1<<23) | ||
| 2591 | #define ILK_DSPCLK_GATE 0x42020 | 2601 | #define ILK_DSPCLK_GATE 0x42020 |
| 2592 | #define ILK_DPARB_CLK_GATE (1<<5) | 2602 | #define ILK_DPARB_CLK_GATE (1<<5) |
| 2593 | /* According to spec this bit 7/8/9 of 0x42020 should be set to enable FBC */ | 2603 | /* According to spec this bit 7/8/9 of 0x42020 should be set to enable FBC */ |
diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c index 2b2078695d2a..b0b1200ed650 100644 --- a/drivers/gpu/drm/i915/intel_bios.c +++ b/drivers/gpu/drm/i915/intel_bios.c | |||
| @@ -270,7 +270,7 @@ parse_general_features(struct drm_i915_private *dev_priv, | |||
| 270 | general->ssc_freq ? 66 : 48; | 270 | general->ssc_freq ? 66 : 48; |
| 271 | else if (IS_GEN5(dev) || IS_GEN6(dev)) | 271 | else if (IS_GEN5(dev) || IS_GEN6(dev)) |
| 272 | dev_priv->lvds_ssc_freq = | 272 | dev_priv->lvds_ssc_freq = |
| 273 | general->ssc_freq ? 120 : 100; | 273 | general->ssc_freq ? 100 : 120; |
| 274 | else | 274 | else |
| 275 | dev_priv->lvds_ssc_freq = | 275 | dev_priv->lvds_ssc_freq = |
| 276 | general->ssc_freq ? 100 : 96; | 276 | general->ssc_freq ? 100 : 96; |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index d9b7092439ef..fca523288aca 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
| @@ -5379,6 +5379,23 @@ static int intel_encoder_clones(struct drm_device *dev, int type_mask) | |||
| 5379 | return index_mask; | 5379 | return index_mask; |
| 5380 | } | 5380 | } |
| 5381 | 5381 | ||
| 5382 | static bool has_edp_a(struct drm_device *dev) | ||
| 5383 | { | ||
| 5384 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
| 5385 | |||
| 5386 | if (!IS_MOBILE(dev)) | ||
| 5387 | return false; | ||
| 5388 | |||
| 5389 | if ((I915_READ(DP_A) & DP_DETECTED) == 0) | ||
| 5390 | return false; | ||
| 5391 | |||
| 5392 | if (IS_GEN5(dev) && | ||
| 5393 | (I915_READ(ILK_DISPLAY_CHICKEN_FUSES) & ILK_eDP_A_DISABLE)) | ||
| 5394 | return false; | ||
| 5395 | |||
| 5396 | return true; | ||
| 5397 | } | ||
| 5398 | |||
| 5382 | static void intel_setup_outputs(struct drm_device *dev) | 5399 | static void intel_setup_outputs(struct drm_device *dev) |
| 5383 | { | 5400 | { |
| 5384 | struct drm_i915_private *dev_priv = dev->dev_private; | 5401 | struct drm_i915_private *dev_priv = dev->dev_private; |
| @@ -5396,7 +5413,7 @@ static void intel_setup_outputs(struct drm_device *dev) | |||
| 5396 | if (HAS_PCH_SPLIT(dev)) { | 5413 | if (HAS_PCH_SPLIT(dev)) { |
| 5397 | dpd_is_edp = intel_dpd_is_edp(dev); | 5414 | dpd_is_edp = intel_dpd_is_edp(dev); |
| 5398 | 5415 | ||
| 5399 | if (IS_MOBILE(dev) && (I915_READ(DP_A) & DP_DETECTED)) | 5416 | if (has_edp_a(dev)) |
| 5400 | intel_dp_init(dev, DP_A); | 5417 | intel_dp_init(dev, DP_A); |
| 5401 | 5418 | ||
| 5402 | if (dpd_is_edp && (I915_READ(PCH_DP_D) & DP_DETECTED)) | 5419 | if (dpd_is_edp && (I915_READ(PCH_DP_D) & DP_DETECTED)) |
| @@ -5825,6 +5842,8 @@ void intel_init_clock_gating(struct drm_device *dev) | |||
| 5825 | I915_WRITE(PCH_3DCGDIS0, | 5842 | I915_WRITE(PCH_3DCGDIS0, |
| 5826 | MARIUNIT_CLOCK_GATE_DISABLE | | 5843 | MARIUNIT_CLOCK_GATE_DISABLE | |
| 5827 | SVSMUNIT_CLOCK_GATE_DISABLE); | 5844 | SVSMUNIT_CLOCK_GATE_DISABLE); |
| 5845 | I915_WRITE(PCH_3DCGDIS1, | ||
| 5846 | VFMUNIT_CLOCK_GATE_DISABLE); | ||
| 5828 | } | 5847 | } |
| 5829 | 5848 | ||
| 5830 | I915_WRITE(PCH_DSPCLK_GATE_D, dspclk_gate); | 5849 | I915_WRITE(PCH_DSPCLK_GATE_D, dspclk_gate); |
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c index 27e63abf2a73..6bc42fa2a6ec 100644 --- a/drivers/gpu/drm/i915/intel_sdvo.c +++ b/drivers/gpu/drm/i915/intel_sdvo.c | |||
| @@ -2040,13 +2040,14 @@ intel_sdvo_dvi_init(struct intel_sdvo *intel_sdvo, int device) | |||
| 2040 | SDVO_COLORIMETRY_RGB256); | 2040 | SDVO_COLORIMETRY_RGB256); |
| 2041 | connector->connector_type = DRM_MODE_CONNECTOR_HDMIA; | 2041 | connector->connector_type = DRM_MODE_CONNECTOR_HDMIA; |
| 2042 | 2042 | ||
| 2043 | intel_sdvo_add_hdmi_properties(intel_sdvo_connector); | ||
| 2044 | intel_sdvo->is_hdmi = true; | 2043 | intel_sdvo->is_hdmi = true; |
| 2045 | } | 2044 | } |
| 2046 | intel_sdvo->base.clone_mask = ((1 << INTEL_SDVO_NON_TV_CLONE_BIT) | | 2045 | intel_sdvo->base.clone_mask = ((1 << INTEL_SDVO_NON_TV_CLONE_BIT) | |
| 2047 | (1 << INTEL_ANALOG_CLONE_BIT)); | 2046 | (1 << INTEL_ANALOG_CLONE_BIT)); |
| 2048 | 2047 | ||
| 2049 | intel_sdvo_connector_init(intel_sdvo_connector, intel_sdvo); | 2048 | intel_sdvo_connector_init(intel_sdvo_connector, intel_sdvo); |
| 2049 | if (intel_sdvo->is_hdmi) | ||
| 2050 | intel_sdvo_add_hdmi_properties(intel_sdvo_connector); | ||
| 2050 | 2051 | ||
| 2051 | return true; | 2052 | return true; |
| 2052 | } | 2053 | } |
diff --git a/drivers/hwmon/s3c-hwmon.c b/drivers/hwmon/s3c-hwmon.c index 05248f2d7581..92b42db43bcf 100644 --- a/drivers/hwmon/s3c-hwmon.c +++ b/drivers/hwmon/s3c-hwmon.c | |||
| @@ -234,7 +234,6 @@ static int s3c_hwmon_create_attr(struct device *dev, | |||
| 234 | attr->index = channel; | 234 | attr->index = channel; |
| 235 | attr->dev_attr.attr.name = attrs->in_name; | 235 | attr->dev_attr.attr.name = attrs->in_name; |
| 236 | attr->dev_attr.attr.mode = S_IRUGO; | 236 | attr->dev_attr.attr.mode = S_IRUGO; |
| 237 | attr->dev_attr.attr.owner = THIS_MODULE; | ||
| 238 | attr->dev_attr.show = s3c_hwmon_ch_show; | 237 | attr->dev_attr.show = s3c_hwmon_ch_show; |
| 239 | 238 | ||
| 240 | ret = device_create_file(dev, &attr->dev_attr); | 239 | ret = device_create_file(dev, &attr->dev_attr); |
| @@ -252,7 +251,6 @@ static int s3c_hwmon_create_attr(struct device *dev, | |||
| 252 | attr->index = channel; | 251 | attr->index = channel; |
| 253 | attr->dev_attr.attr.name = attrs->label_name; | 252 | attr->dev_attr.attr.name = attrs->label_name; |
| 254 | attr->dev_attr.attr.mode = S_IRUGO; | 253 | attr->dev_attr.attr.mode = S_IRUGO; |
| 255 | attr->dev_attr.attr.owner = THIS_MODULE; | ||
| 256 | attr->dev_attr.show = s3c_hwmon_label_show; | 254 | attr->dev_attr.show = s3c_hwmon_label_show; |
| 257 | 255 | ||
| 258 | ret = device_create_file(dev, &attr->dev_attr); | 256 | ret = device_create_file(dev, &attr->dev_attr); |
diff --git a/drivers/media/video/cx25840/cx25840-core.c b/drivers/media/video/cx25840/cx25840-core.c index dfb198d0415b..f16461844c5c 100644 --- a/drivers/media/video/cx25840/cx25840-core.c +++ b/drivers/media/video/cx25840/cx25840-core.c | |||
| @@ -1989,8 +1989,23 @@ static int cx25840_probe(struct i2c_client *client, | |||
| 1989 | v4l2_ctrl_new_std(&state->hdl, &cx25840_ctrl_ops, | 1989 | v4l2_ctrl_new_std(&state->hdl, &cx25840_ctrl_ops, |
| 1990 | V4L2_CID_HUE, -128, 127, 1, 0); | 1990 | V4L2_CID_HUE, -128, 127, 1, 0); |
| 1991 | if (!is_cx2583x(state)) { | 1991 | if (!is_cx2583x(state)) { |
| 1992 | default_volume = 228 - cx25840_read(client, 0x8d4); | 1992 | default_volume = cx25840_read(client, 0x8d4); |
| 1993 | default_volume = ((default_volume / 2) + 23) << 9; | 1993 | /* |
| 1994 | * Enforce the legacy PVR-350/MSP3400 to PVR-150/CX25843 volume | ||
| 1995 | * scale mapping limits to avoid -ERANGE errors when | ||
| 1996 | * initializing the volume control | ||
| 1997 | */ | ||
| 1998 | if (default_volume > 228) { | ||
| 1999 | /* Bottom out at -96 dB, v4l2 vol range 0x2e00-0x2fff */ | ||
| 2000 | default_volume = 228; | ||
| 2001 | cx25840_write(client, 0x8d4, 228); | ||
| 2002 | } | ||
| 2003 | else if (default_volume < 20) { | ||
| 2004 | /* Top out at + 8 dB, v4l2 vol range 0xfe00-0xffff */ | ||
| 2005 | default_volume = 20; | ||
| 2006 | cx25840_write(client, 0x8d4, 20); | ||
| 2007 | } | ||
| 2008 | default_volume = (((228 - default_volume) >> 1) + 23) << 9; | ||
| 1994 | 2009 | ||
| 1995 | state->volume = v4l2_ctrl_new_std(&state->hdl, | 2010 | state->volume = v4l2_ctrl_new_std(&state->hdl, |
| 1996 | &cx25840_audio_ctrl_ops, V4L2_CID_AUDIO_VOLUME, | 2011 | &cx25840_audio_ctrl_ops, V4L2_CID_AUDIO_VOLUME, |
diff --git a/drivers/media/video/cx88/cx88-alsa.c b/drivers/media/video/cx88/cx88-alsa.c index 4aaa47c0eabf..54b7fcd469a8 100644 --- a/drivers/media/video/cx88/cx88-alsa.c +++ b/drivers/media/video/cx88/cx88-alsa.c | |||
| @@ -40,7 +40,6 @@ | |||
| 40 | #include <sound/control.h> | 40 | #include <sound/control.h> |
| 41 | #include <sound/initval.h> | 41 | #include <sound/initval.h> |
| 42 | #include <sound/tlv.h> | 42 | #include <sound/tlv.h> |
| 43 | #include <media/wm8775.h> | ||
| 44 | 43 | ||
| 45 | #include "cx88.h" | 44 | #include "cx88.h" |
| 46 | #include "cx88-reg.h" | 45 | #include "cx88-reg.h" |
| @@ -587,47 +586,26 @@ static int snd_cx88_volume_put(struct snd_kcontrol *kcontrol, | |||
| 587 | int left, right, v, b; | 586 | int left, right, v, b; |
| 588 | int changed = 0; | 587 | int changed = 0; |
| 589 | u32 old; | 588 | u32 old; |
| 590 | struct v4l2_control client_ctl; | ||
| 591 | |||
| 592 | /* Pass volume & balance onto any WM8775 */ | ||
| 593 | if (value->value.integer.value[0] >= value->value.integer.value[1]) { | ||
| 594 | v = value->value.integer.value[0] << 10; | ||
| 595 | b = value->value.integer.value[0] ? | ||
| 596 | (0x8000 * value->value.integer.value[1]) / value->value.integer.value[0] : | ||
| 597 | 0x8000; | ||
| 598 | } else { | ||
| 599 | v = value->value.integer.value[1] << 10; | ||
| 600 | b = value->value.integer.value[1] ? | ||
| 601 | 0xffff - (0x8000 * value->value.integer.value[0]) / value->value.integer.value[1] : | ||
| 602 | 0x8000; | ||
| 603 | } | ||
| 604 | client_ctl.value = v; | ||
| 605 | client_ctl.id = V4L2_CID_AUDIO_VOLUME; | ||
| 606 | call_hw(core, WM8775_GID, core, s_ctrl, &client_ctl); | ||
| 607 | |||
| 608 | client_ctl.value = b; | ||
| 609 | client_ctl.id = V4L2_CID_AUDIO_BALANCE; | ||
| 610 | call_hw(core, WM8775_GID, core, s_ctrl, &client_ctl); | ||
| 611 | 589 | ||
| 612 | left = value->value.integer.value[0] & 0x3f; | 590 | left = value->value.integer.value[0] & 0x3f; |
| 613 | right = value->value.integer.value[1] & 0x3f; | 591 | right = value->value.integer.value[1] & 0x3f; |
| 614 | b = right - left; | 592 | b = right - left; |
| 615 | if (b < 0) { | 593 | if (b < 0) { |
| 616 | v = 0x3f - left; | 594 | v = 0x3f - left; |
| 617 | b = (-b) | 0x40; | 595 | b = (-b) | 0x40; |
| 618 | } else { | 596 | } else { |
| 619 | v = 0x3f - right; | 597 | v = 0x3f - right; |
| 620 | } | 598 | } |
| 621 | /* Do we really know this will always be called with IRQs on? */ | 599 | /* Do we really know this will always be called with IRQs on? */ |
| 622 | spin_lock_irq(&chip->reg_lock); | 600 | spin_lock_irq(&chip->reg_lock); |
| 623 | old = cx_read(AUD_VOL_CTL); | 601 | old = cx_read(AUD_VOL_CTL); |
| 624 | if (v != (old & 0x3f)) { | 602 | if (v != (old & 0x3f)) { |
| 625 | cx_swrite(SHADOW_AUD_VOL_CTL, AUD_VOL_CTL, (old & ~0x3f) | v); | 603 | cx_write(AUD_VOL_CTL, (old & ~0x3f) | v); |
| 626 | changed = 1; | 604 | changed = 1; |
| 627 | } | 605 | } |
| 628 | if ((cx_read(AUD_BAL_CTL) & 0x7f) != b) { | 606 | if (cx_read(AUD_BAL_CTL) != b) { |
| 629 | cx_write(AUD_BAL_CTL, b); | 607 | cx_write(AUD_BAL_CTL, b); |
| 630 | changed = 1; | 608 | changed = 1; |
| 631 | } | 609 | } |
| 632 | spin_unlock_irq(&chip->reg_lock); | 610 | spin_unlock_irq(&chip->reg_lock); |
| 633 | 611 | ||
| @@ -640,7 +618,7 @@ static const struct snd_kcontrol_new snd_cx88_volume = { | |||
| 640 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 618 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 641 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | | 619 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | |
| 642 | SNDRV_CTL_ELEM_ACCESS_TLV_READ, | 620 | SNDRV_CTL_ELEM_ACCESS_TLV_READ, |
| 643 | .name = "Analog-TV Volume", | 621 | .name = "Playback Volume", |
| 644 | .info = snd_cx88_volume_info, | 622 | .info = snd_cx88_volume_info, |
| 645 | .get = snd_cx88_volume_get, | 623 | .get = snd_cx88_volume_get, |
| 646 | .put = snd_cx88_volume_put, | 624 | .put = snd_cx88_volume_put, |
| @@ -671,14 +649,7 @@ static int snd_cx88_switch_put(struct snd_kcontrol *kcontrol, | |||
| 671 | vol = cx_read(AUD_VOL_CTL); | 649 | vol = cx_read(AUD_VOL_CTL); |
| 672 | if (value->value.integer.value[0] != !(vol & bit)) { | 650 | if (value->value.integer.value[0] != !(vol & bit)) { |
| 673 | vol ^= bit; | 651 | vol ^= bit; |
| 674 | cx_swrite(SHADOW_AUD_VOL_CTL, AUD_VOL_CTL, vol); | 652 | cx_write(AUD_VOL_CTL, vol); |
| 675 | /* Pass mute onto any WM8775 */ | ||
| 676 | if ((1<<6) == bit) { | ||
| 677 | struct v4l2_control client_ctl; | ||
| 678 | client_ctl.value = 0 != (vol & bit); | ||
| 679 | client_ctl.id = V4L2_CID_AUDIO_MUTE; | ||
| 680 | call_hw(core, WM8775_GID, core, s_ctrl, &client_ctl); | ||
| 681 | } | ||
| 682 | ret = 1; | 653 | ret = 1; |
| 683 | } | 654 | } |
| 684 | spin_unlock_irq(&chip->reg_lock); | 655 | spin_unlock_irq(&chip->reg_lock); |
| @@ -687,7 +658,7 @@ static int snd_cx88_switch_put(struct snd_kcontrol *kcontrol, | |||
| 687 | 658 | ||
| 688 | static const struct snd_kcontrol_new snd_cx88_dac_switch = { | 659 | static const struct snd_kcontrol_new snd_cx88_dac_switch = { |
| 689 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 660 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 690 | .name = "Audio-Out Switch", | 661 | .name = "Playback Switch", |
| 691 | .info = snd_ctl_boolean_mono_info, | 662 | .info = snd_ctl_boolean_mono_info, |
| 692 | .get = snd_cx88_switch_get, | 663 | .get = snd_cx88_switch_get, |
| 693 | .put = snd_cx88_switch_put, | 664 | .put = snd_cx88_switch_put, |
| @@ -696,49 +667,13 @@ static const struct snd_kcontrol_new snd_cx88_dac_switch = { | |||
| 696 | 667 | ||
| 697 | static const struct snd_kcontrol_new snd_cx88_source_switch = { | 668 | static const struct snd_kcontrol_new snd_cx88_source_switch = { |
| 698 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 669 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 699 | .name = "Analog-TV Switch", | 670 | .name = "Capture Switch", |
| 700 | .info = snd_ctl_boolean_mono_info, | 671 | .info = snd_ctl_boolean_mono_info, |
| 701 | .get = snd_cx88_switch_get, | 672 | .get = snd_cx88_switch_get, |
| 702 | .put = snd_cx88_switch_put, | 673 | .put = snd_cx88_switch_put, |
| 703 | .private_value = (1<<6), | 674 | .private_value = (1<<6), |
| 704 | }; | 675 | }; |
| 705 | 676 | ||
| 706 | static int snd_cx88_alc_get(struct snd_kcontrol *kcontrol, | ||
| 707 | struct snd_ctl_elem_value *value) | ||
| 708 | { | ||
| 709 | snd_cx88_card_t *chip = snd_kcontrol_chip(kcontrol); | ||
| 710 | struct cx88_core *core = chip->core; | ||
| 711 | struct v4l2_control client_ctl; | ||
| 712 | |||
| 713 | client_ctl.id = V4L2_CID_AUDIO_LOUDNESS; | ||
| 714 | call_hw(core, WM8775_GID, core, g_ctrl, &client_ctl); | ||
| 715 | value->value.integer.value[0] = client_ctl.value ? 1 : 0; | ||
| 716 | |||
| 717 | return 0; | ||
| 718 | } | ||
| 719 | |||
| 720 | static int snd_cx88_alc_put(struct snd_kcontrol *kcontrol, | ||
| 721 | struct snd_ctl_elem_value *value) | ||
| 722 | { | ||
| 723 | snd_cx88_card_t *chip = snd_kcontrol_chip(kcontrol); | ||
| 724 | struct cx88_core *core = chip->core; | ||
| 725 | struct v4l2_control client_ctl; | ||
| 726 | |||
| 727 | client_ctl.value = 0 != value->value.integer.value[0]; | ||
| 728 | client_ctl.id = V4L2_CID_AUDIO_LOUDNESS; | ||
| 729 | call_hw(core, WM8775_GID, core, s_ctrl, &client_ctl); | ||
| 730 | |||
| 731 | return 0; | ||
| 732 | } | ||
| 733 | |||
| 734 | static struct snd_kcontrol_new snd_cx88_alc_switch = { | ||
| 735 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
| 736 | .name = "Line-In ALC Switch", | ||
| 737 | .info = snd_ctl_boolean_mono_info, | ||
| 738 | .get = snd_cx88_alc_get, | ||
| 739 | .put = snd_cx88_alc_put, | ||
| 740 | }; | ||
| 741 | |||
| 742 | /**************************************************************************** | 677 | /**************************************************************************** |
| 743 | Basic Flow for Sound Devices | 678 | Basic Flow for Sound Devices |
| 744 | ****************************************************************************/ | 679 | ****************************************************************************/ |
| @@ -860,7 +795,6 @@ static int __devinit cx88_audio_initdev(struct pci_dev *pci, | |||
| 860 | { | 795 | { |
| 861 | struct snd_card *card; | 796 | struct snd_card *card; |
| 862 | snd_cx88_card_t *chip; | 797 | snd_cx88_card_t *chip; |
| 863 | struct v4l2_subdev *sd; | ||
| 864 | int err; | 798 | int err; |
| 865 | 799 | ||
| 866 | if (devno >= SNDRV_CARDS) | 800 | if (devno >= SNDRV_CARDS) |
| @@ -896,15 +830,6 @@ static int __devinit cx88_audio_initdev(struct pci_dev *pci, | |||
| 896 | if (err < 0) | 830 | if (err < 0) |
| 897 | goto error; | 831 | goto error; |
| 898 | 832 | ||
| 899 | /* If there's a wm8775 then add a Line-In ALC switch */ | ||
| 900 | list_for_each_entry(sd, &chip->core->v4l2_dev.subdevs, list) { | ||
| 901 | if (WM8775_GID == sd->grp_id) { | ||
| 902 | snd_ctl_add(card, snd_ctl_new1(&snd_cx88_alc_switch, | ||
| 903 | chip)); | ||
| 904 | break; | ||
| 905 | } | ||
| 906 | } | ||
| 907 | |||
| 908 | strcpy (card->driver, "CX88x"); | 833 | strcpy (card->driver, "CX88x"); |
| 909 | sprintf(card->shortname, "Conexant CX%x", pci->device); | 834 | sprintf(card->shortname, "Conexant CX%x", pci->device); |
| 910 | sprintf(card->longname, "%s at %#llx", | 835 | sprintf(card->longname, "%s at %#llx", |
diff --git a/drivers/media/video/cx88/cx88-cards.c b/drivers/media/video/cx88/cx88-cards.c index 9b9e169cce90..0ccc2afd7266 100644 --- a/drivers/media/video/cx88/cx88-cards.c +++ b/drivers/media/video/cx88/cx88-cards.c | |||
| @@ -1007,15 +1007,22 @@ static const struct cx88_board cx88_boards[] = { | |||
| 1007 | .radio_type = UNSET, | 1007 | .radio_type = UNSET, |
| 1008 | .tuner_addr = ADDR_UNSET, | 1008 | .tuner_addr = ADDR_UNSET, |
| 1009 | .radio_addr = ADDR_UNSET, | 1009 | .radio_addr = ADDR_UNSET, |
| 1010 | .audio_chip = V4L2_IDENT_WM8775, | ||
| 1010 | .input = {{ | 1011 | .input = {{ |
| 1011 | .type = CX88_VMUX_DVB, | 1012 | .type = CX88_VMUX_DVB, |
| 1012 | .vmux = 0, | 1013 | .vmux = 0, |
| 1014 | /* 2: Line-In */ | ||
| 1015 | .audioroute = 2, | ||
| 1013 | },{ | 1016 | },{ |
| 1014 | .type = CX88_VMUX_COMPOSITE1, | 1017 | .type = CX88_VMUX_COMPOSITE1, |
| 1015 | .vmux = 1, | 1018 | .vmux = 1, |
| 1019 | /* 2: Line-In */ | ||
| 1020 | .audioroute = 2, | ||
| 1016 | },{ | 1021 | },{ |
| 1017 | .type = CX88_VMUX_SVIDEO, | 1022 | .type = CX88_VMUX_SVIDEO, |
| 1018 | .vmux = 2, | 1023 | .vmux = 2, |
| 1024 | /* 2: Line-In */ | ||
| 1025 | .audioroute = 2, | ||
| 1019 | }}, | 1026 | }}, |
| 1020 | .mpeg = CX88_MPEG_DVB, | 1027 | .mpeg = CX88_MPEG_DVB, |
| 1021 | }, | 1028 | }, |
diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c index 62cea9549404..d9249e5a04c9 100644 --- a/drivers/media/video/cx88/cx88-video.c +++ b/drivers/media/video/cx88/cx88-video.c | |||
| @@ -40,7 +40,6 @@ | |||
| 40 | #include "cx88.h" | 40 | #include "cx88.h" |
| 41 | #include <media/v4l2-common.h> | 41 | #include <media/v4l2-common.h> |
| 42 | #include <media/v4l2-ioctl.h> | 42 | #include <media/v4l2-ioctl.h> |
| 43 | #include <media/wm8775.h> | ||
| 44 | 43 | ||
| 45 | MODULE_DESCRIPTION("v4l2 driver module for cx2388x based TV cards"); | 44 | MODULE_DESCRIPTION("v4l2 driver module for cx2388x based TV cards"); |
| 46 | MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]"); | 45 | MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]"); |
| @@ -977,7 +976,6 @@ int cx88_set_control(struct cx88_core *core, struct v4l2_control *ctl) | |||
| 977 | const struct cx88_ctrl *c = NULL; | 976 | const struct cx88_ctrl *c = NULL; |
| 978 | u32 value,mask; | 977 | u32 value,mask; |
| 979 | int i; | 978 | int i; |
| 980 | struct v4l2_control client_ctl; | ||
| 981 | 979 | ||
| 982 | for (i = 0; i < CX8800_CTLS; i++) { | 980 | for (i = 0; i < CX8800_CTLS; i++) { |
| 983 | if (cx8800_ctls[i].v.id == ctl->id) { | 981 | if (cx8800_ctls[i].v.id == ctl->id) { |
| @@ -991,27 +989,6 @@ int cx88_set_control(struct cx88_core *core, struct v4l2_control *ctl) | |||
| 991 | ctl->value = c->v.minimum; | 989 | ctl->value = c->v.minimum; |
| 992 | if (ctl->value > c->v.maximum) | 990 | if (ctl->value > c->v.maximum) |
| 993 | ctl->value = c->v.maximum; | 991 | ctl->value = c->v.maximum; |
| 994 | |||
| 995 | /* Pass changes onto any WM8775 */ | ||
| 996 | client_ctl.id = ctl->id; | ||
| 997 | switch (ctl->id) { | ||
| 998 | case V4L2_CID_AUDIO_MUTE: | ||
| 999 | client_ctl.value = ctl->value; | ||
| 1000 | break; | ||
| 1001 | case V4L2_CID_AUDIO_VOLUME: | ||
| 1002 | client_ctl.value = (ctl->value) ? | ||
| 1003 | (0x90 + ctl->value) << 8 : 0; | ||
| 1004 | break; | ||
| 1005 | case V4L2_CID_AUDIO_BALANCE: | ||
| 1006 | client_ctl.value = ctl->value << 9; | ||
| 1007 | break; | ||
| 1008 | default: | ||
| 1009 | client_ctl.id = 0; | ||
| 1010 | break; | ||
| 1011 | } | ||
| 1012 | if (client_ctl.id) | ||
| 1013 | call_hw(core, WM8775_GID, core, s_ctrl, &client_ctl); | ||
| 1014 | |||
| 1015 | mask=c->mask; | 992 | mask=c->mask; |
| 1016 | switch (ctl->id) { | 993 | switch (ctl->id) { |
| 1017 | case V4L2_CID_AUDIO_BALANCE: | 994 | case V4L2_CID_AUDIO_BALANCE: |
| @@ -1558,9 +1535,7 @@ static int radio_queryctrl (struct file *file, void *priv, | |||
| 1558 | if (c->id < V4L2_CID_BASE || | 1535 | if (c->id < V4L2_CID_BASE || |
| 1559 | c->id >= V4L2_CID_LASTP1) | 1536 | c->id >= V4L2_CID_LASTP1) |
| 1560 | return -EINVAL; | 1537 | return -EINVAL; |
| 1561 | if (c->id == V4L2_CID_AUDIO_MUTE || | 1538 | if (c->id == V4L2_CID_AUDIO_MUTE) { |
| 1562 | c->id == V4L2_CID_AUDIO_VOLUME || | ||
| 1563 | c->id == V4L2_CID_AUDIO_BALANCE) { | ||
| 1564 | for (i = 0; i < CX8800_CTLS; i++) { | 1539 | for (i = 0; i < CX8800_CTLS; i++) { |
| 1565 | if (cx8800_ctls[i].v.id == c->id) | 1540 | if (cx8800_ctls[i].v.id == c->id) |
| 1566 | break; | 1541 | break; |
diff --git a/drivers/media/video/cx88/cx88.h b/drivers/media/video/cx88/cx88.h index e8c732e7ae4f..c9981e77416a 100644 --- a/drivers/media/video/cx88/cx88.h +++ b/drivers/media/video/cx88/cx88.h | |||
| @@ -398,19 +398,17 @@ static inline struct cx88_core *to_core(struct v4l2_device *v4l2_dev) | |||
| 398 | return container_of(v4l2_dev, struct cx88_core, v4l2_dev); | 398 | return container_of(v4l2_dev, struct cx88_core, v4l2_dev); |
| 399 | } | 399 | } |
| 400 | 400 | ||
| 401 | #define call_hw(core, grpid, o, f, args...) \ | 401 | #define call_all(core, o, f, args...) \ |
| 402 | do { \ | 402 | do { \ |
| 403 | if (!core->i2c_rc) { \ | 403 | if (!core->i2c_rc) { \ |
| 404 | if (core->gate_ctrl) \ | 404 | if (core->gate_ctrl) \ |
| 405 | core->gate_ctrl(core, 1); \ | 405 | core->gate_ctrl(core, 1); \ |
| 406 | v4l2_device_call_all(&core->v4l2_dev, grpid, o, f, ##args); \ | 406 | v4l2_device_call_all(&core->v4l2_dev, 0, o, f, ##args); \ |
| 407 | if (core->gate_ctrl) \ | 407 | if (core->gate_ctrl) \ |
| 408 | core->gate_ctrl(core, 0); \ | 408 | core->gate_ctrl(core, 0); \ |
| 409 | } \ | 409 | } \ |
| 410 | } while (0) | 410 | } while (0) |
| 411 | 411 | ||
| 412 | #define call_all(core, o, f, args...) call_hw(core, 0, o, f, ##args) | ||
| 413 | |||
| 414 | struct cx8800_dev; | 412 | struct cx8800_dev; |
| 415 | struct cx8802_dev; | 413 | struct cx8802_dev; |
| 416 | 414 | ||
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c index 908e3bc88303..2c3007280032 100644 --- a/drivers/media/video/em28xx/em28xx-video.c +++ b/drivers/media/video/em28xx/em28xx-video.c | |||
| @@ -2377,7 +2377,7 @@ static const struct v4l2_file_operations radio_fops = { | |||
| 2377 | .owner = THIS_MODULE, | 2377 | .owner = THIS_MODULE, |
| 2378 | .open = em28xx_v4l2_open, | 2378 | .open = em28xx_v4l2_open, |
| 2379 | .release = em28xx_v4l2_close, | 2379 | .release = em28xx_v4l2_close, |
| 2380 | .ioctl = video_ioctl2, | 2380 | .unlocked_ioctl = video_ioctl2, |
| 2381 | }; | 2381 | }; |
| 2382 | 2382 | ||
| 2383 | static const struct v4l2_ioctl_ops radio_ioctl_ops = { | 2383 | static const struct v4l2_ioctl_ops radio_ioctl_ops = { |
diff --git a/drivers/media/video/wm8775.c b/drivers/media/video/wm8775.c index 135525649086..fe8ef6419f83 100644 --- a/drivers/media/video/wm8775.c +++ b/drivers/media/video/wm8775.c | |||
| @@ -35,7 +35,6 @@ | |||
| 35 | #include <media/v4l2-device.h> | 35 | #include <media/v4l2-device.h> |
| 36 | #include <media/v4l2-chip-ident.h> | 36 | #include <media/v4l2-chip-ident.h> |
| 37 | #include <media/v4l2-ctrls.h> | 37 | #include <media/v4l2-ctrls.h> |
| 38 | #include <media/wm8775.h> | ||
| 39 | 38 | ||
| 40 | MODULE_DESCRIPTION("wm8775 driver"); | 39 | MODULE_DESCRIPTION("wm8775 driver"); |
| 41 | MODULE_AUTHOR("Ulf Eklund, Hans Verkuil"); | 40 | MODULE_AUTHOR("Ulf Eklund, Hans Verkuil"); |
| @@ -51,16 +50,10 @@ enum { | |||
| 51 | TOT_REGS | 50 | TOT_REGS |
| 52 | }; | 51 | }; |
| 53 | 52 | ||
| 54 | #define ALC_HOLD 0x85 /* R17: use zero cross detection, ALC hold time 42.6 ms */ | ||
| 55 | #define ALC_EN 0x100 /* R17: ALC enable */ | ||
| 56 | |||
| 57 | struct wm8775_state { | 53 | struct wm8775_state { |
| 58 | struct v4l2_subdev sd; | 54 | struct v4l2_subdev sd; |
| 59 | struct v4l2_ctrl_handler hdl; | 55 | struct v4l2_ctrl_handler hdl; |
| 60 | struct v4l2_ctrl *mute; | 56 | struct v4l2_ctrl *mute; |
| 61 | struct v4l2_ctrl *vol; | ||
| 62 | struct v4l2_ctrl *bal; | ||
| 63 | struct v4l2_ctrl *loud; | ||
| 64 | u8 input; /* Last selected input (0-0xf) */ | 57 | u8 input; /* Last selected input (0-0xf) */ |
| 65 | }; | 58 | }; |
| 66 | 59 | ||
| @@ -92,30 +85,6 @@ static int wm8775_write(struct v4l2_subdev *sd, int reg, u16 val) | |||
| 92 | return -1; | 85 | return -1; |
| 93 | } | 86 | } |
| 94 | 87 | ||
| 95 | static void wm8775_set_audio(struct v4l2_subdev *sd, int quietly) | ||
| 96 | { | ||
| 97 | struct wm8775_state *state = to_state(sd); | ||
| 98 | u8 vol_l, vol_r; | ||
| 99 | int muted = 0 != state->mute->val; | ||
| 100 | u16 volume = (u16)state->vol->val; | ||
| 101 | u16 balance = (u16)state->bal->val; | ||
| 102 | |||
| 103 | /* normalize ( 65535 to 0 -> 255 to 0 (+24dB to -103dB) ) */ | ||
| 104 | vol_l = (min(65536 - balance, 32768) * volume) >> 23; | ||
| 105 | vol_r = (min(balance, (u16)32768) * volume) >> 23; | ||
| 106 | |||
| 107 | /* Mute */ | ||
| 108 | if (muted || quietly) | ||
| 109 | wm8775_write(sd, R21, 0x0c0 | state->input); | ||
| 110 | |||
| 111 | wm8775_write(sd, R14, vol_l | 0x100); /* 0x100= Left channel ADC zero cross enable */ | ||
| 112 | wm8775_write(sd, R15, vol_r | 0x100); /* 0x100= Right channel ADC zero cross enable */ | ||
| 113 | |||
| 114 | /* Un-mute */ | ||
| 115 | if (!muted) | ||
| 116 | wm8775_write(sd, R21, state->input); | ||
| 117 | } | ||
| 118 | |||
| 119 | static int wm8775_s_routing(struct v4l2_subdev *sd, | 88 | static int wm8775_s_routing(struct v4l2_subdev *sd, |
| 120 | u32 input, u32 output, u32 config) | 89 | u32 input, u32 output, u32 config) |
| 121 | { | 90 | { |
| @@ -133,26 +102,25 @@ static int wm8775_s_routing(struct v4l2_subdev *sd, | |||
| 133 | state->input = input; | 102 | state->input = input; |
| 134 | if (!v4l2_ctrl_g_ctrl(state->mute)) | 103 | if (!v4l2_ctrl_g_ctrl(state->mute)) |
| 135 | return 0; | 104 | return 0; |
| 136 | if (!v4l2_ctrl_g_ctrl(state->vol)) | 105 | wm8775_write(sd, R21, 0x0c0); |
| 137 | return 0; | 106 | wm8775_write(sd, R14, 0x1d4); |
| 138 | if (!v4l2_ctrl_g_ctrl(state->bal)) | 107 | wm8775_write(sd, R15, 0x1d4); |
| 139 | return 0; | 108 | wm8775_write(sd, R21, 0x100 + state->input); |
| 140 | wm8775_set_audio(sd, 1); | ||
| 141 | return 0; | 109 | return 0; |
| 142 | } | 110 | } |
| 143 | 111 | ||
| 144 | static int wm8775_s_ctrl(struct v4l2_ctrl *ctrl) | 112 | static int wm8775_s_ctrl(struct v4l2_ctrl *ctrl) |
| 145 | { | 113 | { |
| 146 | struct v4l2_subdev *sd = to_sd(ctrl); | 114 | struct v4l2_subdev *sd = to_sd(ctrl); |
| 115 | struct wm8775_state *state = to_state(sd); | ||
| 147 | 116 | ||
| 148 | switch (ctrl->id) { | 117 | switch (ctrl->id) { |
| 149 | case V4L2_CID_AUDIO_MUTE: | 118 | case V4L2_CID_AUDIO_MUTE: |
| 150 | case V4L2_CID_AUDIO_VOLUME: | 119 | wm8775_write(sd, R21, 0x0c0); |
| 151 | case V4L2_CID_AUDIO_BALANCE: | 120 | wm8775_write(sd, R14, 0x1d4); |
| 152 | wm8775_set_audio(sd, 0); | 121 | wm8775_write(sd, R15, 0x1d4); |
| 153 | return 0; | 122 | if (!ctrl->val) |
| 154 | case V4L2_CID_AUDIO_LOUDNESS: | 123 | wm8775_write(sd, R21, 0x100 + state->input); |
| 155 | wm8775_write(sd, R17, (ctrl->val ? ALC_EN : 0) | ALC_HOLD); | ||
| 156 | return 0; | 124 | return 0; |
| 157 | } | 125 | } |
| 158 | return -EINVAL; | 126 | return -EINVAL; |
| @@ -176,7 +144,16 @@ static int wm8775_log_status(struct v4l2_subdev *sd) | |||
| 176 | 144 | ||
| 177 | static int wm8775_s_frequency(struct v4l2_subdev *sd, struct v4l2_frequency *freq) | 145 | static int wm8775_s_frequency(struct v4l2_subdev *sd, struct v4l2_frequency *freq) |
| 178 | { | 146 | { |
| 179 | wm8775_set_audio(sd, 0); | 147 | struct wm8775_state *state = to_state(sd); |
| 148 | |||
| 149 | /* If I remove this, then it can happen that I have no | ||
| 150 | sound the first time I tune from static to a valid channel. | ||
| 151 | It's difficult to reproduce and is almost certainly related | ||
| 152 | to the zero cross detect circuit. */ | ||
| 153 | wm8775_write(sd, R21, 0x0c0); | ||
| 154 | wm8775_write(sd, R14, 0x1d4); | ||
| 155 | wm8775_write(sd, R15, 0x1d4); | ||
| 156 | wm8775_write(sd, R21, 0x100 + state->input); | ||
| 180 | return 0; | 157 | return 0; |
| 181 | } | 158 | } |
| 182 | 159 | ||
| @@ -226,7 +203,6 @@ static int wm8775_probe(struct i2c_client *client, | |||
| 226 | { | 203 | { |
| 227 | struct wm8775_state *state; | 204 | struct wm8775_state *state; |
| 228 | struct v4l2_subdev *sd; | 205 | struct v4l2_subdev *sd; |
| 229 | int err; | ||
| 230 | 206 | ||
| 231 | /* Check if the adapter supports the needed features */ | 207 | /* Check if the adapter supports the needed features */ |
| 232 | if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) | 208 | if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) |
| @@ -240,21 +216,15 @@ static int wm8775_probe(struct i2c_client *client, | |||
| 240 | return -ENOMEM; | 216 | return -ENOMEM; |
| 241 | sd = &state->sd; | 217 | sd = &state->sd; |
| 242 | v4l2_i2c_subdev_init(sd, client, &wm8775_ops); | 218 | v4l2_i2c_subdev_init(sd, client, &wm8775_ops); |
| 243 | sd->grp_id = WM8775_GID; /* subdev group id */ | ||
| 244 | state->input = 2; | 219 | state->input = 2; |
| 245 | 220 | ||
| 246 | v4l2_ctrl_handler_init(&state->hdl, 4); | 221 | v4l2_ctrl_handler_init(&state->hdl, 1); |
| 247 | state->mute = v4l2_ctrl_new_std(&state->hdl, &wm8775_ctrl_ops, | 222 | state->mute = v4l2_ctrl_new_std(&state->hdl, &wm8775_ctrl_ops, |
| 248 | V4L2_CID_AUDIO_MUTE, 0, 1, 1, 0); | 223 | V4L2_CID_AUDIO_MUTE, 0, 1, 1, 0); |
| 249 | state->vol = v4l2_ctrl_new_std(&state->hdl, &wm8775_ctrl_ops, | ||
| 250 | V4L2_CID_AUDIO_VOLUME, 0, 65535, (65535+99)/100, 0xCF00); /* 0dB*/ | ||
| 251 | state->bal = v4l2_ctrl_new_std(&state->hdl, &wm8775_ctrl_ops, | ||
| 252 | V4L2_CID_AUDIO_BALANCE, 0, 65535, (65535+99)/100, 32768); | ||
| 253 | state->loud = v4l2_ctrl_new_std(&state->hdl, &wm8775_ctrl_ops, | ||
| 254 | V4L2_CID_AUDIO_LOUDNESS, 0, 1, 1, 1); | ||
| 255 | sd->ctrl_handler = &state->hdl; | 224 | sd->ctrl_handler = &state->hdl; |
| 256 | err = state->hdl.error; | 225 | if (state->hdl.error) { |
| 257 | if (err) { | 226 | int err = state->hdl.error; |
| 227 | |||
| 258 | v4l2_ctrl_handler_free(&state->hdl); | 228 | v4l2_ctrl_handler_free(&state->hdl); |
| 259 | kfree(state); | 229 | kfree(state); |
| 260 | return err; | 230 | return err; |
| @@ -266,25 +236,29 @@ static int wm8775_probe(struct i2c_client *client, | |||
| 266 | wm8775_write(sd, R23, 0x000); | 236 | wm8775_write(sd, R23, 0x000); |
| 267 | /* Disable zero cross detect timeout */ | 237 | /* Disable zero cross detect timeout */ |
| 268 | wm8775_write(sd, R7, 0x000); | 238 | wm8775_write(sd, R7, 0x000); |
| 269 | /* HPF enable, I2S mode, 24-bit */ | 239 | /* Left justified, 24-bit mode */ |
| 270 | wm8775_write(sd, R11, 0x022); | 240 | wm8775_write(sd, R11, 0x021); |
| 271 | /* Master mode, clock ratio 256fs */ | 241 | /* Master mode, clock ratio 256fs */ |
| 272 | wm8775_write(sd, R12, 0x102); | 242 | wm8775_write(sd, R12, 0x102); |
| 273 | /* Powered up */ | 243 | /* Powered up */ |
| 274 | wm8775_write(sd, R13, 0x000); | 244 | wm8775_write(sd, R13, 0x000); |
| 275 | /* ALC stereo, ALC target level -5dB FS, ALC max gain +8dB */ | 245 | /* ADC gain +2.5dB, enable zero cross */ |
| 276 | wm8775_write(sd, R16, 0x1bb); | 246 | wm8775_write(sd, R14, 0x1d4); |
| 277 | /* Set ALC mode and hold time */ | 247 | /* ADC gain +2.5dB, enable zero cross */ |
| 278 | wm8775_write(sd, R17, (state->loud->val ? ALC_EN : 0) | ALC_HOLD); | 248 | wm8775_write(sd, R15, 0x1d4); |
| 249 | /* ALC Stereo, ALC target level -1dB FS max gain +8dB */ | ||
| 250 | wm8775_write(sd, R16, 0x1bf); | ||
| 251 | /* Enable gain control, use zero cross detection, | ||
| 252 | ALC hold time 42.6 ms */ | ||
| 253 | wm8775_write(sd, R17, 0x185); | ||
| 279 | /* ALC gain ramp up delay 34 s, ALC gain ramp down delay 33 ms */ | 254 | /* ALC gain ramp up delay 34 s, ALC gain ramp down delay 33 ms */ |
| 280 | wm8775_write(sd, R18, 0x0a2); | 255 | wm8775_write(sd, R18, 0x0a2); |
| 281 | /* Enable noise gate, threshold -72dBfs */ | 256 | /* Enable noise gate, threshold -72dBfs */ |
| 282 | wm8775_write(sd, R19, 0x005); | 257 | wm8775_write(sd, R19, 0x005); |
| 283 | /* Transient window 4ms, ALC min gain -5dB */ | 258 | /* Transient window 4ms, lower PGA gain limit -1dB */ |
| 284 | wm8775_write(sd, R20, 0x0fb); | 259 | wm8775_write(sd, R20, 0x07a); |
| 285 | 260 | /* LRBOTH = 1, use input 2. */ | |
| 286 | wm8775_set_audio(sd, 1); /* set volume/mute/mux */ | 261 | wm8775_write(sd, R21, 0x102); |
| 287 | |||
| 288 | return 0; | 262 | return 0; |
| 289 | } | 263 | } |
| 290 | 264 | ||
diff --git a/drivers/platform/x86/intel_ips.c b/drivers/platform/x86/intel_ips.c index c44a5e8b8b82..f0b3ad13c273 100644 --- a/drivers/platform/x86/intel_ips.c +++ b/drivers/platform/x86/intel_ips.c | |||
| @@ -75,6 +75,7 @@ | |||
| 75 | #include <drm/i915_drm.h> | 75 | #include <drm/i915_drm.h> |
| 76 | #include <asm/msr.h> | 76 | #include <asm/msr.h> |
| 77 | #include <asm/processor.h> | 77 | #include <asm/processor.h> |
| 78 | #include "intel_ips.h" | ||
| 78 | 79 | ||
| 79 | #define PCI_DEVICE_ID_INTEL_THERMAL_SENSOR 0x3b32 | 80 | #define PCI_DEVICE_ID_INTEL_THERMAL_SENSOR 0x3b32 |
| 80 | 81 | ||
| @@ -245,6 +246,7 @@ | |||
| 245 | #define thm_writel(off, val) writel((val), ips->regmap + (off)) | 246 | #define thm_writel(off, val) writel((val), ips->regmap + (off)) |
| 246 | 247 | ||
| 247 | static const int IPS_ADJUST_PERIOD = 5000; /* ms */ | 248 | static const int IPS_ADJUST_PERIOD = 5000; /* ms */ |
| 249 | static bool late_i915_load = false; | ||
| 248 | 250 | ||
| 249 | /* For initial average collection */ | 251 | /* For initial average collection */ |
| 250 | static const int IPS_SAMPLE_PERIOD = 200; /* ms */ | 252 | static const int IPS_SAMPLE_PERIOD = 200; /* ms */ |
| @@ -339,6 +341,9 @@ struct ips_driver { | |||
| 339 | u64 orig_turbo_ratios; | 341 | u64 orig_turbo_ratios; |
| 340 | }; | 342 | }; |
| 341 | 343 | ||
| 344 | static bool | ||
| 345 | ips_gpu_turbo_enabled(struct ips_driver *ips); | ||
| 346 | |||
| 342 | /** | 347 | /** |
| 343 | * ips_cpu_busy - is CPU busy? | 348 | * ips_cpu_busy - is CPU busy? |
| 344 | * @ips: IPS driver struct | 349 | * @ips: IPS driver struct |
| @@ -517,7 +522,7 @@ static void ips_disable_cpu_turbo(struct ips_driver *ips) | |||
| 517 | */ | 522 | */ |
| 518 | static bool ips_gpu_busy(struct ips_driver *ips) | 523 | static bool ips_gpu_busy(struct ips_driver *ips) |
| 519 | { | 524 | { |
| 520 | if (!ips->gpu_turbo_enabled) | 525 | if (!ips_gpu_turbo_enabled(ips)) |
| 521 | return false; | 526 | return false; |
| 522 | 527 | ||
| 523 | return ips->gpu_busy(); | 528 | return ips->gpu_busy(); |
| @@ -532,7 +537,7 @@ static bool ips_gpu_busy(struct ips_driver *ips) | |||
| 532 | */ | 537 | */ |
| 533 | static void ips_gpu_raise(struct ips_driver *ips) | 538 | static void ips_gpu_raise(struct ips_driver *ips) |
| 534 | { | 539 | { |
| 535 | if (!ips->gpu_turbo_enabled) | 540 | if (!ips_gpu_turbo_enabled(ips)) |
| 536 | return; | 541 | return; |
| 537 | 542 | ||
| 538 | if (!ips->gpu_raise()) | 543 | if (!ips->gpu_raise()) |
| @@ -549,7 +554,7 @@ static void ips_gpu_raise(struct ips_driver *ips) | |||
| 549 | */ | 554 | */ |
| 550 | static void ips_gpu_lower(struct ips_driver *ips) | 555 | static void ips_gpu_lower(struct ips_driver *ips) |
| 551 | { | 556 | { |
| 552 | if (!ips->gpu_turbo_enabled) | 557 | if (!ips_gpu_turbo_enabled(ips)) |
| 553 | return; | 558 | return; |
| 554 | 559 | ||
| 555 | if (!ips->gpu_lower()) | 560 | if (!ips->gpu_lower()) |
| @@ -1454,6 +1459,31 @@ out_err: | |||
| 1454 | return false; | 1459 | return false; |
| 1455 | } | 1460 | } |
| 1456 | 1461 | ||
| 1462 | static bool | ||
| 1463 | ips_gpu_turbo_enabled(struct ips_driver *ips) | ||
| 1464 | { | ||
| 1465 | if (!ips->gpu_busy && late_i915_load) { | ||
| 1466 | if (ips_get_i915_syms(ips)) { | ||
| 1467 | dev_info(&ips->dev->dev, | ||
| 1468 | "i915 driver attached, reenabling gpu turbo\n"); | ||
| 1469 | ips->gpu_turbo_enabled = !(thm_readl(THM_HTS) & HTS_GTD_DIS); | ||
| 1470 | } | ||
| 1471 | } | ||
| 1472 | |||
| 1473 | return ips->gpu_turbo_enabled; | ||
| 1474 | } | ||
| 1475 | |||
| 1476 | void | ||
| 1477 | ips_link_to_i915_driver() | ||
| 1478 | { | ||
| 1479 | /* We can't cleanly get at the various ips_driver structs from | ||
| 1480 | * this caller (the i915 driver), so just set a flag saying | ||
| 1481 | * that it's time to try getting the symbols again. | ||
| 1482 | */ | ||
| 1483 | late_i915_load = true; | ||
| 1484 | } | ||
| 1485 | EXPORT_SYMBOL_GPL(ips_link_to_i915_driver); | ||
| 1486 | |||
| 1457 | static DEFINE_PCI_DEVICE_TABLE(ips_id_table) = { | 1487 | static DEFINE_PCI_DEVICE_TABLE(ips_id_table) = { |
| 1458 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, | 1488 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, |
| 1459 | PCI_DEVICE_ID_INTEL_THERMAL_SENSOR), }, | 1489 | PCI_DEVICE_ID_INTEL_THERMAL_SENSOR), }, |
diff --git a/drivers/platform/x86/intel_ips.h b/drivers/platform/x86/intel_ips.h new file mode 100644 index 000000000000..73299beff5b3 --- /dev/null +++ b/drivers/platform/x86/intel_ips.h | |||
| @@ -0,0 +1,21 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (c) 2010 Intel Corporation | ||
| 3 | * | ||
| 4 | * This program is free software; you can redistribute it and/or modify it | ||
| 5 | * under the terms and conditions of the GNU General Public License, | ||
| 6 | * version 2, as published by the Free Software Foundation. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
| 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
| 11 | * more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License along with | ||
| 14 | * this program; if not, write to the Free Software Foundation, Inc., | ||
| 15 | * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. | ||
| 16 | * | ||
| 17 | * The full GNU General Public License is included in this distribution in | ||
| 18 | * the file called "COPYING". | ||
| 19 | */ | ||
| 20 | |||
| 21 | void ips_link_to_i915_driver(void); | ||
diff --git a/drivers/spi/coldfire_qspi.c b/drivers/spi/coldfire_qspi.c index 052b3c7fa6a0..8856bcca9d29 100644 --- a/drivers/spi/coldfire_qspi.c +++ b/drivers/spi/coldfire_qspi.c | |||
| @@ -317,7 +317,7 @@ static void mcfqspi_work(struct work_struct *work) | |||
| 317 | msg = container_of(mcfqspi->msgq.next, struct spi_message, | 317 | msg = container_of(mcfqspi->msgq.next, struct spi_message, |
| 318 | queue); | 318 | queue); |
| 319 | 319 | ||
| 320 | list_del_init(&mcfqspi->msgq); | 320 | list_del_init(&msg->queue); |
| 321 | spin_unlock_irqrestore(&mcfqspi->lock, flags); | 321 | spin_unlock_irqrestore(&mcfqspi->lock, flags); |
| 322 | 322 | ||
| 323 | spi = msg->spi; | 323 | spi = msg->spi; |
diff --git a/drivers/spi/omap2_mcspi.c b/drivers/spi/omap2_mcspi.c index 2a651e61bfbf..951a160fc27f 100644 --- a/drivers/spi/omap2_mcspi.c +++ b/drivers/spi/omap2_mcspi.c | |||
| @@ -1305,10 +1305,49 @@ static int __exit omap2_mcspi_remove(struct platform_device *pdev) | |||
| 1305 | /* work with hotplug and coldplug */ | 1305 | /* work with hotplug and coldplug */ |
| 1306 | MODULE_ALIAS("platform:omap2_mcspi"); | 1306 | MODULE_ALIAS("platform:omap2_mcspi"); |
| 1307 | 1307 | ||
| 1308 | #ifdef CONFIG_SUSPEND | ||
| 1309 | /* | ||
| 1310 | * When SPI wake up from off-mode, CS is in activate state. If it was in | ||
| 1311 | * unactive state when driver was suspend, then force it to unactive state at | ||
| 1312 | * wake up. | ||
| 1313 | */ | ||
| 1314 | static int omap2_mcspi_resume(struct device *dev) | ||
| 1315 | { | ||
| 1316 | struct spi_master *master = dev_get_drvdata(dev); | ||
| 1317 | struct omap2_mcspi *mcspi = spi_master_get_devdata(master); | ||
| 1318 | struct omap2_mcspi_cs *cs; | ||
| 1319 | |||
| 1320 | omap2_mcspi_enable_clocks(mcspi); | ||
| 1321 | list_for_each_entry(cs, &omap2_mcspi_ctx[master->bus_num - 1].cs, | ||
| 1322 | node) { | ||
| 1323 | if ((cs->chconf0 & OMAP2_MCSPI_CHCONF_FORCE) == 0) { | ||
| 1324 | |||
| 1325 | /* | ||
| 1326 | * We need to toggle CS state for OMAP take this | ||
| 1327 | * change in account. | ||
| 1328 | */ | ||
| 1329 | MOD_REG_BIT(cs->chconf0, OMAP2_MCSPI_CHCONF_FORCE, 1); | ||
| 1330 | __raw_writel(cs->chconf0, cs->base + OMAP2_MCSPI_CHCONF0); | ||
| 1331 | MOD_REG_BIT(cs->chconf0, OMAP2_MCSPI_CHCONF_FORCE, 0); | ||
| 1332 | __raw_writel(cs->chconf0, cs->base + OMAP2_MCSPI_CHCONF0); | ||
| 1333 | } | ||
| 1334 | } | ||
| 1335 | omap2_mcspi_disable_clocks(mcspi); | ||
| 1336 | return 0; | ||
| 1337 | } | ||
| 1338 | #else | ||
| 1339 | #define omap2_mcspi_resume NULL | ||
| 1340 | #endif | ||
| 1341 | |||
| 1342 | static const struct dev_pm_ops omap2_mcspi_pm_ops = { | ||
| 1343 | .resume = omap2_mcspi_resume, | ||
| 1344 | }; | ||
| 1345 | |||
| 1308 | static struct platform_driver omap2_mcspi_driver = { | 1346 | static struct platform_driver omap2_mcspi_driver = { |
| 1309 | .driver = { | 1347 | .driver = { |
| 1310 | .name = "omap2_mcspi", | 1348 | .name = "omap2_mcspi", |
| 1311 | .owner = THIS_MODULE, | 1349 | .owner = THIS_MODULE, |
| 1350 | .pm = &omap2_mcspi_pm_ops | ||
| 1312 | }, | 1351 | }, |
| 1313 | .remove = __exit_p(omap2_mcspi_remove), | 1352 | .remove = __exit_p(omap2_mcspi_remove), |
| 1314 | }; | 1353 | }; |
diff --git a/drivers/staging/zram/zram_drv.c b/drivers/staging/zram/zram_drv.c index 8c3c057aa847..d0e9e0207539 100644 --- a/drivers/staging/zram/zram_drv.c +++ b/drivers/staging/zram/zram_drv.c | |||
| @@ -435,12 +435,6 @@ static int zram_make_request(struct request_queue *queue, struct bio *bio) | |||
| 435 | int ret = 0; | 435 | int ret = 0; |
| 436 | struct zram *zram = queue->queuedata; | 436 | struct zram *zram = queue->queuedata; |
| 437 | 437 | ||
| 438 | if (unlikely(!zram->init_done)) { | ||
| 439 | set_bit(BIO_UPTODATE, &bio->bi_flags); | ||
| 440 | bio_endio(bio, 0); | ||
| 441 | return 0; | ||
| 442 | } | ||
| 443 | |||
| 444 | if (!valid_io_request(zram, bio)) { | 438 | if (!valid_io_request(zram, bio)) { |
| 445 | zram_stat64_inc(zram, &zram->stats.invalid_io); | 439 | zram_stat64_inc(zram, &zram->stats.invalid_io); |
| 446 | bio_io_error(bio); | 440 | bio_io_error(bio); |
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h index 9d8688b92d8b..8cd00ad98d37 100644 --- a/include/linux/dmaengine.h +++ b/include/linux/dmaengine.h | |||
| @@ -824,6 +824,8 @@ enum dma_status dma_sync_wait(struct dma_chan *chan, dma_cookie_t cookie); | |||
| 824 | #ifdef CONFIG_DMA_ENGINE | 824 | #ifdef CONFIG_DMA_ENGINE |
| 825 | enum dma_status dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx); | 825 | enum dma_status dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx); |
| 826 | void dma_issue_pending_all(void); | 826 | void dma_issue_pending_all(void); |
| 827 | struct dma_chan *__dma_request_channel(dma_cap_mask_t *mask, dma_filter_fn fn, void *fn_param); | ||
| 828 | void dma_release_channel(struct dma_chan *chan); | ||
| 827 | #else | 829 | #else |
| 828 | static inline enum dma_status dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx) | 830 | static inline enum dma_status dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx) |
| 829 | { | 831 | { |
| @@ -831,7 +833,14 @@ static inline enum dma_status dma_wait_for_async_tx(struct dma_async_tx_descript | |||
| 831 | } | 833 | } |
| 832 | static inline void dma_issue_pending_all(void) | 834 | static inline void dma_issue_pending_all(void) |
| 833 | { | 835 | { |
| 834 | do { } while (0); | 836 | } |
| 837 | static inline struct dma_chan *__dma_request_channel(dma_cap_mask_t *mask, | ||
| 838 | dma_filter_fn fn, void *fn_param) | ||
| 839 | { | ||
| 840 | return NULL; | ||
| 841 | } | ||
| 842 | static inline void dma_release_channel(struct dma_chan *chan) | ||
| 843 | { | ||
| 835 | } | 844 | } |
| 836 | #endif | 845 | #endif |
| 837 | 846 | ||
| @@ -842,8 +851,6 @@ void dma_async_device_unregister(struct dma_device *device); | |||
| 842 | void dma_run_dependencies(struct dma_async_tx_descriptor *tx); | 851 | void dma_run_dependencies(struct dma_async_tx_descriptor *tx); |
| 843 | struct dma_chan *dma_find_channel(enum dma_transaction_type tx_type); | 852 | struct dma_chan *dma_find_channel(enum dma_transaction_type tx_type); |
| 844 | #define dma_request_channel(mask, x, y) __dma_request_channel(&(mask), x, y) | 853 | #define dma_request_channel(mask, x, y) __dma_request_channel(&(mask), x, y) |
| 845 | struct dma_chan *__dma_request_channel(dma_cap_mask_t *mask, dma_filter_fn fn, void *fn_param); | ||
| 846 | void dma_release_channel(struct dma_chan *chan); | ||
| 847 | 854 | ||
| 848 | /* --- Helper iov-locking functions --- */ | 855 | /* --- Helper iov-locking functions --- */ |
| 849 | 856 | ||
diff --git a/include/media/wm8775.h b/include/media/wm8775.h index a1c4d417dfa2..60739c5a23ae 100644 --- a/include/media/wm8775.h +++ b/include/media/wm8775.h | |||
| @@ -32,7 +32,4 @@ | |||
| 32 | #define WM8775_AIN3 4 | 32 | #define WM8775_AIN3 4 |
| 33 | #define WM8775_AIN4 8 | 33 | #define WM8775_AIN4 8 |
| 34 | 34 | ||
| 35 | /* subdev group ID */ | ||
| 36 | #define WM8775_GID (1 << 0) | ||
| 37 | |||
| 38 | #endif | 35 | #endif |
diff --git a/init/do_mounts.c b/init/do_mounts.c index 830aaec9c7d5..2b54bef33b55 100644 --- a/init/do_mounts.c +++ b/init/do_mounts.c | |||
| @@ -93,7 +93,7 @@ no_match: | |||
| 93 | * | 93 | * |
| 94 | * Returns the matching dev_t on success or 0 on failure. | 94 | * Returns the matching dev_t on success or 0 on failure. |
| 95 | */ | 95 | */ |
| 96 | static dev_t __init devt_from_partuuid(char *uuid_str) | 96 | static dev_t devt_from_partuuid(char *uuid_str) |
| 97 | { | 97 | { |
| 98 | dev_t res = 0; | 98 | dev_t res = 0; |
| 99 | struct device *dev = NULL; | 99 | struct device *dev = NULL; |
diff --git a/kernel/user.c b/kernel/user.c index 2c7d8d5914b1..5c598ca781df 100644 --- a/kernel/user.c +++ b/kernel/user.c | |||
| @@ -158,6 +158,7 @@ struct user_struct *alloc_uid(struct user_namespace *ns, uid_t uid) | |||
| 158 | spin_lock_irq(&uidhash_lock); | 158 | spin_lock_irq(&uidhash_lock); |
| 159 | up = uid_hash_find(uid, hashent); | 159 | up = uid_hash_find(uid, hashent); |
| 160 | if (up) { | 160 | if (up) { |
| 161 | put_user_ns(ns); | ||
| 161 | key_put(new->uid_keyring); | 162 | key_put(new->uid_keyring); |
| 162 | key_put(new->session_keyring); | 163 | key_put(new->session_keyring); |
| 163 | kmem_cache_free(uid_cachep, new); | 164 | kmem_cache_free(uid_cachep, new); |
diff --git a/kernel/watchdog.c b/kernel/watchdog.c index 6e3c41a4024c..5b082156cd21 100644 --- a/kernel/watchdog.c +++ b/kernel/watchdog.c | |||
| @@ -364,7 +364,8 @@ static int watchdog_nmi_enable(int cpu) | |||
| 364 | goto out_save; | 364 | goto out_save; |
| 365 | } | 365 | } |
| 366 | 366 | ||
| 367 | printk(KERN_ERR "NMI watchdog failed to create perf event on cpu%i: %p\n", cpu, event); | 367 | printk(KERN_ERR "NMI watchdog disabled for cpu%i: unable to create perf event: %ld\n", |
| 368 | cpu, PTR_ERR(event)); | ||
| 368 | return PTR_ERR(event); | 369 | return PTR_ERR(event); |
| 369 | 370 | ||
| 370 | /* success path */ | 371 | /* success path */ |
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 7a22b4129211..00bb8a64d028 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
| @@ -1925,19 +1925,18 @@ again: | |||
| 1925 | 1925 | ||
| 1926 | rcu_read_lock(); | 1926 | rcu_read_lock(); |
| 1927 | p = rcu_dereference(mm->owner); | 1927 | p = rcu_dereference(mm->owner); |
| 1928 | VM_BUG_ON(!p); | ||
| 1929 | /* | 1928 | /* |
| 1930 | * because we don't have task_lock(), "p" can exit while | 1929 | * Because we don't have task_lock(), "p" can exit. |
| 1931 | * we're here. In that case, "mem" can point to root | 1930 | * In that case, "mem" can point to root or p can be NULL with |
| 1932 | * cgroup but never be NULL. (and task_struct itself is freed | 1931 | * race with swapoff. Then, we have small risk of mis-accouning. |
| 1933 | * by RCU, cgroup itself is RCU safe.) Then, we have small | 1932 | * But such kind of mis-account by race always happens because |
| 1934 | * risk here to get wrong cgroup. But such kind of mis-account | 1933 | * we don't have cgroup_mutex(). It's overkill and we allo that |
| 1935 | * by race always happens because we don't have cgroup_mutex(). | 1934 | * small race, here. |
| 1936 | * It's overkill and we allow that small race, here. | 1935 | * (*) swapoff at el will charge against mm-struct not against |
| 1936 | * task-struct. So, mm->owner can be NULL. | ||
| 1937 | */ | 1937 | */ |
| 1938 | mem = mem_cgroup_from_task(p); | 1938 | mem = mem_cgroup_from_task(p); |
| 1939 | VM_BUG_ON(!mem); | 1939 | if (!mem || mem_cgroup_is_root(mem)) { |
| 1940 | if (mem_cgroup_is_root(mem)) { | ||
| 1941 | rcu_read_unlock(); | 1940 | rcu_read_unlock(); |
| 1942 | goto done; | 1941 | goto done; |
| 1943 | } | 1942 | } |
diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c index b9d9aa18e6d6..5f77dcb8977e 100644 --- a/scripts/kconfig/menu.c +++ b/scripts/kconfig/menu.c | |||
| @@ -140,6 +140,20 @@ struct property *menu_add_prop(enum prop_type type, char *prompt, struct expr *e | |||
| 140 | } | 140 | } |
| 141 | if (current_entry->prompt && current_entry != &rootmenu) | 141 | if (current_entry->prompt && current_entry != &rootmenu) |
| 142 | prop_warn(prop, "prompt redefined"); | 142 | prop_warn(prop, "prompt redefined"); |
| 143 | |||
| 144 | /* Apply all upper menus' visibilities to actual prompts. */ | ||
| 145 | if(type == P_PROMPT) { | ||
| 146 | struct menu *menu = current_entry; | ||
| 147 | |||
| 148 | while ((menu = menu->parent) != NULL) { | ||
| 149 | if (!menu->visibility) | ||
| 150 | continue; | ||
| 151 | prop->visible.expr | ||
| 152 | = expr_alloc_and(prop->visible.expr, | ||
| 153 | menu->visibility); | ||
| 154 | } | ||
| 155 | } | ||
| 156 | |||
| 143 | current_entry->prompt = prop; | 157 | current_entry->prompt = prop; |
| 144 | } | 158 | } |
| 145 | prop->text = prompt; | 159 | prop->text = prompt; |
diff --git a/security/integrity/ima/ima_policy.c b/security/integrity/ima/ima_policy.c index aef8c0a923ab..d661afbe474c 100644 --- a/security/integrity/ima/ima_policy.c +++ b/security/integrity/ima/ima_policy.c | |||
| @@ -253,6 +253,8 @@ static int ima_lsm_rule_init(struct ima_measure_rule_entry *entry, | |||
| 253 | result = security_filter_rule_init(entry->lsm[lsm_rule].type, | 253 | result = security_filter_rule_init(entry->lsm[lsm_rule].type, |
| 254 | Audit_equal, args, | 254 | Audit_equal, args, |
| 255 | &entry->lsm[lsm_rule].rule); | 255 | &entry->lsm[lsm_rule].rule); |
| 256 | if (!entry->lsm[lsm_rule].rule) | ||
| 257 | return -EINVAL; | ||
| 256 | return result; | 258 | return result; |
| 257 | } | 259 | } |
| 258 | 260 | ||
diff --git a/sound/oss/soundcard.c b/sound/oss/soundcard.c index 46c0d03dbecc..fcb14a099822 100644 --- a/sound/oss/soundcard.c +++ b/sound/oss/soundcard.c | |||
| @@ -87,7 +87,7 @@ int *load_mixer_volumes(char *name, int *levels, int present) | |||
| 87 | int i, n; | 87 | int i, n; |
| 88 | 88 | ||
| 89 | for (i = 0; i < num_mixer_volumes; i++) { | 89 | for (i = 0; i < num_mixer_volumes; i++) { |
| 90 | if (strcmp(name, mixer_vols[i].name) == 0) { | 90 | if (strncmp(name, mixer_vols[i].name, 32) == 0) { |
| 91 | if (present) | 91 | if (present) |
| 92 | mixer_vols[i].num = i; | 92 | mixer_vols[i].num = i; |
| 93 | return mixer_vols[i].levels; | 93 | return mixer_vols[i].levels; |
| @@ -99,7 +99,7 @@ int *load_mixer_volumes(char *name, int *levels, int present) | |||
| 99 | } | 99 | } |
| 100 | n = num_mixer_volumes++; | 100 | n = num_mixer_volumes++; |
| 101 | 101 | ||
| 102 | strcpy(mixer_vols[n].name, name); | 102 | strncpy(mixer_vols[n].name, name, 32); |
| 103 | 103 | ||
| 104 | if (present) | 104 | if (present) |
| 105 | mixer_vols[n].num = n; | 105 | mixer_vols[n].num = n; |
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index b030c8eba21f..a1c4008af891 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c | |||
| @@ -2300,6 +2300,7 @@ static struct snd_pci_quirk position_fix_list[] __devinitdata = { | |||
| 2300 | SND_PCI_QUIRK(0x1028, 0x01cc, "Dell D820", POS_FIX_LPIB), | 2300 | SND_PCI_QUIRK(0x1028, 0x01cc, "Dell D820", POS_FIX_LPIB), |
| 2301 | SND_PCI_QUIRK(0x1028, 0x01de, "Dell Precision 390", POS_FIX_LPIB), | 2301 | SND_PCI_QUIRK(0x1028, 0x01de, "Dell Precision 390", POS_FIX_LPIB), |
| 2302 | SND_PCI_QUIRK(0x1028, 0x01f6, "Dell Latitude 131L", POS_FIX_LPIB), | 2302 | SND_PCI_QUIRK(0x1028, 0x01f6, "Dell Latitude 131L", POS_FIX_LPIB), |
| 2303 | SND_PCI_QUIRK(0x1028, 0x0470, "Dell Inspiron 1120", POS_FIX_LPIB), | ||
| 2303 | SND_PCI_QUIRK(0x103c, 0x306d, "HP dv3", POS_FIX_LPIB), | 2304 | SND_PCI_QUIRK(0x103c, 0x306d, "HP dv3", POS_FIX_LPIB), |
| 2304 | SND_PCI_QUIRK(0x1043, 0x813d, "ASUS P5AD2", POS_FIX_LPIB), | 2305 | SND_PCI_QUIRK(0x1043, 0x813d, "ASUS P5AD2", POS_FIX_LPIB), |
| 2305 | SND_PCI_QUIRK(0x1043, 0x81b3, "ASUS", POS_FIX_LPIB), | 2306 | SND_PCI_QUIRK(0x1043, 0x81b3, "ASUS", POS_FIX_LPIB), |
diff --git a/sound/soc/codecs/max98088.c b/sound/soc/codecs/max98088.c index d63e28773eb1..6447dbb2f123 100644 --- a/sound/soc/codecs/max98088.c +++ b/sound/soc/codecs/max98088.c | |||
| @@ -40,7 +40,6 @@ struct max98088_cdata { | |||
| 40 | }; | 40 | }; |
| 41 | 41 | ||
| 42 | struct max98088_priv { | 42 | struct max98088_priv { |
| 43 | u8 reg_cache[M98088_REG_CNT]; | ||
| 44 | enum max98088_type devtype; | 43 | enum max98088_type devtype; |
| 45 | void *control_data; | 44 | void *control_data; |
| 46 | struct max98088_pdata *pdata; | 45 | struct max98088_pdata *pdata; |
| @@ -1588,7 +1587,7 @@ static int max98088_dai2_set_fmt(struct snd_soc_dai *codec_dai, | |||
| 1588 | 1587 | ||
| 1589 | static void max98088_sync_cache(struct snd_soc_codec *codec) | 1588 | static void max98088_sync_cache(struct snd_soc_codec *codec) |
| 1590 | { | 1589 | { |
| 1591 | struct max98088_priv *max98088 = snd_soc_codec_get_drvdata(codec); | 1590 | u16 *reg_cache = codec->reg_cache; |
| 1592 | int i; | 1591 | int i; |
| 1593 | 1592 | ||
| 1594 | if (!codec->cache_sync) | 1593 | if (!codec->cache_sync) |
| @@ -1599,14 +1598,14 @@ static void max98088_sync_cache(struct snd_soc_codec *codec) | |||
| 1599 | /* write back cached values if they're writeable and | 1598 | /* write back cached values if they're writeable and |
| 1600 | * different from the hardware default. | 1599 | * different from the hardware default. |
| 1601 | */ | 1600 | */ |
| 1602 | for (i = 1; i < ARRAY_SIZE(max98088->reg_cache); i++) { | 1601 | for (i = 1; i < codec->driver->reg_cache_size; i++) { |
| 1603 | if (!max98088_access[i].writable) | 1602 | if (!max98088_access[i].writable) |
| 1604 | continue; | 1603 | continue; |
| 1605 | 1604 | ||
| 1606 | if (max98088->reg_cache[i] == max98088_reg[i]) | 1605 | if (reg_cache[i] == max98088_reg[i]) |
| 1607 | continue; | 1606 | continue; |
| 1608 | 1607 | ||
| 1609 | snd_soc_write(codec, i, max98088->reg_cache[i]); | 1608 | snd_soc_write(codec, i, reg_cache[i]); |
| 1610 | } | 1609 | } |
| 1611 | 1610 | ||
| 1612 | codec->cache_sync = 0; | 1611 | codec->cache_sync = 0; |
| @@ -1951,7 +1950,6 @@ static int max98088_probe(struct snd_soc_codec *codec) | |||
| 1951 | int ret = 0; | 1950 | int ret = 0; |
| 1952 | 1951 | ||
| 1953 | codec->cache_sync = 1; | 1952 | codec->cache_sync = 1; |
| 1954 | memcpy(codec->reg_cache, max98088_reg, sizeof(max98088_reg)); | ||
| 1955 | 1953 | ||
| 1956 | ret = snd_soc_codec_set_cache_io(codec, 8, 8, SND_SOC_I2C); | 1954 | ret = snd_soc_codec_set_cache_io(codec, 8, 8, SND_SOC_I2C); |
| 1957 | if (ret != 0) { | 1955 | if (ret != 0) { |
diff --git a/sound/soc/codecs/wm8523.c b/sound/soc/codecs/wm8523.c index 9a433a5396cb..deca79ea2b4b 100644 --- a/sound/soc/codecs/wm8523.c +++ b/sound/soc/codecs/wm8523.c | |||
| @@ -41,7 +41,6 @@ static const char *wm8523_supply_names[WM8523_NUM_SUPPLIES] = { | |||
| 41 | /* codec private data */ | 41 | /* codec private data */ |
| 42 | struct wm8523_priv { | 42 | struct wm8523_priv { |
| 43 | enum snd_soc_control_type control_type; | 43 | enum snd_soc_control_type control_type; |
| 44 | u16 reg_cache[WM8523_REGISTER_COUNT]; | ||
| 45 | struct regulator_bulk_data supplies[WM8523_NUM_SUPPLIES]; | 44 | struct regulator_bulk_data supplies[WM8523_NUM_SUPPLIES]; |
| 46 | unsigned int sysclk; | 45 | unsigned int sysclk; |
| 47 | unsigned int rate_constraint_list[WM8523_NUM_RATES]; | 46 | unsigned int rate_constraint_list[WM8523_NUM_RATES]; |
| @@ -314,6 +313,7 @@ static int wm8523_set_bias_level(struct snd_soc_codec *codec, | |||
| 314 | enum snd_soc_bias_level level) | 313 | enum snd_soc_bias_level level) |
| 315 | { | 314 | { |
| 316 | struct wm8523_priv *wm8523 = snd_soc_codec_get_drvdata(codec); | 315 | struct wm8523_priv *wm8523 = snd_soc_codec_get_drvdata(codec); |
| 316 | u16 *reg_cache = codec->reg_cache; | ||
| 317 | int ret, i; | 317 | int ret, i; |
| 318 | 318 | ||
| 319 | switch (level) { | 319 | switch (level) { |
| @@ -344,7 +344,7 @@ static int wm8523_set_bias_level(struct snd_soc_codec *codec, | |||
| 344 | /* Sync back default/cached values */ | 344 | /* Sync back default/cached values */ |
| 345 | for (i = WM8523_AIF_CTRL1; | 345 | for (i = WM8523_AIF_CTRL1; |
| 346 | i < WM8523_MAX_REGISTER; i++) | 346 | i < WM8523_MAX_REGISTER; i++) |
| 347 | snd_soc_write(codec, i, wm8523->reg_cache[i]); | 347 | snd_soc_write(codec, i, reg_cache[i]); |
| 348 | 348 | ||
| 349 | 349 | ||
| 350 | msleep(100); | 350 | msleep(100); |
| @@ -414,6 +414,7 @@ static int wm8523_resume(struct snd_soc_codec *codec) | |||
| 414 | static int wm8523_probe(struct snd_soc_codec *codec) | 414 | static int wm8523_probe(struct snd_soc_codec *codec) |
| 415 | { | 415 | { |
| 416 | struct wm8523_priv *wm8523 = snd_soc_codec_get_drvdata(codec); | 416 | struct wm8523_priv *wm8523 = snd_soc_codec_get_drvdata(codec); |
| 417 | u16 *reg_cache = codec->reg_cache; | ||
| 417 | int ret, i; | 418 | int ret, i; |
| 418 | 419 | ||
| 419 | codec->hw_write = (hw_write_t)i2c_master_send; | 420 | codec->hw_write = (hw_write_t)i2c_master_send; |
| @@ -470,8 +471,8 @@ static int wm8523_probe(struct snd_soc_codec *codec) | |||
| 470 | } | 471 | } |
| 471 | 472 | ||
| 472 | /* Change some default settings - latch VU and enable ZC */ | 473 | /* Change some default settings - latch VU and enable ZC */ |
| 473 | wm8523->reg_cache[WM8523_DAC_GAINR] |= WM8523_DACR_VU; | 474 | reg_cache[WM8523_DAC_GAINR] |= WM8523_DACR_VU; |
| 474 | wm8523->reg_cache[WM8523_DAC_CTRL3] |= WM8523_ZC; | 475 | reg_cache[WM8523_DAC_CTRL3] |= WM8523_ZC; |
| 475 | 476 | ||
| 476 | wm8523_set_bias_level(codec, SND_SOC_BIAS_STANDBY); | 477 | wm8523_set_bias_level(codec, SND_SOC_BIAS_STANDBY); |
| 477 | 478 | ||
diff --git a/sound/soc/codecs/wm8741.c b/sound/soc/codecs/wm8741.c index 90e31e9aa6f7..aea60ef8aba7 100644 --- a/sound/soc/codecs/wm8741.c +++ b/sound/soc/codecs/wm8741.c | |||
| @@ -41,7 +41,6 @@ static const char *wm8741_supply_names[WM8741_NUM_SUPPLIES] = { | |||
| 41 | /* codec private data */ | 41 | /* codec private data */ |
| 42 | struct wm8741_priv { | 42 | struct wm8741_priv { |
| 43 | enum snd_soc_control_type control_type; | 43 | enum snd_soc_control_type control_type; |
| 44 | u16 reg_cache[WM8741_REGISTER_COUNT]; | ||
| 45 | struct regulator_bulk_data supplies[WM8741_NUM_SUPPLIES]; | 44 | struct regulator_bulk_data supplies[WM8741_NUM_SUPPLIES]; |
| 46 | unsigned int sysclk; | 45 | unsigned int sysclk; |
| 47 | struct snd_pcm_hw_constraint_list *sysclk_constraints; | 46 | struct snd_pcm_hw_constraint_list *sysclk_constraints; |
| @@ -422,6 +421,7 @@ static int wm8741_resume(struct snd_soc_codec *codec) | |||
| 422 | static int wm8741_probe(struct snd_soc_codec *codec) | 421 | static int wm8741_probe(struct snd_soc_codec *codec) |
| 423 | { | 422 | { |
| 424 | struct wm8741_priv *wm8741 = snd_soc_codec_get_drvdata(codec); | 423 | struct wm8741_priv *wm8741 = snd_soc_codec_get_drvdata(codec); |
| 424 | u16 *reg_cache = codec->reg_cache; | ||
| 425 | int ret = 0; | 425 | int ret = 0; |
| 426 | 426 | ||
| 427 | ret = snd_soc_codec_set_cache_io(codec, 7, 9, wm8741->control_type); | 427 | ret = snd_soc_codec_set_cache_io(codec, 7, 9, wm8741->control_type); |
| @@ -437,10 +437,10 @@ static int wm8741_probe(struct snd_soc_codec *codec) | |||
| 437 | } | 437 | } |
| 438 | 438 | ||
| 439 | /* Change some default settings - latch VU */ | 439 | /* Change some default settings - latch VU */ |
| 440 | wm8741->reg_cache[WM8741_DACLLSB_ATTENUATION] |= WM8741_UPDATELL; | 440 | reg_cache[WM8741_DACLLSB_ATTENUATION] |= WM8741_UPDATELL; |
| 441 | wm8741->reg_cache[WM8741_DACLMSB_ATTENUATION] |= WM8741_UPDATELM; | 441 | reg_cache[WM8741_DACLMSB_ATTENUATION] |= WM8741_UPDATELM; |
| 442 | wm8741->reg_cache[WM8741_DACRLSB_ATTENUATION] |= WM8741_UPDATERL; | 442 | reg_cache[WM8741_DACRLSB_ATTENUATION] |= WM8741_UPDATERL; |
| 443 | wm8741->reg_cache[WM8741_DACRLSB_ATTENUATION] |= WM8741_UPDATERM; | 443 | reg_cache[WM8741_DACRLSB_ATTENUATION] |= WM8741_UPDATERM; |
| 444 | 444 | ||
| 445 | snd_soc_add_controls(codec, wm8741_snd_controls, | 445 | snd_soc_add_controls(codec, wm8741_snd_controls, |
| 446 | ARRAY_SIZE(wm8741_snd_controls)); | 446 | ARRAY_SIZE(wm8741_snd_controls)); |
diff --git a/sound/soc/codecs/wm8753.c b/sound/soc/codecs/wm8753.c index 8f679a13f2bc..87caae59e939 100644 --- a/sound/soc/codecs/wm8753.c +++ b/sound/soc/codecs/wm8753.c | |||
| @@ -65,22 +65,22 @@ static void wm8753_set_dai_mode(struct snd_soc_codec *codec, | |||
| 65 | * are using 2 wire for device control, so we cache them instead. | 65 | * are using 2 wire for device control, so we cache them instead. |
| 66 | */ | 66 | */ |
| 67 | static const u16 wm8753_reg[] = { | 67 | static const u16 wm8753_reg[] = { |
| 68 | 0x0008, 0x0000, 0x000a, 0x000a, | 68 | 0x0000, 0x0008, 0x0000, 0x000a, |
| 69 | 0x0033, 0x0000, 0x0007, 0x00ff, | 69 | 0x000a, 0x0033, 0x0000, 0x0007, |
| 70 | 0x00ff, 0x000f, 0x000f, 0x007b, | 70 | 0x00ff, 0x00ff, 0x000f, 0x000f, |
| 71 | 0x0000, 0x0032, 0x0000, 0x00c3, | 71 | 0x007b, 0x0000, 0x0032, 0x0000, |
| 72 | 0x00c3, 0x00c0, 0x0000, 0x0000, | 72 | 0x00c3, 0x00c3, 0x00c0, 0x0000, |
| 73 | 0x0000, 0x0000, 0x0000, 0x0000, | 73 | 0x0000, 0x0000, 0x0000, 0x0000, |
| 74 | 0x0000, 0x0000, 0x0000, 0x0000, | 74 | 0x0000, 0x0000, 0x0000, 0x0000, |
| 75 | 0x0000, 0x0000, 0x0000, 0x0055, | ||
| 76 | 0x0005, 0x0050, 0x0055, 0x0050, | ||
| 77 | 0x0055, 0x0050, 0x0055, 0x0079, | ||
| 78 | 0x0079, 0x0079, 0x0079, 0x0079, | ||
| 79 | 0x0000, 0x0000, 0x0000, 0x0000, | 75 | 0x0000, 0x0000, 0x0000, 0x0000, |
| 80 | 0x0097, 0x0097, 0x0000, 0x0004, | 76 | 0x0055, 0x0005, 0x0050, 0x0055, |
| 81 | 0x0000, 0x0083, 0x0024, 0x01ba, | 77 | 0x0050, 0x0055, 0x0050, 0x0055, |
| 82 | 0x0000, 0x0083, 0x0024, 0x01ba, | 78 | 0x0079, 0x0079, 0x0079, 0x0079, |
| 83 | 0x0000, 0x0000, 0x0000 | 79 | 0x0079, 0x0000, 0x0000, 0x0000, |
| 80 | 0x0000, 0x0097, 0x0097, 0x0000, | ||
| 81 | 0x0004, 0x0000, 0x0083, 0x0024, | ||
| 82 | 0x01ba, 0x0000, 0x0083, 0x0024, | ||
| 83 | 0x01ba, 0x0000, 0x0000, 0x0000 | ||
| 84 | }; | 84 | }; |
| 85 | 85 | ||
| 86 | /* codec private data */ | 86 | /* codec private data */ |
| @@ -88,57 +88,10 @@ struct wm8753_priv { | |||
| 88 | enum snd_soc_control_type control_type; | 88 | enum snd_soc_control_type control_type; |
| 89 | unsigned int sysclk; | 89 | unsigned int sysclk; |
| 90 | unsigned int pcmclk; | 90 | unsigned int pcmclk; |
| 91 | u16 reg_cache[ARRAY_SIZE(wm8753_reg)]; | ||
| 92 | int dai_func; | 91 | int dai_func; |
| 93 | }; | 92 | }; |
| 94 | 93 | ||
| 95 | /* | 94 | #define wm8753_reset(c) snd_soc_write(c, WM8753_RESET, 0) |
| 96 | * read wm8753 register cache | ||
| 97 | */ | ||
| 98 | static inline unsigned int wm8753_read_reg_cache(struct snd_soc_codec *codec, | ||
| 99 | unsigned int reg) | ||
| 100 | { | ||
| 101 | u16 *cache = codec->reg_cache; | ||
| 102 | if (reg < 1 || reg >= (ARRAY_SIZE(wm8753_reg) + 1)) | ||
| 103 | return -1; | ||
| 104 | return cache[reg - 1]; | ||
| 105 | } | ||
| 106 | |||
| 107 | /* | ||
| 108 | * write wm8753 register cache | ||
| 109 | */ | ||
| 110 | static inline void wm8753_write_reg_cache(struct snd_soc_codec *codec, | ||
| 111 | unsigned int reg, unsigned int value) | ||
| 112 | { | ||
| 113 | u16 *cache = codec->reg_cache; | ||
| 114 | if (reg < 1 || reg >= (ARRAY_SIZE(wm8753_reg) + 1)) | ||
| 115 | return; | ||
| 116 | cache[reg - 1] = value; | ||
| 117 | } | ||
| 118 | |||
| 119 | /* | ||
| 120 | * write to the WM8753 register space | ||
| 121 | */ | ||
| 122 | static int wm8753_write(struct snd_soc_codec *codec, unsigned int reg, | ||
| 123 | unsigned int value) | ||
| 124 | { | ||
| 125 | u8 data[2]; | ||
| 126 | |||
| 127 | /* data is | ||
| 128 | * D15..D9 WM8753 register offset | ||
| 129 | * D8...D0 register data | ||
| 130 | */ | ||
| 131 | data[0] = (reg << 1) | ((value >> 8) & 0x0001); | ||
| 132 | data[1] = value & 0x00ff; | ||
| 133 | |||
| 134 | wm8753_write_reg_cache(codec, reg, value); | ||
| 135 | if (codec->hw_write(codec->control_data, data, 2) == 2) | ||
| 136 | return 0; | ||
| 137 | else | ||
| 138 | return -EIO; | ||
| 139 | } | ||
| 140 | |||
| 141 | #define wm8753_reset(c) wm8753_write(c, WM8753_RESET, 0) | ||
| 142 | 95 | ||
| 143 | /* | 96 | /* |
| 144 | * WM8753 Controls | 97 | * WM8753 Controls |
| @@ -218,7 +171,7 @@ static int wm8753_get_dai(struct snd_kcontrol *kcontrol, | |||
| 218 | struct snd_ctl_elem_value *ucontrol) | 171 | struct snd_ctl_elem_value *ucontrol) |
| 219 | { | 172 | { |
| 220 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); | 173 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); |
| 221 | int mode = wm8753_read_reg_cache(codec, WM8753_IOCTL); | 174 | int mode = snd_soc_read(codec, WM8753_IOCTL); |
| 222 | 175 | ||
| 223 | ucontrol->value.integer.value[0] = (mode & 0xc) >> 2; | 176 | ucontrol->value.integer.value[0] = (mode & 0xc) >> 2; |
| 224 | return 0; | 177 | return 0; |
| @@ -228,7 +181,7 @@ static int wm8753_set_dai(struct snd_kcontrol *kcontrol, | |||
| 228 | struct snd_ctl_elem_value *ucontrol) | 181 | struct snd_ctl_elem_value *ucontrol) |
| 229 | { | 182 | { |
| 230 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); | 183 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); |
| 231 | int mode = wm8753_read_reg_cache(codec, WM8753_IOCTL); | 184 | int mode = snd_soc_read(codec, WM8753_IOCTL); |
| 232 | struct wm8753_priv *wm8753 = snd_soc_codec_get_drvdata(codec); | 185 | struct wm8753_priv *wm8753 = snd_soc_codec_get_drvdata(codec); |
| 233 | 186 | ||
| 234 | if (((mode & 0xc) >> 2) == ucontrol->value.integer.value[0]) | 187 | if (((mode & 0xc) >> 2) == ucontrol->value.integer.value[0]) |
| @@ -738,17 +691,17 @@ static int wm8753_set_dai_pll(struct snd_soc_dai *codec_dai, int pll_id, | |||
| 738 | if (pll_id == WM8753_PLL1) { | 691 | if (pll_id == WM8753_PLL1) { |
| 739 | offset = 0; | 692 | offset = 0; |
| 740 | enable = 0x10; | 693 | enable = 0x10; |
| 741 | reg = wm8753_read_reg_cache(codec, WM8753_CLOCK) & 0xffef; | 694 | reg = snd_soc_read(codec, WM8753_CLOCK) & 0xffef; |
| 742 | } else { | 695 | } else { |
| 743 | offset = 4; | 696 | offset = 4; |
| 744 | enable = 0x8; | 697 | enable = 0x8; |
| 745 | reg = wm8753_read_reg_cache(codec, WM8753_CLOCK) & 0xfff7; | 698 | reg = snd_soc_read(codec, WM8753_CLOCK) & 0xfff7; |
| 746 | } | 699 | } |
| 747 | 700 | ||
| 748 | if (!freq_in || !freq_out) { | 701 | if (!freq_in || !freq_out) { |
| 749 | /* disable PLL */ | 702 | /* disable PLL */ |
| 750 | wm8753_write(codec, WM8753_PLL1CTL1 + offset, 0x0026); | 703 | snd_soc_write(codec, WM8753_PLL1CTL1 + offset, 0x0026); |
| 751 | wm8753_write(codec, WM8753_CLOCK, reg); | 704 | snd_soc_write(codec, WM8753_CLOCK, reg); |
| 752 | return 0; | 705 | return 0; |
| 753 | } else { | 706 | } else { |
| 754 | u16 value = 0; | 707 | u16 value = 0; |
| @@ -759,20 +712,20 @@ static int wm8753_set_dai_pll(struct snd_soc_dai *codec_dai, int pll_id, | |||
| 759 | /* set up N and K PLL divisor ratios */ | 712 | /* set up N and K PLL divisor ratios */ |
| 760 | /* bits 8:5 = PLL_N, bits 3:0 = PLL_K[21:18] */ | 713 | /* bits 8:5 = PLL_N, bits 3:0 = PLL_K[21:18] */ |
| 761 | value = (pll_div.n << 5) + ((pll_div.k & 0x3c0000) >> 18); | 714 | value = (pll_div.n << 5) + ((pll_div.k & 0x3c0000) >> 18); |
| 762 | wm8753_write(codec, WM8753_PLL1CTL2 + offset, value); | 715 | snd_soc_write(codec, WM8753_PLL1CTL2 + offset, value); |
| 763 | 716 | ||
| 764 | /* bits 8:0 = PLL_K[17:9] */ | 717 | /* bits 8:0 = PLL_K[17:9] */ |
| 765 | value = (pll_div.k & 0x03fe00) >> 9; | 718 | value = (pll_div.k & 0x03fe00) >> 9; |
| 766 | wm8753_write(codec, WM8753_PLL1CTL3 + offset, value); | 719 | snd_soc_write(codec, WM8753_PLL1CTL3 + offset, value); |
| 767 | 720 | ||
| 768 | /* bits 8:0 = PLL_K[8:0] */ | 721 | /* bits 8:0 = PLL_K[8:0] */ |
| 769 | value = pll_div.k & 0x0001ff; | 722 | value = pll_div.k & 0x0001ff; |
| 770 | wm8753_write(codec, WM8753_PLL1CTL4 + offset, value); | 723 | snd_soc_write(codec, WM8753_PLL1CTL4 + offset, value); |
| 771 | 724 | ||
| 772 | /* set PLL as input and enable */ | 725 | /* set PLL as input and enable */ |
| 773 | wm8753_write(codec, WM8753_PLL1CTL1 + offset, 0x0027 | | 726 | snd_soc_write(codec, WM8753_PLL1CTL1 + offset, 0x0027 | |
| 774 | (pll_div.div2 << 3)); | 727 | (pll_div.div2 << 3)); |
| 775 | wm8753_write(codec, WM8753_CLOCK, reg | enable); | 728 | snd_soc_write(codec, WM8753_CLOCK, reg | enable); |
| 776 | } | 729 | } |
| 777 | return 0; | 730 | return 0; |
| 778 | } | 731 | } |
| @@ -879,7 +832,7 @@ static int wm8753_vdac_adc_set_dai_fmt(struct snd_soc_dai *codec_dai, | |||
| 879 | unsigned int fmt) | 832 | unsigned int fmt) |
| 880 | { | 833 | { |
| 881 | struct snd_soc_codec *codec = codec_dai->codec; | 834 | struct snd_soc_codec *codec = codec_dai->codec; |
| 882 | u16 voice = wm8753_read_reg_cache(codec, WM8753_PCM) & 0x01ec; | 835 | u16 voice = snd_soc_read(codec, WM8753_PCM) & 0x01ec; |
| 883 | 836 | ||
| 884 | /* interface format */ | 837 | /* interface format */ |
| 885 | switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { | 838 | switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { |
| @@ -901,7 +854,7 @@ static int wm8753_vdac_adc_set_dai_fmt(struct snd_soc_dai *codec_dai, | |||
| 901 | return -EINVAL; | 854 | return -EINVAL; |
| 902 | } | 855 | } |
| 903 | 856 | ||
| 904 | wm8753_write(codec, WM8753_PCM, voice); | 857 | snd_soc_write(codec, WM8753_PCM, voice); |
| 905 | return 0; | 858 | return 0; |
| 906 | } | 859 | } |
| 907 | 860 | ||
| @@ -922,8 +875,8 @@ static int wm8753_pcm_hw_params(struct snd_pcm_substream *substream, | |||
| 922 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 875 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
| 923 | struct snd_soc_codec *codec = rtd->codec; | 876 | struct snd_soc_codec *codec = rtd->codec; |
| 924 | struct wm8753_priv *wm8753 = snd_soc_codec_get_drvdata(codec); | 877 | struct wm8753_priv *wm8753 = snd_soc_codec_get_drvdata(codec); |
| 925 | u16 voice = wm8753_read_reg_cache(codec, WM8753_PCM) & 0x01f3; | 878 | u16 voice = snd_soc_read(codec, WM8753_PCM) & 0x01f3; |
| 926 | u16 srate = wm8753_read_reg_cache(codec, WM8753_SRATE1) & 0x017f; | 879 | u16 srate = snd_soc_read(codec, WM8753_SRATE1) & 0x017f; |
| 927 | 880 | ||
| 928 | /* bit size */ | 881 | /* bit size */ |
| 929 | switch (params_format(params)) { | 882 | switch (params_format(params)) { |
| @@ -943,9 +896,9 @@ static int wm8753_pcm_hw_params(struct snd_pcm_substream *substream, | |||
| 943 | /* sample rate */ | 896 | /* sample rate */ |
| 944 | if (params_rate(params) * 384 == wm8753->pcmclk) | 897 | if (params_rate(params) * 384 == wm8753->pcmclk) |
| 945 | srate |= 0x80; | 898 | srate |= 0x80; |
| 946 | wm8753_write(codec, WM8753_SRATE1, srate); | 899 | snd_soc_write(codec, WM8753_SRATE1, srate); |
| 947 | 900 | ||
| 948 | wm8753_write(codec, WM8753_PCM, voice); | 901 | snd_soc_write(codec, WM8753_PCM, voice); |
| 949 | return 0; | 902 | return 0; |
| 950 | } | 903 | } |
| 951 | 904 | ||
| @@ -958,8 +911,8 @@ static int wm8753_pcm_set_dai_fmt(struct snd_soc_dai *codec_dai, | |||
| 958 | struct snd_soc_codec *codec = codec_dai->codec; | 911 | struct snd_soc_codec *codec = codec_dai->codec; |
| 959 | u16 voice, ioctl; | 912 | u16 voice, ioctl; |
| 960 | 913 | ||
| 961 | voice = wm8753_read_reg_cache(codec, WM8753_PCM) & 0x011f; | 914 | voice = snd_soc_read(codec, WM8753_PCM) & 0x011f; |
| 962 | ioctl = wm8753_read_reg_cache(codec, WM8753_IOCTL) & 0x015d; | 915 | ioctl = snd_soc_read(codec, WM8753_IOCTL) & 0x015d; |
| 963 | 916 | ||
| 964 | /* set master/slave audio interface */ | 917 | /* set master/slave audio interface */ |
| 965 | switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { | 918 | switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { |
| @@ -1013,8 +966,8 @@ static int wm8753_pcm_set_dai_fmt(struct snd_soc_dai *codec_dai, | |||
| 1013 | return -EINVAL; | 966 | return -EINVAL; |
| 1014 | } | 967 | } |
| 1015 | 968 | ||
| 1016 | wm8753_write(codec, WM8753_PCM, voice); | 969 | snd_soc_write(codec, WM8753_PCM, voice); |
| 1017 | wm8753_write(codec, WM8753_IOCTL, ioctl); | 970 | snd_soc_write(codec, WM8753_IOCTL, ioctl); |
| 1018 | return 0; | 971 | return 0; |
| 1019 | } | 972 | } |
| 1020 | 973 | ||
| @@ -1026,16 +979,16 @@ static int wm8753_set_dai_clkdiv(struct snd_soc_dai *codec_dai, | |||
| 1026 | 979 | ||
| 1027 | switch (div_id) { | 980 | switch (div_id) { |
| 1028 | case WM8753_PCMDIV: | 981 | case WM8753_PCMDIV: |
| 1029 | reg = wm8753_read_reg_cache(codec, WM8753_CLOCK) & 0x003f; | 982 | reg = snd_soc_read(codec, WM8753_CLOCK) & 0x003f; |
| 1030 | wm8753_write(codec, WM8753_CLOCK, reg | div); | 983 | snd_soc_write(codec, WM8753_CLOCK, reg | div); |
| 1031 | break; | 984 | break; |
| 1032 | case WM8753_BCLKDIV: | 985 | case WM8753_BCLKDIV: |
| 1033 | reg = wm8753_read_reg_cache(codec, WM8753_SRATE2) & 0x01c7; | 986 | reg = snd_soc_read(codec, WM8753_SRATE2) & 0x01c7; |
| 1034 | wm8753_write(codec, WM8753_SRATE2, reg | div); | 987 | snd_soc_write(codec, WM8753_SRATE2, reg | div); |
| 1035 | break; | 988 | break; |
| 1036 | case WM8753_VXCLKDIV: | 989 | case WM8753_VXCLKDIV: |
| 1037 | reg = wm8753_read_reg_cache(codec, WM8753_SRATE2) & 0x003f; | 990 | reg = snd_soc_read(codec, WM8753_SRATE2) & 0x003f; |
| 1038 | wm8753_write(codec, WM8753_SRATE2, reg | div); | 991 | snd_soc_write(codec, WM8753_SRATE2, reg | div); |
| 1039 | break; | 992 | break; |
| 1040 | default: | 993 | default: |
| 1041 | return -EINVAL; | 994 | return -EINVAL; |
| @@ -1050,7 +1003,7 @@ static int wm8753_hdac_set_dai_fmt(struct snd_soc_dai *codec_dai, | |||
| 1050 | unsigned int fmt) | 1003 | unsigned int fmt) |
| 1051 | { | 1004 | { |
| 1052 | struct snd_soc_codec *codec = codec_dai->codec; | 1005 | struct snd_soc_codec *codec = codec_dai->codec; |
| 1053 | u16 hifi = wm8753_read_reg_cache(codec, WM8753_HIFI) & 0x01e0; | 1006 | u16 hifi = snd_soc_read(codec, WM8753_HIFI) & 0x01e0; |
| 1054 | 1007 | ||
| 1055 | /* interface format */ | 1008 | /* interface format */ |
| 1056 | switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { | 1009 | switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { |
| @@ -1072,7 +1025,7 @@ static int wm8753_hdac_set_dai_fmt(struct snd_soc_dai *codec_dai, | |||
| 1072 | return -EINVAL; | 1025 | return -EINVAL; |
| 1073 | } | 1026 | } |
| 1074 | 1027 | ||
| 1075 | wm8753_write(codec, WM8753_HIFI, hifi); | 1028 | snd_soc_write(codec, WM8753_HIFI, hifi); |
| 1076 | return 0; | 1029 | return 0; |
| 1077 | } | 1030 | } |
| 1078 | 1031 | ||
| @@ -1085,8 +1038,8 @@ static int wm8753_i2s_set_dai_fmt(struct snd_soc_dai *codec_dai, | |||
| 1085 | struct snd_soc_codec *codec = codec_dai->codec; | 1038 | struct snd_soc_codec *codec = codec_dai->codec; |
| 1086 | u16 ioctl, hifi; | 1039 | u16 ioctl, hifi; |
| 1087 | 1040 | ||
| 1088 | hifi = wm8753_read_reg_cache(codec, WM8753_HIFI) & 0x011f; | 1041 | hifi = snd_soc_read(codec, WM8753_HIFI) & 0x011f; |
| 1089 | ioctl = wm8753_read_reg_cache(codec, WM8753_IOCTL) & 0x00ae; | 1042 | ioctl = snd_soc_read(codec, WM8753_IOCTL) & 0x00ae; |
| 1090 | 1043 | ||
| 1091 | /* set master/slave audio interface */ | 1044 | /* set master/slave audio interface */ |
| 1092 | switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { | 1045 | switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { |
| @@ -1140,8 +1093,8 @@ static int wm8753_i2s_set_dai_fmt(struct snd_soc_dai *codec_dai, | |||
| 1140 | return -EINVAL; | 1093 | return -EINVAL; |
| 1141 | } | 1094 | } |
| 1142 | 1095 | ||
| 1143 | wm8753_write(codec, WM8753_HIFI, hifi); | 1096 | snd_soc_write(codec, WM8753_HIFI, hifi); |
| 1144 | wm8753_write(codec, WM8753_IOCTL, ioctl); | 1097 | snd_soc_write(codec, WM8753_IOCTL, ioctl); |
| 1145 | return 0; | 1098 | return 0; |
| 1146 | } | 1099 | } |
| 1147 | 1100 | ||
| @@ -1162,8 +1115,8 @@ static int wm8753_i2s_hw_params(struct snd_pcm_substream *substream, | |||
| 1162 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 1115 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
| 1163 | struct snd_soc_codec *codec = rtd->codec; | 1116 | struct snd_soc_codec *codec = rtd->codec; |
| 1164 | struct wm8753_priv *wm8753 = snd_soc_codec_get_drvdata(codec); | 1117 | struct wm8753_priv *wm8753 = snd_soc_codec_get_drvdata(codec); |
| 1165 | u16 srate = wm8753_read_reg_cache(codec, WM8753_SRATE1) & 0x01c0; | 1118 | u16 srate = snd_soc_read(codec, WM8753_SRATE1) & 0x01c0; |
| 1166 | u16 hifi = wm8753_read_reg_cache(codec, WM8753_HIFI) & 0x01f3; | 1119 | u16 hifi = snd_soc_read(codec, WM8753_HIFI) & 0x01f3; |
| 1167 | int coeff; | 1120 | int coeff; |
| 1168 | 1121 | ||
| 1169 | /* is digital filter coefficient valid ? */ | 1122 | /* is digital filter coefficient valid ? */ |
| @@ -1172,7 +1125,7 @@ static int wm8753_i2s_hw_params(struct snd_pcm_substream *substream, | |||
| 1172 | printk(KERN_ERR "wm8753 invalid MCLK or rate\n"); | 1125 | printk(KERN_ERR "wm8753 invalid MCLK or rate\n"); |
| 1173 | return coeff; | 1126 | return coeff; |
| 1174 | } | 1127 | } |
| 1175 | wm8753_write(codec, WM8753_SRATE1, srate | (coeff_div[coeff].sr << 1) | | 1128 | snd_soc_write(codec, WM8753_SRATE1, srate | (coeff_div[coeff].sr << 1) | |
| 1176 | coeff_div[coeff].usb); | 1129 | coeff_div[coeff].usb); |
| 1177 | 1130 | ||
| 1178 | /* bit size */ | 1131 | /* bit size */ |
| @@ -1190,7 +1143,7 @@ static int wm8753_i2s_hw_params(struct snd_pcm_substream *substream, | |||
| 1190 | break; | 1143 | break; |
| 1191 | } | 1144 | } |
| 1192 | 1145 | ||
| 1193 | wm8753_write(codec, WM8753_HIFI, hifi); | 1146 | snd_soc_write(codec, WM8753_HIFI, hifi); |
| 1194 | return 0; | 1147 | return 0; |
| 1195 | } | 1148 | } |
| 1196 | 1149 | ||
| @@ -1201,8 +1154,8 @@ static int wm8753_mode1v_set_dai_fmt(struct snd_soc_dai *codec_dai, | |||
| 1201 | u16 clock; | 1154 | u16 clock; |
| 1202 | 1155 | ||
| 1203 | /* set clk source as pcmclk */ | 1156 | /* set clk source as pcmclk */ |
| 1204 | clock = wm8753_read_reg_cache(codec, WM8753_CLOCK) & 0xfffb; | 1157 | clock = snd_soc_read(codec, WM8753_CLOCK) & 0xfffb; |
| 1205 | wm8753_write(codec, WM8753_CLOCK, clock); | 1158 | snd_soc_write(codec, WM8753_CLOCK, clock); |
| 1206 | 1159 | ||
| 1207 | if (wm8753_vdac_adc_set_dai_fmt(codec_dai, fmt) < 0) | 1160 | if (wm8753_vdac_adc_set_dai_fmt(codec_dai, fmt) < 0) |
| 1208 | return -EINVAL; | 1161 | return -EINVAL; |
| @@ -1224,8 +1177,8 @@ static int wm8753_mode2_set_dai_fmt(struct snd_soc_dai *codec_dai, | |||
| 1224 | u16 clock; | 1177 | u16 clock; |
| 1225 | 1178 | ||
| 1226 | /* set clk source as pcmclk */ | 1179 | /* set clk source as pcmclk */ |
| 1227 | clock = wm8753_read_reg_cache(codec, WM8753_CLOCK) & 0xfffb; | 1180 | clock = snd_soc_read(codec, WM8753_CLOCK) & 0xfffb; |
| 1228 | wm8753_write(codec, WM8753_CLOCK, clock); | 1181 | snd_soc_write(codec, WM8753_CLOCK, clock); |
| 1229 | 1182 | ||
| 1230 | if (wm8753_vdac_adc_set_dai_fmt(codec_dai, fmt) < 0) | 1183 | if (wm8753_vdac_adc_set_dai_fmt(codec_dai, fmt) < 0) |
| 1231 | return -EINVAL; | 1184 | return -EINVAL; |
| @@ -1239,8 +1192,8 @@ static int wm8753_mode3_4_set_dai_fmt(struct snd_soc_dai *codec_dai, | |||
| 1239 | u16 clock; | 1192 | u16 clock; |
| 1240 | 1193 | ||
| 1241 | /* set clk source as mclk */ | 1194 | /* set clk source as mclk */ |
| 1242 | clock = wm8753_read_reg_cache(codec, WM8753_CLOCK) & 0xfffb; | 1195 | clock = snd_soc_read(codec, WM8753_CLOCK) & 0xfffb; |
| 1243 | wm8753_write(codec, WM8753_CLOCK, clock | 0x4); | 1196 | snd_soc_write(codec, WM8753_CLOCK, clock | 0x4); |
| 1244 | 1197 | ||
| 1245 | if (wm8753_hdac_set_dai_fmt(codec_dai, fmt) < 0) | 1198 | if (wm8753_hdac_set_dai_fmt(codec_dai, fmt) < 0) |
| 1246 | return -EINVAL; | 1199 | return -EINVAL; |
| @@ -1252,19 +1205,19 @@ static int wm8753_mode3_4_set_dai_fmt(struct snd_soc_dai *codec_dai, | |||
| 1252 | static int wm8753_mute(struct snd_soc_dai *dai, int mute) | 1205 | static int wm8753_mute(struct snd_soc_dai *dai, int mute) |
| 1253 | { | 1206 | { |
| 1254 | struct snd_soc_codec *codec = dai->codec; | 1207 | struct snd_soc_codec *codec = dai->codec; |
| 1255 | u16 mute_reg = wm8753_read_reg_cache(codec, WM8753_DAC) & 0xfff7; | 1208 | u16 mute_reg = snd_soc_read(codec, WM8753_DAC) & 0xfff7; |
| 1256 | struct wm8753_priv *wm8753 = snd_soc_codec_get_drvdata(codec); | 1209 | struct wm8753_priv *wm8753 = snd_soc_codec_get_drvdata(codec); |
| 1257 | 1210 | ||
| 1258 | /* the digital mute covers the HiFi and Voice DAC's on the WM8753. | 1211 | /* the digital mute covers the HiFi and Voice DAC's on the WM8753. |
| 1259 | * make sure we check if they are not both active when we mute */ | 1212 | * make sure we check if they are not both active when we mute */ |
| 1260 | if (mute && wm8753->dai_func == 1) { | 1213 | if (mute && wm8753->dai_func == 1) { |
| 1261 | if (!codec->active) | 1214 | if (!codec->active) |
| 1262 | wm8753_write(codec, WM8753_DAC, mute_reg | 0x8); | 1215 | snd_soc_write(codec, WM8753_DAC, mute_reg | 0x8); |
| 1263 | } else { | 1216 | } else { |
| 1264 | if (mute) | 1217 | if (mute) |
| 1265 | wm8753_write(codec, WM8753_DAC, mute_reg | 0x8); | 1218 | snd_soc_write(codec, WM8753_DAC, mute_reg | 0x8); |
| 1266 | else | 1219 | else |
| 1267 | wm8753_write(codec, WM8753_DAC, mute_reg); | 1220 | snd_soc_write(codec, WM8753_DAC, mute_reg); |
| 1268 | } | 1221 | } |
| 1269 | 1222 | ||
| 1270 | return 0; | 1223 | return 0; |
| @@ -1273,23 +1226,23 @@ static int wm8753_mute(struct snd_soc_dai *dai, int mute) | |||
| 1273 | static int wm8753_set_bias_level(struct snd_soc_codec *codec, | 1226 | static int wm8753_set_bias_level(struct snd_soc_codec *codec, |
| 1274 | enum snd_soc_bias_level level) | 1227 | enum snd_soc_bias_level level) |
| 1275 | { | 1228 | { |
| 1276 | u16 pwr_reg = wm8753_read_reg_cache(codec, WM8753_PWR1) & 0xfe3e; | 1229 | u16 pwr_reg = snd_soc_read(codec, WM8753_PWR1) & 0xfe3e; |
| 1277 | 1230 | ||
| 1278 | switch (level) { | 1231 | switch (level) { |
| 1279 | case SND_SOC_BIAS_ON: | 1232 | case SND_SOC_BIAS_ON: |
| 1280 | /* set vmid to 50k and unmute dac */ | 1233 | /* set vmid to 50k and unmute dac */ |
| 1281 | wm8753_write(codec, WM8753_PWR1, pwr_reg | 0x00c0); | 1234 | snd_soc_write(codec, WM8753_PWR1, pwr_reg | 0x00c0); |
| 1282 | break; | 1235 | break; |
| 1283 | case SND_SOC_BIAS_PREPARE: | 1236 | case SND_SOC_BIAS_PREPARE: |
| 1284 | /* set vmid to 5k for quick power up */ | 1237 | /* set vmid to 5k for quick power up */ |
| 1285 | wm8753_write(codec, WM8753_PWR1, pwr_reg | 0x01c1); | 1238 | snd_soc_write(codec, WM8753_PWR1, pwr_reg | 0x01c1); |
| 1286 | break; | 1239 | break; |
| 1287 | case SND_SOC_BIAS_STANDBY: | 1240 | case SND_SOC_BIAS_STANDBY: |
| 1288 | /* mute dac and set vmid to 500k, enable VREF */ | 1241 | /* mute dac and set vmid to 500k, enable VREF */ |
| 1289 | wm8753_write(codec, WM8753_PWR1, pwr_reg | 0x0141); | 1242 | snd_soc_write(codec, WM8753_PWR1, pwr_reg | 0x0141); |
| 1290 | break; | 1243 | break; |
| 1291 | case SND_SOC_BIAS_OFF: | 1244 | case SND_SOC_BIAS_OFF: |
| 1292 | wm8753_write(codec, WM8753_PWR1, 0x0001); | 1245 | snd_soc_write(codec, WM8753_PWR1, 0x0001); |
| 1293 | break; | 1246 | break; |
| 1294 | } | 1247 | } |
| 1295 | codec->bias_level = level; | 1248 | codec->bias_level = level; |
| @@ -1477,7 +1430,7 @@ static void wm8753_set_dai_mode(struct snd_soc_codec *codec, | |||
| 1477 | else | 1430 | else |
| 1478 | dai->driver = &wm8753_all_dai[(wm8753->dai_func << 1) + 1]; | 1431 | dai->driver = &wm8753_all_dai[(wm8753->dai_func << 1) + 1]; |
| 1479 | } | 1432 | } |
| 1480 | wm8753_write(codec, WM8753_IOCTL, wm8753->dai_func); | 1433 | snd_soc_write(codec, WM8753_IOCTL, wm8753->dai_func); |
| 1481 | } | 1434 | } |
| 1482 | 1435 | ||
| 1483 | static void wm8753_work(struct work_struct *work) | 1436 | static void wm8753_work(struct work_struct *work) |
| @@ -1495,22 +1448,19 @@ static int wm8753_suspend(struct snd_soc_codec *codec, pm_message_t state) | |||
| 1495 | 1448 | ||
| 1496 | static int wm8753_resume(struct snd_soc_codec *codec) | 1449 | static int wm8753_resume(struct snd_soc_codec *codec) |
| 1497 | { | 1450 | { |
| 1451 | u16 *reg_cache = codec->reg_cache; | ||
| 1498 | int i; | 1452 | int i; |
| 1499 | u8 data[2]; | ||
| 1500 | u16 *cache = codec->reg_cache; | ||
| 1501 | 1453 | ||
| 1502 | /* Sync reg_cache with the hardware */ | 1454 | /* Sync reg_cache with the hardware */ |
| 1503 | for (i = 0; i < ARRAY_SIZE(wm8753_reg); i++) { | 1455 | for (i = 1; i < ARRAY_SIZE(wm8753_reg); i++) { |
| 1504 | if (i + 1 == WM8753_RESET) | 1456 | if (i == WM8753_RESET) |
| 1505 | continue; | 1457 | continue; |
| 1506 | 1458 | ||
| 1507 | /* No point in writing hardware default values back */ | 1459 | /* No point in writing hardware default values back */ |
| 1508 | if (cache[i] == wm8753_reg[i]) | 1460 | if (reg_cache[i] == wm8753_reg[i]) |
| 1509 | continue; | 1461 | continue; |
| 1510 | 1462 | ||
| 1511 | data[0] = ((i + 1) << 1) | ((cache[i] >> 8) & 0x0001); | 1463 | snd_soc_write(codec, i, reg_cache[i]); |
| 1512 | data[1] = cache[i] & 0x00ff; | ||
| 1513 | codec->hw_write(codec->control_data, data, 2); | ||
| 1514 | } | 1464 | } |
| 1515 | 1465 | ||
| 1516 | wm8753_set_bias_level(codec, SND_SOC_BIAS_STANDBY); | 1466 | wm8753_set_bias_level(codec, SND_SOC_BIAS_STANDBY); |
| @@ -1548,7 +1498,7 @@ static int run_delayed_work(struct delayed_work *dwork) | |||
| 1548 | static int wm8753_probe(struct snd_soc_codec *codec) | 1498 | static int wm8753_probe(struct snd_soc_codec *codec) |
| 1549 | { | 1499 | { |
| 1550 | struct wm8753_priv *wm8753 = snd_soc_codec_get_drvdata(codec); | 1500 | struct wm8753_priv *wm8753 = snd_soc_codec_get_drvdata(codec); |
| 1551 | int ret = 0, reg; | 1501 | int ret; |
| 1552 | 1502 | ||
| 1553 | INIT_DELAYED_WORK(&codec->delayed_work, wm8753_work); | 1503 | INIT_DELAYED_WORK(&codec->delayed_work, wm8753_work); |
| 1554 | 1504 | ||
| @@ -1573,26 +1523,16 @@ static int wm8753_probe(struct snd_soc_codec *codec) | |||
| 1573 | msecs_to_jiffies(caps_charge)); | 1523 | msecs_to_jiffies(caps_charge)); |
| 1574 | 1524 | ||
| 1575 | /* set the update bits */ | 1525 | /* set the update bits */ |
| 1576 | reg = wm8753_read_reg_cache(codec, WM8753_LDAC); | 1526 | snd_soc_update_bits(codec, WM8753_LDAC, 0x0100, 0x0100); |
| 1577 | wm8753_write(codec, WM8753_LDAC, reg | 0x0100); | 1527 | snd_soc_update_bits(codec, WM8753_RDAC, 0x0100, 0x0100); |
| 1578 | reg = wm8753_read_reg_cache(codec, WM8753_RDAC); | 1528 | snd_soc_update_bits(codec, WM8753_LDAC, 0x0100, 0x0100); |
| 1579 | wm8753_write(codec, WM8753_RDAC, reg | 0x0100); | 1529 | snd_soc_update_bits(codec, WM8753_RDAC, 0x0100, 0x0100); |
| 1580 | reg = wm8753_read_reg_cache(codec, WM8753_LADC); | 1530 | snd_soc_update_bits(codec, WM8753_LOUT1V, 0x0100, 0x0100); |
| 1581 | wm8753_write(codec, WM8753_LADC, reg | 0x0100); | 1531 | snd_soc_update_bits(codec, WM8753_ROUT1V, 0x0100, 0x0100); |
| 1582 | reg = wm8753_read_reg_cache(codec, WM8753_RADC); | 1532 | snd_soc_update_bits(codec, WM8753_LOUT2V, 0x0100, 0x0100); |
| 1583 | wm8753_write(codec, WM8753_RADC, reg | 0x0100); | 1533 | snd_soc_update_bits(codec, WM8753_ROUT2V, 0x0100, 0x0100); |
| 1584 | reg = wm8753_read_reg_cache(codec, WM8753_LOUT1V); | 1534 | snd_soc_update_bits(codec, WM8753_LINVOL, 0x0100, 0x0100); |
| 1585 | wm8753_write(codec, WM8753_LOUT1V, reg | 0x0100); | 1535 | snd_soc_update_bits(codec, WM8753_RINVOL, 0x0100, 0x0100); |
| 1586 | reg = wm8753_read_reg_cache(codec, WM8753_ROUT1V); | ||
| 1587 | wm8753_write(codec, WM8753_ROUT1V, reg | 0x0100); | ||
| 1588 | reg = wm8753_read_reg_cache(codec, WM8753_LOUT2V); | ||
| 1589 | wm8753_write(codec, WM8753_LOUT2V, reg | 0x0100); | ||
| 1590 | reg = wm8753_read_reg_cache(codec, WM8753_ROUT2V); | ||
| 1591 | wm8753_write(codec, WM8753_ROUT2V, reg | 0x0100); | ||
| 1592 | reg = wm8753_read_reg_cache(codec, WM8753_LINVOL); | ||
| 1593 | wm8753_write(codec, WM8753_LINVOL, reg | 0x0100); | ||
| 1594 | reg = wm8753_read_reg_cache(codec, WM8753_RINVOL); | ||
| 1595 | wm8753_write(codec, WM8753_RINVOL, reg | 0x0100); | ||
| 1596 | 1536 | ||
| 1597 | snd_soc_add_controls(codec, wm8753_snd_controls, | 1537 | snd_soc_add_controls(codec, wm8753_snd_controls, |
| 1598 | ARRAY_SIZE(wm8753_snd_controls)); | 1538 | ARRAY_SIZE(wm8753_snd_controls)); |
diff --git a/sound/soc/codecs/wm8904.c b/sound/soc/codecs/wm8904.c index 9001cc48ba13..1ec12eff0620 100644 --- a/sound/soc/codecs/wm8904.c +++ b/sound/soc/codecs/wm8904.c | |||
| @@ -50,8 +50,6 @@ static const char *wm8904_supply_names[WM8904_NUM_SUPPLIES] = { | |||
| 50 | /* codec private data */ | 50 | /* codec private data */ |
| 51 | struct wm8904_priv { | 51 | struct wm8904_priv { |
| 52 | 52 | ||
| 53 | u16 reg_cache[WM8904_MAX_REGISTER + 1]; | ||
| 54 | |||
| 55 | enum wm8904_type devtype; | 53 | enum wm8904_type devtype; |
| 56 | void *control_data; | 54 | void *control_data; |
| 57 | 55 | ||
| @@ -2094,7 +2092,7 @@ static int wm8904_digital_mute(struct snd_soc_dai *codec_dai, int mute) | |||
| 2094 | 2092 | ||
| 2095 | static void wm8904_sync_cache(struct snd_soc_codec *codec) | 2093 | static void wm8904_sync_cache(struct snd_soc_codec *codec) |
| 2096 | { | 2094 | { |
| 2097 | struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec); | 2095 | u16 *reg_cache = codec->reg_cache; |
| 2098 | int i; | 2096 | int i; |
| 2099 | 2097 | ||
| 2100 | if (!codec->cache_sync) | 2098 | if (!codec->cache_sync) |
| @@ -2105,14 +2103,14 @@ static void wm8904_sync_cache(struct snd_soc_codec *codec) | |||
| 2105 | /* Sync back cached values if they're different from the | 2103 | /* Sync back cached values if they're different from the |
| 2106 | * hardware default. | 2104 | * hardware default. |
| 2107 | */ | 2105 | */ |
| 2108 | for (i = 1; i < ARRAY_SIZE(wm8904->reg_cache); i++) { | 2106 | for (i = 1; i < codec->driver->reg_cache_size; i++) { |
| 2109 | if (!wm8904_access[i].writable) | 2107 | if (!wm8904_access[i].writable) |
| 2110 | continue; | 2108 | continue; |
| 2111 | 2109 | ||
| 2112 | if (wm8904->reg_cache[i] == wm8904_reg[i]) | 2110 | if (reg_cache[i] == wm8904_reg[i]) |
| 2113 | continue; | 2111 | continue; |
| 2114 | 2112 | ||
| 2115 | snd_soc_write(codec, i, wm8904->reg_cache[i]); | 2113 | snd_soc_write(codec, i, reg_cache[i]); |
| 2116 | } | 2114 | } |
| 2117 | 2115 | ||
| 2118 | codec->cache_sync = 0; | 2116 | codec->cache_sync = 0; |
| @@ -2371,6 +2369,7 @@ static int wm8904_probe(struct snd_soc_codec *codec) | |||
| 2371 | { | 2369 | { |
| 2372 | struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec); | 2370 | struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec); |
| 2373 | struct wm8904_pdata *pdata = wm8904->pdata; | 2371 | struct wm8904_pdata *pdata = wm8904->pdata; |
| 2372 | u16 *reg_cache = codec->reg_cache; | ||
| 2374 | int ret, i; | 2373 | int ret, i; |
| 2375 | 2374 | ||
| 2376 | codec->cache_sync = 1; | 2375 | codec->cache_sync = 1; |
| @@ -2437,19 +2436,19 @@ static int wm8904_probe(struct snd_soc_codec *codec) | |||
| 2437 | } | 2436 | } |
| 2438 | 2437 | ||
| 2439 | /* Change some default settings - latch VU and enable ZC */ | 2438 | /* Change some default settings - latch VU and enable ZC */ |
| 2440 | wm8904->reg_cache[WM8904_ADC_DIGITAL_VOLUME_LEFT] |= WM8904_ADC_VU; | 2439 | reg_cache[WM8904_ADC_DIGITAL_VOLUME_LEFT] |= WM8904_ADC_VU; |
| 2441 | wm8904->reg_cache[WM8904_ADC_DIGITAL_VOLUME_RIGHT] |= WM8904_ADC_VU; | 2440 | reg_cache[WM8904_ADC_DIGITAL_VOLUME_RIGHT] |= WM8904_ADC_VU; |
| 2442 | wm8904->reg_cache[WM8904_DAC_DIGITAL_VOLUME_LEFT] |= WM8904_DAC_VU; | 2441 | reg_cache[WM8904_DAC_DIGITAL_VOLUME_LEFT] |= WM8904_DAC_VU; |
| 2443 | wm8904->reg_cache[WM8904_DAC_DIGITAL_VOLUME_RIGHT] |= WM8904_DAC_VU; | 2442 | reg_cache[WM8904_DAC_DIGITAL_VOLUME_RIGHT] |= WM8904_DAC_VU; |
| 2444 | wm8904->reg_cache[WM8904_ANALOGUE_OUT1_LEFT] |= WM8904_HPOUT_VU | | 2443 | reg_cache[WM8904_ANALOGUE_OUT1_LEFT] |= WM8904_HPOUT_VU | |
| 2445 | WM8904_HPOUTLZC; | 2444 | WM8904_HPOUTLZC; |
| 2446 | wm8904->reg_cache[WM8904_ANALOGUE_OUT1_RIGHT] |= WM8904_HPOUT_VU | | 2445 | reg_cache[WM8904_ANALOGUE_OUT1_RIGHT] |= WM8904_HPOUT_VU | |
| 2447 | WM8904_HPOUTRZC; | 2446 | WM8904_HPOUTRZC; |
| 2448 | wm8904->reg_cache[WM8904_ANALOGUE_OUT2_LEFT] |= WM8904_LINEOUT_VU | | 2447 | reg_cache[WM8904_ANALOGUE_OUT2_LEFT] |= WM8904_LINEOUT_VU | |
| 2449 | WM8904_LINEOUTLZC; | 2448 | WM8904_LINEOUTLZC; |
| 2450 | wm8904->reg_cache[WM8904_ANALOGUE_OUT2_RIGHT] |= WM8904_LINEOUT_VU | | 2449 | reg_cache[WM8904_ANALOGUE_OUT2_RIGHT] |= WM8904_LINEOUT_VU | |
| 2451 | WM8904_LINEOUTRZC; | 2450 | WM8904_LINEOUTRZC; |
| 2452 | wm8904->reg_cache[WM8904_CLOCK_RATES_0] &= ~WM8904_SR_MODE; | 2451 | reg_cache[WM8904_CLOCK_RATES_0] &= ~WM8904_SR_MODE; |
| 2453 | 2452 | ||
| 2454 | /* Apply configuration from the platform data. */ | 2453 | /* Apply configuration from the platform data. */ |
| 2455 | if (wm8904->pdata) { | 2454 | if (wm8904->pdata) { |
| @@ -2457,23 +2456,23 @@ static int wm8904_probe(struct snd_soc_codec *codec) | |||
| 2457 | if (!pdata->gpio_cfg[i]) | 2456 | if (!pdata->gpio_cfg[i]) |
| 2458 | continue; | 2457 | continue; |
| 2459 | 2458 | ||
| 2460 | wm8904->reg_cache[WM8904_GPIO_CONTROL_1 + i] | 2459 | reg_cache[WM8904_GPIO_CONTROL_1 + i] |
| 2461 | = pdata->gpio_cfg[i] & 0xffff; | 2460 | = pdata->gpio_cfg[i] & 0xffff; |
| 2462 | } | 2461 | } |
| 2463 | 2462 | ||
| 2464 | /* Zero is the default value for these anyway */ | 2463 | /* Zero is the default value for these anyway */ |
| 2465 | for (i = 0; i < WM8904_MIC_REGS; i++) | 2464 | for (i = 0; i < WM8904_MIC_REGS; i++) |
| 2466 | wm8904->reg_cache[WM8904_MIC_BIAS_CONTROL_0 + i] | 2465 | reg_cache[WM8904_MIC_BIAS_CONTROL_0 + i] |
| 2467 | = pdata->mic_cfg[i]; | 2466 | = pdata->mic_cfg[i]; |
| 2468 | } | 2467 | } |
| 2469 | 2468 | ||
| 2470 | /* Set Class W by default - this will be managed by the Class | 2469 | /* Set Class W by default - this will be managed by the Class |
| 2471 | * G widget at runtime where bypass paths are available. | 2470 | * G widget at runtime where bypass paths are available. |
| 2472 | */ | 2471 | */ |
| 2473 | wm8904->reg_cache[WM8904_CLASS_W_0] |= WM8904_CP_DYN_PWR; | 2472 | reg_cache[WM8904_CLASS_W_0] |= WM8904_CP_DYN_PWR; |
| 2474 | 2473 | ||
| 2475 | /* Use normal bias source */ | 2474 | /* Use normal bias source */ |
| 2476 | wm8904->reg_cache[WM8904_BIAS_CONTROL_0] &= ~WM8904_POBCTRL; | 2475 | reg_cache[WM8904_BIAS_CONTROL_0] &= ~WM8904_POBCTRL; |
| 2477 | 2476 | ||
| 2478 | wm8904_set_bias_level(codec, SND_SOC_BIAS_STANDBY); | 2477 | wm8904_set_bias_level(codec, SND_SOC_BIAS_STANDBY); |
| 2479 | 2478 | ||
diff --git a/sound/soc/codecs/wm8940.c b/sound/soc/codecs/wm8940.c index 2cb16f895c46..23086e2c976a 100644 --- a/sound/soc/codecs/wm8940.c +++ b/sound/soc/codecs/wm8940.c | |||
| @@ -768,6 +768,7 @@ static __devinit int wm8940_i2c_probe(struct i2c_client *i2c, | |||
| 768 | 768 | ||
| 769 | i2c_set_clientdata(i2c, wm8940); | 769 | i2c_set_clientdata(i2c, wm8940); |
| 770 | wm8940->control_data = i2c; | 770 | wm8940->control_data = i2c; |
| 771 | wm8940->control_type = SND_SOC_I2C; | ||
| 771 | 772 | ||
| 772 | ret = snd_soc_register_codec(&i2c->dev, | 773 | ret = snd_soc_register_codec(&i2c->dev, |
| 773 | &soc_codec_dev_wm8940, &wm8940_dai, 1); | 774 | &soc_codec_dev_wm8940, &wm8940_dai, 1); |
diff --git a/sound/soc/codecs/wm8955.c b/sound/soc/codecs/wm8955.c index 9cbab8e1de01..2ac35b0be86a 100644 --- a/sound/soc/codecs/wm8955.c +++ b/sound/soc/codecs/wm8955.c | |||
| @@ -42,8 +42,6 @@ static const char *wm8955_supply_names[WM8955_NUM_SUPPLIES] = { | |||
| 42 | struct wm8955_priv { | 42 | struct wm8955_priv { |
| 43 | enum snd_soc_control_type control_type; | 43 | enum snd_soc_control_type control_type; |
| 44 | 44 | ||
| 45 | u16 reg_cache[WM8955_MAX_REGISTER + 1]; | ||
| 46 | |||
| 47 | unsigned int mclk_rate; | 45 | unsigned int mclk_rate; |
| 48 | 46 | ||
| 49 | int deemph; | 47 | int deemph; |
| @@ -768,6 +766,7 @@ static int wm8955_set_bias_level(struct snd_soc_codec *codec, | |||
| 768 | enum snd_soc_bias_level level) | 766 | enum snd_soc_bias_level level) |
| 769 | { | 767 | { |
| 770 | struct wm8955_priv *wm8955 = snd_soc_codec_get_drvdata(codec); | 768 | struct wm8955_priv *wm8955 = snd_soc_codec_get_drvdata(codec); |
| 769 | u16 *reg_cache = codec->reg_cache; | ||
| 771 | int ret, i; | 770 | int ret, i; |
| 772 | 771 | ||
| 773 | switch (level) { | 772 | switch (level) { |
| @@ -800,14 +799,14 @@ static int wm8955_set_bias_level(struct snd_soc_codec *codec, | |||
| 800 | /* Sync back cached values if they're | 799 | /* Sync back cached values if they're |
| 801 | * different from the hardware default. | 800 | * different from the hardware default. |
| 802 | */ | 801 | */ |
| 803 | for (i = 0; i < ARRAY_SIZE(wm8955->reg_cache); i++) { | 802 | for (i = 0; i < codec->driver->reg_cache_size; i++) { |
| 804 | if (i == WM8955_RESET) | 803 | if (i == WM8955_RESET) |
| 805 | continue; | 804 | continue; |
| 806 | 805 | ||
| 807 | if (wm8955->reg_cache[i] == wm8955_reg[i]) | 806 | if (reg_cache[i] == wm8955_reg[i]) |
| 808 | continue; | 807 | continue; |
| 809 | 808 | ||
| 810 | snd_soc_write(codec, i, wm8955->reg_cache[i]); | 809 | snd_soc_write(codec, i, reg_cache[i]); |
| 811 | } | 810 | } |
| 812 | 811 | ||
| 813 | /* Enable VREF and VMID */ | 812 | /* Enable VREF and VMID */ |
| @@ -902,6 +901,7 @@ static int wm8955_probe(struct snd_soc_codec *codec) | |||
| 902 | { | 901 | { |
| 903 | struct wm8955_priv *wm8955 = snd_soc_codec_get_drvdata(codec); | 902 | struct wm8955_priv *wm8955 = snd_soc_codec_get_drvdata(codec); |
| 904 | struct wm8955_pdata *pdata = dev_get_platdata(codec->dev); | 903 | struct wm8955_pdata *pdata = dev_get_platdata(codec->dev); |
| 904 | u16 *reg_cache = codec->reg_cache; | ||
| 905 | int ret, i; | 905 | int ret, i; |
| 906 | 906 | ||
| 907 | ret = snd_soc_codec_set_cache_io(codec, 7, 9, wm8955->control_type); | 907 | ret = snd_soc_codec_set_cache_io(codec, 7, 9, wm8955->control_type); |
| @@ -934,25 +934,25 @@ static int wm8955_probe(struct snd_soc_codec *codec) | |||
| 934 | } | 934 | } |
| 935 | 935 | ||
| 936 | /* Change some default settings - latch VU and enable ZC */ | 936 | /* Change some default settings - latch VU and enable ZC */ |
| 937 | wm8955->reg_cache[WM8955_LEFT_DAC_VOLUME] |= WM8955_LDVU; | 937 | reg_cache[WM8955_LEFT_DAC_VOLUME] |= WM8955_LDVU; |
| 938 | wm8955->reg_cache[WM8955_RIGHT_DAC_VOLUME] |= WM8955_RDVU; | 938 | reg_cache[WM8955_RIGHT_DAC_VOLUME] |= WM8955_RDVU; |
| 939 | wm8955->reg_cache[WM8955_LOUT1_VOLUME] |= WM8955_LO1VU | WM8955_LO1ZC; | 939 | reg_cache[WM8955_LOUT1_VOLUME] |= WM8955_LO1VU | WM8955_LO1ZC; |
| 940 | wm8955->reg_cache[WM8955_ROUT1_VOLUME] |= WM8955_RO1VU | WM8955_RO1ZC; | 940 | reg_cache[WM8955_ROUT1_VOLUME] |= WM8955_RO1VU | WM8955_RO1ZC; |
| 941 | wm8955->reg_cache[WM8955_LOUT2_VOLUME] |= WM8955_LO2VU | WM8955_LO2ZC; | 941 | reg_cache[WM8955_LOUT2_VOLUME] |= WM8955_LO2VU | WM8955_LO2ZC; |
| 942 | wm8955->reg_cache[WM8955_ROUT2_VOLUME] |= WM8955_RO2VU | WM8955_RO2ZC; | 942 | reg_cache[WM8955_ROUT2_VOLUME] |= WM8955_RO2VU | WM8955_RO2ZC; |
| 943 | wm8955->reg_cache[WM8955_MONOOUT_VOLUME] |= WM8955_MOZC; | 943 | reg_cache[WM8955_MONOOUT_VOLUME] |= WM8955_MOZC; |
| 944 | 944 | ||
| 945 | /* Also enable adaptive bass boost by default */ | 945 | /* Also enable adaptive bass boost by default */ |
| 946 | wm8955->reg_cache[WM8955_BASS_CONTROL] |= WM8955_BB; | 946 | reg_cache[WM8955_BASS_CONTROL] |= WM8955_BB; |
| 947 | 947 | ||
| 948 | /* Set platform data values */ | 948 | /* Set platform data values */ |
| 949 | if (pdata) { | 949 | if (pdata) { |
| 950 | if (pdata->out2_speaker) | 950 | if (pdata->out2_speaker) |
| 951 | wm8955->reg_cache[WM8955_ADDITIONAL_CONTROL_2] | 951 | reg_cache[WM8955_ADDITIONAL_CONTROL_2] |
| 952 | |= WM8955_ROUT2INV; | 952 | |= WM8955_ROUT2INV; |
| 953 | 953 | ||
| 954 | if (pdata->monoin_diff) | 954 | if (pdata->monoin_diff) |
| 955 | wm8955->reg_cache[WM8955_MONO_OUT_MIX_1] | 955 | reg_cache[WM8955_MONO_OUT_MIX_1] |
| 956 | |= WM8955_DMEN; | 956 | |= WM8955_DMEN; |
| 957 | } | 957 | } |
| 958 | 958 | ||
| @@ -1003,6 +1003,7 @@ static __devinit int wm8955_i2c_probe(struct i2c_client *i2c, | |||
| 1003 | return -ENOMEM; | 1003 | return -ENOMEM; |
| 1004 | 1004 | ||
| 1005 | i2c_set_clientdata(i2c, wm8955); | 1005 | i2c_set_clientdata(i2c, wm8955); |
| 1006 | wm8955->control_type = SND_SOC_I2C; | ||
| 1006 | 1007 | ||
| 1007 | ret = snd_soc_register_codec(&i2c->dev, | 1008 | ret = snd_soc_register_codec(&i2c->dev, |
| 1008 | &soc_codec_dev_wm8955, &wm8955_dai, 1); | 1009 | &soc_codec_dev_wm8955, &wm8955_dai, 1); |
diff --git a/sound/soc/codecs/wm8960.c b/sound/soc/codecs/wm8960.c index 21986c42272f..ff6ff2f529d2 100644 --- a/sound/soc/codecs/wm8960.c +++ b/sound/soc/codecs/wm8960.c | |||
| @@ -1013,6 +1013,7 @@ static __devinit int wm8960_i2c_probe(struct i2c_client *i2c, | |||
| 1013 | return -ENOMEM; | 1013 | return -ENOMEM; |
| 1014 | 1014 | ||
| 1015 | i2c_set_clientdata(i2c, wm8960); | 1015 | i2c_set_clientdata(i2c, wm8960); |
| 1016 | wm8960->control_type = SND_SOC_I2C; | ||
| 1016 | wm8960->control_data = i2c; | 1017 | wm8960->control_data = i2c; |
| 1017 | 1018 | ||
| 1018 | ret = snd_soc_register_codec(&i2c->dev, | 1019 | ret = snd_soc_register_codec(&i2c->dev, |
diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c index 1304ca91a11c..7c421cc837bd 100644 --- a/sound/soc/codecs/wm8962.c +++ b/sound/soc/codecs/wm8962.c | |||
| @@ -52,8 +52,6 @@ static const char *wm8962_supply_names[WM8962_NUM_SUPPLIES] = { | |||
| 52 | struct wm8962_priv { | 52 | struct wm8962_priv { |
| 53 | struct snd_soc_codec *codec; | 53 | struct snd_soc_codec *codec; |
| 54 | 54 | ||
| 55 | u16 reg_cache[WM8962_MAX_REGISTER + 1]; | ||
| 56 | |||
| 57 | int sysclk; | 55 | int sysclk; |
| 58 | int sysclk_rate; | 56 | int sysclk_rate; |
| 59 | 57 | ||
| @@ -1991,8 +1989,7 @@ static int wm8962_put_hp_sw(struct snd_kcontrol *kcontrol, | |||
| 1991 | struct snd_ctl_elem_value *ucontrol) | 1989 | struct snd_ctl_elem_value *ucontrol) |
| 1992 | { | 1990 | { |
| 1993 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); | 1991 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); |
| 1994 | struct wm8962_priv *wm8962 = snd_soc_codec_get_drvdata(codec); | 1992 | u16 *reg_cache = codec->reg_cache; |
| 1995 | u16 *reg_cache = wm8962->reg_cache; | ||
| 1996 | int ret; | 1993 | int ret; |
| 1997 | 1994 | ||
| 1998 | /* Apply the update (if any) */ | 1995 | /* Apply the update (if any) */ |
| @@ -2020,8 +2017,7 @@ static int wm8962_put_spk_sw(struct snd_kcontrol *kcontrol, | |||
| 2020 | struct snd_ctl_elem_value *ucontrol) | 2017 | struct snd_ctl_elem_value *ucontrol) |
| 2021 | { | 2018 | { |
| 2022 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); | 2019 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2023 | struct wm8962_priv *wm8962 = snd_soc_codec_get_drvdata(codec); | 2020 | u16 *reg_cache = codec->reg_cache; |
| 2024 | u16 *reg_cache = wm8962->reg_cache; | ||
| 2025 | int ret; | 2021 | int ret; |
| 2026 | 2022 | ||
| 2027 | /* Apply the update (if any) */ | 2023 | /* Apply the update (if any) */ |
| @@ -2329,8 +2325,7 @@ static int out_pga_event(struct snd_soc_dapm_widget *w, | |||
| 2329 | struct snd_kcontrol *kcontrol, int event) | 2325 | struct snd_kcontrol *kcontrol, int event) |
| 2330 | { | 2326 | { |
| 2331 | struct snd_soc_codec *codec = w->codec; | 2327 | struct snd_soc_codec *codec = w->codec; |
| 2332 | struct wm8962_priv *wm8962 = snd_soc_codec_get_drvdata(codec); | 2328 | u16 *reg_cache = codec->reg_cache; |
| 2333 | u16 *reg_cache = wm8962->reg_cache; | ||
| 2334 | int reg; | 2329 | int reg; |
| 2335 | 2330 | ||
| 2336 | switch (w->shift) { | 2331 | switch (w->shift) { |
| @@ -2719,7 +2714,7 @@ static int wm8962_add_widgets(struct snd_soc_codec *codec) | |||
| 2719 | 2714 | ||
| 2720 | static void wm8962_sync_cache(struct snd_soc_codec *codec) | 2715 | static void wm8962_sync_cache(struct snd_soc_codec *codec) |
| 2721 | { | 2716 | { |
| 2722 | struct wm8962_priv *wm8962 = snd_soc_codec_get_drvdata(codec); | 2717 | u16 *reg_cache = codec->reg_cache; |
| 2723 | int i; | 2718 | int i; |
| 2724 | 2719 | ||
| 2725 | if (!codec->cache_sync) | 2720 | if (!codec->cache_sync) |
| @@ -2732,13 +2727,13 @@ static void wm8962_sync_cache(struct snd_soc_codec *codec) | |||
| 2732 | /* Sync back cached values if they're different from the | 2727 | /* Sync back cached values if they're different from the |
| 2733 | * hardware default. | 2728 | * hardware default. |
| 2734 | */ | 2729 | */ |
| 2735 | for (i = 1; i < ARRAY_SIZE(wm8962->reg_cache); i++) { | 2730 | for (i = 1; i < codec->driver->reg_cache_size; i++) { |
| 2736 | if (i == WM8962_SOFTWARE_RESET) | 2731 | if (i == WM8962_SOFTWARE_RESET) |
| 2737 | continue; | 2732 | continue; |
| 2738 | if (wm8962->reg_cache[i] == wm8962_reg[i]) | 2733 | if (reg_cache[i] == wm8962_reg[i]) |
| 2739 | continue; | 2734 | continue; |
| 2740 | 2735 | ||
| 2741 | snd_soc_write(codec, i, wm8962->reg_cache[i]); | 2736 | snd_soc_write(codec, i, reg_cache[i]); |
| 2742 | } | 2737 | } |
| 2743 | 2738 | ||
| 2744 | codec->cache_sync = 0; | 2739 | codec->cache_sync = 0; |
| @@ -3406,12 +3401,11 @@ EXPORT_SYMBOL_GPL(wm8962_mic_detect); | |||
| 3406 | #ifdef CONFIG_PM | 3401 | #ifdef CONFIG_PM |
| 3407 | static int wm8962_resume(struct snd_soc_codec *codec) | 3402 | static int wm8962_resume(struct snd_soc_codec *codec) |
| 3408 | { | 3403 | { |
| 3409 | struct wm8962_priv *wm8962 = snd_soc_codec_get_drvdata(codec); | ||
| 3410 | u16 *reg_cache = codec->reg_cache; | 3404 | u16 *reg_cache = codec->reg_cache; |
| 3411 | int i; | 3405 | int i; |
| 3412 | 3406 | ||
| 3413 | /* Restore the registers */ | 3407 | /* Restore the registers */ |
| 3414 | for (i = 1; i < ARRAY_SIZE(wm8962->reg_cache); i++) { | 3408 | for (i = 1; i < codec->driver->reg_cache_size; i++) { |
| 3415 | switch (i) { | 3409 | switch (i) { |
| 3416 | case WM8962_SOFTWARE_RESET: | 3410 | case WM8962_SOFTWARE_RESET: |
| 3417 | continue; | 3411 | continue; |
| @@ -3705,6 +3699,7 @@ static int wm8962_probe(struct snd_soc_codec *codec) | |||
| 3705 | struct wm8962_pdata *pdata = dev_get_platdata(codec->dev); | 3699 | struct wm8962_pdata *pdata = dev_get_platdata(codec->dev); |
| 3706 | struct i2c_client *i2c = container_of(codec->dev, struct i2c_client, | 3700 | struct i2c_client *i2c = container_of(codec->dev, struct i2c_client, |
| 3707 | dev); | 3701 | dev); |
| 3702 | u16 *reg_cache = codec->reg_cache; | ||
| 3708 | int i, trigger, irq_pol; | 3703 | int i, trigger, irq_pol; |
| 3709 | 3704 | ||
| 3710 | wm8962->codec = codec; | 3705 | wm8962->codec = codec; |
| @@ -3804,7 +3799,7 @@ static int wm8962_probe(struct snd_soc_codec *codec) | |||
| 3804 | 3799 | ||
| 3805 | /* Put the speakers into mono mode? */ | 3800 | /* Put the speakers into mono mode? */ |
| 3806 | if (pdata->spk_mono) | 3801 | if (pdata->spk_mono) |
| 3807 | wm8962->reg_cache[WM8962_CLASS_D_CONTROL_2] | 3802 | reg_cache[WM8962_CLASS_D_CONTROL_2] |
| 3808 | |= WM8962_SPK_MONO; | 3803 | |= WM8962_SPK_MONO; |
| 3809 | 3804 | ||
| 3810 | /* Micbias setup, detection enable and detection | 3805 | /* Micbias setup, detection enable and detection |
| @@ -3819,16 +3814,16 @@ static int wm8962_probe(struct snd_soc_codec *codec) | |||
| 3819 | } | 3814 | } |
| 3820 | 3815 | ||
| 3821 | /* Latch volume update bits */ | 3816 | /* Latch volume update bits */ |
| 3822 | wm8962->reg_cache[WM8962_LEFT_INPUT_VOLUME] |= WM8962_IN_VU; | 3817 | reg_cache[WM8962_LEFT_INPUT_VOLUME] |= WM8962_IN_VU; |
| 3823 | wm8962->reg_cache[WM8962_RIGHT_INPUT_VOLUME] |= WM8962_IN_VU; | 3818 | reg_cache[WM8962_RIGHT_INPUT_VOLUME] |= WM8962_IN_VU; |
| 3824 | wm8962->reg_cache[WM8962_LEFT_ADC_VOLUME] |= WM8962_ADC_VU; | 3819 | reg_cache[WM8962_LEFT_ADC_VOLUME] |= WM8962_ADC_VU; |
| 3825 | wm8962->reg_cache[WM8962_RIGHT_ADC_VOLUME] |= WM8962_ADC_VU; | 3820 | reg_cache[WM8962_RIGHT_ADC_VOLUME] |= WM8962_ADC_VU; |
| 3826 | wm8962->reg_cache[WM8962_LEFT_DAC_VOLUME] |= WM8962_DAC_VU; | 3821 | reg_cache[WM8962_LEFT_DAC_VOLUME] |= WM8962_DAC_VU; |
| 3827 | wm8962->reg_cache[WM8962_RIGHT_DAC_VOLUME] |= WM8962_DAC_VU; | 3822 | reg_cache[WM8962_RIGHT_DAC_VOLUME] |= WM8962_DAC_VU; |
| 3828 | wm8962->reg_cache[WM8962_SPKOUTL_VOLUME] |= WM8962_SPKOUT_VU; | 3823 | reg_cache[WM8962_SPKOUTL_VOLUME] |= WM8962_SPKOUT_VU; |
| 3829 | wm8962->reg_cache[WM8962_SPKOUTR_VOLUME] |= WM8962_SPKOUT_VU; | 3824 | reg_cache[WM8962_SPKOUTR_VOLUME] |= WM8962_SPKOUT_VU; |
| 3830 | wm8962->reg_cache[WM8962_HPOUTL_VOLUME] |= WM8962_HPOUT_VU; | 3825 | reg_cache[WM8962_HPOUTL_VOLUME] |= WM8962_HPOUT_VU; |
| 3831 | wm8962->reg_cache[WM8962_HPOUTR_VOLUME] |= WM8962_HPOUT_VU; | 3826 | reg_cache[WM8962_HPOUTR_VOLUME] |= WM8962_HPOUT_VU; |
| 3832 | 3827 | ||
| 3833 | wm8962_add_widgets(codec); | 3828 | wm8962_add_widgets(codec); |
| 3834 | 3829 | ||
diff --git a/sound/soc/codecs/wm8971.c b/sound/soc/codecs/wm8971.c index 63f6dbf5d070..9f18db6e167c 100644 --- a/sound/soc/codecs/wm8971.c +++ b/sound/soc/codecs/wm8971.c | |||
| @@ -718,6 +718,7 @@ static __devinit int wm8971_i2c_probe(struct i2c_client *i2c, | |||
| 718 | if (wm8971 == NULL) | 718 | if (wm8971 == NULL) |
| 719 | return -ENOMEM; | 719 | return -ENOMEM; |
| 720 | 720 | ||
| 721 | wm8971->control_type = SND_SOC_I2C; | ||
| 721 | i2c_set_clientdata(i2c, wm8971); | 722 | i2c_set_clientdata(i2c, wm8971); |
| 722 | 723 | ||
| 723 | ret = snd_soc_register_codec(&i2c->dev, | 724 | ret = snd_soc_register_codec(&i2c->dev, |
diff --git a/sound/soc/codecs/wm9081.c b/sound/soc/codecs/wm9081.c index ecc7c37180c7..a486670966bd 100644 --- a/sound/soc/codecs/wm9081.c +++ b/sound/soc/codecs/wm9081.c | |||
| @@ -1335,6 +1335,7 @@ static __devinit int wm9081_i2c_probe(struct i2c_client *i2c, | |||
| 1335 | return -ENOMEM; | 1335 | return -ENOMEM; |
| 1336 | 1336 | ||
| 1337 | i2c_set_clientdata(i2c, wm9081); | 1337 | i2c_set_clientdata(i2c, wm9081); |
| 1338 | wm9081->control_type = SND_SOC_I2C; | ||
| 1338 | wm9081->control_data = i2c; | 1339 | wm9081->control_data = i2c; |
| 1339 | 1340 | ||
| 1340 | ret = snd_soc_register_codec(&i2c->dev, | 1341 | ret = snd_soc_register_codec(&i2c->dev, |
diff --git a/sound/soc/codecs/wm9090.c b/sound/soc/codecs/wm9090.c index 99c046ba46bb..6e5f64f627cb 100644 --- a/sound/soc/codecs/wm9090.c +++ b/sound/soc/codecs/wm9090.c | |||
| @@ -141,7 +141,6 @@ static const u16 wm9090_reg_defaults[] = { | |||
| 141 | /* This struct is used to save the context */ | 141 | /* This struct is used to save the context */ |
| 142 | struct wm9090_priv { | 142 | struct wm9090_priv { |
| 143 | struct mutex mutex; | 143 | struct mutex mutex; |
| 144 | u16 reg_cache[WM9090_MAX_REGISTER + 1]; | ||
| 145 | struct wm9090_platform_data pdata; | 144 | struct wm9090_platform_data pdata; |
| 146 | void *control_data; | 145 | void *control_data; |
| 147 | }; | 146 | }; |
| @@ -552,6 +551,7 @@ static int wm9090_set_bias_level(struct snd_soc_codec *codec, | |||
| 552 | static int wm9090_probe(struct snd_soc_codec *codec) | 551 | static int wm9090_probe(struct snd_soc_codec *codec) |
| 553 | { | 552 | { |
| 554 | struct wm9090_priv *wm9090 = snd_soc_codec_get_drvdata(codec); | 553 | struct wm9090_priv *wm9090 = snd_soc_codec_get_drvdata(codec); |
| 554 | u16 *reg_cache = codec->reg_cache; | ||
| 555 | int ret; | 555 | int ret; |
| 556 | 556 | ||
| 557 | codec->control_data = wm9090->control_data; | 557 | codec->control_data = wm9090->control_data; |
| @@ -576,22 +576,22 @@ static int wm9090_probe(struct snd_soc_codec *codec) | |||
| 576 | /* Configure some defaults; they will be written out when we | 576 | /* Configure some defaults; they will be written out when we |
| 577 | * bring the bias up. | 577 | * bring the bias up. |
| 578 | */ | 578 | */ |
| 579 | wm9090->reg_cache[WM9090_IN1_LINE_INPUT_A_VOLUME] |= WM9090_IN1_VU | 579 | reg_cache[WM9090_IN1_LINE_INPUT_A_VOLUME] |= WM9090_IN1_VU |
| 580 | | WM9090_IN1A_ZC; | 580 | | WM9090_IN1A_ZC; |
| 581 | wm9090->reg_cache[WM9090_IN1_LINE_INPUT_B_VOLUME] |= WM9090_IN1_VU | 581 | reg_cache[WM9090_IN1_LINE_INPUT_B_VOLUME] |= WM9090_IN1_VU |
| 582 | | WM9090_IN1B_ZC; | 582 | | WM9090_IN1B_ZC; |
| 583 | wm9090->reg_cache[WM9090_IN2_LINE_INPUT_A_VOLUME] |= WM9090_IN2_VU | 583 | reg_cache[WM9090_IN2_LINE_INPUT_A_VOLUME] |= WM9090_IN2_VU |
| 584 | | WM9090_IN2A_ZC; | 584 | | WM9090_IN2A_ZC; |
| 585 | wm9090->reg_cache[WM9090_IN2_LINE_INPUT_B_VOLUME] |= WM9090_IN2_VU | 585 | reg_cache[WM9090_IN2_LINE_INPUT_B_VOLUME] |= WM9090_IN2_VU |
| 586 | | WM9090_IN2B_ZC; | 586 | | WM9090_IN2B_ZC; |
| 587 | wm9090->reg_cache[WM9090_SPEAKER_VOLUME_LEFT] |= | 587 | reg_cache[WM9090_SPEAKER_VOLUME_LEFT] |= |
| 588 | WM9090_SPKOUT_VU | WM9090_SPKOUTL_ZC; | 588 | WM9090_SPKOUT_VU | WM9090_SPKOUTL_ZC; |
| 589 | wm9090->reg_cache[WM9090_LEFT_OUTPUT_VOLUME] |= | 589 | reg_cache[WM9090_LEFT_OUTPUT_VOLUME] |= |
| 590 | WM9090_HPOUT1_VU | WM9090_HPOUT1L_ZC; | 590 | WM9090_HPOUT1_VU | WM9090_HPOUT1L_ZC; |
| 591 | wm9090->reg_cache[WM9090_RIGHT_OUTPUT_VOLUME] |= | 591 | reg_cache[WM9090_RIGHT_OUTPUT_VOLUME] |= |
| 592 | WM9090_HPOUT1_VU | WM9090_HPOUT1R_ZC; | 592 | WM9090_HPOUT1_VU | WM9090_HPOUT1R_ZC; |
| 593 | 593 | ||
| 594 | wm9090->reg_cache[WM9090_CLOCKING_1] |= WM9090_TOCLK_ENA; | 594 | reg_cache[WM9090_CLOCKING_1] |= WM9090_TOCLK_ENA; |
| 595 | 595 | ||
| 596 | wm9090_set_bias_level(codec, SND_SOC_BIAS_STANDBY); | 596 | wm9090_set_bias_level(codec, SND_SOC_BIAS_STANDBY); |
| 597 | 597 | ||
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c index 2022e8740994..76bcc35cf9b1 100644 --- a/tools/perf/util/hist.c +++ b/tools/perf/util/hist.c | |||
| @@ -356,7 +356,7 @@ static size_t ipchain__fprintf_graph_line(FILE *fp, int depth, int depth_mask, | |||
| 356 | 356 | ||
| 357 | static size_t ipchain__fprintf_graph(FILE *fp, struct callchain_list *chain, | 357 | static size_t ipchain__fprintf_graph(FILE *fp, struct callchain_list *chain, |
| 358 | int depth, int depth_mask, int period, | 358 | int depth, int depth_mask, int period, |
| 359 | u64 total_samples, int hits, | 359 | u64 total_samples, u64 hits, |
| 360 | int left_margin) | 360 | int left_margin) |
| 361 | { | 361 | { |
| 362 | int i; | 362 | int i; |
