Skip to contentSkip to conversation

gspca_pac7302: add support for device 1ae7:2001 Speedlink Snappy Microphone SL-6825-SBK

PATCH In review Frank Schäfer 2 participants 7 messages Sep 9, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/6 gspca_pac7302: add support for device 1ae7:2001 Speedlink Snappy Microphone SL-6825-SBK

---
 drivers/media/usb/gspca/pac7302.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/media/usb/gspca/pac7302.c +1 -0
index 4877f7a..e906f56 100644
@@ -905,6 +905,7 @@ static const struct usb_device_id device_table[] = {
 	{USB_DEVICE(0x093a, 0x262a)},
 	{USB_DEVICE(0x093a, 0x262c)},
 	{USB_DEVICE(0x145f, 0x013c)},
+	{USB_DEVICE(0x1ae7, 0x2001)}, /* SpeedLink Snappy Mic SL-6825-SBK */
 	{}
 };
 MODULE_DEVICE_TABLE(usb, device_table);
Signature · 1 line
1.7.7
#1 lore raw

PATCH 2/6 gspca_pac7302: make red balance and blue balance controls work again

Fix a regression from kernel 3.4 which has been introduced with the conversion of the gspca driver to the v4l2 control framework.

---
 drivers/media/usb/gspca/pac7302.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/media/usb/gspca/pac7302.c +1 -1
index e906f56..eb3c90e4 100644
@@ -616,7 +616,7 @@ static int sd_init_controls(struct gspca_dev *gspca_dev)
 	sd->red_balance = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
 					V4L2_CID_RED_BALANCE, 0, 3, 1, 1);
 	sd->blue_balance = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
-					V4L2_CID_RED_BALANCE, 0, 3, 1, 1);
+					V4L2_CID_BLUE_BALANCE, 0, 3, 1, 1);
 
 	gspca_dev->autogain = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
 					V4L2_CID_AUTOGAIN, 0, 1, 1, 1);
Signature · 1 line
1.7.7
#2 lore raw

PATCH 3/6 gspca_pac7302: add sharpness control

In reply to Frank Schäfer

The Windows driver uses page 0 register 0xb6 for sharpness adjustment.

---
 drivers/media/usb/gspca/pac7302.c |   25 ++++++++++++++++++++++++-
 1 files changed, 24 insertions(+), 1 deletions(-)
drivers/media/usb/gspca/pac7302.c +24 -1
index eb3c90e4..8c29613 100644
@@ -26,6 +26,11 @@
 /*
  * Some documentation about various registers as determined by trial and error.
  *
+ * Register page 0:
+ *
+ * Address	Description
+ * 0xb6		Sharpness control (bits 0-4)
+ *
  * Register page 1:
  *
  * Address	Description
@@ -66,6 +71,7 @@
  * -----+------------+---------------------------------------------------
  *  0   | 0x0f..0x20 | setcolors()
  *  0   | 0xa2..0xab | setbrightcont()
+ *  0   | 0xb6       | setsharpness()
  *  0   | 0xc5       | setredbalance()
  *  0   | 0xc6       | setwhitebalance()
  *  0   | 0xc7       | setbluebalance()
@@ -109,6 +115,7 @@ struct sd {
 		struct v4l2_ctrl *hflip;
 		struct v4l2_ctrl *vflip;
 	};
+	struct v4l2_ctrl *sharpness;
 	u8 flags;
 #define FL_HFLIP 0x01		/* mirrored by default */
 #define FL_VFLIP 0x02		/* vertical flipped by default */
@@ -531,6 +538,16 @@ static void sethvflip(struct gspca_dev *gspca_dev)
 	reg_w(gspca_dev, 0x11, 0x01);
 }
 
+static void setsharpness(struct gspca_dev *gspca_dev)
+{
+	struct sd *sd = (struct sd *) gspca_dev;
+
+	reg_w(gspca_dev, 0xff, 0x00);		/* page 0 */
+	reg_w(gspca_dev, 0xb6, sd->sharpness->val);
+
+	reg_w(gspca_dev, 0xdc, 0x01);
+}
+
 /* this function is called at probe and resume time for pac7302 */
 static int sd_init(struct gspca_dev *gspca_dev)
 {
@@ -584,6 +601,9 @@ static int sd_s_ctrl(struct v4l2_ctrl *ctrl)
 	case V4L2_CID_HFLIP:
 		sethvflip(gspca_dev);
 		break;
+	case V4L2_CID_SHARPNESS:
+		setsharpness(gspca_dev);
+		break;
 	default:
 		return -EINVAL;
 	}
@@ -601,7 +621,7 @@ static int sd_init_controls(struct gspca_dev *gspca_dev)
 	struct v4l2_ctrl_handler *hdl = &gspca_dev->ctrl_handler;
 
 	gspca_dev->vdev.ctrl_handler = hdl;
