Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 294987
b: refs/heads/master
c: 1b3b212
h: refs/heads/master
i:
  294985: 1e34b7a
  294983: f80339f
v: v3
  • Loading branch information
Jean-François Moine authored and Mauro Carvalho Chehab committed Mar 8, 2012
1 parent 4179847 commit 2c10fe7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 36 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f1801904eeb79f46e7854e4d18c7107160a16093
refs/heads/master: 1b3b21206b7506a1abdd411419bc871438efc89c
48 changes: 13 additions & 35 deletions trunk/drivers/media/video/gspca/zc3xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -5643,7 +5643,7 @@ static const struct usb_action gc0303_NoFlikerScale[] = {
{}
};

static u8 reg_r_i(struct gspca_dev *gspca_dev,
static u8 reg_r(struct gspca_dev *gspca_dev,
u16 index)
{
int ret;
Expand All @@ -5658,24 +5658,14 @@ static u8 reg_r_i(struct gspca_dev *gspca_dev,
index, gspca_dev->usb_buf, 1,
500);
if (ret < 0) {
pr_err("reg_r_i err %d\n", ret);
pr_err("reg_r err %d\n", ret);
gspca_dev->usb_err = ret;
return 0;
}
return gspca_dev->usb_buf[0];
}

static u8 reg_r(struct gspca_dev *gspca_dev,
u16 index)
{
u8 ret;

ret = reg_r_i(gspca_dev, index);
PDEBUG(D_USBI, "reg r [%04x] -> %02x", index, ret);
return ret;
}

static void reg_w_i(struct gspca_dev *gspca_dev,
static void reg_w(struct gspca_dev *gspca_dev,
u8 value,
u16 index)
{
Expand All @@ -5695,14 +5685,6 @@ static void reg_w_i(struct gspca_dev *gspca_dev,
}
}

static void reg_w(struct gspca_dev *gspca_dev,
u8 value,
u16 index)
{
PDEBUG(D_USBO, "reg w [%04x] = %02x", index, value);
reg_w_i(gspca_dev, value, index);
}

static u16 i2c_read(struct gspca_dev *gspca_dev,
u8 reg)
{
Expand All @@ -5711,16 +5693,14 @@ static u16 i2c_read(struct gspca_dev *gspca_dev,

if (gspca_dev->usb_err < 0)
return 0;
reg_w_i(gspca_dev, reg, 0x0092);
reg_w_i(gspca_dev, 0x02, 0x0090); /* <- read command */
reg_w(gspca_dev, reg, 0x0092);
reg_w(gspca_dev, 0x02, 0x0090); /* <- read command */
msleep(20);
retbyte = reg_r_i(gspca_dev, 0x0091); /* read status */
retbyte = reg_r(gspca_dev, 0x0091); /* read status */
if (retbyte != 0x00)
pr_err("i2c_r status error %02x\n", retbyte);
retval = reg_r_i(gspca_dev, 0x0095); /* read Lowbyte */
retval |= reg_r_i(gspca_dev, 0x0096) << 8; /* read Hightbyte */
PDEBUG(D_USBI, "i2c r [%02x] -> %04x (%02x)",
reg, retval, retbyte);
retval = reg_r(gspca_dev, 0x0095); /* read Lowbyte */
retval |= reg_r(gspca_dev, 0x0096) << 8; /* read Hightbyte */
return retval;
}

Expand All @@ -5733,16 +5713,14 @@ static u8 i2c_write(struct gspca_dev *gspca_dev,

if (gspca_dev->usb_err < 0)
return 0;
reg_w_i(gspca_dev, reg, 0x92);
reg_w_i(gspca_dev, valL, 0x93);
reg_w_i(gspca_dev, valH, 0x94);
reg_w_i(gspca_dev, 0x01, 0x90); /* <- write command */
reg_w(gspca_dev, reg, 0x92);
reg_w(gspca_dev, valL, 0x93);
reg_w(gspca_dev, valH, 0x94);
reg_w(gspca_dev, 0x01, 0x90); /* <- write command */
msleep(1);
retbyte = reg_r_i(gspca_dev, 0x0091); /* read status */
retbyte = reg_r(gspca_dev, 0x0091); /* read status */
if (retbyte != 0x00)
pr_err("i2c_w status error %02x\n", retbyte);
PDEBUG(D_USBO, "i2c w [%02x] = %02x%02x (%02x)",
reg, valH, valL, retbyte);
return retbyte;
}

Expand Down

0 comments on commit 2c10fe7

Please sign in to comment.