aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/sta32x.c
diff options
context:
space:
mode:
authorJohannes Stezenbach <js@sig21.net>2011-11-14 11:23:17 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2011-11-14 16:34:14 -0500
commite012ba249171a205c5735a76b947bdae9cf34c6e (patch)
treebca3a151f4aa57d15acb060ab141b09769e2fd1b /sound/soc/codecs/sta32x.c
parent8f9aa2526b4e799ee8242762e35cd8e2ca0788b2 (diff)
ASoC: sta32x: add platform data definition
Add a structure for platform specific configuration and use it, thereby removing a few FIXMEs which marked hard-coded values. Signed-off-by: Johannes Stezenbach <js@sig21.net> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/codecs/sta32x.c')
-rw-r--r--sound/soc/codecs/sta32x.c30
1 files changed, 21 insertions, 9 deletions
diff --git a/sound/soc/codecs/sta32x.c b/sound/soc/codecs/sta32x.c
index d2f37152f940..97091e3b9a0b 100644
--- a/sound/soc/codecs/sta32x.c
+++ b/sound/soc/codecs/sta32x.c
@@ -35,6 +35,7 @@
35#include <sound/initval.h> 35#include <sound/initval.h>
36#include <sound/tlv.h> 36#include <sound/tlv.h>
37 37
38#include <sound/sta32x.h>
38#include "sta32x.h" 39#include "sta32x.h"
39 40
40#define STA32X_RATES (SNDRV_PCM_RATE_32000 | \ 41#define STA32X_RATES (SNDRV_PCM_RATE_32000 | \
@@ -73,6 +74,7 @@ static const char *sta32x_supply_names[] = {
73struct sta32x_priv { 74struct sta32x_priv {
74 struct regulator_bulk_data supplies[ARRAY_SIZE(sta32x_supply_names)]; 75 struct regulator_bulk_data supplies[ARRAY_SIZE(sta32x_supply_names)];
75 struct snd_soc_codec *codec; 76 struct snd_soc_codec *codec;
77 struct sta32x_platform_data *pdata;
76 78
77 unsigned int mclk; 79 unsigned int mclk;
78 unsigned int format; 80 unsigned int format;
@@ -775,9 +777,10 @@ static int sta32x_resume(struct snd_soc_codec *codec)
775static int sta32x_probe(struct snd_soc_codec *codec) 777static int sta32x_probe(struct snd_soc_codec *codec)
776{ 778{
777 struct sta32x_priv *sta32x = snd_soc_codec_get_drvdata(codec); 779 struct sta32x_priv *sta32x = snd_soc_codec_get_drvdata(codec);
778 int i, ret = 0; 780 int i, ret = 0, thermal = 0;
779 781
780 sta32x->codec = codec; 782 sta32x->codec = codec;
783 sta32x->pdata = dev_get_platdata(codec->dev);
781 784
782 /* regulators */ 785 /* regulators */
783 for (i = 0; i < ARRAY_SIZE(sta32x->supplies); i++) 786 for (i = 0; i < ARRAY_SIZE(sta32x->supplies); i++)
@@ -820,25 +823,34 @@ static int sta32x_probe(struct snd_soc_codec *codec)
820 snd_soc_cache_write(codec, STA32X_AUTO3, 0x00); 823 snd_soc_cache_write(codec, STA32X_AUTO3, 0x00);
821 snd_soc_cache_write(codec, STA32X_C3CFG, 0x40); 824 snd_soc_cache_write(codec, STA32X_C3CFG, 0x40);
822 825
823 /* FIXME enable thermal warning adjustment and recovery */ 826 /* set thermal warning adjustment and recovery */
827 if (!(sta32x->pdata->thermal_conf & STA32X_THERMAL_ADJUSTMENT_ENABLE))
828 thermal |= STA32X_CONFA_TWAB;
829 if (!(sta32x->pdata->thermal_conf & STA32X_THERMAL_RECOVERY_ENABLE))
830 thermal |= STA32X_CONFA_TWRB;
824 snd_soc_update_bits(codec, STA32X_CONFA, 831 snd_soc_update_bits(codec, STA32X_CONFA,
825 STA32X_CONFA_TWAB | STA32X_CONFA_TWRB, 0); 832 STA32X_CONFA_TWAB | STA32X_CONFA_TWRB,
833 thermal);
826 834
827 /* FIXME select 2.1 mode */ 835 /* select output configuration */
828 snd_soc_update_bits(codec, STA32X_CONFF, 836 snd_soc_update_bits(codec, STA32X_CONFF,
829 STA32X_CONFF_OCFG_MASK, 837 STA32X_CONFF_OCFG_MASK,
830 1 << STA32X_CONFF_OCFG_SHIFT); 838 sta32x->pdata->output_conf
839 << STA32X_CONFF_OCFG_SHIFT);
831 840
832 /* FIXME channel to output mapping */ 841 /* channel to output mapping */
833 snd_soc_update_bits(codec, STA32X_C1CFG, 842 snd_soc_update_bits(codec, STA32X_C1CFG,
834 STA32X_CxCFG_OM_MASK, 843 STA32X_CxCFG_OM_MASK,
835 0 << STA32X_CxCFG_OM_SHIFT); 844 sta32x->pdata->ch1_output_mapping
845 << STA32X_CxCFG_OM_SHIFT);
836 snd_soc_update_bits(codec, STA32X_C2CFG, 846 snd_soc_update_bits(codec, STA32X_C2CFG,
837 STA32X_CxCFG_OM_MASK, 847 STA32X_CxCFG_OM_MASK,
838 1 << STA32X_CxCFG_OM_SHIFT); 848 sta32x->pdata->ch2_output_mapping
849 << STA32X_CxCFG_OM_SHIFT);
839 snd_soc_update_bits(codec, STA32X_C3CFG, 850 snd_soc_update_bits(codec, STA32X_C3CFG,
840 STA32X_CxCFG_OM_MASK, 851 STA32X_CxCFG_OM_MASK,
841 2 << STA32X_CxCFG_OM_SHIFT); 852 sta32x->pdata->ch3_output_mapping
853 << STA32X_CxCFG_OM_SHIFT);
842 854
843 /* initialize coefficient shadow RAM with reset values */ 855 /* initialize coefficient shadow RAM with reset values */
844 for (i = 4; i <= 49; i += 5) 856 for (i = 4; i <= 49; i += 5)