Re: logitech quickcam 9000 uvcdynctrl broken since kernel 3.2 - PING

2012-05-04 Thread Hans de Goede

Hi Paulo,

I've also done some work on libwebcam a while ago, but have not yet had
the time to send this to Martin Rubli. Attached are git format-patch
patches against the 0.2.1 branch of svn. Note these are against what
was in that branch when I did this work some months ago, so not sure
if it will still apply cleanly.

I would really like to work together with you on getting an updated version
of libwebcam out there for use in distros (I maintain libwebcam in Fedora,
and AFAIK you maintain it in Debian, right?)

My sourceforge.net account is jwrdegoede, I hope you're willing to give
me commit access to the git repo there.

I guess if there is going to be more then 1 of us working on the git repo
we should have some review procedure. If others don't object we could post
patches to linux-media, prefixing the subject with a [PATCH libwebcam] and
then do reviews on linux-media and push only after an ack?

I guess we could start with that right away with my proposed patches,
if you can make an initial git repo available I can rebase on top
of that and then send the patches with git send-email (so 1 patch / mail)
for review?

Either way thanks for working on this!

Regards,

Hans






On 05/03/2012 04:17 PM, Paulo Assis wrote:

Karl Hi,
I'm setting up a libwebcam git repo in sourceforge, Martin Rubli from
logitech (the libwebcam developer), was kind enough to post me all
it's code and the old svn repo backup.
He had already done some fixes regarding the new ioctls for version
0.3, so I just need to go through that and add add them to 0.2.
I still need to check with him how he wants to handle the 0.3 version,
since it has a lot of new code ( and some extra apps ).

Regards,
Paulo

2012/5/3 Karl Kinigerkarl.kini...@med.ge.com:

Hi Paulo,

On Wed 120502, Paulo Assis wrote:

OK, so UVCIOC_CTRL_ADD is no longer available, now we have:

UVCIOC_CTRL_MAP and UVCIOC_CTRL_QUERY, so I guess some changes are
needed, I'll try to fix this ASAP.


compiled libwebcam-0.2.1 from Ubuntu (had to fight against
CMake - I am almost CMake agnostic so far...) and I got the
manual focus control in guvcview so things are definitely
looking better now.

So far I have got a focus slider and a LED1 frequency slider,
but not a LED mode... forgot what exactly was available in
the past.

---
LD_LIBRARY_PATH=/usr/local/lib /usr/local/bin/uvcdynctrl -i 
/usr/share/uvcdynctrl/data/046d/logitech.xml
[libwebcam] Unsupported V4L2_CID_EXPOSURE_AUTO control with a non-contiguous 
range of choice IDs found
[libwebcam] Invalid or unsupported V4L2 control encountered: ctrl_id = 
0x009A0901, name = 'Exposure, Auto'
Importing dynamic controls from file
/usr/share/uvcdynctrl/data/046d/logitech.xml.  
/usr/share/uvcdynctrl/data/046d/logitech.xml: error: video0: unable to
map 'Pan (relative)' control. ioctl(UVCIOC_CTRL_MAP) failed with return 
value -1 (error 2: No such file or directory)
/usr/share/uvcdynctrl/data/046d/logitech.xml: error: video0: unable to map 
'Tilt (relative)'
control. ioctl(UVCIOC_CTRL_MAP) failed with return value -1 (error 2: No 
such file or directory)
/usr/share/uvcdynctrl/data/046d/logitech.xml:354: error: Invalid V4L2 control 
type specified: 'V4L2_CTRL_TYPE_BUTTON'
/usr/share/uvcdynctrl/data/046d/logitech.xml:368: error: Invalid V4L2 control 
type specified: 'V4L2_CTRL_TYPE_BUTTON'
/usr/share/uvcdynctrl/data/046d/logitech.xml:396: error: Invalid V4L2 control 
type specified: 'V4L2_CTRL_TYPE_MENU'

Thanks again,
Karl



Regards,
Paulo



--
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
From 72d835008c1712a8b19427e540de82527d75 Mon Sep 17 00:00:00 2001
From: Hans de Goede hdego...@redhat.com
Date: Sun, 16 May 2010 11:17:22 +0200
Subject: [PATCH 01/10] Support mapping button controls

---
 libwebcam/dynctrl.c |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libwebcam/dynctrl.c b/libwebcam/dynctrl.c
index 229bdc4..78e67ff 100644
--- a/libwebcam/dynctrl.c
+++ b/libwebcam/dynctrl.c
@@ -422,6 +422,9 @@ static enum v4l2_ctrl_type get_v4l2_ctrl_type_by_name (const xmlChar *name)
 	else if(xmlStrEqual(name, BAD_CAST(V4L2_CTRL_TYPE_BOOLEAN))) {
 		type = V4L2_CTRL_TYPE_BOOLEAN;
 	}
