Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 110841
b: refs/heads/master
c: 58cd33c
h: refs/heads/master
i:
  110839: 3bd6826
v: v3
  • Loading branch information
Mark Brown authored and Jaroslav Kysela committed Jul 29, 2008
1 parent 4a23721 commit 1a8d667
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8a33de9e51673dbdadb552d888a4544aefe0c31d
refs/heads/master: 58cd33c0f375578cfda25a52ed280caa888b6254
2 changes: 2 additions & 0 deletions trunk/include/sound/soc.h
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,8 @@ struct snd_soc_codec {
void *control_data; /* codec control (i2c/3wire) data */
unsigned int (*read)(struct snd_soc_codec *, unsigned int);
int (*write)(struct snd_soc_codec *, unsigned int, unsigned int);
int (*display_register)(struct snd_soc_codec *, char *,
size_t, unsigned int);
hw_write_t hw_write;
hw_read_t hw_read;
void *reg_cache;
Expand Down
26 changes: 23 additions & 3 deletions trunk/sound/soc/soc-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -970,9 +970,29 @@ static ssize_t codec_reg_show(struct device *dev,
step = codec->reg_cache_step;

count += sprintf(buf, "%s registers\n", codec->name);
for (i = 0; i < codec->reg_cache_size; i += step)
count += sprintf(buf + count, "%2x: %4x\n", i,
codec->read(codec, i));
for (i = 0; i < codec->reg_cache_size; i += step) {
count += sprintf(buf + count, "%2x: ", i);
if (count >= PAGE_SIZE - 1)
break;

if (codec->display_register)
count += codec->display_register(codec, buf + count,
PAGE_SIZE - count, i);
else
count += snprintf(buf + count, PAGE_SIZE - count,
"%4x", codec->read(codec, i));

if (count >= PAGE_SIZE - 1)
break;

count += snprintf(buf + count, PAGE_SIZE - count, "\n");
if (count >= PAGE_SIZE - 1)
break;
}

/* Truncate count; min() would cause a warning */
if (count >= PAGE_SIZE)
count = PAGE_SIZE - 1;

return count;
}
Expand Down

0 comments on commit 1a8d667

Please sign in to comment.