aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb-frontends/mb86a20s.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2016-11-18[media] dvb: make DVB frontend *_ops instances "const"Max Kellermann1-2/+2
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-10-24[media] mb86a20s: always initialize a return valueNicolas Iooss1-0/+1
In mb86a20s_read_status_and_stats(), when mb86a20s_read_status() fails, the function returns the value in variable rc without initializing it first. Fix this by propagating the error code from variable status_nr. This bug has been found using clang and -Wsometimes-uninitialized warning flag. Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-09-05[media] mb86a20s: fix demod settingsMauro Carvalho Chehab1-50/+42
With the current settings, only one channel locks properly. That's likely because, when this driver was written, Brazil were still using experimental transmissions. Change it to reproduce the settings used by the newer drivers. That makes it lock on other channels. Tested with both PixelView SBTVD Hybrid (cx231xx-based) and C3Tech Digital Duo HDTV/SDTV (em28xx-based) devices. Cc: stable@vger.kernel.org Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-09-05[media] mb86a20s: fix the locking logicMauro Carvalho Chehab1-1/+11
On this frontend, it takes a while to start output normal TS data. That only happens on state S9. On S8, the TS output is enabled, but it is not reliable enough. However, the zigzag loop is too fast to let it sync. As, on practical tests, the zigzag software loop doesn't seem to be helping, but just slowing down the tuning, let's switch to hardware algorithm, as the tuners used on such devices are capable of work with frequency drifts without any help from software. Cc: stable@vger.kernel.org Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-07-15[media] mb86a20s: apply mask to val after checking for read failureColin Ian King1-1/+2
Appling the mask 0x0f to the immediate return of the call to mb86a20s_readreg will always result in a positive value, meaning that the check of ret < 0 will never work. Instead, check for a -ve return value first, and then mask val with 0x0f. Kudos to Mauro Carvalho Chehab for spotting the mistake in my original fix. Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-02-04[media] mb86a20s: get rid of dummy get_frontend()Mauro Carvalho Chehab1-11/+0
This is not needed, as the core handles well if get_frontend() is not present. Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-06-09[media] dvb: Get rid of typedev usage for enumsMauro Carvalho Chehab1-3/+3
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-01-26[media] mb86a20s: remove unused debug modprobe parameterMauro Carvalho Chehab1-4/+0
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>
2014-09-03[media] mb86a16/mb86a20s: fix sparse warningsHans Verkuil1-7/+7
drivers/media/dvb-frontends/mb86a16.c:31:14: warning: symbol 'verbose' was not declared. Should it be static? drivers/media/dvb-frontends/mb86a20s.c:36:4: warning: symbol 'mb86a20s_subchannel' was not declared. Should it be static? drivers/media/dvb-frontends/mb86a20s.c:1333:24: warning: symbol 'cnr_qpsk_table' was not declared. Should it be static? Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-22[media] mb86a20s: Fix the code that estimates the measurement intervalMauro Carvalho Chehab1-4/+4
Instead of looking at the guard interval field, it was using the interval length, with is wrong. Fix it. Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-22[media] mb86a20s: Fix InterleavingMauro Carvalho Chehab1-14/+4
Interleaving code was wrong at mb86a20s: instead, it was looking at the Guard Interval. Fix it. Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-07-22[media] mb86a20s: fix ISDB-T mode handlingMauro Carvalho Chehab1-4/+5
The driver was reporting an incorrect mode, when mode 2 is selected. While testing it, noticed that neither mode 1 or guard interval 1/32 is supported by this device. Document it, and ensure that it will report _AUTO when it doesn't lock, in order to not report a wrong detection to userspace. Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2014-02-07[media, edac] Change my email addressMauro Carvalho Chehab1-2/+2
There are several left overs with my old email address. Remove their occurrences and add myself at CREDITS, to allow people to be able to reach me on my new addresses. Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2013-08-22[media] mb86a20s: Fix TS parallel modeMauro Carvalho Chehab1-9/+7
changeset 768e6dadd74 caused a regression on using mb86a20s in parallel mode, as the parallel mode selection got overriden by mb86a20s_init2. Cc: stable@vger.kernel.org Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
2013-04-08[media] mb86a20s: better name temp vars at mb86a20s_layer_bitrate()Mauro Carvalho Chehab1-18/+19
Using 'i' for the guard interval temporary var is a bad idea, as 'i' is generally used by "anonymous" indexes. Let's rename modulation, fec and guard interval temp vars with a meaningful name, as that makes easier to understand the code and avoids cut-and-paste types of error. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com> Signed-off-by: Michael Krufky <mkrufky@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-04-08[media] mb86a20s: Fix estimate_rate settingMauro Carvalho Chehab1-1/+1
As reported by Dan Carpenter <dan.carpenter@oracle.com>: Smatch warnings: drivers/media/dvb-frontends/mb86a20s.c:644 mb86a20s_layer_bitrate() error: buffer overflow 'state->estimated_rate' 3 <= 3 What happens there is that estimate_rate index should be the layer number, and not the guard interval. Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com> Signed-off-by: Michael Krufky <mkrufky@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-04-08[media] mb86a20s: Use 'layer' instead of 'i' on all placesMauro Carvalho Chehab1-74/+74
We're using the anonymous 'i' to indicate the layer number on several places on the driver. That's not good, as some cut-and-paste type of change might be doing the wrong thing. So, call it as "layer" everywhere. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com> Signed-off-by: Michael Krufky <mkrufky@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-04-08[media] mb86a20s: fix audio sub-channel checkMauro Carvalho Chehab1-1/+1
As reported by Dan Carpenter <dan.carpenter@oracle.com> FYI, there are new smatch warnings show up in: tree: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next master head: da17d7bda957ae4697b6abc0793f74fb9b50b58f commit: 04fa725e7b1c22c583dd71a8cd85b8d997edfce3 [media] mb86a20s: Implement set_frontend cache logic New smatch warnings: drivers/media/dvb-frontends/mb86a20s.c:1897 mb86a20s_set_frontend() error: buffer overflow 'mb86a20s_subchannel' 8 <= 8 04fa725e Mauro Carvalho Chehab 2013-03-04 1894 if (c->isdbt_sb_subchannel > ARRAY_SIZE(mb86a20s_subchannel)) 04fa725e Mauro Carvalho Chehab 2013-03-04 1895 c->isdbt_sb_subchannel = 0; 04fa725e Mauro Carvalho Chehab 2013-03-04 1896 04fa725e Mauro Carvalho Chehab 2013-03-04 @1897 state->subchannel = mb86a20s_subchannel[c->isdbt_sb_subchannel]; Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com> Signed-off-by: Michael Krufky <mkrufky@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-04-08[media] mb86a20s: Use a macro for the number of layersMauro Carvalho Chehab1-15/+17
Instead of using the magic number "3", use NUM_LAYERS macro on all places that are related to the ISDB-T layers. This makes the source code a little more readable. No functional changes. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com> Signed-off-by: Michael Krufky <mkrufky@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-04[media] mb86a20s: Don't assume a 32.57142MHz clockMauro Carvalho Chehab1-2/+24
Now that some devices initialize register 0x2a with different values, add the calculus formula, instead of hardcoding it. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-04[media] mb86a20s: Implement set_frontend cache logicMauro Carvalho Chehab1-11/+63
Up to now, the driver was simply assuming TV mode, 13 segs. Implement the logic to control the ISDB operational mode. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-04[media] mb86a20s: cleanup the status at set_frontend()Mauro Carvalho Chehab1-0/+1
As the device got re-initialized, the stats should vanish until the device gets lock again. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-04[media] mb86a20s: Don't reset strength with the other statsMauro Carvalho Chehab1-1/+0
Signal strength is always available. There's no reason to reset it, as it has its own logic to reset it already. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-04[media] mb86a20s: Always reset the frontend with set_frontendMauro Carvalho Chehab1-12/+7
Always init the frontend when set_frontend is called. The rationale is: it was noticed that, on some devices, it fails to lock with a different channel. It seems that some other registers need to be restored to its initial state, when the channel changes. As it is better to reset everything, even wasting a few more miliseconds than to loose channel lock, let's change the logic to always reset. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-04[media] mb86a20s: change AGC tuning parametersMauro Carvalho Chehab1-42/+44
Use the AGC settings present on a newer device. The initial settings were taken from one of the first devices with mb86a20s, and there are several reports that this is not working properly on some places. So, instead of keeping using it, get the parameters taken from a newer device. Tests are welcomed. Tested also with cx231xx PixelView SBTVD Hybrid with no regressions noticed so far. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-04[media] mb86a20s: don't allow updating signal strength too fastMauro Carvalho Chehab1-7/+17
Getting signal strength requires some loop poking with I2C. Don't let it happen too fast. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-04[media] mb86a20s: Fix signal strength calculusMauro Carvalho Chehab1-1/+1
A register typo made the calculation to not work. Fix it. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-04[media] mb86a20s: provide CNR stats before FE_HAS_SYNCMauro Carvalho Chehab1-8/+16
State 9 means TS started to be output, and it should be associated with FE_HAS_SYNC. The mb86a20scan get CNR statistics at state 7, when frame sync is obtained. As CNR may help to adjust the antenna, provide it earlier. A latter patch could eventually start outputing MER measures earlier, but that would require a bigger change, and probably won't be better than the current way, as the time between changing from state 8 to 9 is generally lower than the time to get the stats collected. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-04[media] mb86a20s: adjust IF based on what's set on the tunerMauro Carvalho Chehab1-4/+53
Instead of hardcoding a fixed IF frequency of 3.3 MHz, use the IF frequency provided by the tuner driver. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-03-04[media] mb86a20s: don't pollute dmesg with debug messagesMauro Carvalho Chehab1-3/+3
There are a few debug tests that are shown with dev_err() or dev_info(). Replace them by dev_dbg(). Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-01-24[media] mb86a20s: remove global BER/PER counters if per-layer counters vanishMauro Carvalho Chehab1-3/+9
If, for any reason, all per-layers counters stop, remove the corresponding global counter. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-01-24[media] mb86a20s: add a logic for post-BER measurementMauro Carvalho Chehab1-24/+196
The logic here is similar to the preBER. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-01-24[media] mb86a20s: fix the PER reset logicMauro Carvalho Chehab1-5/+35
The logic that resets the device is wrong. It should be resetting just the layer that got read. Also, stop is needed before updating the counters. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-01-24[media] mb86a20s: some fixes at preBER logicMauro Carvalho Chehab1-12/+39
The logic that resets the device is wrong. It should be resetting just the layer that got read. Also, stop is needed before updating the counters. While there, rename it, as we'll soon introduce a postBER logic there. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-01-24[media] mb86a20s: add block count measures (PER/UCB)Mauro Carvalho Chehab1-10/+180
Add both per-layer and global block error count and block count, for PER and UCB measurements. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-01-23[media] mb86a20s: add CNR measurementMauro Carvalho Chehab1-2/+334
Add Signal/Noise ratio measurement. On this device, a global measure is taken by the demod. It also provides per-layer CNR measurements, based on Modulation Error measures (MER). Reviewed-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-01-23[media] mb86a20s: improve bit error count for BERMauro Carvalho Chehab1-3/+157
Do a better job on setting the bit error counters, in order to have all layer measures to happen in a little less than one second. Reviewed-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-01-23[media] mb86a20s: add BER measurementMauro Carvalho Chehab1-3/+178
Add the methods to read bit error/bit count measurements from mb86a20s. On ISDB-T devices, those reads are done per layer. However, as userspace applications may not be aware of that, add a global measure that will sum the bit errors and bit counts for each layer, storing them into a global value. Reviewed-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-01-23[media] mb86a20s: calculate statistics at .read_status()Mauro Carvalho Chehab1-39/+224
Instead of providing separate callbacks to read the several FE stats properties, the better seems to use just one method that will: - Read lock status; - Read signal strength; - if locked, get TMCC data; - if locked, get DVB statistics. As the DVB frontend thread will call this read_status callback on every 3 seconds, and userspace can even call it earlier, all stats data and layers layout will be updated together if available, with is a good thing. Reviewed-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-01-23[media] mb86a20s: don't use state before initializing itMauro Carvalho Chehab1-5/+5
As reported by Feng's kbuild test: From: kbuild test robot <fengguang.wu@intel.com> Subject: drivers/media/dvb-frontends/mb86a20s.c:706 mb86a20s_attach() error: potential null dereference 'state'. (kzalloc returns null) Date: Wed, 23 Jan 2013 19:30:43 +0800 commit: f66d81b54dac26d4e601d4d7faca53f3bdc98427 [media] mb86a20s: convert it to use dev_info/dev_err/dev_dbg drivers/media/dvb-frontends/mb86a20s.c:706 mb86a20s_attach() error: potential null dereference 'state'. (kzalloc returns null) drivers/media/dvb-frontends/mb86a20s.c:706 mb86a20s_attach() error: we previously assumed 'state' could be null (see line 705) As, at mb86a20s_attach(), we have an i2c pointer, use it for all printk messages there, instead of state->i2c. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-01-22[media] mb86a20s: convert it to use dev_info/dev_err/dev_dbgMauro Carvalho Chehab1-44/+52
Instead of having its own set of macros, use the Kernel default ones for debug, error and info. While here, do some cleanup on the debug printk's. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-01-22[media] mb86a20s: Function reorderMauro Carvalho Chehab1-105/+110
Reorder functions to have everything related to stats/status read close. That will make the file more organized as other stats routines will be added. No functional changes. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-01-22[media] mb86a20s: Split status read logic from DVB callbackMauro Carvalho Chehab1-7/+24
Split the logic that reads the status from the DVB callback. That helps to properly return an error code, if status read fails. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-01-22[media] mb86a20s: fix interleaving and FEC retrivalMauro Carvalho Chehab1-5/+17
Get the proper bits from the TMCC table registers. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-01-22[media] mb86a20s: make AGC work betterMauro Carvalho Chehab1-1/+2
It is recommented to change register 0x0440 value to 0, in order to fix some AGC bug. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-01-22[media] mb86a20s: Fix i2c gate on errorMauro Carvalho Chehab1-1/+5
If an error happens, restore tuner I2C gate to the right value. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2013-01-22[media] mb86a20s: improve error handling at get_frontendMauro Carvalho Chehab1-58/+80
The read/write errors are not handled well on get_frontend. Fix it, by letting the frontend cached values to represent the DVB properties that were successfully retrieved. While here, use "c" for dtv_frontend_properties cache, instead of "p", as this is more common. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-08-13[media] move the dvb/frontends to drivers/media/dvb-frontendsMauro Carvalho Chehab1-0/+701
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>