Commit graph

703 commits

Author SHA1 Message Date
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 15d37f3824 [media] rtl2830: 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 15:59:19 -02:00
Antti Palosaari fd4cfa8bb1 [media] rtl2830: implement own I2C locking
Own I2C locking is needed due to two special reasons:
1) Chips uses multiple register pages/banks on single I2C slave.
Page is changed via I2C register access.
2) Chip offers muxed/gated I2C adapter for tuner. Gate/mux is
controlled by I2C register access.

Due to these reasons, I2C locking did not fit very well.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-03 15:54:59 -02:00
Antti Palosaari df70ddad81 [media] rtl2830: implement PID filter
Implement PID filter.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-02 17:56:50 -02:00
Antti Palosaari 6dcfe3cc2e [media] rtl2830: 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-02 17:56:14 -02:00
Antti Palosaari f491391cc3 [media] rtl2830: wrap DVBv5 BER to DVBv3
Change legacy DVBv3 read BER 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-02 17:55:51 -02:00
Antti Palosaari d512e28651 [media] rtl2830: wrap DVBv5 signal strength to DVBv3
Change legacy DVBv3 signal strength 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-02 17:55:28 -02:00
Antti Palosaari 5bb11ca586 [media] rtl2830: 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-02 17:55:08 -02:00
Antti Palosaari 871f70252b [media] rtl2830: implement DVBv5 signal strength statistics
Estimate signal strength from IF AGC.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-02 17:54:35 -02:00
Antti Palosaari 47b4dbfff1 [media] rtl2830: 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-02 17:53:53 -02:00
Antti Palosaari 947debb4f2 [media] rtl2830: style related changes
Trivial changes proposed by checkpatch.pl and some more.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-02 17:53:06 -02:00
Antti Palosaari b8cb50d237 [media] rtl2830: get rid of internal config data
Remove internal config and use configuration values directly from
the platform data.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-02 17:52:25 -02:00
Antti Palosaari 7cc3932889 [media] rtl2830: fix logging
Pass correct device for dev_foo() logging in order to print logs
correctly.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-02 17:51:39 -02:00
Antti Palosaari 1f153c4d88 [media] rtl2830: carry pointer to I2C client for every function
As a I2C driver struct i2c_client is top level structure representing
the driver. Use it as parameter to carry all needed information for
each function in order to simplify things.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-02 17:51:08 -02:00
Antti Palosaari f544f100ac [media] rtl2830: rename 'priv' to 'dev'
Use name 'dev' for device state instance as it is more common and
also one letter shorter.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-02 17:50:02 -02:00
Antti Palosaari aba4e34a78 [media] rtl2830: get rid of legacy DVB driver binding
Remove legacy DVB binding as all users are using I2C binding.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-02 17:48:44 -02:00
Antti Palosaari 28c0879939 [media] rtl2830: convert driver to kernel I2C model
Convert driver to kernel I2C model. Old DVB proprietary model is
still left there also.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-02 17:47:32 -02:00
Mauro Carvalho Chehab 901c4ad64c [media] dib8000: upd_demod_gain_period should be u32
X-Patchwork-Delegate: m.chehab@samsung.com
As shown at the code, upd_demod_gain_period is used to write
to two 16-bit registers:
    dib8000_write_word(state, 1946, upd_demod_gain_period & 0xFFFF);
    dib8000_write_word(state, 1947, reg | (1<<14) | ((upd_demod_gain_period >> 16) & 0xFF));

So, it should be declared as u32.

This fixes the following smatch warning:
	drivers/media/dvb-frontends/dib8000.c:1282 dib8000_agc_startup() warn: right shifting more than type allows

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-02-02 13:21:25 -02:00
Antti Palosaari c32b281628 [media] si2168: change firmware variable name and type
Rename firmware variable from fw_file to fw_name and change its type
from u8 to const char as request_firmware() input defines.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-01-29 18:46:05 -02:00
Antti Palosaari 9b7839c306 [media] si2168: print chip version
Print chip version once using log level into when init() is called.
Remove cold/warm state printing as those are not very useful.

old printing:
si2168 6-0064: found a 'Silicon Labs Si2168' in cold state
si2168 6-0064: downloading firmware from file 'dvb-demod-si2168-b40-01.fw'
si2168 6-0064: firmware version: 4.0.11
si2168 6-0064: found a 'Silicon Labs Si2168' in warm state

