diff options
Diffstat (limited to 'include/media')
-rw-r--r-- | include/media/cx2341x.h | 97 | ||||
-rw-r--r-- | include/media/cx25840.h | 87 | ||||
-rw-r--r-- | include/media/ir-core.h | 49 | ||||
-rw-r--r-- | include/media/ir-kbd-i2c.h | 2 | ||||
-rw-r--r-- | include/media/lirc.h | 168 | ||||
-rw-r--r-- | include/media/lirc_dev.h | 225 | ||||
-rw-r--r-- | include/media/rc-map.h | 11 | ||||
-rw-r--r-- | include/media/sh_mobile_ceu.h | 3 | ||||
-rw-r--r-- | include/media/sh_mobile_csi2.h | 46 | ||||
-rw-r--r-- | include/media/soc_camera.h | 3 | ||||
-rw-r--r-- | include/media/v4l2-ctrls.h | 460 | ||||
-rw-r--r-- | include/media/v4l2-dev.h | 4 | ||||
-rw-r--r-- | include/media/v4l2-device.h | 4 | ||||
-rw-r--r-- | include/media/v4l2-mediabus.h | 13 | ||||
-rw-r--r-- | include/media/v4l2-subdev.h | 54 | ||||
-rw-r--r-- | include/media/videobuf-core.h | 6 | ||||
-rw-r--r-- | include/media/videobuf-dma-sg.h | 39 | ||||
-rw-r--r-- | include/media/videobuf-vmalloc.h | 2 |
18 files changed, 1215 insertions, 58 deletions
diff --git a/include/media/cx2341x.h b/include/media/cx2341x.h index 9ebe8558b9b6..8d08ebfe20b7 100644 --- a/include/media/cx2341x.h +++ b/include/media/cx2341x.h | |||
@@ -19,6 +19,8 @@ | |||
19 | #ifndef CX2341X_H | 19 | #ifndef CX2341X_H |
20 | #define CX2341X_H | 20 | #define CX2341X_H |
21 | 21 | ||
22 | #include <media/v4l2-ctrls.h> | ||
23 | |||
22 | enum cx2341x_port { | 24 | enum cx2341x_port { |
23 | CX2341X_PORT_MEMORY = 0, | 25 | CX2341X_PORT_MEMORY = 0, |
24 | CX2341X_PORT_STREAMING = 1, | 26 | CX2341X_PORT_STREAMING = 1, |
@@ -99,6 +101,101 @@ int cx2341x_ext_ctrls(struct cx2341x_mpeg_params *params, int busy, | |||
99 | void cx2341x_fill_defaults(struct cx2341x_mpeg_params *p); | 101 | void cx2341x_fill_defaults(struct cx2341x_mpeg_params *p); |
100 | void cx2341x_log_status(const struct cx2341x_mpeg_params *p, const char *prefix); | 102 | void cx2341x_log_status(const struct cx2341x_mpeg_params *p, const char *prefix); |
101 | 103 | ||
104 | struct cx2341x_handler; | ||
105 | |||
106 | struct cx2341x_handler_ops { | ||
107 | /* needed for the video clock freq */ | ||
108 | int (*s_audio_sampling_freq)(struct cx2341x_handler *hdl, u32 val); | ||
109 | /* needed for dualwatch */ | ||
110 | int (*s_audio_mode)(struct cx2341x_handler *hdl, u32 val); | ||
111 | /* needed for setting up the video resolution */ | ||
112 | int (*s_video_encoding)(struct cx2341x_handler *hdl, u32 val); | ||
113 | /* needed for setting up the sliced vbi insertion data structures */ | ||
114 | int (*s_stream_vbi_fmt)(struct cx2341x_handler *hdl, u32 val); | ||
115 | }; | ||
116 | |||
117 | struct cx2341x_handler { | ||
118 | u32 capabilities; | ||
119 | enum cx2341x_port port; | ||
120 | u16 width; | ||
121 | u16 height; | ||
122 | u16 is_50hz; | ||
123 | u32 audio_properties; | ||
124 | |||
125 | struct v4l2_ctrl_handler hdl; | ||
126 | void *priv; | ||
127 | cx2341x_mbox_func func; | ||
128 | const struct cx2341x_handler_ops *ops; | ||
129 | |||
130 | struct v4l2_ctrl *stream_vbi_fmt; | ||
131 | |||
132 | struct { | ||
133 | /* audio cluster */ | ||
134 | struct v4l2_ctrl *audio_sampling_freq; | ||
135 | struct v4l2_ctrl *audio_encoding; | ||
136 | struct v4l2_ctrl *audio_l2_bitrate; | ||
137 | struct v4l2_ctrl *audio_mode; | ||
138 | struct v4l2_ctrl *audio_mode_extension; | ||
139 | struct v4l2_ctrl *audio_emphasis; | ||
140 | struct v4l2_ctrl *audio_crc; | ||
141 | struct v4l2_ctrl *audio_ac3_bitrate; | ||
142 | }; | ||
143 | |||
144 | struct { | ||
145 | /* video gop cluster */ | ||
146 | struct v4l2_ctrl *video_b_frames; | ||
147 | struct v4l2_ctrl *video_gop_size; | ||
148 | }; | ||
149 | |||
150 | struct { | ||
151 | /* stream type cluster */ | ||
152 | struct v4l2_ctrl *stream_type; | ||
153 | struct v4l2_ctrl *video_encoding; | ||
154 | struct v4l2_ctrl *video_bitrate_mode; | ||
155 | struct v4l2_ctrl *video_bitrate; | ||
156 | struct v4l2_ctrl *video_bitrate_peak; | ||
157 | }; | ||
158 | |||
159 | struct { | ||
160 | /* video mute cluster */ | ||
161 | struct v4l2_ctrl *video_mute; | ||
162 | struct v4l2_ctrl *video_mute_yuv; | ||
163 | }; | ||
164 | |||
165 | struct { | ||
166 | /* video filter mode cluster */ | ||
167 | struct v4l2_ctrl *video_spatial_filter_mode; | ||
168 | struct v4l2_ctrl *video_temporal_filter_mode; | ||
169 | struct v4l2_ctrl *video_median_filter_type; | ||
170 | }; | ||
171 | |||
172 | struct { | ||
173 | /* video filter type cluster */ | ||
174 | struct v4l2_ctrl *video_luma_spatial_filter_type; | ||
175 | struct v4l2_ctrl *video_chroma_spatial_filter_type; | ||
176 | }; | ||
177 | |||
178 | struct { | ||
179 | /* video filter cluster */ | ||
180 | struct v4l2_ctrl *video_spatial_filter; | ||
181 | struct v4l2_ctrl *video_temporal_filter; | ||
182 | }; | ||
183 | |||
184 | struct { | ||
185 | /* video median cluster */ | ||
186 | struct v4l2_ctrl *video_luma_median_filter_top; | ||
187 | struct v4l2_ctrl *video_luma_median_filter_bottom; | ||
188 | struct v4l2_ctrl *video_chroma_median_filter_top; | ||
189 | struct v4l2_ctrl *video_chroma_median_filter_bottom; | ||
190 | }; | ||
191 | }; | ||
192 | |||
193 | int cx2341x_handler_init(struct cx2341x_handler *cxhdl, | ||
194 | unsigned nr_of_controls_hint); | ||
195 | void cx2341x_handler_set_50hz(struct cx2341x_handler *cxhdl, int is_50hz); | ||
196 | int cx2341x_handler_setup(struct cx2341x_handler *cxhdl); | ||
197 | void cx2341x_handler_set_busy(struct cx2341x_handler *cxhdl, int busy); | ||
198 | |||
102 | /* Firmware names */ | 199 | /* Firmware names */ |
103 | #define CX2341X_FIRM_ENC_FILENAME "v4l-cx2341x-enc.fw" | 200 | #define CX2341X_FIRM_ENC_FILENAME "v4l-cx2341x-enc.fw" |
104 | /* Decoder firmware for the cx23415 only */ | 201 | /* Decoder firmware for the cx23415 only */ |
diff --git a/include/media/cx25840.h b/include/media/cx25840.h index 0b0cb1776796..46d1a141208e 100644 --- a/include/media/cx25840.h +++ b/include/media/cx25840.h | |||
@@ -97,4 +97,91 @@ enum cx25840_audio_input { | |||
97 | CX25840_AUDIO8, | 97 | CX25840_AUDIO8, |
98 | }; | 98 | }; |
99 | 99 | ||
100 | enum cx25840_io_pin { | ||
101 | CX25840_PIN_DVALID_PRGM0 = 0, | ||
102 | CX25840_PIN_FIELD_PRGM1, | ||
103 | CX25840_PIN_HRESET_PRGM2, | ||
104 | CX25840_PIN_VRESET_HCTL_PRGM3, | ||
105 | CX25840_PIN_IRQ_N_PRGM4, | ||
106 | CX25840_PIN_IR_TX_PRGM6, | ||
107 | CX25840_PIN_IR_RX_PRGM5, | ||
108 | CX25840_PIN_GPIO0_PRGM8, | ||
109 | CX25840_PIN_GPIO1_PRGM9, | ||
110 | CX25840_PIN_SA_SDIN, /* Alternate GP Input only */ | ||
111 | CX25840_PIN_SA_SDOUT, /* Alternate GP Input only */ | ||
112 | CX25840_PIN_PLL_CLK_PRGM7, | ||
113 | CX25840_PIN_CHIP_SEL_VIPCLK, /* Output only */ | ||
114 | }; | ||
115 | |||
116 | enum cx25840_io_pad { | ||
117 | /* Output pads */ | ||
118 | CX25840_PAD_DEFAULT = 0, | ||
119 | CX25840_PAD_ACTIVE, | ||
120 | CX25840_PAD_VACTIVE, | ||
121 | CX25840_PAD_CBFLAG, | ||
122 | CX25840_PAD_VID_DATA_EXT0, | ||
123 | CX25840_PAD_VID_DATA_EXT1, | ||
124 | CX25840_PAD_GPO0, | ||
125 | CX25840_PAD_GPO1, | ||
126 | CX25840_PAD_GPO2, | ||
127 | CX25840_PAD_GPO3, | ||
128 | CX25840_PAD_IRQ_N, | ||
129 | CX25840_PAD_AC_SYNC, | ||
130 | CX25840_PAD_AC_SDOUT, | ||
131 | CX25840_PAD_PLL_CLK, | ||
132 | CX25840_PAD_VRESET, | ||
133 | CX25840_PAD_RESERVED, | ||
134 | /* Pads for PLL_CLK output only */ | ||
135 | CX25840_PAD_XTI_X5_DLL, | ||
136 | CX25840_PAD_AUX_PLL, | ||
137 | CX25840_PAD_VID_PLL, | ||
138 | CX25840_PAD_XTI, | ||
139 | /* Input Pads */ | ||
140 | CX25840_PAD_GPI0, | ||
141 | CX25840_PAD_GPI1, | ||
142 | CX25840_PAD_GPI2, | ||
143 | CX25840_PAD_GPI3, | ||
144 | }; | ||
145 | |||
146 | enum cx25840_io_pin_strength { | ||
147 | CX25840_PIN_DRIVE_MEDIUM = 0, | ||
148 | CX25840_PIN_DRIVE_SLOW, | ||
149 | CX25840_PIN_DRIVE_FAST, | ||
150 | }; | ||
151 | |||
152 | enum cx23885_io_pin { | ||
153 | CX23885_PIN_IR_RX_GPIO19, | ||
154 | CX23885_PIN_IR_TX_GPIO20, | ||
155 | CX23885_PIN_I2S_SDAT_GPIO21, | ||
156 | CX23885_PIN_I2S_WCLK_GPIO22, | ||
157 | CX23885_PIN_I2S_BCLK_GPIO23, | ||
158 | CX23885_PIN_IRQ_N_GPIO16, | ||
159 | }; | ||
160 | |||
161 | enum cx23885_io_pad { | ||
162 | CX23885_PAD_IR_RX, | ||
163 | CX23885_PAD_GPIO19, | ||
164 | CX23885_PAD_IR_TX, | ||
165 | CX23885_PAD_GPIO20, | ||
166 | CX23885_PAD_I2S_SDAT, | ||
167 | CX23885_PAD_GPIO21, | ||
168 | CX23885_PAD_I2S_WCLK, | ||
169 | CX23885_PAD_GPIO22, | ||
170 | CX23885_PAD_I2S_BCLK, | ||
171 | CX23885_PAD_GPIO23, | ||
172 | CX23885_PAD_IRQ_N, | ||
173 | CX23885_PAD_GPIO16, | ||
174 | }; | ||
175 | |||
176 | /* pvr150_workaround activates a workaround for a hardware bug that is | ||
177 | present in Hauppauge PVR-150 (and possibly PVR-500) cards that have | ||
178 | certain NTSC tuners (tveeprom tuner model numbers 85, 99 and 112). The | ||
179 | audio autodetect fails on some channels for these models and the workaround | ||
180 | is to select the audio standard explicitly. Many thanks to Hauppauge for | ||
181 | providing this information. | ||
182 | This platform data only needs to be supplied by the ivtv driver. */ | ||
183 | struct cx25840_platform_data { | ||
184 | int pvr150_workaround; | ||
185 | }; | ||
186 | |||
100 | #endif | 187 | #endif |
diff --git a/include/media/ir-core.h b/include/media/ir-core.h index ad1303f20e00..eb7fddf8f607 100644 --- a/include/media/ir-core.h +++ b/include/media/ir-core.h | |||
@@ -41,21 +41,49 @@ enum rc_driver_type { | |||
41 | * anything with it. Yet, as the same keycode table can be used with other | 41 | * anything with it. Yet, as the same keycode table can be used with other |
42 | * devices, a mask is provided to allow its usage. Drivers should generally | 42 | * devices, a mask is provided to allow its usage. Drivers should generally |
43 | * leave this field in blank | 43 | * leave this field in blank |
44 | * @timeout: optional time after which device stops sending data | ||
45 | * @min_timeout: minimum timeout supported by device | ||
46 | * @max_timeout: maximum timeout supported by device | ||
47 | * @rx_resolution : resolution (in ns) of input sampler | ||
48 | * @tx_resolution: resolution (in ns) of output sampler | ||
44 | * @priv: driver-specific data, to be used on the callbacks | 49 | * @priv: driver-specific data, to be used on the callbacks |
45 | * @change_protocol: allow changing the protocol used on hardware decoders | 50 | * @change_protocol: allow changing the protocol used on hardware decoders |
46 | * @open: callback to allow drivers to enable polling/irq when IR input device | 51 | * @open: callback to allow drivers to enable polling/irq when IR input device |
47 | * is opened. | 52 | * is opened. |
48 | * @close: callback to allow drivers to disable polling/irq when IR input device | 53 | * @close: callback to allow drivers to disable polling/irq when IR input device |
49 | * is opened. | 54 | * is opened. |
55 | * @s_tx_mask: set transmitter mask (for devices with multiple tx outputs) | ||
56 | * @s_tx_carrier: set transmit carrier frequency | ||
57 | * @s_tx_duty_cycle: set transmit duty cycle (0% - 100%) | ||
58 | * @s_rx_carrier: inform driver about carrier it is expected to handle | ||
59 | * @tx_ir: transmit IR | ||
60 | * @s_idle: optional: enable/disable hardware idle mode, upon which, | ||
61 | device doesn't interrupt host until it sees IR pulses | ||
62 | * @s_learning_mode: enable wide band receiver used for learning | ||
50 | */ | 63 | */ |
51 | struct ir_dev_props { | 64 | struct ir_dev_props { |
52 | enum rc_driver_type driver_type; | 65 | enum rc_driver_type driver_type; |
53 | unsigned long allowed_protos; | 66 | unsigned long allowed_protos; |
54 | u32 scanmask; | 67 | u32 scanmask; |
55 | void *priv; | 68 | |
69 | u32 timeout; | ||
70 | u32 min_timeout; | ||
71 | u32 max_timeout; | ||
72 | |||
73 | u32 rx_resolution; | ||
74 | u32 tx_resolution; | ||
75 | |||
76 | void *priv; | ||
56 | int (*change_protocol)(void *priv, u64 ir_type); | 77 | int (*change_protocol)(void *priv, u64 ir_type); |
57 | int (*open)(void *priv); | 78 | int (*open)(void *priv); |
58 | void (*close)(void *priv); | 79 | void (*close)(void *priv); |
80 | int (*s_tx_mask)(void *priv, u32 mask); | ||
81 | int (*s_tx_carrier)(void *priv, u32 carrier); | ||
82 | int (*s_tx_duty_cycle)(void *priv, u32 duty_cycle); | ||
83 | int (*s_rx_carrier_range)(void *priv, u32 min, u32 max); | ||
84 | int (*tx_ir)(void *priv, int *txbuf, u32 n); | ||
85 | void (*s_idle)(void *priv, int enable); | ||
86 | int (*s_learning_mode)(void *priv, int enable); | ||
59 | }; | 87 | }; |
60 | 88 | ||
61 | struct ir_input_dev { | 89 | struct ir_input_dev { |
@@ -63,9 +91,10 @@ struct ir_input_dev { | |||
63 | char *driver_name; /* Name of the driver module */ | 91 | char *driver_name; /* Name of the driver module */ |
64 | struct ir_scancode_table rc_tab; /* scan/key table */ | 92 | struct ir_scancode_table rc_tab; /* scan/key table */ |
65 | unsigned long devno; /* device number */ | 93 | unsigned long devno; /* device number */ |
66 | const struct ir_dev_props *props; /* Device properties */ | 94 | struct ir_dev_props *props; /* Device properties */ |
67 | struct ir_raw_event_ctrl *raw; /* for raw pulse/space events */ | 95 | struct ir_raw_event_ctrl *raw; /* for raw pulse/space events */ |
68 | struct input_dev *input_dev; /* the input device associated with this device */ | 96 | struct input_dev *input_dev; /* the input device associated with this device */ |
97 | bool idle; | ||
69 | 98 | ||
70 | /* key info - needed by IR keycode handlers */ | 99 | /* key info - needed by IR keycode handlers */ |
71 | spinlock_t keylock; /* protects the below members */ | 100 | spinlock_t keylock; /* protects the below members */ |
@@ -89,12 +118,12 @@ enum raw_event_type { | |||
89 | /* From ir-keytable.c */ | 118 | /* From ir-keytable.c */ |
90 | int __ir_input_register(struct input_dev *dev, | 119 | int __ir_input_register(struct input_dev *dev, |
91 | const struct ir_scancode_table *ir_codes, | 120 | const struct ir_scancode_table *ir_codes, |
92 | const struct ir_dev_props *props, | 121 | struct ir_dev_props *props, |
93 | const char *driver_name); | 122 | const char *driver_name); |
94 | 123 | ||
95 | static inline int ir_input_register(struct input_dev *dev, | 124 | static inline int ir_input_register(struct input_dev *dev, |
96 | const char *map_name, | 125 | const char *map_name, |
97 | const struct ir_dev_props *props, | 126 | struct ir_dev_props *props, |
98 | const char *driver_name) { | 127 | const char *driver_name) { |
99 | struct ir_scancode_table *ir_codes; | 128 | struct ir_scancode_table *ir_codes; |
100 | struct ir_input_dev *ir_dev; | 129 | struct ir_input_dev *ir_dev; |
@@ -104,8 +133,12 @@ static inline int ir_input_register(struct input_dev *dev, | |||
104 | return -EINVAL; | 133 | return -EINVAL; |
105 | 134 | ||
106 | ir_codes = get_rc_map(map_name); | 135 | ir_codes = get_rc_map(map_name); |
107 | if (!ir_codes) | 136 | if (!ir_codes) { |
108 | return -EINVAL; | 137 | ir_codes = get_rc_map(RC_MAP_EMPTY); |
138 | |||
139 | if (!ir_codes) | ||
140 | return -EINVAL; | ||
141 | } | ||
109 | 142 | ||
110 | rc = __ir_input_register(dev, ir_codes, props, driver_name); | 143 | rc = __ir_input_register(dev, ir_codes, props, driver_name); |
111 | if (rc < 0) | 144 | if (rc < 0) |
@@ -138,6 +171,10 @@ struct ir_raw_event { | |||
138 | void ir_raw_event_handle(struct input_dev *input_dev); | 171 | void ir_raw_event_handle(struct input_dev *input_dev); |
139 | int ir_raw_event_store(struct input_dev *input_dev, struct ir_raw_event *ev); | 172 | int ir_raw_event_store(struct input_dev *input_dev, struct ir_raw_event *ev); |
140 | int ir_raw_event_store_edge(struct input_dev *input_dev, enum raw_event_type type); | 173 | int ir_raw_event_store_edge(struct input_dev *input_dev, enum raw_event_type type); |
174 | int ir_raw_event_store_with_filter(struct input_dev *input_dev, | ||
175 | struct ir_raw_event *ev); | ||
176 | void ir_raw_event_set_idle(struct input_dev *input_dev, int idle); | ||
177 | |||
141 | static inline void ir_raw_event_reset(struct input_dev *input_dev) | 178 | static inline void ir_raw_event_reset(struct input_dev *input_dev) |
142 | { | 179 | { |
143 | struct ir_raw_event ev = { .pulse = false, .duration = 0 }; | 180 | struct ir_raw_event ev = { .pulse = false, .duration = 0 }; |
diff --git a/include/media/ir-kbd-i2c.h b/include/media/ir-kbd-i2c.h index 0506e45c9a4f..5e96d7a430be 100644 --- a/include/media/ir-kbd-i2c.h +++ b/include/media/ir-kbd-i2c.h | |||
@@ -11,7 +11,7 @@ struct IR_i2c { | |||
11 | struct i2c_client *c; | 11 | struct i2c_client *c; |
12 | struct input_dev *input; | 12 | struct input_dev *input; |
13 | struct ir_input_state ir; | 13 | struct ir_input_state ir; |
14 | 14 | u64 ir_type; | |
15 | /* Used to avoid fast repeating */ | 15 | /* Used to avoid fast repeating */ |
16 | unsigned char old; | 16 | unsigned char old; |
17 | 17 | ||
diff --git a/include/media/lirc.h b/include/media/lirc.h new file mode 100644 index 000000000000..6678a169fd9e --- /dev/null +++ b/include/media/lirc.h | |||
@@ -0,0 +1,168 @@ | |||
1 | /* | ||
2 | * lirc.h - linux infrared remote control header file | ||
3 | * last modified 2010/07/13 by Jarod Wilson | ||
4 | */ | ||
5 | |||
6 | #ifndef _LINUX_LIRC_H | ||
7 | #define _LINUX_LIRC_H | ||
8 | |||
9 | #include <linux/types.h> | ||
10 | #include <linux/ioctl.h> | ||
11 | |||
12 | #define PULSE_BIT 0x01000000 | ||
13 | #define PULSE_MASK 0x00FFFFFF | ||
14 | |||
15 | #define LIRC_MODE2_SPACE 0x00000000 | ||
16 | #define LIRC_MODE2_PULSE 0x01000000 | ||
17 | #define LIRC_MODE2_FREQUENCY 0x02000000 | ||
18 | #define LIRC_MODE2_TIMEOUT 0x03000000 | ||
19 | |||
20 | #define LIRC_VALUE_MASK 0x00FFFFFF | ||
21 | #define LIRC_MODE2_MASK 0xFF000000 | ||
22 | |||
23 | #define LIRC_SPACE(val) (((val)&LIRC_VALUE_MASK) | LIRC_MODE2_SPACE) | ||
24 | #define LIRC_PULSE(val) (((val)&LIRC_VALUE_MASK) | LIRC_MODE2_PULSE) | ||
25 | #define LIRC_FREQUENCY(val) (((val)&LIRC_VALUE_MASK) | LIRC_MODE2_FREQUENCY) | ||
26 | #define LIRC_TIMEOUT(val) (((val)&LIRC_VALUE_MASK) | LIRC_MODE2_TIMEOUT) | ||
27 | |||
28 | #define LIRC_VALUE(val) ((val)&LIRC_VALUE_MASK) | ||
29 | #define LIRC_MODE2(val) ((val)&LIRC_MODE2_MASK) | ||
30 | |||
31 | #define LIRC_IS_SPACE(val) (LIRC_MODE2(val) == LIRC_MODE2_SPACE) | ||
32 | #define LIRC_IS_PULSE(val) (LIRC_MODE2(val) == LIRC_MODE2_PULSE) | ||
33 | #define LIRC_IS_FREQUENCY(val) (LIRC_MODE2(val) == LIRC_MODE2_FREQUENCY) | ||
34 | #define LIRC_IS_TIMEOUT(val) (LIRC_MODE2(val) == LIRC_MODE2_TIMEOUT) | ||
35 | |||
36 | /* used heavily by lirc userspace */ | ||
37 | #define lirc_t int | ||
38 | |||
39 | /*** lirc compatible hardware features ***/ | ||
40 | |||
41 | #define LIRC_MODE2SEND(x) (x) | ||
42 | #define LIRC_SEND2MODE(x) (x) | ||
43 | #define LIRC_MODE2REC(x) ((x) << 16) | ||
44 | #define LIRC_REC2MODE(x) ((x) >> 16) | ||
45 | |||
46 | #define LIRC_MODE_RAW 0x00000001 | ||
47 | #define LIRC_MODE_PULSE 0x00000002 | ||
48 | #define LIRC_MODE_MODE2 0x00000004 | ||
49 | #define LIRC_MODE_LIRCCODE 0x00000010 | ||
50 | |||
51 | |||
52 | #define LIRC_CAN_SEND_RAW LIRC_MODE2SEND(LIRC_MODE_RAW) | ||
53 | #define LIRC_CAN_SEND_PULSE LIRC_MODE2SEND(LIRC_MODE_PULSE) | ||
54 | #define LIRC_CAN_SEND_MODE2 LIRC_MODE2SEND(LIRC_MODE_MODE2) | ||
55 | #define LIRC_CAN_SEND_LIRCCODE LIRC_MODE2SEND(LIRC_MODE_LIRCCODE) | ||
56 | |||
57 | #define LIRC_CAN_SEND_MASK 0x0000003f | ||
58 | |||
59 | #define LIRC_CAN_SET_SEND_CARRIER 0x00000100 | ||
60 | #define LIRC_CAN_SET_SEND_DUTY_CYCLE 0x00000200 | ||
61 | #define LIRC_CAN_SET_TRANSMITTER_MASK 0x00000400 | ||
62 | |||
63 | #define LIRC_CAN_REC_RAW LIRC_MODE2REC(LIRC_MODE_RAW) | ||
64 | #define LIRC_CAN_REC_PULSE LIRC_MODE2REC(LIRC_MODE_PULSE) | ||
65 | #define LIRC_CAN_REC_MODE2 LIRC_MODE2REC(LIRC_MODE_MODE2) | ||
66 | #define LIRC_CAN_REC_LIRCCODE LIRC_MODE2REC(LIRC_MODE_LIRCCODE) | ||
67 | |||
68 | #define LIRC_CAN_REC_MASK LIRC_MODE2REC(LIRC_CAN_SEND_MASK) | ||
69 | |||
70 | #define LIRC_CAN_SET_REC_CARRIER (LIRC_CAN_SET_SEND_CARRIER << 16) | ||
71 | #define LIRC_CAN_SET_REC_DUTY_CYCLE (LIRC_CAN_SET_SEND_DUTY_CYCLE << 16) | ||
72 | |||
73 | #define LIRC_CAN_SET_REC_DUTY_CYCLE_RANGE 0x40000000 | ||
74 | #define LIRC_CAN_SET_REC_CARRIER_RANGE 0x80000000 | ||
75 | #define LIRC_CAN_GET_REC_RESOLUTION 0x20000000 | ||
76 | #define LIRC_CAN_SET_REC_TIMEOUT 0x10000000 | ||
77 | #define LIRC_CAN_SET_REC_FILTER 0x08000000 | ||
78 | |||
79 | #define LIRC_CAN_MEASURE_CARRIER 0x02000000 | ||
80 | #define LIRC_CAN_USE_WIDEBAND_RECEIVER 0x04000000 | ||
81 | |||
82 | #define LIRC_CAN_SEND(x) ((x)&LIRC_CAN_SEND_MASK) | ||
83 | #define LIRC_CAN_REC(x) ((x)&LIRC_CAN_REC_MASK) | ||
84 | |||
85 | #define LIRC_CAN_NOTIFY_DECODE 0x01000000 | ||
86 | |||
87 | /*** IOCTL commands for lirc driver ***/ | ||
88 | |||
89 | #define LIRC_GET_FEATURES _IOR('i', 0x00000000, __u32) | ||
90 | |||
91 | #define LIRC_GET_SEND_MODE _IOR('i', 0x00000001, __u32) | ||
92 | #define LIRC_GET_REC_MODE _IOR('i', 0x00000002, __u32) | ||
93 | #define LIRC_GET_SEND_CARRIER _IOR('i', 0x00000003, __u32) | ||
94 | #define LIRC_GET_REC_CARRIER _IOR('i', 0x00000004, __u32) | ||
95 | #define LIRC_GET_SEND_DUTY_CYCLE _IOR('i', 0x00000005, __u32) | ||
96 | #define LIRC_GET_REC_DUTY_CYCLE _IOR('i', 0x00000006, __u32) | ||
97 | #define LIRC_GET_REC_RESOLUTION _IOR('i', 0x00000007, __u32) | ||
98 | |||
99 | #define LIRC_GET_MIN_TIMEOUT _IOR('i', 0x00000008, __u32) | ||
100 | #define LIRC_GET_MAX_TIMEOUT _IOR('i', 0x00000009, __u32) | ||
101 | |||
102 | #define LIRC_GET_MIN_FILTER_PULSE _IOR('i', 0x0000000a, __u32) | ||
103 | #define LIRC_GET_MAX_FILTER_PULSE _IOR('i', 0x0000000b, __u32) | ||
104 | #define LIRC_GET_MIN_FILTER_SPACE _IOR('i', 0x0000000c, __u32) | ||
105 | #define LIRC_GET_MAX_FILTER_SPACE _IOR('i', 0x0000000d, __u32) | ||
106 | |||
107 | /* code length in bits, currently only for LIRC_MODE_LIRCCODE */ | ||
108 | #define LIRC_GET_LENGTH _IOR('i', 0x0000000f, __u32) | ||
109 | |||
110 | #define LIRC_SET_SEND_MODE _IOW('i', 0x00000011, __u32) | ||
111 | #define LIRC_SET_REC_MODE _IOW('i', 0x00000012, __u32) | ||
112 | /* Note: these can reset the according pulse_width */ | ||
113 | #define LIRC_SET_SEND_CARRIER _IOW('i', 0x00000013, __u32) | ||
114 | #define LIRC_SET_REC_CARRIER _IOW('i', 0x00000014, __u32) | ||
115 | #define LIRC_SET_SEND_DUTY_CYCLE _IOW('i', 0x00000015, __u32) | ||
116 | #define LIRC_SET_REC_DUTY_CYCLE _IOW('i', 0x00000016, __u32) | ||
117 | #define LIRC_SET_TRANSMITTER_MASK _IOW('i', 0x00000017, __u32) | ||
118 | |||
119 | /* | ||
120 | * when a timeout != 0 is set the driver will send a | ||
121 | * LIRC_MODE2_TIMEOUT data packet, otherwise LIRC_MODE2_TIMEOUT is | ||
122 | * never sent, timeout is disabled by default | ||
123 | */ | ||
124 | #define LIRC_SET_REC_TIMEOUT _IOW('i', 0x00000018, __u32) | ||
125 | |||
126 | /* 1 enables, 0 disables timeout reports in MODE2 */ | ||
127 | #define LIRC_SET_REC_TIMEOUT_REPORTS _IOW('i', 0x00000019, __u32) | ||
128 | |||
129 | /* | ||
130 | * pulses shorter than this are filtered out by hardware (software | ||
131 | * emulation in lirc_dev?) | ||
132 | */ | ||
133 | #define LIRC_SET_REC_FILTER_PULSE _IOW('i', 0x0000001a, __u32) | ||
134 | /* | ||
135 | * spaces shorter than this are filtered out by hardware (software | ||
136 | * emulation in lirc_dev?) | ||
137 | */ | ||
138 | #define LIRC_SET_REC_FILTER_SPACE _IOW('i', 0x0000001b, __u32) | ||
139 | /* | ||
140 | * if filter cannot be set independantly for pulse/space, this should | ||
141 | * be used | ||
142 | */ | ||
143 | #define LIRC_SET_REC_FILTER _IOW('i', 0x0000001c, __u32) | ||
144 | |||
145 | /* | ||
146 | * if enabled from the next key press on the driver will send | ||
147 | * LIRC_MODE2_FREQUENCY packets | ||
148 | */ | ||
149 | #define LIRC_SET_MEASURE_CARRIER_MODE _IOW('i', 0x0000001d, __u32) | ||
150 | |||
151 | /* | ||
152 | * to set a range use | ||
153 | * LIRC_SET_REC_DUTY_CYCLE_RANGE/LIRC_SET_REC_CARRIER_RANGE with the | ||
154 | * lower bound first and later | ||
155 | * LIRC_SET_REC_DUTY_CYCLE/LIRC_SET_REC_CARRIER with the upper bound | ||
156 | */ | ||
157 | |||
158 | #define LIRC_SET_REC_DUTY_CYCLE_RANGE _IOW('i', 0x0000001e, __u32) | ||
159 | #define LIRC_SET_REC_CARRIER_RANGE _IOW('i', 0x0000001f, __u32) | ||
160 | |||
161 | #define LIRC_NOTIFY_DECODE _IO('i', 0x00000020) | ||
162 | |||
163 | #define LIRC_SETUP_START _IO('i', 0x00000021) | ||
164 | #define LIRC_SETUP_END _IO('i', 0x00000022) | ||
165 | |||
166 | #define LIRC_SET_WIDEBAND_RECEIVER _IOW('i', 0x00000023, __u32) | ||
167 | |||
168 | #endif | ||
diff --git a/include/media/lirc_dev.h b/include/media/lirc_dev.h new file mode 100644 index 000000000000..b1f60663cb39 --- /dev/null +++ b/include/media/lirc_dev.h | |||
@@ -0,0 +1,225 @@ | |||
1 | /* | ||
2 | * LIRC base driver | ||
3 | * | ||
4 | * by Artur Lipowski <alipowski@interia.pl> | ||
5 | * This code is licensed under GNU GPL | ||
6 | * | ||
7 | */ | ||
8 | |||
9 | #ifndef _LINUX_LIRC_DEV_H | ||
10 | #define _LINUX_LIRC_DEV_H | ||
11 | |||
12 | #define MAX_IRCTL_DEVICES 4 | ||
13 | #define BUFLEN 16 | ||
14 | |||
15 | #define mod(n, div) ((n) % (div)) | ||
16 | |||
17 | #include <linux/slab.h> | ||
18 | #include <linux/fs.h> | ||
19 | #include <linux/ioctl.h> | ||
20 | #include <linux/poll.h> | ||
21 | #include <linux/kfifo.h> | ||
22 | #include <media/lirc.h> | ||
23 | |||
24 | struct lirc_buffer { | ||
25 | wait_queue_head_t wait_poll; | ||
26 | spinlock_t fifo_lock; | ||
27 | unsigned int chunk_size; | ||
28 | unsigned int size; /* in chunks */ | ||
29 | /* Using chunks instead of bytes pretends to simplify boundary checking | ||
30 | * And should allow for some performance fine tunning later */ | ||
31 | struct kfifo fifo; | ||
32 | u8 fifo_initialized; | ||
33 | }; | ||
34 | |||
35 | static inline void lirc_buffer_clear(struct lirc_buffer *buf) | ||
36 | { | ||
37 | unsigned long flags; | ||
38 | |||
39 | if (buf->fifo_initialized) { | ||
40 | spin_lock_irqsave(&buf->fifo_lock, flags); | ||
41 | kfifo_reset(&buf->fifo); | ||
42 | spin_unlock_irqrestore(&buf->fifo_lock, flags); | ||
43 | } else | ||
44 | WARN(1, "calling %s on an uninitialized lirc_buffer\n", | ||
45 | __func__); | ||
46 | } | ||
47 | |||
48 | static inline int lirc_buffer_init(struct lirc_buffer *buf, | ||
49 | unsigned int chunk_size, | ||
50 | unsigned int size) | ||
51 | { | ||
52 | int ret; | ||
53 | |||
54 | init_waitqueue_head(&buf->wait_poll); | ||
55 | spin_lock_init(&buf->fifo_lock); | ||
56 | buf->chunk_size = chunk_size; | ||
57 | buf->size = size; | ||
58 | ret = kfifo_alloc(&buf->fifo, size * chunk_size, GFP_KERNEL); | ||
59 | if (ret == 0) | ||
60 | buf->fifo_initialized = 1; | ||
61 | |||
62 | return ret; | ||
63 | } | ||
64 | |||
65 | static inline void lirc_buffer_free(struct lirc_buffer *buf) | ||
66 | { | ||
67 | if (buf->fifo_initialized) { | ||
68 | kfifo_free(&buf->fifo); | ||
69 | buf->fifo_initialized = 0; | ||
70 | } else | ||
71 | WARN(1, "calling %s on an uninitialized lirc_buffer\n", | ||
72 | __func__); | ||
73 | } | ||
74 | |||
75 | static inline int lirc_buffer_len(struct lirc_buffer *buf) | ||
76 | { | ||
77 | int len; | ||
78 | unsigned long flags; | ||
79 | |||
80 | spin_lock_irqsave(&buf->fifo_lock, flags); | ||
81 | len = kfifo_len(&buf->fifo); | ||
82 | spin_unlock_irqrestore(&buf->fifo_lock, flags); | ||
83 | |||
84 | return len; | ||
85 | } | ||
86 | |||
87 | static inline int lirc_buffer_full(struct lirc_buffer *buf) | ||
88 | { | ||
89 | return lirc_buffer_len(buf) == buf->size * buf->chunk_size; | ||
90 | } | ||
91 | |||
92 | static inline int lirc_buffer_empty(struct lirc_buffer *buf) | ||
93 | { | ||
94 | return !lirc_buffer_len(buf); | ||
95 | } | ||
96 | |||
97 | static inline int lirc_buffer_available(struct lirc_buffer *buf) | ||
98 | { | ||
99 | return buf->size - (lirc_buffer_len(buf) / buf->chunk_size); | ||
100 | } | ||
101 | |||
102 | static inline unsigned int lirc_buffer_read(struct lirc_buffer *buf, | ||
103 | unsigned char *dest) | ||
104 | { | ||
105 | unsigned int ret = 0; | ||
106 | |||
107 | if (lirc_buffer_len(buf) >= buf->chunk_size) | ||
108 | ret = kfifo_out_locked(&buf->fifo, dest, buf->chunk_size, | ||
109 | &buf->fifo_lock); | ||
110 | return ret; | ||
111 | |||
112 | } | ||
113 | |||
114 | static inline unsigned int lirc_buffer_write(struct lirc_buffer *buf, | ||
115 | unsigned char *orig) | ||
116 | { | ||
117 | unsigned int ret; | ||
118 | |||
119 | ret = kfifo_in_locked(&buf->fifo, orig, buf->chunk_size, | ||
120 | &buf->fifo_lock); | ||
121 | |||
122 | return ret; | ||
123 | } | ||
124 | |||
125 | struct lirc_driver { | ||
126 | char name[40]; | ||
127 | int minor; | ||
128 | unsigned long code_length; | ||
129 | unsigned int buffer_size; /* in chunks holding one code each */ | ||
130 | int sample_rate; | ||
131 | unsigned long features; | ||
132 | |||
133 | unsigned int chunk_size; | ||
134 | |||
135 | void *data; | ||
136 | int min_timeout; | ||
137 | int max_timeout; | ||
138 | int (*add_to_buf) (void *data, struct lirc_buffer *buf); | ||
139 | struct lirc_buffer *rbuf; | ||
140 | int (*set_use_inc) (void *data); | ||
141 | void (*set_use_dec) (void *data); | ||
142 | struct file_operations *fops; | ||
143 | struct device *dev; | ||
144 | struct module *owner; | ||
145 | }; | ||
146 | |||
147 | /* name: | ||
148 | * this string will be used for logs | ||
149 | * | ||
150 | * minor: | ||
151 | * indicates minor device (/dev/lirc) number for registered driver | ||
152 | * if caller fills it with negative value, then the first free minor | ||
153 | * number will be used (if available) | ||
154 | * | ||
155 | * code_length: | ||
156 | * length of the remote control key code expressed in bits | ||
157 | * | ||
158 | * sample_rate: | ||
159 | * | ||
160 | * data: | ||
161 | * it may point to any driver data and this pointer will be passed to | ||
162 | * all callback functions | ||
163 | * | ||
164 | * add_to_buf: | ||
165 | * add_to_buf will be called after specified period of the time or | ||
166 | * triggered by the external event, this behavior depends on value of | ||
167 | * the sample_rate this function will be called in user context. This | ||
168 | * routine should return 0 if data was added to the buffer and | ||
169 | * -ENODATA if none was available. This should add some number of bits | ||
170 | * evenly divisible by code_length to the buffer | ||
171 | * | ||
172 | * rbuf: | ||
173 | * if not NULL, it will be used as a read buffer, you will have to | ||
174 | * write to the buffer by other means, like irq's (see also | ||
175 | * lirc_serial.c). | ||
176 | * | ||
177 | * set_use_inc: | ||
178 | * set_use_inc will be called after device is opened | ||
179 | * | ||
180 | * set_use_dec: | ||
181 | * set_use_dec will be called after device is closed | ||
182 | * | ||
183 | * fops: | ||
184 | * file_operations for drivers which don't fit the current driver model. | ||
185 | * | ||
186 | * Some ioctl's can be directly handled by lirc_dev if the driver's | ||
187 | * ioctl function is NULL or if it returns -ENOIOCTLCMD (see also | ||
188 | * lirc_serial.c). | ||
189 | * | ||
190 | * owner: | ||
191 | * the module owning this struct | ||
192 | * | ||
193 | */ | ||
194 | |||
195 | |||
196 | /* following functions can be called ONLY from user context | ||
197 | * | ||
198 | * returns negative value on error or minor number | ||
199 | * of the registered device if success | ||
200 | * contents of the structure pointed by p is copied | ||
201 | */ | ||
202 | extern int lirc_register_driver(struct lirc_driver *d); | ||
203 | |||
204 | /* returns negative value on error or 0 if success | ||
205 | */ | ||
206 | extern int lirc_unregister_driver(int minor); | ||
207 | |||
208 | /* Returns the private data stored in the lirc_driver | ||
209 | * associated with the given device file pointer. | ||
210 | */ | ||
211 | void *lirc_get_pdata(struct file *file); | ||
212 | |||
213 | /* default file operations | ||
214 | * used by drivers if they override only some operations | ||
215 | */ | ||
216 | int lirc_dev_fop_open(struct inode *inode, struct file *file); | ||
217 | int lirc_dev_fop_close(struct inode *inode, struct file *file); | ||
218 | unsigned int lirc_dev_fop_poll(struct file *file, poll_table *wait); | ||
219 | long lirc_dev_fop_ioctl(struct file *file, unsigned int cmd, unsigned long arg); | ||
220 | ssize_t lirc_dev_fop_read(struct file *file, char *buffer, size_t length, | ||
221 | loff_t *ppos); | ||
222 | ssize_t lirc_dev_fop_write(struct file *file, const char *buffer, size_t length, | ||
223 | loff_t *ppos); | ||
224 | |||
225 | #endif | ||
diff --git a/include/media/rc-map.h b/include/media/rc-map.h index c78e99a435b6..a9c041d49662 100644 --- a/include/media/rc-map.h +++ b/include/media/rc-map.h | |||
@@ -17,8 +17,13 @@ | |||
17 | #define IR_TYPE_RC6 (1 << 2) /* Philips RC6 protocol */ | 17 | #define IR_TYPE_RC6 (1 << 2) /* Philips RC6 protocol */ |
18 | #define IR_TYPE_JVC (1 << 3) /* JVC protocol */ | 18 | #define IR_TYPE_JVC (1 << 3) /* JVC protocol */ |
19 | #define IR_TYPE_SONY (1 << 4) /* Sony12/15/20 protocol */ | 19 | #define IR_TYPE_SONY (1 << 4) /* Sony12/15/20 protocol */ |
20 | #define IR_TYPE_LIRC (1 << 30) /* Pass raw IR to lirc userspace */ | ||
20 | #define IR_TYPE_OTHER (1u << 31) | 21 | #define IR_TYPE_OTHER (1u << 31) |
21 | 22 | ||
23 | #define IR_TYPE_ALL (IR_TYPE_RC5 | IR_TYPE_NEC | IR_TYPE_RC6 | \ | ||
24 | IR_TYPE_JVC | IR_TYPE_SONY | IR_TYPE_LIRC | \ | ||
25 | IR_TYPE_OTHER) | ||
26 | |||
22 | struct ir_scancode { | 27 | struct ir_scancode { |
23 | u32 scancode; | 28 | u32 scancode; |
24 | u32 keycode; | 29 | u32 keycode; |
@@ -64,6 +69,8 @@ void rc_map_init(void); | |||
64 | #define RC_MAP_BUDGET_CI_OLD "rc-budget-ci-old" | 69 | #define RC_MAP_BUDGET_CI_OLD "rc-budget-ci-old" |
65 | #define RC_MAP_CINERGY_1400 "rc-cinergy-1400" | 70 | #define RC_MAP_CINERGY_1400 "rc-cinergy-1400" |
66 | #define RC_MAP_CINERGY "rc-cinergy" | 71 | #define RC_MAP_CINERGY "rc-cinergy" |
72 | #define RC_MAP_DIB0700_NEC_TABLE "rc-dib0700-nec" | ||
73 | #define RC_MAP_DIB0700_RC5_TABLE "rc-dib0700-rc5" | ||
67 | #define RC_MAP_DM1105_NEC "rc-dm1105-nec" | 74 | #define RC_MAP_DM1105_NEC "rc-dm1105-nec" |
68 | #define RC_MAP_DNTV_LIVE_DVBT_PRO "rc-dntv-live-dvbt-pro" | 75 | #define RC_MAP_DNTV_LIVE_DVBT_PRO "rc-dntv-live-dvbt-pro" |
69 | #define RC_MAP_DNTV_LIVE_DVB_T "rc-dntv-live-dvb-t" | 76 | #define RC_MAP_DNTV_LIVE_DVB_T "rc-dntv-live-dvb-t" |
@@ -87,6 +94,7 @@ void rc_map_init(void); | |||
87 | #define RC_MAP_KAIOMY "rc-kaiomy" | 94 | #define RC_MAP_KAIOMY "rc-kaiomy" |
88 | #define RC_MAP_KWORLD_315U "rc-kworld-315u" | 95 | #define RC_MAP_KWORLD_315U "rc-kworld-315u" |
89 | #define RC_MAP_KWORLD_PLUS_TV_ANALOG "rc-kworld-plus-tv-analog" | 96 | #define RC_MAP_KWORLD_PLUS_TV_ANALOG "rc-kworld-plus-tv-analog" |
97 | #define RC_MAP_LIRC "rc-lirc" | ||
90 | #define RC_MAP_MANLI "rc-manli" | 98 | #define RC_MAP_MANLI "rc-manli" |
91 | #define RC_MAP_MSI_TVANYWHERE_PLUS "rc-msi-tvanywhere-plus" | 99 | #define RC_MAP_MSI_TVANYWHERE_PLUS "rc-msi-tvanywhere-plus" |
92 | #define RC_MAP_MSI_TVANYWHERE "rc-msi-tvanywhere" | 100 | #define RC_MAP_MSI_TVANYWHERE "rc-msi-tvanywhere" |
@@ -106,7 +114,9 @@ void rc_map_init(void); | |||
106 | #define RC_MAP_PURPLETV "rc-purpletv" | 114 | #define RC_MAP_PURPLETV "rc-purpletv" |
107 | #define RC_MAP_PV951 "rc-pv951" | 115 | #define RC_MAP_PV951 "rc-pv951" |
108 | #define RC_MAP_RC5_HAUPPAUGE_NEW "rc-rc5-hauppauge-new" | 116 | #define RC_MAP_RC5_HAUPPAUGE_NEW "rc-rc5-hauppauge-new" |
117 | #define RC_MAP_RC5_STREAMZAP "rc-rc5-streamzap" | ||
109 | #define RC_MAP_RC5_TV "rc-rc5-tv" | 118 | #define RC_MAP_RC5_TV "rc-rc5-tv" |
119 | #define RC_MAP_RC6_MCE "rc-rc6-mce" | ||
110 | #define RC_MAP_REAL_AUDIO_220_32_KEYS "rc-real-audio-220-32-keys" | 120 | #define RC_MAP_REAL_AUDIO_220_32_KEYS "rc-real-audio-220-32-keys" |
111 | #define RC_MAP_TBS_NEC "rc-tbs-nec" | 121 | #define RC_MAP_TBS_NEC "rc-tbs-nec" |
112 | #define RC_MAP_TERRATEC_CINERGY_XS "rc-terratec-cinergy-xs" | 122 | #define RC_MAP_TERRATEC_CINERGY_XS "rc-terratec-cinergy-xs" |
@@ -116,6 +126,7 @@ void rc_map_init(void); | |||
116 | #define RC_MAP_VIDEOMATE_TV_PVR "rc-videomate-tv-pvr" | 126 | #define RC_MAP_VIDEOMATE_TV_PVR "rc-videomate-tv-pvr" |
117 | #define RC_MAP_WINFAST "rc-winfast" | 127 | #define RC_MAP_WINFAST "rc-winfast" |
118 | #define RC_MAP_WINFAST_USBII_DELUXE "rc-winfast-usbii-deluxe" | 128 | #define RC_MAP_WINFAST_USBII_DELUXE "rc-winfast-usbii-deluxe" |
129 | |||
119 | /* | 130 | /* |
120 | * Please, do not just append newer Remote Controller names at the end. | 131 | * Please, do not just append newer Remote Controller names at the end. |
121 | * The names should be ordered in alphabetical order | 132 | * The names should be ordered in alphabetical order |
diff --git a/include/media/sh_mobile_ceu.h b/include/media/sh_mobile_ceu.h index b67747836878..80346a6d28a9 100644 --- a/include/media/sh_mobile_ceu.h +++ b/include/media/sh_mobile_ceu.h | |||
@@ -6,8 +6,11 @@ | |||
6 | #define SH_CEU_FLAG_HSYNC_LOW (1 << 2) /* default High if possible */ | 6 | #define SH_CEU_FLAG_HSYNC_LOW (1 << 2) /* default High if possible */ |
7 | #define SH_CEU_FLAG_VSYNC_LOW (1 << 3) /* default High if possible */ | 7 | #define SH_CEU_FLAG_VSYNC_LOW (1 << 3) /* default High if possible */ |
8 | 8 | ||
9 | struct device; | ||
10 | |||
9 | struct sh_mobile_ceu_info { | 11 | struct sh_mobile_ceu_info { |
10 | unsigned long flags; | 12 | unsigned long flags; |
13 | struct device *csi2_dev; | ||
11 | }; | 14 | }; |
12 | 15 | ||
13 | #endif /* __ASM_SH_MOBILE_CEU_H__ */ | 16 | #endif /* __ASM_SH_MOBILE_CEU_H__ */ |
diff --git a/include/media/sh_mobile_csi2.h b/include/media/sh_mobile_csi2.h new file mode 100644 index 000000000000..4d2615174461 --- /dev/null +++ b/include/media/sh_mobile_csi2.h | |||
@@ -0,0 +1,46 @@ | |||
1 | /* | ||
2 | * Driver header for the SH-Mobile MIPI CSI-2 unit | ||
3 | * | ||
4 | * Copyright (C) 2010, Guennadi Liakhovetski <g.liakhovetski@gmx.de> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | */ | ||
10 | |||
11 | #ifndef SH_MIPI_CSI | ||
12 | #define SH_MIPI_CSI | ||
13 | |||
14 | enum sh_csi2_phy { | ||
15 | SH_CSI2_PHY_MAIN, | ||
16 | SH_CSI2_PHY_SUB, | ||
17 | }; | ||
18 | |||
19 | enum sh_csi2_type { | ||
20 | SH_CSI2C, | ||
21 | SH_CSI2I, | ||
22 | }; | ||
23 | |||
24 | #define SH_CSI2_CRC (1 << 0) | ||
25 | #define SH_CSI2_ECC (1 << 1) | ||
26 | |||
27 | struct platform_device; | ||
28 | |||
29 | struct sh_csi2_client_config { | ||
30 | enum sh_csi2_phy phy; | ||
31 | unsigned char lanes; /* bitmask[3:0] */ | ||
32 | unsigned char channel; /* 0..3 */ | ||
33 | struct platform_device *pdev; /* client platform device */ | ||
34 | }; | ||
35 | |||
36 | struct sh_csi2_pdata { | ||
37 | enum sh_csi2_type type; | ||
38 | unsigned int flags; | ||
39 | struct sh_csi2_client_config *clients; | ||
40 | int num_clients; | ||
41 | }; | ||
42 | |||
43 | struct device; | ||
44 | struct v4l2_device; | ||
45 | |||
46 | #endif | ||
diff --git a/include/media/soc_camera.h b/include/media/soc_camera.h index b8289c2f609b..2ce957301f77 100644 --- a/include/media/soc_camera.h +++ b/include/media/soc_camera.h | |||
@@ -12,12 +12,15 @@ | |||
12 | #ifndef SOC_CAMERA_H | 12 | #ifndef SOC_CAMERA_H |
13 | #define SOC_CAMERA_H | 13 | #define SOC_CAMERA_H |
14 | 14 | ||
15 | #include <linux/device.h> | ||
15 | #include <linux/mutex.h> | 16 | #include <linux/mutex.h> |
16 | #include <linux/pm.h> | 17 | #include <linux/pm.h> |
17 | #include <linux/videodev2.h> | 18 | #include <linux/videodev2.h> |
18 | #include <media/videobuf-core.h> | 19 | #include <media/videobuf-core.h> |
19 | #include <media/v4l2-device.h> | 20 | #include <media/v4l2-device.h> |
20 | 21 | ||
22 | extern struct bus_type soc_camera_bus_type; | ||
23 | |||
21 | struct soc_camera_device { | 24 | struct soc_camera_device { |
22 | struct list_head list; | 25 | struct list_head list; |
23 | struct device dev; | 26 | struct device dev; |
diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h new file mode 100644 index 000000000000..9b7bea928a88 --- /dev/null +++ b/include/media/v4l2-ctrls.h | |||
@@ -0,0 +1,460 @@ | |||
1 | /* | ||
2 | V4L2 controls support header. | ||
3 | |||
4 | Copyright (C) 2010 Hans Verkuil <hverkuil@xs4all.nl> | ||
5 | |||
6 | This program is free software; you can redistribute it and/or modify | ||
7 | it under the terms of the GNU General Public License as published by | ||
8 | the Free Software Foundation; either version 2 of the License, or | ||
9 | (at your option) any later version. | ||
10 | |||
11 | This program is distributed in the hope that it will be useful, | ||
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | GNU General Public License for more details. | ||
15 | |||
16 | You should have received a copy of the GNU General Public License | ||
17 | along with this program; if not, write to the Free Software | ||
18 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
19 | */ | ||
20 | |||
21 | #ifndef _V4L2_CTRLS_H | ||
22 | #define _V4L2_CTRLS_H | ||
23 | |||
24 | #include <linux/list.h> | ||
25 | #include <linux/device.h> | ||
26 | |||
27 | /* forward references */ | ||
28 | struct v4l2_ctrl_handler; | ||
29 | struct v4l2_ctrl; | ||
30 | struct video_device; | ||
31 | struct v4l2_subdev; | ||
32 | |||
33 | /** struct v4l2_ctrl_ops - The control operations that the driver has to provide. | ||
34 | * @g_volatile_ctrl: Get a new value for this control. Generally only relevant | ||
35 | * for volatile (and usually read-only) controls such as a control | ||
36 | * that returns the current signal strength which changes | ||
37 | * continuously. | ||
38 | * If not set, then the currently cached value will be returned. | ||
39 | * @try_ctrl: Test whether the control's value is valid. Only relevant when | ||
40 | * the usual min/max/step checks are not sufficient. | ||
41 | * @s_ctrl: Actually set the new control value. s_ctrl is compulsory. The | ||
42 | * ctrl->handler->lock is held when these ops are called, so no | ||
43 | * one else can access controls owned by that handler. | ||
44 | */ | ||
45 | struct v4l2_ctrl_ops { | ||
46 | int (*g_volatile_ctrl)(struct v4l2_ctrl *ctrl); | ||
47 | int (*try_ctrl)(struct v4l2_ctrl *ctrl); | ||
48 | int (*s_ctrl)(struct v4l2_ctrl *ctrl); | ||
49 | }; | ||
50 | |||
51 | /** struct v4l2_ctrl - The control structure. | ||
52 | * @node: The list node. | ||
53 | * @handler: The handler that owns the control. | ||
54 | * @cluster: Point to start of cluster array. | ||
55 | * @ncontrols: Number of controls in cluster array. | ||
56 | * @has_new: Internal flag: set when there is a valid new value. | ||
57 | * @done: Internal flag: set for each processed control. | ||
58 | * @is_private: If set, then this control is private to its handler and it | ||
59 | * will not be added to any other handlers. Drivers can set | ||
60 | * this flag. | ||
61 | * @is_volatile: If set, then this control is volatile. This means that the | ||
62 | * control's current value cannot be cached and needs to be | ||
63 | * retrieved through the g_volatile_ctrl op. Drivers can set | ||
64 | * this flag. | ||
65 | * @ops: The control ops. | ||
66 | * @id: The control ID. | ||
67 | * @name: The control name. | ||
68 | * @type: The control type. | ||
69 | * @minimum: The control's minimum value. | ||
70 | * @maximum: The control's maximum value. | ||
71 | * @default_value: The control's default value. | ||
72 | * @step: The control's step value for non-menu controls. | ||
73 | * @menu_skip_mask: The control's skip mask for menu controls. This makes it | ||
74 | * easy to skip menu items that are not valid. If bit X is set, | ||
75 | * then menu item X is skipped. Of course, this only works for | ||
76 | * menus with <= 32 menu items. There are no menus that come | ||
77 | * close to that number, so this is OK. Should we ever need more, | ||
78 | * then this will have to be extended to a u64 or a bit array. | ||
79 | * @qmenu: A const char * array for all menu items. Array entries that are | ||
80 | * empty strings ("") correspond to non-existing menu items (this | ||
81 | * is in addition to the menu_skip_mask above). The last entry | ||
82 | * must be NULL. | ||
83 | * @flags: The control's flags. | ||
84 | * @cur: The control's current value. | ||
85 | * @val: The control's new s32 value. | ||
86 | * @val64: The control's new s64 value. | ||
87 | * @string: The control's new string value. | ||
88 | * @priv: The control's private pointer. For use by the driver. It is | ||
89 | * untouched by the control framework. Note that this pointer is | ||
90 | * not freed when the control is deleted. Should this be needed | ||
91 | * then a new internal bitfield can be added to tell the framework | ||
92 | * to free this pointer. | ||
93 | */ | ||
94 | struct v4l2_ctrl { | ||
95 | /* Administrative fields */ | ||
96 | struct list_head node; | ||
97 | struct v4l2_ctrl_handler *handler; | ||
98 | struct v4l2_ctrl **cluster; | ||
99 | unsigned ncontrols; | ||
100 | unsigned int has_new:1; | ||
101 | unsigned int done:1; | ||
102 | |||
103 | unsigned int is_private:1; | ||
104 | unsigned int is_volatile:1; | ||
105 | |||
106 | const struct v4l2_ctrl_ops *ops; | ||
107 | u32 id; | ||
108 | const char *name; | ||
109 | enum v4l2_ctrl_type type; | ||
110 | s32 minimum, maximum, default_value; | ||
111 | union { | ||
112 | u32 step; | ||
113 | u32 menu_skip_mask; | ||
114 | }; | ||
115 | const char **qmenu; | ||
116 | unsigned long flags; | ||
117 | union { | ||
118 | s32 val; | ||
119 | s64 val64; | ||
120 | char *string; | ||
121 | } cur; | ||
122 | union { | ||
123 | s32 val; | ||
124 | s64 val64; | ||
125 | char *string; | ||
126 | }; | ||
127 | void *priv; | ||
128 | }; | ||
129 | |||
130 | /** struct v4l2_ctrl_ref - The control reference. | ||
131 | * @node: List node for the sorted list. | ||
132 | * @next: Single-link list node for the hash. | ||
133 | * @ctrl: The actual control information. | ||
134 | * | ||
135 | * Each control handler has a list of these refs. The list_head is used to | ||
136 | * keep a sorted-by-control-ID list of all controls, while the next pointer | ||
137 | * is used to link the control in the hash's bucket. | ||
138 | */ | ||
139 | struct v4l2_ctrl_ref { | ||
140 | struct list_head node; | ||
141 | struct v4l2_ctrl_ref *next; | ||
142 | struct v4l2_ctrl *ctrl; | ||
143 | }; | ||
144 | |||
145 | /** struct v4l2_ctrl_handler - The control handler keeps track of all the | ||
146 | * controls: both the controls owned by the handler and those inherited | ||
147 | * from other handlers. | ||
148 | * @lock: Lock to control access to this handler and its controls. | ||
149 | * @ctrls: The list of controls owned by this handler. | ||
150 | * @ctrl_refs: The list of control references. | ||
151 | * @cached: The last found control reference. It is common that the same | ||
152 | * control is needed multiple times, so this is a simple | ||
153 | * optimization. | ||
154 | * @buckets: Buckets for the hashing. Allows for quick control lookup. | ||
155 | * @nr_of_buckets: Total number of buckets in the array. | ||
156 | * @error: The error code of the first failed control addition. | ||
157 | */ | ||
158 | struct v4l2_ctrl_handler { | ||
159 | struct mutex lock; | ||
160 | struct list_head ctrls; | ||
161 | struct list_head ctrl_refs; | ||
162 | struct v4l2_ctrl_ref *cached; | ||
163 | struct v4l2_ctrl_ref **buckets; | ||
164 | u16 nr_of_buckets; | ||
165 | int error; | ||
166 | }; | ||
167 | |||
168 | /** struct v4l2_ctrl_config - Control configuration structure. | ||
169 | * @ops: The control ops. | ||
170 | * @id: The control ID. | ||
171 | * @name: The control name. | ||
172 | * @type: The control type. | ||
173 | * @min: The control's minimum value. | ||
174 | * @max: The control's maximum value. | ||
175 | * @step: The control's step value for non-menu controls. | ||
176 | * @def: The control's default value. | ||
177 | * @flags: The control's flags. | ||
178 | * @menu_skip_mask: The control's skip mask for menu controls. This makes it | ||
179 | * easy to skip menu items that are not valid. If bit X is set, | ||
180 | * then menu item X is skipped. Of course, this only works for | ||
181 | * menus with <= 32 menu items. There are no menus that come | ||
182 | * close to that number, so this is OK. Should we ever need more, | ||
183 | * then this will have to be extended to a u64 or a bit array. | ||
184 | * @qmenu: A const char * array for all menu items. Array entries that are | ||
185 | * empty strings ("") correspond to non-existing menu items (this | ||
186 | * is in addition to the menu_skip_mask above). The last entry | ||
187 | * must be NULL. | ||
188 | * @is_private: If set, then this control is private to its handler and it | ||
189 | * will not be added to any other handlers. | ||
190 | * @is_volatile: If set, then this control is volatile. This means that the | ||
191 | * control's current value cannot be cached and needs to be | ||
192 | * retrieved through the g_volatile_ctrl op. | ||
193 | */ | ||
194 | struct v4l2_ctrl_config { | ||
195 | const struct v4l2_ctrl_ops *ops; | ||
196 | u32 id; | ||
197 | const char *name; | ||
198 | enum v4l2_ctrl_type type; | ||
199 | s32 min; | ||
200 | s32 max; | ||
201 | u32 step; | ||
202 | s32 def; | ||
203 | u32 flags; | ||
204 | u32 menu_skip_mask; | ||
205 | const char **qmenu; | ||
206 | unsigned int is_private:1; | ||
207 | unsigned int is_volatile:1; | ||
208 | }; | ||
209 | |||
210 | /** v4l2_ctrl_fill() - Fill in the control fields based on the control ID. | ||
211 | * | ||
212 | * This works for all standard V4L2 controls. | ||
213 | * For non-standard controls it will only fill in the given arguments | ||
214 | * and @name will be NULL. | ||
215 | * | ||
216 | * This function will overwrite the contents of @name, @type and @flags. | ||
217 | * The contents of @min, @max, @step and @def may be modified depending on | ||
218 | * the type. | ||
219 | * | ||
220 | * Do not use in drivers! It is used internally for backwards compatibility | ||
221 | * control handling only. Once all drivers are converted to use the new | ||
222 | * control framework this function will no longer be exported. | ||
223 | */ | ||
224 | void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type, | ||
225 | s32 *min, s32 *max, s32 *step, s32 *def, u32 *flags); | ||
226 | |||
227 | |||
228 | /** v4l2_ctrl_handler_init() - Initialize the control handler. | ||
229 | * @hdl: The control handler. | ||
230 | * @nr_of_controls_hint: A hint of how many controls this handler is | ||
231 | * expected to refer to. This is the total number, so including | ||
232 | * any inherited controls. It doesn't have to be precise, but if | ||
233 | * it is way off, then you either waste memory (too many buckets | ||
234 | * are allocated) or the control lookup becomes slower (not enough | ||
235 | * buckets are allocated, so there are more slow list lookups). | ||
236 | * It will always work, though. | ||
237 | * | ||
238 | * Returns an error if the buckets could not be allocated. This error will | ||
239 | * also be stored in @hdl->error. | ||
240 | */ | ||
241 | int v4l2_ctrl_handler_init(struct v4l2_ctrl_handler *hdl, | ||
242 | unsigned nr_of_controls_hint); | ||
243 | |||
244 | /** v4l2_ctrl_handler_free() - Free all controls owned by the handler and free | ||
245 | * the control list. | ||
246 | * @hdl: The control handler. | ||
247 | * | ||
248 | * Does nothing if @hdl == NULL. | ||
249 | */ | ||
250 | void v4l2_ctrl_handler_free(struct v4l2_ctrl_handler *hdl); | ||
251 | |||
252 | /** v4l2_ctrl_handler_setup() - Call the s_ctrl op for all controls belonging | ||
253 | * to the handler to initialize the hardware to the current control values. | ||
254 | * @hdl: The control handler. | ||
255 | * | ||
256 | * Button controls will be skipped, as are read-only controls. | ||
257 | * | ||
258 | * If @hdl == NULL, then this just returns 0. | ||
259 | */ | ||
260 | int v4l2_ctrl_handler_setup(struct v4l2_ctrl_handler *hdl); | ||
261 | |||
262 | /** v4l2_ctrl_handler_log_status() - Log all controls owned by the handler. | ||
263 | * @hdl: The control handler. | ||
264 | * @prefix: The prefix to use when logging the control values. If the | ||
265 | * prefix does not end with a space, then ": " will be added | ||
266 | * after the prefix. If @prefix == NULL, then no prefix will be | ||
267 | * used. | ||
268 | * | ||
269 | * For use with VIDIOC_LOG_STATUS. | ||
270 | * | ||
271 | * Does nothing if @hdl == NULL. | ||
272 | */ | ||
273 | void v4l2_ctrl_handler_log_status(struct v4l2_ctrl_handler *hdl, | ||
274 | const char *prefix); | ||
275 | |||
276 | /** v4l2_ctrl_new_custom() - Allocate and initialize a new custom V4L2 | ||
277 | * control. | ||
278 | * @hdl: The control handler. | ||
279 | * @cfg: The control's configuration data. | ||
280 | * @priv: The control's driver-specific private data. | ||
281 | * | ||
282 | * If the &v4l2_ctrl struct could not be allocated then NULL is returned | ||
283 | * and @hdl->error is set to the error code (if it wasn't set already). | ||
284 | */ | ||
285 | struct v4l2_ctrl *v4l2_ctrl_new_custom(struct v4l2_ctrl_handler *hdl, | ||
286 | const struct v4l2_ctrl_config *cfg, void *priv); | ||
287 | |||
288 | /** v4l2_ctrl_new_std() - Allocate and initialize a new standard V4L2 non-menu control. | ||
289 | * @hdl: The control handler. | ||
290 | * @ops: The control ops. | ||
291 | * @id: The control ID. | ||
292 | * @min: The control's minimum value. | ||
293 | * @max: The control's maximum value. | ||
294 | * @step: The control's step value | ||
295 | * @def: The control's default value. | ||
296 | * | ||
297 | * If the &v4l2_ctrl struct could not be allocated, or the control | ||
298 | * ID is not known, then NULL is returned and @hdl->error is set to the | ||
299 | * appropriate error code (if it wasn't set already). | ||
300 | * | ||
301 | * If @id refers to a menu control, then this function will return NULL. | ||
302 | * | ||
303 | * Use v4l2_ctrl_new_std_menu() when adding menu controls. | ||
304 | */ | ||
305 | struct v4l2_ctrl *v4l2_ctrl_new_std(struct v4l2_ctrl_handler *hdl, | ||
306 | const struct v4l2_ctrl_ops *ops, | ||
307 | u32 id, s32 min, s32 max, u32 step, s32 def); | ||
308 | |||
309 | /** v4l2_ctrl_new_std_menu() - Allocate and initialize a new standard V4L2 menu control. | ||
310 | * @hdl: The control handler. | ||
311 | * @ops: The control ops. | ||
312 | * @id: The control ID. | ||
313 | * @max: The control's maximum value. | ||
314 | * @mask: The control's skip mask for menu controls. This makes it | ||
315 | * easy to skip menu items that are not valid. If bit X is set, | ||
316 | * then menu item X is skipped. Of course, this only works for | ||
317 | * menus with <= 32 menu items. There are no menus that come | ||
318 | * close to that number, so this is OK. Should we ever need more, | ||
319 | * then this will have to be extended to a u64 or a bit array. | ||
320 | * @def: The control's default value. | ||
321 | * | ||
322 | * Same as v4l2_ctrl_new_std(), but @min is set to 0 and the @mask value | ||
323 | * determines which menu items are to be skipped. | ||
324 | * | ||
325 | * If @id refers to a non-menu control, then this function will return NULL. | ||
326 | */ | ||
327 | struct v4l2_ctrl *v4l2_ctrl_new_std_menu(struct v4l2_ctrl_handler *hdl, | ||
328 | const struct v4l2_ctrl_ops *ops, | ||
329 | u32 id, s32 max, s32 mask, s32 def); | ||
330 | |||
331 | /** v4l2_ctrl_add_ctrl() - Add a control from another handler to this handler. | ||
332 | * @hdl: The control handler. | ||
333 | * @ctrl: The control to add. | ||
334 | * | ||
335 | * It will return NULL if it was unable to add the control reference. | ||
336 | * If the control already belonged to the handler, then it will do | ||
337 | * nothing and just return @ctrl. | ||
338 | */ | ||
339 | struct v4l2_ctrl *v4l2_ctrl_add_ctrl(struct v4l2_ctrl_handler *hdl, | ||
340 | struct v4l2_ctrl *ctrl); | ||
341 | |||
342 | /** v4l2_ctrl_add_handler() - Add all controls from handler @add to | ||
343 | * handler @hdl. | ||
344 | * @hdl: The control handler. | ||
345 | * @add: The control handler whose controls you want to add to | ||
346 | * the @hdl control handler. | ||
347 | * | ||
348 | * Does nothing if either of the two is a NULL pointer. | ||
349 | * In case of an error @hdl->error will be set to the error code (if it | ||
350 | * wasn't set already). | ||
351 | */ | ||
352 | int v4l2_ctrl_add_handler(struct v4l2_ctrl_handler *hdl, | ||
353 | struct v4l2_ctrl_handler *add); | ||
354 | |||
355 | |||
356 | /** v4l2_ctrl_cluster() - Mark all controls in the cluster as belonging to that cluster. | ||
357 | * @ncontrols: The number of controls in this cluster. | ||
358 | * @controls: The cluster control array of size @ncontrols. | ||
359 | */ | ||
360 | void v4l2_ctrl_cluster(unsigned ncontrols, struct v4l2_ctrl **controls); | ||
361 | |||
362 | |||
363 | /** v4l2_ctrl_find() - Find a control with the given ID. | ||
364 | * @hdl: The control handler. | ||
365 | * @id: The control ID to find. | ||
366 | * | ||
367 | * If @hdl == NULL this will return NULL as well. Will lock the handler so | ||
368 | * do not use from inside &v4l2_ctrl_ops. | ||
369 | */ | ||
370 | struct v4l2_ctrl *v4l2_ctrl_find(struct v4l2_ctrl_handler *hdl, u32 id); | ||
371 | |||
372 | /** v4l2_ctrl_activate() - Make the control active or inactive. | ||
373 | * @ctrl: The control to (de)activate. | ||
374 | * @active: True if the control should become active. | ||
375 | * | ||
376 | * This sets or clears the V4L2_CTRL_FLAG_INACTIVE flag atomically. | ||
377 | * Does nothing if @ctrl == NULL. | ||
378 | * This will usually be called from within the s_ctrl op. | ||
379 | * | ||
380 | * This function can be called regardless of whether the control handler | ||
381 | * is locked or not. | ||
382 | */ | ||
383 | void v4l2_ctrl_activate(struct v4l2_ctrl *ctrl, bool active); | ||
384 | |||
385 | /** v4l2_ctrl_grab() - Mark the control as grabbed or not grabbed. | ||
386 | * @ctrl: The control to (de)activate. | ||
387 | * @grabbed: True if the control should become grabbed. | ||
388 | * | ||
389 | * This sets or clears the V4L2_CTRL_FLAG_GRABBED flag atomically. | ||
390 | * Does nothing if @ctrl == NULL. | ||
391 | * This will usually be called when starting or stopping streaming in the | ||
392 | * driver. | ||
393 | * | ||
394 | * This function can be called regardless of whether the control handler | ||
395 | * is locked or not. | ||
396 | */ | ||
397 | void v4l2_ctrl_grab(struct v4l2_ctrl *ctrl, bool grabbed); | ||
398 | |||
399 | /** v4l2_ctrl_lock() - Helper function to lock the handler | ||
400 | * associated with the control. | ||
401 | * @ctrl: The control to lock. | ||
402 | */ | ||
403 | static inline void v4l2_ctrl_lock(struct v4l2_ctrl *ctrl) | ||
404 | { | ||
405 | mutex_lock(&ctrl->handler->lock); | ||
406 | } | ||
407 | |||
408 | /** v4l2_ctrl_lock() - Helper function to unlock the handler | ||
409 | * associated with the control. | ||
410 | * @ctrl: The control to unlock. | ||
411 | */ | ||
412 | static inline void v4l2_ctrl_unlock(struct v4l2_ctrl *ctrl) | ||
413 | { | ||
414 | mutex_unlock(&ctrl->handler->lock); | ||
415 | } | ||
416 | |||
417 | /** v4l2_ctrl_g_ctrl() - Helper function to get the control's value from within a driver. | ||
418 | * @ctrl: The control. | ||
419 | * | ||
420 | * This returns the control's value safely by going through the control | ||
421 | * framework. This function will lock the control's handler, so it cannot be | ||
422 | * used from within the &v4l2_ctrl_ops functions. | ||
423 | * | ||
424 | * This function is for integer type controls only. | ||
425 | */ | ||
426 | s32 v4l2_ctrl_g_ctrl(struct v4l2_ctrl *ctrl); | ||
427 | |||
428 | /** v4l2_ctrl_s_ctrl() - Helper function to set the control's value from within a driver. | ||
429 | * @ctrl: The control. | ||
430 | * @val: The new value. | ||
431 | * | ||
432 | * This set the control's new value safely by going through the control | ||
433 | * framework. This function will lock the control's handler, so it cannot be | ||
434 | * used from within the &v4l2_ctrl_ops functions. | ||
435 | * | ||
436 | * This function is for integer type controls only. | ||
437 | */ | ||
438 | int v4l2_ctrl_s_ctrl(struct v4l2_ctrl *ctrl, s32 val); | ||
439 | |||
440 | |||
441 | /* Helpers for ioctl_ops. If hdl == NULL then they will all return -EINVAL. */ | ||
442 | int v4l2_queryctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_queryctrl *qc); | ||
443 | int v4l2_querymenu(struct v4l2_ctrl_handler *hdl, struct v4l2_querymenu *qm); | ||
444 | int v4l2_g_ctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_control *ctrl); | ||
445 | int v4l2_s_ctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_control *ctrl); | ||
446 | int v4l2_g_ext_ctrls(struct v4l2_ctrl_handler *hdl, struct v4l2_ext_controls *c); | ||
447 | int v4l2_try_ext_ctrls(struct v4l2_ctrl_handler *hdl, struct v4l2_ext_controls *c); | ||
448 | int v4l2_s_ext_ctrls(struct v4l2_ctrl_handler *hdl, struct v4l2_ext_controls *c); | ||
449 | |||
450 | /* Helpers for subdevices. If the associated ctrl_handler == NULL then they | ||
451 | will all return -EINVAL. */ | ||
452 | int v4l2_subdev_queryctrl(struct v4l2_subdev *sd, struct v4l2_queryctrl *qc); | ||
453 | int v4l2_subdev_querymenu(struct v4l2_subdev *sd, struct v4l2_querymenu *qm); | ||
454 | int v4l2_subdev_g_ext_ctrls(struct v4l2_subdev *sd, struct v4l2_ext_controls *cs); | ||
455 | int v4l2_subdev_try_ext_ctrls(struct v4l2_subdev *sd, struct v4l2_ext_controls *cs); | ||
456 | int v4l2_subdev_s_ext_ctrls(struct v4l2_subdev *sd, struct v4l2_ext_controls *cs); | ||
457 | int v4l2_subdev_g_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl); | ||
458 | int v4l2_subdev_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl); | ||
459 | |||
460 | #endif | ||
diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h index bebe44b03e0f..1efcacbed01a 100644 --- a/include/media/v4l2-dev.h +++ b/include/media/v4l2-dev.h | |||
@@ -27,6 +27,7 @@ | |||
27 | struct v4l2_ioctl_callbacks; | 27 | struct v4l2_ioctl_callbacks; |
28 | struct video_device; | 28 | struct video_device; |
29 | struct v4l2_device; | 29 | struct v4l2_device; |
30 | struct v4l2_ctrl_handler; | ||
30 | 31 | ||
31 | /* Flag to mark the video_device struct as registered. | 32 | /* Flag to mark the video_device struct as registered. |
32 | Drivers can clear this flag if they want to block all future | 33 | Drivers can clear this flag if they want to block all future |
@@ -67,6 +68,9 @@ struct video_device | |||
67 | struct device *parent; /* device parent */ | 68 | struct device *parent; /* device parent */ |
68 | struct v4l2_device *v4l2_dev; /* v4l2_device parent */ | 69 | struct v4l2_device *v4l2_dev; /* v4l2_device parent */ |
69 | 70 | ||
71 | /* Control handler associated with this device node. May be NULL. */ | ||
72 | struct v4l2_ctrl_handler *ctrl_handler; | ||
73 | |||
70 | /* device info */ | 74 | /* device info */ |
71 | char name[32]; | 75 | char name[32]; |
72 | int vfl_type; | 76 | int vfl_type; |
diff --git a/include/media/v4l2-device.h b/include/media/v4l2-device.h index 5d5d550e63ad..8bcbd7a0271c 100644 --- a/include/media/v4l2-device.h +++ b/include/media/v4l2-device.h | |||
@@ -32,6 +32,8 @@ | |||
32 | 32 | ||
33 | #define V4L2_DEVICE_NAME_SIZE (20 + 16) | 33 | #define V4L2_DEVICE_NAME_SIZE (20 + 16) |
34 | 34 | ||
35 | struct v4l2_ctrl_handler; | ||
36 | |||
35 | struct v4l2_device { | 37 | struct v4l2_device { |
36 | /* dev->driver_data points to this struct. | 38 | /* dev->driver_data points to this struct. |
37 | Note: dev might be NULL if there is no parent device | 39 | Note: dev might be NULL if there is no parent device |
@@ -47,6 +49,8 @@ struct v4l2_device { | |||
47 | /* notify callback called by some sub-devices. */ | 49 | /* notify callback called by some sub-devices. */ |
48 | void (*notify)(struct v4l2_subdev *sd, | 50 | void (*notify)(struct v4l2_subdev *sd, |
49 | unsigned int notification, void *arg); | 51 | unsigned int notification, void *arg); |
52 | /* The control handler. May be NULL. */ | ||
53 | struct v4l2_ctrl_handler *ctrl_handler; | ||
50 | }; | 54 | }; |
51 | 55 | ||
52 | /* Initialize v4l2_dev and make dev->driver_data point to v4l2_dev. | 56 | /* Initialize v4l2_dev and make dev->driver_data point to v4l2_dev. |
diff --git a/include/media/v4l2-mediabus.h b/include/media/v4l2-mediabus.h index 865cda7cd611..f0cf2e7def06 100644 --- a/include/media/v4l2-mediabus.h +++ b/include/media/v4l2-mediabus.h | |||
@@ -24,10 +24,10 @@ | |||
24 | */ | 24 | */ |
25 | enum v4l2_mbus_pixelcode { | 25 | enum v4l2_mbus_pixelcode { |
26 | V4L2_MBUS_FMT_FIXED = 1, | 26 | V4L2_MBUS_FMT_FIXED = 1, |
27 | V4L2_MBUS_FMT_YUYV8_2X8_LE, | 27 | V4L2_MBUS_FMT_YUYV8_2X8, |
28 | V4L2_MBUS_FMT_YVYU8_2X8_LE, | 28 | V4L2_MBUS_FMT_YVYU8_2X8, |
29 | V4L2_MBUS_FMT_YUYV8_2X8_BE, | 29 | V4L2_MBUS_FMT_UYVY8_2X8, |
30 | V4L2_MBUS_FMT_YVYU8_2X8_BE, | 30 | V4L2_MBUS_FMT_VYUY8_2X8, |
31 | V4L2_MBUS_FMT_RGB555_2X8_PADHI_LE, | 31 | V4L2_MBUS_FMT_RGB555_2X8_PADHI_LE, |
32 | V4L2_MBUS_FMT_RGB555_2X8_PADHI_BE, | 32 | V4L2_MBUS_FMT_RGB555_2X8_PADHI_BE, |
33 | V4L2_MBUS_FMT_RGB565_2X8_LE, | 33 | V4L2_MBUS_FMT_RGB565_2X8_LE, |
@@ -41,6 +41,11 @@ enum v4l2_mbus_pixelcode { | |||
41 | V4L2_MBUS_FMT_SBGGR10_2X8_PADHI_BE, | 41 | V4L2_MBUS_FMT_SBGGR10_2X8_PADHI_BE, |
42 | V4L2_MBUS_FMT_SBGGR10_2X8_PADLO_BE, | 42 | V4L2_MBUS_FMT_SBGGR10_2X8_PADLO_BE, |
43 | V4L2_MBUS_FMT_SGRBG8_1X8, | 43 | V4L2_MBUS_FMT_SGRBG8_1X8, |
44 | V4L2_MBUS_FMT_SBGGR12_1X12, | ||
45 | V4L2_MBUS_FMT_YUYV8_1_5X8, | ||
46 | V4L2_MBUS_FMT_YVYU8_1_5X8, | ||
47 | V4L2_MBUS_FMT_UYVY8_1_5X8, | ||
48 | V4L2_MBUS_FMT_VYUY8_1_5X8, | ||
44 | }; | 49 | }; |
45 | 50 | ||
46 | /** | 51 | /** |
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h index 02c6f4d11ed3..4a97d7341a94 100644 --- a/include/media/v4l2-subdev.h +++ b/include/media/v4l2-subdev.h | |||
@@ -35,6 +35,7 @@ | |||
35 | #define V4L2_SUBDEV_IR_TX_FIFO_SERVICE_REQ 0x00000001 | 35 | #define V4L2_SUBDEV_IR_TX_FIFO_SERVICE_REQ 0x00000001 |
36 | 36 | ||
37 | struct v4l2_device; | 37 | struct v4l2_device; |
38 | struct v4l2_ctrl_handler; | ||
38 | struct v4l2_subdev; | 39 | struct v4l2_subdev; |
39 | struct tuner_setup; | 40 | struct tuner_setup; |
40 | 41 | ||
@@ -90,10 +91,31 @@ struct v4l2_decode_vbi_line { | |||
90 | not yet implemented) since ops provide proper type-checking. | 91 | not yet implemented) since ops provide proper type-checking. |
91 | */ | 92 | */ |
92 | 93 | ||
94 | /* Subdevice external IO pin configuration */ | ||
95 | #define V4L2_SUBDEV_IO_PIN_DISABLE (1 << 0) /* ENABLE assumed */ | ||
96 | #define V4L2_SUBDEV_IO_PIN_OUTPUT (1 << 1) | ||
97 | #define V4L2_SUBDEV_IO_PIN_INPUT (1 << 2) | ||
98 | #define V4L2_SUBDEV_IO_PIN_SET_VALUE (1 << 3) /* Set output value */ | ||
99 | #define V4L2_SUBDEV_IO_PIN_ACTIVE_LOW (1 << 4) /* ACTIVE HIGH assumed */ | ||
100 | |||
101 | struct v4l2_subdev_io_pin_config { | ||
102 | u32 flags; /* V4L2_SUBDEV_IO_PIN_* flags for this pin's config */ | ||
103 | u8 pin; /* Chip external IO pin to configure */ | ||
104 | u8 function; /* Internal signal pad/function to route to IO pin */ | ||
105 | u8 value; /* Initial value for pin - e.g. GPIO output value */ | ||
106 | u8 strength; /* Pin drive strength */ | ||
107 | }; | ||
108 | |||
93 | /* s_config: if set, then it is always called by the v4l2_i2c_new_subdev* | 109 | /* s_config: if set, then it is always called by the v4l2_i2c_new_subdev* |
94 | functions after the v4l2_subdev was registered. It is used to pass | 110 | functions after the v4l2_subdev was registered. It is used to pass |
95 | platform data to the subdev which can be used during initialization. | 111 | platform data to the subdev which can be used during initialization. |
96 | 112 | ||
113 | s_io_pin_config: configure one or more chip I/O pins for chips that | ||
114 | multiplex different internal signal pads out to IO pins. This function | ||
115 | takes a pointer to an array of 'n' pin configuration entries, one for | ||
116 | each pin being configured. This function could be called at times | ||
117 | other than just subdevice initialization. | ||
118 | |||
97 | init: initialize the sensor registors to some sort of reasonable default | 119 | init: initialize the sensor registors to some sort of reasonable default |
98 | values. Do not use for new drivers and should be removed in existing | 120 | values. Do not use for new drivers and should be removed in existing |
99 | drivers. | 121 | drivers. |
@@ -110,11 +132,18 @@ struct v4l2_decode_vbi_line { | |||
110 | 132 | ||
111 | s_power: puts subdevice in power saving mode (on == 0) or normal operation | 133 | s_power: puts subdevice in power saving mode (on == 0) or normal operation |
112 | mode (on == 1). | 134 | mode (on == 1). |
135 | |||
136 | interrupt_service_routine: Called by the bridge chip's interrupt service | ||
137 | handler, when an interrupt status has be raised due to this subdev, | ||
138 | so that this subdev can handle the details. It may schedule work to be | ||
139 | performed later. It must not sleep. *Called from an IRQ context*. | ||
113 | */ | 140 | */ |
114 | struct v4l2_subdev_core_ops { | 141 | struct v4l2_subdev_core_ops { |
115 | int (*g_chip_ident)(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip); | 142 | int (*g_chip_ident)(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip); |
116 | int (*log_status)(struct v4l2_subdev *sd); | 143 | int (*log_status)(struct v4l2_subdev *sd); |
117 | int (*s_config)(struct v4l2_subdev *sd, int irq, void *platform_data); | 144 | int (*s_config)(struct v4l2_subdev *sd, int irq, void *platform_data); |
145 | int (*s_io_pin_config)(struct v4l2_subdev *sd, size_t n, | ||
146 | struct v4l2_subdev_io_pin_config *pincfg); | ||
118 | int (*init)(struct v4l2_subdev *sd, u32 val); | 147 | int (*init)(struct v4l2_subdev *sd, u32 val); |
119 | int (*load_fw)(struct v4l2_subdev *sd); | 148 | int (*load_fw)(struct v4l2_subdev *sd); |
120 | int (*reset)(struct v4l2_subdev *sd, u32 val); | 149 | int (*reset)(struct v4l2_subdev *sd, u32 val); |
@@ -133,6 +162,8 @@ struct v4l2_subdev_core_ops { | |||
133 | int (*s_register)(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg); | 162 | int (*s_register)(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg); |
134 | #endif | 163 | #endif |
135 | int (*s_power)(struct v4l2_subdev *sd, int on); | 164 | int (*s_power)(struct v4l2_subdev *sd, int on); |
165 | int (*interrupt_service_routine)(struct v4l2_subdev *sd, | ||
166 | u32 status, bool *handled); | ||
136 | }; | 167 | }; |
137 | 168 | ||
138 | /* s_mode: switch the tuner to a specific tuner mode. Replacement of s_radio. | 169 | /* s_mode: switch the tuner to a specific tuner mode. Replacement of s_radio. |
@@ -307,11 +338,6 @@ struct v4l2_subdev_sensor_ops { | |||
307 | }; | 338 | }; |
308 | 339 | ||
309 | /* | 340 | /* |
310 | interrupt_service_routine: Called by the bridge chip's interrupt service | ||
311 | handler, when an IR interrupt status has be raised due to this subdev, | ||
312 | so that this subdev can handle the details. It may schedule work to be | ||
313 | performed later. It must not sleep. *Called from an IRQ context*. | ||
314 | |||
315 | [rt]x_g_parameters: Get the current operating parameters and state of the | 341 | [rt]x_g_parameters: Get the current operating parameters and state of the |
316 | the IR receiver or transmitter. | 342 | the IR receiver or transmitter. |
317 | 343 | ||
@@ -335,14 +361,9 @@ struct v4l2_subdev_sensor_ops { | |||
335 | */ | 361 | */ |
336 | 362 | ||
337 | enum v4l2_subdev_ir_mode { | 363 | enum v4l2_subdev_ir_mode { |
338 | V4L2_SUBDEV_IR_MODE_PULSE_WIDTH, /* space & mark widths in nanosecs */ | 364 | V4L2_SUBDEV_IR_MODE_PULSE_WIDTH, /* uses struct ir_raw_event records */ |
339 | }; | 365 | }; |
340 | 366 | ||
341 | /* Data format of data read or written for V4L2_SUBDEV_IR_MODE_PULSE_WIDTH */ | ||
342 | #define V4L2_SUBDEV_IR_PULSE_MAX_WIDTH_NS 0x7fffffff | ||
343 | #define V4L2_SUBDEV_IR_PULSE_LEVEL_MASK 0x80000000 | ||
344 | #define V4L2_SUBDEV_IR_PULSE_RX_SEQ_END 0xffffffff | ||
345 | |||
346 | struct v4l2_subdev_ir_parameters { | 367 | struct v4l2_subdev_ir_parameters { |
347 | /* Either Rx or Tx */ | 368 | /* Either Rx or Tx */ |
348 | unsigned int bytes_per_data_element; /* of data in read or write call */ | 369 | unsigned int bytes_per_data_element; /* of data in read or write call */ |
@@ -356,7 +377,10 @@ struct v4l2_subdev_ir_parameters { | |||
356 | u32 max_pulse_width; /* ns, valid only for baseband signal */ | 377 | u32 max_pulse_width; /* ns, valid only for baseband signal */ |
357 | unsigned int carrier_freq; /* Hz, valid only for modulated signal*/ | 378 | unsigned int carrier_freq; /* Hz, valid only for modulated signal*/ |
358 | unsigned int duty_cycle; /* percent, valid only for modulated signal*/ | 379 | unsigned int duty_cycle; /* percent, valid only for modulated signal*/ |
359 | bool invert; /* logically invert sense of mark/space */ | 380 | bool invert_level; /* invert signal level */ |
381 | |||
382 | /* Tx only */ | ||
383 | bool invert_carrier_sense; /* Send 0/space as a carrier burst */ | ||
360 | 384 | ||
361 | /* Rx only */ | 385 | /* Rx only */ |
362 | u32 noise_filter_min_width; /* ns, min time of a valid pulse */ | 386 | u32 noise_filter_min_width; /* ns, min time of a valid pulse */ |
@@ -366,10 +390,6 @@ struct v4l2_subdev_ir_parameters { | |||
366 | }; | 390 | }; |
367 | 391 | ||
368 | struct v4l2_subdev_ir_ops { | 392 | struct v4l2_subdev_ir_ops { |
369 | /* Common to receiver and transmitter */ | ||
370 | int (*interrupt_service_routine)(struct v4l2_subdev *sd, | ||
371 | u32 status, bool *handled); | ||
372 | |||
373 | /* Receiver */ | 393 | /* Receiver */ |
374 | int (*rx_read)(struct v4l2_subdev *sd, u8 *buf, size_t count, | 394 | int (*rx_read)(struct v4l2_subdev *sd, u8 *buf, size_t count, |
375 | ssize_t *num); | 395 | ssize_t *num); |
@@ -415,6 +435,8 @@ struct v4l2_subdev { | |||
415 | u32 flags; | 435 | u32 flags; |
416 | struct v4l2_device *v4l2_dev; | 436 | struct v4l2_device *v4l2_dev; |
417 | const struct v4l2_subdev_ops *ops; | 437 | const struct v4l2_subdev_ops *ops; |
438 | /* The control handler of this subdev. May be NULL. */ | ||
439 | struct v4l2_ctrl_handler *ctrl_handler; | ||
418 | /* name must be unique */ | 440 | /* name must be unique */ |
419 | char name[V4L2_SUBDEV_NAME_SIZE]; | 441 | char name[V4L2_SUBDEV_NAME_SIZE]; |
420 | /* can be used to group similar subdevs, value is driver-specific */ | 442 | /* can be used to group similar subdevs, value is driver-specific */ |
diff --git a/include/media/videobuf-core.h b/include/media/videobuf-core.h index f91a736c133d..f2c41cebf453 100644 --- a/include/media/videobuf-core.h +++ b/include/media/videobuf-core.h | |||
@@ -54,8 +54,6 @@ struct videobuf_queue; | |||
54 | 54 | ||
55 | struct videobuf_mapping { | 55 | struct videobuf_mapping { |
56 | unsigned int count; | 56 | unsigned int count; |
57 | unsigned long start; | ||
58 | unsigned long end; | ||
59 | struct videobuf_queue *q; | 57 | struct videobuf_queue *q; |
60 | }; | 58 | }; |
61 | 59 | ||
@@ -127,7 +125,7 @@ struct videobuf_queue_ops { | |||
127 | struct videobuf_qtype_ops { | 125 | struct videobuf_qtype_ops { |
128 | u32 magic; | 126 | u32 magic; |
129 | 127 | ||
130 | struct videobuf_buffer *(*alloc)(size_t size); | 128 | struct videobuf_buffer *(*alloc_vb)(size_t size); |
131 | void *(*vaddr) (struct videobuf_buffer *buf); | 129 | void *(*vaddr) (struct videobuf_buffer *buf); |
132 | int (*iolock) (struct videobuf_queue *q, | 130 | int (*iolock) (struct videobuf_queue *q, |
133 | struct videobuf_buffer *vb, | 131 | struct videobuf_buffer *vb, |
@@ -173,7 +171,7 @@ int videobuf_waiton(struct videobuf_buffer *vb, int non_blocking, int intr); | |||
173 | int videobuf_iolock(struct videobuf_queue *q, struct videobuf_buffer *vb, | 171 | int videobuf_iolock(struct videobuf_queue *q, struct videobuf_buffer *vb, |
174 | struct v4l2_framebuffer *fbuf); | 172 | struct v4l2_framebuffer *fbuf); |
175 | 173 | ||
176 | struct videobuf_buffer *videobuf_alloc(struct videobuf_queue *q); | 174 | struct videobuf_buffer *videobuf_alloc_vb(struct videobuf_queue *q); |
177 | 175 | ||
178 | /* Used on videobuf-dvb */ | 176 | /* Used on videobuf-dvb */ |
179 | void *videobuf_queue_to_vaddr(struct videobuf_queue *q, | 177 | void *videobuf_queue_to_vaddr(struct videobuf_queue *q, |
diff --git a/include/media/videobuf-dma-sg.h b/include/media/videobuf-dma-sg.h index a195f3b9c00a..97e07f46a0fa 100644 --- a/include/media/videobuf-dma-sg.h +++ b/include/media/videobuf-dma-sg.h | |||
@@ -25,23 +25,6 @@ | |||
25 | /* --------------------------------------------------------------------- */ | 25 | /* --------------------------------------------------------------------- */ |
26 | 26 | ||
27 | /* | 27 | /* |
28 | * Return a scatterlist for some page-aligned vmalloc()'ed memory | ||
29 | * block (NULL on errors). Memory for the scatterlist is allocated | ||
30 | * using kmalloc. The caller must free the memory. | ||
31 | */ | ||
32 | struct scatterlist *videobuf_vmalloc_to_sg(unsigned char *virt, int nr_pages); | ||
33 | |||
34 | /* | ||
35 | * Return a scatterlist for a an array of userpages (NULL on errors). | ||
36 | * Memory for the scatterlist is allocated using kmalloc. The caller | ||
37 | * must free the memory. | ||
38 | */ | ||
39 | struct scatterlist *videobuf_pages_to_sg(struct page **pages, int nr_pages, | ||
40 | int offset); | ||
41 | |||
42 | /* --------------------------------------------------------------------- */ | ||
43 | |||
44 | /* | ||
45 | * A small set of helper functions to manage buffers (both userland | 28 | * A small set of helper functions to manage buffers (both userland |
46 | * and kernel) for DMA. | 29 | * and kernel) for DMA. |
47 | * | 30 | * |
@@ -68,7 +51,7 @@ struct videobuf_dmabuf { | |||
68 | struct page **pages; | 51 | struct page **pages; |
69 | 52 | ||
70 | /* for kernel buffers */ | 53 | /* for kernel buffers */ |
71 | void *vmalloc; | 54 | void *vaddr; |
72 | 55 | ||
73 | /* for overlay buffers (pci-pci dma) */ | 56 | /* for overlay buffers (pci-pci dma) */ |
74 | dma_addr_t bus_addr; | 57 | dma_addr_t bus_addr; |
@@ -87,6 +70,16 @@ struct videobuf_dma_sg_memory { | |||
87 | struct videobuf_dmabuf dma; | 70 | struct videobuf_dmabuf dma; |
88 | }; | 71 | }; |
89 | 72 | ||
73 | /* | ||
74 | * Scatter-gather DMA buffer API. | ||
75 | * | ||
76 | * These functions provide a simple way to create a page list and a | ||
77 | * scatter-gather list from a kernel, userspace of physical address and map the | ||
78 | * memory for DMA operation. | ||
79 | * | ||
80 | * Despite the name, this is totally unrelated to videobuf, except that | ||
81 | * videobuf-dma-sg uses the same API internally. | ||
82 | */ | ||
90 | void videobuf_dma_init(struct videobuf_dmabuf *dma); | 83 | void videobuf_dma_init(struct videobuf_dmabuf *dma); |
91 | int videobuf_dma_init_user(struct videobuf_dmabuf *dma, int direction, | 84 | int videobuf_dma_init_user(struct videobuf_dmabuf *dma, int direction, |
92 | unsigned long data, unsigned long size); | 85 | unsigned long data, unsigned long size); |
@@ -96,8 +89,8 @@ int videobuf_dma_init_overlay(struct videobuf_dmabuf *dma, int direction, | |||
96 | dma_addr_t addr, int nr_pages); | 89 | dma_addr_t addr, int nr_pages); |
97 | int videobuf_dma_free(struct videobuf_dmabuf *dma); | 90 | int videobuf_dma_free(struct videobuf_dmabuf *dma); |
98 | 91 | ||
99 | int videobuf_dma_map(struct videobuf_queue *q, struct videobuf_dmabuf *dma); | 92 | int videobuf_dma_map(struct device *dev, struct videobuf_dmabuf *dma); |
100 | int videobuf_dma_unmap(struct videobuf_queue *q, struct videobuf_dmabuf *dma); | 93 | int videobuf_dma_unmap(struct device *dev, struct videobuf_dmabuf *dma); |
101 | struct videobuf_dmabuf *videobuf_to_dma(struct videobuf_buffer *buf); | 94 | struct videobuf_dmabuf *videobuf_to_dma(struct videobuf_buffer *buf); |
102 | 95 | ||
103 | void *videobuf_sg_alloc(size_t size); | 96 | void *videobuf_sg_alloc(size_t size); |
@@ -111,11 +104,5 @@ void videobuf_queue_sg_init(struct videobuf_queue *q, | |||
111 | unsigned int msize, | 104 | unsigned int msize, |
112 | void *priv); | 105 | void *priv); |
113 | 106 | ||
114 | /*FIXME: these variants are used only on *-alsa code, where videobuf is | ||
115 | * used without queue | ||
116 | */ | ||
117 | int videobuf_sg_dma_map(struct device *dev, struct videobuf_dmabuf *dma); | ||
118 | int videobuf_sg_dma_unmap(struct device *dev, struct videobuf_dmabuf *dma); | ||
119 | |||
120 | #endif /* _VIDEOBUF_DMA_SG_H */ | 107 | #endif /* _VIDEOBUF_DMA_SG_H */ |
121 | 108 | ||
diff --git a/include/media/videobuf-vmalloc.h b/include/media/videobuf-vmalloc.h index 851eb1a2ff2a..e19403c18dae 100644 --- a/include/media/videobuf-vmalloc.h +++ b/include/media/videobuf-vmalloc.h | |||
@@ -22,7 +22,7 @@ | |||
22 | struct videobuf_vmalloc_memory { | 22 | struct videobuf_vmalloc_memory { |
23 | u32 magic; | 23 | u32 magic; |
24 | 24 | ||
25 | void *vmalloc; | 25 | void *vaddr; |
26 | 26 | ||
27 | /* remap_vmalloc_range seems to need to run | 27 | /* remap_vmalloc_range seems to need to run |
28 | * after mmap() on some cases */ | 28 | * after mmap() on some cases */ |