xref: /linux/drivers/media/usb/pvrusb2/pvrusb2-ctrl.h (revision d6869352cb3c3cf3450637a52349e2e87c1354aa)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  *
4  *  Copyright (C) 2005 Mike Isely <isely@pobox.com>
5  */
6 #ifndef __PVRUSB2_CTRL_H
7 #define __PVRUSB2_CTRL_H
8 
9 struct pvr2_ctrl;
10 
11 enum pvr2_ctl_type {
12 	pvr2_ctl_int = 0,
13 	pvr2_ctl_enum = 1,
14 	pvr2_ctl_bitmask = 2,
15 	pvr2_ctl_bool = 3,
16 };
17 
18 
19 /* Set the given control. */
20 int pvr2_ctrl_set_value(struct pvr2_ctrl *,int val);
21 
22 /* Set/clear specific bits of the given control. */
23 int pvr2_ctrl_set_mask_value(struct pvr2_ctrl *,int mask,int val);
24 
25 /* Get the current value of the given control. */
26 int pvr2_ctrl_get_value(struct pvr2_ctrl *,int *valptr);
27 
28 /* Retrieve control's type */
29 enum pvr2_ctl_type pvr2_ctrl_get_type(struct pvr2_ctrl *);
30 
31 /* Retrieve control's maximum value (int type) */
32 int pvr2_ctrl_get_max(struct pvr2_ctrl *);
33 
34 /* Retrieve control's minimum value (int type) */
35 int pvr2_ctrl_get_min(struct pvr2_ctrl *);
36 
37 /* Retrieve control's default value (any type) */
38 int pvr2_ctrl_get_def(struct pvr2_ctrl *, int *valptr);
39 
40 /* Retrieve control's enumeration count (enum only) */
41 int pvr2_ctrl_get_cnt(struct pvr2_ctrl *);
42 
43 /* Retrieve control's valid mask bits (bit mask only) */
44 int pvr2_ctrl_get_mask(struct pvr2_ctrl *);
45 
46 /* Retrieve the control's name */
47 const char *pvr2_ctrl_get_name(struct pvr2_ctrl *);
48 
49 /* Retrieve the control's desc */
50 const char *pvr2_ctrl_get_desc(struct pvr2_ctrl *);
51 
52 /* Retrieve a control enumeration or bit mask value */
53 int pvr2_ctrl_get_valname(struct pvr2_ctrl *,int,char *,unsigned int,
54 			  unsigned int *);
55 
56 /* Return true if control is writable */
57 int pvr2_ctrl_is_writable(struct pvr2_ctrl *);
58 
59 /* Return V4L flags value for control (or zero if there is no v4l control
60    actually under this control) */
61 unsigned int pvr2_ctrl_get_v4lflags(struct pvr2_ctrl *);
62 
63 /* Return V4L ID for this control or zero if none */
64 int pvr2_ctrl_get_v4lid(struct pvr2_ctrl *);
65 
66 /* Return true if control has custom symbolic representation */
67 int pvr2_ctrl_has_custom_symbols(struct pvr2_ctrl *);
68 
69 /* Convert a given mask/val to a custom symbolic value */
70 int pvr2_ctrl_custom_value_to_sym(struct pvr2_ctrl *,
71 				  int mask,int val,
72 				  char *buf,unsigned int maxlen,
73 				  unsigned int *len);
74 
75 /* Convert a symbolic value to a mask/value pair */
76 int pvr2_ctrl_custom_sym_to_value(struct pvr2_ctrl *,
77 				  const char *buf,unsigned int len,
78 				  int *maskptr,int *valptr);
79 
80 /* Convert a given mask/val to a symbolic value */
81 int pvr2_ctrl_value_to_sym(struct pvr2_ctrl *,
82 			   int mask,int val,
83 			   char *buf,unsigned int maxlen,
84 			   unsigned int *len);
85 
86 /* Convert a symbolic value to a mask/value pair */
87 int pvr2_ctrl_sym_to_value(struct pvr2_ctrl *,
88 			   const char *buf,unsigned int len,
89 			   int *maskptr,int *valptr);
90 
91 /* Convert a given mask/val to a symbolic value - must already be
92    inside of critical region. */
93 int pvr2_ctrl_value_to_sym_internal(struct pvr2_ctrl *,
94 			   int mask,int val,
95 			   char *buf,unsigned int maxlen,
96 			   unsigned int *len);
97 
98 #endif /* __PVRUSB2_CTRL_H */
99