1
0
Fork 0
Commit Graph

75 Commits (00a14c2968e3d55817e0fa35c78106ca840537bf)

Author SHA1 Message Date
Mauro Carvalho Chehab 86c330fa59 [media] cx88-dvb: whitespace cleanup
X-Patchwork-Delegate: m.chehab@samsung.com
Fix the following smatch warning:
	drivers/media/pci/cx88//cx88-dvb.c:1508 dvb_register() warn: if statement not indented

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 17:12:12 -02:00
Hans Verkuil 21a7e0596a [media] media: drivers shouldn't touch debug field in video_device
The debug field in struct video_device is for internal use only and
drivers should mix that with their own debug module options.

It is handled by the V4L2 core and users can set it using
/sys/class/video4linux/<devX>/debug.

It has been deprecated for some time now, so it is time to remove it
completely from the drivers.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-12-23 10:29:04 -02:00
Hans Verkuil 215cedec37 [media] media: remove emacs editor variables
1) This is not allowed by the kernel coding style
2) Just configure your editor correctly
3) It's really ugly

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-12-22 17:52:20 -02:00
Hans Verkuil 389208e117 [media] cx88: remove leftover start_video_dma() call
The start_streaming op is responsible for starting the video dma,
so it shouldn't be called anymore from the buf_queue op.

Unfortunately, this call to start_video_dma() was added to the
start_streaming op, but was forgotten to be removed from the
buf_queue op, which is where it used to be before the vb2 conversion.

Calling this function twice causes very hard to find errors: sometimes
it works, sometimes it doesn't. It took me a whole friggin' day
to track this down, and in the end it was just luck that my eye suddenly
triggered on that line.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-12-16 23:21:40 -02:00
Hans Verkuil 165d00439f [media] cx88: add missing alloc_ctx support
The cx88 vb2 conversion and the vb2 dma_sg improvements were developed separately and
were merged separately. Unfortunately, the patch updating drivers to the dma_sg
improvements didn't take the updated cx88 driver into account. Basically two ships
passing in the night, unaware of one another even though both ships have the same
owner, i.e. me :-)

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reported-by: Chris Lee <updatelee@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-12-16 23:21:40 -02:00
Hans Verkuil 872dfcfe82 [media] bttv/cx25821/cx88/ivtv: use sg_next instead of sg++
Never use sg++, always use sg = sg_next(sg). Scatterlist entries can
be combined if the memory is contiguous but sg++ won't know about that.

As far as I can tell cx88 and ivtv are really broken because of this,
and bttv and cx25821 are OK because vb1 doesn't combine scatterlist
entries.

But regardless, sg++ should never be used, only sg_next is safe.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-25 08:12:53 -02:00
Prabhakar Lad 7f56a4a710 [media] media: cx88: use vb2_start_streaming_called() helper
this patch adds support for using vb2_start_streaming_called()
for cx88-blackbird driver.

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-14 18:18:41 -02:00
Hans Verkuil c0d5b5fbbe [media] cx88: fix VBI support
Now works with both NTSC and PAL. Tested with CC/XDS for NTSC and
teletext/WSS for PAL. The start lines were wrong, the WSS signal
wasn't captured and there was no difference between NTSC and PAL
w.r.t. the count[] values so NTSC returned way too many lines.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-03 08:36:40 -02:00
Hans Verkuil 98822de9ae [media] cx88: pci_disable_device comes after free_irq
Move pci_disable_device() down otherwise it will complain about an
unfreed irq.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-03 08:35:56 -02:00
Hans Verkuil c39ba33032 [media] cx88: consistently use UNSET for absent tuner
Don't mix UNSET and TUNER_ABSENT: you have to pick one or the other. For
this driver selecting UNSET to represent an absent tuner resulting in
the fewest changes.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-03 08:35:34 -02:00
Hans Verkuil 078859a323 [media] cx88: don't allow changes while vb2_is_busy
Make sure that changing the standard or format is not allowed while
one or more of the video, vbi or mpeg vb2 queues are busy.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-03 08:34:33 -02:00
Hans Verkuil fb37ab3e78 [media] cx88: drop mpeg_active field
The vb2 framework knows if streaming is in progress, no need to use
a separate field for that.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-03 08:33:29 -02:00
Hans Verkuil ccd6f1d488 [media] cx88: move width, height and field to core struct
The width, height and field values are core fields since both vbi, video
and blackbird use the same video input.

