[patch RFC] [media] staging: solo6x10: fix | vs

2012-06-09 Thread Dan Carpenter
The test here is never true because '' was used instead of '|'.  It was
the same as:

if (status  ((116)  (117)) ...

Signed-off-by: Dan Carpenter dan.carpen...@oracle.com
---
I don't have this hardware and this one really should be tested or
checked by someone who knows the spec.  It could be that the intent was
to do:

if ((status  SOLO_IIC_STATE_TRNS) 
(status  SOLO_IIC_STATE_SIG_ERR) || ...

diff --git a/drivers/staging/media/solo6x10/i2c.c 
b/drivers/staging/media/solo6x10/i2c.c
index ef95a50..398070a 100644
--- a/drivers/staging/media/solo6x10/i2c.c
+++ b/drivers/staging/media/solo6x10/i2c.c
@@ -175,7 +175,7 @@ int solo_i2c_isr(struct solo_dev *solo_dev)
 
solo_reg_write(solo_dev, SOLO_IRQ_STAT, SOLO_IRQ_IIC);
 
-   if (status  (SOLO_IIC_STATE_TRNS  SOLO_IIC_STATE_SIG_ERR) ||
+   if (status  (SOLO_IIC_STATE_TRNS | SOLO_IIC_STATE_SIG_ERR) ||
solo_dev-i2c_id  0) {
solo_i2c_stop(solo_dev);
return -ENXIO;
--
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: question about bt8xx/bttv-audio-hook.c, tvaudio.c

2012-06-09 Thread Hans Verkuil
On Wed June 6 2012 09:06:23 Julia Lawall wrote:
 The files drivers/media/video/bt8xx/bttv-audio-hook.c and 
 drivers/media/video/tvaudio.c contain a number of occurrences of eg:
 
 mode |= V4L2_TUNER_MODE_LANG1 | V4L2_TUNER_MODE_LANG2;
 
 and
 
 if (mode  V4L2_TUNER_MODE_MONO)
 
 (both from tvaudio.c)
 
 V4L2_TUNER_MODE_LANG1 | V4L2_TUNER_MODE_LANG2 is suspicious because 
 V4L2_TUNER_MODE_LANG1 is 3 and V4L2_TUNER_MODE_LANG2 is 2, so the result 
 is just the same as V4L2_TUNER_MODE_LANG1.  Maybe 
 V4L2_TUNER_MODE_LANG1_LANG2 was intended?
 
 mode  V4L2_TUNER_MODE_MONO is suspicious because V4L2_TUNER_MODE_MONO is 
 0.  Maybe  should be ==?
 
 If  is to be changed to == everywhere, then some new code may need to be 
 constructed to account for V4L2_TUNER_MODE_LANG1_LANG2.  For example, the 
 function tda8425_setmode has ifs for the other values, but not for this 
 one.  On the other hand, the function ta8874z_setmode already uses == (or 
 rather switch), and does not take V4L2_TUNER_MODE_LANG1_LANG2 into 
 account, so perhaps it is not appropriate in this context?

I would have to analyse this more carefully, but the core issue here is that
these drivers mixup the tuner audio reception bitmask flags (V4L2_TUNER_SUB_*)
and the tuner audio modes (V4L2_TUNER_MODE_*, not a bitmask). This happened
regularly in older drivers, and apparently these two are still not fixed.

More info is here:

http://hverkuil.home.xs4all.nl/spec/media.html#vidioc-g-tuner

I can't just replace one define with another, I would need to look carefully
at the code to see what was intended.

If you find more places where this happens, then please let us know. Otherwise
this is something for us to fix.

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


[PATCH] em28xx: Make em28xx_ir_change_protocol a static function

2012-06-09 Thread Ezequiel Garcia
Signed-off-by: Ezequiel Garcia elezegar...@gmail.com
---
 drivers/media/video/em28xx/em28xx-input.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/media/video/em28xx/em28xx-input.c
b/drivers/media/video/em28xx/em28xx-input.c
index 2630b26..53cc36b 100644
--- a/drivers/media/video/em28xx/em28xx-input.c
+++ b/drivers/media/video/em28xx/em28xx-input.c
@@ -344,7 +344,7 @@ static void em28xx_ir_stop(struct rc_dev *rc)
       cancel_delayed_work_sync(ir-work);
 }

-int em28xx_ir_change_protocol(struct rc_dev *rc_dev, u64 rc_type)
+static int em28xx_ir_change_protocol(struct rc_dev *rc_dev, u64 rc_type)
 {
       int rc = 0;
       struct em28xx_IR *ir = rc_dev-priv;
--
1.7.3.4
--
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: Staging: solo6x10: New driver (staging) for Softlogic 6x10

2012-06-09 Thread Dan Carpenter
Hello Ben Collins,

The patch faa4fd2a0951: Staging: solo6x10: New driver (staging) for 
Softlogic 6x10 from Jun 17, 2010, leads to the following warning:
drivers/staging/media/solo6x10/tw28.c:352 tw2815_setup()
 warn: x |= 0

tbl_ntsc_tw2815_common[0x06] |= 0x03  (DEFAULT_HDELAY_NTSC  8);

DEFAULT_HDELAY_NTSC is less than 256 so after the shift we get:

tbl_ntsc_tw2815_common[0x06] |= 0x03  0;

Which is a noop.  There are several of these complicated noops.

drivers/staging/media/solo6x10/tw28.c:352 tw2815_setup() warn: x |= 0
drivers/staging/media/solo6x10/tw28.c:362 tw2815_setup() warn: x |= 0
drivers/staging/media/solo6x10/tw28.c:367 tw2815_setup() warn: x |= 0
drivers/staging/media/solo6x10/tw28.c:373 tw2815_setup() warn: x |= 0
drivers/staging/media/solo6x10/tw28.c:383 tw2815_setup() warn: x |= 0

regards,
dan carpenter

--
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 for v3.5] Fix VIDIOC_DQEVENT docbook entry

2012-06-09 Thread Hans Verkuil
Signed-off-by: Hans Verkuil hans.verk...@cisco.com

diff --git a/Documentation/DocBook/media/v4l/vidioc-dqevent.xml 
b/Documentation/DocBook/media/v4l/vidioc-dqevent.xml
index e8714aa..98a856f 100644
--- a/Documentation/DocBook/media/v4l/vidioc-dqevent.xml
+++ b/Documentation/DocBook/media/v4l/vidioc-dqevent.xml
@@ -89,7 +89,7 @@
  row
entry/entry
entryv4l2-event-frame-sync;/entry
-entrystructfieldframe/structfield/entry
+entrystructfieldframe_sync/structfield/entry
entryEvent data for event V4L2_EVENT_FRAME_SYNC./entry
  /row
  row
--
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: [Linaro-mm-sig] [RFC] Synchronizing access to buffers shared with dma-buf between drivers/devices

2012-06-09 Thread Clark, Rob
On Fri, Jun 8, 2012 at 3:56 PM, Erik Gilling konk...@android.com wrote:
 I guess my other thought is that implicit vs explicit is not
 mutually exclusive, though I'd guess there'd be interesting
 deadlocks to have to debug if both were in use _at the same
 time_. :-)

 I think this is an approach worth investigating.  I'd like a way to
 either opt out of implicit sync or have a way to check if a dma-buf
 has an attached fence and detach it.  Actually, that could work really
 well. Consider:

 * Each dma_buf has a single fence slot
 * on submission
   * the driver will extract the fence from the dma_buf and queue a wait on it.
   * the driver will replace that fence with it's own complettion
 fence before the job submission ioctl returns.
 * dma_buf will have two userspace ioctls:
   * DETACH: will return the fence as an FD to userspace and clear the
 fence slot in the dma_buf
   * ATTACH: takes a fence FD from userspace and attaches it to the
 dma_buf fence slot.  Returns an error if the fence slot is non-empty.

 In the android case, we can do a detach after every submission and an
 attach right before.

btw, I like this idea for implicit and explicit sync to coexist

BR,
-R
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/4] pvrusb2: Variable set but not used

2012-06-09 Thread Peter Senna Tschudin
In function pvr2_enum_input variable ret was set but not used. Tested by 
compilation only.

Signed-off-by: Peter Senna Tschudin peter.se...@gmail.com
---
 drivers/media/video/pvrusb2/pvrusb2-v4l2.c |2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/media/video/pvrusb2/pvrusb2-v4l2.c 
b/drivers/media/video/pvrusb2/pvrusb2-v4l2.c
index 7bddfae..f1e0421 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-v4l2.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-v4l2.c
@@ -226,13 +226,11 @@ static int pvr2_enum_input(struct file *file, void *priv, 
struct v4l2_input *vi)
struct v4l2_input tmp;
unsigned int cnt;
int val;
-   int ret;
 
cptr = pvr2_hdw_get_ctrl_by_id(hdw, PVR2_CID_INPUT);
 
memset(tmp, 0, sizeof(tmp));
tmp.index = vi-index;
-   ret = 0;
if (vi-index = fh-input_cnt)
return -EINVAL;
val = fh-input_map[vi-index];
-- 
1.7.10.2

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/4] pvrusb2: Variable set but not used