new printing:
si2168 6-0064: found a 'Silicon Labs Si2168-B40'
si2168 6-0064: downloading firmware from file 'dvb-demod-si2168-b40-01.fw'
si2168 6-0064: firmware version: 4.0.11

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-01-29 18:45:36 -02:00
Antti Palosaari 58f6693fa1 [media] si2168: remove unneeded fw variable initialization
commit 034e1ec0ce
si2168: One function call less in si2168_init() after error detection

That commit added goto label for error path to release firmware,
but forgets to remove variable NULL set. Remove those now.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-01-29 18:44:43 -02:00
Antti Palosaari 68c16a76c6 [media] si2168: enhance firmware download routine
All known old firmware firmware formats are downloaded using 8 byte
chunks. Reject firmware if it could not be divided to 8 byte chunks
and because of that we could simplify some calculations. Now both
supported firmware download routines are rather similar.

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-01-29 18:44:00 -02:00
Antti Palosaari 1ee5e7dd5e [media] si2168: add own goto label for kzalloc failure
Use own label for kzalloc failure in which does not call kfree().
kfree() could be called with NULL, but it is still better to have
own label which skips unnecessary kfree().

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-01-29 18:43:16 -02:00
Antti Palosaari e5dd1100c7 [media] si2168: change stream id debug log formatter
Change formatter from signed to unsigned as stream_id is 32bit
unsigned variable.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-01-29 18:42:43 -02:00
Antti Palosaari 955e0ab8ce [media] si2168: change firmware version print from debug to info
Even firmware version is not needed to know, it is still interesting
and useful to know some cases. Due to that increase its printing to
info log level.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-01-29 18:42:12 -02:00
Antti Palosaari 346d4900f0 [media] si2168: rename few things
Rename some goto labels and more. No functionality changes.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-01-29 18:41:49 -02:00
Antti Palosaari 4affbe1d08 [media] si2168: simplify si2168_cmd_execute() error path
Remove if () from firmware command error path as there should not be
any error prone conditional logic there. Use goto labels instead.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-01-29 18:41:11 -02:00
Antti Palosaari 3de3583539 [media] si2168: get rid of own struct i2c_client pointer
We don't need that anymore as same pointer is passed to each
routine via struct dvb_frontend private field.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-01-29 18:40:24 -02:00
Antti Palosaari 6307b56080 [media] si2168: carry pointer to client instead of state
Carry struct i2c_client pointer inside struct dvb_frontend private
pointer. This driver is I2C driver, which is represented as a
struct i2c_client, so better to carry this top level structure for
each routine in order to unify things. This allows further
simplification.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-01-29 18:39:49 -02:00
Antti Palosaari bd01c7666c [media] si2168: rename device state variable from 's' to 'dev'
'dev' is most common name in kernel for structure containing device
state instance, so rename it.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-01-29 18:38:59 -02:00
Antti Palosaari f1ecc5d119 [media] si2168: define symbol rate limits
w_scan complains about missing symbol rate limits:
This dvb driver is *buggy*: the symbol rate limits are undefined - please report to linuxtv.org

Chip supports 1 to 7.2 MSymbol/s on DVB-C.

Cc: stable@vger.kernel.org
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-01-29 18:38:17 -02:00
Michael Ira Krufky 27f7ef7ca9 [media] lgdt3305: add support for fixed tp clock mode
Add support for controlling TP clock mode for VSB and QAM annex-B/C mode.
Gated clock mode is the default value, and does not support QAM annex-C.
The patch enables setting this control to fixed clock mode.

Signed-off-by: Michael Ira Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-01-29 18:32:01 -02:00
Michael Ira Krufky bdba90df2e [media] lgdt3305: we only need to pass state into lgdt3305_mpeg_mode_polarity()
Simplify the code a little bit by removing some uneeded arguments
to lgdt3305_mpeg_mode_polarity().

Signed-off-by: Michael Ira Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-01-29 18:30:55 -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
Asaf Vertz 3edd59abb0 [media] media: stb0899_drv: use time_after()
To be future-proof and for better readability the time comparisons are
modified to use time_after() instead of plain, error-prone math.

Signed-off-by: Asaf Vertz <asaf.vertz@tandemg.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-01-27 09:55:28 -02:00
Mauro Carvalho Chehab e32b31ae45 [media] mb86a20s: remove unused debug modprobe parameter
The debug parameter is not used anymore, as this module was
converted already to use dev_dbg().

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-01-26 10:08:29 -02:00
Jurgen Kramer 551c33e729 [media] Si2168: increase timeout to fix firmware loading
Increase si2168 cmd execute timeout to prevent firmware load failures. Tests
shows it takes up to 52ms to load the 'dvb-demod-si2168-a30-01.fw' firmware.
Increase timeout to a safe value of 70ms.