Move those fields to the correct struct.

Also fix the field checks in the try_fmt functions: add V4L2_FIELD_SEQ_BT/TB
support and map incorrect field values to a correct field value instead of
returning an error.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-03 08:32:36 -02:00
Hans Verkuil d386259f8e [media] cx88: don't pollute the kernel log
There is no reason to dump the sram code to the kernel log when you
stop streaming. Remove those calls to cx88_sram_channel_dump.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-03 08:31:01 -02:00
Hans Verkuil b8f884164b [media] cx88: increase API command timeout
The timeout is way too small. Especially complicated command like
CX2341X_ENC_STOP_CAPTURE takes much more time than 10 ms. Increase the
timeout to 1 second, just as ivtv does (the cx88-blackbird has the
same IP core for MPEG compression as ivtv).

This solves a nasty issue where STOP_CAPTURE would timeout and the
mailbox is left in a busy state, making it impossible to start streaming
a second time without reloading the driver first.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-03 08:30:26 -02:00
Hans Verkuil 5e7045e3fa [media] cx88: remove dependency on btcx-risc
btcx-risc is for the bt8xx driver and other drivers shouldn't depend
on it. There is no benefit to use that module just to do a
pci_zalloc_consistent.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-03 08:29:51 -02:00
Hans Verkuil 999b3ceb84 [media] cx88: drop cx88_free_buffer
Remove this function. This makes all vb2 queues behave the same, which
simplifies comparing the various vb2 queue op implementations.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-03 08:28:30 -02:00
Hans Verkuil eddd326320 [media] cx88: return proper errors during fw load
Don't return -1, return a proper error.

Replace dprintk(0, ...) by pr_err since firmware load errors should just be
reported as an error.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-03 08:27:36 -02:00
Hans Verkuil c79a23f33d [media] cx88: fix sparse warning
drivers/media/pci/cx88/cx88-blackbird.c:476:25: warning: cast to restricted __le32

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-03 08:26:59 -02:00
Hans Verkuil 0b6b6302d9 [media] cx88: convert to vb2
As usual, this patch is very large due to the fact that half a vb2 conversion
isn't possible. And since this affects blackbird, alsa, core, dvb, vbi and
video the changes are all over.

What made this more difficult was the peculiar way the risc program was setup.
The driver allowed for running out of buffers in which case the DMA would stop
and restart when the next buffer was queued. There was also a complicated
timeout system for when buffers weren't filled. This was replaced by a much
simpler scheme where there is always one buffer around and the DMA will just
cycle that buffer until a new buffer is queued. In that case the previous
buffer will be chained to the new buffer. An interrupt is generated at the
start of the new buffer telling the driver that the previous buffer can be
passed on to userspace.

Much simpler and more robust.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-03 08:26:33 -02:00
Hans Verkuil b2c75abde0 [media] cx88: drop videobuf abuse in cx88-alsa
The alsa driver uses videobuf low-level functions that are not
available in vb2, so replace them by driver-specific functions.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-03 08:21:55 -02:00
Hans Verkuil 6f11adc6a5 [media] cx88: drop the bogus 'queue' list in dmaqueue
This list is only used if the width, height and/or format of a buffer has
changed, but that can never happen. Remove it and all associated code.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-03 08:21:24 -02:00
Hans Verkuil 637bc20796 [media] cx88: remove fmt from the buffer struct
This is a duplicate of dev->fmt and can be removed. As a consequence a
lot of tests that check if the format has changed midstream can be
removed as well: the format cannot change midstream, so this is a bogus
check.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-03 08:20:45 -02:00
Mauro Carvalho Chehab 84babee8fe [media] cx88: remove return after BUG()
As reported by smatch:

