diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2010-08-12 05:59:15 -0400 |
---|---|---|
committer | Liam Girdwood <lrg@slimlogic.co.uk> | 2010-08-12 09:02:06 -0400 |
commit | a6d14342dc46f0ef94cccf323fd9481de84b458f (patch) | |
tree | 7556a696372d7e023e482406628c08d4924418ea /sound/soc/soc-cache.c | |
parent | 960d0697919aef453273e3a0ccc87daf52d808ac (diff) |
ASoC: Automatically determine control_data for soc-cache users
Since the provision of a struct device for the CODEC is now mandatory
we can use container_of() to locate the struct i2c_client and struct
spi_device for relevant devices, removing the need to manually set it
in each driver.
A further patch will automate selection of the control type based on
the bus_type of the struct device, further reducing the amount of
driver code required.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
Diffstat (limited to 'sound/soc/soc-cache.c')
-rw-r--r-- | sound/soc/soc-cache.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/sound/soc/soc-cache.c b/sound/soc/soc-cache.c index 83cd8ed944bf..b856177ea281 100644 --- a/sound/soc/soc-cache.c +++ b/sound/soc/soc-cache.c | |||
@@ -584,11 +584,19 @@ int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec, | |||
584 | #endif | 584 | #endif |
585 | if (io_types[i].i2c_read) | 585 | if (io_types[i].i2c_read) |
586 | codec->hw_read = io_types[i].i2c_read; | 586 | codec->hw_read = io_types[i].i2c_read; |
587 | |||
588 | codec->control_data = container_of(codec->dev, | ||
589 | struct i2c_client, | ||
590 | dev); | ||
587 | break; | 591 | break; |
588 | 592 | ||
589 | case SND_SOC_SPI: | 593 | case SND_SOC_SPI: |
590 | if (io_types[i].spi_write) | 594 | if (io_types[i].spi_write) |
591 | codec->hw_write = io_types[i].spi_write; | 595 | codec->hw_write = io_types[i].spi_write; |
596 | |||
597 | codec->control_data = container_of(codec->dev, | ||
598 | struct spi_device, | ||
599 | dev); | ||
592 | break; | 600 | break; |
593 | } | 601 | } |
594 | 602 | ||