Commit graph

19172 commits

Author SHA1 Message Date
Mauro Carvalho Chehab 0448056c7e [media] dm355_ccdc: declare a function as static
drivers/media/platform/davinci/dm355_ccdc.c:463:5: warning: no previous prototy
pe for 'ccdc_write_dfc_entry' [-Wmissing-prototypes]
 int ccdc_write_dfc_entry(int index, struct ccdc_vertical_dft *dfc)
     ^

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-26 18:51:59 -03:00
Mauro Carvalho Chehab f17513c9bf [media] dm644x_ccdc: declare some functions as static
drivers/media/platform/davinci/dm644x_ccdc.c:133:6: warning: no previous protot
ype for 'ccdc_setwin' [-Wmissing-prototypes]
 void ccdc_setwin(struct v4l2_rect *image_win,
      ^
drivers/media/platform/davinci/dm644x_ccdc.c:373:6: warning: no previous protot
ype for 'ccdc_config_ycbcr' [-Wmissing-prototypes]
 void ccdc_config_ycbcr(void)
      ^
drivers/media/platform/davinci/dm644x_ccdc.c:526:6: warning: no previous protot
ype for 'ccdc_config_raw' [-Wmissing-prototypes]
 void ccdc_config_raw(void)
      ^

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-26 18:51:58 -03:00
Mauro Carvalho Chehab 24ab6338f3 [media] vpif_capture: get rid of some unused vars
drivers/media/platform/davinci/vpif_capture.c: In function 'vpif_channel_isr':
drivers/media/platform/davinci/vpif_capture.c:376:18: warning: variable 'field'
 set but not used [-Wunused-but-set-variable]
  enum v4l2_field field;
                  ^
drivers/media/platform/davinci/vpif_capture.c: In function 'vpif_calculate_offs
ets':
drivers/media/platform/davinci/vpif_capture.c:536:23: warning: variable 'vpitch
' set but not used [-Wunused-but-set-variable]
  unsigned int hpitch, vpitch, sizeimage;
                       ^

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-26 18:51:58 -03:00
Mauro Carvalho Chehab a4f20e2fbc [media] vpif_display: get rid of some unused vars
drivers/media/platform/davinci/vpif_display.c: In function 'vpif_channel_isr':
drivers/media/platform/davinci/vpif_display.c:363:18: warning: variable 'field'
 set but not used [-Wunused-but-set-variable]
  enum v4l2_field field;
                  ^
drivers/media/platform/davinci/vpif_display.c: In function 'vpif_calculate_offs
ets':
drivers/media/platform/davinci/vpif_display.c:505:23: warning: variable 'vpitch
' set but not used [-Wunused-but-set-variable]
  unsigned int hpitch, vpitch, sizeimage;
                       ^
drivers/media/platform/davinci/vpif_display.c: In function 'vpif_set_output':
drivers/media/platform/davinci/vpif_display.c:816:27: warning: variable 'subdev
_info' set but not used [-Wunused-but-set-variable]
  struct vpif_subdev_info *subdev_info = NULL;

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-26 18:51:57 -03:00
Randy Dunlap b250392f7b [media] media: ttpci: fix av7110 build to be compatible with CONFIG_INPUT_EVDEV
Fix build when CONFIG_INPUT_EVDEV=m and DVB_AV7110=y.
Only build av7110_ir.c when CONFIG_INPUT_EVDEV is compatible with
CONFIG_DVB_AV7110.

Fixes these build errors:

drivers/built-in.o: In function `input_sync':
av7110_ir.c:(.text+0x1223ac): undefined reference to `input_event'
drivers/built-in.o: In function `av7110_emit_key':
av7110_ir.c:(.text+0x12247c): undefined reference to `input_event'
av7110_ir.c:(.text+0x122495): undefined reference to `input_event'
av7110_ir.c:(.text+0x122569): undefined reference to `input_event'
av7110_ir.c:(.text+0x1225a7): undefined reference to `input_event'
drivers/built-in.o:av7110_ir.c:(.text+0x122629): more undefined
references to `input_event' follow
drivers/built-in.o: In function `av7110_ir_init':
(.text+0x1227e4): undefined reference to `input_allocate_device'
drivers/built-in.o: In function `av7110_ir_init':
(.text+0x12298f): undefined reference to `input_register_device'
drivers/built-in.o: In function `av7110_ir_init':
(.text+0x12299e): undefined reference to `input_free_device'
drivers/built-in.o: In function `av7110_ir_exit':
(.text+0x122a94): undefined reference to `input_unregister_device'

drivers/built-in.o: In function `av7110_detach':
av7110.c:(.text+0x228d4a): undefined reference to `av7110_ir_exit'
drivers/built-in.o: In function `arm_thread':
av7110.c:(.text+0x22a404): undefined reference to `av7110_check_ir_config'
av7110.c:(.text+0x22a626): undefined reference to `av7110_check_ir_config'
drivers/built-in.o: In function `av7110_attach':
av7110.c:(.text+0x22b08c): undefined reference to `av7110_ir_init'

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Reported-by: Randy Dunlap <rdunlap@infradead.org>
Reported-by: Jim Davis <jim.epost@gmail.com>
Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:38 -05:00
Mauro Carvalho Chehab 85c1abcb52 [media] usbtv: Make it dependent on ALSA
Now that alsa code is part of the driver, it can be compiled
only if alsa is enabled.

   drivers/built-in.o: In function `snd_usbtv_hw_free':
>> usbtv-audio.c:(.text+0x21eb55): undefined reference to `snd_pcm_lib_free_pages'
   drivers/built-in.o: In function `snd_usbtv_hw_params':
>> usbtv-audio.c:(.text+0x21eb72): undefined reference to `snd_pcm_lib_malloc_pages'
   drivers/built-in.o: In function `usbtv_audio_urb_received':
>> usbtv-audio.c:(.text+0x21ed66): undefined reference to `snd_pcm_link_rwlock'
>> usbtv-audio.c:(.text+0x21ed9f): undefined reference to `snd_pcm_link_rwlock'
>> usbtv-audio.c:(.text+0x21edf5): undefined reference to `snd_pcm_period_elapsed'
   drivers/built-in.o: In function `usbtv_audio_init':
>> (.text+0x21f00a): undefined reference to `snd_card_new'
   drivers/built-in.o: In function `usbtv_audio_init':
>> (.text+0x21f0a2): undefined reference to `snd_pcm_new'
   drivers/built-in.o: In function `usbtv_audio_init':
>> (.text+0x21f0e5): undefined reference to `snd_pcm_set_ops'
   drivers/built-in.o: In function `usbtv_audio_init':
>> (.text+0x21f103): undefined reference to `snd_pcm_lib_preallocate_pages_for_all'
   drivers/built-in.o: In function `usbtv_audio_init':
>> (.text+0x21f10c): undefined reference to `snd_card_register'
   drivers/built-in.o: In function `usbtv_audio_init':
>> (.text+0x21f12a): undefined reference to `snd_card_free'
   drivers/built-in.o: In function `usbtv_audio_free':
>> (.text+0x21f15c): undefined reference to `snd_card_free'
>> drivers/built-in.o:(.data+0x43250): undefined reference to `snd_pcm_lib_ioctl'

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:38 -05:00
Shuah Khan 66cae53024 [media] media: fix au0828 dvb suspend/resume to call dvb_frontend_suspend/resume
au0828 doesn't resume correctly and TV tuning fails with
xc_set_signal_source(0) failed message. Change au0828 dvb
suspend and resume interfaces to suspend and resume frontend
during suspend and resume respectively. dvb_frontend_suspend()
suspends tuner and fe using tuner and fe ops. dvb_frontend_resume()
resumes fe and tuner using fe and tuner ops ini before waking up
the frontend. With this change HVR950Q suspend and resume work
when system gets suspended when digital function is tuned to a
channel and with active TV stream, and after resume it went right
back to active TV stream.

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:38 -05:00
Frank Schaefer 662c97cf8f [media] em28xx-v4l: fix video buffer field order reporting in progressive mode
The correct field order in progressive mode is V4L2_FIELD_NONE, not V4L2_FIELD_INTERLACED.

Cc: <stable@vger.kernel.org>
Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:38 -05:00
Frank Schaefer 627530c32a [media] em28xx-v4l: give back all active video buffers to the vb2 core properly on streaming stop
When a new video frame is started, the driver takes the next video buffer from
the list of active buffers and moves it to dev->usb_ctl.vid_buf / dev->usb_ctl.vbi_buf
for further processing.

On streaming stop we currently only give back the pending buffers from the list
but not the ones which are currently processed.

This causes the following warning from the vb2 core since kernel 3.15:

...
 ------------[ cut here ]------------
 WARNING: CPU: 1 PID: 2284 at drivers/media/v4l2-core/videobuf2-core.c:2115 __vb2_queue_cancel+0xed/0x150 [videobuf2_core]()
 [...]
 Call Trace:
  [<c0769c46>] dump_stack+0x48/0x69
  [<c0245b69>] warn_slowpath_common+0x79/0x90
  [<f925e4ad>] ? __vb2_queue_cancel+0xed/0x150 [videobuf2_core]
  [<f925e4ad>] ? __vb2_queue_cancel+0xed/0x150 [videobuf2_core]
  [<c0245bfd>] warn_slowpath_null+0x1d/0x20
  [<f925e4ad>] __vb2_queue_cancel+0xed/0x150 [videobuf2_core]
  [<f925fa35>] vb2_internal_streamoff+0x35/0x90 [videobuf2_core]
  [<f925fac5>] vb2_streamoff+0x35/0x60 [videobuf2_core]
  [<f925fb27>] vb2_ioctl_streamoff+0x37/0x40 [videobuf2_core]
  [<f8e45895>] v4l_streamoff+0x15/0x20 [videodev]
  [<f8e4925d>] __video_do_ioctl+0x23d/0x2d0 [videodev]
  [<f8e49020>] ? video_ioctl2+0x20/0x20 [videodev]
  [<f8e48c63>] video_usercopy+0x203/0x5a0 [videodev]
  [<f8e49020>] ? video_ioctl2+0x20/0x20 [videodev]
  [<c039d0e7>] ? fsnotify+0x1e7/0x2b0
  [<f8e49012>] video_ioctl2+0x12/0x20 [videodev]
  [<f8e49020>] ? video_ioctl2+0x20/0x20 [videodev]
  [<f8e4461e>] v4l2_ioctl+0xee/0x130 [videodev]
  [<f8e44530>] ? v4l2_open+0xf0/0xf0 [videodev]
  [<c0378de2>] do_vfs_ioctl+0x2e2/0x4d0
  [<c0368eec>] ? vfs_write+0x13c/0x1c0
  [<c0369a8f>] ? vfs_writev+0x2f/0x50
  [<c0379028>] SyS_ioctl+0x58/0x80
  [<c076fff3>] sysenter_do_call+0x12/0x12
 ---[ end trace 5545f934409f13f4 ]---
...

Many thanks to Hans Verkuil, whose recently added check in the vb2 core unveiled
this long standing issue and who has investigated it further.

Cc: <stable@vger.kernel.org>
Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:37 -05:00
Axel Lin c0d04f4026 [media] via-camera: Include media/v4l2-image-sizes.h
So we can remove the same defines in the driver code.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:37 -05:00
Axel Lin 7c5a62e1ee [media] sh_veu: Include media/v4l2-image-sizes.h
So we can remove the same defines in the driver code.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:37 -05:00
Axel Lin 91ba0e59ba [media] tda7432: Fix setting TDA7432_MUTE bit for TDA7432_RF register
Fix a copy-paste bug when converting to the control framework.

Fixes: commit 5d478e0de8 ("[media] tda7432: convert to the control framework")

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:36 -05:00
Axel Lin a14e55190b [media] soc_camera: ov772x: Include media/v4l2-image-sizes.h
So we can remove the same defines in the driver code.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:36 -05:00
Axel Lin 665152a4fb [media] soc_camera: mt9t112: Include media/v4l2-image-sizes.h
So we can remove the same defines in the driver code.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:36 -05:00
Axel Lin 37096b476b [media] vs6624: Include media/v4l2-image-sizes.h
So we can remove the same defines in the driver code.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:36 -05:00
Axel Lin 4721b3eb66 [media] ov7670: Include media/v4l2-image-sizes.h
So we can remove the same defines in the driver code.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:35 -05:00
Ulrich Eckhardt 6ddc2be511 [media] imon: Fix not working front panel
Make the front panel buttons working after another button on the
remote was pressed.

Signed-off-by: Ulrich Eckhardt <uli@uli-eckhardt.de>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:35 -05:00
Ulrich Eckhardt 7b5fc07149 [media] imon: Add internal key table for 15c2:0034
Add the key table for the Thermaltake DH-102 to the USB-Id 15c2:0034.

Signed-off-by: Ulrich Eckhardt <uli@uli-eckhardt.de>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:34 -05:00
Ulrich Eckhardt 0d8053f2ac [media] imon: Define keytables per USB Device Id
This patch defines the keytables per USB Device ID.

Signed-off-by: Ulrich Eckhardt <uli@uli-eckhardt.de>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:34 -05:00
Federico Simoncelli 63ddf68de5 [media] usbtv: add audio support
Add an ALSA handler inside usbtv module, in order to make
audio to work with those devices.

Signed-off-by: Federico Simoncelli <fsimonce@redhat.com>
Tested-by: Lubomir Rintel <lkundrak@v3.sk>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:34 -05:00
Andreas Ruprecht c8fa50549d [media] drivers: media: pci: Makefile: Remove duplicate subdirectory from obj-y
In the list of subdirectories compiled, b2c2/ appears twice.

This patch removes one of the appearances.

Signed-off-by: Andreas Ruprecht <rupran@einserver.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:33 -05:00
Axel Lin 6af6e9c84f [media] saa6752hs: Convert to devm_kzalloc()
Using the managed function the kfree() calls can be removed from the
probe error path and the remove handler.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:33 -05:00
Geert Uytterhoeven 43e9d4ab0c [media] cx23885: Spelling s/compuations/computations/
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:33 -05:00
Geert Uytterhoeven d720b7aff6 [media] cx25840: Spelling s/compuations/computations/
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:32 -05:00
Hans Verkuil 0821344d9e [media] vb2: use pr_info instead of pr_debug
Modern kernels enable dynamic printk support, which is fine, except when it is
combined with a debug module option. Enabling debug in videobuf2-core now produces
no debugging unless it is also enabled through the dynamic printk support in debugfs.

Either use a debug module option + pr_info, or use pr_debug without a debug module
option. In this case the fact that you can set various debug levels is very useful,
so I believe that for videobuf2-core.c we should use pr_info.

The mix of the two is very confusing: I've spent too much time already trying to
figure out why I am not seeing any debug output in the kernel log when I do:

	echo 1 >/sys/modules/videobuf2_core/parameters/debug

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:32 -05:00
Hans Verkuil f035eb4e97 [media] videobuf2: fix lockdep warning
The following lockdep warning has been there ever since commit a517cca6b2
one year ago:

[  403.117947] ======================================================
[  403.117949] [ INFO: possible circular locking dependency detected ]
[  403.117953] 3.16.0-rc6-test-media #961 Not tainted
[  403.117954] -------------------------------------------------------
[  403.117956] v4l2-ctl/15377 is trying to acquire lock:
[  403.117959]  (&dev->mutex#3){+.+.+.}, at: [<ffffffffa005a6c3>] vb2_fop_mmap+0x33/0x90 [videobuf2_core]
[  403.117974]
[  403.117974] but task is already holding lock:
[  403.117976]  (&mm->mmap_sem){++++++}, at: [<ffffffff8118291f>] vm_mmap_pgoff+0x6f/0xc0
[  403.117987]
[  403.117987] which lock already depends on the new lock.
[  403.117987]
[  403.117990]
[  403.117990] the existing dependency chain (in reverse order) is:
[  403.117992]
[  403.117992] -> #1 (&mm->mmap_sem){++++++}:
[  403.117997]        [<ffffffff810d733c>] validate_chain.isra.39+0x5fc/0x9a0
[  403.118006]        [<ffffffff810d8bc3>] __lock_acquire+0x4d3/0xd30
[  403.118010]        [<ffffffff810d9da7>] lock_acquire+0xa7/0x160
[  403.118014]        [<ffffffff8118c9ec>] might_fault+0x7c/0xb0
[  403.118018]        [<ffffffffa0028a25>] video_usercopy+0x425/0x610 [videodev]
[  403.118028]        [<ffffffffa0028c25>] video_ioctl2+0x15/0x20 [videodev]
[  403.118034]        [<ffffffffa0022764>] v4l2_ioctl+0x184/0x1a0 [videodev]
[  403.118040]        [<ffffffff811d77d0>] do_vfs_ioctl+0x2f0/0x4f0
[  403.118307]        [<ffffffff811d7a51>] SyS_ioctl+0x81/0xa0
[  403.118311]        [<ffffffff8199dc69>] system_call_fastpath+0x16/0x1b
[  403.118319]
[  403.118319] -> #0 (&dev->mutex#3){+.+.+.}:
[  403.118324]        [<ffffffff810d6a96>] check_prevs_add+0x746/0x9f0
[  403.118329]        [<ffffffff810d733c>] validate_chain.isra.39+0x5fc/0x9a0
[  403.118333]        [<ffffffff810d8bc3>] __lock_acquire+0x4d3/0xd30
[  403.118336]        [<ffffffff810d9da7>] lock_acquire+0xa7/0x160
[  403.118340]        [<ffffffff81999664>] mutex_lock_interruptible_nested+0x64/0x640
[  403.118344]        [<ffffffffa005a6c3>] vb2_fop_mmap+0x33/0x90 [videobuf2_core]
[  403.118349]        [<ffffffffa0022122>] v4l2_mmap+0x62/0xa0 [videodev]
[  403.118354]        [<ffffffff81197270>] mmap_region+0x3d0/0x5d0
[  403.118359]        [<ffffffff8119778d>] do_mmap_pgoff+0x31d/0x400
[  403.118363]        [<ffffffff81182940>] vm_mmap_pgoff+0x90/0xc0
[  403.118366]        [<ffffffff81195cef>] SyS_mmap_pgoff+0x1df/0x2a0
[  403.118369]        [<ffffffff810085c2>] SyS_mmap+0x22/0x30
[  403.118376]        [<ffffffff8199dc69>] system_call_fastpath+0x16/0x1b
[  403.118381]
[  403.118381] other info that might help us debug this:
[  403.118381]
[  403.118383]  Possible unsafe locking scenario:
[  403.118383]
[  403.118385]        CPU0                    CPU1
[  403.118387]        ----                    ----
[  403.118388]   lock(&mm->mmap_sem);
[  403.118391]                                lock(&dev->mutex#3);
[  403.118394]                                lock(&mm->mmap_sem);
[  403.118397]   lock(&dev->mutex#3);
[  403.118400]
[  403.118400]  *** DEADLOCK ***
[  403.118400]
[  403.118403] 1 lock held by v4l2-ctl/15377:
[  403.118405]  #0:  (&mm->mmap_sem){++++++}, at: [<ffffffff8118291f>] vm_mmap_pgoff+0x6f/0xc0
[  403.118411]
[  403.118411] stack backtrace:
[  403.118415] CPU: 0 PID: 15377 Comm: v4l2-ctl Not tainted 3.16.0-rc6-test-media #961
[  403.118418] Hardware name: VMware, Inc. VMware Virtual Platform/440BX Desktop Reference Platform, BIOS 6.00 07/31/2013
[  403.118420]  ffffffff82a6c9d0 ffff8800af37fb00 ffffffff819916a2 ffffffff82a6c9d0
[  403.118425]  ffff8800af37fb40 ffffffff810d5715 ffff8802308e4200 0000000000000000
[  403.118429]  ffff8802308e4a48 ffff8802308e4a48 ffff8802308e4200 0000000000000001
[  403.118433] Call Trace:
[  403.118441]  [<ffffffff819916a2>] dump_stack+0x4e/0x7a
[  403.118445]  [<ffffffff810d5715>] print_circular_bug+0x1d5/0x2a0
[  403.118449]  [<ffffffff810d6a96>] check_prevs_add+0x746/0x9f0
[  403.118455]  [<ffffffff8119c172>] ? find_vmap_area+0x42/0x70
[  403.118459]  [<ffffffff810d733c>] validate_chain.isra.39+0x5fc/0x9a0
[  403.118463]  [<ffffffff810d8bc3>] __lock_acquire+0x4d3/0xd30
[  403.118468]  [<ffffffff810d9da7>] lock_acquire+0xa7/0x160
[  403.118472]  [<ffffffffa005a6c3>] ? vb2_fop_mmap+0x33/0x90 [videobuf2_core]
[  403.118476]  [<ffffffffa005a6c3>] ? vb2_fop_mmap+0x33/0x90 [videobuf2_core]
[  403.118480]  [<ffffffff81999664>] mutex_lock_interruptible_nested+0x64/0x640
[  403.118484]  [<ffffffffa005a6c3>] ? vb2_fop_mmap+0x33/0x90 [videobuf2_core]
[  403.118488]  [<ffffffffa005a6c3>] ? vb2_fop_mmap+0x33/0x90 [videobuf2_core]
[  403.118493]  [<ffffffff810d8055>] ? mark_held_locks+0x75/0xa0
[  403.118497]  [<ffffffffa005a6c3>] vb2_fop_mmap+0x33/0x90 [videobuf2_core]
[  403.118502]  [<ffffffffa0022122>] v4l2_mmap+0x62/0xa0 [videodev]
[  403.118506]  [<ffffffff81197270>] mmap_region+0x3d0/0x5d0
[  403.118510]  [<ffffffff8119778d>] do_mmap_pgoff+0x31d/0x400
[  403.118513]  [<ffffffff81182940>] vm_mmap_pgoff+0x90/0xc0
[  403.118517]  [<ffffffff81195cef>] SyS_mmap_pgoff+0x1df/0x2a0
[  403.118521]  [<ffffffff810085c2>] SyS_mmap+0x22/0x30
[  403.118525]  [<ffffffff8199dc69>] system_call_fastpath+0x16/0x1b

The reason is that vb2_fop_mmap and vb2_fop_get_unmapped_area take the core lock
while they are called with the mmap_sem semaphore held. But elsewhere in the code
the core lock is taken first but calls to copy_to/from_user() can take the mmap_sem
semaphore as well, potentially causing a classical A-B/B-A deadlock.

However, the mmap/get_unmapped_area calls really shouldn't take the core lock
at all. So what would happen if they don't take the core lock anymore?

There are two situations that need to be taken into account: calling mmap while
new buffers are being added and calling mmap while buffers are being deleted.

The first case works almost fine without a lock: in all cases mmap relies on
correctly filled-in q->num_buffers/q->num_planes values and those are only
updated by reqbufs and create_buffers *after* any new buffers have been
initialized completely. Except in one case: if an error occurred while allocating
the buffers it will increase num_buffers and rely on __vb2_queue_free to
decrease it again. So there is a short period where the buffer information
may be wrong.

The second case definitely does pose a problem: buffers may be in the process
of being deleted, without the internal structure being updated.

In order to fix this a new mutex is added to vb2_queue that is taken when
buffers are allocated or deleted, and in vb2_mmap. That way vb2_mmap won't
get stale buffer data. Note that this is a problem only for MEMORY_MMAP, so
even though __qbuf_userptr and __qbuf_dmabuf also mess around with buffers
(mem_priv in particular), this doesn't clash with vb2_mmap or
vb2_get_unmapped_area since those are MMAP specific.

As an additional bonus the hack in __buf_prepare, the USERPTR case, can be
removed as well since mmap() no longer takes the core lock.

All in all a much cleaner solution.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:31 -05:00
Dan Carpenter 23d3090f8b [media] vmalloc_sg: off by one in error handling
The "i--" needs to happen at the start of the loop or it will try to
release something bogus (probably it will crash) and it won't release
the first ->vaddr_page[].

Fixes: 7b4eeed174 ('[media] vmalloc_sg: make sure all pages in vmalloc area are really DMA-ready')

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:31 -05:00
Mauro Carvalho Chehab 5b6aa19919 [media] as102-fe: Add a release function
This is needed to free state and for dvb_detach() to be
called.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:31 -05:00
Mauro Carvalho Chehab 4628f993bf [media] as102: add missing viterbi lock
In order to get FE_HAS_SYNC, the viterbi should already be
locked too. So, add the missing FE_HAS_VITERBI lock.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:31 -05:00
Mauro Carvalho Chehab dcae778148 [media] as102-fe: make it an independent driver
Move as102-fe to dvb-frontends directory and make it an
independent driver.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:30 -05:00
Mauro Carvalho Chehab 47f79129ec [media] as102: prepare as102_fe to be compiled as a module
Remove the dependencies of as102_cmd from as102, in order to
allow it to be compiled as a separate module.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:30 -05:00
Mauro Carvalho Chehab c098c219b0 [media] as102: get rid of as10x_fe_copy_tps_parameters()
This function just converts from the as10x internal data into
the DVBv5 cache. Get rid of it.

No functional changes.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:30 -05:00
Mauro Carvalho Chehab 1d6207fd2c [media] as102: get rid of as102_fe_copy_tune_parameters()
This function just parses the frontend cache and converts
to the as102 internal format message. Get rid of it.

No functional changes.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:29 -05:00
Mauro Carvalho Chehab b601d9a5d6 [media] as102: Move ancillary routines to the beggining
Avoid having function prototypes by moving some
ancillary routines to the beginning of the file.

No functional changes.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:29 -05:00
Mauro Carvalho Chehab d8eb070b66 [media] as102: better name the unknown frontend
Make the frontend .name more coherent with DVB namespace.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:29 -05:00
Mauro Carvalho Chehab 1d5c2bb1f9 [media] as102: CodingStyle fixes
Fix this warning:

WARNING: quoted string split across lines
566: FILE: drivers/media/usb/as102/as102_fe.c:141:
+				"demod status: fc: 0x%08x, bad fc: 0x%08x, "
+				"bytes corrected: 0x%08x , MER: 0x%04x\n",

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:29 -05:00
Mauro Carvalho Chehab 1f2563d68c [media] as102: get rid of FSF mail address
Make checkpatch happier by removing FSF mail address.

No functional changes.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:28 -05:00
Mauro Carvalho Chehab d6317c68f3 [media] as102: promote it out of staging
This driver is stable and doesn't contain any really serious
issue. Move it out of staging.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:28 -05:00
Mauro Carvalho Chehab 29bbb7bd0a [media] siano: add support for PCTV 77e
Add support for PCTV microStick (77e) device that uses a sms1140
chipset.

Cc: stable@vger.kernel.org
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:27 -05:00
Sakari Ailus a328e7e3fd [media] smiapp: Set 64-bit integer control using v4l2_ctrl_s_ctrl_int64()
Don't manipulate struct v4l2_ctrl directly. Instead, use
v4l2_ctrl_s_ctrl_int64() to change the values.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:27 -05:00
Sakari Ailus e47a81d888 [media] smiapp: Use unlocked __v4l2_ctrl_modify_range()
Instead of modifying the control ranges directly by manipulating struct
v4l2_ctrl, use __v4l2_ctrl_modify_range() for the purpose.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:27 -05:00
Philipp Zabel f23797b636 [media] coda: checkpatch cleanup
This patch breaks most long lines, concatenates broken up text strings,
and adds or removes parentheses where needed to make checkpatch happy.
The long codec list lines and a few 81-wide lines remain.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:26 -05:00
Philipp Zabel a188a668dd [media] coda: disable old cropping ioctls
Since we neither support composing on the OUTPUT side, nor cropping
on the CAPTURE side, disable VIDIOC_CROPCAP and VIDIOC_G/S_CROP
altogether. This silences a GStreamer warning when GStreamer tries
to obtain the pixel aspect ratio using VIDIOC_CROPCAP.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:26 -05:00
Philipp Zabel f95a6ce167 [media] coda: set capture frame size with output S_FMT
This patch makes coda_s_fmt_vid_out propagate the output frame size
to the capture side.
The GStreamer v4l2videodec only ever calls S_FMT on the output side
and then expects G_FMT on the capture side to return a valid format.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:26 -05:00
Philipp Zabel 2dc546d00c [media] coda: fix coda_s_fmt_vid_out
Set the context color space when s_fmt succeeded, not when it failed.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:26 -05:00
Philipp Zabel 18fd0cceb9 [media] coda: fix timestamp list handling
Lock modification of the timestamp list with bitstream_mutex and do not
try to remove a timestamp element if the list is empty. This can happen
if the userspace feeds us garbage or multiple encoded frames in a single
buffer.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:25 -05:00
Philipp Zabel 68fc31c5d2 [media] coda: improve allocation error messages
Produce some error messages when internal buffer allocation
fails, for example because the CMA region is too small.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:25 -05:00
Philipp Zabel d60b18ba31 [media] coda: add an intermediate debug level
Dumping all register accesses drowns other debugging messages
in the log. Add a less verbose debug level.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:25 -05:00
Philipp Zabel b0ed05b902 [media] coda: increase max vertical frame size to 1088
This patch increases the maximum vertical frame size reported
by enum_fmt and accepted by try_fmt/s_fmt from 1080 to 1088.
Since for 16x16-pixel macroblocks 1080p will be rounded up to
this anyway, we may as well admit that we support it.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:25 -05:00
Philipp Zabel 8be31c898d [media] coda: allow running coda without iram on mx6dl
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:24 -05:00
Philipp Zabel fcf59764b9 [media] coda: skip calling coda_find_codec in encoder try_fmt_vid_out
We know that it will return NULL in this case, so we can just as well
skip it altogether.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:24 -05:00
Philipp Zabel 4a31b52fca [media] coda: dequeue buffers on streamoff
This is needed to decrease the q->owned_by_drv_count to zero before
__vb2_queue_cancel is called, to avoid the WARN_ON therein.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:24 -05:00
Philipp Zabel b906352c23 [media] coda: dequeue buffers if start_streaming fails
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:24 -05:00
Philipp Zabel 540b72e415 [media] coda: request BIT processor interrupt by name
Request the main coda interrupt using its name, "bit", if available.
Fall back to requesting the first interrupt for backwards compatibility.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:23 -05:00
Philipp Zabel 5727a5a4a1 [media] coda: remove unnecessary peek at next destination buffer from coda_finish_decode
The return value of this call to v4l2_m2m_next_dst_buf() is never used.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:23 -05:00
Philipp Zabel 2c3759d406 [media] coda: include header for memcpy
coda_h264_padding uses memcpy, we should include string.h for that.

Reported-by: Ian Jamison <ian.dev@arkver.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:23 -05:00
Philipp Zabel 79924ca9cf [media] coda: move BIT specific functions into separate file
This patch moves the BIT processor specific coda_context_ops, the firmware
upload and other related functions from coda-common.c into coda-bit.c.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:22 -05:00
Philipp Zabel 4f4ee9ee88 [media] coda: move H.264 helper function into separate file
Currently there is only the coda_h264_padding function, but
we will have to add more H.264 specific helpers later.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:22 -05:00
Philipp Zabel 58b7677db0 [media] coda: move per-instance buffer allocation and cleanup
This patch moves the context buffer allocation into the context start_streaming
callbacks. The context buffer and internal framebuffer cleanup is moved into
the context release callback.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:22 -05:00
Philipp Zabel 347bb7f019 [media] coda: add coda_bit_stream_set_flag helper
This adds a helper function to consolidate three occurences where
the bitstream parameter stream end flag is set during operation.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:22 -05:00
Philipp Zabel 8a82c6ba2e [media] coda: move BIT processor command execution out of pic_run_work
In preparation for the split, move the AXI_SRAM_USE register access and the
PIC_RUN command execution out of pic_run_work into prepare_encode/decode.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:21 -05:00
Philipp Zabel a1192a17ee [media] coda: add context ops
Add a struct coda_context_ops that encapsulates context specific operations.
This will simplify adding JPEG support in the future and helps to avoid
exporting all functions individually when they move out of the main code
file.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:21 -05:00
Philipp Zabel a2b3e46acb [media] coda: move defines, enums, and structs into shared header
These will have to be shared between multiple code files.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:21 -05:00
Philipp Zabel e19a763950 [media] coda: move coda driver into its own directory
The coda driver has grown significantly and will continue to grow.
Move the coda driver into its own directory so it can be split.
Rename coda.h to coda_regs.h as it contains the register defines.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:21 -05:00
Philipp Zabel 814c376255 [media] coda: mark constant structures as such
The format and codec lists and the ops structures are read-only.
Mark them as const.

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:20 -05:00
Philipp Zabel 4f31ff0102 [media] coda: default to h.264 decoder on invalid formats
If the user provides an invalid format, let the decoder device
default to h.264.

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:20 -05:00
Philipp Zabel 22e244b813 [media] coda: split format enumeration for encoder end decoder device
Let the decoder capture side and encoder output side only list
uncompressed formats, and the decoder output and encoder capture
side only list compressed formats.

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:20 -05:00
Philipp Zabel 121cacf445 [media] coda: split userspace interface into encoder and decoder device
Userspace has a hard time making sense of format enumerations on V4L2
mem2mem devices if there are restrictions on which input and output
formats can be used together. Alleviate the problem by splitting the
video4linux device into separate encoder and decoder devices which list
only raw formats on one side and only encoded formats on the other side.
With this patch, the instance type (encoder or decoder) is already
determined by the open file operation.

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:20 -05:00
Philipp Zabel 91b5841e24 [media] coda: lock capture frame size to output frame size when streaming
As soon as the output queue is streaming, let try_fmt on the capture side
only allow the frame size that was set on the output side.

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:19 -05:00
Michael Olbrich eabed931df [media] coda: delay coda_fill_bitstream()
coda_fill_bitstream() calls v4l2_m2m_buf_done() which is no longer allowed
before streaming was started.
Delay coda_fill_bitstream() until coda_start_streaming() and explicitly set
'start_streaming_called' before calling coda_fill_bitstream()

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:19 -05:00
Michael Olbrich 390503bdb4 [media] coda: use CODA_MAX_FRAME_SIZE everywhere
Without this changing CODA_MAX_FRAME_SIZE to anything other than 0x100000
can break the bitstram handling

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:19 -05:00
Philipp Zabel d29a8cf24d [media] coda: remove VB2_USERPTR from queue io_modes
Disallow USERPTR buffers, videobuf2-dma-contig doesn't support them.

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:18 -05:00
Philipp Zabel 3898e7a72d [media] coda: remove CAPTURE and OUTPUT caps
This is a mem2mem driver, pure capture or output modes are not
supported.

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:18 -05:00
Philipp Zabel 65919e6baa [media] coda: initialize hardware on pm runtime resume only if firmware available
If no firmware was found and the coda module is unloaded, coda_runtime_resume
will be called without an allocated code buffer. Do not call coda_hw_init in
this case.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:18 -05:00
Philipp Zabel ae5abd2561 [media] coda: fix CODA7541 hardware reset
Do not try to read the CODA960 GDI status register on CODA7541.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:18 -05:00
Laurent Pinchart cd73bb6c4e [media] omap3isp: resizer: Protect against races when updating crop
When updating the crop rectangle during streaming, the IRQ handler will
reprogram the resizer after the current frame. A race condition
currently exists between the set selection operation and the IRQ
handler: if the set selection operation is called twice in a row and the
IRQ handler runs only during the second call, it could reprogram the
hardware with partially updated values. Use a spinlock to protect
against that.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:17 -05:00
Laurent Pinchart d903a0a367 [media] omap3isp: resizer: Remove slow debugging message from interrupt handler
The resizer_set_input_size() function prints a debugging message with
the input width and height values. As the function is called from
interrupt context, printing that message to the serial console could
slow down the interrupt handler and cause it to miss the start of the
next frame, causing image corruption.

Fix this by reorganizing the resizer debug messages. The driver now
prints the input size, the crop rectangle and the output size in the set
selection handler instead of scattering debug messages in various
places.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:17 -05:00
Laurent Pinchart 41316a27ee [media] omap3isp: resizer: Remove needless variable initializations
There's no need to initialize local variables to zero when they're
explicitly assigned another value right after. Remove the needless
initializations.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:17 -05:00
Laurent Pinchart ca84ea49f8 [media] omap3isp: ccdc: Restart the CCDC immediately after an underrun in BT.656
As the CCDC doesn't generate interrupts when stopped in BT.656 mode,
restart it immediately when the next buffer after an underrun is queued
instead of relying on the interrupt handler to restart the CCDC.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Enrico Butera <ebutera@users.sourceforge.net>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:17 -05:00
Laurent Pinchart 0b3fcd5727 [media] omap3isp: ccdc: Don't timeout on stream off when the CCDC is stopped
When the CCDC is already stopped due to a buffer underrun, the stop
state machine won't advance in BT.656 mode as no interrupt are generated
by the stopped CCDC in that mode. Handle this case explicitly in the
ccdc_disable() function.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Enrico Butera <ebutera@users.sourceforge.net>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:16 -05:00
Laurent Pinchart 93456527b4 [media] omap3isp: ccdc: Fix freeze when a short frame is received
In BT.656 mode the synchronization signals are generated by the CCDC
from the embedded sync codes. The VD0 and VD1 interrupts are thus only
triggered when the CCDC is enabled, unlike external sync mode where the
line counter runs even when the CCDC is stopped. We can't disable the
CCDC at VD1 time, as no VD0 interrupt would be generated for a short
frame, which would result in the CCDC being stopped and no VD interrupt
generated anymore. The CCDC is stopped from the VD0 interrupt handler
instead for BT.656.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Enrico Butera <ebutera@users.sourceforge.net>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:16 -05:00
Laurent Pinchart fd93c10afe [media] omap3isp: ccdc: Increment the frame number at VD0 time for BT.656
We will stop using VD1 in BT.656 mode, move frame number increment to
the VD0 interrupt handler.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Enrico Butera <ebutera@users.sourceforge.net>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:16 -05:00
Laurent Pinchart 1c74817405 [media] omap3isp: ccdc: Simplify ccdc_lsc_is_configured()
Use a local variable to avoid the duplicate spin_unlock_irqrestore()
call.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Enrico Butera <ebutera@users.sourceforge.net>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:16 -05:00
Laurent Pinchart 8815392a1d [media] omap3isp: ccdc: Rename __ccdc_handle_stopping to ccdc_handle_stopping
There's no need for a double underscore in the function name, remove it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Enrico Butera <ebutera@users.sourceforge.net>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:15 -05:00
Laurent Pinchart 93d7badf1b [media] omap3isp: ccdc: Only complete buffer when all fields are captured
Checking that the captured field corresponds to the last required field
depending on the requested field order before completing the buffer
isn't enough. When the first field at stream start corresponds to the
last required field, this would result in returning an interlaced buffer
containing a single field.

Fix this by keeping track of the fields captured in the buffer, and make
sure that both fields are present for alternate field orders.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Enrico Butera <ebutera@users.sourceforge.net>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:15 -05:00
Laurent Pinchart aec2de0e93 [media] omap3isp: ccdc: Disable the video port when unused
The video port doesn't support YUV formats. Disable it when the CCDC
sink pad format is set to YUV instead of leaving it enabled and relying
on downstream modules not to process data they receive from the video
port.

Experiments showed that this fixes some of the CCDC failures to stop,
especially in BT.656 mode.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Enrico Butera <ebutera@users.sourceforge.net>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:15 -05:00
Laurent Pinchart 9de7af4d5b [media] omap3isp: ccdc: Add support for BT.656 YUV format at the CCDC input
Query the CCDC input media bus type from the subdev connected to the
CCDC sink pad and configure the CCDC accordingly to support BT.656
synchronization.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Enrico Butera <ebutera@users.sourceforge.net>
Acked-by: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:15 -05:00
Laurent Pinchart bcb4e0efd1 [media] omap3isp: ccdc: Support the interlaced field orders at the CCDC output
The CCDC can interleave fields into a single buffer when writing to
memory. Support it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Enrico Butera <ebutera@users.sourceforge.net>
Acked-by: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:14 -05:00
Laurent Pinchart 9a36d8ed33 [media] omap3isp: ccdc: Add basic support for interlaced video
When the CCDC input is interlaced enable the alternate field order on
the CCDC output video node. The field signal polarity is specified
through platform data.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Enrico Butera <ebutera@users.sourceforge.net>
Acked-by: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:14 -05:00
Laurent Pinchart 0a7b1a0103 [media] omap3isp: ccdc: Simplify the ccdc_isr_buffer() function
Instead of using goto statements to a single line return, return the
correct value immediately.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Enrico Butera <ebutera@users.sourceforge.net>
Acked-by: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:14 -05:00
Laurent Pinchart 2e8f01725e [media] omap3isp: ccdc: Simplify the configuration function
Assign the format variable to the sink pad format earlier and use it
instead of accessing the sink pad format directly from the ISP
structure.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Enrico Butera <ebutera@users.sourceforge.net>
Acked-by: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:13 -05:00
Laurent Pinchart f7abbe989f [media] omap3isp: video: Validate the video node field order
The field order requested on the video node must match the field order
at the connected subdevice source pad.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Enrico Butera <ebutera@users.sourceforge.net>
Acked-by: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:13 -05:00
Laurent Pinchart 48a8a0cb76 [media] omap3isp: Default to progressive field order when setting the format
If the requested field order is not supported default to progressive as
we can't guess how the user will configure the pipeline later on.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Enrico Butera <ebutera@users.sourceforge.net>
Acked-by: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:13 -05:00
Laurent Pinchart 25c5cc9194 [media] omap3isp: Move non-critical code out of the mutex-protected section
The isp_video_pix_to_mbus() and isp_video_mbus_to_pix() calls in
isp_video_set_format() only access static fields of the isp_video
structure. They don't need to be protected by a mutex.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Enrico Butera <ebutera@users.sourceforge.net>
Acked-by: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:13 -05:00
Laurent Pinchart 9884a955a9 [media] omap3isp: Remove boilerplate disclaimer and FSF address
We don't want to modify all source files the day the FSF moves.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Enrico Butera <ebutera@users.sourceforge.net>
Acked-by: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:12 -05:00
Laurent Pinchart eb228e897c [media] omap3isp: Don't ignore subdev streamoff failures
Record the value returned by subdevs from s_stream(0) and handle stop
failures when an error occurs.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Enrico Butera <ebutera@users.sourceforge.net>
Acked-by: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:12 -05:00
Laurent Pinchart 24acf8b211 [media] v4l: subdev: Extend default link validation to cover field order
The field order must match between the source and sink pads, or the sink
pad field order must be NONE. This allows connecting an interlaced
source to a bridge that has no hardware support for interlaced formats.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Enrico Butera <ebutera@users.sourceforge.net>
Acked-by: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:12 -05:00
Sakari Ailus 0e2a6b7f2b [media] smiapp: Implement the test pattern control
Add support for the V4L2_CID_TEST_PATTERN control. When the solid colour
mode is selected, additional controls become available for setting the
solid four solid colour components.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:12 -05:00
Sakari Ailus 0fc8786487 [media] v4l: Add test pattern colour component controls
In many cases the test pattern has selectable values for each colour
component. Implement controls for raw bayer components. Additional controls
should be defined for colour components that are not covered by these
controls.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:11 -05:00
Mauro Carvalho Chehab 5275a3b6b0 [media] xc5000: be sure that the firmware is there before set params
Now that xc5000_set_params() is also called during resume,
move the code that checks for the firmware to happen there.

This way, the firmware will be loaded either for analog or
digital TV when .resume callback is called.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:11 -05:00
Mauro Carvalho Chehab 2930977ac5 [media] au0828: Fix DVB resume when streaming
When DVB is streaming and suspend is called, it will call
au0828_stop_transport(), with will clean the streaming flag.

Due to that, stop_urb_transfer() will be called twice,
causing an oops.

So, we need another flag to be used at resume, telling it
to restart DVB.

While here, add a logic at stop_urb_transfer() to prevent
it of being called twice, and convert the usb_streaming
flag into boolean.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:10 -05:00
Mauro Carvalho Chehab bbc62a18b6 [media] au0828: fix checks if dvb is initialized
dev->dvb is always not null, as it is an area at the dev
memory. So, checking if (dev->dvb) is always true.

Instead of this stupid check, what the code wants to do is
to know if the DVB was successully registered.

Fix it by checking, instead, for dvb->frontend. It should
also be sure that this var will be NULL if the device was
not properly initialized.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:10 -05:00
Mauro Carvalho Chehab 59b94f3e74 [media] xc5000: better name the functions
xc5000_set_params() is a bad name for a function that
handles only digital TV. Rename it to xc5000_set_digital_params(),
and proper name the generic function that works for both
digital and analog.

No functional changes.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:10 -05:00
Mauro Carvalho Chehab 7ab1c07614 [media] xc5000: add a resume function
If a device suspends/hibertates with a station tuned, restore
the tuner station at resume.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:10 -05:00
Mauro Carvalho Chehab c3d6676bba [media] xc5000: Split config and set code for analog/radio
As we need a function that reapply the last tuned radio,
in order to do resume, split the code that validates and
updates the internal priv struct from the ones that
actually set radio and TV.

A latter patch will add support for resume.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:09 -05:00
Mauro Carvalho Chehab 1643520231 [media] au0828: move the code that sets DTV on a separate function
As we'll be adding a code to resume tuner operation, we
need to move the code that actually sets DTV on a separate
function, to be called by the resume code.

No functional changes, just code got moved.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:09 -05:00
Mauro Carvalho Chehab 91a5307cb0 [media] xc5000: fix xc5000 suspend
After xc5000 stops working, it waits for 5 seconds, waiting
for a new usage. Only after that it goes to low power mode.

If a suspend event happens before that, a work queue will
remain active, with causes suspend to crash.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:09 -05:00
Mauro Carvalho Chehab 59d7889ae4 [media] dvb-frontend: add core support for tuner suspend/resume
While several tuners have some sort of suspend/resume
implementation, this is currently mangled with an optional
.sleep callback that it is also used to put the device on
low power mode.

Not all drivers implement it, as returning the driver from
low power may require to re-load the firmware, with takes
some time. Also, some drivers may delay it.

So, the more coherent is to add two new optional callbacks
that will let the tuners to directy implement suspend and
resume callbacks if they need.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:09 -05:00
Mauro Carvalho Chehab 811872404b [media] au0828: add pr_info to track au0828 suspend/resume code
Suspend/resume conditions can be very tricky. Add some info
printk's to help tracking what's happening there.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:08 -05:00
Mauro Carvalho Chehab 83afb32aa9 [media] au0828: use pr_foo macros
Instead of using printk(KERN_foo, use pr_foo() macros.

No functional changes.

Note: we should do the same for dprintk(), but that would
require to remove the dprintk levels. So, for now, let's
not touch on it.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:08 -05:00
Mauro Carvalho Chehab 3d8de92e07 [media] au0828: Remove a bad whitespace
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:08 -05:00
Mauro Carvalho Chehab 1a1ba95e80 [media] au0828: add suspend/resume code for V4L2
No timers should be enabled during suspend. So,
stop them. At resume time, we should do the proper
initialization for it to keep working.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:08 -05:00
Mauro Carvalho Chehab e2147d0af0 [media] au0828: properly handle stream on/off state
The STREAM_ON state is used by s_format callback,
but the driver never sets it.

Fix it. This will also be needed in order to handle
suspend/resume ops.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:07 -05:00
Mauro Carvalho Chehab b799de75e0 [media] au0828: Add suspend code for DVB
The scheduled work should be cancelled during suspend.

At resume time, we need to set the frontend again. So,
add such logic to the driver.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:07 -05:00
Mauro Carvalho Chehab fa500461db [media] au0828: be sure to reenable the bridge and GPIOs on resume
At resume, we should restore the register contents. So,
reenable the bridge and GPIO settings.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:07 -05:00
Mauro Carvalho Chehab aaeac1991b [media] au0828: don't let the IR polling thread to run at suspend
Trying to make au0828 to suspend can do very bad things, as
the polling Kthread is not handled. We should disable it
during suspend, only re-enabling it at resume.

Still, analog and digital TV won't work, as we don't reinit
the settings at resume, but at least it won't hang.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:07 -05:00
Shuah Khan 92143f6fb0 [media] au0828: remove CONFIG_VIDEO_AU0828_RC scope around au0828_rc_*()
Remove CONFIG_VIDEO_AU0828_RC scope around au0828_rc_register()
and au0828_rc_unregister() calls in au0828-core

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:06 -05:00
Shuah Khan 917cbcde46 [media] au0828: add au0828_rc_*() stubs for VIDEO_AU0828_RC disabled case
Define au0828_rc_*() stubs to avoid compile errors when
VIDEO_AU0828_RC is disabled and avoid the need to enclose
au0828_rc_*() in ifdef CONFIG_VIDEO_AU0828_RC in .c files.

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:06 -05:00
Mauro Carvalho Chehab 345e3bfdad [media] au0828: handle IR int during suspend/resume
It doesn't make sense to handle an IR code given before
suspending after the device resume. So, turn off IR
int while suspending.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:06 -05:00
Mauro Carvalho Chehab e9018af0b8 [media] au0828: avoid race conditions at RC stop
As the RC kthread can re-enable IR int, we should first
cancel the kthread and then disable IR int.

While here, remove a temporary debug printk.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:06 -05:00
Mauro Carvalho Chehab 2e0cc7ee75 [media] au0828-input: Be sure that IR is enabled at polling
When the DVB code sets the frontend, it disables the IR
INT, probably due to some hardware bug, as there's no code
there at au8522 frontend that writes on register 0xe0.

Fixing it at au8522 code is hard, as it doesn't know if the
IR is enabled or disabled, and just restoring the value of
register 0xe0 could cause other nasty effects. So, better
to add a hack at au0828-input polling interval to enable int,
if disabled.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:05 -05:00
Mauro Carvalho Chehab d84fdc774b [media] au0828: Enable IR for HVR-850
HVR-850 also has a remote. Enable it.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:05 -05:00
Mauro Carvalho Chehab ff346b0f5d [media] au0828: add an option to disable IR via modprobe parameter
The IR code increases the power consumption of the device.
Allow to disable it via modprobe parameter.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:05 -05:00
Mauro Carvalho Chehab f5885f4097 [media] au0828: no need to sleep at the IR code
This sleep was doing some debouncing on the original driver.
This is not needed on Linux, because the RC core and the input
layer already takes care of it.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-21 15:25:05 -05:00
Joe Perches 6850aeabdd media: use pci_zalloc_consistent
Remove the now unnecessary memset too.

Signed-off-by: Joe Perches <joe@perches.com>
Cc: Hans Verkuil <hverkuil@xs4all.nl>
Cc: Mauro Carvalho Chehab <m.chehab@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2014-08-08 15:57:28 -07:00
Linus Torvalds ae045e2455 Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next
Pull networking updates from David Miller:
 "Highlights:

   1) Steady transitioning of the BPF instructure to a generic spot so
      all kernel subsystems can make use of it, from Alexei Starovoitov.

   2) SFC driver supports busy polling, from Alexandre Rames.

   3) Take advantage of hash table in UDP multicast delivery, from David
      Held.

   4) Lighten locking, in particular by getting rid of the LRU lists, in
      inet frag handling.  From Florian Westphal.

   5) Add support for various RFC6458 control messages in SCTP, from
      Geir Ola Vaagland.

   6) Allow to filter bridge forwarding database dumps by device, from
      Jamal Hadi Salim.

   7) virtio-net also now supports busy polling, from Jason Wang.

   8) Some low level optimization tweaks in pktgen from Jesper Dangaard
      Brouer.

   9) Add support for ipv6 address generation modes, so that userland
      can have some input into the process.  From Jiri Pirko.

  10) Consolidate common TCP connection request code in ipv4 and ipv6,
      from Octavian Purdila.

  11) New ARP packet logger in netfilter, from Pablo Neira Ayuso.

  12) Generic resizable RCU hash table, with intial users in netlink and
      nftables.  From Thomas Graf.

  13) Maintain a name assignment type so that userspace can see where a
      network device name came from (enumerated by kernel, assigned
      explicitly by userspace, etc.) From Tom Gundersen.

  14) Automatic flow label generation on transmit in ipv6, from Tom
      Herbert.

  15) New packet timestamping facilities from Willem de Bruijn, meant to
      assist in measuring latencies going into/out-of the packet
      scheduler, latency from TCP data transmission to ACK, etc"

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next: (1536 commits)
  cxgb4 : Disable recursive mailbox commands when enabling vi
  net: reduce USB network driver config options.
  tg3: Modify tg3_tso_bug() to handle multiple TX rings
  amd-xgbe: Perform phy connect/disconnect at dev open/stop
  amd-xgbe: Use dma_set_mask_and_coherent to set DMA mask
  net: sun4i-emac: fix memory leak on bad packet
  sctp: fix possible seqlock seadlock in sctp_packet_transmit()
  Revert "net: phy: Set the driver when registering an MDIO bus device"
  cxgb4vf: Turn off SGE RX/TX Callback Timers and interrupts in PCI shutdown routine
  team: Simplify return path of team_newlink
  bridge: Update outdated comment on promiscuous mode
  net-timestamp: ACK timestamp for bytestreams
  net-timestamp: TCP timestamping
  net-timestamp: SCHED timestamp on entering packet scheduler
  net-timestamp: add key to disambiguate concurrent datagrams
  net-timestamp: move timestamp flags out of sk_flags
  net-timestamp: extend SCM_TIMESTAMPING ancillary data struct
  cxgb4i : Move stray CPL definitions to cxgb4 driver
  tcp: reduce spurious retransmits due to transient SACK reneging
  qlcnic: Initialize dcbnl_ops before register_netdev
  ...
