]> git.karo-electronics.de Git - linux-beck.git/commitdiff
ASoC: Allow CODECs to flag invalid registers
authorMark Brown <broonie@opensource.wolfsonmicro.com>
Fri, 31 Jul 2009 17:26:51 +0000 (18:26 +0100)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Fri, 31 Jul 2009 17:54:48 +0000 (18:54 +0100)
This helps CODECs with sparse register maps work better with the
register cache display interface.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
include/sound/soc.h
sound/soc/soc-core.c

index 756fb59772d10309ce36906b081047da7169005a..55b330937260e95b5339760053828b0099f612c8 100644 (file)
@@ -385,6 +385,7 @@ struct snd_soc_codec {
        int (*display_register)(struct snd_soc_codec *, char *,
                                size_t, unsigned int);
        int (*volatile_register)(unsigned int);
+       int (*readable_register)(unsigned int);
        hw_write_t hw_write;
        hw_read_t hw_read;
        void *reg_cache;
index 5eabb711760870cb1399b26edee0a091d4f59309..fb8d7a766155c44f1c3664c74659207b24d38e6b 100644 (file)
@@ -1156,6 +1156,9 @@ static ssize_t soc_codec_reg_show(struct snd_soc_codec *codec, char *buf)
 
        count += sprintf(buf, "%s registers\n", codec->name);
        for (i = 0; i < codec->reg_cache_size; i += step) {
+               if (codec->readable_register && !codec->readable_register(i))
+                       continue;
+
                count += sprintf(buf + count, "%2x: ", i);
                if (count >= PAGE_SIZE - 1)
                        break;