Skip to contentSkip to conversation

eMpia Microscope Camera

DISCUSSION Guennadi Liakhovetski 2 participants 4 messages Jul 3, 2009 – Jul 12, 2009 7 messages not in the archive Media (V4L/DVB)

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#7 lore raw

(re-adding the mailing list)

Quoted 4 lines · Wally

Hello Guennadi, hello Mauro

that's means i have to wait
or is there a workaround or something else i can do for now ?

you can either wait, or hack the mt9m001 driver to work for you, or help with development.

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

#8 lore raw

Em Fri, 3 Jul 2009 20:35:08 +0200 (CEST) Guennadi Liakhovetski <[email protected]> escreveu:

Quoted 11 lines

(re-adding the mailing list)

Quoted 4 lines · Wally

Hello Guennadi, hello Mauro

that's means i have to wait
or is there a workaround or something else i can do for now ?

you can either wait, or hack the mt9m001 driver to work for you, or help with development.

The change at em28xx for it should be trivial. The enclosed patch should provide the mt9v001 glue, once having it ported to v4l2 dev/subdev.

You'll need to use this patch _and_ the v4l dev/subdev version of mt9m001 driver.

Change Huaqi to use mt9m001 driver.

linux/drivers/media/video/em28xx/em28xx-cards.c +13 -2
@@ -512,8 +512,9 @@ struct em28xx_board em28xx_boards[] = {
 	[EM2860_BOARD_NETGMBH_CAM] = {
 		/* Beijing Huaqi Information Digital Technology Co., Ltd */
 		.name         = "NetGMBH Cam",
-		.valid        = EM28XX_BOARD_NOT_VALIDATED,
-		.tuner_type   = TUNER_ABSENT,	/* This is a webcam */
+		.tuner_type   = TUNER_ABSENT,
+		.is_27xx      = 1,
+		.decoder      = EM28XX_MT9M001,
 		.input        = { {
 			.type     = EM28XX_VMUX_COMPOSITE1,
 			.vmux     = 0,
@@ -1804,6 +1805,12 @@ static int em28xx_hint_sensor(struct em2
 		dev->model = EM2820_BOARD_SILVERCREST_WEBCAM;
 		sensor_name = "mt9v011";
 		break;
+        case 0x8411:
+        case 0x8421:
+        case 0x8431:
+                dev->model = EM2750_BOARD_DLCW_130;
+		sensor_name = "mt9m001";
+		break;
 	default:
 		printk("Unknown Sensor 0x%04x\n", be16_to_cpu(version));
 		return -EINVAL;
@@ -2371,6 +2378,10 @@ void em28xx_card_setup(struct em28xx *de
 		v4l2_i2c_new_probed_subdev(&dev->v4l2_dev, &dev->i2c_adap,
 			"mt9v011", "mt9v011", mt9v011_addrs);
 
+	if (dev->board.decoder == EM28XX_MT9M001)
+		v4l2_i2c_new_probed_subdev(&dev->v4l2_dev, &dev->i2c_adap,
+			"mt9m001", "mt9m001", mt9v011_addrs);
+
 	if (dev->board.adecoder == EM28XX_TVAUDIO)
 		v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap,
 			"tvaudio", "tvaudio", dev->board.tvaudio_addr);
linux/drivers/media/video/em28xx/em28xx.h +1 -0
@@ -363,6 +363,7 @@ enum em28xx_decoder {
 	EM28XX_TVP5150,
 	EM28XX_SAA711X,
 	EM28XX_MT9V011,
+	EM28XX_MT9M001,
 };
 
 enum em28xx_adecoder {

Cheers,
Mauro

#9 lore raw

Hi Wally,

Em Mon, 6 Jul 2009 10:15:05 -0300
Mauro Carvalho Chehab <[email protected]> escreveu:

Quoted 15 lines

Em Fri, 3 Jul 2009 20:35:08 +0200 (CEST) Guennadi Liakhovetski <[email protected]> escreveu:

Quoted 11 lines

(re-adding the mailing list)

Quoted 4 lines · Wally

Hello Guennadi, hello Mauro

that's means i have to wait
or is there a workaround or something else i can do for now ?

you can either wait, or hack the mt9m001 driver to work for you, or help with development.

Quoted 8 lines

The change at em28xx for it should be trivial. The enclosed patch should provide the mt9v001 glue, once having it ported to v4l2 dev/subdev.

You'll need to use this patch _and_ the v4l dev/subdev version of mt9m001 driver.

Change Huaqi to use mt9m001 driver.

I did a few changes on em28xx that will help to have a better webcam support. Due to that, the patch I've sent before won't apply anymore.

Could you please test the enclosed patch? It adds a hack that may work with mt9m001 sensor.

Cheers,
Mauro

---
 linux/drivers/media/video/em28xx/em28xx-cards.c |   55 ++++++++++++++++++++++++
 linux/drivers/media/video/em28xx/em28xx.h       |    1 
 2 files changed, 56 insertions(+)
linux/drivers/media/video/em28xx/em28xx-cards.c +55 -0
@@ -1778,6 +1778,46 @@ static inline void em28xx_set_model(stru
 				       EM28XX_I2C_FREQ_100_KHZ;
 }
 
+/* FIXME: Should be replaced by a proper mt9m001 driver */
+static int em28xx_initialize_mt9m001(struct em28xx *dev)
+{
+	int i;
+	unsigned char regs[][3] = {
+		{ 0x0d, 0x00, 0x01 },
+		{ 0x0d, 0x00, 0x00 },
+		{ 0x01, 0x00, 0x08 },   /* ROWSTART */
+		{ 0x02, 0x00, 0x14 },   /* COLSTART */
+		{ 0x03, 0x01, 0xe0 },   /* WINDOW HEIGHT */
+		{ 0x04, 0x02, 0x80 },   /* WINDOW WIDTH */
+		{ 0x05, 0x00, 0x01 },   /* HORIZONTAL BLANKING */
+		{ 0x06, 0x00, 0x01 },   /* VERTICAL BLANKING */
+		{ 0x0d, 0x00, 0x02 },
+		{ 0x0a, 0x00, 0x00 },
+		{ 0x0c, 0x00, 0x00 },
+		{ 0x11, 0x00, 0x00 },
+		{ 0x1e, 0x80, 0x00 },
+		{ 0x5f, 0x89, 0x04 },
+		{ 0x60, 0x00, 0x00 },
+		{ 0x61, 0x00, 0x00 },
+		{ 0x62, 0x04, 0x98 },
+		{ 0x63, 0x00, 0x00 },
+		{ 0x64, 0x00, 0x00 },
+		{ 0x20, 0x11, 0x1d },
+		{ 0x06, 0x00, 0xf2 },
+		{ 0x05, 0x00, 0x13 },
+		{ 0x09, 0x10, 0xf2 },
+		{ 0x07, 0x00, 0x03 },
+		{ 0x2b, 0x00, 0x2a },
+		{ 0x2d, 0x00, 0x2a },
+		{ 0x2c, 0x00, 0x2a },
+		{ 0x2e, 0x00, 0x29 },
+		{ 0x07, 0x00, 0x02 },
+	};
+
+	for (i = 0; i < ARRAY_SIZE(regs); i++)
+		i2c_master_send(&dev->i2c_client, &regs[i][0], 3);
+}
+
 /* HINT method: webcam I2C chips
  *
  * This method work for webcams with Micron sensors
@@ -1809,6 +1849,14 @@ static int em28xx_hint_sensor(struct em2
 		sensor_name = "mt9v011";
 		dev->em28xx_sensor = EM28XX_MT9V011;
 		break;
+	case 0x8411:
+	case 0x8421:
+	case 0x8431:
+		dev->model = EM2750_BOARD_UNKNOWN;
+		sensor_name = "mt9m001";
+		dev->em28xx_sensor = EM28XX_MT9M001;
+		em28xx_initialize_mt9m001(dev);
+		break;
 	default:
 		printk("Unknown Micron Sensor 0x%04x\n", be16_to_cpu(version));
 		return -EINVAL;
@@ -2376,6 +2424,13 @@ void em28xx_card_setup(struct em28xx *de
 		v4l2_i2c_new_probed_subdev(&dev->v4l2_dev, &dev->i2c_adap,
 			"mt9v011", "mt9v011", mt9v011_addrs);
 
+#if 0
+	/* FIXME: use mt9m001 after their conversion to v4l dev/subdev */
+	if (dev->em28xx_sensor == EM28XX_MT9M001)
+		v4l2_i2c_new_probed_subdev(&dev->v4l2_dev, &dev->i2c_adap,
+			"mt9m001", "mt9m001", mt9v011_addrs);
+#endif
+
 	if (dev->board.adecoder == EM28XX_TVAUDIO)
 		v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap,
 			"tvaudio", "tvaudio", dev->board.tvaudio_addr);
linux/drivers/media/video/em28xx/em28xx.h +1 -0
@@ -367,6 +367,7 @@ enum em28xx_decoder {
 enum em28xx_sensor {
 	EM28XX_NOSENSOR = 0,
 	EM28XX_MT9V011,
+	EM28XX_MT9M001,
 };
 
 enum em28xx_adecoder {
#10 lore raw
In reply to a message not in the archive

Em Fri, 3 Jul 2009 19:02:36 +0200 (CEST) Guennadi Liakhovetski <[email protected]> escreveu:

Quoted 89 lines · Mauro Carvalho Chehab
Quoted 82 lines

Em Fri, 3 Jul 2009 17:38:36 +0200
Wally <[email protected]> escreveu:

Quoted 69 lines

Hi Mauro,

built the driver without problems.

the rsult picture on mplayer is much better and the camera response now much better. But the picture sync (or something like this is still not ok).

Here are the logs:

removed all em28xx distro packages

$ hg clone http://www.linuxtv.org/hg/v4l-dvb
$ cd v4l-dvb
$ make
$ make rmmod
$ make install
$ modprobe em28xx

modprobe em28xx
dmesg

Linux video capture interface: v2.00
usbcore: registered new interface driver em28xx
em28xx driver loaded

plugin device
dmesg:

usb 5-2: new high speed USB device using ehci_hcd and address 2 usb 5-2: configuration #1 chosen from 1 choice
em28xx: New device @ 480 Mbps (eb1a:2750, interface 0, class 0) em28xx #0: Identified as Unknown EM2750/EM2751 webcam grabber (card=22) em28xx #0: chip ID is em2750
em28xx #0: board has no eeprom
em28xx #0: Config register raw data: 0x00
em28xx #0: v4l2 driver version 0.1.2
em28xx #0: V4L2 device registered as /dev/video0 and /dev/vbi0 usb 5-2: New USB device found, idVendor=eb1a, idProduct=2750 usb 5-2: New USB device strings: Mfr=0, Product=0, SerialNumber=0

same behavior of camera as was, green screen etc.

trying:
modprobe em28xx card=71
dmesg:

Linux video capture interface: v2.00
usbcore: registered new interface driver em28xx
em28xx driver loaded

plugin the device
dmesg:

usb 5-2: new high speed USB device using ehci_hcd and address 2 usb 5-2: configuration #1 chosen from 1 choice
em28xx: New device @ 480 Mbps (eb1a:2750, interface 0, class 0) em28xx #0: Identified as Silvercrest Webcam 1.3mpix (card=71) em28xx #0: chip ID is em2750
em28xx #0: board has no eeprom
mt9v011 4-005d: chip found @ 0xba (em28xx #0)
em28xx #0: Config register raw data: 0x00
mt9v011 4-005d: *** unknown micron chip detected (0x8431. em28xx #0: v4l2 driver version 0.1.2
em28xx #0: V4L2 device registered as /dev/video0 and /dev/vbi0 usb 5-2: New USB device found, idVendor=eb1a, idProduct=2750 usb 5-2: New USB device strings: Mfr=0, Product=0, SerialNumber=0 mt9v011 4-005d: *** unknown micron chip detected (0x8431.

Quoted 1 line

much better but still not recognizable picture.

Good!

Based on the chip version, this one seems to use mt9m001c2st sensor. This sensor is already supported by mt9m001 driver. It will probably work like a charm after using it. Yet, the mt9m001 currently uses a different API for I2C binding, although Guennadi is porting it to v4l2 dev/subdev.

Quoted 5 lines

Guennadi,

I saw some patches from you migrating soc_camera to v4l2 dev/subdev. When are you intending to send those patches to me? It would be cool if Wally could test the mt9m001 with em28xx driver

Quoted 7 lines

Hi Mauro

Yes, in my quilt stack soc-camera uses v4l2-subdev registration / module loading procedure and some operations. Currently I am fixing cropping / scaling (which, I hope, I interpreted correctly this time, although I haven't got your or Hans' or anyone else's opinion to my last question / interpretation) in all soc-camera drivers.

Ok. I'll seek for some time to better understand your question and give my impression about the crop/scaling question.

Quoted 6 lines

This makes the "legacy"
soc-camera API between the core and host drivers on one side and camera drivers on the other side quite thin. Still even when this is done, there are still some remaining bonds that have to be broken: 1) pixel format negotiation, 2) bus parameter negotiation, and we still haven't got your decision regarding whether or not we shall support autonegiation.

What thread are you referring to?

Quoted 4 lines

So, one delaying factor is that there is still some work to be done, and I don't think, I'll be getting more time for soc-camera in the near future. Another delaying factor, is that ARM platforms have missed the 2.6.31 merge window, so, we cannot convert now and have to wait until 2.6.32.

Are you meaning that you need some patches at arch/arm that aren't merged upstream yet? Are those patches already in linux-next?

Quoted 2 lines

Of course, development and testing can be done in a separate tree. My last snapshot is based on post 2.6.30.

Considering the regressions we had with 2.6.30, several of them directly or indirectly related to dev/subdev conversion, I prefer if you could send the soc-camera conversion on an early -rc kernel, to allow more time for testing inside v4l-dvb tree and at linux-next, before entering on a new merge window

Cheers,
Mauro