drivers/media/pci/cx88/cx88-video.c:699 get_queue() info: ignoring unreachable code.
drivers/media/pci/cx88/cx88-video.c:714 get_resource() info: ignoring unreachable code.
drivers/media/pci/cx88/cx88-video.c:815 video_read() info: ignoring unreachable code.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-26 06:47:57 -03:00
Mauro Carvalho Chehab e2392d347e [media] cx88: fix cards table CodingStyle
This is actually a coding style issue, but it was generating lots
of smatch warnings:

drivers/media/pci/cx88/cx88-cards.c:1513:37: warning: Initializer entry defined twice
drivers/media/pci/cx88/cx88-cards.c:1517:19:   also defined here
drivers/media/pci/cx88/cx88-cards.c:1533:36: warning: Initializer entry defined twice
drivers/media/pci/cx88/cx88-cards.c:1538:19:   also defined here
...

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-26 06:47:56 -03:00
David Härdeman 9d2f1d3cde [media] rc-core: rename dev->scanmask to dev->scancode_mask
We already have dev->scancode_filter and dev->scancode_wakeup_filter
so rename dev->scanmask to dev->scancode_mask for consistency.

Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-25 19:10:43 -03:00
David Härdeman c5540fbb9d [media] rc-core: remove protocol arrays
The basic API of rc-core used to be:

	dev = rc_allocate_device();
	dev->x = a;
	dev->y = b;
	dev->z = c;
	rc_register_device();

which is a pretty common pattern in the kernel, after the introduction of
protocol arrays the API looks something like:

	dev = rc_allocate_device();
	dev->x = a;
	rc_set_allowed_protocols(dev, RC_BIT_X);
	dev->z = c;
	rc_register_device();

There's no real need for the protocols to be an array, so change it
back to be consistent (and in preparation for the following patches).

[m.chehab@samsung.com: added missing changes at some files]
Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-25 19:10:43 -03:00
David Härdeman 120703f9eb [media] rc-core: document the protocol type
Right now the protocol information is not preserved, rc-core gets handed a
scancode but has no idea which protocol it corresponds to.

This patch (which required reading through the source/keymap for all drivers,
not fun) makes the protocol information explicit which is important
documentation and makes it easier to e.g. support multiple protocols with one
decoder (think rc5 and rc-streamzap). The information isn't used yet so there
should be no functional changes.

[m.chehab@samsung.com: rebased, added cxusb and removed bad whitespacing]
Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-23 21:50:48 -03:00
David Härdeman 4dd9bb91bb [media] rc-core: improve ir-kbd-i2c get_key functions
The arguments used for ir-kbd-i2c's get_key() functions are not
really suited for rc-core and the ir_raw/ir_key distinction is
just confusing.

