Skip to content

Commit

Permalink
mfd: Don't store volatile bits in WM8350 register cache
Browse files Browse the repository at this point in the history
This makes the contents of the cache clearer and fixes incorrect
initialisation of the cache for partially volatile registers.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Samuel Ortiz <sameo@openedhand.com>
  • Loading branch information
Mark Brown authored and Samuel Ortiz committed Oct 21, 2008
1 parent 799f9e3 commit e76f755
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/mfd/wm8350-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,9 @@ static int wm8350_write(struct wm8350 *wm8350, u8 reg, int num_regs, u16 *src)
(wm8350->reg_cache[i] & ~wm8350_reg_io_map[i].writable)
| src[i - reg];

/* Don't store volatile bits */
wm8350->reg_cache[i] &= ~wm8350_reg_io_map[i].vol;

src[i - reg] = cpu_to_be16(src[i - reg]);
}

Expand Down Expand Up @@ -1120,6 +1123,7 @@ static int wm8350_create_cache(struct wm8350 *wm8350, int mode)
}
value = be16_to_cpu(value);
value &= wm8350_reg_io_map[i].readable;
value &= ~wm8350_reg_io_map[i].vol;
wm8350->reg_cache[i] = value;
} else
wm8350->reg_cache[i] = reg_map[i];
Expand Down

0 comments on commit e76f755

Please sign in to comment.