16 #include <linux/module.h>
19 #include <linux/i2c.h>
31 #include "../codecs/wm8731.h"
37 #define CORGI_HEADSET 3
38 #define CORGI_HP_OFF 4
39 #define CORGI_SPK_ON 0
40 #define CORGI_SPK_OFF 1
43 #define CORGI_AUDIO_CLOCK 12288000
45 static int corgi_jack_func;
46 static int corgi_spk_func;
51 switch (corgi_jack_func) {
105 corgi_ext_control(&codec->
dapm);
126 unsigned int clk = 0;
159 .startup = corgi_startup,
160 .hw_params = corgi_hw_params,
161 .shutdown = corgi_shutdown,
164 static int corgi_get_jack(
struct snd_kcontrol *kcontrol,
167 ucontrol->
value.integer.value[0] = corgi_jack_func;
171 static int corgi_set_jack(
struct snd_kcontrol *kcontrol,
176 if (corgi_jack_func == ucontrol->
value.integer.value[0])
179 corgi_jack_func = ucontrol->
value.integer.value[0];
180 corgi_ext_control(&card->
dapm);
187 ucontrol->
value.integer.value[0] = corgi_spk_func;
196 if (corgi_spk_func == ucontrol->
value.integer.value[0])
199 corgi_spk_func = ucontrol->
value.integer.value[0];
200 corgi_ext_control(&card->
dapm);
231 {
"Headset Jack",
NULL,
"LHPOUT"},
234 {
"Headphone Jack",
NULL,
"LHPOUT"},
235 {
"Headphone Jack",
NULL,
"RHPOUT"},
238 {
"Ext Spk",
NULL,
"ROUT"},
239 {
"Ext Spk",
NULL,
"LOUT"},
242 {
"MICIN",
NULL,
"Mic Jack"},
245 {
"MICIN",
NULL,
"Line Jack"},
248 static const char *jack_function[] = {
"Headphone",
"Mic",
"Line",
"Headset",
250 static const char *spk_function[] = {
"On",
"Off"};
251 static const struct soc_enum corgi_enum[] = {
257 SOC_ENUM_EXT(
"Jack Function", corgi_enum[0], corgi_get_jack,
259 SOC_ENUM_EXT(
"Speaker Function", corgi_enum[1], corgi_get_spk,
280 .stream_name =
"WM8731",
281 .cpu_dai_name =
"pxa2xx-i2s",
282 .codec_dai_name =
"wm8731-hifi",
283 .platform_name =
"pxa-pcm-audio",
284 .codec_name =
"wm8731.0-001b",
285 .init = corgi_wm8731_init,
295 .dai_link = &corgi_dai,
298 .controls = wm8731_corgi_controls,
299 .num_controls =
ARRAY_SIZE(wm8731_corgi_controls),
300 .dapm_widgets = wm8731_dapm_widgets,
301 .num_dapm_widgets =
ARRAY_SIZE(wm8731_dapm_widgets),
302 .dapm_routes = corgi_audio_map,
303 .num_dapm_routes =
ARRAY_SIZE(corgi_audio_map),
315 dev_err(&pdev->
dev,
"snd_soc_register_card() failed: %d\n",
330 .name =
"corgi-audio",
333 .probe = corgi_probe,