Lines Matching refs:opts
803 static void setup_headers(struct f_uac2_opts *opts,
845 if (EPIN_EN(opts))
847 if (EPOUT_EN(opts)) {
851 if (FUOUT_EN(opts))
855 if (EPIN_EN(opts)) {
858 if (FUIN_EN(opts))
864 if (EPOUT_EN(opts))
867 if (FUOUT_EN(opts) || FUIN_EN(opts)) {
873 if (EPOUT_EN(opts)) {
884 if (EPOUT_FBACK_IN_EN(opts)) {
891 if (EPIN_EN(opts)) {
905 static void setup_descriptor(struct f_uac2_opts *opts)
910 if (EPOUT_EN(opts))
912 if (EPIN_EN(opts))
914 if (EPOUT_EN(opts))
916 if (EPIN_EN(opts))
918 if (FUOUT_EN(opts))
920 if (FUIN_EN(opts))
922 if (EPOUT_EN(opts))
924 if (EPIN_EN(opts))
929 if (FUIN_EN(opts)) {
940 if (FUOUT_EN(opts)) {
953 if (EPIN_EN(opts)) {
959 if (FUIN_EN(opts))
966 if (EPOUT_EN(opts)) {
972 if (FUOUT_EN(opts))
980 setup_headers(opts, fs_audio_desc, USB_SPEED_FULL);
981 setup_headers(opts, hs_audio_desc, USB_SPEED_HIGH);
982 setup_headers(opts, ss_audio_desc, USB_SPEED_SUPER);
987 struct f_uac2_opts *opts = g_audio_to_uac2_opts(agdev);
990 if (!opts->p_chmask && !opts->c_chmask)
992 else if (opts->p_chmask & ~UAC2_CHANNEL_MASK)
994 else if (opts->c_chmask & ~UAC2_CHANNEL_MASK)
996 else if ((opts->p_ssize < 1) || (opts->p_ssize > 4))
998 else if ((opts->c_ssize < 1) || (opts->c_ssize > 4))
1000 else if (!opts->p_srates[0])
1002 else if (!opts->c_srates[0])
1005 else if (opts->p_volume_max <= opts->p_volume_min)
1007 else if (opts->c_volume_max <= opts->c_volume_min)
1009 else if (opts->p_volume_res <= 0)
1011 else if (opts->c_volume_res <= 0)
1014 else if ((opts->p_volume_max - opts->p_volume_min) % opts->p_volume_res)
1016 else if ((opts->c_volume_max - opts->c_volume_min) % opts->c_volume_res)
1019 else if ((opts->p_hs_bint < 0) || (opts->p_hs_bint > 4))
1021 else if ((opts->c_hs_bint < 0) || (opts->c_hs_bint > 4))
1518 struct f_uac2_opts *opts = g_audio_to_uac2_opts(agdev);
1551 } else if ((FUIN_EN(opts) && (entity_id == USB_IN_FU_ID)) ||
1552 (FUOUT_EN(opts) && (entity_id == USB_OUT_FU_ID))) {
1555 if (FUIN_EN(opts) && (entity_id == USB_IN_FU_ID))
1595 struct f_uac2_opts *opts = g_audio_to_uac2_opts(agdev);
1612 srates = opts->p_srates;
1614 srates = opts->c_srates;
1640 } else if ((FUIN_EN(opts) && (entity_id == USB_IN_FU_ID)) ||
1641 (FUOUT_EN(opts) && (entity_id == USB_OUT_FU_ID))) {
1644 if (FUIN_EN(opts) && (entity_id == USB_IN_FU_ID))
1652 max_db = opts->p_volume_max;
1653 min_db = opts->p_volume_min;
1654 res_db = opts->p_volume_res;
1656 max_db = opts->c_volume_max;
1657 min_db = opts->c_volume_min;
1658 res_db = opts->c_volume_res;
1717 struct f_uac2_opts *opts = g_audio_to_uac2_opts(agdev);
1730 if ((FUIN_EN(opts) && (entity_id == USB_IN_FU_ID)) ||
1731 (FUOUT_EN(opts) && (entity_id == USB_OUT_FU_ID))) {
1734 if (FUIN_EN(opts) && (entity_id == USB_IN_FU_ID))
1766 struct f_uac2_opts *opts = g_audio_to_uac2_opts(agdev);
1784 } else if ((FUIN_EN(opts) && (entity_id == USB_IN_FU_ID)) ||
1785 (FUOUT_EN(opts) && (entity_id == USB_OUT_FU_ID))) {
1862 struct f_uac2_opts *opts = to_f_uac2_opts(item);
1864 usb_put_function_instance(&opts->func_inst);
1885 struct f_uac2_opts *opts = to_f_uac2_opts(item); \
1888 mutex_lock(&opts->lock); \
1889 result = sprintf(page, type##_fmt, opts->name); \
1890 mutex_unlock(&opts->lock); \
1898 struct f_uac2_opts *opts = to_f_uac2_opts(item); \
1902 mutex_lock(&opts->lock); \
1903 if (opts->refcnt) { \
1912 opts->name = num; \
1916 mutex_unlock(&opts->lock); \
1926 struct f_uac2_opts *opts = to_f_uac2_opts(item); \
1930 mutex_lock(&opts->lock); \
1931 switch (opts->name) { \
1943 mutex_unlock(&opts->lock); \
1951 struct f_uac2_opts *opts = to_f_uac2_opts(item); \
1954 mutex_lock(&opts->lock); \
1955 if (opts->refcnt) { \
1961 opts->name = USB_ENDPOINT_SYNC_ASYNC; \
1963 opts->name = USB_ENDPOINT_SYNC_ADAPTIVE; \
1972 mutex_unlock(&opts->lock); \
1982 struct f_uac2_opts *opts = to_f_uac2_opts(item); \
1986 mutex_lock(&opts->lock); \
1989 if (opts->name##s[i] == 0) \
1992 opts->name##s[i]); \
1996 mutex_unlock(&opts->lock); \
2004 struct f_uac2_opts *opts = to_f_uac2_opts(item); \
2011 mutex_lock(&opts->lock); \
2012 if (opts->refcnt) { \
2018 memset(opts->name##s, 0x00, sizeof(opts->name##s)); \
2025 opts->name##s[i++] = num; \
2031 mutex_unlock(&opts->lock); \
2041 struct f_uac2_opts *opts = to_f_uac2_opts(item); \
2044 mutex_lock(&opts->lock); \
2045 result = snprintf(page, sizeof(opts->name), "%s", opts->name); \
2046 mutex_unlock(&opts->lock); \
2054 struct f_uac2_opts *opts = to_f_uac2_opts(item); \
2057 mutex_lock(&opts->lock); \
2058 if (opts->refcnt) { \
2063 ret = snprintf(opts->name, min(sizeof(opts->name), len), \
2067 mutex_unlock(&opts->lock); \
2136 struct f_uac2_opts *opts;
2138 opts = container_of(f, struct f_uac2_opts, func_inst);
2139 kfree(opts);
2144 struct f_uac2_opts *opts;
2146 opts = kzalloc(sizeof(*opts), GFP_KERNEL);
2147 if (!opts)
2150 mutex_init(&opts->lock);
2151 opts->func_inst.free_func_inst = afunc_free_inst;
2153 config_group_init_type_name(&opts->func_inst.group, "",
2156 opts->p_chmask = UAC2_DEF_PCHMASK;
2157 opts->p_srates[0] = UAC2_DEF_PSRATE;
2158 opts->p_ssize = UAC2_DEF_PSSIZE;
2159 opts->p_hs_bint = UAC2_DEF_PHSBINT;
2160 opts->c_chmask = UAC2_DEF_CCHMASK;
2161 opts->c_srates[0] = UAC2_DEF_CSRATE;
2162 opts->c_ssize = UAC2_DEF_CSSIZE;
2163 opts->c_hs_bint = UAC2_DEF_CHSBINT;
2164 opts->c_sync = UAC2_DEF_CSYNC;
2166 opts->p_mute_present = UAC2_DEF_MUTE_PRESENT;
2167 opts->p_volume_present = UAC2_DEF_VOLUME_PRESENT;
2168 opts->p_volume_min = UAC2_DEF_MIN_DB;
2169 opts->p_volume_max = UAC2_DEF_MAX_DB;
2170 opts->p_volume_res = UAC2_DEF_RES_DB;
2172 opts->c_mute_present = UAC2_DEF_MUTE_PRESENT;
2173 opts->c_volume_present = UAC2_DEF_VOLUME_PRESENT;
2174 opts->c_volume_min = UAC2_DEF_MIN_DB;
2175 opts->c_volume_max = UAC2_DEF_MAX_DB;
2176 opts->c_volume_res = UAC2_DEF_RES_DB;
2178 opts->req_number = UAC2_DEF_REQ_NUM;
2179 opts->fb_max = FBACK_FAST_MAX;
2181 snprintf(opts->function_name, sizeof(opts->function_name), "Source/Sink");
2183 return &opts->func_inst;
2189 struct f_uac2_opts *opts;
2192 opts = container_of(f->fi, struct f_uac2_opts, func_inst);
2194 mutex_lock(&opts->lock);
2195 --opts->refcnt;
2196 mutex_unlock(&opts->lock);
2217 struct f_uac2_opts *opts;
2223 opts = container_of(fi, struct f_uac2_opts, func_inst);
2224 mutex_lock(&opts->lock);
2225 ++opts->refcnt;
2226 mutex_unlock(&opts->lock);