2012-06-09 Thread Peter Senna Tschudin
In function pvr2_queryctrl variable ret was set but not used. Tested by 
compilation only.

Signed-off-by: Peter Senna Tschudin peter.se...@gmail.com
---
 drivers/media/video/pvrusb2/pvrusb2-v4l2.c |2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/media/video/pvrusb2/pvrusb2-v4l2.c 
b/drivers/media/video/pvrusb2/pvrusb2-v4l2.c
index f1e0421..aa0cf25 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-v4l2.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-v4l2.c
@@ -554,9 +554,7 @@ static int pvr2_queryctrl(struct file *file, void *priv,
struct pvr2_hdw *hdw = fh-channel.mc_head-hdw;
struct pvr2_ctrl *cptr;
int val;
-   int ret;
 
-   ret = 0;
if (vc-id  V4L2_CTRL_FLAG_NEXT_CTRL) {
cptr = pvr2_hdw_get_ctrl_nextv4l(
hdw, (vc-id  ~V4L2_CTRL_FLAG_NEXT_CTRL));
-- 
1.7.10.2

--
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 3/4] pvrusb2: Variable set but not used

2012-06-09 Thread Peter Senna Tschudin
In function pvr2_try_ext_ctrls variable ret was set but not used. Tested by 
compilation only.

Signed-off-by: Peter Senna Tschudin peter.se...@gmail.com
---
 drivers/media/video/pvrusb2/pvrusb2-v4l2.c |2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/media/video/pvrusb2/pvrusb2-v4l2.c 
b/drivers/media/video/pvrusb2/pvrusb2-v4l2.c
index aa0cf25..fc9c2ac 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-v4l2.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-v4l2.c
@@ -701,11 +701,9 @@ static int pvr2_try_ext_ctrls(struct file *file, void 
*priv,
struct v4l2_ext_control *ctrl;
struct pvr2_ctrl *pctl;
unsigned int idx;
-   int ret;
 
/* For the moment just validate that the requested control
   actually exists. */
-   ret = 0;
for (idx = 0; idx  ctls-count; idx++) {
ctrl = ctls-controls + idx;
pctl = pvr2_hdw_get_ctrl_v4l(hdw, ctrl-id);
-- 
1.7.10.2

--
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 4/4] pvrusb2: Variable set but not used

2012-06-09 Thread Peter Senna Tschudin
In function pvr2_s_crop variable cap was set but not used. Tested by 
compilation only.

Signed-off-by: Peter Senna Tschudin peter.se...@gmail.com
---
 drivers/media/video/pvrusb2/pvrusb2-v4l2.c |2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/media/video/pvrusb2/pvrusb2-v4l2.c 
b/drivers/media/video/pvrusb2/pvrusb2-v4l2.c
index fc9c2ac..cbe4080 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-v4l2.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-v4l2.c
@@ -764,12 +764,10 @@ static int pvr2_s_crop(struct file *file, void *priv, 
struct v4l2_crop *crop)
 {
struct pvr2_v4l2_fh *fh = file-private_data;
struct pvr2_hdw *hdw = fh-channel.mc_head-hdw;
-   struct v4l2_cropcap cap;
int ret;
 
if (crop-type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
return -EINVAL;
-   cap.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
ret = pvr2_ctrl_set_value(
pvr2_hdw_get_ctrl_by_id(hdw, PVR2_CID_CROPL),
crop-c.left);
-- 
1.7.10.2

--
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] saa7146: Variable set but not used

2012-06-09 Thread Peter Senna Tschudin
In function fops_open variable type was set but not used. Tested by compilation 
only.

Signed-off-by: Peter Senna Tschudin peter.se...@gmail.com
---
 drivers/media/common/saa7146_fops.c |5 -
 1 file changed, 5 deletions(-)

diff --git a/drivers/media/common/saa7146_fops.c 
b/drivers/media/common/saa7146_fops.c
index 7d42c11..0cdbd74 100644
--- a/drivers/media/common/saa7146_fops.c
+++ b/drivers/media/common/saa7146_fops.c
@@ -198,7 +198,6 @@ static int fops_open(struct file *file)
struct saa7146_dev *dev = video_drvdata(file);
struct saa7146_fh *fh = NULL;
int result = 0;
-   enum v4l2_buf_type type;
 
DEB_EE(file:%p, dev:%s\n, file, video_device_node_name(vdev));
 
@@ -207,10 +206,6 @@ static int fops_open(struct file *file)
 
DEB_D(using: %p\n, dev);
 
-   type = vdev-vfl_type == VFL_TYPE_GRABBER
-? V4L2_BUF_TYPE_VIDEO_CAPTURE
-: V4L2_BUF_TYPE_VBI_CAPTURE;
-
/* check if an extension is registered */
if( NULL == dev-ext ) {
DEB_S(no extension registered for this device\n);
-- 
1.7.10.2

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


Janitor / newbie patches

2012-06-09 Thread Peter Senna Tschudin
Dear List,

I've sent some janitor/newbie patches and I want to know if am I doing
something wrong before continuing with more patches.

The patches I've submitted:
http://patchwork.linuxtv.org/patch/11576/

   This one was sent only to the list, I've not cc:
   Mauro Carvalho Chehab mche...@infradead.org
   Thomas Petazzoni thomas.petazz...@free-electrons.com
   Devin Heitmueller dheitmuel...@kernellabs.com
   Julia Lawall ju...@diku.dk
   Greg Kroah-Hartman gre...@suse.de

   What should I do about it?

http://patchwork.linuxtv.org/patch/11600/
http://patchwork.linuxtv.org/patch/11601/
http://patchwork.linuxtv.org/patch/11602/
http://patchwork.linuxtv.org/patch/11603/
http://patchwork.linuxtv.org/patch/11604/

[]'s

Peter


-- 
Peter Senna Tschudin
peter.se...@gmail.com
gpg id: 48274C36
--
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: hdpvr lockup with audio dropouts

2012-06-09 Thread sitten74490
-Original Message-
From: Devin Heitmueller dheitmuel...@kernellabs.com
Sent: Jun 7, 2012 8:45 PM
To: sitten74...@mypacks.net
Cc: linux-media@vger.kernel.org
Subject: Re: hdpvr lockup with audio dropouts

On Thu, Jun 7, 2012 at 7:53 PM,  sitten74...@mypacks.net wrote:
 Apparently there is a known issue where the HD-PVR cannot handle the loss of 
 audio signal over SPDIF while recording.  If this happens, the unit locks up 
 requiring it to be power cycled before it can be used again. This behavior 
 can easily be reproduced by pulling the SPDIF cable during recording.  My 
 question is this:  are there any changes that could be made to the hdpvr 
 driver that would make it more tolerant of brief audio dropouts?

Does it do this under Windows?  If it does, then call Hauppauge and
get them to fix it (and if that results in a firmware fix, then it
will help Linux too).  If it works under Windows, then we know it's
some sort of driver issue which would be needed.

It's always good when it's readily reproducible.  :-)

Devin

Well, I tested it in Windows and no, the HD-PVR does not lock up when the audio 
signal is lost.  It does pause, but when the signal comes back it resumes 
playing normally.  So if I understand you correctly, this would most likely be 
a Linux driver bug rather than a firmware problem.


--
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: Janitor / newbie patches

2012-06-09 Thread Andy Walls
Peter Senna Tschudin peter.se...@gmail.com wrote:

Dear List,

I've sent some janitor/newbie patches and I want to know if am I doing
something wrong before continuing with more patches.

The patches I've submitted:
http://patchwork.linuxtv.org/patch/11576/

   This one was sent only to the list, I've not cc:
   Mauro Carvalho Chehab mche...@infradead.org
   Thomas Petazzoni thomas.petazz...@free-electrons.com
   Devin Heitmueller dheitmuel...@kernellabs.com
   Julia Lawall ju...@diku.dk
   Greg Kroah-Hartman gre...@suse.de

   What should I do about it?

http://patchwork.linuxtv.org/patch/11600/
http://patchwork.linuxtv.org/patch/11601/
http://patchwork.linuxtv.org/patch/11602/
http://patchwork.linuxtv.org/patch/11603/
http://patchwork.linuxtv.org/patch/11604/

[]'s

Peter


-- 
Peter Senna Tschudin
peter.se...@gmail.com
gpg id: 48274C36
--
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

You need to Cc: the driver authors or maintainers.

In the case of pvrusb2, that is Mike Isley.

Regards,
Andy
--
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: [Linaro-mm-sig] [RFC] Synchronizing access to buffers shared with dma-buf between drivers/devices

2012-06-09 Thread Daniel Vetter
On Sat, Jun 9, 2012 at 12:22 AM, Erik Gilling konk...@android.com wrote:
 The current linux graphics stack does not allow synchronization
 between the GPU and a camera/video decoder.  When we've seen people
 try to support this behind the scenes, they get it wrong and introduce
 bugs that can take weeks to track down.  As stated in the previous
 email, one of our goals is to centrally manage synchronization so that
 it's easer for people bringing up a platform to get it right.

I agree that letting everyone reinvent the wheel isn't the best idea
for cross-device sync - people will just get it wrong way too often.
I'm not convinced yet that doing it with explicit sync points/fences
and in userspace is the best solution. dri2/gem all use implicit sync
points managed by the kernel in a transparent fashion, so I'm leaning
towards such a sulotion for cross-device sync, too. Imo the big upside
of such an implicitly sync'ed approach is that it massively simplifies
cross-process protocols (i.e. for the display server).

So to foster understanding of the various requirements and use-cases,
could you elaborate on the pros and cons a bit and explain why you
think explicit sync points managed by the userspace display server is
the best approach for android?

Yours, Daniel
-- 
Daniel Vetter
daniel.vet...@ffwll.ch - +41 (0) 79 364 57 48 - http://blog.ffwll.ch
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


cron job: media_tree daily build: WARNINGS

2012-06-09 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:Sat Jun  9 19:00:17 CEST 2012
git hash:5472d3f17845c4398c6a510b46855820920c2181
gcc version:  i686-linux-gcc (GCC) 4.6.3
host hardware:x86_64
host os:  3.3-6.slh.2-amd64

linux-git-arm-eabi-davinci: WARNINGS
linux-git-arm-eabi-exynos: WARNINGS
linux-git-arm-eabi-omap: WARNINGS
linux-git-i686: WARNINGS
linux-git-m32r: WARNINGS
linux-git-mips: WARNINGS
linux-git-powerpc64: WARNINGS
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: WARNINGS
linux-3.1-i686: WARNINGS
linux-3.2.1-i686: WARNINGS
linux-3.3-i686: WARNINGS
linux-3.4-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
linux-3.4-x86_64: WARNINGS
apps: WARNINGS
spec-git: WARNINGS
sparse: ERRORS

Detailed results are available here:

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

Full logs are available here:

http://www.xs4all.nl/~hverkuil/logs/Saturday.tar.bz2

The V4L-DVB specification from this daily build is here:

http://www.xs4all.nl/~hverkuil/spec/media.html
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: PWC ioctl inappropriate for device (Regression)

2012-06-09 Thread Hans de Goede

Hi,

On 06/09/2012 07:06 PM, Bernard GODARD wrote:

Dear all,

I am using a Philips Toucam Pro 2 webcam with the program qastrocam-g2
(astronomy program that use some specific functions of the PWC
driver).
I have been using this program with this camera for a long time on
different Linux distributions without a problem.

With Ubuntu 12.04, I now get a kernel oops. See bug report:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1010028

I have installed mainline kernel 3.4rc6 on my Ubuntu box to check if
the oops was fixed upstream. Now I am not getting the oops anymore


Good!

 but the IOCTL used to get/set the camera parameters are failing:



astro@saturn:~$ qastrocam-g2
init : Avifile RELEASE-0.7.48-120122-05:53-../src/configure
init : Available CPU flags: fpu vme de pse tsc msr pae mce cx8 apic
sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall
nx mmxext fxsr_opt rdtscp lm 3dnowext 3dnow rep_good nopl extd_apicid
pni cx16 la
init : 2200.00 MHz AMD Athlon(tm) 64 X2 Dual Core Processor 4200+ detected
Getting Standard: Inappropriate ioctl for device
setWhiteBalance: Inappropriate ioctl for device
getWhiteBalance: Inappropriate ioctl for device
getWhiteBalance: Inappropriate ioctl for device
VIDIOCPWCGAGC: Inappropriate ioctl for device
ioctl (VIDIOCGWIN): Inappropriate ioctl for device
mmap: Invalid argument
VIDIOCPWCGDYNNOISE: Inappropriate ioctl for device
VIDIOCPWCGCONTOUR: Inappropriate ioctl for device
VIDIOCPWCSCONTOUR: Inappropriate ioctl for device
VIDIOCPWCGDYNNOISE: Inappropriate ioctl for device
VIDIOCPWCGCONTOUR: Inappropriate ioctl for device
VIDIOCPWCGDYNNOISE: Inappropriate ioctl for device
VIDIOCPWCGAGC: Inappropriate ioctl for device
VIDIOCPWCSAGC: Inappropriate ioctl for device
getWhiteBalance: Inappropriate ioctl for device
VIDIOCPWCSAGC: Inappropriate ioctl for device
VIDIOCPWCSSHUTTER: Inappropriate ioctl for device
VIDIOCPWCGAGC: Inappropriate ioctl for device
getWhiteBalance: Inappropriate ioctl for device
VIDIOCPWCGAGC: Inappropriate ioctl for device
VIDIOCPWCGAGC: Inappropriate ioctl for device
VIDIOCPWCGAGC: Inappropriate ioctl for device
VIDIOCPWCGAGC: Inappropriate ioctl for device
VIDIOCPWCGAGC: Inappropriate ioctl for device
VIDIOCPWCGAGC: Inappropriate ioctl for device
VIDIOCPWCGAGC: Inappropriate ioctl for device
VIDIOCPWCGAGC: Inappropriate ioctl for device
VIDIOCPWCGAGC: Inappropriate ioctl for device
VIDIOCPWCGAGC: Inappropriate ioctl for device
VIDIOCPWCGAGC: Inappropriate ioctl for device
VIDIOCPWCGAGC: Inappropriate ioctl for device
VIDIOCPWCGAGC: Inappropriate ioctl for device
VIDIOCPWCGAGC: Inappropriate ioctl for device
VIDIOCPWCGAGC: Inappropriate ioctl for device
VIDIOCPWCGAGC: Inappropriate ioctl for device
VIDIOCPWCGAGC: Inappropriate ioctl for device
VIDIOCPWCGAGC: Inappropriate ioctl for device
VIDIOCPWCGAGC: Inappropriate ioctl for device


As the names of the ioctls imply these are (were) custom pwc
ioctls, these were added in the v4l1 days as the v4l1 api did not
have a way to expose the desired functionality in a standard manner.

Support for the v4l1 API has been removed a number of kernel releases
ago and at the same time the pwc specific ioctls have been marked
as deprecated. And with kernel 3.2 they have finally been removed.

The same results can be achieved with the standard v4l2
VIDIOC_S_CTRL and VIDIOC_G_CTRL ioctls. I'm sorry to hear that the
removal of the custom pwc ioctls is causing problems for you, but
we really don't want to have any unneeded driver specific ioctls
with v4l2 devices.

So the qastrocam-g2 program needs to be modified to use the standard
controls interface to modify these settings on newer kernels.

Can you please send a bug report to qastrocam-g2 about this and add
me in the CC ?

Thanks,

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: question about bt8xx/bttv-audio-hook.c, tvaudio.c

2012-06-09 Thread Daniel Glöckner
On Sat, Jun 09, 2012 at 10:05:16AM +0200, Hans Verkuil wrote:
 On Wed June 6 2012 09:06:23 Julia Lawall wrote:
  The files drivers/media/video/bt8xx/bttv-audio-hook.c and 
  drivers/media/video/tvaudio.c contain a number of occurrences of eg:
  
  mode |= V4L2_TUNER_MODE_LANG1 | V4L2_TUNER_MODE_LANG2;
  
  and
  
  if (mode  V4L2_TUNER_MODE_MONO)
  
  (both from tvaudio.c)
 
 I would have to analyse this more carefully, but the core issue here is that
 these drivers mixup the tuner audio reception bitmask flags (V4L2_TUNER_SUB_*)
 and the tuner audio modes (V4L2_TUNER_MODE_*, not a bitmask). This happened
 regularly in older drivers, and apparently these two are still not fixed.
 
 More info is here:
 
 http://hverkuil.home.xs4all.nl/spec/media.html#vidioc-g-tuner
 
 I can't just replace one define with another, I would need to look carefully
 at the code to see what was intended.

I have an old patch on one of my other machines that should fix this
in tvaudio.c. I'll try to clean it up.

  Daniel
--
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] pms: fix build error in pms_probe()

2012-06-09 Thread Fengguang Wu
Mauro,

If possible, I'd prefer folding this patch into commit 8173090acb33
(v4l: fix compiler warnings), which introduced the build error.
Thank you!

drivers/media/video/pms.c: In function ‘pms_probe’:
drivers/media/video/pms.c:1047:2: error: implicit declaration of function 
‘kzalloc’ [-Werror=implicit-function-declaration]
drivers/media/video/pms.c:1116:2: error: implicit declaration of function 
‘kfree’ [-Werror=implicit-function-declaration]

Signed-off-by: Fengguang Wu fengguang...@intel.com
---
 drivers/media/video/pms.c |1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/video/pms.c b/drivers/media/video/pms.c
index af2d908..77f9c92 100644
--- a/drivers/media/video/pms.c
+++ b/drivers/media/video/pms.c
@@ -26,6 +26,7 @@
 #include linux/fs.h
 #include linux/kernel.h
 #include linux/mm.h
+#include linux/slab.h
 #include linux/ioport.h
 #include linux/init.h
 #include linux/mutex.h
-- 
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


Some tvaudio fixes

2012-06-09 Thread Daniel Glöckner
This patchset is made up of changes I did to the tvaudio driver
back in 2009. IIRC I started these to get automatic mono/stereo
swiching working again in mplayer. These changes have been tested
with a TDA9873H only and most of the time there was stereo. The
last patch is just a few hours old and has received no testing at
all.

  Daniel
  
 [PATCH 1/9] tvaudio: fix TDA9873 constants
 [PATCH 2/9] tvaudio: fix tda8425_setmode
 [PATCH 3/9] tvaudio: use V4L2_TUNER_MODE_SAP for TDA985x SAP
 [PATCH 4/9] tvaudio: remove watch_stereo
 [PATCH 5/9] tvaudio: don't use thread for TA8874Z
 [PATCH 6/9] tvaudio: use V4L2_TUNER_SUB_* for bitfields
 [PATCH 7/9] tvaudio: obey V4L2 tuner audio matrix
 [PATCH 8/9] tvaudio: support V4L2_TUNER_MODE_LANG1_LANG2
 [PATCH 9/9] tvaudio: don't report mono when stereo is received

 drivers/media/video/tvaudio.c |  189 +++--
 1 files changed, 107 insertions(+), 82 deletions(-)

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/9] tvaudio: fix TDA9873 constants

2012-06-09 Thread Daniel Glöckner
These constants were unused so far but need | instead of .

Signed-off-by: Daniel Glöckner daniel...@gmx.net
---
 drivers/media/video/tvaudio.c |   10 +-
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/media/video/tvaudio.c b/drivers/media/video/tvaudio.c
index c5b1a73..9b85e2a 100644
--- a/drivers/media/video/tvaudio.c
+++ b/drivers/media/video/tvaudio.c
@@ -583,7 +583,7 @@ static void tda985x_setmode(struct CHIPSTATE *chip, int 
mode)
 #define TDA9873_TR_MASK (7  2)
 #define TDA9873_TR_MONO 4
 #define TDA9873_TR_STEREO   1  4
-#define TDA9873_TR_REVERSE  (1  3)  (1  2)
+#define TDA9873_TR_REVERSE  ((1  3) | (1  2))
 #define TDA9873_TR_DUALA1  2
 #define TDA9873_TR_DUALB1  3
 
@@ -653,11 +653,11 @@ static void tda985x_setmode(struct CHIPSTATE *chip, int 
mode)
 #define TDA9873_MOUT_DUALA  0
 #define TDA9873_MOUT_DUALB  1  3
 #define TDA9873_MOUT_ST 1  4
-#define TDA9873_MOUT_EXTM   (1  4 )  (1  3)
+#define TDA9873_MOUT_EXTM   ((1  4) | (1  3))
 #define TDA9873_MOUT_EXTL   1  5
-#define TDA9873_MOUT_EXTR   (1  5 )  (1  3)
-#define TDA9873_MOUT_EXTLR  (1  5 )  (1  4)
-#define TDA9873_MOUT_MUTE   (1  5 )  (1  4)  (1  3)
+#define TDA9873_MOUT_EXTR   ((1  5) | (1  3))
+#define TDA9873_MOUT_EXTLR  ((1  5) | (1  4))
+#define TDA9873_MOUT_MUTE   ((1  5) | (1  4) | (1  3))
 
 /* Status bits: (chip read) */
 #define TDA9873_PONR0 /* Power-on reset detected if = 1 */
-- 
1.7.0.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


[PATCH 6/9] tvaudio: use V4L2_TUNER_SUB_* for bitfields

2012-06-09 Thread Daniel Glöckner
The V4L2_TUNER_MODE_* constants are not suited for use in bitfields.

Signed-off-by: Daniel Glöckner daniel...@gmx.net
---
 drivers/media/video/tvaudio.c |   63 +---
 1 files changed, 27 insertions(+), 36 deletions(-)

diff --git a/drivers/media/video/tvaudio.c b/drivers/media/video/tvaudio.c
index 0e77d49..58a0e9c 100644
--- a/drivers/media/video/tvaudio.c
+++ b/drivers/media/video/tvaudio.c
@@ -315,13 +315,13 @@ static int chip_thread(void *data)
 
chip-prevmode = mode;
 
-   if (mode  V4L2_TUNER_MODE_STEREO)
+   if (mode  V4L2_TUNER_SUB_STEREO)
desc-setmode(chip, V4L2_TUNER_MODE_STEREO);
-   if (mode  V4L2_TUNER_MODE_LANG1_LANG2)
+   if (mode  V4L2_TUNER_SUB_LANG1_LANG2)
desc-setmode(chip, V4L2_TUNER_MODE_STEREO);
-   else if (mode  V4L2_TUNER_MODE_LANG1)
+   else if (mode  V4L2_SUB_MODE_LANG1)
desc-setmode(chip, V4L2_TUNER_MODE_LANG1);
-   else if (mode  V4L2_TUNER_MODE_LANG2)
+   else if (mode  V4L2_SUB_MODE_LANG2)
desc-setmode(chip, V4L2_TUNER_MODE_LANG2);
else
desc-setmode(chip, V4L2_TUNER_MODE_MONO);
@@ -363,11 +363,11 @@ static int tda9840_getmode(struct CHIPSTATE *chip)
int val, mode;
 
val = chip_read(chip);
-   mode = V4L2_TUNER_MODE_MONO;
+   mode = V4L2_TUNER_SUB_MONO;
if (val  TDA9840_DS_DUAL)
-   mode |= V4L2_TUNER_MODE_LANG1 | V4L2_TUNER_MODE_LANG2;
+   mode |= V4L2_TUNER_SUB_LANG1 | V4L2_TUNER_SUB_LANG2;
if (val  TDA9840_ST_STEREO)
-   mode |= V4L2_TUNER_MODE_STEREO;
+   mode |= V4L2_TUNER_SUB_STEREO;
 
v4l2_dbg(1, debug, sd, tda9840_getmode(): raw chip read: %d, return: 
%d\n,
val, mode);
@@ -514,13 +514,17 @@ static int tda9855_treble(int val) { return 
(val/0x1c71+0x3)1; }
 
 static int  tda985x_getmode(struct CHIPSTATE *chip)
 {
-   int mode;
+   int mode, val;
 
-   mode = ((TDA985x_STP | TDA985x_SAPP) 
-   chip_read(chip))  4;
/* Add mono mode regardless of SAP and stereo */
/* Allows forced mono */
-   return mode | V4L2_TUNER_MODE_MONO;
+   mode = V4L2_TUNER_SUB_MONO;
+   val = chip_read(chip);
+   if (val  TDA985x_STP)
+   mode |= V4L2_TUNER_SUB_STEREO;
+   if (val  TDA985x_SAPP)
+   mode |= V4L2_TUNER_SUB_SAP;
+   return mode;
 }
 
 static void tda985x_setmode(struct CHIPSTATE *chip, int mode)
@@ -670,11 +674,11 @@ static int tda9873_getmode(struct CHIPSTATE *chip)
int val,mode;
 
val = chip_read(chip);
-   mode = V4L2_TUNER_MODE_MONO;
+   mode = V4L2_TUNER_SUB_MONO;
if (val  TDA9873_STEREO)
-   mode |= V4L2_TUNER_MODE_STEREO;
+   mode |= V4L2_TUNER_SUB_STEREO;
if (val  TDA9873_DUAL)
-   mode |= V4L2_TUNER_MODE_LANG1 | V4L2_TUNER_MODE_LANG2;
+   mode |= V4L2_TUNER_SUB_LANG1 | V4L2_TUNER_SUB_LANG2;
v4l2_dbg(1, debug, sd, tda9873_getmode(): raw chip read: %d, return: 
%d\n,
val, mode);
return mode;
@@ -865,7 +869,7 @@ static int tda9874a_getmode(struct CHIPSTATE *chip)
int dsr,nsr,mode;
int necr; /* just for debugging */
 
-   mode = V4L2_TUNER_MODE_MONO;
+   mode = V4L2_TUNER_SUB_MONO;
 
if(-1 == (dsr = chip_read2(chip,TDA9874A_DSR)))
return mode;
@@ -888,14 +892,14 @@ static int tda9874a_getmode(struct CHIPSTATE *chip)
 * external 4052 multiplexer in audio_hook().
 */
if(nsr  0x02) /* NSR.S/MB=1 */
-   mode |= V4L2_TUNER_MODE_STEREO;
+   mode |= V4L2_TUNER_SUB_STEREO;
if(nsr  0x01) /* NSR.D/SB=1 */
-   mode |= V4L2_TUNER_MODE_LANG1 | V4L2_TUNER_MODE_LANG2;
+   mode |= V4L2_TUNER_SUB_LANG1 | V4L2_TUNER_SUB_LANG2;
} else {
if(dsr  0x02) /* DSR.IDSTE=1 */
-   mode |= V4L2_TUNER_MODE_STEREO;
+   mode |= V4L2_TUNER_SUB_STEREO;
if(dsr  0x04) /* DSR.IDDUA=1 */
-   mode |= V4L2_TUNER_MODE_LANG1 | V4L2_TUNER_MODE_LANG2;
+   mode |= V4L2_TUNER_SUB_LANG1 | V4L2_TUNER_SUB_LANG2;
}
 
