summaryrefslogtreecommitdiff
path: root/drivers/media/dvb-frontends/cx24120.c
AgeCommit message (Collapse)Author
2019-05-30treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157Thomas Gleixner
Based on 3 normalized pattern(s): this program is free software you can redistribute it and or modify it under the terms of the gnu general public license as published by the free software foundation either version 2 of the license or at your option any later version this program is distributed in the hope that it will be useful but without any warranty without even the implied warranty of merchantability or fitness for a particular purpose see the gnu general public license for more details this program is free software you can redistribute it and or modify it under the terms of the gnu general public license as published by the free software foundation either version 2 of the license or at your option any later version [author] [kishon] [vijay] [abraham] [i] [kishon]@[ti] [com] this program is distributed in the hope that it will be useful but without any warranty without even the implied warranty of merchantability or fitness for a particular purpose see the gnu general public license for more details this program is free software you can redistribute it and or modify it under the terms of the gnu general public license as published by the free software foundation either version 2 of the license or at your option any later version [author] [graeme] [gregory] [gg]@[slimlogic] [co] [uk] [author] [kishon] [vijay] [abraham] [i] [kishon]@[ti] [com] [based] [on] [twl6030]_[usb] [c] [author] [hema] [hk] [hemahk]@[ti] [com] this program is distributed in the hope that it will be useful but without any warranty without even the implied warranty of merchantability or fitness for a particular purpose see the gnu general public license for more details extracted by the scancode license scanner the SPDX license identifier GPL-2.0-or-later has been chosen to replace the boilerplate/reference in 1105 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Allison Randal <allison@lohutok.net> Reviewed-by: Richard Fontana <rfontana@redhat.com> Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190527070033.202006027@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-02media: dvb: represent min/max/step/tolerance freqs in HzMauro Carvalho Chehab
Right now, satellite frontend drivers specify frequencies in kHz, while terrestrial/cable ones specify in Hz. That's confusing for developers. However, the main problem is that universal frontends capable of handling both satellite and non-satelite delivery systems are appearing. We end by needing to hack the drivers in order to support such hybrid frontends. So, convert everything to specify frontend frequencies in Hz. Tested-by: Katsuhiro Suzuki <suzuki.katsuhiro@socionext.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-05-05media: frontends: fix ops get_algo()'s return typeLuc Van Oostenryck
The method dvb_frontend_ops::get_frontend_algo() is defined as returning an 'enum dvbfe_algo', but the implementation in this driver returns an 'int'. Fix this by returning 'enum dvbfe_algo' on drivers. [mchehab+samsung@kernel.org: merge similar patches and patch ddbridge-mci.c the same way] Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2017-12-28media: move dvb kAPI headers to include/mediaMauro Carvalho Chehab
Except for DVB, all media kAPI headers are at include/media. Move the headers to it. 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-10-24[media] cx24120: do not allow an invalid delivery system typesColin Ian King
cx24120_set_frontend currently allows invalid delivery system types other than SYS_DVBS2 and SYS_DVBS. Fix this by returning -EINVAL for invalid values. Signed-off-by: Colin Ian King <colin.king@canonical.com> Acked-by: Jemma Denson <jdenson@gmail.com>
2016-03-03[media] cx24120: make sure tuner is locked at get_frontendJemma Denson
Change get_frontend to re-check current lock status rather than relying on a cached value from get_status. Removes potential for tuning failure if get_frontend is called during tuning. Probably not too essential as other changes work around this: https://patchwork.linuxtv.org/patch/32845/ Signed-off-by: Jemma Denson <jdenson@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-02-04[media] dvb_frontend: pass the props cache to get_frontend() as argMauro Carvalho Chehab
Instead of using the DTV properties cache directly, pass the get frontend data as an argument. For now, everything should remain the same, but the next patch will prevent get_frontend to affect the global cache. This is needed because several drivers don't care enough to only change the properties if locked. Due to that, calling G_PROPERTY before locking on those drivers will make them to never lock. Ok, those drivers are crap and should never be merged like that, but the core should not rely that the drivers would be doing the right thing. Reviewed-by: Michael Ira Krufky <mkrufky@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.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/*
2015-05-30[media] cx24120: fix sparse warningHans Verkuil
drivers/media/dvb-frontends/cx24120.c:837:6: warning: symbol 'cx24120_calculate_ber_window' was not declared. Should it be static? Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-30[media] cx24120: Assume ucb registers is a counterJemma Denson
The ucblocks register is probably a counter and not a rate; assume it is so and change the calculations as required. Signed-off-by: Jemma Denson <jdenson@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-20[media] cx24120: fix minor checkpatch-errorPatrick Boettcher
Remove multiple blank likes. Signed-off-by: Patrick Boettcher <patrick.boettcher@posteo.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-20[media] cx24120: Update comment & fix typoJemma Denson
These state vars are used for more than just ber calculation, also fix typo. Signed-off-by: Jemma Denson <jdenson@gmail.com> Signed-off-by: Patrick Boettcher <patrick.boettcher@posteo.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-20[media] cx24120: Check for lock before updating BER & UCBJemma Denson
BER & UCB aren't available unless we're locked; don't update dvbv5 stats when not locked and mark these counters as unavailable. Signed-off-by: Jemma Denson <jdenson@gmail.com> Signed-off-by: Patrick Boettcher <patrick.boettcher@posteo.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-20[media] cx24120: Convert ucblocks to dvbv5 statsJemma Denson
DVBv3 is a legacy API. Drivers should use DVBv5, in order to support modern applications. So, implement UCB using dvbv5. Signed-off-by: Jemma Denson <jdenson@gmail.com> Signed-off-by: Patrick Boettcher <patrick.boettcher@posteo.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-20[media] cx24120: Convert read_ber to retrieve from cacheJemma Denson
Instead of reading BER again for DVBv3 call, use the value from the cache. Signed-off-by: Jemma Denson <jdenson@gmail.com> Signed-off-by: Patrick Boettcher <patrick.boettcher@posteo.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-20[media] cx24120: Add in dvbv5 stats for bit error rateJemma Denson
DVBv3 is a legacy API. Drivers should use DVBv5, in order to support modern applications. So, implement BER using dvbv5. Signed-off-by: Jemma Denson <jdenson@gmail.com> Signed-off-by: Patrick Boettcher <patrick.boettcher@posteo.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-20[media] cx24120: constify static dataMauro Carvalho Chehab
Use const on the static data, as gcc may optimize better the code. Also, would prevent that some code would override the data there. Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com> Signed-off-by: Patrick Boettcher <patrick.boettcher@posteo.de>
2015-05-20[media] cx24120: declare cx24120_init() as staticMauro Carvalho Chehab
drivers/media/dvb-frontends/cx24120.c:1182:5: warning: no previous prototype for 'cx24120_init' [-Wmissing-prototypes] int cx24120_init(struct dvb_frontend *fe) ^ Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com> Signed-off-by: Patrick Boettcher <patrick.boettcher@posteo.de>
2015-05-20[media] cx24120: don't initialize a var that won't be usedMauro Carvalho Chehab
As reported by smatch: drivers/media/dvb-frontends/cx24120.c: In function 'cx24120_message_send': drivers/media/dvb-frontends/cx24120.c:368:6: warning: variable 'ret' set but not used [-Wunused-but-set-variable] int ret, ficus; ^ The values written by cx24120 are never checked. So, remove the check here too. That's said, the best would be to do the reverse, but globally: to properly handle the error codes. Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com> Signed-off-by: Patrick Boettcher <patrick.boettcher@posteo.de>
2015-05-19[media] cx24120: Complete modfec_tableJemma Denson
Add in all the likely values for setting fec on tuning. Some values yet to be tested but very likely to be correct. In the very unlikely event that these are wrong tuning with FEC_AUTO will still work. Signed-off-by: Jemma Denson <jdenson@gmail.com> Signed-off-by: Patrick Boettcher <patrick.boettcher@posteo.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-18[media] cx24120: More tidying in cx24120_initJemma Denson
Remove reg1 by refactoring for loops Change ret into an int as it's only used for return values now, and remove reset_result by using ret instead. Signed-off-by: Jemma Denson <jdenson@gmail.com> Signed-off-by: Patrick Boettcher <patrick.boettcher@posteo.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-18[media] cx24120: Tidy cx24120_initJemma Denson
Use reg instead of ret for all calls to readreg, remove ret_EA as it doesn't need to be a separate var anymore. Signed-off-by: Jemma Denson <jdenson@gmail.com> Signed-off-by: Patrick Boettcher <patrick.boettcher@posteo.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-18[media] cx24120: Remove unneccesary assignments in cx24120_initJemma Denson
Probably a remnant of this driver being reverse engineered, cx24120_init assigned ret on each call to writereg - they're not used for anything so remove them to clear up the codebase. Signed-off-by: Jemma Denson <jdenson@gmail.com> Signed-off-by: Patrick Boettcher <patrick.boettcher@posteo.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-18[media] cx24120: Tidy up calls to dev_dbgJemma Denson
Remove __func__ from calls to dev_dbg as dynamic debug can add in the function name anyway. Remove debug call in dvbv3 read_signal_strength as userspace has this value anyway. Reword some strings to make them simpler / more obvious. Signed-off-by: Jemma Denson <jdenson@gmail.com> Signed-off-by: Patrick Boettcher <patrick.boettcher@posteo.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-18[media] cx24120: Move CNR to DVBv5 statsJemma Denson
Better to report CNR via DVBv5 stats, as scale can be used. Signed-off-by: Jemma Denson <jdenson@gmail.com> Signed-off-by: Patrick Boettcher <patrick.boettcher@posteo.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-18[media] cx24120: Fix disecq_send_burst commandJemma Denson
Previous version of this driver had a memset before every call to cmd. This meant the default value of cmd.arg[1] was zero unless burst is set. Make sure it remains zero. Also fe_sec_mini_cmd_t is an enum, so test against it. Signed-off-by: Jemma Denson <jdenson@gmail.com> Signed-off-by: Patrick Boettcher <patrick.boettcher@posteo.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-18[media] cx24120: More coding style fixesJemma Denson
Signed-off-by: Jemma Denson <jdenson@gmail.com> Signed-off-by: Patrick Boettcher <patrick.boettcher@posteo.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-18[media] cx24120: Improve cooked signal strength valueJemma Denson
Algorithm copied from cx24117.c - it seems to work. Showing 95% on a signal I know to be somewhere around 74dBuV. [mchehab@osg.samsung.net: merged two patches, to avoid breaking compilation] Signed-off-by: Jemma Denson <jdenson@gmail.com> Signed-off-by: Patrick Boettcher <patrick.boettcher@posteo.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-18[media] cx24120: Return DVBv3 signal strength from cacheJemma Denson
This patch changes DVBv3 signal strength to read from the cache by moving the signal strength reading routine into get_stat, and reducing read_signal_strength to just returning the cached value. Signed-off-by: Jemma Denson <jdenson@gmail.com> Signed-off-by: Patrick Boettcher <patrick.boettcher@posteo.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-18[media] cx24120: Remove additional calls to read_statusJemma Denson
get_frontend was making a call to read_status, which is being called periodically anyway. Have read_status store fe_status in the state struct instead and use that within get_frontend. Signed-off-by: Jemma Denson <jdenson@gmail.com> Signed-off-by: Patrick Boettcher <patrick.boettcher@posteo.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-18[media] cx24120: Enable DVBv5 signal strength statsJemma Denson
Previous patch added in collection, this patch enables them by signalling they are available. Signed-off-by: Jemma Denson <jdenson@gmail.com> Signed-off-by: Patrick Boettcher <patrick.boettcher@posteo.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-18[media] cx24120: Add DVBv5 signal strength statsJemma Denson
Add new get_stats function, called from read_status, for collecting DVBv5 stats into the frontend cache. Only signal strength for now, can add others later. Not currently marked as available, future patch will enable. Signed-off-by: Jemma Denson <jdenson@gmail.com> Signed-off-by: Patrick Boettcher <patrick.boettcher@posteo.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-18[media] cx24120: Rework vco function to remove xxyyzz variableJemma Denson
Change calculate_vco function to send_vco to tidy up cx24120_init function. xxyyzz variable is remnants of a manual div & remainder codepath to perform a u64 rounded div; replace with kernel macro DIV_ROUND_CLOSEST_ULL Hex values provided to the message are mainly variables calculated within this function, replace with these to remove hardcoding. Signed-off-by: Jemma Denson <jdenson@gmail.com> Signed-off-by: Patrick Boettcher <patrick.boettcher@posteo.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-18[media] cx24120: Fix hexdump length in writeregsJemma Denson
msg.len has been ++'d so msg.len is one too many. Signed-off-by: Jemma Denson <jdenson@gmail.com> Signed-off-by: Patrick Boettcher <patrick.boettcher@posteo.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-18[media] cx24120: Add missing command to cx24120_check_cmdJemma Denson
This patch adds in a missing command to cx24120_check_cmd. This part of the old reverse engineered driver was quite hard to follow - it's presumed the compiler did some neat optimisation that wasn't easy to decode. This command was checked for in that version but not copied across to the new switch statement. For reference, old reverse engineered code: xxzz = cmd->id - 0x11; // look for specific message id if ( xxzz <= 0x13 ) { msg_cmd_mask = 1 << xxzz; //0x0F8021 // if cmd_id 17 or 22 or 33-36, 42, 47, 57-61 etc. disable mpeg output if ( msg_cmd_mask & 0x0F8021 ) { // 000011111000000000100001b cx24120_msg_mpeg_output_global_config(state, 0); msleep(100); state->dvb_s2_mode &= 0xFD; // reset mpeg out enable flag } } Signed-off-by: Jemma Denson <jdenson@gmail.com> Signed-off-by: Patrick Boettcher <patrick.boettcher@posteo.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-18[media] cx24120: Move clock set to read_statusJemma Denson
This patch removes the requirement of waiting for tune in set_frontend by moving the clock set call into read_status Signed-off-by: Jemma Denson <jdenson@gmail.com> Signed-off-by: Patrick Boettcher <patrick.boettcher@posteo.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-18[media] cx24120: fix strict checkpatch-errorsPatrick Boettcher
This patches fixes all checkpatch-errors. Even the ones created --strict. Signed-off-by: Patrick Boettcher <patrick.boettcher@posteo.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-18[media] cx24120: fix codingstyle issue first roundPatrick Boettcher
Mauro pointed out some coding style issues in his review. This patch fixes them. Signed-off-by: Patrick Boettcher <patrick.boettcher@posteo.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-18[media] cx24120: i2c-max-write-size is now configurablePatrick Boettcher
Some i2c-hosts are quite limited regarding maximum i2c-burst-write-sizes. This patch makes the previously hardcoded field configurable by users of the driver. Signed-off-by: Patrick Boettcher <patrick.boettcher@posteo.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-18[media] cx24120: minor checkpatch fixesPatrick Boettcher
This patch fixes printk-related checkpatch warnings. All printks have been converted to pr_warn or pr_info or pr_err. Signed-off-by: Patrick.Boettcher <patrick.boettcher@posteo.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2015-05-18[media] Add support for TechniSat Skystar S2Jemma Denson
This patch adds support for the Technisat Skystar S2 - this has been tried before but the cx24120 driver was a bit out of shape and it didn't got any further: https://patchwork.linuxtv.org/patch/10575/ It is an old card, but currently being sold off for next to nothing, so it's proving quite popular of late. Noticing it's quite similar to the cx24116 and cx24117 I've rewritten the driver in a similar way. There were a few registers and commands from those drivers missing from this one I've tested out and found they do something so they've been added in to speed up tuning and to make get_frontend return something useful. Signed-off-by: Jemma Denson <jdenson@gmail.com> Signed-off-by: Patrick.Boettcher <patrick.boettcher@posteo.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>