summaryrefslogtreecommitdiff
path: root/drivers/media/usb/gspca/stv06xx/stv06xx.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-02-06 11:27:48 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2018-02-06 11:27:48 -0800
commit68c5735eaa5e680e701c9a2d1e3c7880bdf5ab66 (patch)
tree4f584693638bf257b66a1646cc30d823cacc0a58 /drivers/media/usb/gspca/stv06xx/stv06xx.c
parent2246edfaf88dc368e8671b04afd54412625df60a (diff)
parent273caa260035c03d89ad63d72d8cd3d9e5c5e3f1 (diff)
Merge tag 'media/v4.16-2' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media
Pull media updates from Mauro Carvalho Chehab: - videobuf2 was moved to a media/common dir, as it is now used by the DVB subsystem too - Digital TV core memory mapped support interface - new sensor driver: ov7740 - several improvements at ddbridge driver - new V4L2 driver: IPU3 CIO2 CSI-2 receiver unit, found on some Intel SoCs - new tuner driver: tda18250 - finally got rid of all LIRC staging drivers - as we don't have old lirc drivers anymore, restruct the lirc device code - add support for UVC metadata - add a new staging driver for NVIDIA Tegra Video Decoder Engine - DVB kAPI headers moved to include/media - synchronize the kAPI and uAPI for the DVB subsystem, removing the gap for non-legacy APIs - reduce the kAPI gap for V4L2 - lots of other driver enhancements, cleanups, etc. * tag 'media/v4.16-2' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (407 commits) media: v4l2-compat-ioctl32.c: make ctrl_is_pointer work for subdevs media: v4l2-compat-ioctl32.c: refactor compat ioctl32 logic media: v4l2-compat-ioctl32.c: don't copy back the result for certain errors media: v4l2-compat-ioctl32.c: drop pr_info for unknown buffer type media: v4l2-compat-ioctl32.c: copy clip list in put_v4l2_window32 media: v4l2-compat-ioctl32.c: fix ctrl_is_pointer media: v4l2-compat-ioctl32.c: copy m.userptr in put_v4l2_plane32 media: v4l2-compat-ioctl32.c: avoid sizeof(type) media: v4l2-compat-ioctl32.c: move 'helper' functions to __get/put_v4l2_format32 media: v4l2-compat-ioctl32.c: fix the indentation media: v4l2-compat-ioctl32.c: add missing VIDIOC_PREPARE_BUF media: v4l2-ioctl.c: don't copy back the result for -ENOTTY media: v4l2-ioctl.c: use check_fmt for enum/g/s/try_fmt media: vivid: fix module load error when enabling fb and no_error_inj=1 media: dvb_demux: improve debug messages media: dvb_demux: Better handle discontinuity errors media: cxusb, dib0700: ignore XC2028_I2C_FLUSH media: ts2020: avoid integer overflows on 32 bit machines media: i2c: ov7740: use gpio/consumer.h instead of gpio.h media: entity: Add a nop variant of media_entity_cleanup ...
Diffstat (limited to 'drivers/media/usb/gspca/stv06xx/stv06xx.c')
-rw-r--r--drivers/media/usb/gspca/stv06xx/stv06xx.c76
1 files changed, 40 insertions, 36 deletions
diff --git a/drivers/media/usb/gspca/stv06xx/stv06xx.c b/drivers/media/usb/gspca/stv06xx/stv06xx.c
index e72c3e1ab9ff..6080a35310ca 100644
--- a/drivers/media/usb/gspca/stv06xx/stv06xx.c
+++ b/drivers/media/usb/gspca/stv06xx/stv06xx.c
@@ -51,8 +51,8 @@ int stv06xx_write_bridge(struct sd *sd, u16 address, u16 i2c_data)
0x04, 0x40, address, 0, buf, len,
STV06XX_URB_MSG_TIMEOUT);
- PDEBUG(D_CONF, "Written 0x%x to address 0x%x, status: %d",
- i2c_data, address, err);
+ gspca_dbg(gspca_dev, D_CONF, "Written 0x%x to address 0x%x, status: %d\n",
+ i2c_data, address, err);
return (err < 0) ? err : 0;
}
@@ -70,8 +70,8 @@ int stv06xx_read_bridge(struct sd *sd, u16 address, u8 *i2c_data)
*i2c_data = buf[0];
- PDEBUG(D_CONF, "Reading 0x%x from address 0x%x, status %d",
- *i2c_data, address, err);
+ gspca_dbg(gspca_dev, D_CONF, "Reading 0x%x from address 0x%x, status %d\n",
+ *i2c_data, address, err);
return (err < 0) ? err : 0;
}
@@ -113,15 +113,16 @@ int stv06xx_write_sensor_bytes(struct sd *sd, const u8 *data, u8 len)
struct usb_device *udev = sd->gspca_dev.dev;
__u8 *buf = sd->gspca_dev.usb_buf;
- PDEBUG(D_CONF, "I2C: Command buffer contains %d entries", len);
+ gspca_dbg(gspca_dev, D_CONF, "I2C: Command buffer contains %d entries\n",
+ len);
for (i = 0; i < len;) {
/* Build the command buffer */
memset(buf, 0, I2C_BUFFER_LENGTH);
for (j = 0; j < I2C_MAX_BYTES && i < len; j++, i++) {
buf[j] = data[2*i];
buf[0x10 + j] = data[2*i+1];
- PDEBUG(D_CONF, "I2C: Writing 0x%02x to reg 0x%02x",
- data[2*i+1], data[2*i]);
+ gspca_dbg(gspca_dev, D_CONF, "I2C: Writing 0x%02x to reg 0x%02x\n",
+ data[2*i+1], data[2*i]);
}
buf[0x20] = sd->sensor->i2c_addr;
buf[0x21] = j - 1; /* Number of commands to send - 1 */
@@ -143,7 +144,8 @@ int stv06xx_write_sensor_words(struct sd *sd, const u16 *data, u8 len)
struct usb_device *udev = sd->gspca_dev.dev;
__u8 *buf = sd->gspca_dev.usb_buf;
- PDEBUG(D_CONF, "I2C: Command buffer contains %d entries", len);
+ gspca_dbg(gspca_dev, D_CONF, "I2C: Command buffer contains %d entries\n",
+ len);
for (i = 0; i < len;) {
/* Build the command buffer */
@@ -152,8 +154,8 @@ int stv06xx_write_sensor_words(struct sd *sd, const u16 *data, u8 len)
buf[j] = data[2*i];
buf[0x10 + j * 2] = data[2*i+1];
buf[0x10 + j * 2 + 1] = data[2*i+1] >> 8;
- PDEBUG(D_CONF, "I2C: Writing 0x%04x to reg 0x%02x",
- data[2*i+1], data[2*i]);
+ gspca_dbg(gspca_dev, D_CONF, "I2C: Writing 0x%04x to reg 0x%02x\n",
+ data[2*i+1], data[2*i]);
}
buf[0x20] = sd->sensor->i2c_addr;
buf[0x21] = j - 1; /* Number of commands to send - 1 */
@@ -205,8 +207,8 @@ int stv06xx_read_sensor(struct sd *sd, const u8 address, u16 *value)
else
*value = buf[0];
- PDEBUG(D_CONF, "I2C: Read 0x%x from address 0x%x, status: %d",
- *value, address, err);
+ gspca_dbg(gspca_dev, D_CONF, "I2C: Read 0x%x from address 0x%x, status: %d\n",
+ *value, address, err);
return (err < 0) ? err : 0;
}
@@ -249,7 +251,7 @@ static int stv06xx_init(struct gspca_dev *gspca_dev)
struct sd *sd = (struct sd *) gspca_dev;
int err;
- PDEBUG(D_PROBE, "Initializing camera");
+ gspca_dbg(gspca_dev, D_PROBE, "Initializing camera\n");
/* Let the usb init settle for a bit
before performing the initialization */
@@ -268,7 +270,7 @@ static int stv06xx_init_controls(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
- PDEBUG(D_PROBE, "Initializing controls");
+ gspca_dbg(gspca_dev, D_PROBE, "Initializing controls\n");
gspca_dev->vdev.ctrl_handler = &gspca_dev->ctrl_handler;
return sd->sensor->init_controls(sd);
@@ -285,7 +287,7 @@ static int stv06xx_start(struct gspca_dev *gspca_dev)
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) {
- PERR("Couldn't get altsetting");
+ gspca_err(gspca_dev, "Couldn't get altsetting\n");
return -EIO;
}
@@ -304,9 +306,9 @@ static int stv06xx_start(struct gspca_dev *gspca_dev)
out:
if (err < 0)
- PDEBUG(D_STREAM, "Starting stream failed");
+ gspca_dbg(gspca_dev, D_STREAM, "Starting stream failed\n");
else
- PDEBUG(D_STREAM, "Started streaming");
+ gspca_dbg(gspca_dev, D_STREAM, "Started streaming\n");
return (err < 0) ? err : 0;
}
@@ -343,7 +345,7 @@ static int stv06xx_isoc_nego(struct gspca_dev *gspca_dev)
ret = usb_set_interface(gspca_dev->dev, gspca_dev->iface, 1);
if (ret < 0)
- PERR("set alt 1 err %d", ret);
+ gspca_err(gspca_dev, "set alt 1 err %d\n", ret);
return ret;
}
@@ -362,9 +364,9 @@ static void stv06xx_stopN(struct gspca_dev *gspca_dev)
out:
if (err < 0)
- PDEBUG(D_STREAM, "Failed to stop stream");
+ gspca_dbg(gspca_dev, D_STREAM, "Failed to stop stream\n");
else
- PDEBUG(D_STREAM, "Stopped streaming");
+ gspca_dbg(gspca_dev, D_STREAM, "Stopped streaming\n");
}
/*
@@ -385,7 +387,7 @@ static void stv06xx_pkt_scan(struct gspca_dev *gspca_dev,
{
struct sd *sd = (struct sd *) gspca_dev;
- PDEBUG(D_PACK, "Packet of length %d arrived", len);
+ gspca_dbg(gspca_dev, D_PACK, "Packet of length %d arrived\n", len);
/* A packet may contain several frames
loop until the whole packet is reached */
@@ -393,7 +395,7 @@ static void stv06xx_pkt_scan(struct gspca_dev *gspca_dev,
int id, chunk_len;
if (len < 4) {
- PDEBUG(D_PACK, "Packet is smaller than 4 bytes");
+ gspca_dbg(gspca_dev, D_PACK, "Packet is smaller than 4 bytes\n");
return;
}
@@ -402,13 +404,14 @@ static void stv06xx_pkt_scan(struct gspca_dev *gspca_dev,
/* Capture the chunk length */
chunk_len = (data[2] << 8) | data[3];
- PDEBUG(D_PACK, "Chunk id: %x, length: %d", id, chunk_len);
+ gspca_dbg(gspca_dev, D_PACK, "Chunk id: %x, length: %d\n",
+ id, chunk_len);
data += 4;
len -= 4;
if (len < chunk_len) {
- PERR("URB packet length is smaller than the specified chunk length");
+ gspca_err(gspca_dev, "URB packet length is smaller than the specified chunk length\n");
gspca_dev->last_packet_type = DISCARD_PACKET;
return;
}
@@ -421,7 +424,7 @@ static void stv06xx_pkt_scan(struct gspca_dev *gspca_dev,
case 0x0200:
case 0x4200:
frame_data:
- PDEBUG(D_PACK, "Frame data packet detected");
+ gspca_dbg(gspca_dev, D_PACK, "Frame data packet detected\n");
if (sd->to_skip) {
int skip = (sd->to_skip < chunk_len) ?
@@ -440,7 +443,7 @@ frame_data:
case 0x8005:
case 0xc001:
case 0xc005:
- PDEBUG(D_PACK, "Starting new frame");
+ gspca_dbg(gspca_dev, D_PACK, "Starting new frame\n");
/* Create a new frame, chunk length should be zero */
gspca_frame_add(gspca_dev, FIRST_PACKET,
@@ -450,40 +453,41 @@ frame_data:
sd->to_skip = gspca_dev->pixfmt.width * 4;
if (chunk_len)
- PERR("Chunk length is non-zero on a SOF");
+ gspca_err(gspca_dev, "Chunk length is non-zero on a SOF\n");
break;
case 0x8002:
case 0x8006:
case 0xc002:
- PDEBUG(D_PACK, "End of frame detected");
+ gspca_dbg(gspca_dev, D_PACK, "End of frame detected\n");
/* Complete the last frame (if any) */
gspca_frame_add(gspca_dev, LAST_PACKET,
NULL, 0);
if (chunk_len)
- PERR("Chunk length is non-zero on a EOF");
+ gspca_err(gspca_dev, "Chunk length is non-zero on a EOF\n");
break;
case 0x0005:
- PDEBUG(D_PACK, "Chunk 0x005 detected");
+ gspca_dbg(gspca_dev, D_PACK, "Chunk 0x005 detected\n");
/* Unknown chunk with 11 bytes of data,
occurs just before end of each frame
in compressed mode */
break;
case 0x0100:
- PDEBUG(D_PACK, "Chunk 0x0100 detected");
+ gspca_dbg(gspca_dev, D_PACK, "Chunk 0x0100 detected\n");
/* Unknown chunk with 2 bytes of data,
occurs 2-3 times per USB interrupt */
break;
case 0x42ff:
- PDEBUG(D_PACK, "Chunk 0x42ff detected");
+ gspca_dbg(gspca_dev, D_PACK, "Chunk 0x42ff detected\n");
/* Special chunk seen sometimes on the ST6422 */
break;
default:
- PDEBUG(D_PACK, "Unknown chunk 0x%04x detected", id);
+ gspca_dbg(gspca_dev, D_PACK, "Unknown chunk 0x%04x detected\n",
+ id);
/* Unknown chunk */
}
data += chunk_len;
@@ -539,7 +543,7 @@ static int stv06xx_config(struct gspca_dev *gspca_dev,
{
struct sd *sd = (struct sd *) gspca_dev;
- PDEBUG(D_PROBE, "Configuring camera");
+ gspca_dbg(gspca_dev, D_PROBE, "Configuring camera\n");
sd->bridge = id->driver_info;
gspca_dev->sd_desc = &sd_desc;
@@ -575,7 +579,7 @@ static int stv06xx_config(struct gspca_dev *gspca_dev,
/* -- module initialisation -- */
static const struct usb_device_id device_table[] = {
- {USB_DEVICE(0x046d, 0x0840), .driver_info = BRIDGE_STV600 }, /* QuickCam Express */
+ {USB_DEVICE(0x046d, 0x0840), .driver_info = BRIDGE_STV600 }, /* QuickCam Express */
{USB_DEVICE(0x046d, 0x0850), .driver_info = BRIDGE_STV610 }, /* LEGO cam / QuickCam Web */
{USB_DEVICE(0x046d, 0x0870), .driver_info = BRIDGE_STV602 }, /* Dexxa WebCam USB */
{USB_DEVICE(0x046D, 0x08F0), .driver_info = BRIDGE_ST6422 }, /* QuickCam Messenger */
@@ -598,7 +602,7 @@ static void sd_disconnect(struct usb_interface *intf)
struct gspca_dev *gspca_dev = usb_get_intfdata(intf);
struct sd *sd = (struct sd *) gspca_dev;
void *priv = sd->sensor_priv;
- PDEBUG(D_PROBE, "Disconnecting the stv06xx device");
+ gspca_dbg(gspca_dev, D_PROBE, "Disconnecting the stv06xx device\n");
sd->sensor = NULL;
gspca_disconnect(intf);