Commit graph

56 commits

Author SHA1 Message Date
Krzysztof Kozlowski 04d8be053f [media] dvb-frontends: Drop owner assignment from i2c_driver
i2c_driver does not need to set an owner because i2c_register_driver()
will set it.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 12:58:20 -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
Antti Palosaari f88aae9d07 [media] rtl2832: add inittab for FC2580 tuner
Add reg/val inittab for FC2580 tuner.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-18 15:55:52 -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
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
Luis de Bethencourt 2035775624 [media] rtl2832: remove compiler warning
Cleaning up the following compiler warning:
rtl2832.c:703:12: warning: 'tmp' may be used uninitialized in this function

Even though it could never happen since if rtl2832_rd_demod_reg () doesn't set
tmp, this line would never run because we go to err. It is still nice to avoid
compiler warnings.

[mchehab@osg.samsung.com: fix a merge conflict with another patch meant
 to fix the same bug, but doing it at the wrong way]
Signed-off-by: Luis de Bethencourt <luis.bg@samsung.com>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-08 13:13:36 -03:00
Antti Palosaari b3b2bf820e [media] rtl2832: disable regmap register cache
Caching register reads causes some random I/O errors on channel
change. Disable caching now in order to avoid those errors.

Reverts partly commit dcadb82

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02 18:26:45 -03:00
Hans Verkuil f2e37b9b73 [media] rtl2832: fix compiler warning
>From the daily build:

