Commit Graph

866 Commits

Author SHA1 Message Date
Krzysztof Kozlowski f078818770 [media] dvb-frontends: Drop owner assignment from platform_driver
platform_driver does not need to set an owner because
platform_driver_register() 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:59:38 -03:00
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
Geert Uytterhoeven 6df34051d8 [media] dvb-frontends: Make all DVB Frontends visible if COMPILE_TEST=y
Make the DVB Frontends menu visible when compile-testing, to allow
selecting additional drivers on top of the drivers that are already
automatically selected if MEDIA_SUBDRV_AUTOSELECT is enabled.

Without this, many drivers stay disabled during e.g. allmodconfig.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 11:11:46 -03:00
Antti Palosaari 267897a470 [media] tda10071: implement DVBv5 statistics
Implement DVBv5 CNR, signal strength, BER and block errors.

Wrap legacy DVBv3 statistics to DVBv5 internally.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 07:34:58 -03:00
Antti Palosaari 4c4acb7a7e [media] tda10071: do not get_frontend() when not ready
This is a bit hack, but returning error when driver is not tuned yet
causes DVBv5 zap stop polling DVBv5 statistics. Thus return 0 even
callback is called during invalid device state.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 07:33:32 -03:00
Antti Palosaari e14432a5b7 [media] tda10071: protect firmware command exec with mutex
There should be clearly some lock in order to make sure firmware
command in execution is not disturbed by another command. It has
worked as callbacks are serialized somehow pretty well and command
execution happens usually without any delays.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 07:32:58 -03:00
Antti Palosaari 54ab48ed5d [media] tda10071: convert to regmap I2C API
Use regmap API for I2C operations.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 07:12:50 -03:00
Antti Palosaari fca3e00760 [media] tda10071: rename device state struct to dev
Rename device state struct from 'priv' to 'dev'.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 07:11:16 -03:00
Antti Palosaari 59ca2ce1d5 [media] tda10071: remove legacy media attach
All users are now using I2C binding and old attach could be removed.
Use I2C client for proper logging at the same.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 07:10:53 -03:00
Antti Palosaari 3250a550c4 [media] a8293: coding style issues
Remove FSF address from license. Indent parameter correctly.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 07:10:04 -03:00
Antti Palosaari 4bef67e311 [media] a8293: improve LNB register programming logic
On power-on LNB power supply voltage is disabled, due to that no
need to disable it during probe. Tone is supply is hard-coded as
external tone coming from the demodulator. Program both voltage
and tone on set_voltage(). Use register cache to prevent unneeded
programming.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 07:09:42 -03:00
Antti Palosaari 2c509b866b [media] a8293: use i2c_master_send / i2c_master_recv for I2C I/O
As driver is now proper I2C client driver, we could use correct
functions for I2C I/O. Also rename state from priv to dev. Fix
logging too.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 07:09:13 -03:00
Antti Palosaari 55881b4fb5 [media] a8293: remove legacy media attach
Remove legacy media attach as all users are on I2C bindings now.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-08-11 07:08:32 -03:00
Laurent Pinchart 60acc4ebe7 treewide: Fix typo compatability -> compatibility
Even though 'compatability' has a dedicated entry in the Wiktionary,
it's listed as 'Mispelling of compatibility'. Fix it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: David S. Miller <davem@davemloft.net>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> for the atomic_helper.c
Signed-off-by: Jiri Kosina <jkosina@suse.com>
2015-08-07 14:01:39 +02:00
Randy Dunlap cdeb1755d7 [media] media/dvb: fix ts2020.c Kconfig and build
Fix kconfig warning that is caused by DVB_TS2020:

warning: (DVB_TS2020 && SND_SOC_ADAU1761_I2C && SND_SOC_ADAU1781_I2C && SND_SOC_ADAU1977_I2C && SND_SOC_RT5677 && EXTCON_MAX14577 && EXTCON_MAX77693 && EXTCON_MAX77843) selects REGMAP_I2C which has unmet direct dependencies (I2C)

This fixes many subsequent build errors.

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Konstantin Dimitrov <kosio.dimitrov@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-07-01 16:31:28 -03:00
Mauro Carvalho Chehab 87b09bd048 ts2020: fix compilation on i386
drivers/built-in.o: In function `ts2020_read_signal_strength':
ts2020.c:(.text+0x298ff94): undefined reference to `__divdi3'
ts2020.c:(.text+0x298ffd4): undefined reference to `__divdi3'
ts2020.c:(.text+0x298fffd): undefined reference to `__divdi3'
Makefile:921: recipe for target 'vmlinux' failed

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-06-10 12:26:18 -03:00
David Howells c7275ae161 [media] ts2020: Allow stats polling to be suppressed
Statistics polling can not be done by lmedm04 driver's implementation of
M88RS2000/TS2020 because I2C messages stop the device's demuxer, so allow
polling for statistics to be suppressed in the ts2020 driver by setting
dont_poll in the ts2020_config struct.

