Commit Graph

78 Commits (34a991587a5cc9f78960c2c9beea217866458c41)

Author SHA1 Message Date
Stefan Ringel 423c79e3fe [media] tm6000: fix uninitialized field, change prink to dprintk
fix uninitialized field, change prink to dprintk

Signed-off-by: Stefan Ringel <stefan.ringel@arcor.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-05-21 07:24:19 -03:00
Stefan Ringel 2f349daa01 [media] tm6000: add pts logging
Signed-off-by: Stefan Ringel <stefan.ringel@arcor.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-05-20 20:08:32 -03:00
Stefan Ringel 1f385717c9 [media] tm6000: change from ioctl to unlocked_ioctl
Signed-off-by: Stefan Ringel <stefan.ringel@arcor.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-05-20 20:08:13 -03:00
Stefan Ringel 7ecff8c93e [media] tm6000: all audio packets must swab
Signed-off-by: Stefan Ringel <stefan.ringel@arcor.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-05-20 20:07:59 -03:00
Stefan Ringel 0f6040e892 [media] tm6000: change input control
change input control

Signed-off-by: Stefan Ringel <stefan.ringel@arcor.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-05-20 20:04:53 -03:00
Stefan Ringel b8f7bd8769 [media] tm6000: vitual input enums
vitual input enums

Signed-off-by: Stefan Ringel <stefan.ringel@arcor.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-05-20 20:01:39 -03:00
Stefan Ringel 886a3c0b58 [media] tm6000: add tm6010 audio mode setup
add tm6010 audio mode setup

Signed-off-by: Stefan Ringel <stefan.ringel@arcor.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-05-20 20:01:02 -03:00
Stefan Ringel 1416910743 [media] tm6000: add radio capabilities
add radio capabilities

Signed-off-by: Stefan Ringel <stefan.ringel@arcor.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-05-20 19:59:23 -03:00
Jarod Wilson cc73b4b57c [media] tm6000: fix vbuf may be used uninitialized
In commit 8aff8ba951, most of the manipulations to vbuf inside
copy_streams were gated on if !dev->radio, but one place that touches
vbuf lays outside those gates -- a memcpy of vbuf isn't NULL. If we
initialize vbuf to NULL, that memcpy will never happen in the case where
we do have dev->radio, and otherwise, in the !dev->radio case, the code
behaves exactly like it did prior to 8aff8ba951.

While we're at it, also fix an incorrectly indented closing brace for
one of the sections touching vbuf that is conditional on !dev->radio.

Signed-off-by: Jarod Wilson <jarod@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-05-20 09:27:42 -03:00
Lucas De Marchi 25985edced Fix common misspellings
Fixes generated by 'codespell' and manually reviewed.

Signed-off-by: Lucas De Marchi <lucas.demarchi@profusion.mobi>
2011-03-31 11:26:23 -03:00
Dmitri Belimov 2aefbc1acb [media] tm6000: fix s-video input
Add compatibility for composite and s-video inputs. Some TV cards hasn't
it.

Fix S-Video input, the s-video cable has only video signals no
audio. Call the function of audio configure kill chroma in signal. only
b/w video.

Known bugs:
  - after s-video the audio for radio didn't work, TV crashed hardly
  - after composite TV crashed hardly too.

P.S. After this patch I'll want to rework the procedure of configure
     video. Now it has a lot of junk and dubles.

With my best regards, Dmitry.

Signed-off-by: Beholder Intl. Ltd. Dmitry Belimov <d.belimov@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-03-22 17:20:14 -03:00
Dmitri Belimov 8aff8ba951 [media] tm6000: add radio support to the driver
Changes:
  Add function tm6000_set_reg_mask for change some bits in regs. Very usefull, simplify some code with this function.
  Add control mute
  Add control volume
  Add control audio input MUX
  Add support radio

Radio works well. TV works too