Signed-off-by: Jurgen Kramer <gtmkramer@xs4all.nl>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-01-26 08:23:45 -02:00
Benjamin Larsson d2fb785227 [media] mn88472: calculate the IF register values
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-12-23 14:46:02 -02:00
Hans Verkuil 50fd5e8c1e [media] hd29l2: fix sparse error and warnings
drivers/media/dvb-frontends/hd29l2.c:29:18: warning: Variable length array is used.
drivers/media/dvb-frontends/hd29l2.c:34:32: error: cannot size expression
drivers/media/dvb-frontends/hd29l2.c:125:5: warning: symbol 'hd29l2_rd_reg_mask' was not declared. Should it be static?

Variable length arrays are frowned upon, so replace with a fixed length and check
that there won't be a buffer overrun.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-12-23 10:42:51 -02:00
Hans Verkuil 215cedec37 [media] media: remove emacs editor variables
1) This is not allowed by the kernel coding style
2) Just configure your editor correctly
3) It's really ugly

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-12-22 17:52:20 -02:00
Mauro Carvalho Chehab ffe300107d [media] stv090x: add an extra protetion against buffer overflow
As pointed by smatch:
	drivers/media/dvb-frontends/stv090x.c:2787 stv090x_optimize_carloop() error: buffer overflow 'car_loop_apsk_low' 11 <= 13
	drivers/media/dvb-frontends/stv090x.c:2789 stv090x_optimize_carloop() error: buffer overflow 'car_loop_apsk_low' 11 <= 13
	drivers/media/dvb-frontends/stv090x.c:2791 stv090x_optimize_carloop() error: buffer overflow 'car_loop_apsk_low' 11 <= 13
	drivers/media/dvb-frontends/stv090x.c:2793 stv090x_optimize_carloop() error: buffer overflow 'car_loop_apsk_low' 11 <= 13
	drivers/media/dvb-frontends/stv090x.c:2795 stv090x_optimize_carloop() error: buffer overflow 'car_loop_apsk_low' 11 <= 13

The situation of a buffer overflow won't happen, in practice,
with the current values of car_loop table. Yet, the entire logic
that checks for those registration values is too complex. So,
better to add an explicit check, just in case someone changes
the car_loop tables causing a buffer overflow by mistake.

This also helps to remove several smatch warnings, with is good.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-12-04 15:28:46 -02:00
Mauro Carvalho Chehab b769ef69d0 [media] stv090x: Remove an unreachable code
if STV090x_RANGEOK is not returned, then STV090x_OUTOFRANGE
is returned. However, that part of the code is never reached,
as pointed by smatch:

	drivers/media/dvb-frontends/stv090x.c:2673 stv090x_get_sig_params() info: ignoring unreachable code.

So, remove the two uneeded elses, with makes the code a little bit
cleaner.

No functional changes, and one less smatch warning.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-12-04 15:28:41 -02:00
Mauro Carvalho Chehab 09e59098bb [media] stv090x: Some whitespace cleanups
While writing changeset fdf1bc9fa2, I noticed some checkpatch
complains about the CodingStyle for function parameters. So,
clean them.

While here, also removes uneeded "extern" from function prototype.

No functional changes.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-12-04 14:19:49 -02:00
Olli Salonen 1b97dc98b5 [media] si2168: add support for firmware files in new format
This patch adds support for new type of firmware versions of Si2168 chip.

Old type: n x 8 bytes (all data, first byte seems to be 04 or 05)
New type: n x 17 bytes (1 byte indicates len and max 16 bytes data)