Reported-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: David Howells <dhowells@redhat.com>
cc: 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:25 -03:00
David Howells 0f20baad24 [media] ts2020: Copy loop_through from the config to the internal data
Copy the loop_through setting from the ts2020_config struct to the internal
ts2020_priv struct so that it can actually be used.

Whilst we're at it, group the bitfields together in the same order in both
structs so that the compiler has a good chance to copy them in one go.

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:11:38 -03:00
David Howells 3366cd5d72 [media] ts2020: Provide DVBv5 API signal strength
Provide a DVBv5 API signal strength.  This is in units of 0.001 dBm rather
than a percentage.

>From Antti Palosaari's testing with a signal generator, it appears that the
gain calculated according to Montage's specification if negated is a
reasonable representation of the signal strength of the generator.

To this end:

 (1) Polled statistic gathering needed to be implemented in the TS2020 driver.
     This is done in the ts2020_stat_work() function.

 (2) The calculated gain is placed as the signal strength in the
     dtv_property_cache associated with the front end with the scale set to
     FE_SCALE_DECIBEL.

 (3) The DVBv3 format signal strength then needed to be calculated from the
     signal strength stored in the dtv_property_cache rather than accessing
     the value when ts2020_read_signal_strength() is called.

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:11:03 -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 478932b160 [media] m88ds3103: use regmap for I2C register access
Use regmap for I2C register access.
Remove own I2C repeated mutex as it should not be needed. I2C adapter
lock is already taken when I2C mux adapter is called, no need for
double locking.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-06-10 11:08:50 -03:00
Antti Palosaari 7978b8a1bc [media] m88ds3103: rename variables and correct logging
Rename driver state from priv to dev.
Use I2C client for correct logging.
Use adapter and address from I2C client structure where needed.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-06-10 11:05:58 -03:00
David Howells 80868c8e5c [media] ts2020: Add a comment about lifetime of on-stack pdata in ts2020_attach()
ts2020_attach() allocates a variable pdata on the stack and then passes a
pointer to it to i2c_new_device() which stashes the pointer in persistent
structures.

Add a comment to the effect that this isn't actually an error because the
contents of the variable are only used in ts2020_probe() and this is only
called ts2020_attach()'s stack frame exists.

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:00:06 -03:00
Antti Palosaari f158cbceb1 [media] ts2020: convert to regmap I2C API
Use regmap to cover I2C register access.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-06-10 10:59:25 -03:00
Antti Palosaari e6ad9ce3e9 [media] ts2020: register I2C driver from legacy media attach
Register driver using I2C bindings internally when legacy media
attach is used. That is done by registering driver using I2C binding
from legacy attach. That way we can get valid I2C client, which is
needed for proper dev_() logging and regmap for example even legacy
binding is used.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-06-10 10:58:48 -03:00
Antti Palosaari 2ca58f45cc [media] ts2020: improve filter limit calc
* We don't need calculate channel bandwidth from symbol rate as it
is calculated by DVB core.

* Use clamp() to force upper/lower limit of filter 3dB frequency.
Upper limit should never exceeded 40MHz (80MHz BW) in any case,
though...

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-06-10 10:55:58 -03:00
Antti Palosaari af9d525553 [media] ts2020: re-implement PLL calculations
Used frequency synthesizer is simple Integer-N PLL, with configurable
reference divider, output divider and of course N itself. Old
calculations were working fine, but not so easy to understand.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-06-10 10:55:09 -03:00
Tina Ruchandani 9056a23ba1 [media] dvb-frontend: Replace timeval with ktime_t
struct timeval uses a 32-bit seconds representation which will
overflow in the year 2038 and beyond. This patch replaces
the usage of struct timeval with ktime_t which is a 64-bit
timestamp and is year 2038 safe.
This patch is part of a larger attempt to remove all instances
of 32-bit timekeeping variables (timeval, timespec, time_t)
which are not year 2038 safe, from the kernel.

[mchehab@osg.samsung.com: add a missing parenthesis, breaking compilation]
Suggested-by: Arnd Bergmann <arndb@arndb.de>
Signed-off-by: Tina Ruchandani <ruchandani.tina@gmail.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-06-09 21:09:51 -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 ab80b19bb9 [media] tda10071: add missing error status when probe() fails
We must return -ENODEV error on case probe() fails to detect chip.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-06-09 17:22:28 -03:00
Dan Carpenter 4347df6a7f [media] m88ds3103: a couple missing error codes
We need to set some error codes here.

