~ubuntu-branches/debian/wheezy/linux-2.6/wheezy

« back to all changes in this revision

Viewing changes to sound/pci/hda/patch_conexant.c

  • Committer: Bazaar Package Importer
  • Author(s): Ben Hutchings, Ben Hutchings, Aurelien Jarno
  • Date: 2011-06-07 12:14:05 UTC
  • mfrom: (43.1.9 sid)
  • Revision ID: james.westby@ubuntu.com-20110607121405-i3h1rd7nrnd2b73h
Tags: 2.6.39-2
[ Ben Hutchings ]
* [x86] Enable BACKLIGHT_APPLE, replacing BACKLIGHT_MBP_NVIDIA
  (Closes: #627492)
* cgroups: Disable memory resource controller by default. Allow it
  to be enabled using kernel parameter 'cgroup_enable=memory'.
* rt2800usb: Enable support for more USB devices including
  Linksys WUSB600N (Closes: #596626) (this change was accidentally
  omitted from 2.6.39-1)
* [x86] Remove Celeron from list of processors supporting PAE. Most
  'Celeron M' models do not.
* Update debconf template translations:
  - Swedish (Martin Bagge) (Closes: #628932)
  - French (David Prévot) (Closes: #628191)
* aufs: Update for 2.6.39 (Closes: #627837)
* Add stable 2.6.39.1, including:
  - ext4: dont set PageUptodate in ext4_end_bio()
  - pata_cmd64x: fix boot crash on parisc (Closes: #622997, #622745)
  - ext3: Fix fs corruption when make_indexed_dir() fails
  - netfilter: nf_ct_sip: validate Content-Length in TCP SIP messages
  - sctp: fix race between sctp_bind_addr_free() and
    sctp_bind_addr_conflict()
  - sctp: fix memory leak of the ASCONF queue when free asoc
  - md/bitmap: fix saving of events_cleared and other state
  - cdc_acm: Fix oops when Droids MuIn LCD is connected
  - cx88: Fix conversion from BKL to fine-grained locks (Closes: #619827)
  - keys: Set cred->user_ns in key_replace_session_keyring (CVE-2011-2184)
  - tmpfs: fix race between truncate and writepage
  - nfs41: Correct offset for LAYOUTCOMMIT
  - xen/mmu: fix a race window causing leave_mm BUG()
  - ext4: fix possible use-after-free in ext4_remove_li_request()
  For the complete list of changes, see:
   http://www.kernel.org/pub/linux/kernel/v2.6/ChangeLog-2.6.39.1
* Bump ABI to 2
* netfilter: Enable IP_SET, IP_SET_BITMAP_IP, IP_SET_BITMAP_IPMAC,
  IP_SET_BITMAP_PORT, IP_SET_HASH_IP, IP_SET_HASH_IPPORT,
  IP_SET_HASH_IPPORTIP, IP_SET_HASH_IPPORTNET, IP_SET_HASH_NET,
  IP_SET_HASH_NETPORT, IP_SET_LIST_SET, NETFILTER_XT_SET as modules
  (Closes: #629401)

[ Aurelien Jarno ]
* [mipsel/loongson-2f] Disable_SCSI_LPFC to workaround GCC ICE.

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
#define AUTO_MIC_PORTB          (1 << 1)
50
50
#define AUTO_MIC_PORTC          (1 << 2)
51
51
 
52
 
struct conexant_jack {
53
 
 
54
 
        hda_nid_t nid;
55
 
        int type;
56
 
        struct snd_jack *jack;
57
 
 
58
 
};
59
 
 
60
52
struct pin_dac_pair {
61
53
        hda_nid_t pin;
62
54
        hda_nid_t dac;
111
103
 
112
104
        unsigned int spdif_route;
113
105
 
114
 
        /* jack detection */
115
 
        struct snd_array jacks;
116
 
 
117
106
        /* dynamic controls, init_verbs and input_mux */
118
107
        struct auto_pin_cfg autocfg;
119
108
        struct hda_input_mux private_imux;
393
382
                                     &spec->cur_mux[adc_idx]);
394
383
}
395
384
 
396
 
#ifdef CONFIG_SND_HDA_INPUT_JACK
397
 
static void conexant_free_jack_priv(struct snd_jack *jack)
398
 
{
399
 
        struct conexant_jack *jacks = jack->private_data;
400
 
        jacks->nid = 0;
401
 
        jacks->jack = NULL;
402
 
}
403
 
 
404
 
static int conexant_add_jack(struct hda_codec *codec,
405
 
                hda_nid_t nid, int type)
406
 
{
407
 
        struct conexant_spec *spec;
408
 
        struct conexant_jack *jack;
409
 
        const char *name;
410
 
        int i, err;
411
 
 
412
 
        spec = codec->spec;
413
 
        snd_array_init(&spec->jacks, sizeof(*jack), 32);
414
 
 
415
 
        jack = spec->jacks.list;
416
 
        for (i = 0; i < spec->jacks.used; i++, jack++)
417
 
                if (jack->nid == nid)
418
 
                        return 0 ; /* already present */
419
 
 
420
 
        jack = snd_array_new(&spec->jacks);
421
 
        name = (type == SND_JACK_HEADPHONE) ? "Headphone" : "Mic" ;
422
 
 
423
 
        if (!jack)
424
 
                return -ENOMEM;
425
 
 
426
 
        jack->nid = nid;
427
 
        jack->type = type;
428
 
 
429
 
        err = snd_jack_new(codec->bus->card, name, type, &jack->jack);
430
 
        if (err < 0)
431
 
                return err;
432
 
        jack->jack->private_data = jack;
433
 
        jack->jack->private_free = conexant_free_jack_priv;
434
 
        return 0;
435
 
}
436
 
 
437
 
static void conexant_report_jack(struct hda_codec *codec, hda_nid_t nid)
438
 
{
439
 
        struct conexant_spec *spec = codec->spec;
440
 
        struct conexant_jack *jacks = spec->jacks.list;
441
 
 
442
 
        if (jacks) {
443
 
                int i;
444
 
                for (i = 0; i < spec->jacks.used; i++) {
445
 
                        if (jacks->nid == nid) {
446
 
                                unsigned int present;
447
 
                                present = snd_hda_jack_detect(codec, nid);
448
 
 
449
 
                                present = (present) ? jacks->type : 0 ;
450
 
 
451
 
                                snd_jack_report(jacks->jack,
452
 
                                                present);
453
 
                        }
454
 
                        jacks++;
455
 
                }
456
 
        }
457
 
}
458
 
 
459
385
static int conexant_init_jacks(struct hda_codec *codec)
460
386
{
 
387
#ifdef CONFIG_SND_HDA_INPUT_JACK
461
388
        struct conexant_spec *spec = codec->spec;
462
389
        int i;
463
390
 
469
396
                        int err = 0;
470
397
                        switch (hv->param ^ AC_USRSP_EN) {
471
398
                        case CONEXANT_HP_EVENT:
472
 
                                err = conexant_add_jack(codec, hv->nid,
473
 
                                                SND_JACK_HEADPHONE);
474
 
                                conexant_report_jack(codec, hv->nid);
 
399
                                err = snd_hda_input_jack_add(codec, hv->nid,
 
400
                                                SND_JACK_HEADPHONE, NULL);
 
401
                                snd_hda_input_jack_report(codec, hv->nid);
475
402
                                break;
476
403
                        case CXT5051_PORTC_EVENT:
477
404
                        case CONEXANT_MIC_EVENT:
478
 
                                err = conexant_add_jack(codec, hv->nid,
479
 
                                                SND_JACK_MICROPHONE);
480
 
                                conexant_report_jack(codec, hv->nid);
 
405
                                err = snd_hda_input_jack_add(codec, hv->nid,
 
406
                                                SND_JACK_MICROPHONE, NULL);
 
407
                                snd_hda_input_jack_report(codec, hv->nid);
481
408
                                break;
482
409
                        }
483
410
                        if (err < 0)
485
412
                        ++hv;
486
413
                }
487
414
        }
488
 
        return 0;
489
 
 
490
 
}
491
 
#else
492
 
static inline void conexant_report_jack(struct hda_codec *codec, hda_nid_t nid)
493
 
{
494
 
}
495
 
 
496
 
static inline int conexant_init_jacks(struct hda_codec *codec)
497
 
{
498
 
        return 0;
499
 
}
500
 
#endif
 
415
#endif /* CONFIG_SND_HDA_INPUT_JACK */
 
416
        return 0;
 
417
}
501
418
 
502
419
static int conexant_init(struct hda_codec *codec)
503
420
{
511
428
 
512
429
static void conexant_free(struct hda_codec *codec)
513
430
{
514
 
#ifdef CONFIG_SND_HDA_INPUT_JACK
515
 
        struct conexant_spec *spec = codec->spec;
516
 
        if (spec->jacks.list) {
517
 
                struct conexant_jack *jacks = spec->jacks.list;
518
 
                int i;
519
 
                for (i = 0; i < spec->jacks.used; i++, jacks++) {
520
 
                        if (jacks->jack)
521
 
                                snd_device_free(codec->bus->card, jacks->jack);
522
 
                }
523
 
                snd_array_free(&spec->jacks);
524
 
        }
525
 
#endif
 
431
        snd_hda_input_jack_free(codec);
526
432
        snd_hda_detach_beep_device(codec);
527
433
        kfree(codec->spec);
528
434
}
1787
1693
                cxt5051_portc_automic(codec);
1788
1694
                break;
1789
1695
        }
1790
 
        conexant_report_jack(codec, nid);
 
1696
        snd_hda_input_jack_report(codec, nid);
1791
1697
}
1792
1698
 
1793
1699
static struct snd_kcontrol_new cxt5051_playback_mixers[] = {
1959
1865
        snd_hda_codec_write(codec, nid, 0,
1960
1866
                            AC_VERB_SET_UNSOLICITED_ENABLE,
1961
1867
                            AC_USRSP_EN | event);
1962
 
#ifdef CONFIG_SND_HDA_INPUT_JACK
1963
 
        conexant_add_jack(codec, nid, SND_JACK_MICROPHONE);
1964
 
        conexant_report_jack(codec, nid);
1965
 
#endif
 
1868
        snd_hda_input_jack_add(codec, nid, SND_JACK_MICROPHONE, NULL);
 
1869
        snd_hda_input_jack_report(codec, nid);
1966
1870
}
1967
1871
 
1968
1872
static struct hda_verb cxt5051_ideapad_init_verbs[] = {
3130
3034
        SND_PCI_QUIRK(0x17aa, 0x21c5, "Thinkpad Edge 13", CXT5066_THINKPAD),
3131
3035
        SND_PCI_QUIRK(0x17aa, 0x21c6, "Thinkpad Edge 13", CXT5066_ASUS),
3132
3036
        SND_PCI_QUIRK(0x17aa, 0x215e, "Lenovo Thinkpad", CXT5066_THINKPAD),
 
3037
        SND_PCI_QUIRK(0x17aa, 0x21da, "Lenovo X220", CXT5066_THINKPAD),
 
3038
        SND_PCI_QUIRK(0x17aa, 0x21db, "Lenovo X220-tablet", CXT5066_THINKPAD),
3133
3039
        SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo G560", CXT5066_ASUS),
3134
3040
        SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", CXT5066_IDEAPAD), /* Fallback for Lenovos without dock mic */
3135
3041
        {}
3477
3383
        switch (res >> 26) {
3478
3384
        case CONEXANT_HP_EVENT:
3479
3385
                cx_auto_hp_automute(codec);
3480
 
                conexant_report_jack(codec, nid);
 
3386
                snd_hda_input_jack_report(codec, nid);
3481
3387
                break;
3482
3388
        case CONEXANT_MIC_EVENT:
3483
3389
                cx_auto_automic(codec);
3484
 
                conexant_report_jack(codec, nid);
 
3390
                snd_hda_input_jack_report(codec, nid);
3485
3391
                break;
3486
3392
        }
3487
3393
}