.. | .. |
---|
42 | 42 | struct axg_tdm_stream *rx = (struct axg_tdm_stream *) |
---|
43 | 43 | dai->capture_dma_data; |
---|
44 | 44 | unsigned int tx_slots, rx_slots; |
---|
| 45 | + unsigned int fmt = 0; |
---|
45 | 46 | |
---|
46 | 47 | tx_slots = axg_tdm_slots_total(tx_mask); |
---|
47 | 48 | rx_slots = axg_tdm_slots_total(rx_mask); |
---|
.. | .. |
---|
52 | 53 | return -EINVAL; |
---|
53 | 54 | } |
---|
54 | 55 | |
---|
55 | | - /* |
---|
56 | | - * Amend the dai driver channel number and let dpcm channel merge do |
---|
57 | | - * its job |
---|
58 | | - */ |
---|
| 56 | + iface->slots = slots; |
---|
| 57 | + |
---|
| 58 | + switch (slot_width) { |
---|
| 59 | + case 0: |
---|
| 60 | + slot_width = 32; |
---|
| 61 | + fallthrough; |
---|
| 62 | + case 32: |
---|
| 63 | + fmt |= SNDRV_PCM_FMTBIT_S32_LE; |
---|
| 64 | + fallthrough; |
---|
| 65 | + case 24: |
---|
| 66 | + fmt |= SNDRV_PCM_FMTBIT_S24_LE; |
---|
| 67 | + fmt |= SNDRV_PCM_FMTBIT_S20_LE; |
---|
| 68 | + fallthrough; |
---|
| 69 | + case 16: |
---|
| 70 | + fmt |= SNDRV_PCM_FMTBIT_S16_LE; |
---|
| 71 | + fallthrough; |
---|
| 72 | + case 8: |
---|
| 73 | + fmt |= SNDRV_PCM_FMTBIT_S8; |
---|
| 74 | + break; |
---|
| 75 | + default: |
---|
| 76 | + dev_err(dai->dev, "unsupported slot width: %d\n", slot_width); |
---|
| 77 | + return -EINVAL; |
---|
| 78 | + } |
---|
| 79 | + |
---|
| 80 | + iface->slot_width = slot_width; |
---|
| 81 | + |
---|
| 82 | + /* Amend the dai driver and let dpcm merge do its job */ |
---|
59 | 83 | if (tx) { |
---|
60 | 84 | tx->mask = tx_mask; |
---|
61 | 85 | dai->driver->playback.channels_max = tx_slots; |
---|
| 86 | + dai->driver->playback.formats = fmt; |
---|
62 | 87 | } |
---|
63 | 88 | |
---|
64 | 89 | if (rx) { |
---|
65 | 90 | rx->mask = rx_mask; |
---|
66 | 91 | dai->driver->capture.channels_max = rx_slots; |
---|
67 | | - } |
---|
68 | | - |
---|
69 | | - iface->slots = slots; |
---|
70 | | - |
---|
71 | | - switch (slot_width) { |
---|
72 | | - case 0: |
---|
73 | | - /* defaults width to 32 if not provided */ |
---|
74 | | - iface->slot_width = 32; |
---|
75 | | - break; |
---|
76 | | - case 8: |
---|
77 | | - case 16: |
---|
78 | | - case 24: |
---|
79 | | - case 32: |
---|
80 | | - iface->slot_width = slot_width; |
---|
81 | | - break; |
---|
82 | | - default: |
---|
83 | | - dev_err(dai->dev, "unsupported slot width: %d\n", slot_width); |
---|
84 | | - return -EINVAL; |
---|
| 92 | + dai->driver->capture.formats = fmt; |
---|
85 | 93 | } |
---|
86 | 94 | |
---|
87 | 95 | return 0; |
---|
.. | .. |
---|
125 | 133 | case SND_SOC_DAIFMT_CBS_CFM: |
---|
126 | 134 | case SND_SOC_DAIFMT_CBM_CFS: |
---|
127 | 135 | dev_err(dai->dev, "only CBS_CFS and CBM_CFM are supported\n"); |
---|
128 | | - /* Fall-through */ |
---|
| 136 | + fallthrough; |
---|
129 | 137 | default: |
---|
130 | 138 | return -EINVAL; |
---|
131 | 139 | } |
---|
.. | .. |
---|
148 | 156 | } |
---|
149 | 157 | |
---|
150 | 158 | /* Apply component wide rate symmetry */ |
---|
151 | | - if (dai->component->active) { |
---|
| 159 | + if (snd_soc_component_active(dai->component)) { |
---|
152 | 160 | ret = snd_pcm_hw_constraint_single(substream->runtime, |
---|
153 | 161 | SNDRV_PCM_HW_PARAM_RATE, |
---|
154 | 162 | iface->rate); |
---|
.. | .. |
---|
305 | 313 | } |
---|
306 | 314 | break; |
---|
307 | 315 | |
---|
308 | | - case SND_SOC_DAI_FORMAT_DSP_A: |
---|
309 | | - case SND_SOC_DAI_FORMAT_DSP_B: |
---|
| 316 | + case SND_SOC_DAIFMT_DSP_A: |
---|
| 317 | + case SND_SOC_DAIFMT_DSP_B: |
---|
310 | 318 | break; |
---|
311 | 319 | |
---|
312 | 320 | default: |
---|