Skip to contentSkip to conversation

ASoC: io: Retrieve val_bytes from the regmap API

PATCH In review Mark Brown 2 participants 2 messages Feb 17, 2012 – Feb 20, 2012

Subsystems (2)
lore
Share & tools
lore

Mark Brown

author
#0 lore raw

PATCH 1/1 ASoC: io: Retrieve val_bytes from the regmap API

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.

---
 sound/soc/soc-io.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
sound/soc/soc-io.c +6 -0
index 39ba507..4d8dc6a 100644
@@ -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:
Signature · 1 line
1.7.9