Lines Matching refs:opts

790 static void setup_headers(struct f_uac2_opts *opts,  in setup_headers()  argument
832 if (EPIN_EN(opts)) in setup_headers()
834 if (EPOUT_EN(opts)) { in setup_headers()
838 if (FUOUT_EN(opts)) in setup_headers()
842 if (EPIN_EN(opts)) { in setup_headers()
845 if (FUIN_EN(opts)) in setup_headers()
851 if (EPOUT_EN(opts)) in setup_headers()
854 if (FUOUT_EN(opts) || FUIN_EN(opts)) { in setup_headers()
860 if (EPOUT_EN(opts)) { in setup_headers()
871 if (EPOUT_FBACK_IN_EN(opts)) { in setup_headers()
878 if (EPIN_EN(opts)) { in setup_headers()
892 static void setup_descriptor(struct f_uac2_opts *opts) in setup_descriptor() argument
897 if (EPOUT_EN(opts)) in setup_descriptor()
899 if (EPIN_EN(opts)) in setup_descriptor()
901 if (EPOUT_EN(opts)) in setup_descriptor()
903 if (EPIN_EN(opts)) in setup_descriptor()
905 if (FUOUT_EN(opts)) in setup_descriptor()
907 if (FUIN_EN(opts)) in setup_descriptor()
909 if (EPOUT_EN(opts)) in setup_descriptor()
911 if (EPIN_EN(opts)) in setup_descriptor()
916 if (FUIN_EN(opts)) { in setup_descriptor()
927 if (FUOUT_EN(opts)) { in setup_descriptor()
940 if (EPIN_EN(opts)) { in setup_descriptor()
946 if (FUIN_EN(opts)) in setup_descriptor()
953 if (EPOUT_EN(opts)) { in setup_descriptor()
959 if (FUOUT_EN(opts)) in setup_descriptor()
967 io_in_it_desc.wTerminalType = cpu_to_le16(opts->c_terminal_type); in setup_descriptor()
968 io_out_ot_desc.wTerminalType = cpu_to_le16(opts->p_terminal_type); in setup_descriptor()
970 setup_headers(opts, fs_audio_desc, USB_SPEED_FULL); in setup_descriptor()
971 setup_headers(opts, hs_audio_desc, USB_SPEED_HIGH); in setup_descriptor()
972 setup_headers(opts, ss_audio_desc, USB_SPEED_SUPER); in setup_descriptor()
977 struct f_uac2_opts *opts = g_audio_to_uac2_opts(agdev); in afunc_validate_opts() local
980 if (!opts->p_chmask && !opts->c_chmask) in afunc_validate_opts()
982 else if (opts->p_chmask & ~UAC2_CHANNEL_MASK) in afunc_validate_opts()
984 else if (opts->c_chmask & ~UAC2_CHANNEL_MASK) in afunc_validate_opts()
986 else if ((opts->p_ssize < 1) || (opts->p_ssize > 4)) in afunc_validate_opts()
988 else if ((opts->c_ssize < 1) || (opts->c_ssize > 4)) in afunc_validate_opts()
990 else if (!opts->p_srates[0]) in afunc_validate_opts()
992 else if (!opts->c_srates[0]) in afunc_validate_opts()
995 else if (opts->p_volume_max <= opts->p_volume_min) in afunc_validate_opts()
997 else if (opts->c_volume_max <= opts->c_volume_min) in afunc_validate_opts()
999 else if (opts->p_volume_res <= 0) in afunc_validate_opts()
1001 else if (opts->c_volume_res <= 0) in afunc_validate_opts()
1004 else if ((opts->p_volume_max - opts->p_volume_min) % opts->p_volume_res) in afunc_validate_opts()
1006 else if ((opts->c_volume_max - opts->c_volume_min) % opts->c_volume_res) in afunc_validate_opts()
1009 else if ((opts->p_hs_bint < 0) || (opts->p_hs_bint > 4)) in afunc_validate_opts()
1011 else if ((opts->c_hs_bint < 0) || (opts->c_hs_bint > 4)) in afunc_validate_opts()
1527 struct f_uac2_opts *opts = g_audio_to_uac2_opts(agdev); in in_rq_cur() local
1560 } else if ((FUIN_EN(opts) && (entity_id == USB_IN_FU_ID)) || in in_rq_cur()
1561 (FUOUT_EN(opts) && (entity_id == USB_OUT_FU_ID))) { in in_rq_cur()
1564 if (FUIN_EN(opts) && (entity_id == USB_IN_FU_ID)) in in_rq_cur()
1604 struct f_uac2_opts *opts = g_audio_to_uac2_opts(agdev); in in_rq_range() local
1621 srates = opts->p_srates; in in_rq_range()
1623 srates = opts->c_srates; in in_rq_range()
1649 } else if ((FUIN_EN(opts) && (entity_id == USB_IN_FU_ID)) || in in_rq_range()
1650 (FUOUT_EN(opts) && (entity_id == USB_OUT_FU_ID))) { in in_rq_range()
1653 if (FUIN_EN(opts) && (entity_id == USB_IN_FU_ID)) in in_rq_range()
1661 max_db = opts->p_volume_max; in in_rq_range()
1662 min_db = opts->p_volume_min; in in_rq_range()
1663 res_db = opts->p_volume_res; in in_rq_range()
1665 max_db = opts->c_volume_max; in in_rq_range()
1666 min_db = opts->c_volume_min; in in_rq_range()
1667 res_db = opts->c_volume_res; in in_rq_range()
1726 struct f_uac2_opts *opts = g_audio_to_uac2_opts(agdev); in out_rq_cur_complete() local
1739 if ((FUIN_EN(opts) && (entity_id == USB_IN_FU_ID)) || in out_rq_cur_complete()
1740 (FUOUT_EN(opts) && (entity_id == USB_OUT_FU_ID))) { in out_rq_cur_complete()
1743 if (FUIN_EN(opts) && (entity_id == USB_IN_FU_ID)) in out_rq_cur_complete()
1775 struct f_uac2_opts *opts = g_audio_to_uac2_opts(agdev); in out_rq_cur() local
1793 } else if ((FUIN_EN(opts) && (entity_id == USB_IN_FU_ID)) || in out_rq_cur()
1794 (FUOUT_EN(opts) && (entity_id == USB_OUT_FU_ID))) { in out_rq_cur()
1871 struct f_uac2_opts *opts = to_f_uac2_opts(item); in f_uac2_attr_release() local
1873 usb_put_function_instance(&opts->func_inst); in f_uac2_attr_release()
1894 struct f_uac2_opts *opts = to_f_uac2_opts(item); \
1897 mutex_lock(&opts->lock); \
1898 result = sprintf(page, type##_fmt, opts->name); \
1899 mutex_unlock(&opts->lock); \
1907 struct f_uac2_opts *opts = to_f_uac2_opts(item); \
1911 mutex_lock(&opts->lock); \
1912 if (opts->refcnt) { \
1921 opts->name = num; \
1925 mutex_unlock(&opts->lock); \
1935 struct f_uac2_opts *opts = to_f_uac2_opts(item); \
1939 mutex_lock(&opts->lock); \
1940 switch (opts->name) { \
1952 mutex_unlock(&opts->lock); \
1960 struct f_uac2_opts *opts = to_f_uac2_opts(item); \
1963 mutex_lock(&opts->lock); \
1964 if (opts->refcnt) { \
1970 opts->name = USB_ENDPOINT_SYNC_ASYNC; \
1972 opts->name = USB_ENDPOINT_SYNC_ADAPTIVE; \
1981 mutex_unlock(&opts->lock); \
1991 struct f_uac2_opts *opts = to_f_uac2_opts(item); \
1995 mutex_lock(&opts->lock); \
1998 if (opts->name##s[i] == 0) \
2001 opts->name##s[i]); \
2005 mutex_unlock(&opts->lock); \
2013 struct f_uac2_opts *opts = to_f_uac2_opts(item); \
2020 mutex_lock(&opts->lock); \
2021 if (opts->refcnt) { \
2027 memset(opts->name##s, 0x00, sizeof(opts->name##s)); \
2034 opts->name##s[i++] = num; \
2040 mutex_unlock(&opts->lock); \
2050 struct f_uac2_opts *opts = to_f_uac2_opts(item); \
2053 mutex_lock(&opts->lock); \
2054 result = scnprintf(page, sizeof(opts->name), "%s", opts->name); \
2055 mutex_unlock(&opts->lock); \
2063 struct f_uac2_opts *opts = to_f_uac2_opts(item); \
2066 mutex_lock(&opts->lock); \
2067 if (opts->refcnt) { \
2075 scnprintf(opts->name, min(sizeof(opts->name), len + 1), \
2079 mutex_unlock(&opts->lock); \
2181 struct f_uac2_opts *opts; in afunc_free_inst() local
2183 opts = container_of(f, struct f_uac2_opts, func_inst); in afunc_free_inst()
2184 kfree(opts); in afunc_free_inst()
2189 struct f_uac2_opts *opts; in afunc_alloc_inst() local
2191 opts = kzalloc(sizeof(*opts), GFP_KERNEL); in afunc_alloc_inst()
2192 if (!opts) in afunc_alloc_inst()
2195 mutex_init(&opts->lock); in afunc_alloc_inst()
2196 opts->func_inst.free_func_inst = afunc_free_inst; in afunc_alloc_inst()
2198 config_group_init_type_name(&opts->func_inst.group, "", in afunc_alloc_inst()
2201 opts->p_chmask = UAC2_DEF_PCHMASK; in afunc_alloc_inst()
2202 opts->p_srates[0] = UAC2_DEF_PSRATE; in afunc_alloc_inst()
2203 opts->p_ssize = UAC2_DEF_PSSIZE; in afunc_alloc_inst()
2204 opts->p_hs_bint = UAC2_DEF_PHSBINT; in afunc_alloc_inst()
2205 opts->c_chmask = UAC2_DEF_CCHMASK; in afunc_alloc_inst()
2206 opts->c_srates[0] = UAC2_DEF_CSRATE; in afunc_alloc_inst()
2207 opts->c_ssize = UAC2_DEF_CSSIZE; in afunc_alloc_inst()
2208 opts->c_hs_bint = UAC2_DEF_CHSBINT; in afunc_alloc_inst()
2209 opts->c_sync = UAC2_DEF_CSYNC; in afunc_alloc_inst()
2211 opts->p_mute_present = UAC2_DEF_MUTE_PRESENT; in afunc_alloc_inst()
2212 opts->p_volume_present = UAC2_DEF_VOLUME_PRESENT; in afunc_alloc_inst()
2213 opts->p_volume_min = UAC2_DEF_MIN_DB; in afunc_alloc_inst()
2214 opts->p_volume_max = UAC2_DEF_MAX_DB; in afunc_alloc_inst()
2215 opts->p_volume_res = UAC2_DEF_RES_DB; in afunc_alloc_inst()
2217 opts->c_mute_present = UAC2_DEF_MUTE_PRESENT; in afunc_alloc_inst()
2218 opts->c_volume_present = UAC2_DEF_VOLUME_PRESENT; in afunc_alloc_inst()
2219 opts->c_volume_min = UAC2_DEF_MIN_DB; in afunc_alloc_inst()
2220 opts->c_volume_max = UAC2_DEF_MAX_DB; in afunc_alloc_inst()
2221 opts->c_volume_res = UAC2_DEF_RES_DB; in afunc_alloc_inst()
2223 opts->req_number = UAC2_DEF_REQ_NUM; in afunc_alloc_inst()
2224 opts->fb_max = FBACK_FAST_MAX; in afunc_alloc_inst()
2226 scnprintf(opts->function_name, sizeof(opts->function_name), "Source/Sink"); in afunc_alloc_inst()
2227 scnprintf(opts->if_ctrl_name, sizeof(opts->if_ctrl_name), "Topology Control"); in afunc_alloc_inst()
2228 scnprintf(opts->clksrc_in_name, sizeof(opts->clksrc_in_name), "Input Clock"); in afunc_alloc_inst()
2229 scnprintf(opts->clksrc_out_name, sizeof(opts->clksrc_out_name), "Output Clock"); in afunc_alloc_inst()
2231 scnprintf(opts->p_it_name, sizeof(opts->p_it_name), "USBD Out"); in afunc_alloc_inst()
2232 scnprintf(opts->p_it_ch_name, sizeof(opts->p_it_ch_name), "Capture Channels"); in afunc_alloc_inst()
2233 scnprintf(opts->p_ot_name, sizeof(opts->p_ot_name), "USBH In"); in afunc_alloc_inst()
2234 scnprintf(opts->p_fu_vol_name, sizeof(opts->p_fu_vol_name), "Capture Volume"); in afunc_alloc_inst()
2236 scnprintf(opts->c_it_name, sizeof(opts->c_it_name), "USBH Out"); in afunc_alloc_inst()
2237 scnprintf(opts->c_it_ch_name, sizeof(opts->c_it_ch_name), "Playback Channels"); in afunc_alloc_inst()
2238 scnprintf(opts->c_ot_name, sizeof(opts->c_ot_name), "USBD In"); in afunc_alloc_inst()
2239 scnprintf(opts->c_fu_vol_name, sizeof(opts->c_fu_vol_name), "Playback Volume"); in afunc_alloc_inst()
2241 opts->p_terminal_type = UAC2_DEF_P_TERM_TYPE; in afunc_alloc_inst()
2242 opts->c_terminal_type = UAC2_DEF_C_TERM_TYPE; in afunc_alloc_inst()
2244 return &opts->func_inst; in afunc_alloc_inst()
2250 struct f_uac2_opts *opts; in afunc_free() local
2253 opts = container_of(f->fi, struct f_uac2_opts, func_inst); in afunc_free()
2255 mutex_lock(&opts->lock); in afunc_free()
2256 --opts->refcnt; in afunc_free()
2257 mutex_unlock(&opts->lock); in afunc_free()
2278 struct f_uac2_opts *opts; in afunc_alloc() local
2284 opts = container_of(fi, struct f_uac2_opts, func_inst); in afunc_alloc()
2285 mutex_lock(&opts->lock); in afunc_alloc()
2286 ++opts->refcnt; in afunc_alloc()
2287 mutex_unlock(&opts->lock); in afunc_alloc()