1
0
Fork 0
Commit Graph

1607 Commits (16a8a49be1b878ef6dd5d1663d456e254e54ae3d)

Author SHA1 Message Date
Mauro Carvalho Chehab faebbd8f13 [media] lmedm04: fix the range for relative measurements
Relative measurements are typically between 0 and 0xffff. However,
for some tuners (TUNER_S7395 and TUNER_S0194), the range were from
0 to 0xff00, with means that 100% is never archived.
Also, TUNER_RS2000 uses a more complex math.

So, create a macro that does the conversion using bit operations
and use it for all conversions.

The code is also easier to read with is a bonus.

While here, remove a bogus comment.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-06-24 08:38:30 -03:00
Mauro Carvalho Chehab 5ae65db547 [media] lmedm04: use u32 instead of u64 for relative stats
Cleanup this sparse warning:
	drivers/media/usb/dvb-usb-v2/lmedm04.c:302 lme2510_update_stats() warn: should '((255 - st->signal_sn - 161) * 3) << 8' be a 64 bit type?

Both c_tmp and s_tmp actually stores a u16 stat. Using a u64 data
there is a waste, specially on u32 archs, as 64 ints there are more
expensive.

So, change the types to u32 and do the typecast only when storing
the result.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-06-24 08:38:30 -03:00
Rafael Lourenço de Lima Chehab e42c8c6eb4 [media] au0828: move dev->boards atribuition to happen earlier
The attribution of dev->boards occured too late, which
would couse an OOPS in media controller registration.

Signed-off-by: Rafael Lourenço de Lima Chehab <chehabrafael@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-06-10 12:39:35 -03:00
Malcolm Priestley 48c91aadc5 [media] lmedm04: implement dvb v5 statistics
Indroduce function lme2510_update_stats to update
statistics directly from usb interrupt.

Provide signal and snr wrap rounds for dvb v3 functions.

Block and post bit are not available.

When i2c_talk_onoff is on no statistics are available,
with possible future hand over to the relevant frontend/tuner.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-06-10 12:37:54 -03:00
Malcolm Priestley 9e8715c91d [media] lmedm04: Enable dont_poll for TS2020 tuner
Following a change made to TS2020 tuner in patches
ts2020: Provide DVBv5 API signal strength
ts2020: Allow stats polling to be suppressed

Polling on the driver must be suppressed because
the demuxer is stopped by I2C messages.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-06-10 11:12:42 -03:00
David Howells 0f91c9d6ba [media] TS2020: Calculate tuner gain correctly
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: David Howells <dhowells@redhat.com>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-06-10 11:10:27 -03:00
Antti Palosaari 76b91be3d3 [media] em28xx: PCTV 461e use I2C client for demod and SEC
Use I2C client binding for demod and SEC.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-06-10 11:09:20 -03:00
Tommi Rantala eee1d06dc2 [media] cx231xx: Add support for Terratec Grabby
Add support for the Terratec Grabby with USB ID 0ccd:00a6.

Signed-off-by: Tommi Rantala <tt.rantala@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-06-09 18:37:08 -03:00
Mauro Carvalho Chehab 09f2082e23 [media] usb drivers: use BUG_ON() instead of if () BUG
Some USB drivers have a logic at the VB buffer handling like:
	if (in_interrupt())
		BUG();
Use, instead:
	BUG_ON(in_interrupt());

Btw, this logic looks weird on my eyes. We should convert them
to use VB2, in order to avoid those crappy things.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-06-09 18:30:09 -03:00
Mauro Carvalho Chehab 0df289a209 [media] dvb: Get rid of typedev usage for enums
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: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Acked-by: Stefan Richter <stefanr@s5r6.in-berlin.de> # for drivers/media/firewire/*
2015-06-09 17:47:35 -03:00
Hans Verkuil 7f3c2e1d1d [media] cx231xx: fix compiler warning
Fix this compiler warning by allocating a structure to read the eeprom instead
of doing it on the stack and worse: the eeprom array is static, so that can
cause problems if there are multiple cx231xx instances.

cx231xx-cards.c: In function 'cx231xx_card_setup':
cx231xx-cards.c:1110:1: warning: the frame size of 2064 bytes is larger than 2048 bytes [-Wframe-larger-than=]
 }
 ^

I did consider removing the code altogether since the result is actually
not used at the moment, but I decided against it since it is used in other
drivers and someone might want to start using it in this driver as well. And
then it is useful that the code is already there.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-06-09 17:46:24 -03:00
Hans Verkuil ebbb563755 [media] stk1160: add DMABUF support
Implement DMABUF exporting and importing.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-06-06 07:33:36 -03:00
Antti Palosaari 8022f9afcd [media] em28xx: bind PCTV 460e using I2C client
Load PCTV 460e tda10071 demod and a8293 SEC using I2C client bindings.
Remove old unused tda10071 config struct. We are using I2C platform
data now.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-06-06 07:22:52 -03:00
Antti Palosaari 7098f582e0 [media] em28xx: add support for DVB SEC I2C client
Add support for DVB SEC (satellite equipment controller) I2C client.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-06-06 07:22:00 -03:00
Mauro Carvalho Chehab b295e5c7d8 [media] usbvision: cleanup the code
There's a dead code on usbvision that makes it harder to read
and produces a smatch warning about bad identation.

Improve the code readability and add a FIXME to warn about
the current hack there.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-06-05 11:26:47 -03:00
Mauro Carvalho Chehab 485bdbb6b8 [media] tm6000: remove needless check
Smatch reports a warning:
	drivers/media/usb/tm6000/tm6000-video.c:646 tm6000_prepare_isoc() error: we previously assumed 'dev->urb_buffer' could be null (see line 624)

This is not really a problem, but it actually shows that the check
if urb_buffer is NULL is being done twice: at the if and at
tm6000_alloc_urb_buffers().

We don't need to do it twice. So, remove the extra check. The code
become cleaner, and, as a collateral effect, smatch becomes happy.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-06-05 11:26:37 -03:00
Mauro Carvalho Chehab 7fdc5561ca [media] em28xx: remove dead code
As reported by smatch:
	drivers/media/usb/em28xx/em28xx-video.c:842 get_ressource() info: ignoring unreachable code.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-06-05 08:03:01 -03:00
Laurent Pinchart d511eb7d64 [media] uvcvideo: Remove unneeded device disconnected flag
The UVC_DEV_DISCONNECTED flag is set when the USB device is
disconnected, and checked in the open() handler to refuse opening a
device that has been disconnected.

This is inherently racy, but the race condition is taken care of in the
V4L2 core, which also fails open() calls when the V4L2 device node has
been unregistered. As the uvcvideo USB disconnect handler unregisters
all its video device nodes, the UVC_DEV_DISCONNECTED flag doesn't serve
any purpose anymore and can be removed.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-30 12:12:58 -03:00
Laurent Pinchart 37f85b276a [media] uvcvideo: Fix incorrect bandwidth with Chicony device 04f2:b50b
The "TOSHIBA Web Camera - 5M" Chicony device (04f2:b50b) seems to
compute the bandwidth on 16 bits and erroneously sign-extend it to
32 bits, resulting in a huge bandwidth value. Detect and fix that
condition by setting the 16 MSBs to 0 when they're all equal to 1.

