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

Commit e17cc08c authored by Erik Andr?n's avatar Erik Andr?n Committed by Mauro Carvalho Chehab
Browse files

V4L/DVB (11414): gspca - m5602-mt9m111: Move v4l2 controls to main sensor file.



Move over the v4l2 controls to the sensor specific source file.
Remove the now redundant sensor struct member.

Signed-off-by: default avatarErik Andrén <erik.andren@gmail.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 74cadfe1
Loading
Loading
Loading
Loading
+43 −1
Original line number Diff line number Diff line
@@ -31,6 +31,48 @@ static struct v4l2_pix_format mt9m111_modes[] = {
	}
};

const static struct ctrl mt9m111_ctrls[] = {
	{
		{
			.id		= V4L2_CID_VFLIP,
			.type           = V4L2_CTRL_TYPE_BOOLEAN,
			.name           = "vertical flip",
			.minimum        = 0,
			.maximum        = 1,
			.step           = 1,
			.default_value  = 0
		},
		.set = mt9m111_set_vflip,
		.get = mt9m111_get_vflip
	}, {
		{
			.id             = V4L2_CID_HFLIP,
			.type           = V4L2_CTRL_TYPE_BOOLEAN,
			.name           = "horizontal flip",
			.minimum        = 0,
			.maximum        = 1,
			.step           = 1,
			.default_value  = 0
		},
		.set = mt9m111_set_hflip,
		.get = mt9m111_get_hflip
	}, {
		{
			.id             = V4L2_CID_GAIN,
			.type           = V4L2_CTRL_TYPE_INTEGER,
			.name           = "gain",
			.minimum        = 0,
			.maximum        = (INITIAL_MAX_GAIN - 1) * 2 * 2 * 2,
			.step           = 1,
			.default_value  = DEFAULT_GAIN,
			.flags          = V4L2_CTRL_FLAG_SLIDER
		},
		.set = mt9m111_set_gain,
		.get = mt9m111_get_gain
	}
};


static void mt9m111_dump_registers(struct sd *sd);

int mt9m111_probe(struct sd *sd)
@@ -77,7 +119,7 @@ int mt9m111_probe(struct sd *sd)
sensor_found:
	sd->gspca_dev.cam.cam_mode = mt9m111_modes;
	sd->gspca_dev.cam.nmodes = ARRAY_SIZE(mt9m111_modes);
	sd->desc->ctrls = mt9m111.ctrls;
	sd->desc->ctrls = mt9m111_ctrls;
	sd->desc->nctrls = ARRAY_SIZE(mt9m111_ctrls);
	return 0;
}
+0 −41
Original line number Diff line number Diff line
@@ -94,47 +94,6 @@ int mt9m111_set_hflip(struct gspca_dev *gspca_dev, __s32 val);
int mt9m111_get_gain(struct gspca_dev *gspca_dev, __s32 *val);
int mt9m111_set_gain(struct gspca_dev *gspca_dev, __s32 val);

const static struct ctrl mt9m111_ctrls[] = {
	{
		{
			.id		= V4L2_CID_VFLIP,
			.type           = V4L2_CTRL_TYPE_BOOLEAN,
			.name           = "vertical flip",
			.minimum        = 0,
			.maximum        = 1,
			.step           = 1,
			.default_value  = 0
		},
		.set = mt9m111_set_vflip,
		.get = mt9m111_get_vflip
	}, {
		{
			.id             = V4L2_CID_HFLIP,
			.type           = V4L2_CTRL_TYPE_BOOLEAN,
			.name           = "horizontal flip",
			.minimum        = 0,
			.maximum        = 1,
			.step           = 1,
			.default_value  = 0
		},
		.set = mt9m111_set_hflip,
		.get = mt9m111_get_hflip
	}, {
		{
			.id             = V4L2_CID_GAIN,
			.type           = V4L2_CTRL_TYPE_INTEGER,
			.name           = "gain",
			.minimum        = 0,
			.maximum        = (INITIAL_MAX_GAIN - 1) * 2 * 2 * 2,
			.step           = 1,
			.default_value  = DEFAULT_GAIN,
			.flags          = V4L2_CTRL_FLAG_SLIDER
		},
		.set = mt9m111_set_gain,
		.get = mt9m111_get_gain
	}
};

