Commit graph

404 commits

Author SHA1 Message Date
Frank Schaefer 8e2c8717c1 [media] em28xx-v4l: get rid of field "users" in struct em28xx_v4l2"
This reverts commit 747dba7de2.

It breaks concurrent vbi and video capturing:
While v4l2->users is the number of users of the whole device (all device nodes),
v4l2_fh_is_singular() only checks the number of users of a specific device node.
As a result. if one device node is open and a second device node is opened
(closed), the device is reinitialized (streaming is stopped).

Reported-by: Hans Verkuil <hans.verkuil@cisco.com>
Tested-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Cc: stable@vger.kernel.org
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-21 21:27:57 -03:00
Mauro Carvalho Chehab c7854c2c5d [media] em28xx: fix VBI handling logic
When both VBI and video are streaming, and video stream is stopped,
a subsequent trial to restart it will fail, because S_FMT will
return -EBUSY.

That prevents applications like zvbi to work properly.

Please notice that, while this fix it fully for zvbi, the
best is to get rid of streaming_users and res_get logic as a hole.

However, this single-line patch is better to be merged at -stable.

Cc: stable@vger.kernel.org
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-21 21:07:29 -03:00
Mauro Carvalho Chehab eb500df22c [media] em28xx: Get rid of some unused modprobe parameters at vbi code
There are two modprobe parameters for VBI that aren't used
anywhere (one for debug, the other one related to the buffer
size). Get rid of them!

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-21 21:06:44 -03:00
Antti Palosaari ac7a24fb75 [media] em28xx: convert tda18212 tuner to I2C client
Used tda18212 tuner is implemented as a I2C driver. Use em28xx
tuner I2C client for tda18212 driver.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-09-21 19:59:57 -03:00
Mauro Carvalho Chehab 7e6c8c1981 [media] em28xx: use true/false for boolean vars
Instead of using 0 or 1 for boolean, use the true/false
defines.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-09-03 17:59:13 -03:00
Hans Verkuil 4a9e512afa [media] em28xx: fix sparse warnings
drivers/media/usb/em28xx/em28xx-core.c:297:16: warning: cast to restricted __le16
drivers/media/usb/em28xx/em28xx-cards.c:2249:20: warning: symbol 'em28xx_bcount' was not declared. Should it be static?

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-09-03 10:34:58 -03:00
Olli Salonen 6fd2f44a00 [media] em28xx: add ts mode setting for PCTV 292e
TS mode must be set in the existing PCTV 292e driver.

Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-09-02 15:03:40 -03:00
nibble.max 79d0933032 [media] m88ds3103: implement set voltage and TS clock
Implement set voltage operation.
Separate TS clock as a own configuration parameter.
Add TS clock polarity parameter.

[crope@iki.fi: merge em28xx driver m88ds3103 config change patch
to that one, in order to keep build unbroken]

Signed-off-by: Nibble Max <nibble.max@gmail.com>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-09-02 15:02:10 -03: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
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
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 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
Shuah Khan 4db8954afa [media] media: em28xx - add error handling for KWORLD dvb_attach failures
Add error hanlding when EM2870_BOARD_KWORLD_A340 dvb_attach()
for fe and tuner fail in em28xx_dvb_init().

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-26 11:09:40 -03:00
Shuah Khan 6eb5e3399e [media] media: em28xx-dvb - fix em28xx_dvb_resume() to not unregister i2c and dvb
em28xx_dvb_resume() unregisters i2c tuner, i2c demod, and dvb.
This erroneous cleanup results in i2c tuner, i2c demod, and dvb
devices unregistered and removed during resume. This error is a
result of merge conflict between two patches that went into 3.15.

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-26 11:03:36 -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
Matthias Schwarzott c3b513bd69 [media] em28xx-dvb: Prepare for si2157 driver getting more parameters
Modify all users of si2157_config to correctly initialize all not
listed values to 0.

Signed-off-by: Matthias Schwarzott <zzam@gentoo.org>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-21 21:28:41 -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
Hans Verkuil e22eca7857 [media] em28xx: add MSI Digivox Trio support
Add support for the MSI Digivox Trio device.