Fixes: f01919e8f5 ('[media] m88ds3103: add I2C client binding')

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-06-09 17:20:42 -03:00
Antti Palosaari b561baec11 [media] a8293: implement I2C client bindings
Implement I2C client bindings.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-06-06 07:19:47 -03:00
Antti Palosaari d69abb79e1 [media] tda10071: implement I2C client bindings
Implement I2C client bindings.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-06-06 07:19:07 -03:00
Mauro Carvalho Chehab 91aff0c5d9 [media] dib0090: Remove a dead code
As reported by smatch:
	drivers/media/dvb-frontends/dib0090.c:1710 dib0090_dc_offset_calibration() warn: missing break? reassigning '*tune_state'

There's no need to change tune_state there, as the fall though code
will change it again to another state. So, simplify it by
removing the dead code.

While here, fix a typo:
	Sart => Start

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-06-05 11:26:31 -03:00
Mauro Carvalho Chehab 2f60f13c14 [media] drxk: better handle errors
As reported by smatch:
	drivers/media/dvb-frontends/drxk_hard.c:3277 dvbt_sc_command() warn: missing break? reassigning 'status'

This is basically because the error handling logic there was crappy.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-06-05 07:58:52 -03:00
Antti Palosaari d2b72f6482 [media] si2168: Implement own I2C adapter locking
We need own I2C locking because of tuner I2C adapter/repeater.
Firmware command is executed using I2C send + reply message. Default
I2C adapter locking protects only single I2C operation, not whole
send + reply sequence as needed. Due to that, it was possible tuner
I2C message interrupts firmware command sequence.

Reported-by: Adam Baker <linux@baker-net.org.uk>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Reviewed-by: Adam Baker <linux@baker-net.org.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-06-05 06:32:05 -03:00
Antti Palosaari f01919e8f5 [media] m88ds3103: add I2C client binding
Implement I2C client device binding.
Wrap media attach to driver I2C probe.
Add wrapper from m88ds3103_attach() to m88ds3103_probe() via driver
core in order to provide proper I2C client for legacy media attach
binding.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-30 12:08:05 -03:00
Antti Palosaari befa0cc1da [media] m88ds3103: use jiffies when polling DiSEqC TX ready
Use jiffies to set timeout for DiSEqC TX ready polling. Using jiffies
is more elegant solution than looping N times with sleep.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-30 12:06:48 -03:00
Antti Palosaari ce80d713e3 [media] m88ds3103: implement DVBv5 BER
Implement DVBv5 BER statistics.
Wrap legacy DVBv3 BER to DVBv5 BER.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-30 12:05:55 -03:00
Antti Palosaari c1daf6511a [media] m88ds3103: implement DVBv5 CNR statistics
Implement DVBv5 CNR statistics.
Wrap legacy DVBv3 SNR to DVBv5 CNR.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-30 12:05:25 -03:00
Antti Palosaari 9240c384f1 [media] m88ds3103: do not return error from get_frontend() when not ready
Do not return error from get_frontend() when status is queried, but
the frontend didn't lock yet. The proper behavior is to only update the
cache after having a lock.

[mchehab@osg.samsung.com: fix the patch description]
Signed-off-by: Antti Palosaari <crope@iki.fi>

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-30 12:04:16 -03:00
Hans Verkuil edff2bac9d [media] cx24120: fix sparse warning
drivers/media/dvb-frontends/cx24120.c:837:6: warning: symbol 'cx24120_calculate_ber_window' was not declared. Should it be static?

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-30 11:22:14 -03:00
Jemma Denson bf8de2d38a [media] cx24120: Assume ucb registers is a counter
The ucblocks register is probably a counter and not a rate; assume
it is so and change the calculations as required.

Signed-off-by: Jemma Denson <jdenson@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-30 08:12:39 -03:00
Dan Carpenter e4d131d392 [media] rtl2832_sdr: cleanup some set_bit() calls
This code works fine but static checkers complain.  The test_bit()
function takes the bit number and not a mask.  Then the other issue is
that we were using USB_STATE_URB_BUF which is BIT(0) instead of URB_BUF.
Also we were open coding that instead of using the test/clear/set_bit()
functions.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-20 13:45:15 -03:00
Patrick Boettcher 71df673132 [media] cx24120: fix minor checkpatch-error
Remove multiple blank likes.

Signed-off-by: Patrick Boettcher <patrick.boettcher@posteo.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-20 09:04:02 -03:00
Jemma Denson c9adafa3b2 [media] cx24120: Update comment & fix typo
These state vars are used for more than just ber calculation, also
fix typo.