static struct m5602_sensor mt9m111 = {
	.name = "MT9M111",

+103 −4
Original line number Diff line number Diff line
@@ -68,6 +68,108 @@ static
	{ }
};

const static struct ctrl ov9650_ctrls[] = {
	{
		{
			.id		= V4L2_CID_EXPOSURE,
			.type		= V4L2_CTRL_TYPE_INTEGER,
			.name		= "exposure",
			.minimum	= 0x00,
			.maximum	= 0xffff,
			.step		= 0x1,
			.default_value 	= EXPOSURE_DEFAULT,
			.flags         	= V4L2_CTRL_FLAG_SLIDER
		},
		.set = ov9650_set_exposure,
		.get = ov9650_get_exposure
	}, {
		{
			.id		= V4L2_CID_GAIN,
			.type		= V4L2_CTRL_TYPE_INTEGER,
			.name		= "gain",
			.minimum	= 0x00,
			.maximum	= 0x3ff,
			.step		= 0x1,
			.default_value	= GAIN_DEFAULT,
			.flags		= V4L2_CTRL_FLAG_SLIDER
		},
		.set = ov9650_set_gain,
		.get = ov9650_get_gain
	}, {
		{
			.type 		= V4L2_CTRL_TYPE_INTEGER,
			.name 		= "red balance",
			.minimum 	= 0x00,
			.maximum 	= 0xff,
			.step 		= 0x1,
			.default_value 	= RED_GAIN_DEFAULT,
			.flags         	= V4L2_CTRL_FLAG_SLIDER
		},
		.set = ov9650_set_red_balance,
		.get = ov9650_get_red_balance
	}, {
		{
			.type 		= V4L2_CTRL_TYPE_INTEGER,
			.name 		= "blue balance",
			.minimum 	= 0x00,
			.maximum 	= 0xff,
			.step 		= 0x1,
			.default_value 	= BLUE_GAIN_DEFAULT,
			.flags         	= V4L2_CTRL_FLAG_SLIDER
		},
		.set = ov9650_set_blue_balance,
		.get = ov9650_get_blue_balance
	}, {
		{
			.id 		= V4L2_CID_HFLIP,
			.type 		= V4L2_CTRL_TYPE_BOOLEAN,
			.name 		= "horizontal flip",
			.minimum 	= 0,
			.maximum 	= 1,
			.step 		= 1,
			.default_value 	= 0
		},
		.set = ov9650_set_hflip,
		.get = ov9650_get_hflip
	}, {
		{
			.id 		= V4L2_CID_VFLIP,
			.type 		= V4L2_CTRL_TYPE_BOOLEAN,
			.name 		= "vertical flip",
			.minimum 	= 0,
			.maximum 	= 1,
			.step 		= 1,
			.default_value 	= 0
		},
		.set = ov9650_set_vflip,
		.get = ov9650_get_vflip
	}, {
		{
			.id 		= V4L2_CID_AUTO_WHITE_BALANCE,
			.type 		= V4L2_CTRL_TYPE_BOOLEAN,
			.name 		= "auto white balance",
			.minimum 	= 0,
			.maximum 	= 1,
			.step 		= 1,
			.default_value 	= 0
		},
		.set = ov9650_set_auto_white_balance,
		.get = ov9650_get_auto_white_balance
	}, {
		{
			.id 		= V4L2_CID_AUTOGAIN,
			.type 		= V4L2_CTRL_TYPE_BOOLEAN,
			.name 		= "auto gain control",
			.minimum 	= 0,
			.maximum 	= 1,
			.step 		= 1,
			.default_value 	= 0
		},
		.set = ov9650_set_auto_gain,
		.get = ov9650_get_auto_gain
	}
};

static struct v4l2_pix_format ov9650_modes[] = {
	{
		176,
@@ -154,12 +256,9 @@ int ov9650_probe(struct sd *sd)
	return -ENODEV;

sensor_found:
// 	sd->gspca_dev.cam.cam_mode = ov9650.modes;
// 	sd->gspca_dev.cam.nmodes = ov9650.nmodes;
	sd->gspca_dev.cam.cam_mode = ov9650_modes;
	sd->gspca_dev.cam.nmodes = ARRAY_SIZE(ov9650_modes);

