diff options
Diffstat (limited to 'drivers/media/usb/gspca/ov519.c')
-rw-r--r-- | drivers/media/usb/gspca/ov519.c | 81 |
1 files changed, 53 insertions, 28 deletions
diff --git a/drivers/media/usb/gspca/ov519.c b/drivers/media/usb/gspca/ov519.c index 9ad19a7ef81..a3958ee8681 100644 --- a/drivers/media/usb/gspca/ov519.c +++ b/drivers/media/usb/gspca/ov519.c @@ -2034,6 +2034,7 @@ static unsigned char ov7670_abs_to_sm(unsigned char v) /* Write a OV519 register */ static void reg_w(struct sd *sd, u16 index, u16 value) { + struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; int ret, req = 0; if (sd->gspca_dev.usb_err < 0) @@ -2071,7 +2072,7 @@ static void reg_w(struct sd *sd, u16 index, u16 value) sd->gspca_dev.usb_buf, 1, 500); leave: if (ret < 0) { - pr_err("reg_w %02x failed %d\n", index, ret); + PERR("reg_w %02x failed %d\n", index, ret); sd->gspca_dev.usb_err = ret; return; } @@ -2081,6 +2082,7 @@ leave: /* returns: negative is error, pos or zero is data */ static int reg_r(struct sd *sd, u16 index) { + struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; int ret; int req; @@ -2110,7 +2112,7 @@ static int reg_r(struct sd *sd, u16 index) PDEBUG(D_USBI, "GET %02x 0000 %04x %02x", req, index, ret); } else { - pr_err("reg_r %02x failed %d\n", index, ret); + PERR("reg_r %02x failed %d\n", index, ret); sd->gspca_dev.usb_err = ret; } @@ -2121,6 +2123,7 @@ static int reg_r(struct sd *sd, u16 index) static int reg_r8(struct sd *sd, u16 index) { + struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; int ret; if (sd->gspca_dev.usb_err < 0) @@ -2135,7 +2138,7 @@ static int reg_r8(struct sd *sd, if (ret >= 0) { ret = sd->gspca_dev.usb_buf[0]; } else { - pr_err("reg_r8 %02x failed %d\n", index, ret); + PERR("reg_r8 %02x failed %d\n", index, ret); sd->gspca_dev.usb_err = ret; } @@ -2174,6 +2177,7 @@ static void reg_w_mask(struct sd *sd, */ static void ov518_reg_w32(struct sd *sd, u16 index, u32 value, int n) { + struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; int ret; if (sd->gspca_dev.usb_err < 0) @@ -2188,13 +2192,14 @@ static void ov518_reg_w32(struct sd *sd, u16 index, u32 value, int n) 0, index, sd->gspca_dev.usb_buf, n, 500); if (ret < 0) { - pr_err("reg_w32 %02x failed %d\n", index, ret); + PERR("reg_w32 %02x failed %d\n", index, ret); sd->gspca_dev.usb_err = ret; } } static void ov511_i2c_w(struct sd *sd, u8 reg, u8 value) { + struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; int rc, retries; PDEBUG(D_USBO, "ov511_i2c_w %02x %02x", reg, value); @@ -2228,6 +2233,7 @@ static void ov511_i2c_w(struct sd *sd, u8 reg, u8 value) static int ov511_i2c_r(struct sd *sd, u8 reg) { + struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; int rc, value, retries; /* Two byte write cycle */ @@ -2300,6 +2306,8 @@ static void ov518_i2c_w(struct sd *sd, u8 reg, u8 value) { + struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; + PDEBUG(D_USBO, "ov518_i2c_w %02x %02x", reg, value); /* Select camera register */ @@ -2325,6 +2333,7 @@ static void ov518_i2c_w(struct sd *sd, */ static int ov518_i2c_r(struct sd *sd, u8 reg) { + struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; int value; /* Select camera register */ @@ -2345,6 +2354,7 @@ static int ov518_i2c_r(struct sd *sd, u8 reg) static void ovfx2_i2c_w(struct sd *sd, u8 reg, u8 value) { + struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; int ret; if (sd->gspca_dev.usb_err < 0) @@ -2357,7 +2367,7 @@ static void ovfx2_i2c_w(struct sd *sd, u8 reg, u8 value) (u16) value, (u16) reg, NULL, 0, 500); if (ret < 0) { - pr_err("ovfx2_i2c_w %02x failed %d\n", reg, ret); + PERR("ovfx2_i2c_w %02x failed %d\n", reg, ret); sd->gspca_dev.usb_err = ret; } @@ -2366,6 +2376,7 @@ static void ovfx2_i2c_w(struct sd *sd, u8 reg, u8 value) static int ovfx2_i2c_r(struct sd *sd, u8 reg) { + struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; int ret; if (sd->gspca_dev.usb_err < 0) @@ -2381,7 +2392,7 @@ static int ovfx2_i2c_r(struct sd *sd, u8 reg) ret = sd->gspca_dev.usb_buf[0]; PDEBUG(D_USBI, "ovfx2_i2c_r %02x %02x", reg, ret); } else { - pr_err("ovfx2_i2c_r %02x failed %d\n", reg, ret); + PERR("ovfx2_i2c_r %02x failed %d\n", reg, ret); sd->gspca_dev.usb_err = ret; } @@ -2478,6 +2489,8 @@ static void i2c_w_mask(struct sd *sd, * registers while the camera is streaming */ static inline void ov51x_stop(struct sd *sd) { + struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; + PDEBUG(D_STREAM, "stopping"); sd->stopped = 1; switch (sd->bridge) { @@ -2507,6 +2520,8 @@ static inline void ov51x_stop(struct sd *sd) * actually stopped (for performance). */ static inline void ov51x_restart(struct sd *sd) { + struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; + PDEBUG(D_STREAM, "restarting"); if (!sd->stopped) return; @@ -2545,6 +2560,7 @@ static void ov51x_set_slave_ids(struct sd *sd, u8 slave); static int init_ov_sensor(struct sd *sd, u8 slave) { int i; + struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; ov51x_set_slave_ids(sd, slave); @@ -2624,10 +2640,11 @@ static void write_i2c_regvals(struct sd *sd, /* This initializes the OV2x10 / OV3610 / OV3620 / OV9600 */ static void ov_hires_configure(struct sd *sd) { + struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; int high, low; if (sd->bridge != BRIDGE_OVFX2) { - pr_err("error hires sensors only supported with ovfx2\n"); + PERR("error hires sensors only supported with ovfx2\n"); return; } @@ -2662,7 +2679,7 @@ static void ov_hires_configure(struct sd *sd) } break; } - pr_err("Error unknown sensor type: %02x%02x\n", high, low); + PERR("Error unknown sensor type: %02x%02x\n", high, low); } /* This initializes the OV8110, OV8610 sensor. The OV8110 uses @@ -2670,6 +2687,7 @@ static void ov_hires_configure(struct sd *sd) */ static void ov8xx0_configure(struct sd *sd) { + struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; int rc; PDEBUG(D_PROBE, "starting ov8xx0 configuration"); @@ -2677,13 +2695,13 @@ static void ov8xx0_configure(struct sd *sd) /* Detect sensor (sub)type */ rc = i2c_r(sd, OV7610_REG_COM_I); if (rc < 0) { - PDEBUG(D_ERR, "Error detecting sensor type"); + PERR("Error detecting sensor type"); return; } if ((rc & 3) == 1) sd->sensor = SEN_OV8610; else - pr_err("Unknown image sensor version: %d\n", rc & 3); + PERR("Unknown image sensor version: %d\n", rc & 3); } /* This initializes the OV7610, OV7620, or OV76BE sensor. The OV76BE uses @@ -2691,6 +2709,7 @@ static void ov8xx0_configure(struct sd *sd) */ static void ov7xx0_configure(struct sd *sd) { + struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; int rc, high, low; PDEBUG(D_PROBE, "starting OV7xx0 configuration"); @@ -2701,7 +2720,7 @@ static void ov7xx0_configure(struct sd *sd) /* add OV7670 here * it appears to be wrongly detected as a 7610 by default */ if (rc < 0) { - pr_err("Error detecting sensor type\n"); + PERR("Error detecting sensor type\n"); return; } if ((rc & 3) == 3) { @@ -2729,19 +2748,19 @@ static void ov7xx0_configure(struct sd *sd) /* try to read product id registers */ high = i2c_r(sd, 0x0a); if (high < 0) { - pr_err("Error detecting camera chip PID\n"); + PERR("Error detecting camera chip PID\n"); return; } low = i2c_r(sd, 0x0b); if (low < 0) { - pr_err("Error detecting camera chip VER\n"); + PERR("Error detecting camera chip VER\n"); return; } if (high == 0x76) { switch (low) { case 0x30: - pr_err("Sensor is an OV7630/OV7635\n"); - pr_err("7630 is not supported by this driver\n"); + PERR("Sensor is an OV7630/OV7635\n"); + PERR("7630 is not supported by this driver\n"); return; case 0x40: PDEBUG(D_PROBE, "Sensor is an OV7645"); @@ -2760,7 +2779,7 @@ static void ov7xx0_configure(struct sd *sd) sd->sensor = SEN_OV7660; break; default: - pr_err("Unknown sensor: 0x76%02x\n", low); + PERR("Unknown sensor: 0x76%02x\n", low); return; } } else { @@ -2768,20 +2787,22 @@ static void ov7xx0_configure(struct sd *sd) sd->sensor = SEN_OV7620; } } else { - pr_err("Unknown image sensor version: %d\n", rc & 3); + PERR("Unknown image sensor version: %d\n", rc & 3); } } /* This initializes the OV6620, OV6630, OV6630AE, or OV6630AF sensor. */ static void ov6xx0_configure(struct sd *sd) { + struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; int rc; + PDEBUG(D_PROBE, "starting OV6xx0 configuration"); /* Detect sensor (sub)type */ rc = i2c_r(sd, OV7610_REG_COM_I); if (rc < 0) { - pr_err("Error detecting sensor type\n"); + PERR("Error detecting sensor type\n"); return; } @@ -2810,7 +2831,7 @@ static void ov6xx0_configure(struct sd *sd) pr_warn("WARNING: Sensor is an OV66307. Your camera may have been misdetected in previous driver versions.\n"); break; default: - pr_err("FATAL: Unknown sensor version: 0x%02x\n", rc); + PERR("FATAL: Unknown sensor version: 0x%02x\n", rc); return; } @@ -2907,6 +2928,7 @@ static void ov51x_upload_quan_tables(struct sd *sd) 7, 7, 7, 7, 7, 7, 8, 8 }; + struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; const unsigned char *pYTable, *pUVTable; unsigned char val0, val1; int i, size, reg = R51x_COMP_LUT_BEGIN; @@ -3300,7 +3322,7 @@ static int sd_init(struct gspca_dev *gspca_dev) } else if (init_ov_sensor(sd, OV_HIRES_SID) >= 0) { ov_hires_configure(sd); } else { - pr_err("Can't determine sensor slave IDs\n"); + PERR("Can't determine sensor slave IDs\n"); goto error; } @@ -3433,7 +3455,7 @@ static int sd_init(struct gspca_dev *gspca_dev) } return gspca_dev->usb_err; error: - PDEBUG(D_ERR, "OV519 Config failed"); + PERR("OV519 Config failed"); return -EINVAL; } @@ -3459,6 +3481,7 @@ static int sd_isoc_init(struct gspca_dev *gspca_dev) */ static void ov511_mode_init_regs(struct sd *sd) { + struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; int hsegs, vsegs, packet_size, fps, needed; int interlaced = 0; struct usb_host_interface *alt; @@ -3467,7 +3490,7 @@ static void ov511_mode_init_regs(struct sd *sd) intf = usb_ifnum_to_if(sd->gspca_dev.dev, sd->gspca_dev.iface); alt = usb_altnum_to_altsetting(intf, sd->gspca_dev.alt); if (!alt) { - pr_err("Couldn't get altsetting\n"); + PERR("Couldn't get altsetting\n"); sd->gspca_dev.usb_err = -EIO; return; } @@ -3583,6 +3606,7 @@ static void ov511_mode_init_regs(struct sd *sd) */ static void ov518_mode_init_regs(struct sd *sd) { + struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; int hsegs, vsegs, packet_size; struct usb_host_interface *alt; struct usb_interface *intf; @@ -3590,7 +3614,7 @@ static void ov518_mode_init_regs(struct sd *sd) intf = usb_ifnum_to_if(sd->gspca_dev.dev, sd->gspca_dev.iface); alt = usb_altnum_to_altsetting(intf, sd->gspca_dev.alt); if (!alt) { - pr_err("Couldn't get altsetting\n"); + PERR("Couldn't get altsetting\n"); sd->gspca_dev.usb_err = -EIO; return; } @@ -3750,6 +3774,8 @@ static void ov519_mode_init_regs(struct sd *sd) /* windows reads 0x55 at this point, why? */ }; + struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; + /******** Set the mode ********/ switch (sd->sensor) { default: @@ -3865,11 +3891,10 @@ static void ov519_mode_init_regs(struct sd *sd) static void mode_init_ov_sensor_regs(struct sd *sd) { - struct gspca_dev *gspca_dev; + struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; int qvga, xstart, xend, ystart, yend; u8 v; - gspca_dev = &sd->gspca_dev; qvga = gspca_dev->cam.cam_mode[gspca_dev->curr_mode].priv & 1; /******** Mode (VGA/QVGA) and sensor specific regs ********/ @@ -4304,7 +4329,7 @@ static void ov511_pkt_scan(struct gspca_dev *gspca_dev, /* Frame end */ if ((in[9] + 1) * 8 != gspca_dev->width || (in[10] + 1) * 8 != gspca_dev->height) { - PDEBUG(D_ERR, "Invalid frame size, got: %dx%d," + PERR("Invalid frame size, got: %dx%d," " requested: %dx%d\n", (in[9] + 1) * 8, (in[10] + 1) * 8, gspca_dev->width, gspca_dev->height); @@ -4355,7 +4380,7 @@ static void ov518_pkt_scan(struct gspca_dev *gspca_dev, except that they may contain part of the footer), are numbered 0 */ else if (sd->packet_nr == 0 || data[len]) { - PDEBUG(D_ERR, "Invalid packet nr: %d (expect: %d)", + PERR("Invalid packet nr: %d (expect: %d)", (int)data[len], (int)sd->packet_nr); gspca_dev->last_packet_type = DISCARD_PACKET; return; @@ -4898,7 +4923,7 @@ static int sd_init_controls(struct gspca_dev *gspca_dev) QUALITY_MIN, QUALITY_MAX, 1, QUALITY_DEF); if (hdl->error) { - pr_err("Could not initialize controls\n"); + PERR("Could not initialize controls\n"); return hdl->error; } if (gspca_dev->autogain) |