diff options
Diffstat (limited to 'sound/soc/codecs/cq93vc.c')
-rw-r--r-- | sound/soc/codecs/cq93vc.c | 46 |
1 files changed, 14 insertions, 32 deletions
diff --git a/sound/soc/codecs/cq93vc.c b/sound/soc/codecs/cq93vc.c index 23316c887b19..43737a27d79c 100644 --- a/sound/soc/codecs/cq93vc.c +++ b/sound/soc/codecs/cq93vc.c | |||
@@ -38,24 +38,6 @@ | |||
38 | #include <sound/soc.h> | 38 | #include <sound/soc.h> |
39 | #include <sound/initval.h> | 39 | #include <sound/initval.h> |
40 | 40 | ||
41 | static inline unsigned int cq93vc_read(struct snd_soc_codec *codec, | ||
42 | unsigned int reg) | ||
43 | { | ||
44 | struct davinci_vc *davinci_vc = codec->control_data; | ||
45 | |||
46 | return readl(davinci_vc->base + reg); | ||
47 | } | ||
48 | |||
49 | static inline int cq93vc_write(struct snd_soc_codec *codec, unsigned int reg, | ||
50 | unsigned int value) | ||
51 | { | ||
52 | struct davinci_vc *davinci_vc = codec->control_data; | ||
53 | |||
54 | writel(value, davinci_vc->base + reg); | ||
55 | |||
56 | return 0; | ||
57 | } | ||
58 | |||
59 | static const struct snd_kcontrol_new cq93vc_snd_controls[] = { | 41 | static const struct snd_kcontrol_new cq93vc_snd_controls[] = { |
60 | SOC_SINGLE("PGA Capture Volume", DAVINCI_VC_REG05, 0, 0x03, 0), | 42 | SOC_SINGLE("PGA Capture Volume", DAVINCI_VC_REG05, 0, 0x03, 0), |
61 | SOC_SINGLE("Mono DAC Playback Volume", DAVINCI_VC_REG09, 0, 0x3f, 0), | 43 | SOC_SINGLE("Mono DAC Playback Volume", DAVINCI_VC_REG09, 0, 0x3f, 0), |
@@ -64,13 +46,15 @@ static const struct snd_kcontrol_new cq93vc_snd_controls[] = { | |||
64 | static int cq93vc_mute(struct snd_soc_dai *dai, int mute) | 46 | static int cq93vc_mute(struct snd_soc_dai *dai, int mute) |
65 | { | 47 | { |
66 | struct snd_soc_codec *codec = dai->codec; | 48 | struct snd_soc_codec *codec = dai->codec; |
67 | u8 reg = cq93vc_read(codec, DAVINCI_VC_REG09) & ~DAVINCI_VC_REG09_MUTE; | 49 | u8 reg; |
68 | 50 | ||
69 | if (mute) | 51 | if (mute) |
70 | cq93vc_write(codec, DAVINCI_VC_REG09, | 52 | reg = DAVINCI_VC_REG09_MUTE; |
71 | reg | DAVINCI_VC_REG09_MUTE); | ||
72 | else | 53 | else |
73 | cq93vc_write(codec, DAVINCI_VC_REG09, reg); | 54 | reg = 0; |
55 | |||
56 | snd_soc_update_bits(codec, DAVINCI_VC_REG09, DAVINCI_VC_REG09_MUTE, | ||
57 | reg); | ||
74 | 58 | ||
75 | return 0; | 59 | return 0; |
76 | } | 60 | } |
@@ -79,7 +63,7 @@ static int cq93vc_set_dai_sysclk(struct snd_soc_dai *codec_dai, | |||
79 | int clk_id, unsigned int freq, int dir) | 63 | int clk_id, unsigned int freq, int dir) |
80 | { | 64 | { |
81 | struct snd_soc_codec *codec = codec_dai->codec; | 65 | struct snd_soc_codec *codec = codec_dai->codec; |
82 | struct davinci_vc *davinci_vc = codec->control_data; | 66 | struct davinci_vc *davinci_vc = codec->dev->platform_data; |
83 | 67 | ||
84 | switch (freq) { | 68 | switch (freq) { |
85 | case 22579200: | 69 | case 22579200: |
@@ -97,18 +81,18 @@ static int cq93vc_set_bias_level(struct snd_soc_codec *codec, | |||
97 | { | 81 | { |
98 | switch (level) { | 82 | switch (level) { |
99 | case SND_SOC_BIAS_ON: | 83 | case SND_SOC_BIAS_ON: |
100 | cq93vc_write(codec, DAVINCI_VC_REG12, | 84 | snd_soc_write(codec, DAVINCI_VC_REG12, |
101 | DAVINCI_VC_REG12_POWER_ALL_ON); | 85 | DAVINCI_VC_REG12_POWER_ALL_ON); |
102 | break; | 86 | break; |
103 | case SND_SOC_BIAS_PREPARE: | 87 | case SND_SOC_BIAS_PREPARE: |
104 | break; | 88 | break; |
105 | case SND_SOC_BIAS_STANDBY: | 89 | case SND_SOC_BIAS_STANDBY: |
106 | cq93vc_write(codec, DAVINCI_VC_REG12, | 90 | snd_soc_write(codec, DAVINCI_VC_REG12, |
107 | DAVINCI_VC_REG12_POWER_ALL_OFF); | 91 | DAVINCI_VC_REG12_POWER_ALL_OFF); |
108 | break; | 92 | break; |
109 | case SND_SOC_BIAS_OFF: | 93 | case SND_SOC_BIAS_OFF: |
110 | /* force all power off */ | 94 | /* force all power off */ |
111 | cq93vc_write(codec, DAVINCI_VC_REG12, | 95 | snd_soc_write(codec, DAVINCI_VC_REG12, |
112 | DAVINCI_VC_REG12_POWER_ALL_OFF); | 96 | DAVINCI_VC_REG12_POWER_ALL_OFF); |
113 | break; | 97 | break; |
114 | } | 98 | } |
@@ -154,11 +138,9 @@ static int cq93vc_probe(struct snd_soc_codec *codec) | |||
154 | struct davinci_vc *davinci_vc = codec->dev->platform_data; | 138 | struct davinci_vc *davinci_vc = codec->dev->platform_data; |
155 | 139 | ||
156 | davinci_vc->cq93vc.codec = codec; | 140 | davinci_vc->cq93vc.codec = codec; |
157 | codec->control_data = davinci_vc; | 141 | codec->control_data = davinci_vc->regmap; |
158 | 142 | ||
159 | /* Set controls */ | 143 | snd_soc_codec_set_cache_io(codec, 32, 32, SND_SOC_REGMAP); |
160 | snd_soc_add_codec_controls(codec, cq93vc_snd_controls, | ||
161 | ARRAY_SIZE(cq93vc_snd_controls)); | ||
162 | 144 | ||
163 | /* Off, with power on */ | 145 | /* Off, with power on */ |
164 | cq93vc_set_bias_level(codec, SND_SOC_BIAS_STANDBY); | 146 | cq93vc_set_bias_level(codec, SND_SOC_BIAS_STANDBY); |
@@ -174,12 +156,12 @@ static int cq93vc_remove(struct snd_soc_codec *codec) | |||
174 | } | 156 | } |
175 | 157 | ||
176 | static struct snd_soc_codec_driver soc_codec_dev_cq93vc = { | 158 | static struct snd_soc_codec_driver soc_codec_dev_cq93vc = { |
177 | .read = cq93vc_read, | ||
178 | .write = cq93vc_write, | ||
179 | .set_bias_level = cq93vc_set_bias_level, | 159 | .set_bias_level = cq93vc_set_bias_level, |
180 | .probe = cq93vc_probe, | 160 | .probe = cq93vc_probe, |
181 | .remove = cq93vc_remove, | 161 | .remove = cq93vc_remove, |
182 | .resume = cq93vc_resume, | 162 | .resume = cq93vc_resume, |
163 | .controls = cq93vc_snd_controls, | ||
164 | .num_controls = ARRAY_SIZE(cq93vc_snd_controls), | ||
183 | }; | 165 | }; |
184 | 166 | ||
185 | static int cq93vc_platform_probe(struct platform_device *pdev) | 167 | static int cq93vc_platform_probe(struct platform_device *pdev) |