summaryrefslogtreecommitdiff
path: root/drivers/media/dvb-frontends/stv090x.c
AgeCommit message (Collapse)Author
2016-11-23[media] stv090x: use lookup tables for carrier/noise ratioJoerg Riechardt
The stv090x driver uses the lookup table for signal strength already, with this patch we use the lookup tables for carrier/noise ratio as well. This has the advantage, that values for DVB-S and DVB-S2 are now corresponding, while before they were way off. The values are now proportional to real carrier/noise ratio, while before they were corresponding to register values. So now applications are able to give the user real carrier/noise ratio. Because the output has to be within 0x0000...0xFFFF the three negative values for DVB-S2 are omitted. This is no significant loss, because reception is lost at 7.5 dB already (TT S2-1600, Cine S2), so the negative values are not really important, and also for DVB-S they donĀ“t exist. Signed-off-by: Joerg Riechardt <j.riechardt@gmx.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-18[media] dvb: make DVB frontend *_ops instances "const"Max Kellermann
These are immutable. Making them "const" allows the compiler to move them to the "rodata" section. Note that cxd2841er_t_c_ops cannot be made "const", because cxd2841er_attach() modifies it. Ouch! [mchehab@s-opensource.com: fix merge conflicts] Signed-off-by: Max Kellermann <max.kellermann@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-11-18[media] stv090x: get rid of continuation linesMauro Carvalho Chehab
This driver has printk continuation lines for debugging purposes. Since commit 563873318d32 ("Merge branch 'printk-cleanups'")', this won't work as expected anymore. So, use %*ph and get rid of it. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2015-06-09[media] dvb: Get rid of typedev usage for enumsMauro Carvalho Chehab
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/*
2014-12-04[media] stv090x: add an extra protetion against buffer overflowMauro Carvalho Chehab
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[media] stv090x: Remove an unreachable codeMauro Carvalho Chehab
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[media] stv090x: remove export symbol for stv090x_set_gpio()Mauro Carvalho Chehab
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-11-05[media] stv090x: Fix delivery system settingMauro Carvalho Chehab
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-03[media] stv090x: remove indent levels in stv090x_get_coldlock()Dan Carpenter
This code is needlessly complicated and checkpatch.pl complains that we go over the 80 characters per line limit. If we flip the "if (!lock) {" test to "if (lock) return;" then we can remove an indent level from the rest of the function. We can add two returns in the "if (state->srate >= 10000000) {" condition and move the else statement back an additional indent level. There is another "if (!lock) {" check which can be removed since we have already checked "lock" and know it is zero at this point. This second check on "lock" is also a problem because it sets off a static checker warning. I have reviewed this code for some time to see if something else was intended, but have concluded that it was simply an oversight and should be removed. Removing this duplicative check gains us an third indent level. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2013-11-08[media] stv090x: Don't use dynamic static allocationMauro Carvalho Chehab
Dynamic static allocation is evil, as Kernel stack is too low, and compilation complains about it on some archs: drivers/media/dvb-frontends/stv090x.c:750:1: warning: 'stv090x_write_regs.constprop.6' uses dynamic stack allocation [enabled by default] Instead, let's enforce a limit for the buffer. Considering that I2C transfers are generally limited, and that devices used on USB has a max data length of 64 bytes for the control URBs. So, it seem safe to use 64 bytes as the hard limit for all those devices. On most cases, the limit is a way lower than that, but this limit is small enough to not affect the Kernel stack, and it is a no brain limit, as using smaller ones would require to either carefully each driver or to take a look on each datasheet. Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com> Reviewed-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2013-03-14[media] stv090x: do not unlock unheld mutex in stv090x_sleep()Alexey Khoroshilov
goto err and goto err_gateoff before mutex_lock(&state->internal->demod_lock) lead to unlock of unheld mutex in stv090x_sleep(). Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru> Cc: Manu Abraham <abraham.manu@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-01-24[media] stv090x: On STV0903 do not set registers of the second pathAndreas Regel
Sometimes there is a problem when trying to access the non-existing registers of the second demodulator path on the STV0903. This change removes the calls in case the driver is used on a STV0903. Signed-off-by: Andreas Regel <andreas.regel@gmx.de> Acked-by: Manu Abraham <manu@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-09-23[media] stv090x: add support for multistreamEvgeny Plehov
Adds support for filtering multistream TS using stv090x hardware. Signed-off-by: Evgeny Plehov <EvgenyPlehov@ukr.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-13[media] move the dvb/frontends to drivers/media/dvb-frontendsMauro Carvalho Chehab
Raise the DVB frontends one level up, as the intention is to remove the drivers/media/dvb directory. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>