summaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb-frontends
Commit message (Collapse)AuthorAgeFilesLines
...
* media: zd1301_demod: constify i2c_algorithm structureGustavo A. R. Silva2017-07-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Check for i2c_algorithm structures that are only stored in the algo field of an i2c_adapter structure. This field is declared const, so i2c_algorithm structures that have this property can be declared as const also. This issue was identified using Coccinelle and the following semantic patch: @r disable optional_qualifier@ identifier i; position p; @@ static struct i2c_algorithm i@p = { ... }; @ok@ identifier r.i; struct i2c_adapter e; position p; @@ e.algo = &i@p; @bad@ position p != {r.p,ok.p}; identifier r.i; @@ i@p @depends on !bad disable optional_qualifier@ identifier r.i; @@ static +const struct i2c_algorithm i = { ... }; Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: dib8000: constify i2c_algorithm structureGustavo A. R. Silva2017-07-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Check for i2c_algorithm structures that are only stored in the algo field of an i2c_adapter structure. This field is declared const, so i2c_algorithm structures that have this property can be declared as const also. This issue was identified using Coccinelle and the following semantic patch: @r disable optional_qualifier@ identifier i; position p; @@ static struct i2c_algorithm i@p = { ... }; @ok@ identifier r.i; struct i2c_adapter e; position p; @@ e.algo = &i@p; @bad@ position p != {r.p,ok.p}; identifier r.i; @@ i@p @depends on !bad disable optional_qualifier@ identifier r.i; @@ static +const struct i2c_algorithm i = { ... }; Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: s5h1420: constify i2c_algorithm structureGustavo A. R. Silva2017-07-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Check for i2c_algorithm structures that are only stored in the algo field of an i2c_adapter structure. This field is declared const, so i2c_algorithm structures that have this property can be declared as const also. This issue was identified using Coccinelle and the following semantic patch: @r disable optional_qualifier@ identifier i; position p; @@ static struct i2c_algorithm i@p = { ... }; @ok@ identifier r.i; struct i2c_adapter e; position p; @@ e.algo = &i@p; @bad@ position p != {r.p,ok.p}; identifier r.i; @@ i@p @depends on !bad disable optional_qualifier@ identifier r.i; @@ static +const struct i2c_algorithm i = { ... }; Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: dib7000p: constify i2c_algorithm structureGustavo A. R. Silva2017-07-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Check for i2c_algorithm structures that are only stored in the algo field of an i2c_adapter structure. This field is declared const, so i2c_algorithm structures that have this property can be declared as const also. This issue was identified using Coccinelle and the following semantic patch: @r disable optional_qualifier@ identifier i; position p; @@ static struct i2c_algorithm i@p = { ... }; @ok@ identifier r.i; struct i2c_adapter e; position p; @@ e.algo = &i@p; @bad@ position p != {r.p,ok.p}; identifier r.i; @@ i@p @depends on !bad disable optional_qualifier@ identifier r.i; @@ static +const struct i2c_algorithm i = { ... }; Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: dib9000: constify i2c_algorithm structureGustavo A. R. Silva2017-07-201-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Check for i2c_algorithm structures that are only stored in the algo field of an i2c_adapter structure. This field is declared const, so i2c_algorithm structures that have this property can be declared as const also. This issue was identified using Coccinelle and the following semantic patch: @r disable optional_qualifier@ identifier i; position p; @@ static struct i2c_algorithm i@p = { ... }; @ok@ identifier r.i; struct i2c_adapter e; position p; @@ e.algo = &i@p; @bad@ position p != {r.p,ok.p}; identifier r.i; @@ i@p @depends on !bad disable optional_qualifier@ identifier r.i; @@ static +const struct i2c_algorithm i = { ... }; Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: dvb-frontends/stv0367: DDB frontend status inquiry fixupDaniel Scheller2017-07-201-3/+3
| | | | | | | | | | | | Return 0 instead of -EINVAL in get_frontend if no demod mode is active. This fixes ie. dvb-fe-tool getting confused and assuming a DVBv3 FE on idle frontends when the FE has been put to sleep using sleep(). Also, in read_status(), don't immediately return when no demod is active, so the remaining code has a chance to clear the signal statistics. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: dvb-frontends: add ST STV6111 DVB-S/S2 tuner frontend driverDaniel Scheller2017-07-204-0/+704
| | | | | | | | | | | | | | | This adds a frontend driver for the ST STV6111 DVB-S/S2 tuners. Like the stv0910 demod frontend driver, this driver originates from the Digital Devices' dddvb vendor driver package as of version 0.9.29, and was cleaned up aswell. No functionality had to be removed though. Any camel case has been converted to kernel_case, fixup patch has been proposed upstream. Permission to reuse and mainline the driver code was formally granted by Ralph Metzler <rjkm@metzlerbros.de>. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Tested-by: Richard Scobie <r.scobie@clear.net.nz> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: dvb-frontends/stv0910: Add missing set_frontend fe-opDaniel Scheller2017-07-201-0/+1
| | | | | | | | This was missing from the frontend_ops. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Tested-by: Richard Scobie <r.scobie@clear.net.nz> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: dvb-frontends/stv0910: Add demod-only signal strength reportingDaniel Scheller2017-07-201-4/+44
| | | | | | | | | | | | Original code at least has some signed/unsigned issues, resulting in values like 32dBm. Implement signal strength readout to work without asking the attached tuner, and use a lookup table instead of log calc. Values reported appear plausible, gathered from feedback from several testers. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Tested-by: Richard Scobie <r.scobie@clear.net.nz> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: dvb-frontends/stv0910: add multistream (ISI) and PLS capabilitiesDaniel Scheller2017-07-201-1/+28
| | | | | | | | | | | | | | | | Implements stream_id filter and scrambling code setup in start() and also sets FE_CAN_MULTISTREAM in frontend_ops. This enables the driver to properly receive and handle multistream transponders, functionality has been reported working fine by testers with access to such streams, in conjunction with VDR on the userspace side. The code snippet originates from the original vendor's dddvb driver package and has been made working properly with the current in-kernel DVB core API. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Tested-by: Richard Scobie <r.scobie@clear.net.nz> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: dvb-frontends/stv0910: Fix possible buffer overflowDaniel Scheller2017-07-201-1/+2
| | | | | | | | | | | | | | | | Fixes smatch error: drivers/media/dvb-frontends/stv0910.c:715 dvbs2_nbch() error: buffer overflow 'nbch[fectype]' 2 <= 28 Also, fixes the nbch array table by adding the DUMMY_PLF element at the top to match the enums (table element order was off by one before). Patch sent upstream aswell. Cc: Ralph Metzler <rjkm@metzlerbros.de> Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Tested-by: Richard Scobie <r.scobie@clear.net.nz> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: dvb-frontends: add ST STV0910 DVB-S/S2 demodulator frontend driverDaniel Scheller2017-07-205-0/+6503
| | | | | | | | | | | | | | | | | | This adds a multi frontend driver for the ST STV0910 DVB-S/S2 demodulator frontends. The driver code originates from the Digital Devices' dddvb vendor driver package as of version 0.9.29, and has been cleaned up from core API usage which isn't supported yet in the kernel, and additionally all obvious style issues have been resolved. All camel case and allcaps have been converted to kernel_case and lowercase. Patches have been sent to the vendor package maintainers to fix this aswell. Signal statistics acquisition has been refactored to comply with standards. Permission to reuse and mainline the driver code was formally granted by Ralph Metzler <rjkm@metzlerbros.de>. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Tested-by: Richard Scobie <r.scobie@clear.net.nz> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: dvb-frontends/stv0367: Improve DVB-C/T frontend statusMauro Carvalho Chehab2017-06-251-1/+14
| | | | | | | | | | The stv0367 driver provide a lot of status on its state machine. Change the logic to provide more information about frontend locking status. Also, while any detailed status isn't available, provide a more complete FE_STATUS for DVB-T. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com> Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
* media: dvb-frontends/stv0367: DVB-C signal strength statisticsDaniel Scheller2017-06-251-0/+21
| | | | | | | | | Provide QAM/DVB-C signal strength in decibel scale. Values returned from stv0367cab_get_rf_lvl() are good but need to be multiplied as they're in 1dBm precision. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: dvb-frontends/stv0367: update UCB readout condition logicDaniel Scheller2017-06-251-6/+4Star
| | | | | | | | Since the other statistics are read when fe_status conditions are TRUE, change the ucblocks readout logic to match this aswell. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: stv0367: prevent division by zeroMauro Carvalho Chehab2017-06-251-1/+3
| | | | | | | | While there's a test at the SNR calculus to avoid division by zero, it will still follow the path that would do the division. So, add a missing break there. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: dvb-frontends/stv0367: SNR DVBv5 statistics for DVB-C and TDaniel Scheller2017-06-251-0/+39
| | | | | | | | | Add signal-to-noise-ratio as provided by the demodulator in decibel scale. QAM/DVB-C needs some intlog calculation to have usable dB values, OFDM/ DVB-T values from the demod look alright already and are provided as-is. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: dvb-frontends/cxd2841er: require STATE_ACTIVE_* for agc readoutDaniel Scheller2017-06-251-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | When the demod driver puts the demod into sleep or shutdown state and it's status is then polled e.g. via "dvb-fe-tool -m", i2c errors are printed to the kernel log. If the last delsys was DVB-T/T2: cxd2841er: i2c wr failed=-5 addr=6c reg=00 len=1 cxd2841er: i2c rd failed=-5 addr=6c reg=26 and if it was DVB-C: cxd2841er: i2c wr failed=-5 addr=6c reg=00 len=1 cxd2841er: i2c rd failed=-5 addr=6c reg=49 This happens when read_status unconditionally calls into the read_signal_strength() function which triggers the read_agc_gain_*() functions, where these registered are polled. This isn't a critical thing since when the demod is active again, no more such errors are logged, however this might make users suspecting defects. Fix this by requiring STATE_ACTIVE_* in priv->state. If it isn't in any active state, additionally set the strength scale to NOT_AVAILABLE. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: dvb-frontends/stv0367: split SNR determination into functionsDaniel Scheller2017-06-241-26/+42
| | | | | | | | | The read_snr() functions currently do some magic to return relative scale values when called. Split out register readouts into separate functions so the functionality can be reused in some other way. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: dvb-frontends/stv0367: initial DDB DVBv5 stats, implement ucblocksDaniel Scheller2017-06-241-4/+50
| | | | | | | | | | This adds the basics to stv0367ddb_read_status() to be able to properly provide signal statistics in DVBv5 format. Also adds UCB readout and provides those values. Also, don't return -EINVAL in ddb_read_status() if active_demod_state indicates no delivery system. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: dvb-frontends/lnbh25: improve kernellog outputDaniel Scheller2017-06-241-3/+3
| | | | | | | | | | Use dev_dbg() in conjunction with the %*ph format macro to print the vmon status debug, thus hiding continuous hexdumping from default log levels. Also, change the attach success log line from error to info severity. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Acked-by: Abylay Ospan <aospan@netup.ru> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: dvb-frontends: drx39xyj: remove obsolete sign extend macrosMartin Kepplinger2017-06-241-13/+0Star
| | | | | | | | | DRX_S9TOS16 and DRX_S24TODRXFREQ are simply not used. Furthermore, sign_extend32() should be used for sign extension. (Also, the comment describing DRX_S24TODRXFREQ was wrong). So remove these macros. Signed-off-by: Martin Kepplinger <martink@posteo.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: Replace initalized ->initializedMauro Carvalho Chehab2017-06-241-1/+1
| | | | | | | | While committing a change on em28xx, I got a warning of a typo there. So, fix it on em28xx and on two other media drivers with the same typo. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: dvb-frontends/stv0367: deduplicate DDB dvb_frontend_ops capsDaniel Scheller2017-06-241-8/+5Star
| | | | | Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] af9013: refactor power controlAntti Palosaari2017-06-201-57/+36Star
| | | | | | | | | | Move power-up and power-down functionality to init/sleep ops and get rid of old function. Fixes and simplifies power-up functionality slightly. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] af9013: refactor firmware download routineAntti Palosaari2017-06-201-35/+30Star
| | | | | | | Refactor firmware download routine. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] af9013: remove unneeded register writesAntti Palosaari2017-06-201-42/+0Star
| | | | | | | | Removed register writes are already chip defaults, are not required, are set later or belong to AF9015 USB interface. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] af9013: add configurable TS output pinAntti Palosaari2017-06-202-13/+16
| | | | | | | | | | On serial TS mode output pin could be selected from D0 or D7. Add configuration option to for it. Rename TS mode config option prefix from AF9013_TS_ to AF9013_TS_MODE_. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] af9013: add dvbv5 cnrAntti Palosaari2017-06-201-0/+9
| | | | | | | Add support for DVBv5 CNR. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] af9013: fix error handlingAntti Palosaari2017-06-201-35/+49
| | | | | | | | Use typical (return 0/goto err/return err) error handling everywhere. Add missing error handling where missing. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] af9013: convert to regmap apiAntti Palosaari2017-06-203-306/+294Star
| | | | | | | | | Use regmap for register access. Own low level i2c read and write routines for regmap is still needed because chip uses single command byte in addition to typical i2c register access. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] af9013: fix loggingAntti Palosaari2017-06-201-102/+100Star
| | | | | | | | We can simplify logging as we now have a proper i2c client to pass for kernel dev_* logging functions. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] af9013: use kernel 64-bit divisionAntti Palosaari2017-06-202-31/+4Star
| | | | | | | Replace own binary division with 64-bit multiply and division. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] af9013: add i2c client bindingsAntti Palosaari2017-06-202-164/+241
| | | | | | | | Add kernel i2c driver bindings. That allows dev_* logging, regmap and more. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] af9013: move config values directly under driver stateAntti Palosaari2017-06-201-24/+38
| | | | | | | | | | It shorten, as typed chars, access to config values as there is one pointer less. Also, when config/platform data is passed to driver there could be some values that are not relevant to store state as such or not needed to store at all. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] af9013: add check on af9013_wr_regs() return valueGustavo A. R. Silva2017-06-201-0/+2
| | | | | | | | | | | Check return value from call to af9013_wr_regs(), so in case of error print debug message and return. Addresses-Coverity-ID: 1227035 Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com> Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] dvb-frontends/cxd2841er: improved snr reportingDaniel Scheller2017-06-201-3/+4
| | | | | | | | | | | | | On DVB-T/T2 at least, SNR might be reported as >2500dB, which not only is just wrong but also ridiculous, so fix this by improving the conversion of the register value. The INTLOG10X100 function/macro and the way the values are converted were both taken from DD's cxd2843 driver. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Acked-by: Abylay Ospan <aospan@netup.ru> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] dvb-frontends/cxd2841er: more configurable TSBITSDaniel Scheller2017-06-202-0/+5
| | | | | | | | | | Bits 3 and 4 of the TSCONFIG register are important for certain hardware constellations, in that they need to be zeroed. Add a configuration flag to toggle this. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Acked-by: Abylay Ospan <aospan@netup.ru> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] dvb-frontends/cxd2841er: configurable IFAGCNEGDaniel Scheller2017-06-202-2/+4
| | | | | | | | Adds a flag to enable or disable the IFAGCNEG bit in cxd2841er_init_tc(). Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Acked-by: Abylay Ospan <aospan@netup.ru> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] dvb-frontends/cxd2841er: make lock wait in set_fe_tc() optionalDaniel Scheller2017-06-202-0/+5
| | | | | | | | | | | | | Don't wait for FE_HAS_LOCK in set_frontend_tc() and thus don't hammer the lock status register with inquiries when CXD2841ER_NO_WAIT_LOCK is set in the configuration, which also unneccessarily blocks applications until a TS LOCK has been acquired. Rather, API and applications will check for a TS LOCK by utilising the tune fe_op, read_status and get_frontend ops, which is sufficient. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Acked-by: Abylay Ospan <aospan@netup.ru> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] dvb-frontends/cxd2841er: optionally tune earlier in set_frontend()Daniel Scheller2017-06-202-2/+13
| | | | | | | | | | | | | | | | When AUTO_IFHZ is set and the tuner is supposed to provide proper IF speed values, it should be possible to have the tuner setup take place before the demod is configured, else the demod might be configured with either wrong (old), or even no values at all, which obviously will cause issues. To set this behaviour in the most flexible way, this is done with a separate flag instead of making this depend on AUTO_IFHZ. It should be evaluated if tuning shouldn't take place earlier in all cases and hardware constellations. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Acked-by: Abylay Ospan <aospan@netup.ru> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] dvb-frontends/cxd2841er: make ASCOT use optionalDaniel Scheller2017-06-202-26/+45
| | | | | | | | | | The Sony CXD28xx demods may have other tuner types attached to them (e.g. NXP TDA18212), so don't mandatorily configure and enable the ASCOT functionality, but make this conditional by a config flag. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Acked-by: Abylay Ospan <aospan@netup.ru> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] dvb-frontends/cxd2841er: TS_SERIAL config flagDaniel Scheller2017-06-202-4/+19
| | | | | | | | | Some constellations work/need a serial TS transport mode. This adds a flag that will toggle set up of such mode. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Acked-by: Abylay Ospan <aospan@netup.ru> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] dvb-frontends/cxd2841er: support IF speed calc from tuner valuesDaniel Scheller2017-06-202-18/+47
| | | | | | | | | | | | Add a AUTO_IFHZ flag and a function that will read IF speed values from any attached tuner if the tuner supports this and if AUTO_IFHZ is enabled, and else the passed default value (which probably matches Sony ASCOT tuners) will be passed back. The returned value is then used to calculate the iffeq which the demod will be programmed with. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Acked-by: Abylay Ospan <aospan@netup.ru> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] dvb-frontends/cxd2841er: make call to i2c_gate_ctrl optionalDaniel Scheller2017-06-202-12/+22
| | | | | | | | | | | | | | | | | | | | Some cards/bridges wrap i2c_gate_ctrl handling with a mutex_lock(). This is e.g. done in ddbridge to protect against concurrent tuner access with regards to the dual tuner HW, where concurrent tuner reconfiguration can result in tuning fails or bad reception quality. When the tuner driver additionally tries to open the I2C gate (which e.g. the tda18212 driver does) when the demod already did this, this will lead to a deadlock. This makes the calls to i2c_gatectrl from the demod driver optional when the flag is set, leaving this to the tuner driver. For readability reasons and to not have the check duplicated multiple times, the setup is factored into cxd2841er_tuner_set(). This commit also updates the netup card driver (which seems to be the only consumer of the cxd2841er as of now). Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Acked-by: Abylay Ospan <aospan@netup.ru> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] dvb-frontends/cxd2841er: add variable for configuration flagsDaniel Scheller2017-06-202-0/+3
| | | | | | | | | | | Throughout the patch series some configuration flags will be added to the demod driver. This patch prepares this by adding the flags var to struct cxd2841er_config, which will serve as a bitmask to toggle various options and behaviour in the driver. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Acked-by: Abylay Ospan <aospan@netup.ru> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] dvb-frontends/cxd2841er: replace IFFREQ calc macros into functionsDaniel Scheller2017-06-201-19/+29
| | | | | | | | | | | | The way the MAKE_IFFREQ_CONFIG macros are written make it impossible to pass regular integers for iffreq calculation, since this will cause "SSE register return with SSE disabled" compile errors. This changes the calculation into C functions which also might help when debugging. Also, expand all passed frequencies from MHz to Hz scale. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Acked-by: Abylay Ospan <aospan@netup.ru> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] dvb-frontends/cxd2841er: support CXD2837/38/43ER demods/Chip IDsDaniel Scheller2017-06-202-1/+26
| | | | | | | | | | | | | | Those demods are programmed in the same way as the CXD2841ER/54ER and can be handled by this driver. Support added in a way matching the existing code, supported delivery systems are set according to what each demod supports. Updates the type string setting used for printing the "attaching..." log line aswell. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Acked-by: Abylay Ospan <aospan@netup.ru> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] dvb-frontends/cxd2841er: immediately unfreeze regs when doneDaniel Scheller2017-06-201-13/+10Star
| | | | | | | | | | Do unfreeze_regs() directly when accessing the demod registers is done, and don't have multiple unfreeze's on different conditions, which even can get prone to errors. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Acked-by: Abylay Ospan <aospan@netup.ru> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] dvb-frontends/cxd2841er: do I2C reads in one goDaniel Scheller2017-06-201-11/+2Star
| | | | | | | | | | | | | | | | Doing the I2C read operation with two calls to i2c_transfer() causes the exclusive I2C bus lock of the underlying adapter to be released. While this isn't an issue if only one demodulator is attached to the bus, having two or even more causes troubles in that concurrent accesses to the different demods will cause all kinds of issues due to wrong data being returned on read operations (for example, the TS config register will be set wrong). This changes the read_regs() function to do the operation in one go (by calling i2c_transfer with the whole msg list instead of one by one) to not loose the I2C bus lock, fixing all sorts of random runtime failures. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Acked-by: Abylay Ospan <aospan@netup.ru> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>