rtl2832.c: In function 'rtl2832_read_status':
rtl2832.c:703:12: warning: 'tmp' may be used uninitialized in this function [-Wmaybe-uninitialized]
  } else if (tmp == 10) {
            ^

The code is OK, it's just the compiler that cannot figure out what's
going on. So just init 'tmp' to 0.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-02 18:22:54 -03:00
Mauro Carvalho Chehab bda977b731 [media] rtl2832: declare functions as static
drivers/media/dvb-frontends/rtl2832.c:157:5: warning: no previous prototype for ‘rtl2832_bulk_write’ [-Wmissing-prototypes]
 int rtl2832_bulk_write(struct i2c_client *client, unsigned int reg,
     ^
drivers/media/dvb-frontends/rtl2832.c:169:5: warning: no previous prototype for ‘rtl2832_update_bits’ [-Wmissing-prototypes]
 int rtl2832_update_bits(struct i2c_client *client, unsigned int reg,
     ^
drivers/media/dvb-frontends/rtl2832.c:181:5: warning: no previous prototype for ‘rtl2832_bulk_read’ [-Wmissing-prototypes]
 int rtl2832_bulk_read(struct i2c_client *client, unsigned int reg, void *val,

Cc: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 16:38:43 -02:00
Antti Palosaari b410dae43c [media] rtl2832: implement own lock for regmap
Introduce own lock to silence lockdep warning. lockdep validator
makes wrong decision when two similar (&map->mutex) locks were taken
recursively, even those are different mutexes in a two different
drivers. After that patch, functionality remains same, but mutex names
are different. That is a temporary hack, proper solution is make
regmap aware of locked nested locking rules.

=============================================
[ INFO: possible recursive locking detected ]
3.18.0-rc4+ #4 Tainted: G           O
---------------------------------------------
kdvb-ad-0-fe-0/2814 is trying to acquire lock:
 (&map->mutex){+.+.+.}, at: [<ffffffff814ec90f>] regmap_lock_mutex+0x2f/0x40

but task is already holding lock:
 (&map->mutex){+.+.+.}, at: [<ffffffff814ec90f>] regmap_lock_mutex+0x2f/0x40

other info that might help us debug this:
 Possible unsafe locking scenario:
       CPU0
       ----
  lock(&map->mutex);
  lock(&map->mutex);

 *** DEADLOCK ***
 May be due to missing lock nesting notation
1 lock held by kdvb-ad-0-fe-0/2814:
 #0:  (&map->mutex){+.+.+.}, at: [<ffffffff814ec90f>] regmap_lock_mutex+0x2f/0x40

stack backtrace:
CPU: 3 PID: 2814 Comm: kdvb-ad-0-fe-0 Tainted: G           O 3.18.0-rc4+ #4
Hardware name: System manufacturer System Product Name/M5A78L-M/USB3, BIOS 2001    09/11/2014
 0000000000000000 00000000410c8772 ffff880293af3868 ffffffff817a6f82
 0000000000000000 ffff8800b3462be0 ffff880293af3968 ffffffff810e7f94
 ffff880293af3888 00000000410c8772 ffffffff82dfee60 ffffffff81ab8f89
Call Trace:
 [<ffffffff817a6f82>] dump_stack+0x4e/0x68
 [<ffffffff810e7f94>] __lock_acquire+0x1ea4/0x1f50
 [<ffffffff810e2a7d>] ? trace_hardirqs_off+0xd/0x10
 [<ffffffff817b01f3>] ? _raw_spin_lock_irqsave+0x83/0xa0
 [<ffffffff810e13e6>] ? up+0x16/0x50
 [<ffffffff810e2a7d>] ? trace_hardirqs_off+0xd/0x10
 [<ffffffff817af8bf>] ? _raw_spin_unlock_irqrestore+0x5f/0x70
 [<ffffffff810e9069>] lock_acquire+0xc9/0x170
 [<ffffffff814ec90f>] ? regmap_lock_mutex+0x2f/0x40
 [<ffffffff817ab50e>] mutex_lock_nested+0x7e/0x430
 [<ffffffff814ec90f>] ? regmap_lock_mutex+0x2f/0x40
 [<ffffffff814ec90f>] ? regmap_lock_mutex+0x2f/0x40
 [<ffffffff817a530b>] ? printk+0x70/0x86
 [<ffffffff8110d9e8>] ? mod_timer+0x168/0x240
 [<ffffffff814ec90f>] regmap_lock_mutex+0x2f/0x40
 [<ffffffff814f08d9>] regmap_update_bits+0x29/0x60
 [<ffffffffa03e9778>] rtl2832_select+0x38/0x70 [rtl2832]
 [<ffffffffa039b03d>] i2c_mux_master_xfer+0x3d/0x90 [i2c_mux]
 [<ffffffff815da493>] __i2c_transfer+0x73/0x2e0
 [<ffffffff815dbaba>] i2c_transfer+0x5a/0xc0
 [<ffffffff815dbb6e>] i2c_master_send+0x4e/0x70
 [<ffffffffa03ff25a>] regmap_i2c_write+0x1a/0x50 [regmap_i2c]
 [<ffffffff817ab713>] ? mutex_lock_nested+0x283/0x430
 [<ffffffff814f06b2>] _regmap_raw_write+0x862/0x880
 [<ffffffff814ec90f>] ? regmap_lock_mutex+0x2f/0x40
 [<ffffffff814f0744>] _regmap_bus_raw_write+0x74/0xa0
 [<ffffffff814ef3d2>] _regmap_write+0x92/0x140
 [<ffffffff814f0b7b>] regmap_write+0x4b/0x70
 [<ffffffffa032b090>] ? dvb_frontend_release+0x110/0x110 [dvb_core]
 [<ffffffffa05141d4>] e4000_init+0x34/0x210 [e4000]
 [<ffffffffa032a029>] dvb_frontend_init+0x59/0xc0 [dvb_core]
 [<ffffffff810bde30>] ? finish_task_switch+0x80/0x180
 [<ffffffff810bddf2>] ? finish_task_switch+0x42/0x180
 [<ffffffffa032b116>] dvb_frontend_thread+0x86/0x7b0 [dvb_core]
 [<ffffffff817a9203>] ? __schedule+0x343/0x930
 [<ffffffffa032b090>] ? dvb_frontend_release+0x110/0x110 [dvb_core]
 [<ffffffff810b826b>] kthread+0x10b/0x130
 [<ffffffff81020099>] ? sched_clock+0x9/0x10
 [<ffffffff810b8160>] ? kthread_create_on_node+0x250/0x250
 [<ffffffff817b063c>] ret_from_fork+0x7c/0xb0
 [<ffffffff810b8160>] ? kthread_create_on_node+0x250/0x250

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 16:28:12 -02:00
Antti Palosaari 0d117901b6 [media] rtl2832: remove internal mux I2C adapter
There was 2 muxed I2C adapters, one for demod tuner bus and one for
internal use. Idea of internal I2C adapter was to force I2C repeater
close when demod access its registers. Driver has also delayed work
queue based method to close I2C repeater.

After regmap conversion internal I2C adapter based repeater close
left unused - only work queue method was in use. We could not use
internal mux adapter method with regmap as it makes recursive regmap
call, which causes deadlock as regmap has own locking. Due to that
remove whole method totally.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 16:23:09 -02:00
Antti Palosaari a08c378119 [media] rtl2832: implement sleep
Put demod to soft reset in order to save power when sleep. That drops
power usage ~30mA @5V on USB dongle I tested. In real life it does
not matter much as USB IF powers off demod too, but now it is done
twice - demod and USB IF.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 16:20:02 -02:00
Antti Palosaari 75c24005ee [media] rtl2832: claim copyright and module author
I have implemented tons of things for that driver, more than anyone
else, so lets claim copyright and module authorship.

Cc: Thomas Mair <thomas.mair86@gmail.com>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 16:19:24 -02:00
Antti Palosaari cd559e0b13 [media] rtl2832: cleanups and minor changes
Remove all the stuff that is not needed anymore. Rename variable.
Remove extra new lines.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 16:18:51 -02:00
Antti Palosaari 0aa32ef9b3 [media] rtl2832: provide register IO callbacks
Provide register read and write callbacks for SDR module.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 16:12:34 -02:00
Antti Palosaari eec21beb35 [media] rtl2832: merge reg page as a part of reg address
Chips uses 8-bit register addresses with 5 pages. Extend register
address by using register page as a first byte of address, defining
virtual register addresses. That is common method of handling
register pages and regmap also uses it. Remove page + address
conversion glue which was there for regmap.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 16:12:07 -02:00
Antti Palosaari 5e5d52a00f [media] rtl2832: remove unneeded software reset from init()
There is no need to do software reset on init() as it is done a bit
later on end of set_frontend(). Software reset usually means
restarting (resetting to starting point) chip internal state machine
(FSM). Naturally it is done after all parameters are programmed.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 16:11:17 -02:00
Antti Palosaari dcadb82a7a [media] rtl2832: use regmap reg cache
Enable regmap register cache in order to reduce IO.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 16:10:54 -02:00
Antti Palosaari 4b01e01a81 [media] rtl2832: implement PID filter
Implement PID filter. This demod has PID filter size of 32 PIDs.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 16:09:56 -02:00
Antti Palosaari 1c7da405c6 [media] rtl2832: define more demod lock statuses
Demod lock flags are derived from demod state machine states. States
are running from 1 to 11, where highest state 11 means demod is
fully locked and streaming. Naturally smaller state numbers means
there is some partial locks.

Define now state 10 as missing synch and lock.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 16:09:19 -02:00
Antti Palosaari c65dbf652d [media] rtl2832: drop FE i2c gate control support
We don't need it anymore as all users are using 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:08:37 -02:00
Antti Palosaari 25ef9f5547 [media] rtl2832: implement DVBv5 signal strength statistics
Estimate signal strength from IF digital AGC.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 16:07:43 -02:00
Antti Palosaari 084330b746 [media] rtl2832: wrap DVBv5 BER to DVBv3
Change legacy DVBv3 read BER to return values calculated by DVBv5
statistics.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 16:07:22 -02:00
Antti Palosaari f7caf93fb8 [media] rtl2832: wrap DVBv5 CNR to DVBv3 SNR
Change legacy DVBv3 read SNR to return values calculated by DVBv5
statistics.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 16:07:01 -02:00
Antti Palosaari 6b4fd01804 [media] rtl2832: implement DVBv5 BER statistic
DVBv5 BER.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 16:06:30 -02:00
Antti Palosaari 19d273d635 [media] rtl2832: implement DVBv5 CNR statistic
DVBv5 CNR.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 16:06:07 -02:00
Antti Palosaari d10165815b [media] rtl2832: convert to regmap API
Use regmap to cover register access routines.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 16:05:33 -02:00
Antti Palosaari e1174d788a [media] rtl2832: move all configuration to platform data struct
Move all needed configuration values to platform data structure
and remove old configuration code where possible.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 16:03:41 -02:00
Antti Palosaari 6e6aac6525 [media] rtl2832: enhance / fix logging
Pass correct device pointer to dev_* logging functions in order
print logs correctly.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 16:03:04 -02:00
Antti Palosaari 038c6f240e [media] rtl2832: rename driver state variable from 'priv' to 'dev'
Rename it device state variable to dev. Both priv and dev are very
common terms for such variable in kernel, but I like use dev in
order to keep drivers consistent.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 16:02:19 -02:00
Antti Palosaari ac32ee42cc [media] rtl2832: remove exported resources
Exported resources are not needed anymore as all users are using
callbacks carried via platform data. Due to that we will remove
those.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 16:01:25 -02:00
Antti Palosaari 6f5f6ee24e [media] rtl2832: add platform data callbacks for exported resources
Add callback for all of those functions which are currently
exported using EXPORT_SYMBOL. That allows us convert every user to
callbacks and eventually all exported symbols could be removed.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 16:00:05 -02:00
Antti Palosaari c2c8386f82 [media] rtl2832: convert driver to I2C binding
Convert that driver to I2C driver model.
Legacy DVB binding is left also for later removal...

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 10:55:36 -02:00
Antti Palosaari fe37b38bbb [media] rtl2832: implement option to bypass slave demod TS
Implement partial PIP mode to carry TS from slave demodulator,
through that master demodulator. RTL2832 demod has TS input
interface to connected another demodulator TS output.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-21 16:03:39 -02:00
Mauro Carvalho Chehab 2fe15e2013 [media] af9013: use true/false for boolean vars
Instead of using 0 or 1 for boolean, use the true/false
defines.

Also, instead of testing foo == false, just use the
simplified notation if(!foo).

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-09-03 17:59:16 -03:00
Antti Palosaari 92d20d9fd1 [media] rtl2832: implement delayed I2C gate close
Delay possible I2C gate close a little bit in order to see if there
is next message coming to tuner in a sequence.

Also, export private muxed I2C adapter. That is aimed only for SDR
extension module as SDR belongs to same RTL2832 physical I2C bus (it
is physically property of RTL2832, whilst it is own kernel module).

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-05 15:41:18 -03:00
Luis Alves 0db5c800aa [media] rtl2832: Fix deadlock on i2c mux select function
Signed-off-by: Luis Alves <ljalvs@gmail.com>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-05 15:39:34 -03:00
Antti Palosaari 0ea872d43e [media] rtl2832: add muxed I2C adapter for demod itself
There was a deadlock between master I2C adapter and muxed I2C
adapter. Implement two I2C muxed I2C adapters and leave master
alone, just only for offering I2C adapter for these mux adapters.

Reported-by: Luis Alves <ljalvs@gmail.com>
Reported-by: Benjamin Larsson <benjamin@southpole.se>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-05 15:39:17 -03:00
Antti Palosaari 8823f0288d [media] rtl2832: provide muxed I2C adapter
RTL2832 provides gated / repeater I2C adapter for tuner.
Implement it as a muxed I2C adapter.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-05 15:38:28 -03:00
Antti Palosaari 3ca2418d70 [media] rtl2832: style changes and minor cleanup
Most of those were reported by checkpatch.pl...

debug module parameter is not used anywhere so remove it.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-05 15:38:01 -03:00
Antti Palosaari 5791eee264 [media] rtl2832: remove unused if_dvbt config parameter
All used tuners has get_if_frequency() callback and that parameter
is not needed and will not needed as all upcoming tuner drivers
should implement get_if_frequency().

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-03-05 15:36:59 -03:00
Mauro Carvalho Chehab 37ebaf6891 [media] dvb-frontends: Don't use dynamic static allocation
Dynamic static allocation is evil, as Kernel stack is too low, and
compilation complains about it on some archs:
	drivers/media/dvb-frontends/af9013.c:77:1: warning: 'af9013_wr_regs_i2c' uses dynamic stack allocation [enabled by default]
	drivers/media/dvb-frontends/af9033.c:188:1: warning: 'af9033_wr_reg_val_tab' uses dynamic stack allocation [enabled by default]
	drivers/media/dvb-frontends/af9033.c:68:1: warning: 'af9033_wr_regs' uses dynamic stack allocation [enabled by default]
	drivers/media/dvb-frontends/bcm3510.c:230:1: warning: 'bcm3510_do_hab_cmd' uses dynamic stack allocation [enabled by default]
	drivers/media/dvb-frontends/cxd2820r_core.c:84:1: warning: 'cxd2820r_rd_regs_i2c.isra.1' uses dynamic stack allocation [enabled by default]
	drivers/media/dvb-frontends/rtl2830.c:56:1: warning: 'rtl2830_wr' uses dynamic stack allocation [enabled by default]
	drivers/media/dvb-frontends/rtl2832.c:187:1: warning: 'rtl2832_wr' uses dynamic stack allocation [enabled by default]
	drivers/media/dvb-frontends/tda10071.c:52:1: warning: 'tda10071_wr_regs' uses dynamic stack allocation [enabled by default]
	drivers/media/dvb-frontends/tda10071.c:84:1: warning: 'tda10071_rd_regs' uses dynamic stack allocation [enabled by default]
Instead, let's enforce a limit for the buffer. Considering that I2C
transfers are generally limited, and that devices used on USB has a
max data length of 64 bytes for	the control URBs.
So, it seem safe to use 64 bytes as the hard limit for all those devices.
 On most cases, the limit is a way lower than that, but	this limit
is small enough to not affect the Kernel stack, and it is a no brain
limit, as using smaller ones would require to either carefully each
driver or to take a look on each datasheet.

Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Reviewed-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2013-11-08 09:45:39 -02:00
Antti Palosaari a26758edff [media] rtl2832: add new tuner R828D
Use R820T config for R828D too as those are about same tuner.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2013-10-31 06:09:23 -02:00
Mauro Carvalho Chehab c8832e8f42 [media] rtl2832: Fix IF calculus
Spectrum is inverted. So, we need to invert it when calculating the
value for the IF register

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Tested-by: Antti Palosaari <crope@iki.fi>
2013-04-16 21:39:28 -03:00
Mauro Carvalho Chehab 884655ad2e [media] rtl2832: properly set en_bbin for r820t
DVBT_EN_BBIN should be set on both places where IF is set. So,
move it to a function and call it where needed.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Tested-by: Antti Palosaari <crope@iki.fi>
2013-04-16 21:27:19 -03:00
Mauro Carvalho Chehab fa4bfd2bd0 [media] rtl2832: add code to bind r820t on it
There are some init stuff to be done for each new tuner at the
demod code. Add the code there for r820t.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Tested-by: Antti Palosaari <crope@iki.fi>
2013-04-16 21:25:52 -03:00
Mauro Carvalho Chehab b0944ea2a9 [media] rtl2832: get rid of warning: no previous prototype
drivers/media/dvb-frontends/rtl2832.c:268:5: warning: no previous prototype for 'rtl2832_rd_demod_reg' [-Wmissing-prototypes]
drivers/media/dvb-frontends/rtl2832.c:308:5: warning: no previous prototype for 'rtl2832_wr_demod_reg' [-Wmissing-prototypes]
drivers/media/dvb-frontends/rtl2832.c:513:5: warning: no previous prototype for 'rtl2832_get_tune_settings' [-Wmissing-prototypes]

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-10-27 17:56:56 -02:00
Antti Palosaari 7e688de000 [media] rtl2832: add configuration for e4000 tuner
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-09-27 15:14:15 -03:00
Antti Palosaari 298efdd376 [media] rtl2832: use dev_foo() logging
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-09-23 19:46:48 -03:00
Antti Palosaari 5db4187a03 [media] rtl2832: support for tua9001 tuner
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-09-23 19:45:34 -03:00