Mike Isely | d855497 | 2006-06-26 20:58:46 -0300 | [diff] [blame] | 1 | /* |
| 2 | * |
Mike Isely | d855497 | 2006-06-26 20:58:46 -0300 | [diff] [blame] | 3 | * |
| 4 | * Copyright (C) 2005 Mike Isely <isely@pobox.com> |
| 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 |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program; if not, write to the Free Software |
| 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 18 | * |
| 19 | */ |
| 20 | #ifndef __PVRUSB2_HDW_INTERNAL_H |
| 21 | #define __PVRUSB2_HDW_INTERNAL_H |
| 22 | |
| 23 | /* |
| 24 | |
| 25 | This header sets up all the internal structures and definitions needed to |
| 26 | track and coordinate the driver's interaction with the hardware. ONLY |
| 27 | source files which actually implement part of that whole circus should be |
| 28 | including this header. Higher levels, like the external layers to the |
| 29 | various public APIs (V4L, sysfs, etc) should NOT ever include this |
| 30 | private, internal header. This means that pvrusb2-hdw, pvrusb2-encoder, |
| 31 | etc will include this, but pvrusb2-v4l should not. |
| 32 | |
| 33 | */ |
| 34 | |
Mike Isely | d855497 | 2006-06-26 20:58:46 -0300 | [diff] [blame] | 35 | #include <linux/videodev2.h> |
| 36 | #include <linux/i2c.h> |
Mike Isely | 681c739 | 2007-11-26 01:48:52 -0300 | [diff] [blame] | 37 | #include <linux/workqueue.h> |
Mike Isely | d855497 | 2006-06-26 20:58:46 -0300 | [diff] [blame] | 38 | #include <linux/mutex.h> |
| 39 | #include "pvrusb2-hdw.h" |
| 40 | #include "pvrusb2-io.h" |
Mike Isely | c05c046 | 2006-06-25 20:04:25 -0300 | [diff] [blame] | 41 | #include <media/cx2341x.h> |
Mike Isely | 989eb15 | 2007-11-26 01:53:12 -0300 | [diff] [blame] | 42 | #include "pvrusb2-devattr.h" |
Mike Isely | d855497 | 2006-06-26 20:58:46 -0300 | [diff] [blame] | 43 | |
Mike Isely | d855497 | 2006-06-26 20:58:46 -0300 | [diff] [blame] | 44 | /* Legal values for PVR2_CID_HSM */ |
| 45 | #define PVR2_CVAL_HSM_FAIL 0 |
| 46 | #define PVR2_CVAL_HSM_FULL 1 |
| 47 | #define PVR2_CVAL_HSM_HIGH 2 |
| 48 | |
| 49 | #define PVR2_VID_ENDPOINT 0x84 |
| 50 | #define PVR2_UNK_ENDPOINT 0x86 /* maybe raw yuv ? */ |
| 51 | #define PVR2_VBI_ENDPOINT 0x88 |
| 52 | |
| 53 | #define PVR2_CTL_BUFFSIZE 64 |
| 54 | |
| 55 | #define FREQTABLE_SIZE 500 |
| 56 | |
| 57 | #define LOCK_TAKE(x) do { mutex_lock(&x##_mutex); x##_held = !0; } while (0) |
| 58 | #define LOCK_GIVE(x) do { x##_held = 0; mutex_unlock(&x##_mutex); } while (0) |
| 59 | |
| 60 | struct pvr2_decoder; |
| 61 | |
| 62 | typedef int (*pvr2_ctlf_is_dirty)(struct pvr2_ctrl *); |
| 63 | typedef void (*pvr2_ctlf_clear_dirty)(struct pvr2_ctrl *); |
Mike Isely | 5549f54 | 2006-12-27 23:28:54 -0300 | [diff] [blame] | 64 | typedef int (*pvr2_ctlf_check_value)(struct pvr2_ctrl *,int); |
Mike Isely | d855497 | 2006-06-26 20:58:46 -0300 | [diff] [blame] | 65 | typedef int (*pvr2_ctlf_get_value)(struct pvr2_ctrl *,int *); |
| 66 | typedef int (*pvr2_ctlf_set_value)(struct pvr2_ctrl *,int msk,int val); |
| 67 | typedef int (*pvr2_ctlf_val_to_sym)(struct pvr2_ctrl *,int msk,int val, |
| 68 | char *,unsigned int,unsigned int *); |
| 69 | typedef int (*pvr2_ctlf_sym_to_val)(struct pvr2_ctrl *, |
| 70 | const char *,unsigned int, |
| 71 | int *mskp,int *valp); |
Mike Isely | a761f43 | 2006-06-25 20:04:44 -0300 | [diff] [blame] | 72 | typedef unsigned int (*pvr2_ctlf_get_v4lflags)(struct pvr2_ctrl *); |
Mike Isely | d855497 | 2006-06-26 20:58:46 -0300 | [diff] [blame] | 73 | |
| 74 | /* This structure describes a specific control. A table of these is set up |
| 75 | in pvrusb2-hdw.c. */ |
| 76 | struct pvr2_ctl_info { |
| 77 | /* Control's name suitable for use as an identifier */ |
| 78 | const char *name; |
| 79 | |
| 80 | /* Short description of control */ |
| 81 | const char *desc; |
| 82 | |
| 83 | /* Control's implementation */ |
| 84 | pvr2_ctlf_get_value get_value; /* Get its value */ |
Mike Isely | 26dd1c5 | 2008-08-31 20:55:03 -0300 | [diff] [blame] | 85 | pvr2_ctlf_get_value get_def_value; /* Get its default value */ |
Mike Isely | 89ebd63 | 2006-08-08 09:10:07 -0300 | [diff] [blame] | 86 | pvr2_ctlf_get_value get_min_value; /* Get minimum allowed value */ |
| 87 | pvr2_ctlf_get_value get_max_value; /* Get maximum allowed value */ |
Mike Isely | d855497 | 2006-06-26 20:58:46 -0300 | [diff] [blame] | 88 | pvr2_ctlf_set_value set_value; /* Set its value */ |
Mike Isely | 5549f54 | 2006-12-27 23:28:54 -0300 | [diff] [blame] | 89 | pvr2_ctlf_check_value check_value; /* Check that value is valid */ |
Mike Isely | d855497 | 2006-06-26 20:58:46 -0300 | [diff] [blame] | 90 | pvr2_ctlf_val_to_sym val_to_sym; /* Custom convert value->symbol */ |
| 91 | pvr2_ctlf_sym_to_val sym_to_val; /* Custom convert symbol->value */ |
| 92 | pvr2_ctlf_is_dirty is_dirty; /* Return true if dirty */ |
| 93 | pvr2_ctlf_clear_dirty clear_dirty; /* Clear dirty state */ |
Mike Isely | a761f43 | 2006-06-25 20:04:44 -0300 | [diff] [blame] | 94 | pvr2_ctlf_get_v4lflags get_v4lflags;/* Retrieve v4l flags */ |
Mike Isely | d855497 | 2006-06-26 20:58:46 -0300 | [diff] [blame] | 95 | |
| 96 | /* Control's type (int, enum, bitmask) */ |
| 97 | enum pvr2_ctl_type type; |
| 98 | |
| 99 | /* Associated V4L control ID, if any */ |
| 100 | int v4l_id; |
| 101 | |
| 102 | /* Associated driver internal ID, if any */ |
| 103 | int internal_id; |
| 104 | |
| 105 | /* Don't implicitly initialize this control's value */ |
| 106 | int skip_init; |
| 107 | |
| 108 | /* Starting value for this control */ |
| 109 | int default_value; |
| 110 | |
| 111 | /* Type-specific control information */ |
| 112 | union { |
| 113 | struct { /* Integer control */ |
| 114 | long min_value; /* lower limit */ |
| 115 | long max_value; /* upper limit */ |
| 116 | } type_int; |
| 117 | struct { /* enumerated control */ |
| 118 | unsigned int count; /* enum value count */ |
| 119 | const char **value_names; /* symbol names */ |
| 120 | } type_enum; |
| 121 | struct { /* bitmask control */ |
| 122 | unsigned int valid_bits; /* bits in use */ |
| 123 | const char **bit_names; /* symbol name/bit */ |
| 124 | } type_bitmask; |
| 125 | } def; |
| 126 | }; |
| 127 | |
| 128 | |
Mike Isely | c05c046 | 2006-06-25 20:04:25 -0300 | [diff] [blame] | 129 | /* Same as pvr2_ctl_info, but includes storage for the control description */ |
| 130 | #define PVR2_CTLD_INFO_DESC_SIZE 32 |
| 131 | struct pvr2_ctld_info { |
| 132 | struct pvr2_ctl_info info; |
| 133 | char desc[PVR2_CTLD_INFO_DESC_SIZE]; |
| 134 | }; |
| 135 | |
Mike Isely | d855497 | 2006-06-26 20:58:46 -0300 | [diff] [blame] | 136 | struct pvr2_ctrl { |
| 137 | const struct pvr2_ctl_info *info; |
| 138 | struct pvr2_hdw *hdw; |
| 139 | }; |
| 140 | |
| 141 | |
Mike Isely | d855497 | 2006-06-26 20:58:46 -0300 | [diff] [blame] | 142 | struct pvr2_decoder_ctrl { |
| 143 | void *ctxt; |
| 144 | void (*detach)(void *); |
| 145 | void (*enable)(void *,int); |
Mike Isely | d855497 | 2006-06-26 20:58:46 -0300 | [diff] [blame] | 146 | void (*force_reset)(void *); |
| 147 | }; |
| 148 | |
| 149 | #define PVR2_I2C_PEND_DETECT 0x01 /* Need to detect a client type */ |
| 150 | #define PVR2_I2C_PEND_CLIENT 0x02 /* Client needs a specific update */ |
| 151 | #define PVR2_I2C_PEND_REFRESH 0x04 /* Client has specific pending bits */ |
| 152 | #define PVR2_I2C_PEND_STALE 0x08 /* Broadcast pending bits */ |
| 153 | |
| 154 | #define PVR2_I2C_PEND_ALL (PVR2_I2C_PEND_DETECT |\ |
| 155 | PVR2_I2C_PEND_CLIENT |\ |
| 156 | PVR2_I2C_PEND_REFRESH |\ |
| 157 | PVR2_I2C_PEND_STALE) |
| 158 | |
| 159 | /* Disposition of firmware1 loading situation */ |
| 160 | #define FW1_STATE_UNKNOWN 0 |
| 161 | #define FW1_STATE_MISSING 1 |
| 162 | #define FW1_STATE_FAILED 2 |
| 163 | #define FW1_STATE_RELOAD 3 |
| 164 | #define FW1_STATE_OK 4 |
| 165 | |
Mike Isely | 62433e3 | 2008-04-22 14:45:40 -0300 | [diff] [blame] | 166 | /* What state the device is in if it is a hybrid */ |
| 167 | #define PVR2_PATHWAY_UNKNOWN 0 |
| 168 | #define PVR2_PATHWAY_ANALOG 1 |
| 169 | #define PVR2_PATHWAY_DIGITAL 2 |
| 170 | |
Mike Isely | d855497 | 2006-06-26 20:58:46 -0300 | [diff] [blame] | 171 | typedef int (*pvr2_i2c_func)(struct pvr2_hdw *,u8,u8 *,u16,u8 *, u16); |
| 172 | #define PVR2_I2C_FUNC_CNT 128 |
| 173 | |
| 174 | /* This structure contains all state data directly needed to |
| 175 | manipulate the hardware (as opposed to complying with a kernel |
| 176 | interface) */ |
| 177 | struct pvr2_hdw { |
| 178 | /* Underlying USB device handle */ |
| 179 | struct usb_device *usb_dev; |
| 180 | struct usb_interface *usb_intf; |
| 181 | |
Mike Isely | f66fbd7 | 2007-11-26 01:55:07 -0300 | [diff] [blame] | 182 | /* Device description, anything that must adjust behavior based on |
| 183 | device specific info will use information held here. */ |
Mike Isely | 989eb15 | 2007-11-26 01:53:12 -0300 | [diff] [blame] | 184 | const struct pvr2_device_desc *hdw_desc; |
Mike Isely | d855497 | 2006-06-26 20:58:46 -0300 | [diff] [blame] | 185 | |
Mike Isely | 681c739 | 2007-11-26 01:48:52 -0300 | [diff] [blame] | 186 | /* Kernel worker thread handling */ |
| 187 | struct workqueue_struct *workqueue; |
| 188 | struct work_struct workpoll; /* Update driver state */ |
| 189 | struct work_struct worki2csync; /* Update i2c clients */ |
Mike Isely | 681c739 | 2007-11-26 01:48:52 -0300 | [diff] [blame] | 190 | |
Mike Isely | d855497 | 2006-06-26 20:58:46 -0300 | [diff] [blame] | 191 | /* Video spigot */ |
| 192 | struct pvr2_stream *vid_stream; |
| 193 | |
| 194 | /* Mutex for all hardware state control */ |
| 195 | struct mutex big_lock_mutex; |
| 196 | int big_lock_held; /* For debugging */ |
| 197 | |
Mike Isely | d855497 | 2006-06-26 20:58:46 -0300 | [diff] [blame] | 198 | char name[32]; |
| 199 | |
| 200 | /* I2C stuff */ |
| 201 | struct i2c_adapter i2c_adap; |
| 202 | struct i2c_algorithm i2c_algo; |
| 203 | pvr2_i2c_func i2c_func[PVR2_I2C_FUNC_CNT]; |
| 204 | int i2c_cx25840_hack_state; |
| 205 | int i2c_linked; |
| 206 | unsigned int i2c_pend_types; /* Which types of update are needed */ |
| 207 | unsigned long i2c_pend_mask; /* Change bits we need to scan */ |
| 208 | unsigned long i2c_stale_mask; /* Pending broadcast change bits */ |
| 209 | unsigned long i2c_active_mask; /* All change bits currently in use */ |
| 210 | struct list_head i2c_clients; |
| 211 | struct mutex i2c_list_lock; |
| 212 | |
| 213 | /* Frequency table */ |
| 214 | unsigned int freqTable[FREQTABLE_SIZE]; |
| 215 | unsigned int freqProgSlot; |
Mike Isely | d855497 | 2006-06-26 20:58:46 -0300 | [diff] [blame] | 216 | |
| 217 | /* Stuff for handling low level control interaction with device */ |
| 218 | struct mutex ctl_lock_mutex; |
| 219 | int ctl_lock_held; /* For debugging */ |
| 220 | struct urb *ctl_write_urb; |
| 221 | struct urb *ctl_read_urb; |
| 222 | unsigned char *ctl_write_buffer; |
| 223 | unsigned char *ctl_read_buffer; |
Mike Isely | 26e3304 | 2007-12-03 01:43:23 -0300 | [diff] [blame] | 224 | int ctl_write_pend_flag; |
| 225 | int ctl_read_pend_flag; |
| 226 | int ctl_timeout_flag; |
Mike Isely | d855497 | 2006-06-26 20:58:46 -0300 | [diff] [blame] | 227 | struct completion ctl_done; |
| 228 | unsigned char cmd_buffer[PVR2_CTL_BUFFSIZE]; |
| 229 | int cmd_debug_state; // Low level command debugging info |
| 230 | unsigned char cmd_debug_code; // |
| 231 | unsigned int cmd_debug_write_len; // |
| 232 | unsigned int cmd_debug_read_len; // |
| 233 | |
Mike Isely | 681c739 | 2007-11-26 01:48:52 -0300 | [diff] [blame] | 234 | /* Bits of state that describe what is going on with various parts |
| 235 | of the driver. */ |
Mike Isely | 62433e3 | 2008-04-22 14:45:40 -0300 | [diff] [blame] | 236 | int state_pathway_ok; /* Pathway config is ok */ |
Mike Isely | e802c14 | 2007-12-03 01:44:43 -0300 | [diff] [blame] | 237 | int state_encoder_ok; /* Encoder is operational */ |
| 238 | int state_encoder_run; /* Encoder is running */ |
| 239 | int state_encoder_config; /* Encoder is configured */ |
| 240 | int state_encoder_waitok; /* Encoder pre-wait done */ |
Mike Isely | d913d63 | 2008-04-06 04:04:35 -0300 | [diff] [blame] | 241 | int state_encoder_runok; /* Encoder has run for >= .25 sec */ |
Mike Isely | e802c14 | 2007-12-03 01:44:43 -0300 | [diff] [blame] | 242 | int state_decoder_run; /* Decoder is running */ |
| 243 | int state_usbstream_run; /* FX2 is streaming */ |
| 244 | int state_decoder_quiescent; /* Decoder idle for > 50msec */ |
| 245 | int state_pipeline_config; /* Pipeline is configured */ |
Mike Isely | 7f421fe | 2008-04-22 14:45:39 -0300 | [diff] [blame] | 246 | int state_pipeline_req; /* Somebody wants to stream */ |
| 247 | int state_pipeline_pause; /* Pipeline must be paused */ |
| 248 | int state_pipeline_idle; /* Pipeline not running */ |
Mike Isely | 681c739 | 2007-11-26 01:48:52 -0300 | [diff] [blame] | 249 | |
| 250 | /* This is the master state of the driver. It is the combined |
| 251 | result of other bits of state. Examining this will indicate the |
| 252 | overall state of the driver. Values here are one of |
| 253 | PVR2_STATE_xxxx */ |
| 254 | unsigned int master_state; |
| 255 | |
Mike Isely | 40381cb | 2008-04-22 14:45:42 -0300 | [diff] [blame] | 256 | /* True if device led is currently on */ |
| 257 | int led_on; |
| 258 | |
Mike Isely | 681c739 | 2007-11-26 01:48:52 -0300 | [diff] [blame] | 259 | /* True if states must be re-evaluated */ |
| 260 | int state_stale; |
| 261 | |
| 262 | void (*state_func)(void *); |
| 263 | void *state_data; |
| 264 | |
| 265 | /* Timer for measuring decoder settling time */ |
| 266 | struct timer_list quiescent_timer; |
| 267 | |
| 268 | /* Timer for measuring encoder pre-wait time */ |
| 269 | struct timer_list encoder_wait_timer; |
| 270 | |
Mike Isely | d913d63 | 2008-04-06 04:04:35 -0300 | [diff] [blame] | 271 | /* Timer for measuring encoder minimum run time */ |
| 272 | struct timer_list encoder_run_timer; |
| 273 | |
Mike Isely | 681c739 | 2007-11-26 01:48:52 -0300 | [diff] [blame] | 274 | /* Place to block while waiting for state changes */ |
| 275 | wait_queue_head_t state_wait_data; |
| 276 | |
| 277 | |
Mike Isely | 9a607f0 | 2007-10-14 18:18:12 -0300 | [diff] [blame] | 278 | int flag_ok; /* device in known good state */ |
| 279 | int flag_disconnected; /* flag_ok == 0 due to disconnect */ |
| 280 | int flag_init_ok; /* true if structure is fully initialized */ |
Mike Isely | 9a607f0 | 2007-10-14 18:18:12 -0300 | [diff] [blame] | 281 | int fw1_state; /* current situation with fw1 */ |
Mike Isely | 62433e3 | 2008-04-22 14:45:40 -0300 | [diff] [blame] | 282 | int pathway_state; /* one of PVR2_PATHWAY_xxx */ |
Mike Isely | 681c739 | 2007-11-26 01:48:52 -0300 | [diff] [blame] | 283 | int flag_decoder_missed;/* We've noticed missing decoder */ |
| 284 | int flag_tripped; /* Indicates overall failure to start */ |
Mike Isely | d855497 | 2006-06-26 20:58:46 -0300 | [diff] [blame] | 285 | |
| 286 | struct pvr2_decoder_ctrl *decoder_ctrl; |
| 287 | |
| 288 | // CPU firmware info (used to help find / save firmware data) |
| 289 | char *fw_buffer; |
| 290 | unsigned int fw_size; |
Mike Isely | 4db666c | 2007-09-08 22:16:27 -0300 | [diff] [blame] | 291 | int fw_cpu_flag; /* True if we are dealing with the CPU */ |
Mike Isely | d855497 | 2006-06-26 20:58:46 -0300 | [diff] [blame] | 292 | |
Mike Isely | d855497 | 2006-06-26 20:58:46 -0300 | [diff] [blame] | 293 | // True if there is a request to trigger logging of state in each |
| 294 | // module. |
| 295 | int log_requested; |
| 296 | |
| 297 | /* Tuner / frequency control stuff */ |
| 298 | unsigned int tuner_type; |
| 299 | int tuner_updated; |
Mike Isely | 1bde028 | 2006-12-27 23:30:13 -0300 | [diff] [blame] | 300 | unsigned int freqValTelevision; /* Current freq for tv mode */ |
| 301 | unsigned int freqValRadio; /* Current freq for radio mode */ |
| 302 | unsigned int freqSlotTelevision; /* Current slot for tv mode */ |
| 303 | unsigned int freqSlotRadio; /* Current slot for radio mode */ |
| 304 | unsigned int freqSelector; /* 0=radio 1=television */ |
Mike Isely | d855497 | 2006-06-26 20:58:46 -0300 | [diff] [blame] | 305 | int freqDirty; |
| 306 | |
Mike Isely | 18103c5 | 2007-01-20 00:09:47 -0300 | [diff] [blame] | 307 | /* Current tuner info - this information is polled from the I2C bus */ |
| 308 | struct v4l2_tuner tuner_signal_info; |
| 309 | int tuner_signal_stale; |
| 310 | |
Mike Isely | 432907f | 2008-08-31 21:02:20 -0300 | [diff] [blame^] | 311 | /* Cropping capability info */ |
| 312 | struct v4l2_cropcap cropcap_info; |
| 313 | int cropcap_stale; |
| 314 | |
Mike Isely | d855497 | 2006-06-26 20:58:46 -0300 | [diff] [blame] | 315 | /* Video standard handling */ |
| 316 | v4l2_std_id std_mask_eeprom; // Hardware supported selections |
| 317 | v4l2_std_id std_mask_avail; // Which standards we may select from |
| 318 | v4l2_std_id std_mask_cur; // Currently selected standard(s) |
| 319 | unsigned int std_enum_cnt; // # of enumerated standards |
| 320 | int std_enum_cur; // selected standard enumeration value |
| 321 | int std_dirty; // True if std_mask_cur has changed |
| 322 | struct pvr2_ctl_info std_info_enum; |
| 323 | struct pvr2_ctl_info std_info_avail; |
| 324 | struct pvr2_ctl_info std_info_cur; |
| 325 | struct v4l2_standard *std_defs; |
| 326 | const char **std_enum_names; |
| 327 | |
| 328 | // Generated string names, one per actual V4L2 standard |
| 329 | const char *std_mask_ptrs[32]; |
| 330 | char std_mask_names[32][10]; |
| 331 | |
| 332 | int unit_number; /* ID for driver instance */ |
| 333 | unsigned long serial_number; /* ID for hardware itself */ |
| 334 | |
Mike Isely | 31a1854 | 2007-04-08 01:11:47 -0300 | [diff] [blame] | 335 | char bus_info[32]; /* Bus location info */ |
| 336 | |
Pantelis Koukousoulas | 2fdf3d9 | 2006-12-27 23:07:58 -0300 | [diff] [blame] | 337 | /* Minor numbers used by v4l logic (yes, this is a hack, as there |
| 338 | should be no v4l junk here). Probably a better way to do this. */ |
Mike Isely | 8079384 | 2006-12-27 23:12:28 -0300 | [diff] [blame] | 339 | int v4l_minor_number_video; |
| 340 | int v4l_minor_number_vbi; |
Mike Isely | fd5a75f | 2006-12-27 23:11:22 -0300 | [diff] [blame] | 341 | int v4l_minor_number_radio; |
Mike Isely | d855497 | 2006-06-26 20:58:46 -0300 | [diff] [blame] | 342 | |
Mike Isely | 1cb03b7 | 2008-04-21 03:47:43 -0300 | [diff] [blame] | 343 | /* Bit mask of PVR2_CVAL_INPUT choices which are valid for the hardware */ |
Mike Isely | 7fb20fa | 2008-04-22 14:45:37 -0300 | [diff] [blame] | 344 | unsigned int input_avail_mask; |
Mike Isely | 1cb03b7 | 2008-04-21 03:47:43 -0300 | [diff] [blame] | 345 | /* Bit mask of PVR2_CVAL_INPUT choices which are currenly allowed */ |
| 346 | unsigned int input_allowed_mask; |
Mike Isely | 7fb20fa | 2008-04-22 14:45:37 -0300 | [diff] [blame] | 347 | |
Mike Isely | d855497 | 2006-06-26 20:58:46 -0300 | [diff] [blame] | 348 | /* Location of eeprom or a negative number if none */ |
| 349 | int eeprom_addr; |
| 350 | |
Mike Isely | 681c739 | 2007-11-26 01:48:52 -0300 | [diff] [blame] | 351 | enum pvr2_config active_stream_type; |
| 352 | enum pvr2_config desired_stream_type; |
Mike Isely | d855497 | 2006-06-26 20:58:46 -0300 | [diff] [blame] | 353 | |
Mike Isely | b30d244 | 2006-06-25 20:05:01 -0300 | [diff] [blame] | 354 | /* Control state needed for cx2341x module */ |
| 355 | struct cx2341x_mpeg_params enc_cur_state; |
| 356 | struct cx2341x_mpeg_params enc_ctl_state; |
| 357 | /* True if an encoder attribute has changed */ |
| 358 | int enc_stale; |
Mike Isely | 681c739 | 2007-11-26 01:48:52 -0300 | [diff] [blame] | 359 | /* True if an unsafe encoder attribute has changed */ |
| 360 | int enc_unsafe_stale; |
Mike Isely | b30d244 | 2006-06-25 20:05:01 -0300 | [diff] [blame] | 361 | /* True if enc_cur_state is valid */ |
| 362 | int enc_cur_valid; |
Mike Isely | c05c046 | 2006-06-25 20:04:25 -0300 | [diff] [blame] | 363 | |
Mike Isely | d855497 | 2006-06-26 20:58:46 -0300 | [diff] [blame] | 364 | /* Control state */ |
| 365 | #define VCREATE_DATA(lab) int lab##_val; int lab##_dirty |
| 366 | VCREATE_DATA(brightness); |
| 367 | VCREATE_DATA(contrast); |
| 368 | VCREATE_DATA(saturation); |
| 369 | VCREATE_DATA(hue); |
| 370 | VCREATE_DATA(volume); |
| 371 | VCREATE_DATA(balance); |
| 372 | VCREATE_DATA(bass); |
| 373 | VCREATE_DATA(treble); |
| 374 | VCREATE_DATA(mute); |
vdb128@picaros.org | e784bfb | 2008-08-30 18:26:39 -0300 | [diff] [blame] | 375 | VCREATE_DATA(cropl); |
| 376 | VCREATE_DATA(cropt); |
| 377 | VCREATE_DATA(cropw); |
| 378 | VCREATE_DATA(croph); |
Mike Isely | c05c046 | 2006-06-25 20:04:25 -0300 | [diff] [blame] | 379 | VCREATE_DATA(input); |
| 380 | VCREATE_DATA(audiomode); |
| 381 | VCREATE_DATA(res_hor); |
| 382 | VCREATE_DATA(res_ver); |
Mike Isely | d855497 | 2006-06-26 20:58:46 -0300 | [diff] [blame] | 383 | VCREATE_DATA(srate); |
Mike Isely | d855497 | 2006-06-26 20:58:46 -0300 | [diff] [blame] | 384 | #undef VCREATE_DATA |
| 385 | |
Mike Isely | b30d244 | 2006-06-25 20:05:01 -0300 | [diff] [blame] | 386 | struct pvr2_ctld_info *mpeg_ctrl_info; |
Mike Isely | c05c046 | 2006-06-25 20:04:25 -0300 | [diff] [blame] | 387 | |
Mike Isely | d855497 | 2006-06-26 20:58:46 -0300 | [diff] [blame] | 388 | struct pvr2_ctrl *controls; |
Mike Isely | c05c046 | 2006-06-25 20:04:25 -0300 | [diff] [blame] | 389 | unsigned int control_cnt; |
Mike Isely | d855497 | 2006-06-26 20:58:46 -0300 | [diff] [blame] | 390 | }; |
| 391 | |
Mike Isely | 1bde028 | 2006-12-27 23:30:13 -0300 | [diff] [blame] | 392 | /* This function gets the current frequency */ |
| 393 | unsigned long pvr2_hdw_get_cur_freq(struct pvr2_hdw *); |
Mike Isely | 681c739 | 2007-11-26 01:48:52 -0300 | [diff] [blame] | 394 | void pvr2_hdw_set_decoder(struct pvr2_hdw *,struct pvr2_decoder_ctrl *); |
Mike Isely | 1bde028 | 2006-12-27 23:30:13 -0300 | [diff] [blame] | 395 | |
Mike Isely | d855497 | 2006-06-26 20:58:46 -0300 | [diff] [blame] | 396 | #endif /* __PVRUSB2_HDW_INTERNAL_H */ |
| 397 | |
| 398 | /* |
| 399 | Stuff for Emacs to see, in order to encourage consistent editing style: |
| 400 | *** Local Variables: *** |
| 401 | *** mode: c *** |
| 402 | *** fill-column: 75 *** |
| 403 | *** tab-width: 8 *** |
| 404 | *** c-basic-offset: 8 *** |
| 405 | *** End: *** |
| 406 | */ |