Merge for 5.18-rc1
Unified · Split
| @@ -679,6 +679,7 @@ EXPORT_SYMBOL_GPL(fw_card_release); · 678 unmodified lines | ||
| 679 | 679 | void fw_core_remove_card(struct fw_card *card) |
| 680 | 680 | { |
| 681 | 681 | struct fw_card_driver dummy_driver = dummy_driver_template; |
| 682 | + unsigned long flags; | |
| 682 | 683 | |
| 683 | 684 | card->driver->update_phy_reg(card, 4, |
| 684 | 685 | PHY_LINK_ACTIVE | PHY_CONTENDER, 0); |
| @@ -693,7 +694,9 @@ void fw_core_remove_card(struct fw_card *card) · 8 unmodified lines | ||
| 693 | 694 | dummy_driver.stop_iso = card->driver->stop_iso; |
| 694 | 695 | card->driver = &dummy_driver; |
| 695 | 696 | |
| 697 | + spin_lock_irqsave(&card->lock, flags); | |
| 696 | 698 | fw_destroy_nodes(card); |
| 699 | + spin_unlock_irqrestore(&card->lock, flags); | |
| 697 | 700 | |
| 698 | 701 | /* Wait for all users, especially device workqueue jobs, to finish. */ |
| 699 | 702 | fw_card_put(card); |
| @@ -1502,6 +1502,7 @@ static void outbound_phy_packet_callback(struct fw_packet *packet, · 1501 unmodified lines | ||
| 1502 | 1502 | { |
| 1503 | 1503 | struct outbound_phy_packet_event *e = |
| 1504 | 1504 | container_of(packet, struct outbound_phy_packet_event, p); |
| 1505 | + struct client *e_client; | |
| 1505 | 1506 | |
| 1506 | 1507 | switch (status) { |
| 1507 | 1508 | /* expected: */ |
| @@ -1518,9 +1519,10 @@ static void outbound_phy_packet_callback(struct fw_packet *packet, · 10 unmodified lines | ||
| 1518 | 1519 | } |
| 1519 | 1520 | e->phy_packet.data[0] = packet->timestamp; |
| 1520 | 1521 | |
| 1522 | + e_client = e->client; | |
| 1521 | 1523 | queue_event(e->client, &e->event, &e->phy_packet, |
| 1522 | 1524 | sizeof(e->phy_packet) + e->phy_packet.length, NULL, 0); |
| 1523 | − client_put(e->client); | |
| 1525 | + client_put(e_client); | |
| 1524 | 1526 | } |
| 1525 | 1527 | |
| 1526 | 1528 | static int ioctl_send_phy_packet(struct client *client, union ioctl_arg *arg) |
| @@ -375,16 +375,13 @@ static void report_found_node(struct fw_card *card, · 374 unmodified lines | ||
| 375 | 375 | card->bm_retries = 0; |
| 376 | 376 | } |
| 377 | 377 | |
| 378 | +/* Must be called with card->lock held */ | |
| 378 | 379 | void fw_destroy_nodes(struct fw_card *card) |
| 379 | 380 | { |
| 380 | − unsigned long flags; | |
| 381 | − | |
| 382 | − spin_lock_irqsave(&card->lock, flags); | |
| 383 | 381 | card->color++; |
| 384 | 382 | if (card->local_node != NULL) |
| 385 | 383 | for_each_fw_node(card, card->local_node, report_lost_node); |
| 386 | 384 | card->local_node = NULL; |
| 387 | − spin_unlock_irqrestore(&card->lock, flags); | |
| 388 | 385 | } |
| 389 | 386 | |
| 390 | 387 | static void move_tree(struct fw_node *node0, struct fw_node *node1, int port) |
| @@ -510,6 +507,8 @@ void fw_core_handle_bus_reset(struct fw_card *card, int node_id, int generation, · 119 unmodified lines | ||
| 510 | 507 | struct fw_node *local_node; |
| 511 | 508 | unsigned long flags; |
| 512 | 509 | |
| 510 | + spin_lock_irqsave(&card->lock, flags); | |
| 511 | + | |
| 513 | 512 | /* |
| 514 | 513 | * If the selfID buffer is not the immediate successor of the |
| 515 | 514 | * previously processed one, we cannot reliably compare the |
| @@ -521,8 +520,6 @@ void fw_core_handle_bus_reset(struct fw_card *card, int node_id, int generation, · 5 unmodified lines | ||
| 521 | 520 | card->bm_retries = 0; |
| 522 | 521 | } |
| 523 | 522 | |
| 524 | − spin_lock_irqsave(&card->lock, flags); | |
| 525 | − | |
| 526 | 523 | card->broadcast_channel_allocated = card->broadcast_channel_auto_allocated; |
| 527 | 524 | card->node_id = node_id; |
| 528 | 525 | /* |
| @@ -73,24 +73,25 @@ static int try_cancel_split_timeout(struct fw_transaction *t) · 72 unmodified lines | ||
| 73 | 73 | static int close_transaction(struct fw_transaction *transaction, |
| 74 | 74 | struct fw_card *card, int rcode) |
| 75 | 75 | { |
| 76 | − struct fw_transaction *t; | |
| 76 | + struct fw_transaction *t = NULL, *iter; | |
| 77 | 77 | unsigned long flags; |
| 78 | 78 | |
| 79 | 79 | spin_lock_irqsave(&card->lock, flags); |
| 80 | − list_for_each_entry(t, &card->transaction_list, link) { | |
| 81 | − if (t == transaction) { | |
| 82 | − if (!try_cancel_split_timeout(t)) { | |
| 80 | + list_for_each_entry(iter, &card->transaction_list, link) { | |
| 81 | + if (iter == transaction) { | |
| 82 | + if (!try_cancel_split_timeout(iter)) { | |
| 83 | 83 | spin_unlock_irqrestore(&card->lock, flags); |
| 84 | 84 | goto timed_out; |
| 85 | 85 | } |
| 86 | − list_del_init(&t->link); | |
| 87 | − card->tlabel_mask &= ~(1ULL << t->tlabel); | |
| 86 | + list_del_init(&iter->link); | |
| 87 | + card->tlabel_mask &= ~(1ULL << iter->tlabel); | |
| 88 | + t = iter; | |
| 88 | 89 | break; |
| 89 | 90 | } |
| 90 | 91 | } |
| 91 | 92 | spin_unlock_irqrestore(&card->lock, flags); |
| 92 | 93 | |
| 93 | − if (&t->link != &card->transaction_list) { | |
| 94 | + if (t) { | |
| 94 | 95 | t->callback(card, rcode, NULL, 0, t->callback_data); |
| 95 | 96 | return 0; |
| 96 | 97 | } |
| @@ -953,7 +954,7 @@ EXPORT_SYMBOL(fw_core_handle_request); · 856 unmodified lines | ||
| 953 | 954 | |
| 954 | 955 | void fw_core_handle_response(struct fw_card *card, struct fw_packet *p) |
| 955 | 956 | { |
| 956 | − struct fw_transaction *t; | |
| 957 | + struct fw_transaction *t = NULL, *iter; | |
| 957 | 958 | unsigned long flags; |
| 958 | 959 | u32 *data; |
| 959 | 960 | size_t data_length; |
| @@ -965,20 +966,21 @@ void fw_core_handle_response(struct fw_card *card, struct fw_packet *p) · 5 unmodified lines | ||
| 965 | 966 | rcode = HEADER_GET_RCODE(p->header[1]); |
| 966 | 967 | |
| 967 | 968 | spin_lock_irqsave(&card->lock, flags); |
| 968 | − list_for_each_entry(t, &card->transaction_list, link) { | |
| 969 | − if (t->node_id == source && t->tlabel == tlabel) { | |
| 970 | − if (!try_cancel_split_timeout(t)) { | |
| 969 | + list_for_each_entry(iter, &card->transaction_list, link) { | |
| 970 | + if (iter->node_id == source && iter->tlabel == tlabel) { | |
| 971 | + if (!try_cancel_split_timeout(iter)) { | |
| 971 | 972 | spin_unlock_irqrestore(&card->lock, flags); |
| 972 | 973 | goto timed_out; |
| 973 | 974 | } |
| 974 | − list_del_init(&t->link); | |
| 975 | − card->tlabel_mask &= ~(1ULL << t->tlabel); | |
| 975 | + list_del_init(&iter->link); | |
| 976 | + card->tlabel_mask &= ~(1ULL << iter->tlabel); | |
| 977 | + t = iter; | |
| 976 | 978 | break; |
| 977 | 979 | } |
| 978 | 980 | } |
| 979 | 981 | spin_unlock_irqrestore(&card->lock, flags); |
| 980 | 982 | |
| 981 | − if (&t->link == &card->transaction_list) { | |
| 983 | + if (!t) { | |
| 982 | 984 | timed_out: |
| 983 | 985 | fw_notice(card, "unsolicited response (source %x, tlabel %x)\n", |
| 984 | 986 | source, tlabel); |
| @@ -408,7 +408,7 @@ static void sbp2_status_write(struct fw_card *card, struct fw_request *request, · 407 unmodified lines | ||
| 408 | 408 | void *payload, size_t length, void *callback_data) |
| 409 | 409 | { |
| 410 | 410 | struct sbp2_logical_unit *lu = callback_data; |
| 411 | − struct sbp2_orb *orb; | |
| 411 | + struct sbp2_orb *orb = NULL, *iter; | |
| 412 | 412 | struct sbp2_status status; |
| 413 | 413 | unsigned long flags; |
| 414 | 414 | |
| @@ -433,17 +433,18 @@ static void sbp2_status_write(struct fw_card *card, struct fw_request *request, · 18 unmodified lines | ||
| 433 | 433 | |
| 434 | 434 | /* Lookup the orb corresponding to this status write. */ |
| 435 | 435 | spin_lock_irqsave(&lu->tgt->lock, flags); |
| 436 | − list_for_each_entry(orb, &lu->orb_list, link) { | |
| 436 | + list_for_each_entry(iter, &lu->orb_list, link) { | |
| 437 | 437 | if (STATUS_GET_ORB_HIGH(status) == 0 && |
| 438 | − STATUS_GET_ORB_LOW(status) == orb->request_bus) { | |
| 439 | − orb->rcode = RCODE_COMPLETE; | |
| 440 | − list_del(&orb->link); | |
| 438 | + STATUS_GET_ORB_LOW(status) == iter->request_bus) { | |
| 439 | + iter->rcode = RCODE_COMPLETE; | |
| 440 | + list_del(&iter->link); | |
| 441 | + orb = iter; | |
| 441 | 442 | break; |
| 442 | 443 | } |
| 443 | 444 | } |
| 444 | 445 | spin_unlock_irqrestore(&lu->tgt->lock, flags); |
| 445 | 446 | |
| 446 | − if (&orb->link != &lu->orb_list) { | |
| 447 | + if (orb) { | |
| 447 | 448 | orb->callback(orb, &status); |
| 448 | 449 | kref_put(&orb->kref, free_orb); /* orb callback reference */ |
| 449 | 450 | } else { |
| @@ -955,8 +955,7 @@ static int cs_dsp_create_control(struct cs_dsp *dsp, · 954 unmodified lines | ||
| 955 | 955 | ctl->alg_region = *alg_region; |
| 956 | 956 | if (subname && dsp->fw_ver >= 2) { |
| 957 | 957 | ctl->subname_len = subname_len; |
| 958 | − ctl->subname = kmemdup(subname, | |
| 959 | − strlen(subname) + 1, GFP_KERNEL); | |
| 958 | + ctl->subname = kasprintf(GFP_KERNEL, "%.*s", subname_len, subname); | |
| 960 | 959 | if (!ctl->subname) { |
| 961 | 960 | ret = -ENOMEM; |
| 962 | 961 | goto err_ctl; |
| @@ -179,6 +179,10 @@ struct snd_soc_component_driver { · 178 unmodified lines | ||
| 179 | 179 | struct snd_pcm_hw_params *params); |
| 180 | 180 | bool use_dai_pcm_id; /* use DAI link PCM ID as PCM device number */ |
| 181 | 181 | int be_pcm_base; /* base device ID for all BE PCMs */ |
| 182 | + | |
| 183 | +#ifdef CONFIG_DEBUG_FS | |
| 184 | + const char *debugfs_prefix; | |
| 185 | +#endif | |
| 182 | 186 | }; |
| 183 | 187 | |
| 184 | 188 | struct snd_soc_component { |
| @@ -34,6 +34,7 @@ hwdep_read_resp_buf(struct snd_efw *efw, char __user *buf, long remained, · 33 unmodified lines | ||
| 34 | 34 | type = SNDRV_FIREWIRE_EVENT_EFW_RESPONSE; |
| 35 | 35 | if (copy_to_user(buf, &type, sizeof(type))) |
| 36 | 36 | return -EFAULT; |
| 37 | + count += sizeof(type); | |
| 37 | 38 | remained -= sizeof(type); |
| 38 | 39 | buf += sizeof(type); |
| 39 | 40 | |
| @@ -127,11 +127,10 @@ static int i915_gfx_present(struct pci_dev *hdac_pci) · 126 unmodified lines | ||
| 127 | 127 | display_dev = pci_get_class(class, display_dev); |
| 128 | 128 | |
| 129 | 129 | if (display_dev && display_dev->vendor == PCI_VENDOR_ID_INTEL && |
| 130 | − connectivity_check(display_dev, hdac_pci)) | |
| 130 | + connectivity_check(display_dev, hdac_pci)) { | |
| 131 | + pci_dev_put(display_dev); | |
| 131 | 132 | match = true; |
| 132 | − | |
| 133 | − pci_dev_put(display_dev); | |
| 134 | − | |
| 133 | + } | |
| 135 | 134 | } while (!match && display_dev); |
| 136 | 135 | |
| 137 | 136 | return match; |
| @@ -424,6 +424,15 @@ static const struct config_entry config_table[] = { · 423 unmodified lines | ||
| 424 | 424 | .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, |
| 425 | 425 | .device = 0x54c8, |
| 426 | 426 | }, |
| 427 | + /* RaptorLake-P */ | |
| 428 | + { | |
| 429 | + .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, | |
| 430 | + .device = 0x51ca, | |
| 431 | + }, | |
| 432 | + { | |
| 433 | + .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, | |
| 434 | + .device = 0x51cb, | |
| 435 | + }, | |
| 427 | 436 | #endif |
| 428 | 437 | |
| 429 | 438 | }; |
| @@ -1094,7 +1094,8 @@ wavefront_send_sample (snd_wavefront_t *dev, · 1093 unmodified lines | ||
| 1094 | 1094 | |
| 1095 | 1095 | if (dataptr < data_end) { |
| 1096 | 1096 | |
| 1097 | − __get_user (sample_short, dataptr); | |
| 1097 | + if (get_user(sample_short, dataptr)) | |
| 1098 | + return -EFAULT; | |
| 1098 | 1099 | dataptr += skip; |
| 1099 | 1100 | |
| 1100 | 1101 | if (data_is_unsigned) { /* GUS ? */ |
| @@ -1428,7 +1428,7 @@ void dmasound_deinit(void) · 1427 unmodified lines | ||
| 1428 | 1428 | unregister_sound_dsp(sq_unit); |
| 1429 | 1429 | } |
| 1430 | 1430 | |
| 1431 | −static int dmasound_setup(char *str) | |
| 1431 | +static int __maybe_unused dmasound_setup(char *str) | |
| 1432 | 1432 | { |
| 1433 | 1433 | int ints[6], size; |
| 1434 | 1434 | |
| @@ -1395,7 +1395,7 @@ static int hdmi_find_pcm_slot(struct hdmi_spec *spec, · 1394 unmodified lines | ||
| 1395 | 1395 | |
| 1396 | 1396 | last_try: |
| 1397 | 1397 | /* the last try; check the empty slots in pins */ |
| 1398 | − for (i = 0; i < spec->num_nids; i++) { | |
| 1398 | + for (i = 0; i < spec->pcm_used; i++) { | |
| 1399 | 1399 | if (!test_bit(i, &spec->pcm_bitmap)) |
| 1400 | 1400 | return i; |
| 1401 | 1401 | } |
| @@ -2325,7 +2325,9 @@ static int generic_hdmi_build_pcms(struct hda_codec *codec) · 923 unmodified lines | ||
| 2325 | 2325 | * dev_num is the device entry number in a pin |
| 2326 | 2326 | */ |
| 2327 | 2327 | |
| 2328 | − if (codec->mst_no_extra_pcms) | |
| 2328 | + if (spec->dyn_pcm_no_legacy && codec->mst_no_extra_pcms) | |
| 2329 | + pcm_num = spec->num_cvts; | |
| 2330 | + else if (codec->mst_no_extra_pcms) | |
| 2329 | 2331 | pcm_num = spec->num_nids; |
| 2330 | 2332 | else |
| 2331 | 2333 | pcm_num = spec->num_nids + spec->dev_num - 1; |
| @@ -4551,6 +4553,7 @@ HDA_CODEC_ENTRY(0x80862819, "DG2 HDMI", patch_i915_adlp_hdmi), · 2219 unmodified lines | ||
| 4551 | 4553 | HDA_CODEC_ENTRY(0x8086281a, "Jasperlake HDMI", patch_i915_icl_hdmi), |
| 4552 | 4554 | HDA_CODEC_ENTRY(0x8086281b, "Elkhartlake HDMI", patch_i915_icl_hdmi), |
| 4553 | 4555 | HDA_CODEC_ENTRY(0x8086281c, "Alderlake-P HDMI", patch_i915_adlp_hdmi), |
| 4556 | +HDA_CODEC_ENTRY(0x8086281f, "Raptorlake-P HDMI", patch_i915_adlp_hdmi), | |
| 4554 | 4557 | HDA_CODEC_ENTRY(0x80862880, "CedarTrail HDMI", patch_generic_hdmi), |
| 4555 | 4558 | HDA_CODEC_ENTRY(0x80862882, "Valleyview2 HDMI", patch_i915_byt_hdmi), |
| 4556 | 4559 | HDA_CODEC_ENTRY(0x80862883, "Braswell HDMI", patch_i915_byt_hdmi), |
| @@ -937,6 +937,9 @@ static int alc_init(struct hda_codec *codec) · 936 unmodified lines | ||
| 937 | 937 | return 0; |
| 938 | 938 | } |
| 939 | 939 | |
| 940 | +#define alc_free snd_hda_gen_free | |
| 941 | + | |
| 942 | +#ifdef CONFIG_PM | |
| 940 | 943 | static inline void alc_shutup(struct hda_codec *codec) |
| 941 | 944 | { |
| 942 | 945 | struct alc_spec *spec = codec->spec; |
| @@ -950,9 +953,6 @@ static inline void alc_shutup(struct hda_codec *codec) · 7 unmodified lines | ||
| 950 | 953 | alc_shutup_pins(codec); |
| 951 | 954 | } |
| 952 | 955 | |
| 953 | −#define alc_free snd_hda_gen_free | |
| 954 | − | |
| 955 | −#ifdef CONFIG_PM | |
| 956 | 956 | static void alc_power_eapd(struct hda_codec *codec) |
| 957 | 957 | { |
| 958 | 958 | alc_auto_setup_eapd(codec, false); |
| @@ -966,9 +966,7 @@ static int alc_suspend(struct hda_codec *codec) · 7 unmodified lines | ||
| 966 | 966 | spec->power_hook(codec); |
| 967 | 967 | return 0; |
| 968 | 968 | } |
| 969 | −#endif | |
| 970 | 969 | |
| 971 | −#ifdef CONFIG_PM | |
| 972 | 970 | static int alc_resume(struct hda_codec *codec) |
| 973 | 971 | { |
| 974 | 972 | struct alc_spec *spec = codec->spec; |
| @@ -6728,6 +6726,41 @@ static void alc256_fixup_mic_no_presence_and_resume(struct hda_codec *codec, · 5753 unmodified lines | ||
| 6728 | 6726 | } |
| 6729 | 6727 | } |
| 6730 | 6728 | |
| 6729 | +static void alc_fixup_dell4_mic_no_presence_quiet(struct hda_codec *codec, | |
| 6730 | + const struct hda_fixup *fix, | |
| 6731 | + int action) | |
| 6732 | +{ | |
| 6733 | + struct alc_spec *spec = codec->spec; | |
| 6734 | + struct hda_input_mux *imux = &spec->gen.input_mux; | |
| 6735 | + int i; | |
| 6736 | + | |
| 6737 | + alc269_fixup_limit_int_mic_boost(codec, fix, action); | |
| 6738 | + | |
| 6739 | + switch (action) { | |
| 6740 | + case HDA_FIXUP_ACT_PRE_PROBE: | |
| 6741 | + /** | |
| 6742 | + * Set the vref of pin 0x19 (Headset Mic) and pin 0x1b (Headphone Mic) | |
| 6743 | + * to Hi-Z to avoid pop noises at startup and when plugging and | |
| 6744 | + * unplugging headphones. | |
| 6745 | + */ | |
| 6746 | + snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ); | |
| 6747 | + snd_hda_codec_set_pin_target(codec, 0x1b, PIN_VREFHIZ); | |
| 6748 | + break; | |
| 6749 | + case HDA_FIXUP_ACT_PROBE: | |
| 6750 | + /** | |
| 6751 | + * Make the internal mic (0x12) the default input source to | |
| 6752 | + * prevent pop noises on cold boot. | |
| 6753 | + */ | |
| 6754 | + for (i = 0; i < imux->num_items; i++) { | |
| 6755 | + if (spec->gen.imux_pins[i] == 0x12) { | |
| 6756 | + spec->gen.cur_mux[0] = i; | |
| 6757 | + break; | |
| 6758 | + } | |
| 6759 | + } | |
| 6760 | + break; | |
| 6761 | + } | |
| 6762 | +} | |
| 6763 | + | |
| 6731 | 6764 | enum { |
| 6732 | 6765 | ALC269_FIXUP_GPIO2, |
| 6733 | 6766 | ALC269_FIXUP_SONY_VAIO, |
| @@ -6769,6 +6802,7 @@ enum { · 35 unmodified lines | ||
| 6769 | 6802 | ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, |
| 6770 | 6803 | ALC269_FIXUP_DELL3_MIC_NO_PRESENCE, |
| 6771 | 6804 | ALC269_FIXUP_DELL4_MIC_NO_PRESENCE, |
| 6805 | + ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET, | |
| 6772 | 6806 | ALC269_FIXUP_HEADSET_MODE, |
| 6773 | 6807 | ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC, |
| 6774 | 6808 | ALC269_FIXUP_ASPIRE_HEADSET_MIC, |
| @@ -6954,11 +6988,13 @@ enum { · 179 unmodified lines | ||
| 6954 | 6988 | ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE, |
| 6955 | 6989 | ALC287_FIXUP_LEGION_16ACHG6, |
| 6956 | 6990 | ALC287_FIXUP_CS35L41_I2C_2, |
| 6991 | + ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED, | |
| 6957 | 6992 | ALC245_FIXUP_CS35L41_SPI_2, |
| 6958 | 6993 | ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED, |
| 6959 | 6994 | ALC245_FIXUP_CS35L41_SPI_4, |
| 6960 | 6995 | ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED, |
| 6961 | 6996 | ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED, |
| 6997 | + ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE, | |
| 6962 | 6998 | }; |
| 6963 | 6999 | |
| 6964 | 7000 | static const struct hda_fixup alc269_fixups[] = { |
| @@ -8716,6 +8752,14 @@ static const struct hda_fixup alc269_fixups[] = { · 1751 unmodified lines | ||
| 8716 | 8752 | [ALC287_FIXUP_CS35L41_I2C_2] = { |
| 8717 | 8753 | .type = HDA_FIXUP_FUNC, |
| 8718 | 8754 | .v.func = cs35l41_fixup_i2c_two, |
| 8755 | + .chained = true, | |
| 8756 | + .chain_id = ALC269_FIXUP_THINKPAD_ACPI, | |
| 8757 | + }, | |
| 8758 | + [ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED] = { | |
| 8759 | + .type = HDA_FIXUP_FUNC, | |
| 8760 | + .v.func = cs35l41_fixup_i2c_two, | |
| 8761 | + .chained = true, | |
| 8762 | + .chain_id = ALC285_FIXUP_HP_MUTE_LED, | |
| 8719 | 8763 | }, |
| 8720 | 8764 | [ALC245_FIXUP_CS35L41_SPI_2] = { |
| 8721 | 8765 | .type = HDA_FIXUP_FUNC, |
| @@ -8747,6 +8791,21 @@ static const struct hda_fixup alc269_fixups[] = { · 25 unmodified lines | ||
| 8747 | 8791 | .chained = true, |
| 8748 | 8792 | .chain_id = ALC285_FIXUP_HP_MUTE_LED, |
| 8749 | 8793 | }, |
| 8794 | + [ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET] = { | |
| 8795 | + .type = HDA_FIXUP_FUNC, | |
| 8796 | + .v.func = alc_fixup_dell4_mic_no_presence_quiet, | |
| 8797 | + .chained = true, | |
| 8798 | + .chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE, | |
| 8799 | + }, | |
| 8800 | + [ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE] = { | |
| 8801 | + .type = HDA_FIXUP_PINS, | |
| 8802 | + .v.pins = (const struct hda_pintbl[]) { | |
| 8803 | + { 0x19, 0x02a1112c }, /* use as headset mic, without its own jack detect */ | |
| 8804 | + { } | |
| 8805 | + }, | |
| 8806 | + .chained = true, | |
| 8807 | + .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC | |
| 8808 | + }, | |
| 8750 | 8809 | }; |
| 8751 | 8810 | |
| 8752 | 8811 | static const struct snd_pci_quirk alc269_fixup_tbl[] = { |
| @@ -8837,6 +8896,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { · 84 unmodified lines | ||
| 8837 | 8896 | SND_PCI_QUIRK(0x1028, 0x09bf, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE), |
| 8838 | 8897 | SND_PCI_QUIRK(0x1028, 0x0a2e, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC), |
| 8839 | 8898 | SND_PCI_QUIRK(0x1028, 0x0a30, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC), |
| 8899 | + SND_PCI_QUIRK(0x1028, 0x0a38, "Dell Latitude 7520", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET), | |
| 8840 | 8900 | SND_PCI_QUIRK(0x1028, 0x0a58, "Dell", ALC255_FIXUP_DELL_HEADSET_MIC), |
| 8841 | 8901 | SND_PCI_QUIRK(0x1028, 0x0a61, "Dell XPS 15 9510", ALC289_FIXUP_DUAL_SPK), |
| 8842 | 8902 | SND_PCI_QUIRK(0x1028, 0x0a62, "Dell Precision 5560", ALC289_FIXUP_DUAL_SPK), |
| @@ -8964,21 +9024,22 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { · 121 unmodified lines | ||
| 8964 | 9024 | SND_PCI_QUIRK(0x103c, 0x8896, "HP EliteBook 855 G8 Notebook PC", ALC285_FIXUP_HP_MUTE_LED), |
| 8965 | 9025 | SND_PCI_QUIRK(0x103c, 0x8898, "HP EliteBook 845 G8 Notebook PC", ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST), |
| 8966 | 9026 | SND_PCI_QUIRK(0x103c, 0x88d0, "HP Pavilion 15-eh1xxx (mainboard 88D0)", ALC287_FIXUP_HP_GPIO_LED), |
| 8967 | − SND_PCI_QUIRK(0x103c, 0x896e, "HP EliteBook x360 830 G9", ALC245_FIXUP_CS35L41_SPI_2), | |
| 8968 | − SND_PCI_QUIRK(0x103c, 0x8971, "HP EliteBook 830 G9", ALC245_FIXUP_CS35L41_SPI_2), | |
| 8969 | − SND_PCI_QUIRK(0x103c, 0x8972, "HP EliteBook 840 G9", ALC245_FIXUP_CS35L41_SPI_2), | |
| 8970 | − SND_PCI_QUIRK(0x103c, 0x8973, "HP EliteBook 860 G9", ALC245_FIXUP_CS35L41_SPI_2), | |
| 8971 | − SND_PCI_QUIRK(0x103c, 0x8974, "HP EliteBook 840 Aero G9", ALC245_FIXUP_CS35L41_SPI_2), | |
| 8972 | − SND_PCI_QUIRK(0x103c, 0x8975, "HP EliteBook x360 840 Aero G9", ALC245_FIXUP_CS35L41_SPI_2), | |
| 9027 | + SND_PCI_QUIRK(0x103c, 0x896e, "HP EliteBook x360 830 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED), | |
| 9028 | + SND_PCI_QUIRK(0x103c, 0x8971, "HP EliteBook 830 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED), | |
| 9029 | + SND_PCI_QUIRK(0x103c, 0x8972, "HP EliteBook 840 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED), | |
| 9030 | + SND_PCI_QUIRK(0x103c, 0x8973, "HP EliteBook 860 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED), | |
| 9031 | + SND_PCI_QUIRK(0x103c, 0x8974, "HP EliteBook 840 Aero G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED), | |
| 9032 | + SND_PCI_QUIRK(0x103c, 0x8975, "HP EliteBook x360 840 Aero G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED), | |
| 8973 | 9033 | SND_PCI_QUIRK(0x103c, 0x8981, "HP Elite Dragonfly G3", ALC245_FIXUP_CS35L41_SPI_4), |
| 8974 | 9034 | SND_PCI_QUIRK(0x103c, 0x898e, "HP EliteBook 835 G9", ALC287_FIXUP_CS35L41_I2C_2), |
| 8975 | 9035 | SND_PCI_QUIRK(0x103c, 0x898f, "HP EliteBook 835 G9", ALC287_FIXUP_CS35L41_I2C_2), |
| 8976 | − SND_PCI_QUIRK(0x103c, 0x8991, "HP EliteBook 845 G9", ALC287_FIXUP_CS35L41_I2C_2), | |
| 9036 | + SND_PCI_QUIRK(0x103c, 0x8991, "HP EliteBook 845 G9", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED), | |
| 8977 | 9037 | SND_PCI_QUIRK(0x103c, 0x8992, "HP EliteBook 845 G9", ALC287_FIXUP_CS35L41_I2C_2), |
| 8978 | − SND_PCI_QUIRK(0x103c, 0x8994, "HP EliteBook 855 G9", ALC287_FIXUP_CS35L41_I2C_2), | |
| 9038 | + SND_PCI_QUIRK(0x103c, 0x8994, "HP EliteBook 855 G9", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED), | |
| 8979 | 9039 | SND_PCI_QUIRK(0x103c, 0x8995, "HP EliteBook 855 G9", ALC287_FIXUP_CS35L41_I2C_2), |
| 8980 | 9040 | SND_PCI_QUIRK(0x103c, 0x89a4, "HP ProBook 440 G9", ALC236_FIXUP_HP_GPIO_LED), |
| 8981 | 9041 | SND_PCI_QUIRK(0x103c, 0x89a6, "HP ProBook 450 G9", ALC236_FIXUP_HP_GPIO_LED), |
| 9042 | + SND_PCI_QUIRK(0x103c, 0x89aa, "HP EliteBook 630 G9", ALC236_FIXUP_HP_GPIO_LED), | |
| 8982 | 9043 | SND_PCI_QUIRK(0x103c, 0x89ac, "HP EliteBook 640 G9", ALC236_FIXUP_HP_GPIO_LED), |
| 8983 | 9044 | SND_PCI_QUIRK(0x103c, 0x89ae, "HP EliteBook 650 G9", ALC236_FIXUP_HP_GPIO_LED), |
| 8984 | 9045 | SND_PCI_QUIRK(0x103c, 0x89c3, "Zbook Studio G9", ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED), |
| @@ -9111,6 +9172,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { · 126 unmodified lines | ||
| 9111 | 9172 | SND_PCI_QUIRK(0x1558, 0x8562, "Clevo NH[57][0-9]RZ[Q]", ALC269_FIXUP_DMIC), |
| 9112 | 9173 | SND_PCI_QUIRK(0x1558, 0x8668, "Clevo NP50B[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), |
| 9113 | 9174 | SND_PCI_QUIRK(0x1558, 0x866d, "Clevo NP5[05]PN[HJK]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE), |
| 9175 | + SND_PCI_QUIRK(0x1558, 0x867c, "Clevo NP7[01]PNP", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE), | |
| 9114 | 9176 | SND_PCI_QUIRK(0x1558, 0x867d, "Clevo NP7[01]PN[HJK]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE), |
| 9115 | 9177 | SND_PCI_QUIRK(0x1558, 0x8680, "Clevo NJ50LU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE), |
| 9116 | 9178 | SND_PCI_QUIRK(0x1558, 0x8686, "Clevo NH50[CZ]U", ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME), |
| @@ -9185,6 +9247,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { · 68 unmodified lines | ||
| 9185 | 9247 | SND_PCI_QUIRK(0x17aa, 0x3813, "Legion 7i 15IMHG05", ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS), |
| 9186 | 9248 | SND_PCI_QUIRK(0x17aa, 0x3818, "Lenovo C940", ALC298_FIXUP_LENOVO_SPK_VOLUME), |
| 9187 | 9249 | SND_PCI_QUIRK(0x17aa, 0x3819, "Lenovo 13s Gen2 ITL", ALC287_FIXUP_13S_GEN2_SPEAKERS), |
| 9250 | + SND_PCI_QUIRK(0x17aa, 0x3820, "Yoga Duet 7 13ITL6", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS), | |
| 9188 | 9251 | SND_PCI_QUIRK(0x17aa, 0x3824, "Legion Y9000X 2020", ALC285_FIXUP_LEGION_Y9000X_SPEAKERS), |
| 9189 | 9252 | SND_PCI_QUIRK(0x17aa, 0x3827, "Ideapad S740", ALC285_FIXUP_IDEAPAD_S740_COEF), |
| 9190 | 9253 | SND_PCI_QUIRK(0x17aa, 0x3834, "Lenovo IdeaPad Slim 9i 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS), |
| @@ -9227,6 +9290,14 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { · 36 unmodified lines | ||
| 9227 | 9290 | SND_PCI_QUIRK(0x1c06, 0x2013, "Lemote A1802", ALC269_FIXUP_LEMOTE_A1802), |
| 9228 | 9291 | SND_PCI_QUIRK(0x1c06, 0x2015, "Lemote A190X", ALC269_FIXUP_LEMOTE_A190X), |
| 9229 | 9292 | SND_PCI_QUIRK(0x1d05, 0x1132, "TongFang PHxTxX1", ALC256_FIXUP_SET_COEF_DEFAULTS), |
| 9293 | + SND_PCI_QUIRK(0x1d05, 0x1096, "TongFang GMxMRxx", ALC269_FIXUP_NO_SHUTUP), | |
| 9294 | + SND_PCI_QUIRK(0x1d05, 0x1100, "TongFang GKxNRxx", ALC269_FIXUP_NO_SHUTUP), | |
| 9295 | + SND_PCI_QUIRK(0x1d05, 0x1111, "TongFang GMxZGxx", ALC269_FIXUP_NO_SHUTUP), | |
| 9296 | + SND_PCI_QUIRK(0x1d05, 0x1119, "TongFang GMxZGxx", ALC269_FIXUP_NO_SHUTUP), | |
| 9297 | + SND_PCI_QUIRK(0x1d05, 0x1129, "TongFang GMxZGxx", ALC269_FIXUP_NO_SHUTUP), | |
| 9298 | + SND_PCI_QUIRK(0x1d05, 0x1147, "TongFang GMxTGxx", ALC269_FIXUP_NO_SHUTUP), | |
| 9299 | + SND_PCI_QUIRK(0x1d05, 0x115c, "TongFang GMxTGxx", ALC269_FIXUP_NO_SHUTUP), | |
| 9300 | + SND_PCI_QUIRK(0x1d05, 0x121b, "TongFang GMxAGxx", ALC269_FIXUP_NO_SHUTUP), | |
| 9230 | 9301 | SND_PCI_QUIRK(0x1d72, 0x1602, "RedmiBook", ALC255_FIXUP_XIAOMI_HEADSET_MIC), |
| 9231 | 9302 | SND_PCI_QUIRK(0x1d72, 0x1701, "XiaomiNotebook Pro", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE), |
| 9232 | 9303 | SND_PCI_QUIRK(0x1d72, 0x1901, "RedmiBook 14", ALC256_FIXUP_ASUS_HEADSET_MIC), |
| @@ -9234,6 +9305,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { · 1 unmodified line | ||
| 9234 | 9305 | SND_PCI_QUIRK(0x8086, 0x2074, "Intel NUC 8", ALC233_FIXUP_INTEL_NUC8_DMIC), |
| 9235 | 9306 | SND_PCI_QUIRK(0x8086, 0x2080, "Intel NUC 8 Rugged", ALC256_FIXUP_INTEL_NUC8_RUGGED), |
| 9236 | 9307 | SND_PCI_QUIRK(0x8086, 0x2081, "Intel NUC 10", ALC256_FIXUP_INTEL_NUC10), |
| 9308 | + SND_PCI_QUIRK(0xf111, 0x0001, "Framework Laptop", ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE), | |
| 9237 | 9309 | |
| 9238 | 9310 | #if 0 |
| 9239 | 9311 | /* Below is a quirk table taken from the old code. |
| @@ -561,8 +561,9 @@ static snd_pcm_uframes_t lola_pcm_pointer(struct snd_pcm_substream *substream) · 560 unmodified lines | ||
| 561 | 561 | void lola_pcm_update(struct lola *chip, struct lola_pcm *pcm, unsigned int bits) |
| 562 | 562 | { |
| 563 | 563 | int i; |
| 564 | + u8 num_streams = min_t(u8, pcm->num_streams, ARRAY_SIZE(pcm->streams)); | |
| 564 | 565 | |
| 565 | − for (i = 0; bits && i < pcm->num_streams; i++) { | |
| 566 | + for (i = 0; bits && i < num_streams; i++) { | |
| 566 | 567 | if (bits & (1 << i)) { |
| 567 | 568 | struct lola_stream *str = &pcm->streams[i]; |
| 568 | 569 | if (str->substream && str->running) |
| @@ -966,6 +966,7 @@ static int mchp_pdmc_process(struct snd_pcm_substream *substream, · 965 unmodified lines | ||
| 966 | 966 | |
| 967 | 967 | static struct snd_dmaengine_pcm_config mchp_pdmc_config = { |
| 968 | 968 | .process = mchp_pdmc_process, |
| 969 | + .prepare_slave_config = snd_dmaengine_pcm_prepare_slave_config, | |
| 969 | 970 | }; |
| 970 | 971 | |
| 971 | 972 | static int mchp_pdmc_probe(struct platform_device *pdev) |
| @@ -46,35 +46,6 @@ · 45 unmodified lines | ||
| 46 | 46 | */ |
| 47 | 47 | #undef ENABLE_MIC_INPUT |
| 48 | 48 | |
| 49 | −static struct clk *mclk; | |
| 50 | − | |
| 51 | −static int at91sam9g20ek_set_bias_level(struct snd_soc_card *card, | |
| 52 | − struct snd_soc_dapm_context *dapm, | |
| 53 | − enum snd_soc_bias_level level) | |
| 54 | −{ | |
| 55 | − static int mclk_on; | |
| 56 | − int ret = 0; | |
| 57 | − | |
| 58 | − switch (level) { | |
| 59 | − case SND_SOC_BIAS_ON: | |
| 60 | − case SND_SOC_BIAS_PREPARE: | |
| 61 | − if (!mclk_on) | |
| 62 | − ret = clk_enable(mclk); | |
| 63 | − if (ret == 0) | |
| 64 | − mclk_on = 1; | |
| 65 | − break; | |
| 66 | − | |
| 67 | − case SND_SOC_BIAS_OFF: | |
| 68 | − case SND_SOC_BIAS_STANDBY: | |
| 69 | − if (mclk_on) | |
| 70 | − clk_disable(mclk); | |
| 71 | − mclk_on = 0; | |
| 72 | − break; | |
| 73 | − } | |
| 74 | − | |
| 75 | − return ret; | |
| 76 | −} | |
| 77 | − | |
| 78 | 49 | static const struct snd_soc_dapm_widget at91sam9g20ek_dapm_widgets[] = { |
| 79 | 50 | SND_SOC_DAPM_MIC("Int Mic", NULL), |
| 80 | 51 | SND_SOC_DAPM_SPK("Ext Spk", NULL), |
| @@ -135,7 +106,6 @@ static struct snd_soc_card snd_soc_at91sam9g20ek = { · 54 unmodified lines | ||
| 135 | 106 | .owner = THIS_MODULE, |
| 136 | 107 | .dai_link = &at91sam9g20ek_dai, |
| 137 | 108 | .num_links = 1, |
| 138 | − .set_bias_level = at91sam9g20ek_set_bias_level, | |
| 139 | 109 | |
| 140 | 110 | .dapm_widgets = at91sam9g20ek_dapm_widgets, |
| 141 | 111 | .num_dapm_widgets = ARRAY_SIZE(at91sam9g20ek_dapm_widgets), |
| @@ -148,7 +118,6 @@ static int at91sam9g20ek_audio_probe(struct platform_device *pdev) · 6 unmodified lines | ||
| 148 | 118 | { |
| 149 | 119 | struct device_node *np = pdev->dev.of_node; |
| 150 | 120 | struct device_node *codec_np, *cpu_np; |
| 151 | − struct clk *pllb; | |
| 152 | 121 | struct snd_soc_card *card = &snd_soc_at91sam9g20ek; |
| 153 | 122 | int ret; |
| 154 | 123 | |
| @@ -162,31 +131,6 @@ static int at91sam9g20ek_audio_probe(struct platform_device *pdev) · 7 unmodified lines | ||
| 162 | 131 | return -EINVAL; |
| 163 | 132 | } |
| 164 | 133 | |
| 165 | − /* | |
| 166 | − * Codec MCLK is supplied by PCK0 - set it up. | |
| 167 | − */ | |
| 168 | − mclk = clk_get(NULL, "pck0"); | |
| 169 | − if (IS_ERR(mclk)) { | |
| 170 | − dev_err(&pdev->dev, "Failed to get MCLK\n"); | |
| 171 | − ret = PTR_ERR(mclk); | |
| 172 | − goto err; | |
| 173 | − } | |
| 174 | − | |
| 175 | − pllb = clk_get(NULL, "pllb"); | |
| 176 | − if (IS_ERR(pllb)) { | |
| 177 | − dev_err(&pdev->dev, "Failed to get PLLB\n"); | |
| 178 | − ret = PTR_ERR(pllb); | |
| 179 | − goto err_mclk; | |
| 180 | − } | |
| 181 | − ret = clk_set_parent(mclk, pllb); | |
| 182 | − clk_put(pllb); | |
| 183 | − if (ret != 0) { | |
| 184 | − dev_err(&pdev->dev, "Failed to set MCLK parent\n"); | |
| 185 | − goto err_mclk; | |
| 186 | − } | |
| 187 | − | |
| 188 | − clk_set_rate(mclk, MCLK_RATE); | |
| 189 | − | |
| 190 | 134 | card->dev = &pdev->dev; |
| 191 | 135 | |
| 192 | 136 | /* Parse device node info */ |
| @@ -230,9 +174,6 @@ static int at91sam9g20ek_audio_probe(struct platform_device *pdev) · 37 unmodified lines | ||
| 230 | 174 | |
| 231 | 175 | return ret; |
| 232 | 176 | |
| 233 | −err_mclk: | |
| 234 | − clk_put(mclk); | |
| 235 | − mclk = NULL; | |
| 236 | 177 | err: |
| 237 | 178 | atmel_ssc_put_audio(0); |
| 238 | 179 | return ret; |
| @@ -242,8 +183,6 @@ static int at91sam9g20ek_audio_remove(struct platform_device *pdev) · 3 unmodified lines | ||
| 242 | 183 | { |
| 243 | 184 | struct snd_soc_card *card = platform_get_drvdata(pdev); |
| 244 | 185 | |
| 245 | − clk_disable(mclk); | |
| 246 | − mclk = NULL; | |
| 247 | 186 | snd_soc_unregister_card(card); |
| 248 | 187 | atmel_ssc_put_audio(0); |
| 249 | 188 | |
| @@ -842,8 +842,8 @@ int cs35l41_otp_unpack(struct device *dev, struct regmap *regmap) · 841 unmodified lines | ||
| 842 | 842 | word_offset = otp_map_match->word_offset; |
| 843 | 843 | |
| 844 | 844 | for (i = 0; i < otp_map_match->num_elements; i++) { |
| 845 | − dev_dbg(dev, "bitoffset= %d, word_offset=%d, bit_sum mod 32=%d\n", | |
| 846 | − bit_offset, word_offset, bit_sum % 32); | |
| 845 | + dev_dbg(dev, "bitoffset= %d, word_offset=%d, bit_sum mod 32=%d otp_map[i].size = %d\n", | |
| 846 | + bit_offset, word_offset, bit_sum % 32, otp_map[i].size); | |
| 847 | 847 | if (bit_offset + otp_map[i].size - 1 >= 32) { |
| 848 | 848 | otp_val = (otp_mem[word_offset] & |
| 849 | 849 | GENMASK(31, bit_offset)) >> bit_offset; |
| @@ -851,12 +851,14 @@ int cs35l41_otp_unpack(struct device *dev, struct regmap *regmap) · 1 unmodified line | ||
| 851 | 851 | GENMASK(bit_offset + otp_map[i].size - 33, 0)) << |
| 852 | 852 | (32 - bit_offset); |
| 853 | 853 | bit_offset += otp_map[i].size - 32; |
| 854 | − } else { | |
| 854 | + } else if (bit_offset + otp_map[i].size - 1 >= 0) { | |
| 855 | 855 | otp_val = (otp_mem[word_offset] & |
| 856 | 856 | GENMASK(bit_offset + otp_map[i].size - 1, bit_offset) |
| 857 | 857 | ) >> bit_offset; |
| 858 | 858 | bit_offset += otp_map[i].size; |
| 859 | − } | |
| 859 | + } else /* both bit_offset and otp_map[i].size are 0 */ | |
| 860 | + otp_val = 0; | |
| 861 | + | |
| 860 | 862 | bit_sum += otp_map[i].size; |
| 861 | 863 | |
| 862 | 864 | if (bit_offset == 32) { |
| @@ -446,7 +446,7 @@ static int da7219_tonegen_freq_put(struct snd_kcontrol *kcontrol, · 445 unmodified lines | ||
| 446 | 446 | struct soc_mixer_control *mixer_ctrl = |
| 447 | 447 | (struct soc_mixer_control *) kcontrol->private_value; |
| 448 | 448 | unsigned int reg = mixer_ctrl->reg; |
| 449 | − __le16 val; | |
| 449 | + __le16 val_new, val_old; | |
| 450 | 450 | int ret; |
| 451 | 451 | |
| 452 | 452 | /* |
| @@ -454,13 +454,19 @@ static int da7219_tonegen_freq_put(struct snd_kcontrol *kcontrol, · 1 unmodified line | ||
| 454 | 454 | * Therefore we need to convert to little endian here to align with |
| 455 | 455 | * HW registers. |
| 456 | 456 | */ |
| 457 | − val = cpu_to_le16(ucontrol->value.integer.value[0]); | |
| 457 | + val_new = cpu_to_le16(ucontrol->value.integer.value[0]); | |
| 458 | 458 | |
| 459 | 459 | mutex_lock(&da7219->ctrl_lock); |
| 460 | − ret = regmap_raw_write(da7219->regmap, reg, &val, sizeof(val)); | |
| 460 | + ret = regmap_raw_read(da7219->regmap, reg, &val_old, sizeof(val_old)); | |
| 461 | + if (ret == 0 && (val_old != val_new)) | |
| 462 | + ret = regmap_raw_write(da7219->regmap, reg, | |
| 463 | + &val_new, sizeof(val_new)); | |
| 461 | 464 | mutex_unlock(&da7219->ctrl_lock); |
| 462 | 465 | |
| 463 | − return ret; | |
| 466 | + if (ret < 0) | |
| 467 | + return ret; | |
| 468 | + | |
| 469 | + return val_old != val_new; | |
| 464 | 470 | } |
| 465 | 471 | |
| 466 | 472 | |
| @@ -3566,12 +3566,16 @@ static int rx_macro_probe(struct platform_device *pdev) · 3565 unmodified lines | ||
| 3566 | 3566 | return PTR_ERR(rx->pds); |
| 3567 | 3567 | |
| 3568 | 3568 | base = devm_platform_ioremap_resource(pdev, 0); |
| 3569 | − if (IS_ERR(base)) | |
| 3570 | − return PTR_ERR(base); | |
| 3569 | + if (IS_ERR(base)) { | |
| 3570 | + ret = PTR_ERR(base); | |
| 3571 | + goto err; | |
| 3572 | + } | |
| 3571 | 3573 | |
| 3572 | 3574 | rx->regmap = devm_regmap_init_mmio(dev, base, &rx_regmap_config); |
| 3573 | − if (IS_ERR(rx->regmap)) | |
| 3574 | − return PTR_ERR(rx->regmap); | |
| 3575 | + if (IS_ERR(rx->regmap)) { | |
| 3576 | + ret = PTR_ERR(rx->regmap); | |
| 3577 | + goto err; | |
| 3578 | + } | |
| 3575 | 3579 | |
| 3576 | 3580 | dev_set_drvdata(dev, rx); |
| 3577 | 3581 | |
| @@ -3632,6 +3636,8 @@ err_mclk: · 54 unmodified lines | ||
| 3632 | 3636 | err_dcodec: |
| 3633 | 3637 | clk_disable_unprepare(rx->macro); |
| 3634 | 3638 | err: |
| 3639 | + lpass_macro_pds_exit(rx->pds); | |
| 3640 | + | |
| 3635 | 3641 | return ret; |
| 3636 | 3642 | } |
| 3637 | 3643 | |
| @@ -1828,8 +1828,10 @@ static int tx_macro_probe(struct platform_device *pdev) · 1827 unmodified lines | ||
| 1828 | 1828 | return PTR_ERR(tx->pds); |
| 1829 | 1829 | |
| 1830 | 1830 | base = devm_platform_ioremap_resource(pdev, 0); |
| 1831 | − if (IS_ERR(base)) | |
| 1832 | − return PTR_ERR(base); | |
| 1831 | + if (IS_ERR(base)) { | |
| 1832 | + ret = PTR_ERR(base); | |
| 1833 | + goto err; | |
| 1834 | + } | |
| 1833 | 1835 | |
| 1834 | 1836 | /* Update defaults for lpass sc7280 */ |
| 1835 | 1837 | if (of_device_is_compatible(np, "qcom,sc7280-lpass-tx-macro")) { |
| @@ -1846,8 +1848,10 @@ static int tx_macro_probe(struct platform_device *pdev) · 10 unmodified lines | ||
| 1846 | 1848 | } |
| 1847 | 1849 | |
| 1848 | 1850 | tx->regmap = devm_regmap_init_mmio(dev, base, &tx_regmap_config); |
| 1849 | − if (IS_ERR(tx->regmap)) | |
| 1850 | − return PTR_ERR(tx->regmap); | |
| 1851 | + if (IS_ERR(tx->regmap)) { | |
| 1852 | + ret = PTR_ERR(tx->regmap); | |
| 1853 | + goto err; | |
| 1854 | + } | |
| 1851 | 1855 | |
| 1852 | 1856 | dev_set_drvdata(dev, tx); |
| 1853 | 1857 | |
| @@ -1907,6 +1911,8 @@ err_mclk: · 53 unmodified lines | ||
| 1907 | 1911 | err_dcodec: |
| 1908 | 1912 | clk_disable_unprepare(tx->macro); |
| 1909 | 1913 | err: |
| 1914 | + lpass_macro_pds_exit(tx->pds); | |
| 1915 | + | |
| 1910 | 1916 | return ret; |
| 1911 | 1917 | } |
| 1912 | 1918 | |
| @@ -1434,8 +1434,10 @@ static int va_macro_probe(struct platform_device *pdev) · 1433 unmodified lines | ||
| 1434 | 1434 | va->dmic_clk_div = VA_MACRO_CLK_DIV_2; |
| 1435 | 1435 | } else { |
| 1436 | 1436 | ret = va_macro_validate_dmic_sample_rate(sample_rate, va); |
| 1437 | − if (!ret) | |
| 1438 | − return -EINVAL; | |
| 1437 | + if (!ret) { | |
| 1438 | + ret = -EINVAL; | |
| 1439 | + goto err; | |
| 1440 | + } | |
| 1439 | 1441 | } |
| 1440 | 1442 | |
| 1441 | 1443 | base = devm_platform_ioremap_resource(pdev, 0); |
| @@ -1492,6 +1494,8 @@ err_mclk: · 50 unmodified lines | ||
| 1492 | 1494 | err_dcodec: |
| 1493 | 1495 | clk_disable_unprepare(va->macro); |
| 1494 | 1496 | err: |
| 1497 | + lpass_macro_pds_exit(va->pds); | |
| 1498 | + | |
| 1495 | 1499 | return ret; |
| 1496 | 1500 | } |
| 1497 | 1501 | |
| @@ -413,6 +413,9 @@ static int max98090_put_enab_tlv(struct snd_kcontrol *kcontrol, · 412 unmodified lines | ||
| 413 | 413 | |
| 414 | 414 | val = (val >> mc->shift) & mask; |
| 415 | 415 | |
| 416 | + if (sel < 0 || sel > mc->max) | |
| 417 | + return -EINVAL; | |
| 418 | + | |
| 416 | 419 | *select = sel; |
| 417 | 420 | |
| 418 | 421 | /* Setting a volume is only valid if it is already On */ |
| @@ -427,7 +430,7 @@ static int max98090_put_enab_tlv(struct snd_kcontrol *kcontrol, · 8 unmodified lines | ||
| 427 | 430 | mask << mc->shift, |
| 428 | 431 | sel << mc->shift); |
| 429 | 432 | |
| 430 | − return 0; | |
| 433 | + return *select != val; | |
| 431 | 434 | } |
| 432 | 435 | |
| 433 | 436 | static const char *max98090_perf_pwr_text[] = |
| @@ -1206,9 +1206,16 @@ static int msm8916_wcd_digital_probe(struct platform_device *pdev) · 1205 unmodified lines | ||
| 1206 | 1206 | |
| 1207 | 1207 | dev_set_drvdata(dev, priv); |
| 1208 | 1208 | |
| 1209 | − return devm_snd_soc_register_component(dev, &msm8916_wcd_digital, | |
| 1209 | + ret = devm_snd_soc_register_component(dev, &msm8916_wcd_digital, | |
| 1210 | 1210 | msm8916_wcd_digital_dai, |
| 1211 | 1211 | ARRAY_SIZE(msm8916_wcd_digital_dai)); |
| 1212 | + if (ret) | |
| 1213 | + goto err_mclk; | |
| 1214 | + | |
| 1215 | + return 0; | |
| 1216 | + | |
| 1217 | +err_mclk: | |
| 1218 | + clk_disable_unprepare(priv->mclk); | |
| 1212 | 1219 | err_clk: |
| 1213 | 1220 | clk_disable_unprepare(priv->ahbclk); |
| 1214 | 1221 | return ret; |
| @@ -489,7 +489,7 @@ static int rk817_platform_probe(struct platform_device *pdev) · 488 unmodified lines | ||
| 489 | 489 | |
| 490 | 490 | rk817_codec_parse_dt_property(&pdev->dev, rk817_codec_data); |
| 491 | 491 | |
| 492 | − rk817_codec_data->mclk = clk_get(pdev->dev.parent, "mclk"); | |
| 492 | + rk817_codec_data->mclk = devm_clk_get(pdev->dev.parent, "mclk"); | |
| 493 | 493 | if (IS_ERR(rk817_codec_data->mclk)) { |
| 494 | 494 | dev_dbg(&pdev->dev, "Unable to get mclk\n"); |
| 495 | 495 | ret = -ENXIO; |
| @@ -1100,6 +1100,15 @@ void rt5682_jack_detect_handler(struct work_struct *work) · 1099 unmodified lines | ||
| 1100 | 1100 | return; |
| 1101 | 1101 | } |
| 1102 | 1102 | |
| 1103 | + if (rt5682->is_sdw) { | |
| 1104 | + if (pm_runtime_status_suspended(rt5682->slave->dev.parent)) { | |
| 1105 | + dev_dbg(&rt5682->slave->dev, | |
| 1106 | + "%s: parent device is pm_runtime_status_suspended, skipping jack detection\n", | |
| 1107 | + __func__); | |
| 1108 | + return; | |
| 1109 | + } | |
| 1110 | + } | |
| 1111 | + | |
| 1103 | 1112 | dapm = snd_soc_component_get_dapm(rt5682->component); |
| 1104 | 1113 | |
| 1105 | 1114 | snd_soc_dapm_mutex_lock(dapm); |
| @@ -2822,14 +2831,11 @@ static int rt5682_bclk_set_rate(struct clk_hw *hw, unsigned long rate, · 1716 unmodified lines | ||
| 2822 | 2831 | |
| 2823 | 2832 | for_each_component_dais(component, dai) |
| 2824 | 2833 | if (dai->id == RT5682_AIF1) |
| 2825 | − break; | |
| 2826 | − if (!dai) { | |
| 2827 | − dev_err(rt5682->i2c_dev, "dai %d not found in component\n", | |
| 2828 | − RT5682_AIF1); | |
| 2829 | − return -ENODEV; | |
| 2830 | − } | |
| 2834 | + return rt5682_set_bclk1_ratio(dai, factor); | |
| 2831 | 2835 | |
| 2832 | − return rt5682_set_bclk1_ratio(dai, factor); | |
| 2836 | + dev_err(rt5682->i2c_dev, "dai %d not found in component\n", | |
| 2837 | + RT5682_AIF1); | |
| 2838 | + return -ENODEV; | |
| 2833 | 2839 | } |
| 2834 | 2840 | |
| 2835 | 2841 | static const struct clk_ops rt5682_dai_clk_ops[RT5682_DAI_NUM_CLKS] = { |
| @@ -2687,14 +2687,11 @@ static int rt5682s_bclk_set_rate(struct clk_hw *hw, unsigned long rate, · 2686 unmodified lines | ||
| 2687 | 2687 | |
| 2688 | 2688 | for_each_component_dais(component, dai) |
| 2689 | 2689 | if (dai->id == RT5682S_AIF1) |
| 2690 | − break; | |
| 2691 | − if (!dai) { | |
| 2692 | − dev_err(component->dev, "dai %d not found in component\n", | |
| 2693 | − RT5682S_AIF1); | |
| 2694 | − return -ENODEV; | |
| 2695 | − } | |
| 2690 | + return rt5682s_set_bclk1_ratio(dai, factor); | |
| 2696 | 2691 | |
| 2697 | − return rt5682s_set_bclk1_ratio(dai, factor); | |
| 2692 | + dev_err(component->dev, "dai %d not found in component\n", | |
| 2693 | + RT5682S_AIF1); | |
| 2694 | + return -ENODEV; | |
| 2698 | 2695 | } |
| 2699 | 2696 | |
| 2700 | 2697 | static const struct clk_ops rt5682s_dai_clk_ops[RT5682S_DAI_NUM_CLKS] = { |
| @@ -245,6 +245,13 @@ static void rt711_jack_detect_handler(struct work_struct *work) · 244 unmodified lines | ||
| 245 | 245 | if (!rt711->component->card->instantiated) |
| 246 | 246 | return; |
| 247 | 247 | |
| 248 | + if (pm_runtime_status_suspended(rt711->slave->dev.parent)) { | |
| 249 | + dev_dbg(&rt711->slave->dev, | |
| 250 | + "%s: parent device is pm_runtime_status_suspended, skipping jack detection\n", | |
| 251 | + __func__); | |
| 252 | + return; | |
| 253 | + } | |
| 254 | + | |
| 248 | 255 | reg = RT711_VERB_GET_PIN_SENSE | RT711_HP_OUT; |
| 249 | 256 | ret = regmap_read(rt711->regmap, reg, &jack_status); |
| 250 | 257 | if (ret < 0) |
| @@ -341,7 +341,6 @@ static int rt9120_get_reg_size(unsigned int reg) · 340 unmodified lines | ||
| 341 | 341 | { |
| 342 | 342 | switch (reg) { |
| 343 | 343 | case 0x00: |
| 344 | − case 0x09: | |
| 345 | 344 | case 0x20 ... 0x27: |
| 346 | 345 | return 2; |
| 347 | 346 | case 0x30 ... 0x3D: |
| @@ -1274,29 +1274,7 @@ static int wcd934x_set_sido_input_src(struct wcd934x_codec *wcd, int sido_src) · 1273 unmodified lines | ||
| 1274 | 1274 | if (sido_src == wcd->sido_input_src) |
| 1275 | 1275 | return 0; |
| 1276 | 1276 | |
| 1277 | − if (sido_src == SIDO_SOURCE_INTERNAL) { | |
| 1278 | − regmap_update_bits(wcd->regmap, WCD934X_ANA_BUCK_CTL, | |
| 1279 | − WCD934X_ANA_BUCK_HI_ACCU_EN_MASK, 0); | |
| 1280 | − usleep_range(100, 110); | |
| 1281 | − regmap_update_bits(wcd->regmap, WCD934X_ANA_BUCK_CTL, | |
| 1282 | − WCD934X_ANA_BUCK_HI_ACCU_PRE_ENX_MASK, 0x0); | |
| 1283 | − usleep_range(100, 110); | |
| 1284 | − regmap_update_bits(wcd->regmap, WCD934X_ANA_RCO, | |
| 1285 | − WCD934X_ANA_RCO_BG_EN_MASK, 0); | |
| 1286 | − usleep_range(100, 110); | |
| 1287 | − regmap_update_bits(wcd->regmap, WCD934X_ANA_BUCK_CTL, | |
| 1288 | − WCD934X_ANA_BUCK_PRE_EN1_MASK, | |
| 1289 | − WCD934X_ANA_BUCK_PRE_EN1_ENABLE); | |
| 1290 | − usleep_range(100, 110); | |
| 1291 | − regmap_update_bits(wcd->regmap, WCD934X_ANA_BUCK_CTL, | |
| 1292 | − WCD934X_ANA_BUCK_PRE_EN2_MASK, | |
| 1293 | − WCD934X_ANA_BUCK_PRE_EN2_ENABLE); | |
| 1294 | − usleep_range(100, 110); | |
| 1295 | − regmap_update_bits(wcd->regmap, WCD934X_ANA_BUCK_CTL, | |
| 1296 | − WCD934X_ANA_BUCK_HI_ACCU_EN_MASK, | |
| 1297 | − WCD934X_ANA_BUCK_HI_ACCU_ENABLE); | |
| 1298 | − usleep_range(100, 110); | |
| 1299 | − } else if (sido_src == SIDO_SOURCE_RCO_BG) { | |
| 1277 | + if (sido_src == SIDO_SOURCE_RCO_BG) { | |
| 1300 | 1278 | regmap_update_bits(wcd->regmap, WCD934X_ANA_RCO, |
| 1301 | 1279 | WCD934X_ANA_RCO_BG_EN_MASK, |
| 1302 | 1280 | WCD934X_ANA_RCO_BG_ENABLE); |
| @@ -1382,8 +1360,6 @@ static int wcd934x_disable_ana_bias_and_syclk(struct wcd934x_codec *wcd) · 79 unmodified lines | ||
| 1382 | 1360 | regmap_update_bits(wcd->regmap, WCD934X_CLK_SYS_MCLK_PRG, |
| 1383 | 1361 | WCD934X_EXT_CLK_BUF_EN_MASK | |
| 1384 | 1362 | WCD934X_MCLK_EN_MASK, 0x0); |
| 1385 | − wcd934x_set_sido_input_src(wcd, SIDO_SOURCE_INTERNAL); | |
| 1386 | − | |
| 1387 | 1363 | regmap_update_bits(wcd->regmap, WCD934X_ANA_BIAS, |
| 1388 | 1364 | WCD934X_ANA_BIAS_EN_MASK, 0); |
| 1389 | 1365 | regmap_update_bits(wcd->regmap, WCD934X_ANA_BIAS, |
| @@ -602,7 +602,7 @@ static int wm8731_hw_init(struct device *dev, struct wm8731_priv *wm8731) · 601 unmodified lines | ||
| 602 | 602 | ret = wm8731_reset(wm8731->regmap); |
| 603 | 603 | if (ret < 0) { |
| 604 | 604 | dev_err(dev, "Failed to issue reset: %d\n", ret); |
| 605 | − goto err_regulator_enable; | |
| 605 | + goto err; | |
| 606 | 606 | } |
| 607 | 607 | |
| 608 | 608 | /* Clear POWEROFF, keep everything else disabled */ |
| @@ -619,10 +619,7 @@ static int wm8731_hw_init(struct device *dev, struct wm8731_priv *wm8731) · 10 unmodified lines | ||
| 619 | 619 | |
| 620 | 620 | regcache_mark_dirty(wm8731->regmap); |
| 621 | 621 | |
| 622 | −err_regulator_enable: | |
| 623 | − /* Regulators will be enabled by bias management */ | |
| 624 | − regulator_bulk_disable(ARRAY_SIZE(wm8731->supplies), wm8731->supplies); | |
| 625 | − | |
| 622 | +err: | |
| 626 | 623 | return ret; |
| 627 | 624 | } |
| 628 | 625 | |
| @@ -760,21 +757,27 @@ static int wm8731_i2c_probe(struct i2c_client *i2c, · 131 unmodified lines | ||
| 760 | 757 | ret = PTR_ERR(wm8731->regmap); |
| 761 | 758 | dev_err(&i2c->dev, "Failed to allocate register map: %d\n", |
| 762 | 759 | ret); |
| 763 | − return ret; | |
| 760 | + goto err_regulator_enable; | |
| 764 | 761 | } |
| 765 | 762 | |
| 766 | 763 | ret = wm8731_hw_init(&i2c->dev, wm8731); |
| 767 | 764 | if (ret != 0) |
| 768 | − return ret; | |
| 765 | + goto err_regulator_enable; | |
| 769 | 766 | |
| 770 | 767 | ret = devm_snd_soc_register_component(&i2c->dev, |
| 771 | 768 | &soc_component_dev_wm8731, &wm8731_dai, 1); |
| 772 | 769 | if (ret != 0) { |
| 773 | 770 | dev_err(&i2c->dev, "Failed to register CODEC: %d\n", ret); |
| 774 | − return ret; | |
| 771 | + goto err_regulator_enable; | |
| 775 | 772 | } |
| 776 | 773 | |
| 777 | 774 | return 0; |
| 775 | + | |
| 776 | +err_regulator_enable: | |
| 777 | + /* Regulators will be enabled by bias management */ | |
| 778 | + regulator_bulk_disable(ARRAY_SIZE(wm8731->supplies), wm8731->supplies); | |
| 779 | + | |
| 780 | + return ret; | |
| 778 | 781 | } |
| 779 | 782 | |
| 780 | 783 | static const struct i2c_device_id wm8731_i2c_id[] = { |
| @@ -530,7 +530,7 @@ static int wm8958_mbc_put(struct snd_kcontrol *kcontrol, · 529 unmodified lines | ||
| 530 | 530 | |
| 531 | 531 | wm8958_dsp_apply(component, mbc, wm8994->mbc_ena[mbc]); |
| 532 | 532 | |
| 533 | − return 0; | |
| 533 | + return 1; | |
| 534 | 534 | } |
| 535 | 535 | |
| 536 | 536 | #define WM8958_MBC_SWITCH(xname, xval) {\ |
| @@ -656,7 +656,7 @@ static int wm8958_vss_put(struct snd_kcontrol *kcontrol, · 119 unmodified lines | ||
| 656 | 656 | |
| 657 | 657 | wm8958_dsp_apply(component, vss, wm8994->vss_ena[vss]); |
| 658 | 658 | |
| 659 | − return 0; | |
| 659 | + return 1; | |
| 660 | 660 | } |
| 661 | 661 | |
| 662 | 662 | |
| @@ -730,7 +730,7 @@ static int wm8958_hpf_put(struct snd_kcontrol *kcontrol, · 67 unmodified lines | ||
| 730 | 730 | |
| 731 | 731 | wm8958_dsp_apply(component, hpf % 3, ucontrol->value.integer.value[0]); |
| 732 | 732 | |
| 733 | − return 0; | |
| 733 | + return 1; | |
| 734 | 734 | } |
| 735 | 735 | |
| 736 | 736 | #define WM8958_HPF_SWITCH(xname, xval) {\ |
| @@ -824,7 +824,7 @@ static int wm8958_enh_eq_put(struct snd_kcontrol *kcontrol, · 87 unmodified lines | ||
| 824 | 824 | |
| 825 | 825 | wm8958_dsp_apply(component, eq, ucontrol->value.integer.value[0]); |
| 826 | 826 | |
| 827 | − return 0; | |
| 827 | + return 1; | |
| 828 | 828 | } |
| 829 | 829 | |
| 830 | 830 | #define WM8958_ENH_EQ_SWITCH(xname, xval) {\ |
| @@ -97,13 +97,13 @@ struct wm_adsp_system_config_xm_hdr { · 96 unmodified lines | ||
| 97 | 97 | __be32 wdma[8]; |
| 98 | 98 | __be32 build_job_name[3]; |
| 99 | 99 | __be32 build_job_number; |
| 100 | −}; | |
| 100 | +} __packed; | |
| 101 | 101 | |
| 102 | 102 | struct wm_halo_system_config_xm_hdr { |
| 103 | 103 | __be32 halo_heartbeat; |
| 104 | 104 | __be32 build_job_name[3]; |
| 105 | 105 | __be32 build_job_number; |
| 106 | −}; | |
| 106 | +} __packed; | |
| 107 | 107 | |
| 108 | 108 | struct wm_adsp_alg_xm_struct { |
| 109 | 109 | __be32 magic; |
| @@ -114,13 +114,13 @@ struct wm_adsp_alg_xm_struct { · 4 unmodified lines | ||
| 114 | 114 | __be32 high_water_mark; |
| 115 | 115 | __be32 low_water_mark; |
| 116 | 116 | __be64 smoothed_power; |
| 117 | −}; | |
| 117 | +} __packed; | |
| 118 | 118 | |
| 119 | 119 | struct wm_adsp_host_buf_coeff_v1 { |
| 120 | 120 | __be32 host_buf_ptr; /* Host buffer pointer */ |
| 121 | 121 | __be32 versions; /* Version numbers */ |
| 122 | 122 | __be32 name[4]; /* The buffer name */ |
| 123 | −}; | |
| 123 | +} __packed; | |
| 124 | 124 | |
| 125 | 125 | struct wm_adsp_buffer { |
| 126 | 126 | __be32 buf1_base; /* Base addr of first buffer area */ |
| @@ -141,7 +141,7 @@ struct wm_adsp_buffer { · 14 unmodified lines | ||
| 141 | 141 | __be32 min_free; /* min free space since stream start */ |
| 142 | 142 | __be32 blocks_written[2]; /* total blocks written (64 bit) */ |
| 143 | 143 | __be32 words_written[2]; /* total words written (64 bit) */ |
| 144 | −}; | |
| 144 | +} __packed; | |
| 145 | 145 | |
| 146 | 146 | struct wm_adsp_compr; |
| 147 | 147 | |
| @@ -372,7 +372,7 @@ static int fsl_sai_set_bclk(struct snd_soc_dai *dai, bool tx, u32 freq) · 371 unmodified lines | ||
| 372 | 372 | continue; |
| 373 | 373 | if (ratio == 1 && !support_1_1_ratio) |
| 374 | 374 | continue; |
| 375 | − else if (ratio & 1) | |
| 375 | + if ((ratio & 1) && ratio > 1) | |
| 376 | 376 | continue; |
| 377 | 377 | |
| 378 | 378 | diff = abs((long)clk_rate - ratio * freq); |
| @@ -322,7 +322,7 @@ void asoc_simple_shutdown(struct snd_pcm_substream *substream) · 321 unmodified lines | ||
| 322 | 322 | |
| 323 | 323 | if (props->mclk_fs && !dai->clk_fixed && !snd_soc_dai_active(cpu_dai)) |
| 324 | 324 | snd_soc_dai_set_sysclk(cpu_dai, |
| 325 | − 0, 0, SND_SOC_CLOCK_IN); | |
| 325 | + 0, 0, SND_SOC_CLOCK_OUT); | |
| 326 | 326 | |
| 327 | 327 | asoc_simple_clk_disable(dai); |
| 328 | 328 | } |
| @@ -364,13 +364,15 @@ static int asoc_simple_set_tdm(struct snd_soc_dai *dai, · 35 unmodified lines | ||
| 364 | 364 | struct snd_pcm_hw_params *params) |
| 365 | 365 | { |
| 366 | 366 | int sample_bits = params_width(params); |
| 367 | − int slot_width = simple_dai->slot_width; | |
| 368 | − int slot_count = simple_dai->slots; | |
| 367 | + int slot_width, slot_count; | |
| 369 | 368 | int i, ret; |
| 370 | 369 | |
| 371 | 370 | if (!simple_dai || !simple_dai->tdm_width_map) |
| 372 | 371 | return 0; |
| 373 | 372 | |
| 373 | + slot_width = simple_dai->slot_width; | |
| 374 | + slot_count = simple_dai->slots; | |
| 375 | + | |
| 374 | 376 | if (slot_width == 0) |
| 375 | 377 | slot_width = sample_bits; |
| 376 | 378 | |
| @@ -27,9 +27,11 @@ · 26 unmodified lines | ||
| 27 | 27 | #define SOF_ES8336_SSP_CODEC(quirk) ((quirk) & GENMASK(3, 0)) |
| 28 | 28 | #define SOF_ES8336_SSP_CODEC_MASK (GENMASK(3, 0)) |
| 29 | 29 | |
| 30 | −#define SOF_ES8336_TGL_GPIO_QUIRK BIT(4) | |
| 30 | +#define SOF_ES8336_SPEAKERS_EN_GPIO1_QUIRK BIT(4) | |
| 31 | 31 | #define SOF_ES8336_ENABLE_DMIC BIT(5) |
| 32 | 32 | #define SOF_ES8336_JD_INVERTED BIT(6) |
| 33 | +#define SOF_ES8336_HEADPHONE_GPIO BIT(7) | |
| 34 | +#define SOC_ES8336_HEADSET_MIC1 BIT(8) | |
| 33 | 35 | |
| 34 | 36 | static unsigned long quirk; |
| 35 | 37 | |
| @@ -39,7 +41,7 @@ MODULE_PARM_DESC(quirk, "Board-specific quirk override"); · 3 unmodified lines | ||
| 39 | 41 | |
| 40 | 42 | struct sof_es8336_private { |
| 41 | 43 | struct device *codec_dev; |
| 42 | − struct gpio_desc *gpio_pa; | |
| 44 | + struct gpio_desc *gpio_speakers, *gpio_headphone; | |
| 43 | 45 | struct snd_soc_jack jack; |
| 44 | 46 | struct list_head hdmi_pcm_list; |
| 45 | 47 | bool speaker_en; |
| @@ -51,19 +53,31 @@ struct sof_hdmi_pcm { · 5 unmodified lines | ||
| 51 | 53 | int device; |
| 52 | 54 | }; |
| 53 | 55 | |
| 54 | −static const struct acpi_gpio_params pa_enable_gpio = { 0, 0, true }; | |
| 55 | −static const struct acpi_gpio_mapping acpi_es8336_gpios[] = { | |
| 56 | − { "pa-enable-gpios", &pa_enable_gpio, 1 }, | |
| 56 | +static const struct acpi_gpio_params enable_gpio0 = { 0, 0, true }; | |
| 57 | +static const struct acpi_gpio_params enable_gpio1 = { 1, 0, true }; | |
| 58 | + | |
| 59 | +static const struct acpi_gpio_mapping acpi_speakers_enable_gpio0[] = { | |
| 60 | + { "speakers-enable-gpios", &enable_gpio0, 1 }, | |
| 57 | 61 | { } |
| 58 | 62 | }; |
| 59 | 63 | |
| 60 | −static const struct acpi_gpio_params quirk_pa_enable_gpio = { 1, 0, true }; | |
| 61 | −static const struct acpi_gpio_mapping quirk_acpi_es8336_gpios[] = { | |
| 62 | − { "pa-enable-gpios", &quirk_pa_enable_gpio, 1 }, | |
| 64 | +static const struct acpi_gpio_mapping acpi_speakers_enable_gpio1[] = { | |
| 65 | + { "speakers-enable-gpios", &enable_gpio1, 1 }, | |
| 66 | +}; | |
| 67 | + | |
| 68 | +static const struct acpi_gpio_mapping acpi_enable_both_gpios[] = { | |
| 69 | + { "speakers-enable-gpios", &enable_gpio0, 1 }, | |
| 70 | + { "headphone-enable-gpios", &enable_gpio1, 1 }, | |
| 63 | 71 | { } |
| 64 | 72 | }; |
| 65 | 73 | |
| 66 | −static const struct acpi_gpio_mapping *gpio_mapping = acpi_es8336_gpios; | |
| 74 | +static const struct acpi_gpio_mapping acpi_enable_both_gpios_rev_order[] = { | |
| 75 | + { "speakers-enable-gpios", &enable_gpio1, 1 }, | |
| 76 | + { "headphone-enable-gpios", &enable_gpio0, 1 }, | |
| 77 | + { } | |
| 78 | +}; | |
| 79 | + | |
| 80 | +static const struct acpi_gpio_mapping *gpio_mapping = acpi_speakers_enable_gpio0; | |
| 67 | 81 | |
| 68 | 82 | static void log_quirks(struct device *dev) |
| 69 | 83 | { |
| @@ -71,10 +85,14 @@ static void log_quirks(struct device *dev) · 1 unmodified line | ||
| 71 | 85 | dev_info(dev, "quirk SSP%ld\n", SOF_ES8336_SSP_CODEC(quirk)); |
| 72 | 86 | if (quirk & SOF_ES8336_ENABLE_DMIC) |
| 73 | 87 | dev_info(dev, "quirk DMIC enabled\n"); |
| 74 | − if (quirk & SOF_ES8336_TGL_GPIO_QUIRK) | |
| 75 | − dev_info(dev, "quirk TGL GPIO enabled\n"); | |
| 88 | + if (quirk & SOF_ES8336_SPEAKERS_EN_GPIO1_QUIRK) | |
| 89 | + dev_info(dev, "Speakers GPIO1 quirk enabled\n"); | |
| 90 | + if (quirk & SOF_ES8336_HEADPHONE_GPIO) | |
| 91 | + dev_info(dev, "quirk headphone GPIO enabled\n"); | |
| 76 | 92 | if (quirk & SOF_ES8336_JD_INVERTED) |
| 77 | 93 | dev_info(dev, "quirk JD inverted enabled\n"); |
| 94 | + if (quirk & SOC_ES8336_HEADSET_MIC1) | |
| 95 | + dev_info(dev, "quirk headset at mic1 port enabled\n"); | |
| 78 | 96 | } |
| 79 | 97 | |
| 80 | 98 | static int sof_es8316_speaker_power_event(struct snd_soc_dapm_widget *w, |
| @@ -83,12 +101,23 @@ static int sof_es8316_speaker_power_event(struct snd_soc_dapm_widget *w, · 2 unmodified lines | ||
| 83 | 101 | struct snd_soc_card *card = w->dapm->card; |
| 84 | 102 | struct sof_es8336_private *priv = snd_soc_card_get_drvdata(card); |
| 85 | 103 | |
| 104 | + if (priv->speaker_en == !SND_SOC_DAPM_EVENT_ON(event)) | |
| 105 | + return 0; | |
| 106 | + | |
| 107 | + priv->speaker_en = !SND_SOC_DAPM_EVENT_ON(event); | |
| 108 | + | |
| 109 | + if (SND_SOC_DAPM_EVENT_ON(event)) | |
| 110 | + msleep(70); | |
| 111 | + | |
| 112 | + gpiod_set_value_cansleep(priv->gpio_speakers, priv->speaker_en); | |
| 113 | + | |
| 114 | + if (!(quirk & SOF_ES8336_HEADPHONE_GPIO)) | |
| 115 | + return 0; | |
| 116 | + | |
| 86 | 117 | if (SND_SOC_DAPM_EVENT_ON(event)) |
| 87 | − priv->speaker_en = false; | |
| 88 | − else | |
| 89 | − priv->speaker_en = true; | |
| 118 | + msleep(70); | |
| 90 | 119 | |
| 91 | − gpiod_set_value_cansleep(priv->gpio_pa, priv->speaker_en); | |
| 120 | + gpiod_set_value_cansleep(priv->gpio_headphone, priv->speaker_en); | |
| 92 | 121 | |
| 93 | 122 | return 0; |
| 94 | 123 | } |
| @@ -114,18 +143,23 @@ static const struct snd_soc_dapm_route sof_es8316_audio_map[] = { · 19 unmodified lines | ||
| 114 | 143 | |
| 115 | 144 | /* |
| 116 | 145 | * There is no separate speaker output instead the speakers are muxed to |
| 117 | − * the HP outputs. The mux is controlled by the "Speaker Power" supply. | |
| 146 | + * the HP outputs. The mux is controlled Speaker and/or headphone switch. | |
| 118 | 147 | */ |
| 119 | 148 | {"Speaker", NULL, "HPOL"}, |
| 120 | 149 | {"Speaker", NULL, "HPOR"}, |
| 121 | 150 | {"Speaker", NULL, "Speaker Power"}, |
| 122 | 151 | }; |
| 123 | 152 | |
| 124 | −static const struct snd_soc_dapm_route sof_es8316_intmic_in1_map[] = { | |
| 153 | +static const struct snd_soc_dapm_route sof_es8316_headset_mic2_map[] = { | |
| 125 | 154 | {"MIC1", NULL, "Internal Mic"}, |
| 126 | 155 | {"MIC2", NULL, "Headset Mic"}, |
| 127 | 156 | }; |
| 128 | 157 | |
| 158 | +static const struct snd_soc_dapm_route sof_es8316_headset_mic1_map[] = { | |
| 159 | + {"MIC2", NULL, "Internal Mic"}, | |
| 160 | + {"MIC1", NULL, "Headset Mic"}, | |
| 161 | +}; | |
| 162 | + | |
| 129 | 163 | static const struct snd_soc_dapm_route dmic_map[] = { |
| 130 | 164 | /* digital mics */ |
| 131 | 165 | {"DMic", NULL, "SoC DMIC"}, |
| @@ -199,8 +233,13 @@ static int sof_es8316_init(struct snd_soc_pcm_runtime *runtime) · 67 unmodified lines | ||
| 199 | 233 | |
| 200 | 234 | card->dapm.idle_bias_off = true; |
| 201 | 235 | |
| 202 | − custom_map = sof_es8316_intmic_in1_map; | |
| 203 | − num_routes = ARRAY_SIZE(sof_es8316_intmic_in1_map); | |
| 236 | + if (quirk & SOC_ES8336_HEADSET_MIC1) { | |
| 237 | + custom_map = sof_es8316_headset_mic1_map; | |
| 238 | + num_routes = ARRAY_SIZE(sof_es8316_headset_mic1_map); | |
| 239 | + } else { | |
| 240 | + custom_map = sof_es8316_headset_mic2_map; | |
| 241 | + num_routes = ARRAY_SIZE(sof_es8316_headset_mic2_map); | |
| 242 | + } | |
| 204 | 243 | |
| 205 | 244 | ret = snd_soc_dapm_add_routes(&card->dapm, custom_map, num_routes); |
| 206 | 245 | if (ret) |
| @@ -233,8 +272,14 @@ static int sof_es8336_quirk_cb(const struct dmi_system_id *id) · 26 unmodified lines | ||
| 233 | 272 | { |
| 234 | 273 | quirk = (unsigned long)id->driver_data; |
| 235 | 274 | |
| 236 | − if (quirk & SOF_ES8336_TGL_GPIO_QUIRK) | |
| 237 | − gpio_mapping = quirk_acpi_es8336_gpios; | |
| 275 | + if (quirk & SOF_ES8336_HEADPHONE_GPIO) { | |
| 276 | + if (quirk & SOF_ES8336_SPEAKERS_EN_GPIO1_QUIRK) | |
| 277 | + gpio_mapping = acpi_enable_both_gpios; | |
| 278 | + else | |
| 279 | + gpio_mapping = acpi_enable_both_gpios_rev_order; | |
| 280 | + } else if (quirk & SOF_ES8336_SPEAKERS_EN_GPIO1_QUIRK) { | |
| 281 | + gpio_mapping = acpi_speakers_enable_gpio1; | |
| 282 | + } | |
| 238 | 283 | |
| 239 | 284 | return 1; |
| 240 | 285 | } |
| @@ -257,7 +302,16 @@ static const struct dmi_system_id sof_es8336_quirk_table[] = { · 16 unmodified lines | ||
| 257 | 302 | DMI_MATCH(DMI_SYS_VENDOR, "IP3 tech"), |
| 258 | 303 | DMI_MATCH(DMI_BOARD_NAME, "WN1"), |
| 259 | 304 | }, |
| 260 | − .driver_data = (void *)(SOF_ES8336_TGL_GPIO_QUIRK) | |
| 305 | + .driver_data = (void *)(SOF_ES8336_SPEAKERS_EN_GPIO1_QUIRK) | |
| 306 | + }, | |
| 307 | + { | |
| 308 | + .callback = sof_es8336_quirk_cb, | |
| 309 | + .matches = { | |
| 310 | + DMI_MATCH(DMI_SYS_VENDOR, "HUAWEI"), | |
| 311 | + DMI_MATCH(DMI_BOARD_NAME, "BOHB-WAX9-PCB-B2"), | |
| 312 | + }, | |
| 313 | + .driver_data = (void *)(SOF_ES8336_HEADPHONE_GPIO | | |
| 314 | + SOC_ES8336_HEADSET_MIC1) | |
| 261 | 315 | }, |
| 262 | 316 | {} |
| 263 | 317 | }; |
| @@ -585,10 +639,17 @@ static int sof_es8336_probe(struct platform_device *pdev) · 321 unmodified lines | ||
| 585 | 639 | if (ret) |
| 586 | 640 | dev_warn(codec_dev, "unable to add GPIO mapping table\n"); |
| 587 | 641 | |
| 588 | − priv->gpio_pa = gpiod_get_optional(codec_dev, "pa-enable", GPIOD_OUT_LOW); | |
| 589 | − if (IS_ERR(priv->gpio_pa)) { | |
| 590 | − ret = dev_err_probe(dev, PTR_ERR(priv->gpio_pa), | |
| 591 | − "could not get pa-enable GPIO\n"); | |
| 642 | + priv->gpio_speakers = gpiod_get_optional(codec_dev, "speakers-enable", GPIOD_OUT_LOW); | |
| 643 | + if (IS_ERR(priv->gpio_speakers)) { | |
| 644 | + ret = dev_err_probe(dev, PTR_ERR(priv->gpio_speakers), | |
| 645 | + "could not get speakers-enable GPIO\n"); | |
| 646 | + goto err_put_codec; | |
| 647 | + } | |
| 648 | + | |
| 649 | + priv->gpio_headphone = gpiod_get_optional(codec_dev, "headphone-enable", GPIOD_OUT_LOW); | |
| 650 | + if (IS_ERR(priv->gpio_headphone)) { | |
| 651 | + ret = dev_err_probe(dev, PTR_ERR(priv->gpio_headphone), | |
| 652 | + "could not get headphone-enable GPIO\n"); | |
| 592 | 653 | goto err_put_codec; |
| 593 | 654 | } |
| 594 | 655 | |
| @@ -604,7 +665,7 @@ static int sof_es8336_probe(struct platform_device *pdev) · 9 unmodified lines | ||
| 604 | 665 | |
| 605 | 666 | ret = devm_snd_soc_register_card(dev, card); |
| 606 | 667 | if (ret) { |
| 607 | − gpiod_put(priv->gpio_pa); | |
| 668 | + gpiod_put(priv->gpio_speakers); | |
| 608 | 669 | dev_err(dev, "snd_soc_register_card failed: %d\n", ret); |
| 609 | 670 | goto err_put_codec; |
| 610 | 671 | } |
| @@ -622,7 +683,7 @@ static int sof_es8336_remove(struct platform_device *pdev) · 11 unmodified lines | ||
| 622 | 683 | struct snd_soc_card *card = platform_get_drvdata(pdev); |
| 623 | 684 | struct sof_es8336_private *priv = snd_soc_card_get_drvdata(card); |
| 624 | 685 | |
| 625 | − gpiod_put(priv->gpio_pa); | |
| 686 | + gpiod_put(priv->gpio_speakers); | |
| 626 | 687 | device_remove_software_node(priv->codec_dev); |
| 627 | 688 | put_device(priv->codec_dev); |
| 628 | 689 | |
| @@ -212,6 +212,19 @@ static const struct dmi_system_id sof_rt5682_quirk_table[] = { · 211 unmodified lines | ||
| 212 | 212 | SOF_SSP_BT_OFFLOAD_PRESENT), |
| 213 | 213 | |
| 214 | 214 | }, |
| 215 | + { | |
| 216 | + .callback = sof_rt5682_quirk_cb, | |
| 217 | + .matches = { | |
| 218 | + DMI_MATCH(DMI_PRODUCT_FAMILY, "Google_Brya"), | |
| 219 | + DMI_MATCH(DMI_OEM_STRING, "AUDIO-MAX98360_ALC5682I_I2S_AMP_SSP2"), | |
| 220 | + }, | |
| 221 | + .driver_data = (void *)(SOF_RT5682_MCLK_EN | | |
| 222 | + SOF_RT5682_SSP_CODEC(0) | | |
| 223 | + SOF_SPEAKER_AMP_PRESENT | | |
| 224 | + SOF_MAX98360A_SPEAKER_AMP_PRESENT | | |
| 225 | + SOF_RT5682_SSP_AMP(2) | | |
| 226 | + SOF_RT5682_NUM_HDMIDEV(4)), | |
| 227 | + }, | |
| 215 | 228 | {} |
| 216 | 229 | }; |
| 217 | 230 | |
| @@ -132,13 +132,13 @@ static const struct snd_soc_acpi_adr_device mx8373_1_adr[] = { · 131 unmodified lines | ||
| 132 | 132 | { |
| 133 | 133 | .adr = 0x000123019F837300ull, |
| 134 | 134 | .num_endpoints = 1, |
| 135 | − .endpoints = &spk_l_endpoint, | |
| 135 | + .endpoints = &spk_r_endpoint, | |
| 136 | 136 | .name_prefix = "Right" |
| 137 | 137 | }, |
| 138 | 138 | { |
| 139 | 139 | .adr = 0x000127019F837300ull, |
| 140 | 140 | .num_endpoints = 1, |
| 141 | − .endpoints = &spk_r_endpoint, | |
| 141 | + .endpoints = &spk_l_endpoint, | |
| 142 | 142 | .name_prefix = "Left" |
| 143 | 143 | } |
| 144 | 144 | }; |
| @@ -58,7 +58,7 @@ static int aiu_acodec_ctrl_mux_put_enum(struct snd_kcontrol *kcontrol, · 57 unmodified lines | ||
| 58 | 58 | |
| 59 | 59 | snd_soc_dapm_mux_update_power(dapm, kcontrol, mux, e, NULL); |
| 60 | 60 | |
| 61 | − return 0; | |
| 61 | + return 1; | |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | static SOC_ENUM_SINGLE_DECL(aiu_acodec_ctrl_mux_enum, AIU_ACODEC_CTRL, |
| @@ -193,6 +193,9 @@ static const struct snd_soc_component_driver aiu_acodec_ctrl_component = { · 128 unmodified lines | ||
| 193 | 193 | .of_xlate_dai_name = aiu_acodec_of_xlate_dai_name, |
| 194 | 194 | .endianness = 1, |
| 195 | 195 | .non_legacy_dai_naming = 1, |
| 196 | +#ifdef CONFIG_DEBUG_FS | |
| 197 | + .debugfs_prefix = "acodec", | |
| 198 | +#endif | |
| 196 | 199 | }; |
| 197 | 200 | |
| 198 | 201 | int aiu_acodec_ctrl_register_component(struct device *dev) |
| @@ -57,7 +57,7 @@ static int aiu_codec_ctrl_mux_put_enum(struct snd_kcontrol *kcontrol, · 56 unmodified lines | ||
| 57 | 57 | |
| 58 | 58 | snd_soc_dapm_mux_update_power(dapm, kcontrol, mux, e, NULL); |
| 59 | 59 | |
| 60 | − return 0; | |
| 60 | + return 1; | |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | static SOC_ENUM_SINGLE_DECL(aiu_hdmi_ctrl_mux_enum, AIU_HDMI_CLK_DATA_CTRL, |
| @@ -140,6 +140,9 @@ static const struct snd_soc_component_driver aiu_hdmi_ctrl_component = { · 76 unmodified lines | ||
| 140 | 140 | .of_xlate_dai_name = aiu_hdmi_of_xlate_dai_name, |
| 141 | 141 | .endianness = 1, |
| 142 | 142 | .non_legacy_dai_naming = 1, |
| 143 | +#ifdef CONFIG_DEBUG_FS | |
| 144 | + .debugfs_prefix = "hdmi", | |
| 145 | +#endif | |
| 143 | 146 | }; |
| 144 | 147 | |
| 145 | 148 | int aiu_hdmi_ctrl_register_component(struct device *dev) |
| @@ -103,6 +103,9 @@ static const struct snd_soc_component_driver aiu_cpu_component = { · 102 unmodified lines | ||
| 103 | 103 | .pointer = aiu_fifo_pointer, |
| 104 | 104 | .probe = aiu_cpu_component_probe, |
| 105 | 105 | .remove = aiu_cpu_component_remove, |
| 106 | +#ifdef CONFIG_DEBUG_FS | |
| 107 | + .debugfs_prefix = "cpu", | |
| 108 | +#endif | |
| 106 | 109 | }; |
| 107 | 110 | |
| 108 | 111 | static struct snd_soc_dai_driver aiu_cpu_dai_drv[] = { |
| @@ -320,7 +320,6 @@ static int axg_card_add_link(struct snd_soc_card *card, struct device_node *np, · 319 unmodified lines | ||
| 320 | 320 | |
| 321 | 321 | dai_link->cpus = cpu; |
| 322 | 322 | dai_link->num_cpus = 1; |
| 323 | − dai_link->nonatomic = true; | |
| 324 | 323 | |
| 325 | 324 | ret = meson_card_parse_dai(card, np, &dai_link->cpus->of_node, |
| 326 | 325 | &dai_link->cpus->dai_name); |
| @@ -351,29 +351,13 @@ static int axg_tdm_iface_hw_free(struct snd_pcm_substream *substream, · 350 unmodified lines | ||
| 351 | 351 | return 0; |
| 352 | 352 | } |
| 353 | 353 | |
| 354 | −static int axg_tdm_iface_trigger(struct snd_pcm_substream *substream, | |
| 355 | − int cmd, | |
| 354 | +static int axg_tdm_iface_prepare(struct snd_pcm_substream *substream, | |
| 356 | 355 | struct snd_soc_dai *dai) |
| 357 | 356 | { |
| 358 | − struct axg_tdm_stream *ts = | |
| 359 | − snd_soc_dai_get_dma_data(dai, substream); | |
| 360 | − | |
| 361 | − switch (cmd) { | |
| 362 | − case SNDRV_PCM_TRIGGER_START: | |
| 363 | − case SNDRV_PCM_TRIGGER_RESUME: | |
| 364 | − case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: | |
| 365 | − axg_tdm_stream_start(ts); | |
| 366 | − break; | |
| 367 | − case SNDRV_PCM_TRIGGER_SUSPEND: | |
| 368 | − case SNDRV_PCM_TRIGGER_PAUSE_PUSH: | |
| 369 | − case SNDRV_PCM_TRIGGER_STOP: | |
| 370 | − axg_tdm_stream_stop(ts); | |
| 371 | − break; | |
| 372 | − default: | |
| 373 | − return -EINVAL; | |
| 374 | − } | |
| 357 | + struct axg_tdm_stream *ts = snd_soc_dai_get_dma_data(dai, substream); | |
| 375 | 358 | |
| 376 | − return 0; | |
| 359 | + /* Force all attached formatters to update */ | |
| 360 | + return axg_tdm_stream_reset(ts); | |
| 377 | 361 | } |
| 378 | 362 | |
| 379 | 363 | static int axg_tdm_iface_remove_dai(struct snd_soc_dai *dai) |
| @@ -413,8 +397,8 @@ static const struct snd_soc_dai_ops axg_tdm_iface_ops = { · 33 unmodified lines | ||
| 413 | 397 | .set_fmt = axg_tdm_iface_set_fmt, |
| 414 | 398 | .startup = axg_tdm_iface_startup, |
| 415 | 399 | .hw_params = axg_tdm_iface_hw_params, |
| 400 | + .prepare = axg_tdm_iface_prepare, | |
| 416 | 401 | .hw_free = axg_tdm_iface_hw_free, |
| 417 | − .trigger = axg_tdm_iface_trigger, | |
| 418 | 402 | }; |
| 419 | 403 | |
| 420 | 404 | /* TDM Backend DAIs */ |
| @@ -67,7 +67,7 @@ static int g12a_tohdmitx_i2s_mux_put_enum(struct snd_kcontrol *kcontrol, · 66 unmodified lines | ||
| 67 | 67 | |
| 68 | 68 | snd_soc_dapm_mux_update_power(dapm, kcontrol, mux, e, NULL); |
| 69 | 69 | |
| 70 | − return 0; | |
| 70 | + return 1; | |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | static SOC_ENUM_SINGLE_DECL(g12a_tohdmitx_i2s_mux_enum, TOHDMITX_CTRL0, |
| @@ -2587,6 +2587,11 @@ int snd_soc_component_initialize(struct snd_soc_component *component, · 2586 unmodified lines | ||
| 2587 | 2587 | component->dev = dev; |
| 2588 | 2588 | component->driver = driver; |
| 2589 | 2589 | |
| 2590 | +#ifdef CONFIG_DEBUG_FS | |
| 2591 | + if (!component->debugfs_prefix) | |
| 2592 | + component->debugfs_prefix = driver->debugfs_prefix; | |
| 2593 | +#endif | |
| 2594 | + | |
| 2590 | 2595 | return 0; |
| 2591 | 2596 | } |
| 2592 | 2597 | EXPORT_SYMBOL_GPL(snd_soc_component_initialize); |
| @@ -1687,8 +1687,7 @@ static void dapm_seq_run(struct snd_soc_card *card, · 1686 unmodified lines | ||
| 1687 | 1687 | switch (w->id) { |
| 1688 | 1688 | case snd_soc_dapm_pre: |
| 1689 | 1689 | if (!w->event) |
| 1690 | − list_for_each_entry_safe_continue(w, n, list, | |
| 1691 | − power_list); | |
| 1690 | + continue; | |
| 1692 | 1691 | |
| 1693 | 1692 | if (event == SND_SOC_DAPM_STREAM_START) |
| 1694 | 1693 | ret = w->event(w, |
| @@ -1700,8 +1699,7 @@ static void dapm_seq_run(struct snd_soc_card *card, · 5 unmodified lines | ||
| 1700 | 1699 | |
| 1701 | 1700 | case snd_soc_dapm_post: |
| 1702 | 1701 | if (!w->event) |
| 1703 | − list_for_each_entry_safe_continue(w, n, list, | |
| 1704 | − power_list); | |
| 1702 | + continue; | |
| 1705 | 1703 | |
| 1706 | 1704 | if (event == SND_SOC_DAPM_STREAM_START) |
| 1707 | 1705 | ret = w->event(w, |
| @@ -86,10 +86,10 @@ static int dmaengine_pcm_hw_params(struct snd_soc_component *component, · 85 unmodified lines | ||
| 86 | 86 | |
| 87 | 87 | memset(&slave_config, 0, sizeof(slave_config)); |
| 88 | 88 | |
| 89 | − if (pcm->config && pcm->config->prepare_slave_config) | |
| 90 | − prepare_slave_config = pcm->config->prepare_slave_config; | |
| 91 | − else | |
| 89 | + if (!pcm->config) | |
| 92 | 90 | prepare_slave_config = snd_dmaengine_pcm_prepare_slave_config; |
| 91 | + else | |
| 92 | + prepare_slave_config = pcm->config->prepare_slave_config; | |
| 93 | 93 | |
| 94 | 94 | if (prepare_slave_config) { |
| 95 | 95 | int ret = prepare_slave_config(substream, params, &slave_config); |
| @@ -461,7 +461,7 @@ int snd_soc_put_volsw_sx(struct snd_kcontrol *kcontrol, · 460 unmodified lines | ||
| 461 | 461 | ret = err; |
| 462 | 462 | } |
| 463 | 463 | } |
| 464 | − return err; | |
| 464 | + return ret; | |
| 465 | 465 | } |
| 466 | 466 | EXPORT_SYMBOL_GPL(snd_soc_put_volsw_sx); |
| 467 | 467 | |
| @@ -519,7 +519,15 @@ int snd_soc_put_volsw_range(struct snd_kcontrol *kcontrol, · 51 unmodified lines | ||
| 519 | 519 | unsigned int mask = (1 << fls(max)) - 1; |
| 520 | 520 | unsigned int invert = mc->invert; |
| 521 | 521 | unsigned int val, val_mask; |
| 522 | − int err, ret; | |
| 522 | + int err, ret, tmp; | |
| 523 | + | |
| 524 | + tmp = ucontrol->value.integer.value[0]; | |
| 525 | + if (tmp < 0) | |
| 526 | + return -EINVAL; | |
| 527 | + if (mc->platform_max && tmp > mc->platform_max) | |
| 528 | + return -EINVAL; | |
| 529 | + if (tmp > mc->max - mc->min + 1) | |
| 530 | + return -EINVAL; | |
| 523 | 531 | |
| 524 | 532 | if (invert) |
| 525 | 533 | val = (max - ucontrol->value.integer.value[0]) & mask; |
| @@ -534,6 +542,14 @@ int snd_soc_put_volsw_range(struct snd_kcontrol *kcontrol, · 8 unmodified lines | ||
| 534 | 542 | ret = err; |
| 535 | 543 | |
| 536 | 544 | if (snd_soc_volsw_is_stereo(mc)) { |
| 545 | + tmp = ucontrol->value.integer.value[1]; | |
| 546 | + if (tmp < 0) | |
| 547 | + return -EINVAL; | |
| 548 | + if (mc->platform_max && tmp > mc->platform_max) | |
| 549 | + return -EINVAL; | |
| 550 | + if (tmp > mc->max - mc->min + 1) | |
| 551 | + return -EINVAL; | |
| 552 | + | |
| 537 | 553 | if (invert) |
| 538 | 554 | val = (max - ucontrol->value.integer.value[1]) & mask; |
| 539 | 555 | else |
| @@ -1214,7 +1214,7 @@ static int dpcm_be_connect(struct snd_soc_pcm_runtime *fe, · 1213 unmodified lines | ||
| 1214 | 1214 | be_substream->pcm->nonatomic = 1; |
| 1215 | 1215 | } |
| 1216 | 1216 | |
| 1217 | − dpcm = kzalloc(sizeof(struct snd_soc_dpcm), GFP_ATOMIC); | |
| 1217 | + dpcm = kzalloc(sizeof(struct snd_soc_dpcm), GFP_KERNEL); | |
| 1218 | 1218 | if (!dpcm) |
| 1219 | 1219 | return -ENOMEM; |
| 1220 | 1220 | |
| @@ -1436,12 +1436,12 @@ static int soc_tplg_dapm_widget_create(struct soc_tplg *tplg, · 1435 unmodified lines | ||
| 1436 | 1436 | template.num_kcontrols = le32_to_cpu(w->num_kcontrols); |
| 1437 | 1437 | kc = devm_kcalloc(tplg->dev, le32_to_cpu(w->num_kcontrols), sizeof(*kc), GFP_KERNEL); |
| 1438 | 1438 | if (!kc) |
| 1439 | − goto err; | |
| 1439 | + goto hdr_err; | |
| 1440 | 1440 | |
| 1441 | 1441 | kcontrol_type = devm_kcalloc(tplg->dev, le32_to_cpu(w->num_kcontrols), sizeof(unsigned int), |
| 1442 | 1442 | GFP_KERNEL); |
| 1443 | 1443 | if (!kcontrol_type) |
| 1444 | − goto err; | |
| 1444 | + goto hdr_err; | |
| 1445 | 1445 | |
| 1446 | 1446 | for (i = 0; i < le32_to_cpu(w->num_kcontrols); i++) { |
| 1447 | 1447 | control_hdr = (struct snd_soc_tplg_ctl_hdr *)tplg->pos; |
| @@ -83,7 +83,14 @@ static const struct dmi_system_id sof_tplg_table[] = { · 82 unmodified lines | ||
| 83 | 83 | }, |
| 84 | 84 | .driver_data = "sof-adl-max98357a-rt5682-2way.tplg", |
| 85 | 85 | }, |
| 86 | − | |
| 86 | + { | |
| 87 | + .callback = sof_tplg_cb, | |
| 88 | + .matches = { | |
| 89 | + DMI_MATCH(DMI_PRODUCT_FAMILY, "Google_Brya"), | |
| 90 | + DMI_MATCH(DMI_OEM_STRING, "AUDIO-MAX98360_ALC5682I_I2S_AMP_SSP2"), | |
| 91 | + }, | |
| 92 | + .driver_data = "sof-adl-max98357a-rt5682.tplg", | |
| 93 | + }, | |
| 87 | 94 | {} |
| 88 | 95 | }; |
| 89 | 96 | |
| @@ -146,6 +153,11 @@ int sof_pci_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) · 56 unmodified lines | ||
| 146 | 153 | |
| 147 | 154 | dev_dbg(&pci->dev, "PCI DSP detected"); |
| 148 | 155 | |
| 156 | + if (!desc) { | |
| 157 | + dev_err(dev, "error: no matching PCI descriptor\n"); | |
| 158 | + return -ENODEV; | |
| 159 | + } | |
| 160 | + | |
| 149 | 161 | if (!desc->ops) { |
| 150 | 162 | dev_err(dev, "error: no matching PCI descriptor ops\n"); |
| 151 | 163 | return -ENODEV; |
| @@ -904,8 +904,10 @@ static int sof_control_load(struct snd_soc_component *scomp, int index, · 903 unmodified lines | ||
| 904 | 904 | return -ENOMEM; |
| 905 | 905 | |
| 906 | 906 | scontrol->name = kstrdup(hdr->name, GFP_KERNEL); |
| 907 | − if (!scontrol->name) | |
| 907 | + if (!scontrol->name) { | |
| 908 | + kfree(scontrol); | |
| 908 | 909 | return -ENOMEM; |
| 910 | + } | |
| 909 | 911 | |
| 910 | 912 | scontrol->scomp = scomp; |
| 911 | 913 | scontrol->access = kc->access; |
| @@ -941,11 +943,13 @@ static int sof_control_load(struct snd_soc_component *scomp, int index, · 29 unmodified lines | ||
| 941 | 943 | default: |
| 942 | 944 | dev_warn(scomp->dev, "control type not supported %d:%d:%d\n", |
| 943 | 945 | hdr->ops.get, hdr->ops.put, hdr->ops.info); |
| 946 | + kfree(scontrol->name); | |
| 944 | 947 | kfree(scontrol); |
| 945 | 948 | return 0; |
| 946 | 949 | } |
| 947 | 950 | |
| 948 | 951 | if (ret < 0) { |
| 952 | + kfree(scontrol->name); | |
| 949 | 953 | kfree(scontrol); |
| 950 | 954 | return ret; |
| 951 | 955 | } |
| @@ -1068,6 +1072,46 @@ static int sof_connect_dai_widget(struct snd_soc_component *scomp, · 116 unmodified lines | ||
| 1068 | 1072 | return 0; |
| 1069 | 1073 | } |
| 1070 | 1074 | |
| 1075 | +static void sof_disconnect_dai_widget(struct snd_soc_component *scomp, | |
| 1076 | + struct snd_soc_dapm_widget *w) | |
| 1077 | +{ | |
| 1078 | + struct snd_soc_card *card = scomp->card; | |
| 1079 | + struct snd_soc_pcm_runtime *rtd; | |
| 1080 | + struct snd_soc_dai *cpu_dai; | |
| 1081 | + int i; | |
| 1082 | + | |
| 1083 | + if (!w->sname) | |
| 1084 | + return; | |
| 1085 | + | |
| 1086 | + list_for_each_entry(rtd, &card->rtd_list, list) { | |
| 1087 | + /* does stream match DAI link ? */ | |
| 1088 | + if (!rtd->dai_link->stream_name || | |
| 1089 | + strcmp(w->sname, rtd->dai_link->stream_name)) | |
| 1090 | + continue; | |
| 1091 | + | |
| 1092 | + switch (w->id) { | |
| 1093 | + case snd_soc_dapm_dai_out: | |
| 1094 | + for_each_rtd_cpu_dais(rtd, i, cpu_dai) { | |
| 1095 | + if (cpu_dai->capture_widget == w) { | |
| 1096 | + cpu_dai->capture_widget = NULL; | |
| 1097 | + break; | |
| 1098 | + } | |
| 1099 | + } | |
| 1100 | + break; | |
| 1101 | + case snd_soc_dapm_dai_in: | |
| 1102 | + for_each_rtd_cpu_dais(rtd, i, cpu_dai) { | |
| 1103 | + if (cpu_dai->playback_widget == w) { | |
| 1104 | + cpu_dai->playback_widget = NULL; | |
| 1105 | + break; | |
| 1106 | + } | |
| 1107 | + } | |
| 1108 | + break; | |
| 1109 | + default: | |
| 1110 | + break; | |
| 1111 | + } | |
| 1112 | + } | |
| 1113 | +} | |
| 1114 | + | |
| 1071 | 1115 | /* bind PCM ID to host component ID */ |
| 1072 | 1116 | static int spcm_bind(struct snd_soc_component *scomp, struct snd_sof_pcm *spcm, |
| 1073 | 1117 | int dir) |
| @@ -1353,6 +1397,9 @@ static int sof_widget_unload(struct snd_soc_component *scomp, · 279 unmodified lines | ||
| 1353 | 1397 | |
| 1354 | 1398 | if (dai) |
| 1355 | 1399 | list_del(&dai->list); |
| 1400 | + | |
| 1401 | + sof_disconnect_dai_widget(scomp, widget); | |
| 1402 | + | |
| 1356 | 1403 | break; |
| 1357 | 1404 | default: |
| 1358 | 1405 | break; |
| @@ -1380,6 +1427,7 @@ static int sof_widget_unload(struct snd_soc_component *scomp, · 21 unmodified lines | ||
| 1380 | 1427 | } |
| 1381 | 1428 | kfree(scontrol->ipc_control_data); |
| 1382 | 1429 | list_del(&scontrol->list); |
| 1430 | + kfree(scontrol->name); | |
| 1383 | 1431 | kfree(scontrol); |
| 1384 | 1432 | } |
| 1385 | 1433 | |
| @@ -572,6 +572,13 @@ static int set_sample_rate_v2v3(struct snd_usb_audio *chip, · 571 unmodified lines | ||
| 572 | 572 | /* continue processing */ |
| 573 | 573 | } |
| 574 | 574 | |
| 575 | + /* FIXME - TEAC devices require the immediate interface setup */ | |
| 576 | + if (rate != prev_rate && USB_ID_VENDOR(chip->usb_id) == 0x0644) { | |
| 577 | + usb_set_interface(chip->dev, fmt->iface, fmt->altsetting); | |
| 578 | + if (chip->quirk_flags & QUIRK_FLAG_IFACE_DELAY) | |
| 579 | + msleep(50); | |
| 580 | + } | |
| 581 | + | |
| 575 | 582 | validation: |
| 576 | 583 | /* validate clock after rate change */ |
| 577 | 584 | if (!uac_clock_source_is_valid(chip, fmt, clock)) |
| @@ -1194,6 +1194,7 @@ static void snd_usbmidi_output_drain(struct snd_rawmidi_substream *substream) · 1193 unmodified lines | ||
| 1194 | 1194 | } while (drain_urbs && timeout); |
| 1195 | 1195 | finish_wait(&ep->drain_wait, &wait); |
| 1196 | 1196 | } |
| 1197 | + port->active = 0; | |
| 1197 | 1198 | spin_unlock_irq(&ep->buffer_lock); |
| 1198 | 1199 | } |
| 1199 | 1200 | |
| @@ -599,6 +599,10 @@ static const struct usbmix_ctl_map usbmix_ctl_maps[] = { · 598 unmodified lines | ||
| 599 | 599 | .id = USB_ID(0x0db0, 0x419c), |
| 600 | 600 | .map = msi_mpg_x570s_carbon_max_wifi_alc4080_map, |
| 601 | 601 | }, |
| 602 | + { /* MSI MAG X570S Torpedo Max */ | |
| 603 | + .id = USB_ID(0x0db0, 0xa073), | |
| 604 | + .map = msi_mpg_x570s_carbon_max_wifi_alc4080_map, | |
| 605 | + }, | |
| 602 | 606 | { /* MSI TRX40 */ |
| 603 | 607 | .id = USB_ID(0x0db0, 0x543d), |
| 604 | 608 | .map = trx40_mobo_map, |
| @@ -2672,6 +2672,7 @@ YAMAHA_DEVICE(0x7010, "UB99"), · 2671 unmodified lines | ||
| 2672 | 2672 | .altset_idx = 1, |
| 2673 | 2673 | .attributes = 0, |
| 2674 | 2674 | .endpoint = 0x82, |
| 2675 | + .ep_idx = 1, | |
| 2675 | 2676 | .ep_attr = USB_ENDPOINT_XFER_ISOC, |
| 2676 | 2677 | .datainterval = 1, |
| 2677 | 2678 | .maxpacksize = 0x0126, |
| @@ -2875,6 +2876,7 @@ YAMAHA_DEVICE(0x7010, "UB99"), · 197 unmodified lines | ||
| 2875 | 2876 | .altset_idx = 1, |
| 2876 | 2877 | .attributes = 0x4, |
| 2877 | 2878 | .endpoint = 0x81, |
| 2879 | + .ep_idx = 1, | |
| 2878 | 2880 | .ep_attr = USB_ENDPOINT_XFER_ISOC | |
| 2879 | 2881 | USB_ENDPOINT_SYNC_ASYNC, |
| 2880 | 2882 | .maxpacksize = 0x130, |
| @@ -3235,6 +3237,15 @@ YAMAHA_DEVICE(0x7010, "UB99"), · 354 unmodified lines | ||
| 3235 | 3237 | } |
| 3236 | 3238 | }, |
| 3237 | 3239 | |
| 3240 | +/* Rane SL-1 */ | |
| 3241 | +{ | |
| 3242 | + USB_DEVICE(0x13e5, 0x0001), | |
| 3243 | + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { | |
| 3244 | + .ifnum = QUIRK_ANY_INTERFACE, | |
| 3245 | + .type = QUIRK_AUDIO_STANDARD_INTERFACE | |
| 3246 | + } | |
| 3247 | +}, | |
| 3248 | + | |
| 3238 | 3249 | /* disabled due to regression for other devices; |
| 3239 | 3250 | * see https://bugzilla.kernel.org/show_bug.cgi?id=199905 |
| 3240 | 3251 | */ |
| @@ -3382,6 +3393,7 @@ YAMAHA_DEVICE(0x7010, "UB99"), · 141 unmodified lines | ||
| 3382 | 3393 | .altset_idx = 1, |
| 3383 | 3394 | .attributes = 0, |
| 3384 | 3395 | .endpoint = 0x03, |
| 3396 | + .ep_idx = 1, | |
| 3385 | 3397 | .rates = SNDRV_PCM_RATE_96000, |
| 3386 | 3398 | .ep_attr = USB_ENDPOINT_XFER_ISOC | |
| 3387 | 3399 | USB_ENDPOINT_SYNC_ASYNC, |
| @@ -1824,6 +1824,8 @@ static const struct usb_audio_quirk_flags_table quirk_flags_table[] = { · 1823 unmodified lines | ||
| 1824 | 1824 | QUIRK_FLAG_IGNORE_CTL_ERROR), |
| 1825 | 1825 | DEVICE_FLG(0x06f8, 0xd002, /* Hercules DJ Console (Macintosh Edition) */ |
| 1826 | 1826 | QUIRK_FLAG_IGNORE_CTL_ERROR), |
| 1827 | + DEVICE_FLG(0x0711, 0x5800, /* MCT Trigger 5 USB-to-HDMI */ | |
| 1828 | + QUIRK_FLAG_GET_SAMPLE_RATE), | |
| 1827 | 1829 | DEVICE_FLG(0x074d, 0x3553, /* Outlaw RR2150 (Micronas UAC3553B) */ |
| 1828 | 1830 | QUIRK_FLAG_GET_SAMPLE_RATE), |
| 1829 | 1831 | DEVICE_FLG(0x0763, 0x2030, /* M-Audio Fast Track C400 */ |