| .. | .. |
|---|
| 7 | 7 | * Copyright (c) 2014 Samsung Electronics Co., Ltd. |
|---|
| 8 | 8 | * http://www.samsung.com |
|---|
| 9 | 9 | * |
|---|
| 10 | | - * Author: Andrzej Pietrasiewicz <andrzej.p@samsung.com> |
|---|
| 10 | + * Author: Andrzej Pietrasiewicz <andrzejtp2010@gmail.com> |
|---|
| 11 | 11 | */ |
|---|
| 12 | 12 | |
|---|
| 13 | 13 | #include <linux/sort.h> |
|---|
| .. | .. |
|---|
| 1607 | 1607 | if (ret) \ |
|---|
| 1608 | 1608 | goto end; \ |
|---|
| 1609 | 1609 | \ |
|---|
| 1610 | | - if (num > 255) { \ |
|---|
| 1611 | | - ret = -EINVAL; \ |
|---|
| 1612 | | - goto end; \ |
|---|
| 1613 | | - } \ |
|---|
| 1614 | 1610 | u->desc.aname = num; \ |
|---|
| 1615 | 1611 | ret = len; \ |
|---|
| 1616 | 1612 | end: \ |
|---|
| .. | .. |
|---|
| 1804 | 1800 | if (ret) \ |
|---|
| 1805 | 1801 | goto end; \ |
|---|
| 1806 | 1802 | \ |
|---|
| 1807 | | - if (num > 255) { \ |
|---|
| 1808 | | - ret = -EINVAL; \ |
|---|
| 1809 | | - goto end; \ |
|---|
| 1810 | | - } \ |
|---|
| 1811 | 1803 | u->desc.aname = num; \ |
|---|
| 1812 | 1804 | ret = len; \ |
|---|
| 1813 | 1805 | end: \ |
|---|
| .. | .. |
|---|
| 2774 | 2766 | UVCG_OPTS_ATTR(streaming_interval, streaming_interval, 16); |
|---|
| 2775 | 2767 | UVCG_OPTS_ATTR(streaming_maxpacket, streaming_maxpacket, 3072); |
|---|
| 2776 | 2768 | UVCG_OPTS_ATTR(streaming_maxburst, streaming_maxburst, 15); |
|---|
| 2777 | | -UVCG_OPTS_ATTR(uvc_num_request, uvc_num_request, UVC_MAX_NUM_REQUESTS); |
|---|
| 2778 | 2769 | UVCG_OPTS_ATTR(pm_qos_latency, pm_qos_latency, PM_QOS_LATENCY_ANY); |
|---|
| 2770 | +#if defined(CONFIG_ARCH_ROCKCHIP) && defined(CONFIG_NO_GKI) |
|---|
| 2771 | +UVCG_OPTS_ATTR(uvc_num_request, uvc_num_request, 64); |
|---|
| 2772 | +UVCG_OPTS_ATTR(uvc_zero_copy, uvc_zero_copy, 1); |
|---|
| 2773 | +#endif |
|---|
| 2779 | 2774 | |
|---|
| 2780 | 2775 | #undef UVCG_OPTS_ATTR |
|---|
| 2781 | 2776 | |
|---|
| 2777 | +#if defined(CONFIG_ARCH_ROCKCHIP) && defined(CONFIG_NO_GKI) |
|---|
| 2782 | 2778 | static ssize_t f_uvc_opts_device_name_show(struct config_item *item, |
|---|
| 2783 | 2779 | char *page) |
|---|
| 2784 | 2780 | { |
|---|
| .. | .. |
|---|
| 2832 | 2828 | return ret; |
|---|
| 2833 | 2829 | } |
|---|
| 2834 | 2830 | UVC_ATTR(f_uvc_opts_, device_name, device_name); |
|---|
| 2831 | +#endif |
|---|
| 2832 | + |
|---|
| 2833 | +#define UVCG_OPTS_STRING_ATTR(cname, aname) \ |
|---|
| 2834 | +static ssize_t f_uvc_opts_string_##cname##_show(struct config_item *item,\ |
|---|
| 2835 | + char *page) \ |
|---|
| 2836 | +{ \ |
|---|
| 2837 | + struct f_uvc_opts *opts = to_f_uvc_opts(item); \ |
|---|
| 2838 | + int result; \ |
|---|
| 2839 | + \ |
|---|
| 2840 | + mutex_lock(&opts->lock); \ |
|---|
| 2841 | + result = snprintf(page, sizeof(opts->aname), "%s", opts->aname);\ |
|---|
| 2842 | + mutex_unlock(&opts->lock); \ |
|---|
| 2843 | + \ |
|---|
| 2844 | + return result; \ |
|---|
| 2845 | +} \ |
|---|
| 2846 | + \ |
|---|
| 2847 | +static ssize_t f_uvc_opts_string_##cname##_store(struct config_item *item,\ |
|---|
| 2848 | + const char *page, size_t len) \ |
|---|
| 2849 | +{ \ |
|---|
| 2850 | + struct f_uvc_opts *opts = to_f_uvc_opts(item); \ |
|---|
| 2851 | + int size = min(sizeof(opts->aname), len + 1); \ |
|---|
| 2852 | + int ret = 0; \ |
|---|
| 2853 | + \ |
|---|
| 2854 | + mutex_lock(&opts->lock); \ |
|---|
| 2855 | + if (opts->refcnt) { \ |
|---|
| 2856 | + ret = -EBUSY; \ |
|---|
| 2857 | + goto end; \ |
|---|
| 2858 | + } \ |
|---|
| 2859 | + \ |
|---|
| 2860 | + ret = strscpy(opts->aname, page, size); \ |
|---|
| 2861 | + if (ret == -E2BIG) \ |
|---|
| 2862 | + ret = size - 1; \ |
|---|
| 2863 | + \ |
|---|
| 2864 | +end: \ |
|---|
| 2865 | + mutex_unlock(&opts->lock); \ |
|---|
| 2866 | + return ret; \ |
|---|
| 2867 | +} \ |
|---|
| 2868 | + \ |
|---|
| 2869 | +UVC_ATTR(f_uvc_opts_string_, cname, aname) |
|---|
| 2870 | + |
|---|
| 2871 | +UVCG_OPTS_STRING_ATTR(function_name, function_name); |
|---|
| 2872 | + |
|---|
| 2873 | +#undef UVCG_OPTS_STRING_ATTR |
|---|
| 2835 | 2874 | |
|---|
| 2836 | 2875 | static struct configfs_attribute *uvc_attrs[] = { |
|---|
| 2837 | 2876 | &f_uvc_opts_attr_streaming_bulk, |
|---|
| 2838 | 2877 | &f_uvc_opts_attr_streaming_interval, |
|---|
| 2839 | 2878 | &f_uvc_opts_attr_streaming_maxpacket, |
|---|
| 2840 | 2879 | &f_uvc_opts_attr_streaming_maxburst, |
|---|
| 2841 | | - &f_uvc_opts_attr_uvc_num_request, |
|---|
| 2842 | 2880 | &f_uvc_opts_attr_pm_qos_latency, |
|---|
| 2881 | +#if defined(CONFIG_ARCH_ROCKCHIP) && defined(CONFIG_NO_GKI) |
|---|
| 2843 | 2882 | &f_uvc_opts_attr_device_name, |
|---|
| 2883 | + &f_uvc_opts_attr_uvc_num_request, |
|---|
| 2884 | + &f_uvc_opts_attr_uvc_zero_copy, |
|---|
| 2885 | +#endif |
|---|
| 2886 | + &f_uvc_opts_string_attr_function_name, |
|---|
| 2844 | 2887 | NULL, |
|---|
| 2845 | 2888 | }; |
|---|
| 2846 | 2889 | |
|---|