Signed-off-by: P. van Gaans <w3ird_n3rd@gmx.net>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-04 15:34:40 -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
Mauro Carvalho Chehab f472c0b59f [media] em28xx: make em28xx_free_v4l2 static()
Changeset 95d2608b88 created this function, but declared it as
global, by mistake.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-05-23 14:29:59 -03:00
Frank Schaefer a5c075cfd2 [media] em28xx: move fields wq_trigger and streaming_started from struct em28xx to struct em28xx_audio
Both wq_trigger and stream_started are used only to control the em28xx
alsa streaming. They don't belong to em28xx common struct.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-05-23 13:44:42 -03:00
Frank Schaefer 3319e6f839 [media] em28xx: remove field tuner_addr from struct em28xx
The tuner address is only used by the v4l submodule and at tuner setup and
can be obtained from the board data directly (if specified).

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-05-23 13:43:09 -03:00
Frank Schaefer 6867bd5aa7 [media] em28xx: remove field tda9887_conf from struct em28xx
The tda9887 chipset is part of the analog tuner. Move it out of
em28xx-cards.

Also, it is used only one time by the v4l2 sub-module at tuner setup.

With that, we can get rid of an additional data inside the em28xx
common structure.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-05-23 13:41:56 -03:00
Frank Schaefer 3854b0d847 [media] em28xx: move tuner frequency field from struct em28xx to struct v4l2
Move V4L2-specific frequency cache to struct em28xx_v4l2.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-05-23 13:39:38 -03:00
Frank Schaefer 8139a4d583 [media] em28xx: move v4l2 user counting fields from struct em28xx to struct v4l2
Despite being at the common em28xx struct, those two fields are
actually taking into account only the usage inside em28xx v4l2
submodule. So, move them out of the common struct.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-05-23 13:37:49 -03:00
Frank Schaefer f0e38230b3 [media] em28xx: move capture state tracking fields from struct em28xx to struct v4l2
Move some temporary capture tracking date to the em28xx_v4l2 struct,
as those info are used only by em28xx v4l2 submodule.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-05-23 13:23:36 -03:00
Frank Schaefer d7dc18da63 [media] em28xx: move sensor parameter fields from struct em28xx to struct v4l2
Move camera sensor resolution and xtal out of em28xx common struct,
as thore are used only by the em28xx v4l2 submodule.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-05-23 13:22:06 -03:00
Frank Schaefer 58159171c7 [media] em28xx: move progressive/interlaced fields from struct em28xx to struct v4l2
The video progressive data fields belong to analog TV. Move them out
of the common em28xx struct.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-05-23 13:20:13 -03:00
Frank Schaefer 06e206721c [media] em28xx: move struct em28xx_fmt *format from struct em28xx to struct v4l2
The analog format struct belongs to analog TV. Move it out of the
common em28xx struct.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-05-23 13:19:15 -03:00
Frank Schaefer 52faaf78b5 [media] em28xx: move TV norm from struct em28xx to struct v4l2
TV norm is specific to analog TV reception. move it out of the common
em28xx struct.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-05-23 13:16:54 -03:00
Frank Schaefer 9297285e51 [media] em28xx: move vinmode and vinctrl data from struct em28xx to struct v4l2
The video input mode and control data also belong only to the
analog side. move them to struct em28xx_v4l.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-05-23 13:16:03 -03:00
Frank Schaefer 753aee7738 [media] em28xx: move v4l2 frame resolutions and scale data from struct em28xx to struct v4l2
The em28xx scaler data are used only for analog video. Move them to
struct em28xx_v4l2.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-05-23 13:14:53 -03:00
Frank Schaefer 27a36df63b [media] em28xx: move videobuf2 related data from struct em28xx to struct v4l2
The video and VBI-specific VB2 queue and mutexes are used only by
the v4l2 sub-driver. Move them to the V4L2 struct, preventing
wasting memory if this sub-driver is not used.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-05-23 13:13:35 -03:00
Frank Schaefer ef74a0b9ff [media] em28xx: move video_device structs from struct em28xx to struct v4l2
There are 3 struct video_device at the em28xx common struct,
for video, VBI and radio. They all are used only by the V4L2 driver.
So, move them to the v4l2-specific struct.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-05-23 13:11:59 -03:00
Frank Schaefer 2c52a2fce0 [media] em28xx: move struct v4l2_clk *clk from struct em28xx to struct v4l2
The current clock definition applies only to the V4L2 side of the
driver. Move its struct pointer to the v4l2_dev, where it belongs.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-05-23 13:09:54 -03:00
Frank Schaefer abc1308f0b [media] em28xx: move struct v4l2_ctrl_handler ctrl_handler from struct em28xx to struct v4l2
Controls are only applicable to V4L2 module. Move the corresponding
data structs to the proper place.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-05-23 13:08:01 -03:00
Frank Schaefer 95d2608b88 [media] em28xx: start moving em28xx-v4l specific data to its own struct
That reduces a little bit the memory footprint when em28xx-video
is not loaded.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-05-23 13:06:11 -03:00
Frank Schaefer ad2980557d [media] em28xx-video: simplify usage of the pointer to struct v4l2_ctrl_handler in em28xx_v4l2_init()
The local var hdl is already pointing to &dev->ctrl_handler.
Use it, instead of dereferencing it all the time.

