Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge remote-tracking branches 'asoc/topic/blackfin', 'asoc/topic/davinci', 'asoc/topic/fsl', 'asoc/topic/hdmi' and 'asoc/topic/intel' into asoc-next

+209 -319
+1 -10
sound/soc/blackfin/bf5xx-ad1836.c
··· 87 87 card->dev = &pdev->dev; 88 88 platform_set_drvdata(pdev, card); 89 89 90 - ret = snd_soc_register_card(card); 90 + ret = devm_snd_soc_register_card(&pdev->dev, card); 91 91 if (ret) 92 92 dev_err(&pdev->dev, "Failed to register card\n"); 93 93 return ret; 94 - } 95 - 96 - static int bf5xx_ad1836_driver_remove(struct platform_device *pdev) 97 - { 98 - struct snd_soc_card *card = platform_get_drvdata(pdev); 99 - 100 - snd_soc_unregister_card(card); 101 - return 0; 102 94 } 103 95 104 96 static struct platform_driver bf5xx_ad1836_driver = { ··· 99 107 .pm = &snd_soc_pm_ops, 100 108 }, 101 109 .probe = bf5xx_ad1836_driver_probe, 102 - .remove = bf5xx_ad1836_driver_remove, 103 110 }; 104 111 module_platform_driver(bf5xx_ad1836_driver); 105 112
+1 -11
sound/soc/blackfin/bfin-eval-adau1373.c
··· 154 154 155 155 card->dev = &pdev->dev; 156 156 157 - return snd_soc_register_card(&bfin_eval_adau1373); 158 - } 159 - 160 - static int bfin_eval_adau1373_remove(struct platform_device *pdev) 161 - { 162 - struct snd_soc_card *card = platform_get_drvdata(pdev); 163 - 164 - snd_soc_unregister_card(card); 165 - 166 - return 0; 157 + return devm_snd_soc_register_card(&pdev->dev, &bfin_eval_adau1373); 167 158 } 168 159 169 160 static struct platform_driver bfin_eval_adau1373_driver = { ··· 163 172 .pm = &snd_soc_pm_ops, 164 173 }, 165 174 .probe = bfin_eval_adau1373_probe, 166 - .remove = bfin_eval_adau1373_remove, 167 175 }; 168 176 169 177 module_platform_driver(bfin_eval_adau1373_driver);
+1 -11
sound/soc/blackfin/bfin-eval-adau1701.c
··· 94 94 95 95 card->dev = &pdev->dev; 96 96 97 - return snd_soc_register_card(&bfin_eval_adau1701); 98 - } 99 - 100 - static int bfin_eval_adau1701_remove(struct platform_device *pdev) 101 - { 102 - struct snd_soc_card *card = platform_get_drvdata(pdev); 103 - 104 - snd_soc_unregister_card(card); 105 - 106 - return 0; 97 + return devm_snd_soc_register_card(&pdev->dev, &bfin_eval_adau1701); 107 98 } 108 99 109 100 static struct platform_driver bfin_eval_adau1701_driver = { ··· 103 112 .pm = &snd_soc_pm_ops, 104 113 }, 105 114 .probe = bfin_eval_adau1701_probe, 106 - .remove = bfin_eval_adau1701_remove, 107 115 }; 108 116 109 117 module_platform_driver(bfin_eval_adau1701_driver);
+1 -11
sound/soc/blackfin/bfin-eval-adav80x.c
··· 119 119 120 120 card->dev = &pdev->dev; 121 121 122 - return snd_soc_register_card(&bfin_eval_adav80x); 123 - } 124 - 125 - static int bfin_eval_adav80x_remove(struct platform_device *pdev) 126 - { 127 - struct snd_soc_card *card = platform_get_drvdata(pdev); 128 - 129 - snd_soc_unregister_card(card); 130 - 131 - return 0; 122 + return devm_snd_soc_register_card(&pdev->dev, &bfin_eval_adav80x); 132 123 } 133 124 134 125 static const struct platform_device_id bfin_eval_adav80x_ids[] = { ··· 135 144 .pm = &snd_soc_pm_ops, 136 145 }, 137 146 .probe = bfin_eval_adav80x_probe, 138 - .remove = bfin_eval_adav80x_remove, 139 147 .id_table = bfin_eval_adav80x_ids, 140 148 }; 141 149
-4
sound/soc/codecs/Kconfig
··· 80 80 select SND_SOC_MAX9877 if I2C 81 81 select SND_SOC_MC13783 if MFD_MC13XXX 82 82 select SND_SOC_ML26124 if I2C 83 - select SND_SOC_HDMI_CODEC 84 83 select SND_SOC_PCM1681 if I2C 85 84 select SND_SOC_PCM1792A if SPI_MASTER 86 85 select SND_SOC_PCM3008 ··· 445 446 446 447 config SND_SOC_DMIC 447 448 tristate 448 - 449 - config SND_SOC_HDMI_CODEC 450 - tristate "HDMI stub CODEC" 451 449 452 450 config SND_SOC_ES8328 453 451 tristate "Everest Semi ES8328 CODEC"
-2
sound/soc/codecs/Makefile
··· 73 73 snd-soc-max9850-objs := max9850.o 74 74 snd-soc-mc13783-objs := mc13783.o 75 75 snd-soc-ml26124-objs := ml26124.o 76 - snd-soc-hdmi-codec-objs := hdmi.o 77 76 snd-soc-pcm1681-objs := pcm1681.o 78 77 snd-soc-pcm1792a-codec-objs := pcm1792a.o 79 78 snd-soc-pcm3008-objs := pcm3008.o ··· 265 266 obj-$(CONFIG_SND_SOC_MAX9850) += snd-soc-max9850.o 266 267 obj-$(CONFIG_SND_SOC_MC13783) += snd-soc-mc13783.o 267 268 obj-$(CONFIG_SND_SOC_ML26124) += snd-soc-ml26124.o 268 - obj-$(CONFIG_SND_SOC_HDMI_CODEC) += snd-soc-hdmi-codec.o 269 269 obj-$(CONFIG_SND_SOC_PCM1681) += snd-soc-pcm1681.o 270 270 obj-$(CONFIG_SND_SOC_PCM1792A) += snd-soc-pcm1792a-codec.o 271 271 obj-$(CONFIG_SND_SOC_PCM3008) += snd-soc-pcm3008.o
-109
sound/soc/codecs/hdmi.c
··· 1 - /* 2 - * ALSA SoC codec driver for HDMI audio codecs. 3 - * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/ 4 - * Author: Ricardo Neri <ricardo.neri@ti.com> 5 - * 6 - * This program is free software; you can redistribute it and/or 7 - * modify it under the terms of the GNU General Public License 8 - * version 2 as published by the Free Software Foundation. 9 - * 10 - * This program is distributed in the hope that it will be useful, but 11 - * WITHOUT ANY WARRANTY; without even the implied warranty of 12 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 - * General Public License for more details. 14 - * 15 - * You should have received a copy of the GNU General Public License 16 - * along with this program; if not, write to the Free Software 17 - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 18 - * 02110-1301 USA 19 - * 20 - */ 21 - #include <linux/module.h> 22 - #include <sound/soc.h> 23 - #include <linux/of.h> 24 - #include <linux/of_device.h> 25 - 26 - #define DRV_NAME "hdmi-audio-codec" 27 - 28 - static const struct snd_soc_dapm_widget hdmi_widgets[] = { 29 - SND_SOC_DAPM_INPUT("RX"), 30 - SND_SOC_DAPM_OUTPUT("TX"), 31 - }; 32 - 33 - static const struct snd_soc_dapm_route hdmi_routes[] = { 34 - { "Capture", NULL, "RX" }, 35 - { "TX", NULL, "Playback" }, 36 - }; 37 - 38 - static struct snd_soc_dai_driver hdmi_codec_dai = { 39 - .name = "hdmi-hifi", 40 - .playback = { 41 - .stream_name = "Playback", 42 - .channels_min = 2, 43 - .channels_max = 8, 44 - .rates = SNDRV_PCM_RATE_32000 | 45 - SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000 | 46 - SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000 | 47 - SNDRV_PCM_RATE_176400 | SNDRV_PCM_RATE_192000, 48 - .formats = SNDRV_PCM_FMTBIT_S16_LE | 49 - SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE, 50 - .sig_bits = 24, 51 - }, 52 - .capture = { 53 - .stream_name = "Capture", 54 - .channels_min = 2, 55 - .channels_max = 2, 56 - .rates = SNDRV_PCM_RATE_32000 | 57 - SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000 | 58 - SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000 | 59 - SNDRV_PCM_RATE_176400 | SNDRV_PCM_RATE_192000, 60 - .formats = SNDRV_PCM_FMTBIT_S16_LE | 61 - SNDRV_PCM_FMTBIT_S24_LE, 62 - }, 63 - 64 - }; 65 - 66 - #ifdef CONFIG_OF 67 - static const struct of_device_id hdmi_audio_codec_ids[] = { 68 - { .compatible = "linux,hdmi-audio", }, 69 - { } 70 - }; 71 - MODULE_DEVICE_TABLE(of, hdmi_audio_codec_ids); 72 - #endif 73 - 74 - static struct snd_soc_codec_driver hdmi_codec = { 75 - .dapm_widgets = hdmi_widgets, 76 - .num_dapm_widgets = ARRAY_SIZE(hdmi_widgets), 77 - .dapm_routes = hdmi_routes, 78 - .num_dapm_routes = ARRAY_SIZE(hdmi_routes), 79 - .ignore_pmdown_time = true, 80 - }; 81 - 82 - static int hdmi_codec_probe(struct platform_device *pdev) 83 - { 84 - return snd_soc_register_codec(&pdev->dev, &hdmi_codec, 85 - &hdmi_codec_dai, 1); 86 - } 87 - 88 - static int hdmi_codec_remove(struct platform_device *pdev) 89 - { 90 - snd_soc_unregister_codec(&pdev->dev); 91 - return 0; 92 - } 93 - 94 - static struct platform_driver hdmi_codec_driver = { 95 - .driver = { 96 - .name = DRV_NAME, 97 - .of_match_table = of_match_ptr(hdmi_audio_codec_ids), 98 - }, 99 - 100 - .probe = hdmi_codec_probe, 101 - .remove = hdmi_codec_remove, 102 - }; 103 - 104 - module_platform_driver(hdmi_codec_driver); 105 - 106 - MODULE_AUTHOR("Ricardo Neri <ricardo.neri@ti.com>"); 107 - MODULE_DESCRIPTION("ASoC generic HDMI codec driver"); 108 - MODULE_LICENSE("GPL"); 109 - MODULE_ALIAS("platform:" DRV_NAME);
+202 -103
sound/soc/davinci/davinci-mcasp.c
··· 80 80 81 81 /* McASP specific data */ 82 82 int tdm_slots; 83 + u32 tdm_mask[2]; 84 + int slot_width; 83 85 u8 op_mode; 84 86 u8 num_serializer; 85 87 u8 *serial_dir; 86 88 u8 version; 87 89 u8 bclk_div; 88 - u16 bclk_lrclk_ratio; 89 90 int streams; 90 91 u32 irq_request[2]; 91 92 int dma_request[2]; ··· 557 556 mcasp->bclk_div = div; 558 557 break; 559 558 560 - case 2: /* BCLK/LRCLK ratio */ 561 - mcasp->bclk_lrclk_ratio = div; 559 + case 2: /* 560 + * BCLK/LRCLK ratio descries how many bit-clock cycles 561 + * fit into one frame. The clock ratio is given for a 562 + * full period of data (for I2S format both left and 563 + * right channels), so it has to be divided by number 564 + * of tdm-slots (for I2S - divided by 2). 565 + * Instead of storing this ratio, we calculate a new 566 + * tdm_slot width by dividing the the ratio by the 567 + * number of configured tdm slots. 568 + */ 569 + mcasp->slot_width = div / mcasp->tdm_slots; 570 + if (div % mcasp->tdm_slots) 571 + dev_warn(mcasp->dev, 572 + "%s(): BCLK/LRCLK %d is not divisible by %d tdm slots", 573 + __func__, div, mcasp->tdm_slots); 562 574 break; 563 575 564 576 default: ··· 610 596 return 0; 611 597 } 612 598 599 + /* All serializers must have equal number of channels */ 600 + static int davinci_mcasp_ch_constraint(struct davinci_mcasp *mcasp, int stream, 601 + int serializers) 602 + { 603 + struct snd_pcm_hw_constraint_list *cl = &mcasp->chconstr[stream]; 604 + unsigned int *list = (unsigned int *) cl->list; 605 + int slots = mcasp->tdm_slots; 606 + int i, count = 0; 607 + 608 + if (mcasp->tdm_mask[stream]) 609 + slots = hweight32(mcasp->tdm_mask[stream]); 610 + 611 + for (i = 2; i <= slots; i++) 612 + list[count++] = i; 613 + 614 + for (i = 2; i <= serializers; i++) 615 + list[count++] = i*slots; 616 + 617 + cl->count = count; 618 + 619 + return 0; 620 + } 621 + 622 + static int davinci_mcasp_set_ch_constraints(struct davinci_mcasp *mcasp) 623 + { 624 + int rx_serializers = 0, tx_serializers = 0, ret, i; 625 + 626 + for (i = 0; i < mcasp->num_serializer; i++) 627 + if (mcasp->serial_dir[i] == TX_MODE) 628 + tx_serializers++; 629 + else if (mcasp->serial_dir[i] == RX_MODE) 630 + rx_serializers++; 631 + 632 + ret = davinci_mcasp_ch_constraint(mcasp, SNDRV_PCM_STREAM_PLAYBACK, 633 + tx_serializers); 634 + if (ret) 635 + return ret; 636 + 637 + ret = davinci_mcasp_ch_constraint(mcasp, SNDRV_PCM_STREAM_CAPTURE, 638 + rx_serializers); 639 + 640 + return ret; 641 + } 642 + 643 + 644 + static int davinci_mcasp_set_tdm_slot(struct snd_soc_dai *dai, 645 + unsigned int tx_mask, 646 + unsigned int rx_mask, 647 + int slots, int slot_width) 648 + { 649 + struct davinci_mcasp *mcasp = snd_soc_dai_get_drvdata(dai); 650 + 651 + dev_dbg(mcasp->dev, 652 + "%s() tx_mask 0x%08x rx_mask 0x%08x slots %d width %d\n", 653 + __func__, tx_mask, rx_mask, slots, slot_width); 654 + 655 + if (tx_mask >= (1<<slots) || rx_mask >= (1<<slots)) { 656 + dev_err(mcasp->dev, 657 + "Bad tdm mask tx: 0x%08x rx: 0x%08x slots %d\n", 658 + tx_mask, rx_mask, slots); 659 + return -EINVAL; 660 + } 661 + 662 + if (slot_width && 663 + (slot_width < 8 || slot_width > 32 || slot_width % 4 != 0)) { 664 + dev_err(mcasp->dev, "%s: Unsupported slot_width %d\n", 665 + __func__, slot_width); 666 + return -EINVAL; 667 + } 668 + 669 + mcasp->tdm_slots = slots; 670 + mcasp->tdm_mask[SNDRV_PCM_STREAM_PLAYBACK] = rx_mask; 671 + mcasp->tdm_mask[SNDRV_PCM_STREAM_CAPTURE] = tx_mask; 672 + mcasp->slot_width = slot_width; 673 + 674 + return davinci_mcasp_set_ch_constraints(mcasp); 675 + } 676 + 613 677 static int davinci_config_channel_size(struct davinci_mcasp *mcasp, 614 - int word_length) 678 + int sample_width) 615 679 { 616 680 u32 fmt; 617 - u32 tx_rotate = (word_length / 4) & 0x7; 618 - u32 mask = (1ULL << word_length) - 1; 681 + u32 tx_rotate = (sample_width / 4) & 0x7; 682 + u32 mask = (1ULL << sample_width) - 1; 683 + u32 slot_width = sample_width; 684 + 619 685 /* 620 686 * For captured data we should not rotate, inversion and masking is 621 687 * enoguh to get the data to the right position: ··· 708 614 u32 rx_rotate = 0; 709 615 710 616 /* 711 - * if s BCLK-to-LRCLK ratio has been configured via the set_clkdiv() 712 - * callback, take it into account here. That allows us to for example 713 - * send 32 bits per channel to the codec, while only 16 of them carry 714 - * audio payload. 715 - * The clock ratio is given for a full period of data (for I2S format 716 - * both left and right channels), so it has to be divided by number of 717 - * tdm-slots (for I2S - divided by 2). 617 + * Setting the tdm slot width either with set_clkdiv() or 618 + * set_tdm_slot() allows us to for example send 32 bits per 619 + * channel to the codec, while only 16 of them carry audio 620 + * payload. 718 621 */ 719 - if (mcasp->bclk_lrclk_ratio) { 720 - u32 slot_length = mcasp->bclk_lrclk_ratio / mcasp->tdm_slots; 721 - 622 + if (mcasp->slot_width) { 722 623 /* 723 - * When we have more bclk then it is needed for the data, we 724 - * need to use the rotation to move the received samples to have 725 - * correct alignment. 624 + * When we have more bclk then it is needed for the 625 + * data, we need to use the rotation to move the 626 + * received samples to have correct alignment. 726 627 */ 727 - rx_rotate = (slot_length - word_length) / 4; 728 - word_length = slot_length; 628 + slot_width = mcasp->slot_width; 629 + rx_rotate = (slot_width - sample_width) / 4; 729 630 } 730 631 731 632 /* mapping of the XSSZ bit-field as described in the datasheet */ 732 - fmt = (word_length >> 1) - 1; 633 + fmt = (slot_width >> 1) - 1; 733 634 734 635 if (mcasp->op_mode != DAVINCI_MCASP_DIT_MODE) { 735 636 mcasp_mod_bits(mcasp, DAVINCI_MCASP_RXFMT_REG, RXSSZ(fmt), ··· 865 776 866 777 /* 867 778 * If more than one serializer is needed, then use them with 868 - * their specified tdm_slots count. Otherwise, one serializer 869 - * can cope with the transaction using as many slots as channels 870 - * in the stream, requires channels symmetry 779 + * all the specified tdm_slots. Otherwise, one serializer can 780 + * cope with the transaction using just as many slots as there 781 + * are channels in the stream. 871 782 */ 872 - active_serializers = (channels + total_slots - 1) / total_slots; 873 - if (active_serializers == 1) 874 - active_slots = channels; 875 - else 876 - active_slots = total_slots; 783 + if (mcasp->tdm_mask[stream]) { 784 + active_slots = hweight32(mcasp->tdm_mask[stream]); 785 + active_serializers = (channels + active_slots - 1) / 786 + active_slots; 787 + if (active_serializers == 1) { 788 + active_slots = channels; 789 + for (i = 0; i < total_slots; i++) { 790 + if ((1 << i) & mcasp->tdm_mask[stream]) { 791 + mask |= (1 << i); 792 + if (--active_slots <= 0) 793 + break; 794 + } 795 + } 796 + } 797 + } else { 798 + active_serializers = (channels + total_slots - 1) / total_slots; 799 + if (active_serializers == 1) 800 + active_slots = channels; 801 + else 802 + active_slots = total_slots; 877 803 878 - for (i = 0; i < active_slots; i++) 879 - mask |= (1 << i); 880 - 804 + for (i = 0; i < active_slots; i++) 805 + mask |= (1 << i); 806 + } 881 807 mcasp_clr_bits(mcasp, DAVINCI_MCASP_ACLKXCTL_REG, TX_ASYNC); 882 808 883 809 if (!mcasp->dat_port) 884 810 busel = TXSEL; 885 811 886 - mcasp_set_reg(mcasp, DAVINCI_MCASP_TXTDM_REG, mask); 887 - mcasp_set_bits(mcasp, DAVINCI_MCASP_TXFMT_REG, busel | TXORD); 888 - mcasp_mod_bits(mcasp, DAVINCI_MCASP_TXFMCTL_REG, 889 - FSXMOD(total_slots), FSXMOD(0x1FF)); 890 - 891 - mcasp_set_reg(mcasp, DAVINCI_MCASP_RXTDM_REG, mask); 892 - mcasp_set_bits(mcasp, DAVINCI_MCASP_RXFMT_REG, busel | RXORD); 893 - mcasp_mod_bits(mcasp, DAVINCI_MCASP_RXFMCTL_REG, 894 - FSRMOD(total_slots), FSRMOD(0x1FF)); 812 + if (stream == SNDRV_PCM_STREAM_PLAYBACK) { 813 + mcasp_set_reg(mcasp, DAVINCI_MCASP_TXTDM_REG, mask); 814 + mcasp_set_bits(mcasp, DAVINCI_MCASP_TXFMT_REG, busel | TXORD); 815 + mcasp_mod_bits(mcasp, DAVINCI_MCASP_TXFMCTL_REG, 816 + FSXMOD(total_slots), FSXMOD(0x1FF)); 817 + } else if (stream == SNDRV_PCM_STREAM_CAPTURE) { 818 + mcasp_set_reg(mcasp, DAVINCI_MCASP_RXTDM_REG, mask); 819 + mcasp_set_bits(mcasp, DAVINCI_MCASP_RXFMT_REG, busel | RXORD); 820 + mcasp_mod_bits(mcasp, DAVINCI_MCASP_RXFMCTL_REG, 821 + FSRMOD(total_slots), FSRMOD(0x1FF)); 822 + } 895 823 896 824 return 0; 897 825 } ··· 1028 922 int sbits = params_width(params); 1029 923 int ppm, div; 1030 924 925 + if (mcasp->slot_width) 926 + sbits = mcasp->slot_width; 927 + 1031 928 div = davinci_mcasp_calc_clk_div(mcasp, rate*sbits*slots, 1032 929 &ppm); 1033 930 if (ppm) ··· 1136 1027 struct snd_interval range; 1137 1028 int i; 1138 1029 1030 + if (rd->mcasp->slot_width) 1031 + sbits = rd->mcasp->slot_width; 1032 + 1139 1033 snd_interval_any(&range); 1140 1034 range.empty = 1; 1141 1035 ··· 1181 1069 1182 1070 for (i = 0; i < SNDRV_PCM_FORMAT_LAST; i++) { 1183 1071 if (snd_mask_test(fmt, i)) { 1184 - uint bclk_freq = snd_pcm_format_width(i)*slots*rate; 1072 + uint sbits = snd_pcm_format_width(i); 1185 1073 int ppm; 1186 1074 1187 - davinci_mcasp_calc_clk_div(rd->mcasp, bclk_freq, &ppm); 1075 + if (rd->mcasp->slot_width) 1076 + sbits = rd->mcasp->slot_width; 1077 + 1078 + davinci_mcasp_calc_clk_div(rd->mcasp, sbits*slots*rate, 1079 + &ppm); 1188 1080 if (abs(ppm) < DAVINCI_MAX_RATE_ERROR_PPM) { 1189 1081 snd_mask_set(&nfmt, i); 1190 1082 count++; ··· 1210 1094 &mcasp->ruledata[substream->stream]; 1211 1095 u32 max_channels = 0; 1212 1096 int i, dir; 1097 + int tdm_slots = mcasp->tdm_slots; 1098 + 1099 + if (mcasp->tdm_mask[substream->stream]) 1100 + tdm_slots = hweight32(mcasp->tdm_mask[substream->stream]); 1213 1101 1214 1102 mcasp->substreams[substream->stream] = substream; 1215 1103 ··· 1234 1114 max_channels++; 1235 1115 } 1236 1116 ruledata->serializers = max_channels; 1237 - max_channels *= mcasp->tdm_slots; 1117 + max_channels *= tdm_slots; 1238 1118 /* 1239 1119 * If the already active stream has less channels than the calculated 1240 1120 * limnit based on the seirializers * tdm_slots, we need to use that as ··· 1244 1124 */ 1245 1125 if (mcasp->channels && mcasp->channels < max_channels) 1246 1126 max_channels = mcasp->channels; 1127 + /* 1128 + * But we can always allow channels upto the amount of 1129 + * the available tdm_slots. 1130 + */ 1131 + if (max_channels < tdm_slots) 1132 + max_channels = tdm_slots; 1247 1133 1248 1134 snd_pcm_hw_constraint_minmax(substream->runtime, 1249 1135 SNDRV_PCM_HW_PARAM_CHANNELS, 1250 1136 2, max_channels); 1251 1137 1252 - if (mcasp->chconstr[substream->stream].count) 1253 - snd_pcm_hw_constraint_list(substream->runtime, 1254 - 0, SNDRV_PCM_HW_PARAM_CHANNELS, 1255 - &mcasp->chconstr[substream->stream]); 1138 + snd_pcm_hw_constraint_list(substream->runtime, 1139 + 0, SNDRV_PCM_HW_PARAM_CHANNELS, 1140 + &mcasp->chconstr[substream->stream]); 1141 + 1142 + if (mcasp->slot_width) 1143 + snd_pcm_hw_constraint_minmax(substream->runtime, 1144 + SNDRV_PCM_HW_PARAM_SAMPLE_BITS, 1145 + 8, mcasp->slot_width); 1256 1146 1257 1147 /* 1258 1148 * If we rely on implicit BCLK divider setting we should ··· 1314 1184 .set_fmt = davinci_mcasp_set_dai_fmt, 1315 1185 .set_clkdiv = davinci_mcasp_set_clkdiv, 1316 1186 .set_sysclk = davinci_mcasp_set_sysclk, 1187 + .set_tdm_slot = davinci_mcasp_set_tdm_slot, 1317 1188 }; 1318 1189 1319 1190 static int davinci_mcasp_dai_probe(struct snd_soc_dai *dai) ··· 1645 1514 return pdata; 1646 1515 } 1647 1516 1648 - /* All serializers must have equal number of channels */ 1649 - static int davinci_mcasp_ch_constraint(struct davinci_mcasp *mcasp, 1650 - struct snd_pcm_hw_constraint_list *cl, 1651 - int serializers) 1652 - { 1653 - unsigned int *list; 1654 - int i, count = 0; 1655 - 1656 - if (serializers <= 1) 1657 - return 0; 1658 - 1659 - list = devm_kzalloc(mcasp->dev, sizeof(unsigned int) * 1660 - (mcasp->tdm_slots + serializers - 2), 1661 - GFP_KERNEL); 1662 - if (!list) 1663 - return -ENOMEM; 1664 - 1665 - for (i = 2; i <= mcasp->tdm_slots; i++) 1666 - list[count++] = i; 1667 - 1668 - for (i = 2; i <= serializers; i++) 1669 - list[count++] = i*mcasp->tdm_slots; 1670 - 1671 - cl->count = count; 1672 - cl->list = list; 1673 - 1674 - return 0; 1675 - } 1676 - 1677 - 1678 - static int davinci_mcasp_init_ch_constraints(struct davinci_mcasp *mcasp) 1679 - { 1680 - int rx_serializers = 0, tx_serializers = 0, ret, i; 1681 - 1682 - for (i = 0; i < mcasp->num_serializer; i++) 1683 - if (mcasp->serial_dir[i] == TX_MODE) 1684 - tx_serializers++; 1685 - else if (mcasp->serial_dir[i] == RX_MODE) 1686 - rx_serializers++; 1687 - 1688 - ret = davinci_mcasp_ch_constraint(mcasp, &mcasp->chconstr[ 1689 - SNDRV_PCM_STREAM_PLAYBACK], 1690 - tx_serializers); 1691 - if (ret) 1692 - return ret; 1693 - 1694 - ret = davinci_mcasp_ch_constraint(mcasp, &mcasp->chconstr[ 1695 - SNDRV_PCM_STREAM_CAPTURE], 1696 - rx_serializers); 1697 - 1698 - return ret; 1699 - } 1700 - 1701 1517 enum { 1702 1518 PCM_EDMA, 1703 1519 PCM_SDMA, ··· 1861 1783 mcasp->fifo_base = DAVINCI_MCASP_V3_AFIFO_BASE; 1862 1784 } 1863 1785 1864 - ret = davinci_mcasp_init_ch_constraints(mcasp); 1786 + /* Allocate memory for long enough list for all possible 1787 + * scenarios. Maximum number tdm slots is 32 and there cannot 1788 + * be more serializers than given in the configuration. The 1789 + * serializer directions could be taken into account, but it 1790 + * would make code much more complex and save only couple of 1791 + * bytes. 1792 + */ 1793 + mcasp->chconstr[SNDRV_PCM_STREAM_PLAYBACK].list = 1794 + devm_kzalloc(mcasp->dev, sizeof(unsigned int) * 1795 + (32 + mcasp->num_serializer - 2), 1796 + GFP_KERNEL); 1797 + 1798 + mcasp->chconstr[SNDRV_PCM_STREAM_CAPTURE].list = 1799 + devm_kzalloc(mcasp->dev, sizeof(unsigned int) * 1800 + (32 + mcasp->num_serializer - 2), 1801 + GFP_KERNEL); 1802 + 1803 + if (!mcasp->chconstr[SNDRV_PCM_STREAM_PLAYBACK].list || 1804 + !mcasp->chconstr[SNDRV_PCM_STREAM_CAPTURE].list) 1805 + return -ENOMEM; 1806 + 1807 + ret = davinci_mcasp_set_ch_constraints(mcasp); 1865 1808 if (ret) 1866 1809 goto err; 1867 1810
+1
sound/soc/fsl/fsl-asoc-card.c
··· 593 593 { .compatible = "fsl,imx-audio-wm8960", }, 594 594 {} 595 595 }; 596 + MODULE_DEVICE_TABLE(of, fsl_asoc_card_dt_ids); 596 597 597 598 static struct platform_driver fsl_asoc_card_driver = { 598 599 .probe = fsl_asoc_card_probe,
+1
sound/soc/fsl/fsl_sai.c
··· 801 801 { .compatible = "fsl,imx6sx-sai", }, 802 802 { /* sentinel */ } 803 803 }; 804 + MODULE_DEVICE_TABLE(of, fsl_sai_ids); 804 805 805 806 static struct platform_driver fsl_sai_driver = { 806 807 .probe = fsl_sai_probe,
-17
sound/soc/intel/atom/sst-mfld-platform-pcm.c
··· 368 368 kfree(stream); 369 369 } 370 370 371 - static inline unsigned int get_current_pipe_id(struct snd_soc_dai *dai, 372 - struct snd_pcm_substream *substream) 373 - { 374 - struct sst_data *sst = snd_soc_dai_get_drvdata(dai); 375 - struct sst_dev_stream_map *map = sst->pdata->pdev_strm_map; 376 - struct sst_runtime_stream *stream = 377 - substream->runtime->private_data; 378 - u32 str_id = stream->stream_info.str_id; 379 - unsigned int pipe_id; 380 - 381 - pipe_id = map[str_id].device_id; 382 - 383 - dev_dbg(dai->dev, "got pipe_id = %#x for str_id = %d\n", 384 - pipe_id, str_id); 385 - return pipe_id; 386 - } 387 - 388 371 static int sst_media_prepare(struct snd_pcm_substream *substream, 389 372 struct snd_soc_dai *dai) 390 373 {
+1 -8
sound/soc/intel/boards/broadwell.c
··· 266 266 { 267 267 broadwell_rt286.dev = &pdev->dev; 268 268 269 - return snd_soc_register_card(&broadwell_rt286); 270 - } 271 - 272 - static int broadwell_audio_remove(struct platform_device *pdev) 273 - { 274 - snd_soc_unregister_card(&broadwell_rt286); 275 - return 0; 269 + return devm_snd_soc_register_card(&pdev->dev, &broadwell_rt286); 276 270 } 277 271 278 272 static struct platform_driver broadwell_audio = { 279 273 .probe = broadwell_audio_probe, 280 - .remove = broadwell_audio_remove, 281 274 .driver = { 282 275 .name = "broadwell-audio", 283 276 },
-33
sound/soc/intel/skylake/skl-pcm.c
··· 510 510 }, 511 511 }, 512 512 { 513 - .name = "DMIC23 Pin", 514 - .ops = &skl_dmic_dai_ops, 515 - .capture = { 516 - .stream_name = "DMIC23 Rx", 517 - .channels_min = HDA_STEREO, 518 - .channels_max = HDA_STEREO, 519 - .rates = SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_16000, 520 - .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE, 521 - }, 522 - }, 523 - { 524 513 .name = "HD-Codec Pin", 525 514 .ops = &skl_link_dai_ops, 526 515 .playback = { ··· 521 532 }, 522 533 .capture = { 523 534 .stream_name = "HD-Codec Rx", 524 - .channels_min = HDA_STEREO, 525 - .channels_max = HDA_STEREO, 526 - .rates = SNDRV_PCM_RATE_48000, 527 - .formats = SNDRV_PCM_FMTBIT_S16_LE, 528 - }, 529 - }, 530 - { 531 - .name = "HD-Codec-SPK Pin", 532 - .ops = &skl_link_dai_ops, 533 - .playback = { 534 - .stream_name = "HD-Codec-SPK Tx", 535 - .channels_min = HDA_STEREO, 536 - .channels_max = HDA_STEREO, 537 - .rates = SNDRV_PCM_RATE_48000, 538 - .formats = SNDRV_PCM_FMTBIT_S16_LE, 539 - }, 540 - }, 541 - { 542 - .name = "HD-Codec-AMIC Pin", 543 - .ops = &skl_link_dai_ops, 544 - .capture = { 545 - .stream_name = "HD-Codec-AMIC Rx", 546 535 .channels_min = HDA_STEREO, 547 536 .channels_max = HDA_STEREO, 548 537 .rates = SNDRV_PCM_RATE_48000,