diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2009-05-24 08:32:24 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2009-05-24 08:32:24 -0400 |
commit | 05e1efa2deb42b1bd548208e5c43f471e2cf0da1 (patch) | |
tree | 9242ae7aa647c7ae5347994bf134d56ecf53b1a8 /sound/soc | |
parent | 3c166c7f1828f226c7f478758bf6c8ce8be1623f (diff) |
ASoC: Fix minor issues in STAC9766 driver
Fairly minor issues:
- Don't register the DAIs, it's not required for AC97 devices.
- Make unexported functions static.
- Wrap some excessively long lines.
- Undo tab/space breakage.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc')
-rw-r--r-- | sound/soc/codecs/stac9766.c | 65 |
1 files changed, 29 insertions, 36 deletions
diff --git a/sound/soc/codecs/stac9766.c b/sound/soc/codecs/stac9766.c index 7740cd5a7604..8ad4b7b3e3ba 100644 --- a/sound/soc/codecs/stac9766.c +++ b/sound/soc/codecs/stac9766.c | |||
@@ -52,12 +52,14 @@ static const u16 stac9766_reg[] = { | |||
52 | 0x0000, 0x0000, 0x0000, 0x0000, /* 7e */ | 52 | 0x0000, 0x0000, 0x0000, 0x0000, /* 7e */ |
53 | }; | 53 | }; |
54 | 54 | ||
55 | static const char *stac9766_record_mux[] = {"Mic", "CD", "Video", "AUX", "Line", "Stereo Mix", "Mono Mix", "Phone"}; | 55 | static const char *stac9766_record_mux[] = {"Mic", "CD", "Video", "AUX", |
56 | "Line", "Stereo Mix", "Mono Mix", "Phone"}; | ||
56 | static const char *stac9766_mono_mux[] = {"Mix", "Mic"}; | 57 | static const char *stac9766_mono_mux[] = {"Mix", "Mic"}; |
57 | static const char *stac9766_mic_mux[] = {"Mic1", "Mic2"}; | 58 | static const char *stac9766_mic_mux[] = {"Mic1", "Mic2"}; |
58 | static const char *stac9766_SPDIF_mux[] = {"PCM", "ADC Record"}; | 59 | static const char *stac9766_SPDIF_mux[] = {"PCM", "ADC Record"}; |
59 | static const char *stac9766_popbypass_mux[] = {"Normal", "Bypass Mixer"}; | 60 | static const char *stac9766_popbypass_mux[] = {"Normal", "Bypass Mixer"}; |
60 | static const char *stac9766_record_all_mux[] = {"All analog", "Analog plus DAC"}; | 61 | static const char *stac9766_record_all_mux[] = {"All analog", |
62 | "Analog plus DAC"}; | ||
61 | static const char *stac9766_boost1[] = {"0dB", "10dB"}; | 63 | static const char *stac9766_boost1[] = {"0dB", "10dB"}; |
62 | static const char *stac9766_boost2[] = {"0dB", "20dB"}; | 64 | static const char *stac9766_boost2[] = {"0dB", "20dB"}; |
63 | static const char *stac9766_stereo_mic[] = {"Off", "On"}; | 65 | static const char *stac9766_stereo_mic[] = {"Off", "On"}; |
@@ -73,7 +75,8 @@ static const struct soc_enum stac9766_SPDIF_enum = | |||
73 | static const struct soc_enum stac9766_popbypass_enum = | 75 | static const struct soc_enum stac9766_popbypass_enum = |
74 | SOC_ENUM_SINGLE(AC97_GENERAL_PURPOSE, 15, 2, stac9766_popbypass_mux); | 76 | SOC_ENUM_SINGLE(AC97_GENERAL_PURPOSE, 15, 2, stac9766_popbypass_mux); |
75 | static const struct soc_enum stac9766_record_all_enum = | 77 | static const struct soc_enum stac9766_record_all_enum = |
76 | SOC_ENUM_SINGLE(AC97_STAC_ANALOG_SPECIAL, 12, 2, stac9766_record_all_mux); | 78 | SOC_ENUM_SINGLE(AC97_STAC_ANALOG_SPECIAL, 12, 2, |
79 | stac9766_record_all_mux); | ||
77 | static const struct soc_enum stac9766_boost1_enum = | 80 | static const struct soc_enum stac9766_boost1_enum = |
78 | SOC_ENUM_SINGLE(AC97_MIC, 6, 2, stac9766_boost1); /* 0/10dB */ | 81 | SOC_ENUM_SINGLE(AC97_MIC, 6, 2, stac9766_boost1); /* 0/10dB */ |
79 | static const struct soc_enum stac9766_boost2_enum = | 82 | static const struct soc_enum stac9766_boost2_enum = |
@@ -89,9 +92,11 @@ static const DECLARE_TLV_DB_LINEAR(mix_tlv, -3450, 1200); | |||
89 | static const struct snd_kcontrol_new stac9766_snd_ac97_controls[] = { | 92 | static const struct snd_kcontrol_new stac9766_snd_ac97_controls[] = { |
90 | SOC_DOUBLE_TLV("Speaker Volume", AC97_MASTER, 8, 0, 31, 1, master_tlv), | 93 | SOC_DOUBLE_TLV("Speaker Volume", AC97_MASTER, 8, 0, 31, 1, master_tlv), |
91 | SOC_SINGLE("Speaker Switch", AC97_MASTER, 15, 1, 1), | 94 | SOC_SINGLE("Speaker Switch", AC97_MASTER, 15, 1, 1), |
92 | SOC_DOUBLE_TLV("Headphone Volume", AC97_HEADPHONE, 8, 0, 31, 1, master_tlv), | 95 | SOC_DOUBLE_TLV("Headphone Volume", AC97_HEADPHONE, 8, 0, 31, 1, |
96 | master_tlv), | ||
93 | SOC_SINGLE("Headphone Switch", AC97_HEADPHONE, 15, 1, 1), | 97 | SOC_SINGLE("Headphone Switch", AC97_HEADPHONE, 15, 1, 1), |
94 | SOC_SINGLE_TLV("Mono Out Volume", AC97_MASTER_MONO, 0, 31, 1, master_tlv), | 98 | SOC_SINGLE_TLV("Mono Out Volume", AC97_MASTER_MONO, 0, 31, 1, |
99 | master_tlv), | ||
95 | SOC_SINGLE("Mono Out Switch", AC97_MASTER_MONO, 15, 1, 1), | 100 | SOC_SINGLE("Mono Out Switch", AC97_MASTER_MONO, 15, 1, 1), |
96 | 101 | ||
97 | SOC_DOUBLE_TLV("Record Volume", AC97_REC_GAIN, 8, 0, 15, 0, record_tlv), | 102 | SOC_DOUBLE_TLV("Record Volume", AC97_REC_GAIN, 8, 0, 15, 0, record_tlv), |
@@ -133,8 +138,8 @@ static const struct snd_kcontrol_new stac9766_snd_ac97_controls[] = { | |||
133 | SOC_ENUM("Pop Bypass Mux", stac9766_popbypass_enum), | 138 | SOC_ENUM("Pop Bypass Mux", stac9766_popbypass_enum), |
134 | }; | 139 | }; |
135 | 140 | ||
136 | int stac9766_ac97_write(struct snd_soc_codec *codec, unsigned int reg, | 141 | static int stac9766_ac97_write(struct snd_soc_codec *codec, unsigned int reg, |
137 | unsigned int val) | 142 | unsigned int val) |
138 | { | 143 | { |
139 | u16 *cache = codec->reg_cache; | 144 | u16 *cache = codec->reg_cache; |
140 | 145 | ||
@@ -152,7 +157,8 @@ int stac9766_ac97_write(struct snd_soc_codec *codec, unsigned int reg, | |||
152 | return 0; | 157 | return 0; |
153 | } | 158 | } |
154 | 159 | ||
155 | unsigned int stac9766_ac97_read(struct snd_soc_codec *codec, unsigned int reg) | 160 | static unsigned int stac9766_ac97_read(struct snd_soc_codec *codec, |
161 | unsigned int reg) | ||
156 | { | 162 | { |
157 | u16 val = 0, *cache = codec->reg_cache; | 163 | u16 val = 0, *cache = codec->reg_cache; |
158 | 164 | ||
@@ -176,7 +182,7 @@ unsigned int stac9766_ac97_read(struct snd_soc_codec *codec, unsigned int reg) | |||
176 | } | 182 | } |
177 | 183 | ||
178 | static int ac97_analog_prepare(struct snd_pcm_substream *substream, | 184 | static int ac97_analog_prepare(struct snd_pcm_substream *substream, |
179 | struct snd_soc_dai *dai) | 185 | struct snd_soc_dai *dai) |
180 | { | 186 | { |
181 | struct snd_soc_codec *codec = dai->codec; | 187 | struct snd_soc_codec *codec = dai->codec; |
182 | struct snd_pcm_runtime *runtime = substream->runtime; | 188 | struct snd_pcm_runtime *runtime = substream->runtime; |
@@ -197,7 +203,7 @@ static int ac97_analog_prepare(struct snd_pcm_substream *substream, | |||
197 | } | 203 | } |
198 | 204 | ||
199 | static int ac97_digital_prepare(struct snd_pcm_substream *substream, | 205 | static int ac97_digital_prepare(struct snd_pcm_substream *substream, |
200 | struct snd_soc_dai *dai) | 206 | struct snd_soc_dai *dai) |
201 | { | 207 | { |
202 | struct snd_soc_codec *codec = dai->codec; | 208 | struct snd_soc_codec *codec = dai->codec; |
203 | struct snd_pcm_runtime *runtime = substream->runtime; | 209 | struct snd_pcm_runtime *runtime = substream->runtime; |
@@ -216,7 +222,7 @@ static int ac97_digital_prepare(struct snd_pcm_substream *substream, | |||
216 | } | 222 | } |
217 | 223 | ||
218 | static int ac97_digital_trigger(struct snd_pcm_substream *substream, | 224 | static int ac97_digital_trigger(struct snd_pcm_substream *substream, |
219 | int cmd, struct snd_soc_dai *dai) | 225 | int cmd, struct snd_soc_dai *dai) |
220 | { | 226 | { |
221 | struct snd_soc_codec *codec = dai->codec; | 227 | struct snd_soc_codec *codec = dai->codec; |
222 | unsigned short vra; | 228 | unsigned short vra; |
@@ -232,7 +238,7 @@ static int ac97_digital_trigger(struct snd_pcm_substream *substream, | |||
232 | } | 238 | } |
233 | 239 | ||
234 | static int stac9766_set_bias_level(struct snd_soc_codec *codec, | 240 | static int stac9766_set_bias_level(struct snd_soc_codec *codec, |
235 | enum snd_soc_bias_level level) | 241 | enum snd_soc_bias_level level) |
236 | { | 242 | { |
237 | switch (level) { | 243 | switch (level) { |
238 | case SND_SOC_BIAS_ON: /* full On */ | 244 | case SND_SOC_BIAS_ON: /* full On */ |
@@ -249,7 +255,7 @@ static int stac9766_set_bias_level(struct snd_soc_codec *codec, | |||
249 | return 0; | 255 | return 0; |
250 | } | 256 | } |
251 | 257 | ||
252 | int stac9766_reset(struct snd_soc_codec *codec, int try_warm) | 258 | static int stac9766_reset(struct snd_soc_codec *codec, int try_warm) |
253 | { | 259 | { |
254 | if (try_warm && soc_ac97_ops.warm_reset) { | 260 | if (try_warm && soc_ac97_ops.warm_reset) { |
255 | soc_ac97_ops.warm_reset(codec->ac97); | 261 | soc_ac97_ops.warm_reset(codec->ac97); |
@@ -266,7 +272,7 @@ int stac9766_reset(struct snd_soc_codec *codec, int try_warm) | |||
266 | } | 272 | } |
267 | 273 | ||
268 | static int stac9766_codec_suspend(struct platform_device *pdev, | 274 | static int stac9766_codec_suspend(struct platform_device *pdev, |
269 | pm_message_t state) | 275 | pm_message_t state) |
270 | { | 276 | { |
271 | struct snd_soc_device *socdev = platform_get_drvdata(pdev); | 277 | struct snd_soc_device *socdev = platform_get_drvdata(pdev); |
272 | struct snd_soc_codec *codec = socdev->card->codec; | 278 | struct snd_soc_codec *codec = socdev->card->codec; |
@@ -303,13 +309,11 @@ reset: | |||
303 | return 0; | 309 | return 0; |
304 | } | 310 | } |
305 | 311 | ||
306 | static struct snd_soc_dai_ops stac9766_dai_ops_analog = | 312 | static struct snd_soc_dai_ops stac9766_dai_ops_analog = { |
307 | { | ||
308 | .prepare = ac97_analog_prepare, | 313 | .prepare = ac97_analog_prepare, |
309 | }; | 314 | }; |
310 | 315 | ||
311 | static struct snd_soc_dai_ops stac9766_dai_ops_digital = | 316 | static struct snd_soc_dai_ops stac9766_dai_ops_digital = { |
312 | { | ||
313 | .prepare = ac97_digital_prepare, | 317 | .prepare = ac97_digital_prepare, |
314 | .trigger = ac97_digital_trigger, | 318 | .trigger = ac97_digital_trigger, |
315 | }; | 319 | }; |
@@ -354,7 +358,8 @@ struct snd_soc_dai stac9766_dai[] = { | |||
354 | }, | 358 | }, |
355 | /* alsa ops */ | 359 | /* alsa ops */ |
356 | .ops = &stac9766_dai_ops_digital, | 360 | .ops = &stac9766_dai_ops_digital, |
357 | }}; | 361 | } |
362 | }; | ||
358 | EXPORT_SYMBOL_GPL(stac9766_dai); | 363 | EXPORT_SYMBOL_GPL(stac9766_dai); |
359 | 364 | ||
360 | static int stac9766_codec_probe(struct platform_device *pdev) | 365 | static int stac9766_codec_probe(struct platform_device *pdev) |
@@ -371,7 +376,8 @@ static int stac9766_codec_probe(struct platform_device *pdev) | |||
371 | codec = socdev->card->codec; | 376 | codec = socdev->card->codec; |
372 | mutex_init(&codec->mutex); | 377 | mutex_init(&codec->mutex); |
373 | 378 | ||
374 | codec->reg_cache = kmemdup(stac9766_reg, sizeof(stac9766_reg), GFP_KERNEL); | 379 | codec->reg_cache = kmemdup(stac9766_reg, sizeof(stac9766_reg), |
380 | GFP_KERNEL); | ||
375 | if (codec->reg_cache == NULL) { | 381 | if (codec->reg_cache == NULL) { |
376 | ret = -ENOMEM; | 382 | ret = -ENOMEM; |
377 | goto cache_err; | 383 | goto cache_err; |
@@ -409,8 +415,8 @@ static int stac9766_codec_probe(struct platform_device *pdev) | |||
409 | 415 | ||
410 | stac9766_set_bias_level(codec, SND_SOC_BIAS_STANDBY); | 416 | stac9766_set_bias_level(codec, SND_SOC_BIAS_STANDBY); |
411 | 417 | ||
412 | snd_soc_add_controls(codec, stac9766_snd_ac97_controls, ARRAY_SIZE( | 418 | snd_soc_add_controls(codec, stac9766_snd_ac97_controls, |
413 | stac9766_snd_ac97_controls)); | 419 | ARRAY_SIZE(stac9766_snd_ac97_controls)); |
414 | 420 | ||
415 | ret = snd_soc_init_card(socdev); | 421 | ret = snd_soc_init_card(socdev); |
416 | if (ret < 0) | 422 | if (ret < 0) |
@@ -444,8 +450,7 @@ static int stac9766_codec_remove(struct platform_device *pdev) | |||
444 | return 0; | 450 | return 0; |
445 | } | 451 | } |
446 | 452 | ||
447 | struct snd_soc_codec_device soc_codec_dev_stac9766 = | 453 | struct snd_soc_codec_device soc_codec_dev_stac9766 = { |
448 | { | ||
449 | .probe = stac9766_codec_probe, | 454 | .probe = stac9766_codec_probe, |
450 | .remove = stac9766_codec_remove, | 455 | .remove = stac9766_codec_remove, |
451 | .suspend = stac9766_codec_suspend, | 456 | .suspend = stac9766_codec_suspend, |
@@ -453,18 +458,6 @@ struct snd_soc_codec_device soc_codec_dev_stac9766 = | |||
453 | }; | 458 | }; |
454 | EXPORT_SYMBOL_GPL(soc_codec_dev_stac9766); | 459 | EXPORT_SYMBOL_GPL(soc_codec_dev_stac9766); |
455 | 460 | ||
456 | static int __init stac9766_modinit(void) | ||
457 | { | ||
458 | return snd_soc_register_dais(stac9766_dai, ARRAY_SIZE(stac9766_dai)); | ||
459 | } | ||
460 | module_init(stac9766_modinit); | ||
461 | |||
462 | static void __exit stac9766_exit(void) | ||
463 | { | ||
464 | snd_soc_unregister_dais(stac9766_dai, ARRAY_SIZE(stac9766_dai)); | ||
465 | } | ||
466 | module_exit(stac9766_exit); | ||
467 | |||
468 | MODULE_DESCRIPTION("ASoC stac9766 driver"); | 461 | MODULE_DESCRIPTION("ASoC stac9766 driver"); |
469 | MODULE_AUTHOR("Jon Smirl <jonsmirl@gmail.com>"); | 462 | MODULE_AUTHOR("Jon Smirl <jonsmirl@gmail.com>"); |
470 | MODULE_LICENSE("GPL"); | 463 | MODULE_LICENSE("GPL"); |