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/dwc', 'asoc/topic/fallthrough', 'asoc/topic/fsi', 'asoc/topic/fsl' and 'asoc/topic/graph' into asoc-next

+92 -48
+1
Documentation/devicetree/bindings/sound/audio-graph-card.txt
··· 17 17 - bitclock-master 18 18 - bitclock-inversion 19 19 - frame-inversion 20 + - mclk-fs 20 21 - dai-tdm-slot-num 21 22 - dai-tdm-slot-width 22 23 - clocks / system-clock-frequency
+1
sound/soc/codecs/msm8916-wcd-analog.c
··· 615 615 case CDC_A_TX_2_EN: 616 616 snd_soc_update_bits(codec, CDC_A_MICB_1_CTL, 617 617 MICB_1_CTL_CFILT_REF_SEL_MASK, 0); 618 + /* fall through */ 618 619 case CDC_A_TX_3_EN: 619 620 snd_soc_update_bits(codec, CDC_D_CDC_CONN_TX2_CTL, 620 621 CONN_TX2_SERIAL_TX2_MUX,
+1
sound/soc/codecs/tlv320aic23.c
··· 454 454 break; 455 455 case SND_SOC_DAIFMT_DSP_A: 456 456 iface_reg |= TLV320AIC23_LRP_ON; 457 + /* fall through */ 457 458 case SND_SOC_DAIFMT_DSP_B: 458 459 iface_reg |= TLV320AIC23_FOR_DSP; 459 460 break;
+1 -1
sound/soc/codecs/tlv320aic31xx.c
··· 929 929 case SND_SOC_DAIFMT_I2S: 930 930 break; 931 931 case SND_SOC_DAIFMT_DSP_A: 932 - dsp_a_val = 0x1; 932 + dsp_a_val = 0x1; /* fall through */ 933 933 case SND_SOC_DAIFMT_DSP_B: 934 934 /* NOTE: BCLKINV bit value 1 equas NB and 0 equals IB */ 935 935 switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
+1
sound/soc/codecs/tpa6130a2.c
··· 274 274 default: 275 275 dev_warn(dev, "Unknown TPA model (%d). Assuming 6130A2\n", 276 276 data->id); 277 + /* fall through */ 277 278 case TPA6130A2: 278 279 regulator = "Vdd"; 279 280 break;
+2 -2
sound/soc/codecs/wm8753.c
··· 971 971 case SND_SOC_DAIFMT_CBS_CFS: 972 972 break; 973 973 case SND_SOC_DAIFMT_CBM_CFM: 974 - ioctl |= 0x2; 974 + ioctl |= 0x2; /* fall through */ 975 975 case SND_SOC_DAIFMT_CBM_CFS: 976 976 voice |= 0x0040; 977 977 break; ··· 1096 1096 case SND_SOC_DAIFMT_CBS_CFS: 1097 1097 break; 1098 1098 case SND_SOC_DAIFMT_CBM_CFM: 1099 - ioctl |= 0x1; 1099 + ioctl |= 0x1; /* fall through */ 1100 1100 case SND_SOC_DAIFMT_CBM_CFS: 1101 1101 hifi |= 0x0040; 1102 1102 break;
+2
sound/soc/codecs/wm8993.c
··· 1076 1076 switch (clk_id) { 1077 1077 case WM8993_SYSCLK_MCLK: 1078 1078 wm8993->mclk_rate = freq; 1079 + /* fall through */ 1079 1080 case WM8993_SYSCLK_FLL: 1080 1081 wm8993->sysclk_source = clk_id; 1081 1082 break; ··· 1124 1123 switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { 1125 1124 case SND_SOC_DAIFMT_DSP_B: 1126 1125 aif1 |= WM8993_AIF_LRCLK_INV; 1126 + /* fall through */ 1127 1127 case SND_SOC_DAIFMT_DSP_A: 1128 1128 aif1 |= 0x18; 1129 1129 break;
+2
sound/soc/codecs/wm8994.c
··· 860 860 switch (wm8994->vmid_mode) { 861 861 default: 862 862 WARN_ON(NULL == "Invalid VMID mode"); 863 + /* fall through */ 863 864 case WM8994_VMID_NORMAL: 864 865 /* Startup bias, VMID ramp & buffer */ 865 866 snd_soc_update_bits(codec, WM8994_ANTIPOP_2, ··· 2655 2654 case SND_SOC_DAIFMT_DSP_B: 2656 2655 aif1 |= WM8994_AIF1_LRCLK_INV; 2657 2656 lrclk |= WM8958_AIF1_LRCLK_INV; 2657 + /* fall through */ 2658 2658 case SND_SOC_DAIFMT_DSP_A: 2659 2659 aif1 |= 0x18; 2660 2660 break;
+2 -2
sound/soc/dwc/Kconfig
··· 4 4 select SND_SOC_GENERIC_DMAENGINE_PCM 5 5 help 6 6 Say Y or M if you want to add support for I2S driver for 7 - Synopsys desigwnware I2S device. The device supports upto 8 - maximum of 8 channels each for play and record. 7 + Synopsys designware I2S device. The device supports up to 8 + a maximum of 8 channels each for play and record. 9 9 10 10 config SND_DESIGNWARE_PCM 11 11 bool "PCM PIO extension for I2S driver"
+9 -5
sound/soc/fsl/fsl-asoc-card.c
··· 166 166 ret = snd_soc_dai_set_sysclk(rtd->cpu_dai, cpu_priv->sysclk_id[tx], 167 167 cpu_priv->sysclk_freq[tx], 168 168 cpu_priv->sysclk_dir[tx]); 169 - if (ret) { 169 + if (ret && ret != -ENOTSUPP) { 170 170 dev_err(dev, "failed to set sysclk for cpu dai\n"); 171 171 return ret; 172 172 } ··· 174 174 if (cpu_priv->slot_width) { 175 175 ret = snd_soc_dai_set_tdm_slot(rtd->cpu_dai, 0x3, 0x3, 2, 176 176 cpu_priv->slot_width); 177 - if (ret) { 177 + if (ret && ret != -ENOTSUPP) { 178 178 dev_err(dev, "failed to set TDM slot for cpu dai\n"); 179 179 return ret; 180 180 } ··· 270 270 271 271 ret = snd_soc_dai_set_sysclk(codec_dai, codec_priv->fll_id, 272 272 pll_out, SND_SOC_CLOCK_IN); 273 - if (ret) { 273 + if (ret && ret != -ENOTSUPP) { 274 274 dev_err(dev, "failed to set SYSCLK: %d\n", ret); 275 275 return ret; 276 276 } ··· 283 283 ret = snd_soc_dai_set_sysclk(codec_dai, codec_priv->mclk_id, 284 284 codec_priv->mclk_freq, 285 285 SND_SOC_CLOCK_IN); 286 - if (ret) { 286 + if (ret && ret != -ENOTSUPP) { 287 287 dev_err(dev, "failed to switch away from FLL: %d\n", ret); 288 288 return ret; 289 289 } ··· 459 459 460 460 ret = snd_soc_dai_set_sysclk(codec_dai, codec_priv->mclk_id, 461 461 codec_priv->mclk_freq, SND_SOC_CLOCK_IN); 462 - if (ret) { 462 + if (ret && ret != -ENOTSUPP) { 463 463 dev_err(dev, "failed to set sysclk in %s\n", __func__); 464 464 return ret; 465 465 } ··· 639 639 devm_kasprintf(&pdev->dev, GFP_KERNEL, 640 640 "ac97-codec.%u", 641 641 (unsigned int)idx); 642 + if (!priv->dai_link[0].codec_name) { 643 + ret = -ENOMEM; 644 + goto asrc_fail; 645 + } 642 646 } 643 647 644 648 priv->dai_link[0].platform_of_node = cpu_np;
+2 -2
sound/soc/fsl/fsl_spdif.c
··· 1110 1110 struct clk *clk, u64 savesub, 1111 1111 enum spdif_txrate index, bool round) 1112 1112 { 1113 - const u32 rate[] = { 32000, 44100, 48000, 96000, 192000 }; 1113 + static const u32 rate[] = { 32000, 44100, 48000, 96000, 192000 }; 1114 1114 bool is_sysclk = clk_is_match(clk, spdif_priv->sysclk); 1115 1115 u64 rate_ideal, rate_actual, sub; 1116 1116 u32 sysclk_dfmin, sysclk_dfmax; ··· 1169 1169 static int fsl_spdif_probe_txclk(struct fsl_spdif_priv *spdif_priv, 1170 1170 enum spdif_txrate index) 1171 1171 { 1172 - const u32 rate[] = { 32000, 44100, 48000, 96000, 192000 }; 1172 + static const u32 rate[] = { 32000, 44100, 48000, 96000, 192000 }; 1173 1173 struct platform_device *pdev = spdif_priv->pdev; 1174 1174 struct device *dev = &pdev->dev; 1175 1175 u64 savesub = 100000, ret;
+26 -20
sound/soc/fsl/fsl_ssi.c
··· 197 197 * @use_dma: DMA is used or FIQ with stream filter 198 198 * @use_dual_fifo: DMA with support for both FIFOs used 199 199 * @fifo_deph: Depth of the SSI FIFOs 200 + * @slot_width: width of each DAI slot 201 + * @slots: number of slots 200 202 * @rxtx_reg_val: Specific register settings for receive/transmit configuration 201 203 * 202 204 * @clk: SSI clock 203 205 * @baudclk: SSI baud clock for master mode 204 206 * @baudclk_streams: Active streams that are using baudclk 205 - * @bitclk_freq: bitclock frequency set by .set_dai_sysclk 206 207 * 207 208 * @dma_params_tx: DMA transmit parameters 208 209 * @dma_params_rx: DMA receive parameters ··· 234 233 bool use_dual_fifo; 235 234 bool has_ipg_clk_name; 236 235 unsigned int fifo_depth; 236 + unsigned int slot_width; 237 + unsigned int slots; 237 238 struct fsl_ssi_rxtx_reg_val rxtx_reg_val; 238 239 239 240 struct clk *clk; 240 241 struct clk *baudclk; 241 242 unsigned int baudclk_streams; 242 - unsigned int bitclk_freq; 243 243 244 244 /* regcache for volatile regs */ 245 245 u32 regcache_sfcsr; ··· 702 700 * Note: This function can be only called when using SSI as DAI master 703 701 * 704 702 * Quick instruction for parameters: 705 - * freq: Output BCLK frequency = samplerate * 32 (fixed) * channels 706 - * dir: SND_SOC_CLOCK_OUT -> TxBCLK, SND_SOC_CLOCK_IN -> RxBCLK. 703 + * freq: Output BCLK frequency = samplerate * slots * slot_width 704 + * (In 2-channel I2S Master mode, slot_width is fixed 32) 707 705 */ 708 706 static int fsl_ssi_set_bclk(struct snd_pcm_substream *substream, 709 707 struct snd_soc_dai *cpu_dai, ··· 714 712 int synchronous = ssi_private->cpu_dai_drv.symmetric_rates, ret; 715 713 u32 pm = 999, div2, psr, stccr, mask, afreq, factor, i; 716 714 unsigned long clkrate, baudrate, tmprate; 715 + unsigned int slots = params_channels(hw_params); 716 + unsigned int slot_width = 32; 717 717 u64 sub, savesub = 100000; 718 718 unsigned int freq; 719 719 bool baudclk_is_used; 720 720 721 - /* Prefer the explicitly set bitclock frequency */ 722 - if (ssi_private->bitclk_freq) 723 - freq = ssi_private->bitclk_freq; 724 - else 725 - freq = params_channels(hw_params) * 32 * params_rate(hw_params); 721 + /* Override slots and slot_width if being specifically set... */ 722 + if (ssi_private->slots) 723 + slots = ssi_private->slots; 724 + /* ...but keep 32 bits if slots is 2 -- I2S Master mode */ 725 + if (ssi_private->slot_width && slots != 2) 726 + slot_width = ssi_private->slot_width; 727 + 728 + /* Generate bit clock based on the slot number and slot width */ 729 + freq = slots * slot_width * params_rate(hw_params); 726 730 727 731 /* Don't apply it to any non-baudclk circumstance */ 728 732 if (IS_ERR(ssi_private->baudclk)) ··· 809 801 return -EINVAL; 810 802 } 811 803 } 812 - 813 - return 0; 814 - } 815 - 816 - static int fsl_ssi_set_dai_sysclk(struct snd_soc_dai *cpu_dai, 817 - int clk_id, unsigned int freq, int dir) 818 - { 819 - struct fsl_ssi_private *ssi_private = snd_soc_dai_get_drvdata(cpu_dai); 820 - 821 - ssi_private->bitclk_freq = freq; 822 804 823 805 return 0; 824 806 } ··· 1093 1095 struct regmap *regs = ssi_private->regs; 1094 1096 u32 val; 1095 1097 1098 + /* The word length should be 8, 10, 12, 16, 18, 20, 22 or 24 */ 1099 + if (slot_width & 1 || slot_width < 8 || slot_width > 24) { 1100 + dev_err(cpu_dai->dev, "invalid slot width: %d\n", slot_width); 1101 + return -EINVAL; 1102 + } 1103 + 1096 1104 /* The slot number should be >= 2 if using Network mode or I2S mode */ 1097 1105 regmap_read(regs, CCSR_SSI_SCR, &val); 1098 1106 val &= CCSR_SSI_SCR_I2S_MODE_MASK | CCSR_SSI_SCR_NET; ··· 1124 1120 regmap_write(regs, CCSR_SSI_SRMSK, ~rx_mask); 1125 1121 1126 1122 regmap_update_bits(regs, CCSR_SSI_SCR, CCSR_SSI_SCR_SSIEN, val); 1123 + 1124 + ssi_private->slot_width = slot_width; 1125 + ssi_private->slots = slots; 1127 1126 1128 1127 return 0; 1129 1128 } ··· 1198 1191 .hw_params = fsl_ssi_hw_params, 1199 1192 .hw_free = fsl_ssi_hw_free, 1200 1193 .set_fmt = fsl_ssi_set_dai_fmt, 1201 - .set_sysclk = fsl_ssi_set_dai_sysclk, 1202 1194 .set_tdm_slot = fsl_ssi_set_dai_tdm_slot, 1203 1195 .trigger = fsl_ssi_trigger, 1204 1196 };
+39 -8
sound/soc/generic/audio-graph-card.c
··· 29 29 struct graph_dai_props { 30 30 struct asoc_simple_dai cpu_dai; 31 31 struct asoc_simple_dai codec_dai; 32 + unsigned int mclk_fs; 32 33 } *dai_props; 34 + unsigned int mclk_fs; 33 35 struct snd_soc_dai_link *dai_link; 34 36 struct gpio_desc *pa_gpio; 35 37 }; ··· 97 95 asoc_simple_card_clk_disable(&dai_props->codec_dai); 98 96 } 99 97 98 + static int asoc_graph_card_hw_params(struct snd_pcm_substream *substream, 99 + struct snd_pcm_hw_params *params) 100 + { 101 + struct snd_soc_pcm_runtime *rtd = substream->private_data; 102 + struct snd_soc_dai *codec_dai = rtd->codec_dai; 103 + struct snd_soc_dai *cpu_dai = rtd->cpu_dai; 104 + struct graph_card_data *priv = snd_soc_card_get_drvdata(rtd->card); 105 + struct graph_dai_props *dai_props = graph_priv_to_props(priv, rtd->num); 106 + unsigned int mclk, mclk_fs = 0; 107 + int ret = 0; 108 + 109 + if (priv->mclk_fs) 110 + mclk_fs = priv->mclk_fs; 111 + else if (dai_props->mclk_fs) 112 + mclk_fs = dai_props->mclk_fs; 113 + 114 + if (mclk_fs) { 115 + mclk = params_rate(params) * mclk_fs; 116 + ret = snd_soc_dai_set_sysclk(codec_dai, 0, mclk, 117 + SND_SOC_CLOCK_IN); 118 + if (ret && ret != -ENOTSUPP) 119 + goto err; 120 + 121 + ret = snd_soc_dai_set_sysclk(cpu_dai, 0, mclk, 122 + SND_SOC_CLOCK_OUT); 123 + if (ret && ret != -ENOTSUPP) 124 + goto err; 125 + } 126 + return 0; 127 + err: 128 + return ret; 129 + } 130 + 100 131 static const struct snd_soc_ops asoc_graph_card_ops = { 101 132 .startup = asoc_graph_card_startup, 102 133 .shutdown = asoc_graph_card_shutdown, 134 + .hw_params = asoc_graph_card_hw_params, 103 135 }; 104 136 105 137 static int asoc_graph_card_dai_init(struct snd_soc_pcm_runtime *rtd) ··· 182 146 if (ret < 0) 183 147 goto dai_link_of_err; 184 148 185 - /* 186 - * we need to consider "mclk-fs" around here 187 - * see simple-card 188 - */ 149 + of_property_read_u32(rcpu_ep, "mclk-fs", &dai_props->mclk_fs); 189 150 190 151 ret = asoc_simple_card_parse_graph_cpu(cpu_ep, dai_link); 191 152 if (ret < 0) ··· 250 217 if (ret < 0) 251 218 return ret; 252 219 253 - /* 254 - * we need to consider "mclk-fs" around here 255 - * see simple-card 256 - */ 220 + /* Factor to mclk, used in hw_params() */ 221 + of_property_read_u32(node, "mclk-fs", &priv->mclk_fs); 257 222 258 223 of_for_each_phandle(&it, rc, node, "dais", NULL, 0) { 259 224 ret = asoc_graph_card_dai_link_of(it.node, priv, idx++);
+3 -8
sound/soc/sh/fsi.c
··· 1932 1932 1933 1933 core = NULL; 1934 1934 if (np) { 1935 - const struct of_device_id *of_id; 1936 - 1937 - of_id = of_match_device(fsi_of_match, &pdev->dev); 1938 - if (of_id) { 1939 - core = of_id->data; 1940 - fsi_of_parse("fsia", np, &info.port_a, &pdev->dev); 1941 - fsi_of_parse("fsib", np, &info.port_b, &pdev->dev); 1942 - } 1935 + core = of_device_get_match_data(&pdev->dev); 1936 + fsi_of_parse("fsia", np, &info.port_a, &pdev->dev); 1937 + fsi_of_parse("fsib", np, &info.port_b, &pdev->dev); 1943 1938 } else { 1944 1939 const struct platform_device_id *id_entry = pdev->id_entry; 1945 1940 if (id_entry)