Hans Verkuil [Thu, 21 May 2015 09:19:28 +0000 (06:19 -0300)]
[media] cobalt: fix irqs used for the adv7511 transmitter
The interrupt bit assignments use for the adv7511 were off by one.
This means that the current scheme (bit << (4 * stream_index)) can
no longer be used.
Fix this by precalculating and storing the correct masks in the
cobalt_stream struct.
This wasn't noticed before because the adv7511 interrupts are very
rare. But for CEC support these interrupts are essential, so this made
me realize that it wasn't working correctly.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
[media] DocBook: Update DocBook version and fix a few legacy things
The DVB part of the media API documentation has several
legacy things on it:
- Examples that don't work;
- APIs unused and deprecated;
- places mentioning the wrong API version.
Fix them and bump the documentation version, in order to
reflect the cleanup efforts to make it more consistent with
the current status of the API.
[media] DocBook: cleaup the notes about DTV properties
The notes there are somewhat confusing and assumes that the
reader would have read the DVBv3 way. This is not true anymore,
as the DVBv3 is now on a separate section that is marked as
deprecated.
So, cleanup the notes.
While here, add a note about using libdvbv5, instead of using
the DVBv5 API directly.
[media] DocBook: Add an example for using FE_SET_PROPERTY
In order to make it clearer about how to use the DVBv5 calls,
add an example of its usage. That should make it clearer about
what's actually required for the DVBv5 calls to work.
[media] DocBook: cross-reference enum fe_modulation where needed
At frontend legacy API description, there are three places
where fe_modulation_t is defined. Cross-reference it to point
to the right place at the documentation.
[media] DocBook: add a proper description for dvb_frontend_info.fe_type
The fe_type is deprecated at the DVB API. However, it may still
be used by legacy DVBv3 applications. While this works with old
devices, modern devices may support more than one delivery
system.
Add an explanation about that and a point to what should be
used, instead, in order for legacy apps to support newer hardware.
What's written there about the arguments for this ioctl
is bogus: it doesn't return an enum (or a typedef)
for enum fe_status. Instead, it returns a bitmask with the
values defined by enum fe_status.
Also, the size of the integer returned is not 16 bits, but,
instead, sizeof(fe_status_t), e. g. sizeof(enum), with is
arch-dependent.
This should of course be fixed, but this should be done on
a separate patch.
[media] DocBook: better organize the function descriptions for frontend
Move the function ioctl definitions to the end of the chapter,
at their importance. That makes the document better organized,
as the DVB frontend system call index will look like:
open()
close()
ioctl FE_GET_INFO — Query DVB frontend capabilities and returns information about the front-end. This call only requires read-only access to the device
ioctl FE_READ_STATUS — Returns status information about the front-end. This call only requires read-only access to the device
ioctl FE_SET_PROPERTY, FE_GET_PROPERTY — FE_SET_PROPERTY sets one or more frontend properties. FE_GET_PROPERTY returns one or more frontend properties.
ioctl FE_DISEQC_RESET_OVERLOAD — Restores the power to the antenna subsystem, if it was powered off due to power overload.
ioctl FE_DISEQC_SEND_MASTER_CMD — Sends a DiSEqC command
ioctl FE_DISEQC_RECV_SLAVE_REPLY — Receives reply from a DiSEqC 2.0 command
ioctl FE_DISEQC_SEND_BURST — Sends a 22KHz tone burst for 2x1 mini DiSEqC satellite selection.
ioctl FE_SET_TONE — Sets/resets the generation of the continuous 22kHz tone.
ioctl FE_SET_VOLTAGE — Allow setting the DC level sent to the antenna subsystem.
ioctl FE_ENABLE_HIGH_LNB_VOLTAGE — Select output DC level between normal LNBf voltages or higher LNBf voltages.
ioctl FE_SET_FRONTEND_TUNE_MODE — Allow setting tuner mode flags to the frontend.
Use the proper format for FE_SET_VOLTAGE documentation and fix
the documentation. The description for the enum is not 100%,
and it is missing the voltage off value.
Also, it is better to keep the enum description together with
the ioctl, as both are used together.
[media] DocBook: move FE_GET_PROPERTY to its own xml file
That helps the xref logic at the Makefile to point to the
right place. Also, it becomes more organized and easier to
maintain if each ioctl have its own xml file.
[media] DocBook: Improve xref check for undocumented ioctls
There are several badly documented undocumented ioctls.
Currently, it just generates an empty link. Instead of doing that,
only add references to the ones that exists, and add a warning
for all references that weren't found.
[media] DocBook: move DVB properties to happen earlier at the document
The DVBv5 API uses DVB properties as the main way to set the frontend
and collect statistics. Move the definition to happen earlier, in
order to reflect its importance.
[media] DocBook: move FE_GET_INFO to a separate xml file
Keeping everything altogether makes harder to reorganize the
DocBook. So, move the FE_GET_INFO ioctl and the associated structures
into a separate file.
The DVB part of the docbook has a completely different format
than the V4L2 part, as it was written as a separate document.
As the V4L2 documentation is on better shape, and its format
allows adding more information, let's use it for FE_GET_INFO
and gradually update the non-legacy DVB ioctls using the new
format.
[media] dvb: split enum from typedefs at frontend.h
Using typedefs is already bad enough, but doing it together
with enum declaration is even worse.
Also, it breaks the scripts at DocBook that would be generating
reference pointers for the enums.
Well, we can't get rid of typedef right now, but let's at least
declare it on a separate line, and let the scripts to generate
the cross-reference, as this is needed for the next DocBook
patches.
[media] DocBook: add drawing with a typical media device
An illustration of what's considered a typical media device
may help people to better understand the contents of the media
infrastructure API docbook. So, add it.
The Docbook mistakenly makes to believe that all needed APIs for
media devices are there. Add a note there pointing that some
sub-devices are actually be controlled via ALSA API.
[media] DocBook: Update DVB supported standards at introduction
The list of standards at the media docbook is incomplete, and it
is mentioning that the DVB-S2 & friends is "currently being updated".
That's wrong, as such update occurred back in 2008.
So, provide a more complete list of supported standards and add
a reference to the actual list.
drivers/media/tuners/e4000.c:287:32: warning: constant 2208000000 is so big it is long long
drivers/media/tuners/e4000.c:287:32: warning: decimal constant 2208000000 is between LONG_MAX and ULONG_MAX. For C99 that means long long, C90 compilers are very likely to produce unsigned long (and a warning) here
drivers/media/tuners/e4000.c:287:3: warning: this decimal constant is unsigned only in ISO C90
.rangehigh = 2208000000,
^
Cc: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Antti Palosaari [Tue, 21 Apr 2015 20:13:39 +0000 (17:13 -0300)]
[media] e4000: various small changes
* Rename device state from 's' to 'dev'.
* Move single include to driver private header.
* Change error handling type of each function to one I tend use
nowadays.
* Remove dummy register write from init. Even Windows driver does this
multiple times remove it as I have never seen any I2C errors.
* Define I2C client pointer for each function and use it.
* Do not clean tuner ops during driver remove - not needed.
* Disable sysfs device bind / unbind. We are not allowed manually
bind / unbind device from the driver currently.
* Rename some other variables.
Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Antti Palosaari [Wed, 22 Apr 2015 00:18:45 +0000 (21:18 -0300)]
[media] e4000: revise synthesizer calculation
Update synthesizer calculation to model I prefer nowadays. It is
mostly just renaming some variables to ones I think are most standard.
Also add 'schematic' of synthesizer following my current understanding.
Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Dan Carpenter [Thu, 14 May 2015 08:39:17 +0000 (05:39 -0300)]
[media] rtl2832_sdr: cleanup some set_bit() calls
This code works fine but static checkers complain. The test_bit()
function takes the bit number and not a mask. Then the other issue is
that we were using USB_STATE_URB_BUF which is BIT(0) instead of URB_BUF.
Also we were open coding that instead of using the test/clear/set_bit()
functions.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Hans Verkuil [Tue, 12 May 2015 11:52:21 +0000 (08:52 -0300)]
[media] cobalt: add new driver
The cobalt device is a PCIe card with 4 HDMI inputs (adv7604) and a
connector that can be used to hook up an adv7511 transmitter or an
adv7842 receiver daughterboard.
This device is used within Cisco but is sadly not available outside
of Cisco. Nevertheless it is a very interesting driver that can serve
as an example of how to support HDMI hardware and how to use the popular
adv devices.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
[media] v4l2-subdev: allow subdev to send an event to the v4l2_device notify function
All drivers use custom notifications, in particular when source changes.
The bridge only has to map the subdev that sends it to whatever video node it is connected to.
Hans Verkuil [Tue, 20 Jan 2015 15:18:16 +0000 (12:18 -0300)]
[media] vb2: allow requeuing buffers while streaming
vb2_buffer_done() already allows STATE_QUEUED, but currently only when not
streaming. It is useful to allow it while streaming as well, as this makes
it possible for drivers to requeue buffers while waiting for a stable
video signal.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Hans Verkuil [Fri, 1 May 2015 14:31:30 +0000 (11:31 -0300)]
[media] adv7842: Make output format configurable through pad format operations
Replace the dummy video format operations by pad format operations that
configure the output format.
Copied from the adv7604 driver.
Note: while arch/blackfin/mach-bf609/boards/ezkit.c uses adv7842_platform_data
this source has not been updated because it is broken since the very
beginning. It depends on a struct adv7842_output_format that does not
exist.
And besides that gcc has no support for bf609 so nobody can compile it
except by installing a toolchain from ADI.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Cc: Scott Jiang <scott.jiang.linux@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/dvb-frontends/cx24120.c:1182:5: warning: no previous prototype for 'cx24120_init' [-Wmissing-prototypes]
int cx24120_init(struct dvb_frontend *fe)
^
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com> Signed-off-by: Patrick Boettcher <patrick.boettcher@posteo.de>
[media] cx24120: don't initialize a var that won't be used
As reported by smatch:
drivers/media/dvb-frontends/cx24120.c: In function 'cx24120_message_send':
drivers/media/dvb-frontends/cx24120.c:368:6: warning: variable 'ret' set but not used [-Wunused-but-set-variable]
int ret, ficus;
^
The values written by cx24120 are never checked. So, remove the
check here too. That's said, the best would be to do the reverse,
but globally: to properly handle the error codes.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com> Signed-off-by: Patrick Boettcher <patrick.boettcher@posteo.de>
Jemma Denson [Fri, 15 May 2015 19:08:26 +0000 (16:08 -0300)]
[media] cx24120: Complete modfec_table
Add in all the likely values for setting fec on tuning. Some values
yet to be tested but very likely to be correct.
In the very unlikely event that these are wrong tuning with
FEC_AUTO will still work.
Jemma Denson [Fri, 15 May 2015 18:40:29 +0000 (15:40 -0300)]
[media] b2c2: Reset no_base_addr on skystarS2 attach failure
If set, all the other drivers reset no_base_addr on failure to
attach - git commit for this being added to some of them seems to
be eccd15aad72f774b2059f708bc422dbb8493bb30
This driver has been floating around outside the mainline for so
long it hasn't had this fix, so add it in.
Whilst here tidy surrounding code to fix style issues.
Jemma Denson [Fri, 8 May 2015 19:57:56 +0000 (16:57 -0300)]
[media] cx24120: Remove unneccesary assignments in cx24120_init
Probably a remnant of this driver being reverse engineered,
cx24120_init assigned ret on each call to writereg - they're not
used for anything so remove them to clear up the codebase.
Jemma Denson [Fri, 8 May 2015 19:34:31 +0000 (16:34 -0300)]
[media] cx24120: Tidy up calls to dev_dbg
Remove __func__ from calls to dev_dbg as dynamic debug can add in
the function name anyway.
Remove debug call in dvbv3 read_signal_strength as userspace has
this value anyway.
Reword some strings to make them simpler / more obvious.
Jemma Denson [Tue, 5 May 2015 21:33:27 +0000 (18:33 -0300)]
[media] cx24120: Fix disecq_send_burst command
Previous version of this driver had a memset before every call
to cmd. This meant the default value of cmd.arg[1] was zero unless
burst is set. Make sure it remains zero.
Also fe_sec_mini_cmd_t is an enum, so test against it.
Jemma Denson [Tue, 5 May 2015 20:47:55 +0000 (17:47 -0300)]
[media] cx24120: Return DVBv3 signal strength from cache
This patch changes DVBv3 signal strength to read from the cache by
moving the signal strength reading routine into get_stat, and
reducing read_signal_strength to just returning the cached value.
Jemma Denson [Tue, 5 May 2015 20:18:11 +0000 (17:18 -0300)]
[media] cx24120: Remove additional calls to read_status
get_frontend was making a call to read_status, which is being
called periodically anyway. Have read_status store fe_status in
the state struct instead and use that within get_frontend.
Jemma Denson [Tue, 5 May 2015 19:59:27 +0000 (16:59 -0300)]
[media] cx24120: Add DVBv5 signal strength stats
Add new get_stats function, called from read_status, for
collecting DVBv5 stats into the frontend cache. Only signal
strength for now, can add others later.
Not currently marked as available, future patch will enable.
Jemma Denson [Sun, 3 May 2015 11:55:15 +0000 (08:55 -0300)]
[media] cx24120: Rework vco function to remove xxyyzz variable
Change calculate_vco function to send_vco to tidy up cx24120_init
function.
xxyyzz variable is remnants of a manual div & remainder codepath
to perform a u64 rounded div; replace with kernel macro
DIV_ROUND_CLOSEST_ULL
Hex values provided to the message are mainly variables calculated
within this function, replace with these to remove hardcoding.
[media] cx24120: Add missing command to cx24120_check_cmd
This patch adds in a missing command to cx24120_check_cmd. This part
of the old reverse engineered driver was quite hard to follow - it's
presumed the compiler did some neat optimisation that wasn't easy to
decode. This command was checked for in that version but not copied
across to the new switch statement.
For reference, old reverse engineered code:
xxzz = cmd->id - 0x11; // look for specific message id
if ( xxzz <= 0x13 ) {
msg_cmd_mask = 1 << xxzz;
//0x0F8021 // if cmd_id 17 or 22 or 33-36, 42, 47, 57-61 etc. disable mpeg output
if ( msg_cmd_mask & 0x0F8021 ) { // 000011111000000000100001b
cx24120_msg_mpeg_output_global_config(state, 0);
msleep(100);
state->dvb_s2_mode &= 0xFD; // reset mpeg out enable flag
}
}
[media] cx24120: i2c-max-write-size is now configurable
Some i2c-hosts are quite limited regarding maximum
i2c-burst-write-sizes. This patch makes the previously
hardcoded field configurable by users of the driver.
Signed-off-by: Patrick Boettcher <patrick.boettcher@posteo.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
This patch adds support for the Technisat Skystar S2 - this
has been tried before but the cx24120 driver was a bit out of shape
and it didn't got any further:
https://patchwork.linuxtv.org/patch/10575/
It is an old card, but currently being sold off for next to nothing,
so it's proving quite popular of late. Noticing it's quite similar
to the cx24116 and cx24117 I've rewritten the driver in a similar way.
There were a few registers and commands from those drivers
missing from this one I've tested out and found they do something so
they've been added in to speed up tuning and to make get_frontend
return something useful.
Hans Verkuil [Thu, 7 May 2015 06:26:21 +0000 (03:26 -0300)]
[media] rcar-vin: use monotonic timestamps
Even though the rcar-vin driver tells userspace that it will give a monotonic
timestamp, it is actually using gettimeofday. Replace this with a proper
monotonic timestamp.