2014-08-06 09:38:14 -07:00
Linus Torvalds f4d33337ea Merge branch 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media
Pull media updates from Mauro Carvalho Chehab:
 - removal of sn9c102.  This device driver was replaced a long time ago
   by gspca
 - solo6x10 and go7007 webcam drivers moved from staging into
   mainstream.  They were waiting for an API to allow setting the image
   detection matrix
 - SDR drivers moved from staging into mainstream: sdr-msi3101 (renamed
   as msi2500) and rtl2832
 - added SDR driver for airspy
 - added demux driver: si2165
 - rework at several RC subsystem, making the code for RC-5 SZ variant
   to be added at the standard RC5 decoder
 - added decoder for the XMP IR protocol
 - tuner driver moved from staging into mainstream: msi3101 (renamed as
   msi001)
 - added documentation for some additional SDR pixfmt
 - some device tree bindings documented
 - added support for exynos3250 at s5p-jpeg
 - remove the obsolete, unmaintained and broken mx1_camera driver
 - added support for remote controllers at au0828 driver
 - added a RC driver: sunxi-cir
 - several driver fixes, enhancements and cleanups.

* 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (455 commits)
  [media] cx23885: fix UNSET/TUNER_ABSENT confusion
  [media] coda: fix build error by making reset control optional
  [media] radio-miropcm20: fix sparse NULL pointer warning
  [media] MAINTAINERS: Update go7007 pattern
  [media] MAINTAINERS: Update solo6x10 patterns
  [media] media: atmel-isi: add primary DT support
  [media] media: atmel-isi: convert the pdata from pointer to structure
  [media] media: atmel-isi: add v4l2 async probe support
  [media] rcar_vin: add devicetree support
  [media] media: pxa_camera device-tree support
  [media] media: mt9m111: add device-tree suppport
  [media] soc_camera: add support for dt binding soc_camera drivers
  [media] media: soc_camera: pxa_camera documentation device-tree support
  [media] media: mt9m111: add device-tree documentation
  [media] s5p-mfc: remove unnecessary calling to function video_devdata()
  [media] s5p-jpeg: add chroma subsampling adjustment for Exynos3250
  [media] s5p-jpeg: Prevent erroneous downscaling for Exynos3250 SoC
  [media] s5p-jpeg: Assure proper crop rectangle initialization
  [media] s5p-jpeg: fix g_selection op
  [media] s5p-jpeg: Adjust jpeg_bound_align_image to Exynos3250 needs
  ...
