[PATCH v2 1/1] lib/vsprintf: Add support for printing V4L2 and DRM fourccs

Mauro Carvalho Chehab mchehab+huawei at kernel.org
Mon Apr 6 07:46:45 UTC 2020


Em Fri, 3 Apr 2020 21:32:42 +0300
Andy Shevchenko <andy.shevchenko at gmail.com> escreveu:

> On Fri, Apr 3, 2020 at 8:54 PM Joe Perches <joe at perches.com> wrote:
> > On Fri, 2020-04-03 at 19:32 +0200, Mauro Carvalho Chehab wrote:  
> > > Em Fri, 03 Apr 2020 09:56:42 -0700
> > > Joe Perches <joe at perches.com> escreveu:  
> 
> > It _might_ be useful to use a CONFIG_MEDIA_SUPPORT guard
> > in lib/vsprintf for this.  
> 
> No need. FourCC, if Sakari makes it more generic, can be used for
> other purposes, e.g. printing component names from the chips (not
> related to media at all).
> 

Hmm... not 100% sure about what you're meaning with "component names".

At media, some vendors use a cc-like code to allow identifying the
name of the chip, retrieved on a common register via an I2C bus.
Omnivision uses, for example, uses a 2 bytes code:

	OV5670_CHIP_ID			0x5670
	OV5675_CHIP_ID			0x5675
	OV2680_CHIP_ID			0x2680
	OV5670_CHIP_ID			0x5670
	OV5675_CHIP_ID			0x5675

We used this at the em28xx driver to detect a camera sensor, and give
a name for the chip (see drivers/media/usb/em28xx/em28xx-camera.c):

		switch (id) {
		case 0x2642:
			name = "OV2640";
			dev->em28xx_sensor = EM28XX_OV2640;
			break;
		case 0x7648:
			name = "OV7648";
			break;
		case 0x7660:
			name = "OV7660";
			break;

Yet, this is not too reliable, as, for some products, they use something
different:

	OV8856_CHIP_ID			0x885a
	OV13858_CHIP_ID		0xd855

	OV9640 can either be 0x9648 or 0x9649, depending on its revision.

If you're referring to this kind of code, I don't think we can have
something generic.

Thanks,
Mauro


More information about the dri-devel mailing list