While there's no risk of divison by zero, the logic there is akward, as it
does the calculus for the numerator and denominator before checking
if this will be used.
Change the order to check first if the denominator is zero, and only
calculating the numerator/denominator if not.
This should also avoid those smatch errors:
drivers/media/dvb-frontends/drx39xyj/drxj.c:9605 ctrl_get_qam_sig_quality() debug: sval_binop_unsigned: divide by zero
drivers/media/dvb-frontends/drx39xyj/drxj.c:9605 ctrl_get_qam_sig_quality() debug: sval_binop_unsigned: divide by zero
drivers/media/dvb-frontends/drx39xyj/drxj.c:9605 ctrl_get_qam_sig_quality() debug: sval_binop_unsigned: divide by zero
drivers/media/dvb-frontends/drx39xyj/drxj.c:9605 ctrl_get_qam_sig_quality() debug: sval_binop_unsigned: divide by zero
drivers/media/dvb-frontends/drx39xyj/drxj.c:9605 ctrl_get_qam_sig_quality() debug: sval_binop_unsigned: divide by zero
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
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/*
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>
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>
Changeset 9b174527e7 added this new macro, ensuring that it
is true only if the function is actually reachable.
However, newer drivers were added since when it was written.
So, change those drivers to also use it.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
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>
drx39xxj_set_lna() and drx39xxj_set_frontend() set LNA. Instead of
duplicating LNA configure code, change to use drxj_set_lna_state()
which sets LNA to the caller requested state (on or off).
Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Several functions ignore the return values in error legs and always
return -EIO. This makes it hard to debug and take proper action in
calling routines.
Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
drx39xyj driver lacks resume support. Add support by changing
its fe ops init interface to detect the resume status by checking
fe exit flag and do the necessary initialization. With this change,
driver resume correctly in both dvb adapter is not in use and in use
by an application cases.
Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Change drx39xyj_release() to check fe exit flag to detect the
device disconnect state and avoid accessing the device after
it has been removed.
Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
This issue was reported by coccicheck using the semantic patch
at scripts/coccinelle/api/memdup.cocci
Signed-off-by: Benoit Taine <benoit.taine@lip6.fr>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
The Kconfig entry for "Micronas DRX-J demodulator" defaults to modular
if DVB_FE_CUSTOMISE is set. But that Kconfig symbol was replaced with
MEDIA_SUBDRV_AUTOSELECT as of v3.7. So use the new symbol. And negate
the logic, because MEDIA_SUBDRV_AUTOSELECT's logic is the opposite of
the former logic.
Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
There are two troubles there:
1) the bit error measure were not accumulating;
2) it was missing the bit count.
Fix them.
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
drivers/media/dvb-frontends/drx39xyj/drxj.c: In function 'ctrl_get_qam_sig_quality':
drivers/media/dvb-frontends/drx39xyj/drxj.c:9468:6: warning: variable 'ber_cnt' set but not used [-Wunused-but-set-variable]
u32 ber_cnt = 0; /* BER count */
^
By reading the comment, it is said that BER should be calculated as:
qam_pre_rs_ber = frac_times1e6( ber_cnt, rs_bit_cnt );
Also, it makes sense to take the mantissa into account, so fix the
code to do what's commented.
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Now that everything is set, let's enable DVBv5 stats, for
applications that support it.
DVBv3 apps will still work.
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Instead of just assuming that the min resolution is 1E-6,
pass both bit error and bit counts for userspace to calculate
BER. The same applies for PER, for 8VSB. It is not clear how
to get the packet count for QAM. So, for now, don't expose PER
for QAM.
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Convert the stats internally to use DVBv5. For now, it will keep
showing everything via DVBv3 API only, as the .len value were
not initialized.
That allows testing if the new stats code didn't break anything.
A latter patch will add the final bits for the DVBv5 stats to
fully work.
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
We'll need to use this function. Restore it from the
git history.
This function will be used on the next patch.
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
State is already used on other places for the state struct.
Don't use it here, to avoid troubles with latter patches.
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
As reported when compiled with W=1:
drivers/media/dvb-frontends/drx39xyj/drxj.c: In function ‘ctrl_set_channel’:
drivers/media/dvb-frontends/drx39xyj/drxj.c:10340:26: warning: variable ‘common_attr’ set but not used [-Wunused-but-set-variable]
struct drx_common_attr *common_attr = NULL;
^
drivers/media/dvb-frontends/drx39xyj/drxj.c:10336:6: warning: variable ‘intermediate_freq’ set but not used [-Wunused-but-set-variable]
s32 intermediate_freq = 0;
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
This function is currently not used. However, it was meant to
be called at device release. So, add it there.
While here, remove the bad check, as reported by Dan, as
smatch warning:
drivers/media/dvb-frontends/drx39xyj/drxj.c:20041 drxj_close() warn: variable dereferenced before check 'demod' (see line 20036)
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
There are large chunks of code at drx-j that aren't used. Most
of them are due to analog TV support. Well, just enabling them
won't make analog support work, as devices with DRX and analog
support requires an extra chip (avf4910).
We don't have drivers for it, nor the current device that uses
this frontend has support for analog TV.
So, let's just get rid of this code. If latter needed, this
patch can easily be reverted from git history.
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
As reported by the kbuild test robot <fengguang.wu@intel.com>:
drivers/built-in.o: In function `em28xx_dvb_init':
em28xx-dvb.c:(.text+0x876f2c): undefined reference to `drx39xxj_attach'
That happens when CONFIG_VIDEO_EM28XX_DVB is selected, and neither
CONFIG_MEDIA_SUBDRV_AUTOSELECT or DVB_DRX39XYJ is selected.
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Fixes the following warnings:
drivers/media/dvb-frontends/drx39xyj/drxj.c:1679:65: warning: Using plain integer as NULL pointer
drivers/media/dvb-frontends/drx39xyj/drxj.c:1679:71: warning: Using plain integer as NULL pointer
drivers/media/dvb-frontends/drx39xyj/drxj.c:1681:52: warning: Using plain integer as NULL pointer
drivers/media/dvb-frontends/drx39xyj/drxj.c:1681:58: warning: Using plain integer as NULL pointer
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Fix sparse warning:
drivers/media/dvb-frontends/drx39xyj/drxj.c:1039:16: sparse: symbol 'drxj_default_aud_data_g' was not declared. Should it be static?
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Currently, there's just one device using this frontend: PCTV 80e,
and it works on serial mode.
Change the default here to serial mode. If we add more devices,
then this option should be set via config structure.
Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
The cfg_mpeg_output has more fields than what it is initialized
when the code is called. Be sure to initialize everything before
use, in order to avoid random behaviors.
Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Just like the windows driver, disable OOB after setting the driver
version.
Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
DJH_DEBUG only code path in drxbsp_i2c_write_read() dereferences
w_dev_addr and subsequently w_dev_addr->user_data->i2c which results
in failure during boot. This patch fixes the null pointer derefence
bug as well as the following compile errors:
LD arch/x86/built-in.o
CC drivers/media/dvb-frontends/drx39xyj/drxj.o
drivers/media/dvb-frontends/drx39xyj/drxj.c: In function ‘drxbsp_i2c_write_read’:
drivers/media/dvb-frontends/drx39xyj/drxj.c:1558:25: error: redeclaration of ‘state’ with no linkage
struct drx39xxj_state *state = w_dev_addr->user_data;
^
drivers/media/dvb-frontends/drx39xyj/drxj.c:1512:25: note: previous declaration of ‘state’ was here
struct drx39xxj_state *state;
^
drivers/media/dvb-frontends/drx39xyj/drxj.c:1558:2: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
struct drx39xxj_state *state = w_dev_addr->user_data;
^
drivers/media/dvb-frontends/drx39xyj/drxj.c:1560:17: error: redeclaration of ‘msg’ with no linkage
struct i2c_msg msg[2] = {
^
drivers/media/dvb-frontends/drx39xyj/drxj.c:1513:17: note: previous declaration of ‘msg’ was here
struct i2c_msg msg[2];
^
Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Mimic what windows driver does here: it writes 0x07 to
SIO_CC_SOFT_RST__A, instead of just 0x03.
Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
As drxj_close puts the device in powerdown, we need to power it up
properly at drxj_open.
This is the behavior noticed at the Windows driver.
Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
There are no other I2C masters here. Also, the Windows driver uses
this mode (and both drxd and drxk Kernel drivers). So, switch
to it.
That helps to compare the logs between the Linux driver and the
Windows one.
Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Instead of just disabling the LNA every time, allow to control it from
userspace.
Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
On several places, the I2C functions are just wrappers to others.
Get rid of it.
Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
This struct contains the first abstraction layer for the I2C
access routines. Get rid of it.
Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
This file contains an abstract layer for the I2C transfer
functions. Get rid of it, merging it at drxj. This will allow
to remove another abstraction layer there, making the code
easier to read, and removing the functions that just return
-EIO.
Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Reorder functions and data at drx_dap_fasi.c, in order to avoid
having function prototypes.
This is in preparation to merge this code inside drxj, removing
some duplicated bits there, and getting rid of yet another
abstraction layer.
Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
This is not used anywere. Get rid of it.
Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
QAM/256 currently doesn't work, as the code is only called if
channel->mirror is DRX_MIRROR_AUTO, but a prevous if prevents
this condition to happen.
While here, returns -EINVAL to not supported QAM modes and
simplify the code, reducing the number of indents.
Acked-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>