v4l2_dbg(1, debug, sd, tda9874a_getmode(): DSR=0x%X, NSR=0x%X, 
NECR=0x%X, return: %d.\n,
@@ -1306,11 +1310,11 @@ static int ta8874z_getmode(struct CHIPSTATE *chip)
int val, mode;
 
val = chip_read(chip);
-   mode = V4L2_TUNER_MODE_MONO;
+   mode = V4L2_TUNER_SUB_MONO;
if (val  TA8874Z_B1){
-   mode |= V4L2_TUNER_MODE_LANG1 | V4L2_TUNER_MODE_LANG2;
+   mode |= V4L2_TUNER_SUB_LANG1 | V4L2_TUNER_SUB_LANG2;
}else if (!(val  TA8874Z_B0)){

[PATCH 7/9] tvaudio: obey V4L2 tuner audio matrix

2012-06-09 Thread Daniel Glöckner
V4L2 specifies the audio mode to use for combinations of possible
(rxsubchans) and requested (audmode) audio modes. Up to now tvaudio
has made these decisions automatically based on the possible audio
modes from setting of the frequency until VIDIOC_S_TUNER was called.
It then forced the hardware to use the mode requested by the user.
With this patch it continues to adjust the audio mode while taking
the requested mode into account.

Signed-off-by: Daniel Glöckner daniel...@gmx.net
---
 drivers/media/video/tvaudio.c |   61 +---
 1 files changed, 32 insertions(+), 29 deletions(-)

diff --git a/drivers/media/video/tvaudio.c b/drivers/media/video/tvaudio.c
index 58a0e9c..04ebdfe 100644
--- a/drivers/media/video/tvaudio.c
+++ b/drivers/media/video/tvaudio.c
@@ -118,7 +118,7 @@ struct CHIPSTATE {
audiocmd   shadow;
 
/* current settings */
-   __u16 left,right,treble,bass,muted,mode;
+   __u16 left, right, treble, bass, muted;
int prevmode;
int radio;
int input;
@@ -287,7 +287,7 @@ static int chip_thread(void *data)
struct CHIPSTATE *chip = data;
struct CHIPDESC  *desc = chip-desc;
struct v4l2_subdev *sd = chip-sd;
-   int mode;
+   int mode, selected;
 
v4l2_dbg(1, debug, sd, thread started\n);
set_freezable();
@@ -301,8 +301,8 @@ static int chip_thread(void *data)
break;
v4l2_dbg(1, debug, sd, thread wakeup\n);
 
-   /* don't do anything for radio or if mode != auto */
-   if (chip-radio || chip-mode != 0)
+   /* don't do anything for radio */
+   if (chip-radio)
continue;
 
/* have a look what's going on */
@@ -315,16 +315,27 @@ static int chip_thread(void *data)
 
chip-prevmode = mode;
 
-   if (mode  V4L2_TUNER_SUB_STEREO)
-   desc-setmode(chip, V4L2_TUNER_MODE_STEREO);
-   if (mode  V4L2_TUNER_SUB_LANG1_LANG2)
-   desc-setmode(chip, V4L2_TUNER_MODE_STEREO);
-   else if (mode  V4L2_SUB_MODE_LANG1)
-   desc-setmode(chip, V4L2_TUNER_MODE_LANG1);
-   else if (mode  V4L2_SUB_MODE_LANG2)
-   desc-setmode(chip, V4L2_TUNER_MODE_LANG2);
-   else
-   desc-setmode(chip, V4L2_TUNER_MODE_MONO);
+   selected = V4L2_TUNER_MODE_MONO;
+   switch (chip-audmode) {
+   case V4L2_TUNER_MODE_MONO:
+   if (mode  V4L2_TUNER_SUB_LANG1)
+   selected = V4L2_TUNER_MODE_LANG1;
+   break;
+   case V4L2_TUNER_MODE_STEREO:
+   case V4L2_TUNER_MODE_LANG1:
+   if (mode  V4L2_TUNER_SUB_LANG1)
+   selected = V4L2_TUNER_MODE_LANG1;
+   else if (mode  V4L2_TUNER_SUB_STEREO)
+   selected = V4L2_TUNER_MODE_STEREO;
+   break;
+   case V4L2_TUNER_MODE_LANG2:
+   if (mode  V4L2_TUNER_SUB_LANG2)
+   selected = V4L2_TUNER_MODE_LANG2;
+   else if (mode  V4L2_TUNER_SUB_STEREO)
+   selected = V4L2_TUNER_MODE_STEREO;
+   break;
+   }
+   desc-setmode(chip, selected);
 
/* schedule next check */
mod_timer(chip-wt, jiffies+msecs_to_jiffies(2000));
@@ -712,7 +723,6 @@ static void tda9873_setmode(struct CHIPSTATE *chip, int 
mode)
sw_data |= TDA9873_TR_DUALB;
break;
default:
-   chip-mode = 0;
return;
}
 
@@ -944,7 +954,6 @@ static void tda9874a_setmode(struct CHIPSTATE *chip, int 
mode)
mdacosr = (tda9874a_mode) ? 0x83:0x81;
break;
default:
-   chip-mode = 0;
return;
}
chip_write(chip, TDA9874A_AOSR, aosr);
@@ -979,7 +988,6 @@ static void tda9874a_setmode(struct CHIPSTATE *chip, int 
mode)
aosr = 0x20; /* dual B/B */
break;
default:
-   chip-mode = 0;
return;
}
chip_write(chip, TDA9874A_FMMR, fmmr);
@@ -1799,7 +1807,6 @@ static int tvaudio_s_tuner(struct v4l2_subdev *sd, struct 
v4l2_tuner *vt)
 {
struct CHIPSTATE *chip = to_state(sd);
struct CHIPDESC *desc = chip-desc;
-   int mode = 0;
 
if (!desc-setmode)
return 0;
@@ -1811,21 +1818,20 @@ static int tvaudio_s_tuner(struct v4l2_subdev *sd, 
struct v4l2_tuner *vt)
case V4L2_TUNER_MODE_STEREO:
case V4L2_TUNER_MODE_LANG1:
case 

[PATCH 9/9] tvaudio: don't report mono when stereo is received

2012-06-09 Thread Daniel Glöckner
The V4L2 spec says reporting mono and stereo at the same time means
the hardware can not distinguish between the two. So when we can,
we should report only one of them.

Signed-off-by: Daniel Glöckner daniel...@gmx.net
---
 drivers/media/video/tvaudio.c |   12 ++--
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/media/video/tvaudio.c b/drivers/media/video/tvaudio.c
index f3ce93a..1e61cbf 100644
--- a/drivers/media/video/tvaudio.c
+++ b/drivers/media/video/tvaudio.c
@@ -383,7 +383,7 @@ static int tda9840_getmode(struct CHIPSTATE *chip)
if (val  TDA9840_DS_DUAL)
mode |= V4L2_TUNER_SUB_LANG1 | V4L2_TUNER_SUB_LANG2;
if (val  TDA9840_ST_STEREO)
-   mode |= V4L2_TUNER_SUB_STEREO;
+   mode = V4L2_TUNER_SUB_STEREO;
 
v4l2_dbg(1, debug, sd, tda9840_getmode(): raw chip read: %d, return: 
%d\n,
val, mode);
@@ -541,7 +541,7 @@ static int  tda985x_getmode(struct CHIPSTATE *chip)
mode = V4L2_TUNER_SUB_MONO;
val = chip_read(chip);
if (val  TDA985x_STP)
-   mode |= V4L2_TUNER_SUB_STEREO;
+   mode = V4L2_TUNER_SUB_STEREO;
if (val  TDA985x_SAPP)
mode |= V4L2_TUNER_SUB_SAP;
return mode;
@@ -700,7 +700,7 @@ static int tda9873_getmode(struct CHIPSTATE *chip)
val = chip_read(chip);
mode = V4L2_TUNER_SUB_MONO;
if (val  TDA9873_STEREO)
-   mode |= V4L2_TUNER_SUB_STEREO;
+   mode = V4L2_TUNER_SUB_STEREO;
if (val  TDA9873_DUAL)
mode |= V4L2_TUNER_SUB_LANG1 | V4L2_TUNER_SUB_LANG2;
v4l2_dbg(1, debug, sd, tda9873_getmode(): raw chip read: %d, return: 
%d\n,
@@ -918,12 +918,12 @@ static int tda9874a_getmode(struct CHIPSTATE *chip)
 * external 4052 multiplexer in audio_hook().
 */
if(nsr  0x02) /* NSR.S/MB=1 */
-   mode |= V4L2_TUNER_SUB_STEREO;
+   mode = V4L2_TUNER_SUB_STEREO;
if(nsr  0x01) /* NSR.D/SB=1 */
mode |= V4L2_TUNER_SUB_LANG1 | V4L2_TUNER_SUB_LANG2;
} else {
if(dsr  0x02) /* DSR.IDSTE=1 */
-   mode |= V4L2_TUNER_SUB_STEREO;
+   mode = V4L2_TUNER_SUB_STEREO;
if(dsr  0x04) /* DSR.IDDUA=1 */
mode |= V4L2_TUNER_SUB_LANG1 | V4L2_TUNER_SUB_LANG2;
}
@@ -1350,7 +1350,7 @@ static int ta8874z_getmode(struct CHIPSTATE *chip)
if (val  TA8874Z_B1){
mode |= V4L2_TUNER_SUB_LANG1 | V4L2_TUNER_SUB_LANG2;
}else if (!(val  TA8874Z_B0)){
-   mode |= V4L2_TUNER_SUB_STEREO;
+   mode = V4L2_TUNER_SUB_STEREO;
}
/* v4l_dbg(1, debug, chip-c, ta8874z_getmode(): raw chip read: 
0x%02x, return: 0x%02x\n, val, mode); */
return mode;
-- 
1.7.0.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


[PATCH 8/9] tvaudio: support V4L2_TUNER_MODE_LANG1_LANG2

2012-06-09 Thread Daniel Glöckner
Many of the audio decoders handled by the driver support this mode,
so the driver should support it as well.

Coding style errors are done to blend into the surrounding code.

Signed-off-by: Daniel Glöckner daniel...@gmx.net
---
 drivers/media/video/tvaudio.c |   34 --
 1 files changed, 32 insertions(+), 2 deletions(-)

diff --git a/drivers/media/video/tvaudio.c b/drivers/media/video/tvaudio.c
index 04ebdfe..f3ce93a 100644
--- a/drivers/media/video/tvaudio.c
+++ b/drivers/media/video/tvaudio.c
@@ -334,6 +334,11 @@ static int chip_thread(void *data)
else if (mode  V4L2_TUNER_SUB_STEREO)
selected = V4L2_TUNER_MODE_STEREO;
break;
+   case V4L2_TUNER_MODE_LANG1_LANG2:
+   if (mode  V4L2_TUNER_SUB_LANG2)
+   selected = V4L2_TUNER_MODE_LANG1_LANG2;
+   else if (mode  V4L2_TUNER_SUB_STEREO)
+   selected = V4L2_TUNER_MODE_STEREO;
}
desc-setmode(chip, selected);
 