Reported-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-30 12:12:15 -03:00
Laurent Pinchart 7195f61b80 [media] uvcvideo: Implement DMABUF exporter role
Now that videobuf2-vmalloc supports exporting buffers, add support for
the DMABUF exporter role by plugging in the videobuf2 ioctl helper.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-30 12:11:40 -03:00
Antti Palosaari baf06b5190 [media] af9035: add USB ID 07ca:0337 AVerMedia HD Volar (A867)
It is AF9035 + MxL5007T.
Driver reports:
prechip_version=00 chip_version=03 chip_type=3802

Not sure if that USB ID is reserved only for HP brand or if it is
common, but the stick I have is branded as HP part no. 580715-001
rmn A867.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-30 12:08:50 -03:00
Vasily Khoruzhick d8fd9f5625 [media] gspca: sn9c2028: Add gain and autogain controls Genius Videocam Live v2
Autogain algorithm is very simple, if average luminance is low - increase gain,
if it's high - decrease gain. Gain granularity is low enough for this algo to
stabilize quickly.

Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-30 11:48:09 -03:00
Vasily Khoruzhick 48c291eda7 [media] gspca: sn9c2028: Add support for Genius Videocam Live v2
This cam seems to return different values on long commands, so make status check
in sn9c2028_long_command() more tolerant. Anyway, read value isn't used anywhere
later.

Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-30 11:47:29 -03:00
Antti Palosaari 9ea964f369 [media] rtl28xxu: load SDR module for fc2580 based devices
Load rtl2832_sdr driver for devices having fc2580 tuner.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-18 15:59:35 -03:00
Antti Palosaari 7e33f8a282 [media] rtl28xxu: set correct FC2580 tuner for RTL2832 demod
rtl2832 demod driver has support for FC2580 tuner config, no need to
abuse FC0012 settings anymore.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-18 15:56:19 -03:00
Antti Palosaari 88ffe55ae3 [media] rtl28xxu: bind tua9001 using I2C binding
Change tua9001 driver from media binding to I2C client binding.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-18 15:52:36 -03:00
Antti Palosaari b6c5fe70a7 [media] af9035: bind tua9001 using I2C binding
Change tua9001 driver from media binding to I2C client binding.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-18 15:52:14 -03:00
Antti Palosaari b3f02270b2 [media] af9035: fix device order in ID list
Driver supports multiple chipset versions. Devices are ordered to
ID table per used chipset type. "ITE 9303 Generic" device uses IT9303
chipset and was added mistakenly between IT9135 IDs.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-18 15:51:02 -03:00
Antti Palosaari 7a893ba9c8 [media] af9035: bind fc2580 using I2C binding
Change fc2580 driver from media binding to I2C client binding.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-18 15:46:16 -03:00
Antti Palosaari 35fc0e0fcb [media] rtl28xxu: bind fc2580 using I2C binding
Change fc2580 driver from media binding to I2C client binding.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-18 15:45:55 -03:00
Mauro Carvalho Chehab 0fae1997f0 [media] dib0700: avoid the risk of forgetting to add the adapter's size
For every frontend entry, we need to add the adapter's size. There
are already two patches fixing it. So, it doesn't seem trivial to
keep it there at the right place.

Also, currently, the indentation is wrong on all places.

So, it seems that keeping it right is not too trivial.

Better to use a macro that would do it for us, at least while
this is not converted to dvb-usb-v2.

Compile-tested only.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-14 19:31:34 -03:00
Antti Palosaari f7e5a65596 [media] msi2500: cleanups
Rename state to dev.
Correct some indentations.
Remove FSF address.
Fix some style issues reported by checkpatch.pl.
Correct some style issues I liked.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-14 08:27:23 -03:00
Antti Palosaari faf22b13ee [media] msi2500: revise synthesizer calculation
Update synthesizer calculation to model I prefer nowadays. It is mostly
just renaming some variables, but also minor functionality change how
integer and fractional part are divided (using div_u64_rem()). Also, add
'schematic' of synthesizer following my current understanding.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-14 07:57:41 -03:00
Thomas Reitmayr e989a73ebd [media] media: Fix regression in some more dib0700 based devices
Fix an oops during device initialization by correctly setting size_of_priv
instead of leaving it 0.
The regression was introduced by 8abe4a0a3f ("[media] dib7000:
export just one symbol") and only fixed for one type of dib0700 based
devices in 9e334c7564 ("[media] Fix regression in some dib0700
based devices").

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=92301

Fixes: 8abe4a0a3f ("[media] dib7000: export just one symbol")

Cc: stable@vger.kernel.org # for version 3.17+
Signed-off-by: Thomas Reitmayr <treitmayr@devbase.at>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-13 18:18:39 -03:00
Olli Salonen 356484cabe [media] dw2102: resync fifo when demod locks
If the streaming_ctrl is called to enable TS before demod has locked
the TS will be empty. Copied the solution from the dvbsky driver for the
TechnoTrend S2-4600 device: when the state changes from unlock to
lock, call su3000_streaming_ctrl again.

Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-13 17:12:42 -03:00
Olli Salonen c636bd0bce [media] dw2102: remove unnecessary printing of MAC address
While reading the MAC address for SU3000-based devices the system was
printing excessive debug information in the logs:

Output before the patch:

[ 1515.780692] bc 00 00 00 00 00
[ 1515.781440] bc ea 00 00 00 00
[ 1515.782251] bc ea 2b 00 00 00
[ 1515.783094] bc ea 2b 46 00 00
[ 1515.783816] bc ea 2b 46 12 00
[ 1515.784565] bc ea 2b 46 12 92
[ 1515.784571] dvb-usb: MAC address: bc:ea:2b:46:12:92

Output after the patch:

[ 3803.495706] dvb-usb: MAC address: bc:ea:2b:46:12:92

Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-13 17:12:02 -03:00
David Härdeman 4d298b8539 [media] rc-core: fix dib0700 scancode generation for RC5
commit af3a4a9bbe ("[media] dib0700: NEC scancode cleanup") cleaned
up the NEC scancode logic but overlooked the RC5 case.

This patch brings the RC5 case in line with the NEC code and makes
the struct self-documenting.

Signed-off-by: David Härdeman <david@hardeman.nu>
Reported-by: David Cimbůrek <david.cimburek@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-12 18:27:25 -03:00
Wei Yongjun 250d2ff016 [media] rtl28xxu: fix return value check in rtl2832u_tuner_attach()
In case of error, the function platform_device_register_data() returns
ERR_PTR() and never returns NULL. The NULL test in the return value check
should be replaced with IS_ERR().

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-12 13:27:22 -03:00
Olli Salonen 699dcffc52 [media] rtl2832: add support for GoTView MasterHD 3 USB tuner
GoTView MasterHD 3 is a DVB-T2/C USB 2.0 tuner.

It's based on the following components:
- USB bridge: RTL2832P (contains also DVB-T demodulator)
- Demodulator: Si2168-A30
- Tuner: Si2148-A20

The demodulator and the tuner will need firmwares. The Si2148 uses Si2158
firmware. Antti has the firmwares available for download:
http://palosaari.fi/linux/v4l-dvb/firmware/

Do note that for DVB-T either of the demodulators can be used. DVB-C and
DVB-T2 are only supported by the Si2168 demodulator. The driver will
register 2 frontends for the same adapter. Frontend 0 will be the RTL2832
demodulator and frontend 1 will be the Si2168 demodulator. The same
tuner is used for both.

As a consequence of the above, it's recommended to use application that
does implement proper DVBv5 support.

For some reason, the old I2C write method sporadically fails. Thus the
need for an option to only use the new I2C write method supported by the
RTL2832.

Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-12 13:25:35 -03:00
Olli Salonen d744a0cb8a [media] rtl28xxu: add I2C read without write
Add support for I2C read operation without a preceeding write.

While here, change the error code to EOPNOTSUPP in case an
unsupported I2C operation is attempted.

Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-12 13:21:29 -03:00
Olli Salonen ee3c3e4688 [media] si2157: support selection of IF interface
The chips supported by the si2157 driver have two IF outputs (either
pins 12+13 or pins 9+11). Instead of hardcoding the output to be used
add an option to choose which output shall be used.

As this patch changes the default behaviour, the IF interface is
specified in each driver currently using si2157 driver. This is to
keep bisectability.

Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-12 13:20:55 -03:00
Olli Salonen c060f9329f [media] dvbsky: use si2168 config option ts_clock_gapped
Change the dvbsky driver to support gapped clock instead of the current
hack.

Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-12 13:17:19 -03:00
Olli Salonen 44767fc418 [media] dw2102: TeVii S482 support
TeVii S482 is a PCIe device with two tuners that actually contains two
USB devices. The devices are visible in the lsusb printout.

Bus 006 Device 002: ID 9022:d483 TeVii Technology Ltd.
Bus 007 Device 002: ID 9022:d484 TeVii Technology Ltd.

The device itself works exactly with the same settings as TechnoTrend
TT-connect S2-4600. Firmware for DS3103 demodulator is required:
http://palosaari.fi/linux/v4l-dvb/firmware/M88DS3103/

This patch should be applied on top of the TT S2-4600 patch:
https://patchwork.linuxtv.org/patch/28818/

Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-12 08:02:41 -03:00
Hans Verkuil ebf984bb15 [media] v4l2: replace s_mbus_fmt by set_fmt in bridge drivers
Replace all calls to s_mbus_fmt in bridge drivers by calls to the
set_fmt pad op.

Remove the old try/s_mbus_fmt video ops since they are now no longer used.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Acked-by: Prabhakar Lad <prabhakar.csengg@gmail.com>
Acked-by: Scott Jiang <scott.jiang.linux@gmail.com>
Cc: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-01 09:01:16 -03:00
Hans Verkuil 6e80c4738a [media] v4l2: replace s_mbus_fmt by set_fmt
The s_mbus_fmt video op is a duplicate of the pad op. Replace all uses
in sub-devices by the set_fmt() pad op.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-01 08:52:34 -03:00
Hans Verkuil a988410ad1 [media] usbtv: fix v4l2-compliance issues
Running v4l2-compliance on my usbtv stick revealed two failures:

1) Correct handling of CREATE_BUFS in usbtv_queue_setup was missing. Added this.
2) The sequence counter wasn't reset to 0 when starting streaming.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-01 07:35:24 -03:00
Julia Lawall bfe40b79e9 [media] as102: fix error return code
Return a negative error code on failure.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@@
identifier ret; expression e1,e2;
@@
(
if (\(ret < 0\|ret != 0\))
 { ... return ret; }
|
ret = 0
)
... when != ret = e1
    when != &ret
*if(...)
{
  ... when != ret = e2
      when forall
 return ret;
}
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-01 07:00:51 -03:00
Mauro Carvalho Chehab cd65d24e03 [media] xirlink_cit: comment unreachable code
drivers/media/usb/gspca/xirlink_cit.c:1776 cit_start_model2() info: ignoring unreachable code.
drivers/media/usb/gspca/xirlink_cit.c:1858 cit_start_model2() info: ignoring unreachable code.
drivers/media/usb/gspca/xirlink_cit.c:1910 cit_start_model2() info: ignoring unreachable code.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-01 06:27:08 -03:00
Mauro Carvalho Chehab 48902bc7d0 [media] dw2102: fix bad indenting
drivers/media/usb/dvb-usb/dw2102.c:440 dw2104_i2c_transfer() warn: inconsistent indenting

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-01 06:26:47 -03:00
Mauro Carvalho Chehab ab4bc55ebd [media] af9005: fix bad indenting
drivers/media/usb/dvb-usb/af9005-fe.c:484 af9005_fe_read_status() warn: inconsistent indenting

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-01 06:26:31 -03:00
Mauro Carvalho Chehab 316c46b8f3 [media] dib0700: fix bad indentation
drivers/media/usb/dvb-usb/dib0700_devices.c:864 dib7770_set_param_override() warn: inconsistent indenting

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-01 06:26:05 -03:00
Mauro Carvalho Chehab ff1522d546 [media] usbvision: fix bad indentation
drivers/media/usb/usbvision/usbvision-core.c:2395 usbvision_init_isoc() warn: inconsistent indenting

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-01 06:25:28 -03:00
Mauro Carvalho Chehab 3ff105ed9f [media] ttusb-dec: fix bad indentation
drivers/media/usb/ttusb-dec/ttusb_dec.c:1434 ttusb_dec_init_stb() warn: inconsistent indenting

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-01 06:24:49 -03:00
Mauro Carvalho Chehab f419edd4f7 [media] pvrusb2: fix inconsistent indenting
smatch complains about multiple issues here:
	drivers/media/usb/pvrusb2/pvrusb2-context.c:402 pvr2_channel_claim_stream() warn: inconsistent indenting
	drivers/media/usb/pvrusb2/pvrusb2-ioread.c:240 pvr2_ioread_setup() warn: inconsistent indenting
	drivers/media/usb/pvrusb2/pvrusb2-ioread.c:255 pvr2_ioread_set_enabled() warn: inconsistent indenting
	drivers/media/usb/pvrusb2/pvrusb2-ioread.c:485 pvr2_ioread_read() warn: inconsistent indenting
	drivers/media/usb/pvrusb2/pvrusb2-io.c:522 pvr2_stream_set_callback() warn: inconsistent indenting
	drivers/media/usb/pvrusb2/pvrusb2-io.c:561 pvr2_stream_set_buffer_count() warn: inconsistent indenting
	drivers/media/usb/pvrusb2/pvrusb2-io.c:640 pvr2_buffer_queue() warn: inconsistent indenting
	drivers/media/usb/pvrusb2/pvrusb2-io.c:667 pvr2_buffer_set_buffer() warn: inconsistent indenting
	drivers/media/usb/pvrusb2/pvrusb2-io.c:668 pvr2_buffer_set_buffer() warn: inconsistent indenting
	drivers/media/usb/pvrusb2/pvrusb2-hdw.c:2614 pvr2_hdw_create() warn: inconsistent indenting
	drivers/media/usb/pvrusb2/pvrusb2-hdw.c:2740 pvr2_hdw_destroy() warn: inconsistent indenting
	drivers/media/usb/pvrusb2/pvrusb2-hdw.c:3353 pvr2_hdw_trigger_module_log() warn: inconsistent indenting

Let's get rid of those, in order to cleanup as much as possible the smatch error log.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-01 06:12:01 -03:00
Mauro Carvalho Chehab e2f233d97b [media] stk014: fix bad indenting
drivers/media/usb/gspca/stk014.c:279 sd_start() warn: inconsistent indenting

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-01 06:11:22 -03:00
Mauro Carvalho Chehab 513641293d [media] sonixj: fix bad indenting
drivers/media/usb/gspca/sonixj.c:1792 expo_adjust() warn: inconsistent indenting

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-01 06:11:05 -03:00
Mauro Carvalho Chehab 269d91f53f [media] vp702x: comment dead code
Since the first version of this driver, the remote controller
code is disabled, adding an early return inside vp702x_rc_query().

Let's disable the code with #if 0, to remove this warning:

drivers/media/usb/dvb-usb/vp702x.c:268 vp702x_rc_query() info: ignoring unreachable code.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-01 06:10:18 -03:00
Mauro Carvalho Chehab 6629e4de82 [media] go7007: Comment some dead code
drivers/media/usb/go7007/go7007-usb.c:1099 go7007_usb_probe() info: ignoring unreachable code.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-01 06:09:52 -03:00
Mauro Carvalho Chehab 6962685384 [media] cx231xx: fix bad indenting
drivers/media/usb/cx231xx/cx231xx-avcore.c:1598 cx231xx_set_DIF_bandpass() warn: inconsistent indenting
drivers/media/usb/cx231xx/cx231xx-core.c:656 cx231xx_demod_reset() warn: inconsistent indenting
drivers/media/usb/cx231xx/cx231xx-core.c:659 cx231xx_demod_reset() warn: inconsistent indenting
drivers/media/usb/cx231xx/cx231xx-core.c:664 cx231xx_demod_reset() warn: inconsistent indenting
drivers/media/usb/cx231xx/cx231xx-core.c:669 cx231xx_demod_reset() warn: inconsistent indenting
drivers/media/usb/cx231xx/cx231xx-core.c:673 cx231xx_demod_reset() warn: inconsistent indenting
drivers/media/usb/cx231xx/cx231xx-417.c:1164 cx231xx_initialize_codec() warn: inconsistent indenting

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-01 06:06:49 -03:00
Mauro Carvalho Chehab 094af36a3a [media] zc3xx: remove dead code and uneeded gotos
As reported by smatch:
	drivers/media/usb/gspca/zc3xx.c:5994 transfer_update() info: ignoring unreachable code.

That happens because there's a return that it is never called,
as the work queue runs an infinite loop, except when the device is
put to sleep or an error happens.

When an error happens, a break statement is enough to go out of
the loop. So, let's remove the goto, as break is the typical
instruction used to end a loop.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-30 14:27:53 -03:00
Mauro Carvalho Chehab b036f1cb6e [media] zc3xx: don't go past quality array
drivers/media/usb/gspca/zc3xx.c:6363 zcxx_s_ctrl() error: buffer overflow 'jpeg_qual' 3 <= 3

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-30 14:27:15 -03:00
Mauro Carvalho Chehab ebb326341c [media] benq: fix indentation
drivers/media/usb/gspca/benq.c:239 sd_isoc_irq() warn: inconsistent indenting

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-30 13:41:52 -03:00
Mauro Carvalho Chehab 747598d5b6 [media] go7007: don't use vb before test if it is not NULL
As reported by smatch:
	drivers/media/usb/go7007/go7007-driver.c:452 frame_boundary() warn: variable dereferenced before check 'vb' (see line 449)

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-30 13:41:03 -03:00
Mauro Carvalho Chehab 676ee36be0 Merge branch 'patchwork' into v4l_for_linus
* patchwork: (404 commits)
  [media] uvcvideo: add support for VIDIOC_QUERY_EXT_CTRL
  [media] uvcvideo: fix cropcap v4l2-compliance failure
  [media] media: omap3isp: remove unused clkdev
  [media] coda: Add tracing support
  [media] coda: drop dma_sync_single_for_device in coda_bitstream_queue
  [media] coda: fix fill bitstream errors in nonstreaming case
  [media] coda: call SEQ_END when the first queue is stopped
  [media] coda: fail to start streaming if userspace set invalid formats
  [media] coda: remove duplicate error messages for buffer allocations
  [media] coda: move parameter buffer in together with context buffer allocation
  [media] coda: allocate bitstream buffer from REQBUFS, size depends on the format
  [media] coda: allocate per-context buffers from REQBUFS
  [media] coda: use strlcpy instead of snprintf
  [media] coda: bitstream payload is unsigned
  [media] coda: fix double call to debugfs_remove
  [media] coda: check kasprintf return value in coda_open
  [media] coda: bitrate can only be set in kbps steps
  [media] v4l2-mem2mem: no need to initialize b in v4l2_m2m_next_buf and v4l2_m2m_buf_remove
  [media] s5p-mfc: set allow_zero_bytesused flag for vb2_queue_init
  [media] coda: set allow_zero_bytesused flag for vb2_queue_init
  ...
2015-04-21 06:12:35 -03:00
Hans Verkuil e183201b9e [media] uvcvideo: add support for VIDIOC_QUERY_EXT_CTRL
Add support for the new VIDIOC_QUERY_EXT_CTRL ioctl. Since uvc doesn't use
the control framework, support for this ioctl isn't automatic.

This is makes v4l2-compliance happy as well.

[Added blank lines for improved readability]

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-10 10:29:27 -03:00
Hans Verkuil 1461fe7ab6 [media] uvcvideo: fix cropcap v4l2-compliance failure
The v4l2-compliance tool expects that if VIDIOC_CROPCAP is defined, then
VIDIOC_G_SELECTION for TGT_CROP_BOUNDS/DEFAULT is also defined (or COMPOSE
in the case of an output device).

In fact, all that a driver has to do to implement cropcap is to support
those two targets since the v4l2 core will implement cropcap and fill in
the pixelaspect to 1/1 by default.

Implementing cropcap is only needed if the pixelaspect isn't square.

So implement g_selection instead of cropcap in uvc to fix the v4l2-compliance
failure.

[Added blank lines for improved readability]

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-10 10:26:02 -03:00
Christian Dale 09f50121e3 [media] WinFast DTV2000 DS Plus
Add Leadtek WinFast DTV2000DS Plus device based on Realtek RTL2832U.

I have not tested the remote, but it is the Y04G0051 model.

Signed-off-by: Christian Dale <kernel@techmunk.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-08 15:41:58 -03:00
Dimitris Lampridis 882302c859 [media] rtl28xxu: add support for Turbo-X DTT2000
ID 1b80:d3a4 Afatech

Simply added the PID (0xd3a4) of this DVB-T USB device to the list of rtl2832u-supported devices. VID (0x1b80) is same as KWORLD2.

Tested and verified to work in amd64 with kernels 3.13.0 and 3.16.0.

Signed-off-by: Dimitris Lampridis <dlampridis@logikonlabs.com>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-08 13:14:38 -03:00
David Howells 974e08d8f0 [media] cxusb: Use enum to represent table offsets rather than hard-coding numbers
Use enum to represent table offsets rather than hard-coding numbers to avoid
problems with the numbers becoming out of sync with the table.

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-08 12:36:37 -03:00
Luis de Bethencourt 67a260f1eb [media] dib0700: remove unused macros
Remove unused macros RC_REPEAT_DELAY and RC_REPEAT_DELAY_V1_20

Signed-off-by: Luis de Bethencourt <luis.bg@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-08 08:33:13 -03:00
Luis de Bethencourt e68c2fe64c [media] dvb-usb: fix spaces after commas
Fixing a few checkpatch errors of type: space required after that ','

Signed-off-by: Luis de Bethencourt <luis.bg@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-08 07:39:24 -03:00
Benjamin Larsson 021cd2d21b [media] mn88472: add ts mode and ts clock to driver
Signed-off-by: Benjamin Larsson <benjamin@southpole.se>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-08 06:54:41 -03:00
Hans Verkuil d8da7513bc [media] uvc: embed video_device
Embed the video_device struct to simplify the error handling and in
order to (eventually) get rid of video_device_alloc/release.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-08 06:47:13 -03:00
Hans Verkuil d4352f3639 [media] em28xx: embed video_device
Embed the video_device struct to simplify the error handling and in
order to (eventually) get rid of video_device_alloc/release.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-08 06:46:31 -03:00
Alexey Khoroshilov afd270d1a4 [media] usbvision: fix leak of usb_dev on failure paths in usbvision_probe()
There is no usb_put_dev() on failure paths in usbvision_probe().

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

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02 23:55:20 -03:00
Hans Verkuil 60acf18768 [media] cx231xx: embed video_device
Embed the video_device struct to simplify the error handling and in
order to (eventually) get rid of video_device_alloc/release.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02 23:53:34 -03:00
Hans Verkuil 2aa689dd80 [media] usbvision: embed video_device
Embed the video_device struct to simplify the error handling and in
order to (eventually) get rid of video_device_alloc/release.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02 23:52:21 -03:00
Hans Verkuil 65b88c0be1 [media] tm6000: embed video_device
Embed the video_device struct to simplify the error handling and in
order to (eventually) get rid of video_device_alloc/release.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02 23:49:49 -03:00
Hans Verkuil 4b30409b1b [media] hdpvr: embed video_device
Embed the video_device struct to simplify the error handling and in
order to (eventually) get rid of video_device_alloc/release.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02 23:36:54 -03:00
Antti Palosaari 0fecb6c094 [media] dw2102: switch ts2022 to ts2020 driver
Change ts2022 driver to ts2020 driver. ts2020 driver supports
both tuner chip models.

That affects TechnoTrend TT-connect S2-4600 DVB-S/S2 device, which
Olli just added.

Cc: Olli Salonen <olli.salonen@iki.fi>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02 22:26:16 -03:00
Antti Palosaari f31a638600 [media] dvbsky: switch ts2022 to ts2020 driver
Change ts2022 driver to ts2020 driver. ts2020 driver supports
both tuner chip models.

Cc: Nibble Max <nibble.max@gmail.com>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02 22:25:52 -03:00
Antti Palosaari 83c1b6ce75 [media] em28xx: switch PCTV 461e to ts2020 driver
Change ts2022 driver to ts2020 driver as ts2020 driver now supports
both models.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02 22:24:25 -03:00
Olli Salonen 27254c3634 [media] dw2102: TechnoTrend TT-connect S2-4600 DVB-S/S2 tuner
TechnoTrend TT-connect S2-4600 is a USB2.0 DVB-S/S2 tuner using the popular
Montage M88DS3103/M88TS2022 demod/tuner.

The demodulator needs a firmware. Antti posted a firmware when releasing
support for PCTV 461e, available here:
http://palosaari.fi/linux/v4l-dvb/firmware/M88DS3103/

Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02 22:24:02 -03:00
Olli Salonen 70769b24d2 [media] dw2102: store i2c client for tuner into dw2102_state
Prepare the dw2102 driver for tuner drivers that are implemented as I2C
drivers (such as m88ts2022). The I2C client is stored in to the state
and released at disconnect.

Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02 22:24:01 -03:00
Olli Salonen 2c4ffe27d0 [media] dw2102: combine su3000_state and s6x0_state into dw2102_state
Two separate state structs are defined for different devices inside the
dw2102. Combine them, as both only contain one element.

This will also make it easier to further cleanup the driver.

Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02 22:24:01 -03:00
Benjamin Larsson 46cf707482 [media] rtl28xxu: lower the rc poll time to mitigate i2c transfer errors
The Astrometa device has issues with i2c transfers. Lowering the
poll time somehow makes these errors disappear.

