aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorStephen Warren <swarren@nvidia.com>2011-04-01 16:50:44 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2011-04-03 09:11:26 -0400
commit00b317a41c5428b13eb7e5b4bbc691b1aa7afa80 (patch)
tree59e8f673eb8d23cd67117c1c1c50fcddfa6af6bd /sound
parent1b4610ebf37a05a65e9f29cdf4d87c207573104d (diff)
ASoC: format_register_str: Don't clip register values
wordsize is used as the textual width of a register address. regsize is used as the textual width of a register value. The assignments to these values were swapped. In the case of WM8903, which has 8-bit register addresses and 16-bit register values, this caused the register values to be clipped to 2 digits instead of the full 4. Signed-off-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/soc-core.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 4dda58926bc5..b76b74db0968 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -92,8 +92,8 @@ static int min_bytes_needed(unsigned long val)
92static int format_register_str(struct snd_soc_codec *codec, 92static int format_register_str(struct snd_soc_codec *codec,
93 unsigned int reg, char *buf, size_t len) 93 unsigned int reg, char *buf, size_t len)
94{ 94{
95 int wordsize = codec->driver->reg_word_size * 2; 95 int wordsize = min_bytes_needed(codec->driver->reg_cache_size) * 2;
96 int regsize = min_bytes_needed(codec->driver->reg_cache_size) * 2; 96 int regsize = codec->driver->reg_word_size * 2;
97 int ret; 97 int ret;
98 char tmpbuf[len + 1]; 98 char tmpbuf[len + 1];
99 char regbuf[regsize + 1]; 99 char regbuf[regsize + 1];
@@ -132,8 +132,8 @@ static ssize_t soc_codec_reg_show(struct snd_soc_codec *codec, char *buf,
132 size_t total = 0; 132 size_t total = 0;
133 loff_t p = 0; 133 loff_t p = 0;
134 134
135 wordsize = codec->driver->reg_word_size * 2; 135 wordsize = min_bytes_needed(codec->driver->reg_cache_size) * 2;
136 regsize = min_bytes_needed(codec->driver->reg_cache_size) * 2; 136 regsize = codec->driver->reg_word_size * 2;
137 137
138 len = wordsize + regsize + 2 + 1; 138 len = wordsize + regsize + 2 + 1;
139 139