tangled
alpha
login
or
join now
tjh.dev
/
kernel
1
fork
atom
Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
1
fork
atom
overview
issues
pulls
pipelines
Merge branch 'topic/hda' into for-linus
Takashi Iwai
15 years ago
f686c74c
7ec298df
+4106
-3275
15 changed files
expand all
collapse all
unified
split
Documentation
sound
alsa
HD-Audio-Models.txt
sound
pci
hda
hda_codec.c
hda_codec.h
hda_intel.c
hda_local.h
patch_analog.c
patch_ca0110.c
patch_cirrus.c
patch_cmedia.c
patch_conexant.c
patch_hdmi.c
patch_realtek.c
patch_si3054.c
patch_sigmatel.c
patch_via.c
+1
-1
Documentation/sound/alsa/HD-Audio-Models.txt
reviewed
···
94
94
3stack-dig 3-stack (2-channel) with SPDIF
95
95
3stack-6ch 3-stack (6-channel)
96
96
3stack-6ch-dig 3-stack (6-channel) with SPDIF
97
97
-
6stack-dig 6-stack with SPDIF
97
97
+
5stack-dig 5-stack with SPDIF
98
98
lenovo-101e Lenovo laptop
99
99
eeepc-p701 ASUS Eeepc P701
100
100
eeepc-ep20 ASUS Eeepc EP20
+84
-13
sound/pci/hda/hda_codec.c
reviewed
···
307
307
}
308
308
EXPORT_SYMBOL_HDA(snd_hda_get_sub_nodes);
309
309
310
310
+
static int _hda_get_connections(struct hda_codec *codec, hda_nid_t nid,
311
311
+
hda_nid_t *conn_list, int max_conns);
312
312
+
static bool add_conn_list(struct snd_array *array, hda_nid_t nid);
313
313
+
static int copy_conn_list(hda_nid_t nid, hda_nid_t *dst, int max_dst,
314
314
+
hda_nid_t *src, int len);
315
315
+
310
316
/**
311
317
* snd_hda_get_connections - get connection list
312
318
* @codec: the HDA codec
···
326
320
* Returns the number of connections, or a negative error code.
327
321
*/
328
322
int snd_hda_get_connections(struct hda_codec *codec, hda_nid_t nid,
329
329
-
hda_nid_t *conn_list, int max_conns)
323
323
+
hda_nid_t *conn_list, int max_conns)
324
324
+
{
325
325
+
struct snd_array *array = &codec->conn_lists;
326
326
+
int i, len, old_used;
327
327
+
hda_nid_t list[HDA_MAX_CONNECTIONS];
328
328
+
329
329
+
/* look up the cached results */
330
330
+
for (i = 0; i < array->used; ) {
331
331
+
hda_nid_t *p = snd_array_elem(array, i);
332
332
+
len = p[1];
333
333
+
if (nid == *p)
334
334
+
return copy_conn_list(nid, conn_list, max_conns,
335
335
+
p + 2, len);
336
336
+
i += len + 2;
337
337
+
}
338
338
+
339
339
+
len = _hda_get_connections(codec, nid, list, HDA_MAX_CONNECTIONS);
340
340
+
if (len < 0)
341
341
+
return len;
342
342
+
343
343
+
/* add to the cache */
344
344
+
old_used = array->used;
345
345
+
if (!add_conn_list(array, nid) || !add_conn_list(array, len))
346
346
+
goto error_add;
347
347
+
for (i = 0; i < len; i++)
348
348
+
if (!add_conn_list(array, list[i]))
349
349
+
goto error_add;
350
350
+
351
351
+
return copy_conn_list(nid, conn_list, max_conns, list, len);
352
352
+
353
353
+
error_add:
354
354
+
array->used = old_used;
355
355
+
return -ENOMEM;
356
356
+
}
357
357
+
EXPORT_SYMBOL_HDA(snd_hda_get_connections);
358
358
+
359
359
+
static int _hda_get_connections(struct hda_codec *codec, hda_nid_t nid,
360
360
+
hda_nid_t *conn_list, int max_conns)
330
361
{
331
362
unsigned int parm;
332
363
int i, conn_len, conns;
···
460
417
}
461
418
return conns;
462
419
}
463
463
-
EXPORT_SYMBOL_HDA(snd_hda_get_connections);
464
420
421
421
+
static bool add_conn_list(struct snd_array *array, hda_nid_t nid)
422
422
+
{
423
423
+
hda_nid_t *p = snd_array_new(array);
424
424
+
if (!p)
425
425
+
return false;
426
426
+
*p = nid;
427
427
+
return true;
428
428
+
}
429
429
+
430
430
+
static int copy_conn_list(hda_nid_t nid, hda_nid_t *dst, int max_dst,
431
431
+
hda_nid_t *src, int len)
432
432
+
{
433
433
+
if (len > max_dst) {
434
434
+
snd_printk(KERN_ERR "hda_codec: "
435
435
+
"Too many connections %d for NID 0x%x\n",
436
436
+
len, nid);
437
437
+
return -EINVAL;
438
438
+
}
439
439
+
memcpy(dst, src, len * sizeof(hda_nid_t));
440
440
+
return len;
441
441
+
}
465
442
466
443
/**
467
444
* snd_hda_queue_unsol_event - add an unsolicited event to queue
···
1082
1019
list_del(&codec->list);
1083
1020
snd_array_free(&codec->mixers);
1084
1021
snd_array_free(&codec->nids);
1022
1022
+
snd_array_free(&codec->conn_lists);
1085
1023
codec->bus->caddr_tbl[codec->addr] = NULL;
1086
1024
if (codec->patch_ops.free)
1087
1025
codec->patch_ops.free(codec);
···
1143
1079
snd_array_init(&codec->init_pins, sizeof(struct hda_pincfg), 16);
1144
1080
snd_array_init(&codec->driver_pins, sizeof(struct hda_pincfg), 16);
1145
1081
snd_array_init(&codec->cvt_setups, sizeof(struct hda_cvt_setup), 8);
1082
1082
+
snd_array_init(&codec->conn_lists, sizeof(hda_nid_t), 64);
1146
1083
if (codec->bus->modelname) {
1147
1084
codec->modelname = kstrdup(codec->bus->modelname, GFP_KERNEL);
1148
1085
if (!codec->modelname) {
···
2621
2556
static void set_dig_out(struct hda_codec *codec, hda_nid_t nid,
2622
2557
int verb, int val)
2623
2558
{
2624
2624
-
hda_nid_t *d;
2559
2559
+
const hda_nid_t *d;
2625
2560
2626
2561
snd_hda_codec_write_cache(codec, nid, 0, verb, val);
2627
2562
d = codec->slave_dig_outs;
···
3872
3807
*
3873
3808
* Returns 0 if successful, or a negative error code.
3874
3809
*/
3875
3875
-
int snd_hda_add_new_ctls(struct hda_codec *codec, struct snd_kcontrol_new *knew)
3810
3810
+
int snd_hda_add_new_ctls(struct hda_codec *codec,
3811
3811
+
const struct snd_kcontrol_new *knew)
3876
3812
{
3877
3813
int err;
3878
3814
···
4016
3950
struct hda_loopback_check *check,
4017
3951
hda_nid_t nid)
4018
3952
{
4019
4019
-
struct hda_amp_list *p;
3953
3953
+
const struct hda_amp_list *p;
4020
3954
int ch, v;
4021
3955
4022
3956
if (!check->amplist)
···
4184
4118
-1);
4185
4119
snd_hda_codec_setup_stream(codec, nid, stream_tag, 0, format);
4186
4120
if (codec->slave_dig_outs) {
4187
4187
-
hda_nid_t *d;
4121
4121
+
const hda_nid_t *d;
4188
4122
for (d = codec->slave_dig_outs; *d; d++)
4189
4123
snd_hda_codec_setup_stream(codec, *d, stream_tag, 0,
4190
4124
format);
···
4199
4133
{
4200
4134
snd_hda_codec_cleanup_stream(codec, nid);
4201
4135
if (codec->slave_dig_outs) {
4202
4202
-
hda_nid_t *d;
4136
4136
+
const hda_nid_t *d;
4203
4137
for (d = codec->slave_dig_outs; *d; d++)
4204
4138
snd_hda_codec_cleanup_stream(codec, *d);
4205
4139
}
···
4346
4280
unsigned int format,
4347
4281
struct snd_pcm_substream *substream)
4348
4282
{
4349
4349
-
hda_nid_t *nids = mout->dac_nids;
4283
4283
+
const hda_nid_t *nids = mout->dac_nids;
4350
4284
int chs = substream->runtime->channels;
4351
4285
int i;
4352
4286
···
4401
4335
int snd_hda_multi_out_analog_cleanup(struct hda_codec *codec,
4402
4336
struct hda_multi_out *mout)
4403
4337
{
4404
4404
-
hda_nid_t *nids = mout->dac_nids;
4338
4338
+
const hda_nid_t *nids = mout->dac_nids;
4405
4339
int i;
4406
4340
4407
4341
for (i = 0; i < mout->num_dacs; i++)
···
4426
4360
* Helper for automatic pin configuration
4427
4361
*/
4428
4362
4429
4429
-
static int is_in_nid_list(hda_nid_t nid, hda_nid_t *list)
4363
4363
+
static int is_in_nid_list(hda_nid_t nid, const hda_nid_t *list)
4430
4364
{
4431
4365
for (; *list; list++)
4432
4366
if (*list == nid)
···
4507
4441
*/
4508
4442
int snd_hda_parse_pin_def_config(struct hda_codec *codec,
4509
4443
struct auto_pin_cfg *cfg,
4510
4510
-
hda_nid_t *ignore_nids)
4444
4444
+
const hda_nid_t *ignore_nids)
4511
4445
{
4512
4446
hda_nid_t nid, end_nid;
4513
4447
short seq, assoc_line_out, assoc_speaker;
···
4698
4632
/*
4699
4633
* debug prints of the parsed results
4700
4634
*/
4701
4701
-
snd_printd("autoconfig: line_outs=%d (0x%x/0x%x/0x%x/0x%x/0x%x)\n",
4635
4635
+
snd_printd("autoconfig: line_outs=%d (0x%x/0x%x/0x%x/0x%x/0x%x) type:%s\n",
4702
4636
cfg->line_outs, cfg->line_out_pins[0], cfg->line_out_pins[1],
4703
4637
cfg->line_out_pins[2], cfg->line_out_pins[3],
4704
4704
-
cfg->line_out_pins[4]);
4638
4638
+
cfg->line_out_pins[4],
4639
4639
+
cfg->line_out_type == AUTO_PIN_HP_OUT ? "hp" :
4640
4640
+
(cfg->line_out_type == AUTO_PIN_SPEAKER_OUT ?
4641
4641
+
"speaker" : "line"));
4705
4642
snd_printd(" speaker_outs=%d (0x%x/0x%x/0x%x/0x%x/0x%x)\n",
4706
4643
cfg->speaker_outs, cfg->speaker_pins[0],
4707
4644
cfg->speaker_pins[1], cfg->speaker_pins[2],
···
5055
4986
return "Line-out";
5056
4987
case SND_JACK_HEADSET:
5057
4988
return "Headset";
4989
4989
+
case SND_JACK_VIDEOOUT:
4990
4990
+
return "HDMI/DP";
5058
4991
default:
5059
4992
return "Misc";
5060
4993
}
+3
-1
sound/pci/hda/hda_codec.h
reviewed
···
825
825
struct hda_cache_rec amp_cache; /* cache for amp access */
826
826
struct hda_cache_rec cmd_cache; /* cache for other commands */
827
827
828
828
+
struct snd_array conn_lists; /* connection-list array */
829
829
+
828
830
struct mutex spdif_mutex;
829
831
struct mutex control_mutex;
830
832
unsigned int spdif_status; /* IEC958 status bits */
831
833
unsigned short spdif_ctls; /* SPDIF control bits */
832
834
unsigned int spdif_in_enable; /* SPDIF input enable? */
833
833
-
hda_nid_t *slave_dig_outs; /* optional digital out slave widgets */
835
835
+
const hda_nid_t *slave_dig_outs; /* optional digital out slave widgets */
834
836
struct snd_array init_pins; /* initial (BIOS) pin configurations */
835
837
struct snd_array driver_pins; /* pin configs set by codec parser */
836
838
struct snd_array cvt_setups; /* audio convert setups */
+36
-2
sound/pci/hda/hda_intel.c
reviewed
···
126
126
"{Intel, ICH10},"
127
127
"{Intel, PCH},"
128
128
"{Intel, CPT},"
129
129
+
"{Intel, PPT},"
129
130
"{Intel, PBG},"
130
131
"{Intel, SCH},"
131
132
"{ATI, SB450},"
···
1092
1091
? "Failed" : "OK");
1093
1092
}
1094
1093
break;
1095
1095
-
1094
1094
+
default:
1095
1095
+
/* AMD Hudson needs the similar snoop, as it seems... */
1096
1096
+
if (chip->pci->vendor == PCI_VENDOR_ID_AMD)
1097
1097
+
update_pci_byte(chip->pci,
1098
1098
+
ATI_SB450_HDAUDIO_MISC_CNTR2_ADDR,
1099
1099
+
0x07, ATI_SB450_HDAUDIO_ENABLE_SNOOP);
1100
1100
+
break;
1096
1101
}
1097
1102
}
1098
1103
···
1451
1444
azx_init_chip(chip, 1);
1452
1445
}
1453
1446
}
1447
1447
+
}
1448
1448
+
1449
1449
+
/* AMD chipsets often cause the communication stalls upon certain
1450
1450
+
* sequence like the pin-detection. It seems that forcing the synced
1451
1451
+
* access works around the stall. Grrr...
1452
1452
+
*/
1453
1453
+
if (chip->pci->vendor == PCI_VENDOR_ID_AMD ||
1454
1454
+
chip->pci->vendor == PCI_VENDOR_ID_ATI) {
1455
1455
+
snd_printk(KERN_INFO SFX "Enable sync_write for AMD chipset\n");
1456
1456
+
chip->bus->sync_write = 1;
1457
1457
+
chip->bus->allow_bus_reset = 1;
1454
1458
}
1455
1459
1456
1460
/* Then create codec instances */
···
2367
2349
/* Check VIA/ATI HD Audio Controller exist */
2368
2350
switch (chip->driver_type) {
2369
2351
case AZX_DRIVER_VIA:
2370
2370
-
case AZX_DRIVER_ATI:
2371
2352
/* Use link position directly, avoid any transfer problem. */
2372
2353
return POS_FIX_VIACOMBO;
2354
2354
+
case AZX_DRIVER_ATI:
2355
2355
+
/* ATI chipsets don't work well with position-buffer */
2356
2356
+
return POS_FIX_LPIB;
2357
2357
+
case AZX_DRIVER_GENERIC:
2358
2358
+
/* AMD chipsets also don't work with position-buffer */
2359
2359
+
if (chip->pci->vendor == PCI_VENDOR_ID_AMD)
2360
2360
+
return POS_FIX_LPIB;
2361
2361
+
break;
2373
2362
}
2374
2363
2375
2364
return POS_FIX_AUTO;
···
2574
2549
gcap &= ~ICH6_GCAP_64OK;
2575
2550
pci_dev_put(p_smbus);
2576
2551
}
2552
2552
+
} else {
2553
2553
+
/* FIXME: not sure whether this is really needed, but
2554
2554
+
* Hudson isn't stable enough for allowing everything...
2555
2555
+
* let's check later again.
2556
2556
+
*/
2557
2557
+
if (chip->pci->vendor == PCI_VENDOR_ID_AMD)
2558
2558
+
gcap &= ~ICH6_GCAP_64OK;
2577
2559
}
2578
2560
2579
2561
/* disable 64bit DMA address for Teradici */
···
2791
2759
{ PCI_DEVICE(0x8086, 0x1c20), .driver_data = AZX_DRIVER_PCH },
2792
2760
/* PBG */
2793
2761
{ PCI_DEVICE(0x8086, 0x1d20), .driver_data = AZX_DRIVER_PCH },
2762
2762
+
/* Panther Point */
2763
2763
+
{ PCI_DEVICE(0x8086, 0x1e20), .driver_data = AZX_DRIVER_PCH },
2794
2764
/* SCH */
2795
2765
{ PCI_DEVICE(0x8086, 0x811b), .driver_data = AZX_DRIVER_SCH },
2796
2766
/* Generic Intel */
+11
-5
sound/pci/hda/hda_local.h
reviewed
···
267
267
268
268
struct hda_multi_out {
269
269
int num_dacs; /* # of DACs, must be more than 1 */
270
270
-
hda_nid_t *dac_nids; /* DAC list */
270
270
+
const hda_nid_t *dac_nids; /* DAC list */
271
271
hda_nid_t hp_nid; /* optional DAC for HP, 0 when not exists */
272
272
hda_nid_t extra_out_nid[3]; /* optional DACs, 0 when not exists */
273
273
hda_nid_t dig_out_nid; /* digital out audio widget */
274
274
-
hda_nid_t *slave_dig_outs;
274
274
+
const hda_nid_t *slave_dig_outs;
275
275
int max_channels; /* currently supported analog channels */
276
276
int dig_out_used; /* current usage of digital out (HDA_DIG_XXX) */
277
277
int no_share_stream; /* don't share a stream with multiple pins */
···
347
347
int num_configs, const char * const *models,
348
348
const struct snd_pci_quirk *tbl);
349
349
int snd_hda_add_new_ctls(struct hda_codec *codec,
350
350
-
struct snd_kcontrol_new *knew);
350
350
+
const struct snd_kcontrol_new *knew);
351
351
352
352
/*
353
353
* unsolicited event handler
···
443
443
444
444
int snd_hda_parse_pin_def_config(struct hda_codec *codec,
445
445
struct auto_pin_cfg *cfg,
446
446
-
hda_nid_t *ignore_nids);
446
446
+
const hda_nid_t *ignore_nids);
447
447
448
448
/* amp values */
449
449
#define AMP_IN_MUTE(idx) (0x7080 | ((idx)<<8))
···
492
492
u32 snd_hda_query_pin_caps(struct hda_codec *codec, hda_nid_t nid);
493
493
u32 snd_hda_pin_sense(struct hda_codec *codec, hda_nid_t nid);
494
494
int snd_hda_jack_detect(struct hda_codec *codec, hda_nid_t nid);
495
495
+
496
496
+
static inline bool is_jack_detectable(struct hda_codec *codec, hda_nid_t nid)
497
497
+
{
498
498
+
return (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_PRES_DETECT) &&
499
499
+
(get_wcaps(codec, nid) & AC_WCAP_UNSOL_CAP);
500
500
+
}
495
501
496
502
/* flags for hda_nid_item */
497
503
#define HDA_NID_ITEM_AMP (1<<0)
···
573
567
};
574
568
575
569
struct hda_loopback_check {
576
576
-
struct hda_amp_list *amplist;
570
570
+
const struct hda_amp_list *amplist;
577
571
int power_on;
578
572
};
579
573
+173
-172
sound/pci/hda/patch_analog.c
reviewed
···
30
30
#include "hda_beep.h"
31
31
32
32
struct ad198x_spec {
33
33
-
struct snd_kcontrol_new *mixers[6];
33
33
+
const struct snd_kcontrol_new *mixers[6];
34
34
int num_mixers;
35
35
unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */
36
36
const struct hda_verb *init_verbs[6]; /* initialization verbs
···
46
46
unsigned int cur_eapd;
47
47
unsigned int need_dac_fix;
48
48
49
49
-
hda_nid_t *alt_dac_nid;
50
50
-
struct hda_pcm_stream *stream_analog_alt_playback;
49
49
+
const hda_nid_t *alt_dac_nid;
50
50
+
const struct hda_pcm_stream *stream_analog_alt_playback;
51
51
52
52
/* capture */
53
53
unsigned int num_adc_nids;
54
54
-
hda_nid_t *adc_nids;
54
54
+
const hda_nid_t *adc_nids;
55
55
hda_nid_t dig_in_nid; /* digital-in NID; optional */
56
56
57
57
/* capture source */
58
58
const struct hda_input_mux *input_mux;
59
59
-
hda_nid_t *capsrc_nids;
59
59
+
const hda_nid_t *capsrc_nids;
60
60
unsigned int cur_mux[3];
61
61
62
62
/* channel model */
···
182
182
183
183
#ifdef CONFIG_SND_HDA_INPUT_BEEP
184
184
/* additional beep mixers; the actual parameters are overwritten at build */
185
185
-
static struct snd_kcontrol_new ad_beep_mixer[] = {
185
185
+
static const struct snd_kcontrol_new ad_beep_mixer[] = {
186
186
HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_OUTPUT),
187
187
HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_OUTPUT),
188
188
{ } /* end */
189
189
};
190
190
191
191
-
static struct snd_kcontrol_new ad_beep2_mixer[] = {
191
191
+
static const struct snd_kcontrol_new ad_beep2_mixer[] = {
192
192
HDA_CODEC_VOLUME("Digital Beep Playback Volume", 0, 0, HDA_OUTPUT),
193
193
HDA_CODEC_MUTE_BEEP("Digital Beep Playback Switch", 0, 0, HDA_OUTPUT),
194
194
{ } /* end */
···
231
231
/* create beep controls if needed */
232
232
#ifdef CONFIG_SND_HDA_INPUT_BEEP
233
233
if (spec->beep_amp) {
234
234
-
struct snd_kcontrol_new *knew;
234
234
+
const struct snd_kcontrol_new *knew;
235
235
knew = spec->analog_beep ? ad_beep2_mixer : ad_beep_mixer;
236
236
for ( ; knew->name; knew++) {
237
237
struct snd_kcontrol *kctl;
···
331
331
return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
332
332
}
333
333
334
334
-
static struct hda_pcm_stream ad198x_pcm_analog_alt_playback = {
334
334
+
static const struct hda_pcm_stream ad198x_pcm_analog_alt_playback = {
335
335
.substreams = 1,
336
336
.channels_min = 2,
337
337
.channels_max = 2,
···
403
403
404
404
/*
405
405
*/
406
406
-
static struct hda_pcm_stream ad198x_pcm_analog_playback = {
406
406
+
static const struct hda_pcm_stream ad198x_pcm_analog_playback = {
407
407
.substreams = 1,
408
408
.channels_min = 2,
409
409
.channels_max = 6, /* changed later */
···
415
415
},
416
416
};
417
417
418
418
-
static struct hda_pcm_stream ad198x_pcm_analog_capture = {
418
418
+
static const struct hda_pcm_stream ad198x_pcm_analog_capture = {
419
419
.substreams = 1,
420
420
.channels_min = 2,
421
421
.channels_max = 2,
···
426
426
},
427
427
};
428
428
429
429
-
static struct hda_pcm_stream ad198x_pcm_digital_playback = {
429
429
+
static const struct hda_pcm_stream ad198x_pcm_digital_playback = {
430
430
.substreams = 1,
431
431
.channels_min = 2,
432
432
.channels_max = 2,
···
439
439
},
440
440
};
441
441
442
442
-
static struct hda_pcm_stream ad198x_pcm_digital_capture = {
442
442
+
static const struct hda_pcm_stream ad198x_pcm_digital_capture = {
443
443
.substreams = 1,
444
444
.channels_min = 2,
445
445
.channels_max = 2,
···
487
487
}
488
488
489
489
return 0;
490
490
-
}
491
491
-
492
492
-
static inline void ad198x_shutup(struct hda_codec *codec)
493
493
-
{
494
494
-
snd_hda_shutup_pins(codec);
495
490
}
496
491
497
492
static void ad198x_free_kctls(struct hda_codec *codec)
···
542
547
}
543
548
}
544
549
550
550
+
static void ad198x_shutup(struct hda_codec *codec)
551
551
+
{
552
552
+
snd_hda_shutup_pins(codec);
553
553
+
ad198x_power_eapd(codec);
554
554
+
}
555
555
+
545
556
static void ad198x_free(struct hda_codec *codec)
546
557
{
547
558
struct ad198x_spec *spec = codec->spec;
···
565
564
static int ad198x_suspend(struct hda_codec *codec, pm_message_t state)
566
565
{
567
566
ad198x_shutup(codec);
568
568
-
ad198x_power_eapd(codec);
569
567
return 0;
570
568
}
571
569
#endif
572
570
573
573
-
static struct hda_codec_ops ad198x_patch_ops = {
571
571
+
static const struct hda_codec_ops ad198x_patch_ops = {
574
572
.build_controls = ad198x_build_controls,
575
573
.build_pcms = ad198x_build_pcms,
576
574
.init = ad198x_init,
···
639
639
#define AD1986A_CLFE_DAC 0x05
640
640
#define AD1986A_ADC 0x06
641
641
642
642
-
static hda_nid_t ad1986a_dac_nids[3] = {
642
642
+
static const hda_nid_t ad1986a_dac_nids[3] = {
643
643
AD1986A_FRONT_DAC, AD1986A_SURR_DAC, AD1986A_CLFE_DAC
644
644
};
645
645
-
static hda_nid_t ad1986a_adc_nids[1] = { AD1986A_ADC };
646
646
-
static hda_nid_t ad1986a_capsrc_nids[1] = { 0x12 };
645
645
+
static const hda_nid_t ad1986a_adc_nids[1] = { AD1986A_ADC };
646
646
+
static const hda_nid_t ad1986a_capsrc_nids[1] = { 0x12 };
647
647
648
648
-
static struct hda_input_mux ad1986a_capture_source = {
648
648
+
static const struct hda_input_mux ad1986a_capture_source = {
649
649
.num_items = 7,
650
650
.items = {
651
651
{ "Mic", 0x0 },
···
659
659
};
660
660
661
661
662
662
-
static struct hda_bind_ctls ad1986a_bind_pcm_vol = {
662
662
+
static const struct hda_bind_ctls ad1986a_bind_pcm_vol = {
663
663
.ops = &snd_hda_bind_vol,
664
664
.values = {
665
665
HDA_COMPOSE_AMP_VAL(AD1986A_FRONT_DAC, 3, 0, HDA_OUTPUT),
···
669
669
},
670
670
};
671
671
672
672
-
static struct hda_bind_ctls ad1986a_bind_pcm_sw = {
672
672
+
static const struct hda_bind_ctls ad1986a_bind_pcm_sw = {
673
673
.ops = &snd_hda_bind_sw,
674
674
.values = {
675
675
HDA_COMPOSE_AMP_VAL(AD1986A_FRONT_DAC, 3, 0, HDA_OUTPUT),
···
682
682
/*
683
683
* mixers
684
684
*/
685
685
-
static struct snd_kcontrol_new ad1986a_mixers[] = {
685
685
+
static const struct snd_kcontrol_new ad1986a_mixers[] = {
686
686
/*
687
687
* bind volumes/mutes of 3 DACs as a single PCM control for simplicity
688
688
*/
···
723
723
};
724
724
725
725
/* additional mixers for 3stack mode */
726
726
-
static struct snd_kcontrol_new ad1986a_3st_mixers[] = {
726
726
+
static const struct snd_kcontrol_new ad1986a_3st_mixers[] = {
727
727
{
728
728
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
729
729
.name = "Channel Mode",
···
735
735
};
736
736
737
737
/* laptop model - 2ch only */
738
738
-
static hda_nid_t ad1986a_laptop_dac_nids[1] = { AD1986A_FRONT_DAC };
738
738
+
static const hda_nid_t ad1986a_laptop_dac_nids[1] = { AD1986A_FRONT_DAC };
739
739
740
740
/* master controls both pins 0x1a and 0x1b */
741
741
-
static struct hda_bind_ctls ad1986a_laptop_master_vol = {
741
741
+
static const struct hda_bind_ctls ad1986a_laptop_master_vol = {
742
742
.ops = &snd_hda_bind_vol,
743
743
.values = {
744
744
HDA_COMPOSE_AMP_VAL(0x1a, 3, 0, HDA_OUTPUT),
···
747
747
},
748
748
};
749
749
750
750
-
static struct hda_bind_ctls ad1986a_laptop_master_sw = {
750
750
+
static const struct hda_bind_ctls ad1986a_laptop_master_sw = {
751
751
.ops = &snd_hda_bind_sw,
752
752
.values = {
753
753
HDA_COMPOSE_AMP_VAL(0x1a, 3, 0, HDA_OUTPUT),
···
756
756
},
757
757
};
758
758
759
759
-
static struct snd_kcontrol_new ad1986a_laptop_mixers[] = {
759
759
+
static const struct snd_kcontrol_new ad1986a_laptop_mixers[] = {
760
760
HDA_CODEC_VOLUME("PCM Playback Volume", 0x03, 0x0, HDA_OUTPUT),
761
761
HDA_CODEC_MUTE("PCM Playback Switch", 0x03, 0x0, HDA_OUTPUT),
762
762
HDA_BIND_VOL("Master Playback Volume", &ad1986a_laptop_master_vol),
···
787
787
788
788
/* laptop-eapd model - 2ch only */
789
789
790
790
-
static struct hda_input_mux ad1986a_laptop_eapd_capture_source = {
790
790
+
static const struct hda_input_mux ad1986a_laptop_eapd_capture_source = {
791
791
.num_items = 3,
792
792
.items = {
793
793
{ "Mic", 0x0 },
···
796
796
},
797
797
};
798
798
799
799
-
static struct hda_input_mux ad1986a_automic_capture_source = {
799
799
+
static const struct hda_input_mux ad1986a_automic_capture_source = {
800
800
.num_items = 2,
801
801
.items = {
802
802
{ "Mic", 0x0 },
···
804
804
},
805
805
};
806
806
807
807
-
static struct snd_kcontrol_new ad1986a_laptop_master_mixers[] = {
807
807
+
static const struct snd_kcontrol_new ad1986a_laptop_master_mixers[] = {
808
808
HDA_BIND_VOL("Master Playback Volume", &ad1986a_laptop_master_vol),
809
809
HDA_BIND_SW("Master Playback Switch", &ad1986a_laptop_master_sw),
810
810
{ } /* end */
811
811
};
812
812
813
813
-
static struct snd_kcontrol_new ad1986a_laptop_eapd_mixers[] = {
813
813
+
static const struct snd_kcontrol_new ad1986a_laptop_eapd_mixers[] = {
814
814
HDA_CODEC_VOLUME("PCM Playback Volume", 0x03, 0x0, HDA_OUTPUT),
815
815
HDA_CODEC_MUTE("PCM Playback Switch", 0x03, 0x0, HDA_OUTPUT),
816
816
HDA_CODEC_VOLUME("Mic Playback Volume", 0x13, 0x0, HDA_OUTPUT),
···
837
837
{ } /* end */
838
838
};
839
839
840
840
-
static struct snd_kcontrol_new ad1986a_laptop_intmic_mixers[] = {
840
840
+
static const struct snd_kcontrol_new ad1986a_laptop_intmic_mixers[] = {
841
841
HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x17, 0, HDA_OUTPUT),
842
842
HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x17, 0, HDA_OUTPUT),
843
843
{ } /* end */
···
931
931
return change;
932
932
}
933
933
934
934
-
static struct snd_kcontrol_new ad1986a_automute_master_mixers[] = {
934
934
+
static const struct snd_kcontrol_new ad1986a_automute_master_mixers[] = {
935
935
HDA_BIND_VOL("Master Playback Volume", &ad1986a_laptop_master_vol),
936
936
{
937
937
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
···
949
949
/*
950
950
* initialization verbs
951
951
*/
952
952
-
static struct hda_verb ad1986a_init_verbs[] = {
952
952
+
static const struct hda_verb ad1986a_init_verbs[] = {
953
953
/* Front, Surround, CLFE DAC; mute as default */
954
954
{0x03, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080},
955
955
{0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080},
···
1004
1004
{ } /* end */
1005
1005
};
1006
1006
1007
1007
-
static struct hda_verb ad1986a_ch2_init[] = {
1007
1007
+
static const struct hda_verb ad1986a_ch2_init[] = {
1008
1008
/* Surround out -> Line In */
1009
1009
{ 0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1010
1010
/* Line-in selectors */
···
1016
1016
{ } /* end */
1017
1017
};
1018
1018
1019
1019
-
static struct hda_verb ad1986a_ch4_init[] = {
1019
1019
+
static const struct hda_verb ad1986a_ch4_init[] = {
1020
1020
/* Surround out -> Surround */
1021
1021
{ 0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1022
1022
{ 0x10, AC_VERB_SET_CONNECT_SEL, 0x0 },
···
1026
1026
{ } /* end */
1027
1027
};
1028
1028
1029
1029
-
static struct hda_verb ad1986a_ch6_init[] = {
1029
1029
+
static const struct hda_verb ad1986a_ch6_init[] = {
1030
1030
/* Surround out -> Surround out */
1031
1031
{ 0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1032
1032
{ 0x10, AC_VERB_SET_CONNECT_SEL, 0x0 },
···
1036
1036
{ } /* end */
1037
1037
};
1038
1038
1039
1039
-
static struct hda_channel_mode ad1986a_modes[3] = {
1039
1039
+
static const struct hda_channel_mode ad1986a_modes[3] = {
1040
1040
{ 2, ad1986a_ch2_init },
1041
1041
{ 4, ad1986a_ch4_init },
1042
1042
{ 6, ad1986a_ch6_init },
1043
1043
};
1044
1044
1045
1045
/* eapd initialization */
1046
1046
-
static struct hda_verb ad1986a_eapd_init_verbs[] = {
1046
1046
+
static const struct hda_verb ad1986a_eapd_init_verbs[] = {
1047
1047
{0x1b, AC_VERB_SET_EAPD_BTLENABLE, 0x00 },
1048
1048
{}
1049
1049
};
1050
1050
1051
1051
-
static struct hda_verb ad1986a_automic_verbs[] = {
1051
1051
+
static const struct hda_verb ad1986a_automic_verbs[] = {
1052
1052
{0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1053
1053
{0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1054
1054
/*{0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},*/
···
1058
1058
};
1059
1059
1060
1060
/* Ultra initialization */
1061
1061
-
static struct hda_verb ad1986a_ultra_init[] = {
1061
1061
+
static const struct hda_verb ad1986a_ultra_init[] = {
1062
1062
/* eapd initialization */
1063
1063
{ 0x1b, AC_VERB_SET_EAPD_BTLENABLE, 0x00 },
1064
1064
/* CLFE -> Mic in */
···
1069
1069
};
1070
1070
1071
1071
/* pin sensing on HP jack */
1072
1072
-
static struct hda_verb ad1986a_hp_init_verbs[] = {
1072
1072
+
static const struct hda_verb ad1986a_hp_init_verbs[] = {
1073
1073
{0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | AD1986A_HP_EVENT},
1074
1074
{}
1075
1075
};
···
1120
1120
[AD1986A_SAMSUNG_P50] = "samsung-p50",
1121
1121
};
1122
1122
1123
1123
-
static struct snd_pci_quirk ad1986a_cfg_tbl[] = {
1123
1123
+
static const struct snd_pci_quirk ad1986a_cfg_tbl[] = {
1124
1124
SND_PCI_QUIRK(0x103c, 0x30af, "HP B2800", AD1986A_LAPTOP_EAPD),
1125
1125
SND_PCI_QUIRK(0x1043, 0x1153, "ASUS M9", AD1986A_LAPTOP_EAPD),
1126
1126
SND_PCI_QUIRK(0x1043, 0x11f7, "ASUS U5A", AD1986A_LAPTOP_EAPD),
···
1152
1152
};
1153
1153
1154
1154
#ifdef CONFIG_SND_HDA_POWER_SAVE
1155
1155
-
static struct hda_amp_list ad1986a_loopbacks[] = {
1155
1155
+
static const struct hda_amp_list ad1986a_loopbacks[] = {
1156
1156
{ 0x13, HDA_OUTPUT, 0 }, /* Mic */
1157
1157
{ 0x14, HDA_OUTPUT, 0 }, /* Phone */
1158
1158
{ 0x15, HDA_OUTPUT, 0 }, /* CD */
···
1329
1329
#define AD1983_DAC 0x03
1330
1330
#define AD1983_ADC 0x04
1331
1331
1332
1332
-
static hda_nid_t ad1983_dac_nids[1] = { AD1983_DAC };
1333
1333
-
static hda_nid_t ad1983_adc_nids[1] = { AD1983_ADC };
1334
1334
-
static hda_nid_t ad1983_capsrc_nids[1] = { 0x15 };
1332
1332
+
static const hda_nid_t ad1983_dac_nids[1] = { AD1983_DAC };
1333
1333
+
static const hda_nid_t ad1983_adc_nids[1] = { AD1983_ADC };
1334
1334
+
static const hda_nid_t ad1983_capsrc_nids[1] = { 0x15 };
1335
1335
1336
1336
-
static struct hda_input_mux ad1983_capture_source = {
1336
1336
+
static const struct hda_input_mux ad1983_capture_source = {
1337
1337
.num_items = 4,
1338
1338
.items = {
1339
1339
{ "Mic", 0x0 },
···
1348
1348
*/
1349
1349
static int ad1983_spdif_route_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
1350
1350
{
1351
1351
-
static char *texts[] = { "PCM", "ADC" };
1351
1351
+
static const char * const texts[] = { "PCM", "ADC" };
1352
1352
1353
1353
uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
1354
1354
uinfo->count = 1;
···
1385
1385
return 0;
1386
1386
}
1387
1387
1388
1388
-
static struct snd_kcontrol_new ad1983_mixers[] = {
1388
1388
+
static const struct snd_kcontrol_new ad1983_mixers[] = {
1389
1389
HDA_CODEC_VOLUME("Front Playback Volume", 0x05, 0x0, HDA_OUTPUT),
1390
1390
HDA_CODEC_MUTE("Front Playback Switch", 0x05, 0x0, HDA_OUTPUT),
1391
1391
HDA_CODEC_VOLUME("Headphone Playback Volume", 0x06, 0x0, HDA_OUTPUT),
···
1418
1418
{ } /* end */
1419
1419
};
1420
1420
1421
1421
-
static struct hda_verb ad1983_init_verbs[] = {
1421
1421
+
static const struct hda_verb ad1983_init_verbs[] = {
1422
1422
/* Front, HP, Mono; mute as default */
1423
1423
{0x05, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080},
1424
1424
{0x06, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080},
···
1458
1458
};
1459
1459
1460
1460
#ifdef CONFIG_SND_HDA_POWER_SAVE
1461
1461
-
static struct hda_amp_list ad1983_loopbacks[] = {
1461
1461
+
static const struct hda_amp_list ad1983_loopbacks[] = {
1462
1462
{ 0x12, HDA_OUTPUT, 0 }, /* Mic */
1463
1463
{ 0x13, HDA_OUTPUT, 0 }, /* Line */
1464
1464
{ } /* end */
···
1518
1518
#define AD1981_DAC 0x03
1519
1519
#define AD1981_ADC 0x04
1520
1520
1521
1521
-
static hda_nid_t ad1981_dac_nids[1] = { AD1981_DAC };
1522
1522
-
static hda_nid_t ad1981_adc_nids[1] = { AD1981_ADC };
1523
1523
-
static hda_nid_t ad1981_capsrc_nids[1] = { 0x15 };
1521
1521
+
static const hda_nid_t ad1981_dac_nids[1] = { AD1981_DAC };
1522
1522
+
static const hda_nid_t ad1981_adc_nids[1] = { AD1981_ADC };
1523
1523
+
static const hda_nid_t ad1981_capsrc_nids[1] = { 0x15 };
1524
1524
1525
1525
/* 0x0c, 0x09, 0x0e, 0x0f, 0x19, 0x05, 0x18, 0x17 */
1526
1526
-
static struct hda_input_mux ad1981_capture_source = {
1526
1526
+
static const struct hda_input_mux ad1981_capture_source = {
1527
1527
.num_items = 7,
1528
1528
.items = {
1529
1529
{ "Front Mic", 0x0 },
···
1536
1536
},
1537
1537
};
1538
1538
1539
1539
-
static struct snd_kcontrol_new ad1981_mixers[] = {
1539
1539
+
static const struct snd_kcontrol_new ad1981_mixers[] = {
1540
1540
HDA_CODEC_VOLUME("Front Playback Volume", 0x05, 0x0, HDA_OUTPUT),
1541
1541
HDA_CODEC_MUTE("Front Playback Switch", 0x05, 0x0, HDA_OUTPUT),
1542
1542
HDA_CODEC_VOLUME("Headphone Playback Volume", 0x06, 0x0, HDA_OUTPUT),
···
1577
1577
{ } /* end */
1578
1578
};
1579
1579
1580
1580
-
static struct hda_verb ad1981_init_verbs[] = {
1580
1580
+
static const struct hda_verb ad1981_init_verbs[] = {
1581
1581
/* Front, HP, Mono; mute as default */
1582
1582
{0x05, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080},
1583
1583
{0x06, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080},
···
1625
1625
};
1626
1626
1627
1627
#ifdef CONFIG_SND_HDA_POWER_SAVE
1628
1628
-
static struct hda_amp_list ad1981_loopbacks[] = {
1628
1628
+
static const struct hda_amp_list ad1981_loopbacks[] = {
1629
1629
{ 0x12, HDA_OUTPUT, 0 }, /* Front Mic */
1630
1630
{ 0x13, HDA_OUTPUT, 0 }, /* Line */
1631
1631
{ 0x1b, HDA_OUTPUT, 0 }, /* Aux */
···
1645
1645
#define AD1981_HP_EVENT 0x37
1646
1646
#define AD1981_MIC_EVENT 0x38
1647
1647
1648
1648
-
static struct hda_verb ad1981_hp_init_verbs[] = {
1648
1648
+
static const struct hda_verb ad1981_hp_init_verbs[] = {
1649
1649
{0x05, AC_VERB_SET_EAPD_BTLENABLE, 0x00 }, /* default off */
1650
1650
/* pin sensing on HP and Mic jacks */
1651
1651
{0x06, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | AD1981_HP_EVENT},
···
1674
1674
}
1675
1675
1676
1676
/* bind volumes of both NID 0x05 and 0x06 */
1677
1677
-
static struct hda_bind_ctls ad1981_hp_bind_master_vol = {
1677
1677
+
static const struct hda_bind_ctls ad1981_hp_bind_master_vol = {
1678
1678
.ops = &snd_hda_bind_vol,
1679
1679
.values = {
1680
1680
HDA_COMPOSE_AMP_VAL(0x05, 3, 0, HDA_OUTPUT),
···
1696
1696
/* toggle input of built-in and mic jack appropriately */
1697
1697
static void ad1981_hp_automic(struct hda_codec *codec)
1698
1698
{
1699
1699
-
static struct hda_verb mic_jack_on[] = {
1699
1699
+
static const struct hda_verb mic_jack_on[] = {
1700
1700
{0x1f, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080},
1701
1701
{0x1e, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
1702
1702
{}
1703
1703
};
1704
1704
-
static struct hda_verb mic_jack_off[] = {
1704
1704
+
static const struct hda_verb mic_jack_off[] = {
1705
1705
{0x1e, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080},
1706
1706
{0x1f, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
1707
1707
{}
···
1730
1730
}
1731
1731
}
1732
1732
1733
1733
-
static struct hda_input_mux ad1981_hp_capture_source = {
1733
1733
+
static const struct hda_input_mux ad1981_hp_capture_source = {
1734
1734
.num_items = 3,
1735
1735
.items = {
1736
1736
{ "Mic", 0x0 },
···
1739
1739
},
1740
1740
};
1741
1741
1742
1742
-
static struct snd_kcontrol_new ad1981_hp_mixers[] = {
1742
1742
+
static const struct snd_kcontrol_new ad1981_hp_mixers[] = {
1743
1743
HDA_BIND_VOL("Master Playback Volume", &ad1981_hp_bind_master_vol),
1744
1744
{
1745
1745
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
···
1790
1790
}
1791
1791
1792
1792
/* configuration for Toshiba Laptops */
1793
1793
-
static struct hda_verb ad1981_toshiba_init_verbs[] = {
1793
1793
+
static const struct hda_verb ad1981_toshiba_init_verbs[] = {
1794
1794
{0x05, AC_VERB_SET_EAPD_BTLENABLE, 0x01 }, /* default on */
1795
1795
/* pin sensing on HP and Mic jacks */
1796
1796
{0x06, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | AD1981_HP_EVENT},
···
1798
1798
{}
1799
1799
};
1800
1800
1801
1801
-
static struct snd_kcontrol_new ad1981_toshiba_mixers[] = {
1801
1801
+
static const struct snd_kcontrol_new ad1981_toshiba_mixers[] = {
1802
1802
HDA_CODEC_VOLUME("Amp Volume", 0x1a, 0x0, HDA_OUTPUT),
1803
1803
HDA_CODEC_MUTE("Amp Switch", 0x1a, 0x0, HDA_OUTPUT),
1804
1804
{ }
1805
1805
};
1806
1806
1807
1807
/* configuration for Lenovo Thinkpad T60 */
1808
1808
-
static struct snd_kcontrol_new ad1981_thinkpad_mixers[] = {
1808
1808
+
static const struct snd_kcontrol_new ad1981_thinkpad_mixers[] = {
1809
1809
HDA_CODEC_VOLUME("Master Playback Volume", 0x05, 0x0, HDA_OUTPUT),
1810
1810
HDA_CODEC_MUTE("Master Playback Switch", 0x05, 0x0, HDA_OUTPUT),
1811
1811
HDA_CODEC_VOLUME("PCM Playback Volume", 0x11, 0x0, HDA_OUTPUT),
···
1835
1835
{ } /* end */
1836
1836
};
1837
1837
1838
1838
-
static struct hda_input_mux ad1981_thinkpad_capture_source = {
1838
1838
+
static const struct hda_input_mux ad1981_thinkpad_capture_source = {
1839
1839
.num_items = 3,
1840
1840
.items = {
1841
1841
{ "Mic", 0x0 },
···
1860
1860
[AD1981_TOSHIBA] = "toshiba"
1861
1861
};
1862
1862
1863
1863
-
static struct snd_pci_quirk ad1981_cfg_tbl[] = {
1863
1863
+
static const struct snd_pci_quirk ad1981_cfg_tbl[] = {
1864
1864
SND_PCI_QUIRK(0x1014, 0x0597, "Lenovo Z60", AD1981_THINKPAD),
1865
1865
SND_PCI_QUIRK(0x1014, 0x05b7, "Lenovo Z60m", AD1981_THINKPAD),
1866
1866
/* All HP models */
···
2075
2075
* mixers
2076
2076
*/
2077
2077
2078
2078
-
static hda_nid_t ad1988_6stack_dac_nids[4] = {
2078
2078
+
static const hda_nid_t ad1988_6stack_dac_nids[4] = {
2079
2079
0x04, 0x06, 0x05, 0x0a
2080
2080
};
2081
2081
2082
2082
-
static hda_nid_t ad1988_3stack_dac_nids[3] = {
2082
2082
+
static const hda_nid_t ad1988_3stack_dac_nids[3] = {
2083
2083
0x04, 0x05, 0x0a
2084
2084
};
2085
2085
2086
2086
/* for AD1988A revision-2, DAC2-4 are swapped */
2087
2087
-
static hda_nid_t ad1988_6stack_dac_nids_rev2[4] = {
2087
2087
+
static const hda_nid_t ad1988_6stack_dac_nids_rev2[4] = {
2088
2088
0x04, 0x05, 0x0a, 0x06
2089
2089
};
2090
2090
2091
2091
-
static hda_nid_t ad1988_alt_dac_nid[1] = {
2091
2091
+
static const hda_nid_t ad1988_alt_dac_nid[1] = {
2092
2092
0x03
2093
2093
};
2094
2094
2095
2095
-
static hda_nid_t ad1988_3stack_dac_nids_rev2[3] = {
2095
2095
+
static const hda_nid_t ad1988_3stack_dac_nids_rev2[3] = {
2096
2096
0x04, 0x0a, 0x06
2097
2097
};
2098
2098
2099
2099
-
static hda_nid_t ad1988_adc_nids[3] = {
2099
2099
+
static const hda_nid_t ad1988_adc_nids[3] = {
2100
2100
0x08, 0x09, 0x0f
2101
2101
};
2102
2102
2103
2103
-
static hda_nid_t ad1988_capsrc_nids[3] = {
2103
2103
+
static const hda_nid_t ad1988_capsrc_nids[3] = {
2104
2104
0x0c, 0x0d, 0x0e
2105
2105
};
2106
2106
···
2108
2108
#define AD1988_SPDIF_OUT_HDMI 0x0b
2109
2109
#define AD1988_SPDIF_IN 0x07
2110
2110
2111
2111
-
static hda_nid_t ad1989b_slave_dig_outs[] = {
2111
2111
+
static const hda_nid_t ad1989b_slave_dig_outs[] = {
2112
2112
AD1988_SPDIF_OUT, AD1988_SPDIF_OUT_HDMI, 0
2113
2113
};
2114
2114
2115
2115
-
static struct hda_input_mux ad1988_6stack_capture_source = {
2115
2115
+
static const struct hda_input_mux ad1988_6stack_capture_source = {
2116
2116
.num_items = 5,
2117
2117
.items = {
2118
2118
{ "Front Mic", 0x1 }, /* port-B */
···
2123
2123
},
2124
2124
};
2125
2125
2126
2126
-
static struct hda_input_mux ad1988_laptop_capture_source = {
2126
2126
+
static const struct hda_input_mux ad1988_laptop_capture_source = {
2127
2127
.num_items = 3,
2128
2128
.items = {
2129
2129
{ "Mic/Line", 0x1 }, /* port-B */
···
2166
2166
}
2167
2167
2168
2168
/* 6-stack mode */
2169
2169
-
static struct snd_kcontrol_new ad1988_6stack_mixers1[] = {
2169
2169
+
static const struct snd_kcontrol_new ad1988_6stack_mixers1[] = {
2170
2170
HDA_CODEC_VOLUME("Front Playback Volume", 0x04, 0x0, HDA_OUTPUT),
2171
2171
HDA_CODEC_VOLUME("Surround Playback Volume", 0x06, 0x0, HDA_OUTPUT),
2172
2172
HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x05, 1, 0x0, HDA_OUTPUT),
···
2175
2175
{ } /* end */
2176
2176
};
2177
2177
2178
2178
-
static struct snd_kcontrol_new ad1988_6stack_mixers1_rev2[] = {
2178
2178
+
static const struct snd_kcontrol_new ad1988_6stack_mixers1_rev2[] = {
2179
2179
HDA_CODEC_VOLUME("Front Playback Volume", 0x04, 0x0, HDA_OUTPUT),
2180
2180
HDA_CODEC_VOLUME("Surround Playback Volume", 0x05, 0x0, HDA_OUTPUT),
2181
2181
HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
···
2184
2184
{ } /* end */
2185
2185
};
2186
2186
2187
2187
-
static struct snd_kcontrol_new ad1988_6stack_mixers2[] = {
2187
2187
+
static const struct snd_kcontrol_new ad1988_6stack_mixers2[] = {
2188
2188
HDA_BIND_MUTE("Front Playback Switch", 0x29, 2, HDA_INPUT),
2189
2189
HDA_BIND_MUTE("Surround Playback Switch", 0x2a, 2, HDA_INPUT),
2190
2190
HDA_BIND_MUTE_MONO("Center Playback Switch", 0x27, 1, 2, HDA_INPUT),
···
2211
2211
{ } /* end */
2212
2212
};
2213
2213
2214
2214
-
static struct snd_kcontrol_new ad1988_6stack_fp_mixers[] = {
2214
2214
+
static const struct snd_kcontrol_new ad1988_6stack_fp_mixers[] = {
2215
2215
HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
2216
2216
2217
2217
{ } /* end */
2218
2218
};
2219
2219
2220
2220
/* 3-stack mode */
2221
2221
-
static struct snd_kcontrol_new ad1988_3stack_mixers1[] = {
2221
2221
+
static const struct snd_kcontrol_new ad1988_3stack_mixers1[] = {
2222
2222
HDA_CODEC_VOLUME("Front Playback Volume", 0x04, 0x0, HDA_OUTPUT),
2223
2223
HDA_CODEC_VOLUME("Surround Playback Volume", 0x0a, 0x0, HDA_OUTPUT),
2224
2224
HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x05, 1, 0x0, HDA_OUTPUT),
···
2226
2226
{ } /* end */
2227
2227
};
2228
2228
2229
2229
-
static struct snd_kcontrol_new ad1988_3stack_mixers1_rev2[] = {
2229
2229
+
static const struct snd_kcontrol_new ad1988_3stack_mixers1_rev2[] = {
2230
2230
HDA_CODEC_VOLUME("Front Playback Volume", 0x04, 0x0, HDA_OUTPUT),
2231
2231
HDA_CODEC_VOLUME("Surround Playback Volume", 0x0a, 0x0, HDA_OUTPUT),
2232
2232
HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x06, 1, 0x0, HDA_OUTPUT),
···
2234
2234
{ } /* end */
2235
2235
};
2236
2236
2237
2237
-
static struct snd_kcontrol_new ad1988_3stack_mixers2[] = {
2237
2237
+
static const struct snd_kcontrol_new ad1988_3stack_mixers2[] = {
2238
2238
HDA_BIND_MUTE("Front Playback Switch", 0x29, 2, HDA_INPUT),
2239
2239
HDA_BIND_MUTE("Surround Playback Switch", 0x2c, 2, HDA_INPUT),
2240
2240
HDA_BIND_MUTE_MONO("Center Playback Switch", 0x26, 1, 2, HDA_INPUT),
···
2268
2268
};
2269
2269
2270
2270
/* laptop mode */
2271
2271
-
static struct snd_kcontrol_new ad1988_laptop_mixers[] = {
2271
2271
+
static const struct snd_kcontrol_new ad1988_laptop_mixers[] = {
2272
2272
HDA_CODEC_VOLUME("PCM Playback Volume", 0x04, 0x0, HDA_OUTPUT),
2273
2273
HDA_CODEC_MUTE("PCM Playback Switch", 0x29, 0x0, HDA_INPUT),
2274
2274
HDA_BIND_MUTE("Mono Playback Switch", 0x1e, 2, HDA_INPUT),
···
2299
2299
};
2300
2300
2301
2301
/* capture */
2302
2302
-
static struct snd_kcontrol_new ad1988_capture_mixers[] = {
2302
2302
+
static const struct snd_kcontrol_new ad1988_capture_mixers[] = {
2303
2303
HDA_CODEC_VOLUME("Capture Volume", 0x0c, 0x0, HDA_OUTPUT),
2304
2304
HDA_CODEC_MUTE("Capture Switch", 0x0c, 0x0, HDA_OUTPUT),
2305
2305
HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x0d, 0x0, HDA_OUTPUT),
···
2324
2324
static int ad1988_spdif_playback_source_info(struct snd_kcontrol *kcontrol,
2325
2325
struct snd_ctl_elem_info *uinfo)
2326
2326
{
2327
2327
-
static char *texts[] = {
2327
2327
+
static const char * const texts[] = {
2328
2328
"PCM", "ADC1", "ADC2", "ADC3"
2329
2329
};
2330
2330
uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
···
2405
2405
return change;
2406
2406
}
2407
2407
2408
2408
-
static struct snd_kcontrol_new ad1988_spdif_out_mixers[] = {
2408
2408
+
static const struct snd_kcontrol_new ad1988_spdif_out_mixers[] = {
2409
2409
HDA_CODEC_VOLUME("IEC958 Playback Volume", 0x1b, 0x0, HDA_OUTPUT),
2410
2410
{
2411
2411
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
···
2418
2418
{ } /* end */
2419
2419
};
2420
2420
2421
2421
-
static struct snd_kcontrol_new ad1988_spdif_in_mixers[] = {
2421
2421
+
static const struct snd_kcontrol_new ad1988_spdif_in_mixers[] = {
2422
2422
HDA_CODEC_VOLUME("IEC958 Capture Volume", 0x1c, 0x0, HDA_INPUT),
2423
2423
{ } /* end */
2424
2424
};
2425
2425
2426
2426
-
static struct snd_kcontrol_new ad1989_spdif_out_mixers[] = {
2426
2426
+
static const struct snd_kcontrol_new ad1989_spdif_out_mixers[] = {
2427
2427
HDA_CODEC_VOLUME("IEC958 Playback Volume", 0x1b, 0x0, HDA_OUTPUT),
2428
2428
HDA_CODEC_VOLUME("HDMI Playback Volume", 0x1d, 0x0, HDA_OUTPUT),
2429
2429
{ } /* end */
···
2436
2436
/*
2437
2437
* for 6-stack (+dig)
2438
2438
*/
2439
2439
-
static struct hda_verb ad1988_6stack_init_verbs[] = {
2439
2439
+
static const struct hda_verb ad1988_6stack_init_verbs[] = {
2440
2440
/* Front, Surround, CLFE, side DAC; unmute as default */
2441
2441
{0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2442
2442
{0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
···
2496
2496
{ }
2497
2497
};
2498
2498
2499
2499
-
static struct hda_verb ad1988_6stack_fp_init_verbs[] = {
2499
2499
+
static const struct hda_verb ad1988_6stack_fp_init_verbs[] = {
2500
2500
/* Headphone; unmute as default */
2501
2501
{0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2502
2502
/* Port-A front headphon path */
···
2509
2509
{ }
2510
2510
};
2511
2511
2512
2512
-
static struct hda_verb ad1988_capture_init_verbs[] = {
2512
2512
+
static const struct hda_verb ad1988_capture_init_verbs[] = {
2513
2513
/* mute analog mix */
2514
2514
{0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2515
2515
{0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
···
2527
2527
{ }
2528
2528
};
2529
2529
2530
2530
-
static struct hda_verb ad1988_spdif_init_verbs[] = {
2530
2530
+
static const struct hda_verb ad1988_spdif_init_verbs[] = {
2531
2531
/* SPDIF out sel */
2532
2532
{0x02, AC_VERB_SET_CONNECT_SEL, 0x0}, /* PCM */
2533
2533
{0x0b, AC_VERB_SET_CONNECT_SEL, 0x0}, /* ADC1 */
···
2539
2539
{ }
2540
2540
};
2541
2541
2542
2542
-
static struct hda_verb ad1988_spdif_in_init_verbs[] = {
2542
2542
+
static const struct hda_verb ad1988_spdif_in_init_verbs[] = {
2543
2543
/* unmute SPDIF input pin */
2544
2544
{0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2545
2545
{ }
2546
2546
};
2547
2547
2548
2548
/* AD1989 has no ADC -> SPDIF route */
2549
2549
-
static struct hda_verb ad1989_spdif_init_verbs[] = {
2549
2549
+
static const struct hda_verb ad1989_spdif_init_verbs[] = {
2550
2550
/* SPDIF-1 out pin */
2551
2551
{0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2552
2552
{0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE | 0x27}, /* 0dB */
···
2559
2559
/*
2560
2560
* verbs for 3stack (+dig)
2561
2561
*/
2562
2562
-
static struct hda_verb ad1988_3stack_ch2_init[] = {
2562
2562
+
static const struct hda_verb ad1988_3stack_ch2_init[] = {
2563
2563
/* set port-C to line-in */
2564
2564
{ 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2565
2565
{ 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
···
2569
2569
{ } /* end */
2570
2570
};
2571
2571
2572
2572
-
static struct hda_verb ad1988_3stack_ch6_init[] = {
2572
2572
+
static const struct hda_verb ad1988_3stack_ch6_init[] = {
2573
2573
/* set port-C to surround out */
2574
2574
{ 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2575
2575
{ 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
···
2579
2579
{ } /* end */
2580
2580
};
2581
2581
2582
2582
-
static struct hda_channel_mode ad1988_3stack_modes[2] = {
2582
2582
+
static const struct hda_channel_mode ad1988_3stack_modes[2] = {
2583
2583
{ 2, ad1988_3stack_ch2_init },
2584
2584
{ 6, ad1988_3stack_ch6_init },
2585
2585
};
2586
2586
2587
2587
-
static struct hda_verb ad1988_3stack_init_verbs[] = {
2587
2587
+
static const struct hda_verb ad1988_3stack_init_verbs[] = {
2588
2588
/* Front, Surround, CLFE, side DAC; unmute as default */
2589
2589
{0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2590
2590
{0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
···
2644
2644
/*
2645
2645
* verbs for laptop mode (+dig)
2646
2646
*/
2647
2647
-
static struct hda_verb ad1988_laptop_hp_on[] = {
2647
2647
+
static const struct hda_verb ad1988_laptop_hp_on[] = {
2648
2648
/* unmute port-A and mute port-D */
2649
2649
{ 0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2650
2650
{ 0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2651
2651
{ } /* end */
2652
2652
};
2653
2653
-
static struct hda_verb ad1988_laptop_hp_off[] = {
2653
2653
+
static const struct hda_verb ad1988_laptop_hp_off[] = {
2654
2654
/* mute port-A and unmute port-D */
2655
2655
{ 0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2656
2656
{ 0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
···
2659
2659
2660
2660
#define AD1988_HP_EVENT 0x01
2661
2661
2662
2662
-
static struct hda_verb ad1988_laptop_init_verbs[] = {
2662
2662
+
static const struct hda_verb ad1988_laptop_init_verbs[] = {
2663
2663
/* Front, Surround, CLFE, side DAC; unmute as default */
2664
2664
{0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2665
2665
{0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
···
2723
2723
}
2724
2724
2725
2725
#ifdef CONFIG_SND_HDA_POWER_SAVE
2726
2726
-
static struct hda_amp_list ad1988_loopbacks[] = {
2726
2726
+
static const struct hda_amp_list ad1988_loopbacks[] = {
2727
2727
{ 0x20, HDA_INPUT, 0 }, /* Front Mic */
2728
2728
{ 0x20, HDA_INPUT, 1 }, /* Line */
2729
2729
{ 0x20, HDA_INPUT, 4 }, /* Mic */
···
2741
2741
AD_CTL_WIDGET_MUTE,
2742
2742
AD_CTL_BIND_MUTE,
2743
2743
};
2744
2744
-
static struct snd_kcontrol_new ad1988_control_templates[] = {
2744
2744
+
static const struct snd_kcontrol_new ad1988_control_templates[] = {
2745
2745
HDA_CODEC_VOLUME(NULL, 0, 0, 0),
2746
2746
HDA_CODEC_MUTE(NULL, 0, 0, 0),
2747
2747
HDA_BIND_MUTE(NULL, 0, 0, 0),
···
2770
2770
#define AD1988_PIN_CD_NID 0x18
2771
2771
#define AD1988_PIN_BEEP_NID 0x10
2772
2772
2773
2773
-
static hda_nid_t ad1988_mixer_nids[8] = {
2773
2773
+
static const hda_nid_t ad1988_mixer_nids[8] = {
2774
2774
/* A B C D E F G H */
2775
2775
0x22, 0x2b, 0x2c, 0x29, 0x26, 0x2a, 0x27, 0x28
2776
2776
};
2777
2777
2778
2778
static inline hda_nid_t ad1988_idx_to_dac(struct hda_codec *codec, int idx)
2779
2779
{
2780
2780
-
static hda_nid_t idx_to_dac[8] = {
2780
2780
+
static const hda_nid_t idx_to_dac[8] = {
2781
2781
/* A B C D E F G H */
2782
2782
0x04, 0x06, 0x05, 0x04, 0x0a, 0x06, 0x05, 0x0a
2783
2783
};
2784
2784
-
static hda_nid_t idx_to_dac_rev2[8] = {
2784
2784
+
static const hda_nid_t idx_to_dac_rev2[8] = {
2785
2785
/* A B C D E F G H */
2786
2786
0x04, 0x05, 0x0a, 0x04, 0x06, 0x05, 0x0a, 0x06
2787
2787
};
···
2791
2791
return idx_to_dac[idx];
2792
2792
}
2793
2793
2794
2794
-
static hda_nid_t ad1988_boost_nids[8] = {
2794
2794
+
static const hda_nid_t ad1988_boost_nids[8] = {
2795
2795
0x38, 0x39, 0x3a, 0x3d, 0x3c, 0x3b, 0, 0
2796
2796
};
2797
2797
2798
2798
static int ad1988_pin_idx(hda_nid_t nid)
2799
2799
{
2800
2800
-
static hda_nid_t ad1988_io_pins[8] = {
2800
2800
+
static const hda_nid_t ad1988_io_pins[8] = {
2801
2801
0x11, 0x14, 0x15, 0x12, 0x17, 0x16, 0x24, 0x25
2802
2802
};
2803
2803
int i;
···
2809
2809
2810
2810
static int ad1988_pin_to_loopback_idx(hda_nid_t nid)
2811
2811
{
2812
2812
-
static int loopback_idx[8] = {
2812
2812
+
static const int loopback_idx[8] = {
2813
2813
2, 0, 1, 3, 4, 5, 1, 4
2814
2814
};
2815
2815
switch (nid) {
···
2822
2822
2823
2823
static int ad1988_pin_to_adc_idx(hda_nid_t nid)
2824
2824
{
2825
2825
-
static int adc_idx[8] = {
2825
2825
+
static const int adc_idx[8] = {
2826
2826
0, 1, 2, 8, 4, 3, 6, 7
2827
2827
};
2828
2828
switch (nid) {
···
2845
2845
/* check the pins hardwired to audio widget */
2846
2846
for (i = 0; i < cfg->line_outs; i++) {
2847
2847
idx = ad1988_pin_idx(cfg->line_out_pins[i]);
2848
2848
-
spec->multiout.dac_nids[i] = ad1988_idx_to_dac(codec, idx);
2848
2848
+
spec->private_dac_nids[i] = ad1988_idx_to_dac(codec, idx);
2849
2849
}
2850
2850
spec->multiout.num_dacs = cfg->line_outs;
2851
2851
return 0;
···
3070
3070
3071
3071
for (i = 0; i < cfg->num_inputs; i++) {
3072
3072
hda_nid_t nid = cfg->inputs[i].pin;
3073
3073
+
int type = cfg->inputs[i].type;
3073
3074
switch (nid) {
3074
3075
case 0x15: /* port-C */
3075
3076
snd_hda_codec_write(codec, 0x33, 0, AC_VERB_SET_CONNECT_SEL, 0x0);
···
3080
3079
break;
3081
3080
}
3082
3081
snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3083
3083
-
i == AUTO_PIN_MIC ? PIN_VREF80 : PIN_IN);
3082
3082
+
type == AUTO_PIN_MIC ? PIN_VREF80 : PIN_IN);
3084
3083
if (nid != AD1988_PIN_CD_NID)
3085
3084
snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
3086
3085
AMP_OUT_MUTE);
···
3155
3154
[AD1988_AUTO] = "auto",
3156
3155
};
3157
3156
3158
3158
-
static struct snd_pci_quirk ad1988_cfg_tbl[] = {
3157
3157
+
static const struct snd_pci_quirk ad1988_cfg_tbl[] = {
3159
3158
SND_PCI_QUIRK(0x1043, 0x81ec, "Asus P5B-DLX", AD1988_6STACK_DIG),
3160
3159
SND_PCI_QUIRK(0x1043, 0x81f6, "Asus M2N-SLI", AD1988_6STACK_DIG),
3161
3160
SND_PCI_QUIRK(0x1043, 0x8277, "Asus P5K-E/WIFI-AP", AD1988_6STACK_DIG),
···
3343
3342
* but no build-up framework is given, so far.
3344
3343
*/
3345
3344
3346
3346
-
static hda_nid_t ad1884_dac_nids[1] = {
3345
3345
+
static const hda_nid_t ad1884_dac_nids[1] = {
3347
3346
0x04,
3348
3347
};
3349
3348
3350
3350
-
static hda_nid_t ad1884_adc_nids[2] = {
3349
3349
+
static const hda_nid_t ad1884_adc_nids[2] = {
3351
3350
0x08, 0x09,
3352
3351
};
3353
3352
3354
3354
-
static hda_nid_t ad1884_capsrc_nids[2] = {
3353
3353
+
static const hda_nid_t ad1884_capsrc_nids[2] = {
3355
3354
0x0c, 0x0d,
3356
3355
};
3357
3356
3358
3357
#define AD1884_SPDIF_OUT 0x02
3359
3358
3360
3360
-
static struct hda_input_mux ad1884_capture_source = {
3359
3359
+
static const struct hda_input_mux ad1884_capture_source = {
3361
3360
.num_items = 4,
3362
3361
.items = {
3363
3362
{ "Front Mic", 0x0 },
···
3367
3366
},
3368
3367
};
3369
3368
3370
3370
-
static struct snd_kcontrol_new ad1884_base_mixers[] = {
3369
3369
+
static const struct snd_kcontrol_new ad1884_base_mixers[] = {
3371
3370
HDA_CODEC_VOLUME("PCM Playback Volume", 0x04, 0x0, HDA_OUTPUT),
3372
3371
/* HDA_CODEC_VOLUME_IDX("PCM Playback Volume", 1, 0x03, 0x0, HDA_OUTPUT), */
3373
3372
HDA_CODEC_MUTE("Headphone Playback Switch", 0x11, 0x0, HDA_OUTPUT),
···
3411
3410
{ } /* end */
3412
3411
};
3413
3412
3414
3414
-
static struct snd_kcontrol_new ad1984_dmic_mixers[] = {
3413
3413
+
static const struct snd_kcontrol_new ad1984_dmic_mixers[] = {
3415
3414
HDA_CODEC_VOLUME("Digital Mic Capture Volume", 0x05, 0x0, HDA_INPUT),
3416
3415
HDA_CODEC_MUTE("Digital Mic Capture Switch", 0x05, 0x0, HDA_INPUT),
3417
3416
HDA_CODEC_VOLUME_IDX("Digital Mic Capture Volume", 1, 0x06, 0x0,
···
3424
3423
/*
3425
3424
* initialization verbs
3426
3425
*/
3427
3427
-
static struct hda_verb ad1884_init_verbs[] = {
3426
3426
+
static const struct hda_verb ad1884_init_verbs[] = {
3428
3427
/* DACs; mute as default */
3429
3428
{0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3430
3429
{0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
···
3470
3469
};
3471
3470
3472
3471
#ifdef CONFIG_SND_HDA_POWER_SAVE
3473
3473
-
static struct hda_amp_list ad1884_loopbacks[] = {
3472
3472
+
static const struct hda_amp_list ad1884_loopbacks[] = {
3474
3473
{ 0x20, HDA_INPUT, 0 }, /* Front Mic */
3475
3474
{ 0x20, HDA_INPUT, 1 }, /* Mic */
3476
3475
{ 0x20, HDA_INPUT, 2 }, /* CD */
···
3542
3541
/*
3543
3542
* Lenovo Thinkpad T61/X61
3544
3543
*/
3545
3545
-
static struct hda_input_mux ad1984_thinkpad_capture_source = {
3544
3544
+
static const struct hda_input_mux ad1984_thinkpad_capture_source = {
3546
3545
.num_items = 4,
3547
3546
.items = {
3548
3547
{ "Mic", 0x0 },
···
3556
3555
/*
3557
3556
* Dell Precision T3400
3558
3557
*/
3559
3559
-
static struct hda_input_mux ad1984_dell_desktop_capture_source = {
3558
3558
+
static const struct hda_input_mux ad1984_dell_desktop_capture_source = {
3560
3559
.num_items = 3,
3561
3560
.items = {
3562
3561
{ "Front Mic", 0x0 },
···
3566
3565
};
3567
3566
3568
3567
3569
3569
-
static struct snd_kcontrol_new ad1984_thinkpad_mixers[] = {
3568
3568
+
static const struct snd_kcontrol_new ad1984_thinkpad_mixers[] = {
3570
3569
HDA_CODEC_VOLUME("PCM Playback Volume", 0x04, 0x0, HDA_OUTPUT),
3571
3570
/* HDA_CODEC_VOLUME_IDX("PCM Playback Volume", 1, 0x03, 0x0, HDA_OUTPUT), */
3572
3571
HDA_CODEC_MUTE("Headphone Playback Switch", 0x11, 0x0, HDA_OUTPUT),
···
3612
3611
};
3613
3612
3614
3613
/* additional verbs */
3615
3615
-
static struct hda_verb ad1984_thinkpad_init_verbs[] = {
3614
3614
+
static const struct hda_verb ad1984_thinkpad_init_verbs[] = {
3616
3615
/* Port-E (docking station mic) pin */
3617
3616
{0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3618
3617
{0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
···
3630
3629
/*
3631
3630
* Dell Precision T3400
3632
3631
*/
3633
3633
-
static struct snd_kcontrol_new ad1984_dell_desktop_mixers[] = {
3632
3632
+
static const struct snd_kcontrol_new ad1984_dell_desktop_mixers[] = {
3634
3633
HDA_CODEC_VOLUME("PCM Playback Volume", 0x04, 0x0, HDA_OUTPUT),
3635
3634
HDA_CODEC_MUTE("Headphone Playback Switch", 0x11, 0x0, HDA_OUTPUT),
3636
3635
HDA_CODEC_MUTE("Speaker Playback Switch", 0x12, 0x0, HDA_OUTPUT),
···
3681
3680
return 0;
3682
3681
}
3683
3682
3684
3684
-
static struct hda_pcm_stream ad1984_pcm_dmic_capture = {
3683
3683
+
static const struct hda_pcm_stream ad1984_pcm_dmic_capture = {
3685
3684
.substreams = 2,
3686
3685
.channels_min = 2,
3687
3686
.channels_max = 2,
···
3723
3722
[AD1984_DELL_DESKTOP] = "dell_desktop",
3724
3723
};
3725
3724
3726
3726
-
static struct snd_pci_quirk ad1984_cfg_tbl[] = {
3725
3725
+
static const struct snd_pci_quirk ad1984_cfg_tbl[] = {
3727
3726
/* Lenovo Thinkpad T61/X61 */
3728
3727
SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo Thinkpad", AD1984_THINKPAD),
3729
3728
SND_PCI_QUIRK(0x1028, 0x0214, "Dell T3400", AD1984_DELL_DESKTOP),
···
3788
3787
* We share the single DAC for both HP and line-outs (see AD1884/1984).
3789
3788
*/
3790
3789
3791
3791
-
static hda_nid_t ad1884a_dac_nids[1] = {
3790
3790
+
static const hda_nid_t ad1884a_dac_nids[1] = {
3792
3791
0x03,
3793
3792
};
3794
3793
···
3797
3796
3798
3797
#define AD1884A_SPDIF_OUT 0x02
3799
3798
3800
3800
-
static struct hda_input_mux ad1884a_capture_source = {
3799
3799
+
static const struct hda_input_mux ad1884a_capture_source = {
3801
3800
.num_items = 5,
3802
3801
.items = {
3803
3802
{ "Front Mic", 0x0 },
···
3808
3807
},
3809
3808
};
3810
3809
3811
3811
-
static struct snd_kcontrol_new ad1884a_base_mixers[] = {
3810
3810
+
static const struct snd_kcontrol_new ad1884a_base_mixers[] = {
3812
3811
HDA_CODEC_VOLUME("Master Playback Volume", 0x21, 0x0, HDA_OUTPUT),
3813
3812
HDA_CODEC_MUTE("Master Playback Switch", 0x21, 0x0, HDA_OUTPUT),
3814
3813
HDA_CODEC_MUTE("Headphone Playback Switch", 0x11, 0x0, HDA_OUTPUT),
···
3860
3859
/*
3861
3860
* initialization verbs
3862
3861
*/
3863
3863
-
static struct hda_verb ad1884a_init_verbs[] = {
3862
3862
+
static const struct hda_verb ad1884a_init_verbs[] = {
3864
3863
/* DACs; unmute as default */
3865
3864
{0x03, AC_VERB_SET_AMP_GAIN_MUTE, 0x27}, /* 0dB */
3866
3865
{0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x27}, /* 0dB */
···
3915
3914
};
3916
3915
3917
3916
#ifdef CONFIG_SND_HDA_POWER_SAVE
3918
3918
-
static struct hda_amp_list ad1884a_loopbacks[] = {
3917
3917
+
static const struct hda_amp_list ad1884a_loopbacks[] = {
3919
3918
{ 0x20, HDA_INPUT, 0 }, /* Front Mic */
3920
3919
{ 0x20, HDA_INPUT, 1 }, /* Mic */
3921
3920
{ 0x20, HDA_INPUT, 2 }, /* CD */
···
3948
3947
return ret;
3949
3948
}
3950
3949
3951
3951
-
static struct snd_kcontrol_new ad1884a_laptop_mixers[] = {
3950
3950
+
static const struct snd_kcontrol_new ad1884a_laptop_mixers[] = {
3952
3951
HDA_CODEC_VOLUME("Master Playback Volume", 0x21, 0x0, HDA_OUTPUT),
3953
3952
{
3954
3953
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
···
3976
3975
{ } /* end */
3977
3976
};
3978
3977
3979
3979
-
static struct snd_kcontrol_new ad1884a_mobile_mixers[] = {
3978
3978
+
static const struct snd_kcontrol_new ad1884a_mobile_mixers[] = {
3980
3979
HDA_CODEC_VOLUME("Master Playback Volume", 0x21, 0x0, HDA_OUTPUT),
3981
3980
/*HDA_CODEC_MUTE("Master Playback Switch", 0x21, 0x0, HDA_OUTPUT),*/
3982
3981
{
···
4096
4095
}
4097
4096
4098
4097
/* additional verbs for laptop model */
4099
4099
-
static struct hda_verb ad1884a_laptop_verbs[] = {
4098
4098
+
static const struct hda_verb ad1884a_laptop_verbs[] = {
4100
4099
/* Port-A (HP) pin - always unmuted */
4101
4100
{0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4102
4101
/* Port-F (int speaker) mixer - route only from analog mixer */
···
4127
4126
{ } /* end */
4128
4127
};
4129
4128
4130
4130
-
static struct hda_verb ad1884a_mobile_verbs[] = {
4129
4129
+
static const struct hda_verb ad1884a_mobile_verbs[] = {
4131
4130
/* DACs; unmute as default */
4132
4131
{0x03, AC_VERB_SET_AMP_GAIN_MUTE, 0x27}, /* 0dB */
4133
4132
{0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x27}, /* 0dB */
···
4182
4181
* 0x17 - built-in mic
4183
4182
*/
4184
4183
4185
4185
-
static struct hda_verb ad1984a_thinkpad_verbs[] = {
4184
4184
+
static const struct hda_verb ad1984a_thinkpad_verbs[] = {
4186
4185
/* HP unmute */
4187
4186
{0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4188
4187
/* analog mix */
···
4199
4198
{ } /* end */
4200
4199
};
4201
4200
4202
4202
-
static struct snd_kcontrol_new ad1984a_thinkpad_mixers[] = {
4201
4201
+
static const struct snd_kcontrol_new ad1984a_thinkpad_mixers[] = {
4203
4202
HDA_CODEC_VOLUME("Master Playback Volume", 0x21, 0x0, HDA_OUTPUT),
4204
4203
HDA_CODEC_MUTE("Master Playback Switch", 0x21, 0x0, HDA_OUTPUT),
4205
4204
HDA_CODEC_VOLUME("PCM Playback Volume", 0x20, 0x5, HDA_INPUT),
···
4220
4219
{ } /* end */
4221
4220
};
4222
4221
4223
4223
-
static struct hda_input_mux ad1984a_thinkpad_capture_source = {
4222
4222
+
static const struct hda_input_mux ad1984a_thinkpad_capture_source = {
4224
4223
.num_items = 3,
4225
4224
.items = {
4226
4225
{ "Mic", 0x0 },
···
4263
4262
* 0x15 - mic-in
4264
4263
*/
4265
4264
4266
4266
-
static struct hda_verb ad1984a_precision_verbs[] = {
4265
4265
+
static const struct hda_verb ad1984a_precision_verbs[] = {
4267
4266
/* Unmute main output path */
4268
4267
{0x03, AC_VERB_SET_AMP_GAIN_MUTE, 0x27}, /* 0dB */
4269
4268
{0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE + 0x1f}, /* 0dB */
···
4289
4288
{ } /* end */
4290
4289
};
4291
4290
4292
4292
-
static struct snd_kcontrol_new ad1984a_precision_mixers[] = {
4291
4291
+
static const struct snd_kcontrol_new ad1984a_precision_mixers[] = {
4293
4292
HDA_CODEC_VOLUME("Master Playback Volume", 0x21, 0x0, HDA_OUTPUT),
4294
4293
HDA_CODEC_MUTE("Master Playback Switch", 0x21, 0x0, HDA_OUTPUT),
4295
4294
HDA_CODEC_VOLUME("PCM Playback Volume", 0x20, 0x5, HDA_INPUT),
···
4345
4344
* digital-mic (0x17) - Internal mic
4346
4345
*/
4347
4346
4348
4348
-
static struct hda_verb ad1984a_touchsmart_verbs[] = {
4347
4347
+
static const struct hda_verb ad1984a_touchsmart_verbs[] = {
4349
4348
/* DACs; unmute as default */
4350
4349
{0x03, AC_VERB_SET_AMP_GAIN_MUTE, 0x27}, /* 0dB */
4351
4350
{0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x27}, /* 0dB */
···
4397
4396
{ } /* end */
4398
4397
};
4399
4398
4400
4400
-
static struct snd_kcontrol_new ad1984a_touchsmart_mixers[] = {
4399
4399
+
static const struct snd_kcontrol_new ad1984a_touchsmart_mixers[] = {
4401
4400
HDA_CODEC_VOLUME("Master Playback Volume", 0x21, 0x0, HDA_OUTPUT),
4402
4401
/* HDA_CODEC_MUTE("Master Playback Switch", 0x21, 0x0, HDA_OUTPUT),*/
4403
4402
{
···
4476
4475
[AD1984A_PRECISION] = "precision",
4477
4476
};
4478
4477
4479
4479
-
static struct snd_pci_quirk ad1884a_cfg_tbl[] = {
4478
4478
+
static const struct snd_pci_quirk ad1884a_cfg_tbl[] = {
4480
4479
SND_PCI_QUIRK(0x1028, 0x04ac, "Precision R5500", AD1984A_PRECISION),
4481
4480
SND_PCI_QUIRK(0x103c, 0x3030, "HP", AD1884A_MOBILE),
4482
4481
SND_PCI_QUIRK(0x103c, 0x3037, "HP 2230s", AD1884A_LAPTOP),
···
4615
4614
* port-G - rear clfe-out (6stack)
4616
4615
*/
4617
4616
4618
4618
-
static hda_nid_t ad1882_dac_nids[3] = {
4617
4617
+
static const hda_nid_t ad1882_dac_nids[3] = {
4619
4618
0x04, 0x03, 0x05
4620
4619
};
4621
4620
4622
4622
-
static hda_nid_t ad1882_adc_nids[2] = {
4621
4621
+
static const hda_nid_t ad1882_adc_nids[2] = {
4623
4622
0x08, 0x09,
4624
4623
};
4625
4624
4626
4626
-
static hda_nid_t ad1882_capsrc_nids[2] = {
4625
4625
+
static const hda_nid_t ad1882_capsrc_nids[2] = {
4627
4626
0x0c, 0x0d,
4628
4627
};
4629
4628
4630
4629
#define AD1882_SPDIF_OUT 0x02
4631
4630
4632
4631
/* list: 0x11, 0x39, 0x3a, 0x18, 0x3c, 0x3b, 0x12, 0x20 */
4633
4633
-
static struct hda_input_mux ad1882_capture_source = {
4632
4632
+
static const struct hda_input_mux ad1882_capture_source = {
4634
4633
.num_items = 5,
4635
4634
.items = {
4636
4635
{ "Front Mic", 0x1 },
···
4642
4641
};
4643
4642
4644
4643
/* list: 0x11, 0x39, 0x3a, 0x3c, 0x18, 0x1f, 0x12, 0x20 */
4645
4645
-
static struct hda_input_mux ad1882a_capture_source = {
4644
4644
+
static const struct hda_input_mux ad1882a_capture_source = {
4646
4645
.num_items = 5,
4647
4646
.items = {
4648
4647
{ "Front Mic", 0x1 },
···
4653
4652
},
4654
4653
};
4655
4654
4656
4656
-
static struct snd_kcontrol_new ad1882_base_mixers[] = {
4655
4655
+
static const struct snd_kcontrol_new ad1882_base_mixers[] = {
4657
4656
HDA_CODEC_VOLUME("Front Playback Volume", 0x04, 0x0, HDA_OUTPUT),
4658
4657
HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
4659
4658
HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x05, 1, 0x0, HDA_OUTPUT),
···
4695
4694
{ } /* end */
4696
4695
};
4697
4696
4698
4698
-
static struct snd_kcontrol_new ad1882_loopback_mixers[] = {
4697
4697
+
static const struct snd_kcontrol_new ad1882_loopback_mixers[] = {
4699
4698
HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x20, 0x00, HDA_INPUT),
4700
4699
HDA_CODEC_MUTE("Front Mic Playback Switch", 0x20, 0x00, HDA_INPUT),
4701
4700
HDA_CODEC_VOLUME("Mic Playback Volume", 0x20, 0x01, HDA_INPUT),
···
4707
4706
{ } /* end */
4708
4707
};
4709
4708
4710
4710
-
static struct snd_kcontrol_new ad1882a_loopback_mixers[] = {
4709
4709
+
static const struct snd_kcontrol_new ad1882a_loopback_mixers[] = {
4711
4710
HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x20, 0x00, HDA_INPUT),
4712
4711
HDA_CODEC_MUTE("Front Mic Playback Switch", 0x20, 0x00, HDA_INPUT),
4713
4712
HDA_CODEC_VOLUME("Mic Playback Volume", 0x20, 0x04, HDA_INPUT),
···
4720
4719
{ } /* end */
4721
4720
};
4722
4721
4723
4723
-
static struct snd_kcontrol_new ad1882_3stack_mixers[] = {
4722
4722
+
static const struct snd_kcontrol_new ad1882_3stack_mixers[] = {
4724
4723
HDA_CODEC_MUTE("Surround Playback Switch", 0x15, 0x0, HDA_OUTPUT),
4725
4724
HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x17, 1, 0x0, HDA_OUTPUT),
4726
4725
HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x17, 2, 0x0, HDA_OUTPUT),
···
4734
4733
{ } /* end */
4735
4734
};
4736
4735
4737
4737
-
static struct snd_kcontrol_new ad1882_6stack_mixers[] = {
4736
4736
+
static const struct snd_kcontrol_new ad1882_6stack_mixers[] = {
4738
4737
HDA_CODEC_MUTE("Surround Playback Switch", 0x16, 0x0, HDA_OUTPUT),
4739
4738
HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x24, 1, 0x0, HDA_OUTPUT),
4740
4739
HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x24, 2, 0x0, HDA_OUTPUT),
4741
4740
{ } /* end */
4742
4741
};
4743
4742
4744
4744
-
static struct hda_verb ad1882_ch2_init[] = {
4743
4743
+
static const struct hda_verb ad1882_ch2_init[] = {
4745
4744
{0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4746
4745
{0x2c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4747
4746
{0x2c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
···
4751
4750
{ } /* end */
4752
4751
};
4753
4752
4754
4754
-
static struct hda_verb ad1882_ch4_init[] = {
4753
4753
+
static const struct hda_verb ad1882_ch4_init[] = {
4755
4754
{0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4756
4755
{0x2c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4757
4756
{0x2c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
···
4761
4760
{ } /* end */
4762
4761
};
4763
4762
4764
4764
-
static struct hda_verb ad1882_ch6_init[] = {
4763
4763
+
static const struct hda_verb ad1882_ch6_init[] = {
4765
4764
{0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4766
4765
{0x2c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4767
4766
{0x2c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
···
4771
4770
{ } /* end */
4772
4771
};
4773
4772
4774
4774
-
static struct hda_channel_mode ad1882_modes[3] = {
4773
4773
+
static const struct hda_channel_mode ad1882_modes[3] = {
4775
4774
{ 2, ad1882_ch2_init },
4776
4775
{ 4, ad1882_ch4_init },
4777
4776
{ 6, ad1882_ch6_init },
···
4780
4779
/*
4781
4780
* initialization verbs
4782
4781
*/
4783
4783
-
static struct hda_verb ad1882_init_verbs[] = {
4782
4782
+
static const struct hda_verb ad1882_init_verbs[] = {
4784
4783
/* DACs; mute as default */
4785
4784
{0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4786
4785
{0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
···
4849
4848
};
4850
4849
4851
4850
#ifdef CONFIG_SND_HDA_POWER_SAVE
4852
4852
-
static struct hda_amp_list ad1882_loopbacks[] = {
4851
4851
+
static const struct hda_amp_list ad1882_loopbacks[] = {
4853
4852
{ 0x20, HDA_INPUT, 0 }, /* Front Mic */
4854
4853
{ 0x20, HDA_INPUT, 1 }, /* Mic */
4855
4854
{ 0x20, HDA_INPUT, 4 }, /* Line */
···
4946
4945
/*
4947
4946
* patch entries
4948
4947
*/
4949
4949
-
static struct hda_codec_preset snd_hda_preset_analog[] = {
4948
4948
+
static const struct hda_codec_preset snd_hda_preset_analog[] = {
4950
4949
{ .id = 0x11d4184a, .name = "AD1884A", .patch = patch_ad1884a },
4951
4950
{ .id = 0x11d41882, .name = "AD1882", .patch = patch_ad1882 },
4952
4951
{ .id = 0x11d41883, .name = "AD1883", .patch = patch_ad1884a },
+8
-8
sound/pci/hda/patch_ca0110.c
reviewed
···
134
134
/*
135
135
*/
136
136
137
137
-
static char *dirstr[2] = { "Playback", "Capture" };
137
137
+
static const char * const dirstr[2] = { "Playback", "Capture" };
138
138
139
139
static int _add_switch(struct hda_codec *codec, hda_nid_t nid, const char *pfx,
140
140
int chan, int dir)
···
171
171
{
172
172
struct ca0110_spec *spec = codec->spec;
173
173
struct auto_pin_cfg *cfg = &spec->autocfg;
174
174
-
static char *prefix[AUTO_CFG_MAX_OUTS] = {
174
174
+
static const char * const prefix[AUTO_CFG_MAX_OUTS] = {
175
175
"Front", "Surround", NULL, "Side", "Multi"
176
176
};
177
177
hda_nid_t mutenid;
···
259
259
260
260
/*
261
261
*/
262
262
-
static struct hda_pcm_stream ca0110_pcm_analog_playback = {
262
262
+
static const struct hda_pcm_stream ca0110_pcm_analog_playback = {
263
263
.substreams = 1,
264
264
.channels_min = 2,
265
265
.channels_max = 8,
···
270
270
},
271
271
};
272
272
273
273
-
static struct hda_pcm_stream ca0110_pcm_analog_capture = {
273
273
+
static const struct hda_pcm_stream ca0110_pcm_analog_capture = {
274
274
.substreams = 1,
275
275
.channels_min = 2,
276
276
.channels_max = 2,
···
280
280
},
281
281
};
282
282
283
283
-
static struct hda_pcm_stream ca0110_pcm_digital_playback = {
283
283
+
static const struct hda_pcm_stream ca0110_pcm_digital_playback = {
284
284
.substreams = 1,
285
285
.channels_min = 2,
286
286
.channels_max = 2,
···
291
291
},
292
292
};
293
293
294
294
-
static struct hda_pcm_stream ca0110_pcm_digital_capture = {
294
294
+
static const struct hda_pcm_stream ca0110_pcm_digital_capture = {
295
295
.substreams = 1,
296
296
.channels_min = 2,
297
297
.channels_max = 2,
···
389
389
kfree(codec->spec);
390
390
}
391
391
392
392
-
static struct hda_codec_ops ca0110_patch_ops = {
392
392
+
static const struct hda_codec_ops ca0110_patch_ops = {
393
393
.build_controls = ca0110_build_controls,
394
394
.build_pcms = ca0110_build_pcms,
395
395
.init = ca0110_init,
···
539
539
/*
540
540
* patch entries
541
541
*/
542
542
-
static struct hda_codec_preset snd_hda_preset_ca0110[] = {
542
542
+
static const struct hda_codec_preset snd_hda_preset_ca0110[] = {
543
543
{ .id = 0x1102000a, .name = "CA0110-IBG", .patch = patch_ca0110 },
544
544
{ .id = 0x1102000b, .name = "CA0110-IBG", .patch = patch_ca0110 },
545
545
{ .id = 0x1102000d, .name = "SB0880 X-Fi", .patch = patch_ca0110 },
+25
-27
sound/pci/hda/patch_cirrus.c
reviewed
···
51
51
unsigned int cur_adc_format;
52
52
hda_nid_t dig_in;
53
53
54
54
-
struct hda_bind_ctls *capture_bind[2];
54
54
+
const struct hda_bind_ctls *capture_bind[2];
55
55
56
56
unsigned int gpio_mask;
57
57
unsigned int gpio_dir;
···
231
231
232
232
/*
233
233
*/
234
234
-
static struct hda_pcm_stream cs_pcm_analog_playback = {
234
234
+
static const struct hda_pcm_stream cs_pcm_analog_playback = {
235
235
.substreams = 1,
236
236
.channels_min = 2,
237
237
.channels_max = 2,
···
242
242
},
243
243
};
244
244
245
245
-
static struct hda_pcm_stream cs_pcm_analog_capture = {
245
245
+
static const struct hda_pcm_stream cs_pcm_analog_capture = {
246
246
.substreams = 1,
247
247
.channels_min = 2,
248
248
.channels_max = 2,
···
252
252
},
253
253
};
254
254
255
255
-
static struct hda_pcm_stream cs_pcm_digital_playback = {
255
255
+
static const struct hda_pcm_stream cs_pcm_digital_playback = {
256
256
.substreams = 1,
257
257
.channels_min = 2,
258
258
.channels_max = 2,
···
264
264
},
265
265
};
266
266
267
267
-
static struct hda_pcm_stream cs_pcm_digital_capture = {
267
267
+
static const struct hda_pcm_stream cs_pcm_digital_capture = {
268
268
.substreams = 1,
269
269
.channels_min = 2,
270
270
.channels_max = 2,
···
331
331
struct cs_spec *spec = codec->spec;
332
332
struct auto_pin_cfg *cfg = &spec->autocfg;
333
333
hda_nid_t pin = cfg->inputs[idx].pin;
334
334
-
unsigned int val = snd_hda_query_pin_caps(codec, pin);
335
335
-
if (!(val & AC_PINCAP_PRES_DETECT))
334
334
+
unsigned int val;
335
335
+
if (!is_jack_detectable(codec, pin))
336
336
return 0;
337
337
val = snd_hda_codec_get_pincfg(codec, pin);
338
338
return (snd_hda_get_input_pin_attr(val) != INPUT_PIN_ATTR_INT);
···
349
349
hda_nid_t pins[2];
350
350
unsigned int type;
351
351
int j, nums;
352
352
-
type = (get_wcaps(codec, nid) & AC_WCAP_TYPE)
353
353
-
>> AC_WCAP_TYPE_SHIFT;
352
352
+
type = get_wcaps_type(get_wcaps(codec, nid));
354
353
if (type != AC_WID_AUD_IN)
355
354
continue;
356
355
nums = snd_hda_get_connections(codec, nid, pins,
···
558
559
const char *name;
559
560
int err, index;
560
561
struct snd_kcontrol *kctl;
561
561
-
static char *speakers[] = {
562
562
+
static const char * const speakers[] = {
562
563
"Front Speaker", "Surround Speaker", "Bass Speaker"
563
564
};
564
564
-
static char *line_outs[] = {
565
565
+
static const char * const line_outs[] = {
565
566
"Front Line-Out", "Surround Line-Out", "Bass Line-Out"
566
567
};
567
568
···
641
642
/*
642
643
*/
643
644
644
644
-
static struct snd_kcontrol_new cs_capture_ctls[] = {
645
645
+
static const struct snd_kcontrol_new cs_capture_ctls[] = {
645
646
HDA_BIND_SW("Capture Switch", 0),
646
647
HDA_BIND_VOL("Capture Volume", 0),
647
648
};
···
709
710
return change_cur_input(codec, idx, 0);
710
711
}
711
712
712
712
-
static struct snd_kcontrol_new cs_capture_source = {
713
713
+
static const struct snd_kcontrol_new cs_capture_source = {
713
714
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
714
715
.name = "Capture Source",
715
716
.access = SNDRV_CTL_ELEM_ACCESS_READWRITE,
···
718
719
.put = cs_capture_source_put,
719
720
};
720
721
721
721
-
static struct hda_bind_ctls *make_bind_capture(struct hda_codec *codec,
722
722
+
static const struct hda_bind_ctls *make_bind_capture(struct hda_codec *codec,
722
723
struct hda_ctl_ops *ops)
723
724
{
724
725
struct cs_spec *spec = codec->spec;
···
846
847
{
847
848
struct cs_spec *spec = codec->spec;
848
849
struct auto_pin_cfg *cfg = &spec->autocfg;
849
849
-
unsigned int caps, hp_present;
850
850
+
unsigned int hp_present;
850
851
hda_nid_t nid;
851
852
int i;
852
853
853
854
hp_present = 0;
854
855
for (i = 0; i < cfg->hp_outs; i++) {
855
856
nid = cfg->hp_pins[i];
856
856
-
caps = snd_hda_query_pin_caps(codec, nid);
857
857
-
if (!(caps & AC_PINCAP_PRES_DETECT))
857
857
+
if (!is_jack_detectable(codec, nid))
858
858
continue;
859
859
hp_present = snd_hda_jack_detect(codec, nid);
860
860
if (hp_present)
···
922
924
AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP);
923
925
if (!cfg->speaker_outs)
924
926
continue;
925
925
-
if (get_wcaps(codec, nid) & AC_WCAP_UNSOL_CAP) {
927
927
+
if (is_jack_detectable(codec, nid)) {
926
928
snd_hda_codec_write(codec, nid, 0,
927
929
AC_VERB_SET_UNSOLICITED_ENABLE,
928
930
AC_USRSP_EN | HP_EVENT);
···
981
983
cs_vendor_coef_set(codec, IDX_ADC_CFG, coef);
982
984
}
983
985
984
984
-
static struct hda_verb cs_coef_init_verbs[] = {
986
986
+
static const struct hda_verb cs_coef_init_verbs[] = {
985
987
{0x11, AC_VERB_SET_PROC_STATE, 1},
986
988
{0x11, AC_VERB_SET_COEF_INDEX, IDX_DAC_CFG},
987
989
{0x11, AC_VERB_SET_PROC_COEF,
···
1015
1017
* blocks, which will alleviate the issue.
1016
1018
*/
1017
1019
1018
1018
-
static struct hda_verb cs_errata_init_verbs[] = {
1020
1020
+
static const struct hda_verb cs_errata_init_verbs[] = {
1019
1021
{0x01, AC_VERB_SET_POWER_STATE, 0x00}, /* AFG: D0 */
1020
1022
{0x11, AC_VERB_SET_PROC_STATE, 0x01}, /* VPW: processing on */
1021
1023
···
1124
1126
}
1125
1127
}
1126
1128
1127
1127
-
static struct hda_codec_ops cs_patch_ops = {
1129
1129
+
static const struct hda_codec_ops cs_patch_ops = {
1128
1130
.build_controls = cs_build_controls,
1129
1131
.build_pcms = cs_build_pcms,
1130
1132
.init = cs_init,
···
1164
1166
};
1165
1167
1166
1168
1167
1167
-
static struct snd_pci_quirk cs420x_cfg_tbl[] = {
1169
1169
+
static const struct snd_pci_quirk cs420x_cfg_tbl[] = {
1168
1170
SND_PCI_QUIRK(0x10de, 0x0ac0, "MacBookPro 5,3", CS420X_MBP53),
1169
1171
SND_PCI_QUIRK(0x10de, 0x0d94, "MacBookAir 3,1(2)", CS420X_MBP55),
1170
1172
SND_PCI_QUIRK(0x10de, 0xcb79, "MacBookPro 5,5", CS420X_MBP55),
···
1178
1180
u32 val;
1179
1181
};
1180
1182
1181
1181
-
static struct cs_pincfg mbp53_pincfgs[] = {
1183
1183
+
static const struct cs_pincfg mbp53_pincfgs[] = {
1182
1184
{ 0x09, 0x012b4050 },
1183
1185
{ 0x0a, 0x90100141 },
1184
1186
{ 0x0b, 0x90100140 },
···
1192
1194
{} /* terminator */
1193
1195
};
1194
1196
1195
1195
-
static struct cs_pincfg mbp55_pincfgs[] = {
1197
1197
+
static const struct cs_pincfg mbp55_pincfgs[] = {
1196
1198
{ 0x09, 0x012b4030 },
1197
1199
{ 0x0a, 0x90100121 },
1198
1200
{ 0x0b, 0x90100120 },
···
1206
1208
{} /* terminator */
1207
1209
};
1208
1210
1209
1209
-
static struct cs_pincfg imac27_pincfgs[] = {
1211
1211
+
static const struct cs_pincfg imac27_pincfgs[] = {
1210
1212
{ 0x09, 0x012b4050 },
1211
1213
{ 0x0a, 0x90100140 },
1212
1214
{ 0x0b, 0x90100142 },
···
1220
1222
{} /* terminator */
1221
1223
};
1222
1224
1223
1223
-
static struct cs_pincfg *cs_pincfgs[CS420X_MODELS] = {
1225
1225
+
static const struct cs_pincfg *cs_pincfgs[CS420X_MODELS] = {
1224
1226
[CS420X_MBP53] = mbp53_pincfgs,
1225
1227
[CS420X_MBP55] = mbp55_pincfgs,
1226
1228
[CS420X_IMAC27] = imac27_pincfgs,
···
1281
1283
/*
1282
1284
* patch entries
1283
1285
*/
1284
1284
-
static struct hda_codec_preset snd_hda_preset_cirrus[] = {
1286
1286
+
static const struct hda_codec_preset snd_hda_preset_cirrus[] = {
1285
1287
{ .id = 0x10134206, .name = "CS4206", .patch = patch_cs420x },
1286
1288
{ .id = 0x10134207, .name = "CS4207", .patch = patch_cs420x },
1287
1289
{} /* terminator */
+20
-20
sound/pci/hda/patch_cmedia.c
reviewed
···
53
53
int num_dacs;
54
54
55
55
/* capture */
56
56
-
hda_nid_t *adc_nids;
56
56
+
const hda_nid_t *adc_nids;
57
57
hda_nid_t dig_in_nid;
58
58
59
59
/* capture source */
···
110
110
*/
111
111
112
112
/* 3-stack / 2 channel */
113
113
-
static struct hda_verb cmi9880_ch2_init[] = {
113
113
+
static const struct hda_verb cmi9880_ch2_init[] = {
114
114
/* set line-in PIN for input */
115
115
{ 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
116
116
/* set mic PIN for input, also enable vref */
···
121
121
};
122
122
123
123
/* 3-stack / 6 channel */
124
124
-
static struct hda_verb cmi9880_ch6_init[] = {
124
124
+
static const struct hda_verb cmi9880_ch6_init[] = {
125
125
/* set line-in PIN for output */
126
126
{ 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
127
127
/* set mic PIN for output */
···
132
132
};
133
133
134
134
/* 3-stack+front / 8 channel */
135
135
-
static struct hda_verb cmi9880_ch8_init[] = {
135
135
+
static const struct hda_verb cmi9880_ch8_init[] = {
136
136
/* set line-in PIN for output */
137
137
{ 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
138
138
/* set mic PIN for output */
···
142
142
{}
143
143
};
144
144
145
145
-
static struct hda_channel_mode cmi9880_channel_modes[3] = {
145
145
+
static const struct hda_channel_mode cmi9880_channel_modes[3] = {
146
146
{ 2, cmi9880_ch2_init },
147
147
{ 6, cmi9880_ch6_init },
148
148
{ 8, cmi9880_ch8_init },
···
174
174
175
175
/*
176
176
*/
177
177
-
static struct snd_kcontrol_new cmi9880_basic_mixer[] = {
177
177
+
static const struct snd_kcontrol_new cmi9880_basic_mixer[] = {
178
178
/* CMI9880 has no playback volumes! */
179
179
HDA_CODEC_MUTE("PCM Playback Switch", 0x03, 0x0, HDA_OUTPUT), /* front */
180
180
HDA_CODEC_MUTE("Surround Playback Switch", 0x04, 0x0, HDA_OUTPUT),
···
205
205
/*
206
206
* shared I/O pins
207
207
*/
208
208
-
static struct snd_kcontrol_new cmi9880_ch_mode_mixer[] = {
208
208
+
static const struct snd_kcontrol_new cmi9880_ch_mode_mixer[] = {
209
209
{
210
210
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
211
211
.name = "Channel Mode",
···
219
219
/* AUD-in selections:
220
220
* 0x0b 0x0c 0x0d 0x0e 0x0f 0x10 0x11 0x1f 0x20
221
221
*/
222
222
-
static struct hda_input_mux cmi9880_basic_mux = {
222
222
+
static const struct hda_input_mux cmi9880_basic_mux = {
223
223
.num_items = 4,
224
224
.items = {
225
225
{ "Front Mic", 0x5 },
···
229
229
}
230
230
};
231
231
232
232
-
static struct hda_input_mux cmi9880_no_line_mux = {
232
232
+
static const struct hda_input_mux cmi9880_no_line_mux = {
233
233
.num_items = 3,
234
234
.items = {
235
235
{ "Front Mic", 0x5 },
···
239
239
};
240
240
241
241
/* front, rear, clfe, rear_surr */
242
242
-
static hda_nid_t cmi9880_dac_nids[4] = {
242
242
+
static const hda_nid_t cmi9880_dac_nids[4] = {
243
243
0x03, 0x04, 0x05, 0x06
244
244
};
245
245
/* ADC0, ADC1 */
246
246
-
static hda_nid_t cmi9880_adc_nids[2] = {
246
246
+
static const hda_nid_t cmi9880_adc_nids[2] = {
247
247
0x08, 0x09
248
248
};
249
249
···
252
252
253
253
/*
254
254
*/
255
255
-
static struct hda_verb cmi9880_basic_init[] = {
255
255
+
static const struct hda_verb cmi9880_basic_init[] = {
256
256
/* port-D for line out (rear panel) */
257
257
{ 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
258
258
/* port-E for HP out (front panel) */
···
281
281
{} /* terminator */
282
282
};
283
283
284
284
-
static struct hda_verb cmi9880_allout_init[] = {
284
284
+
static const struct hda_verb cmi9880_allout_init[] = {
285
285
/* port-D for line out (rear panel) */
286
286
{ 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
287
287
/* port-E for HP out (front panel) */
···
528
528
529
529
/*
530
530
*/
531
531
-
static struct hda_pcm_stream cmi9880_pcm_analog_playback = {
531
531
+
static const struct hda_pcm_stream cmi9880_pcm_analog_playback = {
532
532
.substreams = 1,
533
533
.channels_min = 2,
534
534
.channels_max = 8,
···
540
540
},
541
541
};
542
542
543
543
-
static struct hda_pcm_stream cmi9880_pcm_analog_capture = {
543
543
+
static const struct hda_pcm_stream cmi9880_pcm_analog_capture = {
544
544
.substreams = 2,
545
545
.channels_min = 2,
546
546
.channels_max = 2,
···
551
551
},
552
552
};
553
553
554
554
-
static struct hda_pcm_stream cmi9880_pcm_digital_playback = {
554
554
+
static const struct hda_pcm_stream cmi9880_pcm_digital_playback = {
555
555
.substreams = 1,
556
556
.channels_min = 2,
557
557
.channels_max = 2,
···
563
563
},
564
564
};
565
565
566
566
-
static struct hda_pcm_stream cmi9880_pcm_digital_capture = {
566
566
+
static const struct hda_pcm_stream cmi9880_pcm_digital_capture = {
567
567
.substreams = 1,
568
568
.channels_min = 2,
569
569
.channels_max = 2,
···
617
617
[CMI_AUTO] = "auto",
618
618
};
619
619
620
620
-
static struct snd_pci_quirk cmi9880_cfg_tbl[] = {
620
620
+
static const struct snd_pci_quirk cmi9880_cfg_tbl[] = {
621
621
SND_PCI_QUIRK(0x1043, 0x813d, "ASUS P5AD2", CMI_FULL_DIG),
622
622
SND_PCI_QUIRK(0x1854, 0x002b, "LG LS75", CMI_MINIMAL),
623
623
SND_PCI_QUIRK(0x1854, 0x0032, "LG", CMI_FULL_DIG),
624
624
{} /* terminator */
625
625
};
626
626
627
627
-
static struct hda_codec_ops cmi9880_patch_ops = {
627
627
+
static const struct hda_codec_ops cmi9880_patch_ops = {
628
628
.build_controls = cmi9880_build_controls,
629
629
.build_pcms = cmi9880_build_pcms,
630
630
.init = cmi9880_init,
···
745
745
/*
746
746
* patch entries
747
747
*/
748
748
-
static struct hda_codec_preset snd_hda_preset_cmedia[] = {
748
748
+
static const struct hda_codec_preset snd_hda_preset_cmedia[] = {
749
749
{ .id = 0x13f69880, .name = "CMI9880", .patch = patch_cmi9880 },
750
750
{ .id = 0x434d4980, .name = "CMI9880", .patch = patch_cmi9880 },
751
751
{} /* terminator */
+807
-276
sound/pci/hda/patch_conexant.c
reviewed
···
39
39
40
40
#define CONEXANT_HP_EVENT 0x37
41
41
#define CONEXANT_MIC_EVENT 0x38
42
42
+
#define CONEXANT_LINE_EVENT 0x39
42
43
43
44
/* Conexant 5051 specific */
44
45
···
56
55
int type;
57
56
};
58
57
58
58
+
struct imux_info {
59
59
+
hda_nid_t pin; /* input pin NID */
60
60
+
hda_nid_t adc; /* connected ADC NID */
61
61
+
hda_nid_t boost; /* optional boost volume NID */
62
62
+
int index; /* corresponding to autocfg.input */
63
63
+
};
64
64
+
59
65
struct conexant_spec {
60
66
61
61
-
struct snd_kcontrol_new *mixers[5];
67
67
+
const struct snd_kcontrol_new *mixers[5];
62
68
int num_mixers;
63
69
hda_nid_t vmaster_nid;
64
70
···
82
74
*/
83
75
unsigned int cur_eapd;
84
76
unsigned int hp_present;
77
77
+
unsigned int line_present;
85
78
unsigned int auto_mic;
86
86
-
int auto_mic_ext; /* autocfg.inputs[] index for ext mic */
79
79
+
int auto_mic_ext; /* imux_pins[] index for ext mic */
80
80
+
int auto_mic_dock; /* imux_pins[] index for dock mic */
81
81
+
int auto_mic_int; /* imux_pins[] index for int mic */
87
82
unsigned int need_dac_fix;
88
83
hda_nid_t slave_dig_outs[2];
89
84
90
85
/* capture */
91
86
unsigned int num_adc_nids;
92
92
-
hda_nid_t *adc_nids;
87
87
+
const hda_nid_t *adc_nids;
93
88
hda_nid_t dig_in_nid; /* digital-in NID; optional */
94
89
95
90
unsigned int cur_adc_idx;
···
100
89
unsigned int cur_adc_stream_tag;
101
90
unsigned int cur_adc_format;
102
91
92
92
+
const struct hda_pcm_stream *capture_stream;
93
93
+
103
94
/* capture source */
104
95
const struct hda_input_mux *input_mux;
105
105
-
hda_nid_t *capsrc_nids;
96
96
+
const hda_nid_t *capsrc_nids;
106
97
unsigned int cur_mux[3];
107
98
108
99
/* channel model */
···
119
106
/* dynamic controls, init_verbs and input_mux */
120
107
struct auto_pin_cfg autocfg;
121
108
struct hda_input_mux private_imux;
109
109
+
struct imux_info imux_info[HDA_MAX_NUM_INPUTS];
110
110
+
hda_nid_t private_adc_nids[HDA_MAX_NUM_INPUTS];
122
111
hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
123
112
struct pin_dac_pair dac_info[8];
124
113
int dac_info_filled;
125
114
126
115
unsigned int port_d_mode;
127
116
unsigned int auto_mute:1; /* used in auto-parser */
117
117
+
unsigned int detect_line:1; /* Line-out detection enabled */
118
118
+
unsigned int automute_lines:1; /* automute line-out as well */
119
119
+
unsigned int automute_hp_lo:1; /* both HP and LO available */
128
120
unsigned int dell_automute:1;
129
121
unsigned int dell_vostro:1;
130
122
unsigned int ideapad:1;
131
123
unsigned int thinkpad:1;
132
124
unsigned int hp_laptop:1;
133
125
unsigned int asus:1;
126
126
+
127
127
+
unsigned int adc_switching:1;
134
128
135
129
unsigned int ext_mic_present;
136
130
unsigned int recording;
···
247
227
248
228
249
229
250
250
-
static struct hda_pcm_stream conexant_pcm_analog_playback = {
230
230
+
static const struct hda_pcm_stream conexant_pcm_analog_playback = {
251
231
.substreams = 1,
252
232
.channels_min = 2,
253
233
.channels_max = 2,
···
259
239
},
260
240
};
261
241
262
262
-
static struct hda_pcm_stream conexant_pcm_analog_capture = {
242
242
+
static const struct hda_pcm_stream conexant_pcm_analog_capture = {
263
243
.substreams = 1,
264
244
.channels_min = 2,
265
245
.channels_max = 2,
···
271
251
};
272
252
273
253
274
274
-
static struct hda_pcm_stream conexant_pcm_digital_playback = {
254
254
+
static const struct hda_pcm_stream conexant_pcm_digital_playback = {
275
255
.substreams = 1,
276
256
.channels_min = 2,
277
257
.channels_max = 2,
···
283
263
},
284
264
};
285
265
286
286
-
static struct hda_pcm_stream conexant_pcm_digital_capture = {
266
266
+
static const struct hda_pcm_stream conexant_pcm_digital_capture = {
287
267
.substreams = 1,
288
268
.channels_min = 2,
289
269
.channels_max = 2,
···
314
294
return 0;
315
295
}
316
296
317
317
-
static struct hda_pcm_stream cx5051_pcm_analog_capture = {
297
297
+
static const struct hda_pcm_stream cx5051_pcm_analog_capture = {
318
298
.substreams = 1,
319
299
.channels_min = 2,
320
300
.channels_max = 2,
···
339
319
spec->multiout.max_channels;
340
320
info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
341
321
spec->multiout.dac_nids[0];
342
342
-
if (codec->vendor_id == 0x14f15051)
343
343
-
info->stream[SNDRV_PCM_STREAM_CAPTURE] =
344
344
-
cx5051_pcm_analog_capture;
345
345
-
else
346
346
-
info->stream[SNDRV_PCM_STREAM_CAPTURE] =
347
347
-
conexant_pcm_analog_capture;
348
348
-
info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = spec->num_adc_nids;
322
322
+
if (spec->capture_stream)
323
323
+
info->stream[SNDRV_PCM_STREAM_CAPTURE] = *spec->capture_stream;
324
324
+
else {
325
325
+
if (codec->vendor_id == 0x14f15051)
326
326
+
info->stream[SNDRV_PCM_STREAM_CAPTURE] =
327
327
+
cx5051_pcm_analog_capture;
328
328
+
else {
329
329
+
info->stream[SNDRV_PCM_STREAM_CAPTURE] =
330
330
+
conexant_pcm_analog_capture;
331
331
+
info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
332
332
+
spec->num_adc_nids;
333
333
+
}
334
334
+
}
349
335
info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
350
336
351
337
if (spec->multiout.dig_out_nid) {
···
459
433
kfree(codec->spec);
460
434
}
461
435
462
462
-
static struct snd_kcontrol_new cxt_capture_mixers[] = {
436
436
+
static const struct snd_kcontrol_new cxt_capture_mixers[] = {
463
437
{
464
438
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
465
439
.name = "Capture Source",
···
472
446
473
447
#ifdef CONFIG_SND_HDA_INPUT_BEEP
474
448
/* additional beep mixers; the actual parameters are overwritten at build */
475
475
-
static struct snd_kcontrol_new cxt_beep_mixer[] = {
449
449
+
static const struct snd_kcontrol_new cxt_beep_mixer[] = {
476
450
HDA_CODEC_VOLUME_MONO("Beep Playback Volume", 0, 1, 0, HDA_OUTPUT),
477
451
HDA_CODEC_MUTE_BEEP_MONO("Beep Playback Switch", 0, 1, 0, HDA_OUTPUT),
478
452
{ } /* end */
···
482
456
static const char * const slave_vols[] = {
483
457
"Headphone Playback Volume",
484
458
"Speaker Playback Volume",
459
459
+
"Front Playback Volume",
460
460
+
"Surround Playback Volume",
461
461
+
"CLFE Playback Volume",
485
462
NULL
486
463
};
487
464
488
465
static const char * const slave_sws[] = {
489
466
"Headphone Playback Switch",
490
467
"Speaker Playback Switch",
468
468
+
"Front Playback Switch",
469
469
+
"Surround Playback Switch",
470
470
+
"CLFE Playback Switch",
491
471
NULL
492
472
};
493
473
···
553
521
#ifdef CONFIG_SND_HDA_INPUT_BEEP
554
522
/* create beep controls if needed */
555
523
if (spec->beep_amp) {
556
556
-
struct snd_kcontrol_new *knew;
524
524
+
const struct snd_kcontrol_new *knew;
557
525
for (knew = cxt_beep_mixer; knew->name; knew++) {
558
526
struct snd_kcontrol *kctl;
559
527
kctl = snd_ctl_new1(knew, codec);
···
578
546
}
579
547
#endif
580
548
581
581
-
static struct hda_codec_ops conexant_patch_ops = {
549
549
+
static const struct hda_codec_ops conexant_patch_ops = {
582
550
.build_controls = conexant_build_controls,
583
551
.build_pcms = conexant_build_pcms,
584
552
.init = conexant_init,
···
596
564
#define set_beep_amp(spec, nid, idx, dir) /* NOP */
597
565
#endif
598
566
567
567
+
static int patch_conexant_auto(struct hda_codec *codec);
599
568
/*
600
569
* EAPD control
601
570
* the private value = nid | (invert << 8)
···
695
662
696
663
/* Conexant 5045 specific */
697
664
698
698
-
static hda_nid_t cxt5045_dac_nids[1] = { 0x19 };
699
699
-
static hda_nid_t cxt5045_adc_nids[1] = { 0x1a };
700
700
-
static hda_nid_t cxt5045_capsrc_nids[1] = { 0x1a };
665
665
+
static const hda_nid_t cxt5045_dac_nids[1] = { 0x19 };
666
666
+
static const hda_nid_t cxt5045_adc_nids[1] = { 0x1a };
667
667
+
static const hda_nid_t cxt5045_capsrc_nids[1] = { 0x1a };
701
668
#define CXT5045_SPDIF_OUT 0x18
702
669
703
703
-
static struct hda_channel_mode cxt5045_modes[1] = {
670
670
+
static const struct hda_channel_mode cxt5045_modes[1] = {
704
671
{ 2, NULL },
705
672
};
706
673
707
707
-
static struct hda_input_mux cxt5045_capture_source = {
674
674
+
static const struct hda_input_mux cxt5045_capture_source = {
708
675
.num_items = 2,
709
676
.items = {
710
677
{ "IntMic", 0x1 },
···
712
679
}
713
680
};
714
681
715
715
-
static struct hda_input_mux cxt5045_capture_source_benq = {
682
682
+
static const struct hda_input_mux cxt5045_capture_source_benq = {
716
683
.num_items = 5,
717
684
.items = {
718
685
{ "IntMic", 0x1 },
···
723
690
}
724
691
};
725
692
726
726
-
static struct hda_input_mux cxt5045_capture_source_hp530 = {
693
693
+
static const struct hda_input_mux cxt5045_capture_source_hp530 = {
727
694
.num_items = 2,
728
695
.items = {
729
696
{ "ExtMic", 0x1 },
···
756
723
}
757
724
758
725
/* bind volumes of both NID 0x10 and 0x11 */
759
759
-
static struct hda_bind_ctls cxt5045_hp_bind_master_vol = {
726
726
+
static const struct hda_bind_ctls cxt5045_hp_bind_master_vol = {
760
727
.ops = &snd_hda_bind_vol,
761
728
.values = {
762
729
HDA_COMPOSE_AMP_VAL(0x10, 3, 0, HDA_OUTPUT),
···
768
735
/* toggle input of built-in and mic jack appropriately */
769
736
static void cxt5045_hp_automic(struct hda_codec *codec)
770
737
{
771
771
-
static struct hda_verb mic_jack_on[] = {
738
738
+
static const struct hda_verb mic_jack_on[] = {
772
739
{0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080},
773
740
{0x12, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
774
741
{}
775
742
};
776
776
-
static struct hda_verb mic_jack_off[] = {
743
743
+
static const struct hda_verb mic_jack_off[] = {
777
744
{0x12, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080},
778
745
{0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
779
746
{}
···
817
784
}
818
785
}
819
786
820
820
-
static struct snd_kcontrol_new cxt5045_mixers[] = {
787
787
+
static const struct snd_kcontrol_new cxt5045_mixers[] = {
821
788
HDA_CODEC_VOLUME("Internal Mic Capture Volume", 0x1a, 0x01, HDA_INPUT),
822
789
HDA_CODEC_MUTE("Internal Mic Capture Switch", 0x1a, 0x01, HDA_INPUT),
823
790
HDA_CODEC_VOLUME("Mic Capture Volume", 0x1a, 0x02, HDA_INPUT),
···
841
808
{}
842
809
};
843
810
844
844
-
static struct snd_kcontrol_new cxt5045_benq_mixers[] = {
811
811
+
static const struct snd_kcontrol_new cxt5045_benq_mixers[] = {
845
812
HDA_CODEC_VOLUME("CD Capture Volume", 0x1a, 0x04, HDA_INPUT),
846
813
HDA_CODEC_MUTE("CD Capture Switch", 0x1a, 0x04, HDA_INPUT),
847
814
HDA_CODEC_VOLUME("CD Playback Volume", 0x17, 0x4, HDA_INPUT),
···
858
825
{}
859
826
};
860
827
861
861
-
static struct snd_kcontrol_new cxt5045_mixers_hp530[] = {
828
828
+
static const struct snd_kcontrol_new cxt5045_mixers_hp530[] = {
862
829
HDA_CODEC_VOLUME("Internal Mic Capture Volume", 0x1a, 0x02, HDA_INPUT),
863
830
HDA_CODEC_MUTE("Internal Mic Capture Switch", 0x1a, 0x02, HDA_INPUT),
864
831
HDA_CODEC_VOLUME("Mic Capture Volume", 0x1a, 0x01, HDA_INPUT),
···
882
849
{}
883
850
};
884
851
885
885
-
static struct hda_verb cxt5045_init_verbs[] = {
852
852
+
static const struct hda_verb cxt5045_init_verbs[] = {
886
853
/* Line in, Mic */
887
854
{0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN|AC_PINCTL_VREF_80 },
888
855
{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN|AC_PINCTL_VREF_80 },
···
908
875
{ } /* end */
909
876
};
910
877
911
911
-
static struct hda_verb cxt5045_benq_init_verbs[] = {
878
878
+
static const struct hda_verb cxt5045_benq_init_verbs[] = {
912
879
/* Internal Mic, Mic */
913
880
{0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN|AC_PINCTL_VREF_80 },
914
881
{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN|AC_PINCTL_VREF_80 },
···
934
901
{ } /* end */
935
902
};
936
903
937
937
-
static struct hda_verb cxt5045_hp_sense_init_verbs[] = {
904
904
+
static const struct hda_verb cxt5045_hp_sense_init_verbs[] = {
938
905
/* pin sensing on HP jack */
939
906
{0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | CONEXANT_HP_EVENT},
940
907
{ } /* end */
941
908
};
942
909
943
943
-
static struct hda_verb cxt5045_mic_sense_init_verbs[] = {
910
910
+
static const struct hda_verb cxt5045_mic_sense_init_verbs[] = {
944
911
/* pin sensing on HP jack */
945
912
{0x12, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | CONEXANT_MIC_EVENT},
946
913
{ } /* end */
···
950
917
/* Test configuration for debugging, modelled after the ALC260 test
951
918
* configuration.
952
919
*/
953
953
-
static struct hda_input_mux cxt5045_test_capture_source = {
920
920
+
static const struct hda_input_mux cxt5045_test_capture_source = {
954
921
.num_items = 5,
955
922
.items = {
956
923
{ "MIXER", 0x0 },
···
961
928
},
962
929
};
963
930
964
964
-
static struct snd_kcontrol_new cxt5045_test_mixer[] = {
931
931
+
static const struct snd_kcontrol_new cxt5045_test_mixer[] = {
965
932
966
933
/* Output controls */
967
934
HDA_CODEC_VOLUME("Speaker Playback Volume", 0x10, 0x0, HDA_OUTPUT),
···
1011
978
{ } /* end */
1012
979
};
1013
980
1014
1014
-
static struct hda_verb cxt5045_test_init_verbs[] = {
981
981
+
static const struct hda_verb cxt5045_test_init_verbs[] = {
1015
982
/* Set connections */
1016
983
{ 0x10, AC_VERB_SET_CONNECT_SEL, 0x0 },
1017
984
{ 0x11, AC_VERB_SET_CONNECT_SEL, 0x0 },
···
1080
1047
#ifdef CONFIG_SND_DEBUG
1081
1048
CXT5045_TEST,
1082
1049
#endif
1050
1050
+
CXT5045_AUTO,
1083
1051
CXT5045_MODELS
1084
1052
};
1085
1053
···
1093
1059
#ifdef CONFIG_SND_DEBUG
1094
1060
[CXT5045_TEST] = "test",
1095
1061
#endif
1062
1062
+
[CXT5045_AUTO] = "auto",
1096
1063
};
1097
1064
1098
1098
-
static struct snd_pci_quirk cxt5045_cfg_tbl[] = {
1065
1065
+
static const struct snd_pci_quirk cxt5045_cfg_tbl[] = {
1099
1066
SND_PCI_QUIRK(0x103c, 0x30d5, "HP 530", CXT5045_LAPTOP_HP530),
1100
1067
SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP DV Series",
1101
1068
CXT5045_LAPTOP_HPSENSE),
···
1119
1084
{
1120
1085
struct conexant_spec *spec;
1121
1086
int board_config;
1087
1087
+
1088
1088
+
board_config = snd_hda_check_board_config(codec, CXT5045_MODELS,
1089
1089
+
cxt5045_models,
1090
1090
+
cxt5045_cfg_tbl);
1091
1091
+
#if 0 /* use the old method just for safety */
1092
1092
+
if (board_config < 0)
1093
1093
+
board_config = CXT5045_AUTO;
1094
1094
+
#endif
1095
1095
+
if (board_config == CXT5045_AUTO)
1096
1096
+
return patch_conexant_auto(codec);
1122
1097
1123
1098
spec = kzalloc(sizeof(*spec), GFP_KERNEL);
1124
1099
if (!spec)
···
1156
1111
1157
1112
codec->patch_ops = conexant_patch_ops;
1158
1113
1159
1159
-
board_config = snd_hda_check_board_config(codec, CXT5045_MODELS,
1160
1160
-
cxt5045_models,
1161
1161
-
cxt5045_cfg_tbl);
1162
1114
switch (board_config) {
1163
1115
case CXT5045_LAPTOP_HPSENSE:
1164
1116
codec->patch_ops.unsol_event = cxt5045_hp_unsol_event;
···
1238
1196
/* Conexant 5047 specific */
1239
1197
#define CXT5047_SPDIF_OUT 0x11
1240
1198
1241
1241
-
static hda_nid_t cxt5047_dac_nids[1] = { 0x10 }; /* 0x1c */
1242
1242
-
static hda_nid_t cxt5047_adc_nids[1] = { 0x12 };
1243
1243
-
static hda_nid_t cxt5047_capsrc_nids[1] = { 0x1a };
1199
1199
+
static const hda_nid_t cxt5047_dac_nids[1] = { 0x10 }; /* 0x1c */
1200
1200
+
static const hda_nid_t cxt5047_adc_nids[1] = { 0x12 };
1201
1201
+
static const hda_nid_t cxt5047_capsrc_nids[1] = { 0x1a };
1244
1202
1245
1245
-
static struct hda_channel_mode cxt5047_modes[1] = {
1203
1203
+
static const struct hda_channel_mode cxt5047_modes[1] = {
1246
1204
{ 2, NULL },
1247
1205
};
1248
1206
1249
1249
-
static struct hda_input_mux cxt5047_toshiba_capture_source = {
1207
1207
+
static const struct hda_input_mux cxt5047_toshiba_capture_source = {
1250
1208
.num_items = 2,
1251
1209
.items = {
1252
1210
{ "ExtMic", 0x2 },
···
1298
1256
/* toggle input of built-in and mic jack appropriately */
1299
1257
static void cxt5047_hp_automic(struct hda_codec *codec)
1300
1258
{
1301
1301
-
static struct hda_verb mic_jack_on[] = {
1259
1259
+
static const struct hda_verb mic_jack_on[] = {
1302
1260
{0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1303
1261
{0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1304
1262
{}
1305
1263
};
1306
1306
-
static struct hda_verb mic_jack_off[] = {
1264
1264
+
static const struct hda_verb mic_jack_off[] = {
1307
1265
{0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1308
1266
{0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1309
1267
{}
···
1331
1289
}
1332
1290
}
1333
1291
1334
1334
-
static struct snd_kcontrol_new cxt5047_base_mixers[] = {
1292
1292
+
static const struct snd_kcontrol_new cxt5047_base_mixers[] = {
1335
1293
HDA_CODEC_VOLUME("Mic Playback Volume", 0x19, 0x02, HDA_INPUT),
1336
1294
HDA_CODEC_MUTE("Mic Playback Switch", 0x19, 0x02, HDA_INPUT),
1337
1295
HDA_CODEC_VOLUME("Mic Boost Volume", 0x1a, 0x0, HDA_OUTPUT),
···
1351
1309
{}
1352
1310
};
1353
1311
1354
1354
-
static struct snd_kcontrol_new cxt5047_hp_spk_mixers[] = {
1312
1312
+
static const struct snd_kcontrol_new cxt5047_hp_spk_mixers[] = {
1355
1313
/* See the note in cxt5047_hp_master_sw_put */
1356
1314
HDA_CODEC_VOLUME("Speaker Playback Volume", 0x1d, 0x01, HDA_OUTPUT),
1357
1315
HDA_CODEC_VOLUME("Headphone Playback Volume", 0x13, 0x00, HDA_OUTPUT),
1358
1316
{}
1359
1317
};
1360
1318
1361
1361
-
static struct snd_kcontrol_new cxt5047_hp_only_mixers[] = {
1319
1319
+
static const struct snd_kcontrol_new cxt5047_hp_only_mixers[] = {
1362
1320
HDA_CODEC_VOLUME("Master Playback Volume", 0x13, 0x00, HDA_OUTPUT),
1363
1321
{ } /* end */
1364
1322
};
1365
1323
1366
1366
-
static struct hda_verb cxt5047_init_verbs[] = {
1324
1324
+
static const struct hda_verb cxt5047_init_verbs[] = {
1367
1325
/* Line in, Mic, Built-in Mic */
1368
1326
{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1369
1327
{0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN|AC_PINCTL_VREF_50 },
···
1390
1348
};
1391
1349
1392
1350
/* configuration for Toshiba Laptops */
1393
1393
-
static struct hda_verb cxt5047_toshiba_init_verbs[] = {
1351
1351
+
static const struct hda_verb cxt5047_toshiba_init_verbs[] = {
1394
1352
{0x13, AC_VERB_SET_EAPD_BTLENABLE, 0x0}, /* default off */
1395
1353
{}
1396
1354
};
···
1399
1357
* configuration.
1400
1358
*/
1401
1359
#ifdef CONFIG_SND_DEBUG
1402
1402
-
static struct hda_input_mux cxt5047_test_capture_source = {
1360
1360
+
static const struct hda_input_mux cxt5047_test_capture_source = {
1403
1361
.num_items = 4,
1404
1362
.items = {
1405
1363
{ "LINE1 pin", 0x0 },
···
1409
1367
},
1410
1368
};
1411
1369
1412
1412
-
static struct snd_kcontrol_new cxt5047_test_mixer[] = {
1370
1370
+
static const struct snd_kcontrol_new cxt5047_test_mixer[] = {
1413
1371
1414
1372
/* Output only controls */
1415
1373
HDA_CODEC_VOLUME("OutAmp-1 Volume", 0x10, 0x0, HDA_OUTPUT),
···
1462
1420
{ } /* end */
1463
1421
};
1464
1422
1465
1465
-
static struct hda_verb cxt5047_test_init_verbs[] = {
1423
1423
+
static const struct hda_verb cxt5047_test_init_verbs[] = {
1466
1424
/* Enable retasking pins as output, initially without power amp */
1467
1425
{0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1468
1426
{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
···
1534
1492
#ifdef CONFIG_SND_DEBUG
1535
1493
CXT5047_TEST,
1536
1494
#endif
1495
1495
+
CXT5047_AUTO,
1537
1496
CXT5047_MODELS
1538
1497
};
1539
1498
···
1545
1502
#ifdef CONFIG_SND_DEBUG
1546
1503
[CXT5047_TEST] = "test",
1547
1504
#endif
1505
1505
+
[CXT5047_AUTO] = "auto",
1548
1506
};
1549
1507
1550
1550
-
static struct snd_pci_quirk cxt5047_cfg_tbl[] = {
1508
1508
+
static const struct snd_pci_quirk cxt5047_cfg_tbl[] = {
1551
1509
SND_PCI_QUIRK(0x103c, 0x30a5, "HP DV5200T/DV8000T", CXT5047_LAPTOP_HP),
1552
1510
SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP DV Series",
1553
1511
CXT5047_LAPTOP),
···
1560
1516
{
1561
1517
struct conexant_spec *spec;
1562
1518
int board_config;
1519
1519
+
1520
1520
+
board_config = snd_hda_check_board_config(codec, CXT5047_MODELS,
1521
1521
+
cxt5047_models,
1522
1522
+
cxt5047_cfg_tbl);
1523
1523
+
#if 0 /* not enabled as default, as BIOS often broken for this codec */
1524
1524
+
if (board_config < 0)
1525
1525
+
board_config = CXT5047_AUTO;
1526
1526
+
#endif
1527
1527
+
if (board_config == CXT5047_AUTO)
1528
1528
+
return patch_conexant_auto(codec);
1563
1529
1564
1530
spec = kzalloc(sizeof(*spec), GFP_KERNEL);
1565
1531
if (!spec)
···
1594
1540
1595
1541
codec->patch_ops = conexant_patch_ops;
1596
1542
1597
1597
-
board_config = snd_hda_check_board_config(codec, CXT5047_MODELS,
1598
1598
-
cxt5047_models,
1599
1599
-
cxt5047_cfg_tbl);
1600
1543
switch (board_config) {
1601
1544
case CXT5047_LAPTOP:
1602
1545
spec->num_mixers = 2;
···
1642
1591
}
1643
1592
1644
1593
/* Conexant 5051 specific */
1645
1645
-
static hda_nid_t cxt5051_dac_nids[1] = { 0x10 };
1646
1646
-
static hda_nid_t cxt5051_adc_nids[2] = { 0x14, 0x15 };
1594
1594
+
static const hda_nid_t cxt5051_dac_nids[1] = { 0x10 };
1595
1595
+
static const hda_nid_t cxt5051_adc_nids[2] = { 0x14, 0x15 };
1647
1596
1648
1648
-
static struct hda_channel_mode cxt5051_modes[1] = {
1597
1597
+
static const struct hda_channel_mode cxt5051_modes[1] = {
1649
1598
{ 2, NULL },
1650
1599
};
1651
1600
···
1747
1696
snd_hda_input_jack_report(codec, nid);
1748
1697
}
1749
1698
1750
1750
-
static struct snd_kcontrol_new cxt5051_playback_mixers[] = {
1699
1699
+
static const struct snd_kcontrol_new cxt5051_playback_mixers[] = {
1751
1700
HDA_CODEC_VOLUME("Master Playback Volume", 0x10, 0x00, HDA_OUTPUT),
1752
1701
{
1753
1702
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
···
1760
1709
{}
1761
1710
};
1762
1711
1763
1763
-
static struct snd_kcontrol_new cxt5051_capture_mixers[] = {
1712
1712
+
static const struct snd_kcontrol_new cxt5051_capture_mixers[] = {
1764
1713
HDA_CODEC_VOLUME("Internal Mic Volume", 0x14, 0x00, HDA_INPUT),
1765
1714
HDA_CODEC_MUTE("Internal Mic Switch", 0x14, 0x00, HDA_INPUT),
1766
1715
HDA_CODEC_VOLUME("Mic Volume", 0x14, 0x01, HDA_INPUT),
···
1770
1719
{}
1771
1720
};
1772
1721
1773
1773
-
static struct snd_kcontrol_new cxt5051_hp_mixers[] = {
1722
1722
+
static const struct snd_kcontrol_new cxt5051_hp_mixers[] = {
1774
1723
HDA_CODEC_VOLUME("Internal Mic Volume", 0x14, 0x00, HDA_INPUT),
1775
1724
HDA_CODEC_MUTE("Internal Mic Switch", 0x14, 0x00, HDA_INPUT),
1776
1725
HDA_CODEC_VOLUME("Mic Volume", 0x15, 0x00, HDA_INPUT),
···
1778
1727
{}
1779
1728
};
1780
1729
1781
1781
-
static struct snd_kcontrol_new cxt5051_hp_dv6736_mixers[] = {
1730
1730
+
static const struct snd_kcontrol_new cxt5051_hp_dv6736_mixers[] = {
1782
1731
HDA_CODEC_VOLUME("Capture Volume", 0x14, 0x00, HDA_INPUT),
1783
1732
HDA_CODEC_MUTE("Capture Switch", 0x14, 0x00, HDA_INPUT),
1784
1733
{}
1785
1734
};
1786
1735
1787
1787
-
static struct snd_kcontrol_new cxt5051_f700_mixers[] = {
1736
1736
+
static const struct snd_kcontrol_new cxt5051_f700_mixers[] = {
1788
1737
HDA_CODEC_VOLUME("Capture Volume", 0x14, 0x01, HDA_INPUT),
1789
1738
HDA_CODEC_MUTE("Capture Switch", 0x14, 0x01, HDA_INPUT),
1790
1739
{}
1791
1740
};
1792
1741
1793
1793
-
static struct snd_kcontrol_new cxt5051_toshiba_mixers[] = {
1742
1742
+
static const struct snd_kcontrol_new cxt5051_toshiba_mixers[] = {
1794
1743
HDA_CODEC_VOLUME("Internal Mic Volume", 0x14, 0x00, HDA_INPUT),
1795
1744
HDA_CODEC_MUTE("Internal Mic Switch", 0x14, 0x00, HDA_INPUT),
1796
1745
HDA_CODEC_VOLUME("Mic Volume", 0x14, 0x01, HDA_INPUT),
···
1798
1747
{}
1799
1748
};
1800
1749
1801
1801
-
static struct hda_verb cxt5051_init_verbs[] = {
1750
1750
+
static const struct hda_verb cxt5051_init_verbs[] = {
1802
1751
/* Line in, Mic */
1803
1752
{0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) | 0x03},
1804
1753
{0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
···
1827
1776
{ } /* end */
1828
1777
};
1829
1778
1830
1830
-
static struct hda_verb cxt5051_hp_dv6736_init_verbs[] = {
1779
1779
+
static const struct hda_verb cxt5051_hp_dv6736_init_verbs[] = {
1831
1780
/* Line in, Mic */
1832
1781
{0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) | 0x03},
1833
1782
{0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
···
1852
1801
{ } /* end */
1853
1802
};
1854
1803
1855
1855
-
static struct hda_verb cxt5051_lenovo_x200_init_verbs[] = {
1804
1804
+
static const struct hda_verb cxt5051_lenovo_x200_init_verbs[] = {
1856
1805
/* Line in, Mic */
1857
1806
{0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) | 0x03},
1858
1807
{0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
···
1885
1834
{ } /* end */
1886
1835
};
1887
1836
1888
1888
-
static struct hda_verb cxt5051_f700_init_verbs[] = {
1837
1837
+
static const struct hda_verb cxt5051_f700_init_verbs[] = {
1889
1838
/* Line in, Mic */
1890
1839
{0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) | 0x03},
1891
1840
{0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
···
1920
1869
snd_hda_input_jack_report(codec, nid);
1921
1870
}
1922
1871
1923
1923
-
static struct hda_verb cxt5051_ideapad_init_verbs[] = {
1872
1872
+
static const struct hda_verb cxt5051_ideapad_init_verbs[] = {
1924
1873
/* Subwoofer */
1925
1874
{0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1926
1875
{0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
···
1957
1906
CXT5051_F700, /* HP Compaq Presario F700 */
1958
1907
CXT5051_TOSHIBA, /* Toshiba M300 & co */
1959
1908
CXT5051_IDEAPAD, /* Lenovo IdeaPad Y430 */
1909
1909
+
CXT5051_AUTO, /* auto-parser */
1960
1910
CXT5051_MODELS
1961
1911
};
1962
1912
···
1969
1917
[CXT5051_F700] = "hp-700",
1970
1918
[CXT5051_TOSHIBA] = "toshiba",
1971
1919
[CXT5051_IDEAPAD] = "ideapad",
1920
1920
+
[CXT5051_AUTO] = "auto",
1972
1921
};
1973
1922
1974
1974
-
static struct snd_pci_quirk cxt5051_cfg_tbl[] = {
1923
1923
+
static const struct snd_pci_quirk cxt5051_cfg_tbl[] = {
1975
1924
SND_PCI_QUIRK(0x103c, 0x30cf, "HP DV6736", CXT5051_HP_DV6736),
1976
1925
SND_PCI_QUIRK(0x103c, 0x360b, "Compaq Presario CQ60", CXT5051_HP),
1977
1926
SND_PCI_QUIRK(0x103c, 0x30ea, "Compaq Presario F700", CXT5051_F700),
···
1989
1936
{
1990
1937
struct conexant_spec *spec;
1991
1938
int board_config;
1939
1939
+
1940
1940
+
board_config = snd_hda_check_board_config(codec, CXT5051_MODELS,
1941
1941
+
cxt5051_models,
1942
1942
+
cxt5051_cfg_tbl);
1943
1943
+
#if 0 /* use the old method just for safety */
1944
1944
+
if (board_config < 0)
1945
1945
+
board_config = CXT5051_AUTO;
1946
1946
+
#endif
1947
1947
+
if (board_config == CXT5051_AUTO)
1948
1948
+
return patch_conexant_auto(codec);
1992
1949
1993
1950
spec = kzalloc(sizeof(*spec), GFP_KERNEL);
1994
1951
if (!spec)
···
2030
1967
2031
1968
codec->patch_ops.unsol_event = cxt5051_hp_unsol_event;
2032
1969
2033
2033
-
board_config = snd_hda_check_board_config(codec, CXT5051_MODELS,
2034
2034
-
cxt5051_models,
2035
2035
-
cxt5051_cfg_tbl);
2036
1970
spec->auto_mic = AUTO_MIC_PORTB | AUTO_MIC_PORTC;
2037
1971
switch (board_config) {
2038
1972
case CXT5051_HP:
···
2071
2011
2072
2012
/* Conexant 5066 specific */
2073
2013
2074
2074
-
static hda_nid_t cxt5066_dac_nids[1] = { 0x10 };
2075
2075
-
static hda_nid_t cxt5066_adc_nids[3] = { 0x14, 0x15, 0x16 };
2076
2076
-
static hda_nid_t cxt5066_capsrc_nids[1] = { 0x17 };
2077
2077
-
static hda_nid_t cxt5066_digout_pin_nids[2] = { 0x20, 0x22 };
2014
2014
+
static const hda_nid_t cxt5066_dac_nids[1] = { 0x10 };
2015
2015
+
static const hda_nid_t cxt5066_adc_nids[3] = { 0x14, 0x15, 0x16 };
2016
2016
+
static const hda_nid_t cxt5066_capsrc_nids[1] = { 0x17 };
2017
2017
+
static const hda_nid_t cxt5066_digout_pin_nids[2] = { 0x20, 0x22 };
2078
2018
2079
2019
/* OLPC's microphone port is DC coupled for use with external sensors,
2080
2020
* therefore we use a 50% mic bias in order to center the input signal with
2081
2021
* the DC input range of the codec. */
2082
2022
#define CXT5066_OLPC_EXT_MIC_BIAS PIN_VREF50
2083
2023
2084
2084
-
static struct hda_channel_mode cxt5066_modes[1] = {
2024
2024
+
static const struct hda_channel_mode cxt5066_modes[1] = {
2085
2025
{ 2, NULL },
2086
2026
};
2087
2027
···
2236
2176
{0x23, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
2237
2177
{}
2238
2178
};
2239
2239
-
static struct hda_verb ext_mic_absent[] = {
2179
2179
+
static const struct hda_verb ext_mic_absent[] = {
2240
2180
/* enable internal mic, port C */
2241
2181
{0x23, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2242
2182
···
2269
2209
{0x23, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
2270
2210
{}
2271
2211
};
2272
2272
-
static struct hda_verb ext_mic_absent[] = {
2212
2212
+
static const struct hda_verb ext_mic_absent[] = {
2273
2213
{0x14, AC_VERB_SET_CONNECT_SEL, 2},
2274
2214
{0x23, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2275
2215
{0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
···
2317
2257
{
2318
2258
unsigned int ext_present, dock_present;
2319
2259
2320
2320
-
static struct hda_verb ext_mic_present[] = {
2260
2260
+
static const struct hda_verb ext_mic_present[] = {
2321
2261
{0x14, AC_VERB_SET_CONNECT_SEL, 0},
2322
2262
{0x17, AC_VERB_SET_CONNECT_SEL, 1},
2323
2263
{0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
···
2325
2265
{0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
2326
2266
{}
2327
2267
};
2328
2328
-
static struct hda_verb dock_mic_present[] = {
2268
2268
+
static const struct hda_verb dock_mic_present[] = {
2329
2269
{0x14, AC_VERB_SET_CONNECT_SEL, 0},
2330
2270
{0x17, AC_VERB_SET_CONNECT_SEL, 0},
2331
2271
{0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
···
2333
2273
{0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
2334
2274
{}
2335
2275
};
2336
2336
-
static struct hda_verb ext_mic_absent[] = {
2276
2276
+
static const struct hda_verb ext_mic_absent[] = {
2337
2277
{0x14, AC_VERB_SET_CONNECT_SEL, 2},
2338
2278
{0x23, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2339
2279
{0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
···
2597
2537
}
2598
2538
2599
2539
static void conexant_check_dig_outs(struct hda_codec *codec,
2600
2600
-
hda_nid_t *dig_pins,
2540
2540
+
const hda_nid_t *dig_pins,
2601
2541
int num_pins)
2602
2542
{
2603
2543
struct conexant_spec *spec = codec->spec;
···
2617
2557
}
2618
2558
}
2619
2559
2620
2620
-
static struct hda_input_mux cxt5066_capture_source = {
2560
2560
+
static const struct hda_input_mux cxt5066_capture_source = {
2621
2561
.num_items = 4,
2622
2562
.items = {
2623
2563
{ "Mic B", 0 },
···
2627
2567
},
2628
2568
};
2629
2569
2630
2630
-
static struct hda_bind_ctls cxt5066_bind_capture_vol_others = {
2570
2570
+
static const struct hda_bind_ctls cxt5066_bind_capture_vol_others = {
2631
2571
.ops = &snd_hda_bind_vol,
2632
2572
.values = {
2633
2573
HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_INPUT),
···
2636
2576
},
2637
2577
};
2638
2578
2639
2639
-
static struct hda_bind_ctls cxt5066_bind_capture_sw_others = {
2579
2579
+
static const struct hda_bind_ctls cxt5066_bind_capture_sw_others = {
2640
2580
.ops = &snd_hda_bind_sw,
2641
2581
.values = {
2642
2582
HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_INPUT),
···
2645
2585
},
2646
2586
};
2647
2587
2648
2648
-
static struct snd_kcontrol_new cxt5066_mixer_master[] = {
2588
2588
+
static const struct snd_kcontrol_new cxt5066_mixer_master[] = {
2649
2589
HDA_CODEC_VOLUME("Master Playback Volume", 0x10, 0x00, HDA_OUTPUT),
2650
2590
{}
2651
2591
};
2652
2592
2653
2653
-
static struct snd_kcontrol_new cxt5066_mixer_master_olpc[] = {
2593
2593
+
static const struct snd_kcontrol_new cxt5066_mixer_master_olpc[] = {
2654
2594
{
2655
2595
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2656
2596
.name = "Master Playback Volume",
···
2669
2609
{}
2670
2610
};
2671
2611
2672
2672
-
static struct snd_kcontrol_new cxt5066_mixer_olpc_dc[] = {
2612
2612
+
static const struct snd_kcontrol_new cxt5066_mixer_olpc_dc[] = {
2673
2613
{
2674
2614
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2675
2615
.name = "DC Mode Enable Switch",
···
2687
2627
{}
2688
2628
};
2689
2629
2690
2690
-
static struct snd_kcontrol_new cxt5066_mixers[] = {
2630
2630
+
static const struct snd_kcontrol_new cxt5066_mixers[] = {
2691
2631
{
2692
2632
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2693
2633
.name = "Master Playback Switch",
···
2710
2650
{}
2711
2651
};
2712
2652
2713
2713
-
static struct snd_kcontrol_new cxt5066_vostro_mixers[] = {
2653
2653
+
static const struct snd_kcontrol_new cxt5066_vostro_mixers[] = {
2714
2654
{
2715
2655
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2716
2656
.name = "Internal Mic Boost Capture Enum",
···
2722
2662
{}
2723
2663
};
2724
2664
2725
2725
-
static struct hda_verb cxt5066_init_verbs[] = {
2665
2665
+
static const struct hda_verb cxt5066_init_verbs[] = {
2726
2666
{0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, /* Port B */
2727
2667
{0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, /* Port C */
2728
2668
{0x1e, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Port F */
···
2777
2717
{ } /* end */
2778
2718
};
2779
2719
2780
2780
-
static struct hda_verb cxt5066_init_verbs_olpc[] = {
2720
2720
+
static const struct hda_verb cxt5066_init_verbs_olpc[] = {
2781
2721
/* Port A: headphones */
2782
2722
{0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2783
2723
{0x19, AC_VERB_SET_CONNECT_SEL, 0x00}, /* DAC1 */
···
2838
2778
{ } /* end */
2839
2779
};
2840
2780
2841
2841
-
static struct hda_verb cxt5066_init_verbs_vostro[] = {
2781
2781
+
static const struct hda_verb cxt5066_init_verbs_vostro[] = {
2842
2782
/* Port A: headphones */
2843
2783
{0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
2844
2784
{0x19, AC_VERB_SET_CONNECT_SEL, 0x00}, /* DAC1 */
···
2899
2839
{ } /* end */
2900
2840
};
2901
2841
2902
2902
-
static struct hda_verb cxt5066_init_verbs_ideapad[] = {
2842
2842
+
static const struct hda_verb cxt5066_init_verbs_ideapad[] = {
2903
2843
{0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, /* Port B */
2904
2844
{0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, /* Port C */
2905
2845
{0x1e, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Port F */
···
2949
2889
{ } /* end */
2950
2890
};
2951
2891
2952
2952
-
static struct hda_verb cxt5066_init_verbs_thinkpad[] = {
2892
2892
+
static const struct hda_verb cxt5066_init_verbs_thinkpad[] = {
2953
2893
{0x1e, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Port F */
2954
2894
{0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Port E */
2955
2895
···
3007
2947
{ } /* end */
3008
2948
};
3009
2949
3010
3010
-
static struct hda_verb cxt5066_init_verbs_portd_lo[] = {
2950
2950
+
static const struct hda_verb cxt5066_init_verbs_portd_lo[] = {
3011
2951
{0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3012
2952
{ } /* end */
3013
2953
};
3014
2954
3015
2955
3016
3016
-
static struct hda_verb cxt5066_init_verbs_hp_laptop[] = {
2956
2956
+
static const struct hda_verb cxt5066_init_verbs_hp_laptop[] = {
3017
2957
{0x14, AC_VERB_SET_CONNECT_SEL, 0x0},
3018
2958
{0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | CONEXANT_HP_EVENT},
3019
2959
{0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | CONEXANT_MIC_EVENT},
···
3057
2997
CXT5066_THINKPAD, /* Lenovo ThinkPad T410s, others? */
3058
2998
CXT5066_ASUS, /* Asus K52JU, Lenovo G560 - Int mic at 0x1a and Ext mic at 0x1b */
3059
2999
CXT5066_HP_LAPTOP, /* HP Laptop */
3000
3000
+
CXT5066_AUTO, /* BIOS auto-parser */
3060
3001
CXT5066_MODELS
3061
3002
};
3062
3003
···
3070
3009
[CXT5066_THINKPAD] = "thinkpad",
3071
3010
[CXT5066_ASUS] = "asus",
3072
3011
[CXT5066_HP_LAPTOP] = "hp-laptop",
3012
3012
+
[CXT5066_AUTO] = "auto",
3073
3013
};
3074
3014
3075
3075
-
static struct snd_pci_quirk cxt5066_cfg_tbl[] = {
3015
3015
+
static const struct snd_pci_quirk cxt5066_cfg_tbl[] = {
3076
3016
SND_PCI_QUIRK_MASK(0x1025, 0xff00, 0x0400, "Acer", CXT5066_IDEAPAD),
3077
3017
SND_PCI_QUIRK(0x1028, 0x02d8, "Dell Vostro", CXT5066_DELL_VOSTRO),
3078
3018
SND_PCI_QUIRK(0x1028, 0x02f5, "Dell Vostro 320", CXT5066_IDEAPAD),
···
3108
3046
struct conexant_spec *spec;
3109
3047
int board_config;
3110
3048
3049
3049
+
board_config = snd_hda_check_board_config(codec, CXT5066_MODELS,
3050
3050
+
cxt5066_models, cxt5066_cfg_tbl);
3051
3051
+
#if 0 /* use the old method just for safety */
3052
3052
+
if (board_config < 0)
3053
3053
+
board_config = CXT5066_AUTO;
3054
3054
+
#endif
3055
3055
+
if (board_config == CXT5066_AUTO)
3056
3056
+
return patch_conexant_auto(codec);
3057
3057
+
3111
3058
spec = kzalloc(sizeof(*spec), GFP_KERNEL);
3112
3059
if (!spec)
3113
3060
return -ENOMEM;
···
3147
3076
3148
3077
set_beep_amp(spec, 0x13, 0, HDA_OUTPUT);
3149
3078
3150
3150
-
board_config = snd_hda_check_board_config(codec, CXT5066_MODELS,
3151
3151
-
cxt5066_models, cxt5066_cfg_tbl);
3152
3079
switch (board_config) {
3153
3080
default:
3154
3081
case CXT5066_LAPTOP:
···
3264
3195
* Automatic parser for CX20641 & co
3265
3196
*/
3266
3197
3267
3267
-
static hda_nid_t cx_auto_adc_nids[] = { 0x14 };
3198
3198
+
static int cx_auto_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
3199
3199
+
struct hda_codec *codec,
3200
3200
+
unsigned int stream_tag,
3201
3201
+
unsigned int format,
3202
3202
+
struct snd_pcm_substream *substream)
3203
3203
+
{
3204
3204
+
struct conexant_spec *spec = codec->spec;
3205
3205
+
hda_nid_t adc = spec->imux_info[spec->cur_mux[0]].adc;
3206
3206
+
if (spec->adc_switching) {
3207
3207
+
spec->cur_adc = adc;
3208
3208
+
spec->cur_adc_stream_tag = stream_tag;
3209
3209
+
spec->cur_adc_format = format;
3210
3210
+
}
3211
3211
+
snd_hda_codec_setup_stream(codec, adc, stream_tag, 0, format);
3212
3212
+
return 0;
3213
3213
+
}
3214
3214
+
3215
3215
+
static int cx_auto_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
3216
3216
+
struct hda_codec *codec,
3217
3217
+
struct snd_pcm_substream *substream)
3218
3218
+
{
3219
3219
+
struct conexant_spec *spec = codec->spec;
3220
3220
+
snd_hda_codec_cleanup_stream(codec, spec->cur_adc);
3221
3221
+
spec->cur_adc = 0;
3222
3222
+
return 0;
3223
3223
+
}
3224
3224
+
3225
3225
+
static const struct hda_pcm_stream cx_auto_pcm_analog_capture = {
3226
3226
+
.substreams = 1,
3227
3227
+
.channels_min = 2,
3228
3228
+
.channels_max = 2,
3229
3229
+
.nid = 0, /* fill later */
3230
3230
+
.ops = {
3231
3231
+
.prepare = cx_auto_capture_pcm_prepare,
3232
3232
+
.cleanup = cx_auto_capture_pcm_cleanup
3233
3233
+
},
3234
3234
+
};
3235
3235
+
3236
3236
+
static const hda_nid_t cx_auto_adc_nids[] = { 0x14 };
3268
3237
3269
3238
/* get the connection index of @nid in the widget @mux */
3270
3239
static int get_connection_index(struct hda_codec *codec, hda_nid_t mux,
···
3427
3320
spec->multiout.dac_nids = spec->private_dac_nids;
3428
3321
spec->multiout.max_channels = spec->multiout.num_dacs * 2;
3429
3322
3430
3430
-
if (cfg->hp_outs > 0)
3431
3431
-
spec->auto_mute = 1;
3323
3323
+
for (i = 0; i < cfg->hp_outs; i++) {
3324
3324
+
if (is_jack_detectable(codec, cfg->hp_pins[i])) {
3325
3325
+
spec->auto_mute = 1;
3326
3326
+
break;
3327
3327
+
}
3328
3328
+
}
3329
3329
+
if (spec->auto_mute && cfg->line_out_pins[0] &&
3330
3330
+
cfg->line_out_pins[0] != cfg->hp_pins[0] &&
3331
3331
+
cfg->line_out_pins[0] != cfg->speaker_pins[0]) {
3332
3332
+
for (i = 0; i < cfg->line_outs; i++) {
3333
3333
+
if (is_jack_detectable(codec, cfg->line_out_pins[i])) {
3334
3334
+
spec->detect_line = 1;
3335
3335
+
break;
3336
3336
+
}
3337
3337
+
}
3338
3338
+
spec->automute_lines = spec->detect_line;
3339
3339
+
}
3340
3340
+
3432
3341
spec->vmaster_nid = spec->private_dac_nids[0];
3433
3342
}
3434
3343
3344
3344
+
static void cx_auto_turn_eapd(struct hda_codec *codec, int num_pins,
3345
3345
+
hda_nid_t *pins, bool on);
3346
3346
+
3347
3347
+
static void do_automute(struct hda_codec *codec, int num_pins,
3348
3348
+
hda_nid_t *pins, bool on)
3349
3349
+
{
3350
3350
+
int i;
3351
3351
+
for (i = 0; i < num_pins; i++)
3352
3352
+
snd_hda_codec_write(codec, pins[i], 0,
3353
3353
+
AC_VERB_SET_PIN_WIDGET_CONTROL,
3354
3354
+
on ? PIN_OUT : 0);
3355
3355
+
cx_auto_turn_eapd(codec, num_pins, pins, on);
3356
3356
+
}
3357
3357
+
3358
3358
+
static int detect_jacks(struct hda_codec *codec, int num_pins, hda_nid_t *pins)
3359
3359
+
{
3360
3360
+
int i, present = 0;
3361
3361
+
3362
3362
+
for (i = 0; i < num_pins; i++) {
3363
3363
+
hda_nid_t nid = pins[i];
3364
3364
+
if (!nid || !is_jack_detectable(codec, nid))
3365
3365
+
break;
3366
3366
+
snd_hda_input_jack_report(codec, nid);
3367
3367
+
present |= snd_hda_jack_detect(codec, nid);
3368
3368
+
}
3369
3369
+
return present;
3370
3370
+
}
3371
3371
+
3435
3372
/* auto-mute/unmute speaker and line outs according to headphone jack */
3373
3373
+
static void cx_auto_update_speakers(struct hda_codec *codec)
3374
3374
+
{
3375
3375
+
struct conexant_spec *spec = codec->spec;
3376
3376
+
struct auto_pin_cfg *cfg = &spec->autocfg;
3377
3377
+
int on;
3378
3378
+
3379
3379
+
if (!spec->auto_mute)
3380
3380
+
on = 0;
3381
3381
+
else
3382
3382
+
on = spec->hp_present | spec->line_present;
3383
3383
+
cx_auto_turn_eapd(codec, cfg->hp_outs, cfg->hp_pins, on);
3384
3384
+
do_automute(codec, cfg->speaker_outs, cfg->speaker_pins, !on);
3385
3385
+
3386
3386
+
/* toggle line-out mutes if needed, too */
3387
3387
+
/* if LO is a copy of either HP or Speaker, don't need to handle it */
3388
3388
+
if (cfg->line_out_pins[0] == cfg->hp_pins[0] ||
3389
3389
+
cfg->line_out_pins[0] == cfg->speaker_pins[0])
3390
3390
+
return;
3391
3391
+
if (!spec->automute_lines || !spec->auto_mute)
3392
3392
+
on = 0;
3393
3393
+
else
3394
3394
+
on = spec->hp_present;
3395
3395
+
do_automute(codec, cfg->line_outs, cfg->line_out_pins, !on);
3396
3396
+
}
3397
3397
+
3436
3398
static void cx_auto_hp_automute(struct hda_codec *codec)
3437
3399
{
3438
3400
struct conexant_spec *spec = codec->spec;
3439
3401
struct auto_pin_cfg *cfg = &spec->autocfg;
3440
3440
-
int i, present;
3441
3402
3442
3403
if (!spec->auto_mute)
3443
3404
return;
3444
3444
-
present = 0;
3445
3445
-
for (i = 0; i < cfg->hp_outs; i++) {
3446
3446
-
if (snd_hda_jack_detect(codec, cfg->hp_pins[i])) {
3447
3447
-
present = 1;
3448
3448
-
break;
3405
3405
+
spec->hp_present = detect_jacks(codec, cfg->hp_outs, cfg->hp_pins);
3406
3406
+
cx_auto_update_speakers(codec);
3407
3407
+
}
3408
3408
+
3409
3409
+
static void cx_auto_line_automute(struct hda_codec *codec)
3410
3410
+
{
3411
3411
+
struct conexant_spec *spec = codec->spec;
3412
3412
+
struct auto_pin_cfg *cfg = &spec->autocfg;
3413
3413
+
3414
3414
+
if (!spec->auto_mute || !spec->detect_line)
3415
3415
+
return;
3416
3416
+
spec->line_present = detect_jacks(codec, cfg->line_outs,
3417
3417
+
cfg->line_out_pins);
3418
3418
+
cx_auto_update_speakers(codec);
3419
3419
+
}
3420
3420
+
3421
3421
+
static int cx_automute_mode_info(struct snd_kcontrol *kcontrol,
3422
3422
+
struct snd_ctl_elem_info *uinfo)
3423
3423
+
{
3424
3424
+
struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3425
3425
+
struct conexant_spec *spec = codec->spec;
3426
3426
+
static const char * const texts2[] = {
3427
3427
+
"Disabled", "Enabled"
3428
3428
+
};
3429
3429
+
static const char * const texts3[] = {
3430
3430
+
"Disabled", "Speaker Only", "Line-Out+Speaker"
3431
3431
+
};
3432
3432
+
const char * const *texts;
3433
3433
+
3434
3434
+
uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3435
3435
+
uinfo->count = 1;
3436
3436
+
if (spec->automute_hp_lo) {
3437
3437
+
uinfo->value.enumerated.items = 3;
3438
3438
+
texts = texts3;
3439
3439
+
} else {
3440
3440
+
uinfo->value.enumerated.items = 2;
3441
3441
+
texts = texts2;
3442
3442
+
}
3443
3443
+
if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items)
3444
3444
+
uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1;
3445
3445
+
strcpy(uinfo->value.enumerated.name,
3446
3446
+
texts[uinfo->value.enumerated.item]);
3447
3447
+
return 0;
3448
3448
+
}
3449
3449
+
3450
3450
+
static int cx_automute_mode_get(struct snd_kcontrol *kcontrol,
3451
3451
+
struct snd_ctl_elem_value *ucontrol)
3452
3452
+
{
3453
3453
+
struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3454
3454
+
struct conexant_spec *spec = codec->spec;
3455
3455
+
unsigned int val;
3456
3456
+
if (!spec->auto_mute)
3457
3457
+
val = 0;
3458
3458
+
else if (!spec->automute_lines)
3459
3459
+
val = 1;
3460
3460
+
else
3461
3461
+
val = 2;
3462
3462
+
ucontrol->value.enumerated.item[0] = val;
3463
3463
+
return 0;
3464
3464
+
}
3465
3465
+
3466
3466
+
static int cx_automute_mode_put(struct snd_kcontrol *kcontrol,
3467
3467
+
struct snd_ctl_elem_value *ucontrol)
3468
3468
+
{
3469
3469
+
struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3470
3470
+
struct conexant_spec *spec = codec->spec;
3471
3471
+
3472
3472
+
switch (ucontrol->value.enumerated.item[0]) {
3473
3473
+
case 0:
3474
3474
+
if (!spec->auto_mute)
3475
3475
+
return 0;
3476
3476
+
spec->auto_mute = 0;
3477
3477
+
break;
3478
3478
+
case 1:
3479
3479
+
if (spec->auto_mute && !spec->automute_lines)
3480
3480
+
return 0;
3481
3481
+
spec->auto_mute = 1;
3482
3482
+
spec->automute_lines = 0;
3483
3483
+
break;
3484
3484
+
case 2:
3485
3485
+
if (!spec->automute_hp_lo)
3486
3486
+
return -EINVAL;
3487
3487
+
if (spec->auto_mute && spec->automute_lines)
3488
3488
+
return 0;
3489
3489
+
spec->auto_mute = 1;
3490
3490
+
spec->automute_lines = 1;
3491
3491
+
break;
3492
3492
+
default:
3493
3493
+
return -EINVAL;
3494
3494
+
}
3495
3495
+
cx_auto_update_speakers(codec);
3496
3496
+
return 1;
3497
3497
+
}
3498
3498
+
3499
3499
+
static const struct snd_kcontrol_new cx_automute_mode_enum[] = {
3500
3500
+
{
3501
3501
+
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3502
3502
+
.name = "Auto-Mute Mode",
3503
3503
+
.info = cx_automute_mode_info,
3504
3504
+
.get = cx_automute_mode_get,
3505
3505
+
.put = cx_automute_mode_put,
3506
3506
+
},
3507
3507
+
{ }
3508
3508
+
};
3509
3509
+
3510
3510
+
static int cx_auto_mux_enum_info(struct snd_kcontrol *kcontrol,
3511
3511
+
struct snd_ctl_elem_info *uinfo)
3512
3512
+
{
3513
3513
+
struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3514
3514
+
struct conexant_spec *spec = codec->spec;
3515
3515
+
3516
3516
+
return snd_hda_input_mux_info(&spec->private_imux, uinfo);
3517
3517
+
}
3518
3518
+
3519
3519
+
static int cx_auto_mux_enum_get(struct snd_kcontrol *kcontrol,
3520
3520
+
struct snd_ctl_elem_value *ucontrol)
3521
3521
+
{
3522
3522
+
struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3523
3523
+
struct conexant_spec *spec = codec->spec;
3524
3524
+
3525
3525
+
ucontrol->value.enumerated.item[0] = spec->cur_mux[0];
3526
3526
+
return 0;
3527
3527
+
}
3528
3528
+
3529
3529
+
/* look for the route the given pin from mux and return the index;
3530
3530
+
* if do_select is set, actually select the route.
3531
3531
+
*/
3532
3532
+
static int __select_input_connection(struct hda_codec *codec, hda_nid_t mux,
3533
3533
+
hda_nid_t pin, hda_nid_t *srcp,
3534
3534
+
bool do_select, int depth)
3535
3535
+
{
3536
3536
+
hda_nid_t conn[HDA_MAX_NUM_INPUTS];
3537
3537
+
int i, nums;
3538
3538
+
3539
3539
+
switch (get_wcaps_type(get_wcaps(codec, mux))) {
3540
3540
+
case AC_WID_AUD_IN:
3541
3541
+
case AC_WID_AUD_SEL:
3542
3542
+
case AC_WID_AUD_MIX:
3543
3543
+
break;
3544
3544
+
default:
3545
3545
+
return -1;
3546
3546
+
}
3547
3547
+
3548
3548
+
nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn));
3549
3549
+
for (i = 0; i < nums; i++)
3550
3550
+
if (conn[i] == pin) {
3551
3551
+
if (do_select)
3552
3552
+
snd_hda_codec_write(codec, mux, 0,
3553
3553
+
AC_VERB_SET_CONNECT_SEL, i);
3554
3554
+
if (srcp)
3555
3555
+
*srcp = mux;
3556
3556
+
return i;
3557
3557
+
}
3558
3558
+
depth++;
3559
3559
+
if (depth == 2)
3560
3560
+
return -1;
3561
3561
+
for (i = 0; i < nums; i++) {
3562
3562
+
int ret = __select_input_connection(codec, conn[i], pin, srcp,
3563
3563
+
do_select, depth);
3564
3564
+
if (ret >= 0) {
3565
3565
+
if (do_select)
3566
3566
+
snd_hda_codec_write(codec, mux, 0,
3567
3567
+
AC_VERB_SET_CONNECT_SEL, i);
3568
3568
+
return i;
3449
3569
}
3450
3570
}
3451
3451
-
for (i = 0; i < cfg->line_outs; i++) {
3452
3452
-
snd_hda_codec_write(codec, cfg->line_out_pins[i], 0,
3453
3453
-
AC_VERB_SET_PIN_WIDGET_CONTROL,
3454
3454
-
present ? 0 : PIN_OUT);
3571
3571
+
return -1;
3572
3572
+
}
3573
3573
+
3574
3574
+
static void select_input_connection(struct hda_codec *codec, hda_nid_t mux,
3575
3575
+
hda_nid_t pin)
3576
3576
+
{
3577
3577
+
__select_input_connection(codec, mux, pin, NULL, true, 0);
3578
3578
+
}
3579
3579
+
3580
3580
+
static int get_input_connection(struct hda_codec *codec, hda_nid_t mux,
3581
3581
+
hda_nid_t pin)
3582
3582
+
{
3583
3583
+
return __select_input_connection(codec, mux, pin, NULL, false, 0);
3584
3584
+
}
3585
3585
+
3586
3586
+
static int cx_auto_mux_enum_update(struct hda_codec *codec,
3587
3587
+
const struct hda_input_mux *imux,
3588
3588
+
unsigned int idx)
3589
3589
+
{
3590
3590
+
struct conexant_spec *spec = codec->spec;
3591
3591
+
hda_nid_t adc;
3592
3592
+
3593
3593
+
if (!imux->num_items)
3594
3594
+
return 0;
3595
3595
+
if (idx >= imux->num_items)
3596
3596
+
idx = imux->num_items - 1;
3597
3597
+
if (spec->cur_mux[0] == idx)
3598
3598
+
return 0;
3599
3599
+
adc = spec->imux_info[idx].adc;
3600
3600
+
select_input_connection(codec, spec->imux_info[idx].adc,
3601
3601
+
spec->imux_info[idx].pin);
3602
3602
+
if (spec->cur_adc && spec->cur_adc != adc) {
3603
3603
+
/* stream is running, let's swap the current ADC */
3604
3604
+
__snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1);
3605
3605
+
spec->cur_adc = adc;
3606
3606
+
snd_hda_codec_setup_stream(codec, adc,
3607
3607
+
spec->cur_adc_stream_tag, 0,
3608
3608
+
spec->cur_adc_format);
3455
3609
}
3456
3456
-
for (i = 0; !present && i < cfg->line_outs; i++)
3457
3457
-
if (snd_hda_jack_detect(codec, cfg->line_out_pins[i]))
3458
3458
-
present = 1;
3459
3459
-
for (i = 0; i < cfg->speaker_outs; i++) {
3460
3460
-
snd_hda_codec_write(codec, cfg->speaker_pins[i], 0,
3461
3461
-
AC_VERB_SET_PIN_WIDGET_CONTROL,
3462
3462
-
present ? 0 : PIN_OUT);
3463
3463
-
}
3610
3610
+
spec->cur_mux[0] = idx;
3611
3611
+
return 1;
3612
3612
+
}
3613
3613
+
3614
3614
+
static int cx_auto_mux_enum_put(struct snd_kcontrol *kcontrol,
3615
3615
+
struct snd_ctl_elem_value *ucontrol)
3616
3616
+
{
3617
3617
+
struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3618
3618
+
struct conexant_spec *spec = codec->spec;
3619
3619
+
3620
3620
+
return cx_auto_mux_enum_update(codec, &spec->private_imux,
3621
3621
+
ucontrol->value.enumerated.item[0]);
3622
3622
+
}
3623
3623
+
3624
3624
+
static const struct snd_kcontrol_new cx_auto_capture_mixers[] = {
3625
3625
+
{
3626
3626
+
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3627
3627
+
.name = "Capture Source",
3628
3628
+
.info = cx_auto_mux_enum_info,
3629
3629
+
.get = cx_auto_mux_enum_get,
3630
3630
+
.put = cx_auto_mux_enum_put
3631
3631
+
},
3632
3632
+
{}
3633
3633
+
};
3634
3634
+
3635
3635
+
static bool select_automic(struct hda_codec *codec, int idx, bool detect)
3636
3636
+
{
3637
3637
+
struct conexant_spec *spec = codec->spec;
3638
3638
+
if (idx < 0)
3639
3639
+
return false;
3640
3640
+
if (detect && !snd_hda_jack_detect(codec, spec->imux_info[idx].pin))
3641
3641
+
return false;
3642
3642
+
cx_auto_mux_enum_update(codec, &spec->private_imux, idx);
3643
3643
+
return true;
3464
3644
}
3465
3645
3466
3646
/* automatic switch internal and external mic */
3467
3647
static void cx_auto_automic(struct hda_codec *codec)
3468
3648
{
3469
3649
struct conexant_spec *spec = codec->spec;
3470
3470
-
struct auto_pin_cfg *cfg = &spec->autocfg;
3471
3471
-
struct hda_input_mux *imux = &spec->private_imux;
3472
3472
-
int ext_idx = spec->auto_mic_ext;
3473
3650
3474
3651
if (!spec->auto_mic)
3475
3652
return;
3476
3476
-
if (snd_hda_jack_detect(codec, cfg->inputs[ext_idx].pin)) {
3477
3477
-
snd_hda_codec_write(codec, spec->adc_nids[0], 0,
3478
3478
-
AC_VERB_SET_CONNECT_SEL,
3479
3479
-
imux->items[ext_idx].index);
3480
3480
-
} else {
3481
3481
-
snd_hda_codec_write(codec, spec->adc_nids[0], 0,
3482
3482
-
AC_VERB_SET_CONNECT_SEL,
3483
3483
-
imux->items[!ext_idx].index);
3484
3484
-
}
3653
3653
+
if (!select_automic(codec, spec->auto_mic_ext, true))
3654
3654
+
if (!select_automic(codec, spec->auto_mic_dock, true))
3655
3655
+
select_automic(codec, spec->auto_mic_int, false);
3485
3656
}
3486
3657
3487
3658
static void cx_auto_unsol_event(struct hda_codec *codec, unsigned int res)
···
3768
3383
switch (res >> 26) {
3769
3384
case CONEXANT_HP_EVENT:
3770
3385
cx_auto_hp_automute(codec);
3771
3771
-
snd_hda_input_jack_report(codec, nid);
3386
3386
+
break;
3387
3387
+
case CONEXANT_LINE_EVENT:
3388
3388
+
cx_auto_line_automute(codec);
3772
3389
break;
3773
3390
case CONEXANT_MIC_EVENT:
3774
3391
cx_auto_automic(codec);
···
3779
3392
}
3780
3393
}
3781
3394
3782
3782
-
/* return true if it's an internal-mic pin */
3783
3783
-
static int is_int_mic(struct hda_codec *codec, hda_nid_t pin)
3784
3784
-
{
3785
3785
-
unsigned int def_conf = snd_hda_codec_get_pincfg(codec, pin);
3786
3786
-
return get_defcfg_device(def_conf) == AC_JACK_MIC_IN &&
3787
3787
-
snd_hda_get_input_pin_attr(def_conf) == INPUT_PIN_ATTR_INT;
3788
3788
-
}
3789
3789
-
3790
3790
-
/* return true if it's an external-mic pin */
3791
3791
-
static int is_ext_mic(struct hda_codec *codec, hda_nid_t pin)
3792
3792
-
{
3793
3793
-
unsigned int def_conf = snd_hda_codec_get_pincfg(codec, pin);
3794
3794
-
return get_defcfg_device(def_conf) == AC_JACK_MIC_IN &&
3795
3795
-
snd_hda_get_input_pin_attr(def_conf) >= INPUT_PIN_ATTR_NORMAL &&
3796
3796
-
(snd_hda_query_pin_caps(codec, pin) & AC_PINCAP_PRES_DETECT);
3797
3797
-
}
3798
3798
-
3799
3395
/* check whether the pin config is suitable for auto-mic switching;
3800
3800
-
* auto-mic is enabled only when one int-mic and one-ext mic exist
3396
3396
+
* auto-mic is enabled only when one int-mic and one ext- and/or
3397
3397
+
* one dock-mic exist
3801
3398
*/
3802
3399
static void cx_auto_check_auto_mic(struct hda_codec *codec)
3803
3400
{
3804
3401
struct conexant_spec *spec = codec->spec;
3805
3805
-
struct auto_pin_cfg *cfg = &spec->autocfg;
3402
3402
+
int pset[INPUT_PIN_ATTR_NORMAL + 1];
3403
3403
+
int i;
3806
3404
3807
3807
-
if (is_ext_mic(codec, cfg->inputs[0].pin) &&
3808
3808
-
is_int_mic(codec, cfg->inputs[1].pin)) {
3809
3809
-
spec->auto_mic = 1;
3810
3810
-
spec->auto_mic_ext = 1;
3811
3811
-
return;
3405
3405
+
for (i = 0; i < INPUT_PIN_ATTR_NORMAL; i++)
3406
3406
+
pset[i] = -1;
3407
3407
+
for (i = 0; i < spec->private_imux.num_items; i++) {
3408
3408
+
hda_nid_t pin = spec->imux_info[i].pin;
3409
3409
+
unsigned int def_conf = snd_hda_codec_get_pincfg(codec, pin);
3410
3410
+
int type, attr;
3411
3411
+
attr = snd_hda_get_input_pin_attr(def_conf);
3412
3412
+
if (attr == INPUT_PIN_ATTR_UNUSED)
3413
3413
+
return; /* invalid entry */
3414
3414
+
if (attr > INPUT_PIN_ATTR_NORMAL)
3415
3415
+
attr = INPUT_PIN_ATTR_NORMAL;
3416
3416
+
if (attr != INPUT_PIN_ATTR_INT &&
3417
3417
+
!is_jack_detectable(codec, pin))
3418
3418
+
return; /* non-detectable pin */
3419
3419
+
type = get_defcfg_device(def_conf);
3420
3420
+
if (type != AC_JACK_MIC_IN &&
3421
3421
+
(attr != INPUT_PIN_ATTR_DOCK || type != AC_JACK_LINE_IN))
3422
3422
+
return; /* no valid input type */
3423
3423
+
if (pset[attr] >= 0)
3424
3424
+
return; /* already occupied */
3425
3425
+
pset[attr] = i;
3812
3426
}
3813
3813
-
if (is_int_mic(codec, cfg->inputs[1].pin) &&
3814
3814
-
is_ext_mic(codec, cfg->inputs[0].pin)) {
3815
3815
-
spec->auto_mic = 1;
3816
3816
-
spec->auto_mic_ext = 0;
3817
3817
-
return;
3818
3818
-
}
3427
3427
+
if (pset[INPUT_PIN_ATTR_INT] < 0 ||
3428
3428
+
(pset[INPUT_PIN_ATTR_NORMAL] < 0 && pset[INPUT_PIN_ATTR_DOCK]))
3429
3429
+
return; /* no input to switch*/
3430
3430
+
spec->auto_mic = 1;
3431
3431
+
spec->auto_mic_ext = pset[INPUT_PIN_ATTR_NORMAL];
3432
3432
+
spec->auto_mic_dock = pset[INPUT_PIN_ATTR_DOCK];
3433
3433
+
spec->auto_mic_int = pset[INPUT_PIN_ATTR_INT];
3819
3434
}
3820
3435
3821
3436
static void cx_auto_parse_input(struct hda_codec *codec)
···
3825
3436
struct conexant_spec *spec = codec->spec;
3826
3437
struct auto_pin_cfg *cfg = &spec->autocfg;
3827
3438
struct hda_input_mux *imux;
3828
3828
-
int i;
3439
3439
+
int i, j;
3829
3440
3830
3441
imux = &spec->private_imux;
3831
3442
for (i = 0; i < cfg->num_inputs; i++) {
3832
3832
-
int idx = get_connection_index(codec, spec->adc_nids[0],
3833
3833
-
cfg->inputs[i].pin);
3834
3834
-
if (idx >= 0) {
3835
3835
-
const char *label;
3836
3836
-
label = hda_get_autocfg_input_label(codec, cfg, i);
3837
3837
-
snd_hda_add_imux_item(imux, label, idx, NULL);
3443
3443
+
for (j = 0; j < spec->num_adc_nids; j++) {
3444
3444
+
hda_nid_t adc = spec->adc_nids[j];
3445
3445
+
int idx = get_input_connection(codec, adc,
3446
3446
+
cfg->inputs[i].pin);
3447
3447
+
if (idx >= 0) {
3448
3448
+
const char *label;
3449
3449
+
label = hda_get_autocfg_input_label(codec, cfg, i);
3450
3450
+
spec->imux_info[imux->num_items].index = i;
3451
3451
+
spec->imux_info[imux->num_items].boost = 0;
3452
3452
+
spec->imux_info[imux->num_items].adc = adc;
3453
3453
+
spec->imux_info[imux->num_items].pin =
3454
3454
+
cfg->inputs[i].pin;
3455
3455
+
snd_hda_add_imux_item(imux, label, idx, NULL);
3456
3456
+
break;
3457
3457
+
}
3838
3458
}
3839
3459
}
3840
3840
-
if (imux->num_items == 2 && cfg->num_inputs == 2)
3460
3460
+
if (imux->num_items >= 2 && cfg->num_inputs == imux->num_items)
3841
3461
cx_auto_check_auto_mic(codec);
3842
3842
-
if (imux->num_items > 1 && !spec->auto_mic)
3843
3843
-
spec->input_mux = imux;
3462
3462
+
if (imux->num_items > 1 && !spec->auto_mic) {
3463
3463
+
for (i = 1; i < imux->num_items; i++) {
3464
3464
+
if (spec->imux_info[i].adc != spec->imux_info[0].adc) {
3465
3465
+
spec->adc_switching = 1;
3466
3466
+
break;
3467
3467
+
}
3468
3468
+
}
3469
3469
+
}
3844
3470
}
3845
3471
3846
3472
/* get digital-input audio widget corresponding to the given pin */
···
3921
3517
return 0;
3922
3518
}
3923
3519
3924
3924
-
static void cx_auto_turn_on_eapd(struct hda_codec *codec, int num_pins,
3925
3925
-
hda_nid_t *pins)
3520
3520
+
static void cx_auto_turn_eapd(struct hda_codec *codec, int num_pins,
3521
3521
+
hda_nid_t *pins, bool on)
3926
3522
{
3927
3523
int i;
3928
3524
for (i = 0; i < num_pins; i++) {
3929
3525
if (snd_hda_query_pin_caps(codec, pins[i]) & AC_PINCAP_EAPD)
3930
3526
snd_hda_codec_write(codec, pins[i], 0,
3931
3931
-
AC_VERB_SET_EAPD_BTLENABLE, 0x02);
3527
3527
+
AC_VERB_SET_EAPD_BTLENABLE,
3528
3528
+
on ? 0x02 : 0);
3932
3529
}
3933
3530
}
3934
3531
···
3942
3537
AC_VERB_SET_CONNECT_SEL, idx);
3943
3538
}
3944
3539
3540
3540
+
static void mute_outputs(struct hda_codec *codec, int num_nids,
3541
3541
+
const hda_nid_t *nids)
3542
3542
+
{
3543
3543
+
int i, val;
3544
3544
+
3545
3545
+
for (i = 0; i < num_nids; i++) {
3546
3546
+
hda_nid_t nid = nids[i];
3547
3547
+
if (!(get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
3548
3548
+
continue;
3549
3549
+
if (query_amp_caps(codec, nid, HDA_OUTPUT) & AC_AMPCAP_MUTE)
3550
3550
+
val = AMP_OUT_MUTE;
3551
3551
+
else
3552
3552
+
val = AMP_OUT_ZERO;
3553
3553
+
snd_hda_codec_write(codec, nid, 0,
3554
3554
+
AC_VERB_SET_AMP_GAIN_MUTE, val);
3555
3555
+
}
3556
3556
+
}
3557
3557
+
3558
3558
+
static void enable_unsol_pins(struct hda_codec *codec, int num_pins,
3559
3559
+
hda_nid_t *pins, unsigned int tag)
3560
3560
+
{
3561
3561
+
int i;
3562
3562
+
for (i = 0; i < num_pins; i++)
3563
3563
+
snd_hda_codec_write(codec, pins[i], 0,
3564
3564
+
AC_VERB_SET_UNSOLICITED_ENABLE,
3565
3565
+
AC_USRSP_EN | tag);
3566
3566
+
}
3567
3567
+
3945
3568
static void cx_auto_init_output(struct hda_codec *codec)
3946
3569
{
3947
3570
struct conexant_spec *spec = codec->spec;
···
3977
3544
hda_nid_t nid;
3978
3545
int i;
3979
3546
3980
3980
-
for (i = 0; i < spec->multiout.num_dacs; i++)
3981
3981
-
snd_hda_codec_write(codec, spec->multiout.dac_nids[i], 0,
3982
3982
-
AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3983
3983
-
3547
3547
+
mute_outputs(codec, spec->multiout.num_dacs, spec->multiout.dac_nids);
3984
3548
for (i = 0; i < cfg->hp_outs; i++)
3985
3549
snd_hda_codec_write(codec, cfg->hp_pins[i], 0,
3986
3550
AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP);
3987
3987
-
if (spec->auto_mute) {
3988
3988
-
for (i = 0; i < cfg->hp_outs; i++) {
3989
3989
-
snd_hda_codec_write(codec, cfg->hp_pins[i], 0,
3990
3990
-
AC_VERB_SET_UNSOLICITED_ENABLE,
3991
3991
-
AC_USRSP_EN | CONEXANT_HP_EVENT);
3992
3992
-
}
3993
3993
-
cx_auto_hp_automute(codec);
3994
3994
-
} else {
3995
3995
-
for (i = 0; i < cfg->line_outs; i++)
3996
3996
-
snd_hda_codec_write(codec, cfg->line_out_pins[i], 0,
3997
3997
-
AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3998
3998
-
for (i = 0; i < cfg->speaker_outs; i++)
3999
3999
-
snd_hda_codec_write(codec, cfg->speaker_pins[i], 0,
4000
4000
-
AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
4001
4001
-
}
4002
4002
-
3551
3551
+
mute_outputs(codec, cfg->hp_outs, cfg->hp_pins);
3552
3552
+
mute_outputs(codec, cfg->line_outs, cfg->line_out_pins);
3553
3553
+
mute_outputs(codec, cfg->speaker_outs, cfg->speaker_pins);
4003
3554
for (i = 0; i < spec->dac_info_filled; i++) {
4004
3555
nid = spec->dac_info[i].dac;
4005
3556
if (!nid)
4006
3557
nid = spec->multiout.dac_nids[0];
4007
3558
select_connection(codec, spec->dac_info[i].pin, nid);
4008
3559
}
4009
4009
-
4010
4010
-
/* turn on EAPD */
4011
4011
-
cx_auto_turn_on_eapd(codec, cfg->line_outs, cfg->line_out_pins);
4012
4012
-
cx_auto_turn_on_eapd(codec, cfg->hp_outs, cfg->hp_pins);
4013
4013
-
cx_auto_turn_on_eapd(codec, cfg->speaker_outs, cfg->speaker_pins);
3560
3560
+
if (spec->auto_mute) {
3561
3561
+
enable_unsol_pins(codec, cfg->hp_outs, cfg->hp_pins,
3562
3562
+
CONEXANT_HP_EVENT);
3563
3563
+
spec->hp_present = detect_jacks(codec, cfg->hp_outs,
3564
3564
+
cfg->hp_pins);
3565
3565
+
if (spec->detect_line) {
3566
3566
+
enable_unsol_pins(codec, cfg->line_outs,
3567
3567
+
cfg->line_out_pins,
3568
3568
+
CONEXANT_LINE_EVENT);
3569
3569
+
spec->line_present =
3570
3570
+
detect_jacks(codec, cfg->line_outs,
3571
3571
+
cfg->line_out_pins);
3572
3572
+
}
3573
3573
+
}
3574
3574
+
cx_auto_update_speakers(codec);
4014
3575
}
4015
3576
4016
3577
static void cx_auto_init_input(struct hda_codec *codec)
4017
3578
{
4018
3579
struct conexant_spec *spec = codec->spec;
4019
3580
struct auto_pin_cfg *cfg = &spec->autocfg;
4020
4020
-
int i;
3581
3581
+
int i, val;
4021
3582
4022
4022
-
for (i = 0; i < spec->num_adc_nids; i++)
4023
4023
-
snd_hda_codec_write(codec, spec->adc_nids[i], 0,
4024
4024
-
AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0));
3583
3583
+
for (i = 0; i < spec->num_adc_nids; i++) {
3584
3584
+
hda_nid_t nid = spec->adc_nids[i];
3585
3585
+
if (!(get_wcaps(codec, nid) & AC_WCAP_IN_AMP))
3586
3586
+
continue;
3587
3587
+
if (query_amp_caps(codec, nid, HDA_INPUT) & AC_AMPCAP_MUTE)
3588
3588
+
val = AMP_IN_MUTE(0);
3589
3589
+
else
3590
3590
+
val = AMP_IN_UNMUTE(0);
3591
3591
+
snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
3592
3592
+
val);
3593
3593
+
}
4025
3594
4026
3595
for (i = 0; i < cfg->num_inputs; i++) {
4027
3596
unsigned int type;
···
4036
3601
}
4037
3602
4038
3603
if (spec->auto_mic) {
4039
4039
-
int ext_idx = spec->auto_mic_ext;
4040
4040
-
snd_hda_codec_write(codec, cfg->inputs[ext_idx].pin, 0,
4041
4041
-
AC_VERB_SET_UNSOLICITED_ENABLE,
4042
4042
-
AC_USRSP_EN | CONEXANT_MIC_EVENT);
3604
3604
+
if (spec->auto_mic_ext >= 0) {
3605
3605
+
snd_hda_codec_write(codec,
3606
3606
+
cfg->inputs[spec->auto_mic_ext].pin, 0,
3607
3607
+
AC_VERB_SET_UNSOLICITED_ENABLE,
3608
3608
+
AC_USRSP_EN | CONEXANT_MIC_EVENT);
3609
3609
+
}
3610
3610
+
if (spec->auto_mic_dock >= 0) {
3611
3611
+
snd_hda_codec_write(codec,
3612
3612
+
cfg->inputs[spec->auto_mic_dock].pin, 0,
3613
3613
+
AC_VERB_SET_UNSOLICITED_ENABLE,
3614
3614
+
AC_USRSP_EN | CONEXANT_MIC_EVENT);
3615
3615
+
}
4043
3616
cx_auto_automic(codec);
4044
3617
} else {
4045
4045
-
for (i = 0; i < spec->num_adc_nids; i++) {
4046
4046
-
snd_hda_codec_write(codec, spec->adc_nids[i], 0,
4047
4047
-
AC_VERB_SET_CONNECT_SEL,
4048
4048
-
spec->private_imux.items[0].index);
4049
4049
-
}
3618
3618
+
select_input_connection(codec, spec->imux_info[0].adc,
3619
3619
+
spec->imux_info[0].pin);
4050
3620
}
4051
3621
}
4052
3622
···
4086
3646
HDA_CODEC_VOLUME(name, 0, 0, 0),
4087
3647
HDA_CODEC_MUTE(name, 0, 0, 0),
4088
3648
};
4089
4089
-
static char *sfx[2] = { "Volume", "Switch" };
3649
3649
+
static const char * const sfx[2] = { "Volume", "Switch" };
4090
3650
int i, err;
4091
3651
4092
3652
for (i = 0; i < 2; i++) {
···
4114
3674
#define cx_auto_add_pb_volume(codec, nid, str, idx) \
4115
3675
cx_auto_add_volume(codec, str, " Playback", idx, nid, HDA_OUTPUT)
4116
3676
3677
3677
+
static int try_add_pb_volume(struct hda_codec *codec, hda_nid_t dac,
3678
3678
+
hda_nid_t pin, const char *name, int idx)
3679
3679
+
{
3680
3680
+
unsigned int caps;
3681
3681
+
caps = query_amp_caps(codec, dac, HDA_OUTPUT);
3682
3682
+
if (caps & AC_AMPCAP_NUM_STEPS)
3683
3683
+
return cx_auto_add_pb_volume(codec, dac, name, idx);
3684
3684
+
caps = query_amp_caps(codec, pin, HDA_OUTPUT);
3685
3685
+
if (caps & AC_AMPCAP_NUM_STEPS)
3686
3686
+
return cx_auto_add_pb_volume(codec, pin, name, idx);
3687
3687
+
return 0;
3688
3688
+
}
3689
3689
+
4117
3690
static int cx_auto_build_output_controls(struct hda_codec *codec)
4118
3691
{
4119
3692
struct conexant_spec *spec = codec->spec;
···
4135
3682
static const char * const texts[3] = { "Front", "Surround", "CLFE" };
4136
3683
4137
3684
if (spec->dac_info_filled == 1)
4138
4138
-
return cx_auto_add_pb_volume(codec, spec->dac_info[0].dac,
4139
4139
-
"Master", 0);
3685
3685
+
return try_add_pb_volume(codec, spec->dac_info[0].dac,
3686
3686
+
spec->dac_info[0].pin,
3687
3687
+
"Master", 0);
3688
3688
+
4140
3689
for (i = 0; i < spec->dac_info_filled; i++) {
4141
3690
const char *label;
4142
3691
int idx, type;
···
4162
3707
idx = num_spk++;
4163
3708
break;
4164
3709
}
4165
4165
-
err = cx_auto_add_pb_volume(codec, spec->dac_info[i].dac,
4166
4166
-
label, idx);
3710
3710
+
err = try_add_pb_volume(codec, spec->dac_info[i].dac,
3711
3711
+
spec->dac_info[i].pin,
3712
3712
+
label, idx);
4167
3713
if (err < 0)
4168
3714
return err;
3715
3715
+
}
3716
3716
+
3717
3717
+
if (spec->auto_mute) {
3718
3718
+
err = snd_hda_add_new_ctls(codec, cx_automute_mode_enum);
3719
3719
+
if (err < 0)
3720
3720
+
return err;
3721
3721
+
}
3722
3722
+
3723
3723
+
return 0;
3724
3724
+
}
3725
3725
+
3726
3726
+
static int cx_auto_add_capture_volume(struct hda_codec *codec, hda_nid_t nid,
3727
3727
+
const char *label, const char *pfx,
3728
3728
+
int cidx)
3729
3729
+
{
3730
3730
+
struct conexant_spec *spec = codec->spec;
3731
3731
+
int i;
3732
3732
+
3733
3733
+
for (i = 0; i < spec->num_adc_nids; i++) {
3734
3734
+
hda_nid_t adc_nid = spec->adc_nids[i];
3735
3735
+
int idx = get_input_connection(codec, adc_nid, nid);
3736
3736
+
if (idx < 0)
3737
3737
+
continue;
3738
3738
+
return cx_auto_add_volume_idx(codec, label, pfx,
3739
3739
+
cidx, adc_nid, HDA_INPUT, idx);
3740
3740
+
}
3741
3741
+
return 0;
3742
3742
+
}
3743
3743
+
3744
3744
+
static int cx_auto_add_boost_volume(struct hda_codec *codec, int idx,
3745
3745
+
const char *label, int cidx)
3746
3746
+
{
3747
3747
+
struct conexant_spec *spec = codec->spec;
3748
3748
+
hda_nid_t mux, nid;
3749
3749
+
int i, con;
3750
3750
+
3751
3751
+
nid = spec->imux_info[idx].pin;
3752
3752
+
if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
3753
3753
+
return cx_auto_add_volume(codec, label, " Boost", cidx,
3754
3754
+
nid, HDA_INPUT);
3755
3755
+
con = __select_input_connection(codec, spec->imux_info[idx].adc, nid,
3756
3756
+
&mux, false, 0);
3757
3757
+
if (con < 0)
3758
3758
+
return 0;
3759
3759
+
for (i = 0; i < idx; i++) {
3760
3760
+
if (spec->imux_info[i].boost == mux)
3761
3761
+
return 0; /* already present */
3762
3762
+
}
3763
3763
+
3764
3764
+
if (get_wcaps(codec, mux) & AC_WCAP_OUT_AMP) {
3765
3765
+
spec->imux_info[idx].boost = mux;
3766
3766
+
return cx_auto_add_volume(codec, label, " Boost", 0,
3767
3767
+
mux, HDA_OUTPUT);
4169
3768
}
4170
3769
return 0;
4171
3770
}
···
4227
3718
static int cx_auto_build_input_controls(struct hda_codec *codec)
4228
3719
{
4229
3720
struct conexant_spec *spec = codec->spec;
4230
4230
-
struct auto_pin_cfg *cfg = &spec->autocfg;
4231
4231
-
static const char *prev_label;
4232
4232
-
int i, err, cidx, conn_len;
4233
4233
-
hda_nid_t conn[HDA_MAX_CONNECTIONS];
3721
3721
+
struct hda_input_mux *imux = &spec->private_imux;
3722
3722
+
const char *prev_label;
3723
3723
+
int input_conn[HDA_MAX_NUM_INPUTS];
3724
3724
+
int i, err, cidx;
3725
3725
+
int multi_connection;
4234
3726
4235
4235
-
int multi_adc_volume = 0; /* If the ADC nid has several input volumes */
4236
4236
-
int adc_nid = spec->adc_nids[0];
4237
4237
-
4238
4238
-
conn_len = snd_hda_get_connections(codec, adc_nid, conn,
4239
4239
-
HDA_MAX_CONNECTIONS);
4240
4240
-
if (conn_len < 0)
4241
4241
-
return conn_len;
4242
4242
-
4243
4243
-
multi_adc_volume = cfg->num_inputs > 1 && conn_len > 1;
4244
4244
-
if (!multi_adc_volume) {
4245
4245
-
err = cx_auto_add_volume(codec, "Capture", "", 0, adc_nid,
4246
4246
-
HDA_INPUT);
4247
4247
-
if (err < 0)
4248
4248
-
return err;
3727
3727
+
multi_connection = 0;
3728
3728
+
for (i = 0; i < imux->num_items; i++) {
3729
3729
+
cidx = get_input_connection(codec, spec->imux_info[i].adc,
3730
3730
+
spec->imux_info[i].pin);
3731
3731
+
input_conn[i] = (spec->imux_info[i].adc << 8) | cidx;
3732
3732
+
if (i > 0 && input_conn[i] != input_conn[0])
3733
3733
+
multi_connection = 1;
4249
3734
}
4250
3735
4251
3736
prev_label = NULL;
4252
3737
cidx = 0;
4253
4253
-
for (i = 0; i < cfg->num_inputs; i++) {
4254
4254
-
hda_nid_t nid = cfg->inputs[i].pin;
3738
3738
+
for (i = 0; i < imux->num_items; i++) {
3739
3739
+
hda_nid_t nid = spec->imux_info[i].pin;
4255
3740
const char *label;
4256
4256
-
int j;
4257
4257
-
int pin_amp = get_wcaps(codec, nid) & AC_WCAP_IN_AMP;
4258
4258
-
if (!pin_amp && !multi_adc_volume)
4259
4259
-
continue;
4260
3741
4261
4261
-
label = hda_get_autocfg_input_label(codec, cfg, i);
3742
3742
+
label = hda_get_autocfg_input_label(codec, &spec->autocfg,
3743
3743
+
spec->imux_info[i].index);
4262
3744
if (label == prev_label)
4263
3745
cidx++;
4264
3746
else
4265
3747
cidx = 0;
4266
3748
prev_label = label;
4267
3749
4268
4268
-
if (pin_amp) {
4269
4269
-
err = cx_auto_add_volume(codec, label, " Boost", cidx,
4270
4270
-
nid, HDA_INPUT);
4271
4271
-
if (err < 0)
4272
4272
-
return err;
4273
4273
-
}
3750
3750
+
err = cx_auto_add_boost_volume(codec, i, label, cidx);
3751
3751
+
if (err < 0)
3752
3752
+
return err;
4274
3753
4275
4275
-
if (!multi_adc_volume)
4276
4276
-
continue;
4277
4277
-
for (j = 0; j < conn_len; j++) {
4278
4278
-
if (conn[j] == nid) {
4279
4279
-
err = cx_auto_add_volume_idx(codec, label,
4280
4280
-
" Capture", cidx, adc_nid, HDA_INPUT, j);
4281
4281
-
if (err < 0)
4282
4282
-
return err;
4283
4283
-
break;
4284
4284
-
}
3754
3754
+
if (!multi_connection) {
3755
3755
+
if (i > 0)
3756
3756
+
continue;
3757
3757
+
err = cx_auto_add_capture_volume(codec, nid,
3758
3758
+
"Capture", "", cidx);
3759
3759
+
} else {
3760
3760
+
err = cx_auto_add_capture_volume(codec, nid,
3761
3761
+
label, " Capture", cidx);
4285
3762
}
3763
3763
+
if (err < 0)
3764
3764
+
return err;
4286
3765
}
3766
3766
+
3767
3767
+
if (spec->private_imux.num_items > 1 && !spec->auto_mic) {
3768
3768
+
err = snd_hda_add_new_ctls(codec, cx_auto_capture_mixers);
3769
3769
+
if (err < 0)
3770
3770
+
return err;
3771
3771
+
}
3772
3772
+
4287
3773
return 0;
4288
3774
}
4289
3775
···
4295
3791
return conexant_build_controls(codec);
4296
3792
}
4297
3793
4298
4298
-
static struct hda_codec_ops cx_auto_patch_ops = {
3794
3794
+
static int cx_auto_search_adcs(struct hda_codec *codec)
3795
3795
+
{
3796
3796
+
struct conexant_spec *spec = codec->spec;
3797
3797
+
hda_nid_t nid, end_nid;
3798
3798
+
3799
3799
+
end_nid = codec->start_nid + codec->num_nodes;
3800
3800
+
for (nid = codec->start_nid; nid < end_nid; nid++) {
3801
3801
+
unsigned int caps = get_wcaps(codec, nid);
3802
3802
+
if (get_wcaps_type(caps) != AC_WID_AUD_IN)
3803
3803
+
continue;
3804
3804
+
if (caps & AC_WCAP_DIGITAL)
3805
3805
+
continue;
3806
3806
+
if (snd_BUG_ON(spec->num_adc_nids >=
3807
3807
+
ARRAY_SIZE(spec->private_adc_nids)))
3808
3808
+
break;
3809
3809
+
spec->private_adc_nids[spec->num_adc_nids++] = nid;
3810
3810
+
}
3811
3811
+
spec->adc_nids = spec->private_adc_nids;
3812
3812
+
return 0;
3813
3813
+
}
3814
3814
+
3815
3815
+
3816
3816
+
static const struct hda_codec_ops cx_auto_patch_ops = {
4299
3817
.build_controls = cx_auto_build_controls,
4300
3818
.build_pcms = conexant_build_pcms,
4301
3819
.init = cx_auto_init,
···
4334
3808
struct conexant_spec *spec;
4335
3809
int err;
4336
3810
3811
3811
+
printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
3812
3812
+
codec->chip_name);
3813
3813
+
4337
3814
spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4338
3815
if (!spec)
4339
3816
return -ENOMEM;
4340
3817
codec->spec = spec;
4341
4341
-
spec->adc_nids = cx_auto_adc_nids;
4342
4342
-
spec->num_adc_nids = ARRAY_SIZE(cx_auto_adc_nids);
4343
4343
-
spec->capsrc_nids = spec->adc_nids;
3818
3818
+
codec->pin_amp_workaround = 1;
3819
3819
+
err = cx_auto_search_adcs(codec);
3820
3820
+
if (err < 0)
3821
3821
+
return err;
4344
3822
err = cx_auto_parse_auto_config(codec);
4345
3823
if (err < 0) {
4346
3824
kfree(codec->spec);
4347
3825
codec->spec = NULL;
4348
3826
return err;
4349
3827
}
3828
3828
+
spec->capture_stream = &cx_auto_pcm_analog_capture;
4350
3829
codec->patch_ops = cx_auto_patch_ops;
4351
3830
if (spec->beep_amp)
4352
3831
snd_hda_attach_beep_device(codec, spec->beep_amp);
···
4361
3830
/*
4362
3831
*/
4363
3832
4364
4364
-
static struct hda_codec_preset snd_hda_preset_conexant[] = {
3833
3833
+
static const struct hda_codec_preset snd_hda_preset_conexant[] = {
4365
3834
{ .id = 0x14f15045, .name = "CX20549 (Venice)",
4366
3835
.patch = patch_cxt5045 },
4367
3836
{ .id = 0x14f15047, .name = "CX20551 (Waikiki)",
+26
-13
sound/pci/hda/patch_hdmi.c
reviewed
···
33
33
#include <linux/slab.h>
34
34
#include <linux/moduleparam.h>
35
35
#include <sound/core.h>
36
36
+
#include <sound/jack.h>
36
37
#include "hda_codec.h"
37
38
#include "hda_local.h"
38
39
···
77
76
* ati/nvhdmi specific
78
77
*/
79
78
struct hda_multi_out multiout;
80
80
-
struct hda_pcm_stream *pcm_playback;
79
79
+
const struct hda_pcm_stream *pcm_playback;
81
80
82
81
/* misc flags */
83
82
/* PD bit indicates only the update, not the current state */
···
721
720
&spec->sink_eld[index]);
722
721
/* TODO: do real things about ELD */
723
722
}
723
723
+
724
724
+
snd_hda_input_jack_report(codec, tag);
724
725
}
725
726
726
727
static void hdmi_non_intrinsic_event(struct hda_codec *codec, unsigned int res)
···
915
912
static int hdmi_add_pin(struct hda_codec *codec, hda_nid_t pin_nid)
916
913
{
917
914
struct hdmi_spec *spec = codec->spec;
915
915
+
int err;
918
916
919
917
if (spec->num_pins >= MAX_HDMI_PINS) {
920
918
snd_printk(KERN_WARNING
921
919
"HDMI: no space for pin %d\n", pin_nid);
922
920
return -E2BIG;
923
921
}
922
922
+
923
923
+
err = snd_hda_input_jack_add(codec, pin_nid,
924
924
+
SND_JACK_VIDEOOUT, NULL);
925
925
+
if (err < 0)
926
926
+
return err;
927
927
+
snd_hda_input_jack_report(codec, pin_nid);
924
928
925
929
hdmi_present_sense(codec, pin_nid, &spec->sink_eld[spec->num_pins]);
926
930
···
1054
1044
return hdmi_setup_stream(codec, hinfo->nid, stream_tag, format);
1055
1045
}
1056
1046
1057
1057
-
static struct hda_pcm_stream generic_hdmi_pcm_playback = {
1047
1047
+
static const struct hda_pcm_stream generic_hdmi_pcm_playback = {
1058
1048
.substreams = 1,
1059
1049
.channels_min = 2,
1060
1050
.ops = {
···
1130
1120
1131
1121
for (i = 0; i < spec->num_pins; i++)
1132
1122
snd_hda_eld_proc_free(codec, &spec->sink_eld[i]);
1123
1123
+
snd_hda_input_jack_free(codec);
1133
1124
1134
1125
kfree(spec);
1135
1126
}
1136
1127
1137
1137
-
static struct hda_codec_ops generic_hdmi_patch_ops = {
1128
1128
+
static const struct hda_codec_ops generic_hdmi_patch_ops = {
1138
1129
.init = generic_hdmi_init,
1139
1130
.free = generic_hdmi_free,
1140
1131
.build_pcms = generic_hdmi_build_pcms,
···
1180
1169
#define nvhdmi_master_con_nid_7x 0x04
1181
1170
#define nvhdmi_master_pin_nid_7x 0x05
1182
1171
1183
1183
-
static hda_nid_t nvhdmi_con_nids_7x[4] = {
1172
1172
+
static const hda_nid_t nvhdmi_con_nids_7x[4] = {
1184
1173
/*front, rear, clfe, rear_surr */
1185
1174
0x6, 0x8, 0xa, 0xc,
1186
1175
};
1187
1176
1188
1188
-
static struct hda_verb nvhdmi_basic_init_7x[] = {
1177
1177
+
static const struct hda_verb nvhdmi_basic_init_7x[] = {
1189
1178
/* set audio protect on */
1190
1179
{ 0x1, Nv_VERB_SET_Audio_Protection_On, 0x1},
1191
1180
/* enable digital output on pin widget */
···
1446
1435
return 0;
1447
1436
}
1448
1437
1449
1449
-
static struct hda_pcm_stream nvhdmi_pcm_playback_8ch_7x = {
1438
1438
+
static const struct hda_pcm_stream nvhdmi_pcm_playback_8ch_7x = {
1450
1439
.substreams = 1,
1451
1440
.channels_min = 2,
1452
1441
.channels_max = 8,
···
1461
1450
},
1462
1451
};
1463
1452
1464
1464
-
static struct hda_pcm_stream nvhdmi_pcm_playback_2ch = {
1453
1453
+
static const struct hda_pcm_stream nvhdmi_pcm_playback_2ch = {
1465
1454
.substreams = 1,
1466
1455
.channels_min = 2,
1467
1456
.channels_max = 2,
···
1476
1465
},
1477
1466
};
1478
1467
1479
1479
-
static struct hda_codec_ops nvhdmi_patch_ops_8ch_7x = {
1468
1468
+
static const struct hda_codec_ops nvhdmi_patch_ops_8ch_7x = {
1480
1469
.build_controls = generic_hdmi_build_controls,
1481
1470
.build_pcms = generic_hdmi_build_pcms,
1482
1471
.init = nvhdmi_7x_init,
1483
1472
.free = generic_hdmi_free,
1484
1473
};
1485
1474
1486
1486
-
static struct hda_codec_ops nvhdmi_patch_ops_2ch = {
1475
1475
+
static const struct hda_codec_ops nvhdmi_patch_ops_2ch = {
1487
1476
.build_controls = generic_hdmi_build_controls,
1488
1477
.build_pcms = generic_hdmi_build_pcms,
1489
1478
.init = nvhdmi_7x_init,
···
1579
1568
return 0;
1580
1569
}
1581
1570
1582
1582
-
static struct hda_pcm_stream atihdmi_pcm_digital_playback = {
1571
1571
+
static const struct hda_pcm_stream atihdmi_pcm_digital_playback = {
1583
1572
.substreams = 1,
1584
1573
.channels_min = 2,
1585
1574
.channels_max = 2,
···
1591
1580
},
1592
1581
};
1593
1582
1594
1594
-
static struct hda_verb atihdmi_basic_init[] = {
1583
1583
+
static const struct hda_verb atihdmi_basic_init[] = {
1595
1584
/* enable digital output on pin widget */
1596
1585
{ 0x03, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1597
1586
{} /* terminator */
···
1610
1599
return 0;
1611
1600
}
1612
1601
1613
1613
-
static struct hda_codec_ops atihdmi_patch_ops = {
1602
1602
+
static const struct hda_codec_ops atihdmi_patch_ops = {
1614
1603
.build_controls = generic_hdmi_build_controls,
1615
1604
.build_pcms = generic_hdmi_build_pcms,
1616
1605
.init = atihdmi_init,
···
1645
1634
/*
1646
1635
* patch entries
1647
1636
*/
1648
1648
-
static struct hda_codec_preset snd_hda_preset_hdmi[] = {
1637
1637
+
static const struct hda_codec_preset snd_hda_preset_hdmi[] = {
1649
1638
{ .id = 0x1002793c, .name = "RS600 HDMI", .patch = patch_atihdmi },
1650
1639
{ .id = 0x10027919, .name = "RS600 HDMI", .patch = patch_atihdmi },
1651
1640
{ .id = 0x1002791a, .name = "RS690/780 HDMI", .patch = patch_atihdmi },
···
1688
1677
{ .id = 0x80862803, .name = "Eaglelake HDMI", .patch = patch_generic_hdmi },
1689
1678
{ .id = 0x80862804, .name = "IbexPeak HDMI", .patch = patch_generic_hdmi },
1690
1679
{ .id = 0x80862805, .name = "CougarPoint HDMI", .patch = patch_generic_hdmi },
1680
1680
+
{ .id = 0x80862806, .name = "PantherPoint HDMI", .patch = patch_generic_hdmi },
1691
1681
{ .id = 0x808629fb, .name = "Crestline HDMI", .patch = patch_generic_hdmi },
1692
1682
{} /* terminator */
1693
1683
};
···
1734
1722
MODULE_ALIAS("snd-hda-codec-id:80862803");
1735
1723
MODULE_ALIAS("snd-hda-codec-id:80862804");
1736
1724
MODULE_ALIAS("snd-hda-codec-id:80862805");
1725
1725
+
MODULE_ALIAS("snd-hda-codec-id:80862806");
1737
1726
MODULE_ALIAS("snd-hda-codec-id:808629fb");
1738
1727
1739
1728
MODULE_LICENSE("GPL");
+1827
-1852
sound/pci/hda/patch_realtek.c
reviewed
···
299
299
300
300
struct alc_fixup;
301
301
302
302
+
struct alc_multi_io {
303
303
+
hda_nid_t pin; /* multi-io widget pin NID */
304
304
+
hda_nid_t dac; /* DAC to be connected */
305
305
+
unsigned int ctl_in; /* cached input-pin control value */
306
306
+
};
307
307
+
308
308
+
enum {
309
309
+
ALC_AUTOMUTE_PIN, /* change the pin control */
310
310
+
ALC_AUTOMUTE_AMP, /* mute/unmute the pin AMP */
311
311
+
ALC_AUTOMUTE_MIXER, /* mute/unmute mixer widget AMP */
312
312
+
};
313
313
+
302
314
struct alc_spec {
303
315
/* codec parameterization */
304
304
-
struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
316
316
+
const struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
305
317
unsigned int num_mixers;
306
306
-
struct snd_kcontrol_new *cap_mixer; /* capture mixer */
318
318
+
const struct snd_kcontrol_new *cap_mixer; /* capture mixer */
307
319
unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */
308
320
309
321
const struct hda_verb *init_verbs[10]; /* initialization verbs
···
325
313
unsigned int num_init_verbs;
326
314
327
315
char stream_name_analog[32]; /* analog PCM stream */
328
328
-
struct hda_pcm_stream *stream_analog_playback;
329
329
-
struct hda_pcm_stream *stream_analog_capture;
330
330
-
struct hda_pcm_stream *stream_analog_alt_playback;
331
331
-
struct hda_pcm_stream *stream_analog_alt_capture;
316
316
+
const struct hda_pcm_stream *stream_analog_playback;
317
317
+
const struct hda_pcm_stream *stream_analog_capture;
318
318
+
const struct hda_pcm_stream *stream_analog_alt_playback;
319
319
+
const struct hda_pcm_stream *stream_analog_alt_capture;
332
320
333
321
char stream_name_digital[32]; /* digital PCM stream */
334
334
-
struct hda_pcm_stream *stream_digital_playback;
335
335
-
struct hda_pcm_stream *stream_digital_capture;
322
322
+
const struct hda_pcm_stream *stream_digital_playback;
323
323
+
const struct hda_pcm_stream *stream_digital_capture;
336
324
337
325
/* playback */
338
326
struct hda_multi_out multiout; /* playback set-up
···
345
333
346
334
/* capture */
347
335
unsigned int num_adc_nids;
348
348
-
hda_nid_t *adc_nids;
349
349
-
hda_nid_t *capsrc_nids;
336
336
+
const hda_nid_t *adc_nids;
337
337
+
const hda_nid_t *capsrc_nids;
350
338
hda_nid_t dig_in_nid; /* digital-in NID; optional */
351
339
352
340
/* capture setup for dynamic dual-adc switch */
···
360
348
const struct hda_input_mux *input_mux;
361
349
unsigned int cur_mux[3];
362
350
struct alc_mic_route ext_mic;
351
351
+
struct alc_mic_route dock_mic;
363
352
struct alc_mic_route int_mic;
364
353
365
354
/* channel model */
···
388
375
#ifdef CONFIG_SND_HDA_POWER_SAVE
389
376
void (*power_hook)(struct hda_codec *codec);
390
377
#endif
378
378
+
void (*shutup)(struct hda_codec *codec);
391
379
392
380
/* for pin sensing */
393
393
-
unsigned int sense_updated: 1;
394
381
unsigned int jack_present: 1;
395
395
-
unsigned int master_sw: 1;
382
382
+
unsigned int line_jack_present:1;
383
383
+
unsigned int master_mute:1;
396
384
unsigned int auto_mic:1;
385
385
+
unsigned int automute:1; /* HP automute enabled */
386
386
+
unsigned int detect_line:1; /* Line-out detection enabled */
387
387
+
unsigned int automute_lines:1; /* automute line-out as well */
388
388
+
unsigned int automute_hp_lo:1; /* both HP and LO available */
397
389
398
390
/* other flags */
399
391
unsigned int no_analog :1; /* digital I/O only */
400
392
unsigned int dual_adc_switch:1; /* switch ADCs (for ALC275) */
401
393
unsigned int single_input_src:1;
394
394
+
395
395
+
/* auto-mute control */
396
396
+
int automute_mode;
397
397
+
hda_nid_t automute_mixer_nid[AUTO_CFG_MAX_OUTS];
398
398
+
402
399
int init_amp;
403
400
int codec_variant; /* flag for other variants */
404
401
···
426
403
int fixup_id;
427
404
const struct alc_fixup *fixup_list;
428
405
const char *fixup_name;
406
406
+
407
407
+
/* multi-io */
408
408
+
int multi_ios;
409
409
+
struct alc_multi_io multi_io[4];
429
410
};
430
411
431
412
/*
432
413
* configuration template - to be copied to the spec instance
433
414
*/
434
415
struct alc_config_preset {
435
435
-
struct snd_kcontrol_new *mixers[5]; /* should be identical size
416
416
+
const struct snd_kcontrol_new *mixers[5]; /* should be identical size
436
417
* with spec
437
418
*/
438
438
-
struct snd_kcontrol_new *cap_mixer; /* capture mixer */
419
419
+
const struct snd_kcontrol_new *cap_mixer; /* capture mixer */
439
420
const struct hda_verb *init_verbs[5];
440
421
unsigned int num_dacs;
441
441
-
hda_nid_t *dac_nids;
422
422
+
const hda_nid_t *dac_nids;
442
423
hda_nid_t dig_out_nid; /* optional */
443
424
hda_nid_t hp_nid; /* optional */
444
444
-
hda_nid_t *slave_dig_outs;
425
425
+
const hda_nid_t *slave_dig_outs;
445
426
unsigned int num_adc_nids;
446
446
-
hda_nid_t *adc_nids;
447
447
-
hda_nid_t *capsrc_nids;
427
427
+
const hda_nid_t *adc_nids;
428
428
+
const hda_nid_t *capsrc_nids;
448
429
hda_nid_t dig_in_nid;
449
430
unsigned int num_channel_mode;
450
431
const struct hda_channel_mode *channel_mode;
···
460
433
void (*setup)(struct hda_codec *);
461
434
void (*init_hook)(struct hda_codec *);
462
435
#ifdef CONFIG_SND_HDA_POWER_SAVE
463
463
-
struct hda_amp_list *loopbacks;
436
436
+
const struct hda_amp_list *loopbacks;
464
437
void (*power_hook)(struct hda_codec *codec);
465
438
#endif
466
439
};
···
587
560
* NIDs 0x0f and 0x10 have been observed to have this behaviour as of
588
561
* March 2006.
589
562
*/
590
590
-
static char *alc_pin_mode_names[] = {
563
563
+
static const char * const alc_pin_mode_names[] = {
591
564
"Mic 50pc bias", "Mic 80pc bias",
592
565
"Line in", "Line out", "Headphone out",
593
566
};
594
594
-
static unsigned char alc_pin_mode_values[] = {
567
567
+
static const unsigned char alc_pin_mode_values[] = {
595
568
PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
596
569
};
597
570
/* The control can present all 5 options, or it can limit the options based
···
610
583
/* Info about the pin modes supported by the different pin direction modes.
611
584
* For each direction the minimum and maximum values are given.
612
585
*/
613
613
-
static signed char alc_pin_mode_dir_info[5][2] = {
586
586
+
static const signed char alc_pin_mode_dir_info[5][2] = {
614
587
{ 0, 2 }, /* ALC_PIN_DIR_IN */
615
588
{ 3, 4 }, /* ALC_PIN_DIR_OUT */
616
589
{ 0, 4 }, /* ALC_PIN_DIR_INOUT */
···
927
900
928
901
/*
929
902
*/
930
930
-
static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix)
903
903
+
static void add_mixer(struct alc_spec *spec, const struct snd_kcontrol_new *mix)
931
904
{
932
905
if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers)))
933
906
return;
···
998
971
}
999
972
1000
973
/* Enable GPIO mask and set output */
1001
1001
-
static struct hda_verb alc_gpio1_init_verbs[] = {
974
974
+
static const struct hda_verb alc_gpio1_init_verbs[] = {
1002
975
{0x01, AC_VERB_SET_GPIO_MASK, 0x01},
1003
976
{0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
1004
977
{0x01, AC_VERB_SET_GPIO_DATA, 0x01},
1005
978
{ }
1006
979
};
1007
980
1008
1008
-
static struct hda_verb alc_gpio2_init_verbs[] = {
981
981
+
static const struct hda_verb alc_gpio2_init_verbs[] = {
1009
982
{0x01, AC_VERB_SET_GPIO_MASK, 0x02},
1010
983
{0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
1011
984
{0x01, AC_VERB_SET_GPIO_DATA, 0x02},
1012
985
{ }
1013
986
};
1014
987
1015
1015
-
static struct hda_verb alc_gpio3_init_verbs[] = {
988
988
+
static const struct hda_verb alc_gpio3_init_verbs[] = {
1016
989
{0x01, AC_VERB_SET_GPIO_MASK, 0x03},
1017
990
{0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
1018
991
{0x01, AC_VERB_SET_GPIO_DATA, 0x03},
···
1058
1031
int err;
1059
1032
unsigned int hp_nid = spec->autocfg.hp_pins[0];
1060
1033
unsigned int mic_nid = spec->ext_mic.pin;
1034
1034
+
unsigned int dock_nid = spec->dock_mic.pin;
1061
1035
1062
1036
if (hp_nid) {
1063
1037
err = snd_hda_input_jack_add(codec, hp_nid,
···
1075
1047
return err;
1076
1048
snd_hda_input_jack_report(codec, mic_nid);
1077
1049
}
1050
1050
+
if (dock_nid) {
1051
1051
+
err = snd_hda_input_jack_add(codec, dock_nid,
1052
1052
+
SND_JACK_MICROPHONE, NULL);
1053
1053
+
if (err < 0)
1054
1054
+
return err;
1055
1055
+
snd_hda_input_jack_report(codec, dock_nid);
1056
1056
+
}
1078
1057
#endif /* CONFIG_SND_HDA_INPUT_JACK */
1079
1058
return 0;
1080
1059
}
1081
1060
1082
1082
-
static void alc_automute_speaker(struct hda_codec *codec, int pinctl)
1061
1061
+
static int detect_jacks(struct hda_codec *codec, int num_pins, hda_nid_t *pins)
1083
1062
{
1084
1084
-
struct alc_spec *spec = codec->spec;
1085
1085
-
unsigned int mute;
1086
1086
-
hda_nid_t nid;
1087
1087
-
int i;
1063
1063
+
int i, present = 0;
1088
1064
1089
1089
-
spec->jack_present = 0;
1090
1090
-
for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) {
1091
1091
-
nid = spec->autocfg.hp_pins[i];
1065
1065
+
for (i = 0; i < num_pins; i++) {
1066
1066
+
hda_nid_t nid = pins[i];
1092
1067
if (!nid)
1093
1068
break;
1094
1069
snd_hda_input_jack_report(codec, nid);
1095
1095
-
spec->jack_present |= snd_hda_jack_detect(codec, nid);
1070
1070
+
present |= snd_hda_jack_detect(codec, nid);
1096
1071
}
1072
1072
+
return present;
1073
1073
+
}
1097
1074
1098
1098
-
mute = spec->jack_present ? HDA_AMP_MUTE : 0;
1099
1099
-
/* Toggle internal speakers muting */
1100
1100
-
for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
1101
1101
-
nid = spec->autocfg.speaker_pins[i];
1075
1075
+
static void do_automute(struct hda_codec *codec, int num_pins, hda_nid_t *pins,
1076
1076
+
bool mute, bool hp_out)
1077
1077
+
{
1078
1078
+
struct alc_spec *spec = codec->spec;
1079
1079
+
unsigned int mute_bits = mute ? HDA_AMP_MUTE : 0;
1080
1080
+
unsigned int pin_bits = mute ? 0 : (hp_out ? PIN_HP : PIN_OUT);
1081
1081
+
int i;
1082
1082
+
1083
1083
+
for (i = 0; i < num_pins; i++) {
1084
1084
+
hda_nid_t nid = pins[i];
1102
1085
if (!nid)
1103
1086
break;
1104
1104
-
if (pinctl) {
1087
1087
+
switch (spec->automute_mode) {
1088
1088
+
case ALC_AUTOMUTE_PIN:
1105
1089
snd_hda_codec_write(codec, nid, 0,
1106
1106
-
AC_VERB_SET_PIN_WIDGET_CONTROL,
1107
1107
-
spec->jack_present ? 0 : PIN_OUT);
1108
1108
-
} else {
1090
1090
+
AC_VERB_SET_PIN_WIDGET_CONTROL,
1091
1091
+
pin_bits);
1092
1092
+
break;
1093
1093
+
case ALC_AUTOMUTE_AMP:
1109
1094
snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
1110
1110
-
HDA_AMP_MUTE, mute);
1095
1095
+
HDA_AMP_MUTE, mute_bits);
1096
1096
+
break;
1097
1097
+
case ALC_AUTOMUTE_MIXER:
1098
1098
+
nid = spec->automute_mixer_nid[i];
1099
1099
+
if (!nid)
1100
1100
+
break;
1101
1101
+
snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
1102
1102
+
HDA_AMP_MUTE, mute_bits);
1103
1103
+
snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 1,
1104
1104
+
HDA_AMP_MUTE, mute_bits);
1105
1105
+
break;
1111
1106
}
1112
1107
}
1113
1108
}
1114
1109
1115
1115
-
static void alc_automute_pin(struct hda_codec *codec)
1110
1110
+
/* Toggle internal speakers muting */
1111
1111
+
static void update_speakers(struct hda_codec *codec)
1116
1112
{
1117
1117
-
alc_automute_speaker(codec, 1);
1113
1113
+
struct alc_spec *spec = codec->spec;
1114
1114
+
int on;
1115
1115
+
1116
1116
+
if (!spec->automute)
1117
1117
+
on = 0;
1118
1118
+
else
1119
1119
+
on = spec->jack_present | spec->line_jack_present;
1120
1120
+
on |= spec->master_mute;
1121
1121
+
do_automute(codec, ARRAY_SIZE(spec->autocfg.speaker_pins),
1122
1122
+
spec->autocfg.speaker_pins, on, false);
1123
1123
+
1124
1124
+
/* toggle line-out mutes if needed, too */
1125
1125
+
/* if LO is a copy of either HP or Speaker, don't need to handle it */
1126
1126
+
if (spec->autocfg.line_out_pins[0] == spec->autocfg.hp_pins[0] ||
1127
1127
+
spec->autocfg.line_out_pins[0] == spec->autocfg.speaker_pins[0])
1128
1128
+
return;
1129
1129
+
if (!spec->automute_lines || !spec->automute)
1130
1130
+
on = 0;
1131
1131
+
else
1132
1132
+
on = spec->jack_present;
1133
1133
+
on |= spec->master_mute;
1134
1134
+
do_automute(codec, ARRAY_SIZE(spec->autocfg.line_out_pins),
1135
1135
+
spec->autocfg.line_out_pins, on, false);
1136
1136
+
}
1137
1137
+
1138
1138
+
static void alc_hp_automute(struct hda_codec *codec)
1139
1139
+
{
1140
1140
+
struct alc_spec *spec = codec->spec;
1141
1141
+
1142
1142
+
if (!spec->automute)
1143
1143
+
return;
1144
1144
+
spec->jack_present =
1145
1145
+
detect_jacks(codec, ARRAY_SIZE(spec->autocfg.hp_pins),
1146
1146
+
spec->autocfg.hp_pins);
1147
1147
+
update_speakers(codec);
1148
1148
+
}
1149
1149
+
1150
1150
+
static void alc_line_automute(struct hda_codec *codec)
1151
1151
+
{
1152
1152
+
struct alc_spec *spec = codec->spec;
1153
1153
+
1154
1154
+
if (!spec->automute || !spec->detect_line)
1155
1155
+
return;
1156
1156
+
spec->line_jack_present =
1157
1157
+
detect_jacks(codec, ARRAY_SIZE(spec->autocfg.line_out_pins),
1158
1158
+
spec->autocfg.line_out_pins);
1159
1159
+
update_speakers(codec);
1118
1160
}
1119
1161
1120
1162
static int get_connection_index(struct hda_codec *codec, hda_nid_t mux,
···
1226
1128
static void alc_mic_automute(struct hda_codec *codec)
1227
1129
{
1228
1130
struct alc_spec *spec = codec->spec;
1229
1229
-
struct alc_mic_route *dead, *alive;
1131
1131
+
struct alc_mic_route *dead1, *dead2, *alive;
1230
1132
unsigned int present, type;
1231
1133
hda_nid_t cap_nid;
1232
1134
···
1244
1146
1245
1147
cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0];
1246
1148
1149
1149
+
alive = &spec->int_mic;
1150
1150
+
dead1 = &spec->ext_mic;
1151
1151
+
dead2 = &spec->dock_mic;
1152
1152
+
1247
1153
present = snd_hda_jack_detect(codec, spec->ext_mic.pin);
1248
1154
if (present) {
1249
1155
alive = &spec->ext_mic;
1250
1250
-
dead = &spec->int_mic;
1251
1251
-
} else {
1252
1252
-
alive = &spec->int_mic;
1253
1253
-
dead = &spec->ext_mic;
1156
1156
+
dead1 = &spec->int_mic;
1157
1157
+
dead2 = &spec->dock_mic;
1158
1158
+
}
1159
1159
+
if (!present && spec->dock_mic.pin > 0) {
1160
1160
+
present = snd_hda_jack_detect(codec, spec->dock_mic.pin);
1161
1161
+
if (present) {
1162
1162
+
alive = &spec->dock_mic;
1163
1163
+
dead1 = &spec->int_mic;
1164
1164
+
dead2 = &spec->ext_mic;
1165
1165
+
}
1166
1166
+
snd_hda_input_jack_report(codec, spec->dock_mic.pin);
1254
1167
}
1255
1168
1256
1169
type = get_wcaps_type(get_wcaps(codec, cap_nid));
···
1270
1161
snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1271
1162
alive->mux_idx,
1272
1163
HDA_AMP_MUTE, 0);
1273
1273
-
snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1274
1274
-
dead->mux_idx,
1275
1275
-
HDA_AMP_MUTE, HDA_AMP_MUTE);
1164
1164
+
if (dead1->pin > 0)
1165
1165
+
snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1166
1166
+
dead1->mux_idx,
1167
1167
+
HDA_AMP_MUTE, HDA_AMP_MUTE);
1168
1168
+
if (dead2->pin > 0)
1169
1169
+
snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1170
1170
+
dead2->mux_idx,
1171
1171
+
HDA_AMP_MUTE, HDA_AMP_MUTE);
1276
1172
} else {
1277
1173
/* MUX style (e.g. ALC880) */
1278
1174
snd_hda_codec_write_cache(codec, cap_nid, 0,
···
1298
1184
res >>= 26;
1299
1185
switch (res) {
1300
1186
case ALC880_HP_EVENT:
1301
1301
-
alc_automute_pin(codec);
1187
1187
+
alc_hp_automute(codec);
1188
1188
+
break;
1189
1189
+
case ALC880_FRONT_EVENT:
1190
1190
+
alc_line_automute(codec);
1302
1191
break;
1303
1192
case ALC880_MIC_EVENT:
1304
1193
alc_mic_automute(codec);
···
1311
1194
1312
1195
static void alc_inithook(struct hda_codec *codec)
1313
1196
{
1314
1314
-
alc_automute_pin(codec);
1197
1197
+
alc_hp_automute(codec);
1198
1198
+
alc_line_automute(codec);
1315
1199
alc_mic_automute(codec);
1316
1200
}
1317
1201
···
1354
1236
on ? 2 : 0);
1355
1237
}
1356
1238
1239
1239
+
/* turn on/off EAPD controls of the codec */
1240
1240
+
static void alc_auto_setup_eapd(struct hda_codec *codec, bool on)
1241
1241
+
{
1242
1242
+
/* We currently only handle front, HP */
1243
1243
+
switch (codec->vendor_id) {
1244
1244
+
case 0x10ec0260:
1245
1245
+
set_eapd(codec, 0x0f, on);
1246
1246
+
set_eapd(codec, 0x10, on);
1247
1247
+
break;
1248
1248
+
case 0x10ec0262:
1249
1249
+
case 0x10ec0267:
1250
1250
+
case 0x10ec0268:
1251
1251
+
case 0x10ec0269:
1252
1252
+
case 0x10ec0270:
1253
1253
+
case 0x10ec0272:
1254
1254
+
case 0x10ec0660:
1255
1255
+
case 0x10ec0662:
1256
1256
+
case 0x10ec0663:
1257
1257
+
case 0x10ec0665:
1258
1258
+
case 0x10ec0862:
1259
1259
+
case 0x10ec0889:
1260
1260
+
case 0x10ec0892:
1261
1261
+
set_eapd(codec, 0x14, on);
1262
1262
+
set_eapd(codec, 0x15, on);
1263
1263
+
break;
1264
1264
+
}
1265
1265
+
}
1266
1266
+
1267
1267
+
/* generic shutup callback;
1268
1268
+
* just turning off EPAD and a little pause for avoiding pop-noise
1269
1269
+
*/
1270
1270
+
static void alc_eapd_shutup(struct hda_codec *codec)
1271
1271
+
{
1272
1272
+
alc_auto_setup_eapd(codec, false);
1273
1273
+
msleep(200);
1274
1274
+
}
1275
1275
+
1357
1276
static void alc_auto_init_amp(struct hda_codec *codec, int type)
1358
1277
{
1359
1278
unsigned int tmp;
···
1406
1251
snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
1407
1252
break;
1408
1253
case ALC_INIT_DEFAULT:
1409
1409
-
switch (codec->vendor_id) {
1410
1410
-
case 0x10ec0260:
1411
1411
-
set_eapd(codec, 0x0f, 1);
1412
1412
-
set_eapd(codec, 0x10, 1);
1413
1413
-
break;
1414
1414
-
case 0x10ec0262:
1415
1415
-
case 0x10ec0267:
1416
1416
-
case 0x10ec0268:
1417
1417
-
case 0x10ec0269:
1418
1418
-
case 0x10ec0270:
1419
1419
-
case 0x10ec0272:
1420
1420
-
case 0x10ec0660:
1421
1421
-
case 0x10ec0662:
1422
1422
-
case 0x10ec0663:
1423
1423
-
case 0x10ec0665:
1424
1424
-
case 0x10ec0862:
1425
1425
-
case 0x10ec0889:
1426
1426
-
set_eapd(codec, 0x14, 1);
1427
1427
-
set_eapd(codec, 0x15, 1);
1428
1428
-
break;
1429
1429
-
}
1254
1254
+
alc_auto_setup_eapd(codec, true);
1430
1255
switch (codec->vendor_id) {
1431
1256
case 0x10ec0260:
1432
1257
snd_hda_codec_write(codec, 0x1a, 0,
···
1450
1315
}
1451
1316
}
1452
1317
1318
1318
+
static int alc_automute_mode_info(struct snd_kcontrol *kcontrol,
1319
1319
+
struct snd_ctl_elem_info *uinfo)
1320
1320
+
{
1321
1321
+
struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1322
1322
+
struct alc_spec *spec = codec->spec;
1323
1323
+
static const char * const texts2[] = {
1324
1324
+
"Disabled", "Enabled"
1325
1325
+
};
1326
1326
+
static const char * const texts3[] = {
1327
1327
+
"Disabled", "Speaker Only", "Line-Out+Speaker"
1328
1328
+
};
1329
1329
+
const char * const *texts;
1330
1330
+
1331
1331
+
uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
1332
1332
+
uinfo->count = 1;
1333
1333
+
if (spec->automute_hp_lo) {
1334
1334
+
uinfo->value.enumerated.items = 3;
1335
1335
+
texts = texts3;
1336
1336
+
} else {
1337
1337
+
uinfo->value.enumerated.items = 2;
1338
1338
+
texts = texts2;
1339
1339
+
}
1340
1340
+
if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items)
1341
1341
+
uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1;
1342
1342
+
strcpy(uinfo->value.enumerated.name,
1343
1343
+
texts[uinfo->value.enumerated.item]);
1344
1344
+
return 0;
1345
1345
+
}
1346
1346
+
1347
1347
+
static int alc_automute_mode_get(struct snd_kcontrol *kcontrol,
1348
1348
+
struct snd_ctl_elem_value *ucontrol)
1349
1349
+
{
1350
1350
+
struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1351
1351
+
struct alc_spec *spec = codec->spec;
1352
1352
+
unsigned int val;
1353
1353
+
if (!spec->automute)
1354
1354
+
val = 0;
1355
1355
+
else if (!spec->automute_lines)
1356
1356
+
val = 1;
1357
1357
+
else
1358
1358
+
val = 2;
1359
1359
+
ucontrol->value.enumerated.item[0] = val;
1360
1360
+
return 0;
1361
1361
+
}
1362
1362
+
1363
1363
+
static int alc_automute_mode_put(struct snd_kcontrol *kcontrol,
1364
1364
+
struct snd_ctl_elem_value *ucontrol)
1365
1365
+
{
1366
1366
+
struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1367
1367
+
struct alc_spec *spec = codec->spec;
1368
1368
+
1369
1369
+
switch (ucontrol->value.enumerated.item[0]) {
1370
1370
+
case 0:
1371
1371
+
if (!spec->automute)
1372
1372
+
return 0;
1373
1373
+
spec->automute = 0;
1374
1374
+
break;
1375
1375
+
case 1:
1376
1376
+
if (spec->automute && !spec->automute_lines)
1377
1377
+
return 0;
1378
1378
+
spec->automute = 1;
1379
1379
+
spec->automute_lines = 0;
1380
1380
+
break;
1381
1381
+
case 2:
1382
1382
+
if (!spec->automute_hp_lo)
1383
1383
+
return -EINVAL;
1384
1384
+
if (spec->automute && spec->automute_lines)
1385
1385
+
return 0;
1386
1386
+
spec->automute = 1;
1387
1387
+
spec->automute_lines = 1;
1388
1388
+
break;
1389
1389
+
default:
1390
1390
+
return -EINVAL;
1391
1391
+
}
1392
1392
+
update_speakers(codec);
1393
1393
+
return 1;
1394
1394
+
}
1395
1395
+
1396
1396
+
static const struct snd_kcontrol_new alc_automute_mode_enum = {
1397
1397
+
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1398
1398
+
.name = "Auto-Mute Mode",
1399
1399
+
.info = alc_automute_mode_info,
1400
1400
+
.get = alc_automute_mode_get,
1401
1401
+
.put = alc_automute_mode_put,
1402
1402
+
};
1403
1403
+
1404
1404
+
static struct snd_kcontrol_new *alc_kcontrol_new(struct alc_spec *spec);
1405
1405
+
1406
1406
+
static int alc_add_automute_mode_enum(struct hda_codec *codec)
1407
1407
+
{
1408
1408
+
struct alc_spec *spec = codec->spec;
1409
1409
+
struct snd_kcontrol_new *knew;
1410
1410
+
1411
1411
+
knew = alc_kcontrol_new(spec);
1412
1412
+
if (!knew)
1413
1413
+
return -ENOMEM;
1414
1414
+
*knew = alc_automute_mode_enum;
1415
1415
+
knew->name = kstrdup("Auto-Mute Mode", GFP_KERNEL);
1416
1416
+
if (!knew->name)
1417
1417
+
return -ENOMEM;
1418
1418
+
return 0;
1419
1419
+
}
1420
1420
+
1453
1421
static void alc_init_auto_hp(struct hda_codec *codec)
1454
1422
{
1455
1423
struct alc_spec *spec = codec->spec;
1456
1424
struct auto_pin_cfg *cfg = &spec->autocfg;
1425
1425
+
int present = 0;
1457
1426
int i;
1458
1427
1459
1459
-
if (!cfg->hp_pins[0]) {
1460
1460
-
if (cfg->line_out_type != AUTO_PIN_HP_OUT)
1461
1461
-
return;
1462
1462
-
}
1428
1428
+
if (cfg->hp_pins[0])
1429
1429
+
present++;
1430
1430
+
if (cfg->line_out_pins[0])
1431
1431
+
present++;
1432
1432
+
if (cfg->speaker_pins[0])
1433
1433
+
present++;
1434
1434
+
if (present < 2) /* need two different output types */
1435
1435
+
return;
1436
1436
+
if (present == 3)
1437
1437
+
spec->automute_hp_lo = 1; /* both HP and LO automute */
1463
1438
1464
1439
if (!cfg->speaker_pins[0]) {
1465
1465
-
if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT)
1466
1466
-
return;
1467
1440
memcpy(cfg->speaker_pins, cfg->line_out_pins,
1468
1441
sizeof(cfg->speaker_pins));
1469
1442
cfg->speaker_outs = cfg->line_outs;
···
1584
1341
}
1585
1342
1586
1343
for (i = 0; i < cfg->hp_outs; i++) {
1344
1344
+
hda_nid_t nid = cfg->hp_pins[i];
1345
1345
+
if (!is_jack_detectable(codec, nid))
1346
1346
+
continue;
1587
1347
snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n",
1588
1588
-
cfg->hp_pins[i]);
1589
1589
-
snd_hda_codec_write_cache(codec, cfg->hp_pins[i], 0,
1348
1348
+
nid);
1349
1349
+
snd_hda_codec_write_cache(codec, nid, 0,
1590
1350
AC_VERB_SET_UNSOLICITED_ENABLE,
1591
1351
AC_USRSP_EN | ALC880_HP_EVENT);
1352
1352
+
spec->automute = 1;
1353
1353
+
spec->automute_mode = ALC_AUTOMUTE_PIN;
1592
1354
}
1593
1593
-
spec->unsol_event = alc_sku_unsol_event;
1355
1355
+
if (spec->automute && cfg->line_out_pins[0] &&
1356
1356
+
cfg->line_out_pins[0] != cfg->hp_pins[0] &&
1357
1357
+
cfg->line_out_pins[0] != cfg->speaker_pins[0]) {
1358
1358
+
for (i = 0; i < cfg->line_outs; i++) {
1359
1359
+
hda_nid_t nid = cfg->line_out_pins[i];
1360
1360
+
if (!is_jack_detectable(codec, nid))
1361
1361
+
continue;
1362
1362
+
snd_printdd("realtek: Enable Line-Out auto-muting "
1363
1363
+
"on NID 0x%x\n", nid);
1364
1364
+
snd_hda_codec_write_cache(codec, nid, 0,
1365
1365
+
AC_VERB_SET_UNSOLICITED_ENABLE,
1366
1366
+
AC_USRSP_EN | ALC880_FRONT_EVENT);
1367
1367
+
spec->detect_line = 1;
1368
1368
+
}
1369
1369
+
spec->automute_lines = spec->detect_line;
1370
1370
+
}
1371
1371
+
1372
1372
+
if (spec->automute) {
1373
1373
+
/* create a control for automute mode */
1374
1374
+
alc_add_automute_mode_enum(codec);
1375
1375
+
spec->unsol_event = alc_sku_unsol_event;
1376
1376
+
}
1594
1377
}
1595
1378
1596
1379
static void alc_init_auto_mic(struct hda_codec *codec)
1597
1380
{
1598
1381
struct alc_spec *spec = codec->spec;
1599
1382
struct auto_pin_cfg *cfg = &spec->autocfg;
1600
1600
-
hda_nid_t fixed, ext;
1383
1383
+
hda_nid_t fixed, ext, dock;
1601
1384
int i;
1602
1385
1603
1603
-
/* there must be only two mic inputs exclusively */
1604
1604
-
for (i = 0; i < cfg->num_inputs; i++)
1605
1605
-
if (cfg->inputs[i].type >= AUTO_PIN_LINE_IN)
1606
1606
-
return;
1607
1607
-
1608
1608
-
fixed = ext = 0;
1386
1386
+
fixed = ext = dock = 0;
1609
1387
for (i = 0; i < cfg->num_inputs; i++) {
1610
1388
hda_nid_t nid = cfg->inputs[i].pin;
1611
1389
unsigned int defcfg;
···
1635
1371
case INPUT_PIN_ATTR_INT:
1636
1372
if (fixed)
1637
1373
return; /* already occupied */
1374
1374
+
if (cfg->inputs[i].type != AUTO_PIN_MIC)
1375
1375
+
return; /* invalid type */
1638
1376
fixed = nid;
1639
1377
break;
1640
1378
case INPUT_PIN_ATTR_UNUSED:
1641
1379
return; /* invalid entry */
1380
1380
+
case INPUT_PIN_ATTR_DOCK:
1381
1381
+
if (dock)
1382
1382
+
return; /* already occupied */
1383
1383
+
if (cfg->inputs[i].type > AUTO_PIN_LINE_IN)
1384
1384
+
return; /* invalid type */
1385
1385
+
dock = nid;
1386
1386
+
break;
1642
1387
default:
1643
1388
if (ext)
1644
1389
return; /* already occupied */
1390
1390
+
if (cfg->inputs[i].type != AUTO_PIN_MIC)
1391
1391
+
return; /* invalid type */
1645
1392
ext = nid;
1646
1393
break;
1647
1394
}
1648
1395
}
1396
1396
+
if (!ext && dock) {
1397
1397
+
ext = dock;
1398
1398
+
dock = 0;
1399
1399
+
}
1649
1400
if (!ext || !fixed)
1650
1401
return;
1651
1651
-
if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP))
1402
1402
+
if (!is_jack_detectable(codec, ext))
1652
1403
return; /* no unsol support */
1653
1653
-
snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n",
1654
1654
-
ext, fixed);
1404
1404
+
if (dock && !is_jack_detectable(codec, dock))
1405
1405
+
return; /* no unsol support */
1406
1406
+
snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x/0x%x\n",
1407
1407
+
ext, fixed, dock);
1655
1408
spec->ext_mic.pin = ext;
1409
1409
+
spec->dock_mic.pin = dock;
1656
1410
spec->int_mic.pin = fixed;
1657
1411
spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1412
1412
+
spec->dock_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1658
1413
spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1659
1414
spec->auto_mic = 1;
1660
1415
snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0,
···
1866
1583
return 1;
1867
1584
spec->autocfg.hp_pins[0] = nid;
1868
1585
}
1869
1869
-
1870
1870
-
alc_init_auto_hp(codec);
1871
1871
-
alc_init_auto_mic(codec);
1872
1586
return 1;
1873
1587
}
1874
1588
···
1878
1598
snd_printd("realtek: "
1879
1599
"Enable default setup for auto mode as fallback\n");
1880
1600
spec->init_amp = ALC_INIT_DEFAULT;
1881
1881
-
alc_init_auto_hp(codec);
1882
1882
-
alc_init_auto_mic(codec);
1883
1601
}
1602
1602
+
1603
1603
+
alc_init_auto_hp(codec);
1604
1604
+
alc_init_auto_mic(codec);
1884
1605
}
1885
1606
1886
1607
/*
···
2123
1842
/*
2124
1843
* 2ch mode
2125
1844
*/
2126
2126
-
static struct hda_verb alc888_4ST_ch2_intel_init[] = {
1845
1845
+
static const struct hda_verb alc888_4ST_ch2_intel_init[] = {
2127
1846
/* Mic-in jack as mic in */
2128
1847
{ 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2129
1848
{ 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
···
2138
1857
/*
2139
1858
* 4ch mode
2140
1859
*/
2141
2141
-
static struct hda_verb alc888_4ST_ch4_intel_init[] = {
1860
1860
+
static const struct hda_verb alc888_4ST_ch4_intel_init[] = {
2142
1861
/* Mic-in jack as mic in */
2143
1862
{ 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2144
1863
{ 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
···
2153
1872
/*
2154
1873
* 6ch mode
2155
1874
*/
2156
2156
-
static struct hda_verb alc888_4ST_ch6_intel_init[] = {
1875
1875
+
static const struct hda_verb alc888_4ST_ch6_intel_init[] = {
2157
1876
/* Mic-in jack as CLFE */
2158
1877
{ 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2159
1878
{ 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
···
2168
1887
/*
2169
1888
* 8ch mode
2170
1889
*/
2171
2171
-
static struct hda_verb alc888_4ST_ch8_intel_init[] = {
1890
1890
+
static const struct hda_verb alc888_4ST_ch8_intel_init[] = {
2172
1891
/* Mic-in jack as CLFE */
2173
1892
{ 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2174
1893
{ 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
···
2180
1899
{ } /* end */
2181
1900
};
2182
1901
2183
2183
-
static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = {
1902
1902
+
static const struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = {
2184
1903
{ 2, alc888_4ST_ch2_intel_init },
2185
1904
{ 4, alc888_4ST_ch4_intel_init },
2186
1905
{ 6, alc888_4ST_ch6_intel_init },
···
2191
1910
* ALC888 Fujitsu Siemens Amillo xa3530
2192
1911
*/
2193
1912
2194
2194
-
static struct hda_verb alc888_fujitsu_xa3530_verbs[] = {
1913
1913
+
static const struct hda_verb alc888_fujitsu_xa3530_verbs[] = {
2195
1914
/* Front Mic: set to PIN_IN (empty by default) */
2196
1915
{0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2197
1916
/* Connect Internal HP to Front */
···
2224
1943
{}
2225
1944
};
2226
1945
2227
2227
-
static void alc_automute_amp(struct hda_codec *codec)
2228
2228
-
{
2229
2229
-
alc_automute_speaker(codec, 0);
2230
2230
-
}
2231
2231
-
2232
2232
-
static void alc_automute_amp_unsol_event(struct hda_codec *codec,
2233
2233
-
unsigned int res)
2234
2234
-
{
2235
2235
-
if (codec->vendor_id == 0x10ec0880)
2236
2236
-
res >>= 28;
2237
2237
-
else
2238
2238
-
res >>= 26;
2239
2239
-
if (res == ALC880_HP_EVENT)
2240
2240
-
alc_automute_amp(codec);
2241
2241
-
}
2242
2242
-
2243
1946
static void alc889_automute_setup(struct hda_codec *codec)
2244
1947
{
2245
1948
struct alc_spec *spec = codec->spec;
···
2234
1969
spec->autocfg.speaker_pins[2] = 0x17;
2235
1970
spec->autocfg.speaker_pins[3] = 0x19;
2236
1971
spec->autocfg.speaker_pins[4] = 0x1a;
1972
1972
+
spec->automute = 1;
1973
1973
+
spec->automute_mode = ALC_AUTOMUTE_AMP;
2237
1974
}
2238
1975
2239
1976
static void alc889_intel_init_hook(struct hda_codec *codec)
2240
1977
{
2241
1978
alc889_coef_init(codec);
2242
2242
-
alc_automute_amp(codec);
1979
1979
+
alc_hp_automute(codec);
2243
1980
}
2244
1981
2245
1982
static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec)
···
2252
1985
spec->autocfg.hp_pins[1] = 0x1b; /* hp */
2253
1986
spec->autocfg.speaker_pins[0] = 0x14; /* speaker */
2254
1987
spec->autocfg.speaker_pins[1] = 0x15; /* bass */
1988
1988
+
spec->automute = 1;
1989
1989
+
spec->automute_mode = ALC_AUTOMUTE_AMP;
2255
1990
}
2256
1991
2257
1992
/*
2258
1993
* ALC888 Acer Aspire 4930G model
2259
1994
*/
2260
1995
2261
2261
-
static struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
1996
1996
+
static const struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
2262
1997
/* Front Mic: set to PIN_IN (empty by default) */
2263
1998
{0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2264
1999
/* Unselect Front Mic by default in input mixer 3 */
···
2283
2014
* ALC888 Acer Aspire 6530G model
2284
2015
*/
2285
2016
2286
2286
-
static struct hda_verb alc888_acer_aspire_6530g_verbs[] = {
2017
2017
+
static const struct hda_verb alc888_acer_aspire_6530g_verbs[] = {
2287
2018
/* Route to built-in subwoofer as well as speakers */
2288
2019
{0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2289
2020
{0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
···
2313
2044
*ALC888 Acer Aspire 7730G model
2314
2045
*/
2315
2046
2316
2316
-
static struct hda_verb alc888_acer_aspire_7730G_verbs[] = {
2047
2047
+
static const struct hda_verb alc888_acer_aspire_7730G_verbs[] = {
2317
2048
/* Bias voltage on for external mic port */
2318
2049
{0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80},
2319
2050
/* Front Mic: set to PIN_IN (empty by default) */
···
2343
2074
* ALC889 Acer Aspire 8930G model
2344
2075
*/
2345
2076
2346
2346
-
static struct hda_verb alc889_acer_aspire_8930g_verbs[] = {
2077
2077
+
static const struct hda_verb alc889_acer_aspire_8930g_verbs[] = {
2347
2078
/* Front Mic: set to PIN_IN (empty by default) */
2348
2079
{0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2349
2080
/* Unselect Front Mic by default in input mixer 3 */
···
2389
2120
{ }
2390
2121
};
2391
2122
2392
2392
-
static struct hda_input_mux alc888_2_capture_sources[2] = {
2123
2123
+
static const struct hda_input_mux alc888_2_capture_sources[2] = {
2393
2124
/* Front mic only available on one ADC */
2394
2125
{
2395
2126
.num_items = 4,
···
2410
2141
}
2411
2142
};
2412
2143
2413
2413
-
static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = {
2144
2144
+
static const struct hda_input_mux alc888_acer_aspire_6530_sources[2] = {
2414
2145
/* Interal mic only available on one ADC */
2415
2146
{
2416
2147
.num_items = 5,
···
2433
2164
}
2434
2165
};
2435
2166
2436
2436
-
static struct hda_input_mux alc889_capture_sources[3] = {
2167
2167
+
static const struct hda_input_mux alc889_capture_sources[3] = {
2437
2168
/* Digital mic only available on first "ADC" */
2438
2169
{
2439
2170
.num_items = 5,
···
2465
2196
}
2466
2197
};
2467
2198
2468
2468
-
static struct snd_kcontrol_new alc888_base_mixer[] = {
2199
2199
+
static const struct snd_kcontrol_new alc888_base_mixer[] = {
2469
2200
HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2470
2201
HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2471
2202
HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
···
2487
2218
{ } /* end */
2488
2219
};
2489
2220
2490
2490
-
static struct snd_kcontrol_new alc888_acer_aspire_4930g_mixer[] = {
2221
2221
+
static const struct snd_kcontrol_new alc888_acer_aspire_4930g_mixer[] = {
2491
2222
HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2492
2223
HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2493
2224
HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
···
2509
2240
{ } /* end */
2510
2241
};
2511
2242
2512
2512
-
static struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = {
2243
2243
+
static const struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = {
2513
2244
HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2514
2245
HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2515
2246
HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
···
2536
2267
spec->autocfg.speaker_pins[0] = 0x14;
2537
2268
spec->autocfg.speaker_pins[1] = 0x16;
2538
2269
spec->autocfg.speaker_pins[2] = 0x17;
2270
2270
+
spec->automute = 1;
2271
2271
+
spec->automute_mode = ALC_AUTOMUTE_AMP;
2539
2272
}
2540
2273
2541
2274
static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec)
···
2548
2277
spec->autocfg.speaker_pins[0] = 0x14;
2549
2278
spec->autocfg.speaker_pins[1] = 0x16;
2550
2279
spec->autocfg.speaker_pins[2] = 0x17;
2280
2280
+
spec->automute = 1;
2281
2281
+
spec->automute_mode = ALC_AUTOMUTE_AMP;
2551
2282
}
2552
2283
2553
2284
static void alc888_acer_aspire_7730g_setup(struct hda_codec *codec)
···
2560
2287
spec->autocfg.speaker_pins[0] = 0x14;
2561
2288
spec->autocfg.speaker_pins[1] = 0x16;
2562
2289
spec->autocfg.speaker_pins[2] = 0x17;
2290
2290
+
spec->automute = 1;
2291
2291
+
spec->automute_mode = ALC_AUTOMUTE_AMP;
2563
2292
}
2564
2293
2565
2294
static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec)
···
2572
2297
spec->autocfg.speaker_pins[0] = 0x14;
2573
2298
spec->autocfg.speaker_pins[1] = 0x16;
2574
2299
spec->autocfg.speaker_pins[2] = 0x1b;
2300
2300
+
spec->automute = 1;
2301
2301
+
spec->automute_mode = ALC_AUTOMUTE_AMP;
2575
2302
}
2576
2303
2577
2304
/*
···
2584
2307
* F-Mic = 0x1b, HP = 0x19
2585
2308
*/
2586
2309
2587
2587
-
static hda_nid_t alc880_dac_nids[4] = {
2310
2310
+
static const hda_nid_t alc880_dac_nids[4] = {
2588
2311
/* front, rear, clfe, rear_surr */
2589
2312
0x02, 0x05, 0x04, 0x03
2590
2313
};
2591
2314
2592
2592
-
static hda_nid_t alc880_adc_nids[3] = {
2315
2315
+
static const hda_nid_t alc880_adc_nids[3] = {
2593
2316
/* ADC0-2 */
2594
2317
0x07, 0x08, 0x09,
2595
2318
};
···
2598
2321
* but it shows zero connection in the real implementation on some devices.
2599
2322
* Note: this is a 915GAV bug, fixed on 915GLV
2600
2323
*/
2601
2601
-
static hda_nid_t alc880_adc_nids_alt[2] = {
2324
2324
+
static const hda_nid_t alc880_adc_nids_alt[2] = {
2602
2325
/* ADC1-2 */
2603
2326
0x08, 0x09,
2604
2327
};
···
2606
2329
#define ALC880_DIGOUT_NID 0x06
2607
2330
#define ALC880_DIGIN_NID 0x0a
2608
2331
2609
2609
-
static struct hda_input_mux alc880_capture_source = {
2332
2332
+
static const struct hda_input_mux alc880_capture_source = {
2610
2333
.num_items = 4,
2611
2334
.items = {
2612
2335
{ "Mic", 0x0 },
···
2618
2341
2619
2342
/* channel source setting (2/6 channel selection for 3-stack) */
2620
2343
/* 2ch mode */
2621
2621
-
static struct hda_verb alc880_threestack_ch2_init[] = {
2344
2344
+
static const struct hda_verb alc880_threestack_ch2_init[] = {
2622
2345
/* set line-in to input, mute it */
2623
2346
{ 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2624
2347
{ 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
···
2629
2352
};
2630
2353
2631
2354
/* 6ch mode */
2632
2632
-
static struct hda_verb alc880_threestack_ch6_init[] = {
2355
2355
+
static const struct hda_verb alc880_threestack_ch6_init[] = {
2633
2356
/* set line-in to output, unmute it */
2634
2357
{ 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2635
2358
{ 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
···
2639
2362
{ } /* end */
2640
2363
};
2641
2364
2642
2642
-
static struct hda_channel_mode alc880_threestack_modes[2] = {
2365
2365
+
static const struct hda_channel_mode alc880_threestack_modes[2] = {
2643
2366
{ 2, alc880_threestack_ch2_init },
2644
2367
{ 6, alc880_threestack_ch6_init },
2645
2368
};
2646
2369
2647
2647
-
static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
2370
2370
+
static const struct snd_kcontrol_new alc880_three_stack_mixer[] = {
2648
2371
HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2649
2372
HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2650
2373
HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
···
2789
2512
}
2790
2513
2791
2514
#define DEFINE_CAPMIX(num) \
2792
2792
-
static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
2515
2515
+
static const struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
2793
2516
_DEFINE_CAPMIX(num), \
2794
2517
_DEFINE_CAPSRC(num), \
2795
2518
{ } /* end */ \
2796
2519
}
2797
2520
2798
2521
#define DEFINE_CAPMIX_NOSRC(num) \
2799
2799
-
static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \
2522
2522
+
static const struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \
2800
2523
_DEFINE_CAPMIX(num), \
2801
2524
{ } /* end */ \
2802
2525
}
···
2819
2542
*/
2820
2543
2821
2544
/* additional mixers to alc880_three_stack_mixer */
2822
2822
-
static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
2545
2545
+
static const struct snd_kcontrol_new alc880_five_stack_mixer[] = {
2823
2546
HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2824
2547
HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
2825
2548
{ } /* end */
···
2827
2550
2828
2551
/* channel source setting (6/8 channel selection for 5-stack) */
2829
2552
/* 6ch mode */
2830
2830
-
static struct hda_verb alc880_fivestack_ch6_init[] = {
2553
2553
+
static const struct hda_verb alc880_fivestack_ch6_init[] = {
2831
2554
/* set line-in to input, mute it */
2832
2555
{ 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2833
2556
{ 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
···
2835
2558
};
2836
2559
2837
2560
/* 8ch mode */
2838
2838
-
static struct hda_verb alc880_fivestack_ch8_init[] = {
2561
2561
+
static const struct hda_verb alc880_fivestack_ch8_init[] = {
2839
2562
/* set line-in to output, unmute it */
2840
2563
{ 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2841
2564
{ 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2842
2565
{ } /* end */
2843
2566
};
2844
2567
2845
2845
-
static struct hda_channel_mode alc880_fivestack_modes[2] = {
2568
2568
+
static const struct hda_channel_mode alc880_fivestack_modes[2] = {
2846
2569
{ 6, alc880_fivestack_ch6_init },
2847
2570
{ 8, alc880_fivestack_ch8_init },
2848
2571
};
···
2857
2580
* Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
2858
2581
*/
2859
2582
2860
2860
-
static hda_nid_t alc880_6st_dac_nids[4] = {
2583
2583
+
static const hda_nid_t alc880_6st_dac_nids[4] = {
2861
2584
/* front, rear, clfe, rear_surr */
2862
2585
0x02, 0x03, 0x04, 0x05
2863
2586
};
2864
2587
2865
2865
-
static struct hda_input_mux alc880_6stack_capture_source = {
2588
2588
+
static const struct hda_input_mux alc880_6stack_capture_source = {
2866
2589
.num_items = 4,
2867
2590
.items = {
2868
2591
{ "Mic", 0x0 },
···
2873
2596
};
2874
2597
2875
2598
/* fixed 8-channels */
2876
2876
-
static struct hda_channel_mode alc880_sixstack_modes[1] = {
2599
2599
+
static const struct hda_channel_mode alc880_sixstack_modes[1] = {
2877
2600
{ 8, NULL },
2878
2601
};
2879
2602
2880
2880
-
static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
2603
2603
+
static const struct snd_kcontrol_new alc880_six_stack_mixer[] = {
2881
2604
HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2882
2605
HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2883
2606
HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
···
2932
2655
* haven't setup any initialization verbs for these yet...
2933
2656
*/
2934
2657
2935
2935
-
static hda_nid_t alc880_w810_dac_nids[3] = {
2658
2658
+
static const hda_nid_t alc880_w810_dac_nids[3] = {
2936
2659
/* front, rear/surround, clfe */
2937
2660
0x02, 0x03, 0x04
2938
2661
};
2939
2662
2940
2663
/* fixed 6 channels */
2941
2941
-
static struct hda_channel_mode alc880_w810_modes[1] = {
2664
2664
+
static const struct hda_channel_mode alc880_w810_modes[1] = {
2942
2665
{ 6, NULL }
2943
2666
};
2944
2667
2945
2668
/* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
2946
2946
-
static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
2669
2669
+
static const struct snd_kcontrol_new alc880_w810_base_mixer[] = {
2947
2670
HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2948
2671
HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2949
2672
HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
···
2965
2688
* Line = 0x1a
2966
2689
*/
2967
2690
2968
2968
-
static hda_nid_t alc880_z71v_dac_nids[1] = {
2691
2691
+
static const hda_nid_t alc880_z71v_dac_nids[1] = {
2969
2692
0x02
2970
2693
};
2971
2694
#define ALC880_Z71V_HP_DAC 0x03
2972
2695
2973
2696
/* fixed 2 channels */
2974
2974
-
static struct hda_channel_mode alc880_2_jack_modes[1] = {
2697
2697
+
static const struct hda_channel_mode alc880_2_jack_modes[1] = {
2975
2698
{ 2, NULL }
2976
2699
};
2977
2700
2978
2978
-
static struct snd_kcontrol_new alc880_z71v_mixer[] = {
2701
2701
+
static const struct snd_kcontrol_new alc880_z71v_mixer[] = {
2979
2702
HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2980
2703
HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2981
2704
HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
···
2995
2718
* Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
2996
2719
*/
2997
2720
2998
2998
-
static hda_nid_t alc880_f1734_dac_nids[1] = {
2721
2721
+
static const hda_nid_t alc880_f1734_dac_nids[1] = {
2999
2722
0x03
3000
2723
};
3001
2724
#define ALC880_F1734_HP_DAC 0x02
3002
2725
3003
3003
-
static struct snd_kcontrol_new alc880_f1734_mixer[] = {
2726
2726
+
static const struct snd_kcontrol_new alc880_f1734_mixer[] = {
3004
2727
HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3005
2728
HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
3006
2729
HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
···
3012
2735
{ } /* end */
3013
2736
};
3014
2737
3015
3015
-
static struct hda_input_mux alc880_f1734_capture_source = {
2738
2738
+
static const struct hda_input_mux alc880_f1734_capture_source = {
3016
2739
.num_items = 2,
3017
2740
.items = {
3018
2741
{ "Mic", 0x1 },
···
3032
2755
#define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
3033
2756
#define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
3034
2757
3035
3035
-
static struct snd_kcontrol_new alc880_asus_mixer[] = {
2758
2758
+
static const struct snd_kcontrol_new alc880_asus_mixer[] = {
3036
2759
HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3037
2760
HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3038
2761
HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
···
3066
2789
*/
3067
2790
3068
2791
/* additional mixers to alc880_asus_mixer */
3069
3069
-
static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
2792
2792
+
static const struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
3070
2793
HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
3071
2794
HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
3072
2795
{ } /* end */
3073
2796
};
3074
2797
3075
2798
/* TCL S700 */
3076
3076
-
static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
2799
2799
+
static const struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
3077
2800
HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3078
2801
HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
3079
2802
HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
···
3087
2810
};
3088
2811
3089
2812
/* Uniwill */
3090
3090
-
static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
2813
2813
+
static const struct snd_kcontrol_new alc880_uniwill_mixer[] = {
3091
2814
HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3092
2815
HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
3093
2816
HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
···
3114
2837
{ } /* end */
3115
2838
};
3116
2839
3117
3117
-
static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
2840
2840
+
static const struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
3118
2841
HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3119
2842
HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
3120
2843
HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
···
3128
2851
{ } /* end */
3129
2852
};
3130
2853
3131
3131
-
static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
2854
2854
+
static const struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
3132
2855
HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3133
2856
HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
3134
2857
HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
···
3155
2878
"Speaker Playback Volume",
3156
2879
"Mono Playback Volume",
3157
2880
"Line-Out Playback Volume",
3158
3158
-
"PCM Playback Volume",
3159
2881
NULL,
3160
2882
};
3161
2883
···
3169
2893
"Mono Playback Switch",
3170
2894
"IEC958 Playback Switch",
3171
2895
"Line-Out Playback Switch",
3172
3172
-
"PCM Playback Switch",
3173
2896
NULL,
3174
2897
};
3175
2898
···
3189
2914
3190
2915
#ifdef CONFIG_SND_HDA_INPUT_BEEP
3191
2916
/* additional beep mixers; the actual parameters are overwritten at build */
3192
3192
-
static struct snd_kcontrol_new alc_beep_mixer[] = {
2917
2917
+
static const struct snd_kcontrol_new alc_beep_mixer[] = {
3193
2918
HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
3194
2919
HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
3195
2920
{ } /* end */
···
3200
2925
{
3201
2926
struct alc_spec *spec = codec->spec;
3202
2927
struct snd_kcontrol *kctl = NULL;
3203
3203
-
struct snd_kcontrol_new *knew;
2928
2928
+
const struct snd_kcontrol_new *knew;
3204
2929
int i, j, err;
3205
2930
unsigned int u;
3206
2931
hda_nid_t nid;
···
3237
2962
#ifdef CONFIG_SND_HDA_INPUT_BEEP
3238
2963
/* create beep controls if needed */
3239
2964
if (spec->beep_amp) {
3240
3240
-
struct snd_kcontrol_new *knew;
2965
2965
+
const struct snd_kcontrol_new *knew;
3241
2966
for (knew = alc_beep_mixer; knew->name; knew++) {
3242
2967
struct snd_kcontrol *kctl;
3243
2968
kctl = snd_ctl_new1(knew, codec);
···
3276
3001
if (!kctl)
3277
3002
kctl = snd_hda_find_mixer_ctl(codec, "Input Source");
3278
3003
for (i = 0; kctl && i < kctl->count; i++) {
3279
3279
-
hda_nid_t *nids = spec->capsrc_nids;
3004
3004
+
const hda_nid_t *nids = spec->capsrc_nids;
3280
3005
if (!nids)
3281
3006
nids = spec->adc_nids;
3282
3007
err = snd_hda_add_nid(codec, kctl, i, nids[i]);
···
3354
3079
/*
3355
3080
* generic initialization of ADC, input mixers and output mixers
3356
3081
*/
3357
3357
-
static struct hda_verb alc880_volume_init_verbs[] = {
3082
3082
+
static const struct hda_verb alc880_volume_init_verbs[] = {
3358
3083
/*
3359
3084
* Unmute ADC0-2 and set the default input to mic-in
3360
3085
*/
···
3405
3130
* 3-stack pin configuration:
3406
3131
* front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
3407
3132
*/
3408
3408
-
static struct hda_verb alc880_pin_3stack_init_verbs[] = {
3133
3133
+
static const struct hda_verb alc880_pin_3stack_init_verbs[] = {
3409
3134
/*
3410
3135
* preset connection lists of input pins
3411
3136
* 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
···
3443
3168
* front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
3444
3169
* line-in/side = 0x1a, f-mic = 0x1b
3445
3170
*/
3446
3446
-
static struct hda_verb alc880_pin_5stack_init_verbs[] = {
3171
3171
+
static const struct hda_verb alc880_pin_5stack_init_verbs[] = {
3447
3172
/*
3448
3173
* preset connection lists of input pins
3449
3174
* 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
···
3487
3212
* W810 pin configuration:
3488
3213
* front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
3489
3214
*/
3490
3490
-
static struct hda_verb alc880_pin_w810_init_verbs[] = {
3215
3215
+
static const struct hda_verb alc880_pin_w810_init_verbs[] = {
3491
3216
/* hphone/speaker input selector: front DAC */
3492
3217
{0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
3493
3218
···
3508
3233
* Z71V pin configuration:
3509
3234
* Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
3510
3235
*/
3511
3511
-
static struct hda_verb alc880_pin_z71v_init_verbs[] = {
3236
3236
+
static const struct hda_verb alc880_pin_z71v_init_verbs[] = {
3512
3237
{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3513
3238
{0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3514
3239
{0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
···
3527
3252
* front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
3528
3253
* f-mic = 0x19, line = 0x1a, HP = 0x1b
3529
3254
*/
3530
3530
-
static struct hda_verb alc880_pin_6stack_init_verbs[] = {
3255
3255
+
static const struct hda_verb alc880_pin_6stack_init_verbs[] = {
3531
3256
{0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3532
3257
3533
3258
{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
···
3557
3282
* HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
3558
3283
* line = 0x1a
3559
3284
*/
3560
3560
-
static struct hda_verb alc880_uniwill_init_verbs[] = {
3285
3285
+
static const struct hda_verb alc880_uniwill_init_verbs[] = {
3561
3286
{0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3562
3287
3563
3288
{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
···
3595
3320
* Uniwill P53
3596
3321
* HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
3597
3322
*/
3598
3598
-
static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
3323
3323
+
static const struct hda_verb alc880_uniwill_p53_init_verbs[] = {
3599
3324
{0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3600
3325
3601
3326
{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
···
3624
3349
{ }
3625
3350
};
3626
3351
3627
3627
-
static struct hda_verb alc880_beep_init_verbs[] = {
3352
3352
+
static const struct hda_verb alc880_beep_init_verbs[] = {
3628
3353
{ 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
3629
3354
{ }
3630
3355
};
···
3647
3372
spec->autocfg.hp_pins[0] = 0x14;
3648
3373
spec->autocfg.speaker_pins[0] = 0x15;
3649
3374
spec->autocfg.speaker_pins[0] = 0x16;
3375
3375
+
spec->automute = 1;
3376
3376
+
spec->automute_mode = ALC_AUTOMUTE_AMP;
3650
3377
}
3651
3378
3652
3379
static void alc880_uniwill_init_hook(struct hda_codec *codec)
3653
3380
{
3654
3654
-
alc_automute_amp(codec);
3381
3381
+
alc_hp_automute(codec);
3655
3382
alc88x_simple_mic_automute(codec);
3656
3383
}
3657
3384
···
3668
3391
alc88x_simple_mic_automute(codec);
3669
3392
break;
3670
3393
default:
3671
3671
-
alc_automute_amp_unsol_event(codec, res);
3394
3394
+
alc_sku_unsol_event(codec, res);
3672
3395
break;
3673
3396
}
3674
3397
}
···
3679
3402
3680
3403
spec->autocfg.hp_pins[0] = 0x14;
3681
3404
spec->autocfg.speaker_pins[0] = 0x15;
3405
3405
+
spec->automute = 1;
3406
3406
+
spec->automute_mode = ALC_AUTOMUTE_AMP;
3682
3407
}
3683
3408
3684
3409
static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
···
3705
3426
if ((res >> 28) == ALC880_DCVOL_EVENT)
3706
3427
alc880_uniwill_p53_dcvol_automute(codec);
3707
3428
else
3708
3708
-
alc_automute_amp_unsol_event(codec, res);
3429
3429
+
alc_sku_unsol_event(codec, res);
3709
3430
}
3710
3431
3711
3432
/*
3712
3433
* F1734 pin configuration:
3713
3434
* HP = 0x14, speaker-out = 0x15, mic = 0x18
3714
3435
*/
3715
3715
-
static struct hda_verb alc880_pin_f1734_init_verbs[] = {
3436
3436
+
static const struct hda_verb alc880_pin_f1734_init_verbs[] = {
3716
3437
{0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
3717
3438
{0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
3718
3439
{0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
···
3744
3465
* ASUS pin configuration:
3745
3466
* HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
3746
3467
*/
3747
3747
-
static struct hda_verb alc880_pin_asus_init_verbs[] = {
3468
3468
+
static const struct hda_verb alc880_pin_asus_init_verbs[] = {
3748
3469
{0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
3749
3470
{0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
3750
3471
{0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
···
3778
3499
#define alc880_gpio3_init_verbs alc_gpio3_init_verbs
3779
3500
3780
3501
/* Clevo m520g init */
3781
3781
-
static struct hda_verb alc880_pin_clevo_init_verbs[] = {
3502
3502
+
static const struct hda_verb alc880_pin_clevo_init_verbs[] = {
3782
3503
/* headphone output */
3783
3504
{0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3784
3505
/* line-out */
···
3806
3527
{ }
3807
3528
};
3808
3529
3809
3809
-
static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
3530
3530
+
static const struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
3810
3531
/* change to EAPD mode */
3811
3532
{0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3812
3533
{0x20, AC_VERB_SET_PROC_COEF, 0x3060},
···
3844
3565
*/
3845
3566
3846
3567
/* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
3847
3847
-
static hda_nid_t alc880_lg_dac_nids[3] = {
3568
3568
+
static const hda_nid_t alc880_lg_dac_nids[3] = {
3848
3569
0x05, 0x02, 0x03
3849
3570
};
3850
3571
3851
3572
/* seems analog CD is not working */
3852
3852
-
static struct hda_input_mux alc880_lg_capture_source = {
3573
3573
+
static const struct hda_input_mux alc880_lg_capture_source = {
3853
3574
.num_items = 3,
3854
3575
.items = {
3855
3576
{ "Mic", 0x1 },
···
3859
3580
};
3860
3581
3861
3582
/* 2,4,6 channel modes */
3862
3862
-
static struct hda_verb alc880_lg_ch2_init[] = {
3583
3583
+
static const struct hda_verb alc880_lg_ch2_init[] = {
3863
3584
/* set line-in and mic-in to input */
3864
3585
{ 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
3865
3586
{ 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3866
3587
{ }
3867
3588
};
3868
3589
3869
3869
-
static struct hda_verb alc880_lg_ch4_init[] = {
3590
3590
+
static const struct hda_verb alc880_lg_ch4_init[] = {
3870
3591
/* set line-in to out and mic-in to input */
3871
3592
{ 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3872
3593
{ 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3873
3594
{ }
3874
3595
};
3875
3596
3876
3876
-
static struct hda_verb alc880_lg_ch6_init[] = {
3597
3597
+
static const struct hda_verb alc880_lg_ch6_init[] = {
3877
3598
/* set line-in and mic-in to output */
3878
3599
{ 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3879
3600
{ 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3880
3601
{ }
3881
3602
};
3882
3603
3883
3883
-
static struct hda_channel_mode alc880_lg_ch_modes[3] = {
3604
3604
+
static const struct hda_channel_mode alc880_lg_ch_modes[3] = {
3884
3605
{ 2, alc880_lg_ch2_init },
3885
3606
{ 4, alc880_lg_ch4_init },
3886
3607
{ 6, alc880_lg_ch6_init },
3887
3608
};
3888
3609
3889
3889
-
static struct snd_kcontrol_new alc880_lg_mixer[] = {
3610
3610
+
static const struct snd_kcontrol_new alc880_lg_mixer[] = {
3890
3611
HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3891
3612
HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
3892
3613
HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
···
3911
3632
{ } /* end */
3912
3633
};
3913
3634
3914
3914
-
static struct hda_verb alc880_lg_init_verbs[] = {
3635
3635
+
static const struct hda_verb alc880_lg_init_verbs[] = {
3915
3636
/* set capture source to mic-in */
3916
3637
{0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3917
3638
{0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
···
3949
3670
3950
3671
spec->autocfg.hp_pins[0] = 0x1b;
3951
3672
spec->autocfg.speaker_pins[0] = 0x17;
3673
3673
+
spec->automute = 1;
3674
3674
+
spec->automute_mode = ALC_AUTOMUTE_AMP;
3952
3675
}
3953
3676
3954
3677
/*
···
3965
3684
* SPDIF-Out: 0x1e
3966
3685
*/
3967
3686
3968
3968
-
static struct hda_input_mux alc880_lg_lw_capture_source = {
3687
3687
+
static const struct hda_input_mux alc880_lg_lw_capture_source = {
3969
3688
.num_items = 3,
3970
3689
.items = {
3971
3690
{ "Mic", 0x0 },
···
3976
3695
3977
3696
#define alc880_lg_lw_modes alc880_threestack_modes
3978
3697
3979
3979
-
static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
3698
3698
+
static const struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
3980
3699
HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3981
3700
HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3982
3701
HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
···
4001
3720
{ } /* end */
4002
3721
};
4003
3722
4004
4004
-
static struct hda_verb alc880_lg_lw_init_verbs[] = {
3723
3723
+
static const struct hda_verb alc880_lg_lw_init_verbs[] = {
4005
3724
{0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
4006
3725
{0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
4007
3726
{0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
···
4035
3754
4036
3755
spec->autocfg.hp_pins[0] = 0x1b;
4037
3756
spec->autocfg.speaker_pins[0] = 0x14;
3757
3757
+
spec->automute = 1;
3758
3758
+
spec->automute_mode = ALC_AUTOMUTE_AMP;
4038
3759
}
4039
3760
4040
4040
-
static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
3761
3761
+
static const struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
4041
3762
HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
4042
3763
HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
4043
3764
HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
···
4049
3766
{ } /* end */
4050
3767
};
4051
3768
4052
4052
-
static struct hda_input_mux alc880_medion_rim_capture_source = {
3769
3769
+
static const struct hda_input_mux alc880_medion_rim_capture_source = {
4053
3770
.num_items = 2,
4054
3771
.items = {
4055
3772
{ "Mic", 0x0 },
···
4057
3774
},
4058
3775
};
4059
3776
4060
4060
-
static struct hda_verb alc880_medion_rim_init_verbs[] = {
3777
3777
+
static const struct hda_verb alc880_medion_rim_init_verbs[] = {
4061
3778
{0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
4062
3779
4063
3780
{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
···
4084
3801
static void alc880_medion_rim_automute(struct hda_codec *codec)
4085
3802
{
4086
3803
struct alc_spec *spec = codec->spec;
4087
4087
-
alc_automute_amp(codec);
3804
3804
+
alc_hp_automute(codec);
4088
3805
/* toggle EAPD */
4089
3806
if (spec->jack_present)
4090
3807
snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
···
4108
3825
4109
3826
spec->autocfg.hp_pins[0] = 0x14;
4110
3827
spec->autocfg.speaker_pins[0] = 0x1b;
3828
3828
+
spec->automute = 1;
3829
3829
+
spec->automute_mode = ALC_AUTOMUTE_AMP;
4111
3830
}
4112
3831
4113
3832
#ifdef CONFIG_SND_HDA_POWER_SAVE
4114
4114
-
static struct hda_amp_list alc880_loopbacks[] = {
3833
3833
+
static const struct hda_amp_list alc880_loopbacks[] = {
4115
3834
{ 0x0b, HDA_INPUT, 0 },
4116
3835
{ 0x0b, HDA_INPUT, 1 },
4117
3836
{ 0x0b, HDA_INPUT, 2 },
···
4122
3837
{ } /* end */
4123
3838
};
4124
3839
4125
4125
-
static struct hda_amp_list alc880_lg_loopbacks[] = {
3840
3840
+
static const struct hda_amp_list alc880_lg_loopbacks[] = {
4126
3841
{ 0x0b, HDA_INPUT, 1 },
4127
3842
{ 0x0b, HDA_INPUT, 6 },
4128
3843
{ 0x0b, HDA_INPUT, 7 },
···
4294
4009
return 0;
4295
4010
}
4296
4011
4297
4297
-
static struct hda_pcm_stream dualmic_pcm_analog_capture = {
4012
4012
+
static const struct hda_pcm_stream dualmic_pcm_analog_capture = {
4298
4013
.substreams = 1,
4299
4014
.channels_min = 2,
4300
4015
.channels_max = 2,
···
4307
4022
4308
4023
/*
4309
4024
*/
4310
4310
-
static struct hda_pcm_stream alc880_pcm_analog_playback = {
4025
4025
+
static const struct hda_pcm_stream alc880_pcm_analog_playback = {
4311
4026
.substreams = 1,
4312
4027
.channels_min = 2,
4313
4028
.channels_max = 8,
···
4319
4034
},
4320
4035
};
4321
4036
4322
4322
-
static struct hda_pcm_stream alc880_pcm_analog_capture = {
4037
4037
+
static const struct hda_pcm_stream alc880_pcm_analog_capture = {
4323
4038
.substreams = 1,
4324
4039
.channels_min = 2,
4325
4040
.channels_max = 2,
4326
4041
/* NID is set in alc_build_pcms */
4327
4042
};
4328
4043
4329
4329
-
static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
4044
4044
+
static const struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
4330
4045
.substreams = 1,
4331
4046
.channels_min = 2,
4332
4047
.channels_max = 2,
4333
4048
/* NID is set in alc_build_pcms */
4334
4049
};
4335
4050
4336
4336
-
static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
4051
4051
+
static const struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
4337
4052
.substreams = 2, /* can be overridden */
4338
4053
.channels_min = 2,
4339
4054
.channels_max = 2,
···
4344
4059
},
4345
4060
};
4346
4061
4347
4347
-
static struct hda_pcm_stream alc880_pcm_digital_playback = {
4062
4062
+
static const struct hda_pcm_stream alc880_pcm_digital_playback = {
4348
4063
.substreams = 1,
4349
4064
.channels_min = 2,
4350
4065
.channels_max = 2,
···
4357
4072
},
4358
4073
};
4359
4074
4360
4360
-
static struct hda_pcm_stream alc880_pcm_digital_capture = {
4075
4075
+
static const struct hda_pcm_stream alc880_pcm_digital_capture = {
4361
4076
.substreams = 1,
4362
4077
.channels_min = 2,
4363
4078
.channels_max = 2,
···
4365
4080
};
4366
4081
4367
4082
/* Used by alc_build_pcms to flag that a PCM has no playback stream */
4368
4368
-
static struct hda_pcm_stream alc_pcm_null_stream = {
4083
4083
+
static const struct hda_pcm_stream alc_pcm_null_stream = {
4369
4084
.substreams = 0,
4370
4085
.channels_min = 0,
4371
4086
.channels_max = 0,
···
4459
4174
alc_pcm_null_stream;
4460
4175
info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
4461
4176
}
4462
4462
-
if (spec->num_adc_nids > 1) {
4177
4177
+
if (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture) {
4463
4178
info->stream[SNDRV_PCM_STREAM_CAPTURE] =
4464
4179
*spec->stream_analog_alt_capture;
4465
4180
info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
···
4478
4193
4479
4194
static inline void alc_shutup(struct hda_codec *codec)
4480
4195
{
4196
4196
+
struct alc_spec *spec = codec->spec;
4197
4197
+
4198
4198
+
if (spec && spec->shutup)
4199
4199
+
spec->shutup(codec);
4481
4200
snd_hda_shutup_pins(codec);
4482
4201
}
4483
4202
···
4515
4226
#ifdef CONFIG_SND_HDA_POWER_SAVE
4516
4227
static void alc_power_eapd(struct hda_codec *codec)
4517
4228
{
4518
4518
-
/* We currently only handle front, HP */
4519
4519
-
switch (codec->vendor_id) {
4520
4520
-
case 0x10ec0260:
4521
4521
-
set_eapd(codec, 0x0f, 0);
4522
4522
-
set_eapd(codec, 0x10, 0);
4523
4523
-
break;
4524
4524
-
case 0x10ec0262:
4525
4525
-
case 0x10ec0267:
4526
4526
-
case 0x10ec0268:
4527
4527
-
case 0x10ec0269:
4528
4528
-
case 0x10ec0270:
4529
4529
-
case 0x10ec0272:
4530
4530
-
case 0x10ec0660:
4531
4531
-
case 0x10ec0662:
4532
4532
-
case 0x10ec0663:
4533
4533
-
case 0x10ec0665:
4534
4534
-
case 0x10ec0862:
4535
4535
-
case 0x10ec0889:
4536
4536
-
set_eapd(codec, 0x14, 0);
4537
4537
-
set_eapd(codec, 0x15, 0);
4538
4538
-
break;
4539
4539
-
}
4229
4229
+
alc_auto_setup_eapd(codec, false);
4540
4230
}
4541
4231
4542
4232
static int alc_suspend(struct hda_codec *codec, pm_message_t state)
···
4531
4263
#ifdef SND_HDA_NEEDS_RESUME
4532
4264
static int alc_resume(struct hda_codec *codec)
4533
4265
{
4266
4266
+
msleep(150); /* to avoid pop noise */
4534
4267
codec->patch_ops.init(codec);
4535
4268
snd_hda_codec_resume_amp(codec);
4536
4269
snd_hda_codec_resume_cache(codec);
···
4542
4273
4543
4274
/*
4544
4275
*/
4545
4545
-
static struct hda_codec_ops alc_patch_ops = {
4276
4276
+
static const struct hda_codec_ops alc_patch_ops = {
4546
4277
.build_controls = alc_build_controls,
4547
4278
.build_pcms = alc_build_pcms,
4548
4279
.init = alc_init,
···
4577
4308
* enum controls.
4578
4309
*/
4579
4310
#ifdef CONFIG_SND_DEBUG
4580
4580
-
static hda_nid_t alc880_test_dac_nids[4] = {
4311
4311
+
static const hda_nid_t alc880_test_dac_nids[4] = {
4581
4312
0x02, 0x03, 0x04, 0x05
4582
4313
};
4583
4314
4584
4584
-
static struct hda_input_mux alc880_test_capture_source = {
4315
4315
+
static const struct hda_input_mux alc880_test_capture_source = {
4585
4316
.num_items = 7,
4586
4317
.items = {
4587
4318
{ "In-1", 0x0 },
···
4594
4325
},
4595
4326
};
4596
4327
4597
4597
-
static struct hda_channel_mode alc880_test_modes[4] = {
4328
4328
+
static const struct hda_channel_mode alc880_test_modes[4] = {
4598
4329
{ 2, NULL },
4599
4330
{ 4, NULL },
4600
4331
{ 6, NULL },
···
4604
4335
static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
4605
4336
struct snd_ctl_elem_info *uinfo)
4606
4337
{
4607
4607
-
static char *texts[] = {
4338
4338
+
static const char * const texts[] = {
4608
4339
"N/A", "Line Out", "HP Out",
4609
4340
"In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
4610
4341
};
···
4649
4380
{
4650
4381
struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4651
4382
hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4652
4652
-
static unsigned int ctls[] = {
4383
4383
+
static const unsigned int ctls[] = {
4653
4384
0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
4654
4385
AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
4655
4386
AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
···
4679
4410
static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
4680
4411
struct snd_ctl_elem_info *uinfo)
4681
4412
{
4682
4682
-
static char *texts[] = {
4413
4413
+
static const char * const texts[] = {
4683
4414
"Front", "Surround", "CLFE", "Side"
4684
4415
};
4685
4416
uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
···
4740
4471
.private_value = nid \
4741
4472
}
4742
4473
4743
4743
-
static struct snd_kcontrol_new alc880_test_mixer[] = {
4474
4474
+
static const struct snd_kcontrol_new alc880_test_mixer[] = {
4744
4475
HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
4745
4476
HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
4746
4477
HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
···
4781
4512
{ } /* end */
4782
4513
};
4783
4514
4784
4784
-
static struct hda_verb alc880_test_init_verbs[] = {
4515
4515
+
static const struct hda_verb alc880_test_init_verbs[] = {
4785
4516
/* Unmute inputs of 0x0c - 0x0f */
4786
4517
{0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4787
4518
{0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
···
4865
4596
[ALC880_AUTO] = "auto",
4866
4597
};
4867
4598
4868
4868
-
static struct snd_pci_quirk alc880_cfg_tbl[] = {
4599
4599
+
static const struct snd_pci_quirk alc880_cfg_tbl[] = {
4869
4600
SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
4870
4601
SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
4871
4602
SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
···
4945
4676
/*
4946
4677
* ALC880 codec presets
4947
4678
*/
4948
4948
-
static struct alc_config_preset alc880_presets[] = {
4679
4679
+
static const struct alc_config_preset alc880_presets[] = {
4949
4680
[ALC880_3ST] = {
4950
4681
.mixers = { alc880_three_stack_mixer },
4951
4682
.init_verbs = { alc880_volume_init_verbs,
···
5063
4794
.input_mux = &alc880_f1734_capture_source,
5064
4795
.unsol_event = alc880_uniwill_p53_unsol_event,
5065
4796
.setup = alc880_uniwill_p53_setup,
5066
5066
-
.init_hook = alc_automute_amp,
4797
4797
+
.init_hook = alc_hp_automute,
5067
4798
},
5068
4799
[ALC880_ASUS] = {
5069
4800
.mixers = { alc880_asus_mixer },
···
5154
4885
.input_mux = &alc880_capture_source,
5155
4886
.unsol_event = alc880_uniwill_p53_unsol_event,
5156
4887
.setup = alc880_uniwill_p53_setup,
5157
5157
-
.init_hook = alc_automute_amp,
4888
4888
+
.init_hook = alc_hp_automute,
5158
4889
},
5159
4890
[ALC880_FUJITSU] = {
5160
4891
.mixers = { alc880_fujitsu_mixer },
···
5169
4900
.input_mux = &alc880_capture_source,
5170
4901
.unsol_event = alc880_uniwill_p53_unsol_event,
5171
4902
.setup = alc880_uniwill_p53_setup,
5172
5172
-
.init_hook = alc_automute_amp,
4903
4903
+
.init_hook = alc_hp_automute,
5173
4904
},
5174
4905
[ALC880_CLEVO] = {
5175
4906
.mixers = { alc880_three_stack_mixer },
···
5194
4925
.channel_mode = alc880_lg_ch_modes,
5195
4926
.need_dac_fix = 1,
5196
4927
.input_mux = &alc880_lg_capture_source,
5197
5197
-
.unsol_event = alc_automute_amp_unsol_event,
4928
4928
+
.unsol_event = alc_sku_unsol_event,
5198
4929
.setup = alc880_lg_setup,
5199
5199
-
.init_hook = alc_automute_amp,
4930
4930
+
.init_hook = alc_hp_automute,
5200
4931
#ifdef CONFIG_SND_HDA_POWER_SAVE
5201
4932
.loopbacks = alc880_lg_loopbacks,
5202
4933
#endif
···
5211
4942
.num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
5212
4943
.channel_mode = alc880_lg_lw_modes,
5213
4944
.input_mux = &alc880_lg_lw_capture_source,
5214
5214
-
.unsol_event = alc_automute_amp_unsol_event,
4945
4945
+
.unsol_event = alc_sku_unsol_event,
5215
4946
.setup = alc880_lg_lw_setup,
5216
5216
-
.init_hook = alc_automute_amp,
4947
4947
+
.init_hook = alc_hp_automute,
5217
4948
},
5218
4949
[ALC880_MEDION_RIM] = {
5219
4950
.mixers = { alc880_medion_rim_mixer },
···
5253
4984
ALC_CTL_WIDGET_MUTE,
5254
4985
ALC_CTL_BIND_MUTE,
5255
4986
};
5256
5256
-
static struct snd_kcontrol_new alc880_control_templates[] = {
4987
4987
+
static const struct snd_kcontrol_new alc880_control_templates[] = {
5257
4988
HDA_CODEC_VOLUME(NULL, 0, 0, 0),
5258
4989
HDA_CODEC_MUTE(NULL, 0, 0, 0),
5259
4990
HDA_BIND_MUTE(NULL, 0, 0, 0),
5260
4991
};
4992
4992
+
4993
4993
+
static struct snd_kcontrol_new *alc_kcontrol_new(struct alc_spec *spec)
4994
4994
+
{
4995
4995
+
snd_array_init(&spec->kctls, sizeof(struct snd_kcontrol_new), 32);
4996
4996
+
return snd_array_new(&spec->kctls);
4997
4997
+
}
5261
4998
5262
4999
/* add dynamic controls */
5263
5000
static int add_control(struct alc_spec *spec, int type, const char *name,
···
5271
4996
{
5272
4997
struct snd_kcontrol_new *knew;
5273
4998
5274
5274
-
snd_array_init(&spec->kctls, sizeof(*knew), 32);
5275
5275
-
knew = snd_array_new(&spec->kctls);
4999
4999
+
knew = alc_kcontrol_new(spec);
5276
5000
if (!knew)
5277
5001
return -ENOMEM;
5278
5002
*knew = alc880_control_templates[type];
···
5329
5055
nid = cfg->line_out_pins[i];
5330
5056
if (alc880_is_fixed_pin(nid)) {
5331
5057
int idx = alc880_fixed_pin_idx(nid);
5332
5332
-
spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
5058
5058
+
spec->private_dac_nids[i] = alc880_idx_to_dac(idx);
5333
5059
assigned[idx] = 1;
5334
5060
}
5335
5061
}
···
5341
5067
/* search for an empty channel */
5342
5068
for (j = 0; j < cfg->line_outs; j++) {
5343
5069
if (!assigned[j]) {
5344
5344
-
spec->multiout.dac_nids[i] =
5070
5070
+
spec->private_dac_nids[i] =
5345
5071
alc880_idx_to_dac(j);
5346
5072
assigned[j] = 1;
5347
5073
break;
···
5352
5078
return 0;
5353
5079
}
5354
5080
5355
5355
-
static const char *alc_get_line_out_pfx(const struct auto_pin_cfg *cfg,
5081
5081
+
static const char *alc_get_line_out_pfx(struct alc_spec *spec,
5356
5082
bool can_be_master)
5357
5083
{
5358
5358
-
if (!cfg->hp_outs && !cfg->speaker_outs && can_be_master)
5084
5084
+
struct auto_pin_cfg *cfg = &spec->autocfg;
5085
5085
+
5086
5086
+
if (cfg->line_outs == 1 && !spec->multi_ios &&
5087
5087
+
!cfg->hp_outs && !cfg->speaker_outs && can_be_master)
5359
5088
return "Master";
5360
5089
5361
5090
switch (cfg->line_out_type) {
···
5369
5092
case AUTO_PIN_HP_OUT:
5370
5093
return "Headphone";
5371
5094
default:
5372
5372
-
if (cfg->line_outs == 1)
5095
5095
+
if (cfg->line_outs == 1 && !spec->multi_ios)
5373
5096
return "PCM";
5374
5097
break;
5375
5098
}
···
5383
5106
static const char * const chname[4] = {
5384
5107
"Front", "Surround", NULL /*CLFE*/, "Side"
5385
5108
};
5386
5386
-
const char *pfx = alc_get_line_out_pfx(cfg, false);
5109
5109
+
const char *pfx = alc_get_line_out_pfx(spec, false);
5387
5110
hda_nid_t nid;
5388
5388
-
int i, err;
5111
5111
+
int i, err, noutputs;
5389
5112
5390
5390
-
for (i = 0; i < cfg->line_outs; i++) {
5113
5113
+
noutputs = cfg->line_outs;
5114
5114
+
if (spec->multi_ios > 0)
5115
5115
+
noutputs += spec->multi_ios;
5116
5116
+
5117
5117
+
for (i = 0; i < noutputs; i++) {
5391
5118
if (!spec->multiout.dac_nids[i])
5392
5119
continue;
5393
5120
nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
···
5657
5376
}
5658
5377
}
5659
5378
5379
5379
+
static int alc_auto_add_multi_channel_mode(struct hda_codec *codec);
5380
5380
+
5660
5381
/* parse the BIOS configuration and set up the alc_spec */
5661
5382
/* return 1 if successful, 0 if the proper config is not found,
5662
5383
* or a negative error code
···
5667
5384
{
5668
5385
struct alc_spec *spec = codec->spec;
5669
5386
int err;
5670
5670
-
static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
5387
5387
+
static const hda_nid_t alc880_ignore[] = { 0x1d, 0 };
5671
5388
5672
5389
err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
5673
5390
alc880_ignore);
···
5677
5394
return 0; /* can't find valid BIOS pin config */
5678
5395
5679
5396
err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
5397
5397
+
if (err < 0)
5398
5398
+
return err;
5399
5399
+
err = alc_auto_add_multi_channel_mode(codec);
5680
5400
if (err < 0)
5681
5401
return err;
5682
5402
err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
···
5753
5467
spec->capsrc_nids += i;
5754
5468
spec->adc_nids += i;
5755
5469
spec->num_adc_nids = 1;
5470
5470
+
/* optional dock-mic */
5471
5471
+
eidx = get_connection_index(codec, cap, spec->dock_mic.pin);
5472
5472
+
if (eidx < 0)
5473
5473
+
spec->dock_mic.pin = 0;
5474
5474
+
else
5475
5475
+
spec->dock_mic.mux_idx = eidx;
5756
5476
return;
5757
5477
}
5758
5478
snd_printd(KERN_INFO "hda_codec: %s: "
···
5786
5494
struct alc_spec *spec = codec->spec;
5787
5495
int i;
5788
5496
5497
5497
+
if (!pin)
5498
5498
+
return 0;
5789
5499
for (i = 0; i < spec->num_adc_nids; i++) {
5790
5500
hda_nid_t cap = spec->capsrc_nids ?
5791
5501
spec->capsrc_nids[i] : spec->adc_nids[i];
···
5828
5534
{
5829
5535
struct alc_spec *spec = codec->spec;
5830
5536
init_capsrc_for_pin(codec, spec->ext_mic.pin);
5537
5537
+
init_capsrc_for_pin(codec, spec->dock_mic.pin);
5831
5538
init_capsrc_for_pin(codec, spec->int_mic.pin);
5832
5539
}
5833
5540
···
5845
5550
static void set_capture_mixer(struct hda_codec *codec)
5846
5551
{
5847
5552
struct alc_spec *spec = codec->spec;
5848
5848
-
static struct snd_kcontrol_new *caps[2][3] = {
5553
5553
+
static const struct snd_kcontrol_new *caps[2][3] = {
5849
5554
{ alc_capture_mixer_nosrc1,
5850
5555
alc_capture_mixer_nosrc2,
5851
5556
alc_capture_mixer_nosrc3 },
···
5871
5576
}
5872
5577
5873
5578
/* fill adc_nids (and capsrc_nids) containing all active input pins */
5874
5874
-
static void fillup_priv_adc_nids(struct hda_codec *codec, hda_nid_t *nids,
5579
5579
+
static void fillup_priv_adc_nids(struct hda_codec *codec, const hda_nid_t *nids,
5875
5580
int num_nids)
5876
5581
{
5877
5582
struct alc_spec *spec = codec->spec;
···
5937
5642
#define set_beep_amp(spec, nid, idx, dir) \
5938
5643
((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
5939
5644
5940
5940
-
static struct snd_pci_quirk beep_white_list[] = {
5645
5645
+
static const struct snd_pci_quirk beep_white_list[] = {
5941
5646
SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
5942
5647
SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
5943
5648
SND_PCI_QUIRK(0x1043, 0x831a, "EeePC", 1),
5649
5649
+
SND_PCI_QUIRK(0x1043, 0x834a, "EeePC", 1),
5944
5650
SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
5945
5651
{}
5946
5652
};
···
6049
5753
* ALC260 support
6050
5754
*/
6051
5755
6052
6052
-
static hda_nid_t alc260_dac_nids[1] = {
5756
5756
+
static const hda_nid_t alc260_dac_nids[1] = {
6053
5757
/* front */
6054
5758
0x02,
6055
5759
};
6056
5760
6057
6057
-
static hda_nid_t alc260_adc_nids[1] = {
5761
5761
+
static const hda_nid_t alc260_adc_nids[1] = {
6058
5762
/* ADC0 */
6059
5763
0x04,
6060
5764
};
6061
5765
6062
6062
-
static hda_nid_t alc260_adc_nids_alt[1] = {
5766
5766
+
static const hda_nid_t alc260_adc_nids_alt[1] = {
6063
5767
/* ADC1 */
6064
5768
0x05,
6065
5769
};
···
6067
5771
/* NIDs used when simultaneous access to both ADCs makes sense. Note that
6068
5772
* alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
6069
5773
*/
6070
6070
-
static hda_nid_t alc260_dual_adc_nids[2] = {
5774
5774
+
static const hda_nid_t alc260_dual_adc_nids[2] = {
6071
5775
/* ADC0, ADC1 */
6072
5776
0x04, 0x05
6073
5777
};
···
6075
5779
#define ALC260_DIGOUT_NID 0x03
6076
5780
#define ALC260_DIGIN_NID 0x06
6077
5781
6078
6078
-
static struct hda_input_mux alc260_capture_source = {
5782
5782
+
static const struct hda_input_mux alc260_capture_source = {
6079
5783
.num_items = 4,
6080
5784
.items = {
6081
5785
{ "Mic", 0x0 },
···
6091
5795
* recording the mixer output on the second ADC (ADC0 doesn't have a
6092
5796
* connection to the mixer output).
6093
5797
*/
6094
6094
-
static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
5798
5798
+
static const struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
6095
5799
{
6096
5800
.num_items = 3,
6097
5801
.items = {
···
6115
5819
/* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
6116
5820
* the Fujitsu S702x, but jacks are marked differently.
6117
5821
*/
6118
6118
-
static struct hda_input_mux alc260_acer_capture_sources[2] = {
5822
5822
+
static const struct hda_input_mux alc260_acer_capture_sources[2] = {
6119
5823
{
6120
5824
.num_items = 4,
6121
5825
.items = {
···
6138
5842
};
6139
5843
6140
5844
/* Maxdata Favorit 100XS */
6141
6141
-
static struct hda_input_mux alc260_favorit100_capture_sources[2] = {
5845
5845
+
static const struct hda_input_mux alc260_favorit100_capture_sources[2] = {
6142
5846
{
6143
5847
.num_items = 2,
6144
5848
.items = {
···
6162
5866
* element which allows changing the channel mode, so the verb list is
6163
5867
* never used.
6164
5868
*/
6165
6165
-
static struct hda_channel_mode alc260_modes[1] = {
5869
5869
+
static const struct hda_channel_mode alc260_modes[1] = {
6166
5870
{ 2, NULL },
6167
5871
};
6168
5872
···
6176
5880
* acer: acer + capture
6177
5881
*/
6178
5882
6179
6179
-
static struct snd_kcontrol_new alc260_base_output_mixer[] = {
5883
5883
+
static const struct snd_kcontrol_new alc260_base_output_mixer[] = {
6180
5884
HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6181
5885
HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
6182
5886
HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
···
6186
5890
{ } /* end */
6187
5891
};
6188
5892
6189
6189
-
static struct snd_kcontrol_new alc260_input_mixer[] = {
5893
5893
+
static const struct snd_kcontrol_new alc260_input_mixer[] = {
6190
5894
HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6191
5895
HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6192
5896
HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
···
6199
5903
};
6200
5904
6201
5905
/* update HP, line and mono out pins according to the master switch */
6202
6202
-
static void alc260_hp_master_update(struct hda_codec *codec,
6203
6203
-
hda_nid_t hp, hda_nid_t line,
6204
6204
-
hda_nid_t mono)
5906
5906
+
static void alc260_hp_master_update(struct hda_codec *codec)
6205
5907
{
6206
5908
struct alc_spec *spec = codec->spec;
6207
6207
-
unsigned int val = spec->master_sw ? PIN_HP : 0;
6208
6208
-
/* change HP and line-out pins */
6209
6209
-
snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6210
6210
-
val);
6211
6211
-
snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6212
6212
-
val);
6213
6213
-
/* mono (speaker) depending on the HP jack sense */
6214
6214
-
val = (val && !spec->jack_present) ? PIN_OUT : 0;
6215
6215
-
snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6216
6216
-
val);
5909
5909
+
5910
5910
+
/* change HP pins */
5911
5911
+
do_automute(codec, ARRAY_SIZE(spec->autocfg.hp_pins),
5912
5912
+
spec->autocfg.hp_pins, spec->master_mute, true);
5913
5913
+
update_speakers(codec);
6217
5914
}
6218
5915
6219
5916
static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
···
6214
5925
{
6215
5926
struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
6216
5927
struct alc_spec *spec = codec->spec;
6217
6217
-
*ucontrol->value.integer.value = spec->master_sw;
5928
5928
+
*ucontrol->value.integer.value = !spec->master_mute;
6218
5929
return 0;
6219
5930
}
6220
5931
···
6223
5934
{
6224
5935
struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
6225
5936
struct alc_spec *spec = codec->spec;
6226
6226
-
int val = !!*ucontrol->value.integer.value;
6227
6227
-
hda_nid_t hp, line, mono;
5937
5937
+
int val = !*ucontrol->value.integer.value;
6228
5938
6229
6229
-
if (val == spec->master_sw)
5939
5939
+
if (val == spec->master_mute)
6230
5940
return 0;
6231
6231
-
spec->master_sw = val;
6232
6232
-
hp = (kcontrol->private_value >> 16) & 0xff;
6233
6233
-
line = (kcontrol->private_value >> 8) & 0xff;
6234
6234
-
mono = kcontrol->private_value & 0xff;
6235
6235
-
alc260_hp_master_update(codec, hp, line, mono);
5941
5941
+
spec->master_mute = val;
5942
5942
+
alc260_hp_master_update(codec);
6236
5943
return 1;
6237
5944
}
6238
5945
6239
6239
-
static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
5946
5946
+
static const struct snd_kcontrol_new alc260_hp_output_mixer[] = {
6240
5947
{
6241
5948
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6242
5949
.name = "Master Playback Switch",
···
6240
5955
.info = snd_ctl_boolean_mono_info,
6241
5956
.get = alc260_hp_master_sw_get,
6242
5957
.put = alc260_hp_master_sw_put,
6243
6243
-
.private_value = (0x0f << 16) | (0x10 << 8) | 0x11
6244
5958
},
6245
5959
HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6246
5960
HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
···
6251
5967
{ } /* end */
6252
5968
};
6253
5969
6254
6254
-
static struct hda_verb alc260_hp_unsol_verbs[] = {
5970
5970
+
static const struct hda_verb alc260_hp_unsol_verbs[] = {
6255
5971
{0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6256
5972
{},
6257
5973
};
6258
5974
6259
6259
-
static void alc260_hp_automute(struct hda_codec *codec)
5975
5975
+
static void alc260_hp_setup(struct hda_codec *codec)
6260
5976
{
6261
5977
struct alc_spec *spec = codec->spec;
6262
5978
6263
6263
-
spec->jack_present = snd_hda_jack_detect(codec, 0x10);
6264
6264
-
alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
5979
5979
+
spec->autocfg.hp_pins[0] = 0x0f;
5980
5980
+
spec->autocfg.speaker_pins[0] = 0x10;
5981
5981
+
spec->autocfg.speaker_pins[1] = 0x11;
5982
5982
+
spec->automute = 1;
5983
5983
+
spec->automute_mode = ALC_AUTOMUTE_PIN;
6265
5984
}
6266
5985
6267
6267
-
static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
6268
6268
-
{
6269
6269
-
if ((res >> 26) == ALC880_HP_EVENT)
6270
6270
-
alc260_hp_automute(codec);
6271
6271
-
}
6272
6272
-
6273
6273
-
static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
5986
5986
+
static const struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
6274
5987
{
6275
5988
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6276
5989
.name = "Master Playback Switch",
···
6275
5994
.info = snd_ctl_boolean_mono_info,
6276
5995
.get = alc260_hp_master_sw_get,
6277
5996
.put = alc260_hp_master_sw_put,
6278
6278
-
.private_value = (0x15 << 16) | (0x10 << 8) | 0x11
6279
5997
},
6280
5998
HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
6281
5999
HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
···
6287
6007
{ } /* end */
6288
6008
};
6289
6009
6290
6290
-
static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
6010
6010
+
static void alc260_hp_3013_setup(struct hda_codec *codec)
6011
6011
+
{
6012
6012
+
struct alc_spec *spec = codec->spec;
6013
6013
+
6014
6014
+
spec->autocfg.hp_pins[0] = 0x15;
6015
6015
+
spec->autocfg.speaker_pins[0] = 0x10;
6016
6016
+
spec->autocfg.speaker_pins[1] = 0x11;
6017
6017
+
spec->automute = 1;
6018
6018
+
spec->automute_mode = ALC_AUTOMUTE_PIN;
6019
6019
+
}
6020
6020
+
6021
6021
+
static const struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
6291
6022
.ops = &snd_hda_bind_vol,
6292
6023
.values = {
6293
6024
HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
···
6308
6017
},
6309
6018
};
6310
6019
6311
6311
-
static struct hda_bind_ctls alc260_dc7600_bind_switch = {
6020
6020
+
static const struct hda_bind_ctls alc260_dc7600_bind_switch = {
6312
6021
.ops = &snd_hda_bind_sw,
6313
6022
.values = {
6314
6023
HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
···
6317
6026
},
6318
6027
};
6319
6028
6320
6320
-
static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
6029
6029
+
static const struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
6321
6030
HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
6322
6031
HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
6323
6032
HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
···
6325
6034
{ } /* end */
6326
6035
};
6327
6036
6328
6328
-
static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
6037
6037
+
static const struct hda_verb alc260_hp_3013_unsol_verbs[] = {
6329
6038
{0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6330
6039
{},
6331
6040
};
6332
6041
6333
6333
-
static void alc260_hp_3013_automute(struct hda_codec *codec)
6042
6042
+
static void alc260_hp_3012_setup(struct hda_codec *codec)
6334
6043
{
6335
6044
struct alc_spec *spec = codec->spec;
6336
6045
6337
6337
-
spec->jack_present = snd_hda_jack_detect(codec, 0x15);
6338
6338
-
alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
6339
6339
-
}
6340
6340
-
6341
6341
-
static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
6342
6342
-
unsigned int res)
6343
6343
-
{
6344
6344
-
if ((res >> 26) == ALC880_HP_EVENT)
6345
6345
-
alc260_hp_3013_automute(codec);
6346
6346
-
}
6347
6347
-
6348
6348
-
static void alc260_hp_3012_automute(struct hda_codec *codec)
6349
6349
-
{
6350
6350
-
unsigned int bits = snd_hda_jack_detect(codec, 0x10) ? 0 : PIN_OUT;
6351
6351
-
6352
6352
-
snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6353
6353
-
bits);
6354
6354
-
snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6355
6355
-
bits);
6356
6356
-
snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6357
6357
-
bits);
6358
6358
-
}
6359
6359
-
6360
6360
-
static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
6361
6361
-
unsigned int res)
6362
6362
-
{
6363
6363
-
if ((res >> 26) == ALC880_HP_EVENT)
6364
6364
-
alc260_hp_3012_automute(codec);
6046
6046
+
spec->autocfg.hp_pins[0] = 0x10;
6047
6047
+
spec->autocfg.speaker_pins[0] = 0x0f;
6048
6048
+
spec->autocfg.speaker_pins[1] = 0x11;
6049
6049
+
spec->autocfg.speaker_pins[2] = 0x15;
6050
6050
+
spec->automute = 1;
6051
6051
+
spec->automute_mode = ALC_AUTOMUTE_PIN;
6365
6052
}
6366
6053
6367
6054
/* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
6368
6055
* HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
6369
6056
*/
6370
6370
-
static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
6057
6057
+
static const struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
6371
6058
HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6372
6059
HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
6373
6060
ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
···
6382
6113
* controls for such models. On models without a "mono speaker" the control
6383
6114
* won't do anything.
6384
6115
*/
6385
6385
-
static struct snd_kcontrol_new alc260_acer_mixer[] = {
6116
6116
+
static const struct snd_kcontrol_new alc260_acer_mixer[] = {
6386
6117
HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6387
6118
HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
6388
6119
ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
···
6403
6134
6404
6135
/* Maxdata Favorit 100XS: one output and one input (0x12) jack
6405
6136
*/
6406
6406
-
static struct snd_kcontrol_new alc260_favorit100_mixer[] = {
6137
6137
+
static const struct snd_kcontrol_new alc260_favorit100_mixer[] = {
6407
6138
HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6408
6139
HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
6409
6140
ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
···
6416
6147
/* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
6417
6148
* Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
6418
6149
*/
6419
6419
-
static struct snd_kcontrol_new alc260_will_mixer[] = {
6150
6150
+
static const struct snd_kcontrol_new alc260_will_mixer[] = {
6420
6151
HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6421
6152
HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
6422
6153
HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
···
6433
6164
/* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
6434
6165
* Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
6435
6166
*/
6436
6436
-
static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
6167
6167
+
static const struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
6437
6168
HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6438
6169
HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
6439
6170
HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
···
6450
6181
/*
6451
6182
* initialization verbs
6452
6183
*/
6453
6453
-
static struct hda_verb alc260_init_verbs[] = {
6184
6184
+
static const struct hda_verb alc260_init_verbs[] = {
6454
6185
/* Line In pin widget for input */
6455
6186
{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6456
6187
/* CD pin widget for input */
···
6514
6245
};
6515
6246
6516
6247
#if 0 /* should be identical with alc260_init_verbs? */
6517
6517
-
static struct hda_verb alc260_hp_init_verbs[] = {
6248
6248
+
static const struct hda_verb alc260_hp_init_verbs[] = {
6518
6249
/* Headphone and output */
6519
6250
{0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
6520
6251
/* mono output */
···
6564
6295
};
6565
6296
#endif
6566
6297
6567
6567
-
static struct hda_verb alc260_hp_3013_init_verbs[] = {
6298
6298
+
static const struct hda_verb alc260_hp_3013_init_verbs[] = {
6568
6299
/* Line out and output */
6569
6300
{0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
6570
6301
/* mono output */
···
6617
6348
* laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
6618
6349
* audio = 0x16, internal speaker = 0x10.
6619
6350
*/
6620
6620
-
static struct hda_verb alc260_fujitsu_init_verbs[] = {
6351
6351
+
static const struct hda_verb alc260_fujitsu_init_verbs[] = {
6621
6352
/* Disable all GPIOs */
6622
6353
{0x01, AC_VERB_SET_GPIO_MASK, 0},
6623
6354
/* Internal speaker is connected to headphone pin */
···
6699
6430
/* Initialisation sequence for ALC260 as configured in Acer TravelMate and
6700
6431
* similar laptops (adapted from Fujitsu init verbs).
6701
6432
*/
6702
6702
-
static struct hda_verb alc260_acer_init_verbs[] = {
6433
6433
+
static const struct hda_verb alc260_acer_init_verbs[] = {
6703
6434
/* On TravelMate laptops, GPIO 0 enables the internal speaker and
6704
6435
* the headphone jack. Turn this on and rely on the standard mute
6705
6436
* methods whenever the user wants to turn these outputs off.
···
6787
6518
/* Initialisation sequence for Maxdata Favorit 100XS
6788
6519
* (adapted from Acer init verbs).
6789
6520
*/
6790
6790
-
static struct hda_verb alc260_favorit100_init_verbs[] = {
6521
6521
+
static const struct hda_verb alc260_favorit100_init_verbs[] = {
6791
6522
/* GPIO 0 enables the output jack.
6792
6523
* Turn this on and rely on the standard mute
6793
6524
* methods whenever the user wants to turn these outputs off.
···
6867
6598
{ }
6868
6599
};
6869
6600
6870
6870
-
static struct hda_verb alc260_will_verbs[] = {
6601
6601
+
static const struct hda_verb alc260_will_verbs[] = {
6871
6602
{0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6872
6603
{0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
6873
6604
{0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
···
6877
6608
{}
6878
6609
};
6879
6610
6880
6880
-
static struct hda_verb alc260_replacer_672v_verbs[] = {
6611
6611
+
static const struct hda_verb alc260_replacer_672v_verbs[] = {
6881
6612
{0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
6882
6613
{0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
6883
6614
{0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
···
6919
6650
alc260_replacer_672v_automute(codec);
6920
6651
}
6921
6652
6922
6922
-
static struct hda_verb alc260_hp_dc7600_verbs[] = {
6653
6653
+
static const struct hda_verb alc260_hp_dc7600_verbs[] = {
6923
6654
{0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
6924
6655
{0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6925
6656
{0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
···
6937
6668
* configuration.
6938
6669
*/
6939
6670
#ifdef CONFIG_SND_DEBUG
6940
6940
-
static hda_nid_t alc260_test_dac_nids[1] = {
6671
6671
+
static const hda_nid_t alc260_test_dac_nids[1] = {
6941
6672
0x02,
6942
6673
};
6943
6943
-
static hda_nid_t alc260_test_adc_nids[2] = {
6674
6674
+
static const hda_nid_t alc260_test_adc_nids[2] = {
6944
6675
0x04, 0x05,
6945
6676
};
6946
6677
/* For testing the ALC260, each input MUX needs its own definition since
6947
6678
* the signal assignments are different. This assumes that the first ADC
6948
6679
* is NID 0x04.
6949
6680
*/
6950
6950
-
static struct hda_input_mux alc260_test_capture_sources[2] = {
6681
6681
+
static const struct hda_input_mux alc260_test_capture_sources[2] = {
6951
6682
{
6952
6683
.num_items = 7,
6953
6684
.items = {
···
6974
6705
},
6975
6706
},
6976
6707
};
6977
6977
-
static struct snd_kcontrol_new alc260_test_mixer[] = {
6708
6708
+
static const struct snd_kcontrol_new alc260_test_mixer[] = {
6978
6709
/* Output driver widgets */
6979
6710
HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
6980
6711
HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
···
7038
6769
7039
6770
{ } /* end */
7040
6771
};
7041
7041
-
static struct hda_verb alc260_test_init_verbs[] = {
6772
6772
+
static const struct hda_verb alc260_test_init_verbs[] = {
7042
6773
/* Enable all GPIOs as outputs with an initial value of 0 */
7043
6774
{0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
7044
6775
{0x01, AC_VERB_SET_GPIO_DATA, 0x00},
···
7176
6907
7177
6908
spec->multiout.num_dacs = 1;
7178
6909
spec->multiout.dac_nids = spec->private_dac_nids;
7179
7179
-
spec->multiout.dac_nids[0] = 0x02;
6910
6910
+
spec->private_dac_nids[0] = 0x02;
7180
6911
7181
6912
nid = cfg->line_out_pins[0];
7182
6913
if (nid) {
···
7274
7005
/*
7275
7006
* generic initialization of ADC, input mixers and output mixers
7276
7007
*/
7277
7277
-
static struct hda_verb alc260_volume_init_verbs[] = {
7008
7008
+
static const struct hda_verb alc260_volume_init_verbs[] = {
7278
7009
/*
7279
7010
* Unmute ADC0-1 and set the default input to mic-in
7280
7011
*/
···
7319
7050
{
7320
7051
struct alc_spec *spec = codec->spec;
7321
7052
int err;
7322
7322
-
static hda_nid_t alc260_ignore[] = { 0x17, 0 };
7053
7053
+
static const hda_nid_t alc260_ignore[] = { 0x17, 0 };
7323
7054
7324
7055
err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
7325
7056
alc260_ignore);
···
7364
7095
}
7365
7096
7366
7097
#ifdef CONFIG_SND_HDA_POWER_SAVE
7367
7367
-
static struct hda_amp_list alc260_loopbacks[] = {
7098
7098
+
static const struct hda_amp_list alc260_loopbacks[] = {
7368
7099
{ 0x07, HDA_INPUT, 0 },
7369
7100
{ 0x07, HDA_INPUT, 1 },
7370
7101
{ 0x07, HDA_INPUT, 2 },
···
7391
7122
},
7392
7123
};
7393
7124
7394
7394
-
static struct snd_pci_quirk alc260_fixup_tbl[] = {
7125
7125
+
static const struct snd_pci_quirk alc260_fixup_tbl[] = {
7395
7126
SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", PINFIX_HP_DC5750),
7396
7127
{}
7397
7128
};
···
7415
7146
[ALC260_AUTO] = "auto",
7416
7147
};
7417
7148
7418
7418
-
static struct snd_pci_quirk alc260_cfg_tbl[] = {
7149
7149
+
static const struct snd_pci_quirk alc260_cfg_tbl[] = {
7419
7150
SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
7420
7151
SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL),
7421
7152
SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
···
7439
7170
{}
7440
7171
};
7441
7172
7442
7442
-
static struct alc_config_preset alc260_presets[] = {
7173
7173
+
static const struct alc_config_preset alc260_presets[] = {
7443
7174
[ALC260_BASIC] = {
7444
7175
.mixers = { alc260_base_output_mixer,
7445
7176
alc260_input_mixer },
···
7464
7195
.num_channel_mode = ARRAY_SIZE(alc260_modes),
7465
7196
.channel_mode = alc260_modes,
7466
7197
.input_mux = &alc260_capture_source,
7467
7467
-
.unsol_event = alc260_hp_unsol_event,
7468
7468
-
.init_hook = alc260_hp_automute,
7198
7198
+
.unsol_event = alc_sku_unsol_event,
7199
7199
+
.setup = alc260_hp_setup,
7200
7200
+
.init_hook = alc_inithook,
7469
7201
},
7470
7202
[ALC260_HP_DC7600] = {
7471
7203
.mixers = { alc260_hp_dc7600_mixer,
···
7480
7210
.num_channel_mode = ARRAY_SIZE(alc260_modes),
7481
7211
.channel_mode = alc260_modes,
7482
7212
.input_mux = &alc260_capture_source,
7483
7483
-
.unsol_event = alc260_hp_3012_unsol_event,
7484
7484
-
.init_hook = alc260_hp_3012_automute,
7213
7213
+
.unsol_event = alc_sku_unsol_event,
7214
7214
+
.setup = alc260_hp_3012_setup,
7215
7215
+
.init_hook = alc_inithook,
7485
7216
},
7486
7217
[ALC260_HP_3013] = {
7487
7218
.mixers = { alc260_hp_3013_mixer,
···
7496
7225
.num_channel_mode = ARRAY_SIZE(alc260_modes),
7497
7226
.channel_mode = alc260_modes,
7498
7227
.input_mux = &alc260_capture_source,
7499
7499
-
.unsol_event = alc260_hp_3013_unsol_event,
7500
7500
-
.init_hook = alc260_hp_3013_automute,
7228
7228
+
.unsol_event = alc_sku_unsol_event,
7229
7229
+
.setup = alc260_hp_3013_setup,
7230
7230
+
.init_hook = alc_inithook,
7501
7231
},
7502
7232
[ALC260_FUJITSU_S702X] = {
7503
7233
.mixers = { alc260_fujitsu_mixer },
···
7656
7384
codec->patch_ops = alc_patch_ops;
7657
7385
if (board_config == ALC260_AUTO)
7658
7386
spec->init_hook = alc260_auto_init;
7387
7387
+
spec->shutup = alc_eapd_shutup;
7659
7388
#ifdef CONFIG_SND_HDA_POWER_SAVE
7660
7389
if (!spec->loopback.amplist)
7661
7390
spec->loopback.amplist = alc260_loopbacks;
···
7684
7411
#define ALC1200_DIGOUT_NID 0x10
7685
7412
7686
7413
7687
7687
-
static struct hda_channel_mode alc882_ch_modes[1] = {
7414
7414
+
static const struct hda_channel_mode alc882_ch_modes[1] = {
7688
7415
{ 8, NULL }
7689
7416
};
7690
7417
7691
7418
/* DACs */
7692
7692
-
static hda_nid_t alc882_dac_nids[4] = {
7419
7419
+
static const hda_nid_t alc882_dac_nids[4] = {
7693
7420
/* front, rear, clfe, rear_surr */
7694
7421
0x02, 0x03, 0x04, 0x05
7695
7422
};
···
7699
7426
#define alc882_adc_nids alc880_adc_nids
7700
7427
#define alc882_adc_nids_alt alc880_adc_nids_alt
7701
7428
#define alc883_adc_nids alc882_adc_nids_alt
7702
7702
-
static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 };
7703
7703
-
static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 };
7429
7429
+
static const hda_nid_t alc883_adc_nids_alt[1] = { 0x08 };
7430
7430
+
static const hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 };
7704
7431
#define alc889_adc_nids alc880_adc_nids
7705
7432
7706
7706
-
static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
7707
7707
-
static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
7433
7433
+
static const hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
7434
7434
+
static const hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
7708
7435
#define alc883_capsrc_nids alc882_capsrc_nids_alt
7709
7709
-
static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
7436
7436
+
static const hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
7710
7437
#define alc889_capsrc_nids alc882_capsrc_nids
7711
7438
7712
7439
/* input MUX */
7713
7440
/* FIXME: should be a matrix-type input source selection */
7714
7441
7715
7715
-
static struct hda_input_mux alc882_capture_source = {
7442
7442
+
static const struct hda_input_mux alc882_capture_source = {
7716
7443
.num_items = 4,
7717
7444
.items = {
7718
7445
{ "Mic", 0x0 },
···
7724
7451
7725
7452
#define alc883_capture_source alc882_capture_source
7726
7453
7727
7727
-
static struct hda_input_mux alc889_capture_source = {
7454
7454
+
static const struct hda_input_mux alc889_capture_source = {
7728
7455
.num_items = 3,
7729
7456
.items = {
7730
7457
{ "Front Mic", 0x0 },
···
7733
7460
},
7734
7461
};
7735
7462
7736
7736
-
static struct hda_input_mux mb5_capture_source = {
7463
7463
+
static const struct hda_input_mux mb5_capture_source = {
7737
7464
.num_items = 3,
7738
7465
.items = {
7739
7466
{ "Mic", 0x1 },
···
7742
7469
},
7743
7470
};
7744
7471
7745
7745
-
static struct hda_input_mux macmini3_capture_source = {
7472
7472
+
static const struct hda_input_mux macmini3_capture_source = {
7746
7473
.num_items = 2,
7747
7474
.items = {
7748
7475
{ "Line", 0x2 },
···
7750
7477
},
7751
7478
};
7752
7479
7753
7753
-
static struct hda_input_mux alc883_3stack_6ch_intel = {
7480
7480
+
static const struct hda_input_mux alc883_3stack_6ch_intel = {
7754
7481
.num_items = 4,
7755
7482
.items = {
7756
7483
{ "Mic", 0x1 },
···
7760
7487
},
7761
7488
};
7762
7489
7763
7763
-
static struct hda_input_mux alc883_lenovo_101e_capture_source = {
7490
7490
+
static const struct hda_input_mux alc883_lenovo_101e_capture_source = {
7764
7491
.num_items = 2,
7765
7492
.items = {
7766
7493
{ "Mic", 0x1 },
···
7768
7495
},
7769
7496
};
7770
7497
7771
7771
-
static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
7498
7498
+
static const struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
7772
7499
.num_items = 4,
7773
7500
.items = {
7774
7501
{ "Mic", 0x0 },
···
7778
7505
},
7779
7506
};
7780
7507
7781
7781
-
static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
7508
7508
+
static const struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
7782
7509
.num_items = 2,
7783
7510
.items = {
7784
7511
{ "Mic", 0x0 },
···
7786
7513
},
7787
7514
};
7788
7515
7789
7789
-
static struct hda_input_mux alc883_lenovo_sky_capture_source = {
7516
7516
+
static const struct hda_input_mux alc883_lenovo_sky_capture_source = {
7790
7517
.num_items = 3,
7791
7518
.items = {
7792
7519
{ "Mic", 0x0 },
···
7795
7522
},
7796
7523
};
7797
7524
7798
7798
-
static struct hda_input_mux alc883_asus_eee1601_capture_source = {
7525
7525
+
static const struct hda_input_mux alc883_asus_eee1601_capture_source = {
7799
7526
.num_items = 2,
7800
7527
.items = {
7801
7528
{ "Mic", 0x0 },
···
7803
7530
},
7804
7531
};
7805
7532
7806
7806
-
static struct hda_input_mux alc889A_mb31_capture_source = {
7533
7533
+
static const struct hda_input_mux alc889A_mb31_capture_source = {
7807
7534
.num_items = 2,
7808
7535
.items = {
7809
7536
{ "Mic", 0x0 },
···
7814
7541
},
7815
7542
};
7816
7543
7817
7817
-
static struct hda_input_mux alc889A_imac91_capture_source = {
7544
7544
+
static const struct hda_input_mux alc889A_imac91_capture_source = {
7818
7545
.num_items = 2,
7819
7546
.items = {
7820
7547
{ "Mic", 0x01 },
···
7825
7552
/*
7826
7553
* 2ch mode
7827
7554
*/
7828
7828
-
static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
7555
7555
+
static const struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
7829
7556
{ 2, NULL }
7830
7557
};
7831
7558
7832
7559
/*
7833
7560
* 2ch mode
7834
7561
*/
7835
7835
-
static struct hda_verb alc882_3ST_ch2_init[] = {
7562
7562
+
static const struct hda_verb alc882_3ST_ch2_init[] = {
7836
7563
{ 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7837
7564
{ 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7838
7565
{ 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
···
7843
7570
/*
7844
7571
* 4ch mode
7845
7572
*/
7846
7846
-
static struct hda_verb alc882_3ST_ch4_init[] = {
7573
7573
+
static const struct hda_verb alc882_3ST_ch4_init[] = {
7847
7574
{ 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7848
7575
{ 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7849
7576
{ 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
···
7855
7582
/*
7856
7583
* 6ch mode
7857
7584
*/
7858
7858
-
static struct hda_verb alc882_3ST_ch6_init[] = {
7585
7585
+
static const struct hda_verb alc882_3ST_ch6_init[] = {
7859
7586
{ 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7860
7587
{ 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7861
7588
{ 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
···
7865
7592
{ } /* end */
7866
7593
};
7867
7594
7868
7868
-
static struct hda_channel_mode alc882_3ST_6ch_modes[3] = {
7595
7595
+
static const struct hda_channel_mode alc882_3ST_6ch_modes[3] = {
7869
7596
{ 2, alc882_3ST_ch2_init },
7870
7597
{ 4, alc882_3ST_ch4_init },
7871
7598
{ 6, alc882_3ST_ch6_init },
···
7876
7603
/*
7877
7604
* 2ch mode
7878
7605
*/
7879
7879
-
static struct hda_verb alc883_3ST_ch2_clevo_init[] = {
7606
7606
+
static const struct hda_verb alc883_3ST_ch2_clevo_init[] = {
7880
7607
{ 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
7881
7608
{ 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7882
7609
{ 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
···
7888
7615
/*
7889
7616
* 4ch mode
7890
7617
*/
7891
7891
-
static struct hda_verb alc883_3ST_ch4_clevo_init[] = {
7618
7618
+
static const struct hda_verb alc883_3ST_ch4_clevo_init[] = {
7892
7619
{ 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7893
7620
{ 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7894
7621
{ 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
···
7901
7628
/*
7902
7629
* 6ch mode
7903
7630
*/
7904
7904
-
static struct hda_verb alc883_3ST_ch6_clevo_init[] = {
7631
7631
+
static const struct hda_verb alc883_3ST_ch6_clevo_init[] = {
7905
7632
{ 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7906
7633
{ 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7907
7634
{ 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
···
7912
7639
{ } /* end */
7913
7640
};
7914
7641
7915
7915
-
static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = {
7642
7642
+
static const struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = {
7916
7643
{ 2, alc883_3ST_ch2_clevo_init },
7917
7644
{ 4, alc883_3ST_ch4_clevo_init },
7918
7645
{ 6, alc883_3ST_ch6_clevo_init },
···
7922
7649
/*
7923
7650
* 6ch mode
7924
7651
*/
7925
7925
-
static struct hda_verb alc882_sixstack_ch6_init[] = {
7652
7652
+
static const struct hda_verb alc882_sixstack_ch6_init[] = {
7926
7653
{ 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7927
7654
{ 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7928
7655
{ 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
···
7933
7660
/*
7934
7661
* 8ch mode
7935
7662
*/
7936
7936
-
static struct hda_verb alc882_sixstack_ch8_init[] = {
7663
7663
+
static const struct hda_verb alc882_sixstack_ch8_init[] = {
7937
7664
{ 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7938
7665
{ 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7939
7666
{ 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
···
7941
7668
{ } /* end */
7942
7669
};
7943
7670
7944
7944
-
static struct hda_channel_mode alc882_sixstack_modes[2] = {
7671
7671
+
static const struct hda_channel_mode alc882_sixstack_modes[2] = {
7945
7672
{ 6, alc882_sixstack_ch6_init },
7946
7673
{ 8, alc882_sixstack_ch8_init },
7947
7674
};
···
7949
7676
7950
7677
/* Macbook Air 2,1 */
7951
7678
7952
7952
-
static struct hda_channel_mode alc885_mba21_ch_modes[1] = {
7679
7679
+
static const struct hda_channel_mode alc885_mba21_ch_modes[1] = {
7953
7680
{ 2, NULL },
7954
7681
};
7955
7682
···
7960
7687
/*
7961
7688
* 2ch mode
7962
7689
*/
7963
7963
-
static struct hda_verb alc885_mbp_ch2_init[] = {
7690
7690
+
static const struct hda_verb alc885_mbp_ch2_init[] = {
7964
7691
{ 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7965
7692
{ 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7966
7693
{ 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
···
7970
7697
/*
7971
7698
* 4ch mode
7972
7699
*/
7973
7973
-
static struct hda_verb alc885_mbp_ch4_init[] = {
7700
7700
+
static const struct hda_verb alc885_mbp_ch4_init[] = {
7974
7701
{ 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7975
7702
{ 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7976
7703
{ 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
···
7979
7706
{ } /* end */
7980
7707
};
7981
7708
7982
7982
-
static struct hda_channel_mode alc885_mbp_4ch_modes[2] = {
7709
7709
+
static const struct hda_channel_mode alc885_mbp_4ch_modes[2] = {
7983
7710
{ 2, alc885_mbp_ch2_init },
7984
7711
{ 4, alc885_mbp_ch4_init },
7985
7712
};
···
7989
7716
* Speakers/Woofer/HP = Front
7990
7717
* LineIn = Input
7991
7718
*/
7992
7992
-
static struct hda_verb alc885_mb5_ch2_init[] = {
7719
7719
+
static const struct hda_verb alc885_mb5_ch2_init[] = {
7993
7720
{0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7994
7721
{0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7995
7722
{ } /* end */
···
8001
7728
* Woofer = LFE
8002
7729
* LineIn = Surround
8003
7730
*/
8004
8004
-
static struct hda_verb alc885_mb5_ch6_init[] = {
7731
7731
+
static const struct hda_verb alc885_mb5_ch6_init[] = {
8005
7732
{0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8006
7733
{0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8007
7734
{0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8008
7735
{ } /* end */
8009
7736
};
8010
7737
8011
8011
-
static struct hda_channel_mode alc885_mb5_6ch_modes[2] = {
7738
7738
+
static const struct hda_channel_mode alc885_mb5_6ch_modes[2] = {
8012
7739
{ 2, alc885_mb5_ch2_init },
8013
7740
{ 6, alc885_mb5_ch6_init },
8014
7741
};
···
8018
7745
/*
8019
7746
* 2ch mode
8020
7747
*/
8021
8021
-
static struct hda_verb alc883_4ST_ch2_init[] = {
7748
7748
+
static const struct hda_verb alc883_4ST_ch2_init[] = {
8022
7749
{ 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8023
7750
{ 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8024
7751
{ 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
···
8031
7758
/*
8032
7759
* 4ch mode
8033
7760
*/
8034
8034
-
static struct hda_verb alc883_4ST_ch4_init[] = {
7761
7761
+
static const struct hda_verb alc883_4ST_ch4_init[] = {
8035
7762
{ 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8036
7763
{ 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8037
7764
{ 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
···
8045
7772
/*
8046
7773
* 6ch mode
8047
7774
*/
8048
8048
-
static struct hda_verb alc883_4ST_ch6_init[] = {
7775
7775
+
static const struct hda_verb alc883_4ST_ch6_init[] = {
8049
7776
{ 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8050
7777
{ 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8051
7778
{ 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
···
8060
7787
/*
8061
7788
* 8ch mode
8062
7789
*/
8063
8063
-
static struct hda_verb alc883_4ST_ch8_init[] = {
7790
7790
+
static const struct hda_verb alc883_4ST_ch8_init[] = {
8064
7791
{ 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8065
7792
{ 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8066
7793
{ 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
···
8073
7800
{ } /* end */
8074
7801
};
8075
7802
8076
8076
-
static struct hda_channel_mode alc883_4ST_8ch_modes[4] = {
7803
7803
+
static const struct hda_channel_mode alc883_4ST_8ch_modes[4] = {
8077
7804
{ 2, alc883_4ST_ch2_init },
8078
7805
{ 4, alc883_4ST_ch4_init },
8079
7806
{ 6, alc883_4ST_ch6_init },
···
8084
7811
/*
8085
7812
* 2ch mode
8086
7813
*/
8087
8087
-
static struct hda_verb alc883_3ST_ch2_intel_init[] = {
7814
7814
+
static const struct hda_verb alc883_3ST_ch2_intel_init[] = {
8088
7815
{ 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8089
7816
{ 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8090
7817
{ 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
···
8095
7822
/*
8096
7823
* 4ch mode
8097
7824
*/
8098
8098
-
static struct hda_verb alc883_3ST_ch4_intel_init[] = {
7825
7825
+
static const struct hda_verb alc883_3ST_ch4_intel_init[] = {
8099
7826
{ 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8100
7827
{ 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8101
7828
{ 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
···
8107
7834
/*
8108
7835
* 6ch mode
8109
7836
*/
8110
8110
-
static struct hda_verb alc883_3ST_ch6_intel_init[] = {
7837
7837
+
static const struct hda_verb alc883_3ST_ch6_intel_init[] = {
8111
7838
{ 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8112
7839
{ 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8113
7840
{ 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
···
8117
7844
{ } /* end */
8118
7845
};
8119
7846
8120
8120
-
static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
7847
7847
+
static const struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
8121
7848
{ 2, alc883_3ST_ch2_intel_init },
8122
7849
{ 4, alc883_3ST_ch4_intel_init },
8123
7850
{ 6, alc883_3ST_ch6_intel_init },
···
8126
7853
/*
8127
7854
* 2ch mode
8128
7855
*/
8129
8129
-
static struct hda_verb alc889_ch2_intel_init[] = {
7856
7856
+
static const struct hda_verb alc889_ch2_intel_init[] = {
8130
7857
{ 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
8131
7858
{ 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 },
8132
7859
{ 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 },
···
8139
7866
/*
8140
7867
* 6ch mode
8141
7868
*/
8142
8142
-
static struct hda_verb alc889_ch6_intel_init[] = {
7869
7869
+
static const struct hda_verb alc889_ch6_intel_init[] = {
8143
7870
{ 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
8144
7871
{ 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
8145
7872
{ 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
···
8152
7879
/*
8153
7880
* 8ch mode
8154
7881
*/
8155
8155
-
static struct hda_verb alc889_ch8_intel_init[] = {
7882
7882
+
static const struct hda_verb alc889_ch8_intel_init[] = {
8156
7883
{ 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
8157
7884
{ 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
8158
7885
{ 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
···
8163
7890
{ } /* end */
8164
7891
};
8165
7892
8166
8166
-
static struct hda_channel_mode alc889_8ch_intel_modes[3] = {
7893
7893
+
static const struct hda_channel_mode alc889_8ch_intel_modes[3] = {
8167
7894
{ 2, alc889_ch2_intel_init },
8168
7895
{ 6, alc889_ch6_intel_init },
8169
7896
{ 8, alc889_ch8_intel_init },
···
8172
7899
/*
8173
7900
* 6ch mode
8174
7901
*/
8175
8175
-
static struct hda_verb alc883_sixstack_ch6_init[] = {
7902
7902
+
static const struct hda_verb alc883_sixstack_ch6_init[] = {
8176
7903
{ 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
8177
7904
{ 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8178
7905
{ 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
···
8183
7910
/*
8184
7911
* 8ch mode
8185
7912
*/
8186
8186
-
static struct hda_verb alc883_sixstack_ch8_init[] = {
7913
7913
+
static const struct hda_verb alc883_sixstack_ch8_init[] = {
8187
7914
{ 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8188
7915
{ 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8189
7916
{ 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
···
8191
7918
{ } /* end */
8192
7919
};
8193
7920
8194
8194
-
static struct hda_channel_mode alc883_sixstack_modes[2] = {
7921
7921
+
static const struct hda_channel_mode alc883_sixstack_modes[2] = {
8195
7922
{ 6, alc883_sixstack_ch6_init },
8196
7923
{ 8, alc883_sixstack_ch8_init },
8197
7924
};
···
8200
7927
/* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
8201
7928
* Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
8202
7929
*/
8203
8203
-
static struct snd_kcontrol_new alc882_base_mixer[] = {
7930
7930
+
static const struct snd_kcontrol_new alc882_base_mixer[] = {
8204
7931
HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8205
7932
HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8206
7933
HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
···
8227
7954
8228
7955
/* Macbook Air 2,1 same control for HP and internal Speaker */
8229
7956
8230
8230
-
static struct snd_kcontrol_new alc885_mba21_mixer[] = {
7957
7957
+
static const struct snd_kcontrol_new alc885_mba21_mixer[] = {
8231
7958
HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8232
7959
HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_OUTPUT),
8233
7960
{ }
8234
7961
};
8235
7962
8236
7963
8237
8237
-
static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
7964
7964
+
static const struct snd_kcontrol_new alc885_mbp3_mixer[] = {
8238
7965
HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8239
7966
HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
8240
7967
HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
···
8249
7976
{ } /* end */
8250
7977
};
8251
7978
8252
8252
-
static struct snd_kcontrol_new alc885_mb5_mixer[] = {
7979
7979
+
static const struct snd_kcontrol_new alc885_mb5_mixer[] = {
8253
7980
HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8254
7981
HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
8255
7982
HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
···
8267
7994
{ } /* end */
8268
7995
};
8269
7996
8270
8270
-
static struct snd_kcontrol_new alc885_macmini3_mixer[] = {
7997
7997
+
static const struct snd_kcontrol_new alc885_macmini3_mixer[] = {
8271
7998
HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8272
7999
HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
8273
8000
HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
···
8282
8009
{ } /* end */
8283
8010
};
8284
8011
8285
8285
-
static struct snd_kcontrol_new alc885_imac91_mixer[] = {
8012
8012
+
static const struct snd_kcontrol_new alc885_imac91_mixer[] = {
8286
8013
HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8287
8014
HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
8288
8015
{ } /* end */
8289
8016
};
8290
8017
8291
8018
8292
8292
-
static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
8019
8019
+
static const struct snd_kcontrol_new alc882_w2jc_mixer[] = {
8293
8020
HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8294
8021
HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8295
8022
HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
···
8302
8029
{ } /* end */
8303
8030
};
8304
8031
8305
8305
-
static struct snd_kcontrol_new alc882_targa_mixer[] = {
8032
8032
+
static const struct snd_kcontrol_new alc882_targa_mixer[] = {
8306
8033
HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8307
8034
HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8308
8035
HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
···
8322
8049
/* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
8323
8050
* Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
8324
8051
*/
8325
8325
-
static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
8052
8052
+
static const struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
8326
8053
HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8327
8054
HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8328
8055
HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
···
8339
8066
{ } /* end */
8340
8067
};
8341
8068
8342
8342
-
static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
8069
8069
+
static const struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
8343
8070
HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8344
8071
HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8345
8072
HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
···
8353
8080
{ } /* end */
8354
8081
};
8355
8082
8356
8356
-
static struct snd_kcontrol_new alc882_chmode_mixer[] = {
8083
8083
+
static const struct snd_kcontrol_new alc882_chmode_mixer[] = {
8357
8084
{
8358
8085
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8359
8086
.name = "Channel Mode",
···
8364
8091
{ } /* end */
8365
8092
};
8366
8093
8367
8367
-
static struct hda_verb alc882_base_init_verbs[] = {
8094
8094
+
static const struct hda_verb alc882_base_init_verbs[] = {
8368
8095
/* Front mixer: unmute input/output amp left and right (volume = 0) */
8369
8096
{0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8370
8097
{0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
···
8426
8153
{ }
8427
8154
};
8428
8155
8429
8429
-
static struct hda_verb alc882_adc1_init_verbs[] = {
8156
8156
+
static const struct hda_verb alc882_adc1_init_verbs[] = {
8430
8157
/* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8431
8158
{0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8432
8159
{0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
···
8438
8165
{ }
8439
8166
};
8440
8167
8441
8441
-
static struct hda_verb alc882_eapd_verbs[] = {
8168
8168
+
static const struct hda_verb alc882_eapd_verbs[] = {
8442
8169
/* change to EAPD mode */
8443
8170
{0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8444
8171
{0x20, AC_VERB_SET_PROC_COEF, 0x3060},
8445
8172
{ }
8446
8173
};
8447
8174
8448
8448
-
static struct hda_verb alc889_eapd_verbs[] = {
8175
8175
+
static const struct hda_verb alc889_eapd_verbs[] = {
8449
8176
{0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
8450
8177
{0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
8451
8178
{ }
8452
8179
};
8453
8180
8454
8454
-
static struct hda_verb alc_hp15_unsol_verbs[] = {
8181
8181
+
static const struct hda_verb alc_hp15_unsol_verbs[] = {
8455
8182
{0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8456
8183
{0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8457
8184
{}
8458
8185
};
8459
8186
8460
8460
-
static struct hda_verb alc885_init_verbs[] = {
8187
8187
+
static const struct hda_verb alc885_init_verbs[] = {
8461
8188
/* Front mixer: unmute input/output amp left and right (volume = 0) */
8462
8189
{0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8463
8190
{0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
···
8516
8243
{ }
8517
8244
};
8518
8245
8519
8519
-
static struct hda_verb alc885_init_input_verbs[] = {
8246
8246
+
static const struct hda_verb alc885_init_input_verbs[] = {
8520
8247
{0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8521
8248
{0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8522
8249
{0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
···
8525
8252
8526
8253
8527
8254
/* Unmute Selector 24h and set the default input to front mic */
8528
8528
-
static struct hda_verb alc889_init_input_verbs[] = {
8255
8255
+
static const struct hda_verb alc889_init_input_verbs[] = {
8529
8256
{0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
8530
8257
{0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8531
8258
{ }
···
8535
8262
#define alc883_init_verbs alc882_base_init_verbs
8536
8263
8537
8264
/* Mac Pro test */
8538
8538
-
static struct snd_kcontrol_new alc882_macpro_mixer[] = {
8265
8265
+
static const struct snd_kcontrol_new alc882_macpro_mixer[] = {
8539
8266
HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8540
8267
HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8541
8268
HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
···
8548
8275
{ } /* end */
8549
8276
};
8550
8277
8551
8551
-
static struct hda_verb alc882_macpro_init_verbs[] = {
8278
8278
+
static const struct hda_verb alc882_macpro_init_verbs[] = {
8552
8279
/* Front mixer: unmute input/output amp left and right (volume = 0) */
8553
8280
{0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8554
8281
{0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
···
8600
8327
};
8601
8328
8602
8329
/* Macbook 5,1 */
8603
8603
-
static struct hda_verb alc885_mb5_init_verbs[] = {
8330
8330
+
static const struct hda_verb alc885_mb5_init_verbs[] = {
8604
8331
/* DACs */
8605
8332
{0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8606
8333
{0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
···
8649
8376
};
8650
8377
8651
8378
/* Macmini 3,1 */
8652
8652
-
static struct hda_verb alc885_macmini3_init_verbs[] = {
8379
8379
+
static const struct hda_verb alc885_macmini3_init_verbs[] = {
8653
8380
/* DACs */
8654
8381
{0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8655
8382
{0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
···
8696
8423
};
8697
8424
8698
8425
8699
8699
-
static struct hda_verb alc885_mba21_init_verbs[] = {
8426
8426
+
static const struct hda_verb alc885_mba21_init_verbs[] = {
8700
8427
/*Internal and HP Speaker Mixer*/
8701
8428
{0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8702
8429
{0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
···
8719
8446
8720
8447
8721
8448
/* Macbook Pro rev3 */
8722
8722
-
static struct hda_verb alc885_mbp3_init_verbs[] = {
8449
8449
+
static const struct hda_verb alc885_mbp3_init_verbs[] = {
8723
8450
/* Front mixer: unmute input/output amp left and right (volume = 0) */
8724
8451
{0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8725
8452
{0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
···
8783
8510
};
8784
8511
8785
8512
/* iMac 9,1 */
8786
8786
-
static struct hda_verb alc885_imac91_init_verbs[] = {
8513
8513
+
static const struct hda_verb alc885_imac91_init_verbs[] = {
8787
8514
/* Internal Speaker Pin (0x0c) */
8788
8515
{0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
8789
8516
{0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
···
8838
8565
};
8839
8566
8840
8567
/* iMac 24 mixer. */
8841
8841
-
static struct snd_kcontrol_new alc885_imac24_mixer[] = {
8568
8568
+
static const struct snd_kcontrol_new alc885_imac24_mixer[] = {
8842
8569
HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8843
8570
HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
8844
8571
{ } /* end */
8845
8572
};
8846
8573
8847
8574
/* iMac 24 init verbs. */
8848
8848
-
static struct hda_verb alc885_imac24_init_verbs[] = {
8575
8575
+
static const struct hda_verb alc885_imac24_init_verbs[] = {
8849
8576
/* Internal speakers: output 0 (0x0c) */
8850
8577
{0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8851
8578
{0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
···
8873
8600
spec->autocfg.hp_pins[0] = 0x14;
8874
8601
spec->autocfg.speaker_pins[0] = 0x18;
8875
8602
spec->autocfg.speaker_pins[1] = 0x1a;
8603
8603
+
spec->automute = 1;
8604
8604
+
spec->automute_mode = ALC_AUTOMUTE_AMP;
8876
8605
}
8877
8606
8878
8607
#define alc885_mb5_setup alc885_imac24_setup
···
8887
8612
8888
8613
spec->autocfg.hp_pins[0] = 0x14;
8889
8614
spec->autocfg.speaker_pins[0] = 0x18;
8615
8615
+
spec->automute = 1;
8616
8616
+
spec->automute_mode = ALC_AUTOMUTE_AMP;
8890
8617
}
8891
8618
8892
8619
···
8899
8622
8900
8623
spec->autocfg.hp_pins[0] = 0x15;
8901
8624
spec->autocfg.speaker_pins[0] = 0x14;
8625
8625
+
spec->automute = 1;
8626
8626
+
spec->automute_mode = ALC_AUTOMUTE_AMP;
8902
8627
}
8903
8628
8904
8629
static void alc885_imac91_setup(struct hda_codec *codec)
···
8910
8631
spec->autocfg.hp_pins[0] = 0x14;
8911
8632
spec->autocfg.speaker_pins[0] = 0x18;
8912
8633
spec->autocfg.speaker_pins[1] = 0x1a;
8634
8634
+
spec->automute = 1;
8635
8635
+
spec->automute_mode = ALC_AUTOMUTE_AMP;
8913
8636
}
8914
8637
8915
8915
-
static struct hda_verb alc882_targa_verbs[] = {
8638
8638
+
static const struct hda_verb alc882_targa_verbs[] = {
8916
8639
{0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8917
8640
{0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8918
8641
···
8933
8652
static void alc882_targa_automute(struct hda_codec *codec)
8934
8653
{
8935
8654
struct alc_spec *spec = codec->spec;
8936
8936
-
alc_automute_amp(codec);
8655
8655
+
alc_hp_automute(codec);
8937
8656
snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
8938
8657
spec->jack_present ? 1 : 3);
8939
8658
}
···
8944
8663
8945
8664
spec->autocfg.hp_pins[0] = 0x14;
8946
8665
spec->autocfg.speaker_pins[0] = 0x1b;
8666
8666
+
spec->automute = 1;
8667
8667
+
spec->automute_mode = ALC_AUTOMUTE_AMP;
8947
8668
}
8948
8669
8949
8670
static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
···
8954
8671
alc882_targa_automute(codec);
8955
8672
}
8956
8673
8957
8957
-
static struct hda_verb alc882_asus_a7j_verbs[] = {
8674
8674
+
static const struct hda_verb alc882_asus_a7j_verbs[] = {
8958
8675
{0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8959
8676
{0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8960
8677
···
8972
8689
{ } /* end */
8973
8690
};
8974
8691
8975
8975
-
static struct hda_verb alc882_asus_a7m_verbs[] = {
8692
8692
+
static const struct hda_verb alc882_asus_a7m_verbs[] = {
8976
8693
{0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8977
8694
{0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8978
8695
···
9033
8750
static void alc885_imac24_init_hook(struct hda_codec *codec)
9034
8751
{
9035
8752
alc885_macpro_init_hook(codec);
9036
9036
-
alc_automute_amp(codec);
8753
8753
+
alc_hp_automute(codec);
9037
8754
}
9038
8755
9039
8756
/*
9040
8757
* generic initialization of ADC, input mixers and output mixers
9041
8758
*/
9042
9042
-
static struct hda_verb alc883_auto_init_verbs[] = {
8759
8759
+
static const struct hda_verb alc883_auto_init_verbs[] = {
9043
8760
/*
9044
8761
* Unmute ADC0-2 and set the default input to mic-in
9045
8762
*/
···
9079
8796
};
9080
8797
9081
8798
/* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
9082
9082
-
static struct hda_verb alc889A_mb31_ch2_init[] = {
8799
8799
+
static const struct hda_verb alc889A_mb31_ch2_init[] = {
9083
8800
{0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
9084
8801
{0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
9085
8802
{0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
···
9088
8805
};
9089
8806
9090
8807
/* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
9091
9091
-
static struct hda_verb alc889A_mb31_ch4_init[] = {
8808
8808
+
static const struct hda_verb alc889A_mb31_ch4_init[] = {
9092
8809
{0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
9093
8810
{0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
9094
8811
{0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
···
9097
8814
};
9098
8815
9099
8816
/* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
9100
9100
-
static struct hda_verb alc889A_mb31_ch5_init[] = {
8817
8817
+
static const struct hda_verb alc889A_mb31_ch5_init[] = {
9101
8818
{0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */
9102
8819
{0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
9103
8820
{0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
···
9106
8823
};
9107
8824
9108
8825
/* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
9109
9109
-
static struct hda_verb alc889A_mb31_ch6_init[] = {
8826
8826
+
static const struct hda_verb alc889A_mb31_ch6_init[] = {
9110
8827
{0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */
9111
8828
{0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */
9112
8829
{0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
···
9114
8831
{ } /* end */
9115
8832
};
9116
8833
9117
9117
-
static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = {
8834
8834
+
static const struct hda_channel_mode alc889A_mb31_6ch_modes[4] = {
9118
8835
{ 2, alc889A_mb31_ch2_init },
9119
8836
{ 4, alc889A_mb31_ch4_init },
9120
8837
{ 5, alc889A_mb31_ch5_init },
9121
8838
{ 6, alc889A_mb31_ch6_init },
9122
8839
};
9123
8840
9124
9124
-
static struct hda_verb alc883_medion_eapd_verbs[] = {
8841
8841
+
static const struct hda_verb alc883_medion_eapd_verbs[] = {
9125
8842
/* eanable EAPD on medion laptop */
9126
8843
{0x20, AC_VERB_SET_COEF_INDEX, 0x07},
9127
8844
{0x20, AC_VERB_SET_PROC_COEF, 0x3070},
···
9130
8847
9131
8848
#define alc883_base_mixer alc882_base_mixer
9132
8849
9133
9133
-
static struct snd_kcontrol_new alc883_mitac_mixer[] = {
8850
8850
+
static const struct snd_kcontrol_new alc883_mitac_mixer[] = {
9134
8851
HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9135
8852
HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9136
8853
HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
···
9147
8864
{ } /* end */
9148
8865
};
9149
8866
9150
9150
-
static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
8867
8867
+
static const struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
9151
8868
HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9152
8869
HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
9153
8870
HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
···
9161
8878
{ } /* end */
9162
8879
};
9163
8880
9164
9164
-
static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
8881
8881
+
static const struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
9165
8882
HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9166
8883
HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
9167
8884
HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
···
9175
8892
{ } /* end */
9176
8893
};
9177
8894
9178
9178
-
static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
8895
8895
+
static const struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
9179
8896
HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9180
8897
HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9181
8898
HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
···
9192
8909
{ } /* end */
9193
8910
};
9194
8911
9195
9195
-
static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
8912
8912
+
static const struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
9196
8913
HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9197
8914
HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9198
8915
HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
···
9215
8932
{ } /* end */
9216
8933
};
9217
8934
9218
9218
-
static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
8935
8935
+
static const struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
9219
8936
HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9220
8937
HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9221
8938
HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
···
9239
8956
{ } /* end */
9240
8957
};
9241
8958
9242
9242
-
static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = {
8959
8959
+
static const struct snd_kcontrol_new alc885_8ch_intel_mixer[] = {
9243
8960
HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9244
8961
HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9245
8962
HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
···
9263
8980
{ } /* end */
9264
8981
};
9265
8982
9266
9266
-
static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
8983
8983
+
static const struct snd_kcontrol_new alc883_fivestack_mixer[] = {
9267
8984
HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9268
8985
HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9269
8986
HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
···
9286
9003
{ } /* end */
9287
9004
};
9288
9005
9289
9289
-
static struct snd_kcontrol_new alc883_targa_mixer[] = {
9006
9006
+
static const struct snd_kcontrol_new alc883_targa_mixer[] = {
9290
9007
HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9291
9008
HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9292
9009
HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
···
9307
9024
{ } /* end */
9308
9025
};
9309
9026
9310
9310
-
static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = {
9027
9027
+
static const struct snd_kcontrol_new alc883_targa_2ch_mixer[] = {
9311
9028
HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9312
9029
HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9313
9030
HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
···
9323
9040
{ } /* end */
9324
9041
};
9325
9042
9326
9326
-
static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = {
9043
9043
+
static const struct snd_kcontrol_new alc883_targa_8ch_mixer[] = {
9327
9044
HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
9328
9045
HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
9329
9046
HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
···
9332
9049
{ } /* end */
9333
9050
};
9334
9051
9335
9335
-
static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
9052
9052
+
static const struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
9336
9053
HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9337
9054
HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9338
9055
HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
···
9344
9061
{ } /* end */
9345
9062
};
9346
9063
9347
9347
-
static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
9064
9064
+
static const struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
9348
9065
HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9349
9066
HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
9350
9067
HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
···
9357
9074
{ } /* end */
9358
9075
};
9359
9076
9360
9360
-
static struct snd_kcontrol_new alc883_medion_wim2160_mixer[] = {
9077
9077
+
static const struct snd_kcontrol_new alc883_medion_wim2160_mixer[] = {
9361
9078
HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9362
9079
HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9363
9080
HDA_CODEC_MUTE("Speaker Playback Switch", 0x15, 0x0, HDA_OUTPUT),
···
9367
9084
{ } /* end */
9368
9085
};
9369
9086
9370
9370
-
static struct hda_verb alc883_medion_wim2160_verbs[] = {
9087
9087
+
static const struct hda_verb alc883_medion_wim2160_verbs[] = {
9371
9088
/* Unmute front mixer */
9372
9089
{0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9373
9090
{0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
···
9391
9108
9392
9109
spec->autocfg.hp_pins[0] = 0x1a;
9393
9110
spec->autocfg.speaker_pins[0] = 0x15;
9111
9111
+
spec->automute = 1;
9112
9112
+
spec->automute_mode = ALC_AUTOMUTE_AMP;
9394
9113
}
9395
9114
9396
9396
-
static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
9115
9115
+
static const struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
9397
9116
HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9398
9117
HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9399
9118
HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
···
9407
9122
{ } /* end */
9408
9123
};
9409
9124
9410
9410
-
static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = {
9125
9125
+
static const struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = {
9411
9126
HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9412
9127
HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
9413
9128
HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
···
9420
9135
{ } /* end */
9421
9136
};
9422
9137
9423
9423
-
static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
9138
9138
+
static const struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
9424
9139
HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9425
9140
HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9426
9141
HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
···
9445
9160
{ } /* end */
9446
9161
};
9447
9162
9448
9448
-
static struct snd_kcontrol_new alc889A_mb31_mixer[] = {
9163
9163
+
static const struct snd_kcontrol_new alc889A_mb31_mixer[] = {
9449
9164
/* Output mixers */
9450
9165
HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
9451
9166
HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
···
9471
9186
{ } /* end */
9472
9187
};
9473
9188
9474
9474
-
static struct snd_kcontrol_new alc883_vaiott_mixer[] = {
9189
9189
+
static const struct snd_kcontrol_new alc883_vaiott_mixer[] = {
9475
9190
HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9476
9191
HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9477
9192
HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
···
9481
9196
{ } /* end */
9482
9197
};
9483
9198
9484
9484
-
static struct hda_bind_ctls alc883_bind_cap_vol = {
9199
9199
+
static const struct hda_bind_ctls alc883_bind_cap_vol = {
9485
9200
.ops = &snd_hda_bind_vol,
9486
9201
.values = {
9487
9202
HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
···
9490
9205
},
9491
9206
};
9492
9207
9493
9493
-
static struct hda_bind_ctls alc883_bind_cap_switch = {
9208
9208
+
static const struct hda_bind_ctls alc883_bind_cap_switch = {
9494
9209
.ops = &snd_hda_bind_sw,
9495
9210
.values = {
9496
9211
HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
···
9499
9214
},
9500
9215
};
9501
9216
9502
9502
-
static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
9217
9217
+
static const struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
9503
9218
HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9504
9219
HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9505
9220
HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
···
9511
9226
{ } /* end */
9512
9227
};
9513
9228
9514
9514
-
static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
9229
9229
+
static const struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
9515
9230
HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
9516
9231
HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
9517
9232
{
···
9526
9241
{ } /* end */
9527
9242
};
9528
9243
9529
9529
-
static struct snd_kcontrol_new alc883_chmode_mixer[] = {
9244
9244
+
static const struct snd_kcontrol_new alc883_chmode_mixer[] = {
9530
9245
{
9531
9246
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9532
9247
.name = "Channel Mode",
···
9545
9260
spec->autocfg.hp_pins[0] = 0x15;
9546
9261
spec->autocfg.speaker_pins[0] = 0x14;
9547
9262
spec->autocfg.speaker_pins[1] = 0x17;
9263
9263
+
spec->automute = 1;
9264
9264
+
spec->automute_mode = ALC_AUTOMUTE_AMP;
9548
9265
}
9549
9266
9550
9550
-
static struct hda_verb alc883_mitac_verbs[] = {
9267
9267
+
static const struct hda_verb alc883_mitac_verbs[] = {
9551
9268
/* HP */
9552
9269
{0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9553
9270
{0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
···
9564
9277
{ } /* end */
9565
9278
};
9566
9279
9567
9567
-
static struct hda_verb alc883_clevo_m540r_verbs[] = {
9280
9280
+
static const struct hda_verb alc883_clevo_m540r_verbs[] = {
9568
9281
/* HP */
9569
9282
{0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9570
9283
{0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
···
9580
9293
{ } /* end */
9581
9294
};
9582
9295
9583
9583
-
static struct hda_verb alc883_clevo_m720_verbs[] = {
9296
9296
+
static const struct hda_verb alc883_clevo_m720_verbs[] = {
9584
9297
/* HP */
9585
9298
{0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9586
9299
{0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
···
9595
9308
{ } /* end */
9596
9309
};
9597
9310
9598
9598
-
static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
9311
9311
+
static const struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
9599
9312
/* HP */
9600
9313
{0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9601
9314
{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
···
9609
9322
{ } /* end */
9610
9323
};
9611
9324
9612
9612
-
static struct hda_verb alc883_targa_verbs[] = {
9325
9325
+
static const struct hda_verb alc883_targa_verbs[] = {
9613
9326
{0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9614
9327
{0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9615
9328
···
9638
9351
{ } /* end */
9639
9352
};
9640
9353
9641
9641
-
static struct hda_verb alc883_lenovo_101e_verbs[] = {
9354
9354
+
static const struct hda_verb alc883_lenovo_101e_verbs[] = {
9642
9355
{0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9643
9356
{0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
9644
9357
{0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
9645
9358
{ } /* end */
9646
9359
};
9647
9360
9648
9648
-
static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
9361
9361
+
static const struct hda_verb alc883_lenovo_nb0763_verbs[] = {
9649
9362
{0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9650
9363
{0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9651
9364
{0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
···
9653
9366
{ } /* end */
9654
9367
};
9655
9368
9656
9656
-
static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
9369
9369
+
static const struct hda_verb alc888_lenovo_ms7195_verbs[] = {
9657
9370
{0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9658
9371
{0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9659
9372
{0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
···
9662
9375
{ } /* end */
9663
9376
};
9664
9377
9665
9665
-
static struct hda_verb alc883_haier_w66_verbs[] = {
9378
9378
+
static const struct hda_verb alc883_haier_w66_verbs[] = {
9666
9379
{0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9667
9380
{0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9668
9381
···
9675
9388
{ } /* end */
9676
9389
};
9677
9390
9678
9678
-
static struct hda_verb alc888_lenovo_sky_verbs[] = {
9391
9391
+
static const struct hda_verb alc888_lenovo_sky_verbs[] = {
9679
9392
{0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9680
9393
{0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9681
9394
{0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
···
9687
9400
{ } /* end */
9688
9401
};
9689
9402
9690
9690
-
static struct hda_verb alc888_6st_dell_verbs[] = {
9403
9403
+
static const struct hda_verb alc888_6st_dell_verbs[] = {
9691
9404
{0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9692
9405
{ }
9693
9406
};
9694
9407
9695
9695
-
static struct hda_verb alc883_vaiott_verbs[] = {
9408
9408
+
static const struct hda_verb alc883_vaiott_verbs[] = {
9696
9409
/* HP */
9697
9410
{0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9698
9411
{0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
···
9711
9424
spec->autocfg.speaker_pins[0] = 0x14;
9712
9425
spec->autocfg.speaker_pins[1] = 0x16;
9713
9426
spec->autocfg.speaker_pins[2] = 0x18;
9427
9427
+
spec->automute = 1;
9428
9428
+
spec->automute_mode = ALC_AUTOMUTE_AMP;
9714
9429
}
9715
9430
9716
9716
-
static struct hda_verb alc888_3st_hp_verbs[] = {
9431
9431
+
static const struct hda_verb alc888_3st_hp_verbs[] = {
9717
9432
{0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
9718
9433
{0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
9719
9434
{0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
···
9726
9437
/*
9727
9438
* 2ch mode
9728
9439
*/
9729
9729
-
static struct hda_verb alc888_3st_hp_2ch_init[] = {
9440
9440
+
static const struct hda_verb alc888_3st_hp_2ch_init[] = {
9730
9441
{ 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
9731
9442
{ 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
9732
9443
{ 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
···
9737
9448
/*
9738
9449
* 4ch mode
9739
9450
*/
9740
9740
-
static struct hda_verb alc888_3st_hp_4ch_init[] = {
9451
9451
+
static const struct hda_verb alc888_3st_hp_4ch_init[] = {
9741
9452
{ 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
9742
9453
{ 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
9743
9454
{ 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
···
9749
9460
/*
9750
9461
* 6ch mode
9751
9462
*/
9752
9752
-
static struct hda_verb alc888_3st_hp_6ch_init[] = {
9463
9463
+
static const struct hda_verb alc888_3st_hp_6ch_init[] = {
9753
9464
{ 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9754
9465
{ 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9755
9466
{ 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
···
9759
9470
{ } /* end */
9760
9471
};
9761
9472
9762
9762
-
static struct hda_channel_mode alc888_3st_hp_modes[3] = {
9473
9473
+
static const struct hda_channel_mode alc888_3st_hp_modes[3] = {
9763
9474
{ 2, alc888_3st_hp_2ch_init },
9764
9475
{ 4, alc888_3st_hp_4ch_init },
9765
9476
{ 6, alc888_3st_hp_6ch_init },
9766
9477
};
9767
9478
9768
9768
-
/* toggle front-jack and RCA according to the hp-jack state */
9769
9769
-
static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
9479
9479
+
static void alc888_lenovo_ms7195_setup(struct hda_codec *codec)
9770
9480
{
9771
9771
-
unsigned int present = snd_hda_jack_detect(codec, 0x1b);
9481
9481
+
struct alc_spec *spec = codec->spec;
9772
9482
9773
9773
-
snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9774
9774
-
HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9775
9775
-
snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9776
9776
-
HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9777
9777
-
}
9778
9778
-
9779
9779
-
/* toggle RCA according to the front-jack state */
9780
9780
-
static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
9781
9781
-
{
9782
9782
-
unsigned int present = snd_hda_jack_detect(codec, 0x14);
9783
9783
-
9784
9784
-
snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9785
9785
-
HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9786
9786
-
}
9787
9787
-
9788
9788
-
static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
9789
9789
-
unsigned int res)
9790
9790
-
{
9791
9791
-
if ((res >> 26) == ALC880_HP_EVENT)
9792
9792
-
alc888_lenovo_ms7195_front_automute(codec);
9793
9793
-
if ((res >> 26) == ALC880_FRONT_EVENT)
9794
9794
-
alc888_lenovo_ms7195_rca_automute(codec);
9483
9483
+
spec->autocfg.hp_pins[0] = 0x1b;
9484
9484
+
spec->autocfg.line_out_pins[0] = 0x14;
9485
9485
+
spec->autocfg.speaker_pins[0] = 0x15;
9486
9486
+
spec->automute = 1;
9487
9487
+
spec->automute_mode = ALC_AUTOMUTE_AMP;
9795
9488
}
9796
9489
9797
9490
/* toggle speaker-output according to the hp-jack state */
···
9783
9512
9784
9513
spec->autocfg.hp_pins[0] = 0x14;
9785
9514
spec->autocfg.speaker_pins[0] = 0x15;
9515
9515
+
spec->automute = 1;
9516
9516
+
spec->automute_mode = ALC_AUTOMUTE_AMP;
9786
9517
}
9787
9518
9788
9519
/* toggle speaker-output according to the hp-jack state */
···
9797
9524
9798
9525
spec->autocfg.hp_pins[0] = 0x15;
9799
9526
spec->autocfg.speaker_pins[0] = 0x14;
9527
9527
+
spec->automute = 1;
9528
9528
+
spec->automute_mode = ALC_AUTOMUTE_AMP;
9800
9529
}
9801
9530
9802
9531
static void alc883_clevo_m720_init_hook(struct hda_codec *codec)
9803
9532
{
9804
9804
-
alc_automute_amp(codec);
9533
9533
+
alc_hp_automute(codec);
9805
9534
alc88x_simple_mic_automute(codec);
9806
9535
}
9807
9536
···
9815
9540
alc88x_simple_mic_automute(codec);
9816
9541
break;
9817
9542
default:
9818
9818
-
alc_automute_amp_unsol_event(codec, res);
9543
9543
+
alc_sku_unsol_event(codec, res);
9819
9544
break;
9820
9545
}
9821
9546
}
···
9827
9552
9828
9553
spec->autocfg.hp_pins[0] = 0x14;
9829
9554
spec->autocfg.speaker_pins[0] = 0x15;
9555
9555
+
spec->automute = 1;
9556
9556
+
spec->automute_mode = ALC_AUTOMUTE_AMP;
9830
9557
}
9831
9558
9832
9559
static void alc883_haier_w66_setup(struct hda_codec *codec)
···
9837
9560
9838
9561
spec->autocfg.hp_pins[0] = 0x1b;
9839
9562
spec->autocfg.speaker_pins[0] = 0x14;
9563
9563
+
spec->automute = 1;
9564
9564
+
spec->automute_mode = ALC_AUTOMUTE_AMP;
9840
9565
}
9841
9566
9842
9842
-
static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
9567
9567
+
static void alc883_lenovo_101e_setup(struct hda_codec *codec)
9843
9568
{
9844
9844
-
int bits = snd_hda_jack_detect(codec, 0x14) ? HDA_AMP_MUTE : 0;
9569
9569
+
struct alc_spec *spec = codec->spec;
9845
9570
9846
9846
-
snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9847
9847
-
HDA_AMP_MUTE, bits);
9848
9848
-
}
9849
9849
-
9850
9850
-
static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
9851
9851
-
{
9852
9852
-
int bits = snd_hda_jack_detect(codec, 0x1b) ? HDA_AMP_MUTE : 0;
9853
9853
-
9854
9854
-
snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9855
9855
-
HDA_AMP_MUTE, bits);
9856
9856
-
snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9857
9857
-
HDA_AMP_MUTE, bits);
9858
9858
-
}
9859
9859
-
9860
9860
-
static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
9861
9861
-
unsigned int res)
9862
9862
-
{
9863
9863
-
if ((res >> 26) == ALC880_HP_EVENT)
9864
9864
-
alc883_lenovo_101e_all_automute(codec);
9865
9865
-
if ((res >> 26) == ALC880_FRONT_EVENT)
9866
9866
-
alc883_lenovo_101e_ispeaker_automute(codec);
9571
9571
+
spec->autocfg.hp_pins[0] = 0x1b;
9572
9572
+
spec->autocfg.line_out_pins[0] = 0x14;
9573
9573
+
spec->autocfg.speaker_pins[0] = 0x15;
9574
9574
+
spec->automute = 1;
9575
9575
+
spec->detect_line = 1;
9576
9576
+
spec->automute_lines = 1;
9577
9577
+
spec->automute_mode = ALC_AUTOMUTE_AMP;
9867
9578
}
9868
9579
9869
9580
/* toggle speaker-output according to the hp-jack state */
···
9862
9597
spec->autocfg.hp_pins[0] = 0x14;
9863
9598
spec->autocfg.speaker_pins[0] = 0x15;
9864
9599
spec->autocfg.speaker_pins[1] = 0x16;
9600
9600
+
spec->automute = 1;
9601
9601
+
spec->automute_mode = ALC_AUTOMUTE_AMP;
9865
9602
}
9866
9603
9867
9867
-
static struct hda_verb alc883_acer_eapd_verbs[] = {
9604
9604
+
static const struct hda_verb alc883_acer_eapd_verbs[] = {
9868
9605
/* HP Pin: output 0 (0x0c) */
9869
9606
{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9870
9607
{0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
···
9893
9626
spec->autocfg.speaker_pins[1] = 0x15;
9894
9627
spec->autocfg.speaker_pins[2] = 0x16;
9895
9628
spec->autocfg.speaker_pins[3] = 0x17;
9629
9629
+
spec->automute = 1;
9630
9630
+
spec->automute_mode = ALC_AUTOMUTE_AMP;
9896
9631
}
9897
9632
9898
9633
static void alc888_lenovo_sky_setup(struct hda_codec *codec)
···
9907
9638
spec->autocfg.speaker_pins[2] = 0x16;
9908
9639
spec->autocfg.speaker_pins[3] = 0x17;
9909
9640
spec->autocfg.speaker_pins[4] = 0x1a;
9641
9641
+
spec->automute = 1;
9642
9642
+
spec->automute_mode = ALC_AUTOMUTE_AMP;
9910
9643
}
9911
9644
9912
9645
static void alc883_vaiott_setup(struct hda_codec *codec)
···
9918
9647
spec->autocfg.hp_pins[0] = 0x15;
9919
9648
spec->autocfg.speaker_pins[0] = 0x14;
9920
9649
spec->autocfg.speaker_pins[1] = 0x17;
9650
9650
+
spec->automute = 1;
9651
9651
+
spec->automute_mode = ALC_AUTOMUTE_AMP;
9921
9652
}
9922
9653
9923
9923
-
static struct hda_verb alc888_asus_m90v_verbs[] = {
9654
9654
+
static const struct hda_verb alc888_asus_m90v_verbs[] = {
9924
9655
{0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9925
9656
{0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9926
9657
{0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
···
9945
9672
spec->ext_mic.mux_idx = 0;
9946
9673
spec->int_mic.mux_idx = 1;
9947
9674
spec->auto_mic = 1;
9675
9675
+
spec->automute = 1;
9676
9676
+
spec->automute_mode = ALC_AUTOMUTE_AMP;
9948
9677
}
9949
9678
9950
9950
-
static struct hda_verb alc888_asus_eee1601_verbs[] = {
9679
9679
+
static const struct hda_verb alc888_asus_eee1601_verbs[] = {
9951
9680
{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9952
9681
{0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9953
9682
{0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
···
9968
9693
9969
9694
spec->autocfg.hp_pins[0] = 0x14;
9970
9695
spec->autocfg.speaker_pins[0] = 0x1b;
9971
9971
-
alc_automute_pin(codec);
9696
9696
+
alc_hp_automute(codec);
9972
9697
}
9973
9698
9974
9974
-
static struct hda_verb alc889A_mb31_verbs[] = {
9699
9699
+
static const struct hda_verb alc889A_mb31_verbs[] = {
9975
9700
/* Init rear pin (used as headphone output) */
9976
9701
{0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */
9977
9702
{0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */
···
10017
9742
#define alc882_pcm_digital_playback alc880_pcm_digital_playback
10018
9743
#define alc882_pcm_digital_capture alc880_pcm_digital_capture
10019
9744
10020
10020
-
static hda_nid_t alc883_slave_dig_outs[] = {
9745
9745
+
static const hda_nid_t alc883_slave_dig_outs[] = {
10021
9746
ALC1200_DIGOUT_NID, 0,
10022
9747
};
10023
9748
10024
10024
-
static hda_nid_t alc1200_slave_dig_outs[] = {
9749
9749
+
static const hda_nid_t alc1200_slave_dig_outs[] = {
10025
9750
ALC883_DIGOUT_NID, 0,
10026
9751
};
10027
9752
···
10080
9805
[ALC882_AUTO] = "auto",
10081
9806
};
10082
9807
10083
10083
-
static struct snd_pci_quirk alc882_cfg_tbl[] = {
9808
9808
+
static const struct snd_pci_quirk alc882_cfg_tbl[] = {
10084
9809
SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
10085
9810
10086
9811
SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
···
10207
9932
};
10208
9933
10209
9934
/* codec SSID table for Intel Mac */
10210
10210
-
static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
9935
9935
+
static const struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
10211
9936
SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3),
10212
9937
SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3),
10213
9938
SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3),
···
10234
9959
{} /* terminator */
10235
9960
};
10236
9961
10237
10237
-
static struct alc_config_preset alc882_presets[] = {
9962
9962
+
static const struct alc_config_preset alc882_presets[] = {
10238
9963
[ALC882_3ST_DIG] = {
10239
9964
.mixers = { alc882_base_mixer },
10240
9965
.init_verbs = { alc882_base_init_verbs,
···
10290
10015
.channel_mode = alc885_mba21_ch_modes,
10291
10016
.num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes),
10292
10017
.input_mux = &alc882_capture_source,
10293
10293
-
.unsol_event = alc_automute_amp_unsol_event,
10018
10018
+
.unsol_event = alc_sku_unsol_event,
10294
10019
.setup = alc885_mba21_setup,
10295
10295
-
.init_hook = alc_automute_amp,
10020
10020
+
.init_hook = alc_hp_automute,
10296
10021
},
10297
10022
[ALC885_MBP3] = {
10298
10023
.mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
···
10306
10031
.input_mux = &alc882_capture_source,
10307
10032
.dig_out_nid = ALC882_DIGOUT_NID,
10308
10033
.dig_in_nid = ALC882_DIGIN_NID,
10309
10309
-
.unsol_event = alc_automute_amp_unsol_event,
10034
10034
+
.unsol_event = alc_sku_unsol_event,
10310
10035
.setup = alc885_mbp3_setup,
10311
10311
-
.init_hook = alc_automute_amp,
10036
10036
+
.init_hook = alc_hp_automute,
10312
10037
},
10313
10038
[ALC885_MB5] = {
10314
10039
.mixers = { alc885_mb5_mixer, alc882_chmode_mixer },
···
10321
10046
.input_mux = &mb5_capture_source,
10322
10047
.dig_out_nid = ALC882_DIGOUT_NID,
10323
10048
.dig_in_nid = ALC882_DIGIN_NID,
10324
10324
-
.unsol_event = alc_automute_amp_unsol_event,
10049
10049
+
.unsol_event = alc_sku_unsol_event,
10325
10050
.setup = alc885_mb5_setup,
10326
10326
-
.init_hook = alc_automute_amp,
10051
10051
+
.init_hook = alc_hp_automute,
10327
10052
},
10328
10053
[ALC885_MACMINI3] = {
10329
10054
.mixers = { alc885_macmini3_mixer, alc882_chmode_mixer },
···
10336
10061
.input_mux = &macmini3_capture_source,
10337
10062
.dig_out_nid = ALC882_DIGOUT_NID,
10338
10063
.dig_in_nid = ALC882_DIGIN_NID,
10339
10339
-
.unsol_event = alc_automute_amp_unsol_event,
10064
10064
+
.unsol_event = alc_sku_unsol_event,
10340
10065
.setup = alc885_macmini3_setup,
10341
10341
-
.init_hook = alc_automute_amp,
10066
10066
+
.init_hook = alc_hp_automute,
10342
10067
},
10343
10068
[ALC885_MACPRO] = {
10344
10069
.mixers = { alc882_macpro_mixer },
···
10362
10087
.num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
10363
10088
.channel_mode = alc882_ch_modes,
10364
10089
.input_mux = &alc882_capture_source,
10365
10365
-
.unsol_event = alc_automute_amp_unsol_event,
10090
10090
+
.unsol_event = alc_sku_unsol_event,
10366
10091
.setup = alc885_imac24_setup,
10367
10092
.init_hook = alc885_imac24_init_hook,
10368
10093
},
···
10377
10102
.input_mux = &alc889A_imac91_capture_source,
10378
10103
.dig_out_nid = ALC882_DIGOUT_NID,
10379
10104
.dig_in_nid = ALC882_DIGIN_NID,
10380
10380
-
.unsol_event = alc_automute_amp_unsol_event,
10105
10105
+
.unsol_event = alc_sku_unsol_event,
10381
10106
.setup = alc885_imac91_setup,
10382
10382
-
.init_hook = alc_automute_amp,
10107
10107
+
.init_hook = alc_hp_automute,
10383
10108
},
10384
10109
[ALC882_TARGA] = {
10385
10110
.mixers = { alc882_targa_mixer, alc882_chmode_mixer },
···
10395
10120
.channel_mode = alc882_3ST_6ch_modes,
10396
10121
.need_dac_fix = 1,
10397
10122
.input_mux = &alc882_capture_source,
10398
10398
-
.unsol_event = alc882_targa_unsol_event,
10123
10123
+
.unsol_event = alc_sku_unsol_event,
10399
10124
.setup = alc882_targa_setup,
10400
10125
.init_hook = alc882_targa_automute,
10401
10126
},
···
10489
10214
.capsrc_nids = alc889_capsrc_nids,
10490
10215
.input_mux = &alc889_capture_source,
10491
10216
.setup = alc889_automute_setup,
10492
10492
-
.init_hook = alc_automute_amp,
10493
10493
-
.unsol_event = alc_automute_amp_unsol_event,
10217
10217
+
.init_hook = alc_hp_automute,
10218
10218
+
.unsol_event = alc_sku_unsol_event,
10494
10219
.need_dac_fix = 1,
10495
10220
},
10496
10221
[ALC889_INTEL] = {
···
10510
10235
.input_mux = &alc889_capture_source,
10511
10236
.setup = alc889_automute_setup,
10512
10237
.init_hook = alc889_intel_init_hook,
10513
10513
-
.unsol_event = alc_automute_amp_unsol_event,
10238
10238
+
.unsol_event = alc_sku_unsol_event,
10514
10239
.need_dac_fix = 1,
10515
10240
},
10516
10241
[ALC883_6ST_DIG] = {
···
10599
10324
.num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10600
10325
.channel_mode = alc883_3ST_2ch_modes,
10601
10326
.input_mux = &alc883_capture_source,
10602
10602
-
.unsol_event = alc_automute_amp_unsol_event,
10327
10327
+
.unsol_event = alc_sku_unsol_event,
10603
10328
.setup = alc883_acer_aspire_setup,
10604
10604
-
.init_hook = alc_automute_amp,
10329
10329
+
.init_hook = alc_hp_automute,
10605
10330
},
10606
10331
[ALC888_ACER_ASPIRE_4930G] = {
10607
10332
.mixers = { alc888_acer_aspire_4930g_mixer,
···
10621
10346
.num_mux_defs =
10622
10347
ARRAY_SIZE(alc888_2_capture_sources),
10623
10348
.input_mux = alc888_2_capture_sources,
10624
10624
-
.unsol_event = alc_automute_amp_unsol_event,
10349
10349
+
.unsol_event = alc_sku_unsol_event,
10625
10350
.setup = alc888_acer_aspire_4930g_setup,
10626
10626
-
.init_hook = alc_automute_amp,
10351
10351
+
.init_hook = alc_hp_automute,
10627
10352
},
10628
10353
[ALC888_ACER_ASPIRE_6530G] = {
10629
10354
.mixers = { alc888_acer_aspire_6530_mixer },
···
10640
10365
.num_mux_defs =
10641
10366
ARRAY_SIZE(alc888_2_capture_sources),
10642
10367
.input_mux = alc888_acer_aspire_6530_sources,
10643
10643
-
.unsol_event = alc_automute_amp_unsol_event,
10368
10368
+
.unsol_event = alc_sku_unsol_event,
10644
10369
.setup = alc888_acer_aspire_6530g_setup,
10645
10645
-
.init_hook = alc_automute_amp,
10370
10370
+
.init_hook = alc_hp_automute,
10646
10371
},
10647
10372
[ALC888_ACER_ASPIRE_8930G] = {
10648
10373
.mixers = { alc889_acer_aspire_8930g_mixer,
···
10663
10388
.num_mux_defs =
10664
10389
ARRAY_SIZE(alc889_capture_sources),
10665
10390
.input_mux = alc889_capture_sources,
10666
10666
-
.unsol_event = alc_automute_amp_unsol_event,
10391
10391
+
.unsol_event = alc_sku_unsol_event,
10667
10392
.setup = alc889_acer_aspire_8930g_setup,
10668
10668
-
.init_hook = alc_automute_amp,
10393
10393
+
.init_hook = alc_hp_automute,
10669
10394
#ifdef CONFIG_SND_HDA_POWER_SAVE
10670
10395
.power_hook = alc_power_eapd,
10671
10396
#endif
···
10686
10411
.need_dac_fix = 1,
10687
10412
.const_channel_count = 6,
10688
10413
.input_mux = &alc883_capture_source,
10689
10689
-
.unsol_event = alc_automute_amp_unsol_event,
10414
10414
+
.unsol_event = alc_sku_unsol_event,
10690
10415
.setup = alc888_acer_aspire_7730g_setup,
10691
10691
-
.init_hook = alc_automute_amp,
10416
10416
+
.init_hook = alc_hp_automute,
10692
10417
},
10693
10418
[ALC883_MEDION] = {
10694
10419
.mixers = { alc883_fivestack_mixer,
···
10715
10440
.num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10716
10441
.channel_mode = alc883_3ST_2ch_modes,
10717
10442
.input_mux = &alc883_capture_source,
10718
10718
-
.unsol_event = alc_automute_amp_unsol_event,
10443
10443
+
.unsol_event = alc_sku_unsol_event,
10719
10444
.setup = alc883_medion_wim2160_setup,
10720
10720
-
.init_hook = alc_automute_amp,
10445
10445
+
.init_hook = alc_hp_automute,
10721
10446
},
10722
10447
[ALC883_LAPTOP_EAPD] = {
10723
10448
.mixers = { alc883_base_mixer },
···
10767
10492
.num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10768
10493
.channel_mode = alc883_3ST_2ch_modes,
10769
10494
.input_mux = &alc883_lenovo_101e_capture_source,
10770
10770
-
.unsol_event = alc883_lenovo_101e_unsol_event,
10771
10771
-
.init_hook = alc883_lenovo_101e_all_automute,
10495
10495
+
.setup = alc883_lenovo_101e_setup,
10496
10496
+
.unsol_event = alc_sku_unsol_event,
10497
10497
+
.init_hook = alc_inithook,
10772
10498
},
10773
10499
[ALC883_LENOVO_NB0763] = {
10774
10500
.mixers = { alc883_lenovo_nb0763_mixer },
···
10780
10504
.channel_mode = alc883_3ST_2ch_modes,
10781
10505
.need_dac_fix = 1,
10782
10506
.input_mux = &alc883_lenovo_nb0763_capture_source,
10783
10783
-
.unsol_event = alc_automute_amp_unsol_event,
10507
10507
+
.unsol_event = alc_sku_unsol_event,
10784
10508
.setup = alc883_lenovo_nb0763_setup,
10785
10785
-
.init_hook = alc_automute_amp,
10509
10509
+
.init_hook = alc_hp_automute,
10786
10510
},
10787
10511
[ALC888_LENOVO_MS7195_DIG] = {
10788
10512
.mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
···
10794
10518
.channel_mode = alc883_3ST_6ch_modes,
10795
10519
.need_dac_fix = 1,
10796
10520
.input_mux = &alc883_capture_source,
10797
10797
-
.unsol_event = alc883_lenovo_ms7195_unsol_event,
10798
10798
-
.init_hook = alc888_lenovo_ms7195_front_automute,
10521
10521
+
.unsol_event = alc_sku_unsol_event,
10522
10522
+
.setup = alc888_lenovo_ms7195_setup,
10523
10523
+
.init_hook = alc_inithook,
10799
10524
},
10800
10525
[ALC883_HAIER_W66] = {
10801
10526
.mixers = { alc883_targa_2ch_mixer},
···
10807
10530
.num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10808
10531
.channel_mode = alc883_3ST_2ch_modes,
10809
10532
.input_mux = &alc883_capture_source,
10810
10810
-
.unsol_event = alc_automute_amp_unsol_event,
10533
10533
+
.unsol_event = alc_sku_unsol_event,
10811
10534
.setup = alc883_haier_w66_setup,
10812
10812
-
.init_hook = alc_automute_amp,
10535
10535
+
.init_hook = alc_hp_automute,
10813
10536
},
10814
10537
[ALC888_3ST_HP] = {
10815
10538
.mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
···
10820
10543
.channel_mode = alc888_3st_hp_modes,
10821
10544
.need_dac_fix = 1,
10822
10545
.input_mux = &alc883_capture_source,
10823
10823
-
.unsol_event = alc_automute_amp_unsol_event,
10546
10546
+
.unsol_event = alc_sku_unsol_event,
10824
10547
.setup = alc888_3st_hp_setup,
10825
10825
-
.init_hook = alc_automute_amp,
10548
10548
+
.init_hook = alc_hp_automute,
10826
10549
},
10827
10550
[ALC888_6ST_DELL] = {
10828
10551
.mixers = { alc883_base_mixer, alc883_chmode_mixer },
···
10834
10557
.num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10835
10558
.channel_mode = alc883_sixstack_modes,
10836
10559
.input_mux = &alc883_capture_source,
10837
10837
-
.unsol_event = alc_automute_amp_unsol_event,
10560
10560
+
.unsol_event = alc_sku_unsol_event,
10838
10561
.setup = alc888_6st_dell_setup,
10839
10839
-
.init_hook = alc_automute_amp,
10562
10562
+
.init_hook = alc_hp_automute,
10840
10563
},
10841
10564
[ALC883_MITAC] = {
10842
10565
.mixers = { alc883_mitac_mixer },
···
10846
10569
.num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10847
10570
.channel_mode = alc883_3ST_2ch_modes,
10848
10571
.input_mux = &alc883_capture_source,
10849
10849
-
.unsol_event = alc_automute_amp_unsol_event,
10572
10572
+
.unsol_event = alc_sku_unsol_event,
10850
10573
.setup = alc883_mitac_setup,
10851
10851
-
.init_hook = alc_automute_amp,
10574
10574
+
.init_hook = alc_hp_automute,
10852
10575
},
10853
10576
[ALC883_FUJITSU_PI2515] = {
10854
10577
.mixers = { alc883_2ch_fujitsu_pi2515_mixer },
···
10860
10583
.num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10861
10584
.channel_mode = alc883_3ST_2ch_modes,
10862
10585
.input_mux = &alc883_fujitsu_pi2515_capture_source,
10863
10863
-
.unsol_event = alc_automute_amp_unsol_event,
10586
10586
+
.unsol_event = alc_sku_unsol_event,
10864
10587
.setup = alc883_2ch_fujitsu_pi2515_setup,
10865
10865
-
.init_hook = alc_automute_amp,
10588
10588
+
.init_hook = alc_hp_automute,
10866
10589
},
10867
10590
[ALC888_FUJITSU_XA3530] = {
10868
10591
.mixers = { alc888_base_mixer, alc883_chmode_mixer },
···
10879
10602
.num_mux_defs =
10880
10603
ARRAY_SIZE(alc888_2_capture_sources),
10881
10604
.input_mux = alc888_2_capture_sources,
10882
10882
-
.unsol_event = alc_automute_amp_unsol_event,
10605
10605
+
.unsol_event = alc_sku_unsol_event,
10883
10606
.setup = alc888_fujitsu_xa3530_setup,
10884
10884
-
.init_hook = alc_automute_amp,
10607
10607
+
.init_hook = alc_hp_automute,
10885
10608
},
10886
10609
[ALC888_LENOVO_SKY] = {
10887
10610
.mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
···
10893
10616
.channel_mode = alc883_sixstack_modes,
10894
10617
.need_dac_fix = 1,
10895
10618
.input_mux = &alc883_lenovo_sky_capture_source,
10896
10896
-
.unsol_event = alc_automute_amp_unsol_event,
10619
10619
+
.unsol_event = alc_sku_unsol_event,
10897
10620
.setup = alc888_lenovo_sky_setup,
10898
10898
-
.init_hook = alc_automute_amp,
10621
10621
+
.init_hook = alc_hp_automute,
10899
10622
},
10900
10623
[ALC888_ASUS_M90V] = {
10901
10624
.mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
···
10963
10686
.num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10964
10687
.channel_mode = alc883_3ST_2ch_modes,
10965
10688
.input_mux = &alc883_capture_source,
10966
10966
-
.unsol_event = alc_automute_amp_unsol_event,
10689
10689
+
.unsol_event = alc_sku_unsol_event,
10967
10690
.setup = alc883_vaiott_setup,
10968
10968
-
.init_hook = alc_automute_amp,
10691
10691
+
.init_hook = alc_hp_automute,
10969
10692
},
10970
10693
};
10971
10694
···
11011
10734
},
11012
10735
};
11013
10736
11014
11014
-
static struct snd_pci_quirk alc882_fixup_tbl[] = {
10737
10737
+
static const struct snd_pci_quirk alc882_fixup_tbl[] = {
11015
10738
SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", PINFIX_PB_M5210),
11016
10739
SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", PINFIX_LENOVO_Y530),
11017
10740
SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
···
11119
10842
const struct hda_input_mux *imux;
11120
10843
int conns, mute, idx, item;
11121
10844
10845
10845
+
/* mute ADC */
10846
10846
+
snd_hda_codec_write(codec, spec->adc_nids[c], 0,
10847
10847
+
AC_VERB_SET_AMP_GAIN_MUTE,
10848
10848
+
AMP_IN_MUTE(0));
10849
10849
+
11122
10850
conns = snd_hda_get_connections(codec, nid, conn_list,
11123
10851
ARRAY_SIZE(conn_list));
11124
10852
if (conns < 0)
···
11203
10921
static int alc882_parse_auto_config(struct hda_codec *codec)
11204
10922
{
11205
10923
struct alc_spec *spec = codec->spec;
11206
11206
-
static hda_nid_t alc882_ignore[] = { 0x1d, 0 };
10924
10924
+
static const hda_nid_t alc882_ignore[] = { 0x1d, 0 };
11207
10925
int err;
11208
10926
11209
10927
err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
···
11214
10932
return 0; /* can't find valid BIOS pin config */
11215
10933
11216
10934
err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
10935
10935
+
if (err < 0)
10936
10936
+
return err;
10937
10937
+
err = alc_auto_add_multi_channel_mode(codec);
11217
10938
if (err < 0)
11218
10939
return err;
11219
10940
err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
···
11420
11135
#define alc262_modes alc260_modes
11421
11136
#define alc262_capture_source alc882_capture_source
11422
11137
11423
11423
-
static hda_nid_t alc262_dmic_adc_nids[1] = {
11138
11138
+
static const hda_nid_t alc262_dmic_adc_nids[1] = {
11424
11139
/* ADC0 */
11425
11140
0x09
11426
11141
};
11427
11142
11428
11428
-
static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
11143
11143
+
static const hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
11429
11144
11430
11430
-
static struct snd_kcontrol_new alc262_base_mixer[] = {
11145
11145
+
static const struct snd_kcontrol_new alc262_base_mixer[] = {
11431
11146
HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11432
11147
HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11433
11148
HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
···
11448
11163
};
11449
11164
11450
11165
/* update HP, line and mono-out pins according to the master switch */
11451
11451
-
static void alc262_hp_master_update(struct hda_codec *codec)
11452
11452
-
{
11453
11453
-
struct alc_spec *spec = codec->spec;
11454
11454
-
int val = spec->master_sw;
11166
11166
+
#define alc262_hp_master_update alc260_hp_master_update
11455
11167
11456
11456
-
/* HP & line-out */
11457
11457
-
snd_hda_codec_write_cache(codec, 0x1b, 0,
11458
11458
-
AC_VERB_SET_PIN_WIDGET_CONTROL,
11459
11459
-
val ? PIN_HP : 0);
11460
11460
-
snd_hda_codec_write_cache(codec, 0x15, 0,
11461
11461
-
AC_VERB_SET_PIN_WIDGET_CONTROL,
11462
11462
-
val ? PIN_HP : 0);
11463
11463
-
/* mono (speaker) depending on the HP jack sense */
11464
11464
-
val = val && !spec->jack_present;
11465
11465
-
snd_hda_codec_write_cache(codec, 0x16, 0,
11466
11466
-
AC_VERB_SET_PIN_WIDGET_CONTROL,
11467
11467
-
val ? PIN_OUT : 0);
11468
11468
-
}
11469
11469
-
11470
11470
-
static void alc262_hp_bpc_automute(struct hda_codec *codec)
11168
11168
+
static void alc262_hp_bpc_setup(struct hda_codec *codec)
11471
11169
{
11472
11170
struct alc_spec *spec = codec->spec;
11473
11171
11474
11474
-
spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
11475
11475
-
alc262_hp_master_update(codec);
11172
11172
+
spec->autocfg.hp_pins[0] = 0x1b;
11173
11173
+
spec->autocfg.speaker_pins[0] = 0x16;
11174
11174
+
spec->automute = 1;
11175
11175
+
spec->automute_mode = ALC_AUTOMUTE_PIN;
11476
11176
}
11477
11177
11478
11478
-
static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
11479
11479
-
{
11480
11480
-
if ((res >> 26) != ALC880_HP_EVENT)
11481
11481
-
return;
11482
11482
-
alc262_hp_bpc_automute(codec);
11483
11483
-
}
11484
11484
-
11485
11485
-
static void alc262_hp_wildwest_automute(struct hda_codec *codec)
11178
11178
+
static void alc262_hp_wildwest_setup(struct hda_codec *codec)
11486
11179
{
11487
11180
struct alc_spec *spec = codec->spec;
11488
11181
11489
11489
-
spec->jack_present = snd_hda_jack_detect(codec, 0x15);
11490
11490
-
alc262_hp_master_update(codec);
11491
11491
-
}
11492
11492
-
11493
11493
-
static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
11494
11494
-
unsigned int res)
11495
11495
-
{
11496
11496
-
if ((res >> 26) != ALC880_HP_EVENT)
11497
11497
-
return;
11498
11498
-
alc262_hp_wildwest_automute(codec);
11182
11182
+
spec->autocfg.hp_pins[0] = 0x15;
11183
11183
+
spec->autocfg.speaker_pins[0] = 0x16;
11184
11184
+
spec->automute = 1;
11185
11185
+
spec->automute_mode = ALC_AUTOMUTE_PIN;
11499
11186
}
11500
11187
11501
11188
#define alc262_hp_master_sw_get alc260_hp_master_sw_get
11502
11502
-
11503
11503
-
static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
11504
11504
-
struct snd_ctl_elem_value *ucontrol)
11505
11505
-
{
11506
11506
-
struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11507
11507
-
struct alc_spec *spec = codec->spec;
11508
11508
-
int val = !!*ucontrol->value.integer.value;
11509
11509
-
11510
11510
-
if (val == spec->master_sw)
11511
11511
-
return 0;
11512
11512
-
spec->master_sw = val;
11513
11513
-
alc262_hp_master_update(codec);
11514
11514
-
return 1;
11515
11515
-
}
11189
11189
+
#define alc262_hp_master_sw_put alc260_hp_master_sw_put
11516
11190
11517
11191
#define ALC262_HP_MASTER_SWITCH \
11518
11192
{ \
···
11488
11244
}
11489
11245
11490
11246
11491
11491
-
static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
11247
11247
+
static const struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
11492
11248
ALC262_HP_MASTER_SWITCH,
11493
11249
HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11494
11250
HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
···
11512
11268
{ } /* end */
11513
11269
};
11514
11270
11515
11515
-
static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
11271
11271
+
static const struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
11516
11272
ALC262_HP_MASTER_SWITCH,
11517
11273
HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11518
11274
HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
···
11532
11288
{ } /* end */
11533
11289
};
11534
11290
11535
11535
-
static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
11291
11291
+
static const struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
11536
11292
HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11537
11293
HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11538
11294
HDA_CODEC_VOLUME("Rear Mic Boost Volume", 0x18, 0, HDA_INPUT),
···
11546
11302
11547
11303
spec->autocfg.hp_pins[0] = 0x15;
11548
11304
spec->autocfg.speaker_pins[0] = 0x14;
11305
11305
+
spec->automute = 1;
11306
11306
+
spec->automute_mode = ALC_AUTOMUTE_PIN;
11549
11307
}
11550
11308
11551
11551
-
static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
11309
11309
+
static const struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
11552
11310
HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11553
11311
HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11554
11312
HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
···
11561
11315
{ } /* end */
11562
11316
};
11563
11317
11564
11564
-
static struct hda_verb alc262_hp_t5735_verbs[] = {
11318
11318
+
static const struct hda_verb alc262_hp_t5735_verbs[] = {
11565
11319
{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11566
11320
{0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11567
11321
···
11569
11323
{ }
11570
11324
};
11571
11325
11572
11572
-
static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
11326
11326
+
static const struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
11573
11327
HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11574
11328
HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11575
11329
HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
···
11579
11333
{ } /* end */
11580
11334
};
11581
11335
11582
11582
-
static struct hda_verb alc262_hp_rp5700_verbs[] = {
11336
11336
+
static const struct hda_verb alc262_hp_rp5700_verbs[] = {
11583
11337
{0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11584
11338
{0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11585
11339
{0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
···
11593
11347
{}
11594
11348
};
11595
11349
11596
11596
-
static struct hda_input_mux alc262_hp_rp5700_capture_source = {
11350
11350
+
static const struct hda_input_mux alc262_hp_rp5700_capture_source = {
11597
11351
.num_items = 1,
11598
11352
.items = {
11599
11353
{ "Line", 0x1 },
···
11601
11355
};
11602
11356
11603
11357
/* bind hp and internal speaker mute (with plug check) as master switch */
11604
11604
-
static void alc262_hippo_master_update(struct hda_codec *codec)
11605
11605
-
{
11606
11606
-
struct alc_spec *spec = codec->spec;
11607
11607
-
hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
11608
11608
-
hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
11609
11609
-
hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
11610
11610
-
unsigned int mute;
11611
11611
-
11612
11612
-
/* HP */
11613
11613
-
mute = spec->master_sw ? 0 : HDA_AMP_MUTE;
11614
11614
-
snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0,
11615
11615
-
HDA_AMP_MUTE, mute);
11616
11616
-
/* mute internal speaker per jack sense */
11617
11617
-
if (spec->jack_present)
11618
11618
-
mute = HDA_AMP_MUTE;
11619
11619
-
if (line_nid)
11620
11620
-
snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0,
11621
11621
-
HDA_AMP_MUTE, mute);
11622
11622
-
if (speaker_nid && speaker_nid != line_nid)
11623
11623
-
snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0,
11624
11624
-
HDA_AMP_MUTE, mute);
11625
11625
-
}
11626
11626
-
11358
11358
+
#define alc262_hippo_master_update alc262_hp_master_update
11627
11359
#define alc262_hippo_master_sw_get alc262_hp_master_sw_get
11628
11628
-
11629
11629
-
static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
11630
11630
-
struct snd_ctl_elem_value *ucontrol)
11631
11631
-
{
11632
11632
-
struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11633
11633
-
struct alc_spec *spec = codec->spec;
11634
11634
-
int val = !!*ucontrol->value.integer.value;
11635
11635
-
11636
11636
-
if (val == spec->master_sw)
11637
11637
-
return 0;
11638
11638
-
spec->master_sw = val;
11639
11639
-
alc262_hippo_master_update(codec);
11640
11640
-
return 1;
11641
11641
-
}
11360
11360
+
#define alc262_hippo_master_sw_put alc262_hp_master_sw_put
11642
11361
11643
11362
#define ALC262_HIPPO_MASTER_SWITCH \
11644
11363
{ \
···
11620
11409
(SUBDEV_SPEAKER(0) << 16), \
11621
11410
}
11622
11411
11623
11623
-
static struct snd_kcontrol_new alc262_hippo_mixer[] = {
11412
11412
+
static const struct snd_kcontrol_new alc262_hippo_mixer[] = {
11624
11413
ALC262_HIPPO_MASTER_SWITCH,
11625
11414
HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11626
11415
HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
···
11637
11426
{ } /* end */
11638
11427
};
11639
11428
11640
11640
-
static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
11429
11429
+
static const struct snd_kcontrol_new alc262_hippo1_mixer[] = {
11641
11430
HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11642
11431
ALC262_HIPPO_MASTER_SWITCH,
11643
11432
HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
···
11654
11443
};
11655
11444
11656
11445
/* mute/unmute internal speaker according to the hp jack and mute state */
11657
11657
-
static void alc262_hippo_automute(struct hda_codec *codec)
11658
11658
-
{
11659
11659
-
struct alc_spec *spec = codec->spec;
11660
11660
-
hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
11661
11661
-
11662
11662
-
spec->jack_present = snd_hda_jack_detect(codec, hp_nid);
11663
11663
-
alc262_hippo_master_update(codec);
11664
11664
-
}
11665
11665
-
11666
11666
-
static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res)
11667
11667
-
{
11668
11668
-
if ((res >> 26) != ALC880_HP_EVENT)
11669
11669
-
return;
11670
11670
-
alc262_hippo_automute(codec);
11671
11671
-
}
11672
11672
-
11673
11446
static void alc262_hippo_setup(struct hda_codec *codec)
11674
11447
{
11675
11448
struct alc_spec *spec = codec->spec;
11676
11449
11677
11450
spec->autocfg.hp_pins[0] = 0x15;
11678
11451
spec->autocfg.speaker_pins[0] = 0x14;
11452
11452
+
spec->automute = 1;
11453
11453
+
spec->automute_mode = ALC_AUTOMUTE_AMP;
11679
11454
}
11680
11455
11681
11456
static void alc262_hippo1_setup(struct hda_codec *codec)
···
11670
11473
11671
11474
spec->autocfg.hp_pins[0] = 0x1b;
11672
11475
spec->autocfg.speaker_pins[0] = 0x14;
11476
11476
+
spec->automute = 1;
11477
11477
+
spec->automute_mode = ALC_AUTOMUTE_AMP;
11673
11478
}
11674
11479
11675
11480
11676
11676
-
static struct snd_kcontrol_new alc262_sony_mixer[] = {
11481
11481
+
static const struct snd_kcontrol_new alc262_sony_mixer[] = {
11677
11482
HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11678
11483
ALC262_HIPPO_MASTER_SWITCH,
11679
11484
HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
···
11685
11486
{ } /* end */
11686
11487
};
11687
11488
11688
11688
-
static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
11489
11489
+
static const struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
11689
11490
HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11690
11491
ALC262_HIPPO_MASTER_SWITCH,
11691
11492
HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
···
11696
11497
{ } /* end */
11697
11498
};
11698
11499
11699
11699
-
static struct snd_kcontrol_new alc262_tyan_mixer[] = {
11500
11500
+
static const struct snd_kcontrol_new alc262_tyan_mixer[] = {
11700
11501
HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11701
11502
HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
11702
11503
HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
···
11712
11513
{ } /* end */
11713
11514
};
11714
11515
11715
11715
-
static struct hda_verb alc262_tyan_verbs[] = {
11516
11516
+
static const struct hda_verb alc262_tyan_verbs[] = {
11716
11517
/* Headphone automute */
11717
11518
{0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11718
11519
{0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
···
11734
11535
11735
11536
spec->autocfg.hp_pins[0] = 0x1b;
11736
11537
spec->autocfg.speaker_pins[0] = 0x15;
11538
11538
+
spec->automute = 1;
11539
11539
+
spec->automute_mode = ALC_AUTOMUTE_AMP;
11737
11540
}
11738
11541
11739
11542
···
11745
11544
/*
11746
11545
* generic initialization of ADC, input mixers and output mixers
11747
11546
*/
11748
11748
-
static struct hda_verb alc262_init_verbs[] = {
11547
11547
+
static const struct hda_verb alc262_init_verbs[] = {
11749
11548
/*
11750
11549
* Unmute ADC0-2 and set the default input to mic-in
11751
11550
*/
···
11821
11620
{ }
11822
11621
};
11823
11622
11824
11824
-
static struct hda_verb alc262_eapd_verbs[] = {
11623
11623
+
static const struct hda_verb alc262_eapd_verbs[] = {
11825
11624
{0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11826
11625
{0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
11827
11626
{ }
11828
11627
};
11829
11628
11830
11830
-
static struct hda_verb alc262_hippo1_unsol_verbs[] = {
11629
11629
+
static const struct hda_verb alc262_hippo1_unsol_verbs[] = {
11831
11630
{0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11832
11631
{0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11833
11632
{0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
···
11837
11636
{}
11838
11637
};
11839
11638
11840
11840
-
static struct hda_verb alc262_sony_unsol_verbs[] = {
11639
11639
+
static const struct hda_verb alc262_sony_unsol_verbs[] = {
11841
11640
{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11842
11641
{0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11843
11642
{0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
···
11847
11646
{}
11848
11647
};
11849
11648
11850
11850
-
static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
11649
11649
+
static const struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
11851
11650
HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11852
11651
HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11853
11652
HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
···
11856
11655
{ } /* end */
11857
11656
};
11858
11657
11859
11859
-
static struct hda_verb alc262_toshiba_s06_verbs[] = {
11658
11658
+
static const struct hda_verb alc262_toshiba_s06_verbs[] = {
11860
11659
{0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11861
11660
{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11862
11661
{0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
···
11879
11678
spec->int_mic.pin = 0x12;
11880
11679
spec->int_mic.mux_idx = 9;
11881
11680
spec->auto_mic = 1;
11681
11681
+
spec->automute = 1;
11682
11682
+
spec->automute_mode = ALC_AUTOMUTE_PIN;
11882
11683
}
11883
11684
11884
11685
/*
···
11890
11687
* 0x18 = external mic
11891
11688
*/
11892
11689
11893
11893
-
static struct snd_kcontrol_new alc262_nec_mixer[] = {
11690
11690
+
static const struct snd_kcontrol_new alc262_nec_mixer[] = {
11894
11691
HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
11895
11692
HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
11896
11693
···
11903
11700
{ } /* end */
11904
11701
};
11905
11702
11906
11906
-
static struct hda_verb alc262_nec_verbs[] = {
11703
11703
+
static const struct hda_verb alc262_nec_verbs[] = {
11907
11704
/* Unmute Speaker */
11908
11705
{0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11909
11706
···
11926
11723
11927
11724
#define ALC_HP_EVENT 0x37
11928
11725
11929
11929
-
static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
11726
11726
+
static const struct hda_verb alc262_fujitsu_unsol_verbs[] = {
11930
11727
{0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11931
11728
{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11932
11729
{0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
···
11934
11731
{}
11935
11732
};
11936
11733
11937
11937
-
static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
11734
11734
+
static const struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
11938
11735
{0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11939
11736
{0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11940
11737
{}
11941
11738
};
11942
11739
11943
11943
-
static struct hda_verb alc262_lenovo_3000_init_verbs[] = {
11740
11740
+
static const struct hda_verb alc262_lenovo_3000_init_verbs[] = {
11944
11741
/* Front Mic pin: input vref at 50% */
11945
11742
{0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
11946
11743
{0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11947
11744
{}
11948
11745
};
11949
11746
11950
11950
-
static struct hda_input_mux alc262_fujitsu_capture_source = {
11747
11747
+
static const struct hda_input_mux alc262_fujitsu_capture_source = {
11951
11748
.num_items = 3,
11952
11749
.items = {
11953
11750
{ "Mic", 0x0 },
···
11956
11753
},
11957
11754
};
11958
11755
11959
11959
-
static struct hda_input_mux alc262_HP_capture_source = {
11756
11756
+
static const struct hda_input_mux alc262_HP_capture_source = {
11960
11757
.num_items = 5,
11961
11758
.items = {
11962
11759
{ "Mic", 0x0 },
···
11967
11764
},
11968
11765
};
11969
11766
11970
11970
-
static struct hda_input_mux alc262_HP_D7000_capture_source = {
11767
11767
+
static const struct hda_input_mux alc262_HP_D7000_capture_source = {
11971
11768
.num_items = 4,
11972
11769
.items = {
11973
11770
{ "Mic", 0x0 },
···
11977
11774
},
11978
11775
};
11979
11776
11980
11980
-
/* mute/unmute internal speaker according to the hp jacks and mute state */
11981
11981
-
static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
11777
11777
+
static void alc262_fujitsu_setup(struct hda_codec *codec)
11982
11778
{
11983
11779
struct alc_spec *spec = codec->spec;
11984
11984
-
unsigned int mute;
11985
11780
11986
11986
-
if (force || !spec->sense_updated) {
11987
11987
-
spec->jack_present = snd_hda_jack_detect(codec, 0x14) ||
11988
11988
-
snd_hda_jack_detect(codec, 0x1b);
11989
11989
-
spec->sense_updated = 1;
11990
11990
-
}
11991
11991
-
/* unmute internal speaker only if both HPs are unplugged and
11992
11992
-
* master switch is on
11993
11993
-
*/
11994
11994
-
if (spec->jack_present)
11995
11995
-
mute = HDA_AMP_MUTE;
11996
11996
-
else
11997
11997
-
mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
11998
11998
-
snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11999
11999
-
HDA_AMP_MUTE, mute);
12000
12000
-
}
12001
12001
-
12002
12002
-
/* unsolicited event for HP jack sensing */
12003
12003
-
static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
12004
12004
-
unsigned int res)
12005
12005
-
{
12006
12006
-
if ((res >> 26) != ALC_HP_EVENT)
12007
12007
-
return;
12008
12008
-
alc262_fujitsu_automute(codec, 1);
12009
12009
-
}
12010
12010
-
12011
12011
-
static void alc262_fujitsu_init_hook(struct hda_codec *codec)
12012
12012
-
{
12013
12013
-
alc262_fujitsu_automute(codec, 1);
11781
11781
+
spec->autocfg.hp_pins[0] = 0x14;
11782
11782
+
spec->autocfg.hp_pins[1] = 0x1b;
11783
11783
+
spec->autocfg.speaker_pins[0] = 0x15;
11784
11784
+
spec->automute = 1;
11785
11785
+
spec->automute_mode = ALC_AUTOMUTE_AMP;
12014
11786
}
12015
11787
12016
11788
/* bind volumes of both NID 0x0c and 0x0d */
12017
12017
-
static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
11789
11789
+
static const struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
12018
11790
.ops = &snd_hda_bind_vol,
12019
11791
.values = {
12020
11792
HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
···
11998
11820
},
11999
11821
};
12000
11822
12001
12001
-
/* mute/unmute internal speaker according to the hp jack and mute state */
12002
12002
-
static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
12003
12003
-
{
12004
12004
-
struct alc_spec *spec = codec->spec;
12005
12005
-
unsigned int mute;
12006
12006
-
12007
12007
-
if (force || !spec->sense_updated) {
12008
12008
-
spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
12009
12009
-
spec->sense_updated = 1;
12010
12010
-
}
12011
12011
-
if (spec->jack_present) {
12012
12012
-
/* mute internal speaker */
12013
12013
-
snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
12014
12014
-
HDA_AMP_MUTE, HDA_AMP_MUTE);
12015
12015
-
snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
12016
12016
-
HDA_AMP_MUTE, HDA_AMP_MUTE);
12017
12017
-
} else {
12018
12018
-
/* unmute internal speaker if necessary */
12019
12019
-
mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
12020
12020
-
snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
12021
12021
-
HDA_AMP_MUTE, mute);
12022
12022
-
snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
12023
12023
-
HDA_AMP_MUTE, mute);
12024
12024
-
}
12025
12025
-
}
12026
12026
-
12027
12027
-
/* unsolicited event for HP jack sensing */
12028
12028
-
static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
12029
12029
-
unsigned int res)
12030
12030
-
{
12031
12031
-
if ((res >> 26) != ALC_HP_EVENT)
12032
12032
-
return;
12033
12033
-
alc262_lenovo_3000_automute(codec, 1);
12034
12034
-
}
12035
12035
-
12036
12036
-
static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid,
12037
12037
-
int dir, int idx, long *valp)
12038
12038
-
{
12039
12039
-
int i, change = 0;
12040
12040
-
12041
12041
-
for (i = 0; i < 2; i++, valp++)
12042
12042
-
change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx,
12043
12043
-
HDA_AMP_MUTE,
12044
12044
-
*valp ? 0 : HDA_AMP_MUTE);
12045
12045
-
return change;
12046
12046
-
}
12047
12047
-
12048
12048
-
/* bind hp and internal speaker mute (with plug check) */
12049
12049
-
static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
12050
12050
-
struct snd_ctl_elem_value *ucontrol)
12051
12051
-
{
12052
12052
-
struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
12053
12053
-
long *valp = ucontrol->value.integer.value;
12054
12054
-
int change;
12055
12055
-
12056
12056
-
change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
12057
12057
-
change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
12058
12058
-
if (change)
12059
12059
-
alc262_fujitsu_automute(codec, 0);
12060
12060
-
return change;
12061
12061
-
}
12062
12062
-
12063
12063
-
static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
11823
11823
+
static const struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
12064
11824
HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
12065
11825
{
12066
11826
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12067
11827
.name = "Master Playback Switch",
12068
12068
-
.subdevice = HDA_SUBDEV_AMP_FLAG,
12069
12069
-
.info = snd_hda_mixer_amp_switch_info,
12070
12070
-
.get = snd_hda_mixer_amp_switch_get,
12071
12071
-
.put = alc262_fujitsu_master_sw_put,
12072
12072
-
.private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11828
11828
+
.subdevice = HDA_SUBDEV_NID_FLAG | 0x14,
11829
11829
+
.info = snd_ctl_boolean_mono_info,
11830
11830
+
.get = alc262_hp_master_sw_get,
11831
11831
+
.put = alc262_hp_master_sw_put,
12073
11832
},
12074
11833
{
12075
11834
.iface = NID_MAPPING,
···
12024
11909
{ } /* end */
12025
11910
};
12026
11911
12027
12027
-
/* bind hp and internal speaker mute (with plug check) */
12028
12028
-
static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
12029
12029
-
struct snd_ctl_elem_value *ucontrol)
11912
11912
+
static void alc262_lenovo_3000_setup(struct hda_codec *codec)
12030
11913
{
12031
12031
-
struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
12032
12032
-
long *valp = ucontrol->value.integer.value;
12033
12033
-
int change;
11914
11914
+
struct alc_spec *spec = codec->spec;
12034
11915
12035
12035
-
change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
12036
12036
-
if (change)
12037
12037
-
alc262_lenovo_3000_automute(codec, 0);
12038
12038
-
return change;
11916
11916
+
spec->autocfg.hp_pins[0] = 0x1b;
11917
11917
+
spec->autocfg.speaker_pins[0] = 0x14;
11918
11918
+
spec->autocfg.speaker_pins[1] = 0x16;
11919
11919
+
spec->automute = 1;
11920
11920
+
spec->automute_mode = ALC_AUTOMUTE_AMP;
12039
11921
}
12040
11922
12041
12041
-
static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
11923
11923
+
static const struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
12042
11924
HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
12043
11925
{
12044
11926
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12045
11927
.name = "Master Playback Switch",
12046
12046
-
.subdevice = HDA_SUBDEV_AMP_FLAG,
12047
12047
-
.info = snd_hda_mixer_amp_switch_info,
12048
12048
-
.get = snd_hda_mixer_amp_switch_get,
12049
12049
-
.put = alc262_lenovo_3000_master_sw_put,
12050
12050
-
.private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
11928
11928
+
.subdevice = HDA_SUBDEV_NID_FLAG | 0x1b,
11929
11929
+
.info = snd_ctl_boolean_mono_info,
11930
11930
+
.get = alc262_hp_master_sw_get,
11931
11931
+
.put = alc262_hp_master_sw_put,
12051
11932
},
12052
11933
HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
12053
11934
HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
···
12056
11945
{ } /* end */
12057
11946
};
12058
11947
12059
12059
-
static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
11948
11948
+
static const struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
12060
11949
HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
12061
11950
ALC262_HIPPO_MASTER_SWITCH,
12062
11951
HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
···
12069
11958
};
12070
11959
12071
11960
/* additional init verbs for Benq laptops */
12072
12072
-
static struct hda_verb alc262_EAPD_verbs[] = {
11961
11961
+
static const struct hda_verb alc262_EAPD_verbs[] = {
12073
11962
{0x20, AC_VERB_SET_COEF_INDEX, 0x07},
12074
11963
{0x20, AC_VERB_SET_PROC_COEF, 0x3070},
12075
11964
{}
12076
11965
};
12077
11966
12078
12078
-
static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
11967
11967
+
static const struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
12079
11968
{0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12080
11969
{0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12081
11970
···
12085
11974
};
12086
11975
12087
11976
/* Samsung Q1 Ultra Vista model setup */
12088
12088
-
static struct snd_kcontrol_new alc262_ultra_mixer[] = {
11977
11977
+
static const struct snd_kcontrol_new alc262_ultra_mixer[] = {
12089
11978
HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
12090
11979
HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
12091
11980
HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
···
12095
11984
{ } /* end */
12096
11985
};
12097
11986
12098
12098
-
static struct hda_verb alc262_ultra_verbs[] = {
11987
11987
+
static const struct hda_verb alc262_ultra_verbs[] = {
12099
11988
/* output mixer */
12100
11989
{0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12101
11990
{0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
···
12158
12047
alc262_ultra_automute(codec);
12159
12048
}
12160
12049
12161
12161
-
static struct hda_input_mux alc262_ultra_capture_source = {
12050
12050
+
static const struct hda_input_mux alc262_ultra_capture_source = {
12162
12051
.num_items = 2,
12163
12052
.items = {
12164
12053
{ "Mic", 0x1 },
···
12184
12073
return ret;
12185
12074
}
12186
12075
12187
12187
-
static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
12076
12076
+
static const struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
12188
12077
HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
12189
12078
HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
12190
12079
{
···
12259
12148
12260
12149
spec->multiout.num_dacs = 1; /* only use one dac */
12261
12150
spec->multiout.dac_nids = spec->private_dac_nids;
12262
12262
-
spec->multiout.dac_nids[0] = 2;
12151
12151
+
spec->private_dac_nids[0] = 2;
12263
12152
12264
12264
-
pfx = alc_get_line_out_pfx(cfg, true);
12153
12153
+
pfx = alc_get_line_out_pfx(spec, true);
12265
12154
if (!pfx)
12266
12155
pfx = "Front";
12267
12156
for (i = 0; i < 2; i++) {
···
12315
12204
/*
12316
12205
* generic initialization of ADC, input mixers and output mixers
12317
12206
*/
12318
12318
-
static struct hda_verb alc262_volume_init_verbs[] = {
12207
12207
+
static const struct hda_verb alc262_volume_init_verbs[] = {
12319
12208
/*
12320
12209
* Unmute ADC0-2 and set the default input to mic-in
12321
12210
*/
···
12376
12265
{ }
12377
12266
};
12378
12267
12379
12379
-
static struct hda_verb alc262_HP_BPC_init_verbs[] = {
12268
12268
+
static const struct hda_verb alc262_HP_BPC_init_verbs[] = {
12380
12269
/*
12381
12270
* Unmute ADC0-2 and set the default input to mic-in
12382
12271
*/
···
12480
12369
{ }
12481
12370
};
12482
12371
12483
12483
-
static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
12372
12372
+
static const struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
12484
12373
/*
12485
12374
* Unmute ADC0-2 and set the default input to mic-in
12486
12375
*/
···
12576
12465
{ }
12577
12466
};
12578
12467
12579
12579
-
static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
12468
12468
+
static const struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
12580
12469
12581
12470
{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
12582
12471
{0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
···
12612
12501
},
12613
12502
};
12614
12503
12615
12615
-
static struct snd_pci_quirk alc262_fixup_tbl[] = {
12504
12504
+
static const struct snd_pci_quirk alc262_fixup_tbl[] = {
12616
12505
SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", PINFIX_FSC_H270),
12617
12506
{}
12618
12507
};
···
12635
12524
{
12636
12525
struct alc_spec *spec = codec->spec;
12637
12526
int err;
12638
12638
-
static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
12527
12527
+
static const hda_nid_t alc262_ignore[] = { 0x1d, 0 };
12639
12528
12640
12529
err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12641
12530
alc262_ignore);
···
12720
12609
[ALC262_AUTO] = "auto",
12721
12610
};
12722
12611
12723
12723
-
static struct snd_pci_quirk alc262_cfg_tbl[] = {
12612
12612
+
static const struct snd_pci_quirk alc262_cfg_tbl[] = {
12724
12613
SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
12725
12614
SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
12726
12615
SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
···
12772
12661
{}
12773
12662
};
12774
12663
12775
12775
-
static struct alc_config_preset alc262_presets[] = {
12664
12664
+
static const struct alc_config_preset alc262_presets[] = {
12776
12665
[ALC262_BASIC] = {
12777
12666
.mixers = { alc262_base_mixer },
12778
12667
.init_verbs = { alc262_init_verbs },
···
12793
12682
.num_channel_mode = ARRAY_SIZE(alc262_modes),
12794
12683
.channel_mode = alc262_modes,
12795
12684
.input_mux = &alc262_capture_source,
12796
12796
-
.unsol_event = alc262_hippo_unsol_event,
12685
12685
+
.unsol_event = alc_sku_unsol_event,
12797
12686
.setup = alc262_hippo_setup,
12798
12798
-
.init_hook = alc262_hippo_automute,
12687
12687
+
.init_hook = alc_inithook,
12799
12688
},
12800
12689
[ALC262_HIPPO_1] = {
12801
12690
.mixers = { alc262_hippo1_mixer },
···
12807
12696
.num_channel_mode = ARRAY_SIZE(alc262_modes),
12808
12697
.channel_mode = alc262_modes,
12809
12698
.input_mux = &alc262_capture_source,
12810
12810
-
.unsol_event = alc262_hippo_unsol_event,
12699
12699
+
.unsol_event = alc_sku_unsol_event,
12811
12700
.setup = alc262_hippo1_setup,
12812
12812
-
.init_hook = alc262_hippo_automute,
12701
12701
+
.init_hook = alc_inithook,
12813
12702
},
12814
12703
[ALC262_FUJITSU] = {
12815
12704
.mixers = { alc262_fujitsu_mixer },
···
12822
12711
.num_channel_mode = ARRAY_SIZE(alc262_modes),
12823
12712
.channel_mode = alc262_modes,
12824
12713
.input_mux = &alc262_fujitsu_capture_source,
12825
12825
-
.unsol_event = alc262_fujitsu_unsol_event,
12826
12826
-
.init_hook = alc262_fujitsu_init_hook,
12714
12714
+
.unsol_event = alc_sku_unsol_event,
12715
12715
+
.setup = alc262_fujitsu_setup,
12716
12716
+
.init_hook = alc_inithook,
12827
12717
},
12828
12718
[ALC262_HP_BPC] = {
12829
12719
.mixers = { alc262_HP_BPC_mixer },
···
12835
12723
.num_channel_mode = ARRAY_SIZE(alc262_modes),
12836
12724
.channel_mode = alc262_modes,
12837
12725
.input_mux = &alc262_HP_capture_source,
12838
12838
-
.unsol_event = alc262_hp_bpc_unsol_event,
12839
12839
-
.init_hook = alc262_hp_bpc_automute,
12726
12726
+
.unsol_event = alc_sku_unsol_event,
12727
12727
+
.setup = alc262_hp_bpc_setup,
12728
12728
+
.init_hook = alc_inithook,
12840
12729
},
12841
12730
[ALC262_HP_BPC_D7000_WF] = {
12842
12731
.mixers = { alc262_HP_BPC_WildWest_mixer },
···
12848
12735
.num_channel_mode = ARRAY_SIZE(alc262_modes),
12849
12736
.channel_mode = alc262_modes,
12850
12737
.input_mux = &alc262_HP_D7000_capture_source,
12851
12851
-
.unsol_event = alc262_hp_wildwest_unsol_event,
12852
12852
-
.init_hook = alc262_hp_wildwest_automute,
12738
12738
+
.unsol_event = alc_sku_unsol_event,
12739
12739
+
.setup = alc262_hp_wildwest_setup,
12740
12740
+
.init_hook = alc_inithook,
12853
12741
},
12854
12742
[ALC262_HP_BPC_D7000_WL] = {
12855
12743
.mixers = { alc262_HP_BPC_WildWest_mixer,
···
12862
12748
.num_channel_mode = ARRAY_SIZE(alc262_modes),
12863
12749
.channel_mode = alc262_modes,
12864
12750
.input_mux = &alc262_HP_D7000_capture_source,
12865
12865
-
.unsol_event = alc262_hp_wildwest_unsol_event,
12866
12866
-
.init_hook = alc262_hp_wildwest_automute,
12751
12751
+
.unsol_event = alc_sku_unsol_event,
12752
12752
+
.setup = alc262_hp_wildwest_setup,
12753
12753
+
.init_hook = alc_inithook,
12867
12754
},
12868
12755
[ALC262_HP_TC_T5735] = {
12869
12756
.mixers = { alc262_hp_t5735_mixer },
···
12907
12792
.num_channel_mode = ARRAY_SIZE(alc262_modes),
12908
12793
.channel_mode = alc262_modes,
12909
12794
.input_mux = &alc262_capture_source,
12910
12910
-
.unsol_event = alc262_hippo_unsol_event,
12795
12795
+
.unsol_event = alc_sku_unsol_event,
12911
12796
.setup = alc262_hippo_setup,
12912
12912
-
.init_hook = alc262_hippo_automute,
12797
12797
+
.init_hook = alc_inithook,
12913
12798
},
12914
12799
[ALC262_BENQ_T31] = {
12915
12800
.mixers = { alc262_benq_t31_mixer },
···
12921
12806
.num_channel_mode = ARRAY_SIZE(alc262_modes),
12922
12807
.channel_mode = alc262_modes,
12923
12808
.input_mux = &alc262_capture_source,
12924
12924
-
.unsol_event = alc262_hippo_unsol_event,
12809
12809
+
.unsol_event = alc_sku_unsol_event,
12925
12810
.setup = alc262_hippo_setup,
12926
12926
-
.init_hook = alc262_hippo_automute,
12811
12811
+
.init_hook = alc_inithook,
12927
12812
},
12928
12813
[ALC262_ULTRA] = {
12929
12814
.mixers = { alc262_ultra_mixer },
···
12952
12837
.num_channel_mode = ARRAY_SIZE(alc262_modes),
12953
12838
.channel_mode = alc262_modes,
12954
12839
.input_mux = &alc262_fujitsu_capture_source,
12955
12955
-
.unsol_event = alc262_lenovo_3000_unsol_event,
12840
12840
+
.unsol_event = alc_sku_unsol_event,
12841
12841
+
.setup = alc262_lenovo_3000_setup,
12842
12842
+
.init_hook = alc_inithook,
12956
12843
},
12957
12844
[ALC262_NEC] = {
12958
12845
.mixers = { alc262_nec_mixer },
···
12991
12874
.num_channel_mode = ARRAY_SIZE(alc262_modes),
12992
12875
.channel_mode = alc262_modes,
12993
12876
.input_mux = &alc262_capture_source,
12994
12994
-
.unsol_event = alc262_hippo_unsol_event,
12877
12877
+
.unsol_event = alc_sku_unsol_event,
12995
12878
.setup = alc262_hippo_setup,
12996
12996
-
.init_hook = alc262_hippo_automute,
12879
12879
+
.init_hook = alc_inithook,
12997
12880
},
12998
12881
[ALC262_TYAN] = {
12999
12882
.mixers = { alc262_tyan_mixer },
···
13005
12888
.num_channel_mode = ARRAY_SIZE(alc262_modes),
13006
12889
.channel_mode = alc262_modes,
13007
12890
.input_mux = &alc262_capture_source,
13008
13008
-
.unsol_event = alc_automute_amp_unsol_event,
12891
12891
+
.unsol_event = alc_sku_unsol_event,
13009
12892
.setup = alc262_tyan_setup,
13010
13010
-
.init_hook = alc_automute_amp,
12893
12893
+
.init_hook = alc_hp_automute,
13011
12894
},
13012
12895
};
13013
12896
···
13128
13011
codec->patch_ops = alc_patch_ops;
13129
13012
if (board_config == ALC262_AUTO)
13130
13013
spec->init_hook = alc262_auto_init;
13014
13014
+
spec->shutup = alc_eapd_shutup;
13131
13015
13132
13016
alc_init_jacks(codec);
13133
13017
#ifdef CONFIG_SND_HDA_POWER_SAVE
···
13145
13027
#define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
13146
13028
#define alc268_modes alc260_modes
13147
13029
13148
13148
-
static hda_nid_t alc268_dac_nids[2] = {
13030
13030
+
static const hda_nid_t alc268_dac_nids[2] = {
13149
13031
/* front, hp */
13150
13032
0x02, 0x03
13151
13033
};
13152
13034
13153
13153
-
static hda_nid_t alc268_adc_nids[2] = {
13035
13035
+
static const hda_nid_t alc268_adc_nids[2] = {
13154
13036
/* ADC0-1 */
13155
13037
0x08, 0x07
13156
13038
};
13157
13039
13158
13158
-
static hda_nid_t alc268_adc_nids_alt[1] = {
13040
13040
+
static const hda_nid_t alc268_adc_nids_alt[1] = {
13159
13041
/* ADC0 */
13160
13042
0x08
13161
13043
};
13162
13044
13163
13163
-
static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
13045
13045
+
static const hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
13164
13046
13165
13165
-
static struct snd_kcontrol_new alc268_base_mixer[] = {
13047
13047
+
static const struct snd_kcontrol_new alc268_base_mixer[] = {
13166
13048
/* output mixer control */
13167
13049
HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
13168
13050
HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
···
13174
13056
{ }
13175
13057
};
13176
13058
13177
13177
-
static struct snd_kcontrol_new alc268_toshiba_mixer[] = {
13059
13059
+
static const struct snd_kcontrol_new alc268_toshiba_mixer[] = {
13178
13060
/* output mixer control */
13179
13061
HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
13180
13062
HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
···
13186
13068
};
13187
13069
13188
13070
/* bind Beep switches of both NID 0x0f and 0x10 */
13189
13189
-
static struct hda_bind_ctls alc268_bind_beep_sw = {
13071
13071
+
static const struct hda_bind_ctls alc268_bind_beep_sw = {
13190
13072
.ops = &snd_hda_bind_sw,
13191
13073
.values = {
13192
13074
HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
···
13195
13077
},
13196
13078
};
13197
13079
13198
13198
-
static struct snd_kcontrol_new alc268_beep_mixer[] = {
13080
13080
+
static const struct snd_kcontrol_new alc268_beep_mixer[] = {
13199
13081
HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
13200
13082
HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
13201
13083
{ }
13202
13084
};
13203
13085
13204
13204
-
static struct hda_verb alc268_eapd_verbs[] = {
13086
13086
+
static const struct hda_verb alc268_eapd_verbs[] = {
13205
13087
{0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13206
13088
{0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
13207
13089
{ }
13208
13090
};
13209
13091
13210
13092
/* Toshiba specific */
13211
13211
-
static struct hda_verb alc268_toshiba_verbs[] = {
13093
13093
+
static const struct hda_verb alc268_toshiba_verbs[] = {
13212
13094
{0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13213
13095
{ } /* end */
13214
13096
};
13215
13097
13216
13098
/* Acer specific */
13217
13099
/* bind volumes of both NID 0x02 and 0x03 */
13218
13218
-
static struct hda_bind_ctls alc268_acer_bind_master_vol = {
13100
13100
+
static const struct hda_bind_ctls alc268_acer_bind_master_vol = {
13219
13101
.ops = &snd_hda_bind_vol,
13220
13102
.values = {
13221
13103
HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
···
13224
13106
},
13225
13107
};
13226
13108
13227
13227
-
/* mute/unmute internal speaker according to the hp jack and mute state */
13228
13228
-
static void alc268_acer_automute(struct hda_codec *codec, int force)
13109
13109
+
static void alc268_acer_setup(struct hda_codec *codec)
13229
13110
{
13230
13111
struct alc_spec *spec = codec->spec;
13231
13231
-
unsigned int mute;
13232
13112
13233
13233
-
if (force || !spec->sense_updated) {
13234
13234
-
spec->jack_present = snd_hda_jack_detect(codec, 0x14);
13235
13235
-
spec->sense_updated = 1;
13236
13236
-
}
13237
13237
-
if (spec->jack_present)
13238
13238
-
mute = HDA_AMP_MUTE; /* mute internal speaker */
13239
13239
-
else /* unmute internal speaker if necessary */
13240
13240
-
mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
13241
13241
-
snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
13242
13242
-
HDA_AMP_MUTE, mute);
13113
13113
+
spec->autocfg.hp_pins[0] = 0x14;
13114
13114
+
spec->autocfg.speaker_pins[0] = 0x15;
13115
13115
+
spec->automute = 1;
13116
13116
+
spec->automute_mode = ALC_AUTOMUTE_AMP;
13243
13117
}
13244
13118
13119
13119
+
#define alc268_acer_master_sw_get alc262_hp_master_sw_get
13120
13120
+
#define alc268_acer_master_sw_put alc262_hp_master_sw_put
13245
13121
13246
13246
-
/* bind hp and internal speaker mute (with plug check) */
13247
13247
-
static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
13248
13248
-
struct snd_ctl_elem_value *ucontrol)
13249
13249
-
{
13250
13250
-
struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
13251
13251
-
long *valp = ucontrol->value.integer.value;
13252
13252
-
int change;
13253
13253
-
13254
13254
-
change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
13255
13255
-
if (change)
13256
13256
-
alc268_acer_automute(codec, 0);
13257
13257
-
return change;
13258
13258
-
}
13259
13259
-
13260
13260
-
static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
13122
13122
+
static const struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
13261
13123
/* output mixer control */
13262
13124
HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13263
13125
{
13264
13126
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13265
13127
.name = "Master Playback Switch",
13266
13266
-
.subdevice = HDA_SUBDEV_AMP_FLAG,
13267
13267
-
.info = snd_hda_mixer_amp_switch_info,
13268
13268
-
.get = snd_hda_mixer_amp_switch_get,
13128
13128
+
.subdevice = HDA_SUBDEV_NID_FLAG | 0x15,
13129
13129
+
.info = snd_ctl_boolean_mono_info,
13130
13130
+
.get = alc268_acer_master_sw_get,
13269
13131
.put = alc268_acer_master_sw_put,
13270
13270
-
.private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13271
13132
},
13272
13133
HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
13273
13134
{ }
13274
13135
};
13275
13136
13276
13276
-
static struct snd_kcontrol_new alc268_acer_mixer[] = {
13137
13137
+
static const struct snd_kcontrol_new alc268_acer_mixer[] = {
13277
13138
/* output mixer control */
13278
13139
HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13279
13140
{
13280
13141
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13281
13142
.name = "Master Playback Switch",
13282
13282
-
.subdevice = HDA_SUBDEV_AMP_FLAG,
13283
13283
-
.info = snd_hda_mixer_amp_switch_info,
13284
13284
-
.get = snd_hda_mixer_amp_switch_get,
13143
13143
+
.subdevice = HDA_SUBDEV_NID_FLAG | 0x14,
13144
13144
+
.info = snd_ctl_boolean_mono_info,
13145
13145
+
.get = alc268_acer_master_sw_get,
13285
13146
.put = alc268_acer_master_sw_put,
13286
13286
-
.private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13287
13147
},
13288
13148
HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13289
13149
HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
···
13269
13173
{ }
13270
13174
};
13271
13175
13272
13272
-
static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
13176
13176
+
static const struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
13273
13177
/* output mixer control */
13274
13178
HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13275
13179
{
13276
13180
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13277
13181
.name = "Master Playback Switch",
13278
13278
-
.subdevice = HDA_SUBDEV_AMP_FLAG,
13279
13279
-
.info = snd_hda_mixer_amp_switch_info,
13280
13280
-
.get = snd_hda_mixer_amp_switch_get,
13182
13182
+
.subdevice = HDA_SUBDEV_NID_FLAG | 0x14,
13183
13183
+
.info = snd_ctl_boolean_mono_info,
13184
13184
+
.get = alc268_acer_master_sw_get,
13281
13185
.put = alc268_acer_master_sw_put,
13282
13282
-
.private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13283
13186
},
13284
13187
HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13285
13188
HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT),
13286
13189
{ }
13287
13190
};
13288
13191
13289
13289
-
static struct hda_verb alc268_acer_aspire_one_verbs[] = {
13192
13192
+
static const struct hda_verb alc268_acer_aspire_one_verbs[] = {
13290
13193
{0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13291
13194
{0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13292
13195
{0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
···
13295
13200
{ }
13296
13201
};
13297
13202
13298
13298
-
static struct hda_verb alc268_acer_verbs[] = {
13203
13203
+
static const struct hda_verb alc268_acer_verbs[] = {
13299
13204
{0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
13300
13205
{0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13301
13206
{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
···
13307
13212
};
13308
13213
13309
13214
/* unsolicited event for HP jack sensing */
13310
13310
-
#define alc268_toshiba_unsol_event alc262_hippo_unsol_event
13311
13215
#define alc268_toshiba_setup alc262_hippo_setup
13312
13312
-
#define alc268_toshiba_automute alc262_hippo_automute
13313
13313
-
13314
13314
-
static void alc268_acer_unsol_event(struct hda_codec *codec,
13315
13315
-
unsigned int res)
13316
13316
-
{
13317
13317
-
if ((res >> 26) != ALC880_HP_EVENT)
13318
13318
-
return;
13319
13319
-
alc268_acer_automute(codec, 1);
13320
13320
-
}
13321
13321
-
13322
13322
-
static void alc268_acer_init_hook(struct hda_codec *codec)
13323
13323
-
{
13324
13324
-
alc268_acer_automute(codec, 1);
13325
13325
-
}
13326
13326
-
13327
13327
-
/* toggle speaker-output according to the hp-jack state */
13328
13328
-
static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
13329
13329
-
{
13330
13330
-
unsigned int present;
13331
13331
-
unsigned char bits;
13332
13332
-
13333
13333
-
present = snd_hda_jack_detect(codec, 0x15);
13334
13334
-
bits = present ? HDA_AMP_MUTE : 0;
13335
13335
-
snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
13336
13336
-
HDA_AMP_MUTE, bits);
13337
13337
-
snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
13338
13338
-
HDA_AMP_MUTE, bits);
13339
13339
-
}
13340
13340
-
13341
13341
-
static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
13342
13342
-
unsigned int res)
13343
13343
-
{
13344
13344
-
switch (res >> 26) {
13345
13345
-
case ALC880_HP_EVENT:
13346
13346
-
alc268_aspire_one_speaker_automute(codec);
13347
13347
-
break;
13348
13348
-
case ALC880_MIC_EVENT:
13349
13349
-
alc_mic_automute(codec);
13350
13350
-
break;
13351
13351
-
}
13352
13352
-
}
13353
13216
13354
13217
static void alc268_acer_lc_setup(struct hda_codec *codec)
13355
13218
{
13356
13219
struct alc_spec *spec = codec->spec;
13220
13220
+
spec->autocfg.hp_pins[0] = 0x15;
13221
13221
+
spec->autocfg.speaker_pins[0] = 0x14;
13222
13222
+
spec->automute_mixer_nid[0] = 0x0f;
13223
13223
+
spec->automute = 1;
13224
13224
+
spec->automute_mode = ALC_AUTOMUTE_MIXER;
13357
13225
spec->ext_mic.pin = 0x18;
13358
13226
spec->ext_mic.mux_idx = 0;
13359
13227
spec->int_mic.pin = 0x12;
···
13324
13266
spec->auto_mic = 1;
13325
13267
}
13326
13268
13327
13327
-
static void alc268_acer_lc_init_hook(struct hda_codec *codec)
13328
13328
-
{
13329
13329
-
alc268_aspire_one_speaker_automute(codec);
13330
13330
-
alc_mic_automute(codec);
13331
13331
-
}
13332
13332
-
13333
13333
-
static struct snd_kcontrol_new alc268_dell_mixer[] = {
13269
13269
+
static const struct snd_kcontrol_new alc268_dell_mixer[] = {
13334
13270
/* output mixer control */
13335
13271
HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13336
13272
HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
···
13335
13283
{ }
13336
13284
};
13337
13285
13338
13338
-
static struct hda_verb alc268_dell_verbs[] = {
13286
13286
+
static const struct hda_verb alc268_dell_verbs[] = {
13339
13287
{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13340
13288
{0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13341
13289
{0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
···
13355
13303
spec->int_mic.pin = 0x19;
13356
13304
spec->int_mic.mux_idx = 1;
13357
13305
spec->auto_mic = 1;
13306
13306
+
spec->automute = 1;
13307
13307
+
spec->automute_mode = ALC_AUTOMUTE_PIN;
13358
13308
}
13359
13309
13360
13360
-
static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
13310
13310
+
static const struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
13361
13311
HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
13362
13312
HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13363
13313
HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
···
13371
13317
{ }
13372
13318
};
13373
13319
13374
13374
-
static struct hda_verb alc267_quanta_il1_verbs[] = {
13320
13320
+
static const struct hda_verb alc267_quanta_il1_verbs[] = {
13375
13321
{0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13376
13322
{0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
13377
13323
{ }
···
13387
13333
spec->int_mic.pin = 0x19;
13388
13334
spec->int_mic.mux_idx = 1;
13389
13335
spec->auto_mic = 1;
13336
13336
+
spec->automute = 1;
13337
13337
+
spec->automute_mode = ALC_AUTOMUTE_PIN;
13390
13338
}
13391
13339
13392
13340
/*
13393
13341
* generic initialization of ADC, input mixers and output mixers
13394
13342
*/
13395
13395
-
static struct hda_verb alc268_base_init_verbs[] = {
13343
13343
+
static const struct hda_verb alc268_base_init_verbs[] = {
13396
13344
/* Unmute DAC0-1 and set vol = 0 */
13397
13345
{0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13398
13346
{0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
···
13442
13386
/*
13443
13387
* generic initialization of ADC, input mixers and output mixers
13444
13388
*/
13445
13445
-
static struct hda_verb alc268_volume_init_verbs[] = {
13389
13389
+
static const struct hda_verb alc268_volume_init_verbs[] = {
13446
13390
/* set output DAC */
13447
13391
{0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13448
13392
{0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
···
13468
13412
{ }
13469
13413
};
13470
13414
13471
13471
-
static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = {
13415
13415
+
static const struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = {
13472
13416
HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13473
13417
HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
13474
13418
{ } /* end */
13475
13419
};
13476
13420
13477
13477
-
static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
13421
13421
+
static const struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
13478
13422
HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13479
13423
HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
13480
13424
_DEFINE_CAPSRC(1),
13481
13425
{ } /* end */
13482
13426
};
13483
13427
13484
13484
-
static struct snd_kcontrol_new alc268_capture_mixer[] = {
13428
13428
+
static const struct snd_kcontrol_new alc268_capture_mixer[] = {
13485
13429
HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13486
13430
HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
13487
13431
HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
···
13490
13434
{ } /* end */
13491
13435
};
13492
13436
13493
13493
-
static struct hda_input_mux alc268_capture_source = {
13437
13437
+
static const struct hda_input_mux alc268_capture_source = {
13494
13438
.num_items = 4,
13495
13439
.items = {
13496
13440
{ "Mic", 0x0 },
···
13500
13444
},
13501
13445
};
13502
13446
13503
13503
-
static struct hda_input_mux alc268_acer_capture_source = {
13447
13447
+
static const struct hda_input_mux alc268_acer_capture_source = {
13504
13448
.num_items = 3,
13505
13449
.items = {
13506
13450
{ "Mic", 0x0 },
···
13509
13453
},
13510
13454
};
13511
13455
13512
13512
-
static struct hda_input_mux alc268_acer_dmic_capture_source = {
13456
13456
+
static const struct hda_input_mux alc268_acer_dmic_capture_source = {
13513
13457
.num_items = 3,
13514
13458
.items = {
13515
13459
{ "Mic", 0x0 },
···
13519
13463
};
13520
13464
13521
13465
#ifdef CONFIG_SND_DEBUG
13522
13522
-
static struct snd_kcontrol_new alc268_test_mixer[] = {
13466
13466
+
static const struct snd_kcontrol_new alc268_test_mixer[] = {
13523
13467
/* Volume widgets */
13524
13468
HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13525
13469
HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
···
13598
13542
HDA_OUTPUT));
13599
13543
if (err < 0)
13600
13544
return err;
13601
13601
-
spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
13545
13545
+
spec->private_dac_nids[spec->multiout.num_dacs++] = dac;
13602
13546
}
13603
13547
13604
13548
if (nid != 0x16)
···
13771
13715
{
13772
13716
struct alc_spec *spec = codec->spec;
13773
13717
int err;
13774
13774
-
static hda_nid_t alc268_ignore[] = { 0 };
13718
13718
+
static const hda_nid_t alc268_ignore[] = { 0 };
13775
13719
13776
13720
err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13777
13721
alc268_ignore);
···
13851
13795
[ALC268_AUTO] = "auto",
13852
13796
};
13853
13797
13854
13854
-
static struct snd_pci_quirk alc268_cfg_tbl[] = {
13798
13798
+
static const struct snd_pci_quirk alc268_cfg_tbl[] = {
13855
13799
SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
13856
13800
SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
13857
13801
SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
···
13876
13820
};
13877
13821
13878
13822
/* Toshiba laptops have no unique PCI SSID but only codec SSID */
13879
13879
-
static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = {
13823
13823
+
static const struct snd_pci_quirk alc268_ssid_cfg_tbl[] = {
13880
13824
SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO),
13881
13825
SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO),
13882
13826
SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
···
13884
13828
{}
13885
13829
};
13886
13830
13887
13887
-
static struct alc_config_preset alc268_presets[] = {
13831
13831
+
static const struct alc_config_preset alc268_presets[] = {
13888
13832
[ALC267_QUANTA_IL1] = {
13889
13833
.mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer,
13890
13834
alc268_capture_nosrc_mixer },
···
13930
13874
.num_channel_mode = ARRAY_SIZE(alc268_modes),
13931
13875
.channel_mode = alc268_modes,
13932
13876
.input_mux = &alc268_capture_source,
13933
13933
-
.unsol_event = alc268_toshiba_unsol_event,
13877
13877
+
.unsol_event = alc_sku_unsol_event,
13934
13878
.setup = alc268_toshiba_setup,
13935
13935
-
.init_hook = alc268_toshiba_automute,
13879
13879
+
.init_hook = alc_inithook,
13936
13880
},
13937
13881
[ALC268_ACER] = {
13938
13882
.mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
···
13948
13892
.num_channel_mode = ARRAY_SIZE(alc268_modes),
13949
13893
.channel_mode = alc268_modes,
13950
13894
.input_mux = &alc268_acer_capture_source,
13951
13951
-
.unsol_event = alc268_acer_unsol_event,
13952
13952
-
.init_hook = alc268_acer_init_hook,
13895
13895
+
.unsol_event = alc_sku_unsol_event,
13896
13896
+
.setup = alc268_acer_setup,
13897
13897
+
.init_hook = alc_inithook,
13953
13898
},
13954
13899
[ALC268_ACER_DMIC] = {
13955
13900
.mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
···
13966
13909
.num_channel_mode = ARRAY_SIZE(alc268_modes),
13967
13910
.channel_mode = alc268_modes,
13968
13911
.input_mux = &alc268_acer_dmic_capture_source,
13969
13969
-
.unsol_event = alc268_acer_unsol_event,
13970
13970
-
.init_hook = alc268_acer_init_hook,
13912
13912
+
.unsol_event = alc_sku_unsol_event,
13913
13913
+
.setup = alc268_acer_setup,
13914
13914
+
.init_hook = alc_inithook,
13971
13915
},
13972
13916
[ALC268_ACER_ASPIRE_ONE] = {
13973
13917
.mixers = { alc268_acer_aspire_one_mixer,
···
13984
13926
.hp_nid = 0x03,
13985
13927
.num_channel_mode = ARRAY_SIZE(alc268_modes),
13986
13928
.channel_mode = alc268_modes,
13987
13987
-
.unsol_event = alc268_acer_lc_unsol_event,
13929
13929
+
.unsol_event = alc_sku_unsol_event,
13988
13930
.setup = alc268_acer_lc_setup,
13989
13989
-
.init_hook = alc268_acer_lc_init_hook,
13931
13931
+
.init_hook = alc_inithook,
13990
13932
},
13991
13933
[ALC268_DELL] = {
13992
13934
.mixers = { alc268_dell_mixer, alc268_beep_mixer,
···
14020
13962
.num_channel_mode = ARRAY_SIZE(alc268_modes),
14021
13963
.channel_mode = alc268_modes,
14022
13964
.input_mux = &alc268_capture_source,
13965
13965
+
.unsol_event = alc_sku_unsol_event,
14023
13966
.setup = alc268_toshiba_setup,
14024
14024
-
.init_hook = alc268_toshiba_automute,
13967
13967
+
.init_hook = alc_inithook,
14025
13968
},
14026
13969
#ifdef CONFIG_SND_DEBUG
14027
13970
[ALC268_TEST] = {
···
14144
14085
codec->patch_ops = alc_patch_ops;
14145
14086
if (board_config == ALC268_AUTO)
14146
14087
spec->init_hook = alc268_auto_init;
14088
14088
+
spec->shutup = alc_eapd_shutup;
14147
14089
14148
14090
alc_init_jacks(codec);
14149
14091
···
14158
14098
14159
14099
#define alc269_dac_nids alc260_dac_nids
14160
14100
14161
14161
-
static hda_nid_t alc269_adc_nids[1] = {
14101
14101
+
static const hda_nid_t alc269_adc_nids[1] = {
14162
14102
/* ADC1 */
14163
14103
0x08,
14164
14104
};
14165
14105
14166
14166
-
static hda_nid_t alc269_capsrc_nids[1] = {
14106
14106
+
static const hda_nid_t alc269_capsrc_nids[1] = {
14167
14107
0x23,
14168
14108
};
14169
14109
14170
14170
-
static hda_nid_t alc269vb_adc_nids[1] = {
14110
14110
+
static const hda_nid_t alc269vb_adc_nids[1] = {
14171
14111
/* ADC1 */
14172
14112
0x09,
14173
14113
};
14174
14114
14175
14175
-
static hda_nid_t alc269vb_capsrc_nids[1] = {
14115
14115
+
static const hda_nid_t alc269vb_capsrc_nids[1] = {
14176
14116
0x22,
14177
14117
};
14178
14118
14179
14179
-
static hda_nid_t alc269_adc_candidates[] = {
14119
14119
+
static const hda_nid_t alc269_adc_candidates[] = {
14180
14120
0x08, 0x09, 0x07, 0x11,
14181
14121
};
14182
14122
14183
14123
#define alc269_modes alc260_modes
14184
14124
#define alc269_capture_source alc880_lg_lw_capture_source
14185
14125
14186
14186
-
static struct snd_kcontrol_new alc269_base_mixer[] = {
14126
14126
+
static const struct snd_kcontrol_new alc269_base_mixer[] = {
14187
14127
HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14188
14128
HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14189
14129
HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
···
14199
14139
{ } /* end */
14200
14140
};
14201
14141
14202
14202
-
static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
14142
14142
+
static const struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
14203
14143
/* output mixer control */
14204
14144
HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
14205
14145
{
···
14220
14160
{ }
14221
14161
};
14222
14162
14223
14223
-
static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
14163
14163
+
static const struct snd_kcontrol_new alc269_lifebook_mixer[] = {
14224
14164
/* output mixer control */
14225
14165
HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
14226
14166
{
···
14244
14184
{ }
14245
14185
};
14246
14186
14247
14247
-
static struct snd_kcontrol_new alc269_laptop_mixer[] = {
14187
14187
+
static const struct snd_kcontrol_new alc269_laptop_mixer[] = {
14248
14188
HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14249
14189
HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14250
14190
HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
···
14252
14192
{ } /* end */
14253
14193
};
14254
14194
14255
14255
-
static struct snd_kcontrol_new alc269vb_laptop_mixer[] = {
14195
14195
+
static const struct snd_kcontrol_new alc269vb_laptop_mixer[] = {
14256
14196
HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14257
14197
HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14258
14198
HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
···
14260
14200
{ } /* end */
14261
14201
};
14262
14202
14263
14263
-
static struct snd_kcontrol_new alc269_asus_mixer[] = {
14203
14203
+
static const struct snd_kcontrol_new alc269_asus_mixer[] = {
14264
14204
HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14265
14205
HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x0, HDA_INPUT),
14266
14206
{ } /* end */
14267
14207
};
14268
14208
14269
14209
/* capture mixer elements */
14270
14270
-
static struct snd_kcontrol_new alc269_laptop_analog_capture_mixer[] = {
14210
14210
+
static const struct snd_kcontrol_new alc269_laptop_analog_capture_mixer[] = {
14271
14211
HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
14272
14212
HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
14273
14213
HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
···
14275
14215
{ } /* end */
14276
14216
};
14277
14217
14278
14278
-
static struct snd_kcontrol_new alc269_laptop_digital_capture_mixer[] = {
14218
14218
+
static const struct snd_kcontrol_new alc269_laptop_digital_capture_mixer[] = {
14279
14219
HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
14280
14220
HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
14281
14221
HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
14282
14222
{ } /* end */
14283
14223
};
14284
14224
14285
14285
-
static struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer[] = {
14225
14225
+
static const struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer[] = {
14286
14226
HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
14287
14227
HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
14288
14228
HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
···
14290
14230
{ } /* end */
14291
14231
};
14292
14232
14293
14293
-
static struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer[] = {
14233
14233
+
static const struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer[] = {
14294
14234
HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
14295
14235
HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
14296
14236
HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
···
14300
14240
/* FSC amilo */
14301
14241
#define alc269_fujitsu_mixer alc269_laptop_mixer
14302
14242
14303
14303
-
static struct hda_verb alc269_quanta_fl1_verbs[] = {
14243
14243
+
static const struct hda_verb alc269_quanta_fl1_verbs[] = {
14304
14244
{0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14305
14245
{0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14306
14246
{0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
···
14310
14250
{ }
14311
14251
};
14312
14252
14313
14313
-
static struct hda_verb alc269_lifebook_verbs[] = {
14253
14253
+
static const struct hda_verb alc269_lifebook_verbs[] = {
14314
14254
{0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14315
14255
{0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
14316
14256
{0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
···
14327
14267
/* toggle speaker-output according to the hp-jack state */
14328
14268
static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
14329
14269
{
14330
14330
-
unsigned int present;
14331
14331
-
unsigned char bits;
14332
14332
-
14333
14333
-
present = snd_hda_jack_detect(codec, 0x15);
14334
14334
-
bits = present ? HDA_AMP_MUTE : 0;
14335
14335
-
snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
14336
14336
-
HDA_AMP_MUTE, bits);
14337
14337
-
snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
14338
14338
-
HDA_AMP_MUTE, bits);
14270
14270
+
alc_hp_automute(codec);
14339
14271
14340
14272
snd_hda_codec_write(codec, 0x20, 0,
14341
14273
AC_VERB_SET_COEF_INDEX, 0x0c);
···
14340
14288
AC_VERB_SET_PROC_COEF, 0x480);
14341
14289
}
14342
14290
14343
14343
-
/* toggle speaker-output according to the hp-jacks state */
14344
14344
-
static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
14345
14345
-
{
14346
14346
-
unsigned int present;
14347
14347
-
unsigned char bits;
14348
14348
-
14349
14349
-
/* Check laptop headphone socket */
14350
14350
-
present = snd_hda_jack_detect(codec, 0x15);
14351
14351
-
14352
14352
-
/* Check port replicator headphone socket */
14353
14353
-
present |= snd_hda_jack_detect(codec, 0x1a);
14354
14354
-
14355
14355
-
bits = present ? HDA_AMP_MUTE : 0;
14356
14356
-
snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
14357
14357
-
HDA_AMP_MUTE, bits);
14358
14358
-
snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
14359
14359
-
HDA_AMP_MUTE, bits);
14360
14360
-
14361
14361
-
snd_hda_codec_write(codec, 0x20, 0,
14362
14362
-
AC_VERB_SET_COEF_INDEX, 0x0c);
14363
14363
-
snd_hda_codec_write(codec, 0x20, 0,
14364
14364
-
AC_VERB_SET_PROC_COEF, 0x680);
14365
14365
-
14366
14366
-
snd_hda_codec_write(codec, 0x20, 0,
14367
14367
-
AC_VERB_SET_COEF_INDEX, 0x0c);
14368
14368
-
snd_hda_codec_write(codec, 0x20, 0,
14369
14369
-
AC_VERB_SET_PROC_COEF, 0x480);
14370
14370
-
}
14291
14291
+
#define alc269_lifebook_speaker_automute \
14292
14292
+
alc269_quanta_fl1_speaker_automute
14371
14293
14372
14294
static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
14373
14295
{
···
14390
14364
struct alc_spec *spec = codec->spec;
14391
14365
spec->autocfg.hp_pins[0] = 0x15;
14392
14366
spec->autocfg.speaker_pins[0] = 0x14;
14367
14367
+
spec->automute_mixer_nid[0] = 0x0c;
14368
14368
+
spec->automute = 1;
14369
14369
+
spec->automute_mode = ALC_AUTOMUTE_MIXER;
14393
14370
spec->ext_mic.pin = 0x18;
14394
14371
spec->ext_mic.mux_idx = 0;
14395
14372
spec->int_mic.pin = 0x19;
···
14406
14377
alc_mic_automute(codec);
14407
14378
}
14408
14379
14380
14380
+
static void alc269_lifebook_setup(struct hda_codec *codec)
14381
14381
+
{
14382
14382
+
struct alc_spec *spec = codec->spec;
14383
14383
+
spec->autocfg.hp_pins[0] = 0x15;
14384
14384
+
spec->autocfg.hp_pins[1] = 0x1a;
14385
14385
+
spec->autocfg.speaker_pins[0] = 0x14;
14386
14386
+
spec->automute_mixer_nid[0] = 0x0c;
14387
14387
+
spec->automute = 1;
14388
14388
+
spec->automute_mode = ALC_AUTOMUTE_MIXER;
14389
14389
+
}
14390
14390
+
14409
14391
static void alc269_lifebook_init_hook(struct hda_codec *codec)
14410
14392
{
14411
14393
alc269_lifebook_speaker_automute(codec);
14412
14394
alc269_lifebook_mic_autoswitch(codec);
14413
14395
}
14414
14396
14415
14415
-
static struct hda_verb alc269_laptop_dmic_init_verbs[] = {
14397
14397
+
static const struct hda_verb alc269_laptop_dmic_init_verbs[] = {
14416
14398
{0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14417
14399
{0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
14418
14400
{0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
···
14434
14394
{}
14435
14395
};
14436
14396
14437
14437
-
static struct hda_verb alc269_laptop_amic_init_verbs[] = {
14397
14397
+
static const struct hda_verb alc269_laptop_amic_init_verbs[] = {
14438
14398
{0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14439
14399
{0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
14440
14400
{0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
···
14444
14404
{}
14445
14405
};
14446
14406
14447
14447
-
static struct hda_verb alc269vb_laptop_dmic_init_verbs[] = {
14407
14407
+
static const struct hda_verb alc269vb_laptop_dmic_init_verbs[] = {
14448
14408
{0x21, AC_VERB_SET_CONNECT_SEL, 0x01},
14449
14409
{0x22, AC_VERB_SET_CONNECT_SEL, 0x06},
14450
14410
{0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
···
14455
14415
{}
14456
14416
};
14457
14417
14458
14458
-
static struct hda_verb alc269vb_laptop_amic_init_verbs[] = {
14418
14418
+
static const struct hda_verb alc269vb_laptop_amic_init_verbs[] = {
14459
14419
{0x21, AC_VERB_SET_CONNECT_SEL, 0x01},
14460
14420
{0x22, AC_VERB_SET_CONNECT_SEL, 0x01},
14461
14421
{0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
···
14466
14426
{}
14467
14427
};
14468
14428
14469
14469
-
static struct hda_verb alc271_acer_dmic_verbs[] = {
14429
14429
+
static const struct hda_verb alc271_acer_dmic_verbs[] = {
14470
14430
{0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
14471
14431
{0x20, AC_VERB_SET_PROC_COEF, 0x4000},
14472
14432
{0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
···
14480
14440
{ }
14481
14441
};
14482
14442
14483
14483
-
/* toggle speaker-output according to the hp-jack state */
14484
14484
-
static void alc269_speaker_automute(struct hda_codec *codec)
14485
14485
-
{
14486
14486
-
struct alc_spec *spec = codec->spec;
14487
14487
-
unsigned int nid = spec->autocfg.hp_pins[0];
14488
14488
-
unsigned int present;
14489
14489
-
unsigned char bits;
14490
14490
-
14491
14491
-
present = snd_hda_jack_detect(codec, nid);
14492
14492
-
bits = present ? HDA_AMP_MUTE : 0;
14493
14493
-
snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
14494
14494
-
HDA_AMP_MUTE, bits);
14495
14495
-
snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
14496
14496
-
HDA_AMP_MUTE, bits);
14497
14497
-
snd_hda_input_jack_report(codec, nid);
14498
14498
-
}
14499
14499
-
14500
14500
-
/* unsolicited event for HP jack sensing */
14501
14501
-
static void alc269_laptop_unsol_event(struct hda_codec *codec,
14502
14502
-
unsigned int res)
14503
14503
-
{
14504
14504
-
switch (res >> 26) {
14505
14505
-
case ALC880_HP_EVENT:
14506
14506
-
alc269_speaker_automute(codec);
14507
14507
-
break;
14508
14508
-
case ALC880_MIC_EVENT:
14509
14509
-
alc_mic_automute(codec);
14510
14510
-
break;
14511
14511
-
}
14512
14512
-
}
14513
14513
-
14514
14443
static void alc269_laptop_amic_setup(struct hda_codec *codec)
14515
14444
{
14516
14445
struct alc_spec *spec = codec->spec;
14517
14446
spec->autocfg.hp_pins[0] = 0x15;
14518
14447
spec->autocfg.speaker_pins[0] = 0x14;
14448
14448
+
spec->automute_mixer_nid[0] = 0x0c;
14449
14449
+
spec->automute = 1;
14450
14450
+
spec->automute_mode = ALC_AUTOMUTE_MIXER;
14519
14451
spec->ext_mic.pin = 0x18;
14520
14452
spec->ext_mic.mux_idx = 0;
14521
14453
spec->int_mic.pin = 0x19;
···
14500
14488
struct alc_spec *spec = codec->spec;
14501
14489
spec->autocfg.hp_pins[0] = 0x15;
14502
14490
spec->autocfg.speaker_pins[0] = 0x14;
14491
14491
+
spec->automute_mixer_nid[0] = 0x0c;
14492
14492
+
spec->automute = 1;
14493
14493
+
spec->automute_mode = ALC_AUTOMUTE_MIXER;
14503
14494
spec->ext_mic.pin = 0x18;
14504
14495
spec->ext_mic.mux_idx = 0;
14505
14496
spec->int_mic.pin = 0x12;
···
14515
14500
struct alc_spec *spec = codec->spec;
14516
14501
spec->autocfg.hp_pins[0] = 0x21;
14517
14502
spec->autocfg.speaker_pins[0] = 0x14;
14503
14503
+
spec->automute_mixer_nid[0] = 0x0c;
14504
14504
+
spec->automute = 1;
14505
14505
+
spec->automute_mode = ALC_AUTOMUTE_MIXER;
14518
14506
spec->ext_mic.pin = 0x18;
14519
14507
spec->ext_mic.mux_idx = 0;
14520
14508
spec->int_mic.pin = 0x19;
···
14530
14512
struct alc_spec *spec = codec->spec;
14531
14513
spec->autocfg.hp_pins[0] = 0x21;
14532
14514
spec->autocfg.speaker_pins[0] = 0x14;
14515
14515
+
spec->automute_mixer_nid[0] = 0x0c;
14516
14516
+
spec->automute = 1;
14517
14517
+
spec->automute_mode = ALC_AUTOMUTE_MIXER;
14533
14518
spec->ext_mic.pin = 0x18;
14534
14519
spec->ext_mic.mux_idx = 0;
14535
14520
spec->int_mic.pin = 0x12;
···
14540
14519
spec->auto_mic = 1;
14541
14520
}
14542
14521
14543
14543
-
static void alc269_laptop_inithook(struct hda_codec *codec)
14544
14544
-
{
14545
14545
-
alc269_speaker_automute(codec);
14546
14546
-
alc_mic_automute(codec);
14547
14547
-
}
14548
14548
-
14549
14522
/*
14550
14523
* generic initialization of ADC, input mixers and output mixers
14551
14524
*/
14552
14552
-
static struct hda_verb alc269_init_verbs[] = {
14525
14525
+
static const struct hda_verb alc269_init_verbs[] = {
14553
14526
/*
14554
14527
* Unmute ADC0 and set the default input to mic-in
14555
14528
*/
···
14586
14571
{ }
14587
14572
};
14588
14573
14589
14589
-
static struct hda_verb alc269vb_init_verbs[] = {
14574
14574
+
static const struct hda_verb alc269vb_init_verbs[] = {
14590
14575
/*
14591
14576
* Unmute ADC0 and set the default input to mic-in
14592
14577
*/
···
14644
14629
#define alc269_pcm_digital_playback alc880_pcm_digital_playback
14645
14630
#define alc269_pcm_digital_capture alc880_pcm_digital_capture
14646
14631
14647
14647
-
static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
14632
14632
+
static const struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
14648
14633
.substreams = 1,
14649
14634
.channels_min = 2,
14650
14635
.channels_max = 8,
···
14657
14642
},
14658
14643
};
14659
14644
14660
14660
-
static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
14645
14645
+
static const struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
14661
14646
.substreams = 1,
14662
14647
.channels_min = 2,
14663
14648
.channels_max = 2,
···
14741
14726
{
14742
14727
struct alc_spec *spec = codec->spec;
14743
14728
int err;
14744
14744
-
static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
14729
14729
+
static const hda_nid_t alc269_ignore[] = { 0x1d, 0 };
14745
14730
14746
14731
err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14747
14732
alc269_ignore);
···
14811
14796
alc_inithook(codec);
14812
14797
}
14813
14798
14814
14814
-
#ifdef SND_HDA_NEEDS_RESUME
14815
14799
static void alc269_toggle_power_output(struct hda_codec *codec, int power_up)
14816
14800
{
14817
14801
int val = alc_read_coef_idx(codec, 0x04);
···
14821
14807
alc_write_coef_idx(codec, 0x04, val);
14822
14808
}
14823
14809
14824
14824
-
#ifdef CONFIG_SND_HDA_POWER_SAVE
14825
14825
-
static int alc269_suspend(struct hda_codec *codec, pm_message_t state)
14810
14810
+
static void alc269_shutup(struct hda_codec *codec)
14826
14811
{
14827
14827
-
struct alc_spec *spec = codec->spec;
14828
14828
-
14829
14812
if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017)
14830
14813
alc269_toggle_power_output(codec, 0);
14831
14814
if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) {
14832
14815
alc269_toggle_power_output(codec, 0);
14833
14816
msleep(150);
14834
14817
}
14835
14835
-
14836
14836
-
alc_shutup(codec);
14837
14837
-
if (spec && spec->power_hook)
14838
14838
-
spec->power_hook(codec);
14839
14839
-
return 0;
14840
14818
}
14841
14841
-
#endif /* CONFIG_SND_HDA_POWER_SAVE */
14842
14819
14820
14820
+
#ifdef SND_HDA_NEEDS_RESUME
14843
14821
static int alc269_resume(struct hda_codec *codec)
14844
14822
{
14845
14823
if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) {
···
14870
14864
static void alc271_fixup_dmic(struct hda_codec *codec,
14871
14865
const struct alc_fixup *fix, int action)
14872
14866
{
14873
14873
-
static struct hda_verb verbs[] = {
14867
14867
+
static const struct hda_verb verbs[] = {
14874
14868
{0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
14875
14869
{0x20, AC_VERB_SET_PROC_COEF, 0x4000},
14876
14870
{}
···
14953
14947
},
14954
14948
};
14955
14949
14956
14956
-
static struct snd_pci_quirk alc269_fixup_tbl[] = {
14950
14950
+
static const struct snd_pci_quirk alc269_fixup_tbl[] = {
14957
14951
SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
14958
14952
SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
14959
14953
SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
···
14984
14978
[ALC269_AUTO] = "auto",
14985
14979
};
14986
14980
14987
14987
-
static struct snd_pci_quirk alc269_cfg_tbl[] = {
14981
14981
+
static const struct snd_pci_quirk alc269_cfg_tbl[] = {
14988
14982
SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
14989
14983
SND_PCI_QUIRK(0x1025, 0x047c, "ACER ZGA", ALC271_ACER),
14990
14984
SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
···
15042
15036
{}
15043
15037
};
15044
15038
15045
15045
-
static struct alc_config_preset alc269_presets[] = {
15039
15039
+
static const struct alc_config_preset alc269_presets[] = {
15046
15040
[ALC269_BASIC] = {
15047
15041
.mixers = { alc269_base_mixer },
15048
15042
.init_verbs = { alc269_init_verbs },
···
15076
15070
.hp_nid = 0x03,
15077
15071
.num_channel_mode = ARRAY_SIZE(alc269_modes),
15078
15072
.channel_mode = alc269_modes,
15079
15079
-
.unsol_event = alc269_laptop_unsol_event,
15073
15073
+
.unsol_event = alc_sku_unsol_event,
15080
15074
.setup = alc269_laptop_amic_setup,
15081
15081
-
.init_hook = alc269_laptop_inithook,
15075
15075
+
.init_hook = alc_inithook,
15082
15076
},
15083
15077
[ALC269_DMIC] = {
15084
15078
.mixers = { alc269_laptop_mixer },
···
15090
15084
.hp_nid = 0x03,
15091
15085
.num_channel_mode = ARRAY_SIZE(alc269_modes),
15092
15086
.channel_mode = alc269_modes,
15093
15093
-
.unsol_event = alc269_laptop_unsol_event,
15087
15087
+
.unsol_event = alc_sku_unsol_event,
15094
15088
.setup = alc269_laptop_dmic_setup,
15095
15095
-
.init_hook = alc269_laptop_inithook,
15089
15089
+
.init_hook = alc_inithook,
15096
15090
},
15097
15091
[ALC269VB_AMIC] = {
15098
15092
.mixers = { alc269vb_laptop_mixer },
···
15104
15098
.hp_nid = 0x03,
15105
15099
.num_channel_mode = ARRAY_SIZE(alc269_modes),
15106
15100
.channel_mode = alc269_modes,
15107
15107
-
.unsol_event = alc269_laptop_unsol_event,
15101
15101
+
.unsol_event = alc_sku_unsol_event,
15108
15102
.setup = alc269vb_laptop_amic_setup,
15109
15109
-
.init_hook = alc269_laptop_inithook,
15103
15103
+
.init_hook = alc_inithook,
15110
15104
},
15111
15105
[ALC269VB_DMIC] = {
15112
15106
.mixers = { alc269vb_laptop_mixer },
···
15118
15112
.hp_nid = 0x03,
15119
15113
.num_channel_mode = ARRAY_SIZE(alc269_modes),
15120
15114
.channel_mode = alc269_modes,
15121
15121
-
.unsol_event = alc269_laptop_unsol_event,
15115
15115
+
.unsol_event = alc_sku_unsol_event,
15122
15116
.setup = alc269vb_laptop_dmic_setup,
15123
15123
-
.init_hook = alc269_laptop_inithook,
15117
15117
+
.init_hook = alc_inithook,
15124
15118
},
15125
15119
[ALC269_FUJITSU] = {
15126
15120
.mixers = { alc269_fujitsu_mixer },
···
15132
15126
.hp_nid = 0x03,
15133
15127
.num_channel_mode = ARRAY_SIZE(alc269_modes),
15134
15128
.channel_mode = alc269_modes,
15135
15135
-
.unsol_event = alc269_laptop_unsol_event,
15129
15129
+
.unsol_event = alc_sku_unsol_event,
15136
15130
.setup = alc269_laptop_dmic_setup,
15137
15137
-
.init_hook = alc269_laptop_inithook,
15131
15131
+
.init_hook = alc_inithook,
15138
15132
},
15139
15133
[ALC269_LIFEBOOK] = {
15140
15134
.mixers = { alc269_lifebook_mixer },
···
15146
15140
.channel_mode = alc269_modes,
15147
15141
.input_mux = &alc269_capture_source,
15148
15142
.unsol_event = alc269_lifebook_unsol_event,
15143
15143
+
.setup = alc269_lifebook_setup,
15149
15144
.init_hook = alc269_lifebook_init_hook,
15150
15145
},
15151
15146
[ALC271_ACER] = {
···
15192
15185
val = alc_read_coef_idx(codec, 0xd);
15193
15186
if ((val & 0x0c00) >> 10 != 0x1) {
15194
15187
/* Capless ramp up clock control */
15195
15195
-
alc_write_coef_idx(codec, 0xd, val | 1<<10);
15188
15188
+
alc_write_coef_idx(codec, 0xd, val | (1<<10));
15196
15189
}
15197
15190
val = alc_read_coef_idx(codec, 0x17);
15198
15191
if ((val & 0x01c0) >> 6 != 0x4) {
15199
15192
/* Class D power on reset */
15200
15200
-
alc_write_coef_idx(codec, 0x17, val | 1<<7);
15193
15193
+
alc_write_coef_idx(codec, 0x17, val | (1<<7));
15201
15194
}
15202
15195
}
15196
15196
+
15197
15197
+
val = alc_read_coef_idx(codec, 0xd); /* Class D */
15198
15198
+
alc_write_coef_idx(codec, 0xd, val | (1<<14));
15199
15199
+
15200
15200
+
val = alc_read_coef_idx(codec, 0x4); /* HP */
15201
15201
+
alc_write_coef_idx(codec, 0x4, val | (1<<11));
15202
15202
+
15203
15203
return 0;
15204
15204
}
15205
15205
···
15327
15313
spec->vmaster_nid = 0x02;
15328
15314
15329
15315
codec->patch_ops = alc_patch_ops;
15330
15330
-
#ifdef CONFIG_SND_HDA_POWER_SAVE
15331
15331
-
codec->patch_ops.suspend = alc269_suspend;
15332
15332
-
#endif
15333
15316
#ifdef SND_HDA_NEEDS_RESUME
15334
15317
codec->patch_ops.resume = alc269_resume;
15335
15318
#endif
15336
15319
if (board_config == ALC269_AUTO)
15337
15320
spec->init_hook = alc269_auto_init;
15321
15321
+
spec->shutup = alc269_shutup;
15338
15322
15339
15323
alc_init_jacks(codec);
15340
15324
#ifdef CONFIG_SND_HDA_POWER_SAVE
···
15353
15341
* set the path ways for 2 channel output
15354
15342
* need to set the codec line out and mic 1 pin widgets to inputs
15355
15343
*/
15356
15356
-
static struct hda_verb alc861_threestack_ch2_init[] = {
15344
15344
+
static const struct hda_verb alc861_threestack_ch2_init[] = {
15357
15345
/* set pin widget 1Ah (line in) for input */
15358
15346
{ 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15359
15347
/* set pin widget 18h (mic1/2) for input, for mic also enable
···
15372
15360
* 6ch mode
15373
15361
* need to set the codec line out and mic 1 pin widgets to outputs
15374
15362
*/
15375
15375
-
static struct hda_verb alc861_threestack_ch6_init[] = {
15363
15363
+
static const struct hda_verb alc861_threestack_ch6_init[] = {
15376
15364
/* set pin widget 1Ah (line in) for output (Back Surround)*/
15377
15365
{ 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15378
15366
/* set pin widget 18h (mic1) for output (CLFE)*/
···
15389
15377
{ } /* end */
15390
15378
};
15391
15379
15392
15392
-
static struct hda_channel_mode alc861_threestack_modes[2] = {
15380
15380
+
static const struct hda_channel_mode alc861_threestack_modes[2] = {
15393
15381
{ 2, alc861_threestack_ch2_init },
15394
15382
{ 6, alc861_threestack_ch6_init },
15395
15383
};
15396
15384
/* Set mic1 as input and unmute the mixer */
15397
15397
-
static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
15385
15385
+
static const struct hda_verb alc861_uniwill_m31_ch2_init[] = {
15398
15386
{ 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15399
15387
{ 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
15400
15388
{ } /* end */
15401
15389
};
15402
15390
/* Set mic1 as output and mute mixer */
15403
15403
-
static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
15391
15391
+
static const struct hda_verb alc861_uniwill_m31_ch4_init[] = {
15404
15392
{ 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15405
15393
{ 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
15406
15394
{ } /* end */
15407
15395
};
15408
15396
15409
15409
-
static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
15397
15397
+
static const struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
15410
15398
{ 2, alc861_uniwill_m31_ch2_init },
15411
15399
{ 4, alc861_uniwill_m31_ch4_init },
15412
15400
};
15413
15401
15414
15402
/* Set mic1 and line-in as input and unmute the mixer */
15415
15415
-
static struct hda_verb alc861_asus_ch2_init[] = {
15403
15403
+
static const struct hda_verb alc861_asus_ch2_init[] = {
15416
15404
/* set pin widget 1Ah (line in) for input */
15417
15405
{ 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15418
15406
/* set pin widget 18h (mic1/2) for input, for mic also enable
···
15428
15416
{ } /* end */
15429
15417
};
15430
15418
/* Set mic1 nad line-in as output and mute mixer */
15431
15431
-
static struct hda_verb alc861_asus_ch6_init[] = {
15419
15419
+
static const struct hda_verb alc861_asus_ch6_init[] = {
15432
15420
/* set pin widget 1Ah (line in) for output (Back Surround)*/
15433
15421
{ 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15434
15422
/* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
···
15446
15434
{ } /* end */
15447
15435
};
15448
15436
15449
15449
-
static struct hda_channel_mode alc861_asus_modes[2] = {
15437
15437
+
static const struct hda_channel_mode alc861_asus_modes[2] = {
15450
15438
{ 2, alc861_asus_ch2_init },
15451
15439
{ 6, alc861_asus_ch6_init },
15452
15440
};
15453
15441
15454
15442
/* patch-ALC861 */
15455
15443
15456
15456
-
static struct snd_kcontrol_new alc861_base_mixer[] = {
15444
15444
+
static const struct snd_kcontrol_new alc861_base_mixer[] = {
15457
15445
/* output mixer control */
15458
15446
HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15459
15447
HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
···
15476
15464
{ } /* end */
15477
15465
};
15478
15466
15479
15479
-
static struct snd_kcontrol_new alc861_3ST_mixer[] = {
15467
15467
+
static const struct snd_kcontrol_new alc861_3ST_mixer[] = {
15480
15468
/* output mixer control */
15481
15469
HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15482
15470
HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
···
15507
15495
{ } /* end */
15508
15496
};
15509
15497
15510
15510
-
static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
15498
15498
+
static const struct snd_kcontrol_new alc861_toshiba_mixer[] = {
15511
15499
/* output mixer control */
15512
15500
HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15513
15501
HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
···
15516
15504
{ } /* end */
15517
15505
};
15518
15506
15519
15519
-
static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
15507
15507
+
static const struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
15520
15508
/* output mixer control */
15521
15509
HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15522
15510
HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
···
15547
15535
{ } /* end */
15548
15536
};
15549
15537
15550
15550
-
static struct snd_kcontrol_new alc861_asus_mixer[] = {
15538
15538
+
static const struct snd_kcontrol_new alc861_asus_mixer[] = {
15551
15539
/* output mixer control */
15552
15540
HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15553
15541
HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
···
15579
15567
};
15580
15568
15581
15569
/* additional mixer */
15582
15582
-
static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
15570
15570
+
static const struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
15583
15571
HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15584
15572
HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15585
15573
{ }
···
15588
15576
/*
15589
15577
* generic initialization of ADC, input mixers and output mixers
15590
15578
*/
15591
15591
-
static struct hda_verb alc861_base_init_verbs[] = {
15579
15579
+
static const struct hda_verb alc861_base_init_verbs[] = {
15592
15580
/*
15593
15581
* Unmute ADC0 and set the default input to mic-in
15594
15582
*/
···
15654
15642
{ }
15655
15643
};
15656
15644
15657
15657
-
static struct hda_verb alc861_threestack_init_verbs[] = {
15645
15645
+
static const struct hda_verb alc861_threestack_init_verbs[] = {
15658
15646
/*
15659
15647
* Unmute ADC0 and set the default input to mic-in
15660
15648
*/
···
15715
15703
{ }
15716
15704
};
15717
15705
15718
15718
-
static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
15706
15706
+
static const struct hda_verb alc861_uniwill_m31_init_verbs[] = {
15719
15707
/*
15720
15708
* Unmute ADC0 and set the default input to mic-in
15721
15709
*/
···
15777
15765
{ }
15778
15766
};
15779
15767
15780
15780
-
static struct hda_verb alc861_asus_init_verbs[] = {
15768
15768
+
static const struct hda_verb alc861_asus_init_verbs[] = {
15781
15769
/*
15782
15770
* Unmute ADC0 and set the default input to mic-in
15783
15771
*/
···
15843
15831
};
15844
15832
15845
15833
/* additional init verbs for ASUS laptops */
15846
15846
-
static struct hda_verb alc861_asus_laptop_init_verbs[] = {
15834
15834
+
static const struct hda_verb alc861_asus_laptop_init_verbs[] = {
15847
15835
{ 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
15848
15836
{ 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
15849
15837
{ }
···
15852
15840
/*
15853
15841
* generic initialization of ADC, input mixers and output mixers
15854
15842
*/
15855
15855
-
static struct hda_verb alc861_auto_init_verbs[] = {
15843
15843
+
static const struct hda_verb alc861_auto_init_verbs[] = {
15856
15844
/*
15857
15845
* Unmute ADC0 and set the default input to mic-in
15858
15846
*/
···
15901
15889
{ }
15902
15890
};
15903
15891
15904
15904
-
static struct hda_verb alc861_toshiba_init_verbs[] = {
15892
15892
+
static const struct hda_verb alc861_toshiba_init_verbs[] = {
15905
15893
{0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15906
15894
15907
15895
{ }
···
15934
15922
15935
15923
#define ALC861_DIGOUT_NID 0x07
15936
15924
15937
15937
-
static struct hda_channel_mode alc861_8ch_modes[1] = {
15925
15925
+
static const struct hda_channel_mode alc861_8ch_modes[1] = {
15938
15926
{ 8, NULL }
15939
15927
};
15940
15928
15941
15941
-
static hda_nid_t alc861_dac_nids[4] = {
15929
15929
+
static const hda_nid_t alc861_dac_nids[4] = {
15942
15930
/* front, surround, clfe, side */
15943
15931
0x03, 0x06, 0x05, 0x04
15944
15932
};
15945
15933
15946
15946
-
static hda_nid_t alc660_dac_nids[3] = {
15934
15934
+
static const hda_nid_t alc660_dac_nids[3] = {
15947
15935
/* front, clfe, surround */
15948
15936
0x03, 0x05, 0x06
15949
15937
};
15950
15938
15951
15951
-
static hda_nid_t alc861_adc_nids[1] = {
15939
15939
+
static const hda_nid_t alc861_adc_nids[1] = {
15952
15940
/* ADC0-2 */
15953
15941
0x08,
15954
15942
};
15955
15943
15956
15956
-
static struct hda_input_mux alc861_capture_source = {
15944
15944
+
static const struct hda_input_mux alc861_capture_source = {
15957
15945
.num_items = 5,
15958
15946
.items = {
15959
15947
{ "Mic", 0x0 },
···
16003
15991
dac = alc861_look_for_dac(codec, nid);
16004
15992
if (!dac)
16005
15993
continue;
16006
16006
-
spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
15994
15994
+
spec->private_dac_nids[spec->multiout.num_dacs++] = dac;
16007
15995
}
16008
15996
return 0;
16009
15997
}
···
16026
16014
static const char * const chname[4] = {
16027
16015
"Front", "Surround", NULL /*CLFE*/, "Side"
16028
16016
};
16029
16029
-
const char *pfx = alc_get_line_out_pfx(cfg, true);
16017
16017
+
const char *pfx = alc_get_line_out_pfx(spec, true);
16030
16018
hda_nid_t nid;
16031
16031
-
int i, err;
16019
16019
+
int i, err, noutputs;
16032
16020
16033
16033
-
for (i = 0; i < cfg->line_outs; i++) {
16021
16021
+
noutputs = cfg->line_outs;
16022
16022
+
if (spec->multi_ios > 0)
16023
16023
+
noutputs += spec->multi_ios;
16024
16024
+
16025
16025
+
for (i = 0; i < noutputs; i++) {
16034
16026
nid = spec->multiout.dac_nids[i];
16035
16027
if (!nid)
16036
16028
continue;
···
16167
16151
{
16168
16152
struct alc_spec *spec = codec->spec;
16169
16153
int err;
16170
16170
-
static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
16154
16154
+
static const hda_nid_t alc861_ignore[] = { 0x1d, 0 };
16171
16155
16172
16156
err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
16173
16157
alc861_ignore);
···
16177
16161
return 0; /* can't find valid BIOS pin config */
16178
16162
16179
16163
err = alc861_auto_fill_dac_nids(codec, &spec->autocfg);
16164
16164
+
if (err < 0)
16165
16165
+
return err;
16166
16166
+
err = alc_auto_add_multi_channel_mode(codec);
16180
16167
if (err < 0)
16181
16168
return err;
16182
16169
err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg);
···
16226
16207
}
16227
16208
16228
16209
#ifdef CONFIG_SND_HDA_POWER_SAVE
16229
16229
-
static struct hda_amp_list alc861_loopbacks[] = {
16210
16210
+
static const struct hda_amp_list alc861_loopbacks[] = {
16230
16211
{ 0x15, HDA_INPUT, 0 },
16231
16212
{ 0x15, HDA_INPUT, 1 },
16232
16213
{ 0x15, HDA_INPUT, 2 },
···
16251
16232
[ALC861_AUTO] = "auto",
16252
16233
};
16253
16234
16254
16254
-
static struct snd_pci_quirk alc861_cfg_tbl[] = {
16235
16235
+
static const struct snd_pci_quirk alc861_cfg_tbl[] = {
16255
16236
SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
16256
16237
SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
16257
16238
SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
···
16275
16256
{}
16276
16257
};
16277
16258
16278
16278
-
static struct alc_config_preset alc861_presets[] = {
16259
16259
+
static const struct alc_config_preset alc861_presets[] = {
16279
16260
[ALC861_3ST] = {
16280
16261
.mixers = { alc861_3ST_mixer },
16281
16262
.init_verbs = { alc861_threestack_init_verbs },
···
16398
16379
},
16399
16380
};
16400
16381
16401
16401
-
static struct snd_pci_quirk alc861_fixup_tbl[] = {
16382
16382
+
static const struct snd_pci_quirk alc861_fixup_tbl[] = {
16402
16383
SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505),
16403
16384
{}
16404
16385
};
···
16491
16472
*/
16492
16473
#define ALC861VD_DIGOUT_NID 0x06
16493
16474
16494
16494
-
static hda_nid_t alc861vd_dac_nids[4] = {
16475
16475
+
static const hda_nid_t alc861vd_dac_nids[4] = {
16495
16476
/* front, surr, clfe, side surr */
16496
16477
0x02, 0x03, 0x04, 0x05
16497
16478
};
···
16503
16484
* - and it is the same as in 861vd.
16504
16485
* adc_nids in ALC660vd are (is) the same as in 861vd
16505
16486
*/
16506
16506
-
static hda_nid_t alc660vd_dac_nids[3] = {
16487
16487
+
static const hda_nid_t alc660vd_dac_nids[3] = {
16507
16488
/* front, rear, clfe, rear_surr */
16508
16489
0x02, 0x04, 0x03
16509
16490
};
16510
16491
16511
16511
-
static hda_nid_t alc861vd_adc_nids[1] = {
16492
16492
+
static const hda_nid_t alc861vd_adc_nids[1] = {
16512
16493
/* ADC0 */
16513
16494
0x09,
16514
16495
};
16515
16496
16516
16516
-
static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
16497
16497
+
static const hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
16517
16498
16518
16499
/* input MUX */
16519
16500
/* FIXME: should be a matrix-type input source selection */
16520
16520
-
static struct hda_input_mux alc861vd_capture_source = {
16501
16501
+
static const struct hda_input_mux alc861vd_capture_source = {
16521
16502
.num_items = 4,
16522
16503
.items = {
16523
16504
{ "Mic", 0x0 },
···
16527
16508
},
16528
16509
};
16529
16510
16530
16530
-
static struct hda_input_mux alc861vd_dallas_capture_source = {
16511
16511
+
static const struct hda_input_mux alc861vd_dallas_capture_source = {
16531
16512
.num_items = 2,
16532
16513
.items = {
16533
16514
{ "Mic", 0x0 },
···
16535
16516
},
16536
16517
};
16537
16518
16538
16538
-
static struct hda_input_mux alc861vd_hp_capture_source = {
16519
16519
+
static const struct hda_input_mux alc861vd_hp_capture_source = {
16539
16520
.num_items = 2,
16540
16521
.items = {
16541
16522
{ "Front Mic", 0x0 },
···
16546
16527
/*
16547
16528
* 2ch mode
16548
16529
*/
16549
16549
-
static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
16530
16530
+
static const struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
16550
16531
{ 2, NULL }
16551
16532
};
16552
16533
16553
16534
/*
16554
16535
* 6ch mode
16555
16536
*/
16556
16556
-
static struct hda_verb alc861vd_6stack_ch6_init[] = {
16537
16537
+
static const struct hda_verb alc861vd_6stack_ch6_init[] = {
16557
16538
{ 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
16558
16539
{ 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16559
16540
{ 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
···
16564
16545
/*
16565
16546
* 8ch mode
16566
16547
*/
16567
16567
-
static struct hda_verb alc861vd_6stack_ch8_init[] = {
16548
16548
+
static const struct hda_verb alc861vd_6stack_ch8_init[] = {
16568
16549
{ 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16569
16550
{ 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16570
16551
{ 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
···
16572
16553
{ } /* end */
16573
16554
};
16574
16555
16575
16575
-
static struct hda_channel_mode alc861vd_6stack_modes[2] = {
16556
16556
+
static const struct hda_channel_mode alc861vd_6stack_modes[2] = {
16576
16557
{ 6, alc861vd_6stack_ch6_init },
16577
16558
{ 8, alc861vd_6stack_ch8_init },
16578
16559
};
16579
16560
16580
16580
-
static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
16561
16561
+
static const struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
16581
16562
{
16582
16563
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
16583
16564
.name = "Channel Mode",
···
16591
16572
/* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
16592
16573
* Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
16593
16574
*/
16594
16594
-
static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
16575
16575
+
static const struct snd_kcontrol_new alc861vd_6st_mixer[] = {
16595
16576
HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16596
16577
HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
16597
16578
···
16627
16608
{ } /* end */
16628
16609
};
16629
16610
16630
16630
-
static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
16611
16611
+
static const struct snd_kcontrol_new alc861vd_3st_mixer[] = {
16631
16612
HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16632
16613
HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
16633
16614
···
16650
16631
{ } /* end */
16651
16632
};
16652
16633
16653
16653
-
static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
16634
16634
+
static const struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
16654
16635
HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16655
16636
/*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
16656
16637
HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
···
16674
16655
/* Pin assignment: Speaker=0x14, HP = 0x15,
16675
16656
* Mic=0x18, Internal Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
16676
16657
*/
16677
16677
-
static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
16658
16658
+
static const struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
16678
16659
HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16679
16660
HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
16680
16661
HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
···
16691
16672
/* Pin assignment: Speaker=0x14, Line-out = 0x15,
16692
16673
* Front Mic=0x18, ATAPI Mic = 0x19,
16693
16674
*/
16694
16694
-
static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
16675
16675
+
static const struct snd_kcontrol_new alc861vd_hp_mixer[] = {
16695
16676
HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16696
16677
HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
16697
16678
HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
···
16707
16688
/*
16708
16689
* generic initialization of ADC, input mixers and output mixers
16709
16690
*/
16710
16710
-
static struct hda_verb alc861vd_volume_init_verbs[] = {
16691
16691
+
static const struct hda_verb alc861vd_volume_init_verbs[] = {
16711
16692
/*
16712
16693
* Unmute ADC0 and set the default input to mic-in
16713
16694
*/
···
16757
16738
* 3-stack pin configuration:
16758
16739
* front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
16759
16740
*/
16760
16760
-
static struct hda_verb alc861vd_3stack_init_verbs[] = {
16741
16741
+
static const struct hda_verb alc861vd_3stack_init_verbs[] = {
16761
16742
/*
16762
16743
* Set pin mode and muting
16763
16744
*/
···
16788
16769
/*
16789
16770
* 6-stack pin configuration:
16790
16771
*/
16791
16791
-
static struct hda_verb alc861vd_6stack_init_verbs[] = {
16772
16772
+
static const struct hda_verb alc861vd_6stack_init_verbs[] = {
16792
16773
/*
16793
16774
* Set pin mode and muting
16794
16775
*/
···
16829
16810
{ }
16830
16811
};
16831
16812
16832
16832
-
static struct hda_verb alc861vd_eapd_verbs[] = {
16813
16813
+
static const struct hda_verb alc861vd_eapd_verbs[] = {
16833
16814
{0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16834
16815
{ }
16835
16816
};
16836
16817
16837
16837
-
static struct hda_verb alc660vd_eapd_verbs[] = {
16818
16818
+
static const struct hda_verb alc660vd_eapd_verbs[] = {
16838
16819
{0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16839
16820
{0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
16840
16821
{ }
16841
16822
};
16842
16823
16843
16843
-
static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
16824
16824
+
static const struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
16844
16825
{0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16845
16826
{0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16846
16827
{0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
···
16854
16835
struct alc_spec *spec = codec->spec;
16855
16836
spec->autocfg.hp_pins[0] = 0x1b;
16856
16837
spec->autocfg.speaker_pins[0] = 0x14;
16838
16838
+
spec->automute = 1;
16839
16839
+
spec->automute_mode = ALC_AUTOMUTE_AMP;
16857
16840
}
16858
16841
16859
16842
static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
16860
16843
{
16861
16861
-
alc_automute_amp(codec);
16844
16844
+
alc_hp_automute(codec);
16862
16845
alc88x_simple_mic_automute(codec);
16863
16846
}
16864
16847
···
16872
16851
alc88x_simple_mic_automute(codec);
16873
16852
break;
16874
16853
default:
16875
16875
-
alc_automute_amp_unsol_event(codec, res);
16854
16854
+
alc_sku_unsol_event(codec, res);
16876
16855
break;
16877
16856
}
16878
16857
}
16879
16858
16880
16880
-
static struct hda_verb alc861vd_dallas_verbs[] = {
16859
16859
+
static const struct hda_verb alc861vd_dallas_verbs[] = {
16881
16860
{0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16882
16861
{0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16883
16862
{0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
···
16929
16908
16930
16909
spec->autocfg.hp_pins[0] = 0x15;
16931
16910
spec->autocfg.speaker_pins[0] = 0x14;
16911
16911
+
spec->automute = 1;
16912
16912
+
spec->automute_mode = ALC_AUTOMUTE_AMP;
16932
16913
}
16933
16914
16934
16915
#ifdef CONFIG_SND_HDA_POWER_SAVE
···
16959
16936
[ALC861VD_AUTO] = "auto",
16960
16937
};
16961
16938
16962
16962
-
static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
16939
16939
+
static const struct snd_pci_quirk alc861vd_cfg_tbl[] = {
16963
16940
SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
16964
16941
SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
16965
16942
SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
···
16978
16955
{}
16979
16956
};
16980
16957
16981
16981
-
static struct alc_config_preset alc861vd_presets[] = {
16958
16958
+
static const struct alc_config_preset alc861vd_presets[] = {
16982
16959
[ALC660VD_3ST] = {
16983
16960
.mixers = { alc861vd_3st_mixer },
16984
16961
.init_verbs = { alc861vd_volume_init_verbs,
···
17055
17032
.num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
17056
17033
.channel_mode = alc861vd_3stack_2ch_modes,
17057
17034
.input_mux = &alc861vd_dallas_capture_source,
17058
17058
-
.unsol_event = alc_automute_amp_unsol_event,
17035
17035
+
.unsol_event = alc_sku_unsol_event,
17059
17036
.setup = alc861vd_dallas_setup,
17060
17060
-
.init_hook = alc_automute_amp,
17037
17037
+
.init_hook = alc_hp_automute,
17061
17038
},
17062
17039
[ALC861VD_HP] = {
17063
17040
.mixers = { alc861vd_hp_mixer },
···
17068
17045
.num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
17069
17046
.channel_mode = alc861vd_3stack_2ch_modes,
17070
17047
.input_mux = &alc861vd_hp_capture_source,
17071
17071
-
.unsol_event = alc_automute_amp_unsol_event,
17048
17048
+
.unsol_event = alc_sku_unsol_event,
17072
17049
.setup = alc861vd_dallas_setup,
17073
17073
-
.init_hook = alc_automute_amp,
17050
17050
+
.init_hook = alc_hp_automute,
17074
17051
},
17075
17052
[ALC660VD_ASUS_V1S] = {
17076
17053
.mixers = { alc861vd_lenovo_mixer },
···
17169
17146
static const char * const chname[4] = {
17170
17147
"Front", "Surround", "CLFE", "Side"
17171
17148
};
17172
17172
-
const char *pfx = alc_get_line_out_pfx(cfg, true);
17149
17149
+
const char *pfx = alc_get_line_out_pfx(spec, true);
17173
17150
hda_nid_t nid_v, nid_s;
17174
17174
-
int i, err;
17151
17151
+
int i, err, noutputs;
17175
17152
17176
17176
-
for (i = 0; i < cfg->line_outs; i++) {
17153
17153
+
noutputs = cfg->line_outs;
17154
17154
+
if (spec->multi_ios > 0)
17155
17155
+
noutputs += spec->multi_ios;
17156
17156
+
17157
17157
+
for (i = 0; i < noutputs; i++) {
17177
17158
if (!spec->multiout.dac_nids[i])
17178
17159
continue;
17179
17160
nid_v = alc861vd_idx_to_mixer_vol(
···
17290
17263
{
17291
17264
struct alc_spec *spec = codec->spec;
17292
17265
int err;
17293
17293
-
static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
17266
17266
+
static const hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
17294
17267
17295
17268
err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
17296
17269
alc861vd_ignore);
···
17300
17273
return 0; /* can't find valid BIOS pin config */
17301
17274
17302
17275
err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
17276
17276
+
if (err < 0)
17277
17277
+
return err;
17278
17278
+
err = alc_auto_add_multi_channel_mode(codec);
17303
17279
if (err < 0)
17304
17280
return err;
17305
17281
err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
···
17373
17343
},
17374
17344
};
17375
17345
17376
17376
-
static struct snd_pci_quirk alc861vd_fixup_tbl[] = {
17346
17346
+
static const struct snd_pci_quirk alc861vd_fixup_tbl[] = {
17377
17347
SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
17378
17348
{}
17379
17349
};
···
17456
17426
17457
17427
if (board_config == ALC861VD_AUTO)
17458
17428
spec->init_hook = alc861vd_auto_init;
17429
17429
+
spec->shutup = alc_eapd_shutup;
17459
17430
#ifdef CONFIG_SND_HDA_POWER_SAVE
17460
17431
if (!spec->loopback.amplist)
17461
17432
spec->loopback.amplist = alc861vd_loopbacks;
···
17479
17448
#define ALC662_DIGOUT_NID 0x06
17480
17449
#define ALC662_DIGIN_NID 0x0a
17481
17450
17482
17482
-
static hda_nid_t alc662_dac_nids[4] = {
17483
17483
-
/* front, rear, clfe, rear_surr */
17451
17451
+
static const hda_nid_t alc662_dac_nids[3] = {
17452
17452
+
/* front, rear, clfe */
17484
17453
0x02, 0x03, 0x04
17485
17454
};
17486
17455
17487
17487
-
static hda_nid_t alc272_dac_nids[2] = {
17456
17456
+
static const hda_nid_t alc272_dac_nids[2] = {
17488
17457
0x02, 0x03
17489
17458
};
17490
17459
17491
17491
-
static hda_nid_t alc662_adc_nids[2] = {
17460
17460
+
static const hda_nid_t alc662_adc_nids[2] = {
17492
17461
/* ADC1-2 */
17493
17462
0x09, 0x08
17494
17463
};
17495
17464
17496
17496
-
static hda_nid_t alc272_adc_nids[1] = {
17465
17465
+
static const hda_nid_t alc272_adc_nids[1] = {
17497
17466
/* ADC1-2 */
17498
17467
0x08,
17499
17468
};
17500
17469
17501
17501
-
static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 };
17502
17502
-
static hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
17470
17470
+
static const hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 };
17471
17471
+
static const hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
17503
17472
17504
17473
17505
17474
/* input MUX */
17506
17475
/* FIXME: should be a matrix-type input source selection */
17507
17507
-
static struct hda_input_mux alc662_capture_source = {
17476
17476
+
static const struct hda_input_mux alc662_capture_source = {
17508
17477
.num_items = 4,
17509
17478
.items = {
17510
17479
{ "Mic", 0x0 },
···
17514
17483
},
17515
17484
};
17516
17485
17517
17517
-
static struct hda_input_mux alc662_lenovo_101e_capture_source = {
17486
17486
+
static const struct hda_input_mux alc662_lenovo_101e_capture_source = {
17518
17487
.num_items = 2,
17519
17488
.items = {
17520
17489
{ "Mic", 0x1 },
···
17522
17491
},
17523
17492
};
17524
17493
17525
17525
-
static struct hda_input_mux alc663_capture_source = {
17494
17494
+
static const struct hda_input_mux alc663_capture_source = {
17526
17495
.num_items = 3,
17527
17496
.items = {
17528
17497
{ "Mic", 0x0 },
···
17532
17501
};
17533
17502
17534
17503
#if 0 /* set to 1 for testing other input sources below */
17535
17535
-
static struct hda_input_mux alc272_nc10_capture_source = {
17504
17504
+
static const struct hda_input_mux alc272_nc10_capture_source = {
17536
17505
.num_items = 16,
17537
17506
.items = {
17538
17507
{ "Autoselect Mic", 0x0 },
···
17558
17527
/*
17559
17528
* 2ch mode
17560
17529
*/
17561
17561
-
static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
17530
17530
+
static const struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
17562
17531
{ 2, NULL }
17563
17532
};
17564
17533
17565
17534
/*
17566
17535
* 2ch mode
17567
17536
*/
17568
17568
-
static struct hda_verb alc662_3ST_ch2_init[] = {
17537
17537
+
static const struct hda_verb alc662_3ST_ch2_init[] = {
17569
17538
{ 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
17570
17539
{ 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
17571
17540
{ 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
···
17576
17545
/*
17577
17546
* 6ch mode
17578
17547
*/
17579
17579
-
static struct hda_verb alc662_3ST_ch6_init[] = {
17548
17548
+
static const struct hda_verb alc662_3ST_ch6_init[] = {
17580
17549
{ 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17581
17550
{ 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
17582
17551
{ 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
···
17586
17555
{ } /* end */
17587
17556
};
17588
17557
17589
17589
-
static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
17558
17558
+
static const struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
17590
17559
{ 2, alc662_3ST_ch2_init },
17591
17560
{ 6, alc662_3ST_ch6_init },
17592
17561
};
···
17594
17563
/*
17595
17564
* 2ch mode
17596
17565
*/
17597
17597
-
static struct hda_verb alc662_sixstack_ch6_init[] = {
17566
17566
+
static const struct hda_verb alc662_sixstack_ch6_init[] = {
17598
17567
{ 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
17599
17568
{ 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
17600
17569
{ 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
···
17604
17573
/*
17605
17574
* 6ch mode
17606
17575
*/
17607
17607
-
static struct hda_verb alc662_sixstack_ch8_init[] = {
17576
17576
+
static const struct hda_verb alc662_sixstack_ch8_init[] = {
17608
17577
{ 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17609
17578
{ 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17610
17579
{ 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17611
17580
{ } /* end */
17612
17581
};
17613
17582
17614
17614
-
static struct hda_channel_mode alc662_5stack_modes[2] = {
17583
17583
+
static const struct hda_channel_mode alc662_5stack_modes[2] = {
17615
17584
{ 2, alc662_sixstack_ch6_init },
17616
17585
{ 6, alc662_sixstack_ch8_init },
17617
17586
};
···
17620
17589
* Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
17621
17590
*/
17622
17591
17623
17623
-
static struct snd_kcontrol_new alc662_base_mixer[] = {
17592
17592
+
static const struct snd_kcontrol_new alc662_base_mixer[] = {
17624
17593
/* output mixer control */
17625
17594
HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
17626
17595
HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
···
17644
17613
{ } /* end */
17645
17614
};
17646
17615
17647
17647
-
static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
17616
17616
+
static const struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
17648
17617
HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17649
17618
HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
17650
17619
HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
···
17659
17628
{ } /* end */
17660
17629
};
17661
17630
17662
17662
-
static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
17631
17631
+
static const struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
17663
17632
HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17664
17633
HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
17665
17634
HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
···
17680
17649
{ } /* end */
17681
17650
};
17682
17651
17683
17683
-
static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
17652
17652
+
static const struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
17684
17653
HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17685
17654
HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
17686
17655
HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
···
17693
17662
{ } /* end */
17694
17663
};
17695
17664
17696
17696
-
static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
17665
17665
+
static const struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
17697
17666
HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17698
17667
ALC262_HIPPO_MASTER_SWITCH,
17699
17668
···
17707
17676
{ } /* end */
17708
17677
};
17709
17678
17710
17710
-
static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
17679
17679
+
static const struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
17711
17680
ALC262_HIPPO_MASTER_SWITCH,
17712
17681
HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17713
17682
HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
···
17721
17690
{ } /* end */
17722
17691
};
17723
17692
17724
17724
-
static struct hda_bind_ctls alc663_asus_bind_master_vol = {
17693
17693
+
static const struct hda_bind_ctls alc663_asus_bind_master_vol = {
17725
17694
.ops = &snd_hda_bind_vol,
17726
17695
.values = {
17727
17696
HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
···
17730
17699
},
17731
17700
};
17732
17701
17733
17733
-
static struct hda_bind_ctls alc663_asus_one_bind_switch = {
17702
17702
+
static const struct hda_bind_ctls alc663_asus_one_bind_switch = {
17734
17703
.ops = &snd_hda_bind_sw,
17735
17704
.values = {
17736
17705
HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
···
17739
17708
},
17740
17709
};
17741
17710
17742
17742
-
static struct snd_kcontrol_new alc663_m51va_mixer[] = {
17711
17711
+
static const struct snd_kcontrol_new alc663_m51va_mixer[] = {
17743
17712
HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17744
17713
HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
17745
17714
HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
···
17747
17716
{ } /* end */
17748
17717
};
17749
17718
17750
17750
-
static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
17719
17719
+
static const struct hda_bind_ctls alc663_asus_tree_bind_switch = {
17751
17720
.ops = &snd_hda_bind_sw,
17752
17721
.values = {
17753
17722
HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
···
17757
17726
},
17758
17727
};
17759
17728
17760
17760
-
static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
17729
17729
+
static const struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
17761
17730
HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17762
17731
HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
17763
17732
HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
···
17768
17737
{ } /* end */
17769
17738
};
17770
17739
17771
17771
-
static struct hda_bind_ctls alc663_asus_four_bind_switch = {
17740
17740
+
static const struct hda_bind_ctls alc663_asus_four_bind_switch = {
17772
17741
.ops = &snd_hda_bind_sw,
17773
17742
.values = {
17774
17743
HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
···
17778
17747
},
17779
17748
};
17780
17749
17781
17781
-
static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
17750
17750
+
static const struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
17782
17751
HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17783
17752
HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
17784
17753
HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
···
17788
17757
{ } /* end */
17789
17758
};
17790
17759
17791
17791
-
static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
17760
17760
+
static const struct snd_kcontrol_new alc662_1bjd_mixer[] = {
17792
17761
HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17793
17762
HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17794
17763
HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
···
17799
17768
{ } /* end */
17800
17769
};
17801
17770
17802
17802
-
static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
17771
17771
+
static const struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
17803
17772
.ops = &snd_hda_bind_vol,
17804
17773
.values = {
17805
17774
HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
···
17808
17777
},
17809
17778
};
17810
17779
17811
17811
-
static struct hda_bind_ctls alc663_asus_two_bind_switch = {
17780
17780
+
static const struct hda_bind_ctls alc663_asus_two_bind_switch = {
17812
17781
.ops = &snd_hda_bind_sw,
17813
17782
.values = {
17814
17783
HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
···
17817
17786
},
17818
17787
};
17819
17788
17820
17820
-
static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
17789
17789
+
static const struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
17821
17790
HDA_BIND_VOL("Master Playback Volume",
17822
17791
&alc663_asus_two_bind_master_vol),
17823
17792
HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
···
17828
17797
{ } /* end */
17829
17798
};
17830
17799
17831
17831
-
static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
17800
17800
+
static const struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
17832
17801
HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17833
17802
HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
17834
17803
HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
···
17838
17807
{ } /* end */
17839
17808
};
17840
17809
17841
17841
-
static struct snd_kcontrol_new alc663_g71v_mixer[] = {
17810
17810
+
static const struct snd_kcontrol_new alc663_g71v_mixer[] = {
17842
17811
HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17843
17812
HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17844
17813
HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
···
17852
17821
{ } /* end */
17853
17822
};
17854
17823
17855
17855
-
static struct snd_kcontrol_new alc663_g50v_mixer[] = {
17824
17824
+
static const struct snd_kcontrol_new alc663_g50v_mixer[] = {
17856
17825
HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17857
17826
HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17858
17827
HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
···
17866
17835
{ } /* end */
17867
17836
};
17868
17837
17869
17869
-
static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = {
17838
17838
+
static const struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = {
17870
17839
.ops = &snd_hda_bind_sw,
17871
17840
.values = {
17872
17841
HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
···
17878
17847
},
17879
17848
};
17880
17849
17881
17881
-
static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = {
17850
17850
+
static const struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = {
17882
17851
.ops = &snd_hda_bind_sw,
17883
17852
.values = {
17884
17853
HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
···
17887
17856
},
17888
17857
};
17889
17858
17890
17890
-
static struct snd_kcontrol_new alc663_mode7_mixer[] = {
17859
17859
+
static const struct snd_kcontrol_new alc663_mode7_mixer[] = {
17891
17860
HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
17892
17861
HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
17893
17862
HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
···
17900
17869
{ } /* end */
17901
17870
};
17902
17871
17903
17903
-
static struct snd_kcontrol_new alc663_mode8_mixer[] = {
17872
17872
+
static const struct snd_kcontrol_new alc663_mode8_mixer[] = {
17904
17873
HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
17905
17874
HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
17906
17875
HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
···
17912
17881
};
17913
17882
17914
17883
17915
17915
-
static struct snd_kcontrol_new alc662_chmode_mixer[] = {
17884
17884
+
static const struct snd_kcontrol_new alc662_chmode_mixer[] = {
17916
17885
{
17917
17886
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
17918
17887
.name = "Channel Mode",
···
17923
17892
{ } /* end */
17924
17893
};
17925
17894
17926
17926
-
static struct hda_verb alc662_init_verbs[] = {
17895
17895
+
static const struct hda_verb alc662_init_verbs[] = {
17927
17896
/* ADC: mute amp left and right */
17928
17897
{0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17929
17898
{0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
···
17969
17938
{0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17970
17939
{0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17971
17940
17941
17941
+
{ }
17942
17942
+
};
17943
17943
+
17944
17944
+
static const struct hda_verb alc662_eapd_init_verbs[] = {
17972
17945
/* always trun on EAPD */
17973
17946
{0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
17974
17947
{0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
17975
17975
-
17976
17948
{ }
17977
17949
};
17978
17950
17979
17979
-
static struct hda_verb alc663_init_verbs[] = {
17980
17980
-
{0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17981
17981
-
{0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17982
17982
-
{0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17983
17983
-
{0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17984
17984
-
{0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17985
17985
-
{0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17986
17986
-
{ }
17987
17987
-
};
17988
17988
-
17989
17989
-
static struct hda_verb alc272_init_verbs[] = {
17990
17990
-
{0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17991
17991
-
{0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17992
17992
-
{0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17993
17993
-
{0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17994
17994
-
{0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17995
17995
-
{0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17996
17996
-
{0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17997
17997
-
{0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17998
17998
-
{ }
17999
17999
-
};
18000
18000
-
18001
18001
-
static struct hda_verb alc662_sue_init_verbs[] = {
17951
17951
+
static const struct hda_verb alc662_sue_init_verbs[] = {
18002
17952
{0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
18003
17953
{0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
18004
17954
{}
18005
17955
};
18006
17956
18007
18007
-
static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
17957
17957
+
static const struct hda_verb alc662_eeepc_sue_init_verbs[] = {
18008
17958
{0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18009
17959
{0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18010
17960
{}
18011
17961
};
18012
17962
18013
17963
/* Set Unsolicited Event*/
18014
18014
-
static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
17964
17964
+
static const struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
18015
17965
{0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
18016
17966
{0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18017
17967
{}
18018
17968
};
18019
17969
18020
18020
-
static struct hda_verb alc663_m51va_init_verbs[] = {
17970
17970
+
static const struct hda_verb alc663_m51va_init_verbs[] = {
18021
17971
{0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18022
17972
{0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18023
17973
{0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
···
18011
17999
{}
18012
18000
};
18013
18001
18014
18014
-
static struct hda_verb alc663_21jd_amic_init_verbs[] = {
18002
18002
+
static const struct hda_verb alc663_21jd_amic_init_verbs[] = {
18015
18003
{0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18016
18004
{0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18017
18005
{0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
···
18022
18010
{}
18023
18011
};
18024
18012
18025
18025
-
static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
18013
18013
+
static const struct hda_verb alc662_1bjd_amic_init_verbs[] = {
18026
18014
{0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18027
18015
{0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18028
18016
{0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
···
18034
18022
{}
18035
18023
};
18036
18024
18037
18037
-
static struct hda_verb alc663_15jd_amic_init_verbs[] = {
18025
18025
+
static const struct hda_verb alc663_15jd_amic_init_verbs[] = {
18038
18026
{0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18039
18027
{0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18040
18028
{0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
···
18045
18033
{}
18046
18034
};
18047
18035
18048
18048
-
static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
18036
18036
+
static const struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
18049
18037
{0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18050
18038
{0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18051
18039
{0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
···
18061
18049
{}
18062
18050
};
18063
18051
18064
18064
-
static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
18052
18052
+
static const struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
18065
18053
{0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18066
18054
{0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18067
18055
{0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
···
18077
18065
{}
18078
18066
};
18079
18067
18080
18080
-
static struct hda_verb alc663_g71v_init_verbs[] = {
18068
18068
+
static const struct hda_verb alc663_g71v_init_verbs[] = {
18081
18069
{0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18082
18070
/* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
18083
18071
/* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
···
18092
18080
{}
18093
18081
};
18094
18082
18095
18095
-
static struct hda_verb alc663_g50v_init_verbs[] = {
18083
18083
+
static const struct hda_verb alc663_g50v_init_verbs[] = {
18096
18084
{0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18097
18085
{0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18098
18086
{0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
···
18102
18090
{}
18103
18091
};
18104
18092
18105
18105
-
static struct hda_verb alc662_ecs_init_verbs[] = {
18093
18093
+
static const struct hda_verb alc662_ecs_init_verbs[] = {
18106
18094
{0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
18107
18095
{0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18108
18096
{0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
···
18110
18098
{}
18111
18099
};
18112
18100
18113
18113
-
static struct hda_verb alc272_dell_zm1_init_verbs[] = {
18101
18101
+
static const struct hda_verb alc272_dell_zm1_init_verbs[] = {
18114
18102
{0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18115
18103
{0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18116
18104
{0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
···
18125
18113
{}
18126
18114
};
18127
18115
18128
18128
-
static struct hda_verb alc272_dell_init_verbs[] = {
18116
18116
+
static const struct hda_verb alc272_dell_init_verbs[] = {
18129
18117
{0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18130
18118
{0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18131
18119
{0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
···
18140
18128
{}
18141
18129
};
18142
18130
18143
18143
-
static struct hda_verb alc663_mode7_init_verbs[] = {
18131
18131
+
static const struct hda_verb alc663_mode7_init_verbs[] = {
18144
18132
{0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18145
18133
{0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18146
18134
{0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
···
18159
18147
{}
18160
18148
};
18161
18149
18162
18162
-
static struct hda_verb alc663_mode8_init_verbs[] = {
18150
18150
+
static const struct hda_verb alc663_mode8_init_verbs[] = {
18163
18151
{0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18164
18152
{0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18165
18153
{0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
···
18179
18167
{}
18180
18168
};
18181
18169
18182
18182
-
static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
18170
18170
+
static const struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
18183
18171
HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
18184
18172
HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
18185
18173
{ } /* end */
18186
18174
};
18187
18175
18188
18188
-
static struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
18176
18176
+
static const struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
18189
18177
HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
18190
18178
HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
18191
18179
{ } /* end */
18192
18180
};
18193
18181
18194
18194
-
static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
18182
18182
+
static void alc662_lenovo_101e_setup(struct hda_codec *codec)
18195
18183
{
18196
18196
-
unsigned int present;
18197
18197
-
unsigned char bits;
18184
18184
+
struct alc_spec *spec = codec->spec;
18198
18185
18199
18199
-
present = snd_hda_jack_detect(codec, 0x14);
18200
18200
-
bits = present ? HDA_AMP_MUTE : 0;
18201
18201
-
18202
18202
-
snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
18203
18203
-
HDA_AMP_MUTE, bits);
18204
18204
-
}
18205
18205
-
18206
18206
-
static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
18207
18207
-
{
18208
18208
-
unsigned int present;
18209
18209
-
unsigned char bits;
18210
18210
-
18211
18211
-
present = snd_hda_jack_detect(codec, 0x1b);
18212
18212
-
bits = present ? HDA_AMP_MUTE : 0;
18213
18213
-
18214
18214
-
snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
18215
18215
-
HDA_AMP_MUTE, bits);
18216
18216
-
snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
18217
18217
-
HDA_AMP_MUTE, bits);
18218
18218
-
}
18219
18219
-
18220
18220
-
static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
18221
18221
-
unsigned int res)
18222
18222
-
{
18223
18223
-
if ((res >> 26) == ALC880_HP_EVENT)
18224
18224
-
alc662_lenovo_101e_all_automute(codec);
18225
18225
-
if ((res >> 26) == ALC880_FRONT_EVENT)
18226
18226
-
alc662_lenovo_101e_ispeaker_automute(codec);
18227
18227
-
}
18228
18228
-
18229
18229
-
/* unsolicited event for HP jack sensing */
18230
18230
-
static void alc662_eeepc_unsol_event(struct hda_codec *codec,
18231
18231
-
unsigned int res)
18232
18232
-
{
18233
18233
-
if ((res >> 26) == ALC880_MIC_EVENT)
18234
18234
-
alc_mic_automute(codec);
18235
18235
-
else
18236
18236
-
alc262_hippo_unsol_event(codec, res);
18186
18186
+
spec->autocfg.hp_pins[0] = 0x1b;
18187
18187
+
spec->autocfg.line_out_pins[0] = 0x14;
18188
18188
+
spec->autocfg.speaker_pins[0] = 0x15;
18189
18189
+
spec->automute = 1;
18190
18190
+
spec->detect_line = 1;
18191
18191
+
spec->automute_lines = 1;
18192
18192
+
spec->automute_mode = ALC_AUTOMUTE_AMP;
18237
18193
}
18238
18194
18239
18195
static void alc662_eeepc_setup(struct hda_codec *codec)
···
18216
18236
spec->auto_mic = 1;
18217
18237
}
18218
18238
18219
18219
-
static void alc662_eeepc_inithook(struct hda_codec *codec)
18220
18220
-
{
18221
18221
-
alc262_hippo_automute(codec);
18222
18222
-
alc_mic_automute(codec);
18223
18223
-
}
18224
18224
-
18225
18239
static void alc662_eeepc_ep20_setup(struct hda_codec *codec)
18226
18240
{
18227
18241
struct alc_spec *spec = codec->spec;
18228
18242
18229
18243
spec->autocfg.hp_pins[0] = 0x14;
18230
18244
spec->autocfg.speaker_pins[0] = 0x1b;
18231
18231
-
}
18232
18232
-
18233
18233
-
#define alc662_eeepc_ep20_inithook alc262_hippo_master_update
18234
18234
-
18235
18235
-
static void alc663_m51va_speaker_automute(struct hda_codec *codec)
18236
18236
-
{
18237
18237
-
unsigned int present;
18238
18238
-
unsigned char bits;
18239
18239
-
18240
18240
-
present = snd_hda_jack_detect(codec, 0x21);
18241
18241
-
bits = present ? HDA_AMP_MUTE : 0;
18242
18242
-
snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18243
18243
-
HDA_AMP_MUTE, bits);
18244
18244
-
snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18245
18245
-
HDA_AMP_MUTE, bits);
18246
18246
-
}
18247
18247
-
18248
18248
-
static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
18249
18249
-
{
18250
18250
-
unsigned int present;
18251
18251
-
unsigned char bits;
18252
18252
-
18253
18253
-
present = snd_hda_jack_detect(codec, 0x21);
18254
18254
-
bits = present ? HDA_AMP_MUTE : 0;
18255
18255
-
snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18256
18256
-
HDA_AMP_MUTE, bits);
18257
18257
-
snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18258
18258
-
HDA_AMP_MUTE, bits);
18259
18259
-
snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
18260
18260
-
HDA_AMP_MUTE, bits);
18261
18261
-
snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
18262
18262
-
HDA_AMP_MUTE, bits);
18263
18263
-
}
18264
18264
-
18265
18265
-
static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
18266
18266
-
{
18267
18267
-
unsigned int present;
18268
18268
-
unsigned char bits;
18269
18269
-
18270
18270
-
present = snd_hda_jack_detect(codec, 0x15);
18271
18271
-
bits = present ? HDA_AMP_MUTE : 0;
18272
18272
-
snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18273
18273
-
HDA_AMP_MUTE, bits);
18274
18274
-
snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18275
18275
-
HDA_AMP_MUTE, bits);
18276
18276
-
snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
18277
18277
-
HDA_AMP_MUTE, bits);
18278
18278
-
snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
18279
18279
-
HDA_AMP_MUTE, bits);
18280
18280
-
}
18281
18281
-
18282
18282
-
static void alc662_f5z_speaker_automute(struct hda_codec *codec)
18283
18283
-
{
18284
18284
-
unsigned int present;
18285
18285
-
unsigned char bits;
18286
18286
-
18287
18287
-
present = snd_hda_jack_detect(codec, 0x1b);
18288
18288
-
bits = present ? 0 : PIN_OUT;
18289
18289
-
snd_hda_codec_write(codec, 0x14, 0,
18290
18290
-
AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
18291
18291
-
}
18292
18292
-
18293
18293
-
static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
18294
18294
-
{
18295
18295
-
unsigned int present1, present2;
18296
18296
-
18297
18297
-
present1 = snd_hda_jack_detect(codec, 0x21);
18298
18298
-
present2 = snd_hda_jack_detect(codec, 0x15);
18299
18299
-
18300
18300
-
if (present1 || present2) {
18301
18301
-
snd_hda_codec_write_cache(codec, 0x14, 0,
18302
18302
-
AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18303
18303
-
} else {
18304
18304
-
snd_hda_codec_write_cache(codec, 0x14, 0,
18305
18305
-
AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18306
18306
-
}
18307
18307
-
}
18308
18308
-
18309
18309
-
static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
18310
18310
-
{
18311
18311
-
unsigned int present1, present2;
18312
18312
-
18313
18313
-
present1 = snd_hda_jack_detect(codec, 0x1b);
18314
18314
-
present2 = snd_hda_jack_detect(codec, 0x15);
18315
18315
-
18316
18316
-
if (present1 || present2) {
18317
18317
-
snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18318
18318
-
HDA_AMP_MUTE, HDA_AMP_MUTE);
18319
18319
-
snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18320
18320
-
HDA_AMP_MUTE, HDA_AMP_MUTE);
18321
18321
-
} else {
18322
18322
-
snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18323
18323
-
HDA_AMP_MUTE, 0);
18324
18324
-
snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18325
18325
-
HDA_AMP_MUTE, 0);
18326
18326
-
}
18327
18327
-
}
18328
18328
-
18329
18329
-
static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec)
18330
18330
-
{
18331
18331
-
unsigned int present1, present2;
18332
18332
-
18333
18333
-
present1 = snd_hda_codec_read(codec, 0x1b, 0,
18334
18334
-
AC_VERB_GET_PIN_SENSE, 0)
18335
18335
-
& AC_PINSENSE_PRESENCE;
18336
18336
-
present2 = snd_hda_codec_read(codec, 0x21, 0,
18337
18337
-
AC_VERB_GET_PIN_SENSE, 0)
18338
18338
-
& AC_PINSENSE_PRESENCE;
18339
18339
-
18340
18340
-
if (present1 || present2) {
18341
18341
-
snd_hda_codec_write_cache(codec, 0x14, 0,
18342
18342
-
AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18343
18343
-
snd_hda_codec_write_cache(codec, 0x17, 0,
18344
18344
-
AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18345
18345
-
} else {
18346
18346
-
snd_hda_codec_write_cache(codec, 0x14, 0,
18347
18347
-
AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18348
18348
-
snd_hda_codec_write_cache(codec, 0x17, 0,
18349
18349
-
AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18350
18350
-
}
18351
18351
-
}
18352
18352
-
18353
18353
-
static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec)
18354
18354
-
{
18355
18355
-
unsigned int present1, present2;
18356
18356
-
18357
18357
-
present1 = snd_hda_codec_read(codec, 0x21, 0,
18358
18358
-
AC_VERB_GET_PIN_SENSE, 0)
18359
18359
-
& AC_PINSENSE_PRESENCE;
18360
18360
-
present2 = snd_hda_codec_read(codec, 0x15, 0,
18361
18361
-
AC_VERB_GET_PIN_SENSE, 0)
18362
18362
-
& AC_PINSENSE_PRESENCE;
18363
18363
-
18364
18364
-
if (present1 || present2) {
18365
18365
-
snd_hda_codec_write_cache(codec, 0x14, 0,
18366
18366
-
AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18367
18367
-
snd_hda_codec_write_cache(codec, 0x17, 0,
18368
18368
-
AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18369
18369
-
} else {
18370
18370
-
snd_hda_codec_write_cache(codec, 0x14, 0,
18371
18371
-
AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18372
18372
-
snd_hda_codec_write_cache(codec, 0x17, 0,
18373
18373
-
AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18374
18374
-
}
18375
18375
-
}
18376
18376
-
18377
18377
-
static void alc663_m51va_unsol_event(struct hda_codec *codec,
18378
18378
-
unsigned int res)
18379
18379
-
{
18380
18380
-
switch (res >> 26) {
18381
18381
-
case ALC880_HP_EVENT:
18382
18382
-
alc663_m51va_speaker_automute(codec);
18383
18383
-
break;
18384
18384
-
case ALC880_MIC_EVENT:
18385
18385
-
alc_mic_automute(codec);
18386
18386
-
break;
18387
18387
-
}
18245
18245
+
spec->automute = 1;
18246
18246
+
spec->automute_mode = ALC_AUTOMUTE_AMP;
18388
18247
}
18389
18248
18390
18249
static void alc663_m51va_setup(struct hda_codec *codec)
18391
18250
{
18392
18251
struct alc_spec *spec = codec->spec;
18252
18252
+
spec->autocfg.hp_pins[0] = 0x21;
18253
18253
+
spec->autocfg.speaker_pins[0] = 0x14;
18254
18254
+
spec->automute_mixer_nid[0] = 0x0c;
18255
18255
+
spec->automute = 1;
18256
18256
+
spec->automute_mode = ALC_AUTOMUTE_MIXER;
18393
18257
spec->ext_mic.pin = 0x18;
18394
18258
spec->ext_mic.mux_idx = 0;
18395
18259
spec->int_mic.pin = 0x12;
···
18241
18417
spec->auto_mic = 1;
18242
18418
}
18243
18419
18244
18244
-
static void alc663_m51va_inithook(struct hda_codec *codec)
18245
18245
-
{
18246
18246
-
alc663_m51va_speaker_automute(codec);
18247
18247
-
alc_mic_automute(codec);
18248
18248
-
}
18249
18249
-
18250
18420
/* ***************** Mode1 ******************************/
18251
18251
-
#define alc663_mode1_unsol_event alc663_m51va_unsol_event
18252
18252
-
18253
18421
static void alc663_mode1_setup(struct hda_codec *codec)
18254
18422
{
18255
18423
struct alc_spec *spec = codec->spec;
18424
18424
+
spec->autocfg.hp_pins[0] = 0x21;
18425
18425
+
spec->autocfg.speaker_pins[0] = 0x14;
18426
18426
+
spec->automute_mixer_nid[0] = 0x0c;
18427
18427
+
spec->automute = 1;
18428
18428
+
spec->automute_mode = ALC_AUTOMUTE_MIXER;
18256
18429
spec->ext_mic.pin = 0x18;
18257
18430
spec->ext_mic.mux_idx = 0;
18258
18431
spec->int_mic.pin = 0x19;
···
18257
18436
spec->auto_mic = 1;
18258
18437
}
18259
18438
18260
18260
-
#define alc663_mode1_inithook alc663_m51va_inithook
18261
18261
-
18262
18439
/* ***************** Mode2 ******************************/
18263
18263
-
static void alc662_mode2_unsol_event(struct hda_codec *codec,
18264
18264
-
unsigned int res)
18440
18440
+
static void alc662_mode2_setup(struct hda_codec *codec)
18265
18441
{
18266
18266
-
switch (res >> 26) {
18267
18267
-
case ALC880_HP_EVENT:
18268
18268
-
alc662_f5z_speaker_automute(codec);
18269
18269
-
break;
18270
18270
-
case ALC880_MIC_EVENT:
18271
18271
-
alc_mic_automute(codec);
18272
18272
-
break;
18273
18273
-
}
18442
18442
+
struct alc_spec *spec = codec->spec;
18443
18443
+
spec->autocfg.hp_pins[0] = 0x1b;
18444
18444
+
spec->autocfg.speaker_pins[0] = 0x14;
18445
18445
+
spec->automute = 1;
18446
18446
+
spec->automute_mode = ALC_AUTOMUTE_PIN;
18447
18447
+
spec->ext_mic.pin = 0x18;
18448
18448
+
spec->ext_mic.mux_idx = 0;
18449
18449
+
spec->int_mic.pin = 0x19;
18450
18450
+
spec->int_mic.mux_idx = 1;
18451
18451
+
spec->auto_mic = 1;
18274
18452
}
18275
18453
18276
18276
-
#define alc662_mode2_setup alc663_mode1_setup
18277
18277
-
18278
18278
-
static void alc662_mode2_inithook(struct hda_codec *codec)
18279
18279
-
{
18280
18280
-
alc662_f5z_speaker_automute(codec);
18281
18281
-
alc_mic_automute(codec);
18282
18282
-
}
18283
18454
/* ***************** Mode3 ******************************/
18284
18284
-
static void alc663_mode3_unsol_event(struct hda_codec *codec,
18285
18285
-
unsigned int res)
18455
18455
+
static void alc663_mode3_setup(struct hda_codec *codec)
18286
18456
{
18287
18287
-
switch (res >> 26) {
18288
18288
-
case ALC880_HP_EVENT:
18289
18289
-
alc663_two_hp_m1_speaker_automute(codec);
18290
18290
-
break;
18291
18291
-
case ALC880_MIC_EVENT:
18292
18292
-
alc_mic_automute(codec);
18293
18293
-
break;
18294
18294
-
}
18457
18457
+
struct alc_spec *spec = codec->spec;
18458
18458
+
spec->autocfg.hp_pins[0] = 0x21;
18459
18459
+
spec->autocfg.hp_pins[0] = 0x15;
18460
18460
+
spec->autocfg.speaker_pins[0] = 0x14;
18461
18461
+
spec->automute = 1;
18462
18462
+
spec->automute_mode = ALC_AUTOMUTE_PIN;
18463
18463
+
spec->ext_mic.pin = 0x18;
18464
18464
+
spec->ext_mic.mux_idx = 0;
18465
18465
+
spec->int_mic.pin = 0x19;
18466
18466
+
spec->int_mic.mux_idx = 1;
18467
18467
+
spec->auto_mic = 1;
18295
18468
}
18296
18469
18297
18297
-
#define alc663_mode3_setup alc663_mode1_setup
18298
18298
-
18299
18299
-
static void alc663_mode3_inithook(struct hda_codec *codec)
18300
18300
-
{
18301
18301
-
alc663_two_hp_m1_speaker_automute(codec);
18302
18302
-
alc_mic_automute(codec);
18303
18303
-
}
18304
18470
/* ***************** Mode4 ******************************/
18305
18305
-
static void alc663_mode4_unsol_event(struct hda_codec *codec,
18306
18306
-
unsigned int res)
18471
18471
+
static void alc663_mode4_setup(struct hda_codec *codec)
18307
18472
{
18308
18308
-
switch (res >> 26) {
18309
18309
-
case ALC880_HP_EVENT:
18310
18310
-
alc663_21jd_two_speaker_automute(codec);
18311
18311
-
break;
18312
18312
-
case ALC880_MIC_EVENT:
18313
18313
-
alc_mic_automute(codec);
18314
18314
-
break;
18315
18315
-
}
18473
18473
+
struct alc_spec *spec = codec->spec;
18474
18474
+
spec->autocfg.hp_pins[0] = 0x21;
18475
18475
+
spec->autocfg.speaker_pins[0] = 0x14;
18476
18476
+
spec->autocfg.speaker_pins[1] = 0x16;
18477
18477
+
spec->automute_mixer_nid[0] = 0x0c;
18478
18478
+
spec->automute_mixer_nid[1] = 0x0e;
18479
18479
+
spec->automute = 1;
18480
18480
+
spec->automute_mode = ALC_AUTOMUTE_MIXER;
18481
18481
+
spec->ext_mic.pin = 0x18;
18482
18482
+
spec->ext_mic.mux_idx = 0;
18483
18483
+
spec->int_mic.pin = 0x19;
18484
18484
+
spec->int_mic.mux_idx = 1;
18485
18485
+
spec->auto_mic = 1;
18316
18486
}
18317
18487
18318
18318
-
#define alc663_mode4_setup alc663_mode1_setup
18319
18319
-
18320
18320
-
static void alc663_mode4_inithook(struct hda_codec *codec)
18321
18321
-
{
18322
18322
-
alc663_21jd_two_speaker_automute(codec);
18323
18323
-
alc_mic_automute(codec);
18324
18324
-
}
18325
18488
/* ***************** Mode5 ******************************/
18326
18326
-
static void alc663_mode5_unsol_event(struct hda_codec *codec,
18327
18327
-
unsigned int res)
18489
18489
+
static void alc663_mode5_setup(struct hda_codec *codec)
18328
18490
{
18329
18329
-
switch (res >> 26) {
18330
18330
-
case ALC880_HP_EVENT:
18331
18331
-
alc663_15jd_two_speaker_automute(codec);
18332
18332
-
break;
18333
18333
-
case ALC880_MIC_EVENT:
18334
18334
-
alc_mic_automute(codec);
18335
18335
-
break;
18336
18336
-
}
18491
18491
+
struct alc_spec *spec = codec->spec;
18492
18492
+
spec->autocfg.hp_pins[0] = 0x15;
18493
18493
+
spec->autocfg.speaker_pins[0] = 0x14;
18494
18494
+
spec->autocfg.speaker_pins[1] = 0x16;
18495
18495
+
spec->automute_mixer_nid[0] = 0x0c;
18496
18496
+
spec->automute_mixer_nid[1] = 0x0e;
18497
18497
+
spec->automute = 1;
18498
18498
+
spec->automute_mode = ALC_AUTOMUTE_MIXER;
18499
18499
+
spec->ext_mic.pin = 0x18;
18500
18500
+
spec->ext_mic.mux_idx = 0;
18501
18501
+
spec->int_mic.pin = 0x19;
18502
18502
+
spec->int_mic.mux_idx = 1;
18503
18503
+
spec->auto_mic = 1;
18337
18504
}
18338
18505
18339
18339
-
#define alc663_mode5_setup alc663_mode1_setup
18340
18340
-
18341
18341
-
static void alc663_mode5_inithook(struct hda_codec *codec)
18342
18342
-
{
18343
18343
-
alc663_15jd_two_speaker_automute(codec);
18344
18344
-
alc_mic_automute(codec);
18345
18345
-
}
18346
18506
/* ***************** Mode6 ******************************/
18347
18347
-
static void alc663_mode6_unsol_event(struct hda_codec *codec,
18348
18348
-
unsigned int res)
18507
18507
+
static void alc663_mode6_setup(struct hda_codec *codec)
18349
18508
{
18350
18350
-
switch (res >> 26) {
18351
18351
-
case ALC880_HP_EVENT:
18352
18352
-
alc663_two_hp_m2_speaker_automute(codec);
18353
18353
-
break;
18354
18354
-
case ALC880_MIC_EVENT:
18355
18355
-
alc_mic_automute(codec);
18356
18356
-
break;
18357
18357
-
}
18358
18358
-
}
18359
18359
-
18360
18360
-
#define alc663_mode6_setup alc663_mode1_setup
18361
18361
-
18362
18362
-
static void alc663_mode6_inithook(struct hda_codec *codec)
18363
18363
-
{
18364
18364
-
alc663_two_hp_m2_speaker_automute(codec);
18365
18365
-
alc_mic_automute(codec);
18509
18509
+
struct alc_spec *spec = codec->spec;
18510
18510
+
spec->autocfg.hp_pins[0] = 0x1b;
18511
18511
+
spec->autocfg.hp_pins[0] = 0x15;
18512
18512
+
spec->autocfg.speaker_pins[0] = 0x14;
18513
18513
+
spec->automute_mixer_nid[0] = 0x0c;
18514
18514
+
spec->automute = 1;
18515
18515
+
spec->automute_mode = ALC_AUTOMUTE_MIXER;
18516
18516
+
spec->ext_mic.pin = 0x18;
18517
18517
+
spec->ext_mic.mux_idx = 0;
18518
18518
+
spec->int_mic.pin = 0x19;
18519
18519
+
spec->int_mic.mux_idx = 1;
18520
18520
+
spec->auto_mic = 1;
18366
18521
}
18367
18522
18368
18523
/* ***************** Mode7 ******************************/
18369
18369
-
static void alc663_mode7_unsol_event(struct hda_codec *codec,
18370
18370
-
unsigned int res)
18524
18524
+
static void alc663_mode7_setup(struct hda_codec *codec)
18371
18525
{
18372
18372
-
switch (res >> 26) {
18373
18373
-
case ALC880_HP_EVENT:
18374
18374
-
alc663_two_hp_m7_speaker_automute(codec);
18375
18375
-
break;
18376
18376
-
case ALC880_MIC_EVENT:
18377
18377
-
alc_mic_automute(codec);
18378
18378
-
break;
18379
18379
-
}
18380
18380
-
}
18381
18381
-
18382
18382
-
#define alc663_mode7_setup alc663_mode1_setup
18383
18383
-
18384
18384
-
static void alc663_mode7_inithook(struct hda_codec *codec)
18385
18385
-
{
18386
18386
-
alc663_two_hp_m7_speaker_automute(codec);
18387
18387
-
alc_mic_automute(codec);
18526
18526
+
struct alc_spec *spec = codec->spec;
18527
18527
+
spec->autocfg.hp_pins[0] = 0x1b;
18528
18528
+
spec->autocfg.hp_pins[0] = 0x21;
18529
18529
+
spec->autocfg.speaker_pins[0] = 0x14;
18530
18530
+
spec->autocfg.speaker_pins[0] = 0x17;
18531
18531
+
spec->automute = 1;
18532
18532
+
spec->automute_mode = ALC_AUTOMUTE_PIN;
18533
18533
+
spec->ext_mic.pin = 0x18;
18534
18534
+
spec->ext_mic.mux_idx = 0;
18535
18535
+
spec->int_mic.pin = 0x19;
18536
18536
+
spec->int_mic.mux_idx = 1;
18537
18537
+
spec->auto_mic = 1;
18388
18538
}
18389
18539
18390
18540
/* ***************** Mode8 ******************************/
18391
18391
-
static void alc663_mode8_unsol_event(struct hda_codec *codec,
18392
18392
-
unsigned int res)
18541
18541
+
static void alc663_mode8_setup(struct hda_codec *codec)
18393
18542
{
18394
18394
-
switch (res >> 26) {
18395
18395
-
case ALC880_HP_EVENT:
18396
18396
-
alc663_two_hp_m8_speaker_automute(codec);
18397
18397
-
break;
18398
18398
-
case ALC880_MIC_EVENT:
18399
18399
-
alc_mic_automute(codec);
18400
18400
-
break;
18401
18401
-
}
18543
18543
+
struct alc_spec *spec = codec->spec;
18544
18544
+
spec->autocfg.hp_pins[0] = 0x21;
18545
18545
+
spec->autocfg.hp_pins[1] = 0x15;
18546
18546
+
spec->autocfg.speaker_pins[0] = 0x14;
18547
18547
+
spec->autocfg.speaker_pins[0] = 0x17;
18548
18548
+
spec->automute = 1;
18549
18549
+
spec->automute_mode = ALC_AUTOMUTE_PIN;
18550
18550
+
spec->ext_mic.pin = 0x18;
18551
18551
+
spec->ext_mic.mux_idx = 0;
18552
18552
+
spec->int_mic.pin = 0x12;
18553
18553
+
spec->int_mic.mux_idx = 9;
18554
18554
+
spec->auto_mic = 1;
18402
18555
}
18403
18556
18404
18404
-
#define alc663_mode8_setup alc663_m51va_setup
18405
18405
-
18406
18406
-
static void alc663_mode8_inithook(struct hda_codec *codec)
18557
18557
+
static void alc663_g71v_setup(struct hda_codec *codec)
18407
18558
{
18408
18408
-
alc663_two_hp_m8_speaker_automute(codec);
18409
18409
-
alc_mic_automute(codec);
18410
18410
-
}
18411
18411
-
18412
18412
-
static void alc663_g71v_hp_automute(struct hda_codec *codec)
18413
18413
-
{
18414
18414
-
unsigned int present;
18415
18415
-
unsigned char bits;
18416
18416
-
18417
18417
-
present = snd_hda_jack_detect(codec, 0x21);
18418
18418
-
bits = present ? HDA_AMP_MUTE : 0;
18419
18419
-
snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
18420
18420
-
HDA_AMP_MUTE, bits);
18421
18421
-
snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
18422
18422
-
HDA_AMP_MUTE, bits);
18423
18423
-
}
18424
18424
-
18425
18425
-
static void alc663_g71v_front_automute(struct hda_codec *codec)
18426
18426
-
{
18427
18427
-
unsigned int present;
18428
18428
-
unsigned char bits;
18429
18429
-
18430
18430
-
present = snd_hda_jack_detect(codec, 0x15);
18431
18431
-
bits = present ? HDA_AMP_MUTE : 0;
18432
18432
-
snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
18433
18433
-
HDA_AMP_MUTE, bits);
18434
18434
-
}
18435
18435
-
18436
18436
-
static void alc663_g71v_unsol_event(struct hda_codec *codec,
18437
18437
-
unsigned int res)
18438
18438
-
{
18439
18439
-
switch (res >> 26) {
18440
18440
-
case ALC880_HP_EVENT:
18441
18441
-
alc663_g71v_hp_automute(codec);
18442
18442
-
break;
18443
18443
-
case ALC880_FRONT_EVENT:
18444
18444
-
alc663_g71v_front_automute(codec);
18445
18445
-
break;
18446
18446
-
case ALC880_MIC_EVENT:
18447
18447
-
alc_mic_automute(codec);
18448
18448
-
break;
18449
18449
-
}
18450
18450
-
}
18451
18451
-
18452
18452
-
#define alc663_g71v_setup alc663_m51va_setup
18453
18453
-
18454
18454
-
static void alc663_g71v_inithook(struct hda_codec *codec)
18455
18455
-
{
18456
18456
-
alc663_g71v_front_automute(codec);
18457
18457
-
alc663_g71v_hp_automute(codec);
18458
18458
-
alc_mic_automute(codec);
18459
18459
-
}
18460
18460
-
18461
18461
-
static void alc663_g50v_unsol_event(struct hda_codec *codec,
18462
18462
-
unsigned int res)
18463
18463
-
{
18464
18464
-
switch (res >> 26) {
18465
18465
-
case ALC880_HP_EVENT:
18466
18466
-
alc663_m51va_speaker_automute(codec);
18467
18467
-
break;
18468
18468
-
case ALC880_MIC_EVENT:
18469
18469
-
alc_mic_automute(codec);
18470
18470
-
break;
18471
18471
-
}
18559
18559
+
struct alc_spec *spec = codec->spec;
18560
18560
+
spec->autocfg.hp_pins[0] = 0x21;
18561
18561
+
spec->autocfg.line_out_pins[0] = 0x15;
18562
18562
+
spec->autocfg.speaker_pins[0] = 0x14;
18563
18563
+
spec->automute = 1;
18564
18564
+
spec->automute_mode = ALC_AUTOMUTE_AMP;
18565
18565
+
spec->detect_line = 1;
18566
18566
+
spec->automute_lines = 1;
18567
18567
+
spec->ext_mic.pin = 0x18;
18568
18568
+
spec->ext_mic.mux_idx = 0;
18569
18569
+
spec->int_mic.pin = 0x12;
18570
18570
+
spec->int_mic.mux_idx = 9;
18571
18571
+
spec->auto_mic = 1;
18472
18572
}
18473
18573
18474
18574
#define alc663_g50v_setup alc663_m51va_setup
18475
18575
18476
18476
-
static void alc663_g50v_inithook(struct hda_codec *codec)
18477
18477
-
{
18478
18478
-
alc663_m51va_speaker_automute(codec);
18479
18479
-
alc_mic_automute(codec);
18480
18480
-
}
18481
18481
-
18482
18482
-
static struct snd_kcontrol_new alc662_ecs_mixer[] = {
18576
18576
+
static const struct snd_kcontrol_new alc662_ecs_mixer[] = {
18483
18577
HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
18484
18578
ALC262_HIPPO_MASTER_SWITCH,
18485
18579
···
18408
18672
{ } /* end */
18409
18673
};
18410
18674
18411
18411
-
static struct snd_kcontrol_new alc272_nc10_mixer[] = {
18675
18675
+
static const struct snd_kcontrol_new alc272_nc10_mixer[] = {
18412
18676
/* Master Playback automatically created from Speaker and Headphone */
18413
18677
HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
18414
18678
HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
···
18443
18707
[ALC662_3ST_2ch_DIG] = "3stack-dig",
18444
18708
[ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
18445
18709
[ALC662_3ST_6ch] = "3stack-6ch",
18446
18446
-
[ALC662_5ST_DIG] = "6stack-dig",
18710
18710
+
[ALC662_5ST_DIG] = "5stack-dig",
18447
18711
[ALC662_LENOVO_101E] = "lenovo-101e",
18448
18712
[ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
18449
18713
[ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
···
18466
18730
[ALC662_AUTO] = "auto",
18467
18731
};
18468
18732
18469
18469
-
static struct snd_pci_quirk alc662_cfg_tbl[] = {
18733
18733
+
static const struct snd_pci_quirk alc662_cfg_tbl[] = {
18470
18734
SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
18471
18735
SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
18472
18736
SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
···
18548
18812
{}
18549
18813
};
18550
18814
18551
18551
-
static struct alc_config_preset alc662_presets[] = {
18815
18815
+
static const struct alc_config_preset alc662_presets[] = {
18552
18816
[ALC662_3ST_2ch_DIG] = {
18553
18817
.mixers = { alc662_3ST_2ch_mixer },
18554
18554
-
.init_verbs = { alc662_init_verbs },
18818
18818
+
.init_verbs = { alc662_init_verbs, alc662_eapd_init_verbs },
18555
18819
.num_dacs = ARRAY_SIZE(alc662_dac_nids),
18556
18820
.dac_nids = alc662_dac_nids,
18557
18821
.dig_out_nid = ALC662_DIGOUT_NID,
···
18562
18826
},
18563
18827
[ALC662_3ST_6ch_DIG] = {
18564
18828
.mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
18565
18565
-
.init_verbs = { alc662_init_verbs },
18829
18829
+
.init_verbs = { alc662_init_verbs, alc662_eapd_init_verbs },
18566
18830
.num_dacs = ARRAY_SIZE(alc662_dac_nids),
18567
18831
.dac_nids = alc662_dac_nids,
18568
18832
.dig_out_nid = ALC662_DIGOUT_NID,
···
18574
18838
},
18575
18839
[ALC662_3ST_6ch] = {
18576
18840
.mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
18577
18577
-
.init_verbs = { alc662_init_verbs },
18841
18841
+
.init_verbs = { alc662_init_verbs, alc662_eapd_init_verbs },
18578
18842
.num_dacs = ARRAY_SIZE(alc662_dac_nids),
18579
18843
.dac_nids = alc662_dac_nids,
18580
18844
.num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
···
18584
18848
},
18585
18849
[ALC662_5ST_DIG] = {
18586
18850
.mixers = { alc662_base_mixer, alc662_chmode_mixer },
18587
18587
-
.init_verbs = { alc662_init_verbs },
18851
18851
+
.init_verbs = { alc662_init_verbs, alc662_eapd_init_verbs },
18588
18852
.num_dacs = ARRAY_SIZE(alc662_dac_nids),
18589
18853
.dac_nids = alc662_dac_nids,
18590
18854
.dig_out_nid = ALC662_DIGOUT_NID,
···
18595
18859
},
18596
18860
[ALC662_LENOVO_101E] = {
18597
18861
.mixers = { alc662_lenovo_101e_mixer },
18598
18598
-
.init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
18862
18862
+
.init_verbs = { alc662_init_verbs,
18863
18863
+
alc662_eapd_init_verbs,
18864
18864
+
alc662_sue_init_verbs },
18599
18865
.num_dacs = ARRAY_SIZE(alc662_dac_nids),
18600
18866
.dac_nids = alc662_dac_nids,
18601
18867
.num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18602
18868
.channel_mode = alc662_3ST_2ch_modes,
18603
18869
.input_mux = &alc662_lenovo_101e_capture_source,
18604
18604
-
.unsol_event = alc662_lenovo_101e_unsol_event,
18605
18605
-
.init_hook = alc662_lenovo_101e_all_automute,
18870
18870
+
.unsol_event = alc_sku_unsol_event,
18871
18871
+
.setup = alc662_lenovo_101e_setup,
18872
18872
+
.init_hook = alc_inithook,
18606
18873
},
18607
18874
[ALC662_ASUS_EEEPC_P701] = {
18608
18875
.mixers = { alc662_eeepc_p701_mixer },
18609
18876
.init_verbs = { alc662_init_verbs,
18877
18877
+
alc662_eapd_init_verbs,
18610
18878
alc662_eeepc_sue_init_verbs },
18611
18879
.num_dacs = ARRAY_SIZE(alc662_dac_nids),
18612
18880
.dac_nids = alc662_dac_nids,
18613
18881
.num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18614
18882
.channel_mode = alc662_3ST_2ch_modes,
18615
18615
-
.unsol_event = alc662_eeepc_unsol_event,
18883
18883
+
.unsol_event = alc_sku_unsol_event,
18616
18884
.setup = alc662_eeepc_setup,
18617
18617
-
.init_hook = alc662_eeepc_inithook,
18885
18885
+
.init_hook = alc_inithook,
18618
18886
},
18619
18887
[ALC662_ASUS_EEEPC_EP20] = {
18620
18888
.mixers = { alc662_eeepc_ep20_mixer,
18621
18889
alc662_chmode_mixer },
18622
18890
.init_verbs = { alc662_init_verbs,
18891
18891
+
alc662_eapd_init_verbs,
18623
18892
alc662_eeepc_ep20_sue_init_verbs },
18624
18893
.num_dacs = ARRAY_SIZE(alc662_dac_nids),
18625
18894
.dac_nids = alc662_dac_nids,
18626
18895
.num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18627
18896
.channel_mode = alc662_3ST_6ch_modes,
18628
18897
.input_mux = &alc662_lenovo_101e_capture_source,
18629
18629
-
.unsol_event = alc662_eeepc_unsol_event,
18898
18898
+
.unsol_event = alc_sku_unsol_event,
18630
18899
.setup = alc662_eeepc_ep20_setup,
18631
18631
-
.init_hook = alc662_eeepc_ep20_inithook,
18900
18900
+
.init_hook = alc_inithook,
18632
18901
},
18633
18902
[ALC662_ECS] = {
18634
18903
.mixers = { alc662_ecs_mixer },
18635
18904
.init_verbs = { alc662_init_verbs,
18905
18905
+
alc662_eapd_init_verbs,
18636
18906
alc662_ecs_init_verbs },
18637
18907
.num_dacs = ARRAY_SIZE(alc662_dac_nids),
18638
18908
.dac_nids = alc662_dac_nids,
18639
18909
.num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18640
18910
.channel_mode = alc662_3ST_2ch_modes,
18641
18641
-
.unsol_event = alc662_eeepc_unsol_event,
18911
18911
+
.unsol_event = alc_sku_unsol_event,
18642
18912
.setup = alc662_eeepc_setup,
18643
18643
-
.init_hook = alc662_eeepc_inithook,
18913
18913
+
.init_hook = alc_inithook,
18644
18914
},
18645
18915
[ALC663_ASUS_M51VA] = {
18646
18916
.mixers = { alc663_m51va_mixer },
18647
18647
-
.init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
18917
18917
+
.init_verbs = { alc662_init_verbs,
18918
18918
+
alc662_eapd_init_verbs,
18919
18919
+
alc663_m51va_init_verbs },
18648
18920
.num_dacs = ARRAY_SIZE(alc662_dac_nids),
18649
18921
.dac_nids = alc662_dac_nids,
18650
18922
.dig_out_nid = ALC662_DIGOUT_NID,
18651
18923
.num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18652
18924
.channel_mode = alc662_3ST_2ch_modes,
18653
18653
-
.unsol_event = alc663_m51va_unsol_event,
18925
18925
+
.unsol_event = alc_sku_unsol_event,
18654
18926
.setup = alc663_m51va_setup,
18655
18655
-
.init_hook = alc663_m51va_inithook,
18927
18927
+
.init_hook = alc_inithook,
18656
18928
},
18657
18929
[ALC663_ASUS_G71V] = {
18658
18930
.mixers = { alc663_g71v_mixer },
18659
18659
-
.init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
18931
18931
+
.init_verbs = { alc662_init_verbs,
18932
18932
+
alc662_eapd_init_verbs,
18933
18933
+
alc663_g71v_init_verbs },
18660
18934
.num_dacs = ARRAY_SIZE(alc662_dac_nids),
18661
18935
.dac_nids = alc662_dac_nids,
18662
18936
.dig_out_nid = ALC662_DIGOUT_NID,
18663
18937
.num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18664
18938
.channel_mode = alc662_3ST_2ch_modes,
18665
18665
-
.unsol_event = alc663_g71v_unsol_event,
18939
18939
+
.unsol_event = alc_sku_unsol_event,
18666
18940
.setup = alc663_g71v_setup,
18667
18667
-
.init_hook = alc663_g71v_inithook,
18941
18941
+
.init_hook = alc_inithook,
18668
18942
},
18669
18943
[ALC663_ASUS_H13] = {
18670
18944
.mixers = { alc663_m51va_mixer },
18671
18671
-
.init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
18945
18945
+
.init_verbs = { alc662_init_verbs,
18946
18946
+
alc662_eapd_init_verbs,
18947
18947
+
alc663_m51va_init_verbs },
18672
18948
.num_dacs = ARRAY_SIZE(alc662_dac_nids),
18673
18949
.dac_nids = alc662_dac_nids,
18674
18950
.num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18675
18951
.channel_mode = alc662_3ST_2ch_modes,
18676
18676
-
.unsol_event = alc663_m51va_unsol_event,
18677
18677
-
.init_hook = alc663_m51va_inithook,
18952
18952
+
.setup = alc663_m51va_setup,
18953
18953
+
.unsol_event = alc_sku_unsol_event,
18954
18954
+
.init_hook = alc_inithook,
18678
18955
},
18679
18956
[ALC663_ASUS_G50V] = {
18680
18957
.mixers = { alc663_g50v_mixer },
18681
18681
-
.init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
18958
18958
+
.init_verbs = { alc662_init_verbs,
18959
18959
+
alc662_eapd_init_verbs,
18960
18960
+
alc663_g50v_init_verbs },
18682
18961
.num_dacs = ARRAY_SIZE(alc662_dac_nids),
18683
18962
.dac_nids = alc662_dac_nids,
18684
18963
.dig_out_nid = ALC662_DIGOUT_NID,
18685
18964
.num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18686
18965
.channel_mode = alc662_3ST_6ch_modes,
18687
18966
.input_mux = &alc663_capture_source,
18688
18688
-
.unsol_event = alc663_g50v_unsol_event,
18967
18967
+
.unsol_event = alc_sku_unsol_event,
18689
18968
.setup = alc663_g50v_setup,
18690
18690
-
.init_hook = alc663_g50v_inithook,
18969
18969
+
.init_hook = alc_inithook,
18691
18970
},
18692
18971
[ALC663_ASUS_MODE1] = {
18693
18972
.mixers = { alc663_m51va_mixer },
18694
18973
.cap_mixer = alc662_auto_capture_mixer,
18695
18974
.init_verbs = { alc662_init_verbs,
18975
18975
+
alc662_eapd_init_verbs,
18696
18976
alc663_21jd_amic_init_verbs },
18697
18977
.num_dacs = ARRAY_SIZE(alc662_dac_nids),
18698
18978
.hp_nid = 0x03,
···
18716
18964
.dig_out_nid = ALC662_DIGOUT_NID,
18717
18965
.num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18718
18966
.channel_mode = alc662_3ST_2ch_modes,
18719
18719
-
.unsol_event = alc663_mode1_unsol_event,
18967
18967
+
.unsol_event = alc_sku_unsol_event,
18720
18968
.setup = alc663_mode1_setup,
18721
18721
-
.init_hook = alc663_mode1_inithook,
18969
18969
+
.init_hook = alc_inithook,
18722
18970
},
18723
18971
[ALC662_ASUS_MODE2] = {
18724
18972
.mixers = { alc662_1bjd_mixer },
18725
18973
.cap_mixer = alc662_auto_capture_mixer,
18726
18974
.init_verbs = { alc662_init_verbs,
18975
18975
+
alc662_eapd_init_verbs,
18727
18976
alc662_1bjd_amic_init_verbs },
18728
18977
.num_dacs = ARRAY_SIZE(alc662_dac_nids),
18729
18978
.dac_nids = alc662_dac_nids,
18730
18979
.dig_out_nid = ALC662_DIGOUT_NID,
18731
18980
.num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18732
18981
.channel_mode = alc662_3ST_2ch_modes,
18733
18733
-
.unsol_event = alc662_mode2_unsol_event,
18982
18982
+
.unsol_event = alc_sku_unsol_event,
18734
18983
.setup = alc662_mode2_setup,
18735
18735
-
.init_hook = alc662_mode2_inithook,
18984
18984
+
.init_hook = alc_inithook,
18736
18985
},
18737
18986
[ALC663_ASUS_MODE3] = {
18738
18987
.mixers = { alc663_two_hp_m1_mixer },
18739
18988
.cap_mixer = alc662_auto_capture_mixer,
18740
18989
.init_verbs = { alc662_init_verbs,
18990
18990
+
alc662_eapd_init_verbs,
18741
18991
alc663_two_hp_amic_m1_init_verbs },
18742
18992
.num_dacs = ARRAY_SIZE(alc662_dac_nids),
18743
18993
.hp_nid = 0x03,
···
18747
18993
.dig_out_nid = ALC662_DIGOUT_NID,
18748
18994
.num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18749
18995
.channel_mode = alc662_3ST_2ch_modes,
18750
18750
-
.unsol_event = alc663_mode3_unsol_event,
18996
18996
+
.unsol_event = alc_sku_unsol_event,
18751
18997
.setup = alc663_mode3_setup,
18752
18752
-
.init_hook = alc663_mode3_inithook,
18998
18998
+
.init_hook = alc_inithook,
18753
18999
},
18754
19000
[ALC663_ASUS_MODE4] = {
18755
19001
.mixers = { alc663_asus_21jd_clfe_mixer },
18756
19002
.cap_mixer = alc662_auto_capture_mixer,
18757
19003
.init_verbs = { alc662_init_verbs,
19004
19004
+
alc662_eapd_init_verbs,
18758
19005
alc663_21jd_amic_init_verbs},
18759
19006
.num_dacs = ARRAY_SIZE(alc662_dac_nids),
18760
19007
.hp_nid = 0x03,
···
18763
19008
.dig_out_nid = ALC662_DIGOUT_NID,
18764
19009
.num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18765
19010
.channel_mode = alc662_3ST_2ch_modes,
18766
18766
-
.unsol_event = alc663_mode4_unsol_event,
19011
19011
+
.unsol_event = alc_sku_unsol_event,
18767
19012
.setup = alc663_mode4_setup,
18768
18768
-
.init_hook = alc663_mode4_inithook,
19013
19013
+
.init_hook = alc_inithook,
18769
19014
},
18770
19015
[ALC663_ASUS_MODE5] = {
18771
19016
.mixers = { alc663_asus_15jd_clfe_mixer },
18772
19017
.cap_mixer = alc662_auto_capture_mixer,
18773
19018
.init_verbs = { alc662_init_verbs,
19019
19019
+
alc662_eapd_init_verbs,
18774
19020
alc663_15jd_amic_init_verbs },
18775
19021
.num_dacs = ARRAY_SIZE(alc662_dac_nids),
18776
19022
.hp_nid = 0x03,
···
18779
19023
.dig_out_nid = ALC662_DIGOUT_NID,
18780
19024
.num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18781
19025
.channel_mode = alc662_3ST_2ch_modes,
18782
18782
-
.unsol_event = alc663_mode5_unsol_event,
19026
19026
+
.unsol_event = alc_sku_unsol_event,
18783
19027
.setup = alc663_mode5_setup,
18784
18784
-
.init_hook = alc663_mode5_inithook,
19028
19028
+
.init_hook = alc_inithook,
18785
19029
},
18786
19030
[ALC663_ASUS_MODE6] = {
18787
19031
.mixers = { alc663_two_hp_m2_mixer },
18788
19032
.cap_mixer = alc662_auto_capture_mixer,
18789
19033
.init_verbs = { alc662_init_verbs,
19034
19034
+
alc662_eapd_init_verbs,
18790
19035
alc663_two_hp_amic_m2_init_verbs },
18791
19036
.num_dacs = ARRAY_SIZE(alc662_dac_nids),
18792
19037
.hp_nid = 0x03,
···
18795
19038
.dig_out_nid = ALC662_DIGOUT_NID,
18796
19039
.num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18797
19040
.channel_mode = alc662_3ST_2ch_modes,
18798
18798
-
.unsol_event = alc663_mode6_unsol_event,
19041
19041
+
.unsol_event = alc_sku_unsol_event,
18799
19042
.setup = alc663_mode6_setup,
18800
18800
-
.init_hook = alc663_mode6_inithook,
19043
19043
+
.init_hook = alc_inithook,
18801
19044
},
18802
19045
[ALC663_ASUS_MODE7] = {
18803
19046
.mixers = { alc663_mode7_mixer },
18804
19047
.cap_mixer = alc662_auto_capture_mixer,
18805
19048
.init_verbs = { alc662_init_verbs,
19049
19049
+
alc662_eapd_init_verbs,
18806
19050
alc663_mode7_init_verbs },
18807
19051
.num_dacs = ARRAY_SIZE(alc662_dac_nids),
18808
19052
.hp_nid = 0x03,
···
18811
19053
.dig_out_nid = ALC662_DIGOUT_NID,
18812
19054
.num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18813
19055
.channel_mode = alc662_3ST_2ch_modes,
18814
18814
-
.unsol_event = alc663_mode7_unsol_event,
19056
19056
+
.unsol_event = alc_sku_unsol_event,
18815
19057
.setup = alc663_mode7_setup,
18816
18816
-
.init_hook = alc663_mode7_inithook,
19058
19058
+
.init_hook = alc_inithook,
18817
19059
},
18818
19060
[ALC663_ASUS_MODE8] = {
18819
19061
.mixers = { alc663_mode8_mixer },
18820
19062
.cap_mixer = alc662_auto_capture_mixer,
18821
19063
.init_verbs = { alc662_init_verbs,
19064
19064
+
alc662_eapd_init_verbs,
18822
19065
alc663_mode8_init_verbs },
18823
19066
.num_dacs = ARRAY_SIZE(alc662_dac_nids),
18824
19067
.hp_nid = 0x03,
···
18827
19068
.dig_out_nid = ALC662_DIGOUT_NID,
18828
19069
.num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18829
19070
.channel_mode = alc662_3ST_2ch_modes,
18830
18830
-
.unsol_event = alc663_mode8_unsol_event,
19071
19071
+
.unsol_event = alc_sku_unsol_event,
18831
19072
.setup = alc663_mode8_setup,
18832
18832
-
.init_hook = alc663_mode8_inithook,
19073
19073
+
.init_hook = alc_inithook,
18833
19074
},
18834
19075
[ALC272_DELL] = {
18835
19076
.mixers = { alc663_m51va_mixer },
18836
19077
.cap_mixer = alc272_auto_capture_mixer,
18837
18837
-
.init_verbs = { alc662_init_verbs, alc272_dell_init_verbs },
19078
19078
+
.init_verbs = { alc662_init_verbs,
19079
19079
+
alc662_eapd_init_verbs,
19080
19080
+
alc272_dell_init_verbs },
18838
19081
.num_dacs = ARRAY_SIZE(alc272_dac_nids),
18839
18839
-
.dac_nids = alc662_dac_nids,
19082
19082
+
.dac_nids = alc272_dac_nids,
18840
19083
.num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18841
19084
.adc_nids = alc272_adc_nids,
18842
19085
.num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
18843
19086
.capsrc_nids = alc272_capsrc_nids,
18844
19087
.channel_mode = alc662_3ST_2ch_modes,
18845
18845
-
.unsol_event = alc663_m51va_unsol_event,
19088
19088
+
.unsol_event = alc_sku_unsol_event,
18846
19089
.setup = alc663_m51va_setup,
18847
18847
-
.init_hook = alc663_m51va_inithook,
19090
19090
+
.init_hook = alc_inithook,
18848
19091
},
18849
19092
[ALC272_DELL_ZM1] = {
18850
19093
.mixers = { alc663_m51va_mixer },
18851
19094
.cap_mixer = alc662_auto_capture_mixer,
18852
18852
-
.init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs },
19095
19095
+
.init_verbs = { alc662_init_verbs,
19096
19096
+
alc662_eapd_init_verbs,
19097
19097
+
alc272_dell_zm1_init_verbs },
18853
19098
.num_dacs = ARRAY_SIZE(alc272_dac_nids),
18854
18854
-
.dac_nids = alc662_dac_nids,
19099
19099
+
.dac_nids = alc272_dac_nids,
18855
19100
.num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18856
19101
.adc_nids = alc662_adc_nids,
18857
19102
.num_adc_nids = 1,
18858
19103
.capsrc_nids = alc662_capsrc_nids,
18859
19104
.channel_mode = alc662_3ST_2ch_modes,
18860
18860
-
.unsol_event = alc663_m51va_unsol_event,
19105
19105
+
.unsol_event = alc_sku_unsol_event,
18861
19106
.setup = alc663_m51va_setup,
18862
18862
-
.init_hook = alc663_m51va_inithook,
19107
19107
+
.init_hook = alc_inithook,
18863
19108
},
18864
19109
[ALC272_SAMSUNG_NC10] = {
18865
19110
.mixers = { alc272_nc10_mixer },
18866
19111
.init_verbs = { alc662_init_verbs,
19112
19112
+
alc662_eapd_init_verbs,
18867
19113
alc663_21jd_amic_init_verbs },
18868
19114
.num_dacs = ARRAY_SIZE(alc272_dac_nids),
18869
19115
.dac_nids = alc272_dac_nids,
18870
19116
.num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18871
19117
.channel_mode = alc662_3ST_2ch_modes,
18872
19118
/*.input_mux = &alc272_nc10_capture_source,*/
18873
18873
-
.unsol_event = alc663_mode4_unsol_event,
19119
19119
+
.unsol_event = alc_sku_unsol_event,
18874
19120
.setup = alc663_mode4_setup,
18875
18875
-
.init_hook = alc663_mode4_inithook,
19121
19121
+
.init_hook = alc_inithook,
18876
19122
},
18877
19123
};
18878
19124
···
18887
19123
*/
18888
19124
18889
19125
/* convert from MIX nid to DAC */
18890
18890
-
static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid)
19126
19126
+
static hda_nid_t alc_auto_mix_to_dac(struct hda_codec *codec, hda_nid_t nid)
18891
19127
{
18892
18892
-
if (nid == 0x0f)
18893
18893
-
return 0x02;
18894
18894
-
else if (nid >= 0x0c && nid <= 0x0e)
18895
18895
-
return nid - 0x0c + 0x02;
18896
18896
-
else if (nid == 0x26) /* ALC887-VD has this DAC too */
18897
18897
-
return 0x25;
18898
18898
-
else
18899
18899
-
return 0;
19128
19128
+
hda_nid_t list[5];
19129
19129
+
int i, num;
19130
19130
+
19131
19131
+
num = snd_hda_get_connections(codec, nid, list, ARRAY_SIZE(list));
19132
19132
+
for (i = 0; i < num; i++) {
19133
19133
+
if (get_wcaps_type(get_wcaps(codec, list[i])) == AC_WID_AUD_OUT)
19134
19134
+
return list[i];
19135
19135
+
}
19136
19136
+
return 0;
19137
19137
+
}
19138
19138
+
19139
19139
+
/* go down to the selector widget before the mixer */
19140
19140
+
static hda_nid_t alc_go_down_to_selector(struct hda_codec *codec, hda_nid_t pin)
19141
19141
+
{
19142
19142
+
hda_nid_t srcs[5];
19143
19143
+
int num = snd_hda_get_connections(codec, pin, srcs,
19144
19144
+
ARRAY_SIZE(srcs));
19145
19145
+
if (num != 1 ||
19146
19146
+
get_wcaps_type(get_wcaps(codec, srcs[0])) != AC_WID_AUD_SEL)
19147
19147
+
return pin;
19148
19148
+
return srcs[0];
18900
19149
}
18901
19150
18902
19151
/* get MIX nid connected to the given pin targeted to DAC */
18903
18903
-
static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin,
19152
19152
+
static hda_nid_t alc_auto_dac_to_mix(struct hda_codec *codec, hda_nid_t pin,
18904
19153
hda_nid_t dac)
18905
19154
{
18906
19155
hda_nid_t mix[5];
18907
19156
int i, num;
18908
19157
19158
19158
+
pin = alc_go_down_to_selector(codec, pin);
18909
19159
num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix));
18910
19160
for (i = 0; i < num; i++) {
18911
18911
-
if (alc662_mix_to_dac(mix[i]) == dac)
19161
19161
+
if (alc_auto_mix_to_dac(codec, mix[i]) == dac)
18912
19162
return mix[i];
18913
19163
}
18914
19164
return 0;
18915
19165
}
18916
19166
19167
19167
+
/* select the connection from pin to DAC if needed */
19168
19168
+
static int alc_auto_select_dac(struct hda_codec *codec, hda_nid_t pin,
19169
19169
+
hda_nid_t dac)
19170
19170
+
{
19171
19171
+
hda_nid_t mix[5];
19172
19172
+
int i, num;
19173
19173
+
19174
19174
+
pin = alc_go_down_to_selector(codec, pin);
19175
19175
+
num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix));
19176
19176
+
if (num < 2)
19177
19177
+
return 0;
19178
19178
+
for (i = 0; i < num; i++) {
19179
19179
+
if (alc_auto_mix_to_dac(codec, mix[i]) == dac) {
19180
19180
+
snd_hda_codec_update_cache(codec, pin, 0,
19181
19181
+
AC_VERB_SET_CONNECT_SEL, i);
19182
19182
+
return 0;
19183
19183
+
}
19184
19184
+
}
19185
19185
+
return 0;
19186
19186
+
}
19187
19187
+
18917
19188
/* look for an empty DAC slot */
18918
18918
-
static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
19189
19189
+
static hda_nid_t alc_auto_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
18919
19190
{
18920
19191
struct alc_spec *spec = codec->spec;
18921
19192
hda_nid_t srcs[5];
18922
19193
int i, j, num;
18923
19194
19195
19195
+
pin = alc_go_down_to_selector(codec, pin);
18924
19196
num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs));
18925
18925
-
if (num < 0)
18926
18926
-
return 0;
18927
19197
for (i = 0; i < num; i++) {
18928
18928
-
hda_nid_t nid = alc662_mix_to_dac(srcs[i]);
19198
19198
+
hda_nid_t nid = alc_auto_mix_to_dac(codec, srcs[i]);
18929
19199
if (!nid)
18930
19200
continue;
18931
19201
for (j = 0; j < spec->multiout.num_dacs; j++)
···
18981
19183
18982
19184
spec->multiout.dac_nids = spec->private_dac_nids;
18983
19185
for (i = 0; i < cfg->line_outs; i++) {
18984
18984
-
dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]);
19186
19186
+
dac = alc_auto_look_for_dac(codec, cfg->line_out_pins[i]);
18985
19187
if (!dac)
18986
19188
continue;
18987
18987
-
spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
19189
19189
+
spec->private_dac_nids[spec->multiout.num_dacs++] = dac;
18988
19190
}
18989
19191
return 0;
18990
19192
}
···
19020
19222
static const char * const chname[4] = {
19021
19223
"Front", "Surround", NULL /*CLFE*/, "Side"
19022
19224
};
19023
19023
-
const char *pfx = alc_get_line_out_pfx(cfg, true);
19024
19024
-
hda_nid_t nid, mix;
19025
19025
-
int i, err;
19225
19225
+
const char *pfx = alc_get_line_out_pfx(spec, true);
19226
19226
+
hda_nid_t nid, mix, pin;
19227
19227
+
int i, err, noutputs;
19026
19228
19027
19027
-
for (i = 0; i < cfg->line_outs; i++) {
19229
19229
+
noutputs = cfg->line_outs;
19230
19230
+
if (spec->multi_ios > 0)
19231
19231
+
noutputs += spec->multi_ios;
19232
19232
+
19233
19233
+
for (i = 0; i < noutputs; i++) {
19028
19234
nid = spec->multiout.dac_nids[i];
19029
19235
if (!nid)
19030
19236
continue;
19031
19031
-
mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid);
19237
19237
+
if (i >= cfg->line_outs)
19238
19238
+
pin = spec->multi_io[i - 1].pin;
19239
19239
+
else
19240
19240
+
pin = cfg->line_out_pins[i];
19241
19241
+
mix = alc_auto_dac_to_mix(codec, pin, nid);
19032
19242
if (!mix)
19033
19243
continue;
19034
19244
if (!pfx && i == 2) {
···
19082
19276
19083
19277
if (!pin)
19084
19278
return 0;
19085
19085
-
nid = alc662_look_for_dac(codec, pin);
19279
19279
+
nid = alc_auto_look_for_dac(codec, pin);
19086
19280
if (!nid) {
19087
19281
/* the corresponding DAC is already occupied */
19088
19282
if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP))
···
19092
19286
HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
19093
19287
}
19094
19288
19095
19095
-
mix = alc662_dac_to_mix(codec, pin, nid);
19289
19289
+
mix = alc_auto_dac_to_mix(codec, pin, nid);
19096
19290
if (!mix)
19097
19291
return 0;
19098
19292
err = alc662_add_vol_ctl(spec, pfx, nid, 3);
···
19116
19310
hda_nid_t srcs[HDA_MAX_CONNECTIONS];
19117
19311
19118
19312
alc_set_pin_output(codec, nid, pin_type);
19119
19119
-
/* need the manual connection? */
19120
19313
num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs));
19121
19121
-
if (num <= 1)
19122
19122
-
return;
19123
19314
for (i = 0; i < num; i++) {
19124
19124
-
if (alc662_mix_to_dac(srcs[i]) != dac)
19315
19315
+
if (alc_auto_mix_to_dac(codec, srcs[i]) != dac)
19125
19316
continue;
19126
19126
-
snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i);
19317
19317
+
/* need the manual connection? */
19318
19318
+
if (num > 1)
19319
19319
+
snd_hda_codec_write(codec, nid, 0,
19320
19320
+
AC_VERB_SET_CONNECT_SEL, i);
19321
19321
+
/* unmute mixer widget inputs */
19322
19322
+
snd_hda_codec_write(codec, srcs[i], 0,
19323
19323
+
AC_VERB_SET_AMP_GAIN_MUTE,
19324
19324
+
AMP_IN_UNMUTE(0));
19325
19325
+
snd_hda_codec_write(codec, srcs[i], 0,
19326
19326
+
AC_VERB_SET_AMP_GAIN_MUTE,
19327
19327
+
AMP_IN_UNMUTE(1));
19127
19328
return;
19128
19329
}
19129
19330
}
···
19187
19374
19188
19375
#define alc662_auto_init_input_src alc882_auto_init_input_src
19189
19376
19377
19377
+
/*
19378
19378
+
* multi-io helper
19379
19379
+
*/
19380
19380
+
static int alc_auto_fill_multi_ios(struct hda_codec *codec,
19381
19381
+
unsigned int location)
19382
19382
+
{
19383
19383
+
struct alc_spec *spec = codec->spec;
19384
19384
+
struct auto_pin_cfg *cfg = &spec->autocfg;
19385
19385
+
int type, i, num_pins = 0;
19386
19386
+
19387
19387
+
for (type = AUTO_PIN_LINE_IN; type >= AUTO_PIN_MIC; type--) {
19388
19388
+
for (i = 0; i < cfg->num_inputs; i++) {
19389
19389
+
hda_nid_t nid = cfg->inputs[i].pin;
19390
19390
+
hda_nid_t dac;
19391
19391
+
unsigned int defcfg, caps;
19392
19392
+
if (cfg->inputs[i].type != type)
19393
19393
+
continue;
19394
19394
+
defcfg = snd_hda_codec_get_pincfg(codec, nid);
19395
19395
+
if (get_defcfg_connect(defcfg) != AC_JACK_PORT_COMPLEX)
19396
19396
+
continue;
19397
19397
+
if (location && get_defcfg_location(defcfg) != location)
19398
19398
+
continue;
19399
19399
+
caps = snd_hda_query_pin_caps(codec, nid);
19400
19400
+
if (!(caps & AC_PINCAP_OUT))
19401
19401
+
continue;
19402
19402
+
dac = alc_auto_look_for_dac(codec, nid);
19403
19403
+
if (!dac)
19404
19404
+
continue;
19405
19405
+
spec->multi_io[num_pins].pin = nid;
19406
19406
+
spec->multi_io[num_pins].dac = dac;
19407
19407
+
num_pins++;
19408
19408
+
spec->private_dac_nids[spec->multiout.num_dacs++] = dac;
19409
19409
+
}
19410
19410
+
}
19411
19411
+
spec->multiout.num_dacs = 1;
19412
19412
+
if (num_pins < 2)
19413
19413
+
return 0;
19414
19414
+
return num_pins;
19415
19415
+
}
19416
19416
+
19417
19417
+
static int alc_auto_ch_mode_info(struct snd_kcontrol *kcontrol,
19418
19418
+
struct snd_ctl_elem_info *uinfo)
19419
19419
+
{
19420
19420
+
struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
19421
19421
+
struct alc_spec *spec = codec->spec;
19422
19422
+
19423
19423
+
uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
19424
19424
+
uinfo->count = 1;
19425
19425
+
uinfo->value.enumerated.items = spec->multi_ios + 1;
19426
19426
+
if (uinfo->value.enumerated.item > spec->multi_ios)
19427
19427
+
uinfo->value.enumerated.item = spec->multi_ios;
19428
19428
+
sprintf(uinfo->value.enumerated.name, "%dch",
19429
19429
+
(uinfo->value.enumerated.item + 1) * 2);
19430
19430
+
return 0;
19431
19431
+
}
19432
19432
+
19433
19433
+
static int alc_auto_ch_mode_get(struct snd_kcontrol *kcontrol,
19434
19434
+
struct snd_ctl_elem_value *ucontrol)
19435
19435
+
{
19436
19436
+
struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
19437
19437
+
struct alc_spec *spec = codec->spec;
19438
19438
+
ucontrol->value.enumerated.item[0] = (spec->ext_channel_count - 1) / 2;
19439
19439
+
return 0;
19440
19440
+
}
19441
19441
+
19442
19442
+
static int alc_set_multi_io(struct hda_codec *codec, int idx, bool output)
19443
19443
+
{
19444
19444
+
struct alc_spec *spec = codec->spec;
19445
19445
+
hda_nid_t nid = spec->multi_io[idx].pin;
19446
19446
+
19447
19447
+
if (!spec->multi_io[idx].ctl_in)
19448
19448
+
spec->multi_io[idx].ctl_in =
19449
19449
+
snd_hda_codec_read(codec, nid, 0,
19450
19450
+
AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
19451
19451
+
if (output) {
19452
19452
+
snd_hda_codec_update_cache(codec, nid, 0,
19453
19453
+
AC_VERB_SET_PIN_WIDGET_CONTROL,
19454
19454
+
PIN_OUT);
19455
19455
+
if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
19456
19456
+
snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
19457
19457
+
HDA_AMP_MUTE, 0);
19458
19458
+
alc_auto_select_dac(codec, nid, spec->multi_io[idx].dac);
19459
19459
+
} else {
19460
19460
+
if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
19461
19461
+
snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
19462
19462
+
HDA_AMP_MUTE, HDA_AMP_MUTE);
19463
19463
+
snd_hda_codec_update_cache(codec, nid, 0,
19464
19464
+
AC_VERB_SET_PIN_WIDGET_CONTROL,
19465
19465
+
spec->multi_io[idx].ctl_in);
19466
19466
+
}
19467
19467
+
return 0;
19468
19468
+
}
19469
19469
+
19470
19470
+
static int alc_auto_ch_mode_put(struct snd_kcontrol *kcontrol,
19471
19471
+
struct snd_ctl_elem_value *ucontrol)
19472
19472
+
{
19473
19473
+
struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
19474
19474
+
struct alc_spec *spec = codec->spec;
19475
19475
+
int i, ch;
19476
19476
+
19477
19477
+
ch = ucontrol->value.enumerated.item[0];
19478
19478
+
if (ch < 0 || ch > spec->multi_ios)
19479
19479
+
return -EINVAL;
19480
19480
+
if (ch == (spec->ext_channel_count - 1) / 2)
19481
19481
+
return 0;
19482
19482
+
spec->ext_channel_count = (ch + 1) * 2;
19483
19483
+
for (i = 0; i < spec->multi_ios; i++)
19484
19484
+
alc_set_multi_io(codec, i, i < ch);
19485
19485
+
spec->multiout.max_channels = spec->ext_channel_count;
19486
19486
+
return 1;
19487
19487
+
}
19488
19488
+
19489
19489
+
static const struct snd_kcontrol_new alc_auto_channel_mode_enum = {
19490
19490
+
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
19491
19491
+
.name = "Channel Mode",
19492
19492
+
.info = alc_auto_ch_mode_info,
19493
19493
+
.get = alc_auto_ch_mode_get,
19494
19494
+
.put = alc_auto_ch_mode_put,
19495
19495
+
};
19496
19496
+
19497
19497
+
static int alc_auto_add_multi_channel_mode(struct hda_codec *codec)
19498
19498
+
{
19499
19499
+
struct alc_spec *spec = codec->spec;
19500
19500
+
struct auto_pin_cfg *cfg = &spec->autocfg;
19501
19501
+
unsigned int location, defcfg;
19502
19502
+
int num_pins;
19503
19503
+
19504
19504
+
if (cfg->line_outs != 1 ||
19505
19505
+
cfg->line_out_type != AUTO_PIN_LINE_OUT)
19506
19506
+
return 0;
19507
19507
+
19508
19508
+
defcfg = snd_hda_codec_get_pincfg(codec, cfg->line_out_pins[0]);
19509
19509
+
location = get_defcfg_location(defcfg);
19510
19510
+
19511
19511
+
num_pins = alc_auto_fill_multi_ios(codec, location);
19512
19512
+
if (num_pins > 0) {
19513
19513
+
struct snd_kcontrol_new *knew;
19514
19514
+
19515
19515
+
knew = alc_kcontrol_new(spec);
19516
19516
+
if (!knew)
19517
19517
+
return -ENOMEM;
19518
19518
+
*knew = alc_auto_channel_mode_enum;
19519
19519
+
knew->name = kstrdup("Channel Mode", GFP_KERNEL);
19520
19520
+
if (!knew->name)
19521
19521
+
return -ENOMEM;
19522
19522
+
19523
19523
+
spec->multi_ios = num_pins;
19524
19524
+
spec->ext_channel_count = 2;
19525
19525
+
spec->multiout.num_dacs = num_pins + 1;
19526
19526
+
}
19527
19527
+
return 0;
19528
19528
+
}
19529
19529
+
19190
19530
static int alc662_parse_auto_config(struct hda_codec *codec)
19191
19531
{
19192
19532
struct alc_spec *spec = codec->spec;
19193
19533
int err;
19194
19194
-
static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
19534
19534
+
static const hda_nid_t alc662_ignore[] = { 0x1d, 0 };
19195
19535
19196
19536
err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
19197
19537
alc662_ignore);
···
19354
19388
return 0; /* can't find valid BIOS pin config */
19355
19389
19356
19390
err = alc662_auto_fill_dac_nids(codec, &spec->autocfg);
19391
19391
+
if (err < 0)
19392
19392
+
return err;
19393
19393
+
err = alc_auto_add_multi_channel_mode(codec);
19357
19394
if (err < 0)
19358
19395
return err;
19359
19396
err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg);
···
19388
19419
19389
19420
spec->num_mux_defs = 1;
19390
19421
spec->input_mux = &spec->private_imux[0];
19391
19391
-
19392
19392
-
add_verb(spec, alc662_init_verbs);
19393
19393
-
if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
19394
19394
-
codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670)
19395
19395
-
add_verb(spec, alc663_init_verbs);
19396
19396
-
19397
19397
-
if (codec->vendor_id == 0x10ec0272)
19398
19398
-
add_verb(spec, alc272_init_verbs);
19399
19422
19400
19423
err = alc_auto_add_mic_boost(codec);
19401
19424
if (err < 0)
···
19469
19508
},
19470
19509
};
19471
19510
19472
19472
-
static struct snd_pci_quirk alc662_fixup_tbl[] = {
19511
19511
+
static const struct snd_pci_quirk alc662_fixup_tbl[] = {
19473
19512
SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
19474
19513
SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE),
19475
19514
SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
···
19587
19626
codec->patch_ops = alc_patch_ops;
19588
19627
if (board_config == ALC662_AUTO)
19589
19628
spec->init_hook = alc662_auto_init;
19629
19629
+
spec->shutup = alc_eapd_shutup;
19590
19630
19591
19631
alc_init_jacks(codec);
19592
19632
···
19616
19654
return patch_alc882(codec);
19617
19655
}
19618
19656
19657
19657
+
static int patch_alc899(struct hda_codec *codec)
19658
19658
+
{
19659
19659
+
if ((alc_read_coef_idx(codec, 0) & 0x2000) != 0x2000) {
19660
19660
+
kfree(codec->chip_name);
19661
19661
+
codec->chip_name = kstrdup("ALC898", GFP_KERNEL);
19662
19662
+
}
19663
19663
+
return patch_alc882(codec);
19664
19664
+
}
19665
19665
+
19619
19666
/*
19620
19667
* ALC680 support
19621
19668
*/
···
19632
19661
#define ALC680_DIGOUT_NID ALC880_DIGOUT_NID
19633
19662
#define alc680_modes alc260_modes
19634
19663
19635
19635
-
static hda_nid_t alc680_dac_nids[3] = {
19664
19664
+
static const hda_nid_t alc680_dac_nids[3] = {
19636
19665
/* Lout1, Lout2, hp */
19637
19666
0x02, 0x03, 0x04
19638
19667
};
19639
19668
19640
19640
-
static hda_nid_t alc680_adc_nids[3] = {
19669
19669
+
static const hda_nid_t alc680_adc_nids[3] = {
19641
19670
/* ADC0-2 */
19642
19671
/* DMIC, MIC, Line-in*/
19643
19672
0x07, 0x08, 0x09
···
19657
19686
19658
19687
for (i = 0; i < cfg->num_inputs; i++) {
19659
19688
nid = cfg->inputs[i].pin;
19660
19660
-
if (!(snd_hda_query_pin_caps(codec, nid) &
19661
19661
-
AC_PINCAP_PRES_DETECT))
19689
19689
+
if (!is_jack_detectable(codec, nid))
19662
19690
continue;
19663
19691
if (snd_hda_jack_detect(codec, nid)) {
19664
19692
if (cfg->inputs[i].type < type_found) {
···
19704
19734
return 0;
19705
19735
}
19706
19736
19707
19707
-
static struct hda_pcm_stream alc680_pcm_analog_auto_capture = {
19737
19737
+
static const struct hda_pcm_stream alc680_pcm_analog_auto_capture = {
19708
19738
.substreams = 1, /* can be overridden */
19709
19739
.channels_min = 2,
19710
19740
.channels_max = 2,
···
19715
19745
},
19716
19746
};
19717
19747
19718
19718
-
static struct snd_kcontrol_new alc680_base_mixer[] = {
19748
19748
+
static const struct snd_kcontrol_new alc680_base_mixer[] = {
19719
19749
/* output mixer control */
19720
19750
HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
19721
19751
HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
···
19727
19757
{ }
19728
19758
};
19729
19759
19730
19730
-
static struct hda_bind_ctls alc680_bind_cap_vol = {
19760
19760
+
static const struct hda_bind_ctls alc680_bind_cap_vol = {
19731
19761
.ops = &snd_hda_bind_vol,
19732
19762
.values = {
19733
19763
HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT),
···
19737
19767
},
19738
19768
};
19739
19769
19740
19740
-
static struct hda_bind_ctls alc680_bind_cap_switch = {
19770
19770
+
static const struct hda_bind_ctls alc680_bind_cap_switch = {
19741
19771
.ops = &snd_hda_bind_sw,
19742
19772
.values = {
19743
19773
HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT),
···
19747
19777
},
19748
19778
};
19749
19779
19750
19750
-
static struct snd_kcontrol_new alc680_master_capture_mixer[] = {
19780
19780
+
static const struct snd_kcontrol_new alc680_master_capture_mixer[] = {
19751
19781
HDA_BIND_VOL("Capture Volume", &alc680_bind_cap_vol),
19752
19782
HDA_BIND_SW("Capture Switch", &alc680_bind_cap_switch),
19753
19783
{ } /* end */
···
19756
19786
/*
19757
19787
* generic initialization of ADC, input mixers and output mixers
19758
19788
*/
19759
19759
-
static struct hda_verb alc680_init_verbs[] = {
19789
19789
+
static const struct hda_verb alc680_init_verbs[] = {
19760
19790
{0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
19761
19791
{0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
19762
19792
{0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
···
19794
19824
spec->autocfg.inputs[0].type = AUTO_PIN_MIC;
19795
19825
spec->autocfg.inputs[1].pin = 0x19;
19796
19826
spec->autocfg.inputs[1].type = AUTO_PIN_LINE_IN;
19827
19827
+
spec->automute = 1;
19828
19828
+
spec->automute_mode = ALC_AUTOMUTE_AMP;
19797
19829
}
19798
19830
19799
19831
static void alc680_unsol_event(struct hda_codec *codec,
19800
19832
unsigned int res)
19801
19833
{
19802
19834
if ((res >> 26) == ALC880_HP_EVENT)
19803
19803
-
alc_automute_amp(codec);
19835
19835
+
alc_hp_automute(codec);
19804
19836
if ((res >> 26) == ALC880_MIC_EVENT)
19805
19837
alc680_rec_autoswitch(codec);
19806
19838
}
19807
19839
19808
19840
static void alc680_inithook(struct hda_codec *codec)
19809
19841
{
19810
19810
-
alc_automute_amp(codec);
19842
19842
+
alc_hp_automute(codec);
19811
19843
alc680_rec_autoswitch(codec);
19812
19844
}
19813
19845
···
19846
19874
19847
19875
if (err < 0)
19848
19876
return err;
19849
19849
-
spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
19877
19877
+
spec->private_dac_nids[spec->multiout.num_dacs++] = dac;
19850
19878
}
19851
19879
19852
19880
return 0;
···
19932
19960
{
19933
19961
struct alc_spec *spec = codec->spec;
19934
19962
int err;
19935
19935
-
static hda_nid_t alc680_ignore[] = { 0 };
19963
19963
+
static const hda_nid_t alc680_ignore[] = { 0 };
19936
19964
19937
19965
err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
19938
19966
alc680_ignore);
···
19990
20018
[ALC680_AUTO] = "auto",
19991
20019
};
19992
20020
19993
19993
-
static struct snd_pci_quirk alc680_cfg_tbl[] = {
20021
20021
+
static const struct snd_pci_quirk alc680_cfg_tbl[] = {
19994
20022
SND_PCI_QUIRK(0x1043, 0x12f3, "ASUS NX90", ALC680_BASE),
19995
20023
{}
19996
20024
};
19997
20025
19998
19998
-
static struct alc_config_preset alc680_presets[] = {
20026
20026
+
static const struct alc_config_preset alc680_presets[] = {
19999
20027
[ALC680_BASE] = {
20000
20028
.mixers = { alc680_base_mixer },
20001
20029
.cap_mixer = alc680_master_capture_mixer,
···
20076
20104
/*
20077
20105
* patch entries
20078
20106
*/
20079
20079
-
static struct hda_codec_preset snd_hda_preset_realtek[] = {
20107
20107
+
static const struct hda_codec_preset snd_hda_preset_realtek[] = {
20108
20108
+
{ .id = 0x10ec0221, .name = "ALC221", .patch = patch_alc269 },
20080
20109
{ .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
20081
20110
{ .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
20082
20111
{ .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
···
20086
20113
{ .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 },
20087
20114
{ .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
20088
20115
{ .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 },
20116
20116
+
{ .id = 0x10ec0276, .name = "ALC276", .patch = patch_alc269 },
20089
20117
{ .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
20090
20118
.patch = patch_alc861 },
20091
20119
{ .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
···
20114
20140
{ .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 },
20115
20141
{ .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
20116
20142
{ .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 },
20143
20143
+
{ .id = 0x10ec0899, .name = "ALC899", .patch = patch_alc899 },
20117
20144
{} /* terminator */
20118
20145
};
20119
20146
+6
-5
sound/pci/hda/patch_si3054.c
reviewed
···
130
130
}
131
131
132
132
133
133
-
static struct snd_kcontrol_new si3054_modem_mixer[] = {
133
133
+
static const struct snd_kcontrol_new si3054_modem_mixer[] = {
134
134
SI3054_KCONTROL("Off-hook Switch", SI3054_GPIO_CONTROL, SI3054_GPIO_OH),
135
135
SI3054_KCONTROL("Caller ID Switch", SI3054_GPIO_CONTROL, SI3054_GPIO_CID),
136
136
{}
···
181
181
}
182
182
183
183
184
184
-
static struct hda_pcm_stream si3054_pcm = {
184
184
+
static const struct hda_pcm_stream si3054_pcm = {
185
185
.substreams = 1,
186
186
.channels_min = 1,
187
187
.channels_max = 1,
···
200
200
{
201
201
struct si3054_spec *spec = codec->spec;
202
202
struct hda_pcm *info = &spec->pcm;
203
203
-
si3054_pcm.nid = codec->mfg;
204
203
codec->num_pcms = 1;
205
204
codec->pcm_info = info;
206
205
info->name = "Si3054 Modem";
207
206
info->stream[SNDRV_PCM_STREAM_PLAYBACK] = si3054_pcm;
208
207
info->stream[SNDRV_PCM_STREAM_CAPTURE] = si3054_pcm;
208
208
+
info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = codec->mfg;
209
209
+
info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = codec->mfg;
209
210
info->pcm_type = HDA_PCM_TYPE_MODEM;
210
211
return 0;
211
212
}
···
264
263
/*
265
264
*/
266
265
267
267
-
static struct hda_codec_ops si3054_patch_ops = {
266
266
+
static const struct hda_codec_ops si3054_patch_ops = {
268
267
.build_controls = si3054_build_controls,
269
268
.build_pcms = si3054_build_pcms,
270
269
.init = si3054_init,
···
284
283
/*
285
284
* patch entries
286
285
*/
287
287
-
static struct hda_codec_preset snd_hda_preset_si3054[] = {
286
286
+
static const struct hda_codec_preset snd_hda_preset_si3054[] = {
288
287
{ .id = 0x163c3055, .name = "Si3054", .patch = patch_si3054 },
289
288
{ .id = 0x163c3155, .name = "Si3054", .patch = patch_si3054 },
290
289
{ .id = 0x11c13026, .name = "Si3054", .patch = patch_si3054 },
+214
-217
sound/pci/hda/patch_sigmatel.c
reviewed
···
217
217
unsigned int stream_delay;
218
218
219
219
/* analog loopback */
220
220
-
struct snd_kcontrol_new *aloopback_ctl;
220
220
+
const struct snd_kcontrol_new *aloopback_ctl;
221
221
unsigned char aloopback_mask;
222
222
unsigned char aloopback_shift;
223
223
224
224
/* power management */
225
225
unsigned int num_pwrs;
226
226
-
unsigned int *pwr_mapping;
227
227
-
hda_nid_t *pwr_nids;
228
228
-
hda_nid_t *dac_list;
226
226
+
const unsigned int *pwr_mapping;
227
227
+
const hda_nid_t *pwr_nids;
228
228
+
const hda_nid_t *dac_list;
229
229
230
230
/* events */
231
231
struct snd_array events;
···
241
241
int volume_offset;
242
242
243
243
/* capture */
244
244
-
hda_nid_t *adc_nids;
244
244
+
const hda_nid_t *adc_nids;
245
245
unsigned int num_adcs;
246
246
-
hda_nid_t *mux_nids;
246
246
+
const hda_nid_t *mux_nids;
247
247
unsigned int num_muxes;
248
248
-
hda_nid_t *dmic_nids;
248
248
+
const hda_nid_t *dmic_nids;
249
249
unsigned int num_dmics;
250
250
-
hda_nid_t *dmux_nids;
250
250
+
const hda_nid_t *dmux_nids;
251
251
unsigned int num_dmuxes;
252
252
-
hda_nid_t *smux_nids;
252
252
+
const hda_nid_t *smux_nids;
253
253
unsigned int num_smuxes;
254
254
unsigned int num_analog_muxes;
255
255
256
256
-
unsigned long *capvols; /* amp-volume attr: HDA_COMPOSE_AMP_VAL() */
257
257
-
unsigned long *capsws; /* amp-mute attr: HDA_COMPOSE_AMP_VAL() */
256
256
+
const unsigned long *capvols; /* amp-volume attr: HDA_COMPOSE_AMP_VAL() */
257
257
+
const unsigned long *capsws; /* amp-mute attr: HDA_COMPOSE_AMP_VAL() */
258
258
unsigned int num_caps; /* number of capture volume/switch elements */
259
259
260
260
struct sigmatel_mic_route ext_mic;
···
269
269
hda_nid_t digbeep_nid;
270
270
271
271
/* pin widgets */
272
272
-
hda_nid_t *pin_nids;
272
272
+
const hda_nid_t *pin_nids;
273
273
unsigned int num_pins;
274
274
275
275
/* codec specific stuff */
276
276
-
struct hda_verb *init;
277
277
-
struct snd_kcontrol_new *mixer;
276
276
+
const struct hda_verb *init;
277
277
+
const struct snd_kcontrol_new *mixer;
278
278
279
279
/* capture source */
280
280
struct hda_input_mux *dinput_mux;
···
317
317
hda_nid_t auto_dmic_nids[MAX_DMICS_NUM];
318
318
};
319
319
320
320
-
static hda_nid_t stac9200_adc_nids[1] = {
320
320
+
static const hda_nid_t stac9200_adc_nids[1] = {
321
321
0x03,
322
322
};
323
323
324
324
-
static hda_nid_t stac9200_mux_nids[1] = {
324
324
+
static const hda_nid_t stac9200_mux_nids[1] = {
325
325
0x0c,
326
326
};
327
327
328
328
-
static hda_nid_t stac9200_dac_nids[1] = {
328
328
+
static const hda_nid_t stac9200_dac_nids[1] = {
329
329
0x02,
330
330
};
331
331
332
332
-
static hda_nid_t stac92hd73xx_pwr_nids[8] = {
332
332
+
static const hda_nid_t stac92hd73xx_pwr_nids[8] = {
333
333
0x0a, 0x0b, 0x0c, 0xd, 0x0e,
334
334
0x0f, 0x10, 0x11
335
335
};
336
336
337
337
-
static hda_nid_t stac92hd73xx_slave_dig_outs[2] = {
337
337
+
static const hda_nid_t stac92hd73xx_slave_dig_outs[2] = {
338
338
0x26, 0,
339
339
};
340
340
341
341
-
static hda_nid_t stac92hd73xx_adc_nids[2] = {
341
341
+
static const hda_nid_t stac92hd73xx_adc_nids[2] = {
342
342
0x1a, 0x1b
343
343
};
344
344
345
345
#define STAC92HD73XX_NUM_DMICS 2
346
346
-
static hda_nid_t stac92hd73xx_dmic_nids[STAC92HD73XX_NUM_DMICS + 1] = {
346
346
+
static const hda_nid_t stac92hd73xx_dmic_nids[STAC92HD73XX_NUM_DMICS + 1] = {
347
347
0x13, 0x14, 0
348
348
};
349
349
350
350
#define STAC92HD73_DAC_COUNT 5
351
351
352
352
-
static hda_nid_t stac92hd73xx_mux_nids[2] = {
352
352
+
static const hda_nid_t stac92hd73xx_mux_nids[2] = {
353
353
0x20, 0x21,
354
354
};
355
355
356
356
-
static hda_nid_t stac92hd73xx_dmux_nids[2] = {
356
356
+
static const hda_nid_t stac92hd73xx_dmux_nids[2] = {
357
357
0x20, 0x21,
358
358
};
359
359
360
360
-
static hda_nid_t stac92hd73xx_smux_nids[2] = {
360
360
+
static const hda_nid_t stac92hd73xx_smux_nids[2] = {
361
361
0x22, 0x23,
362
362
};
363
363
364
364
#define STAC92HD73XX_NUM_CAPS 2
365
365
-
static unsigned long stac92hd73xx_capvols[] = {
365
365
+
static const unsigned long stac92hd73xx_capvols[] = {
366
366
HDA_COMPOSE_AMP_VAL(0x20, 3, 0, HDA_OUTPUT),
367
367
HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
368
368
};
···
370
370
371
371
#define STAC92HD83_DAC_COUNT 3
372
372
373
373
-
static hda_nid_t stac92hd83xxx_pwr_nids[4] = {
373
373
+
static const hda_nid_t stac92hd83xxx_pwr_nids[4] = {
374
374
0xa, 0xb, 0xd, 0xe,
375
375
};
376
376
377
377
-
static hda_nid_t stac92hd83xxx_slave_dig_outs[2] = {
377
377
+
static const hda_nid_t stac92hd83xxx_slave_dig_outs[2] = {
378
378
0x1e, 0,
379
379
};
380
380
381
381
-
static unsigned int stac92hd83xxx_pwr_mapping[4] = {
381
381
+
static const unsigned int stac92hd83xxx_pwr_mapping[4] = {
382
382
0x03, 0x0c, 0x20, 0x40,
383
383
};
384
384
385
385
-
static hda_nid_t stac92hd83xxx_dmic_nids[] = {
385
385
+
static const hda_nid_t stac92hd83xxx_dmic_nids[] = {
386
386
0x11, 0x20,
387
387
};
388
388
389
389
-
static hda_nid_t stac92hd71bxx_pwr_nids[3] = {
389
389
+
static const hda_nid_t stac92hd71bxx_pwr_nids[3] = {
390
390
0x0a, 0x0d, 0x0f
391
391
};
392
392
393
393
-
static hda_nid_t stac92hd71bxx_adc_nids[2] = {
393
393
+
static const hda_nid_t stac92hd71bxx_adc_nids[2] = {
394
394
0x12, 0x13,
395
395
};
396
396
397
397
-
static hda_nid_t stac92hd71bxx_mux_nids[2] = {
397
397
+
static const hda_nid_t stac92hd71bxx_mux_nids[2] = {
398
398
0x1a, 0x1b
399
399
};
400
400
401
401
-
static hda_nid_t stac92hd71bxx_dmux_nids[2] = {
401
401
+
static const hda_nid_t stac92hd71bxx_dmux_nids[2] = {
402
402
0x1c, 0x1d,
403
403
};
404
404
405
405
-
static hda_nid_t stac92hd71bxx_smux_nids[2] = {
405
405
+
static const hda_nid_t stac92hd71bxx_smux_nids[2] = {
406
406
0x24, 0x25,
407
407
};
408
408
409
409
#define STAC92HD71BXX_NUM_DMICS 2
410
410
-
static hda_nid_t stac92hd71bxx_dmic_nids[STAC92HD71BXX_NUM_DMICS + 1] = {
410
410
+
static const hda_nid_t stac92hd71bxx_dmic_nids[STAC92HD71BXX_NUM_DMICS + 1] = {
411
411
0x18, 0x19, 0
412
412
};
413
413
414
414
-
static hda_nid_t stac92hd71bxx_slave_dig_outs[2] = {
414
414
+
static const hda_nid_t stac92hd71bxx_dmic_5port_nids[STAC92HD71BXX_NUM_DMICS] = {
415
415
+
0x18, 0
416
416
+
};
417
417
+
418
418
+
static const hda_nid_t stac92hd71bxx_slave_dig_outs[2] = {
415
419
0x22, 0
416
420
};
417
421
418
422
#define STAC92HD71BXX_NUM_CAPS 2
419
419
-
static unsigned long stac92hd71bxx_capvols[] = {
423
423
+
static const unsigned long stac92hd71bxx_capvols[] = {
420
424
HDA_COMPOSE_AMP_VAL(0x1c, 3, 0, HDA_OUTPUT),
421
425
HDA_COMPOSE_AMP_VAL(0x1d, 3, 0, HDA_OUTPUT),
422
426
};
423
427
#define stac92hd71bxx_capsws stac92hd71bxx_capvols
424
428
425
425
-
static hda_nid_t stac925x_adc_nids[1] = {
429
429
+
static const hda_nid_t stac925x_adc_nids[1] = {
426
430
0x03,
427
431
};
428
432
429
429
-
static hda_nid_t stac925x_mux_nids[1] = {
433
433
+
static const hda_nid_t stac925x_mux_nids[1] = {
430
434
0x0f,
431
435
};
432
436
433
433
-
static hda_nid_t stac925x_dac_nids[1] = {
437
437
+
static const hda_nid_t stac925x_dac_nids[1] = {
434
438
0x02,
435
439
};
436
440
437
441
#define STAC925X_NUM_DMICS 1
438
438
-
static hda_nid_t stac925x_dmic_nids[STAC925X_NUM_DMICS + 1] = {
442
442
+
static const hda_nid_t stac925x_dmic_nids[STAC925X_NUM_DMICS + 1] = {
439
443
0x15, 0
440
444
};
441
445
442
442
-
static hda_nid_t stac925x_dmux_nids[1] = {
446
446
+
static const hda_nid_t stac925x_dmux_nids[1] = {
443
447
0x14,
444
448
};
445
449
446
446
-
static unsigned long stac925x_capvols[] = {
450
450
+
static const unsigned long stac925x_capvols[] = {
447
451
HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
448
452
};
449
449
-
static unsigned long stac925x_capsws[] = {
453
453
+
static const unsigned long stac925x_capsws[] = {
450
454
HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
451
455
};
452
456
453
453
-
static hda_nid_t stac922x_adc_nids[2] = {
457
457
+
static const hda_nid_t stac922x_adc_nids[2] = {
454
458
0x06, 0x07,
455
459
};
456
460
457
457
-
static hda_nid_t stac922x_mux_nids[2] = {
461
461
+
static const hda_nid_t stac922x_mux_nids[2] = {
458
462
0x12, 0x13,
459
463
};
460
464
461
465
#define STAC922X_NUM_CAPS 2
462
462
-
static unsigned long stac922x_capvols[] = {
466
466
+
static const unsigned long stac922x_capvols[] = {
463
467
HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_INPUT),
464
468
HDA_COMPOSE_AMP_VAL(0x18, 3, 0, HDA_INPUT),
465
469
};
466
470
#define stac922x_capsws stac922x_capvols
467
471
468
468
-
static hda_nid_t stac927x_slave_dig_outs[2] = {
472
472
+
static const hda_nid_t stac927x_slave_dig_outs[2] = {
469
473
0x1f, 0,
470
474
};
471
475
472
472
-
static hda_nid_t stac927x_adc_nids[3] = {
476
476
+
static const hda_nid_t stac927x_adc_nids[3] = {
473
477
0x07, 0x08, 0x09
474
478
};
475
479
476
476
-
static hda_nid_t stac927x_mux_nids[3] = {
480
480
+
static const hda_nid_t stac927x_mux_nids[3] = {
477
481
0x15, 0x16, 0x17
478
482
};
479
483
480
480
-
static hda_nid_t stac927x_smux_nids[1] = {
484
484
+
static const hda_nid_t stac927x_smux_nids[1] = {
481
485
0x21,
482
486
};
483
487
484
484
-
static hda_nid_t stac927x_dac_nids[6] = {
488
488
+
static const hda_nid_t stac927x_dac_nids[6] = {
485
489
0x02, 0x03, 0x04, 0x05, 0x06, 0
486
490
};
487
491
488
488
-
static hda_nid_t stac927x_dmux_nids[1] = {
492
492
+
static const hda_nid_t stac927x_dmux_nids[1] = {
489
493
0x1b,
490
494
};
491
495
492
496
#define STAC927X_NUM_DMICS 2
493
493
-
static hda_nid_t stac927x_dmic_nids[STAC927X_NUM_DMICS + 1] = {
497
497
+
static const hda_nid_t stac927x_dmic_nids[STAC927X_NUM_DMICS + 1] = {
494
498
0x13, 0x14, 0
495
499
};
496
500
497
501
#define STAC927X_NUM_CAPS 3
498
498
-
static unsigned long stac927x_capvols[] = {
502
502
+
static const unsigned long stac927x_capvols[] = {
499
503
HDA_COMPOSE_AMP_VAL(0x18, 3, 0, HDA_INPUT),
500
504
HDA_COMPOSE_AMP_VAL(0x19, 3, 0, HDA_INPUT),
501
505
HDA_COMPOSE_AMP_VAL(0x1a, 3, 0, HDA_INPUT),
502
506
};
503
503
-
static unsigned long stac927x_capsws[] = {
507
507
+
static const unsigned long stac927x_capsws[] = {
504
508
HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
505
509
HDA_COMPOSE_AMP_VAL(0x1c, 3, 0, HDA_OUTPUT),
506
510
HDA_COMPOSE_AMP_VAL(0x1d, 3, 0, HDA_OUTPUT),
···
515
511
"Analog Mux 2", "Analog Mux 3"
516
512
};
517
513
518
518
-
static hda_nid_t stac9205_adc_nids[2] = {
514
514
+
static const hda_nid_t stac9205_adc_nids[2] = {
519
515
0x12, 0x13
520
516
};
521
517
522
522
-
static hda_nid_t stac9205_mux_nids[2] = {
518
518
+
static const hda_nid_t stac9205_mux_nids[2] = {
523
519
0x19, 0x1a
524
520
};
525
521
526
526
-
static hda_nid_t stac9205_dmux_nids[1] = {
522
522
+
static const hda_nid_t stac9205_dmux_nids[1] = {
527
523
0x1d,
528
524
};
529
525
530
530
-
static hda_nid_t stac9205_smux_nids[1] = {
526
526
+
static const hda_nid_t stac9205_smux_nids[1] = {
531
527
0x21,
532
528
};
533
529
534
530
#define STAC9205_NUM_DMICS 2
535
535
-
static hda_nid_t stac9205_dmic_nids[STAC9205_NUM_DMICS + 1] = {
531
531
+
static const hda_nid_t stac9205_dmic_nids[STAC9205_NUM_DMICS + 1] = {
536
532
0x17, 0x18, 0
537
533
};
538
534
539
535
#define STAC9205_NUM_CAPS 2
540
540
-
static unsigned long stac9205_capvols[] = {
536
536
+
static const unsigned long stac9205_capvols[] = {
541
537
HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_INPUT),
542
538
HDA_COMPOSE_AMP_VAL(0x1c, 3, 0, HDA_INPUT),
543
539
};
544
544
-
static unsigned long stac9205_capsws[] = {
540
540
+
static const unsigned long stac9205_capsws[] = {
545
541
HDA_COMPOSE_AMP_VAL(0x1d, 3, 0, HDA_OUTPUT),
546
542
HDA_COMPOSE_AMP_VAL(0x1e, 3, 0, HDA_OUTPUT),
547
543
};
548
544
549
549
-
static hda_nid_t stac9200_pin_nids[8] = {
545
545
+
static const hda_nid_t stac9200_pin_nids[8] = {
550
546
0x08, 0x09, 0x0d, 0x0e,
551
547
0x0f, 0x10, 0x11, 0x12,
552
548
};
553
549
554
554
-
static hda_nid_t stac925x_pin_nids[8] = {
550
550
+
static const hda_nid_t stac925x_pin_nids[8] = {
555
551
0x07, 0x08, 0x0a, 0x0b,
556
552
0x0c, 0x0d, 0x10, 0x11,
557
553
};
558
554
559
559
-
static hda_nid_t stac922x_pin_nids[10] = {
555
555
+
static const hda_nid_t stac922x_pin_nids[10] = {
560
556
0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
561
557
0x0f, 0x10, 0x11, 0x15, 0x1b,
562
558
};
563
559
564
564
-
static hda_nid_t stac92hd73xx_pin_nids[13] = {
560
560
+
static const hda_nid_t stac92hd73xx_pin_nids[13] = {
565
561
0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
566
562
0x0f, 0x10, 0x11, 0x12, 0x13,
567
563
0x14, 0x22, 0x23
568
564
};
569
565
570
566
#define STAC92HD71BXX_NUM_PINS 13
571
571
-
static hda_nid_t stac92hd71bxx_pin_nids_4port[STAC92HD71BXX_NUM_PINS] = {
567
567
+
static const hda_nid_t stac92hd71bxx_pin_nids_4port[STAC92HD71BXX_NUM_PINS] = {
572
568
0x0a, 0x0b, 0x0c, 0x0d, 0x00,
573
569
0x00, 0x14, 0x18, 0x19, 0x1e,
574
570
0x1f, 0x20, 0x27
575
571
};
576
576
-
static hda_nid_t stac92hd71bxx_pin_nids_6port[STAC92HD71BXX_NUM_PINS] = {
572
572
+
static const hda_nid_t stac92hd71bxx_pin_nids_6port[STAC92HD71BXX_NUM_PINS] = {
577
573
0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
578
574
0x0f, 0x14, 0x18, 0x19, 0x1e,
579
575
0x1f, 0x20, 0x27
580
576
};
581
577
582
582
-
static hda_nid_t stac927x_pin_nids[14] = {
578
578
+
static const hda_nid_t stac927x_pin_nids[14] = {
583
579
0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
584
580
0x0f, 0x10, 0x11, 0x12, 0x13,
585
581
0x14, 0x21, 0x22, 0x23,
586
582
};
587
583
588
588
-
static hda_nid_t stac9205_pin_nids[12] = {
584
584
+
static const hda_nid_t stac9205_pin_nids[12] = {
589
585
0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
590
586
0x0f, 0x14, 0x16, 0x17, 0x18,
591
587
0x21, 0x22,
···
845
841
return 1;
846
842
}
847
843
848
848
-
static struct hda_verb stac9200_core_init[] = {
844
844
+
static const struct hda_verb stac9200_core_init[] = {
849
845
/* set dac0mux for dac converter */
850
846
{ 0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
851
847
{}
852
848
};
853
849
854
854
-
static struct hda_verb stac9200_eapd_init[] = {
850
850
+
static const struct hda_verb stac9200_eapd_init[] = {
855
851
/* set dac0mux for dac converter */
856
852
{0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
857
853
{0x08, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
858
854
{}
859
855
};
860
856
861
861
-
static struct hda_verb dell_eq_core_init[] = {
857
857
+
static const struct hda_verb dell_eq_core_init[] = {
862
858
/* set master volume to max value without distortion
863
859
* and direct control */
864
860
{ 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xec},
865
861
{}
866
862
};
867
863
868
868
-
static struct hda_verb stac92hd73xx_core_init[] = {
864
864
+
static const struct hda_verb stac92hd73xx_core_init[] = {
869
865
/* set master volume and direct control */
870
866
{ 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
871
867
{}
872
868
};
873
869
874
874
-
static struct hda_verb stac92hd83xxx_core_init[] = {
870
870
+
static const struct hda_verb stac92hd83xxx_core_init[] = {
875
871
/* power state controls amps */
876
872
{ 0x01, AC_VERB_SET_EAPD, 1 << 2},
877
873
{}
878
874
};
879
875
880
880
-
static struct hda_verb stac92hd71bxx_core_init[] = {
876
876
+
static const struct hda_verb stac92hd71bxx_core_init[] = {
881
877
/* set master volume and direct control */
882
878
{ 0x28, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
883
879
{}
884
880
};
885
881
886
886
-
static struct hda_verb stac92hd71bxx_unmute_core_init[] = {
882
882
+
static const struct hda_verb stac92hd71bxx_unmute_core_init[] = {
887
883
/* unmute right and left channels for nodes 0x0f, 0xa, 0x0d */
888
884
{ 0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
889
885
{ 0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
···
891
887
{}
892
888
};
893
889
894
894
-
static struct hda_verb stac925x_core_init[] = {
890
890
+
static const struct hda_verb stac925x_core_init[] = {
895
891
/* set dac0mux for dac converter */
896
892
{ 0x06, AC_VERB_SET_CONNECT_SEL, 0x00},
897
893
/* mute the master volume */
···
899
895
{}
900
896
};
901
897
902
902
-
static struct hda_verb stac922x_core_init[] = {
898
898
+
static const struct hda_verb stac922x_core_init[] = {
903
899
/* set master volume and direct control */
904
900
{ 0x16, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
905
901
{}
906
902
};
907
903
908
908
-
static struct hda_verb d965_core_init[] = {
904
904
+
static const struct hda_verb d965_core_init[] = {
909
905
/* set master volume and direct control */
910
906
{ 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
911
907
/* unmute node 0x1b */
···
915
911
{}
916
912
};
917
913
918
918
-
static struct hda_verb dell_3st_core_init[] = {
914
914
+
static const struct hda_verb dell_3st_core_init[] = {
919
915
/* don't set delta bit */
920
916
{0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0x7f},
921
917
/* unmute node 0x1b */
···
925
921
{}
926
922
};
927
923
928
928
-
static struct hda_verb stac927x_core_init[] = {
924
924
+
static const struct hda_verb stac927x_core_init[] = {
929
925
/* set master volume and direct control */
930
926
{ 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
931
927
/* enable analog pc beep path */
···
933
929
{}
934
930
};
935
931
936
936
-
static struct hda_verb stac927x_volknob_core_init[] = {
932
932
+
static const struct hda_verb stac927x_volknob_core_init[] = {
937
933
/* don't set delta bit */
938
934
{0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0x7f},
939
935
/* enable analog pc beep path */
···
941
937
{}
942
938
};
943
939
944
944
-
static struct hda_verb stac9205_core_init[] = {
940
940
+
static const struct hda_verb stac9205_core_init[] = {
945
941
/* set master volume and direct control */
946
942
{ 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
947
943
/* enable analog pc beep path */
···
981
977
.private_value = nid, \
982
978
}
983
979
984
984
-
static struct snd_kcontrol_new stac9200_mixer[] = {
980
980
+
static const struct snd_kcontrol_new stac9200_mixer[] = {
985
981
HDA_CODEC_VOLUME_MIN_MUTE("Master Playback Volume", 0xb, 0, HDA_OUTPUT),
986
982
HDA_CODEC_MUTE("Master Playback Switch", 0xb, 0, HDA_OUTPUT),
987
983
HDA_CODEC_VOLUME("Capture Volume", 0x0a, 0, HDA_OUTPUT),
···
989
985
{ } /* end */
990
986
};
991
987
992
992
-
static struct snd_kcontrol_new stac92hd73xx_6ch_loopback[] = {
988
988
+
static const struct snd_kcontrol_new stac92hd73xx_6ch_loopback[] = {
993
989
STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 3),
994
990
{}
995
991
};
996
992
997
997
-
static struct snd_kcontrol_new stac92hd73xx_8ch_loopback[] = {
993
993
+
static const struct snd_kcontrol_new stac92hd73xx_8ch_loopback[] = {
998
994
STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 4),
999
995
{}
1000
996
};
1001
997
1002
1002
-
static struct snd_kcontrol_new stac92hd73xx_10ch_loopback[] = {
998
998
+
static const struct snd_kcontrol_new stac92hd73xx_10ch_loopback[] = {
1003
999
STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 5),
1004
1000
{}
1005
1001
};
1006
1002
1007
1003
1008
1008
-
static struct snd_kcontrol_new stac92hd71bxx_loopback[] = {
1004
1004
+
static const struct snd_kcontrol_new stac92hd71bxx_loopback[] = {
1009
1005
STAC_ANALOG_LOOPBACK(0xFA0, 0x7A0, 2)
1010
1006
};
1011
1007
1012
1012
-
static struct snd_kcontrol_new stac925x_mixer[] = {
1008
1008
+
static const struct snd_kcontrol_new stac925x_mixer[] = {
1013
1009
HDA_CODEC_VOLUME_MIN_MUTE("Master Playback Volume", 0xe, 0, HDA_OUTPUT),
1014
1010
HDA_CODEC_MUTE("Master Playback Switch", 0x0e, 0, HDA_OUTPUT),
1015
1011
{ } /* end */
1016
1012
};
1017
1013
1018
1018
-
static struct snd_kcontrol_new stac9205_loopback[] = {
1014
1014
+
static const struct snd_kcontrol_new stac9205_loopback[] = {
1019
1015
STAC_ANALOG_LOOPBACK(0xFE0, 0x7E0, 1),
1020
1016
{}
1021
1017
};
1022
1018
1023
1023
-
static struct snd_kcontrol_new stac927x_loopback[] = {
1019
1019
+
static const struct snd_kcontrol_new stac927x_loopback[] = {
1024
1020
STAC_ANALOG_LOOPBACK(0xFEB, 0x7EB, 1),
1025
1021
{}
1026
1022
};
···
1186
1182
return 0;
1187
1183
}
1188
1184
1189
1189
-
static unsigned int ref9200_pin_configs[8] = {
1185
1185
+
static const unsigned int ref9200_pin_configs[8] = {
1190
1186
0x01c47010, 0x01447010, 0x0221401f, 0x01114010,
1191
1187
0x02a19020, 0x01a19021, 0x90100140, 0x01813122,
1192
1188
};
1193
1189
1194
1194
-
static unsigned int gateway9200_m4_pin_configs[8] = {
1190
1190
+
static const unsigned int gateway9200_m4_pin_configs[8] = {
1195
1191
0x400000fe, 0x404500f4, 0x400100f0, 0x90110010,
1196
1192
0x400100f1, 0x02a1902e, 0x500000f2, 0x500000f3,
1197
1193
};
1198
1198
-
static unsigned int gateway9200_m4_2_pin_configs[8] = {
1194
1194
+
static const unsigned int gateway9200_m4_2_pin_configs[8] = {
1199
1195
0x400000fe, 0x404500f4, 0x400100f0, 0x90110010,
1200
1196
0x400100f1, 0x02a1902e, 0x500000f2, 0x500000f3,
1201
1197
};
···
1206
1202
102801DE
1207
1203
102801E8
1208
1204
*/
1209
1209
-
static unsigned int dell9200_d21_pin_configs[8] = {
1205
1205
+
static const unsigned int dell9200_d21_pin_configs[8] = {
1210
1206
0x400001f0, 0x400001f1, 0x02214030, 0x01014010,
1211
1207
0x02a19020, 0x01a19021, 0x90100140, 0x01813122,
1212
1208
};
···
1216
1212
102801C0
1217
1213
102801C1
1218
1214
*/
1219
1219
-
static unsigned int dell9200_d22_pin_configs[8] = {
1215
1215
+
static const unsigned int dell9200_d22_pin_configs[8] = {
1220
1216
0x400001f0, 0x400001f1, 0x0221401f, 0x01014010,
1221
1217
0x01813020, 0x02a19021, 0x90100140, 0x400001f2,
1222
1218
};
···
1230
1226
102801DA
1231
1227
102801E3
1232
1228
*/
1233
1233
-
static unsigned int dell9200_d23_pin_configs[8] = {
1229
1229
+
static const unsigned int dell9200_d23_pin_configs[8] = {
1234
1230
0x400001f0, 0x400001f1, 0x0221401f, 0x01014010,
1235
1231
0x01813020, 0x01a19021, 0x90100140, 0x400001f2,
1236
1232
};
···
1241
1237
102801B5 (Dell Inspiron 630m)
1242
1238
102801D8 (Dell Inspiron 640m)
1243
1239
*/
1244
1244
-
static unsigned int dell9200_m21_pin_configs[8] = {
1240
1240
+
static const unsigned int dell9200_m21_pin_configs[8] = {
1245
1241
0x40c003fa, 0x03441340, 0x0321121f, 0x90170310,
1246
1242
0x408003fb, 0x03a11020, 0x401003fc, 0x403003fd,
1247
1243
};
···
1254
1250
102801D4
1255
1251
102801D6
1256
1252
*/
1257
1257
-
static unsigned int dell9200_m22_pin_configs[8] = {
1253
1253
+
static const unsigned int dell9200_m22_pin_configs[8] = {
1258
1254
0x40c003fa, 0x0144131f, 0x0321121f, 0x90170310,
1259
1255
0x90a70321, 0x03a11020, 0x401003fb, 0x40f000fc,
1260
1256
};
···
1264
1260
102801CE (Dell XPS M1710)
1265
1261
102801CF (Dell Precision M90)
1266
1262
*/
1267
1267
-
static unsigned int dell9200_m23_pin_configs[8] = {
1263
1263
+
static const unsigned int dell9200_m23_pin_configs[8] = {
1268
1264
0x40c003fa, 0x01441340, 0x0421421f, 0x90170310,
1269
1265
0x408003fb, 0x04a1102e, 0x90170311, 0x403003fc,
1270
1266
};
···
1276
1272
102801CB (Dell Latitude 120L)
1277
1273
102801D3
1278
1274
*/
1279
1279
-
static unsigned int dell9200_m24_pin_configs[8] = {
1275
1275
+
static const unsigned int dell9200_m24_pin_configs[8] = {
1280
1276
0x40c003fa, 0x404003fb, 0x0321121f, 0x90170310,
1281
1277
0x408003fc, 0x03a11020, 0x401003fd, 0x403003fe,
1282
1278
};
···
1287
1283
102801EE
1288
1284
102801EF
1289
1285
*/
1290
1290
-
static unsigned int dell9200_m25_pin_configs[8] = {
1286
1286
+
static const unsigned int dell9200_m25_pin_configs[8] = {
1291
1287
0x40c003fa, 0x01441340, 0x0421121f, 0x90170310,
1292
1288
0x408003fb, 0x04a11020, 0x401003fc, 0x403003fd,
1293
1289
};
···
1297
1293
102801F5 (Dell Inspiron 1501)
1298
1294
102801F6
1299
1295
*/
1300
1300
-
static unsigned int dell9200_m26_pin_configs[8] = {
1296
1296
+
static const unsigned int dell9200_m26_pin_configs[8] = {
1301
1297
0x40c003fa, 0x404003fb, 0x0421121f, 0x90170310,
1302
1298
0x408003fc, 0x04a11020, 0x401003fd, 0x403003fe,
1303
1299
};
···
1306
1302
STAC 9200-32
1307
1303
102801CD (Dell Inspiron E1705/9400)
1308
1304
*/
1309
1309
-
static unsigned int dell9200_m27_pin_configs[8] = {
1305
1305
+
static const unsigned int dell9200_m27_pin_configs[8] = {
1310
1306
0x40c003fa, 0x01441340, 0x0421121f, 0x90170310,
1311
1307
0x90170310, 0x04a11020, 0x90170310, 0x40f003fc,
1312
1308
};
1313
1309
1314
1314
-
static unsigned int oqo9200_pin_configs[8] = {
1310
1310
+
static const unsigned int oqo9200_pin_configs[8] = {
1315
1311
0x40c000f0, 0x404000f1, 0x0221121f, 0x02211210,
1316
1312
0x90170111, 0x90a70120, 0x400000f2, 0x400000f3,
1317
1313
};
1318
1314
1319
1315
1320
1320
-
static unsigned int *stac9200_brd_tbl[STAC_9200_MODELS] = {
1316
1316
+
static const unsigned int *stac9200_brd_tbl[STAC_9200_MODELS] = {
1321
1317
[STAC_REF] = ref9200_pin_configs,
1322
1318
[STAC_9200_OQO] = oqo9200_pin_configs,
1323
1319
[STAC_9200_DELL_D21] = dell9200_d21_pin_configs,
···
1354
1350
[STAC_9200_PANASONIC] = "panasonic",
1355
1351
};
1356
1352
1357
1357
-
static struct snd_pci_quirk stac9200_cfg_tbl[] = {
1353
1353
+
static const struct snd_pci_quirk stac9200_cfg_tbl[] = {
1358
1354
/* SigmaTel reference board */
1359
1355
SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1360
1356
"DFI LanParty", STAC_REF),
···
1430
1426
{} /* terminator */
1431
1427
};
1432
1428
1433
1433
-
static unsigned int ref925x_pin_configs[8] = {
1429
1429
+
static const unsigned int ref925x_pin_configs[8] = {
1434
1430
0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021,
1435
1431
0x90a70320, 0x02214210, 0x01019020, 0x9033032e,
1436
1432
};
1437
1433
1438
1438
-
static unsigned int stac925xM1_pin_configs[8] = {
1434
1434
+
static const unsigned int stac925xM1_pin_configs[8] = {
1439
1435
0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020,
1440
1436
0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e,
1441
1437
};
1442
1438
1443
1443
-
static unsigned int stac925xM1_2_pin_configs[8] = {
1439
1439
+
static const unsigned int stac925xM1_2_pin_configs[8] = {
1444
1440
0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020,
1445
1441
0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e,
1446
1442
};
1447
1443
1448
1448
-
static unsigned int stac925xM2_pin_configs[8] = {
1444
1444
+
static const unsigned int stac925xM2_pin_configs[8] = {
1449
1445
0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020,
1450
1446
0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e,
1451
1447
};
1452
1448
1453
1453
-
static unsigned int stac925xM2_2_pin_configs[8] = {
1449
1449
+
static const unsigned int stac925xM2_2_pin_configs[8] = {
1454
1450
0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020,
1455
1451
0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e,
1456
1452
};
1457
1453
1458
1458
-
static unsigned int stac925xM3_pin_configs[8] = {
1454
1454
+
static const unsigned int stac925xM3_pin_configs[8] = {
1459
1455
0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020,
1460
1456
0x40a000f0, 0x90100210, 0x400003f1, 0x503303f3,
1461
1457
};
1462
1458
1463
1463
-
static unsigned int stac925xM5_pin_configs[8] = {
1459
1459
+
static const unsigned int stac925xM5_pin_configs[8] = {
1464
1460
0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020,
1465
1461
0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e,
1466
1462
};
1467
1463
1468
1468
-
static unsigned int stac925xM6_pin_configs[8] = {
1464
1464
+
static const unsigned int stac925xM6_pin_configs[8] = {
1469
1465
0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020,
1470
1466
0x40a000f0, 0x90100210, 0x400003f1, 0x90330320,
1471
1467
};
1472
1468
1473
1473
-
static unsigned int *stac925x_brd_tbl[STAC_925x_MODELS] = {
1469
1469
+
static const unsigned int *stac925x_brd_tbl[STAC_925x_MODELS] = {
1474
1470
[STAC_REF] = ref925x_pin_configs,
1475
1471
[STAC_M1] = stac925xM1_pin_configs,
1476
1472
[STAC_M1_2] = stac925xM1_2_pin_configs,
···
1493
1489
[STAC_M6] = "m6",
1494
1490
};
1495
1491
1496
1496
-
static struct snd_pci_quirk stac925x_codec_id_cfg_tbl[] = {
1492
1492
+
static const struct snd_pci_quirk stac925x_codec_id_cfg_tbl[] = {
1497
1493
SND_PCI_QUIRK(0x107b, 0x0316, "Gateway M255", STAC_M2),
1498
1494
SND_PCI_QUIRK(0x107b, 0x0366, "Gateway MP6954", STAC_M5),
1499
1495
SND_PCI_QUIRK(0x107b, 0x0461, "Gateway NX560XL", STAC_M1),
···
1507
1503
{} /* terminator */
1508
1504
};
1509
1505
1510
1510
-
static struct snd_pci_quirk stac925x_cfg_tbl[] = {
1506
1506
+
static const struct snd_pci_quirk stac925x_cfg_tbl[] = {
1511
1507
/* SigmaTel reference board */
1512
1508
SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, "DFI LanParty", STAC_REF),
1513
1509
SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, "DFI LanParty", STAC_REF),
···
1519
1515
{} /* terminator */
1520
1516
};
1521
1517
1522
1522
-
static unsigned int ref92hd73xx_pin_configs[13] = {
1518
1518
+
static const unsigned int ref92hd73xx_pin_configs[13] = {
1523
1519
0x02214030, 0x02a19040, 0x01a19020, 0x02214030,
1524
1520
0x0181302e, 0x01014010, 0x01014020, 0x01014030,
1525
1521
0x02319040, 0x90a000f0, 0x90a000f0, 0x01452050,
1526
1522
0x01452050,
1527
1523
};
1528
1524
1529
1529
-
static unsigned int dell_m6_pin_configs[13] = {
1525
1525
+
static const unsigned int dell_m6_pin_configs[13] = {
1530
1526
0x0321101f, 0x4f00000f, 0x4f0000f0, 0x90170110,
1531
1527
0x03a11020, 0x0321101f, 0x4f0000f0, 0x4f0000f0,
1532
1528
0x4f0000f0, 0x90a60160, 0x4f0000f0, 0x4f0000f0,
1533
1529
0x4f0000f0,
1534
1530
};
1535
1531
1536
1536
-
static unsigned int alienware_m17x_pin_configs[13] = {
1532
1532
+
static const unsigned int alienware_m17x_pin_configs[13] = {
1537
1533
0x0321101f, 0x0321101f, 0x03a11020, 0x03014020,
1538
1534
0x90170110, 0x4f0000f0, 0x4f0000f0, 0x4f0000f0,
1539
1535
0x4f0000f0, 0x90a60160, 0x4f0000f0, 0x4f0000f0,
1540
1536
0x904601b0,
1541
1537
};
1542
1538
1543
1543
-
static unsigned int intel_dg45id_pin_configs[13] = {
1539
1539
+
static const unsigned int intel_dg45id_pin_configs[13] = {
1544
1540
0x02214230, 0x02A19240, 0x01013214, 0x01014210,
1545
1541
0x01A19250, 0x01011212, 0x01016211
1546
1542
};
1547
1543
1548
1548
-
static unsigned int *stac92hd73xx_brd_tbl[STAC_92HD73XX_MODELS] = {
1544
1544
+
static const unsigned int *stac92hd73xx_brd_tbl[STAC_92HD73XX_MODELS] = {
1549
1545
[STAC_92HD73XX_REF] = ref92hd73xx_pin_configs,
1550
1546
[STAC_DELL_M6_AMIC] = dell_m6_pin_configs,
1551
1547
[STAC_DELL_M6_DMIC] = dell_m6_pin_configs,
···
1567
1563
[STAC_ALIENWARE_M17X] = "alienware",
1568
1564
};
1569
1565
1570
1570
-
static struct snd_pci_quirk stac92hd73xx_cfg_tbl[] = {
1566
1566
+
static const struct snd_pci_quirk stac92hd73xx_cfg_tbl[] = {
1571
1567
/* SigmaTel reference board */
1572
1568
SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1573
1569
"DFI LanParty", STAC_92HD73XX_REF),
···
1604
1600
SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02fe,
1605
1601
"Dell Studio XPS 1645", STAC_DELL_M6_BOTH),
1606
1602
SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0413,
1607
1607
-
"Dell Studio 1558", STAC_DELL_M6_BOTH),
1603
1603
+
"Dell Studio 1558", STAC_DELL_M6_DMIC),
1608
1604
{} /* terminator */
1609
1605
};
1610
1606
1611
1611
-
static struct snd_pci_quirk stac92hd73xx_codec_id_cfg_tbl[] = {
1607
1607
+
static const struct snd_pci_quirk stac92hd73xx_codec_id_cfg_tbl[] = {
1612
1608
SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02a1,
1613
1609
"Alienware M17x", STAC_ALIENWARE_M17X),
1614
1610
SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x043a,
···
1616
1612
{} /* terminator */
1617
1613
};
1618
1614
1619
1619
-
static unsigned int ref92hd83xxx_pin_configs[10] = {
1615
1615
+
static const unsigned int ref92hd83xxx_pin_configs[10] = {
1620
1616
0x02214030, 0x02211010, 0x02a19020, 0x02170130,
1621
1617
0x01014050, 0x01819040, 0x01014020, 0x90a3014e,
1622
1618
0x01451160, 0x98560170,
1623
1619
};
1624
1620
1625
1625
-
static unsigned int dell_s14_pin_configs[10] = {
1621
1621
+
static const unsigned int dell_s14_pin_configs[10] = {
1626
1622
0x0221403f, 0x0221101f, 0x02a19020, 0x90170110,
1627
1623
0x40f000f0, 0x40f000f0, 0x40f000f0, 0x90a60160,
1628
1624
0x40f000f0, 0x40f000f0,
1629
1625
};
1630
1626
1631
1631
-
static unsigned int hp_dv7_4000_pin_configs[10] = {
1627
1627
+
static const unsigned int hp_dv7_4000_pin_configs[10] = {
1632
1628
0x03a12050, 0x0321201f, 0x40f000f0, 0x90170110,
1633
1629
0x40f000f0, 0x40f000f0, 0x90170110, 0xd5a30140,
1634
1630
0x40f000f0, 0x40f000f0,
1635
1631
};
1636
1632
1637
1637
-
static unsigned int *stac92hd83xxx_brd_tbl[STAC_92HD83XXX_MODELS] = {
1633
1633
+
static const unsigned int *stac92hd83xxx_brd_tbl[STAC_92HD83XXX_MODELS] = {
1638
1634
[STAC_92HD83XXX_REF] = ref92hd83xxx_pin_configs,
1639
1635
[STAC_92HD83XXX_PWR_REF] = ref92hd83xxx_pin_configs,
1640
1636
[STAC_DELL_S14] = dell_s14_pin_configs,
···
1650
1646
[STAC_HP_DV7_4000] = "hp-dv7-4000",
1651
1647
};
1652
1648
1653
1653
-
static struct snd_pci_quirk stac92hd83xxx_cfg_tbl[] = {
1649
1649
+
static const struct snd_pci_quirk stac92hd83xxx_cfg_tbl[] = {
1654
1650
/* SigmaTel reference board */
1655
1651
SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1656
1652
"DFI LanParty", STAC_92HD83XXX_REF),
···
1663
1659
{} /* terminator */
1664
1660
};
1665
1661
1666
1666
-
static unsigned int ref92hd71bxx_pin_configs[STAC92HD71BXX_NUM_PINS] = {
1662
1662
+
static const unsigned int ref92hd71bxx_pin_configs[STAC92HD71BXX_NUM_PINS] = {
1667
1663
0x02214030, 0x02a19040, 0x01a19020, 0x01014010,
1668
1664
0x0181302e, 0x01014010, 0x01019020, 0x90a000f0,
1669
1665
0x90a000f0, 0x01452050, 0x01452050, 0x00000000,
1670
1666
0x00000000
1671
1667
};
1672
1668
1673
1673
-
static unsigned int dell_m4_1_pin_configs[STAC92HD71BXX_NUM_PINS] = {
1669
1669
+
static const unsigned int dell_m4_1_pin_configs[STAC92HD71BXX_NUM_PINS] = {
1674
1670
0x0421101f, 0x04a11221, 0x40f000f0, 0x90170110,
1675
1671
0x23a1902e, 0x23014250, 0x40f000f0, 0x90a000f0,
1676
1672
0x40f000f0, 0x4f0000f0, 0x4f0000f0, 0x00000000,
1677
1673
0x00000000
1678
1674
};
1679
1675
1680
1680
-
static unsigned int dell_m4_2_pin_configs[STAC92HD71BXX_NUM_PINS] = {
1676
1676
+
static const unsigned int dell_m4_2_pin_configs[STAC92HD71BXX_NUM_PINS] = {
1681
1677
0x0421101f, 0x04a11221, 0x90a70330, 0x90170110,
1682
1678
0x23a1902e, 0x23014250, 0x40f000f0, 0x40f000f0,
1683
1679
0x40f000f0, 0x044413b0, 0x044413b0, 0x00000000,
1684
1680
0x00000000
1685
1681
};
1686
1682
1687
1687
-
static unsigned int dell_m4_3_pin_configs[STAC92HD71BXX_NUM_PINS] = {
1683
1683
+
static const unsigned int dell_m4_3_pin_configs[STAC92HD71BXX_NUM_PINS] = {
1688
1684
0x0421101f, 0x04a11221, 0x90a70330, 0x90170110,
1689
1685
0x40f000f0, 0x40f000f0, 0x40f000f0, 0x90a000f0,
1690
1686
0x40f000f0, 0x044413b0, 0x044413b0, 0x00000000,
1691
1687
0x00000000
1692
1688
};
1693
1689
1694
1694
-
static unsigned int *stac92hd71bxx_brd_tbl[STAC_92HD71BXX_MODELS] = {
1690
1690
+
static const unsigned int *stac92hd71bxx_brd_tbl[STAC_92HD71BXX_MODELS] = {
1695
1691
[STAC_92HD71BXX_REF] = ref92hd71bxx_pin_configs,
1696
1692
[STAC_DELL_M4_1] = dell_m4_1_pin_configs,
1697
1693
[STAC_DELL_M4_2] = dell_m4_2_pin_configs,
···
1716
1712
[STAC_HP_DV4_1222NR] = "hp-dv4-1222nr",
1717
1713
};
1718
1714
1719
1719
-
static struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = {
1715
1715
+
static const struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = {
1720
1716
/* SigmaTel reference board */
1721
1717
SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1722
1718
"DFI LanParty", STAC_92HD71BXX_REF),
···
1773
1769
{} /* terminator */
1774
1770
};
1775
1771
1776
1776
-
static unsigned int ref922x_pin_configs[10] = {
1772
1772
+
static const unsigned int ref922x_pin_configs[10] = {
1777
1773
0x01014010, 0x01016011, 0x01012012, 0x0221401f,
1778
1774
0x01813122, 0x01011014, 0x01441030, 0x01c41030,
1779
1775
0x40000100, 0x40000100,
···
1787
1783
102801D1
1788
1784
102801D2
1789
1785
*/
1790
1790
-
static unsigned int dell_922x_d81_pin_configs[10] = {
1786
1786
+
static const unsigned int dell_922x_d81_pin_configs[10] = {
1791
1787
0x02214030, 0x01a19021, 0x01111012, 0x01114010,
1792
1788
0x02a19020, 0x01117011, 0x400001f0, 0x400001f1,
1793
1789
0x01813122, 0x400001f2,
···
1798
1794
102801AC
1799
1795
102801D0
1800
1796
*/
1801
1801
-
static unsigned int dell_922x_d82_pin_configs[10] = {
1797
1797
+
static const unsigned int dell_922x_d82_pin_configs[10] = {
1802
1798
0x02214030, 0x01a19021, 0x01111012, 0x01114010,
1803
1799
0x02a19020, 0x01117011, 0x01451140, 0x400001f0,
1804
1800
0x01813122, 0x400001f1,
···
1808
1804
STAC 922X pin configs for
1809
1805
102801BF
1810
1806
*/
1811
1811
-
static unsigned int dell_922x_m81_pin_configs[10] = {
1807
1807
+
static const unsigned int dell_922x_m81_pin_configs[10] = {
1812
1808
0x0321101f, 0x01112024, 0x01111222, 0x91174220,
1813
1809
0x03a11050, 0x01116221, 0x90a70330, 0x01452340,
1814
1810
0x40C003f1, 0x405003f0,
···
1818
1814
STAC 9221 A1 pin configs for
1819
1815
102801D7 (Dell XPS M1210)
1820
1816
*/
1821
1821
-
static unsigned int dell_922x_m82_pin_configs[10] = {
1817
1817
+
static const unsigned int dell_922x_m82_pin_configs[10] = {
1822
1818
0x02211211, 0x408103ff, 0x02a1123e, 0x90100310,
1823
1819
0x408003f1, 0x0221121f, 0x03451340, 0x40c003f2,
1824
1820
0x508003f3, 0x405003f4,
1825
1821
};
1826
1822
1827
1827
-
static unsigned int d945gtp3_pin_configs[10] = {
1823
1823
+
static const unsigned int d945gtp3_pin_configs[10] = {
1828
1824
0x0221401f, 0x01a19022, 0x01813021, 0x01014010,
1829
1825
0x40000100, 0x40000100, 0x40000100, 0x40000100,
1830
1826
0x02a19120, 0x40000100,
1831
1827
};
1832
1828
1833
1833
-
static unsigned int d945gtp5_pin_configs[10] = {
1829
1829
+
static const unsigned int d945gtp5_pin_configs[10] = {
1834
1830
0x0221401f, 0x01011012, 0x01813024, 0x01014010,
1835
1831
0x01a19021, 0x01016011, 0x01452130, 0x40000100,
1836
1832
0x02a19320, 0x40000100,
1837
1833
};
1838
1834
1839
1839
-
static unsigned int intel_mac_v1_pin_configs[10] = {
1835
1835
+
static const unsigned int intel_mac_v1_pin_configs[10] = {
1840
1836
0x0121e21f, 0x400000ff, 0x9017e110, 0x400000fd,
1841
1837
0x400000fe, 0x0181e020, 0x1145e030, 0x11c5e240,
1842
1838
0x400000fc, 0x400000fb,
1843
1839
};
1844
1840
1845
1845
-
static unsigned int intel_mac_v2_pin_configs[10] = {
1841
1841
+
static const unsigned int intel_mac_v2_pin_configs[10] = {
1846
1842
0x0121e21f, 0x90a7012e, 0x9017e110, 0x400000fd,
1847
1843
0x400000fe, 0x0181e020, 0x1145e230, 0x500000fa,
1848
1844
0x400000fc, 0x400000fb,
1849
1845
};
1850
1846
1851
1851
-
static unsigned int intel_mac_v3_pin_configs[10] = {
1847
1847
+
static const unsigned int intel_mac_v3_pin_configs[10] = {
1852
1848
0x0121e21f, 0x90a7012e, 0x9017e110, 0x400000fd,
1853
1849
0x400000fe, 0x0181e020, 0x1145e230, 0x11c5e240,
1854
1850
0x400000fc, 0x400000fb,
1855
1851
};
1856
1852
1857
1857
-
static unsigned int intel_mac_v4_pin_configs[10] = {
1853
1853
+
static const unsigned int intel_mac_v4_pin_configs[10] = {
1858
1854
0x0321e21f, 0x03a1e02e, 0x9017e110, 0x9017e11f,
1859
1855
0x400000fe, 0x0381e020, 0x1345e230, 0x13c5e240,
1860
1856
0x400000fc, 0x400000fb,
1861
1857
};
1862
1858
1863
1863
-
static unsigned int intel_mac_v5_pin_configs[10] = {
1859
1859
+
static const unsigned int intel_mac_v5_pin_configs[10] = {
1864
1860
0x0321e21f, 0x03a1e02e, 0x9017e110, 0x9017e11f,
1865
1861
0x400000fe, 0x0381e020, 0x1345e230, 0x13c5e240,
1866
1862
0x400000fc, 0x400000fb,
1867
1863
};
1868
1864
1869
1869
-
static unsigned int ecs202_pin_configs[10] = {
1865
1865
+
static const unsigned int ecs202_pin_configs[10] = {
1870
1866
0x0221401f, 0x02a19020, 0x01a19020, 0x01114010,
1871
1867
0x408000f0, 0x01813022, 0x074510a0, 0x40c400f1,
1872
1868
0x9037012e, 0x40e000f2,
1873
1869
};
1874
1870
1875
1875
-
static unsigned int *stac922x_brd_tbl[STAC_922X_MODELS] = {
1871
1871
+
static const unsigned int *stac922x_brd_tbl[STAC_922X_MODELS] = {
1876
1872
[STAC_D945_REF] = ref922x_pin_configs,
1877
1873
[STAC_D945GTP3] = d945gtp3_pin_configs,
1878
1874
[STAC_D945GTP5] = d945gtp5_pin_configs,
···
1921
1917
[STAC_922X_DELL_M82] = "dell-m82",
1922
1918
};
1923
1919
1924
1924
-
static struct snd_pci_quirk stac922x_cfg_tbl[] = {
1920
1920
+
static const struct snd_pci_quirk stac922x_cfg_tbl[] = {
1925
1921
/* SigmaTel reference board */
1926
1922
SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1927
1923
"DFI LanParty", STAC_D945_REF),
···
2012
2008
{} /* terminator */
2013
2009
};
2014
2010
2015
2015
-
static unsigned int ref927x_pin_configs[14] = {
2011
2011
+
static const unsigned int ref927x_pin_configs[14] = {
2016
2012
0x02214020, 0x02a19080, 0x0181304e, 0x01014010,
2017
2013
0x01a19040, 0x01011012, 0x01016011, 0x0101201f,
2018
2014
0x183301f0, 0x18a001f0, 0x18a001f0, 0x01442070,
2019
2015
0x01c42190, 0x40000100,
2020
2016
};
2021
2017
2022
2022
-
static unsigned int d965_3st_pin_configs[14] = {
2018
2018
+
static const unsigned int d965_3st_pin_configs[14] = {
2023
2019
0x0221401f, 0x02a19120, 0x40000100, 0x01014011,
2024
2020
0x01a19021, 0x01813024, 0x40000100, 0x40000100,
2025
2021
0x40000100, 0x40000100, 0x40000100, 0x40000100,
2026
2022
0x40000100, 0x40000100
2027
2023
};
2028
2024
2029
2029
-
static unsigned int d965_5st_pin_configs[14] = {
2025
2025
+
static const unsigned int d965_5st_pin_configs[14] = {
2030
2026
0x02214020, 0x02a19080, 0x0181304e, 0x01014010,
2031
2027
0x01a19040, 0x01011012, 0x01016011, 0x40000100,
2032
2028
0x40000100, 0x40000100, 0x40000100, 0x01442070,
2033
2029
0x40000100, 0x40000100
2034
2030
};
2035
2031
2036
2036
-
static unsigned int d965_5st_no_fp_pin_configs[14] = {
2032
2032
+
static const unsigned int d965_5st_no_fp_pin_configs[14] = {
2037
2033
0x40000100, 0x40000100, 0x0181304e, 0x01014010,
2038
2034
0x01a19040, 0x01011012, 0x01016011, 0x40000100,
2039
2035
0x40000100, 0x40000100, 0x40000100, 0x01442070,
2040
2036
0x40000100, 0x40000100
2041
2037
};
2042
2038
2043
2043
-
static unsigned int dell_3st_pin_configs[14] = {
2039
2039
+
static const unsigned int dell_3st_pin_configs[14] = {
2044
2040
0x02211230, 0x02a11220, 0x01a19040, 0x01114210,
2045
2041
0x01111212, 0x01116211, 0x01813050, 0x01112214,
2046
2042
0x403003fa, 0x90a60040, 0x90a60040, 0x404003fb,
2047
2043
0x40c003fc, 0x40000100
2048
2044
};
2049
2045
2050
2050
-
static unsigned int *stac927x_brd_tbl[STAC_927X_MODELS] = {
2046
2046
+
static const unsigned int *stac927x_brd_tbl[STAC_927X_MODELS] = {
2051
2047
[STAC_D965_REF_NO_JD] = ref927x_pin_configs,
2052
2048
[STAC_D965_REF] = ref927x_pin_configs,
2053
2049
[STAC_D965_3ST] = d965_3st_pin_configs,
···
2070
2066
[STAC_927X_VOLKNOB] = "volknob",
2071
2067
};
2072
2068
2073
2073
-
static struct snd_pci_quirk stac927x_cfg_tbl[] = {
2069
2069
+
static const struct snd_pci_quirk stac927x_cfg_tbl[] = {
2074
2070
/* SigmaTel reference board */
2075
2071
SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
2076
2072
"DFI LanParty", STAC_D965_REF),
···
2108
2104
{} /* terminator */
2109
2105
};
2110
2106
2111
2111
-
static unsigned int ref9205_pin_configs[12] = {
2107
2107
+
static const unsigned int ref9205_pin_configs[12] = {
2112
2108
0x40000100, 0x40000100, 0x01016011, 0x01014010,
2113
2109
0x01813122, 0x01a19021, 0x01019020, 0x40000100,
2114
2110
0x90a000f0, 0x90a000f0, 0x01441030, 0x01c41030
···
2125
2121
10280228 (Dell Vostro 1500)
2126
2122
10280229 (Dell Vostro 1700)
2127
2123
*/
2128
2128
-
static unsigned int dell_9205_m42_pin_configs[12] = {
2124
2124
+
static const unsigned int dell_9205_m42_pin_configs[12] = {
2129
2125
0x0321101F, 0x03A11020, 0x400003FA, 0x90170310,
2130
2126
0x400003FB, 0x400003FC, 0x400003FD, 0x40F000F9,
2131
2127
0x90A60330, 0x400003FF, 0x0144131F, 0x40C003FE,
···
2141
2137
10280200
2142
2138
10280201
2143
2139
*/
2144
2144
-
static unsigned int dell_9205_m43_pin_configs[12] = {
2140
2140
+
static const unsigned int dell_9205_m43_pin_configs[12] = {
2145
2141
0x0321101f, 0x03a11020, 0x90a70330, 0x90170310,
2146
2142
0x400000fe, 0x400000ff, 0x400000fd, 0x40f000f9,
2147
2143
0x400000fa, 0x400000fc, 0x0144131f, 0x40c003f8,
2148
2144
};
2149
2145
2150
2150
-
static unsigned int dell_9205_m44_pin_configs[12] = {
2146
2146
+
static const unsigned int dell_9205_m44_pin_configs[12] = {
2151
2147
0x0421101f, 0x04a11020, 0x400003fa, 0x90170310,
2152
2148
0x400003fb, 0x400003fc, 0x400003fd, 0x400003f9,
2153
2149
0x90a60330, 0x400003ff, 0x01441340, 0x40c003fe,
2154
2150
};
2155
2151
2156
2156
-
static unsigned int *stac9205_brd_tbl[STAC_9205_MODELS] = {
2152
2152
+
static const unsigned int *stac9205_brd_tbl[STAC_9205_MODELS] = {
2157
2153
[STAC_9205_REF] = ref9205_pin_configs,
2158
2154
[STAC_9205_DELL_M42] = dell_9205_m42_pin_configs,
2159
2155
[STAC_9205_DELL_M43] = dell_9205_m43_pin_configs,
···
2170
2166
[STAC_9205_EAPD] = "eapd",
2171
2167
};
2172
2168
2173
2173
-
static struct snd_pci_quirk stac9205_cfg_tbl[] = {
2169
2169
+
static const struct snd_pci_quirk stac9205_cfg_tbl[] = {
2174
2170
/* SigmaTel reference board */
2175
2171
SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
2176
2172
"DFI LanParty", STAC_9205_REF),
···
2218
2214
};
2219
2215
2220
2216
static void stac92xx_set_config_regs(struct hda_codec *codec,
2221
2221
-
unsigned int *pincfgs)
2217
2217
+
const unsigned int *pincfgs)
2222
2218
{
2223
2219
int i;
2224
2220
struct sigmatel_spec *spec = codec->spec;
···
2338
2334
return 0;
2339
2335
}
2340
2336
2341
2341
-
static struct hda_pcm_stream stac92xx_pcm_digital_playback = {
2337
2337
+
static const struct hda_pcm_stream stac92xx_pcm_digital_playback = {
2342
2338
.substreams = 1,
2343
2339
.channels_min = 2,
2344
2340
.channels_max = 2,
···
2351
2347
},
2352
2348
};
2353
2349
2354
2354
-
static struct hda_pcm_stream stac92xx_pcm_digital_capture = {
2350
2350
+
static const struct hda_pcm_stream stac92xx_pcm_digital_capture = {
2355
2351
.substreams = 1,
2356
2352
.channels_min = 2,
2357
2353
.channels_max = 2,
2358
2354
/* NID is set in stac92xx_build_pcms */
2359
2355
};
2360
2356
2361
2361
-
static struct hda_pcm_stream stac92xx_pcm_analog_playback = {
2357
2357
+
static const struct hda_pcm_stream stac92xx_pcm_analog_playback = {
2362
2358
.substreams = 1,
2363
2359
.channels_min = 2,
2364
2360
.channels_max = 8,
···
2370
2366
},
2371
2367
};
2372
2368
2373
2373
-
static struct hda_pcm_stream stac92xx_pcm_analog_alt_playback = {
2369
2369
+
static const struct hda_pcm_stream stac92xx_pcm_analog_alt_playback = {
2374
2370
.substreams = 1,
2375
2371
.channels_min = 2,
2376
2372
.channels_max = 2,
···
2382
2378
},
2383
2379
};
2384
2380
2385
2385
-
static struct hda_pcm_stream stac92xx_pcm_analog_capture = {
2381
2381
+
static const struct hda_pcm_stream stac92xx_pcm_analog_capture = {
2386
2382
.channels_min = 2,
2387
2383
.channels_max = 2,
2388
2384
/* NID + .substreams is set in stac92xx_build_pcms */
···
2491
2487
struct snd_ctl_elem_info *uinfo)
2492
2488
{
2493
2489
int i;
2494
2494
-
static char *texts[] = {
2490
2490
+
static const char * const texts[] = {
2495
2491
"Mic In", "Line In", "Line Out"
2496
2492
};
2497
2493
···
2560
2556
static int stac92xx_io_switch_info(struct snd_kcontrol *kcontrol,
2561
2557
struct snd_ctl_elem_info *uinfo)
2562
2558
{
2563
2563
-
static char *texts[2];
2559
2559
+
char *texts[2];
2564
2560
struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2565
2561
struct sigmatel_spec *spec = codec->spec;
2566
2562
···
2691
2687
STAC_CTL_WIDGET_DC_BIAS
2692
2688
};
2693
2689
2694
2694
-
static struct snd_kcontrol_new stac92xx_control_templates[] = {
2690
2690
+
static const struct snd_kcontrol_new stac92xx_control_templates[] = {
2695
2691
HDA_CODEC_VOLUME(NULL, 0, 0, 0),
2696
2692
HDA_CODEC_MUTE(NULL, 0, 0, 0),
2697
2693
HDA_CODEC_MUTE_BEEP(NULL, 0, 0, 0),
···
2705
2701
/* add dynamic controls */
2706
2702
static struct snd_kcontrol_new *
2707
2703
stac_control_new(struct sigmatel_spec *spec,
2708
2708
-
struct snd_kcontrol_new *ktemp,
2704
2704
+
const struct snd_kcontrol_new *ktemp,
2709
2705
const char *name,
2710
2706
unsigned int subdev)
2711
2707
{
···
2728
2724
}
2729
2725
2730
2726
static int stac92xx_add_control_temp(struct sigmatel_spec *spec,
2731
2731
-
struct snd_kcontrol_new *ktemp,
2727
2727
+
const struct snd_kcontrol_new *ktemp,
2732
2728
int idx, const char *name,
2733
2729
unsigned long val)
2734
2730
{
···
2758
2754
return stac92xx_add_control_idx(spec, type, 0, name, val);
2759
2755
}
2760
2756
2761
2761
-
static struct snd_kcontrol_new stac_input_src_temp = {
2757
2757
+
static const struct snd_kcontrol_new stac_input_src_temp = {
2762
2758
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2763
2759
.name = "Input Source",
2764
2760
.info = stac92xx_mux_enum_info,
···
3076
3072
printk(KERN_WARNING "stac92xx: No space for DAC 0x%x\n", nid);
3077
3073
return 1;
3078
3074
} else {
3079
3079
-
spec->multiout.dac_nids[spec->multiout.num_dacs] = nid;
3075
3075
+
snd_BUG_ON(spec->multiout.dac_nids != spec->dac_nids);
3076
3076
+
spec->dac_nids[spec->multiout.num_dacs] = nid;
3080
3077
spec->multiout.num_dacs++;
3081
3078
}
3082
3079
return 0;
···
3114
3109
3115
3110
for (i = 0; i < num_outs && i < ARRAY_SIZE(chname); i++) {
3116
3111
if (type == AUTO_PIN_HP_OUT && !spec->hp_detect) {
3117
3117
-
wid_caps = get_wcaps(codec, pins[i]);
3118
3118
-
if (wid_caps & AC_WCAP_UNSOL_CAP)
3112
3112
+
if (is_jack_detectable(codec, pins[i]))
3119
3113
spec->hp_detect = 1;
3120
3114
}
3121
3115
nid = dac_nids[i];
···
3313
3309
return snd_hda_enable_beep_device(codec, ucontrol->value.integer.value[0]);
3314
3310
}
3315
3311
3316
3316
-
static struct snd_kcontrol_new stac92xx_dig_beep_ctrl = {
3312
3312
+
static const struct snd_kcontrol_new stac92xx_dig_beep_ctrl = {
3317
3313
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3318
3314
.info = stac92xx_dig_beep_switch_info,
3319
3315
.get = stac92xx_dig_beep_switch_get,
···
3520
3516
hda_nid_t *fixed, hda_nid_t *ext, hda_nid_t *dock)
3521
3517
{
3522
3518
unsigned int cfg;
3519
3519
+
unsigned int type;
3523
3520
3524
3521
if (!nid)
3525
3522
return 0;
3526
3523
cfg = snd_hda_codec_get_pincfg(codec, nid);
3524
3524
+
type = get_defcfg_device(cfg);
3527
3525
switch (snd_hda_get_input_pin_attr(cfg)) {
3528
3526
case INPUT_PIN_ATTR_INT:
3529
3527
if (*fixed)
3530
3528
return 1; /* already occupied */
3529
3529
+
if (type != AC_JACK_MIC_IN)
3530
3530
+
return 1; /* invalid type */
3531
3531
*fixed = nid;
3532
3532
break;
3533
3533
case INPUT_PIN_ATTR_UNUSED:
···
3539
3531
case INPUT_PIN_ATTR_DOCK:
3540
3532
if (*dock)
3541
3533
return 1; /* already occupied */
3534
3534
+
if (type != AC_JACK_MIC_IN && type != AC_JACK_LINE_IN)
3535
3535
+
return 1; /* invalid type */
3542
3536
*dock = nid;
3543
3537
break;
3544
3538
default:
3545
3539
if (*ext)
3546
3540
return 1; /* already occupied */
3541
3541
+
if (type != AC_JACK_MIC_IN)
3542
3542
+
return 1; /* invalid type */
3547
3543
*ext = nid;
3548
3544
break;
3549
3545
}
···
3603
3591
hda_nid_t fixed, ext, dock;
3604
3592
int i;
3605
3593
3606
3606
-
for (i = 0; i < cfg->num_inputs; i++) {
3607
3607
-
if (cfg->inputs[i].type >= AUTO_PIN_LINE_IN)
3608
3608
-
return 0; /* must be exclusively mics */
3609
3609
-
}
3610
3594
fixed = ext = dock = 0;
3611
3595
for (i = 0; i < cfg->num_inputs; i++)
3612
3596
if (check_mic_pin(codec, cfg->inputs[i].pin,
···
3614
3606
return 0;
3615
3607
if (!fixed || (!ext && !dock))
3616
3608
return 0; /* no input to switch */
3617
3617
-
if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP))
3609
3609
+
if (!is_jack_detectable(codec, ext))
3618
3610
return 0; /* no unsol support */
3619
3611
if (set_mic_route(codec, &spec->ext_mic, ext) ||
3620
3612
set_mic_route(codec, &spec->int_mic, fixed) ||
···
3929
3921
{
3930
3922
struct sigmatel_spec *spec = codec->spec;
3931
3923
hda_nid_t pin = cfg->hp_pins[0];
3932
3932
-
unsigned int wid_caps;
3933
3924
3934
3925
if (! pin)
3935
3926
return 0;
3936
3927
3937
3937
-
wid_caps = get_wcaps(codec, pin);
3938
3938
-
if (wid_caps & AC_WCAP_UNSOL_CAP)
3928
3928
+
if (is_jack_detectable(codec, pin))
3939
3929
spec->hp_detect = 1;
3940
3930
3941
3931
return 0;
···
4144
4138
struct sigmatel_event *event;
4145
4139
int tag;
4146
4140
4147
4147
-
if (!(get_wcaps(codec, nid) & AC_WCAP_UNSOL_CAP))
4141
4141
+
if (!is_jack_detectable(codec, nid))
4148
4142
return 0;
4149
4143
event = stac_get_event(codec, nid);
4150
4144
if (event) {
···
4177
4171
struct sigmatel_spec *spec = codec->spec;
4178
4172
4179
4173
/* power down inactive DACs */
4180
4180
-
hda_nid_t *dac;
4174
4174
+
const hda_nid_t *dac;
4181
4175
for (dac = spec->dac_list; *dac; dac++)
4182
4176
if (!check_all_dac_nids(spec, *dac))
4183
4177
snd_hda_codec_write(codec, *dac, 0,
···
4650
4644
}
4651
4645
4652
4646
static int stac92xx_connected_ports(struct hda_codec *codec,
4653
4653
-
hda_nid_t *nids, int num_nids)
4647
4647
+
const hda_nid_t *nids, int num_nids)
4654
4648
{
4655
4649
struct sigmatel_spec *spec = codec->spec;
4656
4650
int idx, num;
···
4974
4968
}
4975
4969
#endif
4976
4970
4977
4977
-
static struct hda_codec_ops stac92xx_patch_ops = {
4971
4971
+
static const struct hda_codec_ops stac92xx_patch_ops = {
4978
4972
.build_controls = stac92xx_build_controls,
4979
4973
.build_pcms = stac92xx_build_pcms,
4980
4974
.init = stac92xx_init,
···
5594
5588
return 1;
5595
5589
}
5596
5590
5597
5597
-
static struct snd_kcontrol_new stac_hp_bass_sw_ctrl = {
5591
5591
+
static const struct snd_kcontrol_new stac_hp_bass_sw_ctrl = {
5598
5592
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5599
5593
.info = stac_hp_bass_gpio_info,
5600
5594
.get = stac_hp_bass_gpio_get,
···
5618
5612
static int patch_stac92hd71bxx(struct hda_codec *codec)
5619
5613
{
5620
5614
struct sigmatel_spec *spec;
5621
5621
-
struct hda_verb *unmute_init = stac92hd71bxx_unmute_core_init;
5615
5615
+
const struct hda_verb *unmute_init = stac92hd71bxx_unmute_core_init;
5622
5616
unsigned int pin_cfg;
5623
5617
int err = 0;
5624
5618
···
5711
5705
unmute_init++;
5712
5706
snd_hda_codec_set_pincfg(codec, 0x0f, 0x40f000f0);
5713
5707
snd_hda_codec_set_pincfg(codec, 0x19, 0x40f000f3);
5714
5714
-
stac92hd71bxx_dmic_nids[STAC92HD71BXX_NUM_DMICS - 1] = 0;
5708
5708
+
spec->dmic_nids = stac92hd71bxx_dmic_5port_nids;
5715
5709
spec->num_dmics = stac92xx_connected_ports(codec,
5716
5716
-
stac92hd71bxx_dmic_nids,
5710
5710
+
stac92hd71bxx_dmic_5port_nids,
5717
5711
STAC92HD71BXX_NUM_DMICS - 1);
5718
5712
break;
5719
5713
case 0x111d7603: /* 6 Port with Analog Mixer */
···
5734
5728
5735
5729
if (get_wcaps(codec, 0xa) & AC_WCAP_IN_AMP)
5736
5730
snd_hda_sequence_write_cache(codec, unmute_init);
5737
5737
-
5738
5738
-
/* Some HP machines seem to have unstable codec communications
5739
5739
-
* especially with ATI fglrx driver. For recovering from the
5740
5740
-
* CORB/RIRB stall, allow the BUS reset and keep always sync
5741
5741
-
*/
5742
5742
-
if (spec->board_config == STAC_HP_DV5) {
5743
5743
-
codec->bus->sync_write = 1;
5744
5744
-
codec->bus->allow_bus_reset = 1;
5745
5745
-
}
5746
5731
5747
5732
spec->aloopback_ctl = stac92hd71bxx_loopback;
5748
5733
spec->aloopback_mask = 0x50;
···
6220
6223
* STAC9872 hack
6221
6224
*/
6222
6225
6223
6223
-
static struct hda_verb stac9872_core_init[] = {
6226
6226
+
static const struct hda_verb stac9872_core_init[] = {
6224
6227
{0x15, AC_VERB_SET_CONNECT_SEL, 0x1}, /* mic-sel: 0a,0d,14,02 */
6225
6228
{0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Mic-in -> 0x9 */
6226
6229
{}
6227
6230
};
6228
6231
6229
6229
-
static hda_nid_t stac9872_pin_nids[] = {
6232
6232
+
static const hda_nid_t stac9872_pin_nids[] = {
6230
6233
0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
6231
6234
0x11, 0x13, 0x14,
6232
6235
};
6233
6236
6234
6234
-
static hda_nid_t stac9872_adc_nids[] = {
6237
6237
+
static const hda_nid_t stac9872_adc_nids[] = {
6235
6238
0x8 /*,0x6*/
6236
6239
};
6237
6240
6238
6238
-
static hda_nid_t stac9872_mux_nids[] = {
6241
6241
+
static const hda_nid_t stac9872_mux_nids[] = {
6239
6242
0x15
6240
6243
};
6241
6244
6242
6242
-
static unsigned long stac9872_capvols[] = {
6245
6245
+
static const unsigned long stac9872_capvols[] = {
6243
6246
HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
6244
6247
};
6245
6248
#define stac9872_capsws stac9872_capvols
6246
6249
6247
6247
-
static unsigned int stac9872_vaio_pin_configs[9] = {
6250
6250
+
static const unsigned int stac9872_vaio_pin_configs[9] = {
6248
6251
0x03211020, 0x411111f0, 0x411111f0, 0x03a15030,
6249
6252
0x411111f0, 0x90170110, 0x411111f0, 0x411111f0,
6250
6253
0x90a7013e
···
6255
6258
[STAC_9872_VAIO] = "vaio",
6256
6259
};
6257
6260
6258
6258
-
static unsigned int *stac9872_brd_tbl[STAC_9872_MODELS] = {
6261
6261
+
static const unsigned int *stac9872_brd_tbl[STAC_9872_MODELS] = {
6259
6262
[STAC_9872_VAIO] = stac9872_vaio_pin_configs,
6260
6263
};
6261
6264
6262
6262
-
static struct snd_pci_quirk stac9872_cfg_tbl[] = {
6265
6265
+
static const struct snd_pci_quirk stac9872_cfg_tbl[] = {
6263
6266
SND_PCI_QUIRK_MASK(0x104d, 0xfff0, 0x81e0,
6264
6267
"Sony VAIO F/S", STAC_9872_VAIO),
6265
6268
{} /* terminator */
···
6313
6316
/*
6314
6317
* patch entries
6315
6318
*/
6316
6316
-
static struct hda_codec_preset snd_hda_preset_sigmatel[] = {
6319
6319
+
static const struct hda_codec_preset snd_hda_preset_sigmatel[] = {
6317
6320
{ .id = 0x83847690, .name = "STAC9200", .patch = patch_stac9200 },
6318
6321
{ .id = 0x83847882, .name = "STAC9220 A1", .patch = patch_stac922x },
6319
6322
{ .id = 0x83847680, .name = "STAC9221 A1", .patch = patch_stac922x },
+865
-663
sound/pci/hda/patch_via.c
reviewed
···
98
98
VT1716S,
99
99
VT2002P,
100
100
VT1812,
101
101
+
VT1802,
101
102
CODEC_TYPES,
102
103
};
103
104
105
105
+
#define VT2002P_COMPATIBLE(spec) \
106
106
+
((spec)->codec_type == VT2002P ||\
107
107
+
(spec)->codec_type == VT1812 ||\
108
108
+
(spec)->codec_type == VT1802)
109
109
+
104
110
struct via_spec {
105
111
/* codec parameterization */
106
106
-
struct snd_kcontrol_new *mixers[6];
112
112
+
const struct snd_kcontrol_new *mixers[6];
107
113
unsigned int num_mixers;
108
114
109
109
-
struct hda_verb *init_verbs[5];
115
115
+
const struct hda_verb *init_verbs[5];
110
116
unsigned int num_iverbs;
111
117
112
118
char *stream_name_analog;
113
113
-
struct hda_pcm_stream *stream_analog_playback;
114
114
-
struct hda_pcm_stream *stream_analog_capture;
119
119
+
const struct hda_pcm_stream *stream_analog_playback;
120
120
+
const struct hda_pcm_stream *stream_analog_capture;
115
121
116
122
char *stream_name_digital;
117
117
-
struct hda_pcm_stream *stream_digital_playback;
118
118
-
struct hda_pcm_stream *stream_digital_capture;
123
123
+
const struct hda_pcm_stream *stream_digital_playback;
124
124
+
const struct hda_pcm_stream *stream_digital_capture;
119
125
120
126
/* playback */
121
127
struct hda_multi_out multiout;
···
129
123
130
124
/* capture */
131
125
unsigned int num_adc_nids;
132
132
-
hda_nid_t *adc_nids;
126
126
+
const hda_nid_t *adc_nids;
133
127
hda_nid_t mux_nids[3];
134
128
hda_nid_t dig_in_nid;
135
129
hda_nid_t dig_in_pin;
···
160
154
struct delayed_work vt1708_hp_work;
161
155
int vt1708_jack_detectect;
162
156
int vt1708_hp_present;
157
157
+
158
158
+
void (*set_widgets_power_state)(struct hda_codec *codec);
159
159
+
163
160
#ifdef CONFIG_SND_HDA_POWER_SAVE
164
161
struct hda_loopback_check loopback;
165
162
#endif
···
227
218
codec_type = VT1812;
228
219
else if (dev_id == 0x0440)
229
220
codec_type = VT1708S;
221
221
+
else if ((dev_id & 0xfff) == 0x446)
222
222
+
codec_type = VT1802;
230
223
else
231
224
codec_type = UNKNOWN;
232
225
return codec_type;
233
226
};
234
227
228
228
+
#define VIA_JACK_EVENT 0x20
235
229
#define VIA_HP_EVENT 0x01
236
230
#define VIA_GPIO_EVENT 0x02
237
237
-
#define VIA_JACK_EVENT 0x04
238
238
-
#define VIA_MONO_EVENT 0x08
239
239
-
#define VIA_SPEAKER_EVENT 0x10
240
240
-
#define VIA_BIND_HP_EVENT 0x20
231
231
+
#define VIA_MONO_EVENT 0x03
232
232
+
#define VIA_SPEAKER_EVENT 0x04
233
233
+
#define VIA_BIND_HP_EVENT 0x05
241
234
242
235
enum {
243
236
VIA_CTL_WIDGET_VOL,
···
256
245
};
257
246
258
247
static void analog_low_current_mode(struct hda_codec *codec, int stream_idle);
259
259
-
static void set_jack_power_state(struct hda_codec *codec);
260
248
static int is_aa_path_mute(struct hda_codec *codec);
261
249
262
250
static void vt1708_start_hp_work(struct via_spec *spec)
···
281
271
cancel_delayed_work_sync(&spec->vt1708_hp_work);
282
272
}
283
273
274
274
+
static void set_widgets_power_state(struct hda_codec *codec)
275
275
+
{
276
276
+
struct via_spec *spec = codec->spec;
277
277
+
if (spec->set_widgets_power_state)
278
278
+
spec->set_widgets_power_state(codec);
279
279
+
}
284
280
285
281
static int analog_input_switch_put(struct snd_kcontrol *kcontrol,
286
282
struct snd_ctl_elem_value *ucontrol)
···
294
278
int change = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
295
279
struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
296
280
297
297
-
set_jack_power_state(codec);
281
281
+
set_widgets_power_state(codec);
298
282
analog_low_current_mode(snd_kcontrol_chip(kcontrol), -1);
299
283
if (snd_hda_get_bool_hint(codec, "analog_loopback_hp_detect") == 1) {
300
284
if (is_aa_path_mute(codec))
···
410
394
.put = bind_pin_switch_put, \
411
395
.private_value = HDA_COMPOSE_AMP_VAL(0, 3, 0, 0) }
412
396
413
413
-
static struct snd_kcontrol_new via_control_templates[] = {
397
397
+
static const struct snd_kcontrol_new via_control_templates[] = {
414
398
HDA_CODEC_VOLUME(NULL, 0, 0, 0),
415
399
HDA_CODEC_MUTE(NULL, 0, 0, 0),
416
400
ANALOG_INPUT_MUTE,
417
401
BIND_PIN_MUTE,
418
402
};
419
403
420
420
-
static hda_nid_t vt1708_adc_nids[2] = {
404
404
+
static const hda_nid_t vt1708_adc_nids[2] = {
421
405
/* ADC1-2 */
422
406
0x15, 0x27
423
407
};
424
408
425
425
-
static hda_nid_t vt1709_adc_nids[3] = {
409
409
+
static const hda_nid_t vt1709_adc_nids[3] = {
426
410
/* ADC1-2 */
427
411
0x14, 0x15, 0x16
428
412
};
429
413
430
430
-
static hda_nid_t vt1708B_adc_nids[2] = {
414
414
+
static const hda_nid_t vt1708B_adc_nids[2] = {
431
415
/* ADC1-2 */
432
416
0x13, 0x14
433
417
};
434
418
435
435
-
static hda_nid_t vt1708S_adc_nids[2] = {
419
419
+
static const hda_nid_t vt1708S_adc_nids[2] = {
436
420
/* ADC1-2 */
437
421
0x13, 0x14
438
422
};
439
423
440
440
-
static hda_nid_t vt1702_adc_nids[3] = {
424
424
+
static const hda_nid_t vt1702_adc_nids[3] = {
441
425
/* ADC1-2 */
442
426
0x12, 0x20, 0x1F
443
427
};
444
428
445
445
-
static hda_nid_t vt1718S_adc_nids[2] = {
429
429
+
static const hda_nid_t vt1718S_adc_nids[2] = {
446
430
/* ADC1-2 */
447
431
0x10, 0x11
448
432
};
449
433
450
450
-
static hda_nid_t vt1716S_adc_nids[2] = {
434
434
+
static const hda_nid_t vt1716S_adc_nids[2] = {
451
435
/* ADC1-2 */
452
436
0x13, 0x14
453
437
};
454
438
455
455
-
static hda_nid_t vt2002P_adc_nids[2] = {
439
439
+
static const hda_nid_t vt2002P_adc_nids[2] = {
456
440
/* ADC1-2 */
457
441
0x10, 0x11
458
442
};
459
443
460
460
-
static hda_nid_t vt1812_adc_nids[2] = {
444
444
+
static const hda_nid_t vt1812_adc_nids[2] = {
461
445
/* ADC1-2 */
462
446
0x10, 0x11
463
447
};
···
487
471
__via_add_control(spec, type, name, 0, val)
488
472
489
473
static struct snd_kcontrol_new *via_clone_control(struct via_spec *spec,
490
490
-
struct snd_kcontrol_new *tmpl)
474
474
+
const struct snd_kcontrol_new *tmpl)
491
475
{
492
476
struct snd_kcontrol_new *knew;
493
477
···
618
602
snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_POWER_STATE, parm);
619
603
}
620
604
621
621
-
static void set_jack_power_state(struct hda_codec *codec)
622
622
-
{
623
623
-
struct via_spec *spec = codec->spec;
624
624
-
int imux_is_smixer;
625
625
-
unsigned int parm;
626
626
-
627
627
-
if (spec->codec_type == VT1702) {
628
628
-
imux_is_smixer = snd_hda_codec_read(
629
629
-
codec, 0x13, 0, AC_VERB_GET_CONNECT_SEL, 0x00) == 3;
630
630
-
/* inputs */
631
631
-
/* PW 1/2/5 (14h/15h/18h) */
632
632
-
parm = AC_PWRST_D3;
633
633
-
set_pin_power_state(codec, 0x14, &parm);
634
634
-
set_pin_power_state(codec, 0x15, &parm);
635
635
-
set_pin_power_state(codec, 0x18, &parm);
636
636
-
if (imux_is_smixer)
637
637
-
parm = AC_PWRST_D0; /* SW0 = stereo mixer (idx 3) */
638
638
-
/* SW0 (13h), AIW 0/1/2 (12h/1fh/20h) */
639
639
-
snd_hda_codec_write(codec, 0x13, 0, AC_VERB_SET_POWER_STATE,
640
640
-
parm);
641
641
-
snd_hda_codec_write(codec, 0x12, 0, AC_VERB_SET_POWER_STATE,
642
642
-
parm);
643
643
-
snd_hda_codec_write(codec, 0x1f, 0, AC_VERB_SET_POWER_STATE,
644
644
-
parm);
645
645
-
snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_POWER_STATE,
646
646
-
parm);
647
647
-
648
648
-
/* outputs */
649
649
-
/* PW 3/4 (16h/17h) */
650
650
-
parm = AC_PWRST_D3;
651
651
-
set_pin_power_state(codec, 0x16, &parm);
652
652
-
set_pin_power_state(codec, 0x17, &parm);
653
653
-
/* MW0 (1ah), AOW 0/1 (10h/1dh) */
654
654
-
snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_POWER_STATE,
655
655
-
imux_is_smixer ? AC_PWRST_D0 : parm);
656
656
-
snd_hda_codec_write(codec, 0x10, 0, AC_VERB_SET_POWER_STATE,
657
657
-
parm);
658
658
-
snd_hda_codec_write(codec, 0x1d, 0, AC_VERB_SET_POWER_STATE,
659
659
-
parm);
660
660
-
} else if (spec->codec_type == VT1708B_8CH
661
661
-
|| spec->codec_type == VT1708B_4CH
662
662
-
|| spec->codec_type == VT1708S) {
663
663
-
/* SW0 (17h) = stereo mixer */
664
664
-
int is_8ch = spec->codec_type != VT1708B_4CH;
665
665
-
imux_is_smixer = snd_hda_codec_read(
666
666
-
codec, 0x17, 0, AC_VERB_GET_CONNECT_SEL, 0x00)
667
667
-
== ((spec->codec_type == VT1708S) ? 5 : 0);
668
668
-
/* inputs */
669
669
-
/* PW 1/2/5 (1ah/1bh/1eh) */
670
670
-
parm = AC_PWRST_D3;
671
671
-
set_pin_power_state(codec, 0x1a, &parm);
672
672
-
set_pin_power_state(codec, 0x1b, &parm);
673
673
-
set_pin_power_state(codec, 0x1e, &parm);
674
674
-
if (imux_is_smixer)
675
675
-
parm = AC_PWRST_D0;
676
676
-
/* SW0 (17h), AIW 0/1 (13h/14h) */
677
677
-
snd_hda_codec_write(codec, 0x17, 0, AC_VERB_SET_POWER_STATE,
678
678
-
parm);
679
679
-
snd_hda_codec_write(codec, 0x13, 0, AC_VERB_SET_POWER_STATE,
680
680
-
parm);
681
681
-
snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_POWER_STATE,
682
682
-
parm);
683
683
-
684
684
-
/* outputs */
685
685
-
/* PW0 (19h), SW1 (18h), AOW1 (11h) */
686
686
-
parm = AC_PWRST_D3;
687
687
-
set_pin_power_state(codec, 0x19, &parm);
688
688
-
if (spec->smart51_enabled)
689
689
-
parm = AC_PWRST_D0;
690
690
-
snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_POWER_STATE,
691
691
-
parm);
692
692
-
snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_POWER_STATE,
693
693
-
parm);
694
694
-
695
695
-
/* PW6 (22h), SW2 (26h), AOW2 (24h) */
696
696
-
if (is_8ch) {
697
697
-
parm = AC_PWRST_D3;
698
698
-
set_pin_power_state(codec, 0x22, &parm);
699
699
-
if (spec->smart51_enabled)
700
700
-
parm = AC_PWRST_D0;
701
701
-
snd_hda_codec_write(codec, 0x26, 0,
702
702
-
AC_VERB_SET_POWER_STATE, parm);
703
703
-
snd_hda_codec_write(codec, 0x24, 0,
704
704
-
AC_VERB_SET_POWER_STATE, parm);
705
705
-
}
706
706
-
707
707
-
/* PW 3/4/7 (1ch/1dh/23h) */
708
708
-
parm = AC_PWRST_D3;
709
709
-
/* force to D0 for internal Speaker */
710
710
-
set_pin_power_state(codec, 0x1c, &parm);
711
711
-
set_pin_power_state(codec, 0x1d, &parm);
712
712
-
if (is_8ch)
713
713
-
set_pin_power_state(codec, 0x23, &parm);
714
714
-
/* MW0 (16h), Sw3 (27h), AOW 0/3 (10h/25h) */
715
715
-
snd_hda_codec_write(codec, 0x16, 0, AC_VERB_SET_POWER_STATE,
716
716
-
imux_is_smixer ? AC_PWRST_D0 : parm);
717
717
-
snd_hda_codec_write(codec, 0x10, 0, AC_VERB_SET_POWER_STATE,
718
718
-
parm);
719
719
-
if (is_8ch) {
720
720
-
snd_hda_codec_write(codec, 0x25, 0,
721
721
-
AC_VERB_SET_POWER_STATE, parm);
722
722
-
snd_hda_codec_write(codec, 0x27, 0,
723
723
-
AC_VERB_SET_POWER_STATE, parm);
724
724
-
}
725
725
-
} else if (spec->codec_type == VT1718S) {
726
726
-
/* MUX6 (1eh) = stereo mixer */
727
727
-
imux_is_smixer = snd_hda_codec_read(
728
728
-
codec, 0x1e, 0, AC_VERB_GET_CONNECT_SEL, 0x00) == 5;
729
729
-
/* inputs */
730
730
-
/* PW 5/6/7 (29h/2ah/2bh) */
731
731
-
parm = AC_PWRST_D3;
732
732
-
set_pin_power_state(codec, 0x29, &parm);
733
733
-
set_pin_power_state(codec, 0x2a, &parm);
734
734
-
set_pin_power_state(codec, 0x2b, &parm);
735
735
-
if (imux_is_smixer)
736
736
-
parm = AC_PWRST_D0;
737
737
-
/* MUX6/7 (1eh/1fh), AIW 0/1 (10h/11h) */
738
738
-
snd_hda_codec_write(codec, 0x1e, 0, AC_VERB_SET_POWER_STATE,
739
739
-
parm);
740
740
-
snd_hda_codec_write(codec, 0x1f, 0, AC_VERB_SET_POWER_STATE,
741
741
-
parm);
742
742
-
snd_hda_codec_write(codec, 0x10, 0, AC_VERB_SET_POWER_STATE,
743
743
-
parm);
744
744
-
snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_POWER_STATE,
745
745
-
parm);
746
746
-
747
747
-
/* outputs */
748
748
-
/* PW3 (27h), MW2 (1ah), AOW3 (bh) */
749
749
-
parm = AC_PWRST_D3;
750
750
-
set_pin_power_state(codec, 0x27, &parm);
751
751
-
snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_POWER_STATE,
752
752
-
parm);
753
753
-
snd_hda_codec_write(codec, 0xb, 0, AC_VERB_SET_POWER_STATE,
754
754
-
parm);
755
755
-
756
756
-
/* PW2 (26h), AOW2 (ah) */
757
757
-
parm = AC_PWRST_D3;
758
758
-
set_pin_power_state(codec, 0x26, &parm);
759
759
-
snd_hda_codec_write(codec, 0xa, 0, AC_VERB_SET_POWER_STATE,
760
760
-
parm);
761
761
-
762
762
-
/* PW0/1 (24h/25h) */
763
763
-
parm = AC_PWRST_D3;
764
764
-
set_pin_power_state(codec, 0x24, &parm);
765
765
-
set_pin_power_state(codec, 0x25, &parm);
766
766
-
if (!spec->hp_independent_mode) /* check for redirected HP */
767
767
-
set_pin_power_state(codec, 0x28, &parm);
768
768
-
snd_hda_codec_write(codec, 0x8, 0, AC_VERB_SET_POWER_STATE,
769
769
-
parm);
770
770
-
snd_hda_codec_write(codec, 0x9, 0, AC_VERB_SET_POWER_STATE,
771
771
-
parm);
772
772
-
/* MW9 (21h), Mw2 (1ah), AOW0 (8h) */
773
773
-
snd_hda_codec_write(codec, 0x21, 0, AC_VERB_SET_POWER_STATE,
774
774
-
imux_is_smixer ? AC_PWRST_D0 : parm);
775
775
-
if (spec->hp_independent_mode) {
776
776
-
/* PW4 (28h), MW3 (1bh), MUX1(34h), AOW4 (ch) */
777
777
-
parm = AC_PWRST_D3;
778
778
-
set_pin_power_state(codec, 0x28, &parm);
779
779
-
snd_hda_codec_write(codec, 0x1b, 0,
780
780
-
AC_VERB_SET_POWER_STATE, parm);
781
781
-
snd_hda_codec_write(codec, 0x34, 0,
782
782
-
AC_VERB_SET_POWER_STATE, parm);
783
783
-
snd_hda_codec_write(codec, 0xc, 0,
784
784
-
AC_VERB_SET_POWER_STATE, parm);
785
785
-
}
786
786
-
} else if (spec->codec_type == VT1716S) {
787
787
-
unsigned int mono_out, present;
788
788
-
/* SW0 (17h) = stereo mixer */
789
789
-
imux_is_smixer = snd_hda_codec_read(
790
790
-
codec, 0x17, 0, AC_VERB_GET_CONNECT_SEL, 0x00) == 5;
791
791
-
/* inputs */
792
792
-
/* PW 1/2/5 (1ah/1bh/1eh) */
793
793
-
parm = AC_PWRST_D3;
794
794
-
set_pin_power_state(codec, 0x1a, &parm);
795
795
-
set_pin_power_state(codec, 0x1b, &parm);
796
796
-
set_pin_power_state(codec, 0x1e, &parm);
797
797
-
if (imux_is_smixer)
798
798
-
parm = AC_PWRST_D0;
799
799
-
/* SW0 (17h), AIW0(13h) */
800
800
-
snd_hda_codec_write(codec, 0x17, 0, AC_VERB_SET_POWER_STATE,
801
801
-
parm);
802
802
-
snd_hda_codec_write(codec, 0x13, 0, AC_VERB_SET_POWER_STATE,
803
803
-
parm);
804
804
-
805
805
-
parm = AC_PWRST_D3;
806
806
-
set_pin_power_state(codec, 0x1e, &parm);
807
807
-
/* PW11 (22h) */
808
808
-
if (spec->dmic_enabled)
809
809
-
set_pin_power_state(codec, 0x22, &parm);
810
810
-
else
811
811
-
snd_hda_codec_write(
812
812
-
codec, 0x22, 0,
813
813
-
AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
814
814
-
815
815
-
/* SW2(26h), AIW1(14h) */
816
816
-
snd_hda_codec_write(codec, 0x26, 0, AC_VERB_SET_POWER_STATE,
817
817
-
parm);
818
818
-
snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_POWER_STATE,
819
819
-
parm);
820
820
-
821
821
-
/* outputs */
822
822
-
/* PW0 (19h), SW1 (18h), AOW1 (11h) */
823
823
-
parm = AC_PWRST_D3;
824
824
-
set_pin_power_state(codec, 0x19, &parm);
825
825
-
/* Smart 5.1 PW2(1bh) */
826
826
-
if (spec->smart51_enabled)
827
827
-
set_pin_power_state(codec, 0x1b, &parm);
828
828
-
snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_POWER_STATE,
829
829
-
parm);
830
830
-
snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_POWER_STATE,
831
831
-
parm);
832
832
-
833
833
-
/* PW7 (23h), SW3 (27h), AOW3 (25h) */
834
834
-
parm = AC_PWRST_D3;
835
835
-
set_pin_power_state(codec, 0x23, &parm);
836
836
-
/* Smart 5.1 PW1(1ah) */
837
837
-
if (spec->smart51_enabled)
838
838
-
set_pin_power_state(codec, 0x1a, &parm);
839
839
-
snd_hda_codec_write(codec, 0x27, 0, AC_VERB_SET_POWER_STATE,
840
840
-
parm);
841
841
-
842
842
-
/* Smart 5.1 PW5(1eh) */
843
843
-
if (spec->smart51_enabled)
844
844
-
set_pin_power_state(codec, 0x1e, &parm);
845
845
-
snd_hda_codec_write(codec, 0x25, 0, AC_VERB_SET_POWER_STATE,
846
846
-
parm);
847
847
-
848
848
-
/* Mono out */
849
849
-
/* SW4(28h)->MW1(29h)-> PW12 (2ah)*/
850
850
-
present = snd_hda_jack_detect(codec, 0x1c);
851
851
-
if (present)
852
852
-
mono_out = 0;
853
853
-
else {
854
854
-
present = snd_hda_jack_detect(codec, 0x1d);
855
855
-
if (!spec->hp_independent_mode && present)
856
856
-
mono_out = 0;
857
857
-
else
858
858
-
mono_out = 1;
859
859
-
}
860
860
-
parm = mono_out ? AC_PWRST_D0 : AC_PWRST_D3;
861
861
-
snd_hda_codec_write(codec, 0x28, 0, AC_VERB_SET_POWER_STATE,
862
862
-
parm);
863
863
-
snd_hda_codec_write(codec, 0x29, 0, AC_VERB_SET_POWER_STATE,
864
864
-
parm);
865
865
-
snd_hda_codec_write(codec, 0x2a, 0, AC_VERB_SET_POWER_STATE,
866
866
-
parm);
867
867
-
868
868
-
/* PW 3/4 (1ch/1dh) */
869
869
-
parm = AC_PWRST_D3;
870
870
-
set_pin_power_state(codec, 0x1c, &parm);
871
871
-
set_pin_power_state(codec, 0x1d, &parm);
872
872
-
/* HP Independent Mode, power on AOW3 */
873
873
-
if (spec->hp_independent_mode)
874
874
-
snd_hda_codec_write(codec, 0x25, 0,
875
875
-
AC_VERB_SET_POWER_STATE, parm);
876
876
-
877
877
-
/* force to D0 for internal Speaker */
878
878
-
/* MW0 (16h), AOW0 (10h) */
879
879
-
snd_hda_codec_write(codec, 0x16, 0, AC_VERB_SET_POWER_STATE,
880
880
-
imux_is_smixer ? AC_PWRST_D0 : parm);
881
881
-
snd_hda_codec_write(codec, 0x10, 0, AC_VERB_SET_POWER_STATE,
882
882
-
mono_out ? AC_PWRST_D0 : parm);
883
883
-
} else if (spec->codec_type == VT2002P) {
884
884
-
unsigned int present;
885
885
-
/* MUX9 (1eh) = stereo mixer */
886
886
-
imux_is_smixer = snd_hda_codec_read(
887
887
-
codec, 0x1e, 0, AC_VERB_GET_CONNECT_SEL, 0x00) == 3;
888
888
-
/* inputs */
889
889
-
/* PW 5/6/7 (29h/2ah/2bh) */
890
890
-
parm = AC_PWRST_D3;
891
891
-
set_pin_power_state(codec, 0x29, &parm);
892
892
-
set_pin_power_state(codec, 0x2a, &parm);
893
893
-
set_pin_power_state(codec, 0x2b, &parm);
894
894
-
if (imux_is_smixer)
895
895
-
parm = AC_PWRST_D0;
896
896
-
/* MUX9/10 (1eh/1fh), AIW 0/1 (10h/11h) */
897
897
-
snd_hda_codec_write(codec, 0x1e, 0,
898
898
-
AC_VERB_SET_POWER_STATE, parm);
899
899
-
snd_hda_codec_write(codec, 0x1f, 0,
900
900
-
AC_VERB_SET_POWER_STATE, parm);
901
901
-
snd_hda_codec_write(codec, 0x10, 0,
902
902
-
AC_VERB_SET_POWER_STATE, parm);
903
903
-
snd_hda_codec_write(codec, 0x11, 0,
904
904
-
AC_VERB_SET_POWER_STATE, parm);
905
905
-
906
906
-
/* outputs */
907
907
-
/* AOW0 (8h)*/
908
908
-
snd_hda_codec_write(codec, 0x8, 0,
909
909
-
AC_VERB_SET_POWER_STATE, AC_PWRST_D0);
910
910
-
911
911
-
/* PW4 (26h), MW4 (1ch), MUX4(37h) */
912
912
-
parm = AC_PWRST_D3;
913
913
-
set_pin_power_state(codec, 0x26, &parm);
914
914
-
snd_hda_codec_write(codec, 0x1c, 0,
915
915
-
AC_VERB_SET_POWER_STATE, parm);
916
916
-
snd_hda_codec_write(codec, 0x37,
917
917
-
0, AC_VERB_SET_POWER_STATE, parm);
918
918
-
919
919
-
/* PW1 (25h), MW1 (19h), MUX1(35h), AOW1 (9h) */
920
920
-
parm = AC_PWRST_D3;
921
921
-
set_pin_power_state(codec, 0x25, &parm);
922
922
-
snd_hda_codec_write(codec, 0x19, 0,
923
923
-
AC_VERB_SET_POWER_STATE, parm);
924
924
-
snd_hda_codec_write(codec, 0x35, 0,
925
925
-
AC_VERB_SET_POWER_STATE, parm);
926
926
-
if (spec->hp_independent_mode) {
927
927
-
snd_hda_codec_write(codec, 0x9, 0,
928
928
-
AC_VERB_SET_POWER_STATE, parm);
929
929
-
}
930
930
-
931
931
-
/* Class-D */
932
932
-
/* PW0 (24h), MW0(18h), MUX0(34h) */
933
933
-
present = snd_hda_jack_detect(codec, 0x25);
934
934
-
parm = AC_PWRST_D3;
935
935
-
set_pin_power_state(codec, 0x24, &parm);
936
936
-
if (present) {
937
937
-
snd_hda_codec_write(
938
938
-
codec, 0x18, 0,
939
939
-
AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
940
940
-
snd_hda_codec_write(
941
941
-
codec, 0x34, 0,
942
942
-
AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
943
943
-
} else {
944
944
-
snd_hda_codec_write(
945
945
-
codec, 0x18, 0,
946
946
-
AC_VERB_SET_POWER_STATE, AC_PWRST_D0);
947
947
-
snd_hda_codec_write(
948
948
-
codec, 0x34, 0,
949
949
-
AC_VERB_SET_POWER_STATE, AC_PWRST_D0);
950
950
-
}
951
951
-
952
952
-
/* Mono Out */
953
953
-
/* PW15 (31h), MW8(17h), MUX8(3bh) */
954
954
-
present = snd_hda_jack_detect(codec, 0x26);
955
955
-
parm = AC_PWRST_D3;
956
956
-
set_pin_power_state(codec, 0x31, &parm);
957
957
-
if (present) {
958
958
-
snd_hda_codec_write(
959
959
-
codec, 0x17, 0,
960
960
-
AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
961
961
-
snd_hda_codec_write(
962
962
-
codec, 0x3b, 0,
963
963
-
AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
964
964
-
} else {
965
965
-
snd_hda_codec_write(
966
966
-
codec, 0x17, 0,
967
967
-
AC_VERB_SET_POWER_STATE, AC_PWRST_D0);
968
968
-
snd_hda_codec_write(
969
969
-
codec, 0x3b, 0,
970
970
-
AC_VERB_SET_POWER_STATE, AC_PWRST_D0);
971
971
-
}
972
972
-
973
973
-
/* MW9 (21h) */
974
974
-
if (imux_is_smixer || !is_aa_path_mute(codec))
975
975
-
snd_hda_codec_write(
976
976
-
codec, 0x21, 0,
977
977
-
AC_VERB_SET_POWER_STATE, AC_PWRST_D0);
978
978
-
else
979
979
-
snd_hda_codec_write(
980
980
-
codec, 0x21, 0,
981
981
-
AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
982
982
-
} else if (spec->codec_type == VT1812) {
983
983
-
unsigned int present;
984
984
-
/* MUX10 (1eh) = stereo mixer */
985
985
-
imux_is_smixer = snd_hda_codec_read(
986
986
-
codec, 0x1e, 0, AC_VERB_GET_CONNECT_SEL, 0x00) == 5;
987
987
-
/* inputs */
988
988
-
/* PW 5/6/7 (29h/2ah/2bh) */
989
989
-
parm = AC_PWRST_D3;
990
990
-
set_pin_power_state(codec, 0x29, &parm);
991
991
-
set_pin_power_state(codec, 0x2a, &parm);
992
992
-
set_pin_power_state(codec, 0x2b, &parm);
993
993
-
if (imux_is_smixer)
994
994
-
parm = AC_PWRST_D0;
995
995
-
/* MUX10/11 (1eh/1fh), AIW 0/1 (10h/11h) */
996
996
-
snd_hda_codec_write(codec, 0x1e, 0,
997
997
-
AC_VERB_SET_POWER_STATE, parm);
998
998
-
snd_hda_codec_write(codec, 0x1f, 0,
999
999
-
AC_VERB_SET_POWER_STATE, parm);
1000
1000
-
snd_hda_codec_write(codec, 0x10, 0,
1001
1001
-
AC_VERB_SET_POWER_STATE, parm);
1002
1002
-
snd_hda_codec_write(codec, 0x11, 0,
1003
1003
-
AC_VERB_SET_POWER_STATE, parm);
1004
1004
-
1005
1005
-
/* outputs */
1006
1006
-
/* AOW0 (8h)*/
1007
1007
-
snd_hda_codec_write(codec, 0x8, 0,
1008
1008
-
AC_VERB_SET_POWER_STATE, AC_PWRST_D0);
1009
1009
-
1010
1010
-
/* PW4 (28h), MW4 (18h), MUX4(38h) */
1011
1011
-
parm = AC_PWRST_D3;
1012
1012
-
set_pin_power_state(codec, 0x28, &parm);
1013
1013
-
snd_hda_codec_write(codec, 0x18, 0,
1014
1014
-
AC_VERB_SET_POWER_STATE, parm);
1015
1015
-
snd_hda_codec_write(codec, 0x38, 0,
1016
1016
-
AC_VERB_SET_POWER_STATE, parm);
1017
1017
-
1018
1018
-
/* PW1 (25h), MW1 (15h), MUX1(35h), AOW1 (9h) */
1019
1019
-
parm = AC_PWRST_D3;
1020
1020
-
set_pin_power_state(codec, 0x25, &parm);
1021
1021
-
snd_hda_codec_write(codec, 0x15, 0,
1022
1022
-
AC_VERB_SET_POWER_STATE, parm);
1023
1023
-
snd_hda_codec_write(codec, 0x35, 0,
1024
1024
-
AC_VERB_SET_POWER_STATE, parm);
1025
1025
-
if (spec->hp_independent_mode) {
1026
1026
-
snd_hda_codec_write(codec, 0x9, 0,
1027
1027
-
AC_VERB_SET_POWER_STATE, parm);
1028
1028
-
}
1029
1029
-
1030
1030
-
/* Internal Speaker */
1031
1031
-
/* PW0 (24h), MW0(14h), MUX0(34h) */
1032
1032
-
present = snd_hda_jack_detect(codec, 0x25);
1033
1033
-
parm = AC_PWRST_D3;
1034
1034
-
set_pin_power_state(codec, 0x24, &parm);
1035
1035
-
if (present) {
1036
1036
-
snd_hda_codec_write(codec, 0x14, 0,
1037
1037
-
AC_VERB_SET_POWER_STATE,
1038
1038
-
AC_PWRST_D3);
1039
1039
-
snd_hda_codec_write(codec, 0x34, 0,
1040
1040
-
AC_VERB_SET_POWER_STATE,
1041
1041
-
AC_PWRST_D3);
1042
1042
-
} else {
1043
1043
-
snd_hda_codec_write(codec, 0x14, 0,
1044
1044
-
AC_VERB_SET_POWER_STATE,
1045
1045
-
AC_PWRST_D0);
1046
1046
-
snd_hda_codec_write(codec, 0x34, 0,
1047
1047
-
AC_VERB_SET_POWER_STATE,
1048
1048
-
AC_PWRST_D0);
1049
1049
-
}
1050
1050
-
/* Mono Out */
1051
1051
-
/* PW13 (31h), MW13(1ch), MUX13(3ch), MW14(3eh) */
1052
1052
-
present = snd_hda_jack_detect(codec, 0x28);
1053
1053
-
parm = AC_PWRST_D3;
1054
1054
-
set_pin_power_state(codec, 0x31, &parm);
1055
1055
-
if (present) {
1056
1056
-
snd_hda_codec_write(codec, 0x1c, 0,
1057
1057
-
AC_VERB_SET_POWER_STATE,
1058
1058
-
AC_PWRST_D3);
1059
1059
-
snd_hda_codec_write(codec, 0x3c, 0,
1060
1060
-
AC_VERB_SET_POWER_STATE,
1061
1061
-
AC_PWRST_D3);
1062
1062
-
snd_hda_codec_write(codec, 0x3e, 0,
1063
1063
-
AC_VERB_SET_POWER_STATE,
1064
1064
-
AC_PWRST_D3);
1065
1065
-
} else {
1066
1066
-
snd_hda_codec_write(codec, 0x1c, 0,
1067
1067
-
AC_VERB_SET_POWER_STATE,
1068
1068
-
AC_PWRST_D0);
1069
1069
-
snd_hda_codec_write(codec, 0x3c, 0,
1070
1070
-
AC_VERB_SET_POWER_STATE,
1071
1071
-
AC_PWRST_D0);
1072
1072
-
snd_hda_codec_write(codec, 0x3e, 0,
1073
1073
-
AC_VERB_SET_POWER_STATE,
1074
1074
-
AC_PWRST_D0);
1075
1075
-
}
1076
1076
-
1077
1077
-
/* PW15 (33h), MW15 (1dh), MUX15(3dh) */
1078
1078
-
parm = AC_PWRST_D3;
1079
1079
-
set_pin_power_state(codec, 0x33, &parm);
1080
1080
-
snd_hda_codec_write(codec, 0x1d, 0,
1081
1081
-
AC_VERB_SET_POWER_STATE, parm);
1082
1082
-
snd_hda_codec_write(codec, 0x3d, 0,
1083
1083
-
AC_VERB_SET_POWER_STATE, parm);
1084
1084
-
1085
1085
-
/* MW9 (21h) */
1086
1086
-
if (imux_is_smixer || !is_aa_path_mute(codec))
1087
1087
-
snd_hda_codec_write(
1088
1088
-
codec, 0x21, 0,
1089
1089
-
AC_VERB_SET_POWER_STATE, AC_PWRST_D0);
1090
1090
-
else
1091
1091
-
snd_hda_codec_write(
1092
1092
-
codec, 0x21, 0,
1093
1093
-
AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
1094
1094
-
}
1095
1095
-
}
1096
1096
-
1097
605
/*
1098
606
* input MUX handling
1099
607
*/
···
660
1120
spec->mux_nids[adc_idx],
661
1121
&spec->cur_mux[adc_idx]);
662
1122
/* update jack power state */
663
663
-
set_jack_power_state(codec);
1123
1123
+
set_widgets_power_state(codec);
664
1124
665
1125
return ret;
666
1126
}
···
708
1168
case VT1709_10CH: return 0x29;
709
1169
case VT1708B_8CH: /* fall thru */
710
1170
case VT1708S: return 0x27;
1171
1171
+
case VT2002P: return 0x19;
1172
1172
+
case VT1802: return 0x15;
1173
1173
+
case VT1812: return 0x15;
711
1174
default: return 0;
712
1175
}
713
1176
}
···
719
1176
{
720
1177
/* mute side channel */
721
1178
struct via_spec *spec = codec->spec;
722
722
-
unsigned int parm = spec->hp_independent_mode
723
723
-
? AMP_OUT_MUTE : AMP_OUT_UNMUTE;
1179
1179
+
unsigned int parm;
724
1180
hda_nid_t sw3 = side_mute_channel(spec);
725
1181
726
726
-
if (sw3)
727
727
-
snd_hda_codec_write(codec, sw3, 0, AC_VERB_SET_AMP_GAIN_MUTE,
728
728
-
parm);
1182
1182
+
if (sw3) {
1183
1183
+
if (VT2002P_COMPATIBLE(spec))
1184
1184
+
parm = spec->hp_independent_mode ?
1185
1185
+
AMP_IN_MUTE(1) : AMP_IN_UNMUTE(1);
1186
1186
+
else
1187
1187
+
parm = spec->hp_independent_mode ?
1188
1188
+
AMP_OUT_MUTE : AMP_OUT_UNMUTE;
1189
1189
+
snd_hda_codec_write(codec, sw3, 0,
1190
1190
+
AC_VERB_SET_AMP_GAIN_MUTE, parm);
1191
1191
+
if (spec->codec_type == VT1812)
1192
1192
+
snd_hda_codec_write(codec, 0x1d, 0,
1193
1193
+
AC_VERB_SET_AMP_GAIN_MUTE, parm);
1194
1194
+
}
729
1195
return 0;
730
1196
}
731
1197
···
769
1217
|| spec->codec_type == VT1702
770
1218
|| spec->codec_type == VT1718S
771
1219
|| spec->codec_type == VT1716S
772
772
-
|| spec->codec_type == VT2002P
773
773
-
|| spec->codec_type == VT1812) {
1220
1220
+
|| VT2002P_COMPATIBLE(spec)) {
774
1221
activate_ctl(codec, "Headphone Playback Volume",
775
1222
spec->hp_independent_mode);
776
1223
activate_ctl(codec, "Headphone Playback Switch",
777
1224
spec->hp_independent_mode);
778
1225
}
779
1226
/* update jack power state */
780
780
-
set_jack_power_state(codec);
1227
1227
+
set_widgets_power_state(codec);
781
1228
return 0;
782
1229
}
783
1230
784
784
-
static struct snd_kcontrol_new via_hp_mixer[2] = {
1231
1231
+
static const struct snd_kcontrol_new via_hp_mixer[2] = {
785
1232
{
786
1233
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
787
1234
.name = "Independent HP",
···
807
1256
nid = 0x34;
808
1257
break;
809
1258
case VT2002P:
1259
1259
+
case VT1802:
810
1260
nid = 0x35;
811
1261
break;
812
1262
case VT1812:
···
999
1447
}
1000
1448
}
1001
1449
spec->smart51_enabled = *ucontrol->value.integer.value;
1002
1002
-
set_jack_power_state(codec);
1450
1450
+
set_widgets_power_state(codec);
1003
1451
return 1;
1004
1452
}
1005
1453
1006
1006
-
static struct snd_kcontrol_new via_smart51_mixer[2] = {
1454
1454
+
static const struct snd_kcontrol_new via_smart51_mixer[2] = {
1007
1455
{
1008
1456
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1009
1457
.name = "Smart 5.1",
···
1025
1473
hda_nid_t nid;
1026
1474
int i;
1027
1475
1476
1476
+
if (!cfg)
1477
1477
+
return 0;
1478
1478
+
if (cfg->line_outs > 2)
1479
1479
+
return 0;
1480
1480
+
1028
1481
knew = via_clone_control(spec, &via_smart51_mixer[0]);
1029
1482
if (knew == NULL)
1030
1483
return -ENOMEM;
···
1049
1492
}
1050
1493
1051
1494
/* capture mixer elements */
1052
1052
-
static struct snd_kcontrol_new vt1708_capture_mixer[] = {
1495
1495
+
static const struct snd_kcontrol_new vt1708_capture_mixer[] = {
1053
1496
HDA_CODEC_VOLUME("Capture Volume", 0x15, 0x0, HDA_INPUT),
1054
1497
HDA_CODEC_MUTE("Capture Switch", 0x15, 0x0, HDA_INPUT),
1055
1498
HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x27, 0x0, HDA_INPUT),
···
1100
1543
break;
1101
1544
case VT2002P:
1102
1545
case VT1812:
1546
1546
+
case VT1802:
1103
1547
nid_mixer = 0x21;
1104
1548
start_idx = 0;
1105
1549
end_idx = 2;
···
1165
1607
break;
1166
1608
case VT2002P:
1167
1609
case VT1812:
1610
1610
+
case VT1802:
1168
1611
verb = 0xf93;
1169
1612
parm = enable ? 0x00 : 0xe0; /* 0x00: 4/40x, 0xe0: 1x */
1170
1613
break;
···
1179
1620
/*
1180
1621
* generic initialization of ADC, input mixers and output mixers
1181
1622
*/
1182
1182
-
static struct hda_verb vt1708_volume_init_verbs[] = {
1623
1623
+
static const struct hda_verb vt1708_volume_init_verbs[] = {
1183
1624
/*
1184
1625
* Unmute ADC0-1 and set the default input to mic-in
1185
1626
*/
···
1209
1650
{0x20, AC_VERB_SET_CONNECT_SEL, 0},
1210
1651
/* PW9 Output enable */
1211
1652
{0x25, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
1653
1653
+
/* power down jack detect function */
1654
1654
+
{0x1, 0xf81, 0x1},
1212
1655
{ }
1213
1656
};
1214
1657
···
1233
1672
{
1234
1673
struct via_spec *spec = codec->spec;
1235
1674
struct hda_multi_out *mout = &spec->multiout;
1236
1236
-
hda_nid_t *nids = mout->dac_nids;
1675
1675
+
const hda_nid_t *nids = mout->dac_nids;
1237
1676
int chs = substream->runtime->channels;
1238
1677
int i;
1239
1678
···
1302
1741
{
1303
1742
struct via_spec *spec = codec->spec;
1304
1743
struct hda_multi_out *mout = &spec->multiout;
1305
1305
-
hda_nid_t *nids = mout->dac_nids;
1744
1744
+
const hda_nid_t *nids = mout->dac_nids;
1306
1745
1307
1746
if (substream->number == 0)
1308
1747
playback_multi_pcm_prep_0(codec, stream_tag, format,
···
1323
1762
{
1324
1763
struct via_spec *spec = codec->spec;
1325
1764
struct hda_multi_out *mout = &spec->multiout;
1326
1326
-
hda_nid_t *nids = mout->dac_nids;
1765
1765
+
const hda_nid_t *nids = mout->dac_nids;
1327
1766
int i;
1328
1767
1329
1768
if (substream->number == 0) {
···
1421
1860
return 0;
1422
1861
}
1423
1862
1424
1424
-
static struct hda_pcm_stream vt1708_pcm_analog_playback = {
1863
1863
+
static const struct hda_pcm_stream vt1708_pcm_analog_playback = {
1425
1864
.substreams = 2,
1426
1865
.channels_min = 2,
1427
1866
.channels_max = 8,
···
1433
1872
},
1434
1873
};
1435
1874
1436
1436
-
static struct hda_pcm_stream vt1708_pcm_analog_s16_playback = {
1875
1875
+
static const struct hda_pcm_stream vt1708_pcm_analog_s16_playback = {
1437
1876
.substreams = 2,
1438
1877
.channels_min = 2,
1439
1878
.channels_max = 8,
···
1450
1889
},
1451
1890
};
1452
1891
1453
1453
-
static struct hda_pcm_stream vt1708_pcm_analog_capture = {
1892
1892
+
static const struct hda_pcm_stream vt1708_pcm_analog_capture = {
1454
1893
.substreams = 2,
1455
1894
.channels_min = 2,
1456
1895
.channels_max = 2,
···
1461
1900
},
1462
1901
};
1463
1902
1464
1464
-
static struct hda_pcm_stream vt1708_pcm_digital_playback = {
1903
1903
+
static const struct hda_pcm_stream vt1708_pcm_digital_playback = {
1465
1904
.substreams = 1,
1466
1905
.channels_min = 2,
1467
1906
.channels_max = 2,
···
1474
1913
},
1475
1914
};
1476
1915
1477
1477
-
static struct hda_pcm_stream vt1708_pcm_digital_capture = {
1916
1916
+
static const struct hda_pcm_stream vt1708_pcm_digital_capture = {
1478
1917
.substreams = 1,
1479
1918
.channels_min = 2,
1480
1919
.channels_max = 2,
···
1484
1923
{
1485
1924
struct via_spec *spec = codec->spec;
1486
1925
struct snd_kcontrol *kctl;
1487
1487
-
struct snd_kcontrol_new *knew;
1926
1926
+
const struct snd_kcontrol_new *knew;
1488
1927
int err, i;
1489
1928
1490
1929
for (i = 0; i < spec->num_mixers; i++) {
···
1532
1971
}
1533
1972
1534
1973
/* init power states */
1535
1535
-
set_jack_power_state(codec);
1974
1974
+
set_widgets_power_state(codec);
1536
1975
analog_low_current_mode(codec, 1);
1537
1976
1538
1977
via_free_kctls(codec); /* no longer needed */
···
1696
2135
unsigned int hp_present;
1697
2136
struct via_spec *spec = codec->spec;
1698
2137
1699
1699
-
if (spec->codec_type != VT2002P && spec->codec_type != VT1812)
2138
2138
+
if (!VT2002P_COMPATIBLE(spec))
1700
2139
return;
1701
2140
1702
2141
hp_present = snd_hda_jack_detect(codec, spec->autocfg.hp_pins[0]);
···
1755
2194
unsigned int res)
1756
2195
{
1757
2196
res >>= 26;
1758
1758
-
if (res & VIA_HP_EVENT)
1759
1759
-
via_hp_automute(codec);
1760
1760
-
if (res & VIA_GPIO_EVENT)
1761
1761
-
via_gpio_control(codec);
2197
2197
+
1762
2198
if (res & VIA_JACK_EVENT)
1763
1763
-
set_jack_power_state(codec);
1764
1764
-
if (res & VIA_MONO_EVENT)
2199
2199
+
set_widgets_power_state(codec);
2200
2200
+
2201
2201
+
res &= ~VIA_JACK_EVENT;
2202
2202
+
2203
2203
+
if (res == VIA_HP_EVENT)
2204
2204
+
via_hp_automute(codec);
2205
2205
+
else if (res == VIA_GPIO_EVENT)
2206
2206
+
via_gpio_control(codec);
2207
2207
+
else if (res == VIA_MONO_EVENT)
1765
2208
via_mono_automute(codec);
1766
1766
-
if (res & VIA_SPEAKER_EVENT)
2209
2209
+
else if (res == VIA_SPEAKER_EVENT)
1767
2210
via_speaker_automute(codec);
1768
1768
-
if (res & VIA_BIND_HP_EVENT)
2211
2211
+
else if (res == VIA_BIND_HP_EVENT)
1769
2212
via_hp_bind_automute(codec);
1770
2213
}
1771
2214
···
1819
2254
1820
2255
/*
1821
2256
*/
1822
1822
-
static struct hda_codec_ops via_patch_ops = {
2257
2257
+
static const struct hda_codec_ops via_patch_ops = {
1823
2258
.build_controls = via_build_controls,
1824
2259
.build_pcms = via_build_pcms,
1825
2260
.init = via_init,
···
1849
2284
/* config dac list */
1850
2285
switch (i) {
1851
2286
case AUTO_SEQ_FRONT:
1852
1852
-
spec->multiout.dac_nids[i] = 0x10;
2287
2287
+
spec->private_dac_nids[i] = 0x10;
1853
2288
break;
1854
2289
case AUTO_SEQ_CENLFE:
1855
1855
-
spec->multiout.dac_nids[i] = 0x12;
2290
2290
+
spec->private_dac_nids[i] = 0x12;
1856
2291
break;
1857
2292
case AUTO_SEQ_SURROUND:
1858
1858
-
spec->multiout.dac_nids[i] = 0x11;
2293
2293
+
spec->private_dac_nids[i] = 0x11;
1859
2294
break;
1860
2295
case AUTO_SEQ_SIDE:
1861
1861
-
spec->multiout.dac_nids[i] = 0x13;
2296
2296
+
spec->private_dac_nids[i] = 0x13;
1862
2297
break;
1863
2298
}
1864
2299
}
···
2002
2437
static int vt_auto_create_analog_input_ctls(struct hda_codec *codec,
2003
2438
const struct auto_pin_cfg *cfg,
2004
2439
hda_nid_t cap_nid,
2005
2005
-
hda_nid_t pin_idxs[], int num_idxs)
2440
2440
+
const hda_nid_t pin_idxs[],
2441
2441
+
int num_idxs)
2006
2442
{
2007
2443
struct via_spec *spec = codec->spec;
2008
2444
struct hda_input_mux *imux = &spec->private_imux[0];
···
2049
2483
static int vt1708_auto_create_analog_input_ctls(struct hda_codec *codec,
2050
2484
const struct auto_pin_cfg *cfg)
2051
2485
{
2052
2052
-
static hda_nid_t pin_idxs[] = { 0xff, 0x24, 0x1d, 0x1e, 0x21 };
2486
2486
+
static const hda_nid_t pin_idxs[] = { 0xff, 0x24, 0x1d, 0x1e, 0x21 };
2053
2487
return vt_auto_create_analog_input_ctls(codec, cfg, 0x17, pin_idxs,
2054
2488
ARRAY_SIZE(pin_idxs));
2055
2489
}
2056
2490
2057
2491
#ifdef CONFIG_SND_HDA_POWER_SAVE
2058
2058
-
static struct hda_amp_list vt1708_loopbacks[] = {
2492
2492
+
static const struct hda_amp_list vt1708_loopbacks[] = {
2059
2493
{ 0x17, HDA_INPUT, 1 },
2060
2494
{ 0x17, HDA_INPUT, 2 },
2061
2495
{ 0x17, HDA_INPUT, 3 },
···
2114
2548
return change;
2115
2549
}
2116
2550
2117
2117
-
static struct snd_kcontrol_new vt1708_jack_detectect[] = {
2551
2551
+
static const struct snd_kcontrol_new vt1708_jack_detectect[] = {
2118
2552
{
2119
2553
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2120
2554
.name = "Jack Detect",
···
2189
2623
via_auto_init_multi_out(codec);
2190
2624
via_auto_init_hp_out(codec);
2191
2625
via_auto_init_analog_input(codec);
2192
2192
-
if (spec->codec_type == VT2002P || spec->codec_type == VT1812) {
2626
2626
+
2627
2627
+
if (VT2002P_COMPATIBLE(spec)) {
2193
2628
via_hp_bind_automute(codec);
2194
2629
} else {
2195
2630
via_hp_automute(codec);
···
2294
2727
}
2295
2728
2296
2729
/* capture mixer elements */
2297
2297
-
static struct snd_kcontrol_new vt1709_capture_mixer[] = {
2730
2730
+
static const struct snd_kcontrol_new vt1709_capture_mixer[] = {
2298
2731
HDA_CODEC_VOLUME("Capture Volume", 0x14, 0x0, HDA_INPUT),
2299
2732
HDA_CODEC_MUTE("Capture Switch", 0x14, 0x0, HDA_INPUT),
2300
2733
HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x15, 0x0, HDA_INPUT),
···
2316
2749
{ } /* end */
2317
2750
};
2318
2751
2319
2319
-
static struct hda_verb vt1709_uniwill_init_verbs[] = {
2752
2752
+
static const struct hda_verb vt1709_uniwill_init_verbs[] = {
2320
2753
{0x20, AC_VERB_SET_UNSOLICITED_ENABLE,
2321
2754
AC_USRSP_EN | VIA_HP_EVENT | VIA_JACK_EVENT},
2322
2755
{ }
···
2325
2758
/*
2326
2759
* generic initialization of ADC, input mixers and output mixers
2327
2760
*/
2328
2328
-
static struct hda_verb vt1709_10ch_volume_init_verbs[] = {
2761
2761
+
static const struct hda_verb vt1709_10ch_volume_init_verbs[] = {
2329
2762
/*
2330
2763
* Unmute ADC0-2 and set the default input to mic-in
2331
2764
*/
···
2365
2798
{ }
2366
2799
};
2367
2800
2368
2368
-
static struct hda_pcm_stream vt1709_10ch_pcm_analog_playback = {
2801
2801
+
static const struct hda_pcm_stream vt1709_10ch_pcm_analog_playback = {
2369
2802
.substreams = 1,
2370
2803
.channels_min = 2,
2371
2804
.channels_max = 10,
···
2377
2810
},
2378
2811
};
2379
2812
2380
2380
-
static struct hda_pcm_stream vt1709_6ch_pcm_analog_playback = {
2813
2813
+
static const struct hda_pcm_stream vt1709_6ch_pcm_analog_playback = {
2381
2814
.substreams = 1,
2382
2815
.channels_min = 2,
2383
2816
.channels_max = 6,
···
2389
2822
},
2390
2823
};
2391
2824
2392
2392
-
static struct hda_pcm_stream vt1709_pcm_analog_capture = {
2825
2825
+
static const struct hda_pcm_stream vt1709_pcm_analog_capture = {
2393
2826
.substreams = 2,
2394
2827
.channels_min = 2,
2395
2828
.channels_max = 2,
···
2400
2833
},
2401
2834
};
2402
2835
2403
2403
-
static struct hda_pcm_stream vt1709_pcm_digital_playback = {
2836
2836
+
static const struct hda_pcm_stream vt1709_pcm_digital_playback = {
2404
2837
.substreams = 1,
2405
2838
.channels_min = 2,
2406
2839
.channels_max = 2,
···
2411
2844
},
2412
2845
};
2413
2846
2414
2414
-
static struct hda_pcm_stream vt1709_pcm_digital_capture = {
2847
2847
+
static const struct hda_pcm_stream vt1709_pcm_digital_capture = {
2415
2848
.substreams = 1,
2416
2849
.channels_min = 2,
2417
2850
.channels_max = 2,
···
2438
2871
switch (i) {
2439
2872
case AUTO_SEQ_FRONT:
2440
2873
/* AOW0 */
2441
2441
-
spec->multiout.dac_nids[i] = 0x10;
2874
2874
+
spec->private_dac_nids[i] = 0x10;
2442
2875
break;
2443
2876
case AUTO_SEQ_CENLFE:
2444
2877
/* AOW2 */
2445
2445
-
spec->multiout.dac_nids[i] = 0x12;
2878
2878
+
spec->private_dac_nids[i] = 0x12;
2446
2879
break;
2447
2880
case AUTO_SEQ_SURROUND:
2448
2881
/* AOW3 */
2449
2449
-
spec->multiout.dac_nids[i] = 0x11;
2882
2882
+
spec->private_dac_nids[i] = 0x11;
2450
2883
break;
2451
2884
case AUTO_SEQ_SIDE:
2452
2885
/* AOW1 */
2453
2453
-
spec->multiout.dac_nids[i] = 0x27;
2886
2886
+
spec->private_dac_nids[i] = 0x27;
2454
2887
break;
2455
2888
default:
2456
2889
break;
2457
2890
}
2458
2891
}
2459
2892
}
2460
2460
-
spec->multiout.dac_nids[cfg->line_outs] = 0x28; /* AOW4 */
2893
2893
+
spec->private_dac_nids[cfg->line_outs] = 0x28; /* AOW4 */
2461
2894
2462
2895
} else if (cfg->line_outs == 3) { /* 6 channels */
2463
2896
for (i = 0; i < cfg->line_outs; i++) {
···
2467
2900
switch (i) {
2468
2901
case AUTO_SEQ_FRONT:
2469
2902
/* AOW0 */
2470
2470
-
spec->multiout.dac_nids[i] = 0x10;
2903
2903
+
spec->private_dac_nids[i] = 0x10;
2471
2904
break;
2472
2905
case AUTO_SEQ_CENLFE:
2473
2906
/* AOW2 */
2474
2474
-
spec->multiout.dac_nids[i] = 0x12;
2907
2907
+
spec->private_dac_nids[i] = 0x12;
2475
2908
break;
2476
2909
case AUTO_SEQ_SURROUND:
2477
2910
/* AOW1 */
2478
2478
-
spec->multiout.dac_nids[i] = 0x11;
2911
2911
+
spec->private_dac_nids[i] = 0x11;
2479
2912
break;
2480
2913
default:
2481
2914
break;
···
2623
3056
static int vt1709_auto_create_analog_input_ctls(struct hda_codec *codec,
2624
3057
const struct auto_pin_cfg *cfg)
2625
3058
{
2626
2626
-
static hda_nid_t pin_idxs[] = { 0xff, 0x23, 0x1d, 0x1e, 0x21 };
3059
3059
+
static const hda_nid_t pin_idxs[] = { 0xff, 0x23, 0x1d, 0x1e, 0x21 };
2627
3060
return vt_auto_create_analog_input_ctls(codec, cfg, 0x18, pin_idxs,
2628
3061
ARRAY_SIZE(pin_idxs));
2629
3062
}
···
2673
3106
}
2674
3107
2675
3108
#ifdef CONFIG_SND_HDA_POWER_SAVE
2676
2676
-
static struct hda_amp_list vt1709_loopbacks[] = {
3109
3109
+
static const struct hda_amp_list vt1709_loopbacks[] = {
2677
3110
{ 0x18, HDA_INPUT, 1 },
2678
3111
{ 0x18, HDA_INPUT, 2 },
2679
3112
{ 0x18, HDA_INPUT, 3 },
···
2734
3167
/*
2735
3168
* generic initialization of ADC, input mixers and output mixers
2736
3169
*/
2737
2737
-
static struct hda_verb vt1709_6ch_volume_init_verbs[] = {
3170
3170
+
static const struct hda_verb vt1709_6ch_volume_init_verbs[] = {
2738
3171
/*
2739
3172
* Unmute ADC0-2 and set the default input to mic-in
2740
3173
*/
···
2824
3257
}
2825
3258
2826
3259
/* capture mixer elements */
2827
2827
-
static struct snd_kcontrol_new vt1708B_capture_mixer[] = {
3260
3260
+
static const struct snd_kcontrol_new vt1708B_capture_mixer[] = {
2828
3261
HDA_CODEC_VOLUME("Capture Volume", 0x13, 0x0, HDA_INPUT),
2829
3262
HDA_CODEC_MUTE("Capture Switch", 0x13, 0x0, HDA_INPUT),
2830
3263
HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x14, 0x0, HDA_INPUT),
···
2846
3279
/*
2847
3280
* generic initialization of ADC, input mixers and output mixers
2848
3281
*/
2849
2849
-
static struct hda_verb vt1708B_8ch_volume_init_verbs[] = {
3282
3282
+
static const struct hda_verb vt1708B_8ch_volume_init_verbs[] = {
2850
3283
/*
2851
3284
* Unmute ADC0-1 and set the default input to mic-in
2852
3285
*/
···
2881
3314
{ }
2882
3315
};
2883
3316
2884
2884
-
static struct hda_verb vt1708B_4ch_volume_init_verbs[] = {
3317
3317
+
static const struct hda_verb vt1708B_4ch_volume_init_verbs[] = {
2885
3318
/*
2886
3319
* Unmute ADC0-1 and set the default input to mic-in
2887
3320
*/
···
2916
3349
{ }
2917
3350
};
2918
3351
2919
2919
-
static struct hda_verb vt1708B_uniwill_init_verbs[] = {
3352
3352
+
static const struct hda_verb vt1708B_uniwill_init_verbs[] = {
2920
3353
{0x1d, AC_VERB_SET_UNSOLICITED_ENABLE,
2921
3354
AC_USRSP_EN | VIA_HP_EVENT | VIA_JACK_EVENT},
2922
3355
{0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | VIA_JACK_EVENT},
···
2940
3373
return 0;
2941
3374
}
2942
3375
2943
2943
-
static struct hda_pcm_stream vt1708B_8ch_pcm_analog_playback = {
3376
3376
+
static const struct hda_pcm_stream vt1708B_8ch_pcm_analog_playback = {
2944
3377
.substreams = 2,
2945
3378
.channels_min = 2,
2946
3379
.channels_max = 8,
···
2953
3386
},
2954
3387
};
2955
3388
2956
2956
-
static struct hda_pcm_stream vt1708B_4ch_pcm_analog_playback = {
3389
3389
+
static const struct hda_pcm_stream vt1708B_4ch_pcm_analog_playback = {
2957
3390
.substreams = 2,
2958
3391
.channels_min = 2,
2959
3392
.channels_max = 4,
···
2965
3398
},
2966
3399
};
2967
3400
2968
2968
-
static struct hda_pcm_stream vt1708B_pcm_analog_capture = {
3401
3401
+
static const struct hda_pcm_stream vt1708B_pcm_analog_capture = {
2969
3402
.substreams = 2,
2970
3403
.channels_min = 2,
2971
3404
.channels_max = 2,
···
2978
3411
},
2979
3412
};
2980
3413
2981
2981
-
static struct hda_pcm_stream vt1708B_pcm_digital_playback = {
3414
3414
+
static const struct hda_pcm_stream vt1708B_pcm_digital_playback = {
2982
3415
.substreams = 1,
2983
3416
.channels_min = 2,
2984
3417
.channels_max = 2,
···
2991
3424
},
2992
3425
};
2993
3426
2994
2994
-
static struct hda_pcm_stream vt1708B_pcm_digital_capture = {
3427
3427
+
static const struct hda_pcm_stream vt1708B_pcm_digital_capture = {
2995
3428
.substreams = 1,
2996
3429
.channels_min = 2,
2997
3430
.channels_max = 2,
···
3014
3447
/* config dac list */
3015
3448
switch (i) {
3016
3449
case AUTO_SEQ_FRONT:
3017
3017
-
spec->multiout.dac_nids[i] = 0x10;
3450
3450
+
spec->private_dac_nids[i] = 0x10;
3018
3451
break;
3019
3452
case AUTO_SEQ_CENLFE:
3020
3020
-
spec->multiout.dac_nids[i] = 0x24;
3453
3453
+
spec->private_dac_nids[i] = 0x24;
3021
3454
break;
3022
3455
case AUTO_SEQ_SURROUND:
3023
3023
-
spec->multiout.dac_nids[i] = 0x11;
3456
3456
+
spec->private_dac_nids[i] = 0x11;
3024
3457
break;
3025
3458
case AUTO_SEQ_SIDE:
3026
3026
-
spec->multiout.dac_nids[i] = 0x25;
3459
3459
+
spec->private_dac_nids[i] = 0x25;
3027
3460
break;
3028
3461
}
3029
3462
}
···
3155
3588
static int vt1708B_auto_create_analog_input_ctls(struct hda_codec *codec,
3156
3589
const struct auto_pin_cfg *cfg)
3157
3590
{
3158
3158
-
static hda_nid_t pin_idxs[] = { 0xff, 0x1f, 0x1a, 0x1b, 0x1e };
3591
3591
+
static const hda_nid_t pin_idxs[] = { 0xff, 0x1f, 0x1a, 0x1b, 0x1e };
3159
3592
return vt_auto_create_analog_input_ctls(codec, cfg, 0x16, pin_idxs,
3160
3593
ARRAY_SIZE(pin_idxs));
3161
3594
}
···
3205
3638
}
3206
3639
3207
3640
#ifdef CONFIG_SND_HDA_POWER_SAVE
3208
3208
-
static struct hda_amp_list vt1708B_loopbacks[] = {
3641
3641
+
static const struct hda_amp_list vt1708B_loopbacks[] = {
3209
3642
{ 0x16, HDA_INPUT, 1 },
3210
3643
{ 0x16, HDA_INPUT, 2 },
3211
3644
{ 0x16, HDA_INPUT, 3 },
···
3213
3646
{ } /* end */
3214
3647
};
3215
3648
#endif
3649
3649
+
3650
3650
+
static void set_widgets_power_state_vt1708B(struct hda_codec *codec)
3651
3651
+
{
3652
3652
+
struct via_spec *spec = codec->spec;
3653
3653
+
int imux_is_smixer;
3654
3654
+
unsigned int parm;
3655
3655
+
int is_8ch = 0;
3656
3656
+
if ((spec->codec_type != VT1708B_4CH) &&
3657
3657
+
(codec->vendor_id != 0x11064397))
3658
3658
+
is_8ch = 1;
3659
3659
+
3660
3660
+
/* SW0 (17h) = stereo mixer */
3661
3661
+
imux_is_smixer =
3662
3662
+
(snd_hda_codec_read(codec, 0x17, 0, AC_VERB_GET_CONNECT_SEL, 0x00)
3663
3663
+
== ((spec->codec_type == VT1708S) ? 5 : 0));
3664
3664
+
/* inputs */
3665
3665
+
/* PW 1/2/5 (1ah/1bh/1eh) */
3666
3666
+
parm = AC_PWRST_D3;
3667
3667
+
set_pin_power_state(codec, 0x1a, &parm);
3668
3668
+
set_pin_power_state(codec, 0x1b, &parm);
3669
3669
+
set_pin_power_state(codec, 0x1e, &parm);
3670
3670
+
if (imux_is_smixer)
3671
3671
+
parm = AC_PWRST_D0;
3672
3672
+
/* SW0 (17h), AIW 0/1 (13h/14h) */
3673
3673
+
snd_hda_codec_write(codec, 0x17, 0, AC_VERB_SET_POWER_STATE, parm);
3674
3674
+
snd_hda_codec_write(codec, 0x13, 0, AC_VERB_SET_POWER_STATE, parm);
3675
3675
+
snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_POWER_STATE, parm);
3676
3676
+
3677
3677
+
/* outputs */
3678
3678
+
/* PW0 (19h), SW1 (18h), AOW1 (11h) */
3679
3679
+
parm = AC_PWRST_D3;
3680
3680
+
set_pin_power_state(codec, 0x19, &parm);
3681
3681
+
if (spec->smart51_enabled)
3682
3682
+
set_pin_power_state(codec, 0x1b, &parm);
3683
3683
+
snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_POWER_STATE, parm);
3684
3684
+
snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_POWER_STATE, parm);
3685
3685
+
3686
3686
+
/* PW6 (22h), SW2 (26h), AOW2 (24h) */
3687
3687
+
if (is_8ch) {
3688
3688
+
parm = AC_PWRST_D3;
3689
3689
+
set_pin_power_state(codec, 0x22, &parm);
3690
3690
+
if (spec->smart51_enabled)
3691
3691
+
set_pin_power_state(codec, 0x1a, &parm);
3692
3692
+
snd_hda_codec_write(codec, 0x26, 0,
3693
3693
+
AC_VERB_SET_POWER_STATE, parm);
3694
3694
+
snd_hda_codec_write(codec, 0x24, 0,
3695
3695
+
AC_VERB_SET_POWER_STATE, parm);
3696
3696
+
} else if (codec->vendor_id == 0x11064397) {
3697
3697
+
/* PW7(23h), SW2(27h), AOW2(25h) */
3698
3698
+
parm = AC_PWRST_D3;
3699
3699
+
set_pin_power_state(codec, 0x23, &parm);
3700
3700
+
if (spec->smart51_enabled)
3701
3701
+
set_pin_power_state(codec, 0x1a, &parm);
3702
3702
+
snd_hda_codec_write(codec, 0x27, 0,
3703
3703
+
AC_VERB_SET_POWER_STATE, parm);
3704
3704
+
snd_hda_codec_write(codec, 0x25, 0,
3705
3705
+
AC_VERB_SET_POWER_STATE, parm);
3706
3706
+
}
3707
3707
+
3708
3708
+
/* PW 3/4/7 (1ch/1dh/23h) */
3709
3709
+
parm = AC_PWRST_D3;
3710
3710
+
/* force to D0 for internal Speaker */
3711
3711
+
set_pin_power_state(codec, 0x1c, &parm);
3712
3712
+
set_pin_power_state(codec, 0x1d, &parm);
3713
3713
+
if (is_8ch)
3714
3714
+
set_pin_power_state(codec, 0x23, &parm);
3715
3715
+
3716
3716
+
/* MW0 (16h), Sw3 (27h), AOW 0/3 (10h/25h) */
3717
3717
+
snd_hda_codec_write(codec, 0x16, 0, AC_VERB_SET_POWER_STATE,
3718
3718
+
imux_is_smixer ? AC_PWRST_D0 : parm);
3719
3719
+
snd_hda_codec_write(codec, 0x10, 0, AC_VERB_SET_POWER_STATE, parm);
3720
3720
+
if (is_8ch) {
3721
3721
+
snd_hda_codec_write(codec, 0x25, 0,
3722
3722
+
AC_VERB_SET_POWER_STATE, parm);
3723
3723
+
snd_hda_codec_write(codec, 0x27, 0,
3724
3724
+
AC_VERB_SET_POWER_STATE, parm);
3725
3725
+
} else if (codec->vendor_id == 0x11064397 && spec->hp_independent_mode)
3726
3726
+
snd_hda_codec_write(codec, 0x25, 0,
3727
3727
+
AC_VERB_SET_POWER_STATE, parm);
3728
3728
+
}
3729
3729
+
3216
3730
static int patch_vt1708S(struct hda_codec *codec);
3217
3731
static int patch_vt1708B_8ch(struct hda_codec *codec)
3218
3732
{
···
3343
3695
#ifdef CONFIG_SND_HDA_POWER_SAVE
3344
3696
spec->loopback.amplist = vt1708B_loopbacks;
3345
3697
#endif
3698
3698
+
3699
3699
+
spec->set_widgets_power_state = set_widgets_power_state_vt1708B;
3346
3700
3347
3701
return 0;
3348
3702
}
···
3396
3746
spec->loopback.amplist = vt1708B_loopbacks;
3397
3747
#endif
3398
3748
3749
3749
+
spec->set_widgets_power_state = set_widgets_power_state_vt1708B;
3750
3750
+
3399
3751
return 0;
3400
3752
}
3401
3753
3402
3754
/* Patch for VT1708S */
3403
3755
3404
3756
/* capture mixer elements */
3405
3405
-
static struct snd_kcontrol_new vt1708S_capture_mixer[] = {
3757
3757
+
static const struct snd_kcontrol_new vt1708S_capture_mixer[] = {
3406
3758
HDA_CODEC_VOLUME("Capture Volume", 0x13, 0x0, HDA_INPUT),
3407
3759
HDA_CODEC_MUTE("Capture Switch", 0x13, 0x0, HDA_INPUT),
3408
3760
HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x14, 0x0, HDA_INPUT),
···
3427
3775
{ } /* end */
3428
3776
};
3429
3777
3430
3430
-
static struct hda_verb vt1708S_volume_init_verbs[] = {
3778
3778
+
static const struct hda_verb vt1708S_volume_init_verbs[] = {
3431
3779
/* Unmute ADC0-1 and set the default input to mic-in */
3432
3780
{0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3433
3781
{0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
···
3453
3801
{ }
3454
3802
};
3455
3803
3456
3456
-
static struct hda_verb vt1708S_uniwill_init_verbs[] = {
3804
3804
+
static const struct hda_verb vt1708S_uniwill_init_verbs[] = {
3457
3805
{0x1d, AC_VERB_SET_UNSOLICITED_ENABLE,
3458
3806
AC_USRSP_EN | VIA_HP_EVENT | VIA_JACK_EVENT},
3459
3807
{0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | VIA_JACK_EVENT},
···
3466
3814
{ }
3467
3815
};
3468
3816
3469
3469
-
static struct hda_pcm_stream vt1708S_pcm_analog_playback = {
3817
3817
+
static const struct hda_verb vt1705_uniwill_init_verbs[] = {
3818
3818
+
{0x1d, AC_VERB_SET_UNSOLICITED_ENABLE,
3819
3819
+
AC_USRSP_EN | VIA_HP_EVENT | VIA_JACK_EVENT},
3820
3820
+
{0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | VIA_JACK_EVENT},
3821
3821
+
{0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | VIA_JACK_EVENT},
3822
3822
+
{0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | VIA_JACK_EVENT},
3823
3823
+
{0x1c, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | VIA_JACK_EVENT},
3824
3824
+
{0x1e, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | VIA_JACK_EVENT},
3825
3825
+
{0x23, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | VIA_JACK_EVENT},
3826
3826
+
{ }
3827
3827
+
};
3828
3828
+
3829
3829
+
static const struct hda_pcm_stream vt1708S_pcm_analog_playback = {
3470
3830
.substreams = 2,
3471
3831
.channels_min = 2,
3472
3832
.channels_max = 8,
···
3491
3827
},
3492
3828
};
3493
3829
3494
3494
-
static struct hda_pcm_stream vt1708S_pcm_analog_capture = {
3830
3830
+
static const struct hda_pcm_stream vt1705_pcm_analog_playback = {
3831
3831
+
.substreams = 2,
3832
3832
+
.channels_min = 2,
3833
3833
+
.channels_max = 6,
3834
3834
+
.nid = 0x10, /* NID to query formats and rates */
3835
3835
+
.ops = {
3836
3836
+
.open = via_playback_pcm_open,
3837
3837
+
.prepare = via_playback_multi_pcm_prepare,
3838
3838
+
.cleanup = via_playback_multi_pcm_cleanup,
3839
3839
+
.close = via_pcm_open_close
3840
3840
+
},
3841
3841
+
};
3842
3842
+
3843
3843
+
static const struct hda_pcm_stream vt1708S_pcm_analog_capture = {
3495
3844
.substreams = 2,
3496
3845
.channels_min = 2,
3497
3846
.channels_max = 2,
···
3517
3840
},
3518
3841
};
3519
3842
3520
3520
-
static struct hda_pcm_stream vt1708S_pcm_digital_playback = {
3843
3843
+
static const struct hda_pcm_stream vt1708S_pcm_digital_playback = {
3521
3844
.substreams = 1,
3522
3845
.channels_min = 2,
3523
3846
.channels_max = 2,
···
3547
3870
/* config dac list */
3548
3871
switch (i) {
3549
3872
case AUTO_SEQ_FRONT:
3550
3550
-
spec->multiout.dac_nids[i] = 0x10;
3873
3873
+
spec->private_dac_nids[i] = 0x10;
3551
3874
break;
3552
3875
case AUTO_SEQ_CENLFE:
3553
3553
-
spec->multiout.dac_nids[i] = 0x24;
3876
3876
+
if (spec->codec->vendor_id == 0x11064397)
3877
3877
+
spec->private_dac_nids[i] = 0x25;
3878
3878
+
else
3879
3879
+
spec->private_dac_nids[i] = 0x24;
3554
3880
break;
3555
3881
case AUTO_SEQ_SURROUND:
3556
3556
-
spec->multiout.dac_nids[i] = 0x11;
3882
3882
+
spec->private_dac_nids[i] = 0x11;
3557
3883
break;
3558
3884
case AUTO_SEQ_SIDE:
3559
3559
-
spec->multiout.dac_nids[i] = 0x25;
3885
3885
+
spec->private_dac_nids[i] = 0x25;
3560
3886
break;
3561
3887
}
3562
3888
}
···
3568
3888
/* for Smart 5.1, line/mic inputs double as output pins */
3569
3889
if (cfg->line_outs == 1) {
3570
3890
spec->multiout.num_dacs = 3;
3571
3571
-
spec->multiout.dac_nids[AUTO_SEQ_SURROUND] = 0x11;
3572
3572
-
spec->multiout.dac_nids[AUTO_SEQ_CENLFE] = 0x24;
3891
3891
+
spec->private_dac_nids[AUTO_SEQ_SURROUND] = 0x11;
3892
3892
+
if (spec->codec->vendor_id == 0x11064397)
3893
3893
+
spec->private_dac_nids[AUTO_SEQ_CENLFE] = 0x25;
3894
3894
+
else
3895
3895
+
spec->private_dac_nids[AUTO_SEQ_CENLFE] = 0x24;
3573
3896
}
3574
3897
3575
3898
return 0;
3576
3899
}
3577
3900
3578
3901
/* add playback controls from the parsed DAC table */
3579
3579
-
static int vt1708S_auto_create_multi_out_ctls(struct via_spec *spec,
3902
3902
+
static int vt1708S_auto_create_multi_out_ctls(struct hda_codec *codec,
3580
3903
const struct auto_pin_cfg *cfg)
3581
3904
{
3905
3905
+
struct via_spec *spec = codec->spec;
3582
3906
char name[32];
3583
3907
static const char * const chname[4] = {
3584
3908
"Front", "Surround", "C/LFE", "Side"
3585
3909
};
3586
3586
-
hda_nid_t nid_vols[] = {0x10, 0x11, 0x24, 0x25};
3587
3587
-
hda_nid_t nid_mutes[] = {0x1C, 0x18, 0x26, 0x27};
3910
3910
+
hda_nid_t nid_vols[2][4] = { {0x10, 0x11, 0x24, 0x25},
3911
3911
+
{0x10, 0x11, 0x25, 0} };
3912
3912
+
hda_nid_t nid_mutes[2][4] = { {0x1C, 0x18, 0x26, 0x27},
3913
3913
+
{0x1C, 0x18, 0x27, 0} };
3588
3914
hda_nid_t nid, nid_vol, nid_mute;
3589
3915
int i, err;
3590
3916
···
3601
3915
if (!nid && i > AUTO_SEQ_CENLFE)
3602
3916
continue;
3603
3917
3604
3604
-
nid_vol = nid_vols[i];
3605
3605
-
nid_mute = nid_mutes[i];
3918
3918
+
if (codec->vendor_id == 0x11064397) {
3919
3919
+
nid_vol = nid_vols[1][i];
3920
3920
+
nid_mute = nid_mutes[1][i];
3921
3921
+
} else {
3922
3922
+
nid_vol = nid_vols[0][i];
3923
3923
+
nid_mute = nid_mutes[0][i];
3924
3924
+
}
3925
3925
+
if (!nid_vol && !nid_mute)
3926
3926
+
continue;
3606
3927
3607
3928
if (i == AUTO_SEQ_CENLFE) {
3608
3929
/* Center/LFE */
···
3719
4026
static int vt1708S_auto_create_analog_input_ctls(struct hda_codec *codec,
3720
4027
const struct auto_pin_cfg *cfg)
3721
4028
{
3722
3722
-
static hda_nid_t pin_idxs[] = { 0x1f, 0x1a, 0x1b, 0x1e, 0, 0xff };
4029
4029
+
static const hda_nid_t pin_idxs[] = { 0x1f, 0x1a, 0x1b, 0x1e, 0, 0xff };
3723
4030
return vt_auto_create_analog_input_ctls(codec, cfg, 0x16, pin_idxs,
3724
4031
ARRAY_SIZE(pin_idxs));
3725
4032
}
···
3763
4070
if (!spec->autocfg.line_outs && !spec->autocfg.hp_pins[0])
3764
4071
return 0; /* can't find valid BIOS pin config */
3765
4072
3766
3766
-
err = vt1708S_auto_create_multi_out_ctls(spec, &spec->autocfg);
4073
4073
+
err = vt1708S_auto_create_multi_out_ctls(codec, &spec->autocfg);
3767
4074
if (err < 0)
3768
4075
return err;
3769
4076
err = vt1708S_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]);
···
3790
4097
}
3791
4098
3792
4099
#ifdef CONFIG_SND_HDA_POWER_SAVE
3793
3793
-
static struct hda_amp_list vt1708S_loopbacks[] = {
4100
4100
+
static const struct hda_amp_list vt1708S_loopbacks[] = {
3794
4101
{ 0x16, HDA_INPUT, 1 },
3795
4102
{ 0x16, HDA_INPUT, 2 },
3796
4103
{ 0x16, HDA_INPUT, 3 },
···
3830
4137
}
3831
4138
3832
4139
spec->init_verbs[spec->num_iverbs++] = vt1708S_volume_init_verbs;
3833
3833
-
spec->init_verbs[spec->num_iverbs++] = vt1708S_uniwill_init_verbs;
4140
4140
+
if (codec->vendor_id == 0x11064397)
4141
4141
+
spec->init_verbs[spec->num_iverbs++] =
4142
4142
+
vt1705_uniwill_init_verbs;
4143
4143
+
else
4144
4144
+
spec->init_verbs[spec->num_iverbs++] =
4145
4145
+
vt1708S_uniwill_init_verbs;
3834
4146
3835
4147
if (codec->vendor_id == 0x11060440)
3836
4148
spec->stream_name_analog = "VT1818S Analog";
4149
4149
+
else if (codec->vendor_id == 0x11064397)
4150
4150
+
spec->stream_name_analog = "VT1705 Analog";
3837
4151
else
3838
4152
spec->stream_name_analog = "VT1708S Analog";
3839
3839
-
spec->stream_analog_playback = &vt1708S_pcm_analog_playback;
4153
4153
+
if (codec->vendor_id == 0x11064397)
4154
4154
+
spec->stream_analog_playback = &vt1705_pcm_analog_playback;
4155
4155
+
else
4156
4156
+
spec->stream_analog_playback = &vt1708S_pcm_analog_playback;
3840
4157
spec->stream_analog_capture = &vt1708S_pcm_analog_capture;
3841
4158
3842
4159
if (codec->vendor_id == 0x11060440)
3843
4160
spec->stream_name_digital = "VT1818S Digital";
4161
4161
+
else if (codec->vendor_id == 0x11064397)
4162
4162
+
spec->stream_name_digital = "VT1705 Digital";
3844
4163
else
3845
4164
spec->stream_name_digital = "VT1708S Digital";
3846
4165
spec->stream_digital_playback = &vt1708S_pcm_digital_playback;
···
3890
4185
spec->stream_name_analog = "VT1818S Analog";
3891
4186
spec->stream_name_digital = "VT1818S Digital";
3892
4187
}
4188
4188
+
/* correct names for VT1705 */
4189
4189
+
if (codec->vendor_id == 0x11064397) {
4190
4190
+
kfree(codec->chip_name);
4191
4191
+
codec->chip_name = kstrdup("VT1705", GFP_KERNEL);
4192
4192
+
snprintf(codec->bus->card->mixername,
4193
4193
+
sizeof(codec->bus->card->mixername),
4194
4194
+
"%s %s", codec->vendor_name, codec->chip_name);
4195
4195
+
}
4196
4196
+
spec->set_widgets_power_state = set_widgets_power_state_vt1708B;
3893
4197
return 0;
3894
4198
}
3895
4199
3896
4200
/* Patch for VT1702 */
3897
4201
3898
4202
/* capture mixer elements */
3899
3899
-
static struct snd_kcontrol_new vt1702_capture_mixer[] = {
4203
4203
+
static const struct snd_kcontrol_new vt1702_capture_mixer[] = {
3900
4204
HDA_CODEC_VOLUME("Capture Volume", 0x12, 0x0, HDA_INPUT),
3901
4205
HDA_CODEC_MUTE("Capture Switch", 0x12, 0x0, HDA_INPUT),
3902
4206
HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x20, 0x0, HDA_INPUT),
···
3929
4215
{ } /* end */
3930
4216
};
3931
4217
3932
3932
-
static struct hda_verb vt1702_volume_init_verbs[] = {
4218
4218
+
static const struct hda_verb vt1702_volume_init_verbs[] = {
3933
4219
/*
3934
4220
* Unmute ADC0-1 and set the default input to mic-in
3935
4221
*/
···
3960
4246
{ }
3961
4247
};
3962
4248
3963
3963
-
static struct hda_verb vt1702_uniwill_init_verbs[] = {
4249
4249
+
static const struct hda_verb vt1702_uniwill_init_verbs[] = {
3964
4250
{0x17, AC_VERB_SET_UNSOLICITED_ENABLE,
3965
4251
AC_USRSP_EN | VIA_HP_EVENT | VIA_JACK_EVENT},
3966
4252
{0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | VIA_JACK_EVENT},
···
3970
4256
{ }
3971
4257
};
3972
4258
3973
3973
-
static struct hda_pcm_stream vt1702_pcm_analog_playback = {
4259
4259
+
static const struct hda_pcm_stream vt1702_pcm_analog_playback = {
3974
4260
.substreams = 2,
3975
4261
.channels_min = 2,
3976
4262
.channels_max = 2,
···
3983
4269
},
3984
4270
};
3985
4271
3986
3986
-
static struct hda_pcm_stream vt1702_pcm_analog_capture = {
4272
4272
+
static const struct hda_pcm_stream vt1702_pcm_analog_capture = {
3987
4273
.substreams = 3,
3988
4274
.channels_min = 2,
3989
4275
.channels_max = 2,
···
3996
4282
},
3997
4283
};
3998
4284
3999
3999
-
static struct hda_pcm_stream vt1702_pcm_digital_playback = {
4285
4285
+
static const struct hda_pcm_stream vt1702_pcm_digital_playback = {
4000
4286
.substreams = 2,
4001
4287
.channels_min = 2,
4002
4288
.channels_max = 2,
···
4018
4304
4019
4305
if (cfg->line_out_pins[0]) {
4020
4306
/* config dac list */
4021
4021
-
spec->multiout.dac_nids[0] = 0x10;
4307
4307
+
spec->private_dac_nids[0] = 0x10;
4022
4308
}
4023
4309
4024
4310
return 0;
···
4096
4382
static int vt1702_auto_create_analog_input_ctls(struct hda_codec *codec,
4097
4383
const struct auto_pin_cfg *cfg)
4098
4384
{
4099
4099
-
static hda_nid_t pin_idxs[] = { 0x14, 0x15, 0x18, 0xff };
4385
4385
+
static const hda_nid_t pin_idxs[] = { 0x14, 0x15, 0x18, 0xff };
4100
4386
return vt_auto_create_analog_input_ctls(codec, cfg, 0x1a, pin_idxs,
4101
4387
ARRAY_SIZE(pin_idxs));
4102
4388
}
···
4147
4433
}
4148
4434
4149
4435
#ifdef CONFIG_SND_HDA_POWER_SAVE
4150
4150
-
static struct hda_amp_list vt1702_loopbacks[] = {
4436
4436
+
static const struct hda_amp_list vt1702_loopbacks[] = {
4151
4437
{ 0x1A, HDA_INPUT, 1 },
4152
4438
{ 0x1A, HDA_INPUT, 2 },
4153
4439
{ 0x1A, HDA_INPUT, 3 },
···
4155
4441
{ } /* end */
4156
4442
};
4157
4443
#endif
4444
4444
+
4445
4445
+
static void set_widgets_power_state_vt1702(struct hda_codec *codec)
4446
4446
+
{
4447
4447
+
int imux_is_smixer =
4448
4448
+
snd_hda_codec_read(codec, 0x13, 0, AC_VERB_GET_CONNECT_SEL, 0x00) == 3;
4449
4449
+
unsigned int parm;
4450
4450
+
/* inputs */
4451
4451
+
/* PW 1/2/5 (14h/15h/18h) */
4452
4452
+
parm = AC_PWRST_D3;
4453
4453
+
set_pin_power_state(codec, 0x14, &parm);
4454
4454
+
set_pin_power_state(codec, 0x15, &parm);
4455
4455
+
set_pin_power_state(codec, 0x18, &parm);
4456
4456
+
if (imux_is_smixer)
4457
4457
+
parm = AC_PWRST_D0; /* SW0 (13h) = stereo mixer (idx 3) */
4458
4458
+
/* SW0 (13h), AIW 0/1/2 (12h/1fh/20h) */
4459
4459
+
snd_hda_codec_write(codec, 0x13, 0, AC_VERB_SET_POWER_STATE, parm);
4460
4460
+
snd_hda_codec_write(codec, 0x12, 0, AC_VERB_SET_POWER_STATE, parm);
4461
4461
+
snd_hda_codec_write(codec, 0x1f, 0, AC_VERB_SET_POWER_STATE, parm);
4462
4462
+
snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_POWER_STATE, parm);
4463
4463
+
4464
4464
+
/* outputs */
4465
4465
+
/* PW 3/4 (16h/17h) */
4466
4466
+
parm = AC_PWRST_D3;
4467
4467
+
set_pin_power_state(codec, 0x17, &parm);
4468
4468
+
set_pin_power_state(codec, 0x16, &parm);
4469
4469
+
/* MW0 (1ah), AOW 0/1 (10h/1dh) */
4470
4470
+
snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_POWER_STATE,
4471
4471
+
imux_is_smixer ? AC_PWRST_D0 : parm);
4472
4472
+
snd_hda_codec_write(codec, 0x10, 0, AC_VERB_SET_POWER_STATE, parm);
4473
4473
+
snd_hda_codec_write(codec, 0x1d, 0, AC_VERB_SET_POWER_STATE, parm);
4474
4474
+
}
4158
4475
4159
4476
static int patch_vt1702(struct hda_codec *codec)
4160
4477
{
···
4233
4488
spec->loopback.amplist = vt1702_loopbacks;
4234
4489
#endif
4235
4490
4491
4491
+
spec->set_widgets_power_state = set_widgets_power_state_vt1702;
4236
4492
return 0;
4237
4493
}
4238
4494
4239
4495
/* Patch for VT1718S */
4240
4496
4241
4497
/* capture mixer elements */
4242
4242
-
static struct snd_kcontrol_new vt1718S_capture_mixer[] = {
4498
4498
+
static const struct snd_kcontrol_new vt1718S_capture_mixer[] = {
4243
4499
HDA_CODEC_VOLUME("Capture Volume", 0x10, 0x0, HDA_INPUT),
4244
4500
HDA_CODEC_MUTE("Capture Switch", 0x10, 0x0, HDA_INPUT),
4245
4501
HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x11, 0x0, HDA_INPUT),
···
4262
4516
{ } /* end */
4263
4517
};
4264
4518
4265
4265
-
static struct hda_verb vt1718S_volume_init_verbs[] = {
4519
4519
+
static const struct hda_verb vt1718S_volume_init_verbs[] = {
4266
4520
/*
4267
4521
* Unmute ADC0-1 and set the default input to mic-in
4268
4522
*/
4269
4523
{0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4270
4524
{0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4271
4525
4272
4272
-
4526
4526
+
/* Enable MW0 adjust Gain 5 */
4527
4527
+
{0x1, 0xfb2, 0x10},
4273
4528
/* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
4274
4529
* mixer widget
4275
4530
*/
···
4279
4532
{0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4280
4533
{0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4281
4534
{0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4282
4282
-
{0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
4535
4535
+
{0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
4283
4536
4284
4537
/* Setup default input of Front HP to MW9 */
4285
4538
{0x28, AC_VERB_SET_CONNECT_SEL, 0x1},
···
4310
4563
};
4311
4564
4312
4565
4313
4313
-
static struct hda_verb vt1718S_uniwill_init_verbs[] = {
4566
4566
+
static const struct hda_verb vt1718S_uniwill_init_verbs[] = {
4314
4567
{0x28, AC_VERB_SET_UNSOLICITED_ENABLE,
4315
4568
AC_USRSP_EN | VIA_HP_EVENT | VIA_JACK_EVENT},
4316
4569
{0x24, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | VIA_JACK_EVENT},
···
4323
4576
{ }
4324
4577
};
4325
4578
4326
4326
-
static struct hda_pcm_stream vt1718S_pcm_analog_playback = {
4579
4579
+
static const struct hda_pcm_stream vt1718S_pcm_analog_playback = {
4327
4580
.substreams = 2,
4328
4581
.channels_min = 2,
4329
4582
.channels_max = 10,
···
4336
4589
},
4337
4590
};
4338
4591
4339
4339
-
static struct hda_pcm_stream vt1718S_pcm_analog_capture = {
4592
4592
+
static const struct hda_pcm_stream vt1718S_pcm_analog_capture = {
4340
4593
.substreams = 2,
4341
4594
.channels_min = 2,
4342
4595
.channels_max = 2,
···
4349
4602
},
4350
4603
};
4351
4604
4352
4352
-
static struct hda_pcm_stream vt1718S_pcm_digital_playback = {
4605
4605
+
static const struct hda_pcm_stream vt1718S_pcm_digital_playback = {
4353
4606
.substreams = 2,
4354
4607
.channels_min = 2,
4355
4608
.channels_max = 2,
···
4362
4615
},
4363
4616
};
4364
4617
4365
4365
-
static struct hda_pcm_stream vt1718S_pcm_digital_capture = {
4618
4618
+
static const struct hda_pcm_stream vt1718S_pcm_digital_capture = {
4366
4619
.substreams = 1,
4367
4620
.channels_min = 2,
4368
4621
.channels_max = 2,
···
4385
4638
/* config dac list */
4386
4639
switch (i) {
4387
4640
case AUTO_SEQ_FRONT:
4388
4388
-
spec->multiout.dac_nids[i] = 0x8;
4641
4641
+
spec->private_dac_nids[i] = 0x8;
4389
4642
break;
4390
4643
case AUTO_SEQ_CENLFE:
4391
4391
-
spec->multiout.dac_nids[i] = 0xa;
4644
4644
+
spec->private_dac_nids[i] = 0xa;
4392
4645
break;
4393
4646
case AUTO_SEQ_SURROUND:
4394
4394
-
spec->multiout.dac_nids[i] = 0x9;
4647
4647
+
spec->private_dac_nids[i] = 0x9;
4395
4648
break;
4396
4649
case AUTO_SEQ_SIDE:
4397
4397
-
spec->multiout.dac_nids[i] = 0xb;
4650
4650
+
spec->private_dac_nids[i] = 0xb;
4398
4651
break;
4399
4652
}
4400
4653
}
···
4516
4769
static int vt1718S_auto_create_analog_input_ctls(struct hda_codec *codec,
4517
4770
const struct auto_pin_cfg *cfg)
4518
4771
{
4519
4519
-
static hda_nid_t pin_idxs[] = { 0x2c, 0x2b, 0x2a, 0x29, 0, 0xff };
4772
4772
+
static const hda_nid_t pin_idxs[] = { 0x2c, 0x2b, 0x2a, 0x29, 0, 0xff };
4520
4773
return vt_auto_create_analog_input_ctls(codec, cfg, 0x21, pin_idxs,
4521
4774
ARRAY_SIZE(pin_idxs));
4522
4775
}
···
4567
4820
}
4568
4821
4569
4822
#ifdef CONFIG_SND_HDA_POWER_SAVE
4570
4570
-
static struct hda_amp_list vt1718S_loopbacks[] = {
4823
4823
+
static const struct hda_amp_list vt1718S_loopbacks[] = {
4571
4824
{ 0x21, HDA_INPUT, 1 },
4572
4825
{ 0x21, HDA_INPUT, 2 },
4573
4826
{ 0x21, HDA_INPUT, 3 },
···
4575
4828
{ } /* end */
4576
4829
};
4577
4830
#endif
4831
4831
+
4832
4832
+
static void set_widgets_power_state_vt1718S(struct hda_codec *codec)
4833
4833
+
{
4834
4834
+
struct via_spec *spec = codec->spec;
4835
4835
+
int imux_is_smixer;
4836
4836
+
unsigned int parm;
4837
4837
+
/* MUX6 (1eh) = stereo mixer */
4838
4838
+
imux_is_smixer =
4839
4839
+
snd_hda_codec_read(codec, 0x1e, 0, AC_VERB_GET_CONNECT_SEL, 0x00) == 5;
4840
4840
+
/* inputs */
4841
4841
+
/* PW 5/6/7 (29h/2ah/2bh) */
4842
4842
+
parm = AC_PWRST_D3;
4843
4843
+
set_pin_power_state(codec, 0x29, &parm);
4844
4844
+
set_pin_power_state(codec, 0x2a, &parm);
4845
4845
+
set_pin_power_state(codec, 0x2b, &parm);
4846
4846
+
if (imux_is_smixer)
4847
4847
+
parm = AC_PWRST_D0;
4848
4848
+
/* MUX6/7 (1eh/1fh), AIW 0/1 (10h/11h) */
4849
4849
+
snd_hda_codec_write(codec, 0x1e, 0, AC_VERB_SET_POWER_STATE, parm);
4850
4850
+
snd_hda_codec_write(codec, 0x1f, 0, AC_VERB_SET_POWER_STATE, parm);
4851
4851
+
snd_hda_codec_write(codec, 0x10, 0, AC_VERB_SET_POWER_STATE, parm);
4852
4852
+
snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_POWER_STATE, parm);
4853
4853
+
4854
4854
+
/* outputs */
4855
4855
+
/* PW3 (27h), MW2 (1ah), AOW3 (bh) */
4856
4856
+
parm = AC_PWRST_D3;
4857
4857
+
set_pin_power_state(codec, 0x27, &parm);
4858
4858
+
snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_POWER_STATE, parm);
4859
4859
+
snd_hda_codec_write(codec, 0xb, 0, AC_VERB_SET_POWER_STATE, parm);
4860
4860
+
4861
4861
+
/* PW2 (26h), AOW2 (ah) */
4862
4862
+
parm = AC_PWRST_D3;
4863
4863
+
set_pin_power_state(codec, 0x26, &parm);
4864
4864
+
if (spec->smart51_enabled)
4865
4865
+
set_pin_power_state(codec, 0x2b, &parm);
4866
4866
+
snd_hda_codec_write(codec, 0xa, 0, AC_VERB_SET_POWER_STATE, parm);
4867
4867
+
4868
4868
+
/* PW0 (24h), AOW0 (8h) */
4869
4869
+
parm = AC_PWRST_D3;
4870
4870
+
set_pin_power_state(codec, 0x24, &parm);
4871
4871
+
if (!spec->hp_independent_mode) /* check for redirected HP */
4872
4872
+
set_pin_power_state(codec, 0x28, &parm);
4873
4873
+
snd_hda_codec_write(codec, 0x8, 0, AC_VERB_SET_POWER_STATE, parm);
4874
4874
+
/* MW9 (21h), Mw2 (1ah), AOW0 (8h) */
4875
4875
+
snd_hda_codec_write(codec, 0x21, 0, AC_VERB_SET_POWER_STATE,
4876
4876
+
imux_is_smixer ? AC_PWRST_D0 : parm);
4877
4877
+
4878
4878
+
/* PW1 (25h), AOW1 (9h) */
4879
4879
+
parm = AC_PWRST_D3;
4880
4880
+
set_pin_power_state(codec, 0x25, &parm);
4881
4881
+
if (spec->smart51_enabled)
4882
4882
+
set_pin_power_state(codec, 0x2a, &parm);
4883
4883
+
snd_hda_codec_write(codec, 0x9, 0, AC_VERB_SET_POWER_STATE, parm);
4884
4884
+
4885
4885
+
if (spec->hp_independent_mode) {
4886
4886
+
/* PW4 (28h), MW3 (1bh), MUX1(34h), AOW4 (ch) */
4887
4887
+
parm = AC_PWRST_D3;
4888
4888
+
set_pin_power_state(codec, 0x28, &parm);
4889
4889
+
snd_hda_codec_write(codec, 0x1b, 0,
4890
4890
+
AC_VERB_SET_POWER_STATE, parm);
4891
4891
+
snd_hda_codec_write(codec, 0x34, 0,
4892
4892
+
AC_VERB_SET_POWER_STATE, parm);
4893
4893
+
snd_hda_codec_write(codec, 0xc, 0,
4894
4894
+
AC_VERB_SET_POWER_STATE, parm);
4895
4895
+
}
4896
4896
+
}
4578
4897
4579
4898
static int patch_vt1718S(struct hda_codec *codec)
4580
4899
{
···
4703
4890
spec->loopback.amplist = vt1718S_loopbacks;
4704
4891
#endif
4705
4892
4893
4893
+
spec->set_widgets_power_state = set_widgets_power_state_vt1718S;
4894
4894
+
4706
4895
return 0;
4707
4896
}
4708
4897
···
4744
4929
snd_hda_codec_write(codec, 0x26, 0,
4745
4930
AC_VERB_SET_CONNECT_SEL, index);
4746
4931
spec->dmic_enabled = index;
4747
4747
-
set_jack_power_state(codec);
4748
4748
-
4932
4932
+
set_widgets_power_state(codec);
4749
4933
return 1;
4750
4934
}
4751
4935
4752
4936
/* capture mixer elements */
4753
4753
-
static struct snd_kcontrol_new vt1716S_capture_mixer[] = {
4937
4937
+
static const struct snd_kcontrol_new vt1716S_capture_mixer[] = {
4754
4938
HDA_CODEC_VOLUME("Capture Volume", 0x13, 0x0, HDA_INPUT),
4755
4939
HDA_CODEC_MUTE("Capture Switch", 0x13, 0x0, HDA_INPUT),
4756
4940
HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x14, 0x0, HDA_INPUT),
···
4768
4954
{ } /* end */
4769
4955
};
4770
4956
4771
4771
-
static struct snd_kcontrol_new vt1716s_dmic_mixer[] = {
4957
4957
+
static const struct snd_kcontrol_new vt1716s_dmic_mixer[] = {
4772
4958
HDA_CODEC_VOLUME("Digital Mic Capture Volume", 0x22, 0x0, HDA_INPUT),
4773
4959
{
4774
4960
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
···
4784
4970
4785
4971
4786
4972
/* mono-out mixer elements */
4787
4787
-
static struct snd_kcontrol_new vt1716S_mono_out_mixer[] = {
4973
4973
+
static const struct snd_kcontrol_new vt1716S_mono_out_mixer[] = {
4788
4974
HDA_CODEC_MUTE("Mono Playback Switch", 0x2a, 0x0, HDA_OUTPUT),
4789
4975
{ } /* end */
4790
4976
};
4791
4977
4792
4792
-
static struct hda_verb vt1716S_volume_init_verbs[] = {
4978
4978
+
static const struct hda_verb vt1716S_volume_init_verbs[] = {
4793
4979
/*
4794
4980
* Unmute ADC0-1 and set the default input to mic-in
4795
4981
*/
···
4838
5024
};
4839
5025
4840
5026
4841
4841
-
static struct hda_verb vt1716S_uniwill_init_verbs[] = {
5027
5027
+
static const struct hda_verb vt1716S_uniwill_init_verbs[] = {
4842
5028
{0x1d, AC_VERB_SET_UNSOLICITED_ENABLE,
4843
5029
AC_USRSP_EN | VIA_HP_EVENT | VIA_JACK_EVENT},
4844
5030
{0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | VIA_JACK_EVENT},
···
4851
5037
{ }
4852
5038
};
4853
5039
4854
4854
-
static struct hda_pcm_stream vt1716S_pcm_analog_playback = {
5040
5040
+
static const struct hda_pcm_stream vt1716S_pcm_analog_playback = {
4855
5041
.substreams = 2,
4856
5042
.channels_min = 2,
4857
5043
.channels_max = 6,
···
4864
5050
},
4865
5051
};
4866
5052
4867
4867
-
static struct hda_pcm_stream vt1716S_pcm_analog_capture = {
5053
5053
+
static const struct hda_pcm_stream vt1716S_pcm_analog_capture = {
4868
5054
.substreams = 2,
4869
5055
.channels_min = 2,
4870
5056
.channels_max = 2,
···
4877
5063
},
4878
5064
};
4879
5065
4880
4880
-
static struct hda_pcm_stream vt1716S_pcm_digital_playback = {
5066
5066
+
static const struct hda_pcm_stream vt1716S_pcm_digital_playback = {
4881
5067
.substreams = 2,
4882
5068
.channels_min = 2,
4883
5069
.channels_max = 2,
···
4906
5092
/* config dac list */
4907
5093
switch (i) {
4908
5094
case AUTO_SEQ_FRONT:
4909
4909
-
spec->multiout.dac_nids[i] = 0x10;
5095
5095
+
spec->private_dac_nids[i] = 0x10;
4910
5096
break;
4911
5097
case AUTO_SEQ_CENLFE:
4912
4912
-
spec->multiout.dac_nids[i] = 0x25;
5098
5098
+
spec->private_dac_nids[i] = 0x25;
4913
5099
break;
4914
5100
case AUTO_SEQ_SURROUND:
4915
4915
-
spec->multiout.dac_nids[i] = 0x11;
5101
5101
+
spec->private_dac_nids[i] = 0x11;
4916
5102
break;
4917
5103
}
4918
5104
}
···
5047
5233
static int vt1716S_auto_create_analog_input_ctls(struct hda_codec *codec,
5048
5234
const struct auto_pin_cfg *cfg)
5049
5235
{
5050
5050
-
static hda_nid_t pin_idxs[] = { 0x1f, 0x1a, 0x1b, 0x1e, 0, 0xff };
5236
5236
+
static const hda_nid_t pin_idxs[] = { 0x1f, 0x1a, 0x1b, 0x1e, 0, 0xff };
5051
5237
return vt_auto_create_analog_input_ctls(codec, cfg, 0x16, pin_idxs,
5052
5238
ARRAY_SIZE(pin_idxs));
5053
5239
}
···
5094
5280
}
5095
5281
5096
5282
#ifdef CONFIG_SND_HDA_POWER_SAVE
5097
5097
-
static struct hda_amp_list vt1716S_loopbacks[] = {
5283
5283
+
static const struct hda_amp_list vt1716S_loopbacks[] = {
5098
5284
{ 0x16, HDA_INPUT, 1 },
5099
5285
{ 0x16, HDA_INPUT, 2 },
5100
5286
{ 0x16, HDA_INPUT, 3 },
···
5102
5288
{ } /* end */
5103
5289
};
5104
5290
#endif
5291
5291
+
5292
5292
+
static void set_widgets_power_state_vt1716S(struct hda_codec *codec)
5293
5293
+
{
5294
5294
+
struct via_spec *spec = codec->spec;
5295
5295
+
int imux_is_smixer;
5296
5296
+
unsigned int parm;
5297
5297
+
unsigned int mono_out, present;
5298
5298
+
/* SW0 (17h) = stereo mixer */
5299
5299
+
imux_is_smixer =
5300
5300
+
(snd_hda_codec_read(codec, 0x17, 0,
5301
5301
+
AC_VERB_GET_CONNECT_SEL, 0x00) == 5);
5302
5302
+
/* inputs */
5303
5303
+
/* PW 1/2/5 (1ah/1bh/1eh) */
5304
5304
+
parm = AC_PWRST_D3;
5305
5305
+
set_pin_power_state(codec, 0x1a, &parm);
5306
5306
+
set_pin_power_state(codec, 0x1b, &parm);
5307
5307
+
set_pin_power_state(codec, 0x1e, &parm);
5308
5308
+
if (imux_is_smixer)
5309
5309
+
parm = AC_PWRST_D0;
5310
5310
+
/* SW0 (17h), AIW0(13h) */
5311
5311
+
snd_hda_codec_write(codec, 0x17, 0, AC_VERB_SET_POWER_STATE, parm);
5312
5312
+
snd_hda_codec_write(codec, 0x13, 0, AC_VERB_SET_POWER_STATE, parm);
5313
5313
+
5314
5314
+
parm = AC_PWRST_D3;
5315
5315
+
set_pin_power_state(codec, 0x1e, &parm);
5316
5316
+
/* PW11 (22h) */
5317
5317
+
if (spec->dmic_enabled)
5318
5318
+
set_pin_power_state(codec, 0x22, &parm);
5319
5319
+
else
5320
5320
+
snd_hda_codec_write(codec, 0x22, 0,
5321
5321
+
AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
5322
5322
+
5323
5323
+
/* SW2(26h), AIW1(14h) */
5324
5324
+
snd_hda_codec_write(codec, 0x26, 0, AC_VERB_SET_POWER_STATE, parm);
5325
5325
+
snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_POWER_STATE, parm);
5326
5326
+
5327
5327
+
/* outputs */
5328
5328
+
/* PW0 (19h), SW1 (18h), AOW1 (11h) */
5329
5329
+
parm = AC_PWRST_D3;
5330
5330
+
set_pin_power_state(codec, 0x19, &parm);
5331
5331
+
/* Smart 5.1 PW2(1bh) */
5332
5332
+
if (spec->smart51_enabled)
5333
5333
+
set_pin_power_state(codec, 0x1b, &parm);
5334
5334
+
snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_POWER_STATE, parm);
5335
5335
+
snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_POWER_STATE, parm);
5336
5336
+
5337
5337
+
/* PW7 (23h), SW3 (27h), AOW3 (25h) */
5338
5338
+
parm = AC_PWRST_D3;
5339
5339
+
set_pin_power_state(codec, 0x23, &parm);
5340
5340
+
/* Smart 5.1 PW1(1ah) */
5341
5341
+
if (spec->smart51_enabled)
5342
5342
+
set_pin_power_state(codec, 0x1a, &parm);
5343
5343
+
snd_hda_codec_write(codec, 0x27, 0, AC_VERB_SET_POWER_STATE, parm);
5344
5344
+
5345
5345
+
/* Smart 5.1 PW5(1eh) */
5346
5346
+
if (spec->smart51_enabled)
5347
5347
+
set_pin_power_state(codec, 0x1e, &parm);
5348
5348
+
snd_hda_codec_write(codec, 0x25, 0, AC_VERB_SET_POWER_STATE, parm);
5349
5349
+
5350
5350
+
/* Mono out */
5351
5351
+
/* SW4(28h)->MW1(29h)-> PW12 (2ah)*/
5352
5352
+
present = snd_hda_jack_detect(codec, 0x1c);
5353
5353
+
5354
5354
+
if (present)
5355
5355
+
mono_out = 0;
5356
5356
+
else {
5357
5357
+
present = snd_hda_jack_detect(codec, 0x1d);
5358
5358
+
if (!spec->hp_independent_mode && present)
5359
5359
+
mono_out = 0;
5360
5360
+
else
5361
5361
+
mono_out = 1;
5362
5362
+
}
5363
5363
+
parm = mono_out ? AC_PWRST_D0 : AC_PWRST_D3;
5364
5364
+
snd_hda_codec_write(codec, 0x28, 0, AC_VERB_SET_POWER_STATE, parm);
5365
5365
+
snd_hda_codec_write(codec, 0x29, 0, AC_VERB_SET_POWER_STATE, parm);
5366
5366
+
snd_hda_codec_write(codec, 0x2a, 0, AC_VERB_SET_POWER_STATE, parm);
5367
5367
+
5368
5368
+
/* PW 3/4 (1ch/1dh) */
5369
5369
+
parm = AC_PWRST_D3;
5370
5370
+
set_pin_power_state(codec, 0x1c, &parm);
5371
5371
+
set_pin_power_state(codec, 0x1d, &parm);
5372
5372
+
/* HP Independent Mode, power on AOW3 */
5373
5373
+
if (spec->hp_independent_mode)
5374
5374
+
snd_hda_codec_write(codec, 0x25, 0,
5375
5375
+
AC_VERB_SET_POWER_STATE, parm);
5376
5376
+
5377
5377
+
/* force to D0 for internal Speaker */
5378
5378
+
/* MW0 (16h), AOW0 (10h) */
5379
5379
+
snd_hda_codec_write(codec, 0x16, 0, AC_VERB_SET_POWER_STATE,
5380
5380
+
imux_is_smixer ? AC_PWRST_D0 : parm);
5381
5381
+
snd_hda_codec_write(codec, 0x10, 0, AC_VERB_SET_POWER_STATE,
5382
5382
+
mono_out ? AC_PWRST_D0 : parm);
5383
5383
+
}
5105
5384
5106
5385
static int patch_vt1716S(struct hda_codec *codec)
5107
5386
{
···
5250
5343
spec->loopback.amplist = vt1716S_loopbacks;
5251
5344
#endif
5252
5345
5346
5346
+
spec->set_widgets_power_state = set_widgets_power_state_vt1716S;
5253
5347
return 0;
5254
5348
}
5255
5349
5256
5350
/* for vt2002P */
5257
5351
5258
5352
/* capture mixer elements */
5259
5259
-
static struct snd_kcontrol_new vt2002P_capture_mixer[] = {
5353
5353
+
static const struct snd_kcontrol_new vt2002P_capture_mixer[] = {
5260
5354
HDA_CODEC_VOLUME("Capture Volume", 0x10, 0x0, HDA_INPUT),
5261
5355
HDA_CODEC_MUTE("Capture Switch", 0x10, 0x0, HDA_INPUT),
5262
5356
HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x11, 0x0, HDA_INPUT),
···
5280
5372
{ } /* end */
5281
5373
};
5282
5374
5283
5283
-
static struct hda_verb vt2002P_volume_init_verbs[] = {
5375
5375
+
static const struct hda_verb vt2002P_volume_init_verbs[] = {
5376
5376
+
/* Class-D speaker related verbs */
5377
5377
+
{0x1, 0xfe0, 0x4},
5378
5378
+
{0x1, 0xfe9, 0x80},
5379
5379
+
{0x1, 0xfe2, 0x22},
5284
5380
/*
5285
5381
* Unmute ADC0-1 and set the default input to mic-in
5286
5382
*/
···
5335
5423
{0x1, 0xfb8, 0x88},
5336
5424
{ }
5337
5425
};
5426
5426
+
static const struct hda_verb vt1802_volume_init_verbs[] = {
5427
5427
+
/*
5428
5428
+
* Unmute ADC0-1 and set the default input to mic-in
5429
5429
+
*/
5430
5430
+
{0x8, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5431
5431
+
{0x9, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5338
5432
5339
5433
5340
5340
-
static struct hda_verb vt2002P_uniwill_init_verbs[] = {
5434
5434
+
/* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
5435
5435
+
* mixer widget
5436
5436
+
*/
5437
5437
+
/* Amp Indices: CD = 1, Mic1 = 2, Line = 3, Mic2 = 4 */
5438
5438
+
{0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5439
5439
+
{0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5440
5440
+
{0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5441
5441
+
{0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5442
5442
+
{0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5443
5443
+
5444
5444
+
/* MUX Indices: Mic = 0 */
5445
5445
+
{0x1e, AC_VERB_SET_CONNECT_SEL, 0},
5446
5446
+
{0x1f, AC_VERB_SET_CONNECT_SEL, 0},
5447
5447
+
5448
5448
+
/* PW9 Output enable */
5449
5449
+
{0x2d, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_OUT_EN},
5450
5450
+
5451
5451
+
/* Enable Boost Volume backdoor */
5452
5452
+
{0x1, 0xfb9, 0x24},
5453
5453
+
5454
5454
+
/* MW0/1/4/8: un-mute index 0 (MUXx), un-mute index 1 (MW9) */
5455
5455
+
{0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5456
5456
+
{0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5457
5457
+
{0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5458
5458
+
{0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5459
5459
+
{0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5460
5460
+
{0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5461
5461
+
{0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5462
5462
+
{0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5463
5463
+
5464
5464
+
/* set MUX0/1/4/8 = 0 (AOW0) */
5465
5465
+
{0x34, AC_VERB_SET_CONNECT_SEL, 0},
5466
5466
+
{0x35, AC_VERB_SET_CONNECT_SEL, 0},
5467
5467
+
{0x38, AC_VERB_SET_CONNECT_SEL, 0},
5468
5468
+
{0x3c, AC_VERB_SET_CONNECT_SEL, 0},
5469
5469
+
5470
5470
+
/* set PW0 index=0 (MW0) */
5471
5471
+
{0x24, AC_VERB_SET_CONNECT_SEL, 0},
5472
5472
+
5473
5473
+
/* Enable AOW0 to MW9 */
5474
5474
+
{0x1, 0xfb8, 0x88},
5475
5475
+
{ }
5476
5476
+
};
5477
5477
+
5478
5478
+
5479
5479
+
static const struct hda_verb vt2002P_uniwill_init_verbs[] = {
5341
5480
{0x25, AC_VERB_SET_UNSOLICITED_ENABLE,
5342
5481
AC_USRSP_EN | VIA_JACK_EVENT | VIA_BIND_HP_EVENT},
5343
5482
{0x26, AC_VERB_SET_UNSOLICITED_ENABLE,
···
5398
5435
{0x2b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | VIA_JACK_EVENT},
5399
5436
{ }
5400
5437
};
5438
5438
+
static const struct hda_verb vt1802_uniwill_init_verbs[] = {
5439
5439
+
{0x25, AC_VERB_SET_UNSOLICITED_ENABLE,
5440
5440
+
AC_USRSP_EN | VIA_JACK_EVENT | VIA_BIND_HP_EVENT},
5441
5441
+
{0x28, AC_VERB_SET_UNSOLICITED_ENABLE,
5442
5442
+
AC_USRSP_EN | VIA_JACK_EVENT | VIA_BIND_HP_EVENT},
5443
5443
+
{0x29, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | VIA_JACK_EVENT},
5444
5444
+
{0x2a, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | VIA_JACK_EVENT},
5445
5445
+
{0x2b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | VIA_JACK_EVENT},
5446
5446
+
{ }
5447
5447
+
};
5401
5448
5402
5402
-
static struct hda_pcm_stream vt2002P_pcm_analog_playback = {
5449
5449
+
static const struct hda_pcm_stream vt2002P_pcm_analog_playback = {
5403
5450
.substreams = 2,
5404
5451
.channels_min = 2,
5405
5452
.channels_max = 2,
···
5422
5449
},
5423
5450
};
5424
5451
5425
5425
-
static struct hda_pcm_stream vt2002P_pcm_analog_capture = {
5452
5452
+
static const struct hda_pcm_stream vt2002P_pcm_analog_capture = {
5426
5453
.substreams = 2,
5427
5454
.channels_min = 2,
5428
5455
.channels_max = 2,
···
5435
5462
},
5436
5463
};
5437
5464
5438
5438
-
static struct hda_pcm_stream vt2002P_pcm_digital_playback = {
5465
5465
+
static const struct hda_pcm_stream vt2002P_pcm_digital_playback = {
5439
5466
.substreams = 1,
5440
5467
.channels_min = 2,
5441
5468
.channels_max = 2,
···
5455
5482
spec->multiout.num_dacs = 1;
5456
5483
spec->multiout.dac_nids = spec->private_dac_nids;
5457
5484
if (cfg->line_out_pins[0])
5458
5458
-
spec->multiout.dac_nids[0] = 0x8;
5485
5485
+
spec->private_dac_nids[0] = 0x8;
5459
5486
return 0;
5460
5487
}
5461
5488
···
5464
5491
const struct auto_pin_cfg *cfg)
5465
5492
{
5466
5493
int err;
5494
5494
+
hda_nid_t sw_nid;
5467
5495
5468
5496
if (!cfg->line_out_pins[0])
5469
5497
return -1;
5470
5498
5499
5499
+
if (spec->codec_type == VT1802)
5500
5500
+
sw_nid = 0x28;
5501
5501
+
else
5502
5502
+
sw_nid = 0x26;
5471
5503
5472
5504
/* Line-Out: PortE */
5473
5505
err = via_add_control(spec, VIA_CTL_WIDGET_VOL,
···
5482
5504
return err;
5483
5505
err = via_add_control(spec, VIA_CTL_WIDGET_BIND_PIN_MUTE,
5484
5506
"Master Front Playback Switch",
5485
5485
-
HDA_COMPOSE_AMP_VAL(0x26, 3, 0, HDA_OUTPUT));
5507
5507
+
HDA_COMPOSE_AMP_VAL(sw_nid, 3, 0, HDA_OUTPUT));
5486
5508
if (err < 0)
5487
5509
return err;
5488
5510
···
5522
5544
{
5523
5545
struct via_spec *spec = codec->spec;
5524
5546
struct hda_input_mux *imux = &spec->private_imux[0];
5525
5525
-
static hda_nid_t pin_idxs[] = { 0x2b, 0x2a, 0x29, 0xff };
5547
5547
+
static const hda_nid_t pin_idxs[] = { 0x2b, 0x2a, 0x29, 0xff };
5526
5548
int err;
5527
5549
5528
5550
err = vt_auto_create_analog_input_ctls(codec, cfg, 0x21, pin_idxs,
···
5583
5605
}
5584
5606
5585
5607
#ifdef CONFIG_SND_HDA_POWER_SAVE
5586
5586
-
static struct hda_amp_list vt2002P_loopbacks[] = {
5608
5608
+
static const struct hda_amp_list vt2002P_loopbacks[] = {
5587
5609
{ 0x21, HDA_INPUT, 0 },
5588
5610
{ 0x21, HDA_INPUT, 1 },
5589
5611
{ 0x21, HDA_INPUT, 2 },
···
5591
5613
};
5592
5614
#endif
5593
5615
5616
5616
+
static void set_widgets_power_state_vt2002P(struct hda_codec *codec)
5617
5617
+
{
5618
5618
+
struct via_spec *spec = codec->spec;
5619
5619
+
int imux_is_smixer;
5620
5620
+
unsigned int parm;
5621
5621
+
unsigned int present;
5622
5622
+
/* MUX9 (1eh) = stereo mixer */
5623
5623
+
imux_is_smixer =
5624
5624
+
snd_hda_codec_read(codec, 0x1e, 0, AC_VERB_GET_CONNECT_SEL, 0x00) == 3;
5625
5625
+
/* inputs */
5626
5626
+
/* PW 5/6/7 (29h/2ah/2bh) */
5627
5627
+
parm = AC_PWRST_D3;
5628
5628
+
set_pin_power_state(codec, 0x29, &parm);
5629
5629
+
set_pin_power_state(codec, 0x2a, &parm);
5630
5630
+
set_pin_power_state(codec, 0x2b, &parm);
5631
5631
+
parm = AC_PWRST_D0;
5632
5632
+
/* MUX9/10 (1eh/1fh), AIW 0/1 (10h/11h) */
5633
5633
+
snd_hda_codec_write(codec, 0x1e, 0, AC_VERB_SET_POWER_STATE, parm);
5634
5634
+
snd_hda_codec_write(codec, 0x1f, 0, AC_VERB_SET_POWER_STATE, parm);
5635
5635
+
snd_hda_codec_write(codec, 0x10, 0, AC_VERB_SET_POWER_STATE, parm);
5636
5636
+
snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_POWER_STATE, parm);
5637
5637
+
5638
5638
+
/* outputs */
5639
5639
+
/* AOW0 (8h)*/
5640
5640
+
snd_hda_codec_write(codec, 0x8, 0, AC_VERB_SET_POWER_STATE, parm);
5641
5641
+
5642
5642
+
if (spec->codec_type == VT1802) {
5643
5643
+
/* PW4 (28h), MW4 (18h), MUX4(38h) */
5644
5644
+
parm = AC_PWRST_D3;
5645
5645
+
set_pin_power_state(codec, 0x28, &parm);
5646
5646
+
snd_hda_codec_write(codec, 0x18, 0,
5647
5647
+
AC_VERB_SET_POWER_STATE, parm);
5648
5648
+
snd_hda_codec_write(codec, 0x38, 0,
5649
5649
+
AC_VERB_SET_POWER_STATE, parm);
5650
5650
+
} else {
5651
5651
+
/* PW4 (26h), MW4 (1ch), MUX4(37h) */
5652
5652
+
parm = AC_PWRST_D3;
5653
5653
+
set_pin_power_state(codec, 0x26, &parm);
5654
5654
+
snd_hda_codec_write(codec, 0x1c, 0,
5655
5655
+
AC_VERB_SET_POWER_STATE, parm);
5656
5656
+
snd_hda_codec_write(codec, 0x37, 0,
5657
5657
+
AC_VERB_SET_POWER_STATE, parm);
5658
5658
+
}
5659
5659
+
5660
5660
+
if (spec->codec_type == VT1802) {
5661
5661
+
/* PW1 (25h), MW1 (15h), MUX1(35h), AOW1 (9h) */
5662
5662
+
parm = AC_PWRST_D3;
5663
5663
+
set_pin_power_state(codec, 0x25, &parm);
5664
5664
+
snd_hda_codec_write(codec, 0x15, 0,
5665
5665
+
AC_VERB_SET_POWER_STATE, parm);
5666
5666
+
snd_hda_codec_write(codec, 0x35, 0,
5667
5667
+
AC_VERB_SET_POWER_STATE, parm);
5668
5668
+
} else {
5669
5669
+
/* PW1 (25h), MW1 (19h), MUX1(35h), AOW1 (9h) */
5670
5670
+
parm = AC_PWRST_D3;
5671
5671
+
set_pin_power_state(codec, 0x25, &parm);
5672
5672
+
snd_hda_codec_write(codec, 0x19, 0,
5673
5673
+
AC_VERB_SET_POWER_STATE, parm);
5674
5674
+
snd_hda_codec_write(codec, 0x35, 0,
5675
5675
+
AC_VERB_SET_POWER_STATE, parm);
5676
5676
+
}
5677
5677
+
5678
5678
+
if (spec->hp_independent_mode)
5679
5679
+
snd_hda_codec_write(codec, 0x9, 0,
5680
5680
+
AC_VERB_SET_POWER_STATE, AC_PWRST_D0);
5681
5681
+
5682
5682
+
/* Class-D */
5683
5683
+
/* PW0 (24h), MW0(18h/14h), MUX0(34h) */
5684
5684
+
present = snd_hda_jack_detect(codec, 0x25);
5685
5685
+
5686
5686
+
parm = AC_PWRST_D3;
5687
5687
+
set_pin_power_state(codec, 0x24, &parm);
5688
5688
+
parm = present ? AC_PWRST_D3 : AC_PWRST_D0;
5689
5689
+
if (spec->codec_type == VT1802)
5690
5690
+
snd_hda_codec_write(codec, 0x14, 0,
5691
5691
+
AC_VERB_SET_POWER_STATE, parm);
5692
5692
+
else
5693
5693
+
snd_hda_codec_write(codec, 0x18, 0,
5694
5694
+
AC_VERB_SET_POWER_STATE, parm);
5695
5695
+
snd_hda_codec_write(codec, 0x34, 0, AC_VERB_SET_POWER_STATE, parm);
5696
5696
+
5697
5697
+
/* Mono Out */
5698
5698
+
present = snd_hda_jack_detect(codec, 0x26);
5699
5699
+
5700
5700
+
parm = present ? AC_PWRST_D3 : AC_PWRST_D0;
5701
5701
+
if (spec->codec_type == VT1802) {
5702
5702
+
/* PW15 (33h), MW8(1ch), MUX8(3ch) */
5703
5703
+
snd_hda_codec_write(codec, 0x33, 0,
5704
5704
+
AC_VERB_SET_POWER_STATE, parm);
5705
5705
+
snd_hda_codec_write(codec, 0x1c, 0,
5706
5706
+
AC_VERB_SET_POWER_STATE, parm);
5707
5707
+
snd_hda_codec_write(codec, 0x3c, 0,
5708
5708
+
AC_VERB_SET_POWER_STATE, parm);
5709
5709
+
} else {
5710
5710
+
/* PW15 (31h), MW8(17h), MUX8(3bh) */
5711
5711
+
snd_hda_codec_write(codec, 0x31, 0,
5712
5712
+
AC_VERB_SET_POWER_STATE, parm);
5713
5713
+
snd_hda_codec_write(codec, 0x17, 0,
5714
5714
+
AC_VERB_SET_POWER_STATE, parm);
5715
5715
+
snd_hda_codec_write(codec, 0x3b, 0,
5716
5716
+
AC_VERB_SET_POWER_STATE, parm);
5717
5717
+
}
5718
5718
+
/* MW9 (21h) */
5719
5719
+
if (imux_is_smixer || !is_aa_path_mute(codec))
5720
5720
+
snd_hda_codec_write(codec, 0x21, 0,
5721
5721
+
AC_VERB_SET_POWER_STATE, AC_PWRST_D0);
5722
5722
+
else
5723
5723
+
snd_hda_codec_write(codec, 0x21, 0,
5724
5724
+
AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
5725
5725
+
}
5594
5726
5595
5727
/* patch for vt2002P */
5596
5728
static int patch_vt2002P(struct hda_codec *codec)
···
5723
5635
"from BIOS. Using genenic mode...\n");
5724
5636
}
5725
5637
5726
5726
-
spec->init_verbs[spec->num_iverbs++] = vt2002P_volume_init_verbs;
5727
5727
-
spec->init_verbs[spec->num_iverbs++] = vt2002P_uniwill_init_verbs;
5638
5638
+
if (spec->codec_type == VT1802)
5639
5639
+
spec->init_verbs[spec->num_iverbs++] =
5640
5640
+
vt1802_volume_init_verbs;
5641
5641
+
else
5642
5642
+
spec->init_verbs[spec->num_iverbs++] =
5643
5643
+
vt2002P_volume_init_verbs;
5728
5644
5729
5729
-
spec->stream_name_analog = "VT2002P Analog";
5645
5645
+
if (spec->codec_type == VT1802)
5646
5646
+
spec->init_verbs[spec->num_iverbs++] =
5647
5647
+
vt1802_uniwill_init_verbs;
5648
5648
+
else
5649
5649
+
spec->init_verbs[spec->num_iverbs++] =
5650
5650
+
vt2002P_uniwill_init_verbs;
5651
5651
+
5652
5652
+
if (spec->codec_type == VT1802)
5653
5653
+
spec->stream_name_analog = "VT1802 Analog";
5654
5654
+
else
5655
5655
+
spec->stream_name_analog = "VT2002P Analog";
5730
5656
spec->stream_analog_playback = &vt2002P_pcm_analog_playback;
5731
5657
spec->stream_analog_capture = &vt2002P_pcm_analog_capture;
5732
5658
5733
5733
-
spec->stream_name_digital = "VT2002P Digital";
5659
5659
+
if (spec->codec_type == VT1802)
5660
5660
+
spec->stream_name_digital = "VT1802 Digital";
5661
5661
+
else
5662
5662
+
spec->stream_name_digital = "VT2002P Digital";
5734
5663
spec->stream_digital_playback = &vt2002P_pcm_digital_playback;
5735
5664
5736
5665
if (!spec->adc_nids && spec->input_mux) {
···
5769
5664
spec->loopback.amplist = vt2002P_loopbacks;
5770
5665
#endif
5771
5666
5667
5667
+
spec->set_widgets_power_state = set_widgets_power_state_vt2002P;
5772
5668
return 0;
5773
5669
}
5774
5670
5775
5671
/* for vt1812 */
5776
5672
5777
5673
/* capture mixer elements */
5778
5778
-
static struct snd_kcontrol_new vt1812_capture_mixer[] = {
5674
5674
+
static const struct snd_kcontrol_new vt1812_capture_mixer[] = {
5779
5675
HDA_CODEC_VOLUME("Capture Volume", 0x10, 0x0, HDA_INPUT),
5780
5676
HDA_CODEC_MUTE("Capture Switch", 0x10, 0x0, HDA_INPUT),
5781
5677
HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x11, 0x0, HDA_INPUT),
···
5798
5692
{ } /* end */
5799
5693
};
5800
5694
5801
5801
-
static struct hda_verb vt1812_volume_init_verbs[] = {
5695
5695
+
static const struct hda_verb vt1812_volume_init_verbs[] = {
5802
5696
/*
5803
5697
* Unmute ADC0-1 and set the default input to mic-in
5804
5698
*/
···
5851
5745
};
5852
5746
5853
5747
5854
5854
-
static struct hda_verb vt1812_uniwill_init_verbs[] = {
5748
5748
+
static const struct hda_verb vt1812_uniwill_init_verbs[] = {
5855
5749
{0x33, AC_VERB_SET_UNSOLICITED_ENABLE,
5856
5750
AC_USRSP_EN | VIA_JACK_EVENT | VIA_BIND_HP_EVENT},
5857
5751
{0x25, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | VIA_JACK_EVENT },
···
5863
5757
{ }
5864
5758
};
5865
5759
5866
5866
-
static struct hda_pcm_stream vt1812_pcm_analog_playback = {
5760
5760
+
static const struct hda_pcm_stream vt1812_pcm_analog_playback = {
5867
5761
.substreams = 2,
5868
5762
.channels_min = 2,
5869
5763
.channels_max = 2,
···
5876
5770
},
5877
5771
};
5878
5772
5879
5879
-
static struct hda_pcm_stream vt1812_pcm_analog_capture = {
5773
5773
+
static const struct hda_pcm_stream vt1812_pcm_analog_capture = {
5880
5774
.substreams = 2,
5881
5775
.channels_min = 2,
5882
5776
.channels_max = 2,
···
5889
5783
},
5890
5784
};
5891
5785
5892
5892
-
static struct hda_pcm_stream vt1812_pcm_digital_playback = {
5786
5786
+
static const struct hda_pcm_stream vt1812_pcm_digital_playback = {
5893
5787
.substreams = 1,
5894
5788
.channels_min = 2,
5895
5789
.channels_max = 2,
···
5908
5802
spec->multiout.num_dacs = 1;
5909
5803
spec->multiout.dac_nids = spec->private_dac_nids;
5910
5804
if (cfg->line_out_pins[0])
5911
5911
-
spec->multiout.dac_nids[0] = 0x8;
5805
5805
+
spec->private_dac_nids[0] = 0x8;
5912
5806
return 0;
5913
5807
}
5914
5808
···
5971
5865
{
5972
5866
struct via_spec *spec = codec->spec;
5973
5867
struct hda_input_mux *imux = &spec->private_imux[0];
5974
5974
-
static hda_nid_t pin_idxs[] = { 0x2b, 0x2a, 0x29, 0, 0, 0xff };
5868
5868
+
static const hda_nid_t pin_idxs[] = { 0x2b, 0x2a, 0x29, 0, 0, 0xff };
5975
5869
int err;
5976
5870
5977
5871
err = vt_auto_create_analog_input_ctls(codec, cfg, 0x21, pin_idxs,
···
6033
5927
}
6034
5928
6035
5929
#ifdef CONFIG_SND_HDA_POWER_SAVE
6036
6036
-
static struct hda_amp_list vt1812_loopbacks[] = {
5930
5930
+
static const struct hda_amp_list vt1812_loopbacks[] = {
6037
5931
{ 0x21, HDA_INPUT, 0 },
6038
5932
{ 0x21, HDA_INPUT, 1 },
6039
5933
{ 0x21, HDA_INPUT, 2 },
···
6041
5935
};
6042
5936
#endif
6043
5937
5938
5938
+
static void set_widgets_power_state_vt1812(struct hda_codec *codec)
5939
5939
+
{
5940
5940
+
struct via_spec *spec = codec->spec;
5941
5941
+
int imux_is_smixer =
5942
5942
+
snd_hda_codec_read(codec, 0x13, 0, AC_VERB_GET_CONNECT_SEL, 0x00) == 3;
5943
5943
+
unsigned int parm;
5944
5944
+
unsigned int present;
5945
5945
+
/* MUX10 (1eh) = stereo mixer */
5946
5946
+
imux_is_smixer =
5947
5947
+
snd_hda_codec_read(codec, 0x1e, 0, AC_VERB_GET_CONNECT_SEL, 0x00) == 5;
5948
5948
+
/* inputs */
5949
5949
+
/* PW 5/6/7 (29h/2ah/2bh) */
5950
5950
+
parm = AC_PWRST_D3;
5951
5951
+
set_pin_power_state(codec, 0x29, &parm);
5952
5952
+
set_pin_power_state(codec, 0x2a, &parm);
5953
5953
+
set_pin_power_state(codec, 0x2b, &parm);
5954
5954
+
parm = AC_PWRST_D0;
5955
5955
+
/* MUX10/11 (1eh/1fh), AIW 0/1 (10h/11h) */
5956
5956
+
snd_hda_codec_write(codec, 0x1e, 0, AC_VERB_SET_POWER_STATE, parm);
5957
5957
+
snd_hda_codec_write(codec, 0x1f, 0, AC_VERB_SET_POWER_STATE, parm);
5958
5958
+
snd_hda_codec_write(codec, 0x10, 0, AC_VERB_SET_POWER_STATE, parm);
5959
5959
+
snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_POWER_STATE, parm);
5960
5960
+
5961
5961
+
/* outputs */
5962
5962
+
/* AOW0 (8h)*/
5963
5963
+
snd_hda_codec_write(codec, 0x8, 0,
5964
5964
+
AC_VERB_SET_POWER_STATE, AC_PWRST_D0);
5965
5965
+
5966
5966
+
/* PW4 (28h), MW4 (18h), MUX4(38h) */
5967
5967
+
parm = AC_PWRST_D3;
5968
5968
+
set_pin_power_state(codec, 0x28, &parm);
5969
5969
+
snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_POWER_STATE, parm);
5970
5970
+
snd_hda_codec_write(codec, 0x38, 0, AC_VERB_SET_POWER_STATE, parm);
5971
5971
+
5972
5972
+
/* PW1 (25h), MW1 (15h), MUX1(35h), AOW1 (9h) */
5973
5973
+
parm = AC_PWRST_D3;
5974
5974
+
set_pin_power_state(codec, 0x25, &parm);
5975
5975
+
snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_POWER_STATE, parm);
5976
5976
+
snd_hda_codec_write(codec, 0x35, 0, AC_VERB_SET_POWER_STATE, parm);
5977
5977
+
if (spec->hp_independent_mode)
5978
5978
+
snd_hda_codec_write(codec, 0x9, 0,
5979
5979
+
AC_VERB_SET_POWER_STATE, AC_PWRST_D0);
5980
5980
+
5981
5981
+
/* Internal Speaker */
5982
5982
+
/* PW0 (24h), MW0(14h), MUX0(34h) */
5983
5983
+
present = snd_hda_jack_detect(codec, 0x25);
5984
5984
+
5985
5985
+
parm = AC_PWRST_D3;
5986
5986
+
set_pin_power_state(codec, 0x24, &parm);
5987
5987
+
if (present) {
5988
5988
+
snd_hda_codec_write(codec, 0x14, 0,
5989
5989
+
AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
5990
5990
+
snd_hda_codec_write(codec, 0x34, 0,
5991
5991
+
AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
5992
5992
+
} else {
5993
5993
+
snd_hda_codec_write(codec, 0x14, 0,
5994
5994
+
AC_VERB_SET_POWER_STATE, AC_PWRST_D0);
5995
5995
+
snd_hda_codec_write(codec, 0x34, 0,
5996
5996
+
AC_VERB_SET_POWER_STATE, AC_PWRST_D0);
5997
5997
+
}
5998
5998
+
5999
5999
+
6000
6000
+
/* Mono Out */
6001
6001
+
/* PW13 (31h), MW13(1ch), MUX13(3ch), MW14(3eh) */
6002
6002
+
present = snd_hda_jack_detect(codec, 0x28);
6003
6003
+
6004
6004
+
parm = AC_PWRST_D3;
6005
6005
+
set_pin_power_state(codec, 0x31, &parm);
6006
6006
+
if (present) {
6007
6007
+
snd_hda_codec_write(codec, 0x1c, 0,
6008
6008
+
AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
6009
6009
+
snd_hda_codec_write(codec, 0x3c, 0,
6010
6010
+
AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
6011
6011
+
snd_hda_codec_write(codec, 0x3e, 0,
6012
6012
+
AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
6013
6013
+
} else {
6014
6014
+
snd_hda_codec_write(codec, 0x1c, 0,
6015
6015
+
AC_VERB_SET_POWER_STATE, AC_PWRST_D0);
6016
6016
+
snd_hda_codec_write(codec, 0x3c, 0,
6017
6017
+
AC_VERB_SET_POWER_STATE, AC_PWRST_D0);
6018
6018
+
snd_hda_codec_write(codec, 0x3e, 0,
6019
6019
+
AC_VERB_SET_POWER_STATE, AC_PWRST_D0);
6020
6020
+
}
6021
6021
+
6022
6022
+
/* PW15 (33h), MW15 (1dh), MUX15(3dh) */
6023
6023
+
parm = AC_PWRST_D3;
6024
6024
+
set_pin_power_state(codec, 0x33, &parm);
6025
6025
+
snd_hda_codec_write(codec, 0x1d, 0, AC_VERB_SET_POWER_STATE, parm);
6026
6026
+
snd_hda_codec_write(codec, 0x3d, 0, AC_VERB_SET_POWER_STATE, parm);
6027
6027
+
6028
6028
+
}
6044
6029
6045
6030
/* patch for vt1812 */
6046
6031
static int patch_vt1812(struct hda_codec *codec)
···
6185
5988
spec->loopback.amplist = vt1812_loopbacks;
6186
5989
#endif
6187
5990
5991
5991
+
spec->set_widgets_power_state = set_widgets_power_state_vt1812;
6188
5992
return 0;
6189
5993
}
6190
5994
6191
5995
/*
6192
5996
* patch entries
6193
5997
*/
6194
6194
-
static struct hda_codec_preset snd_hda_preset_via[] = {
5998
5998
+
static const struct hda_codec_preset snd_hda_preset_via[] = {
6195
5999
{ .id = 0x11061708, .name = "VT1708", .patch = patch_vt1708},
6196
6000
{ .id = 0x11061709, .name = "VT1708", .patch = patch_vt1708},
6197
6001
{ .id = 0x1106170a, .name = "VT1708", .patch = patch_vt1708},
···
6237
6039
.patch = patch_vt1708S},
6238
6040
{ .id = 0x11063397, .name = "VT1708S",
6239
6041
.patch = patch_vt1708S},
6240
6240
-
{ .id = 0x11064397, .name = "VT1708S",
6042
6042
+
{ .id = 0x11064397, .name = "VT1705",
6241
6043
.patch = patch_vt1708S},
6242
6044
{ .id = 0x11065397, .name = "VT1708S",
6243
6045
.patch = patch_vt1708S},
···
6278
6080
{ .id = 0x11060448, .name = "VT1812", .patch = patch_vt1812},
6279
6081
{ .id = 0x11060440, .name = "VT1818S",
6280
6082
.patch = patch_vt1708S},
6083
6083
+
{ .id = 0x11060446, .name = "VT1802",
6084
6084
+
.patch = patch_vt2002P},
6085
6085
+
{ .id = 0x11068446, .name = "VT1802",
6086
6086
+
.patch = patch_vt2002P},
6281
6087
{} /* terminator */
6282
6088
};
6283
6089