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()
1528 struct f_uac2_opts *opts = g_audio_to_uac2_opts(agdev); in in_rq_cur() local
1561 } else if ((FUIN_EN(opts) && (entity_id == USB_IN_FU_ID)) || in in_rq_cur()
1562 (FUOUT_EN(opts) && (entity_id == USB_OUT_FU_ID))) { in in_rq_cur()
1565 if (FUIN_EN(opts) && (entity_id == USB_IN_FU_ID)) in in_rq_cur()
1605 struct f_uac2_opts *opts = g_audio_to_uac2_opts(agdev); in in_rq_range() local
1622 srates = opts->p_srates; in in_rq_range()
1624 srates = opts->c_srates; in in_rq_range()
1650 } else if ((FUIN_EN(opts) && (entity_id == USB_IN_FU_ID)) || in in_rq_range()
1651 (FUOUT_EN(opts) && (entity_id == USB_OUT_FU_ID))) { in in_rq_range()
1654 if (FUIN_EN(opts) && (entity_id == USB_IN_FU_ID)) in in_rq_range()
1662 max_db = opts->p_volume_max; in in_rq_range()
1663 min_db = opts->p_volume_min; in in_rq_range()
1664 res_db = opts->p_volume_res; in in_rq_range()
1666 max_db = opts->c_volume_max; in in_rq_range()
1667 min_db = opts->c_volume_min; in in_rq_range()
1668 res_db = opts->c_volume_res; in in_rq_range()
1727 struct f_uac2_opts *opts = g_audio_to_uac2_opts(agdev); in out_rq_cur_complete() local
1740 if ((FUIN_EN(opts) && (entity_id == USB_IN_FU_ID)) || in out_rq_cur_complete()
1741 (FUOUT_EN(opts) && (entity_id == USB_OUT_FU_ID))) { in out_rq_cur_complete()
1744 if (FUIN_EN(opts) && (entity_id == USB_IN_FU_ID)) in out_rq_cur_complete()
1776 struct f_uac2_opts *opts = g_audio_to_uac2_opts(agdev); in out_rq_cur() local
1794 } else if ((FUIN_EN(opts) && (entity_id == USB_IN_FU_ID)) || in out_rq_cur()
1795 (FUOUT_EN(opts) && (entity_id == USB_OUT_FU_ID))) { in out_rq_cur()
1872 struct f_uac2_opts *opts = to_f_uac2_opts(item); in f_uac2_attr_release() local
1874 usb_put_function_instance(&opts->func_inst); in f_uac2_attr_release()
1895 struct f_uac2_opts *opts = to_f_uac2_opts(item); \
1898 mutex_lock(&opts->lock); \
1899 result = sprintf(page, type##_fmt, opts->name); \
1900 mutex_unlock(&opts->lock); \
1908 struct f_uac2_opts *opts = to_f_uac2_opts(item); \
1912 mutex_lock(&opts->lock); \
1913 if (opts->refcnt) { \
1922 opts->name = num; \
1926 mutex_unlock(&opts->lock); \
1936 struct f_uac2_opts *opts = to_f_uac2_opts(item); \
1940 mutex_lock(&opts->lock); \
1941 switch (opts->name) { \
1953 mutex_unlock(&opts->lock); \
1961 struct f_uac2_opts *opts = to_f_uac2_opts(item); \
1964 mutex_lock(&opts->lock); \
1965 if (opts->refcnt) { \
1971 opts->name = USB_ENDPOINT_SYNC_ASYNC; \
1973 opts->name = USB_ENDPOINT_SYNC_ADAPTIVE; \
1982 mutex_unlock(&opts->lock); \
1992 struct f_uac2_opts *opts = to_f_uac2_opts(item); \
1996 mutex_lock(&opts->lock); \
1999 if (opts->name##s[i] == 0) \
2002 opts->name##s[i]); \
2006 mutex_unlock(&opts->lock); \
2014 struct f_uac2_opts *opts = to_f_uac2_opts(item); \
2021 mutex_lock(&opts->lock); \
2022 if (opts->refcnt) { \
2028 memset(opts->name##s, 0x00, sizeof(opts->name##s)); \
2035 opts->name##s[i++] = num; \
2041 mutex_unlock(&opts->lock); \
2051 struct f_uac2_opts *opts = to_f_uac2_opts(item); \
2054 mutex_lock(&opts->lock); \
2055 result = scnprintf(page, sizeof(opts->name), "%s", opts->name); \
2056 mutex_unlock(&opts->lock); \
2064 struct f_uac2_opts *opts = to_f_uac2_opts(item); \
2067 mutex_lock(&opts->lock); \
2068 if (opts->refcnt) { \
2076 scnprintf(opts->name, min(sizeof(opts->name), len + 1), \
2080 mutex_unlock(&opts->lock); \
2182 struct f_uac2_opts *opts; in afunc_free_inst() local
2184 opts = container_of(f, struct f_uac2_opts, func_inst); in afunc_free_inst()
2185 kfree(opts); in afunc_free_inst()
2190 struct f_uac2_opts *opts; in afunc_alloc_inst() local
2192 opts = kzalloc(sizeof(*opts), GFP_KERNEL); in afunc_alloc_inst()
2193 if (!opts) in afunc_alloc_inst()
2196 mutex_init(&opts->lock); in afunc_alloc_inst()
2197 opts->func_inst.free_func_inst = afunc_free_inst; in afunc_alloc_inst()
2199 config_group_init_type_name(&opts->func_inst.group, "", in afunc_alloc_inst()
2202 opts->p_chmask = UAC2_DEF_PCHMASK; in afunc_alloc_inst()
2203 opts->p_srates[0] = UAC2_DEF_PSRATE; in afunc_alloc_inst()
2204 opts->p_ssize = UAC2_DEF_PSSIZE; in afunc_alloc_inst()
2205 opts->p_hs_bint = UAC2_DEF_PHSBINT; in afunc_alloc_inst()
2206 opts->c_chmask = UAC2_DEF_CCHMASK; in afunc_alloc_inst()
2207 opts->c_srates[0] = UAC2_DEF_CSRATE; in afunc_alloc_inst()
2208 opts->c_ssize = UAC2_DEF_CSSIZE; in afunc_alloc_inst()
2209 opts->c_hs_bint = UAC2_DEF_CHSBINT; in afunc_alloc_inst()
2210 opts->c_sync = UAC2_DEF_CSYNC; in afunc_alloc_inst()
2212 opts->p_mute_present = UAC2_DEF_MUTE_PRESENT; in afunc_alloc_inst()
2213 opts->p_volume_present = UAC2_DEF_VOLUME_PRESENT; in afunc_alloc_inst()
2214 opts->p_volume_min = UAC2_DEF_MIN_DB; in afunc_alloc_inst()
2215 opts->p_volume_max = UAC2_DEF_MAX_DB; in afunc_alloc_inst()
2216 opts->p_volume_res = UAC2_DEF_RES_DB; in afunc_alloc_inst()
2218 opts->c_mute_present = UAC2_DEF_MUTE_PRESENT; in afunc_alloc_inst()
2219 opts->c_volume_present = UAC2_DEF_VOLUME_PRESENT; in afunc_alloc_inst()
2220 opts->c_volume_min = UAC2_DEF_MIN_DB; in afunc_alloc_inst()
2221 opts->c_volume_max = UAC2_DEF_MAX_DB; in afunc_alloc_inst()
2222 opts->c_volume_res = UAC2_DEF_RES_DB; in afunc_alloc_inst()
2224 opts->req_number = UAC2_DEF_REQ_NUM; in afunc_alloc_inst()
2225 opts->fb_max = FBACK_FAST_MAX; in afunc_alloc_inst()
2227 scnprintf(opts->function_name, sizeof(opts->function_name), "Source/Sink"); in afunc_alloc_inst()
2228 scnprintf(opts->if_ctrl_name, sizeof(opts->if_ctrl_name), "Topology Control"); in afunc_alloc_inst()
2229 scnprintf(opts->clksrc_in_name, sizeof(opts->clksrc_in_name), "Input Clock"); in afunc_alloc_inst()
2230 scnprintf(opts->clksrc_out_name, sizeof(opts->clksrc_out_name), "Output Clock"); in afunc_alloc_inst()
2232 scnprintf(opts->p_it_name, sizeof(opts->p_it_name), "USBD Out"); in afunc_alloc_inst()
2233 scnprintf(opts->p_it_ch_name, sizeof(opts->p_it_ch_name), "Capture Channels"); in afunc_alloc_inst()
2234 scnprintf(opts->p_ot_name, sizeof(opts->p_ot_name), "USBH In"); in afunc_alloc_inst()
2235 scnprintf(opts->p_fu_vol_name, sizeof(opts->p_fu_vol_name), "Capture Volume"); in afunc_alloc_inst()
2237 scnprintf(opts->c_it_name, sizeof(opts->c_it_name), "USBH Out"); in afunc_alloc_inst()
2238 scnprintf(opts->c_it_ch_name, sizeof(opts->c_it_ch_name), "Playback Channels"); in afunc_alloc_inst()
2239 scnprintf(opts->c_ot_name, sizeof(opts->c_ot_name), "USBD In"); in afunc_alloc_inst()
2240 scnprintf(opts->c_fu_vol_name, sizeof(opts->c_fu_vol_name), "Playback Volume"); in afunc_alloc_inst()
2242 opts->p_terminal_type = UAC2_DEF_P_TERM_TYPE; in afunc_alloc_inst()
2243 opts->c_terminal_type = UAC2_DEF_C_TERM_TYPE; in afunc_alloc_inst()
2245 return &opts->func_inst; in afunc_alloc_inst()
2251 struct f_uac2_opts *opts; in afunc_free() local
2254 opts = container_of(f->fi, struct f_uac2_opts, func_inst); in afunc_free()
2256 mutex_lock(&opts->lock); in afunc_free()
2257 --opts->refcnt; in afunc_free()
2258 mutex_unlock(&opts->lock); in afunc_free()
2279 struct f_uac2_opts *opts; in afunc_alloc() local
2285 opts = container_of(fi, struct f_uac2_opts, func_inst); in afunc_alloc()
2286 mutex_lock(&opts->lock); in afunc_alloc()
2287 ++opts->refcnt; in afunc_alloc()
2288 mutex_unlock(&opts->lock); in afunc_alloc()