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

Commit d36bb4e7 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab
Browse files

V4L/DVB (12243): em28xx: allow specifying sensor xtal frequency



In order to properly estimate fps, mt9v011 sensor driver needs to know
what is the used frequency on the sensor cristal. Adds the proper fields
and initialization code for specifying the cristal frequency.

Also, based on experimentation, it was noticed that the Silvercrest is
outputing data at 7 fps. This means that it should be using a 6.3 MHz
cristal. This information needs to be double checked later, by opening
the device. Anyway, by using this value for xtal, at least now we have
the correct fps report.

Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 2ea472ff
Loading
Loading
Loading
Loading
+8 −3
Original line number Original line Diff line number Diff line
@@ -1734,6 +1734,7 @@ static int em28xx_hint_sensor(struct em28xx *dev)
		dev->em28xx_sensor = EM28XX_MT9V011;
		dev->em28xx_sensor = EM28XX_MT9V011;
		dev->sensor_xres = 640;
		dev->sensor_xres = 640;
		dev->sensor_yres = 480;
		dev->sensor_yres = 480;
		dev->sensor_xtal = 6300000;
		break;
		break;
	default:
	default:
		printk("Unknown Micron Sensor 0x%04x\n", be16_to_cpu(version));
		printk("Unknown Micron Sensor 0x%04x\n", be16_to_cpu(version));
@@ -2261,9 +2262,13 @@ void em28xx_card_setup(struct em28xx *dev)
		v4l2_i2c_new_probed_subdev(&dev->v4l2_dev, &dev->i2c_adap,
		v4l2_i2c_new_probed_subdev(&dev->v4l2_dev, &dev->i2c_adap,
			"tvp5150", "tvp5150", tvp5150_addrs);
			"tvp5150", "tvp5150", tvp5150_addrs);


	if (dev->em28xx_sensor == EM28XX_MT9V011)
	if (dev->em28xx_sensor == EM28XX_MT9V011) {
		v4l2_i2c_new_probed_subdev(&dev->v4l2_dev, &dev->i2c_adap,
		struct v4l2_subdev *sd;
			"mt9v011", "mt9v011", mt9v011_addrs);

		sd = v4l2_i2c_new_probed_subdev(&dev->v4l2_dev,
			 &dev->i2c_adap, "mt9v011", "mt9v011", mt9v011_addrs);
		v4l2_subdev_call(sd, core, s_config, 0, &dev->sensor_xtal);
	}


	if (dev->board.adecoder == EM28XX_TVAUDIO)
	if (dev->board.adecoder == EM28XX_TVAUDIO)
		v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap,
		v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap,
+2 −0
Original line number Original line Diff line number Diff line
@@ -478,8 +478,10 @@ struct em28xx {
	struct v4l2_device v4l2_dev;
	struct v4l2_device v4l2_dev;
	struct em28xx_board board;
	struct em28xx_board board;


	/* Webcam specific fields */
	enum em28xx_sensor em28xx_sensor;
	enum em28xx_sensor em28xx_sensor;
	int sensor_xres, sensor_yres;
	int sensor_xres, sensor_yres;
	int sensor_xtal;


	unsigned int stream_on:1;	/* Locks streams */
	unsigned int stream_on:1;	/* Locks streams */
	unsigned int has_audio_class:1;
	unsigned int has_audio_class:1;