2014-08-05 16:36:30 -07:00
Linus Torvalds 29b88e23a9 Driver core patches for 3.17-rc1
Here's the big driver-core pull request for 3.17-rc1.
 
 Largest thing in here is the dma-buf rework and fence code, that touched
 many different subsystems so it was agreed it should go through this
 tree to handle merge issues.  There's also some firmware loading
 updates, as well as tests added, and a few other tiny changes, the
 changelog has the details.
 
 All have been in linux-next for a long time.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iEYEABECAAYFAlPf1XcACgkQMUfUDdst+ylREACdHLXBa02yLrRzbrONJ+nARuFv
 JuQAoMN49PD8K9iMQpXqKBvZBsu+iCIY
 =w8OJ
 -----END PGP SIGNATURE-----

Merge tag 'driver-core-3.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core

Pull driver core updates from Greg KH:
 "Here's the big driver-core pull request for 3.17-rc1.

  Largest thing in here is the dma-buf rework and fence code, that
  touched many different subsystems so it was agreed it should go
  through this tree to handle merge issues.  There's also some firmware
  loading updates, as well as tests added, and a few other tiny changes,
  the changelog has the details.

  All have been in linux-next for a long time"

* tag 'driver-core-3.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (32 commits)
  ARM: imx: Remove references to platform_bus in mxc code
  firmware loader: Fix _request_firmware_load() return val for fw load abort
  platform: Remove most references to platform_bus device
  test: add firmware_class loader test
  doc: fix minor typos in firmware_class README
  staging: android: Cleanup style issues
  Documentation: devres: Sort managed interfaces
  Documentation: devres: Add devm_kmalloc() et al
  fs: debugfs: remove trailing whitespace
  kernfs: kernel-doc warning fix
  debugfs: Fix corrupted loop in debugfs_remove_recursive
  stable_kernel_rules: Add pointer to netdev-FAQ for network patches
  driver core: platform: add device binding path 'driver_override'
  driver core/platform: remove unused implicit padding in platform_object
  firmware loader: inform direct failure when udev loader is disabled
  firmware: replace ALIGN(PAGE_SIZE) by PAGE_ALIGN
  firmware: read firmware size using i_size_read()
  firmware loader: allow disabling of udev as firmware loader
  reservation: add suppport for read-only access using rcu
  reservation: update api and add some helpers
  ...

