summaryrefslogtreecommitdiff
path: root/drivers/media/dvb-frontends/mb86a20s.c
AgeCommit message (Collapse)Author
2013-08-22[media] mb86a20s: Fix TS parallel modeMauro Carvalho Chehab
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 Chehab
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 Chehab
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 Chehab
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 Chehab
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 Chehab
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 Chehab
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 Chehab
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 Chehab
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 Chehab
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 Chehab
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 Chehab
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 Chehab
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 Chehab
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 Chehab
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 Chehab
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 Chehab
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 Chehab
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 Chehab
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 Chehab
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 Chehab
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 Chehab
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 Chehab
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 Chehab
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 Chehab
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 Chehab
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 Chehab
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 Chehab
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 Chehab
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 Chehab
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 Chehab
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 Chehab
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 Chehab
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 Chehab
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 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>