Code cleanup. No functional changes.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-05-23 13:03:54 -03:00
Frank Schaefer 6743033e58 [media] em28xx: move sub-module data structs to a common place in the main struct
Just a cleanup. No functional changes.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-05-23 13:02:21 -03:00
Frank Schaefer aa4ce5f7f3 [media] em28xx: remove the i2c_set_adapdata() call in em28xx_i2c_register()
It is no longer needed since nobody is calling i2c_get_adapdata() anymore.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-05-23 12:56:35 -03:00
Frank Schaefer 25c61e4cfc [media] em28xx: move norm_maxw() and norm_maxh() from em28xx.h to em28xx-video.c
Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-05-23 12:11:34 -03:00
Frank Schaefer cba8e9b32d [media] em28xx: remove function em28xx_compression_disable() and its call
em28xx_compression_disable() is a single line function which is called only one
time and this call also isn't needed.
Register 0x26 is always configured as part of the scaler configuration, which
in turn is always done when the resolution changes. And the initial resolution
setting is applied at first device open.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-05-23 12:11:06 -03:00
Frank Schaefer 88d285965c [media] em28xx: remove some unused fields from struct em28xx
Just driver cleanup. No functional changes.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-05-23 12:06:07 -03:00
Frank Schaefer 5869778301 [media] em28xx: fix indenting in em28xx_usb_probe()
No functional changes.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-05-23 12:05:32 -03:00
Hans Verkuil e37559b22c [media] vb2: stop_streaming should return void
The vb2 core ignores any return code from the stop_streaming op.
And there really isn't anything it can do anyway in case of an error.
So change the return type to void and update any drivers that implement it.

The int return gave drivers the idea that this operation could actually
fail, but that's really not the case.

The pwc amd sdr-msi3101 drivers both had this construction:

        if (mutex_lock_interruptible(&s->v4l2_lock))
                return -ERESTARTSYS;

This has been updated to just call mutex_lock(). The stop_streaming op
expects this to really stop streaming and I very much doubt this will
work reliably if stop_streaming just returns without really stopping the
DMA.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Pawel Osciak <pawel@osciak.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-04-23 10:12:51 -03:00
Antti Palosaari ffb9948e65 [media] em28xx: PCTV tripleStick (292e) LNA support
External LNA between antenna connector and RF tuner is controlled
by EM28178 GPIO 0. GPIO value 1 is LNA active and value 0 is LNA
disabled.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-04-23 09:56:20 -03:00
Antti Palosaari 1922924031 [media] em28xx: add [2013:025f] PCTV tripleStick (292e)
Empia EM28178, Silicon Labs Si2168, Silicon Labs Si2157.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-04-23 09:51:31 -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
Antti Palosaari a83b93a748 [media] em28xx-dvb: fix PCTV 461e tuner I2C binding
Add missing m88ts2022 module reference counts as removing that module
is not allowed when it is used by em28xx-dvb module. That same module
was not unregistered correctly, fix it too.

