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