aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/pci/ddbridge (follow)
AgeCommit message (Collapse)AuthorFilesLines
2019-05-18media: prefix header search paths with $(srctree)/Masahiro Yamada1-2/+2
Currently, the Kbuild core manipulates header search paths in a crazy way [1]. To fix this mess, I want all Makefiles to add explicit $(srctree)/ to the search paths in the srctree. Some Makefiles are already written in that way, but not all. The goal of this work is to make the notation consistent, and finally get rid of the gross hacks. Having whitespaces after -I does not matter since commit 48f6e3cf5bc6 ("kbuild: do not drop -I without parameter"). [1]: https://patchwork.kernel.org/patch/9632347/ Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>
2019-03-20media: Kconfig files: use the right help coding styleMauro Carvalho Chehab1-2/+2
Checkpatch wants to use 'help' instead of '---help---': WARNING: prefer 'help' over '---help---' for new help texts Let's change it globally at the media subsystem, as otherwise people would keep using the old way. Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-12-20media: ddbridge: Move asm includes after linux onesNathan Chancellor1-3/+3
Without this, cpumask_t and bool are not defined: In file included from drivers/media/pci/ddbridge/ddbridge-ci.c:19: In file included from drivers/media/pci/ddbridge/ddbridge.h:22: ./arch/arm/include/asm/irq.h:35:50: error: unknown type name 'cpumask_t' extern void arch_trigger_cpumask_backtrace(const cpumask_t *mask, ^ ./arch/arm/include/asm/irq.h:36:9: error: unknown type name 'bool' bool exclude_self); ^ Doing a survey of the kernel tree, this appears to be expected because '#include <asm/irq.h>' is always after the linux includes. This also fixes warnings of this variety (with Clang): In file included from drivers/media/pci/ddbridge/ddbridge-ci.c:19: In file included from drivers/media/pci/ddbridge/ddbridge.h:56: In file included from ./include/media/dvb_net.h:22: In file included from ./include/linux/netdevice.h:50: In file included from ./include/uapi/linux/neighbour.h:6: In file included from ./include/linux/netlink.h:9: In file included from ./include/net/scm.h:11: In file included from ./include/linux/sched/signal.h:6: ./include/linux/signal.h:87:11: warning: array index 3 is past the end of the array (which contains 2 elements) [-Warray-bounds] return (set->sig[3] | set->sig[2] | ^ ~ ./arch/arm/include/asm/signal.h:17:2: note: array 'sig' declared here unsigned long sig[_NSIG_WORDS]; ^ Fixes: b6973637c4cc ("media: ddbridge: remove another duplicate of io.h and sort includes") Signed-off-by: Nathan Chancellor <natechancellor@gmail.com> Tested-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-12-05media: ddbridge: remove another duplicate of io.h and sort includesMauro Carvalho Chehab1-27/+25
The io.h was still included twice. Having a large number of includes like that unsorted is likely the reason why we ended by having 3 includes of io.h and two includes of interrupt.h at the first place. So, let's reorder the includes on alphabetic order. That would make easier to maintain it. Fixes: 12645e0655e4 ("media: ddbridge: remove some duplicated include file") Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-12-05media: ddbridge: remove some duplicated include filezhong jiang1-2/+0
interrupt.h and io.h have duplicated include. hence just remove redundant file. Signed-off-by: zhong jiang <zhongjiang@huawei.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-09-12media: ddbridge/sx8: remove redundant check of iq_mode == 2Colin Ian King1-3/+1
The check for irq_mode == 2 occurs is always false and hence flags is always zero. This is because the check occurs in a path where irq_mode is >= 3. Clean up the code by removing the check and irq_mode and just pass 0. Detected by CoverityScan, CID#1472214 ("Logically dead code") Signed-off-by: Colin Ian King <colin.king@canonical.com> Cc: Ralph Metzler <rjkm@metzlerbros.de> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-09-12media: ddbridge: header/boilerplate cleanups and cosmeticsDaniel Scheller13-28/+1
Cleanup blank lines, remove wrong links to http://www.gnu.org/copyleft/gpl.html (the driver is licensed under the terms of GPLv2, but the link points to a copy of the GPLv3), and fix the filename reference in ddbridge-i2c.h. [mchehab@kernel.org: removed whitespace changes at the licensing text, as we didn't get any acks from the authors with regards to changing the text] Cc: Ralph Metzler <rjkm@metzlerbros.de> Cc: Manfred Voelkel <mvoelkel@DigitalDevices.de> Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-09-12media: ddbridge: add SPDX license identifiersDaniel Scheller13-0/+13
Since the boilerplates and MODULE_LICENSE are now in sync regarding the used license (GPL v2 only), add a matching GPLv2 SPDX license identifier to all files of the ddbridge driver. Cc: Ralph Metzler <rjkm@metzlerbros.de> Cc: Manfred Voelkel <mvoelkel@DigitalDevices.de> Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-09-12media: mxl5xx/stv0910/stv6111/ddbridge: fix MODULE_LICENSE to 'GPL v2'Daniel Scheller1-1/+1
In commit 3db30defab4b ("use correct MODULE_LINCESE for GPL v2 only according to notice in header") in the upstream repository for the mentioned four drivers at https://github.com/DigitalDevices/dddvb.git (plus a few more which aren't part of the mainline kernel tree), the MODULE_LICENSE was fixed to "GPL v2" and are now in sync with the GPL copyright boilerplate. Apply this change to the kernel tree drivers as well. Cc: Ralph Metzler <rjkm@metzlerbros.de> Cc: Manfred Voelkel <mvoelkel@DigitalDevices.de> Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-08-02media: dvb: represent min/max/step/tolerance freqs in HzMauro Carvalho Chehab1-4/+2
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-07-30media: ddbridge/mci: add SX8 I/Q mode remark and remove DIAG CMD definesDaniel Scheller1-8/+16
Take note that the SX8 IQ mode is only available on a single tuner, and remove the MCI/SX8 DIAG CMD defines. Picked up from the upstream dddvb GIT. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-07-30media: ddbridge/sx8: enable modulation selection in set_parameters()Daniel Scheller1-7/+23
Allow for tuning to transponders with specific modulations in set_parameters(). Setting a specific modulation will also enable lower modulations. Picked up from the upstream dddvb GIT. Upstream also has support for APSK64/128/256 modulations which aren't supported yet by the DVB API, so comment them out until support for them is added. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-07-30media: ddbridge/sx8: disable automatic PLS code searchDaniel Scheller1-1/+1
The SX8 cards by default do an automatic search for the PLS code. This is not necessarily wanted as this can eventually be detected wrong, so disable this. Picked up from the upstream dddvb GIT. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-07-30media: ddbridge/mci: add more MCI status codes, improve MCI_SUCCESS macroDaniel Scheller1-2/+6
The MCI can report the command status more finegrained, so, add more status code defines and update the MCI_SUCCESS macro. Picked up from the upstream dddvb GIT. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-07-30media: ddbridge/mci: split MaxSX8 specific code off to ddbridge-sx8.cDaniel Scheller7-419/+516
Split off all code specific to the MaxSX8 cards to a separate ddbridge-sx8 module and hook it up in the Makefile. This also adds evaluation of the mci_type to allow for using different attach handling for different cards. As different cards can implement things differently (ie. support differing frontend_ops, and have different base structs being put ontop of the common mci_base struct), this introduces the mci_cfg struct which is initially used to hold a few specifics to the -sx8 submodule. While at it, the handling of the i/q mode is adjusted slightly. Besides this and handling mci_base and sx8_base struct pointers where needed, all code is copied unmodified from ddbridge-mci.c. Picked up from the upstream dddvb GIT. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-07-30media: ddbridge/mci: make ddb_mci_cmd() and ddb_mci_config() publicDaniel Scheller2-47/+51
In preparation for splitting all MaxSX8 related code parts from the common MCI code, prefix both mci_cmd() and mci_config() functions with ddb_, remove the static marking and add matching function prototypes to ddbridge-mci.h so these functions can be reused from other files within the ddbridge driver. As this requires the mci-related structs to be defined in ddbridge-mci.h, move struct mci and struct mci_base there and clean them up. Picked up from the upstream dddvb GIT. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-07-30media: ddbridge/mci: store mci type and number of ports in the hwinfoDaniel Scheller3-6/+10
For better support for future MCI based cards, rename the mci struct member to mci_ports to carry the number of ports on the cards, and add a mci_type member to identify the card type to handle differing hardware. Picked up from the upstream dddvb GIT. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-07-30media: ddbridge/mci: extend mci_command and mci_result structsDaniel Scheller1-8/+66
Recent FPGA firmware reports more data and values in sent command responses. Adjust the mci_command and mci_result structs including it's unions to match these changes and add a few comments explaining things. Picked up from the upstream dddvb GIT. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-07-30media: ddbridge/mci: rename defines and fix i/q var typesDaniel Scheller2-29/+29
Adjustments to match the FPGA firmware, and the signal I/Q values are reported as s16 types from the card firmware. Picked up from the upstream dddvb GIT. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-07-30media: ddbridge/mci: read and report signal strength and SNRDaniel Scheller1-1/+46
Implement querying signal statistics from the MCI and report this data in read_status() as DVBv5 statistics. Picked up from the upstream dddvb GIT. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-07-30media: ddbridge/mci: update copyright year in headersDaniel Scheller2-6/+6
Update the copyright year information in the MCI headers to 2017-2018. Picked up from the upstream dddvb GIT. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-07-30media: ddbridge: change MCI base ID and define a SX8 IDDaniel Scheller2-3/+5
Change the start of the MCI ID range (internally used only) to 48 and define an ID for the SX8 card type. Use this new ID to handle device attachment. This change is done in preparation for support of more MCI based cards. Picked up from the upstream dddvb GIT. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-07-30media: ddbridge: link structure access cosmetics in ddb_port_probe()Daniel Scheller1-8/+9
Throughout the function, dev->link[l] is used several times. Unclutter this a bit by declaring a ddb_link var at the top of the function, assign the address of dev->link[l] to it and use that var to access the link[] struct member. Picked up from the upstream dddvb GIT. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-07-30media: ddbridge: remove unused MDIO defines and hwinfo memberDaniel Scheller2-9/+0
ddbridge has a few MDIO related remainders (defines, hwinfo struct) which aren't of any use for the in-kernel driver at all (they're only used in conjunction with the OctoNet SAT>IP boxes which the kernel driver doesn't have any support for), so clean this up. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-07-30media: ddbridge: report I2C bus errorsDaniel Scheller1-1/+4
The I2C_COMMAND response reports an error in the I2C bus communication using bit 17. Evaluate the response more thoroughly and log an error if an I2C problem was detected. Picked up from the upstream dddvb GIT. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-07-30media: ddbridge: evaluate the actual link when setting up the dummy tunerDaniel Scheller1-1/+1
Devices supporting dummy tuner operation can exist on any link, not only on link 0, so fix this accordingly. Picked up from the upstream dddvb GIT. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-07-30media: ddbridge: probe for LNBH25 chips before attachingDaniel Scheller1-7/+15
In demod_attach_stv0910(), the LNBH25 IC is being blindly attached and, if the result is bad, blindly attached on another possible I2C address. The LNBH25 uses it's set_voltage function to test for the IC and will print an error to the kernel log on failure. Prevent this by probing the possible I2C address and use this (and only this) to attach the LNBH25 I2C driver. This also allows the stv0910 attach function to be a bit cleaner. Picked up from the upstream dddvb GIT and adapted for the LNBH25 driver variant from the kernel tree. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-05-28media: ddbridge: conditionally enable fast TS for stv0910-equipped bridgesDaniel Scheller1-5/+29
CineS2 V7(A) and Octopus CI S2 Pro/Advanced cards support faster TS speeds on the card's contained stv0910 demodulator when their FPGA was updated with a recent (>= 1.7, version number applies to all mentioned cards) vendor firmware. Enable this faster TS speed on card port 0 (contained demod) and parallel stv0910 connections when the card firmware is at least 1.7 or later. Note: The mentioned cards and their demods are handled via the STV0910_PR and STV0910_P tuner types. DuoFlex modules with such demodulators are handled via the STV0910 (without suffix) types where such TS speed increase doesn't technically make sense. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Tested-by: Richard Scobie <rascobie@slingshot.co.nz> Tested-by: Helmut Auer <post@helmutauer.de> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-05-28media: dvb-frontends/stv0910: make TS speed configurableDaniel Scheller1-0/+1
Add a tsspeed config option to struct stv0910_cfg which can be used by users of the driver to set the (parallel) TS speed (higher speeds enable support for higher bitrate transponders). If tsspeed isn't set in the config, it'll default to a sane value. This commit also updates the two consumers of the stv0910 driver (ngene and ddbridge) to have a default tsspeed in their stv0910_cfg templates. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Tested-by: Richard Scobie <rascobie@slingshot.co.nz> Tested-by: Helmut Auer <post@helmutauer.de> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-05-28media: ddbridge/mci: add identifiers to function definition argumentsDaniel Scheller2-2/+2
Fixes two checkpatch warnings WARNING: function definition argument 'xxx' should also have an identifier name in the ddb_mci_attach() prototype definition. checkpatch keeps complaining on the "int (**fn_set_input)" as it seems to have issues with the ptr-to-ptr, though this probably needs fixing in checkpatch. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-05-28media: ddbridge/mci: protect against out-of-bounds array access in stop()Daniel Scheller2-10/+15
In stop(), an (unlikely) out-of-bounds write error can occur when setting the demod_in_use element indexed by state->demod to zero, as state->demod isn't checked for being in the range of the array size of demod_in_use, and state->demod maybe carrying the magic 0xff (demod unused) value. Prevent this by checking state->demod not exceeding the array size before setting the element value. To make the code a bit easier to read, replace the magic value and the number of array elements with defines, and use them at a few more places. Detected by CoverityScan, CID#1468550 ("Out-of-bounds write") Thanks to Colin for reporting the problem and providing an initial patch. Fixes: daeeb1319e6f ("media: ddbridge: initial support for MCI-based MaxSX8 cards") Reported-by: Colin Ian King <colin.king@canonical.com> Cc: Ralph Metzler <rjkm@metzlerbros.de> Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-05-05media: frontends: fix ops get_algo()'s return typeLuc Van Oostenryck1-1/+1
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>
2018-05-04media: ddbridge, cxd2099: include guard, fix unneeded NULL init, stringsDaniel Scheller2-1/+5
Three really tiny minors in this single commit which all on their own would just clutter up the commit history unnecessarily: * ddbridge-regs.h is lacking an include guard. Add it. * Fix an unnecessary NULL initialisation in ddbridge-ci. The declaration of the ci struct ptr is immediately followed by kzalloc(). * Clarify that the CXD2099AR is a Sony device in the cxd2099 driver at a few places including Kconfig. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Acked-by: Jasmin Jessich <jasmin@anw.at> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-05-04media: ddbridge: set driver version to 0.9.33-integratedDaniel Scheller1-1/+1
Set DDBRIDGE_VERSION in ddbridge.h to 0.9.33-integrated to reflect the updated driver. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-05-04media: ddbridge: recognize and attach the MaxSX8 cardsDaniel Scheller1-0/+15
Add needed logic into dvb_input_attach(), ddb_port_probe() and ddb_ports_init() to initialize and support these new cards. Picked up from the upstream dddvb-0.9.33 release. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-05-04media: ddbridge: add hardware defs and PCI IDs for MCI cardsDaniel Scheller3-4/+19
Add PCI IDs and ddb_info for the new MCI-based MaxSX8 cards. Also add needed defines so the cards can be hooked up into ddbridge's probe and attach handling. Picked up from the upstream dddvb-0.9.33 release. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-05-04media: ddbridge/max: implement MCI/MaxSX8 attach functionDaniel Scheller2-0/+43
Implement frontend attachment as ddb_fe_attach_mci() into the ddbridge-max module. The MaxSX8 MCI cards are part of the Max card series and make use of the LNB controller driven by the already existing lnb functionality, so here's where this code belongs to. Picked up from the upstream dddvb-0.9.33 release. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-05-04media: ddbridge: initial support for MCI-based MaxSX8 cardsDaniel Scheller3-1/+703
This adds initial support for the new MCI-based (micro-code interface) DD cards, with the first one being the MaxSX8 eight-tuner DVB-S/S2/S2X PCIe card. The MCI is basically a generalized interface implemented in the card's FPGA firmware and usable for all kind of cards, without the need to implement any demod/tuner drivers as this interface "hides" any I2C interface to the actual ICs, in other words any required driver is implemented in the card firmware. At this stage, the MCI interface is quite rudimentary with things like signal statistics reporting missing, but is already working to serve DVB streams to DVB applications. Missing functionality will be enabled over time. This implements only the ddbridge-mci sub-object and hooks it up to the Makefile so the object gets build. The upcoming commits hook this module into all other ddbridge parts where required, including device IDs etc. Picked up from the upstream dddvb-0.9.33 release. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-05-04media: ddbridge: support dummy tuners with 125MByte/s dummy data streamDaniel Scheller3-0/+38
The Octopus V3 and Octopus Mini devices support set up of a dummy tuner mode on port 0 that will deliver a continuous data stream of 125MBytes per second while raising IRQs and filling the DMA buffers, which comes handy for some stress, PCIe link and IRQ handling testing. The dummy frontend is registered using dvb_dummy_fe's QAM dummy frontend. Set ddbridge.dummy_tuner to 1 to enable this on the supported cards. Picked up from the upstream dddvb-0.9.33 release. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-05-04media: ddbridge: make DMA buffer count and size modparam-configurableDaniel Scheller2-18/+24
Make the number of DMA buffers and their size configurable using module parameters. Being able to set these to a higher number might help on busy systems when handling overall high data rates without having to edit the driver sources and recompile things. Picked up from the upstream dddvb-0.9.33 release. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-05-04media: ddbridge: set devid entry for link 0Daniel Scheller1-0/+1
Currently, /sys/class/ddbridgeX/devid always reports 0 due to devid not being set at all. Set the devid field alongside while storing all other hardware ID data. Picked up from the upstream dddvb-0.9.33 release. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-05-04media: ddbridge: fix output buffer checkDaniel Scheller1-2/+2
A 188 byte gap has to be left between the writer and the consumer. This requires 2*188 bytes available to be able to write to the output buffers. So, change ddb_output_free() to report free bytes according to this rule. Picked up from the upstream dddvb-0.9.33 release. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-05-04media: ddbridge: use spin_lock_irqsave() in output_work()Daniel Scheller1-6/+6
Make sure to save IRQ states before taking the dma lock, as already done in it's input_work() counterpart. Picked up from the upstream dddvb-0.9.33 release. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-05-04media: ddbridge: improve separated MSI IRQ handlingDaniel Scheller1-10/+12
Improve IRQ handling in the separated MSG/I2C and IO/TSDATA handlers by applying a mask for recognized bits immediately upon reading the IRQ mask from the hardware, so only the bits/IRQs that actually were set will be acked. Picked up from the upstream dddvb-0.9.33 release. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-05-04media: ddbridge: add macros to handle IRQs in nibble and byte blocksDaniel Scheller1-40/+27
Currently, each IRQ requires one IRQ_HANDLE() line to call each IRQ handler that was set up. Add a IRQ_HANDLE_NIBBLE() and IRQ_HANDLE_BYTE() macro to call all handlers in blocks of four (_NIBBLE) or eight (_BYTE) handlers at a time, to make this construct more compact. Picked up from the upstream dddvb-0.9.33 release. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-05-04media: ddbridge: add helper for IRQ handler setupDaniel Scheller3-28/+41
Introduce the ddb_irq_set() helper function (along with a matching prototype in ddbridge.h) to improve the set up of the IRQ handlers and handler_data, and rework storing this data into the ddb_link using a new ddb_irq struct. This also does the necessary rework of affected variables. And while at it, always do queue_work in input_handler() as there's not much of a difference to directly calling input_work if there's no ptr at input->redi, or queueing this call. Picked up from the upstream dddvb-0.9.33 release. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-05-04media: ddbridge: request/free_irq using pci_irq_vector, enable MSI-XDaniel Scheller1-10/+14
Instead of trying to manage IRQ numbers on itself, utilise the pci_irq_vector() function to do this, which will take care of correct IRQ numbering for MSI and non-MSI IRQs. While at it, request and enable MSI-X interrupts for hardware (boards and cards) that support this. Picked up from the upstream dddvb-0.9.33 release. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-05-04media: ddbridge: move MSI IRQ cleanup to a helper functionDaniel Scheller1-6/+10
Introduce the ddb_msi_exit() helper to be used for cleaning up previously allocated MSI IRQ vectors. Deduplicates code and makes things look cleaner as for all cleanup work the CONFIG_PCI_MSI ifdeffery is only needed in the helper now. Also, replace the call to the deprecated pci_disable_msi() function with pci_free_irq_vectors(). Picked up from the upstream dddvb-0.9.33 release. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-05-04media: ddbridge: move ddb_wq and the wq+class initialisation to -coreDaniel Scheller3-22/+38
Move the ddbridge module initialisation and cleanup code to ddbridge-core and set up the ddb_wq workqueue there, and create and destroy the ddb device class there aswell. Due to this, the prototypes for ddb_wq, ddb_class_create() and ddb_class_destroy() aren't required in ddbridge.h anymore, so remove them. Also, declare ddb_wq and the ddb_class_*() functions static. Picked up from the upstream dddvb-0.9.33 release. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-05-04media: ddbridge: move modparams to ddbridge-core.cDaniel Scheller3-34/+28
Besides the 'msi' module option, all options are used from within ddbridge-core only, so move them over from ddbridge-main, and declare the associated variables static. Since the prototypes in ddbridge.h aren't necessary anymore now, remove them. As a side effect, this has the benefit of aligning things more with the dddvb upstream. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>