From 571e148aaec20c26c308d6611cdb1f34ec81ff1e Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Sat, 26 May 2018 20:58:19 +0300 Subject: configfs: Refactor ConfigFS parsing code Move all attribute parsing to a top-level configfs_parse_uvc() function, and split control and streaming interface attributes to two separate helper functions. In addition to making the code more structured, it will also allow supporting multiple streaming interfaces in a single UVC function in the future. The uvc_function_config structure is similarly reorganized in a hierarchical representation of the configuration. Signed-off-by: Laurent Pinchart Reviewed-by: Kieran Bingham --- configfs.h | 53 ++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 42 insertions(+), 11 deletions(-) (limited to 'configfs.h') diff --git a/configfs.h b/configfs.h index b5c7480..9f7f377 100644 --- a/configfs.h +++ b/configfs.h @@ -10,26 +10,57 @@ #ifndef __CONFIGFS_H__ #define __CONFIGFS_H__ +/* + * struct uvc_function_config_endpoint - Endpoint parameters + * @bInterval: Transfer interval (interrupt and isochronous only) + * @bMaxBurst: Transfer burst size (super-speed only) + * @wMaxPacketSize: Maximum packet size (including the multiplier) + */ +struct uvc_function_config_endpoint { + unsigned int bInterval; + unsigned int bMaxBurst; + unsigned int wMaxPacketSize; +}; + +/* + * struct uvc_function_config_interface - Interface parameters + * @bInterfaceNumber: Interface number + */ +struct uvc_function_config_interface { + unsigned int bInterfaceNumber; +}; + +/* + * struct uvc_function_config_control - Control interface parameters + * @intf: Generic interface parameters + */ +struct uvc_function_config_control { + struct uvc_function_config_interface intf; +}; + +/* + * struct uvc_function_config_streaming - Streaming interface parameters + * @intf: Generic interface parameters + * @ep: Endpoint parameters + */ +struct uvc_function_config_streaming { + struct uvc_function_config_interface intf; + struct uvc_function_config_endpoint ep; +}; + /* * struct uvc_function_config - UVC function configuration parameters * @video: Full path to the video device node * @udc: UDC name - * @control_interface: Control interface number - * @streaming_interface: Streaming interface number - * @streaming_interval: Isochronous interval for the streaming endpoint - * @streaming_maxburts: Isochronous maximum burst for the streaming endpoint - * @streaming_maxpacket: Isochronous maximum packets for the streaming endpoint + * @control: Control interface configuration + * @streaming: Streaming interface configuration */ struct uvc_function_config { char *video; char *udc; - unsigned int control_interface; - unsigned int streaming_interface; - - unsigned int streaming_interval; - unsigned int streaming_maxburst; - unsigned int streaming_maxpacket; + struct uvc_function_config_control control; + struct uvc_function_config_streaming streaming; }; struct uvc_function_config *configfs_parse_uvc_function(const char *function); -- cgit v1.2.3