Signed-off-by: Jemma Denson <jdenson@gmail.com>
Signed-off-by: Patrick Boettcher <patrick.boettcher@posteo.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-20 09:03:41 -03:00
Jemma Denson e3f2f63e8c [media] cx24120: Check for lock before updating BER & UCB
BER & UCB aren't available unless we're locked; don't update dvbv5
stats when not locked and mark these counters as unavailable.

Signed-off-by: Jemma Denson <jdenson@gmail.com>
Signed-off-by: Patrick Boettcher <patrick.boettcher@posteo.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-20 09:03:15 -03:00
Jemma Denson 80e9710b34 [media] cx24120: Convert ucblocks to dvbv5 stats
DVBv3 is a legacy API. Drivers should use DVBv5, in order to support
modern applications. So, implement UCB using dvbv5.

Signed-off-by: Jemma Denson <jdenson@gmail.com>
Signed-off-by: Patrick Boettcher <patrick.boettcher@posteo.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-20 09:02:46 -03:00
Jemma Denson fc44328478 [media] cx24120: Convert read_ber to retrieve from cache
Instead of reading BER again for DVBv3 call, use the value from the cache.

Signed-off-by: Jemma Denson <jdenson@gmail.com>
Signed-off-by: Patrick Boettcher <patrick.boettcher@posteo.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-20 09:02:10 -03:00
Jemma Denson ddcb252e41 [media] cx24120: Add in dvbv5 stats for bit error rate
DVBv3 is a legacy API. Drivers should use DVBv5, in order to support
modern applications. So, implement BER using dvbv5.

Signed-off-by: Jemma Denson <jdenson@gmail.com>
Signed-off-by: Patrick Boettcher <patrick.boettcher@posteo.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-20 09:00:51 -03:00
Mauro Carvalho Chehab ec8fe6c925 [media] cx24120: constify static data
Use const on the static data, as gcc may optimize better the
code. Also, would prevent that some code would override the
data there.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: Patrick Boettcher <patrick.boettcher@posteo.de>
2015-05-20 08:54:41 -03:00
Mauro Carvalho Chehab 5b8bc802e7 [media] cx24120: declare cx24120_init() as static
drivers/media/dvb-frontends/cx24120.c:1182:5: warning: no previous prototype for 'cx24120_init' [-Wmissing-prototypes]
 int cx24120_init(struct dvb_frontend *fe)
     ^

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: Patrick Boettcher <patrick.boettcher@posteo.de>
2015-05-20 08:54:37 -03:00
Mauro Carvalho Chehab 65b01665a9 [media] cx24120: don't initialize a var that won't be used
As reported by smatch:
drivers/media/dvb-frontends/cx24120.c: In function 'cx24120_message_send':
drivers/media/dvb-frontends/cx24120.c:368:6: warning: variable 'ret' set but not used [-Wunused-but-set-variable]
  int ret, ficus;
      ^

The values written by cx24120 are never checked. So, remove the
check here too. That's said, the best would be to do the reverse,
but globally: to properly handle the error codes.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: Patrick Boettcher <patrick.boettcher@posteo.de>
2015-05-20 08:54:29 -03:00
Jemma Denson 5c0a1c28c0 [media] cx24120: Complete modfec_table
Add in all the likely values for setting fec on tuning. Some values
yet to be tested but very likely to be correct.
In the very unlikely event that these are wrong tuning with
FEC_AUTO will still work.

Signed-off-by: Jemma Denson <jdenson@gmail.com>
Signed-off-by: Patrick Boettcher <patrick.boettcher@posteo.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-19 08:01:47 -03:00
Jemma Denson 4133601c31 [media] cx24120: More tidying in cx24120_init
Remove reg1 by refactoring for loops
Change ret into an int as it's only used for return values now,
and remove reset_result by using ret instead.

Signed-off-by: Jemma Denson <jdenson@gmail.com>
Signed-off-by: Patrick Boettcher <patrick.boettcher@posteo.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-18 17:47:49 -03:00
Jemma Denson 1668797d17 [media] cx24120: Tidy cx24120_init
Use reg instead of ret for all calls to readreg, remove ret_EA
as it doesn't need to be a separate var anymore.

Signed-off-by: Jemma Denson <jdenson@gmail.com>
Signed-off-by: Patrick Boettcher <patrick.boettcher@posteo.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-18 17:47:23 -03:00
Jemma Denson 92443cdb23 [media] cx24120: Remove unneccesary assignments in cx24120_init
Probably a remnant of this driver being reverse engineered,
cx24120_init assigned ret on each call to writereg - they're not
used for anything so remove them to clear up the codebase.