Conflicts:
	drivers/base/platform.c
2014-08-04 18:34:04 -07:00
Hans Verkuil 0f3bf3dc1c [media] cx23885: fix UNSET/TUNER_ABSENT confusion
Sometimes dev->tuner_type is compared to UNSET, sometimes to TUNER_ABSENT,
but these defines have different values.

Standardize to TUNER_ABSENT.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-01 15:30:59 -03:00
Philipp Zabel ee27aa9018 [media] coda: fix build error by making reset control optional
make reset control optional for i.MX27

The patch "[media] coda: add reset control support" introduced a build failure
if CONFIG_RESET_CONTROLLER is disabled:

    drivers/media/platform/coda.c:3734:2: error: implicit declaration of
     function 'devm_reset_control_get'

Since not all SoCs containing CODA VPUs do have a system reset controller,
use devm_reset_control_get_optional to make it optional.

Reported-by: Shawn Guo <shawn.guo@linaro.org>
Reported-by: Olof's autobuilder <build@lixom.net>
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-08-01 15:27:14 -03:00
Wei Yongjun 27dcb00d0d [media] radio-miropcm20: fix sparse NULL pointer warning
Fixes the following sparse warnings:

drivers/media/radio/radio-miropcm20.c:193:33: warning:
 Using plain integer as NULL pointer

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-30 19:50:09 -03:00
Josh Wu 8ff19bc437 [media] media: atmel-isi: add primary DT support
This patch add the DT support for Atmel ISI driver.
It use the same v4l2 DT interface that defined in video-interfaces.txt.