Signed-off-by: Benjamin Larsson <benjamin@southpole.se>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02 21:51:37 -03:00
Guennadi Liakhovetski a37462b919 [media] V4L: remove clock name from v4l2_clk API
All uses of the v4l2_clk API so far only register one clock with a fixed
name. This allows us to get rid of it, which also will make CCF and DT
integration easier.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Josh Wu <josh.wu@atmel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02 18:32:53 -03:00
Hans Verkuil 8a55ddd94c [media] au0828: fix broken streaming
Commit c5036d61e0 ("media: au0828: drop
vbi_buffer_filled() and re-use buffer_filled()") broke video and vbi streaming.

The vb2_buffer struct was copied instead of taking a pointer to it, but
vb2_buffer_done() needs the real object, not a copy, since it is hooking
the buffer into a different list.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02 18:28:59 -03:00
Antti Palosaari b18042a673 [media] rtl28xxu: return success for unimplemented FE callback
Return success for FE callback on case we don't have any special
implementation. fc0013 tuner driver calls that callback in order to
switch antenna input, even we don't provide antenna switch.
Returning error caused fc0013 driver given up tuning.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02 18:27:14 -03:00
Hans Verkuil 27eb5e24e0 [media] cx231xx: fix compiler warnings
If CONFIG_VIDEO_CX231XX_RC is undefined, then these compiler warnings
are generated:

In file included from drivers/media/usb/cx231xx/cx231xx-cards.c:23:0:
drivers/media/usb/cx231xx/cx231xx-cards.c: In function ‘cx231xx_release_resources’:
drivers/media/usb/cx231xx/cx231xx.h:982:30: warning: statement with no effect [-Wunused-value]
 #define cx231xx_ir_exit(dev) (0)
                              ^
drivers/media/usb/cx231xx/cx231xx-cards.c:1158:2: note: in expansion of macro ‘cx231xx_ir_exit’
  cx231xx_ir_exit(dev);
  ^
drivers/media/usb/cx231xx/cx231xx-cards.c: In function ‘cx231xx_init_dev’:
drivers/media/usb/cx231xx/cx231xx.h:981:30: warning: statement with no effect [-Wunused-value]
 #define cx231xx_ir_init(dev) (0)
                              ^
drivers/media/usb/cx231xx/cx231xx-cards.c:1351:2: note: in expansion of macro ‘cx231xx_ir_init’
  cx231xx_ir_init(dev);
  ^
drivers/media/usb/cx231xx/cx231xx-cards.c: In function ‘cx231xx_usb_probe’:
drivers/media/usb/cx231xx/cx231xx.h:982:30: warning: statement with no effect [-Wunused-value]
 #define cx231xx_ir_exit(dev) (0)
                              ^
drivers/media/usb/cx231xx/cx231xx-cards.c:1705:2: note: in expansion of macro ‘cx231xx_ir_exit’
  cx231xx_ir_exit(dev);
  ^
drivers/media/usb/cx231xx/cx231xx-cards.c: In function ‘cx231xx_usb_disconnect’:
drivers/media/usb/cx231xx/cx231xx.h:982:30: warning: statement with no effect [-Wunused-value]
 #define cx231xx_ir_exit(dev) (0)
                              ^
drivers/media/usb/cx231xx/cx231xx-cards.c:1754:3: note: in expansion of macro ‘cx231xx_ir_exit’
   cx231xx_ir_exit(dev);
   ^

Fix by using static inlines instead of defines.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02 18:24:04 -03:00
Ezequiel Garcia aeff092767 [media] stk1160: Make sure current buffer is released
The available (i.e. not used) buffers are returned by stk1160_clear_queue(),
on the stop_streaming() path. However, this is insufficient and the current
buffer must be released as well. Fix it.

Cc: stable@vger.kernel.org
Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02 18:18:37 -03:00
Laurent Pinchart 1cdf60c97a [media] uvcvideo: Validate index during step-wise frame intervals enumeration
Frame intervals exposed as an interval and step (so-called step-wise)
are restricted by the V4L2 API to a single enumeration entry. Return an
error when the index is not zero.

Reported-by: Alexey Smirnoff <fling@member.fsf.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
[mchehab@osg.samsung.com: add a missing collon at the end of the return
 statement, in order to avoid compilation breakage]
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02 17:31:48 -03:00
Laurent Pinchart fe6524719d [media] uvcvideo: Recognize the Tasco USB microscope
The device is based on an Aveo chipset, implements UVC but advertises a
vendor-specific class on all interfaces.

Support it by listing the USB VID:PID explicitly.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02 17:30:05 -03:00
Laurent Pinchart 9e68c53910 [media] uvcvideo: Don't call vb2 mmap and get_unmapped_area with queue lock held
videobuf2 has long been subject to AB-BA style deadlocks due to the
queue lock and mmap_sem being taken in different orders for the mmap and
get_unmapped_area operations. The problem has been fixed by making those
two operations callable without taking the queue lock, using an
mmap_lock internal to videobuf2.

The uvcvideo driver still calls the mmap and get_unmapped_area
operations with the queue lock held, resulting in a potential deadlock.
As the operations can now be called without locking the queue, fix it.

Reported-by: Bjørn Mork <bjorn@mork.no>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02 17:29:28 -03:00
Gilles Risch 1fe0fbd69a [media] Basic support for the Elgato EyeTV Hybrid INT 2008 USB Stick
This patch will add basic support for the Elgato EyeTV Hybrid INT
2008 USB Stick.

Signed-off-by: Gilles Risch <gilles.risch@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-03 11:20:50 -03:00
Wei Yongjun 03983e5db1 [media] v4l2: remove unused including <linux/version.h>
Remove including <linux/version.h> that don't need it.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-03 11:20:12 -03:00
Shuah Khan 41071bb8c7 [media] media: au0828 - embed vdev and vbi_dev structs in au0828_dev
Embed video_device structs vdev and vbi_dev in au0828_dev.
With this change, dynamic allocation and error path logic
in au0828_analog_register() is removed as it doesn't need
to allocate and handle allocation errors. Unregister path
doesn't need to free the now static video_device structures,
hence, changed video_device.release in au0828_video_template
to point to video_device_release_empty.

Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-03 11:19:52 -03:00
Lad, Prabhakar c5036d61e0 [media] media: au0828: drop vbi_buffer_filled() and re-use buffer_filled()
The vbi_buffer_filled() and buffer_filled() did the same functionality
except for incrementing the buffer sequence, this patch drops the
vbi_buffer_filled() and re-uses buffer_filled() for vbi buffers
as well by adding the check for vb2-queue type while incrementing
the sequence numbers. Along side this patch aligns the input parameters
of buffer_filled() function appropriately.

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Acked-by: Shuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-03 11:17:56 -03:00
Olli Salonen 809abdbf46 [media] cx231xx: Hauppauge HVR-955Q ATSC/QAM tuner
Hauppauge HVR-955Q is a ATSC/QAM USB tuner with LGDT3306A demodulator and SiLabs Si2157-A30 tuner.

Only digital TV has been tested (both ATSC and QAM256).

Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-03 10:36:12 -03:00
Randy Dunlap d5c00762ec [media] media: fix gspca drivers build dependencies
Several (15) drivers in media/usb/gspca use IF_ENABLED(CONFIG_INPUT)
to decide if they should call input* interfaces, but those drivers
do not build successfully when CONFIG_INPUT=m and the gspca drivers
are builtin (=y).  Making USB_GSPCA depend on INPUT || INPUT=n
fixes the build dependencies and allows all of them to build
cleanly.

Fixes these build errors (selections, not all are listed):

drivers/built-in.o: In function `gspca_disconnect':
(.text+0x32ed0f): undefined reference to `input_unregister_device'
drivers/built-in.o: In function `sd_isoc_irq':
konica.c:(.text+0x333098): undefined reference to `input_event'
konica.c:(.text+0x3330ab): undefined reference to `input_event'
drivers/built-in.o: In function `sd_stopN':
konica.c:(.text+0x3338d3): undefined reference to `input_event'
konica.c:(.text+0x3338e5): undefined reference to `input_event'
drivers/built-in.o: In function `ov51x_handle_button':
ov519.c:(.text+0x335ddb): undefined reference to `input_event'
drivers/built-in.o:ov519.c:(.text+0x335ded): more undefined references to `input_event' follow
pac7302.c:(.text+0x336ea1): undefined reference to `input_event'
pac7302.c:(.text+0x336eb3): undefined reference to `input_event'
drivers/built-in.o: In function `sd_pkt_scan':
spca561.c:(.text+0x338fd8): undefined reference to `input_event'
drivers/built-in.o:spca561.c:(.text+0x338feb): more undefined references to `input_event' follow
t613.c:(.text+0x33a6fd): undefined reference to `input_event'
drivers/built-in.o:t613.c:(.text+0x33a70f): more undefined references to `input_event' follow

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc:	Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-03 10:16:31 -03:00
Hans Verkuil cee05cb359 [media] pvrusb2: use struct v4l2_fh
By using struct v4l2_fh both the prio handling and the linked list
implementation in pvrusb2 can be removed since both are now done in
the v4l2 core if you use struct v4l2_fh.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Tested-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-02 17:08:48 -03:00
Hans Verkuil ab91c61129 [media] pvrusb2: replace .ioctl by .unlocked_ioctl
As far as I can tell pvrusb2 does its own locking, so there is
no need to use .ioctl.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-02 17:03:42 -03:00
Markus Elfring 8aa9eb9059 [media] au0828: Delete unnecessary checks before the function call "video_unregister_device"
The video_unregister_device() function tests whether its argument is NULL
and then returns immediately. Thus the test around the call is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-02 14:53:46 -03:00
Markus Elfring 704b3f4c11 [media] stk-webcam: Delete an unnecessary check before the function call "vfree"
The vfree() function performs also input parameter validation.
Thus the test around the call is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-02 14:53:27 -03:00
Mauro Carvalho Chehab 559addc25b [media] fixp-arith: replace sin/cos table by a better precision one
The cos table used at fixp-arith.h has only 8 bits of precision.
That causes problems if it is reused on other drivers.

As some media drivers require a higher precision sin/cos
implementation, replace the current implementation by one that
will provide 32 bits precision.

The values generated by the new implementation matches the
32 bit precision of glibc's sin for an angle measured in
integer degrees.

It also provides support for fractional angles via linear
interpolation. On experimental calculus, when used a table
with a 0.001 degree angle, the maximum error for sin is
0.000038, which is likely good enough for practical purposes.

There are some logic there that seems to be specific to the
usage inside ff-memless.c. Move those logic to there, as they're
not needed elsewhere.

Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: Prashant Laddha <prladdha@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-02 14:50:06 -03:00
Nicholas Mc Guire 9713883b0f [media] cx231xx: drop condition with no effect
The if and the else code are identical - so the condition has no effect
on the effective code.
This patch removes the condition and the duplicated code.

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-02 14:39:32 -03:00
Mauro Carvalho Chehab f704eab5b6 [media] siano: avoid a linkedit error if !MC
If the media controller (MC) is not enabled, it will compile
fine, but will fail at the linkedition:

 ERROR: "media_device_unregister" [drivers/media/usb/siano/smsusb.ko] undefined!

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-02 14:17:01 -03:00
Mauro Carvalho Chehab 89a2c1d60a [media] use a function for DVB media controller register
This is really a simple function, but using it avoids to have
if's inside the drivers.

Also, the kABI becomes a little more clearer.

This shouldn't generate any overhead, and the type check
will happen when compiling with MC DVB enabled.

So, let's do it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-02 11:29:39 -03:00
Mauro Carvalho Chehab 872b9dbedd [media] dvb: Avoid warnings when compiled without the media controller
drivers/media/usb/dvb-usb-v2/dvb_usb_core.c: In function ‘dvb_usbv2_adapter_dvb_exit’:
drivers/media/usb/dvb-usb-v2/dvb_usb_core.c:531:25: warning: unused variable ‘d’ [-Wunused-variable]
  struct dvb_usb_device *d = adap_to_d(adap);
                         ^
drivers/media/usb/dvb-usb-v2/dvb_usb_core.c:403:13: warning: ‘dvb_usbv2_media_device_register’ defined but not used [-Wunused-function]
 static void dvb_usbv2_media_device_register(struct dvb_usb_adapter *adap)

drivers/media/usb/dvb-usb/dvb-usb-dvb.c:97:13: warning: ‘dvb_usb_media_device_register’ defined but not used [-Wunused-function]
 static void dvb_usb_media_device_register(struct dvb_usb_adapter *adap)
             ^

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-02 11:25:45 -03:00
Mauro Carvalho Chehab 480884b647 [media] dvbdev: use adapter arg for dvb_create_media_graph()
Instead of using media_dev argument for dvb_create_media_graph(),
use the adapter.

That allows to create a stub for this function, if compiled
without DVB support, avoiding to add extra if's at the drivers.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-03-02 11:25:38 -03:00
Mauro Carvalho Chehab a3dfc6d925 [media] dvb-usb: create one media_dev per adapter
Instead of assuming just one adapter, change the code to store
one media controller per adapter.

This works fine for dvb-usb, as, on all drivers here, it is not
possible to write a media graph that would mix resources between
the two different adapters.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-26 09:52:26 -03:00
Rafael Lourenço de Lima Chehab 496ccf92b9 [media] dvb-usb: add support for the media controller at USB driver
Create a struct media_device and add it to the dvb adapter.

Please notice that the tuner is not mapped yet by the dvb core.

[mchehab@osg.samsung.com: use config option MEDIA_CONTROLLER_DVB]
Signed-off-by: Rafael Lourenço de Lima Chehab <chehabrafael@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-26 09:52:26 -03:00
Mauro Carvalho Chehab 823b460ee7 [media] dvb-usb-v2: create one media_dev per adapter
Instead of assuming just one adapter, change the code to store
one media controller per adapter.

This works fine for dvb-usb, as, on all drivers here, it is not
possible to write a media graph that would mix resources between
the two different adapters.

Acked-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-26 09:52:25 -03:00
Rafael Lourenço de Lima Chehab 6f6c77d8d2 [media] dvb-usb-v2: add support for the media controller at USB driver
Create a struct media_device and add it to the dvb adapter.

Please notice that the tuner is not mapped yet by the dvb core.

[mchehab@osg.samsung.com: use config option MEDIA_CONTROLLER_DVB due to a rebase]
Signed-off-by: Rafael Lourenço de Lima Chehab <chehabrafael@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-26 09:49:07 -03:00
Mauro Carvalho Chehab 4b208f8b56 [media] siano: register media controller earlier
We need to initialize the media controller earlier, as the core
will call the smsdvb hotplug during register time. Ok, this is
an async operation, so, when the module is not loaded, the media
controller works.

However, if the module is already loaded, nothing will be
registered at the media controller, as it will load too late.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-26 09:10:39 -03:00
Mauro Carvalho Chehab d9f3836b7b [media] siano: get rid of sms_dbg parameter
All siano modules have a sms_dbg parameter. Now that we're using
the standard pr_debug() macro, we can get rid of it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-26 09:10:05 -03:00
Mauro Carvalho Chehab 0dd5f20cb3 [media] siano: get rid of sms_info()
On most cases, sms_info() should actually be pr_debug(), but,
on other places, it should be pr_info().

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-26 09:10:04 -03:00
Mauro Carvalho Chehab 6908368879 [media] siano: replace sms_debug() by pr_debug()
There's no reason to use a macro here. Just replace everything,
and let those debug messages to be activated via dynamic printk.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-26 09:10:04 -03:00
Mauro Carvalho Chehab 5ed0a2c7ec [media] siano: replace sms_err by pr_err
Originally, sms_err() would be also displaying the line where
the error occurs, but the messages are clear enough. Also,
the function is always printed. So, no need for it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-26 09:10:02 -03:00
Mauro Carvalho Chehab 535bd1e96e [media] siano: replace sms_warn() by pr_warn()
There's no reason for a sms' own sms_warn macro. Just replace
it by the standard pr_warn().

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-26 09:10:02 -03:00
Mauro Carvalho Chehab 5e022d1aa0 [media] siano: use pr_* print functions
Instead of defining its own set of printk functions, let's
use the common Kernel debug logic provided by pr_foo functions.

As a first step, let's just define the existing macros as the
Kernel ones.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-26 09:10:01 -03:00
Mauro Carvalho Chehab 46b1e21fe5 [media] siano: add support for the media controller at USB driver
Adding support for the media controller for a pure DVB device
is simple: just create a struct media_device and add it to the
dvb adapter. After creating all DVB devices, we need to call
the DVB core, for it to create the media graph.

More work is needed for pure DVB tuners, but this is hidden
at the Siano driver, just like several others non-hybrid
devices. So, this is streight forward.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-26 08:46:48 -03:00
Mauro Carvalho Chehab 3d263114c4 [media] cx231xx: enable the analog tuner at buffer setup
buf_prepare callback is called for every queued buffer. This is
an overkill. Call it at buf_setup, as this should be enough.

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-26 08:45:25 -03:00
Mauro Carvalho Chehab 7e2b41e912 [media] cx231xx: Improve the media controller comment
There are two problems at the comment:
- it is badly idented;
- its comment doesn't mean anything.

Fix it.

Requested-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-26 08:45:01 -03:00
Mauro Carvalho Chehab 63ba8c7518 [media] cx231xx: fix compilation if the media controller is not defined
drivers/media/usb/cx231xx/cx231xx-cards.c: In function ‘cx231xx_usb_probe’:
drivers/media/usb/cx231xx/cx231xx-cards.c:1589:15: error: ‘struct v4l2_device’ has no member named ‘mdev’
  dev->v4l2_dev.mdev = dev->media_dev;
               ^
drivers/media/usb/cx231xx/cx231xx-cards.c:1589:26: error: ‘struct cx231xx’ has no member named ‘media_dev’
  dev->v4l2_dev.mdev = dev->media_dev;
                          ^
scripts/Makefile.build:257: recipe for target 'drivers/media/usb/cx231xx/cx231xx-cards.o' failed

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-26 08:43:49 -03:00
Mauro Carvalho Chehab 0f0fa90bd0 [media] cx231xx: enable tuner->decoder link at videobuf start
The tuner->decoder needs to be enabled when we're about to
start streaming.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-13 21:10:16 -02:00
Mauro Carvalho Chehab 54e339a960 [media] cx231xx: create DVB graph
cx231xx is simple with regards to DVB: all boards have just one
DVB adapter. So, we can use the default DVB helper function to
create the DVB media graph.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-13 21:10:16 -02:00
Mauro Carvalho Chehab d35a9855a8 [media] cx231xx: create media links for analog mode
Now that we have entities and pads, let's create media links
between them, for analog setup.

We may not have all the links for digital yet, as the dvb extention
may not be loaded yet.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-13 21:10:15 -02:00
Mauro Carvalho Chehab b6a40e7280 [media] cx231xx: initialize video/vbi pads
Both video and vbi are sink pads. Initialize them as such.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-13 21:10:14 -02:00
Mauro Carvalho Chehab 1d058bdcf5 [media] cx231xx: add media controller support
Let's add media controller support for this driver and register it
for both V4L and DVB.

The media controller on this driver is not mandatory, as it can fully
work without it. So, if the media controller register fails, just print
an error message, but proceed with device registering.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-13 21:10:12 -02:00
Luis de Bethencourt d6d4c0e00f [media] gpsca: remove the risk of a division by zero
As reported by Peter Kovar, there's a potential risk of a division by
zero on calls to jpeg_set_qual() when quality is zero.

As quality can't be 0 or lower than that, add an extra clause to cover
this special case.

Signed-off-by: Luis de Bethencourt <luis.bg@samsung.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-10 21:38:40 -02:00
Malcolm Priestley 8716901384 [media] lmedm04: add read snr, signal strength and ber call backs
This allows calling the original functions providing the streaming is off.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 17:16:33 -02:00
Malcolm Priestley 743ab6a1cc [media] lmedm04: Create frontend call back for read status
Create dm04_read_status to check lock through either interrupt values
or directly by the call back.

When the device is not streaming the frontends original call back is
used. When streaming has started it turns off I2C messaging by
setting st->i2c_talk_onoff to zero. I2C can only be turn on again
by one of the other allowed frontend calls.

All old code is removed from lme2510_msg and this function only needs
to set st->i2c_talk_onoff to 1.

The lock status is saved and when the frondend is locked is maintained
by lme2510_int_response who will now just kill the lock.

The call back for rs2000 tuner is nologer required.

All frontend types have been tested.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 17:16:13 -02:00
Malcolm Priestley d8bad1e2ab [media] lmedm04: create frontend callbacks for signal/snr/ber/ucblocks
Create call backs dm04_read_signal_strength, dm04_read_snr and
move dm04_read_ber and dm04_read_ucblocks for all frontends

Removing the I2C filtering from lme2510_msg and the old rs2000 callbacks.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 17:15:29 -02:00
Malcolm Priestley 15e1ce3318 [media] lmedm04: Fix usb_submit_urb BOGUS urb xfer, pipe 1 != type 3 in interrupt urb
A quirk of some older firmwares that report endpoint pipe type as PIPE_BULK
but the endpoint otheriwse functions as interrupt.

Check if usb_endpoint_type is USB_ENDPOINT_XFER_BULK and set as usb_rcvbulkpipe.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 17:14:42 -02:00
Malcolm Priestley cfcd7b8258 [media] lmedm04: Increase Interupt due time to 200 msec
Ocassionally the device fails to report back an interrupt urb status which
results in false no lock trigger on the RS2000 demodulator.

Increase time from 60 msecs to 200 msecs.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Cc: <stable@vger.kernel.org> # v3.17+
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 17:14:00 -02:00
Mauro Carvalho Chehab e181b1f190 [media] rtl28xxu: properly initialize pdata
As complained by smatch:
	drivers/media/usb/dvb-usb-v2/rtl28xxu.c:1159 rtl2832u_tuner_attach() info: 'pdata' is not actually initialized (unreached code).

Cc: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 16:38:48 -02:00
Antti Palosaari 670ef05f82 [media] rtl28xxu: correct reg access routine name prefixes
Use rtl28xxu_ prefix for all register access routine names.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 16:27:33 -02:00
Antti Palosaari 723abfd787 [media] rtl28xxu: merge rtl2831u and rtl2832u properties
As all the callbacks are already same we could merge device
properties struct too and save space.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 16:27:04 -02:00
Antti Palosaari de701f0ff1 [media] rtl28xxu: merge chip type specific all callbacks
Merge all chip type specific prefixed (rtl2831u_ and rtl2832u_)
callback to top level callback prefixed as rtl28xxu_.

rtl2831u_foo() => rtl28xxu_foo()
rtl2832u_foo() => rtl28xxu_foo()

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 16:26:37 -02:00
Antti Palosaari d0f232e823 [media] rtl28xxu: add heuristic to detect chip type
Detect automatically whether chip is old RTL2831U or newer
RTL2832U/RTL2832P. Detection is based I2C command that is found only
from newer RTL2832U models.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 16:25:24 -02:00
Antti Palosaari c56222a6b2 [media] rtl28xxu: move usb buffers to state
Buffer needed for USB control message is small so move it to state
and get rid of alloc/free used for each control message.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 16:24:49 -02:00
Antti Palosaari 5ba4ca1a14 [media] rtl28xxu: fix logging
Pass correct device pointer to dev_* logging in order to print
module name and bus id correctly.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 16:24:15 -02:00
Antti Palosaari 9a02e8fdef [media] rtl28xxu: rename state variable 'priv' to 'dev'
I prefer dev over priv and I want keep all my drivers in line with
that.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 16:23:58 -02:00
Antti Palosaari 6a53fa2350 [media] rtl28xxu: do not refcount rtl2832_sdr module
This driver, rtl28xxu, offers frontend service for rtl2832_sdr
module, thus we are producer and rtl2832_sdr module is consumer.
Due to that, reference counting should be done in way rtl2832_sdr
takes refrence to rtl28xxu. Remove wrong refcount.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 16:21:48 -02:00
Antti Palosaari a6f62431a0 [media] rtl28xxu: simplify FE callback handling
Logic is so simple that there is no idea to separate tuner selection to
own function, instead do it in a callback and get rid of one function.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 16:21:19 -02:00
Antti Palosaari 1dbbdceeb6 [media] rtl28xxu: fix DVB FE callback
DVB FE callback functionality went broken after I moved tuners to
demod muxed I2C adapter. That happens because driver state was
carried by I2C adapter and when mux is used there is one adapter
more in a chain.
USB adapter <-> I2C adapter <-> muxed I2C adapter

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 16:20:46 -02:00
Antti Palosaari 488be13a5e [media] rtl28xxu: use master I2C adapter for slave demods
Both mn88472 and mn88473 slave demods are connected to master I2C
bus, not the bus behind master demod I2C gate like tuners. Use
correct bus.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 16:16:47 -02:00
Antti Palosaari a2f7f220df [media] rtl28xxu: switch SDR module to platform driver
RTL2832 SDR module implements kernel platform driver. Change old
binding to that one.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 16:16:17 -02:00
Antti Palosaari e20b0cf2f3 [media] rtl28xxu: add support for RTL2832U/RTL2832 PID filter
RTL2832 demod integrated into RTL2832U has PID filter. PID filtering
is provided by rtl2832 demod driver. Add support for it.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 16:10:19 -02:00