summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.h
diff options
context:
space:
mode:
Diffstat (limited to 'linux/drivers/media/video/pvrusb2/pvrusb2-hdw.h')
-rw-r--r--linux/drivers/media/video/pvrusb2/pvrusb2-hdw.h156
1 files changed, 33 insertions, 123 deletions
diff --git a/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.h b/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.h
index 4101f4097..4e886328d 100644
--- a/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.h
+++ b/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.h
@@ -25,41 +25,25 @@
#include <linux/usb.h>
#include <linux/videodev2.h>
#include "pvrusb2-io.h"
+#include "pvrusb2-ctrl.h"
-#define PVR2_CTRL_TYPE_INVALID 0
-#define PVR2_CTRL_TYPE_ENUM 1
-#define PVR2_CTRL_TYPE_INT 2
-#define PVR2_CTRL_TYPE_BITMASK 3
-
-/* Private V4L2-compatible controls available in this driver */
-#define V4L2_CID_PVR_SRATE (V4L2_CID_PRIVATE_BASE)
-#define V4L2_CID_PVR_AUDIOBITRATE (V4L2_CID_PRIVATE_BASE+1)
-#define V4L2_CID_PVR_AUDIOCRC (V4L2_CID_PRIVATE_BASE+2)
-#define V4L2_CID_PVR_AUDIOEMPHASIS (V4L2_CID_PRIVATE_BASE+3)
-#define V4L2_CID_PVR_VBR (V4L2_CID_PRIVATE_BASE+4)
-#define V4L2_CID_PVR_VIDEOBITRATE (V4L2_CID_PRIVATE_BASE+5)
-#define V4L2_CID_PVR_VIDEOPEAK (V4L2_CID_PRIVATE_BASE+6)
-#define V4L2_CID_PVR_VIDEOSTANDARD (V4L2_CID_PRIVATE_BASE+7)
-
-/* Deliberate gap for CIDs we don't want apps to discover */
-#define V4L2_CID_PVR_GAP (V4L2_CID_PRIVATE_BASE+8)
-
-/* Additional explicit controls needed by V4L2 ioctl implementation */
-#define V4L2_CID_PVR_STDCUR (V4L2_CID_PVR_GAP+1)
-#define V4L2_CID_PVR_INPUT (V4L2_CID_PVR_GAP+2)
-#define V4L2_CID_PVR_AUDIOMODE (V4L2_CID_PVR_GAP+3)
-#define V4L2_CID_PVR_FREQUENCY (V4L2_CID_PVR_GAP+4)
-#define V4L2_CID_PVR_HRES (V4L2_CID_PVR_GAP+5)
-#define V4L2_CID_PVR_VRES (V4L2_CID_PVR_GAP+6)
-#define V4L2_CID_PVR_INTERLACE (V4L2_CID_PVR_GAP+7)
+
+/* Private internal control ids, look these up with
+ pvr2_hdw_get_ctrl_by_id() - these are NOT visible in V4L */
+#define PVR2_CID_STDENUM 1
+#define PVR2_CID_STDCUR 2
+#define PVR2_CID_STDAVAIL 3
+#define PVR2_CID_INPUT 4
+#define PVR2_CID_AUDIOMODE 5
+#define PVR2_CID_FREQUENCY 6
+#define PVR2_CID_HRES 7
+#define PVR2_CID_VRES 8
/* Legal values for the INPUT state variable */
#define PVR2_CVAL_INPUT_TV 0
#define PVR2_CVAL_INPUT_SVIDEO 1
#define PVR2_CVAL_INPUT_COMPOSITE 2
#define PVR2_CVAL_INPUT_RADIO 3
-#define PVR2_CVAL_INPUT_MIN PVR2_CVAL_INPUT_TV
-#define PVR2_CVAL_INPUT_MAX PVR2_CVAL_INPUT_RADIO
/* Values that pvr2_hdw_get_signal_status() returns */
#define PVR2_SIGNAL_OK 0x0001
@@ -71,19 +55,19 @@
independently stopped / started. Usually you don't want to mess with
this directly (let the driver handle things itself), but it is useful
for debugging. */
-#define PVR2_SUBSYS_ENC_FIRMWARE (1 << 0)
-#define PVR2_SUBSYS_ENC_CFG (1 << 1)
-#define PVR2_SUBSYS_DIGITIZER_RUN (1 << 2)
-#define PVR2_SUBSYS_USBSTREAM_RUN (1 << 3)
-#define PVR2_SUBSYS_ENC_RUN (1 << 4)
+#define PVR2_SUBSYS_B_ENC_FIRMWARE 0
+#define PVR2_SUBSYS_B_ENC_CFG 1
+#define PVR2_SUBSYS_B_DIGITIZER_RUN 2
+#define PVR2_SUBSYS_B_USBSTREAM_RUN 3
+#define PVR2_SUBSYS_B_ENC_RUN 4
#define PVR2_SUBSYS_CFG_ALL ( \
- PVR2_SUBSYS_ENC_FIRMWARE | \
- PVR2_SUBSYS_ENC_CFG )
+ (1 << PVR2_SUBSYS_B_ENC_FIRMWARE) | \
+ (1 << PVR2_SUBSYS_B_ENC_CFG) )
#define PVR2_SUBSYS_RUN_ALL ( \
- PVR2_SUBSYS_DIGITIZER_RUN | \
- PVR2_SUBSYS_USBSTREAM_RUN | \
- PVR2_SUBSYS_ENC_RUN )
+ (1 << PVR2_SUBSYS_B_DIGITIZER_RUN) | \
+ (1 << PVR2_SUBSYS_B_USBSTREAM_RUN) | \
+ (1 << PVR2_SUBSYS_B_ENC_RUN) )
#define PVR2_SUBSYS_ALL ( \
PVR2_SUBSYS_CFG_ALL | \
PVR2_SUBSYS_RUN_ALL )
@@ -99,8 +83,6 @@ const char *pvr2_config_get_name(enum pvr2_config);
struct pvr2_hdw;
-struct pvr2_ctrl;
-
/* Create and return a structure for interacting with the underlying
hardware */
struct pvr2_hdw *pvr2_hdw_create(struct usb_interface *intf,
@@ -110,7 +92,6 @@ struct pvr2_hdw *pvr2_hdw_create(struct usb_interface *intf,
void pvr2_hdw_poll(struct pvr2_hdw *);
/* Trigger a poll to take place later at a convenient time */
-void pvr2_hdw_poll_trigger(struct pvr2_hdw *);
void pvr2_hdw_poll_trigger_unlocked(struct pvr2_hdw *);
/* Register a callback used to trigger a future poll */
@@ -118,9 +99,6 @@ void pvr2_hdw_setup_poll_trigger(struct pvr2_hdw *,
void (*func)(void *),
void *data);
-/* Get pointer to structure given unit number */
-struct pvr2_hdw *pvr2_hdw_find(int unit_number);
-
/* Destroy hardware interaction structure */
void pvr2_hdw_destroy(struct pvr2_hdw *);
@@ -155,59 +133,15 @@ unsigned int pvr2_hdw_get_ctrl_count(struct pvr2_hdw *);
/* Retrieve a control handle given its index (0..count-1) */
struct pvr2_ctrl *pvr2_hdw_get_ctrl_by_index(struct pvr2_hdw *,unsigned int);
-/* Retrieve a control handle given its well known ID */
-struct pvr2_ctrl *pvr2_hdw_get_ctrl(struct pvr2_hdw *,unsigned int ctl_id);
-
-/* Set the current value of the given control. */
-int pvr2_ctrl_set_value(struct pvr2_ctrl *,int val);
-
-/* Get the current value of the given control. */
-int pvr2_ctrl_get_value(struct pvr2_ctrl *);
-
-/* Return the type of the given control (int, enum, or bit mask). */
-int pvr2_ctrl_get_type(struct pvr2_ctrl *);
-
-/* Return the minimum legal value for a given control. This command is
- only relevant for int or enum types. */
-int pvr2_ctrl_get_min_value(struct pvr2_ctrl *);
-
-/* Return the maximum legal value for a given control. This command is
- only relevant for int or enum types. */
-int pvr2_ctrl_get_max_value(struct pvr2_ctrl *);
-
-/* Return a mask of which bits are used within the bit mask of a given
- control. This command is only relevant for bit mask types. */
-int pvr2_ctrl_get_mask_value(struct pvr2_ctrl *);
-
-/* Return the default value for a given control. */
-int pvr2_ctrl_get_default_value(struct pvr2_ctrl *);
-
-/* Return true if this is a valid control. */
-int pvr2_ctrl_is_valid(struct pvr2_ctrl *);
+/* Retrieve a control handle given its internal ID (if any) */
+struct pvr2_ctrl *pvr2_hdw_get_ctrl_by_id(struct pvr2_hdw *,unsigned int);
-/* Return true if the control can be set (otherwise it may only be read,
- assuming that it is valid). */
-int pvr2_ctrl_is_writeable(struct pvr2_ctrl *);
+/* Retrieve a control handle given its V4L ID (if any) */
+struct pvr2_ctrl *pvr2_hdw_get_ctrl_v4l(struct pvr2_hdw *,unsigned int ctl_id);
-/* Return the control's name, or null if there isn't a name or the control
- isn't otherwise valid. */
-const char *pvr2_ctrl_get_name(struct pvr2_ctrl *);
-
-/* Return the control's description, or null if there isn't a name or the
- control isn't otherwise valid. */
-const char *pvr2_ctrl_get_desc(struct pvr2_ctrl *);
-
-/* Return the name for an enumeration value or bit mask position for the
- given control. If the control is not an enumeration or bit mask type,
- then return null. */
-const char *pvr2_ctrl_get_value_name(struct pvr2_ctrl *,int val);
-
-/* Return the number of support standard groups */
-unsigned int pvr2_hdw_get_stdenum_count(struct pvr2_hdw *);
-
-/* Return a pointer to a v4l2 standard descriptor for a given group */
-const struct v4l2_standard *pvr2_hdw_get_stdenum_value(struct pvr2_hdw *,
- unsigned int idx);
+/* Retrieve a control handle given its immediate predecessor V4L ID (if any) */
+struct pvr2_ctrl *pvr2_hdw_get_ctrl_nextv4l(struct pvr2_hdw *,
+ unsigned int ctl_id);
/* Commit all control changes made up to this point */
int pvr2_hdw_commit_ctl(struct pvr2_hdw *);
@@ -233,18 +167,16 @@ int pvr2_hdw_set_stream_type(struct pvr2_hdw *, enum pvr2_config);
/* Get handle to video output stream */
struct pvr2_stream *pvr2_hdw_get_video_stream(struct pvr2_hdw *);
+/* Emit a video standard struct */
+int pvr2_hdw_get_stdenum_value(struct pvr2_hdw *hdw,struct v4l2_standard *std,
+ unsigned int idx);
+
/* Enable / disable various pieces of hardware. Items to change are
identified by bit positions within msk, and new state for each item is
identified by corresponding bit positions within val. */
void pvr2_hdw_subsys_bit_chg(struct pvr2_hdw *hdw,
unsigned long msk,unsigned long val);
-/* Shortcut for pvr2_hdw_subsys_bit_chg(hdw,msk,msk) */
-void pvr2_hdw_subsys_bit_set(struct pvr2_hdw *hdw,unsigned long msk);
-
-/* Shortcut for pvr2_hdw_subsys_bit_chg(hdw,msk,0) */
-void pvr2_hdw_subsys_bit_clr(struct pvr2_hdw *hdw,unsigned long msk);
-
/* Retrieve mask indicating which pieces of hardware are currently enabled
/ configured. */
unsigned long pvr2_hdw_subsys_get(struct pvr2_hdw *);
@@ -284,34 +216,18 @@ void pvr2_hdw_v4l_store_minor_number(struct pvr2_hdw *,int);
/* The following entry points are all lower level things you normally don't
want to worry about. */
-/* Attempt to recover from a USB foul-up (in practice I find that if you
- have to do this, then it's already too late). */
-void pvr2_reset_ctl_endpoints(struct pvr2_hdw *hdw);
-
/* Issue a command and get a response from the device. LOTS of higher
level stuff is built on this. */
int pvr2_send_request(struct pvr2_hdw *,
void *write_ptr,unsigned int write_len,
void *read_ptr,unsigned int read_len);
-/* Issue a command and get a response from the device. This extended
- version includes a probe flag (which if set means that device errors
- should not be logged or treated as fatal) and a timeout in jiffies.
- This can be used to non-lethally probe the health of endpoint 1. */
-int pvr2_send_request_ex(struct pvr2_hdw *,unsigned int timeout,int probe_fl,
- void *write_ptr,unsigned int write_len,
- void *read_ptr,unsigned int read_len);
-
/* Slightly higher level device communication functions. */
int pvr2_write_register(struct pvr2_hdw *, u16, u32);
-int pvr2_read_register(struct pvr2_hdw *, u16, u32 *);
-int pvr2_write_u16(struct pvr2_hdw *, u16, int);
-int pvr2_write_u8(struct pvr2_hdw *, u8, int);
/* Call if for any reason we can't talk to the hardware anymore - this will
cause the driver to stop flailing on the device. */
void pvr2_hdw_render_useless(struct pvr2_hdw *);
-void pvr2_hdw_render_useless_unlocked(struct pvr2_hdw *);
/* Set / clear 8051's reset bit */
void pvr2_hdw_cpureset_assert(struct pvr2_hdw *,int);
@@ -330,12 +246,6 @@ int pvr2_hdw_cmd_powerup(struct pvr2_hdw *);
/* Order decoder to reset */
int pvr2_hdw_cmd_decoder_reset(struct pvr2_hdw *);
-/* Stop / start video stream transport */
-int pvr2_hdw_cmd_usbstream(struct pvr2_hdw *hdw,int runFl);
-
-/* Find I2C address of eeprom */
-int pvr2_hdw_get_eeprom_addr(struct pvr2_hdw *);
-
/* Direct manipulation of GPIO bits */
int pvr2_hdw_gpio_get_dir(struct pvr2_hdw *hdw,u32 *);
int pvr2_hdw_gpio_get_out(struct pvr2_hdw *hdw,u32 *);