Error cases validated by returning errors from m88ds3103, m88ts2022
and a8293 probe().

Signed-off-by: Antti Palosaari <crope@iki.fi>
Cc: stable@vger.kernel.org
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-31 08:02:16 -03:00
Mauro Carvalho Chehab 5eef220312 Revert "[media] em28xx-dvb: fix PCTV 461e tuner I2C binding"
The first hunk of this patch got merged wrong, likely due to some
changes at the em28xx resume code. Revert it to reapply it right.

This reverts commit 37571b163c.

Reported-by: Chris Lee <updatelee@gmail.com>
Reported-by: Hans Verkuil <hverkuil@xs4all.nl>
Cc: stable@vger.kernel.org # Don't apply this patch or 37571b163c
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-31 07:53:45 -03:00
Antti Palosaari 3ec40dcfb4 [media] em28xx: fix PCTV 290e LNA oops
Pointer to device state has been moved to different location during
some change. PCTV 290e LNA function still uses old pointer, carried
over FE priv, and it crash.

Reported-by: Janne Kujanpää <jikuja@iki.fi>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Cc: stable@vger.kernel.org
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-28 18:11:01 -03:00
Antti Palosaari 37571b163c [media] em28xx-dvb: fix PCTV 461e tuner I2C binding
Add missing m88ts2022 module reference counts as removing that module
is not allowed when it is used by em28xx-dvb module. That same module
was not unregistered correctly, fix it too.

Error cases validated by returning errors from m88ds3103, m88ts2022
and a8293 probe().

Signed-off-by: Antti Palosaari <crope@iki.fi>
Cc: stable@vger.kernel.org
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-28 18:10:56 -03:00
Frank Schaefer ba35ca0708 [media] em28xx-audio: make sure audio is unmuted on open()
In all cases, when the first capture is called, we need to
call the code that unmutes the volume.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-14 10:17:18 -03: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
Dan Carpenter 73a8ca4877 [media] em28xx-cards: remove a wrong indent level
This code is correct but the indenting is wrong and triggers a static
checker warning "add curly braces?".

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-03-11 09:27:14 -03:00
Mauro Carvalho Chehab b45e34f2a6 [media] em28xx-dvb: remove one level of identation at fini callback
Simplify the logic a little by removing one level of identation.
Also, it only makes sense to print something if the .fini callback
is actually doing something.

Reviewed-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 06:56:46 -03:00
Mauro Carvalho Chehab 47677e51e2 [media] em28xx: Only deallocate struct em28xx after finishing all extensions
We can't free struct em28xx while one of the extensions is still
using it.

So, add a kref() to control it, freeing it only after the
extensions fini calls.

Reviewed-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 06:56:46 -03:00
Mauro Carvalho Chehab 88e4fcda55 [media] em28xx: only enable PCTV 80e led when streaming
Instead of keeping the led always on, use it to indicate
when DVB is streaming.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-11 06:56:45 -03:00
Sakari Ailus ade48681f1 [media] v4l: Rename vb2_queue.timestamp_type as timestamp_flags
The timestamp_type field used to contain only the timestamp type. Soon it
will be used for timestamp source flags as well. Rename the field
accordingly.

[m.chehab@samsung.com: do the change also to drivers/staging/media and at s2255]
Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-05 16:34:14 -03:00
Mauro Carvalho Chehab 59432be1c7 [media] em28xx: Add LED support for Kworld UB435-Q v3
This device has a led at bit 7 of GPIO reg. 0x80 to indicate
when a DVB capture is happening.

Add support for it.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04 14:44:18 -03:00
Mauro Carvalho Chehab 54e925498c [media] em28xx: add support for DVB monitor led
Some devices have a LED to indicate when DVB capture started.
Add support for it.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04 14:44:09 -03:00
Mauro Carvalho Chehab 02bc1f5574 [media] em28xx: add support for Kworld UB435-Q version 3
This device is close to Kworld UB435-Q, but it uses a different
tuner. Add support for it.

