]> git.karo-electronics.de Git - linux-beck.git/commitdiff
ASoC: io: Retrieve val_bytes from the regmap API
authorMark Brown <broonie@opensource.wolfsonmicro.com>
Fri, 17 Feb 2012 22:33:29 +0000 (14:33 -0800)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Tue, 21 Feb 2012 19:34:47 +0000 (19:34 +0000)
Allow us to build infrastructure which needs to know the size of a value
without requiring regmap based drivers to supply this information to both
ASoC and regmap by asking regmap for the value.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
sound/soc/soc-io.c

index 39ba5070ff92609d45f2e5223221d2b040ecc027..4d8dc6a27d4d170f1586999a88a531fa30ea6807 100644 (file)
@@ -114,6 +114,7 @@ int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec,
                               enum snd_soc_control_type control)
 {
        struct regmap_config config;
+       int ret;
 
        memset(&config, 0, sizeof(config));
        codec->write = hw_write;
@@ -141,6 +142,11 @@ int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec,
        case SND_SOC_REGMAP:
                /* Device has made its own regmap arrangements */
                codec->using_regmap = true;
+
+               ret = regmap_get_val_bytes(codec->control_data);
+               /* Errors are legitimate for non-integer byte multiples */
+               if (ret > 0)
+                       codec->val_bytes = ret;
                break;
 
        default: