Lines Matching refs:i
80 #define IF_USB_AUDIO_PROP_HP(i, prop, bitmask) \ argument
81 COND_CODE_1(DT_PROP(DT_INST(i, COMPAT_HP), prop), (bitmask), (0))
82 #define IF_USB_AUDIO_PROP_MIC(i, prop, bitmask) \ argument
83 COND_CODE_1(DT_PROP(DT_INST(i, COMPAT_MIC), prop), (bitmask), (0))
84 #define IF_USB_AUDIO_PROP_HS_HP(i, prop, bitmask) \ argument
85 COND_CODE_1(DT_PROP(DT_INST(i, COMPAT_HS), hp_##prop), (bitmask), (0))
86 #define IF_USB_AUDIO_PROP_HS_MIC(i, prop, bitmask) \ argument
87 COND_CODE_1(DT_PROP(DT_INST(i, COMPAT_HS), mic_##prop), (bitmask), (0))
88 #define IF_USB_AUDIO_PROP(dev, i, prop, bitmask) \ argument
89 IF_USB_AUDIO_PROP_##dev(i, prop, bitmask)
92 #define CH_CFG(dev, i) (0x0000 \ argument
93 | IF_USB_AUDIO_PROP(dev, i, channel_l, BIT(0)) \
94 | IF_USB_AUDIO_PROP(dev, i, channel_r, BIT(1)) \
95 | IF_USB_AUDIO_PROP(dev, i, channel_c, BIT(2)) \
96 | IF_USB_AUDIO_PROP(dev, i, channel_lfe, BIT(3)) \
97 | IF_USB_AUDIO_PROP(dev, i, channel_ls, BIT(4)) \
98 | IF_USB_AUDIO_PROP(dev, i, channel_rs, BIT(5)) \
99 | IF_USB_AUDIO_PROP(dev, i, channel_lc, BIT(6)) \
100 | IF_USB_AUDIO_PROP(dev, i, channel_rc, BIT(7)) \
101 | IF_USB_AUDIO_PROP(dev, i, channel_s, BIT(8)) \
102 | IF_USB_AUDIO_PROP(dev, i, channel_sl, BIT(9)) \
103 | IF_USB_AUDIO_PROP(dev, i, channel_sr, BIT(10))\
104 | IF_USB_AUDIO_PROP(dev, i, channel_t, BIT(11))\
110 #define CH_CNT(dev, i) (0 \ argument
111 + IF_USB_AUDIO_PROP(dev, i, channel_l, 1)\
112 + IF_USB_AUDIO_PROP(dev, i, channel_r, 1)\
113 + IF_USB_AUDIO_PROP(dev, i, channel_c, 1)\
114 + IF_USB_AUDIO_PROP(dev, i, channel_lfe, 1)\
115 + IF_USB_AUDIO_PROP(dev, i, channel_ls, 1)\
116 + IF_USB_AUDIO_PROP(dev, i, channel_rs, 1)\
117 + IF_USB_AUDIO_PROP(dev, i, channel_lc, 1)\
118 + IF_USB_AUDIO_PROP(dev, i, channel_rc, 1)\
119 + IF_USB_AUDIO_PROP(dev, i, channel_s, 1)\
120 + IF_USB_AUDIO_PROP(dev, i, channel_sl, 1)\
121 + IF_USB_AUDIO_PROP(dev, i, channel_sr, 1)\
122 + IF_USB_AUDIO_PROP(dev, i, channel_t, 1)\
126 #define FEATURES(dev, i) (0x0000 \ argument
127 | IF_USB_AUDIO_PROP(dev, i, feature_mute, BIT(0)) \
128 | IF_USB_AUDIO_PROP(dev, i, feature_volume, BIT(1)) \
129 | IF_USB_AUDIO_PROP(dev, i, feature_tone_control, BIT(2) | BIT(3) | BIT(4))\
130 | IF_USB_AUDIO_PROP(dev, i, feature_graphic_equalizer, BIT(5)) \
131 | IF_USB_AUDIO_PROP(dev, i, feature_automatic_gain_control, BIT(6)) \
132 | IF_USB_AUDIO_PROP(dev, i, feature_delay, BIT(7)) \
133 | IF_USB_AUDIO_PROP(dev, i, feature_bass_boost, BIT(8)) \
134 | IF_USB_AUDIO_PROP(dev, i, feature_loudness, BIT(9)) \
138 #define FEATURES_SIZE(dev, i) ((CH_CNT(dev, i) + 1) * (0x0000 \ argument
139 + IF_USB_AUDIO_PROP(dev, i, feature_mute, \
141 + IF_USB_AUDIO_PROP(dev, i, feature_volume, \
143 + IF_USB_AUDIO_PROP(dev, i, feature_tone_control, \
145 + IF_USB_AUDIO_PROP(dev, i, feature_graphic_equalizer, \
147 + IF_USB_AUDIO_PROP(dev, i, feature_automatic_gain_control, \
149 + IF_USB_AUDIO_PROP(dev, i, feature_delay, \
151 + IF_USB_AUDIO_PROP(dev, i, feature_bass_boost, \
153 + IF_USB_AUDIO_PROP(dev, i, feature_loudness, \
157 #define GET_RES_HP(i) DT_PROP(DT_INST(i, COMPAT_HP), resolution) argument
158 #define GET_RES_MIC(i) DT_PROP(DT_INST(i, COMPAT_MIC), resolution) argument
159 #define GET_RES_HS_HP(i) DT_PROP(DT_INST(i, COMPAT_HS), hp_resolution) argument
160 #define GET_RES_HS_MIC(i) DT_PROP(DT_INST(i, COMPAT_HS), mic_resolution) argument
161 #define GET_RES(dev, i) GET_RES_##dev(i) argument
163 #define GET_VOLUME_HS(i, prop) DT_PROP_OR(DT_INST(i, COMPAT_HS), prop, 0) argument
164 #define GET_VOLUME_HP(i, prop) DT_PROP_OR(DT_INST(i, COMPAT_HP), prop, 0) argument
165 #define GET_VOLUME_MIC(i, prop) DT_PROP_OR(DT_INST(i, COMPAT_MIC), prop, 0) argument
166 #define GET_VOLUME(dev, i, prop) GET_VOLUME_##dev(i, prop) argument
168 #define GET_RATE_HP(i) DT_PROP(DT_INST(i, COMPAT_HP), sample_rate_hz) argument
169 #define GET_RATE_MIC(i) DT_PROP(DT_INST(i, COMPAT_MIC), sample_rate_hz) argument
170 #define GET_RATE_HS_HP(i) DT_PROP(DT_INST(i, COMPAT_HS), hp_sample_rate_hz) argument
171 #define GET_RATE_HS_MIC(i) DT_PROP(DT_INST(i, COMPAT_HS), mic_sample_rate_hz) argument
172 #define GET_RATE(dev, i) GET_RATE_##dev(i) argument
174 #define GET_INTERVAL_HP(i) DT_PROP(DT_INST(i, COMPAT_HP), polling_interval) argument
175 #define GET_INTERVAL_MIC(i) DT_PROP(DT_INST(i, COMPAT_MIC), polling_interval) argument
176 #define GET_INTERVAL_HS_HP(i) DT_PROP(DT_INST(i, COMPAT_HS), hp_polling_interval) argument
177 #define GET_INTERVAL_HS_MIC(i) DT_PROP(DT_INST(i, COMPAT_HS), mic_polling_interval) argument
178 #define GET_INTERVAL(dev, i) GET_INTERVAL_##dev(i) argument
180 #define SYNC_TYPE_HP(i) 3 argument
181 #define SYNC_TYPE_MIC(i) DT_ENUM_IDX(DT_INST(i, COMPAT_MIC), sync_type) argument
182 #define SYNC_TYPE_HS_HP(i) 3 argument
183 #define SYNC_TYPE_HS_MIC(i) DT_ENUM_IDX(DT_INST(i, COMPAT_HS), mic_sync_type) argument
184 #define SYNC_TYPE(dev, i) (SYNC_TYPE_##dev(i) << 2) argument
186 #define EP_SIZE(dev, i) \ argument
187 (DIV_ROUND_UP((GET_RES(dev, i)/8 * CH_CNT(dev, i) * GET_RATE(dev, i)), 1000))
194 #define HP_ID(i) ((3*i) + 1) argument
195 #define MIC_ID(i) ((3*(HEADPHONES_DEVICE_COUNT + i)) + 1) argument
196 #define HS_ID(i) ((3*(HEADPHONES_DEVICE_COUNT + \ argument
197 MICROPHONE_DEVICE_COUNT)) + 6*i + 1)
205 #define HP_LINK(i) ((3*i) + 1) argument
206 #define MIC_LINK(i) ((3*(HEADPHONES_DEVICE_COUNT + i)) + 3) argument
313 #define DECLARE_HEADER(dev, i, ifaces) \ argument
314 struct dev##_cs_ac_if_descriptor_##i { \
324 #define DECLARE_FEATURE_UNIT(dev, i) \ argument
325 struct dev##_feature_unit_descriptor_##i { \
332 uint16_t bmaControls[CH_CNT(dev, i) + 1]; \
351 #define DECLARE_DESCRIPTOR(dev, i, ifaces) \ argument
352 DECLARE_HEADER(dev, i, ifaces); \
353 DECLARE_FEATURE_UNIT(dev, i); \
354 struct dev##_descriptor_##i { \
357 struct dev##_cs_ac_if_descriptor_##i cs_ac_interface; \
359 struct dev##_feature_unit_descriptor_##i feature_unit; \
369 #define DECLARE_DESCRIPTOR_BIDIR(dev, i, ifaces) \ argument
370 DECLARE_HEADER(dev, i, ifaces); \
371 DECLARE_FEATURE_UNIT(dev##_MIC, i); \
372 DECLARE_FEATURE_UNIT(dev##_HP, i); \
373 struct dev##_descriptor_##i { \
376 struct dev##_cs_ac_if_descriptor_##i cs_ac_interface; \
378 struct dev##_MIC_feature_unit_descriptor_##i feature_unit_0; \
381 struct dev##_HP_feature_unit_descriptor_##i feature_unit_1; \
410 #define INIT_CS_AC_IF(dev, i, ifaces) \ argument
412 .bLength = sizeof(struct dev##_cs_ac_if_descriptor_##i), \
417 sizeof(struct dev##_cs_ac_if_descriptor_##i) + \
419 sizeof(struct dev##_feature_unit_descriptor_##i) + \
425 #define INIT_CS_AC_IF_BIDIR(dev, i, ifaces) \ argument
427 .bLength = sizeof(struct dev##_cs_ac_if_descriptor_##i), \
432 sizeof(struct dev##_cs_ac_if_descriptor_##i) + \
434 sizeof(struct dev##_MIC_feature_unit_descriptor_##i) + \
435 sizeof(struct dev##_HP_feature_unit_descriptor_##i) + \
441 #define INIT_IN_TERMINAL(dev, i, terminal_id, type) \ argument
449 .bNrChannels = MAX(1, CH_CNT(dev, i)), \
450 .wChannelConfig = sys_cpu_to_le16(CH_CFG(dev, i)), \
469 #define INIT_FEATURE_UNIT(dev, i, unit_id, source_id) \ argument
471 .bLength = sizeof(struct dev##_feature_unit_descriptor_##i), \
477 .bmaControls = { FEATURES(dev, i) }, \
512 #define INIT_STD_AS_AD_EP(dev, i, addr) \ argument
517 .bmAttributes = (USB_DC_EP_ISOCHRONOUS | SYNC_TYPE(dev, i)), \
518 .wMaxPacketSize = sys_cpu_to_le16(EP_SIZE(dev, i)), \
519 .bInterval = GET_INTERVAL(dev, i), \