Tested with both 8VSB and 256QAM modulations.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04 14:43:59 -03:00
Mauro Carvalho Chehab 959505bd24 [media] em28xx: add support for PCTV 80e remote controller
This stick uses the same RC-5 remote controll found on other
PCTV devices. So, just use the existing keymap.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04 14:33:05 -03:00
Mauro Carvalho Chehab 3fc954a1e9 [media] drx-j: Fix compilation and un-comment it
There were some DVB internal API changes, since this driver were
written. Change it to work with the new API.

Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04 14:21:00 -03:00
Devin Heitmueller 38b2df95c5 [media] drx-j: add a driver for Trident drx-j frontend
Add support for the Trident DRX-J driver, including a card profile for the
PCTV 80e which uses the chip.

Thanks to Trident for allowing the release of this code under a BSD license,
and of course Hauppauge/PCTV for pushing for its release to the community.

[pdickeybeta@gmail.com: modified to fix compilation errors and also to move
 the driver files from the drx39xy subdirectory to the frontends directory]

[m.chehab@samsung.com: fix merge conflicts, commented drx-j compilation and
 added EM28XX_R06_I2C_CLK setup also to the board setup]

Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04 14:20:23 -03:00
Mauro Carvalho Chehab 52f7b00e64 [media] em28xx: Display the used DVB alternate
That helps to understand what's going there.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04 14:19:18 -03:00
Mauro Carvalho Chehab ffdeca885e [media] em28xx_dvb: only call the software filter if data
Several URBs will be simply not filled. Don't call the DVB
core software filter for those empty URBs.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-04 14:19:12 -03:00
Shuah Khan cd701c8975 [media] em28xx: implement em28xx_usb_driver suspend, resume, reset_resume hooks
Implement em28xx_usb_driver suspend, resume, and reset_resume hooks.
These hooks will invoke em28xx core em28xx_suspend_extension() and
em28xx_resume_extension() to suspend and resume registered extensions.

Approach:
Add power management support to em28xx usb driver. This driver works in
conjunction with extensions for each of the functions on the USB device
for video/audio/dvb/remote functionality that is present on media USB
devices it supports. During suspend and resume each of these extensions
will have to do their part in suspending the components they control.

Adding suspend and resume hooks to the existing struct em28xx_ops will
enable the extensions the ability to implement suspend and resume hooks
to be called from em28xx driver. The overall approach is as follows:

-- add suspend and resume hooks to em28xx_ops
-- add suspend and resume routines to em28xx-core to invoke suspend
   and resume hooks for all registered extensions.
-- change em28xx dvb, audio, input, and video extensions to implement
   em28xx_ops: suspend and resume hooks. These hooks do what is necessary
   to suspend and resume the devices they control.

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-03 06:46:48 -03:00
Shuah Khan a61f68119a [media] em28xx-video: implement em28xx_ops: suspend/resume hooks
Implement em28xx_ops: suspend/resume hooks. em28xx usb driver will
invoke em28xx_ops: suspend and resume hooks for all its extensions
from its suspend() and resume() interfaces.

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-03 06:46:36 -03:00
Shuah Khan 5025076aad [media] em28xx-input: implement em28xx_ops: suspend/resume hooks
Implement em28xx_ops: suspend/resume hooks. em28xx usb driver will
invoke em28xx_ops: suspend and resume hooks for all its extensions
from its suspend() and resume() interfaces.