Known bugs:
  The programm gnomeradio can't set freq for radio, it use old v4l API. Audio over USB works via arecord.
  The programm mplayer can set freq but no any audio
           mplayer -v -rawaudio rate=48000 radio://105.2/capture driver=v4l2:alsa:adevice=hw.1,0:amode=1:audiorate=48000:forceaudio:immediatemode=0
  When start watch TV very shortly after radio the kernel crashed hardly. Didn't stop all USB URBs, need some time for stop.

[mchehab@redhat.com: fix merge conflicts]

Signed-off-by: Beholder Intl. Ltd. Dmitry Belimov <d.belimov@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-03-21 20:32:20 -03:00
Dmitri Belimov 3c61be446a [media] tm6000: rework init code
Rework device init part. Move common code part to a function.
Usefull for register multiple devices like video, radio, vbi etc.

Signed-off-by: Beholder Intl. Ltd. Dmitry Belimov <d.belimov@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-01-19 11:45:58 -02:00
Dmitri Belimov 641d21167f [media] tm6000: rework and fix IR
Hi

This patch didn't kill Stefan's remotes and just for upload my good part of code.
1. Add some code for show IR activity
2. Add filter for IR remotes
3. Split remotes to different types.
4. Fix stop interrupt pipe when isoc pipe started.

When we decide general way of IR I'll add support our remotes.
For our customers I'll made custom temporary patch without this part.

Signed-off-by: Beholder Intl. Ltd. Dmitry Belimov <d.belimov@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-12-29 08:17:15 -02:00
Hans Verkuil 08af245de0 [media] V4L: remove V4L1 compatibility mode
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-12-29 08:17:07 -02:00
Stefan Ringel 4f52610e29 [media] tm6000: bugfix set tv standards
bugfix set tv standards

Signed-off-by: Stefan Ringel <stefan.ringel@arcor.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-11-09 15:03:20 -02:00
Ruslan Pisarev 60fbfdfd8c [media] Staging: tm6000: fix braces, tabs, comments and space coding style issue in tm6000-video.c
This is a patch to the tm6000-video.c file that fixed
up a braces, tabs, comments and space Errors and Warnings found by the checkpatch.pl tools.