@@ -403,6 +408,9 @@ static void tda9840_setmode(struct CHIPSTATE *chip, int 
mode)
case V4L2_TUNER_MODE_LANG2:
t |= TDA9840_DUALB;
break;
+   case V4L2_TUNER_MODE_LANG1_LANG2:
+   t |= TDA9840_DUALAB;
+   break;
default:
update = 0;
}
@@ -487,6 +495,7 @@ static int tda9840_checkit(struct CHIPSTATE *chip)
 /* 0x06 - C6 - Control 2 in TDA9855, Control 3 in TDA9850 */
 /* Common to TDA9855 and TDA9850: */
 #define TDA985x_SAP36 /* Selects SAP output, mute if not received */
+#define TDA985x_MONOSAP26 /* Selects Mono on left, SAP on right */
 #define TDA985x_STEREO 16 /* Selects Stereo ouput, mono if not received */
 #define TDA985x_MONO   0/* Forces Mono output */
 #define TDA985x_LMU13 /* Mute (LOR/LOL for 9855, OUTL/OUTR for 9850) */
@@ -554,6 +563,9 @@ static void tda985x_setmode(struct CHIPSTATE *chip, int 
mode)
case V4L2_TUNER_MODE_SAP:
c6 |= TDA985x_SAP;
break;
+   case V4L2_TUNER_MODE_LANG1_LANG2:
+   c6 |= TDA985x_MONOSAP;
+   break;
default:
update = 0;
}
@@ -601,6 +613,7 @@ static void tda985x_setmode(struct CHIPSTATE *chip, int 
mode)
 #define TDA9873_TR_REVERSE  ((1  3) | (1  2))
 #define TDA9873_TR_DUALA1  2
 #define TDA9873_TR_DUALB1  3
