Move the ts bus control function moved higher, enabling it
after configuring frontend and removeing ts_bus_ctrl callback.
While here, also add an error checking and re-add a comment
that were removed by commit 445877742c ("media: si2168:
Add ts bus coontrol, turn off bus on sleep").
[mchehab@s-opensource.com: I ended by applying the first version,
instead of the right one. So, this patch contains the diff and
the v2 changelog instead]
Fixes: 445877742c ("media: si2168: Add ts bus coontrol, turn off bus on sleep")
Signed-off-by: Brad Love <brad@nextdimension.cc>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Rework both DiSEqC send functions (send_master_cmd() and send_burst()) to
utilise the new SET_REG() and SET_FIELD() macros. Esp. due to SET_FIELD(),
this makes sure that not all bits (with unrelated purposes) are always
rewritten, but only those needed for sending DiSEqC commands. In
send_burst(), this makes sure that DISEQC_MODE isn't changed from 3 to 2
inbetween when sending SEC_MINI_A. Also, change both functions to write
DISEQC_MODE first before setting DIS_PRECHARGE. This makes diseqc control
work more reliable for "fullblown" DiSEqC strings in VDR's diseqc.conf in
combination with certain multiswitches.
Fixes: 448461af0e ("media: dvb-frontends/stv0910: implement diseqc_send_burst")
Reported-by: Helmut Auer <post@helmutauer.de>
Cc: Ralph Metzler <rjkm@metzlerbros.de>
Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Tested-by: Helmut Auer <post@helmutauer.de>
Tested-by: Richard Scobie <rascobie@slingshot.co.nz>
Tested-by: Dietmar Spingler <d_spingler@freenet.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
According to the TODO file, this driver only landed in staging because of
the way device nodes and data transfers are handled. Besides that this way
(use of secX devices) has become sort of standard to date (ie. VDR
supports this literally since ages via the ddci plugin, TVHeadend received
this functionality lately, and minisatip being currently worked on
regarding this), most importantly this I2C client only driver isn't even
responsible for setting up device nodes, not for handling data
transfer and so on, but only serves as interface for the dvb_ca_en50221
subsystem, just like every other DVB card out in the wild, with hard-wired
or such flexible CA interfaces. And, it would even work with cards having
the cxd2099 controller hard-wired.
Also, this driver received quite some love and even is a proper I2C client
driver by now. So, as this driver acts as a EN50221 frontend device, move
it to dvb-frontends. There is no need to keep it buried in staging.
This commit also updates all affected Kconfig and Makefile's, and adds
MEDIA_AUTOSELECT depends to ddbridge and ngene.
Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Jasmin Jessich <jasmin@anw.at>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Change the way the cxd2099 hardware is being attached to the new I2C
client interface way.
Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Jasmin Jessich <jasmin@anw.at>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Convert the cxd2099 driver to use regmap for I2C accesses, removing all
own i2c_*() functions. With that, make the driver a proper I2C client
driver. This also adds the benefit of having a proper cleanup function
(cxd2099_remove() in this case) that takes care of resource cleanup
upon I2C client deregistration.
At this point, keep the static inline declared cxd2099_attach()
function so that drivers using the legacy/proprietary style attach way
still compile, albeit lacking the cxd2099 driver functionality. This
is taken care of in the next two patches.
Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Jasmin Jessich <jasmin@anw.at>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Deduplicate the checks for a valid ptr in port->en, and also handle the
default case to also catch eventually yet unsupported CI hardware.
Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Due to a typo, the mask was destroyed by a comparison instead of a bit
shift.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
The PLAT_S5P symbol was removed in commit d78c16ccde ("ARM: SAMSUNG:
Remove remaining legacy code").
Remove the PLAT_S5P dependency from VIDEO_SAMSUNG_S5P_CEC.
Discovered with the
https://github.com/ulfalizer/Kconfiglib/blob/master/examples/list_undefined.py
script.
Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Thoses files are unused since commit b3b961448f ("V4L/DVB (13795): [Mantis/Hopper] Code overhaul, add Hopper devices into the PCI ID list")
8 year after, we could remove it.
Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
bsp_i2c.h is unused since commit ffe7c4f921 ("[media] drx-j: Get rid of drx39xyj/bsp_tuner.h")
Remove it from tree.
Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Instead of directly accessing to dmadev->device_prep_interleaved_dma() use
the dmaengine_prep_interleaved_dma() wrapper instead.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Hauppauge Solo/Dual HD DVB models use a si2157 tuner, which is set to
produce inverted spectrum. This configures the si2168 DVB demod for
inverted spectrum on both affected models.
[mchehab@s-opensource.com: rebased on the top of upstream]
Signed-off-by: Brad Love <brad@nextdimension.cc>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Some tuners produce inverted spectrum, but the si2168 is not
currently set up to accept it. This adds an optional parameter
to set the frontend up to receive inverted spectrum.
Parameter is optional and only boards who enable inversion
will utilize this.
Signed-off-by: Brad Love <brad@nextdimension.cc>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
While experimenting with older compiler versions, I ran
into a warning that no longer shows up on gcc-4.8 or newer:
drivers/media/platform/s3c-camif/camif-capture.c: In function '__camif_subdev_try_format':
drivers/media/platform/s3c-camif/camif-capture.c:1265:25: error: array subscript is below array bounds
This is an off-by-one bug, leading to an access before the start of the
array, while newer compilers silently assume this undefined behavior
cannot happen and leave the loop at index 0 if no other entry matches.
As Sylvester explains, we actually need to ensure that the
value is within the range, so this reworks the loop to be
easier to parse correctly, and an additional check to fall
back on the first format value for any unexpected input.
I found an existing gcc bug for it and added a reduced version
of the function there.
Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69249#c3
Fixes: babde1c243 ("[media] V4L: Add driver for S3C24XX/S3C64XX SoC series camera interface")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
The driver outputs on success, but is silent on failure. Give
one message that probe failed.
Signed-off-by: Brad Love <brad@nextdimension.cc>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
The driver is near silent, this adds a simple announcement at the
end of probe after the chip has been detected and upgrades a debug
message to error if probe has failed.
Signed-off-by: Brad Love <brad@nextdimension.cc>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Includes a function to set TS MODE property os si2168. The function
either disables the TS output bus, or sets mode to config option.
When going to sleep the TS bus is turned off, this makes the driver
compatible with multiple frontend usage.
Signed-off-by: Brad Love <brad@nextdimension.cc>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Include ability to add a i2c device style frontend to cx231xx USB
bridge. All current boards set to use frontend[0]. Changes are
backwards compatible with current behaviour.
Signed-off-by: Brad Love <brad@nextdimension.cc>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Include ability to add a second dvb attach style frontend to cx231xx
USB bridge. All current boards set to use frontend[0]. Changes are
backwards compatible with current behaviour.
[mchehab@s-opensource.com: fix some coding style issues]
Signed-off-by: Brad Love <brad@nextdimension.cc>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Commit f8585ce655 ("[media] dvb-usb-cxusb: Geniatech T230C support")
sneaked in an unrelated change for the older T230 (not C) model.
As the commit was reverted this change was reverted too,
although likely correct.
Fixes: f8585ce655 ("[media] dvb-usb-cxusb: Geniatech T230C support")
Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
This reverts commit f8585ce655.
The T230C is handled by the dvb-usb-v2/dvbsky.c driver, which should
be preferred over a dvb-usb (v1) driver.
Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Hauppauge HVR-975 is hybrid NTSC/PAL, QAM/ATSC, and DVB-C/T/T2 usb device.
Only ATSC/QAM front end is initially active. Second frontend support is
work in progress.
CX23102 + LG3306A/Si2168(WiP) + Si2157
Changes since v1:
- removed double semicolon
Signed-off-by: Brad Love <brad@nextdimension.cc>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
gcc-8 reports
drivers/media/dvb-frontends/dibx000_common.c: In function
'i2c_adapter_init':
./include/linux/string.h:245:9: warning: '__builtin_strncpy' specified
bound 48 equals destination size [-Wstringop-truncation]
We need to use strlcpy() to make sure the dest string is
nul-terminated.
Signed-off-by: Xiongfeng Wang <xiongfeng.wang@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Don't populate the const read-only array 'cmd' on the stack but instead
make it static. Makes the object code smaller by 38 bytes:
Before:
text data bss dec hex filename
4950 868 0 5818 16ba fimc-is-regs.o
After:
text data bss dec hex filename
4824 956 0 5780 1694 fimc-is-regs.o
(gcc version 7.2.0 x86_64)
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Add new QuadHD digital only PCIe boards to driver list.
Differentiate them from 888 digital/analog QuadHD models.
Signed-off-by: Brad Love <brad@nextdimension.cc>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Add new PCIe DVB-S/S2.
A single port Hauppauge HVR-5525
cx23885 + a8293 + m88rs6000t
Signed-off-by: Brad Love <brad@nextdimension.cc>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Add ID of new card revision to driver list
Analog PAL/NTSC capture.
Signed-off-by: Brad Love <brad@nextdimension.cc>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
There are a number of coding style issues at em28xx-video.
Fix most of them, by using checkpatch in strict mode to point
for it.
Automatic fixes were made with --fix-inplace, but those
were complemented by manual work.
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
There are a number of coding style issues at em28xx-input.
Fix most of them, by using checkpatch in strict mode to point
for it.
Automatic fixes were made with --fix-inplace, but those
were complemented by manual work.
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
There are a number of coding style issues at em28xx-i2c.
Fix most of them, by using checkpatch in strict mode to point
for it.
Automatic fixes were made with --fix-inplace, but those
were complemented by manual work.
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
There are a number of coding style issues at em28xx-core.
Fix most of them, by using checkpatch in strict mode to point
for it.
Automatic fixes were made with --fix-inplace, but those
were complemented by manual work.
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
There is a complex loop there with identifies the em28xx
endpoints. It has lots of identations inside, and big names,
making harder to understand.
Simplify it by moving the main logic into a static function.
While here, rename "interface" var to "intf".
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
There are a number of coding style issues, pointed by checkpatch
on strict mode.
Fix the ones that don't require code refactor here.
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
There are some coding style issues at em28xx-camera.
Fix them, by using checkpatch in strict mode to point for it.
Automatic fixes with --fix-inplace were complemented by manual
work.
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
There are a number of coding style issues at em28xx-audio.
Fix them, by using checkpatch in strict mode to point for it.
Automatic fixes with --fix-inplace were complemented by manual
work.
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Use BIT() macros and fix one comment that is not following
the Kernel coding style.
It should be noticed that the registers bit masks should be
casted to unsigned char, as, otherwise, it would produce
warnings like:
drivers/media/usb/em28xx/em28xx-cards.c:81:33: warning: large integer implicitly truncated to unsigned type [-Woverflow]
{EM2820_R08_GPIO_CTRL, 0x6d, ~EM_GPIO_4, 10},
^
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
There used to have a lot of coding style issues there. The
ones detected by checkpatch, in strict mode, got fixed.
Still, we need to work more on it, in order to document all
struct fields using kernel-doc macros, but this will be done
on some future patch.
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Most of the files there are missing a SPDX license tag. Add.
While here fix some DRIVER_LICENSE macro in order to reflect
the source file license, as some of the headers are GPL v2
only.
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
As we're touching a lot on this file, let's solve several
Coding Style issues there using checkpatch --fix-inline --strict,
and manually adjusting the results.
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
There is a typo at the several s5h14*.h headers: continuous were
spelled incorrectly.
Fix it with this script:
for i in $(git grep -l S5H1409_MPEGTIMING_CONTINOUS_NONINVERTING_CLOCK); do
sed s,S5H1409_MPEGTIMING_CONTINOUS_NONINVERTING_CLOCK,S5H1409_MPEGTIMING_CONTINUOUS_NONINVERTING_CLOCK,g -i $i
done
for i in $(git grep -l -i continous drivers/media); do sed s,CONTINOUS,CONTINUOUS,g -i $i; done
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
The module probing logic there is a way more complex than
it should be, and requires some special magic to avoid
stack overflows when KASAN is enabled.
Solve it by creating ancillary functions to setup the
platform data and request module.
Now, the probing functions are cleaner and easier to understand.
As a side effect, the size of the module was reduced by
about 9.7% on x86_64:
Before this patch:
text data bss dec hex filename
51090 14192 96 65378 ff62 drivers/media/usb/em28xx/em28xx-dvb.o
After this patch:
text data bss dec hex filename
44743 14192 96 59031 e697 drivers/media/usb/em28xx/em28xx-dvb.o
Tested with a PCTV 461e device.
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
The dvb_attach()/dvb_detach() methods are ugly hacks designed
to keep using the I2C low-level API. The proper way is to
do I2C bus bindings instead.
Several modules were already converted to use it. Yet,
it is painful to use it, as lots of code need to be
duplicated.
Make it easier by providing two new helper functions:
- dvb_module_probe()
- dvb_module_release()
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
With CONFIG_KASAN, the init function uses a large amount of kernel stack:
drivers/media/usb/em28xx/em28xx-dvb.c: In function 'em28xx_dvb_init.part.4':
drivers/media/usb/em28xx/em28xx-dvb.c:2061:1: error: the frame size of 3232 bytes is larger than 2048 bytes [-Werror=frame-larger-than=]
Using gcc-7 with -fsanitize-address-use-after-scope makes this even worse:
drivers/media/usb/em28xx/em28xx-dvb.c: In function 'em28xx_dvb_init':
drivers/media/usb/em28xx/em28xx-dvb.c:2069:1: error: the frame size of 4280 bytes is larger than 3072 bytes [-Werror=frame-larger-than=]
By splitting out each part of the switch/case statement that has its own local
variables into a separate function, no single one of them uses more than 500 bytes,
and with a noinline_for_stack annotation we can ensure that they are not merged
back together.
[mchehab@s-opensource.com: fix conflict with changeset
be7fd3c3a8 ("media: em28xx: Hauppauge DualHD second tuner functionality")]
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Mauro Carvalho Chehab <>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
If the I2C speed is too slow, it should wait more for an
answer.
While here, change disconnected type from char to unsigned
int, just like all other bitmask fields there at em28xx
struct.
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
There are several em28xx static structs that can now be constified.
That caused a significant reduction at data segment:
Before:
text data bss dec hex filename
85017 59588 576 145181 2371d drivers/media/usb/em28xx/em28xx.o
After:
text data bss dec hex filename
112345 32292 576 145213 2373d drivers/media/usb/em28xx/em28xx.o
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Writing at the device's struct is evil, as two em28xx devices
may be using it. So, stop abusing it, storing the values
inside struct em28xx_dev.
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>