Skip to contentSkip to conversation

video: initial support for ADV7180

hg:v4l-dvb Richard Röjfors 2 participants 2 messages Sep 21, 2009 1 message 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]

#1 lore raw
Quoted 11 lines · Patch from Richard Röjfors

The patch number 13019 was added via Douglas Schilling Landgraf <[email protected]> to http://linuxtv.org/hg/v4l-dvb master development tree.

Kernel patches in this development tree may be modified to be backward compatible with older kernels. Compatibility modifications will be removed before inclusion into the mainstream Kernel

If anyone has any objections, please let us know by sending a message to:
Linux Media Mailing List <[email protected]>

------

Hi,

There is a newer version of the driver that has support for beeing interrupt driver and setting standard, and checking the signal status.

I would be very happy if that gets committed instead.

Here it is:
------

Support for the ADV7180 Video Decoder.

Includes support for setting, getting video standard and status. The driver can optionally be interrupt driven, otherwise it polls for standard when required.

---

drivers/media/video/Kconfig +9 -0
index 84b6fc1..ac9f636 100644
@@ -265,6 +265,15 @@ config VIDEO_SAA6588
 
 comment "Video decoders"
 
+config VIDEO_ADV7180
+	tristate "Analog Devices ADV7180 decoder"
+	depends on VIDEO_V4L2 && I2C
+	---help---
+	  Support for the Analog Devices ADV7180 video decoder.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called adv7180.
+
 config VIDEO_BT819
 	tristate "BT819A VideoStream decoder"
 	depends on VIDEO_V4L2 && I2C
drivers/media/video/Makefile +1 -0
index 9f2e321..aac0884 100644
@@ -45,6 +45,7 @@ obj-$(CONFIG_VIDEO_SAA7185) += saa7185.o
 obj-$(CONFIG_VIDEO_SAA7191) += saa7191.o
 obj-$(CONFIG_VIDEO_ADV7170) += adv7170.o
 obj-$(CONFIG_VIDEO_ADV7175) += adv7175.o
+obj-$(CONFIG_VIDEO_ADV7180) += adv7180.o
 obj-$(CONFIG_VIDEO_ADV7343) += adv7343.o
 obj-$(CONFIG_VIDEO_VPX3220) += vpx3220.o
 obj-$(CONFIG_VIDEO_BT819) += bt819.o
drivers/media/video/adv7180.c new file +466 -0

466 lines not on this page · raw message

include/media/v4l2-chip-ident.h +3 -0
index 94e908c..4e3eed9 100644
@@ -135,6 +135,9 @@ enum {
 	/* module adv7175: just ident 7175 */
 	V4L2_IDENT_ADV7175 = 7175,
 
+	/* module adv7180: just ident 7180 */
+	V4L2_IDENT_ADV7180 = 7180,
+
 	/* module saa7185: just ident 7185 */
 	V4L2_IDENT_SAA7185 = 7185,
 
#2 lore raw

Em Mon, 21 Sep 2009 09:28:51 +0200
Richard Röjfors <[email protected]> escreveu:

Quoted 11 lines
Quoted 10 lines · Patch from Richard Röjfors

The patch number 13019 was added via Douglas Schilling Landgraf <[email protected]> to http://linuxtv.org/hg/v4l-dvb master development tree.

Kernel patches in this development tree may be modified to be backward compatible with older kernels. Compatibility modifications will be removed before inclusion into the mainstream Kernel

If anyone has any objections, please let us know by sending a message to:
Linux Media Mailing List <[email protected]>

Quoted 8 lines
Quoted 1 line

------

Hi,

There is a newer version of the driver that has support for beeing interrupt driver and setting standard, and checking the signal status.

I would be very happy if that gets committed instead.

Hi Richard,

The previous version were already committed on our trees. So, please send us diff patches, instead of a completely new version.

As stated on Kernel Documentation/SubmittingPatches:

"If your changes produce a lot of deltas, you may want to look into splitting them into individual patches which modify things in logical stages. This will facilitate easier reviewing by other kernel developers, very important if you want your patch accepted."

So, if you are adding 3 new functionalities (interrupt, standard setting, signal status), the better is if you send us 3 patches.

Thanks,
Mauro.

Quoted 15 lines
drivers/media/video/adv7180.c new file +15 -0
+static int v4l2_std_to_adv7180(v4l2_std_id std)
+{
+	/* pal is a combination of several variants */
+	if (std & V4L2_STD_PAL)
+		return ADV7180_INPUT_CONTROL_PAL_BG;
+	if (std & V4L2_STD_NTSC)
+		return ADV7180_INPUT_CONTROL_NTSC_M;
+
+	switch (std) {
+	case V4L2_STD_PAL_60:
+		return ADV7180_INPUT_CONTROL_PAL60;
+	case V4L2_STD_NTSC_443:
+		return ADV7180_INPUT_CONTROL_NTSC_443;
+	case V4L2_STD_PAL_N:
+		return ADV7180_INPUT_CONTROL_PAL_N;

drivers/media/video/adv7180.c line 150

Quoted 10 lines
drivers/media/video/adv7180.c new file +10 -0
+	case V4L2_STD_PAL_M:
+		return ADV7180_INPUT_CONTROL_PAL_M;
+	case V4L2_STD_PAL_Nc:
+		return ADV7180_INPUT_CONTROL_PAL_COMB_N;
+	case V4L2_STD_SECAM:
+		return ADV7180_INPUT_CONTROL_PAL_SECAM;
+	default:
+		return -EINVAL;
+	}
+}

Btw, this code is not right.

All standards are bit masks. As such, it is valid that an userspace application to send a request like, for example, V4L2_STD_SECAM_K. This standard seems to be supported, but your driver will return -EINVAL.

What we generally do is to handle first the special cases where just one standard that requires especial treatment is defined (like PAL/60, PAL/M, PAL/N, ...) and then at the bottom, we handle the masks that covers more than one standard, like:

	if (std == V4L_STD_PAL_60)
		return ADV7180_INPUT_CONTROL_PAL60;
	...

	if (std & V4L2_STD_SECAM)
		return ADV7180_INPUT_CONTROL_PAL_SECAM;
	if (std & V4L2_STD_NTSC)
		return ADV7180_INPUT_CONTROL_NTSC_M;
	/* If it is none of the above, it is PAL */
	return ADV7180_INPUT_CONTROL_PAL_BG;

Cheers,
Mauro