	sd->desc->ctrls = ov9650.ctrls;
	sd->desc->ctrls = ov9650_ctrls;
	sd->desc->nctrls = ARRAY_SIZE(ov9650_ctrls);
	return 0;
}
+0 −103
Original line number Diff line number Diff line
@@ -156,108 +156,6 @@ int ov9650_set_auto_white_balance(struct gspca_dev *gspca_dev, __s32 val);
int ov9650_get_auto_gain(struct gspca_dev *gspca_dev, __s32 *val);
int ov9650_set_auto_gain(struct gspca_dev *gspca_dev, __s32 val);

static struct ctrl ov9650_ctrls[] = {
	{
		{
			.id		= V4L2_CID_EXPOSURE,
			.type		= V4L2_CTRL_TYPE_INTEGER,
			.name		= "exposure",
			.minimum	= 0x00,
			.maximum	= 0xffff,
			.step		= 0x1,
			.default_value 	= EXPOSURE_DEFAULT,
			.flags         	= V4L2_CTRL_FLAG_SLIDER
		},
		.set = ov9650_set_exposure,
		.get = ov9650_get_exposure
	}, {
		{
			.id		= V4L2_CID_GAIN,
			.type		= V4L2_CTRL_TYPE_INTEGER,
			.name		= "gain",
			.minimum	= 0x00,
			.maximum	= 0x3ff,
			.step		= 0x1,
			.default_value	= GAIN_DEFAULT,
			.flags		= V4L2_CTRL_FLAG_SLIDER
		},
		.set = ov9650_set_gain,
		.get = ov9650_get_gain
	}, {
		{
			.type 		= V4L2_CTRL_TYPE_INTEGER,
			.name 		= "red balance",
			.minimum 	= 0x00,
			.maximum 	= 0xff,
			.step 		= 0x1,
			.default_value 	= RED_GAIN_DEFAULT,
			.flags         	= V4L2_CTRL_FLAG_SLIDER
		},
		.set = ov9650_set_red_balance,
		.get = ov9650_get_red_balance
	}, {
		{
			.type 		= V4L2_CTRL_TYPE_INTEGER,
			.name 		= "blue balance",
			.minimum 	= 0x00,
			.maximum 	= 0xff,
			.step 		= 0x1,
			.default_value 	= BLUE_GAIN_DEFAULT,
			.flags         	= V4L2_CTRL_FLAG_SLIDER
		},
		.set = ov9650_set_blue_balance,
		.get = ov9650_get_blue_balance
	}, {
		{
			.id 		= V4L2_CID_HFLIP,
			.type 		= V4L2_CTRL_TYPE_BOOLEAN,
			.name 		= "horizontal flip",
			.minimum 	= 0,
			.maximum 	= 1,
			.step 		= 1,
			.default_value 	= 0
		},
		.set = ov9650_set_hflip,
		.get = ov9650_get_hflip
	}, {
		{
			.id 		= V4L2_CID_VFLIP,
			.type 		= V4L2_CTRL_TYPE_BOOLEAN,
			.name 		= "vertical flip",
			.minimum 	= 0,
			.maximum 	= 1,
			.step 		= 1,
			.default_value 	= 0
		},
		.set = ov9650_set_vflip,
		.get = ov9650_get_vflip
	}, {
		{
			.id 		= V4L2_CID_AUTO_WHITE_BALANCE,
			.type 		= V4L2_CTRL_TYPE_BOOLEAN,
			.name 		= "auto white balance",
			.minimum 	= 0,
			.maximum 	= 1,
			.step 		= 1,
			.default_value 	= 0
		},
		.set = ov9650_set_auto_white_balance,
		.get = ov9650_get_auto_white_balance
	}, {
		{
			.id 		= V4L2_CID_AUTOGAIN,
			.type 		= V4L2_CTRL_TYPE_BOOLEAN,
			.name 		= "auto gain control",
			.minimum 	= 0,
			.maximum 	= 1,
			.step 		= 1,
			.default_value 	= 0
		},
		.set = ov9650_set_auto_gain,
		.get = ov9650_get_auto_gain
	}
};

static struct m5602_sensor ov9650 = {
	.name = "OV9650",
	.i2c_slave_id = 0x60,
@@ -267,7 +165,6 @@ static struct m5602_sensor ov9650 = {
	.start = ov9650_start,
	.stop = ov9650_stop,
	.power_down = ov9650_power_down,
	.ctrls = ov9650_ctrls
};

static const unsigned char preinit_ov9650[][3] =
+81 −1
Original line number Diff line number Diff line
@@ -31,6 +31,86 @@ static struct v4l2_pix_format po1030_modes[] = {
	}
};

const static struct ctrl po1030_ctrls[] = {
	{
		{
			.id 		= V4L2_CID_GAIN,
			.type 		= V4L2_CTRL_TYPE_INTEGER,
			.name 		= "gain",
			.minimum 	= 0x00,
			.maximum 	= 0x4f,
			.step 		= 0x1,
			.default_value 	= PO1030_GLOBAL_GAIN_DEFAULT,
			.flags         	= V4L2_CTRL_FLAG_SLIDER
		},
		.set = po1030_set_gain,
		.get = po1030_get_gain
	}, {
		{
			.id 		= V4L2_CID_EXPOSURE,
			.type 		= V4L2_CTRL_TYPE_INTEGER,
			.name 		= "exposure",
			.minimum 	= 0x00,
			.maximum 	= 0x02ff,
			.step 		= 0x1,
			.default_value 	= PO1030_EXPOSURE_DEFAULT,
			.flags         	= V4L2_CTRL_FLAG_SLIDER
		},
		.set = po1030_set_exposure,
		.get = po1030_get_exposure
	}, {
		{
			.id 		= V4L2_CID_RED_BALANCE,
			.type 		= V4L2_CTRL_TYPE_INTEGER,
			.name 		= "red balance",
			.minimum 	= 0x00,
			.maximum 	= 0xff,
			.step 		= 0x1,
			.default_value 	= PO1030_RED_GAIN_DEFAULT,
			.flags         	= V4L2_CTRL_FLAG_SLIDER
		},
		.set = po1030_set_red_balance,
		.get = po1030_get_red_balance
	}, {
		{
			.id 		= V4L2_CID_BLUE_BALANCE,
			.type 		= V4L2_CTRL_TYPE_INTEGER,
			.name 		= "blue balance",
			.minimum 	= 0x00,
			.maximum 	= 0xff,
			.step 		= 0x1,
			.default_value 	= PO1030_BLUE_GAIN_DEFAULT,
			.flags         	= V4L2_CTRL_FLAG_SLIDER
		},
		.set = po1030_set_blue_balance,
		.get = po1030_get_blue_balance
	}, {
		{
			.id 		= V4L2_CID_HFLIP,
			.type 		= V4L2_CTRL_TYPE_BOOLEAN,
			.name 		= "horizontal flip",
			.minimum 	= 0,
			.maximum 	= 1,
			.step 		= 1,
			.default_value 	= 0,
		},
		.set = po1030_set_hflip,
		.get = po1030_get_hflip
	}, {
		{
			.id 		= V4L2_CID_VFLIP,
			.type 		= V4L2_CTRL_TYPE_BOOLEAN,
			.name 		= "vertical flip",
			.minimum 	= 0,
			.maximum 	= 1,
			.step 		= 1,
			.default_value 	= 0,
		},
		.set = po1030_set_vflip,
		.get = po1030_get_vflip
	}
};

static void po1030_dump_registers(struct sd *sd);

int po1030_probe(struct sd *sd)
@@ -74,7 +154,7 @@ int po1030_probe(struct sd *sd)
sensor_found:
	sd->gspca_dev.cam.cam_mode = po1030_modes;
	sd->gspca_dev.cam.nmodes = ARRAY_SIZE(po1030_modes);
	sd->desc->ctrls = po1030.ctrls;
	sd->desc->ctrls = po1030_ctrls;
	sd->desc->nctrls = ARRAY_SIZE(po1030_ctrls);
	return 0;
}
Loading