summaryrefslogtreecommitdiff
path: root/drivers/staging/tm6000/tm6000-video.c
AgeCommit message (Collapse)Author
2011-07-08Staging: tm6000: remove unneeded check in get_next_buf()Dan Carpenter
We dereference "buf" on the line before so if it were NULL here we would have OOPsed earlier. Also list_entry() never returns NULL. And finally, we handled the situation where the list is empty earlier in the function. So this test isn't needed and I've removed it. Signed-off-by: Dan Carpenter <error27@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-07-05Remove unneeded version.h includes (and add where needed) for drivers/tm6000/Jesper Juhl
It was pointed out by 'make versioncheck' that linux/version.h was not always being included where needed and sometimes included needlessly in drivers/staging/tm6000/. This patch fixes up the includes. Signed-off-by: Jesper Juhl <jj@chaosbits.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-06-28staging: tm6000: cleaned up code in tm6000-video.c according to coding styleCurtis McEnroe
Fixed all errors reported by the checker in tm6000-video.c mostly relating to whitespace. Signed-off-by: Curtis McEnroe <programble@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-05-21[media] tm6000: fix uninitialized field, change prink to dprintkStefan Ringel
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-20[media] tm6000: add pts loggingStefan Ringel
Signed-off-by: Stefan Ringel <stefan.ringel@arcor.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-05-20[media] tm6000: change from ioctl to unlocked_ioctlStefan Ringel
Signed-off-by: Stefan Ringel <stefan.ringel@arcor.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-05-20[media] tm6000: all audio packets must swabStefan Ringel
Signed-off-by: Stefan Ringel <stefan.ringel@arcor.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-05-20[media] tm6000: change input controlStefan Ringel
change input control Signed-off-by: Stefan Ringel <stefan.ringel@arcor.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-05-20[media] tm6000: vitual input enumsStefan Ringel
vitual input enums Signed-off-by: Stefan Ringel <stefan.ringel@arcor.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-05-20[media] tm6000: add tm6010 audio mode setupStefan Ringel
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[media] tm6000: add radio capabilitiesStefan Ringel
add radio capabilities Signed-off-by: Stefan Ringel <stefan.ringel@arcor.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2011-05-20[media] tm6000: fix vbuf may be used uninitializedJarod Wilson
In commit 8aff8ba95155df, 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 8aff8ba95155df. 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-03-31Fix common misspellingsLucas De Marchi
Fixes generated by 'codespell' and manually reviewed. Signed-off-by: Lucas De Marchi <lucas.demarchi@profusion.mobi>
2011-03-22[media] tm6000: fix s-video inputDmitri Belimov
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-21[media] tm6000: add radio support to the driverDmitri Belimov
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-01-19[media] tm6000: rework init codeDmitri Belimov
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>
2010-12-29[media] tm6000: rework and fix IRDmitri Belimov
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[media] V4L: remove V4L1 compatibility modeHans Verkuil
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-11-09[media] tm6000: bugfix set tv standardsStefan Ringel
bugfix set tv standards Signed-off-by: Stefan Ringel <stefan.ringel@arcor.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21[media] Staging: tm6000: fix braces, tabs, comments and space coding style ↵Ruslan Pisarev
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[media] tm6000: fix resource lockingMauro Carvalho Chehab
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21[media] tm6000: don't use BKL at the driverMauro Carvalho Chehab
Instead, use core lock handling. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-10-21[media] V4L-DVB: tm6000: Move VBI init to a separate functionMauro Carvalho Chehab
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[media] tm6000: add audio standards tableMauro Carvalho Chehab
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-21V4L/DVB: tm6000+audioDmitri Belimov
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-21V4L/DVB: videobuf: add ext_lock argument to the queue init functionsHans Verkuil
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-08-02V4L/DVB: tm6000: Partially revert some copybuf logicMauro Carvalho Chehab
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-02V4L/DVB: tm6000: Be sure that the new buffer is emptyMauro Carvalho Chehab
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-08-02V4L/DVB: tm6000: Fix copybuf continue logicMauro Carvalho Chehab
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-08-02V4L/DVB: tm6000: audio packet has always 180 bytesMauro Carvalho Chehab
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-08-02V4L/DVB: tm6000: avoid unknown symbol tm6000_debugMauro Carvalho Chehab
Reported by Stefan Ringel. Thanks-to: Stefan Ringel <stefan.ringel@arcor.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-08-02V4L/DVB: tm6000: Add a callback code for buffer fillMauro Carvalho Chehab
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-02V4L/DVB: tm6000: rewrite copy_streamsStefan Ringel
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-06-01V4L/DVB: tm6000: bugfix stabilizing urb dataStefan Ringel
Signed-off-by: Stefan Ringel <stefan.ringel@arcor.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-06-01V4L/DVB: tm6000: bugfix video imageStefan Ringel
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-01V4L/DVB: tm6000: add vbi message inside the type switchStefan Ringel
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-01V4L/DVB: tm6000: bugfix incorrect sizeStefan Ringel
Signed-off-by: Stefan Ringel <stefan.ringel@arcor.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-05-19V4L/DVB (13554a): v4l: Use the video_drvdata function in driversMauro Carvalho Chehab
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-19V4L/DVB: tm6000: bugfix image positionStefan Ringel
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-19Fix compilation breakage with tm6000Mauro Carvalho Chehab
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-19V4L/DVB: Fix color format with tm6010Mauro Carvalho Chehab
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-19V4L/DVB: tm6000: Don't copy outside the bufferMauro Carvalho Chehab
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-19V4L/DVB: tm6000: Fix a panic if buffer become NULLMauro Carvalho Chehab
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-19V4L/DVB: tm6000: Properly set alternate when preparing to streamMauro Carvalho Chehab
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-19V4L/DVB: TM6000: Fix code which cause memory corruptionBee Hock Goh
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-18V4L/DVB: tm6000: Replace all magic values by a register aliasMauro Carvalho Chehab
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-18V4L/DVB: tm6000: fix some info messagesDmitri Belimov
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-18V4L/DVB: drivers/staging/tm6000/tm6000-video.c: correct NULL testJulia Lawall
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-18V4L/DVB (13556a): v4l: Remove unneeded video_device::minor assignmentsLaurent Pinchart
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-18V4L/DVB (13555a): v4l: Use video_device_node_name() instead of the minor numberMauro Carvalho Chehab
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>