-	v4l2_ctrl_handler_init(hdl, 11);
+	v4l2_ctrl_handler_init(hdl, 12);
 
 	sd->brightness = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
 					V4L2_CID_BRIGHTNESS, 0, 32, 1, 16);
@@ -632,6 +652,9 @@ static int sd_init_controls(struct gspca_dev *gspca_dev)
 	sd->vflip = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
 		V4L2_CID_VFLIP, 0, 1, 1, 0);
 
+	sd->sharpness = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
+					V4L2_CID_SHARPNESS, 0, 15, 1, 8);
+
 	if (hdl->error) {
 		pr_err("Could not initialize controls\n");
 		return hdl->error;
Signature · 1 line
1.7.7
#3 lore raw

PATCH 4/6 gspca_pac7302: increase default value for white balance temperature

In reply to Frank Schäfer

The current white balance temperature default value is 4, which is much too small (possible values are 0-255). Improve the picture quality by increasing the default value to 55, which is the default value used by the Windows driver.

---
 drivers/media/usb/gspca/pac7302.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/media/usb/gspca/pac7302.c +1 -1
index 8c29613..bed34df 100644
@@ -632,7 +632,7 @@ static int sd_init_controls(struct gspca_dev *gspca_dev)
 					V4L2_CID_SATURATION, 0, 255, 1, 127);
 	sd->white_balance = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
 					V4L2_CID_WHITE_BALANCE_TEMPERATURE,
-					0, 255, 1, 4);
+					0, 255, 1, 55);
 	sd->red_balance = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
 					V4L2_CID_RED_BALANCE, 0, 3, 1, 1);
 	sd->blue_balance = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops,
Signature · 1 line
1.7.7
#4 lore raw

PATCH 5/6 gspca_pac7302: avoid duplicate calls of the image quality adjustment functions on capturing start

In reply to Frank Schäfer

There is no need to call the image quality adjustment functions in sd_start. The gspca main driver calls v4l2_ctrl_handler_setup in gspca_init_transfer, which already applies all image control values.

---
 drivers/media/usb/gspca/pac7302.c |    8 --------
 1 files changed, 0 insertions(+), 8 deletions(-)
drivers/media/usb/gspca/pac7302.c +0 -8
index bed34df..71fa5a4 100644
@@ -673,14 +673,6 @@ static int sd_start(struct gspca_dev *gspca_dev)
 
 	reg_w_var(gspca_dev, start_7302,
 		page3_7302, sizeof(page3_7302));
-	setbrightcont(gspca_dev);
-	setcolors(gspca_dev);
-	setwhitebalance(gspca_dev);
-	setredbalance(gspca_dev);
-	setbluebalance(gspca_dev);
-	setexposure(gspca_dev);
-	setgain(gspca_dev);
-	sethvflip(gspca_dev);
 
 	sd->sof_read = 0;
 	sd->autogain_ignore_frames = 0;
Signature · 1 line
1.7.7
#5 lore raw

PATCH 6/6 gspca_pac7302: extend register documentation

In reply to Frank Schäfer
---
 drivers/media/usb/gspca/pac7302.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
drivers/media/usb/gspca/pac7302.c +9 -0
index 71fa5a4..2d5c6d83 100644
@@ -29,6 +29,15 @@
  * Register page 0:
  *
  * Address	Description
+ * 0x02		Red balance control
+ * 0x03		Green balance control
+ * 0x04 	Blue balance control
+ *		     Valus are inverted (0=max, 255=min).
+ *		     The Windows driver uses a quadratic approach to map
+ *		     the settable values (0-200) on register values:
+ *		     min=0x80, default=0x40, max=0x20
+ * 0x0f-0x20	Colors, saturation and exposure control
+ * 0xa2-0xab	Brightness, contrast and gamma control
  * 0xb6		Sharpness control (bits 0-4)
  *
  * Register page 1:
Signature · 1 line
1.7.7
#6 lore raw
In reply to Frank Schäfer

Hi,

Entire series applied and included in my pull-req for 3.7 which I just send out.

Thanks,

Hans

Quoted 19 lines · Frank Schäfer
---
  drivers/media/usb/gspca/pac7302.c |    1 +
  1 files changed, 1 insertions(+), 0 deletions(-)
drivers/media/usb/gspca/pac7302.c +1 -0
index 4877f7a..e906f56 100644
@@ -905,6 +905,7 @@ static const struct usb_device_id device_table[] = {
  	{USB_DEVICE(0x093a, 0x262a)},
  	{USB_DEVICE(0x093a, 0x262c)},
  	{USB_DEVICE(0x145f, 0x013c)},
+	{USB_DEVICE(0x1ae7, 0x2001)}, /* SpeedLink Snappy Mic SL-6825-SBK */
  	{}
  };
  MODULE_DEVICE_TABLE(usb, device_table);