+	else if(xmlStrEqual(name, BAD_CAST(V4L2_CTRL_TYPE_BUTTON))) {
+		type = V4L2_CTRL_TYPE_BUTTON;
+	}
 #ifdef ENABLE_RAW_CONTROLS
 	else if(xmlStrEqual(name, BAD_CAST(V4L2_CTRL_TYPE_STRING))) {
 		type = V4L2_CTRL_TYPE_STRING;
@@ -431,9 +434,6 @@ static enum v4l2_ctrl_type get_v4l2_ctrl_type_by_name (const xmlChar *name)
 	else if(xmlStrEqual(name, BAD_CAST(V4L2_CTRL_TYPE_MENU))) {
 		type = V4L2_CTRL_TYPE_MENU;
 	}
-	else if(xmlStrEqual(name, BAD_CAST(V4L2_CTRL_TYPE_BUTTON))) {
-		type = V4L2_CTRL_TYPE_BUTTON;
-	}
 	else if(xmlStrEqual(name, BAD_CAST(V4L2_CTRL_TYPE_INTEGER64))) {
 		type = V4L2_CTRL_TYPE_INTEGER64;
 	}
-- 
1.7.10

From 

Re: logitech quickcam 9000 uvcdynctrl broken since kernel 3.2 - PING

2012-05-04 Thread Hans de Goede

p.s.

Some of my commit messages talk about them needing some
kernel changes / fixes. These are all long in place now
(since before the uvcvideo.h header become an official
userspace available kernel header).

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: Hauppage HVR1600 - CX18 Issue with Centos 6.2 - Analog Sound comes and goes

2012-05-04 Thread Bob Lightfoot
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 05/03/2012 07:38 PM, Andy Walls wrote:
 On Wed, 2012-05-02 at 00:53 -0400, Bob Lightfoot wrote:
 Dear Mailing List linux-media:
 
 I am attempting to use a Hauppage HVR-1600 purchased new in 2010
 as an analog tv tuner in my HP Pavillion Elite M9040n PC running
 Centos 6.2 x86_64.  The problem I am experiencing is that with
 every kernel update and/or mythtv and/or vlc or other media
 update it seems I loose sound on my captured avi/mpeg files.
 After as bit of tweaking it seems to come back and I've never
 been able to pin down exactly what is hosing the sound.  I should
 mention the unit has an HVR 1850 at slot 2 which works for DVB
 tuning jsut fine.  The HVR 1600 is in pci slot 1 and from what I 
 can see in dmesg it also loaded fine.  Maybe someone who is more 
 intimate with linux-media can review the data I've included and
 suggest a troubleshooting approach.
 
 1. If you ever lose sound in the ATSC or QAM DTV streams captured
 with the HVR-1600, then you do not have and HVR-1600 problem, you
 have a systems sound playback problem.  In this case you must
 address that problem.
 
 If not, then go on to #2.
 
 2. If you never lose sound in ATSC/QAM DTV captures, but do
 sometimes lose sound with MPEG captures from the analog baseband
 CVBS or S-Video w/ L and R audio inputs, then this is a driver
 problem with the CX23418's audio processing unit (APU).
 
 In this case there is are a few things to try:
 
 a. prevent the cx18-alsa.ko module from loading by removing it from
 your filesystem (make a back-up of the module if you wish), and
 reboot your computer.  This will stop things like HAL and/or
 PulseAudio from messing with the HVR-1600 via the ALSA sound
 interface.
 
 b. Update to the laters cx18 driver, which will require updating
 many supporting media (video, dvb and common/tuner modules as well.
 (No guarantee this will work right on older enterprise kernels
 where the I2C binding model is very different from modern
 kernels.)
 
 c. Write a patch to the cx18 driver that has it act a little
 smarter about the CX23418 Capture Processing Unit (CPU) and Audio
 Processing Unit (APU) initialzation.  Right now the processors are
 brought out of reset and allowed to run executing uninitialized
 memory as instructions before their firmware is actually loaded and
 the processors restarted.
 
 d. Ask me to write the patch mentioned in c.  Be prepared to wait a
 very long time and still have to update to the latest cx18 module.
 
 
 If you never lose audip in MPEG captures from baseband inputs, then
 go to step 3.
 
 3. If you never lose sound in ATSC/QAM DTV captures, and never
 lose sound with MPEG captures from the analog baseband CVBS or
 S-Video w/ L and R audio inputs, but you do sometimes lose audio
 with MPEG captures from the analog RF tuner, then the broadcast
 audio microcontroller in the integrated CX25843 inside the CX23418
 is likely unable to identify the broadcast audio standard properly
 and is staying muted.
 
 If so, then
 
 a. Use 'v4l2-ctl -d /dev/videoN --log-status' to verify the audio 
 standard is not detected and the microcontroller is muted when an
 analog RF capture is ongoing.
 
 b. Try installing an in-line attenuator in the RF line before it
 reaches the analog RF tuner input of the HVR-1600.  The audio
 microcontroller uses spectral analysis hardware to detect the
 broadcast audio standard. Intermodulation products, caused by
 overdriving the tuner with too strong of a signal, can throw off
 the spectral analysis and confuse the audio standard detection
 microcontroller.
 
 c. Ask Mark Lord for a copy of his script/tool mentioned in this
 long thread: http://patchwork.linuxtv.org/patch/3162/ That
 periodically does some userspace actions to try and get audio
 back.
 
 d. Write a patch to the cx18 driver and the cx18-av-*c files 
 specifically, that allows manual specification of audio standard to
 BTSC without any attaempts at auto-detection.
 
 e. Ask me to write the patch in d.  Be prepared to wait a long
 time, etc. etc.
 
 f. See 2.c.
 
 g. See 2.d.
 
 
 
 I am beginning to suspect I need to specify a conf file for
 module cx18 but not sure where to begin that.  I am trying to
 maintain the package management on this system so I have not 
 isntalled sources or compiled anything, everything has been
 managed by yum and pulled from the centos-base, centos-updates or
 atrpms repos for 99% of things.  There may be an elrepo or
 rpmfusion rpm or two, but they would be an exception.  Below I am
 providing what I think is the relevant starter information.
 
 
 uname -a == Linux mythbox.ladodomain 2.6.32-220.13.1.el6.x86_64
 #1 SMP Tue Apr 17 23:56:34 BST 2012 x86_64 x86_64 x86_64
 GNU/Linux
 
 lspci output follows:
 
 00:00.0 Host bridge: Intel Corporation 82G33/G31/P35/P31 Express
 DRAM Controller (rev 02) 00:01.0 PCI bridge: Intel Corporation
 82G33/G31/P35/P31 Express PCI Express Root Port (rev 02) 00:19.0
 Ethernet 

[media-ctl PATCH 3/3] Compose rectangle support for media-ctl

2012-05-04 Thread Sakari Ailus
Signed-off-by: Sakari Ailus sakari.ai...@iki.fi
---
 src/main.c   |   14 ++
 src/options.c|6 --
 src/v4l2subdev.c |   22 ++
 3 files changed, 36 insertions(+), 6 deletions(-)

diff --git a/src/main.c b/src/main.c
index 6de1031..6362f3e 100644
--- a/src/main.c
+++ b/src/main.c
@@ -77,6 +77,20 @@ static void v4l2_subdev_print_format(struct media_entity 
*entity,
printf(\n\t\t crop.actual:%u,%u/%ux%u, rect.left, rect.top,
   rect.width, rect.height);
 
+   ret = v4l2_subdev_get_selection(entity, rect, pad,
+   V4L2_SUBDEV_SEL_TGT_COMPOSE_BOUNDS,
+   which);
+   if (ret == 0)
+   printf(\n\t\t compose.bounds:%u,%u/%ux%u,
+  rect.left, rect.top, rect.width, rect.height);
+
+   ret = v4l2_subdev_get_selection(entity, rect, pad,
+   V4L2_SUBDEV_SEL_TGT_COMPOSE_ACTUAL,
+   which);
+   if (ret == 0)
+   printf(\n\t\t compose.actual:%u,%u/%ux%u,
+  rect.left, rect.top, rect.width, rect.height);
+
printf(]);
 }
 
diff --git a/src/options.c b/src/options.c
index 4d9d48f..c0b3d3b 100644
--- a/src/options.c
+++ b/src/options.c
@@ -55,13 +55,15 @@ static void usage(const char *argv0, int verbose)
printf(\tlink= pad, '-', pad, '[', flags, ']' ;\n);
printf(\tformat  = pad, '[', formats ']' ;\n);
printf(\tformats = formats ',' formats ;\n);
-   printf(\tformats = fmt | crop | frame interval ;\n);
+   printf(\tformats = fmt | crop | compose | frame interval ;\n);
printf(\fmt  = 'fmt:', fcc, '/', size ;\n);
printf(\tpad = entity, ':', pad number ;\n);
printf(\tentity  = entity number | ( '\', entity name, '\' ) 
;\n);
printf(\tsize= width, 'x', height ;\n);
-   printf(\tcrop= 'crop.actual:', left, ',', top, '/', size 
;\n);
+   printf(\tcrop= 'crop.actual:', window ;\n);
+   printf(\tcompose = 'compose.actual:', window ;\n);
printf(\tframe interval  = '@', numerator, '/', denominator ;\n);
+   printf(\twindow  = left, ',', top, '/', size ;\n);
printf(where the fields are\n);
printf(\tentity number   Entity numeric identifier\n);
printf(\tentity name Entity name (string) \n);
diff --git a/src/v4l2subdev.c b/src/v4l2subdev.c
index 87b22fc..8e3a447 100644
--- a/src/v4l2subdev.c
+++ b/src/v4l2subdev.c
@@ -317,8 +317,8 @@ static int strhazit(const char *str, const char **p)
 
 static struct media_pad *v4l2_subdev_parse_pad_format(
struct media_device *media, struct v4l2_mbus_framefmt *format,
-   struct v4l2_rect *crop, struct v4l2_fract *interval, const char *p,
-   char **endp)
+   struct v4l2_rect *crop, struct v4l2_rect *compose,
+   struct v4l2_fract *interval, const char *p, char **endp)
 {
struct media_pad *pad;
char *end;
@@ -355,6 +355,15 @@ static struct media_pad *v4l2_subdev_parse_pad_format(
continue;
}
 
+   if (!strhazit(compose.actual:, p)) {
+   ret = v4l2_subdev_parse_rectangle(compose, p, end);
+   if (ret  0)
+   return NULL;
+
+   for (p = end; isspace(*p); p++);
+   continue;
+   }
+
if (*p == '@') {
ret = v4l2_subdev_parse_frame_interval(interval, ++p, 
end);
if (ret  0)
@@ -468,13 +477,14 @@ static int v4l2_subdev_parse_setup_format(struct 
media_device *media,
struct v4l2_mbus_framefmt format = { 0, 0, 0 };
struct media_pad *pad;
struct v4l2_rect crop = { -1, -1, -1, -1 };
+   struct v4l2_rect compose = crop;
struct v4l2_fract interval = { 0, 0 };
unsigned int i;
char *end;
int ret;
 
-   pad = v4l2_subdev_parse_pad_format(media, format, crop, interval,
-  p, end);
+   pad = v4l2_subdev_parse_pad_format(media, format, crop, compose,
+  interval, p, end);
if (pad == NULL) {
media_dbg(media, Unable to parse format\n);
return -EINVAL;
@@ -490,6 +500,10 @@ static int v4l2_subdev_parse_setup_format(struct 
media_device *media,
if (ret  0)
return ret;
 
+   ret = set_selection(pad, V4L2_SUBDEV_SEL_TGT_COMPOSE_ACTUAL, compose);
+   if (ret  0)
+   return ret;
+
if (pad-flags  MEDIA_PAD_FL_SOURCE) {
ret = set_format(pad, format);
if (ret  0)
-- 
1.7.2.5

--
To unsubscribe from this list: send the line unsubscribe linux-media 

[media-ctl PATCH 2/3] New, more flexible syntax for media-ctl

2012-05-04 Thread Sakari Ailus
More flexible and extensible syntax for media-ctl which allows better usage
of the selection API.

Signed-off-by: Sakari Ailus sakari.ai...@iki.fi
---
 src/main.c   |   17 +---
 src/options.c|9 --
 src/v4l2subdev.c |   73 +++--
 3 files changed, 62 insertions(+), 37 deletions(-)

diff --git a/src/main.c b/src/main.c
index 53964e4..6de1031 100644
--- a/src/main.c
+++ b/src/main.c
@@ -59,15 +59,24 @@ static void v4l2_subdev_print_format(struct media_entity 
*entity,
if (ret != 0)
return;
 
-   printf([%s %ux%u, v4l2_subdev_pixelcode_to_string(format.code),
-  format.width, format.height);
+   printf(\t\t[fmt:%s/%ux%u,
+  v4l2_subdev_pixelcode_to_string(format.code),
+  format.width, format.height);
+
+   ret = v4l2_subdev_get_selection(entity, rect, pad,
+   V4L2_SUBDEV_SEL_TGT_CROP_BOUNDS,
+   which);
+   if (ret == 0)
+   printf(\n\t\t crop.bounds:%u,%u/%ux%u, rect.left, rect.top,
+  rect.width, rect.height);
 
ret = v4l2_subdev_get_selection(entity, rect, pad,
V4L2_SUBDEV_SEL_TGT_CROP_ACTUAL,
which);
if (ret == 0)
-   printf( (%u,%u)/%ux%u, rect.left, rect.top,
+   printf(\n\t\t crop.actual:%u,%u/%ux%u, rect.left, rect.top,
   rect.width, rect.height);
+
printf(]);
 }
 
@@ -252,7 +261,7 @@ static void media_print_topology_text(struct media_device 
*media)
for (j = 0; j  entity-info.pads; j++) {
struct media_pad *pad = entity-pads[j];
 
-   printf(\tpad%u: %s , j, 
media_pad_type_to_string(pad-flags));
+   printf(\tpad%u: %s\n, j, 
media_pad_type_to_string(pad-flags));
 
if (media_entity_type(entity) == 
MEDIA_ENT_T_V4L2_SUBDEV)
v4l2_subdev_print_format(entity, j, 
V4L2_SUBDEV_FORMAT_ACTIVE);
diff --git a/src/options.c b/src/options.c
index 60cf6d5..4d9d48f 100644
--- a/src/options.c
+++ b/src/options.c
@@ -53,12 +53,15 @@ static void usage(const char *argv0, int verbose)
printf(\n);
printf(Links and formats are defined as\n);
printf(\tlink= pad, '-', pad, '[', flags, ']' ;\n);
-   printf(\tformat  = pad, '[', fcc, ' ', size, [ ' ', crop ], [ 
' ', '@', frame interval ], ']' ;\n);
+   printf(\tformat  = pad, '[', formats ']' ;\n);
+   printf(\tformats = formats ',' formats ;\n);
+   printf(\tformats = fmt | crop | frame interval ;\n);
+   printf(\fmt  = 'fmt:', fcc, '/', size ;\n);
printf(\tpad = entity, ':', pad number ;\n);
printf(\tentity  = entity number | ( '\', entity name, '\' ) 
;\n);
printf(\tsize= width, 'x', height ;\n);
-   printf(\tcrop= '(', left, ',', top, ')', '/', size ;\n);
-   printf(\tframe interval  = numerator, '/', denominator ;\n);
+   printf(\tcrop= 'crop.actual:', left, ',', top, '/', size 
;\n);
+   printf(\tframe interval  = '@', numerator, '/', denominator ;\n);
printf(where the fields are\n);
printf(\tentity number   Entity numeric identifier\n);
printf(\tentity name Entity name (string) \n);
diff --git a/src/v4l2subdev.c b/src/v4l2subdev.c
index 92360bb..87b22fc 100644
--- a/src/v4l2subdev.c
+++ b/src/v4l2subdev.c
@@ -235,13 +235,13 @@ static int v4l2_subdev_parse_format(struct 
v4l2_mbus_framefmt *format,
char *end;
 
for (; isspace(*p); ++p);
-   for (end = (char *)p; !isspace(*end)  *end != '\0'; ++end);
+   for (end = (char *)p; *end != '/'  *end != '\0'; ++end);
 
code = v4l2_subdev_string_to_pixelcode(p, end - p);
if (code == (enum v4l2_mbus_pixelcode)-1)
return -EINVAL;
 
-   for (p = end; isspace(*p); ++p);
+   p = end + 1;
width = strtoul(p, end, 10);
if (*end != 'x')
return -EINVAL;
@@ -258,32 +258,27 @@ static int v4l2_subdev_parse_format(struct 
v4l2_mbus_framefmt *format,
return 0;
 }
 
-static int v4l2_subdev_parse_crop(
-   struct v4l2_rect *crop, const char *p, char **endp)
+static int v4l2_subdev_parse_rectangle(
+   struct v4l2_rect *r, const char *p, char **endp)
 {
char *end;
 
-   if (*p++ != '(')
-   return -EINVAL;
-
-   crop-left = strtoul(p, end, 10);
+   r-left = strtoul(p, end, 10);
if (*end != ',')
return -EINVAL;
 
p = end + 1;
-   crop-top = strtoul(p, end, 10);
-   if (*end++ != ')')
-   return -EINVAL;
+   r-top = strtoul(p, end, 10);
if (*end != '/')
return -EINVAL;
 
p 

[media-ctl PATCH 1/3] Support selections API for crop

2012-05-04 Thread Sakari Ailus
Support the new selections API for crop. Fall back to use the old crop API
in case the selection API isn't available.

Signed-off-by: Sakari Ailus sakari.ai...@iki.fi
---
 src/main.c   |4 ++-
 src/v4l2subdev.c |  100 +-
 src/v4l2subdev.h |   37 +++-
 3 files changed, 93 insertions(+), 48 deletions(-)

diff --git a/src/main.c b/src/main.c
index 4f3271c..53964e4 100644
--- a/src/main.c
+++ b/src/main.c
@@ -62,7 +62,9 @@ static void v4l2_subdev_print_format(struct media_entity 
*entity,
printf([%s %ux%u, v4l2_subdev_pixelcode_to_string(format.code),
   format.width, format.height);
 
-   ret = v4l2_subdev_get_crop(entity, rect, pad, which);
+   ret = v4l2_subdev_get_selection(entity, rect, pad,
+   V4L2_SUBDEV_SEL_TGT_CROP_ACTUAL,
+   which);
if (ret == 0)
printf( (%u,%u)/%ux%u, rect.left, rect.top,
   rect.width, rect.height);
diff --git a/src/v4l2subdev.c b/src/v4l2subdev.c
index b886b72..92360bb 100644
--- a/src/v4l2subdev.c
+++ b/src/v4l2subdev.c
@@ -104,48 +104,85 @@ int v4l2_subdev_set_format(struct media_entity *entity,
return 0;
 }
 
-int v4l2_subdev_get_crop(struct media_entity *entity, struct v4l2_rect *rect,
-unsigned int pad, enum v4l2_subdev_format_whence which)
+int v4l2_subdev_get_selection(
+   struct media_entity *entity, struct v4l2_rect *r,
+   unsigned int pad, int target, enum v4l2_subdev_format_whence which)
 {
-   struct v4l2_subdev_crop crop;
+   union {
+   struct v4l2_subdev_selection sel;
+   struct v4l2_subdev_crop crop;
+   } u;
int ret;
 
ret = v4l2_subdev_open(entity);
if (ret  0)
return ret;
 
-   memset(crop, 0, sizeof(crop));
-   crop.pad = pad;
-   crop.which = which;
+   memset(u.sel, 0, sizeof(u.sel));
+   u.sel.pad = pad;
+   u.sel.target = target;
+   u.sel.which = which;
 
-   ret = ioctl(entity-fd, VIDIOC_SUBDEV_G_CROP, crop);
+   ret = ioctl(entity-fd, VIDIOC_SUBDEV_G_SELECTION, u.sel);
+   if (ret = 0) {
+   *r = u.sel.r;
+   return 0;
+   }
+   if (errno != ENOTTY
+   || target != V4L2_SUBDEV_SEL_TGT_CROP_ACTUAL)
+   return -errno;
+
+   memset(u.crop, 0, sizeof(u.crop));
+   u.crop.pad = pad;
+   u.crop.which = which;
+
+   ret = ioctl(entity-fd, VIDIOC_SUBDEV_G_CROP, u.crop);
if (ret  0)
return -errno;
 
-   *rect = crop.rect;
+   *r = u.crop.rect;
return 0;
 }
 
-int v4l2_subdev_set_crop(struct media_entity *entity, struct v4l2_rect *rect,
-unsigned int pad, enum v4l2_subdev_format_whence which)
+int v4l2_subdev_set_selection(
+   struct media_entity *entity, struct v4l2_rect *r,
+   unsigned int pad, int target, enum v4l2_subdev_format_whence which)
 {
-   struct v4l2_subdev_crop crop;
+   union {
+   struct v4l2_subdev_selection sel;
+   struct v4l2_subdev_crop crop;
+   } u;
int ret;
 
ret = v4l2_subdev_open(entity);
if (ret  0)
return ret;
 
-   memset(crop, 0, sizeof(crop));
-   crop.pad = pad;
-   crop.which = which;
-   crop.rect = *rect;
+   memset(u.sel, 0, sizeof(u.sel));
+   u.sel.pad = pad;
+   u.sel.target = target;
+   u.sel.which = which;
+   u.sel.r = *r;
+
+   ret = ioctl(entity-fd, VIDIOC_SUBDEV_S_SELECTION, u.sel);
+   if (ret = 0) {
+   *r = u.sel.r;
+   return 0;
+   }
+   if (errno != ENOTTY
+   || target != V4L2_SUBDEV_SEL_TGT_CROP_ACTUAL)
+   return -errno;
+
+   memset(u.crop, 0, sizeof(u.crop));
+   u.crop.pad = pad;
+   u.crop.which = which;
+   u.crop.rect = *r;
 
-   ret = ioctl(entity-fd, VIDIOC_SUBDEV_S_CROP, crop);
+   ret = ioctl(entity-fd, VIDIOC_SUBDEV_S_CROP, u.crop);
if (ret  0)
return -errno;
 
-   *rect = crop.rect;
+   *r = u.crop.rect;
return 0;
 }
 
@@ -355,30 +392,31 @@ static int set_format(struct media_pad *pad,
return 0;
 }
 
-static int set_crop(struct media_pad *pad, struct v4l2_rect *crop)
+static int set_selection(struct media_pad *pad, int tgt,
+struct v4l2_rect *rect)
 {
int ret;
 
-   if (crop-left == -1 || crop-top == -1)
+   if (rect-left == -1 || rect-top == -1)
return 0;
 
media_dbg(pad-entity-media,
- Setting up crop rectangle (%u,%u)/%ux%u on pad %s/%u\n,
- crop-left, crop-top, crop-width, crop-height,
+ Setting up selection target %d rectangle (%u,%u)/%ux%u on 
pad %s/%u\n,
+ tgt, rect-left, rect-top, rect-width, rect-height,
   

Re: logitech quickcam 9000 uvcdynctrl broken since kernel 3.2 - PING

2012-05-04 Thread Paulo Assis
Hans,

I've add you has a developer to the project, so you should be able to
commit these patches yourself,
I would suggest that you pushed a new branch with your changes and
after testing we merge them into the master.
I'm doing the same for some fixes I have planned and also for the code
for version 0.3 that Martin kindly send me (it has a lot of new apps,
including a qt interface, and video capture support).

This is the project page:
https://sourceforge.net/p/libwebcam/code

currently master is not building against the new uvcvideo.h, I'll try
to fix that today, also the check for this header during configuration
is unnecessary since it's now in linux headers (just need to include
it with linux/uvcvideo.h)

Regards,
Paulo

2012/5/4 Hans de Goede hdego...@redhat.com:
 Hi Paulo,

 I've also done some work on libwebcam a while ago, but have not yet had
 the time to send this to Martin Rubli. Attached are git format-patch
 patches against the 0.2.1 branch of svn. Note these are against what
 was in that branch when I did this work some months ago, so not sure
 if it will still apply cleanly.

 I would really like to work together with you on getting an updated version
 of libwebcam out there for use in distros (I maintain libwebcam in Fedora,
 and AFAIK you maintain it in Debian, right?)

 My sourceforge.net account is jwrdegoede, I hope you're willing to give
 me commit access to the git repo there.

 I guess if there is going to be more then 1 of us working on the git repo
 we should have some review procedure. If others don't object we could post
 patches to linux-media, prefixing the subject with a [PATCH libwebcam] and
 then do reviews on linux-media and push only after an ack?

 I guess we could start with that right away with my proposed patches,
 if you can make an initial git repo available I can rebase on top
 of that and then send the patches with git send-email (so 1 patch / mail)
 for review?

 Either way thanks for working on this!

 Regards,

 Hans







 On 05/03/2012 04:17 PM, Paulo Assis wrote:

 Karl Hi,
 I'm setting up a libwebcam git repo in sourceforge, Martin Rubli from
 logitech (the libwebcam developer), was kind enough to post me all
 it's code and the old svn repo backup.
 He had already done some fixes regarding the new ioctls for version
 0.3, so I just need to go through that and add add them to 0.2.
 I still need to check with him how he wants to handle the 0.3 version,
 since it has a lot of new code ( and some extra apps ).

 Regards,
 Paulo

 2012/5/3 Karl Kinigerkarl.kini...@med.ge.com:

 Hi Paulo,

 On Wed 120502, Paulo Assis wrote:

 OK, so UVCIOC_CTRL_ADD is no longer available, now we have:

 UVCIOC_CTRL_MAP and UVCIOC_CTRL_QUERY, so I guess some changes are
 needed, I'll try to fix this ASAP.


 compiled libwebcam-0.2.1 from Ubuntu (had to fight against
 CMake - I am almost CMake agnostic so far...) and I got the
 manual focus control in guvcview so things are definitely
 looking better now.

 So far I have got a focus slider and a LED1 frequency slider,
 but not a LED mode... forgot what exactly was available in
 the past.

 ---
 LD_LIBRARY_PATH=/usr/local/lib /usr/local/bin/uvcdynctrl -i
 /usr/share/uvcdynctrl/data/046d/logitech.xml
 [libwebcam] Unsupported V4L2_CID_EXPOSURE_AUTO control with a
 non-contiguous range of choice IDs found
 [libwebcam] Invalid or unsupported V4L2 control encountered: ctrl_id =
 0x009A0901, name = 'Exposure, Auto'
 Importing dynamic controls from file
 /usr/share/uvcdynctrl/data/046d/logitech.xml.
  /usr/share/uvcdynctrl/data/046d/logitech.xml: error: video0: unable to
    map 'Pan (relative)' control. ioctl(UVCIOC_CTRL_MAP) failed with
 return value -1 (error 2: No such file or directory)
 /usr/share/uvcdynctrl/data/046d/logitech.xml: error: video0: unable to
 map 'Tilt (relative)'
    control. ioctl(UVCIOC_CTRL_MAP) failed with return value -1 (error 2:
 No such file or directory)
 /usr/share/uvcdynctrl/data/046d/logitech.xml:354: error: Invalid V4L2
 control type specified: 'V4L2_CTRL_TYPE_BUTTON'
 /usr/share/uvcdynctrl/data/046d/logitech.xml:368: error: Invalid V4L2
 control type specified: 'V4L2_CTRL_TYPE_BUTTON'
 /usr/share/uvcdynctrl/data/046d/logitech.xml:396: error: Invalid V4L2
 control type specified: 'V4L2_CTRL_TYPE_MENU'

 Thanks again,
 Karl


 Regards,
 Paulo


 --
 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
--
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] [media] cx88: Remove duplicate const

2012-05-04 Thread Emil Goode
This patch fixes the following sparse warnings
by removing use of duplicate const.

drivers/media/video/cx88/cx88.h:152:40:
warning: duplicate const
drivers/media/video/cx88/cx88-core.c:256:33:
warning: duplicate const
drivers/media/video/cx88/cx88-alsa.c:769:41:
warning: duplicate const

Signed-off-by: Emil Goode emilgo...@gmail.com
---
 drivers/media/video/cx88/cx88-alsa.c |2 +-
 drivers/media/video/cx88/cx88-core.c |2 +-
 drivers/media/video/cx88/cx88.h  |2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/media/video/cx88/cx88-alsa.c 
b/drivers/media/video/cx88/cx88-alsa.c
index 04bf662..408e3c9 100644
--- a/drivers/media/video/cx88/cx88-alsa.c
+++ b/drivers/media/video/cx88/cx88-alsa.c
@@ -766,7 +766,7 @@ static struct snd_kcontrol_new snd_cx88_alc_switch = {
  * Only boards with eeprom and byte 1 at eeprom=1 have it
  */
 
-static const struct pci_device_id const cx88_audio_pci_tbl[] __devinitdata = {
+static const struct pci_device_id cx88_audio_pci_tbl[] __devinitdata = {
{0x14f1,0x8801,PCI_ANY_ID,PCI_ANY_ID,0,0,0},
{0x14f1,0x8811,PCI_ANY_ID,PCI_ANY_ID,0,0,0},
{0, }
diff --git a/drivers/media/video/cx88/cx88-core.c 
b/drivers/media/video/cx88/cx88-core.c
index fbfdd80..dbd2fa2 100644
--- a/drivers/media/video/cx88/cx88-core.c
+++ b/drivers/media/video/cx88/cx88-core.c
@@ -253,7 +253,7 @@ cx88_free_buffer(struct videobuf_queue *q, struct 
cx88_buffer *buf)
  *0x0c00 -   FIFOs
  */
 
-const struct sram_channel const cx88_sram_channels[] = {
+const struct sram_channel cx88_sram_channels[] = {
[SRAM_CH21] = {
.name   = video y / packed,
.cmds_start = 0x180040,
diff --git a/drivers/media/video/cx88/cx88.h b/drivers/media/video/cx88/cx88.h
index c9659de..aabec7e 100644
--- a/drivers/media/video/cx88/cx88.h
+++ b/drivers/media/video/cx88/cx88.h
@@ -149,7 +149,7 @@ struct sram_channel {
u32  cnt1_reg;
u32  cnt2_reg;
 };
-extern const struct sram_channel const cx88_sram_channels[];
+extern const struct sram_channel cx88_sram_channels[];
 
 /* --- */
 /* card configuration  */
-- 
1.7.9.5

--
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] [media] cx88: Remove duplicate const

2012-05-04 Thread Jonathan Nieder
Emil Goode wrote:

 This patch fixes the following sparse warnings
 by removing use of duplicate const.

Is this really just about quieting sparse noise?

I would find it clearer to read a more straightforward explanation
like

Remove some redundant uses of const detected by sparse:

but that is only a nitpick.

[...]
 --- a/drivers/media/video/cx88/cx88-alsa.c
 +++ b/drivers/media/video/cx88/cx88-alsa.c
 @@ -766,7 +766,7 @@ static struct snd_kcontrol_new snd_cx88_alc_switch = {
   * Only boards with eeprom and byte 1 at eeprom=1 have it
   */
  
 -static const struct pci_device_id const cx88_audio_pci_tbl[] __devinitdata = 
 {
 +static const struct pci_device_id cx88_audio_pci_tbl[] __devinitdata = {

These double const were introduced in v2.6.37-rc1~64^2~464 (V4L/DVB:
drivers/media: Make static data tables and strings const, 2010-08-25).

The address of an array is already immutable by definition, so for
what it's worth, with or without a clarified commit message,

Acked-by: Jonathan Nieder jrnie...@gmail.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


[GIT PULL FOR 3.5] gspca_pac73XX improvements + misc fixes

2012-05-04 Thread Hans de Goede

Hi Mauro et al,

Please pull from my tree for:
-a small stk driver fix
-a bunch of gspca_pac73XX improvements
-removal of the long deprecated et61x251 driver

Note this pull request obsoletes my previous pull req.

The following changes since commit a1ac5dc28d2b4ca78e183229f7c595ffd725241c:

  [media] gspca - sn9c20x: Change the exposure setting of Omnivision sensors 
(2012-05-03 15:29:56 -0300)

are available in the git repository at:

  git://linuxtv.org/hgoede/gspca.git media-for_v3.5

for you to fetch changes up to cfe42cea7b4040c6e18f113a0494426764bfa21b:

  media/video/et61x251: Remove this deprecated driver (2012-05-04 11:38:43 
+0200)


Hans de Goede (13):
  stk-webcam: Don't flip the image by default
  gspca/autogain_functions.h: Allow users to declare what they want
  gspca_pac73xx: Remove comments from before the 7302 / 7311 separation
  gspca_pac7311: Make sure exposure changes get applied immediately
  gspca_pac7311: Adjust control scales to match registers
  gspca_pac7311: Switch to new gspca control mechanism
  gspca_pac7311: Switch to coarse expo autogain algorithm
  gspca_pac7311: Convert multi-line comments to standard kernel style
  gspca_pac7311: Properly set the compression balance
  gspca_pac7302: Convert multi-line comments to standard kernel style
  gspca_pac7302: Document some more registers
  gspca_pac7302: Improve the gain control
  media/video/et61x251: Remove this deprecated driver

 drivers/media/video/Kconfig|2 -
 drivers/media/video/Makefile   |1 -
 drivers/media/video/et61x251/Kconfig   |   18 -
 drivers/media/video/et61x251/Makefile  |4 -
 drivers/media/video/et61x251/et61x251.h|  213 --
 drivers/media/video/et61x251/et61x251_core.c   | 2683 
 drivers/media/video/et61x251/et61x251_sensor.h |  108 -
 drivers/media/video/et61x251/et61x251_tas5130d1b.c |  143 --
 drivers/media/video/gspca/autogain_functions.h |6 +-
 drivers/media/video/gspca/nw80x.c  |2 +
 drivers/media/video/gspca/pac7302.c|  184 +-
 drivers/media/video/gspca/pac7311.c|  380 +--
 drivers/media/video/gspca/sonixb.c |2 +
 drivers/media/video/gspca/sonixj.c |5 +-
 drivers/media/video/gspca/topro.c  |6 +-
 drivers/media/video/stk-webcam.c   |8 +-
 16 files changed, 239 insertions(+), 3526 deletions(-)
 delete mode 100644 drivers/media/video/et61x251/Kconfig
 delete mode 100644 drivers/media/video/et61x251/Makefile
 delete mode 100644 drivers/media/video/et61x251/et61x251.h
 delete mode 100644 drivers/media/video/et61x251/et61x251_core.c
 delete mode 100644 drivers/media/video/et61x251/et61x251_sensor.h
 delete mode 100644 drivers/media/video/et61x251/et61x251_tas5130d1b.c

Thanks  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


[RFC PATCH 3/4] radio-si470x-common.c: remove unnecessary kernel log spam.

2012-05-04 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

There is no need to report an error in the log, you are already returning
that error to userspace after all.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/radio/si470x/radio-si470x-common.c |   78 +-
 1 file changed, 17 insertions(+), 61 deletions(-)

diff --git a/drivers/media/radio/si470x/radio-si470x-common.c 
b/drivers/media/radio/si470x/radio-si470x-common.c
index e70badf..b9a44d4 100644
--- a/drivers/media/radio/si470x/radio-si470x-common.c
+++ b/drivers/media/radio/si470x/radio-si470x-common.c
@@ -327,7 +327,7 @@ static int si470x_set_seek(struct si470x_device *radio,
radio-registers[POWERCFG] = ~POWERCFG_SEEKUP;
retval = si470x_set_register(radio, POWERCFG);
if (retval  0)
-   goto done;
+   return retval;
 
/* currently I2C driver only uses interrupt way to seek */
if (radio-stci_enabled) {
@@ -355,20 +355,15 @@ static int si470x_set_seek(struct si470x_device *radio,
if (radio-registers[STATUSRSSI]  STATUSRSSI_SF)
dev_warn(radio-videodev.dev,
seek failed / band limit reached\n);
-   if (timed_out)
-   dev_warn(radio-videodev.dev,
-   seek timed out after %u ms\n, seek_timeout);
 
 stop:
/* stop seeking */
radio-registers[POWERCFG] = ~POWERCFG_SEEK;
retval = si470x_set_register(radio, POWERCFG);
 
-done:
/* try again, if timed out */
-   if ((retval == 0)  timed_out)
-   retval = -EAGAIN;
-
+   if (retval == 0  timed_out)
+   return -EAGAIN;
return retval;
 }
 
@@ -589,16 +584,14 @@ static int si470x_vidioc_g_tuner(struct file *file, void 
*priv,
struct v4l2_tuner *tuner)
 {
struct si470x_device *radio = video_drvdata(file);
-   int retval = 0;
+   int retval;
 
-   if (tuner-index != 0) {
-   retval = -EINVAL;
-   goto done;
-   }
+   if (tuner-index != 0)
+   return -EINVAL;
 
retval = si470x_get_register(radio, STATUSRSSI);
if (retval  0)
-   goto done;
+   return retval;
 
/* driver constants */
strcpy(tuner-name, FM);
@@ -653,10 +646,6 @@ static int si470x_vidioc_g_tuner(struct file *file, void 
*priv,
/* AFCRL does only indicate that freq. differs, not if too low/high */
tuner-afc = (radio-registers[STATUSRSSI]  STATUSRSSI_AFCRL) ? 1 : 0;
 
-done:
-   if (retval  0)
-   dev_warn(radio-videodev.dev,
-   get tuner failed with %d\n, retval);
return retval;
 }
 
@@ -668,7 +657,6 @@ static int si470x_vidioc_s_tuner(struct file *file, void 
*priv,
struct v4l2_tuner *tuner)
 {
struct si470x_device *radio = video_drvdata(file);
-   int retval = 0;
 
if (tuner-index != 0)
return -EINVAL;
@@ -684,12 +672,7 @@ static int si470x_vidioc_s_tuner(struct file *file, void 
*priv,
break;
}
 
-   retval = si470x_set_register(radio, POWERCFG);
-
-   if (retval  0)
-   dev_warn(radio-videodev.dev,
-   set tuner failed with %d\n, retval);
-   return retval;
+   return si470x_set_register(radio, POWERCFG);
 }
 
 
@@ -700,21 +683,12 @@ static int si470x_vidioc_g_frequency(struct file *file, 
void *priv,
struct v4l2_frequency *freq)
 {
struct si470x_device *radio = video_drvdata(file);
-   int retval = 0;
 
-   if (freq-tuner != 0) {
-   retval = -EINVAL;
-   goto done;
-   }
+   if (freq-tuner != 0)
+   return -EINVAL;
 
freq-type = V4L2_TUNER_RADIO;
-   retval = si470x_get_freq(radio, freq-frequency);
-
-done:
-   if (retval  0)
-   dev_warn(radio-videodev.dev,
-   get frequency failed with %d\n, retval);
-   return retval;
+   return si470x_get_freq(radio, freq-frequency);
 }
 
 
@@ -725,20 +699,11 @@ static int si470x_vidioc_s_frequency(struct file *file, 
void *priv,
struct v4l2_frequency *freq)
 {
struct si470x_device *radio = video_drvdata(file);
-   int retval = 0;
-
-   if (freq-tuner != 0) {
-   retval = -EINVAL;
-   goto done;
-   }
 
-   retval = si470x_set_freq(radio, freq-frequency);
+   if (freq-tuner != 0)
+   return -EINVAL;
 
-done:
-   if (retval  0)
-   dev_warn(radio-videodev.dev,
-   set frequency failed with %d\n, retval);
-   return retval;
+   return si470x_set_freq(radio, freq-frequency);
 }
 
 
@@ -749,20 +714,11 @@ static int si470x_vidioc_s_hw_freq_seek(struct file 
*file, void *priv,
struct v4l2_hw_freq_seek *seek)
 {
struct si470x_device *radio = video_drvdata(file);
-   int retval = 

[RFC PATCH 2/4] si470x: add control event support and more v4l2 compliancy fixes.

2012-05-04 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/radio/si470x/radio-si470x-common.c |   45 ++
 1 file changed, 28 insertions(+), 17 deletions(-)

diff --git a/drivers/media/radio/si470x/radio-si470x-common.c 
b/drivers/media/radio/si470x/radio-si470x-common.c
index de9475f..e70badf 100644
--- a/drivers/media/radio/si470x/radio-si470x-common.c
+++ b/drivers/media/radio/si470x/radio-si470x-common.c
@@ -262,7 +262,7 @@ static int si470x_get_freq(struct si470x_device *radio, 
unsigned int *freq)
  */
 int si470x_set_freq(struct si470x_device *radio, unsigned int freq)
 {
-   unsigned int spacing, band_bottom;
+   unsigned int spacing, band_bottom, band_top;
unsigned short chan;
 
/* Spacing (kHz) */
@@ -278,19 +278,26 @@ int si470x_set_freq(struct si470x_device *radio, unsigned 
int freq)
spacing = 0.050 * FREQ_MUL; break;
};
 
-   /* Bottom of Band (MHz) */
+   /* Bottom/Top of Band (MHz) */
switch ((radio-registers[SYSCONFIG2]  SYSCONFIG2_BAND)  6) {
/* 0: 87.5 - 108 MHz (USA, Europe) */
case 0:
-   band_bottom = 87.5 * FREQ_MUL; break;
+   band_bottom = 87.5 * FREQ_MUL;
+   band_top = 108 * FREQ_MUL;
+   break;
/* 1: 76   - 108 MHz (Japan wide band) */
default:
-   band_bottom = 76   * FREQ_MUL; break;
+   band_bottom = 76 * FREQ_MUL;
+   band_top = 108 * FREQ_MUL;
+   break;
/* 2: 76   -  90 MHz (Japan) */
case 2:
-   band_bottom = 76   * FREQ_MUL; break;
+   band_bottom = 76 * FREQ_MUL;
+   band_top = 90 * FREQ_MUL;
+   break;
};
 
+   freq = clamp(freq, band_bottom, band_top);
/* Chan = [ Freq (Mhz) - Bottom of Band (MHz) ] / Spacing (kHz) */
chan = (freq - band_bottom) / spacing;
 
@@ -515,17 +522,19 @@ static unsigned int si470x_fops_poll(struct file *file,
struct poll_table_struct *pts)
 {
struct si470x_device *radio = video_drvdata(file);
-   int retval = 0;
-
-   /* switch on rds reception */
+   unsigned long req_events = poll_requested_events(pts);
+   int retval = v4l2_ctrl_poll(file, pts);
 
-   if ((radio-registers[SYSCONFIG1]  SYSCONFIG1_RDS) == 0)
-   si470x_rds_on(radio);
+   if (req_events  (POLLIN | POLLRDNORM)) {
+   /* switch on rds reception */
+   if ((radio-registers[SYSCONFIG1]  SYSCONFIG1_RDS) == 0)
+   si470x_rds_on(radio);
 
-   poll_wait(file, radio-read_queue, pts);
+   poll_wait(file, radio-read_queue, pts);
 
-   if (radio-rd_index != radio-wr_index)
-   retval = POLLIN | POLLRDNORM;
+   if (radio-rd_index != radio-wr_index)
+   retval |= POLLIN | POLLRDNORM;
+   }
 
return retval;
 }
@@ -637,6 +646,8 @@ static int si470x_vidioc_g_tuner(struct file *file, void 
*priv,
tuner-signal = (radio-registers[STATUSRSSI]  STATUSRSSI_RSSI);
/* the ideal factor is 0x/75 = 873,8 */
tuner-signal = (tuner-signal * 873) + (8 * tuner-signal / 10);
+   if (tuner-signal  0x)
+   tuner-signal = 0x;
 
/* automatic frequency control: -1: freq to low, 1 freq to high */
/* AFCRL does only indicate that freq. differs, not if too low/high */
@@ -660,7 +671,7 @@ static int si470x_vidioc_s_tuner(struct file *file, void 
*priv,
int retval = 0;
 
if (tuner-index != 0)
-   goto done;
+   return -EINVAL;
 
/* mono/stereo selector */
switch (tuner-audmode) {
@@ -668,15 +679,13 @@ static int si470x_vidioc_s_tuner(struct file *file, void 
*priv,
radio-registers[POWERCFG] |= POWERCFG_MONO;  /* force mono */
break;
case V4L2_TUNER_MODE_STEREO:
+   default:
radio-registers[POWERCFG] = ~POWERCFG_MONO; /* try stereo */
break;
-   default:
-   goto done;
}
 
retval = si470x_set_register(radio, POWERCFG);
 
-done:
if (retval  0)
dev_warn(radio-videodev.dev,
set tuner failed with %d\n, retval);
@@ -770,6 +779,8 @@ static const struct v4l2_ioctl_ops si470x_ioctl_ops = {
.vidioc_g_frequency = si470x_vidioc_g_frequency,
.vidioc_s_frequency = si470x_vidioc_s_frequency,
.vidioc_s_hw_freq_seek  = si470x_vidioc_s_hw_freq_seek,
+   .vidioc_subscribe_event = v4l2_ctrl_subscribe_event,
+   .vidioc_unsubscribe_event = v4l2_event_unsubscribe,
 };
 
 
-- 
1.7.10

--
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


[RFC PATCH 0/4] si470x: clean up and use latest frameworks

2012-05-04 Thread Hans Verkuil
This patch series updates the si470x driver so that it uses the latest
frameworks and passes the v4l2-compliance test tool.

It also removes usb autosuspend and the stop/start of the radio in the
release/open fops. It was very, very confusing that 'arecord -D ... | aplay'
didn't work unless you keep the radio0 node open (for no good reason other
then ensuring that the radio is started).

So the radio_start/stop code has been moved from open/release to
resume/suspend where it is used when you suspend the device. Note that
this change is for the USB version only, I did not touch the suspend/resume
code in the i2c version.

I've tested it all with my ADS InstantFM device.

--
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


[RFC PATCH 4/4] radio-si470x-usb: remove autosuspend, implement suspend/resume.

2012-05-04 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

The radio-si470x-usb driver supported both autosuspend and it stopped the
radio the moment the last user of the radio device closed it. However, that
was very confusing since if you play the audio from the device (e.g. through
arecord -D ... | aplay) then no sound would play unless you had the radio
device open at the same time, even though there is no need to do anything
with that node.

On the other hand, the actual suspend/resume functions didn't do anything,
which would fail if you *did* have the radio node open at that time.

So:

- remove autosuspend (bad idea in general for USB radio devices)
- move the start/stop out of the open/release functions into the resume/suspend
  functions.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/radio/si470x/radio-si470x-common.c |1 -
 drivers/media/radio/si470x/radio-si470x-usb.c|  149 ++
 2 files changed, 70 insertions(+), 80 deletions(-)

diff --git a/drivers/media/radio/si470x/radio-si470x-common.c 
b/drivers/media/radio/si470x/radio-si470x-common.c
index b9a44d4..969cf49 100644
--- a/drivers/media/radio/si470x/radio-si470x-common.c
+++ b/drivers/media/radio/si470x/radio-si470x-common.c
@@ -570,7 +570,6 @@ static int si470x_s_ctrl(struct v4l2_ctrl *ctrl)
else
radio-registers[POWERCFG] |= POWERCFG_DMUTE;
return si470x_set_register(radio, POWERCFG);
-   break;
default:
return -EINVAL;
}
diff --git a/drivers/media/radio/si470x/radio-si470x-usb.c 
b/drivers/media/radio/si470x/radio-si470x-usb.c
index f133c3d..e9f6387 100644
--- a/drivers/media/radio/si470x/radio-si470x-usb.c
+++ b/drivers/media/radio/si470x/radio-si470x-usb.c
@@ -481,91 +481,20 @@ resubmit:
 }
 
 
-
-/**
- * File Operations Interface
- **/
-
-/*
- * si470x_fops_open - file open
- */
 int si470x_fops_open(struct file *file)
 {
-   struct si470x_device *radio = video_drvdata(file);
-   int retval = v4l2_fh_open(file);
-
-   if (retval)
-   return retval;
-
-   retval = usb_autopm_get_interface(radio-intf);
-   if (retval  0)
-   goto done;
-
-   if (v4l2_fh_is_singular_file(file)) {
-   /* start radio */
-   retval = si470x_start(radio);
-   if (retval  0) {
-   usb_autopm_put_interface(radio-intf);
-   goto done;
-   }
-
-   /* initialize interrupt urb */
-   usb_fill_int_urb(radio-int_in_urb, radio-usbdev,
-   usb_rcvintpipe(radio-usbdev,
-   radio-int_in_endpoint-bEndpointAddress),
-   radio-int_in_buffer,
-   le16_to_cpu(radio-int_in_endpoint-wMaxPacketSize),
-   si470x_int_in_callback,
-   radio,
-   radio-int_in_endpoint-bInterval);
-
-   radio-int_in_running = 1;
-   mb();
-
-   retval = usb_submit_urb(radio-int_in_urb, GFP_KERNEL);
-   if (retval) {
-   dev_info(radio-intf-dev,
-submitting int urb failed (%d)\n, retval);
-   radio-int_in_running = 0;
-   usb_autopm_put_interface(radio-intf);
-   }
-   }
-
-done:
-   if (retval)
-   v4l2_fh_release(file);
-   return retval;
+   return v4l2_fh_open(file);
 }
 
-
-/*
- * si470x_fops_release - file release
- */
 int si470x_fops_release(struct file *file)
 {
-   struct si470x_device *radio = video_drvdata(file);
-
-   if (v4l2_fh_is_singular_file(file)) {
-   /* shutdown interrupt handler */
-   if (radio-int_in_running) {
-   radio-int_in_running = 0;
-   if (radio-int_in_urb)
-   usb_kill_urb(radio-int_in_urb);
-   }
-
-   /* cancel read processes */
-   wake_up_interruptible(radio-read_queue);
-
-   /* stop radio */
-   si470x_stop(radio);
-   usb_autopm_put_interface(radio-intf);
-   }
return v4l2_fh_release(file);
 }
 
-static void si470x_usb_release(struct video_device *vdev)
+static void si470x_usb_release(struct v4l2_device *v4l2_dev)
 {
-   struct si470x_device *radio = video_get_drvdata(vdev);
+   struct si470x_device *radio =
+   container_of(v4l2_dev, struct si470x_device, v4l2_dev);
 
usb_free_urb(radio-int_in_urb);
v4l2_ctrl_handler_free(radio-hdl);
@@ -599,6 +528,38 @@ int si470x_vidioc_querycap(struct file *file, void *priv,
 }
 
 
+static int si470x_start_usb(struct si470x_device *radio)
+{
+   int retval;

[RFC PATCH 1/4] si470x: Clean up, introduce the control framework.

2012-05-04 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

This cleans up the code and si470x now uses the proper v4l2 frameworks
and passes most of the v4l2-compliance tests.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/radio/si470x/radio-si470x-common.c |  193 +++---
 drivers/media/radio/si470x/radio-si470x-i2c.c|   65 ++--
 drivers/media/radio/si470x/radio-si470x-usb.c|  146 +++-
 drivers/media/radio/si470x/radio-si470x.h|   14 +-
 4 files changed, 105 insertions(+), 313 deletions(-)

diff --git a/drivers/media/radio/si470x/radio-si470x-common.c 
b/drivers/media/radio/si470x/radio-si470x-common.c
index 0e740c9..de9475f 100644
--- a/drivers/media/radio/si470x/radio-si470x-common.c
+++ b/drivers/media/radio/si470x/radio-si470x-common.c
@@ -196,9 +196,9 @@ static int si470x_set_chan(struct si470x_device *radio, 
unsigned short chan)
}
 
if ((radio-registers[STATUSRSSI]  STATUSRSSI_STC) == 0)
-   dev_warn(radio-videodev-dev, tune does not complete\n);
+   dev_warn(radio-videodev.dev, tune does not complete\n);
if (timed_out)
-   dev_warn(radio-videodev-dev,
+   dev_warn(radio-videodev.dev,
tune timed out after %u ms\n, tune_timeout);
 
 stop:
@@ -344,12 +344,12 @@ static int si470x_set_seek(struct si470x_device *radio,
}
 
if ((radio-registers[STATUSRSSI]  STATUSRSSI_STC) == 0)
-   dev_warn(radio-videodev-dev, seek does not complete\n);
+   dev_warn(radio-videodev.dev, seek does not complete\n);
if (radio-registers[STATUSRSSI]  STATUSRSSI_SF)
-   dev_warn(radio-videodev-dev,
+   dev_warn(radio-videodev.dev,
seek failed / band limit reached\n);
if (timed_out)
-   dev_warn(radio-videodev-dev,
+   dev_warn(radio-videodev.dev,
seek timed out after %u ms\n, seek_timeout);
 
 stop:
@@ -463,7 +463,6 @@ static ssize_t si470x_fops_read(struct file *file, char 
__user *buf,
unsigned int block_count = 0;
 
/* switch on rds reception */
-   mutex_lock(radio-lock);
if ((radio-registers[SYSCONFIG1]  SYSCONFIG1_RDS) == 0)
si470x_rds_on(radio);
 
@@ -505,7 +504,6 @@ static ssize_t si470x_fops_read(struct file *file, char 
__user *buf,
}
 
 done:
-   mutex_unlock(radio-lock);
return retval;
 }
 
@@ -521,10 +519,8 @@ static unsigned int si470x_fops_poll(struct file *file,
 
/* switch on rds reception */
 
-   mutex_lock(radio-lock);
if ((radio-registers[SYSCONFIG1]  SYSCONFIG1_RDS) == 0)
si470x_rds_on(radio);
-   mutex_unlock(radio-lock);
 
poll_wait(file, radio-read_queue, pts);
 
@@ -553,134 +549,27 @@ static const struct v4l2_file_operations si470x_fops = {
  * Video4Linux Interface
  **/
 
-/*
- * si470x_vidioc_queryctrl - enumerate control items
- */
-static int si470x_vidioc_queryctrl(struct file *file, void *priv,
-   struct v4l2_queryctrl *qc)
-{
-   struct si470x_device *radio = video_drvdata(file);
-   int retval = -EINVAL;
-
-   /* abort if qc-id is below V4L2_CID_BASE */
-   if (qc-id  V4L2_CID_BASE)
-   goto done;
-
-   /* search video control */
-   switch (qc-id) {
-   case V4L2_CID_AUDIO_VOLUME:
-   return v4l2_ctrl_query_fill(qc, 0, 15, 1, 15);
-   case V4L2_CID_AUDIO_MUTE:
-   return v4l2_ctrl_query_fill(qc, 0, 1, 1, 1);
-   }
 
-   /* disable unsupported base controls */
-   /* to satisfy kradio and such apps */
-   if ((retval == -EINVAL)  (qc-id  V4L2_CID_LASTP1)) {
-   qc-flags = V4L2_CTRL_FLAG_DISABLED;
-   retval = 0;
-   }
-
-done:
-   if (retval  0)
-   dev_warn(radio-videodev-dev,
-   query controls failed with %d\n, retval);
-   return retval;
-}
-
-
-/*
- * si470x_vidioc_g_ctrl - get the value of a control
- */
-static int si470x_vidioc_g_ctrl(struct file *file, void *priv,
-   struct v4l2_control *ctrl)
+static int si470x_s_ctrl(struct v4l2_ctrl *ctrl)
 {
-   struct si470x_device *radio = video_drvdata(file);
-   int retval = 0;
-
-   mutex_lock(radio-lock);
-   /* safety checks */
-   retval = si470x_disconnect_check(radio);
-   if (retval)
-   goto done;
-
-   switch (ctrl-id) {
-   case V4L2_CID_AUDIO_VOLUME:
-   ctrl-value = radio-registers[SYSCONFIG2] 
-   SYSCONFIG2_VOLUME;
-   break;
-   case V4L2_CID_AUDIO_MUTE:
-   ctrl-value = ((radio-registers[POWERCFG] 
-   POWERCFG_DMUTE) == 0) ? 1 : 0;
-   break;
-   default:
-   retval = -EINVAL;
-   }
-
-done:
-   if 

Re: [PATCH v2] add support for DeLOCK-USB-2.0-DVB-T-Receiver-61744

2012-05-04 Thread Gianluca Gennari
Hi poma,
thanks for the very interesting links.

Il 04/05/2012 03:27, poma ha scritto:
 On 05/03/2012 11:03 AM, Gianluca Gennari wrote:
 Hi poma,
 I have a 0BDA:2838 (Easycap EZTV646) and a 0BDA:2832 (no name 20x20mm
 mini DVB-T stick) and both are based on the E4000 tuner, which is not
 supported in the kernel at the moment.
 I have no idea if there are sticks with the same USB PID and the fc0012
 tuner.
 
 OK, second one - no name device is Realtek RTL2832U reference design**.
 
 First one:
 Once upon a time there was a EasyCAP�
 After while crocodile!
 �and EzCAP was born.
 http://szforwardvideo.en.alibaba.com/aboutus.html
 Obviously Easycap EZTV646 != EzCAP EzTV646
 http://www.reddit.com/r/RTLSDR/comments/s6ddo/rtlsdr_compatibility_list_v2_work_in_progress/
 ezcap EzTV646 0BDA:2838   RTL2832U/FC0012 Some revisions may have 
 the E4000*
 http://i.imgur.com/mFD1X.jpg
 (Generic) 0BDa:2838   RTL2832U/E4000*
 �
 And, in addition:
 http://sdr.osmocom.org/trac/wiki/rtl-sdr
 0x0bda0x2832  all of them Generic RTL2832U (e.g. hama nano)**
 0x0bda0x2838  E4000   ezcap USB 2.0 DVB-T/DAB/FM dongle
 �
 Maybe?
 https://sites.google.com/site/myrtlsdr/

That's it. Opening the device enclosure, I can read this on the PCB:
EzTV668 1.0
and it looks identical to the picture posted there.

 EzCap EZTV646 has got RTL2832U/FC0012. However rtl-sdr must be tweaked
 to force FC0012 tuner because it has the same PID as EZTV668 (PID:
 0x2838) so running it whithout a tweak will select Elonics E4000 tuner.
 Works, not so good at filtering.
 �
 Conclusion:
 At least two devices share same vid/pid with different tuners - fc0012
 vs e4000.
 How to resolve this from a drivers perspective in a proper way?

This is not a big problem: the rtl2832 driver should read the tuner type
from an internal register and load the proper module (or exit with an
error message if the tuner is unsupported).

 Beside,
 there is GPL'ed 'e4k' tuner source code aka 'e4000 improved'*** (Elonics
 E4000)
 by Harald Welte
 http://cgit.osmocom.org/cgit/osmo-sdr/tree/firmware/src/tuner_e4k.c
 http://sdr.osmocom.org/trac/
 http://sdr.osmocom.org/trac/wiki/rtl-sdr
 http://wiki.spench.net/wiki/RTL2832U***

Very nice. So we should ask Harald Welte if he is willing to have his
driver merged in the kernel.

 regards,
 poma
 

Regards,
Gianluca
--
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 v2] add support for DeLOCK-USB-2.0-DVB-T-Receiver-61744

2012-05-04 Thread Gianluca Gennari
Il 04/05/2012 03:27, poma ha scritto:
 On 05/03/2012 11:03 AM, Gianluca Gennari wrote:
 Hi poma,
 I have a 0BDA:2838 (Easycap EZTV646) and a 0BDA:2832 (no name 20x20mm
 mini DVB-T stick) and both are based on the E4000 tuner, which is not
 supported in the kernel at the moment.
 I have no idea if there are sticks with the same USB PID and the fc0012
 tuner.
 
 OK, second one - no name device is Realtek RTL2832U reference design**.

Just for reference, the no name device I bought on ebay is exactly
this one:

http://i01.i.aliimg.com/photo/v0/513925059/Mini_notebook_USB_DVB_T_Stick_receiver.jpg

Tuner: E4000
USB PID: 0BDA:2832

It is listed as Unikoo UK001T (P160) on the RTL SDR compatibility list:
http://www.reddit.com/r/RTLSDR/comments/s6ddo/rtlsdr_compatibility_list_v2_work_in_progress/

Best regards,
Gianluca

 
 First one:
 Once upon a time there was a EasyCAP�
 After while crocodile!
 �and EzCAP was born.
 http://szforwardvideo.en.alibaba.com/aboutus.html
 Obviously Easycap EZTV646 != EzCAP EzTV646
 http://www.reddit.com/r/RTLSDR/comments/s6ddo/rtlsdr_compatibility_list_v2_work_in_progress/
 ezcap EzTV646 0BDA:2838   RTL2832U/FC0012 Some revisions may have 
 the E4000*
 http://i.imgur.com/mFD1X.jpg
 (Generic) 0BDa:2838   RTL2832U/E4000*
 �
 And, in addition:
 http://sdr.osmocom.org/trac/wiki/rtl-sdr
 0x0bda0x2832  all of them Generic RTL2832U (e.g. hama nano)**
 0x0bda0x2838  E4000   ezcap USB 2.0 DVB-T/DAB/FM dongle
 �
 Maybe?
 https://sites.google.com/site/myrtlsdr/
 EzCap EZTV646 has got RTL2832U/FC0012. However rtl-sdr must be tweaked
 to force FC0012 tuner because it has the same PID as EZTV668 (PID:
 0x2838) so running it whithout a tweak will select Elonics E4000 tuner.
 Works, not so good at filtering.
 �
 Conclusion:
 At least two devices share same vid/pid with different tuners - fc0012
 vs e4000.
 How to resolve this from a drivers perspective in a proper way?
 
 Beside,
 there is GPL'ed 'e4k' tuner source code aka 'e4000 improved'*** (Elonics
 E4000)
 by Harald Welte
 http://cgit.osmocom.org/cgit/osmo-sdr/tree/firmware/src/tuner_e4k.c
 http://sdr.osmocom.org/trac/
 http://sdr.osmocom.org/trac/wiki/rtl-sdr
 http://wiki.spench.net/wiki/RTL2832U***
 
 regards,
 poma
 

--
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] v4l: soc-camera: Add support for enum_frameintervals ioctl

2012-05-04 Thread Guennadi Liakhovetski
Hi Sergio

Sorry about the delay.

On Wed, 18 Apr 2012, Aguirre, Sergio wrote:

 From: Sergio Aguirre saagui...@ti.com
 
 Signed-off-by: Sergio Aguirre saagui...@ti.com
 ---
  drivers/media/video/soc_camera.c |   37 +
  include/media/soc_camera.h   |1 +
  2 files changed, 38 insertions(+), 0 deletions(-)
 
 diff --git a/drivers/media/video/soc_camera.c 
 b/drivers/media/video/soc_camera.c
 index eb25756..62c8956 100644
 --- a/drivers/media/video/soc_camera.c
 +++ b/drivers/media/video/soc_camera.c
 @@ -266,6 +266,15 @@ static int soc_camera_enum_fsizes(struct file
 *file, void *fh,
   return ici-ops-enum_fsizes(icd, fsize);
  }
 
 +static int soc_camera_enum_fivals(struct file *file, void *fh,

fivals is a bit short for my taste. Yes, I know about the 
*_enum_fsizes() precedent in soc_camera.c, we should have used a more 
descriptive name for that too. So, maybe I'll push a patch to change that 
to enum_frmsizes() or enum_framesizes().

But that brings in a larger question, which is also the reason, why I 
added a couple more people to the CC: the following 3 operations in struct 
v4l2_subdev_video_ops don't make me particularly happy:

int (*enum_framesizes)(struct v4l2_subdev *sd, struct v4l2_frmsizeenum 
*fsize);
int (*enum_frameintervals)(struct v4l2_subdev *sd, struct 
v4l2_frmivalenum *fival);
int (*enum_mbus_fsizes)(struct v4l2_subdev *sd,
 struct v4l2_frmsizeenum *fsize);

The problems are:

1. enum_framesizes and enum_mbus_fsizes seem to be identical (yes, I see 
my Sob under the latter:-()
2. both struct v4l2_frmsizeenum and struct v4l2_frmivalenum are the 
structs, used in the respective V4L2 ioctl()s, and they both contain a 
field for a fourcc value, which doesn't make sense to subdevice drivers. 
So far the only driver combination in the mainline, that I see, that uses 
these operations is marvell-ccic  ov7670. These drivers just ignore the 
pixel format. Relatively recently enum_mbus_fsizes() has been added to 
soc-camera, and this patch is adding enum_frameintervals(). Both these 
implementations abuse the .pixel_format field to pass a media-bus code 
value in it to subdevice drivers. This sends meaningful information to 
subdevice drivers, but is really a hack, rather than a proper 
implementation.

Any idea how to improve this? Shall we create mediabus clones of those 
structs with an mbus code instead of fourcc, and drop one of the above 
enum_framesizes() operations?

Thanks
Guennadi

 +struct v4l2_frmivalenum *fival)
 +{
 + struct soc_camera_device *icd = file-private_data;
 + struct soc_camera_host *ici = to_soc_camera_host(icd-parent);
 +
 + return ici-ops-enum_fivals(icd, fival);
 +}
 +
  static int soc_camera_reqbufs(struct file *file, void *priv,
 struct v4l2_requestbuffers *p)
  {
 @@ -1266,6 +1275,31 @@ static int default_enum_fsizes(struct
 soc_camera_device *icd,
   return 0;
  }
 
 +static int default_enum_fivals(struct soc_camera_device *icd,
 +   struct v4l2_frmivalenum *fival)
 +{
 + int ret;
 + struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
 + const struct soc_camera_format_xlate *xlate;
 + __u32 pixfmt = fival-pixel_format;
 + struct v4l2_frmivalenum fival_sd = *fival;
 +
 + xlate = soc_camera_xlate_by_fourcc(icd, pixfmt);
 + if (!xlate)
 + return -EINVAL;
 + /* map xlate-code to pixel_format, sensor only handle xlate-code*/
 + fival_sd.pixel_format = xlate-code;
 +
 + ret = v4l2_subdev_call(sd, video, enum_frameintervals, fival_sd);
 + if (ret  0)
 + return ret;
 +
 + *fival = fival_sd;
 + fival-pixel_format = pixfmt;
 +
 + return 0;
 +}
 +
  int soc_camera_host_register(struct soc_camera_host *ici)
  {
   struct soc_camera_host *ix;
 @@ -1297,6 +1331,8 @@ int soc_camera_host_register(struct soc_camera_host 
 *ici)
   ici-ops-get_parm = default_g_parm;
   if (!ici-ops-enum_fsizes)
   ici-ops-enum_fsizes = default_enum_fsizes;
 + if (!ici-ops-enum_fivals)
 + ici-ops-enum_fivals = default_enum_fivals;
 
   mutex_lock(list_lock);
   list_for_each_entry(ix, hosts, list) {
 @@ -1387,6 +1423,7 @@ static const struct v4l2_ioctl_ops
 soc_camera_ioctl_ops = {
   .vidioc_s_std= soc_camera_s_std,
   .vidioc_g_std= soc_camera_g_std,
   .vidioc_enum_framesizes  = soc_camera_enum_fsizes,
 + .vidioc_enum_frameintervals  = soc_camera_enum_fivals,
   .vidioc_reqbufs  = soc_camera_reqbufs,
   .vidioc_querybuf = soc_camera_querybuf,
   .vidioc_qbuf = soc_camera_qbuf,
 diff --git a/include/media/soc_camera.h b/include/media/soc_camera.h
 index b5c2b6c..0a3ac07 100644
 --- a/include/media/soc_camera.h
 +++ b/include/media/soc_camera.h
 @@ -98,6 +98,7 @@ struct soc_camera_host_ops 

GENIUS TV-GO A12 tv analog card

2012-05-04 Thread Sebastián Misuraca
Hi,

I add a tv card support for saa7134 driver, the card name is Genius
TV Go A12 and i test the RF capture with pal-nc and I test the
composite input too. I want to known if I would make a patch or what i
have to do to give us the patch. Here is the code:


diff linux-3.3.4/drivers/media/video/saa7134/saa7134-cards.c
saa7134/saa7134-cards.c
5715,5750d5714
   [SAA7134_BOARD_GENIUS_TVGO_A12] = {
   .name   = GENIUS TV-GO A12,
   .audio_clock    = 0x00187de7,
   .tuner_type = TUNER_PHILIPS_TDA8290,
   .radio_type = UNSET,
   .tuner_addr = ADDR_UNSET,
   .radio_addr = ADDR_UNSET,
   .gpiomask   = 0x20,
   .inputs = {{
   .name = name_tv,
   .vmux = 1,
   .amux = TV,
   .gpio = 0x,
   .tv   = 1,
   },{
   .name = name_tv,
   .vmux = 3,
   .amux = LINE2,
   .tv   = 1
   },{
   .name = name_svideo, //TODO: no test
   .vmux = 6,
   .amux = LINE2,
   .gpio = 0x,
   }},
   .radio = {
   .name = name_radio,
   .amux = TV,
   .gpio = 0x20,
   },
   .mute  = {
   .name = name_mute,
   .gpio = 0x,
   },

   }
6985,6990d6948
   },{
   .vendor   = PCI_VENDOR_ID_PHILIPS,
   .device   = PCI_DEVICE_ID_PHILIPS_SAA7133,
   .subvendor    = 0x0458,
   .subdevice    = 0x6008,
   .driver_data  = SAA7134_BOARD_GENIUS_TVGO_A12,
7029d6986
   /* --- end of list --- */
7030a6988
   /* --- end of list --- */
7360d7317
   case SAA7134_BOARD_GENIUS_TVGO_A12:


--
Sebastián Misuraca
3waySolutions S.A.
TE: 5217-3330
www.3way.com.ar


[GIT PULL FOR 3.5] s5p-fimc driver updates

2012-05-04 Thread Sylwester Nawrocki
Hi Mauro,

The following changes since commit 34b2debaa62bfa384ef91b61cf2c40c48e86a5e2:

  s5p-fimc: Correct memory allocation for VIDIOC_CREATE_BUFS (2012-05-04 
17:07:24 +0200)

are available in the git repository at:

  git://git.infradead.org/users/kmpark/linux-samsung v4l-fimc-exynos4x12

for you to fetch changes up to bab96b068afa07105139be09d3830cc9ed580382:

  s5p-fimc: Use selection API in place of crop operations (2012-05-04 17:18:38 
+0200)


Sylwester Nawrocki (14):
  V4L: Extend V4L2_CID_COLORFX with more image effects
  s5p-fimc: Avoid crash with null platform_data
  s5p-fimc: Move m2m node driver into separate file
  s5p-fimc: Use v4l2_subdev internal ops to register video nodes
  s5p-fimc: Refactor the register interface functions
  s5p-fimc: Add FIMC-LITE register definitions
  s5p-fimc: Rework the video pipeline control functions
  s5p-fimc: Prefix format enumerations with FIMC_FMT_
  s5p-fimc: Minor cleanups
  s5p-fimc: Make sure an interrupt is properly requested
  s5p-fimc: Add support for Exynos4x12 FIMC-LITE
  s5p-fimc: Update copyright notices
  s5p-fimc: Add color effect control
  s5p-fimc: Use selection API in place of crop operations

 Documentation/DocBook/media/v4l/compat.xml   |   13 +
 Documentation/DocBook/media/v4l/controls.xml |   98 ++-
 Documentation/DocBook/media/v4l/v4l2.xml |5 +-
 drivers/media/video/Kconfig  |   24 +-
 drivers/media/video/s5p-fimc/Kconfig |   48 ++
 drivers/media/video/s5p-fimc/Makefile|6 +-
 drivers/media/video/s5p-fimc/fimc-capture.c  |  473 -
 drivers/media/video/s5p-fimc/fimc-core.c | 1096 
+---
 drivers/media/video/s5p-fimc/fimc-core.h |  254 ++-
 drivers/media/video/s5p-fimc/fimc-lite-reg.c |  300 
 drivers/media/video/s5p-fimc/fimc-lite-reg.h |  150 
 drivers/media/video/s5p-fimc/fimc-lite.c | 1576 
+
 drivers/media/video/s5p-fimc/fimc-lite.h |  213 ++
 drivers/media/video/s5p-fimc/fimc-m2m.c  |  820 +
 drivers/media/video/s5p-fimc/fimc-mdevice.c  |  407 +++
 drivers/media/video/s5p-fimc/fimc-mdevice.h  |   18 +-
 drivers/media/video/s5p-fimc/fimc-reg.c  |  613 
 drivers/media/video/s5p-fimc/fimc-reg.h  |  326 +
 drivers/media/video/s5p-fimc/regs-fimc.h |  301 
 drivers/media/video/v4l2-ctrls.c |7 +
 include/linux/videodev2.h|   29 +-
 include/media/s5p_fimc.h |   16 +
 22 files changed, 4734 insertions(+), 2059 deletions(-)
 create mode 100644 drivers/media/video/s5p-fimc/Kconfig
 create mode 100644 drivers/media/video/s5p-fimc/fimc-lite-reg.c
 create mode 100644 drivers/media/video/s5p-fimc/fimc-lite-reg.h
 create mode 100644 drivers/media/video/s5p-fimc/fimc-lite.c
 create mode 100644 drivers/media/video/s5p-fimc/fimc-lite.h
 create mode 100644 drivers/media/video/s5p-fimc/fimc-m2m.c
 create mode 100644 drivers/media/video/s5p-fimc/fimc-reg.h
 delete mode 100644 drivers/media/video/s5p-fimc/regs-fimc.h

I have added following 2 patches, from my previous pull request for 3.4-rc
(http://patchwork.linuxtv.org/patch/10888/), on top of staging/for_v3.5 
as a base for this patch set:

34b2deb s5p-fimc: Correct memory allocation for VIDIOC_CREATE_BUFS
157495a s5p-fimc: Fix locking in subdev set_crop op


Regards
-- 
Sylwester Nawrocki
Samsung Poland RD Center
--
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] v4l: soc-camera: Add support for enum_frameintervals ioctl

2012-05-04 Thread Aguirre, Sergio
Hi Guennadi,

No problem.

On Fri, May 4, 2012 at 10:05 AM, Guennadi Liakhovetski
g.liakhovet...@gmx.de wrote:
 Hi Sergio

 Sorry about the delay.

 On Wed, 18 Apr 2012, Aguirre, Sergio wrote:

 From: Sergio Aguirre saagui...@ti.com

 Signed-off-by: Sergio Aguirre saagui...@ti.com
 ---
  drivers/media/video/soc_camera.c |   37 
 +
  include/media/soc_camera.h       |    1 +
  2 files changed, 38 insertions(+), 0 deletions(-)

 diff --git a/drivers/media/video/soc_camera.c 
 b/drivers/media/video/soc_camera.c
 index eb25756..62c8956 100644
 --- a/drivers/media/video/soc_camera.c
 +++ b/drivers/media/video/soc_camera.c
 @@ -266,6 +266,15 @@ static int soc_camera_enum_fsizes(struct file
 *file, void *fh,
       return ici-ops-enum_fsizes(icd, fsize);
  }

 +static int soc_camera_enum_fivals(struct file *file, void *fh,

 fivals is a bit short for my taste. Yes, I know about the
 *_enum_fsizes() precedent in soc_camera.c, we should have used a more
 descriptive name for that too. So, maybe I'll push a patch to change that
 to enum_frmsizes() or enum_framesizes().

Agreed.


 But that brings in a larger question, which is also the reason, why I
 added a couple more people to the CC: the following 3 operations in struct
 v4l2_subdev_video_ops don't make me particularly happy:

        int (*enum_framesizes)(struct v4l2_subdev *sd, struct v4l2_frmsizeenum 
 *fsize);
        int (*enum_frameintervals)(struct v4l2_subdev *sd, struct 
 v4l2_frmivalenum *fival);
        int (*enum_mbus_fsizes)(struct v4l2_subdev *sd,
                             struct v4l2_frmsizeenum *fsize);

 The problems are:

 1. enum_framesizes and enum_mbus_fsizes seem to be identical (yes, I see
 my Sob under the latter:-()

Yeah, IMHO, the mbus one should go, since there's no mbus specific structure
being handed as a parameter.

 2. both struct v4l2_frmsizeenum and struct v4l2_frmivalenum are the
 structs, used in the respective V4L2 ioctl()s, and they both contain a
 field for a fourcc value, which doesn't make sense to subdevice drivers.
 So far the only driver combination in the mainline, that I see, that uses
 these operations is marvell-ccic  ov7670. These drivers just ignore the
 pixel format. Relatively recently enum_mbus_fsizes() has been added to
 soc-camera, and this patch is adding enum_frameintervals(). Both these
 implementations abuse the .pixel_format field to pass a media-bus code
 value in it to subdevice drivers. This sends meaningful information to
 subdevice drivers, but is really a hack, rather than a proper
 implementation.

True.


 Any idea how to improve this? Shall we create mediabus clones of those
 structs with an mbus code instead of fourcc, and drop one of the above
 enum_framesizes() operations?

Well, to add more confusion to this.. :)

We have this v4l2-subdev IOCTLs exported to userspace:

#define VIDIOC_SUBDEV_ENUM_FRAME_SIZE \
_IOWR('V', 74, struct v4l2_subdev_frame_size_enum)
#define VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL \
_IOWR('V', 75, struct v4l2_subdev_frame_interval_enum)

Which in drivers/media/video/v4l2-subdev.c, are translated to pad ops:
- v4l2_subdev_call(... enum_frame_size ...);
- v4l2_subdev_call(... enum_frame_interval ...);

respectively.

So, this is also another thing that's causing some confusion.

Does soc_camera use pad ops?

Regards,
Sergio


 Thanks
 Guennadi

 +                                struct v4l2_frmivalenum *fival)
 +{
 +     struct soc_camera_device *icd = file-private_data;
 +     struct soc_camera_host *ici = to_soc_camera_host(icd-parent);
 +
 +     return ici-ops-enum_fivals(icd, fival);
 +}
 +
  static int soc_camera_reqbufs(struct file *file, void *priv,
                             struct v4l2_requestbuffers *p)
  {
 @@ -1266,6 +1275,31 @@ static int default_enum_fsizes(struct
 soc_camera_device *icd,
       return 0;
  }

 +static int default_enum_fivals(struct soc_camera_device *icd,
 +                       struct v4l2_frmivalenum *fival)
 +{
 +     int ret;
 +     struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
 +     const struct soc_camera_format_xlate *xlate;
 +     __u32 pixfmt = fival-pixel_format;
 +     struct v4l2_frmivalenum fival_sd = *fival;
 +
 +     xlate = soc_camera_xlate_by_fourcc(icd, pixfmt);
 +     if (!xlate)
 +             return -EINVAL;
 +     /* map xlate-code to pixel_format, sensor only handle xlate-code*/
 +     fival_sd.pixel_format = xlate-code;
 +
 +     ret = v4l2_subdev_call(sd, video, enum_frameintervals, fival_sd);
 +     if (ret  0)
 +             return ret;
 +
 +     *fival = fival_sd;
 +     fival-pixel_format = pixfmt;
 +
 +     return 0;
 +}
 +
  int soc_camera_host_register(struct soc_camera_host *ici)
  {
       struct soc_camera_host *ix;
 @@ -1297,6 +1331,8 @@ int soc_camera_host_register(struct soc_camera_host 
 *ici)
               ici-ops-get_parm = default_g_parm;
       if (!ici-ops-enum_fsizes)
               

cron job: media_tree daily build: WARNINGS

2012-05-04 Thread Hans Verkuil
This message is generated daily by a cron job that builds media_tree for
the kernels and architectures in the list below.

Results of the daily build of media_tree:

date:Fri May  4 19:00:19 CEST 2012
git hash:a1ac5dc28d2b4ca78e183229f7c595ffd725241c
gcc version:  i686-linux-gcc (GCC) 4.6.3
host hardware:x86_64
host os:  3.1-2.slh.1-amd64

linux-git-arm-eabi-exynos: WARNINGS
linux-git-arm-eabi-omap: WARNINGS
linux-git-armv5-ixp: WARNINGS
linux-git-i686: OK
linux-git-m32r: OK
linux-git-mips: WARNINGS
linux-git-powerpc64: OK
linux-git-x86_64: WARNINGS
linux-2.6.31.12-i686: WARNINGS
linux-2.6.32.6-i686: WARNINGS
linux-2.6.33-i686: WARNINGS
linux-2.6.34-i686: WARNINGS
linux-2.6.35.3-i686: WARNINGS
linux-2.6.36-i686: WARNINGS
linux-2.6.37-i686: WARNINGS
linux-2.6.38.2-i686: WARNINGS
linux-2.6.39.1-i686: WARNINGS
linux-3.0-i686: OK
linux-3.1-i686: OK
linux-3.2.1-i686: OK
linux-3.3-i686: WARNINGS
linux-2.6.31.12-x86_64: WARNINGS
linux-2.6.32.6-x86_64: WARNINGS
linux-2.6.33-x86_64: WARNINGS
linux-2.6.34-x86_64: WARNINGS
linux-2.6.35.3-x86_64: WARNINGS
linux-2.6.36-x86_64: WARNINGS
linux-2.6.37-x86_64: WARNINGS
linux-2.6.38.2-x86_64: WARNINGS
linux-2.6.39.1-x86_64: WARNINGS
linux-3.0-x86_64: WARNINGS
linux-3.1-x86_64: WARNINGS
linux-3.2.1-x86_64: WARNINGS
linux-3.3-x86_64: WARNINGS
apps: WARNINGS
spec-git: WARNINGS
sparse: ERRORS

Detailed results are available here:

http://www.xs4all.nl/~hverkuil/logs/Friday.log

Full logs are available here:

http://www.xs4all.nl/~hverkuil/logs/Friday.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


[PATCH/RFC v4 00/13] V4L: camera control enhancements

2012-05-04 Thread Sylwester Nawrocki
Here is one more update of the camera class controls change set.

Changes since v3, these are mainly corrections after comments from
Hans (thank you!):
 - V4L2_CID_IMAGE_STABILIZATION and V4L2_CID_WIDE_DYNAMIC_RANGE controls
   type reverted back to boolean, added a note in the documentation that
   these controls may be converted to menu controls in future;
 - Added description for new integer menu control helpers to
   Documentation/video4linux/v4l2-controls.txt
 - edited V4L2_CID_3A_LOCK control's description;
 - removed the vivi patch from the series;

Comments are welcome. If there is no more major corrections required
I'd like to send a pull request next week for the following:

  V4L: Add helper function for standard integer menu controls
  V4L: Add camera exposure bias control
  V4L: Add an extended camera white balance control
  V4L: Add camera wide dynamic range control
  V4L: Add camera image stabilization control
  V4L: Add camera ISO sensitivity controls
  V4L: Add camera exposure metering control
  V4L: Add camera scene mode control
  V4L: Add camera 3A lock control

and after there is an agreement on how to handle the enums in the V4L2 API,
since some of the above patches depend on the new integer menu control
type addition.


Changes since v2:
 - V4L2_CID_WHITE_BALANCE_PRESET replaced with 
V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE
   according to suggestions from Hans de Goede;
 - added Flurescent H white balance preset;
 - V4L2_CID_IMAGE_STABILIZATION and V4L2_CID_WIDE_DYNAMIC_RANGE controls type
   changed from boolean to menu, to make any further extensions of these
   controls easier;
   I'm just not 100% sure if V4L2_WIDE_DYNAMIC_RANGE_ENABLED and
   V4L2_IMAGE_STABILIZATION_ENABLED are good names for cases where the camera
   doesn't support wide dynamic range or image stabilization technique
   selection and only allows to enable or disable those algorithms;
 - V4L2_CID_ISO_SENSITIVITY_AUTO control type changed from boolean to menu in
   order to support ISO presets; currently enum v4l2_iso_sensitivity_auto_type
   does not contain any presets though;
 - V4L2_CID_COLORFX patch removed from this series;
 - updated vivi and s5c73m3 driver patches.

Changes since v1 (implicit):
 - the V4L2_CID_AUTO_FOCUS_FACE_PRIORITY control merged with
   V4L2_CID_AUTO_FOCUS_FACE_AREA,
 - many minor documentation corrections,
 - removed 08/23 V4L: camera control class... patch, which got
   accidentally added at v1,
 - added V4L2_CID_SCENE_MODE and V4L2_CID_3A_LOCK controls,
 - added vivi patch for testing.

The patches will be also available in few hours in git repository at:
http://git.infradead.org/users/kmpark/linux-samsung/shortlog/refs/heads/v4l-camera-controls

Regards,
Sylwester


Sylwester Nawrocki (12):
  V4L: Add helper function for standard integer menu controls
  V4L: Add camera exposure bias control
  V4L: Add an extended camera white balance control
  V4L: Add camera wide dynamic range control
  V4L: Add camera image stabilization control
  V4L: Add camera ISO sensitivity controls
  V4L: Add camera exposure metering control
  V4L: Add camera scene mode control
  V4L: Add camera 3A lock control
  V4L: Add auto focus targets to the selections API
  V4L: Add auto focus targets to the subdev selections API
  V4L: Add camera auto focus controls

 Documentation/DocBook/media/v4l/biblio.xml |   11 +
 Documentation/DocBook/media/v4l/controls.xml   |  481 +++-
 Documentation/DocBook/media/v4l/dev-subdev.xml |   27 +-
 Documentation/DocBook/media/v4l/selection-api.xml  |   33 +-
 .../DocBook/media/v4l/vidioc-g-selection.xml   |   11 +
 .../media/v4l/vidioc-subdev-g-selection.xml|   14 +-
 Documentation/video4linux/v4l2-controls.txt|   22 +
 drivers/media/video/v4l2-ctrls.c   |  121 -
 include/linux/v4l2-subdev.h|4 +
 include/linux/videodev2.h  |   86 
 include/media/v4l2-ctrls.h |   17 +
 11 files changed, 820 insertions(+), 7 deletions(-)

-- 
1.7.10

--
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/RFC v4 03/12] V4L: Add an extended camera white balance control

2012-05-04 Thread Sylwester Nawrocki
This patch adds V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE control which is
an extended version of the V4L2_CID_AUTO_WHITE_BALANCE control,
including white balance presets. The following presets are defined:

 - V4L2_WHITE_BALANCE_INCANDESCENT,
 - V4L2_WHITE_BALANCE_FLUORESCENT,
 - V4L2_WHITE_BALANCE_FLUORESCENT_H,
 - V4L2_WHITE_BALANCE_HORIZON,
 - V4L2_WHITE_BALANCE_DAYLIGHT,
 - V4L2_WHITE_BALANCE_FLASH,
 - V4L2_WHITE_BALANCE_CLOUDY,
 - V4L2_WHITE_BALANCE_SHADE.

Signed-off-by: HeungJun Kim riverful@samsung.com
Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
Acked-by: Hans de Goede hdego...@redhat.com
---
 Documentation/DocBook/media/v4l/controls.xml |   70 ++
 drivers/media/video/v4l2-ctrls.c |   17 +++
 include/linux/videodev2.h|   14 ++
 3 files changed, 101 insertions(+)

diff --git a/Documentation/DocBook/media/v4l/controls.xml 
b/Documentation/DocBook/media/v4l/controls.xml
index 612009f..e3f9277 100644
--- a/Documentation/DocBook/media/v4l/controls.xml
+++ b/Documentation/DocBook/media/v4l/controls.xml
@@ -2948,6 +2948,76 @@ camera sensor on or off, or specify its strength. Such 
band-stop filters can
 be used, for example, to filter out the fluorescent light component./entry
  /row
  rowentry/entry/row
+
+ row id=v4l2-auto-n-preset-white-balance
+   entry 
spanname=idconstantV4L2_CID_AUTO_N_PRESET_WHITE_BALANCE/constantnbsp;/entry
+   entryenumnbsp;v4l2_auto_n_preset_white_balance/entry
+ /rowrowentry spanname=descrSets white balance to automatic,
+manual or a preset. The presets determine color temperature of the light as
+a hint to the camera for white balance adjustments resulting in most accurate
+color representation. The following white balance presets are listed in order
+of increasing color temperature./entry
+ /row
+ row
+   entrytbl spanname=descr cols=2
+ tbody valign=top
+   row
+ 
entryconstantV4L2_WHITE_BALANCE_MANUAL/constantnbsp;/entry
+ entryManual white balance./entry
+   /row
+   row
+ 
entryconstantV4L2_WHITE_BALANCE_AUTO/constantnbsp;/entry
+ entryAutomatic white balance adjustments./entry
+   /row
+   row
+ 
entryconstantV4L2_WHITE_BALANCE_INCANDESCENT/constantnbsp;/entry
+ entryWhite balance setting for incandescent (tungsten) 
lighting.
+It generally cools down the colors and corresponds approximately to 
2500...3500 K
+color temperature range./entry
+   /row
+   row
+ 
entryconstantV4L2_WHITE_BALANCE_FLUORESCENT/constantnbsp;/entry
+ entryWhite balance preset for fluorescent lighting.
+It corresponds approximately to 4000...5000 K color temperature./entry
+   /row
+   row
+ 
entryconstantV4L2_WHITE_BALANCE_FLUORESCENT_H/constantnbsp;/entry
+ entryWith this setting the camera will compensate for
+fluorescent H lighting./entry
+   /row
+   row
+ 
entryconstantV4L2_WHITE_BALANCE_HORIZON/constantnbsp;/entry
+ entryWhite balance setting for horizon daylight.
+It corresponds approximately to 5000 K color temperature./entry
+   /row
+   row
+ 
entryconstantV4L2_WHITE_BALANCE_DAYLIGHT/constantnbsp;/entry
+ entryWhite balance preset for daylight (with clear sky).
+It corresponds approximately to 5000...6500 K color temperature./entry
+   /row
+   row
+ 
entryconstantV4L2_WHITE_BALANCE_FLASH/constantnbsp;/entry
+ entryWith this setting the camera will compensate for the 
flash
+light. It slightly warms up the colors and corresponds roughly to 5000...5500 K
+color temperature./entry
+   /row
+   row
+ 
entryconstantV4L2_WHITE_BALANCE_CLOUDY/constantnbsp;/entry
+ entryWhite balance preset for moderately overcast sky.
+This option corresponds approximately to 6500...8000 K color temperature
+range./entry
+   /row
+   row
+ 
entryconstantV4L2_WHITE_BALANCE_SHADE/constantnbsp;/entry
+ entryWhite balance preset for shade or heavily overcast
+sky. It corresponds approximately to 9000...1 K color temperature.
+/entry
+   /row
+ /tbody
+   /entrytbl
+ /row
+ rowentry/entry/row
+
/tbody
   /tgroup
 /table
diff --git a/drivers/media/video/v4l2-ctrls.c b/drivers/media/video/v4l2-ctrls.c
index 1d7091f..02fa9b0 100644
--- a/drivers/media/video/v4l2-ctrls.c
+++ b/drivers/media/video/v4l2-ctrls.c
@@ -243,6 +243,19 @@ const char * const *v4l2_ctrl_get_menu(u32 id)
Vivid,
  

[PATCH/RFC v4 02/12] V4L: Add camera exposure bias control

2012-05-04 Thread Sylwester Nawrocki
The camera may in some conditions incorrectly determine the exposure,
and a manual automatic exposure correction may be needed. This patch
adds V4L2_CID_AUTO_EXPOSURE_BIAS control which allows to add some
offset in the automatic exposure control loop, to compensate for
frame under- or over-exposure.

Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 Documentation/DocBook/media/v4l/controls.xml |   16 
 drivers/media/video/v4l2-ctrls.c |4 
 include/linux/videodev2.h|2 ++
 3 files changed, 22 insertions(+)

diff --git a/Documentation/DocBook/media/v4l/controls.xml 
b/Documentation/DocBook/media/v4l/controls.xml
index 5e12257..612009f 100644
--- a/Documentation/DocBook/media/v4l/controls.xml
+++ b/Documentation/DocBook/media/v4l/controls.xml
@@ -2775,6 +2775,22 @@ remain constant./entry
  rowentry/entry/row
 
  row
+   entry 
spanname=idconstantV4L2_CID_EXPOSURE_BIAS/constantnbsp;/entry
+   entryinteger menu/entry
+ /rowrowentry spanname=descr Determines the automatic
+exposure compensation, it is effective only when 
constantV4L2_CID_EXPOSURE_AUTO/constant
+control is set to constantAUTO/constant, constantSHUTTER_PRIORITY 
/constant
+or constantAPERTURE_PRIORITY/constant.
+It is expressed in terms of EV, drivers should interpret the values as 0.001 EV
+units, where the value 1000 stands for +1 EV.
+paraIncreasing the exposure compensation value is equivalent to decreasing
+the exposure value (EV) and will increase the amount of light at the image
+sensor. The camera performs the exposure compensation by adjusting absolute
+exposure time and/or aperture./para/entry
+ /row
+ rowentry/entry/row
+
+ row
entry 
spanname=idconstantV4L2_CID_PAN_RELATIVE/constantnbsp;/entry
entryinteger/entry
  /rowrowentry spanname=descrThis control turns the
diff --git a/drivers/media/video/v4l2-ctrls.c b/drivers/media/video/v4l2-ctrls.c
index e0725b5..1d7091f 100644
--- a/drivers/media/video/v4l2-ctrls.c
+++ b/drivers/media/video/v4l2-ctrls.c
@@ -597,6 +597,7 @@ const char *v4l2_ctrl_get_name(u32 id)
case V4L2_CID_PRIVACY:  return Privacy;
case V4L2_CID_IRIS_ABSOLUTE:return Iris, Absolute;
case V4L2_CID_IRIS_RELATIVE:return Iris, Relative;
+   case V4L2_CID_AUTO_EXPOSURE_BIAS:   return Auto Exposure, Bias;
 
/* FM Radio Modulator control */
/* Keep the order of the 'case's the same as in videodev2.h! */
@@ -739,6 +740,9 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum 
v4l2_ctrl_type *type,
case V4L2_CID_RDS_TX_RADIO_TEXT:
*type = V4L2_CTRL_TYPE_STRING;
break;
+   case V4L2_CID_AUTO_EXPOSURE_BIAS:
+   *type = V4L2_CTRL_TYPE_INTEGER_MENU;
+   break;
case V4L2_CID_USER_CLASS:
case V4L2_CID_CAMERA_CLASS:
case V4L2_CID_MPEG_CLASS:
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index 5a09ac3..da60cbb 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -1693,6 +1693,8 @@ enum  v4l2_exposure_auto_type {
 #define V4L2_CID_IRIS_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+17)
 #define V4L2_CID_IRIS_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+18)
 
+#define V4L2_CID_AUTO_EXPOSURE_BIAS(V4L2_CID_CAMERA_CLASS_BASE+19)
+
 /* FM Modulator class control IDs */
 #define V4L2_CID_FM_TX_CLASS_BASE  (V4L2_CTRL_CLASS_FM_TX | 0x900)
 #define V4L2_CID_FM_TX_CLASS   (V4L2_CTRL_CLASS_FM_TX | 1)
-- 
1.7.10

--
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/RFC v4 06/12] V4L: Add camera ISO sensitivity controls

2012-05-04 Thread Sylwester Nawrocki
Add ISO sensitivity and ISO auto/manual controls. The sensitivity
values are related to level of amplification of the analog signal
between image sensor and ADC. These controls allow to support sensors
exposing an interface to accept the ISO values directly.

Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 Documentation/DocBook/media/v4l/biblio.xml   |   11 
 Documentation/DocBook/media/v4l/controls.xml |   38 ++
 drivers/media/video/v4l2-ctrls.c |   11 
 include/linux/videodev2.h|7 +
 4 files changed, 67 insertions(+)

diff --git a/Documentation/DocBook/media/v4l/biblio.xml 
b/Documentation/DocBook/media/v4l/biblio.xml
index 7dc65c5..66a0ef2 100644
--- a/Documentation/DocBook/media/v4l/biblio.xml
+++ b/Documentation/DocBook/media/v4l/biblio.xml
@@ -197,4 +197,15 @@ in the frequency range from 87,5 to 108,0 MHz/title
   titleNTSC-4: United States RBDS Standard/title
 /biblioentry
 
+biblioentry id=iso12232
+  abbrevISOnbsp;12232:2006/abbrev
+  authorgroup
+   corpauthorInternational Organization for Standardization
+(ulink url=http://www.iso.org;http://www.iso.org/ulink)/corpauthor
+  /authorgroup
+  titlePhotography mdash; Digital still cameras mdash; Determination
+  of exposure index, ISO speed ratings, standard output sensitivity, and
+  recommended exposure index/title
+/biblioentry
+
   /bibliography
diff --git a/Documentation/DocBook/media/v4l/controls.xml 
b/Documentation/DocBook/media/v4l/controls.xml
index 7468267..1300901 100644
--- a/Documentation/DocBook/media/v4l/controls.xml
+++ b/Documentation/DocBook/media/v4l/controls.xml
@@ -3043,6 +3043,44 @@ control in future, if more options are 
required./para/footnote/entry
  /row
  rowentry/entry/row
 
+ row
+   entry 
spanname=idconstantV4L2_CID_ISO_SENSITIVITY/constantnbsp;/entry
+   entryinteger menu/entry
+ /rowrowentry spanname=descrDetermines ISO equivalent of an
+image sensor indicating the sensor's sensitivity to light. The numbers are
+expressed in arithmetic scale, as per xref linkend=iso12232 / standard,
+where doubling the sensor sensitivity is represented by doubling the numerical
+ISO value. Applications should interpret the values as standard ISO values
+multiplied by 1000, e.g. control value 800 stands for ISO 0.8. Drivers will
+usually support only a subset of standard ISO values. The effect of setting
+this control while the constantV4L2_CID_ISO_SENSITIVITY_AUTO/constant
+control is set to a value other than constantV4L2_CID_ISO_SENSITIVITY_MANUAL
+/constant is undefined, drivers should ignore such requests./entry
+ /row
+ rowentry/entry/row
+
+ row id=v4l2-iso-sensitivity-auto-type
+   entry 
spanname=idconstantV4L2_CID_ISO_SENSITIVITY_AUTO/constantnbsp;/entry
+   entryenumnbsp;v4l2_iso_sensitivity_type/entry
+ /rowrowentry spanname=descrEnables or disables automatic ISO
+sensitivity adjustments./entry
+ /row
+ row
+   entrytbl spanname=descr cols=2
+ tbody valign=top
+   row
+ 
entryconstantV4L2_CID_ISO_SENSITIVITY_MANUAL/constantnbsp;/entry
+ entryManual ISO sensitivity./entry
+   /row
+   row
+ 
entryconstantV4L2_CID_ISO_SENSITIVITY_AUTO/constantnbsp;/entry
+ entryAutomatic ISO sensitivity adjustments./entry
+   /row
+ /tbody
+   /entrytbl
+ /row
+ rowentry/entry/row
+
/tbody
   /tgroup
 /table
diff --git a/drivers/media/video/v4l2-ctrls.c b/drivers/media/video/v4l2-ctrls.c
index 406916a..b70226e 100644
--- a/drivers/media/video/v4l2-ctrls.c
+++ b/drivers/media/video/v4l2-ctrls.c
@@ -256,6 +256,11 @@ const char * const *v4l2_ctrl_get_menu(u32 id)
Shade,
NULL,
};
+   static const char * const camera_iso_sensitivity_auto[] = {
+   Manual,
+   Auto,
+   NULL
+   };
static const char * const tune_preemphasis[] = {
No Preemphasis,
50 Microseconds,
@@ -427,6 +432,8 @@ const char * const *v4l2_ctrl_get_menu(u32 id)
return colorfx;
case V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE:
return auto_n_preset_white_balance;
+   case V4L2_CID_ISO_SENSITIVITY_AUTO:
+   return camera_iso_sensitivity_auto;
case V4L2_CID_TUNE_PREEMPHASIS:
return tune_preemphasis;
case V4L2_CID_FLASH_LED_MODE:
@@ -616,6 +623,8 @@ const char *v4l2_ctrl_get_name(u32 id)
case V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE: return White Balance, Auto 
 Preset;
case V4L2_CID_WIDE_DYNAMIC_RANGE:   return Wide Dynamic Range;
case V4L2_CID_IMAGE_STABILIZATION:  return 

[PATCH/RFC v4 11/12] V4L: Add auto focus targets to the subdev selections API

2012-05-04 Thread Sylwester Nawrocki
Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 Documentation/DocBook/media/v4l/dev-subdev.xml |   27 +++-
 .../media/v4l/vidioc-subdev-g-selection.xml|   14 --
 include/linux/v4l2-subdev.h|4 +++
 3 files changed, 42 insertions(+), 3 deletions(-)

diff --git a/Documentation/DocBook/media/v4l/dev-subdev.xml 
b/Documentation/DocBook/media/v4l/dev-subdev.xml
index 4afcbbe..8a212c4 100644
--- a/Documentation/DocBook/media/v4l/dev-subdev.xml
+++ b/Documentation/DocBook/media/v4l/dev-subdev.xml
@@ -277,7 +277,7 @@
 /section
 
 section
-  titleSelections: cropping, scaling and composition/title
+  titleSelections - cropping, scaling and composition/title
 
   paraMany sub-devices support cropping frames on their input or output
   pads (or possible even on both). Cropping is used to select the area of
@@ -330,6 +330,31 @@
 /section
 
 section
+  titleSelections - regions of interest/title
+section
+  titleAutomatic focus/title
+
+  paraThe camera automatic focus algorithms may require configuration
+  of a region or multiple regions of interest in form of rectangle or spot
+  coordinates./para
+
+  paraA single rectangle of interest is represented in v4l2-rect;
+  by the coordinates of the top left corner and the rectangle size. Both
+  the coordinates and sizes are expressed in pixels. When the structfield
+  width/structfield and structfieldheight/structfield fields of
+  v4l2-rect; are set to 0 the selection determines spot coordinates,
+  rather than a rectangle./para
+
+  paraAuto focus rectangles are reset to their default values when the
+  output image format is modified. Drivers should use the output image size
+  as the auto focus rectangle default value, but hardware requirements may
+  prevent this.
+  /para
+  paraThe auto focus selections on input pads are not defined./para
+/section
+/section
+
+section
   titleTypes of selection targets/title
 
   section
diff --git a/Documentation/DocBook/media/v4l/vidioc-subdev-g-selection.xml 
b/Documentation/DocBook/media/v4l/vidioc-subdev-g-selection.xml
index 208e9f0..c4ccae5 100644
--- a/Documentation/DocBook/media/v4l/vidioc-subdev-g-selection.xml
+++ b/Documentation/DocBook/media/v4l/vidioc-subdev-g-selection.xml
@@ -57,8 +57,8 @@
 
 paraThe selections are used to configure various image
 processing functionality performed by the subdevs which affect the
-image size. This currently includes cropping, scaling and
-composition./para
+image size. This currently includes cropping, scaling, composition
+and automatic focus regions of interest./para
 
 paraThe selection API replaces link
 linkend=vidioc-subdev-g-cropthe old subdev crop API/link. All
@@ -114,6 +114,16 @@
entry0x0102/entry
entryBounds of the compose rectangle./entry
  /row
+ row
+   
entryconstantV4L2_SUBDEV_SEL_TGT_AUTO_FOCUS_BOUNDS/constant/entry
+   entry0x1000/entry
+   entryBounds of the automatic focus region of interest./entry
+ /row
+ row
+   
entryconstantV4L2_SUBDEV_SEL_TGT_AUTO_FOCUS_ACTUAL/constant/entry
+   entry0x1001/entry
+   entryActual automatic focus rectangle or spot coordinates./entry
+ /row
/tbody
   /tgroup
 /table
diff --git a/include/linux/v4l2-subdev.h b/include/linux/v4l2-subdev.h
index 812019e..49b1f14 100644
--- a/include/linux/v4l2-subdev.h
+++ b/include/linux/v4l2-subdev.h
@@ -136,6 +136,10 @@ struct v4l2_subdev_frame_interval_enum {
 /* composing bounds */
 #define V4L2_SUBDEV_SEL_TGT_COMPOSE_BOUNDS 0x0102
 
+/* auto focus region of interest */
+#define V4L2_SUBDEV_SEL_TGT_AUTO_FOCUS_ACTUAL  0x1000
+/* auto focus region (spot coordinates) bounds */
+#define V4L2_SUBDEV_SEL_TGT_AUTO_FOCUS_BOUNDS  0x1001
 
 /**
  * struct v4l2_subdev_selection - selection info
-- 
1.7.10

--
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/RFC v4 09/12] V4L: Add camera 3A lock control

2012-05-04 Thread Sylwester Nawrocki
The V4L2_CID_3A_LOCK bitmask control allows applications to pause
or resume the automatic exposure, focus and wite balance adjustments.
It can be used, for example, to lock the 3A adjustments right before
a still image is captured, for pre-focus, etc.
The applications can control each of the algorithms independently,
through a corresponding control bit, if driver allows that.

Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 Documentation/DocBook/media/v4l/controls.xml |   39 ++
 drivers/media/video/v4l2-ctrls.c |2 ++
 include/linux/videodev2.h|5 
 3 files changed, 46 insertions(+)

diff --git a/Documentation/DocBook/media/v4l/controls.xml 
b/Documentation/DocBook/media/v4l/controls.xml
index 88608f6..4a463d3 100644
--- a/Documentation/DocBook/media/v4l/controls.xml
+++ b/Documentation/DocBook/media/v4l/controls.xml
@@ -3227,6 +3227,45 @@ lens-distortion correction./entry
  /row
  rowentry/entry/row
 
+ row
+   entry spanname=idconstantV4L2_CID_3A_LOCK/constant/entry
+   entrybitmask/entry
+ /row
+ row
+   entry spanname=descrThis control locks or unlocks the automatic
+focus, exposure and white balance. The automatic adjustments can be paused
+independently by setting the corresponding lock bit to 1. The camera then 
retains
+the settings until the lock bit is cleared. The following lock bits are 
defined:
+/entry
+ /row
+ row
+   entrytbl spanname=descr cols=2
+ tbody valign=top
+   row
+ entryconstantV4L2_LOCK_EXPOSURE/constant/entry
+ entryAutomatic exposure adjustments lock./entry
+   /row
+   row
+ entryconstantV4L2_LOCK_WHITE_BALANCE/constant/entry
+ entryAutomatic white balance adjustments lock./entry
+   /row
+   row
+ entryconstantV4L2_LOCK_FOCUS/constant/entry
+ entryAutomatic focus lock./entry
+   /row
+ /tbody
+   /entrytbl
+ /row
+ rowentry spanname=descr
+When a given algorithm is not enabled, drivers should ignore requests
+to lock it and should return no error. An example might be an application
+setting bit constantV4L2_LOCK_WHITE_BALANCE/constant when the
+constantV4L2_CID_AUTO_WHITE_BALANCE/constant control is set to
+constantFALSE/constant. The value of this control may be changed
+by exposure, white balance or focus controls./entry
+ /row
+ rowentry/entry/row
+
/tbody
   /tgroup
 /table
diff --git a/drivers/media/video/v4l2-ctrls.c b/drivers/media/video/v4l2-ctrls.c
index 386f20c..6346978 100644
--- a/drivers/media/video/v4l2-ctrls.c
+++ b/drivers/media/video/v4l2-ctrls.c
@@ -654,6 +654,7 @@ const char *v4l2_ctrl_get_name(u32 id)
case V4L2_CID_ISO_SENSITIVITY_AUTO: return ISO Sensitivity, Auto;
case V4L2_CID_EXPOSURE_METERING:return Exposure, Metering 
Mode;
case V4L2_CID_SCENE_MODE:   return Scene Mode;
+   case V4L2_CID_3A_LOCK:  return 3A Lock;
 
/* FM Radio Modulator control */
/* Keep the order of the 'case's the same as in videodev2.h! */
@@ -826,6 +827,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum 
v4l2_ctrl_type *type,
break;
case V4L2_CID_FLASH_FAULT:
case V4L2_CID_JPEG_ACTIVE_MARKER:
+   case V4L2_CID_3A_LOCK:
*type = V4L2_CTRL_TYPE_BITMASK;
break;
case V4L2_CID_MIN_BUFFERS_FOR_CAPTURE:
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index c672c13..c1fae94 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -1744,6 +1744,11 @@ enum v4l2_scene_mode {
V4L2_SCENE_MODE_TEXT= 13,
 };
 
+#define V4L2_CID_3A_LOCK   (V4L2_CID_CAMERA_CLASS_BASE+27)
+#define V4L2_LOCK_EXPOSURE (1  0)
+#define V4L2_LOCK_WHITE_BALANCE(1  1)
+#define V4L2_LOCK_FOCUS(1  2)
+
 /* FM Modulator class control IDs */
 #define V4L2_CID_FM_TX_CLASS_BASE  (V4L2_CTRL_CLASS_FM_TX | 0x900)
 #define V4L2_CID_FM_TX_CLASS   (V4L2_CTRL_CLASS_FM_TX | 1)
-- 
1.7.10

--
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/RFC v4 12/12] V4L: Add camera auto focus controls

2012-05-04 Thread Sylwester Nawrocki
Add following auto focus controls:

 - V4L2_CID_AUTO_FOCUS_START - single-shot auto focus start
 - V4L2_CID_AUTO_FOCUS_STOP -  single-shot auto focus stop
 - V4L2_CID_AUTO_FOCUS_STATUS - automatic focus status
 - V4L2_CID_AUTO_FOCUS_AREA - automatic focus area selection
 - V4L2_CID_AUTO_FOCUS_DISTANCE - automatic focus scan range selection

Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 Documentation/DocBook/media/v4l/controls.xml |  147 +-
 drivers/media/video/v4l2-ctrls.c |   31 +-
 include/linux/videodev2.h|   25 +
 3 files changed, 200 insertions(+), 3 deletions(-)

diff --git a/Documentation/DocBook/media/v4l/controls.xml 
b/Documentation/DocBook/media/v4l/controls.xml
index 4a463d3..d8ef71e 100644
--- a/Documentation/DocBook/media/v4l/controls.xml
+++ b/Documentation/DocBook/media/v4l/controls.xml
@@ -2902,13 +2902,156 @@ negative values towards infinity. This is a write-only 
control./entry
  row
entry 
spanname=idconstantV4L2_CID_FOCUS_AUTO/constantnbsp;/entry
entryboolean/entry
- /rowrowentry spanname=descrEnables automatic focus
-adjustments. The effect of manual focus adjustments while this feature
+ /rowrowentry spanname=descrEnables continuous automatic
+focus adjustments. The effect of manual focus adjustments while this feature
 is enabled is undefined, drivers should ignore such requests./entry
  /row
  rowentry/entry/row
 
  row
+   entry 
spanname=idconstantV4L2_CID_AUTO_FOCUS_START/constantnbsp;/entry
+   entrybutton/entry
+ /rowrowentry spanname=descrStarts single auto focus process.
+The effect of setting this control when 
constantV4L2_CID_FOCUS_AUTO/constant
+is set to constantTRUE/constant (1) is undefined, drivers should ignore
+such requests./entry
+ /row
+ rowentry/entry/row
+
+ row
+   entry 
spanname=idconstantV4L2_CID_AUTO_FOCUS_STOP/constantnbsp;/entry
+   entrybutton/entry
+ /rowrowentry spanname=descrAborts automatic focusing
+started with constantV4L2_CID_AUTO_FOCUS_START/constant control. It is
+effective only when the continuous autofocus is disabled, that is when
+constantV4L2_CID_FOCUS_AUTO/constant control is set to constantFALSE
+/constant (0)./entry
+ /row
+ rowentry/entry/row
+
+ row id=v4l2-auto-focus-status
+   entry spanname=id
+ constantV4L2_CID_AUTO_FOCUS_STATUS/constantnbsp;/entry
+   entrybitmask/entry
+ /row
+ rowentry spanname=descrThe automatic focus status. This is a 
read-only
+ control./entry
+ /row
+ row
+   entrytbl spanname=descr cols=2
+ tbody valign=top
+   row
+ 
entryconstantV4L2_AUTO_FOCUS_STATUS_IDLE/constantnbsp;/entry
+ entryAutomatic focus is not active./entry
+   /row
+   row
+ 
entryconstantV4L2_AUTO_FOCUS_STATUS_BUSY/constantnbsp;/entry
+ entryAutomatic focusing is in progress./entry
+   /row
+   row
+ 
entryconstantV4L2_AUTO_FOCUS_STATUS_REACHED/constantnbsp;/entry
+ entryFocus has been reached./entry
+   /row
+   row
+ 
entryconstantV4L2_AUTO_FOCUS_STATUS_LOST/constantnbsp;/entry
+ entryFocus has been lost./entry
+   /row
+   row
+ 
entryconstantV4L2_AUTO_FOCUS_STATUS_FAILED/constantnbsp;/entry
+ entryAutomatic focus has failed, the driver will not
+ transition from this state until another action is
+ performed by an  application./entry
+   /row
+ /tbody
+   /entrytbl
+ /row
+ rowentry/entry/row
+
+ row id=v4l2-auto-focus-range
+   entry spanname=id
+ constantV4L2_CID_AUTO_FOCUS_RANGE/constantnbsp;/entry
+   entryenumnbsp;v4l2_auto_focus_range/entry
+ /row
+ rowentry spanname=descrDetermines auto focus distance range
+for which lens may be adjusted. /entry
+ /row
+ row
+   entrytbl spanname=descr cols=2
+ tbody valign=top
+   row
+ 
entryconstantV4L2_AUTO_FOCUS_RANGE_AUTO/constantnbsp;/entry
+ entryThe camera automatically selects the focus 
range./entry
+   /row
+   row
+ 
entryconstantV4L2_AUTO_FOCUS_RANGE_NORMAL/constantnbsp;/entry
+ entryThe auto focus normal distance range. It is limited
+for best auto focus algorithm performance./entry
+   /row
+   row
+ 
entryconstantV4L2_AUTO_FOCUS_RANGE_MACRO/constantnbsp;/entry
+ entryMacro (close-up) auto focus. The camera 

[PATCH/RFC v4 08/12] V4L: Add camera scene mode control

2012-05-04 Thread Sylwester Nawrocki
Add control for the scene mode feature available in image sensor
with more advanced ISP firmware. The V4L2_CID_SCENE_MODE menu
control allows to select a set of parameters or a specific image
processing and capture control algorithm optimized for common
image capture conditions.

Signed-off-by: HeungJun Kim riverful@samsung.com
Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 Documentation/DocBook/media/v4l/controls.xml |  117 ++
 drivers/media/video/v4l2-ctrls.c |   21 +
 include/linux/videodev2.h|   18 
 3 files changed, 156 insertions(+)

diff --git a/Documentation/DocBook/media/v4l/controls.xml 
b/Documentation/DocBook/media/v4l/controls.xml
index 3cd6972..88608f6 100644
--- a/Documentation/DocBook/media/v4l/controls.xml
+++ b/Documentation/DocBook/media/v4l/controls.xml
@@ -3110,6 +3110,123 @@ sensitivity adjustments./entry
  /row
  rowentry/entry/row
 
+ row id=v4l2-scene-mode
+   entry 
spanname=idconstantV4L2_CID_SCENE_MODE/constantnbsp;/entry
+   entryenumnbsp;v4l2_scene_mode/entry
+ /rowrowentry spanname=descrThis control allows to select
+scene programs as the camera automatic modes optimized for common shooting
+scenes. Within these modes the camera determines best exposure, aperture,
+focusing, light metering, white balance and equivalent sensitivity. The
+controls of those parameters are influenced by the scene mode control.
+An exact behavior in each mode is subject to the camera specification.
+
+paraWhen the scene mode feature is not used, this control should be set to
+constantV4L2_SCENE_MODE_NONE/constant to make sure the other possibly
+related controls are accessible. The following scene programs are defined:
+/para
+/entry
+ /row
+ row
+   entrytbl spanname=descr cols=2
+ tbody valign=top
+   row
+ entryconstantV4L2_SCENE_MODE_NONE/constantnbsp;/entry
+ entryThe scene mode feature is disabled./entry
+   /row
+   row
+ 
entryconstantV4L2_SCENE_MODE_BACKLIGHT/constantnbsp;/entry
+ entryBacklight. Compensates for dark shadows when light is
+ coming from behind a subject, also by automatically turning
+ on the flash./entry
+   /row
+   row
+ 
entryconstantV4L2_SCENE_MODE_BEACH_SNOW/constantnbsp;/entry
+ entryBeach and snow. This mode compensates for all-white or
+bright scenes, which tend to look gray and low contrast, when camera's 
automatic
+exposure is based on an average scene brightness. To compensate, this mode
+automatically slightly overexposes the frames. The white balance may also be
+adjusted to compensate for the fact that reflected snow looks bluish rather
+than white./entry
+   /row
+   row
+ 
entryconstantV4L2_SCENE_MODE_CANDLELIGHT/constantnbsp;/entry
+ entryCandle light. The camera generally raises the ISO
+sensitivity and lowers the shutter speed. This mode compensates for relatively
+close subject in the scene. The flash is disabled in order to preserve the
+ambiance of the light./entry
+   /row
+   row
+ 
entryconstantV4L2_SCENE_MODE_DAWN_DUSK/constantnbsp;/entry
+ entryDawn and dusk. Preserves the colors seen in low
+natural light before dusk and after down. The camera may turn off the flash,
+and automatically focus at infinity. It will usually boost saturation and
+lower the shutter speed./entry
+   /row
+   row
+ 
entryconstantV4L2_SCENE_MODE_FALL_COLORS/constantnbsp;/entry
+ entryFall colors. Increases saturation and adjusts white
+balance for color enhancement. Pictures of autumn leaves get saturated reds
+and yellows./entry
+   /row
+   row
+ 
entryconstantV4L2_SCENE_MODE_FIREWORKS/constantnbsp;/entry
+ entryFireworks. Long exposure times are used to capture
+the expanding burst of light from a firework. The camera may invoke image
+stabilization./entry
+   /row
+   row
+ 
entryconstantV4L2_SCENE_MODE_LANDSCAPE/constantnbsp;/entry
+ entryLandscape. The camera may choose a small aperture to
+provide deep depth of field and long exposure duration to help capture detail
+in dim light conditions. The focus is fixed at infinity. Suitable for distant
+and wide scenery./entry
+   /row
+   row
+ 
entryconstantV4L2_SCENE_MODE_NIGHT/constantnbsp;/entry
+ entryNight, also known as Night Landscape. Designed for low
+light conditions, it preserves detail in the dark areas without blowing out 
bright
+objects. The camera generally sets itself 

[PATCH/RFC v4 10/12] V4L: Add auto focus targets to the selections API

2012-05-04 Thread Sylwester Nawrocki
The camera automatic focus algorithms may require setting up
a spot or rectangle coordinates or multiple such parameters.

The automatic focus selection targets are introduced in order
to allow applications to query and set such coordinates. Those
selections are intended to be used together with the automatic
focus controls available in the camera control class.

Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 Documentation/DocBook/media/v4l/selection-api.xml  |   33 +++-
 .../DocBook/media/v4l/vidioc-g-selection.xml   |   11 +++
 include/linux/videodev2.h  |5 +++
 3 files changed, 48 insertions(+), 1 deletion(-)

diff --git a/Documentation/DocBook/media/v4l/selection-api.xml 
b/Documentation/DocBook/media/v4l/selection-api.xml
index b299e47..490d29a 100644
--- a/Documentation/DocBook/media/v4l/selection-api.xml
+++ b/Documentation/DocBook/media/v4l/selection-api.xml
@@ -1,6 +1,6 @@
 section id=selection-api
 
-  titleExperimental API for cropping, composing and scaling/title
+  titleExperimental selections API/title
 
   note
titleExperimental/title
@@ -9,6 +9,10 @@
 interface and may change in the future./para
   /note
 
+ section
+
+ titleImage cropping, composing and scaling/title
+
   section
 titleIntroduction/title
 
@@ -321,5 +325,32 @@ V4L2_BUF_TYPE_VIDEO_OUTPUT /constant for other 
devices/para
   /example
 
/section
+ /section
+
+   section
+ titleAutomatic focus regions of interest/title
+
+para The camera automatic focus algorithms may require configuration of
+regions of interest in form of rectangle or spot coordinates. The automatic
+focus selection targets allow applications to query and set such coordinates.
+Those selections are intended to be used together with the
+constantV4L2_CID_AUTO_FOCUS_AREA/constant link linkend=camera-controls
+camera class/link control. The constantV4L2_SEL_TGT_AUTO_FOCUS_ACTUAL
+/constant target is used for querying or setting actual spot or rectangle
+coordinates, while constantV4L2_SEL_TGT_AUTO_FOCUS_BOUNDS/constant target
+determines bounds for a single spot or rectangle.
+These selections are only effective when the constantV4L2_CID_AUTO_FOCUS_AREA
+/constantcontrol is set to constantV4L2_AUTO_FOCUS_AREA_SPOT/constant or
+constantV4L2_AUTO_FOCUS_AREA_RECTANGLE/constant. The new coordinates shall
+be accepted and applied to hardware when the focus area control value is
+changed and also during a VIDIOC-S-SELECTION; ioctl call, only when the focus
+area control is already set to required value./para
+
+para For the constantV4L2_AUTO_FOCUS_AREA_SPOT/constant case, the 
selection
+rectangle structfield width/structfield and 
structfieldheight/structfield
+are not used, i.e. shall be set to 0 by applications and ignored by drivers for
+the VIDIOC-S-SELECTION; ioctl and shall be ignored by applications for the
+VIDIOC-G-SELECTION; ioctl./para
+   /section
 
 /section
diff --git a/Documentation/DocBook/media/v4l/vidioc-g-selection.xml 
b/Documentation/DocBook/media/v4l/vidioc-g-selection.xml
index bb04eff..87df4da 100644
--- a/Documentation/DocBook/media/v4l/vidioc-g-selection.xml
+++ b/Documentation/DocBook/media/v4l/vidioc-g-selection.xml
@@ -195,6 +195,17 @@ exist no rectangle /emphasis that satisfies the 
constraints./para
 entry0x0103/entry
 entryThe active area and all padding pixels that are inserted or 
modified by hardware./entry
  /row
+ row
+entryconstantV4L2_SEL_TGT_AUTO_FOCUS_ACTUAL/constant/entry
+entry0x1000/entry
+   entryActual automatic focus rectangle or spot coordinates./entry
+ /row
+ row
+entryconstantV4L2_SEL_TGT_AUTO_FOCUS_BOUNDS/constant/entry
+entry0x1002/entry
+entryBounds of the automatic focus region of interest.
+   /entry
+ /row
/tbody
   /tgroup
 /table
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index c1fae94..6bfd6c5 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -777,6 +777,11 @@ struct v4l2_crop {
 /* Current composing area plus all padding pixels */
 #define V4L2_SEL_TGT_COMPOSE_PADDED0x0103
 
+/* Auto focus region of interest */
+#define V4L2_SEL_TGT_AUTO_FOCUS_ACTUAL 0x1000
+/* Auto focus region (spot coordinates) bounds */
+#define V4L2_SEL_TGT_AUTO_FOCUS_BOUNDS 0x1001
+
 /**
  * struct v4l2_selection - selection info
  * @type:  buffer type (do not use *_MPLANE types)
-- 
1.7.10

--
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/RFC v4 07/12] V4L: Add camera exposure metering control

2012-05-04 Thread Sylwester Nawrocki
The V4L2_CID_EXPOSURE_METERING control allows to determine
a method used by the camera for measuring the amount of light
available for automatic exposure.

Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 Documentation/DocBook/media/v4l/controls.xml |   29 ++
 drivers/media/video/v4l2-ctrls.c |   10 +
 include/linux/videodev2.h|7 +++
 3 files changed, 46 insertions(+)

diff --git a/Documentation/DocBook/media/v4l/controls.xml 
b/Documentation/DocBook/media/v4l/controls.xml
index 1300901..3cd6972 100644
--- a/Documentation/DocBook/media/v4l/controls.xml
+++ b/Documentation/DocBook/media/v4l/controls.xml
@@ -2790,6 +2790,35 @@ exposure time and/or aperture./para/entry
  /row
  rowentry/entry/row
 
+ row id=v4l2-exposure-metering
+   entry 
spanname=idconstantV4L2_CID_EXPOSURE_METERING/constantnbsp;/entry
+   entryenumnbsp;v4l2_exposure_metering/entry
+ /rowrowentry spanname=descrDetermines how the camera measures
+the amount of light available for the frame exposure. Possible values 
are:/entry
+ /row
+ row
+   entrytbl spanname=descr cols=2
+ tbody valign=top
+   row
+ 
entryconstantV4L2_EXPOSURE_METERING_AVERAGE/constantnbsp;/entry
+ entryUse the light information coming from the entire frame
+and average giving no weighting to any particular portion of the metered area.
+ /entry
+   /row
+   row
+ 
entryconstantV4L2_EXPOSURE_METERING_CENTER_WEIGHTED/constantnbsp;/entry
+ entryAverage the light information coming from the entire 
frame
+giving priority to the center of the metered area./entry
+   /row
+   row
+ 
entryconstantV4L2_EXPOSURE_METERING_SPOT/constantnbsp;/entry
+ entryMeasure only very small area at the center of the 
frame./entry
+   /row
+ /tbody
+   /entrytbl
+ /row
+ rowentry/entry/row
+
  row
entry 
spanname=idconstantV4L2_CID_PAN_RELATIVE/constantnbsp;/entry
entryinteger/entry
diff --git a/drivers/media/video/v4l2-ctrls.c b/drivers/media/video/v4l2-ctrls.c
index b70226e..350c745 100644
--- a/drivers/media/video/v4l2-ctrls.c
+++ b/drivers/media/video/v4l2-ctrls.c
@@ -230,6 +230,12 @@ const char * const *v4l2_ctrl_get_menu(u32 id)
Aperture Priority Mode,
NULL
};
+   static const char * const camera_exposure_metering[] = {
+   Average,
+   Center Weighted,
+   Spot,
+   NULL
+   };
static const char * const colorfx[] = {
None,
Black  White,
@@ -428,6 +434,8 @@ const char * const *v4l2_ctrl_get_menu(u32 id)
return camera_power_line_frequency;
case V4L2_CID_EXPOSURE_AUTO:
return camera_exposure_auto;
+   case V4L2_CID_EXPOSURE_METERING:
+   return camera_exposure_metering;
case V4L2_CID_COLORFX:
return colorfx;
case V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE:
@@ -625,6 +633,7 @@ const char *v4l2_ctrl_get_name(u32 id)
case V4L2_CID_IMAGE_STABILIZATION:  return Image Stabilization;
case V4L2_CID_ISO_SENSITIVITY:  return ISO Sensitivity;
case V4L2_CID_ISO_SENSITIVITY_AUTO: return ISO Sensitivity, Auto;
+   case V4L2_CID_EXPOSURE_METERING:return Exposure, Metering 
Mode;
 
/* FM Radio Modulator control */
/* Keep the order of the 'case's the same as in videodev2.h! */
@@ -765,6 +774,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum 
v4l2_ctrl_type *type,
case V4L2_CID_MPEG_VIDEO_MPEG4_PROFILE:
case V4L2_CID_JPEG_CHROMA_SUBSAMPLING:
case V4L2_CID_ISO_SENSITIVITY_AUTO:
+   case V4L2_CID_EXPOSURE_METERING:
*type = V4L2_CTRL_TYPE_MENU;
break;
case V4L2_CID_RDS_TX_PS_NAME:
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index 993af23..4fb1d0f 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -1719,6 +1719,13 @@ enum v4l2_iso_sensitivity_auto_type {
V4L2_ISO_SENSITIVITY_AUTO   = 1,
 };
 
+#define V4L2_CID_EXPOSURE_METERING (V4L2_CID_CAMERA_CLASS_BASE+25)
+enum v4l2_exposure_metering {
+   V4L2_EXPOSURE_METERING_AVERAGE  = 0,
+   V4L2_EXPOSURE_METERING_CENTER_WEIGHTED  = 1,
+   V4L2_EXPOSURE_METERING_SPOT = 2,
+};
+
 /* FM Modulator class control IDs */
 #define V4L2_CID_FM_TX_CLASS_BASE  (V4L2_CTRL_CLASS_FM_TX | 0x900)
 #define V4L2_CID_FM_TX_CLASS   (V4L2_CTRL_CLASS_FM_TX | 1)
-- 
1.7.10

--
To unsubscribe from this list: send the line unsubscribe 

[PATCH/RFC v4 04/12] V4L: Add camera wide dynamic range control

2012-05-04 Thread Sylwester Nawrocki
Add V4L2_CID_WIDE_DYNAMIC_RANGE camera class control for the
camera wide dynamic range (WDR, HDR) feature. This control
can be used to enable/disable wide dynamic range. It might
get converted to a menu control in future if more options
are needed.

Signed-off-by: HeungJun Kim riverful@samsung.com
Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 Documentation/DocBook/media/v4l/controls.xml |   15 +++
 drivers/media/video/v4l2-ctrls.c |2 ++
 include/linux/videodev2.h|2 ++
 3 files changed, 19 insertions(+)

diff --git a/Documentation/DocBook/media/v4l/controls.xml 
b/Documentation/DocBook/media/v4l/controls.xml
index e3f9277..0256a02 100644
--- a/Documentation/DocBook/media/v4l/controls.xml
+++ b/Documentation/DocBook/media/v4l/controls.xml
@@ -3018,6 +3018,21 @@ sky. It corresponds approximately to 9000...1 K 
color temperature.
  /row
  rowentry/entry/row
 
+ row id=v4l2-wide-dynamic-range
+   entry 
spanname=idconstantV4L2_CID_WIDE_DYNAMIC_RANGE/constant/entry
+   entryboolean/entry
+ /row
+ row
+   entry spanname=descrEnables or disables the camera's wide 
dynamic
+range feature. This feature allows to obtain clear images in situations where
+intensity of the illumination varies significantly throughout the scene, i.e.
+there are simultaneously very dark and very bright areas. It is most commonly
+realized in cameras by combining two subsequent frames with different exposure
+times. footnote id=ctypeconvpara This control may be changed to a menu
+control in future, if more options are required./para/footnote/entry
+ /row
+ rowentry/entry/row
+
/tbody
   /tgroup
 /table
diff --git a/drivers/media/video/v4l2-ctrls.c b/drivers/media/video/v4l2-ctrls.c
index 02fa9b0..8b47c05 100644
--- a/drivers/media/video/v4l2-ctrls.c
+++ b/drivers/media/video/v4l2-ctrls.c
@@ -614,6 +614,7 @@ const char *v4l2_ctrl_get_name(u32 id)
case V4L2_CID_IRIS_RELATIVE:return Iris, Relative;
case V4L2_CID_AUTO_EXPOSURE_BIAS:   return Auto Exposure, Bias;
case V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE: return White Balance, Auto 
 Preset;
+   case V4L2_CID_WIDE_DYNAMIC_RANGE:   return Wide Dynamic Range;
 
/* FM Radio Modulator control */
/* Keep the order of the 'case's the same as in videodev2.h! */
@@ -705,6 +706,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum 
v4l2_ctrl_type *type,
case V4L2_CID_MPEG_VIDEO_H264_8X8_TRANSFORM:
case V4L2_CID_MPEG_VIDEO_H264_VUI_SAR_ENABLE:
case V4L2_CID_MPEG_VIDEO_MPEG4_QPEL:
+   case V4L2_CID_WIDE_DYNAMIC_RANGE:
*type = V4L2_CTRL_TYPE_BOOLEAN;
*min = 0;
*max = *step = 1;
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index 1460419..8964ebc 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -1709,6 +1709,8 @@ enum v4l2_auto_n_preset_white_balance {
V4L2_WHITE_BALANCE_SHADE= 9,
 };
 
+#define V4L2_CID_WIDE_DYNAMIC_RANGE(V4L2_CID_CAMERA_CLASS_BASE+21)
+
 /* FM Modulator class control IDs */
 #define V4L2_CID_FM_TX_CLASS_BASE  (V4L2_CTRL_CLASS_FM_TX | 0x900)
 #define V4L2_CID_FM_TX_CLASS   (V4L2_CTRL_CLASS_FM_TX | 1)
-- 
1.7.10

--
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/RFC v4 05/12] V4L: Add camera image stabilization control

2012-05-04 Thread Sylwester Nawrocki
Add V4L2_CID_IMAGE_STABILIZATION control for the camera image
stabilization feature. This control can be used to enable/disable
image stabilization. It might get converted to a menu control
in future if more options are needed.

Signed-off-by: HeungJun Kim riverful@samsung.com
Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 Documentation/DocBook/media/v4l/controls.xml |   10 ++
 drivers/media/video/v4l2-ctrls.c |2 ++
 include/linux/videodev2.h|1 +
 3 files changed, 13 insertions(+)

diff --git a/Documentation/DocBook/media/v4l/controls.xml 
b/Documentation/DocBook/media/v4l/controls.xml
index 0256a02..7468267 100644
--- a/Documentation/DocBook/media/v4l/controls.xml
+++ b/Documentation/DocBook/media/v4l/controls.xml
@@ -3033,6 +3033,16 @@ control in future, if more options are 
required./para/footnote/entry
  /row
  rowentry/entry/row
 
+ row id=v4l2-image-stabilization
+   entry 
spanname=idconstantV4L2_CID_IMAGE_STABILIZATION/constant/entry
+   entryboolean/entry
+ /row
+ row
+   entry spanname=descrEnables or disables image stabilization.
+ footnoteref linkend=ctypeconv//entry
+ /row
+ rowentry/entry/row
+
/tbody
   /tgroup
 /table
diff --git a/drivers/media/video/v4l2-ctrls.c b/drivers/media/video/v4l2-ctrls.c
index 8b47c05..406916a 100644
--- a/drivers/media/video/v4l2-ctrls.c
+++ b/drivers/media/video/v4l2-ctrls.c
@@ -615,6 +615,7 @@ const char *v4l2_ctrl_get_name(u32 id)
case V4L2_CID_AUTO_EXPOSURE_BIAS:   return Auto Exposure, Bias;
case V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE: return White Balance, Auto 
 Preset;
case V4L2_CID_WIDE_DYNAMIC_RANGE:   return Wide Dynamic Range;
+   case V4L2_CID_IMAGE_STABILIZATION:  return Image Stabilization;
 
/* FM Radio Modulator control */
/* Keep the order of the 'case's the same as in videodev2.h! */
@@ -707,6 +708,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum 
v4l2_ctrl_type *type,
case V4L2_CID_MPEG_VIDEO_H264_VUI_SAR_ENABLE:
case V4L2_CID_MPEG_VIDEO_MPEG4_QPEL:
case V4L2_CID_WIDE_DYNAMIC_RANGE:
+   case V4L2_CID_IMAGE_STABILIZATION:
*type = V4L2_CTRL_TYPE_BOOLEAN;
*min = 0;
*max = *step = 1;
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index 8964ebc..9b5fe8a 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -1710,6 +1710,7 @@ enum v4l2_auto_n_preset_white_balance {
 };
 
 #define V4L2_CID_WIDE_DYNAMIC_RANGE(V4L2_CID_CAMERA_CLASS_BASE+21)
+#define V4L2_CID_IMAGE_STABILIZATION   (V4L2_CID_CAMERA_CLASS_BASE+22)
 
 /* FM Modulator class control IDs */
 #define V4L2_CID_FM_TX_CLASS_BASE  (V4L2_CTRL_CLASS_FM_TX | 0x900)
-- 
1.7.10

--
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/RFC v4 01/12] V4L: Add helper function for standard integer menu controls

2012-05-04 Thread Sylwester Nawrocki
This patch adds v4l2_ctrl_new_std_int_menu() helper function which can
be used in drivers for creating standard integer menu control. It is
similar to v4l2_ctrl_new_std_menu(), except it doesn't have a mask
parameter and an additional qmenu parameter allows passing an array
of signed 64-bit integers constituting the menu items.

Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 Documentation/video4linux/v4l2-controls.txt |   22 ++
 drivers/media/video/v4l2-ctrls.c|   21 +
 include/media/v4l2-ctrls.h  |   17 +
 3 files changed, 60 insertions(+)

diff --git a/Documentation/video4linux/v4l2-controls.txt 
b/Documentation/video4linux/v4l2-controls.txt
index e2492a9..c536d32 100644
--- a/Documentation/video4linux/v4l2-controls.txt
+++ b/Documentation/video4linux/v4l2-controls.txt
@@ -130,8 +130,18 @@ Menu controls are added by calling v4l2_ctrl_new_std_menu:
const struct v4l2_ctrl_ops *ops,
u32 id, s32 max, s32 skip_mask, s32 def);
 
+Or alternatively for integer menu controls, by calling 
v4l2_ctrl_new_std_int_menu:
+
+   struct v4l2_ctrl *v4l2_ctrl_new_std_int_menu(struct v4l2_ctrl_handler 
*hdl,
+   const struct v4l2_ctrl_ops *ops,
+   u32 id, s32 max, s32 def, const s64 *qmenu_int);
+
 These functions are typically called right after the v4l2_ctrl_handler_init:
 
+   static const s64 exp_bias_qmenu[] = {
+  -2, -1, 0, 1, 2
+   };
+
v4l2_ctrl_handler_init(foo-ctrl_handler, nr_of_controls);
v4l2_ctrl_new_std(foo-ctrl_handler, foo_ctrl_ops,
V4L2_CID_BRIGHTNESS, 0, 255, 1, 128);
@@ -141,6 +151,11 @@ These functions are typically called right after the 
v4l2_ctrl_handler_init:
V4L2_CID_POWER_LINE_FREQUENCY,
V4L2_CID_POWER_LINE_FREQUENCY_60HZ, 0,
V4L2_CID_POWER_LINE_FREQUENCY_DISABLED);
+   v4l2_ctrl_new_std_int_menu(foo-ctrl_handler, foo_ctrl_ops,
+   V4L2_CID_EXPOSURE_BIAS,
+   ARRAY_SIZE(exp_bias_qmenu) - 1,
+   ARRAY_SIZE(exp_bias_qmenu) / 2 - 1,
+   exp_bias_qmenu);
...
if (foo-ctrl_handler.error) {
int err = foo-ctrl_handler.error;
@@ -164,6 +179,11 @@ controls. There is no min argument since that is always 0 
for menu controls,
 and instead of a step there is a skip_mask argument: if bit X is 1, then menu
 item X is skipped.
 
+The v4l2_ctrl_new_std_int_menu function creates a new standard integer menu
+control. It differs from v4l2_ctrl_new_std_menu in that it doesn't have the
+mask argument and takes as the last argument an array of signed 64-bit
+integers that form an exact menu item list.
+
 Note that if something fails, the function will return NULL or an error and
 set ctrl_handler-error to the error code. If ctrl_handler-error was already
 set, then it will just return and do nothing. This is also true for
@@ -346,6 +366,8 @@ it to 0 means that all menu items are supported.
 You set this mask either through the v4l2_ctrl_config struct for a custom
 control, or by calling v4l2_ctrl_new_std_menu().
 
+For integer menu controls menu_skip_mask remains unused, it is set to 0
+within v4l2_ctrl_new_std_int_menu().
 
 Custom Controls
 ===
diff --git a/drivers/media/video/v4l2-ctrls.c b/drivers/media/video/v4l2-ctrls.c
index c93a979..e0725b5 100644
--- a/drivers/media/video/v4l2-ctrls.c
+++ b/drivers/media/video/v4l2-ctrls.c
@@ -1517,6 +1517,27 @@ struct v4l2_ctrl *v4l2_ctrl_new_std_menu(struct 
v4l2_ctrl_handler *hdl,
 }
 EXPORT_SYMBOL(v4l2_ctrl_new_std_menu);
 
+/* Helper function for standard integer menu controls */
+struct v4l2_ctrl *v4l2_ctrl_new_std_int_menu(struct v4l2_ctrl_handler *hdl,
+   const struct v4l2_ctrl_ops *ops,
+   u32 id, s32 max, s32 def, const s64 *qmenu_int)
+{
+   const char *name;
+   enum v4l2_ctrl_type type;
+   s32 min;
+   s32 step;
+   u32 flags;
+
+   v4l2_ctrl_fill(id, name, type, min, max, step, def, flags);
+   if (type != V4L2_CTRL_TYPE_INTEGER_MENU) {
+   handler_set_err(hdl, -EINVAL);
+   return NULL;
+   }
+   return v4l2_ctrl_new(hdl, ops, id, name, type,
+0, max, 0, def, flags, NULL, qmenu_int, NULL);
+}
+EXPORT_SYMBOL(v4l2_ctrl_new_std_int_menu);
+
 /* Add a control from another handler to this handler */
 struct v4l2_ctrl *v4l2_ctrl_add_ctrl(struct v4l2_ctrl_handler *hdl,
  struct v4l2_ctrl *ctrl)
diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h
index 8920f82..15116d2 100644
--- a/include/media/v4l2-ctrls.h
+++ b/include/media/v4l2-ctrls.h
@@ -347,6 +347,23 @@ struct v4l2_ctrl 

[PATCH V4 5/5] WL12xx: Add support for FM new features.

2012-05-04 Thread manjunatha_halli
From: Manjunatha Halli x0130...@ti.com

This patch adds below features to TI's V4l2 FM driver for Wilink
chipsets,

1) FM RX Set frequency allows to set frequency anywhere between
65.5 MHz till 108 MHz (if chip is Wilink8 then till 164.55 MHz)
2) FM RX seek caters for band switch
3) FM RX RDS AF turn ON/OFF
4) FM RX De-Emphasis mode set/get
5) FM TX Alternate Frequency set/get

Also this patch fixes below issues

1) FM audio volume gain setting
2) Default rssi level is set to 8 instead of 20
3) Issue related to audio mute/unmute
4) Enable FM RX AF support in driver
5) In wrap_around seek mode try for once

Signed-off-by: Manjunatha Halli x0130...@ti.com
---
 drivers/media/radio/wl128x/fmdrv.h|3 +-
 drivers/media/radio/wl128x/fmdrv_common.c |   38 ++---
 drivers/media/radio/wl128x/fmdrv_common.h |   28 -
 drivers/media/radio/wl128x/fmdrv_rx.c |   90 +++--
 drivers/media/radio/wl128x/fmdrv_rx.h |2 +-
 drivers/media/radio/wl128x/fmdrv_v4l2.c   |   91 +++--
 6 files changed, 215 insertions(+), 37 deletions(-)

diff --git a/drivers/media/radio/wl128x/fmdrv.h 
b/drivers/media/radio/wl128x/fmdrv.h
index d84ad9d..c806c85 100644
--- a/drivers/media/radio/wl128x/fmdrv.h
+++ b/drivers/media/radio/wl128x/fmdrv.h
@@ -150,6 +150,7 @@ struct fm_rx {
struct region_info region;  /* Current selected band */
u32 freq;   /* Current RX frquency */
u8 mute_mode;   /* Current mute mode */
+   u8 bl_flag; /* Band limit reached flag */
u8 deemphasis_mode; /* Current deemphasis mode */
/* RF dependent soft mute mode */
u8 rf_depend_mute;
@@ -203,7 +204,7 @@ struct fmtx_data {
 struct fmdev {
struct video_device *radio_dev; /* V4L2 video device pointer */
struct snd_card *card;  /* Card which holds FM mixer controls */
-   u16 asci_id;
+   u16 asic_id;
spinlock_t rds_buff_lock; /* To protect access to RDS buffer */
spinlock_t resp_skb_lock; /* To protect access to received SKB */
 
diff --git a/drivers/media/radio/wl128x/fmdrv_common.c 
b/drivers/media/radio/wl128x/fmdrv_common.c
index fcce61a..ac20556 100644
--- a/drivers/media/radio/wl128x/fmdrv_common.c
+++ b/drivers/media/radio/wl128x/fmdrv_common.c
@@ -44,20 +44,41 @@
 
 /* Region info */
 static struct region_info region_configs[] = {
+   /* Super set of all bands */
+   {
+.chanl_space = FM_CHANNEL_SPACING_200KHZ * FM_FREQ_MUL,
+.bot_freq = 65800, /* 87.5 MHz */
+.top_freq = 162550,/* 108 MHz */
+.fm_band = 0,
+},
/* Europe/US */
{
 .chanl_space = FM_CHANNEL_SPACING_200KHZ * FM_FREQ_MUL,
 .bot_freq = 87500, /* 87.5 MHz */
 .top_freq = 108000,/* 108 MHz */
-.fm_band = 0,
+.fm_band = 1,
 },
/* Japan */
{
 .chanl_space = FM_CHANNEL_SPACING_200KHZ * FM_FREQ_MUL,
 .bot_freq = 76000, /* 76 MHz */
 .top_freq = 9, /* 90 MHz */
-.fm_band = 1,
+.fm_band = 2,
 },
+   /* Russian (OIRT) band */
+   {
+   .chanl_space = FM_CHANNEL_SPACING_50KHZ * FM_FREQ_MUL_RUS,
+   .bot_freq = 65800, /* 65.8 MHz */
+   .top_freq = 74000, /* 74 MHz */
+   .fm_band = 3,
+   },
+   /* Wether Band */
+   {
+   .chanl_space = FM_CHANNEL_SPACING_50KHZ * FM_FREQ_MUL_WB,
+   .bot_freq = 162400, /* 162.4 MHz */
+   .top_freq = 162550, /* 162.55 MHz */
+   .fm_band = 4,
+   }
 };
 
 /* Band selection */
@@ -596,7 +617,6 @@ static void fm_irq_handle_flag_getcmd_resp(struct fmdev 
*fmdev)
memcpy(fmdev-irq_info.flag, skb-data, fm_evt_hdr-dlen);
 
fmdev-irq_info.flag = be16_to_cpu(fmdev-irq_info.flag);
-   fmdbg(irq: flag register(0x%x)\n, fmdev-irq_info.flag);
 
/* Continue next function in interrupt handler table */
fm_irq_call_stage(fmdev, FM_HW_MAL_FUNC_IDX);
@@ -702,7 +722,7 @@ static void fm_rdsparse_swapbytes(struct fmdev *fmdev,
 * in Dolphin they are in big endian, the parsing of the RDS data
 * is chip dependent
 */
-   if (fmdev-asci_id != 0x6350) {
+   if (fmdev-asic_id != 0x6350) {
rds_buff = rds_format-data.groupdatabuff.buff[0];
while (index + 1  FM_RX_RDS_INFO_FIELD_MAX) {
byte1 = rds_buff[index];
@@ -1353,11 +1373,13 @@ static int fm_power_up(struct fmdev *fmdev, u8 mode)
sizeof(asic_ver), asic_ver, resp_len))
goto rel;
 
+   fmdev-asic_id = be16_to_cpu(asic_id);
+
fmdbg(ASIC ID: 0x%x , ASIC Version: %d\n,
-   be16_to_cpu(asic_id), be16_to_cpu(asic_ver));
+   fmdev-asic_id, be16_to_cpu(asic_ver));
 
sprintf(fw_name, %s_%x.%d.bts, FM_FMC_FW_FILE_START,

[PATCH V4 4/5] Media: Update docs for V4L2 FM new features

2012-05-04 Thread manjunatha_halli
From: Manjunatha Halli x0130...@ti.com

The list of new features -
1) New control class for FM RX
2) New FM RX CID's - De-Emphasis filter mode and RDS AF switch
3) New FM TX CID - RDS Alternate frequency set.

Signed-off-by: Manjunatha Halli x0130...@ti.com
---
 Documentation/DocBook/media/v4l/compat.xml |3 +
 Documentation/DocBook/media/v4l/controls.xml   |   77 
 Documentation/DocBook/media/v4l/dev-rds.xml|5 +-
 .../DocBook/media/v4l/vidioc-g-ext-ctrls.xml   |7 ++
 .../DocBook/media/v4l/vidioc-s-hw-freq-seek.xml|   35 +-
 5 files changed, 124 insertions(+), 3 deletions(-)

diff --git a/Documentation/DocBook/media/v4l/compat.xml 
b/Documentation/DocBook/media/v4l/compat.xml
index bce97c5..df1f345 100644
--- a/Documentation/DocBook/media/v4l/compat.xml
+++ b/Documentation/DocBook/media/v4l/compat.xml
@@ -2311,6 +2311,9 @@ more information./para
  paraAdded FM Modulator (FM TX) Extended Control Class: 
constantV4L2_CTRL_CLASS_FM_TX/constant and their Control IDs./para
/listitem
listitem
+   paraAdded FM Receiver (FM RX) Extended Control Class: 
constantV4L2_CTRL_CLASS_FM_RX/constant and their Control IDs./para
+   /listitem
+   listitem
  paraAdded Remote Controller chapter, describing the default Remote 
Controller mapping for media devices./para
/listitem
   /orderedlist
diff --git a/Documentation/DocBook/media/v4l/controls.xml 
b/Documentation/DocBook/media/v4l/controls.xml
index b84f25e..b831dd7 100644
--- a/Documentation/DocBook/media/v4l/controls.xml
+++ b/Documentation/DocBook/media/v4l/controls.xml
@@ -3018,6 +3018,12 @@ to find receivers which can scroll strings sized as 32 x 
N or 64 x N characters.
 with steps of 32 or 64 characters. The result is it must always contain a 
string with size multiple of 32 or 64. /entry
  /row
  row
+ entry 
spanname=idconstantV4L2_CID_RDS_TX_AF_FREQ/constantnbsp;/entry
+ entryinteger/entry
+ /row
+ rowentry spanname=descrSets the RDS Alternate Frequency value 
which allows a receiver to re-tune to a different frequency providing the same 
station when the first signal becomes too weak (e.g., when moving out of 
range). /entry
+ /row
+ row
entry 
spanname=idconstantV4L2_CID_AUDIO_LIMITER_ENABLED/constantnbsp;/entry
entryboolean/entry
  /row
@@ -3146,6 +3152,77 @@ manually or automatically if set to zero. Unit, range 
and step are driver-specif
 xref linkend=en50067 / document, from CENELEC./para
 /section
 
+section id=fm-rx-controls
+  titleFM Receiver Control Reference/title
+
+  paraThe FM Receiver (FM_RX) class includes controls for common 
features of
+FM Reception capable devices./para
+
+  table pgwide=1 frame=none id=fm-rx-control-id
+  titleFM_RX Control IDs/title
+
+  tgroup cols=4
+colspec colname=c1 colwidth=1* /
+colspec colname=c2 colwidth=6* /
+colspec colname=c3 colwidth=2* /
+colspec colname=c4 colwidth=6* /
+spanspec namest=c1 nameend=c2 spanname=id /
+spanspec namest=c2 nameend=c4 spanname=descr /
+thead
+  row
+entry spanname=id align=leftID/entry
+entry align=leftType/entry
+  /rowrow rowsep=1entry spanname=descr 
align=leftDescription/entry
+  /row
+/thead
+tbody valign=top
+  rowentry/entry/row
+  row
+entry 
spanname=idconstantV4L2_CID_FM_RX_CLASS/constantnbsp;/entry
+entryclass/entry
+  /rowrowentry spanname=descrThe FM_RX class
+descriptor. Calling VIDIOC-QUERYCTRL; for this control will return a
+description of this control class./entry
+  /row
+  row
+entry 
spanname=idconstantV4L2_CID_RDS_AF_SWITCH/constantnbsp;/entry
+entryboolean/entry
+  /row
+  rowentry spanname=descrEnable or Disable the RDS Alternate 
frequency feature. When enabled the driver will decode the RDS AF field and 
tries to switch to this AF frequency once the current frequency RSSI level goes 
below the threshold. If the frequency is switched, then VIDIOC-G-FREQUENCY; 
will return the new frequency./entry
+  /row
+  row
+   entry 
spanname=idconstantV4L2_CID_TUNE_DEEMPHASIS/constantnbsp;/entry
+   entryinteger/entry
+ /row
+ row id=v4l2-deemphasisentry spanname=descrConfigures the 
de-emphasis value for reception.
+A pre-emphasis filter is applied to the broadcast to accentuate the high audio 
frequencies.
+Depending on the region, a time constant of either 50 or 75 useconds is used. 
The enumnbsp;v4l2_preemphasis
+defines possible values for pre-emphasis. Here they are:/entry
+   /rowrow
+   entrytbl spanname=descr cols=2
+ tbody valign=top
+   row
+ 

[PATCH V4 3/5] Add new CID for FM TX RDS Alternate Frequency

2012-05-04 Thread manjunatha_halli
From: Manjunatha Halli x0130...@ti.com

Signed-off-by: Manjunatha Halli x0130...@ti.com
---
 drivers/media/video/v4l2-ctrls.c |1 +
 include/linux/videodev2.h|1 +
 2 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/media/video/v4l2-ctrls.c b/drivers/media/video/v4l2-ctrls.c
index 9d7608e..610076c 100644
--- a/drivers/media/video/v4l2-ctrls.c
+++ b/drivers/media/video/v4l2-ctrls.c
@@ -608,6 +608,7 @@ const char *v4l2_ctrl_get_name(u32 id)
case V4L2_CID_RDS_TX_PTY:   return RDS Program Type;
case V4L2_CID_RDS_TX_PS_NAME:   return RDS PS Name;
case V4L2_CID_RDS_TX_RADIO_TEXT:return RDS Radio Text;
+   case V4L2_CID_RDS_TX_AF_FREQ:   return RDS Alternate 
Frequency;
case V4L2_CID_AUDIO_LIMITER_ENABLED:return Audio Limiter Feature 
Enabled;
case V4L2_CID_AUDIO_LIMITER_RELEASE_TIME: return Audio Limiter Release 
Time;
case V4L2_CID_AUDIO_LIMITER_DEVIATION:  return Audio Limiter 
Deviation;
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index 534a3f1..e7a8e96 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -1699,6 +1699,7 @@ enum  v4l2_exposure_auto_type {
 #define V4L2_CID_RDS_TX_PTY(V4L2_CID_FM_TX_CLASS_BASE + 3)
 #define V4L2_CID_RDS_TX_PS_NAME
(V4L2_CID_FM_TX_CLASS_BASE + 5)
 #define V4L2_CID_RDS_TX_RADIO_TEXT (V4L2_CID_FM_TX_CLASS_BASE + 6)
+#define V4L2_CID_RDS_TX_AF_FREQ
(V4L2_CID_FM_TX_CLASS_BASE + 7)
 
 #define V4L2_CID_AUDIO_LIMITER_ENABLED (V4L2_CID_FM_TX_CLASS_BASE + 64)
 #define V4L2_CID_AUDIO_LIMITER_RELEASE_TIME(V4L2_CID_FM_TX_CLASS_BASE + 65)
-- 
1.7.4.1

--
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 V4 1/5] WL128x: Add support for FM TX RDS

2012-05-04 Thread manjunatha_halli
From: Manjunatha Halli x0130...@ti.com

This patch adds support for following FM TX RDS features,
 1. Radio Text
 2. PS Name
 3. PI Code
 4. PTY Code.

Along with above this patch fixes few other minor issues(like
fm tx get frequency, unnecessary error messages etc).

Signed-off-by: Manjunatha Halli x0130...@ti.com
---
 drivers/media/radio/wl128x/fmdrv_common.c |   17 +++---
 drivers/media/radio/wl128x/fmdrv_common.h |   17 +++
 drivers/media/radio/wl128x/fmdrv_rx.c |2 +-
 drivers/media/radio/wl128x/fmdrv_tx.c |   41 ++---
 drivers/media/radio/wl128x/fmdrv_tx.h |3 +-
 drivers/media/radio/wl128x/fmdrv_v4l2.c   |   47 +
 6 files changed, 90 insertions(+), 37 deletions(-)

diff --git a/drivers/media/radio/wl128x/fmdrv_common.c 
b/drivers/media/radio/wl128x/fmdrv_common.c
index bf867a6..fcce61a 100644
--- a/drivers/media/radio/wl128x/fmdrv_common.c
+++ b/drivers/media/radio/wl128x/fmdrv_common.c
@@ -354,7 +354,7 @@ static void send_tasklet(unsigned long arg)
 
/* Check, is there any timeout happened to last transmitted packet */
if ((jiffies - fmdev-last_tx_jiffies)  FM_DRV_TX_TIMEOUT) {
-   fmerr(TX timeout occurred\n);
+   fmdbg(TX timeout occurred\n);
atomic_set(fmdev-tx_cnt, 1);
}
 
@@ -615,7 +615,11 @@ static void fm_irq_handle_rds_start(struct fmdev *fmdev)
 {
if (fmdev-irq_info.flag  FM_RDS_EVENT  fmdev-irq_info.mask) {
fmdbg(irq: rds threshold reached\n);
-   fmdev-irq_info.stage = FM_RDS_SEND_RDS_GETCMD_IDX;
+   /* If RSSI reached below threshold then dont get RDS data */
+   if (fmdev-irq_info.flag  FM_LEV_EVENT)
+   fmdev-irq_info.stage = FM_HW_TUNE_OP_ENDED_IDX;
+   else
+   fmdev-irq_info.stage = FM_RDS_SEND_RDS_GETCMD_IDX;
} else {
/* Continue next function in interrupt handler table */
fmdev-irq_info.stage = FM_HW_TUNE_OP_ENDED_IDX;
@@ -1129,8 +1133,9 @@ int fmc_set_freq(struct fmdev *fmdev, u32 freq_to_set)
 
 int fmc_get_freq(struct fmdev *fmdev, u32 *cur_tuned_frq)
 {
-   if (fmdev-rx.freq == FM_UNDEFINED_FREQ) {
-   fmerr(RX frequency is not set\n);
+   if (fmdev-rx.freq == FM_UNDEFINED_FREQ 
+   fmdev-tx_data.tx_frq == FM_UNDEFINED_FREQ) {
+   fmerr(RX/TX frequency is not set\n);
return -EPERM;
}
if (cur_tuned_frq == NULL) {
@@ -1144,7 +1149,7 @@ int fmc_get_freq(struct fmdev *fmdev, u32 *cur_tuned_frq)
return 0;
 
case FM_MODE_TX:
-   *cur_tuned_frq = 0; /* TODO : Change this later */
+   *cur_tuned_frq = fmdev-tx_data.tx_frq;
return 0;
 
default:
@@ -1574,6 +1579,8 @@ int fmc_prepare(struct fmdev *fmdev)
fmdev-rx.af_mode = FM_RX_RDS_AF_SWITCH_MODE_OFF;
fmdev-irq_info.retry = 0;
 
+   fmdev-tx_data.tx_frq = FM_UNDEFINED_FREQ;
+
fm_rx_reset_rds_cache(fmdev);
init_waitqueue_head(fmdev-rx.rds.read_queue);
 
diff --git a/drivers/media/radio/wl128x/fmdrv_common.h 
b/drivers/media/radio/wl128x/fmdrv_common.h
index d9b9c6c..196ff7d 100644
--- a/drivers/media/radio/wl128x/fmdrv_common.h
+++ b/drivers/media/radio/wl128x/fmdrv_common.h
@@ -48,8 +48,8 @@ struct fm_reg_table {
 #define SEARCH_LVL_SET   15
 #define BAND_SET 16
 #define MUTE_STATUS_SET  17
-#define RDS_PAUSE_LVL_SET18
-#define RDS_PAUSE_DUR_SET19
+#define AUD_PAUSE_LVL_SET18
+#define AUD_PAUSE_DUR_SET19
 #define RDS_MEM_SET  20
 #define RDS_BLK_B_SET21
 #define RDS_MSK_B_SET22
@@ -84,11 +84,12 @@ struct fm_reg_table {
 
 #define FM_POWER_MODE254
 #define FM_INTERRUPT 255
+#define STATION_VALID   123
 
 /* Transmitter API */
 
 #define CHANL_SET55
-#define CHANL_BW_SET   56
+#define SCAN_SPACING_SET 56
 #define REF_SET  57
 #define POWER_ENB_SET90
 #define POWER_ATT_SET58
@@ -103,7 +104,8 @@ struct fm_reg_table {
 #define MONO_SET 66
 #define MUTE 92
 #define MPX_LMT_ENABLE   67
-#define PI_SET   93
+#define REF_ERR_SET 93
+#define PI_SET   68
 #define ECC_SET  69
 #define PTY  70
 #define AF   71
@@ -120,6 +122,10 @@ struct fm_reg_table {
 #define TX_AUDIO_LEVEL_TEST  96
 #define TX_AUDIO_LEVEL_TEST_THRESHOLD73
 #define TX_AUDIO_INPUT_LEVEL_RANGE_SET   54
+#define TX_AUDIO_LEVEL_GET  7
+#define READ_FMANT_TUNE_VALUE104
+
+/* New FM APIs (Rx and Tx) */
 #define RX_ANTENNA_SELECT87
 #define I2C_DEV_ADDR_SET 86
 #define REF_ERR_CALIB_PARAM_SET  

[PATCH V4 0/5] [Media] Radio: Fixes and New features for FM

2012-05-04 Thread manjunatha_halli
From: Manjunatha Halli x0130...@ti.com

Mauro and the list,

This version 4 of patchset resolves the comments received from
Han's on patchset v3.

This patchset creates new control class 'V4L2_CTRL_CLASS_FM_RX' for FM RX,
introduces 2 new CID's for FM RX and and 1 new CID for FM TX. Also adds 1
field in struct v4l2_hw_freq_seek.

This patch adds few new features to TI's FM driver features
are listed below,

1) FM TX RDS Support (RT, PS, AF, PI, PTY)
2) FM RX Russian band support
3) FM RX AF set/get
4) FM RX De-emphasis mode set/get

Along with new features this patch also fixes few issues in the driver
like default rssi level for seek, unnecessory logs etc.

Manjunatha Halli (5):
  WL128x: Add support for FM TX RDS
  New control class and features for FM RX
  Add new CID for FM TX RDS Alternate Frequency
  Media: Update docs for V4L2 FM new features
  WL12xx: Add support for FM new features.

 Documentation/DocBook/media/v4l/compat.xml |3 +
 Documentation/DocBook/media/v4l/controls.xml   |   77 +++
 Documentation/DocBook/media/v4l/dev-rds.xml|5 +-
 .../DocBook/media/v4l/vidioc-g-ext-ctrls.xml   |7 +
 .../DocBook/media/v4l/vidioc-s-hw-freq-seek.xml|   35 +-
 drivers/media/radio/wl128x/fmdrv.h |3 +-
 drivers/media/radio/wl128x/fmdrv_common.c  |   55 ++--
 drivers/media/radio/wl128x/fmdrv_common.h  |   43 +-
 drivers/media/radio/wl128x/fmdrv_rx.c  |   92 ++---
 drivers/media/radio/wl128x/fmdrv_rx.h  |2 +-
 drivers/media/radio/wl128x/fmdrv_tx.c  |   41 +++
 drivers/media/radio/wl128x/fmdrv_tx.h  |3 +-
 drivers/media/radio/wl128x/fmdrv_v4l2.c|  138 +++-
 drivers/media/video/v4l2-ctrls.c   |   18 ++-
 include/linux/videodev2.h  |   20 +++-
 15 files changed, 462 insertions(+), 80 deletions(-)

-- 
1.7.4.1

--
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 V4 2/5] New control class and features for FM RX

2012-05-04 Thread manjunatha_halli
From: Manjunatha Halli x0130...@ti.com

This patch creates new ctrl class for FM RX and adds new CID's for
below FM features,
  1) De-Emphasis filter mode
  2) RDS Alternate Frequency switch

Also this patch adds a field for band selection in struct v4l2_hw_freq_seek

Signed-off-by: Manjunatha Halli x0130...@ti.com
---
 drivers/media/video/v4l2-ctrls.c |   17 ++---
 include/linux/videodev2.h|   19 ++-
 2 files changed, 32 insertions(+), 4 deletions(-)

diff --git a/drivers/media/video/v4l2-ctrls.c b/drivers/media/video/v4l2-ctrls.c
index 18015c0..9d7608e 100644
--- a/drivers/media/video/v4l2-ctrls.c
+++ b/drivers/media/video/v4l2-ctrls.c
@@ -243,8 +243,8 @@ const char * const *v4l2_ctrl_get_menu(u32 id)
Vivid,
NULL
};
-   static const char * const tune_preemphasis[] = {
-   No Preemphasis,
+   static const char * const tune_emphasis[] = {
+   None,
50 Microseconds,
75 Microseconds,
NULL,
@@ -413,7 +413,9 @@ const char * const *v4l2_ctrl_get_menu(u32 id)
case V4L2_CID_COLORFX:
return colorfx;
case V4L2_CID_TUNE_PREEMPHASIS:
-   return tune_preemphasis;
+   return tune_emphasis;
+   case V4L2_CID_TUNE_DEEMPHASIS:
+   return tune_emphasis;
case V4L2_CID_FLASH_LED_MODE:
return flash_led_mode;
case V4L2_CID_FLASH_STROBE_SOURCE:
@@ -644,6 +646,12 @@ const char *v4l2_ctrl_get_name(u32 id)
case V4L2_CID_JPEG_COMPRESSION_QUALITY: return Compression Quality;
case V4L2_CID_JPEG_ACTIVE_MARKER:   return Active Markers;
 
+   /* FM Radio Receiver control */
+   /* Keep the order of the 'case's the same as in videodev2.h! */
+   case V4L2_CID_FM_RX_CLASS:  return FM Radio Receiver 
Controls;
+   case V4L2_CID_RDS_AF_SWITCH:return RDS Alternate Frequency 
Switch;
+   case V4L2_CID_TUNE_DEEMPHASIS:  return De-Emphasis;
+
default:
return NULL;
}
@@ -688,6 +696,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum 
v4l2_ctrl_type *type,
case V4L2_CID_MPEG_VIDEO_H264_8X8_TRANSFORM:
case V4L2_CID_MPEG_VIDEO_H264_VUI_SAR_ENABLE:
case V4L2_CID_MPEG_VIDEO_MPEG4_QPEL:
+   case V4L2_CID_RDS_AF_SWITCH:
*type = V4L2_CTRL_TYPE_BOOLEAN;
*min = 0;
*max = *step = 1;
@@ -733,6 +742,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum 
v4l2_ctrl_type *type,
case V4L2_CID_MPEG_VIDEO_MPEG4_LEVEL:
case V4L2_CID_MPEG_VIDEO_MPEG4_PROFILE:
case V4L2_CID_JPEG_CHROMA_SUBSAMPLING:
+   case V4L2_CID_TUNE_DEEMPHASIS:
*type = V4L2_CTRL_TYPE_MENU;
break;
case V4L2_CID_RDS_TX_PS_NAME:
@@ -745,6 +755,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum 
v4l2_ctrl_type *type,
case V4L2_CID_FM_TX_CLASS:
case V4L2_CID_FLASH_CLASS:
case V4L2_CID_JPEG_CLASS:
+   case V4L2_CID_FM_RX_CLASS:
*type = V4L2_CTRL_TYPE_CTRL_CLASS;
/* You can neither read not write these */
*flags |= V4L2_CTRL_FLAG_READ_ONLY | V4L2_CTRL_FLAG_WRITE_ONLY;
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index c9c9a46..534a3f1 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -1137,6 +1137,7 @@ struct v4l2_ext_controls {
 #define V4L2_CTRL_CLASS_FM_TX 0x009b   /* FM Modulator control class */
 #define V4L2_CTRL_CLASS_FLASH 0x009c   /* Camera flash controls */
 #define V4L2_CTRL_CLASS_JPEG 0x009d/* JPEG-compression 
controls */
+#define V4L2_CTRL_CLASS_FM_RX 0x009e   /* FM Receiver control class */
 
 #define V4L2_CTRL_ID_MASK(0x0fff)
 #define V4L2_CTRL_ID2CLASS(id)((id)  0x0fffUL)
@@ -1782,6 +1783,13 @@ enum v4l2_jpeg_chroma_subsampling {
 #defineV4L2_JPEG_ACTIVE_MARKER_DQT (1  17)
 #defineV4L2_JPEG_ACTIVE_MARKER_DHT (1  18)
 
+/* FM Receiver class control IDs */
+#define V4L2_CID_FM_RX_CLASS_BASE  (V4L2_CTRL_CLASS_FM_RX | 0x900)
+#define V4L2_CID_FM_RX_CLASS   (V4L2_CTRL_CLASS_FM_RX | 1)
+
+#define V4L2_CID_RDS_AF_SWITCH (V4L2_CID_FM_RX_CLASS_BASE + 1)
+#define V4L2_CID_TUNE_DEEMPHASIS   (V4L2_CID_FM_RX_CLASS_BASE + 2)
+
 /*
  * T U N I N G
  */
@@ -1843,13 +1851,22 @@ struct v4l2_frequency {
__u32 reserved[8];
 };
 
+
+#define FM_BAND_TYPE_ALL   0   /* All Bands 65.8 MHz till 108 Mhz
+  or 162.55 MHz if weather band */
+#define FM_BAND_TYPE_EUROPE_US 1   /* 87.5 Mhz - 108 MHz*/
+#define FM_BAND_TYPE_JAPAN 2   /* 76 MHz - 90 MHz*/
+#define FM_BAND_TYPE_RUSSIAN   3   /* 65.8 MHz - 74 MHz*/
+#define 

Re: [PATCH V4 4/5] Media: Update docs for V4L2 FM new features

2012-05-04 Thread Hans Verkuil
Almost perfect :-)

Just a few things below and one I noticed in the first patch where you set
the maximum length of the various string controls to 0x. I wouldn't do
that: the control framework will actually allocate 2 * (maximum + 1) bytes of
memory for each string control. It wastes a lot of memory and nobody is ever
going to pass in a program name that long.

On Fri May 4 2012 22:49:01 manjunatha_ha...@ti.com wrote:
 From: Manjunatha Halli x0130...@ti.com
 
 The list of new features -
   1) New control class for FM RX
   2) New FM RX CID's - De-Emphasis filter mode and RDS AF switch
   3) New FM TX CID - RDS Alternate frequency set.
 
 Signed-off-by: Manjunatha Halli x0130...@ti.com
 ---
  Documentation/DocBook/media/v4l/compat.xml |3 +
  Documentation/DocBook/media/v4l/controls.xml   |   77 
 
  Documentation/DocBook/media/v4l/dev-rds.xml|5 +-
  .../DocBook/media/v4l/vidioc-g-ext-ctrls.xml   |7 ++
  .../DocBook/media/v4l/vidioc-s-hw-freq-seek.xml|   35 +-
  5 files changed, 124 insertions(+), 3 deletions(-)
 
 diff --git a/Documentation/DocBook/media/v4l/compat.xml 
 b/Documentation/DocBook/media/v4l/compat.xml
 index bce97c5..df1f345 100644
 --- a/Documentation/DocBook/media/v4l/compat.xml
 +++ b/Documentation/DocBook/media/v4l/compat.xml
 @@ -2311,6 +2311,9 @@ more information./para
 paraAdded FM Modulator (FM TX) Extended Control Class: 
 constantV4L2_CTRL_CLASS_FM_TX/constant and their Control IDs./para
   /listitem
   listitem
 + paraAdded FM Receiver (FM RX) Extended Control Class: 
 constantV4L2_CTRL_CLASS_FM_RX/constant and their Control IDs./para
 + /listitem
 + listitem
 paraAdded Remote Controller chapter, describing the default Remote 
 Controller mapping for media devices./para
   /listitem
/orderedlist
 diff --git a/Documentation/DocBook/media/v4l/controls.xml 
 b/Documentation/DocBook/media/v4l/controls.xml
 index b84f25e..b831dd7 100644
 --- a/Documentation/DocBook/media/v4l/controls.xml
 +++ b/Documentation/DocBook/media/v4l/controls.xml
 @@ -3018,6 +3018,12 @@ to find receivers which can scroll strings sized as 32 
 x N or 64 x N characters.
  with steps of 32 or 64 characters. The result is it must always contain a 
 string with size multiple of 32 or 64. /entry
 /row
 row
 +   entry 
 spanname=idconstantV4L2_CID_RDS_TX_AF_FREQ/constantnbsp;/entry
 +   entryinteger/entry
 +   /row
 +   rowentry spanname=descrSets the RDS Alternate Frequency value 
 which allows a receiver to re-tune to a different frequency providing the 
 same station when the first signal becomes too weak (e.g., when moving out of 
 range). /entry
 +   /row
 +   row
   entry 
 spanname=idconstantV4L2_CID_AUDIO_LIMITER_ENABLED/constantnbsp;/entry
   entryboolean/entry
 /row
 @@ -3146,6 +3152,77 @@ manually or automatically if set to zero. Unit, range 
 and step are driver-specif
  xref linkend=en50067 / document, from CENELEC./para
  /section
  
 +section id=fm-rx-controls
 +  titleFM Receiver Control Reference/title
 +
 +  paraThe FM Receiver (FM_RX) class includes controls for common 
 features of
 +FM Reception capable devices./para
 +
 +  table pgwide=1 frame=none id=fm-rx-control-id
 +  titleFM_RX Control IDs/title
 +
 +  tgroup cols=4
 +colspec colname=c1 colwidth=1* /
 +colspec colname=c2 colwidth=6* /
 +colspec colname=c3 colwidth=2* /
 +colspec colname=c4 colwidth=6* /
 +spanspec namest=c1 nameend=c2 spanname=id /
 +spanspec namest=c2 nameend=c4 spanname=descr /
 +thead
 +  row
 +entry spanname=id align=leftID/entry
 +entry align=leftType/entry
 +  /rowrow rowsep=1entry spanname=descr 
 align=leftDescription/entry
 +  /row
 +/thead
 +tbody valign=top
 +  rowentry/entry/row
 +  row
 +entry 
 spanname=idconstantV4L2_CID_FM_RX_CLASS/constantnbsp;/entry
 +entryclass/entry
 +  /rowrowentry spanname=descrThe FM_RX class
 +descriptor. Calling VIDIOC-QUERYCTRL; for this control will return a
 +description of this control class./entry
 +  /row
 +  row
 +entry 
 spanname=idconstantV4L2_CID_RDS_AF_SWITCH/constantnbsp;/entry
 +entryboolean/entry
 +  /row
 +  rowentry spanname=descrEnable or Disable the RDS Alternate 
 frequency feature. When enabled the driver will decode the RDS AF field and 
 tries to switch to this AF frequency once the current frequency RSSI level 
 goes below the threshold. If the frequency is switched, then 
 VIDIOC-G-FREQUENCY; will return the new frequency./entry

You will need to explain 'RSSI' here. It's not an abbreviation everyone will 
know.

 +  /row
 +  row
 + entry 
 

Re: [PATCH v2] add support for DeLOCK-USB-2.0-DVB-T-Receiver-61744

2012-05-04 Thread poma
On 05/04/2012 08:50 AM, Thomas Mair wrote:
 Am 04.05.2012 03:27 schrieb poma pomidorabelis...@gmail.com:

 On 05/03/2012 11:03 AM, Gianluca Gennari wrote:
 Hi poma,
 I have a 0BDA:2838 (Easycap EZTV646) and a 0BDA:2832 (no name 20x20mm
 mini DVB-T stick) and both are based on the E4000 tuner, which is not
 supported in the kernel at the moment.
 I have no idea if there are sticks with the same USB PID and the fc0012
 tuner.

 OK, second one - no name device is Realtek RTL2832U reference design**.

 First one:
 Once upon a time there was a EasyCAP…
 After while crocodile!
 …and EzCAP was born.
 http://szforwardvideo.en.alibaba.com/aboutus.html
 Obviously Easycap EZTV646 != EzCAP EzTV646

 http://www.reddit.com/r/RTLSDR/comments/s6ddo/rtlsdr_compatibility_list_v2_work_in_progress/
 ezcap EzTV646   0BDA:2838   RTL2832U/FC0012 Some revisions
 may have the E4000*
 http://i.imgur.com/mFD1X.jpg
 (Generic)   0BDa:2838   RTL2832U/E4000*
 …
 And, in addition:
 http://sdr.osmocom.org/trac/wiki/rtl-sdr
 0x0bda  0x2832  all of them Generic RTL2832U (e.g. hama nano)**
 0x0bda  0x2838  E4000   ezcap USB 2.0 DVB-T/DAB/FM dongle
 …
 Maybe?
 https://sites.google.com/site/myrtlsdr/
 EzCap EZTV646 has got RTL2832U/FC0012. However rtl-sdr must be tweaked
 to force FC0012 tuner because it has the same PID as EZTV668 (PID:
 0x2838) so running it whithout a tweak will select Elonics E4000 tuner.
 Works, not so good at filtering.
 …
 Conclusion:
 At least two devices share same vid/pid with different tuners - fc0012
 vs e4000.
 How to resolve this from a drivers perspective in a proper way?
 The handling of the different tuners of devices with the same vid/pid
 should not be a problem, because rtl28xxu driver probes for the tuner when
 the device is initialized.
 
Thanks for clarifying!
rtl28xxu.c:
…
* Probe used tuner. We need to know used tuner before demod attach
* since there is some demod params needed to set according to tuner.
…
/* check FC0012 ID register; reg=00 val=a1 */
…

 Beside,
 there is GPL'ed 'e4k' tuner source code aka 'e4000 improved'*** (Elonics
 E4000)
 by Harald Welte
 http://cgit.osmocom.org/cgit/osmo-sdr/tree/firmware/src/tuner_e4k.c
 http://sdr.osmocom.org/trac/
 http://sdr.osmocom.org/trac/wiki/rtl-sdr
 http://wiki.spench.net/wiki/RTL2832U***
 So what is missing is the e4000 tuner driver.
 
True.

 Btw i do have a list of devices that include the Rtl2832 demod. I will send
 that list on the weekend.
 
Groovy!

 Regards
 Thomas
 

regards,
poma

--
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 v2] add support for DeLOCK-USB-2.0-DVB-T-Receiver-61744

2012-05-04 Thread poma
On 05/04/2012 03:49 PM, Gianluca Gennari wrote:
 Hi poma,
 thanks for the very interesting links.
 
;)

 Il 04/05/2012 03:27, poma ha scritto:
 On 05/03/2012 11:03 AM, Gianluca Gennari wrote:
 Hi poma,
 I have a 0BDA:2838 (Easycap EZTV646) and a 0BDA:2832 (no name 20x20mm
 mini DVB-T stick) and both are based on the E4000 tuner, which is not
 supported in the kernel at the moment.
 I have no idea if there are sticks with the same USB PID and the fc0012
 tuner.

 OK, second one - no name device is Realtek RTL2832U reference design**.

 First one:
 Once upon a time there was a EasyCAP�
 After while crocodile!
 �and EzCAP was born.
 http://szforwardvideo.en.alibaba.com/aboutus.html
 Obviously Easycap EZTV646 != EzCAP EzTV646
 http://www.reddit.com/r/RTLSDR/comments/s6ddo/rtlsdr_compatibility_list_v2_work_in_progress/
 ezcap EzTV6460BDA:2838   RTL2832U/FC0012 Some revisions 
 may have the E4000*
 http://i.imgur.com/mFD1X.jpg
 (Generic)0BDa:2838   RTL2832U/E4000*
 �
 And, in addition:
 http://sdr.osmocom.org/trac/wiki/rtl-sdr
 0x0bda   0x2832  all of them Generic RTL2832U (e.g. hama nano)**
 0x0bda   0x2838  E4000   ezcap USB 2.0 DVB-T/DAB/FM dongle
 �
 Maybe?
 https://sites.google.com/site/myrtlsdr/
 
 That's it. Opening the device enclosure, I can read this on the PCB:
 EzTV668 1.0
 and it looks identical to the picture posted there.
 
Groovy!

 EzCap EZTV646 has got RTL2832U/FC0012. However rtl-sdr must be tweaked
 to force FC0012 tuner because it has the same PID as EZTV668 (PID:
 0x2838) so running it whithout a tweak will select Elonics E4000 tuner.
 Works, not so good at filtering.
 �
 Conclusion:
 At least two devices share same vid/pid with different tuners - fc0012
 vs e4000.
 How to resolve this from a drivers perspective in a proper way?
 
 This is not a big problem: the rtl2832 driver should read the tuner type
 from an internal register and load the proper module (or exit with an
 error message if the tuner is unsupported).
 
Ack, thanks!

 Beside,
 there is GPL'ed 'e4k' tuner source code aka 'e4000 improved'*** (Elonics
 E4000)
 by Harald Welte
 http://cgit.osmocom.org/cgit/osmo-sdr/tree/firmware/src/tuner_e4k.c
 http://sdr.osmocom.org/trac/
 http://sdr.osmocom.org/trac/wiki/rtl-sdr
 http://wiki.spench.net/wiki/RTL2832U***
 
 Very nice. So we should ask Harald Welte if he is willing to have his
 driver merged in the kernel.

Undoubtedly!
Please ping Thomas and Antti, accordingly.

 regards,
 poma

 
 Regards,
 Gianluca

regards,
poma
--
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


Creating a DVB-T transport stream with ffmpeg

2012-05-04 Thread Tom Pitcher
Hi all,

I'm attempting to broadcast an mpeg2 transport stream created with
ffmpeg via DVB-T. I have a modulator card with kernel driver, and have
successfully modulated (and received with a simple Hauppage DVB-T USB
device) a transport stream file I obtained from a friend. My problem
is the stream I create myself with ffmpeg (and it's mpegts options,
see link below for docs) is detected by my USB receiver's software (it
finds the channel name and reports full signal strength), but it
displays a black screen with no audio.

I used a spectrum analyser to search for the signal, and was able to
locate it and view it with sound - so I believe the problem is with
normal consumer receivers being unable to understand the stream. I
took a look at the two streams with a hex editor, and noticed my
friend's stream appears to contain a large quantity of additional data
before the media data itself starts. I also noticed that my file
browser's thumbnailer was able to generate thumbnails for the streams
I created, but was unable to for my friend's stream. I'm hoping that
my lack of a picture on the USB receiver is caused by the absence of
this additional data.

Could anyone with more knowledge of a DVB-T stream's structure shed
some light on what my ffmpeg-created stream might be missing that
upsets simple consumer receivers (I've tried a couple with identical
results)?

Many thanks for your time,
Tom

1: http://ffmpeg.org/ffmpeg.html#toc-mpegts
--
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


[GIT PULL FOR 3.5] pvrusb2 driver updates

2012-05-04 Thread Mike Isely

Mauro:

Please pull - this includes a long-awaited change courtesy of Hans 
Verkuil which finally transitions the driver to video_ioctl2.

  -Mike Isely


The following changes since commit a1ac5dc28d2b4ca78e183229f7c595ffd725241c:

  [media] gspca - sn9c20x: Change the exposure setting of Omnivision sensors 
(2012-05-03 15:29:56 -0300)

are available in the git repository at:
  git://git.linuxtv.org/mcisely/pvrusb2-20120504.git pvrusb2-merge-20120504

Hans Verkuil (1):
  pvrusb2: convert to video_ioctl2

Mike Isely (9):
  pvrusb2: Stop statically initializing reserved struct fields to zero
  pvrusb2: Clean up pvr2_hdw_get_detected_std()
  pvrusb2: Implement querystd for videodev_ioctl2
  pvrusb2: Transform video standard detection result into read-only control 
ID
  pvrusb2: Fix truncated video standard names (trivial)
  pvrusb2: Base available video standards on what hardware supports
  pvrusb2: Trivial tweak to get rid of some redundant dereferences
  pvrusb2: Get rid of obsolete code for video standard enumeration
  pvrusb2: For querystd, start with list of hardware-supported standards

 drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h |6 +-
 drivers/media/video/pvrusb2/pvrusb2-hdw.c  |  193 +---
 drivers/media/video/pvrusb2/pvrusb2-hdw.h  |9 +-
 drivers/media/video/pvrusb2/pvrusb2-v4l2.c | 1343 ++--
 4 files changed, 735 insertions(+), 816 deletions(-)

-- 

Mike Isely
isely @ isely (dot) net
PGP: 03 54 43 4D 75 E5 CC 92 71 16 01 E2 B5 F5 C1 E8
--
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: GSoC 2012 Linux-Media!

2012-05-04 Thread Hin-Tak Leung

Hi Antti,

I promised to put you in touch with some more knowledgeable people, so here they 
are. Will made a few comments during our discussions (inserted verbatim below - 
may or may not be relevant)... Please feel free to respond to Mr Cooke and/or 
write to him and Greg.


Hin-Tak

Will Cooke wrote:
 The hacks with USB stick are entirely reliant on the chips inside the stick.  
In
 this case, the demod (Realtek RTL2832U)has the ability to pass through to the
 USB bus raw 8-bit sampled RF called I/Q
 (http://zone.ni.com/devzone/cda/tut/p/id/4805).

 Once you have this raw I/Q data you can demodulate the signals and process 
them
 in software.  So it's possible to build an FM radio, an AM radio, a DAB radio,
 Ham radio, Packet radio, slow scan TV, basically anything which modulates a 
sine
 wave within the frequency range of the tuner inside the DVB stick.  Not all 
DVB
 tuners are created equal.  Some will be limited to n hundred MHz, some have a
 range as low as 50 or 60 MHz up to a few GHz.

 Chips that have this functionality AND are built in to DVB USB sticks AND cost
 less than 20 Dollars are few and far between.  So it's pretty rare to find a
 compatible USB stick, and not every USB stick can pull off this neat trick.

 There is probably scope to run a project around a single targeted DVB USB 
stick,
 but hardware support would be limited.  GNU Radio is a good tool to build the
 remodulators.  As an example real world application, how about building one of
 these sticks in to a laptop and integrating it with the audio stack.  Now my
 laptop comes with a TV tuner, an FM tuner, a DAB tuner, and so on.

 I hope that helps set the scene a little bit more.   Let me know if you need 
any
 more help.

 Cheers, Will

Will Cooke wrote:
 Hi Till!

 I am familiar with what a USB-DVB stick is, how it works, the inside of a DVB
 transport stream, and so on, but... I'm in no way an expert, and I'm in no 
way a
 developer!

 Depending on what sort of mentoring you had in mind, I would be happy to get
 involved.

 Can you let me know a little more about the project and what kind of input you
 need from me.

 Cheers, Will



Antti Palosaari wrote:

Moikka!

As I have mentioned many people already, I have got Google Summer of Code
project for the Linux-Media! It means I can do three months full time work
starting from the week 21 (21.05.2012). Originally I applied Open firmware for
ath9k_htc -project as that was listed but I added own topic for Linux-Media
related stuff and it was accepted.

It is rather much time I can spend and fix all those problems I have seen during
recent years. Schedule is first to fix all DVB USB problems and then move to
enhancing DVB CORE / frontend. I planned only general digital television stuff
since it is what I know best. But if there is some time I can likely do some
other general fixes.

Here is short description.
http://www.google-melange.com/gsoc/project/google/gsoc2012/crope/10001

I will open another thread just discussing what are the most important things
and how those should be fixed correctly.

And there is no blog yet, but sometime ago I created LinuxTV page for Google+.
Lets use it:
https://plus.google.com/u/0/11135056277089175/posts

And my mentor is Hin-Tak Leung.

regards
Antti

--
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