Re: [PATCH 1/2] gspca pac7302: allow controlling LED separately
Hi, I missed the CONFIG_LEDS_CLASS_MODULE configuration option in the previous version of this patch, now it is added. Regards, Márton Németh --- From: Márton Németh On Labtec Webcam 2200 there is a feedback LED which can be controlled independent from the streaming. The feedback LED can be used from user space application to show for example detected motion or to distinguish between the preview and "on-air" state of the video stream. The default value of the LED trigger keeps the previous behaviour: LED is off when the stream is off, LED is on if the stream is on. The code is working in the following three cases: (1) when the LED subsystem ins not configured at all; (2) when the LED subsystem is available, but the LED triggers are not available and (3) when both the LED subsystem and LED triggers are configured. Signed-off-by: Márton Németh --- diff -r d8fafa7d88dc linux/drivers/media/video/gspca/pac7302.c --- a/linux/drivers/media/video/gspca/pac7302.c Thu Feb 18 19:02:51 2010 +0100 +++ b/linux/drivers/media/video/gspca/pac7302.c Sat Feb 27 09:10:44 2010 +0100 @@ -6,6 +6,7 @@ * * Separated from Pixart PAC7311 library by Márton Németh * Camera button input handling by Márton Németh + * LED control by Márton Németh * Copyright (C) 2009-2010 Márton Németh * * This program is free software; you can redistribute it and/or modify @@ -62,6 +63,7 @@ 0 | 0xc6 | setwhitebalance() 0 | 0xc7 | setbluebalance() 0 | 0xdc | setbrightcont(), setcolors() +1 | 0x78 | set_streaming_led() 3 | 0x02 | setexposure() 3 | 0x10 | setgain() 3 | 0x11 | setcolors(), setgain(), setexposure(), sethvflip() @@ -72,6 +74,8 @@ #include #include +#include +#include #include "gspca.h" MODULE_AUTHOR("Thomas Kaiser tho...@kaiser-linux.li"); @@ -91,6 +95,7 @@ unsigned char gain; unsigned char exposure; unsigned char autogain; + unsigned char led; __u8 hflip; __u8 vflip; u8 flags; @@ -101,6 +106,16 @@ u8 autogain_ignore_frames; atomic_t avg_lum; + +#if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE) + struct led_classdev led_cdev; + struct work_struct led_work; + char name[32]; +#ifdef CONFIG_LEDS_TRIGGERS + struct led_trigger led_trigger; + char trigger_name[32]; +#endif +#endif }; /* V4L2 controls supported by the driver */ @@ -572,6 +587,7 @@ sd->gain = GAIN_DEF; sd->exposure = EXPOSURE_DEF; sd->autogain = AUTOGAIN_DEF; + sd->led = 0; sd->hflip = HFLIP_DEF; sd->vflip = VFLIP_DEF; sd->flags = id->driver_info; @@ -716,6 +732,58 @@ reg_w(gspca_dev, 0x11, 0x01); } +static void set_streaming_led(struct gspca_dev *gspca_dev, u8 streaming) +{ + struct sd *sd = (struct sd *) gspca_dev; + u8 data = 0; + + if (sd->led) { + if (streaming) + data = 0x01; + else + data = 0x00; + } else { + if (streaming) + data = 0x41; + else + data = 0x40; + } + + reg_w(gspca_dev, 0xff, 0x01); + reg_w(gspca_dev, 0x78, data); +} + +#if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE) +/* Set the LED, may sleep */ +static void led_work(struct work_struct *work) +{ + struct sd *sd = container_of(work, struct sd, led_work); + struct gspca_dev *gspca_dev = &sd->gspca_dev; + + mutex_lock(&gspca_dev->usb_lock); + set_streaming_led(gspca_dev, gspca_dev->streaming); + mutex_unlock(&gspca_dev->usb_lock); +} + +/* LED state set request, must not sleep */ +static void led_set(struct led_classdev *led_cdev, + enum led_brightness value) +{ + u8 new_value; + struct sd *sd = container_of(led_cdev, struct sd, led_cdev); + + if (value == LED_OFF) + new_value = 0; + else + new_value = 1; + + if (sd->led != new_value) { + sd->led = new_value; + schedule_work(&sd->led_work); + } +} +#endif + /* this function is called at probe and resume time for pac7302 */ static int sd_init(struct gspca_dev *gspca_dev) { @@ -747,27 +815,60 @@ atomic_set(&sd->avg_lum, -1); /* start stream */ - reg_w(gspca_dev, 0xff, 0x01); - reg_w(gspca_dev, 0x78, 0x01); + +#if (defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE)) && defined(CONFIG_LEDS_TRIGGERS) + led_trigger_event(&sd->led_trigger, LED_FULL); +#elif defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE) + sd->led_cdev.brightness = sd->led_cdev.max_brightness; + if (!(sd->led_cdev.flags & LED_SUSPENDED)) + sd->led_cdev.brightness_set(&sd->led_cdev, + sd->led_cdev.brightness); +#else + sd-
Re: [PATCH 1/2] gspca pac7302: allow controlling LED separately
Hi, Hans de Goede wrote: > Hi, > > On 02/27/2010 01:20 AM, Németh Márton wrote: >> From: Márton Németh >> >> On Labtec Webcam 2200 there is a feedback LED which can be controlled >> independent from the streaming. > > This is true for a lot of cameras, so if we are going to add a way to > support control of the LED separate of the streaming state, we > should do that at the gspca_main level, and let sub drivers which > support this export a set_led callback function. If the code is moved to gspca_main level, what shall be the name of the LED? According to Documentation/leds-class.txt, chapter "LED Device Naming" my proposal for "devicename" would be: * /sys/class/leds/video-0::camera * /sys/class/leds/video-1::camera * /sys/class/leds/video-2::camera * ... or * /sys/class/leds/video0::camera * /sys/class/leds/video1::camera * /sys/class/leds/video2::camera * ... Which is the right one? > I must say I personally don't see much of a use case for this feature, > but I believe JF Moine does, so I'll leave further comments and > review of this to JF. I do believe it is important that if we go this > way we do so add the gspca_main level. > > Regards, > > Hans -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/2] gspca pac7302: allow controlling LED separately
On Sat, 27 Feb 2010 08:53:16 +0100 Hans de Goede wrote: > This is true for a lot of cameras, so if we are going to add a way to > support control of the LED separate of the streaming state, we > should do that at the gspca_main level, and let sub drivers which > support this export a set_led callback function. > > I must say I personally don't see much of a use case for this feature, > but I believe JF Moine does, so I'll leave further comments and > review of this to JF. I do believe it is important that if we go this > way we do so add the gspca_main level. Hi, I don't like this mechanism to switch on or off the webcam LEDs. Here are some arguments (some of them were sent last year to the list): 1) End users. Many Linux users don't know the kernel internals, nor which of the too many applications they should use to make their devices work. Actually, there are a few X11 programs in common Linux distros which can handle the webcam parameters: I just know about vlc and v4l2ucp, and they don't even handle the VIDIOC_G_JPEGCOMP and VIDIOC_S_JPEGCOMP ioctls which are part of the v4l2 API. The LED interface uses the /sys file system. Will the webcam programs offer access to this interface? I don't believe it. So, the users will have to search how they can switch on or off the LEDs of their webcams, and then, when found, they should start a X terminal and run a command to do the job! On the other hand, a webcam LED control, whether general or private, is available in the graphical interface as soon as the driver offers it. 2) Memory overhead. Using the led class adds more kernel code and asks the webcam drivers to create a new device. Also, the function called for changing the LED brighness cannot sleep, so the use a workqueue is required. On contrary, with a webcam control, only one byte (for 8 LEDs) is added to the webcam structure and the change is immediatly done in the ioctl. 3) Development. If nobody wants a LED control in the v4l2 interface, I think the code added to access the led class could be splitted between the different subsystem. For example, the workqueue handling could be done in the led class itself... Cheers. -- Ken ar c'hentañ | ** Breizh ha Linux atav! ** Jef | http://moinejf.free.fr/ -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/2] gspca pac7302: allow controlling LED separately
Hi, Jean-Francois Moine wrote: > On Sat, 27 Feb 2010 08:53:16 +0100 > Hans de Goede wrote: > >> This is true for a lot of cameras, so if we are going to add a way to >> support control of the LED separate of the streaming state, we >> should do that at the gspca_main level, and let sub drivers which >> support this export a set_led callback function. >> >> I must say I personally don't see much of a use case for this feature, >> but I believe JF Moine does, so I'll leave further comments and >> review of this to JF. I do believe it is important that if we go this >> way we do so add the gspca_main level. > > Hi, > > I don't like this mechanism to switch on or off the webcam LEDs. Here > are some arguments (some of them were sent last year to the list): I could accept both the V4L2 control solution or the LED subclass solution for handling the camera LED. I miss a little the positive side of using the LED subclass from the list, so I try take the role of that side and add them. > 1) End users. > > Many Linux users don't know the kernel internals, nor which of the too > many applications they should use to make their devices work. > > Actually, there are a few X11 programs in common Linux distros which can > handle the webcam parameters: I just know about vlc and v4l2ucp, and > they don't even handle the VIDIOC_G_JPEGCOMP and VIDIOC_S_JPEGCOMP > ioctls which are part of the v4l2 API. > > The LED interface uses the /sys file system. Will the webcam programs > offer access to this interface? I don't believe it. So, the users will > have to search how they can switch on or off the LEDs of their webcams, > and then, when found, they should start a X terminal and run a command > to do the job! The programs like v4l2ucp can be extended to handle the /sys/class/leds interface. This is work but the user will not recognise the difference as long as the GUI supports it. > On the other hand, a webcam LED control, whether general or private, is > available in the graphical interface as soon as the driver offers it. > > 2) Memory overhead. > > Using the led class adds more kernel code and asks the webcam drivers > to create a new device. Also, the function called for changing the LED > brighness cannot sleep, so the use a workqueue is required. Let me show the numbers on a 32bit machine: sizeof(struct gspca_dev) = 2032 bytes sizeof(struct led_classdev) = 112 bytes sizeof(struct work_struct) = 28 bytes sizeof(struct led_trigger) = 52 bytes Additionally two strings are also needed one for the LED device name and one for the LED trigger. Let's take 32 bytes for each (this value can be made smaller). This means that the necessary memory is 112+28+52+2*32 = 256 bytes. The pac7302 driver subdriver structure with LED device, workqueue and LED trigger is: sizeof(struct sd) = 2308 bytes So the memory usage increase is 1-2308/2032 = 13.6%. I would compare the structure size with the memory page size of the x86 system which is 4096 bytes (see the return value of getpagesize(2)). > On contrary, with a webcam control, only one byte (for 8 LEDs) is added > to the webcam structure and the change is immediatly done in the ioctl. > > 3) Development. > > If nobody wants a LED control in the v4l2 interface, I think the code > added to access the led class could be splitted between the different > subsystem. For example, the workqueue handling could be done in the led > class itself... Advantages of LED subsystem are: 4) Flexible usage of the camera LED for purposes unrelated to camera or unusual way, e.g. just blinking the LED with ledtrig-timer. 5) The status of the LED can be read back by reading /sys/class/leds/video0::camera/brightness. This is not possible when the "auto" menu item is selected from a V4L2 based menu control. Regards, Márton Németh -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/2] gspca pac7302: allow controlling LED separately
Hi, On 02/27/2010 04:35 PM, Németh Márton wrote: Hi, Jean-Francois Moine wrote: On Sat, 27 Feb 2010 08:53:16 +0100 Hans de Goede wrote: This is true for a lot of cameras, so if we are going to add a way to support control of the LED separate of the streaming state, we should do that at the gspca_main level, and let sub drivers which support this export a set_led callback function. I must say I personally don't see much of a use case for this feature, but I believe JF Moine does, so I'll leave further comments and review of this to JF. I do believe it is important that if we go this way we do so add the gspca_main level. Hi, I don't like this mechanism to switch on or off the webcam LEDs. Here are some arguments (some of them were sent last year to the list): I could accept both the V4L2 control solution or the LED subclass solution for handling the camera LED. I miss a little the positive side of using the LED subclass from the list, so I try take the role of that side and add them. I have to side with JF here, I see very little use in the led class interface for webcams. Another important reason to choose for a simple v4l2 menu control solution here is consistency certain logitech uvc cameras already offer Led control through a vendor extension control unit, which (when using uvcdynctrl to enable vendor extension control units), currently shows up as a v4l2 control. So for consistency with existing practices a v4l2 control seems better suited. Also I must say that the led class seems overkill. I would like to note that even if we go the v4l2 control way it still makes sense to handle this in gspca_main, rather then implementing it separately in every sub driver. 1) End users. Many Linux users don't know the kernel internals, nor which of the too many applications they should use to make their devices work. Actually, there are a few X11 programs in common Linux distros which can handle the webcam parameters: I just know about vlc and v4l2ucp, and they don't even handle the VIDIOC_G_JPEGCOMP and VIDIOC_S_JPEGCOMP ioctls which are part of the v4l2 API. The LED interface uses the /sys file system. Will the webcam programs offer access to this interface? I don't believe it. So, the users will have to search how they can switch on or off the LEDs of their webcams, and then, when found, they should start a X terminal and run a command to do the job! The programs like v4l2ucp can be extended to handle the /sys/class/leds interface. This is work but the user will not recognise the difference as long as the GUI supports it. Erm, no currently almost no v4l programs uses v4l2 controls properly, and I certainly see none supporting the led sysfs interface. I say this as someone who has done actual development on v4l2ucp, and who is currnetly involved in writing a GTK v4l2 control panel application. Regards, Hans -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[cron job] v4l-dvb daily build 2.6.22 and up: ERRORS, 2.6.16-2.6.21: ERRORS
This message is generated daily by a cron job that builds v4l-dvb for the kernels and architectures in the list below. Results of the daily build of v4l-dvb: date:Sat Feb 27 19:00:23 CET 2010 path:http://www.linuxtv.org/hg/v4l-dvb changeset: 14319:37581bb7e6f1 gcc version: i686-linux-gcc (GCC) 4.4.3 host hardware:x86_64 host os: 2.6.32.5 linux-2.6.32.6-armv5: OK linux-2.6.33-armv5: OK linux-2.6.32.6-armv5-davinci: WARNINGS linux-2.6.33-armv5-davinci: WARNINGS linux-2.6.32.6-armv5-dm365: ERRORS linux-2.6.33-armv5-dm365: ERRORS linux-2.6.32.6-armv5-ixp: OK linux-2.6.33-armv5-ixp: OK linux-2.6.32.6-armv5-omap2: OK linux-2.6.33-armv5-omap2: OK linux-2.6.22.19-i686: OK linux-2.6.23.17-i686: OK linux-2.6.24.7-i686: OK linux-2.6.25.20-i686: OK linux-2.6.26.8-i686: OK linux-2.6.27.44-i686: OK linux-2.6.28.10-i686: OK linux-2.6.29.1-i686: WARNINGS linux-2.6.30.10-i686: WARNINGS linux-2.6.31.12-i686: OK linux-2.6.32.6-i686: OK linux-2.6.33-i686: OK linux-2.6.32.6-m32r: OK linux-2.6.33-m32r: OK linux-2.6.32.6-mips: OK linux-2.6.33-mips: OK linux-2.6.32.6-powerpc64: WARNINGS linux-2.6.33-powerpc64: WARNINGS linux-2.6.22.19-x86_64: OK linux-2.6.23.17-x86_64: OK linux-2.6.24.7-x86_64: OK linux-2.6.25.20-x86_64: OK linux-2.6.26.8-x86_64: OK linux-2.6.27.44-x86_64: OK linux-2.6.28.10-x86_64: OK linux-2.6.29.1-x86_64: WARNINGS linux-2.6.30.10-x86_64: WARNINGS linux-2.6.31.12-x86_64: OK linux-2.6.32.6-x86_64: OK linux-2.6.33-x86_64: OK spec: OK sparse (linux-2.6.33): ERRORS linux-2.6.16.62-i686: ERRORS linux-2.6.17.14-i686: ERRORS linux-2.6.18.8-i686: OK linux-2.6.19.7-i686: OK linux-2.6.20.21-i686: OK linux-2.6.21.7-i686: OK linux-2.6.16.62-x86_64: ERRORS linux-2.6.17.14-x86_64: ERRORS linux-2.6.18.8-x86_64: OK linux-2.6.19.7-x86_64: OK linux-2.6.20.21-x86_64: OK linux-2.6.21.7-x86_64: OK Detailed results are available here: http://www.xs4all.nl/~hverkuil/logs/Saturday.log Full logs are available here: http://www.xs4all.nl/~hverkuil/logs/Saturday.tar.bz2 The V4L-DVB specification from this daily build is here: http://www.xs4all.nl/~hverkuil/spec/media.html -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/2] gspca pac7302: allow controlling LED separately
On Sat, 27 Feb 2010 20:12:05 +0100 Hans de Goede wrote: [snip] > I would like to note that even if we go the v4l2 control way it still > makes sense to handle this in gspca_main, rather then implementing it > separately in every sub driver. There is nothing to do in the gspca_main: the control just does a usb_control write. > I say this as someone ... who is currnetly > involved in writing a GTK v4l2 control panel application. Great! -- Ken ar c'hentañ | ** Breizh ha Linux atav! ** Jef | http://moinejf.free.fr/ -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 06/11] ov534: Fix Auto White Balance control
From: Max Thrun Set only the needed bits for AWB, and enable it by default. Signed-off-by: Max Thrun Signed-off-by: Antonio Ospite --- linux/drivers/media/video/gspca/ov534.c | 21 + 1 file changed, 13 insertions(+), 8 deletions(-) Index: gspca/linux/drivers/media/video/gspca/ov534.c === --- gspca.orig/linux/drivers/media/video/gspca/ov534.c +++ gspca/linux/drivers/media/video/gspca/ov534.c @@ -171,7 +171,7 @@ .minimum = 0, .maximum = 1, .step= 1, -#define AWB_DEF 0 +#define AWB_DEF 1 .default_value = AWB_DEF, }, .set = sd_setawb, @@ -718,10 +718,17 @@ { struct sd *sd = (struct sd *) gspca_dev; - if (sd->awb) - sccb_reg_write(gspca_dev, 0x63, 0xe0); /* AWB on */ - else - sccb_reg_write(gspca_dev, 0x63, 0xaa); /* AWB off */ + if (sd->awb) { + sccb_reg_write(gspca_dev, 0x13, + sccb_reg_read(gspca_dev, 0x13) | 0x02); + sccb_reg_write(gspca_dev, 0x63, + sccb_reg_read(gspca_dev, 0x63) | 0xc0); + } else { + sccb_reg_write(gspca_dev, 0x13, + sccb_reg_read(gspca_dev, 0x13) & ~0x02); + sccb_reg_write(gspca_dev, 0x63, + sccb_reg_read(gspca_dev, 0x63) & ~0xc0); + } } static void setaec(struct gspca_dev *gspca_dev) @@ -800,9 +807,7 @@ #else gspca_dev->ctrl_inac |= (1 << AWB_IDX); #endif -#if AWB_DEF != 0 - sd->awb = AWB_DEF -#endif + sd->awb = AWB_DEF; sd->aec = AEC_DEF; #if SHARPNESS_DEF != 0 sd->sharpness = SHARPNESS_DEF; -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 10/11] ov534: Add Powerline Frequency control
From: Mosalam Ebrahimi Note that setting this options to 50Hz can reduce the framerate, so the default is still 60Hz. Signed-off-by: Mosalam Ebrahimi Signed-off-by: Antonio Ospite --- linux/drivers/media/video/gspca/ov534.c | 71 +++- 1 file changed, 70 insertions(+), 1 deletion(-) Index: gspca/linux/drivers/media/video/gspca/ov534.c === --- gspca.orig/linux/drivers/media/video/gspca/ov534.c +++ gspca/linux/drivers/media/video/gspca/ov534.c @@ -66,7 +66,7 @@ s8 sharpness; u8 hflip; u8 vflip; - + u8 freqfltr; }; /* V4L2 controls supported by the driver */ @@ -90,6 +90,10 @@ static int sd_getbrightness(struct gspca_dev *gspca_dev, __s32 *val); static int sd_setcontrast(struct gspca_dev *gspca_dev, __s32 val); static int sd_getcontrast(struct gspca_dev *gspca_dev, __s32 *val); +static int sd_setfreqfltr(struct gspca_dev *gspca_dev, __s32 val); +static int sd_getfreqfltr(struct gspca_dev *gspca_dev, __s32 *val); +static int sd_querymenu(struct gspca_dev *gspca_dev, + struct v4l2_querymenu *menu); static const struct ctrl sd_ctrls[] = { { /* 0 */ @@ -233,6 +237,20 @@ .set = sd_setvflip, .get = sd_getvflip, }, +{ /* 10 */ + { + .id = V4L2_CID_POWER_LINE_FREQUENCY, + .type= V4L2_CTRL_TYPE_MENU, + .name= "Light Frequency Filter", + .minimum = 0, + .maximum = 1, + .step= 1, +#define FREQFLTR_DEF 1 + .default_value = FREQFLTR_DEF, + }, + .set = sd_setfreqfltr, + .get = sd_getfreqfltr, +}, }; static const struct v4l2_pix_format ov772x_mode[] = { @@ -779,6 +797,17 @@ sccb_reg_read(gspca_dev, 0x0c) & ~0x80); } +static void setfreqfltr(struct gspca_dev *gspca_dev) +{ + struct sd *sd = (struct sd *) gspca_dev; + + if (sd->freqfltr == 0) + sccb_reg_write(gspca_dev, 0x2b, 0x9e); + else + sccb_reg_write(gspca_dev, 0x2b, 0x00); +} + + /* this function is called at probe time */ static int sd_config(struct gspca_dev *gspca_dev, const struct usb_device_id *id) @@ -812,6 +841,7 @@ sd->sharpness = SHARPNESS_DEF; sd->hflip = HFLIP_DEF; sd->vflip = VFLIP_DEF; + sd->freqfltr = FREQFLTR_DEF; return 0; } @@ -881,6 +911,7 @@ setsharpness(gspca_dev); setvflip(gspca_dev); sethflip(gspca_dev); + setfreqfltr(gspca_dev); ov534_set_led(gspca_dev, 1); ov534_reg_write(gspca_dev, 0xe0, 0x00); @@ -1174,6 +1205,43 @@ return 0; } +static int sd_setfreqfltr(struct gspca_dev *gspca_dev, __s32 val) +{ + struct sd *sd = (struct sd *) gspca_dev; + + sd->freqfltr = val; + if (gspca_dev->streaming) + setfreqfltr(gspca_dev); + return 0; +} + +static int sd_getfreqfltr(struct gspca_dev *gspca_dev, __s32 *val) +{ + struct sd *sd = (struct sd *) gspca_dev; + + *val = sd->freqfltr; + return 0; +} + +static int sd_querymenu(struct gspca_dev *gspca_dev, + struct v4l2_querymenu *menu) +{ + switch (menu->id) { + case V4L2_CID_POWER_LINE_FREQUENCY: + switch (menu->index) { + case 0: /* V4L2_CID_POWER_LINE_FREQUENCY_50HZ */ + strcpy((char *) menu->name, "50 Hz"); + return 0; + case 1: /* V4L2_CID_POWER_LINE_FREQUENCY_60HZ */ + strcpy((char *) menu->name, "60 Hz"); + return 0; + } + break; + } + + return -EINVAL; +} + /* get stream parameters (framerate) */ static int sd_get_streamparm(struct gspca_dev *gspca_dev, struct v4l2_streamparm *parm) @@ -1225,6 +1293,7 @@ .start= sd_start, .stopN= sd_stopN, .pkt_scan = sd_pkt_scan, + .querymenu = sd_querymenu, .get_streamparm = sd_get_streamparm, .set_streamparm = sd_set_streamparm, }; -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 01/11] ov534: Remove ambiguous controls
From: Max Thrun Remove Blue/Red Channel Target Value, they are meant for Black Level Calibration but it is not completely clear how to use them. Signed-off-by: Max Thrun Signed-off-by: Antonio Ospite --- linux/drivers/media/video/gspca/ov534.c | 100 +--- 1 file changed, 6 insertions(+), 94 deletions(-) Index: gspca/linux/drivers/media/video/gspca/ov534.c === --- gspca.orig/linux/drivers/media/video/gspca/ov534.c +++ gspca/linux/drivers/media/video/gspca/ov534.c @@ -60,8 +60,6 @@ u8 contrast; u8 gain; u8 exposure; - u8 redblc; - u8 blueblc; u8 hue; u8 autogain; u8 awb; @@ -76,10 +74,6 @@ static int sd_getgain(struct gspca_dev *gspca_dev, __s32 *val); static int sd_setexposure(struct gspca_dev *gspca_dev, __s32 val); static int sd_getexposure(struct gspca_dev *gspca_dev, __s32 *val); -static int sd_setredblc(struct gspca_dev *gspca_dev, __s32 val); -static int sd_getredblc(struct gspca_dev *gspca_dev, __s32 *val); -static int sd_setblueblc(struct gspca_dev *gspca_dev, __s32 val); -static int sd_getblueblc(struct gspca_dev *gspca_dev, __s32 *val); static int sd_setautogain(struct gspca_dev *gspca_dev, __s32 val); static int sd_getautogain(struct gspca_dev *gspca_dev, __s32 *val); static int sd_setsharpness(struct gspca_dev *gspca_dev, __s32 val); @@ -156,34 +150,6 @@ }, { /* 4 */ { - .id = V4L2_CID_RED_BALANCE, - .type= V4L2_CTRL_TYPE_INTEGER, - .name= "Red Balance", - .minimum = 0, - .maximum = 255, - .step= 1, -#define RED_BALANCE_DEF 128 - .default_value = RED_BALANCE_DEF, - }, - .set = sd_setredblc, - .get = sd_getredblc, -}, -{ /* 5 */ - { - .id = V4L2_CID_BLUE_BALANCE, - .type= V4L2_CTRL_TYPE_INTEGER, - .name= "Blue Balance", - .minimum = 0, - .maximum = 255, - .step= 1, -#define BLUE_BALANCE_DEF 128 - .default_value = BLUE_BALANCE_DEF, - }, - .set = sd_setblueblc, - .get = sd_getblueblc, -}, -{ /* 6 */ - { .id = V4L2_CID_HUE, .type= V4L2_CTRL_TYPE_INTEGER, .name= "Hue", @@ -196,7 +162,7 @@ .set = sd_sethue, .get = sd_gethue, }, -{ /* 7 */ +{ /* 5 */ { .id = V4L2_CID_AUTOGAIN, .type= V4L2_CTRL_TYPE_BOOLEAN, @@ -210,8 +176,8 @@ .set = sd_setautogain, .get = sd_getautogain, }, -#define AWB_IDX 8 -{ /* 8 */ +#define AWB_IDX 6 +{ /* 6 */ { .id = V4L2_CID_AUTO_WHITE_BALANCE, .type= V4L2_CTRL_TYPE_BOOLEAN, @@ -225,7 +191,7 @@ .set = sd_setawb, .get = sd_getawb, }, -{ /* 9 */ +{ /* 7 */ { .id = V4L2_CID_SHARPNESS, .type= V4L2_CTRL_TYPE_INTEGER, @@ -239,7 +205,7 @@ .set = sd_setsharpness, .get = sd_getsharpness, }, -{ /* 10 */ +{ /* 8 */ { .id = V4L2_CID_HFLIP, .type= V4L2_CTRL_TYPE_BOOLEAN, @@ -253,7 +219,7 @@ .set = sd_sethflip, .get = sd_gethflip, }, -{ /* 11 */ +{ /* 9 */ { .id = V4L2_CID_VFLIP, .type= V4L2_CTRL_TYPE_BOOLEAN, @@ -722,20 +688,6 @@ sccb_reg_write(gspca_dev, 0x10, val << 1); } -static void setredblc(struct gspca_dev *gspca_dev) -{ - struct sd *sd = (struct sd *) gspca_dev; - - sccb_reg_write(gspca_dev, 0x43, sd->redblc); -} - -static void setblueblc(struct gspca_dev *gspca_dev) -{ - struct sd *sd = (struct sd *) gspca_dev; - - sccb_reg_write(gspca_dev, 0x42, sd->blueblc); -} - static void sethue(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; @@ -825,8 +777,6 @@ sd->contrast = CONTRAST_DEF; sd->gain = GAIN_DEF; sd->exposure = EXPO_DEF; - sd->redblc = RED_BALANCE_DEF; - sd->blueblc = BLUE_BALANCE_DEF; sd->hue = HUE_DEF; #if AUTOGAIN_DEF != 0 sd->autogain = AUTOGAIN_DEF; @@ -907,8 +857,6 @@ setautogain(gspca_dev);
[PATCH 07/11] ov534: Fixes for sharpness control
From: Max Thrun * Adjust comments for sharpness control * Set default value unconditionally, for readability Signed-off-by: Max Thrun Signed-off-by: Antonio Ospite --- linux/drivers/media/video/gspca/ov534.c |6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) Index: gspca/linux/drivers/media/video/gspca/ov534.c === --- gspca.orig/linux/drivers/media/video/gspca/ov534.c +++ gspca/linux/drivers/media/video/gspca/ov534.c @@ -751,8 +751,8 @@ u8 val; val = sd->sharpness; - sccb_reg_write(gspca_dev, 0x91, val); /* vga noise */ - sccb_reg_write(gspca_dev, 0x8e, val); /* qvga noise */ + sccb_reg_write(gspca_dev, 0x91, val); /* Auto de-noise threshold */ + sccb_reg_write(gspca_dev, 0x8e, val); /* De-noise threshold */ } static void sethflip(struct gspca_dev *gspca_dev) @@ -809,9 +809,7 @@ #endif sd->awb = AWB_DEF; sd->aec = AEC_DEF; -#if SHARPNESS_DEF != 0 sd->sharpness = SHARPNESS_DEF; -#endif #if HFLIP_DEF != 0 sd->hflip = HFLIP_DEF; #endif -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 11/11] ov534: Update copyright info
From: Max Thrun Signed-off-by: Max Thrun Signed-off-by: Antonio Ospite --- linux/drivers/media/video/gspca/ov534.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) Index: gspca/linux/drivers/media/video/gspca/ov534.c === --- gspca.orig/linux/drivers/media/video/gspca/ov534.c +++ gspca/linux/drivers/media/video/gspca/ov534.c @@ -10,8 +10,8 @@ * https://jim.sh/svn/jim/devl/playstation/ps3/eye/test/ * * PS3 Eye camera enhanced by Richard Kaswy http://kaswy.free.fr - * PS3 Eye camera, brightness, contrast, hue, AWB control added - * by Max Thrun + * PS3 Eye camera - brightness, contrast, awb, agc, aec controls + * added by Max Thrun * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 02/11] ov534: Remove hue control
Hue control doesn't work and the sensor datasheet is not clear about how to set hue properly. Signed-off-by: Antonio Ospite --- linux/drivers/media/video/gspca/ov534.c | 54 ++-- 1 file changed, 5 insertions(+), 49 deletions(-) Index: gspca/linux/drivers/media/video/gspca/ov534.c === --- gspca.orig/linux/drivers/media/video/gspca/ov534.c +++ gspca/linux/drivers/media/video/gspca/ov534.c @@ -60,7 +60,6 @@ u8 contrast; u8 gain; u8 exposure; - u8 hue; u8 autogain; u8 awb; s8 sharpness; @@ -82,8 +81,6 @@ static int sd_gethflip(struct gspca_dev *gspca_dev, __s32 *val); static int sd_setvflip(struct gspca_dev *gspca_dev, __s32 val); static int sd_getvflip(struct gspca_dev *gspca_dev, __s32 *val); -static int sd_sethue(struct gspca_dev *gspca_dev, __s32 val); -static int sd_gethue(struct gspca_dev *gspca_dev, __s32 *val); static int sd_setawb(struct gspca_dev *gspca_dev, __s32 val); static int sd_getawb(struct gspca_dev *gspca_dev, __s32 *val); static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val); @@ -150,20 +147,6 @@ }, { /* 4 */ { - .id = V4L2_CID_HUE, - .type= V4L2_CTRL_TYPE_INTEGER, - .name= "Hue", - .minimum = 0, - .maximum = 255, - .step= 1, -#define HUE_DEF 143 - .default_value = HUE_DEF, - }, - .set = sd_sethue, - .get = sd_gethue, -}, -{ /* 5 */ - { .id = V4L2_CID_AUTOGAIN, .type= V4L2_CTRL_TYPE_BOOLEAN, .name= "Autogain", @@ -176,8 +159,8 @@ .set = sd_setautogain, .get = sd_getautogain, }, -#define AWB_IDX 6 -{ /* 6 */ +#define AWB_IDX 5 +{ /* 5 */ { .id = V4L2_CID_AUTO_WHITE_BALANCE, .type= V4L2_CTRL_TYPE_BOOLEAN, @@ -191,7 +174,7 @@ .set = sd_setawb, .get = sd_getawb, }, -{ /* 7 */ +{ /* 6 */ { .id = V4L2_CID_SHARPNESS, .type= V4L2_CTRL_TYPE_INTEGER, @@ -205,7 +188,7 @@ .set = sd_setsharpness, .get = sd_getsharpness, }, -{ /* 8 */ +{ /* 7 */ { .id = V4L2_CID_HFLIP, .type= V4L2_CTRL_TYPE_BOOLEAN, @@ -219,7 +202,7 @@ .set = sd_sethflip, .get = sd_gethflip, }, -{ /* 9 */ +{ /* 8 */ { .id = V4L2_CID_VFLIP, .type= V4L2_CTRL_TYPE_BOOLEAN, @@ -688,13 +671,6 @@ sccb_reg_write(gspca_dev, 0x10, val << 1); } -static void sethue(struct gspca_dev *gspca_dev) -{ - struct sd *sd = (struct sd *) gspca_dev; - - sccb_reg_write(gspca_dev, 0x01, sd->hue); -} - static void setautogain(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; @@ -777,7 +753,6 @@ sd->contrast = CONTRAST_DEF; sd->gain = GAIN_DEF; sd->exposure = EXPO_DEF; - sd->hue = HUE_DEF; #if AUTOGAIN_DEF != 0 sd->autogain = AUTOGAIN_DEF; #else @@ -857,7 +832,6 @@ setautogain(gspca_dev); setawb(gspca_dev); setgain(gspca_dev); - sethue(gspca_dev); setexposure(gspca_dev); setbrightness(gspca_dev); setcontrast(gspca_dev); @@ -1040,24 +1014,6 @@ return 0; } -static int sd_sethue(struct gspca_dev *gspca_dev, __s32 val) -{ - struct sd *sd = (struct sd *) gspca_dev; - - sd->hue = val; - if (gspca_dev->streaming) - sethue(gspca_dev); - return 0; -} - -static int sd_gethue(struct gspca_dev *gspca_dev, __s32 *val) -{ - struct sd *sd = (struct sd *) gspca_dev; - - *val = sd->hue; - return 0; -} - static int sd_setautogain(struct gspca_dev *gspca_dev, __s32 val) { struct sd *sd = (struct sd *) gspca_dev; -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 00/11] ov534: Fixes and updates
Hi Jean-Francois, will you review/apply these changes please? Several fixes and updates: * Removed some controls because their state was not good enough * Added AEC * AGC and AWB enabled by default * Fixed setting/unsetting registers for - exposure - sharpness - hflip - vflip * Fixed coding style * Added Powerline Frequency control The only big behavioural change should be AGC enabled by default, if users want autogain disabled by default we can rediscuss this again. Special thanks to Max Thrun and Mosalam Ebrahimi. Regards, Antonio -- Antonio Ospite http://ao2.it PGP public key ID: 0x4553B001 A: Because it messes up the order in which people normally read text. See http://en.wikipedia.org/wiki/Posting_style Q: Why is top-posting such a bad thing? A: Top-posting. Q: What is the most annoying thing in e-mail? -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 03/11] ov534: Fix autogain control, enable it by default
From: Max Thrun * Use 'agc' instead of 'autogain' in the code so to align the naming as in AEC/AWB. * Tweak brightness and contrast default values. * Fix setting/resetting registers values for AGC. * Set actual gain back when disabling AGC. * Skip setting GAIN register when AGC is enabled. * Enable AGC by default. Note that as Auto Gain Control is now enabled by default, if you are using the driver for visual computing applications you might need to disable it explicitly in your software. Signed-off-by: Max Thrun Signed-off-by: Antonio Ospite --- linux/drivers/media/video/gspca/ov534.c | 53 ++-- 1 file changed, 30 insertions(+), 23 deletions(-) Index: gspca/linux/drivers/media/video/gspca/ov534.c === --- gspca.orig/linux/drivers/media/video/gspca/ov534.c +++ gspca/linux/drivers/media/video/gspca/ov534.c @@ -60,7 +60,7 @@ u8 contrast; u8 gain; u8 exposure; - u8 autogain; + u8 agc; u8 awb; s8 sharpness; u8 hflip; @@ -73,8 +73,8 @@ static int sd_getgain(struct gspca_dev *gspca_dev, __s32 *val); static int sd_setexposure(struct gspca_dev *gspca_dev, __s32 val); static int sd_getexposure(struct gspca_dev *gspca_dev, __s32 *val); -static int sd_setautogain(struct gspca_dev *gspca_dev, __s32 val); -static int sd_getautogain(struct gspca_dev *gspca_dev, __s32 *val); +static int sd_setagc(struct gspca_dev *gspca_dev, __s32 val); +static int sd_getagc(struct gspca_dev *gspca_dev, __s32 *val); static int sd_setsharpness(struct gspca_dev *gspca_dev, __s32 val); static int sd_getsharpness(struct gspca_dev *gspca_dev, __s32 *val); static int sd_sethflip(struct gspca_dev *gspca_dev, __s32 val); @@ -97,7 +97,7 @@ .minimum = 0, .maximum = 255, .step= 1, -#define BRIGHTNESS_DEF 20 +#define BRIGHTNESS_DEF 0 .default_value = BRIGHTNESS_DEF, }, .set = sd_setbrightness, @@ -111,7 +111,7 @@ .minimum = 0, .maximum = 255, .step= 1, -#define CONTRAST_DEF 37 +#define CONTRAST_DEF 32 .default_value = CONTRAST_DEF, }, .set = sd_setcontrast, @@ -149,15 +149,15 @@ { .id = V4L2_CID_AUTOGAIN, .type= V4L2_CTRL_TYPE_BOOLEAN, - .name= "Autogain", + .name= "Auto Gain", .minimum = 0, .maximum = 1, .step= 1, -#define AUTOGAIN_DEF 0 - .default_value = AUTOGAIN_DEF, +#define AGC_DEF 1 + .default_value = AGC_DEF, }, - .set = sd_setautogain, - .get = sd_getautogain, + .set = sd_setagc, + .get = sd_getagc, }, #define AWB_IDX 5 { /* 5 */ @@ -639,6 +639,9 @@ struct sd *sd = (struct sd *) gspca_dev; u8 val; + if (sd->agc) + return; + val = sd->gain; switch (val & 0x30) { case 0x00: @@ -671,18 +674,22 @@ sccb_reg_write(gspca_dev, 0x10, val << 1); } -static void setautogain(struct gspca_dev *gspca_dev) +static void setagc(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; - if (sd->autogain) { - sccb_reg_write(gspca_dev, 0x13, 0xf7); /* AGC,AEC,AWB ON */ + if (sd->agc) { + sccb_reg_write(gspca_dev, 0x13, + sccb_reg_read(gspca_dev, 0x13) | 0x04); sccb_reg_write(gspca_dev, 0x64, sccb_reg_read(gspca_dev, 0x64) | 0x03); } else { - sccb_reg_write(gspca_dev, 0x13, 0xf0); /* AGC,AEC,AWB OFF */ + sccb_reg_write(gspca_dev, 0x13, + sccb_reg_read(gspca_dev, 0x13) & ~0x04); sccb_reg_write(gspca_dev, 0x64, - sccb_reg_read(gspca_dev, 0x64) & 0xfc); + sccb_reg_read(gspca_dev, 0x64) & ~0x03); + + setgain(gspca_dev); } } @@ -753,8 +760,8 @@ sd->contrast = CONTRAST_DEF; sd->gain = GAIN_DEF; sd->exposure = EXPO_DEF; -#if AUTOGAIN_DEF != 0 - sd->autogain = AUTOGAIN_DEF; +#if AGC_DEF != 0 + sd->agc = AGC_DEF; #else gspca_dev->ctrl_inac |= (1 << AWB_IDX); #endif @@ -829,7 +836,7 @@ } set_frame_rate(gspca_dev); - setautogain(gspca_dev); + setagc(gspca_dev); setawb(gspca_dev); setgain(gspca_dev); setexposure(gspca_dev); @@ -1014,11 +1021,11 @@ return 0; } -static int sd_setautogain(struct gspca_dev *gspca_dev, __s32 val) +static int sd_setagc(struct gspca_dev *gspca_dev, __s32 val) { struct sd *sd = (struct sd *) gspca_dev; - sd->autogain = val; + sd->agc = val; if (gspca_dev->streaming) {
[PATCH 05/11] ov534: Fix setting manual exposure
Exposure is now a u16 value, both MSB and LSB are set, but values in the v4l2 control are limited to the interval [0,506] as 0x01fa (506) is the maximum observed value with AEC enabled. Skip setting exposure when AEC is enabled. Signed-off-by: Antonio Ospite --- linux/drivers/media/video/gspca/ov534.c | 14 +- 1 file changed, 9 insertions(+), 5 deletions(-) Index: gspca/linux/drivers/media/video/gspca/ov534.c === --- gspca.orig/linux/drivers/media/video/gspca/ov534.c +++ gspca/linux/drivers/media/video/gspca/ov534.c @@ -59,7 +59,7 @@ u8 brightness; u8 contrast; u8 gain; - u8 exposure; + u16 exposure; u8 agc; u8 awb; u8 aec; @@ -140,7 +140,7 @@ .type= V4L2_CTRL_TYPE_INTEGER, .name= "Exposure", .minimum = 0, - .maximum = 255, + .maximum = 506, .step= 1, #define EXPO_DEF 120 .default_value = EXPO_DEF, @@ -684,11 +684,15 @@ static void setexposure(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; - u8 val; + u16 val; + + if (sd->aec) + return; val = sd->exposure; - sccb_reg_write(gspca_dev, 0x08, val >> 7); - sccb_reg_write(gspca_dev, 0x10, val << 1); + sccb_reg_write(gspca_dev, 0x08, val >> 8); + sccb_reg_write(gspca_dev, 0x10, val & 0xff); + } static void setagc(struct gspca_dev *gspca_dev) -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 09/11] ov534: Cosmetics: fix indentation and hex digits
* Indent with tabs, not with spaces. * Less indentation for controls index comments. * Use lowercase hex digits. Signed-off-by: Antonio Ospite --- linux/drivers/media/video/gspca/ov534.c | 128 1 file changed, 64 insertions(+), 64 deletions(-) Index: gspca/linux/drivers/media/video/gspca/ov534.c === --- gspca.orig/linux/drivers/media/video/gspca/ov534.c +++ gspca/linux/drivers/media/video/gspca/ov534.c @@ -92,7 +92,7 @@ static int sd_getcontrast(struct gspca_dev *gspca_dev, __s32 *val); static const struct ctrl sd_ctrls[] = { -{ /* 0 */ +{ /* 0 */ { .id = V4L2_CID_BRIGHTNESS, .type= V4L2_CTRL_TYPE_INTEGER, @@ -105,8 +105,8 @@ }, .set = sd_setbrightness, .get = sd_getbrightness, -}, -{ /* 1 */ +}, +{ /* 1 */ { .id = V4L2_CID_CONTRAST, .type= V4L2_CTRL_TYPE_INTEGER, @@ -119,51 +119,51 @@ }, .set = sd_setcontrast, .get = sd_getcontrast, -}, -{ /* 2 */ +}, +{ /* 2 */ { - .id = V4L2_CID_GAIN, - .type= V4L2_CTRL_TYPE_INTEGER, - .name= "Main Gain", - .minimum = 0, - .maximum = 63, - .step= 1, + .id = V4L2_CID_GAIN, + .type= V4L2_CTRL_TYPE_INTEGER, + .name= "Main Gain", + .minimum = 0, + .maximum = 63, + .step= 1, #define GAIN_DEF 20 - .default_value = GAIN_DEF, + .default_value = GAIN_DEF, }, .set = sd_setgain, .get = sd_getgain, -}, -{ /* 3 */ +}, +{ /* 3 */ { - .id = V4L2_CID_EXPOSURE, - .type= V4L2_CTRL_TYPE_INTEGER, - .name= "Exposure", - .minimum = 0, - .maximum = 506, - .step= 1, + .id = V4L2_CID_EXPOSURE, + .type= V4L2_CTRL_TYPE_INTEGER, + .name= "Exposure", + .minimum = 0, + .maximum = 506, + .step= 1, #define EXPO_DEF 120 - .default_value = EXPO_DEF, + .default_value = EXPO_DEF, }, .set = sd_setexposure, .get = sd_getexposure, -}, -{ /* 4 */ +}, +{ /* 4 */ { - .id = V4L2_CID_AUTOGAIN, - .type= V4L2_CTRL_TYPE_BOOLEAN, - .name= "Auto Gain", - .minimum = 0, - .maximum = 1, - .step= 1, + .id = V4L2_CID_AUTOGAIN, + .type= V4L2_CTRL_TYPE_BOOLEAN, + .name= "Auto Gain", + .minimum = 0, + .maximum = 1, + .step= 1, #define AGC_DEF 1 - .default_value = AGC_DEF, + .default_value = AGC_DEF, }, .set = sd_setagc, .get = sd_getagc, -}, +}, #define AWB_IDX 5 -{ /* 5 */ +{ /* 5 */ { .id = V4L2_CID_AUTO_WHITE_BALANCE, .type= V4L2_CTRL_TYPE_BOOLEAN, @@ -176,8 +176,8 @@ }, .set = sd_setawb, .get = sd_getawb, -}, -{ /* 6 */ +}, +{ /* 6 */ { .id = V4L2_CID_EXPOSURE_AUTO, .type= V4L2_CTRL_TYPE_BOOLEAN, @@ -190,49 +190,49 @@ }, .set = sd_setaec, .get = sd_getaec, -}, -{ /* 7 */ +}, +{ /* 7 */ { - .id = V4L2_CID_SHARPNESS, - .type= V4L2_CTRL_TYPE_INTEGER, - .name= "Sharpness", - .minimum = 0, - .maximum = 63, - .step= 1, + .id = V4L2_CID_SHARPNESS, + .type= V4L2_CTRL_TYPE_INTEGER, + .name= "Sharpness", + .minimum = 0, + .maximum = 63, + .step= 1, #define SHARPNESS_DEF 0 - .default_value = SHARPNESS_DEF, + .default_value = SHARPNESS_DEF, }, .set = sd_setsharpness, .get = sd_getsharpness, -}, -{ /* 8 */ +}, +{ /* 8 */ { - .id = V4L2_CID_HFLIP, - .type= V4L2_CTRL_TYPE_BOOLEAN, - .name= "HFlip", - .minimum = 0, - .maximum = 1, - .step= 1, + .id = V4L2_CID_HFLIP, +
[PATCH 04/11] ov534: Add Auto Exposure
From: Max Thrun This also makes manual exposure actually work: it never worked before because AEC was always enabled. Signed-off-by: Max Thrun Signed-off-by: Antonio Ospite --- linux/drivers/media/video/gspca/ov534.c | 55 ++-- 1 file changed, 53 insertions(+), 2 deletions(-) Index: gspca/linux/drivers/media/video/gspca/ov534.c === --- gspca.orig/linux/drivers/media/video/gspca/ov534.c +++ gspca/linux/drivers/media/video/gspca/ov534.c @@ -62,6 +62,7 @@ u8 exposure; u8 agc; u8 awb; + u8 aec; s8 sharpness; u8 hflip; u8 vflip; @@ -83,6 +84,8 @@ static int sd_getvflip(struct gspca_dev *gspca_dev, __s32 *val); static int sd_setawb(struct gspca_dev *gspca_dev, __s32 val); static int sd_getawb(struct gspca_dev *gspca_dev, __s32 *val); +static int sd_setaec(struct gspca_dev *gspca_dev, __s32 val); +static int sd_getaec(struct gspca_dev *gspca_dev, __s32 *val); static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val); static int sd_getbrightness(struct gspca_dev *gspca_dev, __s32 *val); static int sd_setcontrast(struct gspca_dev *gspca_dev, __s32 val); @@ -176,6 +179,20 @@ }, { /* 6 */ { + .id = V4L2_CID_EXPOSURE_AUTO, + .type= V4L2_CTRL_TYPE_BOOLEAN, + .name= "Auto Exposure", + .minimum = 0, + .maximum = 1, + .step= 1, +#define AEC_DEF 1 + .default_value = AEC_DEF, + }, + .set = sd_setaec, + .get = sd_getaec, +}, +{ /* 7 */ + { .id = V4L2_CID_SHARPNESS, .type= V4L2_CTRL_TYPE_INTEGER, .name= "Sharpness", @@ -188,7 +205,7 @@ .set = sd_setsharpness, .get = sd_getsharpness, }, -{ /* 7 */ +{ /* 8 */ { .id = V4L2_CID_HFLIP, .type= V4L2_CTRL_TYPE_BOOLEAN, @@ -202,7 +219,7 @@ .set = sd_sethflip, .get = sd_gethflip, }, -{ /* 8 */ +{ /* 9 */ { .id = V4L2_CID_VFLIP, .type= V4L2_CTRL_TYPE_BOOLEAN, @@ -703,6 +720,20 @@ sccb_reg_write(gspca_dev, 0x63, 0xaa); /* AWB off */ } +static void setaec(struct gspca_dev *gspca_dev) +{ + struct sd *sd = (struct sd *) gspca_dev; + + if (sd->aec) + sccb_reg_write(gspca_dev, 0x13, + sccb_reg_read(gspca_dev, 0x13) | 0x01); + else { + sccb_reg_write(gspca_dev, 0x13, + sccb_reg_read(gspca_dev, 0x13) & ~0x01); + setexposure(gspca_dev); + } +} + static void setsharpness(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; @@ -768,6 +799,7 @@ #if AWB_DEF != 0 sd->awb = AWB_DEF #endif + sd->aec = AEC_DEF; #if SHARPNESS_DEF != 0 sd->sharpness = SHARPNESS_DEF; #endif @@ -838,6 +870,7 @@ setagc(gspca_dev); setawb(gspca_dev); + setaec(gspca_dev); setgain(gspca_dev); setexposure(gspca_dev); setbrightness(gspca_dev); @@ -1066,6 +1099,24 @@ return 0; } +static int sd_setaec(struct gspca_dev *gspca_dev, __s32 val) +{ + struct sd *sd = (struct sd *) gspca_dev; + + sd->aec = val; + if (gspca_dev->streaming) + setaec(gspca_dev); + return 0; +} + +static int sd_getaec(struct gspca_dev *gspca_dev, __s32 *val) +{ + struct sd *sd = (struct sd *) gspca_dev; + + *val = sd->aec; + return 0; +} + static int sd_setsharpness(struct gspca_dev *gspca_dev, __s32 val) { struct sd *sd = (struct sd *) gspca_dev; -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 08/11] ov534: Fix unsetting hflip and vflip bits
From: Max Thrun Also set default values unconditionally, for readability. Signed-off-by: Max Thrun Signed-off-by: Antonio Ospite --- linux/drivers/media/video/gspca/ov534.c |8 ++-- 1 file changed, 2 insertions(+), 6 deletions(-) Index: gspca/linux/drivers/media/video/gspca/ov534.c === --- gspca.orig/linux/drivers/media/video/gspca/ov534.c +++ gspca/linux/drivers/media/video/gspca/ov534.c @@ -764,7 +764,7 @@ sccb_reg_read(gspca_dev, 0x0c) | 0x40); else sccb_reg_write(gspca_dev, 0x0c, - sccb_reg_read(gspca_dev, 0x0c) & 0xbf); + sccb_reg_read(gspca_dev, 0x0c) & ~0x40); } static void setvflip(struct gspca_dev *gspca_dev) @@ -776,7 +776,7 @@ sccb_reg_read(gspca_dev, 0x0c) | 0x80); else sccb_reg_write(gspca_dev, 0x0c, - sccb_reg_read(gspca_dev, 0x0c) & 0x7f); + sccb_reg_read(gspca_dev, 0x0c) & ~0x80); } /* this function is called at probe time */ @@ -810,12 +810,8 @@ sd->awb = AWB_DEF; sd->aec = AEC_DEF; sd->sharpness = SHARPNESS_DEF; -#if HFLIP_DEF != 0 sd->hflip = HFLIP_DEF; -#endif -#if VFLIP_DEF != 0 sd->vflip = VFLIP_DEF; -#endif return 0; } -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
No any working frequency/transponder with conceptronic ctvdigrcu
Hi all, I'm new to DVB-T as I just bought a Conceptronic CTVDIGRCU v3.0 (usb dvb-t device), so I hope I do not ask a stupid question, but I do not get any results when executing: ./w_scan -ft -c NL It returns (after a long list of frequency/time logging): ERROR: Sorry - i couldn't get any working frequency/transponder Nothing to scan!! I first tried the stock dvb-v4l in Ubuntu Karmic 2.6.31-19-generic and the w_scan from the repostory and after that the one from hg clone http://linuxtv.org/hg/v4l-dvb/ and w_scan from: wget "http://wirbel.htpc-forum.de/w_scan/w_scan-20091230.tar.bz2 ... but with the same result. My Windows 7 with media center does work with the antenna in exactly the same position. I do get some errors in dmesg but I'm not sure if they harmful: Feb 27 16:34:51 spock kernel: [ 111.934075] tda18271: performing RF tracking filter calibration Feb 27 16:34:53 spock kernel: [ 113.733475] af9013: I2C read failed reg:d417 Feb 27 16:34:53 spock kernel: [ 113.733496] tda18271: RF tracking filter calibration failed! Feb 27 16:36:37 spock kernel: [ 217.485162] tda18271: performing RF tracking filter calibration Feb 27 16:36:40 spock kernel: [ 220.636388] tda18271: RF tracking filter calibration complete Feb 27 16:43:05 spock kernel: [ 605.802390] af9013: I2C read failed reg:d417 Feb 27 16:43:05 spock kernel: [ 605.802639] af9013: I2C write failed reg:d3c0 len:1 Can somebody help me or point me to the right direction? Roalt | -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH firmware 6/6] Add firmware for lgs8g75
This is taken from the lgs8gxx driver as of 2.6.32-rc5. Signed-off-by: Ben Hutchings --- The binary changes are omitted from this message as they are impossible to review. Ben. WHENCE |9 + lgs8g75.fw | Bin 0 -> 262 bytes 2 files changed, 9 insertions(+), 0 deletions(-) create mode 100644 lgs8g75.fw diff --git a/WHENCE b/WHENCE index d62468e..659e255 100644 --- a/WHENCE +++ b/WHENCE @@ -1184,3 +1184,12 @@ Found in hex form in kernel source. -- +Driver: lgs8gxx - Legend Silicon GB20600 demodulator driver + +File: lgs8g75.fw + +Licence: Unknown + +Found in hex form in kernel source. + +-- -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Call for testers: HVR-900R2 and PCTV 330e
I'm finally happy to announce that we've got a working version of the drx-d driver and I'm looking for testers if you happen to own an HVR-900 R2 or PCTV 330e (USB ids 2040:6502 and 2304:0226) More details as to where to find the tree and how to install it can be found here: http://www.kernellabs.com/blog/?p=1397 Feedback welcome (either here or in the blog post comments) Cheers, Devin -- Devin J. Heitmueller - Kernel Labs http://www.kernellabs.com -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PULL] http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2
Hello Mauro, Please PULL from http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2 for the following: as102: import initial as102 driver as102: checkpatch fixes as102: checkpatch fixes as102: checkpatch fixes as102: checkpatch fixes as102: checkpatch fixes as102: checkpatch fixes as102: checkpatch fixes as102: Add Elgato EyeTV DTT Deluxe as102: properly handle multiple product names as102: fix compile warning about unused function Thanks to Rainer Miethling from PCTV Systems for working to get the driver released (for use with the PCTV 74e) and Pierrick Hascoet from Abilis for authoring the original driver. Devin -- Devin J. Heitmueller - Kernel Labs http://www.kernellabs.com -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] Input: scancode in get/set_keycodes should be unsigned
The HID layer has some scan codes of the form 0xffbc for logitech devices which do not work if scancode is typed as signed int, so we need to switch to unsigned int instead. While at it keycode being signed does not make much sense either. Signed-off-by: Dmitry Torokhov --- Guys, I was originally going to switch all platfrom drivers to use sparse keymap libary to eliminate at least one subsystem from this patch but it takes longer than I anticipated so here is mechanical conversion. I'd really like to make get/set keycodes usable for HID so I'd like to get this patch in before .34-rc1, could I get some ACKs please? Thanks! drivers/hid/hid-input.c| 24 drivers/input/evdev.c |2 +- drivers/input/input.c | 20 +--- drivers/input/misc/ati_remote2.c | 14 +++--- drivers/input/misc/winbond-cir.c | 12 +--- drivers/input/sparse-keymap.c |6 -- drivers/media/IR/ir-keytable.c |4 ++-- drivers/media/dvb/dvb-usb/dvb-usb-remote.c |4 ++-- drivers/platform/x86/asus-laptop.c | 15 +++ drivers/platform/x86/dell-wmi.c| 16 +++- drivers/platform/x86/hp-wmi.c | 15 +++ drivers/platform/x86/panasonic-laptop.c| 15 +++ drivers/platform/x86/topstar-laptop.c | 13 ++--- drivers/platform/x86/toshiba_acpi.c| 17 +++-- include/linux/input.h | 20 15 files changed, 95 insertions(+), 102 deletions(-) diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c index 79d9edd..7a0d2e4 100644 --- a/drivers/hid/hid-input.c +++ b/drivers/hid/hid-input.c @@ -68,22 +68,25 @@ static const struct { #define map_key_clear(c) hid_map_usage_clear(hidinput, usage, &bit, \ &max, EV_KEY, (c)) -static inline int match_scancode(int code, int scancode) +static inline int match_scancode(unsigned int code, unsigned int scancode) { if (scancode == 0) return 1; - return ((code & (HID_USAGE_PAGE | HID_USAGE)) == scancode); + + return (code & (HID_USAGE_PAGE | HID_USAGE)) == scancode; } -static inline int match_keycode(int code, int keycode) +static inline int match_keycode(unsigned int code, unsigned int keycode) { if (keycode == 0) return 1; - return (code == keycode); + + return code == keycode; } static struct hid_usage *hidinput_find_key(struct hid_device *hid, - int scancode, int keycode) + unsigned int scancode, + unsigned int keycode) { int i, j, k; struct hid_report *report; @@ -105,8 +108,8 @@ static struct hid_usage *hidinput_find_key(struct hid_device *hid, return NULL; } -static int hidinput_getkeycode(struct input_dev *dev, int scancode, - int *keycode) +static int hidinput_getkeycode(struct input_dev *dev, + unsigned int scancode, unsigned int *keycode) { struct hid_device *hid = input_get_drvdata(dev); struct hid_usage *usage; @@ -119,16 +122,13 @@ static int hidinput_getkeycode(struct input_dev *dev, int scancode, return -EINVAL; } -static int hidinput_setkeycode(struct input_dev *dev, int scancode, - int keycode) +static int hidinput_setkeycode(struct input_dev *dev, + unsigned int scancode, unsigned int keycode) { struct hid_device *hid = input_get_drvdata(dev); struct hid_usage *usage; int old_keycode; - if (keycode < 0 || keycode > KEY_MAX) - return -EINVAL; - usage = hidinput_find_key(hid, scancode, 0); if (usage) { old_keycode = usage->code; diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c index 9f9816b..2ee6c7a 100644 --- a/drivers/input/evdev.c +++ b/drivers/input/evdev.c @@ -515,7 +515,7 @@ static long evdev_do_ioctl(struct file *file, unsigned int cmd, struct input_absinfo abs; struct ff_effect effect; int __user *ip = (int __user *)p; - int i, t, u, v; + unsigned int i, t, u, v; int error; switch (cmd) { diff --git a/drivers/input/input.c b/drivers/input/input.c index 41168d5..e2dd885 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c @@ -582,7 +582,8 @@ static int input_fetch_keycode(struct input_dev *dev, int scancode) } static int input_default_getkeycode(struct input_dev *dev, - int scancode, int *keycode) + unsigned int scancode, + unsigned int *keycode) { if (!dev->keycodesize) return -EINVAL; @@
Re: [PATCH] Input: scancode in get/set_keycodes should be unsigned
Hi, Dmitry Torokhov wrote: > The HID layer has some scan codes of the form 0xffbc for logitech > devices which do not work if scancode is typed as signed int, so we need > to switch to unsigned int instead. While at it keycode being signed does > not make much sense either. Are the scan codes and key codes always 4 bytes long? Then the u32 data type could be used to take 16 bit (or 64 bit) processors also into consideration. Regards, Márton Németh -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] Input: scancode in get/set_keycodes should be unsigned
On Sun, Feb 28, 2010 at 07:44:32AM +0100, Németh Márton wrote: > Hi, > Dmitry Torokhov wrote: > > The HID layer has some scan codes of the form 0xffbc for logitech > > devices which do not work if scancode is typed as signed int, so we need > > to switch to unsigned int instead. While at it keycode being signed does > > not make much sense either. > > Are the scan codes and key codes always 4 bytes long? Then the u32 data > type could be used to take 16 bit (or 64 bit) processors also into > consideration. > We do not support 16 bit processors and for 64 bit 'unsigned int' is still 32 bits. -- Dmitry -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Mumu DVB & Infinity Smart Card reader
Hi, It will be great full if somebody can help me use Infinity smart card reader to tune scrambled channel in mumudvb. Regards, Aslam -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/3] add feedback LED control
From: Márton Németh On some webcams a feedback LED can be found. This LED usually shows the state of streaming mode: this is the "Auto" mode. The LED can be programmed to constantly switched off state (e.g. for power saving reasons, preview mode) or on state (e.g. the application shows motion detection or "on-air"). Signed-off-by: Márton Németh --- diff -r d8fafa7d88dc linux/Documentation/DocBook/v4l/controls.xml --- a/linux/Documentation/DocBook/v4l/controls.xml Thu Feb 18 19:02:51 2010 +0100 +++ b/linux/Documentation/DocBook/v4l/controls.xml Sun Feb 28 08:41:17 2010 +0100 @@ -311,6 +311,17 @@ Applications depending on particular custom controls should check the driver name and version, see . + + V4L2_CID_LED + enum + Controls the feedback LED on the camera. In auto mode +the LED is on when the streaming is active. The LED is off when not streaming. +The LED can be also turned on and off independent from streaming. +Possible values for enum v4l2_led are: +V4L2_CID_LED_AUTO (0), +V4L2_CID_LED_ON (1) and +V4L2_CID_LED_OFF (2). + diff -r d8fafa7d88dc linux/Documentation/DocBook/v4l/videodev2.h.xml --- a/linux/Documentation/DocBook/v4l/videodev2.h.xml Thu Feb 18 19:02:51 2010 +0100 +++ b/linux/Documentation/DocBook/v4l/videodev2.h.xml Sun Feb 28 08:41:17 2010 +0100 @@ -1024,8 +1024,14 @@ #define V4L2_CID_ROTATE (V4L2_CID_BASE+34) #define V4L2_CID_BG_COLOR (V4L2_CID_BASE+35) +#define V4L2_CID_LED(V4L2_CID_BASE+36) +enum v4l2_led { +V4L2_LED_AUTO = 0, +V4L2_LED_ON = 1, +V4L2_LED_OFF= 2, +}; /* last CID + 1 */ -#define V4L2_CID_LASTP1 (V4L2_CID_BASE+36) +#define V4L2_CID_LASTP1 (V4L2_CID_BASE+37) /* MPEG-class control IDs defined by V4L2 */ #define V4L2_CID_MPEG_BASE (V4L2_CTRL_CLASS_MPEG | 0x900) diff -r d8fafa7d88dc linux/drivers/media/video/v4l2-common.c --- a/linux/drivers/media/video/v4l2-common.c Thu Feb 18 19:02:51 2010 +0100 +++ b/linux/drivers/media/video/v4l2-common.c Sun Feb 28 08:41:17 2010 +0100 @@ -349,6 +349,12 @@ "75 useconds", NULL, }; + static const char *led[] = { + "Auto", + "On", + "Off", + NULL, + }; switch (id) { case V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ: @@ -389,6 +395,8 @@ return colorfx; case V4L2_CID_TUNE_PREEMPHASIS: return tune_preemphasis; + case V4L2_CID_LED: + return led; default: return NULL; } @@ -434,6 +442,7 @@ case V4L2_CID_COLORFX: return "Color Effects"; case V4L2_CID_ROTATE: return "Rotate"; case V4L2_CID_BG_COLOR: return "Background color"; + case V4L2_CID_LED: return "Feedback LED"; /* MPEG controls */ case V4L2_CID_MPEG_CLASS: return "MPEG Encoder Controls"; @@ -575,6 +584,7 @@ case V4L2_CID_EXPOSURE_AUTO: case V4L2_CID_COLORFX: case V4L2_CID_TUNE_PREEMPHASIS: + case V4L2_CID_LED: qctrl->type = V4L2_CTRL_TYPE_MENU; step = 1; break; diff -r d8fafa7d88dc linux/include/linux/videodev2.h --- a/linux/include/linux/videodev2.h Thu Feb 18 19:02:51 2010 +0100 +++ b/linux/include/linux/videodev2.h Sun Feb 28 08:41:17 2010 +0100 @@ -1030,8 +1030,14 @@ #define V4L2_CID_ROTATE(V4L2_CID_BASE+34) #define V4L2_CID_BG_COLOR (V4L2_CID_BASE+35) +#define V4L2_CID_LED (V4L2_CID_BASE+36) +enum v4l2_led { + V4L2_LED_AUTO = 0, + V4L2_LED_ON = 1, + V4L2_LED_OFF= 2, +}; /* last CID + 1 */ -#define V4L2_CID_LASTP1 (V4L2_CID_BASE+36) +#define V4L2_CID_LASTP1 (V4L2_CID_BASE+37) /* MPEG-class control IDs defined by V4L2 */ #define V4L2_CID_MPEG_BASE (V4L2_CTRL_CLASS_MPEG | 0x900) -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/3] gspca pac7302: add LED control
From: Márton Németh On Labtec Webcam 2200 there is a feedback LED which can be controlled independent from the streaming. The feedback LED can be used from user space application to show for example detected motion or to distinguish between the preview and "on-air" state of the video stream. The default value of the LED control is "Auto" which keeps the previous behaviour: LED is off when the stream is off, LED is on if the stream is on. Signed-off-by: Márton Németh --- diff -r d8fafa7d88dc linux/drivers/media/video/gspca/pac7302.c --- a/linux/drivers/media/video/gspca/pac7302.c Thu Feb 18 19:02:51 2010 +0100 +++ b/linux/drivers/media/video/gspca/pac7302.c Sun Feb 28 08:41:17 2010 +0100 @@ -6,6 +6,7 @@ * * Separated from Pixart PAC7311 library by Márton Németh * Camera button input handling by Márton Németh + * LED control by Márton Németh * Copyright (C) 2009-2010 Márton Németh * * This program is free software; you can redistribute it and/or modify @@ -62,6 +63,7 @@ 0 | 0xc6 | setwhitebalance() 0 | 0xc7 | setbluebalance() 0 | 0xdc | setbrightcont(), setcolors() +1 | 0x78 | set_streaming_led() 3 | 0x02 | setexposure() 3 | 0x10 | setgain() 3 | 0x11 | setcolors(), setgain(), setexposure(), sethvflip() @@ -91,6 +93,7 @@ unsigned char gain; unsigned char exposure; unsigned char autogain; + unsigned char led; __u8 hflip; __u8 vflip; u8 flags; @@ -126,6 +129,8 @@ static int sd_getgain(struct gspca_dev *gspca_dev, __s32 *val); static int sd_setexposure(struct gspca_dev *gspca_dev, __s32 val); static int sd_getexposure(struct gspca_dev *gspca_dev, __s32 *val); +static int sd_setled(struct gspca_dev *gspca_dev, __s32 val); +static int sd_getled(struct gspca_dev *gspca_dev, __s32 *val); static const struct ctrl sd_ctrls[] = { /* This control is pac7302 only */ @@ -293,6 +298,20 @@ .set = sd_setvflip, .get = sd_getvflip, }, + { + { + .id = V4L2_CID_LED, + .type= V4L2_CTRL_TYPE_MENU, + .name= "LED", + .minimum = 0, + .maximum = 2, /* 0: Auto, 1: On, 2: Off */ + .step= 1, +#define LED_DEF V4L2_LED_AUTO + .default_value = LED_DEF, + }, + .set = sd_setled, + .get = sd_getled, + }, }; static const struct v4l2_pix_format vga_mode[] = { @@ -572,6 +591,7 @@ sd->gain = GAIN_DEF; sd->exposure = EXPOSURE_DEF; sd->autogain = AUTOGAIN_DEF; + sd->led = LED_DEF; sd->hflip = HFLIP_DEF; sd->vflip = VFLIP_DEF; sd->flags = id->driver_info; @@ -716,6 +736,36 @@ reg_w(gspca_dev, 0x11, 0x01); } +static void set_streaming_led(struct gspca_dev *gspca_dev, u8 streaming) +{ + struct sd *sd = (struct sd *) gspca_dev; + u8 data = 0; + + switch (sd->led) { + case V4L2_LED_AUTO: + if (streaming) + data = 0x01; + else + data = 0x40; + break; + case V4L2_LED_ON: + if (streaming) + data = 0x01; + else + data = 0x00; + break; + case V4L2_LED_OFF: + if (streaming) + data = 0x41; + else + data = 0x40; + break; + } + + reg_w(gspca_dev, 0xff, 0x01); + reg_w(gspca_dev, 0x78, data); +} + /* this function is called at probe and resume time for pac7302 */ static int sd_init(struct gspca_dev *gspca_dev) { @@ -747,18 +797,15 @@ atomic_set(&sd->avg_lum, -1); /* start stream */ - reg_w(gspca_dev, 0xff, 0x01); - reg_w(gspca_dev, 0x78, 0x01); + set_streaming_led(gspca_dev, 1); return gspca_dev->usb_err; } static void sd_stopN(struct gspca_dev *gspca_dev) { - /* stop stream */ - reg_w(gspca_dev, 0xff, 0x01); - reg_w(gspca_dev, 0x78, 0x00); + set_streaming_led(gspca_dev, 0); } /* called on streamoff with alt 0 and on disconnect for pac7302 */ @@ -766,8 +813,7 @@ { if (!gspca_dev->present) return; - reg_w(gspca_dev, 0xff, 0x01); - reg_w(gspca_dev, 0x78, 0x40); + set_streaming_led(gspca_dev, 0); } /* Include pac common sof detection functions */ @@ -1121,6 +1167,44 @@ return 0; } +static int sd_setled(struct gspca_dev *gspca_dev, __s32 val) +{ + struct sd *sd = (struct sd *) gspca_dev; + + sd->led = val; + set_streaming_led(gspca_dev, gspca_dev->streaming); + return gspca_dev->usb_err; +} + +static int sd_getled(struct gspca_dev *gspca_dev, __s32 *val) +{ + struct sd *sd = (struct sd *) gspca_dev; + + *val = sd->led; + return 0; +} + +static int sd_querymen
[PATCH 3/3] gspca pac7302: remove LED blinking when switching stream on and off
From: Márton Németh The init sequences for PAC7302 contained register settings affecting the LED state which can result blinking of the LED when it is set to always on or always off. The blinking happened when the stream was switched on or off. Remove the register changes from the init sequence and handle it with the function set_streaming_led(). Signed-off-by: Márton Németh --- --- a/linux/drivers/media/video/gspca/pac7302.c.orig2010-02-28 08:39:30.0 +0100 +++ b/linux/drivers/media/video/gspca/pac7302.c 2010-02-28 08:44:18.0 +0100 @@ -326,13 +326,6 @@ #define END_OF_SEQUENCE0 /* pac 7302 */ -static const __u8 init_7302[] = { -/* index,value */ - 0xff, 0x01, /* page 1 */ - 0x78, 0x00, /* deactivate */ - 0xff, 0x01, - 0x78, 0x40, /* led off */ -}; static const __u8 start_7302[] = { /* index, len, [value]* */ 0xff, 1,0x00, /* page 0 */ @@ -368,7 +361,8 @@ 0xff, 1,0x01, /* page 1 */ 0x12, 3,0x02, 0x00, 0x01, 0x3e, 2,0x00, 0x00, - 0x76, 5,0x01, 0x20, 0x40, 0x00, 0xf2, + 0x76, 2,0x01, 0x20, + 0x79, 2,0x00, 0xf2, 0x7c, 1,0x00, 0x7f, 10, 0x4b, 0x0f, 0x01, 0x2c, 0x02, 0x58, 0x03, 0x20, 0x02, 0x00, @@ -392,8 +386,6 @@ 0x2a, 5,0xc8, 0x00, 0x18, 0x12, 0x22, 0x64, 8,0x00, 0x00, 0xf0, 0x01, 0x14, 0x44, 0x44, 0x44, 0x6e, 1,0x08, - 0xff, 1,0x01, /* page 1 */ - 0x78, 1,0x00, 0, END_OF_SEQUENCE /* end of sequence */ }; @@ -491,15 +483,6 @@ } } -static void reg_w_seq(struct gspca_dev *gspca_dev, - const __u8 *seq, int len) -{ - while (--len >= 0) { - reg_w(gspca_dev, seq[0], seq[1]); - seq += 2; - } -} - /* load the beginning of a page */ static void reg_w_page(struct gspca_dev *gspca_dev, const __u8 *page, int len) @@ -769,7 +752,7 @@ /* this function is called at probe and resume time for pac7302 */ static int sd_init(struct gspca_dev *gspca_dev) { - reg_w_seq(gspca_dev, init_7302, sizeof(init_7302)/2); + set_streaming_led(gspca_dev, 0); return gspca_dev->usb_err; } -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html