History log of /linux-master/drivers/media/pci/ddbridge/ddbridge-main.c
Revision Date Author Comments
# 09b41950 20-Oct-2023 Su Hui <suhui@nfschina.com>

media: ddbridge: fix an error code problem in ddb_probe

Error code is assigned to 'stat', return 'stat' rather than '-1'.

Signed-off-by: Su Hui <suhui@nfschina.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>


# 34c7fdb8 11-Jun-2022 Christophe JAILLET <christophe.jaillet@wanadoo.fr>

media: ddbridge: Remove useless license text when SPDX-License-Identifier is already used

An SPDX-License-Identifier is already in place. There is no need to
duplicate part of the corresponding license.

While at it, a few comments at the end of some .h files have been updated
to reflect the correct include guard name (missing '_' and co.)

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>


# 887069f4 22-Aug-2021 Christophe JAILLET <christophe.jaillet@wanadoo.fr>

media: switch from 'pci_' to 'dma_' API

The wrappers in include/linux/pci-dma-compat.h should go away.

The patch has been generated with the coccinelle script below.

It has been compile tested.

@@
@@
- PCI_DMA_BIDIRECTIONAL
+ DMA_BIDIRECTIONAL

@@
@@
- PCI_DMA_TODEVICE
+ DMA_TO_DEVICE

@@
@@
- PCI_DMA_FROMDEVICE
+ DMA_FROM_DEVICE

@@
@@
- PCI_DMA_NONE
+ DMA_NONE

@@
expression e1, e2, e3;
@@
- pci_alloc_consistent(e1, e2, e3)
+ dma_alloc_coherent(&e1->dev, e2, e3, GFP_)

@@
expression e1, e2, e3;
@@
- pci_zalloc_consistent(e1, e2, e3)
+ dma_alloc_coherent(&e1->dev, e2, e3, GFP_)

@@
expression e1, e2, e3, e4;
@@
- pci_free_consistent(e1, e2, e3, e4)
+ dma_free_coherent(&e1->dev, e2, e3, e4)

@@
expression e1, e2, e3, e4;
@@
- pci_map_single(e1, e2, e3, e4)
+ dma_map_single(&e1->dev, e2, e3, e4)

@@
expression e1, e2, e3, e4;
@@
- pci_unmap_single(e1, e2, e3, e4)
+ dma_unmap_single(&e1->dev, e2, e3, e4)

@@
expression e1, e2, e3, e4, e5;
@@
- pci_map_page(e1, e2, e3, e4, e5)
+ dma_map_page(&e1->dev, e2, e3, e4, e5)

@@
expression e1, e2, e3, e4;
@@
- pci_unmap_page(e1, e2, e3, e4)
+ dma_unmap_page(&e1->dev, e2, e3, e4)

@@
expression e1, e2, e3, e4;
@@
- pci_map_sg(e1, e2, e3, e4)
+ dma_map_sg(&e1->dev, e2, e3, e4)

@@
expression e1, e2, e3, e4;
@@
- pci_unmap_sg(e1, e2, e3, e4)
+ dma_unmap_sg(&e1->dev, e2, e3, e4)

@@
expression e1, e2, e3, e4;
@@
- pci_dma_sync_single_for_cpu(e1, e2, e3, e4)
+ dma_sync_single_for_cpu(&e1->dev, e2, e3, e4)

@@
expression e1, e2, e3, e4;
@@
- pci_dma_sync_single_for_device(e1, e2, e3, e4)
+ dma_sync_single_for_device(&e1->dev, e2, e3, e4)

@@
expression e1, e2, e3, e4;
@@
- pci_dma_sync_sg_for_cpu(e1, e2, e3, e4)
+ dma_sync_sg_for_cpu(&e1->dev, e2, e3, e4)

@@
expression e1, e2, e3, e4;
@@
- pci_dma_sync_sg_for_device(e1, e2, e3, e4)
+ dma_sync_sg_for_device(&e1->dev, e2, e3, e4)

@@
expression e1, e2;
@@
- pci_dma_mapping_error(e1, e2)
+ dma_mapping_error(&e1->dev, e2)

@@
expression e1, e2;
@@
- pci_set_dma_mask(e1, e2)
+ dma_set_mask(&e1->dev, e2)

@@
expression e1, e2;
@@
- pci_set_consistent_dma_mask(e1, e2)
+ dma_set_coherent_mask(&e1->dev, e2)

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Tested-by: Akihiro Tsukada <tskd08@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>


# 79150ac9 19-Jun-2018 Daniel Scheller <d.scheller@gmx.net>

media: ddbridge: header/boilerplate cleanups and cosmetics

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>


# 4771d831 19-Jun-2018 Daniel Scheller <d.scheller@gmx.net>

media: ddbridge: add SPDX license identifiers

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>


# 229b6ea6 19-Jun-2018 Daniel Scheller <d.scheller@gmx.net>

media: mxl5xx/stv0910/stv6111/ddbridge: fix MODULE_LICENSE to 'GPL v2'

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>


# c3eda330 08-Apr-2018 Daniel Scheller <d.scheller@gmx.net>

media: ddbridge: add hardware defs and PCI IDs for MCI cards

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>


# 60586360 08-Apr-2018 Daniel Scheller <d.scheller@gmx.net>

media: ddbridge: set devid entry for link 0

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>


# 6bf0f051 08-Apr-2018 Daniel Scheller <d.scheller@gmx.net>

media: ddbridge: request/free_irq using pci_irq_vector, enable MSI-X

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>


# 95c2ab9e 08-Apr-2018 Daniel Scheller <d.scheller@gmx.net>

media: ddbridge: move MSI IRQ cleanup to a helper function

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>


# 05ed62da 08-Apr-2018 Daniel Scheller <d.scheller@gmx.net>

media: ddbridge: move ddb_wq and the wq+class initialisation to -core

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>


# 5589974e 08-Apr-2018 Daniel Scheller <d.scheller@gmx.net>

media: ddbridge: move modparams to ddbridge-core.c

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>


# 757d78d3 15-Oct-2017 Daniel Scheller <d.scheller@gmx.net>

media: ddbridge: fixup checkpatch-strict issues

Fixes several alignment, braces, space-before-cast, camelcase et al issues
reported by checkpatch --strict, plus a few more checkpatch didn't report.

Three checks are left after this though:
- one CamelCase in ddbridge-core, related to defines/vars/enums referenced
from the stv090x demod driver
- one macro argument reuse in ddbridge-core aswell
- one unbalanced braces around else in ddbridge-main, which is due to
#ifdefs related to CONFIG_PCI_MSI, which preferrably should be kept
as-is for readability.

Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>


# 8e4eef22 20-Aug-2017 Daniel Scheller <d.scheller@gmx.net>

media: ddbridge: move ddb_unmap(), cleanup modparams

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>


# 66cc3d98 20-Aug-2017 Daniel Scheller <d.scheller@gmx.net>

media: ddbridge: move device ID table to ddbridge-hw

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>


# bb4cec96 09-Jul-2017 Daniel Scheller <d.scheller@gmx.net>

media: ddbridge: support MaxLinear MXL5xx based cards (MaxS4/8)

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>


# adaf4df7 12-Aug-2017 Daniel Scheller <d.scheller@gmx.net>

media: ddbridge: Kconfig option to control the MSI modparam default

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>


# 69716934 12-Aug-2017 Daniel Scheller <d.scheller@gmx.net>

media: ddbridge: split off hardware definitions and mappings

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>


# 14e27a10 12-Aug-2017 Daniel Scheller <d.scheller@gmx.net>

media: ddbridge: split I/O related functions off from ddbridge.h

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>


# 22e74389 12-Aug-2017 Daniel Scheller <d.scheller@gmx.net>

media: ddbridge: bump ddbridge code to version 0.9.29

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>


# a96e5ab8 29-Jul-2017 Daniel Scheller <d.scheller@gmx.net>

media: ddbridge: split code into multiple files

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>