diff options
author | Takashi Iwai <tiwai@suse.de> | 2011-11-10 13:52:08 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2011-11-10 13:52:08 -0500 |
commit | d938e66003c9ccc6c0ab10fa31ee23cf27574d66 (patch) | |
tree | c4bc45c786e62f25febf10fc9568ebe550802504 /sound | |
parent | bcca5fa6d786755abe91f5856c9647a2ca2a51b6 (diff) | |
parent | 43df2a57b773596cd0bdd2316889ff9653121015 (diff) |
Merge branch 'fix/misc' into for-linus
Diffstat (limited to 'sound')
-rw-r--r-- | sound/core/vmaster.c | 18 | ||||
-rw-r--r-- | sound/pci/hda/hda_codec.c | 64 | ||||
-rw-r--r-- | sound/pci/hda/hda_codec.h | 1 | ||||
-rw-r--r-- | sound/pci/hda/hda_local.h | 16 | ||||
-rw-r--r-- | sound/pci/hda/patch_sigmatel.c | 11 | ||||
-rw-r--r-- | sound/pci/intel8x0.c | 51 | ||||
-rw-r--r-- | sound/usb/mixer.c | 1 | ||||
-rw-r--r-- | sound/usb/quirks.c | 7 |
8 files changed, 122 insertions, 47 deletions
diff --git a/sound/core/vmaster.c b/sound/core/vmaster.c index 5dbab38d04af..130cfe677d60 100644 --- a/sound/core/vmaster.c +++ b/sound/core/vmaster.c | |||
@@ -52,6 +52,7 @@ struct link_slave { | |||
52 | struct link_ctl_info info; | 52 | struct link_ctl_info info; |
53 | int vals[2]; /* current values */ | 53 | int vals[2]; /* current values */ |
54 | unsigned int flags; | 54 | unsigned int flags; |
55 | struct snd_kcontrol *kctl; /* original kcontrol pointer */ | ||
55 | struct snd_kcontrol slave; /* the copy of original control entry */ | 56 | struct snd_kcontrol slave; /* the copy of original control entry */ |
56 | }; | 57 | }; |
57 | 58 | ||
@@ -252,6 +253,7 @@ int _snd_ctl_add_slave(struct snd_kcontrol *master, struct snd_kcontrol *slave, | |||
252 | slave->count * sizeof(*slave->vd), GFP_KERNEL); | 253 | slave->count * sizeof(*slave->vd), GFP_KERNEL); |
253 | if (!srec) | 254 | if (!srec) |
254 | return -ENOMEM; | 255 | return -ENOMEM; |
256 | srec->kctl = slave; | ||
255 | srec->slave = *slave; | 257 | srec->slave = *slave; |
256 | memcpy(srec->slave.vd, slave->vd, slave->count * sizeof(*slave->vd)); | 258 | memcpy(srec->slave.vd, slave->vd, slave->count * sizeof(*slave->vd)); |
257 | srec->master = master_link; | 259 | srec->master = master_link; |
@@ -333,10 +335,18 @@ static int master_put(struct snd_kcontrol *kcontrol, | |||
333 | static void master_free(struct snd_kcontrol *kcontrol) | 335 | static void master_free(struct snd_kcontrol *kcontrol) |
334 | { | 336 | { |
335 | struct link_master *master = snd_kcontrol_chip(kcontrol); | 337 | struct link_master *master = snd_kcontrol_chip(kcontrol); |
336 | struct link_slave *slave; | 338 | struct link_slave *slave, *n; |
337 | 339 | ||
338 | list_for_each_entry(slave, &master->slaves, list) | 340 | /* free all slave links and retore the original slave kctls */ |
339 | slave->master = NULL; | 341 | list_for_each_entry_safe(slave, n, &master->slaves, list) { |
342 | struct snd_kcontrol *sctl = slave->kctl; | ||
343 | struct list_head olist = sctl->list; | ||
344 | memcpy(sctl, &slave->slave, sizeof(*sctl)); | ||
345 | memcpy(sctl->vd, slave->slave.vd, | ||
346 | sctl->count * sizeof(*sctl->vd)); | ||
347 | sctl->list = olist; /* keep the current linked-list */ | ||
348 | kfree(slave); | ||
349 | } | ||
340 | kfree(master); | 350 | kfree(master); |
341 | } | 351 | } |
342 | 352 | ||
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 916a1863af73..e44b107fdc75 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c | |||
@@ -2331,6 +2331,39 @@ int snd_hda_codec_reset(struct hda_codec *codec) | |||
2331 | return 0; | 2331 | return 0; |
2332 | } | 2332 | } |
2333 | 2333 | ||
2334 | typedef int (*map_slave_func_t)(void *, struct snd_kcontrol *); | ||
2335 | |||
2336 | /* apply the function to all matching slave ctls in the mixer list */ | ||
2337 | static int map_slaves(struct hda_codec *codec, const char * const *slaves, | ||
2338 | map_slave_func_t func, void *data) | ||
2339 | { | ||
2340 | struct hda_nid_item *items; | ||
2341 | const char * const *s; | ||
2342 | int i, err; | ||
2343 | |||
2344 | items = codec->mixers.list; | ||
2345 | for (i = 0; i < codec->mixers.used; i++) { | ||
2346 | struct snd_kcontrol *sctl = items[i].kctl; | ||
2347 | if (!sctl || !sctl->id.name || | ||
2348 | sctl->id.iface != SNDRV_CTL_ELEM_IFACE_MIXER) | ||
2349 | continue; | ||
2350 | for (s = slaves; *s; s++) { | ||
2351 | if (!strcmp(sctl->id.name, *s)) { | ||
2352 | err = func(data, sctl); | ||
2353 | if (err) | ||
2354 | return err; | ||
2355 | break; | ||
2356 | } | ||
2357 | } | ||
2358 | } | ||
2359 | return 0; | ||
2360 | } | ||
2361 | |||
2362 | static int check_slave_present(void *data, struct snd_kcontrol *sctl) | ||
2363 | { | ||
2364 | return 1; | ||
2365 | } | ||
2366 | |||
2334 | /** | 2367 | /** |
2335 | * snd_hda_add_vmaster - create a virtual master control and add slaves | 2368 | * snd_hda_add_vmaster - create a virtual master control and add slaves |
2336 | * @codec: HD-audio codec | 2369 | * @codec: HD-audio codec |
@@ -2351,12 +2384,10 @@ int snd_hda_add_vmaster(struct hda_codec *codec, char *name, | |||
2351 | unsigned int *tlv, const char * const *slaves) | 2384 | unsigned int *tlv, const char * const *slaves) |
2352 | { | 2385 | { |
2353 | struct snd_kcontrol *kctl; | 2386 | struct snd_kcontrol *kctl; |
2354 | const char * const *s; | ||
2355 | int err; | 2387 | int err; |
2356 | 2388 | ||
2357 | for (s = slaves; *s && !snd_hda_find_mixer_ctl(codec, *s); s++) | 2389 | err = map_slaves(codec, slaves, check_slave_present, NULL); |
2358 | ; | 2390 | if (err != 1) { |
2359 | if (!*s) { | ||
2360 | snd_printdd("No slave found for %s\n", name); | 2391 | snd_printdd("No slave found for %s\n", name); |
2361 | return 0; | 2392 | return 0; |
2362 | } | 2393 | } |
@@ -2367,23 +2398,10 @@ int snd_hda_add_vmaster(struct hda_codec *codec, char *name, | |||
2367 | if (err < 0) | 2398 | if (err < 0) |
2368 | return err; | 2399 | return err; |
2369 | 2400 | ||
2370 | for (s = slaves; *s; s++) { | 2401 | err = map_slaves(codec, slaves, (map_slave_func_t)snd_ctl_add_slave, |
2371 | struct snd_kcontrol *sctl; | 2402 | kctl); |
2372 | int i = 0; | 2403 | if (err < 0) |
2373 | for (;;) { | 2404 | return err; |
2374 | sctl = _snd_hda_find_mixer_ctl(codec, *s, i); | ||
2375 | if (!sctl) { | ||
2376 | if (!i) | ||
2377 | snd_printdd("Cannot find slave %s, " | ||
2378 | "skipped\n", *s); | ||
2379 | break; | ||
2380 | } | ||
2381 | err = snd_ctl_add_slave(kctl, sctl); | ||
2382 | if (err < 0) | ||
2383 | return err; | ||
2384 | i++; | ||
2385 | } | ||
2386 | } | ||
2387 | return 0; | 2405 | return 0; |
2388 | } | 2406 | } |
2389 | EXPORT_SYMBOL_HDA(snd_hda_add_vmaster); | 2407 | EXPORT_SYMBOL_HDA(snd_hda_add_vmaster); |
@@ -4752,6 +4770,7 @@ int snd_hda_parse_pin_defcfg(struct hda_codec *codec, | |||
4752 | memset(sequences_hp, 0, sizeof(sequences_hp)); | 4770 | memset(sequences_hp, 0, sizeof(sequences_hp)); |
4753 | assoc_line_out = 0; | 4771 | assoc_line_out = 0; |
4754 | 4772 | ||
4773 | codec->ignore_misc_bit = true; | ||
4755 | end_nid = codec->start_nid + codec->num_nodes; | 4774 | end_nid = codec->start_nid + codec->num_nodes; |
4756 | for (nid = codec->start_nid; nid < end_nid; nid++) { | 4775 | for (nid = codec->start_nid; nid < end_nid; nid++) { |
4757 | unsigned int wid_caps = get_wcaps(codec, nid); | 4776 | unsigned int wid_caps = get_wcaps(codec, nid); |
@@ -4767,6 +4786,9 @@ int snd_hda_parse_pin_defcfg(struct hda_codec *codec, | |||
4767 | continue; | 4786 | continue; |
4768 | 4787 | ||
4769 | def_conf = snd_hda_codec_get_pincfg(codec, nid); | 4788 | def_conf = snd_hda_codec_get_pincfg(codec, nid); |
4789 | if (!(get_defcfg_misc(snd_hda_codec_get_pincfg(codec, nid)) & | ||
4790 | AC_DEFCFG_MISC_NO_PRESENCE)) | ||
4791 | codec->ignore_misc_bit = false; | ||
4770 | conn = get_defcfg_connect(def_conf); | 4792 | conn = get_defcfg_connect(def_conf); |
4771 | if (conn == AC_JACK_PORT_NONE) | 4793 | if (conn == AC_JACK_PORT_NONE) |
4772 | continue; | 4794 | continue; |
diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h index 755f2b0f9d8e..564471169cae 100644 --- a/sound/pci/hda/hda_codec.h +++ b/sound/pci/hda/hda_codec.h | |||
@@ -854,6 +854,7 @@ struct hda_codec { | |||
854 | unsigned int no_sticky_stream:1; /* no sticky-PCM stream assignment */ | 854 | unsigned int no_sticky_stream:1; /* no sticky-PCM stream assignment */ |
855 | unsigned int pins_shutup:1; /* pins are shut up */ | 855 | unsigned int pins_shutup:1; /* pins are shut up */ |
856 | unsigned int no_trigger_sense:1; /* don't trigger at pin-sensing */ | 856 | unsigned int no_trigger_sense:1; /* don't trigger at pin-sensing */ |
857 | unsigned int ignore_misc_bit:1; /* ignore MISC_NO_PRESENCE bit */ | ||
857 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 858 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
858 | unsigned int power_on :1; /* current (global) power-state */ | 859 | unsigned int power_on :1; /* current (global) power-state */ |
859 | unsigned int power_transition :1; /* power-state in transition */ | 860 | unsigned int power_transition :1; /* power-state in transition */ |
diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h index dcbea0da0fa2..6579e0f2bb57 100644 --- a/sound/pci/hda/hda_local.h +++ b/sound/pci/hda/hda_local.h | |||
@@ -510,13 +510,15 @@ int snd_hda_jack_detect(struct hda_codec *codec, hda_nid_t nid); | |||
510 | 510 | ||
511 | static inline bool is_jack_detectable(struct hda_codec *codec, hda_nid_t nid) | 511 | static inline bool is_jack_detectable(struct hda_codec *codec, hda_nid_t nid) |
512 | { | 512 | { |
513 | return (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_PRES_DETECT) && | 513 | if (!(snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_PRES_DETECT)) |
514 | /* disable MISC_NO_PRESENCE check because it may break too | 514 | return false; |
515 | * many devices | 515 | if (!codec->ignore_misc_bit && |
516 | */ | 516 | (get_defcfg_misc(snd_hda_codec_get_pincfg(codec, nid)) & |
517 | /*(get_defcfg_misc(snd_hda_codec_get_pincfg(codec, nid) & | 517 | AC_DEFCFG_MISC_NO_PRESENCE)) |
518 | AC_DEFCFG_MISC_NO_PRESENCE)) &&*/ | 518 | return false; |
519 | (get_wcaps(codec, nid) & AC_WCAP_UNSOL_CAP); | 519 | if (!(get_wcaps(codec, nid) & AC_WCAP_UNSOL_CAP)) |
520 | return false; | ||
521 | return true; | ||
520 | } | 522 | } |
521 | 523 | ||
522 | /* flags for hda_nid_item */ | 524 | /* flags for hda_nid_item */ |
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 4e715fefebef..edc2b7bc177c 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
@@ -95,6 +95,7 @@ enum { | |||
95 | STAC_92HD83XXX_REF, | 95 | STAC_92HD83XXX_REF, |
96 | STAC_92HD83XXX_PWR_REF, | 96 | STAC_92HD83XXX_PWR_REF, |
97 | STAC_DELL_S14, | 97 | STAC_DELL_S14, |
98 | STAC_DELL_VOSTRO_3500, | ||
98 | STAC_92HD83XXX_HP, | 99 | STAC_92HD83XXX_HP, |
99 | STAC_92HD83XXX_HP_cNB11_INTQUAD, | 100 | STAC_92HD83XXX_HP_cNB11_INTQUAD, |
100 | STAC_HP_DV7_4000, | 101 | STAC_HP_DV7_4000, |
@@ -1659,6 +1660,12 @@ static const unsigned int dell_s14_pin_configs[10] = { | |||
1659 | 0x40f000f0, 0x40f000f0, | 1660 | 0x40f000f0, 0x40f000f0, |
1660 | }; | 1661 | }; |
1661 | 1662 | ||
1663 | static const unsigned int dell_vostro_3500_pin_configs[10] = { | ||
1664 | 0x02a11020, 0x0221101f, 0x400000f0, 0x90170110, | ||
1665 | 0x400000f1, 0x400000f2, 0x400000f3, 0x90a60160, | ||
1666 | 0x400000f4, 0x400000f5, | ||
1667 | }; | ||
1668 | |||
1662 | static const unsigned int hp_dv7_4000_pin_configs[10] = { | 1669 | static const unsigned int hp_dv7_4000_pin_configs[10] = { |
1663 | 0x03a12050, 0x0321201f, 0x40f000f0, 0x90170110, | 1670 | 0x03a12050, 0x0321201f, 0x40f000f0, 0x90170110, |
1664 | 0x40f000f0, 0x40f000f0, 0x90170110, 0xd5a30140, | 1671 | 0x40f000f0, 0x40f000f0, 0x90170110, 0xd5a30140, |
@@ -1675,6 +1682,7 @@ static const unsigned int *stac92hd83xxx_brd_tbl[STAC_92HD83XXX_MODELS] = { | |||
1675 | [STAC_92HD83XXX_REF] = ref92hd83xxx_pin_configs, | 1682 | [STAC_92HD83XXX_REF] = ref92hd83xxx_pin_configs, |
1676 | [STAC_92HD83XXX_PWR_REF] = ref92hd83xxx_pin_configs, | 1683 | [STAC_92HD83XXX_PWR_REF] = ref92hd83xxx_pin_configs, |
1677 | [STAC_DELL_S14] = dell_s14_pin_configs, | 1684 | [STAC_DELL_S14] = dell_s14_pin_configs, |
1685 | [STAC_DELL_VOSTRO_3500] = dell_vostro_3500_pin_configs, | ||
1678 | [STAC_92HD83XXX_HP_cNB11_INTQUAD] = hp_cNB11_intquad_pin_configs, | 1686 | [STAC_92HD83XXX_HP_cNB11_INTQUAD] = hp_cNB11_intquad_pin_configs, |
1679 | [STAC_HP_DV7_4000] = hp_dv7_4000_pin_configs, | 1687 | [STAC_HP_DV7_4000] = hp_dv7_4000_pin_configs, |
1680 | }; | 1688 | }; |
@@ -1684,6 +1692,7 @@ static const char * const stac92hd83xxx_models[STAC_92HD83XXX_MODELS] = { | |||
1684 | [STAC_92HD83XXX_REF] = "ref", | 1692 | [STAC_92HD83XXX_REF] = "ref", |
1685 | [STAC_92HD83XXX_PWR_REF] = "mic-ref", | 1693 | [STAC_92HD83XXX_PWR_REF] = "mic-ref", |
1686 | [STAC_DELL_S14] = "dell-s14", | 1694 | [STAC_DELL_S14] = "dell-s14", |
1695 | [STAC_DELL_VOSTRO_3500] = "dell-vostro-3500", | ||
1687 | [STAC_92HD83XXX_HP] = "hp", | 1696 | [STAC_92HD83XXX_HP] = "hp", |
1688 | [STAC_92HD83XXX_HP_cNB11_INTQUAD] = "hp_cNB11_intquad", | 1697 | [STAC_92HD83XXX_HP_cNB11_INTQUAD] = "hp_cNB11_intquad", |
1689 | [STAC_HP_DV7_4000] = "hp-dv7-4000", | 1698 | [STAC_HP_DV7_4000] = "hp-dv7-4000", |
@@ -1697,6 +1706,8 @@ static const struct snd_pci_quirk stac92hd83xxx_cfg_tbl[] = { | |||
1697 | "DFI LanParty", STAC_92HD83XXX_REF), | 1706 | "DFI LanParty", STAC_92HD83XXX_REF), |
1698 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02ba, | 1707 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02ba, |
1699 | "unknown Dell", STAC_DELL_S14), | 1708 | "unknown Dell", STAC_DELL_S14), |
1709 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x1028, | ||
1710 | "Dell Vostro 3500", STAC_DELL_VOSTRO_3500), | ||
1700 | SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xff00, 0x3600, | 1711 | SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xff00, 0x3600, |
1701 | "HP", STAC_92HD83XXX_HP), | 1712 | "HP", STAC_92HD83XXX_HP), |
1702 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1656, | 1713 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1656, |
diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c index c3b9bd0e188e..11718b49b2e2 100644 --- a/sound/pci/intel8x0.c +++ b/sound/pci/intel8x0.c | |||
@@ -2937,6 +2937,45 @@ static unsigned int sis_codec_bits[3] = { | |||
2937 | ICH_PCR, ICH_SCR, ICH_SIS_TCR | 2937 | ICH_PCR, ICH_SCR, ICH_SIS_TCR |
2938 | }; | 2938 | }; |
2939 | 2939 | ||
2940 | static int __devinit snd_intel8x0_inside_vm(struct pci_dev *pci) | ||
2941 | { | ||
2942 | int result = inside_vm; | ||
2943 | char *msg = NULL; | ||
2944 | |||
2945 | /* check module parameter first (override detection) */ | ||
2946 | if (result >= 0) { | ||
2947 | msg = result ? "enable (forced) VM" : "disable (forced) VM"; | ||
2948 | goto fini; | ||
2949 | } | ||
2950 | |||
2951 | /* detect KVM and Parallels virtual environments */ | ||
2952 | result = kvm_para_available(); | ||
2953 | #ifdef X86_FEATURE_HYPERVISOR | ||
2954 | result = result || boot_cpu_has(X86_FEATURE_HYPERVISOR); | ||
2955 | #endif | ||
2956 | if (!result) | ||
2957 | goto fini; | ||
2958 | |||
2959 | /* check for known (emulated) devices */ | ||
2960 | if (pci->subsystem_vendor == 0x1af4 && | ||
2961 | pci->subsystem_device == 0x1100) { | ||
2962 | /* KVM emulated sound, PCI SSID: 1af4:1100 */ | ||
2963 | msg = "enable KVM"; | ||
2964 | } else if (pci->subsystem_vendor == 0x1ab8) { | ||
2965 | /* Parallels VM emulated sound, PCI SSID: 1ab8:xxxx */ | ||
2966 | msg = "enable Parallels VM"; | ||
2967 | } else { | ||
2968 | msg = "disable (unknown or VT-d) VM"; | ||
2969 | result = 0; | ||
2970 | } | ||
2971 | |||
2972 | fini: | ||
2973 | if (msg != NULL) | ||
2974 | printk(KERN_INFO "intel8x0: %s optimization\n", msg); | ||
2975 | |||
2976 | return result; | ||
2977 | } | ||
2978 | |||
2940 | static int __devinit snd_intel8x0_create(struct snd_card *card, | 2979 | static int __devinit snd_intel8x0_create(struct snd_card *card, |
2941 | struct pci_dev *pci, | 2980 | struct pci_dev *pci, |
2942 | unsigned long device_type, | 2981 | unsigned long device_type, |
@@ -3004,9 +3043,7 @@ static int __devinit snd_intel8x0_create(struct snd_card *card, | |||
3004 | if (xbox) | 3043 | if (xbox) |
3005 | chip->xbox = 1; | 3044 | chip->xbox = 1; |
3006 | 3045 | ||
3007 | chip->inside_vm = inside_vm; | 3046 | chip->inside_vm = snd_intel8x0_inside_vm(pci); |
3008 | if (inside_vm) | ||
3009 | printk(KERN_INFO "intel8x0: enable KVM optimization\n"); | ||
3010 | 3047 | ||
3011 | if (pci->vendor == PCI_VENDOR_ID_INTEL && | 3048 | if (pci->vendor == PCI_VENDOR_ID_INTEL && |
3012 | pci->device == PCI_DEVICE_ID_INTEL_440MX) | 3049 | pci->device == PCI_DEVICE_ID_INTEL_440MX) |
@@ -3250,14 +3287,6 @@ static int __devinit snd_intel8x0_probe(struct pci_dev *pci, | |||
3250 | buggy_irq = 0; | 3287 | buggy_irq = 0; |
3251 | } | 3288 | } |
3252 | 3289 | ||
3253 | if (inside_vm < 0) { | ||
3254 | /* detect KVM and Parallels virtual environments */ | ||
3255 | inside_vm = kvm_para_available(); | ||
3256 | #if defined(__i386__) || defined(__x86_64__) | ||
3257 | inside_vm = inside_vm || boot_cpu_has(X86_FEATURE_HYPERVISOR); | ||
3258 | #endif | ||
3259 | } | ||
3260 | |||
3261 | if ((err = snd_intel8x0_create(card, pci, pci_id->driver_data, | 3290 | if ((err = snd_intel8x0_create(card, pci, pci_id->driver_data, |
3262 | &chip)) < 0) { | 3291 | &chip)) < 0) { |
3263 | snd_card_free(card); | 3292 | snd_card_free(card); |
diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c index c5444e00f0c6..ab23869c01bb 100644 --- a/sound/usb/mixer.c +++ b/sound/usb/mixer.c | |||
@@ -799,6 +799,7 @@ static void volume_control_quirks(struct usb_mixer_elem_info *cval, | |||
799 | 799 | ||
800 | case USB_ID(0x046d, 0x0808): | 800 | case USB_ID(0x046d, 0x0808): |
801 | case USB_ID(0x046d, 0x0809): | 801 | case USB_ID(0x046d, 0x0809): |
802 | case USB_ID(0x046d, 0x081d): /* HD Webcam c510 */ | ||
802 | case USB_ID(0x046d, 0x0991): | 803 | case USB_ID(0x046d, 0x0991): |
803 | /* Most audio usb devices lie about volume resolution. | 804 | /* Most audio usb devices lie about volume resolution. |
804 | * Most Logitech webcams have res = 384. | 805 | * Most Logitech webcams have res = 384. |
diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c index 2e5bc7344026..a3ddac0deffd 100644 --- a/sound/usb/quirks.c +++ b/sound/usb/quirks.c | |||
@@ -137,12 +137,12 @@ static int create_fixed_stream_quirk(struct snd_usb_audio *chip, | |||
137 | return -ENOMEM; | 137 | return -ENOMEM; |
138 | } | 138 | } |
139 | if (fp->nr_rates > 0) { | 139 | if (fp->nr_rates > 0) { |
140 | rate_table = kmalloc(sizeof(int) * fp->nr_rates, GFP_KERNEL); | 140 | rate_table = kmemdup(fp->rate_table, |
141 | sizeof(int) * fp->nr_rates, GFP_KERNEL); | ||
141 | if (!rate_table) { | 142 | if (!rate_table) { |
142 | kfree(fp); | 143 | kfree(fp); |
143 | return -ENOMEM; | 144 | return -ENOMEM; |
144 | } | 145 | } |
145 | memcpy(rate_table, fp->rate_table, sizeof(int) * fp->nr_rates); | ||
146 | fp->rate_table = rate_table; | 146 | fp->rate_table = rate_table; |
147 | } | 147 | } |
148 | 148 | ||
@@ -224,10 +224,9 @@ static int create_uaxx_quirk(struct snd_usb_audio *chip, | |||
224 | if (altsd->bNumEndpoints != 1) | 224 | if (altsd->bNumEndpoints != 1) |
225 | return -ENXIO; | 225 | return -ENXIO; |
226 | 226 | ||
227 | fp = kmalloc(sizeof(*fp), GFP_KERNEL); | 227 | fp = kmemdup(&ua_format, sizeof(*fp), GFP_KERNEL); |
228 | if (!fp) | 228 | if (!fp) |
229 | return -ENOMEM; | 229 | return -ENOMEM; |
230 | memcpy(fp, &ua_format, sizeof(*fp)); | ||
231 | 230 | ||
232 | fp->iface = altsd->bInterfaceNumber; | 231 | fp->iface = altsd->bInterfaceNumber; |
233 | fp->endpoint = get_endpoint(alts, 0)->bEndpointAddress; | 232 | fp->endpoint = get_endpoint(alts, 0)->bEndpointAddress; |