Signed-off-by: Josh Wu <josh.wu@atmel.com>
Cc: devicetree@vger.kernel.org
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-30 19:48:36 -03:00
Josh Wu 833e106326 [media] media: atmel-isi: convert the pdata from pointer to structure
Now the platform data is initialized by allocation of isi
structure. In the future, we use pdata to store the dt parameters.

Signed-off-by: Josh Wu <josh.wu@atmel.com>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-30 19:47:19 -03:00
Josh Wu 3900623bfa [media] media: atmel-isi: add v4l2 async probe support
Signed-off-by: Josh Wu <josh.wu@atmel.com>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-30 19:35:06 -03:00
Ben Dooks 47c71bd61b [media] rcar_vin: add devicetree support
Add support for devicetree probe for the rcar-vin
driver.

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
[g.liakhovetski@gmx.de fix a typo, sort headers alphabetically]
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-30 19:34:45 -03:00
Robert Jarzmik e9a1d94fa8 [media] media: pxa_camera device-tree support
Add device-tree support to pxa_camera host driver.

Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
[g.liakhovetski@gmx.de: added of_node_put()]
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-30 19:32:14 -03:00
Robert Jarzmik c5f176dc19 [media] media: mt9m111: add device-tree suppport
Add device-tree support for mt9m111 camera sensor.

Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-30 19:30:35 -03:00
Ben Dooks 1ddc6a6caa [media] soc_camera: add support for dt binding soc_camera drivers
Add initial support for OF based soc-camera devices that may be used
by any of the soc-camera drivers. The driver itself will need converting
to use OF.

