aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2010-12-02 11:15:29 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2010-12-03 07:18:17 -0500
commitc3acec2671cc448bc549b06b561ae2454238e9a0 (patch)
tree82365178227d23ed6da7d27138ffba4be58f653b
parent1ee46ebd0435d547c078859c719d7c892ff7ab2d (diff)
ASoC: Move active copy of CODEC read and write into runtime structure
We shouldn't be assigning to the driver structure (which really ought to be const, further patch to follow) though there's unlikely to be any actual problem except in the unlikely case that two devices with the same driver but different bus types appear in the same system. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
-rw-r--r--include/sound/soc.h2
-rw-r--r--sound/soc/soc-cache.c4
-rw-r--r--sound/soc/soc-core.c6
3 files changed, 8 insertions, 4 deletions
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 4a9195c5ef2d..714a70441bf2 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -476,6 +476,8 @@ struct snd_soc_codec {
476 void *control_data; /* codec control (i2c/3wire) data */ 476 void *control_data; /* codec control (i2c/3wire) data */
477 hw_write_t hw_write; 477 hw_write_t hw_write;
478 unsigned int (*hw_read)(struct snd_soc_codec *, unsigned int); 478 unsigned int (*hw_read)(struct snd_soc_codec *, unsigned int);
479 unsigned int (*read)(struct snd_soc_codec *, unsigned int);
480 int (*write)(struct snd_soc_codec *, unsigned int, unsigned int);
479 void *reg_cache; 481 void *reg_cache;
480 const struct snd_soc_cache_ops *cache_ops; 482 const struct snd_soc_cache_ops *cache_ops;
481 struct mutex cache_rw_mutex; 483 struct mutex cache_rw_mutex;
diff --git a/sound/soc/soc-cache.c b/sound/soc/soc-cache.c
index 514398463f7d..78b25e8c03f6 100644
--- a/sound/soc/soc-cache.c
+++ b/sound/soc/soc-cache.c
@@ -728,8 +728,8 @@ int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec,
728 return -EINVAL; 728 return -EINVAL;
729 } 729 }
730 730
731 codec->driver->write = io_types[i].write; 731 codec->write = io_types[i].write;
732 codec->driver->read = io_types[i].read; 732 codec->read = io_types[i].read;
733 733
734 switch (control) { 734 switch (control) {
735 case SND_SOC_CUSTOM: 735 case SND_SOC_CUSTOM:
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 20dcc978588f..5720dbcefbc4 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -2077,7 +2077,7 @@ unsigned int snd_soc_read(struct snd_soc_codec *codec, unsigned int reg)
2077{ 2077{
2078 unsigned int ret; 2078 unsigned int ret;
2079 2079
2080 ret = codec->driver->read(codec, reg); 2080 ret = codec->read(codec, reg);
2081 dev_dbg(codec->dev, "read %x => %x\n", reg, ret); 2081 dev_dbg(codec->dev, "read %x => %x\n", reg, ret);
2082 trace_snd_soc_reg_read(codec, reg, ret); 2082 trace_snd_soc_reg_read(codec, reg, ret);
2083 2083
@@ -2090,7 +2090,7 @@ unsigned int snd_soc_write(struct snd_soc_codec *codec,
2090{ 2090{
2091 dev_dbg(codec->dev, "write %x = %x\n", reg, val); 2091 dev_dbg(codec->dev, "write %x = %x\n", reg, val);
2092 trace_snd_soc_reg_write(codec, reg, val); 2092 trace_snd_soc_reg_write(codec, reg, val);
2093 return codec->driver->write(codec, reg, val); 2093 return codec->write(codec, reg, val);
2094} 2094}
2095EXPORT_SYMBOL_GPL(snd_soc_write); 2095EXPORT_SYMBOL_GPL(snd_soc_write);
2096 2096
@@ -3448,6 +3448,8 @@ int snd_soc_register_codec(struct device *dev,
3448 3448
3449 INIT_LIST_HEAD(&codec->dapm.widgets); 3449 INIT_LIST_HEAD(&codec->dapm.widgets);
3450 INIT_LIST_HEAD(&codec->dapm.paths); 3450 INIT_LIST_HEAD(&codec->dapm.paths);
3451 codec->write = codec_drv->write;
3452 codec->read = codec_drv->read;
3451 codec->dapm.bias_level = SND_SOC_BIAS_OFF; 3453 codec->dapm.bias_level = SND_SOC_BIAS_OFF;
3452 codec->dapm.dev = dev; 3454 codec->dapm.dev = dev;
3453 codec->dapm.codec = codec; 3455 codec->dapm.codec = codec;