1. 18 12月, 2015 1 次提交
    • H
      [media] cx23885: fix format/crop handling · e80bf856
      Hans Verkuil 提交于
      While testing the cx23885 driver with various TV standards I found
      a number of bugs:
      
      1) norm_maxw() returned 768 instead of 720 for PAL formats. This should
         always be 720, so drop this inline function and just always use 720.
      2) cropcap() was missing, so the pixelaspect was never known and qv4l2 would
         scale the image incorrectly. Add cropcap support.
      3) cx23885_set_tvnorm() should just return 0 if the same standard was
         set again. If another standard is set, then reset the width/height and
         call set_fmt for the subdevs.
      Signed-off-by: NHans Verkuil <hans.verkuil@cisco.com>
      Signed-off-by: NMauro Carvalho Chehab <mchehab@osg.samsung.com>
      e80bf856
  2. 21 11月, 2015 1 次提交
  3. 19 11月, 2015 1 次提交
  4. 17 11月, 2015 1 次提交
    • M
      [media] include/media: move driver interface headers to a separate dir · d647f0b7
      Mauro Carvalho Chehab 提交于
      Let's not mix headers used by the core with those headers that
      are needed by some driver-specific interface header.
      
      The headers used on drivers were manually moved using:
          mkdir include/media/drv-intf/
          git mv include/media/cx2341x.h include/media/cx25840.h \
      	include/media/exynos-fimc.h include/media/msp3400.h \
      	include/media/s3c_camif.h include/media/saa7146.h \
      	include/media/saa7146_vv.h  include/media/sh_mobile_ceu.h \
      	include/media/sh_mobile_csi2.h include/media/sh_vou.h \
      	include/media/si476x.h include/media/soc_mediabus.h \
      	include/media/tea575x.h include/media/drv-intf/
      
      And the references for those headers were corrected using:
      
          MAIN_DIR="media/"
          PREV_DIR="media/"
          DIRS="drv-intf/"
      
          echo "Checking affected files" >&2
          for i in $DIRS; do
      	for j in $(find include/$MAIN_DIR/$i -type f -name '*.h'); do
      		 n=`basename $j`
      		git grep -l $n
      	done
          done|sort|uniq >files && (
      	echo "Handling files..." >&2;
      	echo "for i in \$(cat files|grep -v Documentation); do cat \$i | \\";
      	(
      		cd include/$MAIN_DIR;
      		for j in $DIRS; do
      			for i in $(ls $j); do
      				echo "perl -ne 's,(include [\\\"\\<])$PREV_DIR($i)([\\\"\\>]),\1$MAIN_DIR$j\2\3,; print \$_' |\\";
      			done;
      		done;
      		echo "cat > a && mv a \$i; done";
      	);
      	echo "Handling documentation..." >&2;
      	echo "for i in MAINTAINERS \$(cat files); do cat \$i | \\";
      	(
      		cd include/$MAIN_DIR;
      		for j in $DIRS; do
      			for i in $(ls $j); do
      				echo "  perl -ne 's,include/$PREV_DIR($i)\b,include/$MAIN_DIR$j\1,; print \$_' |\\";
      			done;
      		done;
      		echo "cat > a && mv a \$i; done"
      	);
          ) >script && . ./script
      Signed-off-by: NMauro Carvalho Chehab <mchehab@osg.samsung.com>
      Acked-by: NArnd Bergmann <arnd@arndb.de>
      d647f0b7
  5. 11 11月, 2015 1 次提交
  6. 21 10月, 2015 1 次提交
  7. 01 10月, 2015 1 次提交
  8. 10 6月, 2015 2 次提交
    • D
      [media] TS2020: Calculate tuner gain correctly · 0f91c9d6
      David Howells 提交于
      The TS2020 and TS2022 tuners take an input from the demodulator indicating the
      AGC setting on that component that is then used to influence the tuner's own
      gain.  This should be taken into account when calculating the gain and signal
      strength.
      
      Further, the existing TS2020 driver miscalculates the signal strength as the
      result of its calculations can exceed the storage capacity of the 16-bit word
      used to return it to userspace.
      
      To this end:
      
       (1) Add a callback function (->get_agc_pwm()) in the ts2020_config struct that
           the tuner can call to get the AGC PWM value from the demodulator.
      
       (2) Modify the TS2020 driver to calculate the gain according to Montage's
           specification with the adjustment that we produce a negative value and
           scale it to 0.001dB units (which is what the DVBv5 API will require):
      
           (a) Callback to the demodulator to retrieve the AGC PWM value and then
           	 turn that into Vagc for incorporation in the calculations.  If the
           	 callback is unset, assume a Vagc of 0.
      
           (b) Calculate the tuner gain from a combination of Vagc and the tuner's RF
           	 gain and baseband gain settings.
      
       (3) Turn this into a percentage signal strength as per Montage's
           specification for return to userspace with the DVBv3 API.
      
       (4) Provide a function in the M88DS3103 demodulator driver that can be used to
           get the AGC PWM value on behalf of the tuner.
      
       (5) The ts2020_config.get_agc_pwm function should be set by the code that
           stitches together the drivers for each card.
      
           For the DVBSky cards that use the M88DS3103 with the TS2020 or the TS2022,
           set the get_agc_pwm function to point to m88ds3103_get_agc_pwm.
      
      I have tested this with a DVBSky S952 card which has an M88DS3103 and a TS2022.
      
      Thanks to Montage for providing access to information about the workings of
      these parts.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      Signed-off-by: NAntti Palosaari <crope@iki.fi>
      Signed-off-by: NMauro Carvalho Chehab <mchehab@osg.samsung.com>
      0f91c9d6
    • M
      [media] dvb: Get rid of typedev usage for enums · 0df289a2
      Mauro Carvalho Chehab 提交于
      The DVB API was originally defined using typedefs. This is against
      Kernel CodingStyle, and there's no good usage here. While we can't
      remove its usage on userspace, we can avoid its usage in Kernelspace.
      
      So, let's do it.
      
      This patch was generated by this shell script:
      
      	for j in $(grep typedef include/uapi/linux/dvb/frontend.h |cut -d' ' -f 3); do for i in $(find drivers/media -name '*.[ch]' -type f) $(find drivers/staging/media -name '*.[ch]' -type f); do sed "s,${j}_t,enum $j," <$i >a && mv a $i; done; done
      
      While here, make CodingStyle fixes on the affected lines.
      Signed-off-by: NMauro Carvalho Chehab <mchehab@osg.samsung.com>
      Acked-by: Stefan Richter <stefanr@s5r6.in-berlin.de> # for drivers/media/firewire/*
      0df289a2
  9. 06 6月, 2015 4 次提交
  10. 13 5月, 2015 1 次提交
  11. 01 5月, 2015 2 次提交
  12. 09 4月, 2015 1 次提交
    • A
      [media] Add and use IS_REACHABLE macro · 9b174527
      Arnd Bergmann 提交于
      In the media drivers, the v4l2 core knows about all submodules
      and calls into them from a common function. However this cannot
      work if the modules that get called are loadable and the
      core is built-in. In that case we get
      
      drivers/built-in.o: In function `set_type':
      drivers/media/v4l2-core/tuner-core.c:301: undefined reference to `tea5767_attach'
      drivers/media/v4l2-core/tuner-core.c:307: undefined reference to `tea5761_attach'
      drivers/media/v4l2-core/tuner-core.c:349: undefined reference to `tda9887_attach'
      drivers/media/v4l2-core/tuner-core.c:405: undefined reference to `xc4000_attach'
      
      This was working previously, until the IS_ENABLED() macro was used
      to replace the construct like
      
       #if defined(CONFIG_DVB_CX24110) || (defined(CONFIG_DVB_CX24110_MODULE) && defined(MODULE))
      
      with the difference that the new code no longer checks whether it is being
      built as a loadable module itself.
      
      To fix this, this new patch adds an 'IS_REACHABLE' macro, which evaluates
      true in exactly the condition that was used previously. The downside
      of this is that this trades an obvious link error for a more subtle
      runtime failure, but it is clear that the change that introduced the
      link error was unintentional and it seems better to revert it for
      now. Also, a similar change was originally created by Trent Piepho
      and then reverted by teh change to the IS_ENABLED macro.
      
      Ideally Kconfig would be used to avoid the case of a broken dependency,
      or the code restructured in a way to turn around the dependency, but either
      way would require much larger changes here.
      
      Fixes: 7b34be71 ("[media] use IS_ENABLED() macro")
      See-also: c5dec9fb ("V4L/DVB (4751): Fix DBV_FE_CUSTOMISE for card drivers compiled into kernel")
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NMauro Carvalho Chehab <mchehab@osg.samsung.com>
      9b174527
  13. 08 4月, 2015 1 次提交
    • D
      [media] cx23885: Always initialise dev->slock spinlock · af7f388e
      David Howells 提交于
      The slock spinlock in the cx23885_dev struct is only initialised if analogue
      video is being used, but is used in other places too, leading to the attached
      lockdep complaint.
      
      Move the lock initialisation so that it is done unconditionally.
      
      INFO: trying to register non-static key.
      the code is fine but needs lockdep annotation.
      turning off the locking correctness validator.
      CPU: 1 PID: 4413 Comm: scandvb Tainted: G        W       4.0.0-rc1-fsdevel+ #25
      Hardware name: System manufacturer System Product Name/P5Q PRO TURBO, BIOS 0701    10/08/2012
       0000000000000000 ffff880129d779d8 ffffffff8162bbdf 0000000000000006
       0000000000000000 ffff880129d77aa8 ffffffff810780e3 0000000000000001
       0000000000000046 0000000000000004 ffffffff81c3f180 0000000000000000
      Call Trace:
       [<ffffffff8162bbdf>] dump_stack+0x4c/0x65
       [<ffffffff810780e3>] __lock_acquire+0x7b5/0x1a0e
       [<ffffffff810799ee>] lock_acquire+0x97/0x10c
       [<ffffffffa006494e>] ? cx23885_buf_queue+0x69/0x142 [cx23885]
       [<ffffffff8102e9bc>] ? amd_set_subcaches+0x19b/0x19b
       [<ffffffff816313b4>] _raw_spin_lock_irqsave+0x36/0x4a
       [<ffffffffa006494e>] ? cx23885_buf_queue+0x69/0x142 [cx23885]
       [<ffffffffa006494e>] cx23885_buf_queue+0x69/0x142 [cx23885]
       [<ffffffffa00662cb>] buffer_queue+0x17/0x19 [cx23885]
       [<ffffffffa00382d5>] __enqueue_in_driver+0x6a/0x6f [videobuf2_core]
       [<ffffffffa0038ead>] vb2_start_streaming+0x37/0x129 [videobuf2_core]
       [<ffffffffa003a6c0>] vb2_internal_streamon+0xc5/0x105 [videobuf2_core]
       [<ffffffffa003b889>] __vb2_init_fileio+0x224/0x286 [videobuf2_core]
       [<ffffffffa003bcc0>] ? vb2_thread_start+0x7b/0x15f [videobuf2_core]
       [<ffffffffa0050182>] ? vb2_dvb_start_feed+0x86/0x86 [videobuf2_dvb]
       [<ffffffffa003bd06>] vb2_thread_start+0xc1/0x15f [videobuf2_core]
       [<ffffffff8150d393>] ? dmx_section_feed_start_filtering+0x2f/0x14f
       [<ffffffffa0050157>] vb2_dvb_start_feed+0x5b/0x86 [videobuf2_dvb]
       [<ffffffff8150d461>] dmx_section_feed_start_filtering+0xfd/0x14f
       [<ffffffff8150afc7>] dvb_dmxdev_filter_start+0x23f/0x315
       [<ffffffff8150b6ad>] dvb_demux_do_ioctl+0x1fb/0x556
       [<ffffffff81509e94>] dvb_usercopy+0xb4/0x11c
       [<ffffffff8150b4b2>] ? dvb_dmxdev_ts_callback+0xd0/0xd0
       [<ffffffff8150a11a>] dvb_demux_ioctl+0x10/0x14
       [<ffffffff81144ac4>] do_vfs_ioctl+0x3c1/0x474
       [<ffffffff8126f181>] ? file_has_perm+0x5b/0x7f
       [<ffffffff810bf6ca>] ? __audit_syscall_entry+0xbc/0xde
       [<ffffffff81144bcc>] SyS_ioctl+0x55/0x7a
       [<ffffffff81631d52>] system_call_fastpath+0x12/0x17
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      Signed-off-by: NHans Verkuil <hans.verkuil@cisco.com>
      Signed-off-by: NMauro Carvalho Chehab <mchehab@osg.samsung.com>
      af7f388e
  14. 03 4月, 2015 2 次提交
  15. 01 4月, 2015 1 次提交
  16. 02 2月, 2015 1 次提交
  17. 22 1月, 2015 2 次提交
    • H
      [media] cx23885: fix free interrupt bug · 8d4d9329
      Hans Verkuil 提交于
      First free the interrupt, then disable the PCI device. The other way
      around will lead to this warning:
      
      Jan 19 11:42:02 telek kernel: [ 1440.161234] WARNING: CPU: 0 PID: 2191 at kernel/irq/manage.c:1311 __free_irq+0x97/0x1f0()
      Jan 19 11:42:02 telek kernel: [ 1440.161236] Trying to free already-free IRQ 0
      Jan 19 11:42:02 telek kernel: [ 1440.161237] Modules linked in: tda8290 tda10048 cx25840 cx23885(-) altera_ci tda18271 altera_stapl videobuf2_dvb tveeprom cx2341x videobuf2_dma_sg dvb_core rc_core videobuf2_memops videobuf2_core v4l2_common videodev media nouveau x86_pkg_temp_thermal cfbfillrect cfbimgblt cfbcopyarea ttm drm_kms_helper processor button isci
      Jan 19 11:42:02 telek kernel: [ 1440.161266] CPU: 0 PID: 2191 Comm: rmmod Tainted: G        W      3.19.0-rc1-telek #345
      Jan 19 11:42:02 telek kernel: [ 1440.161268] Hardware name: ASUSTeK COMPUTER INC. Z9PE-D8 WS/Z9PE-D8 WS, BIOS 5404 02/10/2014
      Jan 19 11:42:02 telek kernel: [ 1440.161270]  ffffffff81bf1fce ffff8808958b7cc8 ffffffff8194a97f 0000000000000000
      Jan 19 11:42:02 telek kernel: [ 1440.161274]  ffff8808958b7d18 ffff8808958b7d08 ffffffff810c56b0 0000000000000286
      Jan 19 11:42:02 telek kernel: [ 1440.161279]  0000000000000000 0000000000000000 ffff88089f808890 ffff88089f808800
      Jan 19 11:42:02 telek kernel: [ 1440.161284] Call Trace:
      Jan 19 11:42:02 telek kernel: [ 1440.161290]  [<ffffffff8194a97f>] dump_stack+0x4f/0x7b
      Jan 19 11:42:02 telek kernel: [ 1440.161295]  [<ffffffff810c56b0>] warn_slowpath_common+0x80/0xc0
      Jan 19 11:42:02 telek kernel: [ 1440.161299]  [<ffffffff810c5731>] warn_slowpath_fmt+0x41/0x50
      Jan 19 11:42:02 telek kernel: [ 1440.161303]  [<ffffffff81955d36>] ? _raw_spin_lock_irqsave+0x56/0x70
      Jan 19 11:42:02 telek kernel: [ 1440.161307]  [<ffffffff81114849>] ? __free_irq+0x49/0x1f0
      Jan 19 11:42:02 telek kernel: [ 1440.161311]  [<ffffffff81114897>] __free_irq+0x97/0x1f0
      Jan 19 11:42:02 telek kernel: [ 1440.161316]  [<ffffffff81114a88>] free_irq+0x48/0xd0
      Jan 19 11:42:02 telek kernel: [ 1440.161323]  [<ffffffffa00e6deb>] cx23885_finidev+0x4b/0x90 [cx23885]
      Jan 19 11:42:02 telek kernel: [ 1440.161329]  [<ffffffff814529fa>] pci_device_remove+0x3a/0xc0
      Jan 19 11:42:02 telek kernel: [ 1440.161334]  [<ffffffff8153b4ea>] __device_release_driver+0x7a/0xf0
      Jan 19 11:42:02 telek kernel: [ 1440.161338]  [<ffffffff8153bc98>] driver_detach+0xc8/0xd0
      Jan 19 11:42:02 telek kernel: [ 1440.161341]  [<ffffffff8153b1de>] bus_remove_driver+0x4e/0xb0
      Jan 19 11:42:02 telek kernel: [ 1440.161345]  [<ffffffff8153c2eb>] driver_unregister+0x2b/0x60
      Jan 19 11:42:02 telek kernel: [ 1440.161349]  [<ffffffff814525c5>] pci_unregister_driver+0x25/0x70
      Jan 19 11:42:02 telek kernel: [ 1440.161355]  [<ffffffffa00f6ddc>] cx23885_fini+0x10/0x12 [cx23885]
      Jan 19 11:42:02 telek kernel: [ 1440.161360]  [<ffffffff81139a98>] SyS_delete_module+0x1a8/0x1f0
      Jan 19 11:42:02 telek kernel: [ 1440.161364]  [<ffffffff819561a9>] system_call_fastpath+0x12/0x17
      Jan 19 11:42:02 telek kernel: [ 1440.161367] ---[ end trace a9c07cb5f3357020 ]---
      Signed-off-by: NHans Verkuil <hans.verkuil@cisco.com>
      Signed-off-by: NMauro Carvalho Chehab <mchehab@osg.samsung.com>
      8d4d9329
    • M
      [media] cx23885: Split Hauppauge WinTV Starburst from HVR4400 card entry · 721f3223
      Matthias Schwarzott 提交于
      Unconditionally attaching Si2161/Si2165 demod driver
      breaks Hauppauge WinTV Starburst.
      So create own card entry for this.
      
      Add card name comments to the subsystem ids.
      
      This fixes a regression introduced in 3.17 by
      36efec48 ([media] cx23885: Add si2165 support for HVR-5500)
      Signed-off-by: NMatthias Schwarzott <zzam@gentoo.org>
      Tested-by: NAntti Palosaari <crope@iki.fi>
      Signed-off-by: NHans Verkuil <hans.verkuil@cisco.com>
      CC: stable@vger.kernel.org # for 3.17 and upper
      Signed-off-by: NMauro Carvalho Chehab <mchehab@osg.samsung.com>
      721f3223
  18. 30 12月, 2014 4 次提交
  19. 25 11月, 2014 2 次提交
  20. 22 11月, 2014 1 次提交
    • H
      [media] cx23885: use sg = sg_next(sg) instead of sg++ · 7675fe99
      Hans Verkuil 提交于
      The cx23885 driver still used sg++ instead of sg = sg_next(sg). This worked with
      vb1 since that filled in the sglist manually, page-by-page, but it fails with vb2
      which uses core scatterlist code that can combine contiguous scatterlist entries
      into one larger entry.
      
      This bug led to the following crash as reported by Mariusz:
      
      [20712.990258] BUG: Bad page state in process vb2-cx23885[0]  pfn:2ca34
      [20712.990265] page:ffffea00009c3b60 count:-1 mapcount:0 mapping:          (null) index:0x0
      [20712.990266] flags: 0x4000000000000000()
      [20712.990268] page dumped because: nonzero _count
      [20712.990269] Modules linked in: tun binfmt_misc nf_conntrack_ipv6 nf_defrag_ipv6 ip6table_filter ip6_tables xt_mark xt_REDIRECT xt_limit xt_conntrack xt_nat xt_tcpudp iptable_mangle iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4 nf_nat nf_conntrack iptable_filter ip_tables x_tables sit ip_tunnel nvidia(PO) stb6100 stv090x cx88_dvb videobuf_dvb cx88_vp3054_i2c tuner kvm_amd kvm cx8802 k10temp cx8800 cx88xx btcx_risc videobuf_dma_sg videobuf_core usb_storage ds2490 usbhid ftdi_sio cx23885 tveeprom cx2341x videobuf2_dvb videobuf2_core videobuf2_dma_sg videobuf2_memops asus_atk0110 snd_emu10k1 snd_hwdep snd_util_mem snd_ac97_codec ac97_bus snd_rawmidi snd_pcm_oss snd_mixer_oss snd_pcm snd_timer snd w1_therm wire ipv6
      [20712.990301] CPU: 2 PID: 26942 Comm: vb2-cx23885[0] Tainted: P    B   W  O   3.18.0-rc5-00001-gb3652d1 #2
      [20712.990303] Hardware name: System manufacturer System Product Name/M4A785TD-V EVO, BIOS 2105    07/23/2010
      [20712.990305]  ffffffff81765734 ffff880137683a78 ffffffff815b6b32 0000000000000006
      [20712.990307]  ffffea00009c3b60 ffff880137683aa8 ffffffff8108ec27 ffffffff81765712
      [20712.990309]  ffffffff8189c840 0000000000000246 ffffea00009c3b60 ffff880137683b78
      [20712.990312] Call Trace:
      [20712.990317]  [<ffffffff815b6b32>] dump_stack+0x46/0x58
      [20712.990321]  [<ffffffff8108ec27>] bad_page+0xe9/0x107
      [20712.990323]  [<ffffffff810912ca>] get_page_from_freelist+0x3b2/0x505
      [20712.990326]  [<ffffffff8109150a>] __alloc_pages_nodemask+0xed/0x65f
      [20712.990330]  [<ffffffff81047a52>] ? ttwu_do_activate.constprop.78+0x57/0x5c
      [20712.990332]  [<ffffffff81049ff3>] ? try_to_wake_up+0x21b/0x22d
      [20712.990336]  [<ffffffff810070f4>] dma_generic_alloc_coherent+0x6e/0xf5
      [20712.990339]  [<ffffffff810261a9>] gart_alloc_coherent+0x105/0x114
      [20712.990341]  [<ffffffff81025963>] ? flush_gart+0x39/0x3d
      [20712.990343]  [<ffffffff810260a4>] ? gart_map_sg+0x3a0/0x3a0
      [20712.990349]  [<ffffffffa0141a1e>] cx23885_risc_databuffer+0xa7/0x133 [cx23885]
      [20712.990354]  [<ffffffffa0142764>] cx23885_buf_prepare+0x121/0x134 [cx23885]
      [20712.990359]  [<ffffffffa0144210>] buffer_prepare+0x14/0x16 [cx23885]
      [20712.990363]  [<ffffffffa011f101>] __buf_prepare+0x190/0x279 [videobuf2_core]
      [20712.990366]  [<ffffffffa011d906>] ? vb2_queue_or_prepare_buf+0xb8/0xc0 [videobuf2_core]
      [20712.990369]  [<ffffffffa011f34b>] vb2_internal_qbuf+0x51/0x1e5 [videobuf2_core]
      [20712.990372]  [<ffffffffa0120537>] vb2_thread+0x199/0x1f6 [videobuf2_core]
      [20712.990376]  [<ffffffffa012039e>] ? vb2_fop_write+0xdf/0xdf [videobuf2_core]
      [20712.990379]  [<ffffffff81043e61>] kthread+0xdf/0xe7
      [20712.990381]  [<ffffffff81043d82>] ? kthread_create_on_node+0x16d/0x16d
      [20712.990384]  [<ffffffff815bd46c>] ret_from_fork+0x7c/0xb0
      [20712.990386]  [<ffffffff81043d82>] ? kthread_create_on_node+0x16d/0x16d
      Signed-off-by: NHans Verkuil <hans.verkuil@cisco.com>
      Reported-by: NMariusz Bialonczyk <manio@skyboo.net>
      Tested-by: NMariusz Bialonczyk <manio@skyboo.net>
      Signed-off-by: NMauro Carvalho Chehab <mchehab@osg.samsung.com>
      7675fe99
  21. 15 11月, 2014 2 次提交
  22. 11 11月, 2014 2 次提交
  23. 04 11月, 2014 2 次提交
  24. 03 11月, 2014 2 次提交
  25. 31 10月, 2014 1 次提交