1*2504ba9fSThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */ 20c0d06caSMauro Carvalho Chehab /* 30c0d06caSMauro Carvalho Chehab * 40c0d06caSMauro Carvalho Chehab * Copyright (C) 2005 Mike Isely <isely@pobox.com> 50c0d06caSMauro Carvalho Chehab */ 60c0d06caSMauro Carvalho Chehab #ifndef __PVRUSB2_HDW_H 70c0d06caSMauro Carvalho Chehab #define __PVRUSB2_HDW_H 80c0d06caSMauro Carvalho Chehab 90c0d06caSMauro Carvalho Chehab #include <linux/usb.h> 100c0d06caSMauro Carvalho Chehab #include <linux/videodev2.h> 11a28fbd04SHans Verkuil #include <media/v4l2-dev.h> 120c0d06caSMauro Carvalho Chehab #include "pvrusb2-io.h" 130c0d06caSMauro Carvalho Chehab #include "pvrusb2-ctrl.h" 140c0d06caSMauro Carvalho Chehab 150c0d06caSMauro Carvalho Chehab 160c0d06caSMauro Carvalho Chehab /* Private internal control ids, look these up with 170c0d06caSMauro Carvalho Chehab pvr2_hdw_get_ctrl_by_id() - these are NOT visible in V4L */ 180c0d06caSMauro Carvalho Chehab #define PVR2_CID_STDCUR 2 190c0d06caSMauro Carvalho Chehab #define PVR2_CID_STDAVAIL 3 200c0d06caSMauro Carvalho Chehab #define PVR2_CID_INPUT 4 210c0d06caSMauro Carvalho Chehab #define PVR2_CID_AUDIOMODE 5 220c0d06caSMauro Carvalho Chehab #define PVR2_CID_FREQUENCY 6 230c0d06caSMauro Carvalho Chehab #define PVR2_CID_HRES 7 240c0d06caSMauro Carvalho Chehab #define PVR2_CID_VRES 8 250c0d06caSMauro Carvalho Chehab #define PVR2_CID_CROPL 9 260c0d06caSMauro Carvalho Chehab #define PVR2_CID_CROPT 10 270c0d06caSMauro Carvalho Chehab #define PVR2_CID_CROPW 11 280c0d06caSMauro Carvalho Chehab #define PVR2_CID_CROPH 12 290c0d06caSMauro Carvalho Chehab #define PVR2_CID_CROPCAPPAN 13 300c0d06caSMauro Carvalho Chehab #define PVR2_CID_CROPCAPPAD 14 310c0d06caSMauro Carvalho Chehab #define PVR2_CID_CROPCAPBL 15 320c0d06caSMauro Carvalho Chehab #define PVR2_CID_CROPCAPBT 16 330c0d06caSMauro Carvalho Chehab #define PVR2_CID_CROPCAPBW 17 340c0d06caSMauro Carvalho Chehab #define PVR2_CID_CROPCAPBH 18 350c0d06caSMauro Carvalho Chehab #define PVR2_CID_STDDETECT 19 360c0d06caSMauro Carvalho Chehab 370c0d06caSMauro Carvalho Chehab /* Legal values for the INPUT state variable */ 380c0d06caSMauro Carvalho Chehab #define PVR2_CVAL_INPUT_TV 0 390c0d06caSMauro Carvalho Chehab #define PVR2_CVAL_INPUT_DTV 1 400c0d06caSMauro Carvalho Chehab #define PVR2_CVAL_INPUT_COMPOSITE 2 410c0d06caSMauro Carvalho Chehab #define PVR2_CVAL_INPUT_SVIDEO 3 420c0d06caSMauro Carvalho Chehab #define PVR2_CVAL_INPUT_RADIO 4 43c1ced46cSDan Carpenter #define PVR2_CVAL_INPUT_MAX PVR2_CVAL_INPUT_RADIO 440c0d06caSMauro Carvalho Chehab 450c0d06caSMauro Carvalho Chehab enum pvr2_config { 460c0d06caSMauro Carvalho Chehab pvr2_config_empty, /* No configuration */ 470c0d06caSMauro Carvalho Chehab pvr2_config_mpeg, /* Encoded / compressed video */ 480c0d06caSMauro Carvalho Chehab pvr2_config_vbi, /* Standard vbi info */ 490c0d06caSMauro Carvalho Chehab pvr2_config_pcm, /* Audio raw pcm stream */ 500c0d06caSMauro Carvalho Chehab pvr2_config_rawvideo, /* Video raw frames */ 510c0d06caSMauro Carvalho Chehab }; 520c0d06caSMauro Carvalho Chehab 530c0d06caSMauro Carvalho Chehab enum pvr2_v4l_type { 540c0d06caSMauro Carvalho Chehab pvr2_v4l_type_video, 550c0d06caSMauro Carvalho Chehab pvr2_v4l_type_vbi, 560c0d06caSMauro Carvalho Chehab pvr2_v4l_type_radio, 570c0d06caSMauro Carvalho Chehab }; 580c0d06caSMauro Carvalho Chehab 590c0d06caSMauro Carvalho Chehab /* Major states that we can be in: 600c0d06caSMauro Carvalho Chehab * 610c0d06caSMauro Carvalho Chehab * DEAD - Device is in an unusable state and cannot be recovered. This 620c0d06caSMauro Carvalho Chehab * can happen if we completely lose the ability to communicate with it 630c0d06caSMauro Carvalho Chehab * (but it might still on the bus). In this state there's nothing we can 640c0d06caSMauro Carvalho Chehab * do; it must be replugged in order to recover. 650c0d06caSMauro Carvalho Chehab * 660c0d06caSMauro Carvalho Chehab * COLD - Device is in an unusable state, needs microcontroller firmware. 670c0d06caSMauro Carvalho Chehab * 680c0d06caSMauro Carvalho Chehab * WARM - We can communicate with the device and the proper 690c0d06caSMauro Carvalho Chehab * microcontroller firmware is running, but other device initialization is 700c0d06caSMauro Carvalho Chehab * still needed (e.g. encoder firmware). 710c0d06caSMauro Carvalho Chehab * 720c0d06caSMauro Carvalho Chehab * ERROR - A problem prevents capture operation (e.g. encoder firmware 730c0d06caSMauro Carvalho Chehab * missing). 740c0d06caSMauro Carvalho Chehab * 750c0d06caSMauro Carvalho Chehab * READY - Device is operational, but not streaming. 760c0d06caSMauro Carvalho Chehab * 770c0d06caSMauro Carvalho Chehab * RUN - Device is streaming. 780c0d06caSMauro Carvalho Chehab * 790c0d06caSMauro Carvalho Chehab */ 800c0d06caSMauro Carvalho Chehab #define PVR2_STATE_NONE 0 810c0d06caSMauro Carvalho Chehab #define PVR2_STATE_DEAD 1 820c0d06caSMauro Carvalho Chehab #define PVR2_STATE_COLD 2 830c0d06caSMauro Carvalho Chehab #define PVR2_STATE_WARM 3 840c0d06caSMauro Carvalho Chehab #define PVR2_STATE_ERROR 4 850c0d06caSMauro Carvalho Chehab #define PVR2_STATE_READY 5 860c0d06caSMauro Carvalho Chehab #define PVR2_STATE_RUN 6 870c0d06caSMauro Carvalho Chehab 880c0d06caSMauro Carvalho Chehab /* Translate configuration enum to a string label */ 890c0d06caSMauro Carvalho Chehab const char *pvr2_config_get_name(enum pvr2_config); 900c0d06caSMauro Carvalho Chehab 910c0d06caSMauro Carvalho Chehab struct pvr2_hdw; 920c0d06caSMauro Carvalho Chehab 930c0d06caSMauro Carvalho Chehab /* Create and return a structure for interacting with the underlying 940c0d06caSMauro Carvalho Chehab hardware */ 950c0d06caSMauro Carvalho Chehab struct pvr2_hdw *pvr2_hdw_create(struct usb_interface *intf, 960c0d06caSMauro Carvalho Chehab const struct usb_device_id *devid); 970c0d06caSMauro Carvalho Chehab 980c0d06caSMauro Carvalho Chehab /* Perform second stage initialization, passing in a notification callback 990c0d06caSMauro Carvalho Chehab for when the master state changes. */ 1000c0d06caSMauro Carvalho Chehab int pvr2_hdw_initialize(struct pvr2_hdw *, 1010c0d06caSMauro Carvalho Chehab void (*callback_func)(void *), 1020c0d06caSMauro Carvalho Chehab void *callback_data); 1030c0d06caSMauro Carvalho Chehab 1040c0d06caSMauro Carvalho Chehab /* Destroy hardware interaction structure */ 1050c0d06caSMauro Carvalho Chehab void pvr2_hdw_destroy(struct pvr2_hdw *); 1060c0d06caSMauro Carvalho Chehab 1070c0d06caSMauro Carvalho Chehab /* Return true if in the ready (normal) state */ 1080c0d06caSMauro Carvalho Chehab int pvr2_hdw_dev_ok(struct pvr2_hdw *); 1090c0d06caSMauro Carvalho Chehab 1100c0d06caSMauro Carvalho Chehab /* Return small integer number [1..N] for logical instance number of this 1110c0d06caSMauro Carvalho Chehab device. This is useful for indexing array-valued module parameters. */ 1120c0d06caSMauro Carvalho Chehab int pvr2_hdw_get_unit_number(struct pvr2_hdw *); 1130c0d06caSMauro Carvalho Chehab 1140c0d06caSMauro Carvalho Chehab /* Get pointer to underlying USB device */ 1150c0d06caSMauro Carvalho Chehab struct usb_device *pvr2_hdw_get_dev(struct pvr2_hdw *); 1160c0d06caSMauro Carvalho Chehab 1170c0d06caSMauro Carvalho Chehab /* Retrieve serial number of device */ 1180c0d06caSMauro Carvalho Chehab unsigned long pvr2_hdw_get_sn(struct pvr2_hdw *); 1190c0d06caSMauro Carvalho Chehab 1200c0d06caSMauro Carvalho Chehab /* Retrieve bus location info of device */ 1210c0d06caSMauro Carvalho Chehab const char *pvr2_hdw_get_bus_info(struct pvr2_hdw *); 1220c0d06caSMauro Carvalho Chehab 1230c0d06caSMauro Carvalho Chehab /* Retrieve per-instance string identifier for this specific device */ 1240c0d06caSMauro Carvalho Chehab const char *pvr2_hdw_get_device_identifier(struct pvr2_hdw *); 1250c0d06caSMauro Carvalho Chehab 1260c0d06caSMauro Carvalho Chehab /* Called when hardware has been unplugged */ 1270c0d06caSMauro Carvalho Chehab void pvr2_hdw_disconnect(struct pvr2_hdw *); 1280c0d06caSMauro Carvalho Chehab 129a28fbd04SHans Verkuil /* Sets v4l2_dev of a video_device struct */ 130a28fbd04SHans Verkuil void pvr2_hdw_set_v4l2_dev(struct pvr2_hdw *, struct video_device *); 131a28fbd04SHans Verkuil 1320c0d06caSMauro Carvalho Chehab /* Get the number of defined controls */ 1330c0d06caSMauro Carvalho Chehab unsigned int pvr2_hdw_get_ctrl_count(struct pvr2_hdw *); 1340c0d06caSMauro Carvalho Chehab 1350c0d06caSMauro Carvalho Chehab /* Retrieve a control handle given its index (0..count-1) */ 1360c0d06caSMauro Carvalho Chehab struct pvr2_ctrl *pvr2_hdw_get_ctrl_by_index(struct pvr2_hdw *,unsigned int); 1370c0d06caSMauro Carvalho Chehab 1380c0d06caSMauro Carvalho Chehab /* Retrieve a control handle given its internal ID (if any) */ 1390c0d06caSMauro Carvalho Chehab struct pvr2_ctrl *pvr2_hdw_get_ctrl_by_id(struct pvr2_hdw *,unsigned int); 1400c0d06caSMauro Carvalho Chehab 1410c0d06caSMauro Carvalho Chehab /* Retrieve a control handle given its V4L ID (if any) */ 1420c0d06caSMauro Carvalho Chehab struct pvr2_ctrl *pvr2_hdw_get_ctrl_v4l(struct pvr2_hdw *,unsigned int ctl_id); 1430c0d06caSMauro Carvalho Chehab 1440c0d06caSMauro Carvalho Chehab /* Retrieve a control handle given its immediate predecessor V4L ID (if any) */ 1450c0d06caSMauro Carvalho Chehab struct pvr2_ctrl *pvr2_hdw_get_ctrl_nextv4l(struct pvr2_hdw *, 1460c0d06caSMauro Carvalho Chehab unsigned int ctl_id); 1470c0d06caSMauro Carvalho Chehab 1480c0d06caSMauro Carvalho Chehab /* Commit all control changes made up to this point */ 1490c0d06caSMauro Carvalho Chehab int pvr2_hdw_commit_ctl(struct pvr2_hdw *); 1500c0d06caSMauro Carvalho Chehab 1510c0d06caSMauro Carvalho Chehab /* Return a bit mask of valid input selections for this device. Mask bits 1520c0d06caSMauro Carvalho Chehab * will be according to PVR_CVAL_INPUT_xxxx definitions. */ 1530c0d06caSMauro Carvalho Chehab unsigned int pvr2_hdw_get_input_available(struct pvr2_hdw *); 1540c0d06caSMauro Carvalho Chehab 1550c0d06caSMauro Carvalho Chehab /* Return a bit mask of allowed input selections for this device. Mask bits 1560c0d06caSMauro Carvalho Chehab * will be according to PVR_CVAL_INPUT_xxxx definitions. */ 1570c0d06caSMauro Carvalho Chehab unsigned int pvr2_hdw_get_input_allowed(struct pvr2_hdw *); 1580c0d06caSMauro Carvalho Chehab 1590c0d06caSMauro Carvalho Chehab /* Change the set of allowed input selections for this device. Both 1600c0d06caSMauro Carvalho Chehab change_mask and change_valu are mask bits according to 1610c0d06caSMauro Carvalho Chehab PVR_CVAL_INPUT_xxxx definitions. The change_mask parameter indicate 1620c0d06caSMauro Carvalho Chehab which settings are being changed and the change_val parameter indicates 1630c0d06caSMauro Carvalho Chehab whether corresponding settings are being set or cleared. */ 1640c0d06caSMauro Carvalho Chehab int pvr2_hdw_set_input_allowed(struct pvr2_hdw *, 1650c0d06caSMauro Carvalho Chehab unsigned int change_mask, 1660c0d06caSMauro Carvalho Chehab unsigned int change_val); 1670c0d06caSMauro Carvalho Chehab 1680c0d06caSMauro Carvalho Chehab /* Return name for this driver instance */ 1690c0d06caSMauro Carvalho Chehab const char *pvr2_hdw_get_driver_name(struct pvr2_hdw *); 1700c0d06caSMauro Carvalho Chehab 1710c0d06caSMauro Carvalho Chehab /* Mark tuner status stale so that it will be re-fetched */ 1720c0d06caSMauro Carvalho Chehab void pvr2_hdw_execute_tuner_poll(struct pvr2_hdw *); 1730c0d06caSMauro Carvalho Chehab 1740c0d06caSMauro Carvalho Chehab /* Return information about the tuner */ 1750c0d06caSMauro Carvalho Chehab int pvr2_hdw_get_tuner_status(struct pvr2_hdw *,struct v4l2_tuner *); 1760c0d06caSMauro Carvalho Chehab 1770c0d06caSMauro Carvalho Chehab /* Return information about cropping capabilities */ 1780c0d06caSMauro Carvalho Chehab int pvr2_hdw_get_cropcap(struct pvr2_hdw *, struct v4l2_cropcap *); 1790c0d06caSMauro Carvalho Chehab 1800c0d06caSMauro Carvalho Chehab /* Query device and see if it thinks it is on a high-speed USB link */ 1810c0d06caSMauro Carvalho Chehab int pvr2_hdw_is_hsm(struct pvr2_hdw *); 1820c0d06caSMauro Carvalho Chehab 1830c0d06caSMauro Carvalho Chehab /* Return a string token representative of the hardware type */ 1840c0d06caSMauro Carvalho Chehab const char *pvr2_hdw_get_type(struct pvr2_hdw *); 1850c0d06caSMauro Carvalho Chehab 1860c0d06caSMauro Carvalho Chehab /* Return a single line description of the hardware type */ 1870c0d06caSMauro Carvalho Chehab const char *pvr2_hdw_get_desc(struct pvr2_hdw *); 1880c0d06caSMauro Carvalho Chehab 1890c0d06caSMauro Carvalho Chehab /* Turn streaming on/off */ 1900c0d06caSMauro Carvalho Chehab int pvr2_hdw_set_streaming(struct pvr2_hdw *,int); 1910c0d06caSMauro Carvalho Chehab 1920c0d06caSMauro Carvalho Chehab /* Find out if streaming is on */ 1930c0d06caSMauro Carvalho Chehab int pvr2_hdw_get_streaming(struct pvr2_hdw *); 1940c0d06caSMauro Carvalho Chehab 1950c0d06caSMauro Carvalho Chehab /* Retrieve driver overall state */ 1960c0d06caSMauro Carvalho Chehab int pvr2_hdw_get_state(struct pvr2_hdw *); 1970c0d06caSMauro Carvalho Chehab 1980c0d06caSMauro Carvalho Chehab /* Configure the type of stream to generate */ 1990c0d06caSMauro Carvalho Chehab int pvr2_hdw_set_stream_type(struct pvr2_hdw *, enum pvr2_config); 2000c0d06caSMauro Carvalho Chehab 2010c0d06caSMauro Carvalho Chehab /* Get handle to video output stream */ 2020c0d06caSMauro Carvalho Chehab struct pvr2_stream *pvr2_hdw_get_video_stream(struct pvr2_hdw *); 2030c0d06caSMauro Carvalho Chehab 2040c0d06caSMauro Carvalho Chehab /* Enable / disable retrieval of CPU firmware or prom contents. This must 2050c0d06caSMauro Carvalho Chehab be enabled before pvr2_hdw_cpufw_get() will function. Note that doing 2060c0d06caSMauro Carvalho Chehab this may prevent the device from running (and leaving this mode may 2070c0d06caSMauro Carvalho Chehab imply a device reset). */ 2080c0d06caSMauro Carvalho Chehab void pvr2_hdw_cpufw_set_enabled(struct pvr2_hdw *, 2090c0d06caSMauro Carvalho Chehab int mode, /* 0=8KB FX2, 1=16KB FX2, 2=PROM */ 2100c0d06caSMauro Carvalho Chehab int enable_flag); 2110c0d06caSMauro Carvalho Chehab 2120c0d06caSMauro Carvalho Chehab /* Return true if we're in a mode for retrieval CPU firmware */ 2130c0d06caSMauro Carvalho Chehab int pvr2_hdw_cpufw_get_enabled(struct pvr2_hdw *); 2140c0d06caSMauro Carvalho Chehab 2150c0d06caSMauro Carvalho Chehab /* Retrieve a piece of the CPU's firmware at the given offset. Return 2160c0d06caSMauro Carvalho Chehab value is the number of bytes retrieved or zero if we're past the end or 2170c0d06caSMauro Carvalho Chehab an error otherwise (e.g. if firmware retrieval is not enabled). */ 2180c0d06caSMauro Carvalho Chehab int pvr2_hdw_cpufw_get(struct pvr2_hdw *,unsigned int offs, 2190c0d06caSMauro Carvalho Chehab char *buf,unsigned int cnt); 2200c0d06caSMauro Carvalho Chehab 2210c0d06caSMauro Carvalho Chehab /* Retrieve a previously stored v4l minor device number */ 2220c0d06caSMauro Carvalho Chehab int pvr2_hdw_v4l_get_minor_number(struct pvr2_hdw *,enum pvr2_v4l_type index); 2230c0d06caSMauro Carvalho Chehab 2240c0d06caSMauro Carvalho Chehab /* Store a v4l minor device number */ 2250c0d06caSMauro Carvalho Chehab void pvr2_hdw_v4l_store_minor_number(struct pvr2_hdw *, 2260c0d06caSMauro Carvalho Chehab enum pvr2_v4l_type index,int); 2270c0d06caSMauro Carvalho Chehab 2280c0d06caSMauro Carvalho Chehab /* The following entry points are all lower level things you normally don't 2290c0d06caSMauro Carvalho Chehab want to worry about. */ 2300c0d06caSMauro Carvalho Chehab 2310c0d06caSMauro Carvalho Chehab /* Issue a command and get a response from the device. LOTS of higher 2320c0d06caSMauro Carvalho Chehab level stuff is built on this. */ 2330c0d06caSMauro Carvalho Chehab int pvr2_send_request(struct pvr2_hdw *, 2340c0d06caSMauro Carvalho Chehab void *write_ptr,unsigned int write_len, 2350c0d06caSMauro Carvalho Chehab void *read_ptr,unsigned int read_len); 2360c0d06caSMauro Carvalho Chehab 2370c0d06caSMauro Carvalho Chehab /* Slightly higher level device communication functions. */ 2380c0d06caSMauro Carvalho Chehab int pvr2_write_register(struct pvr2_hdw *, u16, u32); 2390c0d06caSMauro Carvalho Chehab 2400c0d06caSMauro Carvalho Chehab /* Call if for any reason we can't talk to the hardware anymore - this will 2410c0d06caSMauro Carvalho Chehab cause the driver to stop flailing on the device. */ 2420c0d06caSMauro Carvalho Chehab void pvr2_hdw_render_useless(struct pvr2_hdw *); 2430c0d06caSMauro Carvalho Chehab 2440c0d06caSMauro Carvalho Chehab /* Set / clear 8051's reset bit */ 2450c0d06caSMauro Carvalho Chehab void pvr2_hdw_cpureset_assert(struct pvr2_hdw *,int); 2460c0d06caSMauro Carvalho Chehab 2470c0d06caSMauro Carvalho Chehab /* Execute a USB-commanded device reset */ 2480c0d06caSMauro Carvalho Chehab void pvr2_hdw_device_reset(struct pvr2_hdw *); 2490c0d06caSMauro Carvalho Chehab 2500c0d06caSMauro Carvalho Chehab /* Reset worker's error trapping circuit breaker */ 2510c0d06caSMauro Carvalho Chehab int pvr2_hdw_untrip(struct pvr2_hdw *); 2520c0d06caSMauro Carvalho Chehab 2530c0d06caSMauro Carvalho Chehab /* Execute hard reset command (after this point it's likely that the 2540c0d06caSMauro Carvalho Chehab encoder will have to be reconfigured). This also clears the "useless" 2550c0d06caSMauro Carvalho Chehab state. */ 2560c0d06caSMauro Carvalho Chehab int pvr2_hdw_cmd_deep_reset(struct pvr2_hdw *); 2570c0d06caSMauro Carvalho Chehab 2580c0d06caSMauro Carvalho Chehab /* Execute simple reset command */ 2590c0d06caSMauro Carvalho Chehab int pvr2_hdw_cmd_powerup(struct pvr2_hdw *); 2600c0d06caSMauro Carvalho Chehab 2610c0d06caSMauro Carvalho Chehab /* Order decoder to reset */ 2620c0d06caSMauro Carvalho Chehab int pvr2_hdw_cmd_decoder_reset(struct pvr2_hdw *); 2630c0d06caSMauro Carvalho Chehab 2640c0d06caSMauro Carvalho Chehab /* Direct manipulation of GPIO bits */ 2650c0d06caSMauro Carvalho Chehab int pvr2_hdw_gpio_get_dir(struct pvr2_hdw *hdw,u32 *); 2660c0d06caSMauro Carvalho Chehab int pvr2_hdw_gpio_get_out(struct pvr2_hdw *hdw,u32 *); 2670c0d06caSMauro Carvalho Chehab int pvr2_hdw_gpio_get_in(struct pvr2_hdw *hdw,u32 *); 2680c0d06caSMauro Carvalho Chehab int pvr2_hdw_gpio_chg_dir(struct pvr2_hdw *hdw,u32 msk,u32 val); 2690c0d06caSMauro Carvalho Chehab int pvr2_hdw_gpio_chg_out(struct pvr2_hdw *hdw,u32 msk,u32 val); 2700c0d06caSMauro Carvalho Chehab 2710c0d06caSMauro Carvalho Chehab /* This data structure is specifically for the next function... */ 2720c0d06caSMauro Carvalho Chehab struct pvr2_hdw_debug_info { 2730c0d06caSMauro Carvalho Chehab int big_lock_held; 2740c0d06caSMauro Carvalho Chehab int ctl_lock_held; 2750c0d06caSMauro Carvalho Chehab int flag_disconnected; 2760c0d06caSMauro Carvalho Chehab int flag_init_ok; 2770c0d06caSMauro Carvalho Chehab int flag_ok; 2780c0d06caSMauro Carvalho Chehab int fw1_state; 2790c0d06caSMauro Carvalho Chehab int flag_decoder_missed; 2800c0d06caSMauro Carvalho Chehab int flag_tripped; 2810c0d06caSMauro Carvalho Chehab int state_encoder_ok; 2820c0d06caSMauro Carvalho Chehab int state_encoder_run; 2830c0d06caSMauro Carvalho Chehab int state_decoder_run; 2840c0d06caSMauro Carvalho Chehab int state_decoder_ready; 2850c0d06caSMauro Carvalho Chehab int state_usbstream_run; 2860c0d06caSMauro Carvalho Chehab int state_decoder_quiescent; 2870c0d06caSMauro Carvalho Chehab int state_pipeline_config; 2880c0d06caSMauro Carvalho Chehab int state_pipeline_req; 2890c0d06caSMauro Carvalho Chehab int state_pipeline_pause; 2900c0d06caSMauro Carvalho Chehab int state_pipeline_idle; 2910c0d06caSMauro Carvalho Chehab int cmd_debug_state; 2920c0d06caSMauro Carvalho Chehab int cmd_debug_write_len; 2930c0d06caSMauro Carvalho Chehab int cmd_debug_read_len; 2940c0d06caSMauro Carvalho Chehab int cmd_debug_write_pend; 2950c0d06caSMauro Carvalho Chehab int cmd_debug_read_pend; 2960c0d06caSMauro Carvalho Chehab int cmd_debug_timeout; 2970c0d06caSMauro Carvalho Chehab int cmd_debug_rstatus; 2980c0d06caSMauro Carvalho Chehab int cmd_debug_wstatus; 2990c0d06caSMauro Carvalho Chehab unsigned char cmd_code; 3000c0d06caSMauro Carvalho Chehab }; 3010c0d06caSMauro Carvalho Chehab 3020c0d06caSMauro Carvalho Chehab /* Non-intrusively retrieve internal state info - this is useful for 3030c0d06caSMauro Carvalho Chehab diagnosing lockups. Note that this operation is completed without any 3040c0d06caSMauro Carvalho Chehab kind of locking and so it is not atomic and may yield inconsistent 3050c0d06caSMauro Carvalho Chehab results. This is *purely* a debugging aid. */ 3060c0d06caSMauro Carvalho Chehab void pvr2_hdw_get_debug_info_unlocked(const struct pvr2_hdw *hdw, 3070c0d06caSMauro Carvalho Chehab struct pvr2_hdw_debug_info *); 3080c0d06caSMauro Carvalho Chehab 3090c0d06caSMauro Carvalho Chehab /* Intrusively retrieve internal state info - this is useful for 3100c0d06caSMauro Carvalho Chehab diagnosing overall driver state. This operation synchronizes against 3110c0d06caSMauro Carvalho Chehab the overall driver mutex - so if there are locking problems this will 3120c0d06caSMauro Carvalho Chehab likely hang! This is *purely* a debugging aid. */ 3130c0d06caSMauro Carvalho Chehab void pvr2_hdw_get_debug_info_locked(struct pvr2_hdw *hdw, 3140c0d06caSMauro Carvalho Chehab struct pvr2_hdw_debug_info *); 3150c0d06caSMauro Carvalho Chehab 3160c0d06caSMauro Carvalho Chehab /* Report out several lines of text that describes driver internal state. 3170c0d06caSMauro Carvalho Chehab Results are written into the passed-in buffer. */ 3180c0d06caSMauro Carvalho Chehab unsigned int pvr2_hdw_state_report(struct pvr2_hdw *hdw, 3190c0d06caSMauro Carvalho Chehab char *buf_ptr,unsigned int buf_size); 3200c0d06caSMauro Carvalho Chehab 3210c0d06caSMauro Carvalho Chehab /* Cause modules to log their state once */ 3220c0d06caSMauro Carvalho Chehab void pvr2_hdw_trigger_module_log(struct pvr2_hdw *hdw); 3230c0d06caSMauro Carvalho Chehab 3240c0d06caSMauro Carvalho Chehab /* Cause encoder firmware to be uploaded into the device. This is normally 3250c0d06caSMauro Carvalho Chehab done autonomously, but the interface is exported here because it is also 3260c0d06caSMauro Carvalho Chehab a debugging aid. */ 3270c0d06caSMauro Carvalho Chehab int pvr2_upload_firmware2(struct pvr2_hdw *hdw); 3280c0d06caSMauro Carvalho Chehab 3290c0d06caSMauro Carvalho Chehab #endif /* __PVRUSB2_HDW_H */ 330