[mchehab@redhat.com: some changes didn't apply as it were based to an older version, so used patch -f to apply only the changes that are OK]
Signed-off-by: Ruslan Pisarev <ruslan@rpisarev.org.ua>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21 13:59:23 -02:00
Mauro Carvalho Chehab 9efd85dfff [media] tm6000: fix resource locking
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21 11:36:26 -02:00
Mauro Carvalho Chehab dc961136b9 [media] tm6000: don't use BKL at the driver
Instead, use core lock handling.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21 11:35:25 -02:00
Mauro Carvalho Chehab 589851d599 [media] V4L-DVB: tm6000: Move VBI init to a separate function
While here, documment that VBI may need changes, based on video STD, and
do some cleanup at device init, to be sure that VBI init will happen
all the times, and to remove a duplicated video standard call.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21 01:17:53 -02:00
Mauro Carvalho Chehab 709944eae2 [media] tm6000: add audio standards table
The better is to remove the audio init from tm6000-core and add a
separate per-standard set of tables.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21 01:17:51 -02:00
Dmitri Belimov 73f4d265f6 V4L/DVB: tm6000+audio
I rework my last patch for audio and now audio works well. This patch
can be submited to GIT tree Quality of audio now is good for SECAM-DK.
For other standard I set some value from datasheet need some tests.

1. Fix pcm buffer overflow
2. Rework pcm buffer fill method
3. Swap bytes in audio stream
4. Change some registers value for TM6010
5. Change pcm buffer size

Signed-off-by: Beholder Intl. Ltd. Dmitry Belimov <d.belimov@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21 01:06:20 -02:00
Hans Verkuil 08bff03ed6 V4L/DVB: videobuf: add ext_lock argument to the queue init functions
Add an ext_lock argument to the videobuf init functions. This allows
drivers to pass the vdev->lock pointer (or any other externally held lock)
to videobuf. For now all drivers just pass NULL.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21 01:06:14 -02:00
Mauro Carvalho Chehab ccfb302882 V4L/DVB: tm6000: Partially revert some copybuf logic
Partially revert changeset 0208bef609242a2d50b95edc713a41566cae500b:

As pointed by Stefan Ringel <stefan.ringel@arcor.de>, many packets become
damaged by this change. That means that the "size" field of Video/VBI is not
presenting 180 bytes, as it should be expected.

Thanks-to: Stefan Ringel <stefan.ringel@arcor.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-08-02 14:06:02 -03:00
Mauro Carvalho Chehab 758bb0b3e7 V4L/DVB: tm6000: Be sure that the new buffer is empty
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-08-02 14:06:01 -03:00
Mauro Carvalho Chehab d0669c872f V4L/DVB: tm6000: Fix copybuf continue logic
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-08-02 14:06:00 -03:00
Mauro Carvalho Chehab 23ba94633d V4L/DVB: tm6000: audio packet has always 180 bytes
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-08-02 14:05:59 -03:00
Mauro Carvalho Chehab faa7c13481 V4L/DVB: tm6000: avoid unknown symbol tm6000_debug
Reported by Stefan Ringel.

Thanks-to: Stefan Ringel <stefan.ringel@arcor.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-08-02 14:05:54 -03:00
Mauro Carvalho Chehab b17b86991a V4L/DVB: tm6000: Add a callback code for buffer fill
Implements a callback to be used by tm6000-alsa, in order to allow filling
audio data packets.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-08-02 14:05:53 -03:00
Stefan Ringel 83cb9a504c V4L/DVB: tm6000: rewrite copy_streams
Merge function copy streams() and copy_packets() into a new function
copy_streams(), fixing the bugs.

Signed-off-by: Stefan Ringel <stefan.ringel@arcor.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-08-02 14:05:40 -03:00
Stefan Ringel 5a4b55e2c2 V4L/DVB: tm6000: bugfix stabilizing urb data
Signed-off-by: Stefan Ringel <stefan.ringel@arcor.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-06-01 01:22:02 -03:00
Stefan Ringel 4b6ed9fd0b V4L/DVB: tm6000: bugfix video image
bugfix: Avoid loosing frames, causing image delays on some of the image lines.

[mchehab@redhat.com: Fix compilation breakage by merging with the patch fix]
Signed-off-by: Stefan Ringel <stefan.ringel@arcor.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-06-01 01:22:01 -03:00
Stefan Ringel 3569417e5a V4L/DVB: tm6000: add vbi message inside the type switch
add case line for vbi message

Signed-off-by: Stefan Ringel <stefan.ringel@arcor.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-06-01 01:21:59 -03:00
Stefan Ringel 0f9bdbc2da V4L/DVB: tm6000: bugfix incorrect size
Signed-off-by: Stefan Ringel <stefan.ringel@arcor.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-06-01 01:21:58 -03:00
Mauro Carvalho Chehab e8d0416796 V4L/DVB (13554a): v4l: Use the video_drvdata function in drivers
Fix all device drivers to use the video_drvdata function instead of
maintaining a local list of minor to private data mappings. Call
video_set_drvdata to register the driver private pointer when not
already done.

Where applicable, the local list of mappings is completely removed when
it becomes unused.

[mchehab.redhat.com: patch broke into two. This one changes just tm6000]

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-05-19 12:59:18 -03:00
Stefan Ringel 3c7c5e9e89 V4L/DVB: tm6000: bugfix image position
bugfix incorrect image and line position in videobuffer

Signed-off-by: Stefan Ringel <stefan.ringel@arcor.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-05-19 12:59:17 -03:00
Mauro Carvalho Chehab 5a11b6fe5d Fix compilation breakage with tm6000
Randy Dunlap <randy.dunlap@oracle.com>  reported a breakage while compiling
drivers/staging/tm6000, due to this change:
    commit 1c1b78bee1a94f98deeb9c24b21c4812e191646c
    Author: Greg Kroah-Hartman <gregkh@suse.de>
    Date:   Thu Apr 29 15:46:07 2010 -0700

    USB: remove unused usb_buffer_alloc and usb_buffer_free macros

    Now that all callers are converted over, remove the compatibility
    functions and all is good.

As the function got renamed, the rename should also be applied at
tm6000.

Acked-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-05-19 12:58:23 -03:00
Mauro Carvalho Chehab 4223871357 V4L/DVB: Fix color format with tm6010
The values for the fourcc format were correct, but applied to the
wrong register. With this change, video is now barely working again with
tm6000.

While here, let's remove, for now, the memset. This way, people can
have some image when testing this device.

Yet to be fixed: parts of the image frame are missed. As we don't clean
the buffers anymore, this is "recovered" by repeating the values from a
previous frame. The quality is bad, since the image pixels will contain
data from some previous frames, generating weird delay artifacts.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-05-19 12:58:22 -03:00
Mauro Carvalho Chehab 801dd3b32d V4L/DVB: tm6000: Don't copy outside the buffer
tm6000 tm6000_irq_callback :urb resubmit failed (error=-1)
BUG: unable to handle kernel paging request at 000000000100f700
IP: [<ffffffffa007ee79>] tm6000_irq_callback+0x51e/0xac7 [tm6000]

(gdb) list * tm6000_irq_callback+0x51e
0x2e79 is in tm6000_irq_callback (drivers/staging/tm6000/tm6000-video.c:363).
358                                             dev->isoc_ctl.tmp_buf_len--;
359                                     }
360                                     if (dev->isoc_ctl.tmp_buf_len) {
361                                             memcpy (&header,p,
362                                                     dev->isoc_ctl.tmp_buf_l$
363                                             memcpy (((u8 *)header)+
364                                                     dev->isoc_ctl.tmp_buf,
365                                                     ptr,
366                                                     4-dev->isoc_ctl.tmp_buf$
367                                             ptr+=4-dev->isoc_ctl.tmp_buf_le$

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-05-19 12:58:19 -03:00
Mauro Carvalho Chehab f4b727b3ae V4L/DVB: tm6000: Fix a panic if buffer become NULL
Changing a video standard takes a long time to happen on tm6000, since it
needs to load another firmware, and the i2c implementation on this device
is really slow. When the driver tries to change the video standard, a
kernel panic is produced:

BUG: unable to handle kernel NULL pointer dereference at 0000000000000008
IP: [<ffffffffa0c7b48a>] tm6000_irq_callback+0x57f/0xac2 [tm6000]
...
Kernel panic - not syncing: Fatal exception in interrupt

By inspecting it with gdb:

(gdb) list *tm6000_irq_callback+0x57f
0x348a is in tm6000_irq_callback (drivers/staging/tm6000/tm6000-video.c:202).
197             /* FIXME: move to tm6000-isoc */
198             static int last_line = -2, start_line = -2, last_field = -2;
199
200             /* FIXME: this is the hardcoded window size
201              */
202             unsigned int linewidth = (*buf)->vb.width << 1;
203
204             if (!dev->isoc_ctl.cmd) {
205                     c = (header >> 24) & 0xff;
206

Clearly, it was the trial to access *buf, at line 202 that caused the
Panic.

As ioctl is serialized, While S_STD is handled,QBUF/DQBUF won't be called.
So, the driver will run out of the buffers, and *buf will become NULL.

As, on tm6000, the same URB can contain more than one video buffer, it is
likely to hit a condition where no new buffer is available whily copying
the streams. The fix is to leave the URB copy loop, if there's no more buffers
are available.

The same bug could also be produced by an application that is not fast enough
to request new video buffers.

The same bug were reported by Bee Hock Goh <beehock@gmail.com>.

Thanks-to: Bee Hock Goh <beehock@gmail.com> for reporting the bug
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-05-19 12:58:19 -03:00
Mauro Carvalho Chehab 6ae635c4f3 V4L/DVB: tm6000: Properly set alternate when preparing to stream
Although the code is getting the better alternates, it is not really using
it. Get the interface/alternate numbers and use it where needed.

This patch implements also one small fix at the last_line set, as
proposed by Bee Hock Goh <behock@gmail.com>.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-05-19 12:58:18 -03:00
Bee Hock Goh c16dd82b48 V4L/DVB: TM6000: Fix code which cause memory corruption
The driver was doing malloc when buf is null causing memory corruption.

The analog part is still pretty much broken but at least fixing this
will stop it from crashing the machine when streamon.

Signed-off-by: Bee Hock Goh <beehock@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-05-19 12:57:33 -03:00
Mauro Carvalho Chehab 9afec493e2 V4L/DVB: tm6000: Replace all magic values by a register alias
Instead of using magic pairs of req/reg, replace them by the defined
values.

This patch were generated by the following script:

cat tm6000-regs.h |perl -ne 'if (m/(TM6010_REQ[^\s]+)\s+0x([a-f0-9]+)\,
0x([a-f0-9]+)/) { $name="$1"; $req=$2; $val=$3; printf
"s/REQ_${req}_SET_GET_AVREG[_BIT]*, 0x[0]*$3,/$1,/\n" }'  >a; for i in
tm*.c; do sed -f a $i >b && mv b $i; done

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-05-18 00:47:09 -03:00
Dmitri Belimov e28f49b0b2 V4L/DVB: tm6000: fix some info messages
Fix some messages for add information about TM6010

Signed-off-by: Beholder Intl. Ltd. Dmitry Belimov <d.belimov@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-05-18 00:44:07 -03:00
Julia Lawall f8960ee7a4 V4L/DVB: drivers/staging/tm6000/tm6000-video.c: correct NULL test
Test the just-allocated value for NULL rather than some other value.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression x,y;
statement S;
@@

x = \(kmalloc\|kcalloc\|kzalloc\)(...);
(
if ((x) == NULL) S
|
if (
-   y
+   x
       == NULL)
 S
)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-05-18 00:43:58 -03:00
Laurent Pinchart 833724afc0 V4L/DVB (13556a): v4l: Remove unneeded video_device::minor assignments
Now that the video_device registration is tested using
video_is_registered(), drivers don't need to initialize the
video_device::minor field to -1 anymore.

Remove those unneeded assignments.

[mchehab.redhat.com: apply just the tm6000 changes on a separate patch]

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-05-18 00:43:44 -03:00
Mauro Carvalho Chehab 0a34df5359 V4L/DVB (13555a): v4l: Use video_device_node_name() instead of the minor number
Instead of using the minor number in kernel log messages, use the device
node name as returned by the video_device_node_name() function. This
makes debug, informational and error messages easier to understand for
end users.

[mchehab.redhat.com: apply just the tm6000 changes on a separate patch]

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-05-18 00:43:18 -03:00
Mauro Carvalho Chehab 64d339d42d V4L/DVB (12853): tm6000: Fix almost all warnings at the driver
Onr warning is left, since it is there for a purpose:
tm6000-core.c:218: warning: ISO C90 forbids mixed declarations and code

It indicates a place where a temporary hack were added. Tests are needed to be sure that
we can remove it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-05-18 00:40:25 -03:00
Mauro Carvalho Chehab 427f7facb3 V4L/DVB (12852): tm6000: Fix compilation against 2.6.31
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-05-18 00:40:24 -03:00
Mauro Carvalho Chehab e8a4845d2a V4L/DVB (12845): tm6000: more buffer handling fixes
Before this patch, we were writing outside vmalloced buffer

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-05-18 00:40:21 -03:00