Now that interfaces got created, we need to fix the entity
namespace.
So, let's create a consistent new namespace and add backward
compatibility macros to keep the old namespace preserved.
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Some interfaces indirectly control multiple entities.
Add support for those.
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Now that the infrastruct for that is set, add support for
interfaces.
Please notice that we're missing two links:
DVB FE intf -> tuner
DVB demux intf -> dvr
Those should be added latter, after having the entire graph
set. With the current infrastructure, those should be added
at dvb_create_media_graph(), but it would also require some
extra core changes, to allow the function to enumerate the
interfaces.
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
The entire logic that represent graph links were developed on a
time where there were no needs to dynamic remove links. So,
although links are created/removed one by one via some
functions, they're stored as an array inside the entity struct.
As the array may grow, there's a logic inside the code that
checks if the amount of space is not enough to store
the needed links. If it isn't the core uses krealloc()
to change the size of the link, with is bad, as it
leaves the memory fragmented.
So, convert links into a list.
Also, currently, both source and sink entities need the link
at the graph traversal logic inside media_entity. So there's
a logic duplicating all links. That makes it to spend
twice the memory needed. This is not a big deal for today's
usage, where the number of links are not big.
Yet, if during the MC workshop discussions, it was said that
IIO graphs could have up to 4,000 entities. So, we may
want to remove the duplication on some future. The problem
is that it would require a separate linked list to store
the backlinks inside the entity, or to use a more complex
algorithm to do graph backlink traversal, with is something
that the current graph traversal inside the core can't cope
with. So, let's postpone a such change if/when it is actually
needed.
It should also be noticed that the media_link structure uses
44 bytes on 32-bit architectures and 84 bytes on 64-bit
architecture. It will thus be allocated out of the 64-bytes and
96-bytes pools respectively. That's a 12.5% memory waste on
64-bit architectures and 31.25% on 32-bit architecture.
A linked list is less efficient than an array in this case, but
this could later be optimized if we can get rid of the reverse
links (with would reduce memory allocation by 50%).
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
With the new API, a link can be either between two PADs or between an interface
and an entity. So, we need to use a better name for the function that create
links between two pads.
So, rename the such function to media_create_pad_link().
No functional changes.
This patch was created via this shell script:
for i in $(find drivers/media -name '*.[ch]' -type f) $(find drivers/staging/media -name '*.[ch]' -type f) $(find include/ -name '*.h' -type f) ; do sed s,media_entity_create_link,media_create_pad_link,g <$i >a && mv a $i; done
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Tested-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Currently, media_entity_init() creates an array with the links,
allocated at init time. It provides a parameter (extra_links)
that would allocate more links than the current needs, but this
is not used by any driver.
As we want to be able to do dynamic link allocation/removal,
we'll need to change the implementation of the links. So,
before doing that, let's first remove that extra unused
parameter, in order to cleanup the interface first.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
As pointed by Laurent Navet:
"Calling ktime_add_us() seems useless as is only useful
for it's return value which is ignored."
That's reported by coverity CID 1309761.
Laurent proposed to just remove ktime_add_us, but the fact is that
the logic of this function is broken. Instead, we need to use the
value of the timeout, and ensure that it will work on the loops
to emulate the legacy DiSEqC ioctl (FE_DISHNETWORK_SEND_LEGACY_CMD).
Please notice that the logic was also broken if, for any reason,
msleep() would sleep a little less than what it was expected, as
newdelta would be smaller than delta, and udelay() would not be called.
It should also be noticed that nobody noticed that trouble before
likely because the FE_DISHNETWORK_SEND_LEGACY_CMD is not used
anymore by modern DVB applications.
Reported-by: Laurent Navet <laurent.navet@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
This patch adds support for the DVB-T/C/T2 usb stick WinTV-soloHD from
Hauppauge. It adds the usb ID 2040:0264 Hauppauge to the cards of the
driver em28xx.
I successfully tested DVB-T/C and the IR remote control with the
firmware dvb-demod-si2168-b40-01.fw.
Signed-off-by: Arno Bauernoeppel <arno@aziraphale.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
When in FE_TUNE_MODE_ONESHOT the frontend must report
the actual capabilities so user can take appropriate
action.
With frontends that can't do auto inversion this is done
by dvb-core automatically so CAN_INVERSION_AUTO is valid.
However, when in FE_TUNE_MODE_ONESHOT this is not true.
So only set FE_CAN_INVERSION_AUTO in modes other than
FE_TUNE_MODE_ONESHOT
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Improve the comments at the header, removing kernel-doc
tag from where it doesn't belong, grouping the legacy tuner
functions, and improving the text.
No functional changes.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
The get_state()/set_state and the corresponding data types
(struct tuner_state and enum tuner_param) are old DVB interfaces
that came from the DVBv3 time.
Nowadays, set_params() provide a better way to set the tuner
and demod parameters. So, no need to keep those legacy stuff,
as all drivers that were using it got converted.
With this patch, all kABI elements at dvb_frontend.h are now
documented.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
There are several tuner_param values that aren't by any driver or core:
DVBFE_TUNER_TUNERSTEP
DVBFE_TUNER_IFFREQ
DVBFE_TUNER_REFCLOCK
DVBFE_TUNER_IQSENSE
DVBFE_TUNER_DUMMY
Several of those correspond to the values at the tuner_state
struct with is also only initialized by not used anyware:
u32 tunerstep;
u32 ifreq;
u32 refclock;
It doesn't make sense to keep anything at the kABI that it is
not used. So, get rid of them.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
As SEC tone and voltage could have changed during
suspend(), restore them to their previous values at
resume().
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
The DocBook description of this header has two issues:
- It calls the Kernel ABI as API, instead of kABI;
- It mentions that the DVB frontend kABI is not described
within the document. As this will actually generate a
single DocBook, this is actually not true, now that
the documentation for the frontend was added.
So, fix both issues.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
This header file provides the kABI functions used by the
Digital TV Frontend core support. Add a description for
this kABI, to add at the device_drivers Kernel DocBook.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Documents the most used functions at the Digital TV
kABI: dvb_frontend_register(), dvb_frontend_unregister()
and dvb_frontend_detach().
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
The dvb_frontend_reinitialise() function is a special case
used by just one frontend. Document it, for completeness.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
This function is used mainly at the DVB core, in order to provide
emulation for a legacy ioctl. The only current exception is
the stv0299 driver, with takes more than 8ms to switch voltage,
breaking the emulation for FE_DISHNETWORK_SEND_LEGACY_CMD.
Document that.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Classify the functions at the DVB core per API. That makes easier
to understand how they're related to the userspace API.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
It is better to keep the documentation overview at the header file,
as this makes easier for developers to remember to fix when needed.
Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
While we can't document #defines, documenting enums are
well supported by kernel-doc. So, convert the bitmap defines
into an enum.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
The usage of #define at the kABI is fine, but it doesn't
allow adding a proper description. As those defines deserve
a proper documentation, let's convert them into an enum and
document them at device-drivers DocBook.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
The dvb/kdapi.tmpl has already an extensive documentation about
this callback. Now that we've added function typedefs at kernel-doc,
add such documentation at demux.h, for it to appear at device-drivers
DocBook.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
The dvb/kdapi.tmpl has already an extensive documentation about
this callback. Now that we've added function typedefs at kernel-doc,
add such documentation at demux.h, for it to appear at device-drivers
DocBook.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
There are lots of CodingStyle violations here. Now that we're
touching a log on this header files, adding the documentation
here, make sure that this will follow the Kernel CodingStyle.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
The DVB core has a provision for other frontend sources, but no
drivers use it. The kdapi.xml contains provision for some other
frontend source types, but it is not in sync with the code.
So, remove the unused types and sync both files.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
This enum is not actually used anymore. The only value used from
the enum is DMX_OK, passed as a parameter on two callbacks.
Yet, this value is not used anywhere. So, just remove it.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
There are two callbacks still not documented:
.//drivers/media/dvb-core/demux.h:422: warning: No description found for parameter 'get_pes_pids'
.//drivers/media/dvb-core/demux.h:422: warning: No description found for parameter 'get_stc'
The purpose of first one is clear. The second one is used only
on the obsolete av7110 driver, and its purpose is not clear,
as it just returns a 64-bit word from the firmware to userspace.
Let's document get_pes_pids and mark get_stc as private, adding
a comment to not use it, while this is not documented.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
There are two DVB demux callbacks and ioctls that aren't documented
and aren't used at all by the DVB core or by any DVB driver upstream.
Let's comment out the code for those two ioctls and remove on some
future version.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
There are a few inconsistencies between the old documentation
that got imported into the header and the current status.
Update them, and use the proper doc-nano nomenclature for
struct artuments "@", instead of foo().
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
The DocBook/media/dvb/kdapi.xml contains the description of
the kABI for DVB. The problem is that, by being maintained
on a separate file and not being updated for years, it got
outdated. So, for example, some callback parameters were
changed, but the DocBook were still using the old stuff.
As a first step to fix it, let's move the documentation of
struct dmx_demux into demux.h and fix the parameters used
there.
For now, don't document any other field nor touch the
descriptions that got moved, letting this job to other
patches. That makes easier to review the patch.
PS.: Please notice that an additional patch will be needed
in order to fix the return values (some uses non-existent
return codes) and to the functions and callbacks mentioned at
the descriptions.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
There are several CodingStyle violations at the DVB code. While
we won't be fixing them as a hole, let's fix at least the
headers, as we're touching on them already in order to properly
document them.
No functional changes.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
This struct is already documented at the header file, but it is
not using Kernel doc-nano format. Convert to it.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Adds Terratec H7 Rev. 4 with USB id 0ccd:10a5 to DVBSky driver.
Signed-off-by: Erik Andresen <erik@vontaene.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Those two came from dvb_register_adapter cut-and-paste:
.//drivers/media/dvb-core/dvbdev.h:199: warning: Excess function parameter 'device' description in 'dvb_register_device'
.//drivers/media/dvb-core/dvbdev.h:199: warning: Excess function parameter 'adapter_nums' description in 'dvb_register_device'
Remove them.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Document the most relevant functions and data structs for
developers that are working with the DVB subsystem.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Acked-by: Jonathan Corbet <corbet@lwn.net>
That struct is used on every DVB Front End driver, as it
contains what's needed to register/use a frontend at the
Kernel.
Document it.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Acked-by: Jonathan Corbet <corbet@lwn.net>
Most of the parameters here are already well defined at
the userspace documentation. Yet, it is good to add some
documentation, for the developers to be sure that they
are the same as the ones at userspace API.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Acked-by: Jonathan Corbet <corbet@lwn.net>
This is one of the most important functions of the DVB
frontend, containing the logic needed to set the parameters
at the demux and to send commands via SEC.
Document it.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Acked-by: Jonathan Corbet <corbet@lwn.net>
The dvb_frontend.c core defines a FE_ALGO_HW symbol that it is
never used. Also, both cx24123 returns 1 to get_algo() callback
instead of using DVBFE_ALGO_HW.
Probably, those are some left overs from some code cleanup.
Let's stop returning magic numbers and use the proper macro
value.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Acked-by: Jonathan Corbet <corbet@lwn.net>
The struct dvb_tuner_ops contains lots of callbacks used
by tuners. Document them.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Acked-by: Jonathan Corbet <corbet@lwn.net>
That struct inside dvb-frontend.h stores some parameters
from V4L2 API (videodev2.h), in order to be used by the
hybrid analog/digital TV tuners.
Document it.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Acked-by: Jonathan Corbet <corbet@lwn.net>
This enum is not used anymore, as drivers use the
modulation definitions from the public API. It is probably
a left over from some DVB core cleanup.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Acked-by: Jonathan Corbet <corbet@lwn.net>
Despite being used everywhere at DVB frontends, the
struct dvb_tuner_info were never documented.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Acked-by: Jonathan Corbet <corbet@lwn.net>
There are already some comments at dvb_ringbuffer.h that are ready
for DocBook, although not properly formatted.
Convert them, fix some issues and add this file to
the device-drivers DocBook.
While here, put multi-line comments on the right format.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Acked-by: Jonathan Corbet <corbet@lwn.net>
There are already some comments at dvb_math.h that are ready
for DocBook, although not properly formatted.
Convert them, fix some issues and add this file to
the device-drivers DocBook.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Acked-by: Jonathan Corbet <corbet@lwn.net>