+#define TDA9873_TR_DUALAB   0
 
 /* output level controls
  * B5:  output level switch (0 = reduced gain, 1 = normal gain)
@@ -722,6 +735,9 @@ static void tda9873_setmode(struct CHIPSTATE *chip, int 
mode)
case V4L2_TUNER_MODE_LANG2:
sw_data |= TDA9873_TR_DUALB;
break;
+   case V4L2_TUNER_MODE_LANG1_LANG2:
+   sw_data |= TDA9873_TR_DUALAB;
+   break;
default:
return;
}
@@ -953,6 +969,10 @@ static void tda9874a_setmode(struct CHIPSTATE *chip, int 
mode)
aosr = 0xa0; /* auto-select, dual B/B */
mdacosr = (tda9874a_mode) ? 0x83:0x81;
break;
+   case V4L2_TUNER_MODE_LANG1_LANG2:
+   aosr = 0x00; /* always route L to L and R to R */
+   mdacosr = (tda9874a_mode) ? 0x82:0x80;
+   break;
default:
return;
}
@@ -987,6 +1007,10 @@ static void tda9874a_setmode(struct CHIPSTATE *chip, int 
mode)
fmmr = 0x02; /* dual */
aosr = 0x20; /* dual B/B */
break;
+   case V4L2_TUNER_MODE_LANG1_LANG2:
+   fmmr = 0x02; /* dual */
+   aosr = 0x00; /* dual A/B */
+   break;
default:
return;
}
@@ -1251,6 +1275,10 @@ static void tda8425_setmode(struct CHIPSTATE *chip, int 
mode)
s1 |= TDA8425_S1_ML_SOUND_B;
s1 |= TDA8425_S1_STEREO_PSEUDO;
break;
+   case V4L2_TUNER_MODE_LANG1_LANG2:
+   s1 |= TDA8425_S1_ML_STEREO;
+   s1 |= TDA8425_S1_STEREO_LINEAR;
+   break;
case V4L2_TUNER_MODE_MONO:
s1 |= TDA8425_S1_ML_STEREO;
s1 |= TDA8425_S1_STEREO_MONO;
@@ -1332,6 +1360,7 @@ static audiocmd ta8874z_stereo = { 2, {0, 
TA8874Z_SEPARATION_DEFAULT}};
 static audiocmd ta8874z_mono = {2, { TA8874Z_MONO_SET, 
TA8874Z_SEPARATION_DEFAULT}};
 static audiocmd ta8874z_main = {2, { 0, TA8874Z_SEPARATION_DEFAULT}};
 static audiocmd ta8874z_sub = {2, { TA8874Z_MODE_SUB, 
TA8874Z_SEPARATION_DEFAULT}};
+static audiocmd ta8874z_both = {2, { TA8874Z_MODE_MAIN | TA8874Z_MODE_SUB, 
TA8874Z_SEPARATION_DEFAULT}};
 
 static void ta8874z_setmode(struct CHIPSTATE *chip, int mode)
 {
@@ 

[PATCH 5/9] tvaudio: don't use thread for TA8874Z

2012-06-09 Thread Daniel Glöckner
Judging from the data sheet it will automatically switch to the next
best audio mode in accordance with the V4L2 tuner audio matrix.

Signed-off-by: Daniel Glöckner daniel...@gmx.net
---
 drivers/media/video/tvaudio.c |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/drivers/media/video/tvaudio.c b/drivers/media/video/tvaudio.c
index fc37587..0e77d49 100644
--- a/drivers/media/video/tvaudio.c
+++ b/drivers/media/video/tvaudio.c
@@ -1597,7 +1597,6 @@ static struct CHIPDESC chiplist[] = {
.addr_lo= I2C_ADDR_TDA9840  1,
.addr_hi= I2C_ADDR_TDA9840  1,
.registers  = 2,
-   .flags  = CHIP_NEED_CHECKMODE,
 
/* callbacks */
.getmode= ta8874z_getmode,
-- 
1.7.0.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


[PATCH 2/9] tvaudio: fix tda8425_setmode

2012-06-09 Thread Daniel Glöckner
The passed audio mode is not a bitfield.

Signed-off-by: Daniel Glöckner daniel...@gmx.net
---
 drivers/media/video/tvaudio.c |   24 ++--
 1 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/drivers/media/video/tvaudio.c b/drivers/media/video/tvaudio.c
index 9b85e2a..76a8cbe 100644
--- a/drivers/media/video/tvaudio.c
+++ b/drivers/media/video/tvaudio.c
@@ -1230,21 +1230,25 @@ static void tda8425_setmode(struct CHIPSTATE *chip, int 
mode)
 {
int s1 = chip-shadow.bytes[TDA8425_S1+1]  0xe1;
 
-   if (mode  V4L2_TUNER_MODE_LANG1) {
+   switch (mode) {
+   case V4L2_TUNER_MODE_LANG1:
s1 |= TDA8425_S1_ML_SOUND_A;
s1 |= TDA8425_S1_STEREO_PSEUDO;
-
-   } else if (mode  V4L2_TUNER_MODE_LANG2) {
+   break;
+   case V4L2_TUNER_MODE_LANG2:
s1 |= TDA8425_S1_ML_SOUND_B;
s1 |= TDA8425_S1_STEREO_PSEUDO;
-
-   } else {
+   break;
+   case V4L2_TUNER_MODE_MONO:
s1 |= TDA8425_S1_ML_STEREO;
-
-   if (mode  V4L2_TUNER_MODE_MONO)
-   s1 |= TDA8425_S1_STEREO_MONO;
-   if (mode  V4L2_TUNER_MODE_STEREO)
-   s1 |= TDA8425_S1_STEREO_SPATIAL;
+   s1 |= TDA8425_S1_STEREO_MONO;
+   break;
+   case V4L2_TUNER_MODE_STEREO:
+   s1 |= TDA8425_S1_ML_STEREO;
+   s1 |= TDA8425_S1_STEREO_SPATIAL;
+   break;
+   default:
+   return;
}
chip_write(chip,TDA8425_S1,s1);
 }
-- 
1.7.0.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


[PATCH 4/9] tvaudio: remove watch_stereo

2012-06-09 Thread Daniel Glöckner
It is never read and only assigned 0.

Signed-off-by: Daniel Glöckner daniel...@gmx.net
---
 drivers/media/video/tvaudio.c |3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/drivers/media/video/tvaudio.c b/drivers/media/video/tvaudio.c
index 3fbaaa0..fc37587 100644
--- a/drivers/media/video/tvaudio.c
+++ b/drivers/media/video/tvaudio.c
@@ -126,7 +126,6 @@ struct CHIPSTATE {
/* thread */
struct task_struct   *thread;
struct timer_listwt;
-   int  watch_stereo;
int  audmode;
 };
 
@@ -1741,7 +1740,6 @@ static int tvaudio_s_radio(struct v4l2_subdev *sd)
struct CHIPSTATE *chip = to_state(sd);
 
chip-radio = 1;
-   chip-watch_stereo = 0;
/* del_timer(chip-wt); */
return 0;
 }
@@ -1821,7 +1819,6 @@ static int tvaudio_s_tuner(struct v4l2_subdev *sd, struct 
v4l2_tuner *vt)
chip-audmode = vt-audmode;
 
if (mode) {
-   chip-watch_stereo = 0;
/* del_timer(chip-wt); */
chip-mode = mode;
desc-setmode(chip, mode);
-- 
1.7.0.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


[PATCH 3/9] tvaudio: use V4L2_TUNER_MODE_SAP for TDA985x SAP

2012-06-09 Thread Daniel Glöckner
As V4L2_TUNER_MODE_SAP == V4L2_TUNER_MODE_LANG2, we make
V4L2_TUNER_MODE_LANG1 equal to V4L2_TUNER_MODE_STEREO.

Signed-off-by: Daniel Glöckner daniel...@gmx.net
---
 drivers/media/video/tvaudio.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/media/video/tvaudio.c b/drivers/media/video/tvaudio.c
index 76a8cbe..3fbaaa0 100644
--- a/drivers/media/video/tvaudio.c
+++ b/drivers/media/video/tvaudio.c
@@ -534,9 +534,10 @@ static void tda985x_setmode(struct CHIPSTATE *chip, int 
mode)
c6 |= TDA985x_MONO;
break;
case V4L2_TUNER_MODE_STEREO:
+   case V4L2_TUNER_MODE_LANG1:
c6 |= TDA985x_STEREO;
break;
-   case V4L2_TUNER_MODE_LANG1:
+   case V4L2_TUNER_MODE_SAP:
c6 |= TDA985x_SAP;
break;
default:
-- 
1.7.0.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