Convert all of them to return a protocol/scancode/toggle triple instead.

Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-23 20:05:56 -03:00
Ramakrishnan Muthukrishnan 95cd5d5ee6 [media] media: remove the setting of the flag V4L2_FL_USE_FH_PRIO
Since all the drivers that use `struct v4l2_fh' use the core
priority checking, the setting of the flag in the drivers can
be removed.

Signed-off-by: Ramakrishnan Muthukrishnan <ramakrmu@cisco.com>
Reviewed-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-04 16:14:59 -03:00
Laurent Pinchart 8774bed9ce [media] v4l: subdev: Move [gs]_std operation to video ops
The g_std and s_std operations are video-related, move them to the video
ops where they belong.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-05-24 17:11:26 -03:00
Linus Torvalds 3c83e61e67 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:
 "The main set of series of patches for media subsystem, including:
   - document RC sysfs class
   - added an API to setup scancode to allow waking up systems using the
     Remote Controller
   - add API for SDR devices.  Drivers are still on staging
   - some API improvements for getting EDID data from media
     inputs/outputs
   - new DVB frontend driver for drx-j (ATSC)
   - one driver (it913x/it9137) got removed, in favor of an improvement
     on another driver (af9035)
   - added a skeleton V4L2 PCI driver at documentation
   - added a dual flash driver (lm3646)
   - added a new IR driver (img-ir)
   - added an IR scancode decoder for the Sharp protocol
   - some improvements at the usbtv driver, to allow its core to be
     reused.
   - added a new SDR driver (rtl2832u_sdr)
   - added a new tuner driver (msi001)
   - several improvements at em28xx driver to fix PM support, device
     removal and to split the V4L2 specific bits into a separate
     sub-driver
   - one driver got converted to videobuf2 (s2255drv)
   - the e4000 tuner driver now follows an improved binding model
   - some fixes at V4L2 compat32 code
   - several fixes and enhancements at videobuf2 code
   - some cleanups at V4L2 API documentation
   - usual driver enhancements, new board additions and misc fixups"

[ NOTE! This merge effective drops commit 4329b93b28 ("of: Reduce
  indentation in of_graph_get_next_endpoint").

  The of_graph_get_next_endpoint() function was moved and renamed by
  commit fd9fdb78a9 ("[media] of: move graph helpers from
  drivers/media/v4l2-core to drivers/of").  It was originally called
  v4l2_of_get_next_endpoint() and lived in the file
  drivers/media/v4l2-core/v4l2-of.c.

  In that original location, it was then fixed to support empty port
  nodes by commit b9db140c1e ("[media] v4l: of: Support empty port
  nodes"), and that commit clashes badly with the dropped "Reduce
  intendation" commit.  I had to choose one or the other, and decided
  that the "Support empty port nodes" commit was more important ]

* 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (426 commits)
  [media] em28xx-dvb: fix PCTV 461e tuner I2C binding
  Revert "[media] em28xx-dvb: fix PCTV 461e tuner I2C binding"
  [media] em28xx: fix PCTV 290e LNA oops
  [media] em28xx-dvb: fix PCTV 461e tuner I2C binding
  [media] m88ds3103: fix bug on .set_tone()
  [media] saa7134: fix WARN_ON during resume
  [media] v4l2-dv-timings: add module name, description, license
  [media] videodev2.h: add parenthesis around macro arguments
  [media] saa6752hs: depends on CRC32
  [media] si4713: fix Kconfig dependencies
  [media] Sensoray 2255 uses videobuf2
  [media] adv7180: free an interrupt on failure paths in init_device()
  [media] e4000: make VIDEO_V4L2 dependency optional
  [media] af9033: Don't export functions for the hardware filter
  [media] af9035: use af9033 PID filters
  [media] af9033: implement PID filter
  [media] rtl2832_sdr: do not use dynamic stack allocation
  [media] e4000: fix 32-bit build error
  [media] em28xx-audio: make sure audio is unmuted on open()
  [media] DocBook media: v4l2_format_sdr was renamed to v4l2_sdr_format
  ...
2014-04-04 09:50:07 -07:00
James Hogan 1a1934fab0 [media] rc: abstract access to allowed/enabled protocols
The allowed and enabled protocol masks need to be expanded to be per
filter type in order to support wakeup filter protocol selection. To
ease that process abstract access to the rc_dev::allowed_protos and
rc_dev::enabled_protocols members with inline functions.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Reviewed-by: Antti Seppälä <a.seppala@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 13:24:39 -03:00
Takashi Iwai e735688875 [media] Convert to snd_card_new() with a device pointer
Also remove superfluous snd_card_set_dev() calls.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2014-02-14 08:14:09 +01:00
Wei Yongjun cd86e3b535 [media] cx88: use correct pci drvdata type in cx88_audio_finidev()
We had set the pci drvdata in cx88_audio_initdev() as a type of
struct snd_card, so cx88_audio_finidev() should used it as the
same type too.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2013-12-10 15:28:59 -02:00
Michael Opdenacker 3e018fe440 [media] misc drivers: remove deprecated IRQF_DISABLED
This patch proposes to remove the use of the IRQF_DISABLED flag
It's a NOOP since 2.6.35 and it will be removed one day.

Signed-off-by: Michael Opdenacker <michael.opdenacker@free-electrons.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2013-10-17 06:08:31 -03:00
Sachin Kamat c0d4021f6c [media] pci: cx88: Remove redundant pci_set_drvdata
Driver core sets driver data to NULL upon failure or remove.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2013-10-17 06:01:05 -03:00
Sachin Kamat 06333e0aca [media] pci: cx88-video: Use module_pci_driver
module_pci_driver removes some boilerplate and makes code simpler.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2013-10-17 05:56:40 -03:00
Sachin Kamat 38b25adce8 [media] pci: cx88-mpeg: Use module_pci_driver
module_pci_driver removes some boilerplate and makes code simpler.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2013-10-17 05:56:30 -03:00
Sachin Kamat 59963b9498 [media] pci: cx88-alsa: Use module_pci_driver
module_pci_driver removes some boilerplate and makes code simpler.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2013-10-17 05:56:18 -03:00
Hans Verkuil f66b2a1c7f [media] cx88: Fix regression: CX88_AUDIO_WM8775 can't be 0
Cards using the wm8775 specify that in their card struct. Those that do not
use it leave the audio_chip field to 0. Unfortunately, the CX88_AUDIO_WM8775
enum is 0 as well, so boards that do not have the wm8775 still try to load
and use that driver. Change it to 1 to fix this.
This regression was introduced in commit facd23664f.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reported-by: Knut Petersen <Knut_Petersen@t-online.de>
Tested-by: Knut Petersen <Knut_Petersen@t-online.de>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Cc: stable@vger.kernel.org
2013-09-03 09:24:22 -03:00
Mauro Carvalho Chehab 1ae0d202a5 [media] cx88: fix build when VP3054=m and CX88_DVB=y
As reported by Jim Davis <jim.epost@gmail.com>:

randconfig build error with next-20130813, in drivers/media/pci/cx88,
when:
	CONFIG_VIDEO_CX88=y
	CONFIG_VIDEO_CX88_BLACKBIRD=m
	CONFIG_VIDEO_CX88_DVB=y
	CONFIG_VIDEO_CX88_VP3054=m
	CONFIG_VIDEO_CX88_MPEG=y

  LD      init/built-in.o
drivers/built-in.o: In function `cx8802_dvb_remove':
cx88-dvb.c:(.text+0x3a9914): undefined reference to `vp3054_i2c_remove'
drivers/built-in.o: In function `cx8802_dvb_probe':
cx88-dvb.c:(.text+0x3a9c4b): undefined reference to `vp3054_i2c_probe'
make: *** [vmlinux] Error 1

That happens because the vp3054 symbols aren't available builtin.
So, make it builtin, if CX88_DVB=y, or module otherwise, if this
support is selected.

Reported-by: Jim Davis <jim.epost@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2013-08-24 07:55:06 -03:00
Hans Verkuil e5715cfb28 [media] cx88: set dev_parent to the correct parent PCI bus
The cx88 driver has one v4l2_device, but the video nodes are owned by two
different PCI busses. So the dev_parent pointer should be set to the correct
parent bus, otherwise sysfs won't show the correct device hierarchy.
This broke starting in 3.6 after a driver change, so this patch resurrects
the correct behavior.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-06-21 11:08:07 -03:00
Hans Verkuil 7feeb14821 [media] cx88: fix register mask
Ensure that the register is aligned to a dword, otherwise the read could
read out-of-range data.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Cc: Mauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-06-21 10:48:18 -03:00
Hans Verkuil facd23664f [media] cx88: remove g_chip_ident
Remove g_chip_ident from cx88. Also remove the v4l2-chip-ident.h include.
The board code used defines from v4l2-chip-ident.h to tell the driver which
audio chip is used. Replace this with a cx88-specific enum.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Cc: Mauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-06-21 10:30:38 -03:00
Hans Verkuil 609c4c12af [media] cx88: fix NULL pointer dereference
This fixes a NULL pointer deference when loading the cx88_dvb module for a
Hauppauge HVR4000.
The bugzilla bug report is here:
https://bugzilla.kernel.org/show_bug.cgi?id=56271
The cause is that the wm8775 is optional, so even though the board info says
there is one, it doesn't have to be there. Checking whether the module was
actually loaded is much safer.
Note that this driver is quite buggy when it comes to unloading and reloading
modules. Unloading cx8800 and reloading it again will still cause a crash,
most likely because either the i2c bus isn't unloaded at the right time and/or
the v4l2_device_unregister isn't called at the right time.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reported-by: Sebastian Frei <sebastian@familie-frei.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-06-08 20:24:56 -03:00
Mauro Carvalho Chehab 02615ed5e1 [media] cx88: make core less verbose
Along the time, several debug messages were added at cx88-cards.
While those are still useful to track some troubles with
tuners, they're too verbose:
[ 5768.281801] cx88[0]: Calling XC2028/3028 callback
[ 5768.287388] cx88[0]: Calling XC2028/3028 callback
[ 5768.292575] cx88[0]: Calling XC2028/3028 callback
[ 5768.299408] cx88[0]: Calling XC2028/3028 callback
[ 5768.306244] cx88[0]: Calling XC2028/3028 callback
...

and, most of the time, useless.

So, disable them, except if core_debug modprobe parameter
is used.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-04-28 12:40:52 -03:00
Alexey Khoroshilov 5ddfbbb9ca [media] cx88: Fix unsafe locking in suspend-resume
Legacy PCI suspend-resume handlers are called with interrupts enabled.

But cx8800_suspend/cx8800_resume and
cx8802_suspend_common/cx8802_resume_common use spin_lock/spin_unlock
functions to acquire dev->slock, while the same lock is acquired in the
corresponding irq-handlers: cx8800_irq and cx8802_irq.

That means a deadlock is possible if an interrupt happens while suspend
or resume owns the lock. The patch replaces spin_lock/spin_unlock with
spin_lock_irqsave/spin_unlock_irqrestore.

Found by Linux Driver Verification project (linuxtesting.org).

[mchehab@redhat.com: Fix CodingStyle]
Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-04-22 10:08:30 -03:00
Mauro Carvalho Chehab 48a8a03b58 [media] cx88: kernel bz#9476: Fix tone setting for Nova-S+ model 92001
Hauppauge Nova-S-Plus DVB-S model 92001 does not lock on horizontal
polarisation. According with the info provided at the BZ, model
92002 does.

The difference is that, on model 92001, the tone select is done via
isl6421, while, on other devices, this is done via cx24123 code.
This patch adds a way to override the demod's set_tone at isl6421
driver. In order to avoid regressions, the override is enabled
only for cx88 Nova S plus model 92001. For all other models and
devices, the set_tone is provided by the demod driver.

Patch originally proposed at bz@9476[1] by Michel Meyers and
John Donoghue but applying the original patch would break support
for all other devices based on isl6421.

[1] https://bugzilla.kernel.org/show_bug.cgi?id=9476

Tested-by: Adam Sampson <ats@offog.org>
Tested-by: Hans-Peter Jansen <hpj@urpla.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-04-08 06:56:47 -03:00
Hans Verkuil 977ba3b1b7 [media] v4l2: add const to argument of write-only s_register ioctl
This ioctl is defined as IOW, so pass the argument as const.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-24 08:47:01 -03:00