Mauro Carvalho Chehab [Wed, 3 May 2017 02:12:22 +0000 (23:12 -0300)]
media: em28xx: Ignore errors while reading from eeprom
While testing support for Terratec H6 rev. 2, it was noticed
that reading from eeprom there causes a timeout error.
Apparently, this is due to the need of properly setting GPIOs.
In any case, the driver doesn't really require eeprom reading
to succeed, as this is currently used only for debug.
So, Ignore such errors.
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Acked-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Dan Carpenter [Fri, 28 Apr 2017 12:53:31 +0000 (09:53 -0300)]
media: dib0700: fix error handling in dib0700_i2c_xfer_legacy()
Mostly this adds some unlocks to error paths. But, if you see where
there were "break;" statements before, I changed those paths to return
error codes instead of returning success.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Dan Carpenter [Fri, 28 Apr 2017 12:52:07 +0000 (09:52 -0300)]
media: dib0700: fix locking in dib0700_i2c_xfer_new()
This patch mostly adds unlocks to error paths. But one additional small
change is that I made the first "break;" a "goto unlock;" which means
that now we return failure instead of success on that path.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Gustavo A. R. Silva [Thu, 22 Jun 2017 03:20:59 +0000 (00:20 -0300)]
media: tuners: mxl5005s: remove useless variable assignments
Values assigned to variables Fmax and Fmin at lines 2740 and 2741 are
overwritten at lines 2754 and 2755 before they can be used. This makes
such variable assignments useless.
Addresses-Coverity-ID: 1226952
Addresses-Coverity-ID: 1226953
Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Mauro Carvalho Chehab [Sat, 24 Jun 2017 16:15:49 +0000 (13:15 -0300)]
media: imx.rst: add it to v4l-drivers book
Avoid the following warning when building documentation:
checking consistency... /devel/v4l/patchwork/Documentation/media/v4l-drivers/imx.rst:: WARNING: document isn't included in any toctree
While here, avoid placing all driver authors at just one line at
the html/pdf output.
Acked-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Mauro Carvalho Chehab [Sat, 24 Jun 2017 16:02:01 +0000 (13:02 -0300)]
media: dtv-core.rst: explain how to get DVBv5 statistics
It is not trivial to implement the logic that collects DVBv5
statistics. As we're seein lately too many implementations
that are not quite right when reviewing patchsets, add a
detailed explanation, adding a few examples about the right
thing to be done.
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Daniel Scheller [Wed, 21 Jun 2017 20:10:54 +0000 (17:10 -0300)]
media: dvb-frontends/stv0367: deduplicate DDB dvb_frontend_ops caps
Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Daniel Scheller [Wed, 21 Jun 2017 16:53:47 +0000 (13:53 -0300)]
media: ddbridge: use dev_* macros in favor of printk
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>
Daniel Scheller [Fri, 23 Jun 2017 16:37:40 +0000 (13:37 -0300)]
media: ddbridge: make (ddb)readl in while-loops fail-safe
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>
Philipp Zabel [Fri, 23 Jun 2017 09:54:09 +0000 (06:54 -0300)]
media: coda: rename the picture run timeout error handler
I would have liked the the picture run timeout error handler to be renamed to
something a bit more descriptive in the original commit
fb2be08f8cb3 ("[media]
coda: first step at error recovery").
Somehow v1 [1] was merged instead of v2 [2].
[1] https://patchwork.kernel.org/patch/9663965/
[2] https://patchwork.kernel.org/patch/9774239/
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Colin Ian King [Thu, 22 Jun 2017 17:27:21 +0000 (14:27 -0300)]
media: venus: fix loop wrap in cleanup of clks
The current pre-decrement is incorrect and should be replaced
with a post-decrement. Consider the case where the very first
clk_prepare_enable fails when i is 0; in this case the error
clean up will decrement the unsigned int which wraps to the
largest unsigned int value causing an array out of bounds read
on core->clks[i].
Detected by CoverityScan, CID#1446590 ("Out-of-bounds read")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Gustavo A. R. Silva [Thu, 22 Jun 2017 04:01:22 +0000 (01:01 -0300)]
media: radio: wl1273: add check on core->write() return value
Check return value from call to core->write(), so in case of
error print error message, jump to goto label fail and eventually
return.
Addresses-Coverity-ID: 1226943
Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Arnd Bergmann [Wed, 21 Jun 2017 22:10:32 +0000 (19:10 -0300)]
media: rainshadow-cec: avoid -Wmaybe-uninitialized warning again
Back in April I created a patch to address a false-positive warning:
drivers/media/usb/rainshadow-cec/rainshadow-cec.c: In function 'rain_irq_work_handler':
drivers/media/usb/rainshadow-cec/rainshadow-cec.c:171:31: error: 'data' may be used uninitialized in this function [-Werror=maybe-uninitialized]
My patch was totally wrong and introduced a real bug, and Colin Ian King thankfully
noticed it now and fixed my mistake. Unfortunately, fixing the actual uninitialized
data in this case brought back the original bogus warning.
This is a new version of the patch, which simplifies the code to the point where
gcc notices the behavior is correct.
Fixes:
ca33784ba494 ("[media] rainshadow-cec: ensure exit_loop is intialized")
Fixes:
ea6a69defd3311 ("[media] rainshadow-cec: avoid -Wmaybe-uninitialized warning")
Cc: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Joe Perches [Fri, 9 Jun 2017 19:09:08 +0000 (16:09 -0300)]
media: tuner-core: Remove unused #define PREFIX
Commit
680d87c0a9e3 ("[media] tuner-core: use pr_foo, instead of
internal printk macros") removed the use of PREFIX, remove the #define
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Joe Perches [Fri, 9 Jun 2017 17:54:57 +0000 (14:54 -0300)]
media: stkwebcam: Use more common logging styles
Convert STK_<LEVEL> to pr_<level> to use the typical kernel logging.
Add a define for pr_fmt. No change in logging output.
Miscellanea:
o Remove now unused PREFIX and STK_<LEVEL> macros
o Realign arguments
o Use pr_<level>_ratelimited
o Add a few missing newlines to formats
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Philipp Zabel [Thu, 8 Jun 2017 09:21:13 +0000 (06:21 -0300)]
media: coda: ctx->codec is not NULL in coda_alloc_framebuffers
This fixes a smatch warning:
drivers/media/platform/coda/coda-bit.c:415 coda_alloc_framebuffers()
error: we previously assumed 'ctx->codec' could be null (see line 396)
coda_alloc_framebuffers() is called from coda_start_encoding() and
__coda_start_decoding(). Both dereference ctx->codec before calling
coda_alloc_framebuffers() in lines 935 and 1649, so ctx->codec can not
be NULL.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Arnd Bergmann [Thu, 8 Jun 2017 09:01:37 +0000 (06:01 -0300)]
media: Revert "[media] et8ek8: Export OF device ID as module aliases"
This one got applied twice, causing a build error with clang:
drivers/media/i2c/et8ek8/et8ek8_driver.c:1499:1: error: redefinition of '__mod_of__et8ek8_of_table_device_table'
Fixes:
9ae05fd1e791 ("[media] et8ek8: Export OF device ID as module aliases")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Markus Elfring [Thu, 4 May 2017 17:14:15 +0000 (14:14 -0300)]
media: bdisp-debug: Replace a seq_puts() call by seq_putc() in seven functions
Seven single characters (line breaks) should be put into a sequence.
Thus use the corresponding function "seq_putc".
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Kieran Bingham [Tue, 3 Jan 2017 13:12:11 +0000 (11:12 -0200)]
[media] media: entity: Catch unbalanced media_pipeline_stop calls
Drivers must not perform unbalanced calls to stop the entity pipeline,
however if they do they will fault in the core media code, as the
entity->pipe will be set as NULL. We handle this gracefully in the core
with a WARN for the developer.
Replace the erroneous check on zero streaming counts, with a check on
NULL pipe elements instead, as this is the symptom of unbalanced
media_pipeline_stop calls.
Signed-off-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pincharts@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Hans Verkuil [Mon, 8 May 2017 14:35:06 +0000 (11:35 -0300)]
[media] media/uapi/v4l: clarify cropcap/crop/selection behavior
Unfortunately the use of 'type' was inconsistent for multiplanar
buffer types. Starting with 4.13 both the normal and _MPLANE variants
are allowed, thus making it possible to write sensible code.
Yes, we messed up :-(
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
[hans.verkuil@cisco.com: 4.14 -> 4.13 since this would go in for 4.13 after all]
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Hans Verkuil [Mon, 8 May 2017 14:35:05 +0000 (11:35 -0300)]
[media] v4l2-ioctl/exynos: fix G/S_SELECTION's type handling
The type field in struct v4l2_selection is supposed to never use the
_MPLANE variants. E.g. if the driver supports V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE,
then userspace should still pass V4L2_BUF_TYPE_VIDEO_CAPTURE.
The reasons for this are lost in the mists of time, but it is really
annoying. In addition, the exynos drivers didn't follow this rule and
instead expected the _MPLANE type.
To fix that code is added to the v4l2 core that maps the _MPLANE buffer
types to their regular equivalents before calling the driver.
Effectively this allows for userspace to use either _MPLANE or the regular
buffer type. This keeps backwards compatibility while making things easier
for userspace.
Since drivers now never see the _MPLANE buffer types the exynos drivers
had to be adapted as well.
Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Helen Fornazier [Mon, 19 Jun 2017 17:00:21 +0000 (14:00 -0300)]
[media] vimc: sen: Declare vimc_sen_video_ops as static
Declare vimc_sen_video_ops as static, remove warning from sparse tool
Signed-off-by: Helen Koike <helen.koike@collabora.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Helen Fornazier [Mon, 19 Jun 2017 17:00:20 +0000 (14:00 -0300)]
[media] vimc: sca: Add scaler
Implement scaler and integrated with the core
Signed-off-by: Helen Koike <helen.koike@collabora.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Helen Fornazier [Mon, 19 Jun 2017 17:00:19 +0000 (14:00 -0300)]
[media] vimc: deb: Add debayer filter
Implement the debayer filter and integrate it with the core
Signed-off-by: Helen Koike <helen.koike@collabora.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Helen Fornazier [Mon, 19 Jun 2017 17:00:18 +0000 (14:00 -0300)]
[media] vimc: Subdevices as modules
Change the core structure for adding subdevices in the topology.
Instead of calling the specific create function for each subdevice,
inject a child platform_device with the driver's name.
Each type of node in the topology (sensor, capture, debayer, scaler)
will register a platform_driver with the corresponding name through the
component subsystem.
Implementing a new subdevice type doesn't require vimc-core to be altered.
This facilitates future implementation of dynamic entities, where
hotpluging an entity in the topology is just a matter of
registering/unregistering a platform_device in the system.
It also facilitates other implementations of different nodes without
touching the core code and remove the need of a header file for each
type of node.
Signed-off-by: Helen Koike <helen.koike@collabora.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Helen Fornazier [Mon, 19 Jun 2017 17:00:17 +0000 (14:00 -0300)]
[media] vimc: cap: Support several image formats
Allow user space to change the image format as the frame size, the
pixel format, colorspace, quantization, field YCbCr encoding
and the transfer function
Signed-off-by: Helen Koike <helen.koike@collabora.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Helen Fornazier [Mon, 19 Jun 2017 17:00:16 +0000 (14:00 -0300)]
[media] vimc: sen: Support several image formats
Allow user space to change the image format as the frame size, the
media bus pixel format, colorspace, quantization, field YCbCr encoding
and the transfer function
Signed-off-by: Helen Koike <helen.koike@collabora.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Helen Fornazier [Mon, 19 Jun 2017 17:00:15 +0000 (14:00 -0300)]
[media] vimc: common: Add vimc_colorimetry_clamp
Colorimetry value will always be checked in the same way. Adding a
helper macro for that
Signed-off-by: Helen Koike <helen.koike@collabora.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Helen Fornazier [Mon, 19 Jun 2017 17:00:14 +0000 (14:00 -0300)]
[media] vimc: common: Add vimc_link_validate
All links will be checked in the same way. Adding a helper function for
that
Signed-off-by: Helen Koike <helen.koike@collabora.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Helen Fornazier [Mon, 19 Jun 2017 17:00:13 +0000 (14:00 -0300)]
[media] vimc: common: Add vimc_pipeline_s_stream helper
Move the vimc_cap_pipeline_s_stream from the vimc-cap.c to vimc-common.c
as this core will be reused by other subdevices to activate the stream
in their directly connected nodes
Signed-off-by: Helen Koike <helen.koike@collabora.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Helen Fornazier [Mon, 19 Jun 2017 17:00:12 +0000 (14:00 -0300)]
[media] vimc: common: Add vimc_ent_sd_* helper
As all the subdevices in the topology will be initialized in the same
way, to avoid code repetition the vimc_ent_sd_{register, unregister}
helper functions were created
Signed-off-by: Helen Koike <helen.koike@collabora.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Helen Fornazier [Mon, 19 Jun 2017 17:00:11 +0000 (14:00 -0300)]
[media] vimc: Move common code from the core
Remove helper functions from vimc-core and add it in vimc-common to
clean up the core.
Signed-off-by: Helen Koike <helen.koike@collabora.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Helen Fornazier [Mon, 19 Jun 2017 17:00:10 +0000 (14:00 -0300)]
[media] vimc: sen: Integrate the tpg on the sensor
Initialize the test pattern generator on the sensor
Generate a colored bar image instead of a grey one
Signed-off-by: Helen Koike <helen.koike@collabora.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Jacopo Mondi [Fri, 12 May 2017 12:36:59 +0000 (09:36 -0300)]
[media] media: i2c: ov772x: Force use of SCCB protocol
Commit
e78902976150 ("i2c: sh_mobile: don't send a stop condition by
default inside transfers") makes the i2c_sh_mobile I2C-adapter emit a
stop/start sequence between messages in a single transfer only when
explicitly requested with I2C_M_STOP.
This breaks the ov772x driver in the SH4 Migo-R board as the Omnivision
sensor uses the I2C-like SCCB protocol that doesn't support repeated
starts:
i2c-sh_mobile i2c-sh_mobile.0: Transfer request timed out
ov772x 0-0021: Product ID error 92:92
Fix it by marking the client as SCCB, forcing the emission of a
stop/start sequence between all messages.
As I2C_M_STOP requires the I2C adapter to support protocol mangling,
ensure that the I2C_FUNC_PROTOCOL_MANGLING functionality is available.
Tested on SH4 Migo-R board, with OV772x now successfully probing
soc-camera-pdrv soc-camera-pdrv.0: Probing soc-camera-pdrv.0
ov772x 0-0021: ov7725 Product ID 77:21 Manufacturer ID 7f:a2
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Mauro Carvalho Chehab [Wed, 21 Jun 2017 09:51:51 +0000 (06:51 -0300)]
[media] dvb uapi docs: enums are passed by value, not reference
Since 2015, the documentation for FE_DISEQC_SEND_BURST, FE_SET_TONE
and FE_SET_VOLTAGE are incorrectly saying that the enums are passed
by reference. They aren't: they're passed by value.
Fix the documentation to reflect reality.
Fixes:
81959d996a3b ("[media] DocBook: better document FE_DISEQC_SEND_BURST ioctl")
Fixes:
d6b6d346e560 ("[media] DocBook: better document FE_SET_VOLTAGE ioctl")
Fixes:
6dc59e7a195f ("[media] DocBook: better document FE_SET_TONE ioctl")
Reported-by: Thierry Lelegard <thierry.lelegard@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Arnd Bergmann [Thu, 17 Sep 2015 21:19:34 +0000 (18:19 -0300)]
[media] dvb: don't use 'time_t' in event ioctl
'struct video_event' is used for the VIDEO_GET_EVENT ioctl, implemented
by drivers/media/pci/ivtv/ivtv-ioctl.c and
drivers/media/pci/ttpci/av7110_av.c. The structure contains a 'time_t',
which will be redefined in the future to be 64-bit wide, causing an
incompatible ABI change for this ioctl.
As it turns out, neither of the drivers currently sets the timestamp
field, and it is presumably useless anyway because of the limited
resolutions (no sub-second times). This means we can simply change
the structure definition to use a 'long' instead of 'time_t' and
remain compatible with all existing user space binaries when time_t
gets changed.
If anybody ever starts using this field, they have to make sure not
to use 1970 based seconds in there, as those overflow in 2038.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Stanimir Varbanov [Tue, 20 Jun 2017 13:13:50 +0000 (10:13 -0300)]
[media] media: venus: enable building with COMPILE_TEST
We want all media drivers to build with COMPILE_TEST, as the
Coverity instance we use on Kernel works only for x86. Also,
our test workflow relies on it, in order to identify git
bisect breakages.
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Antti Palosaari [Wed, 14 Jun 2017 01:58:06 +0000 (22:58 -0300)]
[media] af9013: refactor power control
Move power-up and power-down functionality to init/sleep ops and
get rid of old function.
Fixes and simplifies power-up functionality slightly.
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Antti Palosaari [Wed, 14 Jun 2017 00:49:33 +0000 (21:49 -0300)]
[media] af9013: refactor firmware download routine
Refactor firmware download routine.
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Antti Palosaari [Wed, 14 Jun 2017 00:32:08 +0000 (21:32 -0300)]
[media] af9015: move 2nd demod power-up wait different location
We need to wait 2nd demod power-up before download firmware. Move
that wait to more correct location.
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Antti Palosaari [Tue, 13 Jun 2017 23:42:52 +0000 (20:42 -0300)]
[media] af9013: remove unneeded register writes
Removed register writes are already chip defaults, are not required,
are set later or belong to AF9015 USB interface.
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Antti Palosaari [Tue, 13 Jun 2017 23:32:15 +0000 (20:32 -0300)]
[media] af9013: add configurable TS output pin
On serial TS mode output pin could be selected from D0 or D7.
Add configuration option to for it.
Rename TS mode config option prefix from AF9013_TS_ to AF9013_TS_MODE_.
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Antti Palosaari [Tue, 13 Jun 2017 08:29:50 +0000 (05:29 -0300)]
[media] af9015: enable 2nd TS flow control when dual mode
It needs to be enabled in order to get stream from slave af9013 demod.
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Antti Palosaari [Mon, 12 Jun 2017 20:06:19 +0000 (17:06 -0300)]
[media] af9015: fix and refactor i2c adapter algo logic
* fix write+read when write has more than one byte
* remove lock, not needed on that case
* remove useless i2c msg send loop, as we support only write, read and
write+read as one go and nothing more
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Antti Palosaari [Mon, 12 Jun 2017 18:10:08 +0000 (15:10 -0300)]
[media] af9013: add dvbv5 cnr
Add support for DVBv5 CNR.
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Antti Palosaari [Mon, 12 Jun 2017 17:32:36 +0000 (14:32 -0300)]
[media] af9013: fix error handling
Use typical (return 0/goto err/return err) error handling everywhere.
Add missing error handling where missing.
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Antti Palosaari [Mon, 12 Jun 2017 05:49:33 +0000 (02:49 -0300)]
[media] af9013: convert to regmap api
Use regmap for register access. Own low level i2c read and write
routines for regmap is still needed because chip uses single command
byte in addition to typical i2c register access.
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Antti Palosaari [Sun, 11 Jun 2017 01:04:30 +0000 (22:04 -0300)]
[media] af9013: fix logging
We can simplify logging as we now have a proper i2c client
to pass for kernel dev_* logging functions.
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Antti Palosaari [Sun, 11 Jun 2017 00:12:14 +0000 (21:12 -0300)]
[media] af9013: use kernel 64-bit division
Replace own binary division with 64-bit multiply and division.
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Antti Palosaari [Sat, 10 Jun 2017 23:53:42 +0000 (20:53 -0300)]
[media] af9013: add i2c client bindings
Add kernel i2c driver bindings.
That allows dev_* logging, regmap and more.
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Antti Palosaari [Sat, 10 Jun 2017 22:24:34 +0000 (19:24 -0300)]
[media] af9013: move config values directly under driver state
It shorten, as typed chars, access to config values as there is one
pointer less. Also, when config/platform data is passed to driver there
could be some values that are not relevant to store state as such or
not needed to store at all.
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Antti Palosaari [Sun, 5 Feb 2017 20:09:38 +0000 (18:09 -0200)]
[media] af9015: use correct 7-bit i2c addresses
Driver was using wrong "8-bit" i2c addresses for demods and tuners.
Internal demod i2c address was not set at all. These are needed
to be fixed before proper i2c client binding is used.
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Gustavo A. R. Silva [Thu, 15 Jun 2017 20:42:44 +0000 (17:42 -0300)]
[media] af9013: add check on af9013_wr_regs() return value
Check return value from call to af9013_wr_regs(), so in case of
error print debug message and return.
Addresses-Coverity-ID: 1227035
Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Daniel Scheller [Sun, 9 Apr 2017 19:38:28 +0000 (16:38 -0300)]
[media] ddbridge: hardware IDs for new C2T2 cards and other devices
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>
Daniel Scheller [Sun, 9 Apr 2017 19:38:27 +0000 (16:38 -0300)]
[media] ddbridge: support for Sony CXD28xx C/C2/T/T2 tuner modules
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>
Daniel Scheller [Sun, 9 Apr 2017 19:38:26 +0000 (16:38 -0300)]
[media] ddbridge: add I2C functions, add XO2 module support
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>
Daniel Scheller [Sun, 9 Apr 2017 19:38:25 +0000 (16:38 -0300)]
[media] ddbridge: board control setup, ts quirk flags
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>
Daniel Scheller [Sun, 9 Apr 2017 19:38:24 +0000 (16:38 -0300)]
[media] dvb-frontends/cxd2841er: improved snr reporting
On DVB-T/T2 at least, SNR might be reported as >2500dB, which not only is
just wrong but also ridiculous, so fix this by improving the conversion
of the register value.
The INTLOG10X100 function/macro and the way the values are converted were
both taken from DD's cxd2843 driver.
Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Acked-by: Abylay Ospan <aospan@netup.ru>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Daniel Scheller [Sun, 9 Apr 2017 19:38:23 +0000 (16:38 -0300)]
[media] dvb-frontends/cxd2841er: more configurable TSBITS
Bits 3 and 4 of the TSCONFIG register are important for certain hardware
constellations, in that they need to be zeroed. Add a configuration flag
to toggle this.
Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Acked-by: Abylay Ospan <aospan@netup.ru>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Daniel Scheller [Sun, 9 Apr 2017 19:38:22 +0000 (16:38 -0300)]
[media] dvb-frontends/cxd2841er: configurable IFAGCNEG
Adds a flag to enable or disable the IFAGCNEG bit in cxd2841er_init_tc().
Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Acked-by: Abylay Ospan <aospan@netup.ru>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Daniel Scheller [Sun, 9 Apr 2017 19:38:21 +0000 (16:38 -0300)]
[media] dvb-frontends/cxd2841er: make lock wait in set_fe_tc() optional
Don't wait for FE_HAS_LOCK in set_frontend_tc() and thus don't hammer the
lock status register with inquiries when CXD2841ER_NO_WAIT_LOCK is set
in the configuration, which also unneccessarily blocks applications until
a TS LOCK has been acquired. Rather, API and applications will check for
a TS LOCK by utilising the tune fe_op, read_status and get_frontend ops,
which is sufficient.
Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Acked-by: Abylay Ospan <aospan@netup.ru>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Daniel Scheller [Sun, 9 Apr 2017 19:38:20 +0000 (16:38 -0300)]
[media] dvb-frontends/cxd2841er: optionally tune earlier in set_frontend()
When AUTO_IFHZ is set and the tuner is supposed to provide proper IF speed
values, it should be possible to have the tuner setup take place before
the demod is configured, else the demod might be configured with either
wrong (old), or even no values at all, which obviously will cause issues.
To set this behaviour in the most flexible way, this is done with a
separate flag instead of making this depend on AUTO_IFHZ.
It should be evaluated if tuning shouldn't take place earlier in all cases
and hardware constellations.
Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Acked-by: Abylay Ospan <aospan@netup.ru>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Daniel Scheller [Sun, 9 Apr 2017 19:38:19 +0000 (16:38 -0300)]
[media] dvb-frontends/cxd2841er: make ASCOT use optional
The Sony CXD28xx demods may have other tuner types attached to them (e.g.
NXP TDA18212), so don't mandatorily configure and enable the ASCOT
functionality, but make this conditional by a config flag.
Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Acked-by: Abylay Ospan <aospan@netup.ru>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Daniel Scheller [Sun, 9 Apr 2017 19:38:18 +0000 (16:38 -0300)]
[media] dvb-frontends/cxd2841er: TS_SERIAL config flag
Some constellations work/need a serial TS transport mode. This adds a flag
that will toggle set up of such mode.
Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Acked-by: Abylay Ospan <aospan@netup.ru>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Daniel Scheller [Sun, 9 Apr 2017 19:38:17 +0000 (16:38 -0300)]
[media] dvb-frontends/cxd2841er: support IF speed calc from tuner values
Add a AUTO_IFHZ flag and a function that will read IF speed values from any
attached tuner if the tuner supports this and if AUTO_IFHZ is enabled, and
else the passed default value (which probably matches Sony ASCOT tuners)
will be passed back. The returned value is then used to calculate the iffeq
which the demod will be programmed with.
Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Acked-by: Abylay Ospan <aospan@netup.ru>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Daniel Scheller [Sun, 9 Apr 2017 19:38:16 +0000 (16:38 -0300)]
[media] dvb-frontends/cxd2841er: make call to i2c_gate_ctrl optional
Some cards/bridges wrap i2c_gate_ctrl handling with a mutex_lock(). This is
e.g. done in ddbridge to protect against concurrent tuner access with
regards to the dual tuner HW, where concurrent tuner reconfiguration can
result in tuning fails or bad reception quality. When the tuner driver
additionally tries to open the I2C gate (which e.g. the tda18212 driver
does) when the demod already did this, this will lead to a deadlock. This
makes the calls to i2c_gatectrl from the demod driver optional when the
flag is set, leaving this to the tuner driver. For readability reasons and
to not have the check duplicated multiple times, the setup is factored
into cxd2841er_tuner_set().
This commit also updates the netup card driver (which seems to be the only
consumer of the cxd2841er as of now).
Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Acked-by: Abylay Ospan <aospan@netup.ru>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Daniel Scheller [Sun, 9 Apr 2017 19:38:15 +0000 (16:38 -0300)]
[media] dvb-frontends/cxd2841er: add variable for configuration flags
Throughout the patch series some configuration flags will be added to the
demod driver. This patch prepares this by adding the flags var to
struct cxd2841er_config, which will serve as a bitmask to toggle various
options and behaviour in the driver.
Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Acked-by: Abylay Ospan <aospan@netup.ru>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Daniel Scheller [Sun, 9 Apr 2017 19:38:14 +0000 (16:38 -0300)]
[media] dvb-frontends/cxd2841er: replace IFFREQ calc macros into functions
The way the MAKE_IFFREQ_CONFIG macros are written make it impossible to
pass regular integers for iffreq calculation, since this will cause "SSE
register return with SSE disabled" compile errors. This changes the
calculation into C functions which also might help when debugging. Also,
expand all passed frequencies from MHz to Hz scale.
Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Acked-by: Abylay Ospan <aospan@netup.ru>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Daniel Scheller [Sun, 9 Apr 2017 19:38:13 +0000 (16:38 -0300)]
[media] dvb-frontends/cxd2841er: support CXD2837/38/43ER demods/Chip IDs
Those demods are programmed in the same way as the CXD2841ER/54ER and can
be handled by this driver. Support added in a way matching the existing
code, supported delivery systems are set according to what each demod
supports.
Updates the type string setting used for printing the "attaching..." log
line aswell.
Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Acked-by: Abylay Ospan <aospan@netup.ru>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Daniel Scheller [Sun, 9 Apr 2017 19:38:12 +0000 (16:38 -0300)]
[media] dvb-frontends/cxd2841er: immediately unfreeze regs when done
Do unfreeze_regs() directly when accessing the demod registers is done,
and don't have multiple unfreeze's on different conditions, which even
can get prone to errors.
Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Acked-by: Abylay Ospan <aospan@netup.ru>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Daniel Scheller [Sun, 9 Apr 2017 19:38:11 +0000 (16:38 -0300)]
[media] dvb-frontends/cxd2841er: do I2C reads in one go
Doing the I2C read operation with two calls to i2c_transfer() causes the
exclusive I2C bus lock of the underlying adapter to be released. While this
isn't an issue if only one demodulator is attached to the bus, having two
or even more causes troubles in that concurrent accesses to the different
demods will cause all kinds of issues due to wrong data being returned on
read operations (for example, the TS config register will be set wrong).
This changes the read_regs() function to do the operation in one go (by
calling i2c_transfer with the whole msg list instead of one by one) to not
loose the I2C bus lock, fixing all sorts of random runtime failures.
Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Acked-by: Abylay Ospan <aospan@netup.ru>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Daniel Scheller [Sun, 9 Apr 2017 19:38:10 +0000 (16:38 -0300)]
[media] dvb-frontends/cxd2841er: remove kernel log spam in non-debug levels
This moves the I2C debug dump into the preceding dev_dbg() call by
utilising the %*ph format macro and removes the call to
print_hex_debug_bytes().
Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Acked-by: Abylay Ospan <aospan@netup.ru>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Daniel Scheller [Wed, 29 Mar 2017 16:43:13 +0000 (13:43 -0300)]
[media] ddbridge: support STV0367-based cards and modules
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>
Daniel Scheller [Wed, 29 Mar 2017 16:43:12 +0000 (13:43 -0300)]
[media] ddbridge: add i2c_read_regs()
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>
Daniel Scheller [Wed, 29 Mar 2017 16:43:11 +0000 (13:43 -0300)]
[media] dvb-frontends/stv0367: add Digital Devices compatibility
This - in conjunction with the previous changes - makes it possible to use
the STV0367 DVB-C/T demodulator driver with Digital Devices hardware having
this demodulator soldered on them (namely CineCTv6 bridges and some earlier
DuoFlex CT addon modules).
The changes do the following:
- add a third *_attach function which will make use of a third frontend_ops
struct which announces both -C and -T support (the same as with DD's own
driver stv0367dd). This is necessary to support both delivery systems
on one FE without having to do large conversions to VB2 or the need to
select either -C or -T mode via modparams and the like. Additionally,
the frontend_ops point to new "glue" functions which will then call into
the existing functionality depending on the active delivery system/demod
state (all used functionality works almost OOTB).
- Demod initialisation has been ported from stv0367dd. DD's driver always
does a full init of both OFDM and QAM cores, with some additional things.
The active delivery system is remembered and upon switch, the Demod will
be reconfigured to work in OFDM or QAM mode (that's what the ddb_setup_XX
functions are used for). Note that in QAM mode, the DD demods work with
an IC speed of 58Mhz. It's not very good to perform full reinits upon
Demod mode changes since in very rare occasions this can lead to the I2C
interface or the whole Demod to crash, requiring a powercycle, thus the
flag to perform full reinit is set to disabled.
- A little enum is added for named identifiers of the current Demod state.
Initialisation code/register writes originate from stv0367dd. Permission
to reuse was formally granted by Ralph Metzler <rjkm@metzlerbros.de>.
Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Daniel Scheller [Wed, 29 Mar 2017 16:43:10 +0000 (13:43 -0300)]
[media] dvb-frontends/stv0367: add defaults for use w/DD-branded devices
Digital Devices uses defaults tables in their stv0367dd demod driver
variant which differ in a few registers, at least enough that no stable
operation can be provided with the tables already present in the driver
(init succeeds and DVB reception works but at least when the driver is
reloaded using rmmod/modprobe, the demod goes into a crashed state in a
way it doesn't react on any I2C command anymore, while even more
side-effects may occur), so there's a good reason to better have another
set of defaults.
Defaults originating from the stv0367dd driver. Permission to reuse them
was formally granted by Ralph Metzler <rjkm@metzlerbros.de>.
Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Daniel Scheller [Wed, 29 Mar 2017 16:43:09 +0000 (13:43 -0300)]
[media] dvb-frontends/stv0367: fix symbol rate conditions in cab_SetQamSize()
The values used for comparing symbol rates and the resulting conditional
reg writes seem wrong (rates multiplied by ten), so fix those values.
While this doesn't seem to influence operation, it should be fixed anyway.
Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Daniel Scheller [Wed, 29 Mar 2017 16:43:08 +0000 (13:43 -0300)]
[media] dvb-frontends/stv0367: selectable QAM FEC Lock status register
In some configurations (due to different PIN config, wiring or so), the
QAM FECLock might be signalled using a different register than
F367CAB_QAMFEC_LOCK (e.g. F367CAB_DESCR_SYNCSTATE on Digital Devices hw),
so make that register selectable.
Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Daniel Scheller [Wed, 29 Mar 2017 16:43:07 +0000 (13:43 -0300)]
[media] dvb-frontends/stv0367: support reading if_khz from tuner config
Currently, if_khz is set and provided using the configuration var in
struct stv0367_config. However, in some constellations, the value might be
different for differing channel bandwidths or even -T and -C operation.
When e.g. used in conjunction with TDA18212 tuners, the tuner frontend
might be aware of the different freqs. This factors if_khz retrieval in a
function, which checks a new flag if an automatic retrieval attempt should
be made, and if the tuner provides it, use it whenever needed.
Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Daniel Scheller [Wed, 29 Mar 2017 16:43:06 +0000 (13:43 -0300)]
[media] dvb-frontends/stv0367: make full reinit on set_frontend() optional
Every time dvb_frontend_ops.set_frontend() is called, an almost full reinit
of the demodulator will be performed. While this might cause a slight delay
when switching channels due to all involved tables being rewritten, it can
even be dangerous in certain causes in that the demod may lock up and
requires to be powercycled (this can happen on Digital Devices hardware).
So this adds a flag if it should be done, and to not change behaviour with
existing card support, it'll be enabled in all cases.
Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Daniel Scheller [Wed, 29 Mar 2017 16:43:05 +0000 (13:43 -0300)]
[media] dvb-frontends/stv0367: make PLLSETUP a function, add 58MHz IC speed
This moves the PLL SETUP code from stv0367ter_init() into a dedicated
function, and also make it possible to configure 58Mhz IC speed at
27MHz Xtal (used on STV0367-based DDB cards/modules in QAM mode).
Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Daniel Scheller [Wed, 29 Mar 2017 16:43:04 +0000 (13:43 -0300)]
[media] dvb-frontends/stv0367: move out tables, support multiple tab variants
Move the *ter and *cab st_register tables into a separate header file and
additionally organize them via a multidimensional array, allowing to add
more tables with differing init values, and also prepare for a base init
table which should contain general setup values. Also add a state var to
store the table triplet to be used.
Also fixes three minor style problems reported by checkpatch.
Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Daniel Scheller [Wed, 29 Mar 2017 16:43:03 +0000 (13:43 -0300)]
[media] dvb-frontends/stv0367: refactor defaults table handling
Change defaults table writing so tables can be of dynamic length without
having to keep track of their lengths by adding and evaluating an end
marker (reg 0x0000), also move table writing to a dedicated function to
remove code duplication. Additionally mark st_register tables const since
they're used read-only.
Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Daniel Scheller [Wed, 29 Mar 2017 16:43:02 +0000 (13:43 -0300)]
[media] dvb-frontends/stv0367: print CPAMP status only if stv_debug is enabled
The CPAMP log lines generated in stv0367_ter_check_cpamp() are printed
everytime tuning succeeds or fails, quite cluttering the normal kernel log.
Use dprintk() instead of printk(KERN_ERR...) so that if the information is
needed, it'll be printed when the stv_debug modparam is enabled.
Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Daniel Scheller [Wed, 29 Mar 2017 16:43:01 +0000 (13:43 -0300)]
[media] dvb-frontends/stv0367: add flag to make i2c_gatectrl optional
Some hardware and bridges (namely ddbridge) require that tuner access is
limited to one concurrent access and wrap i2c gate control with a
mutex_lock when attaching frontends. According to vendor information, this
is required as concurrent tuner reconfiguration can interfere each other
and at worst cause tuning fails or bad reception quality.
If the demod driver does gate_ctrl before setting up tuner parameters, and
the tuner does another I2C enable, it will deadlock forever when gate_ctrl
is wrapped into the mutex_lock. This adds a flag and a conditional before
triggering gate_ctrl in the demodulator driver.
Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Marek Szyprowski [Mon, 19 Jun 2017 12:19:46 +0000 (09:19 -0300)]
[media] s5p-cec: update MAINTAINERS entry
I would like to replace Kyungmin Park, who is no longer interested in
maintaining S5P-CEC driver. I have access to various Exynos boards. I also
already did some tests of this driver and helped enabling it on various
Exynos boards. The driver itself is no longer in staging, so lets fix the
path too and add DT bindings file pattern match. Also change the mailing
list from ARM generic to Samsung SoC specific to get more attention and
easier review in the future.
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Tomasz Figa [Mon, 19 Jun 2017 03:53:43 +0000 (00:53 -0300)]
[media] v4l2-core: Use kvmalloc() for potentially big allocations
There are multiple places where arrays or otherwise variable sized
buffer are allocated through V4L2 core code, including things like
controls, memory pages, staging buffers for ioctls and so on. Such
allocations can potentially require an order > 0 allocation from the
page allocator, which is not guaranteed to be fulfilled and is likely to
fail on a system with severe memory fragmentation (e.g. a system with
very long uptime).
Since the memory being allocated is intended to be used by the CPU
exclusively, we can consider using vmalloc() as a fallback and this is
exactly what the recently merged kvmalloc() helpers do. A kmalloc() call
is still attempted, even for order > 0 allocations, but it is done
with __GFP_NORETRY and __GFP_NOWARN, with expectation of failing if
requested memory is not available instantly. Only then the vmalloc()
fallback is used. This should give us fast and more reliable allocations
even on systems with higher memory pressure and/or more fragmentation,
while still retaining the same performance level on systems not
suffering from such conditions.
While at it, replace explicit array size calculations on changed
allocations with kvmalloc_array().
Purposedly not touching videobuf1, as it is deprecated, has only few
users remaining and would rather be seen removed instead.
Signed-off-by: Tomasz Figa <tfiga@chromium.org>
Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Niklas Söderlund [Thu, 15 Jun 2017 09:17:26 +0000 (06:17 -0300)]
[media] media: entity: Add media_entity_get_fwnode_pad() function
This is a wrapper around the media entity get_fwnode_pad operation.
Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Niklas Söderlund [Thu, 15 Jun 2017 09:17:25 +0000 (06:17 -0300)]
[media] media: entity: Add get_fwnode_pad entity operation
The optional operation can be used by entities to report how it maps its
fwnode endpoints to media pad numbers. This is useful for devices which
require advanced mappings of pads.
Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Niklas Söderlund [Tue, 13 Jun 2017 14:30:35 +0000 (11:30 -0300)]
[media] v4l: async: check for v4l2_dev in v4l2_async_notifier_register()
Add a check for v4l2_dev to v4l2_async_notifier_register() as to fail as
early as possible since this will fail later in v4l2_async_test_notify().
Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Kieran Bingham [Mon, 12 Jun 2017 10:30:16 +0000 (07:30 -0300)]
[media] media: fdp1: Support ES2 platforms
The new Renesas R-Car H3 ES2.0 platforms have a new hw version register.
Update the driver accordingly, defaulting to the new hw revision, and
differentiating the older revision as ES1
Signed-off-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Gustavo A. R. Silva [Thu, 15 Jun 2017 16:49:14 +0000 (13:49 -0300)]
[media] i2c: tc358743: remove useless variable assignment in tc358743_isr
Remove useless variable assignment in function tc358743_isr().
The value stored in variable _intstatus_ at line 1299 is
overwritten at line 1302, just before it can be used.
Addresses-Coverity-ID: 1397678
Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Andrey Utkin [Sun, 11 Jun 2017 21:38:39 +0000 (18:38 -0300)]
[media] MAINTAINERS: solo6x10: update Andrey Utkin email
Updating my personal email address in solo6x10.
Signed-off-by: Andrey Utkin <andrey.utkin@corp.bluecherry.net>
Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Andrey Utkin [Sun, 11 Jun 2017 21:38:38 +0000 (18:38 -0300)]
[media] MAINTAINERS: solo6x10, tw5864: add Anton Sviridenko
Anton Sviridenko is now in charge of drivers in Bluecherry.
Signed-off-by: Andrey Utkin <andrey.utkin@corp.bluecherry.net>
Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Kevin Hilman [Fri, 9 Jun 2017 16:10:26 +0000 (13:10 -0300)]
[media] davinci: vpif: adaptions for DT support
The davinci VPIF is a single hardware block, but the existing driver
is broken up into a common library (vpif.c), output (vpif_display.c) and
intput (vpif_capture.c).
When migrating to DT, to better model the hardware, and because
registers, interrupts, etc. are all common,it was decided to
have a single VPIF hardware node[1].
Because davinci uses legacy, non-DT boot on several SoCs still, the
platform_drivers need to remain. But they are also needed in DT boot.
Since there are no DT nodes for the display/capture parts in DT
boot (there is a single node for the parent/common device) we need to
create platform_devices somewhere to instantiate the platform_drivers.
When VPIF display/capture are needed for a DT boot, the VPIF node
will have endpoints defined for its subdevs. Therefore, vpif_probe()
checks for the presence of endpoints, and if detected manually creates
the platform_devices for the display and capture platform_drivers.
[1] Documentation/devicetree/bindings/media/ti,da850-vpif.txt
Signed-off-by: Kevin Hilman <khilman@baylibre.com>
Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Christophe JAILLET [Sun, 23 Apr 2017 21:40:30 +0000 (18:40 -0300)]
[media] vb2: Fix error handling in '__vb2_buf_mem_alloc'
'call_ptr_memop' can return NULL, so we must test its return value with
'IS_ERR_OR_NULL'. Otherwise, the test 'if (mem_priv)' is meaningless.
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Lucas Stach [Wed, 5 Apr 2017 13:09:55 +0000 (10:09 -0300)]
[media] coda/imx-vdoa: always wait for job completion
As long as only one CODA context is running we get alternating device_run()
and wait_for_completion() calls, but when more then one CODA context is
active, other VDOA slots can be inserted between those calls for one context.
Make sure to wait on job completion before running a different context and
before destroying the currently active context.
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Lucas Stach [Wed, 5 Apr 2017 13:09:54 +0000 (10:09 -0300)]
[media] coda: first step at error recovery
This implements a simple handler for the case where decode did not finish
sucessfully. This might be helpful during normal streaming, but for now it
only handles the case where the context would deadlock with userspace,
i.e. userspace issued DEC_CMD_STOP and waits for EOS, but after the failed
decode run we would hold the context and wait for userspace to queue more
buffers.
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Lucas Stach [Wed, 5 Apr 2017 13:09:53 +0000 (10:09 -0300)]
[media] coda: use correct offset for mvcol buffer
The mvcol buffer needs to be placed behind the chroma plane(s), so
use the real offset including any required rounding.
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Stanimir Varbanov [Thu, 15 Jun 2017 16:31:59 +0000 (13:31 -0300)]
[media] media: venus: update firmware path with linux-firmware place
This makes firmware name and path part of venus_resources
structure and initialize it properly depending on the SoC and
firmware version.
Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>