Signed-off-by: Jemma Denson <jdenson@gmail.com>
Signed-off-by: Patrick Boettcher <patrick.boettcher@posteo.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-18 17:45:58 -03:00
Jemma Denson 2f3f07fbe2 [media] cx24120: Tidy up calls to dev_dbg
Remove __func__ from calls to dev_dbg as dynamic debug can add in
the function name anyway.
Remove debug call in dvbv3 read_signal_strength as userspace has
this value anyway.
Reword some strings to make them simpler / more obvious.

Signed-off-by: Jemma Denson <jdenson@gmail.com>
Signed-off-by: Patrick Boettcher <patrick.boettcher@posteo.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-18 17:45:34 -03:00
Jemma Denson 3b5eb504fe [media] cx24120: Move CNR to DVBv5 stats
Better to report CNR via DVBv5 stats, as scale can be used.

Signed-off-by: Jemma Denson <jdenson@gmail.com>
Signed-off-by: Patrick Boettcher <patrick.boettcher@posteo.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-18 17:44:57 -03:00
Jemma Denson 7c95e25e38 [media] cx24120: Fix disecq_send_burst command
Previous version of this driver had a memset before every call
to cmd. This meant the default value of cmd.arg[1] was zero unless
burst is set. Make sure it remains zero.
Also fe_sec_mini_cmd_t is an enum, so test against it.

Signed-off-by: Jemma Denson <jdenson@gmail.com>
Signed-off-by: Patrick Boettcher <patrick.boettcher@posteo.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-18 17:44:13 -03:00
Jemma Denson fbdbab7296 [media] cx24120: More coding style fixes
Signed-off-by: Jemma Denson <jdenson@gmail.com>
Signed-off-by: Patrick Boettcher <patrick.boettcher@posteo.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-18 17:43:54 -03:00
Jemma Denson b0cdf1a16f [media] cx24120: Improve cooked signal strength value
Algorithm copied from cx24117.c - it seems to work. Showing 95% on
a signal I know to be somewhere around 74dBuV.

[mchehab@osg.samsung.net: merged two patches, to avoid breaking compilation]
Signed-off-by: Jemma Denson <jdenson@gmail.com>
Signed-off-by: Patrick Boettcher <patrick.boettcher@posteo.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-18 16:39:19 -03:00
Jemma Denson 34ce475d32 [media] cx24120: Return DVBv3 signal strength from cache
This patch changes DVBv3 signal strength to read from the cache by
moving the signal strength reading routine into get_stat, and
reducing read_signal_strength to just returning the cached value.

Signed-off-by: Jemma Denson <jdenson@gmail.com>
Signed-off-by: Patrick Boettcher <patrick.boettcher@posteo.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-18 16:37:41 -03:00
Jemma Denson 1462612cb3 [media] cx24120: Remove additional calls to read_status
get_frontend was making a call to read_status, which is being
called periodically anyway. Have read_status store fe_status in
the state struct instead and use that within get_frontend.

Signed-off-by: Jemma Denson <jdenson@gmail.com>
Signed-off-by: Patrick Boettcher <patrick.boettcher@posteo.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-18 16:37:16 -03:00
Jemma Denson d3cf06bbe3 [media] cx24120: Enable DVBv5 signal strength stats
Previous patch added in collection, this patch enables them by
signalling they are available.

Signed-off-by: Jemma Denson <jdenson@gmail.com>
Signed-off-by: Patrick Boettcher <patrick.boettcher@posteo.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-18 16:36:57 -03:00
Jemma Denson 9fc18f18a5 [media] cx24120: Add DVBv5 signal strength stats
Add new get_stats function, called from read_status, for
collecting DVBv5 stats into the frontend cache. Only signal
strength for now, can add others later.
Not currently marked as available, future patch will enable.

Signed-off-by: Jemma Denson <jdenson@gmail.com>
Signed-off-by: Patrick Boettcher <patrick.boettcher@posteo.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-18 16:36:38 -03:00
Jemma Denson c84251bb12 [media] cx24120: Rework vco function to remove xxyyzz variable
Change calculate_vco function to send_vco to tidy up cx24120_init
function.
xxyyzz variable is remnants of a manual div & remainder codepath
to perform a u64 rounded div; replace with kernel macro
DIV_ROUND_CLOSEST_ULL
Hex values provided to the message are mainly variables calculated
within this function, replace with these to remove hardcoding.

Signed-off-by: Jemma Denson <jdenson@gmail.com>
Signed-off-by: Patrick Boettcher <patrick.boettcher@posteo.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-18 16:36:13 -03:00
Jemma Denson 6ce412292a [media] cx24120: Fix hexdump length in writeregs
msg.len has been ++'d so msg.len is one too many.

Signed-off-by: Jemma Denson <jdenson@gmail.com>
Signed-off-by: Patrick Boettcher <patrick.boettcher@posteo.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-18 16:35:44 -03:00
Jemma Denson 270e70713b [media] cx24120: Add missing command to cx24120_check_cmd
This patch adds in a missing command to cx24120_check_cmd. This part
of the old reverse engineered driver was quite hard to follow - it's
presumed the compiler did some neat optimisation that wasn't easy to
decode. This command was checked for in that version but not copied
across to the new switch statement.

For reference, old reverse engineered code:
xxzz = cmd->id - 0x11;			// look for specific message id
if ( xxzz <= 0x13 ) {
	msg_cmd_mask = 1 << xxzz;
	//0x0F8021 // if cmd_id 17 or 22 or 33-36, 42, 47, 57-61 etc. disable mpeg output
	if ( msg_cmd_mask & 0x0F8021 ) {	// 000011111000000000100001b
		cx24120_msg_mpeg_output_global_config(state, 0);
		msleep(100);
		state->dvb_s2_mode &=  0xFD;	// reset mpeg out enable flag
	}
}

Signed-off-by: Jemma Denson <jdenson@gmail.com>
Signed-off-by: Patrick Boettcher <patrick.boettcher@posteo.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-18 16:35:25 -03:00
Jemma Denson 6138dc2f5f [media] cx24120: Move clock set to read_status
This patch removes the requirement of waiting for tune in
set_frontend by moving the clock set call into read_status

Signed-off-by: Jemma Denson <jdenson@gmail.com>
Signed-off-by: Patrick Boettcher <patrick.boettcher@posteo.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-18 16:34:54 -03:00
Jemma Denson cd20c596b5 [media] cx24120: Fix minor style typo in Kconfig
This patch changes DVB-S/DVB-S2 to the more commonly used
DVB-S/S2 in the description for DVB_CX24120

Signed-off-by: Jemma Denson <jdenson@gmail.com>
Signed-off-by: Patrick Boettcher <patrick.boettcher@posteo.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-18 16:34:15 -03:00
Patrick Boettcher 1ff2e8ed28 [media] cx24120: fix strict checkpatch-errors
This patches fixes all checkpatch-errors.
Even the ones created --strict.

Signed-off-by: Patrick Boettcher <patrick.boettcher@posteo.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-18 16:33:55 -03:00
Patrick Boettcher 2e89a5e085 [media] cx24120: fix codingstyle issue first round
Mauro pointed out some coding style issues in his review.
This patch fixes them.

Signed-off-by: Patrick Boettcher <patrick.boettcher@posteo.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-18 16:33:18 -03:00
Patrick Boettcher f7a77ebf08 [media] cx24120: i2c-max-write-size is now configurable
Some i2c-hosts are quite limited regarding maximum
i2c-burst-write-sizes. This patch makes the previously
hardcoded field configurable by users of the driver.

Signed-off-by: Patrick Boettcher <patrick.boettcher@posteo.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-18 16:32:35 -03:00
Patrick Boettcher c5fb0f5f54 [media] cx24120: minor checkpatch fixes
This patch fixes printk-related checkpatch warnings. All printks
have been converted to pr_warn or pr_info or pr_err.

Signed-off-by: Patrick.Boettcher <patrick.boettcher@posteo.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-18 16:32:15 -03:00
Jemma Denson 5afc9a25be [media] Add support for TechniSat Skystar S2
This patch adds support for the Technisat Skystar S2 - this
has been tried before but the cx24120 driver was a bit out of shape
and it didn't got any further:

https://patchwork.linuxtv.org/patch/10575/

It is an old card, but currently being sold off for next to nothing,
so it's proving quite popular of late. Noticing it's quite similar
to the cx24116 and cx24117 I've rewritten the driver in a similar way.

There were a few registers and commands from those drivers
missing from this one I've tested out and found they do something so
they've been added in to speed up tuning and to make get_frontend
return something useful.

Signed-off-by: Jemma Denson <jdenson@gmail.com>
Signed-off-by: Patrick.Boettcher <patrick.boettcher@posteo.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-18 16:31:35 -03:00
Antti Palosaari fc3a0497b9 [media] rtl2832_sdr: add support for fc2580 tuner
Add initial support for fc2580 tuner based devices.
Tuner is controlled via V4L2 subdevice API.
Passes v4l2-compliance tests.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-18 15:59:13 -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
Olli Salonen 7adf99d20c [media] si2168: add I2C error handling
Return error from si2168_cmd_execute in case the demodulator returns an
error.

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:19:26 -03:00
Olli Salonen 8117a3121d [media] si2168: add support for gapped clock
Add a parameter in si2168_config to support gapped clock. This might be
necessary on some devices with higher bitrates.

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:16:37 -03:00
Mauro Carvalho Chehab 5a13e40b28 media: replace bellow -> below
Bellow is yelling. Ok, sometimes the code is yells a lot, but
but this is not the case there ;)

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-08 14:48:48 -03:00
Cheolhyun Park 69bb7ab687 [media] drx-j: Misspelled comment corrected
Fix several typos inside the driver's comments.

Signed-off-by: Cheolhyun Park <pch851130@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-01 07:08:11 -03:00
Mauro Carvalho Chehab b674ac290e [media] tda10086: change typecast to u64 to avoid smatch warnings
drivers/media/dvb-frontends/tda10086.c:476 tda10086_get_frontend() warn: should 'tda10086_read_byte(state, 81) << 8' be a 64 bit type?

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-01 06:14:15 -03:00
Mauro Carvalho Chehab 05a848ecbb [media] s5h1420: use only one statement per line
drivers/media/dvb-frontends/s5h1420.c:565 s5h1420_setfec_inversion() warn: inconsistent indenting

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-01 06:13:50 -03:00
Mauro Carvalho Chehab 4e0b003621 [media] stv0900: fix bad indenting
drivers/media/dvb-frontends/stv0900_sw.c:1559 stv0900_search_srate_fine() warn: inconsistent indenting
drivers/media/dvb-frontends/stv0900_sw.c:2012 stv0900_algo() warn: inconsistent indenting

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-01 06:13:23 -03:00
Mauro Carvalho Chehab f3f8ef2274 [media] dib0070: Fix indenting
The indentation on this driver were deadly broken. On lots
of places, it was using 4 spaces instead of tab to indent.
On other parts, it were using tabs.

Also, on several places, it were not even being properly aligned,
as reported by smatch:
	drivers/media/dvb-frontends/dib0070.c:179 dib0070_set_bandwidth() warn: inconsistent indenting
	drivers/media/dvb-frontends/dib0070.c:198 dib0070_captrim() warn: inconsistent indenting
	drivers/media/dvb-frontends/dib0070.c:246 dib0070_set_ctrl_lo5() warn: inconsistent indenting
	drivers/media/dvb-frontends/dib0070.c:260 dib0070_ctrl_agc_filter() warn: inconsistent indenting
	drivers/media/dvb-frontends/dib0070.c:494 dib0070_tune_digital() warn: inconsistent indenting
	drivers/media/dvb-frontends/dib0070.c:498 dib0070_tune_digital() warn: inconsistent indenting
	drivers/media/dvb-frontends/dib0070.c:655 dib0070_reset() warn: inconsistent indenting
	drivers/media/dvb-frontends/dib0070.c:711 dib0070_reset() warn: curly braces intended?
	drivers/media/dvb-frontends/dib0070.c:713 dib0070_reset() warn: inconsistent indenting

My first idea were to leave it as-is or to just touch the above.

However, this won't be fixing anything. So, as painful as it
is, let's fix indentation globally on the driver, and then
address the inconsistencies.

Hopefully, this driver doesn't have much patches, so it likely
won't conflict to any other patch during this merge window.

Besides the big size of this patch, no functional changes
were done.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-01 06:09:10 -03:00
Mauro Carvalho Chehab f9e2e0e8ba [media] dib3000mc: fix bad indenting
drivers/media/dvb-frontends/dib3000mc.c:149 dib3000mc_setup_pwm_state() warn: inconsistent indenting

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-01 06:07:13 -03:00
Mauro Carvalho Chehab 5e6b681b12 [media] stv0297: change typecast to u64 to avoid smatch warnings
drivers/media/dvb-frontends/stv0297.c:140 stv0297_get_symbolrate() warn: should 'stv0297_readreg(state, 86) << 8' be a 64 bit type?
drivers/media/dvb-frontends/stv0297.c:141 stv0297_get_symbolrate() warn: should 'stv0297_readreg(state, 87) << 16' be a 64 bit type?
drivers/media/dvb-frontends/stv0297.c:142 stv0297_get_symbolrate() warn: should 'stv0297_readreg(state, 88) << 24' be a 64 bit type?

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-01 06:05:31 -03:00
Mauro Carvalho Chehab 2267d2d747 [media] zl10353: fix indenting
drivers/media/dvb-frontends/zl10353.c:536 zl10353_read_ucblocks() warn: inconsistent indenting

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-01 06:04:34 -03:00
Mauro Carvalho Chehab 2b257d18f0 [media] tda1004x: fix identation
drivers/media/dvb-frontends/tda1004x.c:653 tda10046_init() warn: inconsistent indenting

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-01 06:03:01 -03:00
Mauro Carvalho Chehab 82e3b88b67 [media] cx24117: fix a buffer overflow when checking userspace params
The maximum size for a DiSEqC command is 6, according to the
userspace API. However, the code allows to write up much more values:
	drivers/media/dvb-frontends/cx24116.c:983 cx24116_send_diseqc_msg() error: buffer overflow 'd->msg' 6 <= 23

Cc: stable@vger.kernel.org
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-30 14:26:42 -03:00
Mauro Carvalho Chehab d7b76c91f4 [media] af9013: Don't accept invalid bandwidth
If userspace sends an invalid bandwidth, it should either return
EINVAL or switch to auto mode.

This driver will go past an array and program the hardware on a
wrong way if this happens.

Cc: stable@vger.kernel.org
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-30 14:26:22 -03:00
Mauro Carvalho Chehab 1fa2337a31 [media] cx24116: fix a buffer overflow when checking userspace params
The maximum size for a DiSEqC command is 6, according to the
userspace API. However, the code allows to write up much more values:
	drivers/media/dvb-frontends/cx24116.c:983 cx24116_send_diseqc_msg() error: buffer overflow 'd->msg' 6 <= 23

Cc: stable@vger.kernel.org
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-30 14:26:05 -03:00
Mauro Carvalho Chehab 12f4543f5d [media] s5h1420: fix a buffer overflow when checking userspace params
The maximum size for a DiSEqC command is 6, according to the
userspace API. However, the code allows to write up to 7 values:
	drivers/media/dvb-frontends/s5h1420.c:193 s5h1420_send_master_cmd() error: buffer overflow 'cmd->msg' 6 <= 7

Cc: stable@vger.kernel.org
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-30 13:59:54 -03:00
Mauro Carvalho Chehab 451dfbe9f1 [media] stv0288: fix indentation
drivers/media/dvb-frontends/stv0288.c:137 stv0288_set_symbolrate() warn: inconsistent indenting

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-30 13:45:32 -03:00
Mauro Carvalho Chehab 16afc67216 [media] lgdt3306a: fix indentation
drivers/media/dvb-frontends/lgdt3306a.c:2104 lgdt3306a_DumpRegs() warn: inconsistent indenting

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-30 13:45:10 -03:00
Mauro Carvalho Chehab c7a092e36e [media] dib3000mc: Fix indentation
drivers/media/dvb-frontends/dib3000mc.c:134 dib3000mc_setup_pwm_state() warn: inconsistent indenting
drivers/media/dvb-frontends/dib3000mc.c:144 dib3000mc_setup_pwm_state() warn: inconsistent indenting
drivers/media/dvb-frontends/dib3000mc.c:420 dib3000mc_sleep() warn: inconsistent indenting
drivers/media/dvb-frontends/dib3000mc.c:453 dib3000mc_set_channel_cfg() warn: inconsistent indenting

The last one is actually due to a commented code. Let's rework
it, in order to remove the sparse warning without removing the
dead code, as it may be useful in the future.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-30 13:44:50 -03:00
Mauro Carvalho Chehab 361f2e8d97 [media] bcm3510: fix indentation
drivers/media/dvb-frontends/bcm3510.c:688 bcm3510_reset() warn: inconsistent indenting
drivers/media/dvb-frontends/bcm3510.c:711 bcm3510_clear_reset() warn: inconsistent indenting

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-30 13:44:28 -03:00
Mauro Carvalho Chehab 21de82e374 [media] dib8000: fix compiler warning
In file included from include/uapi/linux/posix_types.h:4:0,
                 from include/uapi/linux/types.h:13,
                 from include/linux/types.h:5,
                 from include/uapi/linux/sysinfo.h:4,
                 from include/uapi/linux/kernel.h:4,
                 from include/linux/cache.h:4,
                 from include/linux/time.h:4,
                 from include/linux/input.h:11,
                 from drivers/media/usb/dvb-usb/dvb-usb.h:13,
                 from drivers/media/usb/dvb-usb/dib0700.h:13,
                 from drivers/media/usb/dvb-usb/dib0700_devices.c:9:
drivers/media/dvb-frontends/dib8000.h: In function 'dib8000_attach':
include/linux/stddef.h:8:14: warning: return makes integer from pointer without a cast [-Wint-conversion]
 #define NULL ((void *)0)
              ^
drivers/media/dvb-frontends/dib8000.h:72:9: note: in expansion of macro 'NULL'
  return NULL;
         ^

Reported-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-04-28 09:30:33 -03:00