summaryrefslogtreecommitdiff
path: root/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
AgeCommit message (Collapse)Author
2016-09-22[media] rc: split nec protocol into its three variantsSean Young
Currently we do not know what variant (bit length) of the nec protocol is used, other than from guessing from the length of the scancode. Now nec will be handled the same way as the sony protocol or the rc6 protocol; one variant per bit length. In the future we might want to expose the rc protocol type to userspace and we don't want to be introducing this world of pain into userspace too. Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-06-07[media] rtl28xxu: increase failed I2C msg repeat count to 3Antti Palosaari
1 and 2 wasn't enough for mn88472 chip on Astrometa device, so increase it to 3. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-05-04[media] rtl2832: change the i2c gate to be mux-lockedPeter Rosin
The root i2c adapter lock is then no longer held by the i2c mux during accesses behind the i2c gate, and such accesses need to take that lock just like any other ordinary i2c accesses do. So, declare the i2c gate mux-locked, and zap the regmap overrides that makes the i2c accesses unlocked and use plain old regmap accesses. This also removes the need for the regmap wrappers used by rtl2832_sdr, so deconvolute the code further and provide the regmap handle directly instead of the wrapper functions. Tested-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Peter Rosin <peda@axentia.se> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2016-03-03[media] rtl2832: improve slave TS controlAntti Palosaari
Add callback parameter to select enable / disable slave TS and use it when slave demod is in use. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-02-01[media] rtl28xxu: retry failed i2c messagesAntti Palosaari
Sometimes i2c transfer fails. That happens especially when large amount of data is written sequentially eg. firmware download. Problem arises with both integrated rtl2832 demod and external mn88472 demod, which is clear indicator it is busy i2c bus issue. Use i2c core retry logic in order fix the issue by repeating failed message. Another solution which also works is to add ~100us delay between i2c messages - but repeating sounds more elegant and does not cause any extra delay for success cases. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-12-23[media] rtl28xxu: return demod reg page from driver cacheAntti Palosaari
Return current active rtl2830/rtl2832 register page from the driver cache in order to reduce I2C I/O. Register page is already cached due to I2C write needs. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-11-05Merge tag 'media/v4.4-1' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media Pull media updates from Mauro Carvalho Chehab: "Media updates, including: - Lots of improvements at the kABI documentation - Split of Videobuf2 into a common part and a V4L2 specific one - Split of the VB2 tracing events into a separate header file - s5p-mfc got support for Exynos 5433 - v4l2 fixes for 64-bits alignment when running 32 bits userspace on ARM - Added support for SDR radio transmitter at core, vivid and hackrf drivers - Some y2038 fixups - Some improvements at V4L2 colorspace support - saa7164 converted to use the V4L2 core control framework - several new boards additions, cleanups and fixups PS: There are two patches for scripts/kernel-doc that are needed by the documentation patches on Media. Jon is OK on merging those via my tree" * tag 'media/v4.4-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (146 commits) [media] c8sectpfe: Remove select on CONFIG_FW_LOADER_USER_HELPER_FALLBACK [media] DocBook media: update copyright/version numbers [media] ivtv: Convert to get_user_pages_unlocked() [media] media/v4l2-ctrls: fix setting autocluster to manual with VIDIOC_S_CTRL [media] DocBook media: Fix a typo in encoder cmd [media] DocBook: add SDR specific info to G_MODULATOR / S_MODULATOR [media] DocBook: add SDR specific info to G_TUNER / S_TUNER [media] hackrf: do not set human readable name for formats [media] hackrf: add support for transmitter [media] hackrf: switch to single function which configures everything [media] hackrf: add control for RF amplifier [media] DocBook: add modulator type field [media] v4l: add type field to v4l2_modulator struct [media] DocBook: document SDR transmitter [media] v4l2: add support for SDR transmitter [media] DocBook: document tuner RF gain control [media] v4l2: add RF gain control [media] v4l2: rename V4L2_TUNER_ADC to V4L2_TUNER_SDR [media] media/vivid-osd: fix info leak in ioctl [media] media: videobuf2: Move v4l2-specific stuff to videobuf2-v4l2 ...
2015-10-22[media] rtl28xxu: fix control message flawsAntti Palosaari
Add lock to prevent concurrent access for control message as control message function uses shared buffer. Without the lock there may be remote control polling which messes the buffer causing IO errors. Increase buffer size and add check for maximum supported message length. Link: https://bugzilla.kernel.org/show_bug.cgi?id=103391 Fixes: c56222a6b25c ("[media] rtl28xxu: move usb buffers to state") Cc: <stable@vger.kernel.org> # 4.0+ Signed-off-by: Antti Palosaari <crope@iki.fi>
2015-10-03[media] Compro U650F supportGraham Eccleston
Added Compro U650F to the rtl28xxu devices. Signed-off-by: Graham Eccleston <grahameccleston_@hotmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-18[media] rtl28xxu: load SDR module for fc2580 based devicesAntti Palosaari
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[media] rtl28xxu: set correct FC2580 tuner for RTL2832 demodAntti Palosaari
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[media] rtl28xxu: bind tua9001 using I2C bindingAntti Palosaari
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[media] rtl28xxu: bind fc2580 using I2C bindingAntti Palosaari
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-12[media] rtl28xxu: fix return value check in rtl2832u_tuner_attach()Wei Yongjun
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[media] rtl2832: add support for GoTView MasterHD 3 USB tunerOlli Salonen
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[media] rtl28xxu: add I2C read without writeOlli Salonen
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-04-21Merge branch 'patchwork' into v4l_for_linusMauro Carvalho Chehab
* 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-08[media] WinFast DTV2000 DS PlusChristian Dale
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[media] rtl28xxu: add support for Turbo-X DTT2000Dimitris Lampridis
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[media] mn88472: add ts mode and ts clock to driverBenjamin Larsson
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-03[media] rtl28xxu: lower the rc poll time to mitigate i2c transfer errorsBenjamin Larsson
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[media] rtl28xxu: return success for unimplemented FE callbackAntti Palosaari
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-02-03[media] rtl28xxu: properly initialize pdataMauro Carvalho Chehab
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[media] rtl28xxu: correct reg access routine name prefixesAntti Palosaari
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[media] rtl28xxu: merge rtl2831u and rtl2832u propertiesAntti Palosaari
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[media] rtl28xxu: merge chip type specific all callbacksAntti Palosaari
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[media] rtl28xxu: add heuristic to detect chip typeAntti Palosaari
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[media] rtl28xxu: move usb buffers to stateAntti Palosaari
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[media] rtl28xxu: fix loggingAntti Palosaari
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[media] rtl28xxu: rename state variable 'priv' to 'dev'Antti Palosaari
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[media] rtl28xxu: do not refcount rtl2832_sdr moduleAntti Palosaari
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[media] rtl28xxu: simplify FE callback handlingAntti Palosaari
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[media] rtl28xxu: fix DVB FE callbackAntti Palosaari
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[media] rtl28xxu: use master I2C adapter for slave demodsAntti Palosaari
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[media] rtl28xxu: switch SDR module to platform driverAntti Palosaari
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[media] rtl28xxu: add support for RTL2832U/RTL2832 PID filterAntti Palosaari
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[media] rtl28xxu: use demod mux I2C adapter for every tunerAntti Palosaari
Tuners are connected to demod I2C adapter. Use that muxed adapter for each tuner. That allows us to get rid of hackish FE gate control solution. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03[media] rtl28xxu: use platform data config for rtl2832 demodAntti Palosaari
Use platform data configuration for rtl2832 demod driver. Old configuration are still left as it is used for rtl2832_sdr driver. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03[media] rtl28xxu: use rtl2832 demod callbacks accessing its resourcesAntti Palosaari
Switch demod resource use from exported symbols to callbacks its provides. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-02[media] rtl28xxu: add support for RTL2831U/RTL2830 PID filterAntti Palosaari
RTL2830 demod integrated to RTL2831U has PID filter. PID filtering is provided by rtl2830 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-02[media] rtl28xxu: use I2C binding for RTL2830 demod driverAntti Palosaari
rtl2830 driver supports now I2C model too. Start using it. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-01-27[media] rtl28xxu: change module unregister orderAntti Palosaari
We must unregister frontend first and after that driver itself. That order went wrong after demod drivers were switched to kernel I2C drivers, causing crashes. Tested-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-01-27[media] rtl28xxu: switch rtl2832 demod attach to I2C bindingAntti Palosaari
As rtl2832 driver support now I2C binding we will switch to that one. Tested-by: Benjamin Larsson <benjamin@southpole.se> Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-12-23[media] mn88472: calculate the IF register valuesBenjamin Larsson
Add xtal as a configuration parameter so it can be used in the IF register value calculation. 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>
2014-11-21[media] rtl28xxu: add SDR module for devices having R828D tunerAntti Palosaari
Load SDR sub-driver in order to support SDR for devices having this tuner too. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-21[media] rtl28xxu: remove unused SDR attach logicAntti Palosaari
That logic was duplicated from rtl2832_sdr.h in order to avoid hard dependency for staging directory. rtl2832_sdr is moved to media, so we could remove that code now. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-21[media] rtl28xxu: rename tuner I2C client pointerAntti Palosaari
Better to rename tuner I2C to something which clearly says it is for tuner as there is now multiple different I2C clients used. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-21[media] rtl28xxu: add support for Panasonic MN88473 slave demodAntti Palosaari
There is RTL2832P devices having extra MN88473 demodulator. This patch add support for such configuration. Logically MN88473 slave demodulator is connected to RTL2832 master demodulator, both I2C bus and TS input. RTL2832 is integrated to RTL2832U and RTL2832P chips. Chip version RTL2832P has extra TS interface for connecting slave demodulator. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-21[media] rtl28xxu: add support for Panasonic MN88472 slave demodAntti Palosaari
There is RTL2832P devices having extra MN88472 demodulator. This patch add support for such configuration. Logically MN88472 slave demodulator is connected to RTL2832 master demodulator, both I2C bus and TS input. RTL2832 is integrated to RTL2832U and RTL2832P chips. Chip version RTL2832P has extra TS interface for connecting slave demodulator. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-14[media] rtl28xxu: enable demod ADC only when neededAntti Palosaari
Enable integrated demod ADC only when demod is used. Keep integrated demod ADC disabled when external demod is used. This fixes corrupted stream in a case external demod was used. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>