Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b82180db authored by Hans de Goede's avatar Hans de Goede Committed by Mauro Carvalho Chehab
Browse files

[media] gspca_ov519: Fix support for the Terratec Terracam USB Pro



This is a camera with an ov518+ revision 0 bridge + ov7620ae sensor,
which appearently needs different handling then the Trust spacecam 320, which
has an ov518+ revision 2 + ov7620ae sensor. The Terracam USB Pro used to write
this patch has kindly been provided by
Dr. Tilmann Bubeck <t.bubeck@reinform.de>.

Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
parent 265d3b55
Loading
Loading
Loading
Loading
+25 −7
Original line number Original line Diff line number Diff line
@@ -75,6 +75,8 @@ struct sd {
		struct v4l2_ctrl *brightness;
		struct v4l2_ctrl *brightness;
	};
	};


	u8 revision;

	u8 packet_nr;
	u8 packet_nr;


	char bridge;
	char bridge;
@@ -3080,8 +3082,8 @@ static void ov518_configure(struct gspca_dev *gspca_dev)
	};
	};


	/* First 5 bits of custom ID reg are a revision ID on OV518 */
	/* First 5 bits of custom ID reg are a revision ID on OV518 */
	PDEBUG(D_PROBE, "Device revision %d",
	sd->revision = reg_r(sd, R51x_SYS_CUST_ID) & 0x1f;
		0x1f & reg_r(sd, R51x_SYS_CUST_ID));
	PDEBUG(D_PROBE, "Device revision %d", sd->revision);


	write_regvals(sd, init_518, ARRAY_SIZE(init_518));
	write_regvals(sd, init_518, ARRAY_SIZE(init_518));


@@ -3657,6 +3659,10 @@ static void ov518_mode_init_regs(struct sd *sd)
	reg_w(sd, 0x2f, 0x80);
	reg_w(sd, 0x2f, 0x80);


	/******** Set the framerate ********/
	/******** Set the framerate ********/
	if (sd->bridge == BRIDGE_OV518PLUS && sd->revision == 0 &&
					      sd->sensor == SEN_OV7620AE)
		sd->clockdiv = 0;
	else
		sd->clockdiv = 1;
		sd->clockdiv = 1;


	/* Mode independent, but framerate dependent, regs */
	/* Mode independent, but framerate dependent, regs */
@@ -3668,12 +3674,24 @@ static void ov518_mode_init_regs(struct sd *sd)
	if (sd->bridge == BRIDGE_OV518PLUS) {
	if (sd->bridge == BRIDGE_OV518PLUS) {
		switch (sd->sensor) {
		switch (sd->sensor) {
		case SEN_OV7620AE:
		case SEN_OV7620AE:
			if (sd->gspca_dev.width == 320) {
			/*
				reg_w(sd, 0x20, 0x00);
			 * HdG: 640x480 needs special handling on device
				reg_w(sd, 0x21, 0x19);
			 * revision 2, we check for device revison > 0 to
			} else {
			 * avoid regressions, as we don't know the correct
			 * thing todo for revision 1.
			 *
			 * Also this likely means we don't need to
			 * differentiate between the OV7620 and OV7620AE,
			 * earlier testing hitting this same problem likely
			 * happened to be with revision < 2 cams using an
			 * OV7620 and revision 2 cams using an OV7620AE.
			 */
			if (sd->revision > 0 && sd->gspca_dev.width == 640) {
				reg_w(sd, 0x20, 0x60);
				reg_w(sd, 0x20, 0x60);
				reg_w(sd, 0x21, 0x1f);
				reg_w(sd, 0x21, 0x1f);
			} else {
				reg_w(sd, 0x20, 0x00);
				reg_w(sd, 0x21, 0x19);
			}
			}
			break;
			break;
		case SEN_OV7620:
		case SEN_OV7620: