]> bbs.cooldavid.org Git - net-next-2.6.git/blame - sound/pci/hda/patch_conexant.c
[ALSA] hda: Mono mux mixer support
[net-next-2.6.git] / sound / pci / hda / patch_conexant.c
CommitLineData
c9b443d4
TD
1/*
2 * HD audio interface patch for Conexant HDA audio codec
3 *
4 * Copyright (c) 2006 Pototskiy Akex <alex.pototskiy@gmail.com>
5 * Takashi Iwai <tiwai@suse.de>
6 * Tobin Davis <tdavis@dsl-only.net>
7 *
8 * This driver is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This driver is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22
c9b443d4
TD
23#include <linux/init.h>
24#include <linux/delay.h>
25#include <linux/slab.h>
26#include <linux/pci.h>
27#include <sound/core.h>
28#include "hda_codec.h"
29#include "hda_local.h"
30
31#define CXT_PIN_DIR_IN 0x00
32#define CXT_PIN_DIR_OUT 0x01
33#define CXT_PIN_DIR_INOUT 0x02
34#define CXT_PIN_DIR_IN_NOMICBIAS 0x03
35#define CXT_PIN_DIR_INOUT_NOMICBIAS 0x04
36
37#define CONEXANT_HP_EVENT 0x37
38#define CONEXANT_MIC_EVENT 0x38
39
40
41
42struct conexant_spec {
43
44 struct snd_kcontrol_new *mixers[5];
45 int num_mixers;
46
47 const struct hda_verb *init_verbs[5]; /* initialization verbs
48 * don't forget NULL
49 * termination!
50 */
51 unsigned int num_init_verbs;
52
53 /* playback */
54 struct hda_multi_out multiout; /* playback set-up
55 * max_channels, dacs must be set
56 * dig_out_nid and hp_nid are optional
57 */
58 unsigned int cur_eapd;
82f30040 59 unsigned int hp_present;
c9b443d4
TD
60 unsigned int need_dac_fix;
61
62 /* capture */
63 unsigned int num_adc_nids;
64 hda_nid_t *adc_nids;
65 hda_nid_t dig_in_nid; /* digital-in NID; optional */
66
67 /* capture source */
68 const struct hda_input_mux *input_mux;
69 hda_nid_t *capsrc_nids;
70 unsigned int cur_mux[3];
71
72 /* channel model */
73 const struct hda_channel_mode *channel_mode;
74 int num_channel_mode;
75
76 /* PCM information */
77 struct hda_pcm pcm_rec[2]; /* used in build_pcms() */
78
79 struct mutex amp_mutex; /* PCM volume/mute control mutex */
80 unsigned int spdif_route;
81
82 /* dynamic controls, init_verbs and input_mux */
83 struct auto_pin_cfg autocfg;
84 unsigned int num_kctl_alloc, num_kctl_used;
85 struct snd_kcontrol_new *kctl_alloc;
86 struct hda_input_mux private_imux;
41923e44 87 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
c9b443d4
TD
88
89};
90
91static int conexant_playback_pcm_open(struct hda_pcm_stream *hinfo,
92 struct hda_codec *codec,
93 struct snd_pcm_substream *substream)
94{
95 struct conexant_spec *spec = codec->spec;
96 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream);
97}
98
99static int conexant_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
100 struct hda_codec *codec,
101 unsigned int stream_tag,
102 unsigned int format,
103 struct snd_pcm_substream *substream)
104{
105 struct conexant_spec *spec = codec->spec;
106 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
107 stream_tag,
108 format, substream);
109}
110
111static int conexant_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
112 struct hda_codec *codec,
113 struct snd_pcm_substream *substream)
114{
115 struct conexant_spec *spec = codec->spec;
116 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
117}
118
119/*
120 * Digital out
121 */
122static int conexant_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
123 struct hda_codec *codec,
124 struct snd_pcm_substream *substream)
125{
126 struct conexant_spec *spec = codec->spec;
127 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
128}
129
130static int conexant_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
131 struct hda_codec *codec,
132 struct snd_pcm_substream *substream)
133{
134 struct conexant_spec *spec = codec->spec;
135 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
136}
137
6b97eb45
TI
138static int conexant_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
139 struct hda_codec *codec,
140 unsigned int stream_tag,
141 unsigned int format,
142 struct snd_pcm_substream *substream)
143{
144 struct conexant_spec *spec = codec->spec;
145 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
146 stream_tag,
147 format, substream);
148}
149
c9b443d4
TD
150/*
151 * Analog capture
152 */
153static int conexant_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
154 struct hda_codec *codec,
155 unsigned int stream_tag,
156 unsigned int format,
157 struct snd_pcm_substream *substream)
158{
159 struct conexant_spec *spec = codec->spec;
160 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number],
161 stream_tag, 0, format);
162 return 0;
163}
164
165static int conexant_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
166 struct hda_codec *codec,
167 struct snd_pcm_substream *substream)
168{
169 struct conexant_spec *spec = codec->spec;
170 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number],
171 0, 0, 0);
172 return 0;
173}
174
175
176
177static struct hda_pcm_stream conexant_pcm_analog_playback = {
178 .substreams = 1,
179 .channels_min = 2,
180 .channels_max = 2,
181 .nid = 0, /* fill later */
182 .ops = {
183 .open = conexant_playback_pcm_open,
184 .prepare = conexant_playback_pcm_prepare,
185 .cleanup = conexant_playback_pcm_cleanup
186 },
187};
188
189static struct hda_pcm_stream conexant_pcm_analog_capture = {
190 .substreams = 1,
191 .channels_min = 2,
192 .channels_max = 2,
193 .nid = 0, /* fill later */
194 .ops = {
195 .prepare = conexant_capture_pcm_prepare,
196 .cleanup = conexant_capture_pcm_cleanup
197 },
198};
199
200
201static struct hda_pcm_stream conexant_pcm_digital_playback = {
202 .substreams = 1,
203 .channels_min = 2,
204 .channels_max = 2,
205 .nid = 0, /* fill later */
206 .ops = {
207 .open = conexant_dig_playback_pcm_open,
6b97eb45
TI
208 .close = conexant_dig_playback_pcm_close,
209 .prepare = conexant_dig_playback_pcm_prepare
c9b443d4
TD
210 },
211};
212
213static struct hda_pcm_stream conexant_pcm_digital_capture = {
214 .substreams = 1,
215 .channels_min = 2,
216 .channels_max = 2,
217 /* NID is set in alc_build_pcms */
218};
219
220static int conexant_build_pcms(struct hda_codec *codec)
221{
222 struct conexant_spec *spec = codec->spec;
223 struct hda_pcm *info = spec->pcm_rec;
224
225 codec->num_pcms = 1;
226 codec->pcm_info = info;
227
228 info->name = "CONEXANT Analog";
229 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = conexant_pcm_analog_playback;
230 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max =
231 spec->multiout.max_channels;
232 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
233 spec->multiout.dac_nids[0];
234 info->stream[SNDRV_PCM_STREAM_CAPTURE] = conexant_pcm_analog_capture;
235 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = spec->num_adc_nids;
236 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
237
238 if (spec->multiout.dig_out_nid) {
239 info++;
240 codec->num_pcms++;
241 info->name = "Conexant Digital";
242 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
243 conexant_pcm_digital_playback;
244 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
245 spec->multiout.dig_out_nid;
246 if (spec->dig_in_nid) {
247 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
248 conexant_pcm_digital_capture;
249 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
250 spec->dig_in_nid;
251 }
252 }
253
254 return 0;
255}
256
257static int conexant_mux_enum_info(struct snd_kcontrol *kcontrol,
258 struct snd_ctl_elem_info *uinfo)
259{
260 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
261 struct conexant_spec *spec = codec->spec;
262
263 return snd_hda_input_mux_info(spec->input_mux, uinfo);
264}
265
266static int conexant_mux_enum_get(struct snd_kcontrol *kcontrol,
267 struct snd_ctl_elem_value *ucontrol)
268{
269 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
270 struct conexant_spec *spec = codec->spec;
271 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
272
273 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
274 return 0;
275}
276
277static int conexant_mux_enum_put(struct snd_kcontrol *kcontrol,
278 struct snd_ctl_elem_value *ucontrol)
279{
280 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
281 struct conexant_spec *spec = codec->spec;
282 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
283
284 return snd_hda_input_mux_put(codec, spec->input_mux, ucontrol,
285 spec->capsrc_nids[adc_idx],
286 &spec->cur_mux[adc_idx]);
287}
288
289static int conexant_init(struct hda_codec *codec)
290{
291 struct conexant_spec *spec = codec->spec;
292 int i;
293
294 for (i = 0; i < spec->num_init_verbs; i++)
295 snd_hda_sequence_write(codec, spec->init_verbs[i]);
296 return 0;
297}
298
299static void conexant_free(struct hda_codec *codec)
300{
301 struct conexant_spec *spec = codec->spec;
302 unsigned int i;
303
304 if (spec->kctl_alloc) {
305 for (i = 0; i < spec->num_kctl_used; i++)
306 kfree(spec->kctl_alloc[i].name);
307 kfree(spec->kctl_alloc);
308 }
309
310 kfree(codec->spec);
311}
312
c9b443d4
TD
313static int conexant_build_controls(struct hda_codec *codec)
314{
315 struct conexant_spec *spec = codec->spec;
316 unsigned int i;
317 int err;
318
319 for (i = 0; i < spec->num_mixers; i++) {
320 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
321 if (err < 0)
322 return err;
323 }
324 if (spec->multiout.dig_out_nid) {
325 err = snd_hda_create_spdif_out_ctls(codec,
326 spec->multiout.dig_out_nid);
327 if (err < 0)
328 return err;
329 }
330 if (spec->dig_in_nid) {
331 err = snd_hda_create_spdif_in_ctls(codec,spec->dig_in_nid);
332 if (err < 0)
333 return err;
334 }
335 return 0;
336}
337
338static struct hda_codec_ops conexant_patch_ops = {
339 .build_controls = conexant_build_controls,
340 .build_pcms = conexant_build_pcms,
341 .init = conexant_init,
342 .free = conexant_free,
c9b443d4
TD
343};
344
345/*
346 * EAPD control
347 * the private value = nid | (invert << 8)
348 */
349
a5ce8890 350#define cxt_eapd_info snd_ctl_boolean_mono_info
c9b443d4 351
82f30040 352static int cxt_eapd_get(struct snd_kcontrol *kcontrol,
c9b443d4
TD
353 struct snd_ctl_elem_value *ucontrol)
354{
355 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
356 struct conexant_spec *spec = codec->spec;
357 int invert = (kcontrol->private_value >> 8) & 1;
358 if (invert)
359 ucontrol->value.integer.value[0] = !spec->cur_eapd;
360 else
361 ucontrol->value.integer.value[0] = spec->cur_eapd;
362 return 0;
82f30040 363
c9b443d4
TD
364}
365
82f30040 366static int cxt_eapd_put(struct snd_kcontrol *kcontrol,
c9b443d4
TD
367 struct snd_ctl_elem_value *ucontrol)
368{
369 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
370 struct conexant_spec *spec = codec->spec;
371 int invert = (kcontrol->private_value >> 8) & 1;
372 hda_nid_t nid = kcontrol->private_value & 0xff;
373 unsigned int eapd;
82f30040 374
68ea7b2f 375 eapd = !!ucontrol->value.integer.value[0];
c9b443d4
TD
376 if (invert)
377 eapd = !eapd;
82beb8fd 378 if (eapd == spec->cur_eapd)
c9b443d4 379 return 0;
82f30040 380
c9b443d4 381 spec->cur_eapd = eapd;
82beb8fd
TI
382 snd_hda_codec_write_cache(codec, nid,
383 0, AC_VERB_SET_EAPD_BTLENABLE,
384 eapd ? 0x02 : 0x00);
c9b443d4
TD
385 return 1;
386}
387
86d72bdf
TI
388/* controls for test mode */
389#ifdef CONFIG_SND_DEBUG
390
82f30040
TD
391#define CXT_EAPD_SWITCH(xname, nid, mask) \
392 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
393 .info = cxt_eapd_info, \
394 .get = cxt_eapd_get, \
395 .put = cxt_eapd_put, \
396 .private_value = nid | (mask<<16) }
397
398
399
c9b443d4
TD
400static int conexant_ch_mode_info(struct snd_kcontrol *kcontrol,
401 struct snd_ctl_elem_info *uinfo)
402{
403 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
404 struct conexant_spec *spec = codec->spec;
405 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
406 spec->num_channel_mode);
407}
408
409static int conexant_ch_mode_get(struct snd_kcontrol *kcontrol,
410 struct snd_ctl_elem_value *ucontrol)
411{
412 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
413 struct conexant_spec *spec = codec->spec;
414 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
415 spec->num_channel_mode,
416 spec->multiout.max_channels);
417}
418
419static int conexant_ch_mode_put(struct snd_kcontrol *kcontrol,
420 struct snd_ctl_elem_value *ucontrol)
421{
422 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
423 struct conexant_spec *spec = codec->spec;
424 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
425 spec->num_channel_mode,
426 &spec->multiout.max_channels);
427 if (err >= 0 && spec->need_dac_fix)
428 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
429 return err;
430}
431
432#define CXT_PIN_MODE(xname, nid, dir) \
433 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
434 .info = conexant_ch_mode_info, \
435 .get = conexant_ch_mode_get, \
436 .put = conexant_ch_mode_put, \
437 .private_value = nid | (dir<<16) }
438
86d72bdf
TI
439#endif /* CONFIG_SND_DEBUG */
440
c9b443d4
TD
441/* Conexant 5045 specific */
442
443static hda_nid_t cxt5045_dac_nids[1] = { 0x19 };
444static hda_nid_t cxt5045_adc_nids[1] = { 0x1a };
445static hda_nid_t cxt5045_capsrc_nids[1] = { 0x1a };
446#define CXT5045_SPDIF_OUT 0x13
447
5cd57529
TD
448static struct hda_channel_mode cxt5045_modes[1] = {
449 { 2, NULL },
450};
c9b443d4
TD
451
452static struct hda_input_mux cxt5045_capture_source = {
453 .num_items = 2,
454 .items = {
82f30040 455 { "IntMic", 0x1 },
f4beee94 456 { "ExtMic", 0x2 },
c9b443d4
TD
457 }
458};
459
5218c892
JZ
460static struct hda_input_mux cxt5045_capture_source_benq = {
461 .num_items = 3,
462 .items = {
463 { "IntMic", 0x1 },
464 { "ExtMic", 0x2 },
465 { "LineIn", 0x3 },
466 }
467};
468
c9b443d4
TD
469/* turn on/off EAPD (+ mute HP) as a master switch */
470static int cxt5045_hp_master_sw_put(struct snd_kcontrol *kcontrol,
471 struct snd_ctl_elem_value *ucontrol)
472{
473 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
474 struct conexant_spec *spec = codec->spec;
82f30040 475 unsigned int bits;
c9b443d4 476
82f30040 477 if (!cxt_eapd_put(kcontrol, ucontrol))
c9b443d4
TD
478 return 0;
479
82f30040
TD
480 /* toggle internal speakers mute depending of presence of
481 * the headphone jack
482 */
47fd830a
TI
483 bits = (!spec->hp_present && spec->cur_eapd) ? 0 : HDA_AMP_MUTE;
484 snd_hda_codec_amp_stereo(codec, 0x10, HDA_OUTPUT, 0,
485 HDA_AMP_MUTE, bits);
7f29673b 486
47fd830a
TI
487 bits = spec->cur_eapd ? 0 : HDA_AMP_MUTE;
488 snd_hda_codec_amp_stereo(codec, 0x11, HDA_OUTPUT, 0,
489 HDA_AMP_MUTE, bits);
c9b443d4
TD
490 return 1;
491}
492
493/* bind volumes of both NID 0x10 and 0x11 */
cca3b371
TI
494static struct hda_bind_ctls cxt5045_hp_bind_master_vol = {
495 .ops = &snd_hda_bind_vol,
496 .values = {
497 HDA_COMPOSE_AMP_VAL(0x10, 3, 0, HDA_OUTPUT),
498 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
499 0
500 },
501};
c9b443d4 502
7f29673b
TD
503/* toggle input of built-in and mic jack appropriately */
504static void cxt5045_hp_automic(struct hda_codec *codec)
505{
506 static struct hda_verb mic_jack_on[] = {
507 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080},
508 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
509 {}
510 };
511 static struct hda_verb mic_jack_off[] = {
512 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080},
513 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
514 {}
515 };
516 unsigned int present;
517
518 present = snd_hda_codec_read(codec, 0x12, 0,
519 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
520 if (present)
521 snd_hda_sequence_write(codec, mic_jack_on);
522 else
523 snd_hda_sequence_write(codec, mic_jack_off);
524}
525
c9b443d4
TD
526
527/* mute internal speaker if HP is plugged */
528static void cxt5045_hp_automute(struct hda_codec *codec)
529{
82f30040 530 struct conexant_spec *spec = codec->spec;
dd87da1c 531 unsigned int bits;
c9b443d4 532
82f30040 533 spec->hp_present = snd_hda_codec_read(codec, 0x11, 0,
c9b443d4 534 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
dd87da1c 535
47fd830a
TI
536 bits = (spec->hp_present || !spec->cur_eapd) ? HDA_AMP_MUTE : 0;
537 snd_hda_codec_amp_stereo(codec, 0x10, HDA_OUTPUT, 0,
538 HDA_AMP_MUTE, bits);
c9b443d4
TD
539}
540
541/* unsolicited event for HP jack sensing */
542static void cxt5045_hp_unsol_event(struct hda_codec *codec,
543 unsigned int res)
544{
545 res >>= 26;
546 switch (res) {
547 case CONEXANT_HP_EVENT:
548 cxt5045_hp_automute(codec);
549 break;
7f29673b
TD
550 case CONEXANT_MIC_EVENT:
551 cxt5045_hp_automic(codec);
552 break;
553
c9b443d4
TD
554 }
555}
556
557static struct snd_kcontrol_new cxt5045_mixers[] = {
558 {
559 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
560 .name = "Capture Source",
561 .info = conexant_mux_enum_info,
562 .get = conexant_mux_enum_get,
563 .put = conexant_mux_enum_put
564 },
c8229c38
TI
565 HDA_CODEC_VOLUME("Int Mic Capture Volume", 0x1a, 0x01, HDA_INPUT),
566 HDA_CODEC_MUTE("Int Mic Capture Switch", 0x1a, 0x01, HDA_INPUT),
567 HDA_CODEC_VOLUME("Ext Mic Capture Volume", 0x1a, 0x02, HDA_INPUT),
568 HDA_CODEC_MUTE("Ext Mic Capture Switch", 0x1a, 0x02, HDA_INPUT),
569 HDA_CODEC_VOLUME("PCM Playback Volume", 0x17, 0x0, HDA_INPUT),
570 HDA_CODEC_MUTE("PCM Playback Switch", 0x17, 0x0, HDA_INPUT),
571 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x17, 0x1, HDA_INPUT),
572 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x17, 0x1, HDA_INPUT),
573 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x17, 0x2, HDA_INPUT),
574 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x17, 0x2, HDA_INPUT),
cca3b371 575 HDA_BIND_VOL("Master Playback Volume", &cxt5045_hp_bind_master_vol),
c9b443d4
TD
576 {
577 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
578 .name = "Master Playback Switch",
82f30040
TD
579 .info = cxt_eapd_info,
580 .get = cxt_eapd_get,
c9b443d4 581 .put = cxt5045_hp_master_sw_put,
82f30040 582 .private_value = 0x10,
c9b443d4
TD
583 },
584
585 {}
586};
587
5218c892
JZ
588static struct snd_kcontrol_new cxt5045_benq_mixers[] = {
589 HDA_CODEC_VOLUME("Line In Capture Volume", 0x1a, 0x03, HDA_INPUT),
590 HDA_CODEC_MUTE("Line In Capture Switch", 0x1a, 0x03, HDA_INPUT),
591 HDA_CODEC_VOLUME("Line In Playback Volume", 0x17, 0x3, HDA_INPUT),
592 HDA_CODEC_MUTE("Line In Playback Switch", 0x17, 0x3, HDA_INPUT),
593
594 {}
595};
596
c9b443d4
TD
597static struct hda_verb cxt5045_init_verbs[] = {
598 /* Line in, Mic */
599 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7f29673b 600 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN|AC_PINCTL_VREF_80 },
c9b443d4 601 /* HP, Amp */
c8229c38
TI
602 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
603 {0x10, AC_VERB_SET_CONNECT_SEL, 0x1},
604 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
605 {0x11, AC_VERB_SET_CONNECT_SEL, 0x1},
606 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
607 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
608 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
609 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
610 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
82f30040 611 /* Record selector: Int mic */
7f29673b 612 {0x1a, AC_VERB_SET_CONNECT_SEL,0x1},
82f30040 613 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE,
c9b443d4
TD
614 AC_AMP_SET_INPUT|AC_AMP_SET_RIGHT|AC_AMP_SET_LEFT|0x17},
615 /* SPDIF route: PCM */
616 { 0x13, AC_VERB_SET_CONNECT_SEL, 0x0 },
c9b443d4 617 /* EAPD */
82f30040 618 {0x10, AC_VERB_SET_EAPD_BTLENABLE, 0x2 }, /* default on */
c9b443d4
TD
619 { } /* end */
620};
621
5218c892
JZ
622static struct hda_verb cxt5045_benq_init_verbs[] = {
623 /* Int Mic, Mic */
624 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN|AC_PINCTL_VREF_80 },
625 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN|AC_PINCTL_VREF_80 },
626 /* Line In,HP, Amp */
627 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
628 {0x10, AC_VERB_SET_CONNECT_SEL, 0x1},
629 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
630 {0x11, AC_VERB_SET_CONNECT_SEL, 0x1},
631 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
632 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
633 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
634 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
635 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
636 /* Record selector: Int mic */
637 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x1},
638 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE,
639 AC_AMP_SET_INPUT|AC_AMP_SET_RIGHT|AC_AMP_SET_LEFT|0x17},
640 /* SPDIF route: PCM */
641 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
642 /* EAPD */
643 {0x10, AC_VERB_SET_EAPD_BTLENABLE, 0x2}, /* default on */
644 { } /* end */
645};
7f29673b
TD
646
647static struct hda_verb cxt5045_hp_sense_init_verbs[] = {
648 /* pin sensing on HP jack */
649 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | CONEXANT_HP_EVENT},
d3091fad 650 { } /* end */
7f29673b
TD
651};
652
653static struct hda_verb cxt5045_mic_sense_init_verbs[] = {
654 /* pin sensing on HP jack */
655 {0x12, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | CONEXANT_MIC_EVENT},
d3091fad 656 { } /* end */
7f29673b
TD
657};
658
c9b443d4
TD
659#ifdef CONFIG_SND_DEBUG
660/* Test configuration for debugging, modelled after the ALC260 test
661 * configuration.
662 */
663static struct hda_input_mux cxt5045_test_capture_source = {
664 .num_items = 5,
665 .items = {
666 { "MIXER", 0x0 },
667 { "MIC1 pin", 0x1 },
668 { "LINE1 pin", 0x2 },
669 { "HP-OUT pin", 0x3 },
670 { "CD pin", 0x4 },
671 },
672};
673
674static struct snd_kcontrol_new cxt5045_test_mixer[] = {
675
676 /* Output controls */
c9b443d4
TD
677 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x10, 0x0, HDA_OUTPUT),
678 HDA_CODEC_MUTE("Speaker Playback Switch", 0x10, 0x0, HDA_OUTPUT),
7f29673b
TD
679 HDA_CODEC_VOLUME("Node 11 Playback Volume", 0x11, 0x0, HDA_OUTPUT),
680 HDA_CODEC_MUTE("Node 11 Playback Switch", 0x11, 0x0, HDA_OUTPUT),
681 HDA_CODEC_VOLUME("Node 12 Playback Volume", 0x12, 0x0, HDA_OUTPUT),
682 HDA_CODEC_MUTE("Node 12 Playback Switch", 0x12, 0x0, HDA_OUTPUT),
c9b443d4
TD
683
684 /* Modes for retasking pin widgets */
685 CXT_PIN_MODE("HP-OUT pin mode", 0x11, CXT_PIN_DIR_INOUT),
686 CXT_PIN_MODE("LINE1 pin mode", 0x12, CXT_PIN_DIR_INOUT),
687
82f30040
TD
688 /* EAPD Switch Control */
689 CXT_EAPD_SWITCH("External Amplifier", 0x10, 0x0),
690
c9b443d4 691 /* Loopback mixer controls */
7f29673b
TD
692
693 HDA_CODEC_VOLUME("Mixer-1 Volume", 0x17, 0x0, HDA_INPUT),
694 HDA_CODEC_MUTE("Mixer-1 Switch", 0x17, 0x0, HDA_INPUT),
695 HDA_CODEC_VOLUME("Mixer-2 Volume", 0x17, 0x1, HDA_INPUT),
696 HDA_CODEC_MUTE("Mixer-2 Switch", 0x17, 0x1, HDA_INPUT),
697 HDA_CODEC_VOLUME("Mixer-3 Volume", 0x17, 0x2, HDA_INPUT),
698 HDA_CODEC_MUTE("Mixer-3 Switch", 0x17, 0x2, HDA_INPUT),
699 HDA_CODEC_VOLUME("Mixer-4 Volume", 0x17, 0x3, HDA_INPUT),
700 HDA_CODEC_MUTE("Mixer-4 Switch", 0x17, 0x3, HDA_INPUT),
701 HDA_CODEC_VOLUME("Mixer-5 Volume", 0x17, 0x4, HDA_INPUT),
702 HDA_CODEC_MUTE("Mixer-5 Switch", 0x17, 0x4, HDA_INPUT),
c9b443d4
TD
703 {
704 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
705 .name = "Input Source",
706 .info = conexant_mux_enum_info,
707 .get = conexant_mux_enum_get,
708 .put = conexant_mux_enum_put,
709 },
fb3409e7
TD
710 /* Audio input controls */
711 HDA_CODEC_VOLUME("Input-1 Volume", 0x1a, 0x0, HDA_INPUT),
712 HDA_CODEC_MUTE("Input-1 Switch", 0x1a, 0x0, HDA_INPUT),
713 HDA_CODEC_VOLUME("Input-2 Volume", 0x1a, 0x1, HDA_INPUT),
714 HDA_CODEC_MUTE("Input-2 Switch", 0x1a, 0x1, HDA_INPUT),
715 HDA_CODEC_VOLUME("Input-3 Volume", 0x1a, 0x2, HDA_INPUT),
716 HDA_CODEC_MUTE("Input-3 Switch", 0x1a, 0x2, HDA_INPUT),
717 HDA_CODEC_VOLUME("Input-4 Volume", 0x1a, 0x3, HDA_INPUT),
718 HDA_CODEC_MUTE("Input-4 Switch", 0x1a, 0x3, HDA_INPUT),
719 HDA_CODEC_VOLUME("Input-5 Volume", 0x1a, 0x4, HDA_INPUT),
720 HDA_CODEC_MUTE("Input-5 Switch", 0x1a, 0x4, HDA_INPUT),
c9b443d4
TD
721 { } /* end */
722};
723
724static struct hda_verb cxt5045_test_init_verbs[] = {
7f29673b
TD
725 /* Set connections */
726 { 0x10, AC_VERB_SET_CONNECT_SEL, 0x0 },
727 { 0x11, AC_VERB_SET_CONNECT_SEL, 0x0 },
728 { 0x12, AC_VERB_SET_CONNECT_SEL, 0x0 },
c9b443d4
TD
729 /* Enable retasking pins as output, initially without power amp */
730 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7f29673b 731 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
c9b443d4
TD
732
733 /* Disable digital (SPDIF) pins initially, but users can enable
734 * them via a mixer switch. In the case of SPDIF-out, this initverb
735 * payload also sets the generation to 0, output to be in "consumer"
736 * PCM format, copyright asserted, no pre-emphasis and no validity
737 * control.
738 */
739 {0x13, AC_VERB_SET_DIGI_CONVERT_1, 0},
740
741 /* Start with output sum widgets muted and their output gains at min */
742 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
743 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
744
745 /* Unmute retasking pin widget output buffers since the default
746 * state appears to be output. As the pin mode is changed by the
747 * user the pin mode control will take care of enabling the pin's
748 * input/output buffers as needed.
749 */
750 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
751 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
752
753 /* Mute capture amp left and right */
754 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
755
756 /* Set ADC connection select to match default mixer setting (mic1
757 * pin)
758 */
759 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
7f29673b 760 {0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
c9b443d4
TD
761
762 /* Mute all inputs to mixer widget (even unconnected ones) */
763 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* Mixer pin */
764 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* Mic1 pin */
765 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* Line pin */
766 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* HP pin */
767 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
768
769 { }
770};
771#endif
772
773
774/* initialize jack-sensing, too */
775static int cxt5045_init(struct hda_codec *codec)
776{
777 conexant_init(codec);
778 cxt5045_hp_automute(codec);
779 return 0;
780}
781
782
783enum {
7f29673b
TD
784 CXT5045_LAPTOP, /* Laptops w/ EAPD support */
785 CXT5045_FUJITSU, /* Laptops w/ EAPD support */
5218c892 786 CXT5045_BENQ,
c9b443d4
TD
787#ifdef CONFIG_SND_DEBUG
788 CXT5045_TEST,
789#endif
f5fcc13c 790 CXT5045_MODELS
c9b443d4
TD
791};
792
f5fcc13c
TI
793static const char *cxt5045_models[CXT5045_MODELS] = {
794 [CXT5045_LAPTOP] = "laptop",
7f29673b 795 [CXT5045_FUJITSU] = "fujitsu",
5218c892 796 [CXT5045_BENQ] = "benq",
c9b443d4 797#ifdef CONFIG_SND_DEBUG
f5fcc13c 798 [CXT5045_TEST] = "test",
c9b443d4 799#endif
f5fcc13c
TI
800};
801
802static struct snd_pci_quirk cxt5045_cfg_tbl[] = {
4d69d756
TD
803 SND_PCI_QUIRK(0x103c, 0x30b2, "HP DV Series", CXT5045_LAPTOP),
804 SND_PCI_QUIRK(0x103c, 0x30b5, "HP DV2120", CXT5045_LAPTOP),
ac3e3741
TI
805 SND_PCI_QUIRK(0x103c, 0x30b7, "HP DV6000Z", CXT5045_LAPTOP),
806 SND_PCI_QUIRK(0x103c, 0x30bb, "HP DV8000", CXT5045_LAPTOP),
4d69d756 807 SND_PCI_QUIRK(0x103c, 0x30cd, "HP DV Series", CXT5045_LAPTOP),
38f8b397 808 SND_PCI_QUIRK(0x103c, 0x30d5, "HP 530", CXT5045_LAPTOP),
8481da5a 809 SND_PCI_QUIRK(0x103c, 0x30d9, "HP Spartan", CXT5045_LAPTOP),
5218c892 810 SND_PCI_QUIRK(0x152d, 0x0753, "Benq R55E", CXT5045_BENQ),
7f29673b 811 SND_PCI_QUIRK(0x1734, 0x10ad, "Fujitsu Si1520", CXT5045_FUJITSU),
f8f794ab 812 SND_PCI_QUIRK(0x1734, 0x10cb, "Fujitsu Si3515", CXT5045_LAPTOP),
61bae093 813 SND_PCI_QUIRK(0x1734, 0x110e, "Fujitsu V5505", CXT5045_LAPTOP),
7f29673b 814 SND_PCI_QUIRK(0x8086, 0x2111, "Conexant Reference board", CXT5045_LAPTOP),
c9b443d4
TD
815 {}
816};
817
818static int patch_cxt5045(struct hda_codec *codec)
819{
820 struct conexant_spec *spec;
821 int board_config;
822
823 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
824 if (!spec)
825 return -ENOMEM;
826 mutex_init(&spec->amp_mutex);
827 codec->spec = spec;
828
829 spec->multiout.max_channels = 2;
830 spec->multiout.num_dacs = ARRAY_SIZE(cxt5045_dac_nids);
831 spec->multiout.dac_nids = cxt5045_dac_nids;
832 spec->multiout.dig_out_nid = CXT5045_SPDIF_OUT;
833 spec->num_adc_nids = 1;
834 spec->adc_nids = cxt5045_adc_nids;
835 spec->capsrc_nids = cxt5045_capsrc_nids;
836 spec->input_mux = &cxt5045_capture_source;
837 spec->num_mixers = 1;
838 spec->mixers[0] = cxt5045_mixers;
839 spec->num_init_verbs = 1;
840 spec->init_verbs[0] = cxt5045_init_verbs;
841 spec->spdif_route = 0;
5cd57529
TD
842 spec->num_channel_mode = ARRAY_SIZE(cxt5045_modes),
843 spec->channel_mode = cxt5045_modes,
844
c9b443d4
TD
845
846 codec->patch_ops = conexant_patch_ops;
c9b443d4 847
f5fcc13c
TI
848 board_config = snd_hda_check_board_config(codec, CXT5045_MODELS,
849 cxt5045_models,
850 cxt5045_cfg_tbl);
c9b443d4
TD
851 switch (board_config) {
852 case CXT5045_LAPTOP:
7f29673b
TD
853 codec->patch_ops.unsol_event = cxt5045_hp_unsol_event;
854 spec->input_mux = &cxt5045_capture_source;
855 spec->num_init_verbs = 2;
856 spec->init_verbs[1] = cxt5045_hp_sense_init_verbs;
857 spec->mixers[0] = cxt5045_mixers;
858 codec->patch_ops.init = cxt5045_init;
859 break;
860 case CXT5045_FUJITSU:
c9b443d4
TD
861 spec->input_mux = &cxt5045_capture_source;
862 spec->num_init_verbs = 2;
7f29673b 863 spec->init_verbs[1] = cxt5045_mic_sense_init_verbs;
c9b443d4
TD
864 spec->mixers[0] = cxt5045_mixers;
865 codec->patch_ops.init = cxt5045_init;
866 break;
5218c892
JZ
867 case CXT5045_BENQ:
868 codec->patch_ops.unsol_event = cxt5045_hp_unsol_event;
869 spec->input_mux = &cxt5045_capture_source_benq;
870 spec->num_init_verbs = 1;
871 spec->init_verbs[0] = cxt5045_benq_init_verbs;
872 spec->mixers[0] = cxt5045_mixers;
873 spec->mixers[1] = cxt5045_benq_mixers;
874 spec->num_mixers = 2;
875 codec->patch_ops.init = cxt5045_init;
876 break;
c9b443d4
TD
877#ifdef CONFIG_SND_DEBUG
878 case CXT5045_TEST:
879 spec->input_mux = &cxt5045_test_capture_source;
880 spec->mixers[0] = cxt5045_test_mixer;
881 spec->init_verbs[0] = cxt5045_test_init_verbs;
882#endif
883 }
48ecb7e8
TI
884
885 /*
886 * Fix max PCM level to 0 dB
887 * (originall it has 0x2b steps with 0dB offset 0x14)
888 */
889 snd_hda_override_amp_caps(codec, 0x17, HDA_INPUT,
890 (0x14 << AC_AMPCAP_OFFSET_SHIFT) |
891 (0x14 << AC_AMPCAP_NUM_STEPS_SHIFT) |
892 (0x05 << AC_AMPCAP_STEP_SIZE_SHIFT) |
893 (1 << AC_AMPCAP_MUTE_SHIFT));
894
c9b443d4
TD
895 return 0;
896}
897
898
899/* Conexant 5047 specific */
82f30040 900#define CXT5047_SPDIF_OUT 0x11
c9b443d4 901
82f30040 902static hda_nid_t cxt5047_dac_nids[2] = { 0x10, 0x1c };
c9b443d4
TD
903static hda_nid_t cxt5047_adc_nids[1] = { 0x12 };
904static hda_nid_t cxt5047_capsrc_nids[1] = { 0x1a };
c9b443d4 905
5cd57529
TD
906static struct hda_channel_mode cxt5047_modes[1] = {
907 { 2, NULL },
908};
c9b443d4
TD
909
910static struct hda_input_mux cxt5047_capture_source = {
7f29673b 911 .num_items = 1,
c9b443d4 912 .items = {
7f29673b 913 { "Mic", 0x2 },
c9b443d4
TD
914 }
915};
916
917static struct hda_input_mux cxt5047_hp_capture_source = {
918 .num_items = 1,
919 .items = {
82f30040
TD
920 { "ExtMic", 0x2 },
921 }
922};
923
924static struct hda_input_mux cxt5047_toshiba_capture_source = {
925 .num_items = 2,
926 .items = {
927 { "ExtMic", 0x2 },
928 { "Line-In", 0x1 },
c9b443d4
TD
929 }
930};
931
932/* turn on/off EAPD (+ mute HP) as a master switch */
933static int cxt5047_hp_master_sw_put(struct snd_kcontrol *kcontrol,
934 struct snd_ctl_elem_value *ucontrol)
935{
936 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
937 struct conexant_spec *spec = codec->spec;
82f30040 938 unsigned int bits;
c9b443d4 939
82f30040 940 if (!cxt_eapd_put(kcontrol, ucontrol))
c9b443d4
TD
941 return 0;
942
82f30040
TD
943 /* toggle internal speakers mute depending of presence of
944 * the headphone jack
945 */
47fd830a
TI
946 bits = (!spec->hp_present && spec->cur_eapd) ? 0 : HDA_AMP_MUTE;
947 snd_hda_codec_amp_stereo(codec, 0x1d, HDA_OUTPUT, 0,
948 HDA_AMP_MUTE, bits);
949 bits = spec->cur_eapd ? 0 : HDA_AMP_MUTE;
950 snd_hda_codec_amp_stereo(codec, 0x13, HDA_OUTPUT, 0,
951 HDA_AMP_MUTE, bits);
c9b443d4
TD
952 return 1;
953}
954
82f30040 955/* bind volumes of both NID 0x13 (Headphones) and 0x1d (Speakers) */
cca3b371
TI
956static struct hda_bind_ctls cxt5047_bind_master_vol = {
957 .ops = &snd_hda_bind_vol,
958 .values = {
959 HDA_COMPOSE_AMP_VAL(0x13, 3, 0, HDA_OUTPUT),
960 HDA_COMPOSE_AMP_VAL(0x1d, 3, 0, HDA_OUTPUT),
961 0
962 },
963};
c9b443d4
TD
964
965/* mute internal speaker if HP is plugged */
966static void cxt5047_hp_automute(struct hda_codec *codec)
967{
82f30040 968 struct conexant_spec *spec = codec->spec;
dd87da1c 969 unsigned int bits;
c9b443d4 970
82f30040 971 spec->hp_present = snd_hda_codec_read(codec, 0x13, 0,
c9b443d4 972 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
dd87da1c 973
47fd830a
TI
974 bits = (spec->hp_present || !spec->cur_eapd) ? HDA_AMP_MUTE : 0;
975 snd_hda_codec_amp_stereo(codec, 0x1d, HDA_OUTPUT, 0,
976 HDA_AMP_MUTE, bits);
82f30040 977 /* Mute/Unmute PCM 2 for good measure - some systems need this */
47fd830a
TI
978 snd_hda_codec_amp_stereo(codec, 0x1c, HDA_OUTPUT, 0,
979 HDA_AMP_MUTE, bits);
c9b443d4
TD
980}
981
fb3409e7
TD
982/* mute internal speaker if HP is plugged */
983static void cxt5047_hp2_automute(struct hda_codec *codec)
984{
985 struct conexant_spec *spec = codec->spec;
986 unsigned int bits;
987
988 spec->hp_present = snd_hda_codec_read(codec, 0x13, 0,
989 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
990
47fd830a
TI
991 bits = spec->hp_present ? HDA_AMP_MUTE : 0;
992 snd_hda_codec_amp_stereo(codec, 0x1d, HDA_OUTPUT, 0,
993 HDA_AMP_MUTE, bits);
fb3409e7 994 /* Mute/Unmute PCM 2 for good measure - some systems need this */
47fd830a
TI
995 snd_hda_codec_amp_stereo(codec, 0x1c, HDA_OUTPUT, 0,
996 HDA_AMP_MUTE, bits);
fb3409e7
TD
997}
998
c9b443d4
TD
999/* toggle input of built-in and mic jack appropriately */
1000static void cxt5047_hp_automic(struct hda_codec *codec)
1001{
1002 static struct hda_verb mic_jack_on[] = {
1003 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080},
1004 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
1005 {}
1006 };
1007 static struct hda_verb mic_jack_off[] = {
1008 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080},
1009 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
1010 {}
1011 };
1012 unsigned int present;
1013
7f29673b 1014 present = snd_hda_codec_read(codec, 0x15, 0,
c9b443d4
TD
1015 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1016 if (present)
1017 snd_hda_sequence_write(codec, mic_jack_on);
1018 else
1019 snd_hda_sequence_write(codec, mic_jack_off);
1020}
1021
1022/* unsolicited event for HP jack sensing */
1023static void cxt5047_hp_unsol_event(struct hda_codec *codec,
1024 unsigned int res)
1025{
1026 res >>= 26;
1027 switch (res) {
1028 case CONEXANT_HP_EVENT:
1029 cxt5047_hp_automute(codec);
1030 break;
1031 case CONEXANT_MIC_EVENT:
1032 cxt5047_hp_automic(codec);
1033 break;
1034 }
1035}
1036
fb3409e7
TD
1037/* unsolicited event for HP jack sensing - non-EAPD systems */
1038static void cxt5047_hp2_unsol_event(struct hda_codec *codec,
1039 unsigned int res)
1040{
1041 res >>= 26;
1042 switch (res) {
1043 case CONEXANT_HP_EVENT:
1044 cxt5047_hp2_automute(codec);
1045 break;
1046 case CONEXANT_MIC_EVENT:
1047 cxt5047_hp_automic(codec);
1048 break;
1049 }
1050}
1051
c9b443d4 1052static struct snd_kcontrol_new cxt5047_mixers[] = {
c9b443d4
TD
1053 HDA_CODEC_VOLUME("Mic Bypass Capture Volume", 0x19, 0x02, HDA_INPUT),
1054 HDA_CODEC_MUTE("Mic Bypass Capture Switch", 0x19, 0x02, HDA_INPUT),
7f29673b
TD
1055 HDA_CODEC_VOLUME("Mic Gain Volume", 0x1a, 0x0, HDA_OUTPUT),
1056 HDA_CODEC_MUTE("Mic Gain Switch", 0x1a, 0x0, HDA_OUTPUT),
c9b443d4
TD
1057 HDA_CODEC_VOLUME("Capture Volume", 0x12, 0x03, HDA_INPUT),
1058 HDA_CODEC_MUTE("Capture Switch", 0x12, 0x03, HDA_INPUT),
1059 HDA_CODEC_VOLUME("PCM Volume", 0x10, 0x00, HDA_OUTPUT),
1060 HDA_CODEC_MUTE("PCM Switch", 0x10, 0x00, HDA_OUTPUT),
82f30040
TD
1061 HDA_CODEC_VOLUME("PCM-2 Volume", 0x1c, 0x00, HDA_OUTPUT),
1062 HDA_CODEC_MUTE("PCM-2 Switch", 0x1c, 0x00, HDA_OUTPUT),
b7589ceb
TD
1063 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x1d, 0x00, HDA_OUTPUT),
1064 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1d, 0x00, HDA_OUTPUT),
1065 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x13, 0x00, HDA_OUTPUT),
1066 HDA_CODEC_MUTE("Headphone Playback Switch", 0x13, 0x00, HDA_OUTPUT),
82f30040
TD
1067
1068 {}
1069};
1070
1071static struct snd_kcontrol_new cxt5047_toshiba_mixers[] = {
1072 {
1073 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1074 .name = "Capture Source",
1075 .info = conexant_mux_enum_info,
1076 .get = conexant_mux_enum_get,
1077 .put = conexant_mux_enum_put
1078 },
1079 HDA_CODEC_VOLUME("Mic Bypass Capture Volume", 0x19, 0x02, HDA_INPUT),
1080 HDA_CODEC_MUTE("Mic Bypass Capture Switch", 0x19, 0x02, HDA_INPUT),
1081 HDA_CODEC_VOLUME("Capture Volume", 0x12, 0x03, HDA_INPUT),
1082 HDA_CODEC_MUTE("Capture Switch", 0x12, 0x03, HDA_INPUT),
1083 HDA_CODEC_VOLUME("PCM Volume", 0x10, 0x00, HDA_OUTPUT),
1084 HDA_CODEC_MUTE("PCM Switch", 0x10, 0x00, HDA_OUTPUT),
cca3b371 1085 HDA_BIND_VOL("Master Playback Volume", &cxt5047_bind_master_vol),
82f30040
TD
1086 {
1087 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1088 .name = "Master Playback Switch",
1089 .info = cxt_eapd_info,
1090 .get = cxt_eapd_get,
c9b443d4
TD
1091 .put = cxt5047_hp_master_sw_put,
1092 .private_value = 0x13,
1093 },
1094
1095 {}
1096};
1097
1098static struct snd_kcontrol_new cxt5047_hp_mixers[] = {
1099 {
1100 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1101 .name = "Capture Source",
1102 .info = conexant_mux_enum_info,
1103 .get = conexant_mux_enum_get,
1104 .put = conexant_mux_enum_put
1105 },
1106 HDA_CODEC_VOLUME("Mic Bypass Capture Volume", 0x19, 0x02, HDA_INPUT),
1107 HDA_CODEC_MUTE("Mic Bypass Capture Switch", 0x19,0x02,HDA_INPUT),
1108 HDA_CODEC_VOLUME("Capture Volume", 0x12, 0x03, HDA_INPUT),
1109 HDA_CODEC_MUTE("Capture Switch", 0x12, 0x03, HDA_INPUT),
1110 HDA_CODEC_VOLUME("PCM Volume", 0x10, 0x00, HDA_OUTPUT),
1111 HDA_CODEC_MUTE("PCM Switch", 0x10, 0x00, HDA_OUTPUT),
1112 HDA_CODEC_VOLUME("Master Playback Volume", 0x13, 0x00, HDA_OUTPUT),
1113 {
1114 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1115 .name = "Master Playback Switch",
82f30040
TD
1116 .info = cxt_eapd_info,
1117 .get = cxt_eapd_get,
c9b443d4
TD
1118 .put = cxt5047_hp_master_sw_put,
1119 .private_value = 0x13,
1120 },
1121 { } /* end */
1122};
1123
1124static struct hda_verb cxt5047_init_verbs[] = {
1125 /* Line in, Mic, Built-in Mic */
1126 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1127 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN|AC_PINCTL_VREF_50 },
1128 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN|AC_PINCTL_VREF_50 },
7f29673b 1129 /* HP, Speaker */
b7589ceb
TD
1130 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
1131 {0x13, AC_VERB_SET_CONNECT_SEL,0x1},
82f30040 1132 {0x1d, AC_VERB_SET_CONNECT_SEL,0x0},
7f29673b 1133 /* Record selector: Mic */
c9b443d4
TD
1134 {0x12, AC_VERB_SET_CONNECT_SEL,0x03},
1135 {0x19, AC_VERB_SET_AMP_GAIN_MUTE,
1136 AC_AMP_SET_INPUT|AC_AMP_SET_RIGHT|AC_AMP_SET_LEFT|0x17},
7f29673b
TD
1137 {0x1A, AC_VERB_SET_CONNECT_SEL,0x02},
1138 {0x1A, AC_VERB_SET_AMP_GAIN_MUTE,
1139 AC_AMP_SET_OUTPUT|AC_AMP_SET_RIGHT|AC_AMP_SET_LEFT|0x00},
1140 {0x1A, AC_VERB_SET_AMP_GAIN_MUTE,
1141 AC_AMP_SET_OUTPUT|AC_AMP_SET_RIGHT|AC_AMP_SET_LEFT|0x03},
c9b443d4
TD
1142 /* SPDIF route: PCM */
1143 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x0 },
82f30040
TD
1144 /* Enable unsolicited events */
1145 {0x13, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | CONEXANT_HP_EVENT},
1146 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | CONEXANT_MIC_EVENT},
c9b443d4
TD
1147 { } /* end */
1148};
1149
1150/* configuration for Toshiba Laptops */
1151static struct hda_verb cxt5047_toshiba_init_verbs[] = {
1152 {0x13, AC_VERB_SET_EAPD_BTLENABLE, 0x0 }, /* default on */
1153 /* pin sensing on HP and Mic jacks */
1154 {0x13, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | CONEXANT_HP_EVENT},
1155 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | CONEXANT_MIC_EVENT},
82f30040
TD
1156 /* Speaker routing */
1157 {0x1d, AC_VERB_SET_CONNECT_SEL,0x1},
c9b443d4
TD
1158 {}
1159};
1160
1161/* configuration for HP Laptops */
1162static struct hda_verb cxt5047_hp_init_verbs[] = {
82f30040 1163 /* pin sensing on HP jack */
c9b443d4 1164 {0x13, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | CONEXANT_HP_EVENT},
82f30040
TD
1165 /* Record selector: Ext Mic */
1166 {0x12, AC_VERB_SET_CONNECT_SEL,0x03},
82f30040
TD
1167 {0x19, AC_VERB_SET_AMP_GAIN_MUTE,
1168 AC_AMP_SET_INPUT|AC_AMP_SET_RIGHT|AC_AMP_SET_LEFT|0x17},
1169 /* Speaker routing */
1170 {0x1d, AC_VERB_SET_CONNECT_SEL,0x1},
c9b443d4
TD
1171 {}
1172};
1173
1174/* Test configuration for debugging, modelled after the ALC260 test
1175 * configuration.
1176 */
1177#ifdef CONFIG_SND_DEBUG
1178static struct hda_input_mux cxt5047_test_capture_source = {
82f30040 1179 .num_items = 4,
c9b443d4 1180 .items = {
82f30040
TD
1181 { "LINE1 pin", 0x0 },
1182 { "MIC1 pin", 0x1 },
1183 { "MIC2 pin", 0x2 },
1184 { "CD pin", 0x3 },
c9b443d4
TD
1185 },
1186};
1187
1188static struct snd_kcontrol_new cxt5047_test_mixer[] = {
1189
1190 /* Output only controls */
82f30040
TD
1191 HDA_CODEC_VOLUME("OutAmp-1 Volume", 0x10, 0x0, HDA_OUTPUT),
1192 HDA_CODEC_MUTE("OutAmp-1 Switch", 0x10,0x0, HDA_OUTPUT),
1193 HDA_CODEC_VOLUME("OutAmp-2 Volume", 0x1c, 0x0, HDA_OUTPUT),
1194 HDA_CODEC_MUTE("OutAmp-2 Switch", 0x1c, 0x0, HDA_OUTPUT),
c9b443d4
TD
1195 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x1d, 0x0, HDA_OUTPUT),
1196 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1d, 0x0, HDA_OUTPUT),
1197 HDA_CODEC_VOLUME("HeadPhone Playback Volume", 0x13, 0x0, HDA_OUTPUT),
1198 HDA_CODEC_MUTE("HeadPhone Playback Switch", 0x13, 0x0, HDA_OUTPUT),
82f30040
TD
1199 HDA_CODEC_VOLUME("Line1-Out Playback Volume", 0x14, 0x0, HDA_OUTPUT),
1200 HDA_CODEC_MUTE("Line1-Out Playback Switch", 0x14, 0x0, HDA_OUTPUT),
1201 HDA_CODEC_VOLUME("Line2-Out Playback Volume", 0x15, 0x0, HDA_OUTPUT),
1202 HDA_CODEC_MUTE("Line2-Out Playback Switch", 0x15, 0x0, HDA_OUTPUT),
c9b443d4
TD
1203
1204 /* Modes for retasking pin widgets */
1205 CXT_PIN_MODE("LINE1 pin mode", 0x14, CXT_PIN_DIR_INOUT),
1206 CXT_PIN_MODE("MIC1 pin mode", 0x15, CXT_PIN_DIR_INOUT),
1207
82f30040
TD
1208 /* EAPD Switch Control */
1209 CXT_EAPD_SWITCH("External Amplifier", 0x13, 0x0),
c9b443d4 1210
82f30040
TD
1211 /* Loopback mixer controls */
1212 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x12, 0x01, HDA_INPUT),
1213 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x12, 0x01, HDA_INPUT),
1214 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x12, 0x02, HDA_INPUT),
1215 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x12, 0x02, HDA_INPUT),
1216 HDA_CODEC_VOLUME("LINE Playback Volume", 0x12, 0x0, HDA_INPUT),
1217 HDA_CODEC_MUTE("LINE Playback Switch", 0x12, 0x0, HDA_INPUT),
1218 HDA_CODEC_VOLUME("CD Playback Volume", 0x12, 0x04, HDA_INPUT),
1219 HDA_CODEC_MUTE("CD Playback Switch", 0x12, 0x04, HDA_INPUT),
1220
1221 HDA_CODEC_VOLUME("Capture-1 Volume", 0x19, 0x0, HDA_INPUT),
1222 HDA_CODEC_MUTE("Capture-1 Switch", 0x19, 0x0, HDA_INPUT),
1223 HDA_CODEC_VOLUME("Capture-2 Volume", 0x19, 0x1, HDA_INPUT),
1224 HDA_CODEC_MUTE("Capture-2 Switch", 0x19, 0x1, HDA_INPUT),
1225 HDA_CODEC_VOLUME("Capture-3 Volume", 0x19, 0x2, HDA_INPUT),
1226 HDA_CODEC_MUTE("Capture-3 Switch", 0x19, 0x2, HDA_INPUT),
1227 HDA_CODEC_VOLUME("Capture-4 Volume", 0x19, 0x3, HDA_INPUT),
1228 HDA_CODEC_MUTE("Capture-4 Switch", 0x19, 0x3, HDA_INPUT),
c9b443d4
TD
1229 {
1230 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1231 .name = "Input Source",
1232 .info = conexant_mux_enum_info,
1233 .get = conexant_mux_enum_get,
1234 .put = conexant_mux_enum_put,
1235 },
c9b443d4
TD
1236 { } /* end */
1237};
1238
1239static struct hda_verb cxt5047_test_init_verbs[] = {
c9b443d4
TD
1240 /* Enable retasking pins as output, initially without power amp */
1241 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1242 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1243 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1244
1245 /* Disable digital (SPDIF) pins initially, but users can enable
1246 * them via a mixer switch. In the case of SPDIF-out, this initverb
1247 * payload also sets the generation to 0, output to be in "consumer"
1248 * PCM format, copyright asserted, no pre-emphasis and no validity
1249 * control.
1250 */
1251 {0x18, AC_VERB_SET_DIGI_CONVERT_1, 0},
1252
1253 /* Ensure mic1, mic2, line1 pin widgets take input from the
1254 * OUT1 sum bus when acting as an output.
1255 */
1256 {0x1a, AC_VERB_SET_CONNECT_SEL, 0},
1257 {0x1b, AC_VERB_SET_CONNECT_SEL, 0},
1258
1259 /* Start with output sum widgets muted and their output gains at min */
1260 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1261 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1262
1263 /* Unmute retasking pin widget output buffers since the default
1264 * state appears to be output. As the pin mode is changed by the
1265 * user the pin mode control will take care of enabling the pin's
1266 * input/output buffers as needed.
1267 */
1268 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1269 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1270 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1271
1272 /* Mute capture amp left and right */
1273 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1274
1275 /* Set ADC connection select to match default mixer setting (mic1
1276 * pin)
1277 */
1278 {0x12, AC_VERB_SET_CONNECT_SEL, 0x00},
1279
1280 /* Mute all inputs to mixer widget (even unconnected ones) */
1281 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
1282 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
1283 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
1284 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
1285 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
1286 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
1287 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
1288 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
1289
1290 { }
1291};
1292#endif
1293
1294
1295/* initialize jack-sensing, too */
1296static int cxt5047_hp_init(struct hda_codec *codec)
1297{
1298 conexant_init(codec);
1299 cxt5047_hp_automute(codec);
c9b443d4
TD
1300 return 0;
1301}
1302
1303
1304enum {
f5fcc13c
TI
1305 CXT5047_LAPTOP, /* Laptops w/o EAPD support */
1306 CXT5047_LAPTOP_HP, /* Some HP laptops */
1307 CXT5047_LAPTOP_EAPD, /* Laptops with EAPD support */
c9b443d4
TD
1308#ifdef CONFIG_SND_DEBUG
1309 CXT5047_TEST,
1310#endif
f5fcc13c 1311 CXT5047_MODELS
c9b443d4
TD
1312};
1313
f5fcc13c
TI
1314static const char *cxt5047_models[CXT5047_MODELS] = {
1315 [CXT5047_LAPTOP] = "laptop",
1316 [CXT5047_LAPTOP_HP] = "laptop-hp",
1317 [CXT5047_LAPTOP_EAPD] = "laptop-eapd",
c9b443d4 1318#ifdef CONFIG_SND_DEBUG
f5fcc13c 1319 [CXT5047_TEST] = "test",
c9b443d4 1320#endif
f5fcc13c
TI
1321};
1322
1323static struct snd_pci_quirk cxt5047_cfg_tbl[] = {
1324 SND_PCI_QUIRK(0x103c, 0x30a0, "HP DV1000", CXT5047_LAPTOP),
ac3e3741 1325 SND_PCI_QUIRK(0x103c, 0x30a5, "HP DV5200T/DV8000T", CXT5047_LAPTOP_HP),
f5fcc13c 1326 SND_PCI_QUIRK(0x103c, 0x30b2, "HP DV2000T/DV3000T", CXT5047_LAPTOP),
82f30040 1327 SND_PCI_QUIRK(0x103c, 0x30b5, "HP DV2000Z", CXT5047_LAPTOP),
f5fcc13c 1328 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba P100", CXT5047_LAPTOP_EAPD),
c9b443d4
TD
1329 {}
1330};
1331
1332static int patch_cxt5047(struct hda_codec *codec)
1333{
1334 struct conexant_spec *spec;
1335 int board_config;
1336
1337 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
1338 if (!spec)
1339 return -ENOMEM;
1340 mutex_init(&spec->amp_mutex);
1341 codec->spec = spec;
1342
1343 spec->multiout.max_channels = 2;
1344 spec->multiout.num_dacs = ARRAY_SIZE(cxt5047_dac_nids);
1345 spec->multiout.dac_nids = cxt5047_dac_nids;
1346 spec->multiout.dig_out_nid = CXT5047_SPDIF_OUT;
1347 spec->num_adc_nids = 1;
1348 spec->adc_nids = cxt5047_adc_nids;
1349 spec->capsrc_nids = cxt5047_capsrc_nids;
1350 spec->input_mux = &cxt5047_capture_source;
1351 spec->num_mixers = 1;
1352 spec->mixers[0] = cxt5047_mixers;
1353 spec->num_init_verbs = 1;
1354 spec->init_verbs[0] = cxt5047_init_verbs;
1355 spec->spdif_route = 0;
5cd57529
TD
1356 spec->num_channel_mode = ARRAY_SIZE(cxt5047_modes),
1357 spec->channel_mode = cxt5047_modes,
c9b443d4
TD
1358
1359 codec->patch_ops = conexant_patch_ops;
c9b443d4 1360
f5fcc13c
TI
1361 board_config = snd_hda_check_board_config(codec, CXT5047_MODELS,
1362 cxt5047_models,
1363 cxt5047_cfg_tbl);
c9b443d4
TD
1364 switch (board_config) {
1365 case CXT5047_LAPTOP:
fb3409e7 1366 codec->patch_ops.unsol_event = cxt5047_hp2_unsol_event;
c9b443d4
TD
1367 break;
1368 case CXT5047_LAPTOP_HP:
1369 spec->input_mux = &cxt5047_hp_capture_source;
1370 spec->num_init_verbs = 2;
1371 spec->init_verbs[1] = cxt5047_hp_init_verbs;
1372 spec->mixers[0] = cxt5047_hp_mixers;
fb3409e7 1373 codec->patch_ops.unsol_event = cxt5047_hp_unsol_event;
c9b443d4
TD
1374 codec->patch_ops.init = cxt5047_hp_init;
1375 break;
1376 case CXT5047_LAPTOP_EAPD:
82f30040 1377 spec->input_mux = &cxt5047_toshiba_capture_source;
c9b443d4
TD
1378 spec->num_init_verbs = 2;
1379 spec->init_verbs[1] = cxt5047_toshiba_init_verbs;
82f30040 1380 spec->mixers[0] = cxt5047_toshiba_mixers;
fb3409e7 1381 codec->patch_ops.unsol_event = cxt5047_hp_unsol_event;
c9b443d4
TD
1382 break;
1383#ifdef CONFIG_SND_DEBUG
1384 case CXT5047_TEST:
1385 spec->input_mux = &cxt5047_test_capture_source;
1386 spec->mixers[0] = cxt5047_test_mixer;
1387 spec->init_verbs[0] = cxt5047_test_init_verbs;
fb3409e7 1388 codec->patch_ops.unsol_event = cxt5047_hp_unsol_event;
c9b443d4
TD
1389#endif
1390 }
1391 return 0;
1392}
1393
1394struct hda_codec_preset snd_hda_preset_conexant[] = {
82f30040
TD
1395 { .id = 0x14f15045, .name = "CX20549 (Venice)",
1396 .patch = patch_cxt5045 },
1397 { .id = 0x14f15047, .name = "CX20551 (Waikiki)",
1398 .patch = patch_cxt5047 },
c9b443d4
TD
1399 {} /* terminator */
1400};