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.
Prashant Laddha [Tue, 5 May 2015 13:16:27 +0000 (10:16 -0300)]
[media] v4l2-dv-timings: fix overflow in gtf timings calculation
The intermediate calculation in the expression for hblank can exceed
32 bit signed range. This overflow can lead to negative values for
hblank. Typecasting intermediate variable to higher precision.
Cc: Martin Bugge <marbugge@cisco.com> Signed-off-by: Prashant Laddha <prladdha@cisco.com>
[hans.verkuil@cisco.com: made the denominator u32, since that's what div_u64 expects] Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Antti Palosaari [Mon, 4 May 2015 00:42:02 +0000 (21:42 -0300)]
[media] fc2580: implement V4L2 subdevice for SDR control
Implement V4L2 subdevice for bandwidth and frequency controls of
SDR usage. That driver now implements both DVB frontend and V4L2
subdevice. Driver itself is I2C driver. Lets see how it works.
Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Antti Palosaari [Wed, 15 Apr 2015 18:01:22 +0000 (15:01 -0300)]
[media] af9035: fix device order in ID list
Driver supports multiple chipset versions. Devices are ordered to
ID table per used chipset type. "ITE 9303 Generic" device uses IT9303
chipset and was added mistakenly between IT9135 IDs.
Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Antti Palosaari [Wed, 15 Apr 2015 15:10:54 +0000 (12:10 -0300)]
[media] fc2580: improve set params logic
Calculate PLL dividers slightly differently, most likely it is now
correct. Move some register values to innitab. Use jiffies to poll
filter lock. Fix logging.
Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
[media] dib0700: avoid the risk of forgetting to add the adapter's size
For every frontend entry, we need to add the adapter's size. There
are already two patches fixing it. So, it doesn't seem trivial to
keep it there at the right place.
Also, currently, the indentation is wrong on all places.
So, it seems that keeping it right is not too trivial.
Better to use a macro that would do it for us, at least while
this is not converted to dvb-usb-v2.
[media] saa7164: use an MSI interrupt when available
Enhances driver to use an MSI interrupt when available.
Adds the module option 'enable_msi' (type bool) which by default is
enabled. Can be set to 'N' to disable.
Fixes (or can reduce the occurrence of) a crash which is most commonly
reported when both digital tuners of the saa7164 chip is in use. A
reported example can be found here:
http://permalink.gmane.org/gmane.linux.drivers.video-input-infrastructure/83948
David Howells [Thu, 9 Apr 2015 19:36:49 +0000 (16:36 -0300)]
[media] dvb: Document FE_SCALE_DECIBEL units consistently
In comments and in the documentation, the units of properties marked
with the FE_SCALE_DECIBEL scale are specified in terms of 1/1000 dB
or 0.0001 dB. This is inconsistent, however, as 1/1000 is 0.001,
not 0.0001.
Note that the v4l-utils divide the value by 1000 for the signal
strength suggesting that the 1/1000 is correct.
Settle on millidecibels, ie. 1/1000dB or 0.001dB.
Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Antti Seppälä [Tue, 31 Mar 2015 17:48:12 +0000 (14:48 -0300)]
[media] rc: nuvoton-cir: Add support for writing wakeup samples via sysfs filter callback
Nuvoton-cir utilizes the encoding capabilities of rc-core to convert
scancodes from user space to pulse/space format understood by the
underlying hardware.
Converted samples are then written to the wakeup fifo along with other
necessary configuration to enable wake up functionality.
Signed-off-by: Antti Seppälä <a.seppala@gmail.com> Signed-off-by: James Hogan <james@albanarts.com> Cc: Jarod Wilson <jarod@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
James Hogan [Tue, 31 Mar 2015 17:48:11 +0000 (14:48 -0300)]
[media] rc: rc-loopback: Add loopback of filter scancodes
Add the s_wakeup_filter callback to the rc-loopback driver, which instead of
setting the filter just feeds the scancode back through the input device
so that it can be verified.
Signed-off-by: James Hogan <james@albanarts.com> Signed-off-by: Antti Seppälä <a.seppala@gmail.com> Cc: David Härdeman <david@hardeman.nu> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
James Hogan [Tue, 31 Mar 2015 17:48:10 +0000 (14:48 -0300)]
[media] rc: rc-core: Add support for encode_wakeup drivers
Add support in rc-core for drivers which implement the wakeup scancode
filter by encoding the scancode using the raw IR encoders. This is by
way of rc_dev::encode_wakeup which should be set to true to make the
allowed wakeup protocols the same as the set of raw IR encoders.
As well as updating the sysfs interface to know which wakeup protocols
are allowed for encode_wakeup drivers, also ensure that the IR
decoders/encoders are loaded when an encode_wakeup driver is registered.
Signed-off-by: James Hogan <james@albanarts.com> Signed-off-by: Antti Seppälä <a.seppala@gmail.com> Cc: David Härdeman <david@hardeman.nu> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Antti Seppälä [Tue, 31 Mar 2015 17:48:09 +0000 (14:48 -0300)]
[media] rc: ir-rc6-decoder: Add encode capability
Add the capability to encode RC-6 and RC-6A scancodes as raw events.
The protocol is chosen based on the specified protocol mask, and
whether all the required bits are set in the scancode mask, and none of
the unused bits are set in the scancode data.
The Manchester modulation helper is used several times with various
timings so that RC-6 header preamble, the header, header trailing bit
and the data itself can be modulated correctly.
Signed-off-by: Antti Seppälä <a.seppala@gmail.com> Cc: James Hogan <james@albanarts.com> Cc: David Härdeman <david@hardeman.nu> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
James Hogan [Tue, 31 Mar 2015 17:48:08 +0000 (14:48 -0300)]
[media] rc: ir-rc5-decoder: Add encode capability
Add the capability to encode RC-5, RC-5X and RC-5-SZ scancodes as raw
events. The protocol is chosen based on the specified protocol mask,
and whether all the required bits are set in the scancode mask, and
none of the unused bits are set in the scancode data. For example a
scancode filter with bit 16 set in both data and mask is unambiguously
RC-5X.
The Manchester modulation helper is used, and for RC-5X it is used twice
with two sets of timings, the first with a short trailer space for the
space in the middle, and the second with no leader so that it can
continue the space.
The encoding in RC-5-SZ first inserts a pulse and then simply utilizes
the generic Manchester encoder available in rc-core.
Signed-off-by: James Hogan <james@albanarts.com> Signed-off-by: Antti Seppälä <a.seppala@gmail.com> Cc: David Härdeman <david@hardeman.nu> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Add a callback to raw ir handlers for encoding and modulating a scancode
to a set of raw events. This could be used for transmit, or for
converting a wakeup scancode filter to a form that is more suitable for
raw hardware wake up filters.
Signed-off-by: James Hogan <james@albanarts.com> Signed-off-by: Antti Seppälä <a.seppala@gmail.com> Cc: David Härdeman <david@hardeman.nu> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Antti Palosaari [Wed, 29 Apr 2015 16:37:34 +0000 (13:37 -0300)]
[media] msi2500: cleanups
Rename state to dev.
Correct some indentations.
Remove FSF address.
Fix some style issues reported by checkpatch.pl.
Correct some style issues I liked.
Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Antti Palosaari [Wed, 29 Apr 2015 16:13:31 +0000 (13:13 -0300)]
[media] msi2500: revise synthesizer calculation
Update synthesizer calculation to model I prefer nowadays. It is mostly
just renaming some variables, but also minor functionality change how
integer and fractional part are divided (using div_u64_rem()). 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>
Antti Palosaari [Wed, 29 Apr 2015 13:10:01 +0000 (10:10 -0300)]
[media] msi001: revise synthesizer calculation
Update synthesizer calculation to model I prefer nowadays. It is mostly
just renaming some variables, but also minor functionality change how
integer and fractional part are divided (using div_u64_rem()). 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>
Thomas Reitmayr [Fri, 1 May 2015 23:18:04 +0000 (20:18 -0300)]
[media] media: Fix regression in some more dib0700 based devices
Fix an oops during device initialization by correctly setting size_of_priv
instead of leaving it 0.
The regression was introduced by 8abe4a0a3f6d4217b16a ("[media] dib7000:
export just one symbol") and only fixed for one type of dib0700 based
devices in 9e334c75642b6e5bfb95 ("[media] Fix regression in some dib0700
based devices").
Fixes: 8abe4a0a3f6d4217b16a ("[media] dib7000: export just one symbol") Cc: stable@vger.kernel.org # for version 3.17+ Signed-off-by: Thomas Reitmayr <treitmayr@devbase.at> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Olli Salonen [Tue, 5 May 2015 16:33:55 +0000 (13:33 -0300)]
[media] dw2102: resync fifo when demod locks
If the streaming_ctrl is called to enable TS before demod has locked
the TS will be empty. Copied the solution from the dvbsky driver for the
TechnoTrend S2-4600 device: when the state changes from unlock to
lock, call su3000_streaming_ctrl again.
Signed-off-by: Olli Salonen <olli.salonen@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Olli Salonen [Tue, 5 May 2015 16:33:52 +0000 (13:33 -0300)]
[media] dw2102: remove unnecessary printing of MAC address
While reading the MAC address for SU3000-based devices the system was
printing excessive debug information in the logs:
Output before the patch:
[ 1515.780692] bc 00 00 00 00 00
[ 1515.781440] bc ea 00 00 00 00
[ 1515.782251] bc ea 2b 00 00 00
[ 1515.783094] bc ea 2b 46 00 00
[ 1515.783816] bc ea 2b 46 12 00
[ 1515.784565] bc ea 2b 46 12 92
[ 1515.784571] dvb-usb: MAC address: bc:ea:2b:46:12:92
Output after the patch:
[ 3803.495706] dvb-usb: MAC address: bc:ea:2b:46:12:92
Signed-off-by: Olli Salonen <olli.salonen@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Dan Carpenter [Tue, 21 Apr 2015 09:31:10 +0000 (06:31 -0300)]
[media] v4l: xilinx: harmless buffer overflow
My static checker warns that the name of the port can be 15 characters
when you consider the NUL terminator and that's one more than the 14
characters in name[]. Maybe it's an off-by-one?
It's unlikely that we hit the limit and even if we do the overflow will
only affect one of the two bytes of padding so it's harmless. Still
let's fix it and also change the sprintf() to snprintf().
Building for avr32 leads the following build warning:
drivers/media/rc/st_rc.c:270: warning: passing argument 1 of 'IS_ERR' discards qualifiers from pointer target type
drivers/media/rc/st_rc.c:271: warning: passing argument 1 of 'PTR_ERR' discards qualifiers from pointer target type
devm_ioremap_resource() returns void __iomem *, so change 'base' and
'rx_base' definitions accordingly.
Building for avr32 leads the following build warning:
drivers/media/rc/ir-hix5hd2.c:221: warning: passing argument 1 of 'IS_ERR' discards qualifiers from pointer target type
drivers/media/rc/ir-hix5hd2.c:222: warning: passing argument 1 of 'PTR_ERR' discards qualifiers from pointer target type
devm_ioremap_resource() returns void __iomem *, so change 'base' definition
accordingly.
In a rarely hit randconfig case, the r820t tuner driver can
get built when CONFIG_BITREVERSE is not selected by any
other driver, resulting in this error:
drivers/built-in.o: In function `r820t_read.constprop.3':
:(.text+0xa0594): undefined reference to `byte_rev_table'
For consistency, this adds the 'select BITREVERSE' that
all other similar drivers have.
drivers/media/platform/exynos4-is/fimc-is-i2c.c: In function 'fimc_is_i2c_probe':
drivers/media/platform/exynos4-is/fimc-is-i2c.c:58:8: error: implicit declaration of function 'i2c_add_adapter' [-Werror=implicit-function-declaration]
The dependency already exists for exynos-fimc-lite and s5p-fimc,
but is missing for exynos4-fimc.
The debug macros are not properly defined, as they generate warnings
like:
ERROR: Macros with complex values should be enclosed in parentheses
+#define core_dbg(fmt, arg...) if (core_debug) \
+ printk(KERN_DEBUG pr_fmt("core: " fmt), ## arg)
[media] saa7134-ts: use pr_fmt() at the debug macro
instead of using dev->name, let's use pr_fmt() like on the
other parts of saa7134. Also, rename the debug macro to
ts_dbg() to match the namespace for the debug macros.
[media] saa7134-i2c: make debug macros to use pr_fmt()
Converting debug prints to use pr_foo() is not trivial, as the
result will be a way worse than what's provided here, due to the
pieces of the code that prints the I2C transfers. Those use a
lot pr_cont(), and, depending on using either level 1 or 2,
a different set of macros are selected.
So, let's replace d1printk() and d2printk() macros by i2c_dbg()
and i2c_count() adding a debug level there.
On media drivers, debugging messages should be grouped into
categories, as this makes easier to debug the driver.
In the case of saa7134, the core has 2 debug categories, one
for IRQ, and another one for the core itself. The IRQ have
actually 2 levels of debug.
So, instead of using pr_dbg(), where everything would be in
the same box, let's define two macros that use pr_fmt(),
one for the core, and another one for irq.
With that, we can replace the remaining printk() occurrences
at the core to use either core_dbg() or irq_dbg(), depending
on the group of debug macros that need to be enabled.
[media] saa7134: instead of using printk KERN_foo, use pr_foo
Replaces all occurrences of printk with KERN_INFO, KERN_WARNING
and KERN_ERR to pr_info/pr_warning, pr_err, using this small
shell script:
for i in drivers/media/pci/saa7134/*.[ch]; do sed s,'printk(KERN_INFO ','pr_info(',g <$i >a && mv a $i; done
for i in drivers/media/pci/saa7134/*.[ch]; do sed s,'printk(KERN_ERR ','pr_err(',g <$i >a && mv a $i; done
for i in drivers/media/pci/saa7134/*.[ch]; do sed s,'printk(KERN_WARNING ','pr_warn(',g <$i >a && mv a $i; done
[media] rtl28xxu: fix return value check in rtl2832u_tuner_attach()
In case of error, the function platform_device_register_data() returns
ERR_PTR() and never returns NULL. The NULL test in the return value check
should be replaced with IS_ERR().
[media] mn88472: Fix possible leak in mn88472_init()
Commit 307e95c92257 ("[media] mn88472: implement firmware parity check")
introduced the usage of exit paths that do not free the already allocated
firmware data in case the parity handling fails. Go through the correct
exit paths. Detected by Coverity CID 1295989.
Signed-off-by: Christian Engelmayer <cengelma@gmx.at> Acked-by: Benjamin Larsson <benjamin@southpole.se> Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Olli Salonen [Tue, 5 May 2015 16:54:19 +0000 (13:54 -0300)]
[media] rtl2832: add support for GoTView MasterHD 3 USB tuner
GoTView MasterHD 3 is a DVB-T2/C USB 2.0 tuner.
It's based on the following components:
- USB bridge: RTL2832P (contains also DVB-T demodulator)
- Demodulator: Si2168-A30
- Tuner: Si2148-A20
The demodulator and the tuner will need firmwares. The Si2148 uses Si2158
firmware. Antti has the firmwares available for download:
http://palosaari.fi/linux/v4l-dvb/firmware/
Do note that for DVB-T either of the demodulators can be used. DVB-C and
DVB-T2 are only supported by the Si2168 demodulator. The driver will
register 2 frontends for the same adapter. Frontend 0 will be the RTL2832
demodulator and frontend 1 will be the Si2168 demodulator. The same
tuner is used for both.
As a consequence of the above, it's recommended to use application that
does implement proper DVBv5 support.
For some reason, the old I2C write method sporadically fails. Thus the
need for an option to only use the new I2C write method supported by the
RTL2832.
Signed-off-by: Olli Salonen <olli.salonen@iki.fi> Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Olli Salonen [Tue, 5 May 2015 16:54:17 +0000 (13:54 -0300)]
[media] si2157: support selection of IF interface
The chips supported by the si2157 driver have two IF outputs (either
pins 12+13 or pins 9+11). Instead of hardcoding the output to be used
add an option to choose which output shall be used.
As this patch changes the default behaviour, the IF interface is
specified in each driver currently using si2157 driver. This is to
keep bisectability.
Signed-off-by: Olli Salonen <olli.salonen@iki.fi> Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Olli Salonen [Sat, 21 Mar 2015 20:42:23 +0000 (17:42 -0300)]
[media] dw2102: TeVii S482 support
TeVii S482 is a PCIe device with two tuners that actually contains two
USB devices. The devices are visible in the lsusb printout.
Bus 006 Device 002: ID 9022:d483 TeVii Technology Ltd.
Bus 007 Device 002: ID 9022:d484 TeVii Technology Ltd.
The device itself works exactly with the same settings as TechnoTrend
TT-connect S2-4600. Firmware for DS3103 demodulator is required:
http://palosaari.fi/linux/v4l-dvb/firmware/M88DS3103/
This patch should be applied on top of the TT S2-4600 patch:
https://patchwork.linuxtv.org/patch/28818/
Signed-off-by: Olli Salonen <olli.salonen@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Hans Verkuil [Fri, 24 Apr 2015 09:52:47 +0000 (06:52 -0300)]
[media] marvell-ccic: fix RGB444 format
The RGB444 format swapped the red and blue components, fix this.
Rather than making a new BGR444 format (as I proposed initially), Jon prefers
to just fix this and return the colors in the right order. I think that makes
sense in this case.
Since the RGB444 pixel format is deprecated due to the ambiguous specification
of the alpha component we use the XRGB444 pixel format instead (specified as having
no alpha channel).
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Acked-by: Jonathan Corbet <corbet@lwn.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>