These changes allow the soc-camera driver to do the connecting of any
async capable v4l2 device to the soc-camera driver. This has currently
been tested on the Renesas Lager board.

It currently only supports one input device per driver as this seems
to be the standard connection for these devices.

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
[g.liakhovetski@gmx.de add check for multiple subdevices]
Tested-by: Robert Jarzmik <robert.jarzmik@free.fr>
Tested-by: Josh Wu <josh.wu@atmel.com>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-30 19:30:05 -03:00
Zhaowei Yuan 55647a9936 [media] s5p-mfc: remove unnecessary calling to function video_devdata()
Since we have get vdev by calling video_devdata() at the beginning of
s5p_mfc_open(), we should just use vdev instead of calling video_devdata()
again in the following code.

Signed-off-by: Zhaowei Yuan <zhaowei.yuan@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-30 19:22:21 -03:00
Jacek Anaszewski 39c344c448 [media] s5p-jpeg: add chroma subsampling adjustment for Exynos3250
Take into account limitations specific to the Exynos3250 SoC,
regarding setting the chroma subsampling control's value.

Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-30 19:21:07 -03:00
Jacek Anaszewski 5a71671af3 [media] s5p-jpeg: Prevent erroneous downscaling for Exynos3250 SoC
JPEG codec on Exynos3250 SoC produces broken raw image if a JPEG
image is decoded to YUV420 format and downscaled by a factor
greater than 2. Prevent this by asserting downscale ratio to 2.

Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-30 19:20:14 -03:00
Jacek Anaszewski dfd96900b2 [media] s5p-jpeg: Assure proper crop rectangle initialization
Assure proper crop_rect initialization in case the user space
doesn't call S_SELECTION ioctl.

Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-30 19:19:30 -03:00
Jacek Anaszewski fac4d96126 [media] s5p-jpeg: fix g_selection op
V4L2_SEL_TGT_COMPOSE_DEFAULT switch case should select whole
available area of the image and V4L2_SEL_TGT_COMPOSE
should apply user settings.

Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-30 19:17:43 -03:00
Jacek Anaszewski e9e7dfe5ef [media] s5p-jpeg: Adjust jpeg_bound_align_image to Exynos3250 needs
The jpeg_bound_align_image function needs to know the context
in which it is called, as it needs to align image dimensions in
a slight different manner for Exynos3250, which crops pixels for
specific values in case the format is RGB.

Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-30 19:16:54 -03:00
Jacek Anaszewski a35f600319 [media] s5p-jpeg: return error immediately after get_byte fails
When parsing JPEG header s5p_jpeg_parse_hdr function
should return immediately in case there was an error
while reading a byte.

Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-30 19:16:03 -03:00
Jacek Anaszewski 3246fdaa0a [media] s5p-jpeg: Add support for Exynos3250 SoC
This patch adds support for jpeg codec on Exynos3250 SoC to
the s5p-jpeg driver. Supported raw formats are: YUYV, YVYU, UYVY,
VYUY, RGB565, RGB565X, RGB32, NV12, NV21. The support includes
also scaling and cropping features.

Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-30 19:15:06 -03:00
Mauro Carvalho Chehab ee67674a77 [media] xc5000: always write at dmesg when it fails to upload firmware
On a normal condition, no errors should happen at xc5000
firmware upload is done. So, print at the dmesg if something
bad happens.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-30 15:56:20 -03:00
Mauro Carvalho Chehab 8604f3552b [media] xc5000: optimize firmware retry logic
Currently, firmware retry logic keeps reading from FS every
time during the retry logic. This is not needed. Instead,
only release the firmware read after success.

While here, make the non-debug messages less verbose, as it
only matters to the user if the firmware was successfully
loaded, or if some error happened.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-30 15:55:26 -03:00
Mauro Carvalho Chehab 2621c0b322 [media] xc5000: Don't try forever to load the firmware
With the current code, if something bad happens during the
firmware init process, the device will keep trying forever,
and removing it would cause an OOPS.

Instead, try only a limited amount of time. If not, fails.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-30 15:52:54 -03:00
Mauro Carvalho Chehab 2fcfd317f6 [media] au0828: add support for IR on HVR-950Q
HVR-950Q uses an I2C remote controller at address 0x47 (7-bits
notation). Add support for it.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-30 15:51:43 -03:00
Mauro Carvalho Chehab 32570579cb [media] ir-rc5-decoder: print where decoding fails
The IR dprintk message that prints a RC5 decoding failure
is not much helpful, as it doesn't tell on what bit the
error occurred.

Add such information, in order to make the debug message
more useful.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-30 15:49:35 -03:00
Mauro Carvalho Chehab d24b69fc6b [media] rc-main: allow raw protocol drivers to restrict the allowed protos
On some hardware (au0828/au8522), the hardware is broken with
regards to the initial pulse detection. So, the driver needs to
produce a fake start pulse. That limits the acceptable protocols,
as it is not possible to produce a fake pulse that would cover
all supported protocols.

So, allow the driver to explicitly set the allowed protocols.

If the driver doesn't specify, keep the old behavior.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-30 15:45:48 -03:00
Mauro Carvalho Chehab cfd0c77d08 [media] au0828: improve I2C speed
Commits 21dc61d3c0 and 7a1dd50b89 reduced the board I2C
speed to 20 MHz by default, due to a I2C stretch issue:
while xc5000 uses i2c stretch when a command is sent to it,
au0828 doesn't support this feature.

However, this is needed only for Xceive tuners. The other
I2C devices can work at the max speed.