[m.chehab@samsung.com: Fix a breakage caused by calling a non-existing
 function call: schedule_delayed_work_sync(), and test if IR was defined
 at suspend/resume]

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-03 06:46:25 -03:00
Shuah Khan ca2b46dacb [media] em28xx-dvb: implement em28xx_ops: suspend/resume hooks
Implement em28xx_ops: suspend/resume hooks. em28xx usb driver will
invoke em28xx_ops: suspend and resume hooks for all its extensions
from its suspend() and resume() interfaces.

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-03 06:46:15 -03:00
Shuah Khan 6d746f91f2 [media] em28xx-audio: implement em28xx_ops: suspend/resume hooks
Implement em28xx_ops: suspend/resume hooks. em28xx usb driver will
invoke em28xx_ops: suspend and resume hooks for all its extensions
from its suspend() and resume() interfaces.

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-03 06:46:07 -03:00
Shuah Khan 9c669b7314 [media] em28xx: add suspend/resume to em28xx_ops
em28xx usb driver will have to suspend and resume its extensions. Adding
suspend and resume to em28xx_ops gives extensions the ability to install
suspend and resume that can be invoked from em28xx_usb driver suspend()
and resume() interfaces.

Approach:
Add power management support to em28xx usb driver. This driver works in
conjunction with extensions for each of the functions on the USB device
for video/audio/dvb/remote functionality that is present on media USB
devices it supports. During suspend and resume each of these extensions
will have to do their part in suspending the components they control.

Adding suspend and resume hooks to the existing struct em28xx_ops will
enable the extensions the ability to implement suspend and resume hooks
to be called from em28xx driver. The overall approach is as follows:

-- add suspend and resume hooks to em28xx_ops
-- add suspend and resume routines to em28xx-core to invoke suspend
   and resume hooks for all registered extensions.
-- change em28xx dvb, audio, input, and video extensions to implement
   em28xx_ops: suspend and resume hooks. These hooks do what is necessary
   to suspend and resume the devices they control.

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-03 06:45:57 -03:00
Antti Palosaari 425f53aaf7 [media] em28xx-dvb: fix PCTV 461e tuner I2C binding
Add missing m88ts2022 module reference counts as removing that module
is not allowed when it is used by em28xx-dvb module. That same module
was not unregistered correctly, fix it too.

Error cases validated by returning errors from m88ds3103, m88ts2022
and a8293 probe().

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-02-24 10:28:52 -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
Mauro Carvalho Chehab 37e59f876b [media, edac] Change my email address
There are several left overs with my old email address.
Remove their occurrences and add myself at CREDITS, to
allow people to be able to reach me on my new addresses.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-02-07 08:03:07 -02:00
Frank Schaefer 123a17d142 [media] em28xx-i2c: fix the error code for unknown errors
Commit e63b009d6e "em28xx-i2c: Fix error code for I2C error transfers"
changed the code to return -ETIMEDOUT on all unknown errors.
But the proper error code for unknown errors is -EIO.
So only report -ETIMEDOUT in case of the errors 0x02 and 0x04, which
are according to Mauro Carvalho Chehab's tests related to i2c clock
stretching and return -EIO for the rest.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-02-04 16:43:05 -02:00
Frank Schaefer 8ae8cd6c3e [media] em28xx-i2c: fix the i2c error description strings for -ENXIO
Commit d845fb3ae5 "em28xx-i2c: add timeout debug information if i2c_debug enabled"
has added wrong error descriptions for -ENXIO.
The strings are also missing terminating newline characters, which breaks the
output format.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-02-04 16:41:51 -02:00
Frank Schaefer d86bc65a64 [media] em28xx-v4l: do not call em28xx_init_camera() if the device has no sensor
This avoids the unnecessary temporary registration of a dummy V4L2 clock.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-02-04 16:41:21 -02:00
Frank Schaefer cb497c75fd [media] em28xx-camera: fix return value checks on sensor probing
Since commit e63b009d6e the returned error code in case of not connected/responding
i2c clients is ENXIO isntead of ENODEV, which causes several error messages on
sensor probing.
Fix the i2c return value checks on sensor probing to silence these warnings.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-02-04 16:40:43 -02:00
Frank Schaefer 103f18a27d [media] em28xx-video: do not unregister the v4l2 dummy clock before v4l2_device_unregister() has been called
Otherwiese the core refuses to unregister the clock and the following warning
appears in the system log:

"WARNING: ... at drivers/media/v4l2-core/v4l2-clk.c:231 v4l2_clk_unregister+0x8a/0x90 [videodev]()
 v4l2_clk_unregister(): Refusing to unregister ref-counted 11-0030:mclk clock!"

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-02-04 16:40:26 -02:00
Frank Schaefer 01ae3b51af [media] em28xx-audio: fix user counting in snd_em28xx_capture_open()
dev->adev.users always needs to be increased when snd_em28xx_capture_open() is
called and succeeds.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Cc: stable@vger.kernel.org
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-02-04 16:39:55 -02:00
Fengguang Wu 9e8ca38c52 [media] em28xx-cards: em28xx_devused can be static
Fix sparse warning:
	drivers/media/usb/em28xx/em28xx-cards.c:69:1: sparse: symbol 'em28xx_devused' was not declared. Should it be static?

Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-02-04 13:02:35 -02:00
Mauro Carvalho Chehab c3aed26218 [media] em28xx-cards: properly initialize the device bitmap
Instead of just creating a long int, use DECLARE_BITMAP().

No functional changes.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-01-15 11:46:20 -02:00
Wei Yongjun ff0284cc0b [media] em28xx-audio: remove needless check before usb_free_coherent()
usb_free_coherent() is safe with NULL addr and this check is
not required.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-01-15 09:12:03 -02:00
Mauro Carvalho Chehab bf6e8aaa32 [media] em28xx-audio: provide an error code when URB submit fails
Instead of just saying:
	[ 1646.412419] em2882/3 #0: submit of audio urb failed
Print the reason why it failed, to help debugging and fixing it.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-01-14 19:26:07 -02:00
Frank Schaefer 0191a2a28c [media] em28xx: fix check for audio only usb interfaces when changing the usb alternate setting
Previously, we've been assuming that the video endpoints are always at usb
interface 0. Hence, if vendor audio endpoints are provided at a separate
interface, they were supposed to be at interface number > 0.
Instead of checking for (interface number > 0) to determine if an interface
is a pure audio interface, dev->is_audio_only should be checked.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-01-14 19:25:17 -02:00
Frank Schaefer 961717b41b [media] em28xx: fix usb alternate setting for analog and digital video endpoints > 0
The current code assumes that the analog + digital video endpoints are always at
interface number 0 when changing the alternate setting.
This seems to work fine for most existing devices.
However, at least the SpeedLink VAD Laplace webcam has the video endpoint on
interface number 3 (which fortunately doesn't cause any trouble because ist uses
bulk transfers only).
We already consider the actual interface number for audio endpoints, so
rename the the audio_ifnum variable and use it for all device types.
Also get get rid of a pointless (ifnum < 0) in em28xx-audio.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-01-14 19:24:38 -02:00
Fengguang Wu 8068eb885a [media] em28xx: make 'em28xx_ctrl_ops' static
sparse warnings: (new ones prefixed by >>)

>> drivers/media/usb/em28xx/em28xx-video.c:1151:28: sparse: symbol 'em28xx_ctrl_ops' was not declared. Should it be static?

Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-01-14 19:22:34 -02:00
Mauro Carvalho Chehab 452f236fcf em28xx-alsa: Fix error patch for init/fini
If something bad happens during init, we free the card data.
However, we still keep it initialized, causing some dependent
code to be called at .fini.

Fix it.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-01-14 14:49:04 -02:00
Mauro Carvalho Chehab b49eb2bd71 [media] em28xx-audio: flush work at .fini
As a pending action might be still there at the work
thread, flush it.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-01-14 14:44:11 -02:00
Mauro Carvalho Chehab 4b81972498 [media] drxk: remove the option to load firmware asynchronously
The option to load firmware asynchronously were added due to
a requirement with a few versions of udev. It turns that this was
a bad idea and caused regressions on drxk-based devices.

So, we end by only letting the firmware to be loaded syncronously
everywhere.

So, let's remove the bad code.

This patch partially reverts the changeset 8e30783b0b.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-01-14 14:40:10 -02:00
Mauro Carvalho Chehab a02b9c238b [media] em28xx: adjust period size at runtime
While the current hardcoded period is ok for the current values,
we may latter change the driver to work with different bit rates
or with different latencies than 64ms.

So, adust the period size at runtime.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-01-14 14:39:52 -02:00