New version of TechnoTrend CT2-4400 drivers
(http://www.tt-downloads.de/bda-treiber_4.3.0.0.zip) contains newer
firmware for Si2168-B40 that is in the new format. It can be extracted
with the following command:

dd if=ttTVStick4400_64.sys ibs=1 skip=323872 count=6919 of=dvb-demod-si2168-b40-01.fw

Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-12-04 14:00:01 -02:00
Olli Salonen a594cf21aa [media] si2168: debug printout for firmware version
A debug printout for firmware version.

Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-12-04 13:59:04 -02:00
Geert Uytterhoeven 510cb39c4f [media] cx24117: Grammar s/if ... if/if ... is/
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-12-04 13:57:24 -02:00
Mauro Carvalho Chehab a2ea556117 [media] stv090x: remove export symbol for stv090x_set_gpio()
Drivers that use dvb_attach can have just one exported symbol,
or they will cause compilation breakages depending on the
selected frontends.

As Jim reported:
drivers/built-in.o: In function `technisat_usb2_set_voltage':
technisat-usb2.c:(.text+0x3b4919): undefined reference to `stv090x_set_gpio'
make: *** [vmlinux] Error 1

That happens because, on his configuration, the configuration
is:

	CONFIG_DVB_USB=y
	CONFIG_DVB_STV090x=m

Luis proposed ar way to fix, but that would just force the
STV090x to be selected, even if one wants to use a device
with a different frontend.

Instead, let's do the right thing: move set_gpio to the
configuration structure and fill it during dvb_attach().

This way, the driver can still call it, and dvb_attach()
will load stv090x module only if the device really needs it.

Reported by: Jim Davis <jim.epost@gmail.com>

Cc: Luis Rodriguez <mcgrof@suse.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-12-04 13:52:45 -02:00
Antti Palosaari 2281c8244b [media] rtl2832_sdr: control ADC
Recent rtl28xxu patch I made moved demod ADC enable from power control
to frontend control (due to slave demod support). Because of that we
need call USB interface frontend control too in order to enable ADC.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-12-04 12:42:46 -02:00
Markus Elfring 034e1ec0ce [media] si2168: One function call less in si2168_init() after error detection
GIT_AUTHOR_DATE=1416472767
The release_firmware() function was called in some cases by the
si2168_init() function during error handling even if the passed variable
contained still a null pointer. This implementation detail could be improved
by the introduction of another jump label.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-25 12:12:01 -02:00
Markus Elfring 5ed0cf8800 [media] m88ds3103: One function call less in m88ds3103_init() after error detection
GIT_AUTHOR_DATE=1416472158
The release_firmware() function was called in some cases by the
m88ds3103_init() function during error handling even if the passed variable
contained still a null pointer. This implementation detail could be improved
by the introduction of another jump label.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-25 12:07:33 -02:00
Markus Elfring 9bc2dd7ec0 [media] DVB-frontends: Deletion of unnecessary checks before the function call "release_firmware"
GIT_AUTHOR_DATE=1416472432
The release_firmware() 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: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-25 09:52:44 -02:00
CrazyCat 52791979e9 [media] si2168: TS clock inversion control
TS clock polarity control implemented.

[Antti: Resolved simple conflict]

Signed-off-by: Evgeny Plehov <EvgenyPlehov@ukr.net>
Reviewed-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>
2014-11-25 09:14:41 -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
Antti Palosaari 4f80d85881 [media] mn88473: move to staging
It is not ready enough to be released on mainline.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-14 17:26:05 -02:00
Antti Palosaari 97de6e89d8 [media] mn88473: convert to RegMap API
Convert driver to I2C RegMap API. That offers unified register
access routines, register value caching and more.

We need 3 register maps, one for each register page, as chips has
3 I2C address.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-14 17:25:45 -02:00
Antti Palosaari 01b4be1452 [media] mn88473: convert driver to I2C binding
Driver was using DVB proprietary binding model. As it is I2C
device, we could change it to normal kernel I2C driver.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-14 17:25:18 -02:00
Antti Palosaari df810e8a97 [media] mn88473: improve IF frequency and BW handling
Separate IF and BW based registers.
Add support for DVB-T and DVB-T2 6MHz channel bandwidth.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-14 17:25:03 -02:00
Antti Palosaari 6ebbe22d42 [media] mn88473: implement DVB-T mode
Implement DVB-T mode.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-14 17:24:22 -02:00
Antti Palosaari c00a6b9f9f [media] mn88473: add support for DVB-T2
Add support for DVB-T2.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-14 17:24:04 -02:00
Antti Palosaari dadb5bb473 [media] mn88473: Panasonic MN88473 DVB-T/T2/C demod driver
Only DVB-C is implemented.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-14 17:23:35 -02:00
Antti Palosaari c867b265b1 [media] mn88472: move to staging
It is not ready enough to be released on mainline.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-14 17:22:34 -02:00
Antti Palosaari 5048907076 [media] mn88472: implement DVB-T and DVB-T2
Implement initial support for DVB-T and DVB-T2 modes. Now driver has
basic support for all the modes, DVB-C/T/T2.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-14 17:22:11 -02:00
Antti Palosaari c1011fb818 [media] mn88472: Convert driver to I2C RegMap API
Convert driver to I2C RegMap API.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-14 17:21:45 -02:00
Antti Palosaari 528af1952e [media] mn88472: convert driver to I2C client
It uses I2C bus so better to implement it as a standard I2C driver
model. It was using proprietary DVB binding.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-14 17:21:04 -02:00
Antti Palosaari 0186e434a7 [media] mn88472: rename state to dev
Rename state to dev.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-14 17:20:29 -02:00
Antti Palosaari 5ef1ad351c [media] mn88472: rename mn88472_c.c => mn88472.c
Original plan was to implement driver as one file per used demod
standard (mn88472_c.c, mn88472_t.c and mn88472_t2.c). However, that
plan was a mistake as driver code differences are so small between
different standards. Due to that rename this file and implement all
the needed functionality to that file.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-14 17:19:42 -02:00
Antti Palosaari 8e0d8572be [media] mn88472: add small delay to wait DVB-C lock
400ms delay seems to be enough in order to gain DVB-C lock.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-14 17:19:12 -02:00
Antti Palosaari 64796a5288 [media] mn88472: correct attach symbol name
Wrong symbol name causes demod attach failure.

Reported-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-11-14 17:18:46 -02:00
Antti Palosaari ca25cb54ac [media] mn88472: Panasonic MN88472 demod driver (DVB-C only)
Only DVB-C mode is supported, DVB-T and DVB-T2 are not supported.
Very much feature reduced version, no signal statistics nor normal
chip configuration options.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-14 17:18:19 -02:00
nibble.max b685141940 [media] m88ds3103: change ts clock config for serial mode
1> When m88ds3103 works in serial ts mode, its serial ts clock is equal to ts master clock and the clock divider is bypassed.
2> The serial ts clock is configed by the bridge driver just like parallel ts clock.

Signed-off-by: Nibble Max <nibble.max@gmail.com>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-11 09:21:11 -02:00
Mauro Carvalho Chehab 47a09af68b Merge tag 'v3.18-rc4' into patchwork
Needed due to some important regression fixes at RC core.

* commit 'v3.18-rc4': (587 commits)
  Linux 3.18-rc4
  ARM: dts: zynq: Enable PL clocks for Parallella
  tiny: rename ENABLE_DEV_COREDUMP to ALLOW_DEV_COREDUMP
  tiny: reverse logic for DISABLE_DEV_COREDUMP
  i2c: core: Dispose OF IRQ mapping at client removal time
  i2c: at91: don't account as iowait
  i2c: remove FSF address
  USB: Update default usb-storage delay_use value in kernel-parameters.txt
  sysfs: driver core: Fix glue dir race condition by gdp_mutex
  MIPS: Fix build with binutils 2.24.51+
  xfs: track bulkstat progress by agino
  xfs: bulkstat error handling is broken
  xfs: bulkstat main loop logic is a mess
  xfs: bulkstat chunk-formatter has issues
  xfs: bulkstat chunk formatting cursor is broken
  xfs: bulkstat btree walk doesn't terminate
  mm: Fix comment before truncate_setsize()
  USB: cdc-acm: add quirk for control-line state requests
  tty: Fix pty master poll() after slave closes v2
  MIPS: R3000: Fix debug output for Virtual page number
  ...

Conflicts:
	drivers/media/rc/rc-main.c
2014-11-11 08:37:35 -02:00
Mauro Carvalho Chehab a235473742 [media] cx24110: Simplify error handling at cx24110_set_fec()
move the return to happen before the logic. This way, we can
avoid one extra identation.

This also fixes an identation issue on this function.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-05 10:00:45 -02:00
Mauro Carvalho Chehab 6deaca2bc3 [media] cx23110: Fix return code for cx24110_set_fec()
When a parameter is invalid, the right return code is
-EINVAL.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-05 09:58:07 -02:00
Mauro Carvalho Chehab 5eb2829212 [media] cx24110: Fix whitespaces at cx24110_set_fec()
It is hard to read what's there, because it doesn't follow the
CodingStyle.

Add missing whitespaces to split function arguments.

No functional changes.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-05 09:57:33 -02:00
Mauro Carvalho Chehab b8e64df002 [media] cx24110: Fix a spatch warning
This is actually a false positive:
	drivers/media/dvb-frontends/cx24110.c:210 cx24110_set_fec() error: buffer overflow 'rate' 7 <= 8

But fixing it is easy: just ensure that the table size will be
limited to FEC_AUTO.

While here, fix spacing on the affected lines.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-05 09:56:12 -02:00
Mauro Carvalho Chehab 667c952e71 [media] cx22700: Fix potential buffer overflow
As new FEC types were added, we need a check to avoid overflows:
	drivers/media/dvb-frontends/cx22700.c:172 cx22700_set_tps() error: buffer overflow 'fec_tab' 6 <= 6
	drivers/media/dvb-frontends/cx22700.c:173 cx22700_set_tps() error: buffer overflow 'fec_tab' 6 <= 6

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-05 09:42:22 -02:00
Mauro Carvalho Chehab b9f62ffe05 [media] stb0899: don't go past DiSEqC msg buffer
As reported by spatch:
	drivers/media/dvb-frontends/stb0899_drv.c:720 stb0899_send_diseqc_msg() error: buffer overflow 'cmd->msg' 6 <= 7

The buffer size is 6 and not 8. Anyway, the best is to use sizeof(),
to avoid such mistakes.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-05 09:34:12 -02:00
Mauro Carvalho Chehab 1011d24a21 [media] stv090x: Fix delivery system setting
As sparse complains:
	drivers/media/dvb-frontends/stv090x.c:3471:30: warning: mixing different enum types
	drivers/media/dvb-frontends/stv090x.c:3471:30:     int enum fe_delivery_system  versus
	drivers/media/dvb-frontends/stv090x.c:3471:30:     int enum stv090x_delsys

There's actually an error when setting the delivery system on
stv090x_search(): it is using the DVBv5 macros as if they were
the stv090x ones.

Instead, we should convert between the two namespaces, returning
an error if an unsupported delivery system is requested.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-05 09:23:05 -02:00
Mauro Carvalho Chehab 060f79d575 [media] af0933: Don't go past arrays
X-Patchwork-Delegate: m.chehab@samsung.com
Fixes the following sparse warnings:
	drivers/media/dvb-frontends/af9033.c:295 af9033_init() error: buffer overflow 'clock_adc_lut' 11 <= 11
	drivers/media/dvb-frontends/af9033.c:300 af9033_init() error: buffer overflow 'clock_adc_lut' 11 <= 11
	drivers/media/dvb-frontends/af9033.c:584 af9033_set_frontend() error: buffer overflow 'coeff_lut' 3 <= 3
	drivers/media/dvb-frontends/af9033.c:595 af9033_set_frontend() error: buffer overflow 'clock_adc_lut' 11 <= 11

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-05 08:09:27 -02:00
Antti Palosaari fdc533a97b [media] af9033: continue polling unless critical IO error
That case is not IO error, so better to jump out now, but still
continue polling.

Cc: Bimow Chen <Bimow.Chen@ite.com.tw>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-04 18:21:12 -02:00
Antti Palosaari c3a80cd024 [media] af9033: return 0.1 dB DVBv3 SNR for AF9030 family
Previous patch changed both AF9030 and IT9130 SNR reporting from
dB to relative. Restore AF9030 to old behavior as it has been always
returning 0.1 dB value. Leave IT9130 relative as old IT9130 was
returning relative values.

Cc: Bimow Chen <Bimow.Chen@ite.com.tw>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-04 18:20:51 -02:00
Bimow Chen 6d03f6a875 [media] af9033: fix DVBv3 snr value not correct issue
Snr returns value not correct. Fix it.

Signed-off-by: Bimow Chen <Bimow.Chen@ite.com.tw>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-04 18:20:35 -02:00
Antti Palosaari 1620d22184 [media] af9033: improve read_signal_strength error handling slightly
Check return status after each register access routine and avoid
masking return status values.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-04 18:20:06 -02:00
Antti Palosaari 0b0d96281f [media] af9033: fix AF9033 DVBv3 signal strength measurement
Previous patch changes used signal strength firmware register from
0x800048 to 0x80004a in case of AF9033/AF9035 chip. In practice
reported values were running upside-down, when RR strength increases
reported value decreases and vice versa. That is because of 0x80004a
returns values that are dBm scale, but negative RF strength dBm
returned as positive number.

0x800048 returns 0-100, like percentage
0x80004a returns 0-255 dBm, without a negative sign

So restore old measurement now.

Cc: Bimow Chen <Bimow.Chen@ite.com.tw>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-04 18:19:27 -02:00
Bimow Chen 3adec27242 [media] af9033: fix DVBv3 signal strength value not correct issue
Register 0x800048 is not dB measure but relative scale. Fix it and conform to NorDig specifications.

Signed-off-by: Bimow Chen <Bimow.Chen@ite.com.tw>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2014-11-04 18:19:12 -02:00