Commit 9e1e7b06 authored by Antonio Ospite's avatar Antonio Ospite Committed by Mauro Carvalho Chehab

V4L/DVB (9856): gspca: Use u8 values for USB control messages in ov534.

Signed-off-by: default avatarAntonio Ospite <ospite@studenti.unina.it>
Signed-off-by: default avatarJean-Francois Moine <moinejf@free.fr>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 3adba442
...@@ -62,12 +62,12 @@ static struct v4l2_pix_format vga_mode[] = { ...@@ -62,12 +62,12 @@ static struct v4l2_pix_format vga_mode[] = {
.priv = 0}, .priv = 0},
}; };
static void ov534_reg_write(struct usb_device *udev, u16 reg, u16 val) static void ov534_reg_write(struct usb_device *udev, u16 reg, u8 val)
{ {
u16 data = val; u8 data = val;
int ret; int ret;
PDEBUG(D_USBO, "reg=0x%04x, val=0%04x", reg, val); PDEBUG(D_USBO, "reg=0x%04x, val=0%02x", reg, val);
ret = usb_control_msg(udev, ret = usb_control_msg(udev,
usb_sndctrlpipe(udev, 0), usb_sndctrlpipe(udev, 0),
0x1, 0x1,
...@@ -77,9 +77,9 @@ static void ov534_reg_write(struct usb_device *udev, u16 reg, u16 val) ...@@ -77,9 +77,9 @@ static void ov534_reg_write(struct usb_device *udev, u16 reg, u16 val)
PDEBUG(D_ERR, "write failed"); PDEBUG(D_ERR, "write failed");
} }
static u16 ov534_reg_read(struct usb_device *udev, u16 reg) static u8 ov534_reg_read(struct usb_device *udev, u16 reg)
{ {
u16 data; u8 data;
int ret; int ret;
ret = usb_control_msg(udev, ret = usb_control_msg(udev,
...@@ -87,21 +87,21 @@ static u16 ov534_reg_read(struct usb_device *udev, u16 reg) ...@@ -87,21 +87,21 @@ static u16 ov534_reg_read(struct usb_device *udev, u16 reg)
0x1, 0x1,
USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
0x0, reg, &data, 1, CTRL_TIMEOUT); 0x0, reg, &data, 1, CTRL_TIMEOUT);
PDEBUG(D_USBI, "reg=0x%04x, data=0x%04x", reg, data); PDEBUG(D_USBI, "reg=0x%04x, data=0x%02x", reg, data);
if (ret < 0) if (ret < 0)
PDEBUG(D_ERR, "read failed"); PDEBUG(D_ERR, "read failed");
return data; return data;
} }
static void ov534_reg_verify_write(struct usb_device *udev, u16 reg, u16 val) static void ov534_reg_verify_write(struct usb_device *udev, u16 reg, u8 val)
{ {
u16 data; u8 data;
ov534_reg_write(udev, reg, val); ov534_reg_write(udev, reg, val);
data = ov534_reg_read(udev, reg); data = ov534_reg_read(udev, reg);
if (data != val) { if (data != val) {
PDEBUG(D_ERR | D_USBO, PDEBUG(D_ERR | D_USBO,
"unexpected result from read: 0x%04x != 0x%04x", val, "unexpected result from read: 0x%02x != 0x%02x", val,
data); data);
} }
} }
...@@ -110,7 +110,7 @@ static void ov534_reg_verify_write(struct usb_device *udev, u16 reg, u16 val) ...@@ -110,7 +110,7 @@ static void ov534_reg_verify_write(struct usb_device *udev, u16 reg, u16 val)
* (direction and output)? */ * (direction and output)? */
static void ov534_set_led(struct usb_device *udev, int status) static void ov534_set_led(struct usb_device *udev, int status)
{ {
u16 data; u8 data;
PDEBUG(D_CONF, "led status: %d", status); PDEBUG(D_CONF, "led status: %d", status);
...@@ -129,13 +129,13 @@ static void ov534_set_led(struct usb_device *udev, int status) ...@@ -129,13 +129,13 @@ static void ov534_set_led(struct usb_device *udev, int status)
static int sccb_check_status(struct usb_device *udev) static int sccb_check_status(struct usb_device *udev)
{ {
u16 data; u8 data;
int i; int i;
for (i = 0; i < 5; i++) { for (i = 0; i < 5; i++) {
data = ov534_reg_read(udev, OV534_REG_STATUS); data = ov534_reg_read(udev, OV534_REG_STATUS);
switch (data & 0xFF) { switch (data) {
case 0x00: case 0x00:
return 1; return 1;
case 0x04: case 0x04:
...@@ -150,9 +150,9 @@ static int sccb_check_status(struct usb_device *udev) ...@@ -150,9 +150,9 @@ static int sccb_check_status(struct usb_device *udev)
return 0; return 0;
} }
static void sccb_reg_write(struct usb_device *udev, u16 reg, u16 val) static void sccb_reg_write(struct usb_device *udev, u16 reg, u8 val)
{ {
PDEBUG(D_USBO, "reg: 0x%04x, val: 0x%04x", reg, val); PDEBUG(D_USBO, "reg: 0x%04x, val: 0x%02x", reg, val);
ov534_reg_write(udev, OV534_REG_SUBADDR, reg); ov534_reg_write(udev, OV534_REG_SUBADDR, reg);
ov534_reg_write(udev, OV534_REG_WRITE, val); ov534_reg_write(udev, OV534_REG_WRITE, val);
ov534_reg_write(udev, OV534_REG_OPERATION, OV534_OP_WRITE_3); ov534_reg_write(udev, OV534_REG_OPERATION, OV534_OP_WRITE_3);
......
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