So, revert the workarounds at board level, handling it at
I2C level, only when talking with xc5000.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-30 15:44:25 -03:00
Mauro Carvalho Chehab 7f196789b3 si2135: Declare the structs even if frontend is not enabled
As reported by Kbuildtest:

   In file included from drivers/media/usb/cx231xx/cx231xx-dvb.c:35:0:
   drivers/media/dvb-frontends/si2165.h:57:9: warning: 'struct si2165_config' declared inside parameter list [enabled by default]
     struct i2c_adapter *i2c)
            ^
   drivers/media/dvb-frontends/si2165.h:57:9: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default]
   drivers/media/usb/cx231xx/cx231xx-dvb.c:157:21: error: variable 'hauppauge_930C_HD_1113xx_si2165_config' has initializer but incomplete type
    static const struct si2165_config hauppauge_930C_HD_1113xx_si2165_config = {
                        ^
   drivers/media/usb/cx231xx/cx231xx-dvb.c:158:2: error: unknown field 'i2c_addr' specified in initializer
     .i2c_addr = 0x64,
     ^
   drivers/media/usb/cx231xx/cx231xx-dvb.c:158:2: warning: excess elements in struct initializer [enabled by default]
   drivers/media/usb/cx231xx/cx231xx-dvb.c:158:2: warning: (near initialization for 'hauppauge_930C_HD_1113xx_si2165_config') [enabled by default]
   drivers/media/usb/cx231xx/cx231xx-dvb.c:159:2: error: unknown field 'chip_mode' specified in initializer
     .chip_mode = SI2165_MODE_PLL_XTAL,
     ^
   drivers/media/usb/cx231xx/cx231xx-dvb.c:159:15: error: 'SI2165_MODE_PLL_XTAL' undeclared here (not in a function)
     .chip_mode = SI2165_MODE_PLL_XTAL,
                  ^
   drivers/media/usb/cx231xx/cx231xx-dvb.c:159:2: warning: excess elements in struct initializer [enabled by default]
     .chip_mode = SI2165_MODE_PLL_XTAL,
     ^
   drivers/media/usb/cx231xx/cx231xx-dvb.c:159:2: warning: (near initialization for 'hauppauge_930C_HD_1113xx_si2165_config') [enabled by default]
   drivers/media/usb/cx231xx/cx231xx-dvb.c:160:2: error: unknown field 'ref_freq_Hz' specified in initializer
     .ref_freq_Hz = 16000000,
     ^
   drivers/media/usb/cx231xx/cx231xx-dvb.c:160:2: warning: excess elements in struct initializer [enabled by default]
   drivers/media/usb/cx231xx/cx231xx-dvb.c:160:2: warning: (near initialization for 'hauppauge_930C_HD_1113xx_si2165_config') [enabled by default]
>> drivers/media/usb/cx231xx/cx231xx-dvb.c:163:21: error: variable 'pctv_quatro_stick_1114xx_si2165_config' has initializer but incomplete type
    static const struct si2165_config pctv_quatro_stick_1114xx_si2165_config = {
                        ^
   drivers/media/usb/cx231xx/cx231xx-dvb.c:164:2: error: unknown field 'i2c_addr' specified in initializer
     .i2c_addr = 0x64,
     ^
   drivers/media/usb/cx231xx/cx231xx-dvb.c:164:2: warning: excess elements in struct initializer [enabled by default]
>> drivers/media/usb/cx231xx/cx231xx-dvb.c:164:2: warning: (near initialization for 'pctv_quatro_stick_1114xx_si2165_config') [enabled by default]
   drivers/media/usb/cx231xx/cx231xx-dvb.c:165:2: error: unknown field 'chip_mode' specified in initializer
     .chip_mode = SI2165_MODE_PLL_EXT,
     ^
>> drivers/media/usb/cx231xx/cx231xx-dvb.c:165:15: error: 'SI2165_MODE_PLL_EXT' undeclared here (not in a function)
     .chip_mode = SI2165_MODE_PLL_EXT,
                  ^
   drivers/media/usb/cx231xx/cx231xx-dvb.c:165:2: warning: excess elements in struct initializer [enabled by default]
     .chip_mode = SI2165_MODE_PLL_EXT,
     ^
>> drivers/media/usb/cx231xx/cx231xx-dvb.c:165:2: warning: (near initialization for 'pctv_quatro_stick_1114xx_si2165_config') [enabled by default]
   drivers/media/usb/cx231xx/cx231xx-dvb.c:166:2: error: unknown field 'ref_freq_Hz' specified in initializer
     .ref_freq_Hz = 24000000,
     ^
   drivers/media/usb/cx231xx/cx231xx-dvb.c:166:2: warning: excess elements in struct initializer [enabled by default]
>> drivers/media/usb/cx231xx/cx231xx-dvb.c:166:2: warning: (near initialization for 'pctv_quatro_stick_1114xx_si2165_config') [enabled by default]
   drivers/media/usb/cx231xx/cx231xx-dvb.c: In function 'dvb_init':
   drivers/media/usb/cx231xx/cx231xx-dvb.c:731:3: warning: passing argument 1 of 'si2165_attach' from incompatible pointer type [enabled by default]
      dev->dvb->frontend = dvb_attach(si2165_attach,
      ^
   In file included from drivers/media/usb/cx231xx/cx231xx-dvb.c:35:0:
   drivers/media/dvb-frontends/si2165.h:55:36: note: expected 'const struct si2165_config *' but argument is of type 'const struct si2165_config *'
    static inline struct dvb_frontend *si2165_attach(
                                       ^
   drivers/media/usb/cx231xx/cx231xx-dvb.c:764:3: warning: passing argument 1 of 'si2165_attach' from incompatible pointer type [enabled by default]
      dev->dvb->frontend = dvb_attach(si2165_attach,
      ^
   In file included from drivers/media/usb/cx231xx/cx231xx-dvb.c:35:0:
   drivers/media/dvb-frontends/si2165.h:55:36: note: expected 'const struct si2165_config *' but argument is of type 'const struct si2165_config *'
    static inline struct dvb_frontend *si2165_attach(
                                       ^

That happens because the frontend was disabled by .config, but the
si2165_attach void stub require those structs, and also the
drivers that call it.

While here, remove the duplicated info about the possible I2C
addresses.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-28 10:37:08 -03:00
Ingo Molnar ca5bc6cd5d Merge branch 'sched/urgent' into sched/core, to merge fixes before applying new changes
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2014-07-28 10:03:00 +02:00
Hans Verkuil 0a12830893 [media] solo6x10: fix potential null dereference
drivers/media/pci/solo6x10/solo6x10-disp.c:221 solo_set_motion_block() error: potential null dereference
'buf'.  (kzalloc returns null)

Also propagate this error up the chain.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-27 18:24:16 -03:00
Hans Verkuil 9c9cb1fad8 [media] v4l2-ctrls: fix rounding calculation
Commit 958c7c7e65 ("[media] v4l2-ctrls: fix corner case in round-to-range code") broke
controls that use a negative range.

The cause was a s32/u32 mixup: ctrl->step is unsigned while all others are signed. So
the result type of the expression '(ctrl)->maximum - ((ctrl)->step / 2)' became unsigned,
making 'val >= (ctrl)->maximum - ((ctrl)->step / 2)' true, since '((u32)-128) > 128'
(if val = -128, maximum = 128 and step = 1).

So carefully cast (step / 2) to s32.

There was one cast of step to s32 where it should have been u32 because both offset and
step are unsigned, so casting to signed makes no sense there. You do need a cast to u32
there, because otherwise architectures that have no 64-bit division start complaining
(step is a u64).

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reported-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-27 17:51:37 -03:00
Mauro Carvalho Chehab 5b8c8d4191 [media] mceusb: select default keytable based on vendor
Some vendors have their on keymap table that are used on
all (or almost all) models for that vendor.

So, instead of specifying the keymap table per USB ID,
let's use the Vendor ID's table by default.

At the end, this will mean less code to be added when newer
devices for those vendors are added.

Of course, if rc_map is specified per board, it takes
precedence.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-27 17:37:01 -03:00
Mauro Carvalho Chehab 9683e01eff [media] mceusb: add support for newer cx231xx devices
Add support for the si2165-based cx231xx devices:
	[2013:025e] PCTV QuatroStick 522e
	[2013:0259] PCTV QuatroStick 521e
	[2040:b131] Hauppauge WinTV 930C-HD (model 1114xx)

They're similar to the already supported:
	[2040:b130] Hauppauge WinTV 930C-HD (model 1113xx)

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-27 17:13:53 -03:00
Mauro Carvalho Chehab 1f97947c15 [media] cx231xx: handle errors at read_eeprom()
Fix the following warnings:
	drivers/media/usb/cx231xx/cx231xx-cards.c: In function 'read_eeprom':
	drivers/media/usb/cx231xx/cx231xx-cards.c:979:6: warning: variable 'ret' set but not used [-Wunused-but-set-variable]

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-27 17:03:51 -03:00
Matthias Schwarzott 140a7987db [media] cx231xx: Add support for PCTV QuatroStick 522e
Add support for:
	[2013:025e] PCTV QuatroStick 522e

The hardware is identical to Hauppauge WinTV 930C-HD (model 1114xx)

Signed-off-by: Matthias Schwarzott <zzam@gentoo.org>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-27 17:03:36 -03:00
Matthias Schwarzott a141a887e0 [media] cx231xx: Add support for PCTV QuatroStick 521e
Add support for:
	[2013:0259] PCTV QuatroStick 521e

The hardware is identical to Hauppauge WinTV 930C-HD (model 1113xx)

Signed-off-by: Matthias Schwarzott <zzam@gentoo.org>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-27 17:03:23 -03:00
Matthias Schwarzott 9e49f7c3d6 [media] cx231xx: Add digital support for HVR930C-HD model 1114xx
Add support for:
	[2040:b131] Hauppauge WinTV 930C-HD (model 1114xx)

Signed-off-by: Matthias Schwarzott <zzam@gentoo.org>
Tested-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-27 17:03:07 -03:00
Matthias Schwarzott dd2e7dd20c [media] cx231xx: Add digital support for HVR 930c-HD model 1113xx
Add support for:
	[2040:b130] Hauppauge WinTV 930C-HD (model 1113xx)

After loading the driver the first open to dvb device node fails.

Signed-off-by: Matthias Schwarzott <zzam@gentoo.org>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-27 17:02:48 -03:00
Matthias Schwarzott 6d3debafc8 [media] cx231xx: prepare for i2c_client attachment
This is needed to support PCTV QuatroStick 522e which uses a si2157.
The si2157 driver is written using i2c_client attachment.

Signed-off-by: Matthias Schwarzott <zzam@gentoo.org>
Tested-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-27 17:02:22 -03:00
Matthias Schwarzott 36efec48e2 [media] cx23885: Add si2165 support for HVR-5500
The same card entry is used for HVR-4400 and HVR-5500.
Only HVR-5500 has been tested.

Signed-off-by: Matthias Schwarzott <zzam@gentoo.org>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-27 17:01:59 -03:00
Matthias Schwarzott 3e54a1697a [media] si2165: Add demod driver for DVB-T only
DVB-T was tested  with 8MHz BW channels in germany
This driver is the simplest possible, it uses automatic mode for all
parameters (TPS).

Added spectrum inversion support.

Signed-off-by: Matthias Schwarzott <zzam@gentoo.org>
Tested-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-27 17:01:41 -03:00
Mauro Carvalho Chehab 52841e5e14 [media] cx231xx: return an error if it can't read PCB config
Instead of using some random value, return an error if the
PCB config is not available or doesn't match a know profile

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-27 16:57:43 -03:00
Mauro Carvalho Chehab 4d2a7d3509 [media] cx231xx: move analog init code to a separate function
That makes easier to understand the code. It would also help
to add support for having boards with just digital support
on some latter patch, as allowed by some PCB configs.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-27 16:57:27 -03:00
Mauro Carvalho Chehab 184a82784d [media] cx231xx: use devm_ functions to allocate memory
The initialization is already too complex. Use devm_ functions
to make the code simpler and easier to modify.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-27 16:54:21 -03:00
Mauro Carvalho Chehab dcb78ac761 [media] cx231xx: Don't let an interface number to go past the array
On some newer boards, like HVR-930C HD, the information at
the PCB tables are sometimes higher than the ones actually
available on the device. That causes the probing code to
go past the interfaces array.

Add checks to the interface number before going past the
array.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-27 16:54:04 -03:00
Mauro Carvalho Chehab 139d28826b [media] cx231xx: Fix the max number of interfaces
The max number of interfaces was read from the wrong descriptor.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-27 16:53:40 -03:00
Marcel J.E. Mol 1dee9b59d6 [media] rc: Add support for decoding XMP protocol
This protocol is found on Dreambox remotes

[m.chehab@samsung.com: CodingStyle fixes and conflict fix]
Signed-off-by: Marcel Mol <marcel@mesa.nl>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-26 19:38:04 -03:00
Sonic Zhang 0a6824bc10 [media] v4l2: blackfin: select proper pinctrl state in ppi_set_params if CONFIG_PINCTRL is enabled
Multiple pinctrl states are defined for 8, 16 and 24 data pin groups in PPI peripheral.
The driver should select correct group before set up further PPI parameters.

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
Acked-by: Scott Jiang <scott.jiang.linux@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-26 17:15:16 -03:00
Sonic Zhang 7ba3c21c17 [media] v4l2: bfin: Ensure delete and reinit list entry on NOMMU architecture
On NOMMU architecture page fault is not triggered if a deleted list entry is
accessed without reinit.

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
Acked-by: Scott Jiang <scott.jiang.linux@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-26 17:14:14 -03:00
Sonic Zhang f7d0e6d67f [media] media: blackfin: ppi: Pass device pointer to request peripheral pins
if the pinctrl driver is enabled.

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
Acked-by: Scott Jiang <scott.jiang.linux@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-26 17:12:30 -03:00
Frank Schaefer 3d3a41098e [media] em28xx-v4l: fix disabling ioctl VIDIOC_S_PARM for vbi devices
Fixes an old copy+paste bug that has survived all recent code
changes in this code area.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-26 16:45:47 -03:00
Frank Schaefer 747dba7de2 [media] em28xx-v4l: get rid of field "users" in struct em28xx_v4l2
Instead of counting the number of opened file handles, use function
v4l2_fh_is_singular_file() in em28xx_v4l2_open() and em28xx_v4l2_close() to
determine if the file handle is the first/last opened one.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-26 16:45:14 -03:00
Frank Schaefer 3c0f90e14c [media] em28xx-v4l: simplify em28xx_v4l2_open() by using v4l2_fh_open()
Instead of calling

...
struct v4l2_fh *fh = kzalloc(sizeof(*fh), GFP_KERNEL);
filp->private_data = fh;
v4l2_fh_init(fh, vdev);
v4l2_fh_add(fh);
...

simply use function v4l2_fh_open() which does all of these calls for us.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-26 16:44:30 -03:00
Frank Schaefer 917ba6b0b6 [media] em28xx-v4l: get rid of struct em28xx_fh
struct em28xx_fh isn't needed anymore because the only used field which is left is struct v4l2_fh fh.
Use struct v4l2_fh directly and remvove struct em28xx_fh.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-26 16:43:41 -03:00
Frank Schaefer 5015389fda [media] em28xx-v4l: simplify some pointers in em28xx_init_camera()
Pointer v4l2" can be used instead of "dev->v4l2, which saves some characters.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-26 16:42:28 -03:00
Raimonds Cicans ad86faada7 [media] Fix typo in comments
Expression ((7bit i2c_addr << 1) & 0x01) can not be right
because it is always 0

Signed-off-by: Raimonds Cicans <ray@apollo.lv>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-26 15:09:47 -03:00
Christopher Reimer 93961435d0 [media] ddbridge: Add IDs for several newer Digital Devices cards
This patch adds the necessary IDs for the following dvb cards:

Digital Devices Octopus Mini
Digital Devices Cine S2 V6.5
Digital Devices DVBCT V6.1
Digital Devices Octopus V3
Mystique SaTiX-S2 V3

All these changes are taken from the official driver package by Digital
Devices.
http://download.digital-devices.de/download/linux/

[m.chehab@samsung.com: Fixed whitespace mangling]
Signed-off-by: Christopher Reimer <mail@creimer.net>
Tested-by: "D. Herrendoerfer" <d.herrendoerfer@herrendoerfer.name>

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-26 15:00:01 -03:00
Fabian Frederick 0ee4c2ac18 [media] drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c: remove unnecessary null test before usb_free_urb
Fix checkpatch warning:
WARNING: usb_free_urb(NULL) is safe this check is probably not required

Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-26 14:55:00 -03:00
Heinrich Schuchardt 40feb52fb6 [media] media: saa7134: remove if based on uninitialized variable
Variable b is not initialized.
Only with a small chance it has random value 0xFF.
Remove if statement based on this value.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-26 12:30:41 -03:00
Antti Palosaari 3ab2512337 [media] af9035: override tuner for AVerMedia A835B devices
Tuner ID set into EEPROM is wrong, which causes driver to select
wrong tuner profile. That leads device non-working. Fix issue by
overriding known bad tuner IDs with suitable default value.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-26 12:04:10 -03:00
Mauro Carvalho Chehab 60ecb71a72 [media] remove some new warnings on drxj
changeset b601fe5688 did some cleanup, but didn't remove some
now unused vars:
	drivers/media/dvb-frontends/drx39xyj/drxj.c: In function 'drx39xxj_set_frontend':
	drivers/media/dvb-frontends/drx39xyj/drxj.c:12072:21: warning: unused variable 'uio_data' [-Wunused-variable]
	drivers/media/dvb-frontends/drx39xyj/drxj.c: In function 'drx39xxj_set_lna':
	drivers/media/dvb-frontends/drx39xyj/drxj.c:12230:21: warning: unused variable 'uio_data' [-Wunused-variable]
	drivers/media/dvb-frontends/drx39xyj/drxj.c:12229:20: warning: unused variable 'uio_cfg' [-Wunused-variable]
	drivers/media/dvb-frontends/drx39xyj/drxj.c:12224:6: warning: unused variable 'result' [-Wunused-variable]

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-26 11:57:09 -03:00
Mauro Carvalho Chehab b862b3736e [media] cx23885-dvb: remove previously overriden value
drivers/media/pci/cx23885/cx23885-dvb.c:768:2: warning: initialized field overwritten [-Woverride-init]
  .freq_offset_khz_vhf = 550,
  ^
drivers/media/pci/cx23885/cx23885-dvb.c:768:2: warning: (near initialization for 'dib7070p_dib0070_config.freq_offset_khz_vhf') [-Woverride-init]

Cc: James Harper <james.harper@ejbdigital.com.au>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-26 11:55:11 -03:00
Mauro Carvalho Chehab a39e2866e5 [media] cx23885 now needs to select dib0070
Due to DViCO FusionHDTV DVB-T Dual Express2, we also need to
autoselect this tuner.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-26 11:55:10 -03:00
James Harper 46b21bbaa8 [media] Add support for DViCO FusionHDTV DVB-T Dual Express2
DViCO FusionHDTV DVB-T Dual Express2 is cx23885 + dib7070

[m.chehab@samsung.com: fix conflicts and make checkpatch happy]

Signed-off-by: James Harper <james.harper@ejbdigital.com.au>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-26 11:55:03 -03:00
James Harper 7b4eeed174 [media] vmalloc_sg: make sure all pages in vmalloc area are really DMA-ready
Patch originally written by Konrad. Rebased on current linux media tree.

Under Xen, vmalloc_32() isn't guaranteed to return pages which are really
under 4G in machine physical addresses (only in virtual pseudo-physical
addresses).  To work around this, implement a vmalloc variant which
allocates each page with dma_alloc_coherent() to guarantee that each
page is suitable for the device in question.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: James Harper <james.harper@ejbdigital.com.au>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-26 11:33:15 -03:00
Shuah Khan b601fe5688 [media] media: drx39xyj - use drxj_set_lna_state() and remove duplicate LNA code
drx39xxj_set_lna() and drx39xxj_set_frontend() set LNA. Instead of
duplicating LNA configure code, change to use drxj_set_lna_state()
which sets LNA to the caller requested state (on or off).

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-26 11:22:51 -03:00
Shuah Khan 3074187111 [media] media: drx39xyj - fix to return actual error codes instead of -EIO
Several functions ignore the return values in error legs and always
return -EIO. This makes it hard to debug and take proper action in
calling routines.

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-26 11:22:30 -03:00
Shuah Khan 998819d271 [media] media: drx39xyj - add resume support
drx39xyj driver lacks resume support. Add support by changing
its fe ops init interface to detect the resume status by checking
fe exit flag and do the necessary initialization. With this change,
driver resume correctly in both dvb adapter is not in use and in use
by an application cases.

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-26 11:22:05 -03:00
Shuah Khan 87cd0fa811 [media] media: dvb-core add new flag exit flag value for resume
Some fe drivers will have to do additional initialization
in their fe ops.init interfaces when called during resume.
Without the additional initialization, fe and tuner driver
resume fails. A new fe exit flag value DVB_FE_DEVICE_RESUME
is necessary to detect resume case. This patch adds a new
define and changes dvb_frontend_resume() to set it prior to
calling fe init and tuner init calls and resets it back to
DVB_FE_NO_EXIT once fe and tuner init is done.

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-26 11:20:10 -03:00
Shuah Khan 5b22b1a4f7 [media] media: drx39xyj driver change to check fe exit flag from release
Change drx39xyj_release() to check fe exit flag to detect the
device disconnect state and avoid accessing the device after
it has been removed.

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-26 11:19:21 -03:00
Shuah Khan f68e35af99 [media] media: em28xx-dvb update fe exit flag to indicate device disconnect
Change em28xx_dvb_fini() to set fe exit flag to DVB_FE_DEVICE_REMOVED
when device is disconnected. em28xx maintains device disconnect status
in em28xx device. fe drivers will be able to now check the fe exit
status to avoid accessing the device, from their release interfaces
when called from disconnect path. This change depends on dvb-core
change that exports fe exit flag by moving it from fepriv to fe.

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-26 11:18:57 -03:00
Shuah Khan 18ed2860cb [media] media: dvb-core move fe exit flag from fepriv to fe for driver access
Some fe drivers attempt to access the device for power control from
their release routines. When release routines are called after device
is disconnected, the attempts fail. fe drivers should avoid accessing
the device, from their release interfaces when called from disconnect
path. dvb-frontend maintains exit flag to keep track when fe device is
disconnected in its private data structures. Export the flag in fe to
enable drivers to check the device status from their release interfaces.

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-26 11:17:15 -03:00
Shuah Khan cc5c5d20c3 [media] media: em28xx - fix i2c_xfer to return -ENODEV when dev is removed
In em28xx usb disconnect code path, some dvb fe and tuner drivers
attempt i2c transfers from their release interfaces. When device
is removed, return -ENODEV instead of attempting to transfer data
over i2c.

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-26 11:15:17 -03:00
Shuah Khan b89193e0b0 [media] media: em28xx - remove reset_resume interface
em28xx uses resume interface as its reset_resume interface.
If usb device is reset during suspend, reset_resume doesn't
do the necessary initialization which leads to resume failure.
Many systems don't maintain do not maintain suspend current to
the USB host controllers during hibernation. Remove reset_resume
to allow disconnect to be called followed by device restore
sequence.

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-26 11:14:24 -03:00