Commit 567d7115 authored by Mike Isely's avatar Mike Isely Committed by Mauro Carvalho Chehab

V4L/DVB (5172): Pvrusb2: Control protocol cleanup

Several special-case FX2 commands were being issued through
pvr2_write_u16() and pvr2_write_8(), but there's really nothing
special case about them.  These date from a very early time in the
driver development.  This patch removes these functions and replaces
their use with calls to pvr2_send_request.
Signed-off-by: default avatarMike Isely <isely@pobox.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent edae96bd
......@@ -29,6 +29,7 @@
#define FX2CMD_REG_WRITE 0x04
#define FX2CMD_REG_READ 0x05
#define FX2CMD_MEMSEL 0x06
#define FX2CMD_I2C_WRITE 0x08
#define FX2CMD_I2C_READ 0x09
......@@ -38,6 +39,8 @@
#define FX2CMD_STREAMING_ON 0x36
#define FX2CMD_STREAMING_OFF 0x37
#define FX2CMD_FWPOST1 0x52
#define FX2CMD_POWER_OFF 0xdc
#define FX2CMD_POWER_ON 0xde
......
......@@ -271,8 +271,6 @@ static int pvr2_send_request_ex(struct pvr2_hdw *hdw,
unsigned int timeout,int probe_fl,
void *write_data,unsigned int write_len,
void *read_data,unsigned int read_len);
static int pvr2_write_u16(struct pvr2_hdw *hdw, u16 data, int res);
static int pvr2_write_u8(struct pvr2_hdw *hdw, u8 data, int res);
static int ctrl_channelfreq_get(struct pvr2_ctrl *cptr,int *vp)
{
......@@ -1248,8 +1246,13 @@ int pvr2_upload_firmware2(struct pvr2_hdw *hdw)
ret |= pvr2_write_register(hdw, 0xaa04, 0x00057810); /*unknown*/
ret |= pvr2_write_register(hdw, 0xaa10, 0x00148500); /*unknown*/
ret |= pvr2_write_register(hdw, 0xaa18, 0x00840000); /*unknown*/
ret |= pvr2_write_u8(hdw, 0x52, 0);
ret |= pvr2_write_u16(hdw, 0x0600, 0);
LOCK_TAKE(hdw->ctl_lock); do {
hdw->cmd_buffer[0] = FX2CMD_FWPOST1;
ret |= pvr2_send_request(hdw,hdw->cmd_buffer,1,0,0);
hdw->cmd_buffer[0] = FX2CMD_MEMSEL;
hdw->cmd_buffer[1] = 0;
ret |= pvr2_send_request(hdw,hdw->cmd_buffer,2,0,0);
} while (0); LOCK_GIVE(hdw->ctl_lock);
if (ret) {
pvr2_trace(PVR2_TRACE_ERROR_LEGS,
......@@ -1311,7 +1314,11 @@ int pvr2_upload_firmware2(struct pvr2_hdw *hdw)
ret |= pvr2_write_register(hdw, 0x9054, 0xffffffff); /*reset hw blocks*/
ret |= pvr2_write_register(hdw, 0x9058, 0xffffffe8); /*VPU ctrl*/
ret |= pvr2_write_u16(hdw, 0x0600, 0);
LOCK_TAKE(hdw->ctl_lock); do {
hdw->cmd_buffer[0] = FX2CMD_MEMSEL;
hdw->cmd_buffer[1] = 0;
ret |= pvr2_send_request(hdw,hdw->cmd_buffer,2,0,0);
} while (0); LOCK_GIVE(hdw->ctl_lock);
if (ret) {
pvr2_trace(PVR2_TRACE_ERROR_LEGS,
......@@ -3016,39 +3023,6 @@ static int pvr2_read_register(struct pvr2_hdw *hdw, u16 reg, u32 *data)
}
static int pvr2_write_u16(struct pvr2_hdw *hdw, u16 data, int res)
{
int ret;
LOCK_TAKE(hdw->ctl_lock);
hdw->cmd_buffer[0] = (data >> 8) & 0xff;
hdw->cmd_buffer[1] = data & 0xff;
ret = pvr2_send_request(hdw, hdw->cmd_buffer, 2, hdw->cmd_buffer, res);
LOCK_GIVE(hdw->ctl_lock);
return ret;
}
static int pvr2_write_u8(struct pvr2_hdw *hdw, u8 data, int res)
{
int ret;
LOCK_TAKE(hdw->ctl_lock);
hdw->cmd_buffer[0] = data;
ret = pvr2_send_request(hdw, hdw->cmd_buffer, 1, hdw->cmd_buffer, res);
LOCK_GIVE(hdw->ctl_lock);
return ret;
}
static void pvr2_hdw_render_useless_unlocked(struct pvr2_hdw *hdw)
{
if (!hdw->flag_ok) return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment