summaryrefslogtreecommitdiffstats
path: root/drivers/media/pci/ddbridge
Commit message (Collapse)AuthorAgeFilesLines
* Merge tag 'media/v4.15-1' of ↵Linus Torvalds2017-11-161-2/+2
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media Pull media updates from Mauro Carvalho Chehab: - Documentation for digital TV (both kAPI and uAPI) are now in sync with the implementation (except for legacy/deprecated ioctls). This is a major step, as there were always a gap there - New sensor driver: imx274 - New cec driver: cec-gpio - New platform driver for rockship rga and tegra CEC - New RC driver: tango-ir - Several cleanups at atomisp driver - Core improvements for RC, CEC, V4L2 async probing support and DVB - Lots of drivers cleanup, fixes and improvements. * tag 'media/v4.15-1' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (332 commits) dvb_frontend: don't use-after-free the frontend struct media: dib0700: fix invalid dvb_detach argument media: v4l2-ctrls: Don't validate BITMASK twice media: s5p-mfc: fix lockdep warning media: dvb-core: always call invoke_release() in fe_free() media: usb: dvb-usb-v2: dvb_usb_core: remove redundant code in dvb_usb_fe_sleep media: au0828: make const array addr_list static media: cx88: make const arrays default_addr_list and pvr2000_addr_list static media: drxd: make const array fastIncrDecLUT static media: usb: fix spelling mistake: "synchronuously" -> "synchronously" media: ddbridge: fix build warnings media: av7110: avoid 2038 overflow in debug print media: Don't do DMA on stack for firmware upload in the AS102 driver media: v4l: async: fix unregister for implicitly registered sub-device notifiers media: v4l: async: fix return of unitialized variable ret media: imx274: fix missing return assignment from call to imx274_mode_regs media: camss-vfe: always initialize reg at vfe_set_xbar_cfg() media: atomisp: make function calls cleaner media: atomisp: get rid of storage_class.h media: atomisp: get rid of wrong stddef.h include ...
| * media: ddbridge: fix build warningsRandy Dunlap2017-11-071-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | Fix 2 build warnings. These functions are void, so drop the "return"s. ./drivers/media/pci/ddbridge/ddbridge-io.h: warning: 'return' with a value, in function returning void [enabled by default]: => 50:2, 55:2 Signed-off-by: Randy Dunlap <rdunlap@infradead.org> Reported-by: Geert Uytterhoeven <geert@linux-m68k.org> Cc: Daniel Scheller <d.scheller.oss@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* | License cleanup: add SPDX GPL-2.0 license identifier to files with no licenseGreg Kroah-Hartman2017-11-021-0/+1
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Many source files in the tree are missing licensing information, which makes it harder for compliance tools to determine the correct license. By default all files without license information are under the default license of the kernel, which is GPL version 2. Update the files which contain no license information with the 'GPL-2.0' SPDX license identifier. The SPDX identifier is a legally binding shorthand, which can be used instead of the full boiler plate text. This patch is based on work done by Thomas Gleixner and Kate Stewart and Philippe Ombredanne. How this work was done: Patches were generated and checked against linux-4.14-rc6 for a subset of the use cases: - file had no licensing information it it. - file was a */uapi/* one with no licensing information in it, - file was a */uapi/* one with existing licensing information, Further patches will be generated in subsequent months to fix up cases where non-standard license headers were used, and references to license had to be inferred by heuristics based on keywords. The analysis to determine which SPDX License Identifier to be applied to a file was done in a spreadsheet of side by side results from of the output of two independent scanners (ScanCode & Windriver) producing SPDX tag:value files created by Philippe Ombredanne. Philippe prepared the base worksheet, and did an initial spot review of a few 1000 files. The 4.13 kernel was the starting point of the analysis with 60,537 files assessed. Kate Stewart did a file by file comparison of the scanner results in the spreadsheet to determine which SPDX license identifier(s) to be applied to the file. She confirmed any determination that was not immediately clear with lawyers working with the Linux Foundation. Criteria used to select files for SPDX license identifier tagging was: - Files considered eligible had to be source code files. - Make and config files were included as candidates if they contained >5 lines of source - File already had some variant of a license header in it (even if <5 lines). All documentation files were explicitly excluded. The following heuristics were used to determine which SPDX license identifiers to apply. - when both scanners couldn't find any license traces, file was considered to have no license information in it, and the top level COPYING file license applied. For non */uapi/* files that summary was: SPDX license identifier # files ---------------------------------------------------|------- GPL-2.0 11139 and resulted in the first patch in this series. If that file was a */uapi/* path one, it was "GPL-2.0 WITH Linux-syscall-note" otherwise it was "GPL-2.0". Results of that was: SPDX license identifier # files ---------------------------------------------------|------- GPL-2.0 WITH Linux-syscall-note 930 and resulted in the second patch in this series. - if a file had some form of licensing information in it, and was one of the */uapi/* ones, it was denoted with the Linux-syscall-note if any GPL family license was found in the file or had no licensing in it (per prior point). Results summary: SPDX license identifier # files ---------------------------------------------------|------ GPL-2.0 WITH Linux-syscall-note 270 GPL-2.0+ WITH Linux-syscall-note 169 ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) 21 ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) 17 LGPL-2.1+ WITH Linux-syscall-note 15 GPL-1.0+ WITH Linux-syscall-note 14 ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) 5 LGPL-2.0+ WITH Linux-syscall-note 4 LGPL-2.1 WITH Linux-syscall-note 3 ((GPL-2.0 WITH Linux-syscall-note) OR MIT) 3 ((GPL-2.0 WITH Linux-syscall-note) AND MIT) 1 and that resulted in the third patch in this series. - when the two scanners agreed on the detected license(s), that became the concluded license(s). - when there was disagreement between the two scanners (one detected a license but the other didn't, or they both detected different licenses) a manual inspection of the file occurred. - In most cases a manual inspection of the information in the file resulted in a clear resolution of the license that should apply (and which scanner probably needed to revisit its heuristics). - When it was not immediately clear, the license identifier was confirmed with lawyers working with the Linux Foundation. - If there was any question as to the appropriate license identifier, the file was flagged for further research and to be revisited later in time. In total, over 70 hours of logged manual review was done on the spreadsheet to determine the SPDX license identifiers to apply to the source files by Kate, Philippe, Thomas and, in some cases, confirmation by lawyers working with the Linux Foundation. Kate also obtained a third independent scan of the 4.13 code base from FOSSology, and compared selected files where the other two scanners disagreed against that SPDX file, to see if there was new insights. The Windriver scanner is based on an older version of FOSSology in part, so they are related. Thomas did random spot checks in about 500 files from the spreadsheets for the uapi headers and agreed with SPDX license identifier in the files he inspected. For the non-uapi files Thomas did random spot checks in about 15000 files. In initial set of patches against 4.14-rc6, 3 files were found to have copy/paste license identifier errors, and have been fixed to reflect the correct identifier. Additionally Philippe spent 10 hours this week doing a detailed manual inspection and review of the 12,461 patched files from the initial patch version early this week with: - a full scancode scan run, collecting the matched texts, detected license ids and scores - reviewing anything where there was a license detected (about 500+ files) to ensure that the applied SPDX license was correct - reviewing anything where there was no detection but the patch license was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied SPDX license was correct This produced a worksheet with 20 files needing minor correction. This worksheet was then exported into 3 different .csv files for the different types of files to be modified. These .csv files were then reviewed by Greg. Thomas wrote a script to parse the csv files and add the proper SPDX tag to the file, in the format that the file expected. This script was further refined by Greg based on the output to detect more types of files automatically and to distinguish between header and source .c files (which need different comment types.) Finally Greg ran the script using the .csv files to generate the patches. Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org> Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com> Reviewed-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* media: ddbridge: fix sparse warningsDaniel Scheller2017-08-272-19/+19
| | | | | | | | | | | | | | | Fix several drivers/media/pci/ddbridge/ddbridge-core.c: warning: symbol ... was not declared. Should it be static? drivers/media/pci/ddbridge/ddbridge-core.c: warning: Using plain integer as NULL pointer drivers/media/pci/ddbridge/ddbridge-io.h: warning: cast removes address space of expression drivers/media/pci/ddbridge/ddbridge-io.h: warning: incorrect type in argument 1 (different address spaces) at multiple places. Cc: Ralph Metzler <rjkm@metzlerbros.de> Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: ddbridge: fix teardown/deregistration order in ddb_input_detach()Daniel Scheller2017-08-271-5/+6
| | | | | | | | | | | | | | | | | | | | | | Brought to attention by Matthias Schwarzott <zzam@gentoo.org> by fixing possible use-after-free faults in some demod drivers: In ddb_input_detach(), the i2c_client is unregistered and removed before dvb frontends are unregistered and detached. While no use-after-free issue was observed so far, there is another issue with this: dvb->attached keeps track of the state of the input/output registration, and the i2c_client unregistration takes place only if everything was successful (dvb->attached == 0x31). If for some reason an error occurred during the frontend setup, that value stays at 0x20. In the following error handling and cleanup, ddb_input_detach() will skip down to that state, leaving the i2c_client registered, causing refcount issues. Fix this by moving the i2c_client deregistration down to case 0x20. Cc: Matthias Schwarzott <zzam@gentoo.org> Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: ddbridge: fix semicolon.cocci warningsFengguang Wu2017-08-201-2/+2
| | | | | | | | | | | | | | | drivers/media/pci/ddbridge/ddbridge-maxs8.c:145:2-3: Unneeded semicolon drivers/media/pci/ddbridge/ddbridge-maxs8.c:173:2-3: Unneeded semicolon Remove unneeded semicolon. Generated by: scripts/coccinelle/misc/semicolon.cocci Fixes: a43dbe430fb4 ("media: ddbridge: support MaxLinear MXL5xx based cards (MaxS4/8)") CC: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Fengguang Wu <fengguang.wu@intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: ddbridge: get rid of fall though gcc 7.1 warningsMauro Carvalho Chehab2017-08-201-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | drivers/media/pci/ddbridge/ddbridge-core.c: In function 'ddb_port_attach': drivers/media/pci/ddbridge/ddbridge-core.c:2261:6: warning: this statement may fall through [-Wimplicit-fallthrough=] if (ret < 0) ^ drivers/media/pci/ddbridge/ddbridge-core.c:2263:2: note: here case DDB_PORT_LOOP: ^~~~ drivers/media/pci/ddbridge/ddbridge-core.c: In function 'dvb_input_attach': drivers/media/pci/ddbridge/ddbridge-core.c:1492:6: warning: this statement may fall through [-Wimplicit-fallthrough=] if (input->port->dev->link[input->port->lnr].info->ts_quirks & ^ drivers/media/pci/ddbridge/ddbridge-core.c:1497:2: note: here case DDB_TUNER_DVBCT2_SONY_P: ^~~~ drivers/media/pci/ddbridge/ddbridge-core.c:1516:9: warning: this statement may fall through [-Wimplicit-fallthrough=] osc24 = 1; ~~~~~~^~~ drivers/media/pci/ddbridge/ddbridge-core.c:1517:2: note: here case DDB_TUNER_DVBCT2_SONY: ^~~~ Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: ddbridge: constify stv0910_p and lnbh25_cfgJulia Lawall2017-08-201-2/+2
| | | | | | | | | | These structures are only copied into other structures, so they can be const. Done with the help of Coccinelle. Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: ddbridge: const'ify all ddb_info, ddb_regmap et alDaniel Scheller2017-08-204-28/+29
| | | | | | | | | All data is accessed RO, so mark everything const. Some vars in several functions aswell as function signatures also require the const keyword now, they're also added by this commit. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: ddbridge: bump version string to 0.9.31intermediate-integratedDaniel Scheller2017-08-201-1/+1
| | | | | Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: ddbridge: remove ddb_info's from the global scopeDaniel Scheller2017-08-202-55/+23Star
| | | | | | | | | Since the DD hardware info and maps aren't needed anymore outside of ddbridge-hw.c (they're returned via get_ddb_info() now), mark them static and remove all refs from ddbridge-hw.h. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: ddbridge: move ddb_unmap(), cleanup modparamsDaniel Scheller2017-08-203-20/+21
| | | | | | | | | | adapter_alloc is only used from within ddbridge-core, so move it there, this removes the need for prototyping/referencing the variable. While at it, msi isn't needed outside of ddbridge-main, so don't extref that one aswell. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: ddbridge: move device ID table to ddbridge-hwDaniel Scheller2017-08-205-45/+96
| | | | | | | | | This further cleans up ddbridge-main from hardware-related data and moves the exact card type determination into ddbridge-hw.c:get_ddb_info(), right to the hardware maps/structs. Also, const'ify more structs and pointers. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: ddbridge: fix gap handlingDaniel Scheller2017-08-201-1/+5
| | | | | | | | Force gap setting if given by attribute and enable gap for older regmaps. Also, setting a gap value of 128 via sysfs will now disable gap. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: ddbridge: fix buffer overflow in max_set_input_unlocked()Daniel Scheller2017-08-201-3/+4
| | | | | | | | | | | | | Picked up code parts introduced one smatch error: drivers/media/pci/ddbridge/ddbridge-maxs8.c:163 max_set_input_unlocked() error: buffer overflow 'dev->link[port->lnr].lnb.voltage' 4 <= 255 Fix this by clamping the .lnb.voltage array access to 0-3 by "& 3"'ing dvb->input. Cc: Ralph Metzler <rjkm@metzlerbros.de> Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: ddbridge: support MaxLinear MXL5xx based cards (MaxS4/8)Daniel Scheller2017-08-2010-4/+588
| | | | | | | | | | | This enables MaxS4/S8 and Octopus Max card support in ddbridge by adding glue code into ddbridge-core, having another PCI ID, and have the LNB IC control code (and all other MaxS4/8 related code) in ddbridge-maxs8.c (rather than another ~400 LoC in ddbridge-core.c like it's done in the original vendor driver package). Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: ddbridge: Kconfig option to control the MSI modparam defaultDaniel Scheller2017-08-202-2/+24
| | | | | | | | | | | | | | | | | It is known that MSI interrupts - while working quite well so far - can still cause issues on some hardware platforms (causing I2C timeouts due to unhandled interrupts). The msi variable/option is set to 1 by default. So, add a Kconfig option prefixed with "EXPERIMENTAL" that will control the default value of that modparam, defaulting to off for a better user experience and (guaranteed) stable operation "per default". Cc: Ralph Metzler <rjkm@metzlerbros.de> Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Tested-by: Richard Scobie <r.scobie@clear.net.nz> Tested-by: Jasmin Jessich <jasmin@anw.at> Tested-by: Dietmar Spingler <d_spingler@freenet.de> Tested-by: Manfred Knick <Manfred.Knick@t-online.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: ddbridge: fix dereference before checkDaniel Scheller2017-08-201-4/+14
| | | | | | | | | | | | | | | | | Both ts_release() and ts_open() can use "output" before check (smatch): drivers/media/pci/ddbridge/ddbridge-core.c:816 ts_release() warn: variable dereferenced before check 'output' (see line 809) drivers/media/pci/ddbridge/ddbridge-core.c:836 ts_open() warn: variable dereferenced before check 'output' (see line 828) Fix by performing checks on those pointers. Cc: Ralph Metzler <rjkm@metzlerbros.de> Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Tested-by: Richard Scobie <r.scobie@clear.net.nz> Tested-by: Jasmin Jessich <jasmin@anw.at> Tested-by: Dietmar Spingler <d_spingler@freenet.de> Tested-by: Manfred Knick <Manfred.Knick@t-online.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: ddbridge: fix impossible condition warningDaniel Scheller2017-08-201-1/+1
| | | | | | | | | | | | | | | | | | | Smatch and gcc complained: drivers/media/pci/ddbridge/ddbridge-core.c:3491 bpsnr_show() warn: impossible condition '(snr[0] == 255) => ((-128)-127 == 255)' drivers/media/pci/ddbridge/ddbridge-core.c: In function ‘bpsnr_show’: drivers/media/pci/ddbridge/ddbridge-core.c:3491:13: warning: comparison is always false due to limited range of data type [-Wtype-limits] Fix this by changing the type of snr to unsigned char. Cc: Ralph Metzler <rjkm@metzlerbros.de> Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Tested-by: Richard Scobie <r.scobie@clear.net.nz> Tested-by: Jasmin Jessich <jasmin@anw.at> Tested-by: Dietmar Spingler <d_spingler@freenet.de> Tested-by: Manfred Knick <Manfred.Knick@t-online.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: ddbridge: remove unreachable codeDaniel Scheller2017-08-201-23/+4Star
| | | | | | | | | | | | | | | | | >From smatch: drivers/media/pci/ddbridge/ddbridge-core.c:3490 snr_store() info: ignoring unreachable code. In fact, the function immediately returns zero, so remove it and update ddb_attrs_snr[] to not reference it anymore. Cc: Ralph Metzler <rjkm@metzlerbros.de> Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Tested-by: Richard Scobie <r.scobie@clear.net.nz> Tested-by: Jasmin Jessich <jasmin@anw.at> Tested-by: Dietmar Spingler <d_spingler@freenet.de> Tested-by: Manfred Knick <Manfred.Knick@t-online.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: ddbridge: fix possible buffer overflow in ddb_ports_init()Daniel Scheller2017-08-201-1/+1
| | | | | | | | | | | | | | | | | Report from smatch: drivers/media/pci/ddbridge/ddbridge-core.c:2659 ddb_ports_init() error: buffer overflow 'dev->port' 32 <= u32max Fix by making sure "p" is greater than zero before checking for "dev->port[].type == DDB_CI_EXTERNAL_XO2". Cc: Ralph Metzler <rjkm@metzlerbros.de> Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Tested-by: Richard Scobie <r.scobie@clear.net.nz> Tested-by: Jasmin Jessich <jasmin@anw.at> Tested-by: Dietmar Spingler <d_spingler@freenet.de> Tested-by: Manfred Knick <Manfred.Knick@t-online.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: ddbridge: only register frontends in fe2 if fe is not NULLDaniel Scheller2017-08-201-9/+11
| | | | | | | | | | | | | | | | | | Smatch reported: drivers/media/pci/ddbridge/ddbridge-core.c:1602 dvb_input_attach() error: we previously assumed 'dvb->fe' could be null (see line 1595) dvb->fe2 will ever only be populated when dvb->fe is set. So only handle registration of dvb->fe2 when dvb->fe got set beforehand by moving the registration into the "if (dvb->fe)" conditional. Cc: Ralph Metzler <rjkm@metzlerbros.de> Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Tested-by: Richard Scobie <r.scobie@clear.net.nz> Tested-by: Jasmin Jessich <jasmin@anw.at> Tested-by: Dietmar Spingler <d_spingler@freenet.de> Tested-by: Manfred Knick <Manfred.Knick@t-online.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: ddbridge: check pointers before dereferencingDaniel Scheller2017-08-201-2/+2
| | | | | | | | | | | | | | | | | Fixes two warnings reported by smatch: drivers/media/pci/ddbridge/ddbridge-core.c:240 ddb_redirect() warn: variable dereferenced before check 'idev' (see line 238) drivers/media/pci/ddbridge/ddbridge-core.c:240 ddb_redirect() warn: variable dereferenced before check 'pdev' (see line 238) Fixed by moving the existing checks up before accessing members. Cc: Ralph Metzler <rjkm@metzlerbros.de> Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Tested-by: Richard Scobie <r.scobie@clear.net.nz> Tested-by: Jasmin Jessich <jasmin@anw.at> Tested-by: Dietmar Spingler <d_spingler@freenet.de> Tested-by: Manfred Knick <Manfred.Knick@t-online.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: ddbridge: split off hardware definitions and mappingsDaniel Scheller2017-08-206-286/+354
| | | | | | | | | | | | Further cleanup of ddbridge-core and ddbridge-main, and moves all such hw definitions into one single place, making things easier to maintain. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Tested-by: Richard Scobie <r.scobie@clear.net.nz> Tested-by: Jasmin Jessich <jasmin@anw.at> Tested-by: Dietmar Spingler <d_spingler@freenet.de> Tested-by: Manfred Knick <Manfred.Knick@t-online.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: ddbridge: split I/O related functions off from ddbridge.hDaniel Scheller2017-08-205-43/+74
| | | | | | | | | | | | | | | | | | While it seems valid that headers can carry simple oneline static inline annotated functions, move them into their own header file to have the overall code more readable. Also, keep them as header (and don't put in a separate object) and static inline to help the compiler avoid generating function calls. (Thanks to Jasmin J. <jasmin@anw.at> for valuable input on this!) Cc: Jasmin J. <jasmin@anw.at> Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Tested-by: Richard Scobie <r.scobie@clear.net.nz> Tested-by: Jasmin Jessich <jasmin@anw.at> Tested-by: Dietmar Spingler <d_spingler@freenet.de> Tested-by: Manfred Knick <Manfred.Knick@t-online.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: ddbridge: bump ddbridge code to version 0.9.29Daniel Scheller2017-08-206-1163/+3376
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This huge patch bumps the ddbridge driver to version 0.9.29. Compared to the vendor driver package, DD OctoNET including GTL link support, and all DVB-C Modulator card support has been removed since this requires large changes to the underlying DVB core API, which should eventually be done separately, and, after that, the functionality/device support can be added back rather easy. While the diff is rather large, the bump is mostly a big refactor of all data structures. Yet, the MSI support (message signaled interrupts) is greatly improved, also all currently available CI single/duo bridge cards are fully supported. More changes compared to the upstream driver: - the DDB_USE_WORKER flag/define was removed, kernel worker functionality will be used. - coding style is properly fixed (zero complaints from checkpatch) - all (not much though) CamelCase has been fixed to kernel_case - (private) IOCTLs temporarily removed (which are mainly used to provide rarely-used FPGA update functionality) Great care has been taken to keep all previous changes and fixes (e.g. kernel logging via dev_*(), pointer annotations and such) intact. 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> Tested-by: Jasmin Jessich <jasmin@anw.at> Tested-by: Dietmar Spingler <d_spingler@freenet.de> Tested-by: Manfred Knick <Manfred.Knick@t-online.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: ddbridge: split code into multiple filesDaniel Scheller2017-08-096-577/+710
| | | | | | | | | | | | | | | | | | | | | | | | | As of 0.9.9b, the ddbridge code has been split from one single file (ddbridge-core.c) into multiple files, with the purpose of taking care of different topics, and to be able to reuse code in different kernel modules (ddbridge.ko and octonet.ko). This applies the same code split, with a notable difference: In the vendor package, the split was done by moving all code parts into separate files, and in the "main" code files (ddbridge.c and octonet.c), a simple "#include ddbridge-core.c" was done. In this patch, the same split (codewise) is done, but all resulting .c/.o files will be handled by the makefile, with proper prototyping of all shared functions done in ddbridge.h. To avoid conflicts wrt the global space, the I2C functions and necessary prototypes for ddbridge-i2c.c are moved into ddbridge-i2c.h, which is to be included wherever required. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Tested-by: Richard Scobie <r.scobie@clear.net.nz> Tested-by: Jasmin Jessich <jasmin@anw.at> Tested-by: Dietmar Spingler <d_spingler@freenet.de> Tested-by: Manfred Knick <Manfred.Knick@t-online.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: ddbridge: move/reorder functionsDaniel Scheller2017-08-091-331/+325Star
| | | | | | | | | | | | | | The functions in ddbridge-core.c have been moved to different positions in newer versions of the dddvb vendor driver package (most notably in version 0.9.9b). Perform the same code move to keep the diff of the upcoming code bump simpler. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Tested-by: Richard Scobie <r.scobie@clear.net.nz> Tested-by: Jasmin Jessich <jasmin@anw.at> Tested-by: Dietmar Spingler <d_spingler@freenet.de> Tested-by: Manfred Knick <Manfred.Knick@t-online.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: ddbridge: 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: ddbridge: stv0910 single demod mode module optionDaniel Scheller2017-07-201-0/+7
| | | | | | | | | | Adds a stv0910_single modparm which, when set, configures the stv0910 to run in single demodulator mode, currently intended for high bit rate testing. 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: ddbridge: support for CineS2 V7(A) and DuoFlex S2 V4 hardwareDaniel Scheller2017-07-203-3/+138
| | | | | | | | | | | | | This adds all required glue code to support - in conjunction with the new stv0910 and stv6111 demod/tuner drivers and additionally the lnbh25 LNB controller driver - all current DVB-S/S2 hardware (bridges and flex modules) from Digital Devices like the DD CineS2 V7 and V7A, current S2 V4 DuoFlex modules, and probably all upcoming devices based on this STV0910/STV6111/LNBH25 hardware stack. 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: ddbridge: return stv09xx id in port_has_stv0900_aa()Daniel Scheller2017-07-201-5/+4Star
| | | | | | | | | The returned value is required for further evaluation of the exact demodulator chip (stv090x or stv0910). 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: staging: cxd2099: Fixed buffer modeRalph Metzler2017-06-261-0/+1
| | | | | | | | | | | | | | The buffer mode was already implemented in this driver, but it did not work as expected. This has been fixed now, but it is still deactivated and can be activated by removing a comment at the begin of the file. Original code change by Ralph Metzler, modified by Jasmin Jessich and Daniel Scheller to match Kernel code style. Signed-off-by: Ralph Metzler <rjkm@metzlerbros.de> Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Jasmin Jessich <jasmin@anw.at> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: ddbridge: dev_* logging fixupDaniel Scheller2017-06-251-1/+1
| | | | | | | | | | | | | Fixup commit d52786ddd2d5 ("media: ddbridge: make (ddb)readl in while-loops fail-safe") after/wrt commit 11e358bf37e8 ("media: ddbridge: use dev_* macros in favor of printk") Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: ddbridge: use dev_* macros in favor of printkDaniel Scheller2017-06-241-32/+46
| | | | | | | | | | | | Side effect: KERN_DEBUG messages aren't written to the kernel log anymore. This also improves the tda18212_ping reporting a bit so users know that if pinging wasn't successful, bad things will happen. Since in module_init_ddbridge() there's no dev yet, pr_info is used instead. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* media: ddbridge: make (ddb)readl in while-loops fail-safeDaniel Scheller2017-06-241-5/+18
| | | | | | | | | | | | | | | | Reported by smatch: drivers/media/pci/ddbridge/ddbridge-core.c:1246 input_tasklet() warn: this loop depends on readl() succeeding drivers/media/pci/ddbridge/ddbridge-core.c:1768 flashio() warn: this loop depends on readl() succeeding drivers/media/pci/ddbridge/ddbridge-core.c:1788 flashio() warn: this loop depends on readl() succeeding Fix this by introducing safe_ddbreadl() which will wrap ddbreadl and checks for all bits set in the return which indicates failure, and return 0 in that case. Usable as drop-in-replacement in all affected while loops w/o having to change the logic. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] ddbridge: hardware IDs for new C2T2 cards and other devicesDaniel Scheller2017-06-203-4/+88
| | | | | | | | | Adds hardware IDs for all Sony CXD-based Cine-cards and MaxA8 devices, also adds some other yet missing IDs like the Octopus V3, Octopus OEM and Octopus Mini, as well as cards with unknown/deleted sub-ids. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] ddbridge: support for Sony CXD28xx C/C2/T/T2 tuner modulesDaniel Scheller2017-06-203-14/+132
| | | | | | | | | | | | | Properly detect and attach Ports and Flex modules with the Sony CXD28xxER series demods. This makes newer Cine cards and most DuoFlex C/C2/T/T2 (or any combination of these systems) work, PCI IDs need to be added though. Note: This utilises the CXD2841ER demod driver, which requires the changes from this patch series to properly work. Without those changes, it won't function properly (if at all). Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] ddbridge: add I2C functions, add XO2 module supportDaniel Scheller2017-06-202-0/+158
| | | | | | | | | | | | | | | | | Some Flex modules (mostly with anyof C/C2/T/T2 demods based on the Sony CXD28xxER series) are equipped with an interface named XO2 (which appears to be the Lattice MachXO2). Add functionality to detect such links and initialise them, so any tuner module with such an interface can be used. This also adds dummy detection for any possible connected module, telling the user it isn't supported at this very moment. Also adds i2c_io(), i2c_write() and i2c_write_reg(), all required for the XO2 handling functionality. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] ddbridge: board control setup, ts quirk flagsDaniel Scheller2017-06-203-0/+27
| | | | | | | | | | | | | | | | | This is a backport of the board control setup from the vendor provided dddvb driver package, which does additional device initialisation based on the board_control device info values. Also backports the TS quirk flags which is used to control setup and usage of the tuner modules soldered on the bridge cards (e.g. CineCTv7, CineS2 V7, MaxA8 and the likes). Functionality originates from ddbridge vendor driver. Permission for reuse and kernel inclusion was formally granted by Ralph Metzler <rjkm@metzlerbros.de>. Cc: Ralph Metzler <rjkm@metzlerbros.de> Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] ddbridge: support STV0367-based cards and modulesDaniel Scheller2017-06-203-1/+161
| | | | | | | | | | | | | | | | | | | | | | | This adds detection and activation for STV0367-based tuner hardware (namely CineCTv6 bridge cards and older DuoFlex CT addon modules). Utilises the extended stv0367 demod driver. TDA18212 i2c_client/regmap-api code was originally implemented by Antti Palosaari <crope@iki.fi> in a variant to update the ddbridge code from the vendor dddvb package (formal ack for these parts received). Original patch at [1]. When boards with STV0367 are cold-started, there might be issues with the I2C gate, causing the TDA18212 detection/probe to fail. For these demods, a workaround (tuner_tda18212_ping) is implemented which probes the tuner twice on this hardware constellation which will resolve the problem and put all components into a working state. Other demod/port types won't be retried. [1] https://patchwork.linuxtv.org/patch/25146/ Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] ddbridge: add i2c_read_regs()Daniel Scheller2017-06-201-2/+8
| | | | | | | | | Adds new i2c_read_regs() function and make i2c_read_reg() wrap into this with len=1. Required for the tuner_tda18212_ping() and XO2 handling functions (part of the Sony CXD28xx support patch series). Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] media drivers: annotate fall-throughMauro Carvalho Chehab2017-05-191-3/+4
| | | | | | | | | | | | | | | | | | | Avoid warnings like those: drivers/media/pci/ddbridge/ddbridge-core.c: In function 'dvb_input_detach': drivers/media/pci/ddbridge/ddbridge-core.c:787:6: warning: this statement may fall through [-Wimplicit-fallthrough=] if (input->fe) { ^ drivers/media/pci/ddbridge/ddbridge-core.c:792:2: note: here case 4: ^~~~ ... On several cases, it is just that gcc 7.1 is not capable of understanding the comment, but on other places, we need an annotation. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] media: Drop FSF's postal address from the source code filesSakari Ailus2017-01-273-18/+6Star
| | | | | | | | | | | | | | | | | | | | | Drop the FSF's postal address from the source code files that typically contain mostly the license text. Of the 628 removed instances, 578 are outdated. The patch has been created with the following command without manual edits: git grep -l "675 Mass Ave\|59 Temple Place\|51 Franklin St" -- \ drivers/media/ include/media|while read i; do i=$i perl -e ' open(F,"< $ENV{i}"); $a=join("", <F>); $a =~ s/[ \t]*\*\n.*You should.*\n.*along with.*\n.*(\n.*USA.*$)?\n//m && $a =~ s/(^.*)Or, (point your browser to) /$1To obtain the license, $2\n$1/m; close(F); open(F, "> $ENV{i}"); print F $a; close(F);'; done Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
* [media] ddbridge: don't break long linesMauro Carvalho Chehab2016-10-211-4/+2Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Due to the 80-cols restrictions, and latter due to checkpatch warnings, several strings were broken into multiple lines. This is not considered a good practice anymore, as it makes harder to grep for strings at the source code. As we're right now fixing other drivers due to KERN_CONT, we need to be able to identify what printk strings don't end with a "\n". It is a way easier to detect those if we don't break long lines. So, join those continuation lines. The patch was generated via the script below, and manually adjusted if needed. </script> use Text::Tabs; while (<>) { if ($next ne "") { $c=$_; if ($c =~ /^\s+\"(.*)/) { $c2=$1; $next =~ s/\"\n$//; $n = expand($next); $funpos = index($n, '('); $pos = index($c2, '",'); if ($funpos && $pos > 0) { $s1 = substr $c2, 0, $pos + 2; $s2 = ' ' x ($funpos + 1) . substr $c2, $pos + 2; $s2 =~ s/^\s+//; $s2 = ' ' x ($funpos + 1) . $s2 if ($s2 ne ""); print unexpand("$next$s1\n"); print unexpand("$s2\n") if ($s2 ne ""); } else { print "$next$c2\n"; } $next=""; next; } else { print $next; } $next=""; } else { if (m/\"$/) { if (!m/\\n\"$/) { $next=$_; next; } } } print $_; } </script> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] constify local structuresJulia Lawall2016-09-191-9/+9
| | | | | | | | | | | | | | | | | | | For structure types defined in the same file or local header files, find top-level static structure declarations that have the following properties: 1. Never reassigned. 2. Address never taken 3. Not passed to a top-level macro call 4. No pointer or array-typed field passed to a function or stored in a variable. Declare structures having all of these properties as const. Done using Coccinelle. Based on a suggestion by Joe Perches <joe@perches.com>. Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] ddbridge: Replace vmalloc with vzallocAmitoj Kaur Chawla2016-07-081-2/+1Star
| | | | | | | | | | | | | | | | | | | | | | | vzalloc combines vmalloc and memset 0. The Coccinelle semantic patch used to make this change is as follows: @@ type T; T *d; expression e; statement S; @@ d = - vmalloc + vzalloc (...); if (!d) S - memset(d, 0, sizeof(T)); Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] constify stv6110x_devctl structureJulia Lawall2016-02-011-1/+1
| | | | | | | | | | | The stv6110x_devctl structure is never modified, so declare it as const. Done with the help of Coccinelle. Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] dvb: modify core to implement interfaces/entities at MC new genMauro Carvalho Chehab2016-01-111-1/+1
| | | | | | | | | | The Media Controller New Generation redefines the types for both interfaces and entities to be used on DVB. Make the needed changes at the DVB core for all interfaces, entities and data and interface links to appear in the graph. Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] ddbridge: fix wait_event_timeout return handlingNicholas Mc Guire2015-11-181-2/+2
| | | | | | | | | | | | | | | API conformance testing for completions with coccinelle spatches are being used to locate API usage inconsistencies: ./drivers/media/pci/ddbridge/ddbridge-core.c:89 incorrect check for negative return Return type of wait_event_timeout is signed long not int and the return type is >=0 always thus the negative check is unnecessary.. As stat is used here exclusively its type is simply changed and the negative return check dropped. Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>