Changeset 717 for GPL/trunk/alsa-kernel/pci/hda
- Timestamp:
- Aug 7, 2022, 6:11:12 PM (3 years ago)
- Location:
- GPL/trunk
- Files:
-
- 19 edited
-
. (modified) (1 prop)
-
alsa-kernel/pci/hda/hda_auto_parser.c (modified) (7 diffs)
-
alsa-kernel/pci/hda/hda_bind.c (modified) (5 diffs)
-
alsa-kernel/pci/hda/hda_codec.c (modified) (9 diffs)
-
alsa-kernel/pci/hda/hda_controller.c (modified) (6 diffs)
-
alsa-kernel/pci/hda/hda_controller.h (modified) (3 diffs)
-
alsa-kernel/pci/hda/hda_generic.c (modified) (5 diffs)
-
alsa-kernel/pci/hda/hda_generic.h (modified) (2 diffs)
-
alsa-kernel/pci/hda/hda_intel.c (modified) (25 diffs)
-
alsa-kernel/pci/hda/hda_intel.h (modified) (2 diffs)
-
alsa-kernel/pci/hda/hda_local.h (modified) (4 diffs)
-
alsa-kernel/pci/hda/patch_analog.c (modified) (3 diffs)
-
alsa-kernel/pci/hda/patch_ca0132.c (modified) (3 diffs)
-
alsa-kernel/pci/hda/patch_cirrus.c (modified) (6 diffs)
-
alsa-kernel/pci/hda/patch_conexant.c (modified) (6 diffs)
-
alsa-kernel/pci/hda/patch_hdmi.c (modified) (12 diffs)
-
alsa-kernel/pci/hda/patch_realtek.c (modified) (80 diffs)
-
alsa-kernel/pci/hda/patch_sigmatel.c (modified) (3 diffs)
-
alsa-kernel/pci/hda/patch_via.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
GPL/trunk
- Property svn:mergeinfo changed
/GPL/branches/uniaud32-next merged: 710-716
- Property svn:mergeinfo changed
-
GPL/trunk/alsa-kernel/pci/hda/hda_auto_parser.c
r695 r717 828 828 } 829 829 830 static voidapply_fixup(struct hda_codec *codec, int id, int action, int depth)830 void __snd_hda_apply_fixup(struct hda_codec *codec, int id, int action, int depth) 831 831 { 832 832 const char *modelname = codec->fixup_name; … … 838 838 break; 839 839 if (fix->chained_before) 840 apply_fixup(codec, fix->chain_id, action, depth + 1);840 __snd_hda_apply_fixup(codec, fix->chain_id, action, depth + 1); 841 841 842 842 switch (fix->type) { … … 879 879 } 880 880 } 881 EXPORT_SYMBOL_GPL(__snd_hda_apply_fixup); 881 882 882 883 /** … … 888 889 { 889 890 if (codec->fixup_list) 890 apply_fixup(codec, codec->fixup_id, action, 0);891 __snd_hda_apply_fixup(codec, codec->fixup_id, action, 0); 891 892 } 892 893 EXPORT_SYMBOL_GPL(snd_hda_apply_fixup); … … 976 977 * 977 978 * The function tries to find the matching model name at first, if given. 979 * If the model string contains the SSID alias, try to look up with the given 980 * alias ID. 978 981 * If nothing matched, try to look up the PCI SSID. 979 982 * If still nothing matched, try to look up the codec SSID. … … 987 990 int id = HDA_FIXUP_ID_NOT_SET; 988 991 const char *name = NULL; 992 const char *type = NULL; 993 unsigned int vendor, device; 989 994 990 995 if (codec->fixup_id != HDA_FIXUP_ID_NOT_SET) … … 993 998 /* when model=nofixup is given, don't pick up any fixups */ 994 999 if (codec->modelname && !strcmp(codec->modelname, "nofixup")) { 995 codec->fixup_list = NULL; 996 codec->fixup_name = NULL; 997 codec->fixup_id = HDA_FIXUP_ID_NO_FIXUP; 1000 id = HDA_FIXUP_ID_NO_FIXUP; 1001 fixlist = NULL; 998 1002 codec_dbg(codec, "%s: picked no fixup (nofixup specified)\n", 999 1003 codec->core.chip_name); 1000 return; 1001 } 1002 1004 goto found; 1005 } 1006 1007 /* match with the model name string */ 1003 1008 if (codec->modelname && models) { 1004 1009 while (models->name) { 1005 1010 if (!strcmp(codec->modelname, models->name)) { 1006 codec->fixup_id = models->id; 1007 codec->fixup_name = models->name; 1008 codec->fixup_list = fixlist; 1011 id = models->id; 1012 name = models->name; 1009 1013 codec_dbg(codec, "%s: picked fixup %s (model specified)\n", 1010 1014 codec->core.chip_name, codec->fixup_name); 1011 return;1015 goto found; 1012 1016 } 1013 1017 models++; 1014 1018 } 1015 1019 } 1016 if (quirk) { 1017 q = snd_pci_quirk_lookup(codec->bus->pci, quirk); 1020 1021 if (!quirk) 1022 return; 1023 1024 /* match with the SSID alias given by the model string "XXXX:YYYY" */ 1025 if (codec->modelname && 1026 sscanf(codec->modelname, "%04x:%04x", &vendor, &device) == 2) { 1027 q = snd_pci_quirk_lookup_id(vendor, device, quirk); 1018 1028 if (q) { 1019 id = q->value; 1029 type = "alias SSID"; 1030 goto found_device; 1031 } 1032 } 1033 1034 /* match with the PCI SSID */ 1035 q = snd_pci_quirk_lookup(codec->bus->pci, quirk); 1036 if (q) { 1037 type = "PCI SSID"; 1038 goto found_device; 1039 } 1040 1041 /* match with the codec SSID */ 1042 q = snd_pci_quirk_lookup_id(codec->core.subsystem_id >> 16, 1043 codec->core.subsystem_id & 0xffff, 1044 quirk); 1045 if (q) { 1046 type = "codec SSID"; 1047 goto found_device; 1048 } 1049 1050 return; /* no matching */ 1051 1052 found_device: 1053 id = q->value; 1020 1054 #ifdef CONFIG_SND_DEBUG_VERBOSE 1021 name = q->name; 1022 codec_dbg(codec, "%s: picked fixup %s (PCI SSID%s)\n", 1023 codec->core.chip_name, name, q->subdevice_mask ? "" : " - vendor generic"); 1055 name = q->name; 1024 1056 #endif 1025 } 1026 } 1027 if (id < 0 && quirk) { 1028 for (q = quirk; q->subvendor || q->subdevice; q++) { 1029 unsigned int vendorid = 1030 q->subdevice | (q->subvendor << 16); 1031 unsigned int mask = 0xffff0000 | q->subdevice_mask; 1032 if ((codec->core.subsystem_id & mask) == (vendorid & mask)) { 1033 id = q->value; 1034 #ifdef CONFIG_SND_DEBUG_VERBOSE 1035 name = q->name; 1036 codec_dbg(codec, "%s: picked fixup %s (codec SSID)\n", 1037 codec->core.chip_name, name); 1038 #endif 1039 break; 1040 } 1041 } 1042 } 1043 1057 codec_dbg(codec, "%s: picked fixup %s for %s %04x:%04x\n", 1058 codec->core.chip_name, name ? name : "", 1059 type, q->subvendor, q->subdevice); 1060 found: 1044 1061 codec->fixup_id = id; 1045 if (id >= 0) { 1046 codec->fixup_list = fixlist; 1047 codec->fixup_name = name; 1048 } 1062 codec->fixup_list = fixlist; 1063 codec->fixup_name = name; 1049 1064 } 1050 1065 EXPORT_SYMBOL_GPL(snd_hda_pick_fixup); -
GPL/trunk/alsa-kernel/pci/hda/hda_bind.c
r703 r717 159 159 } 160 160 161 refcount_dec(&codec->pcm_ref); 162 snd_hda_codec_disconnect_pcms(codec); 163 wait_event(codec->remove_sleep, !refcount_read(&codec->pcm_ref)); 164 snd_power_sync_ref(codec->bus->card); 165 161 166 if (codec->patch_ops.free) 162 167 codec->patch_ops.free(codec); … … 168 173 static void hda_codec_driver_shutdown(struct device *dev) 169 174 { 170 struct hda_codec *codec = dev_to_hda_codec(dev); 171 172 if (!pm_runtime_suspended(dev)) { 173 if (codec->patch_ops.reboot_notify) 174 codec->patch_ops.reboot_notify(codec); 175 snd_hda_codec_display_power(codec, false); 176 } 175 snd_hda_codec_shutdown(dev_to_hda_codec(dev)); 177 176 } 178 177 … … 309 308 int err; 310 309 310 if (codec->configured) 311 return 0; 312 311 313 if (is_generic_config(codec)) 312 314 codec->probe_id = HDA_CODEC_ID_GENERIC; … … 314 316 codec->probe_id = 0; 315 317 316 err = snd_hdac_device_register(&codec->core); 317 if (err < 0) 318 return err; 318 if (!device_is_registered(&codec->core.dev)) { 319 err = snd_hdac_device_register(&codec->core); 320 if (err < 0) 321 return err; 322 } 319 323 320 324 if (!codec->preset) … … 323 327 err = codec_bind_generic(codec); 324 328 if (err < 0) { 325 codec_ err(codec, "Unable to bind the codec\n");326 goto error;329 codec_dbg(codec, "Unable to bind the codec\n"); 330 return err; 327 331 } 328 332 } 329 333 330 return 0; 331 332 error: 333 snd_hdac_device_unregister(&codec->core); 334 return err; 334 codec->configured = 1; 335 return 0; 335 336 } 336 337 EXPORT_SYMBOL_GPL(snd_hda_codec_configure); -
GPL/trunk/alsa-kernel/pci/hda/hda_codec.c
r703 r717 712 712 * PCM device 713 713 */ 714 static void release_pcm(struct kref *kref)715 {716 struct hda_pcm *pcm = container_of(kref, struct hda_pcm, kref);717 #ifndef TARGET_OS2718 /* don't do this on OS/2 - results in the device being free'd and can't be re-opened */719 if (pcm->pcm)720 snd_device_free(pcm->codec->card, pcm->pcm);721 #endif722 clear_bit(pcm->device, pcm->codec->bus->pcm_dev_bits);723 kfree(pcm->name);724 kfree(pcm);725 }726 714 727 715 void snd_hda_codec_pcm_put(struct hda_pcm *pcm) 728 716 { 729 kref_put(&pcm->kref, release_pcm); 717 if (refcount_dec_and_test(&pcm->codec->pcm_ref)) 718 wake_up(&pcm->codec->remove_sleep); 730 719 } 731 720 EXPORT_SYMBOL_GPL(snd_hda_codec_pcm_put); … … 742 731 743 732 pcm->codec = codec; 744 kref_init(&pcm->kref);745 733 va_start(args, fmt); 746 734 pcm->name = kvasprintf(GFP_KERNEL, fmt, args); … … 752 740 753 741 list_add_tail(&pcm->list, &codec->pcm_list_head); 742 refcount_inc(&codec->pcm_ref); 754 743 return pcm; 755 744 } … … 759 748 * codec destructor 760 749 */ 761 static void codec_release_pcms(struct hda_codec *codec) 762 { 763 struct hda_pcm *pcm, *n; 764 765 list_for_each_entry_safe(pcm, n, &codec->pcm_list_head, list, struct hda_pcm) { 766 list_del_init(&pcm->list); 750 void snd_hda_codec_disconnect_pcms(struct hda_codec *codec) 751 { 752 struct hda_pcm *pcm; 753 754 list_for_each_entry(pcm, &codec->pcm_list_head, list, struct hda_pcm) { 755 if (pcm->disconnected) 756 continue; 767 757 if (pcm->pcm) 768 758 snd_device_disconnect(codec->card, pcm->pcm); 769 759 snd_hda_codec_pcm_put(pcm); 760 pcm->disconnected = 1; 761 } 762 } 763 764 static void codec_release_pcms(struct hda_codec *codec) 765 { 766 struct hda_pcm *pcm, *n; 767 768 list_for_each_entry_safe(pcm, n, &codec->pcm_list_head, list, struct hda_pcm) { 769 list_del(&pcm->list); 770 #ifndef TARGET_OS2 771 /* don't do this on OS/2 - results in the device being free'd and can't be re-opened */ 772 if (pcm->pcm) 773 snd_device_free(pcm->codec->card, pcm->pcm); 774 #endif 775 clear_bit(pcm->device, pcm->codec->bus->pcm_dev_bits); 776 kfree(pcm->name); 777 kfree(pcm); 770 778 } 771 779 } … … 780 788 } 781 789 790 snd_hda_codec_disconnect_pcms(codec); 782 791 cancel_delayed_work_sync(&codec->jackpoll_work); 783 792 if (!codec->in_freeing) … … 802 811 remove_conn_list(codec); 803 812 snd_hdac_regmap_exit(&codec->core); 813 codec->configured = 0; 814 refcount_set(&codec->pcm_ref, 1); /* reset refcount */ 804 815 } 805 816 EXPORT_SYMBOL_GPL(snd_hda_codec_cleanup_for_unbind); … … 968 979 INIT_LIST_HEAD(&codec->conn_list); 969 980 INIT_LIST_HEAD(&codec->pcm_list_head); 981 refcount_set(&codec->pcm_ref, 1); 982 init_waitqueue_head(&codec->remove_sleep); 970 983 971 984 INIT_DELAYED_WORK(&codec->jackpoll_work, hda_jackpoll_work); … … 1737 1750 int i; 1738 1751 struct hda_nid_item *items = codec->mixers.list; 1752 1753 down_write(&codec->card->controls_rwsem); 1739 1754 for (i = 0; i < codec->mixers.used; i++) 1740 1755 snd_ctl_remove(codec->card, items[i].kctl); 1756 up_write(&codec->card->controls_rwsem); 1741 1757 snd_array_free(&codec->mixers); 1742 1758 snd_array_free(&codec->nids); … … 2998 3014 NULL) 2999 3015 }; 3016 3017 /* suspend the codec at shutdown; called from driver's shutdown callback */ 3018 void snd_hda_codec_shutdown(struct hda_codec *codec) 3019 { 3020 struct hda_pcm *cpcm; 3021 3022 /* Skip the shutdown if codec is not registered */ 3023 if (!codec->registered) 3024 return; 3025 3026 list_for_each_entry(cpcm, &codec->pcm_list_head, list, struct hda_pcm) 3027 snd_pcm_suspend_all(cpcm->pcm); 3028 3029 pm_runtime_force_suspend(hda_codec_dev(codec)); 3030 pm_runtime_disable(hda_codec_dev(codec)); 3031 } 3000 3032 3001 3033 /* -
GPL/trunk/alsa-kernel/pci/hda/hda_controller.c
r695 r717 26 26 #include <sound/initval.h> 27 27 #include "hda_controller.h" 28 #include "hda_local.h" 28 29 29 30 #ifndef TARGET_OS2 … … 523 524 524 525 nsec = timecounter_read(&azx_dev->core.tc); 525 nsec = div_u64(nsec, 3); /* can be optimized */526 526 if (audio_tstamp_config->report_delay) 527 527 nsec = azx_adjust_codec_delay(substream, nsec); … … 690 690 } 691 691 692 #ifndef TARGET_OS2693 static int azx_pcm_mmap(struct snd_pcm_substream *substream,694 struct vm_area_struct *area)695 {696 struct azx_pcm *apcm = snd_pcm_substream_chip(substream);697 struct azx *chip = apcm->chip;698 if (chip->ops->pcm_mmap_prepare)699 chip->ops->pcm_mmap_prepare(substream, area);700 return snd_pcm_lib_default_mmap(substream, area);701 }702 #else703 #define azx_pcm_mmap NULL704 #endif705 706 692 static const struct snd_pcm_ops azx_pcm_ops = { 707 693 .open = azx_pcm_open, … … 713 699 .pointer = azx_pcm_pointer, 714 700 .get_time_info = azx_get_time_info, 715 .mmap = azx_pcm_mmap,716 701 }; 717 702 … … 778 763 size = MAX_PREALLOC_SIZE; 779 764 if (chip->uc_buffer) 780 type = SNDRV_DMA_TYPE_DEV_ UC_SG;765 type = SNDRV_DMA_TYPE_DEV_WC_SG; 781 766 snd_pcm_set_managed_buffer_all(pcm, type, chip->card->dev, 782 767 size, MAX_PREALLOC_SIZE); … … 1293 1278 { 1294 1279 struct hda_codec *codec, *next; 1295 1296 /* use _safe version here since snd_hda_codec_configure() deregisters 1297 * the device upon error and deletes itself from the bus list. 1298 */ 1299 list_for_each_codec_safe(codec, next, &chip->bus) { 1300 snd_hda_codec_configure(codec); 1301 } 1302 1303 if (!azx_bus(chip)->num_codecs) 1304 return -ENODEV; 1305 return 0; 1280 int success = 0; 1281 1282 list_for_each_codec(codec, &chip->bus) { 1283 if (!snd_hda_codec_configure(codec)) 1284 success++; 1285 } 1286 1287 if (success) { 1288 /* unregister failed codecs if any codec has been probed */ 1289 list_for_each_codec_safe(codec, next, &chip->bus) { 1290 if (!codec->configured) { 1291 codec_err(codec, "Unable to configure, disabling\n"); 1292 snd_hdac_device_unregister(&codec->core); 1293 } 1294 } 1295 } 1296 1297 return success ? 0 : -ENODEV; 1306 1298 } 1307 1299 EXPORT_SYMBOL_GPL(azx_codec_configure); -
GPL/trunk/alsa-kernel/pci/hda/hda_controller.h
r679 r717 42 42 #define AZX_DCAPS_COUNT_LPIB_DELAY (1 << 25) /* Take LPIB as delay */ 43 43 #define AZX_DCAPS_PM_RUNTIME (1 << 26) /* runtime PM support */ 44 /* 27 unused */44 #define AZX_DCAPS_RETRY_PROBE (1 << 27) /* retry probe if no codec is configured */ 45 45 #define AZX_DCAPS_CORBRP_SELF_CLEAR (1 << 28) /* CORBRP clears itself after reset */ 46 46 #define AZX_DCAPS_NO_MSI64 (1 << 29) /* Stick to 32-bit MSIs */ … … 75 75 /* Disable msi if supported, PCI only */ 76 76 int (*disable_msi_reset_irq)(struct azx *); 77 void (*pcm_mmap_prepare)(struct snd_pcm_substream *substream,78 struct vm_area_struct *area);79 77 /* Check if current position is acceptable */ 80 78 int (*position_check)(struct azx *chip, struct azx_dev *azx_dev); … … 142 140 unsigned int uc_buffer:1; /* non-cached pages for stream buffers */ 143 141 unsigned int align_buffer_size:1; 144 unsigned int region_requested:1;145 142 unsigned int disabled:1; /* disabled by vga_switcheroo */ 146 143 unsigned int pm_prepared:1; -
GPL/trunk/alsa-kernel/pci/hda/hda_generic.c
r703 r717 95 95 snd_array_free(&spec->paths); 96 96 snd_array_free(&spec->loopback_list); 97 #ifdef CONFIG_SND_HDA_GENERIC_LEDS 98 if (spec->led_cdevs[LED_AUDIO_MUTE]) 99 led_classdev_unregister(spec->led_cdevs[LED_AUDIO_MUTE]); 100 if (spec->led_cdevs[LED_AUDIO_MICMUTE]) 101 led_classdev_unregister(spec->led_cdevs[LED_AUDIO_MICMUTE]); 102 #endif 97 103 } 98 104 … … 3934 3940 bool micmute) 3935 3941 { 3942 struct hda_gen_spec *spec = codec->spec; 3936 3943 struct led_classdev *cdev; 3944 int idx = micmute ? LED_AUDIO_MICMUTE : LED_AUDIO_MUTE; 3945 int err; 3937 3946 3938 3947 cdev = devm_kzalloc(&codec->core.dev, sizeof(*cdev), GFP_KERNEL); … … 3944 3953 cdev->default_trigger = micmute ? "audio-micmute" : "audio-mute"; 3945 3954 cdev->brightness_set_blocking = callback; 3946 cdev->brightness = ledtrig_audio_get( micmute ? LED_AUDIO_MICMUTE : LED_AUDIO_MUTE);3955 cdev->brightness = ledtrig_audio_get(idx); 3947 3956 cdev->flags = LED_CORE_SUSPENDRESUME; 3948 3957 3949 return devm_led_classdev_register(&codec->core.dev, cdev); 3958 err = led_classdev_register(&codec->core.dev, cdev); 3959 if (err < 0) 3960 return err; 3961 spec->led_cdevs[idx] = cdev; 3962 return 0; 3950 3963 } 3951 3964 … … 6016 6029 EXPORT_SYMBOL_GPL(snd_hda_gen_free); 6017 6030 6018 /**6019 * snd_hda_gen_reboot_notify - Make codec enter D3 before rebooting6020 * @codec: the HDA codec6021 *6022 * This can be put as patch_ops reboot_notify function.6023 */6024 void snd_hda_gen_reboot_notify(struct hda_codec *codec)6025 {6026 /* Make the codec enter D3 to avoid spurious noises from the internal6027 * speaker during (and after) reboot6028 */6029 snd_hda_codec_set_power_to_all(codec, codec->core.afg, AC_PWRST_D3);6030 snd_hda_codec_write(codec, codec->core.afg, 0,6031 AC_VERB_SET_POWER_STATE, AC_PWRST_D3);6032 msleep(10);6033 }6034 EXPORT_SYMBOL_GPL(snd_hda_gen_reboot_notify);6035 6036 6031 #ifdef CONFIG_PM 6037 6032 /** … … 6061 6056 .free = snd_hda_gen_free, 6062 6057 .unsol_event = snd_hda_jack_unsol_event, 6063 .reboot_notify = snd_hda_gen_reboot_notify,6064 6058 #ifdef CONFIG_PM 6065 6059 .check_power_status = snd_hda_gen_check_power_status, -
GPL/trunk/alsa-kernel/pci/hda/hda_generic.h
r695 r717 295 295 void (*mic_autoswitch_hook)(struct hda_codec *codec, 296 296 struct hda_jack_callback *cb); 297 298 /* leds */ 299 struct led_classdev *led_cdevs[NUM_AUDIO_LEDS]; 297 300 }; 298 301 … … 325 328 int snd_hda_gen_build_controls(struct hda_codec *codec); 326 329 int snd_hda_gen_build_pcms(struct hda_codec *codec); 327 void snd_hda_gen_reboot_notify(struct hda_codec *codec);328 330 329 331 /* standard jack event callbacks */ -
GPL/trunk/alsa-kernel/pci/hda/hda_intel.c
r703 r717 326 326 #define AZX_DCAPS_PRESET_AMD_SB \ 327 327 (AZX_DCAPS_NO_TCSEL | AZX_DCAPS_AMD_WORKAROUND |\ 328 AZX_DCAPS_SNOOP_TYPE(ATI) | AZX_DCAPS_PM_RUNTIME) 328 AZX_DCAPS_SNOOP_TYPE(ATI) | AZX_DCAPS_PM_RUNTIME |\ 329 AZX_DCAPS_RETRY_PROBE) 329 330 330 331 /* quirks for Nvidia */ … … 353 354 ((pci)->device == 0x0d0c) || \ 354 355 ((pci)->device == 0x160c) || \ 355 ((pci)->device == 0x490d)) 356 ((pci)->device == 0x490d) || \ 357 ((pci)->device == 0x4f90) || \ 358 ((pci)->device == 0x4f91) || \ 359 ((pci)->device == 0x4f92)) 356 360 357 361 #define IS_BXT(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0x5a98) … … 656 660 * data is processed. So, we need to process it afterwords in a 657 661 * workqueue. 662 * 663 * Returns 1 if OK to proceed, 0 for delay handling, -1 for skipping update 658 664 */ 659 665 static int azx_position_ok(struct azx *chip, struct azx_dev *azx_dev) 660 666 { 661 667 struct snd_pcm_substream *substream = azx_dev->core.substream; 668 struct snd_pcm_runtime *runtime = substream->runtime; 662 669 int stream = substream->stream; 663 670 u32 wallclk; 664 671 unsigned int pos; 672 snd_pcm_uframes_t hwptr, target; 665 673 666 674 wallclk = azx_readl(chip, WALLCLK) - azx_dev->core.start_wallclk; … … 706 714 return chip->bdl_pos_adj ? 0 : -1; 707 715 azx_dev->core.start_wallclk += wallclk; 716 717 if (azx_dev->core.no_period_wakeup) 718 return 1; /* OK, no need to check period boundary */ 719 720 if (runtime->hw_ptr_base != runtime->hw_ptr_interrupt) 721 return 1; /* OK, already in hwptr updating process */ 722 723 /* check whether the period gets really elapsed */ 724 pos = bytes_to_frames(runtime, pos); 725 hwptr = runtime->hw_ptr_base + pos; 726 if (hwptr < runtime->status->hw_ptr) 727 hwptr += runtime->buffer_size; 728 target = runtime->hw_ptr_interrupt + runtime->period_size; 729 if (hwptr < target) { 730 /* too early wakeup, process it later */ 731 return chip->bdl_pos_adj ? 0 : -1; 732 } 733 708 734 return 1; /* OK, it's fine */ 709 735 } … … 882 908 /* just read back the calculated value in the above */ 883 909 return substream->runtime->delay; 884 }885 886 static unsigned int azx_skl_get_dpib_pos(struct azx *chip,887 struct azx_dev *azx_dev)888 {889 return _snd_hdac_chip_readl(azx_bus(chip),890 AZX_REG_VS_SDXDPIB_XBASE +891 (AZX_REG_VS_SDXDPIB_XINTERVAL *892 azx_dev->core.index));893 }894 895 /* get the current DMA position with correction on SKL+ chips */896 static unsigned int azx_get_pos_skl(struct azx *chip, struct azx_dev *azx_dev)897 {898 /* DPIB register gives a more accurate position for playback */899 if (azx_dev->core.substream->stream == SNDRV_PCM_STREAM_PLAYBACK)900 return azx_skl_get_dpib_pos(chip, azx_dev);901 902 /* For capture, we need to read posbuf, but it requires a delay903 * for the possible boundary overlap; the read of DPIB fetches the904 * actual posbuf905 */906 udelay(20);907 azx_skl_get_dpib_pos(chip, azx_dev);908 return azx_get_pos_posbuf(chip, azx_dev);909 910 } 910 911 … … 1407 1408 if (bus->irq >= 0) 1408 1409 free_irq(bus->irq, (void*)chip); 1409 if (chip->msi)1410 pci_disable_msi(chip->pci);1411 #ifdef TARGET_OS21412 iounmap((void *)bus->remap_addr);1413 #else1414 iounmap(bus->remap_addr);1415 #endif1416 1410 1417 1411 azx_free_stream_pages(chip); … … 1419 1413 snd_hdac_bus_exit(bus); 1420 1414 1421 if (chip->region_requested)1422 pci_release_regions(chip->pci);1423 1424 pci_disable_device(chip->pci);1425 1415 #ifdef CONFIG_SND_HDA_PATCH_LOADER 1426 1416 release_firmware(chip->fw); … … 1617 1607 [POS_FIX_VIACOMBO] = azx_via_get_position, 1618 1608 [POS_FIX_COMBO] = azx_get_pos_lpib, 1619 [POS_FIX_SKL] = azx_get_pos_ skl,1609 [POS_FIX_SKL] = azx_get_pos_posbuf, 1620 1610 [POS_FIX_FIFO] = azx_get_pos_fifo, 1621 1611 }; … … 1655 1645 SND_PCI_QUIRK(0x1043, 0x1262, "ASUS W5Fm", 0x103), 1656 1646 SND_PCI_QUIRK(0x1046, 0x1262, "ASUS W5F", 0x103), 1647 SND_PCI_QUIRK(0x1558, 0x0351, "Schenker Dock 15", 0x105), 1657 1648 /* WinFast VP200 H (Teradici) user reported broken communication */ 1658 1649 SND_PCI_QUIRK(0x3a21, 0x040d, "WinFast VP200 H", 0x101), … … 1768 1759 static void azx_probe_work(struct work_struct *work) 1769 1760 { 1770 struct hda_intel *hda = container_of(work, struct hda_intel, probe_work );1761 struct hda_intel *hda = container_of(work, struct hda_intel, probe_work.work); 1771 1762 azx_probe_continue(&hda->chip); 1772 1763 } … … 1820 1811 hda = kzalloc(sizeof(*hda), GFP_KERNEL); 1821 1812 #endif 1822 if (!hda) { 1823 pci_disable_device(pci); 1824 return -ENOMEM; 1825 } 1813 if (!hda) 1814 return -ENOMEM; 1826 1815 1827 1816 chip = &hda->chip; … … 1844 1833 assign_position_fix(chip, check_position_fix(chip, position_fix[dev])); 1845 1834 1846 check_probe_mask(chip, dev);1847 1848 1835 if (single_cmd < 0) /* allow fallback to single_cmd at errors */ 1849 1836 chip->fallback_to_single_cmd = 1; … … 1859 1846 1860 1847 err = azx_bus_init(chip, model[dev]); 1861 if (err < 0) { 1862 pci_disable_device(pci); 1848 if (err < 0) 1863 1849 return err; 1864 }1865 1850 1866 1851 /* use the non-cached pages in non-snoop mode */ 1867 1852 if (!azx_snoop(chip)) 1868 azx_bus(chip)->dma_type = SNDRV_DMA_TYPE_DEV_ UC;1853 azx_bus(chip)->dma_type = SNDRV_DMA_TYPE_DEV_WC; 1869 1854 1870 1855 if (chip->driver_type == AZX_DRIVER_NVIDIA) { … … 1872 1857 chip->bus.core.needs_damn_long_delay = 1; 1873 1858 } 1859 1860 check_probe_mask(chip, dev); 1874 1861 1875 1862 err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops); … … 1881 1868 1882 1869 /* continue probing in work context as may trigger request module */ 1883 INIT_ WORK(&hda->probe_work, azx_probe_work);1870 INIT_DELAYED_WORK(&hda->probe_work, azx_probe_work); 1884 1871 1885 1872 *rchip = chip; … … 1908 1895 #endif 1909 1896 1897 #ifndef TARGET_OS2 1898 err = pcim_iomap_regions(pci, 1 << 0, "ICH HD audio"); 1899 #else 1910 1900 err = pci_request_regions(pci, "ICH HD audio"); 1901 #endif 1911 1902 if (err < 0) 1912 1903 return err; 1913 chip->region_requested = 1;1914 1904 1915 1905 bus->addr = pci_resource_start(pci, 0); 1906 #ifndef TARGET_OS2 1907 bus->remap_addr = pcim_iomap_table(pci)[0]; 1908 #else 1916 1909 bus->remap_addr = pci_ioremap_bar(pci, 0); 1917 if (bus->remap_addr == NULL) { 1918 dev_err(card->dev, "ioremap error\n"); 1919 return -ENXIO; 1920 } 1921 1910 #endif 1922 1911 if (chip->driver_type == AZX_DRIVER_SKL) 1923 1912 snd_hdac_bus_parse_capabilities(bus); … … 2101 2090 } 2102 2091 2103 static void pcm_mmap_prepare(struct snd_pcm_substream *substream,2104 struct vm_area_struct *area)2105 {2106 #ifdef CONFIG_X862107 struct azx_pcm *apcm = snd_pcm_substream_chip(substream);2108 struct azx *chip = apcm->chip;2109 if (chip->uc_buffer)2110 area->vm_page_prot = pgprot_writecombine(area->vm_page_prot);2111 #endif2112 }2113 2114 2092 /* Denylist for skipping the whole probe: 2115 2093 * some HD-audio PCI entries are exposed without any codecs, and such devices … … 2125 2103 static const struct hda_controller_ops pci_hda_ops = { 2126 2104 .disable_msi_reset_irq = disable_msi_reset_irq, 2127 .pcm_mmap_prepare = pcm_mmap_prepare,2128 2105 .position_check = azx_position_check, 2129 2106 }; … … 2219 2196 #else 2220 2197 if (schedule_probe) 2221 schedule_ work(&hda->probe_work);2198 schedule_delayed_work(&hda->probe_work, 0); 2222 2199 #endif 2223 2200 … … 2306 2283 int err; 2307 2284 2285 if (chip->disabled || hda->init_failed) 2286 return -EIO; 2287 if (hda->probe_retry) 2288 goto probe_retry; 2289 2308 2290 to_hda_bus(bus)->bus_probing = 1; 2309 2291 hda->probe_continued = 1; … … 2367 2349 } 2368 2350 #endif 2351 2352 probe_retry: 2369 2353 if (bus->codec_mask && !(probe_only[dev] & 1)) { 2370 2354 err = azx_codec_configure(chip); 2371 if (err < 0) 2355 if (err) { 2356 if ((chip->driver_caps & AZX_DCAPS_RETRY_PROBE) && 2357 ++hda->probe_retry < 60) { 2358 schedule_delayed_work(&hda->probe_work, 2359 msecs_to_jiffies(1000)); 2360 return 0; /* keep things up */ 2361 } 2362 dev_err(chip->card->dev, "Cannot probe codecs, giving up\n"); 2372 2363 goto out_free; 2364 } 2373 2365 } 2374 2366 … … 2392 2384 out_free: 2393 2385 if (err < 0) { 2394 azx_free(chip); 2386 pci_set_drvdata(pci, NULL); 2387 snd_card_free(chip->card); 2395 2388 return err; 2396 2389 } … … 2400 2393 complete_all(&hda->probe_wait); 2401 2394 to_hda_bus(bus)->bus_probing = 0; 2395 hda->probe_retry = 0; 2402 2396 return 0; 2403 2397 } … … 2425 2419 */ 2426 2420 device_unlock(&pci->dev); 2427 cancel_ work_sync(&hda->probe_work);2421 cancel_delayed_work_sync(&hda->probe_work); 2428 2422 device_lock(&pci->dev); 2429 2423 … … 2534 2528 /* DG1 */ 2535 2529 { PCI_DEVICE(0x8086, 0x490d), 2530 .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE}, 2531 /* DG2 */ 2532 { PCI_DEVICE(0x8086, 0x4f90), 2533 .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE}, 2534 { PCI_DEVICE(0x8086, 0x4f91), 2535 .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE}, 2536 { PCI_DEVICE(0x8086, 0x4f92), 2536 2537 .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE}, 2537 2538 /* Alderlake-S */ -
GPL/trunk/alsa-kernel/pci/hda/hda_intel.h
r679 r717 15 15 /* sync probing */ 16 16 struct completion probe_wait; 17 struct work_structprobe_work;17 struct delayed_work probe_work; 18 18 19 19 /* card list (for power_save trigger) */ … … 31 31 32 32 bool need_i915_power:1; /* the hda controller needs i915 power */ 33 34 int probe_retry; /* being probe-retry */ 33 35 }; 34 36 -
GPL/trunk/alsa-kernel/pci/hda/hda_local.h
r703 r717 138 138 void snd_hda_codec_register(struct hda_codec *codec); 139 139 void snd_hda_codec_cleanup_for_unbind(struct hda_codec *codec); 140 void snd_hda_codec_disconnect_pcms(struct hda_codec *codec); 140 141 141 142 #define snd_hda_regmap_sync(codec) snd_hdac_regmap_sync(&(codec)->core) … … 364 365 const struct hda_pintbl *cfg); 365 366 void snd_hda_apply_fixup(struct hda_codec *codec, int action); 367 void __snd_hda_apply_fixup(struct hda_codec *codec, int id, int action, int depth); 366 368 void snd_hda_pick_fixup(struct hda_codec *codec, 367 369 const struct hda_model_fixup *models, … … 453 455 for ((nid) = (codec)->core.start_nid; (nid) < (codec)->core.end_nid; (nid)++) 454 456 457 /* Set the codec power_state flag to indicate to allow unsol event handling; 458 * see hda_codec_unsol_event() in hda_bind.c. Calling this might confuse the 459 * state tracking, so use with care. 460 */ 461 static inline void snd_hda_codec_allow_unsol_events(struct hda_codec *codec) 462 { 463 codec->core.dev.power.power_state = PMSG_ON; 464 } 465 455 466 /* 456 467 * get widget capabilities … … 629 640 hda_nid_t nid, 630 641 unsigned int power_state); 642 643 void snd_hda_codec_shutdown(struct hda_codec *codec); 631 644 632 645 /* -
GPL/trunk/alsa-kernel/pci/hda/patch_analog.c
r679 r717 76 76 #endif 77 77 78 78 #ifdef CONFIG_PM 79 79 static void ad198x_power_eapd_write(struct hda_codec *codec, hda_nid_t front, 80 80 hda_nid_t hp) … … 116 116 } 117 117 118 static void ad198x_shutup(struct hda_codec *codec)118 static int ad198x_suspend(struct hda_codec *codec) 119 119 { 120 120 snd_hda_shutup_pins(codec); 121 121 ad198x_power_eapd(codec); 122 }123 124 #ifdef CONFIG_PM125 static int ad198x_suspend(struct hda_codec *codec)126 {127 ad198x_shutup(codec);128 122 return 0; 129 123 } … … 172 166 .suspend = ad198x_suspend, 173 167 #endif 174 .reboot_notify = ad198x_shutup,175 168 }; 176 169 -
GPL/trunk/alsa-kernel/pci/hda/patch_ca0132.c
r703 r717 2276 2276 { 2277 2277 struct ca0132_spec *spec = codec->spec; 2278 int status = -1;2278 int status; 2279 2279 unsigned int scp_send_size = 0; 2280 2280 unsigned int total_size; … … 9782 9782 } 9783 9783 9784 static void ca0132_reboot_notify(struct hda_codec *codec)9785 {9786 codec->patch_ops.free(codec);9787 }9788 9789 9784 #ifdef CONFIG_PM 9790 9785 static int ca0132_suspend(struct hda_codec *codec) … … 9806 9801 .suspend = ca0132_suspend, 9807 9802 #endif 9808 .reboot_notify = ca0132_reboot_notify,9809 9803 }; 9810 9804 -
GPL/trunk/alsa-kernel/pci/hda/patch_cirrus.c
r695 r717 10 10 #include <linux/module.h> 11 11 #include <sound/core.h> 12 #include <linux/mutex.h>13 12 #include <linux/pci.h> 14 13 #include <sound/tlv.h> … … 26 25 */ 27 26 28 #define CS42L42_HP_CH (2U)29 #define CS42L42_HS_MIC_CH (1U)30 31 27 struct cs_spec { 32 28 struct hda_gen_spec gen; … … 47 43 int (*spdif_sw_put)(struct snd_kcontrol *kcontrol, 48 44 struct snd_ctl_elem_value *ucontrol); 49 50 unsigned int cs42l42_hp_jack_in:1;51 unsigned int cs42l42_mic_jack_in:1;52 unsigned int cs42l42_volume_init:1;53 char cs42l42_hp_volume[CS42L42_HP_CH];54 char cs42l42_hs_mic_volume[CS42L42_HS_MIC_CH];55 56 struct mutex cs8409_i2c_mux;57 58 /* verb exec op override */59 int (*exec_verb)(struct hdac_device *dev, unsigned int cmd,60 unsigned int flags, unsigned int *res);61 45 }; 62 46 … … 570 554 .chain_id = CS420X_GPIO_13, 571 555 }, 572 #if def TARGET_OS2xxx556 #ifndef TARGET_OS2 573 557 [CS420X_MBP81] = { 574 558 .type = HDA_FIXUP_VERBS, … … 1246 1230 } 1247 1231 1248 /* Cirrus Logic CS8409 HDA bridge with1249 * companion codec CS42L421250 */1251 #define CS8409_VENDOR_NID 0x471252 1253 #define CS8409_CS42L42_HP_PIN_NID 0x241254 #define CS8409_CS42L42_SPK_PIN_NID 0x2c1255 #define CS8409_CS42L42_AMIC_PIN_NID 0x341256 #define CS8409_CS42L42_DMIC_PIN_NID 0x441257 #define CS8409_CS42L42_DMIC_ADC_PIN_NID 0x221258 1259 #define CS42L42_HSDET_AUTO_DONE 0x021260 #define CS42L42_HSTYPE_MASK 0x031261 1262 #define CS42L42_JACK_INSERTED 0x0C1263 #define CS42L42_JACK_REMOVED 0x001264 1265 #define GPIO3_INT (1 << 3)1266 #define GPIO4_INT (1 << 4)1267 #define GPIO5_INT (1 << 5)1268 1269 #define CS42L42_I2C_ADDR (0x48 << 1)1270 1271 #define CIR_I2C_ADDR 0x00591272 #define CIR_I2C_DATA 0x005A1273 #define CIR_I2C_CTRL 0x005B1274 #define CIR_I2C_STATUS 0x005C1275 #define CIR_I2C_QWRITE 0x005D1276 #define CIR_I2C_QREAD 0x005E1277 1278 #define CS8409_CS42L42_HP_VOL_REAL_MIN (-63)1279 #define CS8409_CS42L42_HP_VOL_REAL_MAX (0)1280 #define CS8409_CS42L42_AMIC_VOL_REAL_MIN (-97)1281 #define CS8409_CS42L42_AMIC_VOL_REAL_MAX (12)1282 #define CS8409_CS42L42_REG_HS_VOLUME_CHA (0x2301)1283 #define CS8409_CS42L42_REG_HS_VOLUME_CHB (0x2303)1284 #define CS8409_CS42L42_REG_AMIC_VOLUME (0x1D03)1285 1286 struct cs8409_i2c_param {1287 unsigned int addr;1288 unsigned int reg;1289 };1290 1291 struct cs8409_cir_param {1292 unsigned int nid;1293 unsigned int cir;1294 unsigned int coeff;1295 };1296 1297 enum {1298 CS8409_BULLSEYE,1299 CS8409_WARLOCK,1300 CS8409_CYBORG,1301 CS8409_FIXUPS,1302 };1303 1304 static void cs8409_cs42l42_fixups(struct hda_codec *codec,1305 const struct hda_fixup *fix, int action);1306 static int cs8409_cs42l42_exec_verb(struct hdac_device *dev,1307 unsigned int cmd, unsigned int flags, unsigned int *res);1308 1309 /* Dell Inspiron models with cs8409/cs42l42 */1310 static const struct hda_model_fixup cs8409_models[] = {1311 { .id = CS8409_BULLSEYE, .name = "bullseye" },1312 { .id = CS8409_WARLOCK, .name = "warlock" },1313 { .id = CS8409_CYBORG, .name = "cyborg" },1314 {0}1315 };1316 1317 /* Dell Inspiron platforms1318 * with cs8409 bridge and cs42l42 codec1319 */1320 static const struct snd_pci_quirk cs8409_fixup_tbl[] = {1321 SND_PCI_QUIRK(0x1028, 0x0A11, "Bullseye", CS8409_BULLSEYE),1322 SND_PCI_QUIRK(0x1028, 0x0A12, "Bullseye", CS8409_BULLSEYE),1323 SND_PCI_QUIRK(0x1028, 0x0A23, "Bullseye", CS8409_BULLSEYE),1324 SND_PCI_QUIRK(0x1028, 0x0A24, "Bullseye", CS8409_BULLSEYE),1325 SND_PCI_QUIRK(0x1028, 0x0A25, "Bullseye", CS8409_BULLSEYE),1326 SND_PCI_QUIRK(0x1028, 0x0A29, "Bullseye", CS8409_BULLSEYE),1327 SND_PCI_QUIRK(0x1028, 0x0A2A, "Bullseye", CS8409_BULLSEYE),1328 SND_PCI_QUIRK(0x1028, 0x0A2B, "Bullseye", CS8409_BULLSEYE),1329 SND_PCI_QUIRK(0x1028, 0x0AB0, "Warlock", CS8409_WARLOCK),1330 SND_PCI_QUIRK(0x1028, 0x0AB2, "Warlock", CS8409_WARLOCK),1331 SND_PCI_QUIRK(0x1028, 0x0AB1, "Warlock", CS8409_WARLOCK),1332 SND_PCI_QUIRK(0x1028, 0x0AB3, "Warlock", CS8409_WARLOCK),1333 SND_PCI_QUIRK(0x1028, 0x0AB4, "Warlock", CS8409_WARLOCK),1334 SND_PCI_QUIRK(0x1028, 0x0AB5, "Warlock", CS8409_WARLOCK),1335 SND_PCI_QUIRK(0x1028, 0x0AD9, "Warlock", CS8409_WARLOCK),1336 SND_PCI_QUIRK(0x1028, 0x0ADA, "Warlock", CS8409_WARLOCK),1337 SND_PCI_QUIRK(0x1028, 0x0ADB, "Warlock", CS8409_WARLOCK),1338 SND_PCI_QUIRK(0x1028, 0x0ADC, "Warlock", CS8409_WARLOCK),1339 SND_PCI_QUIRK(0x1028, 0x0AF4, "Warlock", CS8409_WARLOCK),1340 SND_PCI_QUIRK(0x1028, 0x0AF5, "Warlock", CS8409_WARLOCK),1341 SND_PCI_QUIRK(0x1028, 0x0A77, "Cyborg", CS8409_CYBORG),1342 SND_PCI_QUIRK(0x1028, 0x0A78, "Cyborg", CS8409_CYBORG),1343 SND_PCI_QUIRK(0x1028, 0x0A79, "Cyborg", CS8409_CYBORG),1344 SND_PCI_QUIRK(0x1028, 0x0A7A, "Cyborg", CS8409_CYBORG),1345 SND_PCI_QUIRK(0x1028, 0x0A7D, "Cyborg", CS8409_CYBORG),1346 SND_PCI_QUIRK(0x1028, 0x0A7E, "Cyborg", CS8409_CYBORG),1347 SND_PCI_QUIRK(0x1028, 0x0A7F, "Cyborg", CS8409_CYBORG),1348 SND_PCI_QUIRK(0x1028, 0x0A80, "Cyborg", CS8409_CYBORG),1349 SND_PCI_QUIRK(0x1028, 0x0ADF, "Cyborg", CS8409_CYBORG),1350 SND_PCI_QUIRK(0x1028, 0x0AE0, "Cyborg", CS8409_CYBORG),1351 SND_PCI_QUIRK(0x1028, 0x0AE1, "Cyborg", CS8409_CYBORG),1352 SND_PCI_QUIRK(0x1028, 0x0AE2, "Cyborg", CS8409_CYBORG),1353 SND_PCI_QUIRK(0x1028, 0x0AE9, "Cyborg", CS8409_CYBORG),1354 SND_PCI_QUIRK(0x1028, 0x0AEA, "Cyborg", CS8409_CYBORG),1355 SND_PCI_QUIRK(0x1028, 0x0AEB, "Cyborg", CS8409_CYBORG),1356 SND_PCI_QUIRK(0x1028, 0x0AEC, "Cyborg", CS8409_CYBORG),1357 SND_PCI_QUIRK(0x1028, 0x0AED, "Cyborg", CS8409_CYBORG),1358 SND_PCI_QUIRK(0x1028, 0x0AEE, "Cyborg", CS8409_CYBORG),1359 SND_PCI_QUIRK(0x1028, 0x0AEF, "Cyborg", CS8409_CYBORG),1360 SND_PCI_QUIRK(0x1028, 0x0AF0, "Cyborg", CS8409_CYBORG),1361 {0} /* terminator */1362 };1363 1364 static const struct hda_verb cs8409_cs42l42_init_verbs[] = {1365 { 0x01, AC_VERB_SET_GPIO_WAKE_MASK, 0x0018 }, /* WAKE from GPIO 3,4 */1366 { 0x47, AC_VERB_SET_PROC_STATE, 0x0001 }, /* Enable VPW processing */1367 { 0x47, AC_VERB_SET_COEF_INDEX, 0x0002 }, /* Configure GPIO 6,7 */1368 { 0x47, AC_VERB_SET_PROC_COEF, 0x0080 }, /* I2C mode */1369 { 0x47, AC_VERB_SET_COEF_INDEX, 0x005b }, /* Set I2C bus speed */1370 { 0x47, AC_VERB_SET_PROC_COEF, 0x0200 }, /* 100kHz I2C_STO = 2 */1371 {0} /* terminator */1372 };1373 1374 static const struct hda_pintbl cs8409_cs42l42_pincfgs[] = {1375 { 0x24, 0x042120f0 }, /* ASP-1-TX */1376 { 0x34, 0x04a12050 }, /* ASP-1-RX */1377 { 0x2c, 0x901000f0 }, /* ASP-2-TX */1378 { 0x44, 0x90a00090 }, /* DMIC-1 */1379 {0} /* terminator */1380 };1381 1382 static const struct hda_fixup cs8409_fixups[] = {1383 [CS8409_BULLSEYE] = {1384 .type = HDA_FIXUP_PINS,1385 .v.pins = cs8409_cs42l42_pincfgs,1386 .chained = true,1387 .chain_id = CS8409_FIXUPS,1388 },1389 [CS8409_WARLOCK] = {1390 .type = HDA_FIXUP_PINS,1391 .v.pins = cs8409_cs42l42_pincfgs,1392 .chained = true,1393 .chain_id = CS8409_FIXUPS,1394 },1395 [CS8409_CYBORG] = {1396 .type = HDA_FIXUP_PINS,1397 .v.pins = cs8409_cs42l42_pincfgs,1398 .chained = true,1399 .chain_id = CS8409_FIXUPS,1400 },1401 [CS8409_FIXUPS] = {1402 .type = HDA_FIXUP_FUNC,1403 .v.func = cs8409_cs42l42_fixups,1404 },1405 };1406 1407 /* Vendor specific HW configuration for CS42L42 */1408 static const struct cs8409_i2c_param cs42l42_init_reg_seq[] = {1409 { 0x1010, 0xB0 },1410 { 0x1D01, 0x00 },1411 { 0x1D02, 0x06 },1412 { 0x1D03, 0x00 },1413 { 0x1107, 0x01 },1414 { 0x1009, 0x02 },1415 { 0x1007, 0x03 },1416 { 0x1201, 0x00 },1417 { 0x1208, 0x13 },1418 { 0x1205, 0xFF },1419 { 0x1206, 0x00 },1420 { 0x1207, 0x20 },1421 { 0x1202, 0x0D },1422 { 0x2A02, 0x02 },1423 { 0x2A03, 0x00 },1424 { 0x2A04, 0x00 },1425 { 0x2A05, 0x02 },1426 { 0x2A06, 0x00 },1427 { 0x2A07, 0x20 },1428 { 0x2A08, 0x02 },1429 { 0x2A09, 0x00 },1430 { 0x2A0A, 0x80 },1431 { 0x2A0B, 0x02 },1432 { 0x2A0C, 0x00 },1433 { 0x2A0D, 0xA0 },1434 { 0x2A01, 0x0C },1435 { 0x2902, 0x01 },1436 { 0x2903, 0x02 },1437 { 0x2904, 0x00 },1438 { 0x2905, 0x00 },1439 { 0x2901, 0x01 },1440 { 0x1101, 0x0A },1441 { 0x1102, 0x84 },1442 { 0x2301, 0x00 },1443 { 0x2303, 0x00 },1444 { 0x2302, 0x3f },1445 { 0x2001, 0x03 },1446 { 0x1B75, 0xB6 },1447 { 0x1B73, 0xC2 },1448 { 0x1129, 0x01 },1449 { 0x1121, 0xF3 },1450 { 0x1103, 0x20 },1451 { 0x1105, 0x00 },1452 { 0x1112, 0xC0 },1453 { 0x1113, 0x80 },1454 { 0x1C03, 0xC0 },1455 { 0x1105, 0x00 },1456 { 0x1112, 0xC0 },1457 { 0x1101, 0x02 },1458 {0} /* Terminator */1459 };1460 1461 /* Vendor specific hw configuration for CS8409 */1462 static const struct cs8409_cir_param cs8409_cs42l42_hw_cfg[] = {1463 { 0x47, 0x00, 0xb008 }, /* +PLL1/2_EN, +I2C_EN */1464 { 0x47, 0x01, 0x0002 }, /* ASP1/2_EN=0, ASP1_STP=1 */1465 { 0x47, 0x02, 0x0a80 }, /* ASP1/2_BUS_IDLE=10, +GPIO_I2C */1466 { 0x47, 0x19, 0x0800 }, /* ASP1.A: TX.LAP=0, TX.LSZ=24 bits, TX.LCS=0 */1467 { 0x47, 0x1a, 0x0820 }, /* ASP1.A: TX.RAP=0, TX.RSZ=24 bits, TX.RCS=32 */1468 { 0x47, 0x29, 0x0800 }, /* ASP2.A: TX.LAP=0, TX.LSZ=24 bits, TX.LCS=0 */1469 { 0x47, 0x2a, 0x2800 }, /* ASP2.A: TX.RAP=1, TX.RSZ=24 bits, TX.RCS=0 */1470 { 0x47, 0x39, 0x0800 }, /* ASP1.A: RX.LAP=0, RX.LSZ=24 bits, RX.LCS=0 */1471 { 0x47, 0x3a, 0x0800 }, /* ASP1.A: RX.RAP=0, RX.RSZ=24 bits, RX.RCS=0 */1472 { 0x47, 0x03, 0x8000 }, /* ASP1: LCHI = 00h */1473 { 0x47, 0x04, 0x28ff }, /* ASP1: MC/SC_SRCSEL=PLL1, LCPR=FFh */1474 { 0x47, 0x05, 0x0062 }, /* ASP1: MCEN=0, FSD=011, SCPOL_IN/OUT=0, SCDIV=1:4 */1475 { 0x47, 0x06, 0x801f }, /* ASP2: LCHI=1Fh */1476 { 0x47, 0x07, 0x283f }, /* ASP2: MC/SC_SRCSEL=PLL1, LCPR=3Fh */1477 { 0x47, 0x08, 0x805c }, /* ASP2: 5050=1, MCEN=0, FSD=010, SCPOL_IN/OUT=1, SCDIV=1:16 */1478 { 0x47, 0x09, 0x0023 }, /* DMIC1_MO=10b, DMIC1/2_SR=1 */1479 { 0x47, 0x0a, 0x0000 }, /* ASP1/2_BEEP=0 */1480 { 0x47, 0x01, 0x0062 }, /* ASP1/2_EN=1, ASP1_STP=1 */1481 { 0x47, 0x00, 0x9008 }, /* -PLL2_EN */1482 { 0x47, 0x68, 0x0000 }, /* TX2.A: pre-scale att.=0 dB */1483 { 0x47, 0x82, 0xfc03 }, /* ASP1/2_xxx_EN=1, ASP1/2_MCLK_EN=0, DMIC1_SCL_EN=1 */1484 { 0x47, 0xc0, 0x9999 }, /* test mode on */1485 { 0x47, 0xc5, 0x0000 }, /* GPIO hysteresis = 30 us */1486 { 0x47, 0xc0, 0x0000 }, /* test mode off */1487 {0} /* Terminator */1488 };1489 1490 static const struct cs8409_cir_param cs8409_cs42l42_bullseye_atn[] = {1491 { 0x47, 0x65, 0x4000 }, /* EQ_SEL=1, EQ1/2_EN=0 */1492 { 0x47, 0x64, 0x4000 }, /* +EQ_ACC */1493 { 0x47, 0x65, 0x4010 }, /* +EQ2_EN */1494 { 0x47, 0x63, 0x0647 }, /* EQ_DATA_HI=0x0647 */1495 { 0x47, 0x64, 0xc0c7 }, /* +EQ_WRT, +EQ_ACC, EQ_ADR=0, EQ_DATA_LO=0x67 */1496 { 0x47, 0x63, 0x0647 }, /* EQ_DATA_HI=0x0647 */1497 { 0x47, 0x64, 0xc1c7 }, /* +EQ_WRT, +EQ_ACC, EQ_ADR=1, EQ_DATA_LO=0x67 */1498 { 0x47, 0x63, 0xf370 }, /* EQ_DATA_HI=0xf370 */1499 { 0x47, 0x64, 0xc271 }, /* +EQ_WRT, +EQ_ACC, EQ_ADR=2, EQ_DATA_LO=0x71 */1500 { 0x47, 0x63, 0x1ef8 }, /* EQ_DATA_HI=0x1ef8 */1501 { 0x47, 0x64, 0xc348 }, /* +EQ_WRT, +EQ_ACC, EQ_ADR=3, EQ_DATA_LO=0x48 */1502 { 0x47, 0x63, 0xc110 }, /* EQ_DATA_HI=0xc110 */1503 { 0x47, 0x64, 0xc45a }, /* +EQ_WRT, +EQ_ACC, EQ_ADR=4, EQ_DATA_LO=0x5a */1504 { 0x47, 0x63, 0x1f29 }, /* EQ_DATA_HI=0x1f29 */1505 { 0x47, 0x64, 0xc574 }, /* +EQ_WRT, +EQ_ACC, EQ_ADR=5, EQ_DATA_LO=0x74 */1506 { 0x47, 0x63, 0x1d7a }, /* EQ_DATA_HI=0x1d7a */1507 { 0x47, 0x64, 0xc653 }, /* +EQ_WRT, +EQ_ACC, EQ_ADR=6, EQ_DATA_LO=0x53 */1508 { 0x47, 0x63, 0xc38c }, /* EQ_DATA_HI=0xc38c */1509 { 0x47, 0x64, 0xc714 }, /* +EQ_WRT, +EQ_ACC, EQ_ADR=7, EQ_DATA_LO=0x14 */1510 { 0x47, 0x63, 0x1ca3 }, /* EQ_DATA_HI=0x1ca3 */1511 { 0x47, 0x64, 0xc8c7 }, /* +EQ_WRT, +EQ_ACC, EQ_ADR=8, EQ_DATA_LO=0xc7 */1512 { 0x47, 0x63, 0xc38c }, /* EQ_DATA_HI=0xc38c */1513 { 0x47, 0x64, 0xc914 }, /* +EQ_WRT, +EQ_ACC, EQ_ADR=9, EQ_DATA_LO=0x14 */1514 { 0x47, 0x64, 0x0000 }, /* -EQ_ACC, -EQ_WRT */1515 {0} /* Terminator */1516 };1517 1518 /**1519 * cs8409_enable_i2c_clock - Enable I2C clocks1520 * @codec: the codec instance1521 * @enable: Enable or disable I2C clocks1522 *1523 * Enable or Disable I2C clocks.1524 */1525 static void cs8409_enable_i2c_clock(struct hda_codec *codec, unsigned int enable)1526 {1527 unsigned int retval;1528 unsigned int newval;1529 1530 retval = cs_vendor_coef_get(codec, 0x0);1531 newval = (enable) ? (retval | 0x8) : (retval & 0xfffffff7);1532 cs_vendor_coef_set(codec, 0x0, newval);1533 }1534 1535 /**1536 * cs8409_i2c_wait_complete - Wait for I2C transaction1537 * @codec: the codec instance1538 *1539 * Wait for I2C transaction to complete.1540 * Return -1 if transaction wait times out.1541 */1542 static int cs8409_i2c_wait_complete(struct hda_codec *codec)1543 {1544 int repeat = 5;1545 unsigned int retval;1546 1547 do {1548 retval = cs_vendor_coef_get(codec, CIR_I2C_STATUS);1549 if ((retval & 0x18) != 0x18) {1550 usleep_range(2000, 4000);1551 --repeat;1552 } else1553 return 0;1554 1555 } while (repeat);1556 1557 return -1;1558 }1559 1560 /**1561 * cs8409_i2c_read - CS8409 I2C Read.1562 * @codec: the codec instance1563 * @i2c_address: I2C Address1564 * @i2c_reg: Register to read1565 * @paged: Is a paged transaction1566 *1567 * CS8409 I2C Read.1568 * Returns negative on error, otherwise returns read value in bits 0-7.1569 */1570 static int cs8409_i2c_read(struct hda_codec *codec,1571 unsigned int i2c_address,1572 unsigned int i2c_reg,1573 unsigned int paged)1574 {1575 unsigned int i2c_reg_data;1576 unsigned int read_data;1577 1578 cs8409_enable_i2c_clock(codec, 1);1579 cs_vendor_coef_set(codec, CIR_I2C_ADDR, i2c_address);1580 1581 if (paged) {1582 cs_vendor_coef_set(codec, CIR_I2C_QWRITE, i2c_reg >> 8);1583 if (cs8409_i2c_wait_complete(codec) < 0) {1584 codec_err(codec,1585 "%s() Paged Transaction Failed 0x%02x : 0x%04x\n",1586 __func__, i2c_address, i2c_reg);1587 return -EIO;1588 }1589 }1590 1591 i2c_reg_data = (i2c_reg << 8) & 0x0ffff;1592 cs_vendor_coef_set(codec, CIR_I2C_QREAD, i2c_reg_data);1593 if (cs8409_i2c_wait_complete(codec) < 0) {1594 codec_err(codec, "%s() Transaction Failed 0x%02x : 0x%04x\n",1595 __func__, i2c_address, i2c_reg);1596 return -EIO;1597 }1598 1599 /* Register in bits 15-8 and the data in 7-0 */1600 read_data = cs_vendor_coef_get(codec, CIR_I2C_QREAD);1601 1602 cs8409_enable_i2c_clock(codec, 0);1603 1604 return read_data & 0x0ff;1605 }1606 1607 /**1608 * cs8409_i2c_write - CS8409 I2C Write.1609 * @codec: the codec instance1610 * @i2c_address: I2C Address1611 * @i2c_reg: Register to write to1612 * @i2c_data: Data to write1613 * @paged: Is a paged transaction1614 *1615 * CS8409 I2C Write.1616 * Returns negative on error, otherwise returns 0.1617 */1618 static int cs8409_i2c_write(struct hda_codec *codec,1619 unsigned int i2c_address, unsigned int i2c_reg,1620 unsigned int i2c_data,1621 unsigned int paged)1622 {1623 unsigned int i2c_reg_data;1624 1625 cs8409_enable_i2c_clock(codec, 1);1626 cs_vendor_coef_set(codec, CIR_I2C_ADDR, i2c_address);1627 1628 if (paged) {1629 cs_vendor_coef_set(codec, CIR_I2C_QWRITE, i2c_reg >> 8);1630 if (cs8409_i2c_wait_complete(codec) < 0) {1631 codec_err(codec,1632 "%s() Paged Transaction Failed 0x%02x : 0x%04x\n",1633 __func__, i2c_address, i2c_reg);1634 return -EIO;1635 }1636 }1637 1638 i2c_reg_data = ((i2c_reg << 8) & 0x0ff00) | (i2c_data & 0x0ff);1639 cs_vendor_coef_set(codec, CIR_I2C_QWRITE, i2c_reg_data);1640 1641 if (cs8409_i2c_wait_complete(codec) < 0) {1642 codec_err(codec, "%s() Transaction Failed 0x%02x : 0x%04x\n",1643 __func__, i2c_address, i2c_reg);1644 return -EIO;1645 }1646 1647 cs8409_enable_i2c_clock(codec, 0);1648 1649 return 0;1650 }1651 1652 static int cs8409_cs42l42_volume_info(struct snd_kcontrol *kcontrol,1653 struct snd_ctl_elem_info *uinfo)1654 {1655 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);1656 u16 nid = get_amp_nid(kcontrol);1657 u8 chs = get_amp_channels(kcontrol);1658 1659 codec_dbg(codec, "%s() nid: %d\n", __func__, nid);1660 switch (nid) {1661 case CS8409_CS42L42_HP_PIN_NID:1662 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;1663 uinfo->count = chs == 3 ? 2 : 1;1664 uinfo->value.integer.min = CS8409_CS42L42_HP_VOL_REAL_MIN;1665 uinfo->value.integer.max = CS8409_CS42L42_HP_VOL_REAL_MAX;1666 break;1667 case CS8409_CS42L42_AMIC_PIN_NID:1668 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;1669 uinfo->count = chs == 3 ? 2 : 1;1670 uinfo->value.integer.min = CS8409_CS42L42_AMIC_VOL_REAL_MIN;1671 uinfo->value.integer.max = CS8409_CS42L42_AMIC_VOL_REAL_MAX;1672 break;1673 default:1674 break;1675 }1676 return 0;1677 }1678 1679 static void cs8409_cs42l42_update_volume(struct hda_codec *codec)1680 {1681 struct cs_spec *spec = codec->spec;1682 int data;1683 1684 mutex_lock(&spec->cs8409_i2c_mux);1685 data = cs8409_i2c_read(codec, CS42L42_I2C_ADDR,1686 CS8409_CS42L42_REG_HS_VOLUME_CHA, 1);1687 if (data >= 0)1688 spec->cs42l42_hp_volume[0] = -data;1689 else1690 spec->cs42l42_hp_volume[0] = CS8409_CS42L42_HP_VOL_REAL_MIN;1691 data = cs8409_i2c_read(codec, CS42L42_I2C_ADDR,1692 CS8409_CS42L42_REG_HS_VOLUME_CHB, 1);1693 if (data >= 0)1694 spec->cs42l42_hp_volume[1] = -data;1695 else1696 spec->cs42l42_hp_volume[1] = CS8409_CS42L42_HP_VOL_REAL_MIN;1697 data = cs8409_i2c_read(codec, CS42L42_I2C_ADDR,1698 CS8409_CS42L42_REG_AMIC_VOLUME, 1);1699 if (data >= 0)1700 spec->cs42l42_hs_mic_volume[0] = -data;1701 else1702 spec->cs42l42_hs_mic_volume[0] = CS8409_CS42L42_AMIC_VOL_REAL_MIN;1703 mutex_unlock(&spec->cs8409_i2c_mux);1704 spec->cs42l42_volume_init = 1;1705 }1706 1707 static int cs8409_cs42l42_volume_get(struct snd_kcontrol *kcontrol,1708 struct snd_ctl_elem_value *ucontrol)1709 {1710 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);1711 struct cs_spec *spec = codec->spec;1712 hda_nid_t nid = get_amp_nid(kcontrol);1713 int chs = get_amp_channels(kcontrol);1714 long *valp = ucontrol->value.integer.value;1715 1716 if (!spec->cs42l42_volume_init) {1717 snd_hda_power_up(codec);1718 cs8409_cs42l42_update_volume(codec);1719 snd_hda_power_down(codec);1720 }1721 switch (nid) {1722 case CS8409_CS42L42_HP_PIN_NID:1723 if (chs & BIT(0))1724 *valp++ = spec->cs42l42_hp_volume[0];1725 if (chs & BIT(1))1726 *valp++ = spec->cs42l42_hp_volume[1];1727 break;1728 case CS8409_CS42L42_AMIC_PIN_NID:1729 if (chs & BIT(0))1730 *valp++ = spec->cs42l42_hs_mic_volume[0];1731 break;1732 default:1733 break;1734 }1735 return 0;1736 }1737 1738 static int cs8409_cs42l42_volume_put(struct snd_kcontrol *kcontrol,1739 struct snd_ctl_elem_value *ucontrol)1740 {1741 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);1742 struct cs_spec *spec = codec->spec;1743 hda_nid_t nid = get_amp_nid(kcontrol);1744 int chs = get_amp_channels(kcontrol);1745 long *valp = ucontrol->value.integer.value;1746 int change = 0;1747 char vol;1748 1749 snd_hda_power_up(codec);1750 switch (nid) {1751 case CS8409_CS42L42_HP_PIN_NID:1752 mutex_lock(&spec->cs8409_i2c_mux);1753 if (chs & BIT(0)) {1754 vol = -(*valp);1755 change = cs8409_i2c_write(codec, CS42L42_I2C_ADDR,1756 CS8409_CS42L42_REG_HS_VOLUME_CHA, vol, 1);1757 valp++;1758 }1759 if (chs & BIT(1)) {1760 vol = -(*valp);1761 change |= cs8409_i2c_write(codec, CS42L42_I2C_ADDR,1762 CS8409_CS42L42_REG_HS_VOLUME_CHB, vol, 1);1763 }1764 mutex_unlock(&spec->cs8409_i2c_mux);1765 break;1766 case CS8409_CS42L42_AMIC_PIN_NID:1767 mutex_lock(&spec->cs8409_i2c_mux);1768 if (chs & BIT(0)) {1769 change = cs8409_i2c_write(1770 codec, CS42L42_I2C_ADDR,1771 CS8409_CS42L42_REG_AMIC_VOLUME, (char)*valp, 1);1772 valp++;1773 }1774 mutex_unlock(&spec->cs8409_i2c_mux);1775 break;1776 default:1777 break;1778 }1779 cs8409_cs42l42_update_volume(codec);1780 snd_hda_power_down(codec);1781 return change;1782 }1783 1784 static const DECLARE_TLV_DB_SCALE(1785 cs8409_cs42l42_hp_db_scale,1786 CS8409_CS42L42_HP_VOL_REAL_MIN * 100, 100, 1);1787 1788 static const DECLARE_TLV_DB_SCALE(1789 cs8409_cs42l42_amic_db_scale,1790 CS8409_CS42L42_AMIC_VOL_REAL_MIN * 100, 100, 1);1791 1792 static const struct snd_kcontrol_new cs8409_cs42l42_hp_volume_mixer = {1793 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,1794 .index = 0,1795 .name = "Headphone Playback Volume",1796 .subdevice = (HDA_SUBDEV_AMP_FLAG | HDA_SUBDEV_NID_FLAG),1797 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE1798 | SNDRV_CTL_ELEM_ACCESS_TLV_READ),1799 .info = cs8409_cs42l42_volume_info,1800 .get = cs8409_cs42l42_volume_get,1801 .put = cs8409_cs42l42_volume_put,1802 .tlv = { .p = cs8409_cs42l42_hp_db_scale },1803 .private_value = HDA_COMPOSE_AMP_VAL(1804 CS8409_CS42L42_HP_PIN_NID, 3, 0, HDA_OUTPUT)1805 | HDA_AMP_VAL_MIN_MUTE1806 };1807 1808 static const struct snd_kcontrol_new cs8409_cs42l42_amic_volume_mixer = {1809 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,1810 .index = 0,1811 .name = "Mic Capture Volume",1812 .subdevice = (HDA_SUBDEV_AMP_FLAG | HDA_SUBDEV_NID_FLAG),1813 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE1814 | SNDRV_CTL_ELEM_ACCESS_TLV_READ),1815 .info = cs8409_cs42l42_volume_info,1816 .get = cs8409_cs42l42_volume_get,1817 .put = cs8409_cs42l42_volume_put,1818 .tlv = { .p = cs8409_cs42l42_amic_db_scale },1819 .private_value = HDA_COMPOSE_AMP_VAL(1820 CS8409_CS42L42_AMIC_PIN_NID, 1, 0, HDA_INPUT)1821 | HDA_AMP_VAL_MIN_MUTE1822 };1823 1824 /* Assert/release RTS# line to CS42L42 */1825 static void cs8409_cs42l42_reset(struct hda_codec *codec)1826 {1827 struct cs_spec *spec = codec->spec;1828 1829 /* Assert RTS# line */1830 snd_hda_codec_write(codec,1831 codec->core.afg, 0, AC_VERB_SET_GPIO_DATA, 0);1832 /* wait ~10ms */1833 usleep_range(10000, 15000);1834 /* Release RTS# line */1835 snd_hda_codec_write(codec,1836 codec->core.afg, 0, AC_VERB_SET_GPIO_DATA, GPIO5_INT);1837 /* wait ~10ms */1838 usleep_range(10000, 15000);1839 1840 mutex_lock(&spec->cs8409_i2c_mux);1841 1842 /* Clear interrupts, by reading interrupt status registers */1843 cs8409_i2c_read(codec, CS42L42_I2C_ADDR, 0x1308, 1);1844 cs8409_i2c_read(codec, CS42L42_I2C_ADDR, 0x1309, 1);1845 cs8409_i2c_read(codec, CS42L42_I2C_ADDR, 0x130A, 1);1846 cs8409_i2c_read(codec, CS42L42_I2C_ADDR, 0x130F, 1);1847 1848 mutex_unlock(&spec->cs8409_i2c_mux);1849 1850 }1851 1852 /* Configure CS42L42 slave codec for jack autodetect */1853 static void cs8409_cs42l42_enable_jack_detect(struct hda_codec *codec)1854 {1855 struct cs_spec *spec = codec->spec;1856 1857 mutex_lock(&spec->cs8409_i2c_mux);1858 1859 /* Set TIP_SENSE_EN for analog front-end of tip sense. */1860 cs8409_i2c_write(codec, CS42L42_I2C_ADDR, 0x1b70, 0x0020, 1);1861 /* Clear WAKE# */1862 cs8409_i2c_write(codec, CS42L42_I2C_ADDR, 0x1b71, 0x0001, 1);1863 /* Wait ~2.5ms */1864 usleep_range(2500, 3000);1865 /* Set mode WAKE# output follows the combination logic directly */1866 cs8409_i2c_write(codec, CS42L42_I2C_ADDR, 0x1b71, 0x0020, 1);1867 /* Clear interrupts status */1868 cs8409_i2c_read(codec, CS42L42_I2C_ADDR, 0x130f, 1);1869 cs8409_i2c_read(codec, CS42L42_I2C_ADDR, 0x1b7b, 1);1870 /* Enable interrupt */1871 cs8409_i2c_write(codec, CS42L42_I2C_ADDR, 0x1320, 0x03, 1);1872 cs8409_i2c_write(codec, CS42L42_I2C_ADDR, 0x1b79, 0x00, 1);1873 1874 mutex_unlock(&spec->cs8409_i2c_mux);1875 }1876 1877 /* Enable and run CS42L42 slave codec jack auto detect */1878 static void cs8409_cs42l42_run_jack_detect(struct hda_codec *codec)1879 {1880 struct cs_spec *spec = codec->spec;1881 1882 mutex_lock(&spec->cs8409_i2c_mux);1883 1884 /* Clear interrupts */1885 cs8409_i2c_read(codec, CS42L42_I2C_ADDR, 0x1308, 1);1886 cs8409_i2c_read(codec, CS42L42_I2C_ADDR, 0x1b77, 1);1887 1888 cs8409_i2c_write(codec, CS42L42_I2C_ADDR, 0x1102, 0x87, 1);1889 cs8409_i2c_write(codec, CS42L42_I2C_ADDR, 0x1f06, 0x86, 1);1890 cs8409_i2c_write(codec, CS42L42_I2C_ADDR, 0x1b74, 0x07, 1);1891 cs8409_i2c_write(codec, CS42L42_I2C_ADDR, 0x131b, 0x01, 1);1892 cs8409_i2c_write(codec, CS42L42_I2C_ADDR, 0x1120, 0x80, 1);1893 /* Wait ~110ms*/1894 usleep_range(110000, 200000);1895 cs8409_i2c_write(codec, CS42L42_I2C_ADDR, 0x111f, 0x77, 1);1896 cs8409_i2c_write(codec, CS42L42_I2C_ADDR, 0x1120, 0xc0, 1);1897 /* Wait ~10ms */1898 usleep_range(10000, 25000);1899 1900 mutex_unlock(&spec->cs8409_i2c_mux);1901 1902 }1903 1904 static void cs8409_cs42l42_reg_setup(struct hda_codec *codec)1905 {1906 const struct cs8409_i2c_param *seq = cs42l42_init_reg_seq;1907 struct cs_spec *spec = codec->spec;1908 1909 mutex_lock(&spec->cs8409_i2c_mux);1910 1911 for (; seq->addr; seq++)1912 cs8409_i2c_write(codec, CS42L42_I2C_ADDR, seq->addr, seq->reg, 1);1913 1914 mutex_unlock(&spec->cs8409_i2c_mux);1915 1916 }1917 1918 /*1919 * In the case of CS8409 we do not have unsolicited events from NID's 0x241920 * and 0x34 where hs mic and hp are connected. Companion codec CS42L42 will1921 * generate interrupt via gpio 4 to notify jack events. We have to overwrite1922 * generic snd_hda_jack_unsol_event(), read CS42L42 jack detect status registers1923 * and then notify status via generic snd_hda_jack_unsol_event() call.1924 */1925 static void cs8409_jack_unsol_event(struct hda_codec *codec, unsigned int res)1926 {1927 struct cs_spec *spec = codec->spec;1928 int status_changed = 0;1929 int reg_cdc_status;1930 int reg_hs_status;1931 int reg_ts_status;1932 int type;1933 struct hda_jack_tbl *jk;1934 1935 /* jack_unsol_event() will be called every time gpio line changing state.1936 * In this case gpio4 line goes up as a result of reading interrupt status1937 * registers in previous cs8409_jack_unsol_event() call.1938 * We don't need to handle this event, ignoring...1939 */1940 if ((res & (1 << 4)))1941 return;1942 1943 mutex_lock(&spec->cs8409_i2c_mux);1944 1945 /* Read jack detect status registers */1946 reg_cdc_status = cs8409_i2c_read(codec, CS42L42_I2C_ADDR, 0x1308, 1);1947 reg_hs_status = cs8409_i2c_read(codec, CS42L42_I2C_ADDR, 0x1124, 1);1948 reg_ts_status = cs8409_i2c_read(codec, CS42L42_I2C_ADDR, 0x130f, 1);1949 1950 /* Clear interrupts, by reading interrupt status registers */1951 cs8409_i2c_read(codec, CS42L42_I2C_ADDR, 0x1b7b, 1);1952 1953 mutex_unlock(&spec->cs8409_i2c_mux);1954 1955 /* If status values are < 0, read error has occurred. */1956 if (reg_cdc_status < 0 || reg_hs_status < 0 || reg_ts_status < 0)1957 return;1958 1959 /* HSDET_AUTO_DONE */1960 if (reg_cdc_status & CS42L42_HSDET_AUTO_DONE) {1961 1962 type = ((reg_hs_status & CS42L42_HSTYPE_MASK) + 1);1963 /* CS42L42 reports optical jack as type 41964 * We don't handle optical jack1965 */1966 if (type != 4) {1967 if (!spec->cs42l42_hp_jack_in) {1968 status_changed = 1;1969 spec->cs42l42_hp_jack_in = 1;1970 }1971 /* type = 3 has no mic */1972 if ((!spec->cs42l42_mic_jack_in) && (type != 3)) {1973 status_changed = 1;1974 spec->cs42l42_mic_jack_in = 1;1975 }1976 } else {1977 if (spec->cs42l42_hp_jack_in || spec->cs42l42_mic_jack_in) {1978 status_changed = 1;1979 spec->cs42l42_hp_jack_in = 0;1980 spec->cs42l42_mic_jack_in = 0;1981 }1982 }1983 1984 } else {1985 /* TIP_SENSE INSERT/REMOVE */1986 switch (reg_ts_status) {1987 case CS42L42_JACK_INSERTED:1988 cs8409_cs42l42_run_jack_detect(codec);1989 break;1990 1991 case CS42L42_JACK_REMOVED:1992 if (spec->cs42l42_hp_jack_in || spec->cs42l42_mic_jack_in) {1993 status_changed = 1;1994 spec->cs42l42_hp_jack_in = 0;1995 spec->cs42l42_mic_jack_in = 0;1996 }1997 break;1998 1999 default:2000 /* jack in transition */2001 status_changed = 0;2002 break;2003 }2004 }2005 2006 if (status_changed) {2007 2008 snd_hda_set_pin_ctl(codec, CS8409_CS42L42_SPK_PIN_NID,2009 spec->cs42l42_hp_jack_in ? 0 : PIN_OUT);2010 2011 /* Report jack*/2012 jk = snd_hda_jack_tbl_get_mst(codec, CS8409_CS42L42_HP_PIN_NID, 0);2013 if (jk) {2014 snd_hda_jack_unsol_event(codec,2015 (jk->tag << AC_UNSOL_RES_TAG_SHIFT) & AC_UNSOL_RES_TAG);2016 }2017 /* Report jack*/2018 jk = snd_hda_jack_tbl_get_mst(codec, CS8409_CS42L42_AMIC_PIN_NID, 0);2019 if (jk) {2020 snd_hda_jack_unsol_event(codec,2021 (jk->tag << AC_UNSOL_RES_TAG_SHIFT) & AC_UNSOL_RES_TAG);2022 }2023 }2024 }2025 2026 #ifdef CONFIG_PM2027 /* Manage PDREF, when transition to D3hot */2028 static int cs8409_suspend(struct hda_codec *codec)2029 {2030 struct cs_spec *spec = codec->spec;2031 2032 mutex_lock(&spec->cs8409_i2c_mux);2033 /* Power down CS42L42 ASP/EQ/MIX/HP */2034 cs8409_i2c_write(codec, CS42L42_I2C_ADDR, 0x1101, 0xfe, 1);2035 mutex_unlock(&spec->cs8409_i2c_mux);2036 /* Assert CS42L42 RTS# line */2037 snd_hda_codec_write(codec,2038 codec->core.afg, 0, AC_VERB_SET_GPIO_DATA, 0);2039 2040 snd_hda_shutup_pins(codec);2041 2042 return 0;2043 }2044 #endif2045 2046 /* Enable/Disable Unsolicited Response for gpio(s) 3,4 */2047 static void cs8409_enable_ur(struct hda_codec *codec, int flag)2048 {2049 /* GPIO4 INT# and GPIO3 WAKE# */2050 snd_hda_codec_write(codec, codec->core.afg,2051 0, AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK,2052 flag ? (GPIO3_INT | GPIO4_INT) : 0);2053 2054 snd_hda_codec_write(codec, codec->core.afg,2055 0, AC_VERB_SET_UNSOLICITED_ENABLE,2056 flag ? AC_UNSOL_ENABLED : 0);2057 2058 }2059 2060 /* Vendor specific HW configuration2061 * PLL, ASP, I2C, SPI, GPIOs, DMIC etc...2062 */2063 static void cs8409_cs42l42_hw_init(struct hda_codec *codec)2064 {2065 const struct cs8409_cir_param *seq = cs8409_cs42l42_hw_cfg;2066 const struct cs8409_cir_param *seq_bullseye = cs8409_cs42l42_bullseye_atn;2067 struct cs_spec *spec = codec->spec;2068 2069 if (spec->gpio_mask) {2070 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_MASK,2071 spec->gpio_mask);2072 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DIRECTION,2073 spec->gpio_dir);2074 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,2075 spec->gpio_data);2076 }2077 2078 for (; seq->nid; seq++)2079 cs_vendor_coef_set(codec, seq->cir, seq->coeff);2080 2081 if (codec->fixup_id == CS8409_BULLSEYE)2082 for (; seq_bullseye->nid; seq_bullseye++)2083 cs_vendor_coef_set(codec, seq_bullseye->cir, seq_bullseye->coeff);2084 2085 /* Disable Unsolicited Response during boot */2086 cs8409_enable_ur(codec, 0);2087 2088 /* Reset CS42L42 */2089 cs8409_cs42l42_reset(codec);2090 2091 /* Initialise CS42L42 companion codec */2092 cs8409_cs42l42_reg_setup(codec);2093 2094 if (codec->fixup_id == CS8409_WARLOCK ||2095 codec->fixup_id == CS8409_CYBORG) {2096 /* FULL_SCALE_VOL = 0 for Warlock / Cyborg */2097 mutex_lock(&spec->cs8409_i2c_mux);2098 cs8409_i2c_write(codec, CS42L42_I2C_ADDR, 0x2001, 0x01, 1);2099 mutex_unlock(&spec->cs8409_i2c_mux);2100 /* DMIC1_MO=00b, DMIC1/2_SR=1 */2101 cs_vendor_coef_set(codec, 0x09, 0x0003);2102 }2103 2104 /* Restore Volumes after Resume */2105 if (spec->cs42l42_volume_init) {2106 mutex_lock(&spec->cs8409_i2c_mux);2107 cs8409_i2c_write(codec, CS42L42_I2C_ADDR,2108 CS8409_CS42L42_REG_HS_VOLUME_CHA,2109 -spec->cs42l42_hp_volume[0],2110 1);2111 cs8409_i2c_write(codec, CS42L42_I2C_ADDR,2112 CS8409_CS42L42_REG_HS_VOLUME_CHB,2113 -spec->cs42l42_hp_volume[1],2114 1);2115 cs8409_i2c_write(codec, CS42L42_I2C_ADDR,2116 CS8409_CS42L42_REG_AMIC_VOLUME,2117 spec->cs42l42_hs_mic_volume[0],2118 1);2119 mutex_unlock(&spec->cs8409_i2c_mux);2120 }2121 2122 cs8409_cs42l42_update_volume(codec);2123 2124 cs8409_cs42l42_enable_jack_detect(codec);2125 2126 /* Enable Unsolicited Response */2127 cs8409_enable_ur(codec, 1);2128 }2129 2130 static int cs8409_cs42l42_init(struct hda_codec *codec)2131 {2132 int ret = snd_hda_gen_init(codec);2133 2134 if (!ret)2135 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT);2136 2137 return ret;2138 }2139 2140 static const struct hda_codec_ops cs8409_cs42l42_patch_ops = {2141 .build_controls = cs_build_controls,2142 .build_pcms = snd_hda_gen_build_pcms,2143 .init = cs8409_cs42l42_init,2144 .free = cs_free,2145 .unsol_event = cs8409_jack_unsol_event,2146 #ifdef CONFIG_PM2147 .suspend = cs8409_suspend,2148 #endif2149 };2150 2151 static void cs8409_cs42l42_fixups(struct hda_codec *codec,2152 const struct hda_fixup *fix, int action)2153 {2154 struct cs_spec *spec = codec->spec;2155 int caps;2156 2157 switch (action) {2158 case HDA_FIXUP_ACT_PRE_PROBE:2159 snd_hda_add_verbs(codec, cs8409_cs42l42_init_verbs);2160 /* verb exec op override */2161 spec->exec_verb = codec->core.exec_verb;2162 codec->core.exec_verb = cs8409_cs42l42_exec_verb;2163 2164 mutex_init(&spec->cs8409_i2c_mux);2165 2166 codec->patch_ops = cs8409_cs42l42_patch_ops;2167 2168 spec->gen.suppress_auto_mute = 1;2169 spec->gen.no_primary_hp = 1;2170 spec->gen.suppress_vmaster = 1;2171 2172 /* GPIO 5 out, 3,4 in */2173 spec->gpio_dir = GPIO5_INT;2174 spec->gpio_data = 0;2175 spec->gpio_mask = 0x03f;2176 2177 spec->cs42l42_hp_jack_in = 0;2178 spec->cs42l42_mic_jack_in = 0;2179 2180 /* Basic initial sequence for specific hw configuration */2181 snd_hda_sequence_write(codec, cs8409_cs42l42_init_verbs);2182 2183 /* CS8409 is simple HDA bridge and intended to be used with a remote2184 * companion codec. Most of input/output PIN(s) have only basic2185 * capabilities. NID(s) 0x24 and 0x34 have only OUTC and INC2186 * capabilities and no presence detect capable (PDC) and call to2187 * snd_hda_gen_build_controls() will mark them as non detectable2188 * phantom jacks. However, in this configuration companion codec2189 * CS42L42 is connected to these pins and it has jack detect2190 * capabilities. We have to override pin capabilities,2191 * otherwise they will not be created as input devices.2192 */2193 caps = snd_hdac_read_parm(&codec->core, CS8409_CS42L42_HP_PIN_NID,2194 AC_PAR_PIN_CAP);2195 if (caps >= 0)2196 snd_hdac_override_parm(&codec->core,2197 CS8409_CS42L42_HP_PIN_NID, AC_PAR_PIN_CAP,2198 (caps | (AC_PINCAP_IMP_SENSE | AC_PINCAP_PRES_DETECT)));2199 2200 caps = snd_hdac_read_parm(&codec->core, CS8409_CS42L42_AMIC_PIN_NID,2201 AC_PAR_PIN_CAP);2202 if (caps >= 0)2203 snd_hdac_override_parm(&codec->core,2204 CS8409_CS42L42_AMIC_PIN_NID, AC_PAR_PIN_CAP,2205 (caps | (AC_PINCAP_IMP_SENSE | AC_PINCAP_PRES_DETECT)));2206 2207 snd_hda_override_wcaps(codec, CS8409_CS42L42_HP_PIN_NID,2208 (get_wcaps(codec, CS8409_CS42L42_HP_PIN_NID) | AC_WCAP_UNSOL_CAP));2209 2210 snd_hda_override_wcaps(codec, CS8409_CS42L42_AMIC_PIN_NID,2211 (get_wcaps(codec, CS8409_CS42L42_AMIC_PIN_NID) | AC_WCAP_UNSOL_CAP));2212 break;2213 case HDA_FIXUP_ACT_PROBE:2214 2215 /* Set initial DMIC volume to -26 dB */2216 snd_hda_codec_amp_init_stereo(codec, CS8409_CS42L42_DMIC_ADC_PIN_NID,2217 HDA_INPUT, 0, 0xff, 0x19);2218 snd_hda_gen_add_kctl(&spec->gen,2219 NULL, &cs8409_cs42l42_hp_volume_mixer);2220 snd_hda_gen_add_kctl(&spec->gen,2221 NULL, &cs8409_cs42l42_amic_volume_mixer);2222 cs8409_cs42l42_hw_init(codec);2223 snd_hda_codec_set_name(codec, "CS8409/CS42L42");2224 break;2225 case HDA_FIXUP_ACT_INIT:2226 cs8409_cs42l42_hw_init(codec);2227 fallthrough;2228 case HDA_FIXUP_ACT_BUILD:2229 /* Run jack auto detect first time on boot2230 * after controls have been added, to check if jack has2231 * been already plugged in.2232 * Run immediately after init.2233 */2234 cs8409_cs42l42_run_jack_detect(codec);2235 usleep_range(100000, 150000);2236 break;2237 default:2238 break;2239 }2240 }2241 2242 static int cs8409_cs42l42_exec_verb(struct hdac_device *dev,2243 unsigned int cmd, unsigned int flags, unsigned int *res)2244 {2245 struct hda_codec *codec = container_of(dev, struct hda_codec, core);2246 struct cs_spec *spec = codec->spec;2247 2248 unsigned int nid = ((cmd >> 20) & 0x07f);2249 unsigned int verb = ((cmd >> 8) & 0x0fff);2250 2251 /* CS8409 pins have no AC_PINSENSE_PRESENCE2252 * capabilities. We have to intercept 2 calls for pins 0x24 and 0x342253 * and return correct pin sense values for read_pin_sense() call from2254 * hda_jack based on CS42L42 jack detect status.2255 */2256 switch (nid) {2257 case CS8409_CS42L42_HP_PIN_NID:2258 if (verb == AC_VERB_GET_PIN_SENSE) {2259 *res = (spec->cs42l42_hp_jack_in) ? AC_PINSENSE_PRESENCE : 0;2260 return 0;2261 }2262 break;2263 2264 case CS8409_CS42L42_AMIC_PIN_NID:2265 if (verb == AC_VERB_GET_PIN_SENSE) {2266 *res = (spec->cs42l42_mic_jack_in) ? AC_PINSENSE_PRESENCE : 0;2267 return 0;2268 }2269 break;2270 2271 default:2272 break;2273 }2274 2275 return spec->exec_verb(dev, cmd, flags, res);2276 }2277 2278 static int patch_cs8409(struct hda_codec *codec)2279 {2280 int err;2281 2282 if (!cs_alloc_spec(codec, CS8409_VENDOR_NID))2283 return -ENOMEM;2284 2285 snd_hda_pick_fixup(codec,2286 cs8409_models, cs8409_fixup_tbl, cs8409_fixups);2287 2288 codec_dbg(codec, "Picked ID=%d, VID=%08x, DEV=%08x\n",2289 codec->fixup_id,2290 codec->bus->pci->subsystem_vendor,2291 codec->bus->pci->subsystem_device);2292 2293 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);2294 2295 err = cs_parse_auto_config(codec);2296 if (err < 0) {2297 cs_free(codec);2298 return err;2299 }2300 2301 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);2302 return 0;2303 }2304 2305 1232 /* 2306 1233 * patch entries … … 2312 1239 HDA_CODEC_ENTRY(0x10134210, "CS4210", patch_cs4210), 2313 1240 HDA_CODEC_ENTRY(0x10134213, "CS4213", patch_cs4213), 2314 HDA_CODEC_ENTRY(0x10138409, "CS8409", patch_cs8409),2315 1241 {0} /* terminator */ 2316 1242 }; -
GPL/trunk/alsa-kernel/pci/hda/patch_conexant.c
r695 r717 184 184 } 185 185 186 static void cx_auto_ reboot_notify(struct hda_codec *codec)186 static void cx_auto_shutdown(struct hda_codec *codec) 187 187 { 188 188 struct conexant_spec *spec = codec->spec; … … 191 191 from the internal speaker during (and after) reboot */ 192 192 cx_auto_turn_eapd(codec, spec->num_eapds, spec->eapds, false); 193 snd_hda_gen_reboot_notify(codec);194 193 } 195 194 196 195 static void cx_auto_free(struct hda_codec *codec) 197 196 { 198 cx_auto_ reboot_notify(codec);197 cx_auto_shutdown(codec); 199 198 snd_hda_gen_free(codec); 200 199 } 200 201 #ifdef CONFIG_PM 202 static int cx_auto_suspend(struct hda_codec *codec) 203 { 204 cx_auto_shutdown(codec); 205 return 0; 206 } 207 #endif 201 208 202 209 static const struct hda_codec_ops cx_auto_patch_ops = { … … 204 211 .build_pcms = snd_hda_gen_build_pcms, 205 212 .init = cx_auto_init, 206 .reboot_notify = cx_auto_reboot_notify,207 213 .free = cx_auto_free, 208 214 .unsol_event = snd_hda_jack_unsol_event, 209 215 #ifdef CONFIG_PM 216 .suspend = cx_auto_suspend, 210 217 .check_power_status = snd_hda_gen_check_power_status, 211 218 #endif … … 998 1005 SND_PCI_QUIRK(0x103c, 0x8299, "HP 800 G3 SFF", CXT_FIXUP_HP_MIC_NO_PRESENCE), 999 1006 SND_PCI_QUIRK(0x103c, 0x829a, "HP 800 G3 DM", CXT_FIXUP_HP_MIC_NO_PRESENCE), 1007 SND_PCI_QUIRK(0x103c, 0x82b4, "HP ProDesk 600 G3", CXT_FIXUP_HP_MIC_NO_PRESENCE), 1000 1008 SND_PCI_QUIRK(0x103c, 0x836e, "HP ProBook 455 G5", CXT_FIXUP_MUTE_LED_GPIO), 1001 1009 SND_PCI_QUIRK(0x103c, 0x837f, "HP ProBook 470 G5", CXT_FIXUP_MUTE_LED_GPIO), … … 1106 1114 cxt5051_fixups, cxt_fixups); 1107 1115 break; 1116 case 0x14f15098: 1117 codec->pin_amp_workaround = 1; 1118 spec->gen.mixer_nid = 0x22; 1119 spec->gen.add_stereo_mix_input = HDA_HINT_STEREO_MIX_AUTO; 1120 snd_hda_pick_fixup(codec, cxt5066_fixup_models, 1121 cxt5066_fixups, cxt_fixups); 1122 break; 1108 1123 case 0x14f150f2: 1109 1124 codec->power_save_node = 1; … … 1126 1141 goto error; 1127 1142 1128 err = snd_hda_gen_parse_auto_config(codec, &spec->gen.autocfg);1143 err = cx_auto_parse_beep(codec); 1129 1144 if (err < 0) 1130 1145 goto error; 1131 1146 1132 err = cx_auto_parse_beep(codec);1147 err = snd_hda_gen_parse_auto_config(codec, &spec->gen.autocfg); 1133 1148 if (err < 0) 1134 1149 goto error; -
GPL/trunk/alsa-kernel/pci/hda/patch_hdmi.c
r709 r717 59 59 module_param(enable_silent_stream, bool, 0644); 60 60 MODULE_PARM_DESC(enable_silent_stream, "Enable Silent Stream for HDMI devices"); 61 62 static bool enable_all_pins; 63 module_param(enable_all_pins, bool, 0444); 64 MODULE_PARM_DESC(enable_all_pins, "Forcibly enable all pins"); 61 65 62 66 struct hdmi_spec_per_cvt { … … 1396 1400 last_try: 1397 1401 /* the last try; check the empty slots in pins */ 1398 for (i = 0; i < spec-> num_nids; i++) {1402 for (i = 0; i < spec->pcm_used; i++) { 1399 1403 if (!test_bit(i, &spec->pcm_bitmap)) 1400 1404 return i; … … 1626 1630 struct hdmi_spec *spec = codec->spec; 1627 1631 struct hdmi_eld *eld = &spec->temp_eld; 1632 struct device *dev = hda_codec_dev(codec); 1628 1633 hda_nid_t pin_nid = per_pin->pin_nid; 1629 1634 int dev_id = per_pin->dev_id; … … 1639 1644 int ret; 1640 1645 1646 #ifdef CONFIG_PM 1647 if (dev->power.runtime_status == RPM_SUSPENDING) 1648 return; 1649 #endif 1650 1641 1651 ret = snd_hda_power_up_pm(codec); 1642 if (ret < 0 && pm_runtime_suspended( hda_codec_dev(codec)))1652 if (ret < 0 && pm_runtime_suspended(dev)) 1643 1653 goto out; 1644 1654 … … 1972 1982 } 1973 1983 1984 if (enable_all_pins) 1985 spec->force_connect = true; 1986 1974 1987 q = snd_pci_quirk_lookup(codec->bus->pci, force_connect_list); 1975 1988 … … 2269 2282 */ 2270 2283 2271 if (codec->mst_no_extra_pcms) 2284 if (spec->dyn_pcm_no_legacy && codec->mst_no_extra_pcms) 2285 pcm_num = spec->num_cvts; 2286 else if (codec->mst_no_extra_pcms) 2272 2287 pcm_num = spec->num_nids; 2273 2288 else … … 2965 2980 /* Intel Haswell and onwards; audio component with eld notifier */ 2966 2981 static int intel_hsw_common_init(struct hda_codec *codec, hda_nid_t vendor_nid, 2967 const int *port_map, int port_num, int dev_num) 2982 const int *port_map, int port_num, int dev_num, 2983 bool send_silent_stream) 2968 2984 { 2969 2985 struct hdmi_spec *spec; … … 2998 3014 * module param or Kconfig option 2999 3015 */ 3000 if ( enable_silent_stream)3016 if (send_silent_stream) 3001 3017 spec->send_silent_stream = true; 3002 3018 … … 3006 3022 static int patch_i915_hsw_hdmi(struct hda_codec *codec) 3007 3023 { 3008 return intel_hsw_common_init(codec, 0x08, NULL, 0, 3); 3024 return intel_hsw_common_init(codec, 0x08, NULL, 0, 3, 3025 enable_silent_stream); 3009 3026 } 3010 3027 3011 3028 static int patch_i915_glk_hdmi(struct hda_codec *codec) 3012 3029 { 3013 return intel_hsw_common_init(codec, 0x0b, NULL, 0, 3); 3030 /* 3031 * Silent stream calls audio component .get_power() from 3032 * .pin_eld_notify(). On GLK this will deadlock in i915 due 3033 * to the audio vs. CDCLK workaround. 3034 */ 3035 return intel_hsw_common_init(codec, 0x0b, NULL, 0, 3, false); 3014 3036 } 3015 3037 … … 3022 3044 static const int map[] = {0x0, 0x4, 0x6, 0x8, 0xa, 0xb}; 3023 3045 3024 return intel_hsw_common_init(codec, 0x02, map, ARRAY_SIZE(map), 3); 3046 return intel_hsw_common_init(codec, 0x02, map, ARRAY_SIZE(map), 3, 3047 enable_silent_stream); 3025 3048 } 3026 3049 … … 3034 3057 int ret; 3035 3058 3036 ret = intel_hsw_common_init(codec, 0x02, map, ARRAY_SIZE(map), 4); 3059 ret = intel_hsw_common_init(codec, 0x02, map, ARRAY_SIZE(map), 4, 3060 enable_silent_stream); 3037 3061 if (!ret) { 3038 3062 struct hdmi_spec *spec = codec->spec; … … 4398 4422 HDA_CODEC_ENTRY(0x80862814, "DG1 HDMI", patch_i915_tgl_hdmi), 4399 4423 HDA_CODEC_ENTRY(0x80862815, "Alderlake HDMI", patch_i915_tgl_hdmi), 4400 HDA_CODEC_ENTRY(0x8086281c, "Alderlake-P HDMI", patch_i915_tgl_hdmi),4401 4424 HDA_CODEC_ENTRY(0x80862816, "Rocketlake HDMI", patch_i915_tgl_hdmi), 4425 HDA_CODEC_ENTRY(0x80862819, "DG2 HDMI", patch_i915_tgl_hdmi), 4402 4426 HDA_CODEC_ENTRY(0x8086281a, "Jasperlake HDMI", patch_i915_icl_hdmi), 4403 4427 HDA_CODEC_ENTRY(0x8086281b, "Elkhartlake HDMI", patch_i915_icl_hdmi), 4428 HDA_CODEC_ENTRY(0x8086281c, "Alderlake-P HDMI", patch_i915_tgl_hdmi), 4404 4429 HDA_CODEC_ENTRY(0x80862880, "CedarTrail HDMI", patch_generic_hdmi), 4405 4430 HDA_CODEC_ENTRY(0x80862882, "Valleyview2 HDMI", patch_i915_byt_hdmi), -
GPL/trunk/alsa-kernel/pci/hda/patch_realtek.c
r703 r717 103 103 struct alc_coef_led mute_led_coef; 104 104 struct alc_coef_led mic_led_coef; 105 struct mutex coef_mutex; 105 106 106 107 hda_nid_t headset_mic_pin; … … 115 116 #endif 116 117 void (*shutup)(struct hda_codec *codec); 117 void (*reboot_notify)(struct hda_codec *codec);118 118 119 119 int init_amp; … … 139 139 */ 140 140 141 static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid, 142 unsigned int coef_idx) 141 static void coef_mutex_lock(struct hda_codec *codec) 142 { 143 struct alc_spec *spec = codec->spec; 144 145 snd_hda_power_up_pm(codec); 146 mutex_lock(&spec->coef_mutex); 147 } 148 149 static void coef_mutex_unlock(struct hda_codec *codec) 150 { 151 struct alc_spec *spec = codec->spec; 152 153 mutex_unlock(&spec->coef_mutex); 154 snd_hda_power_down_pm(codec); 155 } 156 157 static int __alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid, 158 unsigned int coef_idx) 143 159 { 144 160 unsigned int val; … … 149 165 } 150 166 167 static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid, 168 unsigned int coef_idx) 169 { 170 unsigned int val; 171 172 coef_mutex_lock(codec); 173 val = __alc_read_coefex_idx(codec, nid, coef_idx); 174 coef_mutex_unlock(codec); 175 return val; 176 } 177 151 178 #define alc_read_coef_idx(codec, coef_idx) \ 152 179 alc_read_coefex_idx(codec, 0x20, coef_idx) 153 180 181 static void __alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid, 182 unsigned int coef_idx, unsigned int coef_val) 183 { 184 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx); 185 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PROC_COEF, coef_val); 186 } 187 154 188 static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid, 155 189 unsigned int coef_idx, unsigned int coef_val) 156 190 { 157 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx); 158 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PROC_COEF, coef_val); 191 coef_mutex_lock(codec); 192 __alc_write_coefex_idx(codec, nid, coef_idx, coef_val); 193 coef_mutex_unlock(codec); 159 194 } 160 195 161 196 #define alc_write_coef_idx(codec, coef_idx, coef_val) \ 162 197 alc_write_coefex_idx(codec, 0x20, coef_idx, coef_val) 198 199 static void __alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid, 200 unsigned int coef_idx, unsigned int mask, 201 unsigned int bits_set) 202 { 203 unsigned int val = __alc_read_coefex_idx(codec, nid, coef_idx); 204 205 if (val != -1) 206 __alc_write_coefex_idx(codec, nid, coef_idx, 207 (val & ~mask) | bits_set); 208 } 163 209 164 210 static void alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid, … … 166 212 unsigned int bits_set) 167 213 { 168 unsigned int val = alc_read_coefex_idx(codec, nid, coef_idx); 169 170 if (val != -1) 171 alc_write_coefex_idx(codec, nid, coef_idx, 172 (val & ~mask) | bits_set); 214 coef_mutex_lock(codec); 215 __alc_update_coefex_idx(codec, nid, coef_idx, mask, bits_set); 216 coef_mutex_unlock(codec); 173 217 } 174 218 … … 203 247 const struct coef_fw *fw) 204 248 { 249 coef_mutex_lock(codec); 205 250 for (; fw->nid; fw++) { 206 251 if (fw->mask == (unsigned short)-1) 207 alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val);252 __alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val); 208 253 else 209 alc_update_coefex_idx(codec, fw->nid, fw->idx, 210 fw->mask, fw->val); 211 } 254 __alc_update_coefex_idx(codec, fw->nid, fw->idx, 255 fw->mask, fw->val); 256 } 257 coef_mutex_unlock(codec); 212 258 } 213 259 … … 400 446 case 0x10ec0255: 401 447 case 0x10ec0256: 448 case 0x19e58326: 402 449 case 0x10ec0257: 403 450 case 0x10ec0282: … … 535 582 536 583 switch (codec->core.vendor_id) { 584 case 0x10ec0236: 585 case 0x10ec0256: 586 case 0x19e58326: 537 587 case 0x10ec0283: 538 588 case 0x10ec0286: … … 893 943 } 894 944 945 #define alc_free snd_hda_gen_free 946 947 #ifdef CONFIG_PM 895 948 static inline void alc_shutup(struct hda_codec *codec) 896 949 { … … 906 959 } 907 960 908 static void alc_reboot_notify(struct hda_codec *codec)909 {910 struct alc_spec *spec = codec->spec;911 912 if (spec && spec->reboot_notify)913 spec->reboot_notify(codec);914 else915 alc_shutup(codec);916 }917 918 #define alc_free snd_hda_gen_free919 920 #ifdef CONFIG_PM921 961 static void alc_power_eapd(struct hda_codec *codec) 922 962 { … … 932 972 return 0; 933 973 } 934 #endif 935 936 #ifdef CONFIG_PM 974 937 975 static int alc_resume(struct hda_codec *codec) 938 976 { … … 961 999 .check_power_status = snd_hda_gen_check_power_status, 962 1000 #endif 963 .reboot_notify = alc_reboot_notify,964 1001 }; 965 1002 … … 1167 1204 codec->forced_resume = 1; 1168 1205 codec->patch_ops = alc_patch_ops; 1206 mutex_init(&spec->coef_mutex); 1169 1207 1170 1208 err = alc_codec_rename_from_preset(codec); … … 2295 2333 ALC887_FIXUP_BASS_CHMAP, 2296 2334 ALC1220_FIXUP_GB_DUAL_CODECS, 2335 ALC1220_FIXUP_GB_X570, 2297 2336 ALC1220_FIXUP_CLEVO_P950, 2298 2337 ALC1220_FIXUP_CLEVO_PB51ED, … … 2300 2339 ALC887_FIXUP_ASUS_AUDIO, 2301 2340 ALC887_FIXUP_ASUS_HMIC, 2341 ALCS1200A_FIXUP_MIC_VREF, 2302 2342 }; 2303 2343 … … 2480 2520 "Rear-Panel Capture Switch" : 2481 2521 "Front-Panel Capture Switch"); 2522 break; 2523 } 2524 } 2525 2526 static void alc1220_fixup_gb_x570(struct hda_codec *codec, 2527 const struct hda_fixup *fix, 2528 int action) 2529 { 2530 static const hda_nid_t conn1[] = { 0x0c }; 2531 static const struct coef_fw gb_x570_coefs[] = { 2532 WRITE_COEF(0x07, 0x03c0), 2533 WRITE_COEF(0x1a, 0x01c1), 2534 WRITE_COEF(0x1b, 0x0202), 2535 WRITE_COEF(0x43, 0x3005), 2536 {0} 2537 }; 2538 2539 switch (action) { 2540 case HDA_FIXUP_ACT_PRE_PROBE: 2541 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1); 2542 snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1); 2543 break; 2544 case HDA_FIXUP_ACT_INIT: 2545 alc_process_coef_fw(codec, gb_x570_coefs); 2482 2546 break; 2483 2547 } … … 2972 3036 .v.func = alc1220_fixup_gb_dual_codecs, 2973 3037 }, 3038 [ALC1220_FIXUP_GB_X570] = { 3039 .type = HDA_FIXUP_FUNC, 3040 .v.func = alc1220_fixup_gb_x570, 3041 }, 2974 3042 [ALC1220_FIXUP_CLEVO_P950] = { 2975 3043 .type = HDA_FIXUP_FUNC, … … 3005 3073 .chain_id = ALC887_FIXUP_ASUS_AUDIO, 3006 3074 }, 3075 #ifdef TARGET_OS2xxx 3076 [ALCS1200A_FIXUP_MIC_VREF] = { 3077 .type = HDA_FIXUP_PINCTLS, 3078 .v.pins = (const struct hda_pintbl[]) { 3079 { 0x18, PIN_VREF50 }, /* rear mic */ 3080 { 0x19, PIN_VREF50 }, /* front mic */ 3081 {} 3082 } 3083 }, 3084 #endif 3007 3085 }; 3008 3086 … … 3042 3120 SND_PCI_QUIRK(0x1043, 0x84bc, "ASUS ET2700", ALC887_FIXUP_ASUS_BASS), 3043 3121 SND_PCI_QUIRK(0x1043, 0x8691, "ASUS ROG Ranger VIII", ALC882_FIXUP_GPIO3), 3122 SND_PCI_QUIRK(0x1043, 0x8797, "ASUS TUF B550M-PLUS", ALCS1200A_FIXUP_MIC_VREF), 3044 3123 SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP), 3045 3124 SND_PCI_QUIRK(0x104d, 0x9044, "Sony VAIO AiO", ALC882_FIXUP_NO_PRIMARY_HP), … … 3076 3155 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE), 3077 3156 SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS), 3078 SND_PCI_QUIRK(0x1458, 0xa0cd, "Gigabyte X570 Aorus Master", ALC1220_FIXUP_CLEVO_P950), 3079 SND_PCI_QUIRK(0x1458, 0xa0ce, "Gigabyte X570 Aorus Xtreme", ALC1220_FIXUP_CLEVO_P950), 3157 SND_PCI_QUIRK(0x1458, 0xa0cd, "Gigabyte X570 Aorus Master", ALC1220_FIXUP_GB_X570), 3158 SND_PCI_QUIRK(0x1458, 0xa0ce, "Gigabyte X570 Aorus Xtreme", ALC1220_FIXUP_GB_X570), 3159 SND_PCI_QUIRK(0x1458, 0xa0d5, "Gigabyte X570S Aorus Master", ALC1220_FIXUP_GB_X570), 3080 3160 SND_PCI_QUIRK(0x1462, 0x11f7, "MSI-GE63", ALC1220_FIXUP_CLEVO_P950), 3081 3161 SND_PCI_QUIRK(0x1462, 0x1228, "MSI-GP63", ALC1220_FIXUP_CLEVO_P950), … … 3094 3174 SND_PCI_QUIRK(0x1558, 0x65e1, "Clevo PB51[ED][DF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS), 3095 3175 SND_PCI_QUIRK(0x1558, 0x65e5, "Clevo PC50D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS), 3176 SND_PCI_QUIRK(0x1558, 0x65f1, "Clevo PC50HS", ALC1220_FIXUP_CLEVO_PB51ED_PINS), 3177 SND_PCI_QUIRK(0x1558, 0x65f5, "Clevo PD50PN[NRT]", ALC1220_FIXUP_CLEVO_PB51ED_PINS), 3096 3178 SND_PCI_QUIRK(0x1558, 0x67d1, "Clevo PB71[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS), 3097 3179 SND_PCI_QUIRK(0x1558, 0x67e1, "Clevo PB71[DE][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS), 3098 3180 SND_PCI_QUIRK(0x1558, 0x67e5, "Clevo PC70D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS), 3181 SND_PCI_QUIRK(0x1558, 0x67f1, "Clevo PC70H[PRS]", ALC1220_FIXUP_CLEVO_PB51ED_PINS), 3182 SND_PCI_QUIRK(0x1558, 0x67f5, "Clevo PD70PN[NRT]", ALC1220_FIXUP_CLEVO_PB51ED_PINS), 3099 3183 SND_PCI_QUIRK(0x1558, 0x70d1, "Clevo PC70[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS), 3100 SND_PCI_QUIRK(0x1558, 0x7714, "Clevo X170", ALC1220_FIXUP_CLEVO_PB51ED_PINS), 3184 SND_PCI_QUIRK(0x1558, 0x7714, "Clevo X170SM", ALC1220_FIXUP_CLEVO_PB51ED_PINS), 3185 SND_PCI_QUIRK(0x1558, 0x7715, "Clevo X170KM-G", ALC1220_FIXUP_CLEVO_PB51ED), 3101 3186 SND_PCI_QUIRK(0x1558, 0x9501, "Clevo P950HR", ALC1220_FIXUP_CLEVO_P950), 3102 3187 SND_PCI_QUIRK(0x1558, 0x9506, "Clevo P955HQ", ALC1220_FIXUP_CLEVO_P950), … … 3149 3234 {.id = ALC887_FIXUP_ASUS_BASS, .name = "asus-bass"}, 3150 3235 {.id = ALC1220_FIXUP_GB_DUAL_CODECS, .name = "dual-codecs"}, 3236 {.id = ALC1220_FIXUP_GB_X570, .name = "gb-x570"}, 3151 3237 {.id = ALC1220_FIXUP_CLEVO_P950, .name = "clevo-p950"}, 3152 3238 {0} … … 3697 3783 ALC269_TYPE_ALC215, 3698 3784 ALC269_TYPE_ALC225, 3785 ALC269_TYPE_ALC245, 3699 3786 ALC269_TYPE_ALC287, 3700 3787 ALC269_TYPE_ALC294, … … 3734 3821 case ALC269_TYPE_ALC215: 3735 3822 case ALC269_TYPE_ALC225: 3823 case ALC269_TYPE_ALC245: 3736 3824 case ALC269_TYPE_ALC287: 3737 3825 case ALC269_TYPE_ALC294: … … 3803 3891 case 0x10ec0236: 3804 3892 case 0x10ec0256: 3893 case 0x19e58326: 3805 3894 alc_write_coef_idx(codec, 0x48, 0x0); 3806 3895 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0); … … 3831 3920 case 0x10ec0236: 3832 3921 case 0x10ec0256: 3922 case 0x19e58326: 3833 3923 alc_write_coef_idx(codec, 0x48, 0xd011); 3834 3924 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045); … … 4184 4274 * when booting with headset plugged. So skip setting it for the codec alc257 4185 4275 */ 4186 if (codec->core.vendor_id != 0x10ec0257) 4276 if (codec->core.vendor_id != 0x10ec0236 && 4277 codec->core.vendor_id != 0x10ec0257) 4187 4278 alc_update_coef_idx(codec, 0x46, 0, 3 << 12); 4188 4279 … … 4262 4353 bool hp1_pin_sense, hp2_pin_sense; 4263 4354 4264 if (spec->codec_variant != ALC269_TYPE_ALC287) 4355 if (spec->codec_variant != ALC269_TYPE_ALC287 && 4356 spec->codec_variant != ALC269_TYPE_ALC245) 4265 4357 /* required only at boot or S3 and S4 resume time */ 4266 4358 #ifndef TARGET_OS2 … … 5025 5117 { 5026 5118 alc_fixup_hp_gpio_led(codec, action, 0x10, 0); 5119 } 5120 5121 static void alc245_fixup_hp_gpio_led(struct hda_codec *codec, 5122 const struct hda_fixup *fix, int action) 5123 { 5124 struct alc_spec *spec = codec->spec; 5125 5126 if (action == HDA_FIXUP_ACT_PRE_PROBE) 5127 spec->micmute_led_polarity = 1; 5128 alc_fixup_hp_gpio_led(codec, action, 0, 0x04); 5027 5129 } 5028 5130 … … 5501 5603 case 0x10ec0236: 5502 5604 case 0x10ec0256: 5605 case 0x19e58326: 5503 5606 alc_process_coef_fw(codec, coef0256); 5504 5607 break; … … 5616 5719 case 0x10ec0236: 5617 5720 case 0x10ec0256: 5721 case 0x19e58326: 5618 5722 alc_write_coef_idx(codec, 0x45, 0xc489); 5619 5723 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); … … 5766 5870 case 0x10ec0236: 5767 5871 case 0x10ec0256: 5872 case 0x19e58326: 5768 5873 alc_write_coef_idx(codec, 0x1b, 0x0e4b); 5769 5874 alc_write_coef_idx(codec, 0x45, 0xc089); … … 5865 5970 case 0x10ec0236: 5866 5971 case 0x10ec0256: 5972 case 0x19e58326: 5867 5973 alc_process_coef_fw(codec, coef0256); 5868 5974 break; … … 5979 6085 case 0x10ec0236: 5980 6086 case 0x10ec0256: 6087 case 0x19e58326: 5981 6088 alc_process_coef_fw(codec, coef0256); 5982 6089 break; … … 6080 6187 case 0x10ec0236: 6081 6188 case 0x10ec0256: 6189 case 0x19e58326: 6082 6190 alc_write_coef_idx(codec, 0x1b, 0x0e4b); 6083 6191 alc_write_coef_idx(codec, 0x06, 0x6104); … … 6376 6484 case 0x10ec0236: 6377 6485 case 0x10ec0256: 6486 case 0x19e58326: 6378 6487 alc_process_coef_fw(codec, alc256fw); 6379 6488 break; … … 6466 6575 6467 6576 if (action == HDA_FIXUP_ACT_PRE_PROBE) { 6468 spec->reboot_notify = snd_hda_gen_reboot_notify; /* reduce noise */6469 6577 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP; 6470 6578 codec->power_save_node = 0; /* avoid click noises */ … … 6980 7088 case 0x10ec0255: 6981 7089 case 0x10ec0256: 7090 case 0x19e58326: 6982 7091 alc_update_coef_idx(codec, 0x1b, 0x8000, 1 << 15); /* Reset HP JD */ 6983 7092 alc_update_coef_idx(codec, 0x1b, 0x8000, 0 << 15); … … 7110 7219 #endif /* NOT_USED */ 7111 7220 7221 /* GPIO1 = amplifier on/off 7222 * GPIO3 = mic mute LED 7223 */ 7224 static void alc285_fixup_hp_spectre_x360_eb1(struct hda_codec *codec, 7225 const struct hda_fixup *fix, int action) 7226 { 7227 static const hda_nid_t conn[] = { 0x02 }; 7228 7229 struct alc_spec *spec = codec->spec; 7230 static const struct hda_pintbl pincfgs[] = { 7231 { 0x14, 0x90170110 }, /* front/high speakers */ 7232 { 0x17, 0x90170130 }, /* back/bass speakers */ 7233 {0} 7234 }; 7235 7236 //enable micmute led 7237 alc_fixup_hp_gpio_led(codec, action, 0x00, 0x04); 7238 7239 switch (action) { 7240 case HDA_FIXUP_ACT_PRE_PROBE: 7241 spec->micmute_led_polarity = 1; 7242 /* needed for amp of back speakers */ 7243 spec->gpio_mask |= 0x01; 7244 spec->gpio_dir |= 0x01; 7245 snd_hda_apply_pincfgs(codec, pincfgs); 7246 /* share DAC to have unified volume control */ 7247 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn); 7248 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn); 7249 break; 7250 case HDA_FIXUP_ACT_INIT: 7251 /* need to toggle GPIO to enable the amp of back speakers */ 7252 alc_update_gpio_data(codec, 0x01, true); 7253 msleep(100); 7254 alc_update_gpio_data(codec, 0x01, false); 7255 break; 7256 } 7257 } 7258 7112 7259 static void alc285_fixup_hp_spectre_x360(struct hda_codec *codec, 7113 7260 const struct hda_fixup *fix, int action) … … 7138 7285 } 7139 7286 7287 /* Fixup for Lenovo Legion 15IMHg05 speaker output on headset removal. */ 7288 static void alc287_fixup_legion_15imhg05_speakers(struct hda_codec *codec, 7289 const struct hda_fixup *fix, 7290 int action) 7291 { 7292 struct alc_spec *spec = codec->spec; 7293 7294 switch (action) { 7295 case HDA_FIXUP_ACT_PRE_PROBE: 7296 spec->gen.suppress_auto_mute = 1; 7297 break; 7298 } 7299 } 7300 7140 7301 /* for alc295_fixup_hp_top_speakers */ 7141 7302 #include "hp_x360_helper.c" … … 7143 7304 /* for alc285_fixup_ideapad_s740_coef() */ 7144 7305 #include "ideapad_s740_helper.c" 7306 7307 static const struct coef_fw alc256_fixup_set_coef_defaults_coefs[] = { 7308 WRITE_COEF(0x10, 0x0020), WRITE_COEF(0x24, 0x0000), 7309 WRITE_COEF(0x26, 0x0000), WRITE_COEF(0x29, 0x3000), 7310 WRITE_COEF(0x37, 0xfe05), WRITE_COEF(0x45, 0x5089), 7311 {0} 7312 }; 7313 7314 static void alc256_fixup_set_coef_defaults(struct hda_codec *codec, 7315 const struct hda_fixup *fix, 7316 int action) 7317 { 7318 /* 7319 * A certain other OS sets these coeffs to different values. On at least 7320 * one TongFang barebone these settings might survive even a cold 7321 * reboot. So to restore a clean slate the values are explicitly reset 7322 * to default here. Without this, the external microphone is always in a 7323 * plugged-in state, while the internal microphone is always in an 7324 * unplugged state, breaking the ability to use the internal microphone. 7325 */ 7326 alc_process_coef_fw(codec, alc256_fixup_set_coef_defaults_coefs); 7327 } 7328 7329 static const struct coef_fw alc233_fixup_no_audio_jack_coefs[] = { 7330 WRITE_COEF(0x1a, 0x9003), WRITE_COEF(0x1b, 0x0e2b), WRITE_COEF(0x37, 0xfe06), 7331 WRITE_COEF(0x38, 0x4981), WRITE_COEF(0x45, 0xd489), WRITE_COEF(0x46, 0x0074), 7332 WRITE_COEF(0x49, 0x0149), 7333 {0} 7334 }; 7335 7336 static void alc233_fixup_no_audio_jack(struct hda_codec *codec, 7337 const struct hda_fixup *fix, 7338 int action) 7339 { 7340 /* 7341 * The audio jack input and output is not detected on the ASRock NUC Box 7342 * 1100 series when cold booting without this fix. Warm rebooting from a 7343 * certain other OS makes the audio functional, as COEF settings are 7344 * preserved in this case. This fix sets these altered COEF values as 7345 * the default. 7346 */ 7347 alc_process_coef_fw(codec, alc233_fixup_no_audio_jack_coefs); 7348 } 7349 7350 static void alc256_fixup_mic_no_presence_and_resume(struct hda_codec *codec, 7351 const struct hda_fixup *fix, 7352 int action) 7353 { 7354 /* 7355 * The Clevo NJ51CU comes either with the ALC293 or the ALC256 codec, 7356 * but uses the 0x8686 subproduct id in both cases. The ALC256 codec 7357 * needs an additional quirk for sound working after suspend and resume. 7358 */ 7359 if (codec->core.vendor_id == 0x10ec0256) { 7360 alc_update_coef_idx(codec, 0x10, 1<<9, 0); 7361 snd_hda_codec_set_pincfg(codec, 0x19, 0x04a11120); 7362 } else { 7363 snd_hda_codec_set_pincfg(codec, 0x1a, 0x04a1113c); 7364 } 7365 } 7145 7366 7146 7367 enum { … … 7230 7451 ALC280_FIXUP_HP_9480M, 7231 7452 ALC245_FIXUP_HP_X360_AMP, 7453 ALC285_FIXUP_HP_SPECTRE_X360_EB1, 7232 7454 ALC288_FIXUP_DELL_HEADSET_MODE, 7233 7455 ALC288_FIXUP_DELL1_MIC_NO_PRESENCE, … … 7256 7478 ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER, 7257 7479 ALC269_FIXUP_ATIV_BOOK_8, 7480 ALC221_FIXUP_HP_288PRO_MIC_NO_PRESENCE, 7258 7481 ALC221_FIXUP_HP_MIC_NO_PRESENCE, 7259 7482 ALC256_FIXUP_ASUS_HEADSET_MODE, … … 7317 7540 ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF, 7318 7541 ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, 7542 ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, 7319 7543 ALC295_FIXUP_ASUS_MIC_NO_PRESENCE, 7320 7544 ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS, … … 7342 7566 ALC287_FIXUP_HP_GPIO_LED, 7343 7567 ALC256_FIXUP_HP_HEADSET_MIC, 7568 ALC245_FIXUP_HP_GPIO_LED, 7344 7569 ALC236_FIXUP_DELL_AIO_HEADSET_MIC, 7345 7570 ALC282_FIXUP_ACER_DISABLE_LINEOUT, … … 7355 7580 ALC255_FIXUP_ACER_HEADPHONE_AND_MIC, 7356 7581 ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST, 7357 }; 7582 ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS, 7583 ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE, 7584 ALC287_FIXUP_YOGA7_14ITL_SPEAKERS, 7585 ALC298_FIXUP_LENOVO_C940_DUET7, 7586 ALC287_FIXUP_13S_GEN2_SPEAKERS, 7587 ALC256_FIXUP_SET_COEF_DEFAULTS, 7588 ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE, 7589 ALC233_FIXUP_NO_AUDIO_JACK, 7590 ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME, 7591 ALC285_FIXUP_LEGION_Y9000X_SPEAKERS, 7592 ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE, 7593 }; 7594 7595 #ifdef NOT_USED 7596 /* A special fixup for Lenovo C940 and Yoga Duet 7; 7597 * both have the very same PCI SSID, and we need to apply different fixups 7598 * depending on the codec ID 7599 */ 7600 static void alc298_fixup_lenovo_c940_duet7(struct hda_codec *codec, 7601 const struct hda_fixup *fix, 7602 int action) 7603 { 7604 int id; 7605 7606 if (codec->core.vendor_id == 0x10ec0298) 7607 id = ALC298_FIXUP_LENOVO_SPK_VOLUME; /* C940 */ 7608 else 7609 id = ALC287_FIXUP_YOGA7_14ITL_SPEAKERS; /* Duet 7 */ 7610 __snd_hda_apply_fixup(codec, id, action, 0); 7611 } 7612 #endif 7358 7613 7359 7614 #ifdef TARGET_OS2 … … 8248 8503 .type = HDA_FIXUP_FUNC, 8249 8504 .v.func = alc245_fixup_hp_x360_amp, 8505 .chained = true, 8506 .chain_id = ALC245_FIXUP_HP_GPIO_LED 8250 8507 }, 8251 8508 [ALC288_FIXUP_DELL_HEADSET_MODE] = { … … 8449 8706 }, 8450 8707 #ifdef TARGET_OS2xxx 8708 [ALC221_FIXUP_HP_288PRO_MIC_NO_PRESENCE] = { 8709 .type = HDA_FIXUP_PINS, 8710 .v.pins = (const struct hda_pintbl[]) { 8711 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */ 8712 { 0x1a, 0x01813030 }, /* use as headphone mic, without its own jack detect */ 8713 { } 8714 }, 8715 .chained = true, 8716 .chain_id = ALC269_FIXUP_HEADSET_MODE 8717 }, 8451 8718 [ALC221_FIXUP_HP_MIC_NO_PRESENCE] = { 8452 8719 .type = HDA_FIXUP_PINS, … … 8948 9215 }, 8949 9216 }, 9217 [ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET] = { 9218 .type = HDA_FIXUP_VERBS, 9219 .v.verbs = (const struct hda_verb[]) { 9220 { 0x20, AC_VERB_SET_COEF_INDEX, 0x08}, 9221 { 0x20, AC_VERB_SET_PROC_COEF, 0x2fcf}, 9222 { } 9223 }, 9224 }, 8950 9225 [ALC295_FIXUP_ASUS_MIC_NO_PRESENCE] = { 8951 9226 .type = HDA_FIXUP_PINS, … … 9227 9502 .v.func = alc285_fixup_hp_spectre_x360, 9228 9503 }, 9504 [ALC285_FIXUP_HP_SPECTRE_X360_EB1] = { 9505 .type = HDA_FIXUP_FUNC, 9506 .v.func = alc285_fixup_hp_spectre_x360_eb1 9507 }, 9229 9508 [ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP] = { 9230 9509 .type = HDA_FIXUP_FUNC, … … 9255 9534 .chained = true, 9256 9535 .chain_id = ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF, 9536 }, 9537 [ALC285_FIXUP_LEGION_Y9000X_SPEAKERS] = { 9538 .type = HDA_FIXUP_FUNC, 9539 .v.func = alc285_fixup_ideapad_s740_coef, 9540 .chained = true, 9541 .chain_id = ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE, 9542 }, 9543 [ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE] = { 9544 .type = HDA_FIXUP_FUNC, 9545 .v.func = alc287_fixup_legion_15imhg05_speakers, 9546 .chained = true, 9547 .chain_id = ALC269_FIXUP_THINKPAD_ACPI, 9548 }, 9549 #ifdef TARGET_OS2xxx 9550 [ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS] = { 9551 .type = HDA_FIXUP_VERBS, 9552 //.v.verbs = legion_15imhg05_coefs, 9553 .v.verbs = (const struct hda_verb[]) { 9554 // set left speaker Legion 7i. 9555 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 }, 9556 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 }, 9557 9558 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 }, 9559 { 0x20, AC_VERB_SET_PROC_COEF, 0xc }, 9560 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 }, 9561 { 0x20, AC_VERB_SET_PROC_COEF, 0x1a }, 9562 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 }, 9563 9564 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 }, 9565 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 }, 9566 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 }, 9567 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 }, 9568 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 }, 9569 9570 // set right speaker Legion 7i. 9571 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 }, 9572 { 0x20, AC_VERB_SET_PROC_COEF, 0x42 }, 9573 9574 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 }, 9575 { 0x20, AC_VERB_SET_PROC_COEF, 0xc }, 9576 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 }, 9577 { 0x20, AC_VERB_SET_PROC_COEF, 0x2a }, 9578 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 }, 9579 9580 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 }, 9581 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 }, 9582 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 }, 9583 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 }, 9584 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 }, 9585 {} 9586 }, 9587 .chained = true, 9588 .chain_id = ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE, 9589 }, 9590 #endif 9591 [ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE] = { 9592 .type = HDA_FIXUP_FUNC, 9593 .v.func = alc287_fixup_legion_15imhg05_speakers, 9594 .chained = true, 9595 .chain_id = ALC269_FIXUP_HEADSET_MODE, 9596 }, 9597 #ifdef TARGET_OS2xxx 9598 [ALC287_FIXUP_YOGA7_14ITL_SPEAKERS] = { 9599 .type = HDA_FIXUP_VERBS, 9600 .v.verbs = (const struct hda_verb[]) { 9601 // set left speaker Yoga 7i. 9602 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 }, 9603 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 }, 9604 9605 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 }, 9606 { 0x20, AC_VERB_SET_PROC_COEF, 0xc }, 9607 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 }, 9608 { 0x20, AC_VERB_SET_PROC_COEF, 0x1a }, 9609 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 }, 9610 9611 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 }, 9612 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 }, 9613 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 }, 9614 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 }, 9615 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 }, 9616 9617 // set right speaker Yoga 7i. 9618 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 }, 9619 { 0x20, AC_VERB_SET_PROC_COEF, 0x46 }, 9620 9621 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 }, 9622 { 0x20, AC_VERB_SET_PROC_COEF, 0xc }, 9623 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 }, 9624 { 0x20, AC_VERB_SET_PROC_COEF, 0x2a }, 9625 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 }, 9626 9627 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 }, 9628 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 }, 9629 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 }, 9630 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 }, 9631 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 }, 9632 {} 9633 }, 9634 .chained = true, 9635 .chain_id = ALC269_FIXUP_HEADSET_MODE, 9636 }, 9637 [ALC298_FIXUP_LENOVO_C940_DUET7] = { 9638 .type = HDA_FIXUP_FUNC, 9639 .v.func = alc298_fixup_lenovo_c940_duet7, 9640 }, 9641 [ALC287_FIXUP_13S_GEN2_SPEAKERS] = { 9642 .type = HDA_FIXUP_VERBS, 9643 .v.verbs = (const struct hda_verb[]) { 9644 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 }, 9645 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 }, 9646 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 }, 9647 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 }, 9648 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 }, 9649 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 }, 9650 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 }, 9651 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 }, 9652 { 0x20, AC_VERB_SET_PROC_COEF, 0x42 }, 9653 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 }, 9654 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 }, 9655 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 }, 9656 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 }, 9657 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 }, 9658 {} 9659 }, 9660 .chained = true, 9661 .chain_id = ALC269_FIXUP_HEADSET_MODE, 9662 }, 9663 #endif 9664 [ALC256_FIXUP_SET_COEF_DEFAULTS] = { 9665 .type = HDA_FIXUP_FUNC, 9666 .v.func = alc256_fixup_set_coef_defaults, 9667 }, 9668 #ifdef TARGET_OS2xxx 9669 [ALC245_FIXUP_HP_GPIO_LED] = { 9670 .type = HDA_FIXUP_FUNC, 9671 .v.func = alc245_fixup_hp_gpio_led, 9672 }, 9673 [ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = { 9674 .type = HDA_FIXUP_PINS, 9675 .v.pins = (const struct hda_pintbl[]) { 9676 { 0x19, 0x03a11120 }, /* use as headset mic, without its own jack detect */ 9677 { } 9678 }, 9679 .chained = true, 9680 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC, 9681 }, 9682 #endif 9683 [ALC233_FIXUP_NO_AUDIO_JACK] = { 9684 .type = HDA_FIXUP_FUNC, 9685 .v.func = alc233_fixup_no_audio_jack, 9686 }, 9687 [ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME] = { 9688 .type = HDA_FIXUP_FUNC, 9689 .v.func = alc256_fixup_mic_no_presence_and_resume, 9690 .chained = true, 9691 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC 9257 9692 }, 9258 9693 }; … … 9288 9723 SND_PCI_QUIRK(0x1025, 0x1291, "Acer Veriton Z4660G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC), 9289 9724 SND_PCI_QUIRK(0x1025, 0x129c, "Acer SWIFT SF314-55", ALC256_FIXUP_ACER_HEADSET_MIC), 9725 SND_PCI_QUIRK(0x1025, 0x129d, "Acer SWIFT SF313-51", ALC256_FIXUP_ACER_MIC_NO_PRESENCE), 9290 9726 SND_PCI_QUIRK(0x1025, 0x1300, "Acer SWIFT SF314-56", ALC256_FIXUP_ACER_MIC_NO_PRESENCE), 9291 9727 SND_PCI_QUIRK(0x1025, 0x1308, "Acer Aspire Z24-890", ALC286_FIXUP_ACER_AIO_HEADSET_MIC), 9292 9728 SND_PCI_QUIRK(0x1025, 0x132a, "Acer TravelMate B114-21", ALC233_FIXUP_ACER_HEADSET_MIC), 9293 9729 SND_PCI_QUIRK(0x1025, 0x1330, "Acer TravelMate X514-51T", ALC255_FIXUP_ACER_HEADSET_MIC), 9730 SND_PCI_QUIRK(0x1025, 0x141f, "Acer Spin SP513-54N", ALC255_FIXUP_ACER_MIC_NO_PRESENCE), 9294 9731 SND_PCI_QUIRK(0x1025, 0x142b, "Acer Swift SF314-42", ALC255_FIXUP_ACER_MIC_NO_PRESENCE), 9295 9732 SND_PCI_QUIRK(0x1025, 0x1430, "Acer TravelMate B311R-31", ALC256_FIXUP_ACER_MIC_NO_PRESENCE), 9296 9733 SND_PCI_QUIRK(0x1025, 0x1466, "Acer Aspire A515-56", ALC255_FIXUP_ACER_HEADPHONE_AND_MIC), 9297 9734 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z), 9735 SND_PCI_QUIRK(0x1028, 0x053c, "Dell Latitude E5430", ALC292_FIXUP_DELL_E7X), 9298 9736 SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS), 9299 9737 SND_PCI_QUIRK(0x1028, 0x05bd, "Dell Latitude E6440", ALC292_FIXUP_DELL_E7X), … … 9347 9785 SND_PCI_QUIRK(0x1028, 0x0a58, "Dell", ALC255_FIXUP_DELL_HEADSET_MIC), 9348 9786 SND_PCI_QUIRK(0x1028, 0x0a61, "Dell XPS 15 9510", ALC289_FIXUP_DUAL_SPK), 9787 SND_PCI_QUIRK(0x1028, 0x0a62, "Dell Precision 5560", ALC289_FIXUP_DUAL_SPK), 9788 SND_PCI_QUIRK(0x1028, 0x0a9d, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE), 9789 SND_PCI_QUIRK(0x1028, 0x0a9e, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE), 9790 SND_PCI_QUIRK(0x1028, 0x0b19, "Dell XPS 15 9520", ALC289_FIXUP_DUAL_SPK), 9349 9791 SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), 9350 9792 SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), … … 9406 9848 SND_PCI_QUIRK(0x103c, 0x2336, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), 9407 9849 SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), 9850 SND_PCI_QUIRK(0x103c, 0x2b5e, "HP 288 Pro G2 MT", ALC221_FIXUP_HP_288PRO_MIC_NO_PRESENCE), 9408 9851 SND_PCI_QUIRK(0x103c, 0x802e, "HP Z240 SFF", ALC221_FIXUP_HP_MIC_NO_PRESENCE), 9409 9852 SND_PCI_QUIRK(0x103c, 0x802f, "HP Z240", ALC221_FIXUP_HP_MIC_NO_PRESENCE), … … 9422 9865 SND_PCI_QUIRK(0x103c, 0x84e7, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3), 9423 9866 SND_PCI_QUIRK(0x103c, 0x8519, "HP Spectre x360 15-df0xxx", ALC285_FIXUP_HP_SPECTRE_X360), 9867 SND_PCI_QUIRK(0x103c, 0x860f, "HP ZBook 15 G6", ALC285_FIXUP_HP_GPIO_AMP_INIT), 9424 9868 SND_PCI_QUIRK(0x103c, 0x861f, "HP Elite Dragonfly G1", ALC285_FIXUP_HP_GPIO_AMP_INIT), 9425 9869 SND_PCI_QUIRK(0x103c, 0x869d, "HP", ALC236_FIXUP_HP_MUTE_LED), … … 9428 9872 SND_PCI_QUIRK(0x103c, 0x8720, "HP EliteBook x360 1040 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_AMP_INIT), 9429 9873 SND_PCI_QUIRK(0x103c, 0x8724, "HP EliteBook 850 G7", ALC285_FIXUP_HP_GPIO_LED), 9874 SND_PCI_QUIRK(0x103c, 0x8728, "HP EliteBook 840 G7", ALC285_FIXUP_HP_GPIO_LED), 9430 9875 SND_PCI_QUIRK(0x103c, 0x8729, "HP", ALC285_FIXUP_HP_GPIO_LED), 9431 9876 SND_PCI_QUIRK(0x103c, 0x8730, "HP ProBook 445 G7", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF), 9877 SND_PCI_QUIRK(0x103c, 0x8735, "HP ProBook 435 G7", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF), 9432 9878 SND_PCI_QUIRK(0x103c, 0x8736, "HP", ALC285_FIXUP_HP_GPIO_AMP_INIT), 9433 9879 SND_PCI_QUIRK(0x103c, 0x8760, "HP", ALC285_FIXUP_HP_MUTE_LED), … … 9438 9884 SND_PCI_QUIRK(0x103c, 0x8783, "HP ZBook Fury 15 G7 Mobile Workstation", 9439 9885 ALC285_FIXUP_HP_GPIO_AMP_INIT), 9886 SND_PCI_QUIRK(0x103c, 0x8787, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED), 9887 SND_PCI_QUIRK(0x103c, 0x8788, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED), 9440 9888 SND_PCI_QUIRK(0x103c, 0x87c8, "HP", ALC287_FIXUP_HP_GPIO_LED), 9441 9889 SND_PCI_QUIRK(0x103c, 0x87e5, "HP ProBook 440 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED), … … 9449 9897 SND_PCI_QUIRK(0x103c, 0x8805, "HP ProBook 650 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED), 9450 9898 SND_PCI_QUIRK(0x103c, 0x880d, "HP EliteBook 830 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED), 9899 SND_PCI_QUIRK(0x103c, 0x8811, "HP Spectre x360 15-eb1xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1), 9900 SND_PCI_QUIRK(0x103c, 0x8812, "HP Spectre x360 15-eb1xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1), 9451 9901 SND_PCI_QUIRK(0x103c, 0x8846, "HP EliteBook 850 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED), 9452 9902 SND_PCI_QUIRK(0x103c, 0x8847, "HP EliteBook x360 830 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED), … … 9462 9912 SND_PCI_QUIRK(0x103c, 0x8898, "HP EliteBook 845 G8 Notebook PC", ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST), 9463 9913 SND_PCI_QUIRK(0x103c, 0x88d0, "HP Pavilion 15-eh1xxx (mainboard 88D0)", ALC287_FIXUP_HP_GPIO_LED), 9914 SND_PCI_QUIRK(0x103c, 0x89aa, "HP EliteBook 630 G9", ALC236_FIXUP_HP_GPIO_LED), 9915 SND_PCI_QUIRK(0x103c, 0x89c3, "HP", ALC285_FIXUP_HP_GPIO_LED), 9916 SND_PCI_QUIRK(0x103c, 0x89ca, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF), 9917 SND_PCI_QUIRK(0x103c, 0x8a78, "HP Dev One", ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST), 9918 SND_PCI_QUIRK(0x103c, 0x8aa0, "HP ProBook 440 G9 (MB 8A9E)", ALC236_FIXUP_HP_GPIO_LED), 9919 SND_PCI_QUIRK(0x103c, 0x8aa3, "HP ProBook 450 G9 (MB 8AA1)", ALC236_FIXUP_HP_GPIO_LED), 9920 SND_PCI_QUIRK(0x103c, 0x8aa8, "HP EliteBook 640 G9 (MB 8AA6)", ALC236_FIXUP_HP_GPIO_LED), 9921 SND_PCI_QUIRK(0x103c, 0x8aab, "HP EliteBook 650 G9 (MB 8AA9)", ALC236_FIXUP_HP_GPIO_LED), 9464 9922 SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC), 9465 9923 SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300), … … 9487 9945 SND_PCI_QUIRK(0x1043, 0x18f1, "Asus FX505DT", ALC256_FIXUP_ASUS_HEADSET_MIC), 9488 9946 SND_PCI_QUIRK(0x1043, 0x194e, "ASUS UX563FD", ALC294_FIXUP_ASUS_HPE), 9947 SND_PCI_QUIRK(0x1043, 0x1970, "ASUS UX550VE", ALC289_FIXUP_ASUS_GA401), 9489 9948 SND_PCI_QUIRK(0x1043, 0x1982, "ASUS B1400CEPE", ALC256_FIXUP_ASUS_HPE), 9490 9949 SND_PCI_QUIRK(0x1043, 0x19ce, "ASUS B9450FA", ALC294_FIXUP_ASUS_HPE), … … 9502 9961 SND_PCI_QUIRK(0x1043, 0x1e8e, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA401), 9503 9962 SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401), 9963 SND_PCI_QUIRK(0x1043, 0x1d42, "ASUS Zephyrus G14 2022", ALC289_FIXUP_ASUS_GA401), 9964 SND_PCI_QUIRK(0x1043, 0x16b2, "ASUS GU603", ALC289_FIXUP_ASUS_GA401), 9504 9965 SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2), 9505 9966 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC), … … 9534 9995 SND_PCI_QUIRK(0x144d, 0xc812, "Samsung Notebook Pen S (NT950SBE-X58)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET), 9535 9996 SND_PCI_QUIRK(0x144d, 0xc830, "Samsung Galaxy Book Ion (NT950XCJ-X716A)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET), 9997 SND_PCI_QUIRK(0x144d, 0xc832, "Samsung Galaxy Book Flex Alpha (NP730QCJ)", ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET), 9536 9998 SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC), 9537 9999 SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC), … … 9550 10012 SND_PCI_QUIRK(0x1558, 0x40c1, "Clevo NL40[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), 9551 10013 SND_PCI_QUIRK(0x1558, 0x40d1, "Clevo NL41DU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), 10014 SND_PCI_QUIRK(0x1558, 0x5015, "Clevo NH5[58]H[HJK]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE), 10015 SND_PCI_QUIRK(0x1558, 0x5017, "Clevo NH7[79]H[HJK]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE), 9552 10016 SND_PCI_QUIRK(0x1558, 0x50a3, "Clevo NJ51GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), 9553 10017 SND_PCI_QUIRK(0x1558, 0x50b3, "Clevo NK50S[BEZ]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), … … 9555 10019 SND_PCI_QUIRK(0x1558, 0x50b8, "Clevo NK50SZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), 9556 10020 SND_PCI_QUIRK(0x1558, 0x50d5, "Clevo NP50D5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), 10021 SND_PCI_QUIRK(0x1558, 0x50e1, "Clevo NH5[58]HPQ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE), 10022 SND_PCI_QUIRK(0x1558, 0x50e2, "Clevo NH7[79]HPQ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE), 9557 10023 SND_PCI_QUIRK(0x1558, 0x50f0, "Clevo NH50A[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), 9558 10024 SND_PCI_QUIRK(0x1558, 0x50f2, "Clevo NH50E[PR]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), … … 9569 10035 SND_PCI_QUIRK(0x1558, 0x70f4, "Clevo NH77EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), 9570 10036 SND_PCI_QUIRK(0x1558, 0x70f6, "Clevo NH77DPQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), 10037 SND_PCI_QUIRK(0x1558, 0x7716, "Clevo NS50PU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE), 10038 SND_PCI_QUIRK(0x1558, 0x7718, "Clevo L140PU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE), 9571 10039 SND_PCI_QUIRK(0x1558, 0x8228, "Clevo NR40BU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), 9572 10040 SND_PCI_QUIRK(0x1558, 0x8520, "Clevo NH50D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), … … 9580 10048 SND_PCI_QUIRK(0x1558, 0x8562, "Clevo NH[57][0-9]RZ[Q]", ALC269_FIXUP_DMIC), 9581 10049 SND_PCI_QUIRK(0x1558, 0x8668, "Clevo NP50B[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), 10050 SND_PCI_QUIRK(0x1558, 0x866d, "Clevo NP5[05]PN[HJK]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE), 10051 SND_PCI_QUIRK(0x1558, 0x867c, "Clevo NP7[01]PNP", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE), 10052 SND_PCI_QUIRK(0x1558, 0x867d, "Clevo NP7[01]PN[HJK]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE), 9582 10053 SND_PCI_QUIRK(0x1558, 0x8680, "Clevo NJ50LU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), 9583 SND_PCI_QUIRK(0x1558, 0x8686, "Clevo NH50[CZ]U", ALC2 93_FIXUP_SYSTEM76_MIC_NO_PRESENCE),10054 SND_PCI_QUIRK(0x1558, 0x8686, "Clevo NH50[CZ]U", ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME), 9584 10055 SND_PCI_QUIRK(0x1558, 0x8a20, "Clevo NH55DCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), 9585 10056 SND_PCI_QUIRK(0x1558, 0x8a51, "Clevo NH70RCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), … … 9647 10118 SND_PCI_QUIRK(0x17aa, 0x3178, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC), 9648 10119 SND_PCI_QUIRK(0x17aa, 0x31af, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340), 9649 SND_PCI_QUIRK(0x17aa, 0x3818, "Lenovo C940", ALC298_FIXUP_LENOVO_SPK_VOLUME), 10120 SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo Yoga DuetITL 2021", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS), 10121 SND_PCI_QUIRK(0x17aa, 0x3813, "Legion 7i 15IMHG05", ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS), 10122 SND_PCI_QUIRK(0x17aa, 0x3818, "Lenovo C940 / Yoga Duet 7", ALC298_FIXUP_LENOVO_C940_DUET7), 10123 SND_PCI_QUIRK(0x17aa, 0x3819, "Lenovo 13s Gen2 ITL", ALC287_FIXUP_13S_GEN2_SPEAKERS), 10124 SND_PCI_QUIRK(0x17aa, 0x3820, "Yoga Duet 7 13ITL6", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS), 10125 SND_PCI_QUIRK(0x17aa, 0x3824, "Legion Y9000X 2020", ALC285_FIXUP_LEGION_Y9000X_SPEAKERS), 9650 10126 SND_PCI_QUIRK(0x17aa, 0x3827, "Ideapad S740", ALC285_FIXUP_IDEAPAD_S740_COEF), 10127 SND_PCI_QUIRK(0x17aa, 0x3834, "Lenovo IdeaPad Slim 9i 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS), 10128 SND_PCI_QUIRK(0x17aa, 0x383d, "Legion Y9000X 2019", ALC285_FIXUP_LEGION_Y9000X_SPEAKERS), 9651 10129 SND_PCI_QUIRK(0x17aa, 0x3843, "Yoga 9i", ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP), 10130 SND_PCI_QUIRK(0x17aa, 0x384a, "Lenovo Yoga 7 15ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS), 10131 SND_PCI_QUIRK(0x17aa, 0x3852, "Lenovo Yoga 7 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS), 10132 SND_PCI_QUIRK(0x17aa, 0x3853, "Lenovo Yoga 7 15ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS), 9652 10133 SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI), 9653 10134 SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC), … … 9669 10150 SND_PCI_QUIRK(0x17aa, 0x505f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK), 9670 10151 SND_PCI_QUIRK(0x17aa, 0x5062, "Thinkpad", ALC298_FIXUP_TPT470_DOCK), 10152 SND_PCI_QUIRK(0x17aa, 0x508b, "Thinkpad X12 Gen 1", ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS), 9671 10153 SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), 9672 10154 SND_PCI_QUIRK(0x17aa, 0x511e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK), 9673 10155 SND_PCI_QUIRK(0x17aa, 0x511f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK), 9674 10156 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD), 10157 SND_PCI_QUIRK(0x1849, 0x1233, "ASRock NUC Box 1100", ALC233_FIXUP_NO_AUDIO_JACK), 9675 10158 SND_PCI_QUIRK(0x19e5, 0x3204, "Huawei MACH-WX9", ALC256_FIXUP_HUAWEI_MACH_WX9_PINS), 9676 10159 SND_PCI_QUIRK(0x1b35, 0x1235, "CZC B20", ALC269_FIXUP_CZC_B20), … … 9680 10163 SND_PCI_QUIRK(0x1c06, 0x2013, "Lemote A1802", ALC269_FIXUP_LEMOTE_A1802), 9681 10164 SND_PCI_QUIRK(0x1c06, 0x2015, "Lemote A190X", ALC269_FIXUP_LEMOTE_A190X), 10165 SND_PCI_QUIRK(0x1d05, 0x1132, "TongFang PHxTxX1", ALC256_FIXUP_SET_COEF_DEFAULTS), 10166 SND_PCI_QUIRK(0x1d05, 0x1096, "TongFang GMxMRxx", ALC269_FIXUP_NO_SHUTUP), 10167 SND_PCI_QUIRK(0x1d05, 0x1100, "TongFang GKxNRxx", ALC269_FIXUP_NO_SHUTUP), 10168 SND_PCI_QUIRK(0x1d05, 0x1111, "TongFang GMxZGxx", ALC269_FIXUP_NO_SHUTUP), 10169 SND_PCI_QUIRK(0x1d05, 0x1119, "TongFang GMxZGxx", ALC269_FIXUP_NO_SHUTUP), 10170 SND_PCI_QUIRK(0x1d05, 0x1129, "TongFang GMxZGxx", ALC269_FIXUP_NO_SHUTUP), 10171 SND_PCI_QUIRK(0x1d05, 0x1147, "TongFang GMxTGxx", ALC269_FIXUP_NO_SHUTUP), 10172 SND_PCI_QUIRK(0x1d05, 0x115c, "TongFang GMxTGxx", ALC269_FIXUP_NO_SHUTUP), 10173 SND_PCI_QUIRK(0x1d05, 0x121b, "TongFang GMxAGxx", ALC269_FIXUP_NO_SHUTUP), 9682 10174 SND_PCI_QUIRK(0x1d72, 0x1602, "RedmiBook", ALC255_FIXUP_XIAOMI_HEADSET_MIC), 9683 10175 SND_PCI_QUIRK(0x1d72, 0x1701, "XiaomiNotebook Pro", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE), 9684 10176 SND_PCI_QUIRK(0x1d72, 0x1901, "RedmiBook 14", ALC256_FIXUP_ASUS_HEADSET_MIC), 10177 SND_PCI_QUIRK(0x1d72, 0x1945, "Redmi G", ALC256_FIXUP_ASUS_HEADSET_MIC), 9685 10178 SND_PCI_QUIRK(0x1d72, 0x1947, "RedmiBook Air", ALC255_FIXUP_XIAOMI_HEADSET_MIC), 9686 10179 SND_PCI_QUIRK(0x8086, 0x2074, "Intel NUC 8", ALC233_FIXUP_INTEL_NUC8_DMIC), … … 9860 10353 {.id = ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE, .name = "alc256-medion-headset"}, 9861 10354 {.id = ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, .name = "alc298-samsung-headphone"}, 10355 {.id = ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, .name = "alc256-samsung-headphone"}, 9862 10356 {.id = ALC255_FIXUP_XIAOMI_HEADSET_MIC, .name = "alc255-xiaomi-headset"}, 9863 10357 {.id = ALC274_FIXUP_HP_MIC, .name = "alc274-hp-mic-detect"}, … … 9865 10359 {.id = ALC295_FIXUP_HP_OMEN, .name = "alc295-hp-omen"}, 9866 10360 {.id = ALC285_FIXUP_HP_SPECTRE_X360, .name = "alc285-hp-spectre-x360"}, 10361 {.id = ALC285_FIXUP_HP_SPECTRE_X360_EB1, .name = "alc285-hp-spectre-x360-eb1"}, 9867 10362 {.id = ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP, .name = "alc287-ideapad-bass-spk-amp"}, 9868 10363 {.id = ALC623_FIXUP_LENOVO_THINKSTATION_P340, .name = "alc623-lenovo-thinkstation-p340"}, 9869 10364 {.id = ALC255_FIXUP_ACER_HEADPHONE_AND_MIC, .name = "alc255-acer-headphone-and-mic"}, 10365 {.id = ALC285_FIXUP_HP_GPIO_AMP_INIT, .name = "alc285-hp-amp-init"}, 9870 10366 {0} 9871 10367 }; … … 10463 10959 case 0x10ec0236: 10464 10960 case 0x10ec0256: 10961 case 0x19e58326: 10465 10962 spec->codec_variant = ALC269_TYPE_ALC256; 10466 10963 spec->shutup = alc256_shutup; … … 10478 10975 case 0x10ec0285: 10479 10976 case 0x10ec0289: 10480 spec->codec_variant = ALC269_TYPE_ALC215; 10977 if (alc_get_coef0(codec) & 0x0010) 10978 spec->codec_variant = ALC269_TYPE_ALC245; 10979 else 10980 spec->codec_variant = ALC269_TYPE_ALC215; 10481 10981 spec->shutup = alc225_shutup; 10482 10982 spec->init_hook = alc225_init; … … 11020 11520 alc_write_coef_idx(codec, 0x19, 0xa054); 11021 11521 break; 11522 } 11523 } 11524 11525 static void alc897_hp_automute_hook(struct hda_codec *codec, 11526 struct hda_jack_callback *jack) 11527 { 11528 struct alc_spec *spec = codec->spec; 11529 int vref; 11530 11531 snd_hda_gen_hp_automute(codec, jack); 11532 vref = spec->gen.hp_jack_present ? (PIN_HP | AC_PINCTL_VREF_100) : PIN_HP; 11533 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, 11534 vref); 11535 } 11536 11537 static void alc897_fixup_lenovo_headset_mic(struct hda_codec *codec, 11538 const struct hda_fixup *fix, int action) 11539 { 11540 struct alc_spec *spec = codec->spec; 11541 if (action == HDA_FIXUP_ACT_PRE_PROBE) { 11542 spec->gen.hp_automute_hook = alc897_hp_automute_hook; 11022 11543 } 11023 11544 } … … 11100 11621 ALC662_FIXUP_ACER_X2660G_HEADSET_MODE, 11101 11622 ALC662_FIXUP_ACER_NITRO_HEADSET_MODE, 11623 ALC668_FIXUP_ASUS_NO_HEADSET_MIC, 11624 ALC668_FIXUP_HEADSET_MIC, 11625 ALC668_FIXUP_MIC_DET_COEF, 11626 ALC897_FIXUP_LENOVO_HEADSET_MIC, 11627 ALC897_FIXUP_HEADSET_MIC_PIN, 11628 ALC897_FIXUP_HP_HSMIC_VERB, 11102 11629 }; 11103 11630 … … 11666 12193 .chained = true, 11667 12194 .chain_id = ALC662_FIXUP_USI_FUNC 12195 }, 12196 [ALC668_FIXUP_ASUS_NO_HEADSET_MIC] = { 12197 .type = HDA_FIXUP_PINS, 12198 .v.pins = (const struct hda_pintbl[]) { 12199 { 0x1b, 0x04a1112c }, 12200 { } 12201 }, 12202 .chained = true, 12203 .chain_id = ALC668_FIXUP_HEADSET_MIC 12204 }, 12205 #endif 12206 [ALC668_FIXUP_HEADSET_MIC] = { 12207 .type = HDA_FIXUP_FUNC, 12208 .v.func = alc269_fixup_headset_mic, 12209 .chained = true, 12210 .chain_id = ALC668_FIXUP_MIC_DET_COEF 12211 }, 12212 #ifdef TARGET_OS2xxx 12213 [ALC668_FIXUP_MIC_DET_COEF] = { 12214 .type = HDA_FIXUP_VERBS, 12215 .v.verbs = (const struct hda_verb[]) { 12216 { 0x20, AC_VERB_SET_COEF_INDEX, 0x15 }, 12217 { 0x20, AC_VERB_SET_PROC_COEF, 0x0d60 }, 12218 {} 12219 }, 12220 }, 12221 #endif 12222 [ALC897_FIXUP_LENOVO_HEADSET_MIC] = { 12223 .type = HDA_FIXUP_FUNC, 12224 .v.func = alc897_fixup_lenovo_headset_mic, 12225 }, 12226 #ifdef TARGET_OS2xxx 12227 [ALC897_FIXUP_HEADSET_MIC_PIN] = { 12228 .type = HDA_FIXUP_PINS, 12229 .v.pins = (const struct hda_pintbl[]) { 12230 { 0x1a, 0x03a11050 }, 12231 { } 12232 }, 12233 .chained = true, 12234 .chain_id = ALC897_FIXUP_LENOVO_HEADSET_MIC 12235 }, 12236 [ALC897_FIXUP_HP_HSMIC_VERB] = { 12237 .type = HDA_FIXUP_PINS, 12238 .v.pins = (const struct hda_pintbl[]) { 12239 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */ 12240 { } 12241 }, 11668 12242 }, 11669 12243 #endif … … 11693 12267 SND_PCI_QUIRK(0x1028, 0x069f, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), 11694 12268 SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800), 12269 SND_PCI_QUIRK(0x103c, 0x8719, "HP", ALC897_FIXUP_HP_HSMIC_VERB), 11695 12270 SND_PCI_QUIRK(0x103c, 0x873e, "HP", ALC671_FIXUP_HP_HEADSET_MIC2), 12271 SND_PCI_QUIRK(0x103c, 0x877e, "HP 288 Pro G6", ALC671_FIXUP_HP_HEADSET_MIC2), 12272 SND_PCI_QUIRK(0x103c, 0x885f, "HP 288 Pro G8", ALC671_FIXUP_HP_HEADSET_MIC2), 11696 12273 SND_PCI_QUIRK(0x1043, 0x1080, "Asus UX501VW", ALC668_FIXUP_HEADSET_MODE), 11697 12274 SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_ASUS_Nx50), … … 11703 12280 SND_PCI_QUIRK(0x1043, 0x177d, "ASUS N551", ALC668_FIXUP_ASUS_Nx51), 11704 12281 SND_PCI_QUIRK(0x1043, 0x17bd, "ASUS N751", ALC668_FIXUP_ASUS_Nx51), 12282 SND_PCI_QUIRK(0x1043, 0x185d, "ASUS G551JW", ALC668_FIXUP_ASUS_NO_HEADSET_MIC), 11705 12283 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71SL", ALC662_FIXUP_ASUS_MODE8), 11706 12284 SND_PCI_QUIRK(0x1043, 0x1b73, "ASUS N55SF", ALC662_FIXUP_BASS_16), … … 11711 12289 SND_PCI_QUIRK(0x14cd, 0x5003, "USI", ALC662_FIXUP_USI_HEADSET_MODE), 11712 12290 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC662_FIXUP_LENOVO_MULTI_CODECS), 12291 SND_PCI_QUIRK(0x17aa, 0x1057, "Lenovo P360", ALC897_FIXUP_HEADSET_MIC_PIN), 12292 SND_PCI_QUIRK(0x17aa, 0x32ca, "Lenovo ThinkCentre M80", ALC897_FIXUP_HEADSET_MIC_PIN), 12293 SND_PCI_QUIRK(0x17aa, 0x32cb, "Lenovo ThinkCentre M70", ALC897_FIXUP_HEADSET_MIC_PIN), 12294 SND_PCI_QUIRK(0x17aa, 0x32cf, "Lenovo ThinkCentre M950", ALC897_FIXUP_HEADSET_MIC_PIN), 12295 SND_PCI_QUIRK(0x17aa, 0x32f7, "Lenovo ThinkCentre M90", ALC897_FIXUP_HEADSET_MIC_PIN), 11713 12296 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD), 11714 12297 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD), … … 12069 12652 HDA_CODEC_ENTRY(0x10ec1168, "ALC1220", patch_alc882), 12070 12653 HDA_CODEC_ENTRY(0x10ec1220, "ALC1220", patch_alc882), 12654 HDA_CODEC_ENTRY(0x19e58326, "HW8326", patch_alc269), 12071 12655 {0} /* terminator */ 12072 12656 }; -
GPL/trunk/alsa-kernel/pci/hda/patch_sigmatel.c
r695 r717 4482 4482 } 4483 4483 4484 static void stac_shutup(struct hda_codec *codec)4485 {4486 struct sigmatel_spec *spec = codec->spec;4487 4488 snd_hda_shutup_pins(codec);4489 4490 if (spec->eapd_mask)4491 stac_gpio_set(codec, spec->gpio_mask,4492 spec->gpio_dir, spec->gpio_data &4493 ~spec->eapd_mask);4494 }4495 4496 4484 #define stac_free snd_hda_gen_free 4497 4485 … … 4546 4534 static int stac_suspend(struct hda_codec *codec) 4547 4535 { 4548 stac_shutup(codec); 4536 struct sigmatel_spec *spec = codec->spec; 4537 4538 snd_hda_shutup_pins(codec); 4539 4540 if (spec->eapd_mask) 4541 stac_gpio_set(codec, spec->gpio_mask, 4542 spec->gpio_dir, spec->gpio_data & 4543 ~spec->eapd_mask); 4544 4549 4545 return 0; 4550 4546 } … … 4562 4558 .suspend = stac_suspend, 4563 4559 #endif 4564 .reboot_notify = stac_shutup,4565 4560 }; 4566 4561 -
GPL/trunk/alsa-kernel/pci/hda/patch_via.c
r703 r717 529 529 return err; 530 530 531 err = auto_parse_beep(codec); 532 if (err < 0) 533 return err; 534 531 535 err = snd_hda_gen_parse_auto_config(codec, &spec->gen.autocfg); 532 if (err < 0)533 return err;534 535 err = auto_parse_beep(codec);536 536 if (err < 0) 537 537 return err;
Note:
See TracChangeset
for help on using the changeset viewer.
