hc
2023-12-08 01573e231f18eb2d99162747186f59511f56b64d
kernel/sound/soc/meson/axg-tdm-interface.c
....@@ -42,6 +42,7 @@
4242 struct axg_tdm_stream *rx = (struct axg_tdm_stream *)
4343 dai->capture_dma_data;
4444 unsigned int tx_slots, rx_slots;
45
+ unsigned int fmt = 0;
4546
4647 tx_slots = axg_tdm_slots_total(tx_mask);
4748 rx_slots = axg_tdm_slots_total(rx_mask);
....@@ -52,36 +53,43 @@
5253 return -EINVAL;
5354 }
5455
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 */
5983 if (tx) {
6084 tx->mask = tx_mask;
6185 dai->driver->playback.channels_max = tx_slots;
86
+ dai->driver->playback.formats = fmt;
6287 }
6388
6489 if (rx) {
6590 rx->mask = rx_mask;
6691 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;
8593 }
8694
8795 return 0;
....@@ -125,7 +133,7 @@
125133 case SND_SOC_DAIFMT_CBS_CFM:
126134 case SND_SOC_DAIFMT_CBM_CFS:
127135 dev_err(dai->dev, "only CBS_CFS and CBM_CFM are supported\n");
128
- /* Fall-through */
136
+ fallthrough;
129137 default:
130138 return -EINVAL;
131139 }
....@@ -148,7 +156,7 @@
148156 }
149157
150158 /* Apply component wide rate symmetry */
151
- if (dai->component->active) {
159
+ if (snd_soc_component_active(dai->component)) {
152160 ret = snd_pcm_hw_constraint_single(substream->runtime,
153161 SNDRV_PCM_HW_PARAM_RATE,
154162 iface->rate);
....@@ -305,8 +313,8 @@
305313 }
306314 break;
307315
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:
310318 break;
311319
312320 default: